From: support Date: Tue, 5 Apr 2022 07:40:37 +0000 (+0000) Subject: Built motion from commit 54cdaf16.|2.6.6 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=adc1306595bdb67b3d3f5ae7e7a52c545cf3da8c;p=motion2.git Built motion from commit 54cdaf16.|2.6.6 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1787d93..a9dc25c 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-05T07:13:16.004Z", + "time": "2022-04-05T07:32:54.026Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index fd00633..51a95e2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-05T07:13:16.004Z", + "time": "2022-04-05T07:32:54.026Z", "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 5e6d606..5eeb89e 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 _0x4f94=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','bot'];(function(_0x1eb4e0,_0x4ebc2d){var _0x18ec21=function(_0x28c9a9){while(--_0x28c9a9){_0x1eb4e0['push'](_0x1eb4e0['shift']());}};_0x18ec21(++_0x4ebc2d);}(_0x4f94,0x1a9));var _0x44f9=function(_0x23a8e3,_0x3a26ac){_0x23a8e3=_0x23a8e3-0x0;var _0x5d3e58=_0x4f94[_0x23a8e3];return _0x5d3e58;};'use strict';var Sequelize=require(_0x44f9('0x0'));module[_0x44f9('0x1')]={'name':{'type':Sequelize[_0x44f9('0x2')],'get':function(_0x477bca){return this[_0x44f9('0x3')](_0x44f9('0x4'));}},'action':{'type':Sequelize[_0x44f9('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x44f9('0x6'),_0x44f9('0x7'),_0x44f9('0x8'),'jscripty','urlForward','browser',_0x44f9('0x9'),_0x44f9('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x44f9('0xb')},'data1':{'type':Sequelize[_0x44f9('0x5')](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[_0x44f9('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x44f9('0x5')](0x1000),'comment':_0x44f9('0xc')},'data4':{'type':Sequelize[_0x44f9('0x5')](0x1000),'comments':_0x44f9('0xd')},'data5':{'type':Sequelize[_0x44f9('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x44f9('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x44f9('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x3404=['urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]','TEXT'];(function(_0x33d144,_0xc5ae3f){var _0x42ed21=function(_0x5ad189){while(--_0x5ad189){_0x33d144['push'](_0x33d144['shift']());}};_0x42ed21(++_0xc5ae3f);}(_0x3404,0xc9));var _0x4340=function(_0x3b0b50,_0x31607c){_0x3b0b50=_0x3b0b50-0x0;var _0x39b3a3=_0x3404[_0x3b0b50];return _0x39b3a3;};'use strict';var Sequelize=require(_0x4340('0x0'));module[_0x4340('0x1')]={'name':{'type':Sequelize[_0x4340('0x2')],'get':function(_0x5849ef){return this[_0x4340('0x3')]('action');}},'action':{'type':Sequelize[_0x4340('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4340('0x5'),_0x4340('0x6'),_0x4340('0x7'),_0x4340('0x8'),_0x4340('0x9'),_0x4340('0xa'),'bot',_0x4340('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4340('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x4340('0x4')](0x1000),'comment':_0x4340('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4340('0xe')},'data4':{'type':Sequelize[_0x4340('0x4')](0x1000),'comments':_0x4340('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x4340('0x10')},'data6':{'type':Sequelize[_0x4340('0x4')],'comments':_0x4340('0x11')},'data7':{'type':Sequelize[_0x4340('0x12')],'comments':_0x4340('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cbc8ef9..97e6137 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 _0x2714=['sendStatus','error','name','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','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','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy'];(function(_0xcb016b,_0x54f052){var _0x187501=function(_0x59d61f){while(--_0x59d61f){_0xcb016b['push'](_0xcb016b['shift']());}};_0x187501(++_0x54f052);}(_0x2714,0x178));var _0x4271=function(_0x3673ee,_0x37b638){_0x3673ee=_0x3673ee-0x0;var _0x7a5b8d=_0x2714[_0x3673ee];return _0x7a5b8d;};'use strict';var emlformat=require(_0x4271('0x0'));var rimraf=require(_0x4271('0x1'));var zipdir=require(_0x4271('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4271('0x3'));var moment=require(_0x4271('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4271('0x5'));var util=require(_0x4271('0x6'));var path=require('path');var sox=require(_0x4271('0x7'));var csv=require('to-csv');var ejs=require(_0x4271('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4271('0x9'));var squel=require(_0x4271('0xa'));var crypto=require('crypto');var jsforce=require(_0x4271('0xb'));var deskjs=require(_0x4271('0xc'));var toCsv=require(_0x4271('0xd'));var querystring=require(_0x4271('0xe'));var Papa=require(_0x4271('0xf'));var Redis=require(_0x4271('0x10'));var authService=require(_0x4271('0x11'));var qs=require(_0x4271('0x12'));var as=require(_0x4271('0x13'));var hardwareService=require(_0x4271('0x14'));var logger=require(_0x4271('0x15'))(_0x4271('0x16'));var utils=require(_0x4271('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4271('0x18'))['db'];function respondWithStatusCode(_0x1ce90c,_0x535c57){_0x535c57=_0x535c57||0xcc;return function(_0x4bee4b){if(_0x4bee4b){return _0x1ce90c['sendStatus'](_0x535c57);}return _0x1ce90c['status'](_0x535c57)[_0x4271('0x19')]();};}function respondWithResult(_0x493d40,_0xb24ae8){_0xb24ae8=_0xb24ae8||0xc8;return function(_0x126e0a){if(_0x126e0a){return _0x493d40[_0x4271('0x1a')](_0xb24ae8)[_0x4271('0x1b')](_0x126e0a);}};}function respondWithFilteredResult(_0x4a64b4,_0x25b99a){return function(_0x3fe4a2){if(_0x3fe4a2){var _0x1e09ae=typeof _0x25b99a['offset']===_0x4271('0x1c')&&typeof _0x25b99a[_0x4271('0x1d')]===_0x4271('0x1c');var _0x87d981=_0x3fe4a2[_0x4271('0x1e')];var _0x538645=_0x1e09ae?0x0:_0x25b99a[_0x4271('0x1f')];var _0x3081de=_0x1e09ae?_0x3fe4a2['count']:_0x25b99a['offset']+_0x25b99a['limit'];var _0x22b9f3;if(_0x3081de>=_0x87d981){_0x3081de=_0x87d981;_0x22b9f3=0xc8;}else{_0x22b9f3=0xce;}_0x4a64b4[_0x4271('0x1a')](_0x22b9f3);return _0x4a64b4[_0x4271('0x20')](_0x4271('0x21'),_0x538645+'-'+_0x3081de+'/'+_0x87d981)[_0x4271('0x1b')](_0x3fe4a2);}return null;};}function patchUpdates(_0x3377e6){return function(_0x1594e7){try{jsonpatch[_0x4271('0x22')](_0x1594e7,_0x3377e6,!![]);}catch(_0x266d10){return BPromise['reject'](_0x266d10);}return _0x1594e7[_0x4271('0x23')]();};}function saveUpdates(_0x1ae4e5,_0x3a2a55){return function(_0x5314b9){if(_0x5314b9){return _0x5314b9['update'](_0x1ae4e5)[_0x4271('0x24')](function(_0x3f6cdb){return _0x3f6cdb;});}return null;};}function removeEntity(_0x2bc87b,_0x11d904){return function(_0xfaec14){if(_0xfaec14){return _0xfaec14[_0x4271('0x25')]()[_0x4271('0x24')](function(){_0x2bc87b['status'](0xcc)[_0x4271('0x19')]();});}};}function handleEntityNotFound(_0x5b7e15,_0x49e1ac){return function(_0x41ebb5){if(!_0x41ebb5){_0x5b7e15[_0x4271('0x26')](0x194);}return _0x41ebb5;};}function handleError(_0x4f3375,_0x4c80f6){_0x4c80f6=_0x4c80f6||0x1f4;return function(_0x249c9c){logger[_0x4271('0x27')](_0x249c9c['stack']);if(_0x249c9c[_0x4271('0x28')]){delete _0x249c9c['name'];}_0x4f3375['status'](_0x4c80f6)['send'](_0x249c9c);};}exports['update']=function(_0x9bb196,_0x4e3caa){if(_0x9bb196[_0x4271('0x29')]['id']){delete _0x9bb196[_0x4271('0x29')]['id'];}return db[_0x4271('0x2a')][_0x4271('0x2b')]({'where':{'id':_0x9bb196[_0x4271('0x2c')]['id']}})[_0x4271('0x24')](handleEntityNotFound(_0x4e3caa,null))['then'](saveUpdates(_0x9bb196[_0x4271('0x29')],null))[_0x4271('0x24')](respondWithResult(_0x4e3caa,null))[_0x4271('0x2d')](handleError(_0x4e3caa,null));};exports['destroy']=function(_0x118dbe,_0x2cf896){return db[_0x4271('0x2a')][_0x4271('0x2b')]({'where':{'id':_0x118dbe['params']['id']}})[_0x4271('0x24')](handleEntityNotFound(_0x2cf896,null))['then'](removeEntity(_0x2cf896,null))[_0x4271('0x2d')](handleError(_0x2cf896,null));}; \ No newline at end of file +var _0xb215=['stack','name','send','body','find','params','catch','eml-format','rimraf','zip-dir','bluebird','mustache','util','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error'];(function(_0x4a025d,_0x15f687){var _0x43d7fa=function(_0x5c82e3){while(--_0x5c82e3){_0x4a025d['push'](_0x4a025d['shift']());}};_0x43d7fa(++_0x15f687);}(_0xb215,0x1f3));var _0x5b21=function(_0x2dab5c,_0x4f3b9e){_0x2dab5c=_0x2dab5c-0x0;var _0x1c7bf1=_0xb215[_0x2dab5c];return _0x1c7bf1;};'use strict';var emlformat=require(_0x5b21('0x0'));var rimraf=require(_0x5b21('0x1'));var zipdir=require(_0x5b21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b21('0x3'));var Mustache=require(_0x5b21('0x4'));var util=require(_0x5b21('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b21('0x6'));var _=require(_0x5b21('0x7'));var squel=require(_0x5b21('0x8'));var crypto=require(_0x5b21('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b21('0xa'));var Papa=require(_0x5b21('0xb'));var Redis=require(_0x5b21('0xc'));var authService=require(_0x5b21('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5b21('0xe'));var hardwareService=require(_0x5b21('0xf'));var logger=require('../../config/logger')(_0x5b21('0x10'));var utils=require('../../config/utils');var config=require(_0x5b21('0x11'));var licenseUtil=require(_0x5b21('0x12'));var db=require(_0x5b21('0x13'))['db'];function respondWithStatusCode(_0x23a144,_0x846d4b){_0x846d4b=_0x846d4b||0xcc;return function(_0x196858){if(_0x196858){return _0x23a144[_0x5b21('0x14')](_0x846d4b);}return _0x23a144[_0x5b21('0x15')](_0x846d4b)[_0x5b21('0x16')]();};}function respondWithResult(_0x5d69fe,_0x317ee9){_0x317ee9=_0x317ee9||0xc8;return function(_0x14746b){if(_0x14746b){return _0x5d69fe[_0x5b21('0x15')](_0x317ee9)['json'](_0x14746b);}};}function respondWithFilteredResult(_0x1330d9,_0x32a744){return function(_0x3de1c3){if(_0x3de1c3){var _0x1f5d50=typeof _0x32a744[_0x5b21('0x17')]===_0x5b21('0x18')&&typeof _0x32a744[_0x5b21('0x19')]===_0x5b21('0x18');var _0x580b50=_0x3de1c3[_0x5b21('0x1a')];var _0x427d68=_0x1f5d50?0x0:_0x32a744[_0x5b21('0x17')];var _0x4058ae=_0x1f5d50?_0x3de1c3[_0x5b21('0x1a')]:_0x32a744[_0x5b21('0x17')]+_0x32a744[_0x5b21('0x19')];var _0x42a100;if(_0x4058ae>=_0x580b50){_0x4058ae=_0x580b50;_0x42a100=0xc8;}else{_0x42a100=0xce;}_0x1330d9[_0x5b21('0x15')](_0x42a100);return _0x1330d9[_0x5b21('0x1b')](_0x5b21('0x1c'),_0x427d68+'-'+_0x4058ae+'/'+_0x580b50)['json'](_0x3de1c3);}return null;};}function patchUpdates(_0x391c38){return function(_0x3851f8){try{jsonpatch['apply'](_0x3851f8,_0x391c38,!![]);}catch(_0x1dc3b0){return BPromise[_0x5b21('0x1d')](_0x1dc3b0);}return _0x3851f8['save']();};}function saveUpdates(_0xf7b43f,_0x3353f0){return function(_0x369e34){if(_0x369e34){return _0x369e34[_0x5b21('0x1e')](_0xf7b43f)['then'](function(_0x35de09){return _0x35de09;});}return null;};}function removeEntity(_0x50c41d,_0x4b8f8d){return function(_0x449594){if(_0x449594){return _0x449594[_0x5b21('0x1f')]()[_0x5b21('0x20')](function(){_0x50c41d[_0x5b21('0x15')](0xcc)[_0x5b21('0x16')]();});}};}function handleEntityNotFound(_0x13b759,_0x896251){return function(_0x36087a){if(!_0x36087a){_0x13b759[_0x5b21('0x14')](0x194);}return _0x36087a;};}function handleError(_0x1232db,_0x2a6071){_0x2a6071=_0x2a6071||0x1f4;return function(_0x1756af){logger[_0x5b21('0x21')](_0x1756af[_0x5b21('0x22')]);if(_0x1756af['name']){delete _0x1756af[_0x5b21('0x23')];}_0x1232db[_0x5b21('0x15')](_0x2a6071)[_0x5b21('0x24')](_0x1756af);};}exports[_0x5b21('0x1e')]=function(_0x1378a7,_0x1cfd30){if(_0x1378a7[_0x5b21('0x25')]['id']){delete _0x1378a7[_0x5b21('0x25')]['id'];}return db['Action'][_0x5b21('0x26')]({'where':{'id':_0x1378a7[_0x5b21('0x27')]['id']}})[_0x5b21('0x20')](handleEntityNotFound(_0x1cfd30,null))[_0x5b21('0x20')](saveUpdates(_0x1378a7[_0x5b21('0x25')],null))[_0x5b21('0x20')](respondWithResult(_0x1cfd30,null))['catch'](handleError(_0x1cfd30,null));};exports[_0x5b21('0x1f')]=function(_0x594a1d,_0x878205){return db['Action']['find']({'where':{'id':_0x594a1d[_0x5b21('0x27')]['id']}})[_0x5b21('0x20')](handleEntityNotFound(_0x878205,null))[_0x5b21('0x20')](removeEntity(_0x878205,null))[_0x5b21('0x28')](handleError(_0x878205,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 390e53b..be448ed 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 _0x25e1=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','../../config/logger','api','moment'];(function(_0x4135f3,_0x23e172){var _0xbb97c=function(_0xfe1eee){while(--_0xfe1eee){_0x4135f3['push'](_0x4135f3['shift']());}};_0xbb97c(++_0x23e172);}(_0x25e1,0x1d0));var _0x125e=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x25e1[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x125e('0x0'));var util=require('util');var logger=require(_0x125e('0x1'))(_0x125e('0x2'));var moment=require(_0x125e('0x3'));var BPromise=require(_0x125e('0x4'));var rp=require(_0x125e('0x5'));var fs=require('fs');var path=require(_0x125e('0x6'));var rimraf=require(_0x125e('0x7'));var config=require(_0x125e('0x8'));var attributes=require(_0x125e('0x9'));module[_0x125e('0xa')]=function(_0x2b16c4,_0x158400){return _0x2b16c4[_0x125e('0xb')](_0x125e('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf6d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Action','tools_actions','lodash','../../config/logger'];(function(_0xb011d6,_0x74d4eb){var _0x1e30f1=function(_0x5009ba){while(--_0x5009ba){_0xb011d6['push'](_0xb011d6['shift']());}};_0x1e30f1(++_0x74d4eb);}(_0xdf6d,0x15e));var _0xddf6=function(_0x11fed6,_0x366955){_0x11fed6=_0x11fed6-0x0;var _0x5dbd7f=_0xdf6d[_0x11fed6];return _0x5dbd7f;};'use strict';var _=require(_0xddf6('0x0'));var util=require('util');var logger=require(_0xddf6('0x1'))(_0xddf6('0x2'));var moment=require(_0xddf6('0x3'));var BPromise=require(_0xddf6('0x4'));var rp=require(_0xddf6('0x5'));var fs=require('fs');var path=require(_0xddf6('0x6'));var rimraf=require(_0xddf6('0x7'));var config=require(_0xddf6('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x571842,_0x33fdfd){return _0x571842['define'](_0xddf6('0x9'),attributes,{'tableName':_0xddf6('0xa'),'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 67792be..0ed5e58 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d0c41,_0x4802ae){var _0x468d86=function(_0x25638e){while(--_0x25638e){_0x5d0c41['push'](_0x5d0c41['shift']());}};_0x468d86(++_0x4802ae);}(_0x326f,0xd1));var _0xf326=function(_0x4fde0f,_0x7acd1c){_0x4fde0f=_0x4fde0f-0x0;var _0x1de7a4=_0x326f[_0x4fde0f];return _0x1de7a4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1d3216d..93c9e58 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 _0x2c04=['delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update'];(function(_0x57868e,_0x868060){var _0x4b7c99=function(_0x481f03){while(--_0x481f03){_0x57868e['push'](_0x57868e['shift']());}};_0x4b7c99(++_0x868060);}(_0x2c04,0x144));var _0x42c0=function(_0x158002,_0xe44f8d){_0x158002=_0x158002-0x0;var _0xb6f745=_0x2c04[_0x158002];return _0xb6f745;};'use strict';var multer=require(_0x42c0('0x0'));var util=require('util');var path=require(_0x42c0('0x1'));var timeout=require(_0x42c0('0x2'));var express=require(_0x42c0('0x3'));var router=express['Router']();var fs_extra=require(_0x42c0('0x4'));var auth=require(_0x42c0('0x5'));var interaction=require(_0x42c0('0x6'));var config=require(_0x42c0('0x7'));var controller=require(_0x42c0('0x8'));router[_0x42c0('0x9')](_0x42c0('0xa'),auth['isAuthenticated'](),controller[_0x42c0('0xb')]);router[_0x42c0('0xc')](_0x42c0('0xa'),auth[_0x42c0('0xd')](),controller[_0x42c0('0xe')]);module[_0x42c0('0xf')]=router; \ No newline at end of file +var _0x635d=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','update','delete','isAuthenticated','destroy'];(function(_0x408f88,_0x15b720){var _0x470b94=function(_0x2274af){while(--_0x2274af){_0x408f88['push'](_0x408f88['shift']());}};_0x470b94(++_0x15b720);}(_0x635d,0x181));var _0xd635=function(_0x1b0046,_0x13ff97){_0x1b0046=_0x1b0046-0x0;var _0x5e0e55=_0x635d[_0x1b0046];return _0x5e0e55;};'use strict';var multer=require(_0xd635('0x0'));var util=require(_0xd635('0x1'));var path=require(_0xd635('0x2'));var timeout=require(_0xd635('0x3'));var express=require(_0xd635('0x4'));var router=express[_0xd635('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd635('0x6'));var interaction=require(_0xd635('0x7'));var config=require('../../config/environment');var controller=require(_0xd635('0x8'));router[_0xd635('0x9')](_0xd635('0xa'),auth['isAuthenticated'](),controller[_0xd635('0xb')]);router[_0xd635('0xc')](_0xd635('0xa'),auth[_0xd635('0xd')](),controller[_0xd635('0xe')]);module[_0xd635('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index dabb623..65725c7 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x4123f5,_0x398add){var _0x1af894=function(_0x568329){while(--_0x568329){_0x4123f5['push'](_0x4123f5['shift']());}};_0x1af894(++_0x398add);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x439f4f,_0x476cdb){var _0x508871=function(_0xa13f49){while(--_0xa13f49){_0x439f4f['push'](_0x439f4f['shift']());}};_0x508871(++_0x476cdb);}(_0xe14b,0x93));var _0xbe14=function(_0x3f6e6f,_0x4f2f50){_0x3f6e6f=_0x3f6e6f-0x0;var _0x416982=_0xe14b[_0x3f6e6f];return _0x416982;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7d2d7db..496ad06 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 _0xb714=['Run\x20Query:','../../files/reports','savename','countTable','runReport','value','MetricId','%s.%s\x20=\x20%s.%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','apply','save','update','destroy','then','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','include','catch','create','body','user','get','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','metric','replace','function','format','order','field','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','SEC_TO_TIME(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','keyBy','groupBy','orderBy','DESC','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info'];(function(_0x322ff3,_0x4c91bc){var _0x3e6830=function(_0x2786ac){while(--_0x2786ac){_0x322ff3['push'](_0x322ff3['shift']());}};_0x3e6830(++_0x4c91bc);}(_0xb714,0xa9));var _0x4b71=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0xb714[_0x46c9a5];return _0x5e3eec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b71('0x0'));var zipdir=require(_0x4b71('0x1'));var jsonpatch=require(_0x4b71('0x2'));var rp=require(_0x4b71('0x3'));var moment=require('moment');var BPromise=require(_0x4b71('0x4'));var Mustache=require(_0x4b71('0x5'));var util=require(_0x4b71('0x6'));var path=require(_0x4b71('0x7'));var sox=require(_0x4b71('0x8'));var csv=require(_0x4b71('0x9'));var ejs=require(_0x4b71('0xa'));var fs=require('fs');var fs_extra=require(_0x4b71('0xb'));var _=require(_0x4b71('0xc'));var squel=require(_0x4b71('0xd'));var crypto=require(_0x4b71('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4b71('0xf'));var toCsv=require(_0x4b71('0x9'));var querystring=require('querystring');var Papa=require(_0x4b71('0x10'));var Redis=require(_0x4b71('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b71('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b71('0x13'))(_0x4b71('0x14'));var utils=require('../../config/utils');var config=require(_0x4b71('0x15'));var licenseUtil=require(_0x4b71('0x16'));var db=require(_0x4b71('0x17'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x194f7a,_0x30c114){_0x30c114=_0x30c114||0xcc;return function(_0xae1e44){if(_0xae1e44){return _0x194f7a[_0x4b71('0x18')](_0x30c114);}return _0x194f7a[_0x4b71('0x19')](_0x30c114)[_0x4b71('0x1a')]();};}function respondWithResult(_0x331d2f,_0x460784){_0x460784=_0x460784||0xc8;return function(_0x395e68){if(_0x395e68){return _0x331d2f[_0x4b71('0x19')](_0x460784)['json'](_0x395e68);}};}function respondWithFilteredResult(_0x5aa097,_0x131019){return function(_0x59bd9d){if(_0x59bd9d){var _0x2918b1=typeof _0x131019['offset']===_0x4b71('0x1b')&&typeof _0x131019[_0x4b71('0x1c')]==='undefined';var _0x41b8e0=_0x59bd9d[_0x4b71('0x1d')];var _0x374477=_0x2918b1?0x0:_0x131019[_0x4b71('0x1e')];var _0x3121cf=_0x2918b1?_0x59bd9d['count']:_0x131019[_0x4b71('0x1e')]+_0x131019[_0x4b71('0x1c')];var _0x19e716;if(_0x3121cf>=_0x41b8e0){_0x3121cf=_0x41b8e0;_0x19e716=0xc8;}else{_0x19e716=0xce;}_0x5aa097[_0x4b71('0x19')](_0x19e716);return _0x5aa097[_0x4b71('0x1f')]('Content-Range',_0x374477+'-'+_0x3121cf+'/'+_0x41b8e0)['json'](_0x59bd9d);}return null;};}function patchUpdates(_0x277a29){return function(_0x271751){try{jsonpatch[_0x4b71('0x20')](_0x271751,_0x277a29,!![]);}catch(_0x40fdb0){return BPromise['reject'](_0x40fdb0);}return _0x271751[_0x4b71('0x21')]();};}function saveUpdates(_0xb0888d,_0x5e2c3b){return function(_0x12d591){if(_0x12d591){return _0x12d591[_0x4b71('0x22')](_0xb0888d)['then'](function(_0x1a2d1f){return _0x1a2d1f;});}return null;};}function removeEntity(_0xc5f76d,_0x232dfe){return function(_0x4f05b1){if(_0x4f05b1){return _0x4f05b1[_0x4b71('0x23')]()[_0x4b71('0x24')](function(){var _0x2e8402=_0x4f05b1['get']({'plain':!![]});var _0x3d632f=_0x4b71('0x25');return db[_0x4b71('0x26')][_0x4b71('0x23')]({'where':{'type':_0x3d632f,'resourceId':_0x2e8402['id']}})[_0x4b71('0x24')](function(){return _0x4f05b1;});})[_0x4b71('0x24')](function(){_0xc5f76d[_0x4b71('0x19')](0xcc)[_0x4b71('0x1a')]();});}};}function handleEntityNotFound(_0x1eeab4,_0x5d6908){return function(_0x50af00){if(!_0x50af00){_0x1eeab4[_0x4b71('0x18')](0x194);}return _0x50af00;};}function handleError(_0x23add9,_0x31deff){_0x31deff=_0x31deff||0x1f4;return function(_0x394ae0){logger[_0x4b71('0x27')](_0x394ae0[_0x4b71('0x28')]);if(_0x394ae0[_0x4b71('0x29')]){delete _0x394ae0[_0x4b71('0x29')];}_0x23add9['status'](_0x31deff)[_0x4b71('0x2a')](_0x394ae0);};}exports['index']=function(_0x502488,_0x3aaf60){var _0xaaf767={},_0x33c175={},_0x99f279={'count':0x0,'rows':[]};var _0x2d68cb=_[_0x4b71('0x2b')](db[_0x4b71('0x2c')][_0x4b71('0x2d')],function(_0x18ff25){return{'name':_0x18ff25[_0x4b71('0x2e')],'type':_0x18ff25[_0x4b71('0x2f')][_0x4b71('0x30')]};});_0x33c175['model']=_['map'](_0x2d68cb,_0x4b71('0x29'));_0x33c175[_0x4b71('0x31')]=_['keys'](_0x502488['query']);_0x33c175[_0x4b71('0x32')]=_[_0x4b71('0x33')](_0x33c175[_0x4b71('0x34')],_0x33c175[_0x4b71('0x31')]);_0xaaf767[_0x4b71('0x35')]=_[_0x4b71('0x33')](_0x33c175[_0x4b71('0x34')],qs[_0x4b71('0x36')](_0x502488[_0x4b71('0x31')][_0x4b71('0x36')]));_0xaaf767['attributes']=_0xaaf767[_0x4b71('0x35')][_0x4b71('0x37')]?_0xaaf767[_0x4b71('0x35')]:_0x33c175['model'];if(!_0x502488['query'][_0x4b71('0x38')]('nolimit')){_0xaaf767[_0x4b71('0x1c')]=qs[_0x4b71('0x1c')](_0x502488['query'][_0x4b71('0x1c')]);_0xaaf767[_0x4b71('0x1e')]=qs[_0x4b71('0x1e')](_0x502488[_0x4b71('0x31')][_0x4b71('0x1e')]);}_0xaaf767['order']=qs[_0x4b71('0x39')](_0x502488[_0x4b71('0x31')][_0x4b71('0x39')]);_0xaaf767[_0x4b71('0x3a')]=qs[_0x4b71('0x32')](_[_0x4b71('0x3b')](_0x502488[_0x4b71('0x31')],_0x33c175['filters']),_0x2d68cb);if(_0x502488[_0x4b71('0x31')][_0x4b71('0x3c')]){_0xaaf767[_0x4b71('0x3a')]=_[_0x4b71('0x3d')](_0xaaf767[_0x4b71('0x3a')],{'$or':_['map'](_0x2d68cb,function(_0x3e01fd){if(_0x3e01fd['type']!==_0x4b71('0x3e')){var _0x5bcc17={};_0x5bcc17[_0x3e01fd[_0x4b71('0x29')]]={'$like':'%'+_0x502488[_0x4b71('0x31')][_0x4b71('0x3c')]+'%'};return _0x5bcc17;}})});}_0xaaf767=_[_0x4b71('0x3d')]({},_0xaaf767,_0x502488[_0x4b71('0x3f')]);var _0x499a86={'where':_0xaaf767[_0x4b71('0x3a')]};return db[_0x4b71('0x2c')][_0x4b71('0x1d')](_0x499a86)[_0x4b71('0x24')](function(_0xc177eb){_0x99f279[_0x4b71('0x1d')]=_0xc177eb;if(_0x502488[_0x4b71('0x31')][_0x4b71('0x40')]){_0xaaf767['include']=[{'all':!![]}];}return db[_0x4b71('0x2c')]['findAll'](_0xaaf767);})[_0x4b71('0x24')](function(_0x580b59){_0x99f279[_0x4b71('0x41')]=_0x580b59;return _0x99f279;})[_0x4b71('0x24')](respondWithFilteredResult(_0x3aaf60,_0xaaf767))['catch'](handleError(_0x3aaf60,null));};exports[_0x4b71('0x42')]=function(_0x4daa18,_0xc362e1){var _0xb3616f={'raw':![],'where':{'id':_0x4daa18[_0x4b71('0x43')]['id']}},_0x26f9f9={};_0x26f9f9[_0x4b71('0x34')]=_[_0x4b71('0x44')](db[_0x4b71('0x2c')][_0x4b71('0x2d')]);_0x26f9f9[_0x4b71('0x31')]=_[_0x4b71('0x44')](_0x4daa18[_0x4b71('0x31')]);_0x26f9f9['filters']=_[_0x4b71('0x33')](_0x26f9f9[_0x4b71('0x34')],_0x26f9f9[_0x4b71('0x31')]);_0xb3616f[_0x4b71('0x35')]=_['intersection'](_0x26f9f9[_0x4b71('0x34')],qs[_0x4b71('0x36')](_0x4daa18[_0x4b71('0x31')][_0x4b71('0x36')]));_0xb3616f[_0x4b71('0x35')]=_0xb3616f[_0x4b71('0x35')][_0x4b71('0x37')]?_0xb3616f[_0x4b71('0x35')]:_0x26f9f9[_0x4b71('0x34')];if(_0x4daa18[_0x4b71('0x31')][_0x4b71('0x40')]){_0xb3616f[_0x4b71('0x45')]=[{'all':!![]}];}_0xb3616f=_[_0x4b71('0x3d')]({},_0xb3616f,_0x4daa18['options']);return db['AnalyticCustomReport']['find'](_0xb3616f)[_0x4b71('0x24')](handleEntityNotFound(_0xc362e1,null))[_0x4b71('0x24')](respondWithResult(_0xc362e1,null))[_0x4b71('0x46')](handleError(_0xc362e1,null));};exports[_0x4b71('0x47')]=function(_0x30b62f,_0x42d5a1){return db[_0x4b71('0x2c')]['create'](_0x30b62f[_0x4b71('0x48')],{})[_0x4b71('0x24')](function(_0x3483bf){var _0x3acb9b=_0x30b62f[_0x4b71('0x49')][_0x4b71('0x4a')]({'plain':!![]});if(!_0x3acb9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3acb9b['role']===_0x4b71('0x49')){var _0x46d423=_0x3483bf[_0x4b71('0x4a')]({'plain':!![]});var _0x40ca69=_0x4b71('0x4b');return db[_0x4b71('0x4c')]['find']({'where':{'name':_0x40ca69,'userProfileId':_0x3acb9b['userProfileId']},'raw':!![]})[_0x4b71('0x24')](function(_0x43a205){if(_0x43a205&&_0x43a205[_0x4b71('0x4d')]===0x0){return db[_0x4b71('0x26')][_0x4b71('0x47')]({'name':_0x46d423['name'],'resourceId':_0x46d423['id'],'type':'CustomReports','sectionId':_0x43a205['id']},{})[_0x4b71('0x24')](function(){return _0x3483bf;});}else{return _0x3483bf;}})[_0x4b71('0x46')](function(_0x320759){logger[_0x4b71('0x27')](_0x4b71('0x4e'),_0x320759);throw _0x320759;});}return _0x3483bf;})[_0x4b71('0x24')](respondWithResult(_0x42d5a1,0xc9))[_0x4b71('0x46')](handleError(_0x42d5a1,null));};exports[_0x4b71('0x22')]=function(_0x351cec,_0x53cd0d){if(_0x351cec['body']['id']){delete _0x351cec[_0x4b71('0x48')]['id'];}return db[_0x4b71('0x2c')][_0x4b71('0x4f')]({'where':{'id':_0x351cec[_0x4b71('0x43')]['id']}})[_0x4b71('0x24')](handleEntityNotFound(_0x53cd0d,null))['then'](saveUpdates(_0x351cec[_0x4b71('0x48')],null))[_0x4b71('0x24')](respondWithResult(_0x53cd0d,null))[_0x4b71('0x46')](handleError(_0x53cd0d,null));};exports['destroy']=function(_0x54574c,_0x53c024){return db[_0x4b71('0x2c')][_0x4b71('0x4f')]({'where':{'id':_0x54574c[_0x4b71('0x43')]['id']}})[_0x4b71('0x24')](handleEntityNotFound(_0x53c024,null))['then'](removeEntity(_0x53c024,null))[_0x4b71('0x46')](handleError(_0x53c024,null));};exports[_0x4b71('0x50')]=function(_0x4e6a2b,_0x5756ab){var _0x54c4f5=0xa;var _0x3653f9=[_0x4b71('0x51'),_0x4b71('0x52'),_0x4b71('0x53'),_0x4b71('0x54')];var _0x1e7857={'SUM':_0x4b71('0x55'),'COUNT':_0x4b71('0x56'),'COUNT DISTINCT':_0x4b71('0x57'),'MAX':_0x4b71('0x58'),'MIN':_0x4b71('0x59'),'AVG':_0x4b71('0x5a'),'GROUP_CONCAT':_0x4b71('0x5b'),'GROUP_CONCAT ASC':_0x4b71('0x5c'),'GROUP_CONCAT DESC':_0x4b71('0x5d')};var _0x3cfedf={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4b71('0x5e'),'HOUR':_0x4b71('0x5f'),'ROUND':_0x4b71('0x60'),'UNIX_TIMESTAMP':_0x4b71('0x61')};var _0x2bde99=function(_0x342847){return!_[_0x4b71('0x62')]([_0x4b71('0x63'),_0x4b71('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x342847);};var _0x5dd822=function(_0x3c705f){if(!_0x3c705f||!_0x3c705f[_0x4b71('0x65')][_0x4b71('0x37')]){return'';}for(var _0x2f00c1='(',_0x5e0923=0x0;_0x5e0923<_0x3c705f[_0x4b71('0x65')][_0x4b71('0x37')];_0x5e0923+=0x1){_0x5e0923>0x0&&(_0x2f00c1+='\x20'+_0x3c705f[_0x4b71('0x66')]+'\x20');_0x2f00c1+=_0x3c705f[_0x4b71('0x65')][_0x5e0923][_0x4b71('0x67')]?_0x5dd822(_0x3c705f['rules'][_0x5e0923][_0x4b71('0x67')]):_0x3c705f['rules'][_0x5e0923]['field']+'\x20'+_0x3c705f[_0x4b71('0x65')][_0x5e0923][_0x4b71('0x68')]+(_0x2bde99(_0x3c705f[_0x4b71('0x65')][_0x5e0923][_0x4b71('0x68')])?'\x20'+_0x3c705f[_0x4b71('0x65')][_0x5e0923]['value']:'');}return _0x2f00c1+')';};var _0x20a060={'where':{'id':_0x4e6a2b[_0x4b71('0x43')]['id']}},_0x35fed2,_0xcb9ce6,_0x1303aa,_0x575855,_0x3d1ab7;_0x20a060=_[_0x4b71('0x3d')]({},_0x20a060,_0x4e6a2b['options']);return db[_0x4b71('0x2c')][_0x4b71('0x4f')](_0x20a060)[_0x4b71('0x24')](function(_0x44cf20){if(_0x44cf20){_0x35fed2=_0x44cf20;return _0x44cf20['getFields']();}return null;})[_0x4b71('0x24')](function(_0x3a812e){if(_0x3a812e){if(!_0x3a812e[_0x4b71('0x37')]){throw new db[(_0x4b71('0x69'))][(_0x4b71('0x6a'))](_0x4b71('0x6b'),0x193);}_0xcb9ce6=_0x3a812e;return db[_0x4b71('0x6c')][_0x4b71('0x6d')]({'raw':!![]});}return null;})[_0x4b71('0x24')](function(_0x2a53f3){if(_0x2a53f3){_0x1303aa=_['keyBy'](_0x2a53f3,'id');var _0x3fb333;var _0x266145=squel[_0x4b71('0x6e')]();_0x266145[_0x4b71('0x6f')](_0x35fed2[_0x4b71('0x70')]);for(var _0x576a51=0x0;_0x576a51<_0xcb9ce6[_0x4b71('0x37')];_0x576a51+=0x1){_0x3fb333=_0xcb9ce6[_0x576a51]['MetricId']?_0x1303aa[_0xcb9ce6[_0x576a51]['MetricId']][_0x4b71('0x71')]:_0xcb9ce6[_0x576a51]['field'];_0x3fb333=_0xcb9ce6[_0x576a51]['function']?_[_0x4b71('0x72')](_0x1e7857[_0xcb9ce6[_0x576a51][_0x4b71('0x73')]],'%s',_0x3fb333):_0x3fb333;_0x3fb333=_0xcb9ce6[_0x576a51][_0x4b71('0x74')]?_[_0x4b71('0x72')](_0x3cfedf[_0xcb9ce6[_0x576a51][_0x4b71('0x74')]],'%s',_0x3fb333):_0x3fb333;if(_0xcb9ce6[_0x576a51]['groupBy']){_0x266145[_0x4b71('0x67')](_0x3fb333);}_0xcb9ce6[_0x576a51]['orderBy']&&_0x266145[_0x4b71('0x75')](_0x3fb333,_0xcb9ce6[_0x576a51]['orderBy']==='DESC'?![]:!![]);_0x266145[_0x4b71('0x76')](_0x3fb333,_0xcb9ce6[_0x576a51][_0x4b71('0x77')]||_0x3fb333);}if(_0x35fed2[_0x4b71('0x78')]){_0x35fed2['joins']=JSON[_0x4b71('0x79')](_0x35fed2[_0x4b71('0x78')]);for(var _0x593afd=0x0;_0x593afd<_0x35fed2[_0x4b71('0x78')]['length'];_0x593afd+=0x1){if(_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x2f')]&&_[_0x4b71('0x62')](_0x3653f9,_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x2f')])&&_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7a')]&&_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7b')]&&_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7c')]){_0x266145[_0x35fed2['joins'][_0x593afd]['type']](_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7b')],null,util[_0x4b71('0x74')]('%s.%s\x20=\x20%s.%s',_0x35fed2[_0x4b71('0x70')],_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7a')],_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7b')],_0x35fed2[_0x4b71('0x78')][_0x593afd][_0x4b71('0x7c')]));}}}if(_0x35fed2['conditions']){_0x35fed2[_0x4b71('0x7d')]=JSON['parse'](_0x35fed2[_0x4b71('0x7d')]);_0x266145['where'](_0x5dd822(_0x35fed2['conditions'][_0x4b71('0x67')]));}_0x3d1ab7=_0x266145[_0x4b71('0x7e')]();_0x266145[_0x4b71('0x1c')](_0x54c4f5);_0x266145[_0x4b71('0x1e')](0x0);logger[_0x4b71('0x7f')]('Limited\x20Query:',_0x266145[_0x4b71('0x80')]());return dbH['sequelize'][_0x4b71('0x31')](_0x266145[_0x4b71('0x80')](),{'type':dbH[_0x4b71('0x81')][_0x4b71('0x82')][_0x4b71('0x83')]});}})[_0x4b71('0x24')](respondWithResult(_0x5756ab,null))[_0x4b71('0x46')](handleError(_0x5756ab,null));};function runReport(_0x4b1063,_0x37edce,_0x385587){var _0xb146fc=_0x37edce['name'];var _0x573b4d=0xa;var _0x54b3a7=['join',_0x4b71('0x52'),_0x4b71('0x53'),'cross_join'];var _0x1db998={'SUM':'SUM(%s)','COUNT':_0x4b71('0x56'),'COUNT DISTINCT':_0x4b71('0x57'),'MAX':_0x4b71('0x58'),'MIN':'MIN(%s)','AVG':_0x4b71('0x5a'),'GROUP_CONCAT':_0x4b71('0x5b'),'GROUP_CONCAT ASC':_0x4b71('0x5c'),'GROUP_CONCAT DESC':_0x4b71('0x5d')};var _0x48b06a={'SEC_TO_TIME':_0x4b71('0x84'),'DATE':_0x4b71('0x5e'),'HOUR':_0x4b71('0x5f'),'ROUND':_0x4b71('0x60'),'UNIX_TIMESTAMP':_0x4b71('0x61')};var _0x94aa54=function(_0x137ec9){return!_['includes']([_0x4b71('0x63'),_0x4b71('0x64'),_0x4b71('0x85'),_0x4b71('0x86')],_0x137ec9);};var _0x5e2eac=function(_0x5b67d1){if(!_0x5b67d1||!_0x5b67d1[_0x4b71('0x65')][_0x4b71('0x37')]){return'';}for(var _0x52696c='(',_0x28ff05=0x0;_0x28ff05<_0x5b67d1[_0x4b71('0x65')]['length'];_0x28ff05+=0x1){_0x28ff05>0x0&&(_0x52696c+='\x20'+_0x5b67d1[_0x4b71('0x66')]+'\x20');_0x52696c+=_0x5b67d1[_0x4b71('0x65')][_0x28ff05][_0x4b71('0x67')]?_0x5e2eac(_0x5b67d1['rules'][_0x28ff05][_0x4b71('0x67')]):_0x5b67d1['rules'][_0x28ff05]['field']+'\x20'+_0x5b67d1[_0x4b71('0x65')][_0x28ff05][_0x4b71('0x68')]+(_0x94aa54(_0x5b67d1['rules'][_0x28ff05]['condition'])?'\x20'+_0x5b67d1[_0x4b71('0x65')][_0x28ff05]['value']:'');}return _0x52696c+')';};var _0x4ddb65={'where':{'id':_0x4b1063['id']}},_0x1abe2b,_0x3843f7,_0x33acf6,_0x344a97,_0x353a80;_0x4ddb65=_[_0x4b71('0x3d')]({},_0x4ddb65,_0x385587);return db['AnalyticCustomReport'][_0x4b71('0x4f')](_0x4ddb65)['then'](function(_0x1a962b){if(_0x1a962b){_0x1abe2b=_0x1a962b;return _0x1a962b[_0x4b71('0x87')]();}return null;})['then'](function(_0xcc826e){if(_0xcc826e){if(!_0xcc826e[_0x4b71('0x37')]){throw new db[(_0x4b71('0x69'))][(_0x4b71('0x6a'))](_0x4b71('0x6b'),0x193);}_0x3843f7=_0xcc826e;return db[_0x4b71('0x6c')][_0x4b71('0x6d')]({'raw':!![]});}return null;})[_0x4b71('0x24')](function(_0x4b6439){if(_0x4b6439){_0x33acf6=_[_0x4b71('0x88')](_0x4b6439,'id');var _0xefed23;var _0x43c4dc=squel[_0x4b71('0x6e')]();_0x43c4dc[_0x4b71('0x6f')](_0x1abe2b[_0x4b71('0x70')]);for(var _0x2b0769=0x0;_0x2b0769<_0x3843f7[_0x4b71('0x37')];_0x2b0769+=0x1){_0xefed23=_0x3843f7[_0x2b0769]['MetricId']?_0x33acf6[_0x3843f7[_0x2b0769]['MetricId']][_0x4b71('0x71')]:_0x3843f7[_0x2b0769][_0x4b71('0x76')];_0xefed23=_0x3843f7[_0x2b0769][_0x4b71('0x73')]?_['replace'](_0x1db998[_0x3843f7[_0x2b0769][_0x4b71('0x73')]],'%s',_0xefed23):_0xefed23;_0xefed23=_0x3843f7[_0x2b0769][_0x4b71('0x74')]?_[_0x4b71('0x72')](_0x48b06a[_0x3843f7[_0x2b0769][_0x4b71('0x74')]],'%s',_0xefed23):_0xefed23;if(_0x3843f7[_0x2b0769][_0x4b71('0x89')]){_0x43c4dc[_0x4b71('0x67')](_0xefed23);}_0x3843f7[_0x2b0769][_0x4b71('0x8a')]&&_0x43c4dc[_0x4b71('0x75')](_0xefed23,_0x3843f7[_0x2b0769][_0x4b71('0x8a')]===_0x4b71('0x8b')?![]:!![]);_0x43c4dc[_0x4b71('0x76')](_0xefed23,_0x3843f7[_0x2b0769]['alias']||_0xefed23);}if(_0x1abe2b[_0x4b71('0x78')]){_0x1abe2b['joins']=JSON['parse'](_0x1abe2b[_0x4b71('0x78')]);for(var _0x40b2bf=0x0;_0x40b2bf<_0x1abe2b[_0x4b71('0x78')][_0x4b71('0x37')];_0x40b2bf+=0x1){if(_0x1abe2b[_0x4b71('0x78')][_0x40b2bf]['type']&&_['includes'](_0x54b3a7,_0x1abe2b[_0x4b71('0x78')][_0x40b2bf][_0x4b71('0x2f')])&&_0x1abe2b[_0x4b71('0x78')][_0x40b2bf]['parentKey']&&_0x1abe2b[_0x4b71('0x78')][_0x40b2bf][_0x4b71('0x7b')]&&_0x1abe2b[_0x4b71('0x78')][_0x40b2bf][_0x4b71('0x7c')]){_0x43c4dc[_0x1abe2b['joins'][_0x40b2bf][_0x4b71('0x2f')]](_0x1abe2b[_0x4b71('0x78')][_0x40b2bf][_0x4b71('0x7b')],null,util[_0x4b71('0x74')]('%s.%s\x20=\x20%s.%s',_0x1abe2b[_0x4b71('0x70')],_0x1abe2b[_0x4b71('0x78')][_0x40b2bf][_0x4b71('0x7a')],_0x1abe2b['joins'][_0x40b2bf]['foreignTable'],_0x1abe2b[_0x4b71('0x78')][_0x40b2bf]['foreignKey']));}}}if(_0x1abe2b[_0x4b71('0x7d')]){_0x1abe2b['conditions']=JSON[_0x4b71('0x79')](_0x1abe2b[_0x4b71('0x7d')]);_0x43c4dc[_0x4b71('0x3a')](_0x5e2eac(_0x1abe2b[_0x4b71('0x7d')]['group']));}_0x353a80=_0x43c4dc[_0x4b71('0x7e')]();_0x43c4dc[_0x4b71('0x1c')](_0x573b4d);_0x43c4dc[_0x4b71('0x1e')](0x0);return;}})['then'](function(){if(_0x37edce[_0x4b71('0x8c')]==='web'){return null;}var _0x27158e=_[_0x4b71('0x3d')](_0x37edce,{'name':_0x37edce[_0x4b71('0x8d')]||_0x37edce[_0x4b71('0x29')]||_0x1abe2b[_0x4b71('0x29')],'basename':_0xb146fc,'savename':util[_0x4b71('0x74')](_0x4b71('0x8e'),_0x37edce[_0x4b71('0x29')]||_0x1abe2b['name'],require(_0x4b71('0x8f'))[_0x4b71('0x90')](0x4),_0x37edce['output']||_0x4b71('0x91')),'reportId':_0x1abe2b['id'],'reportType':_0x4b71('0x92')});return db[_0x4b71('0x93')][_0x4b71('0x47')](_0x27158e,{'raw':!![]});})[_0x4b71('0x24')](function(_0x44afca){if(_0x1abe2b[_0x4b71('0x70')]===_0x4b71('0x94')){_0x353a80[_0x4b71('0x3a')](_0x1abe2b[_0x4b71('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x37edce['startDate'],_0x37edce[_0x4b71('0x95')]);}else{_0x353a80[_0x4b71('0x3a')](_0x1abe2b['table']+_0x4b71('0x96'),_0x37edce[_0x4b71('0x97')],_0x37edce[_0x4b71('0x95')]);}if(_0x44afca){logger[_0x4b71('0x98')](_0x4b71('0x99'),_0x353a80[_0x4b71('0x80')]());require('child_process')['fork'](path[_0x4b71('0x51')](__dirname,'../../components/export/',_0x44afca['output']),[_0x44afca['id'],_0x353a80[_0x4b71('0x80')](),path['join'](__dirname,_0x4b71('0x9a'),_0x44afca[_0x4b71('0x9b')]),_0xb146fc]);return _0x44afca;}else{var _0x5de31e=squel['select']();_0x5de31e['from']('('+_0x353a80[_0x4b71('0x80')]()+')',_0x4b71('0x9c'));_0x5de31e['field']('COUNT(*)',_0x4b71('0x1d'));_0x353a80[_0x4b71('0x1c')](_0x37edce[_0x4b71('0x1c')]||_0x573b4d);_0x353a80[_0x4b71('0x1e')](_0x37edce['offset']||0x0);return dbH[_0x4b71('0x81')]['query'](_0x5de31e[_0x4b71('0x80')](),{'type':dbH['sequelize'][_0x4b71('0x82')][_0x4b71('0x83')]})['then'](function(_0x2d95f4){if(!_0x2d95f4[_0x4b71('0x37')]){_0x344a97=0x0;}else{_0x344a97=_0x2d95f4[0x0]['count']||0x0;}return dbH[_0x4b71('0x81')][_0x4b71('0x31')](_0x353a80[_0x4b71('0x80')](),{'type':dbH['sequelize'][_0x4b71('0x82')][_0x4b71('0x83')]});})[_0x4b71('0x24')](function(_0x554338){return{'rows':_0x554338||[],'count':_0x344a97};});}});}exports['run']=function(_0x1f6bdb,_0x37a0ce){return runReport(_0x1f6bdb[_0x4b71('0x43')],_0x1f6bdb[_0x4b71('0x31')],_0x1f6bdb[_0x4b71('0x3f')])[_0x4b71('0x24')](respondWithResult(_0x37a0ce,null))['catch'](handleError(_0x37a0ce,null));};exports[_0x4b71('0x9d')]=runReport;exports['query']=function(_0x462f4b,_0x3dfb39){var _0x5f5613=0xa;var _0x1b5d62=[_0x4b71('0x51'),_0x4b71('0x52'),_0x4b71('0x53'),_0x4b71('0x54')];var _0x26a454={'SUM':_0x4b71('0x55'),'COUNT':_0x4b71('0x56'),'COUNT DISTINCT':_0x4b71('0x57'),'MAX':_0x4b71('0x58'),'MIN':_0x4b71('0x59'),'AVG':_0x4b71('0x5a'),'GROUP_CONCAT':_0x4b71('0x5b'),'GROUP_CONCAT ASC':_0x4b71('0x5c'),'GROUP_CONCAT DESC':_0x4b71('0x5d')};var _0x3bf11e={'SEC_TO_TIME':_0x4b71('0x84'),'DATE':_0x4b71('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4b71('0x61')};var _0xbe10dc=function(_0x26337b){return!_[_0x4b71('0x62')](['IS\x20NULL',_0x4b71('0x64'),_0x4b71('0x85'),'IS\x20NOT\x20EMPTY'],_0x26337b);};var _0x3c49a5=function(_0x54b2b8){if(!_0x54b2b8||!_0x54b2b8[_0x4b71('0x65')]['length']){return'';}for(var _0x48490b='(',_0x331421=0x0;_0x331421<_0x54b2b8[_0x4b71('0x65')][_0x4b71('0x37')];_0x331421+=0x1){_0x331421>0x0&&(_0x48490b+='\x20'+_0x54b2b8[_0x4b71('0x66')]+'\x20');_0x48490b+=_0x54b2b8['rules'][_0x331421][_0x4b71('0x67')]?_0x3c49a5(_0x54b2b8['rules'][_0x331421][_0x4b71('0x67')]):_0x54b2b8[_0x4b71('0x65')][_0x331421]['field']+'\x20'+_0x54b2b8[_0x4b71('0x65')][_0x331421][_0x4b71('0x68')]+(_0xbe10dc(_0x54b2b8[_0x4b71('0x65')][_0x331421][_0x4b71('0x68')])?'\x20'+_0x54b2b8[_0x4b71('0x65')][_0x331421][_0x4b71('0x9e')]:'');}return _0x48490b+')';};var _0x118f1e={'where':{'id':_0x462f4b[_0x4b71('0x43')]['id']}},_0x30cf30,_0xef3c53,_0x3eefb6,_0x61fc54,_0x58d07b;_0x118f1e=_['merge']({},_0x118f1e,_0x462f4b[_0x4b71('0x3f')]);return db['AnalyticCustomReport'][_0x4b71('0x4f')](_0x118f1e)['then'](function(_0x1a206d){if(_0x1a206d){_0x30cf30=_0x1a206d;return _0x1a206d['getFields']();}return null;})[_0x4b71('0x24')](function(_0x14f65c){if(_0x14f65c){if(!_0x14f65c[_0x4b71('0x37')]){throw new db[(_0x4b71('0x69'))][(_0x4b71('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xef3c53=_0x14f65c;return db[_0x4b71('0x6c')][_0x4b71('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x2cf171){if(_0x2cf171){_0x3eefb6=_[_0x4b71('0x88')](_0x2cf171,'id');var _0x1a2be9;var _0x4151f7=squel[_0x4b71('0x6e')]();_0x4151f7['from'](_0x30cf30[_0x4b71('0x70')]);for(var _0xc8907e=0x0;_0xc8907e<_0xef3c53[_0x4b71('0x37')];_0xc8907e+=0x1){_0x1a2be9=_0xef3c53[_0xc8907e][_0x4b71('0x9f')]?_0x3eefb6[_0xef3c53[_0xc8907e][_0x4b71('0x9f')]][_0x4b71('0x71')]:_0xef3c53[_0xc8907e][_0x4b71('0x76')];_0x1a2be9=_0xef3c53[_0xc8907e]['function']?_[_0x4b71('0x72')](_0x26a454[_0xef3c53[_0xc8907e][_0x4b71('0x73')]],'%s',_0x1a2be9):_0x1a2be9;_0x1a2be9=_0xef3c53[_0xc8907e][_0x4b71('0x74')]?_[_0x4b71('0x72')](_0x3bf11e[_0xef3c53[_0xc8907e][_0x4b71('0x74')]],'%s',_0x1a2be9):_0x1a2be9;if(_0xef3c53[_0xc8907e][_0x4b71('0x89')]){_0x4151f7['group'](_0x1a2be9);}_0xef3c53[_0xc8907e][_0x4b71('0x8a')]&&_0x4151f7[_0x4b71('0x75')](_0x1a2be9,_0xef3c53[_0xc8907e][_0x4b71('0x8a')]===_0x4b71('0x8b')?![]:!![]);_0x4151f7[_0x4b71('0x76')](_0x1a2be9,_0xef3c53[_0xc8907e][_0x4b71('0x77')]||_0x1a2be9);}if(_0x30cf30[_0x4b71('0x78')]){_0x30cf30[_0x4b71('0x78')]=JSON[_0x4b71('0x79')](_0x30cf30[_0x4b71('0x78')]);for(var _0x1f0e35=0x0;_0x1f0e35<_0x30cf30[_0x4b71('0x78')][_0x4b71('0x37')];_0x1f0e35+=0x1){if(_0x30cf30['joins'][_0x1f0e35][_0x4b71('0x2f')]&&_[_0x4b71('0x62')](_0x1b5d62,_0x30cf30[_0x4b71('0x78')][_0x1f0e35]['type'])&&_0x30cf30[_0x4b71('0x78')][_0x1f0e35]['parentKey']&&_0x30cf30['joins'][_0x1f0e35]['foreignTable']&&_0x30cf30['joins'][_0x1f0e35][_0x4b71('0x7c')]){_0x4151f7[_0x30cf30['joins'][_0x1f0e35][_0x4b71('0x2f')]](_0x30cf30['joins'][_0x1f0e35]['foreignTable'],null,util['format'](_0x4b71('0xa0'),_0x30cf30['table'],_0x30cf30[_0x4b71('0x78')][_0x1f0e35][_0x4b71('0x7a')],_0x30cf30[_0x4b71('0x78')][_0x1f0e35][_0x4b71('0x7b')],_0x30cf30['joins'][_0x1f0e35]['foreignKey']));}}}if(_0x30cf30[_0x4b71('0x7d')]){_0x30cf30[_0x4b71('0x7d')]=JSON[_0x4b71('0x79')](_0x30cf30[_0x4b71('0x7d')]);_0x4151f7[_0x4b71('0x3a')](_0x3c49a5(_0x30cf30[_0x4b71('0x7d')][_0x4b71('0x67')]));}_0x58d07b=_0x4151f7[_0x4b71('0x7e')]();_0x4151f7['limit'](_0x5f5613);_0x4151f7['offset'](0x0);logger['debug']('Limited\x20Query:',_0x4151f7[_0x4b71('0x80')]());return dbH[_0x4b71('0x81')]['query'](_0x4151f7[_0x4b71('0x80')](),{'type':dbH[_0x4b71('0x81')][_0x4b71('0x82')][_0x4b71('0x83')]});}})['then'](function(){return{'sql':_0x58d07b[_0x4b71('0x80')]()};})[_0x4b71('0x24')](respondWithResult(_0x3dfb39,null))[_0x4b71('0x46')](handleError(_0x3dfb39,null));}; \ No newline at end of file +var _0x13b6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_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)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','DESC','alias','joins','parse','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','cross_join','ROUND(%s)','operator','findAll','groupBy','orderBy','web','%s-%s.%s','randomstring','generate','output','csv','custom','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x524dcd,_0x4fa41e){var _0xbca436=function(_0xc2bb17){while(--_0xc2bb17){_0x524dcd['push'](_0x524dcd['shift']());}};_0xbca436(++_0x4fa41e);}(_0x13b6,0x97));var _0x613b=function(_0x365b38,_0x17ac80){_0x365b38=_0x365b38-0x0;var _0x465e8c=_0x13b6[_0x365b38];return _0x465e8c;};'use strict';var emlformat=require(_0x613b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x613b('0x1'));var jsonpatch=require(_0x613b('0x2'));var rp=require(_0x613b('0x3'));var moment=require(_0x613b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613b('0x5'));var util=require(_0x613b('0x6'));var path=require(_0x613b('0x7'));var sox=require('sox');var csv=require(_0x613b('0x8'));var ejs=require(_0x613b('0x9'));var fs=require('fs');var fs_extra=require(_0x613b('0xa'));var _=require('lodash');var squel=require(_0x613b('0xb'));var crypto=require('crypto');var jsforce=require(_0x613b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x613b('0xd'));var Papa=require(_0x613b('0xe'));var Redis=require(_0x613b('0xf'));var authService=require(_0x613b('0x10'));var qs=require(_0x613b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x613b('0x12'))('api');var utils=require(_0x613b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x613b('0x14'))['db'];var dbH=require(_0x613b('0x14'))[_0x613b('0x15')];function respondWithStatusCode(_0x4afa45,_0x1d31f8){_0x1d31f8=_0x1d31f8||0xcc;return function(_0x2931ee){if(_0x2931ee){return _0x4afa45[_0x613b('0x16')](_0x1d31f8);}return _0x4afa45[_0x613b('0x17')](_0x1d31f8)[_0x613b('0x18')]();};}function respondWithResult(_0x3516ed,_0xae6dd1){_0xae6dd1=_0xae6dd1||0xc8;return function(_0x3c1e24){if(_0x3c1e24){return _0x3516ed[_0x613b('0x17')](_0xae6dd1)[_0x613b('0x19')](_0x3c1e24);}};}function respondWithFilteredResult(_0x52c088,_0xa74b30){return function(_0x3023a4){if(_0x3023a4){var _0x12f0d1=typeof _0xa74b30['offset']==='undefined'&&typeof _0xa74b30[_0x613b('0x1a')]==='undefined';var _0x27949c=_0x3023a4['count'];var _0x46c9c4=_0x12f0d1?0x0:_0xa74b30[_0x613b('0x1b')];var _0x34cd14=_0x12f0d1?_0x3023a4[_0x613b('0x1c')]:_0xa74b30[_0x613b('0x1b')]+_0xa74b30[_0x613b('0x1a')];var _0x231fcb;if(_0x34cd14>=_0x27949c){_0x34cd14=_0x27949c;_0x231fcb=0xc8;}else{_0x231fcb=0xce;}_0x52c088['status'](_0x231fcb);return _0x52c088[_0x613b('0x1d')](_0x613b('0x1e'),_0x46c9c4+'-'+_0x34cd14+'/'+_0x27949c)['json'](_0x3023a4);}return null;};}function patchUpdates(_0x4b5168){return function(_0x22b5ec){try{jsonpatch[_0x613b('0x1f')](_0x22b5ec,_0x4b5168,!![]);}catch(_0x941359){return BPromise[_0x613b('0x20')](_0x941359);}return _0x22b5ec[_0x613b('0x21')]();};}function saveUpdates(_0x4d9728,_0x84c80f){return function(_0x59a787){if(_0x59a787){return _0x59a787[_0x613b('0x22')](_0x4d9728)[_0x613b('0x23')](function(_0x3a17a1){return _0x3a17a1;});}return null;};}function removeEntity(_0x101ec7,_0x485a6d){return function(_0x32a460){if(_0x32a460){return _0x32a460['destroy']()[_0x613b('0x23')](function(){var _0x4ad958=_0x32a460[_0x613b('0x24')]({'plain':!![]});var _0x17e3ac=_0x613b('0x25');return db[_0x613b('0x26')][_0x613b('0x27')]({'where':{'type':_0x17e3ac,'resourceId':_0x4ad958['id']}})[_0x613b('0x23')](function(){return _0x32a460;});})[_0x613b('0x23')](function(){_0x101ec7[_0x613b('0x17')](0xcc)[_0x613b('0x18')]();});}};}function handleEntityNotFound(_0x63f8c3,_0x30f08b){return function(_0x367c1a){if(!_0x367c1a){_0x63f8c3['sendStatus'](0x194);}return _0x367c1a;};}function handleError(_0x46529a,_0x1c0157){_0x1c0157=_0x1c0157||0x1f4;return function(_0x283027){logger[_0x613b('0x28')](_0x283027[_0x613b('0x29')]);if(_0x283027[_0x613b('0x2a')]){delete _0x283027[_0x613b('0x2a')];}_0x46529a['status'](_0x1c0157)[_0x613b('0x2b')](_0x283027);};}exports[_0x613b('0x2c')]=function(_0x56561f,_0x3af1ff){var _0x4f2df9={},_0x3ed316={},_0x35bbbe={'count':0x0,'rows':[]};var _0x56f59e=_[_0x613b('0x2d')](db[_0x613b('0x2e')][_0x613b('0x2f')],function(_0x136f0e){return{'name':_0x136f0e[_0x613b('0x30')],'type':_0x136f0e[_0x613b('0x31')][_0x613b('0x32')]};});_0x3ed316[_0x613b('0x33')]=_[_0x613b('0x2d')](_0x56f59e,_0x613b('0x2a'));_0x3ed316[_0x613b('0x34')]=_[_0x613b('0x35')](_0x56561f[_0x613b('0x34')]);_0x3ed316['filters']=_[_0x613b('0x36')](_0x3ed316[_0x613b('0x33')],_0x3ed316[_0x613b('0x34')]);_0x4f2df9[_0x613b('0x37')]=_['intersection'](_0x3ed316['model'],qs[_0x613b('0x38')](_0x56561f[_0x613b('0x34')][_0x613b('0x38')]));_0x4f2df9[_0x613b('0x37')]=_0x4f2df9[_0x613b('0x37')][_0x613b('0x39')]?_0x4f2df9[_0x613b('0x37')]:_0x3ed316['model'];if(!_0x56561f[_0x613b('0x34')][_0x613b('0x3a')](_0x613b('0x3b'))){_0x4f2df9[_0x613b('0x1a')]=qs[_0x613b('0x1a')](_0x56561f[_0x613b('0x34')][_0x613b('0x1a')]);_0x4f2df9[_0x613b('0x1b')]=qs[_0x613b('0x1b')](_0x56561f[_0x613b('0x34')][_0x613b('0x1b')]);}_0x4f2df9[_0x613b('0x3c')]=qs[_0x613b('0x3d')](_0x56561f[_0x613b('0x34')][_0x613b('0x3d')]);_0x4f2df9[_0x613b('0x3e')]=qs[_0x613b('0x3f')](_[_0x613b('0x40')](_0x56561f['query'],_0x3ed316[_0x613b('0x3f')]),_0x56f59e);if(_0x56561f[_0x613b('0x34')][_0x613b('0x41')]){_0x4f2df9[_0x613b('0x3e')]=_[_0x613b('0x42')](_0x4f2df9[_0x613b('0x3e')],{'$or':_[_0x613b('0x2d')](_0x56f59e,function(_0xffa7ae){if(_0xffa7ae[_0x613b('0x31')]!==_0x613b('0x43')){var _0x35efba={};_0x35efba[_0xffa7ae['name']]={'$like':'%'+_0x56561f[_0x613b('0x34')]['filter']+'%'};return _0x35efba;}})});}_0x4f2df9=_['merge']({},_0x4f2df9,_0x56561f[_0x613b('0x44')]);var _0x1888fa={'where':_0x4f2df9[_0x613b('0x3e')]};return db[_0x613b('0x2e')]['count'](_0x1888fa)[_0x613b('0x23')](function(_0x47cfb4){_0x35bbbe[_0x613b('0x1c')]=_0x47cfb4;if(_0x56561f[_0x613b('0x34')]['includeAll']){_0x4f2df9[_0x613b('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x4f2df9);})['then'](function(_0x594796){_0x35bbbe[_0x613b('0x46')]=_0x594796;return _0x35bbbe;})['then'](respondWithFilteredResult(_0x3af1ff,_0x4f2df9))[_0x613b('0x47')](handleError(_0x3af1ff,null));};exports[_0x613b('0x48')]=function(_0x57d5fa,_0x392a2d){var _0x302ea3={'raw':![],'where':{'id':_0x57d5fa[_0x613b('0x49')]['id']}},_0x92a1f3={};_0x92a1f3['model']=_['keys'](db[_0x613b('0x2e')][_0x613b('0x2f')]);_0x92a1f3[_0x613b('0x34')]=_['keys'](_0x57d5fa['query']);_0x92a1f3[_0x613b('0x3f')]=_[_0x613b('0x36')](_0x92a1f3[_0x613b('0x33')],_0x92a1f3['query']);_0x302ea3['attributes']=_[_0x613b('0x36')](_0x92a1f3[_0x613b('0x33')],qs[_0x613b('0x38')](_0x57d5fa[_0x613b('0x34')][_0x613b('0x38')]));_0x302ea3[_0x613b('0x37')]=_0x302ea3[_0x613b('0x37')][_0x613b('0x39')]?_0x302ea3[_0x613b('0x37')]:_0x92a1f3[_0x613b('0x33')];if(_0x57d5fa[_0x613b('0x34')][_0x613b('0x4a')]){_0x302ea3['include']=[{'all':!![]}];}_0x302ea3=_[_0x613b('0x42')]({},_0x302ea3,_0x57d5fa[_0x613b('0x44')]);return db[_0x613b('0x2e')][_0x613b('0x4b')](_0x302ea3)[_0x613b('0x23')](handleEntityNotFound(_0x392a2d,null))['then'](respondWithResult(_0x392a2d,null))[_0x613b('0x47')](handleError(_0x392a2d,null));};exports[_0x613b('0x4c')]=function(_0x92d63f,_0x3e48cf){return db[_0x613b('0x2e')][_0x613b('0x4c')](_0x92d63f[_0x613b('0x4d')],{})[_0x613b('0x23')](function(_0x1b23a3){var _0x378205=_0x92d63f[_0x613b('0x4e')][_0x613b('0x24')]({'plain':!![]});if(!_0x378205)throw new Error(_0x613b('0x4f'));if(_0x378205[_0x613b('0x50')]===_0x613b('0x4e')){var _0x1a08ba=_0x1b23a3[_0x613b('0x24')]({'plain':!![]});var _0x381c47=_0x613b('0x51');return db['UserProfileSection'][_0x613b('0x4b')]({'where':{'name':_0x381c47,'userProfileId':_0x378205[_0x613b('0x52')]},'raw':!![]})[_0x613b('0x23')](function(_0x5e6946){if(_0x5e6946&&_0x5e6946['autoAssociation']===0x0){return db[_0x613b('0x26')][_0x613b('0x4c')]({'name':_0x1a08ba[_0x613b('0x2a')],'resourceId':_0x1a08ba['id'],'type':'CustomReports','sectionId':_0x5e6946['id']},{})[_0x613b('0x23')](function(){return _0x1b23a3;});}else{return _0x1b23a3;}})[_0x613b('0x47')](function(_0x5e5890){logger[_0x613b('0x28')](_0x613b('0x53'),_0x5e5890);throw _0x5e5890;});}return _0x1b23a3;})[_0x613b('0x23')](respondWithResult(_0x3e48cf,0xc9))[_0x613b('0x47')](handleError(_0x3e48cf,null));};exports[_0x613b('0x22')]=function(_0x1eb1de,_0x5ef07a){if(_0x1eb1de[_0x613b('0x4d')]['id']){delete _0x1eb1de[_0x613b('0x4d')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x1eb1de[_0x613b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ef07a,null))['then'](saveUpdates(_0x1eb1de[_0x613b('0x4d')],null))[_0x613b('0x23')](respondWithResult(_0x5ef07a,null))[_0x613b('0x47')](handleError(_0x5ef07a,null));};exports[_0x613b('0x27')]=function(_0x55ce54,_0x2ea46a){return db[_0x613b('0x2e')][_0x613b('0x4b')]({'where':{'id':_0x55ce54['params']['id']}})['then'](handleEntityNotFound(_0x2ea46a,null))[_0x613b('0x23')](removeEntity(_0x2ea46a,null))['catch'](handleError(_0x2ea46a,null));};exports['preview']=function(_0x258c69,_0x5cdc2a){var _0x147429=0xa;var _0x2d1c4e=[_0x613b('0x54'),_0x613b('0x55'),'right_join','cross_join'];var _0x210049={'SUM':_0x613b('0x56'),'COUNT':_0x613b('0x57'),'COUNT DISTINCT':_0x613b('0x58'),'MAX':_0x613b('0x59'),'MIN':_0x613b('0x5a'),'AVG':_0x613b('0x5b'),'GROUP_CONCAT':_0x613b('0x5c'),'GROUP_CONCAT ASC':_0x613b('0x5d'),'GROUP_CONCAT DESC':_0x613b('0x5e')};var _0x3600d0={'SEC_TO_TIME':_0x613b('0x5f'),'DATE':_0x613b('0x60'),'HOUR':_0x613b('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x613b('0x62')};var _0x340804=function(_0x577e57){return!_['includes']([_0x613b('0x63'),_0x613b('0x64'),_0x613b('0x65'),_0x613b('0x66')],_0x577e57);};var _0x40b20d=function(_0x35f06c){if(!_0x35f06c||!_0x35f06c[_0x613b('0x67')][_0x613b('0x39')]){return'';}for(var _0x56adf2='(',_0x14a1ab=0x0;_0x14a1ab<_0x35f06c[_0x613b('0x67')]['length'];_0x14a1ab+=0x1){_0x14a1ab>0x0&&(_0x56adf2+='\x20'+_0x35f06c['operator']+'\x20');_0x56adf2+=_0x35f06c['rules'][_0x14a1ab]['group']?_0x40b20d(_0x35f06c['rules'][_0x14a1ab][_0x613b('0x68')]):_0x35f06c[_0x613b('0x67')][_0x14a1ab][_0x613b('0x69')]+'\x20'+_0x35f06c[_0x613b('0x67')][_0x14a1ab][_0x613b('0x6a')]+(_0x340804(_0x35f06c['rules'][_0x14a1ab]['condition'])?'\x20'+_0x35f06c['rules'][_0x14a1ab][_0x613b('0x6b')]:'');}return _0x56adf2+')';};var _0x16f1e2={'where':{'id':_0x258c69[_0x613b('0x49')]['id']}},_0x172e88,_0x1c30d2,_0x49fbb7,_0x457b3b,_0x7b31eb;_0x16f1e2=_[_0x613b('0x42')]({},_0x16f1e2,_0x258c69[_0x613b('0x44')]);return db['AnalyticCustomReport'][_0x613b('0x4b')](_0x16f1e2)[_0x613b('0x23')](function(_0x2c111e){if(_0x2c111e){_0x172e88=_0x2c111e;return _0x2c111e[_0x613b('0x6c')]();}return null;})[_0x613b('0x23')](function(_0x7c00c5){if(_0x7c00c5){if(!_0x7c00c5[_0x613b('0x39')]){throw new db[(_0x613b('0x6d'))][(_0x613b('0x6e'))](_0x613b('0x6f'),0x193);}_0x1c30d2=_0x7c00c5;return db[_0x613b('0x70')]['findAll']({'raw':!![]});}return null;})[_0x613b('0x23')](function(_0x3ee588){if(_0x3ee588){_0x49fbb7=_[_0x613b('0x71')](_0x3ee588,'id');var _0x5e8c5f;var _0x52159f=squel[_0x613b('0x72')]();_0x52159f[_0x613b('0x73')](_0x172e88[_0x613b('0x74')]);for(var _0x8c9496=0x0;_0x8c9496<_0x1c30d2[_0x613b('0x39')];_0x8c9496+=0x1){_0x5e8c5f=_0x1c30d2[_0x8c9496][_0x613b('0x75')]?_0x49fbb7[_0x1c30d2[_0x8c9496][_0x613b('0x75')]][_0x613b('0x76')]:_0x1c30d2[_0x8c9496]['field'];_0x5e8c5f=_0x1c30d2[_0x8c9496][_0x613b('0x77')]?_[_0x613b('0x78')](_0x210049[_0x1c30d2[_0x8c9496][_0x613b('0x77')]],'%s',_0x5e8c5f):_0x5e8c5f;_0x5e8c5f=_0x1c30d2[_0x8c9496][_0x613b('0x79')]?_[_0x613b('0x78')](_0x3600d0[_0x1c30d2[_0x8c9496][_0x613b('0x79')]],'%s',_0x5e8c5f):_0x5e8c5f;if(_0x1c30d2[_0x8c9496]['groupBy']){_0x52159f[_0x613b('0x68')](_0x5e8c5f);}_0x1c30d2[_0x8c9496]['orderBy']&&_0x52159f[_0x613b('0x3c')](_0x5e8c5f,_0x1c30d2[_0x8c9496]['orderBy']===_0x613b('0x7a')?![]:!![]);_0x52159f['field'](_0x5e8c5f,_0x1c30d2[_0x8c9496][_0x613b('0x7b')]||_0x5e8c5f);}if(_0x172e88[_0x613b('0x7c')]){_0x172e88['joins']=JSON[_0x613b('0x7d')](_0x172e88['joins']);for(var _0x1f73c0=0x0;_0x1f73c0<_0x172e88[_0x613b('0x7c')][_0x613b('0x39')];_0x1f73c0+=0x1){if(_0x172e88['joins'][_0x1f73c0]['type']&&_[_0x613b('0x7e')](_0x2d1c4e,_0x172e88[_0x613b('0x7c')][_0x1f73c0]['type'])&&_0x172e88[_0x613b('0x7c')][_0x1f73c0]['parentKey']&&_0x172e88[_0x613b('0x7c')][_0x1f73c0][_0x613b('0x7f')]&&_0x172e88[_0x613b('0x7c')][_0x1f73c0][_0x613b('0x80')]){_0x52159f[_0x172e88['joins'][_0x1f73c0][_0x613b('0x31')]](_0x172e88['joins'][_0x1f73c0]['foreignTable'],null,util[_0x613b('0x79')](_0x613b('0x81'),_0x172e88[_0x613b('0x74')],_0x172e88[_0x613b('0x7c')][_0x1f73c0][_0x613b('0x82')],_0x172e88[_0x613b('0x7c')][_0x1f73c0]['foreignTable'],_0x172e88[_0x613b('0x7c')][_0x1f73c0][_0x613b('0x80')]));}}}if(_0x172e88[_0x613b('0x83')]){_0x172e88['conditions']=JSON['parse'](_0x172e88[_0x613b('0x83')]);_0x52159f[_0x613b('0x3e')](_0x40b20d(_0x172e88['conditions'][_0x613b('0x68')]));}_0x7b31eb=_0x52159f[_0x613b('0x84')]();_0x52159f['limit'](_0x147429);_0x52159f[_0x613b('0x1b')](0x0);logger[_0x613b('0x85')](_0x613b('0x86'),_0x52159f[_0x613b('0x87')]());return dbH['sequelize'][_0x613b('0x34')](_0x52159f[_0x613b('0x87')](),{'type':dbH[_0x613b('0x88')][_0x613b('0x89')][_0x613b('0x8a')]});}})['then'](respondWithResult(_0x5cdc2a,null))[_0x613b('0x47')](handleError(_0x5cdc2a,null));};function runReport(_0x10b169,_0x3c332c,_0x261ee2){var _0xc270d4=_0x3c332c[_0x613b('0x2a')];var _0x49a2c3=0xa;var _0x1f4c2d=['join','left_join',_0x613b('0x8b'),_0x613b('0x8c')];var _0x325492={'SUM':_0x613b('0x56'),'COUNT':_0x613b('0x57'),'COUNT DISTINCT':_0x613b('0x58'),'MAX':_0x613b('0x59'),'MIN':_0x613b('0x5a'),'AVG':_0x613b('0x5b'),'GROUP_CONCAT':_0x613b('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x252b3e={'SEC_TO_TIME':_0x613b('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x613b('0x8d'),'UNIX_TIMESTAMP':_0x613b('0x62')};var _0x187b77=function(_0x40ce59){return!_['includes']([_0x613b('0x63'),_0x613b('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x40ce59);};var _0x3c19d2=function(_0x2a5307){if(!_0x2a5307||!_0x2a5307[_0x613b('0x67')]['length']){return'';}for(var _0x25fa9c='(',_0x526bcf=0x0;_0x526bcf<_0x2a5307[_0x613b('0x67')][_0x613b('0x39')];_0x526bcf+=0x1){_0x526bcf>0x0&&(_0x25fa9c+='\x20'+_0x2a5307[_0x613b('0x8e')]+'\x20');_0x25fa9c+=_0x2a5307[_0x613b('0x67')][_0x526bcf][_0x613b('0x68')]?_0x3c19d2(_0x2a5307[_0x613b('0x67')][_0x526bcf][_0x613b('0x68')]):_0x2a5307['rules'][_0x526bcf][_0x613b('0x69')]+'\x20'+_0x2a5307[_0x613b('0x67')][_0x526bcf][_0x613b('0x6a')]+(_0x187b77(_0x2a5307[_0x613b('0x67')][_0x526bcf]['condition'])?'\x20'+_0x2a5307[_0x613b('0x67')][_0x526bcf][_0x613b('0x6b')]:'');}return _0x25fa9c+')';};var _0x4a440d={'where':{'id':_0x10b169['id']}},_0x464689,_0x118f1d,_0x456eee,_0xbe7782,_0x4e480d;_0x4a440d=_[_0x613b('0x42')]({},_0x4a440d,_0x261ee2);return db[_0x613b('0x2e')]['find'](_0x4a440d)[_0x613b('0x23')](function(_0x38226b){if(_0x38226b){_0x464689=_0x38226b;return _0x38226b[_0x613b('0x6c')]();}return null;})[_0x613b('0x23')](function(_0x141bef){if(_0x141bef){if(!_0x141bef[_0x613b('0x39')]){throw new db[(_0x613b('0x6d'))][(_0x613b('0x6e'))](_0x613b('0x6f'),0x193);}_0x118f1d=_0x141bef;return db[_0x613b('0x70')][_0x613b('0x8f')]({'raw':!![]});}return null;})['then'](function(_0x36d6c0){if(_0x36d6c0){_0x456eee=_[_0x613b('0x71')](_0x36d6c0,'id');var _0x4dc34a;var _0x304f92=squel[_0x613b('0x72')]();_0x304f92[_0x613b('0x73')](_0x464689[_0x613b('0x74')]);for(var _0x53e0d8=0x0;_0x53e0d8<_0x118f1d['length'];_0x53e0d8+=0x1){_0x4dc34a=_0x118f1d[_0x53e0d8][_0x613b('0x75')]?_0x456eee[_0x118f1d[_0x53e0d8][_0x613b('0x75')]]['metric']:_0x118f1d[_0x53e0d8][_0x613b('0x69')];_0x4dc34a=_0x118f1d[_0x53e0d8][_0x613b('0x77')]?_['replace'](_0x325492[_0x118f1d[_0x53e0d8][_0x613b('0x77')]],'%s',_0x4dc34a):_0x4dc34a;_0x4dc34a=_0x118f1d[_0x53e0d8]['format']?_[_0x613b('0x78')](_0x252b3e[_0x118f1d[_0x53e0d8][_0x613b('0x79')]],'%s',_0x4dc34a):_0x4dc34a;if(_0x118f1d[_0x53e0d8][_0x613b('0x90')]){_0x304f92['group'](_0x4dc34a);}_0x118f1d[_0x53e0d8][_0x613b('0x91')]&&_0x304f92[_0x613b('0x3c')](_0x4dc34a,_0x118f1d[_0x53e0d8][_0x613b('0x91')]==='DESC'?![]:!![]);_0x304f92[_0x613b('0x69')](_0x4dc34a,_0x118f1d[_0x53e0d8][_0x613b('0x7b')]||_0x4dc34a);}if(_0x464689['joins']){_0x464689['joins']=JSON['parse'](_0x464689[_0x613b('0x7c')]);for(var _0x2ab1dc=0x0;_0x2ab1dc<_0x464689[_0x613b('0x7c')][_0x613b('0x39')];_0x2ab1dc+=0x1){if(_0x464689['joins'][_0x2ab1dc][_0x613b('0x31')]&&_[_0x613b('0x7e')](_0x1f4c2d,_0x464689['joins'][_0x2ab1dc]['type'])&&_0x464689[_0x613b('0x7c')][_0x2ab1dc][_0x613b('0x82')]&&_0x464689[_0x613b('0x7c')][_0x2ab1dc][_0x613b('0x7f')]&&_0x464689['joins'][_0x2ab1dc][_0x613b('0x80')]){_0x304f92[_0x464689[_0x613b('0x7c')][_0x2ab1dc][_0x613b('0x31')]](_0x464689['joins'][_0x2ab1dc][_0x613b('0x7f')],null,util[_0x613b('0x79')](_0x613b('0x81'),_0x464689[_0x613b('0x74')],_0x464689['joins'][_0x2ab1dc][_0x613b('0x82')],_0x464689['joins'][_0x2ab1dc]['foreignTable'],_0x464689[_0x613b('0x7c')][_0x2ab1dc][_0x613b('0x80')]));}}}if(_0x464689[_0x613b('0x83')]){_0x464689['conditions']=JSON['parse'](_0x464689[_0x613b('0x83')]);_0x304f92[_0x613b('0x3e')](_0x3c19d2(_0x464689[_0x613b('0x83')][_0x613b('0x68')]));}_0x4e480d=_0x304f92[_0x613b('0x84')]();_0x304f92[_0x613b('0x1a')](_0x49a2c3);_0x304f92[_0x613b('0x1b')](0x0);return;}})['then'](function(){if(_0x3c332c['output']===_0x613b('0x92')){return null;}var _0x17ca3f=_[_0x613b('0x42')](_0x3c332c,{'name':_0x3c332c['fullPath']||_0x3c332c[_0x613b('0x2a')]||_0x464689['name'],'basename':_0xc270d4,'savename':util['format'](_0x613b('0x93'),_0x3c332c[_0x613b('0x2a')]||_0x464689[_0x613b('0x2a')],require(_0x613b('0x94'))[_0x613b('0x95')](0x4),_0x3c332c[_0x613b('0x96')]||_0x613b('0x97')),'reportId':_0x464689['id'],'reportType':_0x613b('0x98')});return db['AnalyticExtractedReport'][_0x613b('0x4c')](_0x17ca3f,{'raw':!![]});})[_0x613b('0x23')](function(_0x214fc1){if(_0x464689[_0x613b('0x74')]===_0x613b('0x99')){_0x4e480d[_0x613b('0x3e')](_0x464689[_0x613b('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3c332c['startDate'],_0x3c332c[_0x613b('0x9a')]);}else{_0x4e480d[_0x613b('0x3e')](_0x464689[_0x613b('0x74')]+_0x613b('0x9b'),_0x3c332c['startDate'],_0x3c332c['endDate']);}if(_0x214fc1){logger[_0x613b('0x9c')](_0x613b('0x9d'),_0x4e480d['toString']());require(_0x613b('0x9e'))[_0x613b('0x9f')](path[_0x613b('0x54')](__dirname,_0x613b('0xa0'),_0x214fc1[_0x613b('0x96')]),[_0x214fc1['id'],_0x4e480d[_0x613b('0x87')](),path['join'](__dirname,_0x613b('0xa1'),_0x214fc1[_0x613b('0xa2')]),_0xc270d4]);return _0x214fc1;}else{var _0x160816=squel[_0x613b('0x72')]();_0x160816[_0x613b('0x73')]('('+_0x4e480d[_0x613b('0x87')]()+')','countTable');_0x160816['field'](_0x613b('0xa3'),_0x613b('0x1c'));_0x4e480d[_0x613b('0x1a')](_0x3c332c[_0x613b('0x1a')]||_0x49a2c3);_0x4e480d[_0x613b('0x1b')](_0x3c332c[_0x613b('0x1b')]||0x0);return dbH['sequelize'][_0x613b('0x34')](_0x160816[_0x613b('0x87')](),{'type':dbH[_0x613b('0x88')]['QueryTypes'][_0x613b('0x8a')]})[_0x613b('0x23')](function(_0x456187){if(!_0x456187['length']){_0xbe7782=0x0;}else{_0xbe7782=_0x456187[0x0]['count']||0x0;}return dbH['sequelize'][_0x613b('0x34')](_0x4e480d[_0x613b('0x87')](),{'type':dbH[_0x613b('0x88')]['QueryTypes'][_0x613b('0x8a')]});})[_0x613b('0x23')](function(_0x1d78c1){return{'rows':_0x1d78c1||[],'count':_0xbe7782};});}});}exports[_0x613b('0xa4')]=function(_0x62defc,_0x47dbfc){return runReport(_0x62defc[_0x613b('0x49')],_0x62defc[_0x613b('0x34')],_0x62defc[_0x613b('0x44')])['then'](respondWithResult(_0x47dbfc,null))[_0x613b('0x47')](handleError(_0x47dbfc,null));};exports[_0x613b('0xa5')]=runReport;exports[_0x613b('0x34')]=function(_0x5e17b9,_0x38af16){var _0x58367b=0xa;var _0xdc4061=[_0x613b('0x54'),'left_join',_0x613b('0x8b'),_0x613b('0x8c')];var _0x2b82ed={'SUM':'SUM(%s)','COUNT':_0x613b('0x57'),'COUNT DISTINCT':_0x613b('0x58'),'MAX':_0x613b('0x59'),'MIN':_0x613b('0x5a'),'AVG':_0x613b('0x5b'),'GROUP_CONCAT':_0x613b('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x11599b={'SEC_TO_TIME':_0x613b('0x5f'),'DATE':_0x613b('0x60'),'HOUR':_0x613b('0x61'),'ROUND':_0x613b('0x8d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x455982=function(_0x5e6c12){return!_[_0x613b('0x7e')](['IS\x20NULL',_0x613b('0x64'),_0x613b('0x65'),_0x613b('0x66')],_0x5e6c12);};var _0x103be4=function(_0x38d274){if(!_0x38d274||!_0x38d274['rules'][_0x613b('0x39')]){return'';}for(var _0x49e39d='(',_0x48a21c=0x0;_0x48a21c<_0x38d274[_0x613b('0x67')][_0x613b('0x39')];_0x48a21c+=0x1){_0x48a21c>0x0&&(_0x49e39d+='\x20'+_0x38d274['operator']+'\x20');_0x49e39d+=_0x38d274[_0x613b('0x67')][_0x48a21c]['group']?_0x103be4(_0x38d274[_0x613b('0x67')][_0x48a21c][_0x613b('0x68')]):_0x38d274['rules'][_0x48a21c]['field']+'\x20'+_0x38d274[_0x613b('0x67')][_0x48a21c][_0x613b('0x6a')]+(_0x455982(_0x38d274['rules'][_0x48a21c][_0x613b('0x6a')])?'\x20'+_0x38d274[_0x613b('0x67')][_0x48a21c][_0x613b('0x6b')]:'');}return _0x49e39d+')';};var _0x1fa93a={'where':{'id':_0x5e17b9[_0x613b('0x49')]['id']}},_0x7bc34e,_0x38b55f,_0x5b1d51,_0xb1f041,_0x1a21f3;_0x1fa93a=_[_0x613b('0x42')]({},_0x1fa93a,_0x5e17b9[_0x613b('0x44')]);return db['AnalyticCustomReport'][_0x613b('0x4b')](_0x1fa93a)[_0x613b('0x23')](function(_0x2e015c){if(_0x2e015c){_0x7bc34e=_0x2e015c;return _0x2e015c['getFields']();}return null;})[_0x613b('0x23')](function(_0x46bd46){if(_0x46bd46){if(!_0x46bd46[_0x613b('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x613b('0x6f'),0x193);}_0x38b55f=_0x46bd46;return db[_0x613b('0x70')][_0x613b('0x8f')]({'raw':!![]});}return null;})['then'](function(_0x566e9a){if(_0x566e9a){_0x5b1d51=_[_0x613b('0x71')](_0x566e9a,'id');var _0x5f25a0;var _0x85f5aa=squel['select']();_0x85f5aa[_0x613b('0x73')](_0x7bc34e[_0x613b('0x74')]);for(var _0x237c24=0x0;_0x237c24<_0x38b55f['length'];_0x237c24+=0x1){_0x5f25a0=_0x38b55f[_0x237c24][_0x613b('0x75')]?_0x5b1d51[_0x38b55f[_0x237c24][_0x613b('0x75')]]['metric']:_0x38b55f[_0x237c24][_0x613b('0x69')];_0x5f25a0=_0x38b55f[_0x237c24]['function']?_[_0x613b('0x78')](_0x2b82ed[_0x38b55f[_0x237c24][_0x613b('0x77')]],'%s',_0x5f25a0):_0x5f25a0;_0x5f25a0=_0x38b55f[_0x237c24][_0x613b('0x79')]?_[_0x613b('0x78')](_0x11599b[_0x38b55f[_0x237c24]['format']],'%s',_0x5f25a0):_0x5f25a0;if(_0x38b55f[_0x237c24][_0x613b('0x90')]){_0x85f5aa[_0x613b('0x68')](_0x5f25a0);}_0x38b55f[_0x237c24]['orderBy']&&_0x85f5aa['order'](_0x5f25a0,_0x38b55f[_0x237c24][_0x613b('0x91')]===_0x613b('0x7a')?![]:!![]);_0x85f5aa['field'](_0x5f25a0,_0x38b55f[_0x237c24]['alias']||_0x5f25a0);}if(_0x7bc34e[_0x613b('0x7c')]){_0x7bc34e[_0x613b('0x7c')]=JSON['parse'](_0x7bc34e[_0x613b('0x7c')]);for(var _0x430c19=0x0;_0x430c19<_0x7bc34e[_0x613b('0x7c')][_0x613b('0x39')];_0x430c19+=0x1){if(_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x31')]&&_[_0x613b('0x7e')](_0xdc4061,_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x31')])&&_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x82')]&&_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x7f')]&&_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x80')]){_0x85f5aa[_0x7bc34e['joins'][_0x430c19][_0x613b('0x31')]](_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x7bc34e[_0x613b('0x74')],_0x7bc34e['joins'][_0x430c19]['parentKey'],_0x7bc34e[_0x613b('0x7c')][_0x430c19][_0x613b('0x7f')],_0x7bc34e[_0x613b('0x7c')][_0x430c19]['foreignKey']));}}}if(_0x7bc34e[_0x613b('0x83')]){_0x7bc34e[_0x613b('0x83')]=JSON[_0x613b('0x7d')](_0x7bc34e[_0x613b('0x83')]);_0x85f5aa['where'](_0x103be4(_0x7bc34e[_0x613b('0x83')]['group']));}_0x1a21f3=_0x85f5aa['clone']();_0x85f5aa[_0x613b('0x1a')](_0x58367b);_0x85f5aa['offset'](0x0);logger[_0x613b('0x85')](_0x613b('0x86'),_0x85f5aa[_0x613b('0x87')]());return dbH[_0x613b('0x88')][_0x613b('0x34')](_0x85f5aa[_0x613b('0x87')](),{'type':dbH[_0x613b('0x88')][_0x613b('0x89')][_0x613b('0x8a')]});}})[_0x613b('0x23')](function(){return{'sql':_0x1a21f3[_0x613b('0x87')]()};})['then'](respondWithResult(_0x38af16,null))[_0x613b('0x47')](handleError(_0x38af16,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 14eb8e8..40c514b 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 _0xf611=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xf611,0x65));var _0x1f61=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0xf611[_0x1e62b8];return _0x2ab271;};'use strict';var _=require(_0x1f61('0x0'));var util=require(_0x1f61('0x1'));var logger=require('../../config/logger')(_0x1f61('0x2'));var moment=require(_0x1f61('0x3'));var BPromise=require(_0x1f61('0x4'));var rp=require(_0x1f61('0x5'));var fs=require('fs');var path=require(_0x1f61('0x6'));var rimraf=require(_0x1f61('0x7'));var config=require(_0x1f61('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x1f61('0x9')]=function(_0x111773,_0x2553e7){return _0x111773[_0x1f61('0xa')](_0x1f61('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9505=['analytics_custom_reports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x25727c,_0x1e22db){var _0x122b4b=function(_0x4ee04a){while(--_0x4ee04a){_0x25727c['push'](_0x25727c['shift']());}};_0x122b4b(++_0x1e22db);}(_0x9505,0xaa));var _0x5950=function(_0x243fa7,_0x58bd72){_0x243fa7=_0x243fa7-0x0;var _0x841662=_0x9505[_0x243fa7];return _0x841662;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require('bluebird');var rp=require(_0x5950('0x4'));var fs=require('fs');var path=require(_0x5950('0x5'));var rimraf=require(_0x5950('0x6'));var config=require(_0x5950('0x7'));var attributes=require(_0x5950('0x8'));module[_0x5950('0x9')]=function(_0x386209,_0x16e743){return _0x386209[_0x5950('0xa')](_0x5950('0xb'),attributes,{'tableName':_0x5950('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 99dbf38..458642c 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 _0x09e8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0x09e8,0x70));var _0x809e=function(_0x374db6,_0x43919b){_0x374db6=_0x374db6-0x0;var _0x179262=_0x09e8[_0x374db6];return _0x179262;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x809e('0x0'));var rs=require(_0x809e('0x1'));var fs=require('fs');var Redis=require(_0x809e('0x2'));var db=require(_0x809e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x809e('0x4'))(_0x809e('0x5'));var config=require(_0x809e('0x6'));var jayson=require(_0x809e('0x7'));var client=jayson[_0x809e('0x8')][_0x809e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55bf91,_0x4a61fa,_0x219dfc){return new BPromise(function(_0x28545f,_0x122dbe){return client[_0x809e('0xa')](_0x55bf91,_0x219dfc)[_0x809e('0xb')](function(_0x25c64c){logger[_0x809e('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4a61fa,_0x809e('0xd'));logger[_0x809e('0xe')](_0x809e('0xf'),_0x4a61fa,'request\x20sent',JSON[_0x809e('0x10')](_0x25c64c));if(_0x25c64c[_0x809e('0x11')]){if(_0x25c64c[_0x809e('0x11')][_0x809e('0x12')]===0x1f4){logger[_0x809e('0x11')](_0x809e('0x13'),_0x4a61fa,_0x25c64c[_0x809e('0x11')][_0x809e('0x14')]);return _0x122dbe(_0x25c64c[_0x809e('0x11')][_0x809e('0x14')]);}logger[_0x809e('0x11')](_0x809e('0x13'),_0x4a61fa,_0x25c64c[_0x809e('0x11')][_0x809e('0x14')]);return _0x28545f(_0x25c64c['error'][_0x809e('0x14')]);}else{logger[_0x809e('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4a61fa,_0x809e('0xd'));_0x28545f(_0x25c64c[_0x809e('0x15')]['message']);}})[_0x809e('0x16')](function(_0x2af89c){logger['error'](_0x809e('0x13'),_0x4a61fa,_0x2af89c);_0x122dbe(_0x2af89c);});});} \ No newline at end of file +var _0x2d6f=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x2d6f,0xbe));var _0xf2d6=function(_0x40a4fc,_0x13e07c){_0x40a4fc=_0x40a4fc-0x0;var _0x4dcfd4=_0x2d6f[_0x40a4fc];return _0x4dcfd4;};'use strict';var _=require(_0xf2d6('0x0'));var util=require(_0xf2d6('0x1'));var moment=require(_0xf2d6('0x2'));var BPromise=require(_0xf2d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2d6('0x4'));var db=require(_0xf2d6('0x5'))['db'];var utils=require(_0xf2d6('0x6'));var logger=require(_0xf2d6('0x7'))('rpc');var config=require(_0xf2d6('0x8'));var jayson=require(_0xf2d6('0x9'));var client=jayson[_0xf2d6('0xa')][_0xf2d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5042,_0x56a878,_0x41575d){return new BPromise(function(_0x103e91,_0x4dabaa){return client[_0xf2d6('0xc')](_0x1d5042,_0x41575d)[_0xf2d6('0xd')](function(_0x1bc2b7){logger[_0xf2d6('0xe')](_0xf2d6('0xf'),_0x56a878,_0xf2d6('0x10'));logger[_0xf2d6('0x11')](_0xf2d6('0x12'),_0x56a878,_0xf2d6('0x10'),JSON[_0xf2d6('0x13')](_0x1bc2b7));if(_0x1bc2b7[_0xf2d6('0x14')]){if(_0x1bc2b7[_0xf2d6('0x14')][_0xf2d6('0x15')]===0x1f4){logger[_0xf2d6('0x14')](_0xf2d6('0xf'),_0x56a878,_0x1bc2b7[_0xf2d6('0x14')][_0xf2d6('0x16')]);return _0x4dabaa(_0x1bc2b7[_0xf2d6('0x14')]['message']);}logger[_0xf2d6('0x14')](_0xf2d6('0xf'),_0x56a878,_0x1bc2b7[_0xf2d6('0x14')][_0xf2d6('0x16')]);return _0x103e91(_0x1bc2b7['error'][_0xf2d6('0x16')]);}else{logger[_0xf2d6('0xe')](_0xf2d6('0xf'),_0x56a878,_0xf2d6('0x10'));_0x103e91(_0x1bc2b7[_0xf2d6('0x17')][_0xf2d6('0x16')]);}})[_0xf2d6('0x18')](function(_0x468c40){logger[_0xf2d6('0x14')](_0xf2d6('0xf'),_0x56a878,_0x468c40);_0x4dabaa(_0x468c40);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 65bdb4e..f7b613a 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 _0x2c6f=['/:id','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x2c6f,0x1c6));var _0xf2c6=function(_0x5413a5,_0x3e3c8b){_0x5413a5=_0x5413a5-0x0;var _0xed3967=_0x2c6f[_0x5413a5];return _0xed3967;};'use strict';var multer=require('multer');var util=require(_0xf2c6('0x0'));var path=require('path');var timeout=require(_0xf2c6('0x1'));var express=require(_0xf2c6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf2c6('0x3'));var interaction=require(_0xf2c6('0x4'));var config=require(_0xf2c6('0x5'));var controller=require(_0xf2c6('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf2c6('0x7')](_0xf2c6('0x8'),auth[_0xf2c6('0x9')](),controller[_0xf2c6('0xa')]);router[_0xf2c6('0x7')](_0xf2c6('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0xf2c6('0x7')](_0xf2c6('0xc'),auth[_0xf2c6('0x9')](),controller[_0xf2c6('0xd')]);router[_0xf2c6('0x7')](_0xf2c6('0xe'),auth[_0xf2c6('0x9')](),controller['query']);router[_0xf2c6('0xf')]('/',auth['isAuthenticated'](),controller[_0xf2c6('0x10')]);router[_0xf2c6('0x11')](_0xf2c6('0x8'),auth[_0xf2c6('0x9')](),controller[_0xf2c6('0x12')]);router[_0xf2c6('0x13')](_0xf2c6('0x8'),auth[_0xf2c6('0x9')](),controller[_0xf2c6('0x14')]);module[_0xf2c6('0x15')]=router; \ No newline at end of file +var _0xca61=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','preview','/:id/run','run','query'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xca61,0x1be));var _0x1ca6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca61[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1ca6('0x0'));var util=require(_0x1ca6('0x1'));var path=require('path');var timeout=require(_0x1ca6('0x2'));var express=require(_0x1ca6('0x3'));var router=express[_0x1ca6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ca6('0x5'));var controller=require(_0x1ca6('0x6'));router['get']('/',auth[_0x1ca6('0x7')](),controller[_0x1ca6('0x8')]);router['get'](_0x1ca6('0x9'),auth[_0x1ca6('0x7')](),controller[_0x1ca6('0xa')]);router[_0x1ca6('0xb')]('/:id/preview',auth[_0x1ca6('0x7')](),controller[_0x1ca6('0xc')]);router['get'](_0x1ca6('0xd'),auth[_0x1ca6('0x7')](),controller[_0x1ca6('0xe')]);router[_0x1ca6('0xb')]('/:id/query',auth[_0x1ca6('0x7')](),controller[_0x1ca6('0xf')]);router[_0x1ca6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1ca6('0x11')](_0x1ca6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1ca6('0x12')]('/:id',auth[_0x1ca6('0x7')](),controller[_0x1ca6('0x13')]);module[_0x1ca6('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 6bee773..4fe2583 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 _0x5d58=['TEXT','STRING'];(function(_0x4747ce,_0x31e43c){var _0x307ed5=function(_0x28ed8){while(--_0x28ed8){_0x4747ce['push'](_0x4747ce['shift']());}};_0x307ed5(++_0x31e43c);}(_0x5d58,0x187));var _0x85d5=function(_0x235d34,_0x3a8ab5){_0x235d34=_0x235d34-0x0;var _0x113859=_0x5d58[_0x235d34];return _0x113859;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x8958,0x93));var _0x8895=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x8958[_0x26da89];return _0xc95b7b;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7218c52..d77a4d3 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4acdd0,_0x4d1f59){var _0x392ba5=function(_0x30cab7){while(--_0x30cab7){_0x4acdd0['push'](_0x4acdd0['shift']());}};_0x392ba5(++_0x4d1f59);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x326f,0xd1));var _0xf326=function(_0x92bb6a,_0xfc66ec){_0x92bb6a=_0x92bb6a-0x0;var _0x35fe17=_0x326f[_0x92bb6a];return _0x35fe17;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9cb50a7..fa9bdea 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 _0xfa03=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x113c32,_0x555a00){var _0x1e50c0=function(_0x440a25){while(--_0x440a25){_0x113c32['push'](_0x113c32['shift']());}};_0x1e50c0(++_0x555a00);}(_0xfa03,0x111));var _0x3fa0=function(_0x15162b,_0x341587){_0x15162b=_0x15162b-0x0;var _0x147c6b=_0xfa03[_0x15162b];return _0x147c6b;};'use strict';var _=require(_0x3fa0('0x0'));var util=require(_0x3fa0('0x1'));var logger=require(_0x3fa0('0x2'))(_0x3fa0('0x3'));var moment=require(_0x3fa0('0x4'));var BPromise=require('bluebird');var rp=require(_0x3fa0('0x5'));var fs=require('fs');var path=require(_0x3fa0('0x6'));var rimraf=require(_0x3fa0('0x7'));var config=require(_0x3fa0('0x8'));var attributes=require(_0x3fa0('0x9'));module[_0x3fa0('0xa')]=function(_0x593006,_0x4d3ee9){return _0x593006['define']('AnalyticDefaultReport',attributes,{'tableName':_0x3fa0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a53=['exports','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x555479,_0x3aa2b4){var _0x560c8e=function(_0x5168ef){while(--_0x5168ef){_0x555479['push'](_0x555479['shift']());}};_0x560c8e(++_0x3aa2b4);}(_0x2a53,0x1cb));var _0x32a5=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x2a53[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x32a5('0x0'));var util=require('util');var logger=require(_0x32a5('0x1'))(_0x32a5('0x2'));var moment=require(_0x32a5('0x3'));var BPromise=require(_0x32a5('0x4'));var rp=require(_0x32a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32a5('0x6'));var config=require(_0x32a5('0x7'));var attributes=require(_0x32a5('0x8'));module[_0x32a5('0x9')]=function(_0x161b87,_0x2b0f70){return _0x161b87['define'](_0x32a5('0xa'),attributes,{'tableName':_0x32a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2bf8d6d..f60ff60 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 _0x73f9=['message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x29a20c,_0x37a6c3){var _0x1fe64e=function(_0x2da12e){while(--_0x2da12e){_0x29a20c['push'](_0x29a20c['shift']());}};_0x1fe64e(++_0x37a6c3);}(_0x73f9,0x1f1));var _0x973f=function(_0x249ab1,_0xb48e57){_0x249ab1=_0x249ab1-0x0;var _0x5a9ed2=_0x73f9[_0x249ab1];return _0x5a9ed2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x973f('0x0'));var BPromise=require('bluebird');var rs=require(_0x973f('0x1'));var fs=require('fs');var Redis=require(_0x973f('0x2'));var db=require(_0x973f('0x3'))['db'];var utils=require(_0x973f('0x4'));var logger=require('../../config/logger')(_0x973f('0x5'));var config=require(_0x973f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x973f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe757ec,_0x301ef8,_0x33515b){return new BPromise(function(_0x25696b,_0x3dd9fe){return client['request'](_0xe757ec,_0x33515b)[_0x973f('0x8')](function(_0x807288){logger[_0x973f('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x301ef8,_0x973f('0xa'));logger[_0x973f('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x301ef8,'request\x20sent',JSON[_0x973f('0xc')](_0x807288));if(_0x807288[_0x973f('0xd')]){if(_0x807288['error'][_0x973f('0xe')]===0x1f4){logger[_0x973f('0xd')](_0x973f('0xf'),_0x301ef8,_0x807288[_0x973f('0xd')][_0x973f('0x10')]);return _0x3dd9fe(_0x807288[_0x973f('0xd')][_0x973f('0x10')]);}logger[_0x973f('0xd')](_0x973f('0xf'),_0x301ef8,_0x807288[_0x973f('0xd')][_0x973f('0x10')]);return _0x25696b(_0x807288[_0x973f('0xd')][_0x973f('0x10')]);}else{logger['info'](_0x973f('0xf'),_0x301ef8,'request\x20sent');_0x25696b(_0x807288[_0x973f('0x11')][_0x973f('0x10')]);}})[_0x973f('0x12')](function(_0x4a084a){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x301ef8,_0x4a084a);_0x3dd9fe(_0x4a084a);});});} \ No newline at end of file +var _0xbc01=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird'];(function(_0x3348de,_0xd336fb){var _0x3e5a15=function(_0x30a61b){while(--_0x30a61b){_0x3348de['push'](_0x3348de['shift']());}};_0x3e5a15(++_0xd336fb);}(_0xbc01,0xb3));var _0x1bc0=function(_0x44a0af,_0x13363d){_0x44a0af=_0x44a0af-0x0;var _0x518977=_0xbc01[_0x44a0af];return _0x518977;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1bc0('0x0'));var rs=require(_0x1bc0('0x1'));var fs=require('fs');var Redis=require(_0x1bc0('0x2'));var db=require(_0x1bc0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1bc0('0x4'))('rpc');var config=require(_0x1bc0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1bc0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c475,_0xe726ff,_0xacfd46){return new BPromise(function(_0x45c38b,_0x2ba07c){return client['request'](_0x49c475,_0xacfd46)[_0x1bc0('0x7')](function(_0x2c764a){logger[_0x1bc0('0x8')](_0x1bc0('0x9'),_0xe726ff,_0x1bc0('0xa'));logger['debug'](_0x1bc0('0xb'),_0xe726ff,_0x1bc0('0xa'),JSON[_0x1bc0('0xc')](_0x2c764a));if(_0x2c764a[_0x1bc0('0xd')]){if(_0x2c764a[_0x1bc0('0xd')][_0x1bc0('0xe')]===0x1f4){logger[_0x1bc0('0xd')](_0x1bc0('0x9'),_0xe726ff,_0x2c764a[_0x1bc0('0xd')][_0x1bc0('0xf')]);return _0x2ba07c(_0x2c764a[_0x1bc0('0xd')][_0x1bc0('0xf')]);}logger['error'](_0x1bc0('0x9'),_0xe726ff,_0x2c764a[_0x1bc0('0xd')][_0x1bc0('0xf')]);return _0x45c38b(_0x2c764a[_0x1bc0('0xd')][_0x1bc0('0xf')]);}else{logger[_0x1bc0('0x8')](_0x1bc0('0x9'),_0xe726ff,'request\x20sent');_0x45c38b(_0x2c764a[_0x1bc0('0x10')][_0x1bc0('0xf')]);}})[_0x1bc0('0x11')](function(_0x492286){logger['error'](_0x1bc0('0x9'),_0xe726ff,_0x492286);_0x2ba07c(_0x492286);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0bd4c5d..aad8674 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 _0x8b33=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x278bbb,_0x546e2f){var _0x444877=function(_0x399547){while(--_0x399547){_0x278bbb['push'](_0x278bbb['shift']());}};_0x444877(++_0x546e2f);}(_0x8b33,0x12e));var _0x38b3=function(_0x293e4c,_0x138c21){_0x293e4c=_0x293e4c-0x0;var _0x51099d=_0x8b33[_0x293e4c];return _0x51099d;};'use strict';var multer=require(_0x38b3('0x0'));var util=require(_0x38b3('0x1'));var path=require(_0x38b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x38b3('0x3'));var router=express['Router']();var fs_extra=require(_0x38b3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x38b3('0x5'));var config=require(_0x38b3('0x6'));var controller=require(_0x38b3('0x7'));router[_0x38b3('0x8')]('/',auth[_0x38b3('0x9')](),controller[_0x38b3('0xa')]);router['get'](_0x38b3('0xb'),auth[_0x38b3('0x9')](),controller[_0x38b3('0xc')]);router['get'](_0x38b3('0xd'),auth[_0x38b3('0x9')](),controller[_0x38b3('0xe')]);router[_0x38b3('0x8')](_0x38b3('0xf'),auth[_0x38b3('0x9')](),controller[_0x38b3('0x10')]);router[_0x38b3('0x8')](_0x38b3('0x11'),auth[_0x38b3('0x9')](),controller[_0x38b3('0x12')]);router[_0x38b3('0x13')]('/',auth[_0x38b3('0x9')](),controller[_0x38b3('0x14')]);router[_0x38b3('0x15')]('/:id',auth[_0x38b3('0x9')](),controller[_0x38b3('0x16')]);router[_0x38b3('0x17')](_0x38b3('0xb'),auth[_0x38b3('0x9')](),controller[_0x38b3('0x18')]);module[_0x38b3('0x19')]=router; \ No newline at end of file +var _0x345a=['update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','post','create','put'];(function(_0x4287fe,_0x14ad49){var _0x329a39=function(_0x3c30a9){while(--_0x3c30a9){_0x4287fe['push'](_0x4287fe['shift']());}};_0x329a39(++_0x14ad49);}(_0x345a,0xc0));var _0xa345=function(_0x5d6d21,_0x3daa99){_0x5d6d21=_0x5d6d21-0x0;var _0x590ed3=_0x345a[_0x5d6d21];return _0x590ed3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa345('0x0'));var timeout=require(_0xa345('0x1'));var express=require('express');var router=express[_0xa345('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa345('0x3'));var interaction=require(_0xa345('0x4'));var config=require(_0xa345('0x5'));var controller=require(_0xa345('0x6'));router[_0xa345('0x7')]('/',auth[_0xa345('0x8')](),controller[_0xa345('0x9')]);router[_0xa345('0x7')](_0xa345('0xa'),auth[_0xa345('0x8')](),controller[_0xa345('0xb')]);router[_0xa345('0x7')](_0xa345('0xc'),auth[_0xa345('0x8')](),controller['preview']);router[_0xa345('0x7')]('/:id/run',auth[_0xa345('0x8')](),controller[_0xa345('0xd')]);router['get'](_0xa345('0xe'),auth[_0xa345('0x8')](),controller['query']);router[_0xa345('0xf')]('/',auth[_0xa345('0x8')](),controller[_0xa345('0x10')]);router[_0xa345('0x11')](_0xa345('0xa'),auth['isAuthenticated'](),controller[_0xa345('0x12')]);router[_0xa345('0x13')](_0xa345('0xa'),auth[_0xa345('0x8')](),controller['destroy']);module[_0xa345('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8c5afc8..baacc81 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 _0xed65=['xlsx','DATE','Loading','manual','scheduled','INTEGER','exports','STRING','ENUM','csv','pdf'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xed65,0x1ea));var _0x5ed6=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xed65[_0x2e50a2];return _0x47e5de;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5ed6('0x0')]={'name':{'type':Sequelize[_0x5ed6('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x5ed6('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x5ed6('0x2')](_0x5ed6('0x3'),_0x5ed6('0x4'),_0x5ed6('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x5ed6('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5ed6('0x6')]},'endDate':{'type':Sequelize[_0x5ed6('0x6')]},'status':{'type':Sequelize[_0x5ed6('0x1')],'defaultValue':_0x5ed6('0x7')},'type':{'type':Sequelize['ENUM'](_0x5ed6('0x8'),_0x5ed6('0x9')),'allowNull':![],'defaultValue':_0x5ed6('0x8')},'reportId':{'type':Sequelize[_0x5ed6('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x5ed6('0x1')]}}; \ No newline at end of file +var _0xeb07=['scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading'];(function(_0x59a482,_0x283736){var _0x535530=function(_0x9d9a47){while(--_0x9d9a47){_0x59a482['push'](_0x59a482['shift']());}};_0x535530(++_0x283736);}(_0xeb07,0x17c));var _0x7eb0=function(_0x5a2487,_0x49ceec){_0x5a2487=_0x5a2487-0x0;var _0x433990=_0xeb07[_0x5a2487];return _0x433990;};'use strict';var Sequelize=require(_0x7eb0('0x0'));var moment=require(_0x7eb0('0x1'));module[_0x7eb0('0x2')]={'name':{'type':Sequelize[_0x7eb0('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7eb0('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7eb0('0x4')]('csv',_0x7eb0('0x5'),_0x7eb0('0x6')),'allowNull':![],'defaultValue':_0x7eb0('0x7')},'savename':{'type':Sequelize[_0x7eb0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7eb0('0x8')]},'endDate':{'type':Sequelize[_0x7eb0('0x8')]},'status':{'type':Sequelize[_0x7eb0('0x3')],'defaultValue':_0x7eb0('0x9')},'type':{'type':Sequelize['ENUM']('manual',_0x7eb0('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7eb0('0xb')](0xb)[_0x7eb0('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f60d0de..923d921 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 _0x13b7=['ExtractedReports','UserProfileResource','end','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','basename','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get'];(function(_0x4f2536,_0x1c0a21){var _0x164eb9=function(_0xcb8d76){while(--_0xcb8d76){_0x4f2536['push'](_0x4f2536['shift']());}};_0x164eb9(++_0x1c0a21);}(_0x13b7,0x14b));var _0x713b=function(_0x40c0c6,_0x49f7bb){_0x40c0c6=_0x40c0c6-0x0;var _0x2acfe2=_0x13b7[_0x40c0c6];return _0x2acfe2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x713b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x713b('0x1'));var rp=require(_0x713b('0x2'));var moment=require('moment');var BPromise=require(_0x713b('0x3'));var Mustache=require(_0x713b('0x4'));var util=require(_0x713b('0x5'));var path=require('path');var sox=require(_0x713b('0x6'));var csv=require(_0x713b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x713b('0x8'));var _=require(_0x713b('0x9'));var squel=require(_0x713b('0xa'));var crypto=require(_0x713b('0xb'));var jsforce=require(_0x713b('0xc'));var deskjs=require(_0x713b('0xd'));var toCsv=require(_0x713b('0x7'));var querystring=require('querystring');var Papa=require(_0x713b('0xe'));var Redis=require(_0x713b('0xf'));var authService=require(_0x713b('0x10'));var qs=require(_0x713b('0x11'));var as=require(_0x713b('0x12'));var hardwareService=require(_0x713b('0x13'));var logger=require('../../config/logger')(_0x713b('0x14'));var utils=require('../../config/utils');var config=require(_0x713b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x713b('0x16'))['db'];function respondWithStatusCode(_0x2bd6d0,_0x4c570b){_0x4c570b=_0x4c570b||0xcc;return function(_0x3a6a35){if(_0x3a6a35){return _0x2bd6d0[_0x713b('0x17')](_0x4c570b);}return _0x2bd6d0[_0x713b('0x18')](_0x4c570b)['end']();};}function respondWithResult(_0x1a93b1,_0x26d8a4){_0x26d8a4=_0x26d8a4||0xc8;return function(_0x23351b){if(_0x23351b){return _0x1a93b1['status'](_0x26d8a4)[_0x713b('0x19')](_0x23351b);}};}function respondWithFilteredResult(_0x488a8d,_0x5b55bc){return function(_0x28034e){if(_0x28034e){var _0x28b8b1=typeof _0x5b55bc[_0x713b('0x1a')]===_0x713b('0x1b')&&typeof _0x5b55bc[_0x713b('0x1c')]===_0x713b('0x1b');var _0x59705f=_0x28034e[_0x713b('0x1d')];var _0x56380c=_0x28b8b1?0x0:_0x5b55bc[_0x713b('0x1a')];var _0x37be83=_0x28b8b1?_0x28034e[_0x713b('0x1d')]:_0x5b55bc[_0x713b('0x1a')]+_0x5b55bc[_0x713b('0x1c')];var _0x434fbd;if(_0x37be83>=_0x59705f){_0x37be83=_0x59705f;_0x434fbd=0xc8;}else{_0x434fbd=0xce;}_0x488a8d['status'](_0x434fbd);return _0x488a8d['set'](_0x713b('0x1e'),_0x56380c+'-'+_0x37be83+'/'+_0x59705f)[_0x713b('0x19')](_0x28034e);}return null;};}function patchUpdates(_0x20b360){return function(_0x39ec7c){try{jsonpatch['apply'](_0x39ec7c,_0x20b360,!![]);}catch(_0x389168){return BPromise[_0x713b('0x1f')](_0x389168);}return _0x39ec7c[_0x713b('0x20')]();};}function saveUpdates(_0x3884aa,_0x4be940){return function(_0x72ccf6){if(_0x72ccf6){return _0x72ccf6[_0x713b('0x21')](_0x3884aa)[_0x713b('0x22')](function(_0x585fdb){return _0x585fdb;});}return null;};}function removeEntity(_0x2ef6b2,_0x4dc28a){return function(_0x11ad8e){if(_0x11ad8e){return _0x11ad8e[_0x713b('0x23')]()[_0x713b('0x22')](function(){var _0x346096=_0x11ad8e[_0x713b('0x24')]({'plain':!![]});var _0x42dff3=_0x713b('0x25');return db[_0x713b('0x26')][_0x713b('0x23')]({'where':{'type':_0x42dff3,'resourceId':_0x346096['id']}})[_0x713b('0x22')](function(){return _0x11ad8e;});})['then'](function(){_0x2ef6b2[_0x713b('0x18')](0xcc)[_0x713b('0x27')]();});}};}function handleEntityNotFound(_0x2c9a8e,_0x175a52){return function(_0x1660c2){if(!_0x1660c2){_0x2c9a8e[_0x713b('0x17')](0x194);}return _0x1660c2;};}function handleError(_0x225632,_0x380896){_0x380896=_0x380896||0x1f4;return function(_0x1967a4){logger['error'](_0x1967a4[_0x713b('0x28')]);if(_0x1967a4[_0x713b('0x29')]){delete _0x1967a4['name'];}_0x225632[_0x713b('0x18')](_0x380896)[_0x713b('0x2a')](_0x1967a4);};}exports[_0x713b('0x2b')]=function(_0x101847,_0x23f6b5){var _0x4e7431={},_0x59df8b={},_0x4f7eab={'count':0x0,'rows':[]};var _0x3cea9d=_['map'](db[_0x713b('0x2c')][_0x713b('0x2d')],function(_0x346e3c){return{'name':_0x346e3c[_0x713b('0x2e')],'type':_0x346e3c[_0x713b('0x2f')][_0x713b('0x30')]};});_0x59df8b[_0x713b('0x31')]=_[_0x713b('0x32')](_0x3cea9d,_0x713b('0x29'));_0x59df8b[_0x713b('0x33')]=_['keys'](_0x101847['query']);_0x59df8b['filters']=_[_0x713b('0x34')](_0x59df8b[_0x713b('0x31')],_0x59df8b[_0x713b('0x33')]);_0x4e7431['attributes']=_[_0x713b('0x34')](_0x59df8b[_0x713b('0x31')],qs[_0x713b('0x35')](_0x101847[_0x713b('0x33')][_0x713b('0x35')]));_0x4e7431[_0x713b('0x36')]=_0x4e7431[_0x713b('0x36')][_0x713b('0x37')]?_0x4e7431[_0x713b('0x36')]:_0x59df8b[_0x713b('0x31')];if(!_0x101847[_0x713b('0x33')][_0x713b('0x38')]('nolimit')){_0x4e7431[_0x713b('0x1c')]=qs[_0x713b('0x1c')](_0x101847[_0x713b('0x33')][_0x713b('0x1c')]);_0x4e7431[_0x713b('0x1a')]=qs[_0x713b('0x1a')](_0x101847[_0x713b('0x33')][_0x713b('0x1a')]);}_0x4e7431[_0x713b('0x39')]=qs[_0x713b('0x3a')](_0x101847['query'][_0x713b('0x3a')]);_0x4e7431[_0x713b('0x3b')]=qs[_0x713b('0x3c')](_[_0x713b('0x3d')](_0x101847[_0x713b('0x33')],_0x59df8b[_0x713b('0x3c')]),_0x3cea9d);if(_0x101847[_0x713b('0x33')]['filter']){_0x4e7431['where']=_[_0x713b('0x3e')](_0x4e7431[_0x713b('0x3b')],{'$or':_[_0x713b('0x32')](_0x3cea9d,function(_0xb26fe0){if(_0xb26fe0[_0x713b('0x2f')]!==_0x713b('0x3f')){var _0x2aab12={};_0x2aab12[_0xb26fe0[_0x713b('0x29')]]={'$like':'%'+_0x101847[_0x713b('0x33')][_0x713b('0x40')]+'%'};return _0x2aab12;}})});}_0x4e7431=_['merge']({},_0x4e7431,_0x101847[_0x713b('0x41')]);var _0x41380b={'where':_0x4e7431[_0x713b('0x3b')]};return db[_0x713b('0x2c')][_0x713b('0x1d')](_0x41380b)[_0x713b('0x22')](function(_0xd879cd){_0x4f7eab[_0x713b('0x1d')]=_0xd879cd;if(_0x101847[_0x713b('0x33')][_0x713b('0x42')]){_0x4e7431['include']=[{'all':!![]}];}return db[_0x713b('0x2c')][_0x713b('0x43')](_0x4e7431);})[_0x713b('0x22')](function(_0x4abde9){_0x4f7eab[_0x713b('0x44')]=_0x4abde9;return _0x4f7eab;})[_0x713b('0x22')](respondWithFilteredResult(_0x23f6b5,_0x4e7431))[_0x713b('0x45')](handleError(_0x23f6b5,null));};exports[_0x713b('0x46')]=function(_0x4c4915,_0x5be995){var _0x38a52f={'raw':!![],'where':{'id':_0x4c4915[_0x713b('0x47')]['id']}},_0x266ede={};_0x266ede['model']=_[_0x713b('0x48')](db[_0x713b('0x2c')]['rawAttributes']);_0x266ede[_0x713b('0x33')]=_[_0x713b('0x48')](_0x4c4915[_0x713b('0x33')]);_0x266ede['filters']=_[_0x713b('0x34')](_0x266ede[_0x713b('0x31')],_0x266ede[_0x713b('0x33')]);_0x38a52f[_0x713b('0x36')]=_[_0x713b('0x34')](_0x266ede[_0x713b('0x31')],qs[_0x713b('0x35')](_0x4c4915[_0x713b('0x33')]['fields']));_0x38a52f['attributes']=_0x38a52f[_0x713b('0x36')][_0x713b('0x37')]?_0x38a52f[_0x713b('0x36')]:_0x266ede[_0x713b('0x31')];if(_0x4c4915['query'][_0x713b('0x42')]){_0x38a52f[_0x713b('0x49')]=[{'all':!![]}];}_0x38a52f=_['merge']({},_0x38a52f,_0x4c4915[_0x713b('0x41')]);return db['AnalyticExtractedReport']['find'](_0x38a52f)['then'](handleEntityNotFound(_0x5be995,null))[_0x713b('0x22')](respondWithResult(_0x5be995,null))[_0x713b('0x45')](handleError(_0x5be995,null));};exports[_0x713b('0x4a')]=function(_0x13f567,_0x321e69){return db[_0x713b('0x2c')][_0x713b('0x4a')](_0x13f567[_0x713b('0x4b')],{})[_0x713b('0x22')](function(_0x405576){var _0x346f5d=_0x13f567['user']['get']({'plain':!![]});if(!_0x346f5d)throw new Error(_0x713b('0x4c'));if(_0x346f5d[_0x713b('0x4d')]==='user'){var _0x386675=_0x405576[_0x713b('0x24')]({'plain':!![]});var _0x1144b2=_0x713b('0x25');return db['UserProfileSection'][_0x713b('0x4e')]({'where':{'name':_0x1144b2,'userProfileId':_0x346f5d['userProfileId']},'raw':!![]})['then'](function(_0x57a8f7){if(_0x57a8f7&&_0x57a8f7['autoAssociation']===0x0){return db[_0x713b('0x26')][_0x713b('0x4a')]({'name':_0x386675[_0x713b('0x29')],'resourceId':_0x386675['id'],'type':_0x57a8f7[_0x713b('0x29')],'sectionId':_0x57a8f7['id']},{})[_0x713b('0x22')](function(){return _0x405576;});}else{return _0x405576;}})['catch'](function(_0x417776){logger[_0x713b('0x4f')](_0x713b('0x50'),_0x417776);throw _0x417776;});}return _0x405576;})[_0x713b('0x22')](respondWithResult(_0x321e69,0xc9))['catch'](handleError(_0x321e69,null));};exports['update']=function(_0xe2b025,_0x16d776){if(_0xe2b025[_0x713b('0x4b')]['id']){delete _0xe2b025[_0x713b('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x713b('0x4e')]({'where':{'id':_0xe2b025[_0x713b('0x47')]['id']}})[_0x713b('0x22')](handleEntityNotFound(_0x16d776,null))['then'](saveUpdates(_0xe2b025[_0x713b('0x4b')],null))[_0x713b('0x22')](respondWithResult(_0x16d776,null))['catch'](handleError(_0x16d776,null));};exports['destroy']=function(_0x10ba65,_0x3ba30e){return db[_0x713b('0x2c')][_0x713b('0x4e')]({'where':{'id':_0x10ba65[_0x713b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ba30e,null))['then'](removeEntity(_0x3ba30e,null))[_0x713b('0x45')](handleError(_0x3ba30e,null));};exports['download']=function(_0x44b96d,_0x488f63,_0x18f10c){return db[_0x713b('0x2c')]['find']({'where':{'id':_0x44b96d[_0x713b('0x47')]['id']},'attributes':[_0x713b('0x29'),'basename',_0x713b('0x51'),_0x713b('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x488f63,null))[_0x713b('0x22')](function(_0x44951e){if(_0x44951e){if(!fs[_0x713b('0x53')](path[_0x713b('0x54')](config[_0x713b('0x55')],_0x713b('0x56'),_0x44951e[_0x713b('0x51')]))){throw new db[(_0x713b('0x57'))][(_0x713b('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x44b96d[_0x713b('0x33')][_0x713b('0x59')]){return _0x488f63['sendStatus'](0xc8);}return _0x488f63[_0x713b('0x5a')](path[_0x713b('0x54')](config[_0x713b('0x55')],_0x713b('0x56'),_0x44951e[_0x713b('0x51')]),util['format']('%s.%s',_0x44951e[_0x713b('0x5b')]||_0x44951e[_0x713b('0x29')],_0x44951e[_0x713b('0x52')]['toLowerCase']()));}})['catch'](handleError(_0x488f63,null));}; \ No newline at end of file +var _0x2c4b=['show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','end','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x2c4b,0x1f4));var _0xb2c4=function(_0x54188f,_0x3aabe0){_0x54188f=_0x54188f-0x0;var _0x5e28a7=_0x2c4b[_0x54188f];return _0x5e28a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2c4('0x0'));var zipdir=require(_0xb2c4('0x1'));var jsonpatch=require(_0xb2c4('0x2'));var rp=require(_0xb2c4('0x3'));var moment=require(_0xb2c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb2c4('0x5'));var util=require(_0xb2c4('0x6'));var path=require(_0xb2c4('0x7'));var sox=require(_0xb2c4('0x8'));var csv=require(_0xb2c4('0x9'));var ejs=require(_0xb2c4('0xa'));var fs=require('fs');var fs_extra=require(_0xb2c4('0xb'));var _=require('lodash');var squel=require(_0xb2c4('0xc'));var crypto=require(_0xb2c4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb2c4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb2c4('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2c4('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(_0xb2c4('0x11'))('api');var utils=require(_0xb2c4('0x12'));var config=require(_0xb2c4('0x13'));var licenseUtil=require(_0xb2c4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10746f,_0x54b031){_0x54b031=_0x54b031||0xcc;return function(_0x888e18){if(_0x888e18){return _0x10746f[_0xb2c4('0x15')](_0x54b031);}return _0x10746f[_0xb2c4('0x16')](_0x54b031)['end']();};}function respondWithResult(_0x149830,_0x7183a8){_0x7183a8=_0x7183a8||0xc8;return function(_0x3a35ed){if(_0x3a35ed){return _0x149830['status'](_0x7183a8)[_0xb2c4('0x17')](_0x3a35ed);}};}function respondWithFilteredResult(_0x4d081f,_0x9d24c8){return function(_0x13909f){if(_0x13909f){var _0x4435d3=typeof _0x9d24c8[_0xb2c4('0x18')]==='undefined'&&typeof _0x9d24c8[_0xb2c4('0x19')]==='undefined';var _0x5004e2=_0x13909f['count'];var _0x5a8c58=_0x4435d3?0x0:_0x9d24c8[_0xb2c4('0x18')];var _0x483066=_0x4435d3?_0x13909f[_0xb2c4('0x1a')]:_0x9d24c8['offset']+_0x9d24c8[_0xb2c4('0x19')];var _0x1dda7f;if(_0x483066>=_0x5004e2){_0x483066=_0x5004e2;_0x1dda7f=0xc8;}else{_0x1dda7f=0xce;}_0x4d081f[_0xb2c4('0x16')](_0x1dda7f);return _0x4d081f[_0xb2c4('0x1b')](_0xb2c4('0x1c'),_0x5a8c58+'-'+_0x483066+'/'+_0x5004e2)['json'](_0x13909f);}return null;};}function patchUpdates(_0x111787){return function(_0x59ad00){try{jsonpatch[_0xb2c4('0x1d')](_0x59ad00,_0x111787,!![]);}catch(_0x22b130){return BPromise[_0xb2c4('0x1e')](_0x22b130);}return _0x59ad00[_0xb2c4('0x1f')]();};}function saveUpdates(_0x2909ee,_0x10c5f2){return function(_0xe2ace1){if(_0xe2ace1){return _0xe2ace1[_0xb2c4('0x20')](_0x2909ee)['then'](function(_0x1e7f24){return _0x1e7f24;});}return null;};}function removeEntity(_0xc1c595,_0x2f1682){return function(_0x2d6fe4){if(_0x2d6fe4){return _0x2d6fe4['destroy']()[_0xb2c4('0x21')](function(){var _0x5e3567=_0x2d6fe4[_0xb2c4('0x22')]({'plain':!![]});var _0x2d7634=_0xb2c4('0x23');return db[_0xb2c4('0x24')][_0xb2c4('0x25')]({'where':{'type':_0x2d7634,'resourceId':_0x5e3567['id']}})[_0xb2c4('0x21')](function(){return _0x2d6fe4;});})[_0xb2c4('0x21')](function(){_0xc1c595[_0xb2c4('0x16')](0xcc)[_0xb2c4('0x26')]();});}};}function handleEntityNotFound(_0x398ea3,_0x3a4b3d){return function(_0x12d5b7){if(!_0x12d5b7){_0x398ea3[_0xb2c4('0x15')](0x194);}return _0x12d5b7;};}function handleError(_0x18789e,_0x4d03a7){_0x4d03a7=_0x4d03a7||0x1f4;return function(_0x567d65){logger['error'](_0x567d65[_0xb2c4('0x27')]);if(_0x567d65[_0xb2c4('0x28')]){delete _0x567d65['name'];}_0x18789e['status'](_0x4d03a7)[_0xb2c4('0x29')](_0x567d65);};}exports[_0xb2c4('0x2a')]=function(_0x4c78e6,_0x3786ad){var _0x3c0df5={},_0x529abb={},_0xf2a625={'count':0x0,'rows':[]};var _0x4f8946=_['map'](db[_0xb2c4('0x2b')][_0xb2c4('0x2c')],function(_0x41672e){return{'name':_0x41672e[_0xb2c4('0x2d')],'type':_0x41672e[_0xb2c4('0x2e')][_0xb2c4('0x2f')]};});_0x529abb[_0xb2c4('0x30')]=_[_0xb2c4('0x31')](_0x4f8946,_0xb2c4('0x28'));_0x529abb[_0xb2c4('0x32')]=_[_0xb2c4('0x33')](_0x4c78e6[_0xb2c4('0x32')]);_0x529abb[_0xb2c4('0x34')]=_['intersection'](_0x529abb[_0xb2c4('0x30')],_0x529abb[_0xb2c4('0x32')]);_0x3c0df5[_0xb2c4('0x35')]=_[_0xb2c4('0x36')](_0x529abb[_0xb2c4('0x30')],qs['fields'](_0x4c78e6['query'][_0xb2c4('0x37')]));_0x3c0df5[_0xb2c4('0x35')]=_0x3c0df5[_0xb2c4('0x35')][_0xb2c4('0x38')]?_0x3c0df5['attributes']:_0x529abb[_0xb2c4('0x30')];if(!_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x39')](_0xb2c4('0x3a'))){_0x3c0df5[_0xb2c4('0x19')]=qs[_0xb2c4('0x19')](_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x19')]);_0x3c0df5[_0xb2c4('0x18')]=qs[_0xb2c4('0x18')](_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x18')]);}_0x3c0df5[_0xb2c4('0x3b')]=qs[_0xb2c4('0x3c')](_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x3c')]);_0x3c0df5['where']=qs[_0xb2c4('0x34')](_[_0xb2c4('0x3d')](_0x4c78e6['query'],_0x529abb[_0xb2c4('0x34')]),_0x4f8946);if(_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x3e')]){_0x3c0df5[_0xb2c4('0x3f')]=_[_0xb2c4('0x40')](_0x3c0df5[_0xb2c4('0x3f')],{'$or':_[_0xb2c4('0x31')](_0x4f8946,function(_0x1eb4f4){if(_0x1eb4f4[_0xb2c4('0x2e')]!=='VIRTUAL'){var _0x3c1928={};_0x3c1928[_0x1eb4f4[_0xb2c4('0x28')]]={'$like':'%'+_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x3e')]+'%'};return _0x3c1928;}})});}_0x3c0df5=_['merge']({},_0x3c0df5,_0x4c78e6[_0xb2c4('0x41')]);var _0x3ecb0f={'where':_0x3c0df5[_0xb2c4('0x3f')]};return db['AnalyticExtractedReport']['count'](_0x3ecb0f)['then'](function(_0x910128){_0xf2a625[_0xb2c4('0x1a')]=_0x910128;if(_0x4c78e6[_0xb2c4('0x32')][_0xb2c4('0x42')]){_0x3c0df5[_0xb2c4('0x43')]=[{'all':!![]}];}return db[_0xb2c4('0x2b')][_0xb2c4('0x44')](_0x3c0df5);})[_0xb2c4('0x21')](function(_0x283842){_0xf2a625[_0xb2c4('0x45')]=_0x283842;return _0xf2a625;})['then'](respondWithFilteredResult(_0x3786ad,_0x3c0df5))['catch'](handleError(_0x3786ad,null));};exports[_0xb2c4('0x46')]=function(_0x1e6904,_0x269d9c){var _0x38c5bd={'raw':!![],'where':{'id':_0x1e6904['params']['id']}},_0x4ab549={};_0x4ab549[_0xb2c4('0x30')]=_['keys'](db[_0xb2c4('0x2b')][_0xb2c4('0x2c')]);_0x4ab549[_0xb2c4('0x32')]=_[_0xb2c4('0x33')](_0x1e6904[_0xb2c4('0x32')]);_0x4ab549[_0xb2c4('0x34')]=_['intersection'](_0x4ab549[_0xb2c4('0x30')],_0x4ab549[_0xb2c4('0x32')]);_0x38c5bd[_0xb2c4('0x35')]=_[_0xb2c4('0x36')](_0x4ab549[_0xb2c4('0x30')],qs[_0xb2c4('0x37')](_0x1e6904[_0xb2c4('0x32')][_0xb2c4('0x37')]));_0x38c5bd['attributes']=_0x38c5bd[_0xb2c4('0x35')][_0xb2c4('0x38')]?_0x38c5bd[_0xb2c4('0x35')]:_0x4ab549[_0xb2c4('0x30')];if(_0x1e6904[_0xb2c4('0x32')][_0xb2c4('0x42')]){_0x38c5bd[_0xb2c4('0x43')]=[{'all':!![]}];}_0x38c5bd=_['merge']({},_0x38c5bd,_0x1e6904[_0xb2c4('0x41')]);return db[_0xb2c4('0x2b')][_0xb2c4('0x47')](_0x38c5bd)[_0xb2c4('0x21')](handleEntityNotFound(_0x269d9c,null))[_0xb2c4('0x21')](respondWithResult(_0x269d9c,null))[_0xb2c4('0x48')](handleError(_0x269d9c,null));};exports[_0xb2c4('0x49')]=function(_0x57f81b,_0x3ea2aa){return db[_0xb2c4('0x2b')][_0xb2c4('0x49')](_0x57f81b[_0xb2c4('0x4a')],{})[_0xb2c4('0x21')](function(_0x5e2fde){var _0x1f5d76=_0x57f81b['user'][_0xb2c4('0x22')]({'plain':!![]});if(!_0x1f5d76)throw new Error(_0xb2c4('0x4b'));if(_0x1f5d76[_0xb2c4('0x4c')]==='user'){var _0x26e616=_0x5e2fde[_0xb2c4('0x22')]({'plain':!![]});var _0x11e50a=_0xb2c4('0x23');return db[_0xb2c4('0x4d')]['find']({'where':{'name':_0x11e50a,'userProfileId':_0x1f5d76[_0xb2c4('0x4e')]},'raw':!![]})['then'](function(_0x481a62){if(_0x481a62&&_0x481a62[_0xb2c4('0x4f')]===0x0){return db['UserProfileResource'][_0xb2c4('0x49')]({'name':_0x26e616['name'],'resourceId':_0x26e616['id'],'type':_0x481a62[_0xb2c4('0x28')],'sectionId':_0x481a62['id']},{})[_0xb2c4('0x21')](function(){return _0x5e2fde;});}else{return _0x5e2fde;}})['catch'](function(_0x51a75e){logger[_0xb2c4('0x50')](_0xb2c4('0x51'),_0x51a75e);throw _0x51a75e;});}return _0x5e2fde;})[_0xb2c4('0x21')](respondWithResult(_0x3ea2aa,0xc9))[_0xb2c4('0x48')](handleError(_0x3ea2aa,null));};exports[_0xb2c4('0x20')]=function(_0x3183c1,_0x1ac779){if(_0x3183c1[_0xb2c4('0x4a')]['id']){delete _0x3183c1[_0xb2c4('0x4a')]['id'];}return db[_0xb2c4('0x2b')][_0xb2c4('0x47')]({'where':{'id':_0x3183c1[_0xb2c4('0x52')]['id']}})[_0xb2c4('0x21')](handleEntityNotFound(_0x1ac779,null))[_0xb2c4('0x21')](saveUpdates(_0x3183c1[_0xb2c4('0x4a')],null))[_0xb2c4('0x21')](respondWithResult(_0x1ac779,null))[_0xb2c4('0x48')](handleError(_0x1ac779,null));};exports['destroy']=function(_0x1b5ad8,_0x323a88){return db[_0xb2c4('0x2b')][_0xb2c4('0x47')]({'where':{'id':_0x1b5ad8['params']['id']}})[_0xb2c4('0x21')](handleEntityNotFound(_0x323a88,null))[_0xb2c4('0x21')](removeEntity(_0x323a88,null))[_0xb2c4('0x48')](handleError(_0x323a88,null));};exports[_0xb2c4('0x53')]=function(_0x11db24,_0x28447e,_0x1ec404){return db[_0xb2c4('0x2b')][_0xb2c4('0x47')]({'where':{'id':_0x11db24['params']['id']},'attributes':[_0xb2c4('0x28'),_0xb2c4('0x54'),_0xb2c4('0x55'),'output'],'raw':!![]})[_0xb2c4('0x21')](handleEntityNotFound(_0x28447e,null))[_0xb2c4('0x21')](function(_0x3b6442){if(_0x3b6442){if(!fs[_0xb2c4('0x56')](path[_0xb2c4('0x57')](config[_0xb2c4('0x58')],_0xb2c4('0x59'),_0x3b6442[_0xb2c4('0x55')]))){throw new db[(_0xb2c4('0x5a'))][(_0xb2c4('0x5b'))](_0xb2c4('0x5c'));}if(_0x11db24[_0xb2c4('0x32')][_0xb2c4('0x5d')]){return _0x28447e[_0xb2c4('0x15')](0xc8);}return _0x28447e[_0xb2c4('0x53')](path['join'](config[_0xb2c4('0x58')],_0xb2c4('0x59'),_0x3b6442[_0xb2c4('0x55')]),util[_0xb2c4('0x5e')]('%s.%s',_0x3b6442[_0xb2c4('0x54')]||_0x3b6442[_0xb2c4('0x28')],_0x3b6442['output']['toLowerCase']()));}})['catch'](handleError(_0x28447e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3113a45..eeb47b2 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 _0x6647=['bluebird','request-promise','rimraf','../../config/environment','define','analytics_extracted_reports','util','../../config/logger','api'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x6647,0x14a));var _0x7664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6647[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7664('0x0'));var logger=require(_0x7664('0x1'))(_0x7664('0x2'));var moment=require('moment');var BPromise=require(_0x7664('0x3'));var rp=require(_0x7664('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7664('0x5'));var config=require(_0x7664('0x6'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x7e472e,_0x13dc00){return _0x7e472e[_0x7664('0x7')]('AnalyticExtractedReport',attributes,{'tableName':_0x7664('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b1=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d0fe1,_0x452dbb){var _0x228558=function(_0x356baf){while(--_0x356baf){_0x1d0fe1['push'](_0x1d0fe1['shift']());}};_0x228558(++_0x452dbb);}(_0x07b1,0x14e));var _0x107b=function(_0x1ba27a,_0x2668c6){_0x1ba27a=_0x1ba27a-0x0;var _0x230b68=_0x07b1[_0x1ba27a];return _0x230b68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x107b('0x0'))('api');var moment=require('moment');var BPromise=require(_0x107b('0x1'));var rp=require(_0x107b('0x2'));var fs=require('fs');var path=require(_0x107b('0x3'));var rimraf=require(_0x107b('0x4'));var config=require(_0x107b('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x107b('0x6')]=function(_0x9c69b2,_0x59625b){return _0x9c69b2[_0x107b('0x7')](_0x107b('0x8'),attributes,{'tableName':_0x107b('0x9'),'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 d3ec5bd..d77ee95 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 _0x157f=['debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x2a03fa,_0xb1d8dd){var _0xf84bf7=function(_0x5a6e50){while(--_0x5a6e50){_0x2a03fa['push'](_0x2a03fa['shift']());}};_0xf84bf7(++_0xb1d8dd);}(_0x157f,0x141));var _0xf157=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x157f[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf157('0x0'));var util=require(_0xf157('0x1'));var moment=require(_0xf157('0x2'));var BPromise=require(_0xf157('0x3'));var rs=require(_0xf157('0x4'));var fs=require('fs');var Redis=require(_0xf157('0x5'));var db=require(_0xf157('0x6'))['db'];var utils=require(_0xf157('0x7'));var logger=require(_0xf157('0x8'))(_0xf157('0x9'));var config=require(_0xf157('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf157('0xb')][_0xf157('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50b3f3,_0x34d1d3,_0x456434){return new BPromise(function(_0x4fb474,_0x11a655){return client[_0xf157('0xd')](_0x50b3f3,_0x456434)[_0xf157('0xe')](function(_0xaa0699){logger[_0xf157('0xf')](_0xf157('0x10'),_0x34d1d3,'request\x20sent');logger[_0xf157('0x11')](_0xf157('0x12'),_0x34d1d3,_0xf157('0x13'),JSON[_0xf157('0x14')](_0xaa0699));if(_0xaa0699[_0xf157('0x15')]){if(_0xaa0699['error'][_0xf157('0x16')]===0x1f4){logger[_0xf157('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x34d1d3,_0xaa0699[_0xf157('0x15')]['message']);return _0x11a655(_0xaa0699[_0xf157('0x15')][_0xf157('0x17')]);}logger[_0xf157('0x15')](_0xf157('0x10'),_0x34d1d3,_0xaa0699[_0xf157('0x15')][_0xf157('0x17')]);return _0x4fb474(_0xaa0699[_0xf157('0x15')]['message']);}else{logger[_0xf157('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x34d1d3,'request\x20sent');_0x4fb474(_0xaa0699[_0xf157('0x18')][_0xf157('0x17')]);}})[_0xf157('0x19')](function(_0x208746){logger[_0xf157('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x34d1d3,_0x208746);_0x11a655(_0x208746);});});} \ No newline at end of file +var _0xd408=['stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd408,0x1e7));var _0x8d40=function(_0x2ac410,_0x496237){_0x2ac410=_0x2ac410-0x0;var _0x320ca1=_0xd408[_0x2ac410];return _0x320ca1;};'use strict';var _=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var moment=require(_0x8d40('0x2'));var BPromise=require(_0x8d40('0x3'));var rs=require(_0x8d40('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d40('0x6'))(_0x8d40('0x7'));var config=require(_0x8d40('0x8'));var jayson=require(_0x8d40('0x9'));var client=jayson[_0x8d40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b4f,_0x5842c7,_0x483d83){return new BPromise(function(_0xc25d12,_0x36225b){return client[_0x8d40('0xb')](_0x489b4f,_0x483d83)[_0x8d40('0xc')](function(_0x2a6d0b){logger[_0x8d40('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5842c7,_0x8d40('0xe'));logger[_0x8d40('0xf')](_0x8d40('0x10'),_0x5842c7,_0x8d40('0xe'),JSON[_0x8d40('0x11')](_0x2a6d0b));if(_0x2a6d0b[_0x8d40('0x12')]){if(_0x2a6d0b['error'][_0x8d40('0x13')]===0x1f4){logger['error'](_0x8d40('0x14'),_0x5842c7,_0x2a6d0b['error'][_0x8d40('0x15')]);return _0x36225b(_0x2a6d0b[_0x8d40('0x12')][_0x8d40('0x15')]);}logger[_0x8d40('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5842c7,_0x2a6d0b['error']['message']);return _0xc25d12(_0x2a6d0b['error'][_0x8d40('0x15')]);}else{logger[_0x8d40('0xd')](_0x8d40('0x14'),_0x5842c7,_0x8d40('0xe'));_0xc25d12(_0x2a6d0b[_0x8d40('0x16')]['message']);}})[_0x8d40('0x17')](function(_0x53e51f){logger['error'](_0x8d40('0x14'),_0x5842c7,_0x53e51f);_0x36225b(_0x53e51f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0e7061e..ed521db 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 _0x4036=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','delete','destroy','exports','multer','util'];(function(_0x2a1a0b,_0x52086b){var _0x58a15d=function(_0x36989e){while(--_0x36989e){_0x2a1a0b['push'](_0x2a1a0b['shift']());}};_0x58a15d(++_0x52086b);}(_0x4036,0x9e));var _0x6403=function(_0x5ebfb1,_0x15a7bb){_0x5ebfb1=_0x5ebfb1-0x0;var _0x291643=_0x4036[_0x5ebfb1];return _0x291643;};'use strict';var multer=require(_0x6403('0x0'));var util=require(_0x6403('0x1'));var path=require(_0x6403('0x2'));var timeout=require(_0x6403('0x3'));var express=require(_0x6403('0x4'));var router=express[_0x6403('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6403('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6403('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x6403('0x8')]('/',auth[_0x6403('0x9')](),controller[_0x6403('0xa')]);router['get'](_0x6403('0xb'),auth[_0x6403('0x9')](),controller[_0x6403('0xc')]);router[_0x6403('0x8')](_0x6403('0xd'),auth[_0x6403('0x9')](),controller[_0x6403('0xe')]);router[_0x6403('0xf')]('/',auth[_0x6403('0x9')](),controller['create']);router[_0x6403('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6403('0x11')](_0x6403('0xb'),auth[_0x6403('0x9')](),controller[_0x6403('0x12')]);module[_0x6403('0x13')]=router; \ No newline at end of file +var _0x1b1d=['fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x479b63,_0x1844ae){var _0x3a800b=function(_0x34e948){while(--_0x34e948){_0x479b63['push'](_0x479b63['shift']());}};_0x3a800b(++_0x1844ae);}(_0x1b1d,0x177));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd1b1('0x0'));var util=require(_0xd1b1('0x1'));var path=require(_0xd1b1('0x2'));var timeout=require(_0xd1b1('0x3'));var express=require(_0xd1b1('0x4'));var router=express['Router']();var fs_extra=require(_0xd1b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd1b1('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xd1b1('0x7')]('/',auth[_0xd1b1('0x8')](),controller['index']);router[_0xd1b1('0x7')](_0xd1b1('0x9'),auth['isAuthenticated'](),controller[_0xd1b1('0xa')]);router[_0xd1b1('0x7')](_0xd1b1('0xb'),auth[_0xd1b1('0x8')](),controller[_0xd1b1('0xc')]);router['post']('/',auth[_0xd1b1('0x8')](),controller[_0xd1b1('0xd')]);router[_0xd1b1('0xe')](_0xd1b1('0x9'),auth['isAuthenticated'](),controller[_0xd1b1('0xf')]);router[_0xd1b1('0x10')](_0xd1b1('0x9'),auth['isAuthenticated'](),controller[_0xd1b1('0x11')]);module[_0xd1b1('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 2d18cb1..40a8add 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 _0x2ee0=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1dbf70,_0x3bcdb8){var _0x20adb4=function(_0x374fa3){while(--_0x374fa3){_0x1dbf70['push'](_0x1dbf70['shift']());}};_0x20adb4(++_0x3bcdb8);}(_0x2ee0,0x110));var _0x02ee=function(_0x418ed8,_0x441581){_0x418ed8=_0x418ed8-0x0;var _0xac0bc8=_0x2ee0[_0x418ed8];return _0xac0bc8;};'use strict';var Sequelize=require(_0x02ee('0x0'));module[_0x02ee('0x1')]={'field':{'type':Sequelize[_0x02ee('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x02ee('0x3')]},'format':{'type':Sequelize[_0x02ee('0x3')]},'groupBy':{'type':Sequelize[_0x02ee('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x02ee('0x3')]},'custom':{'type':Sequelize[_0x02ee('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2bf7=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bf7,0x7f));var _0x72bf=function(_0x4e6f9e,_0x54fb1e){_0x4e6f9e=_0x4e6f9e-0x0;var _0x14336e=_0x2bf7[_0x4e6f9e];return _0x14336e;};'use strict';var Sequelize=require(_0x72bf('0x0'));module[_0x72bf('0x1')]={'field':{'type':Sequelize[_0x72bf('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x72bf('0x3')]},'format':{'type':Sequelize[_0x72bf('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x72bf('0x3')]},'custom':{'type':Sequelize[_0x72bf('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 159d7ee..0d3bf2b 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 _0x8ed2=['AnalyticCustomReport','findOne','sequelize','transaction','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','catch','show','rawAttributes','include','bulkCreate','body','update','find','params','bulkDestroy','ids','addFields'];(function(_0x292e60,_0x186dbb){var _0x30227b=function(_0x5fdcd7){while(--_0x5fdcd7){_0x292e60['push'](_0x292e60['shift']());}};_0x30227b(++_0x186dbb);}(_0x8ed2,0xe8));var _0x28ed=function(_0x5b7448,_0x708cff){_0x5b7448=_0x5b7448-0x0;var _0x35d571=_0x8ed2[_0x5b7448];return _0x35d571;};'use strict';var emlformat=require(_0x28ed('0x0'));var rimraf=require(_0x28ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x28ed('0x2'));var moment=require('moment');var BPromise=require(_0x28ed('0x3'));var Mustache=require('mustache');var util=require(_0x28ed('0x4'));var path=require('path');var sox=require(_0x28ed('0x5'));var csv=require(_0x28ed('0x6'));var ejs=require(_0x28ed('0x7'));var fs=require('fs');var fs_extra=require(_0x28ed('0x8'));var _=require(_0x28ed('0x9'));var squel=require('squel');var crypto=require(_0x28ed('0xa'));var jsforce=require(_0x28ed('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28ed('0xc'));var Papa=require('papaparse');var Redis=require(_0x28ed('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x28ed('0xe'));var hardwareService=require(_0x28ed('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x28ed('0x10'));var licenseUtil=require(_0x28ed('0x11'));var db=require(_0x28ed('0x12'))['db'];function respondWithStatusCode(_0x2f36d0,_0x36fc99){_0x36fc99=_0x36fc99||0xcc;return function(_0x4d5f0a){if(_0x4d5f0a){return _0x2f36d0[_0x28ed('0x13')](_0x36fc99);}return _0x2f36d0[_0x28ed('0x14')](_0x36fc99)[_0x28ed('0x15')]();};}function respondWithResult(_0xf37952,_0x31e641){_0x31e641=_0x31e641||0xc8;return function(_0x346b1f){if(_0x346b1f){return _0xf37952[_0x28ed('0x14')](_0x31e641)['json'](_0x346b1f);}};}function respondWithFilteredResult(_0x44dff8,_0x4ed412){return function(_0x20bf59){if(_0x20bf59){var _0x42c6db=typeof _0x4ed412[_0x28ed('0x16')]==='undefined'&&typeof _0x4ed412[_0x28ed('0x17')]===_0x28ed('0x18');var _0x3e0f17=_0x20bf59['count'];var _0x4bb0b9=_0x42c6db?0x0:_0x4ed412[_0x28ed('0x16')];var _0x12162e=_0x42c6db?_0x20bf59[_0x28ed('0x19')]:_0x4ed412[_0x28ed('0x16')]+_0x4ed412['limit'];var _0x3cc0c4;if(_0x12162e>=_0x3e0f17){_0x12162e=_0x3e0f17;_0x3cc0c4=0xc8;}else{_0x3cc0c4=0xce;}_0x44dff8[_0x28ed('0x14')](_0x3cc0c4);return _0x44dff8[_0x28ed('0x1a')](_0x28ed('0x1b'),_0x4bb0b9+'-'+_0x12162e+'/'+_0x3e0f17)['json'](_0x20bf59);}return null;};}function patchUpdates(_0x5ca178){return function(_0x4bc609){try{jsonpatch[_0x28ed('0x1c')](_0x4bc609,_0x5ca178,!![]);}catch(_0x170bc9){return BPromise[_0x28ed('0x1d')](_0x170bc9);}return _0x4bc609[_0x28ed('0x1e')]();};}function saveUpdates(_0x350dd5,_0x22ba11){return function(_0x1426f4){if(_0x1426f4){return _0x1426f4['update'](_0x350dd5)['then'](function(_0x52ef1d){return _0x52ef1d;});}return null;};}function removeEntity(_0x508ecf,_0x5dfe6b){return function(_0x27f5b7){if(_0x27f5b7){return _0x27f5b7[_0x28ed('0x1f')]()[_0x28ed('0x20')](function(){_0x508ecf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d5939,_0x4bad7b){return function(_0x301755){if(!_0x301755){_0x3d5939[_0x28ed('0x13')](0x194);}return _0x301755;};}function handleError(_0xc14f9e,_0x46017d){_0x46017d=_0x46017d||0x1f4;return function(_0x36fd86){logger[_0x28ed('0x21')](_0x36fd86['stack']);if(_0x36fd86[_0x28ed('0x22')]){delete _0x36fd86[_0x28ed('0x22')];}_0xc14f9e['status'](_0x46017d)[_0x28ed('0x23')](_0x36fd86);};}exports[_0x28ed('0x24')]=function(_0x5e9890,_0x383295){var _0x2961fb={},_0x553480={},_0x32c154={'count':0x0,'rows':[]};var _0x254720=_[_0x28ed('0x25')](db[_0x28ed('0x26')]['rawAttributes'],function(_0x5e9406){return{'name':_0x5e9406[_0x28ed('0x27')],'type':_0x5e9406['type'][_0x28ed('0x28')]};});_0x553480[_0x28ed('0x29')]=_[_0x28ed('0x25')](_0x254720,_0x28ed('0x22'));_0x553480[_0x28ed('0x2a')]=_[_0x28ed('0x2b')](_0x5e9890[_0x28ed('0x2a')]);_0x553480[_0x28ed('0x2c')]=_[_0x28ed('0x2d')](_0x553480['model'],_0x553480[_0x28ed('0x2a')]);_0x2961fb[_0x28ed('0x2e')]=_[_0x28ed('0x2d')](_0x553480[_0x28ed('0x29')],qs[_0x28ed('0x2f')](_0x5e9890['query']['fields']));_0x2961fb[_0x28ed('0x2e')]=_0x2961fb[_0x28ed('0x2e')][_0x28ed('0x30')]?_0x2961fb[_0x28ed('0x2e')]:_0x553480[_0x28ed('0x29')];if(!_0x5e9890[_0x28ed('0x2a')][_0x28ed('0x31')]('nolimit')){_0x2961fb[_0x28ed('0x17')]=qs[_0x28ed('0x17')](_0x5e9890[_0x28ed('0x2a')]['limit']);_0x2961fb['offset']=qs[_0x28ed('0x16')](_0x5e9890[_0x28ed('0x2a')][_0x28ed('0x16')]);}_0x2961fb[_0x28ed('0x32')]=qs[_0x28ed('0x33')](_0x5e9890['query'][_0x28ed('0x33')]);_0x2961fb[_0x28ed('0x34')]=qs['filters'](_[_0x28ed('0x35')](_0x5e9890[_0x28ed('0x2a')],_0x553480[_0x28ed('0x2c')]),_0x254720);if(_0x5e9890['query'][_0x28ed('0x36')]){_0x2961fb[_0x28ed('0x34')]=_['merge'](_0x2961fb[_0x28ed('0x34')],{'$or':_['map'](_0x254720,function(_0x44a4c7){if(_0x44a4c7[_0x28ed('0x37')]!=='VIRTUAL'){var _0x1401f5={};_0x1401f5[_0x44a4c7[_0x28ed('0x22')]]={'$like':'%'+_0x5e9890[_0x28ed('0x2a')][_0x28ed('0x36')]+'%'};return _0x1401f5;}})});}_0x2961fb=_[_0x28ed('0x38')]({},_0x2961fb,_0x5e9890[_0x28ed('0x39')]);var _0x389a0b={'where':_0x2961fb[_0x28ed('0x34')]};return db[_0x28ed('0x26')][_0x28ed('0x19')](_0x389a0b)[_0x28ed('0x20')](function(_0x2bd450){_0x32c154['count']=_0x2bd450;if(_0x5e9890[_0x28ed('0x2a')][_0x28ed('0x3a')]){_0x2961fb['include']=[{'all':!![]}];}return db[_0x28ed('0x26')][_0x28ed('0x3b')](_0x2961fb);})[_0x28ed('0x20')](function(_0x359a04){_0x32c154['rows']=_0x359a04;return _0x32c154;})[_0x28ed('0x20')](respondWithFilteredResult(_0x383295,_0x2961fb))[_0x28ed('0x3c')](handleError(_0x383295,null));};exports[_0x28ed('0x3d')]=function(_0x28290f,_0x1032bd){var _0x4ab177={'raw':![],'where':{'id':_0x28290f['params']['id']}},_0x2c3ed8={};_0x2c3ed8[_0x28ed('0x29')]=_[_0x28ed('0x2b')](db['AnalyticFieldReport'][_0x28ed('0x3e')]);_0x2c3ed8['query']=_['keys'](_0x28290f[_0x28ed('0x2a')]);_0x2c3ed8[_0x28ed('0x2c')]=_[_0x28ed('0x2d')](_0x2c3ed8['model'],_0x2c3ed8[_0x28ed('0x2a')]);_0x4ab177['attributes']=_[_0x28ed('0x2d')](_0x2c3ed8[_0x28ed('0x29')],qs[_0x28ed('0x2f')](_0x28290f[_0x28ed('0x2a')][_0x28ed('0x2f')]));_0x4ab177[_0x28ed('0x2e')]=_0x4ab177['attributes'][_0x28ed('0x30')]?_0x4ab177['attributes']:_0x2c3ed8['model'];if(_0x28290f['query'][_0x28ed('0x3a')]){_0x4ab177[_0x28ed('0x3f')]=[{'all':!![]}];}_0x4ab177=_[_0x28ed('0x38')]({},_0x4ab177,_0x28290f[_0x28ed('0x39')]);return db[_0x28ed('0x26')]['find'](_0x4ab177)['then'](handleEntityNotFound(_0x1032bd,null))[_0x28ed('0x20')](respondWithResult(_0x1032bd,null))[_0x28ed('0x3c')](handleError(_0x1032bd,null));};exports['create']=function(_0x2d01f3,_0x35715f){return db[_0x28ed('0x26')]['create'](_0x2d01f3['body'],{})['then'](respondWithResult(_0x35715f,0xc9))['catch'](handleError(_0x35715f,null));};exports['bulkCreate']=function(_0x4451a7,_0x4b2338){return db[_0x28ed('0x26')][_0x28ed('0x40')](_0x4451a7[_0x28ed('0x41')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4b2338,0xc9))[_0x28ed('0x3c')](handleError(_0x4b2338,null));};exports[_0x28ed('0x42')]=function(_0x18a4a0,_0x484ccd){if(_0x18a4a0[_0x28ed('0x41')]['id']){delete _0x18a4a0[_0x28ed('0x41')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x18a4a0['params']['id']}})[_0x28ed('0x20')](handleEntityNotFound(_0x484ccd,null))[_0x28ed('0x20')](saveUpdates(_0x18a4a0[_0x28ed('0x41')],null))[_0x28ed('0x20')](respondWithResult(_0x484ccd,null))[_0x28ed('0x3c')](handleError(_0x484ccd,null));};exports['destroy']=function(_0x5df10a,_0x39d9a9){return db[_0x28ed('0x26')][_0x28ed('0x43')]({'where':{'id':_0x5df10a[_0x28ed('0x44')]['id']}})[_0x28ed('0x20')](handleEntityNotFound(_0x39d9a9,null))[_0x28ed('0x20')](removeEntity(_0x39d9a9,null))[_0x28ed('0x3c')](handleError(_0x39d9a9,null));};exports[_0x28ed('0x45')]=function(_0x54a941,_0x47ca5d){return db[_0x28ed('0x26')][_0x28ed('0x1f')]({'where':{'id':_0x54a941[_0x28ed('0x2a')][_0x28ed('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x28ed('0x20')](respondWithResult(_0x47ca5d,0xcc))['catch'](handleError(_0x47ca5d,null));};exports[_0x28ed('0x47')]=function(_0x2bf646,_0x1bcea6,_0xe7cf8a){return db[_0x28ed('0x48')][_0x28ed('0x49')]({'where':{'id':_0x2bf646[_0x28ed('0x44')]['id']}})[_0x28ed('0x20')](handleEntityNotFound(_0x1bcea6,null))['then'](function(_0x2e2f2e){if(_0x2e2f2e){return db[_0x28ed('0x4a')][_0x28ed('0x4b')](function(_0x4664c8){return db[_0x28ed('0x26')][_0x28ed('0x1f')]({'where':{'CustomReportId':_0x2bf646['params']['id']},'transaction':_0x4664c8})['then'](function(_0x1595d1){var _0x48b3f3=_[_0x28ed('0x25')](_0x2bf646[_0x28ed('0x41')],function(_0x187a1a){delete _0x187a1a['id'];_0x187a1a['CustomReportId']=_0x2bf646[_0x28ed('0x44')]['id'];return _0x187a1a;});return db['AnalyticFieldReport'][_0x28ed('0x40')](_0x48b3f3,{'transaction':_0x4664c8});});})[_0x28ed('0x20')](function(){return db['AnalyticFieldReport'][_0x28ed('0x3b')]({'where':{'CustomReportId':_0x2bf646[_0x28ed('0x44')]['id']}});});}})[_0x28ed('0x20')](respondWithResult(_0x1bcea6,null))[_0x28ed('0x3c')](handleError(_0x1bcea6,null));}; \ No newline at end of file +var _0xf963=['model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key'];(function(_0x3a5172,_0x14a3c8){var _0x5b7c26=function(_0x332aca){while(--_0x332aca){_0x3a5172['push'](_0x3a5172['shift']());}};_0x5b7c26(++_0x14a3c8);}(_0xf963,0x11f));var _0x3f96=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xf963[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0x3f96('0x0'));var rimraf=require(_0x3f96('0x1'));var zipdir=require(_0x3f96('0x2'));var jsonpatch=require(_0x3f96('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f96('0x4'));var Mustache=require(_0x3f96('0x5'));var util=require(_0x3f96('0x6'));var path=require('path');var sox=require(_0x3f96('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f96('0x8'));var squel=require(_0x3f96('0x9'));var crypto=require(_0x3f96('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3f96('0xb'));var toCsv=require(_0x3f96('0xc'));var querystring=require(_0x3f96('0xd'));var Papa=require('papaparse');var Redis=require(_0x3f96('0xe'));var authService=require(_0x3f96('0xf'));var qs=require(_0x3f96('0x10'));var as=require(_0x3f96('0x11'));var hardwareService=require(_0x3f96('0x12'));var logger=require(_0x3f96('0x13'))(_0x3f96('0x14'));var utils=require(_0x3f96('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3f96('0x16'));var db=require(_0x3f96('0x17'))['db'];function respondWithStatusCode(_0x138c61,_0x556767){_0x556767=_0x556767||0xcc;return function(_0x47404b){if(_0x47404b){return _0x138c61[_0x3f96('0x18')](_0x556767);}return _0x138c61[_0x3f96('0x19')](_0x556767)['end']();};}function respondWithResult(_0x3b06af,_0x38c36f){_0x38c36f=_0x38c36f||0xc8;return function(_0xda44ae){if(_0xda44ae){return _0x3b06af[_0x3f96('0x19')](_0x38c36f)[_0x3f96('0x1a')](_0xda44ae);}};}function respondWithFilteredResult(_0x379b21,_0x5066c2){return function(_0x333e4a){if(_0x333e4a){var _0x1e8554=typeof _0x5066c2[_0x3f96('0x1b')]===_0x3f96('0x1c')&&typeof _0x5066c2[_0x3f96('0x1d')]===_0x3f96('0x1c');var _0x51ace6=_0x333e4a[_0x3f96('0x1e')];var _0x5a6c3c=_0x1e8554?0x0:_0x5066c2[_0x3f96('0x1b')];var _0x3f9767=_0x1e8554?_0x333e4a[_0x3f96('0x1e')]:_0x5066c2[_0x3f96('0x1b')]+_0x5066c2['limit'];var _0x59517d;if(_0x3f9767>=_0x51ace6){_0x3f9767=_0x51ace6;_0x59517d=0xc8;}else{_0x59517d=0xce;}_0x379b21[_0x3f96('0x19')](_0x59517d);return _0x379b21[_0x3f96('0x1f')](_0x3f96('0x20'),_0x5a6c3c+'-'+_0x3f9767+'/'+_0x51ace6)[_0x3f96('0x1a')](_0x333e4a);}return null;};}function patchUpdates(_0x419dc3){return function(_0x4775c8){try{jsonpatch[_0x3f96('0x21')](_0x4775c8,_0x419dc3,!![]);}catch(_0x4a4e2d){return BPromise[_0x3f96('0x22')](_0x4a4e2d);}return _0x4775c8['save']();};}function saveUpdates(_0x1c9d64,_0x45237e){return function(_0x5bdba7){if(_0x5bdba7){return _0x5bdba7[_0x3f96('0x23')](_0x1c9d64)[_0x3f96('0x24')](function(_0x476b78){return _0x476b78;});}return null;};}function removeEntity(_0xfe9b49,_0x51a579){return function(_0x4a143c){if(_0x4a143c){return _0x4a143c[_0x3f96('0x25')]()['then'](function(){_0xfe9b49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7cac,_0x27cdd9){return function(_0x7e7f26){if(!_0x7e7f26){_0x3d7cac[_0x3f96('0x18')](0x194);}return _0x7e7f26;};}function handleError(_0x3d1978,_0x2e9f12){_0x2e9f12=_0x2e9f12||0x1f4;return function(_0x4e3b3f){logger[_0x3f96('0x26')](_0x4e3b3f[_0x3f96('0x27')]);if(_0x4e3b3f[_0x3f96('0x28')]){delete _0x4e3b3f[_0x3f96('0x28')];}_0x3d1978[_0x3f96('0x19')](_0x2e9f12)[_0x3f96('0x29')](_0x4e3b3f);};}exports[_0x3f96('0x2a')]=function(_0xd7468c,_0x31550a){var _0x34bc88={},_0x378794={},_0x2864f9={'count':0x0,'rows':[]};var _0x3639de=_[_0x3f96('0x2b')](db[_0x3f96('0x2c')][_0x3f96('0x2d')],function(_0x2ec6ec){return{'name':_0x2ec6ec[_0x3f96('0x2e')],'type':_0x2ec6ec[_0x3f96('0x2f')][_0x3f96('0x30')]};});_0x378794[_0x3f96('0x31')]=_[_0x3f96('0x2b')](_0x3639de,_0x3f96('0x28'));_0x378794[_0x3f96('0x32')]=_[_0x3f96('0x33')](_0xd7468c[_0x3f96('0x32')]);_0x378794['filters']=_['intersection'](_0x378794[_0x3f96('0x31')],_0x378794[_0x3f96('0x32')]);_0x34bc88[_0x3f96('0x34')]=_[_0x3f96('0x35')](_0x378794[_0x3f96('0x31')],qs['fields'](_0xd7468c['query']['fields']));_0x34bc88[_0x3f96('0x34')]=_0x34bc88['attributes'][_0x3f96('0x36')]?_0x34bc88[_0x3f96('0x34')]:_0x378794[_0x3f96('0x31')];if(!_0xd7468c['query'][_0x3f96('0x37')](_0x3f96('0x38'))){_0x34bc88[_0x3f96('0x1d')]=qs['limit'](_0xd7468c[_0x3f96('0x32')][_0x3f96('0x1d')]);_0x34bc88[_0x3f96('0x1b')]=qs[_0x3f96('0x1b')](_0xd7468c[_0x3f96('0x32')][_0x3f96('0x1b')]);}_0x34bc88[_0x3f96('0x39')]=qs[_0x3f96('0x3a')](_0xd7468c[_0x3f96('0x32')][_0x3f96('0x3a')]);_0x34bc88[_0x3f96('0x3b')]=qs[_0x3f96('0x3c')](_[_0x3f96('0x3d')](_0xd7468c['query'],_0x378794['filters']),_0x3639de);if(_0xd7468c[_0x3f96('0x32')][_0x3f96('0x3e')]){_0x34bc88[_0x3f96('0x3b')]=_[_0x3f96('0x3f')](_0x34bc88[_0x3f96('0x3b')],{'$or':_[_0x3f96('0x2b')](_0x3639de,function(_0x408f63){if(_0x408f63[_0x3f96('0x2f')]!==_0x3f96('0x40')){var _0x608707={};_0x608707[_0x408f63[_0x3f96('0x28')]]={'$like':'%'+_0xd7468c[_0x3f96('0x32')]['filter']+'%'};return _0x608707;}})});}_0x34bc88=_[_0x3f96('0x3f')]({},_0x34bc88,_0xd7468c[_0x3f96('0x41')]);var _0x16e33e={'where':_0x34bc88[_0x3f96('0x3b')]};return db[_0x3f96('0x2c')][_0x3f96('0x1e')](_0x16e33e)[_0x3f96('0x24')](function(_0x59e83c){_0x2864f9[_0x3f96('0x1e')]=_0x59e83c;if(_0xd7468c[_0x3f96('0x32')][_0x3f96('0x42')]){_0x34bc88[_0x3f96('0x43')]=[{'all':!![]}];}return db[_0x3f96('0x2c')]['findAll'](_0x34bc88);})['then'](function(_0x1d2814){_0x2864f9[_0x3f96('0x44')]=_0x1d2814;return _0x2864f9;})['then'](respondWithFilteredResult(_0x31550a,_0x34bc88))[_0x3f96('0x45')](handleError(_0x31550a,null));};exports[_0x3f96('0x46')]=function(_0x34c53d,_0x915c70){var _0x5e3984={'raw':![],'where':{'id':_0x34c53d[_0x3f96('0x47')]['id']}},_0x2f9d66={};_0x2f9d66[_0x3f96('0x31')]=_[_0x3f96('0x33')](db[_0x3f96('0x2c')][_0x3f96('0x2d')]);_0x2f9d66[_0x3f96('0x32')]=_['keys'](_0x34c53d[_0x3f96('0x32')]);_0x2f9d66['filters']=_[_0x3f96('0x35')](_0x2f9d66[_0x3f96('0x31')],_0x2f9d66['query']);_0x5e3984[_0x3f96('0x34')]=_['intersection'](_0x2f9d66[_0x3f96('0x31')],qs[_0x3f96('0x48')](_0x34c53d[_0x3f96('0x32')][_0x3f96('0x48')]));_0x5e3984['attributes']=_0x5e3984[_0x3f96('0x34')][_0x3f96('0x36')]?_0x5e3984[_0x3f96('0x34')]:_0x2f9d66['model'];if(_0x34c53d[_0x3f96('0x32')]['includeAll']){_0x5e3984[_0x3f96('0x43')]=[{'all':!![]}];}_0x5e3984=_[_0x3f96('0x3f')]({},_0x5e3984,_0x34c53d[_0x3f96('0x41')]);return db[_0x3f96('0x2c')]['find'](_0x5e3984)['then'](handleEntityNotFound(_0x915c70,null))[_0x3f96('0x24')](respondWithResult(_0x915c70,null))[_0x3f96('0x45')](handleError(_0x915c70,null));};exports[_0x3f96('0x49')]=function(_0x192d98,_0x3513fa){return db[_0x3f96('0x2c')][_0x3f96('0x49')](_0x192d98[_0x3f96('0x4a')],{})[_0x3f96('0x24')](respondWithResult(_0x3513fa,0xc9))[_0x3f96('0x45')](handleError(_0x3513fa,null));};exports[_0x3f96('0x4b')]=function(_0x4eab15,_0x1e85be){return db[_0x3f96('0x2c')][_0x3f96('0x4b')](_0x4eab15['body'],{'raw':![],'individualHooks':!![]})[_0x3f96('0x24')](respondWithResult(_0x1e85be,0xc9))[_0x3f96('0x45')](handleError(_0x1e85be,null));};exports[_0x3f96('0x23')]=function(_0x25b356,_0x5c8e97){if(_0x25b356[_0x3f96('0x4a')]['id']){delete _0x25b356[_0x3f96('0x4a')]['id'];}return db[_0x3f96('0x2c')][_0x3f96('0x4c')]({'where':{'id':_0x25b356[_0x3f96('0x47')]['id']}})[_0x3f96('0x24')](handleEntityNotFound(_0x5c8e97,null))[_0x3f96('0x24')](saveUpdates(_0x25b356[_0x3f96('0x4a')],null))[_0x3f96('0x24')](respondWithResult(_0x5c8e97,null))[_0x3f96('0x45')](handleError(_0x5c8e97,null));};exports[_0x3f96('0x25')]=function(_0x34724f,_0x27f766){return db[_0x3f96('0x2c')][_0x3f96('0x4c')]({'where':{'id':_0x34724f[_0x3f96('0x47')]['id']}})['then'](handleEntityNotFound(_0x27f766,null))[_0x3f96('0x24')](removeEntity(_0x27f766,null))[_0x3f96('0x45')](handleError(_0x27f766,null));};exports[_0x3f96('0x4d')]=function(_0x48c99c,_0x92b740){return db[_0x3f96('0x2c')][_0x3f96('0x25')]({'where':{'id':_0x48c99c['query'][_0x3f96('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x92b740,0xcc))[_0x3f96('0x45')](handleError(_0x92b740,null));};exports[_0x3f96('0x4f')]=function(_0x59fd59,_0x3cee7e,_0xbd3625){return db[_0x3f96('0x50')]['findOne']({'where':{'id':_0x59fd59[_0x3f96('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cee7e,null))[_0x3f96('0x24')](function(_0x20cb12){if(_0x20cb12){return db[_0x3f96('0x51')][_0x3f96('0x52')](function(_0x1f2acb){return db[_0x3f96('0x2c')][_0x3f96('0x25')]({'where':{'CustomReportId':_0x59fd59[_0x3f96('0x47')]['id']},'transaction':_0x1f2acb})[_0x3f96('0x24')](function(_0x3a1974){var _0x141e3d=_[_0x3f96('0x2b')](_0x59fd59[_0x3f96('0x4a')],function(_0x2ca846){delete _0x2ca846['id'];_0x2ca846[_0x3f96('0x53')]=_0x59fd59[_0x3f96('0x47')]['id'];return _0x2ca846;});return db[_0x3f96('0x2c')][_0x3f96('0x4b')](_0x141e3d,{'transaction':_0x1f2acb});});})['then'](function(){return db[_0x3f96('0x2c')]['findAll']({'where':{'CustomReportId':_0x59fd59['params']['id']}});});}})[_0x3f96('0x24')](respondWithResult(_0x3cee7e,null))['catch'](handleError(_0x3cee7e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d3ffca6..8d59e16 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 _0x9c57=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9c57,0x1b9));var _0x79c5=function(_0x333edc,_0x338e2f){_0x333edc=_0x333edc-0x0;var _0x27418d=_0x9c57[_0x333edc];return _0x27418d;};'use strict';var _=require(_0x79c5('0x0'));var util=require(_0x79c5('0x1'));var logger=require(_0x79c5('0x2'))(_0x79c5('0x3'));var moment=require(_0x79c5('0x4'));var BPromise=require(_0x79c5('0x5'));var rp=require(_0x79c5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79c5('0x7'));var config=require(_0x79c5('0x8'));var attributes=require(_0x79c5('0x9'));module['exports']=function(_0x17b13d,_0x42c850){return _0x17b13d[_0x79c5('0xa')](_0x79c5('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x380a=['bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment'];(function(_0x587064,_0x4dc2d6){var _0x550681=function(_0x4aec42){while(--_0x4aec42){_0x587064['push'](_0x587064['shift']());}};_0x550681(++_0x4dc2d6);}(_0x380a,0x17c));var _0xa380=function(_0x315d32,_0x33485b){_0x315d32=_0x315d32-0x0;var _0x3ea98d=_0x380a[_0x315d32];return _0x3ea98d;};'use strict';var _=require(_0xa380('0x0'));var util=require('util');var logger=require(_0xa380('0x1'))(_0xa380('0x2'));var moment=require(_0xa380('0x3'));var BPromise=require(_0xa380('0x4'));var rp=require(_0xa380('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa380('0x6'));var config=require(_0xa380('0x7'));var attributes=require(_0xa380('0x8'));module[_0xa380('0x9')]=function(_0x8417c7,_0x1aeb97){return _0x8417c7['define'](_0xa380('0xa'),attributes,{'tableName':_0xa380('0xb'),'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 ef313b2..3afe66a 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 _0xce5a=['client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x554d29,_0x28c27e){var _0x395e80=function(_0x559c25){while(--_0x559c25){_0x554d29['push'](_0x554d29['shift']());}};_0x395e80(++_0x28c27e);}(_0xce5a,0x141));var _0xace5=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xce5a[_0x5a6961];return _0x4af0a6;};'use strict';var _=require(_0xace5('0x0'));var util=require('util');var moment=require(_0xace5('0x1'));var BPromise=require(_0xace5('0x2'));var rs=require(_0xace5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xace5('0x4'))['db'];var utils=require(_0xace5('0x5'));var logger=require('../../config/logger')(_0xace5('0x6'));var config=require(_0xace5('0x7'));var jayson=require(_0xace5('0x8'));var client=jayson[_0xace5('0x9')][_0xace5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cceca,_0x1c29b7,_0x34e83a){return new BPromise(function(_0x5322a3,_0x2ef11c){return client[_0xace5('0xb')](_0x4cceca,_0x34e83a)['then'](function(_0x587805){logger[_0xace5('0xc')](_0xace5('0xd'),_0x1c29b7,_0xace5('0xe'));logger[_0xace5('0xf')](_0xace5('0x10'),_0x1c29b7,'request\x20sent',JSON[_0xace5('0x11')](_0x587805));if(_0x587805['error']){if(_0x587805['error'][_0xace5('0x12')]===0x1f4){logger[_0xace5('0x13')](_0xace5('0xd'),_0x1c29b7,_0x587805[_0xace5('0x13')]['message']);return _0x2ef11c(_0x587805[_0xace5('0x13')]['message']);}logger[_0xace5('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1c29b7,_0x587805[_0xace5('0x13')][_0xace5('0x14')]);return _0x5322a3(_0x587805[_0xace5('0x13')]['message']);}else{logger[_0xace5('0xc')](_0xace5('0xd'),_0x1c29b7,_0xace5('0xe'));_0x5322a3(_0x587805[_0xace5('0x15')]['message']);}})['catch'](function(_0x3abcf1){logger[_0xace5('0x13')](_0xace5('0xd'),_0x1c29b7,_0x3abcf1);_0x2ef11c(_0x3abcf1);});});} \ No newline at end of file +var _0x4ead=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x9641c6,_0x581f9f){var _0xf99e5a=function(_0x545cc6){while(--_0x545cc6){_0x9641c6['push'](_0x9641c6['shift']());}};_0xf99e5a(++_0x581f9f);}(_0x4ead,0x1a3));var _0xd4ea=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0x4ead[_0x51639a];return _0x3abae4;};'use strict';var _=require(_0xd4ea('0x0'));var util=require(_0xd4ea('0x1'));var moment=require(_0xd4ea('0x2'));var BPromise=require(_0xd4ea('0x3'));var rs=require(_0xd4ea('0x4'));var fs=require('fs');var Redis=require(_0xd4ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd4ea('0x6'))(_0xd4ea('0x7'));var config=require(_0xd4ea('0x8'));var jayson=require(_0xd4ea('0x9'));var client=jayson[_0xd4ea('0xa')][_0xd4ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b5c2a,_0x33eb5e,_0x549eff){return new BPromise(function(_0x20aff3,_0x8bdd3f){return client['request'](_0x2b5c2a,_0x549eff)[_0xd4ea('0xc')](function(_0x5e4343){logger[_0xd4ea('0xd')](_0xd4ea('0xe'),_0x33eb5e,_0xd4ea('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x33eb5e,_0xd4ea('0xf'),JSON[_0xd4ea('0x10')](_0x5e4343));if(_0x5e4343[_0xd4ea('0x11')]){if(_0x5e4343[_0xd4ea('0x11')][_0xd4ea('0x12')]===0x1f4){logger[_0xd4ea('0x11')](_0xd4ea('0xe'),_0x33eb5e,_0x5e4343[_0xd4ea('0x11')][_0xd4ea('0x13')]);return _0x8bdd3f(_0x5e4343[_0xd4ea('0x11')]['message']);}logger[_0xd4ea('0x11')](_0xd4ea('0xe'),_0x33eb5e,_0x5e4343[_0xd4ea('0x11')][_0xd4ea('0x13')]);return _0x20aff3(_0x5e4343[_0xd4ea('0x11')][_0xd4ea('0x13')]);}else{logger[_0xd4ea('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x33eb5e,_0xd4ea('0xf'));_0x20aff3(_0x5e4343[_0xd4ea('0x14')]['message']);}})[_0xd4ea('0x15')](function(_0x3da0c0){logger[_0xd4ea('0x11')](_0xd4ea('0xe'),_0x33eb5e,_0x3da0c0);_0x8bdd3f(_0x3da0c0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1dda60e..5832a87 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(_0x4db4e5,_0x1e1289){var _0xc7329c=function(_0x59e3f7){while(--_0x59e3f7){_0x4db4e5['push'](_0x4db4e5['shift']());}};_0xc7329c(++_0x1e1289);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0xfc12bb,_0x103e40){var _0x332b4a=function(_0x41d024){while(--_0x41d024){_0xfc12bb['push'](_0xfc12bb['shift']());}};_0x332b4a(++_0x103e40);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 67362ee..8790b3d 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 _0xcecc=['sequelize','STRING','TEXT'];(function(_0x4a944e,_0x4143d8){var _0x1da079=function(_0x425393){while(--_0x425393){_0x4a944e['push'](_0x4a944e['shift']());}};_0x1da079(++_0x4143d8);}(_0xcecc,0x186));var _0xccec=function(_0x2f146c,_0x1ecc99){_0x2f146c=_0x2f146c-0x0;var _0x11fccd=_0xcecc[_0x2f146c];return _0x11fccd;};'use strict';var Sequelize=require(_0xccec('0x0'));module['exports']={'name':{'type':Sequelize[_0xccec('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xccec('0x2')]},'description':{'type':Sequelize[_0xccec('0x1')]}}; \ No newline at end of file +var _0x5fc7=['TEXT','sequelize','exports','STRING','name'];(function(_0x3c0e68,_0x3102b4){var _0x58574b=function(_0x3f0066){while(--_0x3f0066){_0x3c0e68['push'](_0x3c0e68['shift']());}};_0x58574b(++_0x3102b4);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x5fc7[_0x171fdc];return _0x3782ea;};'use strict';var Sequelize=require(_0x75fc('0x0'));module[_0x75fc('0x1')]={'name':{'type':Sequelize[_0x75fc('0x2')],'allowNull':![],'unique':_0x75fc('0x3')},'table':{'type':Sequelize[_0x75fc('0x2')]},'metric':{'type':Sequelize[_0x75fc('0x4')]},'description':{'type':Sequelize[_0x75fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 18b12e3..eaf09ef 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(_0x3a1b5f,_0xdd8290){var _0x12c585=function(_0x30626e){while(--_0x30626e){_0x3a1b5f['push'](_0x3a1b5f['shift']());}};_0x12c585(++_0xdd8290);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5f031a,_0x5c070f){_0x5f031a=_0x5f031a-0x0;var _0x4da4ca=_0x8ef6[_0x5f031a];return _0x4da4ca;};'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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x16cb55,_0x1609c5){var _0x38bd84=function(_0x3317a8){while(--_0x3317a8){_0x16cb55['push'](_0x16cb55['shift']());}};_0x38bd84(++_0x1609c5);}(_0xdc97,0x13b));var _0x7dc9=function(_0xbd9e8e,_0x31012c){_0xbd9e8e=_0xbd9e8e-0x0;var _0x1e3cbb=_0xdc97[_0xbd9e8e];return _0x1e3cbb;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 267d308..6995113 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 _0x4553=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','util','../../config/logger','api','request-promise','path'];(function(_0x5d3620,_0x34b31f){var _0x4723f5=function(_0xb8bf90){while(--_0xb8bf90){_0x5d3620['push'](_0x5d3620['shift']());}};_0x4723f5(++_0x34b31f);}(_0x4553,0x1be));var _0x3455=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x4553[_0x3c4737];return _0x2bb926;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var logger=require(_0x3455('0x1'))(_0x3455('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3455('0x3'));var fs=require('fs');var path=require(_0x3455('0x4'));var rimraf=require(_0x3455('0x5'));var config=require(_0x3455('0x6'));var attributes=require(_0x3455('0x7'));module[_0x3455('0x8')]=function(_0x2aa1ed,_0x4010cd){return _0x2aa1ed[_0x3455('0x9')]('AnalyticMetric',attributes,{'tableName':_0x3455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc963=['moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','api'];(function(_0x5ae8f1,_0x4ddb44){var _0x41e908=function(_0x34f126){while(--_0x34f126){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x41e908(++_0x4ddb44);}(_0xc963,0x17f));var _0x3c96=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0xc963[_0x22093a];return _0x2f4989;};'use strict';var _=require(_0x3c96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c96('0x1'));var moment=require(_0x3c96('0x2'));var BPromise=require(_0x3c96('0x3'));var rp=require(_0x3c96('0x4'));var fs=require('fs');var path=require(_0x3c96('0x5'));var rimraf=require('rimraf');var config=require(_0x3c96('0x6'));var attributes=require(_0x3c96('0x7'));module[_0x3c96('0x8')]=function(_0x9213a5,_0x310d7e){return _0x9213a5['define'](_0x3c96('0x9'),attributes,{'tableName':_0x3c96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index deb001b..7bfd778 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 _0x98ae=['request\x20sent','debug','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x5dc4ff,_0x5e2436){var _0x5478ab=function(_0x21f709){while(--_0x21f709){_0x5dc4ff['push'](_0x5dc4ff['shift']());}};_0x5478ab(++_0x5e2436);}(_0x98ae,0x79));var _0xe98a=function(_0x4fc00d,_0x325659){_0x4fc00d=_0x4fc00d-0x0;var _0x3a62c7=_0x98ae[_0x4fc00d];return _0x3a62c7;};'use strict';var _=require('lodash');var util=require(_0xe98a('0x0'));var moment=require(_0xe98a('0x1'));var BPromise=require('bluebird');var rs=require(_0xe98a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe98a('0x3'));var logger=require(_0xe98a('0x4'))(_0xe98a('0x5'));var config=require(_0xe98a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe98a('0x7')][_0xe98a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a7ccb,_0x33ea9c,_0x283e11){return new BPromise(function(_0x23613d,_0x3a534f){return client['request'](_0x4a7ccb,_0x283e11)[_0xe98a('0x9')](function(_0x40dca9){logger[_0xe98a('0xa')](_0xe98a('0xb'),_0x33ea9c,_0xe98a('0xc'));logger[_0xe98a('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x33ea9c,_0xe98a('0xc'),JSON[_0xe98a('0xe')](_0x40dca9));if(_0x40dca9['error']){if(_0x40dca9[_0xe98a('0xf')][_0xe98a('0x10')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x33ea9c,_0x40dca9[_0xe98a('0xf')]['message']);return _0x3a534f(_0x40dca9['error'][_0xe98a('0x11')]);}logger['error'](_0xe98a('0xb'),_0x33ea9c,_0x40dca9['error'][_0xe98a('0x11')]);return _0x23613d(_0x40dca9[_0xe98a('0xf')][_0xe98a('0x11')]);}else{logger['info'](_0xe98a('0xb'),_0x33ea9c,_0xe98a('0xc'));_0x23613d(_0x40dca9[_0xe98a('0x12')][_0xe98a('0x11')]);}})['catch'](function(_0x2c7517){logger[_0xe98a('0xf')](_0xe98a('0xb'),_0x33ea9c,_0x2c7517);_0x3a534f(_0x2c7517);});});} \ No newline at end of file +var _0x682a=['../../config/environment','http','request','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x503a61,_0x1a48f7){var _0x2202cb=function(_0x4e6fce){while(--_0x4e6fce){_0x503a61['push'](_0x503a61['shift']());}};_0x2202cb(++_0x1a48f7);}(_0x682a,0xe9));var _0xa682=function(_0x16e38b,_0x390acf){_0x16e38b=_0x16e38b-0x0;var _0x1ebeab=_0x682a[_0x16e38b];return _0x1ebeab;};'use strict';var _=require('lodash');var util=require(_0xa682('0x0'));var moment=require(_0xa682('0x1'));var BPromise=require(_0xa682('0x2'));var rs=require(_0xa682('0x3'));var fs=require('fs');var Redis=require(_0xa682('0x4'));var db=require(_0xa682('0x5'))['db'];var utils=require(_0xa682('0x6'));var logger=require(_0xa682('0x7'))(_0xa682('0x8'));var config=require(_0xa682('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x142dad,_0xc11ddc,_0x1e12c3){return new BPromise(function(_0x54d3ef,_0x206967){return client[_0xa682('0xb')](_0x142dad,_0x1e12c3)[_0xa682('0xc')](function(_0x492e00){logger[_0xa682('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0xc11ddc,_0xa682('0xe'));logger['debug'](_0xa682('0xf'),_0xc11ddc,_0xa682('0xe'),JSON[_0xa682('0x10')](_0x492e00));if(_0x492e00[_0xa682('0x11')]){if(_0x492e00[_0xa682('0x11')]['code']===0x1f4){logger[_0xa682('0x11')](_0xa682('0x12'),_0xc11ddc,_0x492e00[_0xa682('0x11')]['message']);return _0x206967(_0x492e00[_0xa682('0x11')][_0xa682('0x13')]);}logger[_0xa682('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xc11ddc,_0x492e00[_0xa682('0x11')][_0xa682('0x13')]);return _0x54d3ef(_0x492e00['error'][_0xa682('0x13')]);}else{logger[_0xa682('0xd')](_0xa682('0x12'),_0xc11ddc,'request\x20sent');_0x54d3ef(_0x492e00[_0xa682('0x14')][_0xa682('0x13')]);}})[_0xa682('0x15')](function(_0x445805){logger[_0xa682('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xc11ddc,_0x445805);_0x206967(_0x445805);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a3e059c..22015f1 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 _0xe314=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x3e1572,_0x1b8ad4){var _0x136237=function(_0x5b4e4c){while(--_0x5b4e4c){_0x3e1572['push'](_0x3e1572['shift']());}};_0x136237(++_0x1b8ad4);}(_0xe314,0x7c));var _0x4e31=function(_0x2744c5,_0x3caacd){_0x2744c5=_0x2744c5-0x0;var _0x4d044b=_0xe314[_0x2744c5];return _0x4d044b;};'use strict';var multer=require('multer');var util=require(_0x4e31('0x0'));var path=require(_0x4e31('0x1'));var timeout=require(_0x4e31('0x2'));var express=require(_0x4e31('0x3'));var router=express[_0x4e31('0x4')]();var fs_extra=require(_0x4e31('0x5'));var auth=require(_0x4e31('0x6'));var interaction=require(_0x4e31('0x7'));var config=require(_0x4e31('0x8'));var controller=require(_0x4e31('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e31('0xa')]);router[_0x4e31('0xb')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0xe')]);router[_0x4e31('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e31('0x10')]);router[_0x4e31('0x11')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller['update']);router[_0x4e31('0x12')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0x13')]);module[_0x4e31('0x14')]=router; \ No newline at end of file +var _0x4af9=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x43eb5d,_0xc5d455){var _0x1fdab5=function(_0x5b6055){while(--_0x5b6055){_0x43eb5d['push'](_0x43eb5d['shift']());}};_0x1fdab5(++_0xc5d455);}(_0x4af9,0x12c));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94af('0x2'));var router=express[_0x94af('0x3')]();var fs_extra=require(_0x94af('0x4'));var auth=require(_0x94af('0x5'));var interaction=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var controller=require(_0x94af('0x8'));router['get']('/',auth[_0x94af('0x9')](),controller[_0x94af('0xa')]);router[_0x94af('0xb')](_0x94af('0xc'),auth['isAuthenticated'](),controller[_0x94af('0xd')]);router[_0x94af('0xe')]('/',auth[_0x94af('0x9')](),controller['create']);router['put'](_0x94af('0xc'),auth[_0x94af('0x9')](),controller[_0x94af('0xf')]);router[_0x94af('0x10')](_0x94af('0xc'),auth[_0x94af('0x9')](),controller['destroy']);module[_0x94af('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 86f50b6..691fcfd 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 _0x6327=['exports','TEXT','sequelize'];(function(_0x365a31,_0x542d3f){var _0xe860a5=function(_0x59a0c5){while(--_0x59a0c5){_0x365a31['push'](_0x365a31['shift']());}};_0xe860a5(++_0x542d3f);}(_0x6327,0x131));var _0x7632=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x6327[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x7632('0x0'));module[_0x7632('0x1')]={'tree':{'type':Sequelize[_0x7632('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x743d=['TEXT','sequelize','exports'];(function(_0x3f9f01,_0x47bc5e){var _0xb789e3=function(_0xa41695){while(--_0xa41695){_0x3f9f01['push'](_0x3f9f01['shift']());}};_0xb789e3(++_0x47bc5e);}(_0x743d,0x1c0));var _0xd743=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x743d[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xd743('0x0'));module[_0xd743('0x1')]={'tree':{'type':Sequelize[_0xd743('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 006fab6..6dc8206 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 _0x0f63=['include','findAll','catch','show','params','options','find','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll'];(function(_0x1d6dea,_0x1f8978){var _0x1b5967=function(_0x4a95f6){while(--_0x4a95f6){_0x1d6dea['push'](_0x1d6dea['shift']());}};_0x1b5967(++_0x1f8978);}(_0x0f63,0xe6));var _0x30f6=function(_0x5b6f43,_0x2f5d8a){_0x5b6f43=_0x5b6f43-0x0;var _0x3d0477=_0x0f63[_0x5b6f43];return _0x3d0477;};'use strict';var emlformat=require(_0x30f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30f6('0x1'));var rp=require(_0x30f6('0x2'));var moment=require('moment');var BPromise=require(_0x30f6('0x3'));var Mustache=require(_0x30f6('0x4'));var util=require(_0x30f6('0x5'));var path=require('path');var sox=require(_0x30f6('0x6'));var csv=require(_0x30f6('0x7'));var ejs=require(_0x30f6('0x8'));var fs=require('fs');var fs_extra=require(_0x30f6('0x9'));var _=require(_0x30f6('0xa'));var squel=require(_0x30f6('0xb'));var crypto=require(_0x30f6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x30f6('0x7'));var querystring=require('querystring');var Papa=require(_0x30f6('0xd'));var Redis=require(_0x30f6('0xe'));var authService=require(_0x30f6('0xf'));var qs=require(_0x30f6('0x10'));var as=require(_0x30f6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30f6('0x12'))(_0x30f6('0x13'));var utils=require(_0x30f6('0x14'));var config=require(_0x30f6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x30f6('0x16'))['db'];function respondWithStatusCode(_0x1cd36,_0x2df3a2){_0x2df3a2=_0x2df3a2||0xcc;return function(_0x26fc11){if(_0x26fc11){return _0x1cd36[_0x30f6('0x17')](_0x2df3a2);}return _0x1cd36[_0x30f6('0x18')](_0x2df3a2)[_0x30f6('0x19')]();};}function respondWithResult(_0x1efffe,_0x5c7b1a){_0x5c7b1a=_0x5c7b1a||0xc8;return function(_0x23197f){if(_0x23197f){return _0x1efffe[_0x30f6('0x18')](_0x5c7b1a)['json'](_0x23197f);}};}function respondWithFilteredResult(_0x1b5526,_0x3ae331){return function(_0x79999b){if(_0x79999b){var _0x3f2a5b=typeof _0x3ae331['offset']===_0x30f6('0x1a')&&typeof _0x3ae331['limit']===_0x30f6('0x1a');var _0x106ffc=_0x79999b['count'];var _0x3b6d8b=_0x3f2a5b?0x0:_0x3ae331[_0x30f6('0x1b')];var _0x3b06cb=_0x3f2a5b?_0x79999b[_0x30f6('0x1c')]:_0x3ae331[_0x30f6('0x1b')]+_0x3ae331['limit'];var _0x425f54;if(_0x3b06cb>=_0x106ffc){_0x3b06cb=_0x106ffc;_0x425f54=0xc8;}else{_0x425f54=0xce;}_0x1b5526[_0x30f6('0x18')](_0x425f54);return _0x1b5526[_0x30f6('0x1d')](_0x30f6('0x1e'),_0x3b6d8b+'-'+_0x3b06cb+'/'+_0x106ffc)[_0x30f6('0x1f')](_0x79999b);}return null;};}function patchUpdates(_0x5dec7){return function(_0x533ae2){try{jsonpatch[_0x30f6('0x20')](_0x533ae2,_0x5dec7,!![]);}catch(_0x546c61){return BPromise[_0x30f6('0x21')](_0x546c61);}return _0x533ae2[_0x30f6('0x22')]();};}function saveUpdates(_0xced398,_0x20e7c2){return function(_0x56e2d1){if(_0x56e2d1){return _0x56e2d1[_0x30f6('0x23')](_0xced398)[_0x30f6('0x24')](function(_0x585dea){return _0x585dea;});}return null;};}function removeEntity(_0x410b4c,_0x26888f){return function(_0x313d85){if(_0x313d85){return _0x313d85[_0x30f6('0x25')]()['then'](function(){_0x410b4c[_0x30f6('0x18')](0xcc)[_0x30f6('0x19')]();});}};}function handleEntityNotFound(_0x5c832b,_0x2cb456){return function(_0x2ec3a8){if(!_0x2ec3a8){_0x5c832b[_0x30f6('0x17')](0x194);}return _0x2ec3a8;};}function handleError(_0x37ddc9,_0x59bb4d){_0x59bb4d=_0x59bb4d||0x1f4;return function(_0x26c04d){logger['error'](_0x26c04d[_0x30f6('0x26')]);if(_0x26c04d[_0x30f6('0x27')]){delete _0x26c04d[_0x30f6('0x27')];}_0x37ddc9[_0x30f6('0x18')](_0x59bb4d)[_0x30f6('0x28')](_0x26c04d);};}exports[_0x30f6('0x29')]=function(_0x410ac9,_0x41ef76){var _0x1ad26a={},_0x237d77={},_0x378cb5={'count':0x0,'rows':[]};var _0x2640b2=_['map'](db[_0x30f6('0x2a')][_0x30f6('0x2b')],function(_0x381c1c){return{'name':_0x381c1c[_0x30f6('0x2c')],'type':_0x381c1c[_0x30f6('0x2d')][_0x30f6('0x2e')]};});_0x237d77[_0x30f6('0x2f')]=_[_0x30f6('0x30')](_0x2640b2,_0x30f6('0x27'));_0x237d77['query']=_[_0x30f6('0x31')](_0x410ac9[_0x30f6('0x32')]);_0x237d77[_0x30f6('0x33')]=_[_0x30f6('0x34')](_0x237d77['model'],_0x237d77[_0x30f6('0x32')]);_0x1ad26a[_0x30f6('0x35')]=_[_0x30f6('0x34')](_0x237d77[_0x30f6('0x2f')],qs[_0x30f6('0x36')](_0x410ac9[_0x30f6('0x32')][_0x30f6('0x36')]));_0x1ad26a['attributes']=_0x1ad26a[_0x30f6('0x35')][_0x30f6('0x37')]?_0x1ad26a[_0x30f6('0x35')]:_0x237d77[_0x30f6('0x2f')];if(!_0x410ac9['query'][_0x30f6('0x38')](_0x30f6('0x39'))){_0x1ad26a[_0x30f6('0x3a')]=qs[_0x30f6('0x3a')](_0x410ac9[_0x30f6('0x32')]['limit']);_0x1ad26a[_0x30f6('0x1b')]=qs[_0x30f6('0x1b')](_0x410ac9[_0x30f6('0x32')][_0x30f6('0x1b')]);}_0x1ad26a[_0x30f6('0x3b')]=qs[_0x30f6('0x3c')](_0x410ac9[_0x30f6('0x32')]['sort']);_0x1ad26a[_0x30f6('0x3d')]=qs[_0x30f6('0x33')](_['pick'](_0x410ac9[_0x30f6('0x32')],_0x237d77[_0x30f6('0x33')]),_0x2640b2);if(_0x410ac9['query'][_0x30f6('0x3e')]){_0x1ad26a[_0x30f6('0x3d')]=_[_0x30f6('0x3f')](_0x1ad26a[_0x30f6('0x3d')],{'$or':_['map'](_0x2640b2,function(_0x265a78){if(_0x265a78[_0x30f6('0x2d')]!==_0x30f6('0x40')){var _0x546da7={};_0x546da7[_0x265a78[_0x30f6('0x27')]]={'$like':'%'+_0x410ac9[_0x30f6('0x32')][_0x30f6('0x3e')]+'%'};return _0x546da7;}})});}_0x1ad26a=_['merge']({},_0x1ad26a,_0x410ac9['options']);var _0x22f4c7={'where':_0x1ad26a['where']};return db[_0x30f6('0x2a')][_0x30f6('0x1c')](_0x22f4c7)[_0x30f6('0x24')](function(_0x3f137a){_0x378cb5[_0x30f6('0x1c')]=_0x3f137a;if(_0x410ac9['query'][_0x30f6('0x41')]){_0x1ad26a[_0x30f6('0x42')]=[{'all':!![]}];}return db[_0x30f6('0x2a')][_0x30f6('0x43')](_0x1ad26a);})['then'](function(_0x202466){_0x378cb5['rows']=_0x202466;return _0x378cb5;})[_0x30f6('0x24')](respondWithFilteredResult(_0x41ef76,_0x1ad26a))[_0x30f6('0x44')](handleError(_0x41ef76,null));};exports[_0x30f6('0x45')]=function(_0x43fb71,_0x5bbeaa){var _0x665b73={'raw':!![],'where':{'id':_0x43fb71[_0x30f6('0x46')]['id']}},_0x2924fe={};_0x2924fe[_0x30f6('0x2f')]=_[_0x30f6('0x31')](db['AnalyticTreeReport'][_0x30f6('0x2b')]);_0x2924fe[_0x30f6('0x32')]=_['keys'](_0x43fb71[_0x30f6('0x32')]);_0x2924fe['filters']=_[_0x30f6('0x34')](_0x2924fe['model'],_0x2924fe['query']);_0x665b73['attributes']=_[_0x30f6('0x34')](_0x2924fe['model'],qs['fields'](_0x43fb71[_0x30f6('0x32')][_0x30f6('0x36')]));_0x665b73[_0x30f6('0x35')]=_0x665b73[_0x30f6('0x35')][_0x30f6('0x37')]?_0x665b73[_0x30f6('0x35')]:_0x2924fe['model'];if(_0x43fb71[_0x30f6('0x32')][_0x30f6('0x41')]){_0x665b73[_0x30f6('0x42')]=[{'all':!![]}];}_0x665b73=_[_0x30f6('0x3f')]({},_0x665b73,_0x43fb71[_0x30f6('0x47')]);return db[_0x30f6('0x2a')][_0x30f6('0x48')](_0x665b73)[_0x30f6('0x24')](handleEntityNotFound(_0x5bbeaa,null))[_0x30f6('0x24')](respondWithResult(_0x5bbeaa,null))['catch'](handleError(_0x5bbeaa,null));};exports['create']=function(_0x40cef8,_0x16b49a){return db[_0x30f6('0x2a')]['create'](_0x40cef8[_0x30f6('0x49')],{})['then'](respondWithResult(_0x16b49a,0xc9))[_0x30f6('0x44')](handleError(_0x16b49a,null));};exports[_0x30f6('0x23')]=function(_0x23d09a,_0x3e7ed8){if(_0x23d09a['body']['id']){delete _0x23d09a['body']['id'];}return db[_0x30f6('0x2a')][_0x30f6('0x48')]({'where':{'id':_0x23d09a['params']['id']}})[_0x30f6('0x24')](handleEntityNotFound(_0x3e7ed8,null))[_0x30f6('0x24')](saveUpdates(_0x23d09a[_0x30f6('0x49')],null))[_0x30f6('0x24')](respondWithResult(_0x3e7ed8,null))['catch'](handleError(_0x3e7ed8,null));};exports['destroy']=function(_0x11422b,_0x48bd28){return db['AnalyticTreeReport'][_0x30f6('0x48')]({'where':{'id':_0x11422b['params']['id']}})['then'](handleEntityNotFound(_0x48bd28,null))[_0x30f6('0x24')](removeEntity(_0x48bd28,null))[_0x30f6('0x44')](handleError(_0x48bd28,null));}; \ No newline at end of file +var _0x2091=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','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','status','end','json','undefined','count','offset','limit','apply','update','destroy','sendStatus','name','send','index','map','AnalyticTreeReport','rawAttributes','type'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x2091,0x184));var _0x1209=function(_0x1188fe,_0x1066fb){_0x1188fe=_0x1188fe-0x0;var _0x371d66=_0x2091[_0x1188fe];return _0x371d66;};'use strict';var emlformat=require(_0x1209('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1209('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1209('0x2'));var moment=require(_0x1209('0x3'));var BPromise=require(_0x1209('0x4'));var Mustache=require(_0x1209('0x5'));var util=require(_0x1209('0x6'));var path=require(_0x1209('0x7'));var sox=require(_0x1209('0x8'));var csv=require(_0x1209('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1209('0xa'));var _=require(_0x1209('0xb'));var squel=require('squel');var crypto=require(_0x1209('0xc'));var jsforce=require(_0x1209('0xd'));var deskjs=require(_0x1209('0xe'));var toCsv=require(_0x1209('0x9'));var querystring=require(_0x1209('0xf'));var Papa=require(_0x1209('0x10'));var Redis=require(_0x1209('0x11'));var authService=require(_0x1209('0x12'));var qs=require(_0x1209('0x13'));var as=require(_0x1209('0x14'));var hardwareService=require(_0x1209('0x15'));var logger=require('../../config/logger')(_0x1209('0x16'));var utils=require(_0x1209('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1209('0x18'));var db=require(_0x1209('0x19'))['db'];function respondWithStatusCode(_0x4c2a60,_0x42088d){_0x42088d=_0x42088d||0xcc;return function(_0x3f55f7){if(_0x3f55f7){return _0x4c2a60['sendStatus'](_0x42088d);}return _0x4c2a60[_0x1209('0x1a')](_0x42088d)[_0x1209('0x1b')]();};}function respondWithResult(_0x263e64,_0x20c6b4){_0x20c6b4=_0x20c6b4||0xc8;return function(_0x5d2c30){if(_0x5d2c30){return _0x263e64['status'](_0x20c6b4)[_0x1209('0x1c')](_0x5d2c30);}};}function respondWithFilteredResult(_0x49ed74,_0x2c54eb){return function(_0xf20807){if(_0xf20807){var _0x4d088f=typeof _0x2c54eb['offset']===_0x1209('0x1d')&&typeof _0x2c54eb['limit']==='undefined';var _0x37e0fc=_0xf20807[_0x1209('0x1e')];var _0x1b3144=_0x4d088f?0x0:_0x2c54eb[_0x1209('0x1f')];var _0xf504da=_0x4d088f?_0xf20807[_0x1209('0x1e')]:_0x2c54eb[_0x1209('0x1f')]+_0x2c54eb[_0x1209('0x20')];var _0x3e25a2;if(_0xf504da>=_0x37e0fc){_0xf504da=_0x37e0fc;_0x3e25a2=0xc8;}else{_0x3e25a2=0xce;}_0x49ed74[_0x1209('0x1a')](_0x3e25a2);return _0x49ed74['set']('Content-Range',_0x1b3144+'-'+_0xf504da+'/'+_0x37e0fc)[_0x1209('0x1c')](_0xf20807);}return null;};}function patchUpdates(_0x3c7fe0){return function(_0x2a3fc0){try{jsonpatch[_0x1209('0x21')](_0x2a3fc0,_0x3c7fe0,!![]);}catch(_0x34d887){return BPromise['reject'](_0x34d887);}return _0x2a3fc0['save']();};}function saveUpdates(_0x2500e6,_0x3c8c62){return function(_0x3c6363){if(_0x3c6363){return _0x3c6363[_0x1209('0x22')](_0x2500e6)['then'](function(_0x44ae69){return _0x44ae69;});}return null;};}function removeEntity(_0x14023d,_0x36da0d){return function(_0x3e35a7){if(_0x3e35a7){return _0x3e35a7[_0x1209('0x23')]()['then'](function(){_0x14023d[_0x1209('0x1a')](0xcc)[_0x1209('0x1b')]();});}};}function handleEntityNotFound(_0xec9181,_0x2071a1){return function(_0x59da60){if(!_0x59da60){_0xec9181[_0x1209('0x24')](0x194);}return _0x59da60;};}function handleError(_0x2b4679,_0x386c5e){_0x386c5e=_0x386c5e||0x1f4;return function(_0x5e2cdc){logger['error'](_0x5e2cdc['stack']);if(_0x5e2cdc[_0x1209('0x25')]){delete _0x5e2cdc[_0x1209('0x25')];}_0x2b4679[_0x1209('0x1a')](_0x386c5e)[_0x1209('0x26')](_0x5e2cdc);};}exports[_0x1209('0x27')]=function(_0x50987e,_0x423b10){var _0xa58e6={},_0x544387={},_0x1e970f={'count':0x0,'rows':[]};var _0xc8a6c6=_[_0x1209('0x28')](db[_0x1209('0x29')][_0x1209('0x2a')],function(_0xf3ba1){return{'name':_0xf3ba1['fieldName'],'type':_0xf3ba1[_0x1209('0x2b')][_0x1209('0x2c')]};});_0x544387[_0x1209('0x2d')]=_['map'](_0xc8a6c6,_0x1209('0x25'));_0x544387[_0x1209('0x2e')]=_[_0x1209('0x2f')](_0x50987e['query']);_0x544387[_0x1209('0x30')]=_[_0x1209('0x31')](_0x544387['model'],_0x544387[_0x1209('0x2e')]);_0xa58e6[_0x1209('0x32')]=_[_0x1209('0x31')](_0x544387[_0x1209('0x2d')],qs[_0x1209('0x33')](_0x50987e[_0x1209('0x2e')][_0x1209('0x33')]));_0xa58e6['attributes']=_0xa58e6[_0x1209('0x32')]['length']?_0xa58e6[_0x1209('0x32')]:_0x544387[_0x1209('0x2d')];if(!_0x50987e[_0x1209('0x2e')][_0x1209('0x34')](_0x1209('0x35'))){_0xa58e6['limit']=qs[_0x1209('0x20')](_0x50987e['query']['limit']);_0xa58e6[_0x1209('0x1f')]=qs[_0x1209('0x1f')](_0x50987e[_0x1209('0x2e')][_0x1209('0x1f')]);}_0xa58e6['order']=qs[_0x1209('0x36')](_0x50987e[_0x1209('0x2e')][_0x1209('0x36')]);_0xa58e6[_0x1209('0x37')]=qs[_0x1209('0x30')](_[_0x1209('0x38')](_0x50987e[_0x1209('0x2e')],_0x544387[_0x1209('0x30')]),_0xc8a6c6);if(_0x50987e[_0x1209('0x2e')][_0x1209('0x39')]){_0xa58e6[_0x1209('0x37')]=_[_0x1209('0x3a')](_0xa58e6[_0x1209('0x37')],{'$or':_['map'](_0xc8a6c6,function(_0x40f564){if(_0x40f564[_0x1209('0x2b')]!==_0x1209('0x3b')){var _0x116621={};_0x116621[_0x40f564['name']]={'$like':'%'+_0x50987e['query'][_0x1209('0x39')]+'%'};return _0x116621;}})});}_0xa58e6=_['merge']({},_0xa58e6,_0x50987e[_0x1209('0x3c')]);var _0x179899={'where':_0xa58e6['where']};return db['AnalyticTreeReport']['count'](_0x179899)[_0x1209('0x3d')](function(_0xc43be4){_0x1e970f[_0x1209('0x1e')]=_0xc43be4;if(_0x50987e[_0x1209('0x2e')][_0x1209('0x3e')]){_0xa58e6[_0x1209('0x3f')]=[{'all':!![]}];}return db[_0x1209('0x29')]['findAll'](_0xa58e6);})[_0x1209('0x3d')](function(_0x5abe7e){_0x1e970f[_0x1209('0x40')]=_0x5abe7e;return _0x1e970f;})[_0x1209('0x3d')](respondWithFilteredResult(_0x423b10,_0xa58e6))[_0x1209('0x41')](handleError(_0x423b10,null));};exports[_0x1209('0x42')]=function(_0x4035f9,_0x24bf12){var _0x15c88f={'raw':!![],'where':{'id':_0x4035f9[_0x1209('0x43')]['id']}},_0x55aae7={};_0x55aae7[_0x1209('0x2d')]=_[_0x1209('0x2f')](db[_0x1209('0x29')][_0x1209('0x2a')]);_0x55aae7[_0x1209('0x2e')]=_['keys'](_0x4035f9[_0x1209('0x2e')]);_0x55aae7[_0x1209('0x30')]=_['intersection'](_0x55aae7[_0x1209('0x2d')],_0x55aae7['query']);_0x15c88f[_0x1209('0x32')]=_[_0x1209('0x31')](_0x55aae7[_0x1209('0x2d')],qs['fields'](_0x4035f9[_0x1209('0x2e')][_0x1209('0x33')]));_0x15c88f['attributes']=_0x15c88f[_0x1209('0x32')][_0x1209('0x44')]?_0x15c88f[_0x1209('0x32')]:_0x55aae7[_0x1209('0x2d')];if(_0x4035f9['query'][_0x1209('0x3e')]){_0x15c88f[_0x1209('0x3f')]=[{'all':!![]}];}_0x15c88f=_[_0x1209('0x3a')]({},_0x15c88f,_0x4035f9['options']);return db[_0x1209('0x29')][_0x1209('0x45')](_0x15c88f)[_0x1209('0x3d')](handleEntityNotFound(_0x24bf12,null))[_0x1209('0x3d')](respondWithResult(_0x24bf12,null))[_0x1209('0x41')](handleError(_0x24bf12,null));};exports[_0x1209('0x46')]=function(_0x5d0018,_0x47f10d){return db[_0x1209('0x29')]['create'](_0x5d0018[_0x1209('0x47')],{})[_0x1209('0x3d')](respondWithResult(_0x47f10d,0xc9))[_0x1209('0x41')](handleError(_0x47f10d,null));};exports[_0x1209('0x22')]=function(_0x106f47,_0x4df550){if(_0x106f47[_0x1209('0x47')]['id']){delete _0x106f47['body']['id'];}return db[_0x1209('0x29')][_0x1209('0x45')]({'where':{'id':_0x106f47[_0x1209('0x43')]['id']}})[_0x1209('0x3d')](handleEntityNotFound(_0x4df550,null))[_0x1209('0x3d')](saveUpdates(_0x106f47[_0x1209('0x47')],null))[_0x1209('0x3d')](respondWithResult(_0x4df550,null))[_0x1209('0x41')](handleError(_0x4df550,null));};exports[_0x1209('0x23')]=function(_0x2035ad,_0x34a644){return db[_0x1209('0x29')][_0x1209('0x45')]({'where':{'id':_0x2035ad[_0x1209('0x43')]['id']}})['then'](handleEntityNotFound(_0x34a644,null))['then'](removeEntity(_0x34a644,null))[_0x1209('0x41')](handleError(_0x34a644,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c334251..d8e0cce 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 _0xed4f=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','path'];(function(_0x4b08be,_0xa3caac){var _0x30b817=function(_0x7624aa){while(--_0x7624aa){_0x4b08be['push'](_0x4b08be['shift']());}};_0x30b817(++_0xa3caac);}(_0xed4f,0x7c));var _0xfed4=function(_0x1bf7c6,_0x2d9527){_0x1bf7c6=_0x1bf7c6-0x0;var _0x162c30=_0xed4f[_0x1bf7c6];return _0x162c30;};'use strict';var _=require(_0xfed4('0x0'));var util=require(_0xfed4('0x1'));var logger=require(_0xfed4('0x2'))(_0xfed4('0x3'));var moment=require(_0xfed4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfed4('0x5'));var rimraf=require(_0xfed4('0x6'));var config=require(_0xfed4('0x7'));var attributes=require(_0xfed4('0x8'));module[_0xfed4('0x9')]=function(_0x527536,_0x25f386){return _0x527536[_0xfed4('0xa')](_0xfed4('0xb'),attributes,{'tableName':_0xfed4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda24=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xda24,0x1cd));var _0x4da2=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0xda24[_0x16c2b1];return _0x199ac4;};'use strict';var _=require('lodash');var util=require(_0x4da2('0x0'));var logger=require('../../config/logger')(_0x4da2('0x1'));var moment=require(_0x4da2('0x2'));var BPromise=require(_0x4da2('0x3'));var rp=require(_0x4da2('0x4'));var fs=require('fs');var path=require(_0x4da2('0x5'));var rimraf=require(_0x4da2('0x6'));var config=require(_0x4da2('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x4da2('0x8')]=function(_0x4dd25a,_0x4731cb){return _0x4dd25a[_0x4da2('0x9')](_0x4da2('0xa'),attributes,{'tableName':'analytics_report_trees','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 2bca7ef..7acb7b6 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1136a4,_0x5ae392){var _0x4acef5=function(_0x481cf6){while(--_0x481cf6){_0x1136a4['push'](_0x1136a4['shift']());}};_0x4acef5(++_0x5ae392);}(_0xdb28,0x106));var _0x8db2=function(_0x15fb31,_0x7e636e){_0x15fb31=_0x15fb31-0x0;var _0x36011b=_0xdb28[_0x15fb31];return _0x36011b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x4c6d3e,_0x13dacc){_0x4c6d3e=_0x4c6d3e-0x0;var _0x342ab1=_0x7a54[_0x4c6d3e];return _0x342ab1;};'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 eff191d..dc1abc3 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 _0xf00c=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5f15c3,_0x5657e1){var _0x48405e=function(_0x1052c4){while(--_0x1052c4){_0x5f15c3['push'](_0x5f15c3['shift']());}};_0x48405e(++_0x5657e1);}(_0xf00c,0x14d));var _0xcf00=function(_0x645c00,_0x46fe36){_0x645c00=_0x645c00-0x0;var _0x26776d=_0xf00c[_0x645c00];return _0x26776d;};'use strict';var multer=require(_0xcf00('0x0'));var util=require('util');var path=require(_0xcf00('0x1'));var timeout=require(_0xcf00('0x2'));var express=require(_0xcf00('0x3'));var router=express[_0xcf00('0x4')]();var fs_extra=require(_0xcf00('0x5'));var auth=require(_0xcf00('0x6'));var interaction=require(_0xcf00('0x7'));var config=require(_0xcf00('0x8'));var controller=require(_0xcf00('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcf00('0xa')]('/:id',auth[_0xcf00('0xb')](),controller[_0xcf00('0xc')]);router[_0xcf00('0xd')]('/',auth[_0xcf00('0xb')](),controller[_0xcf00('0xe')]);router[_0xcf00('0xf')](_0xcf00('0x10'),auth[_0xcf00('0xb')](),controller[_0xcf00('0x11')]);router[_0xcf00('0x12')](_0xcf00('0x10'),auth[_0xcf00('0xb')](),controller['destroy']);module[_0xcf00('0x13')]=router; \ No newline at end of file +var _0x4b2e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x475ba6,_0x553dbf){var _0x268add=function(_0x16698c){while(--_0x16698c){_0x475ba6['push'](_0x475ba6['shift']());}};_0x268add(++_0x553dbf);}(_0x4b2e,0x166));var _0xe4b2=function(_0x3a6a79,_0x3931ff){_0x3a6a79=_0x3a6a79-0x0;var _0x168c6f=_0x4b2e[_0x3a6a79];return _0x168c6f;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express['Router']();var fs_extra=require(_0xe4b2('0x5'));var auth=require(_0xe4b2('0x6'));var interaction=require(_0xe4b2('0x7'));var config=require(_0xe4b2('0x8'));var controller=require(_0xe4b2('0x9'));router[_0xe4b2('0xa')]('/',auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xc')]);router['get'](_0xe4b2('0xd'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xe')]);router['post']('/',auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xf')]);router[_0xe4b2('0x10')](_0xe4b2('0xd'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0x11')]);router[_0xe4b2('0x12')](_0xe4b2('0xd'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0x13')]);module[_0xe4b2('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e94e631..160b2aa 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 _0x61df=['STRING'];(function(_0x1e0f14,_0x4140c6){var _0x34fd61=function(_0x5a427f){while(--_0x5a427f){_0x1e0f14['push'](_0x1e0f14['shift']());}};_0x34fd61(++_0x4140c6);}(_0x61df,0xbd));var _0xf61d=function(_0x93d894,_0x209806){_0x93d894=_0x93d894-0x0;var _0x4919da=_0x61df[_0x93d894];return _0x4919da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xf61d('0x0')]},'type':{'type':Sequelize[_0xf61d('0x0')]}}; \ No newline at end of file +var _0xba6c=['STRING','sequelize'];(function(_0x2bc218,_0xd6c860){var _0x4d01bc=function(_0x55834e){while(--_0x55834e){_0x2bc218['push'](_0x2bc218['shift']());}};_0x4d01bc(++_0xd6c860);}(_0xba6c,0x113));var _0xcba6=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0xba6c[_0x3a94e1];return _0x6a09d5;};'use strict';var Sequelize=require(_0xcba6('0x0'));module['exports']={'name':{'type':Sequelize[_0xcba6('0x1')]},'basename':{'type':Sequelize[_0xcba6('0x1')]},'type':{'type':Sequelize[_0xcba6('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ff10203..3ecdd4d 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 _0x1f15=['catch','show','params','keys','fields','includeAll','find','clone','omit','createdAt','body','updatedAt','create','file','basename','filename','mimetype','download','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','where','filters','merge','filter','options','Attachment','include','findAll','rows','then'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x1f15,0xc8));var _0x51f1=function(_0x2e4ffa,_0xeb3d5){_0x2e4ffa=_0x2e4ffa-0x0;var _0x205ff7=_0x1f15[_0x2e4ffa];return _0x205ff7;};'use strict';var emlformat=require(_0x51f1('0x0'));var rimraf=require(_0x51f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51f1('0x2'));var rp=require(_0x51f1('0x3'));var moment=require(_0x51f1('0x4'));var BPromise=require(_0x51f1('0x5'));var Mustache=require(_0x51f1('0x6'));var util=require('util');var path=require(_0x51f1('0x7'));var sox=require('sox');var csv=require(_0x51f1('0x8'));var ejs=require(_0x51f1('0x9'));var fs=require('fs');var fs_extra=require(_0x51f1('0xa'));var _=require(_0x51f1('0xb'));var squel=require('squel');var crypto=require(_0x51f1('0xc'));var jsforce=require(_0x51f1('0xd'));var deskjs=require(_0x51f1('0xe'));var toCsv=require(_0x51f1('0x8'));var querystring=require(_0x51f1('0xf'));var Papa=require(_0x51f1('0x10'));var Redis=require(_0x51f1('0x11'));var authService=require(_0x51f1('0x12'));var qs=require(_0x51f1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51f1('0x14'));var logger=require(_0x51f1('0x15'))(_0x51f1('0x16'));var utils=require(_0x51f1('0x17'));var config=require(_0x51f1('0x18'));var licenseUtil=require(_0x51f1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5da936,_0x1b636e){_0x1b636e=_0x1b636e||0xcc;return function(_0x4a8017){if(_0x4a8017){return _0x5da936[_0x51f1('0x1a')](_0x1b636e);}return _0x5da936[_0x51f1('0x1b')](_0x1b636e)[_0x51f1('0x1c')]();};}function respondWithResult(_0x351930,_0x50bf1d){_0x50bf1d=_0x50bf1d||0xc8;return function(_0x39462f){if(_0x39462f){return _0x351930[_0x51f1('0x1b')](_0x50bf1d)[_0x51f1('0x1d')](_0x39462f);}};}function respondWithFilteredResult(_0x51402c,_0x31a5a5){return function(_0x25cd3d){if(_0x25cd3d){var _0x2dba9d=typeof _0x31a5a5[_0x51f1('0x1e')]===_0x51f1('0x1f')&&typeof _0x31a5a5[_0x51f1('0x20')]===_0x51f1('0x1f');var _0x1468f8=_0x25cd3d[_0x51f1('0x21')];var _0x5c7430=_0x2dba9d?0x0:_0x31a5a5[_0x51f1('0x1e')];var _0x4aab50=_0x2dba9d?_0x25cd3d['count']:_0x31a5a5[_0x51f1('0x1e')]+_0x31a5a5[_0x51f1('0x20')];var _0x4d294f;if(_0x4aab50>=_0x1468f8){_0x4aab50=_0x1468f8;_0x4d294f=0xc8;}else{_0x4d294f=0xce;}_0x51402c['status'](_0x4d294f);return _0x51402c['set'](_0x51f1('0x22'),_0x5c7430+'-'+_0x4aab50+'/'+_0x1468f8)['json'](_0x25cd3d);}return null;};}function patchUpdates(_0x2aa6d0){return function(_0x428e1b){try{jsonpatch[_0x51f1('0x23')](_0x428e1b,_0x2aa6d0,!![]);}catch(_0x415b86){return BPromise[_0x51f1('0x24')](_0x415b86);}return _0x428e1b['save']();};}function saveUpdates(_0x452a51,_0x3bc6d2){return function(_0x3c7490){if(_0x3c7490){return _0x3c7490[_0x51f1('0x25')](_0x452a51)['then'](function(_0x427033){return _0x427033;});}return null;};}function removeEntity(_0x2abd8e,_0x330723){return function(_0x3b9c2d){if(_0x3b9c2d){return _0x3b9c2d[_0x51f1('0x26')]()['then'](function(){_0x2abd8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4e0ca,_0x193823){return function(_0x666a52){if(!_0x666a52){_0xc4e0ca['sendStatus'](0x194);}return _0x666a52;};}function handleError(_0x3c9a75,_0x196e42){_0x196e42=_0x196e42||0x1f4;return function(_0x3737b7){logger[_0x51f1('0x27')](_0x3737b7[_0x51f1('0x28')]);if(_0x3737b7[_0x51f1('0x29')]){delete _0x3737b7[_0x51f1('0x29')];}_0x3c9a75[_0x51f1('0x1b')](_0x196e42)[_0x51f1('0x2a')](_0x3737b7);};}exports[_0x51f1('0x2b')]=function(_0x50602c,_0x2387bd){var _0x15b89d={},_0x2ad0d9={},_0x5a3572={'count':0x0,'rows':[]};var _0x30cd66=_[_0x51f1('0x2c')](db['Attachment'][_0x51f1('0x2d')],function(_0x77d552){return{'name':_0x77d552[_0x51f1('0x2e')],'type':_0x77d552[_0x51f1('0x2f')][_0x51f1('0x30')]};});_0x2ad0d9[_0x51f1('0x31')]=_['map'](_0x30cd66,_0x51f1('0x29'));_0x2ad0d9[_0x51f1('0x32')]=_['keys'](_0x50602c[_0x51f1('0x32')]);_0x2ad0d9['filters']=_[_0x51f1('0x33')](_0x2ad0d9['model'],_0x2ad0d9[_0x51f1('0x32')]);_0x15b89d[_0x51f1('0x34')]=_[_0x51f1('0x33')](_0x2ad0d9['model'],qs['fields'](_0x50602c[_0x51f1('0x32')]['fields']));_0x15b89d[_0x51f1('0x34')]=_0x15b89d[_0x51f1('0x34')][_0x51f1('0x35')]?_0x15b89d[_0x51f1('0x34')]:_0x2ad0d9['model'];if(!_0x50602c[_0x51f1('0x32')]['hasOwnProperty'](_0x51f1('0x36'))){_0x15b89d[_0x51f1('0x20')]=qs['limit'](_0x50602c['query'][_0x51f1('0x20')]);_0x15b89d[_0x51f1('0x1e')]=qs['offset'](_0x50602c[_0x51f1('0x32')][_0x51f1('0x1e')]);}_0x15b89d[_0x51f1('0x37')]=qs[_0x51f1('0x38')](_0x50602c[_0x51f1('0x32')][_0x51f1('0x38')]);_0x15b89d[_0x51f1('0x39')]=qs[_0x51f1('0x3a')](_['pick'](_0x50602c[_0x51f1('0x32')],_0x2ad0d9['filters']),_0x30cd66);if(_0x50602c[_0x51f1('0x32')]['filter']){_0x15b89d[_0x51f1('0x39')]=_[_0x51f1('0x3b')](_0x15b89d[_0x51f1('0x39')],{'$or':_[_0x51f1('0x2c')](_0x30cd66,function(_0x5514ff){if(_0x5514ff['type']!=='VIRTUAL'){var _0x466ca0={};_0x466ca0[_0x5514ff['name']]={'$like':'%'+_0x50602c[_0x51f1('0x32')][_0x51f1('0x3c')]+'%'};return _0x466ca0;}})});}_0x15b89d=_[_0x51f1('0x3b')]({},_0x15b89d,_0x50602c[_0x51f1('0x3d')]);var _0xb3e688={'where':_0x15b89d[_0x51f1('0x39')]};return db[_0x51f1('0x3e')][_0x51f1('0x21')](_0xb3e688)['then'](function(_0x4435bd){_0x5a3572[_0x51f1('0x21')]=_0x4435bd;if(_0x50602c[_0x51f1('0x32')]['includeAll']){_0x15b89d[_0x51f1('0x3f')]=[{'all':!![]}];}return db[_0x51f1('0x3e')][_0x51f1('0x40')](_0x15b89d);})['then'](function(_0x419d7f){_0x5a3572[_0x51f1('0x41')]=_0x419d7f;return _0x5a3572;})[_0x51f1('0x42')](respondWithFilteredResult(_0x2387bd,_0x15b89d))[_0x51f1('0x43')](handleError(_0x2387bd,null));};exports[_0x51f1('0x44')]=function(_0x73dbd1,_0x327bc5){var _0x3643ed={'raw':!![],'where':{'id':_0x73dbd1[_0x51f1('0x45')]['id']}},_0x144e7d={};_0x144e7d[_0x51f1('0x31')]=_[_0x51f1('0x46')](db[_0x51f1('0x3e')][_0x51f1('0x2d')]);_0x144e7d[_0x51f1('0x32')]=_[_0x51f1('0x46')](_0x73dbd1[_0x51f1('0x32')]);_0x144e7d[_0x51f1('0x3a')]=_['intersection'](_0x144e7d[_0x51f1('0x31')],_0x144e7d[_0x51f1('0x32')]);_0x3643ed[_0x51f1('0x34')]=_[_0x51f1('0x33')](_0x144e7d[_0x51f1('0x31')],qs[_0x51f1('0x47')](_0x73dbd1[_0x51f1('0x32')][_0x51f1('0x47')]));_0x3643ed[_0x51f1('0x34')]=_0x3643ed[_0x51f1('0x34')][_0x51f1('0x35')]?_0x3643ed[_0x51f1('0x34')]:_0x144e7d[_0x51f1('0x31')];if(_0x73dbd1[_0x51f1('0x32')][_0x51f1('0x48')]){_0x3643ed[_0x51f1('0x3f')]=[{'all':!![]}];}_0x3643ed=_[_0x51f1('0x3b')]({},_0x3643ed,_0x73dbd1[_0x51f1('0x3d')]);return db['Attachment'][_0x51f1('0x49')](_0x3643ed)['then'](handleEntityNotFound(_0x327bc5,null))[_0x51f1('0x42')](respondWithResult(_0x327bc5,null))[_0x51f1('0x43')](handleError(_0x327bc5,null));};exports[_0x51f1('0x4a')]=function(_0x97ce69,_0x8f2350){var _0x48a7b9={'where':{'id':_0x97ce69[_0x51f1('0x45')]['id']}},_0x5f5d63={};_0x5f5d63['model']=_['keys'](db[_0x51f1('0x3e')][_0x51f1('0x2d')]);_0x48a7b9[_0x51f1('0x34')]=_[_0x51f1('0x33')](_0x5f5d63['model'],qs[_0x51f1('0x47')](_0x97ce69[_0x51f1('0x32')][_0x51f1('0x47')]));_0x48a7b9[_0x51f1('0x34')]=_0x48a7b9[_0x51f1('0x34')]['length']?_0x48a7b9['attributes']:_0x5f5d63[_0x51f1('0x31')];if(_0x97ce69[_0x51f1('0x32')][_0x51f1('0x48')]){_0x48a7b9['include']=[{'all':!![]}];}_0x48a7b9=_[_0x51f1('0x3b')]({},_0x48a7b9,_0x97ce69['options']);return db[_0x51f1('0x3e')][_0x51f1('0x49')](_0x48a7b9)[_0x51f1('0x42')](handleEntityNotFound(_0x8f2350,null))['then'](function(_0x25cdba){if(_0x25cdba){var _0x22125f=_0x25cdba['get']({'plain':!![]});_0x22125f=qs[_0x51f1('0x4b')](_0x22125f,['id',_0x51f1('0x4c'),'updatedAt']);_0x97ce69[_0x51f1('0x4d')]=_[_0x51f1('0x4b')](_0x97ce69[_0x51f1('0x4d')],['id',_0x51f1('0x4c'),_0x51f1('0x4e')]);return db['Attachment'][_0x51f1('0x4f')](_[_0x51f1('0x3b')](_0x22125f,_0x97ce69[_0x51f1('0x4d')]),{'include':_0x97ce69[_0x51f1('0x32')][_0x51f1('0x48')]?[{'all':!![]}]:undefined});}})[_0x51f1('0x42')](respondWithResult(_0x8f2350,0xc9))[_0x51f1('0x43')](handleError(_0x8f2350,null));};exports[_0x51f1('0x25')]=function(_0x3b9778,_0x4fde1c){if(_0x3b9778['body']['id']){delete _0x3b9778[_0x51f1('0x4d')]['id'];}return db[_0x51f1('0x3e')][_0x51f1('0x49')]({'where':{'id':_0x3b9778[_0x51f1('0x45')]['id']}})[_0x51f1('0x42')](handleEntityNotFound(_0x4fde1c,null))[_0x51f1('0x42')](saveUpdates(_0x3b9778[_0x51f1('0x4d')],null))[_0x51f1('0x42')](respondWithResult(_0x4fde1c,null))[_0x51f1('0x43')](handleError(_0x4fde1c,null));};exports[_0x51f1('0x26')]=function(_0x25e00a,_0x299d4c){return db[_0x51f1('0x3e')][_0x51f1('0x49')]({'where':{'id':_0x25e00a['params']['id']}})[_0x51f1('0x42')](handleEntityNotFound(_0x299d4c,null))[_0x51f1('0x42')](removeEntity(_0x299d4c,null))[_0x51f1('0x43')](handleError(_0x299d4c,null));};exports['create']=function(_0x49ae95,_0x4ca370,_0x56bc0e){_0x49ae95[_0x51f1('0x4d')][_0x51f1('0x29')]=_0x49ae95[_0x51f1('0x50')]['originalname'];_0x49ae95[_0x51f1('0x4d')][_0x51f1('0x51')]=_0x49ae95['file'][_0x51f1('0x52')];_0x49ae95[_0x51f1('0x4d')][_0x51f1('0x2f')]=_0x49ae95[_0x51f1('0x50')][_0x51f1('0x53')];return db['Attachment'][_0x51f1('0x4f')](_0x49ae95[_0x51f1('0x4d')])['then'](respondWithResult(_0x4ca370,0xc9))[_0x51f1('0x43')](handleError(_0x4ca370,null));};exports[_0x51f1('0x54')]=function(_0x10ee77,_0x657336,_0x4e17de){return db['Attachment']['findOne']({'where':{'id':_0x10ee77[_0x51f1('0x45')]['id']},'raw':!![]})[_0x51f1('0x42')](handleEntityNotFound(_0x657336,null))[_0x51f1('0x42')](function(_0x1d3a3d){if(_0x1d3a3d){var _0x57ed2b=_0x1d3a3d['ChatOfflineMessageId']!==null;var _0x5622d5=path[_0x51f1('0x55')](config[_0x51f1('0x56')],_0x51f1('0x57'));if(_0x57ed2b){_0x5622d5=path[_0x51f1('0x55')](_0x5622d5,_0x51f1('0x58'));}var _0x58d28d=path[_0x51f1('0x55')](_0x5622d5,_0x1d3a3d['basename']);return _0x657336[_0x51f1('0x54')](_0x58d28d);}})['catch'](handleError(_0x657336,null));}; \ No newline at end of file +var _0x84c9=['download','findOne','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','find','clone','get','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype'];(function(_0x7b57c5,_0x17bc16){var _0x4ffd91=function(_0x1de674){while(--_0x1de674){_0x7b57c5['push'](_0x7b57c5['shift']());}};_0x4ffd91(++_0x17bc16);}(_0x84c9,0x10a));var _0x984c=function(_0x222c40,_0x2b281b){_0x222c40=_0x222c40-0x0;var _0x524522=_0x84c9[_0x222c40];return _0x524522;};'use strict';var emlformat=require(_0x984c('0x0'));var rimraf=require(_0x984c('0x1'));var zipdir=require(_0x984c('0x2'));var jsonpatch=require(_0x984c('0x3'));var rp=require(_0x984c('0x4'));var moment=require(_0x984c('0x5'));var BPromise=require(_0x984c('0x6'));var Mustache=require(_0x984c('0x7'));var util=require(_0x984c('0x8'));var path=require(_0x984c('0x9'));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(_0x984c('0xa'));var squel=require(_0x984c('0xb'));var crypto=require(_0x984c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x984c('0xd'));var querystring=require(_0x984c('0xe'));var Papa=require(_0x984c('0xf'));var Redis=require(_0x984c('0x10'));var authService=require(_0x984c('0x11'));var qs=require(_0x984c('0x12'));var as=require(_0x984c('0x13'));var hardwareService=require(_0x984c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x984c('0x15'));var config=require(_0x984c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x984c('0x17'))['db'];function respondWithStatusCode(_0x351016,_0xf60581){_0xf60581=_0xf60581||0xcc;return function(_0x502e22){if(_0x502e22){return _0x351016[_0x984c('0x18')](_0xf60581);}return _0x351016['status'](_0xf60581)[_0x984c('0x19')]();};}function respondWithResult(_0x56ea19,_0x36fc05){_0x36fc05=_0x36fc05||0xc8;return function(_0x58188b){if(_0x58188b){return _0x56ea19[_0x984c('0x1a')](_0x36fc05)['json'](_0x58188b);}};}function respondWithFilteredResult(_0x132bb9,_0x1ed220){return function(_0x52241b){if(_0x52241b){var _0x1b8ac0=typeof _0x1ed220[_0x984c('0x1b')]==='undefined'&&typeof _0x1ed220[_0x984c('0x1c')]===_0x984c('0x1d');var _0x232e69=_0x52241b[_0x984c('0x1e')];var _0x4e7e60=_0x1b8ac0?0x0:_0x1ed220['offset'];var _0x3cb437=_0x1b8ac0?_0x52241b[_0x984c('0x1e')]:_0x1ed220['offset']+_0x1ed220['limit'];var _0x28f5b9;if(_0x3cb437>=_0x232e69){_0x3cb437=_0x232e69;_0x28f5b9=0xc8;}else{_0x28f5b9=0xce;}_0x132bb9[_0x984c('0x1a')](_0x28f5b9);return _0x132bb9['set'](_0x984c('0x1f'),_0x4e7e60+'-'+_0x3cb437+'/'+_0x232e69)['json'](_0x52241b);}return null;};}function patchUpdates(_0x442b65){return function(_0x438bc5){try{jsonpatch['apply'](_0x438bc5,_0x442b65,!![]);}catch(_0x53caa9){return BPromise[_0x984c('0x20')](_0x53caa9);}return _0x438bc5[_0x984c('0x21')]();};}function saveUpdates(_0xeaf932,_0x93f304){return function(_0x57aa66){if(_0x57aa66){return _0x57aa66[_0x984c('0x22')](_0xeaf932)[_0x984c('0x23')](function(_0x1de130){return _0x1de130;});}return null;};}function removeEntity(_0x23084a,_0x1f3725){return function(_0x51eda8){if(_0x51eda8){return _0x51eda8[_0x984c('0x24')]()[_0x984c('0x23')](function(){_0x23084a[_0x984c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137cf2,_0x9a621){return function(_0x1ee9aa){if(!_0x1ee9aa){_0x137cf2[_0x984c('0x18')](0x194);}return _0x1ee9aa;};}function handleError(_0x999654,_0x4b549b){_0x4b549b=_0x4b549b||0x1f4;return function(_0x4df880){logger[_0x984c('0x25')](_0x4df880[_0x984c('0x26')]);if(_0x4df880[_0x984c('0x27')]){delete _0x4df880[_0x984c('0x27')];}_0x999654[_0x984c('0x1a')](_0x4b549b)[_0x984c('0x28')](_0x4df880);};}exports[_0x984c('0x29')]=function(_0x316b13,_0x420875){var _0x5ee099={},_0x307948={},_0x395f2a={'count':0x0,'rows':[]};var _0xbf8b96=_[_0x984c('0x2a')](db[_0x984c('0x2b')][_0x984c('0x2c')],function(_0xd59fd1){return{'name':_0xd59fd1[_0x984c('0x2d')],'type':_0xd59fd1[_0x984c('0x2e')][_0x984c('0x2f')]};});_0x307948[_0x984c('0x30')]=_[_0x984c('0x2a')](_0xbf8b96,'name');_0x307948[_0x984c('0x31')]=_[_0x984c('0x32')](_0x316b13[_0x984c('0x31')]);_0x307948['filters']=_[_0x984c('0x33')](_0x307948[_0x984c('0x30')],_0x307948[_0x984c('0x31')]);_0x5ee099[_0x984c('0x34')]=_[_0x984c('0x33')](_0x307948['model'],qs[_0x984c('0x35')](_0x316b13[_0x984c('0x31')][_0x984c('0x35')]));_0x5ee099['attributes']=_0x5ee099['attributes']['length']?_0x5ee099[_0x984c('0x34')]:_0x307948[_0x984c('0x30')];if(!_0x316b13[_0x984c('0x31')][_0x984c('0x36')]('nolimit')){_0x5ee099[_0x984c('0x1c')]=qs[_0x984c('0x1c')](_0x316b13[_0x984c('0x31')][_0x984c('0x1c')]);_0x5ee099[_0x984c('0x1b')]=qs[_0x984c('0x1b')](_0x316b13['query'][_0x984c('0x1b')]);}_0x5ee099[_0x984c('0x37')]=qs[_0x984c('0x38')](_0x316b13[_0x984c('0x31')][_0x984c('0x38')]);_0x5ee099[_0x984c('0x39')]=qs[_0x984c('0x3a')](_['pick'](_0x316b13['query'],_0x307948[_0x984c('0x3a')]),_0xbf8b96);if(_0x316b13[_0x984c('0x31')][_0x984c('0x3b')]){_0x5ee099[_0x984c('0x39')]=_['merge'](_0x5ee099[_0x984c('0x39')],{'$or':_[_0x984c('0x2a')](_0xbf8b96,function(_0x472c7c){if(_0x472c7c[_0x984c('0x2e')]!==_0x984c('0x3c')){var _0x111bbc={};_0x111bbc[_0x472c7c[_0x984c('0x27')]]={'$like':'%'+_0x316b13[_0x984c('0x31')]['filter']+'%'};return _0x111bbc;}})});}_0x5ee099=_[_0x984c('0x3d')]({},_0x5ee099,_0x316b13[_0x984c('0x3e')]);var _0x53bfd4={'where':_0x5ee099[_0x984c('0x39')]};return db['Attachment']['count'](_0x53bfd4)[_0x984c('0x23')](function(_0x4fb4fe){_0x395f2a[_0x984c('0x1e')]=_0x4fb4fe;if(_0x316b13[_0x984c('0x31')][_0x984c('0x3f')]){_0x5ee099[_0x984c('0x40')]=[{'all':!![]}];}return db[_0x984c('0x2b')][_0x984c('0x41')](_0x5ee099);})[_0x984c('0x23')](function(_0x154311){_0x395f2a[_0x984c('0x42')]=_0x154311;return _0x395f2a;})[_0x984c('0x23')](respondWithFilteredResult(_0x420875,_0x5ee099))[_0x984c('0x43')](handleError(_0x420875,null));};exports['show']=function(_0x3533fa,_0x1efc0c){var _0x11d7d7={'raw':!![],'where':{'id':_0x3533fa[_0x984c('0x44')]['id']}},_0x4923b7={};_0x4923b7['model']=_[_0x984c('0x32')](db['Attachment'][_0x984c('0x2c')]);_0x4923b7['query']=_['keys'](_0x3533fa['query']);_0x4923b7[_0x984c('0x3a')]=_[_0x984c('0x33')](_0x4923b7[_0x984c('0x30')],_0x4923b7[_0x984c('0x31')]);_0x11d7d7[_0x984c('0x34')]=_[_0x984c('0x33')](_0x4923b7[_0x984c('0x30')],qs[_0x984c('0x35')](_0x3533fa[_0x984c('0x31')]['fields']));_0x11d7d7['attributes']=_0x11d7d7['attributes'][_0x984c('0x45')]?_0x11d7d7['attributes']:_0x4923b7[_0x984c('0x30')];if(_0x3533fa['query']['includeAll']){_0x11d7d7['include']=[{'all':!![]}];}_0x11d7d7=_[_0x984c('0x3d')]({},_0x11d7d7,_0x3533fa[_0x984c('0x3e')]);return db[_0x984c('0x2b')][_0x984c('0x46')](_0x11d7d7)['then'](handleEntityNotFound(_0x1efc0c,null))[_0x984c('0x23')](respondWithResult(_0x1efc0c,null))[_0x984c('0x43')](handleError(_0x1efc0c,null));};exports[_0x984c('0x47')]=function(_0x24cf93,_0x37cd65){var _0x23029c={'where':{'id':_0x24cf93[_0x984c('0x44')]['id']}},_0x523902={};_0x523902['model']=_[_0x984c('0x32')](db[_0x984c('0x2b')][_0x984c('0x2c')]);_0x23029c[_0x984c('0x34')]=_[_0x984c('0x33')](_0x523902[_0x984c('0x30')],qs[_0x984c('0x35')](_0x24cf93[_0x984c('0x31')][_0x984c('0x35')]));_0x23029c[_0x984c('0x34')]=_0x23029c[_0x984c('0x34')]['length']?_0x23029c[_0x984c('0x34')]:_0x523902[_0x984c('0x30')];if(_0x24cf93[_0x984c('0x31')][_0x984c('0x3f')]){_0x23029c['include']=[{'all':!![]}];}_0x23029c=_[_0x984c('0x3d')]({},_0x23029c,_0x24cf93[_0x984c('0x3e')]);return db[_0x984c('0x2b')]['find'](_0x23029c)['then'](handleEntityNotFound(_0x37cd65,null))['then'](function(_0x224152){if(_0x224152){var _0x3e4843=_0x224152[_0x984c('0x48')]({'plain':!![]});_0x3e4843=qs['omit'](_0x3e4843,['id',_0x984c('0x49'),_0x984c('0x4a')]);_0x24cf93['body']=_['omit'](_0x24cf93[_0x984c('0x4b')],['id',_0x984c('0x49'),_0x984c('0x4a')]);return db[_0x984c('0x2b')][_0x984c('0x4c')](_[_0x984c('0x3d')](_0x3e4843,_0x24cf93[_0x984c('0x4b')]),{'include':_0x24cf93[_0x984c('0x31')][_0x984c('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x37cd65,0xc9))[_0x984c('0x43')](handleError(_0x37cd65,null));};exports[_0x984c('0x22')]=function(_0x1ef75f,_0x16bcd1){if(_0x1ef75f[_0x984c('0x4b')]['id']){delete _0x1ef75f['body']['id'];}return db[_0x984c('0x2b')][_0x984c('0x46')]({'where':{'id':_0x1ef75f[_0x984c('0x44')]['id']}})[_0x984c('0x23')](handleEntityNotFound(_0x16bcd1,null))[_0x984c('0x23')](saveUpdates(_0x1ef75f[_0x984c('0x4b')],null))[_0x984c('0x23')](respondWithResult(_0x16bcd1,null))[_0x984c('0x43')](handleError(_0x16bcd1,null));};exports[_0x984c('0x24')]=function(_0x5dd441,_0x27a4ec){return db[_0x984c('0x2b')][_0x984c('0x46')]({'where':{'id':_0x5dd441['params']['id']}})['then'](handleEntityNotFound(_0x27a4ec,null))[_0x984c('0x23')](removeEntity(_0x27a4ec,null))[_0x984c('0x43')](handleError(_0x27a4ec,null));};exports[_0x984c('0x4c')]=function(_0x2bfdb4,_0x123c57,_0x4eafbc){_0x2bfdb4[_0x984c('0x4b')][_0x984c('0x27')]=_0x2bfdb4[_0x984c('0x4d')][_0x984c('0x4e')];_0x2bfdb4[_0x984c('0x4b')][_0x984c('0x4f')]=_0x2bfdb4[_0x984c('0x4d')][_0x984c('0x50')];_0x2bfdb4[_0x984c('0x4b')][_0x984c('0x2e')]=_0x2bfdb4[_0x984c('0x4d')][_0x984c('0x51')];return db[_0x984c('0x2b')]['create'](_0x2bfdb4[_0x984c('0x4b')])[_0x984c('0x23')](respondWithResult(_0x123c57,0xc9))[_0x984c('0x43')](handleError(_0x123c57,null));};exports[_0x984c('0x52')]=function(_0x5aab4e,_0x34caac,_0x35d03c){return db[_0x984c('0x2b')][_0x984c('0x53')]({'where':{'id':_0x5aab4e[_0x984c('0x44')]['id']},'raw':!![]})[_0x984c('0x23')](handleEntityNotFound(_0x34caac,null))[_0x984c('0x23')](function(_0x5cac02){if(_0x5cac02){var _0x238e1c=_0x5cac02['ChatOfflineMessageId']!==null;var _0x472bc9=path[_0x984c('0x54')](config['root'],_0x984c('0x55'));if(_0x238e1c){_0x472bc9=path[_0x984c('0x54')](_0x472bc9,_0x984c('0x56'));}var _0x211b40=path[_0x984c('0x54')](_0x472bc9,_0x5cac02[_0x984c('0x4f')]);return _0x34caac[_0x984c('0x52')](_0x211b40);}})[_0x984c('0x43')](handleError(_0x34caac,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 250227e..b0d36bb 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 _0xd10f=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','Attachment','attachments','lodash'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xd10f,0x6b));var _0xfd10=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd10f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var logger=require(_0xfd10('0x2'))(_0xfd10('0x3'));var moment=require('moment');var BPromise=require(_0xfd10('0x4'));var rp=require(_0xfd10('0x5'));var fs=require('fs');var path=require(_0xfd10('0x6'));var rimraf=require(_0xfd10('0x7'));var config=require('../../config/environment');var attributes=require(_0xfd10('0x8'));module[_0xfd10('0x9')]=function(_0x2bef22,_0x41f8e1){return _0x2bef22['define'](_0xfd10('0xa'),attributes,{'tableName':_0xfd10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0c0=['bluebird','request-promise','path','rimraf','./attachment.attributes','exports','Attachment','attachments','util','../../config/logger','api','moment'];(function(_0x556029,_0x4a8914){var _0xcabb99=function(_0x220e59){while(--_0x220e59){_0x556029['push'](_0x556029['shift']());}};_0xcabb99(++_0x4a8914);}(_0xf0c0,0xd4));var _0x0f0c=function(_0x30eb0d,_0x353f0e){_0x30eb0d=_0x30eb0d-0x0;var _0x56dd12=_0xf0c0[_0x30eb0d];return _0x56dd12;};'use strict';var _=require('lodash');var util=require(_0x0f0c('0x0'));var logger=require(_0x0f0c('0x1'))(_0x0f0c('0x2'));var moment=require(_0x0f0c('0x3'));var BPromise=require(_0x0f0c('0x4'));var rp=require(_0x0f0c('0x5'));var fs=require('fs');var path=require(_0x0f0c('0x6'));var rimraf=require(_0x0f0c('0x7'));var config=require('../../config/environment');var attributes=require(_0x0f0c('0x8'));module[_0x0f0c('0x9')]=function(_0x4887fc,_0xd053e6){return _0x4887fc['define'](_0x0f0c('0xa'),attributes,{'tableName':_0x0f0c('0xb'),'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 e9716c8..137de87 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0bc=['options','raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','create','body'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var moment=require(_0xca0b('0x1'));var BPromise=require('bluebird');var rs=require(_0xca0b('0x2'));var fs=require('fs');var Redis=require(_0xca0b('0x3'));var db=require(_0xca0b('0x4'))['db'];var utils=require(_0xca0b('0x5'));var logger=require(_0xca0b('0x6'))(_0xca0b('0x7'));var config=require(_0xca0b('0x8'));var jayson=require(_0xca0b('0x9'));var client=jayson[_0xca0b('0xa')][_0xca0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbe64c7,_0x30202d,_0xa506a4){return new BPromise(function(_0x19acc2,_0x55a1de){return client[_0xca0b('0xc')](_0xbe64c7,_0xa506a4)[_0xca0b('0xd')](function(_0x3e3909){logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));logger['debug'](_0xca0b('0x11'),_0x30202d,_0xca0b('0x10'),JSON[_0xca0b('0x12')](_0x3e3909));if(_0x3e3909[_0xca0b('0x13')]){if(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x14')]===0x1f4){logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);return _0x55a1de(_0x3e3909['error'][_0xca0b('0x15')]);}logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909['error'][_0xca0b('0x15')]);return _0x19acc2(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);}else{logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));_0x19acc2(_0x3e3909['result'][_0xca0b('0x15')]);}})[_0xca0b('0x16')](function(_0x4d9b16){logger[_0xca0b('0x13')]('Attachment,\x20%s,\x20%s',_0x30202d,_0x4d9b16);_0x55a1de(_0x4d9b16);});});}exports[_0xca0b('0x17')]=function(_0x5050b7){var _0x236503=this;return new Promise(function(_0x32eff7,_0x97be82){return db['Attachment'][_0xca0b('0x18')](_0x5050b7[_0xca0b('0x19')],{'raw':_0x5050b7['options']?_0x5050b7[_0xca0b('0x1a')][_0xca0b('0x1b')]===undefined?!![]:![]:!![]})[_0xca0b('0xd')](function(_0x59bda9){logger[_0xca0b('0xe')](_0xca0b('0x17'),_0x5050b7);logger[_0xca0b('0x1c')](_0xca0b('0x17'),_0x5050b7,JSON[_0xca0b('0x12')](_0x59bda9));_0x32eff7(_0x59bda9);})[_0xca0b('0x16')](function(_0x49e695){logger[_0xca0b('0x13')](_0xca0b('0x17'),_0x49e695[_0xca0b('0x15')],_0x5050b7);_0x97be82(_0x236503['error'](0x1f4,_0x49e695['message']));});});}; \ No newline at end of file +var _0x94dc=['raw','CreateAttachment','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options'];(function(_0x1f109c,_0xd9952e){var _0x3984e8=function(_0x40b60b){while(--_0x40b60b){_0x1f109c['push'](_0x1f109c['shift']());}};_0x3984e8(++_0xd9952e);}(_0x94dc,0xb1));var _0xc94d=function(_0x25a4d7,_0x4c7831){_0x25a4d7=_0x25a4d7-0x0;var _0x15a867=_0x94dc[_0x25a4d7];return _0x15a867;};'use strict';var _=require(_0xc94d('0x0'));var util=require('util');var moment=require(_0xc94d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc94d('0x2'));var fs=require('fs');var Redis=require(_0xc94d('0x3'));var db=require(_0xc94d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94d('0x5'))(_0xc94d('0x6'));var config=require(_0xc94d('0x7'));var jayson=require(_0xc94d('0x8'));var client=jayson[_0xc94d('0x9')][_0xc94d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7275c,_0x5776ab,_0x2f9757){return new BPromise(function(_0xbe5904,_0x15265c){return client[_0xc94d('0xb')](_0xb7275c,_0x2f9757)[_0xc94d('0xc')](function(_0x579245){logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));logger[_0xc94d('0x10')](_0xc94d('0x11'),_0x5776ab,_0xc94d('0xf'),JSON['stringify'](_0x579245));if(_0x579245[_0xc94d('0x12')]){if(_0x579245[_0xc94d('0x12')][_0xc94d('0x13')]===0x1f4){logger[_0xc94d('0x12')]('Attachment,\x20%s,\x20%s',_0x5776ab,_0x579245['error']['message']);return _0x15265c(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}logger[_0xc94d('0x12')](_0xc94d('0xe'),_0x5776ab,_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);return _0xbe5904(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}else{logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));_0xbe5904(_0x579245[_0xc94d('0x15')][_0xc94d('0x14')]);}})[_0xc94d('0x16')](function(_0x19508d){logger['error']('Attachment,\x20%s,\x20%s',_0x5776ab,_0x19508d);_0x15265c(_0x19508d);});});}exports['CreateAttachment']=function(_0x48b879){var _0x345259=this;return new Promise(function(_0x4784a2,_0x4f7287){return db['Attachment'][_0xc94d('0x17')](_0x48b879[_0xc94d('0x18')],{'raw':_0x48b879['options']?_0x48b879[_0xc94d('0x19')][_0xc94d('0x1a')]===undefined?!![]:![]:!![]})[_0xc94d('0xc')](function(_0xb5c1fd){logger[_0xc94d('0xd')](_0xc94d('0x1b'),_0x48b879);logger[_0xc94d('0x10')](_0xc94d('0x1b'),_0x48b879,JSON[_0xc94d('0x1c')](_0xb5c1fd));_0x4784a2(_0xb5c1fd);})[_0xc94d('0x16')](function(_0x5f2820){logger[_0xc94d('0x12')](_0xc94d('0x1b'),_0x5f2820[_0xc94d('0x14')],_0x48b879);_0x4f7287(_0x345259[_0xc94d('0x12')](0x1f4,_0x5f2820[_0xc94d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 08192d0..69e1333 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x3baad0,_0x5a76fc){var _0x33651d=function(_0x36561c){while(--_0x36561c){_0x3baad0['push'](_0x3baad0['shift']());}};_0x33651d(++_0x5a76fc);}(_0x757a,0xde));var _0xa757=function(_0x454b26,_0x29e187){_0x454b26=_0x454b26-0x0;var _0x3f3121=_0x757a[_0x454b26];return _0x3f3121;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _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(_0x11ec18,_0x5cb448){var _0x340864=function(_0x4ee3a3){while(--_0x4ee3a3){_0x11ec18['push'](_0x11ec18['shift']());}};_0x340864(++_0x5cb448);}(_0xadb5,0xad));var _0x5adb=function(_0x4c4261,_0x44b126){_0x4c4261=_0x4c4261-0x0;var _0x4bed3d=_0xadb5[_0x4c4261];return _0x4bed3d;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3cc802f..b718945 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 _0xde7f=['blocked','blockedAt','online','agent','blockDuration','add','clearBlockUser','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','use','moment','activedirectory2','util','api','undefined','activedirectory','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','name','password','salt','disabled'];(function(_0xcd7a10,_0x59b6cd){var _0x4dd6cb=function(_0x4bd6bc){while(--_0x4bd6bc){_0xcd7a10['push'](_0xcd7a10['shift']());}};_0x4dd6cb(++_0x59b6cd);}(_0xde7f,0x1f0));var _0xfde7=function(_0xe11d55,_0xf10bdf){_0xe11d55=_0xe11d55-0x0;var _0x2087cb=_0xde7f[_0xe11d55];return _0x2087cb;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xfde7('0x0'));var ActiveDirectory=require(_0xfde7('0x1'));var BPromise=require('bluebird');var util=require(_0xfde7('0x2'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xfde7('0x3'));function isActiveDirectoryConfigured(_0x2c6045){var _0x15c7f5=![];if(typeof _0x2c6045['activedirectory']!==_0xfde7('0x4')){_0x15c7f5=_0x2c6045[_0xfde7('0x5')]['baseDN']&&_0x2c6045[_0xfde7('0x5')][_0xfde7('0x6')]&&_0x2c6045[_0xfde7('0x5')]['domain'];}return _0x15c7f5;}function adAuthenticate(_0x1aeae4,_0x3b7df5,_0x1914b4){return new BPromise(function(_0x1cf57e,_0x4c440e){try{var _0x387f0d=new ActiveDirectory(_0x1aeae4);_0x387f0d[_0xfde7('0x7')](_0x3b7df5,_0x1914b4,function(_0x317b89,_0x32016a){if(_0x317b89){logger[_0xfde7('0x8')](_0xfde7('0x9'),_0x3b7df5,util[_0xfde7('0xa')](_0x317b89,{'showHidden':![],'depth':null}));_0x4c440e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x32016a){logger['error'](_0xfde7('0xb'),_0x3b7df5);_0x4c440e(_0xfde7('0xc'));}else{_0x1cf57e(_0x32016a);}});}catch(_0x33a664){_0x4c440e(_0x33a664);}});}function ActiveDirectoryAuthenticate(_0x352ded,_0xe7097c,_0x36d637,_0x5af4a8){var _0xb19ec2,_0x3edbfc;if(!isActiveDirectoryConfigured(config)){logger[_0xfde7('0x8')](_0xfde7('0xd'),_0xe7097c);return _0x5af4a8(null,![],{'message':_0xfde7('0xc')});}return db[_0xfde7('0xe')][_0xfde7('0xf')]({'where':{'id':0x1},'attributes':[_0xfde7('0x10'),'blockDuration'],'raw':!![]})[_0xfde7('0x11')](function(_0x10d007){_0xb19ec2=_0x10d007;if(!_0xb19ec2['adSsoEnabled']){logger[_0xfde7('0x8')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0xe7097c);throw new Error(_0xfde7('0xc'));}return _0x352ded[_0xfde7('0xf')]({'attributes':['id',_0xfde7('0x12'),_0xfde7('0x13'),_0xfde7('0x14'),'role',_0xfde7('0x15'),_0xfde7('0x16'),_0xfde7('0x17'),_0xfde7('0x18')],'where':{'name':_0xe7097c,'role':{'$or':['admin','user',_0xfde7('0x19')]},'adSsoEnabled':!![]}});})['then'](function(_0x727546){if(!_0x727546||_0x727546&&_0x727546[_0xfde7('0x12')]!==_0xe7097c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x3edbfc=_0x727546;var _0x35cf7f=_0x3edbfc[_0xfde7('0x12')]+'@'+config[_0xfde7('0x5')]['domain'];return adAuthenticate(config['activedirectory'],_0x35cf7f,_0x36d637);})[_0xfde7('0x11')](function(_0x27ed39){if(_0x3edbfc[_0xfde7('0x15')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0xb19ec2[_0xfde7('0x1a')]>0x0){if(_0x3edbfc['blocked']){if(moment(_0x3edbfc['blockedAt'])[_0xfde7('0x1b')](_0xb19ec2[_0xfde7('0x1a')],'minutes')>moment()){throw new Error(_0xfde7('0xc'));}return utils[_0xfde7('0x1c')](_0x3edbfc,0x0,![],null)[_0xfde7('0x11')](function(){return utils[_0xfde7('0x1d')](_0x3edbfc);})[_0xfde7('0x11')](function(){return _0x5af4a8(null,_0x3edbfc);});}else{return utils[_0xfde7('0x1d')](_0x3edbfc)['then'](function(){return _0x5af4a8(null,_0x3edbfc);});}}else{return utils[_0xfde7('0x1d')](_0x3edbfc)[_0xfde7('0x11')](function(){return _0x5af4a8(null,_0x3edbfc);});}})['catch'](function(_0x576a0c){return _0x5af4a8(null,![],_0x576a0c);});}function handleError(_0x1ae353,_0x11fb12,_0x394017){return _0x1ae353[_0xfde7('0x1e')](_0x11fb12||0x1f4)[_0xfde7('0x1f')]({'message':_0x394017?_0x394017[_0xfde7('0x20')]||_0x394017:''});}exports['login']=function(_0x494ab5,_0x1190e4,_0x2a9ea8){passport[_0xfde7('0x7')](_0xfde7('0x21'),function(_0x460981,_0x113a1e,_0x219008){var _0x440daf=_0x460981||_0x219008;if(_0x440daf){return handleError(_0x1190e4,0x191,_0x440daf);}if(!_0x113a1e){return handleError(_0x1190e4,0x194,{'message':_0xfde7('0x22')});}else{var _0x5a38a8={'payload':{'id':_0x113a1e['id'],'role':_0x113a1e[_0xfde7('0x23')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5a38a8)[_0xfde7('0x11')](function(_0x3ee1e4){_0x1190e4['json']({'id':_0x113a1e['id'],'token':_0x3ee1e4,'statusCall':'','isAlreadyLogged':_0x113a1e['online']});});}})(_0x494ab5,_0x1190e4,_0x2a9ea8);};passport[_0xfde7('0x24')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x512dfb,_0xe01162,_0x1ad046){return ActiveDirectoryAuthenticate(db['User'],_0x512dfb,_0xe01162,_0x1ad046);})); \ No newline at end of file +var _0x278b=['domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','findOne','password','salt','disabled','blocked','blockedAt','online','admin','agent','name','add','minutes','clearBlockUser','getLicense','catch','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','use','ad-login','User','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','undefined','activedirectory','baseDN','url'];(function(_0x36a94d,_0x378fef){var _0x196903=function(_0xa2b762){while(--_0xa2b762){_0x36a94d['push'](_0x36a94d['shift']());}};_0x196903(++_0x378fef);}(_0x278b,0xec));var _0xb278=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x278b[_0x297eea];return _0x1c42d2;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xb278('0x0'))[_0xb278('0x1')];var moment=require(_0xb278('0x2'));var ActiveDirectory=require(_0xb278('0x3'));var BPromise=require(_0xb278('0x4'));var util=require('util');var db=require(_0xb278('0x5'))['db'];var authService=require(_0xb278('0x6'));var utils=require(_0xb278('0x7'));var config=require(_0xb278('0x8'));var logger=require('../../config/logger')(_0xb278('0x9'));function isActiveDirectoryConfigured(_0x189349){var _0x2fe156=![];if(typeof _0x189349['activedirectory']!==_0xb278('0xa')){_0x2fe156=_0x189349[_0xb278('0xb')][_0xb278('0xc')]&&_0x189349[_0xb278('0xb')][_0xb278('0xd')]&&_0x189349[_0xb278('0xb')][_0xb278('0xe')];}return _0x2fe156;}function adAuthenticate(_0xb2ab92,_0x21626f,_0x32a974){return new BPromise(function(_0x4df156,_0x19a8d9){try{var _0x30d31c=new ActiveDirectory(_0xb2ab92);_0x30d31c[_0xb278('0xf')](_0x21626f,_0x32a974,function(_0x47ebf5,_0x2c94a0){if(_0x47ebf5){logger[_0xb278('0x10')](_0xb278('0x11'),_0x21626f,util[_0xb278('0x12')](_0x47ebf5,{'showHidden':![],'depth':null}));_0x19a8d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x2c94a0){logger[_0xb278('0x10')](_0xb278('0x13'),_0x21626f);_0x19a8d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4df156(_0x2c94a0);}});}catch(_0x41fa91){_0x19a8d9(_0x41fa91);}});}function ActiveDirectoryAuthenticate(_0x287d4d,_0x2a7733,_0x38e25c,_0x55035f){var _0x24e397,_0x1eafc6;if(!isActiveDirectoryConfigured(config)){logger[_0xb278('0x10')](_0xb278('0x14'),_0x2a7733);return _0x55035f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb278('0x15')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xb278('0x16')],'raw':!![]})[_0xb278('0x17')](function(_0x97a1bd){_0x24e397=_0x97a1bd;if(!_0x24e397[_0xb278('0x18')]){logger[_0xb278('0x10')](_0xb278('0x19'),_0x2a7733);throw new Error(_0xb278('0x1a'));}return _0x287d4d[_0xb278('0x1b')]({'attributes':['id','name',_0xb278('0x1c'),_0xb278('0x1d'),'role',_0xb278('0x1e'),_0xb278('0x1f'),_0xb278('0x20'),_0xb278('0x21')],'where':{'name':_0x2a7733,'role':{'$or':[_0xb278('0x22'),'user',_0xb278('0x23')]},'adSsoEnabled':!![]}});})[_0xb278('0x17')](function(_0x1fbf33){if(!_0x1fbf33||_0x1fbf33&&_0x1fbf33[_0xb278('0x24')]!==_0x2a7733){throw new Error(_0xb278('0x1a'));}_0x1eafc6=_0x1fbf33;var _0x2b63d0=_0x1eafc6['name']+'@'+config[_0xb278('0xb')][_0xb278('0xe')];return adAuthenticate(config[_0xb278('0xb')],_0x2b63d0,_0x38e25c);})[_0xb278('0x17')](function(_0x5600e5){if(_0x1eafc6[_0xb278('0x1e')]){throw new Error(_0xb278('0x1a'));}if(_0x24e397[_0xb278('0x16')]>0x0){if(_0x1eafc6[_0xb278('0x1f')]){if(moment(_0x1eafc6['blockedAt'])[_0xb278('0x25')](_0x24e397[_0xb278('0x16')],_0xb278('0x26'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xb278('0x27')](_0x1eafc6,0x0,![],null)[_0xb278('0x17')](function(){return utils[_0xb278('0x28')](_0x1eafc6);})[_0xb278('0x17')](function(){return _0x55035f(null,_0x1eafc6);});}else{return utils[_0xb278('0x28')](_0x1eafc6)[_0xb278('0x17')](function(){return _0x55035f(null,_0x1eafc6);});}}else{return utils[_0xb278('0x28')](_0x1eafc6)[_0xb278('0x17')](function(){return _0x55035f(null,_0x1eafc6);});}})[_0xb278('0x29')](function(_0x3c1105){return _0x55035f(null,![],_0x3c1105);});}function handleError(_0x191d6a,_0x631191,_0x5fab7e){return _0x191d6a['status'](_0x631191||0x1f4)['send']({'message':_0x5fab7e?_0x5fab7e[_0xb278('0x2a')]||_0x5fab7e:''});}exports[_0xb278('0x2b')]=function(_0x135f3e,_0x1f11bb,_0x3cad1c){passport['authenticate']('ad-login',function(_0x5b4535,_0x4302f3,_0xeaa04e){var _0x10b231=_0x5b4535||_0xeaa04e;if(_0x10b231){return handleError(_0x1f11bb,0x191,_0x10b231);}if(!_0x4302f3){return handleError(_0x1f11bb,0x194,{'message':_0xb278('0x2c')});}else{var _0x5be92c={'payload':{'id':_0x4302f3['id'],'role':_0x4302f3[_0xb278('0x2d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5be92c)[_0xb278('0x17')](function(_0x370962){_0x1f11bb[_0xb278('0x2e')]({'id':_0x4302f3['id'],'token':_0x370962,'statusCall':'','isAlreadyLogged':_0x4302f3['online']});});}})(_0x135f3e,_0x1f11bb,_0x3cad1c);};passport[_0xb278('0x2f')](_0xb278('0x30'),new LocalStrategy({'usernameField':_0xb278('0x24'),'passwordField':_0xb278('0x1c')},function(_0x74be57,_0x3e4e6c,_0x539dff){return ActiveDirectoryAuthenticate(db[_0xb278('0x31')],_0x74be57,_0x3e4e6c,_0x539dff);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f15173a..080ec02 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 _0x508e=['Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x508e,0x1b8));var _0xe508=function(_0x58c1e0,_0x1b061a){_0x58c1e0=_0x58c1e0-0x0;var _0x5e8e0e=_0x508e[_0x58c1e0];return _0x5e8e0e;};'use strict';var express=require('express');var router=express[_0xe508('0x0')]();var controller=require(_0xe508('0x1'));router[_0xe508('0x2')]('/',controller[_0xe508('0x3')]);module[_0xe508('0x4')]=router; \ No newline at end of file +var _0x62f7=['express','./authActiveDirectory.controller','post','login'];(function(_0x5b6eb0,_0x11fe92){var _0x44e043=function(_0x3b5604){while(--_0x3b5604){_0x5b6eb0['push'](_0x5b6eb0['shift']());}};_0x44e043(++_0x11fe92);}(_0x62f7,0xf8));var _0x762f=function(_0x239b1b,_0x202928){_0x239b1b=_0x239b1b-0x0;var _0x5ca956=_0x62f7[_0x239b1b];return _0x5ca956;};'use strict';var express=require(_0x762f('0x0'));var router=express['Router']();var controller=require(_0x762f('0x1'));router[_0x762f('0x2')]('/',controller[_0x762f('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 e5e90ce..ed34a53 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(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7a54,0x106));var _0x47a5=function(_0x14e3fd,_0x37e13c){_0x14e3fd=_0x14e3fd-0x0;var _0x17befc=_0x7a54[_0x14e3fd];return _0x17befc;};'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 _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(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x7a54,0x106));var _0x47a5=function(_0x109421,_0x4099e9){_0x109421=_0x109421-0x0;var _0x354a83=_0x7a54[_0x109421];return _0x354a83;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2e749b2..ed39f3f 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 _0x20c0=['isMiddleware','login','passport','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x4c045d,_0x4f2995){var _0x1e381d=function(_0x184d8f){while(--_0x184d8f){_0x4c045d['push'](_0x4c045d['shift']());}};_0x1e381d(++_0x4f2995);}(_0x20c0,0x13d));var _0x020c=function(_0x4e0471,_0x4f1b1c){_0x4e0471=_0x4e0471-0x0;var _0x196d80=_0x20c0[_0x4e0471];return _0x196d80;};'use strict';var express=require('express');var passport=require(_0x020c('0x0'));var router=express[_0x020c('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x020c('0x2'));var authService=require(_0x020c('0x3'));router[_0x020c('0x4')]('/',controller['login']);router['get'](_0x020c('0x5'),controller[_0x020c('0x6')],authService[_0x020c('0x7')],userController[_0x020c('0x8')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xedd9=['isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback'];(function(_0x5b4f74,_0x14056d){var _0x36bfda=function(_0x2ba545){while(--_0x2ba545){_0x5b4f74['push'](_0x5b4f74['shift']());}};_0x36bfda(++_0x14056d);}(_0xedd9,0xfc));var _0x9edd=function(_0x38bbde,_0x56f68d){_0x38bbde=_0x38bbde-0x0;var _0x5cd713=_0xedd9[_0x38bbde];return _0x5cd713;};'use strict';var express=require('express');var passport=require(_0x9edd('0x0'));var router=express[_0x9edd('0x1')]();var controller=require(_0x9edd('0x2'));var userController=require(_0x9edd('0x3'));var authService=require(_0x9edd('0x4'));router[_0x9edd('0x5')]('/',controller[_0x9edd('0x6')]);router[_0x9edd('0x5')]('/callback',controller[_0x9edd('0x7')],authService[_0x9edd('0x8')],userController[_0x9edd('0x6')],authService[_0x9edd('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9f66c43..3ad3281 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 _0x96f3=['admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','add','clearBlockUser','blockedAt','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','email','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','send','login','signToken','json','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','use','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','loginAttempts'];(function(_0x2dc9b7,_0x45bf6f){var _0x5da719=function(_0x2930de){while(--_0x2930de){_0x2dc9b7['push'](_0x2dc9b7['shift']());}};_0x5da719(++_0x45bf6f);}(_0x96f3,0x8d));var _0x396f=function(_0x417059,_0x49da59){_0x417059=_0x417059-0x0;var _0x429c7b=_0x96f3[_0x417059];return _0x429c7b;};'use strict';var util=require(_0x396f('0x0'));var passport=require(_0x396f('0x1'));var LocalStrategy=require(_0x396f('0x2'))[_0x396f('0x3')];var jayson=require(_0x396f('0x4'));var _=require(_0x396f('0x5'));var rs=require('randomstring');var moment=require(_0x396f('0x6'));var db=require(_0x396f('0x7'))['db'];var authService=require(_0x396f('0x8'));var utils=require(_0x396f('0x9'));var client=jayson[_0x396f('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x50c466,_0x1c6467,_0x2d2806,_0x1503ad){var _0x596f76,_0x55045e;return db[_0x396f('0xb')][_0x396f('0xc')]({'where':{'id':0x1},'attributes':[_0x396f('0xd'),_0x396f('0xe')],'raw':!![]})[_0x396f('0xf')](function(_0x48ac72){_0x596f76=_0x48ac72;return _0x50c466[_0x396f('0xc')]({'attributes':['id',_0x396f('0x10'),_0x396f('0x11'),_0x396f('0x12'),_0x396f('0x13'),'disabled','blocked','blockedAt',_0x396f('0x14')],'where':{'name':_0x1c6467,'role':{'$or':[_0x396f('0x15'),_0x396f('0x16'),_0x396f('0x17')]}}});})[_0x396f('0xf')](function(_0x5a58e7){if(!_0x5a58e7||_0x5a58e7&&_0x5a58e7[_0x396f('0x10')]!==_0x1c6467){throw new Error(_0x396f('0x18'));}else{_0x55045e=_0x5a58e7;return _0x55045e;}})[_0x396f('0xf')](function(){_0x55045e[_0x396f('0x19')](_0x2d2806,function(_0x18d37f,_0x433aec){var _0x39306e=_0x55045e[_0x396f('0x14')]+0x1;if(_0x18d37f){return _0x1503ad(_0x18d37f);}else if(!_0x433aec){if(_0x55045e[_0x396f('0x1a')]){return _0x1503ad(null,![],{'message':_0x396f('0x18')});}else if(_0x596f76[_0x396f('0xd')]>0x0){if(_0x55045e[_0x396f('0x1b')]){if(_0x596f76['blockDuration']>0x0){if(moment(_0x55045e['blockedAt'])[_0x396f('0x1c')](_0x596f76[_0x396f('0xe')],'minutes')>moment()){return _0x1503ad(null,![],{'message':_0x396f('0x18')});}else{return utils[_0x396f('0x1d')](_0x55045e,_0x39306e,![],null)['then'](function(){return _0x1503ad(null,![],{'message':_0x396f('0x18')});});}}else{return _0x1503ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x39306e>=_0x596f76[_0x396f('0xd')]){return utils[_0x396f('0x1d')](_0x55045e,0x0,!![],moment())[_0x396f('0xf')](function(){return _0x1503ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x396f('0x1d')](_0x55045e,_0x39306e,![],null)[_0x396f('0xf')](function(){return _0x1503ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1503ad(null,![],{'message':_0x396f('0x18')});}}else{if(_0x55045e[_0x396f('0x1a')]){return _0x1503ad(null,![],{'message':_0x396f('0x18')});}else if(_0x596f76[_0x396f('0xd')]>0x0){if(_0x55045e[_0x396f('0x1b')]){if(_0x596f76[_0x396f('0xe')]>0x0){if(moment(_0x55045e[_0x396f('0x1e')])[_0x396f('0x1c')](_0x596f76[_0x396f('0xe')],_0x396f('0x1f'))>moment()){return _0x1503ad(null,![],{'message':_0x396f('0x18')});}else{return utils[_0x396f('0x1d')](_0x55045e,0x0,![],null)[_0x396f('0xf')](function(){return utils[_0x396f('0x20')](_0x55045e);})[_0x396f('0xf')](function(){return _0x1503ad(null,_0x55045e);});}}else{return _0x1503ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x396f('0x1d')](_0x55045e,0x0,![],null)[_0x396f('0xf')](function(){return utils[_0x396f('0x20')](_0x55045e);})[_0x396f('0xf')](function(){return _0x1503ad(null,_0x55045e);})['catch'](function(_0x5d6c20){return _0x1503ad(null,![],_0x5d6c20);});}}else{if(_0x55045e[_0x396f('0x1b')]){return _0x1503ad(null,![],{'message':_0x396f('0x18')});}else{return utils[_0x396f('0x20')](_0x55045e)['then'](function(){return _0x1503ad(null,_0x55045e);});}}}});})[_0x396f('0x21')](function(_0x127556){return _0x1503ad(null,![],_0x127556);});}function sendServiceMail(_0x5436b8){return db[_0x396f('0x22')][_0x396f('0x23')]({'where':{'service':!![]},'attributes':['id',_0x396f('0x10'),'email'],'include':[{'model':db[_0x396f('0x24')],'as':_0x396f('0x25'),'include':[{'model':db[_0x396f('0x26')],'as':'CloudProvider'}]}]})['then'](function(_0x47c538){if(!_0x47c538){throw new Error(_0x396f('0x27'));}var _0xd84683=_0x47c538['getSmtpOptions']();var _0x5531b7={'account':_0xd84683,'message':_['merge']({'from':util['format']('\x22%s\x22\x20<%s>',_0x47c538[_0x396f('0x10')],_0x47c538[_0x396f('0x28')]||_0x47c538[_0x396f('0x25')][_0x396f('0x16')])},_0x5436b8)};return client[_0x396f('0x29')](_0x396f('0x2a'),_0x5531b7);})[_0x396f('0xf')](function(_0x572754){if(_0x572754['error']){throw new Error(util[_0x396f('0x2b')](_0x396f('0x2c'),_0x572754[_0x396f('0x2d')][_0x396f('0x2e')]||JSON['stringify'](_0x572754[_0x396f('0x2d')])));}return!![];});}function handleError(_0xff8628,_0x591482,_0xc20eac){return _0xff8628[_0x396f('0x2f')](_0x591482||0x1f4)[_0x396f('0x30')]({'message':_0xc20eac?_0xc20eac[_0x396f('0x2e')]||_0xc20eac:''});}exports[_0x396f('0x31')]=function(_0x5038e3,_0x104e48,_0x15e330){passport[_0x396f('0x19')]('local-login',function(_0x4522e8,_0x136e4d,_0x9045b1){var _0x4ef281=_0x4522e8||_0x9045b1;if(_0x4ef281){return handleError(_0x104e48,0x191,_0x4ef281);}if(!_0x136e4d){return handleError(_0x104e48,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x232b26={'payload':{'id':_0x136e4d['id'],'role':_0x136e4d[_0x396f('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0x396f('0x32')](_0x232b26)[_0x396f('0xf')](function(_0xefc881){_0x104e48[_0x396f('0x33')]({'id':_0x136e4d['id'],'token':_0xefc881,'statusCall':'','isAlreadyLogged':_0x136e4d['online']});});}})(_0x5038e3,_0x104e48,_0x15e330);};exports['forgot']=function(_0x4e7f3b,_0x100f8e){if(!_0x4e7f3b['body'][_0x396f('0x28')]){return handleError(_0x100f8e,0x1f4,{'message':_0x396f('0x34')});}var _0x28f64e=rs[_0x396f('0x35')]();_0x4e7f3b['body'][_0x396f('0x28')]=_0x4e7f3b[_0x396f('0x36')]['email'][_0x396f('0x37')]()[_0x396f('0x38')]();var _0x19a69e;return db['Setting'][_0x396f('0xc')]({'where':{'id':0x1},'attributes':[_0x396f('0xd'),'blockDuration'],'raw':!![]})[_0x396f('0xf')](function(_0xbf97ae){_0x19a69e=_0xbf97ae;return db[_0x396f('0x39')][_0x396f('0x23')]({'where':{'email':_0x4e7f3b[_0x396f('0x36')]['email']}});})[_0x396f('0xf')](function(_0x42ce47){if(!_0x42ce47){throw new Error(_0x396f('0x3a'));}if(_0x42ce47['disabled']){throw new Error(_0x396f('0x3b'));}if(_0x42ce47['blocked']){if(moment(_0x42ce47[_0x396f('0x1e')])[_0x396f('0x1c')](_0x19a69e['blockDuration'],_0x396f('0x1f'))>moment()){throw new Error(_0x396f('0x3c'));}else{_0x42ce47[_0x396f('0x1b')]=![];_0x42ce47['blockedAt']=null;}}_0x42ce47['resetPasswordToken']=_0x28f64e;_0x42ce47[_0x396f('0x3d')]=Date[_0x396f('0x3e')]()+0x36ee80;return _0x42ce47[_0x396f('0x3f')]();})[_0x396f('0xf')](function(){return sendServiceMail({'to':_0x4e7f3b[_0x396f('0x36')][_0x396f('0x28')],'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'+_0x396f('0x40')+'https://'+_0x4e7f3b[_0x396f('0x41')]['host']+_0x396f('0x42')+_0x28f64e+'\x0a\x0a'+_0x396f('0x43')});})[_0x396f('0xf')](function(){_0x100f8e[_0x396f('0x2f')](0xc8)['send']({'message':_0x396f('0x44')});})[_0x396f('0x21')](function(_0x2414cc){return handleError(_0x100f8e,0x1f4,_0x2414cc);});};exports['reset']=function(_0x553b89,_0x18ae92){return db[_0x396f('0x39')][_0x396f('0x23')]({'where':{'resetPasswordToken':_0x553b89[_0x396f('0x45')][_0x396f('0x46')],'resetPasswordExpires':{'$gt':Date[_0x396f('0x3e')]()}}})[_0x396f('0xf')](function(_0x39395b){if(!_0x39395b){throw new Error(_0x396f('0x47'));}return db['Setting'][_0x396f('0xc')]({'attributes':['id',_0x396f('0x48'),'enforcePasswordHistory',_0x396f('0x49')]})[_0x396f('0xf')](function(_0x4f79db){if(_0x4f79db[_0x396f('0x48')])authService[_0x396f('0x4a')](_0x553b89[_0x396f('0x36')][_0x396f('0x11')]);if(!_0x4f79db[_0x396f('0x4b')]||!_0x39395b['previousPasswords'])return _0x39395b;authService[_0x396f('0x4c')](_0x553b89[_0x396f('0x36')][_0x396f('0x11')],_0x39395b[_0x396f('0x4d')],_0x4f79db[_0x396f('0x49')]);return _0x39395b;})[_0x396f('0xf')](function(){_0x39395b['password']=_0x553b89['body'][_0x396f('0x11')];_0x39395b['resetPasswordToken']=null;_0x39395b['resetPasswordExpires']=null;return _0x39395b[_0x396f('0x3f')]();});})[_0x396f('0xf')](function(){_0x18ae92[_0x396f('0x2f')](0xc8)[_0x396f('0x30')]({'message':_0x396f('0x4e')});})[_0x396f('0x21')](function(_0x1d9a54){return handleError(_0x18ae92,0x1f4,_0x1d9a54);});};passport[_0x396f('0x4f')](_0x396f('0x50'),new LocalStrategy({'usernameField':_0x396f('0x10'),'passwordField':'password'},function(_0x37a3ce,_0x31117c,_0x4d89d8){return localAuthenticate(db['User'],_0x37a3ce,_0x31117c,_0x4d89d8);})); \ No newline at end of file +var _0x40af=['clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','message','stringify','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','findOne','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes'];(function(_0x2d0a53,_0x5ddf2b){var _0x504ea9=function(_0x1e9ba4){while(--_0x1e9ba4){_0x2d0a53['push'](_0x2d0a53['shift']());}};_0x504ea9(++_0x5ddf2b);}(_0x40af,0x8d));var _0xf40a=function(_0x70a1c7,_0x31cf57){_0x70a1c7=_0x70a1c7-0x0;var _0x5c3510=_0x40af[_0x70a1c7];return _0x5c3510;};'use strict';var util=require('util');var passport=require(_0xf40a('0x0'));var LocalStrategy=require(_0xf40a('0x1'))[_0xf40a('0x2')];var jayson=require(_0xf40a('0x3'));var _=require(_0xf40a('0x4'));var rs=require(_0xf40a('0x5'));var moment=require(_0xf40a('0x6'));var db=require(_0xf40a('0x7'))['db'];var authService=require(_0xf40a('0x8'));var utils=require(_0xf40a('0x9'));var client=jayson[_0xf40a('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x264c16,_0x19d6ec,_0x3ee9f0,_0x5e96b2){var _0x6d453b,_0x31a5d5;return db[_0xf40a('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0xf40a('0xc'),_0xf40a('0xd')],'raw':!![]})[_0xf40a('0xe')](function(_0x3105af){_0x6d453b=_0x3105af;return _0x264c16['findOne']({'attributes':['id',_0xf40a('0xf'),_0xf40a('0x10'),_0xf40a('0x11'),'role',_0xf40a('0x12'),_0xf40a('0x13'),_0xf40a('0x14'),_0xf40a('0x15')],'where':{'name':_0x19d6ec,'role':{'$or':['admin',_0xf40a('0x16'),_0xf40a('0x17')]}}});})['then'](function(_0x302584){if(!_0x302584||_0x302584&&_0x302584[_0xf40a('0xf')]!==_0x19d6ec){throw new Error(_0xf40a('0x18'));}else{_0x31a5d5=_0x302584;return _0x31a5d5;}})[_0xf40a('0xe')](function(){_0x31a5d5[_0xf40a('0x19')](_0x3ee9f0,function(_0xf2c44c,_0x49ce12){var _0x5175d2=_0x31a5d5[_0xf40a('0x15')]+0x1;if(_0xf2c44c){return _0x5e96b2(_0xf2c44c);}else if(!_0x49ce12){if(_0x31a5d5[_0xf40a('0x12')]){return _0x5e96b2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x6d453b[_0xf40a('0xc')]>0x0){if(_0x31a5d5[_0xf40a('0x13')]){if(_0x6d453b[_0xf40a('0xd')]>0x0){if(moment(_0x31a5d5[_0xf40a('0x14')])['add'](_0x6d453b[_0xf40a('0xd')],_0xf40a('0x1a'))>moment()){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}else{return utils[_0xf40a('0x1b')](_0x31a5d5,_0x5175d2,![],null)['then'](function(){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});});}}else{return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}}else{if(_0x5175d2>=_0x6d453b[_0xf40a('0xc')]){return utils[_0xf40a('0x1b')](_0x31a5d5,0x0,!![],moment())['then'](function(){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});});}else{return utils[_0xf40a('0x1b')](_0x31a5d5,_0x5175d2,![],null)['then'](function(){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});});}}}else{return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}}else{if(_0x31a5d5[_0xf40a('0x12')]){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}else if(_0x6d453b[_0xf40a('0xc')]>0x0){if(_0x31a5d5['blocked']){if(_0x6d453b[_0xf40a('0xd')]>0x0){if(moment(_0x31a5d5['blockedAt'])[_0xf40a('0x1c')](_0x6d453b[_0xf40a('0xd')],_0xf40a('0x1a'))>moment()){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}else{return utils[_0xf40a('0x1b')](_0x31a5d5,0x0,![],null)[_0xf40a('0xe')](function(){return utils[_0xf40a('0x1d')](_0x31a5d5);})[_0xf40a('0xe')](function(){return _0x5e96b2(null,_0x31a5d5);});}}else{return _0x5e96b2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xf40a('0x1b')](_0x31a5d5,0x0,![],null)['then'](function(){return utils['getLicense'](_0x31a5d5);})['then'](function(){return _0x5e96b2(null,_0x31a5d5);})[_0xf40a('0x1e')](function(_0x44a9dd){return _0x5e96b2(null,![],_0x44a9dd);});}}else{if(_0x31a5d5['blocked']){return _0x5e96b2(null,![],{'message':_0xf40a('0x18')});}else{return utils[_0xf40a('0x1d')](_0x31a5d5)[_0xf40a('0xe')](function(){return _0x5e96b2(null,_0x31a5d5);});}}}});})[_0xf40a('0x1e')](function(_0x2dbe68){return _0x5e96b2(null,![],_0x2dbe68);});}function sendServiceMail(_0x2115ed){return db[_0xf40a('0x1f')][_0xf40a('0x20')]({'where':{'service':!![]},'attributes':['id',_0xf40a('0xf'),'email'],'include':[{'model':db[_0xf40a('0x21')],'as':_0xf40a('0x22'),'include':[{'model':db[_0xf40a('0x23')],'as':_0xf40a('0x23')}]}]})[_0xf40a('0xe')](function(_0x1cc679){if(!_0x1cc679){throw new Error(_0xf40a('0x24'));}var _0x3e0f3f=_0x1cc679['getSmtpOptions']();var _0x13c0ff={'account':_0x3e0f3f,'message':_[_0xf40a('0x25')]({'from':util[_0xf40a('0x26')](_0xf40a('0x27'),_0x1cc679[_0xf40a('0xf')],_0x1cc679[_0xf40a('0x28')]||_0x1cc679[_0xf40a('0x22')]['user'])},_0x2115ed)};return client[_0xf40a('0x29')](_0xf40a('0x2a'),_0x13c0ff);})[_0xf40a('0xe')](function(_0x5e669f){if(_0x5e669f['error']){throw new Error(util[_0xf40a('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5e669f[_0xf40a('0x2b')][_0xf40a('0x2c')]||JSON[_0xf40a('0x2d')](_0x5e669f[_0xf40a('0x2b')])));}return!![];});}function handleError(_0x462ecb,_0x539793,_0x509b78){return _0x462ecb['status'](_0x539793||0x1f4)['send']({'message':_0x509b78?_0x509b78['message']||_0x509b78:''});}exports[_0xf40a('0x2e')]=function(_0x24e11c,_0x509dd5,_0x239e11){passport[_0xf40a('0x19')](_0xf40a('0x2f'),function(_0x52e5c2,_0x559948,_0x1b26a0){var _0x75f615=_0x52e5c2||_0x1b26a0;if(_0x75f615){return handleError(_0x509dd5,0x191,_0x75f615);}if(!_0x559948){return handleError(_0x509dd5,0x194,{'message':_0xf40a('0x30')});}else{var _0xe8414f={'payload':{'id':_0x559948['id'],'role':_0x559948[_0xf40a('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0xf40a('0x32')](_0xe8414f)[_0xf40a('0xe')](function(_0x211114){_0x509dd5['json']({'id':_0x559948['id'],'token':_0x211114,'statusCall':'','isAlreadyLogged':_0x559948['online']});});}})(_0x24e11c,_0x509dd5,_0x239e11);};exports[_0xf40a('0x33')]=function(_0x3ba470,_0x9f60fb){if(!_0x3ba470['body'][_0xf40a('0x28')]){return handleError(_0x9f60fb,0x1f4,{'message':_0xf40a('0x34')});}var _0x3c9ca8=rs[_0xf40a('0x35')]();_0x3ba470[_0xf40a('0x36')][_0xf40a('0x28')]=_0x3ba470[_0xf40a('0x36')]['email'][_0xf40a('0x37')]()['toLowerCase']();var _0x1ae51f;return db[_0xf40a('0xb')][_0xf40a('0x38')]({'where':{'id':0x1},'attributes':[_0xf40a('0xc'),_0xf40a('0xd')],'raw':!![]})['then'](function(_0x404571){_0x1ae51f=_0x404571;return db['User'][_0xf40a('0x20')]({'where':{'email':_0x3ba470[_0xf40a('0x36')][_0xf40a('0x28')]}});})[_0xf40a('0xe')](function(_0x166b26){if(!_0x166b26){throw new Error(_0xf40a('0x39'));}if(_0x166b26[_0xf40a('0x12')]){throw new Error(_0xf40a('0x3a'));}if(_0x166b26[_0xf40a('0x13')]){if(moment(_0x166b26['blockedAt'])[_0xf40a('0x1c')](_0x1ae51f['blockDuration'],_0xf40a('0x1a'))>moment()){throw new Error(_0xf40a('0x3b'));}else{_0x166b26[_0xf40a('0x13')]=![];_0x166b26[_0xf40a('0x14')]=null;}}_0x166b26[_0xf40a('0x3c')]=_0x3c9ca8;_0x166b26['resetPasswordExpires']=Date[_0xf40a('0x3d')]()+0x36ee80;return _0x166b26[_0xf40a('0x3e')]();})[_0xf40a('0xe')](function(){return sendServiceMail({'to':_0x3ba470[_0xf40a('0x36')][_0xf40a('0x28')],'subject':_0xf40a('0x3f'),'text':_0xf40a('0x40')+_0xf40a('0x41')+_0xf40a('0x42')+_0x3ba470['headers']['host']+_0xf40a('0x43')+_0x3c9ca8+'\x0a\x0a'+_0xf40a('0x44')});})[_0xf40a('0xe')](function(){_0x9f60fb[_0xf40a('0x45')](0xc8)[_0xf40a('0x46')]({'message':_0xf40a('0x47')});})[_0xf40a('0x1e')](function(_0x591fc0){return handleError(_0x9f60fb,0x1f4,_0x591fc0);});};exports['reset']=function(_0x8f2646,_0x47bc41){return db[_0xf40a('0x48')][_0xf40a('0x20')]({'where':{'resetPasswordToken':_0x8f2646[_0xf40a('0x49')][_0xf40a('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xf40a('0x3d')]()}}})['then'](function(_0x321e35){if(!_0x321e35){throw new Error(_0xf40a('0x4b'));}return db[_0xf40a('0xb')][_0xf40a('0x38')]({'attributes':['id',_0xf40a('0x4c'),_0xf40a('0x4d'),'passwordHistoryLimit']})[_0xf40a('0xe')](function(_0x50b62b){if(_0x50b62b['securePassword'])authService[_0xf40a('0x4e')](_0x8f2646[_0xf40a('0x36')][_0xf40a('0x10')]);if(!_0x50b62b[_0xf40a('0x4d')]||!_0x321e35['previousPasswords'])return _0x321e35;authService[_0xf40a('0x4f')](_0x8f2646[_0xf40a('0x36')][_0xf40a('0x10')],_0x321e35[_0xf40a('0x50')],_0x50b62b[_0xf40a('0x51')]);return _0x321e35;})['then'](function(){_0x321e35['password']=_0x8f2646[_0xf40a('0x36')]['password'];_0x321e35['resetPasswordToken']=null;_0x321e35[_0xf40a('0x52')]=null;return _0x321e35[_0xf40a('0x3e')]();});})['then'](function(){_0x47bc41[_0xf40a('0x45')](0xc8)[_0xf40a('0x46')]({'message':'Password\x20reset!'});})[_0xf40a('0x1e')](function(_0x4a4e41){return handleError(_0x47bc41,0x1f4,_0x4a4e41);});};passport[_0xf40a('0x53')](_0xf40a('0x2f'),new LocalStrategy({'usernameField':_0xf40a('0xf'),'passwordField':'password'},function(_0x477cbb,_0x24a9dc,_0x5b38f2){return localAuthenticate(db[_0xf40a('0x48')],_0x477cbb,_0x24a9dc,_0x5b38f2);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8a12e60..f153555 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 _0xc703=['Router','post','login','forgot','/reset/:token','exports','express'];(function(_0x104be8,_0x51a270){var _0x49b8cf=function(_0x21ee42){while(--_0x21ee42){_0x104be8['push'](_0x104be8['shift']());}};_0x49b8cf(++_0x51a270);}(_0xc703,0x1f0));var _0x3c70=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc703[_0x4a9fb1];return _0x348672;};'use strict';var express=require(_0x3c70('0x0'));var router=express[_0x3c70('0x1')]();var controller=require('./authLocal.controller');router[_0x3c70('0x2')]('/',controller[_0x3c70('0x3')]);router['post']('/forgot',controller[_0x3c70('0x4')]);router[_0x3c70('0x2')](_0x3c70('0x5'),controller['reset']);module[_0x3c70('0x6')]=router; \ No newline at end of file +var _0x0255=['exports','express','./authLocal.controller','post','/forgot','/reset/:token','reset'];(function(_0x3d562e,_0x2d1fa0){var _0x3dd88f=function(_0x3d1b46){while(--_0x3d1b46){_0x3d562e['push'](_0x3d562e['shift']());}};_0x3dd88f(++_0x2d1fa0);}(_0x0255,0x197));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x5025('0x0'));var router=express['Router']();var controller=require(_0x5025('0x1'));router[_0x5025('0x2')]('/',controller['login']);router[_0x5025('0x2')](_0x5025('0x3'),controller['forgot']);router[_0x5025('0x2')](_0x5025('0x4'),controller[_0x5025('0x5')]);module[_0x5025('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 70f3e36..966409f 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 _0xa025=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x145e87,_0x244827){var _0xbdddad=function(_0x106153){while(--_0x106153){_0x145e87['push'](_0x145e87['shift']());}};_0xbdddad(++_0x244827);}(_0xa025,0x9c));var _0x5a02=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xa025[_0x540133];return _0x26b6e9;};'use strict';var Sequelize=require(_0x5a02('0x0'));module[_0x5a02('0x1')]={'name':{'type':Sequelize[_0x5a02('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5a02('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5a02('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xac2f=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x3c6e1b,_0x35256d){var _0x46c84a=function(_0x262178){while(--_0x262178){_0x3c6e1b['push'](_0x3c6e1b['shift']());}};_0x46c84a(++_0x35256d);}(_0xac2f,0x8d));var _0xfac2=function(_0x3c2f56,_0x363dcd){_0x3c2f56=_0x3c2f56-0x0;var _0x58127e=_0xac2f[_0x3c2f56];return _0x58127e;};'use strict';var Sequelize=require('sequelize');module[_0xfac2('0x0')]={'name':{'type':Sequelize[_0xfac2('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xfac2('0x1')]},'description':{'type':Sequelize[_0xfac2('0x1')]},'status':{'type':Sequelize[_0xfac2('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xfac2('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 9231a3d..8303aab 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 _0x64e6=['save','then','destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','find','create','update','body','addConditions','Condition','ids','omit','getConditions','order','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0xab8c7f,_0x5f0c5b){var _0x51e138=function(_0x1807f8){while(--_0x1807f8){_0xab8c7f['push'](_0xab8c7f['shift']());}};_0x51e138(++_0x5f0c5b);}(_0x64e6,0xdb));var _0x664e=function(_0x527f7d,_0x1fe947){_0x527f7d=_0x527f7d-0x0;var _0x1127c4=_0x64e6[_0x527f7d];return _0x1127c4;};'use strict';var emlformat=require(_0x664e('0x0'));var rimraf=require(_0x664e('0x1'));var zipdir=require(_0x664e('0x2'));var jsonpatch=require(_0x664e('0x3'));var rp=require(_0x664e('0x4'));var moment=require(_0x664e('0x5'));var BPromise=require(_0x664e('0x6'));var Mustache=require(_0x664e('0x7'));var util=require('util');var path=require(_0x664e('0x8'));var sox=require(_0x664e('0x9'));var csv=require(_0x664e('0xa'));var ejs=require(_0x664e('0xb'));var fs=require('fs');var fs_extra=require(_0x664e('0xc'));var _=require(_0x664e('0xd'));var squel=require('squel');var crypto=require(_0x664e('0xe'));var jsforce=require(_0x664e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x664e('0xa'));var querystring=require('querystring');var Papa=require(_0x664e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x664e('0x11'));var logger=require(_0x664e('0x12'))(_0x664e('0x13'));var utils=require(_0x664e('0x14'));var config=require(_0x664e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x664e('0x16'))['db'];function respondWithStatusCode(_0x1d6cff,_0x34479b){_0x34479b=_0x34479b||0xcc;return function(_0x1d77bc){if(_0x1d77bc){return _0x1d6cff[_0x664e('0x17')](_0x34479b);}return _0x1d6cff[_0x664e('0x18')](_0x34479b)['end']();};}function respondWithResult(_0x27d09e,_0x48cd14){_0x48cd14=_0x48cd14||0xc8;return function(_0x503c3a){if(_0x503c3a){return _0x27d09e[_0x664e('0x18')](_0x48cd14)[_0x664e('0x19')](_0x503c3a);}};}function respondWithFilteredResult(_0x57e5d1,_0x1de99f){return function(_0xbed73b){if(_0xbed73b){var _0x288c9a=typeof _0x1de99f[_0x664e('0x1a')]===_0x664e('0x1b')&&typeof _0x1de99f[_0x664e('0x1c')]===_0x664e('0x1b');var _0x2b85fd=_0xbed73b[_0x664e('0x1d')];var _0x154e44=_0x288c9a?0x0:_0x1de99f[_0x664e('0x1a')];var _0x2803b8=_0x288c9a?_0xbed73b[_0x664e('0x1d')]:_0x1de99f[_0x664e('0x1a')]+_0x1de99f[_0x664e('0x1c')];var _0x455773;if(_0x2803b8>=_0x2b85fd){_0x2803b8=_0x2b85fd;_0x455773=0xc8;}else{_0x455773=0xce;}_0x57e5d1[_0x664e('0x18')](_0x455773);return _0x57e5d1[_0x664e('0x1e')](_0x664e('0x1f'),_0x154e44+'-'+_0x2803b8+'/'+_0x2b85fd)[_0x664e('0x19')](_0xbed73b);}return null;};}function patchUpdates(_0x1df8eb){return function(_0x10036d){try{jsonpatch['apply'](_0x10036d,_0x1df8eb,!![]);}catch(_0x520e37){return BPromise[_0x664e('0x20')](_0x520e37);}return _0x10036d[_0x664e('0x21')]();};}function saveUpdates(_0x32edd9,_0x4b93cf){return function(_0x3d4503){if(_0x3d4503){return _0x3d4503['update'](_0x32edd9)[_0x664e('0x22')](function(_0x30b0d5){return _0x30b0d5;});}return null;};}function removeEntity(_0x5e6f2f,_0x47475a){return function(_0x50bb88){if(_0x50bb88){return _0x50bb88[_0x664e('0x23')]()['then'](function(){_0x5e6f2f[_0x664e('0x18')](0xcc)[_0x664e('0x24')]();});}};}function handleEntityNotFound(_0x5b296c,_0x28110b){return function(_0x1445b2){if(!_0x1445b2){_0x5b296c[_0x664e('0x17')](0x194);}return _0x1445b2;};}function handleError(_0x317a19,_0x56d1c8){_0x56d1c8=_0x56d1c8||0x1f4;return function(_0x4b4f18){logger[_0x664e('0x25')](_0x4b4f18[_0x664e('0x26')]);if(_0x4b4f18[_0x664e('0x27')]){delete _0x4b4f18[_0x664e('0x27')];}_0x317a19['status'](_0x56d1c8)[_0x664e('0x28')](_0x4b4f18);};}exports[_0x664e('0x29')]=function(_0x122781,_0x2e1bb9){var _0x257fb5={},_0xd8e01e={},_0x881c39={'count':0x0,'rows':[]};var _0x488767=_[_0x664e('0x2a')](db[_0x664e('0x2b')][_0x664e('0x2c')],function(_0x99a2f5){return{'name':_0x99a2f5[_0x664e('0x2d')],'type':_0x99a2f5['type'][_0x664e('0x2e')]};});_0xd8e01e['model']=_[_0x664e('0x2a')](_0x488767,_0x664e('0x27'));_0xd8e01e[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x122781[_0x664e('0x2f')]);_0xd8e01e[_0x664e('0x31')]=_[_0x664e('0x32')](_0xd8e01e[_0x664e('0x33')],_0xd8e01e[_0x664e('0x2f')]);_0x257fb5[_0x664e('0x34')]=_[_0x664e('0x32')](_0xd8e01e[_0x664e('0x33')],qs[_0x664e('0x35')](_0x122781[_0x664e('0x2f')][_0x664e('0x35')]));_0x257fb5[_0x664e('0x34')]=_0x257fb5[_0x664e('0x34')][_0x664e('0x36')]?_0x257fb5['attributes']:_0xd8e01e[_0x664e('0x33')];if(!_0x122781[_0x664e('0x2f')][_0x664e('0x37')](_0x664e('0x38'))){_0x257fb5[_0x664e('0x1c')]=qs[_0x664e('0x1c')](_0x122781[_0x664e('0x2f')][_0x664e('0x1c')]);_0x257fb5[_0x664e('0x1a')]=qs[_0x664e('0x1a')](_0x122781['query'][_0x664e('0x1a')]);}_0x257fb5['order']=qs[_0x664e('0x39')](_0x122781['query'][_0x664e('0x39')]);_0x257fb5[_0x664e('0x3a')]=qs[_0x664e('0x31')](_[_0x664e('0x3b')](_0x122781[_0x664e('0x2f')],_0xd8e01e[_0x664e('0x31')]),_0x488767);if(_0x122781[_0x664e('0x2f')]['filter']){_0x257fb5['where']=_['merge'](_0x257fb5[_0x664e('0x3a')],{'$or':_['map'](_0x488767,function(_0x3064b1){if(_0x3064b1[_0x664e('0x3c')]!==_0x664e('0x3d')){var _0x1cb223={};_0x1cb223[_0x3064b1['name']]={'$like':'%'+_0x122781[_0x664e('0x2f')][_0x664e('0x3e')]+'%'};return _0x1cb223;}})});}_0x257fb5=_[_0x664e('0x3f')]({},_0x257fb5,_0x122781[_0x664e('0x40')]);var _0x197272={'where':_0x257fb5['where']};return db[_0x664e('0x2b')][_0x664e('0x1d')](_0x197272)[_0x664e('0x22')](function(_0x2423cf){_0x881c39[_0x664e('0x1d')]=_0x2423cf;if(_0x122781[_0x664e('0x2f')][_0x664e('0x41')]){_0x257fb5[_0x664e('0x42')]=[{'all':!![]}];}return db[_0x664e('0x2b')][_0x664e('0x43')](_0x257fb5);})[_0x664e('0x22')](function(_0x4ec734){_0x881c39['rows']=_0x4ec734;return _0x881c39;})[_0x664e('0x22')](respondWithFilteredResult(_0x2e1bb9,_0x257fb5))[_0x664e('0x44')](handleError(_0x2e1bb9,null));};exports['show']=function(_0x23991e,_0x3b5d6a){var _0x31fd14={'raw':![],'where':{'id':_0x23991e[_0x664e('0x45')]['id']}},_0x3164f6={};_0x3164f6[_0x664e('0x33')]=_[_0x664e('0x30')](db[_0x664e('0x2b')][_0x664e('0x2c')]);_0x3164f6[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x23991e[_0x664e('0x2f')]);_0x3164f6[_0x664e('0x31')]=_[_0x664e('0x32')](_0x3164f6['model'],_0x3164f6['query']);_0x31fd14[_0x664e('0x34')]=_[_0x664e('0x32')](_0x3164f6[_0x664e('0x33')],qs[_0x664e('0x35')](_0x23991e[_0x664e('0x2f')][_0x664e('0x35')]));_0x31fd14[_0x664e('0x34')]=_0x31fd14[_0x664e('0x34')][_0x664e('0x36')]?_0x31fd14[_0x664e('0x34')]:_0x3164f6[_0x664e('0x33')];if(_0x23991e['query']['includeAll']){_0x31fd14[_0x664e('0x42')]=[{'all':!![]}];}_0x31fd14=_[_0x664e('0x3f')]({},_0x31fd14,_0x23991e[_0x664e('0x40')]);return db[_0x664e('0x2b')][_0x664e('0x46')](_0x31fd14)['then'](handleEntityNotFound(_0x3b5d6a,null))['then'](respondWithResult(_0x3b5d6a,null))[_0x664e('0x44')](handleError(_0x3b5d6a,null));};exports[_0x664e('0x47')]=function(_0x112509,_0x3e632f){return db['Automation'][_0x664e('0x47')](_0x112509['body'],{})['then'](respondWithResult(_0x3e632f,0xc9))[_0x664e('0x44')](handleError(_0x3e632f,null));};exports[_0x664e('0x48')]=function(_0x51655d,_0x43a6dd){if(_0x51655d[_0x664e('0x49')]['id']){delete _0x51655d[_0x664e('0x49')]['id'];}return db[_0x664e('0x2b')][_0x664e('0x46')]({'where':{'id':_0x51655d[_0x664e('0x45')]['id']}})[_0x664e('0x22')](handleEntityNotFound(_0x43a6dd,null))['then'](saveUpdates(_0x51655d[_0x664e('0x49')],null))[_0x664e('0x22')](respondWithResult(_0x43a6dd,null))['catch'](handleError(_0x43a6dd,null));};exports[_0x664e('0x23')]=function(_0x3f0544,_0x46111f){return db['Automation'][_0x664e('0x46')]({'where':{'id':_0x3f0544[_0x664e('0x45')]['id']}})[_0x664e('0x22')](handleEntityNotFound(_0x46111f,null))['then'](removeEntity(_0x46111f,null))['catch'](handleError(_0x46111f,null));};exports[_0x664e('0x4a')]=function(_0x5e105c,_0x30db89,_0x15d750){return db[_0x664e('0x4b')]['find']({'where':{'id':_0x5e105c[_0x664e('0x45')]['id']}})[_0x664e('0x22')](handleEntityNotFound(_0x30db89,null))[_0x664e('0x22')](function(_0xccc764){if(_0xccc764){return _0xccc764[_0x664e('0x4a')](_0x5e105c['body'][_0x664e('0x4c')],_[_0x664e('0x4d')](_0x5e105c[_0x664e('0x49')],[_0x664e('0x4c'),'id'])||{});}})[_0x664e('0x22')](respondWithResult(_0x30db89,null))[_0x664e('0x44')](handleError(_0x30db89,null));};exports[_0x664e('0x4e')]=function(_0x2c844b,_0x757554,_0x3dc289){var _0x3792a4={};var _0x3d222d={};var _0x3c02fe;var _0x27331e;return db['Automation']['findOne']({'where':{'id':_0x2c844b['params']['id']}})[_0x664e('0x22')](handleEntityNotFound(_0x757554,null))['then'](function(_0x5e2711){if(_0x5e2711){_0x3c02fe=_0x5e2711;_0x3d222d[_0x664e('0x33')]=_[_0x664e('0x30')](db[_0x664e('0x4b')]['rawAttributes']);_0x3d222d[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x2c844b[_0x664e('0x2f')]);_0x3d222d[_0x664e('0x31')]=_[_0x664e('0x32')](_0x3d222d[_0x664e('0x33')],_0x3d222d[_0x664e('0x2f')]);_0x3792a4[_0x664e('0x34')]=_['intersection'](_0x3d222d[_0x664e('0x33')],qs[_0x664e('0x35')](_0x2c844b[_0x664e('0x2f')][_0x664e('0x35')]));_0x3792a4[_0x664e('0x34')]=_0x3792a4[_0x664e('0x34')][_0x664e('0x36')]?_0x3792a4[_0x664e('0x34')]:_0x3d222d[_0x664e('0x33')];_0x3792a4[_0x664e('0x4f')]=qs[_0x664e('0x39')](_0x2c844b[_0x664e('0x2f')][_0x664e('0x39')]);_0x3792a4[_0x664e('0x3a')]=qs[_0x664e('0x31')](_[_0x664e('0x3b')](_0x2c844b[_0x664e('0x2f')],_0x3d222d['filters']));if(_0x2c844b[_0x664e('0x2f')][_0x664e('0x3e')]){_0x3792a4[_0x664e('0x3a')]=_[_0x664e('0x3f')](_0x3792a4[_0x664e('0x3a')],{'$or':_[_0x664e('0x2a')](_0x3792a4[_0x664e('0x34')],function(_0x31f797){var _0x36ec29={};_0x36ec29[_0x31f797]={'$like':'%'+_0x2c844b[_0x664e('0x2f')][_0x664e('0x3e')]+'%'};return _0x36ec29;})});}_0x3792a4=_['merge']({},_0x3792a4,_0x2c844b[_0x664e('0x40')]);return _0x3c02fe['getConditions'](_0x3792a4);}})[_0x664e('0x22')](function(_0x18d7c5){if(_0x18d7c5){_0x27331e=_0x18d7c5[_0x664e('0x36')];if(!_0x2c844b[_0x664e('0x2f')][_0x664e('0x37')]('nolimit')){_0x3792a4['limit']=qs[_0x664e('0x1c')](_0x2c844b[_0x664e('0x2f')][_0x664e('0x1c')]);_0x3792a4['offset']=qs[_0x664e('0x1a')](_0x2c844b[_0x664e('0x2f')][_0x664e('0x1a')]);}return _0x3c02fe['getConditions'](_0x3792a4);}})[_0x664e('0x22')](function(_0x2775fd){if(_0x2775fd){return _0x2775fd?{'count':_0x27331e,'rows':_0x2775fd}:null;}})[_0x664e('0x22')](respondWithResult(_0x757554,null))[_0x664e('0x44')](handleError(_0x757554,null));};exports[_0x664e('0x50')]=function(_0x3e6722,_0x20dd77,_0x2d1c34){return db[_0x664e('0x51')][_0x664e('0x46')]({'where':{'id':_0x3e6722[_0x664e('0x45')]['id']}})['then'](handleEntityNotFound(_0x20dd77,null))[_0x664e('0x22')](function(_0x46193){if(_0x46193){return _0x46193['addActions'](_0x3e6722['body'][_0x664e('0x4c')],_[_0x664e('0x4d')](_0x3e6722[_0x664e('0x49')],['ids','id'])||{});}})[_0x664e('0x22')](respondWithResult(_0x20dd77,null))[_0x664e('0x44')](handleError(_0x20dd77,null));};exports[_0x664e('0x52')]=function(_0x408ff6,_0x4c9a57,_0x467b9e){var _0x5f58e3={};var _0x266fc4={};var _0x1a3169;var _0x4b1fc5;return db[_0x664e('0x2b')][_0x664e('0x53')]({'where':{'id':_0x408ff6[_0x664e('0x45')]['id']}})[_0x664e('0x22')](handleEntityNotFound(_0x4c9a57,null))[_0x664e('0x22')](function(_0x1ab6b0){if(_0x1ab6b0){_0x1a3169=_0x1ab6b0;_0x266fc4[_0x664e('0x33')]=_[_0x664e('0x30')](db[_0x664e('0x51')][_0x664e('0x2c')]);_0x266fc4[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x408ff6[_0x664e('0x2f')]);_0x266fc4[_0x664e('0x31')]=_[_0x664e('0x32')](_0x266fc4[_0x664e('0x33')],_0x266fc4[_0x664e('0x2f')]);_0x5f58e3['attributes']=_['intersection'](_0x266fc4[_0x664e('0x33')],qs[_0x664e('0x35')](_0x408ff6[_0x664e('0x2f')]['fields']));_0x5f58e3[_0x664e('0x34')]=_0x5f58e3[_0x664e('0x34')][_0x664e('0x36')]?_0x5f58e3[_0x664e('0x34')]:_0x266fc4[_0x664e('0x33')];_0x5f58e3[_0x664e('0x4f')]=qs[_0x664e('0x39')](_0x408ff6[_0x664e('0x2f')][_0x664e('0x39')]);_0x5f58e3[_0x664e('0x3a')]=qs['filters'](_[_0x664e('0x3b')](_0x408ff6[_0x664e('0x2f')],_0x266fc4['filters']));if(_0x408ff6[_0x664e('0x2f')][_0x664e('0x3e')]){_0x5f58e3['where']=_[_0x664e('0x3f')](_0x5f58e3[_0x664e('0x3a')],{'$or':_[_0x664e('0x2a')](_0x5f58e3[_0x664e('0x34')],function(_0x59f728){var _0x1d15e1={};_0x1d15e1[_0x59f728]={'$like':'%'+_0x408ff6['query'][_0x664e('0x3e')]+'%'};return _0x1d15e1;})});}_0x5f58e3=_[_0x664e('0x3f')]({},_0x5f58e3,_0x408ff6[_0x664e('0x40')]);return _0x1a3169[_0x664e('0x52')](_0x5f58e3);}})[_0x664e('0x22')](function(_0x22b963){if(_0x22b963){_0x4b1fc5=_0x22b963['length'];if(!_0x408ff6[_0x664e('0x2f')]['hasOwnProperty']('nolimit')){_0x5f58e3[_0x664e('0x1c')]=qs['limit'](_0x408ff6[_0x664e('0x2f')][_0x664e('0x1c')]);_0x5f58e3[_0x664e('0x1a')]=qs[_0x664e('0x1a')](_0x408ff6['query'][_0x664e('0x1a')]);}return _0x1a3169[_0x664e('0x52')](_0x5f58e3);}})['then'](function(_0x500795){if(_0x500795){return _0x500795?{'count':_0x4b1fc5,'rows':_0x500795}:null;}})[_0x664e('0x22')](respondWithResult(_0x4c9a57,null))[_0x664e('0x44')](handleError(_0x4c9a57,null));}; \ No newline at end of file +var _0xd775=['reject','save','then','destroy','sendStatus','name','send','Automation','rawAttributes','fieldName','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','addConditions','Condition','ids','getConditions','findOne','order','addActions','omit','getActions','Action','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x2ab8f9,_0x229c70){var _0x75fcc7=function(_0x5540e2){while(--_0x5540e2){_0x2ab8f9['push'](_0x2ab8f9['shift']());}};_0x75fcc7(++_0x229c70);}(_0xd775,0xd5));var _0x5d77=function(_0x427aee,_0x424698){_0x427aee=_0x427aee-0x0;var _0x222da6=_0xd775[_0x427aee];return _0x222da6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5d77('0x0'));var jsonpatch=require(_0x5d77('0x1'));var rp=require(_0x5d77('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d77('0x3'));var util=require(_0x5d77('0x4'));var path=require(_0x5d77('0x5'));var sox=require(_0x5d77('0x6'));var csv=require(_0x5d77('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d77('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d77('0x9'));var jsforce=require(_0x5d77('0xa'));var deskjs=require(_0x5d77('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d77('0xc'));var Redis=require(_0x5d77('0xd'));var authService=require(_0x5d77('0xe'));var qs=require(_0x5d77('0xf'));var as=require(_0x5d77('0x10'));var hardwareService=require(_0x5d77('0x11'));var logger=require(_0x5d77('0x12'))(_0x5d77('0x13'));var utils=require(_0x5d77('0x14'));var config=require(_0x5d77('0x15'));var licenseUtil=require(_0x5d77('0x16'));var db=require(_0x5d77('0x17'))['db'];function respondWithStatusCode(_0x30574d,_0x32939c){_0x32939c=_0x32939c||0xcc;return function(_0x4e8a1f){if(_0x4e8a1f){return _0x30574d['sendStatus'](_0x32939c);}return _0x30574d[_0x5d77('0x18')](_0x32939c)[_0x5d77('0x19')]();};}function respondWithResult(_0x3a8033,_0x5267de){_0x5267de=_0x5267de||0xc8;return function(_0x38ec3a){if(_0x38ec3a){return _0x3a8033[_0x5d77('0x18')](_0x5267de)[_0x5d77('0x1a')](_0x38ec3a);}};}function respondWithFilteredResult(_0x2750b5,_0x1b96b8){return function(_0xa3f9d5){if(_0xa3f9d5){var _0x179e9f=typeof _0x1b96b8[_0x5d77('0x1b')]===_0x5d77('0x1c')&&typeof _0x1b96b8['limit']==='undefined';var _0x5aeb8f=_0xa3f9d5['count'];var _0x5b389e=_0x179e9f?0x0:_0x1b96b8[_0x5d77('0x1b')];var _0xf87dee=_0x179e9f?_0xa3f9d5['count']:_0x1b96b8[_0x5d77('0x1b')]+_0x1b96b8[_0x5d77('0x1d')];var _0x2e2f39;if(_0xf87dee>=_0x5aeb8f){_0xf87dee=_0x5aeb8f;_0x2e2f39=0xc8;}else{_0x2e2f39=0xce;}_0x2750b5[_0x5d77('0x18')](_0x2e2f39);return _0x2750b5['set']('Content-Range',_0x5b389e+'-'+_0xf87dee+'/'+_0x5aeb8f)['json'](_0xa3f9d5);}return null;};}function patchUpdates(_0x459249){return function(_0x499f26){try{jsonpatch['apply'](_0x499f26,_0x459249,!![]);}catch(_0x153a8f){return BPromise[_0x5d77('0x1e')](_0x153a8f);}return _0x499f26[_0x5d77('0x1f')]();};}function saveUpdates(_0x401b7c,_0x39eb4d){return function(_0x56f5c6){if(_0x56f5c6){return _0x56f5c6['update'](_0x401b7c)[_0x5d77('0x20')](function(_0x157cb9){return _0x157cb9;});}return null;};}function removeEntity(_0x9b6e38,_0x5a88cd){return function(_0x14be03){if(_0x14be03){return _0x14be03[_0x5d77('0x21')]()[_0x5d77('0x20')](function(){_0x9b6e38['status'](0xcc)[_0x5d77('0x19')]();});}};}function handleEntityNotFound(_0x456658,_0x10dd56){return function(_0x22088b){if(!_0x22088b){_0x456658[_0x5d77('0x22')](0x194);}return _0x22088b;};}function handleError(_0x3afc33,_0x20fd05){_0x20fd05=_0x20fd05||0x1f4;return function(_0x591dca){logger['error'](_0x591dca['stack']);if(_0x591dca[_0x5d77('0x23')]){delete _0x591dca[_0x5d77('0x23')];}_0x3afc33[_0x5d77('0x18')](_0x20fd05)[_0x5d77('0x24')](_0x591dca);};}exports['index']=function(_0x128493,_0x424c39){var _0x23bb30={},_0x3e283b={},_0x4491b3={'count':0x0,'rows':[]};var _0x2eb2c0=_['map'](db[_0x5d77('0x25')][_0x5d77('0x26')],function(_0x5bc336){return{'name':_0x5bc336[_0x5d77('0x27')],'type':_0x5bc336['type']['key']};});_0x3e283b['model']=_[_0x5d77('0x28')](_0x2eb2c0,_0x5d77('0x23'));_0x3e283b[_0x5d77('0x29')]=_[_0x5d77('0x2a')](_0x128493['query']);_0x3e283b['filters']=_[_0x5d77('0x2b')](_0x3e283b[_0x5d77('0x2c')],_0x3e283b['query']);_0x23bb30['attributes']=_[_0x5d77('0x2b')](_0x3e283b['model'],qs[_0x5d77('0x2d')](_0x128493[_0x5d77('0x29')]['fields']));_0x23bb30[_0x5d77('0x2e')]=_0x23bb30['attributes'][_0x5d77('0x2f')]?_0x23bb30[_0x5d77('0x2e')]:_0x3e283b[_0x5d77('0x2c')];if(!_0x128493[_0x5d77('0x29')][_0x5d77('0x30')](_0x5d77('0x31'))){_0x23bb30['limit']=qs['limit'](_0x128493[_0x5d77('0x29')]['limit']);_0x23bb30[_0x5d77('0x1b')]=qs[_0x5d77('0x1b')](_0x128493[_0x5d77('0x29')][_0x5d77('0x1b')]);}_0x23bb30['order']=qs[_0x5d77('0x32')](_0x128493[_0x5d77('0x29')][_0x5d77('0x32')]);_0x23bb30[_0x5d77('0x33')]=qs[_0x5d77('0x34')](_[_0x5d77('0x35')](_0x128493['query'],_0x3e283b[_0x5d77('0x34')]),_0x2eb2c0);if(_0x128493[_0x5d77('0x29')][_0x5d77('0x36')]){_0x23bb30[_0x5d77('0x33')]=_[_0x5d77('0x37')](_0x23bb30[_0x5d77('0x33')],{'$or':_[_0x5d77('0x28')](_0x2eb2c0,function(_0x32d3c5){if(_0x32d3c5[_0x5d77('0x38')]!==_0x5d77('0x39')){var _0x32240a={};_0x32240a[_0x32d3c5[_0x5d77('0x23')]]={'$like':'%'+_0x128493[_0x5d77('0x29')][_0x5d77('0x36')]+'%'};return _0x32240a;}})});}_0x23bb30=_[_0x5d77('0x37')]({},_0x23bb30,_0x128493[_0x5d77('0x3a')]);var _0x7acd62={'where':_0x23bb30[_0x5d77('0x33')]};return db['Automation'][_0x5d77('0x3b')](_0x7acd62)[_0x5d77('0x20')](function(_0x124b63){_0x4491b3[_0x5d77('0x3b')]=_0x124b63;if(_0x128493[_0x5d77('0x29')][_0x5d77('0x3c')]){_0x23bb30['include']=[{'all':!![]}];}return db[_0x5d77('0x25')][_0x5d77('0x3d')](_0x23bb30);})['then'](function(_0x109971){_0x4491b3[_0x5d77('0x3e')]=_0x109971;return _0x4491b3;})[_0x5d77('0x20')](respondWithFilteredResult(_0x424c39,_0x23bb30))[_0x5d77('0x3f')](handleError(_0x424c39,null));};exports[_0x5d77('0x40')]=function(_0x390a55,_0xe4ad63){var _0x3d14a0={'raw':![],'where':{'id':_0x390a55[_0x5d77('0x41')]['id']}},_0x229e52={};_0x229e52[_0x5d77('0x2c')]=_[_0x5d77('0x2a')](db[_0x5d77('0x25')][_0x5d77('0x26')]);_0x229e52[_0x5d77('0x29')]=_[_0x5d77('0x2a')](_0x390a55[_0x5d77('0x29')]);_0x229e52[_0x5d77('0x34')]=_[_0x5d77('0x2b')](_0x229e52['model'],_0x229e52[_0x5d77('0x29')]);_0x3d14a0[_0x5d77('0x2e')]=_[_0x5d77('0x2b')](_0x229e52[_0x5d77('0x2c')],qs[_0x5d77('0x2d')](_0x390a55[_0x5d77('0x29')][_0x5d77('0x2d')]));_0x3d14a0[_0x5d77('0x2e')]=_0x3d14a0[_0x5d77('0x2e')][_0x5d77('0x2f')]?_0x3d14a0[_0x5d77('0x2e')]:_0x229e52[_0x5d77('0x2c')];if(_0x390a55[_0x5d77('0x29')]['includeAll']){_0x3d14a0[_0x5d77('0x42')]=[{'all':!![]}];}_0x3d14a0=_[_0x5d77('0x37')]({},_0x3d14a0,_0x390a55[_0x5d77('0x3a')]);return db[_0x5d77('0x25')][_0x5d77('0x43')](_0x3d14a0)['then'](handleEntityNotFound(_0xe4ad63,null))['then'](respondWithResult(_0xe4ad63,null))[_0x5d77('0x3f')](handleError(_0xe4ad63,null));};exports[_0x5d77('0x44')]=function(_0x4f82f8,_0x590491){return db[_0x5d77('0x25')][_0x5d77('0x44')](_0x4f82f8[_0x5d77('0x45')],{})[_0x5d77('0x20')](respondWithResult(_0x590491,0xc9))[_0x5d77('0x3f')](handleError(_0x590491,null));};exports[_0x5d77('0x46')]=function(_0x809a1f,_0x959ffc){if(_0x809a1f['body']['id']){delete _0x809a1f[_0x5d77('0x45')]['id'];}return db['Automation'][_0x5d77('0x43')]({'where':{'id':_0x809a1f[_0x5d77('0x41')]['id']}})['then'](handleEntityNotFound(_0x959ffc,null))['then'](saveUpdates(_0x809a1f[_0x5d77('0x45')],null))[_0x5d77('0x20')](respondWithResult(_0x959ffc,null))['catch'](handleError(_0x959ffc,null));};exports[_0x5d77('0x21')]=function(_0x327a4f,_0x3a2fbb){return db[_0x5d77('0x25')]['find']({'where':{'id':_0x327a4f[_0x5d77('0x41')]['id']}})[_0x5d77('0x20')](handleEntityNotFound(_0x3a2fbb,null))['then'](removeEntity(_0x3a2fbb,null))['catch'](handleError(_0x3a2fbb,null));};exports[_0x5d77('0x47')]=function(_0x561925,_0x1d1c90,_0x3fce53){return db[_0x5d77('0x48')]['find']({'where':{'id':_0x561925[_0x5d77('0x41')]['id']}})[_0x5d77('0x20')](handleEntityNotFound(_0x1d1c90,null))[_0x5d77('0x20')](function(_0x163664){if(_0x163664){return _0x163664['addConditions'](_0x561925[_0x5d77('0x45')][_0x5d77('0x49')],_['omit'](_0x561925['body'],[_0x5d77('0x49'),'id'])||{});}})[_0x5d77('0x20')](respondWithResult(_0x1d1c90,null))[_0x5d77('0x3f')](handleError(_0x1d1c90,null));};exports[_0x5d77('0x4a')]=function(_0x28ead6,_0x454295,_0x2028a8){var _0x2e1813={};var _0x383b23={};var _0x3d101c;var _0x518d6e;return db[_0x5d77('0x25')][_0x5d77('0x4b')]({'where':{'id':_0x28ead6[_0x5d77('0x41')]['id']}})['then'](handleEntityNotFound(_0x454295,null))['then'](function(_0x11998c){if(_0x11998c){_0x3d101c=_0x11998c;_0x383b23[_0x5d77('0x2c')]=_[_0x5d77('0x2a')](db[_0x5d77('0x48')][_0x5d77('0x26')]);_0x383b23['query']=_[_0x5d77('0x2a')](_0x28ead6[_0x5d77('0x29')]);_0x383b23[_0x5d77('0x34')]=_[_0x5d77('0x2b')](_0x383b23[_0x5d77('0x2c')],_0x383b23[_0x5d77('0x29')]);_0x2e1813[_0x5d77('0x2e')]=_[_0x5d77('0x2b')](_0x383b23[_0x5d77('0x2c')],qs[_0x5d77('0x2d')](_0x28ead6['query'][_0x5d77('0x2d')]));_0x2e1813[_0x5d77('0x2e')]=_0x2e1813['attributes'][_0x5d77('0x2f')]?_0x2e1813[_0x5d77('0x2e')]:_0x383b23[_0x5d77('0x2c')];_0x2e1813[_0x5d77('0x4c')]=qs[_0x5d77('0x32')](_0x28ead6[_0x5d77('0x29')][_0x5d77('0x32')]);_0x2e1813['where']=qs[_0x5d77('0x34')](_[_0x5d77('0x35')](_0x28ead6[_0x5d77('0x29')],_0x383b23[_0x5d77('0x34')]));if(_0x28ead6[_0x5d77('0x29')][_0x5d77('0x36')]){_0x2e1813[_0x5d77('0x33')]=_[_0x5d77('0x37')](_0x2e1813[_0x5d77('0x33')],{'$or':_['map'](_0x2e1813[_0x5d77('0x2e')],function(_0x45af24){var _0x249684={};_0x249684[_0x45af24]={'$like':'%'+_0x28ead6[_0x5d77('0x29')]['filter']+'%'};return _0x249684;})});}_0x2e1813=_[_0x5d77('0x37')]({},_0x2e1813,_0x28ead6['options']);return _0x3d101c[_0x5d77('0x4a')](_0x2e1813);}})[_0x5d77('0x20')](function(_0x55ab6f){if(_0x55ab6f){_0x518d6e=_0x55ab6f['length'];if(!_0x28ead6[_0x5d77('0x29')]['hasOwnProperty'](_0x5d77('0x31'))){_0x2e1813[_0x5d77('0x1d')]=qs[_0x5d77('0x1d')](_0x28ead6[_0x5d77('0x29')][_0x5d77('0x1d')]);_0x2e1813[_0x5d77('0x1b')]=qs['offset'](_0x28ead6[_0x5d77('0x29')][_0x5d77('0x1b')]);}return _0x3d101c['getConditions'](_0x2e1813);}})['then'](function(_0x3ec506){if(_0x3ec506){return _0x3ec506?{'count':_0x518d6e,'rows':_0x3ec506}:null;}})['then'](respondWithResult(_0x454295,null))[_0x5d77('0x3f')](handleError(_0x454295,null));};exports[_0x5d77('0x4d')]=function(_0x309fd1,_0x4ef9d3,_0x2be580){return db['Action']['find']({'where':{'id':_0x309fd1['params']['id']}})['then'](handleEntityNotFound(_0x4ef9d3,null))['then'](function(_0x25f782){if(_0x25f782){return _0x25f782[_0x5d77('0x4d')](_0x309fd1['body'][_0x5d77('0x49')],_[_0x5d77('0x4e')](_0x309fd1[_0x5d77('0x45')],[_0x5d77('0x49'),'id'])||{});}})[_0x5d77('0x20')](respondWithResult(_0x4ef9d3,null))[_0x5d77('0x3f')](handleError(_0x4ef9d3,null));};exports[_0x5d77('0x4f')]=function(_0x299bab,_0x5263fb,_0x2580cb){var _0x123d78={};var _0x28b0f2={};var _0x2c1c3f;var _0x3d5bd2;return db[_0x5d77('0x25')]['findOne']({'where':{'id':_0x299bab[_0x5d77('0x41')]['id']}})['then'](handleEntityNotFound(_0x5263fb,null))[_0x5d77('0x20')](function(_0x21bec2){if(_0x21bec2){_0x2c1c3f=_0x21bec2;_0x28b0f2[_0x5d77('0x2c')]=_[_0x5d77('0x2a')](db[_0x5d77('0x50')][_0x5d77('0x26')]);_0x28b0f2[_0x5d77('0x29')]=_[_0x5d77('0x2a')](_0x299bab[_0x5d77('0x29')]);_0x28b0f2[_0x5d77('0x34')]=_[_0x5d77('0x2b')](_0x28b0f2[_0x5d77('0x2c')],_0x28b0f2[_0x5d77('0x29')]);_0x123d78[_0x5d77('0x2e')]=_['intersection'](_0x28b0f2[_0x5d77('0x2c')],qs[_0x5d77('0x2d')](_0x299bab[_0x5d77('0x29')][_0x5d77('0x2d')]));_0x123d78['attributes']=_0x123d78['attributes'][_0x5d77('0x2f')]?_0x123d78[_0x5d77('0x2e')]:_0x28b0f2[_0x5d77('0x2c')];_0x123d78[_0x5d77('0x4c')]=qs[_0x5d77('0x32')](_0x299bab[_0x5d77('0x29')]['sort']);_0x123d78[_0x5d77('0x33')]=qs['filters'](_[_0x5d77('0x35')](_0x299bab[_0x5d77('0x29')],_0x28b0f2[_0x5d77('0x34')]));if(_0x299bab['query']['filter']){_0x123d78[_0x5d77('0x33')]=_[_0x5d77('0x37')](_0x123d78[_0x5d77('0x33')],{'$or':_[_0x5d77('0x28')](_0x123d78['attributes'],function(_0x148e29){var _0x40481c={};_0x40481c[_0x148e29]={'$like':'%'+_0x299bab[_0x5d77('0x29')]['filter']+'%'};return _0x40481c;})});}_0x123d78=_[_0x5d77('0x37')]({},_0x123d78,_0x299bab[_0x5d77('0x3a')]);return _0x2c1c3f['getActions'](_0x123d78);}})[_0x5d77('0x20')](function(_0x512382){if(_0x512382){_0x3d5bd2=_0x512382[_0x5d77('0x2f')];if(!_0x299bab[_0x5d77('0x29')]['hasOwnProperty']('nolimit')){_0x123d78[_0x5d77('0x1d')]=qs[_0x5d77('0x1d')](_0x299bab[_0x5d77('0x29')][_0x5d77('0x1d')]);_0x123d78[_0x5d77('0x1b')]=qs[_0x5d77('0x1b')](_0x299bab[_0x5d77('0x29')][_0x5d77('0x1b')]);}return _0x2c1c3f[_0x5d77('0x4f')](_0x123d78);}})[_0x5d77('0x20')](function(_0x348f26){if(_0x348f26){return _0x348f26?{'count':_0x3d5bd2,'rows':_0x348f26}:null;}})[_0x5d77('0x20')](respondWithResult(_0x5263fb,null))[_0x5d77('0x3f')](handleError(_0x5263fb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 04836af..ac41075 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 _0x26b3=['bluebird','request-promise','./automation.attributes','define','Automation','tools_automations','util','../../config/logger','api'];(function(_0x404fa0,_0xf828f7){var _0x1d7c6b=function(_0x40b247){while(--_0x40b247){_0x404fa0['push'](_0x404fa0['shift']());}};_0x1d7c6b(++_0xf828f7);}(_0x26b3,0x84));var _0x326b=function(_0x1743c8,_0x331a38){_0x1743c8=_0x1743c8-0x0;var _0x1e975c=_0x26b3[_0x1743c8];return _0x1e975c;};'use strict';var _=require('lodash');var util=require(_0x326b('0x0'));var logger=require(_0x326b('0x1'))(_0x326b('0x2'));var moment=require('moment');var BPromise=require(_0x326b('0x3'));var rp=require(_0x326b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x326b('0x5'));module['exports']=function(_0x5a6652,_0x5033f7){return _0x5a6652[_0x326b('0x6')](_0x326b('0x7'),attributes,{'tableName':_0x326b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc59=['define','tools_automations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x186658,_0x583d6e){var _0x54ee23=function(_0x1ac752){while(--_0x1ac752){_0x186658['push'](_0x186658['shift']());}};_0x54ee23(++_0x583d6e);}(_0xbc59,0x1ca));var _0x9bc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc59[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var logger=require(_0x9bc5('0x2'))('api');var moment=require(_0x9bc5('0x3'));var BPromise=require('bluebird');var rp=require(_0x9bc5('0x4'));var fs=require('fs');var path=require(_0x9bc5('0x5'));var rimraf=require(_0x9bc5('0x6'));var config=require(_0x9bc5('0x7'));var attributes=require(_0x9bc5('0x8'));module[_0x9bc5('0x9')]=function(_0x783eec,_0x516433){return _0x783eec[_0x9bc5('0xa')]('Automation',attributes,{'tableName':_0x9bc5('0xb'),'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 2dc01f0..7dec9bd 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 _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19cb2e,_0x1ae057){var _0x5abc62=function(_0x39cfe6){while(--_0x39cfe6){_0x19cb2e['push'](_0x19cb2e['shift']());}};_0x5abc62(++_0x1ae057);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8a9a[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('Automation,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file +var _0x1df7=['jayson/promise','client','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c0fb4,_0x50dd67){var _0x4681c1=function(_0x5206ce){while(--_0x5206ce){_0x1c0fb4['push'](_0x1c0fb4['shift']());}};_0x4681c1(++_0x50dd67);}(_0x1df7,0x6e));var _0x71df=function(_0x5cf424,_0x3b94b4){_0x5cf424=_0x5cf424-0x0;var _0x4ee9e8=_0x1df7[_0x5cf424];return _0x4ee9e8;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var moment=require(_0x71df('0x1'));var BPromise=require(_0x71df('0x2'));var rs=require(_0x71df('0x3'));var fs=require('fs');var Redis=require(_0x71df('0x4'));var db=require(_0x71df('0x5'))['db'];var utils=require(_0x71df('0x6'));var logger=require(_0x71df('0x7'))(_0x71df('0x8'));var config=require(_0x71df('0x9'));var jayson=require(_0x71df('0xa'));var client=jayson[_0x71df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe258,_0x487f3d,_0xc2d7ef){return new BPromise(function(_0x88acfd,_0x4a21c4){return client[_0x71df('0xc')](_0x2fe258,_0xc2d7ef)['then'](function(_0x3cb3be){logger[_0x71df('0xd')]('Automation,\x20%s,\x20%s',_0x487f3d,_0x71df('0xe'));logger[_0x71df('0xf')](_0x71df('0x10'),_0x487f3d,'request\x20sent',JSON[_0x71df('0x11')](_0x3cb3be));if(_0x3cb3be[_0x71df('0x12')]){if(_0x3cb3be['error'][_0x71df('0x13')]===0x1f4){logger[_0x71df('0x12')](_0x71df('0x14'),_0x487f3d,_0x3cb3be['error']['message']);return _0x4a21c4(_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);}logger['error'](_0x71df('0x14'),_0x487f3d,_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);return _0x88acfd(_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);}else{logger[_0x71df('0xd')](_0x71df('0x14'),_0x487f3d,_0x71df('0xe'));_0x88acfd(_0x3cb3be[_0x71df('0x16')][_0x71df('0x15')]);}})[_0x71df('0x17')](function(_0x2ed677){logger['error'](_0x71df('0x14'),_0x487f3d,_0x2ed677);_0x4a21c4(_0x2ed677);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ec4a264..f87fc16 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 _0x0a34=['index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x188fa4,_0x3e93f0){var _0x5b1d9b=function(_0x176bc1){while(--_0x176bc1){_0x188fa4['push'](_0x188fa4['shift']());}};_0x5b1d9b(++_0x3e93f0);}(_0x0a34,0x12a));var _0x40a3=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x0a34[_0x5a3cf0];return _0x5a64ee;};'use strict';var multer=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var path=require('path');var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40a3('0x5'));var interaction=require(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var controller=require('./automation.controller');router[_0x40a3('0x8')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xa')]);router[_0x40a3('0x8')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['show']);router[_0x40a3('0x8')](_0x40a3('0xc'),auth[_0x40a3('0x9')](),controller[_0x40a3('0xd')]);router[_0x40a3('0x8')](_0x40a3('0xe'),auth['isAuthenticated'](),controller[_0x40a3('0xf')]);router[_0x40a3('0x10')]('/',auth[_0x40a3('0x9')](),controller['create']);router[_0x40a3('0x10')](_0x40a3('0xc'),auth['isAuthenticated'](),controller[_0x40a3('0x11')]);router[_0x40a3('0x10')]('/:id/actions',auth[_0x40a3('0x9')](),controller[_0x40a3('0x12')]);router['put'](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller[_0x40a3('0x13')]);router[_0x40a3('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x40a3('0x15')]=router; \ No newline at end of file +var _0xaa19=['addConditions','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','show','isAuthenticated','getConditions','/:id/actions','post','create'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0xaa19,0x79));var _0x9aa1=function(_0xbffc23,_0x5336c4){_0xbffc23=_0xbffc23-0x0;var _0x464534=_0xaa19[_0xbffc23];return _0x464534;};'use strict';var multer=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var path=require(_0x9aa1('0x2'));var timeout=require(_0x9aa1('0x3'));var express=require('express');var router=express[_0x9aa1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9aa1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9aa1('0x6'));var controller=require(_0x9aa1('0x7'));router[_0x9aa1('0x8')]('/',auth['isAuthenticated'](),controller[_0x9aa1('0x9')]);router[_0x9aa1('0x8')](_0x9aa1('0xa'),auth['isAuthenticated'](),controller[_0x9aa1('0xb')]);router['get']('/:id/conditions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0xd')]);router[_0x9aa1('0x8')](_0x9aa1('0xe'),auth['isAuthenticated'](),controller['getActions']);router[_0x9aa1('0xf')]('/',auth['isAuthenticated'](),controller[_0x9aa1('0x10')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0x9aa1('0x11')]);router[_0x9aa1('0xf')]('/:id/actions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x12')]);router[_0x9aa1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9aa1('0x14')]);router['delete'](_0x9aa1('0xa'),auth['isAuthenticated'](),controller[_0x9aa1('0x15')]);module[_0x9aa1('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c36bfae..b602d46 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 _0xf71f=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x47003d,_0x5e27ac){var _0x20715b=function(_0x260128){while(--_0x260128){_0x47003d['push'](_0x47003d['shift']());}};_0x20715b(++_0x5e27ac);}(_0xf71f,0xcb));var _0xff71=function(_0x54d6d0,_0x1edbb1){_0x54d6d0=_0x54d6d0-0x0;var _0x599158=_0xf71f[_0x54d6d0];return _0x599158;};'use strict';var Sequelize=require(_0xff71('0x0'));module[_0xff71('0x1')]={'name':{'type':Sequelize[_0xff71('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xff71('0x3')](_0xff71('0x4')),'allowNull':![],'defaultValue':_0xff71('0x4')},'description':{'type':Sequelize[_0xff71('0x2')]},'active':{'type':Sequelize[_0xff71('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xff71('0x6')](0x4)[_0xff71('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xff71('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xff71('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'comment':_0xff71('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xff71('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xff71('0x2')],'defaultValue':_0xff71('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xff71('0x3')]('always','never',_0xff71('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xff71('0x5')],'defaultValue':0x0,'comment':_0xff71('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xff71('0x6')](0x9)[_0xff71('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xff71('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xff71('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xff71('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xff71('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xff71('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xff71('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xff71('0x6')](0x9)[_0xff71('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xff71('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xff71('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xff71('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xff71('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xff71('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xff71('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xff71('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xff71('0x6')](0x9)[_0xff71('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xff71('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xff71('0x3')]('DESC',_0xff71('0x1b')),'defaultValue':_0xff71('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xff71('0x1d')},'dialCutDigit':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xff71('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff71('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xff71('0x6')](0x3)[_0xff71('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff71('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xff71('0x6')](0x5)[_0xff71('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xce14=['INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','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,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x28f73e,_0x4fb482){var _0x3d096e=function(_0x5af680){while(--_0x5af680){_0x28f73e['push'](_0x28f73e['shift']());}};_0x3d096e(++_0x4fb482);}(_0xce14,0x17f));var _0x4ce1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xce14[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x4ce1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4ce1('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4ce1('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x4ce1('0x3')},'description':{'type':Sequelize[_0x4ce1('0x4')]},'active':{'type':Sequelize[_0x4ce1('0x5')],'defaultValue':0x0,'comment':_0x4ce1('0x6')},'limitCalls':{'type':Sequelize[_0x4ce1('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4ce1('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4ce1('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4ce1('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x4ce1('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'comment':_0x4ce1('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4ce1('0x10')},'dialTimezone':{'type':Sequelize[_0x4ce1('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4ce1('0x4')],'defaultValue':_0x4ce1('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4ce1('0x12'),'never',_0x4ce1('0x13')),'defaultValue':_0x4ce1('0x12')},'dialAMDActive':{'type':Sequelize[_0x4ce1('0x5')],'defaultValue':0x0,'comment':_0x4ce1('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4ce1('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4ce1('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4ce1('0x7')](0x9)[_0x4ce1('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4ce1('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x4ce1('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4ce1('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4ce1('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4ce1('0x7')](0x9)[_0x4ce1('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4ce1('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4ce1('0x7')](0x9)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4ce1('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4ce1('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4ce1('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4ce1('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ce1('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x4ce1('0x1c'),_0x4ce1('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4ce1('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ce1('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ce1('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4ce1('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ce1('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4ce1('0x7')](0x5)[_0x4ce1('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4d7871d..0a0dc9a 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 _0xd23d=['ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','Campaign','findAll','rows','catch','show','params','rawAttributes','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','cm_hopper','phone','scheduledAt','ContactId','field','CmListId','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','onlyIfOpen','into','fromQuery','NOW()','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','OrderBy','h.id'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xd23d,0xa0));var _0xdd23=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xd23d[_0x478c8a];return _0x3b6b3e;};'use strict';var emlformat=require(_0xdd23('0x0'));var rimraf=require(_0xdd23('0x1'));var zipdir=require(_0xdd23('0x2'));var jsonpatch=require(_0xdd23('0x3'));var rp=require(_0xdd23('0x4'));var moment=require(_0xdd23('0x5'));var BPromise=require(_0xdd23('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdd23('0x7'));var csv=require(_0xdd23('0x8'));var ejs=require(_0xdd23('0x9'));var fs=require('fs');var fs_extra=require(_0xdd23('0xa'));var _=require(_0xdd23('0xb'));var squel=require(_0xdd23('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd23('0xd'));var toCsv=require(_0xdd23('0x8'));var querystring=require(_0xdd23('0xe'));var Papa=require(_0xdd23('0xf'));var Redis=require(_0xdd23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdd23('0x11'));var as=require(_0xdd23('0x12'));var hardwareService=require(_0xdd23('0x13'));var logger=require('../../config/logger')(_0xdd23('0x14'));var utils=require(_0xdd23('0x15'));var config=require(_0xdd23('0x16'));var licenseUtil=require(_0xdd23('0x17'));var db=require(_0xdd23('0x18'))['db'];function respondWithStatusCode(_0x103a43,_0x1484d7){_0x1484d7=_0x1484d7||0xcc;return function(_0x1e4739){if(_0x1e4739){return _0x103a43[_0xdd23('0x19')](_0x1484d7);}return _0x103a43['status'](_0x1484d7)['end']();};}function respondWithResult(_0x294683,_0x27a280){_0x27a280=_0x27a280||0xc8;return function(_0x2f2869){if(_0x2f2869){return _0x294683['status'](_0x27a280)[_0xdd23('0x1a')](_0x2f2869);}};}function respondWithFilteredResult(_0x21f67a,_0x2abcd7){return function(_0x3743cf){if(_0x3743cf){var _0x5d0087=typeof _0x2abcd7[_0xdd23('0x1b')]===_0xdd23('0x1c')&&typeof _0x2abcd7[_0xdd23('0x1d')]===_0xdd23('0x1c');var _0x111e0f=_0x3743cf[_0xdd23('0x1e')];var _0x49d959=_0x5d0087?0x0:_0x2abcd7['offset'];var _0x7f3048=_0x5d0087?_0x3743cf[_0xdd23('0x1e')]:_0x2abcd7[_0xdd23('0x1b')]+_0x2abcd7[_0xdd23('0x1d')];var _0x3d2720;if(_0x7f3048>=_0x111e0f){_0x7f3048=_0x111e0f;_0x3d2720=0xc8;}else{_0x3d2720=0xce;}_0x21f67a[_0xdd23('0x1f')](_0x3d2720);return _0x21f67a[_0xdd23('0x20')](_0xdd23('0x21'),_0x49d959+'-'+_0x7f3048+'/'+_0x111e0f)[_0xdd23('0x1a')](_0x3743cf);}return null;};}function patchUpdates(_0x198059){return function(_0x7d557d){try{jsonpatch[_0xdd23('0x22')](_0x7d557d,_0x198059,!![]);}catch(_0x46056c){return BPromise['reject'](_0x46056c);}return _0x7d557d['save']();};}function saveUpdates(_0x4f53fa,_0x5b874b){return function(_0x4ee5e3){if(_0x4ee5e3){return _0x4ee5e3[_0xdd23('0x23')](_0x4f53fa)[_0xdd23('0x24')](function(_0x98a2be){return _0x98a2be;});}return null;};}function removeEntity(_0x151dd5,_0x65feab){return function(_0x15d80c){if(_0x15d80c){return _0x15d80c[_0xdd23('0x25')]()[_0xdd23('0x24')](function(){var _0x395b2e=_0x15d80c[_0xdd23('0x26')]({'plain':!![]});var _0x21834a=_0xdd23('0x27');return db[_0xdd23('0x28')][_0xdd23('0x25')]({'where':{'type':_0x21834a,'resourceId':_0x395b2e['id']}})['then'](function(){return _0x15d80c;});})['then'](function(){_0x151dd5[_0xdd23('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300a79,_0x494640){return function(_0x4be3b3){if(!_0x4be3b3){_0x300a79[_0xdd23('0x19')](0x194);}return _0x4be3b3;};}function handleError(_0x3b6eee,_0x4ba8f6){_0x4ba8f6=_0x4ba8f6||0x1f4;return function(_0x25149e){logger[_0xdd23('0x29')](_0x25149e[_0xdd23('0x2a')]);if(_0x25149e['name']){delete _0x25149e[_0xdd23('0x2b')];}_0x3b6eee[_0xdd23('0x1f')](_0x4ba8f6)[_0xdd23('0x2c')](_0x25149e);};}exports[_0xdd23('0x2d')]=function(_0x2da49d,_0x1d3cfd){var _0x1bca59={},_0x46c432={},_0x4aa771={'count':0x0,'rows':[]};var _0x22a302=_[_0xdd23('0x2e')](db['Campaign']['rawAttributes'],function(_0x2f59f3){return{'name':_0x2f59f3['fieldName'],'type':_0x2f59f3[_0xdd23('0x2f')][_0xdd23('0x30')]};});_0x46c432[_0xdd23('0x31')]=_[_0xdd23('0x2e')](_0x22a302,_0xdd23('0x2b'));_0x46c432[_0xdd23('0x32')]=_[_0xdd23('0x33')](_0x2da49d['query']);_0x46c432[_0xdd23('0x34')]=_[_0xdd23('0x35')](_0x46c432[_0xdd23('0x31')],_0x46c432[_0xdd23('0x32')]);_0x1bca59['attributes']=_[_0xdd23('0x35')](_0x46c432[_0xdd23('0x31')],qs['fields'](_0x2da49d[_0xdd23('0x32')]['fields']));_0x1bca59['attributes']=_0x1bca59[_0xdd23('0x36')]['length']?_0x1bca59[_0xdd23('0x36')]:_0x46c432[_0xdd23('0x31')];if(!_0x2da49d[_0xdd23('0x32')][_0xdd23('0x37')](_0xdd23('0x38'))){_0x1bca59['limit']=qs['limit'](_0x2da49d[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x1bca59[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0x2da49d['query'][_0xdd23('0x1b')]);}_0x1bca59[_0xdd23('0x39')]=qs[_0xdd23('0x3a')](_0x2da49d[_0xdd23('0x32')]['sort']);_0x1bca59[_0xdd23('0x3b')]=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x2da49d[_0xdd23('0x32')],_0x46c432[_0xdd23('0x34')]),_0x22a302);if(_0x2da49d[_0xdd23('0x32')][_0xdd23('0x3d')]){_0x1bca59[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x1bca59[_0xdd23('0x3b')],{'$or':_['map'](_0x22a302,function(_0x1f64e2){if(_0x1f64e2[_0xdd23('0x2f')]!=='VIRTUAL'){var _0x7930a6={};_0x7930a6[_0x1f64e2[_0xdd23('0x2b')]]={'$like':'%'+_0x2da49d[_0xdd23('0x32')][_0xdd23('0x3d')]+'%'};return _0x7930a6;}})});}_0x1bca59=_['merge']({},_0x1bca59,_0x2da49d[_0xdd23('0x3f')]);var _0x4967f9={'where':_0x1bca59[_0xdd23('0x3b')]};return db['Campaign']['count'](_0x4967f9)['then'](function(_0x4b2024){_0x4aa771[_0xdd23('0x1e')]=_0x4b2024;if(_0x2da49d[_0xdd23('0x32')][_0xdd23('0x40')]){_0x1bca59['include']=[{'all':!![]}];}return db[_0xdd23('0x41')][_0xdd23('0x42')](_0x1bca59);})[_0xdd23('0x24')](function(_0x32cb33){_0x4aa771[_0xdd23('0x43')]=_0x32cb33;return _0x4aa771;})[_0xdd23('0x24')](respondWithFilteredResult(_0x1d3cfd,_0x1bca59))[_0xdd23('0x44')](handleError(_0x1d3cfd,null));};exports[_0xdd23('0x45')]=function(_0x2f6d90,_0x3075a1){var _0x2fd6f9={'raw':![],'where':{'id':_0x2f6d90[_0xdd23('0x46')]['id']}},_0x59a7de={};_0x59a7de[_0xdd23('0x31')]=_[_0xdd23('0x33')](db[_0xdd23('0x41')][_0xdd23('0x47')]);_0x59a7de[_0xdd23('0x32')]=_[_0xdd23('0x33')](_0x2f6d90[_0xdd23('0x32')]);_0x59a7de[_0xdd23('0x34')]=_['intersection'](_0x59a7de['model'],_0x59a7de['query']);_0x2fd6f9[_0xdd23('0x36')]=_[_0xdd23('0x35')](_0x59a7de[_0xdd23('0x31')],qs[_0xdd23('0x48')](_0x2f6d90['query'][_0xdd23('0x48')]));_0x2fd6f9[_0xdd23('0x36')]=_0x2fd6f9[_0xdd23('0x36')][_0xdd23('0x49')]?_0x2fd6f9[_0xdd23('0x36')]:_0x59a7de['model'];if(_0x2f6d90[_0xdd23('0x32')][_0xdd23('0x40')]){_0x2fd6f9['include']=[{'all':!![]}];}_0x2fd6f9=_[_0xdd23('0x3e')]({},_0x2fd6f9,_0x2f6d90['options']);return db[_0xdd23('0x41')][_0xdd23('0x4a')](_0x2fd6f9)[_0xdd23('0x24')](handleEntityNotFound(_0x3075a1,null))['then'](respondWithResult(_0x3075a1,null))['catch'](handleError(_0x3075a1,null));};exports[_0xdd23('0x4b')]=function(_0x411e2f,_0x298a17){return db[_0xdd23('0x41')][_0xdd23('0x4b')](_0x411e2f[_0xdd23('0x4c')],{})[_0xdd23('0x24')](function(_0x300c1a){var _0x409339=_0x411e2f['user'][_0xdd23('0x26')]({'plain':!![]});if(!_0x409339)throw new Error(_0xdd23('0x4d'));if(_0x409339[_0xdd23('0x4e')]===_0xdd23('0x4f')){var _0x51aaee=_0x300c1a[_0xdd23('0x26')]({'plain':!![]});var _0x3a9039=_0xdd23('0x27');return db[_0xdd23('0x50')][_0xdd23('0x4a')]({'where':{'name':_0x3a9039,'userProfileId':_0x409339[_0xdd23('0x51')]},'raw':!![]})['then'](function(_0x4f2b2f){if(_0x4f2b2f&&_0x4f2b2f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x51aaee['name'],'resourceId':_0x51aaee['id'],'type':_0x4f2b2f[_0xdd23('0x2b')],'sectionId':_0x4f2b2f['id']},{})[_0xdd23('0x24')](function(){return _0x300c1a;});}else{return _0x300c1a;}})['catch'](function(_0x4b3020){logger[_0xdd23('0x29')](_0xdd23('0x52'),_0x4b3020);throw _0x4b3020;});}return _0x300c1a;})[_0xdd23('0x24')](respondWithResult(_0x298a17,0xc9))[_0xdd23('0x44')](handleError(_0x298a17,null));};exports[_0xdd23('0x53')]=function(_0x1eb8a8,_0x3c8caf){var _0x1f4552={'where':{'id':_0x1eb8a8[_0xdd23('0x46')]['id']}},_0x153111={};_0x153111[_0xdd23('0x31')]=_[_0xdd23('0x33')](db[_0xdd23('0x41')]['rawAttributes']);_0x1f4552[_0xdd23('0x36')]=_['intersection'](_0x153111[_0xdd23('0x31')],qs['fields'](_0x1eb8a8[_0xdd23('0x32')][_0xdd23('0x48')]));_0x1f4552[_0xdd23('0x36')]=_0x1f4552[_0xdd23('0x36')][_0xdd23('0x49')]?_0x1f4552[_0xdd23('0x36')]:_0x153111[_0xdd23('0x31')];if(_0x1eb8a8[_0xdd23('0x32')][_0xdd23('0x40')]){_0x1f4552[_0xdd23('0x54')]=[{'all':!![]}];}_0x1f4552=_[_0xdd23('0x3e')]({},_0x1f4552,_0x1eb8a8[_0xdd23('0x3f')]);return db[_0xdd23('0x41')][_0xdd23('0x4a')](_0x1f4552)[_0xdd23('0x24')](handleEntityNotFound(_0x3c8caf,null))[_0xdd23('0x24')](function(_0x437432){if(_0x437432){var _0x44344e=_0x437432[_0xdd23('0x26')]({'plain':!![]});_0x44344e=qs['omit'](_0x44344e,['id',_0xdd23('0x55'),'updatedAt']);_0x1eb8a8[_0xdd23('0x4c')]=_['omit'](_0x1eb8a8[_0xdd23('0x4c')],['id',_0xdd23('0x55'),_0xdd23('0x56')]);return db[_0xdd23('0x41')][_0xdd23('0x4b')](_[_0xdd23('0x3e')](_0x44344e,_0x1eb8a8[_0xdd23('0x4c')]),{'include':_0x1eb8a8[_0xdd23('0x32')][_0xdd23('0x40')]?[{'all':!![]}]:undefined})[_0xdd23('0x24')](function(_0x37ed33){var _0x5e16b0=_0x1eb8a8[_0xdd23('0x4f')][_0xdd23('0x26')]({'plain':!![]});if(!_0x5e16b0)throw new Error(_0xdd23('0x4d'));if(_0x5e16b0[_0xdd23('0x4e')]===_0xdd23('0x4f')){var _0x235af3=_0x37ed33['get']({'plain':!![]});var _0x430ecf='IvrCampaigns';return db[_0xdd23('0x50')][_0xdd23('0x4a')]({'where':{'name':_0x430ecf,'userProfileId':_0x5e16b0[_0xdd23('0x51')]},'raw':!![]})[_0xdd23('0x24')](function(_0x34ab17){if(_0x34ab17&&_0x34ab17[_0xdd23('0x57')]===0x0){return db['UserProfileResource'][_0xdd23('0x4b')]({'name':_0x235af3[_0xdd23('0x2b')],'resourceId':_0x235af3['id'],'type':_0x34ab17['name'],'sectionId':_0x34ab17['id']},{})[_0xdd23('0x24')](function(){return _0x37ed33;});}else{return _0x37ed33;}})['catch'](function(_0x40eca1){logger[_0xdd23('0x29')](_0xdd23('0x52'),_0x40eca1);throw _0x40eca1;});}return _0x37ed33;});}})[_0xdd23('0x24')](respondWithResult(_0x3c8caf,0xc9))[_0xdd23('0x44')](handleError(_0x3c8caf,null));};exports[_0xdd23('0x23')]=function(_0x1aebe8,_0x516705){if(_0x1aebe8[_0xdd23('0x4c')]['id']){delete _0x1aebe8['body']['id'];}return db['Campaign'][_0xdd23('0x4a')]({'where':{'id':_0x1aebe8[_0xdd23('0x46')]['id']}})['then'](handleEntityNotFound(_0x516705,null))[_0xdd23('0x24')](saveUpdates(_0x1aebe8[_0xdd23('0x4c')],null))['then'](respondWithResult(_0x516705,null))['catch'](handleError(_0x516705,null));};exports[_0xdd23('0x25')]=function(_0x3c7e07,_0x4b84b3){return db[_0xdd23('0x41')]['find']({'where':{'id':_0x3c7e07[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x4b84b3,null))[_0xdd23('0x24')](removeEntity(_0x4b84b3,null))[_0xdd23('0x44')](handleError(_0x4b84b3,null));};exports[_0xdd23('0x58')]=function(_0xf90c83,_0x3d214d,_0x405edc){var _0x4bdcef={'raw':!![],'where':{}};var _0x5581b6={};var _0x4fc65c={'count':0x0,'rows':[]};return db[_0xdd23('0x41')][_0xdd23('0x59')]({'where':{'id':_0xf90c83[_0xdd23('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d214d,null))[_0xdd23('0x24')](function(_0xac8e67){if(_0xac8e67){_0x5581b6[_0xdd23('0x31')]=_[_0xdd23('0x33')](db['CmHopper'][_0xdd23('0x47')]);_0x5581b6[_0xdd23('0x32')]=_[_0xdd23('0x33')](_0xf90c83[_0xdd23('0x32')]);_0x5581b6[_0xdd23('0x34')]=_[_0xdd23('0x35')](_0x5581b6[_0xdd23('0x31')],_0x5581b6['query']);_0x4bdcef[_0xdd23('0x36')]=_[_0xdd23('0x35')](_0x5581b6['model'],qs[_0xdd23('0x48')](_0xf90c83[_0xdd23('0x32')][_0xdd23('0x48')]));_0x4bdcef['attributes']=_0x4bdcef[_0xdd23('0x36')][_0xdd23('0x49')]?_0x4bdcef[_0xdd23('0x36')]:_0x5581b6[_0xdd23('0x31')];if(!_0xf90c83[_0xdd23('0x32')][_0xdd23('0x37')](_0xdd23('0x38'))){_0x4bdcef['limit']=qs['limit'](_0xf90c83[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x4bdcef[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0xf90c83['query'][_0xdd23('0x1b')]);}_0x4bdcef[_0xdd23('0x39')]=qs['sort'](_0xf90c83[_0xdd23('0x32')][_0xdd23('0x3a')]);_0x4bdcef[_0xdd23('0x3b')]=qs['filters'](_[_0xdd23('0x3c')](_0xf90c83[_0xdd23('0x32')],_0x5581b6['filters']));_0x4bdcef['where'][_0xdd23('0x5a')]=_0xac8e67['id'];if(_0xf90c83[_0xdd23('0x32')][_0xdd23('0x3d')]){_0x4bdcef[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x4bdcef[_0xdd23('0x3b')],{'$or':_[_0xdd23('0x2e')](_0x4bdcef['attributes'],function(_0x1b32d5){var _0x4816f2={};_0x4816f2[_0x1b32d5]={'$like':'%'+_0xf90c83[_0xdd23('0x32')]['filter']+'%'};return _0x4816f2;})});}_0x4bdcef=_[_0xdd23('0x3e')]({},_0x4bdcef,_0xf90c83[_0xdd23('0x3f')]);return db['CmHopper']['count']({'where':_0x4bdcef[_0xdd23('0x3b')]})[_0xdd23('0x24')](function(_0x40307d){_0x4fc65c[_0xdd23('0x1e')]=_0x40307d;if(_0xf90c83[_0xdd23('0x32')]['includeAll']){_0x4bdcef[_0xdd23('0x54')]=[{'all':!![]}];}return db[_0xdd23('0x5b')][_0xdd23('0x42')](_0x4bdcef);})[_0xdd23('0x24')](function(_0x10b29a){_0x4fc65c['rows']=_0x10b29a;return _0x4fc65c;});}})[_0xdd23('0x24')](respondWithFilteredResult(_0x3d214d,_0x4bdcef))[_0xdd23('0x44')](handleError(_0x3d214d,null));};exports[_0xdd23('0x5c')]=function(_0x5684cf,_0x54d366,_0x1d277e){var _0x4a2491={'raw':!![],'where':{}};var _0x156108={};var _0x5925b9={'count':0x0,'rows':[]};return db['Campaign'][_0xdd23('0x59')]({'where':{'id':_0x5684cf[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x54d366,null))[_0xdd23('0x24')](function(_0x533e64){if(_0x533e64){_0x156108[_0xdd23('0x31')]=_[_0xdd23('0x33')](db['CmHopperHistory'][_0xdd23('0x47')]);_0x156108[_0xdd23('0x32')]=_[_0xdd23('0x33')](_0x5684cf['query']);_0x156108[_0xdd23('0x34')]=_['intersection'](_0x156108[_0xdd23('0x31')],_0x156108[_0xdd23('0x32')]);_0x4a2491[_0xdd23('0x36')]=_[_0xdd23('0x35')](_0x156108['model'],qs[_0xdd23('0x48')](_0x5684cf['query'][_0xdd23('0x48')]));_0x4a2491[_0xdd23('0x36')]=_0x4a2491[_0xdd23('0x36')][_0xdd23('0x49')]?_0x4a2491[_0xdd23('0x36')]:_0x156108[_0xdd23('0x31')];if(!_0x5684cf[_0xdd23('0x32')][_0xdd23('0x37')](_0xdd23('0x38'))){_0x4a2491[_0xdd23('0x1d')]=qs[_0xdd23('0x1d')](_0x5684cf[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x4a2491[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0x5684cf['query']['offset']);}_0x4a2491[_0xdd23('0x39')]=qs[_0xdd23('0x3a')](_0x5684cf['query'][_0xdd23('0x3a')]);_0x4a2491[_0xdd23('0x3b')]=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x5684cf[_0xdd23('0x32')],_0x156108[_0xdd23('0x34')]));_0x4a2491[_0xdd23('0x3b')][_0xdd23('0x5a')]=_0x533e64['id'];if(_0x5684cf[_0xdd23('0x32')]['filter']){_0x4a2491[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x4a2491[_0xdd23('0x3b')],{'$or':_['map'](_0x4a2491[_0xdd23('0x36')],function(_0x4f963e){var _0x5e1fd6={};_0x5e1fd6[_0x4f963e]={'$like':'%'+_0x5684cf[_0xdd23('0x32')]['filter']+'%'};return _0x5e1fd6;})});}_0x4a2491=_[_0xdd23('0x3e')]({},_0x4a2491,_0x5684cf['options']);return db[_0xdd23('0x5d')][_0xdd23('0x1e')]({'where':_0x4a2491[_0xdd23('0x3b')]})[_0xdd23('0x24')](function(_0x19f38c){_0x5925b9[_0xdd23('0x1e')]=_0x19f38c;if(_0x5684cf[_0xdd23('0x32')][_0xdd23('0x40')]){_0x4a2491[_0xdd23('0x54')]=[{'all':!![]}];}return db[_0xdd23('0x5d')][_0xdd23('0x42')](_0x4a2491);})['then'](function(_0x419803){_0x5925b9[_0xdd23('0x43')]=_0x419803;return _0x5925b9;});}})[_0xdd23('0x24')](respondWithFilteredResult(_0x54d366,_0x4a2491))['catch'](handleError(_0x54d366,null));};exports[_0xdd23('0x5e')]=function(_0x384c50,_0xcf2142,_0x5605d7){var _0x4144c5={'raw':!![],'where':{}};var _0x5d1146={};var _0x28a07e={'count':0x0,'rows':[]};return db[_0xdd23('0x41')][_0xdd23('0x59')]({'where':{'id':_0x384c50['params']['id']}})['then'](handleEntityNotFound(_0xcf2142,null))['then'](function(_0x9ef648){if(_0x9ef648){_0x5d1146['model']=_[_0xdd23('0x33')](db['CmHopperFinal'][_0xdd23('0x47')]);_0x5d1146['query']=_[_0xdd23('0x33')](_0x384c50[_0xdd23('0x32')]);_0x5d1146[_0xdd23('0x34')]=_[_0xdd23('0x35')](_0x5d1146['model'],_0x5d1146[_0xdd23('0x32')]);_0x4144c5[_0xdd23('0x36')]=_[_0xdd23('0x35')](_0x5d1146['model'],qs['fields'](_0x384c50[_0xdd23('0x32')]['fields']));_0x4144c5['attributes']=_0x4144c5[_0xdd23('0x36')][_0xdd23('0x49')]?_0x4144c5[_0xdd23('0x36')]:_0x5d1146['model'];if(!_0x384c50[_0xdd23('0x32')][_0xdd23('0x37')](_0xdd23('0x38'))){_0x4144c5[_0xdd23('0x1d')]=qs['limit'](_0x384c50[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x4144c5[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0x384c50[_0xdd23('0x32')][_0xdd23('0x1b')]);}_0x4144c5['order']=qs[_0xdd23('0x3a')](_0x384c50[_0xdd23('0x32')][_0xdd23('0x3a')]);_0x4144c5['where']=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x384c50[_0xdd23('0x32')],_0x5d1146[_0xdd23('0x34')]));_0x4144c5[_0xdd23('0x3b')][_0xdd23('0x5a')]=_0x9ef648['id'];if(_0x384c50['query'][_0xdd23('0x3d')]){_0x4144c5[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x4144c5[_0xdd23('0x3b')],{'$or':_[_0xdd23('0x2e')](_0x4144c5['attributes'],function(_0x18c8e8){var _0x382975={};_0x382975[_0x18c8e8]={'$like':'%'+_0x384c50['query'][_0xdd23('0x3d')]+'%'};return _0x382975;})});}_0x4144c5=_[_0xdd23('0x3e')]({},_0x4144c5,_0x384c50[_0xdd23('0x3f')]);return db[_0xdd23('0x5f')][_0xdd23('0x1e')]({'where':_0x4144c5[_0xdd23('0x3b')]})['then'](function(_0x2fdf72){_0x28a07e[_0xdd23('0x1e')]=_0x2fdf72;if(_0x384c50['query'][_0xdd23('0x40')]){_0x4144c5[_0xdd23('0x54')]=[{'all':!![]}];}return db[_0xdd23('0x5f')]['findAll'](_0x4144c5);})['then'](function(_0x55e784){_0x28a07e[_0xdd23('0x43')]=_0x55e784;return _0x28a07e;});}})[_0xdd23('0x24')](respondWithFilteredResult(_0xcf2142,_0x4144c5))[_0xdd23('0x44')](handleError(_0xcf2142,null));};exports[_0xdd23('0x60')]=function(_0x4c1f07,_0x516bfe,_0x44353a){var _0xa92e0f={'raw':!![],'where':{}};var _0xca94e7={};var _0xf9054={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4c1f07[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x516bfe,null))['then'](function(_0xe88418){if(_0xe88418){_0xca94e7['model']=_[_0xdd23('0x33')](db[_0xdd23('0x61')]['rawAttributes']);_0xca94e7[_0xdd23('0x32')]=_['keys'](_0x4c1f07['query']);_0xca94e7['filters']=_[_0xdd23('0x35')](_0xca94e7[_0xdd23('0x31')],_0xca94e7['query']);_0xa92e0f[_0xdd23('0x36')]=_['intersection'](_0xca94e7[_0xdd23('0x31')],qs[_0xdd23('0x48')](_0x4c1f07['query'][_0xdd23('0x48')]));_0xa92e0f['attributes']=_0xa92e0f[_0xdd23('0x36')][_0xdd23('0x49')]?_0xa92e0f[_0xdd23('0x36')]:_0xca94e7[_0xdd23('0x31')];if(!_0x4c1f07[_0xdd23('0x32')]['hasOwnProperty'](_0xdd23('0x38'))){_0xa92e0f[_0xdd23('0x1d')]=qs[_0xdd23('0x1d')](_0x4c1f07[_0xdd23('0x32')][_0xdd23('0x1d')]);_0xa92e0f[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0x4c1f07['query'][_0xdd23('0x1b')]);}_0xa92e0f[_0xdd23('0x39')]=qs[_0xdd23('0x3a')](_0x4c1f07[_0xdd23('0x32')]['sort']);_0xa92e0f[_0xdd23('0x3b')]=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x4c1f07[_0xdd23('0x32')],_0xca94e7[_0xdd23('0x34')]));_0xa92e0f[_0xdd23('0x3b')][_0xdd23('0x5a')]=_0xe88418['id'];if(_0x4c1f07[_0xdd23('0x32')][_0xdd23('0x3d')]){_0xa92e0f['where']=_[_0xdd23('0x3e')](_0xa92e0f[_0xdd23('0x3b')],{'$or':_['map'](_0xa92e0f[_0xdd23('0x36')],function(_0x3a0a98){var _0x35c7ec={};_0x35c7ec[_0x3a0a98]={'$like':'%'+_0x4c1f07['query'][_0xdd23('0x3d')]+'%'};return _0x35c7ec;})});}_0xa92e0f=_['merge']({},_0xa92e0f,_0x4c1f07[_0xdd23('0x3f')]);return db['CmHopperBlack'][_0xdd23('0x1e')]({'where':_0xa92e0f[_0xdd23('0x3b')]})[_0xdd23('0x24')](function(_0x319c68){_0xf9054[_0xdd23('0x1e')]=_0x319c68;if(_0x4c1f07['query'][_0xdd23('0x40')]){_0xa92e0f[_0xdd23('0x54')]=[{'all':!![]}];}return db[_0xdd23('0x61')][_0xdd23('0x42')](_0xa92e0f);})[_0xdd23('0x24')](function(_0x278dbe){_0xf9054[_0xdd23('0x43')]=_0x278dbe;return _0xf9054;});}})['then'](respondWithFilteredResult(_0x516bfe,_0xa92e0f))[_0xdd23('0x44')](handleError(_0x516bfe,null));};exports[_0xdd23('0x62')]=function(_0x20d298,_0xd76c54,_0x3aa381){var _0x2d05fc={};var _0x52501a={};var _0x5112ee;var _0x10bbeb;return db[_0xdd23('0x41')][_0xdd23('0x59')]({'where':{'id':_0x20d298[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0xd76c54,null))[_0xdd23('0x24')](function(_0x4dc0a6){if(_0x4dc0a6){_0x5112ee=_0x4dc0a6;_0x52501a['model']=_['keys'](db[_0xdd23('0x63')]['rawAttributes']);_0x52501a[_0xdd23('0x32')]=_[_0xdd23('0x33')](_0x20d298['query']);_0x52501a[_0xdd23('0x34')]=_[_0xdd23('0x35')](_0x52501a['model'],_0x52501a[_0xdd23('0x32')]);_0x2d05fc[_0xdd23('0x36')]=_['intersection'](_0x52501a[_0xdd23('0x31')],qs[_0xdd23('0x48')](_0x20d298[_0xdd23('0x32')][_0xdd23('0x48')]));_0x2d05fc['attributes']=_0x2d05fc[_0xdd23('0x36')][_0xdd23('0x49')]?_0x2d05fc[_0xdd23('0x36')]:_0x52501a[_0xdd23('0x31')];_0x2d05fc[_0xdd23('0x39')]=qs[_0xdd23('0x3a')](_0x20d298[_0xdd23('0x32')][_0xdd23('0x3a')]);_0x2d05fc['where']=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x20d298[_0xdd23('0x32')],_0x52501a[_0xdd23('0x34')]));if(_0x20d298[_0xdd23('0x32')]['filter']){_0x2d05fc[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x2d05fc[_0xdd23('0x3b')],{'$or':_['map'](_0x2d05fc[_0xdd23('0x36')],function(_0x2b0d8d){var _0x56486c={};_0x56486c[_0x2b0d8d]={'$like':'%'+_0x20d298[_0xdd23('0x32')][_0xdd23('0x3d')]+'%'};return _0x56486c;})});}_0x2d05fc=_[_0xdd23('0x3e')]({},_0x2d05fc,_0x20d298[_0xdd23('0x3f')]);return _0x5112ee[_0xdd23('0x62')](_0x2d05fc);}})[_0xdd23('0x24')](function(_0x3c28c1){if(_0x3c28c1){_0x10bbeb=_0x3c28c1[_0xdd23('0x49')];if(!_0x20d298[_0xdd23('0x32')][_0xdd23('0x37')]('nolimit')){_0x2d05fc[_0xdd23('0x1d')]=qs[_0xdd23('0x1d')](_0x20d298[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x2d05fc[_0xdd23('0x1b')]=qs[_0xdd23('0x1b')](_0x20d298[_0xdd23('0x32')][_0xdd23('0x1b')]);}return _0x5112ee[_0xdd23('0x62')](_0x2d05fc);}})[_0xdd23('0x24')](function(_0x1f2d3a){if(_0x1f2d3a){return _0x1f2d3a?{'count':_0x10bbeb,'rows':_0x1f2d3a}:null;}})[_0xdd23('0x24')](respondWithResult(_0xd76c54,null))[_0xdd23('0x44')](handleError(_0xd76c54,null));};exports[_0xdd23('0x64')]=function(_0x422272,_0x52710b,_0x28ce54){var _0x2026e3,_0x366598;var _0x3b2fc=[];var _0x71b74=moment()[_0xdd23('0x65')](_0xdd23('0x66'));return db[_0xdd23('0x41')][_0xdd23('0x4a')]({'where':{'id':_0x422272[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x52710b,null))['then'](function(_0x1bfe43){if(_0x1bfe43){_0x366598=_0x1bfe43;return _0x1bfe43['addLists'](_0x422272[_0xdd23('0x4c')][_0xdd23('0x67')],_['omit'](_0x422272['body'],[_0xdd23('0x67'),'id'])||{});}return null;})[_0xdd23('0x68')](function(_0x386362){var _0x567587;var _0x4ad48e;_0x2026e3=_0x386362||[];var _0x19cb65=[];if(_0x386362){for(var _0x2b8b32=0x0;_0x2b8b32<_0x386362[_0xdd23('0x49')];_0x2b8b32+=0x1){var _0x11e198=_0x386362[_0x2b8b32]['get']({'plain':!![]});_0x366598['dialCheckDuplicateType']=_0x422272[_0xdd23('0x4c')][_0xdd23('0x69')]?_0x422272[_0xdd23('0x4c')]['dialCheckDuplicateType']:_0x366598[_0xdd23('0x69')];switch(_0x366598[_0xdd23('0x69')]){case'always':_0x567587=squel[_0xdd23('0x6a')]()['into'](_0xdd23('0x6b'))['fromQuery']([_0xdd23('0x6c'),_0xdd23('0x6d'),_0xdd23('0x6e'),'ListId','CampaignId',_0xdd23('0x55'),_0xdd23('0x56')],squel['select']()[_0xdd23('0x6f')]('phone','phone')[_0xdd23('0x6f')]('NOW()',_0xdd23('0x6d'))[_0xdd23('0x6f')]('id',_0xdd23('0x6e'))['field'](_0x11e198[_0xdd23('0x70')]['toString'](),_0xdd23('0x71'))[_0xdd23('0x6f')](_0x422272[_0xdd23('0x46')]['id'][_0xdd23('0x72')](),_0xdd23('0x5a'))[_0xdd23('0x6f')]('\x27'+_0x71b74+'\x27','createdAt')['field']('\x27'+_0x71b74+'\x27',_0xdd23('0x56'))['from'](_0xdd23('0x73'))[_0xdd23('0x3b')](_0xdd23('0x74'))[_0xdd23('0x3b')](_0xdd23('0x75'),_0x11e198['CmListId'][_0xdd23('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xdd23('0x76'),squel[_0xdd23('0x77')]()[_0xdd23('0x6f')](_0xdd23('0x78'))[_0xdd23('0x79')]('cm_hopper_final')[_0xdd23('0x3b')](_0xdd23('0x7a'),_0x422272[_0xdd23('0x46')]['id'][_0xdd23('0x72')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdd23('0x77')]()[_0xdd23('0x6f')]('COALESCE(phone,\x27\x27)')[_0xdd23('0x79')](_0xdd23('0x6b'))[_0xdd23('0x3b')]('CampaignId\x20=\x20?',_0x422272['params']['id']['toString']())))[_0xdd23('0x72')]();break;case _0xdd23('0x7b'):_0x567587=squel[_0xdd23('0x6a')]()[_0xdd23('0x7c')](_0xdd23('0x6b'))[_0xdd23('0x7d')](['phone','scheduledAt','ContactId',_0xdd23('0x71'),_0xdd23('0x5a'),'createdAt',_0xdd23('0x56')],squel[_0xdd23('0x77')]()[_0xdd23('0x6f')](_0xdd23('0x6c'),'phone')[_0xdd23('0x6f')](_0xdd23('0x7e'),_0xdd23('0x6d'))[_0xdd23('0x6f')]('id','ContactId')[_0xdd23('0x6f')](_0x11e198[_0xdd23('0x70')][_0xdd23('0x72')](),'ListId')['field'](_0x422272[_0xdd23('0x46')]['id']['toString'](),'CampaignId')[_0xdd23('0x6f')]('\x27'+_0x71b74+'\x27',_0xdd23('0x55'))[_0xdd23('0x6f')]('\x27'+_0x71b74+'\x27',_0xdd23('0x56'))['from'](_0xdd23('0x73'))[_0xdd23('0x3b')](_0xdd23('0x74'))[_0xdd23('0x3b')](_0xdd23('0x75'),_0x11e198[_0xdd23('0x70')][_0xdd23('0x72')]())[_0xdd23('0x3b')](_0xdd23('0x7f'))['where'](_0xdd23('0x76'),squel[_0xdd23('0x77')]()[_0xdd23('0x6f')](_0xdd23('0x80'))[_0xdd23('0x79')]('cm_hopper')['where'](_0xdd23('0x7a'),_0x422272['params']['id'][_0xdd23('0x72')]())))[_0xdd23('0x72')]();break;default:_0x567587=squel[_0xdd23('0x6a')]()[_0xdd23('0x7c')](_0xdd23('0x6b'))[_0xdd23('0x7d')](['phone',_0xdd23('0x6d'),_0xdd23('0x6e'),_0xdd23('0x71'),_0xdd23('0x5a'),_0xdd23('0x55'),_0xdd23('0x56')],squel[_0xdd23('0x77')]()[_0xdd23('0x6f')](_0xdd23('0x6c'),'phone')[_0xdd23('0x6f')](_0xdd23('0x7e'),_0xdd23('0x6d'))[_0xdd23('0x6f')]('id',_0xdd23('0x6e'))[_0xdd23('0x6f')](_0x11e198[_0xdd23('0x70')][_0xdd23('0x72')](),_0xdd23('0x71'))[_0xdd23('0x6f')](_0x422272[_0xdd23('0x46')]['id'][_0xdd23('0x72')](),_0xdd23('0x5a'))[_0xdd23('0x6f')]('\x27'+_0x71b74+'\x27','createdAt')['field']('\x27'+_0x71b74+'\x27','updatedAt')['from'](_0xdd23('0x73'))[_0xdd23('0x3b')](_0xdd23('0x74'))[_0xdd23('0x3b')](_0xdd23('0x75'),_0x11e198[_0xdd23('0x70')]['toString']())['where'](_0xdd23('0x7f')))[_0xdd23('0x72')]();}_0x4ad48e=squel[_0xdd23('0x6a')]()[_0xdd23('0x7c')](_0xdd23('0x81'))[_0xdd23('0x7d')](['cmHopperId',_0xdd23('0x6d'),_0xdd23('0x6c'),_0xdd23('0x82'),'createdAt',_0xdd23('0x56')],squel[_0xdd23('0x77')]()['field'](_0xdd23('0x83'),'id')[_0xdd23('0x6f')](_0xdd23('0x7e'),'scheduledAt')[_0xdd23('0x6f')]('ci.item',_0xdd23('0x6c'))[_0xdd23('0x6f')](_0xdd23('0x84'),_0xdd23('0x82'))['field']('\x27'+_0x71b74+'\x27','createdAt')['field']('\x27'+_0x71b74+'\x27',_0xdd23('0x56'))[_0xdd23('0x79')]('cm_contact_has_items','ci')['join'](_0xdd23('0x6b'),'h',_0xdd23('0x85'))[_0xdd23('0x3b')](_0xdd23('0x86'),_0x11e198[_0xdd23('0x70')][_0xdd23('0x72')]())[_0xdd23('0x3b')](_0xdd23('0x87'),_0x422272['params']['id']['toString']())[_0xdd23('0x3b')](_0xdd23('0x88'),_0x71b74))[_0xdd23('0x72')]();_0x19cb65[_0xdd23('0x89')](db[_0xdd23('0x8a')]['query'](_0x567587));_0x3b2fc[_0xdd23('0x89')](db[_0xdd23('0x8a')]['query'](_0x4ad48e));}return BPromise[_0xdd23('0x8b')](_0x19cb65);}})[_0xdd23('0x24')](function(){return BPromise[_0xdd23('0x8b')](_0x3b2fc);})[_0xdd23('0x24')](function(){return _0x2026e3;})[_0xdd23('0x24')](respondWithResult(_0x52710b,null))[_0xdd23('0x44')](handleError(_0x52710b,null));};exports[_0xdd23('0x8c')]=function(_0x57da4f,_0x55f2b1,_0x5ef3d3){return db[_0xdd23('0x41')][_0xdd23('0x4a')]({'where':{'id':_0x57da4f['params']['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x55f2b1,null))[_0xdd23('0x24')](function(_0x49aaed){if(_0x49aaed){return _0x49aaed[_0xdd23('0x8c')](_0x57da4f['query'][_0xdd23('0x67')]);}})[_0xdd23('0x24')](function(_0x2e56f3){if(_0x2e56f3){return db['CmHopper']['destroy']({'where':{'ListId':_0x57da4f[_0xdd23('0x32')][_0xdd23('0x67')],'CampaignId':_0x57da4f['params']['id']}})[_0xdd23('0x24')](function(){return _0x2e56f3;});}})['then'](respondWithStatusCode(_0x55f2b1,null))['catch'](handleError(_0x55f2b1,null));};exports[_0xdd23('0x8d')]=function(_0x5e9b6c,_0x34ae36,_0x133cc3){var _0x163d5a={};var _0x285fd9={};var _0x489c29;var _0x1e15fc;return db[_0xdd23('0x41')][_0xdd23('0x59')]({'where':{'id':_0x5e9b6c['params']['id']}})['then'](handleEntityNotFound(_0x34ae36,null))[_0xdd23('0x24')](function(_0x3c2965){if(_0x3c2965){_0x489c29=_0x3c2965;_0x285fd9[_0xdd23('0x31')]=_[_0xdd23('0x33')](db[_0xdd23('0x63')]['rawAttributes']);_0x285fd9[_0xdd23('0x32')]=_['keys'](_0x5e9b6c[_0xdd23('0x32')]);_0x285fd9[_0xdd23('0x34')]=_[_0xdd23('0x35')](_0x285fd9[_0xdd23('0x31')],_0x285fd9['query']);_0x163d5a[_0xdd23('0x36')]=_[_0xdd23('0x35')](_0x285fd9[_0xdd23('0x31')],qs[_0xdd23('0x48')](_0x5e9b6c['query']['fields']));_0x163d5a[_0xdd23('0x36')]=_0x163d5a[_0xdd23('0x36')][_0xdd23('0x49')]?_0x163d5a[_0xdd23('0x36')]:_0x285fd9[_0xdd23('0x31')];_0x163d5a[_0xdd23('0x39')]=qs[_0xdd23('0x3a')](_0x5e9b6c[_0xdd23('0x32')][_0xdd23('0x3a')]);_0x163d5a[_0xdd23('0x3b')]=qs[_0xdd23('0x34')](_[_0xdd23('0x3c')](_0x5e9b6c[_0xdd23('0x32')],_0x285fd9[_0xdd23('0x34')]));if(_0x5e9b6c[_0xdd23('0x32')][_0xdd23('0x3d')]){_0x163d5a[_0xdd23('0x3b')]=_[_0xdd23('0x3e')](_0x163d5a[_0xdd23('0x3b')],{'$or':_['map'](_0x163d5a['attributes'],function(_0x23e241){var _0xfa10aa={};_0xfa10aa[_0x23e241]={'$like':'%'+_0x5e9b6c[_0xdd23('0x32')][_0xdd23('0x3d')]+'%'};return _0xfa10aa;})});}_0x163d5a=_['merge']({},_0x163d5a,_0x5e9b6c[_0xdd23('0x3f')]);return _0x489c29['getBlackLists'](_0x163d5a);}})[_0xdd23('0x24')](function(_0x256464){if(_0x256464){_0x1e15fc=_0x256464[_0xdd23('0x49')];if(!_0x5e9b6c['query'][_0xdd23('0x37')](_0xdd23('0x38'))){_0x163d5a[_0xdd23('0x1d')]=qs[_0xdd23('0x1d')](_0x5e9b6c[_0xdd23('0x32')][_0xdd23('0x1d')]);_0x163d5a[_0xdd23('0x1b')]=qs['offset'](_0x5e9b6c['query'][_0xdd23('0x1b')]);}return _0x489c29['getBlackLists'](_0x163d5a);}})[_0xdd23('0x24')](function(_0x5eb022){if(_0x5eb022){return _0x5eb022?{'count':_0x1e15fc,'rows':_0x5eb022}:null;}})[_0xdd23('0x24')](respondWithResult(_0x34ae36,null))[_0xdd23('0x44')](handleError(_0x34ae36,null));};exports[_0xdd23('0x8e')]=function(_0x254bc3,_0x359f29,_0x321478){var _0x86a25d,_0x553764;var _0x38b37c=[];var _0x17a30f=moment()[_0xdd23('0x65')](_0xdd23('0x66'));return db[_0xdd23('0x41')][_0xdd23('0x4a')]({'where':{'id':_0x254bc3['params']['id']}})['then'](handleEntityNotFound(_0x359f29,null))[_0xdd23('0x24')](function(_0x5caec4){if(_0x5caec4){_0x553764=_0x5caec4;return _0x5caec4[_0xdd23('0x8e')](_0x254bc3[_0xdd23('0x4c')]['ids'],_[_0xdd23('0x8f')](_0x254bc3[_0xdd23('0x4c')],['ids','id'])||{});}return null;})[_0xdd23('0x68')](function(_0x3d4903){var _0x13acf2;var _0x3765bc;_0x86a25d=_0x3d4903||[];var _0x23b230=[];if(_0x3d4903){for(var _0x3cc9f2=0x0;_0x3cc9f2<_0x3d4903[_0xdd23('0x49')];_0x3cc9f2+=0x1){var _0x24afca=_0x3d4903[_0x3cc9f2][_0xdd23('0x26')]({'plain':!![]});_0x13acf2=squel['insert']()['into'](_0xdd23('0x90'))['fromQuery'](['phone',_0xdd23('0x6e'),'ListId',_0xdd23('0x5a'),_0xdd23('0x55'),'updatedAt'],squel[_0xdd23('0x77')]()['field'](_0xdd23('0x6c'),_0xdd23('0x6c'))[_0xdd23('0x6f')]('id',_0xdd23('0x6e'))[_0xdd23('0x6f')](_0x24afca[_0xdd23('0x70')][_0xdd23('0x72')](),'ListId')[_0xdd23('0x6f')](_0x254bc3[_0xdd23('0x46')]['id'][_0xdd23('0x72')](),_0xdd23('0x5a'))[_0xdd23('0x6f')](_0xdd23('0x7e'),_0xdd23('0x55'))[_0xdd23('0x6f')]('NOW()',_0xdd23('0x56'))[_0xdd23('0x79')](_0xdd23('0x73'))['where'](_0xdd23('0x74'))['where'](_0xdd23('0x75'),_0x24afca[_0xdd23('0x70')][_0xdd23('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xdd23('0x72')]();_0x23b230[_0xdd23('0x89')](db[_0xdd23('0x8a')]['query'](_0x13acf2));}return BPromise[_0xdd23('0x8b')](_0x23b230);}})[_0xdd23('0x24')](function(){return _0x86a25d;})[_0xdd23('0x24')](respondWithResult(_0x359f29,null))[_0xdd23('0x44')](handleError(_0x359f29,null));};exports[_0xdd23('0x91')]=function(_0x53608c,_0x557686,_0x1c2938){return db[_0xdd23('0x41')][_0xdd23('0x4a')]({'where':{'id':_0x53608c[_0xdd23('0x46')]['id']}})[_0xdd23('0x24')](handleEntityNotFound(_0x557686,null))['then'](function(_0x173122){if(_0x173122){return _0x173122[_0xdd23('0x91')](_0x53608c['query'][_0xdd23('0x67')]);}})[_0xdd23('0x24')](function(_0xfd512e){if(_0xfd512e){return db[_0xdd23('0x61')][_0xdd23('0x25')]({'where':{'ListId':_0x53608c[_0xdd23('0x32')][_0xdd23('0x67')],'CampaignId':_0x53608c[_0xdd23('0x46')]['id']}})['then'](function(){return _0xfd512e;});}})['then'](respondWithStatusCode(_0x557686,null))['catch'](handleError(_0x557686,null));}; \ No newline at end of file +var _0x241f=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','count','status','Content-Range','apply','reject','update','then','destroy','IvrCampaigns','end','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','UserProfileResource','clone','include','options','updatedAt','omit','createdAt','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','pick','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x433740,_0x5343b2){var _0x472884=function(_0x377c9f){while(--_0x377c9f){_0x433740['push'](_0x433740['shift']());}};_0x472884(++_0x5343b2);}(_0x241f,0x123));var _0xf241=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x241f[_0x7feb90];return _0x3c5b33;};'use strict';var emlformat=require(_0xf241('0x0'));var rimraf=require(_0xf241('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf241('0x2'));var rp=require('request-promise');var moment=require(_0xf241('0x3'));var BPromise=require(_0xf241('0x4'));var Mustache=require(_0xf241('0x5'));var util=require(_0xf241('0x6'));var path=require(_0xf241('0x7'));var sox=require(_0xf241('0x8'));var csv=require('to-csv');var ejs=require(_0xf241('0x9'));var fs=require('fs');var fs_extra=require(_0xf241('0xa'));var _=require(_0xf241('0xb'));var squel=require(_0xf241('0xc'));var crypto=require(_0xf241('0xd'));var jsforce=require(_0xf241('0xe'));var deskjs=require(_0xf241('0xf'));var toCsv=require(_0xf241('0x10'));var querystring=require(_0xf241('0x11'));var Papa=require(_0xf241('0x12'));var Redis=require(_0xf241('0x13'));var authService=require(_0xf241('0x14'));var qs=require(_0xf241('0x15'));var as=require(_0xf241('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf241('0x17'))(_0xf241('0x18'));var utils=require(_0xf241('0x19'));var config=require(_0xf241('0x1a'));var licenseUtil=require(_0xf241('0x1b'));var db=require(_0xf241('0x1c'))['db'];function respondWithStatusCode(_0x3dee4f,_0x39b014){_0x39b014=_0x39b014||0xcc;return function(_0x29bb22){if(_0x29bb22){return _0x3dee4f[_0xf241('0x1d')](_0x39b014);}return _0x3dee4f['status'](_0x39b014)['end']();};}function respondWithResult(_0x3b9ced,_0x171d13){_0x171d13=_0x171d13||0xc8;return function(_0x135569){if(_0x135569){return _0x3b9ced['status'](_0x171d13)[_0xf241('0x1e')](_0x135569);}};}function respondWithFilteredResult(_0x1e7a05,_0x4b1c93){return function(_0x224414){if(_0x224414){var _0x26d295=typeof _0x4b1c93[_0xf241('0x1f')]==='undefined'&&typeof _0x4b1c93[_0xf241('0x20')]==='undefined';var _0x12e82c=_0x224414[_0xf241('0x21')];var _0x4d6d8e=_0x26d295?0x0:_0x4b1c93[_0xf241('0x1f')];var _0x1a7a50=_0x26d295?_0x224414[_0xf241('0x21')]:_0x4b1c93[_0xf241('0x1f')]+_0x4b1c93['limit'];var _0x2a3b8f;if(_0x1a7a50>=_0x12e82c){_0x1a7a50=_0x12e82c;_0x2a3b8f=0xc8;}else{_0x2a3b8f=0xce;}_0x1e7a05[_0xf241('0x22')](_0x2a3b8f);return _0x1e7a05['set'](_0xf241('0x23'),_0x4d6d8e+'-'+_0x1a7a50+'/'+_0x12e82c)[_0xf241('0x1e')](_0x224414);}return null;};}function patchUpdates(_0x391574){return function(_0x599763){try{jsonpatch[_0xf241('0x24')](_0x599763,_0x391574,!![]);}catch(_0x438f38){return BPromise[_0xf241('0x25')](_0x438f38);}return _0x599763['save']();};}function saveUpdates(_0x76775d,_0xa92627){return function(_0x5c10e8){if(_0x5c10e8){return _0x5c10e8[_0xf241('0x26')](_0x76775d)[_0xf241('0x27')](function(_0x1c6424){return _0x1c6424;});}return null;};}function removeEntity(_0x20c9f8,_0x13f1b4){return function(_0x3ccc35){if(_0x3ccc35){return _0x3ccc35[_0xf241('0x28')]()['then'](function(){var _0x310425=_0x3ccc35['get']({'plain':!![]});var _0x40f3a2=_0xf241('0x29');return db['UserProfileResource'][_0xf241('0x28')]({'where':{'type':_0x40f3a2,'resourceId':_0x310425['id']}})['then'](function(){return _0x3ccc35;});})['then'](function(){_0x20c9f8[_0xf241('0x22')](0xcc)[_0xf241('0x2a')]();});}};}function handleEntityNotFound(_0x1acfcd,_0x366ed3){return function(_0x1aa211){if(!_0x1aa211){_0x1acfcd[_0xf241('0x1d')](0x194);}return _0x1aa211;};}function handleError(_0x45ad84,_0x26a13f){_0x26a13f=_0x26a13f||0x1f4;return function(_0x5e934e){logger['error'](_0x5e934e[_0xf241('0x2b')]);if(_0x5e934e[_0xf241('0x2c')]){delete _0x5e934e[_0xf241('0x2c')];}_0x45ad84[_0xf241('0x22')](_0x26a13f)[_0xf241('0x2d')](_0x5e934e);};}exports['index']=function(_0x5e7176,_0x5d0ab2){var _0x5d2cb3={},_0x59798a={},_0x18d4cd={'count':0x0,'rows':[]};var _0x2ad5cc=_[_0xf241('0x2e')](db[_0xf241('0x2f')][_0xf241('0x30')],function(_0x3d5ce6){return{'name':_0x3d5ce6[_0xf241('0x31')],'type':_0x3d5ce6[_0xf241('0x32')][_0xf241('0x33')]};});_0x59798a[_0xf241('0x34')]=_[_0xf241('0x2e')](_0x2ad5cc,_0xf241('0x2c'));_0x59798a[_0xf241('0x35')]=_[_0xf241('0x36')](_0x5e7176[_0xf241('0x35')]);_0x59798a[_0xf241('0x37')]=_['intersection'](_0x59798a['model'],_0x59798a[_0xf241('0x35')]);_0x5d2cb3[_0xf241('0x38')]=_[_0xf241('0x39')](_0x59798a[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x5e7176[_0xf241('0x35')][_0xf241('0x3a')]));_0x5d2cb3[_0xf241('0x38')]=_0x5d2cb3['attributes']['length']?_0x5d2cb3[_0xf241('0x38')]:_0x59798a['model'];if(!_0x5e7176[_0xf241('0x35')][_0xf241('0x3b')](_0xf241('0x3c'))){_0x5d2cb3[_0xf241('0x20')]=qs['limit'](_0x5e7176[_0xf241('0x35')][_0xf241('0x20')]);_0x5d2cb3[_0xf241('0x1f')]=qs['offset'](_0x5e7176[_0xf241('0x35')]['offset']);}_0x5d2cb3[_0xf241('0x3d')]=qs['sort'](_0x5e7176[_0xf241('0x35')][_0xf241('0x3e')]);_0x5d2cb3['where']=qs[_0xf241('0x37')](_['pick'](_0x5e7176[_0xf241('0x35')],_0x59798a['filters']),_0x2ad5cc);if(_0x5e7176[_0xf241('0x35')][_0xf241('0x3f')]){_0x5d2cb3[_0xf241('0x40')]=_['merge'](_0x5d2cb3['where'],{'$or':_[_0xf241('0x2e')](_0x2ad5cc,function(_0x281548){if(_0x281548[_0xf241('0x32')]!==_0xf241('0x41')){var _0x588d41={};_0x588d41[_0x281548[_0xf241('0x2c')]]={'$like':'%'+_0x5e7176[_0xf241('0x35')][_0xf241('0x3f')]+'%'};return _0x588d41;}})});}_0x5d2cb3=_['merge']({},_0x5d2cb3,_0x5e7176['options']);var _0x1658ba={'where':_0x5d2cb3[_0xf241('0x40')]};return db[_0xf241('0x2f')][_0xf241('0x21')](_0x1658ba)[_0xf241('0x27')](function(_0x29b7cc){_0x18d4cd[_0xf241('0x21')]=_0x29b7cc;if(_0x5e7176[_0xf241('0x35')][_0xf241('0x42')]){_0x5d2cb3['include']=[{'all':!![]}];}return db[_0xf241('0x2f')][_0xf241('0x43')](_0x5d2cb3);})[_0xf241('0x27')](function(_0x5ac369){_0x18d4cd[_0xf241('0x44')]=_0x5ac369;return _0x18d4cd;})['then'](respondWithFilteredResult(_0x5d0ab2,_0x5d2cb3))[_0xf241('0x45')](handleError(_0x5d0ab2,null));};exports[_0xf241('0x46')]=function(_0xa0a799,_0x3a85a1){var _0x44791d={'raw':![],'where':{'id':_0xa0a799[_0xf241('0x47')]['id']}},_0xfe89d4={};_0xfe89d4[_0xf241('0x34')]=_['keys'](db[_0xf241('0x2f')][_0xf241('0x30')]);_0xfe89d4[_0xf241('0x35')]=_['keys'](_0xa0a799[_0xf241('0x35')]);_0xfe89d4[_0xf241('0x37')]=_[_0xf241('0x39')](_0xfe89d4[_0xf241('0x34')],_0xfe89d4[_0xf241('0x35')]);_0x44791d[_0xf241('0x38')]=_[_0xf241('0x39')](_0xfe89d4[_0xf241('0x34')],qs[_0xf241('0x3a')](_0xa0a799[_0xf241('0x35')][_0xf241('0x3a')]));_0x44791d[_0xf241('0x38')]=_0x44791d[_0xf241('0x38')][_0xf241('0x48')]?_0x44791d[_0xf241('0x38')]:_0xfe89d4[_0xf241('0x34')];if(_0xa0a799[_0xf241('0x35')][_0xf241('0x42')]){_0x44791d['include']=[{'all':!![]}];}_0x44791d=_[_0xf241('0x49')]({},_0x44791d,_0xa0a799['options']);return db[_0xf241('0x2f')][_0xf241('0x4a')](_0x44791d)['then'](handleEntityNotFound(_0x3a85a1,null))[_0xf241('0x27')](respondWithResult(_0x3a85a1,null))[_0xf241('0x45')](handleError(_0x3a85a1,null));};exports[_0xf241('0x4b')]=function(_0x25d61f,_0x5dd37d){return db['Campaign']['create'](_0x25d61f[_0xf241('0x4c')],{})[_0xf241('0x27')](function(_0x21d2f3){var _0x19ab3f=_0x25d61f['user']['get']({'plain':!![]});if(!_0x19ab3f)throw new Error(_0xf241('0x4d'));if(_0x19ab3f['role']==='user'){var _0x199eba=_0x21d2f3[_0xf241('0x4e')]({'plain':!![]});var _0x5354a0='IvrCampaigns';return db[_0xf241('0x4f')][_0xf241('0x4a')]({'where':{'name':_0x5354a0,'userProfileId':_0x19ab3f[_0xf241('0x50')]},'raw':!![]})[_0xf241('0x27')](function(_0x175501){if(_0x175501&&_0x175501['autoAssociation']===0x0){return db[_0xf241('0x51')][_0xf241('0x4b')]({'name':_0x199eba[_0xf241('0x2c')],'resourceId':_0x199eba['id'],'type':_0x175501[_0xf241('0x2c')],'sectionId':_0x175501['id']},{})[_0xf241('0x27')](function(){return _0x21d2f3;});}else{return _0x21d2f3;}})['catch'](function(_0x1817d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1817d7);throw _0x1817d7;});}return _0x21d2f3;})['then'](respondWithResult(_0x5dd37d,0xc9))[_0xf241('0x45')](handleError(_0x5dd37d,null));};exports[_0xf241('0x52')]=function(_0x4facc2,_0x4b0b5b){var _0x5a5ad4={'where':{'id':_0x4facc2[_0xf241('0x47')]['id']}},_0x49b42b={};_0x49b42b[_0xf241('0x34')]=_[_0xf241('0x36')](db[_0xf241('0x2f')][_0xf241('0x30')]);_0x5a5ad4[_0xf241('0x38')]=_['intersection'](_0x49b42b[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x4facc2[_0xf241('0x35')][_0xf241('0x3a')]));_0x5a5ad4[_0xf241('0x38')]=_0x5a5ad4[_0xf241('0x38')]['length']?_0x5a5ad4['attributes']:_0x49b42b['model'];if(_0x4facc2['query']['includeAll']){_0x5a5ad4[_0xf241('0x53')]=[{'all':!![]}];}_0x5a5ad4=_[_0xf241('0x49')]({},_0x5a5ad4,_0x4facc2[_0xf241('0x54')]);return db[_0xf241('0x2f')][_0xf241('0x4a')](_0x5a5ad4)[_0xf241('0x27')](handleEntityNotFound(_0x4b0b5b,null))['then'](function(_0x1cee28){if(_0x1cee28){var _0x4ff3dc=_0x1cee28[_0xf241('0x4e')]({'plain':!![]});_0x4ff3dc=qs['omit'](_0x4ff3dc,['id','createdAt',_0xf241('0x55')]);_0x4facc2['body']=_[_0xf241('0x56')](_0x4facc2['body'],['id',_0xf241('0x57'),_0xf241('0x55')]);return db['Campaign']['create'](_['merge'](_0x4ff3dc,_0x4facc2[_0xf241('0x4c')]),{'include':_0x4facc2[_0xf241('0x35')][_0xf241('0x42')]?[{'all':!![]}]:undefined})[_0xf241('0x27')](function(_0x52972a){var _0x225ed2=_0x4facc2['user'][_0xf241('0x4e')]({'plain':!![]});if(!_0x225ed2)throw new Error(_0xf241('0x4d'));if(_0x225ed2[_0xf241('0x58')]===_0xf241('0x59')){var _0x24034f=_0x52972a['get']({'plain':!![]});var _0x5e6730='IvrCampaigns';return db['UserProfileSection'][_0xf241('0x4a')]({'where':{'name':_0x5e6730,'userProfileId':_0x225ed2[_0xf241('0x50')]},'raw':!![]})[_0xf241('0x27')](function(_0x1db78a){if(_0x1db78a&&_0x1db78a[_0xf241('0x5a')]===0x0){return db[_0xf241('0x51')]['create']({'name':_0x24034f[_0xf241('0x2c')],'resourceId':_0x24034f['id'],'type':_0x1db78a['name'],'sectionId':_0x1db78a['id']},{})[_0xf241('0x27')](function(){return _0x52972a;});}else{return _0x52972a;}})[_0xf241('0x45')](function(_0x1b10c9){logger['error'](_0xf241('0x5b'),_0x1b10c9);throw _0x1b10c9;});}return _0x52972a;});}})[_0xf241('0x27')](respondWithResult(_0x4b0b5b,0xc9))[_0xf241('0x45')](handleError(_0x4b0b5b,null));};exports[_0xf241('0x26')]=function(_0x289c54,_0x10ade2){if(_0x289c54[_0xf241('0x4c')]['id']){delete _0x289c54[_0xf241('0x4c')]['id'];}return db[_0xf241('0x2f')][_0xf241('0x4a')]({'where':{'id':_0x289c54[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x10ade2,null))['then'](saveUpdates(_0x289c54[_0xf241('0x4c')],null))[_0xf241('0x27')](respondWithResult(_0x10ade2,null))[_0xf241('0x45')](handleError(_0x10ade2,null));};exports[_0xf241('0x28')]=function(_0x39fa0f,_0x4ddf99){return db[_0xf241('0x2f')][_0xf241('0x4a')]({'where':{'id':_0x39fa0f[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x4ddf99,null))['then'](removeEntity(_0x4ddf99,null))[_0xf241('0x45')](handleError(_0x4ddf99,null));};exports[_0xf241('0x5c')]=function(_0x2e983a,_0xdbdf99,_0x30a8dd){var _0x407fec={'raw':!![],'where':{}};var _0x32a72d={};var _0x159f34={'count':0x0,'rows':[]};return db[_0xf241('0x2f')][_0xf241('0x5d')]({'where':{'id':_0x2e983a[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0xdbdf99,null))[_0xf241('0x27')](function(_0x541fdd){if(_0x541fdd){_0x32a72d[_0xf241('0x34')]=_[_0xf241('0x36')](db['CmHopper'][_0xf241('0x30')]);_0x32a72d[_0xf241('0x35')]=_[_0xf241('0x36')](_0x2e983a['query']);_0x32a72d['filters']=_[_0xf241('0x39')](_0x32a72d[_0xf241('0x34')],_0x32a72d[_0xf241('0x35')]);_0x407fec[_0xf241('0x38')]=_[_0xf241('0x39')](_0x32a72d[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x2e983a[_0xf241('0x35')][_0xf241('0x3a')]));_0x407fec[_0xf241('0x38')]=_0x407fec[_0xf241('0x38')][_0xf241('0x48')]?_0x407fec[_0xf241('0x38')]:_0x32a72d['model'];if(!_0x2e983a['query'][_0xf241('0x3b')](_0xf241('0x3c'))){_0x407fec[_0xf241('0x20')]=qs[_0xf241('0x20')](_0x2e983a[_0xf241('0x35')][_0xf241('0x20')]);_0x407fec['offset']=qs[_0xf241('0x1f')](_0x2e983a[_0xf241('0x35')]['offset']);}_0x407fec[_0xf241('0x3d')]=qs[_0xf241('0x3e')](_0x2e983a[_0xf241('0x35')][_0xf241('0x3e')]);_0x407fec[_0xf241('0x40')]=qs[_0xf241('0x37')](_['pick'](_0x2e983a[_0xf241('0x35')],_0x32a72d[_0xf241('0x37')]));_0x407fec[_0xf241('0x40')]['CampaignId']=_0x541fdd['id'];if(_0x2e983a['query'][_0xf241('0x3f')]){_0x407fec[_0xf241('0x40')]=_['merge'](_0x407fec[_0xf241('0x40')],{'$or':_[_0xf241('0x2e')](_0x407fec[_0xf241('0x38')],function(_0x259709){var _0x31734e={};_0x31734e[_0x259709]={'$like':'%'+_0x2e983a[_0xf241('0x35')]['filter']+'%'};return _0x31734e;})});}_0x407fec=_[_0xf241('0x49')]({},_0x407fec,_0x2e983a['options']);return db[_0xf241('0x5e')][_0xf241('0x21')]({'where':_0x407fec['where']})[_0xf241('0x27')](function(_0x5613b6){_0x159f34['count']=_0x5613b6;if(_0x2e983a[_0xf241('0x35')][_0xf241('0x42')]){_0x407fec[_0xf241('0x53')]=[{'all':!![]}];}return db[_0xf241('0x5e')][_0xf241('0x43')](_0x407fec);})[_0xf241('0x27')](function(_0x1c51a6){_0x159f34[_0xf241('0x44')]=_0x1c51a6;return _0x159f34;});}})[_0xf241('0x27')](respondWithFilteredResult(_0xdbdf99,_0x407fec))[_0xf241('0x45')](handleError(_0xdbdf99,null));};exports[_0xf241('0x5f')]=function(_0x14d3de,_0x2b2d31,_0x203bc2){var _0x1dd7a4={'raw':!![],'where':{}};var _0x1e825e={};var _0x526d39={'count':0x0,'rows':[]};return db[_0xf241('0x2f')][_0xf241('0x5d')]({'where':{'id':_0x14d3de['params']['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x2b2d31,null))['then'](function(_0x236e1d){if(_0x236e1d){_0x1e825e[_0xf241('0x34')]=_[_0xf241('0x36')](db[_0xf241('0x60')]['rawAttributes']);_0x1e825e[_0xf241('0x35')]=_['keys'](_0x14d3de[_0xf241('0x35')]);_0x1e825e['filters']=_[_0xf241('0x39')](_0x1e825e['model'],_0x1e825e[_0xf241('0x35')]);_0x1dd7a4['attributes']=_['intersection'](_0x1e825e['model'],qs['fields'](_0x14d3de[_0xf241('0x35')][_0xf241('0x3a')]));_0x1dd7a4[_0xf241('0x38')]=_0x1dd7a4[_0xf241('0x38')][_0xf241('0x48')]?_0x1dd7a4['attributes']:_0x1e825e['model'];if(!_0x14d3de['query'][_0xf241('0x3b')](_0xf241('0x3c'))){_0x1dd7a4[_0xf241('0x20')]=qs[_0xf241('0x20')](_0x14d3de[_0xf241('0x35')]['limit']);_0x1dd7a4[_0xf241('0x1f')]=qs[_0xf241('0x1f')](_0x14d3de[_0xf241('0x35')][_0xf241('0x1f')]);}_0x1dd7a4[_0xf241('0x3d')]=qs[_0xf241('0x3e')](_0x14d3de['query']['sort']);_0x1dd7a4[_0xf241('0x40')]=qs[_0xf241('0x37')](_[_0xf241('0x61')](_0x14d3de[_0xf241('0x35')],_0x1e825e[_0xf241('0x37')]));_0x1dd7a4[_0xf241('0x40')]['CampaignId']=_0x236e1d['id'];if(_0x14d3de[_0xf241('0x35')][_0xf241('0x3f')]){_0x1dd7a4['where']=_[_0xf241('0x49')](_0x1dd7a4[_0xf241('0x40')],{'$or':_[_0xf241('0x2e')](_0x1dd7a4[_0xf241('0x38')],function(_0x2bb832){var _0x56d8a6={};_0x56d8a6[_0x2bb832]={'$like':'%'+_0x14d3de[_0xf241('0x35')][_0xf241('0x3f')]+'%'};return _0x56d8a6;})});}_0x1dd7a4=_[_0xf241('0x49')]({},_0x1dd7a4,_0x14d3de[_0xf241('0x54')]);return db[_0xf241('0x60')]['count']({'where':_0x1dd7a4[_0xf241('0x40')]})[_0xf241('0x27')](function(_0x1dcf99){_0x526d39[_0xf241('0x21')]=_0x1dcf99;if(_0x14d3de[_0xf241('0x35')][_0xf241('0x42')]){_0x1dd7a4['include']=[{'all':!![]}];}return db[_0xf241('0x60')][_0xf241('0x43')](_0x1dd7a4);})[_0xf241('0x27')](function(_0x5be534){_0x526d39[_0xf241('0x44')]=_0x5be534;return _0x526d39;});}})[_0xf241('0x27')](respondWithFilteredResult(_0x2b2d31,_0x1dd7a4))['catch'](handleError(_0x2b2d31,null));};exports['getHopperFinals']=function(_0x28553e,_0x2ab36d,_0x8ecd89){var _0x4e7201={'raw':!![],'where':{}};var _0x45ae25={};var _0xea64ee={'count':0x0,'rows':[]};return db[_0xf241('0x2f')][_0xf241('0x5d')]({'where':{'id':_0x28553e[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x2ab36d,null))['then'](function(_0x28111f){if(_0x28111f){_0x45ae25[_0xf241('0x34')]=_[_0xf241('0x36')](db[_0xf241('0x62')][_0xf241('0x30')]);_0x45ae25[_0xf241('0x35')]=_[_0xf241('0x36')](_0x28553e[_0xf241('0x35')]);_0x45ae25[_0xf241('0x37')]=_[_0xf241('0x39')](_0x45ae25['model'],_0x45ae25[_0xf241('0x35')]);_0x4e7201[_0xf241('0x38')]=_[_0xf241('0x39')](_0x45ae25[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x28553e[_0xf241('0x35')][_0xf241('0x3a')]));_0x4e7201[_0xf241('0x38')]=_0x4e7201[_0xf241('0x38')]['length']?_0x4e7201['attributes']:_0x45ae25[_0xf241('0x34')];if(!_0x28553e[_0xf241('0x35')][_0xf241('0x3b')](_0xf241('0x3c'))){_0x4e7201['limit']=qs[_0xf241('0x20')](_0x28553e[_0xf241('0x35')]['limit']);_0x4e7201[_0xf241('0x1f')]=qs[_0xf241('0x1f')](_0x28553e[_0xf241('0x35')][_0xf241('0x1f')]);}_0x4e7201[_0xf241('0x3d')]=qs['sort'](_0x28553e['query'][_0xf241('0x3e')]);_0x4e7201['where']=qs[_0xf241('0x37')](_[_0xf241('0x61')](_0x28553e['query'],_0x45ae25[_0xf241('0x37')]));_0x4e7201['where'][_0xf241('0x63')]=_0x28111f['id'];if(_0x28553e['query'][_0xf241('0x3f')]){_0x4e7201['where']=_[_0xf241('0x49')](_0x4e7201[_0xf241('0x40')],{'$or':_['map'](_0x4e7201['attributes'],function(_0x6f630e){var _0x1931b2={};_0x1931b2[_0x6f630e]={'$like':'%'+_0x28553e['query'][_0xf241('0x3f')]+'%'};return _0x1931b2;})});}_0x4e7201=_['merge']({},_0x4e7201,_0x28553e['options']);return db[_0xf241('0x62')]['count']({'where':_0x4e7201[_0xf241('0x40')]})[_0xf241('0x27')](function(_0x181ef0){_0xea64ee[_0xf241('0x21')]=_0x181ef0;if(_0x28553e[_0xf241('0x35')][_0xf241('0x42')]){_0x4e7201['include']=[{'all':!![]}];}return db[_0xf241('0x62')][_0xf241('0x43')](_0x4e7201);})[_0xf241('0x27')](function(_0x1843fd){_0xea64ee[_0xf241('0x44')]=_0x1843fd;return _0xea64ee;});}})[_0xf241('0x27')](respondWithFilteredResult(_0x2ab36d,_0x4e7201))[_0xf241('0x45')](handleError(_0x2ab36d,null));};exports[_0xf241('0x64')]=function(_0x5ea604,_0x1e8d68,_0x1a1427){var _0x35907a={'raw':!![],'where':{}};var _0x34f903={};var _0x20207e={'count':0x0,'rows':[]};return db['Campaign'][_0xf241('0x5d')]({'where':{'id':_0x5ea604[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x1e8d68,null))[_0xf241('0x27')](function(_0x765908){if(_0x765908){_0x34f903['model']=_[_0xf241('0x36')](db[_0xf241('0x65')][_0xf241('0x30')]);_0x34f903[_0xf241('0x35')]=_[_0xf241('0x36')](_0x5ea604[_0xf241('0x35')]);_0x34f903[_0xf241('0x37')]=_[_0xf241('0x39')](_0x34f903[_0xf241('0x34')],_0x34f903[_0xf241('0x35')]);_0x35907a[_0xf241('0x38')]=_['intersection'](_0x34f903[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x5ea604[_0xf241('0x35')][_0xf241('0x3a')]));_0x35907a['attributes']=_0x35907a[_0xf241('0x38')][_0xf241('0x48')]?_0x35907a['attributes']:_0x34f903[_0xf241('0x34')];if(!_0x5ea604['query'][_0xf241('0x3b')](_0xf241('0x3c'))){_0x35907a['limit']=qs[_0xf241('0x20')](_0x5ea604[_0xf241('0x35')][_0xf241('0x20')]);_0x35907a[_0xf241('0x1f')]=qs[_0xf241('0x1f')](_0x5ea604[_0xf241('0x35')][_0xf241('0x1f')]);}_0x35907a[_0xf241('0x3d')]=qs['sort'](_0x5ea604[_0xf241('0x35')][_0xf241('0x3e')]);_0x35907a[_0xf241('0x40')]=qs[_0xf241('0x37')](_[_0xf241('0x61')](_0x5ea604['query'],_0x34f903[_0xf241('0x37')]));_0x35907a['where'][_0xf241('0x63')]=_0x765908['id'];if(_0x5ea604[_0xf241('0x35')][_0xf241('0x3f')]){_0x35907a[_0xf241('0x40')]=_[_0xf241('0x49')](_0x35907a[_0xf241('0x40')],{'$or':_[_0xf241('0x2e')](_0x35907a[_0xf241('0x38')],function(_0x4b618a){var _0x24e385={};_0x24e385[_0x4b618a]={'$like':'%'+_0x5ea604[_0xf241('0x35')][_0xf241('0x3f')]+'%'};return _0x24e385;})});}_0x35907a=_['merge']({},_0x35907a,_0x5ea604[_0xf241('0x54')]);return db[_0xf241('0x65')][_0xf241('0x21')]({'where':_0x35907a['where']})[_0xf241('0x27')](function(_0x80528b){_0x20207e[_0xf241('0x21')]=_0x80528b;if(_0x5ea604[_0xf241('0x35')][_0xf241('0x42')]){_0x35907a[_0xf241('0x53')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xf241('0x43')](_0x35907a);})['then'](function(_0x4e23df){_0x20207e[_0xf241('0x44')]=_0x4e23df;return _0x20207e;});}})[_0xf241('0x27')](respondWithFilteredResult(_0x1e8d68,_0x35907a))['catch'](handleError(_0x1e8d68,null));};exports[_0xf241('0x66')]=function(_0xb7d0f0,_0x3166b5,_0x55594d){var _0x3e87d7={};var _0x40f667={};var _0x3e0282;var _0x27499a;return db[_0xf241('0x2f')][_0xf241('0x5d')]({'where':{'id':_0xb7d0f0['params']['id']}})['then'](handleEntityNotFound(_0x3166b5,null))[_0xf241('0x27')](function(_0x43dc99){if(_0x43dc99){_0x3e0282=_0x43dc99;_0x40f667['model']=_[_0xf241('0x36')](db[_0xf241('0x67')][_0xf241('0x30')]);_0x40f667[_0xf241('0x35')]=_['keys'](_0xb7d0f0[_0xf241('0x35')]);_0x40f667['filters']=_[_0xf241('0x39')](_0x40f667[_0xf241('0x34')],_0x40f667[_0xf241('0x35')]);_0x3e87d7['attributes']=_[_0xf241('0x39')](_0x40f667[_0xf241('0x34')],qs[_0xf241('0x3a')](_0xb7d0f0[_0xf241('0x35')][_0xf241('0x3a')]));_0x3e87d7[_0xf241('0x38')]=_0x3e87d7[_0xf241('0x38')][_0xf241('0x48')]?_0x3e87d7[_0xf241('0x38')]:_0x40f667[_0xf241('0x34')];_0x3e87d7[_0xf241('0x3d')]=qs[_0xf241('0x3e')](_0xb7d0f0[_0xf241('0x35')][_0xf241('0x3e')]);_0x3e87d7[_0xf241('0x40')]=qs[_0xf241('0x37')](_[_0xf241('0x61')](_0xb7d0f0[_0xf241('0x35')],_0x40f667[_0xf241('0x37')]));if(_0xb7d0f0['query'][_0xf241('0x3f')]){_0x3e87d7[_0xf241('0x40')]=_[_0xf241('0x49')](_0x3e87d7[_0xf241('0x40')],{'$or':_['map'](_0x3e87d7[_0xf241('0x38')],function(_0x199ad6){var _0x17e89b={};_0x17e89b[_0x199ad6]={'$like':'%'+_0xb7d0f0['query'][_0xf241('0x3f')]+'%'};return _0x17e89b;})});}_0x3e87d7=_[_0xf241('0x49')]({},_0x3e87d7,_0xb7d0f0[_0xf241('0x54')]);return _0x3e0282[_0xf241('0x66')](_0x3e87d7);}})[_0xf241('0x27')](function(_0x39fd28){if(_0x39fd28){_0x27499a=_0x39fd28[_0xf241('0x48')];if(!_0xb7d0f0[_0xf241('0x35')][_0xf241('0x3b')](_0xf241('0x3c'))){_0x3e87d7[_0xf241('0x20')]=qs[_0xf241('0x20')](_0xb7d0f0[_0xf241('0x35')][_0xf241('0x20')]);_0x3e87d7[_0xf241('0x1f')]=qs[_0xf241('0x1f')](_0xb7d0f0['query']['offset']);}return _0x3e0282[_0xf241('0x66')](_0x3e87d7);}})[_0xf241('0x27')](function(_0x3f2db2){if(_0x3f2db2){return _0x3f2db2?{'count':_0x27499a,'rows':_0x3f2db2}:null;}})[_0xf241('0x27')](respondWithResult(_0x3166b5,null))['catch'](handleError(_0x3166b5,null));};exports[_0xf241('0x68')]=function(_0x35fef0,_0x351e33,_0x1ff397){var _0x534be3,_0x47262c;var _0x3bc619=[];var _0x176c0f=moment()[_0xf241('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xf241('0x4a')]({'where':{'id':_0x35fef0[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x351e33,null))[_0xf241('0x27')](function(_0x66c827){if(_0x66c827){_0x47262c=_0x66c827;return _0x66c827[_0xf241('0x68')](_0x35fef0[_0xf241('0x4c')]['ids'],_[_0xf241('0x56')](_0x35fef0[_0xf241('0x4c')],['ids','id'])||{});}return null;})[_0xf241('0x6a')](function(_0x8dc68b){var _0x1d60c6;var _0x4f483e;_0x534be3=_0x8dc68b||[];var _0x1aa25c=[];if(_0x8dc68b){for(var _0x2fdd22=0x0;_0x2fdd22<_0x8dc68b[_0xf241('0x48')];_0x2fdd22+=0x1){var _0x17e52e=_0x8dc68b[_0x2fdd22][_0xf241('0x4e')]({'plain':!![]});_0x47262c[_0xf241('0x6b')]=_0x35fef0[_0xf241('0x4c')][_0xf241('0x6b')]?_0x35fef0[_0xf241('0x4c')]['dialCheckDuplicateType']:_0x47262c[_0xf241('0x6b')];switch(_0x47262c['dialCheckDuplicateType']){case'always':_0x1d60c6=squel['insert']()[_0xf241('0x6c')](_0xf241('0x6d'))[_0xf241('0x6e')]([_0xf241('0x6f'),_0xf241('0x70'),_0xf241('0x71'),_0xf241('0x72'),_0xf241('0x63'),'createdAt',_0xf241('0x55')],squel[_0xf241('0x73')]()[_0xf241('0x74')]('phone','phone')[_0xf241('0x74')](_0xf241('0x75'),_0xf241('0x70'))[_0xf241('0x74')]('id',_0xf241('0x71'))[_0xf241('0x74')](_0x17e52e[_0xf241('0x76')][_0xf241('0x77')](),_0xf241('0x72'))[_0xf241('0x74')](_0x35fef0[_0xf241('0x47')]['id'][_0xf241('0x77')](),_0xf241('0x63'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27',_0xf241('0x57'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27','updatedAt')[_0xf241('0x78')](_0xf241('0x79'))[_0xf241('0x40')](_0xf241('0x7a'))[_0xf241('0x40')]('ListId\x20=\x20?',_0x17e52e['CmListId'][_0xf241('0x77')]())[_0xf241('0x40')](_0xf241('0x7b'))[_0xf241('0x40')](_0xf241('0x7c'),squel[_0xf241('0x73')]()['field'](_0xf241('0x7d'))[_0xf241('0x78')](_0xf241('0x7e'))[_0xf241('0x40')]('CampaignId\x20=\x20?',_0x35fef0[_0xf241('0x47')]['id'][_0xf241('0x77')]()))[_0xf241('0x40')](_0xf241('0x7c'),squel[_0xf241('0x73')]()[_0xf241('0x74')](_0xf241('0x7f'))['from']('cm_hopper')[_0xf241('0x40')](_0xf241('0x80'),_0x35fef0[_0xf241('0x47')]['id'][_0xf241('0x77')]())))['toString']();break;case _0xf241('0x81'):_0x1d60c6=squel[_0xf241('0x82')]()['into'](_0xf241('0x6d'))[_0xf241('0x6e')]([_0xf241('0x6f'),_0xf241('0x70'),_0xf241('0x71'),'ListId',_0xf241('0x63'),_0xf241('0x57'),_0xf241('0x55')],squel[_0xf241('0x73')]()[_0xf241('0x74')](_0xf241('0x6f'),'phone')[_0xf241('0x74')](_0xf241('0x75'),_0xf241('0x70'))[_0xf241('0x74')]('id','ContactId')[_0xf241('0x74')](_0x17e52e[_0xf241('0x76')][_0xf241('0x77')](),_0xf241('0x72'))['field'](_0x35fef0['params']['id'][_0xf241('0x77')](),_0xf241('0x63'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27','createdAt')['field']('\x27'+_0x176c0f+'\x27',_0xf241('0x55'))[_0xf241('0x78')](_0xf241('0x79'))[_0xf241('0x40')](_0xf241('0x7a'))[_0xf241('0x40')](_0xf241('0x83'),_0x17e52e['CmListId']['toString']())['where'](_0xf241('0x7b'))['where'](_0xf241('0x7c'),squel[_0xf241('0x73')]()[_0xf241('0x74')](_0xf241('0x7f'))[_0xf241('0x78')]('cm_hopper')['where'](_0xf241('0x80'),_0x35fef0[_0xf241('0x47')]['id'][_0xf241('0x77')]())))[_0xf241('0x77')]();break;default:_0x1d60c6=squel[_0xf241('0x82')]()[_0xf241('0x6c')](_0xf241('0x6d'))['fromQuery'](['phone',_0xf241('0x70'),_0xf241('0x71'),_0xf241('0x72'),_0xf241('0x63'),'createdAt',_0xf241('0x55')],squel[_0xf241('0x73')]()[_0xf241('0x74')](_0xf241('0x6f'),_0xf241('0x6f'))[_0xf241('0x74')](_0xf241('0x75'),_0xf241('0x70'))[_0xf241('0x74')]('id',_0xf241('0x71'))[_0xf241('0x74')](_0x17e52e['CmListId'][_0xf241('0x77')](),'ListId')[_0xf241('0x74')](_0x35fef0[_0xf241('0x47')]['id'][_0xf241('0x77')](),'CampaignId')[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27',_0xf241('0x57'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27',_0xf241('0x55'))[_0xf241('0x78')](_0xf241('0x79'))['where'](_0xf241('0x7a'))[_0xf241('0x40')]('ListId\x20=\x20?',_0x17e52e[_0xf241('0x76')][_0xf241('0x77')]())[_0xf241('0x40')](_0xf241('0x7b')))[_0xf241('0x77')]();}_0x4f483e=squel[_0xf241('0x82')]()[_0xf241('0x6c')](_0xf241('0x84'))['fromQuery']([_0xf241('0x85'),_0xf241('0x70'),'phone',_0xf241('0x86'),_0xf241('0x57'),'updatedAt'],squel[_0xf241('0x73')]()[_0xf241('0x74')](_0xf241('0x87'),'id')[_0xf241('0x74')](_0xf241('0x75'),_0xf241('0x70'))[_0xf241('0x74')](_0xf241('0x88'),_0xf241('0x6f'))['field'](_0xf241('0x89'),_0xf241('0x86'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27',_0xf241('0x57'))[_0xf241('0x74')]('\x27'+_0x176c0f+'\x27',_0xf241('0x55'))[_0xf241('0x78')](_0xf241('0x8a'),'ci')[_0xf241('0x8b')](_0xf241('0x6d'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xf241('0x40')](_0xf241('0x8c'),_0x17e52e[_0xf241('0x76')][_0xf241('0x77')]())['where'](_0xf241('0x8d'),_0x35fef0['params']['id'][_0xf241('0x77')]())[_0xf241('0x40')](_0xf241('0x8e'),_0x176c0f))['toString']();_0x1aa25c['push'](db['sequelize'][_0xf241('0x35')](_0x1d60c6));_0x3bc619['push'](db[_0xf241('0x8f')]['query'](_0x4f483e));}return BPromise[_0xf241('0x90')](_0x1aa25c);}})[_0xf241('0x27')](function(){return BPromise[_0xf241('0x90')](_0x3bc619);})[_0xf241('0x27')](function(){return _0x534be3;})['then'](respondWithResult(_0x351e33,null))[_0xf241('0x45')](handleError(_0x351e33,null));};exports[_0xf241('0x91')]=function(_0x5c71bf,_0x5d532b,_0x8716f9){return db[_0xf241('0x2f')][_0xf241('0x4a')]({'where':{'id':_0x5c71bf[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x5d532b,null))[_0xf241('0x27')](function(_0x46f822){if(_0x46f822){return _0x46f822[_0xf241('0x91')](_0x5c71bf[_0xf241('0x35')][_0xf241('0x92')]);}})[_0xf241('0x27')](function(_0x58136b){if(_0x58136b){return db[_0xf241('0x5e')][_0xf241('0x28')]({'where':{'ListId':_0x5c71bf[_0xf241('0x35')][_0xf241('0x92')],'CampaignId':_0x5c71bf[_0xf241('0x47')]['id']}})[_0xf241('0x27')](function(){return _0x58136b;});}})[_0xf241('0x27')](respondWithStatusCode(_0x5d532b,null))[_0xf241('0x45')](handleError(_0x5d532b,null));};exports[_0xf241('0x93')]=function(_0x5acd29,_0x15be70,_0x10af70){var _0x2362e9={};var _0x23e14f={};var _0x4fdbbe;var _0x5f2eb2;return db[_0xf241('0x2f')]['findOne']({'where':{'id':_0x5acd29['params']['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x15be70,null))[_0xf241('0x27')](function(_0x37dbe0){if(_0x37dbe0){_0x4fdbbe=_0x37dbe0;_0x23e14f['model']=_[_0xf241('0x36')](db[_0xf241('0x67')][_0xf241('0x30')]);_0x23e14f[_0xf241('0x35')]=_['keys'](_0x5acd29['query']);_0x23e14f[_0xf241('0x37')]=_[_0xf241('0x39')](_0x23e14f[_0xf241('0x34')],_0x23e14f[_0xf241('0x35')]);_0x2362e9[_0xf241('0x38')]=_[_0xf241('0x39')](_0x23e14f[_0xf241('0x34')],qs[_0xf241('0x3a')](_0x5acd29[_0xf241('0x35')][_0xf241('0x3a')]));_0x2362e9[_0xf241('0x38')]=_0x2362e9[_0xf241('0x38')][_0xf241('0x48')]?_0x2362e9[_0xf241('0x38')]:_0x23e14f[_0xf241('0x34')];_0x2362e9['order']=qs[_0xf241('0x3e')](_0x5acd29[_0xf241('0x35')]['sort']);_0x2362e9['where']=qs[_0xf241('0x37')](_[_0xf241('0x61')](_0x5acd29[_0xf241('0x35')],_0x23e14f['filters']));if(_0x5acd29[_0xf241('0x35')]['filter']){_0x2362e9[_0xf241('0x40')]=_[_0xf241('0x49')](_0x2362e9['where'],{'$or':_[_0xf241('0x2e')](_0x2362e9['attributes'],function(_0x324c20){var _0x3a191c={};_0x3a191c[_0x324c20]={'$like':'%'+_0x5acd29[_0xf241('0x35')][_0xf241('0x3f')]+'%'};return _0x3a191c;})});}_0x2362e9=_[_0xf241('0x49')]({},_0x2362e9,_0x5acd29[_0xf241('0x54')]);return _0x4fdbbe['getBlackLists'](_0x2362e9);}})['then'](function(_0x4213fa){if(_0x4213fa){_0x5f2eb2=_0x4213fa[_0xf241('0x48')];if(!_0x5acd29[_0xf241('0x35')][_0xf241('0x3b')](_0xf241('0x3c'))){_0x2362e9[_0xf241('0x20')]=qs[_0xf241('0x20')](_0x5acd29[_0xf241('0x35')][_0xf241('0x20')]);_0x2362e9[_0xf241('0x1f')]=qs['offset'](_0x5acd29[_0xf241('0x35')]['offset']);}return _0x4fdbbe[_0xf241('0x93')](_0x2362e9);}})[_0xf241('0x27')](function(_0x304536){if(_0x304536){return _0x304536?{'count':_0x5f2eb2,'rows':_0x304536}:null;}})['then'](respondWithResult(_0x15be70,null))['catch'](handleError(_0x15be70,null));};exports[_0xf241('0x94')]=function(_0x13c5b5,_0x39a89d,_0x50532d){var _0x3be29a,_0xb1760b;var _0x49be4e=[];var _0x5cd0e8=moment()[_0xf241('0x69')](_0xf241('0x95'));return db[_0xf241('0x2f')]['find']({'where':{'id':_0x13c5b5[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x39a89d,null))[_0xf241('0x27')](function(_0x25a877){if(_0x25a877){_0xb1760b=_0x25a877;return _0x25a877[_0xf241('0x94')](_0x13c5b5[_0xf241('0x4c')]['ids'],_[_0xf241('0x56')](_0x13c5b5[_0xf241('0x4c')],[_0xf241('0x92'),'id'])||{});}return null;})['spread'](function(_0x30b376){var _0x3df809;var _0x4000e1;_0x3be29a=_0x30b376||[];var _0x1d7833=[];if(_0x30b376){for(var _0x253180=0x0;_0x253180<_0x30b376[_0xf241('0x48')];_0x253180+=0x1){var _0x297d24=_0x30b376[_0x253180][_0xf241('0x4e')]({'plain':!![]});_0x3df809=squel[_0xf241('0x82')]()[_0xf241('0x6c')](_0xf241('0x96'))[_0xf241('0x6e')]([_0xf241('0x6f'),_0xf241('0x71'),'ListId','CampaignId',_0xf241('0x57'),_0xf241('0x55')],squel[_0xf241('0x73')]()['field']('phone',_0xf241('0x6f'))[_0xf241('0x74')]('id',_0xf241('0x71'))[_0xf241('0x74')](_0x297d24['CmListId'][_0xf241('0x77')](),_0xf241('0x72'))[_0xf241('0x74')](_0x13c5b5[_0xf241('0x47')]['id']['toString'](),_0xf241('0x63'))[_0xf241('0x74')](_0xf241('0x75'),'createdAt')['field'](_0xf241('0x75'),_0xf241('0x55'))[_0xf241('0x78')](_0xf241('0x79'))[_0xf241('0x40')](_0xf241('0x7a'))[_0xf241('0x40')](_0xf241('0x83'),_0x297d24[_0xf241('0x76')][_0xf241('0x77')]())['where'](_0xf241('0x7b')))[_0xf241('0x77')]();_0x1d7833[_0xf241('0x97')](db['sequelize'][_0xf241('0x35')](_0x3df809));}return BPromise['all'](_0x1d7833);}})[_0xf241('0x27')](function(){return _0x3be29a;})[_0xf241('0x27')](respondWithResult(_0x39a89d,null))[_0xf241('0x45')](handleError(_0x39a89d,null));};exports[_0xf241('0x98')]=function(_0x5bbb05,_0x2e603b,_0x48fd7c){return db['Campaign'][_0xf241('0x4a')]({'where':{'id':_0x5bbb05[_0xf241('0x47')]['id']}})[_0xf241('0x27')](handleEntityNotFound(_0x2e603b,null))[_0xf241('0x27')](function(_0x13187b){if(_0x13187b){return _0x13187b[_0xf241('0x98')](_0x5bbb05['query'][_0xf241('0x92')]);}})[_0xf241('0x27')](function(_0x3b2901){if(_0x3b2901){return db[_0xf241('0x65')][_0xf241('0x28')]({'where':{'ListId':_0x5bbb05['query'][_0xf241('0x92')],'CampaignId':_0x5bbb05[_0xf241('0x47')]['id']}})[_0xf241('0x27')](function(){return _0x3b2901;});}})[_0xf241('0x27')](respondWithStatusCode(_0x2e603b,null))[_0xf241('0x45')](handleError(_0x2e603b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e897087..e2e9e8e 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x405a7a,_0x5937ac){var _0x4c9a54=function(_0x826698){while(--_0x826698){_0x405a7a['push'](_0x405a7a['shift']());}};_0x4c9a54(++_0x5937ac);}(_0x7a54,0x106));var _0x47a5=function(_0xb6699e,_0x67ec85){_0xb6699e=_0xb6699e-0x0;var _0x53d746=_0x7a54[_0xb6699e];return _0x53d746;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x57ccad,_0x2e2f66){var _0x457145=function(_0x4a762a){while(--_0x4a762a){_0x57ccad['push'](_0x57ccad['shift']());}};_0x457145(++_0x2e2f66);}(_0x7a54,0x106));var _0x47a5=function(_0x5aca23,_0x1b2e9c){_0x5aca23=_0x5aca23-0x0;var _0xca65ef=_0x7a54[_0x5aca23];return _0xca65ef;};'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 32dd702..a2dd44d 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 _0xe14d=['limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0xe14d,0x1ee));var _0xde14=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe14d[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('Campaign,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});}; \ No newline at end of file +var _0x22a4=['limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','raw','where','attributes'];(function(_0x2ca1db,_0x119849){var _0x4c9b80=function(_0x548118){while(--_0x548118){_0x2ca1db['push'](_0x2ca1db['shift']());}};_0x4c9b80(++_0x119849);}(_0x22a4,0x1cb));var _0x422a=function(_0x21b9b,_0x2fd58c){_0x21b9b=_0x21b9b-0x0;var _0x27ad89=_0x22a4[_0x21b9b];return _0x27ad89;};'use strict';var _=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var moment=require(_0x422a('0x2'));var BPromise=require(_0x422a('0x3'));var rs=require(_0x422a('0x4'));var fs=require('fs');var Redis=require(_0x422a('0x5'));var db=require(_0x422a('0x6'))['db'];var utils=require(_0x422a('0x7'));var logger=require('../../config/logger')(_0x422a('0x8'));var config=require(_0x422a('0x9'));var jayson=require(_0x422a('0xa'));var client=jayson[_0x422a('0xb')][_0x422a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e8fe2,_0x3b5c92,_0x1b4b08){return new BPromise(function(_0x23b1b0,_0x392224){return client[_0x422a('0xd')](_0x5e8fe2,_0x1b4b08)[_0x422a('0xe')](function(_0x317466){logger[_0x422a('0xf')]('Campaign,\x20%s,\x20%s',_0x3b5c92,'request\x20sent');logger[_0x422a('0x10')](_0x422a('0x11'),_0x3b5c92,_0x422a('0x12'),JSON[_0x422a('0x13')](_0x317466));if(_0x317466[_0x422a('0x14')]){if(_0x317466[_0x422a('0x14')]['code']===0x1f4){logger['error'](_0x422a('0x15'),_0x3b5c92,_0x317466['error']['message']);return _0x392224(_0x317466['error'][_0x422a('0x16')]);}logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x317466[_0x422a('0x14')][_0x422a('0x16')]);return _0x23b1b0(_0x317466[_0x422a('0x14')][_0x422a('0x16')]);}else{logger[_0x422a('0xf')](_0x422a('0x15'),_0x3b5c92,_0x422a('0x12'));_0x23b1b0(_0x317466[_0x422a('0x17')][_0x422a('0x16')]);}})[_0x422a('0x18')](function(_0x3d5033){logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x3d5033);_0x392224(_0x3d5033);});});}exports[_0x422a('0x19')]=function(_0x5e2507){var _0x30847a=this;return new Promise(function(_0x3c5d86,_0x5b29fc){return db[_0x422a('0x1a')]['findAll']({'raw':_0x5e2507['options']?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1d')]||null:null,'attributes':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1e')]||null:null,'limit':_0x5e2507['options']?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1f')]||null:null,'include':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x20')]?_['map'](_0x5e2507[_0x422a('0x1b')][_0x422a('0x20')],function(_0x6e209d){return{'model':db[_0x6e209d['model']],'as':_0x6e209d['as'],'attributes':_0x6e209d[_0x422a('0x1e')],'include':_0x6e209d[_0x422a('0x20')]?_[_0x422a('0x21')](_0x6e209d[_0x422a('0x20')],function(_0xfc8699){return{'model':db[_0xfc8699[_0x422a('0x22')]],'as':_0xfc8699['as'],'attributes':_0xfc8699[_0x422a('0x1e')],'include':_0xfc8699[_0x422a('0x20')]?_['map'](_0xfc8699[_0x422a('0x20')],function(_0x15d2ab){return{'model':db[_0x15d2ab['model']],'as':_0x15d2ab['as'],'attributes':_0x15d2ab[_0x422a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b88ae){logger[_0x422a('0xf')](_0x422a('0x19'),_0x5e2507);logger[_0x422a('0x10')]('GetCampaign',_0x5e2507,JSON[_0x422a('0x13')](_0x1b88ae));_0x3c5d86(_0x1b88ae);})[_0x422a('0x18')](function(_0x50cc29){logger['error'](_0x422a('0x19'),_0x50cc29[_0x422a('0x16')],_0x5e2507);_0x5b29fc(_0x30847a['error'](0x1f4,_0x50cc29['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 96a695a..e27771c 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 _0xbb7f=['/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x420030,_0x323141){var _0x2cbd2a=function(_0x5c005f){while(--_0x5c005f){_0x420030['push'](_0x420030['shift']());}};_0x2cbd2a(++_0x323141);}(_0xbb7f,0xe3));var _0xfbb7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb7f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xfbb7('0x0'));var util=require(_0xfbb7('0x1'));var path=require('path');var timeout=require(_0xfbb7('0x2'));var express=require(_0xfbb7('0x3'));var router=express[_0xfbb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbb7('0x5'));var interaction=require(_0xfbb7('0x6'));var config=require(_0xfbb7('0x7'));var controller=require(_0xfbb7('0x8'));router['get']('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xa')]);router[_0xfbb7('0xb')](_0xfbb7('0xc'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xd')]);router['get'](_0xfbb7('0xe'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xf')]);router[_0xfbb7('0xb')](_0xfbb7('0x10'),auth[_0xfbb7('0x9')](),controller['getHopperHistories']);router[_0xfbb7('0xb')](_0xfbb7('0x11'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x12')]);router[_0xfbb7('0xb')]('/:id/hopper_black',auth[_0xfbb7('0x9')](),controller['getHopperBlacks']);router[_0xfbb7('0xb')](_0xfbb7('0x13'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x14')]);router[_0xfbb7('0xb')](_0xfbb7('0x15'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x16')]);router[_0xfbb7('0x17')]('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x18')]);router[_0xfbb7('0x17')](_0xfbb7('0x19'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x1a')]);router[_0xfbb7('0x17')](_0xfbb7('0x13'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x1b')]);router['post'](_0xfbb7('0x15'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x1c')]);router[_0xfbb7('0x1d')](_0xfbb7('0xc'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x1e')]);router['delete']('/:id',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x1f')]);router[_0xfbb7('0x20')](_0xfbb7('0x13'),auth['isAuthenticated'](),controller[_0xfbb7('0x21')]);router[_0xfbb7('0x20')](_0xfbb7('0x15'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x22')]);module[_0xfbb7('0x23')]=router; \ No newline at end of file +var _0x2188=['getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','put','update','delete','removeBlackLists','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/lists'];(function(_0x439905,_0x50c76c){var _0x417289=function(_0xee5332){while(--_0xee5332){_0x439905['push'](_0x439905['shift']());}};_0x417289(++_0x50c76c);}(_0x2188,0x1d6));var _0x8218=function(_0x293a47,_0x907a53){_0x293a47=_0x293a47-0x0;var _0x51687b=_0x2188[_0x293a47];return _0x51687b;};'use strict';var multer=require(_0x8218('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8218('0x1'));var express=require(_0x8218('0x2'));var router=express['Router']();var fs_extra=require(_0x8218('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8218('0x4'));var config=require(_0x8218('0x5'));var controller=require('./campaign.controller');router['get']('/',auth[_0x8218('0x6')](),controller[_0x8218('0x7')]);router[_0x8218('0x8')](_0x8218('0x9'),auth[_0x8218('0x6')](),controller[_0x8218('0xa')]);router[_0x8218('0x8')](_0x8218('0xb'),auth['isAuthenticated'](),controller[_0x8218('0xc')]);router[_0x8218('0x8')](_0x8218('0xd'),auth['isAuthenticated'](),controller[_0x8218('0xe')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x8218('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x8218('0x8')](_0x8218('0xf'),auth[_0x8218('0x6')](),controller[_0x8218('0x10')]);router[_0x8218('0x8')](_0x8218('0x11'),auth[_0x8218('0x6')](),controller[_0x8218('0x12')]);router[_0x8218('0x13')]('/',auth[_0x8218('0x6')](),controller[_0x8218('0x14')]);router['post'](_0x8218('0x15'),auth[_0x8218('0x6')](),controller['clone']);router['post'](_0x8218('0xf'),auth[_0x8218('0x6')](),controller[_0x8218('0x16')]);router[_0x8218('0x13')](_0x8218('0x11'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x8218('0x17')]('/:id',auth[_0x8218('0x6')](),controller[_0x8218('0x18')]);router[_0x8218('0x19')]('/:id',auth[_0x8218('0x6')](),controller['destroy']);router['delete']('/:id/lists',auth[_0x8218('0x6')](),controller['removeLists']);router[_0x8218('0x19')](_0x8218('0x11'),auth[_0x8218('0x6')](),controller[_0x8218('0x1a')]);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 a8fcdc4..78b33a2 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 _0x1067=['STRING','TEXT','VIRTUAL','key','sequelize'];(function(_0x5cfc3c,_0x5a40d3){var _0x55fdab=function(_0x4ef059){while(--_0x4ef059){_0x5cfc3c['push'](_0x5cfc3c['shift']());}};_0x55fdab(++_0x5a40d3);}(_0x1067,0x171));var _0x7106=function(_0x32d788,_0xbaa65e){_0x32d788=_0x32d788-0x0;var _0x1b671a=_0x1067[_0x32d788];return _0x1b671a;};'use strict';var Sequelize=require(_0x7106('0x0'));module['exports']={'key':{'type':Sequelize[_0x7106('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7106('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7106('0x1')]},'name':{'type':Sequelize[_0x7106('0x3')],'get':function(){return this['getDataValue'](_0x7106('0x4'));}}}; \ No newline at end of file +var _0x0f6d=['exports','STRING','VIRTUAL','key','sequelize'];(function(_0x55b25d,_0x2e5d88){var _0x4d1283=function(_0x52afbe){while(--_0x52afbe){_0x55b25d['push'](_0x55b25d['shift']());}};_0x4d1283(++_0x2e5d88);}(_0x0f6d,0xd6));var _0xd0f6=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0x0f6d[_0x509273];return _0x38ef40;};'use strict';var Sequelize=require(_0xd0f6('0x0'));module[_0xd0f6('0x1')]={'key':{'type':Sequelize[_0xd0f6('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xd0f6('0x2')]},'name':{'type':Sequelize[_0xd0f6('0x3')],'get':function(){return this['getDataValue'](_0xd0f6('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1e0bda4..c46bb7c 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 _0x6da9=['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','status','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','CannedAnswers','UserProfileResource','destroy','end','error','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','options','CannedAnswer','include','findAll','rows','catch','show','params','includeAll','merge','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x28d885,_0x22d916){var _0x54e080=function(_0x1b9e76){while(--_0x1b9e76){_0x28d885['push'](_0x28d885['shift']());}};_0x54e080(++_0x22d916);}(_0x6da9,0xaa));var _0x96da=function(_0x1f4a2f,_0x39c4a5){_0x1f4a2f=_0x1f4a2f-0x0;var _0x4b060e=_0x6da9[_0x1f4a2f];return _0x4b060e;};'use strict';var emlformat=require(_0x96da('0x0'));var rimraf=require(_0x96da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96da('0x2'));var rp=require(_0x96da('0x3'));var moment=require(_0x96da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96da('0x5'));var util=require(_0x96da('0x6'));var path=require(_0x96da('0x7'));var sox=require(_0x96da('0x8'));var csv=require(_0x96da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96da('0xa'));var _=require('lodash');var squel=require(_0x96da('0xb'));var crypto=require('crypto');var jsforce=require(_0x96da('0xc'));var deskjs=require(_0x96da('0xd'));var toCsv=require(_0x96da('0x9'));var querystring=require(_0x96da('0xe'));var Papa=require(_0x96da('0xf'));var Redis=require(_0x96da('0x10'));var authService=require(_0x96da('0x11'));var qs=require(_0x96da('0x12'));var as=require(_0x96da('0x13'));var hardwareService=require(_0x96da('0x14'));var logger=require(_0x96da('0x15'))(_0x96da('0x16'));var utils=require(_0x96da('0x17'));var config=require(_0x96da('0x18'));var licenseUtil=require(_0x96da('0x19'));var db=require(_0x96da('0x1a'))['db'];function respondWithStatusCode(_0x59727a,_0x242d6a){_0x242d6a=_0x242d6a||0xcc;return function(_0x1b4e02){if(_0x1b4e02){return _0x59727a['sendStatus'](_0x242d6a);}return _0x59727a[_0x96da('0x1b')](_0x242d6a)['end']();};}function respondWithResult(_0x4a6000,_0x4855fe){_0x4855fe=_0x4855fe||0xc8;return function(_0x227e35){if(_0x227e35){return _0x4a6000['status'](_0x4855fe)['json'](_0x227e35);}};}function respondWithFilteredResult(_0x4ec6e4,_0xedfc7c){return function(_0x2d9a87){if(_0x2d9a87){var _0x1afa6b=typeof _0xedfc7c['offset']===_0x96da('0x1c')&&typeof _0xedfc7c['limit']==='undefined';var _0x13a6c1=_0x2d9a87['count'];var _0x19960e=_0x1afa6b?0x0:_0xedfc7c[_0x96da('0x1d')];var _0x53141d=_0x1afa6b?_0x2d9a87[_0x96da('0x1e')]:_0xedfc7c['offset']+_0xedfc7c['limit'];var _0x480231;if(_0x53141d>=_0x13a6c1){_0x53141d=_0x13a6c1;_0x480231=0xc8;}else{_0x480231=0xce;}_0x4ec6e4['status'](_0x480231);return _0x4ec6e4[_0x96da('0x1f')](_0x96da('0x20'),_0x19960e+'-'+_0x53141d+'/'+_0x13a6c1)[_0x96da('0x21')](_0x2d9a87);}return null;};}function patchUpdates(_0xf887da){return function(_0x17f646){try{jsonpatch[_0x96da('0x22')](_0x17f646,_0xf887da,!![]);}catch(_0xa75e1e){return BPromise[_0x96da('0x23')](_0xa75e1e);}return _0x17f646[_0x96da('0x24')]();};}function saveUpdates(_0x1e8be9,_0x5282b9){return function(_0x5186fe){if(_0x5186fe){return _0x5186fe['update'](_0x1e8be9)[_0x96da('0x25')](function(_0x466278){return _0x466278;});}return null;};}function removeEntity(_0x4b01ad,_0x374908){return function(_0x47764f){if(_0x47764f){return _0x47764f['destroy']()[_0x96da('0x25')](function(){var _0x10ae4c=_0x47764f['get']({'plain':!![]});var _0x461b19=_0x96da('0x26');return db[_0x96da('0x27')][_0x96da('0x28')]({'where':{'type':_0x461b19,'resourceId':_0x10ae4c['id']}})[_0x96da('0x25')](function(){return _0x47764f;});})['then'](function(){_0x4b01ad[_0x96da('0x1b')](0xcc)[_0x96da('0x29')]();});}};}function handleEntityNotFound(_0x34a70b,_0x11a552){return function(_0x36a4c1){if(!_0x36a4c1){_0x34a70b['sendStatus'](0x194);}return _0x36a4c1;};}function handleError(_0x2d5adb,_0x485f3c){_0x485f3c=_0x485f3c||0x1f4;return function(_0xeac755){logger[_0x96da('0x2a')](_0xeac755['stack']);if(_0xeac755['name']){delete _0xeac755['name'];}_0x2d5adb[_0x96da('0x1b')](_0x485f3c)[_0x96da('0x2b')](_0xeac755);};}exports['index']=function(_0x8e4979,_0x437cda){var _0x2a7d35={},_0x58251c={},_0xd57e3={'count':0x0,'rows':[]};var _0x383205=_[_0x96da('0x2c')](db['CannedAnswer'][_0x96da('0x2d')],function(_0x3bd7c6){return{'name':_0x3bd7c6['fieldName'],'type':_0x3bd7c6['type'][_0x96da('0x2e')]};});_0x58251c[_0x96da('0x2f')]=_[_0x96da('0x2c')](_0x383205,'name');_0x58251c[_0x96da('0x30')]=_[_0x96da('0x31')](_0x8e4979[_0x96da('0x30')]);_0x58251c[_0x96da('0x32')]=_[_0x96da('0x33')](_0x58251c[_0x96da('0x2f')],_0x58251c['query']);_0x2a7d35[_0x96da('0x34')]=_[_0x96da('0x33')](_0x58251c[_0x96da('0x2f')],qs[_0x96da('0x35')](_0x8e4979[_0x96da('0x30')][_0x96da('0x35')]));_0x2a7d35[_0x96da('0x34')]=_0x2a7d35['attributes'][_0x96da('0x36')]?_0x2a7d35[_0x96da('0x34')]:_0x58251c[_0x96da('0x2f')];if(!_0x8e4979[_0x96da('0x30')][_0x96da('0x37')](_0x96da('0x38'))){_0x2a7d35[_0x96da('0x39')]=qs[_0x96da('0x39')](_0x8e4979[_0x96da('0x30')][_0x96da('0x39')]);_0x2a7d35[_0x96da('0x1d')]=qs[_0x96da('0x1d')](_0x8e4979[_0x96da('0x30')][_0x96da('0x1d')]);}_0x2a7d35[_0x96da('0x3a')]=qs[_0x96da('0x3b')](_0x8e4979[_0x96da('0x30')]['sort']);_0x2a7d35[_0x96da('0x3c')]=qs[_0x96da('0x32')](_[_0x96da('0x3d')](_0x8e4979[_0x96da('0x30')],_0x58251c['filters']),_0x383205);if(_0x8e4979[_0x96da('0x30')]['filter']){_0x2a7d35[_0x96da('0x3c')]=_['merge'](_0x2a7d35['where'],{'$or':[{'key':{'$like':'%'+_0x8e4979[_0x96da('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x8e4979['query']['filter']+'%'}}]});}_0x2a7d35=_['merge']({},_0x2a7d35,_0x8e4979[_0x96da('0x3e')]);var _0x49a978={'where':_0x2a7d35[_0x96da('0x3c')]};return db[_0x96da('0x3f')]['count'](_0x49a978)[_0x96da('0x25')](function(_0x550cff){_0xd57e3[_0x96da('0x1e')]=_0x550cff;if(_0x8e4979[_0x96da('0x30')]['includeAll']){_0x2a7d35[_0x96da('0x40')]=[{'all':!![]}];}return db[_0x96da('0x3f')][_0x96da('0x41')](_0x2a7d35);})['then'](function(_0x4bf247){_0xd57e3[_0x96da('0x42')]=_0x4bf247;return _0xd57e3;})[_0x96da('0x25')](respondWithFilteredResult(_0x437cda,_0x2a7d35))[_0x96da('0x43')](handleError(_0x437cda,null));};exports[_0x96da('0x44')]=function(_0x26e812,_0x4844e9){var _0x4e9dfc={'raw':!![],'where':{'id':_0x26e812[_0x96da('0x45')]['id']}},_0x5168b4={};_0x5168b4[_0x96da('0x2f')]=_['keys'](db['CannedAnswer'][_0x96da('0x2d')]);_0x5168b4[_0x96da('0x30')]=_[_0x96da('0x31')](_0x26e812['query']);_0x5168b4['filters']=_['intersection'](_0x5168b4[_0x96da('0x2f')],_0x5168b4[_0x96da('0x30')]);_0x4e9dfc[_0x96da('0x34')]=_[_0x96da('0x33')](_0x5168b4[_0x96da('0x2f')],qs[_0x96da('0x35')](_0x26e812[_0x96da('0x30')][_0x96da('0x35')]));_0x4e9dfc[_0x96da('0x34')]=_0x4e9dfc[_0x96da('0x34')][_0x96da('0x36')]?_0x4e9dfc['attributes']:_0x5168b4[_0x96da('0x2f')];if(_0x26e812[_0x96da('0x30')][_0x96da('0x46')]){_0x4e9dfc[_0x96da('0x40')]=[{'all':!![]}];}_0x4e9dfc=_[_0x96da('0x47')]({},_0x4e9dfc,_0x26e812[_0x96da('0x3e')]);return db[_0x96da('0x3f')][_0x96da('0x48')](_0x4e9dfc)['then'](handleEntityNotFound(_0x4844e9,null))[_0x96da('0x25')](respondWithResult(_0x4844e9,null))[_0x96da('0x43')](handleError(_0x4844e9,null));};exports[_0x96da('0x49')]=function(_0x14bdb1,_0x3a9f54){if(_0x14bdb1[_0x96da('0x4a')]['id']){delete _0x14bdb1[_0x96da('0x4a')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x14bdb1[_0x96da('0x45')]['id']}})[_0x96da('0x25')](handleEntityNotFound(_0x3a9f54,null))['then'](saveUpdates(_0x14bdb1[_0x96da('0x4a')],null))[_0x96da('0x25')](respondWithResult(_0x3a9f54,null))[_0x96da('0x43')](handleError(_0x3a9f54,null));};exports[_0x96da('0x28')]=function(_0x1de6c2,_0x3fb280){return db['CannedAnswer'][_0x96da('0x48')]({'where':{'id':_0x1de6c2['params']['id']}})[_0x96da('0x25')](handleEntityNotFound(_0x3fb280,null))['then'](removeEntity(_0x3fb280,null))['catch'](handleError(_0x3fb280,null));};exports[_0x96da('0x4b')]=function(_0x4cc7ea,_0xaaa833){var _0x267e70={'key':_0x4cc7ea[_0x96da('0x4a')]['key']};if(_0x4cc7ea['body'][_0x96da('0x4c')]){_0x267e70[_0x96da('0x4c')]=_0x4cc7ea[_0x96da('0x4a')]['MailAccountId'];}else if(_0x4cc7ea[_0x96da('0x4a')]['SmsAccountId']){_0x267e70['SmsAccountId']=_0x4cc7ea[_0x96da('0x4a')][_0x96da('0x4d')];}else if(_0x4cc7ea[_0x96da('0x4a')]['OpenchannelAccountId']){_0x267e70[_0x96da('0x4e')]=_0x4cc7ea[_0x96da('0x4a')]['OpenchannelAccountId'];}else if(_0x4cc7ea[_0x96da('0x4a')][_0x96da('0x4f')]){_0x267e70[_0x96da('0x4f')]=_0x4cc7ea[_0x96da('0x4a')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x267e70})['then'](function(_0x27a7de){if(_0x27a7de){throw new db[(_0x96da('0x50'))][(_0x96da('0x51'))](_0x96da('0x52'));}return db[_0x96da('0x3f')][_0x96da('0x4b')](_0x4cc7ea[_0x96da('0x4a')]);})[_0x96da('0x25')](function(_0x2690dc){var _0x563332=_0x4cc7ea[_0x96da('0x53')][_0x96da('0x54')]({'plain':!![]});if(!_0x563332)throw new Error(_0x96da('0x55'));if(_0x563332[_0x96da('0x56')]===_0x96da('0x53')){var _0x486b50=_0x2690dc['get']({'plain':!![]});return db[_0x96da('0x57')][_0x96da('0x48')]({'where':{'name':_0x96da('0x26'),'userProfileId':_0x563332['userProfileId']},'raw':!![]})['then'](function(_0x1df54f){if(_0x1df54f&&_0x1df54f[_0x96da('0x58')]===0x0){return db[_0x96da('0x27')][_0x96da('0x4b')]({'name':_0x486b50[_0x96da('0x59')],'resourceId':_0x486b50['id'],'type':_0x1df54f[_0x96da('0x59')],'sectionId':_0x1df54f['id']},{})['then'](function(){return _0x2690dc;});}else{return _0x2690dc;}})[_0x96da('0x43')](function(_0xfd9044){logger[_0x96da('0x2a')](_0x96da('0x5a'),_0xfd9044);throw _0xfd9044;});}return _0x2690dc;})[_0x96da('0x25')](respondWithResult(_0xaaa833,0xc9))[_0x96da('0x43')](handleError(_0xaaa833,null));}; \ No newline at end of file +var _0x20bc=['limit','set','Content-Range','apply','reject','then','CannedAnswers','UserProfileResource','destroy','status','stack','name','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','update','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x20bc,0x19c));var _0xc20b=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0x20bc[_0x2f1ac4];return _0x18e1a5;};'use strict';var emlformat=require(_0xc20b('0x0'));var rimraf=require(_0xc20b('0x1'));var zipdir=require(_0xc20b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc20b('0x3'));var moment=require(_0xc20b('0x4'));var BPromise=require(_0xc20b('0x5'));var Mustache=require(_0xc20b('0x6'));var util=require('util');var path=require(_0xc20b('0x7'));var sox=require('sox');var csv=require(_0xc20b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc20b('0x9'));var squel=require('squel');var crypto=require(_0xc20b('0xa'));var jsforce=require(_0xc20b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc20b('0x8'));var querystring=require(_0xc20b('0xc'));var Papa=require(_0xc20b('0xd'));var Redis=require(_0xc20b('0xe'));var authService=require(_0xc20b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc20b('0x10'));var logger=require(_0xc20b('0x11'))(_0xc20b('0x12'));var utils=require(_0xc20b('0x13'));var config=require(_0xc20b('0x14'));var licenseUtil=require(_0xc20b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3efb14,_0x4a9a3e){_0x4a9a3e=_0x4a9a3e||0xcc;return function(_0x3f721d){if(_0x3f721d){return _0x3efb14[_0xc20b('0x16')](_0x4a9a3e);}return _0x3efb14['status'](_0x4a9a3e)[_0xc20b('0x17')]();};}function respondWithResult(_0x163e64,_0x4266e){_0x4266e=_0x4266e||0xc8;return function(_0x2f3f2c){if(_0x2f3f2c){return _0x163e64['status'](_0x4266e)[_0xc20b('0x18')](_0x2f3f2c);}};}function respondWithFilteredResult(_0x15405f,_0x46908e){return function(_0x148387){if(_0x148387){var _0x5b570b=typeof _0x46908e[_0xc20b('0x19')]===_0xc20b('0x1a')&&typeof _0x46908e['limit']===_0xc20b('0x1a');var _0x3a1765=_0x148387[_0xc20b('0x1b')];var _0x30c222=_0x5b570b?0x0:_0x46908e['offset'];var _0x3bc5dd=_0x5b570b?_0x148387[_0xc20b('0x1b')]:_0x46908e[_0xc20b('0x19')]+_0x46908e[_0xc20b('0x1c')];var _0x53cb9e;if(_0x3bc5dd>=_0x3a1765){_0x3bc5dd=_0x3a1765;_0x53cb9e=0xc8;}else{_0x53cb9e=0xce;}_0x15405f['status'](_0x53cb9e);return _0x15405f[_0xc20b('0x1d')](_0xc20b('0x1e'),_0x30c222+'-'+_0x3bc5dd+'/'+_0x3a1765)[_0xc20b('0x18')](_0x148387);}return null;};}function patchUpdates(_0x38d2f0){return function(_0x3aa595){try{jsonpatch[_0xc20b('0x1f')](_0x3aa595,_0x38d2f0,!![]);}catch(_0xf2eade){return BPromise[_0xc20b('0x20')](_0xf2eade);}return _0x3aa595['save']();};}function saveUpdates(_0x579e01,_0x5d5333){return function(_0x1e7a4a){if(_0x1e7a4a){return _0x1e7a4a['update'](_0x579e01)[_0xc20b('0x21')](function(_0x428741){return _0x428741;});}return null;};}function removeEntity(_0x43aa53,_0x139468){return function(_0x393b16){if(_0x393b16){return _0x393b16['destroy']()[_0xc20b('0x21')](function(){var _0x459cbd=_0x393b16['get']({'plain':!![]});var _0x9bd418=_0xc20b('0x22');return db[_0xc20b('0x23')][_0xc20b('0x24')]({'where':{'type':_0x9bd418,'resourceId':_0x459cbd['id']}})[_0xc20b('0x21')](function(){return _0x393b16;});})[_0xc20b('0x21')](function(){_0x43aa53[_0xc20b('0x25')](0xcc)[_0xc20b('0x17')]();});}};}function handleEntityNotFound(_0x12cb4d,_0x3374ec){return function(_0x368bca){if(!_0x368bca){_0x12cb4d[_0xc20b('0x16')](0x194);}return _0x368bca;};}function handleError(_0xa9b3d9,_0x5bde17){_0x5bde17=_0x5bde17||0x1f4;return function(_0x38a073){logger['error'](_0x38a073[_0xc20b('0x26')]);if(_0x38a073[_0xc20b('0x27')]){delete _0x38a073[_0xc20b('0x27')];}_0xa9b3d9[_0xc20b('0x25')](_0x5bde17)['send'](_0x38a073);};}exports[_0xc20b('0x28')]=function(_0x4c5009,_0x3f6fee){var _0x4cebc6={},_0x112b96={},_0x4371d4={'count':0x0,'rows':[]};var _0x34e78f=_[_0xc20b('0x29')](db[_0xc20b('0x2a')]['rawAttributes'],function(_0x3e1620){return{'name':_0x3e1620[_0xc20b('0x2b')],'type':_0x3e1620[_0xc20b('0x2c')]['key']};});_0x112b96[_0xc20b('0x2d')]=_[_0xc20b('0x29')](_0x34e78f,_0xc20b('0x27'));_0x112b96[_0xc20b('0x2e')]=_[_0xc20b('0x2f')](_0x4c5009[_0xc20b('0x2e')]);_0x112b96[_0xc20b('0x30')]=_['intersection'](_0x112b96[_0xc20b('0x2d')],_0x112b96[_0xc20b('0x2e')]);_0x4cebc6[_0xc20b('0x31')]=_[_0xc20b('0x32')](_0x112b96[_0xc20b('0x2d')],qs[_0xc20b('0x33')](_0x4c5009[_0xc20b('0x2e')][_0xc20b('0x33')]));_0x4cebc6[_0xc20b('0x31')]=_0x4cebc6[_0xc20b('0x31')][_0xc20b('0x34')]?_0x4cebc6[_0xc20b('0x31')]:_0x112b96[_0xc20b('0x2d')];if(!_0x4c5009[_0xc20b('0x2e')]['hasOwnProperty'](_0xc20b('0x35'))){_0x4cebc6[_0xc20b('0x1c')]=qs['limit'](_0x4c5009['query'][_0xc20b('0x1c')]);_0x4cebc6[_0xc20b('0x19')]=qs[_0xc20b('0x19')](_0x4c5009[_0xc20b('0x2e')][_0xc20b('0x19')]);}_0x4cebc6[_0xc20b('0x36')]=qs[_0xc20b('0x37')](_0x4c5009[_0xc20b('0x2e')][_0xc20b('0x37')]);_0x4cebc6[_0xc20b('0x38')]=qs[_0xc20b('0x30')](_[_0xc20b('0x39')](_0x4c5009[_0xc20b('0x2e')],_0x112b96[_0xc20b('0x30')]),_0x34e78f);if(_0x4c5009['query'][_0xc20b('0x3a')]){_0x4cebc6[_0xc20b('0x38')]=_[_0xc20b('0x3b')](_0x4cebc6[_0xc20b('0x38')],{'$or':[{'key':{'$like':'%'+_0x4c5009[_0xc20b('0x2e')]['filter']+'%'}},{'value':{'$like':'%'+_0x4c5009[_0xc20b('0x2e')][_0xc20b('0x3a')]+'%'}}]});}_0x4cebc6=_[_0xc20b('0x3b')]({},_0x4cebc6,_0x4c5009[_0xc20b('0x3c')]);var _0x31dcef={'where':_0x4cebc6[_0xc20b('0x38')]};return db[_0xc20b('0x2a')][_0xc20b('0x1b')](_0x31dcef)[_0xc20b('0x21')](function(_0x4b279f){_0x4371d4[_0xc20b('0x1b')]=_0x4b279f;if(_0x4c5009['query'][_0xc20b('0x3d')]){_0x4cebc6[_0xc20b('0x3e')]=[{'all':!![]}];}return db[_0xc20b('0x2a')][_0xc20b('0x3f')](_0x4cebc6);})[_0xc20b('0x21')](function(_0x43f5af){_0x4371d4['rows']=_0x43f5af;return _0x4371d4;})['then'](respondWithFilteredResult(_0x3f6fee,_0x4cebc6))[_0xc20b('0x40')](handleError(_0x3f6fee,null));};exports[_0xc20b('0x41')]=function(_0x5dd3a5,_0x29d9fe){var _0x5342f6={'raw':!![],'where':{'id':_0x5dd3a5[_0xc20b('0x42')]['id']}},_0x1c80b5={};_0x1c80b5[_0xc20b('0x2d')]=_[_0xc20b('0x2f')](db[_0xc20b('0x2a')][_0xc20b('0x43')]);_0x1c80b5[_0xc20b('0x2e')]=_[_0xc20b('0x2f')](_0x5dd3a5[_0xc20b('0x2e')]);_0x1c80b5['filters']=_['intersection'](_0x1c80b5[_0xc20b('0x2d')],_0x1c80b5['query']);_0x5342f6[_0xc20b('0x31')]=_[_0xc20b('0x32')](_0x1c80b5[_0xc20b('0x2d')],qs[_0xc20b('0x33')](_0x5dd3a5[_0xc20b('0x2e')]['fields']));_0x5342f6['attributes']=_0x5342f6[_0xc20b('0x31')][_0xc20b('0x34')]?_0x5342f6[_0xc20b('0x31')]:_0x1c80b5[_0xc20b('0x2d')];if(_0x5dd3a5[_0xc20b('0x2e')][_0xc20b('0x3d')]){_0x5342f6[_0xc20b('0x3e')]=[{'all':!![]}];}_0x5342f6=_[_0xc20b('0x3b')]({},_0x5342f6,_0x5dd3a5[_0xc20b('0x3c')]);return db[_0xc20b('0x2a')][_0xc20b('0x44')](_0x5342f6)[_0xc20b('0x21')](handleEntityNotFound(_0x29d9fe,null))[_0xc20b('0x21')](respondWithResult(_0x29d9fe,null))[_0xc20b('0x40')](handleError(_0x29d9fe,null));};exports[_0xc20b('0x45')]=function(_0x34337d,_0x3d1a0a){if(_0x34337d['body']['id']){delete _0x34337d[_0xc20b('0x46')]['id'];}return db['CannedAnswer'][_0xc20b('0x44')]({'where':{'id':_0x34337d[_0xc20b('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d1a0a,null))[_0xc20b('0x21')](saveUpdates(_0x34337d['body'],null))['then'](respondWithResult(_0x3d1a0a,null))['catch'](handleError(_0x3d1a0a,null));};exports[_0xc20b('0x24')]=function(_0x534a2e,_0x14982d){return db[_0xc20b('0x2a')][_0xc20b('0x44')]({'where':{'id':_0x534a2e['params']['id']}})[_0xc20b('0x21')](handleEntityNotFound(_0x14982d,null))['then'](removeEntity(_0x14982d,null))[_0xc20b('0x40')](handleError(_0x14982d,null));};exports['create']=function(_0x528bbc,_0x2a95c6){var _0x3585ed={'key':_0x528bbc[_0xc20b('0x46')][_0xc20b('0x47')]};if(_0x528bbc['body']['MailAccountId']){_0x3585ed['MailAccountId']=_0x528bbc['body'][_0xc20b('0x48')];}else if(_0x528bbc[_0xc20b('0x46')]['SmsAccountId']){_0x3585ed[_0xc20b('0x49')]=_0x528bbc[_0xc20b('0x46')][_0xc20b('0x49')];}else if(_0x528bbc[_0xc20b('0x46')][_0xc20b('0x4a')]){_0x3585ed[_0xc20b('0x4a')]=_0x528bbc[_0xc20b('0x46')]['OpenchannelAccountId'];}else if(_0x528bbc[_0xc20b('0x46')][_0xc20b('0x4b')]){_0x3585ed[_0xc20b('0x4b')]=_0x528bbc[_0xc20b('0x46')][_0xc20b('0x4b')];}return db[_0xc20b('0x2a')][_0xc20b('0x44')]({'where':_0x3585ed})[_0xc20b('0x21')](function(_0x2beefe){if(_0x2beefe){throw new db[(_0xc20b('0x4c'))][(_0xc20b('0x4d'))](_0xc20b('0x4e'));}return db[_0xc20b('0x2a')][_0xc20b('0x4f')](_0x528bbc['body']);})[_0xc20b('0x21')](function(_0x16212c){var _0x139503=_0x528bbc['user'][_0xc20b('0x50')]({'plain':!![]});if(!_0x139503)throw new Error(_0xc20b('0x51'));if(_0x139503[_0xc20b('0x52')]===_0xc20b('0x53')){var _0x4cb4b5=_0x16212c[_0xc20b('0x50')]({'plain':!![]});return db[_0xc20b('0x54')]['find']({'where':{'name':_0xc20b('0x22'),'userProfileId':_0x139503[_0xc20b('0x55')]},'raw':!![]})[_0xc20b('0x21')](function(_0x3861e9){if(_0x3861e9&&_0x3861e9[_0xc20b('0x56')]===0x0){return db[_0xc20b('0x23')][_0xc20b('0x4f')]({'name':_0x4cb4b5['name'],'resourceId':_0x4cb4b5['id'],'type':_0x3861e9['name'],'sectionId':_0x3861e9['id']},{})[_0xc20b('0x21')](function(){return _0x16212c;});}else{return _0x16212c;}})[_0xc20b('0x40')](function(_0x18ad89){logger['error'](_0xc20b('0x57'),_0x18ad89);throw _0x18ad89;});}return _0x16212c;})[_0xc20b('0x21')](respondWithResult(_0x2a95c6,0xc9))[_0xc20b('0x40')](handleError(_0x2a95c6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 161f914..aa856b1 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 _0xf4fb=['exports','define','CannedAnswer','utf8mb4','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf4fb,0x12d));var _0xbf4f=function(_0x239b90,_0xb0bf10){_0x239b90=_0x239b90-0x0;var _0x57f19b=_0xf4fb[_0x239b90];return _0x57f19b;};'use strict';var _=require(_0xbf4f('0x0'));var util=require('util');var logger=require(_0xbf4f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbf4f('0x2'));var rp=require(_0xbf4f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4f('0x4'));var config=require(_0xbf4f('0x5'));var attributes=require(_0xbf4f('0x6'));module[_0xbf4f('0x7')]=function(_0x5ce884,_0x977e51){return _0x5ce884[_0xbf4f('0x8')](_0xbf4f('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf4f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc097=['tools_canned_answers','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x39b0f0,_0x255fa0){var _0x514d2d=function(_0x2c5694){while(--_0x2c5694){_0x39b0f0['push'](_0x39b0f0['shift']());}};_0x514d2d(++_0x255fa0);}(_0xc097,0x16a));var _0x7c09=function(_0x132dbb,_0x12f219){_0x132dbb=_0x132dbb-0x0;var _0x189ac5=_0xc097[_0x132dbb];return _0x189ac5;};'use strict';var _=require(_0x7c09('0x0'));var util=require('util');var logger=require(_0x7c09('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7c09('0x2'));var rp=require(_0x7c09('0x3'));var fs=require('fs');var path=require(_0x7c09('0x4'));var rimraf=require('rimraf');var config=require(_0x7c09('0x5'));var attributes=require(_0x7c09('0x6'));module[_0x7c09('0x7')]=function(_0x470d4e,_0x15bd95){return _0x470d4e[_0x7c09('0x8')](_0x7c09('0x9'),attributes,{'tableName':_0x7c09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c09('0xb'),'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 a4f2da0..63ff331 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(_0x41baa3,_0x557b11){var _0x380294=function(_0x63e9e7){while(--_0x63e9e7){_0x41baa3['push'](_0x41baa3['shift']());}};_0x380294(++_0x557b11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x304e86,_0x4261df){var _0x3ba1c8=function(_0x1854ed){while(--_0x1854ed){_0x304e86['push'](_0x304e86['shift']());}};_0x3ba1c8(++_0x4261df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 8a0b757..c19956b 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 _0x4889=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x4889,0x1c3));var _0x9488=function(_0x30730c,_0x5e00f2){_0x30730c=_0x30730c-0x0;var _0x554424=_0x4889[_0x30730c];return _0x554424;};'use strict';var multer=require(_0x9488('0x0'));var util=require(_0x9488('0x1'));var path=require(_0x9488('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9488('0x3')]();var fs_extra=require(_0x9488('0x4'));var auth=require(_0x9488('0x5'));var interaction=require(_0x9488('0x6'));var config=require('../../config/environment');var controller=require(_0x9488('0x7'));router[_0x9488('0x8')]('/',auth[_0x9488('0x9')](),controller[_0x9488('0xa')]);router[_0x9488('0x8')](_0x9488('0xb'),auth[_0x9488('0x9')](),controller[_0x9488('0xc')]);router[_0x9488('0xd')]('/',auth[_0x9488('0x9')](),controller[_0x9488('0xe')]);router[_0x9488('0xf')](_0x9488('0xb'),auth[_0x9488('0x9')](),controller[_0x9488('0x10')]);router['delete']('/:id',auth[_0x9488('0x9')](),controller[_0x9488('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2880=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x48d30b,_0x18ec35){var _0x102aac=function(_0x276a63){while(--_0x276a63){_0x48d30b['push'](_0x48d30b['shift']());}};_0x102aac(++_0x18ec35);}(_0x2880,0x190));var _0x0288=function(_0x20ae89,_0x3363de){_0x20ae89=_0x20ae89-0x0;var _0x29abc4=_0x2880[_0x20ae89];return _0x29abc4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0288('0x0'));var timeout=require(_0x0288('0x1'));var express=require(_0x0288('0x2'));var router=express[_0x0288('0x3')]();var fs_extra=require(_0x0288('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0288('0x5'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x0288('0x6')]('/',auth[_0x0288('0x7')](),controller['index']);router[_0x0288('0x6')](_0x0288('0x8'),auth[_0x0288('0x7')](),controller[_0x0288('0x9')]);router[_0x0288('0xa')]('/',auth[_0x0288('0x7')](),controller[_0x0288('0xb')]);router[_0x0288('0xc')](_0x0288('0x8'),auth['isAuthenticated'](),controller[_0x0288('0xd')]);router['delete'](_0x0288('0x8'),auth['isAuthenticated'](),controller[_0x0288('0xe')]);module[_0x0288('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ec47348..64572f6 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 _0xbf3f=['INTEGER','sequelize','STRING'];(function(_0x1de329,_0x36924c){var _0xc91708=function(_0x4a12f0){while(--_0x4a12f0){_0x1de329['push'](_0x1de329['shift']());}};_0xc91708(++_0x36924c);}(_0xbf3f,0x10f));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfbf3('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xfbf3('0x1')]},'dcontext':{'type':Sequelize[_0xfbf3('0x1')]},'channel':{'type':Sequelize[_0xfbf3('0x1')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xfbf3('0x1')]},'lastdata':{'type':Sequelize[_0xfbf3('0x1')]},'duration':{'type':Sequelize[_0xfbf3('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfbf3('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfbf3('0x1')]},'amaflags':{'type':Sequelize[_0xfbf3('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfbf3('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfbf3('0x1')]},'linkedid':{'type':Sequelize[_0xfbf3('0x1')]},'sequence':{'type':Sequelize[_0xfbf3('0x1')]},'peeraccount':{'type':Sequelize[_0xfbf3('0x1')]},'type':{'type':Sequelize[_0xfbf3('0x1')]},'tag':{'type':Sequelize[_0xfbf3('0x1')]}}; \ No newline at end of file +var _0xcf1c=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x55d8ad,_0x9657fa){var _0x5e22d5=function(_0x1418a2){while(--_0x1418a2){_0x55d8ad['push'](_0x55d8ad['shift']());}};_0x5e22d5(++_0x9657fa);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1eadfb,_0xc1e08b){_0x1eadfb=_0x1eadfb-0x0;var _0x5500fc=_0xcf1c[_0x1eadfb];return _0x5500fc;};'use strict';var Sequelize=require(_0xccf1('0x0'));module[_0xccf1('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xccf1('0x2')},'clid':{'type':Sequelize[_0xccf1('0x3')]},'src':{'type':Sequelize[_0xccf1('0x3')]},'dst':{'type':Sequelize[_0xccf1('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xccf1('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xccf1('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xccf1('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xccf1('0x3')]},'amaflags':{'type':Sequelize[_0xccf1('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xccf1('0x3')]},'userfield':{'type':Sequelize[_0xccf1('0x3')]},'uniqueid':{'type':Sequelize[_0xccf1('0x3')]},'linkedid':{'type':Sequelize[_0xccf1('0x3')]},'sequence':{'type':Sequelize[_0xccf1('0x3')]},'peeraccount':{'type':Sequelize[_0xccf1('0x3')]},'type':{'type':Sequelize[_0xccf1('0x3')]},'tag':{'type':Sequelize[_0xccf1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 64db42a..06be820 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 _0xafdd=['pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x564d53,_0x31ac8a){var _0x1ba891=function(_0x51cad3){while(--_0x51cad3){_0x564d53['push'](_0x564d53['shift']());}};_0x1ba891(++_0x31ac8a);}(_0xafdd,0x19a));var _0xdafd=function(_0x59aa87,_0x4b0699){_0x59aa87=_0x59aa87-0x0;var _0x3e96bb=_0xafdd[_0x59aa87];return _0x3e96bb;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['index']=function(_0x243182,_0x14626b){var _0x13ab81={},_0x249743={},_0x21edb6={'count':0x0,'rows':[]};var _0x324f0f=_['map'](db['Cdr']['rawAttributes'],function(_0xcca4f){return{'name':_0xcca4f[_0xdafd('0x2e')],'type':_0xcca4f['type']['key']};});_0x249743[_0xdafd('0x2f')]=_[_0xdafd('0x30')](_0x324f0f,_0xdafd('0x2c'));_0x249743[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0x243182[_0xdafd('0x31')]);_0x249743[_0xdafd('0x33')]=_['intersection'](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x31')]);_0x13ab81[_0xdafd('0x34')]=_['intersection'](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0x243182['query'][_0xdafd('0x35')]));_0x13ab81[_0xdafd('0x34')]=_0x13ab81[_0xdafd('0x34')]['length']?_0x13ab81[_0xdafd('0x34')]:_0x249743[_0xdafd('0x2f')];if(!_0x243182[_0xdafd('0x31')][_0xdafd('0x36')](_0xdafd('0x37'))){_0x13ab81[_0xdafd('0x20')]=qs[_0xdafd('0x20')](_0x243182['query'][_0xdafd('0x20')]);_0x13ab81[_0xdafd('0x1e')]=qs[_0xdafd('0x1e')](_0x243182[_0xdafd('0x31')][_0xdafd('0x1e')]);}_0x13ab81['order']=qs[_0xdafd('0x38')](_0x243182[_0xdafd('0x31')]['sort']);_0x13ab81[_0xdafd('0x39')]=qs[_0xdafd('0x33')](_[_0xdafd('0x3a')](_0x243182[_0xdafd('0x31')],_0x249743[_0xdafd('0x33')]),_0x324f0f);if(_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]){_0x13ab81[_0xdafd('0x39')]=_[_0xdafd('0x3c')](_0x13ab81[_0xdafd('0x39')],{'$or':_[_0xdafd('0x30')](_0x324f0f,function(_0x245163){if(_0x245163[_0xdafd('0x3d')]!==_0xdafd('0x3e')){var _0xb1e264={};_0xb1e264[_0x245163[_0xdafd('0x2c')]]={'$like':'%'+_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]+'%'};return _0xb1e264;}})});}_0x13ab81=_[_0xdafd('0x3c')]({},_0x13ab81,_0x243182[_0xdafd('0x3f')]);var _0x3f25c2={'where':_0x13ab81[_0xdafd('0x39')]};return db[_0xdafd('0x40')][_0xdafd('0x21')](_0x3f25c2)[_0xdafd('0x27')](function(_0x21d43d){_0x21edb6['count']=_0x21d43d;if(_0x243182['query'][_0xdafd('0x41')]){_0x13ab81['include']=[{'all':!![]}];}return db[_0xdafd('0x40')][_0xdafd('0x42')](_0x13ab81);})['then'](function(_0x4b463c){_0x21edb6[_0xdafd('0x43')]=_0x4b463c;return _0x21edb6;})[_0xdafd('0x27')](respondWithFilteredResult(_0x14626b,_0x13ab81))[_0xdafd('0x44')](handleError(_0x14626b,null));};exports[_0xdafd('0x45')]=function(_0xbc5159,_0x184a59){var _0x3a3a14={'raw':!![],'where':{'id':_0xbc5159[_0xdafd('0x46')]['id']}},_0x2417f8={};_0x2417f8['model']=_['keys'](db[_0xdafd('0x40')][_0xdafd('0x47')]);_0x2417f8[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0xbc5159[_0xdafd('0x31')]);_0x2417f8[_0xdafd('0x33')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],_0x2417f8[_0xdafd('0x31')]);_0x3a3a14[_0xdafd('0x34')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0xbc5159['query'][_0xdafd('0x35')]));_0x3a3a14['attributes']=_0x3a3a14[_0xdafd('0x34')]['length']?_0x3a3a14[_0xdafd('0x34')]:_0x2417f8[_0xdafd('0x2f')];if(_0xbc5159[_0xdafd('0x31')][_0xdafd('0x41')]){_0x3a3a14[_0xdafd('0x49')]=[{'all':!![]}];}_0x3a3a14=_[_0xdafd('0x3c')]({},_0x3a3a14,_0xbc5159['options']);return db[_0xdafd('0x40')][_0xdafd('0x4a')](_0x3a3a14)[_0xdafd('0x27')](handleEntityNotFound(_0x184a59,null))[_0xdafd('0x27')](respondWithResult(_0x184a59,null))[_0xdafd('0x44')](handleError(_0x184a59,null));};exports['create']=function(_0x48cc85,_0x189d61){return db[_0xdafd('0x40')][_0xdafd('0x4b')](_0x48cc85[_0xdafd('0x4c')],{})[_0xdafd('0x27')](respondWithResult(_0x189d61,0xc9))[_0xdafd('0x44')](handleError(_0x189d61,null));};exports[_0xdafd('0x4d')]=function(_0x2f5e4c,_0x2ae4cd){if(_0x2f5e4c['body']['id']){delete _0x2f5e4c[_0xdafd('0x4c')]['id'];}return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x2f5e4c[_0xdafd('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x27')](saveUpdates(_0x2f5e4c[_0xdafd('0x4c')],null))[_0xdafd('0x27')](respondWithResult(_0x2ae4cd,null))[_0xdafd('0x44')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x28')]=function(_0x4b6fbb,_0x5af1a8){return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x4b6fbb['params']['id']}})['then'](handleEntityNotFound(_0x5af1a8,null))[_0xdafd('0x27')](removeEntity(_0x5af1a8,null))[_0xdafd('0x44')](handleError(_0x5af1a8,null));};exports['describe']=function(_0x2dde06,_0x5dc9a0){return db[_0xdafd('0x40')]['describe']()['then'](respondWithResult(_0x5dc9a0,null))[_0xdafd('0x44')](handleError(_0x5dc9a0,null));}; \ No newline at end of file +var _0x5577=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','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/license/hardware','../../config/utils','../../config/environment'];(function(_0x277870,_0x106b59){var _0x47a39e=function(_0x4f7726){while(--_0x4f7726){_0x277870['push'](_0x277870['shift']());}};_0x47a39e(++_0x106b59);}(_0x5577,0x1b4));var _0x7557=function(_0x2ee8c3,_0x295892){_0x2ee8c3=_0x2ee8c3-0x0;var _0x4bd0fb=_0x5577[_0x2ee8c3];return _0x4bd0fb;};'use strict';var emlformat=require(_0x7557('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7557('0x1'));var jsonpatch=require(_0x7557('0x2'));var rp=require('request-promise');var moment=require(_0x7557('0x3'));var BPromise=require(_0x7557('0x4'));var Mustache=require(_0x7557('0x5'));var util=require(_0x7557('0x6'));var path=require(_0x7557('0x7'));var sox=require(_0x7557('0x8'));var csv=require('to-csv');var ejs=require(_0x7557('0x9'));var fs=require('fs');var fs_extra=require(_0x7557('0xa'));var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x10'));var querystring=require(_0x7557('0x11'));var Papa=require(_0x7557('0x12'));var Redis=require(_0x7557('0x13'));var authService=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var as=require(_0x7557('0x16'));var hardwareService=require(_0x7557('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x7557('0x18'));var config=require(_0x7557('0x19'));var licenseUtil=require(_0x7557('0x1a'));var db=require(_0x7557('0x1b'))['db'];function respondWithStatusCode(_0xb6ed30,_0x467ac5){_0x467ac5=_0x467ac5||0xcc;return function(_0x156ac1){if(_0x156ac1){return _0xb6ed30[_0x7557('0x1c')](_0x467ac5);}return _0xb6ed30[_0x7557('0x1d')](_0x467ac5)[_0x7557('0x1e')]();};}function respondWithResult(_0x5468df,_0x276031){_0x276031=_0x276031||0xc8;return function(_0x3fb7a6){if(_0x3fb7a6){return _0x5468df[_0x7557('0x1d')](_0x276031)['json'](_0x3fb7a6);}};}function respondWithFilteredResult(_0x3ad3a1,_0x3c3953){return function(_0x33098f){if(_0x33098f){var _0x325849=typeof _0x3c3953['offset']===_0x7557('0x1f')&&typeof _0x3c3953[_0x7557('0x20')]==='undefined';var _0x4a9cae=_0x33098f[_0x7557('0x21')];var _0x11f186=_0x325849?0x0:_0x3c3953[_0x7557('0x22')];var _0x40a81b=_0x325849?_0x33098f['count']:_0x3c3953[_0x7557('0x22')]+_0x3c3953['limit'];var _0x3e2972;if(_0x40a81b>=_0x4a9cae){_0x40a81b=_0x4a9cae;_0x3e2972=0xc8;}else{_0x3e2972=0xce;}_0x3ad3a1[_0x7557('0x1d')](_0x3e2972);return _0x3ad3a1[_0x7557('0x23')](_0x7557('0x24'),_0x11f186+'-'+_0x40a81b+'/'+_0x4a9cae)['json'](_0x33098f);}return null;};}function patchUpdates(_0x1b60a9){return function(_0x3180cd){try{jsonpatch[_0x7557('0x25')](_0x3180cd,_0x1b60a9,!![]);}catch(_0x34bed5){return BPromise[_0x7557('0x26')](_0x34bed5);}return _0x3180cd['save']();};}function saveUpdates(_0x502e49,_0x4eb212){return function(_0x211fbe){if(_0x211fbe){return _0x211fbe['update'](_0x502e49)[_0x7557('0x27')](function(_0x352b63){return _0x352b63;});}return null;};}function removeEntity(_0x1e97d3,_0x9bbcf6){return function(_0x1533b2){if(_0x1533b2){return _0x1533b2[_0x7557('0x28')]()[_0x7557('0x27')](function(){_0x1e97d3['status'](0xcc)[_0x7557('0x1e')]();});}};}function handleEntityNotFound(_0x5bc953,_0x3daeac){return function(_0x5b2c6a){if(!_0x5b2c6a){_0x5bc953[_0x7557('0x1c')](0x194);}return _0x5b2c6a;};}function handleError(_0x3aa642,_0x4758b9){_0x4758b9=_0x4758b9||0x1f4;return function(_0x42ae94){logger['error'](_0x42ae94[_0x7557('0x29')]);if(_0x42ae94['name']){delete _0x42ae94[_0x7557('0x2a')];}_0x3aa642[_0x7557('0x1d')](_0x4758b9)[_0x7557('0x2b')](_0x42ae94);};}exports['index']=function(_0x3b36eb,_0x2b4ca8){var _0x1c6df9={},_0x1c4649={},_0x19095d={'count':0x0,'rows':[]};var _0x414eec=_['map'](db[_0x7557('0x2c')][_0x7557('0x2d')],function(_0x9080c6){return{'name':_0x9080c6[_0x7557('0x2e')],'type':_0x9080c6['type'][_0x7557('0x2f')]};});_0x1c4649[_0x7557('0x30')]=_[_0x7557('0x31')](_0x414eec,_0x7557('0x2a'));_0x1c4649[_0x7557('0x32')]=_[_0x7557('0x33')](_0x3b36eb[_0x7557('0x32')]);_0x1c4649[_0x7557('0x34')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],_0x1c4649[_0x7557('0x32')]);_0x1c6df9[_0x7557('0x36')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],qs[_0x7557('0x37')](_0x3b36eb[_0x7557('0x32')][_0x7557('0x37')]));_0x1c6df9[_0x7557('0x36')]=_0x1c6df9[_0x7557('0x36')][_0x7557('0x38')]?_0x1c6df9[_0x7557('0x36')]:_0x1c4649[_0x7557('0x30')];if(!_0x3b36eb['query'][_0x7557('0x39')]('nolimit')){_0x1c6df9['limit']=qs[_0x7557('0x20')](_0x3b36eb['query'][_0x7557('0x20')]);_0x1c6df9['offset']=qs['offset'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x22')]);}_0x1c6df9[_0x7557('0x3a')]=qs['sort'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x3b')]);_0x1c6df9[_0x7557('0x3c')]=qs[_0x7557('0x34')](_[_0x7557('0x3d')](_0x3b36eb[_0x7557('0x32')],_0x1c4649[_0x7557('0x34')]),_0x414eec);if(_0x3b36eb[_0x7557('0x32')]['filter']){_0x1c6df9['where']=_['merge'](_0x1c6df9['where'],{'$or':_['map'](_0x414eec,function(_0x4f3c68){if(_0x4f3c68[_0x7557('0x3e')]!==_0x7557('0x3f')){var _0x3a7c60={};_0x3a7c60[_0x4f3c68[_0x7557('0x2a')]]={'$like':'%'+_0x3b36eb['query']['filter']+'%'};return _0x3a7c60;}})});}_0x1c6df9=_[_0x7557('0x40')]({},_0x1c6df9,_0x3b36eb[_0x7557('0x41')]);var _0x962488={'where':_0x1c6df9[_0x7557('0x3c')]};return db[_0x7557('0x2c')]['count'](_0x962488)[_0x7557('0x27')](function(_0x5149c9){_0x19095d[_0x7557('0x21')]=_0x5149c9;if(_0x3b36eb[_0x7557('0x32')][_0x7557('0x42')]){_0x1c6df9[_0x7557('0x43')]=[{'all':!![]}];}return db[_0x7557('0x2c')]['findAll'](_0x1c6df9);})[_0x7557('0x27')](function(_0x3023e5){_0x19095d[_0x7557('0x44')]=_0x3023e5;return _0x19095d;})[_0x7557('0x27')](respondWithFilteredResult(_0x2b4ca8,_0x1c6df9))['catch'](handleError(_0x2b4ca8,null));};exports[_0x7557('0x45')]=function(_0x59a75a,_0x156f3b){var _0x576461={'raw':!![],'where':{'id':_0x59a75a['params']['id']}},_0x16e40f={};_0x16e40f[_0x7557('0x30')]=_['keys'](db[_0x7557('0x2c')]['rawAttributes']);_0x16e40f[_0x7557('0x32')]=_[_0x7557('0x33')](_0x59a75a[_0x7557('0x32')]);_0x16e40f[_0x7557('0x34')]=_[_0x7557('0x35')](_0x16e40f[_0x7557('0x30')],_0x16e40f['query']);_0x576461['attributes']=_['intersection'](_0x16e40f[_0x7557('0x30')],qs[_0x7557('0x37')](_0x59a75a[_0x7557('0x32')][_0x7557('0x37')]));_0x576461[_0x7557('0x36')]=_0x576461['attributes'][_0x7557('0x38')]?_0x576461['attributes']:_0x16e40f[_0x7557('0x30')];if(_0x59a75a[_0x7557('0x32')][_0x7557('0x42')]){_0x576461[_0x7557('0x43')]=[{'all':!![]}];}_0x576461=_[_0x7557('0x40')]({},_0x576461,_0x59a75a[_0x7557('0x41')]);return db[_0x7557('0x2c')][_0x7557('0x46')](_0x576461)['then'](handleEntityNotFound(_0x156f3b,null))[_0x7557('0x27')](respondWithResult(_0x156f3b,null))[_0x7557('0x47')](handleError(_0x156f3b,null));};exports[_0x7557('0x48')]=function(_0x59904c,_0xb25031){return db['Cdr']['create'](_0x59904c[_0x7557('0x49')],{})[_0x7557('0x27')](respondWithResult(_0xb25031,0xc9))[_0x7557('0x47')](handleError(_0xb25031,null));};exports[_0x7557('0x4a')]=function(_0x3683c9,_0x4d9b43){if(_0x3683c9[_0x7557('0x49')]['id']){delete _0x3683c9[_0x7557('0x49')]['id'];}return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x3683c9[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x4d9b43,null))[_0x7557('0x27')](saveUpdates(_0x3683c9['body'],null))['then'](respondWithResult(_0x4d9b43,null))['catch'](handleError(_0x4d9b43,null));};exports['destroy']=function(_0x2b85c5,_0x36a2a1){return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x2b85c5[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x36a2a1,null))[_0x7557('0x27')](removeEntity(_0x36a2a1,null))[_0x7557('0x47')](handleError(_0x36a2a1,null));};exports['describe']=function(_0x46b871,_0x445e17){return db['Cdr'][_0x7557('0x4c')]()['then'](respondWithResult(_0x445e17,null))[_0x7557('0x47')](handleError(_0x445e17,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 65e3a61..31855f2 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4f16bd,_0x2f9263){var _0x2dd933=function(_0x3acb70){while(--_0x3acb70){_0x4f16bd['push'](_0x4f16bd['shift']());}};_0x2dd933(++_0x2f9263);}(_0x7a54,0x106));var _0x47a5=function(_0x33720c,_0x5d7320){_0x33720c=_0x33720c-0x0;var _0x5939ff=_0x7a54[_0x33720c];return _0x5939ff;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xe3cdbf,_0x6f90fc){var _0x17820a=function(_0xd1420d){while(--_0xd1420d){_0xe3cdbf['push'](_0xe3cdbf['shift']());}};_0x17820a(++_0x6f90fc);}(_0x7a54,0x106));var _0x47a5=function(_0x57d445,_0x480187){_0x57d445=_0x57d445-0x0;var _0x4d06f2=_0x7a54[_0x57d445];return _0x4d06f2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 3e85dc8..3506910 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 _0x34c3=['debug','code','error','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x34c3,0xe1));var _0x334c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x34c3[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x334c('0x0'));var util=require(_0x334c('0x1'));var moment=require(_0x334c('0x2'));var BPromise=require(_0x334c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x334c('0x4'));var logger=require(_0x334c('0x5'))(_0x334c('0x6'));var config=require('../../config/environment');var jayson=require(_0x334c('0x7'));var client=jayson[_0x334c('0x8')][_0x334c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486dfe,_0x47e52e,_0x1e9a43){return new BPromise(function(_0x43f5c2,_0xe6b6a9){return client[_0x334c('0xa')](_0x486dfe,_0x1e9a43)[_0x334c('0xb')](function(_0x2c39af){logger[_0x334c('0xc')](_0x334c('0xd'),_0x47e52e,_0x334c('0xe'));logger[_0x334c('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x47e52e,_0x334c('0xe'),JSON['stringify'](_0x2c39af));if(_0x2c39af['error']){if(_0x2c39af['error'][_0x334c('0x10')]===0x1f4){logger[_0x334c('0x11')](_0x334c('0xd'),_0x47e52e,_0x2c39af[_0x334c('0x11')]['message']);return _0xe6b6a9(_0x2c39af[_0x334c('0x11')][_0x334c('0x12')]);}logger[_0x334c('0x11')](_0x334c('0xd'),_0x47e52e,_0x2c39af[_0x334c('0x11')][_0x334c('0x12')]);return _0x43f5c2(_0x2c39af[_0x334c('0x11')][_0x334c('0x12')]);}else{logger[_0x334c('0xc')](_0x334c('0xd'),_0x47e52e,_0x334c('0xe'));_0x43f5c2(_0x2c39af['result'][_0x334c('0x12')]);}})[_0x334c('0x13')](function(_0x3ac76e){logger[_0x334c('0x11')](_0x334c('0xd'),_0x47e52e,_0x3ac76e);_0xe6b6a9(_0x3ac76e);});});} \ No newline at end of file +var _0xd5ea=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x413865,_0x45f066){var _0x2574d7=function(_0x328299){while(--_0x328299){_0x413865['push'](_0x413865['shift']());}};_0x2574d7(++_0x45f066);}(_0xd5ea,0x1b9));var _0xad5e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd5ea[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xad5e('0x0'));var util=require(_0xad5e('0x1'));var moment=require(_0xad5e('0x2'));var BPromise=require(_0xad5e('0x3'));var rs=require(_0xad5e('0x4'));var fs=require('fs');var Redis=require(_0xad5e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad5e('0x6'));var logger=require('../../config/logger')(_0xad5e('0x7'));var config=require(_0xad5e('0x8'));var jayson=require(_0xad5e('0x9'));var client=jayson[_0xad5e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33aa65,_0x440882,_0x4bfd6e){return new BPromise(function(_0x1b11df,_0xef2f35){return client[_0xad5e('0xb')](_0x33aa65,_0x4bfd6e)['then'](function(_0x2cff7f){logger[_0xad5e('0xc')]('Cdr,\x20%s,\x20%s',_0x440882,_0xad5e('0xd'));logger['debug'](_0xad5e('0xe'),_0x440882,_0xad5e('0xd'),JSON[_0xad5e('0xf')](_0x2cff7f));if(_0x2cff7f[_0xad5e('0x10')]){if(_0x2cff7f[_0xad5e('0x10')][_0xad5e('0x11')]===0x1f4){logger[_0xad5e('0x10')](_0xad5e('0x12'),_0x440882,_0x2cff7f[_0xad5e('0x10')][_0xad5e('0x13')]);return _0xef2f35(_0x2cff7f['error']['message']);}logger[_0xad5e('0x10')]('Cdr,\x20%s,\x20%s',_0x440882,_0x2cff7f[_0xad5e('0x10')][_0xad5e('0x13')]);return _0x1b11df(_0x2cff7f['error'][_0xad5e('0x13')]);}else{logger[_0xad5e('0xc')]('Cdr,\x20%s,\x20%s',_0x440882,_0xad5e('0xd'));_0x1b11df(_0x2cff7f[_0xad5e('0x14')][_0xad5e('0x13')]);}})['catch'](function(_0x4aeea8){logger[_0xad5e('0x10')]('Cdr,\x20%s,\x20%s',_0x440882,_0x4aeea8);_0xef2f35(_0x4aeea8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4719d10..7ee44a5 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(_0x2c4e1b,_0x48a2dc){var _0x335117=function(_0x3cac61){while(--_0x3cac61){_0x2c4e1b['push'](_0x2c4e1b['shift']());}};_0x335117(++_0x48a2dc);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 941ffa3..ace0589 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 _0x4942=['noop','TEXT','STRING','exports','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4942,0x12a));var _0x2494=function(_0x18656b,_0x427122){_0x18656b=_0x18656b-0x0;var _0x2612ec=_0x4942[_0x18656b];return _0x2612ec;};'use strict';var Sequelize=require('sequelize');module[_0x2494('0x0')]={'priority':{'type':Sequelize[_0x2494('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2494('0x2')},'appdata':{'type':Sequelize[_0x2494('0x3')]()},'description':{'type':Sequelize[_0x2494('0x4')]},'interval':{'type':Sequelize[_0x2494('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x33ab=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x3f0674,_0x4e8dce){var _0x216fd0=function(_0x3a8736){while(--_0x3a8736){_0x3f0674['push'](_0x3f0674['shift']());}};_0x216fd0(++_0x4e8dce);}(_0x33ab,0x69));var _0xb33a=function(_0x5d91b5,_0x2cf4d2){_0x5d91b5=_0x5d91b5-0x0;var _0x3f7769=_0x33ab[_0x5d91b5];return _0x3f7769;};'use strict';var Sequelize=require(_0xb33a('0x0'));module[_0xb33a('0x1')]={'priority':{'type':Sequelize[_0xb33a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb33a('0x3')},'appdata':{'type':Sequelize[_0xb33a('0x4')]()},'description':{'type':Sequelize[_0xb33a('0x5')]},'interval':{'type':Sequelize[_0xb33a('0x5')],'defaultValue':_0xb33a('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3ede5f1..121337f 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 _0xbfcc=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','attributes','intersection','fields','options','find','catch','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto'];(function(_0xc39233,_0x1765bc){var _0xc8acb2=function(_0x2d67a4){while(--_0x2d67a4){_0xc39233['push'](_0xc39233['shift']());}};_0xc8acb2(++_0x1765bc);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbfcc[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={'raw':!![],'where':{'id':_0x4f632a[_0xcbfc('0x28')]['id']}},_0x7cbdfa={};_0x7cbdfa[_0xcbfc('0x29')]=_[_0xcbfc('0x2a')](db[_0xcbfc('0x2b')]['rawAttributes']);_0x7cbdfa[_0xcbfc('0x2c')]=_[_0xcbfc('0x2a')](_0x4f632a[_0xcbfc('0x2c')]);_0x7cbdfa[_0xcbfc('0x2d')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x29')],_0x7cbdfa[_0xcbfc('0x2c')]);_0x26463f[_0xcbfc('0x2e')]=_[_0xcbfc('0x2f')](_0x7cbdfa[_0xcbfc('0x29')],qs[_0xcbfc('0x30')](_0x4f632a[_0xcbfc('0x2c')]['fields']));_0x26463f[_0xcbfc('0x2e')]=_0x26463f[_0xcbfc('0x2e')]['length']?_0x26463f[_0xcbfc('0x2e')]:_0x7cbdfa[_0xcbfc('0x29')];if(_0x4f632a[_0xcbfc('0x2c')]['includeAll']){_0x26463f['include']=[{'all':!![]}];}_0x26463f=_['merge']({},_0x26463f,_0x4f632a[_0xcbfc('0x31')]);return db[_0xcbfc('0x2b')][_0xcbfc('0x32')](_0x26463f)[_0xcbfc('0x21')](handleEntityNotFound(_0x1f6a14,null))[_0xcbfc('0x21')](respondWithResult(_0x1f6a14,null))[_0xcbfc('0x33')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x34')]=function(_0xc5176f,_0x49ad63){if(_0xc5176f[_0xcbfc('0x35')]['id']){delete _0xc5176f[_0xcbfc('0x35')]['id'];}return db['ChatApplication'][_0xcbfc('0x32')]({'where':{'id':_0xc5176f['params']['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x49ad63,null))[_0xcbfc('0x21')](saveUpdates(_0xc5176f[_0xcbfc('0x35')],null))['then'](respondWithResult(_0x49ad63,null))[_0xcbfc('0x33')](handleError(_0x49ad63,null));};exports['destroy']=function(_0x5af34d,_0x2baf2f){return db[_0xcbfc('0x2b')][_0xcbfc('0x32')]({'where':{'id':_0x5af34d[_0xcbfc('0x28')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x2baf2f,null))[_0xcbfc('0x21')](removeEntity(_0x2baf2f,null))[_0xcbfc('0x33')](handleError(_0x2baf2f,null));}; \ No newline at end of file +var _0x43b1=['fields','length','includeAll','include','merge','then','catch','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','show','params','model','keys','ChatApplication','filters','intersection','query','attributes'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0x43b1,0x7d));var _0x143b=function(_0x3a6205,_0x256f1b){_0x3a6205=_0x3a6205-0x0;var _0x5f49b2=_0x43b1[_0x3a6205];return _0x5f49b2;};'use strict';var emlformat=require(_0x143b('0x0'));var rimraf=require(_0x143b('0x1'));var zipdir=require(_0x143b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x143b('0x3'));var moment=require('moment');var BPromise=require(_0x143b('0x4'));var Mustache=require(_0x143b('0x5'));var util=require(_0x143b('0x6'));var path=require(_0x143b('0x7'));var sox=require(_0x143b('0x8'));var csv=require(_0x143b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x143b('0xa'));var _=require(_0x143b('0xb'));var squel=require(_0x143b('0xc'));var crypto=require('crypto');var jsforce=require(_0x143b('0xd'));var deskjs=require(_0x143b('0xe'));var toCsv=require(_0x143b('0x9'));var querystring=require(_0x143b('0xf'));var Papa=require(_0x143b('0x10'));var Redis=require(_0x143b('0x11'));var authService=require(_0x143b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x143b('0x13'));var hardwareService=require(_0x143b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x143b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x143b('0x16'));var db=require(_0x143b('0x17'))['db'];function respondWithStatusCode(_0x52429f,_0x2d6c07){_0x2d6c07=_0x2d6c07||0xcc;return function(_0x1ef389){if(_0x1ef389){return _0x52429f[_0x143b('0x18')](_0x2d6c07);}return _0x52429f[_0x143b('0x19')](_0x2d6c07)[_0x143b('0x1a')]();};}function respondWithResult(_0x34cd9b,_0x1325c3){_0x1325c3=_0x1325c3||0xc8;return function(_0x40ce06){if(_0x40ce06){return _0x34cd9b[_0x143b('0x19')](_0x1325c3)[_0x143b('0x1b')](_0x40ce06);}};}function respondWithFilteredResult(_0x2bca2c,_0x3cc649){return function(_0x2d746a){if(_0x2d746a){var _0x133603=typeof _0x3cc649[_0x143b('0x1c')]===_0x143b('0x1d')&&typeof _0x3cc649[_0x143b('0x1e')]==='undefined';var _0x520197=_0x2d746a[_0x143b('0x1f')];var _0x244ba8=_0x133603?0x0:_0x3cc649[_0x143b('0x1c')];var _0x139aa9=_0x133603?_0x2d746a[_0x143b('0x1f')]:_0x3cc649[_0x143b('0x1c')]+_0x3cc649[_0x143b('0x1e')];var _0x1ca6d2;if(_0x139aa9>=_0x520197){_0x139aa9=_0x520197;_0x1ca6d2=0xc8;}else{_0x1ca6d2=0xce;}_0x2bca2c[_0x143b('0x19')](_0x1ca6d2);return _0x2bca2c[_0x143b('0x20')](_0x143b('0x21'),_0x244ba8+'-'+_0x139aa9+'/'+_0x520197)['json'](_0x2d746a);}return null;};}function patchUpdates(_0x1dd05b){return function(_0x35df37){try{jsonpatch[_0x143b('0x22')](_0x35df37,_0x1dd05b,!![]);}catch(_0xfd9194){return BPromise[_0x143b('0x23')](_0xfd9194);}return _0x35df37[_0x143b('0x24')]();};}function saveUpdates(_0x159ef6,_0x1d5b5b){return function(_0x5d0684){if(_0x5d0684){return _0x5d0684[_0x143b('0x25')](_0x159ef6)['then'](function(_0x2a55fe){return _0x2a55fe;});}return null;};}function removeEntity(_0x5bdebc,_0x549638){return function(_0x56717f){if(_0x56717f){return _0x56717f[_0x143b('0x26')]()['then'](function(){_0x5bdebc['status'](0xcc)[_0x143b('0x1a')]();});}};}function handleEntityNotFound(_0x53c102,_0x35e097){return function(_0x54eca6){if(!_0x54eca6){_0x53c102[_0x143b('0x18')](0x194);}return _0x54eca6;};}function handleError(_0xd30b1,_0x1adf50){_0x1adf50=_0x1adf50||0x1f4;return function(_0x4f5a17){logger['error'](_0x4f5a17['stack']);if(_0x4f5a17['name']){delete _0x4f5a17[_0x143b('0x27')];}_0xd30b1['status'](_0x1adf50)['send'](_0x4f5a17);};}exports[_0x143b('0x28')]=function(_0x37611b,_0x6174a3){var _0x5535b5={'raw':!![],'where':{'id':_0x37611b[_0x143b('0x29')]['id']}},_0xd1aa12={};_0xd1aa12[_0x143b('0x2a')]=_[_0x143b('0x2b')](db[_0x143b('0x2c')]['rawAttributes']);_0xd1aa12['query']=_['keys'](_0x37611b['query']);_0xd1aa12[_0x143b('0x2d')]=_[_0x143b('0x2e')](_0xd1aa12[_0x143b('0x2a')],_0xd1aa12[_0x143b('0x2f')]);_0x5535b5[_0x143b('0x30')]=_[_0x143b('0x2e')](_0xd1aa12[_0x143b('0x2a')],qs[_0x143b('0x31')](_0x37611b[_0x143b('0x2f')][_0x143b('0x31')]));_0x5535b5['attributes']=_0x5535b5[_0x143b('0x30')][_0x143b('0x32')]?_0x5535b5['attributes']:_0xd1aa12['model'];if(_0x37611b[_0x143b('0x2f')][_0x143b('0x33')]){_0x5535b5[_0x143b('0x34')]=[{'all':!![]}];}_0x5535b5=_[_0x143b('0x35')]({},_0x5535b5,_0x37611b['options']);return db['ChatApplication']['find'](_0x5535b5)['then'](handleEntityNotFound(_0x6174a3,null))[_0x143b('0x36')](respondWithResult(_0x6174a3,null))[_0x143b('0x37')](handleError(_0x6174a3,null));};exports[_0x143b('0x25')]=function(_0x54dcb9,_0x1f2eff){if(_0x54dcb9[_0x143b('0x38')]['id']){delete _0x54dcb9[_0x143b('0x38')]['id'];}return db['ChatApplication'][_0x143b('0x39')]({'where':{'id':_0x54dcb9[_0x143b('0x29')]['id']}})[_0x143b('0x36')](handleEntityNotFound(_0x1f2eff,null))['then'](saveUpdates(_0x54dcb9[_0x143b('0x38')],null))[_0x143b('0x36')](respondWithResult(_0x1f2eff,null))['catch'](handleError(_0x1f2eff,null));};exports['destroy']=function(_0x5a8bd8,_0x1388fc){return db[_0x143b('0x2c')]['find']({'where':{'id':_0x5a8bd8[_0x143b('0x29')]['id']}})[_0x143b('0x36')](handleEntityNotFound(_0x1388fc,null))[_0x143b('0x36')](removeEntity(_0x1388fc,null))[_0x143b('0x37')](handleError(_0x1388fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 844b944..7798dcd 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 _0x2ba4=['api','moment','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x18edae,_0x3496ef){var _0x562e93=function(_0x325375){while(--_0x325375){_0x18edae['push'](_0x18edae['shift']());}};_0x562e93(++_0x3496ef);}(_0x2ba4,0x184));var _0x42ba=function(_0x49870c,_0xf03aee){_0x49870c=_0x49870c-0x0;var _0x57434a=_0x2ba4[_0x49870c];return _0x57434a;};'use strict';var _=require(_0x42ba('0x0'));var util=require(_0x42ba('0x1'));var logger=require('../../config/logger')(_0x42ba('0x2'));var moment=require(_0x42ba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x42ba('0x4'));var rimraf=require(_0x42ba('0x5'));var config=require(_0x42ba('0x6'));var attributes=require(_0x42ba('0x7'));module['exports']=function(_0x4a2987,_0x34b638){return _0x4a2987[_0x42ba('0x8')](_0x42ba('0x9'),attributes,{'tableName':_0x42ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42ba('0xb'),'collate':_0x42ba('0xc')});}; \ No newline at end of file +var _0x865d=['path','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d7b53,_0xbb3fb){var _0x1e83c6=function(_0x14414e){while(--_0x14414e){_0x5d7b53['push'](_0x5d7b53['shift']());}};_0x1e83c6(++_0xbb3fb);}(_0x865d,0x1d9));var _0xd865=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x865d[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xd865('0x0'));var util=require(_0xd865('0x1'));var logger=require(_0xd865('0x2'))(_0xd865('0x3'));var moment=require(_0xd865('0x4'));var BPromise=require(_0xd865('0x5'));var rp=require(_0xd865('0x6'));var fs=require('fs');var path=require(_0xd865('0x7'));var rimraf=require('rimraf');var config=require(_0xd865('0x8'));var attributes=require(_0xd865('0x9'));module[_0xd865('0xa')]=function(_0x5f166b,_0x490365){return _0x5f166b['define'](_0xd865('0xb'),attributes,{'tableName':_0xd865('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd865('0xd'),'collate':_0xd865('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 8235dae..9a63e0c 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 _0x30f4=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x12a58e,_0x443e99){var _0x3a81b7=function(_0x4b444f){while(--_0x4b444f){_0x12a58e['push'](_0x12a58e['shift']());}};_0x3a81b7(++_0x443e99);}(_0x30f4,0x1bf));var _0x430f=function(_0x5806cd,_0x1c26f4){_0x5806cd=_0x5806cd-0x0;var _0x47495e=_0x30f4[_0x5806cd];return _0x47495e;};'use strict';var _=require(_0x430f('0x0'));var util=require(_0x430f('0x1'));var moment=require('moment');var BPromise=require(_0x430f('0x2'));var rs=require(_0x430f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x430f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x430f('0x5'))(_0x430f('0x6'));var config=require(_0x430f('0x7'));var jayson=require(_0x430f('0x8'));var client=jayson[_0x430f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc955,_0x73877e,_0x7ac4c7){return new BPromise(function(_0x3ffe2c,_0x4d0ebf){return client[_0x430f('0xa')](_0x3cc955,_0x7ac4c7)[_0x430f('0xb')](function(_0x75345){logger[_0x430f('0xc')](_0x430f('0xd'),_0x73877e,_0x430f('0xe'));logger['debug'](_0x430f('0xf'),_0x73877e,_0x430f('0xe'),JSON[_0x430f('0x10')](_0x75345));if(_0x75345[_0x430f('0x11')]){if(_0x75345[_0x430f('0x11')][_0x430f('0x12')]===0x1f4){logger[_0x430f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x73877e,_0x75345['error']['message']);return _0x4d0ebf(_0x75345[_0x430f('0x11')]['message']);}logger[_0x430f('0x11')](_0x430f('0xd'),_0x73877e,_0x75345[_0x430f('0x11')][_0x430f('0x13')]);return _0x3ffe2c(_0x75345[_0x430f('0x11')][_0x430f('0x13')]);}else{logger['info'](_0x430f('0xd'),_0x73877e,_0x430f('0xe'));_0x3ffe2c(_0x75345[_0x430f('0x14')][_0x430f('0x13')]);}})['catch'](function(_0x50039b){logger[_0x430f('0x11')](_0x430f('0xd'),_0x73877e,_0x50039b);_0x4d0ebf(_0x50039b);});});} \ No newline at end of file +var _0x4047=['ioredis','../../mysqldb','../../config/logger','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x362f07,_0x552ff3){var _0x3f9011=function(_0xc8efdc){while(--_0xc8efdc){_0x362f07['push'](_0x362f07['shift']());}};_0x3f9011(++_0x552ff3);}(_0x4047,0x150));var _0x7404=function(_0x57e431,_0x46d496){_0x57e431=_0x57e431-0x0;var _0x3afebd=_0x4047[_0x57e431];return _0x3afebd;};'use strict';var _=require('lodash');var util=require(_0x7404('0x0'));var moment=require(_0x7404('0x1'));var BPromise=require(_0x7404('0x2'));var rs=require(_0x7404('0x3'));var fs=require('fs');var Redis=require(_0x7404('0x4'));var db=require(_0x7404('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7404('0x6'))('rpc');var config=require(_0x7404('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7404('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ad6b7,_0x50c246,_0x588eb3){return new BPromise(function(_0x1fb993,_0x304b8e){return client['request'](_0x2ad6b7,_0x588eb3)[_0x7404('0x9')](function(_0xe3ab77){logger[_0x7404('0xa')](_0x7404('0xb'),_0x50c246,_0x7404('0xc'));logger[_0x7404('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x50c246,_0x7404('0xc'),JSON[_0x7404('0xe')](_0xe3ab77));if(_0xe3ab77[_0x7404('0xf')]){if(_0xe3ab77[_0x7404('0xf')][_0x7404('0x10')]===0x1f4){logger[_0x7404('0xf')](_0x7404('0xb'),_0x50c246,_0xe3ab77[_0x7404('0xf')][_0x7404('0x11')]);return _0x304b8e(_0xe3ab77[_0x7404('0xf')][_0x7404('0x11')]);}logger[_0x7404('0xf')](_0x7404('0xb'),_0x50c246,_0xe3ab77[_0x7404('0xf')]['message']);return _0x1fb993(_0xe3ab77[_0x7404('0xf')][_0x7404('0x11')]);}else{logger[_0x7404('0xa')]('ChatApplication,\x20%s,\x20%s',_0x50c246,'request\x20sent');_0x1fb993(_0xe3ab77[_0x7404('0x12')]['message']);}})[_0x7404('0x13')](function(_0x10dc61){logger[_0x7404('0xf')](_0x7404('0xb'),_0x50c246,_0x10dc61);_0x304b8e(_0x10dc61);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a0009f7..e0ae00e 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 _0x5318=['get','/:id','isAuthenticated','show','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0x5318,0xf1));var _0x8531=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x5318[_0x2bf888];return _0x3038d6;};'use strict';var multer=require(_0x8531('0x0'));var util=require(_0x8531('0x1'));var path=require(_0x8531('0x2'));var timeout=require(_0x8531('0x3'));var express=require(_0x8531('0x4'));var router=express[_0x8531('0x5')]();var fs_extra=require(_0x8531('0x6'));var auth=require(_0x8531('0x7'));var interaction=require(_0x8531('0x8'));var config=require(_0x8531('0x9'));var controller=require(_0x8531('0xa'));router[_0x8531('0xb')](_0x8531('0xc'),auth[_0x8531('0xd')](),controller[_0x8531('0xe')]);router[_0x8531('0xf')](_0x8531('0xc'),auth['isAuthenticated'](),controller[_0x8531('0x10')]);router[_0x8531('0x11')](_0x8531('0xc'),auth[_0x8531('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdcd3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','destroy','exports'];(function(_0x5a93f0,_0x172b1b){var _0x53844d=function(_0x19ba69){while(--_0x19ba69){_0x5a93f0['push'](_0x5a93f0['shift']());}};_0x53844d(++_0x172b1b);}(_0xdcd3,0xc3));var _0x3dcd=function(_0x2bbd63,_0x1704ab){_0x2bbd63=_0x2bbd63-0x0;var _0x52e0b3=_0xdcd3[_0x2bbd63];return _0x52e0b3;};'use strict';var multer=require(_0x3dcd('0x0'));var util=require('util');var path=require(_0x3dcd('0x1'));var timeout=require(_0x3dcd('0x2'));var express=require(_0x3dcd('0x3'));var router=express[_0x3dcd('0x4')]();var fs_extra=require(_0x3dcd('0x5'));var auth=require(_0x3dcd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3dcd('0x7'));var controller=require('./chatApplication.controller');router[_0x3dcd('0x8')](_0x3dcd('0x9'),auth[_0x3dcd('0xa')](),controller['show']);router['put'](_0x3dcd('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3dcd('0x9'),auth[_0x3dcd('0xa')](),controller[_0x3dcd('0xb')]);module[_0x3dcd('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0e99b1e..3e9588f 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 _0xdf76=['BOOLEAN','sequelize','exports','STRING'];(function(_0x29ceb8,_0x4521b3){var _0x3608c8=function(_0x45595a){while(--_0x45595a){_0x29ceb8['push'](_0x29ceb8['shift']());}};_0x3608c8(++_0x4521b3);}(_0xdf76,0x1d5));var _0x6df7=function(_0x1d0fa7,_0x1ad70f){_0x1d0fa7=_0x1d0fa7-0x0;var _0x5b2d91=_0xdf76[_0x1d0fa7];return _0x5b2d91;};'use strict';var Sequelize=require(_0x6df7('0x0'));module[_0x6df7('0x1')]={'name':{'type':Sequelize[_0x6df7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6df7('0x2')]},'write':{'type':Sequelize[_0x6df7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x48f5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x45d75e,_0x540d4c){var _0x1a0abf=function(_0x5c6278){while(--_0x5c6278){_0x45d75e['push'](_0x45d75e['shift']());}};_0x1a0abf(++_0x540d4c);}(_0x48f5,0x68));var _0x548f=function(_0x5ec0ad,_0x488c67){_0x5ec0ad=_0x5ec0ad-0x0;var _0x31f2a7=_0x48f5[_0x5ec0ad];return _0x31f2a7;};'use strict';var Sequelize=require(_0x548f('0x0'));module[_0x548f('0x1')]={'name':{'type':Sequelize[_0x548f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x548f('0x2')]},'write':{'type':Sequelize[_0x548f('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 8f5cb1a..f1bf869 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 _0xe0f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','catch','params','fields','find','create','body','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','intersection','getMembers','removeMembers','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xe0f4,0x1bf));var _0x4e0f=function(_0x33fa47,_0xfa22bc){_0x33fa47=_0x33fa47-0x0;var _0x4d34be=_0xe0f4[_0x33fa47];return _0x4d34be;};'use strict';var emlformat=require(_0x4e0f('0x0'));var rimraf=require(_0x4e0f('0x1'));var zipdir=require(_0x4e0f('0x2'));var jsonpatch=require(_0x4e0f('0x3'));var rp=require(_0x4e0f('0x4'));var moment=require(_0x4e0f('0x5'));var BPromise=require(_0x4e0f('0x6'));var Mustache=require(_0x4e0f('0x7'));var util=require(_0x4e0f('0x8'));var path=require(_0x4e0f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e0f('0xa'));var fs=require('fs');var fs_extra=require(_0x4e0f('0xb'));var _=require('lodash');var squel=require(_0x4e0f('0xc'));var crypto=require('crypto');var jsforce=require(_0x4e0f('0xd'));var deskjs=require(_0x4e0f('0xe'));var toCsv=require(_0x4e0f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e0f('0x10'));var authService=require(_0x4e0f('0x11'));var qs=require(_0x4e0f('0x12'));var as=require(_0x4e0f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e0f('0x14'))(_0x4e0f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e0f('0x16'))['db'];config[_0x4e0f('0x17')]=_[_0x4e0f('0x18')](config['redis'],{'host':_0x4e0f('0x19'),'port':0x18eb});var socket=require(_0x4e0f('0x1a'))(new Redis(config[_0x4e0f('0x17')]));require(_0x4e0f('0x1b'))[_0x4e0f('0x1c')](socket);function respondWithStatusCode(_0xe2f4d5,_0x1561bb){_0x1561bb=_0x1561bb||0xcc;return function(_0x2dfaec){if(_0x2dfaec){return _0xe2f4d5['sendStatus'](_0x1561bb);}return _0xe2f4d5[_0x4e0f('0x1d')](_0x1561bb)[_0x4e0f('0x1e')]();};}function respondWithResult(_0x379133,_0x35cd01){_0x35cd01=_0x35cd01||0xc8;return function(_0x488ea2){if(_0x488ea2){return _0x379133[_0x4e0f('0x1d')](_0x35cd01)[_0x4e0f('0x1f')](_0x488ea2);}};}function respondWithFilteredResult(_0xf3668d,_0x11a999){return function(_0x5017b6){if(_0x5017b6){var _0x1a6498=typeof _0x11a999[_0x4e0f('0x20')]===_0x4e0f('0x21')&&typeof _0x11a999['limit']===_0x4e0f('0x21');var _0x25aaa6=_0x5017b6[_0x4e0f('0x22')];var _0x145959=_0x1a6498?0x0:_0x11a999[_0x4e0f('0x20')];var _0x24167a=_0x1a6498?_0x5017b6[_0x4e0f('0x22')]:_0x11a999[_0x4e0f('0x20')]+_0x11a999[_0x4e0f('0x23')];var _0x1a32cd;if(_0x24167a>=_0x25aaa6){_0x24167a=_0x25aaa6;_0x1a32cd=0xc8;}else{_0x1a32cd=0xce;}_0xf3668d[_0x4e0f('0x1d')](_0x1a32cd);return _0xf3668d[_0x4e0f('0x24')](_0x4e0f('0x25'),_0x145959+'-'+_0x24167a+'/'+_0x25aaa6)['json'](_0x5017b6);}return null;};}function patchUpdates(_0x179116){return function(_0x590990){try{jsonpatch['apply'](_0x590990,_0x179116,!![]);}catch(_0x6b5d5b){return BPromise[_0x4e0f('0x26')](_0x6b5d5b);}return _0x590990[_0x4e0f('0x27')]();};}function saveUpdates(_0x1a232b,_0x354508){return function(_0x554f64){if(_0x554f64){return _0x554f64[_0x4e0f('0x28')](_0x1a232b)[_0x4e0f('0x29')](function(_0x45a05a){return _0x45a05a;});}return null;};}function removeEntity(_0x2eb20d,_0x47dc4c){return function(_0x596248){if(_0x596248){return _0x596248['destroy']()[_0x4e0f('0x29')](function(){_0x2eb20d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c8381,_0x23c174){return function(_0x46acf1){if(!_0x46acf1){_0x8c8381[_0x4e0f('0x2a')](0x194);}return _0x46acf1;};}function handleError(_0x3fca87,_0x53a5f4){_0x53a5f4=_0x53a5f4||0x1f4;return function(_0x118644){logger[_0x4e0f('0x2b')](_0x118644[_0x4e0f('0x2c')]);if(_0x118644['name']){delete _0x118644[_0x4e0f('0x2d')];}_0x3fca87[_0x4e0f('0x1d')](_0x53a5f4)[_0x4e0f('0x2e')](_0x118644);};}exports[_0x4e0f('0x2f')]=function(_0x6e0318,_0x173a33){var _0x50d64b={},_0x3269c3={},_0x9154c1={'count':0x0,'rows':[]};var _0x5708db=_[_0x4e0f('0x30')](db[_0x4e0f('0x31')][_0x4e0f('0x32')],function(_0x50344d){return{'name':_0x50344d['fieldName'],'type':_0x50344d[_0x4e0f('0x33')]['key']};});_0x3269c3['model']=_[_0x4e0f('0x30')](_0x5708db,_0x4e0f('0x2d'));_0x3269c3[_0x4e0f('0x34')]=_[_0x4e0f('0x35')](_0x6e0318['query']);_0x3269c3[_0x4e0f('0x36')]=_['intersection'](_0x3269c3[_0x4e0f('0x37')],_0x3269c3[_0x4e0f('0x34')]);_0x50d64b[_0x4e0f('0x38')]=_['intersection'](_0x3269c3[_0x4e0f('0x37')],qs['fields'](_0x6e0318[_0x4e0f('0x34')]['fields']));_0x50d64b[_0x4e0f('0x38')]=_0x50d64b['attributes'][_0x4e0f('0x39')]?_0x50d64b[_0x4e0f('0x38')]:_0x3269c3[_0x4e0f('0x37')];if(!_0x6e0318[_0x4e0f('0x34')][_0x4e0f('0x3a')](_0x4e0f('0x3b'))){_0x50d64b[_0x4e0f('0x23')]=qs[_0x4e0f('0x23')](_0x6e0318[_0x4e0f('0x34')]['limit']);_0x50d64b[_0x4e0f('0x20')]=qs[_0x4e0f('0x20')](_0x6e0318['query'][_0x4e0f('0x20')]);}_0x50d64b[_0x4e0f('0x3c')]=qs[_0x4e0f('0x3d')](_0x6e0318[_0x4e0f('0x34')]['sort']);_0x50d64b['where']=qs[_0x4e0f('0x36')](_[_0x4e0f('0x3e')](_0x6e0318[_0x4e0f('0x34')],_0x3269c3['filters']),_0x5708db);if(_0x6e0318[_0x4e0f('0x34')][_0x4e0f('0x3f')]){_0x50d64b[_0x4e0f('0x40')]=_[_0x4e0f('0x41')](_0x50d64b['where'],{'$or':_['map'](_0x5708db,function(_0xda2d15){if(_0xda2d15['type']!=='VIRTUAL'){var _0x12a2fe={};_0x12a2fe[_0xda2d15['name']]={'$like':'%'+_0x6e0318[_0x4e0f('0x34')]['filter']+'%'};return _0x12a2fe;}})});}_0x50d64b=_[_0x4e0f('0x41')]({},_0x50d64b,_0x6e0318[_0x4e0f('0x42')]);var _0x519f4d={'where':_0x50d64b[_0x4e0f('0x40')]};return db[_0x4e0f('0x31')][_0x4e0f('0x22')](_0x519f4d)['then'](function(_0x5f27f2){_0x9154c1[_0x4e0f('0x22')]=_0x5f27f2;if(_0x6e0318[_0x4e0f('0x34')][_0x4e0f('0x43')]){_0x50d64b[_0x4e0f('0x44')]=[{'all':!![]}];}return db[_0x4e0f('0x31')]['findAll'](_0x50d64b);})[_0x4e0f('0x29')](function(_0x790f37){_0x9154c1['rows']=_0x790f37;return _0x9154c1;})[_0x4e0f('0x29')](respondWithFilteredResult(_0x173a33,_0x50d64b))[_0x4e0f('0x45')](handleError(_0x173a33,null));};exports['show']=function(_0x9ab0a8,_0x4f16ea){var _0xacf216={'raw':!![],'where':{'id':_0x9ab0a8[_0x4e0f('0x46')]['id']}},_0x11d641={};_0x11d641[_0x4e0f('0x37')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x11d641[_0x4e0f('0x34')]=_[_0x4e0f('0x35')](_0x9ab0a8[_0x4e0f('0x34')]);_0x11d641[_0x4e0f('0x36')]=_['intersection'](_0x11d641[_0x4e0f('0x37')],_0x11d641[_0x4e0f('0x34')]);_0xacf216[_0x4e0f('0x38')]=_['intersection'](_0x11d641[_0x4e0f('0x37')],qs[_0x4e0f('0x47')](_0x9ab0a8['query'][_0x4e0f('0x47')]));_0xacf216[_0x4e0f('0x38')]=_0xacf216[_0x4e0f('0x38')][_0x4e0f('0x39')]?_0xacf216[_0x4e0f('0x38')]:_0x11d641[_0x4e0f('0x37')];if(_0x9ab0a8['query']['includeAll']){_0xacf216[_0x4e0f('0x44')]=[{'all':!![]}];}_0xacf216=_[_0x4e0f('0x41')]({},_0xacf216,_0x9ab0a8[_0x4e0f('0x42')]);return db['ChatGroup'][_0x4e0f('0x48')](_0xacf216)[_0x4e0f('0x29')](handleEntityNotFound(_0x4f16ea,null))[_0x4e0f('0x29')](respondWithResult(_0x4f16ea,null))[_0x4e0f('0x45')](handleError(_0x4f16ea,null));};exports[_0x4e0f('0x49')]=function(_0x2fa9f5,_0x1afbeb){return db[_0x4e0f('0x31')][_0x4e0f('0x49')](_0x2fa9f5[_0x4e0f('0x4a')],{})['then'](respondWithResult(_0x1afbeb,0xc9))['catch'](handleError(_0x1afbeb,null));};exports[_0x4e0f('0x28')]=function(_0x16e640,_0x191720){if(_0x16e640['body']['id']){delete _0x16e640['body']['id'];}return db[_0x4e0f('0x31')]['find']({'where':{'id':_0x16e640[_0x4e0f('0x46')]['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x191720,null))[_0x4e0f('0x29')](saveUpdates(_0x16e640[_0x4e0f('0x4a')],null))[_0x4e0f('0x29')](respondWithResult(_0x191720,null))['catch'](handleError(_0x191720,null));};exports[_0x4e0f('0x4b')]=function(_0x4977eb,_0x3c0def){return db[_0x4e0f('0x31')][_0x4e0f('0x48')]({'where':{'id':_0x4977eb[_0x4e0f('0x46')]['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x3c0def,null))['then'](removeEntity(_0x3c0def,null))[_0x4e0f('0x45')](handleError(_0x3c0def,null));};exports[_0x4e0f('0x4c')]=function(_0x1ed3f5,_0x2307b0){return db[_0x4e0f('0x31')]['describe']()[_0x4e0f('0x29')](respondWithResult(_0x2307b0,null))[_0x4e0f('0x45')](handleError(_0x2307b0,null));};exports[_0x4e0f('0x4d')]=function(_0x3e07be,_0x43e52d,_0x54897c){return db[_0x4e0f('0x4e')]['count']({'where':{'ChatGroupId':_0x3e07be[_0x4e0f('0x46')]['id'],'ToId':_0x3e07be['user']['id'],'read':![]}})[_0x4e0f('0x29')](function(_0x30ac26){return{'id':_[_0x4e0f('0x4f')](_0x3e07be[_0x4e0f('0x46')]['id']),'count':_0x30ac26};})['then'](respondWithResult(_0x43e52d,null))[_0x4e0f('0x45')](handleError(_0x43e52d,null));};exports[_0x4e0f('0x50')]=function(_0x113dd2,_0x41ec49,_0x233555){return db[_0x4e0f('0x31')][_0x4e0f('0x48')]({'where':{'id':_0x113dd2['params']['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x41ec49,null))[_0x4e0f('0x29')](function(_0x124e94){if(_0x124e94){return _0x124e94[_0x4e0f('0x50')](_0x113dd2[_0x4e0f('0x4a')][_0x4e0f('0x51')],_[_0x4e0f('0x52')](_0x113dd2[_0x4e0f('0x4a')],[_0x4e0f('0x51'),'id'])||{});}})[_0x4e0f('0x29')](respondWithResult(_0x41ec49,null))['catch'](handleError(_0x41ec49,null));};exports['getMembers']=function(_0x479cb6,_0x43d455,_0x156df3){var _0x270721={};var _0x3054d3={};var _0x2b6a1f;var _0x14e49d;return db[_0x4e0f('0x31')][_0x4e0f('0x53')]({'where':{'id':_0x479cb6['params']['id']}})['then'](handleEntityNotFound(_0x43d455,null))[_0x4e0f('0x29')](function(_0x4d4af3){if(_0x4d4af3){_0x2b6a1f=_0x4d4af3;_0x3054d3['model']=_[_0x4e0f('0x35')](db['User'][_0x4e0f('0x32')]);_0x3054d3[_0x4e0f('0x34')]=_[_0x4e0f('0x35')](_0x479cb6['query']);_0x3054d3[_0x4e0f('0x36')]=_['intersection'](_0x3054d3['model'],_0x3054d3['query']);_0x270721['attributes']=_[_0x4e0f('0x54')](_0x3054d3['model'],qs[_0x4e0f('0x47')](_0x479cb6[_0x4e0f('0x34')][_0x4e0f('0x47')]));_0x270721['attributes']=_0x270721[_0x4e0f('0x38')][_0x4e0f('0x39')]?_0x270721[_0x4e0f('0x38')]:_0x3054d3[_0x4e0f('0x37')];_0x270721['order']=qs[_0x4e0f('0x3d')](_0x479cb6[_0x4e0f('0x34')][_0x4e0f('0x3d')]);_0x270721['where']=qs[_0x4e0f('0x36')](_[_0x4e0f('0x3e')](_0x479cb6['query'],_0x3054d3[_0x4e0f('0x36')]));if(_0x479cb6['query'][_0x4e0f('0x3f')]){_0x270721['where']=_[_0x4e0f('0x41')](_0x270721[_0x4e0f('0x40')],{'$or':_[_0x4e0f('0x30')](_0x270721['attributes'],function(_0x323221){var _0xcd244c={};_0xcd244c[_0x323221]={'$like':'%'+_0x479cb6['query'][_0x4e0f('0x3f')]+'%'};return _0xcd244c;})});}_0x270721=_[_0x4e0f('0x41')]({},_0x270721,_0x479cb6['options']);return _0x2b6a1f[_0x4e0f('0x55')](_0x270721);}})[_0x4e0f('0x29')](function(_0x552c6e){if(_0x552c6e){_0x14e49d=_0x552c6e[_0x4e0f('0x39')];if(!_0x479cb6['query']['hasOwnProperty']('nolimit')){_0x270721[_0x4e0f('0x23')]=qs[_0x4e0f('0x23')](_0x479cb6['query'][_0x4e0f('0x23')]);_0x270721[_0x4e0f('0x20')]=qs['offset'](_0x479cb6[_0x4e0f('0x34')][_0x4e0f('0x20')]);}return _0x2b6a1f[_0x4e0f('0x55')](_0x270721);}})[_0x4e0f('0x29')](function(_0x57d4c5){if(_0x57d4c5){return _0x57d4c5?{'count':_0x14e49d,'rows':_0x57d4c5}:null;}})[_0x4e0f('0x29')](respondWithResult(_0x43d455,null))[_0x4e0f('0x45')](handleError(_0x43d455,null));};exports[_0x4e0f('0x56')]=function(_0x4d0d4f,_0x1aec91,_0x3667f0){return db[_0x4e0f('0x31')]['find']({'where':{'id':_0x4d0d4f['params']['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x1aec91,null))[_0x4e0f('0x29')](function(_0x2269e7){if(_0x2269e7){return _0x2269e7[_0x4e0f('0x56')](_0x4d0d4f[_0x4e0f('0x34')]['ids']);}})[_0x4e0f('0x29')](respondWithStatusCode(_0x1aec91,null))[_0x4e0f('0x45')](handleError(_0x1aec91,null));};exports['addMessage']=function(_0x49dd7b,_0x3be7af,_0x2080ba){if(_0x49dd7b[_0x4e0f('0x4a')]['id']){delete _0x49dd7b['body']['id'];}return db[_0x4e0f('0x31')][_0x4e0f('0x48')]({'where':{'id':_0x49dd7b[_0x4e0f('0x46')]['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x3be7af,null))[_0x4e0f('0x29')](function(_0x3f56b4){if(_0x3f56b4){_0x49dd7b['body'][_0x4e0f('0x57')]=_0x3f56b4['id'];return db[_0x4e0f('0x4e')][_0x4e0f('0x49')](_0x49dd7b['body']);}})['then'](respondWithResult(_0x3be7af,null))[_0x4e0f('0x45')](handleError(_0x3be7af,null));};exports['getMessages']=function(_0xd25838,_0x4b0555,_0x3116f){var _0x57ef15={};var _0x51b391={};var _0x7715fb;var _0x5a431b;return db[_0x4e0f('0x31')][_0x4e0f('0x53')]({'where':{'id':_0xd25838[_0x4e0f('0x46')]['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x4b0555,null))['then'](function(_0x8de1a3){if(_0x8de1a3){_0x7715fb=_0x8de1a3;_0x51b391['model']=_['keys'](db[_0x4e0f('0x4e')][_0x4e0f('0x32')]);_0x51b391[_0x4e0f('0x34')]=_[_0x4e0f('0x35')](_0xd25838[_0x4e0f('0x34')]);_0x51b391[_0x4e0f('0x36')]=_[_0x4e0f('0x54')](_0x51b391[_0x4e0f('0x37')],_0x51b391[_0x4e0f('0x34')]);_0x57ef15[_0x4e0f('0x38')]=_[_0x4e0f('0x54')](_0x51b391[_0x4e0f('0x37')],qs[_0x4e0f('0x47')](_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x47')]));_0x57ef15[_0x4e0f('0x38')]=_0x57ef15[_0x4e0f('0x38')][_0x4e0f('0x39')]?_0x57ef15['attributes']:_0x51b391[_0x4e0f('0x37')];_0x57ef15[_0x4e0f('0x3c')]=qs['sort'](_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x3d')]);_0x57ef15[_0x4e0f('0x40')]=qs[_0x4e0f('0x36')](_[_0x4e0f('0x3e')](_0xd25838[_0x4e0f('0x34')],_0x51b391['filters']));if(_0xd25838['query'][_0x4e0f('0x3f')]){_0x57ef15[_0x4e0f('0x40')]=_['merge'](_0x57ef15[_0x4e0f('0x40')],{'$or':_[_0x4e0f('0x30')](_0x57ef15[_0x4e0f('0x38')],function(_0x56945f){var _0x54fe78={};_0x54fe78[_0x56945f]={'$like':'%'+_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x3f')]+'%'};return _0x54fe78;})});}if(_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x58')]){var _0x51ca6a=_0xd25838['query'][_0x4e0f('0x58')][_0x4e0f('0x59')](',');var _0x593f37={};_0x593f37[_0x51ca6a[0x0]]={'$gte':moment(_0x51ca6a[0x1])[_0x4e0f('0x5a')](_0x4e0f('0x5b'))};_0x57ef15['where']=_[_0x4e0f('0x41')](_0x57ef15['where'],_0x593f37);}_0x57ef15=_[_0x4e0f('0x41')]({},_0x57ef15,_0xd25838[_0x4e0f('0x42')]);return _0x7715fb[_0x4e0f('0x5c')](_0x57ef15);}})['then'](function(_0x13c4ab){if(_0x13c4ab){_0x5a431b=_0x13c4ab[_0x4e0f('0x39')];if(!_0xd25838[_0x4e0f('0x34')]['hasOwnProperty'](_0x4e0f('0x3b'))){_0x57ef15['limit']=qs[_0x4e0f('0x23')](_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x23')]);_0x57ef15[_0x4e0f('0x20')]=qs[_0x4e0f('0x20')](_0xd25838[_0x4e0f('0x34')][_0x4e0f('0x20')]);}return _0x7715fb[_0x4e0f('0x5c')](_0x57ef15);}})[_0x4e0f('0x29')](function(_0x4e195a){if(_0x4e195a){return _0x4e195a?{'count':_0x5a431b,'rows':_0x4e195a}:null;}})[_0x4e0f('0x29')](respondWithResult(_0x4b0555,null))[_0x4e0f('0x45')](handleError(_0x4b0555,null));}; \ No newline at end of file +var _0x4a59=['stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','include','findAll','rows','show','params','keys','merge','catch','create','body','find','destroy','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','then'];(function(_0x2c27b1,_0xa99345){var _0x449d96=function(_0x1c2246){while(--_0x1c2246){_0x2c27b1['push'](_0x2c27b1['shift']());}};_0x449d96(++_0xa99345);}(_0x4a59,0xf1));var _0x94a5=function(_0x31e9a7,_0x224deb){_0x31e9a7=_0x31e9a7-0x0;var _0x32826d=_0x4a59[_0x31e9a7];return _0x32826d;};'use strict';var emlformat=require(_0x94a5('0x0'));var rimraf=require(_0x94a5('0x1'));var zipdir=require(_0x94a5('0x2'));var jsonpatch=require(_0x94a5('0x3'));var rp=require(_0x94a5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x94a5('0x5'));var util=require(_0x94a5('0x6'));var path=require(_0x94a5('0x7'));var sox=require(_0x94a5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94a5('0x9'));var _=require(_0x94a5('0xa'));var squel=require(_0x94a5('0xb'));var crypto=require(_0x94a5('0xc'));var jsforce=require(_0x94a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x94a5('0xe'));var Papa=require('papaparse');var Redis=require(_0x94a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x94a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94a5('0x11'));var logger=require(_0x94a5('0x12'))(_0x94a5('0x13'));var utils=require('../../config/utils');var config=require(_0x94a5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x94a5('0x15')]=_[_0x94a5('0x16')](config[_0x94a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x94a5('0x17'))(new Redis(config[_0x94a5('0x15')]));require(_0x94a5('0x18'))[_0x94a5('0x19')](socket);function respondWithStatusCode(_0x169ecb,_0x4559a9){_0x4559a9=_0x4559a9||0xcc;return function(_0x148619){if(_0x148619){return _0x169ecb['sendStatus'](_0x4559a9);}return _0x169ecb[_0x94a5('0x1a')](_0x4559a9)[_0x94a5('0x1b')]();};}function respondWithResult(_0x1d174c,_0x34cce1){_0x34cce1=_0x34cce1||0xc8;return function(_0x427c24){if(_0x427c24){return _0x1d174c[_0x94a5('0x1a')](_0x34cce1)[_0x94a5('0x1c')](_0x427c24);}};}function respondWithFilteredResult(_0x545148,_0x19344e){return function(_0xdf8287){if(_0xdf8287){var _0x258aa4=typeof _0x19344e[_0x94a5('0x1d')]===_0x94a5('0x1e')&&typeof _0x19344e['limit']===_0x94a5('0x1e');var _0x30bf5a=_0xdf8287[_0x94a5('0x1f')];var _0x3d2f3f=_0x258aa4?0x0:_0x19344e['offset'];var _0x447b88=_0x258aa4?_0xdf8287[_0x94a5('0x1f')]:_0x19344e['offset']+_0x19344e[_0x94a5('0x20')];var _0x89ccc3;if(_0x447b88>=_0x30bf5a){_0x447b88=_0x30bf5a;_0x89ccc3=0xc8;}else{_0x89ccc3=0xce;}_0x545148[_0x94a5('0x1a')](_0x89ccc3);return _0x545148[_0x94a5('0x21')]('Content-Range',_0x3d2f3f+'-'+_0x447b88+'/'+_0x30bf5a)[_0x94a5('0x1c')](_0xdf8287);}return null;};}function patchUpdates(_0x5ee8dc){return function(_0x54d8ee){try{jsonpatch[_0x94a5('0x22')](_0x54d8ee,_0x5ee8dc,!![]);}catch(_0x4c41a7){return BPromise['reject'](_0x4c41a7);}return _0x54d8ee[_0x94a5('0x23')]();};}function saveUpdates(_0x7ff1a7,_0x29efad){return function(_0x569829){if(_0x569829){return _0x569829[_0x94a5('0x24')](_0x7ff1a7)['then'](function(_0x399e81){return _0x399e81;});}return null;};}function removeEntity(_0x4d9915,_0x18b3de){return function(_0x3336ad){if(_0x3336ad){return _0x3336ad['destroy']()[_0x94a5('0x25')](function(){_0x4d9915[_0x94a5('0x1a')](0xcc)[_0x94a5('0x1b')]();});}};}function handleEntityNotFound(_0x18b002,_0x206da4){return function(_0x42a232){if(!_0x42a232){_0x18b002['sendStatus'](0x194);}return _0x42a232;};}function handleError(_0x518305,_0x39b43a){_0x39b43a=_0x39b43a||0x1f4;return function(_0x483051){logger['error'](_0x483051[_0x94a5('0x26')]);if(_0x483051[_0x94a5('0x27')]){delete _0x483051[_0x94a5('0x27')];}_0x518305[_0x94a5('0x1a')](_0x39b43a)[_0x94a5('0x28')](_0x483051);};}exports[_0x94a5('0x29')]=function(_0x3061f7,_0x519d48){var _0x36944f={},_0x3151ab={},_0x568d49={'count':0x0,'rows':[]};var _0x12251c=_[_0x94a5('0x2a')](db[_0x94a5('0x2b')][_0x94a5('0x2c')],function(_0x1e138e){return{'name':_0x1e138e[_0x94a5('0x2d')],'type':_0x1e138e['type'][_0x94a5('0x2e')]};});_0x3151ab[_0x94a5('0x2f')]=_[_0x94a5('0x2a')](_0x12251c,_0x94a5('0x27'));_0x3151ab['query']=_['keys'](_0x3061f7[_0x94a5('0x30')]);_0x3151ab[_0x94a5('0x31')]=_[_0x94a5('0x32')](_0x3151ab[_0x94a5('0x2f')],_0x3151ab[_0x94a5('0x30')]);_0x36944f['attributes']=_['intersection'](_0x3151ab[_0x94a5('0x2f')],qs['fields'](_0x3061f7[_0x94a5('0x30')][_0x94a5('0x33')]));_0x36944f['attributes']=_0x36944f[_0x94a5('0x34')][_0x94a5('0x35')]?_0x36944f[_0x94a5('0x34')]:_0x3151ab['model'];if(!_0x3061f7[_0x94a5('0x30')][_0x94a5('0x36')](_0x94a5('0x37'))){_0x36944f['limit']=qs['limit'](_0x3061f7[_0x94a5('0x30')][_0x94a5('0x20')]);_0x36944f[_0x94a5('0x1d')]=qs[_0x94a5('0x1d')](_0x3061f7[_0x94a5('0x30')]['offset']);}_0x36944f[_0x94a5('0x38')]=qs[_0x94a5('0x39')](_0x3061f7[_0x94a5('0x30')][_0x94a5('0x39')]);_0x36944f[_0x94a5('0x3a')]=qs[_0x94a5('0x31')](_[_0x94a5('0x3b')](_0x3061f7[_0x94a5('0x30')],_0x3151ab[_0x94a5('0x31')]),_0x12251c);if(_0x3061f7['query'][_0x94a5('0x3c')]){_0x36944f[_0x94a5('0x3a')]=_['merge'](_0x36944f[_0x94a5('0x3a')],{'$or':_[_0x94a5('0x2a')](_0x12251c,function(_0x4be253){if(_0x4be253[_0x94a5('0x3d')]!=='VIRTUAL'){var _0xede558={};_0xede558[_0x4be253[_0x94a5('0x27')]]={'$like':'%'+_0x3061f7[_0x94a5('0x30')][_0x94a5('0x3c')]+'%'};return _0xede558;}})});}_0x36944f=_['merge']({},_0x36944f,_0x3061f7[_0x94a5('0x3e')]);var _0x5edab0={'where':_0x36944f[_0x94a5('0x3a')]};return db[_0x94a5('0x2b')][_0x94a5('0x1f')](_0x5edab0)[_0x94a5('0x25')](function(_0x25b471){_0x568d49[_0x94a5('0x1f')]=_0x25b471;if(_0x3061f7[_0x94a5('0x30')]['includeAll']){_0x36944f[_0x94a5('0x3f')]=[{'all':!![]}];}return db['ChatGroup'][_0x94a5('0x40')](_0x36944f);})[_0x94a5('0x25')](function(_0x37f5db){_0x568d49[_0x94a5('0x41')]=_0x37f5db;return _0x568d49;})[_0x94a5('0x25')](respondWithFilteredResult(_0x519d48,_0x36944f))['catch'](handleError(_0x519d48,null));};exports[_0x94a5('0x42')]=function(_0x285eee,_0xe253b7){var _0x413f1e={'raw':!![],'where':{'id':_0x285eee[_0x94a5('0x43')]['id']}},_0x43d263={};_0x43d263[_0x94a5('0x2f')]=_[_0x94a5('0x44')](db[_0x94a5('0x2b')][_0x94a5('0x2c')]);_0x43d263[_0x94a5('0x30')]=_[_0x94a5('0x44')](_0x285eee[_0x94a5('0x30')]);_0x43d263['filters']=_['intersection'](_0x43d263[_0x94a5('0x2f')],_0x43d263[_0x94a5('0x30')]);_0x413f1e[_0x94a5('0x34')]=_[_0x94a5('0x32')](_0x43d263[_0x94a5('0x2f')],qs[_0x94a5('0x33')](_0x285eee[_0x94a5('0x30')][_0x94a5('0x33')]));_0x413f1e[_0x94a5('0x34')]=_0x413f1e[_0x94a5('0x34')][_0x94a5('0x35')]?_0x413f1e[_0x94a5('0x34')]:_0x43d263[_0x94a5('0x2f')];if(_0x285eee[_0x94a5('0x30')]['includeAll']){_0x413f1e[_0x94a5('0x3f')]=[{'all':!![]}];}_0x413f1e=_[_0x94a5('0x45')]({},_0x413f1e,_0x285eee['options']);return db[_0x94a5('0x2b')]['find'](_0x413f1e)['then'](handleEntityNotFound(_0xe253b7,null))[_0x94a5('0x25')](respondWithResult(_0xe253b7,null))[_0x94a5('0x46')](handleError(_0xe253b7,null));};exports[_0x94a5('0x47')]=function(_0xf147cb,_0x34b2bc){return db[_0x94a5('0x2b')]['create'](_0xf147cb['body'],{})['then'](respondWithResult(_0x34b2bc,0xc9))[_0x94a5('0x46')](handleError(_0x34b2bc,null));};exports[_0x94a5('0x24')]=function(_0x18d874,_0x59a7ee){if(_0x18d874[_0x94a5('0x48')]['id']){delete _0x18d874['body']['id'];}return db[_0x94a5('0x2b')][_0x94a5('0x49')]({'where':{'id':_0x18d874['params']['id']}})[_0x94a5('0x25')](handleEntityNotFound(_0x59a7ee,null))['then'](saveUpdates(_0x18d874[_0x94a5('0x48')],null))[_0x94a5('0x25')](respondWithResult(_0x59a7ee,null))['catch'](handleError(_0x59a7ee,null));};exports[_0x94a5('0x4a')]=function(_0x5e4934,_0x11d203){return db['ChatGroup'][_0x94a5('0x49')]({'where':{'id':_0x5e4934['params']['id']}})[_0x94a5('0x25')](handleEntityNotFound(_0x11d203,null))[_0x94a5('0x25')](removeEntity(_0x11d203,null))['catch'](handleError(_0x11d203,null));};exports[_0x94a5('0x4b')]=function(_0x1f225e,_0xf09866){return db[_0x94a5('0x2b')][_0x94a5('0x4b')]()[_0x94a5('0x25')](respondWithResult(_0xf09866,null))[_0x94a5('0x46')](handleError(_0xf09866,null));};exports[_0x94a5('0x4c')]=function(_0x1c7af2,_0x16bfdc,_0x305c23){return db['ChatInternalMessage'][_0x94a5('0x1f')]({'where':{'ChatGroupId':_0x1c7af2['params']['id'],'ToId':_0x1c7af2['user']['id'],'read':![]}})[_0x94a5('0x25')](function(_0x3fac34){return{'id':_[_0x94a5('0x4d')](_0x1c7af2[_0x94a5('0x43')]['id']),'count':_0x3fac34};})[_0x94a5('0x25')](respondWithResult(_0x16bfdc,null))[_0x94a5('0x46')](handleError(_0x16bfdc,null));};exports[_0x94a5('0x4e')]=function(_0x171ba9,_0xab33e0,_0x37ce0a){return db[_0x94a5('0x2b')][_0x94a5('0x49')]({'where':{'id':_0x171ba9[_0x94a5('0x43')]['id']}})['then'](handleEntityNotFound(_0xab33e0,null))[_0x94a5('0x25')](function(_0x306529){if(_0x306529){return _0x306529['addMembers'](_0x171ba9[_0x94a5('0x48')][_0x94a5('0x4f')],_[_0x94a5('0x50')](_0x171ba9[_0x94a5('0x48')],[_0x94a5('0x4f'),'id'])||{});}})['then'](respondWithResult(_0xab33e0,null))[_0x94a5('0x46')](handleError(_0xab33e0,null));};exports[_0x94a5('0x51')]=function(_0x1894a0,_0x498ac9,_0xfa87fe){var _0x561439={};var _0x34531b={};var _0x594a6e;var _0x58b7d0;return db[_0x94a5('0x2b')][_0x94a5('0x52')]({'where':{'id':_0x1894a0[_0x94a5('0x43')]['id']}})[_0x94a5('0x25')](handleEntityNotFound(_0x498ac9,null))[_0x94a5('0x25')](function(_0x5e942a){if(_0x5e942a){_0x594a6e=_0x5e942a;_0x34531b[_0x94a5('0x2f')]=_['keys'](db[_0x94a5('0x53')]['rawAttributes']);_0x34531b[_0x94a5('0x30')]=_['keys'](_0x1894a0[_0x94a5('0x30')]);_0x34531b[_0x94a5('0x31')]=_[_0x94a5('0x32')](_0x34531b[_0x94a5('0x2f')],_0x34531b[_0x94a5('0x30')]);_0x561439[_0x94a5('0x34')]=_[_0x94a5('0x32')](_0x34531b['model'],qs[_0x94a5('0x33')](_0x1894a0['query'][_0x94a5('0x33')]));_0x561439['attributes']=_0x561439[_0x94a5('0x34')][_0x94a5('0x35')]?_0x561439[_0x94a5('0x34')]:_0x34531b['model'];_0x561439[_0x94a5('0x38')]=qs[_0x94a5('0x39')](_0x1894a0[_0x94a5('0x30')][_0x94a5('0x39')]);_0x561439[_0x94a5('0x3a')]=qs['filters'](_[_0x94a5('0x3b')](_0x1894a0[_0x94a5('0x30')],_0x34531b[_0x94a5('0x31')]));if(_0x1894a0[_0x94a5('0x30')][_0x94a5('0x3c')]){_0x561439[_0x94a5('0x3a')]=_[_0x94a5('0x45')](_0x561439[_0x94a5('0x3a')],{'$or':_[_0x94a5('0x2a')](_0x561439[_0x94a5('0x34')],function(_0x426d4d){var _0x4e297a={};_0x4e297a[_0x426d4d]={'$like':'%'+_0x1894a0['query'][_0x94a5('0x3c')]+'%'};return _0x4e297a;})});}_0x561439=_[_0x94a5('0x45')]({},_0x561439,_0x1894a0[_0x94a5('0x3e')]);return _0x594a6e[_0x94a5('0x51')](_0x561439);}})[_0x94a5('0x25')](function(_0x37a284){if(_0x37a284){_0x58b7d0=_0x37a284[_0x94a5('0x35')];if(!_0x1894a0[_0x94a5('0x30')][_0x94a5('0x36')](_0x94a5('0x37'))){_0x561439[_0x94a5('0x20')]=qs['limit'](_0x1894a0[_0x94a5('0x30')]['limit']);_0x561439[_0x94a5('0x1d')]=qs[_0x94a5('0x1d')](_0x1894a0[_0x94a5('0x30')][_0x94a5('0x1d')]);}return _0x594a6e[_0x94a5('0x51')](_0x561439);}})[_0x94a5('0x25')](function(_0x431e33){if(_0x431e33){return _0x431e33?{'count':_0x58b7d0,'rows':_0x431e33}:null;}})[_0x94a5('0x25')](respondWithResult(_0x498ac9,null))[_0x94a5('0x46')](handleError(_0x498ac9,null));};exports['removeMembers']=function(_0x50c040,_0x348beb,_0x4f4f15){return db[_0x94a5('0x2b')]['find']({'where':{'id':_0x50c040['params']['id']}})[_0x94a5('0x25')](handleEntityNotFound(_0x348beb,null))[_0x94a5('0x25')](function(_0x49b281){if(_0x49b281){return _0x49b281[_0x94a5('0x54')](_0x50c040['query']['ids']);}})[_0x94a5('0x25')](respondWithStatusCode(_0x348beb,null))['catch'](handleError(_0x348beb,null));};exports[_0x94a5('0x55')]=function(_0x518dd2,_0x537d6f,_0x390011){if(_0x518dd2[_0x94a5('0x48')]['id']){delete _0x518dd2[_0x94a5('0x48')]['id'];}return db[_0x94a5('0x2b')][_0x94a5('0x49')]({'where':{'id':_0x518dd2['params']['id']}})['then'](handleEntityNotFound(_0x537d6f,null))['then'](function(_0xb43906){if(_0xb43906){_0x518dd2['body'][_0x94a5('0x56')]=_0xb43906['id'];return db['ChatInternalMessage'][_0x94a5('0x47')](_0x518dd2[_0x94a5('0x48')]);}})['then'](respondWithResult(_0x537d6f,null))[_0x94a5('0x46')](handleError(_0x537d6f,null));};exports[_0x94a5('0x57')]=function(_0x20686f,_0x58c124,_0x16ffd2){var _0x5f4ad6={};var _0x4c1b64={};var _0x5d23e8;var _0x57d719;return db[_0x94a5('0x2b')][_0x94a5('0x52')]({'where':{'id':_0x20686f['params']['id']}})[_0x94a5('0x25')](handleEntityNotFound(_0x58c124,null))[_0x94a5('0x25')](function(_0x3be853){if(_0x3be853){_0x5d23e8=_0x3be853;_0x4c1b64['model']=_[_0x94a5('0x44')](db[_0x94a5('0x58')][_0x94a5('0x2c')]);_0x4c1b64[_0x94a5('0x30')]=_['keys'](_0x20686f[_0x94a5('0x30')]);_0x4c1b64[_0x94a5('0x31')]=_[_0x94a5('0x32')](_0x4c1b64[_0x94a5('0x2f')],_0x4c1b64['query']);_0x5f4ad6[_0x94a5('0x34')]=_[_0x94a5('0x32')](_0x4c1b64[_0x94a5('0x2f')],qs['fields'](_0x20686f[_0x94a5('0x30')][_0x94a5('0x33')]));_0x5f4ad6[_0x94a5('0x34')]=_0x5f4ad6[_0x94a5('0x34')]['length']?_0x5f4ad6['attributes']:_0x4c1b64[_0x94a5('0x2f')];_0x5f4ad6[_0x94a5('0x38')]=qs['sort'](_0x20686f[_0x94a5('0x30')][_0x94a5('0x39')]);_0x5f4ad6['where']=qs[_0x94a5('0x31')](_[_0x94a5('0x3b')](_0x20686f[_0x94a5('0x30')],_0x4c1b64[_0x94a5('0x31')]));if(_0x20686f[_0x94a5('0x30')]['filter']){_0x5f4ad6[_0x94a5('0x3a')]=_[_0x94a5('0x45')](_0x5f4ad6[_0x94a5('0x3a')],{'$or':_[_0x94a5('0x2a')](_0x5f4ad6[_0x94a5('0x34')],function(_0x4bb9d7){var _0xaccade={};_0xaccade[_0x4bb9d7]={'$like':'%'+_0x20686f[_0x94a5('0x30')][_0x94a5('0x3c')]+'%'};return _0xaccade;})});}if(_0x20686f[_0x94a5('0x30')][_0x94a5('0x59')]){var _0x25e6c1=_0x20686f[_0x94a5('0x30')]['$gte'][_0x94a5('0x5a')](',');var _0x3ce6f1={};_0x3ce6f1[_0x25e6c1[0x0]]={'$gte':moment(_0x25e6c1[0x1])[_0x94a5('0x5b')](_0x94a5('0x5c'))};_0x5f4ad6[_0x94a5('0x3a')]=_[_0x94a5('0x45')](_0x5f4ad6['where'],_0x3ce6f1);}_0x5f4ad6=_['merge']({},_0x5f4ad6,_0x20686f[_0x94a5('0x3e')]);return _0x5d23e8[_0x94a5('0x57')](_0x5f4ad6);}})[_0x94a5('0x25')](function(_0x1d879d){if(_0x1d879d){_0x57d719=_0x1d879d[_0x94a5('0x35')];if(!_0x20686f[_0x94a5('0x30')][_0x94a5('0x36')](_0x94a5('0x37'))){_0x5f4ad6[_0x94a5('0x20')]=qs[_0x94a5('0x20')](_0x20686f[_0x94a5('0x30')][_0x94a5('0x20')]);_0x5f4ad6[_0x94a5('0x1d')]=qs[_0x94a5('0x1d')](_0x20686f[_0x94a5('0x30')]['offset']);}return _0x5d23e8[_0x94a5('0x57')](_0x5f4ad6);}})[_0x94a5('0x25')](function(_0x3bf316){if(_0x3bf316){return _0x3bf316?{'count':_0x57d719,'rows':_0x3bf316}:null;}})[_0x94a5('0x25')](respondWithResult(_0x58c124,null))[_0x94a5('0x46')](handleError(_0x58c124,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0b596bd..aa16caa 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 _0x9147=['remove','emit','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x293f81,_0x4c0c78){var _0x26e3a1=function(_0x32c554){while(--_0x32c554){_0x293f81['push'](_0x293f81['shift']());}};_0x26e3a1(++_0x4c0c78);}(_0x9147,0x81));var _0x7914=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x9147[_0xae7c2f];return _0x5d7001;};'use strict';var EventEmitter=require(_0x7914('0x0'));var ChatGroup=require(_0x7914('0x1'))['db'][_0x7914('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7914('0x3')](0x0);var events={'afterCreate':_0x7914('0x4'),'afterUpdate':_0x7914('0x5'),'afterDestroy':_0x7914('0x6')};function emitEvent(_0x53d9c7){return function(_0x21cae6,_0x1de2bc,_0x1f8716){ChatGroupEvents[_0x7914('0x7')](_0x53d9c7+':'+_0x21cae6['id'],_0x21cae6);ChatGroupEvents[_0x7914('0x7')](_0x53d9c7,_0x21cae6);_0x1f8716(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x7914('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x4ef7=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xa05546,_0x436fb5){var _0x38fcb4=function(_0x5716ce){while(--_0x5716ce){_0xa05546['push'](_0xa05546['shift']());}};_0x38fcb4(++_0x436fb5);}(_0x4ef7,0x1c7));var _0x74ef=function(_0x5bfa4f,_0x363913){_0x5bfa4f=_0x5bfa4f-0x0;var _0x2c972b=_0x4ef7[_0x5bfa4f];return _0x2c972b;};'use strict';var EventEmitter=require(_0x74ef('0x0'));var ChatGroup=require(_0x74ef('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x74ef('0x2')](0x0);var events={'afterCreate':_0x74ef('0x3'),'afterUpdate':_0x74ef('0x4'),'afterDestroy':_0x74ef('0x5')};function emitEvent(_0x39cbc9){return function(_0x1f1a20,_0x188650,_0x2b378d){ChatGroupEvents[_0x74ef('0x6')](_0x39cbc9+':'+_0x1f1a20['id'],_0x1f1a20);ChatGroupEvents[_0x74ef('0x6')](_0x39cbc9,_0x1f1a20);_0x2b378d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x74ef('0x7')](e,emitEvent(event));}}module[_0x74ef('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 3cbb750..4e1d322 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 _0x9f4e=['rimraf','../../config/environment','./chatGroup.attributes','define','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x9f4e,0xd6));var _0xe9f4=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x9f4e[_0x3522c8];return _0x22f498;};'use strict';var _=require(_0xe9f4('0x0'));var util=require(_0xe9f4('0x1'));var logger=require(_0xe9f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe9f4('0x3'));var rp=require(_0xe9f4('0x4'));var fs=require('fs');var path=require(_0xe9f4('0x5'));var rimraf=require(_0xe9f4('0x6'));var config=require(_0xe9f4('0x7'));var attributes=require(_0xe9f4('0x8'));module['exports']=function(_0x5a1494,_0x1d9757){return _0x5a1494[_0xe9f4('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5023=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x41190e,_0x589411){var _0x28160f=function(_0x2bc475){while(--_0x2bc475){_0x41190e['push'](_0x41190e['shift']());}};_0x28160f(++_0x589411);}(_0x5023,0xc8));var _0x3502=function(_0x77ec04,_0x251c8b){_0x77ec04=_0x77ec04-0x0;var _0x5bb3f7=_0x5023[_0x77ec04];return _0x5bb3f7;};'use strict';var _=require(_0x3502('0x0'));var util=require(_0x3502('0x1'));var logger=require(_0x3502('0x2'))(_0x3502('0x3'));var moment=require('moment');var BPromise=require(_0x3502('0x4'));var rp=require(_0x3502('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3502('0x6'));var attributes=require(_0x3502('0x7'));module[_0x3502('0x8')]=function(_0x514482,_0x4edbb4){return _0x514482[_0x3502('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1b09553..22ba6d3 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 _0xf360=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring'];(function(_0x372148,_0x433764){var _0x1b507b=function(_0x48a8f1){while(--_0x48a8f1){_0x372148['push'](_0x372148['shift']());}};_0x1b507b(++_0x433764);}(_0xf360,0x9e));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var moment=require(_0x0f36('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require(_0x0f36('0x6'))('rpc');var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson[_0x0f36('0x9')][_0x0f36('0xa')]({'port':0x232a});config[_0x0f36('0xb')]=_[_0x0f36('0xc')](config[_0x0f36('0xb')],{'host':_0x0f36('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f36('0xb')]));require(_0x0f36('0xe'))[_0x0f36('0xf')](socket);function respondWithRpcPromise(_0x4036b5,_0x146814,_0x4015fc){return new BPromise(function(_0x4963fb,_0x35d5ee){return client[_0x0f36('0x10')](_0x4036b5,_0x4015fc)[_0x0f36('0x11')](function(_0x5044af){logger[_0x0f36('0x12')]('ChatGroup,\x20%s,\x20%s',_0x146814,'request\x20sent');logger[_0x0f36('0x13')](_0x0f36('0x14'),_0x146814,'request\x20sent',JSON[_0x0f36('0x15')](_0x5044af));if(_0x5044af[_0x0f36('0x16')]){if(_0x5044af[_0x0f36('0x16')][_0x0f36('0x17')]===0x1f4){logger['error'](_0x0f36('0x18'),_0x146814,_0x5044af['error'][_0x0f36('0x19')]);return _0x35d5ee(_0x5044af[_0x0f36('0x16')][_0x0f36('0x19')]);}logger[_0x0f36('0x16')](_0x0f36('0x18'),_0x146814,_0x5044af[_0x0f36('0x16')][_0x0f36('0x19')]);return _0x4963fb(_0x5044af['error']['message']);}else{logger[_0x0f36('0x12')](_0x0f36('0x18'),_0x146814,'request\x20sent');_0x4963fb(_0x5044af['result'][_0x0f36('0x19')]);}})[_0x0f36('0x1a')](function(_0x523c43){logger[_0x0f36('0x16')](_0x0f36('0x18'),_0x146814,_0x523c43);_0x35d5ee(_0x523c43);});});} \ No newline at end of file +var _0x6921=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','ioredis'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6921,0x1d1));var _0x1692=function(_0x1444cd,_0x42f05e){_0x1444cd=_0x1444cd-0x0;var _0x339466=_0x6921[_0x1444cd];return _0x339466;};'use strict';var _=require('lodash');var util=require(_0x1692('0x0'));var moment=require('moment');var BPromise=require(_0x1692('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1692('0x2'));var db=require(_0x1692('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1692('0x4'))('rpc');var config=require(_0x1692('0x5'));var jayson=require(_0x1692('0x6'));var client=jayson[_0x1692('0x7')][_0x1692('0x8')]({'port':0x232a});config[_0x1692('0x9')]=_[_0x1692('0xa')](config[_0x1692('0x9')],{'host':_0x1692('0xb'),'port':0x18eb});var socket=require(_0x1692('0xc'))(new Redis(config[_0x1692('0x9')]));require(_0x1692('0xd'))['register'](socket);function respondWithRpcPromise(_0x3dd25c,_0x4ef77e,_0x1a8f00){return new BPromise(function(_0x41f541,_0x1d07fc){return client[_0x1692('0xe')](_0x3dd25c,_0x1a8f00)[_0x1692('0xf')](function(_0x3a08ac){logger['info'](_0x1692('0x10'),_0x4ef77e,_0x1692('0x11'));logger[_0x1692('0x12')](_0x1692('0x13'),_0x4ef77e,_0x1692('0x11'),JSON[_0x1692('0x14')](_0x3a08ac));if(_0x3a08ac['error']){if(_0x3a08ac[_0x1692('0x15')][_0x1692('0x16')]===0x1f4){logger[_0x1692('0x15')](_0x1692('0x10'),_0x4ef77e,_0x3a08ac[_0x1692('0x15')][_0x1692('0x17')]);return _0x1d07fc(_0x3a08ac[_0x1692('0x15')][_0x1692('0x17')]);}logger['error'](_0x1692('0x10'),_0x4ef77e,_0x3a08ac['error'][_0x1692('0x17')]);return _0x41f541(_0x3a08ac['error'][_0x1692('0x17')]);}else{logger[_0x1692('0x18')](_0x1692('0x10'),_0x4ef77e,'request\x20sent');_0x41f541(_0x3a08ac['result'][_0x1692('0x17')]);}})[_0x1692('0x19')](function(_0x5bd72b){logger[_0x1692('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4ef77e,_0x5bd72b);_0x1d07fc(_0x5bd72b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3a43a26..c8b0b0a 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 _0x8c8d=['update','register','length','chatGroup:','save','remove'];(function(_0x742c21,_0x44bb26){var _0x1abc0f=function(_0x4b9515){while(--_0x4b9515){_0x742c21['push'](_0x742c21['shift']());}};_0x1abc0f(++_0x44bb26);}(_0x8c8d,0x12a));var _0xd8c8=function(_0x2f0166,_0x2c9892){_0x2f0166=_0x2f0166-0x0;var _0x1ba662=_0x8c8d[_0x2f0166];return _0x1ba662;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xd8c8('0x0'),_0xd8c8('0x1'),_0xd8c8('0x2')];function createListener(_0x412f20,_0x4e1c16){return function(_0x5d8058){_0x4e1c16['emit'](_0x412f20,_0x5d8058);};}function removeListener(_0x46cc1e,_0x3f7332){return function(){ChatGroupEvents['removeListener'](_0x46cc1e,_0x3f7332);};}exports[_0xd8c8('0x3')]=function(_0x266b78){for(var _0x1e994a=0x0,_0x37168e=events[_0xd8c8('0x4')];_0x1e994a<_0x37168e;_0x1e994a++){var _0x5cf3ba=events[_0x1e994a];var _0x2d6b25=createListener(_0xd8c8('0x5')+_0x5cf3ba,_0x266b78);ChatGroupEvents['on'](_0x5cf3ba,_0x2d6b25);}}; \ No newline at end of file +var _0x8c34=['register','remove','emit'];(function(_0x5b090f,_0x4661f6){var _0x450660=function(_0x268b1a){while(--_0x268b1a){_0x5b090f['push'](_0x5b090f['shift']());}};_0x450660(++_0x4661f6);}(_0x8c34,0x1e1));var _0x48c3=function(_0x171de0,_0x520ce2){_0x171de0=_0x171de0-0x0;var _0x1b03bb=_0x8c34[_0x171de0];return _0x1b03bb;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x48c3('0x0'),'update'];function createListener(_0x6c3973,_0x18394c){return function(_0x2e7993){_0x18394c[_0x48c3('0x1')](_0x6c3973,_0x2e7993);};}function removeListener(_0x59a10b,_0x580adf){return function(){ChatGroupEvents['removeListener'](_0x59a10b,_0x580adf);};}exports[_0x48c3('0x2')]=function(_0x29b1bc){for(var _0x3c0df2=0x0,_0xd05841=events['length'];_0x3c0df2<_0xd05841;_0x3c0df2++){var _0xf301b4=events[_0x3c0df2];var _0x353208=createListener('chatGroup:'+_0xf301b4,_0x29b1bc);ChatGroupEvents['on'](_0xf301b4,_0x353208);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a649071..3b3f5bb 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 _0xf5eb=['getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','put','update','delete','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/unread'];(function(_0x402c71,_0x7d3f25){var _0xdac8b5=function(_0x223ca7){while(--_0x223ca7){_0x402c71['push'](_0x402c71['shift']());}};_0xdac8b5(++_0x7d3f25);}(_0xf5eb,0x14f));var _0xbf5e=function(_0x5cf101,_0x48e000){_0x5cf101=_0x5cf101-0x0;var _0x54ddb4=_0xf5eb[_0x5cf101];return _0x54ddb4;};'use strict';var multer=require(_0xbf5e('0x0'));var util=require(_0xbf5e('0x1'));var path=require(_0xbf5e('0x2'));var timeout=require(_0xbf5e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf5e('0x4'));var auth=require(_0xbf5e('0x5'));var interaction=require(_0xbf5e('0x6'));var config=require(_0xbf5e('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbf5e('0x8')]);router['get'](_0xbf5e('0x9'),auth['isAuthenticated'](),controller[_0xbf5e('0xa')]);router[_0xbf5e('0xb')](_0xbf5e('0xc'),auth[_0xbf5e('0xd')](),controller[_0xbf5e('0xe')]);router[_0xbf5e('0xb')](_0xbf5e('0xf'),auth[_0xbf5e('0xd')](),controller[_0xbf5e('0x10')]);router[_0xbf5e('0xb')](_0xbf5e('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbf5e('0xb')](_0xbf5e('0x12'),auth['isAuthenticated'](),controller[_0xbf5e('0x13')]);router[_0xbf5e('0x14')]('/',auth[_0xbf5e('0xd')](),controller[_0xbf5e('0x15')]);router[_0xbf5e('0x14')]('/:id/members',auth[_0xbf5e('0xd')](),controller[_0xbf5e('0x16')]);router[_0xbf5e('0x14')](_0xbf5e('0x12'),auth[_0xbf5e('0xd')](),controller['addMessage']);router[_0xbf5e('0x17')](_0xbf5e('0xc'),auth[_0xbf5e('0xd')](),controller[_0xbf5e('0x18')]);router[_0xbf5e('0x19')](_0xbf5e('0xc'),auth[_0xbf5e('0xd')](),controller['destroy']);router['delete'](_0xbf5e('0x11'),auth[_0xbf5e('0xd')](),controller[_0xbf5e('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x53bc=['../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getMessages','create','addMembers','post','/:id/messages','addMessage','put','update','delete','/:id','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x53bc,0x18f));var _0xc53b=function(_0xa4f6f8,_0x4a9ff5){_0xa4f6f8=_0xa4f6f8-0x0;var _0x17bd81=_0x53bc[_0xa4f6f8];return _0x17bd81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc53b('0x0'));var timeout=require(_0xc53b('0x1'));var express=require(_0xc53b('0x2'));var router=express[_0xc53b('0x3')]();var fs_extra=require(_0xc53b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc53b('0x5'));var config=require(_0xc53b('0x6'));var controller=require(_0xc53b('0x7'));router[_0xc53b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc53b('0x8')](_0xc53b('0x9'),auth[_0xc53b('0xa')](),controller[_0xc53b('0xb')]);router['get']('/:id',auth[_0xc53b('0xa')](),controller[_0xc53b('0xc')]);router[_0xc53b('0x8')]('/:id/unread',auth[_0xc53b('0xa')](),controller['getUnread']);router[_0xc53b('0x8')](_0xc53b('0xd'),auth[_0xc53b('0xa')](),controller[_0xc53b('0xe')]);router[_0xc53b('0x8')]('/:id/messages',auth[_0xc53b('0xa')](),controller[_0xc53b('0xf')]);router['post']('/',auth[_0xc53b('0xa')](),controller[_0xc53b('0x10')]);router['post'](_0xc53b('0xd'),auth['isAuthenticated'](),controller[_0xc53b('0x11')]);router[_0xc53b('0x12')](_0xc53b('0x13'),auth[_0xc53b('0xa')](),controller[_0xc53b('0x14')]);router[_0xc53b('0x15')]('/:id',auth[_0xc53b('0xa')](),controller[_0xc53b('0x16')]);router[_0xc53b('0x17')](_0xc53b('0x18'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0xc53b('0xa')](),controller[_0xc53b('0x19')]);module[_0xc53b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e631581..4f2d703 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 _0x56bd=['DATE','ENUM','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING'];(function(_0x2301c1,_0x3c5a47){var _0x28f1eb=function(_0x6a6bb){while(--_0x6a6bb){_0x2301c1['push'](_0x2301c1['shift']());}};_0x28f1eb(++_0x3c5a47);}(_0x56bd,0xe9));var _0xd56b=function(_0x490aad,_0x1c7c91){_0x490aad=_0x490aad-0x0;var _0x54582a=_0x56bd[_0x490aad];return _0x54582a;};'use strict';var Sequelize=require('sequelize');module[_0xd56b('0x0')]={'closed':{'type':Sequelize[_0xd56b('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd56b('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xd56b('0x3'),_0xd56b('0x4')),'defaultValue':_0xd56b('0x3')},'ratingMessage':{'type':Sequelize[_0xd56b('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xd56b('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd56b('0x7')]},'disposition':{'type':Sequelize[_0xd56b('0x6')]},'secondDisposition':{'type':Sequelize[_0xd56b('0x6')]},'thirdDisposition':{'type':Sequelize[_0xd56b('0x6')]},'note':{'type':Sequelize[_0xd56b('0x6')]},'browserName':{'type':Sequelize[_0xd56b('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xd56b('0x6')]},'osVersion':{'type':Sequelize[_0xd56b('0x6')]},'deviceModel':{'type':Sequelize[_0xd56b('0x6')]},'deviceVendor':{'type':Sequelize[_0xd56b('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xd56b('0x6')]},'formData':{'type':Sequelize[_0xd56b('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xd56b('0x7')]},'lastMsgAt':{'type':Sequelize[_0xd56b('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xd56b('0x8')]('in',_0xd56b('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd56b('0x6')]},'customerPort':{'type':Sequelize[_0xd56b('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xd56b('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xd56b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xe605=['DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe605,0x92));var _0x5e60=function(_0x3f692d,_0x183ea9){_0x3f692d=_0x3f692d-0x0;var _0x2d05ab=_0xe605[_0x3f692d];return _0x2d05ab;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5e60('0x2')]},'ratingType':{'type':Sequelize[_0x5e60('0x3')](_0x5e60('0x4'),_0x5e60('0x5')),'defaultValue':_0x5e60('0x4')},'ratingMessage':{'type':Sequelize[_0x5e60('0x6')]},'pathTranscript':{'type':Sequelize[_0x5e60('0x6')]},'mailTranscript':{'type':Sequelize[_0x5e60('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5e60('0x8')]},'disposition':{'type':Sequelize[_0x5e60('0x7')]},'secondDisposition':{'type':Sequelize[_0x5e60('0x7')]},'thirdDisposition':{'type':Sequelize[_0x5e60('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x5e60('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x5e60('0x7')]},'deviceVendor':{'type':Sequelize[_0x5e60('0x7')]},'deviceType':{'type':Sequelize[_0x5e60('0x7')]},'referer':{'type':Sequelize[_0x5e60('0x6')]},'customerIp':{'type':Sequelize[_0x5e60('0x7')]},'formData':{'type':Sequelize[_0x5e60('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x5e60('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5e60('0x3')]('in',_0x5e60('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5e60('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x5e60('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x5e60('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 48ce81e..3a98d81 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 _0x3fd4=['limit','count','set','Content-Range','update','destroy','name','send','render','merge','agent','interaction','account','index','map','rawAttributes','fieldName','type','getOptions','findAll','user','show','keys','ChatInteraction','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','find','create','body','params','describe','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','createdAt','direction','secret','appendFileSync','MailServerOut','Smtp','SendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','getMyMessages','order','push','rows','addTags','setTags','spread','Tag','color','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','ChatWebsite','get','mkdirSync','Chat','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','toString','browserName','osName','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','request-promise','bluebird','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatInteraction,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3fd4,0x165));var _0x43fd=function(_0x43d440,_0x30a005){_0x43d440=_0x43d440-0x0;var _0x58a4ed=_0x3fd4[_0x43d440];return _0x58a4ed;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x43fd('0x0'));var moment=require('moment');var BPromise=require(_0x43fd('0x1'));var Mustache=require(_0x43fd('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x43fd('0x3'));var fs=require('fs');var _=require(_0x43fd('0x4'));var Redis=require(_0x43fd('0x5'));var interaction=require(_0x43fd('0x6'));var qs=require(_0x43fd('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x43fd('0x8'))(_0x43fd('0x9'));var config=require(_0x43fd('0xa'));var db=require('../../mysqldb')['db'];config[_0x43fd('0xb')]=_[_0x43fd('0xc')](config[_0x43fd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x43fd('0xd'))(new Redis(config[_0x43fd('0xb')]));require('./chatInteraction.socket')[_0x43fd('0xe')](socket);var jayson=require(_0x43fd('0xf'));var client=jayson[_0x43fd('0x10')][_0x43fd('0x11')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x291a2f,_0x15dcba,_0x3903c3,_0x28f1ec){return new BPromise(function(_0x5c3248,_0x5c4cce){var _0x3eae2d=_0x28f1ec||client;return _0x3eae2d[_0x43fd('0x12')](_0x291a2f,_0x3903c3)[_0x43fd('0x13')](function(_0x2dc839){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x15dcba,_0x43fd('0x14'));logger[_0x43fd('0x15')](_0x43fd('0x16'),_0x15dcba,'request\x20sent',JSON[_0x43fd('0x17')](_0x2dc839));if(_0x2dc839['error']){if(_0x2dc839['error'][_0x43fd('0x18')]===0x1f4){logger[_0x43fd('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x15dcba,_0x2dc839['error'][_0x43fd('0x1a')]);return _0x5c4cce(_0x2dc839[_0x43fd('0x19')][_0x43fd('0x1a')]);}logger['error'](_0x43fd('0x1b'),_0x15dcba,_0x2dc839[_0x43fd('0x19')][_0x43fd('0x1a')]);return _0x5c3248(_0x2dc839[_0x43fd('0x19')][_0x43fd('0x1a')]);}else{logger['info'](_0x43fd('0x1b'),_0x15dcba,_0x43fd('0x14'));_0x5c3248(_0x2dc839['result'][_0x43fd('0x1a')]);}})[_0x43fd('0x1c')](function(_0x23c381){logger[_0x43fd('0x19')](_0x43fd('0x1b'),_0x15dcba,_0x23c381);_0x5c4cce(_0x23c381);});});}function respondWithStatusCode(_0x3c199c,_0x53fbf6){_0x53fbf6=_0x53fbf6||0xcc;return function(_0x2c283d){if(_0x2c283d){return _0x3c199c[_0x43fd('0x1d')](_0x53fbf6);}return _0x3c199c[_0x43fd('0x1e')](_0x53fbf6)[_0x43fd('0x1f')]();};}function respondWithResult(_0x12cdda,_0x7ee0ab){_0x7ee0ab=_0x7ee0ab||0xc8;return function(_0x45bfd2){if(_0x45bfd2){return _0x12cdda['status'](_0x7ee0ab)[_0x43fd('0x20')](_0x45bfd2);}};}function respondWithFilteredResult(_0x57e5eb,_0x34b44b){return function(_0x98b728){if(_0x98b728){var _0x1ca613=typeof _0x34b44b[_0x43fd('0x21')]===_0x43fd('0x22')&&typeof _0x34b44b[_0x43fd('0x23')]===_0x43fd('0x22');var _0x2679c3=_0x98b728[_0x43fd('0x24')];var _0x57ce36=_0x1ca613?0x0:_0x34b44b[_0x43fd('0x21')];var _0x48bafe=_0x1ca613?_0x98b728[_0x43fd('0x24')]:_0x34b44b[_0x43fd('0x21')]+_0x34b44b[_0x43fd('0x23')];var _0x1bae69;if(_0x48bafe>=_0x2679c3){_0x48bafe=_0x2679c3;_0x1bae69=0xc8;}else{_0x1bae69=0xce;}_0x57e5eb[_0x43fd('0x1e')](_0x1bae69);return _0x57e5eb[_0x43fd('0x25')](_0x43fd('0x26'),_0x57ce36+'-'+_0x48bafe+'/'+_0x2679c3)[_0x43fd('0x20')](_0x98b728);}return null;};}function saveUpdates(_0x3869c3){return function(_0x3bd390){if(_0x3bd390){return _0x3bd390[_0x43fd('0x27')](_0x3869c3)['then'](function(_0x36e547){return _0x36e547;});}return null;};}function removeEntity(_0x3a7153){return function(_0x3cde15){if(_0x3cde15){return _0x3cde15[_0x43fd('0x28')]()[_0x43fd('0x13')](function(){_0x3a7153[_0x43fd('0x1e')](0xcc)[_0x43fd('0x1f')]();});}};}function handleEntityNotFound(_0x43f14c){return function(_0x5750ef){if(!_0x5750ef){_0x43f14c['sendStatus'](0x194);}return _0x5750ef;};}function handleError(_0x53caa1,_0x1785a5){_0x1785a5=_0x1785a5||0x1f4;return function(_0x34af13){logger[_0x43fd('0x19')](_0x34af13['stack']);if(_0x34af13[_0x43fd('0x29')]){delete _0x34af13[_0x43fd('0x29')];}_0x53caa1[_0x43fd('0x1e')](_0x1785a5)[_0x43fd('0x2a')](_0x34af13);};}function getMustacheRender(_0x1275ce,_0x469be0){return Mustache[_0x43fd('0x2b')](_0x1275ce,_[_0x43fd('0x2c')](_0x469be0['body'],{'contact':_0x469be0['contact'],'message':_0x469be0[_0x43fd('0x1a')],'agent':_0x469be0[_0x43fd('0x2d')],'interaction':_0x469be0[_0x43fd('0x2e')],'account':_0x469be0[_0x43fd('0x2f')]}))||'';}exports[_0x43fd('0x30')]=function(_0xa9a204,_0x5ea1cd){var _0x1038ff={};var _0x178e02=_[_0x43fd('0x31')](db['ChatInteraction'][_0x43fd('0x32')],function(_0x2bf6c8){return{'name':_0x2bf6c8[_0x43fd('0x33')],'type':_0x2bf6c8[_0x43fd('0x34')]['key']};});_0x1038ff=qs[_0x43fd('0x35')](_0x178e02,_0xa9a204);return interaction[_0x43fd('0x36')]('chat',_0xa9a204['query'],_0xa9a204[_0x43fd('0x37')],_0x1038ff,_0x178e02)['then'](respondWithFilteredResult(_0x5ea1cd,_0x1038ff))[_0x43fd('0x1c')](handleError(_0x5ea1cd,null));};exports[_0x43fd('0x38')]=function(_0xfcff7c,_0x1a02fa){var _0x478367={'raw':![],'where':{'id':_0xfcff7c['params']['id']}},_0x1c2987={};_0x1c2987['model']=_[_0x43fd('0x39')](db[_0x43fd('0x3a')][_0x43fd('0x32')]);_0x1c2987[_0x43fd('0x3b')]=_[_0x43fd('0x39')](_0xfcff7c[_0x43fd('0x3b')]);_0x1c2987[_0x43fd('0x3c')]=_[_0x43fd('0x3d')](_0x1c2987[_0x43fd('0x3e')],_0x1c2987[_0x43fd('0x3b')]);_0x478367['attributes']=_[_0x43fd('0x3d')](_0x1c2987[_0x43fd('0x3e')],qs[_0x43fd('0x3f')](_0xfcff7c[_0x43fd('0x3b')][_0x43fd('0x3f')]));_0x478367[_0x43fd('0x40')]=_0x478367[_0x43fd('0x40')][_0x43fd('0x41')]?_0x478367[_0x43fd('0x40')]:_0x1c2987[_0x43fd('0x3e')];if(_0xfcff7c['query'][_0x43fd('0x42')]){_0x478367[_0x43fd('0x43')]=[{'all':!![]}];}_0x478367=_[_0x43fd('0x2c')]({},_0x478367,_0xfcff7c[_0x43fd('0x44')]);return db[_0x43fd('0x3a')][_0x43fd('0x45')](_0x478367)[_0x43fd('0x13')](handleEntityNotFound(_0x1a02fa,null))[_0x43fd('0x13')](respondWithResult(_0x1a02fa,null))[_0x43fd('0x1c')](handleError(_0x1a02fa,null));};exports[_0x43fd('0x46')]=function(_0x186420,_0x74a1e3){return db[_0x43fd('0x3a')]['create'](_0x186420[_0x43fd('0x47')],{})[_0x43fd('0x13')](respondWithResult(_0x74a1e3,0xc9))[_0x43fd('0x1c')](handleError(_0x74a1e3,null));};exports['update']=function(_0x675566,_0x14d4ad){if(_0x675566[_0x43fd('0x47')]['id']){delete _0x675566['body']['id'];}return db[_0x43fd('0x3a')][_0x43fd('0x45')]({'where':{'id':_0x675566[_0x43fd('0x48')]['id']}})[_0x43fd('0x13')](handleEntityNotFound(_0x14d4ad,null))[_0x43fd('0x13')](saveUpdates(_0x675566[_0x43fd('0x47')],null))[_0x43fd('0x13')](respondWithResult(_0x14d4ad,null))['catch'](handleError(_0x14d4ad,null));};exports[_0x43fd('0x28')]=function(_0x2a72b8,_0xd98a8b){return db['ChatInteraction'][_0x43fd('0x45')]({'where':{'id':_0x2a72b8[_0x43fd('0x48')]['id']}})[_0x43fd('0x13')](handleEntityNotFound(_0xd98a8b,null))[_0x43fd('0x13')](removeEntity(_0xd98a8b,null))[_0x43fd('0x1c')](handleError(_0xd98a8b,null));};exports[_0x43fd('0x49')]=function(_0x1dabb6,_0x183036){return db[_0x43fd('0x3a')][_0x43fd('0x49')]()[_0x43fd('0x13')](respondWithResult(_0x183036,null))[_0x43fd('0x1c')](handleError(_0x183036,null));};exports['createVidaooSession']=function(_0x33c9f6,_0x440bb1){var _0x2bbb89=_0x33c9f6[_0x43fd('0x48')]['id'];var _0x23eb7e;var _0x1c3e81;var _0x4af990;return db[_0x43fd('0x3a')][_0x43fd('0x4a')]({'where':{'id':_0x2bbb89}})[_0x43fd('0x13')](function(_0x5f3834){_0x23eb7e=_0x5f3834;return db['ChatWebsite'][_0x43fd('0x4a')]({'where':{'id':_0x5f3834[_0x43fd('0x4b')]},'attributes':['id','vidaooApiKey',_0x43fd('0x4c'),_0x43fd('0x4d'),_0x43fd('0x4e'),_0x43fd('0x4f')],'raw':!![]});})[_0x43fd('0x13')](function(_0x22456b){if(_0x22456b&&_0x22456b['vidaooApiKey']&&_0x22456b['vidaooEscalation']){_0x1c3e81=_0x22456b;var _0x4fd3b3={'interaction':{'id':_0x2bbb89},'agent':{'id':_0x33c9f6['user']['id'],'name':_0x33c9f6[_0x43fd('0x37')][_0x43fd('0x29')],'fullname':_0x33c9f6[_0x43fd('0x37')]['fullname'],'email':_0x33c9f6[_0x43fd('0x37')][_0x43fd('0x50')]},'contact':_0x33c9f6['body'][_0x43fd('0x51')],'account':_0x33c9f6['body']['account']};var _0x4c437b={'rejectUnauthorized':![],'method':_0x43fd('0x52'),'url':_0x43fd('0x53'),'headers':{'X-APIKEY':_0x22456b['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x33c9f6[_0x43fd('0x37')][_0x43fd('0x50')]],'buttons':null,'topic':_0x1c3e81[_0x43fd('0x4d')],'note':_[_0x43fd('0x54')](_0x1c3e81['vidaooNote'])?null:getMustacheRender(_0x1c3e81[_0x43fd('0x4e')],_0x4fd3b3),'metadata':null},'redirect':_0x43fd('0x55'),'json':!![]};try{if(!_['isNull'](_0x1c3e81['vidaooMetadata'])){var _0x433b60=getMustacheRender(_0x1c3e81['vidaooMetadata'],_0x4fd3b3);var _0x509036=JSON[_0x43fd('0x56')](_0x433b60);_0x4c437b[_0x43fd('0x47')]['metadata']=_0x509036;}}catch(_0x2939bd){throw new db[(_0x43fd('0x57'))][(_0x43fd('0x58'))](_0x43fd('0x59'));}return rp(_0x4c437b);}else{throw new db['Sequelize'][(_0x43fd('0x58'))](_0x43fd('0x5a'));}})['then'](function(_0x524e98){_0x4af990=_0x524e98;if(_0x4af990['id']){var _0x32d75e={'body':_0x4af990[_0x43fd('0x5b')],'ChatWebsiteId':_0x1c3e81['id'],'ChatInteractionId':_0x23eb7e['id'],'direction':'out','UserId':_0x33c9f6[_0x43fd('0x37')]['id']};return db[_0x43fd('0x5c')][_0x43fd('0x46')](_0x32d75e,{});}else{throw new db[(_0x43fd('0x57'))][(_0x43fd('0x58'))](_0x43fd('0x5d'));}})[_0x43fd('0x13')](function(){return _0x23eb7e[_0x43fd('0x5e')]({'vidaooSessionId':_0x4af990['id']});})[_0x43fd('0x13')](respondWithResult(_0x440bb1,null))['catch'](handleError(_0x440bb1,null));};exports[_0x43fd('0x5f')]=function(_0x1296a9,_0x114149){if(_0x1296a9[_0x43fd('0x47')]['id']){delete _0x1296a9[_0x43fd('0x47')]['id'];}return db[_0x43fd('0x3a')][_0x43fd('0x45')]({'where':{'id':_0x1296a9[_0x43fd('0x48')]['id']},'include':[{'model':db[_0x43fd('0x60')],'as':_0x43fd('0x61')}]})[_0x43fd('0x13')](handleEntityNotFound(_0x114149,null))['then'](saveUpdates(_0x1296a9['body'],null))[_0x43fd('0x13')](respondWithResult(_0x114149,null))[_0x43fd('0x1c')](handleError(_0x114149,null));};exports[_0x43fd('0x62')]=function(_0x3eab69,_0x2cdd6e){if(_0x3eab69['body']['id']){delete _0x3eab69[_0x43fd('0x47')]['id'];}return db[_0x43fd('0x3a')][_0x43fd('0x45')]({'where':{'id':_0x3eab69['params']['id']}})[_0x43fd('0x13')](function(_0x734a5f){if(!_0x734a5f){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x43fd('0x62'),0x194,_0x43fd('0x63'));_0x2cdd6e['sendStatus'](0x194);}else{if(_0x734a5f[_0x43fd('0x64')]){throw new db['Sequelize'][(_0x43fd('0x58'))](_0x43fd('0x65'));}}return _0x734a5f;})['then'](function(_0x418252){if(_0x418252){return _0x418252[_0x43fd('0x27')]({'closed':_0x3eab69[_0x43fd('0x47')][_0x43fd('0x66')],'disposition':_0x3eab69['body'][_0x43fd('0x67')]})['then'](function(_0x40f734){return _0x40f734;});}})[_0x43fd('0x13')](function(){return respondWithRpcPromise('AbandonInteraction',_0x43fd('0x62'),_0x3eab69[_0x43fd('0x47')],client9004);})[_0x43fd('0x13')](respondWithResult(_0x2cdd6e,null))[_0x43fd('0x1c')](handleError(_0x2cdd6e,null));};exports[_0x43fd('0x68')]=function(_0x19e916,_0x3a0302){_0x19e916[_0x43fd('0x47')][_0x43fd('0x29')]=_0x19e916[_0x43fd('0x69')]['originalname'];_0x19e916[_0x43fd('0x47')]['basename']=_0x19e916[_0x43fd('0x69')]['filename'];_0x19e916[_0x43fd('0x47')]['type']=_0x19e916['file'][_0x43fd('0x6a')];return db[_0x43fd('0x6b')][_0x43fd('0x46')](_0x19e916['body'])[_0x43fd('0x13')](respondWithResult(_0x3a0302,0xc9))[_0x43fd('0x1c')](handleError(_0x3a0302,null));};exports[_0x43fd('0x6c')]=function(_0xbe5beb,_0x45b7ee){return db[_0x43fd('0x3a')][_0x43fd('0x4a')]({'where':{'id':_0xbe5beb['params']['id']},'raw':!![]})[_0x43fd('0x13')](handleEntityNotFound(_0x45b7ee,null))[_0x43fd('0x13')](function(_0x51b465){if(_0x51b465){if(_0x51b465[_0x43fd('0x66')]){return _0x45b7ee[_0x43fd('0x1e')](0x193)[_0x43fd('0x20')]({'status':0x193,'message':_0x43fd('0x6d')});}return db[_0x43fd('0x6b')][_0x43fd('0x4a')]({'where':{'id':_0xbe5beb[_0x43fd('0x3b')]['attachId']},'raw':!![]})[_0x43fd('0x13')](handleEntityNotFound(_0x45b7ee,null));}})[_0x43fd('0x13')](function(_0x2b8e25){if(_0x2b8e25){var _0x23983c=_0x2b8e25[_0x43fd('0x6e')]!==null;var _0x11e661=path[_0x43fd('0x6f')](config[_0x43fd('0x70')],'server/files/attachments/');if(_0x23983c){_0x11e661=path[_0x43fd('0x6f')](_0x11e661,'offline-chat/');}var _0x4a8eb2=path[_0x43fd('0x6f')](_0x11e661,_0x2b8e25['basename']);return _0x45b7ee[_0x43fd('0x71')](_0x4a8eb2);}})[_0x43fd('0x1c')](handleError(_0x45b7ee,null));};exports['close']=function(_0x1d7533,_0x9b30b0){var _0x588364=null;var _0x15a491=null;var _0x2258bd=null;if(_0x1d7533[_0x43fd('0x47')]['id']){delete _0x1d7533[_0x43fd('0x47')]['id'];}if(_0x1d7533['body'][_0x43fd('0x72')]){_0x2258bd=path['join'](config[_0x43fd('0x70')],_0x43fd('0x73'),util[_0x43fd('0x74')](_0x43fd('0x75'),Date[_0x43fd('0x76')]()));_0x1d7533[_0x43fd('0x47')][_0x43fd('0x77')]=_0x2258bd;}return db[_0x43fd('0x3a')]['find']({'where':{'id':_0x1d7533[_0x43fd('0x48')]['id']},'include':[{'model':db[_0x43fd('0x5c')],'as':_0x43fd('0x78'),'include':[{'model':db['User'],'as':_0x43fd('0x79')}]}]})['then'](handleEntityNotFound(_0x9b30b0,null))[_0x43fd('0x13')](saveUpdates(_0x1d7533[_0x43fd('0x47')],null))[_0x43fd('0x13')](function(_0x508dda){if(_0x508dda){_0x588364=_0x508dda;return db['ChatWebsite'][_0x43fd('0x45')]({'where':{'id':_0x588364[_0x43fd('0x4b')]}});}})[_0x43fd('0x13')](function(_0x13f0cb){if(_0x13f0cb){_0x15a491=_0x13f0cb;return db['CmContact'][_0x43fd('0x45')]({'where':{'id':_0x588364[_0x43fd('0x7a')]}});}})['then'](function(_0x2b003d){if(_0x2b003d){if(_0x2258bd){var _0x4e8753=null;for(var _0x1c37ae=0x1;_0x1c37ae<_0x588364['Messages'][_0x43fd('0x41')];++_0x1c37ae){_0x4e8753=_0x588364[_0x43fd('0x78')][_0x1c37ae];var _0x1eed7b=_0x4e8753[_0x43fd('0x64')]?util[_0x43fd('0x74')](_0x43fd('0x7b'),_0x15a491[_0x43fd('0x7c')],_0x4e8753[_0x43fd('0x64')]):_0x43fd('0x7d');var _0x5c70f0=_0x1d7533[_0x43fd('0x47')]['customer']||util[_0x43fd('0x74')]('%s%d',_0x43fd('0x7e'),_0x4e8753[_0x43fd('0x7a')]);switch(_0x15a491[_0x43fd('0x7f')]){case _0x43fd('0x80'):_0x1eed7b=_0x4e8753[_0x43fd('0x64')]?util['format']('%s%d',_0x15a491['agentAlias'],_0x4e8753[_0x43fd('0x64')]):_0x43fd('0x7d');break;case _0x43fd('0x81'):_0x1eed7b=_0x4e8753['UserId']?_0x4e8753['User'][_0x43fd('0x82')]||_0x4e8753[_0x43fd('0x79')][_0x43fd('0x83')]:'System';break;case _0x43fd('0x84'):_0x1eed7b=_0x4e8753['UserId']?_0x4e8753[_0x43fd('0x79')][_0x43fd('0x83')]:_0x43fd('0x7d');break;default:_0x1eed7b=_0x4e8753[_0x43fd('0x64')]?util[_0x43fd('0x74')]('%s%d',_0x15a491[_0x43fd('0x7c')],_0x4e8753[_0x43fd('0x64')]):_0x43fd('0x7d');}var _0x417ae8=util[_0x43fd('0x74')]('[%s]\x20%s:\x20%s\x0a',moment(_0x4e8753[_0x43fd('0x85')])[_0x43fd('0x74')]('MM/DD/YYYY\x20HH:mm:ss'),_0x4e8753[_0x43fd('0x86')]==='in'?_0x5c70f0:_0x1eed7b,_0x4e8753[_0x43fd('0x47')]);if(!_0x4e8753[_0x43fd('0x87')]){fs[_0x43fd('0x88')](_0x2258bd,_0x417ae8);}}return db['MailAccount'][_0x43fd('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x43fd('0x89')],'as':_0x43fd('0x8a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x5a7165){if(!_0x5a7165||!_0x5a7165['Smtp']||!_0x1d7533[_0x43fd('0x47')])return _0x588364;var _0x396f26=_0x5a7165['getSmtpOptions']();return respondWithRpcPromise(_0x43fd('0x8b'),'sendMail',{'account':_0x396f26,'message':{'from':util[_0x43fd('0x74')](_0x43fd('0x8c'),_0x5a7165[_0x43fd('0x29')],_0x5a7165[_0x43fd('0x50')]||_0x5a7165[_0x43fd('0x8a')][_0x43fd('0x37')]),'to':_0x1d7533[_0x43fd('0x47')][_0x43fd('0x72')],'subject':'Mail\x20Transcript','text':util[_0x43fd('0x74')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1d7533['body']['mailTranscript']),'attachments':[{'path':_0x2258bd}]}})[_0x43fd('0x13')](function(){return _0x588364;})[_0x43fd('0x1c')](function(_0x77f9a4){logger[_0x43fd('0x19')](_0x77f9a4);});})['then'](respondWithStatusCode(_0x9b30b0,0xc8))['catch'](handleError(_0x9b30b0,null));};exports[_0x43fd('0x8d')]=function(_0x3adcfe,_0x15953f){return db[_0x43fd('0x5c')]['find']({'where':{'id':_0x3adcfe['params']['id']}})[_0x43fd('0x13')](handleEntityNotFound(_0x15953f,null))[_0x43fd('0x13')](function(_0x32b70f){if(_0x32b70f){return _0x32b70f[_0x43fd('0x8d')](_0x3adcfe[_0x43fd('0x47')][_0x43fd('0x8e')],_[_0x43fd('0x8f')](_0x3adcfe[_0x43fd('0x47')],[_0x43fd('0x8e'),'id'])||{});}})[_0x43fd('0x13')](respondWithResult(_0x15953f,null))['catch'](handleError(_0x15953f,null));};exports[_0x43fd('0x90')]=function(_0x24f167,_0x5b7c46){var _0x562b8b={'raw':![],'where':{}};var _0x30c2e9={};var _0x4fcec7={'count':0x0,'rows':[]};return db[_0x43fd('0x3a')][_0x43fd('0x4a')]({'where':{'id':_0x24f167[_0x43fd('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b7c46,null))[_0x43fd('0x13')](function(_0x58a475){if(_0x58a475){_0x30c2e9[_0x43fd('0x3e')]=_['keys'](db[_0x43fd('0x5c')][_0x43fd('0x32')]);_0x30c2e9[_0x43fd('0x3b')]=_[_0x43fd('0x39')](_0x24f167[_0x43fd('0x3b')]);_0x30c2e9[_0x43fd('0x3c')]=_[_0x43fd('0x3d')](_0x30c2e9[_0x43fd('0x3e')],_0x30c2e9[_0x43fd('0x3b')]);_0x562b8b[_0x43fd('0x40')]=_['intersection'](_0x30c2e9[_0x43fd('0x3e')],qs[_0x43fd('0x3f')](_0x24f167[_0x43fd('0x3b')][_0x43fd('0x3f')]));_0x562b8b[_0x43fd('0x40')]=_0x562b8b[_0x43fd('0x40')][_0x43fd('0x41')]?_0x562b8b[_0x43fd('0x40')]:_0x30c2e9['model'];if(!_0x24f167[_0x43fd('0x3b')][_0x43fd('0x91')](_0x43fd('0x92'))){_0x562b8b[_0x43fd('0x23')]=qs[_0x43fd('0x23')](_0x24f167[_0x43fd('0x3b')][_0x43fd('0x23')]);_0x562b8b[_0x43fd('0x21')]=qs['offset'](_0x24f167[_0x43fd('0x3b')][_0x43fd('0x21')]);}_0x562b8b['order']=qs[_0x43fd('0x93')](_0x24f167[_0x43fd('0x3b')][_0x43fd('0x93')]);_0x562b8b[_0x43fd('0x94')]=qs[_0x43fd('0x3c')](_[_0x43fd('0x95')](_0x24f167[_0x43fd('0x3b')],_0x30c2e9[_0x43fd('0x3c')]));_0x562b8b[_0x43fd('0x94')][_0x43fd('0x96')]=_0x58a475['id'];if(_0x24f167[_0x43fd('0x3b')][_0x43fd('0x97')]){_0x562b8b[_0x43fd('0x94')]=_[_0x43fd('0x2c')](_0x562b8b[_0x43fd('0x94')],{'$or':_[_0x43fd('0x31')](_0x562b8b[_0x43fd('0x40')],function(_0x345191){var _0x1575c6={};_0x1575c6[_0x345191]={'$like':'%'+_0x24f167[_0x43fd('0x3b')][_0x43fd('0x97')]+'%'};return _0x1575c6;})});}if(_0x24f167[_0x43fd('0x3b')][_0x43fd('0x98')]){var _0x24acd1=_0x24f167[_0x43fd('0x3b')][_0x43fd('0x98')]['split'](',');var _0x541703={};_0x541703[_0x24acd1[0x0]]={'$gte':moment(_0x24acd1[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x562b8b[_0x43fd('0x94')]=_[_0x43fd('0x2c')](_0x562b8b['where'],_0x541703);}_0x562b8b=_['merge']({},_0x562b8b,_0x24f167['options']);return db[_0x43fd('0x5c')]['count']({'where':_0x562b8b[_0x43fd('0x94')]})[_0x43fd('0x13')](function(_0x47790e){_0x4fcec7[_0x43fd('0x24')]=_0x47790e;if(_0x24f167[_0x43fd('0x3b')]['includeAll']){_0x562b8b[_0x43fd('0x43')]=[{'all':!![]}];}return db[_0x43fd('0x5c')][_0x43fd('0x36')](_0x562b8b);})[_0x43fd('0x13')](function(_0x47b450){_0x4fcec7['rows']=_0x47b450;return _0x4fcec7;});}})[_0x43fd('0x13')](respondWithFilteredResult(_0x5b7c46,_0x562b8b))[_0x43fd('0x1c')](handleError(_0x5b7c46,null));};exports[_0x43fd('0x99')]=function(_0x4677c8,_0x427637){var _0x356ad2={'where':{}},_0x30a2ca={},_0xaf54bc={'count':0x0,'rows':[]};return db[_0x43fd('0x3a')][_0x43fd('0x4a')]({'where':{'id':_0x4677c8[_0x43fd('0x48')]['id']}})[_0x43fd('0x13')](handleEntityNotFound(_0x427637,null))[_0x43fd('0x13')](function(_0x9cb030){if(_0x9cb030){_0x30a2ca[_0x43fd('0x3e')]=_['keys'](db['ChatMessage'][_0x43fd('0x32')]);_0x30a2ca[_0x43fd('0x3b')]=_[_0x43fd('0x39')](_0x4677c8[_0x43fd('0x3b')]);_0x30a2ca[_0x43fd('0x3c')]=_[_0x43fd('0x3d')](_0x30a2ca[_0x43fd('0x3e')],_0x30a2ca[_0x43fd('0x3b')]);_0x356ad2[_0x43fd('0x40')]=_[_0x43fd('0x3d')](_0x30a2ca[_0x43fd('0x3e')],qs[_0x43fd('0x3f')](_0x4677c8[_0x43fd('0x3b')][_0x43fd('0x3f')]));_0x356ad2['attributes']=_0x356ad2[_0x43fd('0x40')][_0x43fd('0x41')]?_0x356ad2['attributes']:_0x30a2ca['model'];if(!_0x4677c8[_0x43fd('0x3b')][_0x43fd('0x91')](_0x43fd('0x92'))){_0x356ad2[_0x43fd('0x23')]=qs[_0x43fd('0x23')](_0x4677c8['query']['limit']);_0x356ad2[_0x43fd('0x21')]=qs[_0x43fd('0x21')](_0x4677c8[_0x43fd('0x3b')][_0x43fd('0x21')]);}_0x356ad2[_0x43fd('0x9a')]=qs[_0x43fd('0x93')](_0x4677c8[_0x43fd('0x3b')][_0x43fd('0x93')]);_0x356ad2[_0x43fd('0x94')]=qs['filters'](_[_0x43fd('0x95')](_0x4677c8[_0x43fd('0x3b')],_0x30a2ca[_0x43fd('0x3c')]));_0x356ad2[_0x43fd('0x94')][_0x43fd('0x96')]=_0x9cb030['id'];if(_0x4677c8[_0x43fd('0x3b')]['filter']){_0x356ad2[_0x43fd('0x94')]=_[_0x43fd('0x2c')](_0x356ad2[_0x43fd('0x94')],{'$or':_[_0x43fd('0x31')](_0x356ad2['attributes'],function(_0x27fd9b){var _0x17f65a={};_0x17f65a[_0x27fd9b]={'$like':'%'+_0x4677c8[_0x43fd('0x3b')]['filter']+'%'};return _0x17f65a;})});}_0x356ad2[_0x43fd('0x94')][_0x43fd('0x87')]=![];if(_0x4677c8[_0x43fd('0x3b')]['id']){_0x356ad2['where']['id']={'$gt':_0x4677c8['query']['id']};}_0x356ad2=_[_0x43fd('0x2c')]({},_0x356ad2,_0x4677c8[_0x43fd('0x44')]);return db[_0x43fd('0x5c')][_0x43fd('0x24')]({'where':_0x356ad2[_0x43fd('0x94')]})['then'](function(_0x227def){_0xaf54bc[_0x43fd('0x24')]=_0x227def;_0x356ad2[_0x43fd('0x43')]=[];if(_0x4677c8[_0x43fd('0x3b')]['includeAgent']){_0x356ad2[_0x43fd('0x43')][_0x43fd('0x9b')]({'model':db['User'],'as':_0x43fd('0x79'),'attributes':['id',_0x43fd('0x83'),'alias']});}if(_0x4677c8[_0x43fd('0x3b')][_0x43fd('0x42')]){_0x356ad2[_0x43fd('0x43')]=[{'all':!![]}];}return db[_0x43fd('0x5c')][_0x43fd('0x36')](_0x356ad2);})[_0x43fd('0x13')](function(_0x1f6582){_0xaf54bc[_0x43fd('0x9c')]=_0x1f6582;return _0xaf54bc;});}})['then'](respondWithFilteredResult(_0x427637,_0x356ad2))['catch'](handleError(_0x427637,null));};exports[_0x43fd('0x9d')]=function(_0xdc5539,_0x1f2893){return db['ChatInteraction'][_0x43fd('0x45')]({'where':{'id':_0xdc5539[_0x43fd('0x48')]['id']}})[_0x43fd('0x13')](handleEntityNotFound(_0x1f2893,null))[_0x43fd('0x13')](function(_0x1abec0){if(_0x1abec0){return _0x1abec0[_0x43fd('0x9e')](_0xdc5539[_0x43fd('0x47')][_0x43fd('0x8e')],_[_0x43fd('0x8f')](_0xdc5539[_0x43fd('0x47')],[_0x43fd('0x8e'),'id'])||{})[_0x43fd('0x9f')](function(){return db[_0x43fd('0xa0')][_0x43fd('0x36')]({'attributes':['id',_0x43fd('0x29'),_0x43fd('0xa1')],'where':{'id':_0xdc5539['body']['ids']}});})[_0x43fd('0x13')](function(_0x18cb14){socket['emit']('chatInteractionTags:save',{'id':Number(_0xdc5539['params']['id']),'tags':_0x18cb14||[]});return{'id':Number(_0xdc5539[_0x43fd('0x48')]['id']),'tags':_0x18cb14||[]};});}})[_0x43fd('0x13')](respondWithResult(_0x1f2893,null))[_0x43fd('0x1c')](handleError(_0x1f2893,null));};exports[_0x43fd('0xa2')]=function(_0x47661b,_0x5235ab){return db[_0x43fd('0x3a')][_0x43fd('0x45')]({'where':{'id':_0x47661b[_0x43fd('0x48')]['id']}})['then'](handleEntityNotFound(_0x5235ab,null))[_0x43fd('0x13')](function(_0x564064){if(_0x564064){return _0x564064[_0x43fd('0xa2')](_0x47661b['query'][_0x43fd('0x8e')]);}})[_0x43fd('0x13')](respondWithStatusCode(_0x5235ab,null))[_0x43fd('0x1c')](handleError(_0x5235ab,null));};exports[_0x43fd('0x71')]=function(_0x2280ca,_0x25fd70){var _0x44431c=moment()[_0x43fd('0xa3')]()['toString']();var _0x456180=path['join'](config[_0x43fd('0x70')],'server','files',_0x43fd('0xa4'));var _0x46d8bd=path[_0x43fd('0x6f')](config[_0x43fd('0x70')],_0x43fd('0xa5'),_0x43fd('0xa6'),_0x43fd('0xa7'));var _0x554d5d=path[_0x43fd('0x6f')](_0x456180,_0x44431c);var _0x2738f1=util[_0x43fd('0x74')](_0x43fd('0xa8'),_0x2280ca[_0x43fd('0x48')]['id'],_0x44431c);var _0x331fd4=path[_0x43fd('0x6f')](_0x456180,_0x2738f1);var _0x56f882=[];_0x56f882[_0x43fd('0x9b')]({'model':db['User'],'as':_0x43fd('0x79'),'attributes':['id',_0x43fd('0x83')],'raw':!![]});_0x56f882[_0x43fd('0x9b')]({'model':db[_0x43fd('0x60')],'as':_0x43fd('0x61'),'attributes':['id',_0x43fd('0xa9'),_0x43fd('0xaa')],'raw':!![]});if(_0x2280ca[_0x43fd('0x3b')][_0x43fd('0xa7')]){_0x56f882[_0x43fd('0x9b')]({'model':db[_0x43fd('0x6b')],'as':_0x43fd('0x6b'),'raw':!![]});}var _0x5deb37=[{'model':db[_0x43fd('0x5c')],'as':'Messages','attributes':['id',_0x43fd('0x47'),_0x43fd('0x85'),_0x43fd('0x86'),_0x43fd('0x87'),_0x43fd('0xab')],'include':_0x56f882}];_0x5deb37[_0x43fd('0x9b')]({'model':db[_0x43fd('0xac')],'as':'Account','attributes':['id',_0x43fd('0x29')]});_0x5deb37['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x43fd('0x83')]});return db[_0x43fd('0x3a')]['find']({'where':{'id':_0x2280ca[_0x43fd('0x48')]['id']},'include':_0x5deb37})[_0x43fd('0x13')](handleEntityNotFound(_0x25fd70,null))[_0x43fd('0x13')](function(_0x4d71df){if(_0x4d71df){var _0x490fab=_0x4d71df[_0x43fd('0xad')]({'plain':!![]});fs[_0x43fd('0xae')](_0x554d5d);var _0x32d145={'channel':_0x43fd('0xaf'),'account':_0x490fab[_0x43fd('0xb0')][_0x43fd('0x29')],'agent':_0x490fab[_0x43fd('0xb1')]?_0x490fab['Owner']['fullname']:'N.A.','createdAt':moment(_0x490fab['createdAt'])[_0x43fd('0x74')](_0x43fd('0xb2'))[_0x43fd('0xb3')](),'closedAt':_0x490fab['closed']?moment(_0x490fab['closedAt'])[_0x43fd('0x74')](_0x43fd('0xb2'))[_0x43fd('0xb3')]():'','disposition':_0x490fab['disposition'],'chatInfo':{'browser':_0x490fab[_0x43fd('0xb4')],'os':_0x490fab[_0x43fd('0xb5')],'referer':_0x490fab['referer'],'customerIp':_0x490fab['customerIp'],'customerPort':_0x490fab[_0x43fd('0xb6')]?_0x490fab[_0x43fd('0xb6')]:_0x43fd('0xb7')},'messages':_(_0x490fab[_0x43fd('0x78')])[_0x43fd('0xb8')]()[_0x43fd('0x97')]({'secret':![]})[_0x43fd('0x31')](function(_0xb548cb){if(_0xb548cb[_0x43fd('0x6b')]){var _0x315763=path[_0x43fd('0x6f')](_0x46d8bd,_0xb548cb[_0x43fd('0x6b')]['basename']);if(fs[_0x43fd('0xb9')](_0x315763)){fs[_0x43fd('0xba')](_0x315763)['pipe'](fs[_0x43fd('0xbb')](path[_0x43fd('0x6f')](_0x554d5d,_0xb548cb[_0x43fd('0x6b')]['basename'])));}}return{'date':moment(_0xb548cb[_0x43fd('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x43fd('0xb3')](),'sender':_0xb548cb[_0x43fd('0x86')]===_0x43fd('0xbc')?_0xb548cb['User']?_0xb548cb[_0x43fd('0x79')]['fullname']:_0x43fd('0x7d'):_0xb548cb[_0x43fd('0x61')]['firstName']+(_0xb548cb['Contact'][_0x43fd('0xaa')]?'\x20'+_0xb548cb['Contact'][_0x43fd('0xaa')]:''),'body':_0xb548cb[_0x43fd('0x6b')]?_0xb548cb[_0x43fd('0x6b')]['basename']:_0xb548cb[_0x43fd('0x47')],'direction':_0xb548cb[_0x43fd('0x86')]===_0x43fd('0xbc')?'A':'C','secret':_0xb548cb[_0x43fd('0x87')],'read':_0xb548cb[_0x43fd('0xab')],'attachment':_0xb548cb['Attachment']};})[_0x43fd('0xbd')]()};return ejs[_0x43fd('0xbe')](path['join'](config[_0x43fd('0x70')],_0x43fd('0xa5'),_0x43fd('0xbf'),_0x43fd('0xc0')),{'interaction':_0x32d145})['then'](function(_0x3709ca){var _0x50a8ef=path[_0x43fd('0x6f')](_0x554d5d,_0x43fd('0xc1')+_0x490fab['id']+'-'+_0x44431c+'.pdf');var _0x5b9d52={'path':_0x50a8ef,'channel':_0x43fd('0xaf'),'interactionId':_0x490fab['id']};return pdf[_0x43fd('0xc2')](_0x3709ca,_0x5b9d52);})[_0x43fd('0x13')](function(){return new Promise(function(_0x8ad329,_0x1a120e){zipdir(_0x554d5d,{'saveTo':_0x331fd4},function(_0x7f082e,_0x4a49c4){if(_0x7f082e)return _0x1a120e(_0x7f082e);return _0x8ad329(_0x4a49c4);});})[_0x43fd('0x13')](function(){return new BPromise(function(_0x2a7cac,_0x2408fb){rimraf(_0x554d5d,function(_0x25c9fb){if(_0x25c9fb)_0x2408fb(_0x25c9fb);return _0x2a7cac();});});})[_0x43fd('0x13')](function(){return _0x25fd70['download'](_0x331fd4,_0x2738f1,function(_0x3112ef){if(_0x3112ef){logger[_0x43fd('0x19')](_0x43fd('0xc3'),_0x3112ef);}else{fs['unlinkSync'](_0x331fd4);}});});});}else{return _0x25fd70[_0x43fd('0x1d')](0xc8);}})[_0x43fd('0x1c')](handleError(_0x25fd70,null));}; \ No newline at end of file +var _0x01bf=['key','findAll','chat','query','user','params','model','keys','filters','attributes','intersection','length','includeAll','include','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','filename','Attachment','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ChatWebsite','ContactId','%s%d','agentAlias','customer','Visitor','website_alias','System','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','fields','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','push','addTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','mkdirSync','Owner','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','update','destroy','end','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type'];(function(_0x59639b,_0x2226eb){var _0x30d495=function(_0x46fa61){while(--_0x46fa61){_0x59639b['push'](_0x59639b['shift']());}};_0x30d495(++_0x2226eb);}(_0x01bf,0x93));var _0xf01b=function(_0x36fc1f,_0x27c1c8){_0x36fc1f=_0x36fc1f-0x0;var _0x371281=_0x01bf[_0x36fc1f];return _0x371281;};'use strict';var rimraf=require(_0xf01b('0x0'));var zipdir=require(_0xf01b('0x1'));var rp=require(_0xf01b('0x2'));var moment=require(_0xf01b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf01b('0x4'));var util=require('util');var path=require('path');var ejs=require(_0xf01b('0x5'));var fs=require('fs');var _=require(_0xf01b('0x6'));var Redis=require('ioredis');var interaction=require(_0xf01b('0x7'));var qs=require(_0xf01b('0x8'));var pdf=require(_0xf01b('0x9'));var logger=require(_0xf01b('0xa'))('api');var config=require('../../config/environment');var db=require(_0xf01b('0xb'))['db'];config[_0xf01b('0xc')]=_['defaults'](config['redis'],{'host':_0xf01b('0xd'),'port':0x18eb});var socket=require(_0xf01b('0xe'))(new Redis(config[_0xf01b('0xc')]));require(_0xf01b('0xf'))[_0xf01b('0x10')](socket);var jayson=require(_0xf01b('0x11'));var client=jayson['client'][_0xf01b('0x12')]({'port':0x232b});var client9004=jayson[_0xf01b('0x13')][_0xf01b('0x12')]({'port':0x232c});function respondWithRpcPromise(_0xbf5d25,_0x4a3db3,_0x9fd5c6,_0x1404b0){return new BPromise(function(_0xccd217,_0x1797e1){var _0x492991=_0x1404b0||client;return _0x492991[_0xf01b('0x14')](_0xbf5d25,_0x9fd5c6)[_0xf01b('0x15')](function(_0x45ae0a){logger['info'](_0xf01b('0x16'),_0x4a3db3,_0xf01b('0x17'));logger['debug'](_0xf01b('0x18'),_0x4a3db3,'request\x20sent',JSON[_0xf01b('0x19')](_0x45ae0a));if(_0x45ae0a[_0xf01b('0x1a')]){if(_0x45ae0a[_0xf01b('0x1a')][_0xf01b('0x1b')]===0x1f4){logger[_0xf01b('0x1a')](_0xf01b('0x16'),_0x4a3db3,_0x45ae0a[_0xf01b('0x1a')]['message']);return _0x1797e1(_0x45ae0a['error']['message']);}logger['error'](_0xf01b('0x16'),_0x4a3db3,_0x45ae0a['error'][_0xf01b('0x1c')]);return _0xccd217(_0x45ae0a[_0xf01b('0x1a')][_0xf01b('0x1c')]);}else{logger[_0xf01b('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x4a3db3,'request\x20sent');_0xccd217(_0x45ae0a[_0xf01b('0x1e')]['message']);}})[_0xf01b('0x1f')](function(_0x56c6c5){logger[_0xf01b('0x1a')](_0xf01b('0x16'),_0x4a3db3,_0x56c6c5);_0x1797e1(_0x56c6c5);});});}function respondWithStatusCode(_0x260ab6,_0x4707a0){_0x4707a0=_0x4707a0||0xcc;return function(_0x492ea8){if(_0x492ea8){return _0x260ab6[_0xf01b('0x20')](_0x4707a0);}return _0x260ab6['status'](_0x4707a0)['end']();};}function respondWithResult(_0x1aeeea,_0x136ffd){_0x136ffd=_0x136ffd||0xc8;return function(_0x591ddc){if(_0x591ddc){return _0x1aeeea[_0xf01b('0x21')](_0x136ffd)[_0xf01b('0x22')](_0x591ddc);}};}function respondWithFilteredResult(_0x3712c4,_0x428b8c){return function(_0x56b025){if(_0x56b025){var _0x2057f6=typeof _0x428b8c[_0xf01b('0x23')]==='undefined'&&typeof _0x428b8c[_0xf01b('0x24')]===_0xf01b('0x25');var _0x1f01e2=_0x56b025[_0xf01b('0x26')];var _0x525377=_0x2057f6?0x0:_0x428b8c[_0xf01b('0x23')];var _0x479c0a=_0x2057f6?_0x56b025['count']:_0x428b8c[_0xf01b('0x23')]+_0x428b8c['limit'];var _0x336ff4;if(_0x479c0a>=_0x1f01e2){_0x479c0a=_0x1f01e2;_0x336ff4=0xc8;}else{_0x336ff4=0xce;}_0x3712c4[_0xf01b('0x21')](_0x336ff4);return _0x3712c4[_0xf01b('0x27')]('Content-Range',_0x525377+'-'+_0x479c0a+'/'+_0x1f01e2)[_0xf01b('0x22')](_0x56b025);}return null;};}function saveUpdates(_0x49b725){return function(_0x1ec6bd){if(_0x1ec6bd){return _0x1ec6bd[_0xf01b('0x28')](_0x49b725)['then'](function(_0x3b9cdf){return _0x3b9cdf;});}return null;};}function removeEntity(_0x21682b){return function(_0x519130){if(_0x519130){return _0x519130[_0xf01b('0x29')]()['then'](function(){_0x21682b[_0xf01b('0x21')](0xcc)[_0xf01b('0x2a')]();});}};}function handleEntityNotFound(_0x1ad074){return function(_0x48395d){if(!_0x48395d){_0x1ad074[_0xf01b('0x20')](0x194);}return _0x48395d;};}function handleError(_0x2f979f,_0x25e50a){_0x25e50a=_0x25e50a||0x1f4;return function(_0x243329){logger[_0xf01b('0x1a')](_0x243329[_0xf01b('0x2b')]);if(_0x243329[_0xf01b('0x2c')]){delete _0x243329['name'];}_0x2f979f[_0xf01b('0x21')](_0x25e50a)[_0xf01b('0x2d')](_0x243329);};}function getMustacheRender(_0x4c990b,_0x13769c){return Mustache[_0xf01b('0x2e')](_0x4c990b,_[_0xf01b('0x2f')](_0x13769c['body'],{'contact':_0x13769c[_0xf01b('0x30')],'message':_0x13769c[_0xf01b('0x1c')],'agent':_0x13769c[_0xf01b('0x31')],'interaction':_0x13769c[_0xf01b('0x32')],'account':_0x13769c[_0xf01b('0x33')]}))||'';}exports[_0xf01b('0x34')]=function(_0x15cfc1,_0x5ab5b8){var _0x9135b1={};var _0x23e7b6=_[_0xf01b('0x35')](db[_0xf01b('0x36')][_0xf01b('0x37')],function(_0x5bbfe3){return{'name':_0x5bbfe3[_0xf01b('0x38')],'type':_0x5bbfe3[_0xf01b('0x39')][_0xf01b('0x3a')]};});_0x9135b1=qs['getOptions'](_0x23e7b6,_0x15cfc1);return interaction[_0xf01b('0x3b')](_0xf01b('0x3c'),_0x15cfc1[_0xf01b('0x3d')],_0x15cfc1[_0xf01b('0x3e')],_0x9135b1,_0x23e7b6)[_0xf01b('0x15')](respondWithFilteredResult(_0x5ab5b8,_0x9135b1))['catch'](handleError(_0x5ab5b8,null));};exports['show']=function(_0x5b1146,_0xe63b6e){var _0x740386={'raw':![],'where':{'id':_0x5b1146[_0xf01b('0x3f')]['id']}},_0x4815b2={};_0x4815b2[_0xf01b('0x40')]=_[_0xf01b('0x41')](db[_0xf01b('0x36')][_0xf01b('0x37')]);_0x4815b2['query']=_[_0xf01b('0x41')](_0x5b1146[_0xf01b('0x3d')]);_0x4815b2[_0xf01b('0x42')]=_['intersection'](_0x4815b2[_0xf01b('0x40')],_0x4815b2['query']);_0x740386[_0xf01b('0x43')]=_[_0xf01b('0x44')](_0x4815b2[_0xf01b('0x40')],qs['fields'](_0x5b1146[_0xf01b('0x3d')]['fields']));_0x740386['attributes']=_0x740386['attributes'][_0xf01b('0x45')]?_0x740386['attributes']:_0x4815b2[_0xf01b('0x40')];if(_0x5b1146[_0xf01b('0x3d')][_0xf01b('0x46')]){_0x740386[_0xf01b('0x47')]=[{'all':!![]}];}_0x740386=_['merge']({},_0x740386,_0x5b1146[_0xf01b('0x48')]);return db[_0xf01b('0x36')][_0xf01b('0x49')](_0x740386)['then'](handleEntityNotFound(_0xe63b6e,null))['then'](respondWithResult(_0xe63b6e,null))['catch'](handleError(_0xe63b6e,null));};exports[_0xf01b('0x4a')]=function(_0x36eecc,_0x53346e){return db['ChatInteraction'][_0xf01b('0x4a')](_0x36eecc[_0xf01b('0x4b')],{})['then'](respondWithResult(_0x53346e,0xc9))['catch'](handleError(_0x53346e,null));};exports[_0xf01b('0x28')]=function(_0xd8ded5,_0x295ac2){if(_0xd8ded5[_0xf01b('0x4b')]['id']){delete _0xd8ded5['body']['id'];}return db[_0xf01b('0x36')][_0xf01b('0x49')]({'where':{'id':_0xd8ded5['params']['id']}})[_0xf01b('0x15')](handleEntityNotFound(_0x295ac2,null))[_0xf01b('0x15')](saveUpdates(_0xd8ded5[_0xf01b('0x4b')],null))[_0xf01b('0x15')](respondWithResult(_0x295ac2,null))[_0xf01b('0x1f')](handleError(_0x295ac2,null));};exports[_0xf01b('0x29')]=function(_0x249a30,_0x5cf6e1){return db[_0xf01b('0x36')][_0xf01b('0x49')]({'where':{'id':_0x249a30['params']['id']}})[_0xf01b('0x15')](handleEntityNotFound(_0x5cf6e1,null))['then'](removeEntity(_0x5cf6e1,null))[_0xf01b('0x1f')](handleError(_0x5cf6e1,null));};exports[_0xf01b('0x4c')]=function(_0xfdae68,_0x372f51){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x372f51,null))['catch'](handleError(_0x372f51,null));};exports[_0xf01b('0x4d')]=function(_0x94c18b,_0x1d8500){var _0x55fe9b=_0x94c18b[_0xf01b('0x3f')]['id'];var _0x3a4562;var _0x480074;var _0x416845;return db[_0xf01b('0x36')][_0xf01b('0x4e')]({'where':{'id':_0x55fe9b}})[_0xf01b('0x15')](function(_0x3259d9){_0x3a4562=_0x3259d9;return db['ChatWebsite'][_0xf01b('0x4e')]({'where':{'id':_0x3259d9[_0xf01b('0x4f')]},'attributes':['id',_0xf01b('0x50'),'vidaooEscalation',_0xf01b('0x51'),_0xf01b('0x52'),_0xf01b('0x53')],'raw':!![]});})[_0xf01b('0x15')](function(_0x134a11){if(_0x134a11&&_0x134a11[_0xf01b('0x50')]&&_0x134a11[_0xf01b('0x54')]){_0x480074=_0x134a11;var _0x32d629={'interaction':{'id':_0x55fe9b},'agent':{'id':_0x94c18b[_0xf01b('0x3e')]['id'],'name':_0x94c18b[_0xf01b('0x3e')][_0xf01b('0x2c')],'fullname':_0x94c18b['user']['fullname'],'email':_0x94c18b['user'][_0xf01b('0x55')]},'contact':_0x94c18b[_0xf01b('0x4b')][_0xf01b('0x30')],'account':_0x94c18b['body'][_0xf01b('0x33')]};var _0x5758e7={'rejectUnauthorized':![],'method':_0xf01b('0x56'),'url':_0xf01b('0x57'),'headers':{'X-APIKEY':_0x134a11[_0xf01b('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x94c18b['user'][_0xf01b('0x55')]],'buttons':null,'topic':_0x480074[_0xf01b('0x51')],'note':_[_0xf01b('0x58')](_0x480074[_0xf01b('0x52')])?null:getMustacheRender(_0x480074['vidaooNote'],_0x32d629),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf01b('0x58')](_0x480074['vidaooMetadata'])){var _0x33744d=getMustacheRender(_0x480074[_0xf01b('0x53')],_0x32d629);var _0x152507=JSON[_0xf01b('0x59')](_0x33744d);_0x5758e7[_0xf01b('0x4b')][_0xf01b('0x5a')]=_0x152507;}}catch(_0xb4650e){throw new db[(_0xf01b('0x5b'))][(_0xf01b('0x5c'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5758e7);}else{throw new db[(_0xf01b('0x5b'))][(_0xf01b('0x5c'))](_0xf01b('0x5d'));}})[_0xf01b('0x15')](function(_0xee4c27){_0x416845=_0xee4c27;if(_0x416845['id']){var _0x245afb={'body':_0x416845['join_url'],'ChatWebsiteId':_0x480074['id'],'ChatInteractionId':_0x3a4562['id'],'direction':_0xf01b('0x5e'),'UserId':_0x94c18b[_0xf01b('0x3e')]['id']};return db[_0xf01b('0x5f')][_0xf01b('0x4a')](_0x245afb,{});}else{throw new db[(_0xf01b('0x5b'))][(_0xf01b('0x5c'))](_0xf01b('0x60'));}})[_0xf01b('0x15')](function(){return _0x3a4562[_0xf01b('0x61')]({'vidaooSessionId':_0x416845['id']});})[_0xf01b('0x15')](respondWithResult(_0x1d8500,null))[_0xf01b('0x1f')](handleError(_0x1d8500,null));};exports[_0xf01b('0x62')]=function(_0xeb042,_0x55c7cb){if(_0xeb042[_0xf01b('0x4b')]['id']){delete _0xeb042[_0xf01b('0x4b')]['id'];}return db[_0xf01b('0x36')]['find']({'where':{'id':_0xeb042[_0xf01b('0x3f')]['id']},'include':[{'model':db[_0xf01b('0x63')],'as':_0xf01b('0x64')}]})[_0xf01b('0x15')](handleEntityNotFound(_0x55c7cb,null))[_0xf01b('0x15')](saveUpdates(_0xeb042[_0xf01b('0x4b')],null))['then'](respondWithResult(_0x55c7cb,null))[_0xf01b('0x1f')](handleError(_0x55c7cb,null));};exports[_0xf01b('0x65')]=function(_0x3aff1a,_0x583e99){if(_0x3aff1a[_0xf01b('0x4b')]['id']){delete _0x3aff1a[_0xf01b('0x4b')]['id'];}return db[_0xf01b('0x36')][_0xf01b('0x49')]({'where':{'id':_0x3aff1a[_0xf01b('0x3f')]['id']}})[_0xf01b('0x15')](function(_0x1137f4){if(!_0x1137f4){logger[_0xf01b('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xf01b('0x66'));_0x583e99[_0xf01b('0x20')](0x194);}else{if(_0x1137f4[_0xf01b('0x67')]){throw new db[(_0xf01b('0x5b'))][(_0xf01b('0x5c'))](_0xf01b('0x68'));}}return _0x1137f4;})['then'](function(_0x552777){if(_0x552777){return _0x552777[_0xf01b('0x28')]({'closed':_0x3aff1a[_0xf01b('0x4b')]['closed'],'disposition':_0x3aff1a[_0xf01b('0x4b')][_0xf01b('0x69')]})[_0xf01b('0x15')](function(_0x57dc39){return _0x57dc39;});}})[_0xf01b('0x15')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3aff1a[_0xf01b('0x4b')],client9004);})['then'](respondWithResult(_0x583e99,null))[_0xf01b('0x1f')](handleError(_0x583e99,null));};exports[_0xf01b('0x6a')]=function(_0x407632,_0x11a179){_0x407632['body'][_0xf01b('0x2c')]=_0x407632[_0xf01b('0x6b')][_0xf01b('0x6c')];_0x407632[_0xf01b('0x4b')][_0xf01b('0x6d')]=_0x407632[_0xf01b('0x6b')][_0xf01b('0x6e')];_0x407632['body'][_0xf01b('0x39')]=_0x407632[_0xf01b('0x6b')]['mimetype'];return db[_0xf01b('0x6f')]['create'](_0x407632['body'])['then'](respondWithResult(_0x11a179,0xc9))[_0xf01b('0x1f')](handleError(_0x11a179,null));};exports['attachmentDownload']=function(_0x2ca1e1,_0x192412){return db[_0xf01b('0x36')][_0xf01b('0x4e')]({'where':{'id':_0x2ca1e1['params']['id']},'raw':!![]})[_0xf01b('0x15')](handleEntityNotFound(_0x192412,null))['then'](function(_0x5d822c){if(_0x5d822c){if(_0x5d822c[_0xf01b('0x70')]){return _0x192412[_0xf01b('0x21')](0x193)[_0xf01b('0x22')]({'status':0x193,'message':_0xf01b('0x71')});}return db[_0xf01b('0x6f')]['findOne']({'where':{'id':_0x2ca1e1[_0xf01b('0x3d')][_0xf01b('0x72')]},'raw':!![]})[_0xf01b('0x15')](handleEntityNotFound(_0x192412,null));}})[_0xf01b('0x15')](function(_0x9da5c){if(_0x9da5c){var _0x39067b=_0x9da5c[_0xf01b('0x73')]!==null;var _0x57e69a=path[_0xf01b('0x74')](config['root'],_0xf01b('0x75'));if(_0x39067b){_0x57e69a=path['join'](_0x57e69a,_0xf01b('0x76'));}var _0x3483a2=path[_0xf01b('0x74')](_0x57e69a,_0x9da5c['basename']);return _0x192412['download'](_0x3483a2);}})[_0xf01b('0x1f')](handleError(_0x192412,null));};exports[_0xf01b('0x77')]=function(_0x31dc6e,_0x25b271){var _0x105558=null;var _0x65dec1=null;var _0x574a16=null;if(_0x31dc6e['body']['id']){delete _0x31dc6e['body']['id'];}if(_0x31dc6e[_0xf01b('0x4b')][_0xf01b('0x78')]){_0x574a16=path['join'](config['root'],_0xf01b('0x79'),util[_0xf01b('0x7a')]('transcript-%s.txt',Date[_0xf01b('0x7b')]()));_0x31dc6e[_0xf01b('0x4b')][_0xf01b('0x7c')]=_0x574a16;}return db['ChatInteraction']['find']({'where':{'id':_0x31dc6e[_0xf01b('0x3f')]['id']},'include':[{'model':db[_0xf01b('0x5f')],'as':_0xf01b('0x7d'),'include':[{'model':db[_0xf01b('0x7e')],'as':_0xf01b('0x7e')}]}]})[_0xf01b('0x15')](handleEntityNotFound(_0x25b271,null))[_0xf01b('0x15')](saveUpdates(_0x31dc6e[_0xf01b('0x4b')],null))['then'](function(_0x1db263){if(_0x1db263){_0x105558=_0x1db263;return db[_0xf01b('0x7f')][_0xf01b('0x49')]({'where':{'id':_0x105558[_0xf01b('0x4f')]}});}})[_0xf01b('0x15')](function(_0x793123){if(_0x793123){_0x65dec1=_0x793123;return db[_0xf01b('0x63')][_0xf01b('0x49')]({'where':{'id':_0x105558[_0xf01b('0x80')]}});}})['then'](function(_0x2307ed){if(_0x2307ed){if(_0x574a16){var _0x34f2dc=null;for(var _0x3eedbe=0x1;_0x3eedbe<_0x105558[_0xf01b('0x7d')][_0xf01b('0x45')];++_0x3eedbe){_0x34f2dc=_0x105558[_0xf01b('0x7d')][_0x3eedbe];var _0x26c1f9=_0x34f2dc[_0xf01b('0x67')]?util['format'](_0xf01b('0x81'),_0x65dec1[_0xf01b('0x82')],_0x34f2dc[_0xf01b('0x67')]):'System';var _0x22f4f2=_0x31dc6e['body'][_0xf01b('0x83')]||util[_0xf01b('0x7a')](_0xf01b('0x81'),_0xf01b('0x84'),_0x34f2dc[_0xf01b('0x80')]);switch(_0x65dec1['agentIdentifier']){case _0xf01b('0x85'):_0x26c1f9=_0x34f2dc[_0xf01b('0x67')]?util[_0xf01b('0x7a')]('%s%d',_0x65dec1[_0xf01b('0x82')],_0x34f2dc['UserId']):_0xf01b('0x86');break;case _0xf01b('0x87'):_0x26c1f9=_0x34f2dc[_0xf01b('0x67')]?_0x34f2dc[_0xf01b('0x7e')][_0xf01b('0x88')]||_0x34f2dc[_0xf01b('0x7e')][_0xf01b('0x89')]:_0xf01b('0x86');break;case _0xf01b('0x8a'):_0x26c1f9=_0x34f2dc[_0xf01b('0x67')]?_0x34f2dc[_0xf01b('0x7e')][_0xf01b('0x89')]:_0xf01b('0x86');break;default:_0x26c1f9=_0x34f2dc['UserId']?util[_0xf01b('0x7a')](_0xf01b('0x81'),_0x65dec1[_0xf01b('0x82')],_0x34f2dc[_0xf01b('0x67')]):_0xf01b('0x86');}var _0x22e79a=util[_0xf01b('0x7a')](_0xf01b('0x8b'),moment(_0x34f2dc[_0xf01b('0x8c')])[_0xf01b('0x7a')]('MM/DD/YYYY\x20HH:mm:ss'),_0x34f2dc[_0xf01b('0x8d')]==='in'?_0x22f4f2:_0x26c1f9,_0x34f2dc[_0xf01b('0x4b')]);if(!_0x34f2dc[_0xf01b('0x8e')]){fs[_0xf01b('0x8f')](_0x574a16,_0x22e79a);}}return db['MailAccount'][_0xf01b('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0xf01b('0x90')],'as':_0xf01b('0x91'),'raw':!![],'include':[{'model':db[_0xf01b('0x92')],'as':_0xf01b('0x92'),'raw':!![]}]}]});}}})[_0xf01b('0x15')](function(_0x1025c5){if(!_0x1025c5||!_0x1025c5[_0xf01b('0x91')]||!_0x31dc6e[_0xf01b('0x4b')])return _0x105558;var _0x289600=_0x1025c5[_0xf01b('0x93')]();return respondWithRpcPromise('SendMail',_0xf01b('0x94'),{'account':_0x289600,'message':{'from':util[_0xf01b('0x7a')](_0xf01b('0x95'),_0x1025c5[_0xf01b('0x2c')],_0x1025c5['email']||_0x1025c5[_0xf01b('0x91')][_0xf01b('0x3e')]),'to':_0x31dc6e[_0xf01b('0x4b')]['mailTranscript'],'subject':_0xf01b('0x96'),'text':util[_0xf01b('0x7a')](_0xf01b('0x97'),_0x31dc6e[_0xf01b('0x4b')]['mailTranscript']),'attachments':[{'path':_0x574a16}]}})[_0xf01b('0x15')](function(){return _0x105558;})[_0xf01b('0x1f')](function(_0x32a7f5){logger[_0xf01b('0x1a')](_0x32a7f5);});})['then'](respondWithStatusCode(_0x25b271,0xc8))[_0xf01b('0x1f')](handleError(_0x25b271,null));};exports[_0xf01b('0x98')]=function(_0x43a175,_0x5a182f){return db[_0xf01b('0x5f')][_0xf01b('0x49')]({'where':{'id':_0x43a175[_0xf01b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5a182f,null))[_0xf01b('0x15')](function(_0x13ed9c){if(_0x13ed9c){return _0x13ed9c['addMessage'](_0x43a175[_0xf01b('0x4b')][_0xf01b('0x99')],_['omit'](_0x43a175['body'],[_0xf01b('0x99'),'id'])||{});}})[_0xf01b('0x15')](respondWithResult(_0x5a182f,null))[_0xf01b('0x1f')](handleError(_0x5a182f,null));};exports[_0xf01b('0x9a')]=function(_0x2a394f,_0xe14557){var _0x5e15bd={'raw':![],'where':{}};var _0x406017={};var _0x2c98ef={'count':0x0,'rows':[]};return db[_0xf01b('0x36')][_0xf01b('0x4e')]({'where':{'id':_0x2a394f[_0xf01b('0x3f')]['id']}})[_0xf01b('0x15')](handleEntityNotFound(_0xe14557,null))[_0xf01b('0x15')](function(_0x178e9a){if(_0x178e9a){_0x406017[_0xf01b('0x40')]=_['keys'](db[_0xf01b('0x5f')][_0xf01b('0x37')]);_0x406017['query']=_[_0xf01b('0x41')](_0x2a394f['query']);_0x406017['filters']=_[_0xf01b('0x44')](_0x406017['model'],_0x406017[_0xf01b('0x3d')]);_0x5e15bd[_0xf01b('0x43')]=_[_0xf01b('0x44')](_0x406017[_0xf01b('0x40')],qs[_0xf01b('0x9b')](_0x2a394f['query'][_0xf01b('0x9b')]));_0x5e15bd[_0xf01b('0x43')]=_0x5e15bd[_0xf01b('0x43')][_0xf01b('0x45')]?_0x5e15bd['attributes']:_0x406017[_0xf01b('0x40')];if(!_0x2a394f[_0xf01b('0x3d')][_0xf01b('0x9c')]('nolimit')){_0x5e15bd[_0xf01b('0x24')]=qs[_0xf01b('0x24')](_0x2a394f[_0xf01b('0x3d')][_0xf01b('0x24')]);_0x5e15bd['offset']=qs[_0xf01b('0x23')](_0x2a394f[_0xf01b('0x3d')][_0xf01b('0x23')]);}_0x5e15bd[_0xf01b('0x9d')]=qs[_0xf01b('0x9e')](_0x2a394f[_0xf01b('0x3d')]['sort']);_0x5e15bd[_0xf01b('0x9f')]=qs[_0xf01b('0x42')](_[_0xf01b('0xa0')](_0x2a394f[_0xf01b('0x3d')],_0x406017[_0xf01b('0x42')]));_0x5e15bd['where'][_0xf01b('0xa1')]=_0x178e9a['id'];if(_0x2a394f[_0xf01b('0x3d')][_0xf01b('0xa2')]){_0x5e15bd[_0xf01b('0x9f')]=_['merge'](_0x5e15bd[_0xf01b('0x9f')],{'$or':_[_0xf01b('0x35')](_0x5e15bd[_0xf01b('0x43')],function(_0x362894){var _0x1b5b93={};_0x1b5b93[_0x362894]={'$like':'%'+_0x2a394f[_0xf01b('0x3d')][_0xf01b('0xa2')]+'%'};return _0x1b5b93;})});}if(_0x2a394f[_0xf01b('0x3d')]['$gte']){var _0xdbe3b3=_0x2a394f[_0xf01b('0x3d')][_0xf01b('0xa3')]['split'](',');var _0x5a0b28={};_0x5a0b28[_0xdbe3b3[0x0]]={'$gte':moment(_0xdbe3b3[0x1])['format'](_0xf01b('0xa4'))};_0x5e15bd[_0xf01b('0x9f')]=_[_0xf01b('0x2f')](_0x5e15bd['where'],_0x5a0b28);}_0x5e15bd=_['merge']({},_0x5e15bd,_0x2a394f[_0xf01b('0x48')]);return db[_0xf01b('0x5f')][_0xf01b('0x26')]({'where':_0x5e15bd[_0xf01b('0x9f')]})[_0xf01b('0x15')](function(_0x411833){_0x2c98ef[_0xf01b('0x26')]=_0x411833;if(_0x2a394f[_0xf01b('0x3d')][_0xf01b('0x46')]){_0x5e15bd['include']=[{'all':!![]}];}return db['ChatMessage'][_0xf01b('0x3b')](_0x5e15bd);})[_0xf01b('0x15')](function(_0x57f6a9){_0x2c98ef[_0xf01b('0xa5')]=_0x57f6a9;return _0x2c98ef;});}})[_0xf01b('0x15')](respondWithFilteredResult(_0xe14557,_0x5e15bd))['catch'](handleError(_0xe14557,null));};exports[_0xf01b('0xa6')]=function(_0x33ae9d,_0x1bf4d7){var _0x22e67a={'where':{}},_0x21184b={},_0x202449={'count':0x0,'rows':[]};return db[_0xf01b('0x36')][_0xf01b('0x4e')]({'where':{'id':_0x33ae9d[_0xf01b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1bf4d7,null))[_0xf01b('0x15')](function(_0x1183f9){if(_0x1183f9){_0x21184b[_0xf01b('0x40')]=_[_0xf01b('0x41')](db[_0xf01b('0x5f')][_0xf01b('0x37')]);_0x21184b[_0xf01b('0x3d')]=_[_0xf01b('0x41')](_0x33ae9d['query']);_0x21184b['filters']=_['intersection'](_0x21184b['model'],_0x21184b[_0xf01b('0x3d')]);_0x22e67a['attributes']=_[_0xf01b('0x44')](_0x21184b[_0xf01b('0x40')],qs['fields'](_0x33ae9d[_0xf01b('0x3d')][_0xf01b('0x9b')]));_0x22e67a[_0xf01b('0x43')]=_0x22e67a[_0xf01b('0x43')][_0xf01b('0x45')]?_0x22e67a[_0xf01b('0x43')]:_0x21184b[_0xf01b('0x40')];if(!_0x33ae9d[_0xf01b('0x3d')]['hasOwnProperty']('nolimit')){_0x22e67a[_0xf01b('0x24')]=qs[_0xf01b('0x24')](_0x33ae9d['query'][_0xf01b('0x24')]);_0x22e67a[_0xf01b('0x23')]=qs[_0xf01b('0x23')](_0x33ae9d[_0xf01b('0x3d')][_0xf01b('0x23')]);}_0x22e67a[_0xf01b('0x9d')]=qs[_0xf01b('0x9e')](_0x33ae9d[_0xf01b('0x3d')][_0xf01b('0x9e')]);_0x22e67a[_0xf01b('0x9f')]=qs[_0xf01b('0x42')](_[_0xf01b('0xa0')](_0x33ae9d[_0xf01b('0x3d')],_0x21184b[_0xf01b('0x42')]));_0x22e67a['where'][_0xf01b('0xa1')]=_0x1183f9['id'];if(_0x33ae9d[_0xf01b('0x3d')][_0xf01b('0xa2')]){_0x22e67a[_0xf01b('0x9f')]=_[_0xf01b('0x2f')](_0x22e67a[_0xf01b('0x9f')],{'$or':_[_0xf01b('0x35')](_0x22e67a[_0xf01b('0x43')],function(_0x30ba9d){var _0x3bbbd3={};_0x3bbbd3[_0x30ba9d]={'$like':'%'+_0x33ae9d[_0xf01b('0x3d')][_0xf01b('0xa2')]+'%'};return _0x3bbbd3;})});}_0x22e67a[_0xf01b('0x9f')][_0xf01b('0x8e')]=![];if(_0x33ae9d['query']['id']){_0x22e67a[_0xf01b('0x9f')]['id']={'$gt':_0x33ae9d[_0xf01b('0x3d')]['id']};}_0x22e67a=_['merge']({},_0x22e67a,_0x33ae9d[_0xf01b('0x48')]);return db[_0xf01b('0x5f')][_0xf01b('0x26')]({'where':_0x22e67a[_0xf01b('0x9f')]})[_0xf01b('0x15')](function(_0xf9df96){_0x202449[_0xf01b('0x26')]=_0xf9df96;_0x22e67a['include']=[];if(_0x33ae9d[_0xf01b('0x3d')]['includeAgent']){_0x22e67a[_0xf01b('0x47')][_0xf01b('0xa7')]({'model':db[_0xf01b('0x7e')],'as':_0xf01b('0x7e'),'attributes':['id',_0xf01b('0x89'),'alias']});}if(_0x33ae9d['query']['includeAll']){_0x22e67a['include']=[{'all':!![]}];}return db[_0xf01b('0x5f')][_0xf01b('0x3b')](_0x22e67a);})['then'](function(_0x2dcea3){_0x202449[_0xf01b('0xa5')]=_0x2dcea3;return _0x202449;});}})[_0xf01b('0x15')](respondWithFilteredResult(_0x1bf4d7,_0x22e67a))[_0xf01b('0x1f')](handleError(_0x1bf4d7,null));};exports[_0xf01b('0xa8')]=function(_0x581b06,_0x662e5){return db[_0xf01b('0x36')][_0xf01b('0x49')]({'where':{'id':_0x581b06[_0xf01b('0x3f')]['id']}})[_0xf01b('0x15')](handleEntityNotFound(_0x662e5,null))[_0xf01b('0x15')](function(_0x4e4702){if(_0x4e4702){return _0x4e4702['setTags'](_0x581b06['body'][_0xf01b('0x99')],_[_0xf01b('0xa9')](_0x581b06[_0xf01b('0x4b')],['ids','id'])||{})[_0xf01b('0xaa')](function(){return db['Tag'][_0xf01b('0x3b')]({'attributes':['id',_0xf01b('0x2c'),_0xf01b('0xab')],'where':{'id':_0x581b06[_0xf01b('0x4b')][_0xf01b('0x99')]}});})['then'](function(_0x59e4d3){socket[_0xf01b('0xac')](_0xf01b('0xad'),{'id':Number(_0x581b06['params']['id']),'tags':_0x59e4d3||[]});return{'id':Number(_0x581b06[_0xf01b('0x3f')]['id']),'tags':_0x59e4d3||[]};});}})[_0xf01b('0x15')](respondWithResult(_0x662e5,null))[_0xf01b('0x1f')](handleError(_0x662e5,null));};exports['removeTags']=function(_0x58a4c7,_0x4885c9){return db['ChatInteraction'][_0xf01b('0x49')]({'where':{'id':_0x58a4c7[_0xf01b('0x3f')]['id']}})[_0xf01b('0x15')](handleEntityNotFound(_0x4885c9,null))[_0xf01b('0x15')](function(_0x1ff9d7){if(_0x1ff9d7){return _0x1ff9d7[_0xf01b('0xae')](_0x58a4c7[_0xf01b('0x3d')]['ids']);}})[_0xf01b('0x15')](respondWithStatusCode(_0x4885c9,null))['catch'](handleError(_0x4885c9,null));};exports['download']=function(_0x2d68cd,_0x1d4ba6){var _0x5425c8=moment()[_0xf01b('0xaf')]()[_0xf01b('0xb0')]();var _0x3a6db2=path[_0xf01b('0x74')](config[_0xf01b('0xb1')],_0xf01b('0xb2'),_0xf01b('0xb3'),_0xf01b('0xb4'));var _0x32e4c9=path['join'](config['root'],_0xf01b('0xb2'),'files',_0xf01b('0xb5'));var _0x21462a=path[_0xf01b('0x74')](_0x3a6db2,_0x5425c8);var _0x258a6e=util['format'](_0xf01b('0xb6'),_0x2d68cd['params']['id'],_0x5425c8);var _0x1e5e3f=path[_0xf01b('0x74')](_0x3a6db2,_0x258a6e);var _0x45f919=[];_0x45f919[_0xf01b('0xa7')]({'model':db[_0xf01b('0x7e')],'as':_0xf01b('0x7e'),'attributes':['id',_0xf01b('0x89')],'raw':!![]});_0x45f919[_0xf01b('0xa7')]({'model':db[_0xf01b('0x63')],'as':_0xf01b('0x64'),'attributes':['id',_0xf01b('0xb7'),_0xf01b('0xb8')],'raw':!![]});if(_0x2d68cd[_0xf01b('0x3d')][_0xf01b('0xb5')]){_0x45f919[_0xf01b('0xa7')]({'model':db['Attachment'],'as':_0xf01b('0x6f'),'raw':!![]});}var _0x54eba6=[{'model':db['ChatMessage'],'as':_0xf01b('0x7d'),'attributes':['id',_0xf01b('0x4b'),'createdAt','direction','secret',_0xf01b('0xb9')],'include':_0x45f919}];_0x54eba6[_0xf01b('0xa7')]({'model':db[_0xf01b('0x7f')],'as':_0xf01b('0xba'),'attributes':['id','name']});_0x54eba6[_0xf01b('0xa7')]({'model':db[_0xf01b('0x7e')],'as':'Owner','attributes':['id','fullname']});return db[_0xf01b('0x36')][_0xf01b('0x49')]({'where':{'id':_0x2d68cd[_0xf01b('0x3f')]['id']},'include':_0x54eba6})[_0xf01b('0x15')](handleEntityNotFound(_0x1d4ba6,null))[_0xf01b('0x15')](function(_0x309aac){if(_0x309aac){var _0x2d69e6=_0x309aac['get']({'plain':!![]});fs[_0xf01b('0xbb')](_0x21462a);var _0xd08f6d={'channel':'Chat','account':_0x2d69e6[_0xf01b('0xba')]['name'],'agent':_0x2d69e6[_0xf01b('0xbc')]?_0x2d69e6['Owner']['fullname']:'N.A.','createdAt':moment(_0x2d69e6[_0xf01b('0x8c')])[_0xf01b('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf01b('0xb0')](),'closedAt':_0x2d69e6[_0xf01b('0x70')]?moment(_0x2d69e6[_0xf01b('0xbd')])['format'](_0xf01b('0xa4'))[_0xf01b('0xb0')]():'','disposition':_0x2d69e6[_0xf01b('0x69')],'chatInfo':{'browser':_0x2d69e6[_0xf01b('0xbe')],'os':_0x2d69e6[_0xf01b('0xbf')],'referer':_0x2d69e6['referer'],'customerIp':_0x2d69e6['customerIp'],'customerPort':_0x2d69e6['customerPort']?_0x2d69e6[_0xf01b('0xc0')]:'N.A.'},'messages':_(_0x2d69e6[_0xf01b('0x7d')])[_0xf01b('0xc1')]()['filter']({'secret':![]})[_0xf01b('0x35')](function(_0x360d5b){if(_0x360d5b[_0xf01b('0x6f')]){var _0x351ca4=path[_0xf01b('0x74')](_0x32e4c9,_0x360d5b[_0xf01b('0x6f')][_0xf01b('0x6d')]);if(fs[_0xf01b('0xc2')](_0x351ca4)){fs[_0xf01b('0xc3')](_0x351ca4)[_0xf01b('0xc4')](fs[_0xf01b('0xc5')](path[_0xf01b('0x74')](_0x21462a,_0x360d5b[_0xf01b('0x6f')][_0xf01b('0x6d')])));}}return{'date':moment(_0x360d5b[_0xf01b('0x8c')])[_0xf01b('0x7a')](_0xf01b('0xa4'))[_0xf01b('0xb0')](),'sender':_0x360d5b['direction']===_0xf01b('0x5e')?_0x360d5b['User']?_0x360d5b[_0xf01b('0x7e')][_0xf01b('0x89')]:_0xf01b('0x86'):_0x360d5b['Contact'][_0xf01b('0xb7')]+(_0x360d5b['Contact'][_0xf01b('0xb8')]?'\x20'+_0x360d5b['Contact'][_0xf01b('0xb8')]:''),'body':_0x360d5b[_0xf01b('0x6f')]?_0x360d5b[_0xf01b('0x6f')][_0xf01b('0x6d')]:_0x360d5b[_0xf01b('0x4b')],'direction':_0x360d5b[_0xf01b('0x8d')]==='out'?'A':'C','secret':_0x360d5b[_0xf01b('0x8e')],'read':_0x360d5b['read'],'attachment':_0x360d5b[_0xf01b('0x6f')]};})[_0xf01b('0xc6')]()};return ejs[_0xf01b('0xc7')](path[_0xf01b('0x74')](config[_0xf01b('0xb1')],'server','views',_0xf01b('0xc8')),{'interaction':_0xd08f6d})[_0xf01b('0x15')](function(_0x3504e2){var _0x578d97=path['join'](_0x21462a,'transcript-'+_0x2d69e6['id']+'-'+_0x5425c8+_0xf01b('0xc9'));var _0x4afd69={'path':_0x578d97,'channel':_0xf01b('0xca'),'interactionId':_0x2d69e6['id']};return pdf[_0xf01b('0xcb')](_0x3504e2,_0x4afd69);})[_0xf01b('0x15')](function(){return new Promise(function(_0x2ecbdc,_0x5bbd17){zipdir(_0x21462a,{'saveTo':_0x1e5e3f},function(_0x25d866,_0x4e63ef){if(_0x25d866)return _0x5bbd17(_0x25d866);return _0x2ecbdc(_0x4e63ef);});})[_0xf01b('0x15')](function(){return new BPromise(function(_0x5e8c1a,_0x1f81d2){rimraf(_0x21462a,function(_0x1f94f8){if(_0x1f94f8)_0x1f81d2(_0x1f94f8);return _0x5e8c1a();});});})['then'](function(){return _0x1d4ba6['download'](_0x1e5e3f,_0x258a6e,function(_0x9daf01){if(_0x9daf01){logger[_0xf01b('0x1a')]('err',_0x9daf01);}else{fs[_0xf01b('0xcc')](_0x1e5e3f);}});});});}else{return _0x1d4ba6[_0xf01b('0x20')](0xc8);}})['catch'](handleError(_0x1d4ba6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c375213..4ba6158 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 _0x3c14=['catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x3c14,0x1f3));var _0x43c1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3c14[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0x43c1('0x0'));var ChatInteraction=require(_0x43c1('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x43c1('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x43c1('0x2')](0x0);var events={'afterCreate':_0x43c1('0x3'),'afterUpdate':_0x43c1('0x4'),'afterDestroy':_0x43c1('0x5')};function emitEvent(_0x288982){return function(_0x197783,_0x203fa9,_0x503962){_0x197783[_0x43c1('0x6')]({'attributes':['id'],'raw':!![]})[_0x43c1('0x7')](function(_0x58d78a){_0x197783[_0x43c1('0x8')]('Users',_0x58d78a[_0x43c1('0x9')](function(_0x2aad79){return{'id':_0x2aad79['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x197783['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43c1('0x7')](function(_0x2024e0){_0x197783[_0x43c1('0x8')](_0x43c1('0xa'),_0x2024e0[_0x43c1('0xb')]);ChatInteractionEvents[_0x43c1('0xc')](_0x288982+':'+_0x197783['id'],_0x197783);ChatInteractionEvents['emit'](_0x288982,_0x197783);_0x503962(null);})[_0x43c1('0xd')](_0x503962(null));};}for(var e in events){if(events[_0x43c1('0xe')](e)){var event=events[e];ChatInteraction[_0x43c1('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x1f1b=['findAll','emit','catch','hasOwnProperty','hook','ChatInteraction','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x1f1b,0x1c5));var _0xb1f1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1f1b[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xb1f1('0x0')];var ChatMessage=require(_0xb1f1('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1f1('0x2'),'afterUpdate':_0xb1f1('0x3'),'afterDestroy':_0xb1f1('0x4')};function emitEvent(_0x28778b){return function(_0x258888,_0x1748f6,_0x18fcda){_0x258888[_0xb1f1('0x5')]({'attributes':['id'],'raw':!![]})[_0xb1f1('0x6')](function(_0x3537c9){_0x258888[_0xb1f1('0x7')](_0xb1f1('0x8'),_0x3537c9['map'](function(_0x4c0324){return{'id':_0x4c0324['id']};}));return ChatMessage[_0xb1f1('0x9')]({'where':{'ChatInteractionId':_0x258888['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3044b2){_0x258888['setDataValue']('unreadMessages',_0x3044b2['length']);ChatInteractionEvents[_0xb1f1('0xa')](_0x28778b+':'+_0x258888['id'],_0x258888);ChatInteractionEvents[_0xb1f1('0xa')](_0x28778b,_0x258888);_0x18fcda(null);})[_0xb1f1('0xb')](_0x18fcda(null));};}for(var e in events){if(events[_0xb1f1('0xc')](e)){var event=events[e];ChatInteraction[_0xb1f1('0xd')](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 4041cd9..baed351 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 _0xf194=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x1ca37b,_0x5a279a){var _0x3cdd9e=function(_0xdbb5ae){while(--_0xdbb5ae){_0x1ca37b['push'](_0x1ca37b['shift']());}};_0x3cdd9e(++_0x5a279a);}(_0xf194,0xdc));var _0x4f19=function(_0x1d1e05,_0x27eaed){_0x1d1e05=_0x1d1e05-0x0;var _0x2f49cf=_0xf194[_0x1d1e05];return _0x2f49cf;};'use strict';var _=require(_0x4f19('0x0'));var util=require('util');var logger=require(_0x4f19('0x1'))(_0x4f19('0x2'));var moment=require(_0x4f19('0x3'));var BPromise=require(_0x4f19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f19('0x5'));var rimraf=require(_0x4f19('0x6'));var config=require(_0x4f19('0x7'));var attributes=require(_0x4f19('0x8'));module['exports']=function(_0x5c8973,_0x4fb25a){return _0x5c8973[_0x4f19('0x9')](_0x4f19('0xa'),attributes,{'tableName':_0x4f19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36fce1,_0x36420b,_0x2ab265){if(_0x36fce1[_0x4f19('0xc')]('closed')){_0x36fce1[_0x4f19('0xd')]=moment()[_0x4f19('0xe')](_0x4f19('0xf'));}_0x2ab265(null,_0x36fce1);}},'charset':_0x4f19('0x10'),'collate':_0x4f19('0x11')});}; \ No newline at end of file +var _0xf586=['api','bluebird','request-promise','rimraf','exports','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf586,0xcf));var _0x6f58=function(_0x17ac5b,_0x1a2d16){_0x17ac5b=_0x17ac5b-0x0;var _0x2dcec9=_0xf586[_0x17ac5b];return _0x2dcec9;};'use strict';var _=require(_0x6f58('0x0'));var util=require(_0x6f58('0x1'));var logger=require(_0x6f58('0x2'))(_0x6f58('0x3'));var moment=require('moment');var BPromise=require(_0x6f58('0x4'));var rp=require(_0x6f58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f58('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x6f58('0x7')]=function(_0x7dd91a,_0x28040f){return _0x7dd91a['define']('ChatInteraction',attributes,{'tableName':_0x6f58('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x316e11,_0x539012,_0x5e4d6b){if(_0x316e11['changed'](_0x6f58('0x9'))){_0x316e11[_0x6f58('0xa')]=moment()[_0x6f58('0xb')](_0x6f58('0xc'));}_0x5e4d6b(null,_0x316e11);}},'charset':_0x6f58('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7ad1de7..66b4722 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 _0x95fa=['omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','body','options','where','attributes','limit','UpdateChatInteraction','debug','AddTagsToChatInteraction','find','ids'];(function(_0x50dcd7,_0x34b6e6){var _0x2d2017=function(_0x1592b0){while(--_0x1592b0){_0x50dcd7['push'](_0x50dcd7['shift']());}};_0x2d2017(++_0x34b6e6);}(_0x95fa,0x143));var _0xa95f=function(_0x828291,_0x576a49){_0x828291=_0x828291-0x0;var _0x306620=_0x95fa[_0x828291];return _0x306620;};'use strict';var _=require('lodash');var util=require(_0xa95f('0x0'));var moment=require(_0xa95f('0x1'));var BPromise=require(_0xa95f('0x2'));var rs=require(_0xa95f('0x3'));var fs=require('fs');var Redis=require(_0xa95f('0x4'));var db=require(_0xa95f('0x5'))['db'];var utils=require(_0xa95f('0x6'));var logger=require(_0xa95f('0x7'))('rpc');var config=require(_0xa95f('0x8'));var jayson=require(_0xa95f('0x9'));var client=jayson[_0xa95f('0xa')][_0xa95f('0xb')]({'port':0x232a});config[_0xa95f('0xc')]=_['defaults'](config[_0xa95f('0xc')],{'host':_0xa95f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa95f('0xc')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x37687c,_0x22b727,_0x34c357){return new BPromise(function(_0x2aee13,_0x5033ae){return client[_0xa95f('0xe')](_0x37687c,_0x34c357)[_0xa95f('0xf')](function(_0x1e97d2){logger[_0xa95f('0x10')](_0xa95f('0x11'),_0x22b727,_0xa95f('0x12'));logger['debug'](_0xa95f('0x13'),_0x22b727,_0xa95f('0x12'),JSON[_0xa95f('0x14')](_0x1e97d2));if(_0x1e97d2[_0xa95f('0x15')]){if(_0x1e97d2['error'][_0xa95f('0x16')]===0x1f4){logger['error'](_0xa95f('0x11'),_0x22b727,_0x1e97d2['error'][_0xa95f('0x17')]);return _0x5033ae(_0x1e97d2[_0xa95f('0x15')][_0xa95f('0x17')]);}logger[_0xa95f('0x15')](_0xa95f('0x11'),_0x22b727,_0x1e97d2[_0xa95f('0x15')][_0xa95f('0x17')]);return _0x2aee13(_0x1e97d2[_0xa95f('0x15')]['message']);}else{logger[_0xa95f('0x10')](_0xa95f('0x11'),_0x22b727,_0xa95f('0x12'));_0x2aee13(_0x1e97d2[_0xa95f('0x18')][_0xa95f('0x17')]);}})[_0xa95f('0x19')](function(_0x26c06a){logger[_0xa95f('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x22b727,_0x26c06a);_0x5033ae(_0x26c06a);});});}exports['UpdateChatInteraction']=function(_0x30d197){var _0xbcb447=this;return new Promise(function(_0x19b6ec,_0x3cbb85){return db[_0xa95f('0x1a')]['update'](_0x30d197[_0xa95f('0x1b')],{'raw':_0x30d197['options']?_0x30d197[_0xa95f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d197['options']?_0x30d197[_0xa95f('0x1c')][_0xa95f('0x1d')]||null:null,'attributes':_0x30d197[_0xa95f('0x1c')]?_0x30d197[_0xa95f('0x1c')][_0xa95f('0x1e')]||null:null,'limit':_0x30d197[_0xa95f('0x1c')]?_0x30d197[_0xa95f('0x1c')][_0xa95f('0x1f')]||null:null})[_0xa95f('0xf')](function(_0x240e44){logger[_0xa95f('0x10')](_0xa95f('0x20'),_0x30d197);logger[_0xa95f('0x21')](_0xa95f('0x20'),_0x30d197,JSON[_0xa95f('0x14')](_0x240e44));_0x19b6ec(_0x240e44);})[_0xa95f('0x19')](function(_0x241d9f){logger[_0xa95f('0x15')](_0xa95f('0x20'),_0x241d9f['message'],_0x30d197);_0x3cbb85(_0xbcb447[_0xa95f('0x15')](0x1f4,_0x241d9f[_0xa95f('0x17')]));});});};exports[_0xa95f('0x22')]=function(_0x3032aa){return new Promise(function(_0x2a328d,_0x3b0e2c){return db[_0xa95f('0x1a')][_0xa95f('0x23')]({'where':_0x3032aa[_0xa95f('0x1c')]?_0x3032aa['options'][_0xa95f('0x1d')]||null:null})[_0xa95f('0xf')](function(_0x540342){if(_0x540342){return _0x540342['addTags'](_0x3032aa[_0xa95f('0x1b')][_0xa95f('0x24')],_[_0xa95f('0x25')](_0x3032aa[_0xa95f('0x1b')],['ids','id'])||{});}})[_0xa95f('0x26')](function(_0x3a9d55){logger[_0xa95f('0x10')](_0xa95f('0x27'),_0x3032aa);logger[_0xa95f('0x21')](_0xa95f('0x27'),_0x3032aa,JSON[_0xa95f('0x14')](_0x3a9d55));_0x2a328d(_0x3a9d55);})[_0xa95f('0x19')](function(_0x2d2f62){logger[_0xa95f('0x15')](_0xa95f('0x27'),_0x2d2f62[_0xa95f('0x17')],_0x3032aa);_0x3b0e2c(_this[_0xa95f('0x15')](0x1f4,_0x2d2f62[_0xa95f('0x17')]));});});}; \ No newline at end of file +var _0x6398=['addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','limit','then'];(function(_0x14c022,_0x247c53){var _0x1d9b68=function(_0xf09d10){while(--_0xf09d10){_0x14c022['push'](_0x14c022['shift']());}};_0x1d9b68(++_0x247c53);}(_0x6398,0x195));var _0x8639=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x6398[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0x8639('0x0'));var util=require(_0x8639('0x1'));var moment=require(_0x8639('0x2'));var BPromise=require(_0x8639('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8639('0x4'));var db=require(_0x8639('0x5'))['db'];var utils=require(_0x8639('0x6'));var logger=require('../../config/logger')(_0x8639('0x7'));var config=require(_0x8639('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8639('0x9')][_0x8639('0xa')]({'port':0x232a});config['redis']=_[_0x8639('0xb')](config[_0x8639('0xc')],{'host':_0x8639('0xd'),'port':0x18eb});var socket=require(_0x8639('0xe'))(new Redis(config[_0x8639('0xc')]));require(_0x8639('0xf'))['register'](socket);function respondWithRpcPromise(_0x27bc24,_0x184d97,_0x51e1ae){return new BPromise(function(_0x44ff77,_0x27b6e2){return client[_0x8639('0x10')](_0x27bc24,_0x51e1ae)['then'](function(_0x527ef8){logger[_0x8639('0x11')](_0x8639('0x12'),_0x184d97,_0x8639('0x13'));logger[_0x8639('0x14')](_0x8639('0x15'),_0x184d97,'request\x20sent',JSON[_0x8639('0x16')](_0x527ef8));if(_0x527ef8[_0x8639('0x17')]){if(_0x527ef8[_0x8639('0x17')]['code']===0x1f4){logger[_0x8639('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x184d97,_0x527ef8[_0x8639('0x17')][_0x8639('0x18')]);return _0x27b6e2(_0x527ef8[_0x8639('0x17')][_0x8639('0x18')]);}logger[_0x8639('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x184d97,_0x527ef8[_0x8639('0x17')]['message']);return _0x44ff77(_0x527ef8[_0x8639('0x17')][_0x8639('0x18')]);}else{logger[_0x8639('0x11')](_0x8639('0x12'),_0x184d97,_0x8639('0x13'));_0x44ff77(_0x527ef8[_0x8639('0x19')][_0x8639('0x18')]);}})[_0x8639('0x1a')](function(_0x265568){logger[_0x8639('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x184d97,_0x265568);_0x27b6e2(_0x265568);});});}exports[_0x8639('0x1b')]=function(_0x5828c7){var _0x5c3735=this;return new Promise(function(_0x530dcb,_0x2c896d){return db[_0x8639('0x1c')]['update'](_0x5828c7[_0x8639('0x1d')],{'raw':_0x5828c7[_0x8639('0x1e')]?_0x5828c7[_0x8639('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5828c7[_0x8639('0x1e')]?_0x5828c7[_0x8639('0x1e')][_0x8639('0x1f')]||null:null,'attributes':_0x5828c7[_0x8639('0x1e')]?_0x5828c7['options'][_0x8639('0x20')]||null:null,'limit':_0x5828c7[_0x8639('0x1e')]?_0x5828c7[_0x8639('0x1e')][_0x8639('0x21')]||null:null})[_0x8639('0x22')](function(_0x5c1b10){logger[_0x8639('0x11')](_0x8639('0x1b'),_0x5828c7);logger[_0x8639('0x14')](_0x8639('0x1b'),_0x5828c7,JSON[_0x8639('0x16')](_0x5c1b10));_0x530dcb(_0x5c1b10);})['catch'](function(_0x438b1d){logger['error']('UpdateChatInteraction',_0x438b1d[_0x8639('0x18')],_0x5828c7);_0x2c896d(_0x5c3735[_0x8639('0x17')](0x1f4,_0x438b1d['message']));});});};exports['AddTagsToChatInteraction']=function(_0x4acfd9){return new Promise(function(_0x1fb072,_0x540e46){return db[_0x8639('0x1c')]['find']({'where':_0x4acfd9[_0x8639('0x1e')]?_0x4acfd9['options'][_0x8639('0x1f')]||null:null})[_0x8639('0x22')](function(_0x4a969a){if(_0x4a969a){return _0x4a969a[_0x8639('0x23')](_0x4acfd9[_0x8639('0x1d')][_0x8639('0x24')],_[_0x8639('0x25')](_0x4acfd9[_0x8639('0x1d')],[_0x8639('0x24'),'id'])||{});}})[_0x8639('0x26')](function(_0x361469){logger[_0x8639('0x11')](_0x8639('0x27'),_0x4acfd9);logger[_0x8639('0x14')](_0x8639('0x27'),_0x4acfd9,JSON['stringify'](_0x361469));_0x1fb072(_0x361469);})[_0x8639('0x1a')](function(_0xc69dc){logger['error'](_0x8639('0x27'),_0xc69dc[_0x8639('0x18')],_0x4acfd9);_0x540e46(_this[_0x8639('0x17')](0x1f4,_0xc69dc[_0x8639('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 277cba0..e4f3f2c 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 _0x46f4=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x46f4,0x115));var _0x446f=function(_0x1d07ab,_0x22f50f){_0x1d07ab=_0x1d07ab-0x0;var _0x572ce3=_0x46f4[_0x1d07ab];return _0x572ce3;};'use strict';var ChatInteractionEvents=require(_0x446f('0x0'));var events=[_0x446f('0x1'),_0x446f('0x2'),_0x446f('0x3')];function createListener(_0x411989,_0xf8e0e4){return function(_0x5064f0){_0xf8e0e4[_0x446f('0x4')](_0x411989,_0x5064f0);};}function removeListener(_0x47f9d0,_0x4b5d43){return function(){ChatInteractionEvents[_0x446f('0x5')](_0x47f9d0,_0x4b5d43);};}exports['register']=function(_0xb6054){for(var _0x3c822c=0x0,_0x2e1761=events[_0x446f('0x6')];_0x3c822c<_0x2e1761;_0x3c822c++){var _0x14b76f=events[_0x3c822c];var _0xce5535=createListener(_0x446f('0x7')+_0x14b76f,_0xb6054);ChatInteractionEvents['on'](_0x14b76f,_0xce5535);}}; \ No newline at end of file +var _0xe4b6=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener','register'];(function(_0x114b46,_0x4a838e){var _0x16149f=function(_0x5a68bd){while(--_0x5a68bd){_0x114b46['push'](_0x114b46['shift']());}};_0x16149f(++_0x4a838e);}(_0xe4b6,0xfa));var _0x6e4b=function(_0x2fda4b,_0x27f574){_0x2fda4b=_0x2fda4b-0x0;var _0x14061e=_0xe4b6[_0x2fda4b];return _0x14061e;};'use strict';var ChatInteractionEvents=require(_0x6e4b('0x0'));var events=[_0x6e4b('0x1'),_0x6e4b('0x2'),'update'];function createListener(_0x2830e4,_0x29be83){return function(_0x4432b6){_0x29be83[_0x6e4b('0x3')](_0x2830e4,_0x4432b6);};}function removeListener(_0x14d9e1,_0x2fa14d){return function(){ChatInteractionEvents[_0x6e4b('0x4')](_0x14d9e1,_0x2fa14d);};}exports[_0x6e4b('0x5')]=function(_0x4cb969){for(var _0x48be7d=0x0,_0x1e29ba=events[_0x6e4b('0x6')];_0x48be7d<_0x1e29ba;_0x48be7d++){var _0x392cf5=events[_0x48be7d];var _0x1c2484=createListener(_0x6e4b('0x7')+_0x392cf5,_0x4cb969);ChatInteractionEvents['on'](_0x392cf5,_0x1c2484);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2e911e7..9e98a48 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 _0x3f41=['show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','originalname','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized'];(function(_0x38f0fe,_0xebf141){var _0x9ace4a=function(_0x30bb5b){while(--_0x30bb5b){_0x38f0fe['push'](_0x38f0fe['shift']());}};_0x9ace4a(++_0xebf141);}(_0x3f41,0xa3));var _0x13f4=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x3f41[_0x39e283];return _0x7de89f;};'use strict';var multer=require('multer');var util=require(_0x13f4('0x0'));var path=require(_0x13f4('0x1'));var timeout=require(_0x13f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x13f4('0x3'));var auth=require(_0x13f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x13f4('0x5'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x13f4('0x6')](),controller[_0x13f4('0x7')]);router['get'](_0x13f4('0x8'),auth['isAuthenticated'](),controller[_0x13f4('0x9')]);router[_0x13f4('0xa')](_0x13f4('0xb'),auth[_0x13f4('0xc')](),controller[_0x13f4('0xd')]);router['get'](_0x13f4('0xe'),auth[_0x13f4('0xc')](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0x13f4('0x6')](),controller[_0x13f4('0xf')]);router[_0x13f4('0xa')](_0x13f4('0x10'),auth[_0x13f4('0xc')](),controller[_0x13f4('0x11')]);router[_0x13f4('0xa')](_0x13f4('0x12'),auth[_0x13f4('0x6')](),controller['download']);router[_0x13f4('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x13f4('0x13')](_0x13f4('0x14'),auth['isAuthenticated'](),controller[_0x13f4('0x15')]);var upload=multer({'storage':multer[_0x13f4('0x16')]({'destination':function(_0x1ca8da,_0x198889,_0x1f17f3){_0x1f17f3(null,path[_0x13f4('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x2d2cbe,_0x609c58,_0x36356e){_0x36356e(null,util['format'](_0x13f4('0x18'),Date['now'](),_0x609c58[_0x13f4('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x13f4('0x13')]('/:id/attachment_upload',upload[_0x13f4('0x1a')](_0x13f4('0x1b')),controller[_0x13f4('0x1c')]);router[_0x13f4('0x13')](_0x13f4('0x1d'),auth[_0x13f4('0xc')](),controller[_0x13f4('0x1e')]);router[_0x13f4('0x13')](_0x13f4('0x1f'),auth[_0x13f4('0x6')](),interaction[_0x13f4('0x20')](_0x13f4('0x21'),'chatinteraction:addtags'),controller[_0x13f4('0x22')]);router[_0x13f4('0x23')](_0x13f4('0xb'),auth[_0x13f4('0x6')](),interaction[_0x13f4('0x20')](_0x13f4('0x21'),_0x13f4('0x24')),controller[_0x13f4('0x25')]);router[_0x13f4('0x23')]('/:id/custom_update',controller[_0x13f4('0x26')]);router[_0x13f4('0x23')](_0x13f4('0x27'),auth[_0x13f4('0xc')](),controller[_0x13f4('0x28')]);router[_0x13f4('0x23')]('/:id/close',controller[_0x13f4('0x29')]);router[_0x13f4('0x2a')](_0x13f4('0xb'),auth['isAuthenticated'](),interaction[_0x13f4('0x20')](_0x13f4('0x21'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0x13f4('0x1f'),auth[_0x13f4('0x6')](),controller['removeTags']);module[_0x13f4('0x2b')]=router; \ No newline at end of file +var _0x691d=['../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','post','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x691d,0x179));var _0xd691=function(_0x2cc9a0,_0x1c456d){_0x2cc9a0=_0x2cc9a0-0x0;var _0x15d5b2=_0x691d[_0x2cc9a0];return _0x15d5b2;};'use strict';var multer=require(_0xd691('0x0'));var util=require(_0xd691('0x1'));var path=require(_0xd691('0x2'));var timeout=require(_0xd691('0x3'));var express=require(_0xd691('0x4'));var router=express['Router']();var fs_extra=require(_0xd691('0x5'));var auth=require(_0xd691('0x6'));var interaction=require(_0xd691('0x7'));var config=require(_0xd691('0x8'));var controller=require(_0xd691('0x9'));router[_0xd691('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd691('0xa')]('/describe',auth[_0xd691('0xb')](),controller[_0xd691('0xc')]);router['get'](_0xd691('0xd'),auth[_0xd691('0xe')](),controller[_0xd691('0xf')]);router[_0xd691('0xa')](_0xd691('0x10'),auth[_0xd691('0xe')](),controller[_0xd691('0x11')]);router[_0xd691('0xa')](_0xd691('0x12'),auth[_0xd691('0xb')](),controller[_0xd691('0x13')]);router['get']('/:id/my_messages',auth[_0xd691('0xe')](),controller[_0xd691('0x14')]);router[_0xd691('0xa')](_0xd691('0x15'),auth[_0xd691('0xb')](),controller[_0xd691('0x16')]);router['post']('/',auth[_0xd691('0xb')](),controller[_0xd691('0x17')]);router[_0xd691('0x18')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xd691('0x19')]);var upload=multer({'storage':multer[_0xd691('0x1a')]({'destination':function(_0x2f330a,_0x4d45a2,_0x55523c){_0x55523c(null,path['join'](config[_0xd691('0x1b')],_0xd691('0x1c')));},'filename':function(_0x5c5771,_0x1c76c3,_0x46269b){_0x46269b(null,util[_0xd691('0x1d')](_0xd691('0x1e'),Date[_0xd691('0x1f')](),_0x1c76c3[_0xd691('0x20')][_0xd691('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd691('0x18')](_0xd691('0x22'),upload[_0xd691('0x23')](_0xd691('0x24')),controller[_0xd691('0x25')]);router['post'](_0xd691('0x12'),auth[_0xd691('0xe')](),controller['addMessage']);router[_0xd691('0x18')](_0xd691('0x26'),auth[_0xd691('0xb')](),interaction[_0xd691('0x27')]('chat',_0xd691('0x28')),controller[_0xd691('0x29')]);router['put'](_0xd691('0xd'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xd691('0x2a')),controller[_0xd691('0x2b')]);router[_0xd691('0x2c')](_0xd691('0x2d'),controller[_0xd691('0x2e')]);router[_0xd691('0x2c')](_0xd691('0x2f'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xd691('0x2c')](_0xd691('0x30'),controller[_0xd691('0x31')]);router[_0xd691('0x32')](_0xd691('0xd'),auth[_0xd691('0xb')](),interaction['tracked']('chat',_0xd691('0x33')),controller[_0xd691('0x34')]);router[_0xd691('0x32')]('/:id/tags',auth[_0xd691('0xb')](),controller[_0xd691('0x35')]);module[_0xd691('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7c9d76d..16b7feb 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 _0x07ca=['exports','TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x3695fe,_0x47bd31){var _0x42fbdd=function(_0x23ec1a){while(--_0x23ec1a){_0x3695fe['push'](_0x3695fe['shift']());}};_0x42fbdd(++_0x47bd31);}(_0x07ca,0x18f));var _0xa07c=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x07ca[_0x5180c3];return _0x55c975;};'use strict';var Sequelize=require(_0xa07c('0x0'));module[_0xa07c('0x1')]={'body':{'type':Sequelize[_0xa07c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa07c('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa07c('0x4')]}}; \ No newline at end of file +var _0x56c0=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x23b2fe,_0x35f7b7){var _0x406050=function(_0x462fa6){while(--_0x462fa6){_0x23b2fe['push'](_0x23b2fe['shift']());}};_0x406050(++_0x35f7b7);}(_0x56c0,0x1c4));var _0x056c=function(_0x4af561,_0x3c8193){_0x4af561=_0x4af561-0x0;var _0x53b587=_0x56c0[_0x4af561];return _0x53b587;};'use strict';var Sequelize=require(_0x056c('0x0'));module[_0x056c('0x1')]={'body':{'type':Sequelize[_0x056c('0x2')](_0x056c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x056c('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x056c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a777912..9980917 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 _0x1e9f=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','ChatInternalMessage','includeAll','findAll','catch','keys','include','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','user','role','userpic','internal','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','length','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xc1c4,_0x1e9763){var _0x3b83a4=function(_0x546e81){while(--_0x546e81){_0xc1c4['push'](_0xc1c4['shift']());}};_0x3b83a4(++_0x1e9763);}(_0x1e9f,0x140));var _0xf1e9=function(_0x245b3b,_0x161dff){_0x245b3b=_0x245b3b-0x0;var _0x249d89=_0x1e9f[_0x245b3b];return _0x249d89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1e9('0x0'));var zipdir=require(_0xf1e9('0x1'));var jsonpatch=require(_0xf1e9('0x2'));var rp=require(_0xf1e9('0x3'));var moment=require(_0xf1e9('0x4'));var BPromise=require(_0xf1e9('0x5'));var Mustache=require('mustache');var util=require(_0xf1e9('0x6'));var path=require(_0xf1e9('0x7'));var sox=require(_0xf1e9('0x8'));var csv=require(_0xf1e9('0x9'));var ejs=require(_0xf1e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1e9('0xb'));var squel=require(_0xf1e9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1e9('0xd'));var toCsv=require(_0xf1e9('0x9'));var querystring=require('querystring');var Papa=require(_0xf1e9('0xe'));var Redis=require(_0xf1e9('0xf'));var authService=require(_0xf1e9('0x10'));var qs=require(_0xf1e9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1e9('0x12'));var logger=require(_0xf1e9('0x13'))(_0xf1e9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf1e9('0x15'));var db=require(_0xf1e9('0x16'))['db'];config[_0xf1e9('0x17')]=_[_0xf1e9('0x18')](config[_0xf1e9('0x17')],{'host':_0xf1e9('0x19'),'port':0x18eb});var socket=require(_0xf1e9('0x1a'))(new Redis(config[_0xf1e9('0x17')]));require(_0xf1e9('0x1b'))[_0xf1e9('0x1c')](socket);function respondWithStatusCode(_0x568af4,_0x244c63){_0x244c63=_0x244c63||0xcc;return function(_0x35c442){if(_0x35c442){return _0x568af4[_0xf1e9('0x1d')](_0x244c63);}return _0x568af4['status'](_0x244c63)[_0xf1e9('0x1e')]();};}function respondWithResult(_0x40a3b0,_0x117c7f){_0x117c7f=_0x117c7f||0xc8;return function(_0x1cc778){if(_0x1cc778){return _0x40a3b0[_0xf1e9('0x1f')](_0x117c7f)[_0xf1e9('0x20')](_0x1cc778);}};}function respondWithFilteredResult(_0x53e3db,_0x4bf6b6){return function(_0x54312f){if(_0x54312f){var _0x5348e3=typeof _0x4bf6b6[_0xf1e9('0x21')]===_0xf1e9('0x22')&&typeof _0x4bf6b6[_0xf1e9('0x23')]===_0xf1e9('0x22');var _0x1f5239=_0x54312f[_0xf1e9('0x24')];var _0x5ecf23=_0x5348e3?0x0:_0x4bf6b6[_0xf1e9('0x21')];var _0x43b7d0=_0x5348e3?_0x54312f[_0xf1e9('0x24')]:_0x4bf6b6[_0xf1e9('0x21')]+_0x4bf6b6[_0xf1e9('0x23')];var _0x59790e;if(_0x43b7d0>=_0x1f5239){_0x43b7d0=_0x1f5239;_0x59790e=0xc8;}else{_0x59790e=0xce;}_0x53e3db[_0xf1e9('0x1f')](_0x59790e);return _0x53e3db['set']('Content-Range',_0x5ecf23+'-'+_0x43b7d0+'/'+_0x1f5239)[_0xf1e9('0x20')](_0x54312f);}return null;};}function patchUpdates(_0x5169d7){return function(_0x8819dd){try{jsonpatch[_0xf1e9('0x25')](_0x8819dd,_0x5169d7,!![]);}catch(_0x46640b){return BPromise[_0xf1e9('0x26')](_0x46640b);}return _0x8819dd[_0xf1e9('0x27')]();};}function saveUpdates(_0x4b77c2,_0x180b8d){return function(_0x321874){if(_0x321874){return _0x321874[_0xf1e9('0x28')](_0x4b77c2)['then'](function(_0x37744b){return _0x37744b;});}return null;};}function removeEntity(_0x4919c8,_0x414be1){return function(_0x50c83e){if(_0x50c83e){return _0x50c83e[_0xf1e9('0x29')]()[_0xf1e9('0x2a')](function(){_0x4919c8[_0xf1e9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a00e7,_0x423b1e){return function(_0x3879d9){if(!_0x3879d9){_0x4a00e7['sendStatus'](0x194);}return _0x3879d9;};}function handleError(_0x240b50,_0x3f516e){_0x3f516e=_0x3f516e||0x1f4;return function(_0x48211b){logger[_0xf1e9('0x2b')](_0x48211b['stack']);if(_0x48211b[_0xf1e9('0x2c')]){delete _0x48211b[_0xf1e9('0x2c')];}_0x240b50['status'](_0x3f516e)[_0xf1e9('0x2d')](_0x48211b);};}exports[_0xf1e9('0x2e')]=function(_0x2d1b93,_0x443ad4){var _0x47ec95={},_0x3ca6e6={},_0x51a4c7={'count':0x0,'rows':[]};var _0x4676c5=_['map'](db['ChatInternalMessage'][_0xf1e9('0x2f')],function(_0x2dfde0){return{'name':_0x2dfde0[_0xf1e9('0x30')],'type':_0x2dfde0[_0xf1e9('0x31')][_0xf1e9('0x32')]};});_0x3ca6e6[_0xf1e9('0x33')]=_[_0xf1e9('0x34')](_0x4676c5,_0xf1e9('0x2c'));_0x3ca6e6[_0xf1e9('0x35')]=_['keys'](_0x2d1b93[_0xf1e9('0x35')]);_0x3ca6e6[_0xf1e9('0x36')]=_[_0xf1e9('0x37')](_0x3ca6e6['model'],_0x3ca6e6[_0xf1e9('0x35')]);_0x47ec95['attributes']=_[_0xf1e9('0x37')](_0x3ca6e6[_0xf1e9('0x33')],qs['fields'](_0x2d1b93[_0xf1e9('0x35')][_0xf1e9('0x38')]));_0x47ec95['attributes']=_0x47ec95[_0xf1e9('0x39')]['length']?_0x47ec95[_0xf1e9('0x39')]:_0x3ca6e6[_0xf1e9('0x33')];if(!_0x2d1b93['query'][_0xf1e9('0x3a')](_0xf1e9('0x3b'))){_0x47ec95[_0xf1e9('0x23')]=qs[_0xf1e9('0x23')](_0x2d1b93[_0xf1e9('0x35')][_0xf1e9('0x23')]);_0x47ec95[_0xf1e9('0x21')]=qs[_0xf1e9('0x21')](_0x2d1b93[_0xf1e9('0x35')][_0xf1e9('0x21')]);}_0x47ec95[_0xf1e9('0x3c')]=qs[_0xf1e9('0x3d')](_0x2d1b93[_0xf1e9('0x35')]['sort']);_0x47ec95['where']=qs[_0xf1e9('0x36')](_['pick'](_0x2d1b93[_0xf1e9('0x35')],_0x3ca6e6[_0xf1e9('0x36')]),_0x4676c5);if(_0x2d1b93[_0xf1e9('0x35')][_0xf1e9('0x3e')]){_0x47ec95['where']=_['merge'](_0x47ec95[_0xf1e9('0x3f')],{'$or':_[_0xf1e9('0x34')](_0x4676c5,function(_0x2b1a63){if(_0x2b1a63[_0xf1e9('0x31')]!==_0xf1e9('0x40')){var _0x5eb5df={};_0x5eb5df[_0x2b1a63['name']]={'$like':'%'+_0x2d1b93[_0xf1e9('0x35')][_0xf1e9('0x3e')]+'%'};return _0x5eb5df;}})});}_0x47ec95=_[_0xf1e9('0x41')]({},_0x47ec95,_0x2d1b93[_0xf1e9('0x42')]);var _0x68a24c={'where':_0x47ec95[_0xf1e9('0x3f')]};return db[_0xf1e9('0x43')][_0xf1e9('0x24')](_0x68a24c)[_0xf1e9('0x2a')](function(_0x37784c){_0x51a4c7[_0xf1e9('0x24')]=_0x37784c;if(_0x2d1b93['query'][_0xf1e9('0x44')]){_0x47ec95['include']=[{'all':!![]}];}return db[_0xf1e9('0x43')][_0xf1e9('0x45')](_0x47ec95);})[_0xf1e9('0x2a')](function(_0x1ca10d){_0x51a4c7['rows']=_0x1ca10d;return _0x51a4c7;})[_0xf1e9('0x2a')](respondWithFilteredResult(_0x443ad4,_0x47ec95))[_0xf1e9('0x46')](handleError(_0x443ad4,null));};exports['show']=function(_0x34929e,_0x3c21d5){var _0x380a02={'raw':!![],'where':{'id':_0x34929e['params']['id']}},_0x3f8dee={};_0x3f8dee['model']=_[_0xf1e9('0x47')](db[_0xf1e9('0x43')][_0xf1e9('0x2f')]);_0x3f8dee[_0xf1e9('0x35')]=_[_0xf1e9('0x47')](_0x34929e[_0xf1e9('0x35')]);_0x3f8dee[_0xf1e9('0x36')]=_[_0xf1e9('0x37')](_0x3f8dee[_0xf1e9('0x33')],_0x3f8dee[_0xf1e9('0x35')]);_0x380a02[_0xf1e9('0x39')]=_['intersection'](_0x3f8dee[_0xf1e9('0x33')],qs['fields'](_0x34929e['query'][_0xf1e9('0x38')]));_0x380a02[_0xf1e9('0x39')]=_0x380a02[_0xf1e9('0x39')]['length']?_0x380a02[_0xf1e9('0x39')]:_0x3f8dee[_0xf1e9('0x33')];if(_0x34929e['query'][_0xf1e9('0x44')]){_0x380a02[_0xf1e9('0x48')]=[{'all':!![]}];}_0x380a02=_[_0xf1e9('0x41')]({},_0x380a02,_0x34929e[_0xf1e9('0x42')]);return db[_0xf1e9('0x43')][_0xf1e9('0x49')](_0x380a02)[_0xf1e9('0x2a')](handleEntityNotFound(_0x3c21d5,null))['then'](respondWithResult(_0x3c21d5,null))['catch'](handleError(_0x3c21d5,null));};exports[_0xf1e9('0x4a')]=function(_0x4c3d43,_0x5e5a7b){return db[_0xf1e9('0x43')][_0xf1e9('0x4a')](_0x4c3d43[_0xf1e9('0x4b')],{})[_0xf1e9('0x2a')](respondWithResult(_0x5e5a7b,0xc9))[_0xf1e9('0x46')](handleError(_0x5e5a7b,null));};exports['update']=function(_0x332af4,_0x1f6522){if(_0x332af4[_0xf1e9('0x4b')]['id']){delete _0x332af4[_0xf1e9('0x4b')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x332af4[_0xf1e9('0x4c')]['id']}})[_0xf1e9('0x2a')](handleEntityNotFound(_0x1f6522,null))[_0xf1e9('0x2a')](saveUpdates(_0x332af4[_0xf1e9('0x4b')],null))[_0xf1e9('0x2a')](respondWithResult(_0x1f6522,null))[_0xf1e9('0x46')](handleError(_0x1f6522,null));};exports[_0xf1e9('0x29')]=function(_0x55bee9,_0x5990c7){return db[_0xf1e9('0x43')]['find']({'where':{'id':_0x55bee9[_0xf1e9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5990c7,null))[_0xf1e9('0x2a')](removeEntity(_0x5990c7,null))[_0xf1e9('0x46')](handleError(_0x5990c7,null));};exports[_0xf1e9('0x4d')]=function(_0x5f2f75,_0x3fd160){return db[_0xf1e9('0x43')][_0xf1e9('0x4d')]()[_0xf1e9('0x2a')](respondWithResult(_0x3fd160,null))[_0xf1e9('0x46')](handleError(_0x3fd160,null));};function wrapUser(_0x2ddc8b){return function(_0x17f759){var _0x2aebb0=_0x2ddc8b[_0xf1e9('0x4e')]({'plain':!![]});_0x2aebb0[_0xf1e9('0x4f')]=[];if(_0x17f759){_0x2aebb0[_0xf1e9('0x50')]=_0x17f759[_0xf1e9('0x51')];_0x2aebb0['lastMessage']=_0x17f759;}else{_0x2aebb0[_0xf1e9('0x50')]=moment(0x0)[_0xf1e9('0x52')](_0xf1e9('0x53'));_0x2aebb0[_0xf1e9('0x54')]={};}return _0x2aebb0;};}exports[_0xf1e9('0x55')]=function(_0x48ee7a,_0x44e890,_0x12cb39){var _0x5bc962=[];return db[_0xf1e9('0x56')]['findAll']({'where':{'role':[_0xf1e9('0x57'),'admin',_0xf1e9('0x58')]},'attributes':['id','fullname',_0xf1e9('0x2c'),_0xf1e9('0x59'),_0xf1e9('0x5a'),_0xf1e9('0x5b'),'online',_0xf1e9('0x5c'),'allowmessenger',_0xf1e9('0x5d')],'order':qs[_0xf1e9('0x3d')]('-online'),'include':[{'model':db[_0xf1e9('0x5e')],'as':_0xf1e9('0x5f'),'attributes':['id','name',_0xf1e9('0x31')],'through':{'attributes':[]}}]})[_0xf1e9('0x2a')](function(_0x13f02c){if(_0x13f02c){var _0x1bebb5=_0x48ee7a[_0xf1e9('0x58')][_0xf1e9('0x4e')]({'plain':!![]});if(!_0x1bebb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bebb5[_0xf1e9('0x59')]===_0xf1e9('0x58')){return db[_0xf1e9('0x60')][_0xf1e9('0x49')]({'where':{'name':_0xf1e9('0x61'),'userProfileId':_0x1bebb5[_0xf1e9('0x62')]},'raw':!![]})[_0xf1e9('0x2a')](function(_0x1c5ea4){if(_0x1c5ea4){if(_0x1c5ea4[_0xf1e9('0x63')]===0x0){return db[_0xf1e9('0x64')][_0xf1e9('0x45')]({'where':{'sectionId':_0x1c5ea4['id']},'raw':!![]})[_0xf1e9('0x2a')](function(_0x5f2a9b){var _0x5c097a=[];if(_['isEmpty'](_0x5f2a9b)){_0x5c097a=_[_0xf1e9('0x3e')](_0x13f02c,function(_0x2d3873){if(_0x2d3873[_0xf1e9('0x59')]!==_0xf1e9('0x57')){return _0x2d3873;}});return _0x5c097a;}else{for(var _0x3216b8=0x0;_0x3216b8<_0x13f02c[_0xf1e9('0x65')];_0x3216b8++){var _0x2ad208=_0x13f02c[_0x3216b8];if(_0x2ad208[_0xf1e9('0x59')]===_0xf1e9('0x57')){var _0x1075b5=_[_0xf1e9('0x49')](_0x5f2a9b,function(_0x43af9d){return _0x43af9d['resourceId']===_0x2ad208['id'];});if(_0x1075b5)_0x5c097a[_0xf1e9('0x66')](_0x2ad208);}else{_0x5c097a[_0xf1e9('0x66')](_0x2ad208);}}return _0x5c097a;}});}else{return _0x13f02c;}}else{var _0x2792cc=_[_0xf1e9('0x3e')](_0x13f02c,function(_0x5b8e1c){if(_0x5b8e1c[_0xf1e9('0x59')]!==_0xf1e9('0x57')){return _0x5b8e1c;}});return _0x2792cc;}});}else{return _0x13f02c;}}})[_0xf1e9('0x2a')](function(_0x25327c){var _0xb37281=[];if(_0x25327c){_0x5bc962=_0x25327c;for(var _0x101b28=0x0;_0x101b28<_0x25327c[_0xf1e9('0x65')];_0x101b28+=0x1){_0x5bc962[_0x101b28]['messages']=[];_0xb37281['push'](db['ChatInternalMessage'][_0xf1e9('0x49')]({'where':{'FromId':[_0x48ee7a[_0xf1e9('0x58')]['id'],_0x25327c[_0x101b28]['id']],'ToId':[_0x48ee7a[_0xf1e9('0x58')]['id'],_0x25327c[_0x101b28]['id']],'ChatGroupId':null},'attributes':['id',_0xf1e9('0x51'),_0xf1e9('0x67'),_0xf1e9('0x68'),_0xf1e9('0x69'),_0xf1e9('0x4b')],'order':qs['sort'](_0xf1e9('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf1e9('0x2a')](wrapUser(_0x25327c[_0x101b28])));}return BPromise[_0xf1e9('0x6b')](_0xb37281);}return[];})[_0xf1e9('0x2a')](function(_0x14f375){return{'rows':_0x14f375,'count':_0x14f375[_0xf1e9('0x65')]};})['then'](respondWithResult(_0x44e890,null))[_0xf1e9('0x46')](handleError(_0x44e890,null));}; \ No newline at end of file +var _0x8c68=['body','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','isEmpty','resourceId','push','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create'];(function(_0x317eb3,_0x3d8599){var _0x4ea09a=function(_0x2d47a7){while(--_0x2d47a7){_0x317eb3['push'](_0x317eb3['shift']());}};_0x4ea09a(++_0x3d8599);}(_0x8c68,0x1d8));var _0x88c6=function(_0x123533,_0x2f8613){_0x123533=_0x123533-0x0;var _0x3bd276=_0x8c68[_0x123533];return _0x3bd276;};'use strict';var emlformat=require(_0x88c6('0x0'));var rimraf=require(_0x88c6('0x1'));var zipdir=require(_0x88c6('0x2'));var jsonpatch=require(_0x88c6('0x3'));var rp=require(_0x88c6('0x4'));var moment=require('moment');var BPromise=require(_0x88c6('0x5'));var Mustache=require(_0x88c6('0x6'));var util=require(_0x88c6('0x7'));var path=require('path');var sox=require(_0x88c6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88c6('0x9'));var _=require(_0x88c6('0xa'));var squel=require(_0x88c6('0xb'));var crypto=require('crypto');var jsforce=require(_0x88c6('0xc'));var deskjs=require(_0x88c6('0xd'));var toCsv=require(_0x88c6('0xe'));var querystring=require(_0x88c6('0xf'));var Papa=require(_0x88c6('0x10'));var Redis=require(_0x88c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x88c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88c6('0x13'));var logger=require(_0x88c6('0x14'))(_0x88c6('0x15'));var utils=require(_0x88c6('0x16'));var config=require(_0x88c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x88c6('0x18'))['db'];config[_0x88c6('0x19')]=_[_0x88c6('0x1a')](config[_0x88c6('0x19')],{'host':_0x88c6('0x1b'),'port':0x18eb});var socket=require(_0x88c6('0x1c'))(new Redis(config['redis']));require(_0x88c6('0x1d'))[_0x88c6('0x1e')](socket);function respondWithStatusCode(_0x7c1840,_0x1e4f8b){_0x1e4f8b=_0x1e4f8b||0xcc;return function(_0x4e5915){if(_0x4e5915){return _0x7c1840[_0x88c6('0x1f')](_0x1e4f8b);}return _0x7c1840[_0x88c6('0x20')](_0x1e4f8b)[_0x88c6('0x21')]();};}function respondWithResult(_0x31699d,_0x23f97f){_0x23f97f=_0x23f97f||0xc8;return function(_0x4495e1){if(_0x4495e1){return _0x31699d['status'](_0x23f97f)[_0x88c6('0x22')](_0x4495e1);}};}function respondWithFilteredResult(_0x3a1787,_0x8a4194){return function(_0x3aec38){if(_0x3aec38){var _0x37bf39=typeof _0x8a4194[_0x88c6('0x23')]==='undefined'&&typeof _0x8a4194[_0x88c6('0x24')]===_0x88c6('0x25');var _0x333fe7=_0x3aec38[_0x88c6('0x26')];var _0x37ebe6=_0x37bf39?0x0:_0x8a4194[_0x88c6('0x23')];var _0x45db97=_0x37bf39?_0x3aec38[_0x88c6('0x26')]:_0x8a4194[_0x88c6('0x23')]+_0x8a4194[_0x88c6('0x24')];var _0x1ab405;if(_0x45db97>=_0x333fe7){_0x45db97=_0x333fe7;_0x1ab405=0xc8;}else{_0x1ab405=0xce;}_0x3a1787[_0x88c6('0x20')](_0x1ab405);return _0x3a1787[_0x88c6('0x27')]('Content-Range',_0x37ebe6+'-'+_0x45db97+'/'+_0x333fe7)[_0x88c6('0x22')](_0x3aec38);}return null;};}function patchUpdates(_0x1ac256){return function(_0x4574d4){try{jsonpatch[_0x88c6('0x28')](_0x4574d4,_0x1ac256,!![]);}catch(_0x556a2b){return BPromise[_0x88c6('0x29')](_0x556a2b);}return _0x4574d4['save']();};}function saveUpdates(_0x1f42e7,_0x4a4223){return function(_0x2d630b){if(_0x2d630b){return _0x2d630b['update'](_0x1f42e7)[_0x88c6('0x2a')](function(_0x35e456){return _0x35e456;});}return null;};}function removeEntity(_0x353d44,_0x490192){return function(_0x20e2d0){if(_0x20e2d0){return _0x20e2d0['destroy']()[_0x88c6('0x2a')](function(){_0x353d44[_0x88c6('0x20')](0xcc)[_0x88c6('0x21')]();});}};}function handleEntityNotFound(_0x578622,_0x326e69){return function(_0x53931d){if(!_0x53931d){_0x578622['sendStatus'](0x194);}return _0x53931d;};}function handleError(_0x4c487a,_0x1be684){_0x1be684=_0x1be684||0x1f4;return function(_0x39691a){logger['error'](_0x39691a[_0x88c6('0x2b')]);if(_0x39691a[_0x88c6('0x2c')]){delete _0x39691a[_0x88c6('0x2c')];}_0x4c487a[_0x88c6('0x20')](_0x1be684)[_0x88c6('0x2d')](_0x39691a);};}exports[_0x88c6('0x2e')]=function(_0x550fa7,_0x4371e7){var _0x1eedd6={},_0x587716={},_0x320183={'count':0x0,'rows':[]};var _0xd11ec0=_[_0x88c6('0x2f')](db[_0x88c6('0x30')]['rawAttributes'],function(_0x494667){return{'name':_0x494667[_0x88c6('0x31')],'type':_0x494667[_0x88c6('0x32')][_0x88c6('0x33')]};});_0x587716[_0x88c6('0x34')]=_[_0x88c6('0x2f')](_0xd11ec0,_0x88c6('0x2c'));_0x587716[_0x88c6('0x35')]=_['keys'](_0x550fa7['query']);_0x587716[_0x88c6('0x36')]=_[_0x88c6('0x37')](_0x587716[_0x88c6('0x34')],_0x587716[_0x88c6('0x35')]);_0x1eedd6[_0x88c6('0x38')]=_['intersection'](_0x587716[_0x88c6('0x34')],qs[_0x88c6('0x39')](_0x550fa7[_0x88c6('0x35')][_0x88c6('0x39')]));_0x1eedd6['attributes']=_0x1eedd6['attributes'][_0x88c6('0x3a')]?_0x1eedd6[_0x88c6('0x38')]:_0x587716[_0x88c6('0x34')];if(!_0x550fa7[_0x88c6('0x35')][_0x88c6('0x3b')](_0x88c6('0x3c'))){_0x1eedd6[_0x88c6('0x24')]=qs[_0x88c6('0x24')](_0x550fa7[_0x88c6('0x35')][_0x88c6('0x24')]);_0x1eedd6[_0x88c6('0x23')]=qs[_0x88c6('0x23')](_0x550fa7['query'][_0x88c6('0x23')]);}_0x1eedd6[_0x88c6('0x3d')]=qs['sort'](_0x550fa7[_0x88c6('0x35')][_0x88c6('0x3e')]);_0x1eedd6[_0x88c6('0x3f')]=qs['filters'](_['pick'](_0x550fa7['query'],_0x587716['filters']),_0xd11ec0);if(_0x550fa7[_0x88c6('0x35')][_0x88c6('0x40')]){_0x1eedd6[_0x88c6('0x3f')]=_[_0x88c6('0x41')](_0x1eedd6['where'],{'$or':_[_0x88c6('0x2f')](_0xd11ec0,function(_0x2061a6){if(_0x2061a6[_0x88c6('0x32')]!==_0x88c6('0x42')){var _0x49860d={};_0x49860d[_0x2061a6[_0x88c6('0x2c')]]={'$like':'%'+_0x550fa7[_0x88c6('0x35')][_0x88c6('0x40')]+'%'};return _0x49860d;}})});}_0x1eedd6=_[_0x88c6('0x41')]({},_0x1eedd6,_0x550fa7[_0x88c6('0x43')]);var _0x5a6c29={'where':_0x1eedd6[_0x88c6('0x3f')]};return db['ChatInternalMessage'][_0x88c6('0x26')](_0x5a6c29)['then'](function(_0x5c4356){_0x320183[_0x88c6('0x26')]=_0x5c4356;if(_0x550fa7[_0x88c6('0x35')]['includeAll']){_0x1eedd6[_0x88c6('0x44')]=[{'all':!![]}];}return db[_0x88c6('0x30')]['findAll'](_0x1eedd6);})[_0x88c6('0x2a')](function(_0x4c0b20){_0x320183[_0x88c6('0x45')]=_0x4c0b20;return _0x320183;})['then'](respondWithFilteredResult(_0x4371e7,_0x1eedd6))[_0x88c6('0x46')](handleError(_0x4371e7,null));};exports[_0x88c6('0x47')]=function(_0x464279,_0x505814){var _0x80a809={'raw':!![],'where':{'id':_0x464279[_0x88c6('0x48')]['id']}},_0x15d308={};_0x15d308['model']=_[_0x88c6('0x49')](db[_0x88c6('0x30')][_0x88c6('0x4a')]);_0x15d308['query']=_[_0x88c6('0x49')](_0x464279[_0x88c6('0x35')]);_0x15d308['filters']=_[_0x88c6('0x37')](_0x15d308[_0x88c6('0x34')],_0x15d308['query']);_0x80a809[_0x88c6('0x38')]=_['intersection'](_0x15d308[_0x88c6('0x34')],qs[_0x88c6('0x39')](_0x464279[_0x88c6('0x35')][_0x88c6('0x39')]));_0x80a809[_0x88c6('0x38')]=_0x80a809[_0x88c6('0x38')][_0x88c6('0x3a')]?_0x80a809['attributes']:_0x15d308['model'];if(_0x464279[_0x88c6('0x35')][_0x88c6('0x4b')]){_0x80a809['include']=[{'all':!![]}];}_0x80a809=_['merge']({},_0x80a809,_0x464279['options']);return db[_0x88c6('0x30')][_0x88c6('0x4c')](_0x80a809)[_0x88c6('0x2a')](handleEntityNotFound(_0x505814,null))[_0x88c6('0x2a')](respondWithResult(_0x505814,null))[_0x88c6('0x46')](handleError(_0x505814,null));};exports[_0x88c6('0x4d')]=function(_0x3cf95c,_0x3cdfb2){return db[_0x88c6('0x30')][_0x88c6('0x4d')](_0x3cf95c[_0x88c6('0x4e')],{})[_0x88c6('0x2a')](respondWithResult(_0x3cdfb2,0xc9))[_0x88c6('0x46')](handleError(_0x3cdfb2,null));};exports['update']=function(_0x1dacba,_0x179e7d){if(_0x1dacba[_0x88c6('0x4e')]['id']){delete _0x1dacba[_0x88c6('0x4e')]['id'];}return db[_0x88c6('0x30')][_0x88c6('0x4c')]({'where':{'id':_0x1dacba[_0x88c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x179e7d,null))[_0x88c6('0x2a')](saveUpdates(_0x1dacba['body'],null))[_0x88c6('0x2a')](respondWithResult(_0x179e7d,null))[_0x88c6('0x46')](handleError(_0x179e7d,null));};exports['destroy']=function(_0x164806,_0x28939a){return db[_0x88c6('0x30')]['find']({'where':{'id':_0x164806['params']['id']}})[_0x88c6('0x2a')](handleEntityNotFound(_0x28939a,null))[_0x88c6('0x2a')](removeEntity(_0x28939a,null))[_0x88c6('0x46')](handleError(_0x28939a,null));};exports['describe']=function(_0x444a88,_0x5cf780){return db[_0x88c6('0x30')][_0x88c6('0x4f')]()[_0x88c6('0x2a')](respondWithResult(_0x5cf780,null))[_0x88c6('0x46')](handleError(_0x5cf780,null));};function wrapUser(_0x35291b){return function(_0x344a57){var _0x37916d=_0x35291b[_0x88c6('0x50')]({'plain':!![]});_0x37916d[_0x88c6('0x51')]=[];if(_0x344a57){_0x37916d['lastMessageAt']=_0x344a57[_0x88c6('0x52')];_0x37916d['lastMessage']=_0x344a57;}else{_0x37916d[_0x88c6('0x53')]=moment(0x0)[_0x88c6('0x54')](_0x88c6('0x55'));_0x37916d['lastMessage']={};}return _0x37916d;};}exports[_0x88c6('0x56')]=function(_0x13b62d,_0x2b974b,_0x8608ce){var _0xa225ef=[];return db['User'][_0x88c6('0x57')]({'where':{'role':[_0x88c6('0x58'),_0x88c6('0x59'),_0x88c6('0x5a')]},'attributes':['id',_0x88c6('0x5b'),_0x88c6('0x2c'),'role',_0x88c6('0x5c'),_0x88c6('0x5d'),_0x88c6('0x5e'),_0x88c6('0x5f'),_0x88c6('0x60'),_0x88c6('0x61')],'order':qs[_0x88c6('0x3e')](_0x88c6('0x62')),'include':[{'model':db[_0x88c6('0x63')],'as':_0x88c6('0x64'),'attributes':['id',_0x88c6('0x2c'),'type'],'through':{'attributes':[]}}]})[_0x88c6('0x2a')](function(_0x2f17fe){if(_0x2f17fe){var _0x20cc1c=_0x13b62d[_0x88c6('0x5a')]['get']({'plain':!![]});if(!_0x20cc1c)throw new Error(_0x88c6('0x65'));if(_0x20cc1c[_0x88c6('0x66')]===_0x88c6('0x5a')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x20cc1c['userProfileId']},'raw':!![]})[_0x88c6('0x2a')](function(_0x293598){if(_0x293598){if(_0x293598[_0x88c6('0x67')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x293598['id']},'raw':!![]})[_0x88c6('0x2a')](function(_0x33a2d8){var _0x3cbac2=[];if(_[_0x88c6('0x68')](_0x33a2d8)){_0x3cbac2=_['filter'](_0x2f17fe,function(_0xc5047){if(_0xc5047['role']!==_0x88c6('0x58')){return _0xc5047;}});return _0x3cbac2;}else{for(var _0x340226=0x0;_0x340226<_0x2f17fe[_0x88c6('0x3a')];_0x340226++){var _0x3b9874=_0x2f17fe[_0x340226];if(_0x3b9874['role']===_0x88c6('0x58')){var _0x3b6521=_[_0x88c6('0x4c')](_0x33a2d8,function(_0x48eeaf){return _0x48eeaf[_0x88c6('0x69')]===_0x3b9874['id'];});if(_0x3b6521)_0x3cbac2[_0x88c6('0x6a')](_0x3b9874);}else{_0x3cbac2[_0x88c6('0x6a')](_0x3b9874);}}return _0x3cbac2;}});}else{return _0x2f17fe;}}else{var _0x137fa3=_[_0x88c6('0x40')](_0x2f17fe,function(_0xd3cde5){if(_0xd3cde5[_0x88c6('0x66')]!==_0x88c6('0x58')){return _0xd3cde5;}});return _0x137fa3;}});}else{return _0x2f17fe;}}})[_0x88c6('0x2a')](function(_0x38a64c){var _0xc8dd1=[];if(_0x38a64c){_0xa225ef=_0x38a64c;for(var _0x249e5a=0x0;_0x249e5a<_0x38a64c[_0x88c6('0x3a')];_0x249e5a+=0x1){_0xa225ef[_0x249e5a]['messages']=[];_0xc8dd1[_0x88c6('0x6a')](db[_0x88c6('0x30')]['find']({'where':{'FromId':[_0x13b62d['user']['id'],_0x38a64c[_0x249e5a]['id']],'ToId':[_0x13b62d['user']['id'],_0x38a64c[_0x249e5a]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x88c6('0x6b'),_0x88c6('0x6c'),_0x88c6('0x4e')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x88c6('0x2a')](wrapUser(_0x38a64c[_0x249e5a])));}return BPromise[_0x88c6('0x6d')](_0xc8dd1);}return[];})['then'](function(_0x3ad0b5){return{'rows':_0x3ad0b5,'count':_0x3ad0b5[_0x88c6('0x3a')]};})[_0x88c6('0x2a')](respondWithResult(_0x2b974b,null))['catch'](handleError(_0x2b974b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9f7a248..83b25c1 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 _0xdde1=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x53d510,_0x539932){var _0x2a7907=function(_0x4aa1f6){while(--_0x4aa1f6){_0x53d510['push'](_0x53d510['shift']());}};_0x2a7907(++_0x539932);}(_0xdde1,0xf5));var _0x1dde=function(_0x35f154,_0x50c6e2){_0x35f154=_0x35f154-0x0;var _0x3302b6=_0xdde1[_0x35f154];return _0x3302b6;};'use strict';var EventEmitter=require(_0x1dde('0x0'));var ChatInternalMessage=require(_0x1dde('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1dde('0x2')](0x0);var events={'afterCreate':_0x1dde('0x3'),'afterUpdate':_0x1dde('0x4'),'afterDestroy':_0x1dde('0x5')};function emitEvent(_0x4690a7){return function(_0x15078c,_0x4af0a1,_0x180389){ChatInternalMessageEvents[_0x1dde('0x6')](_0x4690a7+':'+_0x15078c['id'],_0x15078c);ChatInternalMessageEvents[_0x1dde('0x6')](_0x4690a7,_0x15078c);_0x180389(null);};}for(var e in events){if(events[_0x1dde('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xd3f3=['events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3a2637,_0x1bee62){var _0x4ecba6=function(_0x581b91){while(--_0x581b91){_0x3a2637['push'](_0x3a2637['shift']());}};_0x4ecba6(++_0x1bee62);}(_0xd3f3,0xf0));var _0x3d3f=function(_0x414658,_0x32591f){_0x414658=_0x414658-0x0;var _0x3f33b8=_0xd3f3[_0x414658];return _0x3f33b8;};'use strict';var EventEmitter=require(_0x3d3f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3d3f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3d3f('0x2')](0x0);var events={'afterCreate':_0x3d3f('0x3'),'afterUpdate':_0x3d3f('0x4'),'afterDestroy':_0x3d3f('0x5')};function emitEvent(_0x45e154){return function(_0x6c77e5,_0x21e100,_0x57f873){ChatInternalMessageEvents[_0x3d3f('0x6')](_0x45e154+':'+_0x6c77e5['id'],_0x6c77e5);ChatInternalMessageEvents[_0x3d3f('0x6')](_0x45e154,_0x6c77e5);_0x57f873(null);};}for(var e in events){if(events[_0x3d3f('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3d3f('0x8')](e,emitEvent(event));}}module[_0x3d3f('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 4e858f1..404c336 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 _0x31db=['path','rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','api','request-promise'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x31db,0x96));var _0xb31d=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x31db[_0x3c4dad];return _0x1a4f49;};'use strict';var _=require(_0xb31d('0x0'));var util=require(_0xb31d('0x1'));var logger=require('../../config/logger')(_0xb31d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb31d('0x3'));var fs=require('fs');var path=require(_0xb31d('0x4'));var rimraf=require(_0xb31d('0x5'));var config=require('../../config/environment');var attributes=require(_0xb31d('0x6'));module[_0xb31d('0x7')]=function(_0x2fc845,_0x4a0f4d){return _0x2fc845['define'](_0xb31d('0x8'),attributes,{'tableName':_0xb31d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb31d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfeab=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','lodash','api','moment','bluebird','request-promise','path'];(function(_0x374b9f,_0x35d296){var _0x4e6423=function(_0x15a880){while(--_0x15a880){_0x374b9f['push'](_0x374b9f['shift']());}};_0x4e6423(++_0x35d296);}(_0xfeab,0x1a7));var _0xbfea=function(_0x345776,_0x2a8a04){_0x345776=_0x345776-0x0;var _0x4cdeea=_0xfeab[_0x345776];return _0x4cdeea;};'use strict';var _=require(_0xbfea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbfea('0x1'));var moment=require(_0xbfea('0x2'));var BPromise=require(_0xbfea('0x3'));var rp=require(_0xbfea('0x4'));var fs=require('fs');var path=require(_0xbfea('0x5'));var rimraf=require(_0xbfea('0x6'));var config=require(_0xbfea('0x7'));var attributes=require(_0xbfea('0x8'));module[_0xbfea('0x9')]=function(_0x2ca3fe,_0x3303ad){return _0x2ca3fe[_0xbfea('0xa')](_0xbfea('0xb'),attributes,{'tableName':_0xbfea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c85fb7e..dab5f75 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 _0x9f62=['code','ChatInternalMessage,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f62,0x154));var _0x29f6=function(_0x4ec303,_0x5d4eb5){_0x4ec303=_0x4ec303-0x0;var _0x5516fe=_0x9f62[_0x4ec303];return _0x5516fe;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});} \ No newline at end of file +var _0xe5af=['redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xe5af,0xff));var _0xfe5a=function(_0x1c2560,_0x1d9304){_0x1c2560=_0x1c2560-0x0;var _0x2be4de=_0xe5af[_0x1c2560];return _0x2be4de;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe5a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x3'))(_0xfe5a('0x4'));var config=require(_0xfe5a('0x5'));var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')][_0xfe5a('0x8')]({'port':0x232a});config[_0xfe5a('0x9')]=_['defaults'](config[_0xfe5a('0x9')],{'host':_0xfe5a('0xa'),'port':0x18eb});var socket=require(_0xfe5a('0xb'))(new Redis(config['redis']));require(_0xfe5a('0xc'))['register'](socket);function respondWithRpcPromise(_0x22b4df,_0x103a04,_0x271a89){return new BPromise(function(_0x9d6c67,_0x1db2a1){return client[_0xfe5a('0xd')](_0x22b4df,_0x271a89)['then'](function(_0x3c93ba){logger[_0xfe5a('0xe')](_0xfe5a('0xf'),_0x103a04,_0xfe5a('0x10'));logger[_0xfe5a('0x11')](_0xfe5a('0x12'),_0x103a04,'request\x20sent',JSON['stringify'](_0x3c93ba));if(_0x3c93ba[_0xfe5a('0x13')]){if(_0x3c93ba[_0xfe5a('0x13')][_0xfe5a('0x14')]===0x1f4){logger['error'](_0xfe5a('0xf'),_0x103a04,_0x3c93ba[_0xfe5a('0x13')][_0xfe5a('0x15')]);return _0x1db2a1(_0x3c93ba['error'][_0xfe5a('0x15')]);}logger[_0xfe5a('0x13')](_0xfe5a('0xf'),_0x103a04,_0x3c93ba[_0xfe5a('0x13')][_0xfe5a('0x15')]);return _0x9d6c67(_0x3c93ba[_0xfe5a('0x13')][_0xfe5a('0x15')]);}else{logger[_0xfe5a('0xe')](_0xfe5a('0xf'),_0x103a04,_0xfe5a('0x10'));_0x9d6c67(_0x3c93ba[_0xfe5a('0x16')][_0xfe5a('0x15')]);}})[_0xfe5a('0x17')](function(_0x4979b2){logger[_0xfe5a('0x13')](_0xfe5a('0xf'),_0x103a04,_0x4979b2);_0x1db2a1(_0x4979b2);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e51b755..0937c5a 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 _0x07e0=['remove','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x07e0,0x117));var _0x007e=function(_0x1eba37,_0x4e5cfa){_0x1eba37=_0x1eba37-0x0;var _0xdea13=_0x07e0[_0x1eba37];return _0xdea13;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x007e('0x0'),_0x007e('0x1'),'update'];function createListener(_0x54b4b5,_0x26335b){return function(_0x5b721e){_0x26335b[_0x007e('0x2')](_0x54b4b5,_0x5b721e);};}function removeListener(_0xcfe18c,_0x2eff14){return function(){ChatInternalMessageEvents[_0x007e('0x3')](_0xcfe18c,_0x2eff14);};}exports[_0x007e('0x4')]=function(_0x5dd24a){for(var _0x5bc5a7=0x0,_0x2e61a8=events[_0x007e('0x5')];_0x5bc5a7<_0x2e61a8;_0x5bc5a7++){var _0x62255d=events[_0x5bc5a7];var _0x3c0a3d=createListener(_0x007e('0x6')+_0x62255d,_0x5dd24a);ChatInternalMessageEvents['on'](_0x62255d,_0x3c0a3d);}}; \ No newline at end of file +var _0x8d47=['removeListener','length','save','remove','update'];(function(_0x5a39a8,_0x33de6a){var _0x439f38=function(_0x41a3c7){while(--_0x41a3c7){_0x5a39a8['push'](_0x5a39a8['shift']());}};_0x439f38(++_0x33de6a);}(_0x8d47,0x101));var _0x78d4=function(_0x389aa6,_0x4c2c86){_0x389aa6=_0x389aa6-0x0;var _0x5f0c3e=_0x8d47[_0x389aa6];return _0x5f0c3e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x78d4('0x0'),_0x78d4('0x1'),_0x78d4('0x2')];function createListener(_0x5efe28,_0x39363a){return function(_0x52422c){_0x39363a['emit'](_0x5efe28,_0x52422c);};}function removeListener(_0x5a1fc2,_0xbdb56a){return function(){ChatInternalMessageEvents[_0x78d4('0x3')](_0x5a1fc2,_0xbdb56a);};}exports['register']=function(_0x5d4300){for(var _0x499f87=0x0,_0x56b6a7=events[_0x78d4('0x4')];_0x499f87<_0x56b6a7;_0x499f87++){var _0x5545dd=events[_0x499f87];var _0x1849b0=createListener('chatInternalMessage:'+_0x5545dd,_0x5d4300);ChatInternalMessageEvents['on'](_0x5545dd,_0x1849b0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d076747..6fa13ca 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 _0xb49d=['describe','/users','getUsers','create','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated'];(function(_0xf81b04,_0x348467){var _0x3efc97=function(_0x9e0f00){while(--_0x9e0f00){_0xf81b04['push'](_0xf81b04['shift']());}};_0x3efc97(++_0x348467);}(_0xb49d,0x182));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdb49('0x0'));var util=require(_0xdb49('0x1'));var path=require(_0xdb49('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb49('0x3'));var router=express[_0xdb49('0x4')]();var fs_extra=require(_0xdb49('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb49('0x6'));var config=require(_0xdb49('0x7'));var controller=require(_0xdb49('0x8'));router[_0xdb49('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb49('0xa')]);router[_0xdb49('0x9')](_0xdb49('0xb'),auth[_0xdb49('0xc')](),controller[_0xdb49('0xd')]);router[_0xdb49('0x9')](_0xdb49('0xe'),auth[_0xdb49('0xc')](),controller[_0xdb49('0xf')]);router[_0xdb49('0x9')]('/:id',auth[_0xdb49('0xc')](),controller['show']);router['post']('/',auth[_0xdb49('0xc')](),controller[_0xdb49('0x10')]);router['put'](_0xdb49('0x11'),controller[_0xdb49('0x12')]);router[_0xdb49('0x13')](_0xdb49('0x11'),auth[_0xdb49('0xc')](),controller['destroy']);module[_0xdb49('0x14')]=router; \ No newline at end of file +var _0xdf55=['/describe','describe','/users','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xdf55,0x135));var _0x5df5=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xdf55[_0x9b2bb0];return _0x2cdb3b;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require(_0x5df5('0x2'));var timeout=require(_0x5df5('0x3'));var express=require(_0x5df5('0x4'));var router=express[_0x5df5('0x5')]();var fs_extra=require(_0x5df5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5df5('0x7'));var config=require(_0x5df5('0x8'));var controller=require(_0x5df5('0x9'));router[_0x5df5('0xa')]('/',auth[_0x5df5('0xb')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0xb')](),controller[_0x5df5('0xe')]);router[_0x5df5('0xa')](_0x5df5('0xf'),auth['isAuthenticated'](),controller['getUsers']);router[_0x5df5('0xa')](_0x5df5('0x10'),auth[_0x5df5('0xb')](),controller[_0x5df5('0x11')]);router['post']('/',auth[_0x5df5('0xb')](),controller[_0x5df5('0x12')]);router[_0x5df5('0x13')]('/:id',controller[_0x5df5('0x14')]);router[_0x5df5('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('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 9704829..9c09ff5 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 _0x61d0=['STRING','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x34cafc,_0x419a2a){var _0x2a3051=function(_0xaf9b5c){while(--_0xaf9b5c){_0x34cafc['push'](_0x34cafc['shift']());}};_0x2a3051(++_0x419a2a);}(_0x61d0,0x187));var _0x061d=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x61d0[_0x285800];return _0x4b809e;};'use strict';var Sequelize=require(_0x061d('0x0'));module['exports']={'body':{'type':Sequelize[_0x061d('0x1')](_0x061d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x061d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x061d('0x4')),'defaultValue':_0x061d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x061d('0x5')]},'providerResponse':{'type':Sequelize[_0x061d('0x1')]}}; \ No newline at end of file +var _0x69d3=['TEXT','BOOLEAN','out','sequelize','exports'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x69d3,0xda));var _0x369d=function(_0x307025,_0x18d760){_0x307025=_0x307025-0x0;var _0x1e126a=_0x69d3[_0x307025];return _0x1e126a;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'body':{'type':Sequelize[_0x369d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x369d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x369d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x369d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x369d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7b379e2..64fa2de 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 _0x1025=['catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatMessage','count','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','format','UserId','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize','SIP/%s','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0x36f6fb,_0x249aa3){var _0x39c006=function(_0x2ba353){while(--_0x2ba353){_0x36f6fb['push'](_0x36f6fb['shift']());}};_0x39c006(++_0x249aa3);}(_0x1025,0x15b));var _0x5102=function(_0x514a57,_0x3f68f0){_0x514a57=_0x514a57-0x0;var _0x5814ac=_0x1025[_0x514a57];return _0x5814ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5102('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5102('0x1'));var rp=require(_0x5102('0x2'));var moment=require(_0x5102('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5102('0x4'));var path=require(_0x5102('0x5'));var sox=require(_0x5102('0x6'));var csv=require('to-csv');var ejs=require(_0x5102('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5102('0x8'));var squel=require(_0x5102('0x9'));var crypto=require('crypto');var jsforce=require(_0x5102('0xa'));var deskjs=require(_0x5102('0xb'));var toCsv=require(_0x5102('0xc'));var querystring=require('querystring');var Papa=require(_0x5102('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5102('0xe'));var as=require(_0x5102('0xf'));var hardwareService=require(_0x5102('0x10'));var logger=require(_0x5102('0x11'))(_0x5102('0x12'));var utils=require(_0x5102('0x13'));var config=require(_0x5102('0x14'));var licenseUtil=require(_0x5102('0x15'));var db=require(_0x5102('0x16'))['db'];config[_0x5102('0x17')]=_['defaults'](config['redis'],{'host':_0x5102('0x18'),'port':0x18eb});var socket=require(_0x5102('0x19'))(new Redis(config[_0x5102('0x17')]));require('./chatMessage.socket')[_0x5102('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5102('0x1b')][_0x5102('0x1c')]({'port':0x232c});var client9002=jayson[_0x5102('0x1b')][_0x5102('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d51bd,_0x5e19a8,_0x3a02b9,_0x380a87){return new BPromise(function(_0x238e10,_0x2fbb60){var _0xae64c4=_0x380a87||client;return _0xae64c4[_0x5102('0x1d')](_0x5d51bd,_0x3a02b9)['then'](function(_0x157c9d){logger[_0x5102('0x1e')](_0x5102('0x1f'),_0x5e19a8,'request\x20sent');logger['debug'](_0x5102('0x20'),_0x5e19a8,'request\x20sent',JSON['stringify'](_0x157c9d));if(_0x157c9d[_0x5102('0x21')]){if(_0x157c9d[_0x5102('0x21')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5e19a8,_0x157c9d[_0x5102('0x21')][_0x5102('0x22')]);return _0x2fbb60(_0x157c9d[_0x5102('0x21')][_0x5102('0x22')]);}logger[_0x5102('0x21')](_0x5102('0x1f'),_0x5e19a8,_0x157c9d[_0x5102('0x21')]['message']);return _0x238e10(_0x157c9d[_0x5102('0x21')][_0x5102('0x22')]);}else{logger['info'](_0x5102('0x1f'),_0x5e19a8,_0x5102('0x23'));_0x238e10(_0x157c9d[_0x5102('0x24')][_0x5102('0x22')]);}})[_0x5102('0x25')](function(_0x34e0f4){logger[_0x5102('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5e19a8,_0x34e0f4);_0x2fbb60(_0x34e0f4);});});}function respondWithStatusCode(_0x468f5b,_0x3e9ad6){_0x3e9ad6=_0x3e9ad6||0xcc;return function(_0xc82fab){if(_0xc82fab){return _0x468f5b[_0x5102('0x26')](_0x3e9ad6);}return _0x468f5b[_0x5102('0x27')](_0x3e9ad6)['end']();};}function respondWithResult(_0x53927a,_0x4dd6eb){_0x4dd6eb=_0x4dd6eb||0xc8;return function(_0x314812){if(_0x314812){return _0x53927a[_0x5102('0x27')](_0x4dd6eb)[_0x5102('0x28')](_0x314812);}};}function respondWithFilteredResult(_0x3fd58a,_0xaea7cb){return function(_0x232306){if(_0x232306){var _0x1c4eb5=typeof _0xaea7cb['offset']===_0x5102('0x29')&&typeof _0xaea7cb[_0x5102('0x2a')]==='undefined';var _0x5bd69d=_0x232306['count'];var _0x22e214=_0x1c4eb5?0x0:_0xaea7cb[_0x5102('0x2b')];var _0x1fbabe=_0x1c4eb5?_0x232306['count']:_0xaea7cb[_0x5102('0x2b')]+_0xaea7cb[_0x5102('0x2a')];var _0x20b298;if(_0x1fbabe>=_0x5bd69d){_0x1fbabe=_0x5bd69d;_0x20b298=0xc8;}else{_0x20b298=0xce;}_0x3fd58a[_0x5102('0x27')](_0x20b298);return _0x3fd58a[_0x5102('0x2c')](_0x5102('0x2d'),_0x22e214+'-'+_0x1fbabe+'/'+_0x5bd69d)[_0x5102('0x28')](_0x232306);}return null;};}function patchUpdates(_0x3af300){return function(_0x4bca14){try{jsonpatch[_0x5102('0x2e')](_0x4bca14,_0x3af300,!![]);}catch(_0x328835){return BPromise[_0x5102('0x2f')](_0x328835);}return _0x4bca14[_0x5102('0x30')]();};}function saveUpdates(_0x518948,_0x4134c3){return function(_0x3e1a26){if(_0x3e1a26){return _0x3e1a26[_0x5102('0x31')](_0x518948)[_0x5102('0x32')](function(_0x7e2774){return _0x7e2774;});}return null;};}function removeEntity(_0x46acc3,_0x3f72fe){return function(_0x4d78d8){if(_0x4d78d8){return _0x4d78d8[_0x5102('0x33')]()['then'](function(){_0x46acc3[_0x5102('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b257a,_0x23321b){return function(_0x3cf41c){if(!_0x3cf41c){_0x4b257a[_0x5102('0x26')](0x194);}return _0x3cf41c;};}function handleError(_0x335a82,_0x5711c3){_0x5711c3=_0x5711c3||0x1f4;return function(_0x4c5f02){logger[_0x5102('0x21')](_0x4c5f02[_0x5102('0x34')]);if(_0x4c5f02[_0x5102('0x35')]){delete _0x4c5f02[_0x5102('0x35')];}_0x335a82[_0x5102('0x27')](_0x5711c3)[_0x5102('0x36')](_0x4c5f02);};}exports[_0x5102('0x37')]=function(_0x115555,_0x44e5af){var _0x2ccd5d={},_0x4ab014={},_0x51c6b3={'count':0x0,'rows':[]};var _0x273569=_[_0x5102('0x38')](db['ChatMessage'][_0x5102('0x39')],function(_0xefb324){return{'name':_0xefb324[_0x5102('0x3a')],'type':_0xefb324['type'][_0x5102('0x3b')]};});_0x4ab014[_0x5102('0x3c')]=_[_0x5102('0x38')](_0x273569,_0x5102('0x35'));_0x4ab014[_0x5102('0x3d')]=_[_0x5102('0x3e')](_0x115555[_0x5102('0x3d')]);_0x4ab014[_0x5102('0x3f')]=_['intersection'](_0x4ab014[_0x5102('0x3c')],_0x4ab014[_0x5102('0x3d')]);_0x2ccd5d[_0x5102('0x40')]=_[_0x5102('0x41')](_0x4ab014[_0x5102('0x3c')],qs[_0x5102('0x42')](_0x115555[_0x5102('0x3d')][_0x5102('0x42')]));_0x2ccd5d[_0x5102('0x40')]=_0x2ccd5d[_0x5102('0x40')][_0x5102('0x43')]?_0x2ccd5d['attributes']:_0x4ab014['model'];if(!_0x115555[_0x5102('0x3d')][_0x5102('0x44')](_0x5102('0x45'))){_0x2ccd5d[_0x5102('0x2a')]=qs[_0x5102('0x2a')](_0x115555[_0x5102('0x3d')][_0x5102('0x2a')]);_0x2ccd5d['offset']=qs[_0x5102('0x2b')](_0x115555[_0x5102('0x3d')][_0x5102('0x2b')]);}_0x2ccd5d[_0x5102('0x46')]=qs[_0x5102('0x47')](_0x115555[_0x5102('0x3d')][_0x5102('0x47')]);_0x2ccd5d[_0x5102('0x48')]=qs[_0x5102('0x3f')](_[_0x5102('0x49')](_0x115555[_0x5102('0x3d')],_0x4ab014[_0x5102('0x3f')]),_0x273569);if(_0x115555[_0x5102('0x3d')][_0x5102('0x4a')]){_0x2ccd5d[_0x5102('0x48')]=_[_0x5102('0x4b')](_0x2ccd5d[_0x5102('0x48')],{'$or':_[_0x5102('0x38')](_0x273569,function(_0x340597){if(_0x340597[_0x5102('0x4c')]!==_0x5102('0x4d')){var _0x3a3701={};_0x3a3701[_0x340597[_0x5102('0x35')]]={'$like':'%'+_0x115555['query'][_0x5102('0x4a')]+'%'};return _0x3a3701;}})});}_0x2ccd5d=_['merge']({},_0x2ccd5d,_0x115555[_0x5102('0x4e')]);var _0x33d15b={'where':_0x2ccd5d['where']};return db[_0x5102('0x4f')][_0x5102('0x50')](_0x33d15b)[_0x5102('0x32')](function(_0x3bc43b){_0x51c6b3['count']=_0x3bc43b;if(_0x115555[_0x5102('0x3d')][_0x5102('0x51')]){_0x2ccd5d[_0x5102('0x52')]=[{'all':!![]}];}return db[_0x5102('0x4f')][_0x5102('0x53')](_0x2ccd5d);})[_0x5102('0x32')](function(_0x2458ec){_0x51c6b3[_0x5102('0x54')]=_0x2458ec;return _0x51c6b3;})[_0x5102('0x32')](respondWithFilteredResult(_0x44e5af,_0x2ccd5d))[_0x5102('0x25')](handleError(_0x44e5af,null));};exports[_0x5102('0x55')]=function(_0x5a1e88,_0x11cbec){var _0x48d4de={'raw':!![],'where':{'id':_0x5a1e88[_0x5102('0x56')]['id']}},_0x1d6bc0={};_0x1d6bc0[_0x5102('0x3c')]=_[_0x5102('0x3e')](db['ChatMessage'][_0x5102('0x39')]);_0x1d6bc0[_0x5102('0x3d')]=_[_0x5102('0x3e')](_0x5a1e88[_0x5102('0x3d')]);_0x1d6bc0[_0x5102('0x3f')]=_['intersection'](_0x1d6bc0[_0x5102('0x3c')],_0x1d6bc0[_0x5102('0x3d')]);_0x48d4de[_0x5102('0x40')]=_[_0x5102('0x41')](_0x1d6bc0['model'],qs[_0x5102('0x42')](_0x5a1e88['query'][_0x5102('0x42')]));_0x48d4de[_0x5102('0x40')]=_0x48d4de[_0x5102('0x40')][_0x5102('0x43')]?_0x48d4de['attributes']:_0x1d6bc0[_0x5102('0x3c')];if(_0x5a1e88['query'][_0x5102('0x51')]){_0x48d4de[_0x5102('0x52')]=[{'all':!![]}];}_0x48d4de=_[_0x5102('0x4b')]({},_0x48d4de,_0x5a1e88[_0x5102('0x4e')]);return db[_0x5102('0x4f')][_0x5102('0x57')](_0x48d4de)[_0x5102('0x32')](handleEntityNotFound(_0x11cbec,null))[_0x5102('0x32')](respondWithResult(_0x11cbec,null))['catch'](handleError(_0x11cbec,null));};exports[_0x5102('0x58')]=function(_0xf6ef92,_0x25cdff){return db[_0x5102('0x4f')]['create'](_0xf6ef92['body'],{})[_0x5102('0x32')](respondWithResult(_0x25cdff,0xc9))[_0x5102('0x25')](handleError(_0x25cdff,null));};exports[_0x5102('0x31')]=function(_0x3d9fb1,_0x5dc983){if(_0x3d9fb1[_0x5102('0x59')]['id']){delete _0x3d9fb1[_0x5102('0x59')]['id'];}return db[_0x5102('0x4f')][_0x5102('0x57')]({'where':{'id':_0x3d9fb1[_0x5102('0x56')]['id']}})['then'](handleEntityNotFound(_0x5dc983,null))[_0x5102('0x32')](saveUpdates(_0x3d9fb1[_0x5102('0x59')],null))[_0x5102('0x32')](respondWithResult(_0x5dc983,null))['catch'](handleError(_0x5dc983,null));};exports[_0x5102('0x33')]=function(_0x21aaef,_0x70f6f5){return db[_0x5102('0x4f')][_0x5102('0x57')]({'where':{'id':_0x21aaef[_0x5102('0x56')]['id']}})[_0x5102('0x32')](handleEntityNotFound(_0x70f6f5,null))['then'](removeEntity(_0x70f6f5,null))[_0x5102('0x25')](handleError(_0x70f6f5,null));};exports[_0x5102('0x5a')]=function(_0x15b896,_0x18d1fd){return db[_0x5102('0x4f')][_0x5102('0x5a')]()[_0x5102('0x32')](respondWithResult(_0x18d1fd,null))[_0x5102('0x25')](handleError(_0x18d1fd,null));};var interaction_log=require(_0x5102('0x11'))(_0x5102('0x5b'));exports[_0x5102('0x5c')]=function(_0x4f2dd2,_0x4714b4,_0x373082){var _0x5e959a={'agent':{},'channel':_0x5102('0x5d')};if(_0x4f2dd2['body']['id']){delete _0x4f2dd2[_0x5102('0x59')]['id'];}_0x4f2dd2[_0x5102('0x59')]['read']=!![];_0x4f2dd2[_0x5102('0x59')]['readAt']=moment()[_0x5102('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f2dd2[_0x5102('0x59')][_0x5102('0x5f')]=_0x4f2dd2[_0x5102('0x59')][_0x5102('0x5f')]||_0x4f2dd2['user']['id'];_0x5e959a['agent']['id']=_0x4f2dd2[_0x5102('0x59')][_0x5102('0x5f')];return db[_0x5102('0x4f')]['find']({'where':{'id':_0x4f2dd2['params']['id'],'UserId':null}})[_0x5102('0x32')](handleEntityNotFound(_0x4714b4,null))[_0x5102('0x32')](saveUpdates(_0x4f2dd2['body'],null))[_0x5102('0x32')](function(_0x217946){if(_0x217946){_0x5e959a['message']=_0x217946['get']({'plain':!![]});return db['ChatInteraction'][_0x5102('0x57')]({'where':{'id':_0x217946[_0x5102('0x60')]}});}return null;})[_0x5102('0x32')](handleEntityNotFound(_0x4714b4,null))[_0x5102('0x32')](function(_0x4e3008){if(_0x4e3008){return _0x4e3008['update']({'UserId':_0x4f2dd2['body'][_0x5102('0x5f')],'read1stAt':_[_0x5102('0x61')](_0x4e3008['read1stAt'])?moment()[_0x5102('0x5e')](_0x5102('0x62')):undefined});}return null;})[_0x5102('0x32')](function(_0x12d3e8){if(_0x12d3e8){_0x5e959a['interaction']=_0x12d3e8['get']({'plain':!![]});interaction_log[_0x5102('0x1e')](_0x5102('0x63'),_0x4f2dd2[_0x5102('0x64')]['id'],_0x4f2dd2[_0x5102('0x64')]['name'],_0x4f2dd2[_0x5102('0x64')][_0x5102('0x65')],_0x5e959a[_0x5102('0x66')]['id'],_0x4f2dd2[_0x5102('0x59')]?JSON[_0x5102('0x67')](_0x4f2dd2['body']):'null');return respondWithRpcPromise(_0x5102('0x68'),'acceptMessage',_0x5e959a);}return null;})[_0x5102('0x32')](function(_0x248ee7){var _0x1c5d28=_0x5102('0x69')+_0x248ee7['message'][_0x5102('0x6a')];return db['sequelize'][_0x5102('0x3d')](_0x1c5d28,{'type':db[_0x5102('0x6b')]['QueryTypes'][_0x5102('0x6c')],'raw':!![]})[_0x5102('0x32')](function(_0x1688de){return _0x1688de;});})[_0x5102('0x32')](function(_0x4518ff){if(_0x4518ff){_0x5e959a[_0x5102('0x22')][_0x5102('0x6d')]=_0x4518ff[0x0];if(!_0x4f2dd2['body'][_0x5102('0x5f')])return;return db[_0x5102('0x6e')][_0x5102('0x57')]({'where':{'id':_0x4f2dd2[_0x5102('0x59')][_0x5102('0x5f')],'role':_0x5102('0x6f')},'attributes':['id',_0x5102('0x35'),'fullname',_0x5102('0x70'),_0x5102('0x71')],'raw':!![]});}return null;})[_0x5102('0x32')](function(_0x302b8f){if(!_0x302b8f)return null;_0x5e959a[_0x5102('0x22')]['agent']=_0x302b8f;return _0x5e959a;})[_0x5102('0x32')](function(_0x1952ea){if(_0x1952ea){if(_0x4f2dd2[_0x5102('0x59')][_0x5102('0x72')]){_0x5e959a[_0x5102('0x22')][_0x5102('0x73')]=util[_0x5102('0x5e')]('SIP/%s',_0x4f2dd2[_0x5102('0x64')][_0x5102('0x35')]);_0x5e959a[_0x5102('0x22')][_0x5102('0x74')]=_0x5e959a[_0x5102('0x74')];_0x5e959a[_0x5102('0x22')][_0x5102('0x75')]=_0x5e959a[_0x5102('0x74')];_0x5e959a[_0x5102('0x22')][_0x5102('0x76')]=_0x5102('0x5c');return respondWithRpcPromise('EventManager',_0x5102('0x77'),{'event':_0x5102('0x78'),'message':_['merge'](_0x5e959a['message'],JSON[_0x5102('0x79')](_0x5e959a[_0x5102('0x66')]['formData']))},client9002)[_0x5102('0x32')](function(){return _0x5e959a;});}return _0x5e959a;}return null;})['then'](respondWithResult(_0x4714b4,null))[_0x5102('0x25')](handleError(_0x4714b4,null));};var interaction_log=require(_0x5102('0x11'))(_0x5102('0x5b'));exports[_0x5102('0x2f')]=function(_0x18a839,_0x29ea66,_0x2a96c2){var _0x17ae74={'agent':{},'channel':_0x5102('0x5d')};if(_0x18a839[_0x5102('0x59')]['id']){delete _0x18a839[_0x5102('0x59')]['id'];}_0x18a839['body'][_0x5102('0x5f')]=_0x18a839['body']['UserId']||_0x18a839[_0x5102('0x64')]['id'];_0x17ae74[_0x5102('0x6f')]['id']=_0x18a839[_0x5102('0x59')][_0x5102('0x5f')];return db[_0x5102('0x4f')][_0x5102('0x57')]({'where':{'id':_0x18a839[_0x5102('0x56')]['id'],'UserId':null}})[_0x5102('0x32')](handleEntityNotFound(_0x29ea66,null))[_0x5102('0x32')](function(_0x319f98){if(_0x319f98){_0x17ae74[_0x5102('0x22')]=_0x319f98[_0x5102('0x7a')]({'plain':!![]});return db['ChatInteraction'][_0x5102('0x57')]({'where':{'id':_0x319f98[_0x5102('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x29ea66,null))[_0x5102('0x32')](function(_0x3072ba){if(_0x3072ba){_0x17ae74[_0x5102('0x66')]=_0x3072ba[_0x5102('0x7a')]({'plain':!![]});interaction_log[_0x5102('0x1e')](_0x5102('0x7b'),_0x18a839[_0x5102('0x64')]['id'],_0x18a839[_0x5102('0x64')][_0x5102('0x35')],_0x18a839[_0x5102('0x64')][_0x5102('0x65')],_0x17ae74['interaction']['id'],_0x18a839['body']?JSON[_0x5102('0x67')](_0x18a839[_0x5102('0x59')]):_0x5102('0x7c'));return respondWithRpcPromise('RejectMessage',_0x5102('0x7d'),_0x17ae74);}return null;})[_0x5102('0x32')](function(_0x5e4992){var _0x515b8e=_0x5102('0x69')+_0x5e4992[_0x5102('0x22')][_0x5102('0x6a')];return db[_0x5102('0x7e')]['query'](_0x515b8e,{'type':db['Sequelize']['QueryTypes'][_0x5102('0x6c')],'raw':!![]})[_0x5102('0x32')](function(_0x2dae00){return _0x2dae00;});})[_0x5102('0x32')](function(_0x4f2f3b){if(_0x4f2f3b){_0x17ae74[_0x5102('0x22')][_0x5102('0x6d')]=_0x4f2f3b[0x0];if(!_0x18a839['body'][_0x5102('0x5f')])return;return db[_0x5102('0x6e')][_0x5102('0x57')]({'where':{'id':_0x18a839[_0x5102('0x59')][_0x5102('0x5f')],'role':_0x5102('0x6f')},'attributes':['id',_0x5102('0x35'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x5102('0x32')](function(_0xee3a65){if(!_0xee3a65)return null;_0x17ae74[_0x5102('0x22')][_0x5102('0x6f')]=_0xee3a65;return _0x17ae74;})[_0x5102('0x32')](function(_0x260aff){if(_0x260aff){_0x260aff[_0x5102('0x22')][_0x5102('0x73')]=util[_0x5102('0x5e')](_0x5102('0x7f'),_0x18a839[_0x5102('0x64')][_0x5102('0x35')]);_0x260aff[_0x5102('0x22')]['channel']=_0x17ae74[_0x5102('0x74')];_0x260aff[_0x5102('0x22')][_0x5102('0x75')]=_0x17ae74['channel'];_0x260aff[_0x5102('0x22')]['event']='reject';respondWithRpcPromise(_0x5102('0x77'),_0x5102('0x77'),{'event':'rejectmessage','message':_[_0x5102('0x4b')](_0x17ae74[_0x5102('0x22')],JSON[_0x5102('0x79')](_0x17ae74[_0x5102('0x66')]['formData']))},client9002);return _0x17ae74;}return null;})[_0x5102('0x32')](respondWithResult(_0x29ea66,null))[_0x5102('0x25')](handleError(_0x29ea66,null));}; \ No newline at end of file +var _0x5f5b=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatMessage','include','rows','show','includeAll','find','create','body','params','describe','../../config/logger','chat-interactions','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','internal','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x5d18ca,_0x2bb470){var _0x277824=function(_0x11c9aa){while(--_0x11c9aa){_0x5d18ca['push'](_0x5d18ca['shift']());}};_0x277824(++_0x2bb470);}(_0x5f5b,0x75));var _0xb5f5=function(_0x1f2232,_0x1a9711){_0x1f2232=_0x1f2232-0x0;var _0x4f8a5b=_0x5f5b[_0x1f2232];return _0x4f8a5b;};'use strict';var emlformat=require(_0xb5f5('0x0'));var rimraf=require(_0xb5f5('0x1'));var zipdir=require(_0xb5f5('0x2'));var jsonpatch=require(_0xb5f5('0x3'));var rp=require(_0xb5f5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb5f5('0x5'));var sox=require(_0xb5f5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5f5('0x7'));var _=require(_0xb5f5('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5f5('0x9'));var deskjs=require(_0xb5f5('0xa'));var toCsv=require(_0xb5f5('0xb'));var querystring=require(_0xb5f5('0xc'));var Papa=require(_0xb5f5('0xd'));var Redis=require(_0xb5f5('0xe'));var authService=require(_0xb5f5('0xf'));var qs=require(_0xb5f5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5f5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb5f5('0x12'));var config=require(_0xb5f5('0x13'));var licenseUtil=require(_0xb5f5('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xb5f5('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5f5('0x15')]));require(_0xb5f5('0x16'))[_0xb5f5('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb5f5('0x18')][_0xb5f5('0x19')]({'port':0x232c});var client9002=jayson[_0xb5f5('0x18')][_0xb5f5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1500f6,_0x5cbf72,_0x4b4262,_0x1bbef9){return new BPromise(function(_0x242af0,_0x1375cc){var _0x16993d=_0x1bbef9||client;return _0x16993d['request'](_0x1500f6,_0x4b4262)[_0xb5f5('0x1a')](function(_0x15d939){logger[_0xb5f5('0x1b')](_0xb5f5('0x1c'),_0x5cbf72,'request\x20sent');logger['debug'](_0xb5f5('0x1d'),_0x5cbf72,'request\x20sent',JSON[_0xb5f5('0x1e')](_0x15d939));if(_0x15d939[_0xb5f5('0x1f')]){if(_0x15d939['error'][_0xb5f5('0x20')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5cbf72,_0x15d939[_0xb5f5('0x1f')][_0xb5f5('0x21')]);return _0x1375cc(_0x15d939[_0xb5f5('0x1f')]['message']);}logger[_0xb5f5('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x5cbf72,_0x15d939[_0xb5f5('0x1f')]['message']);return _0x242af0(_0x15d939[_0xb5f5('0x1f')][_0xb5f5('0x21')]);}else{logger[_0xb5f5('0x1b')](_0xb5f5('0x1c'),_0x5cbf72,_0xb5f5('0x22'));_0x242af0(_0x15d939[_0xb5f5('0x23')][_0xb5f5('0x21')]);}})[_0xb5f5('0x24')](function(_0x515a84){logger['error'](_0xb5f5('0x1c'),_0x5cbf72,_0x515a84);_0x1375cc(_0x515a84);});});}function respondWithStatusCode(_0xd6059a,_0x56e2bb){_0x56e2bb=_0x56e2bb||0xcc;return function(_0x4e21d9){if(_0x4e21d9){return _0xd6059a['sendStatus'](_0x56e2bb);}return _0xd6059a[_0xb5f5('0x25')](_0x56e2bb)[_0xb5f5('0x26')]();};}function respondWithResult(_0xa30029,_0x111f93){_0x111f93=_0x111f93||0xc8;return function(_0x3e5ba6){if(_0x3e5ba6){return _0xa30029['status'](_0x111f93)[_0xb5f5('0x27')](_0x3e5ba6);}};}function respondWithFilteredResult(_0x1c33d9,_0x38391a){return function(_0x399e18){if(_0x399e18){var _0x42497b=typeof _0x38391a['offset']===_0xb5f5('0x28')&&typeof _0x38391a[_0xb5f5('0x29')]===_0xb5f5('0x28');var _0x3a7d9f=_0x399e18[_0xb5f5('0x2a')];var _0x1f3166=_0x42497b?0x0:_0x38391a['offset'];var _0x3dcc74=_0x42497b?_0x399e18[_0xb5f5('0x2a')]:_0x38391a[_0xb5f5('0x2b')]+_0x38391a[_0xb5f5('0x29')];var _0x73bdf5;if(_0x3dcc74>=_0x3a7d9f){_0x3dcc74=_0x3a7d9f;_0x73bdf5=0xc8;}else{_0x73bdf5=0xce;}_0x1c33d9['status'](_0x73bdf5);return _0x1c33d9[_0xb5f5('0x2c')](_0xb5f5('0x2d'),_0x1f3166+'-'+_0x3dcc74+'/'+_0x3a7d9f)['json'](_0x399e18);}return null;};}function patchUpdates(_0x34c9e3){return function(_0x38bc01){try{jsonpatch[_0xb5f5('0x2e')](_0x38bc01,_0x34c9e3,!![]);}catch(_0x48901c){return BPromise[_0xb5f5('0x2f')](_0x48901c);}return _0x38bc01['save']();};}function saveUpdates(_0x3debcb,_0x374a82){return function(_0x382a95){if(_0x382a95){return _0x382a95[_0xb5f5('0x30')](_0x3debcb)[_0xb5f5('0x1a')](function(_0x4cdacf){return _0x4cdacf;});}return null;};}function removeEntity(_0x52f034,_0xaf9825){return function(_0x46a041){if(_0x46a041){return _0x46a041[_0xb5f5('0x31')]()['then'](function(){_0x52f034['status'](0xcc)[_0xb5f5('0x26')]();});}};}function handleEntityNotFound(_0x5edada,_0x52b474){return function(_0x4c97d2){if(!_0x4c97d2){_0x5edada[_0xb5f5('0x32')](0x194);}return _0x4c97d2;};}function handleError(_0x416972,_0x572025){_0x572025=_0x572025||0x1f4;return function(_0x1491fe){logger['error'](_0x1491fe[_0xb5f5('0x33')]);if(_0x1491fe[_0xb5f5('0x34')]){delete _0x1491fe[_0xb5f5('0x34')];}_0x416972['status'](_0x572025)[_0xb5f5('0x35')](_0x1491fe);};}exports[_0xb5f5('0x36')]=function(_0x330ec3,_0x27f63e){var _0x1d0f90={},_0x3386e5={},_0x166ca5={'count':0x0,'rows':[]};var _0x1b2cb1=_['map'](db['ChatMessage'][_0xb5f5('0x37')],function(_0x2029d3){return{'name':_0x2029d3[_0xb5f5('0x38')],'type':_0x2029d3[_0xb5f5('0x39')][_0xb5f5('0x3a')]};});_0x3386e5[_0xb5f5('0x3b')]=_[_0xb5f5('0x3c')](_0x1b2cb1,_0xb5f5('0x34'));_0x3386e5[_0xb5f5('0x3d')]=_[_0xb5f5('0x3e')](_0x330ec3[_0xb5f5('0x3d')]);_0x3386e5['filters']=_[_0xb5f5('0x3f')](_0x3386e5[_0xb5f5('0x3b')],_0x3386e5['query']);_0x1d0f90[_0xb5f5('0x40')]=_[_0xb5f5('0x3f')](_0x3386e5[_0xb5f5('0x3b')],qs[_0xb5f5('0x41')](_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x41')]));_0x1d0f90[_0xb5f5('0x40')]=_0x1d0f90['attributes'][_0xb5f5('0x42')]?_0x1d0f90['attributes']:_0x3386e5['model'];if(!_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x43')](_0xb5f5('0x44'))){_0x1d0f90[_0xb5f5('0x29')]=qs['limit'](_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x29')]);_0x1d0f90[_0xb5f5('0x2b')]=qs[_0xb5f5('0x2b')](_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x2b')]);}_0x1d0f90[_0xb5f5('0x45')]=qs[_0xb5f5('0x46')](_0x330ec3['query'][_0xb5f5('0x46')]);_0x1d0f90[_0xb5f5('0x47')]=qs[_0xb5f5('0x48')](_[_0xb5f5('0x49')](_0x330ec3[_0xb5f5('0x3d')],_0x3386e5[_0xb5f5('0x48')]),_0x1b2cb1);if(_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x4a')]){_0x1d0f90[_0xb5f5('0x47')]=_['merge'](_0x1d0f90[_0xb5f5('0x47')],{'$or':_['map'](_0x1b2cb1,function(_0x308f31){if(_0x308f31['type']!==_0xb5f5('0x4b')){var _0x237d10={};_0x237d10[_0x308f31['name']]={'$like':'%'+_0x330ec3[_0xb5f5('0x3d')][_0xb5f5('0x4a')]+'%'};return _0x237d10;}})});}_0x1d0f90=_[_0xb5f5('0x4c')]({},_0x1d0f90,_0x330ec3[_0xb5f5('0x4d')]);var _0x14aaff={'where':_0x1d0f90['where']};return db[_0xb5f5('0x4e')][_0xb5f5('0x2a')](_0x14aaff)['then'](function(_0x32b523){_0x166ca5[_0xb5f5('0x2a')]=_0x32b523;if(_0x330ec3[_0xb5f5('0x3d')]['includeAll']){_0x1d0f90[_0xb5f5('0x4f')]=[{'all':!![]}];}return db[_0xb5f5('0x4e')]['findAll'](_0x1d0f90);})[_0xb5f5('0x1a')](function(_0x54cc1d){_0x166ca5[_0xb5f5('0x50')]=_0x54cc1d;return _0x166ca5;})['then'](respondWithFilteredResult(_0x27f63e,_0x1d0f90))['catch'](handleError(_0x27f63e,null));};exports[_0xb5f5('0x51')]=function(_0x4fd321,_0x17066e){var _0x35608a={'raw':!![],'where':{'id':_0x4fd321['params']['id']}},_0x296c9d={};_0x296c9d['model']=_[_0xb5f5('0x3e')](db[_0xb5f5('0x4e')][_0xb5f5('0x37')]);_0x296c9d[_0xb5f5('0x3d')]=_[_0xb5f5('0x3e')](_0x4fd321['query']);_0x296c9d[_0xb5f5('0x48')]=_[_0xb5f5('0x3f')](_0x296c9d['model'],_0x296c9d['query']);_0x35608a[_0xb5f5('0x40')]=_['intersection'](_0x296c9d[_0xb5f5('0x3b')],qs[_0xb5f5('0x41')](_0x4fd321['query'][_0xb5f5('0x41')]));_0x35608a['attributes']=_0x35608a['attributes'][_0xb5f5('0x42')]?_0x35608a[_0xb5f5('0x40')]:_0x296c9d[_0xb5f5('0x3b')];if(_0x4fd321['query'][_0xb5f5('0x52')]){_0x35608a[_0xb5f5('0x4f')]=[{'all':!![]}];}_0x35608a=_[_0xb5f5('0x4c')]({},_0x35608a,_0x4fd321[_0xb5f5('0x4d')]);return db[_0xb5f5('0x4e')][_0xb5f5('0x53')](_0x35608a)[_0xb5f5('0x1a')](handleEntityNotFound(_0x17066e,null))[_0xb5f5('0x1a')](respondWithResult(_0x17066e,null))['catch'](handleError(_0x17066e,null));};exports[_0xb5f5('0x54')]=function(_0x420d35,_0x25fc65){return db[_0xb5f5('0x4e')][_0xb5f5('0x54')](_0x420d35[_0xb5f5('0x55')],{})[_0xb5f5('0x1a')](respondWithResult(_0x25fc65,0xc9))[_0xb5f5('0x24')](handleError(_0x25fc65,null));};exports[_0xb5f5('0x30')]=function(_0x62c5e2,_0x1a16e2){if(_0x62c5e2[_0xb5f5('0x55')]['id']){delete _0x62c5e2[_0xb5f5('0x55')]['id'];}return db[_0xb5f5('0x4e')][_0xb5f5('0x53')]({'where':{'id':_0x62c5e2[_0xb5f5('0x56')]['id']}})[_0xb5f5('0x1a')](handleEntityNotFound(_0x1a16e2,null))[_0xb5f5('0x1a')](saveUpdates(_0x62c5e2['body'],null))['then'](respondWithResult(_0x1a16e2,null))[_0xb5f5('0x24')](handleError(_0x1a16e2,null));};exports[_0xb5f5('0x31')]=function(_0x1cd46e,_0x567038){return db[_0xb5f5('0x4e')][_0xb5f5('0x53')]({'where':{'id':_0x1cd46e[_0xb5f5('0x56')]['id']}})['then'](handleEntityNotFound(_0x567038,null))['then'](removeEntity(_0x567038,null))[_0xb5f5('0x24')](handleError(_0x567038,null));};exports[_0xb5f5('0x57')]=function(_0x594aae,_0x354147){return db[_0xb5f5('0x4e')]['describe']()[_0xb5f5('0x1a')](respondWithResult(_0x354147,null))['catch'](handleError(_0x354147,null));};var interaction_log=require(_0xb5f5('0x58'))(_0xb5f5('0x59'));exports['accept']=function(_0x521abf,_0x186489,_0x48726d){var _0x27478d={'agent':{},'channel':_0xb5f5('0x5a')};if(_0x521abf[_0xb5f5('0x55')]['id']){delete _0x521abf['body']['id'];}_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x5b')]=!![];_0x521abf[_0xb5f5('0x55')]['readAt']=moment()['format'](_0xb5f5('0x5c'));_0x521abf['body'][_0xb5f5('0x5d')]=_0x521abf['body'][_0xb5f5('0x5d')]||_0x521abf[_0xb5f5('0x5e')]['id'];_0x27478d[_0xb5f5('0x5f')]['id']=_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x5d')];return db['ChatMessage'][_0xb5f5('0x53')]({'where':{'id':_0x521abf['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x186489,null))[_0xb5f5('0x1a')](saveUpdates(_0x521abf[_0xb5f5('0x55')],null))[_0xb5f5('0x1a')](function(_0x45c7bf){if(_0x45c7bf){_0x27478d[_0xb5f5('0x21')]=_0x45c7bf[_0xb5f5('0x60')]({'plain':!![]});return db['ChatInteraction'][_0xb5f5('0x53')]({'where':{'id':_0x45c7bf[_0xb5f5('0x61')]}});}return null;})[_0xb5f5('0x1a')](handleEntityNotFound(_0x186489,null))[_0xb5f5('0x1a')](function(_0x22fb46){if(_0x22fb46){return _0x22fb46['update']({'UserId':_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x5d')],'read1stAt':_[_0xb5f5('0x62')](_0x22fb46[_0xb5f5('0x63')])?moment()[_0xb5f5('0x64')](_0xb5f5('0x5c')):undefined});}return null;})[_0xb5f5('0x1a')](function(_0x477c59){if(_0x477c59){_0x27478d[_0xb5f5('0x65')]=_0x477c59[_0xb5f5('0x60')]({'plain':!![]});interaction_log[_0xb5f5('0x1b')](_0xb5f5('0x66'),_0x521abf[_0xb5f5('0x5e')]['id'],_0x521abf[_0xb5f5('0x5e')][_0xb5f5('0x34')],_0x521abf[_0xb5f5('0x5e')][_0xb5f5('0x67')],_0x27478d[_0xb5f5('0x65')]['id'],_0x521abf[_0xb5f5('0x55')]?JSON[_0xb5f5('0x1e')](_0x521abf[_0xb5f5('0x55')]):_0xb5f5('0x68'));return respondWithRpcPromise('AcceptMessage',_0xb5f5('0x69'),_0x27478d);}return null;})[_0xb5f5('0x1a')](function(_0xc1c7f2){var _0x357ead=_0xb5f5('0x6a')+_0xc1c7f2[_0xb5f5('0x21')][_0xb5f5('0x6b')];return db[_0xb5f5('0x6c')][_0xb5f5('0x3d')](_0x357ead,{'type':db[_0xb5f5('0x6d')][_0xb5f5('0x6e')]['SELECT'],'raw':!![]})[_0xb5f5('0x1a')](function(_0x246c3d){return _0x246c3d;});})['then'](function(_0x133c8a){if(_0x133c8a){_0x27478d[_0xb5f5('0x21')][_0xb5f5('0x6f')]=_0x133c8a[0x0];if(!_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x5d')])return;return db['User'][_0xb5f5('0x53')]({'where':{'id':_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x5d')],'role':'agent'},'attributes':['id',_0xb5f5('0x34'),_0xb5f5('0x70'),_0xb5f5('0x71'),'internal'],'raw':!![]});}return null;})[_0xb5f5('0x1a')](function(_0x4cbc78){if(!_0x4cbc78)return null;_0x27478d[_0xb5f5('0x21')][_0xb5f5('0x5f')]=_0x4cbc78;return _0x27478d;})['then'](function(_0x40db65){if(_0x40db65){if(_0x521abf[_0xb5f5('0x55')][_0xb5f5('0x72')]){_0x27478d[_0xb5f5('0x21')][_0xb5f5('0x73')]=util['format'](_0xb5f5('0x74'),_0x521abf[_0xb5f5('0x5e')][_0xb5f5('0x34')]);_0x27478d['message'][_0xb5f5('0x75')]=_0x27478d[_0xb5f5('0x75')];_0x27478d[_0xb5f5('0x21')][_0xb5f5('0x76')]=_0x27478d[_0xb5f5('0x75')];_0x27478d[_0xb5f5('0x21')][_0xb5f5('0x77')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb5f5('0x78'),'message':_[_0xb5f5('0x4c')](_0x27478d[_0xb5f5('0x21')],JSON[_0xb5f5('0x79')](_0x27478d[_0xb5f5('0x65')][_0xb5f5('0x7a')]))},client9002)[_0xb5f5('0x1a')](function(){return _0x27478d;});}return _0x27478d;}return null;})[_0xb5f5('0x1a')](respondWithResult(_0x186489,null))[_0xb5f5('0x24')](handleError(_0x186489,null));};var interaction_log=require(_0xb5f5('0x58'))(_0xb5f5('0x59'));exports[_0xb5f5('0x2f')]=function(_0x3e8f15,_0x4563fc,_0x5c788e){var _0x56af7a={'agent':{},'channel':_0xb5f5('0x5a')};if(_0x3e8f15[_0xb5f5('0x55')]['id']){delete _0x3e8f15['body']['id'];}_0x3e8f15[_0xb5f5('0x55')][_0xb5f5('0x5d')]=_0x3e8f15[_0xb5f5('0x55')][_0xb5f5('0x5d')]||_0x3e8f15[_0xb5f5('0x5e')]['id'];_0x56af7a[_0xb5f5('0x5f')]['id']=_0x3e8f15[_0xb5f5('0x55')][_0xb5f5('0x5d')];return db[_0xb5f5('0x4e')][_0xb5f5('0x53')]({'where':{'id':_0x3e8f15['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4563fc,null))[_0xb5f5('0x1a')](function(_0x34ffcc){if(_0x34ffcc){_0x56af7a['message']=_0x34ffcc[_0xb5f5('0x60')]({'plain':!![]});return db[_0xb5f5('0x7b')][_0xb5f5('0x53')]({'where':{'id':_0x34ffcc['ChatInteractionId']}});}return null;})[_0xb5f5('0x1a')](handleEntityNotFound(_0x4563fc,null))[_0xb5f5('0x1a')](function(_0x112fe9){if(_0x112fe9){_0x56af7a[_0xb5f5('0x65')]=_0x112fe9[_0xb5f5('0x60')]({'plain':!![]});interaction_log[_0xb5f5('0x1b')](_0xb5f5('0x7c'),_0x3e8f15['user']['id'],_0x3e8f15[_0xb5f5('0x5e')][_0xb5f5('0x34')],_0x3e8f15[_0xb5f5('0x5e')]['role'],_0x56af7a[_0xb5f5('0x65')]['id'],_0x3e8f15[_0xb5f5('0x55')]?JSON[_0xb5f5('0x1e')](_0x3e8f15['body']):_0xb5f5('0x68'));return respondWithRpcPromise(_0xb5f5('0x7d'),_0xb5f5('0x7e'),_0x56af7a);}return null;})[_0xb5f5('0x1a')](function(_0x47832e){var _0x17c7b9=_0xb5f5('0x6a')+_0x47832e[_0xb5f5('0x21')]['ContactId'];return db[_0xb5f5('0x6c')][_0xb5f5('0x3d')](_0x17c7b9,{'type':db[_0xb5f5('0x6d')][_0xb5f5('0x6e')][_0xb5f5('0x7f')],'raw':!![]})['then'](function(_0x2fd777){return _0x2fd777;});})['then'](function(_0x2972ea){if(_0x2972ea){_0x56af7a[_0xb5f5('0x21')][_0xb5f5('0x6f')]=_0x2972ea[0x0];if(!_0x3e8f15[_0xb5f5('0x55')][_0xb5f5('0x5d')])return;return db[_0xb5f5('0x80')][_0xb5f5('0x53')]({'where':{'id':_0x3e8f15['body'][_0xb5f5('0x5d')],'role':_0xb5f5('0x5f')},'attributes':['id',_0xb5f5('0x34'),_0xb5f5('0x70'),_0xb5f5('0x71'),_0xb5f5('0x81')],'raw':!![]});}return null;})[_0xb5f5('0x1a')](function(_0x1b0331){if(!_0x1b0331)return null;_0x56af7a[_0xb5f5('0x21')][_0xb5f5('0x5f')]=_0x1b0331;return _0x56af7a;})['then'](function(_0x5da01a){if(_0x5da01a){_0x5da01a[_0xb5f5('0x21')][_0xb5f5('0x73')]=util['format'](_0xb5f5('0x74'),_0x3e8f15[_0xb5f5('0x5e')][_0xb5f5('0x34')]);_0x5da01a[_0xb5f5('0x21')][_0xb5f5('0x75')]=_0x56af7a['channel'];_0x5da01a[_0xb5f5('0x21')][_0xb5f5('0x76')]=_0x56af7a[_0xb5f5('0x75')];_0x5da01a['message']['event']=_0xb5f5('0x2f');respondWithRpcPromise(_0xb5f5('0x82'),'EventManager',{'event':_0xb5f5('0x83'),'message':_['merge'](_0x56af7a[_0xb5f5('0x21')],JSON['parse'](_0x56af7a['interaction'][_0xb5f5('0x7a')]))},client9002);return _0x56af7a;}return null;})['then'](respondWithResult(_0x4563fc,null))[_0xb5f5('0x24')](handleError(_0x4563fc,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 027b88a..66030c5 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 _0xa312=['exports','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x5a2436,_0x11375a){var _0x2d8468=function(_0x5b77b9){while(--_0x5b77b9){_0x5a2436['push'](_0x5a2436['shift']());}};_0x2d8468(++_0x11375a);}(_0xa312,0x1f1));var _0x2a31=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0xa312[_0x55ef8b];return _0x359c84;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2a31('0x0'))['db'][_0x2a31('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a31('0x2'),'afterUpdate':_0x2a31('0x3'),'afterDestroy':_0x2a31('0x4')};function emitEvent(_0x417c17){return function(_0x57fd8b,_0x197584,_0x54de06){ChatMessageEvents[_0x2a31('0x5')](_0x417c17+':'+_0x57fd8b['id'],_0x57fd8b);ChatMessageEvents[_0x2a31('0x5')](_0x417c17,_0x57fd8b);_0x54de06(null);};}for(var e in events){if(events[_0x2a31('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2a31('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9e61=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x33f54b,_0x41df7d){var _0x191255=function(_0x1c4faf){while(--_0x1c4faf){_0x33f54b['push'](_0x33f54b['shift']());}};_0x191255(++_0x41df7d);}(_0x9e61,0x113));var _0x19e6=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x9e61[_0x556927];return _0x5f1235;};'use strict';var EventEmitter=require(_0x19e6('0x0'));var ChatMessage=require(_0x19e6('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x19e6('0x2')](0x0);var events={'afterCreate':_0x19e6('0x3'),'afterUpdate':'update','afterDestroy':_0x19e6('0x4')};function emitEvent(_0x3bee10){return function(_0x7c3b96,_0x33a137,_0x549fd4){ChatMessageEvents[_0x19e6('0x5')](_0x3bee10+':'+_0x7c3b96['id'],_0x7c3b96);ChatMessageEvents[_0x19e6('0x5')](_0x3bee10,_0x7c3b96);_0x549fd4(null);};}for(var e in events){if(events[_0x19e6('0x6')](e)){var event=events[e];ChatMessage[_0x19e6('0x7')](e,emitEvent(event));}}module[_0x19e6('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a3368cf..fd18d0e 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 _0x3c79=['ChatInteraction','findOne','ChatInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x1fab82,_0x587291){var _0x4e3378=function(_0x364a28){while(--_0x364a28){_0x1fab82['push'](_0x1fab82['shift']());}};_0x4e3378(++_0x587291);}(_0x3c79,0xef));var _0x93c7=function(_0x183878,_0x23a8a2){_0x183878=_0x183878-0x0;var _0x4688cf=_0x3c79[_0x183878];return _0x4688cf;};'use strict';var _=require(_0x93c7('0x0'));var util=require(_0x93c7('0x1'));var logger=require('../../config/logger')(_0x93c7('0x2'));var moment=require(_0x93c7('0x3'));var BPromise=require(_0x93c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93c7('0x5'));var rimraf=require(_0x93c7('0x6'));var config=require('../../config/environment');var attributes=require(_0x93c7('0x7'));module[_0x93c7('0x8')]=function(_0x1827d4,_0x363419){return _0x1827d4[_0x93c7('0x9')](_0x93c7('0xa'),attributes,{'tableName':_0x93c7('0xb'),'paranoid':![],'indexes':[{'name':_0x93c7('0xc'),'fields':[_0x93c7('0xd')],'type':_0x93c7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbc7194,_0x1a331a,_0xdea5a5){var _0x93c935=_0x1827d4[_0x93c7('0xf')];var _0xa25754=_0xbc7194['get']({'plain':!![]});if(_0xa25754[_0x93c7('0x10')][_0x93c7('0x11')]()==='in'||_0xa25754['direction']['toLowerCase']()===_0x93c7('0x12')&&!_0xa25754[_0x93c7('0x13')]&&!_[_0x93c7('0x14')](_0xa25754[_0x93c7('0x15')])){_0x93c935[_0x93c7('0x16')][_0x93c7('0x17')]({'where':{'id':_0xa25754[_0x93c7('0x18')]}})['then'](function(_0xc2c892){if(_0xc2c892){_0xc2c892[_0x93c7('0x19')]({'lastMsgAt':_0xa25754['createdAt'],'lastMsgDirection':_0xa25754['direction']['toLowerCase']()});}})[_0x93c7('0x1a')](function(_0x1b291f){console['error'](_0x1b291f);});}_0xdea5a5();}},'charset':_0x93c7('0x1b'),'collate':_0x93c7('0x1c')});}; \ No newline at end of file +var _0xf631=['update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0xc54604,_0xf604a1){var _0x375828=function(_0x44f1fd){while(--_0x44f1fd){_0xc54604['push'](_0xc54604['shift']());}};_0x375828(++_0xf604a1);}(_0xf631,0x1a9));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1f63('0x0'));var util=require(_0x1f63('0x1'));var logger=require(_0x1f63('0x2'))('api');var moment=require(_0x1f63('0x3'));var BPromise=require(_0x1f63('0x4'));var rp=require(_0x1f63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f63('0x6'));var config=require(_0x1f63('0x7'));var attributes=require(_0x1f63('0x8'));module[_0x1f63('0x9')]=function(_0xf5b4d5,_0x14b5e7){return _0xf5b4d5[_0x1f63('0xa')](_0x1f63('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x1f63('0xc'),'fields':[_0x1f63('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50f565,_0x1b9776,_0x252c75){var _0x28e359=_0xf5b4d5[_0x1f63('0xe')];var _0x4420ba=_0x50f565[_0x1f63('0xf')]({'plain':!![]});if(_0x4420ba[_0x1f63('0x10')]['toLowerCase']()==='in'||_0x4420ba[_0x1f63('0x10')][_0x1f63('0x11')]()===_0x1f63('0x12')&&!_0x4420ba[_0x1f63('0x13')]&&!_['isNil'](_0x4420ba[_0x1f63('0x14')])){_0x28e359[_0x1f63('0x15')][_0x1f63('0x16')]({'where':{'id':_0x4420ba[_0x1f63('0x17')]}})[_0x1f63('0x18')](function(_0x1de417){if(_0x1de417){_0x1de417[_0x1f63('0x19')]({'lastMsgAt':_0x4420ba['createdAt'],'lastMsgDirection':_0x4420ba[_0x1f63('0x10')][_0x1f63('0x11')]()});}})[_0x1f63('0x1a')](function(_0x568772){console[_0x1f63('0x1b')](_0x568772);});}_0x252c75();}},'charset':_0x1f63('0x1c'),'collate':_0x1f63('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 932577a..c3406fc 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 _0xc677=['error','code','message','result','catch','CreateChatMessage','ChatMessage','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xc677,0x18a));var _0x7c67=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc677[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7c67('0x0'));var util=require(_0x7c67('0x1'));var moment=require(_0x7c67('0x2'));var BPromise=require(_0x7c67('0x3'));var rs=require(_0x7c67('0x4'));var fs=require('fs');var Redis=require(_0x7c67('0x5'));var db=require(_0x7c67('0x6'))['db'];var utils=require(_0x7c67('0x7'));var logger=require(_0x7c67('0x8'))(_0x7c67('0x9'));var config=require(_0x7c67('0xa'));var jayson=require(_0x7c67('0xb'));var client=jayson[_0x7c67('0xc')]['http']({'port':0x232a});config[_0x7c67('0xd')]=_['defaults'](config[_0x7c67('0xd')],{'host':_0x7c67('0xe'),'port':0x18eb});var socket=require(_0x7c67('0xf'))(new Redis(config[_0x7c67('0xd')]));require(_0x7c67('0x10'))[_0x7c67('0x11')](socket);function respondWithRpcPromise(_0x82e663,_0x290c3d,_0x3e9cc0){return new BPromise(function(_0x3e35d6,_0x3219a3){return client[_0x7c67('0x12')](_0x82e663,_0x3e9cc0)[_0x7c67('0x13')](function(_0x27a0e8){logger[_0x7c67('0x14')](_0x7c67('0x15'),_0x290c3d,'request\x20sent');logger[_0x7c67('0x16')](_0x7c67('0x17'),_0x290c3d,_0x7c67('0x18'),JSON[_0x7c67('0x19')](_0x27a0e8));if(_0x27a0e8[_0x7c67('0x1a')]){if(_0x27a0e8[_0x7c67('0x1a')][_0x7c67('0x1b')]===0x1f4){logger[_0x7c67('0x1a')](_0x7c67('0x15'),_0x290c3d,_0x27a0e8[_0x7c67('0x1a')][_0x7c67('0x1c')]);return _0x3219a3(_0x27a0e8[_0x7c67('0x1a')]['message']);}logger[_0x7c67('0x1a')](_0x7c67('0x15'),_0x290c3d,_0x27a0e8[_0x7c67('0x1a')]['message']);return _0x3e35d6(_0x27a0e8[_0x7c67('0x1a')]['message']);}else{logger['info'](_0x7c67('0x15'),_0x290c3d,_0x7c67('0x18'));_0x3e35d6(_0x27a0e8[_0x7c67('0x1d')][_0x7c67('0x1c')]);}})[_0x7c67('0x1e')](function(_0x17319d){logger[_0x7c67('0x1a')](_0x7c67('0x15'),_0x290c3d,_0x17319d);_0x3219a3(_0x17319d);});});}exports[_0x7c67('0x1f')]=function(_0x55d4a9){var _0xd4045f=this;return new Promise(function(_0x2092fd,_0xb1f6a3){return db[_0x7c67('0x20')]['create'](_0x55d4a9[_0x7c67('0x21')],{'raw':_0x55d4a9['options']?_0x55d4a9['options'][_0x7c67('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x339e9f){logger['info']('CreateChatMessage',_0x55d4a9);logger[_0x7c67('0x16')](_0x7c67('0x1f'),_0x55d4a9,JSON[_0x7c67('0x19')](_0x339e9f));_0x2092fd(_0x339e9f);})['catch'](function(_0x4f7b05){logger[_0x7c67('0x1a')]('CreateChatMessage',_0x4f7b05[_0x7c67('0x1c')],_0x55d4a9);_0xb1f6a3(_0xd4045f[_0x7c67('0x1a')](0x1f4,_0x4f7b05['message']));});});}; \ No newline at end of file +var _0xd21e=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info'];(function(_0x220d3d,_0x38acb4){var _0x362cef=function(_0x11beee){while(--_0x11beee){_0x220d3d['push'](_0x220d3d['shift']());}};_0x362cef(++_0x38acb4);}(_0xd21e,0x1e5));var _0xed21=function(_0x3bf85d,_0x103a72){_0x3bf85d=_0x3bf85d-0x0;var _0x173be3=_0xd21e[_0x3bf85d];return _0x173be3;};'use strict';var _=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var moment=require(_0xed21('0x2'));var BPromise=require(_0xed21('0x3'));var rs=require(_0xed21('0x4'));var fs=require('fs');var Redis=require(_0xed21('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed21('0x6'));var logger=require(_0xed21('0x7'))(_0xed21('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed21('0x9')][_0xed21('0xa')]({'port':0x232a});config['redis']=_[_0xed21('0xb')](config[_0xed21('0xc')],{'host':_0xed21('0xd'),'port':0x18eb});var socket=require(_0xed21('0xe'))(new Redis(config[_0xed21('0xc')]));require(_0xed21('0xf'))[_0xed21('0x10')](socket);function respondWithRpcPromise(_0x5f38a9,_0x179df6,_0x7321da){return new BPromise(function(_0x2c2346,_0x2a5468){return client[_0xed21('0x11')](_0x5f38a9,_0x7321da)['then'](function(_0x43053a){logger[_0xed21('0x12')](_0xed21('0x13'),_0x179df6,_0xed21('0x14'));logger[_0xed21('0x15')](_0xed21('0x16'),_0x179df6,_0xed21('0x14'),JSON[_0xed21('0x17')](_0x43053a));if(_0x43053a[_0xed21('0x18')]){if(_0x43053a['error'][_0xed21('0x19')]===0x1f4){logger[_0xed21('0x18')](_0xed21('0x13'),_0x179df6,_0x43053a[_0xed21('0x18')][_0xed21('0x1a')]);return _0x2a5468(_0x43053a[_0xed21('0x18')][_0xed21('0x1a')]);}logger[_0xed21('0x18')](_0xed21('0x13'),_0x179df6,_0x43053a['error']['message']);return _0x2c2346(_0x43053a[_0xed21('0x18')][_0xed21('0x1a')]);}else{logger['info'](_0xed21('0x13'),_0x179df6,_0xed21('0x14'));_0x2c2346(_0x43053a[_0xed21('0x1b')][_0xed21('0x1a')]);}})[_0xed21('0x1c')](function(_0x4eedd7){logger[_0xed21('0x18')](_0xed21('0x13'),_0x179df6,_0x4eedd7);_0x2a5468(_0x4eedd7);});});}exports[_0xed21('0x1d')]=function(_0x1fea8c){var _0x3bba49=this;return new Promise(function(_0x837a11,_0x47042c){return db[_0xed21('0x1e')][_0xed21('0x1f')](_0x1fea8c[_0xed21('0x20')],{'raw':_0x1fea8c[_0xed21('0x21')]?_0x1fea8c[_0xed21('0x21')][_0xed21('0x22')]===undefined?!![]:![]:!![]})[_0xed21('0x23')](function(_0x318fba){logger['info']('CreateChatMessage',_0x1fea8c);logger[_0xed21('0x15')]('CreateChatMessage',_0x1fea8c,JSON[_0xed21('0x17')](_0x318fba));_0x837a11(_0x318fba);})[_0xed21('0x1c')](function(_0x20ae51){logger['error']('CreateChatMessage',_0x20ae51[_0xed21('0x1a')],_0x1fea8c);_0x47042c(_0x3bba49[_0xed21('0x18')](0x1f4,_0x20ae51[_0xed21('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 276c18e..45b3123 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 _0x42b0=['register','length','./chatMessage.events','save','update','removeListener'];(function(_0x76d2c0,_0x1f52f1){var _0x46d590=function(_0x50e08b){while(--_0x50e08b){_0x76d2c0['push'](_0x76d2c0['shift']());}};_0x46d590(++_0x1f52f1);}(_0x42b0,0xbc));var _0x042b=function(_0x18bccf,_0x515956){_0x18bccf=_0x18bccf-0x0;var _0x3d07bd=_0x42b0[_0x18bccf];return _0x3d07bd;};'use strict';var ChatMessageEvents=require(_0x042b('0x0'));var events=[_0x042b('0x1'),'remove',_0x042b('0x2')];function createListener(_0x4bf494,_0x1d7aa3){return function(_0x5a7e27){_0x1d7aa3['emit'](_0x4bf494,_0x5a7e27);};}function removeListener(_0x401a0c,_0xd73d53){return function(){ChatMessageEvents[_0x042b('0x3')](_0x401a0c,_0xd73d53);};}exports[_0x042b('0x4')]=function(_0x135bc1){for(var _0x5d194a=0x0,_0x51c41c=events[_0x042b('0x5')];_0x5d194a<_0x51c41c;_0x5d194a++){var _0x1ec28f=events[_0x5d194a];var _0x49ab70=createListener('chatMessage:'+_0x1ec28f,_0x135bc1);ChatMessageEvents['on'](_0x1ec28f,_0x49ab70);}}; \ No newline at end of file +var _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x3645,0x154));var _0x5364=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x3645[_0x1af5b2];return _0xf1aa2d;};'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 7aa027e..2a9dda4 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 _0x685d=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','tracked','chatmessage:create','create','/:id','put','/:id/accept','/:id/reject'];(function(_0xa74972,_0x4148b3){var _0x172494=function(_0x3e2a3d){while(--_0x3e2a3d){_0xa74972['push'](_0xa74972['shift']());}};_0x172494(++_0x4148b3);}(_0x685d,0x99));var _0xd685=function(_0x292d80,_0x18a9ab){_0x292d80=_0x292d80-0x0;var _0x464d14=_0x685d[_0x292d80];return _0x464d14;};'use strict';var multer=require(_0xd685('0x0'));var util=require(_0xd685('0x1'));var path=require(_0xd685('0x2'));var timeout=require(_0xd685('0x3'));var express=require(_0xd685('0x4'));var router=express['Router']();var fs_extra=require(_0xd685('0x5'));var auth=require(_0xd685('0x6'));var interaction=require(_0xd685('0x7'));var config=require(_0xd685('0x8'));var controller=require(_0xd685('0x9'));router[_0xd685('0xa')]('/',auth[_0xd685('0xb')](),controller['index']);router['get'](_0xd685('0xc'),auth['isAuthenticated'](),controller[_0xd685('0xd')]);router[_0xd685('0xa')]('/:id',auth[_0xd685('0xb')](),controller[_0xd685('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xd685('0xf')]('chat',_0xd685('0x10')),controller[_0xd685('0x11')]);router['put'](_0xd685('0x12'),controller['update']);router[_0xd685('0x13')](_0xd685('0x14'),auth[_0xd685('0xb')](),controller['accept']);router[_0xd685('0x13')](_0xd685('0x15'),auth[_0xd685('0xb')](),controller['reject']);router[_0xd685('0x16')](_0xd685('0x12'),auth['isAuthenticated'](),controller[_0xd685('0x17')]);module[_0xd685('0x18')]=router; \ No newline at end of file +var _0x0f98=['accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','create','put','update','/:id/accept'];(function(_0x1e9990,_0xff2bd3){var _0x43eb71=function(_0x49b5d5){while(--_0x49b5d5){_0x1e9990['push'](_0x1e9990['shift']());}};_0x43eb71(++_0xff2bd3);}(_0x0f98,0x1c0));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x80f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x80f9('0x1'));var express=require(_0x80f9('0x2'));var router=express['Router']();var fs_extra=require(_0x80f9('0x3'));var auth=require(_0x80f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x80f9('0x5'));var controller=require(_0x80f9('0x6'));router[_0x80f9('0x7')]('/',auth[_0x80f9('0x8')](),controller[_0x80f9('0x9')]);router[_0x80f9('0x7')](_0x80f9('0xa'),auth['isAuthenticated'](),controller[_0x80f9('0xb')]);router[_0x80f9('0x7')](_0x80f9('0xc'),auth[_0x80f9('0x8')](),controller[_0x80f9('0xd')]);router[_0x80f9('0xe')]('/',auth[_0x80f9('0x8')](),interaction['tracked'](_0x80f9('0xf'),'chatmessage:create'),controller[_0x80f9('0x10')]);router[_0x80f9('0x11')]('/:id',controller[_0x80f9('0x12')]);router[_0x80f9('0x11')](_0x80f9('0x13'),auth['isAuthenticated'](),controller[_0x80f9('0x14')]);router[_0x80f9('0x11')](_0x80f9('0x15'),auth[_0x80f9('0x8')](),controller[_0x80f9('0x16')]);router[_0x80f9('0x17')](_0x80f9('0xc'),auth[_0x80f9('0x8')](),controller[_0x80f9('0x18')]);module[_0x80f9('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e6bfa3c..1d7b46d 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 _0x2032=['medium','exports','TEXT'];(function(_0x1b1ed8,_0x2b0f38){var _0x33e1d6=function(_0x545491){while(--_0x545491){_0x1b1ed8['push'](_0x1b1ed8['shift']());}};_0x33e1d6(++_0x2b0f38);}(_0x2032,0xd9));var _0x2203=function(_0x39b4b4,_0x2255c1){_0x39b4b4=_0x39b4b4-0x0;var _0x142af1=_0x2032[_0x39b4b4];return _0x142af1;};'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 +var _0x2032=['medium','exports','TEXT'];(function(_0x5cc7e3,_0x1d79c1){var _0x2ab05d=function(_0x40ba1f){while(--_0x40ba1f){_0x5cc7e3['push'](_0x5cc7e3['shift']());}};_0x2ab05d(++_0x1d79c1);}(_0x2032,0xd9));var _0x2203=function(_0x58a53d,_0x5dd249){_0x58a53d=_0x58a53d-0x0;var _0x373202=_0x2032[_0x58a53d];return _0x373202;};'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 9b4a7ba..fdda5c9 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x7a54,0x106));var _0x47a5=function(_0x55d236,_0x33e798){_0x55d236=_0x55d236-0x0;var _0x1bc851=_0x7a54[_0x55d236];return _0x1bc851;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x56d546,_0x273f3d){var _0x5a5f86=function(_0x3c6c40){while(--_0x3c6c40){_0x56d546['push'](_0x56d546['shift']());}};_0x5a5f86(++_0x273f3d);}(_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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index ede407e..c3cde3f 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 _0x4a6d=['hook','exports','../../mysqldb','save','update','remove','hasOwnProperty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4a6d,0x121));var _0xd4a6=function(_0x45c943,_0xb1e866){_0x45c943=_0x45c943-0x0;var _0x5a254b=_0x4a6d[_0x45c943];return _0x5a254b;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xd4a6('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4a6('0x1'),'afterUpdate':_0xd4a6('0x2'),'afterDestroy':_0xd4a6('0x3')};function emitEvent(_0x9cfdf){return function(_0x49994a,_0x13fd34,_0x4ec60f){ChatOfflineMessageEvents['emit'](_0x9cfdf+':'+_0x49994a['id'],_0x49994a);ChatOfflineMessageEvents['emit'](_0x9cfdf,_0x49994a);_0x4ec60f(null);};}for(var e in events){if(events[_0xd4a6('0x4')](e)){var event=events[e];ChatOfflineMessage[_0xd4a6('0x5')](e,emitEvent(event));}}module[_0xd4a6('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x71b4=['ChatOfflineMessage','save','update','remove','emit','hook','exports'];(function(_0x5edf65,_0x87b4fd){var _0x4e30c7=function(_0x2dce6f){while(--_0x2dce6f){_0x5edf65['push'](_0x5edf65['shift']());}};_0x4e30c7(++_0x87b4fd);}(_0x71b4,0x7e));var _0x471b=function(_0x47865a,_0x39c3e6){_0x47865a=_0x47865a-0x0;var _0x6d70ad=_0x71b4[_0x47865a];return _0x6d70ad;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x471b('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x471b('0x1'),'afterUpdate':_0x471b('0x2'),'afterDestroy':_0x471b('0x3')};function emitEvent(_0xf76fde){return function(_0x4ef8f2,_0x10e5bd,_0x2eaaf4){ChatOfflineMessageEvents[_0x471b('0x4')](_0xf76fde+':'+_0x4ef8f2['id'],_0x4ef8f2);ChatOfflineMessageEvents[_0x471b('0x4')](_0xf76fde,_0x4ef8f2);_0x2eaaf4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x471b('0x5')](e,emitEvent(event));}}module[_0x471b('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b0efea4..fb374db 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 _0xca48=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xca48,0x181));var _0x8ca4=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xca48[_0x283127];return _0x43da5d;};'use strict';var attributes=require(_0x8ca4('0x0'));module['exports']=function(_0x1c10d5){return _0x1c10d5[_0x8ca4('0x1')](_0x8ca4('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8ca4('0x3')});}; \ No newline at end of file +var _0xd0da=['define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x150d7d,_0x3e113d){var _0xb0b305=function(_0x21fd3a){while(--_0x21fd3a){_0x150d7d['push'](_0x150d7d['shift']());}};_0xb0b305(++_0x3e113d);}(_0xd0da,0x1a8));var _0xad0d=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0xd0da[_0x466a1a];return _0x577165;};'use strict';var attributes=require(_0xad0d('0x0'));module['exports']=function(_0x4befef){return _0x4befef[_0xad0d('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0xad0d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad0d('0x3'),'collate':_0xad0d('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8e7d480..b116dca 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 _0x3836=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment'];(function(_0x11ec5d,_0x144772){var _0x45d165=function(_0x45b124){while(--_0x45b124){_0x11ec5d['push'](_0x11ec5d['shift']());}};_0x45d165(++_0x144772);}(_0x3836,0x140));var _0x6383=function(_0x2304c0,_0xea170e){_0x2304c0=_0x2304c0-0x0;var _0x28eb5e=_0x3836[_0x2304c0];return _0x28eb5e;};'use strict';var _=require(_0x6383('0x0'));var util=require('util');var moment=require(_0x6383('0x1'));var BPromise=require(_0x6383('0x2'));var rs=require(_0x6383('0x3'));var fs=require('fs');var Redis=require(_0x6383('0x4'));var db=require(_0x6383('0x5'))['db'];var utils=require(_0x6383('0x6'));var logger=require('../../config/logger')(_0x6383('0x7'));var config=require(_0x6383('0x8'));var jayson=require(_0x6383('0x9'));var client=jayson[_0x6383('0xa')][_0x6383('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x338653,_0x26e828,_0x25c287){return new BPromise(function(_0x3d2182,_0x5a249e){return client['request'](_0x338653,_0x25c287)[_0x6383('0xc')](function(_0x24b7a4){logger[_0x6383('0xd')](_0x6383('0xe'),_0x26e828,_0x6383('0xf'));logger[_0x6383('0x10')](_0x6383('0x11'),_0x26e828,'request\x20sent',JSON['stringify'](_0x24b7a4));if(_0x24b7a4[_0x6383('0x12')]){if(_0x24b7a4[_0x6383('0x12')][_0x6383('0x13')]===0x1f4){logger[_0x6383('0x12')](_0x6383('0xe'),_0x26e828,_0x24b7a4[_0x6383('0x12')][_0x6383('0x14')]);return _0x5a249e(_0x24b7a4['error']['message']);}logger[_0x6383('0x12')](_0x6383('0xe'),_0x26e828,_0x24b7a4[_0x6383('0x12')][_0x6383('0x14')]);return _0x3d2182(_0x24b7a4[_0x6383('0x12')][_0x6383('0x14')]);}else{logger[_0x6383('0xd')](_0x6383('0xe'),_0x26e828,_0x6383('0xf'));_0x3d2182(_0x24b7a4[_0x6383('0x15')]['message']);}})[_0x6383('0x16')](function(_0x5a0634){logger[_0x6383('0x12')](_0x6383('0xe'),_0x26e828,_0x5a0634);_0x5a249e(_0x5a0634);});});} \ No newline at end of file +var _0x30ea=['client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x548690,_0x149dd7){var _0x4e67f5=function(_0x31a1a5){while(--_0x31a1a5){_0x548690['push'](_0x548690['shift']());}};_0x4e67f5(++_0x149dd7);}(_0x30ea,0x13a));var _0xa30e=function(_0x3e6c21,_0x4529e7){_0x3e6c21=_0x3e6c21-0x0;var _0x3dd960=_0x30ea[_0x3e6c21];return _0x3dd960;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa30e('0x0'));var BPromise=require(_0xa30e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa30e('0x2'));var db=require(_0xa30e('0x3'))['db'];var utils=require(_0xa30e('0x4'));var logger=require('../../config/logger')(_0xa30e('0x5'));var config=require(_0xa30e('0x6'));var jayson=require(_0xa30e('0x7'));var client=jayson[_0xa30e('0x8')][_0xa30e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x68172e,_0x37cf20,_0x1e6c67){return new BPromise(function(_0x5496aa,_0x5cbf14){return client[_0xa30e('0xa')](_0x68172e,_0x1e6c67)[_0xa30e('0xb')](function(_0x496e46){logger[_0xa30e('0xc')](_0xa30e('0xd'),_0x37cf20,_0xa30e('0xe'));logger[_0xa30e('0xf')](_0xa30e('0x10'),_0x37cf20,_0xa30e('0xe'),JSON[_0xa30e('0x11')](_0x496e46));if(_0x496e46[_0xa30e('0x12')]){if(_0x496e46[_0xa30e('0x12')][_0xa30e('0x13')]===0x1f4){logger[_0xa30e('0x12')](_0xa30e('0xd'),_0x37cf20,_0x496e46['error'][_0xa30e('0x14')]);return _0x5cbf14(_0x496e46[_0xa30e('0x12')]['message']);}logger[_0xa30e('0x12')](_0xa30e('0xd'),_0x37cf20,_0x496e46[_0xa30e('0x12')][_0xa30e('0x14')]);return _0x5496aa(_0x496e46[_0xa30e('0x12')][_0xa30e('0x14')]);}else{logger['info'](_0xa30e('0xd'),_0x37cf20,_0xa30e('0xe'));_0x5496aa(_0x496e46[_0xa30e('0x15')][_0xa30e('0x14')]);}})[_0xa30e('0x16')](function(_0x4ca320){logger[_0xa30e('0x12')](_0xa30e('0xd'),_0x37cf20,_0x4ca320);_0x5cbf14(_0x4ca320);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bbd5522..52cdcb7 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 _0x9671=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x11bc7e,_0x999be1){var _0x5056d3=function(_0x5b315f){while(--_0x5b315f){_0x11bc7e['push'](_0x11bc7e['shift']());}};_0x5056d3(++_0x999be1);}(_0x9671,0x6d));var _0x1967=function(_0x279ce7,_0x192ba8){_0x279ce7=_0x279ce7-0x0;var _0x2e4d69=_0x9671[_0x279ce7];return _0x2e4d69;};'use strict';var multer=require(_0x1967('0x0'));var util=require(_0x1967('0x1'));var path=require(_0x1967('0x2'));var timeout=require(_0x1967('0x3'));var express=require(_0x1967('0x4'));var router=express['Router']();var fs_extra=require(_0x1967('0x5'));var auth=require(_0x1967('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1967('0x7'));var controller=require(_0x1967('0x8'));router[_0x1967('0x9')]('/',auth[_0x1967('0xa')](),controller['index']);router[_0x1967('0x9')](_0x1967('0xb'),auth[_0x1967('0xa')](),controller[_0x1967('0xc')]);router[_0x1967('0x9')](_0x1967('0xd'),auth[_0x1967('0xa')](),controller['show']);router[_0x1967('0xe')]('/',auth[_0x1967('0xa')](),controller[_0x1967('0xf')]);router[_0x1967('0x10')]('/:id',auth[_0x1967('0xa')](),controller[_0x1967('0x11')]);router['delete'](_0x1967('0xd'),auth[_0x1967('0xa')](),controller['destroy']);module[_0x1967('0x12')]=router; \ No newline at end of file +var _0x933b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','multer','path'];(function(_0xf47aae,_0x24f5ba){var _0x17d719=function(_0x54c7fd){while(--_0x54c7fd){_0xf47aae['push'](_0xf47aae['shift']());}};_0x17d719(++_0x24f5ba);}(_0x933b,0x96));var _0xb933=function(_0x512368,_0x194577){_0x512368=_0x512368-0x0;var _0x456019=_0x933b[_0x512368];return _0x456019;};'use strict';var multer=require(_0xb933('0x0'));var util=require('util');var path=require(_0xb933('0x1'));var timeout=require(_0xb933('0x2'));var express=require(_0xb933('0x3'));var router=express[_0xb933('0x4')]();var fs_extra=require(_0xb933('0x5'));var auth=require(_0xb933('0x6'));var interaction=require(_0xb933('0x7'));var config=require(_0xb933('0x8'));var controller=require(_0xb933('0x9'));router['get']('/',auth[_0xb933('0xa')](),controller[_0xb933('0xb')]);router[_0xb933('0xc')]('/describe',auth[_0xb933('0xa')](),controller['describe']);router[_0xb933('0xc')](_0xb933('0xd'),auth[_0xb933('0xa')](),controller[_0xb933('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb933('0xf')]);router['put'](_0xb933('0xd'),auth[_0xb933('0xa')](),controller[_0xb933('0x10')]);router[_0xb933('0x11')](_0xb933('0xd'),auth['isAuthenticated'](),controller[_0xb933('0x12')]);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 b90fbf3..0dd9c1b 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 _0xce5e=['exports','ENUM','mouseOver','timeout','STRING'];(function(_0x1bcad6,_0x1ac0c){var _0x3c8778=function(_0x4d07a9){while(--_0x4d07a9){_0x1bcad6['push'](_0x1bcad6['shift']());}};_0x3c8778(++_0x1ac0c);}(_0xce5e,0x64));var _0xece5=function(_0x230bd0,_0x56529b){_0x230bd0=_0x230bd0-0x0;var _0x1ae9a1=_0xce5e[_0x230bd0];return _0x1ae9a1;};'use strict';var Sequelize=require('sequelize');module[_0xece5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xece5('0x1')](_0xece5('0x2'),_0xece5('0x3')),'defaultValue':_0xece5('0x2')},'selector':{'type':Sequelize[_0xece5('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1c32=['timeout','STRING','sequelize','exports','ENUM','mouseOver'];(function(_0x2702fc,_0x379255){var _0x47bfc6=function(_0x512bc7){while(--_0x512bc7){_0x2702fc['push'](_0x2702fc['shift']());}};_0x47bfc6(++_0x379255);}(_0x1c32,0x1ac));var _0x21c3=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x1c32[_0x3a78a0];return _0x48e917;};'use strict';var Sequelize=require(_0x21c3('0x0'));module[_0x21c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x21c3('0x2')](_0x21c3('0x3'),_0x21c3('0x4')),'defaultValue':_0x21c3('0x3')},'selector':{'type':Sequelize[_0x21c3('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 477d42a..d86745b 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 _0xc5c7=['query','filters','intersection','attributes','fields','length','include','merge','options','ChatProactiveAction','create','body','catch','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','name','send','show','params','model','keys','rawAttributes'];(function(_0x2900ca,_0x17a523){var _0x36342f=function(_0xeda161){while(--_0xeda161){_0x2900ca['push'](_0x2900ca['shift']());}};_0x36342f(++_0x17a523);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x162ea6,_0x4aecdc){_0x162ea6=_0x162ea6-0x0;var _0x4319ef=_0xc5c7[_0x162ea6];return _0x4319ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c5c('0x0'));var zipdir=require(_0x7c5c('0x1'));var jsonpatch=require(_0x7c5c('0x2'));var rp=require(_0x7c5c('0x3'));var moment=require(_0x7c5c('0x4'));var BPromise=require(_0x7c5c('0x5'));var Mustache=require('mustache');var util=require(_0x7c5c('0x6'));var path=require(_0x7c5c('0x7'));var sox=require(_0x7c5c('0x8'));var csv=require(_0x7c5c('0x9'));var ejs=require(_0x7c5c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c5c('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c5c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7c5c('0x9'));var querystring=require(_0x7c5c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c5c('0xe'));var qs=require(_0x7c5c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c5c('0x10'));var logger=require('../../config/logger')(_0x7c5c('0x11'));var utils=require('../../config/utils');var config=require(_0x7c5c('0x12'));var licenseUtil=require(_0x7c5c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207464,_0x326230){_0x326230=_0x326230||0xcc;return function(_0x3f1bb4){if(_0x3f1bb4){return _0x207464[_0x7c5c('0x14')](_0x326230);}return _0x207464[_0x7c5c('0x15')](_0x326230)[_0x7c5c('0x16')]();};}function respondWithResult(_0x184f0f,_0x33a9d2){_0x33a9d2=_0x33a9d2||0xc8;return function(_0x2f2285){if(_0x2f2285){return _0x184f0f[_0x7c5c('0x15')](_0x33a9d2)[_0x7c5c('0x17')](_0x2f2285);}};}function respondWithFilteredResult(_0x31bfdb,_0x2af6b3){return function(_0x1ac739){if(_0x1ac739){var _0x4c5b9d=typeof _0x2af6b3['offset']===_0x7c5c('0x18')&&typeof _0x2af6b3[_0x7c5c('0x19')]===_0x7c5c('0x18');var _0x266aea=_0x1ac739['count'];var _0x41bbee=_0x4c5b9d?0x0:_0x2af6b3[_0x7c5c('0x1a')];var _0x3f9704=_0x4c5b9d?_0x1ac739[_0x7c5c('0x1b')]:_0x2af6b3[_0x7c5c('0x1a')]+_0x2af6b3['limit'];var _0x568a95;if(_0x3f9704>=_0x266aea){_0x3f9704=_0x266aea;_0x568a95=0xc8;}else{_0x568a95=0xce;}_0x31bfdb[_0x7c5c('0x15')](_0x568a95);return _0x31bfdb[_0x7c5c('0x1c')](_0x7c5c('0x1d'),_0x41bbee+'-'+_0x3f9704+'/'+_0x266aea)['json'](_0x1ac739);}return null;};}function patchUpdates(_0x170896){return function(_0x1bf163){try{jsonpatch[_0x7c5c('0x1e')](_0x1bf163,_0x170896,!![]);}catch(_0x469b29){return BPromise[_0x7c5c('0x1f')](_0x469b29);}return _0x1bf163['save']();};}function saveUpdates(_0x28a95f,_0x42a551){return function(_0x116528){if(_0x116528){return _0x116528['update'](_0x28a95f)[_0x7c5c('0x20')](function(_0x42d9a0){return _0x42d9a0;});}return null;};}function removeEntity(_0x536916,_0xccd178){return function(_0x4641f3){if(_0x4641f3){return _0x4641f3[_0x7c5c('0x21')]()[_0x7c5c('0x20')](function(){_0x536916[_0x7c5c('0x15')](0xcc)[_0x7c5c('0x16')]();});}};}function handleEntityNotFound(_0x348da0,_0x348930){return function(_0x4673f8){if(!_0x4673f8){_0x348da0[_0x7c5c('0x14')](0x194);}return _0x4673f8;};}function handleError(_0x56a351,_0x4b9dd8){_0x4b9dd8=_0x4b9dd8||0x1f4;return function(_0x43d38b){logger['error'](_0x43d38b['stack']);if(_0x43d38b[_0x7c5c('0x22')]){delete _0x43d38b['name'];}_0x56a351[_0x7c5c('0x15')](_0x4b9dd8)[_0x7c5c('0x23')](_0x43d38b);};}exports[_0x7c5c('0x24')]=function(_0x1b8d20,_0x54094c){var _0x5de2c1={'raw':!![],'where':{'id':_0x1b8d20[_0x7c5c('0x25')]['id']}},_0x447e0d={};_0x447e0d[_0x7c5c('0x26')]=_[_0x7c5c('0x27')](db['ChatProactiveAction'][_0x7c5c('0x28')]);_0x447e0d[_0x7c5c('0x29')]=_[_0x7c5c('0x27')](_0x1b8d20[_0x7c5c('0x29')]);_0x447e0d[_0x7c5c('0x2a')]=_[_0x7c5c('0x2b')](_0x447e0d[_0x7c5c('0x26')],_0x447e0d['query']);_0x5de2c1[_0x7c5c('0x2c')]=_[_0x7c5c('0x2b')](_0x447e0d['model'],qs[_0x7c5c('0x2d')](_0x1b8d20[_0x7c5c('0x29')][_0x7c5c('0x2d')]));_0x5de2c1[_0x7c5c('0x2c')]=_0x5de2c1['attributes'][_0x7c5c('0x2e')]?_0x5de2c1['attributes']:_0x447e0d[_0x7c5c('0x26')];if(_0x1b8d20[_0x7c5c('0x29')]['includeAll']){_0x5de2c1[_0x7c5c('0x2f')]=[{'all':!![]}];}_0x5de2c1=_[_0x7c5c('0x30')]({},_0x5de2c1,_0x1b8d20[_0x7c5c('0x31')]);return db['ChatProactiveAction']['find'](_0x5de2c1)[_0x7c5c('0x20')](handleEntityNotFound(_0x54094c,null))[_0x7c5c('0x20')](respondWithResult(_0x54094c,null))['catch'](handleError(_0x54094c,null));};exports['create']=function(_0x311f65,_0x49e8ee){return db[_0x7c5c('0x32')][_0x7c5c('0x33')](_0x311f65[_0x7c5c('0x34')],{})[_0x7c5c('0x20')](respondWithResult(_0x49e8ee,0xc9))[_0x7c5c('0x35')](handleError(_0x49e8ee,null));};exports[_0x7c5c('0x36')]=function(_0x4a76f9,_0x27bc9b){if(_0x4a76f9['body']['id']){delete _0x4a76f9[_0x7c5c('0x34')]['id'];}return db[_0x7c5c('0x32')][_0x7c5c('0x37')]({'where':{'id':_0x4a76f9['params']['id']}})[_0x7c5c('0x20')](handleEntityNotFound(_0x27bc9b,null))[_0x7c5c('0x20')](saveUpdates(_0x4a76f9[_0x7c5c('0x34')],null))[_0x7c5c('0x20')](respondWithResult(_0x27bc9b,null))[_0x7c5c('0x35')](handleError(_0x27bc9b,null));};exports[_0x7c5c('0x21')]=function(_0x22e459,_0x2f1734){return db['ChatProactiveAction'][_0x7c5c('0x37')]({'where':{'id':_0x22e459[_0x7c5c('0x25')]['id']}})[_0x7c5c('0x20')](handleEntityNotFound(_0x2f1734,null))[_0x7c5c('0x20')](removeEntity(_0x2f1734,null))[_0x7c5c('0x35')](handleError(_0x2f1734,null));}; \ No newline at end of file +var _0x972c=['rawAttributes','query','filters','intersection','attributes','length','includeAll','include','options','find','catch','create','body','params','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction'];(function(_0x54f317,_0x248eb0){var _0x46b925=function(_0x7d9d2e){while(--_0x7d9d2e){_0x54f317['push'](_0x54f317['shift']());}};_0x46b925(++_0x248eb0);}(_0x972c,0xf2));var _0xc972=function(_0x1ffc8b,_0x58ea65){_0x1ffc8b=_0x1ffc8b-0x0;var _0x244870=_0x972c[_0x1ffc8b];return _0x244870;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc972('0x0'));var jsonpatch=require(_0xc972('0x1'));var rp=require('request-promise');var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc972('0x4'));var sox=require(_0xc972('0x5'));var csv=require(_0xc972('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc972('0x7'));var _=require('lodash');var squel=require(_0xc972('0x8'));var crypto=require(_0xc972('0x9'));var jsforce=require(_0xc972('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc972('0xb'));var Redis=require('ioredis');var authService=require(_0xc972('0xc'));var qs=require(_0xc972('0xd'));var as=require(_0xc972('0xe'));var hardwareService=require(_0xc972('0xf'));var logger=require(_0xc972('0x10'))(_0xc972('0x11'));var utils=require(_0xc972('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc972('0x13'));var db=require(_0xc972('0x14'))['db'];function respondWithStatusCode(_0x27851c,_0x5829ab){_0x5829ab=_0x5829ab||0xcc;return function(_0x3623ca){if(_0x3623ca){return _0x27851c[_0xc972('0x15')](_0x5829ab);}return _0x27851c[_0xc972('0x16')](_0x5829ab)['end']();};}function respondWithResult(_0x37786e,_0x298f92){_0x298f92=_0x298f92||0xc8;return function(_0x3aa39d){if(_0x3aa39d){return _0x37786e[_0xc972('0x16')](_0x298f92)['json'](_0x3aa39d);}};}function respondWithFilteredResult(_0x665f8f,_0x3d519e){return function(_0x2b20d2){if(_0x2b20d2){var _0x341564=typeof _0x3d519e[_0xc972('0x17')]===_0xc972('0x18')&&typeof _0x3d519e[_0xc972('0x19')]===_0xc972('0x18');var _0x3a7521=_0x2b20d2[_0xc972('0x1a')];var _0x2bfe0e=_0x341564?0x0:_0x3d519e[_0xc972('0x17')];var _0x214417=_0x341564?_0x2b20d2[_0xc972('0x1a')]:_0x3d519e[_0xc972('0x17')]+_0x3d519e[_0xc972('0x19')];var _0x4a2b5f;if(_0x214417>=_0x3a7521){_0x214417=_0x3a7521;_0x4a2b5f=0xc8;}else{_0x4a2b5f=0xce;}_0x665f8f[_0xc972('0x16')](_0x4a2b5f);return _0x665f8f[_0xc972('0x1b')](_0xc972('0x1c'),_0x2bfe0e+'-'+_0x214417+'/'+_0x3a7521)[_0xc972('0x1d')](_0x2b20d2);}return null;};}function patchUpdates(_0x486340){return function(_0x5e1b06){try{jsonpatch[_0xc972('0x1e')](_0x5e1b06,_0x486340,!![]);}catch(_0x3c4b7c){return BPromise['reject'](_0x3c4b7c);}return _0x5e1b06[_0xc972('0x1f')]();};}function saveUpdates(_0x3fdacf,_0x10c6ce){return function(_0x331338){if(_0x331338){return _0x331338[_0xc972('0x20')](_0x3fdacf)[_0xc972('0x21')](function(_0x59cae4){return _0x59cae4;});}return null;};}function removeEntity(_0x11a9f1,_0x5d11e4){return function(_0x5f0c94){if(_0x5f0c94){return _0x5f0c94[_0xc972('0x22')]()[_0xc972('0x21')](function(){_0x11a9f1[_0xc972('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9bed,_0x47332e){return function(_0xf115da){if(!_0xf115da){_0x1f9bed[_0xc972('0x15')](0x194);}return _0xf115da;};}function handleError(_0x228f99,_0x2497d9){_0x2497d9=_0x2497d9||0x1f4;return function(_0x33ced1){logger[_0xc972('0x23')](_0x33ced1[_0xc972('0x24')]);if(_0x33ced1[_0xc972('0x25')]){delete _0x33ced1[_0xc972('0x25')];}_0x228f99[_0xc972('0x16')](_0x2497d9)[_0xc972('0x26')](_0x33ced1);};}exports[_0xc972('0x27')]=function(_0x5ad71d,_0x1203a8){var _0x481026={'raw':!![],'where':{'id':_0x5ad71d['params']['id']}},_0x164d52={};_0x164d52[_0xc972('0x28')]=_[_0xc972('0x29')](db[_0xc972('0x2a')][_0xc972('0x2b')]);_0x164d52[_0xc972('0x2c')]=_['keys'](_0x5ad71d[_0xc972('0x2c')]);_0x164d52[_0xc972('0x2d')]=_[_0xc972('0x2e')](_0x164d52[_0xc972('0x28')],_0x164d52['query']);_0x481026[_0xc972('0x2f')]=_[_0xc972('0x2e')](_0x164d52['model'],qs['fields'](_0x5ad71d['query']['fields']));_0x481026[_0xc972('0x2f')]=_0x481026['attributes'][_0xc972('0x30')]?_0x481026['attributes']:_0x164d52['model'];if(_0x5ad71d[_0xc972('0x2c')][_0xc972('0x31')]){_0x481026[_0xc972('0x32')]=[{'all':!![]}];}_0x481026=_['merge']({},_0x481026,_0x5ad71d[_0xc972('0x33')]);return db['ChatProactiveAction'][_0xc972('0x34')](_0x481026)[_0xc972('0x21')](handleEntityNotFound(_0x1203a8,null))['then'](respondWithResult(_0x1203a8,null))[_0xc972('0x35')](handleError(_0x1203a8,null));};exports[_0xc972('0x36')]=function(_0x177828,_0xc2a2e2){return db[_0xc972('0x2a')][_0xc972('0x36')](_0x177828[_0xc972('0x37')],{})[_0xc972('0x21')](respondWithResult(_0xc2a2e2,0xc9))[_0xc972('0x35')](handleError(_0xc2a2e2,null));};exports[_0xc972('0x20')]=function(_0x369257,_0x154335){if(_0x369257[_0xc972('0x37')]['id']){delete _0x369257[_0xc972('0x37')]['id'];}return db[_0xc972('0x2a')][_0xc972('0x34')]({'where':{'id':_0x369257[_0xc972('0x38')]['id']}})[_0xc972('0x21')](handleEntityNotFound(_0x154335,null))[_0xc972('0x21')](saveUpdates(_0x369257[_0xc972('0x37')],null))[_0xc972('0x21')](respondWithResult(_0x154335,null))['catch'](handleError(_0x154335,null));};exports[_0xc972('0x22')]=function(_0x3421b2,_0x4880f7){return db[_0xc972('0x2a')][_0xc972('0x34')]({'where':{'id':_0x3421b2[_0xc972('0x38')]['id']}})[_0xc972('0x21')](handleEntityNotFound(_0x4880f7,null))[_0xc972('0x21')](removeEntity(_0x4880f7,null))[_0xc972('0x35')](handleError(_0x4880f7,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7f71701..dfe0cc4 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 _0x7cc3=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util'];(function(_0x1af9ed,_0x313f91){var _0x30206e=function(_0x211c37){while(--_0x211c37){_0x1af9ed['push'](_0x1af9ed['shift']());}};_0x30206e(++_0x313f91);}(_0x7cc3,0x1a1));var _0x37cc=function(_0x221853,_0xe338ab){_0x221853=_0x221853-0x0;var _0x3d725f=_0x7cc3[_0x221853];return _0x3d725f;};'use strict';var _=require('lodash');var util=require(_0x37cc('0x0'));var logger=require(_0x37cc('0x1'))(_0x37cc('0x2'));var moment=require(_0x37cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x37cc('0x4'));var fs=require('fs');var path=require(_0x37cc('0x5'));var rimraf=require('rimraf');var config=require(_0x37cc('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x37cc('0x7')]=function(_0x53ecc8,_0x3f4bb9){return _0x53ecc8[_0x37cc('0x8')](_0x37cc('0x9'),attributes,{'tableName':_0x37cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8828=['ChatProactiveAction','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x8828,0x12d));var _0x8882=function(_0x1b6daf,_0x599a0c){_0x1b6daf=_0x1b6daf-0x0;var _0x4ee820=_0x8828[_0x1b6daf];return _0x4ee820;};'use strict';var _=require(_0x8882('0x0'));var util=require('util');var logger=require(_0x8882('0x1'))('api');var moment=require(_0x8882('0x2'));var BPromise=require('bluebird');var rp=require(_0x8882('0x3'));var fs=require('fs');var path=require(_0x8882('0x4'));var rimraf=require('rimraf');var config=require(_0x8882('0x5'));var attributes=require(_0x8882('0x6'));module[_0x8882('0x7')]=function(_0x502685,_0x374b55){return _0x502685[_0x8882('0x8')](_0x8882('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index bd6bb43..49146d1 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 _0xfb2c=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x13327e,_0x855c59){var _0x10dae8=function(_0x4eab79){while(--_0x4eab79){_0x13327e['push'](_0x13327e['shift']());}};_0x10dae8(++_0x855c59);}(_0xfb2c,0x9b));var _0xcfb2=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xfb2c[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xcfb2('0x0'));var util=require(_0xcfb2('0x1'));var moment=require('moment');var BPromise=require(_0xcfb2('0x2'));var rs=require(_0xcfb2('0x3'));var fs=require('fs');var Redis=require(_0xcfb2('0x4'));var db=require(_0xcfb2('0x5'))['db'];var utils=require(_0xcfb2('0x6'));var logger=require(_0xcfb2('0x7'))(_0xcfb2('0x8'));var config=require(_0xcfb2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcfb2('0xa')][_0xcfb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423b8a,_0x5a674a,_0x47ee54){return new BPromise(function(_0xa67587,_0x45ac06){return client['request'](_0x423b8a,_0x47ee54)[_0xcfb2('0xc')](function(_0x1131aa){logger['info'](_0xcfb2('0xd'),_0x5a674a,_0xcfb2('0xe'));logger[_0xcfb2('0xf')](_0xcfb2('0x10'),_0x5a674a,_0xcfb2('0xe'),JSON[_0xcfb2('0x11')](_0x1131aa));if(_0x1131aa['error']){if(_0x1131aa[_0xcfb2('0x12')]['code']===0x1f4){logger[_0xcfb2('0x12')](_0xcfb2('0xd'),_0x5a674a,_0x1131aa[_0xcfb2('0x12')]['message']);return _0x45ac06(_0x1131aa[_0xcfb2('0x12')][_0xcfb2('0x13')]);}logger[_0xcfb2('0x12')](_0xcfb2('0xd'),_0x5a674a,_0x1131aa[_0xcfb2('0x12')][_0xcfb2('0x13')]);return _0xa67587(_0x1131aa[_0xcfb2('0x12')][_0xcfb2('0x13')]);}else{logger[_0xcfb2('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x5a674a,'request\x20sent');_0xa67587(_0x1131aa[_0xcfb2('0x15')][_0xcfb2('0x13')]);}})[_0xcfb2('0x16')](function(_0x29645f){logger['error'](_0xcfb2('0xd'),_0x5a674a,_0x29645f);_0x45ac06(_0x29645f);});});} \ No newline at end of file +var _0x448f=['request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x47db58,_0xa2085b){var _0x19b171=function(_0x2e8868){while(--_0x2e8868){_0x47db58['push'](_0x47db58['shift']());}};_0x19b171(++_0xa2085b);}(_0x448f,0x195));var _0xf448=function(_0xe05e9a,_0xd16e7c){_0xe05e9a=_0xe05e9a-0x0;var _0x15061b=_0x448f[_0xe05e9a];return _0x15061b;};'use strict';var _=require(_0xf448('0x0'));var util=require(_0xf448('0x1'));var moment=require(_0xf448('0x2'));var BPromise=require(_0xf448('0x3'));var rs=require(_0xf448('0x4'));var fs=require('fs');var Redis=require(_0xf448('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf448('0x6'));var logger=require(_0xf448('0x7'))(_0xf448('0x8'));var config=require(_0xf448('0x9'));var jayson=require(_0xf448('0xa'));var client=jayson[_0xf448('0xb')][_0xf448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x177f11,_0x2d43a7,_0x137c76){return new BPromise(function(_0x2f10c4,_0x594d30){return client[_0xf448('0xd')](_0x177f11,_0x137c76)['then'](function(_0x3c2e38){logger[_0xf448('0xe')](_0xf448('0xf'),_0x2d43a7,_0xf448('0x10'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2d43a7,_0xf448('0x10'),JSON['stringify'](_0x3c2e38));if(_0x3c2e38[_0xf448('0x11')]){if(_0x3c2e38['error'][_0xf448('0x12')]===0x1f4){logger[_0xf448('0x11')](_0xf448('0xf'),_0x2d43a7,_0x3c2e38[_0xf448('0x11')][_0xf448('0x13')]);return _0x594d30(_0x3c2e38[_0xf448('0x11')][_0xf448('0x13')]);}logger[_0xf448('0x11')](_0xf448('0xf'),_0x2d43a7,_0x3c2e38[_0xf448('0x11')][_0xf448('0x13')]);return _0x2f10c4(_0x3c2e38['error'][_0xf448('0x13')]);}else{logger[_0xf448('0xe')](_0xf448('0xf'),_0x2d43a7,'request\x20sent');_0x2f10c4(_0x3c2e38[_0xf448('0x14')][_0xf448('0x13')]);}})[_0xf448('0x15')](function(_0x61a0f2){logger[_0xf448('0x11')](_0xf448('0xf'),_0x2d43a7,_0x61a0f2);_0x594d30(_0x61a0f2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2c582e2..79c5e0e 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 _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x8c697,_0x5f32fd){var _0x290bd5=function(_0x35d768){while(--_0x35d768){_0x8c697['push'](_0x8c697['shift']());}};_0x290bd5(++_0x5f32fd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0xf2ca[_0x36147b];return _0x141351;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file +var _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x263ffd,_0x140cf8){var _0x2b3b8b=function(_0x36331e){while(--_0x36331e){_0x263ffd['push'](_0x263ffd['shift']());}};_0x2b3b8b(++_0x140cf8);}(_0x5d58,0x187));var _0x85d5=function(_0x1bc20a,_0x190181){_0x1bc20a=_0x1bc20a-0x0;var _0x3584bc=_0x5d58[_0x1bc20a];return _0x3584bc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9336c88..f87f037 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 _0x5414=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0x5414,0x121));var _0x4541=function(_0x1bf956,_0x88182a){_0x1bf956=_0x1bf956-0x0;var _0x10b8dc=_0x5414[_0x1bf956];return _0x10b8dc;};'use strict';var Sequelize=require(_0x4541('0x0'));module[_0x4541('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4541('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4541('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4541('0x4')]('rrmemory',_0x4541('0x5'),_0x4541('0x6'))}}; \ No newline at end of file +var _0x496a=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x12d034,_0x430f51){var _0x39d6e5=function(_0x579248){while(--_0x579248){_0x12d034['push'](_0x12d034['shift']());}};_0x39d6e5(++_0x430f51);}(_0x496a,0x1dd));var _0xa496=function(_0xfc2bf1,_0x1232de){_0xfc2bf1=_0xfc2bf1-0x0;var _0x5ce2be=_0x496a[_0xfc2bf1];return _0x5ce2be;};'use strict';var Sequelize=require(_0xa496('0x0'));module[_0xa496('0x1')]={'name':{'type':Sequelize[_0xa496('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa496('0x3')](_0xa496('0x4'),'beepall',_0xa496('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 13fccf4..74d68d3 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 _0x510e=['../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','name','send','map','ChatQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','describe','findOne','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','online','voicePause','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','every','all','value','sequelize','isEmpty','removeAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3281f7,_0x4d613c){var _0x47f6ee=function(_0x404ee7){while(--_0x404ee7){_0x3281f7['push'](_0x3281f7['shift']());}};_0x47f6ee(++_0x4d613c);}(_0x510e,0x1a1));var _0xe510=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x510e[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0xe510('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe510('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe510('0x2'));var moment=require(_0xe510('0x3'));var BPromise=require(_0xe510('0x4'));var Mustache=require(_0xe510('0x5'));var util=require('util');var path=require(_0xe510('0x6'));var sox=require(_0xe510('0x7'));var csv=require(_0xe510('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe510('0x9'));var _=require(_0xe510('0xa'));var squel=require('squel');var crypto=require(_0xe510('0xb'));var jsforce=require(_0xe510('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe510('0x8'));var querystring=require(_0xe510('0xd'));var Papa=require('papaparse');var Redis=require(_0xe510('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe510('0xf'));var as=require(_0xe510('0x10'));var hardwareService=require(_0xe510('0x11'));var logger=require(_0xe510('0x12'))(_0xe510('0x13'));var utils=require('../../config/utils');var config=require(_0xe510('0x14'));var licenseUtil=require(_0xe510('0x15'));var db=require(_0xe510('0x16'))['db'];config[_0xe510('0x17')]=_[_0xe510('0x18')](config[_0xe510('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xe510('0x19'))(new Redis(config[_0xe510('0x17')]));require('./chatQueue.socket')[_0xe510('0x1a')](socket);var jayson=require(_0xe510('0x1b'));var client=jayson[_0xe510('0x1c')][_0xe510('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13421a,_0x57cdfb,_0x5efb07,_0x1660c2){return new BPromise(function(_0x4f4719,_0x4b1fdd){var _0x4bee31=_0x1660c2||client;return _0x4bee31['request'](_0x13421a,_0x5efb07)[_0xe510('0x1e')](function(_0x5c6f50){logger['info'](_0xe510('0x1f'),_0x57cdfb,'request\x20sent');logger[_0xe510('0x20')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x57cdfb,_0xe510('0x21'),JSON[_0xe510('0x22')](_0x5c6f50));if(_0x5c6f50[_0xe510('0x23')]){if(_0x5c6f50[_0xe510('0x23')][_0xe510('0x24')]===0x1f4){logger[_0xe510('0x23')](_0xe510('0x1f'),_0x57cdfb,_0x5c6f50[_0xe510('0x23')][_0xe510('0x25')]);return _0x4b1fdd(_0x5c6f50[_0xe510('0x23')]['message']);}logger[_0xe510('0x23')](_0xe510('0x1f'),_0x57cdfb,_0x5c6f50['error'][_0xe510('0x25')]);return _0x4f4719(_0x5c6f50[_0xe510('0x23')]['message']);}else{logger[_0xe510('0x26')](_0xe510('0x1f'),_0x57cdfb,_0xe510('0x21'));_0x4f4719(_0x5c6f50[_0xe510('0x27')][_0xe510('0x25')]);}})[_0xe510('0x28')](function(_0x25dd79){logger[_0xe510('0x23')](_0xe510('0x1f'),_0x57cdfb,_0x25dd79);_0x4b1fdd(_0x25dd79);});});}function respondWithStatusCode(_0x1718f8,_0x36adc2){_0x36adc2=_0x36adc2||0xcc;return function(_0x5cdc37){if(_0x5cdc37){return _0x1718f8[_0xe510('0x29')](_0x36adc2);}return _0x1718f8[_0xe510('0x2a')](_0x36adc2)[_0xe510('0x2b')]();};}function respondWithResult(_0xaee073,_0x3bf7be){_0x3bf7be=_0x3bf7be||0xc8;return function(_0x11cb7a){if(_0x11cb7a){return _0xaee073[_0xe510('0x2a')](_0x3bf7be)[_0xe510('0x2c')](_0x11cb7a);}};}function respondWithFilteredResult(_0x557bc2,_0xd50367){return function(_0x46e755){if(_0x46e755){var _0x184128=typeof _0xd50367['offset']==='undefined'&&typeof _0xd50367[_0xe510('0x2d')]===_0xe510('0x2e');var _0x586d31=_0x46e755[_0xe510('0x2f')];var _0x52596a=_0x184128?0x0:_0xd50367[_0xe510('0x30')];var _0x124a69=_0x184128?_0x46e755[_0xe510('0x2f')]:_0xd50367['offset']+_0xd50367[_0xe510('0x2d')];var _0x422d3c;if(_0x124a69>=_0x586d31){_0x124a69=_0x586d31;_0x422d3c=0xc8;}else{_0x422d3c=0xce;}_0x557bc2['status'](_0x422d3c);return _0x557bc2[_0xe510('0x31')](_0xe510('0x32'),_0x52596a+'-'+_0x124a69+'/'+_0x586d31)[_0xe510('0x2c')](_0x46e755);}return null;};}function patchUpdates(_0x57ab6b){return function(_0x518eb8){try{jsonpatch[_0xe510('0x33')](_0x518eb8,_0x57ab6b,!![]);}catch(_0x1f8f8f){return BPromise[_0xe510('0x34')](_0x1f8f8f);}return _0x518eb8[_0xe510('0x35')]();};}function saveUpdates(_0x49df44,_0x2d3aef){return function(_0x2e475d){if(_0x2e475d){return _0x2e475d['update'](_0x49df44)[_0xe510('0x1e')](function(_0x49b9b4){return _0x49b9b4;});}return null;};}function removeEntity(_0x1c375c,_0x17fbed){return function(_0x21ebaa){if(_0x21ebaa){return _0x21ebaa[_0xe510('0x36')]()[_0xe510('0x1e')](function(){var _0x5d9a48=_0x21ebaa[_0xe510('0x37')]({'plain':!![]});var _0x623ad3=_0xe510('0x38');return db['UserProfileResource'][_0xe510('0x36')]({'where':{'type':_0x623ad3,'resourceId':_0x5d9a48['id']}})[_0xe510('0x1e')](function(){return _0x21ebaa;});})['then'](function(){_0x1c375c[_0xe510('0x2a')](0xcc)[_0xe510('0x2b')]();});}};}function handleEntityNotFound(_0x3785a9,_0xd4737e){return function(_0x13bc56){if(!_0x13bc56){_0x3785a9[_0xe510('0x29')](0x194);}return _0x13bc56;};}function handleError(_0x4aa9bb,_0x1d0576){_0x1d0576=_0x1d0576||0x1f4;return function(_0x28a5d0){logger['error'](_0x28a5d0['stack']);if(_0x28a5d0[_0xe510('0x39')]){delete _0x28a5d0['name'];}_0x4aa9bb[_0xe510('0x2a')](_0x1d0576)[_0xe510('0x3a')](_0x28a5d0);};}exports['index']=function(_0xe02c57,_0x3720b4){var _0x4aea21={},_0x265033={},_0x26ae3a={'count':0x0,'rows':[]};var _0x37a05a=_[_0xe510('0x3b')](db[_0xe510('0x3c')]['rawAttributes'],function(_0x56815e){return{'name':_0x56815e[_0xe510('0x3d')],'type':_0x56815e[_0xe510('0x3e')][_0xe510('0x3f')]};});_0x265033[_0xe510('0x40')]=_[_0xe510('0x3b')](_0x37a05a,'name');_0x265033[_0xe510('0x41')]=_[_0xe510('0x42')](_0xe02c57[_0xe510('0x41')]);_0x265033['filters']=_[_0xe510('0x43')](_0x265033['model'],_0x265033[_0xe510('0x41')]);_0x4aea21[_0xe510('0x44')]=_[_0xe510('0x43')](_0x265033[_0xe510('0x40')],qs[_0xe510('0x45')](_0xe02c57['query'][_0xe510('0x45')]));_0x4aea21[_0xe510('0x44')]=_0x4aea21[_0xe510('0x44')][_0xe510('0x46')]?_0x4aea21[_0xe510('0x44')]:_0x265033[_0xe510('0x40')];if(!_0xe02c57[_0xe510('0x41')][_0xe510('0x47')](_0xe510('0x48'))){_0x4aea21['limit']=qs[_0xe510('0x2d')](_0xe02c57[_0xe510('0x41')]['limit']);_0x4aea21[_0xe510('0x30')]=qs['offset'](_0xe02c57[_0xe510('0x41')][_0xe510('0x30')]);}_0x4aea21[_0xe510('0x49')]=qs[_0xe510('0x4a')](_0xe02c57[_0xe510('0x41')]['sort']);_0x4aea21[_0xe510('0x4b')]=qs['filters'](_[_0xe510('0x4c')](_0xe02c57['query'],_0x265033[_0xe510('0x4d')]),_0x37a05a);if(_0xe02c57[_0xe510('0x41')][_0xe510('0x4e')]){_0x4aea21['where']=_[_0xe510('0x4f')](_0x4aea21['where'],{'$or':_[_0xe510('0x3b')](_0x37a05a,function(_0xada5b3){if(_0xada5b3['type']!==_0xe510('0x50')){var _0x4ee891={};_0x4ee891[_0xada5b3[_0xe510('0x39')]]={'$like':'%'+_0xe02c57[_0xe510('0x41')][_0xe510('0x4e')]+'%'};return _0x4ee891;}})});}_0x4aea21=_['merge']({},_0x4aea21,_0xe02c57[_0xe510('0x51')]);var _0x360f04={'where':_0x4aea21[_0xe510('0x4b')]};return db['ChatQueue'][_0xe510('0x2f')](_0x360f04)[_0xe510('0x1e')](function(_0x4c0edf){_0x26ae3a['count']=_0x4c0edf;if(_0xe02c57['query'][_0xe510('0x52')]){_0x4aea21[_0xe510('0x53')]=[{'all':!![]}];}return db[_0xe510('0x3c')]['findAll'](_0x4aea21);})[_0xe510('0x1e')](function(_0x38be30){_0x26ae3a[_0xe510('0x54')]=_0x38be30;return _0x26ae3a;})[_0xe510('0x1e')](respondWithFilteredResult(_0x3720b4,_0x4aea21))[_0xe510('0x28')](handleError(_0x3720b4,null));};exports[_0xe510('0x55')]=function(_0x3c26c1,_0xe2d63f){var _0x5d2e7d={'raw':!![],'where':{'id':_0x3c26c1[_0xe510('0x56')]['id']}},_0x3e021b={};_0x3e021b[_0xe510('0x40')]=_['keys'](db[_0xe510('0x3c')][_0xe510('0x57')]);_0x3e021b[_0xe510('0x41')]=_[_0xe510('0x42')](_0x3c26c1[_0xe510('0x41')]);_0x3e021b[_0xe510('0x4d')]=_[_0xe510('0x43')](_0x3e021b[_0xe510('0x40')],_0x3e021b[_0xe510('0x41')]);_0x5d2e7d[_0xe510('0x44')]=_[_0xe510('0x43')](_0x3e021b['model'],qs[_0xe510('0x45')](_0x3c26c1[_0xe510('0x41')]['fields']));_0x5d2e7d[_0xe510('0x44')]=_0x5d2e7d['attributes'][_0xe510('0x46')]?_0x5d2e7d[_0xe510('0x44')]:_0x3e021b[_0xe510('0x40')];if(_0x3c26c1[_0xe510('0x41')][_0xe510('0x52')]){_0x5d2e7d[_0xe510('0x53')]=[{'all':!![]}];}_0x5d2e7d=_[_0xe510('0x4f')]({},_0x5d2e7d,_0x3c26c1[_0xe510('0x51')]);return db[_0xe510('0x3c')][_0xe510('0x58')](_0x5d2e7d)[_0xe510('0x1e')](handleEntityNotFound(_0xe2d63f,null))[_0xe510('0x1e')](respondWithResult(_0xe2d63f,null))[_0xe510('0x28')](handleError(_0xe2d63f,null));};exports[_0xe510('0x59')]=function(_0x440f41,_0x277bd9){return db[_0xe510('0x3c')][_0xe510('0x59')](_0x440f41[_0xe510('0x5a')],{})['then'](function(_0x41db27){var _0x5ac162=_0x440f41[_0xe510('0x5b')][_0xe510('0x37')]({'plain':!![]});if(!_0x5ac162)throw new Error(_0xe510('0x5c'));if(_0x5ac162[_0xe510('0x5d')]===_0xe510('0x5b')){var _0x3b04dc=_0x41db27[_0xe510('0x37')]({'plain':!![]});var _0x3b3ca3=_0xe510('0x38');return db[_0xe510('0x5e')][_0xe510('0x58')]({'where':{'name':_0x3b3ca3,'userProfileId':_0x5ac162[_0xe510('0x5f')]},'raw':!![]})['then'](function(_0x475763){if(_0x475763&&_0x475763[_0xe510('0x60')]===0x0){return db[_0xe510('0x61')][_0xe510('0x59')]({'name':_0x3b04dc[_0xe510('0x39')],'resourceId':_0x3b04dc['id'],'type':_0x475763[_0xe510('0x39')],'sectionId':_0x475763['id']},{})[_0xe510('0x1e')](function(){return _0x41db27;});}else{return _0x41db27;}})[_0xe510('0x28')](function(_0x3d5746){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5746);throw _0x3d5746;});}return _0x41db27;})['then'](respondWithResult(_0x277bd9,0xc9))[_0xe510('0x28')](handleError(_0x277bd9,null));};exports[_0xe510('0x62')]=function(_0x13920a,_0x44434e){if(_0x13920a[_0xe510('0x5a')]['id']){delete _0x13920a[_0xe510('0x5a')]['id'];}return db['ChatQueue'][_0xe510('0x58')]({'where':{'id':_0x13920a[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](handleEntityNotFound(_0x44434e,null))[_0xe510('0x1e')](saveUpdates(_0x13920a[_0xe510('0x5a')],null))[_0xe510('0x1e')](respondWithResult(_0x44434e,null))['catch'](handleError(_0x44434e,null));};exports['destroy']=function(_0x418cc6,_0x2d7abc){return db[_0xe510('0x3c')][_0xe510('0x58')]({'where':{'id':_0x418cc6['params']['id']}})['then'](handleEntityNotFound(_0x2d7abc,null))[_0xe510('0x1e')](removeEntity(_0x2d7abc,null))[_0xe510('0x28')](handleError(_0x2d7abc,null));};exports[_0xe510('0x63')]=function(_0x2a0328,_0x2e8c7b){return db['ChatQueue'][_0xe510('0x63')]()[_0xe510('0x1e')](respondWithResult(_0x2e8c7b,null))[_0xe510('0x28')](handleError(_0x2e8c7b,null));};exports['getMembers']=function(_0x437d98,_0xbcf813,_0x2517c9){var _0x93b09f={'raw':!![],'where':{}},_0x39e8d8={},_0x5116cb;return db[_0xe510('0x3c')][_0xe510('0x64')]({'where':{'id':_0x437d98[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](handleEntityNotFound(_0xbcf813,null))[_0xe510('0x1e')](function(_0x53348a){if(_0x53348a){_0x5116cb=_0x53348a[_0xe510('0x37')]({'plain':!![]});_0x39e8d8[_0xe510('0x40')]=_[_0xe510('0x42')](db[_0xe510('0x65')][_0xe510('0x57')]);_0x39e8d8[_0xe510('0x41')]=_[_0xe510('0x42')](_0x437d98[_0xe510('0x41')]);_0x39e8d8[_0xe510('0x4d')]=_[_0xe510('0x43')](_0x39e8d8[_0xe510('0x40')],_0x39e8d8['query']);_0x93b09f[_0xe510('0x44')]=_[_0xe510('0x43')](_0x39e8d8[_0xe510('0x40')],qs[_0xe510('0x45')](_0x437d98['query'][_0xe510('0x45')]));_0x93b09f[_0xe510('0x44')]=_0x93b09f[_0xe510('0x44')][_0xe510('0x46')]?_0x93b09f[_0xe510('0x44')]:_0x39e8d8[_0xe510('0x40')];if(!_0x437d98[_0xe510('0x41')][_0xe510('0x47')](_0xe510('0x48'))){_0x93b09f[_0xe510('0x2d')]=qs[_0xe510('0x2d')](_0x437d98[_0xe510('0x41')][_0xe510('0x2d')]);_0x93b09f[_0xe510('0x30')]=qs[_0xe510('0x30')](_0x437d98[_0xe510('0x41')][_0xe510('0x30')]);}_0x93b09f[_0xe510('0x49')]=qs[_0xe510('0x4a')](_0x437d98[_0xe510('0x41')][_0xe510('0x4a')]);_0x93b09f[_0xe510('0x4b')]=qs[_0xe510('0x4d')](_[_0xe510('0x4c')](_0x437d98[_0xe510('0x41')],_0x39e8d8[_0xe510('0x4d')]));_0x93b09f[_0xe510('0x4b')][_0xe510('0x66')]=_0x53348a['id'];if(_0x437d98[_0xe510('0x41')][_0xe510('0x4e')]){_0x93b09f['where']=_[_0xe510('0x4f')](_0x93b09f[_0xe510('0x4b')],{'$or':_[_0xe510('0x3b')](_0x93b09f[_0xe510('0x44')],function(_0x1dd363){var _0x4f8e3f={};_0x4f8e3f[_0x1dd363]={'$like':'%'+_0x437d98[_0xe510('0x41')][_0xe510('0x4e')]+'%'};return _0x4f8e3f;})});}_0x93b09f=_['merge']({},_0x93b09f,_0x437d98['options']);return db[_0xe510('0x65')][_0xe510('0x67')](_0x93b09f);}})[_0xe510('0x1e')](function(_0x2d7bce){if(_0x2d7bce){return db['User'][_0xe510('0x68')]({'where':{'id':_[_0xe510('0x3b')](_0x2d7bce,_0xe510('0x69')),'role':'agent'},'attributes':['id','name',_0xe510('0x6a'),'updatedAt',_0xe510('0x6b')]});}})[_0xe510('0x1e')](function(_0xc9d116){if(_0xc9d116){return{'count':_0xc9d116[_0xe510('0x2f')],'rows':_[_0xe510('0x3b')](_0xc9d116['rows'],function(_0x961cf1){return{'membername':_0x961cf1[_0xe510('0x39')],'UserId':_0x961cf1['id'],'queue_name':_0x5116cb[_0xe510('0x39')],'ChatQueueId':_0x5116cb['id'],'interface':util['format'](_0xe510('0x6c'),_0xe510('0x6d'),_0x961cf1['name']),'penalty':0x0,'paused':_0x961cf1[_0xe510('0x6a')],'createdAt':_0x961cf1[_0xe510('0x6b')],'updatedAt':_0x961cf1[_0xe510('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe510('0x1e')](respondWithFilteredResult(_0xbcf813,_0x93b09f))[_0xe510('0x28')](handleError(_0xbcf813,null));};exports[_0xe510('0x6f')]=function(_0x594778,_0x509298,_0x6c7277){var _0x438146={};var _0x18b162={};var _0x43ede1;var _0x25b3fb;return db['ChatQueue'][_0xe510('0x64')]({'where':{'id':_0x594778[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](handleEntityNotFound(_0x509298,null))[_0xe510('0x1e')](function(_0x24c9f7){if(_0x24c9f7){_0x43ede1=_0x24c9f7;_0x18b162['model']=_[_0xe510('0x42')](db[_0xe510('0x70')]['rawAttributes']);_0x18b162[_0xe510('0x41')]=_[_0xe510('0x42')](_0x594778[_0xe510('0x41')]);_0x18b162['filters']=_[_0xe510('0x43')](_0x18b162['model'],_0x18b162[_0xe510('0x41')]);_0x438146['attributes']=_[_0xe510('0x43')](_0x18b162['model'],qs['fields'](_0x594778[_0xe510('0x41')][_0xe510('0x45')]));_0x438146[_0xe510('0x44')]=_0x438146[_0xe510('0x44')][_0xe510('0x46')]?_0x438146['attributes']:_0x18b162[_0xe510('0x40')];_0x438146[_0xe510('0x49')]=qs[_0xe510('0x4a')](_0x594778['query'][_0xe510('0x4a')]);_0x438146[_0xe510('0x4b')]=qs[_0xe510('0x4d')](_['pick'](_0x594778[_0xe510('0x41')],_0x18b162[_0xe510('0x4d')]));if(_0x594778[_0xe510('0x41')][_0xe510('0x4e')]){_0x438146[_0xe510('0x4b')]=_[_0xe510('0x4f')](_0x438146[_0xe510('0x4b')],{'$or':_['map'](_0x438146['attributes'],function(_0x1218f0){var _0x2e9215={};_0x2e9215[_0x1218f0]={'$like':'%'+_0x594778[_0xe510('0x41')][_0xe510('0x4e')]+'%'};return _0x2e9215;})});}_0x438146=_[_0xe510('0x4f')]({},_0x438146,_0x594778[_0xe510('0x51')]);return _0x43ede1[_0xe510('0x6f')](_0x438146);}})['then'](function(_0x492f03){if(_0x492f03){_0x25b3fb=_0x492f03[_0xe510('0x46')];if(!_0x594778[_0xe510('0x41')][_0xe510('0x47')](_0xe510('0x48'))){_0x438146[_0xe510('0x2d')]=qs[_0xe510('0x2d')](_0x594778[_0xe510('0x41')][_0xe510('0x2d')]);_0x438146[_0xe510('0x30')]=qs[_0xe510('0x30')](_0x594778[_0xe510('0x41')][_0xe510('0x30')]);}return _0x43ede1['getTeams'](_0x438146);}})[_0xe510('0x1e')](function(_0x33a8d4){if(_0x33a8d4){return _0x33a8d4?{'count':_0x25b3fb,'rows':_0x33a8d4}:null;}})['then'](respondWithResult(_0x509298,null))[_0xe510('0x28')](handleError(_0x509298,null));};exports[_0xe510('0x71')]=function(_0xde9dcd,_0x5e6769,_0x50119c){var _0x473684=_0xde9dcd['body'][_0xe510('0x72')];return db[_0xe510('0x70')][_0xe510('0x67')]({'where':{'id':_0x473684},'attributes':['id'],'include':[{'model':db[_0xe510('0x73')],'as':'Agents','attributes':['id',_0xe510('0x39'),_0xe510('0x74'),_0xe510('0x75'),'interface'],'raw':!![]}]})[_0xe510('0x1e')](function(_0x2337cd){if(_0x2337cd){var _0x29f7fb=_['flatMap'](_0x2337cd,function(_0x4eb3bb){var _0x409a8b=_0x4eb3bb[_0xe510('0x37')]({'plain':!![]});return _0x409a8b['Agents'];});return db['ChatQueue'][_0xe510('0x58')]({'where':{'id':_0xde9dcd['params']['id']}})[_0xe510('0x1e')](function(_0x3ff24c){return db['sequelize'][_0xe510('0x76')](function(_0x568914){return _0x3ff24c[_0xe510('0x71')](_0x473684,{'transaction':_0x568914})[_0xe510('0x1e')](function(){return BPromise[_0xe510('0x77')](_0x29f7fb,function(_0x2cdd07){return db['UserChatQueue'][_0xe510('0x78')]({'where':{'UserId':_0x2cdd07['id'],'ChatQueueId':_0xde9dcd[_0xe510('0x56')]['id']},'transaction':_0x568914});});})[_0xe510('0x1e')](function(){_0x29f7fb[_0xe510('0x79')](function(_0x317250){socket[_0xe510('0x7a')](_0xe510('0x7b'),{'UserId':_0x317250['id'],'ChatQueueId':_0x3ff24c['id']});});});});});}})[_0xe510('0x1e')](respondWithStatusCode(_0x5e6769,null))[_0xe510('0x28')](handleError(_0x5e6769,null));};exports[_0xe510('0x7c')]=function(_0x5828e7,_0x55ba1f,_0x411792){return db[_0xe510('0x70')]['findAll']({'where':{'id':_0x5828e7['query'][_0xe510('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe510('0x7d'),'attributes':['id'],'raw':!![]}]})[_0xe510('0x1e')](handleEntityNotFound(_0x55ba1f,null))[_0xe510('0x1e')](function(_0x371fa2){var _0x3e49a3=_['map'](_0x371fa2,'id');var _0x1405ff=[];var _0x2bd3a5=[];var _0x31f79b=squel[_0xe510('0x7e')]();_0x31f79b[_0xe510('0x7f')](_0xe510('0x80'))[_0xe510('0x81')](_0xe510('0x82'),'tq')['join'](_0xe510('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x5828e7['params']['id']);for(var _0x362cba=0x0;_0x362cba<_0x371fa2[_0xe510('0x46')];_0x362cba+=0x1){let _0x14c6e7=_0x371fa2[_0x362cba];for(var _0x499efb=0x0;_0x499efb<_0x14c6e7[_0xe510('0x7d')][_0xe510('0x46')];_0x499efb+=0x1){let _0x14b23d=_0x14c6e7[_0xe510('0x7d')][_0x499efb];var _0x9df798=_0x31f79b[_0xe510('0x84')]();_0x9df798[_0xe510('0x4b')](_0xe510('0x85'),_0x14b23d['id']);_0x2bd3a5[_0xe510('0x86')](db['sequelize'][_0xe510('0x41')](_0x9df798['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xe510('0x1e')](function(_0x346a4c){if(_0x346a4c[_0xe510('0x46')]===0x1){return _0x14b23d['id'];}else{var _0x47fca3=_[_0xe510('0x87')](_[_0xe510('0x3b')](_0x346a4c,'TeamId'),function(_0x1112bb){return _['includes'](_0x3e49a3,_0x1112bb);});if(_0x47fca3){return _0x14b23d['id'];}}}));}}return BPromise[_0xe510('0x88')](_0x2bd3a5)['then'](function(_0x33cc4a){_0x1405ff=_(_0x1405ff)['union'](_0x33cc4a)['compact']()[_0xe510('0x89')]();return db['ChatQueue'][_0xe510('0x58')]({'where':{'id':_0x5828e7[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](function(_0x57f4b4){return db[_0xe510('0x8a')]['transaction'](function(_0x1e5886){return _0x57f4b4[_0xe510('0x7c')](_0x5828e7[_0xe510('0x41')]['ids'],{'transaction':_0x1e5886})[_0xe510('0x1e')](function(){if(!_[_0xe510('0x8b')](_0x1405ff)){return _0x57f4b4[_0xe510('0x8c')](_0x1405ff,{'transaction':_0x1e5886});}})[_0xe510('0x1e')](function(){_0x1405ff[_0xe510('0x79')](function(_0x33ed07){socket['emit']('userChatQueue:remove',{'UserId':_0x33ed07,'ChatQueueId':_0x57f4b4['id']});});});});});});})[_0xe510('0x1e')](respondWithStatusCode(_0x55ba1f,null))[_0xe510('0x28')](handleError(_0x55ba1f,null));};exports['addAgents']=function(_0x25464a,_0x1ea073,_0x337122){return db['ChatQueue'][_0xe510('0x58')]({'where':{'id':_0x25464a[_0xe510('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ea073,null))[_0xe510('0x1e')](function(_0x5ae6be){if(_0x5ae6be){return _0x5ae6be['addAgents'](_0x25464a[_0xe510('0x5a')][_0xe510('0x72')],_[_0xe510('0x8d')](_0x25464a[_0xe510('0x5a')],['ids','id'])||{})[_0xe510('0x8e')](function(_0xd1b551){for(var _0x4b6a66=0x0;_0x4b6a66<_0x25464a[_0xe510('0x5a')][_0xe510('0x72')][_0xe510('0x46')];_0x4b6a66+=0x1){socket[_0xe510('0x7a')](_0xe510('0x7b'),{'UserId':Number(_0x25464a[_0xe510('0x5a')][_0xe510('0x72')][_0x4b6a66]),'ChatQueueId':Number(_0x25464a[_0xe510('0x56')]['id'])});}return _0xd1b551;});}})[_0xe510('0x1e')](respondWithResult(_0x1ea073,null))[_0xe510('0x28')](handleError(_0x1ea073,null));};exports[_0xe510('0x8c')]=function(_0x5698bd,_0x21dde2,_0x4fefd8){return db[_0xe510('0x3c')]['find']({'where':{'id':_0x5698bd[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](handleEntityNotFound(_0x21dde2,null))[_0xe510('0x1e')](function(_0x587fc6){if(_0x587fc6){return _0x587fc6[_0xe510('0x8c')](_0x5698bd['query'][_0xe510('0x72')])[_0xe510('0x1e')](function(){if(_[_0xe510('0x8f')](_0x5698bd['query'][_0xe510('0x72')])){for(var _0x32aab7=0x0;_0x32aab7<_0x5698bd['query'][_0xe510('0x72')][_0xe510('0x46')];_0x32aab7+=0x1){socket['emit'](_0xe510('0x90'),{'UserId':Number(_0x5698bd['query'][_0xe510('0x72')][_0x32aab7]),'ChatQueueId':Number(_0x5698bd[_0xe510('0x56')]['id'])});}}else{socket[_0xe510('0x7a')](_0xe510('0x90'),{'UserId':Number(_0x5698bd['query'][_0xe510('0x72')]),'ChatQueueId':Number(_0x5698bd[_0xe510('0x56')]['id'])});}});}})[_0xe510('0x1e')](respondWithStatusCode(_0x21dde2,null))[_0xe510('0x28')](handleError(_0x21dde2,null));};exports[_0xe510('0x91')]=function(_0x2afe5e,_0x498ef0,_0x18e6ed){var _0x4f58ac={};var _0x2e7df1={};var _0x131b7a;var _0x132e73;return db[_0xe510('0x3c')][_0xe510('0x64')]({'where':{'id':_0x2afe5e[_0xe510('0x56')]['id']}})[_0xe510('0x1e')](handleEntityNotFound(_0x498ef0,null))[_0xe510('0x1e')](function(_0xecfa45){if(_0xecfa45){_0x131b7a=_0xecfa45;_0x2e7df1[_0xe510('0x40')]=_['keys'](db['User']['rawAttributes']);_0x2e7df1['query']=_['keys'](_0x2afe5e[_0xe510('0x41')]);_0x2e7df1['filters']=_[_0xe510('0x43')](_0x2e7df1[_0xe510('0x40')],_0x2e7df1[_0xe510('0x41')]);_0x4f58ac[_0xe510('0x44')]=_[_0xe510('0x43')](_0x2e7df1[_0xe510('0x40')],qs['fields'](_0x2afe5e['query'][_0xe510('0x45')]));_0x4f58ac[_0xe510('0x44')]=_0x4f58ac['attributes'][_0xe510('0x46')]?_0x4f58ac[_0xe510('0x44')]:_0x2e7df1['model'];_0x4f58ac[_0xe510('0x49')]=qs['sort'](_0x2afe5e[_0xe510('0x41')][_0xe510('0x4a')]);_0x4f58ac['where']=qs['filters'](_[_0xe510('0x4c')](_0x2afe5e['query'],_0x2e7df1[_0xe510('0x4d')]));if(_0x2afe5e[_0xe510('0x41')][_0xe510('0x4e')]){_0x4f58ac[_0xe510('0x4b')]=_[_0xe510('0x4f')](_0x4f58ac[_0xe510('0x4b')],{'$or':_['map'](_0x4f58ac[_0xe510('0x44')],function(_0x3343cd){var _0x305132={};_0x305132[_0x3343cd]={'$like':'%'+_0x2afe5e[_0xe510('0x41')]['filter']+'%'};return _0x305132;})});}_0x4f58ac=_[_0xe510('0x4f')]({},_0x4f58ac,_0x2afe5e[_0xe510('0x51')]);return _0x131b7a[_0xe510('0x91')](_0x4f58ac);}})[_0xe510('0x1e')](function(_0x4b043c){if(_0x4b043c){_0x132e73=_0x4b043c['length'];if(!_0x2afe5e[_0xe510('0x41')][_0xe510('0x47')](_0xe510('0x48'))){_0x4f58ac[_0xe510('0x2d')]=qs[_0xe510('0x2d')](_0x2afe5e[_0xe510('0x41')][_0xe510('0x2d')]);_0x4f58ac[_0xe510('0x30')]=qs['offset'](_0x2afe5e[_0xe510('0x41')][_0xe510('0x30')]);}return _0x131b7a[_0xe510('0x91')](_0x4f58ac);}})['then'](function(_0x3ce968){if(_0x3ce968){return _0x3ce968?{'count':_0x132e73,'rows':_0x3ce968}:null;}})['then'](respondWithResult(_0x498ef0,null))['catch'](handleError(_0x498ef0,null));}; \ No newline at end of file +var _0xba6a=['desk.js','querystring','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','./chatQueue.socket','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','json','undefined','count','offset','set','reject','update','then','destroy','ChatQueues','UserProfileResource','name','send','index','map','ChatQueue','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','show','params','keys','length','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','findOne','Team','order','ids','Agents','online','flatMap','sequelize','transaction','addTeams','each','forEach','userChatQueue:save','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x326d22,_0x3837b6){var _0x580a44=function(_0x236f7d){while(--_0x236f7d){_0x326d22['push'](_0x326d22['shift']());}};_0x580a44(++_0x3837b6);}(_0xba6a,0x117));var _0xaba6=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xba6a[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xaba6('0x0'));var rimraf=require(_0xaba6('0x1'));var zipdir=require(_0xaba6('0x2'));var jsonpatch=require(_0xaba6('0x3'));var rp=require(_0xaba6('0x4'));var moment=require(_0xaba6('0x5'));var BPromise=require(_0xaba6('0x6'));var Mustache=require('mustache');var util=require(_0xaba6('0x7'));var path=require(_0xaba6('0x8'));var sox=require(_0xaba6('0x9'));var csv=require(_0xaba6('0xa'));var ejs=require(_0xaba6('0xb'));var fs=require('fs');var fs_extra=require(_0xaba6('0xc'));var _=require(_0xaba6('0xd'));var squel=require(_0xaba6('0xe'));var crypto=require(_0xaba6('0xf'));var jsforce=require(_0xaba6('0x10'));var deskjs=require(_0xaba6('0x11'));var toCsv=require(_0xaba6('0xa'));var querystring=require(_0xaba6('0x12'));var Papa=require('papaparse');var Redis=require(_0xaba6('0x13'));var authService=require(_0xaba6('0x14'));var qs=require(_0xaba6('0x15'));var as=require(_0xaba6('0x16'));var hardwareService=require(_0xaba6('0x17'));var logger=require(_0xaba6('0x18'))(_0xaba6('0x19'));var utils=require(_0xaba6('0x1a'));var config=require(_0xaba6('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xaba6('0x1c'))['db'];config[_0xaba6('0x1d')]=_[_0xaba6('0x1e')](config[_0xaba6('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xaba6('0x1f'))(new Redis(config[_0xaba6('0x1d')]));require(_0xaba6('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaba6('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5403c4,_0x49c7f0,_0x26d5c7,_0x12d1b1){return new BPromise(function(_0x5b9655,_0x14749c){var _0x1d06bb=_0x12d1b1||client;return _0x1d06bb[_0xaba6('0x22')](_0x5403c4,_0x26d5c7)['then'](function(_0x2b949c){logger[_0xaba6('0x23')](_0xaba6('0x24'),_0x49c7f0,_0xaba6('0x25'));logger[_0xaba6('0x26')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x49c7f0,_0xaba6('0x25'),JSON['stringify'](_0x2b949c));if(_0x2b949c[_0xaba6('0x27')]){if(_0x2b949c['error'][_0xaba6('0x28')]===0x1f4){logger[_0xaba6('0x27')](_0xaba6('0x24'),_0x49c7f0,_0x2b949c[_0xaba6('0x27')][_0xaba6('0x29')]);return _0x14749c(_0x2b949c[_0xaba6('0x27')]['message']);}logger[_0xaba6('0x27')](_0xaba6('0x24'),_0x49c7f0,_0x2b949c[_0xaba6('0x27')][_0xaba6('0x29')]);return _0x5b9655(_0x2b949c[_0xaba6('0x27')][_0xaba6('0x29')]);}else{logger[_0xaba6('0x23')]('ChatQueue,\x20%s,\x20%s',_0x49c7f0,_0xaba6('0x25'));_0x5b9655(_0x2b949c[_0xaba6('0x2a')][_0xaba6('0x29')]);}})[_0xaba6('0x2b')](function(_0x25d981){logger[_0xaba6('0x27')](_0xaba6('0x24'),_0x49c7f0,_0x25d981);_0x14749c(_0x25d981);});});}function respondWithStatusCode(_0x256022,_0x468c3f){_0x468c3f=_0x468c3f||0xcc;return function(_0x22c9e3){if(_0x22c9e3){return _0x256022[_0xaba6('0x2c')](_0x468c3f);}return _0x256022['status'](_0x468c3f)[_0xaba6('0x2d')]();};}function respondWithResult(_0x270960,_0x5e9e75){_0x5e9e75=_0x5e9e75||0xc8;return function(_0x21689e){if(_0x21689e){return _0x270960[_0xaba6('0x2e')](_0x5e9e75)[_0xaba6('0x2f')](_0x21689e);}};}function respondWithFilteredResult(_0x15c6e6,_0x3ef6bb){return function(_0x1be4e0){if(_0x1be4e0){var _0x4e2283=typeof _0x3ef6bb['offset']===_0xaba6('0x30')&&typeof _0x3ef6bb['limit']===_0xaba6('0x30');var _0x1db337=_0x1be4e0[_0xaba6('0x31')];var _0x496ef5=_0x4e2283?0x0:_0x3ef6bb[_0xaba6('0x32')];var _0x39b155=_0x4e2283?_0x1be4e0[_0xaba6('0x31')]:_0x3ef6bb[_0xaba6('0x32')]+_0x3ef6bb['limit'];var _0x2cea54;if(_0x39b155>=_0x1db337){_0x39b155=_0x1db337;_0x2cea54=0xc8;}else{_0x2cea54=0xce;}_0x15c6e6[_0xaba6('0x2e')](_0x2cea54);return _0x15c6e6[_0xaba6('0x33')]('Content-Range',_0x496ef5+'-'+_0x39b155+'/'+_0x1db337)[_0xaba6('0x2f')](_0x1be4e0);}return null;};}function patchUpdates(_0x691518){return function(_0xc5f135){try{jsonpatch['apply'](_0xc5f135,_0x691518,!![]);}catch(_0x1c60c8){return BPromise[_0xaba6('0x34')](_0x1c60c8);}return _0xc5f135['save']();};}function saveUpdates(_0x36bffe,_0x3e136b){return function(_0x483fdb){if(_0x483fdb){return _0x483fdb[_0xaba6('0x35')](_0x36bffe)[_0xaba6('0x36')](function(_0x5b5946){return _0x5b5946;});}return null;};}function removeEntity(_0x3eaeaa,_0x10a66e){return function(_0x27155d){if(_0x27155d){return _0x27155d[_0xaba6('0x37')]()[_0xaba6('0x36')](function(){var _0x396c09=_0x27155d['get']({'plain':!![]});var _0x2889ef=_0xaba6('0x38');return db[_0xaba6('0x39')][_0xaba6('0x37')]({'where':{'type':_0x2889ef,'resourceId':_0x396c09['id']}})[_0xaba6('0x36')](function(){return _0x27155d;});})['then'](function(){_0x3eaeaa[_0xaba6('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53916e,_0x349f58){return function(_0x38fe98){if(!_0x38fe98){_0x53916e[_0xaba6('0x2c')](0x194);}return _0x38fe98;};}function handleError(_0x55680f,_0x5ef95b){_0x5ef95b=_0x5ef95b||0x1f4;return function(_0x462fd0){logger[_0xaba6('0x27')](_0x462fd0['stack']);if(_0x462fd0[_0xaba6('0x3a')]){delete _0x462fd0['name'];}_0x55680f[_0xaba6('0x2e')](_0x5ef95b)[_0xaba6('0x3b')](_0x462fd0);};}exports[_0xaba6('0x3c')]=function(_0x244539,_0x2955c1){var _0x3a975b={},_0x10d335={},_0x2682ff={'count':0x0,'rows':[]};var _0x4b1f82=_[_0xaba6('0x3d')](db[_0xaba6('0x3e')][_0xaba6('0x3f')],function(_0x7ae90b){return{'name':_0x7ae90b['fieldName'],'type':_0x7ae90b[_0xaba6('0x40')][_0xaba6('0x41')]};});_0x10d335[_0xaba6('0x42')]=_[_0xaba6('0x3d')](_0x4b1f82,_0xaba6('0x3a'));_0x10d335[_0xaba6('0x43')]=_['keys'](_0x244539[_0xaba6('0x43')]);_0x10d335[_0xaba6('0x44')]=_[_0xaba6('0x45')](_0x10d335[_0xaba6('0x42')],_0x10d335[_0xaba6('0x43')]);_0x3a975b['attributes']=_['intersection'](_0x10d335[_0xaba6('0x42')],qs[_0xaba6('0x46')](_0x244539[_0xaba6('0x43')][_0xaba6('0x46')]));_0x3a975b[_0xaba6('0x47')]=_0x3a975b[_0xaba6('0x47')]['length']?_0x3a975b['attributes']:_0x10d335[_0xaba6('0x42')];if(!_0x244539[_0xaba6('0x43')][_0xaba6('0x48')](_0xaba6('0x49'))){_0x3a975b[_0xaba6('0x4a')]=qs[_0xaba6('0x4a')](_0x244539[_0xaba6('0x43')][_0xaba6('0x4a')]);_0x3a975b['offset']=qs[_0xaba6('0x32')](_0x244539['query'][_0xaba6('0x32')]);}_0x3a975b['order']=qs[_0xaba6('0x4b')](_0x244539['query'][_0xaba6('0x4b')]);_0x3a975b[_0xaba6('0x4c')]=qs[_0xaba6('0x44')](_[_0xaba6('0x4d')](_0x244539['query'],_0x10d335['filters']),_0x4b1f82);if(_0x244539[_0xaba6('0x43')][_0xaba6('0x4e')]){_0x3a975b[_0xaba6('0x4c')]=_['merge'](_0x3a975b['where'],{'$or':_[_0xaba6('0x3d')](_0x4b1f82,function(_0x501335){if(_0x501335[_0xaba6('0x40')]!=='VIRTUAL'){var _0x5e6e2a={};_0x5e6e2a[_0x501335[_0xaba6('0x3a')]]={'$like':'%'+_0x244539[_0xaba6('0x43')]['filter']+'%'};return _0x5e6e2a;}})});}_0x3a975b=_[_0xaba6('0x4f')]({},_0x3a975b,_0x244539[_0xaba6('0x50')]);var _0x2cbece={'where':_0x3a975b[_0xaba6('0x4c')]};return db['ChatQueue']['count'](_0x2cbece)[_0xaba6('0x36')](function(_0x3c9b6c){_0x2682ff[_0xaba6('0x31')]=_0x3c9b6c;if(_0x244539[_0xaba6('0x43')][_0xaba6('0x51')]){_0x3a975b['include']=[{'all':!![]}];}return db[_0xaba6('0x3e')]['findAll'](_0x3a975b);})[_0xaba6('0x36')](function(_0x56f1e0){_0x2682ff['rows']=_0x56f1e0;return _0x2682ff;})[_0xaba6('0x36')](respondWithFilteredResult(_0x2955c1,_0x3a975b))[_0xaba6('0x2b')](handleError(_0x2955c1,null));};exports[_0xaba6('0x52')]=function(_0x2ba13e,_0x17002f){var _0x166270={'raw':!![],'where':{'id':_0x2ba13e[_0xaba6('0x53')]['id']}},_0x5d5762={};_0x5d5762[_0xaba6('0x42')]=_[_0xaba6('0x54')](db[_0xaba6('0x3e')][_0xaba6('0x3f')]);_0x5d5762['query']=_[_0xaba6('0x54')](_0x2ba13e[_0xaba6('0x43')]);_0x5d5762[_0xaba6('0x44')]=_[_0xaba6('0x45')](_0x5d5762[_0xaba6('0x42')],_0x5d5762[_0xaba6('0x43')]);_0x166270[_0xaba6('0x47')]=_[_0xaba6('0x45')](_0x5d5762['model'],qs[_0xaba6('0x46')](_0x2ba13e['query'][_0xaba6('0x46')]));_0x166270[_0xaba6('0x47')]=_0x166270[_0xaba6('0x47')][_0xaba6('0x55')]?_0x166270[_0xaba6('0x47')]:_0x5d5762[_0xaba6('0x42')];if(_0x2ba13e[_0xaba6('0x43')][_0xaba6('0x51')]){_0x166270['include']=[{'all':!![]}];}_0x166270=_['merge']({},_0x166270,_0x2ba13e[_0xaba6('0x50')]);return db[_0xaba6('0x3e')][_0xaba6('0x56')](_0x166270)[_0xaba6('0x36')](handleEntityNotFound(_0x17002f,null))[_0xaba6('0x36')](respondWithResult(_0x17002f,null))['catch'](handleError(_0x17002f,null));};exports[_0xaba6('0x57')]=function(_0x84d9e6,_0x5015b7){return db[_0xaba6('0x3e')]['create'](_0x84d9e6[_0xaba6('0x58')],{})[_0xaba6('0x36')](function(_0x955fcd){var _0x398596=_0x84d9e6[_0xaba6('0x59')][_0xaba6('0x5a')]({'plain':!![]});if(!_0x398596)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398596[_0xaba6('0x5b')]===_0xaba6('0x59')){var _0x4cc192=_0x955fcd['get']({'plain':!![]});var _0x43ac60=_0xaba6('0x38');return db[_0xaba6('0x5c')][_0xaba6('0x56')]({'where':{'name':_0x43ac60,'userProfileId':_0x398596['userProfileId']},'raw':!![]})[_0xaba6('0x36')](function(_0x31e7e7){if(_0x31e7e7&&_0x31e7e7[_0xaba6('0x5d')]===0x0){return db[_0xaba6('0x39')][_0xaba6('0x57')]({'name':_0x4cc192['name'],'resourceId':_0x4cc192['id'],'type':_0x31e7e7['name'],'sectionId':_0x31e7e7['id']},{})[_0xaba6('0x36')](function(){return _0x955fcd;});}else{return _0x955fcd;}})[_0xaba6('0x2b')](function(_0x5ab238){logger[_0xaba6('0x27')](_0xaba6('0x5e'),_0x5ab238);throw _0x5ab238;});}return _0x955fcd;})[_0xaba6('0x36')](respondWithResult(_0x5015b7,0xc9))['catch'](handleError(_0x5015b7,null));};exports[_0xaba6('0x35')]=function(_0x134f50,_0x593ac9){if(_0x134f50[_0xaba6('0x58')]['id']){delete _0x134f50[_0xaba6('0x58')]['id'];}return db[_0xaba6('0x3e')][_0xaba6('0x56')]({'where':{'id':_0x134f50[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0x593ac9,null))[_0xaba6('0x36')](saveUpdates(_0x134f50[_0xaba6('0x58')],null))['then'](respondWithResult(_0x593ac9,null))['catch'](handleError(_0x593ac9,null));};exports[_0xaba6('0x37')]=function(_0x19e61d,_0x4b3322){return db['ChatQueue']['find']({'where':{'id':_0x19e61d[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0x4b3322,null))[_0xaba6('0x36')](removeEntity(_0x4b3322,null))['catch'](handleError(_0x4b3322,null));};exports[_0xaba6('0x5f')]=function(_0x2cbd55,_0x3acca2){return db[_0xaba6('0x3e')][_0xaba6('0x5f')]()[_0xaba6('0x36')](respondWithResult(_0x3acca2,null))[_0xaba6('0x2b')](handleError(_0x3acca2,null));};exports[_0xaba6('0x60')]=function(_0x21fc54,_0xdb5165,_0x56373e){var _0xcf7091={'raw':!![],'where':{}},_0x43ec0c={},_0x183302;return db[_0xaba6('0x3e')]['findOne']({'where':{'id':_0x21fc54[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0xdb5165,null))['then'](function(_0x338b78){if(_0x338b78){_0x183302=_0x338b78['get']({'plain':!![]});_0x43ec0c[_0xaba6('0x42')]=_[_0xaba6('0x54')](db[_0xaba6('0x61')][_0xaba6('0x3f')]);_0x43ec0c[_0xaba6('0x43')]=_[_0xaba6('0x54')](_0x21fc54['query']);_0x43ec0c['filters']=_[_0xaba6('0x45')](_0x43ec0c[_0xaba6('0x42')],_0x43ec0c[_0xaba6('0x43')]);_0xcf7091['attributes']=_[_0xaba6('0x45')](_0x43ec0c[_0xaba6('0x42')],qs['fields'](_0x21fc54[_0xaba6('0x43')][_0xaba6('0x46')]));_0xcf7091['attributes']=_0xcf7091[_0xaba6('0x47')][_0xaba6('0x55')]?_0xcf7091[_0xaba6('0x47')]:_0x43ec0c[_0xaba6('0x42')];if(!_0x21fc54[_0xaba6('0x43')][_0xaba6('0x48')](_0xaba6('0x49'))){_0xcf7091[_0xaba6('0x4a')]=qs[_0xaba6('0x4a')](_0x21fc54[_0xaba6('0x43')][_0xaba6('0x4a')]);_0xcf7091[_0xaba6('0x32')]=qs['offset'](_0x21fc54[_0xaba6('0x43')][_0xaba6('0x32')]);}_0xcf7091['order']=qs['sort'](_0x21fc54[_0xaba6('0x43')][_0xaba6('0x4b')]);_0xcf7091[_0xaba6('0x4c')]=qs['filters'](_[_0xaba6('0x4d')](_0x21fc54[_0xaba6('0x43')],_0x43ec0c[_0xaba6('0x44')]));_0xcf7091['where']['ChatQueueId']=_0x338b78['id'];if(_0x21fc54[_0xaba6('0x43')][_0xaba6('0x4e')]){_0xcf7091[_0xaba6('0x4c')]=_['merge'](_0xcf7091['where'],{'$or':_['map'](_0xcf7091[_0xaba6('0x47')],function(_0x47a390){var _0x215cd4={};_0x215cd4[_0x47a390]={'$like':'%'+_0x21fc54[_0xaba6('0x43')][_0xaba6('0x4e')]+'%'};return _0x215cd4;})});}_0xcf7091=_[_0xaba6('0x4f')]({},_0xcf7091,_0x21fc54['options']);return db['UserChatQueue'][_0xaba6('0x62')](_0xcf7091);}})[_0xaba6('0x36')](function(_0x28b52d){if(_0x28b52d){return db[_0xaba6('0x63')][_0xaba6('0x64')]({'where':{'id':_[_0xaba6('0x3d')](_0x28b52d,_0xaba6('0x65')),'role':_0xaba6('0x66')},'attributes':['id','name',_0xaba6('0x67'),'updatedAt',_0xaba6('0x68')]});}})[_0xaba6('0x36')](function(_0x4c6b24){if(_0x4c6b24){return{'count':_0x4c6b24[_0xaba6('0x31')],'rows':_['map'](_0x4c6b24[_0xaba6('0x69')],function(_0x491ea3){return{'membername':_0x491ea3[_0xaba6('0x3a')],'UserId':_0x491ea3['id'],'queue_name':_0x183302[_0xaba6('0x3a')],'ChatQueueId':_0x183302['id'],'interface':util[_0xaba6('0x6a')](_0xaba6('0x6b'),'SIP',_0x491ea3[_0xaba6('0x3a')]),'penalty':0x0,'paused':_0x491ea3[_0xaba6('0x67')],'createdAt':_0x491ea3['createdAt'],'updatedAt':_0x491ea3[_0xaba6('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaba6('0x36')](respondWithFilteredResult(_0xdb5165,_0xcf7091))[_0xaba6('0x2b')](handleError(_0xdb5165,null));};exports[_0xaba6('0x6d')]=function(_0x41bca9,_0x20a748,_0x1a51c1){var _0x20505d={};var _0x1755a5={};var _0x44209e;var _0x2cd792;return db[_0xaba6('0x3e')][_0xaba6('0x6e')]({'where':{'id':_0x41bca9[_0xaba6('0x53')]['id']}})['then'](handleEntityNotFound(_0x20a748,null))['then'](function(_0x5880ef){if(_0x5880ef){_0x44209e=_0x5880ef;_0x1755a5[_0xaba6('0x42')]=_[_0xaba6('0x54')](db[_0xaba6('0x6f')][_0xaba6('0x3f')]);_0x1755a5[_0xaba6('0x43')]=_[_0xaba6('0x54')](_0x41bca9[_0xaba6('0x43')]);_0x1755a5['filters']=_[_0xaba6('0x45')](_0x1755a5[_0xaba6('0x42')],_0x1755a5[_0xaba6('0x43')]);_0x20505d[_0xaba6('0x47')]=_['intersection'](_0x1755a5[_0xaba6('0x42')],qs[_0xaba6('0x46')](_0x41bca9['query'][_0xaba6('0x46')]));_0x20505d[_0xaba6('0x47')]=_0x20505d[_0xaba6('0x47')]['length']?_0x20505d[_0xaba6('0x47')]:_0x1755a5[_0xaba6('0x42')];_0x20505d[_0xaba6('0x70')]=qs['sort'](_0x41bca9[_0xaba6('0x43')][_0xaba6('0x4b')]);_0x20505d[_0xaba6('0x4c')]=qs[_0xaba6('0x44')](_['pick'](_0x41bca9[_0xaba6('0x43')],_0x1755a5[_0xaba6('0x44')]));if(_0x41bca9[_0xaba6('0x43')][_0xaba6('0x4e')]){_0x20505d['where']=_[_0xaba6('0x4f')](_0x20505d['where'],{'$or':_[_0xaba6('0x3d')](_0x20505d[_0xaba6('0x47')],function(_0x27252b){var _0x2838a3={};_0x2838a3[_0x27252b]={'$like':'%'+_0x41bca9[_0xaba6('0x43')]['filter']+'%'};return _0x2838a3;})});}_0x20505d=_[_0xaba6('0x4f')]({},_0x20505d,_0x41bca9[_0xaba6('0x50')]);return _0x44209e['getTeams'](_0x20505d);}})[_0xaba6('0x36')](function(_0x26f777){if(_0x26f777){_0x2cd792=_0x26f777[_0xaba6('0x55')];if(!_0x41bca9['query'][_0xaba6('0x48')](_0xaba6('0x49'))){_0x20505d[_0xaba6('0x4a')]=qs[_0xaba6('0x4a')](_0x41bca9[_0xaba6('0x43')][_0xaba6('0x4a')]);_0x20505d[_0xaba6('0x32')]=qs['offset'](_0x41bca9[_0xaba6('0x43')]['offset']);}return _0x44209e['getTeams'](_0x20505d);}})['then'](function(_0x241f2e){if(_0x241f2e){return _0x241f2e?{'count':_0x2cd792,'rows':_0x241f2e}:null;}})[_0xaba6('0x36')](respondWithResult(_0x20a748,null))[_0xaba6('0x2b')](handleError(_0x20a748,null));};exports['addTeams']=function(_0x26d1dd,_0x5f3866,_0x4aac83){var _0x5456b6=_0x26d1dd[_0xaba6('0x58')][_0xaba6('0x71')];return db[_0xaba6('0x6f')][_0xaba6('0x62')]({'where':{'id':_0x5456b6},'attributes':['id'],'include':[{'model':db[_0xaba6('0x63')],'as':_0xaba6('0x72'),'attributes':['id','name',_0xaba6('0x73'),'voicePause','interface'],'raw':!![]}]})[_0xaba6('0x36')](function(_0x4e9d32){if(_0x4e9d32){var _0x149001=_[_0xaba6('0x74')](_0x4e9d32,function(_0x42d815){var _0x3f28c6=_0x42d815['get']({'plain':!![]});return _0x3f28c6['Agents'];});return db[_0xaba6('0x3e')][_0xaba6('0x56')]({'where':{'id':_0x26d1dd[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](function(_0x23a406){return db[_0xaba6('0x75')][_0xaba6('0x76')](function(_0x3887e3){return _0x23a406[_0xaba6('0x77')](_0x5456b6,{'transaction':_0x3887e3})[_0xaba6('0x36')](function(){return BPromise[_0xaba6('0x78')](_0x149001,function(_0x264e5b){return db[_0xaba6('0x61')]['findOrCreate']({'where':{'UserId':_0x264e5b['id'],'ChatQueueId':_0x26d1dd[_0xaba6('0x53')]['id']},'transaction':_0x3887e3});});})[_0xaba6('0x36')](function(){_0x149001[_0xaba6('0x79')](function(_0x46b8b5){socket['emit'](_0xaba6('0x7a'),{'UserId':_0x46b8b5['id'],'ChatQueueId':_0x23a406['id']});});});});});}})[_0xaba6('0x36')](respondWithStatusCode(_0x5f3866,null))[_0xaba6('0x2b')](handleError(_0x5f3866,null));};exports['removeTeams']=function(_0x2276c9,_0x3e1b73,_0x210e6a){return db[_0xaba6('0x6f')][_0xaba6('0x62')]({'where':{'id':_0x2276c9['query'][_0xaba6('0x71')]},'attributes':['id'],'include':[{'model':db[_0xaba6('0x63')],'as':_0xaba6('0x72'),'attributes':['id'],'raw':!![]}]})[_0xaba6('0x36')](handleEntityNotFound(_0x3e1b73,null))[_0xaba6('0x36')](function(_0x5d167d){var _0x231e7e=_['map'](_0x5d167d,'id');var _0x48cc7c=[];var _0x1ec8f1=[];var _0x98e648=squel['select']();_0x98e648['field'](_0xaba6('0x7b'))[_0xaba6('0x7c')]('team_has_chat_queues','tq')[_0xaba6('0x7d')](_0xaba6('0x7e'),'ut',_0xaba6('0x7f'))['where'](_0xaba6('0x80'),_0x2276c9[_0xaba6('0x53')]['id']);for(var _0xf52f02=0x0;_0xf52f02<_0x5d167d[_0xaba6('0x55')];_0xf52f02+=0x1){let _0x4843c8=_0x5d167d[_0xf52f02];for(var _0x4722b6=0x0;_0x4722b6<_0x4843c8[_0xaba6('0x72')]['length'];_0x4722b6+=0x1){let _0xa2a6ed=_0x4843c8['Agents'][_0x4722b6];var _0x3dab00=_0x98e648[_0xaba6('0x81')]();_0x3dab00['where'](_0xaba6('0x82'),_0xa2a6ed['id']);_0x1ec8f1['push'](db[_0xaba6('0x75')]['query'](_0x3dab00[_0xaba6('0x83')](),{'type':db[_0xaba6('0x75')][_0xaba6('0x84')][_0xaba6('0x85')]})[_0xaba6('0x36')](function(_0x32191a){if(_0x32191a['length']===0x1){return _0xa2a6ed['id'];}else{var _0x2c8205=_['every'](_[_0xaba6('0x3d')](_0x32191a,'TeamId'),function(_0x3ed07d){return _[_0xaba6('0x86')](_0x231e7e,_0x3ed07d);});if(_0x2c8205){return _0xa2a6ed['id'];}}}));}}return BPromise[_0xaba6('0x87')](_0x1ec8f1)[_0xaba6('0x36')](function(_0x5c7d7f){_0x48cc7c=_(_0x48cc7c)['union'](_0x5c7d7f)[_0xaba6('0x88')]()[_0xaba6('0x89')]();return db[_0xaba6('0x3e')][_0xaba6('0x56')]({'where':{'id':_0x2276c9['params']['id']}})['then'](function(_0x139258){return db[_0xaba6('0x75')][_0xaba6('0x76')](function(_0x32b1cc){return _0x139258[_0xaba6('0x8a')](_0x2276c9[_0xaba6('0x43')][_0xaba6('0x71')],{'transaction':_0x32b1cc})[_0xaba6('0x36')](function(){if(!_[_0xaba6('0x8b')](_0x48cc7c)){return _0x139258[_0xaba6('0x8c')](_0x48cc7c,{'transaction':_0x32b1cc});}})[_0xaba6('0x36')](function(){_0x48cc7c[_0xaba6('0x79')](function(_0x58b140){socket[_0xaba6('0x8d')](_0xaba6('0x8e'),{'UserId':_0x58b140,'ChatQueueId':_0x139258['id']});});});});});});})[_0xaba6('0x36')](respondWithStatusCode(_0x3e1b73,null))[_0xaba6('0x2b')](handleError(_0x3e1b73,null));};exports[_0xaba6('0x8f')]=function(_0x4981f6,_0x1a35b5,_0x436002){return db[_0xaba6('0x3e')][_0xaba6('0x56')]({'where':{'id':_0x4981f6[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0x1a35b5,null))[_0xaba6('0x36')](function(_0x1c2672){if(_0x1c2672){return _0x1c2672[_0xaba6('0x8f')](_0x4981f6[_0xaba6('0x58')][_0xaba6('0x71')],_[_0xaba6('0x90')](_0x4981f6[_0xaba6('0x58')],[_0xaba6('0x71'),'id'])||{})[_0xaba6('0x91')](function(_0x927510){for(var _0x1a05c6=0x0;_0x1a05c6<_0x4981f6[_0xaba6('0x58')][_0xaba6('0x71')]['length'];_0x1a05c6+=0x1){socket['emit'](_0xaba6('0x7a'),{'UserId':Number(_0x4981f6['body']['ids'][_0x1a05c6]),'ChatQueueId':Number(_0x4981f6['params']['id'])});}return _0x927510;});}})[_0xaba6('0x36')](respondWithResult(_0x1a35b5,null))[_0xaba6('0x2b')](handleError(_0x1a35b5,null));};exports[_0xaba6('0x8c')]=function(_0x801861,_0x39c1b2,_0x5e62b7){return db[_0xaba6('0x3e')][_0xaba6('0x56')]({'where':{'id':_0x801861[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0x39c1b2,null))['then'](function(_0x1043fc){if(_0x1043fc){return _0x1043fc['removeAgents'](_0x801861[_0xaba6('0x43')][_0xaba6('0x71')])[_0xaba6('0x36')](function(){if(_[_0xaba6('0x92')](_0x801861[_0xaba6('0x43')][_0xaba6('0x71')])){for(var _0x4bef72=0x0;_0x4bef72<_0x801861[_0xaba6('0x43')]['ids'][_0xaba6('0x55')];_0x4bef72+=0x1){socket[_0xaba6('0x8d')]('userChatQueue:remove',{'UserId':Number(_0x801861[_0xaba6('0x43')][_0xaba6('0x71')][_0x4bef72]),'ChatQueueId':Number(_0x801861[_0xaba6('0x53')]['id'])});}}else{socket[_0xaba6('0x8d')](_0xaba6('0x8e'),{'UserId':Number(_0x801861['query'][_0xaba6('0x71')]),'ChatQueueId':Number(_0x801861[_0xaba6('0x53')]['id'])});}});}})[_0xaba6('0x36')](respondWithStatusCode(_0x39c1b2,null))[_0xaba6('0x2b')](handleError(_0x39c1b2,null));};exports['getAgents']=function(_0x43967c,_0x417139,_0x27609d){var _0x2b8b7d={};var _0x294859={};var _0x860fe7;var _0x4dfa88;return db[_0xaba6('0x3e')][_0xaba6('0x6e')]({'where':{'id':_0x43967c[_0xaba6('0x53')]['id']}})[_0xaba6('0x36')](handleEntityNotFound(_0x417139,null))[_0xaba6('0x36')](function(_0x33c81a){if(_0x33c81a){_0x860fe7=_0x33c81a;_0x294859['model']=_['keys'](db[_0xaba6('0x63')][_0xaba6('0x3f')]);_0x294859[_0xaba6('0x43')]=_['keys'](_0x43967c[_0xaba6('0x43')]);_0x294859[_0xaba6('0x44')]=_[_0xaba6('0x45')](_0x294859[_0xaba6('0x42')],_0x294859[_0xaba6('0x43')]);_0x2b8b7d[_0xaba6('0x47')]=_[_0xaba6('0x45')](_0x294859[_0xaba6('0x42')],qs['fields'](_0x43967c[_0xaba6('0x43')]['fields']));_0x2b8b7d[_0xaba6('0x47')]=_0x2b8b7d[_0xaba6('0x47')][_0xaba6('0x55')]?_0x2b8b7d['attributes']:_0x294859['model'];_0x2b8b7d[_0xaba6('0x70')]=qs['sort'](_0x43967c[_0xaba6('0x43')][_0xaba6('0x4b')]);_0x2b8b7d['where']=qs[_0xaba6('0x44')](_[_0xaba6('0x4d')](_0x43967c[_0xaba6('0x43')],_0x294859['filters']));if(_0x43967c[_0xaba6('0x43')]['filter']){_0x2b8b7d[_0xaba6('0x4c')]=_[_0xaba6('0x4f')](_0x2b8b7d[_0xaba6('0x4c')],{'$or':_[_0xaba6('0x3d')](_0x2b8b7d[_0xaba6('0x47')],function(_0x31c665){var _0x1b1322={};_0x1b1322[_0x31c665]={'$like':'%'+_0x43967c['query'][_0xaba6('0x4e')]+'%'};return _0x1b1322;})});}_0x2b8b7d=_[_0xaba6('0x4f')]({},_0x2b8b7d,_0x43967c[_0xaba6('0x50')]);return _0x860fe7['getAgents'](_0x2b8b7d);}})[_0xaba6('0x36')](function(_0x4b5743){if(_0x4b5743){_0x4dfa88=_0x4b5743[_0xaba6('0x55')];if(!_0x43967c[_0xaba6('0x43')][_0xaba6('0x48')]('nolimit')){_0x2b8b7d[_0xaba6('0x4a')]=qs[_0xaba6('0x4a')](_0x43967c[_0xaba6('0x43')][_0xaba6('0x4a')]);_0x2b8b7d['offset']=qs[_0xaba6('0x32')](_0x43967c['query'][_0xaba6('0x32')]);}return _0x860fe7[_0xaba6('0x93')](_0x2b8b7d);}})['then'](function(_0xf0fdbe){if(_0xf0fdbe){return _0xf0fdbe?{'count':_0x4dfa88,'rows':_0xf0fdbe}:null;}})[_0xaba6('0x36')](respondWithResult(_0x417139,null))[_0xaba6('0x2b')](handleError(_0x417139,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3c78c59..a09272f 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 _0x3bde=['../../mysqldb','ChatQueue','setMaxListeners','emit','hasOwnProperty','hook','events'];(function(_0x2840f7,_0x443096){var _0x9c65da=function(_0x5a30d6){while(--_0x5a30d6){_0x2840f7['push'](_0x2840f7['shift']());}};_0x9c65da(++_0x443096);}(_0x3bde,0x68));var _0xe3bd=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x3bde[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0xe3bd('0x0'));var ChatQueue=require(_0xe3bd('0x1'))['db'][_0xe3bd('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe3bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a9511){return function(_0x4a2a7f,_0x17c2bd,_0x276ae8){ChatQueueEvents[_0xe3bd('0x4')](_0x4a9511+':'+_0x4a2a7f['id'],_0x4a2a7f);ChatQueueEvents[_0xe3bd('0x4')](_0x4a9511,_0x4a2a7f);_0x276ae8(null);};}for(var e in events){if(events[_0xe3bd('0x5')](e)){var event=events[e];ChatQueue[_0xe3bd('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xcee0=['hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2a1dc3,_0x2bcbcc){var _0x4f0d17=function(_0x4f44a7){while(--_0x4f44a7){_0x2a1dc3['push'](_0x2a1dc3['shift']());}};_0x4f0d17(++_0x2bcbcc);}(_0xcee0,0x1e1));var _0x0cee=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xcee0[_0x2b9cf5];return _0xd0cf15;};'use strict';var EventEmitter=require(_0x0cee('0x0'));var ChatQueue=require(_0x0cee('0x1'))['db'][_0x0cee('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0cee('0x3')](0x0);var events={'afterCreate':_0x0cee('0x4'),'afterUpdate':_0x0cee('0x5'),'afterDestroy':_0x0cee('0x6')};function emitEvent(_0x271b72){return function(_0x3d96bf,_0x4b32f3,_0x37dba2){ChatQueueEvents[_0x0cee('0x7')](_0x271b72+':'+_0x3d96bf['id'],_0x3d96bf);ChatQueueEvents[_0x0cee('0x7')](_0x271b72,_0x3d96bf);_0x37dba2(null);};}for(var e in events){if(events[_0x0cee('0x8')](e)){var event=events[e];ChatQueue[_0x0cee('0x9')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 096d733..5ec06a4 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 _0xfdb0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue'];(function(_0x39c43e,_0x2a01e0){var _0x5458ad=function(_0x8c710c){while(--_0x8c710c){_0x39c43e['push'](_0x39c43e['shift']());}};_0x5458ad(++_0x2a01e0);}(_0xfdb0,0x6c));var _0x0fdb=function(_0xd21f9c,_0x869969){_0xd21f9c=_0xd21f9c-0x0;var _0x5bd476=_0xfdb0[_0xd21f9c];return _0x5bd476;};'use strict';var _=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var logger=require(_0x0fdb('0x2'))(_0x0fdb('0x3'));var moment=require(_0x0fdb('0x4'));var BPromise=require(_0x0fdb('0x5'));var rp=require(_0x0fdb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fdb('0x7'));var config=require(_0x0fdb('0x8'));var attributes=require(_0x0fdb('0x9'));module[_0x0fdb('0xa')]=function(_0x4e5ca7,_0x1bb39a){return _0x4e5ca7['define'](_0x0fdb('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x681b=['rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a771b,_0x51faba){var _0x46de43=function(_0x2d2f28){while(--_0x2d2f28){_0x3a771b['push'](_0x3a771b['shift']());}};_0x46de43(++_0x51faba);}(_0x681b,0xad));var _0xb681=function(_0x4d5571,_0x25c8c8){_0x4d5571=_0x4d5571-0x0;var _0x65ad18=_0x681b[_0x4d5571];return _0x65ad18;};'use strict';var _=require(_0xb681('0x0'));var util=require(_0xb681('0x1'));var logger=require(_0xb681('0x2'))(_0xb681('0x3'));var moment=require(_0xb681('0x4'));var BPromise=require(_0xb681('0x5'));var rp=require(_0xb681('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb681('0x7'));var config=require(_0xb681('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0xb7f426,_0x540b21){return _0xb7f426[_0xb681('0x9')](_0xb681('0xa'),attributes,{'tableName':_0xb681('0xb'),'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 dcd7717..bd766ef 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 _0xab40=['GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','ShowChatQueue','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xab40,0xcd));var _0x0ab4=function(_0x90db4,_0x5911db){_0x90db4=_0x90db4-0x0;var _0x3d4960=_0xab40[_0x90db4];return _0x3d4960;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});config[_0x0ab4('0x8')]=_[_0x0ab4('0x9')](config[_0x0ab4('0x8')],{'host':_0x0ab4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x0ab4('0xb')](socket);function respondWithRpcPromise(_0x30e726,_0x40e4d1,_0x464f7e){return new BPromise(function(_0x413d9b,_0x24c6c1){return client[_0x0ab4('0xc')](_0x30e726,_0x464f7e)[_0x0ab4('0xd')](function(_0x4e1708){logger['info'](_0x0ab4('0xe'),_0x40e4d1,'request\x20sent');logger[_0x0ab4('0xf')](_0x0ab4('0x10'),_0x40e4d1,_0x0ab4('0x11'),JSON[_0x0ab4('0x12')](_0x4e1708));if(_0x4e1708[_0x0ab4('0x13')]){if(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x24c6c1(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x413d9b(_0x4e1708[_0x0ab4('0x13')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x40e4d1,_0x0ab4('0x11'));_0x413d9b(_0x4e1708[_0x0ab4('0x16')][_0x0ab4('0x15')]);}})['catch'](function(_0x1e3fe2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x1e3fe2);_0x24c6c1(_0x1e3fe2);});});}exports[_0x0ab4('0x17')]=function(_0x4e7852){var _0x4ff836=this;return new Promise(function(_0xdb0797,_0x5b1ed5){return db[_0x0ab4('0x18')][_0x0ab4('0x19')]({'raw':_0x4e7852['options']?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1c')]||null:null,'attributes':_0x4e7852['options']?_0x4e7852['options'][_0x0ab4('0x1d')]||null:null,'limit':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1e')]||null:null,'include':_0x4e7852['options']?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1f')]?_[_0x0ab4('0x20')](_0x4e7852['options']['include'],function(_0x176ff1){return{'model':db[_0x176ff1[_0x0ab4('0x21')]],'as':_0x176ff1['as'],'attributes':_0x176ff1[_0x0ab4('0x1d')],'include':_0x176ff1['include']?_['map'](_0x176ff1['include'],function(_0x19ecc6){return{'model':db[_0x19ecc6['model']],'as':_0x19ecc6['as'],'attributes':_0x19ecc6[_0x0ab4('0x1d')],'include':_0x19ecc6[_0x0ab4('0x1f')]?_['map'](_0x19ecc6['include'],function(_0x4d0cc1){return{'model':db[_0x4d0cc1[_0x0ab4('0x21')]],'as':_0x4d0cc1['as'],'attributes':_0x4d0cc1[_0x0ab4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xd')](function(_0x3f61cb){logger[_0x0ab4('0x22')]('GetChatQueue',_0x4e7852);logger['debug']('GetChatQueue',_0x4e7852,JSON[_0x0ab4('0x12')](_0x3f61cb));_0xdb0797(_0x3f61cb);})[_0x0ab4('0x23')](function(_0x155d96){logger[_0x0ab4('0x13')](_0x0ab4('0x17'),_0x155d96['message'],_0x4e7852);_0x5b1ed5(_0x4ff836['error'](0x1f4,_0x155d96[_0x0ab4('0x15')]));});});};exports[_0x0ab4('0x24')]=function(_0x361f7c){var _0x4819be=this;return new Promise(function(_0x48e430,_0x1b19db){return db['ChatQueue'][_0x0ab4('0x25')]({'raw':_0x361f7c[_0x0ab4('0x1a')]?_0x361f7c[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![],'where':_0x361f7c[_0x0ab4('0x1a')]?_0x361f7c[_0x0ab4('0x1a')]['where']||null:null,'attributes':_0x361f7c[_0x0ab4('0x1a')]?_0x361f7c[_0x0ab4('0x1a')][_0x0ab4('0x1d')]||null:null,'include':_0x361f7c[_0x0ab4('0x1a')]?_0x361f7c['options']['include']?_[_0x0ab4('0x20')](_0x361f7c[_0x0ab4('0x1a')][_0x0ab4('0x1f')],function(_0x4fca1b){return{'model':db[_0x4fca1b['model']],'as':_0x4fca1b['as'],'attributes':_0x4fca1b['attributes'],'include':_0x4fca1b[_0x0ab4('0x1f')]?_[_0x0ab4('0x20')](_0x4fca1b[_0x0ab4('0x1f')],function(_0x53d1fc){return{'model':db[_0x53d1fc['model']],'as':_0x53d1fc['as'],'attributes':_0x53d1fc['attributes'],'include':_0x53d1fc[_0x0ab4('0x1f')]?_[_0x0ab4('0x20')](_0x53d1fc[_0x0ab4('0x1f')],function(_0x39d99b){return{'model':db[_0x39d99b[_0x0ab4('0x21')]],'as':_0x39d99b['as'],'attributes':_0x39d99b[_0x0ab4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xd')](function(_0xfb7f92){logger[_0x0ab4('0x22')](_0x0ab4('0x24'),_0x361f7c);logger['debug'](_0x0ab4('0x24'),_0x361f7c,JSON[_0x0ab4('0x12')](_0xfb7f92));_0x48e430(_0xfb7f92);})[_0x0ab4('0x23')](function(_0x97d4ad){logger[_0x0ab4('0x13')](_0x0ab4('0x24'),_0x97d4ad[_0x0ab4('0x15')],_0x361f7c);_0x1b19db(_0x4819be[_0x0ab4('0x13')](0x1f4,_0x97d4ad[_0x0ab4('0x15')]));});});}; \ No newline at end of file +var _0x21f5=['error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowChatQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x413b2b,_0x24f421){var _0x46df89=function(_0x23ab6a){while(--_0x23ab6a){_0x413b2b['push'](_0x413b2b['shift']());}};_0x46df89(++_0x24f421);}(_0x21f5,0x1e5));var _0x521f=function(_0x50f3ca,_0x44a3eb){_0x50f3ca=_0x50f3ca-0x0;var _0x3b7e98=_0x21f5[_0x50f3ca];return _0x3b7e98;};'use strict';var _=require('lodash');var util=require(_0x521f('0x0'));var moment=require('moment');var BPromise=require(_0x521f('0x1'));var rs=require(_0x521f('0x2'));var fs=require('fs');var Redis=require(_0x521f('0x3'));var db=require(_0x521f('0x4'))['db'];var utils=require(_0x521f('0x5'));var logger=require(_0x521f('0x6'))('rpc');var config=require(_0x521f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x521f('0x8')]['http']({'port':0x232a});config[_0x521f('0x9')]=_[_0x521f('0xa')](config['redis'],{'host':_0x521f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x521f('0xc'))['register'](socket);function respondWithRpcPromise(_0x259a30,_0x4de399,_0x5e3cd8){return new BPromise(function(_0x245588,_0x5a460a){return client['request'](_0x259a30,_0x5e3cd8)['then'](function(_0x13caff){logger[_0x521f('0xd')](_0x521f('0xe'),_0x4de399,_0x521f('0xf'));logger[_0x521f('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4de399,'request\x20sent',JSON[_0x521f('0x11')](_0x13caff));if(_0x13caff['error']){if(_0x13caff['error'][_0x521f('0x12')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4de399,_0x13caff[_0x521f('0x13')][_0x521f('0x14')]);return _0x5a460a(_0x13caff[_0x521f('0x13')][_0x521f('0x14')]);}logger[_0x521f('0x13')](_0x521f('0xe'),_0x4de399,_0x13caff[_0x521f('0x13')][_0x521f('0x14')]);return _0x245588(_0x13caff['error'][_0x521f('0x14')]);}else{logger[_0x521f('0xd')](_0x521f('0xe'),_0x4de399,_0x521f('0xf'));_0x245588(_0x13caff[_0x521f('0x15')]['message']);}})[_0x521f('0x16')](function(_0x3646f5){logger[_0x521f('0x13')](_0x521f('0xe'),_0x4de399,_0x3646f5);_0x5a460a(_0x3646f5);});});}exports[_0x521f('0x17')]=function(_0x5ae89f){var _0x8bedba=this;return new Promise(function(_0x2cb4e9,_0x181fa1){return db[_0x521f('0x18')][_0x521f('0x19')]({'raw':_0x5ae89f['options']?_0x5ae89f[_0x521f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5ae89f[_0x521f('0x1a')]?_0x5ae89f['options'][_0x521f('0x1b')]||null:null,'attributes':_0x5ae89f[_0x521f('0x1a')]?_0x5ae89f[_0x521f('0x1a')][_0x521f('0x1c')]||null:null,'limit':_0x5ae89f[_0x521f('0x1a')]?_0x5ae89f[_0x521f('0x1a')][_0x521f('0x1d')]||null:null,'include':_0x5ae89f[_0x521f('0x1a')]?_0x5ae89f[_0x521f('0x1a')][_0x521f('0x1e')]?_['map'](_0x5ae89f[_0x521f('0x1a')][_0x521f('0x1e')],function(_0x40a1fc){return{'model':db[_0x40a1fc['model']],'as':_0x40a1fc['as'],'attributes':_0x40a1fc[_0x521f('0x1c')],'include':_0x40a1fc[_0x521f('0x1e')]?_[_0x521f('0x1f')](_0x40a1fc['include'],function(_0x39e3a7){return{'model':db[_0x39e3a7[_0x521f('0x20')]],'as':_0x39e3a7['as'],'attributes':_0x39e3a7[_0x521f('0x1c')],'include':_0x39e3a7[_0x521f('0x1e')]?_[_0x521f('0x1f')](_0x39e3a7[_0x521f('0x1e')],function(_0xdd89b6){return{'model':db[_0xdd89b6[_0x521f('0x20')]],'as':_0xdd89b6['as'],'attributes':_0xdd89b6[_0x521f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x521f('0x21')](function(_0x22d477){logger['info'](_0x521f('0x17'),_0x5ae89f);logger[_0x521f('0x10')](_0x521f('0x17'),_0x5ae89f,JSON[_0x521f('0x11')](_0x22d477));_0x2cb4e9(_0x22d477);})['catch'](function(_0x438deb){logger['error'](_0x521f('0x17'),_0x438deb[_0x521f('0x14')],_0x5ae89f);_0x181fa1(_0x8bedba['error'](0x1f4,_0x438deb[_0x521f('0x14')]));});});};exports[_0x521f('0x22')]=function(_0x515de7){var _0x2a99ff=this;return new Promise(function(_0x3b6d86,_0x23f0ff){return db[_0x521f('0x18')][_0x521f('0x23')]({'raw':_0x515de7['options']?_0x515de7[_0x521f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x515de7['options']?_0x515de7[_0x521f('0x1a')][_0x521f('0x1b')]||null:null,'attributes':_0x515de7[_0x521f('0x1a')]?_0x515de7[_0x521f('0x1a')][_0x521f('0x1c')]||null:null,'include':_0x515de7[_0x521f('0x1a')]?_0x515de7['options'][_0x521f('0x1e')]?_[_0x521f('0x1f')](_0x515de7['options'][_0x521f('0x1e')],function(_0x594c89){return{'model':db[_0x594c89[_0x521f('0x20')]],'as':_0x594c89['as'],'attributes':_0x594c89['attributes'],'include':_0x594c89[_0x521f('0x1e')]?_[_0x521f('0x1f')](_0x594c89[_0x521f('0x1e')],function(_0x5dc6fd){return{'model':db[_0x5dc6fd[_0x521f('0x20')]],'as':_0x5dc6fd['as'],'attributes':_0x5dc6fd[_0x521f('0x1c')],'include':_0x5dc6fd[_0x521f('0x1e')]?_[_0x521f('0x1f')](_0x5dc6fd['include'],function(_0x4b85a8){return{'model':db[_0x4b85a8[_0x521f('0x20')]],'as':_0x4b85a8['as'],'attributes':_0x4b85a8[_0x521f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x502a07){logger[_0x521f('0xd')](_0x521f('0x22'),_0x515de7);logger[_0x521f('0x10')](_0x521f('0x22'),_0x515de7,JSON[_0x521f('0x11')](_0x502a07));_0x3b6d86(_0x502a07);})[_0x521f('0x16')](function(_0x4aaad0){logger[_0x521f('0x13')]('ShowChatQueue',_0x4aaad0[_0x521f('0x14')],_0x515de7);_0x23f0ff(_0x2a99ff['error'](0x1f4,_0x4aaad0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a15b072..c2b0785 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 _0x68fc=['emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x2cde2a,_0x4325c4){var _0x110f55=function(_0x4927f5){while(--_0x4927f5){_0x2cde2a['push'](_0x2cde2a['shift']());}};_0x110f55(++_0x4325c4);}(_0x68fc,0xa5));var _0xc68f=function(_0x58335a,_0x44b6bf){_0x58335a=_0x58335a-0x0;var _0x5be056=_0x68fc[_0x58335a];return _0x5be056;};'use strict';var ChatQueueEvents=require(_0xc68f('0x0'));var events=[_0xc68f('0x1'),_0xc68f('0x2'),'update'];function createListener(_0x49aa95,_0x26513f){return function(_0x506fb5){_0x26513f[_0xc68f('0x3')](_0x49aa95,_0x506fb5);};}function removeListener(_0x593648,_0x5899ea){return function(){ChatQueueEvents[_0xc68f('0x4')](_0x593648,_0x5899ea);};}exports[_0xc68f('0x5')]=function(_0x1c6df9){for(var _0x363cdf=0x0,_0x4fcce4=events['length'];_0x363cdf<_0x4fcce4;_0x363cdf++){var _0x9f2705=events[_0x363cdf];var _0x2bf3fd=createListener(_0xc68f('0x6')+_0x9f2705,_0x1c6df9);ChatQueueEvents['on'](_0x9f2705,_0x2bf3fd);}}; \ No newline at end of file +var _0x81bd=['save','remove','update','removeListener','./chatQueue.events'];(function(_0x4a2ff3,_0x34da4c){var _0x220c47=function(_0x25a04c){while(--_0x25a04c){_0x4a2ff3['push'](_0x4a2ff3['shift']());}};_0x220c47(++_0x34da4c);}(_0x81bd,0x7c));var _0xd81b=function(_0x19776e,_0x3690de){_0x19776e=_0x19776e-0x0;var _0xce4b5f=_0x81bd[_0x19776e];return _0xce4b5f;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 13a6641..15399b9 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(_0x5573ee,_0x3db368){var _0x123163=function(_0x5a92db){while(--_0x5a92db){_0x5573ee['push'](_0x5573ee['shift']());}};_0x123163(++_0x3db368);}(_0x008c,0x188));var _0xc008=function(_0x568d30,_0x50fceb){_0x568d30=_0x568d30-0x0;var _0xabb817=_0x008c[_0x568d30];return _0xabb817;};'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(_0x15622e,_0x5422ed){var _0x218768=function(_0x2ae810){while(--_0x2ae810){_0x15622e['push'](_0x15622e['shift']());}};_0x218768(++_0x5422ed);}(_0x55ca,0x126));var _0xa55c=function(_0xd81b5b,_0x15f6a7){_0xd81b5b=_0xd81b5b-0x0;var _0x52ffd9=_0x55ca[_0xd81b5b];return _0x52ffd9;};'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 dac5702..5465de9 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 _0xd88c=['sequelize','exports','STRING','DATE','moment'];(function(_0xbcb09a,_0x4ce38b){var _0x2cf112=function(_0x4a3849){while(--_0x4a3849){_0xbcb09a['push'](_0xbcb09a['shift']());}};_0x2cf112(++_0x4ce38b);}(_0xd88c,0x162));var _0xcd88=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0xd88c[_0x39d711];return _0xee1d0c;};'use strict';var moment=require(_0xcd88('0x0'));var Sequelize=require(_0xcd88('0x1'));module[_0xcd88('0x2')]={'uniqueid':{'type':Sequelize[_0xcd88('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcd88('0x4')]},'leaveAt':{'type':Sequelize[_0xcd88('0x4')]},'acceptAt':{'type':Sequelize[_0xcd88('0x4')]},'exitAt':{'type':Sequelize[_0xcd88('0x4')]},'reason':{'type':Sequelize[_0xcd88('0x3')]}}; \ No newline at end of file +var _0x4e49=['sequelize','exports','STRING','DATE','moment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4e49,0x15d));var _0x94e4=function(_0xec2172,_0x3def75){_0xec2172=_0xec2172-0x0;var _0x203f38=_0x4e49[_0xec2172];return _0x203f38;};'use strict';var moment=require(_0x94e4('0x0'));var Sequelize=require(_0x94e4('0x1'));module[_0x94e4('0x2')]={'uniqueid':{'type':Sequelize[_0x94e4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x94e4('0x3')]},'joinAt':{'type':Sequelize[_0x94e4('0x4')]},'leaveAt':{'type':Sequelize[_0x94e4('0x4')]},'acceptAt':{'type':Sequelize[_0x94e4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x94e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d64238d..2d48b81 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 _0x77f7=['name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','catch','body','find','describe','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1ac279,_0x4127cb){var _0x3ecefa=function(_0x144441){while(--_0x144441){_0x1ac279['push'](_0x1ac279['shift']());}};_0x3ecefa(++_0x4127cb);}(_0x77f7,0xbd));var _0x777f=function(_0xe5fedd,_0x5eda04){_0xe5fedd=_0xe5fedd-0x0;var _0x123fd0=_0x77f7[_0xe5fedd];return _0x123fd0;};'use strict';var emlformat=require(_0x777f('0x0'));var rimraf=require(_0x777f('0x1'));var zipdir=require(_0x777f('0x2'));var jsonpatch=require(_0x777f('0x3'));var rp=require(_0x777f('0x4'));var moment=require(_0x777f('0x5'));var BPromise=require(_0x777f('0x6'));var Mustache=require(_0x777f('0x7'));var util=require(_0x777f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x777f('0x9'));var ejs=require(_0x777f('0xa'));var fs=require('fs');var fs_extra=require(_0x777f('0xb'));var _=require(_0x777f('0xc'));var squel=require(_0x777f('0xd'));var crypto=require(_0x777f('0xe'));var jsforce=require(_0x777f('0xf'));var deskjs=require(_0x777f('0x10'));var toCsv=require(_0x777f('0x9'));var querystring=require(_0x777f('0x11'));var Papa=require('papaparse');var Redis=require(_0x777f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x777f('0x13'));var as=require(_0x777f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x777f('0x15'))(_0x777f('0x16'));var utils=require(_0x777f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x777f('0x18'));var db=require(_0x777f('0x19'))['db'];function respondWithStatusCode(_0x285bf7,_0x30f31b){_0x30f31b=_0x30f31b||0xcc;return function(_0xee481c){if(_0xee481c){return _0x285bf7[_0x777f('0x1a')](_0x30f31b);}return _0x285bf7['status'](_0x30f31b)[_0x777f('0x1b')]();};}function respondWithResult(_0x2cef15,_0x5468c0){_0x5468c0=_0x5468c0||0xc8;return function(_0x36652d){if(_0x36652d){return _0x2cef15[_0x777f('0x1c')](_0x5468c0)[_0x777f('0x1d')](_0x36652d);}};}function respondWithFilteredResult(_0x43d45a,_0xf4d60b){return function(_0x217e98){if(_0x217e98){var _0x41855a=typeof _0xf4d60b['offset']===_0x777f('0x1e')&&typeof _0xf4d60b[_0x777f('0x1f')]===_0x777f('0x1e');var _0x1ef1c5=_0x217e98[_0x777f('0x20')];var _0x3aeb58=_0x41855a?0x0:_0xf4d60b[_0x777f('0x21')];var _0x4e1153=_0x41855a?_0x217e98['count']:_0xf4d60b[_0x777f('0x21')]+_0xf4d60b[_0x777f('0x1f')];var _0x31f786;if(_0x4e1153>=_0x1ef1c5){_0x4e1153=_0x1ef1c5;_0x31f786=0xc8;}else{_0x31f786=0xce;}_0x43d45a[_0x777f('0x1c')](_0x31f786);return _0x43d45a[_0x777f('0x22')](_0x777f('0x23'),_0x3aeb58+'-'+_0x4e1153+'/'+_0x1ef1c5)[_0x777f('0x1d')](_0x217e98);}return null;};}function patchUpdates(_0x143f3d){return function(_0x5d31f1){try{jsonpatch[_0x777f('0x24')](_0x5d31f1,_0x143f3d,!![]);}catch(_0x5637d0){return BPromise[_0x777f('0x25')](_0x5637d0);}return _0x5d31f1[_0x777f('0x26')]();};}function saveUpdates(_0x1cc281,_0x38e32f){return function(_0x3a0c1d){if(_0x3a0c1d){return _0x3a0c1d[_0x777f('0x27')](_0x1cc281)[_0x777f('0x28')](function(_0x5732c6){return _0x5732c6;});}return null;};}function removeEntity(_0x780490,_0x17f1ed){return function(_0x5089ba){if(_0x5089ba){return _0x5089ba[_0x777f('0x29')]()['then'](function(){_0x780490[_0x777f('0x1c')](0xcc)[_0x777f('0x1b')]();});}};}function handleEntityNotFound(_0x109a8e,_0x3fe93d){return function(_0x43a7c1){if(!_0x43a7c1){_0x109a8e[_0x777f('0x1a')](0x194);}return _0x43a7c1;};}function handleError(_0x2c9edc,_0x1c0984){_0x1c0984=_0x1c0984||0x1f4;return function(_0x104b86){logger['error'](_0x104b86['stack']);if(_0x104b86[_0x777f('0x2a')]){delete _0x104b86[_0x777f('0x2a')];}_0x2c9edc[_0x777f('0x1c')](_0x1c0984)[_0x777f('0x2b')](_0x104b86);};}exports[_0x777f('0x2c')]=function(_0x32007e,_0x221dda){var _0x5b0504={},_0x2ebed8={},_0x3940cb={'count':0x0,'rows':[]};var _0x5b78b8=_[_0x777f('0x2d')](db[_0x777f('0x2e')]['rawAttributes'],function(_0x502924){return{'name':_0x502924[_0x777f('0x2f')],'type':_0x502924[_0x777f('0x30')][_0x777f('0x31')]};});_0x2ebed8[_0x777f('0x32')]=_[_0x777f('0x2d')](_0x5b78b8,_0x777f('0x2a'));_0x2ebed8[_0x777f('0x33')]=_[_0x777f('0x34')](_0x32007e[_0x777f('0x33')]);_0x2ebed8[_0x777f('0x35')]=_['intersection'](_0x2ebed8[_0x777f('0x32')],_0x2ebed8[_0x777f('0x33')]);_0x5b0504[_0x777f('0x36')]=_[_0x777f('0x37')](_0x2ebed8[_0x777f('0x32')],qs[_0x777f('0x38')](_0x32007e['query'][_0x777f('0x38')]));_0x5b0504[_0x777f('0x36')]=_0x5b0504['attributes'][_0x777f('0x39')]?_0x5b0504['attributes']:_0x2ebed8['model'];if(!_0x32007e[_0x777f('0x33')][_0x777f('0x3a')](_0x777f('0x3b'))){_0x5b0504[_0x777f('0x1f')]=qs[_0x777f('0x1f')](_0x32007e[_0x777f('0x33')][_0x777f('0x1f')]);_0x5b0504[_0x777f('0x21')]=qs['offset'](_0x32007e['query'][_0x777f('0x21')]);}_0x5b0504[_0x777f('0x3c')]=qs[_0x777f('0x3d')](_0x32007e[_0x777f('0x33')][_0x777f('0x3d')]);_0x5b0504[_0x777f('0x3e')]=qs[_0x777f('0x35')](_[_0x777f('0x3f')](_0x32007e['query'],_0x2ebed8[_0x777f('0x35')]),_0x5b78b8);if(_0x32007e[_0x777f('0x33')][_0x777f('0x40')]){_0x5b0504[_0x777f('0x3e')]=_[_0x777f('0x41')](_0x5b0504[_0x777f('0x3e')],{'$or':_[_0x777f('0x2d')](_0x5b78b8,function(_0x1f32ad){if(_0x1f32ad['type']!=='VIRTUAL'){var _0x19795e={};_0x19795e[_0x1f32ad['name']]={'$like':'%'+_0x32007e[_0x777f('0x33')][_0x777f('0x40')]+'%'};return _0x19795e;}})});}_0x5b0504=_[_0x777f('0x41')]({},_0x5b0504,_0x32007e[_0x777f('0x42')]);var _0x2727d0={'where':_0x5b0504['where']};return db[_0x777f('0x2e')][_0x777f('0x20')](_0x2727d0)[_0x777f('0x28')](function(_0x3a5d34){_0x3940cb[_0x777f('0x20')]=_0x3a5d34;if(_0x32007e['query'][_0x777f('0x43')]){_0x5b0504[_0x777f('0x44')]=[{'all':!![]}];}return db[_0x777f('0x2e')][_0x777f('0x45')](_0x5b0504);})[_0x777f('0x28')](function(_0x43e53d){_0x3940cb[_0x777f('0x46')]=_0x43e53d;return _0x3940cb;})[_0x777f('0x28')](respondWithFilteredResult(_0x221dda,_0x5b0504))['catch'](handleError(_0x221dda,null));};exports['show']=function(_0x2924e9,_0x4a4eb6){var _0x5ac30a={'raw':!![],'where':{'id':_0x2924e9[_0x777f('0x47')]['id']}},_0xdfb525={};_0xdfb525[_0x777f('0x32')]=_['keys'](db['ChatQueueReport'][_0x777f('0x48')]);_0xdfb525[_0x777f('0x33')]=_[_0x777f('0x34')](_0x2924e9[_0x777f('0x33')]);_0xdfb525['filters']=_[_0x777f('0x37')](_0xdfb525[_0x777f('0x32')],_0xdfb525[_0x777f('0x33')]);_0x5ac30a[_0x777f('0x36')]=_[_0x777f('0x37')](_0xdfb525[_0x777f('0x32')],qs[_0x777f('0x38')](_0x2924e9[_0x777f('0x33')][_0x777f('0x38')]));_0x5ac30a[_0x777f('0x36')]=_0x5ac30a[_0x777f('0x36')][_0x777f('0x39')]?_0x5ac30a[_0x777f('0x36')]:_0xdfb525[_0x777f('0x32')];if(_0x2924e9[_0x777f('0x33')]['includeAll']){_0x5ac30a[_0x777f('0x44')]=[{'all':!![]}];}_0x5ac30a=_[_0x777f('0x41')]({},_0x5ac30a,_0x2924e9[_0x777f('0x42')]);return db[_0x777f('0x2e')]['find'](_0x5ac30a)[_0x777f('0x28')](handleEntityNotFound(_0x4a4eb6,null))[_0x777f('0x28')](respondWithResult(_0x4a4eb6,null))[_0x777f('0x49')](handleError(_0x4a4eb6,null));};exports['create']=function(_0x486664,_0x364d41){return db['ChatQueueReport']['create'](_0x486664[_0x777f('0x4a')],{})[_0x777f('0x28')](respondWithResult(_0x364d41,0xc9))[_0x777f('0x49')](handleError(_0x364d41,null));};exports[_0x777f('0x27')]=function(_0x3ba76d,_0x45ea24){if(_0x3ba76d[_0x777f('0x4a')]['id']){delete _0x3ba76d[_0x777f('0x4a')]['id'];}return db['ChatQueueReport'][_0x777f('0x4b')]({'where':{'id':_0x3ba76d[_0x777f('0x47')]['id']}})[_0x777f('0x28')](handleEntityNotFound(_0x45ea24,null))[_0x777f('0x28')](saveUpdates(_0x3ba76d[_0x777f('0x4a')],null))[_0x777f('0x28')](respondWithResult(_0x45ea24,null))[_0x777f('0x49')](handleError(_0x45ea24,null));};exports[_0x777f('0x29')]=function(_0x124fc5,_0x145cbb){return db[_0x777f('0x2e')][_0x777f('0x4b')]({'where':{'id':_0x124fc5[_0x777f('0x47')]['id']}})[_0x777f('0x28')](handleEntityNotFound(_0x145cbb,null))[_0x777f('0x28')](removeEntity(_0x145cbb,null))[_0x777f('0x49')](handleError(_0x145cbb,null));};exports[_0x777f('0x4c')]=function(_0x4d9f46,_0x126b50){return db['ChatQueueReport'][_0x777f('0x4c')]()[_0x777f('0x28')](respondWithResult(_0x126b50,null))[_0x777f('0x49')](handleError(_0x126b50,null));}; \ No newline at end of file +var _0xcd2f=['sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit'];(function(_0x3f4d49,_0x5ab9fd){var _0x253efc=function(_0xc3f676){while(--_0xc3f676){_0x3f4d49['push'](_0x3f4d49['shift']());}};_0x253efc(++_0x5ab9fd);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xcd2f[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfcd2('0x0'));var rp=require(_0xfcd2('0x1'));var moment=require(_0xfcd2('0x2'));var BPromise=require(_0xfcd2('0x3'));var Mustache=require(_0xfcd2('0x4'));var util=require(_0xfcd2('0x5'));var path=require(_0xfcd2('0x6'));var sox=require(_0xfcd2('0x7'));var csv=require('to-csv');var ejs=require(_0xfcd2('0x8'));var fs=require('fs');var fs_extra=require(_0xfcd2('0x9'));var _=require(_0xfcd2('0xa'));var squel=require(_0xfcd2('0xb'));var crypto=require(_0xfcd2('0xc'));var jsforce=require(_0xfcd2('0xd'));var deskjs=require(_0xfcd2('0xe'));var toCsv=require(_0xfcd2('0xf'));var querystring=require(_0xfcd2('0x10'));var Papa=require(_0xfcd2('0x11'));var Redis=require(_0xfcd2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfcd2('0x13'));var as=require(_0xfcd2('0x14'));var hardwareService=require(_0xfcd2('0x15'));var logger=require(_0xfcd2('0x16'))(_0xfcd2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bff49,_0xdcfde9){_0xdcfde9=_0xdcfde9||0xcc;return function(_0x15aebb){if(_0x15aebb){return _0x5bff49['sendStatus'](_0xdcfde9);}return _0x5bff49[_0xfcd2('0x18')](_0xdcfde9)[_0xfcd2('0x19')]();};}function respondWithResult(_0x5ad180,_0x50f44c){_0x50f44c=_0x50f44c||0xc8;return function(_0x2825df){if(_0x2825df){return _0x5ad180[_0xfcd2('0x18')](_0x50f44c)[_0xfcd2('0x1a')](_0x2825df);}};}function respondWithFilteredResult(_0x4baf2f,_0x428cf3){return function(_0x4a2bcd){if(_0x4a2bcd){var _0x1a9f8f=typeof _0x428cf3[_0xfcd2('0x1b')]===_0xfcd2('0x1c')&&typeof _0x428cf3[_0xfcd2('0x1d')]===_0xfcd2('0x1c');var _0x378484=_0x4a2bcd['count'];var _0xba3186=_0x1a9f8f?0x0:_0x428cf3[_0xfcd2('0x1b')];var _0x32607c=_0x1a9f8f?_0x4a2bcd[_0xfcd2('0x1e')]:_0x428cf3[_0xfcd2('0x1b')]+_0x428cf3[_0xfcd2('0x1d')];var _0x5c8a4d;if(_0x32607c>=_0x378484){_0x32607c=_0x378484;_0x5c8a4d=0xc8;}else{_0x5c8a4d=0xce;}_0x4baf2f[_0xfcd2('0x18')](_0x5c8a4d);return _0x4baf2f[_0xfcd2('0x1f')](_0xfcd2('0x20'),_0xba3186+'-'+_0x32607c+'/'+_0x378484)[_0xfcd2('0x1a')](_0x4a2bcd);}return null;};}function patchUpdates(_0x266c86){return function(_0x55d8b0){try{jsonpatch[_0xfcd2('0x21')](_0x55d8b0,_0x266c86,!![]);}catch(_0x41c503){return BPromise[_0xfcd2('0x22')](_0x41c503);}return _0x55d8b0[_0xfcd2('0x23')]();};}function saveUpdates(_0x2a06d4,_0x37dafa){return function(_0x19ea4a){if(_0x19ea4a){return _0x19ea4a[_0xfcd2('0x24')](_0x2a06d4)[_0xfcd2('0x25')](function(_0x47fa14){return _0x47fa14;});}return null;};}function removeEntity(_0x23104f,_0x50c0cc){return function(_0xedae7a){if(_0xedae7a){return _0xedae7a[_0xfcd2('0x26')]()['then'](function(){_0x23104f['status'](0xcc)[_0xfcd2('0x19')]();});}};}function handleEntityNotFound(_0xe7fde9,_0x193dc3){return function(_0x2b0364){if(!_0x2b0364){_0xe7fde9['sendStatus'](0x194);}return _0x2b0364;};}function handleError(_0x1c4981,_0x2a8557){_0x2a8557=_0x2a8557||0x1f4;return function(_0x13e447){logger[_0xfcd2('0x27')](_0x13e447['stack']);if(_0x13e447[_0xfcd2('0x28')]){delete _0x13e447['name'];}_0x1c4981[_0xfcd2('0x18')](_0x2a8557)[_0xfcd2('0x29')](_0x13e447);};}exports['index']=function(_0x909257,_0x3cb642){var _0x41ecc9={},_0x4bffa9={},_0x15965e={'count':0x0,'rows':[]};var _0x4e79b=_[_0xfcd2('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x5192b9){return{'name':_0x5192b9[_0xfcd2('0x2b')],'type':_0x5192b9[_0xfcd2('0x2c')][_0xfcd2('0x2d')]};});_0x4bffa9['model']=_[_0xfcd2('0x2a')](_0x4e79b,_0xfcd2('0x28'));_0x4bffa9[_0xfcd2('0x2e')]=_[_0xfcd2('0x2f')](_0x909257[_0xfcd2('0x2e')]);_0x4bffa9[_0xfcd2('0x30')]=_[_0xfcd2('0x31')](_0x4bffa9['model'],_0x4bffa9['query']);_0x41ecc9[_0xfcd2('0x32')]=_['intersection'](_0x4bffa9[_0xfcd2('0x33')],qs[_0xfcd2('0x34')](_0x909257[_0xfcd2('0x2e')][_0xfcd2('0x34')]));_0x41ecc9[_0xfcd2('0x32')]=_0x41ecc9[_0xfcd2('0x32')][_0xfcd2('0x35')]?_0x41ecc9[_0xfcd2('0x32')]:_0x4bffa9[_0xfcd2('0x33')];if(!_0x909257['query'][_0xfcd2('0x36')](_0xfcd2('0x37'))){_0x41ecc9[_0xfcd2('0x1d')]=qs[_0xfcd2('0x1d')](_0x909257['query']['limit']);_0x41ecc9[_0xfcd2('0x1b')]=qs[_0xfcd2('0x1b')](_0x909257[_0xfcd2('0x2e')][_0xfcd2('0x1b')]);}_0x41ecc9['order']=qs[_0xfcd2('0x38')](_0x909257[_0xfcd2('0x2e')]['sort']);_0x41ecc9[_0xfcd2('0x39')]=qs['filters'](_[_0xfcd2('0x3a')](_0x909257['query'],_0x4bffa9[_0xfcd2('0x30')]),_0x4e79b);if(_0x909257[_0xfcd2('0x2e')][_0xfcd2('0x3b')]){_0x41ecc9['where']=_[_0xfcd2('0x3c')](_0x41ecc9[_0xfcd2('0x39')],{'$or':_[_0xfcd2('0x2a')](_0x4e79b,function(_0x89e532){if(_0x89e532[_0xfcd2('0x2c')]!==_0xfcd2('0x3d')){var _0x10249c={};_0x10249c[_0x89e532[_0xfcd2('0x28')]]={'$like':'%'+_0x909257[_0xfcd2('0x2e')][_0xfcd2('0x3b')]+'%'};return _0x10249c;}})});}_0x41ecc9=_[_0xfcd2('0x3c')]({},_0x41ecc9,_0x909257[_0xfcd2('0x3e')]);var _0x31368e={'where':_0x41ecc9[_0xfcd2('0x39')]};return db[_0xfcd2('0x3f')][_0xfcd2('0x1e')](_0x31368e)[_0xfcd2('0x25')](function(_0x47d6b6){_0x15965e[_0xfcd2('0x1e')]=_0x47d6b6;if(_0x909257['query'][_0xfcd2('0x40')]){_0x41ecc9[_0xfcd2('0x41')]=[{'all':!![]}];}return db[_0xfcd2('0x3f')][_0xfcd2('0x42')](_0x41ecc9);})['then'](function(_0x20f985){_0x15965e[_0xfcd2('0x43')]=_0x20f985;return _0x15965e;})[_0xfcd2('0x25')](respondWithFilteredResult(_0x3cb642,_0x41ecc9))[_0xfcd2('0x44')](handleError(_0x3cb642,null));};exports[_0xfcd2('0x45')]=function(_0x100198,_0x20c15b){var _0x34ffd6={'raw':!![],'where':{'id':_0x100198[_0xfcd2('0x46')]['id']}},_0x4ba64d={};_0x4ba64d[_0xfcd2('0x33')]=_[_0xfcd2('0x2f')](db[_0xfcd2('0x3f')][_0xfcd2('0x47')]);_0x4ba64d['query']=_[_0xfcd2('0x2f')](_0x100198[_0xfcd2('0x2e')]);_0x4ba64d[_0xfcd2('0x30')]=_[_0xfcd2('0x31')](_0x4ba64d['model'],_0x4ba64d[_0xfcd2('0x2e')]);_0x34ffd6[_0xfcd2('0x32')]=_[_0xfcd2('0x31')](_0x4ba64d[_0xfcd2('0x33')],qs[_0xfcd2('0x34')](_0x100198[_0xfcd2('0x2e')][_0xfcd2('0x34')]));_0x34ffd6[_0xfcd2('0x32')]=_0x34ffd6[_0xfcd2('0x32')]['length']?_0x34ffd6['attributes']:_0x4ba64d['model'];if(_0x100198[_0xfcd2('0x2e')][_0xfcd2('0x40')]){_0x34ffd6[_0xfcd2('0x41')]=[{'all':!![]}];}_0x34ffd6=_[_0xfcd2('0x3c')]({},_0x34ffd6,_0x100198['options']);return db[_0xfcd2('0x3f')][_0xfcd2('0x48')](_0x34ffd6)[_0xfcd2('0x25')](handleEntityNotFound(_0x20c15b,null))[_0xfcd2('0x25')](respondWithResult(_0x20c15b,null))['catch'](handleError(_0x20c15b,null));};exports[_0xfcd2('0x49')]=function(_0x26dbe2,_0x36233a){return db['ChatQueueReport'][_0xfcd2('0x49')](_0x26dbe2[_0xfcd2('0x4a')],{})['then'](respondWithResult(_0x36233a,0xc9))[_0xfcd2('0x44')](handleError(_0x36233a,null));};exports['update']=function(_0x559dea,_0x7352bb){if(_0x559dea[_0xfcd2('0x4a')]['id']){delete _0x559dea[_0xfcd2('0x4a')]['id'];}return db[_0xfcd2('0x3f')]['find']({'where':{'id':_0x559dea[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x25')](handleEntityNotFound(_0x7352bb,null))[_0xfcd2('0x25')](saveUpdates(_0x559dea['body'],null))[_0xfcd2('0x25')](respondWithResult(_0x7352bb,null))[_0xfcd2('0x44')](handleError(_0x7352bb,null));};exports[_0xfcd2('0x26')]=function(_0x50f31c,_0x159aec){return db[_0xfcd2('0x3f')][_0xfcd2('0x48')]({'where':{'id':_0x50f31c[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x25')](handleEntityNotFound(_0x159aec,null))[_0xfcd2('0x25')](removeEntity(_0x159aec,null))[_0xfcd2('0x44')](handleError(_0x159aec,null));};exports[_0xfcd2('0x4b')]=function(_0x2409ed,_0xf2e5f8){return db[_0xfcd2('0x3f')][_0xfcd2('0x4b')]()['then'](respondWithResult(_0xf2e5f8,null))[_0xfcd2('0x44')](handleError(_0xf2e5f8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2d12130..e050d86 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5c9491,_0x387e70){var _0x72b4d=function(_0x49dc6a){while(--_0x49dc6a){_0x5c9491['push'](_0x5c9491['shift']());}};_0x72b4d(++_0x387e70);}(_0x757a,0xde));var _0xa757=function(_0x58abbf,_0x2a16f7){_0x58abbf=_0x58abbf-0x0;var _0x35e6e2=_0x757a[_0x58abbf];return _0x35e6e2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3462a9,_0x1d9baa){var _0x128a5d=function(_0x172efb){while(--_0x172efb){_0x3462a9['push'](_0x3462a9['shift']());}};_0x128a5d(++_0x1d9baa);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3c75244..ff231dd 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 _0xd67c=['../../config/environment','jayson/promise','client','http','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xd67c,0x177));var _0xcd67=function(_0xcafb2b,_0x2cc85e){_0xcafb2b=_0xcafb2b-0x0;var _0x539f9a=_0xd67c[_0xcafb2b];return _0x539f9a;};'use strict';var _=require(_0xcd67('0x0'));var util=require(_0xcd67('0x1'));var moment=require(_0xcd67('0x2'));var BPromise=require(_0xcd67('0x3'));var rs=require(_0xcd67('0x4'));var fs=require('fs');var Redis=require(_0xcd67('0x5'));var db=require(_0xcd67('0x6'))['db'];var utils=require(_0xcd67('0x7'));var logger=require(_0xcd67('0x8'))(_0xcd67('0x9'));var config=require(_0xcd67('0xa'));var jayson=require(_0xcd67('0xb'));var client=jayson[_0xcd67('0xc')][_0xcd67('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e925b,_0x247fbe,_0x5f9757){return new BPromise(function(_0xcd56a,_0x1c7c85){return client['request'](_0x4e925b,_0x5f9757)['then'](function(_0x3fa769){logger['info'](_0xcd67('0xe'),_0x247fbe,'request\x20sent');logger[_0xcd67('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x247fbe,_0xcd67('0x10'),JSON[_0xcd67('0x11')](_0x3fa769));if(_0x3fa769[_0xcd67('0x12')]){if(_0x3fa769[_0xcd67('0x12')][_0xcd67('0x13')]===0x1f4){logger[_0xcd67('0x12')](_0xcd67('0xe'),_0x247fbe,_0x3fa769[_0xcd67('0x12')]['message']);return _0x1c7c85(_0x3fa769['error'][_0xcd67('0x14')]);}logger['error'](_0xcd67('0xe'),_0x247fbe,_0x3fa769[_0xcd67('0x12')][_0xcd67('0x14')]);return _0xcd56a(_0x3fa769[_0xcd67('0x12')]['message']);}else{logger[_0xcd67('0x15')](_0xcd67('0xe'),_0x247fbe,_0xcd67('0x10'));_0xcd56a(_0x3fa769[_0xcd67('0x16')][_0xcd67('0x14')]);}})[_0xcd67('0x17')](function(_0x2e9992){logger['error'](_0xcd67('0xe'),_0x247fbe,_0x2e9992);_0x1c7c85(_0x2e9992);});});}exports[_0xcd67('0x18')]=function(_0x5ef506){var _0x2c22cb=this;return new Promise(function(_0x3ab890,_0xa54e5f){return db[_0xcd67('0x19')][_0xcd67('0x1a')](_0x5ef506[_0xcd67('0x1b')],{'raw':_0x5ef506[_0xcd67('0x1c')]?_0x5ef506['options'][_0xcd67('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5dc2d2){logger[_0xcd67('0x15')](_0xcd67('0x18'),_0x5ef506);logger[_0xcd67('0xf')](_0xcd67('0x18'),_0x5ef506,JSON[_0xcd67('0x11')](_0x5dc2d2));_0x3ab890(_0x5dc2d2);})[_0xcd67('0x17')](function(_0x381957){logger['error']('CreateChatQueueReport',_0x381957[_0xcd67('0x14')],_0x5ef506);_0xa54e5f(_0x2c22cb[_0xcd67('0x12')](0x1f4,_0x381957['message']));});});};exports[_0xcd67('0x1e')]=function(_0x42a85f){var _0x5e3728=this;return new Promise(function(_0x28282d,_0x45c431){return db[_0xcd67('0x19')][_0xcd67('0x1f')](_0x42a85f[_0xcd67('0x1b')],{'raw':_0x42a85f[_0xcd67('0x1c')]?_0x42a85f[_0xcd67('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42a85f[_0xcd67('0x1c')]?_0x42a85f[_0xcd67('0x1c')]['where']||null:null,'attributes':_0x42a85f[_0xcd67('0x1c')]?_0x42a85f['options'][_0xcd67('0x20')]||null:null,'limit':_0x42a85f['options']?_0x42a85f[_0xcd67('0x1c')][_0xcd67('0x21')]||null:null})[_0xcd67('0x22')](function(_0x4b8e9d){logger[_0xcd67('0x15')](_0xcd67('0x1e'),_0x42a85f);logger[_0xcd67('0xf')]('UpdateChatQueueReport',_0x42a85f,JSON[_0xcd67('0x11')](_0x4b8e9d));_0x28282d(_0x4b8e9d);})[_0xcd67('0x17')](function(_0x1a678e){logger[_0xcd67('0x12')]('UpdateChatQueueReport',_0x1a678e[_0xcd67('0x14')],_0x42a85f);_0x45c431(_0x5e3728['error'](0x1f4,_0x1a678e[_0xcd67('0x14')]));});});}; \ No newline at end of file +var _0x7562=['info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','raw','then','debug','UpdateChatQueueReport','update','options','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ef4e1,_0xb643d5){var _0x59eff6=function(_0x448037){while(--_0x448037){_0x1ef4e1['push'](_0x1ef4e1['shift']());}};_0x59eff6(++_0xb643d5);}(_0x7562,0x1a0));var _0x2756=function(_0x5e07f6,_0x26f599){_0x5e07f6=_0x5e07f6-0x0;var _0x220f5c=_0x7562[_0x5e07f6];return _0x220f5c;};'use strict';var _=require(_0x2756('0x0'));var util=require(_0x2756('0x1'));var moment=require(_0x2756('0x2'));var BPromise=require(_0x2756('0x3'));var rs=require(_0x2756('0x4'));var fs=require('fs');var Redis=require(_0x2756('0x5'));var db=require(_0x2756('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2756('0x7'))(_0x2756('0x8'));var config=require(_0x2756('0x9'));var jayson=require(_0x2756('0xa'));var client=jayson[_0x2756('0xb')][_0x2756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b58dc,_0x535f4f,_0x458f48){return new BPromise(function(_0x14eeb3,_0xe111fe){return client['request'](_0x3b58dc,_0x458f48)['then'](function(_0x43f9c2){logger[_0x2756('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x535f4f,_0x2756('0xe'));logger['debug'](_0x2756('0xf'),_0x535f4f,_0x2756('0xe'),JSON[_0x2756('0x10')](_0x43f9c2));if(_0x43f9c2['error']){if(_0x43f9c2[_0x2756('0x11')][_0x2756('0x12')]===0x1f4){logger[_0x2756('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x535f4f,_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);return _0xe111fe(_0x43f9c2[_0x2756('0x11')]['message']);}logger[_0x2756('0x11')](_0x2756('0x14'),_0x535f4f,_0x43f9c2[_0x2756('0x11')]['message']);return _0x14eeb3(_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);}else{logger['info'](_0x2756('0x14'),_0x535f4f,_0x2756('0xe'));_0x14eeb3(_0x43f9c2[_0x2756('0x15')]['message']);}})[_0x2756('0x16')](function(_0x160089){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x535f4f,_0x160089);_0xe111fe(_0x160089);});});}exports[_0x2756('0x17')]=function(_0x4591eb){var _0x44ba45=this;return new Promise(function(_0xcf8ab0,_0x70f40a){return db[_0x2756('0x18')][_0x2756('0x19')](_0x4591eb['body'],{'raw':_0x4591eb['options']?_0x4591eb['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![]})[_0x2756('0x1b')](function(_0x2d8d34){logger[_0x2756('0xd')]('CreateChatQueueReport',_0x4591eb);logger[_0x2756('0x1c')](_0x2756('0x17'),_0x4591eb,JSON[_0x2756('0x10')](_0x2d8d34));_0xcf8ab0(_0x2d8d34);})[_0x2756('0x16')](function(_0x24b0af){logger['error'](_0x2756('0x17'),_0x24b0af['message'],_0x4591eb);_0x70f40a(_0x44ba45['error'](0x1f4,_0x24b0af[_0x2756('0x13')]));});});};exports[_0x2756('0x1d')]=function(_0x34270d){var _0x2100a2=this;return new Promise(function(_0x5c11bb,_0xbcb050){return db[_0x2756('0x18')][_0x2756('0x1e')](_0x34270d['body'],{'raw':_0x34270d[_0x2756('0x1f')]?_0x34270d['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')]['where']||null:null,'attributes':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')][_0x2756('0x20')]||null:null,'limit':_0x34270d['options']?_0x34270d[_0x2756('0x1f')]['limit']||null:null})[_0x2756('0x1b')](function(_0x832aa3){logger[_0x2756('0xd')](_0x2756('0x1d'),_0x34270d);logger['debug'](_0x2756('0x1d'),_0x34270d,JSON[_0x2756('0x10')](_0x832aa3));_0x5c11bb(_0x832aa3);})[_0x2756('0x16')](function(_0x2e53c1){logger[_0x2756('0x11')](_0x2756('0x1d'),_0x2e53c1[_0x2756('0x13')],_0x34270d);_0xbcb050(_0x2100a2[_0x2756('0x11')](0x1f4,_0x2e53c1[_0x2756('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 92a85bc..a92e89c 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 _0x4b95=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','/describe','get','/:id','create','put','util'];(function(_0x17d831,_0x1f0cc2){var _0x15a6c2=function(_0x2ed3f1){while(--_0x2ed3f1){_0x17d831['push'](_0x17d831['shift']());}};_0x15a6c2(++_0x1f0cc2);}(_0x4b95,0x137));var _0x54b9=function(_0x57702a,_0x57c215){_0x57702a=_0x57702a-0x0;var _0x487e5a=_0x4b95[_0x57702a];return _0x487e5a;};'use strict';var multer=require('multer');var util=require(_0x54b9('0x0'));var path=require('path');var timeout=require(_0x54b9('0x1'));var express=require(_0x54b9('0x2'));var router=express[_0x54b9('0x3')]();var fs_extra=require(_0x54b9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x54b9('0x5'));var config=require('../../config/environment');var controller=require(_0x54b9('0x6'));router['get']('/',auth[_0x54b9('0x7')](),controller['index']);router['get'](_0x54b9('0x8'),auth[_0x54b9('0x7')](),controller['describe']);router[_0x54b9('0x9')](_0x54b9('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x54b9('0xb')]);router[_0x54b9('0xc')](_0x54b9('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x54b9('0xa'),auth[_0x54b9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdaf5=['delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','create','put','update'];(function(_0xc8f5a3,_0x4a02a5){var _0x55041a=function(_0x43fe7d){while(--_0x43fe7d){_0xc8f5a3['push'](_0xc8f5a3['shift']());}};_0x55041a(++_0x4a02a5);}(_0xdaf5,0x134));var _0x5daf=function(_0x23f845,_0x34b4f5){_0x23f845=_0x23f845-0x0;var _0x4cd3e5=_0xdaf5[_0x23f845];return _0x4cd3e5;};'use strict';var multer=require(_0x5daf('0x0'));var util=require(_0x5daf('0x1'));var path=require('path');var timeout=require(_0x5daf('0x2'));var express=require(_0x5daf('0x3'));var router=express['Router']();var fs_extra=require(_0x5daf('0x4'));var auth=require(_0x5daf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x5daf('0x6')]('/',auth[_0x5daf('0x7')](),controller[_0x5daf('0x8')]);router[_0x5daf('0x6')](_0x5daf('0x9'),auth[_0x5daf('0x7')](),controller[_0x5daf('0xa')]);router[_0x5daf('0x6')](_0x5daf('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5daf('0xc')]);router[_0x5daf('0xd')](_0x5daf('0xb'),auth['isAuthenticated'](),controller[_0x5daf('0xe')]);router[_0x5daf('0xf')](_0x5daf('0xb'),auth[_0x5daf('0x7')](),controller[_0x5daf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 62decbc..884fefc 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1cd0a7,_0x50fb43){var _0x3c965b=function(_0x57d309){while(--_0x57d309){_0x1cd0a7['push'](_0x1cd0a7['shift']());}};_0x3c965b(++_0x50fb43);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xcb91[_0x3ba924];return _0x4cc1df;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3859c3,_0x32d579){var _0x49e2a7=function(_0x59d59a){while(--_0x59d59a){_0x3859c3['push'](_0x3859c3['shift']());}};_0x49e2a7(++_0x32d579);}(_0xaa88,0x137));var _0x8aa8=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xaa88[_0x2850c0];return _0x21e830;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d5d3875..46aef85 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 _0x1cfc=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','keys','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0x1cfc,0x85));var _0xc1cf=function(_0x6a960a,_0x1d2e3c){_0x6a960a=_0x6a960a-0x0;var _0x2758da=_0x1cfc[_0x6a960a];return _0x2758da;};'use strict';var emlformat=require(_0xc1cf('0x0'));var rimraf=require(_0xc1cf('0x1'));var zipdir=require(_0xc1cf('0x2'));var jsonpatch=require(_0xc1cf('0x3'));var rp=require(_0xc1cf('0x4'));var moment=require(_0xc1cf('0x5'));var BPromise=require(_0xc1cf('0x6'));var Mustache=require(_0xc1cf('0x7'));var util=require(_0xc1cf('0x8'));var path=require(_0xc1cf('0x9'));var sox=require(_0xc1cf('0xa'));var csv=require(_0xc1cf('0xb'));var ejs=require(_0xc1cf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1cf('0xd'));var squel=require('squel');var crypto=require(_0xc1cf('0xe'));var jsforce=require(_0xc1cf('0xf'));var deskjs=require(_0xc1cf('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc1cf('0x11'));var Papa=require(_0xc1cf('0x12'));var Redis=require('ioredis');var authService=require(_0xc1cf('0x13'));var qs=require(_0xc1cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1cf('0x15'));var logger=require(_0xc1cf('0x16'))(_0xc1cf('0x17'));var utils=require(_0xc1cf('0x18'));var config=require(_0xc1cf('0x19'));var licenseUtil=require(_0xc1cf('0x1a'));var db=require(_0xc1cf('0x1b'))['db'];function respondWithStatusCode(_0x12cb77,_0x582ff4){_0x582ff4=_0x582ff4||0xcc;return function(_0x3b5018){if(_0x3b5018){return _0x12cb77['sendStatus'](_0x582ff4);}return _0x12cb77[_0xc1cf('0x1c')](_0x582ff4)[_0xc1cf('0x1d')]();};}function respondWithResult(_0x1c96a5,_0x1fcafa){_0x1fcafa=_0x1fcafa||0xc8;return function(_0x4eef75){if(_0x4eef75){return _0x1c96a5[_0xc1cf('0x1c')](_0x1fcafa)[_0xc1cf('0x1e')](_0x4eef75);}};}function respondWithFilteredResult(_0x430fba,_0x35fadf){return function(_0x1e87a4){if(_0x1e87a4){var _0x35bec7=typeof _0x35fadf['offset']==='undefined'&&typeof _0x35fadf['limit']===_0xc1cf('0x1f');var _0x4d2be7=_0x1e87a4[_0xc1cf('0x20')];var _0x31768c=_0x35bec7?0x0:_0x35fadf['offset'];var _0x3d0ee4=_0x35bec7?_0x1e87a4[_0xc1cf('0x20')]:_0x35fadf[_0xc1cf('0x21')]+_0x35fadf[_0xc1cf('0x22')];var _0x280ada;if(_0x3d0ee4>=_0x4d2be7){_0x3d0ee4=_0x4d2be7;_0x280ada=0xc8;}else{_0x280ada=0xce;}_0x430fba[_0xc1cf('0x1c')](_0x280ada);return _0x430fba['set'](_0xc1cf('0x23'),_0x31768c+'-'+_0x3d0ee4+'/'+_0x4d2be7)[_0xc1cf('0x1e')](_0x1e87a4);}return null;};}function patchUpdates(_0x31804b){return function(_0x2c146a){try{jsonpatch[_0xc1cf('0x24')](_0x2c146a,_0x31804b,!![]);}catch(_0x2da10c){return BPromise[_0xc1cf('0x25')](_0x2da10c);}return _0x2c146a[_0xc1cf('0x26')]();};}function saveUpdates(_0x2d2933,_0x5aac80){return function(_0x685021){if(_0x685021){return _0x685021[_0xc1cf('0x27')](_0x2d2933)[_0xc1cf('0x28')](function(_0x2d4c34){return _0x2d4c34;});}return null;};}function removeEntity(_0x51e9c1,_0x54745e){return function(_0x8304b5){if(_0x8304b5){return _0x8304b5[_0xc1cf('0x29')]()['then'](function(){_0x51e9c1[_0xc1cf('0x1c')](0xcc)[_0xc1cf('0x1d')]();});}};}function handleEntityNotFound(_0x5162f2,_0x34b687){return function(_0x689e29){if(!_0x689e29){_0x5162f2['sendStatus'](0x194);}return _0x689e29;};}function handleError(_0x3c7bb0,_0x1c6b5a){_0x1c6b5a=_0x1c6b5a||0x1f4;return function(_0x31a2d3){logger[_0xc1cf('0x2a')](_0x31a2d3['stack']);if(_0x31a2d3[_0xc1cf('0x2b')]){delete _0x31a2d3[_0xc1cf('0x2b')];}_0x3c7bb0[_0xc1cf('0x1c')](_0x1c6b5a)['send'](_0x31a2d3);};}exports[_0xc1cf('0x2c')]=function(_0x14822f,_0x289a16){var _0x17bdb9={},_0x4eda5c={},_0xed5d98={'count':0x0,'rows':[]};var _0x54e5a3=_[_0xc1cf('0x2d')](db[_0xc1cf('0x2e')][_0xc1cf('0x2f')],function(_0x38f81f){return{'name':_0x38f81f[_0xc1cf('0x30')],'type':_0x38f81f[_0xc1cf('0x31')][_0xc1cf('0x32')]};});_0x4eda5c[_0xc1cf('0x33')]=_['map'](_0x54e5a3,_0xc1cf('0x2b'));_0x4eda5c[_0xc1cf('0x34')]=_['keys'](_0x14822f[_0xc1cf('0x34')]);_0x4eda5c[_0xc1cf('0x35')]=_[_0xc1cf('0x36')](_0x4eda5c[_0xc1cf('0x33')],_0x4eda5c[_0xc1cf('0x34')]);_0x17bdb9[_0xc1cf('0x37')]=_[_0xc1cf('0x36')](_0x4eda5c['model'],qs[_0xc1cf('0x38')](_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x38')]));_0x17bdb9[_0xc1cf('0x37')]=_0x17bdb9[_0xc1cf('0x37')][_0xc1cf('0x39')]?_0x17bdb9[_0xc1cf('0x37')]:_0x4eda5c[_0xc1cf('0x33')];if(!_0x14822f[_0xc1cf('0x34')]['hasOwnProperty']('nolimit')){_0x17bdb9[_0xc1cf('0x22')]=qs[_0xc1cf('0x22')](_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x22')]);_0x17bdb9['offset']=qs[_0xc1cf('0x21')](_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x21')]);}_0x17bdb9[_0xc1cf('0x3a')]=qs[_0xc1cf('0x3b')](_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x3b')]);_0x17bdb9[_0xc1cf('0x3c')]=qs[_0xc1cf('0x35')](_[_0xc1cf('0x3d')](_0x14822f['query'],_0x4eda5c[_0xc1cf('0x35')]),_0x54e5a3);if(_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x3e')]){_0x17bdb9[_0xc1cf('0x3c')]=_[_0xc1cf('0x3f')](_0x17bdb9['where'],{'$or':_[_0xc1cf('0x2d')](_0x54e5a3,function(_0x298206){if(_0x298206[_0xc1cf('0x31')]!=='VIRTUAL'){var _0x42e861={};_0x42e861[_0x298206[_0xc1cf('0x2b')]]={'$like':'%'+_0x14822f[_0xc1cf('0x34')]['filter']+'%'};return _0x42e861;}})});}_0x17bdb9=_['merge']({},_0x17bdb9,_0x14822f['options']);var _0x471b03={'where':_0x17bdb9['where']};return db[_0xc1cf('0x2e')][_0xc1cf('0x20')](_0x471b03)['then'](function(_0x23cd3e){_0xed5d98[_0xc1cf('0x20')]=_0x23cd3e;if(_0x14822f[_0xc1cf('0x34')][_0xc1cf('0x40')]){_0x17bdb9[_0xc1cf('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x17bdb9);})[_0xc1cf('0x28')](function(_0x516ff2){_0xed5d98[_0xc1cf('0x42')]=_0x516ff2;return _0xed5d98;})['then'](respondWithFilteredResult(_0x289a16,_0x17bdb9))[_0xc1cf('0x43')](handleError(_0x289a16,null));};exports[_0xc1cf('0x44')]=function(_0x5a53fd,_0x3c3d79){var _0x4f3d69={'raw':!![],'where':{'id':_0x5a53fd['params']['id']}},_0x3c399a={};_0x3c399a[_0xc1cf('0x33')]=_['keys'](db[_0xc1cf('0x2e')]['rawAttributes']);_0x3c399a['query']=_[_0xc1cf('0x45')](_0x5a53fd[_0xc1cf('0x34')]);_0x3c399a[_0xc1cf('0x35')]=_[_0xc1cf('0x36')](_0x3c399a['model'],_0x3c399a['query']);_0x4f3d69['attributes']=_['intersection'](_0x3c399a[_0xc1cf('0x33')],qs[_0xc1cf('0x38')](_0x5a53fd['query'][_0xc1cf('0x38')]));_0x4f3d69['attributes']=_0x4f3d69['attributes'][_0xc1cf('0x39')]?_0x4f3d69[_0xc1cf('0x37')]:_0x3c399a[_0xc1cf('0x33')];if(_0x5a53fd[_0xc1cf('0x34')]['includeAll']){_0x4f3d69[_0xc1cf('0x41')]=[{'all':!![]}];}_0x4f3d69=_[_0xc1cf('0x3f')]({},_0x4f3d69,_0x5a53fd[_0xc1cf('0x46')]);return db[_0xc1cf('0x2e')]['find'](_0x4f3d69)[_0xc1cf('0x28')](handleEntityNotFound(_0x3c3d79,null))[_0xc1cf('0x28')](respondWithResult(_0x3c3d79,null))[_0xc1cf('0x43')](handleError(_0x3c3d79,null));};exports[_0xc1cf('0x47')]=function(_0x2e2460,_0x1478df){return db[_0xc1cf('0x2e')]['create'](_0x2e2460[_0xc1cf('0x48')],{})[_0xc1cf('0x28')](respondWithResult(_0x1478df,0xc9))['catch'](handleError(_0x1478df,null));};exports[_0xc1cf('0x27')]=function(_0x1558f3,_0x62d047){if(_0x1558f3[_0xc1cf('0x48')]['id']){delete _0x1558f3[_0xc1cf('0x48')]['id'];}return db[_0xc1cf('0x2e')][_0xc1cf('0x49')]({'where':{'id':_0x1558f3[_0xc1cf('0x4a')]['id']}})[_0xc1cf('0x28')](handleEntityNotFound(_0x62d047,null))['then'](saveUpdates(_0x1558f3[_0xc1cf('0x48')],null))[_0xc1cf('0x28')](respondWithResult(_0x62d047,null))['catch'](handleError(_0x62d047,null));};exports['destroy']=function(_0x1625ca,_0x3e25f6){return db[_0xc1cf('0x2e')]['find']({'where':{'id':_0x1625ca[_0xc1cf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e25f6,null))[_0xc1cf('0x28')](removeEntity(_0x3e25f6,null))[_0xc1cf('0x43')](handleError(_0x3e25f6,null));};exports[_0xc1cf('0x4b')]=function(_0x92c64f,_0x4f66ad){return db[_0xc1cf('0x2e')]['describe']()[_0xc1cf('0x28')](respondWithResult(_0x4f66ad,null))['catch'](handleError(_0x4f66ad,null));}; \ No newline at end of file +var _0x28f3=['filters','intersection','attributes','fields','query','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','undefined','count','offset','set','Content-Range','json','reject','update','then','destroy','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','name'];(function(_0x117360,_0x674a6b){var _0x2f8cfb=function(_0x29e54a){while(--_0x29e54a){_0x117360['push'](_0x117360['shift']());}};_0x2f8cfb(++_0x674a6b);}(_0x28f3,0xa3));var _0x328f=function(_0x1eee03,_0x3a590e){_0x1eee03=_0x1eee03-0x0;var _0x1cb9d0=_0x28f3[_0x1eee03];return _0x1cb9d0;};'use strict';var emlformat=require(_0x328f('0x0'));var rimraf=require(_0x328f('0x1'));var zipdir=require(_0x328f('0x2'));var jsonpatch=require(_0x328f('0x3'));var rp=require('request-promise');var moment=require(_0x328f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x328f('0x5'));var util=require(_0x328f('0x6'));var path=require('path');var sox=require(_0x328f('0x7'));var csv=require('to-csv');var ejs=require(_0x328f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x328f('0x9'));var squel=require(_0x328f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x328f('0xb'));var toCsv=require(_0x328f('0xc'));var querystring=require('querystring');var Papa=require(_0x328f('0xd'));var Redis=require(_0x328f('0xe'));var authService=require(_0x328f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x328f('0x10'));var hardwareService=require(_0x328f('0x11'));var logger=require('../../config/logger')(_0x328f('0x12'));var utils=require(_0x328f('0x13'));var config=require(_0x328f('0x14'));var licenseUtil=require(_0x328f('0x15'));var db=require(_0x328f('0x16'))['db'];function respondWithStatusCode(_0x29f7f9,_0x16c630){_0x16c630=_0x16c630||0xcc;return function(_0x32b5fc){if(_0x32b5fc){return _0x29f7f9['sendStatus'](_0x16c630);}return _0x29f7f9['status'](_0x16c630)[_0x328f('0x17')]();};}function respondWithResult(_0x3ebf3d,_0x31fd14){_0x31fd14=_0x31fd14||0xc8;return function(_0x24c58a){if(_0x24c58a){return _0x3ebf3d[_0x328f('0x18')](_0x31fd14)['json'](_0x24c58a);}};}function respondWithFilteredResult(_0x1b6c21,_0x281db3){return function(_0x34fb55){if(_0x34fb55){var _0x1c2022=typeof _0x281db3['offset']==='undefined'&&typeof _0x281db3[_0x328f('0x19')]===_0x328f('0x1a');var _0x2e7133=_0x34fb55[_0x328f('0x1b')];var _0x17ba8a=_0x1c2022?0x0:_0x281db3[_0x328f('0x1c')];var _0x184452=_0x1c2022?_0x34fb55[_0x328f('0x1b')]:_0x281db3[_0x328f('0x1c')]+_0x281db3[_0x328f('0x19')];var _0x4e62c3;if(_0x184452>=_0x2e7133){_0x184452=_0x2e7133;_0x4e62c3=0xc8;}else{_0x4e62c3=0xce;}_0x1b6c21['status'](_0x4e62c3);return _0x1b6c21[_0x328f('0x1d')](_0x328f('0x1e'),_0x17ba8a+'-'+_0x184452+'/'+_0x2e7133)[_0x328f('0x1f')](_0x34fb55);}return null;};}function patchUpdates(_0x3fce99){return function(_0x538232){try{jsonpatch['apply'](_0x538232,_0x3fce99,!![]);}catch(_0x2d1c9e){return BPromise[_0x328f('0x20')](_0x2d1c9e);}return _0x538232['save']();};}function saveUpdates(_0x5ba024,_0x5ecdb8){return function(_0x3f3057){if(_0x3f3057){return _0x3f3057[_0x328f('0x21')](_0x5ba024)[_0x328f('0x22')](function(_0x574a55){return _0x574a55;});}return null;};}function removeEntity(_0x3c79dc,_0x99a717){return function(_0x2aa7ce){if(_0x2aa7ce){return _0x2aa7ce[_0x328f('0x23')]()['then'](function(){_0x3c79dc[_0x328f('0x18')](0xcc)[_0x328f('0x17')]();});}};}function handleEntityNotFound(_0x40cf91,_0x5f4107){return function(_0x5845ab){if(!_0x5845ab){_0x40cf91['sendStatus'](0x194);}return _0x5845ab;};}function handleError(_0x424cd8,_0x2a9140){_0x2a9140=_0x2a9140||0x1f4;return function(_0x376644){logger['error'](_0x376644[_0x328f('0x24')]);if(_0x376644['name']){delete _0x376644['name'];}_0x424cd8[_0x328f('0x18')](_0x2a9140)[_0x328f('0x25')](_0x376644);};}exports[_0x328f('0x26')]=function(_0x2b9ea8,_0x2a4fe2){var _0x3ecfd3={},_0x560445={},_0x2b7d72={'count':0x0,'rows':[]};var _0x19dfa8=_[_0x328f('0x27')](db[_0x328f('0x28')][_0x328f('0x29')],function(_0x1d311a){return{'name':_0x1d311a[_0x328f('0x2a')],'type':_0x1d311a[_0x328f('0x2b')][_0x328f('0x2c')]};});_0x560445[_0x328f('0x2d')]=_[_0x328f('0x27')](_0x19dfa8,_0x328f('0x2e'));_0x560445['query']=_['keys'](_0x2b9ea8['query']);_0x560445[_0x328f('0x2f')]=_[_0x328f('0x30')](_0x560445[_0x328f('0x2d')],_0x560445['query']);_0x3ecfd3[_0x328f('0x31')]=_[_0x328f('0x30')](_0x560445[_0x328f('0x2d')],qs[_0x328f('0x32')](_0x2b9ea8[_0x328f('0x33')][_0x328f('0x32')]));_0x3ecfd3[_0x328f('0x31')]=_0x3ecfd3['attributes'][_0x328f('0x34')]?_0x3ecfd3[_0x328f('0x31')]:_0x560445[_0x328f('0x2d')];if(!_0x2b9ea8[_0x328f('0x33')][_0x328f('0x35')]('nolimit')){_0x3ecfd3['limit']=qs[_0x328f('0x19')](_0x2b9ea8[_0x328f('0x33')][_0x328f('0x19')]);_0x3ecfd3[_0x328f('0x1c')]=qs[_0x328f('0x1c')](_0x2b9ea8[_0x328f('0x33')][_0x328f('0x1c')]);}_0x3ecfd3['order']=qs['sort'](_0x2b9ea8[_0x328f('0x33')][_0x328f('0x36')]);_0x3ecfd3[_0x328f('0x37')]=qs[_0x328f('0x2f')](_[_0x328f('0x38')](_0x2b9ea8[_0x328f('0x33')],_0x560445['filters']),_0x19dfa8);if(_0x2b9ea8[_0x328f('0x33')]['filter']){_0x3ecfd3[_0x328f('0x37')]=_[_0x328f('0x39')](_0x3ecfd3[_0x328f('0x37')],{'$or':_[_0x328f('0x27')](_0x19dfa8,function(_0x40532d){if(_0x40532d['type']!==_0x328f('0x3a')){var _0x1e3a47={};_0x1e3a47[_0x40532d[_0x328f('0x2e')]]={'$like':'%'+_0x2b9ea8['query'][_0x328f('0x3b')]+'%'};return _0x1e3a47;}})});}_0x3ecfd3=_['merge']({},_0x3ecfd3,_0x2b9ea8[_0x328f('0x3c')]);var _0x420190={'where':_0x3ecfd3['where']};return db[_0x328f('0x28')][_0x328f('0x1b')](_0x420190)[_0x328f('0x22')](function(_0x6d0256){_0x2b7d72[_0x328f('0x1b')]=_0x6d0256;if(_0x2b9ea8[_0x328f('0x33')][_0x328f('0x3d')]){_0x3ecfd3[_0x328f('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x328f('0x3f')](_0x3ecfd3);})[_0x328f('0x22')](function(_0x1c7329){_0x2b7d72[_0x328f('0x40')]=_0x1c7329;return _0x2b7d72;})[_0x328f('0x22')](respondWithFilteredResult(_0x2a4fe2,_0x3ecfd3))[_0x328f('0x41')](handleError(_0x2a4fe2,null));};exports['show']=function(_0x2f4c03,_0x5aaff1){var _0x593c1b={'raw':!![],'where':{'id':_0x2f4c03[_0x328f('0x42')]['id']}},_0x72b14c={};_0x72b14c[_0x328f('0x2d')]=_['keys'](db[_0x328f('0x28')][_0x328f('0x29')]);_0x72b14c[_0x328f('0x33')]=_['keys'](_0x2f4c03['query']);_0x72b14c[_0x328f('0x2f')]=_['intersection'](_0x72b14c['model'],_0x72b14c[_0x328f('0x33')]);_0x593c1b[_0x328f('0x31')]=_[_0x328f('0x30')](_0x72b14c[_0x328f('0x2d')],qs[_0x328f('0x32')](_0x2f4c03[_0x328f('0x33')]['fields']));_0x593c1b[_0x328f('0x31')]=_0x593c1b[_0x328f('0x31')][_0x328f('0x34')]?_0x593c1b['attributes']:_0x72b14c[_0x328f('0x2d')];if(_0x2f4c03[_0x328f('0x33')][_0x328f('0x3d')]){_0x593c1b[_0x328f('0x3e')]=[{'all':!![]}];}_0x593c1b=_[_0x328f('0x39')]({},_0x593c1b,_0x2f4c03['options']);return db[_0x328f('0x28')][_0x328f('0x43')](_0x593c1b)[_0x328f('0x22')](handleEntityNotFound(_0x5aaff1,null))[_0x328f('0x22')](respondWithResult(_0x5aaff1,null))[_0x328f('0x41')](handleError(_0x5aaff1,null));};exports[_0x328f('0x44')]=function(_0x1a0ec9,_0x38bf4f){return db['ChatTransferReport'][_0x328f('0x44')](_0x1a0ec9[_0x328f('0x45')],{})[_0x328f('0x22')](respondWithResult(_0x38bf4f,0xc9))['catch'](handleError(_0x38bf4f,null));};exports['update']=function(_0x1f38c0,_0x31941){if(_0x1f38c0['body']['id']){delete _0x1f38c0['body']['id'];}return db[_0x328f('0x28')][_0x328f('0x43')]({'where':{'id':_0x1f38c0[_0x328f('0x42')]['id']}})[_0x328f('0x22')](handleEntityNotFound(_0x31941,null))[_0x328f('0x22')](saveUpdates(_0x1f38c0[_0x328f('0x45')],null))[_0x328f('0x22')](respondWithResult(_0x31941,null))[_0x328f('0x41')](handleError(_0x31941,null));};exports['destroy']=function(_0x10efeb,_0x5b8cda){return db[_0x328f('0x28')][_0x328f('0x43')]({'where':{'id':_0x10efeb[_0x328f('0x42')]['id']}})[_0x328f('0x22')](handleEntityNotFound(_0x5b8cda,null))['then'](removeEntity(_0x5b8cda,null))['catch'](handleError(_0x5b8cda,null));};exports['describe']=function(_0x4a5dda,_0x4cdba8){return db[_0x328f('0x28')]['describe']()[_0x328f('0x22')](respondWithResult(_0x4cdba8,null))[_0x328f('0x41')](handleError(_0x4cdba8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f394958..e6eba6a 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 _0xaf4a=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xaf4a,0x74));var _0xaaf4=function(_0x289c79,_0x2d17ba){_0x289c79=_0x289c79-0x0;var _0x2ad590=_0xaf4a[_0x289c79];return _0x2ad590;};'use strict';var _=require(_0xaaf4('0x0'));var util=require(_0xaaf4('0x1'));var logger=require(_0xaaf4('0x2'))(_0xaaf4('0x3'));var moment=require(_0xaaf4('0x4'));var BPromise=require(_0xaaf4('0x5'));var rp=require(_0xaaf4('0x6'));var fs=require('fs');var path=require(_0xaaf4('0x7'));var rimraf=require(_0xaaf4('0x8'));var config=require(_0xaaf4('0x9'));var attributes=require(_0xaaf4('0xa'));module[_0xaaf4('0xb')]=function(_0x1b3716,_0x10e716){return _0x1b3716[_0xaaf4('0xc')](_0xaaf4('0xd'),attributes,{'tableName':_0xaaf4('0xe'),'paranoid':![],'indexes':[{'name':_0xaaf4('0xf'),'fields':[_0xaaf4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa7c=['report_chat_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport'];(function(_0x2c1524,_0x311a60){var _0x4ddd51=function(_0x2f7fa5){while(--_0x2f7fa5){_0x2c1524['push'](_0x2c1524['shift']());}};_0x4ddd51(++_0x311a60);}(_0xaa7c,0x1e2));var _0xcaa7=function(_0x5c660b,_0x477d30){_0x5c660b=_0x5c660b-0x0;var _0x335814=_0xaa7c[_0x5c660b];return _0x335814;};'use strict';var _=require(_0xcaa7('0x0'));var util=require(_0xcaa7('0x1'));var logger=require('../../config/logger')(_0xcaa7('0x2'));var moment=require(_0xcaa7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcaa7('0x4'));var rimraf=require(_0xcaa7('0x5'));var config=require(_0xcaa7('0x6'));var attributes=require(_0xcaa7('0x7'));module[_0xcaa7('0x8')]=function(_0x4218ed,_0x1eddd7){return _0x4218ed['define'](_0xcaa7('0x9'),attributes,{'tableName':_0xcaa7('0xa'),'paranoid':![],'indexes':[{'name':_0xcaa7('0xb'),'fields':[_0xcaa7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 2a5f95f..0a89284 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 _0xdac0=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x50c8b9,_0x1c4951){var _0x3f184e=function(_0x2627c5){while(--_0x2627c5){_0x50c8b9['push'](_0x50c8b9['shift']());}};_0x3f184e(++_0x1c4951);}(_0xdac0,0x152));var _0x0dac=function(_0x528e77,_0x272034){_0x528e77=_0x528e77-0x0;var _0x2b858a=_0xdac0[_0x528e77];return _0x2b858a;};'use strict';var _=require(_0x0dac('0x0'));var util=require('util');var moment=require(_0x0dac('0x1'));var BPromise=require(_0x0dac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dac('0x3'));var db=require(_0x0dac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dac('0x5'))(_0x0dac('0x6'));var config=require('../../config/environment');var jayson=require(_0x0dac('0x7'));var client=jayson[_0x0dac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x927883,_0x302a5c,_0x10d6e3){return new BPromise(function(_0x4a8fd8,_0x11a8d9){return client[_0x0dac('0x9')](_0x927883,_0x10d6e3)['then'](function(_0x423c87){logger[_0x0dac('0xa')](_0x0dac('0xb'),_0x302a5c,_0x0dac('0xc'));logger[_0x0dac('0xd')](_0x0dac('0xe'),_0x302a5c,_0x0dac('0xc'),JSON[_0x0dac('0xf')](_0x423c87));if(_0x423c87[_0x0dac('0x10')]){if(_0x423c87[_0x0dac('0x10')][_0x0dac('0x11')]===0x1f4){logger[_0x0dac('0x10')](_0x0dac('0xb'),_0x302a5c,_0x423c87[_0x0dac('0x10')]['message']);return _0x11a8d9(_0x423c87[_0x0dac('0x10')][_0x0dac('0x12')]);}logger['error'](_0x0dac('0xb'),_0x302a5c,_0x423c87[_0x0dac('0x10')][_0x0dac('0x12')]);return _0x4a8fd8(_0x423c87[_0x0dac('0x10')]['message']);}else{logger[_0x0dac('0xa')](_0x0dac('0xb'),_0x302a5c,'request\x20sent');_0x4a8fd8(_0x423c87[_0x0dac('0x13')][_0x0dac('0x12')]);}})[_0x0dac('0x14')](function(_0x266242){logger['error'](_0x0dac('0xb'),_0x302a5c,_0x266242);_0x11a8d9(_0x266242);});});} \ No newline at end of file +var _0x6374=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x59b68,_0xe0a052){var _0x1a84b7=function(_0x2884dc){while(--_0x2884dc){_0x59b68['push'](_0x59b68['shift']());}};_0x1a84b7(++_0xe0a052);}(_0x6374,0x11f));var _0x4637=function(_0x22e747,_0x37a912){_0x22e747=_0x22e747-0x0;var _0x4950cf=_0x6374[_0x22e747];return _0x4950cf;};'use strict';var _=require(_0x4637('0x0'));var util=require(_0x4637('0x1'));var moment=require(_0x4637('0x2'));var BPromise=require(_0x4637('0x3'));var rs=require(_0x4637('0x4'));var fs=require('fs');var Redis=require(_0x4637('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4637('0x6'));var logger=require(_0x4637('0x7'))(_0x4637('0x8'));var config=require('../../config/environment');var jayson=require(_0x4637('0x9'));var client=jayson[_0x4637('0xa')][_0x4637('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43c197,_0x349c9d,_0x5250ed){return new BPromise(function(_0xc4be90,_0x1e1665){return client[_0x4637('0xc')](_0x43c197,_0x5250ed)[_0x4637('0xd')](function(_0x45ef1e){logger[_0x4637('0xe')](_0x4637('0xf'),_0x349c9d,_0x4637('0x10'));logger[_0x4637('0x11')](_0x4637('0x12'),_0x349c9d,_0x4637('0x10'),JSON[_0x4637('0x13')](_0x45ef1e));if(_0x45ef1e['error']){if(_0x45ef1e[_0x4637('0x14')][_0x4637('0x15')]===0x1f4){logger[_0x4637('0x14')](_0x4637('0xf'),_0x349c9d,_0x45ef1e[_0x4637('0x14')][_0x4637('0x16')]);return _0x1e1665(_0x45ef1e[_0x4637('0x14')][_0x4637('0x16')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x349c9d,_0x45ef1e[_0x4637('0x14')][_0x4637('0x16')]);return _0xc4be90(_0x45ef1e[_0x4637('0x14')][_0x4637('0x16')]);}else{logger['info'](_0x4637('0xf'),_0x349c9d,_0x4637('0x10'));_0xc4be90(_0x45ef1e['result'][_0x4637('0x16')]);}})[_0x4637('0x17')](function(_0x41e926){logger[_0x4637('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x349c9d,_0x41e926);_0x1e1665(_0x41e926);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8ae2660..5b74a41 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 _0xbaad=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3dc56a,_0x407515){var _0x201c74=function(_0x447605){while(--_0x447605){_0x3dc56a['push'](_0x3dc56a['shift']());}};_0x201c74(++_0x407515);}(_0xbaad,0x15d));var _0xdbaa=function(_0x592ca9,_0x426497){_0x592ca9=_0x592ca9-0x0;var _0x360721=_0xbaad[_0x592ca9];return _0x360721;};'use strict';var multer=require(_0xdbaa('0x0'));var util=require(_0xdbaa('0x1'));var path=require(_0xdbaa('0x2'));var timeout=require(_0xdbaa('0x3'));var express=require(_0xdbaa('0x4'));var router=express[_0xdbaa('0x5')]();var fs_extra=require(_0xdbaa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdbaa('0x7'));var config=require(_0xdbaa('0x8'));var controller=require(_0xdbaa('0x9'));router[_0xdbaa('0xa')]('/',auth[_0xdbaa('0xb')](),controller['index']);router[_0xdbaa('0xa')](_0xdbaa('0xc'),auth[_0xdbaa('0xb')](),controller[_0xdbaa('0xd')]);router['get']('/:id',auth[_0xdbaa('0xb')](),controller[_0xdbaa('0xe')]);router[_0xdbaa('0xf')]('/',auth['isAuthenticated'](),controller[_0xdbaa('0x10')]);router[_0xdbaa('0x11')](_0xdbaa('0x12'),auth[_0xdbaa('0xb')](),controller[_0xdbaa('0x13')]);router['delete'](_0xdbaa('0x12'),auth[_0xdbaa('0xb')](),controller[_0xdbaa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3390=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x329ea8,_0x122c96){var _0x446dd1=function(_0x15ae86){while(--_0x15ae86){_0x329ea8['push'](_0x329ea8['shift']());}};_0x446dd1(++_0x122c96);}(_0x3390,0x15b));var _0x0339=function(_0x46b695,_0x369091){_0x46b695=_0x46b695-0x0;var _0x276c75=_0x3390[_0x46b695];return _0x276c75;};'use strict';var multer=require(_0x0339('0x0'));var util=require(_0x0339('0x1'));var path=require(_0x0339('0x2'));var timeout=require(_0x0339('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0339('0x4'));var auth=require(_0x0339('0x5'));var interaction=require(_0x0339('0x6'));var config=require(_0x0339('0x7'));var controller=require('./chatTransferReport.controller');router[_0x0339('0x8')]('/',auth[_0x0339('0x9')](),controller[_0x0339('0xa')]);router[_0x0339('0x8')]('/describe',auth[_0x0339('0x9')](),controller[_0x0339('0xb')]);router['get'](_0x0339('0xc'),auth[_0x0339('0x9')](),controller[_0x0339('0xd')]);router[_0x0339('0xe')]('/',auth[_0x0339('0x9')](),controller[_0x0339('0xf')]);router[_0x0339('0x10')](_0x0339('0xc'),auth['isAuthenticated'](),controller[_0x0339('0x11')]);router[_0x0339('0x12')](_0x0339('0xc'),auth[_0x0339('0x9')](),controller['destroy']);module[_0x0339('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d822522..8802c91 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 _0xedd9=['mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x196ce1,_0x46e836){var _0x360a64=function(_0x3f339f){while(--_0x3f339f){_0x196ce1['push'](_0x196ce1['shift']());}};_0x360a64(++_0x46e836);}(_0xedd9,0xfc));var _0x9edd=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0xedd9[_0x57d740];return _0x6607ef;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'name':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'unique':_0x9edd('0x3')},'description':{'type':Sequelize[_0x9edd('0x2')]},'mapKey':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x4')},'key':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9edd('0x2')]},'animation':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9edd('0x9'),_0x9edd('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xb')},'start_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xc')},'offline_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'header_offline':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9edd('0x11')]},'closingQuestion':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x13')},'noteTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x14')},'closingMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x9edd('0x16'),_0x9edd('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x9edd('0x1a'),'required':!![]},'props':{'title':_0x9edd('0x1b'),'helpText':''}},{'type':_0x9edd('0x19'),'props':{'title':_0x9edd('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9edd('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x1d'))?JSON[_0x9edd('0x1e')](this[_0x9edd('0x1c')](_0x9edd('0x1d'))):{};},'set':function(_0x4d507f){return this['setDataValue'](_0x9edd('0x1d'),JSON[_0x9edd('0x18')](_0x4d507f));}},'offlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9edd('0x4')},'variable':null},{'type':_0x9edd('0x1f'),'config':{'placeholder':_0x9edd('0x20')},'props':{'title':'Comments','helpText':_0x9edd('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x22'))?JSON[_0x9edd('0x1e')](this['getDataValue'](_0x9edd('0x22'))):{};},'set':function(_0x3fb556){return this[_0x9edd('0x23')](_0x9edd('0x22'),JSON[_0x9edd('0x18')](_0x3fb556));}},'token':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return rs[_0x9edd('0x24')]();}},'autoclose':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9edd('0x2')]},'forwardOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9edd('0x2')]},'waitingTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x29')},'skipUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'sendUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9edd('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9edd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2b')},'messagesAlignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2c')},'defaultTitle':{'type':Sequelize[_0x9edd('0x2')]},'customerAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2d')},'systemAvatar':{'type':Sequelize[_0x9edd('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9edd('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![],'comment':_0x9edd('0x2f'),'set':function(_0x48958a){if(!_0x48958a)this[_0x9edd('0x23')]('mandatoryDispositionPauseId',null);this[_0x9edd('0x23')](_0x9edd('0x30'),_0x48958a);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9edd('0x2')]},'vidaooTopic':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x31')},'vidaooNote':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9edd('0x11')]}}; \ No newline at end of file +var _0xd2ea=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','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}}','sequelize','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x3bc717,_0x73c64f){var _0x49933e=function(_0x141ad8){while(--_0x141ad8){_0x3bc717['push'](_0x3bc717['shift']());}};_0x49933e(++_0x73c64f);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1e4fee,_0x1f3ac0){_0x1e4fee=_0x1e4fee-0x0;var _0x273e09=_0xd2ea[_0x1e4fee];return _0x273e09;};'use strict';var Sequelize=require(_0xad2e('0x0'));var rs=require(_0xad2e('0x1'));module[_0xad2e('0x2')]={'name':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xad2e('0x3')]},'mapKey':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'mapKeyOffline':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'key':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xad2e('0x3')]},'animation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xad2e('0x8')]('rounded',_0xad2e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xa')},'start_chat_button':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xad2e('0xe')]},'closingQuestion':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x11')},'noteTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x12')},'placeholderMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x13')},'closingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x14')},'closingMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x16')},'ratingType':{'type':Sequelize[_0xad2e('0x8')](_0xad2e('0x17'),_0xad2e('0x18')),'defaultValue':_0xad2e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xad2e('0xe')],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':_0xad2e('0x1a'),'variable':null,'config':{'placeholder':_0xad2e('0x1b'),'type':_0xad2e('0x1c'),'required':!![]},'props':{'title':_0xad2e('0x1b'),'helpText':''}},{'type':_0xad2e('0x1a'),'props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x1e'))?JSON[_0xad2e('0x1f')](this[_0xad2e('0x1d')](_0xad2e('0x1e'))):{};},'set':function(_0x58acc8){return this[_0xad2e('0x20')](_0xad2e('0x1e'),JSON[_0xad2e('0x19')](_0x58acc8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':'input','props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':_0xad2e('0x4')},'variable':null},{'type':_0xad2e('0x21'),'config':{'placeholder':_0xad2e('0x22')},'props':{'title':_0xad2e('0x22'),'helpText':_0xad2e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x24'))?JSON[_0xad2e('0x1f')](this['getDataValue'](_0xad2e('0x24'))):{};},'set':function(_0xfd2087){return this[_0xad2e('0x20')](_0xad2e('0x24'),JSON[_0xad2e('0x19')](_0xfd2087));}},'token':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':function(){return rs[_0xad2e('0x25')]();}},'autoclose':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xad2e('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xad2e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x26')},'waitingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xad2e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xad2e('0x2b');}},'notificationSound':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xad2e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2f')},'defaultTitle':{'type':Sequelize[_0xad2e('0x3')]},'customerAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad2e('0x6')],'comment':_0xad2e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'comment':_0xad2e('0x32'),'set':function(_0x6f4fbc){if(!_0x6f4fbc)this[_0xad2e('0x20')](_0xad2e('0x33'),null);this['setDataValue'](_0xad2e('0x34'),_0x6f4fbc);}},'vidaooEscalation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xad2e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xad2e('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xad2e('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6bae009..4af6492 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 _0x591c=['agent','startRouting','EventManager','notify','offline','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','originalname','mimetype','server','files','attachments','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','offline-chat','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','custom','License','increment','all','some','x-real-ip','connection','remoteAddress','referer','replace','render','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','path','lodash','querystring','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','end','json','offset','limit','undefined','count','status','set','Content-Range','update','get','ChatWebsites','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatWebsite','includeAll','include','findAll','rows','show','mandatoryDispositionPause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Pause','params','describe','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','addAnswer','getAnswers','map','CannedAnswer','removeAnswers','ids','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','isNil','sitepic','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','asc','Contacts','CmContact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x591c,0x1a1));var _0xc591=function(_0x27ff1a,_0x596dc2){_0x27ff1a=_0x27ff1a-0x0;var _0xa7f1d7=_0x591c[_0x27ff1a];return _0xa7f1d7;};'use strict';var BPromise=require(_0xc591('0x0'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc591('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc591('0x2'));var querystring=require(_0xc591('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xc591('0x4'))(_0xc591('0x5'));var config=require(_0xc591('0x6'));var db=require(_0xc591('0x7'))['db'];config['redis']=_[_0xc591('0x8')](config[_0xc591('0x9')],{'host':_0xc591('0xa'),'port':0x18eb});var socket=require(_0xc591('0xb'))(new Redis(config[_0xc591('0x9')]));require(_0xc591('0xc'))[_0xc591('0xd')](socket);var htmlToText=require(_0xc591('0xe'));var jayson=require(_0xc591('0xf'));var client=jayson['client'][_0xc591('0x10')]({'port':0x232c});var client9002=jayson[_0xc591('0x11')][_0xc591('0x10')]({'port':0x232a});var client9003=jayson['client'][_0xc591('0x10')]({'port':0x232b});var client9001=jayson['client'][_0xc591('0x10')]({'port':0x2329});function respondWithRpcPromise(_0xcb9b99,_0x56a472,_0x417148,_0x517167){return new BPromise(function(_0x4925b0,_0x1732f9){var _0x566130=_0x517167||client;return _0x566130[_0xc591('0x12')](_0xcb9b99,_0x417148)[_0xc591('0x13')](function(_0x5d8c6c){logger['info'](_0xc591('0x14'),_0x56a472,_0xc591('0x15'));logger[_0xc591('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x56a472,_0xc591('0x15'),JSON[_0xc591('0x17')](_0x5d8c6c));if(_0x5d8c6c[_0xc591('0x18')]){if(_0x5d8c6c[_0xc591('0x18')][_0xc591('0x19')]===0x1f4){logger[_0xc591('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x56a472,_0x5d8c6c[_0xc591('0x18')][_0xc591('0x1a')]);return _0x1732f9(_0x5d8c6c[_0xc591('0x18')][_0xc591('0x1a')]);}logger[_0xc591('0x18')](_0xc591('0x14'),_0x56a472,_0x5d8c6c['error']['message']);return _0x4925b0(_0x5d8c6c[_0xc591('0x18')][_0xc591('0x1a')]);}else{logger[_0xc591('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x56a472,'request\x20sent');_0x4925b0(_0x5d8c6c[_0xc591('0x1c')]['message']);}})[_0xc591('0x1d')](function(_0x11d3b8){logger[_0xc591('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x56a472,_0x11d3b8);_0x1732f9(_0x11d3b8);});});}function respondWithStatusCode(_0x3310c2,_0x1330c6){_0x1330c6=_0x1330c6||0xcc;return function(_0x5580b4){if(_0x5580b4){return _0x3310c2['sendStatus'](_0x1330c6);}return _0x3310c2['status'](_0x1330c6)[_0xc591('0x1e')]();};}function respondWithResult(_0x460ff6,_0x3fdb3a){_0x3fdb3a=_0x3fdb3a||0xc8;return function(_0x149929){if(_0x149929){return _0x460ff6['status'](_0x3fdb3a)[_0xc591('0x1f')](_0x149929);}};}function respondWithFilteredResult(_0x13d07b,_0x5460fb){return function(_0x3d0674){if(_0x3d0674){var _0xae787=typeof _0x5460fb[_0xc591('0x20')]==='undefined'&&typeof _0x5460fb[_0xc591('0x21')]===_0xc591('0x22');var _0x32051e=_0x3d0674[_0xc591('0x23')];var _0x511131=_0xae787?0x0:_0x5460fb['offset'];var _0x6ba746=_0xae787?_0x3d0674[_0xc591('0x23')]:_0x5460fb['offset']+_0x5460fb[_0xc591('0x21')];var _0x4ae2c4;if(_0x6ba746>=_0x32051e){_0x6ba746=_0x32051e;_0x4ae2c4=0xc8;}else{_0x4ae2c4=0xce;}_0x13d07b[_0xc591('0x24')](_0x4ae2c4);return _0x13d07b[_0xc591('0x25')](_0xc591('0x26'),_0x511131+'-'+_0x6ba746+'/'+_0x32051e)[_0xc591('0x1f')](_0x3d0674);}return null;};}function saveUpdates(_0x3370fc){return function(_0x2f2108){if(_0x2f2108){return _0x2f2108[_0xc591('0x27')](_0x3370fc)['then'](function(_0x4626ed){return _0x4626ed;});}return null;};}function removeEntity(_0x3e64d3){return function(_0x37f967){if(_0x37f967){return _0x37f967['destroy']()[_0xc591('0x13')](function(){var _0x60a65d=_0x37f967[_0xc591('0x28')]({'plain':!![]});var _0x48396a=_0xc591('0x29');return db['UserProfileResource'][_0xc591('0x2a')]({'where':{'type':_0x48396a,'resourceId':_0x60a65d['id']}})[_0xc591('0x13')](function(){return _0x37f967;});})[_0xc591('0x13')](function(){_0x3e64d3[_0xc591('0x24')](0xcc)[_0xc591('0x1e')]();});}};}function handleEntityNotFound(_0x90f3a9){return function(_0x5876ca){if(!_0x5876ca){_0x90f3a9[_0xc591('0x2b')](0x194);}return _0x5876ca;};}function handleError(_0x5ad618,_0x14e7af){_0x14e7af=_0x14e7af||0x1f4;return function(_0x2cdc03){logger[_0xc591('0x18')](_0x2cdc03[_0xc591('0x2c')]);if(_0x2cdc03['name']){delete _0x2cdc03[_0xc591('0x2d')];}_0x5ad618['status'](_0x14e7af)[_0xc591('0x2e')](_0x2cdc03);};}exports['index']=function(_0x5d186c,_0xac07f5){var _0x8b2cc8={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x48782f={},_0x45eba8={'count':0x0,'rows':[]};var _0x8d831f=_['map'](db['ChatWebsite'][_0xc591('0x2f')],function(_0xdb2c5){return{'name':_0xdb2c5[_0xc591('0x30')],'type':_0xdb2c5[_0xc591('0x31')]['key']};});_0x48782f['model']=_['map'](_0x8d831f,_0xc591('0x2d'));_0x48782f[_0xc591('0x32')]=_[_0xc591('0x33')](_0x5d186c[_0xc591('0x32')]);_0x48782f[_0xc591('0x34')]=_[_0xc591('0x35')](_0x48782f[_0xc591('0x36')],_0x48782f[_0xc591('0x32')]);_0x8b2cc8['attributes']=_[_0xc591('0x35')](_0x48782f[_0xc591('0x36')],qs[_0xc591('0x37')](_0x5d186c[_0xc591('0x32')]['fields']));_0x8b2cc8[_0xc591('0x38')]=_0x8b2cc8['attributes'][_0xc591('0x39')]?_0x8b2cc8[_0xc591('0x38')]:_0x48782f[_0xc591('0x36')];if(!_0x5d186c[_0xc591('0x32')][_0xc591('0x3a')](_0xc591('0x3b'))){_0x8b2cc8[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x5d186c[_0xc591('0x32')][_0xc591('0x21')]);_0x8b2cc8['offset']=qs[_0xc591('0x20')](_0x5d186c[_0xc591('0x32')][_0xc591('0x20')]);}_0x8b2cc8[_0xc591('0x3c')]=qs['sort'](_0x5d186c[_0xc591('0x32')][_0xc591('0x3d')]);_0x8b2cc8[_0xc591('0x3e')]=qs[_0xc591('0x34')](_[_0xc591('0x3f')](_0x5d186c[_0xc591('0x32')],_0x48782f[_0xc591('0x34')]),_0x8d831f);if(_0x5d186c[_0xc591('0x32')]['filter']){_0x8b2cc8[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x8b2cc8['where'],{'$or':_['map'](_0x8d831f,function(_0x20fc86){if(_0x20fc86[_0xc591('0x31')]!==_0xc591('0x41')){var _0x31e028={};_0x31e028[_0x20fc86[_0xc591('0x2d')]]={'$like':'%'+_0x5d186c[_0xc591('0x32')][_0xc591('0x42')]+'%'};return _0x31e028;}})});}_0x8b2cc8=_['merge']({},_0x8b2cc8,_0x5d186c[_0xc591('0x43')]);var _0x1ee7cc={'where':_0x8b2cc8[_0xc591('0x3e')]};return db[_0xc591('0x44')][_0xc591('0x23')](_0x1ee7cc)[_0xc591('0x13')](function(_0x498113){_0x45eba8[_0xc591('0x23')]=_0x498113;if(_0x5d186c['query'][_0xc591('0x45')]){_0x8b2cc8[_0xc591('0x46')]=[{'all':!![]}];}return db[_0xc591('0x44')][_0xc591('0x47')](_0x8b2cc8);})[_0xc591('0x13')](function(_0x694f7){_0x45eba8[_0xc591('0x48')]=_0x694f7;return _0x45eba8;})[_0xc591('0x13')](respondWithFilteredResult(_0xac07f5,_0x8b2cc8))[_0xc591('0x1d')](handleError(_0xac07f5,null));};exports[_0xc591('0x49')]=function(_0x4b9071,_0x3ea631){var _0x39bbd3={'raw':![],'where':{'id':_0x4b9071['params']['id']},'include':[{'model':db['Pause'],'as':_0xc591('0x4a')}]},_0x410b5e={};_0x410b5e[_0xc591('0x36')]=_[_0xc591('0x33')](db[_0xc591('0x44')][_0xc591('0x2f')]);_0x410b5e['query']=_[_0xc591('0x33')](_0x4b9071[_0xc591('0x32')]);_0x410b5e[_0xc591('0x34')]=_[_0xc591('0x35')](_0x410b5e[_0xc591('0x36')],_0x410b5e[_0xc591('0x32')]);_0x39bbd3['attributes']=_[_0xc591('0x35')](_0x410b5e[_0xc591('0x36')],qs['fields'](_0x4b9071[_0xc591('0x32')][_0xc591('0x37')]));_0x39bbd3['attributes']=_0x39bbd3[_0xc591('0x38')][_0xc591('0x39')]?_0x39bbd3['attributes']:_0x410b5e[_0xc591('0x36')];if(_0x4b9071['query'][_0xc591('0x45')]){_0x39bbd3[_0xc591('0x46')]=[{'all':!![]}];}_0x39bbd3=_[_0xc591('0x40')]({},_0x39bbd3,_0x4b9071[_0xc591('0x43')]);return db[_0xc591('0x44')]['find'](_0x39bbd3)['then'](handleEntityNotFound(_0x3ea631,null))[_0xc591('0x13')](respondWithResult(_0x3ea631,null))['catch'](handleError(_0x3ea631,null));};exports[_0xc591('0x4b')]=function(_0x1ae8fe,_0x4a349f){return db['ChatWebsite']['create'](_0x1ae8fe[_0xc591('0x4c')],{})[_0xc591('0x13')](function(_0x3a11a4){var _0x543716=_0x1ae8fe[_0xc591('0x4d')][_0xc591('0x28')]({'plain':!![]});if(!_0x543716)throw new Error(_0xc591('0x4e'));if(_0x543716[_0xc591('0x4f')]===_0xc591('0x4d')){var _0x2d3431=_0x3a11a4['get']({'plain':!![]});var _0x1d0b73='ChatWebsites';return db[_0xc591('0x50')]['find']({'where':{'name':_0x1d0b73,'userProfileId':_0x543716[_0xc591('0x51')]},'raw':!![]})[_0xc591('0x13')](function(_0xe38d5){if(_0xe38d5&&_0xe38d5[_0xc591('0x52')]===0x0){return db[_0xc591('0x53')]['create']({'name':_0x2d3431[_0xc591('0x2d')],'resourceId':_0x2d3431['id'],'type':_0xe38d5[_0xc591('0x2d')],'sectionId':_0xe38d5['id']},{})[_0xc591('0x13')](function(){return _0x3a11a4;});}else{return _0x3a11a4;}})[_0xc591('0x1d')](function(_0x5f2227){logger[_0xc591('0x18')](_0xc591('0x54'),_0x5f2227);throw _0x5f2227;});}return _0x3a11a4;})[_0xc591('0x13')](respondWithResult(_0x4a349f,0xc9))[_0xc591('0x1d')](handleError(_0x4a349f,null));};exports['update']=function(_0x1ee6ee,_0x2da3ae){if(_0x1ee6ee[_0xc591('0x4c')]['id']){delete _0x1ee6ee[_0xc591('0x4c')]['id'];}return db['ChatWebsite'][_0xc591('0x55')]({'where':{'id':_0x1ee6ee['params']['id']},'include':[{'model':db[_0xc591('0x56')],'as':'mandatoryDispositionPause'}]})[_0xc591('0x13')](handleEntityNotFound(_0x2da3ae,null))[_0xc591('0x13')](saveUpdates(_0x1ee6ee['body'],null))[_0xc591('0x13')](respondWithResult(_0x2da3ae,null))['catch'](handleError(_0x2da3ae,null));};exports[_0xc591('0x2a')]=function(_0x376180,_0x390272){return db['ChatWebsite'][_0xc591('0x55')]({'where':{'id':_0x376180[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x390272,null))[_0xc591('0x13')](removeEntity(_0x390272,null))[_0xc591('0x1d')](handleError(_0x390272,null));};exports['describe']=function(_0x337862,_0x41b471){return db[_0xc591('0x44')][_0xc591('0x58')]()['then'](respondWithResult(_0x41b471,null))[_0xc591('0x1d')](handleError(_0x41b471,null));};exports['addDisposition']=function(_0xfbc3f4,_0x3347f7){if(_0xfbc3f4[_0xc591('0x4c')]['id']){delete _0xfbc3f4[_0xc591('0x4c')]['id'];}return db[_0xc591('0x44')]['find']({'where':{'id':_0xfbc3f4[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x3347f7,null))[_0xc591('0x13')](function(_0x4db306){if(_0x4db306){_0xfbc3f4[_0xc591('0x4c')][_0xc591('0x59')]=_0x4db306['id'];return db['Disposition'][_0xc591('0x4b')](_0xfbc3f4[_0xc591('0x4c')]);}})[_0xc591('0x13')](respondWithResult(_0x3347f7,null))[_0xc591('0x1d')](handleError(_0x3347f7,null));};exports[_0xc591('0x5a')]=function(_0x364d50,_0x6251b){var _0x9e6443={'raw':![],'where':{}};var _0x291dfe={};var _0x57efa0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc591('0x5b')]({'where':{'id':_0x364d50[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x6251b,null))['then'](function(_0x4226b7){if(_0x4226b7){_0x291dfe[_0xc591('0x36')]=_['keys'](db['Disposition'][_0xc591('0x2f')]);_0x291dfe[_0xc591('0x32')]=_[_0xc591('0x33')](_0x364d50['query']);_0x291dfe['filters']=_[_0xc591('0x35')](_0x291dfe[_0xc591('0x36')],_0x291dfe[_0xc591('0x32')]);_0x9e6443[_0xc591('0x38')]=_[_0xc591('0x35')](_0x291dfe[_0xc591('0x36')],qs[_0xc591('0x37')](_0x364d50[_0xc591('0x32')][_0xc591('0x37')]));_0x9e6443[_0xc591('0x38')]=_0x9e6443[_0xc591('0x38')][_0xc591('0x39')]?_0x9e6443[_0xc591('0x38')]:_0x291dfe[_0xc591('0x36')];if(!_0x364d50['query'][_0xc591('0x3a')]('nolimit')){_0x9e6443['limit']=qs[_0xc591('0x21')](_0x364d50[_0xc591('0x32')]['limit']);_0x9e6443[_0xc591('0x20')]=qs[_0xc591('0x20')](_0x364d50['query'][_0xc591('0x20')]);}_0x9e6443[_0xc591('0x3c')]=qs[_0xc591('0x3d')](_0x364d50['query']['sort']);_0x9e6443[_0xc591('0x3e')]=qs[_0xc591('0x34')](_[_0xc591('0x3f')](_0x364d50[_0xc591('0x32')],_0x291dfe['filters']));_0x9e6443['where'][_0xc591('0x59')]=_0x4226b7['id'];if(_0x364d50[_0xc591('0x32')][_0xc591('0x42')]){_0x9e6443[_0xc591('0x3e')]=_['merge'](_0x9e6443[_0xc591('0x3e')],{'$or':_['map'](_0x9e6443[_0xc591('0x38')],function(_0x55420b){var _0x25adbf={};_0x25adbf[_0x55420b]={'$like':'%'+_0x364d50[_0xc591('0x32')]['filter']+'%'};return _0x25adbf;})});}_0x9e6443=_[_0xc591('0x40')]({},_0x9e6443,_0x364d50[_0xc591('0x43')]);return db[_0xc591('0x5c')][_0xc591('0x23')]({'where':_0x9e6443[_0xc591('0x3e')]})[_0xc591('0x13')](function(_0x10b317){_0x57efa0[_0xc591('0x23')]=_0x10b317;if(_0x364d50['query']['includeAll']){_0x9e6443[_0xc591('0x46')]=[{'all':!![]}];}return db[_0xc591('0x5c')][_0xc591('0x47')](_0x9e6443);})[_0xc591('0x13')](function(_0x32101b){_0x57efa0[_0xc591('0x48')]=_0x32101b;return _0x57efa0;});}})[_0xc591('0x13')](respondWithFilteredResult(_0x6251b,_0x9e6443))['catch'](handleError(_0x6251b,null));};exports[_0xc591('0x5d')]=function(_0x10248c,_0x27780b){return db['ChatWebsite']['find']({'where':{'id':_0x10248c[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x27780b,null))[_0xc591('0x13')](function(_0x130c6d){if(_0x130c6d){return _0x130c6d[_0xc591('0x5d')](_0x10248c[_0xc591('0x32')]['ids']);}})[_0xc591('0x13')](respondWithStatusCode(_0x27780b,null))[_0xc591('0x1d')](handleError(_0x27780b,null));};exports[_0xc591('0x5e')]=function(_0x13233e,_0x4bbb69){if(_0x13233e[_0xc591('0x4c')]['id']){delete _0x13233e[_0xc591('0x4c')]['id'];}return db['ChatWebsite'][_0xc591('0x55')]({'where':{'id':_0x13233e[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x4bbb69,null))[_0xc591('0x13')](function(_0x183b3b){if(_0x183b3b){_0x13233e[_0xc591('0x4c')][_0xc591('0x59')]=_0x183b3b['id'];return db['CannedAnswer'][_0xc591('0x4b')](_0x13233e[_0xc591('0x4c')]);}})[_0xc591('0x13')](respondWithResult(_0x4bbb69,null))[_0xc591('0x1d')](handleError(_0x4bbb69,null));};exports[_0xc591('0x5f')]=function(_0x568e0a,_0x5f0908){var _0x2fcd39={'raw':![],'where':{}};var _0x467964={};var _0x2e0c59={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc591('0x5b')]({'where':{'id':_0x568e0a[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f0908,null))[_0xc591('0x13')](function(_0x3f38f7){if(_0x3f38f7){_0x467964[_0xc591('0x36')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x467964['query']=_[_0xc591('0x33')](_0x568e0a[_0xc591('0x32')]);_0x467964[_0xc591('0x34')]=_['intersection'](_0x467964[_0xc591('0x36')],_0x467964['query']);_0x2fcd39[_0xc591('0x38')]=_[_0xc591('0x35')](_0x467964[_0xc591('0x36')],qs['fields'](_0x568e0a[_0xc591('0x32')][_0xc591('0x37')]));_0x2fcd39[_0xc591('0x38')]=_0x2fcd39[_0xc591('0x38')][_0xc591('0x39')]?_0x2fcd39[_0xc591('0x38')]:_0x467964[_0xc591('0x36')];if(!_0x568e0a[_0xc591('0x32')][_0xc591('0x3a')](_0xc591('0x3b'))){_0x2fcd39['limit']=qs[_0xc591('0x21')](_0x568e0a['query'][_0xc591('0x21')]);_0x2fcd39[_0xc591('0x20')]=qs[_0xc591('0x20')](_0x568e0a[_0xc591('0x32')][_0xc591('0x20')]);}_0x2fcd39['order']=qs[_0xc591('0x3d')](_0x568e0a[_0xc591('0x32')]['sort']);_0x2fcd39[_0xc591('0x3e')]=qs[_0xc591('0x34')](_['pick'](_0x568e0a[_0xc591('0x32')],_0x467964[_0xc591('0x34')]));_0x2fcd39[_0xc591('0x3e')][_0xc591('0x59')]=_0x3f38f7['id'];if(_0x568e0a[_0xc591('0x32')]['filter']){_0x2fcd39[_0xc591('0x3e')]=_['merge'](_0x2fcd39[_0xc591('0x3e')],{'$or':_[_0xc591('0x60')](_0x2fcd39[_0xc591('0x38')],function(_0x5d8563){var _0x3f33b9={};_0x3f33b9[_0x5d8563]={'$like':'%'+_0x568e0a[_0xc591('0x32')]['filter']+'%'};return _0x3f33b9;})});}_0x2fcd39=_[_0xc591('0x40')]({},_0x2fcd39,_0x568e0a[_0xc591('0x43')]);return db[_0xc591('0x61')][_0xc591('0x23')]({'where':_0x2fcd39[_0xc591('0x3e')]})[_0xc591('0x13')](function(_0xffee00){_0x2e0c59[_0xc591('0x23')]=_0xffee00;if(_0x568e0a[_0xc591('0x32')]['includeAll']){_0x2fcd39[_0xc591('0x46')]=[{'all':!![]}];}return db[_0xc591('0x61')][_0xc591('0x47')](_0x2fcd39);})[_0xc591('0x13')](function(_0x51007e){_0x2e0c59[_0xc591('0x48')]=_0x51007e;return _0x2e0c59;});}})[_0xc591('0x13')](respondWithFilteredResult(_0x5f0908,_0x2fcd39))[_0xc591('0x1d')](handleError(_0x5f0908,null));};exports[_0xc591('0x62')]=function(_0x53f440,_0x3f3272){return db[_0xc591('0x44')]['find']({'where':{'id':_0x53f440['params']['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x3f3272,null))[_0xc591('0x13')](function(_0x258262){if(_0x258262){return _0x258262[_0xc591('0x62')](_0x53f440['query'][_0xc591('0x63')]);}})[_0xc591('0x13')](respondWithStatusCode(_0x3f3272,null))['catch'](handleError(_0x3f3272,null));};exports[_0xc591('0x64')]=function(_0x1140e0,_0x5b75ee){_0x1140e0[_0xc591('0x4c')]['sitepic']=_0x1140e0[_0xc591('0x65')][_0xc591('0x66')];return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x1140e0[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b75ee,null))['then'](saveUpdates(_0x1140e0[_0xc591('0x4c')],null))[_0xc591('0x13')](respondWithResult(_0x5b75ee,null))[_0xc591('0x1d')](handleError(_0x5b75ee,null));};exports[_0xc591('0x67')]=function(_0x382590,_0x47e96a){_0x382590[_0xc591('0x4c')]['agentAvatar']=_0x382590[_0xc591('0x65')][_0xc591('0x66')];return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x382590[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x47e96a,null))[_0xc591('0x13')](saveUpdates(_0x382590['body'],null))[_0xc591('0x13')](respondWithResult(_0x47e96a,null))['catch'](handleError(_0x47e96a,null));};exports[_0xc591('0x68')]=function(_0x4207cd,_0x5b588d){_0x4207cd[_0xc591('0x4c')][_0xc591('0x69')]=_0x4207cd[_0xc591('0x65')]['filename'];return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x4207cd[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x5b588d,null))['then'](saveUpdates(_0x4207cd['body'],null))['then'](respondWithResult(_0x5b588d,null))[_0xc591('0x1d')](handleError(_0x5b588d,null));};exports[_0xc591('0x6a')]=function(_0x134908,_0x2f9b4e){_0x134908['body'][_0xc591('0x6b')]=_0x134908[_0xc591('0x65')][_0xc591('0x66')];return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x134908['params']['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x2f9b4e,null))[_0xc591('0x13')](saveUpdates(_0x134908[_0xc591('0x4c')],null))['then'](respondWithResult(_0x2f9b4e,null))['catch'](handleError(_0x2f9b4e,null));};exports[_0xc591('0x6c')]=function(_0x1952d,_0x1242b2){var _0x42d650=path[_0xc591('0x6d')](config['root'],_0xc591('0x6e'));var _0x7790c0={'where':{'id':_0x1952d[_0xc591('0x57')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xf58cf9=![];return require('../../config/license/util')[_0xc591('0x6f')]()[_0xc591('0x13')](function(_0x301b00){if(_0x301b00){_0xf58cf9=_0x301b00['custom'];}})['then'](function(){return db[_0xc591('0x44')][_0xc591('0x55')](_0x7790c0);})[_0xc591('0x13')](handleEntityNotFound(_0x1242b2,null))[_0xc591('0x13')](function(_0x3324d5){if(_0x3324d5){if(!_[_0xc591('0x70')](_0x3324d5[_0xc591('0x71')])){if(fs[_0xc591('0x72')](path['join'](config[_0xc591('0x73')],_0xc591('0x74'),_0x3324d5['sitepic']))&&_0xf58cf9){_0x42d650=path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0x74'),_0x3324d5[_0xc591('0x71')]);}}return _0x1242b2[_0xc591('0x75')](_0x42d650);}})[_0xc591('0x1d')](handleError(_0x1242b2,null));};exports[_0xc591('0x76')]=function(_0x50478d,_0xa05c78){var _0x3703cb=path['join'](config['root'],_0xc591('0x77'));var _0xe65d8c={'where':{'id':_0x50478d[_0xc591('0x57')]['id']},'attributes':['id',_0xc591('0x78')],'raw':!![]};return db[_0xc591('0x44')][_0xc591('0x55')](_0xe65d8c)['then'](handleEntityNotFound(_0xa05c78,null))[_0xc591('0x13')](function(_0x27c8ea){if(_0x27c8ea){if(!_[_0xc591('0x70')](_0x27c8ea[_0xc591('0x78')])){if(fs[_0xc591('0x72')](path[_0xc591('0x6d')](config[_0xc591('0x73')],'server/files/images/avatars/',_0x27c8ea['agentAvatar']))){_0x3703cb=path[_0xc591('0x6d')](config['root'],_0xc591('0x79'),_0x27c8ea[_0xc591('0x78')]);}}return _0xa05c78[_0xc591('0x75')](_0x3703cb);}})[_0xc591('0x1d')](handleError(_0xa05c78,null));};exports[_0xc591('0x7a')]=function(_0x1acec8,_0xc411f1){var _0x24d122=path['join'](config['root'],_0xc591('0x7b'));var _0x1bfc9d={'where':{'id':_0x1acec8['params']['id']},'attributes':['id',_0xc591('0x69'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x1bfc9d)[_0xc591('0x13')](handleEntityNotFound(_0xc411f1,null))['then'](function(_0x4757a0){if(_0x4757a0){if(!_['isNil'](_0x4757a0[_0xc591('0x69')])){if(fs[_0xc591('0x72')](path[_0xc591('0x6d')](config[_0xc591('0x73')],'server/files/images/avatars/',_0x4757a0['customerAvatar']))&&_0x4757a0[_0xc591('0x7c')]){_0x24d122=path['join'](config[_0xc591('0x73')],'server/files/images/avatars/',_0x4757a0[_0xc591('0x69')]);}}return _0xc411f1[_0xc591('0x75')](_0x24d122);}})['catch'](handleError(_0xc411f1,null));};exports[_0xc591('0x7d')]=function(_0x2b1763,_0x34deaa){var _0xd90e4a=path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0x7e'));var _0x454106={'where':{'id':_0x2b1763[_0xc591('0x57')]['id']},'attributes':['id',_0xc591('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xc591('0x55')](_0x454106)['then'](handleEntityNotFound(_0x34deaa,null))[_0xc591('0x13')](function(_0x2a32b8){if(_0x2a32b8){if(!_[_0xc591('0x70')](_0x2a32b8[_0xc591('0x6b')])){if(fs['existsSync'](path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0x79'),_0x2a32b8['systemAvatar']))){_0xd90e4a=path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0x79'),_0x2a32b8[_0xc591('0x6b')]);}}return _0x34deaa[_0xc591('0x75')](_0xd90e4a);}})[_0xc591('0x1d')](handleError(_0x34deaa,null));};exports['notify']=function(_0x4a094f,_0x398800){var _0x370895=require(_0xc591('0x7f'));var _0x1e5191=new _0x370895();var _0x37f92b=_0x1e5191[_0xc591('0x80')](_0x4a094f['headers'][_0xc591('0x81')])[_0xc591('0x82')]();var _0x2841f2={'body':_0x4a094f['body'],'channel':_0xc591('0x83')};var _0x27397e=[];var _0x3e45a8=[];var _0x5640bd={};var _0x32739f=![];return db['CmContact'][_0xc591('0x58')]()['then'](function(_0x8750d3){if(!_0x8750d3){throw new db[(_0xc591('0x84'))][(_0xc591('0x85'))](_0xc591('0x86'));}_0x27397e=_['difference'](_[_0xc591('0x33')](_0x8750d3),['createdAt',_0xc591('0x87')]);_0x3e45a8=_[_0xc591('0x88')](_[_0xc591('0x33')](_0x8750d3),[_0xc591('0x89'),_0xc591('0x87'),_0xc591('0x8a'),'ListId']);if(_0x4a094f[_0xc591('0x4c')]['id']){delete _0x4a094f[_0xc591('0x4c')]['id'];}if(_[_0xc591('0x70')](_0x4a094f[_0xc591('0x4c')][_0xc591('0x8b')])){throw new db[(_0xc591('0x84'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xc591('0x70')](_0x4a094f[_0xc591('0x4c')][_0xc591('0x4c')])||_0x4a094f[_0xc591('0x4c')][_0xc591('0x4c')]===''){throw new db['Sequelize'][(_0xc591('0x85'))](_0xc591('0x8c'));}if(_[_0xc591('0x70')](_0x4a094f[_0xc591('0x4c')][_0xc591('0x8d')])){throw new db[(_0xc591('0x84'))][(_0xc591('0x85'))](_0xc591('0x8e')+_0x3e45a8);}if(!_['includes'](_0x3e45a8,_0x4a094f['body'][_0xc591('0x8d')])){throw new db[(_0xc591('0x84'))]['ValidationError'](_0xc591('0x8f')+_0x3e45a8);}_0x5640bd[_0x4a094f[_0xc591('0x4c')]['mapKey']]=_0x4a094f[_0xc591('0x4c')][_0xc591('0x8b')];})[_0xc591('0x13')](function(){return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x4a094f[_0xc591('0x57')]['id']},'include':[{'model':db[_0xc591('0x90')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5640bd,'limit':0x1,'order':[[_0xc591('0x87'),_0xc591('0x91')]]}]},{'model':db[_0xc591('0x92')],'as':_0xc591('0x93')}]});})['then'](handleEntityNotFound(_0x398800,null))[_0xc591('0x13')](function(_0x523dd7){if(_0x523dd7&&_0x523dd7[_0xc591('0x94')]){_0x2841f2[_0xc591('0x95')]=_0x523dd7;_0x2841f2[_0xc591('0x96')]=_0x523dd7['Applications'];_0x2841f2[_0xc591('0x97')]=_0x523dd7[_0xc591('0x94')];_0x2841f2['applications']=_[_0xc591('0x98')](_0x2841f2[_0xc591('0x96')],['priority'],[_0xc591('0x99')]);if(_0x2841f2[_0xc591('0x95')][_0xc591('0x93')]){delete _0x2841f2['account'][_0xc591('0x93')];}if(_0x2841f2[_0xc591('0x95')][_0xc591('0x94')]&&_0x2841f2[_0xc591('0x95')][_0xc591('0x94')][_0xc591('0x9a')][_0xc591('0x39')]){return _0x2841f2[_0xc591('0x95')]['List'][_0xc591('0x9a')][0x0];}var _0x299c2c=_[_0xc591('0x8')](_0x4a094f[_0xc591('0x4c')],{'firstName':_0x4a094f[_0xc591('0x4c')][_0xc591('0x8b')],'ListId':_0x523dd7['ListId']});_0x299c2c[_0x4a094f[_0xc591('0x4c')][_0xc591('0x8d')]]=_0x4a094f[_0xc591('0x4c')][_0xc591('0x8b')];return db[_0xc591('0x9b')][_0xc591('0x4b')](_0x299c2c,{'fields':_0x27397e,'raw':!![]});}})['then'](handleEntityNotFound(_0x398800,null))[_0xc591('0x13')](function(_0x539722){_0x2841f2['contact']=_0x539722;var _0x2115a3=_0x4a094f[_0xc591('0x4c')][_0xc591('0x9c')];if(_0x4a094f[_0xc591('0x9d')][_0xc591('0x9e')]){_0x2115a3=_0x4a094f[_0xc591('0x9d')][_0xc591('0x9e')];}else if(_0x4a094f[_0xc591('0x9d')][_0xc591('0x9f')]){_0x2115a3=_[_0xc591('0xa0')](_0x4a094f[_0xc591('0x9d')][_0xc591('0x9f')][_0xc591('0xa1')](','));}if(_0x539722){var _0xdfce15={'ContactId':_0x539722['id'],'ChatWebsiteId':_0x4a094f[_0xc591('0x57')]['id'],'from':(_0x539722[_0xc591('0xa2')]||'')+'\x20'+(_0x539722[_0xc591('0xa3')]||''),'customerIp':_0x2115a3,'customerPort':_0x4a094f[_0xc591('0x9d')][_0xc591('0xa4')]?_0x4a094f[_0xc591('0x9d')][_0xc591('0xa4')]:null,'referer':_0x4a094f['body']['referer'],'browserName':_0x37f92b[_0xc591('0xa5')][_0xc591('0x2d')]&&_0x37f92b[_0xc591('0xa5')][_0xc591('0xa6')]?util[_0xc591('0xa7')](_0xc591('0xa8'),_0x37f92b[_0xc591('0xa5')][_0xc591('0x2d')],_0x37f92b[_0xc591('0xa5')][_0xc591('0xa6')]):_0xc591('0xa9'),'browserVersion':_0x37f92b[_0xc591('0xa5')][_0xc591('0xa6')]||_0xc591('0xa9'),'osName':util['format'](_0xc591('0xa8'),_0x37f92b['os']['name'],_0x37f92b['os'][_0xc591('0xa6')]),'osVersion':_0x37f92b['os'][_0xc591('0xa6')],'deviceModel':_0x37f92b[_0xc591('0xaa')][_0xc591('0x36')]&&_0x37f92b[_0xc591('0xaa')][_0xc591('0xab')]?util['format'](_0xc591('0xac'),_0x37f92b[_0xc591('0xaa')][_0xc591('0x36')],_0x37f92b[_0xc591('0xaa')][_0xc591('0xab')],_0x37f92b[_0xc591('0xaa')][_0xc591('0x31')]):null,'deviceVendor':_0x37f92b[_0xc591('0xaa')][_0xc591('0xab')],'deviceType':_0x37f92b[_0xc591('0xaa')][_0xc591('0x31')],'formData':JSON[_0xc591('0x17')](_0x4a094f[_0xc591('0x4c')])};var _0x1725ab={'ChatWebsiteId':_0x4a094f[_0xc591('0x57')]['id'],'closed':![]};if(_0x4a094f['body'][_0xc591('0xad')]){_0x1725ab['threadId']=_0x4a094f[_0xc591('0x4c')][_0xc591('0xad')];return db[_0xc591('0xae')][_0xc591('0x55')]({'where':_0x1725ab})['then'](function(_0x1c70b7){if(_0x1c70b7){return[_0x1c70b7,![]];}_0xdfce15[_0xc591('0xad')]=_0x4a094f['body'][_0xc591('0xad')];_0xdfce15[_0xc591('0xaf')]=_0x4a094f[_0xc591('0x4c')][_0xc591('0xaf')];return db[_0xc591('0xae')][_0xc591('0x4b')](_0xdfce15)[_0xc591('0x13')](function(_0x4b20bf){return[_0x4b20bf,!![]];});});}_0x1725ab[_0xc591('0xb0')]=_0x539722['id'];if(_0x4a094f['body']['interaction']&&_0x4a094f[_0xc591('0x4c')]['interaction']['id']){_0x1725ab['id']=_0x4a094f[_0xc591('0x4c')][_0xc591('0xb1')]['id'];return db[_0xc591('0xae')][_0xc591('0x55')]({'where':_0x1725ab})[_0xc591('0x13')](function(_0x5672ef){if(_0x5672ef){return[_0x5672ef,![]];}return db[_0xc591('0xae')][_0xc591('0x4b')](_0xdfce15)['then'](function(_0x1d0220){return[_0x1d0220,!![]];});});}return db[_0xc591('0xae')][_0xc591('0x4b')](_0xdfce15)[_0xc591('0x13')](function(_0x1c0658){return[_0x1c0658,!![]];});}})[_0xc591('0xb2')](function(_0x2fd2df,_0x5bd375){if(_0x2fd2df){_0x32739f=_0x5bd375;if(!_0x5bd375){var _0x5d376e={'from':(_0x2841f2[_0xc591('0xb3')]['firstName']||'')+'\x20'+(_0x2841f2[_0xc591('0xb3')][_0xc591('0xa3')]||'')};if(_0x4a094f[_0xc591('0x4c')][_0xc591('0xad')]&&_0x4a094f[_0xc591('0x4c')]['messageId']&&_0x4a094f[_0xc591('0x4c')]['threadId']!=_0x4a094f[_0xc591('0x4c')][_0xc591('0xb4')]){_0x5d376e[_0xc591('0xad')]=_0x4a094f['body'][_0xc591('0xb4')];}return _0x2fd2df[_0xc591('0x27')](_0x5d376e);}else{return _0x2fd2df;}}})[_0xc591('0x13')](function(_0x17555a){_0x2841f2[_0xc591('0xb1')]=_0x17555a[_0xc591('0x28')]({'plain':!![]});_0x2841f2[_0xc591('0xb1')]['created']=_0x32739f;if(_0x2841f2['interaction'][_0xc591('0xb5')]){if(_0x2841f2[_0xc591('0x95')][_0xc591('0xb6')]){_0x2841f2[_0xc591('0x96')][_0xc591('0xb7')]({'id':0x0,'priority':_0x2841f2[_0xc591('0x96')][_0xc591('0x39')]+0x1,'app':_0xc591('0xb8'),'appdata':_0xc591('0xb9'),'interval':_0xc591('0xba')});}}return db[_0xc591('0xbb')][_0xc591('0x4b')]({'body':_0x4a094f[_0xc591('0x4c')]['body'],'ChatWebsiteId':_0x4a094f[_0xc591('0x57')]['id'],'ChatInteractionId':_0x17555a['id'],'direction':'in','ContactId':_0x2841f2['contact']['id'],'AttachmentId':_0x4a094f[_0xc591('0x4c')][_0xc591('0xbc')]});})[_0xc591('0x13')](function(_0x3fc4dc){_0x2841f2[_0xc591('0x1a')]=_0x3fc4dc;if(_0x2841f2['interaction'][_0xc591('0xbd')]){return db[_0xc591('0xbe')][_0xc591('0x55')]({'attributes':['id',_0xc591('0x2d')],'where':{'id':_0x2841f2[_0xc591('0xb1')]['UserId']}})[_0xc591('0x13')](function(_0x537394){if(_0x537394){_0x2841f2['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc591('0xbf'),'appdata':_0x537394[_0xc591('0x2d')]+','+(_0x2841f2['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc591('0xba')});_0x2841f2['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xc591('0xc0'),_0x2841f2);});}return respondWithRpcPromise('Start',_0xc591('0xc0'),_0x2841f2);})[_0xc591('0x13')](function(_0x489786){respondWithRpcPromise(_0xc591('0xc1'),_0xc591('0xc1'),{'event':_0xc591('0xc2'),'message':_0x489786},client9002);return _0x489786;})[_0xc591('0x13')](respondWithResult(_0x398800,null))[_0xc591('0x1d')](handleError(_0x398800,null));};exports[_0xc591('0xc3')]=function(_0x31e8c4,_0x6779d1){var _0x4003be,_0x404d81,_0x5a00f7;var _0x1caa4b=[];var _0x1d7ec4={};var _0x4dae99=_0x31e8c4['files']||[];var _0x535daf=[];var _0xb2907b;return db[_0xc591('0x9b')][_0xc591('0x58')]()[_0xc591('0x13')](function(_0x1d4f98){if(!_0x1d4f98){throw new db[(_0xc591('0x84'))][(_0xc591('0x85'))]('no\x20available\x20attributes');}_0x1caa4b=_[_0xc591('0x88')](_[_0xc591('0x33')](_0x1d4f98),[_0xc591('0x89'),_0xc591('0x87'),_0xc591('0x8a'),_0xc591('0xc4')]);if(_0x31e8c4[_0xc591('0x4c')]['id']){delete _0x31e8c4[_0xc591('0x4c')]['id'];}if(_[_0xc591('0x70')](_0x31e8c4[_0xc591('0x4c')][_0xc591('0x8b')])){throw _0x6779d1['status'](0x1f4)[_0xc591('0x2e')](new db[(_0xc591('0x84'))][(_0xc591('0x85'))](_0xc591('0xc5')));}if(_[_0xc591('0x70')](_0x31e8c4[_0xc591('0x4c')][_0xc591('0x4c')])||_0x31e8c4[_0xc591('0x4c')][_0xc591('0x4c')]===''){throw _0x6779d1[_0xc591('0x24')](0x1f4)[_0xc591('0x2e')](new db[(_0xc591('0x84'))][(_0xc591('0x85'))](_0xc591('0x8c')));}if(_[_0xc591('0x70')](_0x31e8c4[_0xc591('0x4c')][_0xc591('0xc6')])){throw _0x6779d1['status'](0x1f4)[_0xc591('0x2e')](new db['Sequelize'][(_0xc591('0x85'))](_0xc591('0xc7')+_0x1caa4b));}if(!_[_0xc591('0xc8')](_0x1caa4b,_0x31e8c4[_0xc591('0x4c')][_0xc591('0xc6')])){throw _0x6779d1[_0xc591('0x24')](0x1f4)['send'](new db[(_0xc591('0x84'))]['ValidationError'](_0xc591('0xc9')+_0x1caa4b));}_0x1d7ec4[_0x31e8c4[_0xc591('0x4c')]['mapKeyOffline']]=_0x31e8c4[_0xc591('0x4c')][_0xc591('0x8b')];})[_0xc591('0x13')](function(){return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x31e8c4['params']['id']},'include':[{'model':db[_0xc591('0x90')],'as':'List'},{'model':db[_0xc591('0xca')],'as':_0xc591('0xca')}]});})[_0xc591('0x13')](handleEntityNotFound(_0x6779d1,null))[_0xc591('0x13')](function(_0x16e440){if(_0x16e440&&_0x16e440['List']){_0x404d81=_0x16e440;var _0xb857a7=_[_0xc591('0x8')](_0x31e8c4[_0xc591('0x4c')],{'firstName':_0x31e8c4['body'][_0xc591('0x8b')],'phone':_0x31e8c4[_0xc591('0x4c')]['from'],'ListId':_0x16e440[_0xc591('0xc4')]});_0xb857a7[_0x31e8c4['body'][_0xc591('0xc6')]]=_0x31e8c4[_0xc591('0x4c')]['from'];return db['CmContact']['findOrCreate']({'where':_0x1d7ec4,'defaults':_0xb857a7});}})[_0xc591('0xb2')](function(_0x4a14e0){if(_0x4a14e0){_0x5a00f7=_0x4a14e0;var _0x1d34d5=fs[_0xc591('0xcb')](path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0xcc')),_0xc591('0xcd'));var _0x3bac61=ejs['render'](_0x1d34d5,{'body':_[_0xc591('0xce')](_0x31e8c4[_0xc591('0x4c')][_0xc591('0x4c')]),'bodyTitle':_0x404d81['offlineMessageBody']});return db[_0xc591('0xcf')][_0xc591('0x4b')]({'body':_0x3bac61,'plainBody':htmlToText['fromString'](_0x3bac61),'ContactId':_0x4a14e0['id'],'ChatWebsiteId':_0x404d81['id']});}})['then'](function(_0x4d638d){_0xb2907b=_0x4d638d;if(_0x4dae99['length']){var _0x277570=_0x4dae99[_0xc591('0x60')](function(_0x1e8bbe){return{'name':_0x1e8bbe[_0xc591('0xd0')],'basename':_0x1e8bbe[_0xc591('0x66')],'type':_0x1e8bbe[_0xc591('0xd1')],'ChatOfflineMessageId':_0x4d638d['id']};});_0x535daf=_0x277570[_0xc591('0x60')](_0x2d7033=>{var _0x1d630d={'filename':_0x2d7033[_0xc591('0x2d')],'path':path[_0xc591('0x6d')](config[_0xc591('0x73')],_0xc591('0xd2'),_0xc591('0xd3'),_0xc591('0xd4'),'offline-chat',_0x2d7033['basename'])};return _0x1d630d;});if(!_0x404d81[_0xc591('0xd5')]){return db[_0xc591('0xd6')][_0xc591('0xd7')](function(_0x361765){return db[_0xc591('0xd8')][_0xc591('0xd9')](_0x277570,{'transaction':_0x361765});});}}})[_0xc591('0x13')](function(){if(_0xb2907b){_0x4003be=_0xb2907b;return db['MailAccount'][_0xc591('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0xc591('0xda')],'as':_0xc591('0xdb'),'raw':!![],'include':[{'model':db[_0xc591('0xdc')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xc591('0x13')](function(_0x2820f3){if(_0x2820f3&&_0x2820f3['Smtp']&&_0x404d81['forwardOffline']&&_0x404d81['forwardOfflineAddress']){var _0x520457=_0x2820f3[_0xc591('0xdd')]();return respondWithRpcPromise(_0xc591('0xde'),'sendMail',{'account':_0x520457,'message':{'from':util[_0xc591('0xa7')](_0xc591('0xdf'),_0x2820f3['name'],_0x2820f3[_0xc591('0xe0')]||_0x2820f3[_0xc591('0xdb')][_0xc591('0x4d')]),'to':_0x404d81['forwardOfflineAddress'],'subject':_0x404d81['offlineMessageSubject'],'html':_0x4003be['body'],'attachments':_0x535daf}},client9003)[_0xc591('0x13')](function(){return _0x4003be;})[_0xc591('0x1d')](function(_0x3fb6d3){logger['error'](_0x3fb6d3);});}})[_0xc591('0x13')](function(){if(_0x404d81&&_0x404d81['openNewInteraction']&&_0x404d81[_0xc591('0xe1')]){var _0x29d080=[];if(_0x4dae99[_0xc591('0x39')]){_0x29d080=_0x4dae99['map'](function(_0x100959){return{'name':_0x100959[_0xc591('0xd0')],'basename':_0x100959[_0xc591('0x66')],'type':_0x100959['mimetype'],'ChatOfflineMessageId':_0xb2907b['id']};});}var _0x5d0cfa;if(!_[_0xc591('0x70')](_0x404d81[_0xc591('0xe2')])){var _0xaa77e8=_[_0xc591('0x60')](_0x31e8c4[_0xc591('0x4c')],function(_0xa6087c){return _0xa6087c;});var _0x2581dc=_[_0xc591('0xe3')](_0xaa77e8)[0x0];var _0x110ce6=_[_0xc591('0xe4')](_0x2581dc,function(_0x832cf8){return _0x832cf8;});_0x5d0cfa=_0x110ce6[0x1][_0x404d81[_0xc591('0xe2')]];}var _0xb2f53d={'from':_0x5a00f7[_0xc591('0xe0')],'firstName':_0x5a00f7[_0xc591('0xa2')],'lastName':_0x5a00f7[_0xc591('0xa3')],'mapKey':_0xc591('0xe0'),'message':{'from':_0x5a00f7[_0xc591('0xe0')],'to':_0x404d81[_0xc591('0xca')]['email'],'cc':'','subject':_[_0xc591('0x70')](_0x5d0cfa)?_0x404d81[_0xc591('0xe5')]:_0x5d0cfa,'messageId':'','sentAt':new Date(),'attach':_0x29d080[_0xc591('0x39')],'attachments':_0x29d080,'originChannel':'Chat','ChatWebsiteId':_0x404d81['id'],'ChatOfflineMessageId':_0x4003be['id'],'originTo':_0x404d81[_0xc591('0xca')][_0xc591('0xe0')]},'body':_0x4003be[_0xc591('0x4c')]};var _0x4a3498={'account':{'id':_0x404d81['MailAccountId']},'body':_0xb2f53d,'log':_0xc591('0xe6')};return respondWithRpcPromise(_0xc591('0xe6'),_0xc591('0xe7'),_0x4a3498,client9001)[_0xc591('0x13')](function(){return _0x4003be;})['catch'](function(_0x40e54d){logger[_0xc591('0x18')](_0x40e54d);});}return;})['then'](function(){if(_0x4003be){return _0x4003be;}})[_0xc591('0x13')](respondWithResult(_0x6779d1,null))['catch'](function(_0x2b8552){logger[_0xc591('0x18')]('catch',_0x2b8552);for(var _0x101460 of _0x4dae99){var _0x17f018=path[_0xc591('0x6d')](config['root'],_0xc591('0xd2'),_0xc591('0xd3'),'attachments',_0xc591('0xe8'),_0x101460['filename']);fs_extra['remove'](_0x17f018)['catch'](function(_0x1f77d2){logger[_0xc591('0x18')]('Could\x20not\x20remove\x20attachment\x20file',_0x17f018,_0x1f77d2);});}});};exports[_0xc591('0xe9')]=function(_0x8bc27c,_0x5c0647){return db[_0xc591('0xae')][_0xc591('0x55')]({'where':{'id':_0x8bc27c[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c0647,null))[_0xc591('0x13')](function(_0x36e7ee){if(_0x36e7ee){return _0x36e7ee[_0xc591('0xe9')](_0x8bc27c[_0xc591('0x4c')][_0xc591('0x63')],_[_0xc591('0xea')](_0x8bc27c['body'],[_0xc591('0x63'),'id'])||{});}})['then'](respondWithResult(_0x5c0647,null))[_0xc591('0x1d')](handleError(_0x5c0647,null));};exports[_0xc591('0xeb')]=function(_0x1f866f,_0x71fbc){var _0x50cd70={'raw':![],'where':{}};var _0x325890={};var _0x10b77a={'count':0x0,'rows':[]};return db[_0xc591('0x44')]['findOne']({'where':{'id':_0x1f866f['params']['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x71fbc,null))[_0xc591('0x13')](function(_0x2fe4ae){if(_0x2fe4ae){_0x325890['model']=_['keys'](db[_0xc591('0xae')]['rawAttributes']);_0x325890[_0xc591('0x32')]=_[_0xc591('0x33')](_0x1f866f[_0xc591('0x32')]);_0x325890['filters']=_[_0xc591('0x35')](_0x325890['model'],_0x325890[_0xc591('0x32')]);_0x50cd70[_0xc591('0x38')]=_[_0xc591('0x35')](_0x325890['model'],qs['fields'](_0x1f866f[_0xc591('0x32')][_0xc591('0x37')]));_0x50cd70[_0xc591('0x38')]=_0x50cd70[_0xc591('0x38')][_0xc591('0x39')]?_0x50cd70[_0xc591('0x38')]:_0x325890[_0xc591('0x36')];if(!_0x1f866f['query']['hasOwnProperty']('nolimit')){_0x50cd70[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x1f866f[_0xc591('0x32')][_0xc591('0x21')]);_0x50cd70['offset']=qs[_0xc591('0x20')](_0x1f866f[_0xc591('0x32')][_0xc591('0x20')]);}_0x50cd70[_0xc591('0x3c')]=qs[_0xc591('0x3d')](_0x1f866f[_0xc591('0x32')]['sort']);_0x50cd70['where']=qs[_0xc591('0x34')](_['pick'](_0x1f866f[_0xc591('0x32')],_0x325890['filters']));_0x50cd70[_0xc591('0x3e')][_0xc591('0x59')]=_0x2fe4ae['id'];if(_0x1f866f[_0xc591('0x32')]['filter']){_0x50cd70[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x50cd70['where'],{'$or':_[_0xc591('0x60')](_0x50cd70[_0xc591('0x38')],function(_0x50bce3){var _0x476de6={};_0x476de6[_0x50bce3]={'$like':'%'+_0x1f866f[_0xc591('0x32')][_0xc591('0x42')]+'%'};return _0x476de6;})});}_0x50cd70=_[_0xc591('0x40')]({},_0x50cd70,_0x1f866f[_0xc591('0x43')]);return db[_0xc591('0xae')][_0xc591('0x23')]({'where':_0x50cd70[_0xc591('0x3e')]})[_0xc591('0x13')](function(_0x189652){_0x10b77a[_0xc591('0x23')]=_0x189652;if(_0x1f866f['query'][_0xc591('0x45')]){_0x50cd70['include']=[{'model':db[_0xc591('0x9b')],'as':_0xc591('0xec'),'required':![]},{'model':db[_0xc591('0xbe')],'as':_0xc591('0xed'),'attributes':[_0xc591('0x2d'),_0xc591('0xee'),_0xc591('0xef')],'required':![]},{'model':db[_0xc591('0xf0')],'as':_0xc591('0xf1'),'attributes':['id',_0xc591('0x2d'),_0xc591('0xf2')],'where':_0x1f866f[_0xc591('0x32')][_0xc591('0xf3')]?{'id':_0x1f866f[_0xc591('0x32')][_0xc591('0xf3')]}:undefined,'required':_0x1f866f[_0xc591('0x32')][_0xc591('0xf3')]?!![]:![]}];}return db[_0xc591('0xae')][_0xc591('0x47')](_0x50cd70);})['then'](function(_0x256655){_0x10b77a['rows']=_0x256655;return _0x10b77a;});}})[_0xc591('0x13')](respondWithFilteredResult(_0x71fbc,_0x50cd70))[_0xc591('0x1d')](handleError(_0x71fbc,null));};function iftimePromise(_0x102bf6,_0x241496){return respondWithRpcPromise(_0xc591('0xf4'),'getSnippet',{'command':_0x241496[_0xc591('0xf5')]?util[_0xc591('0xa7')](_0xc591('0xf6'),_0x102bf6[_0xc591('0xf7')],_0x241496['timezone']):util[_0xc591('0xa7')](_0xc591('0xf8'),_0x102bf6[_0xc591('0xf7')])},client9002)['then'](function(_0x55f9e1){var _0xcd512f=_0x55f9e1&&_0x55f9e1[_0xc591('0xf9')](_0xc591('0xfa'))>=0x0?!![]:![];logger[_0xc591('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x241496['id'],_0x102bf6['id'],_0x102bf6['interval'],_0xcd512f?'ONLINE':_0xc591('0xfb'),_0x241496['timezone']?_0x241496['timezone']:_0xc591('0xfc'));return _0xcd512f;})[_0xc591('0x1d')](function(_0x5240e2){logger['error'](_0xc591('0xfd'),_0x241496['id'],_0x102bf6['id'],_0x102bf6[_0xc591('0xf7')],util[_0xc591('0xfe')](_0x5240e2,{'showHidden':![],'depth':null}),_0x241496[_0xc591('0xf5')]?_0x241496[_0xc591('0xf5')]:_0xc591('0xfc'));return![];});}exports[_0xc591('0xff')]=function(_0x10e919,_0x4dc6ab){var _0x5cfe69=0x0;var _0x4f3ba3=0x0;var _0x27e647=![];var _0x29c91f;var _0x31a6d2;return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x10e919['params']['id']},'include':[{'model':db['Interval'],'as':_0xc591('0x100'),'include':[{'model':db['Interval'],'as':_0xc591('0x101'),'attributes':['id',_0xc591('0xf7')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4dc6ab,null))[_0xc591('0x13')](function(_0xe8266a){if(_0xe8266a){_0x29c91f=_0xe8266a;return _0xe8266a[_0xc591('0x102')]({'raw':!![]});}})[_0xc591('0x13')](function(_0x3f76f4){if(_0x29c91f){if(_0x3f76f4){_0x31a6d2=_0x3f76f4;}}return require(_0xc591('0x103'))[_0xc591('0x6f')]();})['then'](function(_0xe496cd){if(_0xe496cd){_0x4f3ba3=_0xe496cd[_0xc591('0x104')];_0x27e647=_0xe496cd[_0xc591('0x105')];}})[_0xc591('0x13')](function(){return db['ChatInteraction'][_0xc591('0x23')]({'where':{'closed':![]}});})['then'](function(_0x4385dc){_0x5cfe69=_0x4385dc;if(_0x4f3ba3&&_0x4385dc>_0x4f3ba3){return db[_0xc591('0x106')][_0xc591('0x5b')]({'where':{'id':0x1}})[_0xc591('0x13')](function(_0x5d7368){if(_0x5d7368){_0x5d7368[_0xc591('0x107')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x29c91f[_0xc591('0x100')]&&_0x29c91f[_0xc591('0x100')][_0xc591('0x101')]){var _0x18cbe0=[];for(var _0x581a78=0x0;_0x581a78<_0x29c91f[_0xc591('0x100')][_0xc591('0x101')][_0xc591('0x39')];_0x581a78++){var _0x3d9985=_0x29c91f[_0xc591('0x100')][_0xc591('0x101')][_0x581a78][_0xc591('0x28')]({'plain':!![]});_0x18cbe0[_0xc591('0xb7')](iftimePromise(_0x3d9985,_0x29c91f));}return BPromise[_0xc591('0x108')](_0x18cbe0)[_0xc591('0x13')](function(_0x173c16){return _[_0xc591('0x109')](_0x173c16);});}else{return!![];}})[_0xc591('0x13')](function(_0x2e047a){var _0x1521f7=fs[_0xc591('0xcb')](path[_0xc591('0x6d')](config[_0xc591('0x73')],'server/files/chat/iframe.ejs'),_0xc591('0xcd'));var _0x3d9c0e={'remote':_0x29c91f['remote'],'query':querystring['stringify'](_[_0xc591('0x40')](_0x29c91f['get']({'plain':!![]}),{'customerIp':_0x10e919['headers'][_0xc591('0x9f')]||_0x10e919[_0xc591('0x9d')][_0xc591('0x10a')]||_0x10e919[_0xc591('0x10b')][_0xc591('0x10c')]||_0x10e919['ip'],'referer':_0x10e919['headers'][_0xc591('0x10d')],'openedInteractions':_0x5cfe69,'maxInteractions':_0x4f3ba3,'virtual':_0x27e647[_0xc591('0x104')],'online':_0x2e047a,'custom':_0x27e647}))[_0xc591('0x10e')](/'/g,'\x5c\x27')};_0x4dc6ab[_0xc591('0x2e')](ejs[_0xc591('0x10f')](Mustache[_0xc591('0x10f')](_0x1521f7,_0x3d9c0e),{'proactiveActions':_0x31a6d2,'alignment':_0x29c91f['alignment'],'verticalAlignment':_0x29c91f[_0xc591('0x110')],'div_color':_0x29c91f[_0xc591('0xf2')],'labelText':_0x29c91f['labelText'],'text_color':_0x29c91f[_0xc591('0x111')],'text_button_color':_0x29c91f[_0xc591('0x112')],'button_color':_0x29c91f[_0xc591('0x113')],'background_color':_0x29c91f[_0xc591('0x114')],'hideWhenOffline':_0x29c91f[_0xc591('0x115')],'interval':_0x29c91f[_0xc591('0x116')]}));})[_0xc591('0x1d')](handleError(_0x4dc6ab,null));};exports[_0xc591('0x117')]=function(_0x5eddbc,_0x4e419f){var _0x54986b=_0x5eddbc['params']['id'];var _0x1496ef=_0x5eddbc[_0xc591('0x4c')];var _0x238ebd=0xc8;var _0x9671d0=null;return db[_0xc591('0xd6')][_0xc591('0xd7')]({'isolationLevel':db[_0xc591('0xd6')][_0xc591('0x118')][_0xc591('0x119')][_0xc591('0x11a')]},function(_0x4993a8){return db[_0xc591('0x44')][_0xc591('0x5b')]({'where':{'id':_0x54986b},'transaction':_0x4993a8})[_0xc591('0x13')](function(_0x1fcb11){if(_0x1fcb11){return db[_0xc591('0x92')]['destroy']({'where':{'ChatWebsiteId':_0x54986b},'transaction':_0x4993a8})['then'](function(){var _0x2d89a1=_['map'](_0x1496ef,function(_0x57094a){_0x57094a[_0xc591('0x59')]=_0x54986b;return _0x57094a;});return db[_0xc591('0x92')][_0xc591('0xd9')](_0x2d89a1,{'transaction':_0x4993a8});});}else{_0x238ebd=0x194;_0x9671d0=[];}});})[_0xc591('0x13')](function(){if(_0x238ebd!==0x194){return db['ChatApplication'][_0xc591('0x11b')]({'where':{'ChatWebsiteId':_0x54986b},'order':_0xc591('0x11c')})[_0xc591('0x13')](function(_0x19b92b){_0x9671d0=_0x19b92b;});}})[_0xc591('0x1d')](function(_0x2d1cf9){_0x238ebd=0x1f4;logger[_0xc591('0x18')](_0x2d1cf9[_0xc591('0x2c')]);if(_0x2d1cf9[_0xc591('0x2d')]){delete _0x2d1cf9[_0xc591('0x2d')];}_0x9671d0=_0x2d1cf9;})[_0xc591('0x11d')](function(){if(_0x9671d0===null){_0x4e419f[_0xc591('0x2b')](_0x238ebd);}else{if(_0x238ebd===0x1f4){_0x4e419f[_0xc591('0x24')](_0x238ebd)[_0xc591('0x2e')](_0x9671d0);}else{_0x4e419f['status'](_0x238ebd)[_0xc591('0x1f')](_0x9671d0);}}});};exports['getApplications']=function(_0x3760b8,_0xc9023d){var _0x5f44ce={};var _0x40927d={};var _0xd6b6ff;var _0x24adfe;return db[_0xc591('0x44')][_0xc591('0x5b')]({'where':{'id':_0x3760b8[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0xc9023d,null))[_0xc591('0x13')](function(_0xcfd3){if(_0xcfd3){_0xd6b6ff=_0xcfd3;_0x40927d[_0xc591('0x36')]=_[_0xc591('0x33')](db[_0xc591('0x92')][_0xc591('0x2f')]);_0x40927d[_0xc591('0x32')]=_['keys'](_0x3760b8[_0xc591('0x32')]);_0x40927d['filters']=_[_0xc591('0x35')](_0x40927d[_0xc591('0x36')],_0x40927d[_0xc591('0x32')]);_0x5f44ce[_0xc591('0x38')]=_['intersection'](_0x40927d[_0xc591('0x36')],qs[_0xc591('0x37')](_0x3760b8[_0xc591('0x32')][_0xc591('0x37')]));_0x5f44ce['attributes']=_0x5f44ce[_0xc591('0x38')][_0xc591('0x39')]?_0x5f44ce[_0xc591('0x38')]:_0x40927d['model'];_0x5f44ce[_0xc591('0x3c')]=qs[_0xc591('0x3d')](_0x3760b8['query'][_0xc591('0x3d')]);_0x5f44ce[_0xc591('0x3e')]=qs[_0xc591('0x34')](_[_0xc591('0x3f')](_0x3760b8[_0xc591('0x32')],_0x40927d[_0xc591('0x34')]));if(_0x3760b8['query'][_0xc591('0x42')]){_0x5f44ce[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x5f44ce[_0xc591('0x3e')],{'$or':_[_0xc591('0x60')](_0x5f44ce['attributes'],function(_0x240e25){var _0x592e5c={};_0x592e5c[_0x240e25]={'$like':'%'+_0x3760b8[_0xc591('0x32')][_0xc591('0x42')]+'%'};return _0x592e5c;})});}_0x5f44ce=_['merge']({},_0x5f44ce,_0x3760b8[_0xc591('0x43')]);return _0xd6b6ff[_0xc591('0x11e')](_0x5f44ce);}})['then'](function(_0x314ca6){if(_0x314ca6){_0x24adfe=_0x314ca6[_0xc591('0x39')];if(!_0x3760b8[_0xc591('0x32')][_0xc591('0x3a')]('nolimit')){_0x5f44ce[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x3760b8[_0xc591('0x32')][_0xc591('0x21')]);_0x5f44ce[_0xc591('0x20')]=qs[_0xc591('0x20')](_0x3760b8[_0xc591('0x32')]['offset']);}return _0xd6b6ff[_0xc591('0x11e')](_0x5f44ce);}})['then'](function(_0x87ffe5){if(_0x87ffe5){return _0x87ffe5?{'count':_0x24adfe,'rows':_0x87ffe5}:null;}})[_0xc591('0x13')](respondWithResult(_0xc9023d,null))[_0xc591('0x1d')](handleError(_0xc9023d,null));};exports['addProactiveActions']=function(_0xac9686,_0x13871f){return db[_0xc591('0x11f')][_0xc591('0x55')]({'where':{'id':_0xac9686[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x13871f,null))[_0xc591('0x13')](function(_0x332455){if(_0x332455){return _0x332455['addProactiveActions'](_0xac9686[_0xc591('0x4c')][_0xc591('0x63')],_[_0xc591('0xea')](_0xac9686[_0xc591('0x4c')],[_0xc591('0x63'),'id'])||{});}})[_0xc591('0x13')](respondWithResult(_0x13871f,null))['catch'](handleError(_0x13871f,null));};exports['getProactiveActions']=function(_0x308c12,_0x1b06bc){var _0x3bb91a={};var _0x593c12={};var _0x5ad424;var _0xd615f9;return db[_0xc591('0x44')][_0xc591('0x5b')]({'where':{'id':_0x308c12[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x1b06bc,null))[_0xc591('0x13')](function(_0x31f816){if(_0x31f816){_0x5ad424=_0x31f816;_0x593c12['model']=_['keys'](db[_0xc591('0x120')][_0xc591('0x2f')]);_0x593c12['query']=_['keys'](_0x308c12[_0xc591('0x32')]);_0x593c12['filters']=_['intersection'](_0x593c12[_0xc591('0x36')],_0x593c12[_0xc591('0x32')]);_0x3bb91a[_0xc591('0x38')]=_[_0xc591('0x35')](_0x593c12[_0xc591('0x36')],qs[_0xc591('0x37')](_0x308c12[_0xc591('0x32')][_0xc591('0x37')]));_0x3bb91a[_0xc591('0x38')]=_0x3bb91a['attributes'][_0xc591('0x39')]?_0x3bb91a[_0xc591('0x38')]:_0x593c12['model'];_0x3bb91a[_0xc591('0x3c')]=qs[_0xc591('0x3d')](_0x308c12[_0xc591('0x32')]['sort']);_0x3bb91a[_0xc591('0x3e')]=qs[_0xc591('0x34')](_[_0xc591('0x3f')](_0x308c12[_0xc591('0x32')],_0x593c12[_0xc591('0x34')]));if(_0x308c12['query'][_0xc591('0x42')]){_0x3bb91a[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x3bb91a[_0xc591('0x3e')],{'$or':_['map'](_0x3bb91a[_0xc591('0x38')],function(_0x2548ad){var _0x4d530d={};_0x4d530d[_0x2548ad]={'$like':'%'+_0x308c12[_0xc591('0x32')][_0xc591('0x42')]+'%'};return _0x4d530d;})});}_0x3bb91a=_[_0xc591('0x40')]({},_0x3bb91a,_0x308c12[_0xc591('0x43')]);return _0x5ad424['getProactiveActions'](_0x3bb91a);}})['then'](function(_0x27c0a9){if(_0x27c0a9){_0xd615f9=_0x27c0a9[_0xc591('0x39')];if(!_0x308c12['query']['hasOwnProperty'](_0xc591('0x3b'))){_0x3bb91a[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x308c12['query'][_0xc591('0x21')]);_0x3bb91a[_0xc591('0x20')]=qs[_0xc591('0x20')](_0x308c12[_0xc591('0x32')]['offset']);}return _0x5ad424['getProactiveActions'](_0x3bb91a);}})[_0xc591('0x13')](function(_0x232c15){if(_0x232c15){return _0x232c15?{'count':_0xd615f9,'rows':_0x232c15}:null;}})[_0xc591('0x13')](respondWithResult(_0x1b06bc,null))['catch'](handleError(_0x1b06bc,null));};exports['getFields']=function(_0x10967b,_0x2ac2a7){var _0x3424f6=_0x10967b['query'][_0xc591('0x121')]===_0xc591('0x122')?_0xc591('0x123'):_0xc591('0x124');return db['ChatWebsite']['find']({'attributes':['id',_0x3424f6],'where':{'id':_0x10967b[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x2ac2a7,null))[_0xc591('0x13')](function(_0x35932b){if(_0x35932b){var _0x490411=_0x35932b[_0x3424f6];var _0x2abe6a=_0x490411&&_0x490411[_0xc591('0x125')]?_0x490411[_0xc591('0x125')]:[];_0x2ac2a7[_0xc591('0x2e')]({'fromKey':_[_0xc591('0x70')](_0x490411[_0xc591('0x126')])?undefined:_0x490411[_0xc591('0x126')],'count':_0x2abe6a[_0xc591('0x39')],'rows':_0x2abe6a});}})[_0xc591('0x1d')](handleError(_0x2ac2a7,null));};exports[_0xc591('0x127')]=function(_0x3664fc,_0x5a7c29){var _0x30b7c4={'raw':![],'where':{}};var _0x2b7902={};var _0x3685b5={'count':0x0,'rows':[]};return db[_0xc591('0x44')][_0xc591('0x5b')]({'where':{'id':_0x3664fc[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a7c29,null))['then'](function(_0x59c7f8){if(_0x59c7f8){_0x2b7902[_0xc591('0x36')]=_['keys'](db[_0xc591('0xcf')]['rawAttributes']);_0x2b7902['query']=_['keys'](_0x3664fc[_0xc591('0x32')]);_0x2b7902[_0xc591('0x34')]=_[_0xc591('0x35')](_0x2b7902[_0xc591('0x36')],_0x2b7902[_0xc591('0x32')]);_0x30b7c4['attributes']=_[_0xc591('0x35')](_0x2b7902[_0xc591('0x36')],qs[_0xc591('0x37')](_0x3664fc[_0xc591('0x32')][_0xc591('0x37')]));_0x30b7c4[_0xc591('0x38')]=_0x30b7c4['attributes'][_0xc591('0x39')]?_0x30b7c4['attributes']:_0x2b7902['model'];if(!_0x3664fc[_0xc591('0x32')][_0xc591('0x3a')]('nolimit')){_0x30b7c4[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x3664fc[_0xc591('0x32')]['limit']);_0x30b7c4[_0xc591('0x20')]=qs[_0xc591('0x20')](_0x3664fc['query'][_0xc591('0x20')]);}_0x30b7c4[_0xc591('0x3c')]=qs['sort'](_0x3664fc[_0xc591('0x32')][_0xc591('0x3d')]);_0x30b7c4[_0xc591('0x3e')]=qs[_0xc591('0x34')](_[_0xc591('0x3f')](_0x3664fc[_0xc591('0x32')],_0x2b7902[_0xc591('0x34')]));_0x30b7c4[_0xc591('0x3e')]['ChatWebsiteId']=_0x59c7f8['id'];if(_0x3664fc[_0xc591('0x32')]['filter']){_0x30b7c4[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x30b7c4[_0xc591('0x3e')],{'$or':_[_0xc591('0x60')](_0x30b7c4[_0xc591('0x38')],function(_0x3a9bc2){var _0x3df9d8={};_0x3df9d8[_0x3a9bc2]={'$like':'%'+_0x3664fc[_0xc591('0x32')]['filter']+'%'};return _0x3df9d8;})});}_0x30b7c4=_['merge']({},_0x30b7c4,_0x3664fc[_0xc591('0x43')]);return db[_0xc591('0xcf')][_0xc591('0x23')]({'where':_0x30b7c4[_0xc591('0x3e')]})[_0xc591('0x13')](function(_0x44d883){_0x3685b5[_0xc591('0x23')]=_0x44d883;if(_0x3664fc[_0xc591('0x32')][_0xc591('0x45')]){_0x30b7c4['include']=[{'all':!![]}];}else{_0x30b7c4['include']=[{'model':db[_0xc591('0x9b')],'as':'Contact','required':![]},{'model':db[_0xc591('0xd8')],'as':_0xc591('0x128'),'required':![]}];}return db[_0xc591('0xcf')][_0xc591('0x47')](_0x30b7c4);})[_0xc591('0x13')](function(_0x5c05c2){_0x3685b5['rows']=_0x5c05c2;return _0x3685b5;});}})['then'](respondWithFilteredResult(_0x5a7c29,_0x30b7c4))[_0xc591('0x1d')](handleError(_0x5a7c29,null));};exports[_0xc591('0x129')]=function(_0x5cafbc,_0x4b28cb){return db['ChatWebsite'][_0xc591('0x55')]({'where':{'id':_0x5cafbc['params']['id']}})['then'](handleEntityNotFound(_0x4b28cb,null))[_0xc591('0x13')](function(_0x381165){if(_0x381165){return _0x381165[_0xc591('0x129')](_0x5cafbc[_0xc591('0x4c')][_0xc591('0x63')],_['omit'](_0x5cafbc[_0xc591('0x4c')],[_0xc591('0x63'),'id'])||{})[_0xc591('0xb2')](function(_0x294229){for(var _0x30beec=0x0;_0x30beec<_0x5cafbc[_0xc591('0x4c')][_0xc591('0x63')][_0xc591('0x39')];_0x30beec+=0x1){socket[_0xc591('0x12a')](_0xc591('0x12b'),{'UserId':Number(_0x5cafbc['body'][_0xc591('0x63')][_0x30beec]),'ChatWebsiteId':Number(_0x5cafbc['params']['id'])});}return _0x294229;});}})[_0xc591('0x13')](respondWithResult(_0x4b28cb,null))[_0xc591('0x1d')](handleError(_0x4b28cb,null));};exports[_0xc591('0x12c')]=function(_0x22fbda,_0x4e3c4b){return db[_0xc591('0x44')][_0xc591('0x55')]({'where':{'id':_0x22fbda[_0xc591('0x57')]['id']}})[_0xc591('0x13')](handleEntityNotFound(_0x4e3c4b,null))[_0xc591('0x13')](function(_0x181b12){if(_0x181b12){return _0x181b12[_0xc591('0x12c')](_0x22fbda[_0xc591('0x32')][_0xc591('0x63')])['then'](function(){if(_[_0xc591('0x12d')](_0x22fbda['query'][_0xc591('0x63')])){for(var _0x494694=0x0;_0x494694<_0x22fbda[_0xc591('0x32')][_0xc591('0x63')][_0xc591('0x39')];_0x494694+=0x1){socket[_0xc591('0x12a')](_0xc591('0x12e'),{'UserId':Number(_0x22fbda[_0xc591('0x32')]['ids'][_0x494694]),'ChatWebsiteId':Number(_0x22fbda[_0xc591('0x57')]['id'])});}}else{socket[_0xc591('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x22fbda[_0xc591('0x32')][_0xc591('0x63')]),'ChatWebsiteId':Number(_0x22fbda[_0xc591('0x57')]['id'])});}});}})[_0xc591('0x13')](respondWithStatusCode(_0x4e3c4b,null))[_0xc591('0x1d')](handleError(_0x4e3c4b,null));};exports[_0xc591('0x12f')]=function(_0x994470,_0x274311){var _0x2378cc={};var _0x4aac0c={};var _0x35c840;var _0x232421;return db[_0xc591('0x44')]['findOne']({'where':{'id':_0x994470[_0xc591('0x57')]['id']}})['then'](handleEntityNotFound(_0x274311,null))[_0xc591('0x13')](function(_0x2d539a){if(_0x2d539a){_0x35c840=_0x2d539a;_0x4aac0c['model']=_['keys'](db[_0xc591('0xbe')]['rawAttributes']);_0x4aac0c['query']=_['keys'](_0x994470['query']);_0x4aac0c[_0xc591('0x34')]=_[_0xc591('0x35')](_0x4aac0c[_0xc591('0x36')],_0x4aac0c['query']);_0x2378cc['attributes']=_[_0xc591('0x35')](_0x4aac0c['model'],qs['fields'](_0x994470['query'][_0xc591('0x37')]));_0x2378cc['attributes']=_0x2378cc[_0xc591('0x38')]['length']?_0x2378cc[_0xc591('0x38')]:_0x4aac0c[_0xc591('0x36')];_0x2378cc[_0xc591('0x3c')]=qs['sort'](_0x994470[_0xc591('0x32')][_0xc591('0x3d')]);_0x2378cc[_0xc591('0x3e')]=qs[_0xc591('0x34')](_['pick'](_0x994470['query'],_0x4aac0c['filters']));if(_0x994470[_0xc591('0x32')]['filter']){_0x2378cc[_0xc591('0x3e')]=_[_0xc591('0x40')](_0x2378cc[_0xc591('0x3e')],{'$or':_['map'](_0x2378cc[_0xc591('0x38')],function(_0x157455){var _0x351f12={};_0x351f12[_0x157455]={'$like':'%'+_0x994470[_0xc591('0x32')][_0xc591('0x42')]+'%'};return _0x351f12;})});}_0x2378cc=_[_0xc591('0x40')]({},_0x2378cc,_0x994470[_0xc591('0x43')]);return _0x35c840[_0xc591('0x12f')](_0x2378cc);}})['then'](function(_0x531d92){if(_0x531d92){_0x232421=_0x531d92[_0xc591('0x39')];if(!_0x994470[_0xc591('0x32')][_0xc591('0x3a')](_0xc591('0x3b'))){_0x2378cc[_0xc591('0x21')]=qs[_0xc591('0x21')](_0x994470[_0xc591('0x32')][_0xc591('0x21')]);_0x2378cc['offset']=qs[_0xc591('0x20')](_0x994470[_0xc591('0x32')][_0xc591('0x20')]);}return _0x35c840[_0xc591('0x12f')](_0x2378cc);}})[_0xc591('0x13')](function(_0x2b7201){if(_0x2b7201){return _0x2b7201?{'count':_0x232421,'rows':_0x2b7201}:null;}})[_0xc591('0x13')](respondWithResult(_0x274311,null))[_0xc591('0x1d')](handleError(_0x274311,null));}; \ No newline at end of file +var _0x9a46=['Disposition','getDispositions','findOne','rawAttributes','ChatWebsiteId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','sitepic','download','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','headers','user-agent','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','asc','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','update','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','files','no\x20available\x20attributes','send','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','User','Owner','fullname','internal','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','custom','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','omit','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','querystring','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','json','offset','undefined','limit','set','then','get','ChatWebsites','destroy','end','stack','name','status','ChatWebsite','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a46,0x1eb));var _0x69a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9a46[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x69a4('0x0'));var Mustache=require(_0x69a4('0x1'));var util=require(_0x69a4('0x2'));var path=require(_0x69a4('0x3'));var ejs=require(_0x69a4('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69a4('0x5'));var querystring=require(_0x69a4('0x6'));var Redis=require('ioredis');var qs=require(_0x69a4('0x7'));var logger=require(_0x69a4('0x8'))('api');var config=require(_0x69a4('0x9'));var db=require(_0x69a4('0xa'))['db'];config[_0x69a4('0xb')]=_[_0x69a4('0xc')](config[_0x69a4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x69a4('0xd'))(new Redis(config[_0x69a4('0xb')]));require(_0x69a4('0xe'))[_0x69a4('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x69a4('0x10'));var client=jayson['client'][_0x69a4('0x11')]({'port':0x232c});var client9002=jayson[_0x69a4('0x12')][_0x69a4('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x69a4('0x11')]({'port':0x232b});var client9001=jayson[_0x69a4('0x12')][_0x69a4('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x3c3ac2,_0x43222c,_0x53f601,_0x3a70e5){return new BPromise(function(_0x214346,_0xdfbf0a){var _0x5d5410=_0x3a70e5||client;return _0x5d5410['request'](_0x3c3ac2,_0x53f601)['then'](function(_0xaa5083){logger[_0x69a4('0x13')](_0x69a4('0x14'),_0x43222c,_0x69a4('0x15'));logger[_0x69a4('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43222c,_0x69a4('0x15'),JSON[_0x69a4('0x17')](_0xaa5083));if(_0xaa5083[_0x69a4('0x18')]){if(_0xaa5083[_0x69a4('0x18')][_0x69a4('0x19')]===0x1f4){logger[_0x69a4('0x18')](_0x69a4('0x14'),_0x43222c,_0xaa5083[_0x69a4('0x18')][_0x69a4('0x1a')]);return _0xdfbf0a(_0xaa5083[_0x69a4('0x18')][_0x69a4('0x1a')]);}logger[_0x69a4('0x18')](_0x69a4('0x14'),_0x43222c,_0xaa5083['error'][_0x69a4('0x1a')]);return _0x214346(_0xaa5083[_0x69a4('0x18')][_0x69a4('0x1a')]);}else{logger['info'](_0x69a4('0x14'),_0x43222c,_0x69a4('0x15'));_0x214346(_0xaa5083[_0x69a4('0x1b')]['message']);}})['catch'](function(_0x2ac6bf){logger[_0x69a4('0x18')](_0x69a4('0x14'),_0x43222c,_0x2ac6bf);_0xdfbf0a(_0x2ac6bf);});});}function respondWithStatusCode(_0x3eda16,_0x540446){_0x540446=_0x540446||0xcc;return function(_0xd98781){if(_0xd98781){return _0x3eda16[_0x69a4('0x1c')](_0x540446);}return _0x3eda16['status'](_0x540446)['end']();};}function respondWithResult(_0x515e57,_0x373474){_0x373474=_0x373474||0xc8;return function(_0x83d55a){if(_0x83d55a){return _0x515e57['status'](_0x373474)[_0x69a4('0x1d')](_0x83d55a);}};}function respondWithFilteredResult(_0x4e5541,_0x152a17){return function(_0x4823ea){if(_0x4823ea){var _0x53b88c=typeof _0x152a17[_0x69a4('0x1e')]===_0x69a4('0x1f')&&typeof _0x152a17[_0x69a4('0x20')]===_0x69a4('0x1f');var _0x2c3ddf=_0x4823ea['count'];var _0x2544fc=_0x53b88c?0x0:_0x152a17[_0x69a4('0x1e')];var _0x4e2c94=_0x53b88c?_0x4823ea['count']:_0x152a17[_0x69a4('0x1e')]+_0x152a17[_0x69a4('0x20')];var _0x4a9cab;if(_0x4e2c94>=_0x2c3ddf){_0x4e2c94=_0x2c3ddf;_0x4a9cab=0xc8;}else{_0x4a9cab=0xce;}_0x4e5541['status'](_0x4a9cab);return _0x4e5541[_0x69a4('0x21')]('Content-Range',_0x2544fc+'-'+_0x4e2c94+'/'+_0x2c3ddf)['json'](_0x4823ea);}return null;};}function saveUpdates(_0x3b7fe1){return function(_0x44c201){if(_0x44c201){return _0x44c201['update'](_0x3b7fe1)[_0x69a4('0x22')](function(_0x5f38ba){return _0x5f38ba;});}return null;};}function removeEntity(_0x1596b9){return function(_0x673d8b){if(_0x673d8b){return _0x673d8b['destroy']()[_0x69a4('0x22')](function(){var _0x256310=_0x673d8b[_0x69a4('0x23')]({'plain':!![]});var _0x559e89=_0x69a4('0x24');return db['UserProfileResource'][_0x69a4('0x25')]({'where':{'type':_0x559e89,'resourceId':_0x256310['id']}})[_0x69a4('0x22')](function(){return _0x673d8b;});})['then'](function(){_0x1596b9['status'](0xcc)[_0x69a4('0x26')]();});}};}function handleEntityNotFound(_0x526c6a){return function(_0x162a0d){if(!_0x162a0d){_0x526c6a[_0x69a4('0x1c')](0x194);}return _0x162a0d;};}function handleError(_0x5286ab,_0x2d8924){_0x2d8924=_0x2d8924||0x1f4;return function(_0x40a606){logger[_0x69a4('0x18')](_0x40a606[_0x69a4('0x27')]);if(_0x40a606[_0x69a4('0x28')]){delete _0x40a606[_0x69a4('0x28')];}_0x5286ab[_0x69a4('0x29')](_0x2d8924)['send'](_0x40a606);};}exports['index']=function(_0x45ab13,_0x11cc77){var _0x152e08={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x375b64={},_0x1b4402={'count':0x0,'rows':[]};var _0x2feae9=_['map'](db[_0x69a4('0x2a')]['rawAttributes'],function(_0x486847){return{'name':_0x486847[_0x69a4('0x2b')],'type':_0x486847[_0x69a4('0x2c')][_0x69a4('0x2d')]};});_0x375b64[_0x69a4('0x2e')]=_[_0x69a4('0x2f')](_0x2feae9,_0x69a4('0x28'));_0x375b64[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x45ab13[_0x69a4('0x30')]);_0x375b64['filters']=_[_0x69a4('0x32')](_0x375b64[_0x69a4('0x2e')],_0x375b64[_0x69a4('0x30')]);_0x152e08[_0x69a4('0x33')]=_[_0x69a4('0x32')](_0x375b64[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x45ab13['query'][_0x69a4('0x34')]));_0x152e08['attributes']=_0x152e08[_0x69a4('0x33')][_0x69a4('0x35')]?_0x152e08[_0x69a4('0x33')]:_0x375b64[_0x69a4('0x2e')];if(!_0x45ab13[_0x69a4('0x30')][_0x69a4('0x36')](_0x69a4('0x37'))){_0x152e08[_0x69a4('0x20')]=qs[_0x69a4('0x20')](_0x45ab13[_0x69a4('0x30')][_0x69a4('0x20')]);_0x152e08[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x45ab13[_0x69a4('0x30')][_0x69a4('0x1e')]);}_0x152e08[_0x69a4('0x38')]=qs[_0x69a4('0x39')](_0x45ab13[_0x69a4('0x30')][_0x69a4('0x39')]);_0x152e08['where']=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x45ab13[_0x69a4('0x30')],_0x375b64[_0x69a4('0x3a')]),_0x2feae9);if(_0x45ab13[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x152e08[_0x69a4('0x3d')]=_[_0x69a4('0x3e')](_0x152e08[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x2feae9,function(_0x320a88){if(_0x320a88['type']!==_0x69a4('0x3f')){var _0x40a2cc={};_0x40a2cc[_0x320a88['name']]={'$like':'%'+_0x45ab13[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x40a2cc;}})});}_0x152e08=_[_0x69a4('0x3e')]({},_0x152e08,_0x45ab13[_0x69a4('0x40')]);var _0x2c75fa={'where':_0x152e08[_0x69a4('0x3d')]};return db['ChatWebsite'][_0x69a4('0x41')](_0x2c75fa)[_0x69a4('0x22')](function(_0x2636fc){_0x1b4402[_0x69a4('0x41')]=_0x2636fc;if(_0x45ab13['query'][_0x69a4('0x42')]){_0x152e08[_0x69a4('0x43')]=[{'all':!![]}];}return db[_0x69a4('0x2a')][_0x69a4('0x44')](_0x152e08);})[_0x69a4('0x22')](function(_0x3cdd6b){_0x1b4402[_0x69a4('0x45')]=_0x3cdd6b;return _0x1b4402;})[_0x69a4('0x22')](respondWithFilteredResult(_0x11cc77,_0x152e08))[_0x69a4('0x46')](handleError(_0x11cc77,null));};exports[_0x69a4('0x47')]=function(_0x36b3b0,_0x24168c){var _0x2f4ab6={'raw':![],'where':{'id':_0x36b3b0[_0x69a4('0x48')]['id']},'include':[{'model':db['Pause'],'as':_0x69a4('0x49')}]},_0x28c693={};_0x28c693['model']=_[_0x69a4('0x31')](db['ChatWebsite']['rawAttributes']);_0x28c693[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x36b3b0[_0x69a4('0x30')]);_0x28c693[_0x69a4('0x3a')]=_['intersection'](_0x28c693[_0x69a4('0x2e')],_0x28c693[_0x69a4('0x30')]);_0x2f4ab6[_0x69a4('0x33')]=_['intersection'](_0x28c693[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x36b3b0[_0x69a4('0x30')]['fields']));_0x2f4ab6[_0x69a4('0x33')]=_0x2f4ab6[_0x69a4('0x33')][_0x69a4('0x35')]?_0x2f4ab6[_0x69a4('0x33')]:_0x28c693[_0x69a4('0x2e')];if(_0x36b3b0[_0x69a4('0x30')]['includeAll']){_0x2f4ab6[_0x69a4('0x43')]=[{'all':!![]}];}_0x2f4ab6=_[_0x69a4('0x3e')]({},_0x2f4ab6,_0x36b3b0['options']);return db['ChatWebsite'][_0x69a4('0x4a')](_0x2f4ab6)[_0x69a4('0x22')](handleEntityNotFound(_0x24168c,null))['then'](respondWithResult(_0x24168c,null))[_0x69a4('0x46')](handleError(_0x24168c,null));};exports[_0x69a4('0x4b')]=function(_0x45c301,_0x14e5ed){return db[_0x69a4('0x2a')][_0x69a4('0x4b')](_0x45c301[_0x69a4('0x4c')],{})[_0x69a4('0x22')](function(_0x5c0801){var _0x21fabd=_0x45c301[_0x69a4('0x4d')][_0x69a4('0x23')]({'plain':!![]});if(!_0x21fabd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21fabd[_0x69a4('0x4e')]===_0x69a4('0x4d')){var _0x3a2180=_0x5c0801['get']({'plain':!![]});var _0x2a98dc=_0x69a4('0x24');return db[_0x69a4('0x4f')][_0x69a4('0x4a')]({'where':{'name':_0x2a98dc,'userProfileId':_0x21fabd[_0x69a4('0x50')]},'raw':!![]})[_0x69a4('0x22')](function(_0x2e7c11){if(_0x2e7c11&&_0x2e7c11['autoAssociation']===0x0){return db[_0x69a4('0x51')][_0x69a4('0x4b')]({'name':_0x3a2180[_0x69a4('0x28')],'resourceId':_0x3a2180['id'],'type':_0x2e7c11[_0x69a4('0x28')],'sectionId':_0x2e7c11['id']},{})[_0x69a4('0x22')](function(){return _0x5c0801;});}else{return _0x5c0801;}})[_0x69a4('0x46')](function(_0x4b7ef1){logger['error'](_0x69a4('0x52'),_0x4b7ef1);throw _0x4b7ef1;});}return _0x5c0801;})[_0x69a4('0x22')](respondWithResult(_0x14e5ed,0xc9))[_0x69a4('0x46')](handleError(_0x14e5ed,null));};exports['update']=function(_0x5d960f,_0x4f6c06){if(_0x5d960f[_0x69a4('0x4c')]['id']){delete _0x5d960f[_0x69a4('0x4c')]['id'];}return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x5d960f[_0x69a4('0x48')]['id']},'include':[{'model':db['Pause'],'as':_0x69a4('0x49')}]})[_0x69a4('0x22')](handleEntityNotFound(_0x4f6c06,null))[_0x69a4('0x22')](saveUpdates(_0x5d960f['body'],null))['then'](respondWithResult(_0x4f6c06,null))[_0x69a4('0x46')](handleError(_0x4f6c06,null));};exports['destroy']=function(_0x564e0a,_0x4f0db4){return db[_0x69a4('0x2a')]['find']({'where':{'id':_0x564e0a[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x4f0db4,null))['then'](removeEntity(_0x4f0db4,null))[_0x69a4('0x46')](handleError(_0x4f0db4,null));};exports['describe']=function(_0x474b38,_0x4804e5){return db['ChatWebsite'][_0x69a4('0x53')]()[_0x69a4('0x22')](respondWithResult(_0x4804e5,null))['catch'](handleError(_0x4804e5,null));};exports[_0x69a4('0x54')]=function(_0x4de657,_0x45d6f3){if(_0x4de657[_0x69a4('0x4c')]['id']){delete _0x4de657[_0x69a4('0x4c')]['id'];}return db['ChatWebsite'][_0x69a4('0x4a')]({'where':{'id':_0x4de657[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x45d6f3,null))[_0x69a4('0x22')](function(_0x21d74b){if(_0x21d74b){_0x4de657[_0x69a4('0x4c')]['ChatWebsiteId']=_0x21d74b['id'];return db[_0x69a4('0x55')]['create'](_0x4de657[_0x69a4('0x4c')]);}})[_0x69a4('0x22')](respondWithResult(_0x45d6f3,null))[_0x69a4('0x46')](handleError(_0x45d6f3,null));};exports[_0x69a4('0x56')]=function(_0x3db15a,_0x264bdb){var _0x1c2043={'raw':![],'where':{}};var _0x57d9cf={};var _0x5e021a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x69a4('0x57')]({'where':{'id':_0x3db15a[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x264bdb,null))['then'](function(_0x5120bd){if(_0x5120bd){_0x57d9cf[_0x69a4('0x2e')]=_['keys'](db[_0x69a4('0x55')][_0x69a4('0x58')]);_0x57d9cf['query']=_['keys'](_0x3db15a[_0x69a4('0x30')]);_0x57d9cf[_0x69a4('0x3a')]=_[_0x69a4('0x32')](_0x57d9cf[_0x69a4('0x2e')],_0x57d9cf[_0x69a4('0x30')]);_0x1c2043['attributes']=_[_0x69a4('0x32')](_0x57d9cf[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x3db15a[_0x69a4('0x30')][_0x69a4('0x34')]));_0x1c2043[_0x69a4('0x33')]=_0x1c2043[_0x69a4('0x33')]['length']?_0x1c2043[_0x69a4('0x33')]:_0x57d9cf[_0x69a4('0x2e')];if(!_0x3db15a[_0x69a4('0x30')]['hasOwnProperty'](_0x69a4('0x37'))){_0x1c2043[_0x69a4('0x20')]=qs['limit'](_0x3db15a[_0x69a4('0x30')][_0x69a4('0x20')]);_0x1c2043[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x3db15a[_0x69a4('0x30')][_0x69a4('0x1e')]);}_0x1c2043[_0x69a4('0x38')]=qs['sort'](_0x3db15a[_0x69a4('0x30')][_0x69a4('0x39')]);_0x1c2043['where']=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x3db15a[_0x69a4('0x30')],_0x57d9cf['filters']));_0x1c2043[_0x69a4('0x3d')][_0x69a4('0x59')]=_0x5120bd['id'];if(_0x3db15a['query'][_0x69a4('0x3c')]){_0x1c2043[_0x69a4('0x3d')]=_[_0x69a4('0x3e')](_0x1c2043[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x1c2043[_0x69a4('0x33')],function(_0x2a270b){var _0x55befa={};_0x55befa[_0x2a270b]={'$like':'%'+_0x3db15a[_0x69a4('0x30')]['filter']+'%'};return _0x55befa;})});}_0x1c2043=_[_0x69a4('0x3e')]({},_0x1c2043,_0x3db15a['options']);return db['Disposition'][_0x69a4('0x41')]({'where':_0x1c2043[_0x69a4('0x3d')]})[_0x69a4('0x22')](function(_0x5cc763){_0x5e021a['count']=_0x5cc763;if(_0x3db15a[_0x69a4('0x30')][_0x69a4('0x42')]){_0x1c2043[_0x69a4('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x69a4('0x44')](_0x1c2043);})[_0x69a4('0x22')](function(_0x2482c9){_0x5e021a[_0x69a4('0x45')]=_0x2482c9;return _0x5e021a;});}})[_0x69a4('0x22')](respondWithFilteredResult(_0x264bdb,_0x1c2043))[_0x69a4('0x46')](handleError(_0x264bdb,null));};exports[_0x69a4('0x5a')]=function(_0x2b4728,_0x1b6138){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x2b4728[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x1b6138,null))[_0x69a4('0x22')](function(_0x130fca){if(_0x130fca){return _0x130fca[_0x69a4('0x5a')](_0x2b4728[_0x69a4('0x30')][_0x69a4('0x5b')]);}})[_0x69a4('0x22')](respondWithStatusCode(_0x1b6138,null))[_0x69a4('0x46')](handleError(_0x1b6138,null));};exports['addAnswer']=function(_0x390546,_0x49aae1){if(_0x390546[_0x69a4('0x4c')]['id']){delete _0x390546['body']['id'];}return db[_0x69a4('0x2a')]['find']({'where':{'id':_0x390546[_0x69a4('0x48')]['id']}})['then'](handleEntityNotFound(_0x49aae1,null))[_0x69a4('0x22')](function(_0x5dacd6){if(_0x5dacd6){_0x390546['body']['ChatWebsiteId']=_0x5dacd6['id'];return db[_0x69a4('0x5c')][_0x69a4('0x4b')](_0x390546['body']);}})['then'](respondWithResult(_0x49aae1,null))[_0x69a4('0x46')](handleError(_0x49aae1,null));};exports[_0x69a4('0x5d')]=function(_0x2ea865,_0x2ed9ab){var _0x3be633={'raw':![],'where':{}};var _0x12176a={};var _0x5bb84b={'count':0x0,'rows':[]};return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0x2ea865[_0x69a4('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ed9ab,null))[_0x69a4('0x22')](function(_0x5647ab){if(_0x5647ab){_0x12176a[_0x69a4('0x2e')]=_[_0x69a4('0x31')](db[_0x69a4('0x5c')]['rawAttributes']);_0x12176a[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x2ea865['query']);_0x12176a[_0x69a4('0x3a')]=_[_0x69a4('0x32')](_0x12176a[_0x69a4('0x2e')],_0x12176a['query']);_0x3be633['attributes']=_['intersection'](_0x12176a[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x2ea865[_0x69a4('0x30')][_0x69a4('0x34')]));_0x3be633[_0x69a4('0x33')]=_0x3be633[_0x69a4('0x33')][_0x69a4('0x35')]?_0x3be633['attributes']:_0x12176a[_0x69a4('0x2e')];if(!_0x2ea865['query'][_0x69a4('0x36')](_0x69a4('0x37'))){_0x3be633['limit']=qs[_0x69a4('0x20')](_0x2ea865[_0x69a4('0x30')][_0x69a4('0x20')]);_0x3be633['offset']=qs[_0x69a4('0x1e')](_0x2ea865['query']['offset']);}_0x3be633[_0x69a4('0x38')]=qs['sort'](_0x2ea865[_0x69a4('0x30')][_0x69a4('0x39')]);_0x3be633[_0x69a4('0x3d')]=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x2ea865['query'],_0x12176a['filters']));_0x3be633[_0x69a4('0x3d')][_0x69a4('0x59')]=_0x5647ab['id'];if(_0x2ea865[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x3be633[_0x69a4('0x3d')]=_['merge'](_0x3be633[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x3be633['attributes'],function(_0x152b10){var _0x47dbfc={};_0x47dbfc[_0x152b10]={'$like':'%'+_0x2ea865[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x47dbfc;})});}_0x3be633=_['merge']({},_0x3be633,_0x2ea865[_0x69a4('0x40')]);return db[_0x69a4('0x5c')]['count']({'where':_0x3be633['where']})[_0x69a4('0x22')](function(_0x5359fd){_0x5bb84b[_0x69a4('0x41')]=_0x5359fd;if(_0x2ea865[_0x69a4('0x30')][_0x69a4('0x42')]){_0x3be633[_0x69a4('0x43')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3be633);})[_0x69a4('0x22')](function(_0x22be6e){_0x5bb84b[_0x69a4('0x45')]=_0x22be6e;return _0x5bb84b;});}})[_0x69a4('0x22')](respondWithFilteredResult(_0x2ed9ab,_0x3be633))[_0x69a4('0x46')](handleError(_0x2ed9ab,null));};exports[_0x69a4('0x5e')]=function(_0xf96a4c,_0x49f665){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0xf96a4c[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x49f665,null))['then'](function(_0x214065){if(_0x214065){return _0x214065[_0x69a4('0x5e')](_0xf96a4c[_0x69a4('0x30')][_0x69a4('0x5b')]);}})[_0x69a4('0x22')](respondWithStatusCode(_0x49f665,null))[_0x69a4('0x46')](handleError(_0x49f665,null));};exports[_0x69a4('0x5f')]=function(_0x34f836,_0x4af7c3){_0x34f836[_0x69a4('0x4c')]['sitepic']=_0x34f836[_0x69a4('0x60')][_0x69a4('0x61')];return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x34f836[_0x69a4('0x48')]['id']}})['then'](handleEntityNotFound(_0x4af7c3,null))[_0x69a4('0x22')](saveUpdates(_0x34f836[_0x69a4('0x4c')],null))[_0x69a4('0x22')](respondWithResult(_0x4af7c3,null))['catch'](handleError(_0x4af7c3,null));};exports['addAvatar']=function(_0x51f9e9,_0x168b8b){_0x51f9e9[_0x69a4('0x4c')][_0x69a4('0x62')]=_0x51f9e9[_0x69a4('0x60')]['filename'];return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x51f9e9[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x168b8b,null))[_0x69a4('0x22')](saveUpdates(_0x51f9e9[_0x69a4('0x4c')],null))['then'](respondWithResult(_0x168b8b,null))[_0x69a4('0x46')](handleError(_0x168b8b,null));};exports[_0x69a4('0x63')]=function(_0x11d3da,_0x5206f9){_0x11d3da[_0x69a4('0x4c')][_0x69a4('0x64')]=_0x11d3da['file']['filename'];return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x11d3da['params']['id']}})['then'](handleEntityNotFound(_0x5206f9,null))[_0x69a4('0x22')](saveUpdates(_0x11d3da[_0x69a4('0x4c')],null))[_0x69a4('0x22')](respondWithResult(_0x5206f9,null))[_0x69a4('0x46')](handleError(_0x5206f9,null));};exports['addSystemAvatar']=function(_0x4bd305,_0x221512){_0x4bd305[_0x69a4('0x4c')]['systemAvatar']=_0x4bd305[_0x69a4('0x60')][_0x69a4('0x61')];return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x4bd305[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x221512,null))[_0x69a4('0x22')](saveUpdates(_0x4bd305[_0x69a4('0x4c')],null))[_0x69a4('0x22')](respondWithResult(_0x221512,null))['catch'](handleError(_0x221512,null));};exports['getLogo']=function(_0x579068,_0x55b388){var _0x240b84=path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0x67'));var _0x3054e9={'where':{'id':_0x579068[_0x69a4('0x48')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2db341=![];return require('../../config/license/util')[_0x69a4('0x68')]()[_0x69a4('0x22')](function(_0x3dc455){if(_0x3dc455){_0x2db341=_0x3dc455['custom'];}})[_0x69a4('0x22')](function(){return db[_0x69a4('0x2a')][_0x69a4('0x4a')](_0x3054e9);})['then'](handleEntityNotFound(_0x55b388,null))[_0x69a4('0x22')](function(_0x5dfd27){if(_0x5dfd27){if(!_[_0x69a4('0x69')](_0x5dfd27['sitepic'])){if(fs[_0x69a4('0x6a')](path[_0x69a4('0x65')](config[_0x69a4('0x66')],'server/files/images/logos/',_0x5dfd27[_0x69a4('0x6b')]))&&_0x2db341){_0x240b84=path[_0x69a4('0x65')](config['root'],'server/files/images/logos/',_0x5dfd27[_0x69a4('0x6b')]);}}return _0x55b388[_0x69a4('0x6c')](_0x240b84);}})[_0x69a4('0x46')](handleError(_0x55b388,null));};exports['getAvatar']=function(_0x4bc666,_0xeea23d){var _0x5c3728=path[_0x69a4('0x65')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x1fcc75={'where':{'id':_0x4bc666[_0x69a4('0x48')]['id']},'attributes':['id',_0x69a4('0x62')],'raw':!![]};return db[_0x69a4('0x2a')][_0x69a4('0x4a')](_0x1fcc75)[_0x69a4('0x22')](handleEntityNotFound(_0xeea23d,null))[_0x69a4('0x22')](function(_0x512fde){if(_0x512fde){if(!_[_0x69a4('0x69')](_0x512fde[_0x69a4('0x62')])){if(fs[_0x69a4('0x6a')](path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0x6d'),_0x512fde[_0x69a4('0x62')]))){_0x5c3728=path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0x6d'),_0x512fde[_0x69a4('0x62')]);}}return _0xeea23d[_0x69a4('0x6c')](_0x5c3728);}})[_0x69a4('0x46')](handleError(_0xeea23d,null));};exports[_0x69a4('0x6e')]=function(_0x3cfc1a,_0x230299){var _0xa45c0f=path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0x6f'));var _0x1776b2={'where':{'id':_0x3cfc1a[_0x69a4('0x48')]['id']},'attributes':['id','customerAvatar',_0x69a4('0x70')],'raw':!![]};return db[_0x69a4('0x2a')]['find'](_0x1776b2)[_0x69a4('0x22')](handleEntityNotFound(_0x230299,null))[_0x69a4('0x22')](function(_0x2e68e7){if(_0x2e68e7){if(!_['isNil'](_0x2e68e7[_0x69a4('0x64')])){if(fs[_0x69a4('0x6a')](path['join'](config['root'],'server/files/images/avatars/',_0x2e68e7['customerAvatar']))&&_0x2e68e7[_0x69a4('0x70')]){_0xa45c0f=path['join'](config[_0x69a4('0x66')],_0x69a4('0x6d'),_0x2e68e7[_0x69a4('0x64')]);}}return _0x230299['download'](_0xa45c0f);}})['catch'](handleError(_0x230299,null));};exports[_0x69a4('0x71')]=function(_0x1327b3,_0x5def07){var _0x292dc0=path[_0x69a4('0x65')](config['root'],_0x69a4('0x72'));var _0x110c1a={'where':{'id':_0x1327b3['params']['id']},'attributes':['id',_0x69a4('0x73')],'raw':!![]};return db[_0x69a4('0x2a')][_0x69a4('0x4a')](_0x110c1a)['then'](handleEntityNotFound(_0x5def07,null))[_0x69a4('0x22')](function(_0x6d9528){if(_0x6d9528){if(!_['isNil'](_0x6d9528['systemAvatar'])){if(fs[_0x69a4('0x6a')](path[_0x69a4('0x65')](config['root'],_0x69a4('0x6d'),_0x6d9528[_0x69a4('0x73')]))){_0x292dc0=path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0x6d'),_0x6d9528[_0x69a4('0x73')]);}}return _0x5def07[_0x69a4('0x6c')](_0x292dc0);}})[_0x69a4('0x46')](handleError(_0x5def07,null));};exports[_0x69a4('0x74')]=function(_0x7e89db,_0x32d41a){var _0x37f312=require('user-agent-parser');var _0x4dbe61=new _0x37f312();var _0x307d17=_0x4dbe61['setUA'](_0x7e89db[_0x69a4('0x75')][_0x69a4('0x76')])['getResult']();var _0x33705c={'body':_0x7e89db['body'],'channel':'chat'};var _0x259f5e=[];var _0x4f6699=[];var _0x1ef674={};var _0x372c56=![];return db[_0x69a4('0x77')][_0x69a4('0x53')]()[_0x69a4('0x22')](function(_0x16dca8){if(!_0x16dca8){throw new db[(_0x69a4('0x78'))]['ValidationError']('no\x20available\x20attributes');}_0x259f5e=_[_0x69a4('0x79')](_[_0x69a4('0x31')](_0x16dca8),[_0x69a4('0x7a'),'updatedAt']);_0x4f6699=_[_0x69a4('0x79')](_[_0x69a4('0x31')](_0x16dca8),[_0x69a4('0x7a'),_0x69a4('0x7b'),_0x69a4('0x7c'),_0x69a4('0x7d')]);if(_0x7e89db[_0x69a4('0x4c')]['id']){delete _0x7e89db[_0x69a4('0x4c')]['id'];}if(_[_0x69a4('0x69')](_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x7e')])){throw new db[(_0x69a4('0x78'))][(_0x69a4('0x7f'))]('from\x20is\x20mandatory');}if(_[_0x69a4('0x69')](_0x7e89db[_0x69a4('0x4c')]['body'])||_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x4c')]===''){throw new db['Sequelize'][(_0x69a4('0x7f'))](_0x69a4('0x80'));}if(_[_0x69a4('0x69')](_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x81')])){throw new db[(_0x69a4('0x78'))][(_0x69a4('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f6699);}if(!_['includes'](_0x4f6699,_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x81')])){throw new db[(_0x69a4('0x78'))]['ValidationError'](_0x69a4('0x82')+_0x4f6699);}_0x1ef674[_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x81')]]=_0x7e89db['body']['from'];})[_0x69a4('0x22')](function(){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x7e89db[_0x69a4('0x48')]['id']},'include':[{'model':db[_0x69a4('0x83')],'as':_0x69a4('0x84'),'include':[{'model':db['CmContact'],'as':_0x69a4('0x85'),'where':_0x1ef674,'limit':0x1,'order':[['updatedAt',_0x69a4('0x86')]]}]},{'model':db[_0x69a4('0x87')],'as':_0x69a4('0x88')}]});})[_0x69a4('0x22')](handleEntityNotFound(_0x32d41a,null))['then'](function(_0xec0a84){if(_0xec0a84&&_0xec0a84[_0x69a4('0x84')]){_0x33705c[_0x69a4('0x89')]=_0xec0a84;_0x33705c[_0x69a4('0x8a')]=_0xec0a84[_0x69a4('0x88')];_0x33705c['list']=_0xec0a84[_0x69a4('0x84')];_0x33705c['applications']=_['orderBy'](_0x33705c['applications'],['priority'],[_0x69a4('0x8b')]);if(_0x33705c[_0x69a4('0x89')][_0x69a4('0x88')]){delete _0x33705c[_0x69a4('0x89')][_0x69a4('0x88')];}if(_0x33705c[_0x69a4('0x89')][_0x69a4('0x84')]&&_0x33705c[_0x69a4('0x89')][_0x69a4('0x84')][_0x69a4('0x85')]['length']){return _0x33705c[_0x69a4('0x89')][_0x69a4('0x84')][_0x69a4('0x85')][0x0];}var _0x2bd6e8=_['defaults'](_0x7e89db['body'],{'firstName':_0x7e89db[_0x69a4('0x4c')]['from'],'ListId':_0xec0a84['ListId']});_0x2bd6e8[_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x81')]]=_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x7e')];return db[_0x69a4('0x77')]['create'](_0x2bd6e8,{'fields':_0x259f5e,'raw':!![]});}})['then'](handleEntityNotFound(_0x32d41a,null))[_0x69a4('0x22')](function(_0xd3cadd){_0x33705c['contact']=_0xd3cadd;var _0x333a5e=_0x7e89db[_0x69a4('0x4c')]['customerIp'];if(_0x7e89db[_0x69a4('0x75')][_0x69a4('0x8c')]){_0x333a5e=_0x7e89db[_0x69a4('0x75')][_0x69a4('0x8c')];}else if(_0x7e89db[_0x69a4('0x75')]['x-forwarded-for']){_0x333a5e=_[_0x69a4('0x8d')](_0x7e89db['headers']['x-forwarded-for'][_0x69a4('0x8e')](','));}if(_0xd3cadd){var _0x4aba8d={'ContactId':_0xd3cadd['id'],'ChatWebsiteId':_0x7e89db['params']['id'],'from':(_0xd3cadd[_0x69a4('0x8f')]||'')+'\x20'+(_0xd3cadd[_0x69a4('0x90')]||''),'customerIp':_0x333a5e,'customerPort':_0x7e89db[_0x69a4('0x75')][_0x69a4('0x91')]?_0x7e89db[_0x69a4('0x75')][_0x69a4('0x91')]:null,'referer':_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x92')],'browserName':_0x307d17[_0x69a4('0x93')][_0x69a4('0x28')]&&_0x307d17['browser'][_0x69a4('0x94')]?util[_0x69a4('0x95')](_0x69a4('0x96'),_0x307d17[_0x69a4('0x93')][_0x69a4('0x28')],_0x307d17[_0x69a4('0x93')][_0x69a4('0x94')]):_0x69a4('0x97'),'browserVersion':_0x307d17[_0x69a4('0x93')][_0x69a4('0x94')]||_0x69a4('0x97'),'osName':util[_0x69a4('0x95')](_0x69a4('0x96'),_0x307d17['os'][_0x69a4('0x28')],_0x307d17['os'][_0x69a4('0x94')]),'osVersion':_0x307d17['os'][_0x69a4('0x94')],'deviceModel':_0x307d17['device'][_0x69a4('0x2e')]&&_0x307d17[_0x69a4('0x98')][_0x69a4('0x99')]?util[_0x69a4('0x95')]('%s\x20%s\x20%s',_0x307d17[_0x69a4('0x98')][_0x69a4('0x2e')],_0x307d17[_0x69a4('0x98')][_0x69a4('0x99')],_0x307d17[_0x69a4('0x98')][_0x69a4('0x2c')]):null,'deviceVendor':_0x307d17['device'][_0x69a4('0x99')],'deviceType':_0x307d17[_0x69a4('0x98')]['type'],'formData':JSON[_0x69a4('0x17')](_0x7e89db['body'])};var _0x22e2c0={'ChatWebsiteId':_0x7e89db[_0x69a4('0x48')]['id'],'closed':![]};if(_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9a')]){_0x22e2c0[_0x69a4('0x9a')]=_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9a')];return db[_0x69a4('0x9b')][_0x69a4('0x4a')]({'where':_0x22e2c0})[_0x69a4('0x22')](function(_0xb03fec){if(_0xb03fec){return[_0xb03fec,![]];}_0x4aba8d[_0x69a4('0x9a')]=_0x7e89db['body']['threadId'];_0x4aba8d[_0x69a4('0x9c')]=_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9c')];return db[_0x69a4('0x9b')]['create'](_0x4aba8d)[_0x69a4('0x22')](function(_0x31919e){return[_0x31919e,!![]];});});}_0x22e2c0[_0x69a4('0x9d')]=_0xd3cadd['id'];if(_0x7e89db[_0x69a4('0x4c')]['interaction']&&_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9e')]['id']){_0x22e2c0['id']=_0x7e89db['body'][_0x69a4('0x9e')]['id'];return db[_0x69a4('0x9b')][_0x69a4('0x4a')]({'where':_0x22e2c0})[_0x69a4('0x22')](function(_0x21559e){if(_0x21559e){return[_0x21559e,![]];}return db[_0x69a4('0x9b')][_0x69a4('0x4b')](_0x4aba8d)[_0x69a4('0x22')](function(_0x363edd){return[_0x363edd,!![]];});});}return db[_0x69a4('0x9b')][_0x69a4('0x4b')](_0x4aba8d)[_0x69a4('0x22')](function(_0x589e35){return[_0x589e35,!![]];});}})[_0x69a4('0x9f')](function(_0x1dde25,_0x3a4e17){if(_0x1dde25){_0x372c56=_0x3a4e17;if(!_0x3a4e17){var _0x51dc95={'from':(_0x33705c['contact'][_0x69a4('0x8f')]||'')+'\x20'+(_0x33705c[_0x69a4('0xa0')][_0x69a4('0x90')]||'')};if(_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9a')]&&_0x7e89db[_0x69a4('0x4c')]['messageId']&&_0x7e89db[_0x69a4('0x4c')][_0x69a4('0x9a')]!=_0x7e89db[_0x69a4('0x4c')]['messageId']){_0x51dc95['threadId']=_0x7e89db[_0x69a4('0x4c')][_0x69a4('0xa1')];}return _0x1dde25[_0x69a4('0xa2')](_0x51dc95);}else{return _0x1dde25;}}})['then'](function(_0x4a3574){_0x33705c[_0x69a4('0x9e')]=_0x4a3574[_0x69a4('0x23')]({'plain':!![]});_0x33705c[_0x69a4('0x9e')][_0x69a4('0xa3')]=_0x372c56;if(_0x33705c[_0x69a4('0x9e')][_0x69a4('0xa3')]){if(_0x33705c[_0x69a4('0x89')]['autoclose']){_0x33705c[_0x69a4('0x8a')][_0x69a4('0xa4')]({'id':0x0,'priority':_0x33705c[_0x69a4('0x8a')][_0x69a4('0x35')]+0x1,'app':_0x69a4('0xa5'),'appdata':_0x69a4('0xa6'),'interval':_0x69a4('0xa7')});}}return db[_0x69a4('0xa8')][_0x69a4('0x4b')]({'body':_0x7e89db[_0x69a4('0x4c')]['body'],'ChatWebsiteId':_0x7e89db[_0x69a4('0x48')]['id'],'ChatInteractionId':_0x4a3574['id'],'direction':'in','ContactId':_0x33705c[_0x69a4('0xa0')]['id'],'AttachmentId':_0x7e89db['body'][_0x69a4('0xa9')]});})[_0x69a4('0x22')](function(_0x5063d0){_0x33705c[_0x69a4('0x1a')]=_0x5063d0;if(_0x33705c[_0x69a4('0x9e')]['UserId']){return db['User'][_0x69a4('0x4a')]({'attributes':['id',_0x69a4('0x28')],'where':{'id':_0x33705c[_0x69a4('0x9e')][_0x69a4('0xaa')]}})[_0x69a4('0x22')](function(_0x2fb04e){if(_0x2fb04e){_0x33705c[_0x69a4('0x8a')][_0x69a4('0xab')]({'id':0x0,'priority':0x0,'app':_0x69a4('0xac'),'appdata':_0x2fb04e[_0x69a4('0x28')]+','+(_0x33705c[_0x69a4('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0x69a4('0xa7')});_0x33705c[_0x69a4('0xad')]=!![];}return respondWithRpcPromise(_0x69a4('0xae'),_0x69a4('0xaf'),_0x33705c);});}return respondWithRpcPromise(_0x69a4('0xae'),'startRouting',_0x33705c);})[_0x69a4('0x22')](function(_0x46a80d){respondWithRpcPromise(_0x69a4('0xb0'),_0x69a4('0xb0'),{'event':'notify','message':_0x46a80d},client9002);return _0x46a80d;})['then'](respondWithResult(_0x32d41a,null))['catch'](handleError(_0x32d41a,null));};exports['offline']=function(_0x43e43f,_0x2ced34){var _0x424744,_0x26af96,_0x261e10;var _0x703e69=[];var _0x10fc0f={};var _0x4a4786=_0x43e43f[_0x69a4('0xb1')]||[];var _0x1d6438=[];var _0x45714a;return db['CmContact'][_0x69a4('0x53')]()['then'](function(_0xe83e){if(!_0xe83e){throw new db[(_0x69a4('0x78'))][(_0x69a4('0x7f'))](_0x69a4('0xb2'));}_0x703e69=_[_0x69a4('0x79')](_[_0x69a4('0x31')](_0xe83e),[_0x69a4('0x7a'),_0x69a4('0x7b'),_0x69a4('0x7c'),_0x69a4('0x7d')]);if(_0x43e43f['body']['id']){delete _0x43e43f[_0x69a4('0x4c')]['id'];}if(_[_0x69a4('0x69')](_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x7e')])){throw _0x2ced34[_0x69a4('0x29')](0x1f4)[_0x69a4('0xb3')](new db[(_0x69a4('0x78'))]['ValidationError'](_0x69a4('0xb4')));}if(_['isNil'](_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x4c')])||_0x43e43f['body'][_0x69a4('0x4c')]===''){throw _0x2ced34[_0x69a4('0x29')](0x1f4)[_0x69a4('0xb3')](new db[(_0x69a4('0x78'))][(_0x69a4('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x43e43f[_0x69a4('0x4c')]['mapKeyOffline'])){throw _0x2ced34[_0x69a4('0x29')](0x1f4)['send'](new db[(_0x69a4('0x78'))]['ValidationError'](_0x69a4('0xb5')+_0x703e69));}if(!_['includes'](_0x703e69,_0x43e43f[_0x69a4('0x4c')][_0x69a4('0xb6')])){throw _0x2ced34[_0x69a4('0x29')](0x1f4)[_0x69a4('0xb3')](new db[(_0x69a4('0x78'))][(_0x69a4('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x703e69));}_0x10fc0f[_0x43e43f[_0x69a4('0x4c')][_0x69a4('0xb6')]]=_0x43e43f[_0x69a4('0x4c')]['from'];})[_0x69a4('0x22')](function(){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x43e43f[_0x69a4('0x48')]['id']},'include':[{'model':db[_0x69a4('0x83')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x69a4('0x22')](handleEntityNotFound(_0x2ced34,null))[_0x69a4('0x22')](function(_0x5f1f29){if(_0x5f1f29&&_0x5f1f29[_0x69a4('0x84')]){_0x26af96=_0x5f1f29;var _0xea326d=_[_0x69a4('0xc')](_0x43e43f[_0x69a4('0x4c')],{'firstName':_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x7e')],'phone':_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x7e')],'ListId':_0x5f1f29[_0x69a4('0x7d')]});_0xea326d[_0x43e43f[_0x69a4('0x4c')]['mapKeyOffline']]=_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x7e')];return db[_0x69a4('0x77')]['findOrCreate']({'where':_0x10fc0f,'defaults':_0xea326d});}})['spread'](function(_0x532be0){if(_0x532be0){_0x261e10=_0x532be0;var _0x23e51b=fs[_0x69a4('0xb7')](path['join'](config['root'],_0x69a4('0xb8')),_0x69a4('0xb9'));var _0x3dc073=ejs[_0x69a4('0xba')](_0x23e51b,{'body':_[_0x69a4('0xbb')](_0x43e43f[_0x69a4('0x4c')][_0x69a4('0x4c')]),'bodyTitle':_0x26af96[_0x69a4('0xbc')]});return db[_0x69a4('0xbd')][_0x69a4('0x4b')]({'body':_0x3dc073,'plainBody':htmlToText[_0x69a4('0xbe')](_0x3dc073),'ContactId':_0x532be0['id'],'ChatWebsiteId':_0x26af96['id']});}})[_0x69a4('0x22')](function(_0x5016fe){_0x45714a=_0x5016fe;if(_0x4a4786[_0x69a4('0x35')]){var _0x332714=_0x4a4786['map'](function(_0x2698d4){return{'name':_0x2698d4[_0x69a4('0xbf')],'basename':_0x2698d4[_0x69a4('0x61')],'type':_0x2698d4[_0x69a4('0xc0')],'ChatOfflineMessageId':_0x5016fe['id']};});_0x1d6438=_0x332714[_0x69a4('0x2f')](_0x3eeaee=>{var _0x5ef757={'filename':_0x3eeaee[_0x69a4('0x28')],'path':path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0xc1'),_0x69a4('0xb1'),_0x69a4('0xc2'),_0x69a4('0xc3'),_0x3eeaee[_0x69a4('0xc4')])};return _0x5ef757;});if(!_0x26af96[_0x69a4('0xc5')]){return db['sequelize'][_0x69a4('0xc6')](function(_0x256eae){return db[_0x69a4('0xc7')][_0x69a4('0xc8')](_0x332714,{'transaction':_0x256eae});});}}})[_0x69a4('0x22')](function(){if(_0x45714a){_0x424744=_0x45714a;return db[_0x69a4('0xc9')][_0x69a4('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0x69a4('0xca')],'as':_0x69a4('0xcb'),'raw':!![],'include':[{'model':db[_0x69a4('0xcc')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x69a4('0x22')](function(_0x180ac5){if(_0x180ac5&&_0x180ac5[_0x69a4('0xcb')]&&_0x26af96[_0x69a4('0xcd')]&&_0x26af96[_0x69a4('0xce')]){var _0x489a30=_0x180ac5[_0x69a4('0xcf')]();return respondWithRpcPromise(_0x69a4('0xd0'),_0x69a4('0xd1'),{'account':_0x489a30,'message':{'from':util['format'](_0x69a4('0xd2'),_0x180ac5['name'],_0x180ac5[_0x69a4('0xd3')]||_0x180ac5[_0x69a4('0xcb')][_0x69a4('0x4d')]),'to':_0x26af96[_0x69a4('0xce')],'subject':_0x26af96[_0x69a4('0xd4')],'html':_0x424744[_0x69a4('0x4c')],'attachments':_0x1d6438}},client9003)[_0x69a4('0x22')](function(){return _0x424744;})['catch'](function(_0x28c233){logger['error'](_0x28c233);});}})['then'](function(){if(_0x26af96&&_0x26af96[_0x69a4('0xc5')]&&_0x26af96['MailAccountId']){var _0x3f7075=[];if(_0x4a4786[_0x69a4('0x35')]){_0x3f7075=_0x4a4786[_0x69a4('0x2f')](function(_0x5c9be2){return{'name':_0x5c9be2['originalname'],'basename':_0x5c9be2[_0x69a4('0x61')],'type':_0x5c9be2[_0x69a4('0xc0')],'ChatOfflineMessageId':_0x45714a['id']};});}var _0x3e6804;if(!_[_0x69a4('0x69')](_0x26af96[_0x69a4('0xd5')])){var _0x595206=_['map'](_0x43e43f[_0x69a4('0x4c')],function(_0x68d3b0){return _0x68d3b0;});var _0x304a42=_[_0x69a4('0xd6')](_0x595206)[0x0];var _0x5cae5b=_[_0x69a4('0xd7')](_0x304a42,function(_0x35b955){return _0x35b955;});_0x3e6804=_0x5cae5b[0x1][_0x26af96['subjectOffline']];}var _0x3a42ce={'from':_0x261e10[_0x69a4('0xd3')],'firstName':_0x261e10[_0x69a4('0x8f')],'lastName':_0x261e10[_0x69a4('0x90')],'mapKey':_0x69a4('0xd3'),'message':{'from':_0x261e10[_0x69a4('0xd3')],'to':_0x26af96[_0x69a4('0xc9')]['email'],'cc':'','subject':_[_0x69a4('0x69')](_0x3e6804)?_0x26af96[_0x69a4('0xd4')]:_0x3e6804,'messageId':'','sentAt':new Date(),'attach':_0x3f7075[_0x69a4('0x35')],'attachments':_0x3f7075,'originChannel':'Chat','ChatWebsiteId':_0x26af96['id'],'ChatOfflineMessageId':_0x424744['id'],'originTo':_0x26af96['MailAccount'][_0x69a4('0xd3')]},'body':_0x424744[_0x69a4('0x4c')]};var _0x3b961d={'account':{'id':_0x26af96[_0x69a4('0xd8')]},'body':_0x3a42ce,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x69a4('0xd9'),_0x69a4('0xda'),_0x3b961d,client9001)[_0x69a4('0x22')](function(){return _0x424744;})['catch'](function(_0x56d96d){logger[_0x69a4('0x18')](_0x56d96d);});}return;})[_0x69a4('0x22')](function(){if(_0x424744){return _0x424744;}})['then'](respondWithResult(_0x2ced34,null))[_0x69a4('0x46')](function(_0x4fbb5a){logger[_0x69a4('0x18')]('catch',_0x4fbb5a);for(var _0x38eefa of _0x4a4786){var _0x3fe0e8=path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0xc1'),'files','attachments',_0x69a4('0xc3'),_0x38eefa[_0x69a4('0x61')]);fs_extra[_0x69a4('0xdb')](_0x3fe0e8)[_0x69a4('0x46')](function(_0x4fdb23){logger['error'](_0x69a4('0xdc'),_0x3fe0e8,_0x4fdb23);});}});};exports[_0x69a4('0xdd')]=function(_0x1252f2,_0x5266e7){return db['ChatInteraction']['find']({'where':{'id':_0x1252f2[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x5266e7,null))[_0x69a4('0x22')](function(_0x1e90bb){if(_0x1e90bb){return _0x1e90bb[_0x69a4('0xdd')](_0x1252f2[_0x69a4('0x4c')]['ids'],_['omit'](_0x1252f2[_0x69a4('0x4c')],['ids','id'])||{});}})[_0x69a4('0x22')](respondWithResult(_0x5266e7,null))[_0x69a4('0x46')](handleError(_0x5266e7,null));};exports['getInteractions']=function(_0x58f4f8,_0x2744d1){var _0x33d402={'raw':![],'where':{}};var _0x56fae7={};var _0x1a098b={'count':0x0,'rows':[]};return db[_0x69a4('0x2a')]['findOne']({'where':{'id':_0x58f4f8[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x2744d1,null))[_0x69a4('0x22')](function(_0x2438a0){if(_0x2438a0){_0x56fae7[_0x69a4('0x2e')]=_[_0x69a4('0x31')](db['ChatInteraction'][_0x69a4('0x58')]);_0x56fae7[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x58f4f8['query']);_0x56fae7['filters']=_[_0x69a4('0x32')](_0x56fae7[_0x69a4('0x2e')],_0x56fae7['query']);_0x33d402['attributes']=_[_0x69a4('0x32')](_0x56fae7[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x58f4f8[_0x69a4('0x30')][_0x69a4('0x34')]));_0x33d402[_0x69a4('0x33')]=_0x33d402[_0x69a4('0x33')]['length']?_0x33d402['attributes']:_0x56fae7[_0x69a4('0x2e')];if(!_0x58f4f8[_0x69a4('0x30')][_0x69a4('0x36')](_0x69a4('0x37'))){_0x33d402['limit']=qs[_0x69a4('0x20')](_0x58f4f8['query'][_0x69a4('0x20')]);_0x33d402[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x58f4f8['query'][_0x69a4('0x1e')]);}_0x33d402['order']=qs[_0x69a4('0x39')](_0x58f4f8[_0x69a4('0x30')]['sort']);_0x33d402[_0x69a4('0x3d')]=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x58f4f8[_0x69a4('0x30')],_0x56fae7[_0x69a4('0x3a')]));_0x33d402[_0x69a4('0x3d')][_0x69a4('0x59')]=_0x2438a0['id'];if(_0x58f4f8[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x33d402[_0x69a4('0x3d')]=_[_0x69a4('0x3e')](_0x33d402[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x33d402['attributes'],function(_0x59f561){var _0x41ce86={};_0x41ce86[_0x59f561]={'$like':'%'+_0x58f4f8[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x41ce86;})});}_0x33d402=_[_0x69a4('0x3e')]({},_0x33d402,_0x58f4f8['options']);return db[_0x69a4('0x9b')][_0x69a4('0x41')]({'where':_0x33d402['where']})[_0x69a4('0x22')](function(_0x2d5fff){_0x1a098b['count']=_0x2d5fff;if(_0x58f4f8[_0x69a4('0x30')][_0x69a4('0x42')]){_0x33d402[_0x69a4('0x43')]=[{'model':db[_0x69a4('0x77')],'as':'Contact','required':![]},{'model':db[_0x69a4('0xde')],'as':_0x69a4('0xdf'),'attributes':[_0x69a4('0x28'),_0x69a4('0xe0'),_0x69a4('0xe1')],'required':![]},{'model':db[_0x69a4('0xe2')],'as':'Tags','attributes':['id',_0x69a4('0x28'),_0x69a4('0xe3')],'where':_0x58f4f8['query'][_0x69a4('0xe4')]?{'id':_0x58f4f8[_0x69a4('0x30')][_0x69a4('0xe4')]}:undefined,'required':_0x58f4f8['query'][_0x69a4('0xe4')]?!![]:![]}];}return db[_0x69a4('0x9b')][_0x69a4('0x44')](_0x33d402);})['then'](function(_0x37b308){_0x1a098b[_0x69a4('0x45')]=_0x37b308;return _0x1a098b;});}})['then'](respondWithFilteredResult(_0x2744d1,_0x33d402))[_0x69a4('0x46')](handleError(_0x2744d1,null));};function iftimePromise(_0x4761aa,_0x572ffb){return respondWithRpcPromise('Command',_0x69a4('0xe5'),{'command':_0x572ffb[_0x69a4('0xe6')]?util[_0x69a4('0x95')](_0x69a4('0xe7'),_0x4761aa[_0x69a4('0xe8')],_0x572ffb['timezone']):util[_0x69a4('0x95')]('iftime\x20%s',_0x4761aa['interval'])},client9002)[_0x69a4('0x22')](function(_0x207e5b){var _0x4df1be=_0x207e5b&&_0x207e5b[_0x69a4('0xe9')]('true')>=0x0?!![]:![];logger[_0x69a4('0x13')](_0x69a4('0xea'),_0x572ffb['id'],_0x4761aa['id'],_0x4761aa[_0x69a4('0xe8')],_0x4df1be?_0x69a4('0xeb'):'OFFLINE',_0x572ffb[_0x69a4('0xe6')]?_0x572ffb['timezone']:'No\x20timezone');return _0x4df1be;})['catch'](function(_0x2792e7){logger[_0x69a4('0x18')](_0x69a4('0xea'),_0x572ffb['id'],_0x4761aa['id'],_0x4761aa[_0x69a4('0xe8')],util[_0x69a4('0xec')](_0x2792e7,{'showHidden':![],'depth':null}),_0x572ffb[_0x69a4('0xe6')]?_0x572ffb[_0x69a4('0xe6')]:'No\x20timezone');return![];});}exports[_0x69a4('0xe5')]=function(_0x5abbda,_0x1d4342){var _0xeaa8e4=0x0;var _0x54a181=0x0;var _0x4258b1=![];var _0x4841bf;var _0x17a2d7;return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x5abbda[_0x69a4('0x48')]['id']},'include':[{'model':db[_0x69a4('0xed')],'as':_0x69a4('0xed'),'include':[{'model':db[_0x69a4('0xed')],'as':_0x69a4('0xee'),'attributes':['id',_0x69a4('0xe8')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1d4342,null))['then'](function(_0x5987a2){if(_0x5987a2){_0x4841bf=_0x5987a2;return _0x5987a2[_0x69a4('0xef')]({'raw':!![]});}})[_0x69a4('0x22')](function(_0x720fcf){if(_0x4841bf){if(_0x720fcf){_0x17a2d7=_0x720fcf;}}return require(_0x69a4('0xf0'))[_0x69a4('0x68')]();})[_0x69a4('0x22')](function(_0x2d6f67){if(_0x2d6f67){_0x54a181=_0x2d6f67[_0x69a4('0xf1')];_0x4258b1=_0x2d6f67[_0x69a4('0xf2')];}})['then'](function(){return db[_0x69a4('0x9b')][_0x69a4('0x41')]({'where':{'closed':![]}});})['then'](function(_0x5d2354){_0xeaa8e4=_0x5d2354;if(_0x54a181&&_0x5d2354>_0x54a181){return db['License']['findOne']({'where':{'id':0x1}})[_0x69a4('0x22')](function(_0x5259c7){if(_0x5259c7){_0x5259c7[_0x69a4('0xf3')](_0x69a4('0xf4'));}});}})[_0x69a4('0x22')](function(){if(_0x4841bf[_0x69a4('0xed')]&&_0x4841bf[_0x69a4('0xed')][_0x69a4('0xee')]){var _0x41a3fd=[];for(var _0x4ccc05=0x0;_0x4ccc05<_0x4841bf[_0x69a4('0xed')][_0x69a4('0xee')]['length'];_0x4ccc05++){var _0x619354=_0x4841bf[_0x69a4('0xed')][_0x69a4('0xee')][_0x4ccc05][_0x69a4('0x23')]({'plain':!![]});_0x41a3fd['push'](iftimePromise(_0x619354,_0x4841bf));}return BPromise[_0x69a4('0xf5')](_0x41a3fd)['then'](function(_0x132515){return _[_0x69a4('0xf6')](_0x132515);});}else{return!![];}})[_0x69a4('0x22')](function(_0x2be74f){var _0xf58843=fs[_0x69a4('0xb7')](path[_0x69a4('0x65')](config[_0x69a4('0x66')],_0x69a4('0xf7')),_0x69a4('0xb9'));var _0x530d86={'remote':_0x4841bf[_0x69a4('0xf8')],'query':querystring[_0x69a4('0x17')](_[_0x69a4('0x3e')](_0x4841bf[_0x69a4('0x23')]({'plain':!![]}),{'customerIp':_0x5abbda[_0x69a4('0x75')]['x-forwarded-for']||_0x5abbda['headers'][_0x69a4('0xf9')]||_0x5abbda[_0x69a4('0xfa')][_0x69a4('0xfb')]||_0x5abbda['ip'],'referer':_0x5abbda[_0x69a4('0x75')][_0x69a4('0x92')],'openedInteractions':_0xeaa8e4,'maxInteractions':_0x54a181,'virtual':_0x4258b1[_0x69a4('0xf1')],'online':_0x2be74f,'custom':_0x4258b1}))[_0x69a4('0xfc')](/'/g,'\x5c\x27')};_0x1d4342[_0x69a4('0xb3')](ejs[_0x69a4('0xba')](Mustache[_0x69a4('0xba')](_0xf58843,_0x530d86),{'proactiveActions':_0x17a2d7,'alignment':_0x4841bf['alignment'],'verticalAlignment':_0x4841bf[_0x69a4('0xfd')],'div_color':_0x4841bf[_0x69a4('0xe3')],'labelText':_0x4841bf[_0x69a4('0xfe')],'text_color':_0x4841bf[_0x69a4('0xff')],'text_button_color':_0x4841bf[_0x69a4('0x100')],'button_color':_0x4841bf[_0x69a4('0x101')],'background_color':_0x4841bf[_0x69a4('0x102')],'hideWhenOffline':_0x4841bf[_0x69a4('0x103')],'interval':_0x4841bf['IntervalId']}));})[_0x69a4('0x46')](handleError(_0x1d4342,null));};exports[_0x69a4('0x104')]=function(_0xe72d7,_0x13c594){var _0x47d600=_0xe72d7[_0x69a4('0x48')]['id'];var _0xa39f7b=_0xe72d7[_0x69a4('0x4c')];var _0x4911b6=0xc8;var _0x56271c=null;return db[_0x69a4('0x105')][_0x69a4('0xc6')]({'isolationLevel':db[_0x69a4('0x105')][_0x69a4('0x106')][_0x69a4('0x107')]['READ_COMMITTED']},function(_0x25fd86){return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0x47d600},'transaction':_0x25fd86})[_0x69a4('0x22')](function(_0x4dfcc6){if(_0x4dfcc6){return db['ChatApplication'][_0x69a4('0x25')]({'where':{'ChatWebsiteId':_0x47d600},'transaction':_0x25fd86})[_0x69a4('0x22')](function(){var _0x30f14d=_[_0x69a4('0x2f')](_0xa39f7b,function(_0x500081){_0x500081['ChatWebsiteId']=_0x47d600;return _0x500081;});return db[_0x69a4('0x87')][_0x69a4('0xc8')](_0x30f14d,{'transaction':_0x25fd86});});}else{_0x4911b6=0x194;_0x56271c=[];}});})['then'](function(){if(_0x4911b6!==0x194){return db[_0x69a4('0x87')][_0x69a4('0x108')]({'where':{'ChatWebsiteId':_0x47d600},'order':_0x69a4('0x109')})[_0x69a4('0x22')](function(_0x4010d6){_0x56271c=_0x4010d6;});}})[_0x69a4('0x46')](function(_0x21f7d6){_0x4911b6=0x1f4;logger[_0x69a4('0x18')](_0x21f7d6[_0x69a4('0x27')]);if(_0x21f7d6[_0x69a4('0x28')]){delete _0x21f7d6[_0x69a4('0x28')];}_0x56271c=_0x21f7d6;})[_0x69a4('0x10a')](function(){if(_0x56271c===null){_0x13c594[_0x69a4('0x1c')](_0x4911b6);}else{if(_0x4911b6===0x1f4){_0x13c594['status'](_0x4911b6)[_0x69a4('0xb3')](_0x56271c);}else{_0x13c594[_0x69a4('0x29')](_0x4911b6)[_0x69a4('0x1d')](_0x56271c);}}});};exports[_0x69a4('0x10b')]=function(_0x5dd002,_0x1c00f7){var _0x3fb760={};var _0x5593b2={};var _0x351aca;var _0x35f6cb;return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0x5dd002[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x1c00f7,null))[_0x69a4('0x22')](function(_0x1707e9){if(_0x1707e9){_0x351aca=_0x1707e9;_0x5593b2['model']=_[_0x69a4('0x31')](db[_0x69a4('0x87')][_0x69a4('0x58')]);_0x5593b2[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x5dd002[_0x69a4('0x30')]);_0x5593b2['filters']=_[_0x69a4('0x32')](_0x5593b2[_0x69a4('0x2e')],_0x5593b2[_0x69a4('0x30')]);_0x3fb760[_0x69a4('0x33')]=_[_0x69a4('0x32')](_0x5593b2[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x5dd002[_0x69a4('0x30')][_0x69a4('0x34')]));_0x3fb760['attributes']=_0x3fb760[_0x69a4('0x33')]['length']?_0x3fb760['attributes']:_0x5593b2[_0x69a4('0x2e')];_0x3fb760[_0x69a4('0x38')]=qs[_0x69a4('0x39')](_0x5dd002[_0x69a4('0x30')][_0x69a4('0x39')]);_0x3fb760['where']=qs['filters'](_[_0x69a4('0x3b')](_0x5dd002[_0x69a4('0x30')],_0x5593b2[_0x69a4('0x3a')]));if(_0x5dd002[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x3fb760[_0x69a4('0x3d')]=_['merge'](_0x3fb760[_0x69a4('0x3d')],{'$or':_['map'](_0x3fb760[_0x69a4('0x33')],function(_0x2218b0){var _0x40d8de={};_0x40d8de[_0x2218b0]={'$like':'%'+_0x5dd002[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x40d8de;})});}_0x3fb760=_['merge']({},_0x3fb760,_0x5dd002[_0x69a4('0x40')]);return _0x351aca['getApplications'](_0x3fb760);}})[_0x69a4('0x22')](function(_0x3c75e5){if(_0x3c75e5){_0x35f6cb=_0x3c75e5[_0x69a4('0x35')];if(!_0x5dd002[_0x69a4('0x30')]['hasOwnProperty']('nolimit')){_0x3fb760['limit']=qs[_0x69a4('0x20')](_0x5dd002[_0x69a4('0x30')][_0x69a4('0x20')]);_0x3fb760[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x5dd002[_0x69a4('0x30')][_0x69a4('0x1e')]);}return _0x351aca[_0x69a4('0x10b')](_0x3fb760);}})[_0x69a4('0x22')](function(_0x4e54be){if(_0x4e54be){return _0x4e54be?{'count':_0x35f6cb,'rows':_0x4e54be}:null;}})[_0x69a4('0x22')](respondWithResult(_0x1c00f7,null))[_0x69a4('0x46')](handleError(_0x1c00f7,null));};exports[_0x69a4('0x10c')]=function(_0x285c87,_0x255451){return db[_0x69a4('0x10d')][_0x69a4('0x4a')]({'where':{'id':_0x285c87[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x255451,null))[_0x69a4('0x22')](function(_0x521d07){if(_0x521d07){return _0x521d07['addProactiveActions'](_0x285c87['body'][_0x69a4('0x5b')],_['omit'](_0x285c87[_0x69a4('0x4c')],['ids','id'])||{});}})[_0x69a4('0x22')](respondWithResult(_0x255451,null))[_0x69a4('0x46')](handleError(_0x255451,null));};exports[_0x69a4('0xef')]=function(_0x545542,_0x9b5519){var _0x3f3d47={};var _0x24ef1c={};var _0x44a7b1;var _0x1fc9fa;return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0x545542[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x9b5519,null))[_0x69a4('0x22')](function(_0x5cb473){if(_0x5cb473){_0x44a7b1=_0x5cb473;_0x24ef1c['model']=_['keys'](db[_0x69a4('0x10e')]['rawAttributes']);_0x24ef1c[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x545542[_0x69a4('0x30')]);_0x24ef1c[_0x69a4('0x3a')]=_[_0x69a4('0x32')](_0x24ef1c[_0x69a4('0x2e')],_0x24ef1c[_0x69a4('0x30')]);_0x3f3d47[_0x69a4('0x33')]=_[_0x69a4('0x32')](_0x24ef1c[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0x545542[_0x69a4('0x30')]['fields']));_0x3f3d47[_0x69a4('0x33')]=_0x3f3d47['attributes'][_0x69a4('0x35')]?_0x3f3d47[_0x69a4('0x33')]:_0x24ef1c[_0x69a4('0x2e')];_0x3f3d47[_0x69a4('0x38')]=qs[_0x69a4('0x39')](_0x545542[_0x69a4('0x30')][_0x69a4('0x39')]);_0x3f3d47[_0x69a4('0x3d')]=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x545542['query'],_0x24ef1c[_0x69a4('0x3a')]));if(_0x545542[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x3f3d47[_0x69a4('0x3d')]=_['merge'](_0x3f3d47[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x3f3d47[_0x69a4('0x33')],function(_0x5498aa){var _0x4587ac={};_0x4587ac[_0x5498aa]={'$like':'%'+_0x545542['query'][_0x69a4('0x3c')]+'%'};return _0x4587ac;})});}_0x3f3d47=_['merge']({},_0x3f3d47,_0x545542['options']);return _0x44a7b1[_0x69a4('0xef')](_0x3f3d47);}})[_0x69a4('0x22')](function(_0x47ee82){if(_0x47ee82){_0x1fc9fa=_0x47ee82[_0x69a4('0x35')];if(!_0x545542[_0x69a4('0x30')][_0x69a4('0x36')]('nolimit')){_0x3f3d47[_0x69a4('0x20')]=qs[_0x69a4('0x20')](_0x545542[_0x69a4('0x30')]['limit']);_0x3f3d47[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x545542[_0x69a4('0x30')]['offset']);}return _0x44a7b1[_0x69a4('0xef')](_0x3f3d47);}})[_0x69a4('0x22')](function(_0x2825c2){if(_0x2825c2){return _0x2825c2?{'count':_0x1fc9fa,'rows':_0x2825c2}:null;}})[_0x69a4('0x22')](respondWithResult(_0x9b5519,null))['catch'](handleError(_0x9b5519,null));};exports[_0x69a4('0x10f')]=function(_0xaba525,_0x5569b1){var _0x274d64=_0xaba525[_0x69a4('0x30')]['online']===_0x69a4('0x110')?_0x69a4('0x111'):_0x69a4('0x112');return db['ChatWebsite'][_0x69a4('0x4a')]({'attributes':['id',_0x274d64],'where':{'id':_0xaba525['params']['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x5569b1,null))['then'](function(_0xd3a966){if(_0xd3a966){var _0x28f518=_0xd3a966[_0x274d64];var _0x5bf36e=_0x28f518&&_0x28f518[_0x69a4('0x113')]?_0x28f518[_0x69a4('0x113')]:[];_0x5569b1[_0x69a4('0xb3')]({'fromKey':_[_0x69a4('0x69')](_0x28f518['fromKey'])?undefined:_0x28f518[_0x69a4('0x114')],'count':_0x5bf36e['length'],'rows':_0x5bf36e});}})[_0x69a4('0x46')](handleError(_0x5569b1,null));};exports[_0x69a4('0x115')]=function(_0x4f21f1,_0x5ada91){var _0x45e2ec={'raw':![],'where':{}};var _0x370735={};var _0x3888dc={'count':0x0,'rows':[]};return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0x4f21f1[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x5ada91,null))[_0x69a4('0x22')](function(_0x163ca0){if(_0x163ca0){_0x370735[_0x69a4('0x2e')]=_[_0x69a4('0x31')](db['ChatOfflineMessage']['rawAttributes']);_0x370735[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0x4f21f1['query']);_0x370735[_0x69a4('0x3a')]=_['intersection'](_0x370735[_0x69a4('0x2e')],_0x370735[_0x69a4('0x30')]);_0x45e2ec['attributes']=_[_0x69a4('0x32')](_0x370735['model'],qs['fields'](_0x4f21f1[_0x69a4('0x30')][_0x69a4('0x34')]));_0x45e2ec[_0x69a4('0x33')]=_0x45e2ec[_0x69a4('0x33')]['length']?_0x45e2ec[_0x69a4('0x33')]:_0x370735[_0x69a4('0x2e')];if(!_0x4f21f1[_0x69a4('0x30')][_0x69a4('0x36')](_0x69a4('0x37'))){_0x45e2ec[_0x69a4('0x20')]=qs[_0x69a4('0x20')](_0x4f21f1['query']['limit']);_0x45e2ec[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0x4f21f1['query'][_0x69a4('0x1e')]);}_0x45e2ec[_0x69a4('0x38')]=qs[_0x69a4('0x39')](_0x4f21f1[_0x69a4('0x30')][_0x69a4('0x39')]);_0x45e2ec[_0x69a4('0x3d')]=qs[_0x69a4('0x3a')](_[_0x69a4('0x3b')](_0x4f21f1['query'],_0x370735[_0x69a4('0x3a')]));_0x45e2ec[_0x69a4('0x3d')][_0x69a4('0x59')]=_0x163ca0['id'];if(_0x4f21f1['query']['filter']){_0x45e2ec['where']=_[_0x69a4('0x3e')](_0x45e2ec[_0x69a4('0x3d')],{'$or':_['map'](_0x45e2ec['attributes'],function(_0x5eb557){var _0x4afd89={};_0x4afd89[_0x5eb557]={'$like':'%'+_0x4f21f1[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x4afd89;})});}_0x45e2ec=_['merge']({},_0x45e2ec,_0x4f21f1[_0x69a4('0x40')]);return db[_0x69a4('0xbd')]['count']({'where':_0x45e2ec[_0x69a4('0x3d')]})[_0x69a4('0x22')](function(_0x5ea966){_0x3888dc['count']=_0x5ea966;if(_0x4f21f1[_0x69a4('0x30')][_0x69a4('0x42')]){_0x45e2ec[_0x69a4('0x43')]=[{'all':!![]}];}else{_0x45e2ec[_0x69a4('0x43')]=[{'model':db[_0x69a4('0x77')],'as':_0x69a4('0x116'),'required':![]},{'model':db['Attachment'],'as':_0x69a4('0x117'),'required':![]}];}return db['ChatOfflineMessage'][_0x69a4('0x44')](_0x45e2ec);})[_0x69a4('0x22')](function(_0x451d16){_0x3888dc['rows']=_0x451d16;return _0x3888dc;});}})[_0x69a4('0x22')](respondWithFilteredResult(_0x5ada91,_0x45e2ec))[_0x69a4('0x46')](handleError(_0x5ada91,null));};exports[_0x69a4('0x118')]=function(_0x47ac38,_0x1fbba3){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x47ac38[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x1fbba3,null))['then'](function(_0x2e5068){if(_0x2e5068){return _0x2e5068[_0x69a4('0x118')](_0x47ac38[_0x69a4('0x4c')]['ids'],_[_0x69a4('0x119')](_0x47ac38[_0x69a4('0x4c')],['ids','id'])||{})[_0x69a4('0x9f')](function(_0xea1738){for(var _0x21b657=0x0;_0x21b657<_0x47ac38[_0x69a4('0x4c')][_0x69a4('0x5b')][_0x69a4('0x35')];_0x21b657+=0x1){socket['emit'](_0x69a4('0x11a'),{'UserId':Number(_0x47ac38[_0x69a4('0x4c')][_0x69a4('0x5b')][_0x21b657]),'ChatWebsiteId':Number(_0x47ac38[_0x69a4('0x48')]['id'])});}return _0xea1738;});}})[_0x69a4('0x22')](respondWithResult(_0x1fbba3,null))['catch'](handleError(_0x1fbba3,null));};exports[_0x69a4('0x11b')]=function(_0x203ff8,_0x5de355){return db[_0x69a4('0x2a')][_0x69a4('0x4a')]({'where':{'id':_0x203ff8[_0x69a4('0x48')]['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x5de355,null))[_0x69a4('0x22')](function(_0x1b6835){if(_0x1b6835){return _0x1b6835[_0x69a4('0x11b')](_0x203ff8[_0x69a4('0x30')]['ids'])['then'](function(){if(_[_0x69a4('0x11c')](_0x203ff8[_0x69a4('0x30')]['ids'])){for(var _0x3f8045=0x0;_0x3f8045<_0x203ff8[_0x69a4('0x30')]['ids']['length'];_0x3f8045+=0x1){socket[_0x69a4('0x11d')](_0x69a4('0x11e'),{'UserId':Number(_0x203ff8[_0x69a4('0x30')]['ids'][_0x3f8045]),'ChatWebsiteId':Number(_0x203ff8['params']['id'])});}}else{socket['emit'](_0x69a4('0x11e'),{'UserId':Number(_0x203ff8[_0x69a4('0x30')]['ids']),'ChatWebsiteId':Number(_0x203ff8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5de355,null))[_0x69a4('0x46')](handleError(_0x5de355,null));};exports[_0x69a4('0x11f')]=function(_0xa69494,_0x5d1cc0){var _0x546af6={};var _0x36e0fc={};var _0x3378b2;var _0x499aa4;return db[_0x69a4('0x2a')][_0x69a4('0x57')]({'where':{'id':_0xa69494['params']['id']}})[_0x69a4('0x22')](handleEntityNotFound(_0x5d1cc0,null))[_0x69a4('0x22')](function(_0x23a3d7){if(_0x23a3d7){_0x3378b2=_0x23a3d7;_0x36e0fc[_0x69a4('0x2e')]=_[_0x69a4('0x31')](db['User'][_0x69a4('0x58')]);_0x36e0fc[_0x69a4('0x30')]=_[_0x69a4('0x31')](_0xa69494[_0x69a4('0x30')]);_0x36e0fc['filters']=_[_0x69a4('0x32')](_0x36e0fc[_0x69a4('0x2e')],_0x36e0fc[_0x69a4('0x30')]);_0x546af6[_0x69a4('0x33')]=_[_0x69a4('0x32')](_0x36e0fc[_0x69a4('0x2e')],qs[_0x69a4('0x34')](_0xa69494[_0x69a4('0x30')][_0x69a4('0x34')]));_0x546af6['attributes']=_0x546af6['attributes'][_0x69a4('0x35')]?_0x546af6[_0x69a4('0x33')]:_0x36e0fc[_0x69a4('0x2e')];_0x546af6[_0x69a4('0x38')]=qs[_0x69a4('0x39')](_0xa69494[_0x69a4('0x30')]['sort']);_0x546af6['where']=qs['filters'](_[_0x69a4('0x3b')](_0xa69494[_0x69a4('0x30')],_0x36e0fc[_0x69a4('0x3a')]));if(_0xa69494[_0x69a4('0x30')][_0x69a4('0x3c')]){_0x546af6[_0x69a4('0x3d')]=_[_0x69a4('0x3e')](_0x546af6[_0x69a4('0x3d')],{'$or':_[_0x69a4('0x2f')](_0x546af6[_0x69a4('0x33')],function(_0x2f6f00){var _0x556db6={};_0x556db6[_0x2f6f00]={'$like':'%'+_0xa69494[_0x69a4('0x30')][_0x69a4('0x3c')]+'%'};return _0x556db6;})});}_0x546af6=_['merge']({},_0x546af6,_0xa69494[_0x69a4('0x40')]);return _0x3378b2[_0x69a4('0x11f')](_0x546af6);}})[_0x69a4('0x22')](function(_0x2615f8){if(_0x2615f8){_0x499aa4=_0x2615f8[_0x69a4('0x35')];if(!_0xa69494[_0x69a4('0x30')]['hasOwnProperty']('nolimit')){_0x546af6[_0x69a4('0x20')]=qs[_0x69a4('0x20')](_0xa69494[_0x69a4('0x30')]['limit']);_0x546af6[_0x69a4('0x1e')]=qs[_0x69a4('0x1e')](_0xa69494[_0x69a4('0x30')]['offset']);}return _0x3378b2[_0x69a4('0x11f')](_0x546af6);}})[_0x69a4('0x22')](function(_0x594334){if(_0x594334){return _0x594334?{'count':_0x499aa4,'rows':_0x594334}:null;}})[_0x69a4('0x22')](respondWithResult(_0x5d1cc0,null))['catch'](handleError(_0x5d1cc0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 723de2a..57f16ed 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 _0x4b47=['update','remove','emit','exports','events','ChatWebsite','setMaxListeners','save'];(function(_0x1f23c0,_0x18fffd){var _0x56ab73=function(_0x340121){while(--_0x340121){_0x1f23c0['push'](_0x1f23c0['shift']());}};_0x56ab73(++_0x18fffd);}(_0x4b47,0x1b4));var _0x74b4=function(_0x6d5912,_0x2c82ac){_0x6d5912=_0x6d5912-0x0;var _0x1fdff9=_0x4b47[_0x6d5912];return _0x1fdff9;};'use strict';var EventEmitter=require(_0x74b4('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x74b4('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x74b4('0x2')](0x0);var events={'afterCreate':_0x74b4('0x3'),'afterUpdate':_0x74b4('0x4'),'afterDestroy':_0x74b4('0x5')};function emitEvent(_0x2795e9){return function(_0x565f6b,_0x4ed4fe,_0x27ddaf){ChatWebsiteEvents[_0x74b4('0x6')](_0x2795e9+':'+_0x565f6b['id'],_0x565f6b);ChatWebsiteEvents['emit'](_0x2795e9,_0x565f6b);_0x27ddaf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x74b4('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2a3a=['../../mysqldb','ChatWebsite','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3a077d,_0x2c2c82){var _0x6cdd2b=function(_0xad6bc){while(--_0xad6bc){_0x3a077d['push'](_0x3a077d['shift']());}};_0x6cdd2b(++_0x2c2c82);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x46537f,_0x26d93c){_0x46537f=_0x46537f-0x0;var _0x56631e=_0x2a3a[_0x46537f];return _0x56631e;};'use strict';var EventEmitter=require(_0xa2a3('0x0'));var ChatWebsite=require(_0xa2a3('0x1'))['db'][_0xa2a3('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa2a3('0x3')](0x0);var events={'afterCreate':_0xa2a3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45b267){return function(_0x34d7f9,_0x1e61b2,_0x37b041){ChatWebsiteEvents[_0xa2a3('0x5')](_0x45b267+':'+_0x34d7f9['id'],_0x34d7f9);ChatWebsiteEvents[_0xa2a3('0x5')](_0x45b267,_0x34d7f9);_0x37b041(null);};}for(var e in events){if(events[_0xa2a3('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xa2a3('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 eb087b2..a2f2e32 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 _0xdcfd=['chat_websites','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x5e6cea,_0x24b02a){var _0x55a315=function(_0x395b80){while(--_0x395b80){_0x5e6cea['push'](_0x5e6cea['shift']());}};_0x55a315(++_0x24b02a);}(_0xdcfd,0x181));var _0xddcf=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0xdcfd[_0x4a8418];return _0x390174;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xddcf('0x0'))(_0xddcf('0x1'));var moment=require(_0xddcf('0x2'));var BPromise=require('bluebird');var rp=require(_0xddcf('0x3'));var fs=require('fs');var path=require(_0xddcf('0x4'));var rimraf=require(_0xddcf('0x5'));var config=require(_0xddcf('0x6'));var attributes=require(_0xddcf('0x7'));module[_0xddcf('0x8')]=function(_0x22ba4a,_0x4910a7){return _0x22ba4a[_0xddcf('0x9')](_0xddcf('0xa'),attributes,{'tableName':_0xddcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f35=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x7f35,0x1eb));var _0x57f3=function(_0x24cc11,_0x293e8e){_0x24cc11=_0x24cc11-0x0;var _0x5c4e5c=_0x7f35[_0x24cc11];return _0x5c4e5c;};'use strict';var _=require(_0x57f3('0x0'));var util=require(_0x57f3('0x1'));var logger=require(_0x57f3('0x2'))(_0x57f3('0x3'));var moment=require('moment');var BPromise=require(_0x57f3('0x4'));var rp=require(_0x57f3('0x5'));var fs=require('fs');var path=require(_0x57f3('0x6'));var rimraf=require(_0x57f3('0x7'));var config=require(_0x57f3('0x8'));var attributes=require(_0x57f3('0x9'));module[_0x57f3('0xa')]=function(_0x217488,_0x7052c5){return _0x217488['define'](_0x57f3('0xb'),attributes,{'tableName':_0x57f3('0xc'),'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 6abbc39..c9441ea 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 _0xe580=['jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x596386,_0x58583e){var _0x2d33db=function(_0x4b59cd){while(--_0x4b59cd){_0x596386['push'](_0x596386['shift']());}};_0x2d33db(++_0x58583e);}(_0xe580,0x101));var _0x0e58=function(_0x514ea3,_0x38b18f){_0x514ea3=_0x514ea3-0x0;var _0x2654ae=_0xe580[_0x514ea3];return _0x2654ae;};'use strict';var _=require(_0x0e58('0x0'));var util=require(_0x0e58('0x1'));var moment=require(_0x0e58('0x2'));var BPromise=require(_0x0e58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e58('0x5'));var logger=require(_0x0e58('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e58('0x7'));var client=jayson['client'][_0x0e58('0x8')]({'port':0x232a});config[_0x0e58('0x9')]=_[_0x0e58('0xa')](config[_0x0e58('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e58('0xb'))(new Redis(config['redis']));require(_0x0e58('0xc'))['register'](socket);function respondWithRpcPromise(_0x594ac6,_0x154d80,_0x574bfb){return new BPromise(function(_0x52a2de,_0x59a224){return client[_0x0e58('0xd')](_0x594ac6,_0x574bfb)[_0x0e58('0xe')](function(_0x54648a){logger[_0x0e58('0xf')](_0x0e58('0x10'),_0x154d80,'request\x20sent');logger['debug'](_0x0e58('0x11'),_0x154d80,_0x0e58('0x12'),JSON[_0x0e58('0x13')](_0x54648a));if(_0x54648a[_0x0e58('0x14')]){if(_0x54648a[_0x0e58('0x14')]['code']===0x1f4){logger[_0x0e58('0x14')](_0x0e58('0x10'),_0x154d80,_0x54648a['error'][_0x0e58('0x15')]);return _0x59a224(_0x54648a[_0x0e58('0x14')][_0x0e58('0x15')]);}logger[_0x0e58('0x14')](_0x0e58('0x10'),_0x154d80,_0x54648a[_0x0e58('0x14')][_0x0e58('0x15')]);return _0x52a2de(_0x54648a['error'][_0x0e58('0x15')]);}else{logger[_0x0e58('0xf')](_0x0e58('0x10'),_0x154d80,_0x0e58('0x12'));_0x52a2de(_0x54648a[_0x0e58('0x16')][_0x0e58('0x15')]);}})[_0x0e58('0x17')](function(_0x3e07ea){logger['error'](_0x0e58('0x10'),_0x154d80,_0x3e07ea);_0x59a224(_0x3e07ea);});});} \ No newline at end of file +var _0x6539=['socket.io-emitter','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6539,0x15d));var _0x9653=function(_0x41c895,_0x31e0d8){_0x41c895=_0x41c895-0x0;var _0x15d3cd=_0x6539[_0x41c895];return _0x15d3cd;};'use strict';var _=require('lodash');var util=require(_0x9653('0x0'));var moment=require(_0x9653('0x1'));var BPromise=require(_0x9653('0x2'));var rs=require(_0x9653('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9653('0x4'))['db'];var utils=require(_0x9653('0x5'));var logger=require(_0x9653('0x6'))(_0x9653('0x7'));var config=require(_0x9653('0x8'));var jayson=require(_0x9653('0x9'));var client=jayson[_0x9653('0xa')][_0x9653('0xb')]({'port':0x232a});config[_0x9653('0xc')]=_[_0x9653('0xd')](config['redis'],{'host':_0x9653('0xe'),'port':0x18eb});var socket=require(_0x9653('0xf'))(new Redis(config[_0x9653('0xc')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x4e8718,_0x181e67,_0x4299c2){return new BPromise(function(_0x455fe0,_0xcd1000){return client[_0x9653('0x10')](_0x4e8718,_0x4299c2)[_0x9653('0x11')](function(_0x2bddc4){logger[_0x9653('0x12')](_0x9653('0x13'),_0x181e67,'request\x20sent');logger[_0x9653('0x14')](_0x9653('0x15'),_0x181e67,_0x9653('0x16'),JSON[_0x9653('0x17')](_0x2bddc4));if(_0x2bddc4['error']){if(_0x2bddc4[_0x9653('0x18')][_0x9653('0x19')]===0x1f4){logger['error'](_0x9653('0x13'),_0x181e67,_0x2bddc4[_0x9653('0x18')]['message']);return _0xcd1000(_0x2bddc4[_0x9653('0x18')][_0x9653('0x1a')]);}logger[_0x9653('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x181e67,_0x2bddc4['error'][_0x9653('0x1a')]);return _0x455fe0(_0x2bddc4[_0x9653('0x18')][_0x9653('0x1a')]);}else{logger[_0x9653('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x181e67,_0x9653('0x16'));_0x455fe0(_0x2bddc4['result']['message']);}})[_0x9653('0x1b')](function(_0x5af9de){logger[_0x9653('0x18')](_0x9653('0x13'),_0x181e67,_0x5af9de);_0xcd1000(_0x5af9de);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a808080..e1aa148 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 _0x6df0=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x2ad3d4,_0x17cc94){var _0x268254=function(_0xfb2ec){while(--_0xfb2ec){_0x2ad3d4['push'](_0x2ad3d4['shift']());}};_0x268254(++_0x17cc94);}(_0x6df0,0x18a));var _0x06df=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x6df0[_0x37ffea];return _0x2e2615;};'use strict';var ChatWebsiteEvents=require(_0x06df('0x0'));var events=[_0x06df('0x1'),_0x06df('0x2'),_0x06df('0x3')];function createListener(_0x33c327,_0x2169e6){return function(_0x264f8b){_0x2169e6[_0x06df('0x4')](_0x33c327,_0x264f8b);};}function removeListener(_0xc374f4,_0x2560bc){return function(){ChatWebsiteEvents[_0x06df('0x5')](_0xc374f4,_0x2560bc);};}exports[_0x06df('0x6')]=function(_0x201535){for(var _0x43b36f=0x0,_0x762a12=events[_0x06df('0x7')];_0x43b36f<_0x762a12;_0x43b36f++){var _0x34f247=events[_0x43b36f];var _0x24952a=createListener(_0x06df('0x8')+_0x34f247,_0x201535);ChatWebsiteEvents['on'](_0x34f247,_0x24952a);}}; \ No newline at end of file +var _0x1bf6=['update','emit','removeListener','register','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0x1bf6,0x165));var _0x61bf=function(_0x7ce2c8,_0x180339){_0x7ce2c8=_0x7ce2c8-0x0;var _0x5e7447=_0x1bf6[_0x7ce2c8];return _0x5e7447;};'use strict';var ChatWebsiteEvents=require(_0x61bf('0x0'));var events=[_0x61bf('0x1'),_0x61bf('0x2'),_0x61bf('0x3')];function createListener(_0x56d3fe,_0x166580){return function(_0xf2bb00){_0x166580[_0x61bf('0x4')](_0x56d3fe,_0xf2bb00);};}function removeListener(_0x5a043c,_0x451ec0){return function(){ChatWebsiteEvents[_0x61bf('0x5')](_0x5a043c,_0x451ec0);};}exports[_0x61bf('0x6')]=function(_0x2d7c83){for(var _0x1fb162=0x0,_0xdcc75=events['length'];_0x1fb162<_0xdcc75;_0x1fb162++){var _0x34fb40=events[_0x1fb162];var _0x403058=createListener(_0x61bf('0x7')+_0x34fb40,_0x2d7c83);ChatWebsiteEvents['on'](_0x34fb40,_0x403058);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e381044..b7c8284 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 _0x8b1e=['/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b1e,0x175));var _0xe8b1=function(_0x238b1e,_0x3cdef9){_0x238b1e=_0x238b1e-0x0;var _0x175491=_0x8b1e[_0x238b1e];return _0x175491;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8b1('0x0'));var timeout=require(_0xe8b1('0x1'));var express=require(_0xe8b1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8b1('0x3'));var interaction=require(_0xe8b1('0x4'));var config=require(_0xe8b1('0x5'));var controller=require(_0xe8b1('0x6'));router[_0xe8b1('0x7')]('/',auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x9')]);router['get'](_0xe8b1('0xa'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0xb')]);router[_0xe8b1('0x7')](_0xe8b1('0xc'),auth['isAuthenticated'](),controller[_0xe8b1('0xd')]);router['get'](_0xe8b1('0xe'),auth[_0xe8b1('0x8')](),controller['getDispositions']);router[_0xe8b1('0x7')](_0xe8b1('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe8b1('0x7')](_0xe8b1('0x10'),controller[_0xe8b1('0x11')]);router[_0xe8b1('0x7')]('/:id/avatar',controller['getAvatar']);router[_0xe8b1('0x7')]('/:id/customer_avatar',controller[_0xe8b1('0x12')]);router[_0xe8b1('0x7')](_0xe8b1('0x13'),controller['getSystemAvatar']);router['get'](_0xe8b1('0x14'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x15')]);router[_0xe8b1('0x7')]('/:id/snippet',controller[_0xe8b1('0x16')]);router[_0xe8b1('0x7')](_0xe8b1('0x17'),auth['isAuthenticated'](),controller[_0xe8b1('0x18')]);router['get'](_0xe8b1('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xe8b1('0x7')](_0xe8b1('0x1a'),controller[_0xe8b1('0x1b')]);router[_0xe8b1('0x7')](_0xe8b1('0x1c'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x1d')]);router['get']('/:id/users',auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x1e')]);router[_0xe8b1('0x1f')]('/',auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x20')]);router[_0xe8b1('0x1f')](_0xe8b1('0xe'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x21')]);router[_0xe8b1('0x1f')](_0xe8b1('0xf'),auth[_0xe8b1('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe8b1('0x22')]({'destination':function(_0x13f451,_0x760ff2,_0x296e0f){_0x296e0f(null,path[_0xe8b1('0x23')](config[_0xe8b1('0x24')],_0xe8b1('0x25')));},'filename':function(_0x54ebc7,_0x2b471c,_0x34ab8f){_0x34ab8f(null,util[_0xe8b1('0x26')](_0xe8b1('0x27'),Date[_0xe8b1('0x28')](),_0x2b471c[_0xe8b1('0x29')]));}})});router[_0xe8b1('0x1f')](_0xe8b1('0x10'),upload[_0xe8b1('0x2a')](_0xe8b1('0x2b')),controller[_0xe8b1('0x2c')]);var upload=multer({'storage':multer[_0xe8b1('0x22')]({'destination':function(_0x364423,_0x4a5d1e,_0x3aa5a6){_0x3aa5a6(null,path[_0xe8b1('0x23')](config[_0xe8b1('0x24')],_0xe8b1('0x2d')));},'filename':function(_0x57c362,_0x14e0f0,_0x215c78){_0x215c78(null,util['format'](_0xe8b1('0x27'),Date[_0xe8b1('0x28')](),_0x14e0f0['originalname']));}})});router[_0xe8b1('0x1f')](_0xe8b1('0x2e'),upload[_0xe8b1('0x2a')](_0xe8b1('0x2b')),controller[_0xe8b1('0x2f')]);var upload=multer({'storage':multer[_0xe8b1('0x22')]({'destination':function(_0x212fd8,_0x491183,_0x124979){_0x124979(null,path[_0xe8b1('0x23')](config[_0xe8b1('0x24')],_0xe8b1('0x2d')));},'filename':function(_0xe94d90,_0x13bb30,_0x18083b){_0x18083b(null,util[_0xe8b1('0x26')](_0xe8b1('0x27'),Date[_0xe8b1('0x28')](),_0x13bb30['originalname']));}})});router[_0xe8b1('0x1f')]('/:id/customer_avatar',upload['single'](_0xe8b1('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe8b1('0x22')]({'destination':function(_0x356f7a,_0x36e0ca,_0x97c3f9){_0x97c3f9(null,path[_0xe8b1('0x23')](config[_0xe8b1('0x24')],_0xe8b1('0x2d')));},'filename':function(_0xa0b936,_0x4ccbc0,_0x163a70){_0x163a70(null,util[_0xe8b1('0x26')](_0xe8b1('0x27'),Date[_0xe8b1('0x28')](),_0x4ccbc0[_0xe8b1('0x29')]));}})});router[_0xe8b1('0x1f')]('/:id/system_avatar',upload[_0xe8b1('0x2a')](_0xe8b1('0x2b')),controller[_0xe8b1('0x30')]);router[_0xe8b1('0x1f')](_0xe8b1('0x31'),controller[_0xe8b1('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xe8b1('0x22')]({'destination':function(_0x5c33e0,_0x5f1619,_0x4e1dc7){const _0x4cc22e=path[_0xe8b1('0x23')](config[_0xe8b1('0x24')],_0xe8b1('0x33'),_0xe8b1('0x34'),_0xe8b1('0x35'));fs_extra[_0xe8b1('0x36')](_0x4cc22e,function(){_0x4e1dc7(null,_0x4cc22e);});},'filename':function(_0x37258a,_0x368fff,_0x5efc19){const _0x49e2ab=_0x368fff[_0xe8b1('0x29')][_0xe8b1('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x176f2b=path['extname'](_0x49e2ab);const _0x1bcf9b=Date[_0xe8b1('0x28')]()+'-'+_0x49e2ab[_0xe8b1('0x37')](_0x176f2b,'')+_0x176f2b;_0x5efc19(null,_0x1bcf9b);}})});router[_0xe8b1('0x1f')](_0xe8b1('0x38'),offlineUploadMulter[_0xe8b1('0x39')](),controller['offline']);router[_0xe8b1('0x1f')](_0xe8b1('0x14'),auth[_0xe8b1('0x8')](),controller['addInteraction']);router[_0xe8b1('0x1f')]('/:id/applications',auth[_0xe8b1('0x8')](),controller['addApplications']);router[_0xe8b1('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xe8b1('0x1f')](_0xe8b1('0x3a'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x3b')]);router['put'](_0xe8b1('0xc'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x3c')]);router[_0xe8b1('0x3d')](_0xe8b1('0xc'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x3e')]);router['delete'](_0xe8b1('0xe'),auth['isAuthenticated'](),controller[_0xe8b1('0x3f')]);router[_0xe8b1('0x3d')](_0xe8b1('0xf'),auth[_0xe8b1('0x8')](),controller['removeAnswers']);router[_0xe8b1('0x3d')](_0xe8b1('0x3a'),auth[_0xe8b1('0x8')](),controller[_0xe8b1('0x40')]);module[_0xe8b1('0x41')]=router; \ No newline at end of file +var _0x3b3f=['../../config/environment','./chatWebsite.controller','get','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','isAuthenticated','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','/:id/avatar','addAvatar','join','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','replace','extname','any','offline','addApplications','put','update','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5eae69,_0x404ab0){var _0x5ac47a=function(_0x403f68){while(--_0x403f68){_0x5eae69['push'](_0x5eae69['shift']());}};_0x5ac47a(++_0x404ab0);}(_0x3b3f,0x105));var _0xf3b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3b3f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf3b3('0x0'));var util=require('util');var path=require(_0xf3b3('0x1'));var timeout=require(_0xf3b3('0x2'));var express=require('express');var router=express[_0xf3b3('0x3')]();var fs_extra=require(_0xf3b3('0x4'));var auth=require(_0xf3b3('0x5'));var interaction=require(_0xf3b3('0x6'));var config=require(_0xf3b3('0x7'));var controller=require(_0xf3b3('0x8'));router[_0xf3b3('0x9')]('/',auth['isAuthenticated'](),controller[_0xf3b3('0xa')]);router[_0xf3b3('0x9')](_0xf3b3('0xb'),auth['isAuthenticated'](),controller[_0xf3b3('0xc')]);router['get'](_0xf3b3('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf3b3('0x9')](_0xf3b3('0xe'),auth['isAuthenticated'](),controller[_0xf3b3('0xf')]);router[_0xf3b3('0x9')](_0xf3b3('0x10'),auth[_0xf3b3('0x11')](),controller['getAnswers']);router[_0xf3b3('0x9')](_0xf3b3('0x12'),controller[_0xf3b3('0x13')]);router['get']('/:id/avatar',controller[_0xf3b3('0x14')]);router['get'](_0xf3b3('0x15'),controller['getCustomerAvatar']);router[_0xf3b3('0x9')]('/:id/system_avatar',controller[_0xf3b3('0x16')]);router[_0xf3b3('0x9')](_0xf3b3('0x17'),auth['isAuthenticated'](),controller[_0xf3b3('0x18')]);router[_0xf3b3('0x9')](_0xf3b3('0x19'),controller[_0xf3b3('0x1a')]);router[_0xf3b3('0x9')](_0xf3b3('0x1b'),auth[_0xf3b3('0x11')](),controller['getApplications']);router[_0xf3b3('0x9')](_0xf3b3('0x1c'),auth[_0xf3b3('0x11')](),controller['getProactiveActions']);router[_0xf3b3('0x9')]('/:id/fields',controller[_0xf3b3('0x1d')]);router[_0xf3b3('0x9')](_0xf3b3('0x1e'),auth[_0xf3b3('0x11')](),controller['getOfflineMessages']);router[_0xf3b3('0x9')](_0xf3b3('0x1f'),auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x20')]);router[_0xf3b3('0x21')]('/',auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x22')]);router['post'](_0xf3b3('0xe'),auth[_0xf3b3('0x11')](),controller['addDisposition']);router[_0xf3b3('0x21')](_0xf3b3('0x10'),auth['isAuthenticated'](),controller[_0xf3b3('0x23')]);var upload=multer({'storage':multer[_0xf3b3('0x24')]({'destination':function(_0x527c79,_0x43325f,_0x35a69e){_0x35a69e(null,path['join'](config[_0xf3b3('0x25')],_0xf3b3('0x26')));},'filename':function(_0x3ff431,_0x58640f,_0x1dbc45){_0x1dbc45(null,util[_0xf3b3('0x27')](_0xf3b3('0x28'),Date[_0xf3b3('0x29')](),_0x58640f[_0xf3b3('0x2a')]));}})});router[_0xf3b3('0x21')](_0xf3b3('0x12'),upload[_0xf3b3('0x2b')](_0xf3b3('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xf3b3('0x24')]({'destination':function(_0x4d15b1,_0x3d74ab,_0x1653b8){_0x1653b8(null,path['join'](config[_0xf3b3('0x25')],'server/files/images/avatars/'));},'filename':function(_0x271f42,_0x3a47c1,_0x1287d4){_0x1287d4(null,util['format']('%s-%s',Date[_0xf3b3('0x29')](),_0x3a47c1[_0xf3b3('0x2a')]));}})});router[_0xf3b3('0x21')](_0xf3b3('0x2d'),upload[_0xf3b3('0x2b')](_0xf3b3('0x2c')),controller[_0xf3b3('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b3c37,_0xbd34f7,_0x2c98ac){_0x2c98ac(null,path[_0xf3b3('0x2f')](config[_0xf3b3('0x25')],_0xf3b3('0x30')));},'filename':function(_0x59cbb7,_0xcfb0ff,_0x2669b5){_0x2669b5(null,util['format'](_0xf3b3('0x28'),Date['now'](),_0xcfb0ff[_0xf3b3('0x2a')]));}})});router[_0xf3b3('0x21')]('/:id/customer_avatar',upload[_0xf3b3('0x2b')](_0xf3b3('0x2c')),controller[_0xf3b3('0x31')]);var upload=multer({'storage':multer[_0xf3b3('0x24')]({'destination':function(_0x4ed2be,_0x48e78f,_0x3f899a){_0x3f899a(null,path[_0xf3b3('0x2f')](config['root'],_0xf3b3('0x30')));},'filename':function(_0x40beb8,_0x309763,_0x2b9593){_0x2b9593(null,util['format']('%s-%s',Date[_0xf3b3('0x29')](),_0x309763[_0xf3b3('0x2a')]));}})});router[_0xf3b3('0x21')](_0xf3b3('0x32'),upload[_0xf3b3('0x2b')](_0xf3b3('0x2c')),controller[_0xf3b3('0x33')]);router[_0xf3b3('0x21')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf3b3('0x24')]({'destination':function(_0x57ced7,_0x365083,_0x2920bc){const _0x8feb29=path[_0xf3b3('0x2f')](config[_0xf3b3('0x25')],_0xf3b3('0x34'),_0xf3b3('0x35'),_0xf3b3('0x36'));fs_extra[_0xf3b3('0x37')](_0x8feb29,function(){_0x2920bc(null,_0x8feb29);});},'filename':function(_0x51b9e8,_0x4ea3e8,_0x541dbd){const _0x4f1e46=_0x4ea3e8[_0xf3b3('0x2a')][_0xf3b3('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x240938=path[_0xf3b3('0x39')](_0x4f1e46);const _0x2fb8ac=Date[_0xf3b3('0x29')]()+'-'+_0x4f1e46[_0xf3b3('0x38')](_0x240938,'')+_0x240938;_0x541dbd(null,_0x2fb8ac);}})});router['post']('/:id/offline',offlineUploadMulter[_0xf3b3('0x3a')](),controller[_0xf3b3('0x3b')]);router[_0xf3b3('0x21')](_0xf3b3('0x17'),auth[_0xf3b3('0x11')](),controller['addInteraction']);router[_0xf3b3('0x21')](_0xf3b3('0x1b'),auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x3c')]);router[_0xf3b3('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0xf3b3('0x1f'),auth[_0xf3b3('0x11')](),controller['addAgents']);router[_0xf3b3('0x3d')](_0xf3b3('0xd'),auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x3e')]);router[_0xf3b3('0x3f')](_0xf3b3('0xd'),auth[_0xf3b3('0x11')](),controller['destroy']);router[_0xf3b3('0x3f')](_0xf3b3('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf3b3('0x3f')](_0xf3b3('0x10'),auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x40')]);router[_0xf3b3('0x3f')](_0xf3b3('0x1f'),auth[_0xf3b3('0x11')](),controller[_0xf3b3('0x41')]);module[_0xf3b3('0x42')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 6f8378c..8ca2a0a 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x647c=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x21549c,_0x24d668){var _0x25ad23=function(_0x517d14){while(--_0x517d14){_0x21549c['push'](_0x21549c['shift']());}};_0x25ad23(++_0x24d668);}(_0x647c,0x10c));var _0xc647=function(_0x59bd6a,_0x540db8){_0x59bd6a=_0x59bd6a-0x0;var _0x54ffd0=_0x647c[_0x59bd6a];return _0x54ffd0;};var beaverLogger=require(_0xc647('0x0'));var express=require(_0xc647('0x1'));var auth=require(_0xc647('0x2'));var config=require(_0xc647('0x3'));var router=express['Router']();var isProduction=config[_0xc647('0x4')]===_0xc647('0x5')||![];function clientSideLogs(_0x40629c,_0x2dedb5,_0x15726f){var _0x818d86=_0x40629c[_0xc647('0x6')][_0xc647('0x7')]('client-side-logger');if(!_0x818d86){throw new Error(_0xc647('0x8'));}return beaverLogger[_0xc647('0x9')]({'uri':_0xc647('0xa'),'logger':_0x818d86,'enableCors':!isProduction})(_0x40629c,_0x2dedb5,_0x15726f);}router[_0xc647('0xb')](auth[_0xc647('0xc')](),clientSideLogs);module[_0xc647('0xd')]=router; \ No newline at end of file +var _0xa0f8=['app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','production'];(function(_0x11b120,_0x2c6472){var _0x33e40d=function(_0x265cfd){while(--_0x265cfd){_0x11b120['push'](_0x11b120['shift']());}};_0x33e40d(++_0x2c6472);}(_0xa0f8,0x103));var _0x8a0f=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0xa0f8[_0x1d4923];return _0x14ea9a;};var beaverLogger=require(_0x8a0f('0x0'));var express=require(_0x8a0f('0x1'));var auth=require(_0x8a0f('0x2'));var config=require(_0x8a0f('0x3'));var router=express['Router']();var isProduction=config['env']===_0x8a0f('0x4')||![];function clientSideLogs(_0x1b972b,_0xb9f1c0,_0x476936){var _0x325b3a=_0x1b972b[_0x8a0f('0x5')]['get'](_0x8a0f('0x6'));if(!_0x325b3a){throw new Error(_0x8a0f('0x7'));}return beaverLogger[_0x8a0f('0x8')]({'uri':'/client-logs','logger':_0x325b3a,'enableCors':!isProduction})(_0x1b972b,_0xb9f1c0,_0x476936);}router[_0x8a0f('0x9')](auth[_0x8a0f('0xa')](),clientSideLogs);module[_0x8a0f('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b957fce..3dbe074 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 _0x2e92=['Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x22e429,_0x274567){var _0x39bde9=function(_0x34d023){while(--_0x34d023){_0x22e429['push'](_0x22e429['shift']());}};_0x39bde9(++_0x274567);}(_0x2e92,0xdb));var _0x22e9=function(_0x5927f8,_0x420239){_0x5927f8=_0x5927f8-0x0;var _0x399a2f=_0x2e92[_0x5927f8];return _0x399a2f;};'use strict';var Sequelize=require(_0x22e9('0x0'));module[_0x22e9('0x1')]={'name':{'type':Sequelize[_0x22e9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x22e9('0x3')](_0x22e9('0x4'),_0x22e9('0x5'),_0x22e9('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x22e9('0x3')](_0x22e9('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x22e9('0x2')],'comment':_0x22e9('0x8')},'data2':{'type':Sequelize[_0x22e9('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x22e9('0x2')],'comment':_0x22e9('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x22e9('0xa')},'data5':{'type':Sequelize[_0x22e9('0xb')],'comment':_0x22e9('0xc')},'data6':{'type':Sequelize[_0x22e9('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x22e9('0xb')],'comment':_0x22e9('0xd')}}; \ No newline at end of file +var _0x7648=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x1f3def,_0x175b37){var _0x42186e=function(_0x5814bb){while(--_0x5814bb){_0x1f3def['push'](_0x1f3def['shift']());}};_0x42186e(++_0x175b37);}(_0x7648,0x16f));var _0x8764=function(_0x88a29e,_0x483c69){_0x88a29e=_0x88a29e-0x0;var _0x218bd1=_0x7648[_0x88a29e];return _0x218bd1;};'use strict';var Sequelize=require(_0x8764('0x0'));module['exports']={'name':{'type':Sequelize[_0x8764('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8764('0x2')](_0x8764('0x3'),_0x8764('0x4'),_0x8764('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8764('0x2')]('Outlook365',_0x8764('0x6'))},'data1':{'type':Sequelize[_0x8764('0x1')],'comment':_0x8764('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0x8764('0x8')},'data3':{'type':Sequelize[_0x8764('0x1')],'comment':_0x8764('0x9')},'data4':{'type':Sequelize[_0x8764('0x1')],'comment':_0x8764('0xa')},'data5':{'type':Sequelize[_0x8764('0xb')],'comment':_0x8764('0xc')},'data6':{'type':Sequelize[_0x8764('0xb')],'comment':_0x8764('0xd')},'data7':{'type':Sequelize[_0x8764('0xb')],'comment':_0x8764('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b834ed5..9e7e7be 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 _0xc711=['includeAll','include','options','MicrosoftAzure','create','body','Service\x20parameter\x20not\x20specified','includes','join','find','params','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','status','end','offset','undefined','limit','set','json','update','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','keys','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','rows','service','decryptString','data3','catch','show','length'];(function(_0x15b281,_0x571cb4){var _0x372ee8=function(_0x16f32f){while(--_0x16f32f){_0x15b281['push'](_0x15b281['shift']());}};_0x372ee8(++_0x571cb4);}(_0xc711,0x13b));var _0x1c71=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0xc711[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x1c71('0x0'));var config=require('../../config/environment');var logger=require(_0x1c71('0x1'))(_0x1c71('0x2'));var db=require(_0x1c71('0x3'))['db'];var oauth=require(_0x1c71('0x4'));config[_0x1c71('0x5')]=_[_0x1c71('0x6')](config[_0x1c71('0x5')],{'host':_0x1c71('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c71('0x5')]));var redis=new Redis(config[_0x1c71('0x5')]);function respondWithStatusCode(_0x361251,_0x295e12){_0x295e12=_0x295e12||0xcc;return function(_0x114cfe){if(_0x114cfe){return _0x361251['sendStatus'](_0x295e12);}return _0x361251[_0x1c71('0x8')](_0x295e12)[_0x1c71('0x9')]();};}function respondWithResult(_0x507ddc,_0x1b1416){_0x1b1416=_0x1b1416||0xc8;return function(_0x29f651){if(_0x29f651){return _0x507ddc[_0x1c71('0x8')](_0x1b1416)['json'](_0x29f651);}};}function respondWithFilteredResult(_0x1e0acf,_0x1d0908){return function(_0x1631e1){if(_0x1631e1){var _0x46cb3f=typeof _0x1d0908[_0x1c71('0xa')]===_0x1c71('0xb')&&typeof _0x1d0908['limit']==='undefined';var _0x384a81=_0x1631e1['count'];var _0x26440f=_0x46cb3f?0x0:_0x1d0908['offset'];var _0x56b325=_0x46cb3f?_0x1631e1['count']:_0x1d0908[_0x1c71('0xa')]+_0x1d0908[_0x1c71('0xc')];var _0x8c04b7;if(_0x56b325>=_0x384a81){_0x56b325=_0x384a81;_0x8c04b7=0xc8;}else{_0x8c04b7=0xce;}_0x1e0acf['status'](_0x8c04b7);return _0x1e0acf[_0x1c71('0xd')]('Content-Range',_0x26440f+'-'+_0x56b325+'/'+_0x384a81)[_0x1c71('0xe')](_0x1631e1);}return null;};}function saveUpdates(_0x2bc642){return function(_0xe6b8b0){if(_0xe6b8b0){return _0xe6b8b0[_0x1c71('0xf')](_0x2bc642)[_0x1c71('0x10')](function(_0x50aa36){return _0x50aa36;});}return null;};}function removeEntity(_0x5f31e4){return function(_0x487317){if(_0x487317){return _0x487317[_0x1c71('0x11')]()[_0x1c71('0x10')](function(){_0x5f31e4[_0x1c71('0x8')](0xcc)[_0x1c71('0x9')]();});}};}function handleEntityNotFound(_0x36e1b3){return function(_0x55c78c){if(!_0x55c78c){_0x36e1b3[_0x1c71('0x12')](0x194);}return _0x55c78c;};}function handleError(_0x3b169b,_0x45aab0){_0x45aab0=_0x45aab0||0x1f4;return function(_0x410d02){logger[_0x1c71('0x13')](_0x410d02[_0x1c71('0x14')]);if(_0x410d02['name']){delete _0x410d02[_0x1c71('0x15')];}_0x3b169b[_0x1c71('0x8')](_0x45aab0)[_0x1c71('0x16')](_0x410d02);};}function maskClientSecret(_0x540727){return _[_0x1c71('0x17')](_0x540727[_0x1c71('0x18')](0x0,0x3),0x14,'*');}exports[_0x1c71('0x19')]=function(_0x1f788f,_0x555555){var _0x3282a1={},_0x44e73f={},_0x567c04={'count':0x0,'rows':[]};var _0x56b987=_[_0x1c71('0x1a')](db[_0x1c71('0x1b')][_0x1c71('0x1c')],function(_0x24f7a8){return{'name':_0x24f7a8[_0x1c71('0x1d')],'type':_0x24f7a8[_0x1c71('0x1e')]['key']};});_0x44e73f['model']=_['map'](_0x56b987,_0x1c71('0x15'));_0x44e73f['query']=_[_0x1c71('0x1f')](_0x1f788f[_0x1c71('0x20')]);_0x44e73f['filters']=_['intersection'](_0x44e73f[_0x1c71('0x21')],_0x44e73f[_0x1c71('0x20')]);_0x3282a1[_0x1c71('0x22')]=_[_0x1c71('0x23')](_0x44e73f['model'],qs[_0x1c71('0x24')](_0x1f788f[_0x1c71('0x20')][_0x1c71('0x24')]));_0x3282a1[_0x1c71('0x22')]=_0x3282a1[_0x1c71('0x22')]['length']?_0x3282a1[_0x1c71('0x22')]:_0x44e73f[_0x1c71('0x21')];if(!_0x1f788f[_0x1c71('0x20')][_0x1c71('0x25')](_0x1c71('0x26'))){_0x3282a1[_0x1c71('0xc')]=qs[_0x1c71('0xc')](_0x1f788f['query'][_0x1c71('0xc')]);_0x3282a1[_0x1c71('0xa')]=qs[_0x1c71('0xa')](_0x1f788f['query']['offset']);}_0x3282a1['order']=qs['sort'](_0x1f788f['query'][_0x1c71('0x27')]);_0x3282a1[_0x1c71('0x28')]=qs['filters'](_[_0x1c71('0x29')](_0x1f788f[_0x1c71('0x20')],_0x44e73f['filters']),_0x56b987);if(_0x1f788f['query']['filter']){_0x3282a1['where']=_[_0x1c71('0x2a')](_0x3282a1[_0x1c71('0x28')],{'$or':_['map'](_0x56b987,function(_0xae89b7){if(_0xae89b7[_0x1c71('0x1e')]!==_0x1c71('0x2b')){var _0x8baff7={};_0x8baff7[_0xae89b7['name']]={'$like':'%'+_0x1f788f[_0x1c71('0x20')][_0x1c71('0x2c')]+'%'};return _0x8baff7;}})});}_0x3282a1=_[_0x1c71('0x2a')]({},_0x3282a1,_0x1f788f['options']);var _0x7923cf={'where':_0x3282a1['where']};return db[_0x1c71('0x1b')][_0x1c71('0x2d')](_0x7923cf)[_0x1c71('0x10')](function(_0x3f0760){_0x567c04[_0x1c71('0x2d')]=_0x3f0760;if(_0x1f788f[_0x1c71('0x20')]['includeAll']){_0x3282a1['include']=[{'all':!![]}];}return db[_0x1c71('0x1b')]['findAll'](_0x3282a1);})['then'](function(_0x1f8b36){_0x567c04[_0x1c71('0x2e')]=_[_0x1c71('0x1a')](_0x1f8b36,function(_0x14c63c){if(_0x14c63c[_0x1c71('0x2f')]==='MicrosoftAzure'){var _0x49ba46=encryptor[_0x1c71('0x30')](_0x14c63c[_0x1c71('0x31')]);_0x14c63c[_0x1c71('0x31')]=maskClientSecret(_0x49ba46);}return _0x14c63c;});return _0x567c04;})['then'](respondWithFilteredResult(_0x555555,_0x3282a1))[_0x1c71('0x32')](handleError(_0x555555,null));};exports[_0x1c71('0x33')]=function(_0x390b6f,_0x274e0c){var _0x582e5f={'raw':!![],'where':{'id':_0x390b6f['params']['id']}},_0x9b5c3d={};_0x9b5c3d[_0x1c71('0x21')]=_[_0x1c71('0x1f')](db[_0x1c71('0x1b')]['rawAttributes']);_0x9b5c3d['query']=_[_0x1c71('0x1f')](_0x390b6f['query']);_0x9b5c3d['filters']=_[_0x1c71('0x23')](_0x9b5c3d[_0x1c71('0x21')],_0x9b5c3d[_0x1c71('0x20')]);_0x582e5f[_0x1c71('0x22')]=_[_0x1c71('0x23')](_0x9b5c3d[_0x1c71('0x21')],qs[_0x1c71('0x24')](_0x390b6f[_0x1c71('0x20')][_0x1c71('0x24')]));_0x582e5f[_0x1c71('0x22')]=_0x582e5f[_0x1c71('0x22')][_0x1c71('0x34')]?_0x582e5f['attributes']:_0x9b5c3d['model'];if(_0x390b6f['query'][_0x1c71('0x35')]){_0x582e5f[_0x1c71('0x36')]=[{'all':!![]}];}_0x582e5f=_[_0x1c71('0x2a')]({},_0x582e5f,_0x390b6f[_0x1c71('0x37')]);return db['CloudProvider']['find'](_0x582e5f)[_0x1c71('0x10')](handleEntityNotFound(_0x274e0c,null))[_0x1c71('0x10')](function(_0x102989){if(_0x102989[_0x1c71('0x2f')]===_0x1c71('0x38')){var _0x556659=encryptor['decryptString'](_0x102989[_0x1c71('0x31')]);_0x102989[_0x1c71('0x31')]=maskClientSecret(_0x556659);}return _0x102989;})['then'](respondWithResult(_0x274e0c,null))[_0x1c71('0x32')](handleError(_0x274e0c,null));};exports[_0x1c71('0x39')]=function(_0x43108d,_0x26c48e){if(!_0x43108d[_0x1c71('0x3a')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x43108d[_0x1c71('0x3a')][_0x1c71('0x2f')])throw new Error(_0x1c71('0x3b'));var _0x51f4f0=db[_0x1c71('0x1b')][_0x1c71('0x1c')][_0x1c71('0x2f')]['values'];if(!_0x51f4f0[_0x1c71('0x3c')](_0x43108d['body'][_0x1c71('0x2f')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x51f4f0[_0x1c71('0x3d')](',\x20'));if(_0x43108d[_0x1c71('0x3a')][_0x1c71('0x2f')]===_0x1c71('0x38')&&_0x43108d['body'][_0x1c71('0x31')]){_0x43108d['body'][_0x1c71('0x31')]=encryptor['encryptString'](_0x43108d['body'][_0x1c71('0x31')]);}return db[_0x1c71('0x1b')]['create'](_0x43108d[_0x1c71('0x3a')],{})[_0x1c71('0x10')](respondWithResult(_0x26c48e,0xc9))['catch'](handleError(_0x26c48e,null));};exports[_0x1c71('0xf')]=function(_0x51bf15,_0x1cc1ba){if(_0x51bf15[_0x1c71('0x3a')]['id']){delete _0x51bf15[_0x1c71('0x3a')]['id'];}return db[_0x1c71('0x1b')][_0x1c71('0x3e')]({'where':{'id':_0x51bf15[_0x1c71('0x3f')]['id']}})[_0x1c71('0x10')](handleEntityNotFound(_0x1cc1ba,null))[_0x1c71('0x10')](function(_0x909c4b){if(_0x909c4b[_0x1c71('0x2f')]===_0x1c71('0x38')&&_0x51bf15[_0x1c71('0x3a')][_0x1c71('0x31')]){_0x51bf15[_0x1c71('0x3a')][_0x1c71('0x31')]=encryptor[_0x1c71('0x40')](_0x51bf15[_0x1c71('0x3a')][_0x1c71('0x31')]);}return _0x909c4b;})[_0x1c71('0x10')](saveUpdates(_0x51bf15['body'],null))[_0x1c71('0x10')](respondWithResult(_0x1cc1ba,null))[_0x1c71('0x32')](handleError(_0x1cc1ba,null));};exports[_0x1c71('0x11')]=function(_0xb86059,_0x383634){return db[_0x1c71('0x1b')][_0x1c71('0x3e')]({'where':{'id':_0xb86059[_0x1c71('0x3f')]['id']}})[_0x1c71('0x10')](handleEntityNotFound(_0x383634,null))[_0x1c71('0x10')](removeEntity(_0x383634,null))['catch'](handleError(_0x383634,null));};exports[_0x1c71('0x41')]=function(_0x52399b,_0x445ea7){return db[_0x1c71('0x1b')]['findOne']({'where':{'id':_0x52399b[_0x1c71('0x3f')]['id']},'raw':!![]})['then'](function(_0x1e73a6){if(!_0x1e73a6)return _0x445ea7['sendStatus'](0x194);return{'url':oauth[_0x1c71('0x42')](_0x1e73a6,_0x52399b[_0x1c71('0x43')]['id'])};})[_0x1c71('0x10')](respondWithResult(_0x445ea7,null))['catch'](handleError(_0x445ea7,null));};exports[_0x1c71('0x44')]=function(_0x25901d,_0x5766da){var _0x21039e=_0x25901d[_0x1c71('0x3a')];var _0xf19e1c;var _0x5a93e0;if(_0x21039e[_0x1c71('0x13')])throw _0x21039e;redis[_0x1c71('0x45')](_0x21039e['state'])[_0x1c71('0x10')](function(_0x5bf094){if(!_0x5bf094)throw new Error(_0x1c71('0x46'));_0xf19e1c=JSON[_0x1c71('0x47')](_0x5bf094);var _0x3af11d=Buffer[_0x1c71('0x48')](_0x21039e['state'],_0x1c71('0x49'))[_0x1c71('0x4a')](_0x1c71('0x4b'));_0x5a93e0=JSON[_0x1c71('0x47')](_0x3af11d);if(!oauth[_0x1c71('0x4c')](_0x21039e['id_token'],_0xf19e1c['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x1c71('0x4d')](_0x21039e[_0x1c71('0x4e')]);return oauth[_0x1c71('0x4f')](_0x21039e[_0x1c71('0x50')],_0xf19e1c);})['then'](function(_0x2d961b){_0xf19e1c[_0x1c71('0x51')]=_0x2d961b[_0x1c71('0x52')];_0xf19e1c[_0x1c71('0x53')]=_0x2d961b[_0x1c71('0x54')];return db[_0x1c71('0x1b')][_0x1c71('0xf')]({'data5':_0xf19e1c[_0x1c71('0x51')],'data6':_0xf19e1c[_0x1c71('0x53')]},{'where':{'id':_0xf19e1c['id']}});})[_0x1c71('0x10')](function(){oauth['startRefreshInterval'](_0xf19e1c);socket[_0x1c71('0x55')](_0x1c71('0x56'),{'id':_0x5a93e0['id']});return;})[_0x1c71('0x10')](respondWithStatusCode(_0x5766da,null))[_0x1c71('0x32')](function(_0x244a07){if(_0x5a93e0){socket[_0x1c71('0x55')](_0x1c71('0x57'),{'id':_0x5a93e0['id']});}if(!_0xf19e1c){logger[_0x1c71('0x13')](_0x1c71('0x58'),_0x244a07);return _0x5766da['status'](0x1f4)[_0x1c71('0x16')](_0x244a07[_0x1c71('0x59')]);}logger[_0x1c71('0x13')](_0x1c71('0x5a'),_0xf19e1c['id'],JSON[_0x1c71('0x5b')](_0x244a07));});}; \ No newline at end of file +var _0x57db=['then','error','stack','name','padEnd','slice','index','map','CloudProvider','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','params','keys','rawAttributes','length','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','from','base64','toString','parse','isValidIdToken','id_token','del','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','redis','socket.io-emitter','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range'];(function(_0x5883e5,_0x41e9a4){var _0x31e53f=function(_0x36b6f7){while(--_0x36b6f7){_0x5883e5['push'](_0x5883e5['shift']());}};_0x31e53f(++_0x41e9a4);}(_0x57db,0xa3));var _0xb57d=function(_0x32231d,_0x1bea27){_0x32231d=_0x32231d-0x0;var _0x4a0fae=_0x57db[_0x32231d];return _0x4a0fae;};'use strict';var _=require('lodash');var Redis=require(_0xb57d('0x0'));var qs=require(_0xb57d('0x1'));var encryptor=require(_0xb57d('0x2'));var config=require(_0xb57d('0x3'));var logger=require('../../config/logger')(_0xb57d('0x4'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xb57d('0x5')]=_['defaults'](config[_0xb57d('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xb57d('0x6'))(new Redis(config[_0xb57d('0x5')]));var redis=new Redis(config[_0xb57d('0x5')]);function respondWithStatusCode(_0x3dffcb,_0x4da55c){_0x4da55c=_0x4da55c||0xcc;return function(_0x2db2af){if(_0x2db2af){return _0x3dffcb[_0xb57d('0x7')](_0x4da55c);}return _0x3dffcb[_0xb57d('0x8')](_0x4da55c)[_0xb57d('0x9')]();};}function respondWithResult(_0x374311,_0x460cd8){_0x460cd8=_0x460cd8||0xc8;return function(_0x59ad17){if(_0x59ad17){return _0x374311[_0xb57d('0x8')](_0x460cd8)[_0xb57d('0xa')](_0x59ad17);}};}function respondWithFilteredResult(_0x167db5,_0x166c1a){return function(_0x443615){if(_0x443615){var _0x5788a5=typeof _0x166c1a['offset']===_0xb57d('0xb')&&typeof _0x166c1a[_0xb57d('0xc')]===_0xb57d('0xb');var _0x246615=_0x443615['count'];var _0x1862ff=_0x5788a5?0x0:_0x166c1a[_0xb57d('0xd')];var _0x12d1d6=_0x5788a5?_0x443615[_0xb57d('0xe')]:_0x166c1a[_0xb57d('0xd')]+_0x166c1a[_0xb57d('0xc')];var _0x100611;if(_0x12d1d6>=_0x246615){_0x12d1d6=_0x246615;_0x100611=0xc8;}else{_0x100611=0xce;}_0x167db5[_0xb57d('0x8')](_0x100611);return _0x167db5[_0xb57d('0xf')](_0xb57d('0x10'),_0x1862ff+'-'+_0x12d1d6+'/'+_0x246615)[_0xb57d('0xa')](_0x443615);}return null;};}function saveUpdates(_0x4f26e4){return function(_0x53e456){if(_0x53e456){return _0x53e456['update'](_0x4f26e4)[_0xb57d('0x11')](function(_0x1c72c0){return _0x1c72c0;});}return null;};}function removeEntity(_0x11d3f1){return function(_0x2202f2){if(_0x2202f2){return _0x2202f2['destroy']()[_0xb57d('0x11')](function(){_0x11d3f1[_0xb57d('0x8')](0xcc)[_0xb57d('0x9')]();});}};}function handleEntityNotFound(_0x4e7a2a){return function(_0x529bc6){if(!_0x529bc6){_0x4e7a2a[_0xb57d('0x7')](0x194);}return _0x529bc6;};}function handleError(_0x1f0fb8,_0x26f7f7){_0x26f7f7=_0x26f7f7||0x1f4;return function(_0x43883e){logger[_0xb57d('0x12')](_0x43883e[_0xb57d('0x13')]);if(_0x43883e[_0xb57d('0x14')]){delete _0x43883e['name'];}_0x1f0fb8['status'](_0x26f7f7)['send'](_0x43883e);};}function maskClientSecret(_0x2f8918){return _[_0xb57d('0x15')](_0x2f8918[_0xb57d('0x16')](0x0,0x3),0x14,'*');}exports[_0xb57d('0x17')]=function(_0xe0258e,_0x470395){var _0x42c816={},_0x1454cc={},_0x401565={'count':0x0,'rows':[]};var _0x275017=_[_0xb57d('0x18')](db[_0xb57d('0x19')]['rawAttributes'],function(_0x314652){return{'name':_0x314652['fieldName'],'type':_0x314652[_0xb57d('0x1a')]['key']};});_0x1454cc[_0xb57d('0x1b')]=_[_0xb57d('0x18')](_0x275017,'name');_0x1454cc['query']=_['keys'](_0xe0258e[_0xb57d('0x1c')]);_0x1454cc[_0xb57d('0x1d')]=_[_0xb57d('0x1e')](_0x1454cc[_0xb57d('0x1b')],_0x1454cc[_0xb57d('0x1c')]);_0x42c816[_0xb57d('0x1f')]=_[_0xb57d('0x1e')](_0x1454cc[_0xb57d('0x1b')],qs[_0xb57d('0x20')](_0xe0258e[_0xb57d('0x1c')]['fields']));_0x42c816['attributes']=_0x42c816[_0xb57d('0x1f')]['length']?_0x42c816[_0xb57d('0x1f')]:_0x1454cc[_0xb57d('0x1b')];if(!_0xe0258e['query']['hasOwnProperty'](_0xb57d('0x21'))){_0x42c816[_0xb57d('0xc')]=qs[_0xb57d('0xc')](_0xe0258e['query'][_0xb57d('0xc')]);_0x42c816['offset']=qs[_0xb57d('0xd')](_0xe0258e[_0xb57d('0x1c')]['offset']);}_0x42c816[_0xb57d('0x22')]=qs[_0xb57d('0x23')](_0xe0258e[_0xb57d('0x1c')][_0xb57d('0x23')]);_0x42c816[_0xb57d('0x24')]=qs[_0xb57d('0x1d')](_[_0xb57d('0x25')](_0xe0258e[_0xb57d('0x1c')],_0x1454cc['filters']),_0x275017);if(_0xe0258e[_0xb57d('0x1c')][_0xb57d('0x26')]){_0x42c816[_0xb57d('0x24')]=_[_0xb57d('0x27')](_0x42c816[_0xb57d('0x24')],{'$or':_[_0xb57d('0x18')](_0x275017,function(_0x547b22){if(_0x547b22[_0xb57d('0x1a')]!==_0xb57d('0x28')){var _0xf2b42a={};_0xf2b42a[_0x547b22[_0xb57d('0x14')]]={'$like':'%'+_0xe0258e['query'][_0xb57d('0x26')]+'%'};return _0xf2b42a;}})});}_0x42c816=_[_0xb57d('0x27')]({},_0x42c816,_0xe0258e[_0xb57d('0x29')]);var _0x57674d={'where':_0x42c816[_0xb57d('0x24')]};return db[_0xb57d('0x19')][_0xb57d('0xe')](_0x57674d)[_0xb57d('0x11')](function(_0x5ed4f8){_0x401565[_0xb57d('0xe')]=_0x5ed4f8;if(_0xe0258e['query'][_0xb57d('0x2a')]){_0x42c816[_0xb57d('0x2b')]=[{'all':!![]}];}return db[_0xb57d('0x19')][_0xb57d('0x2c')](_0x42c816);})[_0xb57d('0x11')](function(_0x7d3378){_0x401565[_0xb57d('0x2d')]=_[_0xb57d('0x18')](_0x7d3378,function(_0x309b8c){if(_0x309b8c[_0xb57d('0x2e')]===_0xb57d('0x2f')){var _0x579a32=encryptor['decryptString'](_0x309b8c[_0xb57d('0x30')]);_0x309b8c[_0xb57d('0x30')]=maskClientSecret(_0x579a32);}return _0x309b8c;});return _0x401565;})[_0xb57d('0x11')](respondWithFilteredResult(_0x470395,_0x42c816))[_0xb57d('0x31')](handleError(_0x470395,null));};exports['show']=function(_0xb3658b,_0x44836e){var _0x346bff={'raw':!![],'where':{'id':_0xb3658b[_0xb57d('0x32')]['id']}},_0x398516={};_0x398516[_0xb57d('0x1b')]=_[_0xb57d('0x33')](db[_0xb57d('0x19')][_0xb57d('0x34')]);_0x398516[_0xb57d('0x1c')]=_[_0xb57d('0x33')](_0xb3658b['query']);_0x398516[_0xb57d('0x1d')]=_['intersection'](_0x398516[_0xb57d('0x1b')],_0x398516[_0xb57d('0x1c')]);_0x346bff[_0xb57d('0x1f')]=_[_0xb57d('0x1e')](_0x398516['model'],qs[_0xb57d('0x20')](_0xb3658b[_0xb57d('0x1c')]['fields']));_0x346bff['attributes']=_0x346bff[_0xb57d('0x1f')][_0xb57d('0x35')]?_0x346bff[_0xb57d('0x1f')]:_0x398516[_0xb57d('0x1b')];if(_0xb3658b[_0xb57d('0x1c')][_0xb57d('0x2a')]){_0x346bff['include']=[{'all':!![]}];}_0x346bff=_['merge']({},_0x346bff,_0xb3658b['options']);return db[_0xb57d('0x19')][_0xb57d('0x36')](_0x346bff)[_0xb57d('0x11')](handleEntityNotFound(_0x44836e,null))['then'](function(_0x184825){if(_0x184825[_0xb57d('0x2e')]===_0xb57d('0x2f')){var _0x11ad07=encryptor[_0xb57d('0x37')](_0x184825[_0xb57d('0x30')]);_0x184825['data3']=maskClientSecret(_0x11ad07);}return _0x184825;})['then'](respondWithResult(_0x44836e,null))['catch'](handleError(_0x44836e,null));};exports[_0xb57d('0x38')]=function(_0x19c28e,_0xa69c4d){if(!_0x19c28e[_0xb57d('0x39')][_0xb57d('0x14')])throw new Error(_0xb57d('0x3a'));if(!_0x19c28e['body']['service'])throw new Error(_0xb57d('0x3b'));var _0x1c5baa=db['CloudProvider'][_0xb57d('0x34')]['service'][_0xb57d('0x3c')];if(!_0x1c5baa[_0xb57d('0x3d')](_0x19c28e[_0xb57d('0x39')][_0xb57d('0x2e')]))throw new Error(_0xb57d('0x3e')+_0x1c5baa['join'](',\x20'));if(_0x19c28e['body'][_0xb57d('0x2e')]===_0xb57d('0x2f')&&_0x19c28e['body'][_0xb57d('0x30')]){_0x19c28e[_0xb57d('0x39')]['data3']=encryptor[_0xb57d('0x3f')](_0x19c28e['body'][_0xb57d('0x30')]);}return db[_0xb57d('0x19')][_0xb57d('0x38')](_0x19c28e[_0xb57d('0x39')],{})['then'](respondWithResult(_0xa69c4d,0xc9))[_0xb57d('0x31')](handleError(_0xa69c4d,null));};exports[_0xb57d('0x40')]=function(_0x1a0d0c,_0x48107a){if(_0x1a0d0c['body']['id']){delete _0x1a0d0c[_0xb57d('0x39')]['id'];}return db[_0xb57d('0x19')][_0xb57d('0x36')]({'where':{'id':_0x1a0d0c[_0xb57d('0x32')]['id']}})[_0xb57d('0x11')](handleEntityNotFound(_0x48107a,null))['then'](function(_0x36a813){if(_0x36a813[_0xb57d('0x2e')]===_0xb57d('0x2f')&&_0x1a0d0c[_0xb57d('0x39')]['data3']){_0x1a0d0c[_0xb57d('0x39')][_0xb57d('0x30')]=encryptor[_0xb57d('0x3f')](_0x1a0d0c[_0xb57d('0x39')][_0xb57d('0x30')]);}return _0x36a813;})[_0xb57d('0x11')](saveUpdates(_0x1a0d0c[_0xb57d('0x39')],null))[_0xb57d('0x11')](respondWithResult(_0x48107a,null))[_0xb57d('0x31')](handleError(_0x48107a,null));};exports[_0xb57d('0x41')]=function(_0x1c5b29,_0x40f708){return db['CloudProvider'][_0xb57d('0x36')]({'where':{'id':_0x1c5b29['params']['id']}})[_0xb57d('0x11')](handleEntityNotFound(_0x40f708,null))['then'](removeEntity(_0x40f708,null))[_0xb57d('0x31')](handleError(_0x40f708,null));};exports[_0xb57d('0x42')]=function(_0x21489a,_0x3604c7){return db[_0xb57d('0x19')][_0xb57d('0x43')]({'where':{'id':_0x21489a[_0xb57d('0x32')]['id']},'raw':!![]})[_0xb57d('0x11')](function(_0x5aee54){if(!_0x5aee54)return _0x3604c7['sendStatus'](0x194);return{'url':oauth[_0xb57d('0x44')](_0x5aee54,_0x21489a['user']['id'])};})[_0xb57d('0x11')](respondWithResult(_0x3604c7,null))['catch'](handleError(_0x3604c7,null));};exports[_0xb57d('0x45')]=function(_0x3b0e92,_0x44db5b){var _0xed0924=_0x3b0e92[_0xb57d('0x39')];var _0x2b583e;var _0xae5311;if(_0xed0924[_0xb57d('0x12')])throw _0xed0924;redis['get'](_0xed0924[_0xb57d('0x46')])[_0xb57d('0x11')](function(_0x364916){if(!_0x364916)throw new Error(_0xb57d('0x47'));_0x2b583e=JSON['parse'](_0x364916);var _0x1e79a7=Buffer[_0xb57d('0x48')](_0xed0924[_0xb57d('0x46')],_0xb57d('0x49'))[_0xb57d('0x4a')]('ascii');_0xae5311=JSON[_0xb57d('0x4b')](_0x1e79a7);if(!oauth[_0xb57d('0x4c')](_0xed0924[_0xb57d('0x4d')],_0x2b583e['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xb57d('0x4e')](_0xed0924['state']);return oauth['getOauth2MicrosoftAccessToken'](_0xed0924[_0xb57d('0x4f')],_0x2b583e);})[_0xb57d('0x11')](function(_0x3f32ef){_0x2b583e[_0xb57d('0x50')]=_0x3f32ef[_0xb57d('0x51')];_0x2b583e[_0xb57d('0x52')]=_0x3f32ef['refresh_token'];return db[_0xb57d('0x19')]['update']({'data5':_0x2b583e[_0xb57d('0x50')],'data6':_0x2b583e[_0xb57d('0x52')]},{'where':{'id':_0x2b583e['id']}});})[_0xb57d('0x11')](function(){oauth[_0xb57d('0x53')](_0x2b583e);socket[_0xb57d('0x54')]('microsoftAuthorization:success',{'id':_0xae5311['id']});return;})[_0xb57d('0x11')](respondWithStatusCode(_0x44db5b,null))[_0xb57d('0x31')](function(_0x35ebb3){if(_0xae5311){socket[_0xb57d('0x54')](_0xb57d('0x55'),{'id':_0xae5311['id']});}if(!_0x2b583e){logger[_0xb57d('0x12')](_0xb57d('0x56'),_0x35ebb3);return _0x44db5b[_0xb57d('0x8')](0x1f4)[_0xb57d('0x57')](_0x35ebb3[_0xb57d('0x58')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x2b583e['id'],JSON[_0xb57d('0x59')](_0x35ebb3));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index dbc51e4..523da3a 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 _0xc5e6=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util'];(function(_0x5b306b,_0x19f1d5){var _0x3ab72d=function(_0x385f58){while(--_0x385f58){_0x5b306b['push'](_0x5b306b['shift']());}};_0x3ab72d(++_0x19f1d5);}(_0xc5e6,0xbe));var _0x6c5e=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xc5e6[_0x40df5f];return _0x1573f1;};'use strict';var _=require(_0x6c5e('0x0'));var util=require(_0x6c5e('0x1'));var logger=require(_0x6c5e('0x2'))('api');var moment=require(_0x6c5e('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c5e('0x4'));var fs=require('fs');var path=require(_0x6c5e('0x5'));var rimraf=require(_0x6c5e('0x6'));var config=require(_0x6c5e('0x7'));var attributes=require(_0x6c5e('0x8'));module[_0x6c5e('0x9')]=function(_0x5849be,_0x173bcf){return _0x5849be[_0x6c5e('0xa')]('CloudProvider',attributes,{'tableName':_0x6c5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf224=['exports','define','CloudProvider','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x532376,_0x5f2cd0){var _0x50482c=function(_0x44e33e){while(--_0x44e33e){_0x532376['push'](_0x532376['shift']());}};_0x50482c(++_0x5f2cd0);}(_0xf224,0xd5));var _0x4f22=function(_0x3ed112,_0x2f4679){_0x3ed112=_0x3ed112-0x0;var _0x427db4=_0xf224[_0x3ed112];return _0x427db4;};'use strict';var _=require(_0x4f22('0x0'));var util=require(_0x4f22('0x1'));var logger=require(_0x4f22('0x2'))(_0x4f22('0x3'));var moment=require('moment');var BPromise=require(_0x4f22('0x4'));var rp=require(_0x4f22('0x5'));var fs=require('fs');var path=require(_0x4f22('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x4f22('0x7')]=function(_0x148628,_0x3cc7a5){return _0x148628[_0x4f22('0x8')](_0x4f22('0x9'),attributes,{'tableName':'cloud_providers','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 fc23a16..a1ec0b7 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 _0x5e8a=['isAfter','resolve','then','data3','CloudProvider','refresh_token','decryptString','{TENANT_ID}','access_token','data6','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','catch','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','offline_access','/authorize','map','type','data7','/.default','join','Dynamics365','replace','data2','code','toString','base64','hex','client_id','data1','response_type','data4','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience'];(function(_0x367f24,_0x3dc831){var _0x25fa11=function(_0x9f01b3){while(--_0x9f01b3){_0x367f24['push'](_0x367f24['shift']());}};_0x25fa11(++_0x3dc831);}(_0x5e8a,0x13e));var _0xa5e8=function(_0x1d290e,_0x54d916){_0x1d290e=_0x1d290e-0x0;var _0x37314b=_0x5e8a[_0x1d290e];return _0x37314b;};'use strict';var _=require(_0xa5e8('0x0'));var crypto=require(_0xa5e8('0x1'));var jwt=require(_0xa5e8('0x2'));var moment=require(_0xa5e8('0x3'));var Redis=require(_0xa5e8('0x4'));var rp=require(_0xa5e8('0x5'));var util=require(_0xa5e8('0x6'));var encryptor=require(_0xa5e8('0x7'));var config=require(_0xa5e8('0x8'));var logger=require('../../config/logger')(_0xa5e8('0x9'));var schedule=require(_0xa5e8('0xa'));var db=require('../../mysqldb')['db'];config[_0xa5e8('0xb')]=_[_0xa5e8('0xc')](config[_0xa5e8('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xa5e8('0xb')]);var MICROSOFT_AUTH_URL=_0xa5e8('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa5e8('0xe'),_0xa5e8('0xf'),'email','offline_access',_0xa5e8('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xa5e8('0xe'),_0xa5e8('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xa5e8('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x417327){var _0x31d926=_[_0xa5e8('0x13')](AZURE_AUTH_SCOPES[_0x417327[_0xa5e8('0x14')]]);if(_0x417327[_0xa5e8('0x14')]==='Dynamics365')_0x31d926['push'](_0x417327[_0xa5e8('0x15')]+_0xa5e8('0x16'));return _0x31d926[_0xa5e8('0x17')]('\x20');}function getAccessTokenScope(_0x149f59){if(_0x149f59[_0xa5e8('0x14')]==='Outlook365')return _0xa5e8('0x10');if(_0x149f59[_0xa5e8('0x14')]===_0xa5e8('0x18'))return _0x149f59[_0xa5e8('0x15')]+_0xa5e8('0x16');}function generateMicrosoftAuthorizationUrl(_0x50ecb3,_0x35f405){var _0x350d1a=MICROSOFT_AUTH_URL[_0xa5e8('0x19')]('{TENANT_ID}',_0x50ecb3[_0xa5e8('0x1a')]);var _0x5c1989=[_0xa5e8('0x1b'),'id_token'];var _0x4548da=Buffer['from'](JSON['stringify']({'id':_0x35f405}))[_0xa5e8('0x1c')](_0xa5e8('0x1d'));var _0x1160b1=crypto['randomBytes'](0x10)[_0xa5e8('0x1c')](_0xa5e8('0x1e'));var _0x365c1f=getAuthorizationScopes(_0x50ecb3);var _0x3df6bd=[{'key':_0xa5e8('0x1f'),'value':_0x50ecb3[_0xa5e8('0x20')]},{'key':_0xa5e8('0x21'),'value':encodeURIComponent(_0x5c1989[_0xa5e8('0x17')]('\x20'))},{'key':'redirect_uri','value':_0x50ecb3[_0xa5e8('0x22')]},{'key':'response_mode','value':_0xa5e8('0x23')},{'key':_0xa5e8('0x24'),'value':encodeURIComponent(_0x365c1f)},{'key':_0xa5e8('0x25'),'value':_0x4548da},{'key':_0xa5e8('0x26'),'value':_0x1160b1},{'key':_0xa5e8('0x27'),'value':_0xa5e8('0x28')}];var _0x4b9ce3=_0x350d1a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa5e8('0x13')](_0x3df6bd,function(_0x591765){return _0x591765[_0xa5e8('0x29')]+'='+_0x591765[_0xa5e8('0x2a')];})['join']('&');_0x50ecb3[_0xa5e8('0x2b')]={'issuer':_0x350d1a[_0xa5e8('0x19')](_0xa5e8('0x2c'),''),'audience':_0x50ecb3[_0xa5e8('0x20')],'state':_0x4548da,'nonce':_0x1160b1};redis[_0xa5e8('0x2d')](_0x4548da,JSON['stringify'](_0x50ecb3));return _0x4b9ce3;}function isValidIdToken(_0x325a74,_0x54d07c){try{var _0xfc1fd1=jwt[_0xa5e8('0x2e')](_0x325a74,{'complete':!![]});var _0x213386=_0xfc1fd1[_0xa5e8('0x2f')];if(_0x213386[_0xa5e8('0x30')]!==_0x54d07c[_0xa5e8('0x31')])return![];if(_0x213386[_0xa5e8('0x32')]!==_0x54d07c[_0xa5e8('0x33')])return![];if(_0x213386[_0xa5e8('0x26')]!==_0x54d07c[_0xa5e8('0x26')])return![];if(moment()[_0xa5e8('0x34')](moment['unix'](_0x213386['exp'])))return![];return!![];}catch(_0x4c26ca){throw _0x4c26ca;}}function refreshOauth2MicrosoftAccessToken(_0x4233c8){return Promise[_0xa5e8('0x35')]()[_0xa5e8('0x36')](function(){if(_0x4233c8[_0xa5e8('0x37')])return _0x4233c8;return db[_0xa5e8('0x38')]['findOne']({'where':{'id':_0x4233c8['id']},'raw':!![]});})['then'](function(_0xb7a6d6){var _0x11a6d7={'grant_type':_0xa5e8('0x39'),'refresh_token':_0xb7a6d6['data6'],'scope':getAccessTokenScope(_0xb7a6d6),'redirect_uri':_0xb7a6d6[_0xa5e8('0x22')],'client_id':_0xb7a6d6['data1'],'client_secret':encryptor[_0xa5e8('0x3a')](_0xb7a6d6[_0xa5e8('0x37')])};var _0x50b62c={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa5e8('0x19')](_0xa5e8('0x3b'),_0xb7a6d6[_0xa5e8('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11a6d7,'json':!![]};return rp(_0x50b62c);})[_0xa5e8('0x36')](function(_0x4e072f){_0x4233c8['data5']=_0x4e072f[_0xa5e8('0x3c')];_0x4233c8[_0xa5e8('0x3d')]=_0x4e072f[_0xa5e8('0x39')];return db[_0xa5e8('0x38')][_0xa5e8('0x3e')]({'data5':_0x4233c8[_0xa5e8('0x3f')],'data6':_0x4233c8[_0xa5e8('0x3d')]},{'where':{'id':_0x4233c8['id']}});})[_0xa5e8('0x36')](function(){return _0x4233c8;})['catch'](function(_0x7a9406){logger[_0xa5e8('0x40')](_0xa5e8('0x41'),_0x4233c8['id'],_0x7a9406);});}function getOauth2MicrosoftAccessToken(_0x205c0d,_0x35ff83){var _0x5c83b0={'grant_type':_0xa5e8('0x42'),'code':_0x205c0d,'scope':getAccessTokenScope(_0x35ff83),'redirect_uri':_0x35ff83[_0xa5e8('0x22')],'client_id':_0x35ff83['data1'],'client_secret':encryptor[_0xa5e8('0x3a')](_0x35ff83[_0xa5e8('0x37')])};var _0x111940={'method':_0xa5e8('0x43'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa5e8('0x3b'),_0x35ff83[_0xa5e8('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c83b0,'json':!![]};return rp(_0x111940);}function startRefreshInterval(_0x42c3e0){var _0x56ac3a=schedule[_0xa5e8('0x44')];if(_0x56ac3a[_0x42c3e0['id']])clearInterval(_0x56ac3a[_0x42c3e0['id']]);_0x56ac3a[_0x42c3e0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa5e8('0x45')](this,{'id':_0x42c3e0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa5e8('0x44')]=_0x56ac3a;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xa5e8('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa5e8('0x36')](function(_0x3879fc){var _0x452323=_0x3879fc[_0xa5e8('0x13')](function(_0x2b4fef){return refreshOauth2MicrosoftAccessToken(_0x2b4fef)[_0xa5e8('0x36')](function(_0x5352a6){startRefreshInterval(_0x5352a6);});});return Promise[_0xa5e8('0x47')](_0x452323);})[_0xa5e8('0x48')](function(_0x3e42ec){var _0x41f1fa=_0x3e42ec?util['inspect'](_0x3e42ec,{'showHidden':![],'depth':null}):'';logger[_0xa5e8('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x41f1fa);});}module[_0xa5e8('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xed37=['data4','POST','data5','catch','error','decryptString','CloudProvider','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','response_type','redirect_uri','response_mode','form_post','state','nonce','prompt','map','key','value','oauth2Claims','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','unix','exp','resolve','then','data3','findOne','refresh_token','data6'];(function(_0x468a23,_0x4706d6){var _0x6fb158=function(_0x14a65c){while(--_0x14a65c){_0x468a23['push'](_0x468a23['shift']());}};_0x6fb158(++_0x4706d6);}(_0xed37,0x131));var _0x7ed3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xed37[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x7ed3('0x0'));var moment=require(_0x7ed3('0x1'));var Redis=require(_0x7ed3('0x2'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x7ed3('0x3'));var config=require('../../config/environment');var logger=require(_0x7ed3('0x4'))(_0x7ed3('0x5'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x7ed3('0x6'))['db'];config[_0x7ed3('0x7')]=_[_0x7ed3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x7ed3('0x7')]);var MICROSOFT_AUTH_URL=_0x7ed3('0x9');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7ed3('0xa'),_0x7ed3('0xb'),_0x7ed3('0xc'),_0x7ed3('0xd'),_0x7ed3('0xe'),_0x7ed3('0xf'),_0x7ed3('0x10')],'Dynamics365':[_0x7ed3('0xa'),_0x7ed3('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x7ed3('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x7ed3('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xf507c0){var _0x4c5511=_['map'](AZURE_AUTH_SCOPES[_0xf507c0['type']]);if(_0xf507c0[_0x7ed3('0x13')]==='Dynamics365')_0x4c5511['push'](_0xf507c0[_0x7ed3('0x14')]+_0x7ed3('0x15'));return _0x4c5511[_0x7ed3('0x16')]('\x20');}function getAccessTokenScope(_0x264980){if(_0x264980[_0x7ed3('0x13')]===_0x7ed3('0x17'))return _0x7ed3('0xe');if(_0x264980['type']===_0x7ed3('0x18'))return _0x264980[_0x7ed3('0x14')]+_0x7ed3('0x15');}function generateMicrosoftAuthorizationUrl(_0x3106e8,_0x3b906c){var _0x5511a0=MICROSOFT_AUTH_URL[_0x7ed3('0x19')](_0x7ed3('0x1a'),_0x3106e8[_0x7ed3('0x1b')]);var _0x31a913=[_0x7ed3('0x1c'),_0x7ed3('0x1d')];var _0x468328=Buffer[_0x7ed3('0x1e')](JSON[_0x7ed3('0x1f')]({'id':_0x3b906c}))['toString'](_0x7ed3('0x20'));var _0x41a25d=crypto[_0x7ed3('0x21')](0x10)[_0x7ed3('0x22')](_0x7ed3('0x23'));var _0x58d9fe=getAuthorizationScopes(_0x3106e8);var _0x1006ae=[{'key':_0x7ed3('0x24'),'value':_0x3106e8['data1']},{'key':_0x7ed3('0x25'),'value':encodeURIComponent(_0x31a913[_0x7ed3('0x16')]('\x20'))},{'key':_0x7ed3('0x26'),'value':_0x3106e8['data4']},{'key':_0x7ed3('0x27'),'value':_0x7ed3('0x28')},{'key':'scope','value':encodeURIComponent(_0x58d9fe)},{'key':_0x7ed3('0x29'),'value':_0x468328},{'key':_0x7ed3('0x2a'),'value':_0x41a25d},{'key':_0x7ed3('0x2b'),'value':'login'}];var _0x2498b0=_0x5511a0+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7ed3('0x2c')](_0x1006ae,function(_0x42e2b5){return _0x42e2b5[_0x7ed3('0x2d')]+'='+_0x42e2b5[_0x7ed3('0x2e')];})[_0x7ed3('0x16')]('&');_0x3106e8[_0x7ed3('0x2f')]={'issuer':_0x5511a0['replace'](_0x7ed3('0x30'),''),'audience':_0x3106e8[_0x7ed3('0x31')],'state':_0x468328,'nonce':_0x41a25d};redis[_0x7ed3('0x32')](_0x468328,JSON[_0x7ed3('0x1f')](_0x3106e8));return _0x2498b0;}function isValidIdToken(_0x4953b1,_0x3ca74a){try{var _0x417259=jwt[_0x7ed3('0x33')](_0x4953b1,{'complete':!![]});var _0x3f3772=_0x417259[_0x7ed3('0x34')];if(_0x3f3772[_0x7ed3('0x35')]!==_0x3ca74a[_0x7ed3('0x36')])return![];if(_0x3f3772[_0x7ed3('0x37')]!==_0x3ca74a[_0x7ed3('0x38')])return![];if(_0x3f3772['nonce']!==_0x3ca74a['nonce'])return![];if(moment()['isAfter'](moment[_0x7ed3('0x39')](_0x3f3772[_0x7ed3('0x3a')])))return![];return!![];}catch(_0x532cd7){throw _0x532cd7;}}function refreshOauth2MicrosoftAccessToken(_0x40bf0e){return Promise[_0x7ed3('0x3b')]()[_0x7ed3('0x3c')](function(){if(_0x40bf0e[_0x7ed3('0x3d')])return _0x40bf0e;return db['CloudProvider'][_0x7ed3('0x3e')]({'where':{'id':_0x40bf0e['id']},'raw':!![]});})[_0x7ed3('0x3c')](function(_0x2c79e0){var _0x48d485={'grant_type':_0x7ed3('0x3f'),'refresh_token':_0x2c79e0[_0x7ed3('0x40')],'scope':getAccessTokenScope(_0x2c79e0),'redirect_uri':_0x2c79e0[_0x7ed3('0x41')],'client_id':_0x2c79e0['data1'],'client_secret':encryptor['decryptString'](_0x2c79e0['data3'])};var _0x23ecf7={'method':_0x7ed3('0x42'),'uri':MICROSOFT_AUTH_URL[_0x7ed3('0x19')](_0x7ed3('0x1a'),_0x2c79e0[_0x7ed3('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48d485,'json':!![]};return rp(_0x23ecf7);})[_0x7ed3('0x3c')](function(_0x2fe19d){_0x40bf0e['data5']=_0x2fe19d['access_token'];_0x40bf0e['data6']=_0x2fe19d[_0x7ed3('0x3f')];return db['CloudProvider']['update']({'data5':_0x40bf0e[_0x7ed3('0x43')],'data6':_0x40bf0e[_0x7ed3('0x40')]},{'where':{'id':_0x40bf0e['id']}});})['then'](function(){return _0x40bf0e;})[_0x7ed3('0x44')](function(_0x324649){logger[_0x7ed3('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x40bf0e['id'],_0x324649);});}function getOauth2MicrosoftAccessToken(_0x682670,_0x48f8ea){var _0x328c0c={'grant_type':'authorization_code','code':_0x682670,'scope':getAccessTokenScope(_0x48f8ea),'redirect_uri':_0x48f8ea[_0x7ed3('0x41')],'client_id':_0x48f8ea['data1'],'client_secret':encryptor[_0x7ed3('0x46')](_0x48f8ea[_0x7ed3('0x3d')])};var _0x2311cb={'method':_0x7ed3('0x42'),'uri':MICROSOFT_AUTH_URL[_0x7ed3('0x19')](_0x7ed3('0x1a'),_0x48f8ea[_0x7ed3('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x328c0c,'json':!![]};return rp(_0x2311cb);}function startRefreshInterval(_0x4a181b){var _0x436035=schedule['intervals'];if(_0x436035[_0x4a181b['id']])clearInterval(_0x436035[_0x4a181b['id']]);_0x436035[_0x4a181b['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x4a181b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x436035;}function startAllRefreshIntervals(){return db[_0x7ed3('0x47')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7ed3('0x3c')](function(_0x40a444){var _0xe9b33f=_0x40a444['map'](function(_0x2fdd60){return refreshOauth2MicrosoftAccessToken(_0x2fdd60)[_0x7ed3('0x3c')](function(_0x5f5323){startRefreshInterval(_0x5f5323);});});return Promise[_0x7ed3('0x48')](_0xe9b33f);})[_0x7ed3('0x44')](function(_0x100b6e){var _0x38452c=_0x100b6e?util['inspect'](_0x100b6e,{'showHidden':![],'depth':null}):'';logger[_0x7ed3('0x45')](_0x7ed3('0x49'),_0x38452c);});}module['exports']={'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 bc625d2..c064607 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 _0x5464=['info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x184c37,_0x275925){var _0x5473a7=function(_0x532106){while(--_0x532106){_0x184c37['push'](_0x184c37['shift']());}};_0x5473a7(++_0x275925);}(_0x5464,0x15d));var _0x4546=function(_0x23427e,_0x43d445){_0x23427e=_0x23427e-0x0;var _0x46c8b=_0x5464[_0x23427e];return _0x46c8b;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('CloudProvider,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('CloudProvider,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file +var _0x4959=['../../config/logger','rpc','jayson/promise','client','http','request','then','CloudProvider,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x4959,0x9b));var _0x9495=function(_0xd81edf,_0x2e6383){_0xd81edf=_0xd81edf-0x0;var _0x4e0767=_0x4959[_0xd81edf];return _0x4e0767;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8b52309..17db1e9 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b98e0,_0x442fa3){_0x4b98e0=_0x4b98e0-0x0;var _0x1cf1f2=_0x5f2f[_0x4b98e0];return _0x1cf1f2;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x504505,_0x568e94){var _0x4a75cb=function(_0x85936b){while(--_0x85936b){_0x504505['push'](_0x504505['shift']());}};_0x4a75cb(++_0x568e94);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);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 0190822..a16a543 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 _0xf879=['exports','STRING','sequelize'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf879,0x158));var _0x9f87=function(_0x199c16,_0x43f421){_0x199c16=_0x199c16-0x0;var _0x3a69de=_0xf879[_0x199c16];return _0x3a69de;};'use strict';var Sequelize=require(_0x9f87('0x0'));module[_0x9f87('0x1')]={'name':{'type':Sequelize[_0x9f87('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9f87('0x2')]},'website':{'type':Sequelize[_0x9f87('0x2')]},'phone':{'type':Sequelize[_0x9f87('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9f87('0x2')]},'street':{'type':Sequelize[_0x9f87('0x2')]},'postalCode':{'type':Sequelize[_0x9f87('0x2')]},'city':{'type':Sequelize[_0x9f87('0x2')]},'country':{'type':Sequelize[_0x9f87('0x2')]},'email':{'type':Sequelize[_0x9f87('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9f87('0x2')]},'sStreet':{'type':Sequelize[_0x9f87('0x2')]},'sPostalCode':{'type':Sequelize[_0x9f87('0x2')]},'sCity':{'type':Sequelize[_0x9f87('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16d9=['STRING','sequelize','exports'];(function(_0x2ef9f3,_0x227fdd){var _0x163e71=function(_0x52a688){while(--_0x52a688){_0x2ef9f3['push'](_0x2ef9f3['shift']());}};_0x163e71(++_0x227fdd);}(_0x16d9,0x1f0));var _0x916d=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x16d9[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x916d('0x0'));module[_0x916d('0x1')]={'name':{'type':Sequelize[_0x916d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x916d('0x2')]},'website':{'type':Sequelize[_0x916d('0x2')]},'phone':{'type':Sequelize[_0x916d('0x2')]},'fax':{'type':Sequelize[_0x916d('0x2')]},'type':{'type':Sequelize[_0x916d('0x2')]},'street':{'type':Sequelize[_0x916d('0x2')]},'postalCode':{'type':Sequelize[_0x916d('0x2')]},'city':{'type':Sequelize[_0x916d('0x2')]},'country':{'type':Sequelize[_0x916d('0x2')]},'email':{'type':Sequelize[_0x916d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x916d('0x2')]},'sStreet':{'type':Sequelize[_0x916d('0x2')]},'sPostalCode':{'type':Sequelize[_0x916d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x916d('0x2')]},'description':{'type':Sequelize[_0x916d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7400847..d8307e4 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 _0x5a46=['count','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','pick','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x2c4996,_0x118be3){var _0x2152c0=function(_0x30b4f9){while(--_0x30b4f9){_0x2c4996['push'](_0x2c4996['shift']());}};_0x2152c0(++_0x118be3);}(_0x5a46,0x86));var _0x65a4=function(_0x365a95,_0x5ae25c){_0x365a95=_0x365a95-0x0;var _0x24bf15=_0x5a46[_0x365a95];return _0x24bf15;};'use strict';var emlformat=require(_0x65a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65a4('0x1'));var jsonpatch=require(_0x65a4('0x2'));var rp=require(_0x65a4('0x3'));var moment=require(_0x65a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65a4('0x5'));var util=require(_0x65a4('0x6'));var path=require(_0x65a4('0x7'));var sox=require(_0x65a4('0x8'));var csv=require('to-csv');var ejs=require(_0x65a4('0x9'));var fs=require('fs');var fs_extra=require(_0x65a4('0xa'));var _=require(_0x65a4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65a4('0xc'));var deskjs=require(_0x65a4('0xd'));var toCsv=require(_0x65a4('0xe'));var querystring=require('querystring');var Papa=require(_0x65a4('0xf'));var Redis=require('ioredis');var authService=require(_0x65a4('0x10'));var qs=require(_0x65a4('0x11'));var as=require(_0x65a4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x65a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4baac3,_0x3d8ae1){_0x3d8ae1=_0x3d8ae1||0xcc;return function(_0x252270){if(_0x252270){return _0x4baac3[_0x65a4('0x15')](_0x3d8ae1);}return _0x4baac3[_0x65a4('0x16')](_0x3d8ae1)[_0x65a4('0x17')]();};}function respondWithResult(_0x12810c,_0x53d5bd){_0x53d5bd=_0x53d5bd||0xc8;return function(_0x333204){if(_0x333204){return _0x12810c[_0x65a4('0x16')](_0x53d5bd)[_0x65a4('0x18')](_0x333204);}};}function respondWithFilteredResult(_0x163e3b,_0x1b8f64){return function(_0x1432b0){if(_0x1432b0){var _0x53152a=typeof _0x1b8f64[_0x65a4('0x19')]==='undefined'&&typeof _0x1b8f64[_0x65a4('0x1a')]===_0x65a4('0x1b');var _0x31f624=_0x1432b0[_0x65a4('0x1c')];var _0x362084=_0x53152a?0x0:_0x1b8f64[_0x65a4('0x19')];var _0x128c49=_0x53152a?_0x1432b0[_0x65a4('0x1c')]:_0x1b8f64[_0x65a4('0x19')]+_0x1b8f64['limit'];var _0x15f206;if(_0x128c49>=_0x31f624){_0x128c49=_0x31f624;_0x15f206=0xc8;}else{_0x15f206=0xce;}_0x163e3b['status'](_0x15f206);return _0x163e3b['set'](_0x65a4('0x1d'),_0x362084+'-'+_0x128c49+'/'+_0x31f624)[_0x65a4('0x18')](_0x1432b0);}return null;};}function patchUpdates(_0x2e6647){return function(_0xea5e3d){try{jsonpatch[_0x65a4('0x1e')](_0xea5e3d,_0x2e6647,!![]);}catch(_0x42a47b){return BPromise['reject'](_0x42a47b);}return _0xea5e3d[_0x65a4('0x1f')]();};}function saveUpdates(_0x39e82b,_0x47d908){return function(_0x32c59b){if(_0x32c59b){return _0x32c59b[_0x65a4('0x20')](_0x39e82b)[_0x65a4('0x21')](function(_0xb1bf62){return _0xb1bf62;});}return null;};}function removeEntity(_0x16cd6c,_0x35fe23){return function(_0x616017){if(_0x616017){return _0x616017[_0x65a4('0x22')]()[_0x65a4('0x21')](function(){var _0x4374b8=_0x616017[_0x65a4('0x23')]({'plain':!![]});var _0x18e421=_0x65a4('0x24');return db[_0x65a4('0x25')][_0x65a4('0x22')]({'where':{'type':_0x18e421,'resourceId':_0x4374b8['id']}})[_0x65a4('0x21')](function(){return _0x616017;});})[_0x65a4('0x21')](function(){_0x16cd6c[_0x65a4('0x16')](0xcc)[_0x65a4('0x17')]();});}};}function handleEntityNotFound(_0x2a8b8f,_0x97632d){return function(_0x269121){if(!_0x269121){_0x2a8b8f[_0x65a4('0x15')](0x194);}return _0x269121;};}function handleError(_0x114252,_0x4e4b7b){_0x4e4b7b=_0x4e4b7b||0x1f4;return function(_0x3adc1a){logger[_0x65a4('0x26')](_0x3adc1a['stack']);if(_0x3adc1a['name']){delete _0x3adc1a[_0x65a4('0x27')];}_0x114252[_0x65a4('0x16')](_0x4e4b7b)[_0x65a4('0x28')](_0x3adc1a);};}exports[_0x65a4('0x29')]=function(_0x13ed75,_0x1ce309){var _0x273505={},_0x4dcb6d={},_0x241daa={'count':0x0,'rows':[]};return db[_0x65a4('0x2a')][_0x65a4('0x2b')]()[_0x65a4('0x21')](function(_0x5a7e72){_0x4dcb6d[_0x65a4('0x2c')]=_['keys'](_0x5a7e72);_0x4dcb6d[_0x65a4('0x2d')]=_[_0x65a4('0x2e')](_0x13ed75['query']);_0x4dcb6d[_0x65a4('0x2f')]=_[_0x65a4('0x30')](_0x4dcb6d[_0x65a4('0x2c')],_0x4dcb6d[_0x65a4('0x2d')]);_0x273505[_0x65a4('0x31')]=_['intersection'](_0x4dcb6d[_0x65a4('0x2c')],qs[_0x65a4('0x32')](_0x13ed75[_0x65a4('0x2d')][_0x65a4('0x32')]));_0x273505[_0x65a4('0x31')]=_0x273505['attributes'][_0x65a4('0x33')]?_0x273505['attributes']:_0x4dcb6d['model'];if(!_0x13ed75['query'][_0x65a4('0x34')](_0x65a4('0x35'))){_0x273505[_0x65a4('0x1a')]=qs[_0x65a4('0x1a')](_0x13ed75[_0x65a4('0x2d')][_0x65a4('0x1a')]);_0x273505[_0x65a4('0x19')]=qs['offset'](_0x13ed75[_0x65a4('0x2d')][_0x65a4('0x19')]);}_0x273505['order']=qs[_0x65a4('0x36')](_0x13ed75['query'][_0x65a4('0x36')]);_0x273505[_0x65a4('0x37')]=qs[_0x65a4('0x2f')](_['pick'](_0x13ed75[_0x65a4('0x2d')],_0x4dcb6d[_0x65a4('0x2f')]),_0x5a7e72);if(_0x13ed75['query']['filter']){_0x273505[_0x65a4('0x37')]=_[_0x65a4('0x38')](_0x273505[_0x65a4('0x37')],{'$or':_['map'](_0x273505[_0x65a4('0x31')],function(_0x471272){var _0x509a3a={};_0x509a3a[_0x471272]={'$like':'%'+_0x13ed75[_0x65a4('0x2d')][_0x65a4('0x39')]+'%'};return _0x509a3a;})});}_0x273505=_[_0x65a4('0x38')]({},_0x273505,_0x13ed75[_0x65a4('0x3a')]);var _0x4b1bba={'where':_0x273505[_0x65a4('0x37')]};return db[_0x65a4('0x2a')][_0x65a4('0x1c')](_0x4b1bba)[_0x65a4('0x21')](function(_0x1eed94){_0x241daa['count']=_0x1eed94;if(_0x13ed75['query'][_0x65a4('0x3b')]){_0x273505['include']=[{'all':!![]}];}return db[_0x65a4('0x2a')]['findAll'](_0x273505);})[_0x65a4('0x21')](function(_0x463e58){_0x241daa[_0x65a4('0x3c')]=_0x463e58;return _0x241daa;})['then'](respondWithFilteredResult(_0x1ce309,_0x273505))[_0x65a4('0x3d')](handleError(_0x1ce309,null));})[_0x65a4('0x3d')](handleError(_0x1ce309,null));};exports[_0x65a4('0x3e')]=function(_0x4d1e52,_0x9d9971){var _0x11fac={'raw':![],'where':{'id':_0x4d1e52[_0x65a4('0x3f')]['id']}},_0x234da0={};_0x234da0[_0x65a4('0x2c')]=_[_0x65a4('0x2e')](db[_0x65a4('0x2a')]['rawAttributes']);_0x234da0[_0x65a4('0x2d')]=_[_0x65a4('0x2e')](_0x4d1e52[_0x65a4('0x2d')]);_0x234da0[_0x65a4('0x2f')]=_['intersection'](_0x234da0[_0x65a4('0x2c')],_0x234da0['query']);_0x11fac[_0x65a4('0x31')]=_[_0x65a4('0x30')](_0x234da0[_0x65a4('0x2c')],qs['fields'](_0x4d1e52[_0x65a4('0x2d')]['fields']));_0x11fac[_0x65a4('0x31')]=_0x11fac['attributes'][_0x65a4('0x33')]?_0x11fac[_0x65a4('0x31')]:_0x234da0[_0x65a4('0x2c')];if(_0x4d1e52[_0x65a4('0x2d')]['includeAll']){_0x11fac['include']=[{'all':!![]}];}_0x11fac=_[_0x65a4('0x38')]({},_0x11fac,_0x4d1e52[_0x65a4('0x3a')]);return db[_0x65a4('0x2a')]['find'](_0x11fac)[_0x65a4('0x21')](handleEntityNotFound(_0x9d9971,null))[_0x65a4('0x21')](respondWithResult(_0x9d9971,null))[_0x65a4('0x3d')](handleError(_0x9d9971,null));};exports[_0x65a4('0x40')]=function(_0x3409a2,_0x25f438){return db[_0x65a4('0x2a')][_0x65a4('0x40')](_0x3409a2[_0x65a4('0x41')],{})['then'](function(_0x1e56ab){var _0x2b75bc=_0x3409a2['user'][_0x65a4('0x23')]({'plain':!![]});if(!_0x2b75bc)throw new Error(_0x65a4('0x42'));if(_0x2b75bc[_0x65a4('0x43')]==='user'){var _0x1baff1=_0x1e56ab[_0x65a4('0x23')]({'plain':!![]});var _0x1b1380=_0x65a4('0x24');return db[_0x65a4('0x44')]['find']({'where':{'name':_0x1b1380,'userProfileId':_0x2b75bc['userProfileId']},'raw':!![]})['then'](function(_0x44aee9){if(_0x44aee9&&_0x44aee9[_0x65a4('0x45')]===0x0){return db['UserProfileResource'][_0x65a4('0x40')]({'name':_0x1baff1['name'],'resourceId':_0x1baff1['id'],'type':_0x44aee9['name'],'sectionId':_0x44aee9['id']},{})[_0x65a4('0x21')](function(){return _0x1e56ab;});}else{return _0x1e56ab;}})['catch'](function(_0x1091fe){logger['error'](_0x65a4('0x46'),_0x1091fe);throw _0x1091fe;});}return _0x1e56ab;})[_0x65a4('0x21')](respondWithResult(_0x25f438,0xc9))[_0x65a4('0x3d')](handleError(_0x25f438,null));};exports[_0x65a4('0x20')]=function(_0x2dc864,_0x2d9317){if(_0x2dc864[_0x65a4('0x41')]['id']){delete _0x2dc864[_0x65a4('0x41')]['id'];}return db[_0x65a4('0x2a')][_0x65a4('0x47')]({'where':{'id':_0x2dc864[_0x65a4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2d9317,null))[_0x65a4('0x21')](saveUpdates(_0x2dc864[_0x65a4('0x41')],null))[_0x65a4('0x21')](respondWithResult(_0x2d9317,null))[_0x65a4('0x3d')](handleError(_0x2d9317,null));};exports['destroy']=function(_0x221c89,_0x48bcd1){return db[_0x65a4('0x2a')][_0x65a4('0x47')]({'where':{'id':_0x221c89[_0x65a4('0x3f')]['id']}})[_0x65a4('0x21')](handleEntityNotFound(_0x48bcd1,null))[_0x65a4('0x21')](removeEntity(_0x48bcd1,null))[_0x65a4('0x3d')](handleError(_0x48bcd1,null));};exports[_0x65a4('0x2b')]=function(_0x3df4be,_0x2550bb){return db[_0x65a4('0x2a')]['describe']()[_0x65a4('0x21')](respondWithResult(_0x2550bb,null))[_0x65a4('0x3d')](handleError(_0x2550bb,null));};exports[_0x65a4('0x48')]=function(_0x3878ba,_0x1dc29f,_0x1d3adc){return db[_0x65a4('0x49')][_0x65a4('0x47')]({'where':{'id':_0x3878ba['params']['id']}})[_0x65a4('0x21')](handleEntityNotFound(_0x1dc29f,null))['then'](function(_0x10e978){if(_0x10e978){return _0x10e978['addContacts'](_0x3878ba['body'][_0x65a4('0x4a')],_[_0x65a4('0x4b')](_0x3878ba['body'],[_0x65a4('0x4a'),'id'])||{});}})[_0x65a4('0x21')](respondWithResult(_0x1dc29f,null))['catch'](handleError(_0x1dc29f,null));};exports[_0x65a4('0x4c')]=function(_0x13cab7,_0x259077,_0x109e4f){var _0x1f3cd6={};var _0x50d4c6={};var _0x1a38df;var _0x2c6b8d;return db[_0x65a4('0x2a')][_0x65a4('0x4d')]({'where':{'id':_0x13cab7[_0x65a4('0x3f')]['id']}})[_0x65a4('0x21')](handleEntityNotFound(_0x259077,null))[_0x65a4('0x21')](function(_0x477463){if(_0x477463){_0x1a38df=_0x477463;_0x50d4c6[_0x65a4('0x2c')]=_[_0x65a4('0x2e')](db[_0x65a4('0x49')][_0x65a4('0x4e')]);_0x50d4c6[_0x65a4('0x2d')]=_[_0x65a4('0x2e')](_0x13cab7[_0x65a4('0x2d')]);_0x50d4c6['filters']=_['intersection'](_0x50d4c6[_0x65a4('0x2c')],_0x50d4c6[_0x65a4('0x2d')]);_0x1f3cd6[_0x65a4('0x31')]=_[_0x65a4('0x30')](_0x50d4c6['model'],qs[_0x65a4('0x32')](_0x13cab7['query']['fields']));_0x1f3cd6[_0x65a4('0x31')]=_0x1f3cd6['attributes']['length']?_0x1f3cd6[_0x65a4('0x31')]:_0x50d4c6[_0x65a4('0x2c')];_0x1f3cd6['order']=qs[_0x65a4('0x36')](_0x13cab7[_0x65a4('0x2d')]['sort']);_0x1f3cd6['where']=qs[_0x65a4('0x2f')](_[_0x65a4('0x4f')](_0x13cab7[_0x65a4('0x2d')],_0x50d4c6[_0x65a4('0x2f')]));if(_0x13cab7[_0x65a4('0x2d')][_0x65a4('0x39')]){_0x1f3cd6[_0x65a4('0x37')]=_[_0x65a4('0x38')](_0x1f3cd6[_0x65a4('0x37')],{'$or':_[_0x65a4('0x50')](_0x1f3cd6[_0x65a4('0x31')],function(_0x38de54){var _0xc98299={};_0xc98299[_0x38de54]={'$like':'%'+_0x13cab7['query'][_0x65a4('0x39')]+'%'};return _0xc98299;})});}_0x1f3cd6=_[_0x65a4('0x38')]({},_0x1f3cd6,_0x13cab7['options']);return _0x1a38df[_0x65a4('0x4c')](_0x1f3cd6);}})[_0x65a4('0x21')](function(_0x4f0ddb){if(_0x4f0ddb){_0x2c6b8d=_0x4f0ddb[_0x65a4('0x33')];if(!_0x13cab7['query'][_0x65a4('0x34')](_0x65a4('0x35'))){_0x1f3cd6['limit']=qs[_0x65a4('0x1a')](_0x13cab7[_0x65a4('0x2d')][_0x65a4('0x1a')]);_0x1f3cd6[_0x65a4('0x19')]=qs[_0x65a4('0x19')](_0x13cab7['query']['offset']);}return _0x1a38df[_0x65a4('0x4c')](_0x1f3cd6);}})[_0x65a4('0x21')](function(_0x4b7fa7){if(_0x4b7fa7){return _0x4b7fa7?{'count':_0x2c6b8d,'rows':_0x4b7fa7}:null;}})['then'](respondWithResult(_0x259077,null))[_0x65a4('0x3d')](handleError(_0x259077,null));}; \ No newline at end of file +var _0x7843=['send','index','CmCompany','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','omit','getContacts','findOne','pick','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','Companies','end','error','stack'];(function(_0x5078fc,_0x43d08b){var _0x52d479=function(_0x16126b){while(--_0x16126b){_0x5078fc['push'](_0x5078fc['shift']());}};_0x52d479(++_0x43d08b);}(_0x7843,0xe0));var _0x3784=function(_0x2a7fd0,_0x29d01){_0x2a7fd0=_0x2a7fd0-0x0;var _0x47b5a8=_0x7843[_0x2a7fd0];return _0x47b5a8;};'use strict';var emlformat=require(_0x3784('0x0'));var rimraf=require(_0x3784('0x1'));var zipdir=require(_0x3784('0x2'));var jsonpatch=require(_0x3784('0x3'));var rp=require(_0x3784('0x4'));var moment=require(_0x3784('0x5'));var BPromise=require(_0x3784('0x6'));var Mustache=require('mustache');var util=require(_0x3784('0x7'));var path=require(_0x3784('0x8'));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(_0x3784('0x9'));var squel=require(_0x3784('0xa'));var crypto=require(_0x3784('0xb'));var jsforce=require(_0x3784('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3784('0xd'));var querystring=require(_0x3784('0xe'));var Papa=require(_0x3784('0xf'));var Redis=require(_0x3784('0x10'));var authService=require(_0x3784('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3784('0x12'));var logger=require(_0x3784('0x13'))(_0x3784('0x14'));var utils=require('../../config/utils');var config=require(_0x3784('0x15'));var licenseUtil=require(_0x3784('0x16'));var db=require(_0x3784('0x17'))['db'];function respondWithStatusCode(_0x329d84,_0x382589){_0x382589=_0x382589||0xcc;return function(_0x2536f8){if(_0x2536f8){return _0x329d84[_0x3784('0x18')](_0x382589);}return _0x329d84[_0x3784('0x19')](_0x382589)['end']();};}function respondWithResult(_0x4482e5,_0x3cb7e2){_0x3cb7e2=_0x3cb7e2||0xc8;return function(_0x45b55d){if(_0x45b55d){return _0x4482e5[_0x3784('0x19')](_0x3cb7e2)[_0x3784('0x1a')](_0x45b55d);}};}function respondWithFilteredResult(_0x1a7c41,_0xc0673d){return function(_0x4a1080){if(_0x4a1080){var _0x585e04=typeof _0xc0673d[_0x3784('0x1b')]===_0x3784('0x1c')&&typeof _0xc0673d[_0x3784('0x1d')]===_0x3784('0x1c');var _0x28db8b=_0x4a1080[_0x3784('0x1e')];var _0x42eb75=_0x585e04?0x0:_0xc0673d[_0x3784('0x1b')];var _0x4ba0f4=_0x585e04?_0x4a1080[_0x3784('0x1e')]:_0xc0673d['offset']+_0xc0673d[_0x3784('0x1d')];var _0x5dc07b;if(_0x4ba0f4>=_0x28db8b){_0x4ba0f4=_0x28db8b;_0x5dc07b=0xc8;}else{_0x5dc07b=0xce;}_0x1a7c41[_0x3784('0x19')](_0x5dc07b);return _0x1a7c41[_0x3784('0x1f')](_0x3784('0x20'),_0x42eb75+'-'+_0x4ba0f4+'/'+_0x28db8b)[_0x3784('0x1a')](_0x4a1080);}return null;};}function patchUpdates(_0x11d3aa){return function(_0x41ed5b){try{jsonpatch['apply'](_0x41ed5b,_0x11d3aa,!![]);}catch(_0x401dd0){return BPromise['reject'](_0x401dd0);}return _0x41ed5b['save']();};}function saveUpdates(_0x4db196,_0x5dd82f){return function(_0x3b8910){if(_0x3b8910){return _0x3b8910['update'](_0x4db196)[_0x3784('0x21')](function(_0x531585){return _0x531585;});}return null;};}function removeEntity(_0xb8acd4,_0x1a645d){return function(_0x14ecc1){if(_0x14ecc1){return _0x14ecc1[_0x3784('0x22')]()[_0x3784('0x21')](function(){var _0x453858=_0x14ecc1[_0x3784('0x23')]({'plain':!![]});var _0xa5706e=_0x3784('0x24');return db['UserProfileResource'][_0x3784('0x22')]({'where':{'type':_0xa5706e,'resourceId':_0x453858['id']}})['then'](function(){return _0x14ecc1;});})[_0x3784('0x21')](function(){_0xb8acd4[_0x3784('0x19')](0xcc)[_0x3784('0x25')]();});}};}function handleEntityNotFound(_0x53ddda,_0x339fbb){return function(_0x21d7b0){if(!_0x21d7b0){_0x53ddda[_0x3784('0x18')](0x194);}return _0x21d7b0;};}function handleError(_0x881701,_0x37fc0d){_0x37fc0d=_0x37fc0d||0x1f4;return function(_0x3a0abe){logger[_0x3784('0x26')](_0x3a0abe[_0x3784('0x27')]);if(_0x3a0abe['name']){delete _0x3a0abe['name'];}_0x881701[_0x3784('0x19')](_0x37fc0d)[_0x3784('0x28')](_0x3a0abe);};}exports[_0x3784('0x29')]=function(_0x35db56,_0x3f9721){var _0x400474={},_0x31e4cb={},_0x2ebbb6={'count':0x0,'rows':[]};return db[_0x3784('0x2a')]['describe']()[_0x3784('0x21')](function(_0x34d71c){_0x31e4cb[_0x3784('0x2b')]=_[_0x3784('0x2c')](_0x34d71c);_0x31e4cb[_0x3784('0x2d')]=_[_0x3784('0x2c')](_0x35db56[_0x3784('0x2d')]);_0x31e4cb['filters']=_[_0x3784('0x2e')](_0x31e4cb[_0x3784('0x2b')],_0x31e4cb['query']);_0x400474['attributes']=_[_0x3784('0x2e')](_0x31e4cb['model'],qs[_0x3784('0x2f')](_0x35db56[_0x3784('0x2d')][_0x3784('0x2f')]));_0x400474[_0x3784('0x30')]=_0x400474[_0x3784('0x30')][_0x3784('0x31')]?_0x400474[_0x3784('0x30')]:_0x31e4cb['model'];if(!_0x35db56[_0x3784('0x2d')][_0x3784('0x32')]('nolimit')){_0x400474[_0x3784('0x1d')]=qs[_0x3784('0x1d')](_0x35db56[_0x3784('0x2d')][_0x3784('0x1d')]);_0x400474[_0x3784('0x1b')]=qs[_0x3784('0x1b')](_0x35db56[_0x3784('0x2d')]['offset']);}_0x400474[_0x3784('0x33')]=qs[_0x3784('0x34')](_0x35db56[_0x3784('0x2d')][_0x3784('0x34')]);_0x400474[_0x3784('0x35')]=qs[_0x3784('0x36')](_['pick'](_0x35db56[_0x3784('0x2d')],_0x31e4cb[_0x3784('0x36')]),_0x34d71c);if(_0x35db56[_0x3784('0x2d')][_0x3784('0x37')]){_0x400474[_0x3784('0x35')]=_[_0x3784('0x38')](_0x400474[_0x3784('0x35')],{'$or':_[_0x3784('0x39')](_0x400474['attributes'],function(_0x329814){var _0x257118={};_0x257118[_0x329814]={'$like':'%'+_0x35db56['query']['filter']+'%'};return _0x257118;})});}_0x400474=_[_0x3784('0x38')]({},_0x400474,_0x35db56['options']);var _0x54eedc={'where':_0x400474['where']};return db[_0x3784('0x2a')][_0x3784('0x1e')](_0x54eedc)[_0x3784('0x21')](function(_0x517885){_0x2ebbb6['count']=_0x517885;if(_0x35db56[_0x3784('0x2d')][_0x3784('0x3a')]){_0x400474[_0x3784('0x3b')]=[{'all':!![]}];}return db[_0x3784('0x2a')][_0x3784('0x3c')](_0x400474);})['then'](function(_0x16d00c){_0x2ebbb6[_0x3784('0x3d')]=_0x16d00c;return _0x2ebbb6;})[_0x3784('0x21')](respondWithFilteredResult(_0x3f9721,_0x400474))[_0x3784('0x3e')](handleError(_0x3f9721,null));})[_0x3784('0x3e')](handleError(_0x3f9721,null));};exports['show']=function(_0x269d4b,_0x3eb11e){var _0x25a429={'raw':![],'where':{'id':_0x269d4b[_0x3784('0x3f')]['id']}},_0x394392={};_0x394392[_0x3784('0x2b')]=_[_0x3784('0x2c')](db[_0x3784('0x2a')][_0x3784('0x40')]);_0x394392[_0x3784('0x2d')]=_[_0x3784('0x2c')](_0x269d4b[_0x3784('0x2d')]);_0x394392['filters']=_['intersection'](_0x394392[_0x3784('0x2b')],_0x394392[_0x3784('0x2d')]);_0x25a429[_0x3784('0x30')]=_[_0x3784('0x2e')](_0x394392['model'],qs[_0x3784('0x2f')](_0x269d4b[_0x3784('0x2d')][_0x3784('0x2f')]));_0x25a429[_0x3784('0x30')]=_0x25a429[_0x3784('0x30')][_0x3784('0x31')]?_0x25a429[_0x3784('0x30')]:_0x394392['model'];if(_0x269d4b[_0x3784('0x2d')][_0x3784('0x3a')]){_0x25a429['include']=[{'all':!![]}];}_0x25a429=_['merge']({},_0x25a429,_0x269d4b[_0x3784('0x41')]);return db[_0x3784('0x2a')][_0x3784('0x42')](_0x25a429)[_0x3784('0x21')](handleEntityNotFound(_0x3eb11e,null))[_0x3784('0x21')](respondWithResult(_0x3eb11e,null))['catch'](handleError(_0x3eb11e,null));};exports[_0x3784('0x43')]=function(_0x2276f1,_0x2f5c2e){return db[_0x3784('0x2a')]['create'](_0x2276f1[_0x3784('0x44')],{})[_0x3784('0x21')](function(_0x3f0514){var _0x289a12=_0x2276f1[_0x3784('0x45')]['get']({'plain':!![]});if(!_0x289a12)throw new Error(_0x3784('0x46'));if(_0x289a12[_0x3784('0x47')]===_0x3784('0x45')){var _0xffda23=_0x3f0514[_0x3784('0x23')]({'plain':!![]});var _0x247374=_0x3784('0x24');return db[_0x3784('0x48')][_0x3784('0x42')]({'where':{'name':_0x247374,'userProfileId':_0x289a12[_0x3784('0x49')]},'raw':!![]})[_0x3784('0x21')](function(_0x13a54b){if(_0x13a54b&&_0x13a54b[_0x3784('0x4a')]===0x0){return db[_0x3784('0x4b')][_0x3784('0x43')]({'name':_0xffda23[_0x3784('0x4c')],'resourceId':_0xffda23['id'],'type':_0x13a54b[_0x3784('0x4c')],'sectionId':_0x13a54b['id']},{})[_0x3784('0x21')](function(){return _0x3f0514;});}else{return _0x3f0514;}})[_0x3784('0x3e')](function(_0x496662){logger[_0x3784('0x26')](_0x3784('0x4d'),_0x496662);throw _0x496662;});}return _0x3f0514;})[_0x3784('0x21')](respondWithResult(_0x2f5c2e,0xc9))[_0x3784('0x3e')](handleError(_0x2f5c2e,null));};exports[_0x3784('0x4e')]=function(_0x40049c,_0x4fe177){if(_0x40049c['body']['id']){delete _0x40049c[_0x3784('0x44')]['id'];}return db[_0x3784('0x2a')][_0x3784('0x42')]({'where':{'id':_0x40049c['params']['id']}})['then'](handleEntityNotFound(_0x4fe177,null))[_0x3784('0x21')](saveUpdates(_0x40049c['body'],null))[_0x3784('0x21')](respondWithResult(_0x4fe177,null))[_0x3784('0x3e')](handleError(_0x4fe177,null));};exports[_0x3784('0x22')]=function(_0x5128a9,_0xf74f3c){return db[_0x3784('0x2a')][_0x3784('0x42')]({'where':{'id':_0x5128a9[_0x3784('0x3f')]['id']}})[_0x3784('0x21')](handleEntityNotFound(_0xf74f3c,null))['then'](removeEntity(_0xf74f3c,null))[_0x3784('0x3e')](handleError(_0xf74f3c,null));};exports[_0x3784('0x4f')]=function(_0x2eeac3,_0x3e1948){return db['CmCompany'][_0x3784('0x4f')]()['then'](respondWithResult(_0x3e1948,null))[_0x3784('0x3e')](handleError(_0x3e1948,null));};exports[_0x3784('0x50')]=function(_0x4f4ed0,_0x573589,_0x14c7b7){return db[_0x3784('0x51')][_0x3784('0x42')]({'where':{'id':_0x4f4ed0['params']['id']}})[_0x3784('0x21')](handleEntityNotFound(_0x573589,null))[_0x3784('0x21')](function(_0x493a0d){if(_0x493a0d){return _0x493a0d[_0x3784('0x50')](_0x4f4ed0[_0x3784('0x44')][_0x3784('0x52')],_[_0x3784('0x53')](_0x4f4ed0[_0x3784('0x44')],[_0x3784('0x52'),'id'])||{});}})[_0x3784('0x21')](respondWithResult(_0x573589,null))[_0x3784('0x3e')](handleError(_0x573589,null));};exports[_0x3784('0x54')]=function(_0x3cee5c,_0x52d169,_0x33c171){var _0x1746a3={};var _0x10b747={};var _0x73fc78;var _0x7797c5;return db[_0x3784('0x2a')][_0x3784('0x55')]({'where':{'id':_0x3cee5c[_0x3784('0x3f')]['id']}})[_0x3784('0x21')](handleEntityNotFound(_0x52d169,null))[_0x3784('0x21')](function(_0x388bcd){if(_0x388bcd){_0x73fc78=_0x388bcd;_0x10b747['model']=_[_0x3784('0x2c')](db[_0x3784('0x51')][_0x3784('0x40')]);_0x10b747[_0x3784('0x2d')]=_[_0x3784('0x2c')](_0x3cee5c[_0x3784('0x2d')]);_0x10b747[_0x3784('0x36')]=_[_0x3784('0x2e')](_0x10b747[_0x3784('0x2b')],_0x10b747['query']);_0x1746a3['attributes']=_['intersection'](_0x10b747['model'],qs[_0x3784('0x2f')](_0x3cee5c[_0x3784('0x2d')]['fields']));_0x1746a3['attributes']=_0x1746a3['attributes']['length']?_0x1746a3['attributes']:_0x10b747[_0x3784('0x2b')];_0x1746a3[_0x3784('0x33')]=qs[_0x3784('0x34')](_0x3cee5c[_0x3784('0x2d')][_0x3784('0x34')]);_0x1746a3[_0x3784('0x35')]=qs[_0x3784('0x36')](_[_0x3784('0x56')](_0x3cee5c[_0x3784('0x2d')],_0x10b747[_0x3784('0x36')]));if(_0x3cee5c[_0x3784('0x2d')]['filter']){_0x1746a3[_0x3784('0x35')]=_[_0x3784('0x38')](_0x1746a3[_0x3784('0x35')],{'$or':_[_0x3784('0x39')](_0x1746a3[_0x3784('0x30')],function(_0x1d00db){var _0x411b68={};_0x411b68[_0x1d00db]={'$like':'%'+_0x3cee5c[_0x3784('0x2d')]['filter']+'%'};return _0x411b68;})});}_0x1746a3=_[_0x3784('0x38')]({},_0x1746a3,_0x3cee5c['options']);return _0x73fc78[_0x3784('0x54')](_0x1746a3);}})[_0x3784('0x21')](function(_0x4530a8){if(_0x4530a8){_0x7797c5=_0x4530a8[_0x3784('0x31')];if(!_0x3cee5c['query'][_0x3784('0x32')](_0x3784('0x57'))){_0x1746a3[_0x3784('0x1d')]=qs[_0x3784('0x1d')](_0x3cee5c['query']['limit']);_0x1746a3[_0x3784('0x1b')]=qs['offset'](_0x3cee5c['query'][_0x3784('0x1b')]);}return _0x73fc78[_0x3784('0x54')](_0x1746a3);}})[_0x3784('0x21')](function(_0x50ebb0){if(_0x50ebb0){return _0x50ebb0?{'count':_0x7797c5,'rows':_0x50ebb0}:null;}})[_0x3784('0x21')](respondWithResult(_0x52d169,null))[_0x3784('0x3e')](handleError(_0x52d169,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 015cac5..86add9c 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 _0x7301=['bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x7301,0xbe));var _0x1730=function(_0x103495,_0x2b18ce){_0x103495=_0x103495-0x0;var _0x4fc9c1=_0x7301[_0x103495];return _0x4fc9c1;};'use strict';var _=require(_0x1730('0x0'));var util=require(_0x1730('0x1'));var logger=require(_0x1730('0x2'))(_0x1730('0x3'));var moment=require(_0x1730('0x4'));var BPromise=require(_0x1730('0x5'));var rp=require(_0x1730('0x6'));var fs=require('fs');var path=require(_0x1730('0x7'));var rimraf=require(_0x1730('0x8'));var config=require('../../config/environment');var attributes=require(_0x1730('0x9'));module[_0x1730('0xa')]=function(_0xe4f2ce,_0x2527e8){return _0xe4f2ce['define'](_0x1730('0xb'),attributes,{'tableName':_0x1730('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d10=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3d10,0x8c));var _0x03d1=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x3d10[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x03d1('0x0'));var util=require(_0x03d1('0x1'));var logger=require(_0x03d1('0x2'))(_0x03d1('0x3'));var moment=require(_0x03d1('0x4'));var BPromise=require(_0x03d1('0x5'));var rp=require(_0x03d1('0x6'));var fs=require('fs');var path=require(_0x03d1('0x7'));var rimraf=require(_0x03d1('0x8'));var config=require(_0x03d1('0x9'));var attributes=require(_0x03d1('0xa'));module[_0x03d1('0xb')]=function(_0x328df1,_0x50afb5){return _0x328df1[_0x03d1('0xc')](_0x03d1('0xd'),attributes,{'tableName':_0x03d1('0xe'),'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 1625445..b6a7c45 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 _0xf0ce=['message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0xf0ce,0xde));var _0xef0c=function(_0xb44ced,_0x369a5c){_0xb44ced=_0xb44ced-0x0;var _0x4c14af=_0xf0ce[_0xb44ced];return _0x4c14af;};'use strict';var _=require(_0xef0c('0x0'));var util=require(_0xef0c('0x1'));var moment=require('moment');var BPromise=require(_0xef0c('0x2'));var rs=require(_0xef0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef0c('0x4'))['db'];var utils=require(_0xef0c('0x5'));var logger=require(_0xef0c('0x6'))('rpc');var config=require(_0xef0c('0x7'));var jayson=require(_0xef0c('0x8'));var client=jayson[_0xef0c('0x9')][_0xef0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e4819,_0x10a419,_0x143bea){return new BPromise(function(_0x228c40,_0x41bac5){return client['request'](_0x5e4819,_0x143bea)[_0xef0c('0xb')](function(_0x1976d8){logger[_0xef0c('0xc')](_0xef0c('0xd'),_0x10a419,'request\x20sent');logger[_0xef0c('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x10a419,_0xef0c('0xf'),JSON[_0xef0c('0x10')](_0x1976d8));if(_0x1976d8[_0xef0c('0x11')]){if(_0x1976d8[_0xef0c('0x11')]['code']===0x1f4){logger[_0xef0c('0x11')](_0xef0c('0xd'),_0x10a419,_0x1976d8[_0xef0c('0x11')][_0xef0c('0x12')]);return _0x41bac5(_0x1976d8['error'][_0xef0c('0x12')]);}logger['error'](_0xef0c('0xd'),_0x10a419,_0x1976d8[_0xef0c('0x11')]['message']);return _0x228c40(_0x1976d8[_0xef0c('0x11')][_0xef0c('0x12')]);}else{logger[_0xef0c('0xc')]('CmCompany,\x20%s,\x20%s',_0x10a419,'request\x20sent');_0x228c40(_0x1976d8[_0xef0c('0x13')][_0xef0c('0x12')]);}})['catch'](function(_0x15b698){logger[_0xef0c('0x11')](_0xef0c('0xd'),_0x10a419,_0x15b698);_0x41bac5(_0x15b698);});});} \ No newline at end of file +var _0x5901=['ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5901,0xe3));var _0x1590=function(_0x6909dd,_0xb65836){_0x6909dd=_0x6909dd-0x0;var _0x3c5ff3=_0x5901[_0x6909dd];return _0x3c5ff3;};'use strict';var _=require(_0x1590('0x0'));var util=require(_0x1590('0x1'));var moment=require(_0x1590('0x2'));var BPromise=require('bluebird');var rs=require(_0x1590('0x3'));var fs=require('fs');var Redis=require(_0x1590('0x4'));var db=require(_0x1590('0x5'))['db'];var utils=require(_0x1590('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1590('0x7')][_0x1590('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x356b00,_0x34afc8,_0x29f2c2){return new BPromise(function(_0x325a02,_0x1cdec5){return client[_0x1590('0x9')](_0x356b00,_0x29f2c2)[_0x1590('0xa')](function(_0x321d02){logger[_0x1590('0xb')](_0x1590('0xc'),_0x34afc8,'request\x20sent');logger[_0x1590('0xd')](_0x1590('0xe'),_0x34afc8,_0x1590('0xf'),JSON[_0x1590('0x10')](_0x321d02));if(_0x321d02[_0x1590('0x11')]){if(_0x321d02[_0x1590('0x11')]['code']===0x1f4){logger[_0x1590('0x11')]('CmCompany,\x20%s,\x20%s',_0x34afc8,_0x321d02[_0x1590('0x11')][_0x1590('0x12')]);return _0x1cdec5(_0x321d02[_0x1590('0x11')]['message']);}logger[_0x1590('0x11')]('CmCompany,\x20%s,\x20%s',_0x34afc8,_0x321d02[_0x1590('0x11')][_0x1590('0x12')]);return _0x325a02(_0x321d02['error']['message']);}else{logger[_0x1590('0xb')]('CmCompany,\x20%s,\x20%s',_0x34afc8,'request\x20sent');_0x325a02(_0x321d02[_0x1590('0x13')][_0x1590('0x12')]);}})[_0x1590('0x14')](function(_0xf313f1){logger[_0x1590('0x11')](_0x1590('0xc'),_0x34afc8,_0xf313f1);_0x1cdec5(_0xf313f1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8c2e0d6..713a4b7 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 _0x906b=['./cmCompany.controller','index','get','/describe','isAuthenticated','describe','/:id/contacts','getContacts','post','create','addContacts','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x906b,0x1ef));var _0xb906=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x906b[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0xb906('0x0'));var util=require(_0xb906('0x1'));var path=require(_0xb906('0x2'));var timeout=require(_0xb906('0x3'));var express=require(_0xb906('0x4'));var router=express[_0xb906('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb906('0x6'));var interaction=require(_0xb906('0x7'));var config=require(_0xb906('0x8'));var controller=require(_0xb906('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb906('0xa')]);router[_0xb906('0xb')](_0xb906('0xc'),auth[_0xb906('0xd')](),controller[_0xb906('0xe')]);router['get']('/:id',auth[_0xb906('0xd')](),controller['show']);router['get'](_0xb906('0xf'),auth[_0xb906('0xd')](),controller[_0xb906('0x10')]);router[_0xb906('0x11')]('/',auth['isAuthenticated'](),controller[_0xb906('0x12')]);router[_0xb906('0x11')](_0xb906('0xf'),auth[_0xb906('0xd')](),controller[_0xb906('0x13')]);router[_0xb906('0x14')](_0xb906('0x15'),auth[_0xb906('0xd')](),controller['update']);router['delete'](_0xb906('0x15'),auth[_0xb906('0xd')](),controller[_0xb906('0x16')]);module[_0xb906('0x17')]=router; \ No newline at end of file +var _0xcae1=['multer','path','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x4ba3c4,_0x24842d){var _0x2b6605=function(_0xc2698f){while(--_0xc2698f){_0x4ba3c4['push'](_0x4ba3c4['shift']());}};_0x2b6605(++_0x24842d);}(_0xcae1,0x1b8));var _0x1cae=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0xcae1[_0x4b7e4d];return _0x38d6af;};'use strict';var multer=require(_0x1cae('0x0'));var util=require('util');var path=require(_0x1cae('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1cae('0x2')]();var fs_extra=require(_0x1cae('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1cae('0x4'));var controller=require(_0x1cae('0x5'));router[_0x1cae('0x6')]('/',auth[_0x1cae('0x7')](),controller[_0x1cae('0x8')]);router[_0x1cae('0x6')](_0x1cae('0x9'),auth[_0x1cae('0x7')](),controller[_0x1cae('0xa')]);router[_0x1cae('0x6')](_0x1cae('0xb'),auth[_0x1cae('0x7')](),controller[_0x1cae('0xc')]);router['get']('/:id/contacts',auth[_0x1cae('0x7')](),controller['getContacts']);router['post']('/',auth[_0x1cae('0x7')](),controller['create']);router[_0x1cae('0xd')](_0x1cae('0xe'),auth[_0x1cae('0x7')](),controller[_0x1cae('0xf')]);router[_0x1cae('0x10')](_0x1cae('0xb'),auth[_0x1cae('0x7')](),controller[_0x1cae('0x11')]);router['delete'](_0x1cae('0xb'),auth['isAuthenticated'](),controller[_0x1cae('0x12')]);module[_0x1cae('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bfd36fb..5bbcd80 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 _0x891a=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x3a3e88,_0x4801a0){var _0x1f4fc8=function(_0x1536a4){while(--_0x1536a4){_0x3a3e88['push'](_0x3a3e88['shift']());}};_0x1f4fc8(++_0x4801a0);}(_0x891a,0x178));var _0xa891=function(_0x115cdd,_0x1db606){_0x115cdd=_0x115cdd-0x0;var _0x3bd6d5=_0x891a[_0x115cdd];return _0x3bd6d5;};'use strict';var _=require(_0xa891('0x0'));var Sequelize=require(_0xa891('0x1'));module[_0xa891('0x2')]={'firstName':{'type':Sequelize[_0xa891('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa891('0x3')]},'street':{'type':Sequelize[_0xa891('0x3')]},'postalCode':{'type':Sequelize[_0xa891('0x3')]},'city':{'type':Sequelize[_0xa891('0x3')]},'country':{'type':Sequelize[_0xa891('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa891('0x3')]},'description':{'type':Sequelize[_0xa891('0x4')]},'phone':{'type':Sequelize[_0xa891('0x3')]},'mobile':{'type':Sequelize[_0xa891('0x3')]},'fax':{'type':Sequelize[_0xa891('0x3')]},'email':{'type':Sequelize[_0xa891('0x3')]},'url':{'type':Sequelize[_0xa891('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xa891('0x3')]},'twitter':{'type':Sequelize[_0xa891('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xa891('0x3')]},'viber':{'type':Sequelize[_0xa891('0x3')]},'line':{'type':Sequelize[_0xa891('0x3')]},'wechat':{'type':Sequelize[_0xa891('0x3')]},'telegram':{'type':Sequelize[_0xa891('0x3')]},'UserId':{'type':Sequelize[_0xa891('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xa891('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa891('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa891('0x7')],'defaultValue':Sequelize[_0xa891('0x8')]},'dialTimezone':{'type':Sequelize[_0xa891('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x876c=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0x876c,0xf1));var _0xc876=function(_0x1eb929,_0x281d15){_0x1eb929=_0x1eb929-0x0;var _0x825fa3=_0x876c[_0x1eb929];return _0x825fa3;};'use strict';var _=require(_0xc876('0x0'));var Sequelize=require('sequelize');module[_0xc876('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc876('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc876('0x2')]},'dateOfBirth':{'type':Sequelize[_0xc876('0x2')]},'description':{'type':Sequelize[_0xc876('0x3')]},'phone':{'type':Sequelize[_0xc876('0x2')]},'mobile':{'type':Sequelize[_0xc876('0x2')]},'fax':{'type':Sequelize[_0xc876('0x2')]},'email':{'type':Sequelize[_0xc876('0x2')]},'url':{'type':Sequelize[_0xc876('0x2')]},'facebook':{'type':Sequelize[_0xc876('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xc876('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xc876('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xc876('0x2')]},'wechat':{'type':Sequelize[_0xc876('0x2')]},'telegram':{'type':Sequelize[_0xc876('0x2')]},'UserId':{'type':Sequelize[_0xc876('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc876('0x4')](0x2)[_0xc876('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc876('0x6')],'defaultValue':Sequelize[_0xc876('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc876('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bb3e52b..17021f6 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 7b2bc48..854421f 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1db0=['emit','exports','events','../../mysqldb','CmContact','update','remove'];(function(_0x2145ae,_0x20a3d4){var _0x49aa0d=function(_0x1220e5){while(--_0x1220e5){_0x2145ae['push'](_0x2145ae['shift']());}};_0x49aa0d(++_0x20a3d4);}(_0x1db0,0x198));var _0x01db=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x1db0[_0x2166a3];return _0x260035;};'use strict';var EventEmitter=require(_0x01db('0x0'));var CmContact=require(_0x01db('0x1'))['db'][_0x01db('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x01db('0x3'),'afterDestroy':_0x01db('0x4')};function emitEvent(_0x2424eb){return function(_0x41daec,_0x32b45f,_0x14407a){CmContactEvents[_0x01db('0x5')](_0x2424eb+':'+_0x41daec['id'],_0x41daec);CmContactEvents['emit'](_0x2424eb,_0x41daec);_0x14407a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x01db('0x6')]=CmContactEvents; \ No newline at end of file +var _0xfdb2=['remove','emit','hasOwnProperty','hook','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0xfdb2,0x151));var _0x2fdb=function(_0x2a5eb7,_0x561199){_0x2a5eb7=_0x2a5eb7-0x0;var _0x59dd98=_0xfdb2[_0x2a5eb7];return _0x59dd98;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x2fdb('0x0'))['db'][_0x2fdb('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2fdb('0x2')](0x0);var events={'afterCreate':_0x2fdb('0x3'),'afterUpdate':_0x2fdb('0x4'),'afterDestroy':_0x2fdb('0x5')};function emitEvent(_0x59809f){return function(_0x205e77,_0x266f53,_0x32c59a){CmContactEvents['emit'](_0x59809f+':'+_0x205e77['id'],_0x205e77);CmContactEvents[_0x2fdb('0x6')](_0x59809f,_0x205e77);_0x32c59a(null);};}for(var e in events){if(events[_0x2fdb('0x7')](e)){var event=events[e];CmContact[_0x2fdb('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 31ca9f7..e762d8f 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90e0=['all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','bluebird','request-promise','path','../../config/environment','define','CmContact','cm_contacts','phone','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','onlyIfOpen','List\x20not\x20found','isEmpty','destroy','ContactId','push'];(function(_0x57e4db,_0x4c5b81){var _0x3fc8a6=function(_0xb01a26){while(--_0xb01a26){_0x57e4db['push'](_0x57e4db['shift']());}};_0x3fc8a6(++_0x4c5b81);}(_0x90e0,0x8b));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x090e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x090e('0x1'));var rp=require(_0x090e('0x2'));var fs=require('fs');var path=require(_0x090e('0x3'));var rimraf=require('rimraf');var config=require(_0x090e('0x4'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module['exports']=function(_0x5eedd3,_0x252e7b){return _0x5eedd3[_0x090e('0x5')](_0x090e('0x6'),attributes,{'tableName':_0x090e('0x7'),'paranoid':!![],'indexes':[{'name':_0x090e('0x8'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x090e('0x9'),'lastName',_0x090e('0x8'),_0x090e('0xa'),_0x090e('0xb'),'email'],'type':_0x090e('0xc')}],'timestamps':!![],'charset':_0x090e('0xd'),'collate':_0x090e('0xe'),'hooks':{'afterCreate':function(_0x46092,_0x2a252e,_0x53b688){var _0x167529=_0x5eedd3[_0x090e('0xf')];var _0x5e92b5=_0x46092[_0x090e('0x10')]({'plain':!![]});function _0x40810a(){return function(_0x24f761){logger[_0x090e('0x11')](_0x090e('0x12'),_0x090e('0x13'),util[_0x090e('0x14')](_0x24f761,{'showHidden':![],'depth':null}));};}function _0x50ee58(_0x2cc18b,_0x289bbc){var _0x3eb187=_0x289bbc[_0x090e('0x15')]?_0x289bbc['scheduledat']:moment()[_0x090e('0x16')](_0x090e('0x17'));return new BPromise(function(_0x290f18,_0x2cae42){if(_[_0x090e('0x18')](_0x289bbc[_0x090e('0x19')])){_0x290f18({'ret':_0x3eb187});}else{_0x167529['VoiceQueue'][_0x090e('0x1a')]({'where':{'id':_0x2cc18b['id']}})[_0x090e('0x1b')](function(_0x182f06){if(!_['isNil'](_0x182f06)){var _0x6255c7=_0x182f06[_0x090e('0x19')];if(!_[_0x090e('0x18')](_0x6255c7)){var _0x144784=shared['timezones'];var _0x5aece4=_0x144784[_0x6255c7];var _0x462fe0=_0x144784[_0x289bbc['dialTimezone']];if(!_[_0x090e('0x18')](_0x5aece4)&&!_['isNil'](_0x462fe0)){var _0x11bc2f=_0x5aece4[_0x090e('0x1c')]-_0x462fe0['utcOffset'];_0x3eb187=_0x289bbc['scheduledat']?_0x289bbc[_0x090e('0x15')]:moment();var _0x1ef70d=moment(_0x3eb187)[_0x090e('0x1d')](_0x11bc2f,_0x090e('0x1e'));_0x290f18({'ret':_0x1ef70d['format'](_0x090e('0x17'))});}else _0x290f18({'ret':_0x3eb187});}else _0x290f18({'ret':_0x3eb187});}else{_0x290f18({'ret':_0x3eb187});}});}});return 0xa;}var _0x5ddb30=function(_0x5346f3){return new BPromise(function(_0xf57248,_0x2f9aba){_0x50ee58(_0x5346f3,_0x5e92b5)['then'](function(_0x3bc1b0){_0x5e92b5['scheduledat']=_0x3bc1b0[_0x090e('0x1f')];_0x167529[_0x090e('0x20')][_0x090e('0x1a')]({'where':{'phone':_0x5e92b5['phone'],'VoiceQueueId':_0x5346f3['id']}})[_0x090e('0x1b')](function(_0x44302a){if(!_[_0x090e('0x18')](_0x44302a)){throw new Error(_0x090e('0x21')+_0x5e92b5[_0x090e('0x8')]+_0x090e('0x22')+_0x5346f3['id']);}return _0x167529[_0x090e('0x20')][_0x090e('0x23')]({'phone':_0x5e92b5['phone'],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5['ListId'],'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5['priority']:0x2,'scheduledat':_0x5e92b5['scheduledat']?_0x5e92b5[_0x090e('0x15')]:moment()[_0x090e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5e92b5[_0x090e('0x25')]?!![]:![],'callbackuniqueid':_0x5e92b5['callbackUniqueid']?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5['callbackUniqueid']?moment()[_0x090e('0x16')](_0x090e('0x17')):undefined,'VoiceQueueId':_0x5346f3['id']});})['catch'](function(_0x4edc3a){_0x2f9aba(_0x4edc3a);});});});};var _0x2dee87=function(_0x7d260){return new BPromise(function(_0x17f82d,_0x2903d0){_0x50ee58(_0x7d260,_0x5e92b5)[_0x090e('0x1b')](function(_0x42823d){_0x5e92b5[_0x090e('0x15')]=_0x42823d['ret'];_0x167529[_0x090e('0x20')][_0x090e('0x1a')]({'where':{'phone':_0x5e92b5[_0x090e('0x8')],'VoiceQueueId':_0x7d260['id']}})[_0x090e('0x1b')](function(_0x58bfcf){if(!_[_0x090e('0x18')](_0x58bfcf)){throw new Error(_0x090e('0x21')+_0x5e92b5[_0x090e('0x8')]+_0x090e('0x26')+_0x7d260['id']);}return _0x167529[_0x090e('0x27')][_0x090e('0x1a')]({'where':{'calleridnum':_0x5e92b5[_0x090e('0x8')],'VoiceQueueId':_0x7d260['id']}});})[_0x090e('0x1b')](function(_0x2e6801){if(!_[_0x090e('0x18')](_0x2e6801)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5e92b5[_0x090e('0x8')]+_0x090e('0x28')+_0x7d260['id']);}return _0x167529[_0x090e('0x20')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5[_0x090e('0x24')]:0x2,'scheduledat':_0x5e92b5['scheduledat']?_0x5e92b5[_0x090e('0x15')]:moment()[_0x090e('0x16')](_0x090e('0x17')),'callback':_0x5e92b5[_0x090e('0x25')]?!![]:![],'callbackuniqueid':_0x5e92b5['callbackUniqueid']?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5[_0x090e('0x25')]?moment()['format'](_0x090e('0x17')):undefined,'VoiceQueueId':_0x7d260['id']});})[_0x090e('0x2a')](function(_0x4ce209){_0x2903d0(_0x4ce209);});});});};function _0x4dc845(){return function(_0x3bbc66){logger[_0x090e('0x11')]('cmContact',_0x090e('0x13'),util[_0x090e('0x14')](_0x3bbc66,{'showHidden':![],'depth':null}));};}function _0x457e5e(_0x30aacd,_0x1897bc){var _0x4a401e=_0x1897bc['scheduledat']?_0x1897bc[_0x090e('0x15')]:moment()[_0x090e('0x16')](_0x090e('0x17'));return new BPromise(function(_0x12a280,_0x1267b1){if(_[_0x090e('0x18')](_0x1897bc['dialTimezone'])){_0x12a280({'ret':_0x4a401e});}else{_0x167529[_0x090e('0x2b')][_0x090e('0x1a')]({'where':{'id':_0x30aacd['id']}})[_0x090e('0x1b')](function(_0x229a5d){if(!_[_0x090e('0x18')](_0x229a5d)){var _0x59ef99=_0x229a5d['dialTimezone'];if(!_[_0x090e('0x18')](_0x59ef99)){var _0x2ec56b=shared['timezones'];var _0x43fdbf=_0x2ec56b[_0x59ef99];var _0x557d92=_0x2ec56b[_0x1897bc[_0x090e('0x19')]];if(!_[_0x090e('0x18')](_0x43fdbf)&&!_['isNil'](_0x557d92)){var _0xd73fbf=_0x43fdbf[_0x090e('0x1c')]-_0x557d92[_0x090e('0x1c')];_0x4a401e=_0x1897bc['scheduledat']?_0x1897bc[_0x090e('0x15')]:moment();var _0x7bd0b9=moment(_0x4a401e)[_0x090e('0x1d')](_0xd73fbf,_0x090e('0x1e'));_0x12a280({'ret':_0x7bd0b9['format'](_0x090e('0x17'))});}else _0x12a280({'ret':_0x4a401e});}else _0x12a280({'ret':_0x4a401e});}else{_0x12a280({'ret':_0x4a401e});}});}});return 0xa;}var _0x3836f2=function(_0x49ee7e){return new BPromise(function(_0x3b80be,_0x14bd02){_0x457e5e(_0x49ee7e,_0x5e92b5)['then'](function(_0x3194e1){_0x5e92b5[_0x090e('0x15')]=_0x3194e1[_0x090e('0x1f')];_0x167529[_0x090e('0x20')][_0x090e('0x1a')]({'where':{'phone':_0x5e92b5['phone'],'CampaignId':_0x49ee7e['id']}})[_0x090e('0x1b')](function(_0x1e6b1c){if(!_[_0x090e('0x18')](_0x1e6b1c)){throw new Error(_0x090e('0x21')+_0x5e92b5[_0x090e('0x8')]+_0x090e('0x2c')+_0x49ee7e['id']);}return _0x167529[_0x090e('0x20')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5[_0x090e('0x24')]:0x2,'scheduledat':_0x5e92b5[_0x090e('0x15')]?_0x5e92b5[_0x090e('0x15')]:moment()[_0x090e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5e92b5[_0x090e('0x25')]?!![]:![],'callbackuniqueid':_0x5e92b5[_0x090e('0x25')]?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5[_0x090e('0x25')]?moment()['format'](_0x090e('0x17')):undefined,'CampaignId':_0x49ee7e['id']});})[_0x090e('0x2a')](function(_0x32f0d8){_0x14bd02(_0x32f0d8);});});});};var _0x2115ee=function(_0x3f77ed){return new BPromise(function(_0x1ce962,_0x4bb300){_0x457e5e(_0x3f77ed,_0x5e92b5)['then'](function(_0x58103b){_0x5e92b5[_0x090e('0x15')]=_0x58103b[_0x090e('0x1f')];_0x167529[_0x090e('0x20')][_0x090e('0x1a')]({'where':{'phone':_0x5e92b5[_0x090e('0x8')],'CampaignId':_0x3f77ed['id']}})['then'](function(_0x3b90df){if(!_['isNil'](_0x3b90df)){throw new Error(_0x090e('0x21')+_0x5e92b5[_0x090e('0x8')]+_0x090e('0x2d')+_0x3f77ed['id']);}return _0x167529[_0x090e('0x27')][_0x090e('0x1a')]({'where':{'calleridnum':_0x5e92b5[_0x090e('0x8')],'CampaignId':_0x3f77ed['id']}});})[_0x090e('0x1b')](function(_0x15cd3e){if(!_['isNil'](_0x15cd3e)){throw new Error(_0x090e('0x2e')+_0x5e92b5[_0x090e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3f77ed['id']);}return _0x167529[_0x090e('0x20')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5[_0x090e('0x24')]:0x2,'scheduledat':_0x5e92b5[_0x090e('0x15')]?_0x5e92b5[_0x090e('0x15')]:moment()[_0x090e('0x16')](_0x090e('0x17')),'callback':_0x5e92b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5e92b5[_0x090e('0x25')]?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5[_0x090e('0x25')]?moment()[_0x090e('0x16')](_0x090e('0x17')):undefined,'CampaignId':_0x3f77ed['id']});})[_0x090e('0x2a')](function(_0x49e683){_0x4bb300(_0x49e683);});});});};if(_0x5e92b5['ListId']){_0x167529[_0x090e('0x2f')][_0x090e('0x30')]({'where':{'type':_0x090e('0x31')},'attributes':['id',_0x090e('0x32'),_0x090e('0x19')],'include':[{'model':_0x167529[_0x090e('0x33')],'as':_0x090e('0x34'),'where':{'id':_0x5e92b5[_0x090e('0x29')]}}]})[_0x090e('0x1b')](function(_0x2aa9a7){if(_0x2aa9a7){var _0xe2f1c6=[];for(var _0x4a7b6b=0x0,_0x4a4739;_0x4a7b6b<_0x2aa9a7[_0x090e('0x35')];_0x4a7b6b+=0x1){_0x4a4739=_0x2aa9a7[_0x4a7b6b][_0x090e('0x10')]({'plain':!![]});switch(_0x4a4739[_0x090e('0x32')]){case'always':_0x2dee87(_0x4a4739)[_0x090e('0x2a')](_0x40810a());break;case'onlyIfOpen':_0x5ddb30(_0x4a4739)['catch'](_0x40810a());break;default:_0x457e5e(_0x4a4739,_0x5e92b5)[_0x090e('0x1b')](function(_0x30ed02){_0x5e92b5[_0x090e('0x15')]=_0x30ed02[_0x090e('0x1f')];_0x167529[_0x090e('0x20')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'scheduledat':_0x5e92b5['scheduledat']?_0x5e92b5['scheduledat']:moment()['format'](_0x090e('0x17')),'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5[_0x090e('0x24')]:0x2,'callback':_0x5e92b5[_0x090e('0x25')]?!![]:![],'callbackuniqueid':_0x5e92b5[_0x090e('0x25')]?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5[_0x090e('0x25')]?moment()[_0x090e('0x16')](_0x090e('0x17')):undefined,'VoiceQueueId':_0x4a4739['id']})[_0x090e('0x2a')](_0x40810a());});}}}})[_0x090e('0x1b')](function(){return _0x167529[_0x090e('0x2f')][_0x090e('0x30')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x167529['CmList'],'as':_0x090e('0x36'),'where':{'id':_0x5e92b5[_0x090e('0x29')]}}]})['then'](function(_0x45fbb0){if(_0x45fbb0){var _0x4fb42b=[];for(var _0x42650b=0x0,_0x779296;_0x42650b<_0x45fbb0['length'];_0x42650b+=0x1){_0x779296=_0x45fbb0[_0x42650b]['get']({'plain':!![]});_0x167529[_0x090e('0x37')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'VoiceQueueId':_0x779296['id']})[_0x090e('0x2a')](function(_0x451586){logger[_0x090e('0x11')](_0x090e('0x38'),_0x090e('0x13'),_0x451586[_0x090e('0x39')]);});}}});})[_0x090e('0x1b')](function(){return _0x167529[_0x090e('0x2b')][_0x090e('0x30')]({'attributes':['id',_0x090e('0x32'),_0x090e('0x19')],'include':[{'model':_0x167529[_0x090e('0x33')],'as':_0x090e('0x34'),'where':{'id':_0x5e92b5[_0x090e('0x29')]}}]})['then'](function(_0x3bf7bd){if(_0x3bf7bd){var _0x42e619=[];for(var _0x4699b3=0x0,_0x5444e6;_0x4699b3<_0x3bf7bd[_0x090e('0x35')];_0x4699b3+=0x1){_0x5444e6=_0x3bf7bd[_0x4699b3][_0x090e('0x10')]({'plain':!![]});switch(_0x5444e6[_0x090e('0x32')]){case _0x090e('0x3a'):_0x2115ee(_0x5444e6)[_0x090e('0x2a')](_0x4dc845());break;case _0x090e('0x3b'):_0x3836f2(_0x5444e6)['catch'](_0x4dc845());break;default:_0x167529[_0x090e('0x20')]['create']({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5['ListId'],'scheduledat':_0x5e92b5[_0x090e('0x15')]?_0x5e92b5[_0x090e('0x15')]:moment()[_0x090e('0x16')](_0x090e('0x17')),'priority':_0x5e92b5[_0x090e('0x24')]?_0x5e92b5[_0x090e('0x24')]:0x2,'callback':_0x5e92b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5e92b5[_0x090e('0x25')]?_0x5e92b5[_0x090e('0x25')]:undefined,'callbackat':_0x5e92b5[_0x090e('0x25')]?moment()[_0x090e('0x16')](_0x090e('0x17')):undefined,'CampaignId':_0x5444e6['id']})[_0x090e('0x2a')](_0x4dc845());}}}});})['then'](function(){return _0x167529[_0x090e('0x2b')][_0x090e('0x30')]({'attributes':['id'],'include':[{'model':_0x167529[_0x090e('0x33')],'as':'BlackLists','where':{'id':_0x5e92b5['ListId']}}]})[_0x090e('0x1b')](function(_0x3784a5){if(_0x3784a5){var _0x2a0798=[];for(var _0x2881cf=0x0,_0x57d02b;_0x2881cf<_0x3784a5[_0x090e('0x35')];_0x2881cf+=0x1){_0x57d02b=_0x3784a5[_0x2881cf]['get']({'plain':!![]});_0x167529[_0x090e('0x37')][_0x090e('0x23')]({'phone':_0x5e92b5[_0x090e('0x8')],'ContactId':_0x5e92b5['id'],'ListId':_0x5e92b5[_0x090e('0x29')],'CampaignId':_0x57d02b['id']})[_0x090e('0x2a')](function(_0x27055f){logger[_0x090e('0x11')](_0x090e('0x38'),'afterCreate',_0x27055f[_0x090e('0x39')]);});}}});})[_0x090e('0x1b')](function(){_0x53b688();})[_0x090e('0x2a')](function(_0x1b36b2){logger[_0x090e('0x11')](_0x090e('0x38'),_0x090e('0x13'),_0x1b36b2[_0x090e('0x39')]);_0x53b688(_0x1b36b2);});}else{_0x53b688(new Error(_0x090e('0x3c')));}},'afterDestroy':function(_0x2de6b1,_0x2b19f6,_0x4b8ea5){var _0x27d60a=_0x5eedd3['models'];var _0x40cb8a=_0x2de6b1['get']({'plain':!![]});return _0x27d60a['CmHopper'][_0x090e('0x30')]({'raw':!![],'where':{'ListId':_0x40cb8a[_0x090e('0x29')],'ContactId':_0x40cb8a['id']}})[_0x090e('0x1b')](function(_0x2e4607){if(!_[_0x090e('0x3d')](_0x2e4607)){var _0x41d5a3=[];for(var _0x300b70=0x0;_0x300b70<_0x2e4607[_0x090e('0x35')];_0x300b70+=0x1){var _0x110bbe=_0x27d60a[_0x090e('0x20')][_0x090e('0x3e')]({'where':{'ListId':_0x2e4607[_0x300b70]['ListId'],'ContactId':_0x2e4607[_0x300b70][_0x090e('0x3f')],'VoiceQueueId':_0x2e4607[_0x300b70]['VoiceQueueId'],'CampaignId':_0x2e4607[_0x300b70]['CampaignId']}});_0x41d5a3[_0x090e('0x40')](_0x110bbe);}return BPromise[_0x090e('0x41')](_0x41d5a3);}})[_0x090e('0x1b')](function(_0x1a772b){logger['info'](_0x090e('0x42'),util[_0x090e('0x14')](_0x1a772b,{'showHidden':![],'depth':null}));_0x4b8ea5();})[_0x090e('0x2a')](function(_0x7dd3ca){logger[_0x090e('0x11')](_0x090e('0x43'),util[_0x090e('0x14')](_0x7dd3ca,{'showHidden':![],'depth':null}));_0x4b8ea5(_0x7dd3ca);});}}});}; \ No newline at end of file +var _0x11e4=['cmContact','afterCreate','inspect','format','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','scheduledat','add','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','length','always','onlyIfOpen','outbound','CmList','BlackLists','cmContact,\x20%s,\x20%s','message','CmHopperBlack','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','phone','fti_cm_contacts','firstName','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error'];(function(_0x153b64,_0x5a7e4f){var _0x530e9c=function(_0x464aa0){while(--_0x464aa0){_0x153b64['push'](_0x153b64['shift']());}};_0x530e9c(++_0x5a7e4f);}(_0x11e4,0x1af));var _0x411e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x11e4[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x411e('0x0'));var logger=require(_0x411e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x411e('0x2'));var fs=require('fs');var path=require(_0x411e('0x3'));var rimraf=require('rimraf');var config=require(_0x411e('0x4'));var shared=require(_0x411e('0x5'));var attributes=require('./cmContact.attributes');module[_0x411e('0x6')]=function(_0x59e20b,_0x42bdb2){return _0x59e20b[_0x411e('0x7')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x411e('0x8'),'fields':[_0x411e('0x8')]},{'name':_0x411e('0x9'),'fields':[_0x411e('0xa'),'lastName',_0x411e('0x8'),'mobile',_0x411e('0xb'),'email'],'type':_0x411e('0xc')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x411e('0xd'),'hooks':{'afterCreate':function(_0x12bfdb,_0x224f49,_0x199810){var _0x4f9c85=_0x59e20b[_0x411e('0xe')];var _0x56e6b1=_0x12bfdb[_0x411e('0xf')]({'plain':!![]});function _0x2cc45b(){return function(_0x976bc8){logger[_0x411e('0x10')](_0x411e('0x11'),_0x411e('0x12'),util[_0x411e('0x13')](_0x976bc8,{'showHidden':![],'depth':null}));};}function _0xf04a16(_0x2fa5e7,_0x58b6a9){var _0x353a6b=_0x58b6a9['scheduledat']?_0x58b6a9['scheduledat']:moment()[_0x411e('0x14')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xe342b7,_0x1073ec){if(_[_0x411e('0x15')](_0x58b6a9['dialTimezone'])){_0xe342b7({'ret':_0x353a6b});}else{_0x4f9c85[_0x411e('0x16')][_0x411e('0x17')]({'where':{'id':_0x2fa5e7['id']}})[_0x411e('0x18')](function(_0x32e8ce){if(!_[_0x411e('0x15')](_0x32e8ce)){var _0xda7591=_0x32e8ce[_0x411e('0x19')];if(!_[_0x411e('0x15')](_0xda7591)){var _0x3c649c=shared[_0x411e('0x1a')];var _0x496f63=_0x3c649c[_0xda7591];var _0x4b0731=_0x3c649c[_0x58b6a9[_0x411e('0x19')]];if(!_[_0x411e('0x15')](_0x496f63)&&!_[_0x411e('0x15')](_0x4b0731)){var _0x55fb04=_0x496f63[_0x411e('0x1b')]-_0x4b0731[_0x411e('0x1b')];_0x353a6b=_0x58b6a9[_0x411e('0x1c')]?_0x58b6a9[_0x411e('0x1c')]:moment();var _0x249c84=moment(_0x353a6b)[_0x411e('0x1d')](_0x55fb04,'minutes');_0xe342b7({'ret':_0x249c84[_0x411e('0x14')](_0x411e('0x1e'))});}else _0xe342b7({'ret':_0x353a6b});}else _0xe342b7({'ret':_0x353a6b});}else{_0xe342b7({'ret':_0x353a6b});}});}});return 0xa;}var _0x47c75c=function(_0x143bfd){return new BPromise(function(_0x1b86fc,_0x555000){_0xf04a16(_0x143bfd,_0x56e6b1)[_0x411e('0x18')](function(_0x4d3fc3){_0x56e6b1[_0x411e('0x1c')]=_0x4d3fc3[_0x411e('0x1f')];_0x4f9c85[_0x411e('0x20')]['findOne']({'where':{'phone':_0x56e6b1[_0x411e('0x8')],'VoiceQueueId':_0x143bfd['id']}})[_0x411e('0x18')](function(_0x405dee){if(!_[_0x411e('0x15')](_0x405dee)){throw new Error(_0x411e('0x21')+_0x56e6b1[_0x411e('0x8')]+_0x411e('0x22')+_0x143bfd['id']);}return _0x4f9c85[_0x411e('0x20')]['create']({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1[_0x411e('0x23')],'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1[_0x411e('0x24')]:0x2,'scheduledat':_0x56e6b1[_0x411e('0x1c')]?_0x56e6b1[_0x411e('0x1c')]:moment()['format'](_0x411e('0x1e')),'callback':_0x56e6b1[_0x411e('0x25')]?!![]:![],'callbackuniqueid':_0x56e6b1['callbackUniqueid']?_0x56e6b1['callbackUniqueid']:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()[_0x411e('0x14')](_0x411e('0x1e')):undefined,'VoiceQueueId':_0x143bfd['id']});})['catch'](function(_0x57e047){_0x555000(_0x57e047);});});});};var _0x8e3823=function(_0x319fa8){return new BPromise(function(_0x4b69d6,_0x446c87){_0xf04a16(_0x319fa8,_0x56e6b1)['then'](function(_0x3f0e4f){_0x56e6b1[_0x411e('0x1c')]=_0x3f0e4f[_0x411e('0x1f')];_0x4f9c85[_0x411e('0x20')][_0x411e('0x17')]({'where':{'phone':_0x56e6b1[_0x411e('0x8')],'VoiceQueueId':_0x319fa8['id']}})[_0x411e('0x18')](function(_0xd449a8){if(!_['isNil'](_0xd449a8)){throw new Error(_0x411e('0x21')+_0x56e6b1[_0x411e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x319fa8['id']);}return _0x4f9c85[_0x411e('0x26')][_0x411e('0x17')]({'where':{'calleridnum':_0x56e6b1[_0x411e('0x8')],'VoiceQueueId':_0x319fa8['id']}});})[_0x411e('0x18')](function(_0x92151d){if(!_[_0x411e('0x15')](_0x92151d)){throw new Error(_0x411e('0x27')+_0x56e6b1[_0x411e('0x8')]+_0x411e('0x28')+_0x319fa8['id']);}return _0x4f9c85['CmHopper']['create']({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1['ListId'],'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1['priority']:0x2,'scheduledat':_0x56e6b1[_0x411e('0x1c')]?_0x56e6b1[_0x411e('0x1c')]:moment()['format'](_0x411e('0x1e')),'callback':_0x56e6b1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x56e6b1['callbackUniqueid']?_0x56e6b1[_0x411e('0x25')]:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()['format'](_0x411e('0x1e')):undefined,'VoiceQueueId':_0x319fa8['id']});})[_0x411e('0x29')](function(_0x34eac6){_0x446c87(_0x34eac6);});});});};function _0x1a7133(){return function(_0x2505a0){logger[_0x411e('0x10')](_0x411e('0x11'),_0x411e('0x12'),util['inspect'](_0x2505a0,{'showHidden':![],'depth':null}));};}function _0x2d4734(_0x427cab,_0x570e93){var _0x28c33e=_0x570e93[_0x411e('0x1c')]?_0x570e93[_0x411e('0x1c')]:moment()[_0x411e('0x14')](_0x411e('0x1e'));return new BPromise(function(_0x4381ef,_0x3ebe34){if(_[_0x411e('0x15')](_0x570e93['dialTimezone'])){_0x4381ef({'ret':_0x28c33e});}else{_0x4f9c85[_0x411e('0x2a')][_0x411e('0x17')]({'where':{'id':_0x427cab['id']}})[_0x411e('0x18')](function(_0x50f240){if(!_[_0x411e('0x15')](_0x50f240)){var _0x160602=_0x50f240['dialTimezone'];if(!_[_0x411e('0x15')](_0x160602)){var _0x26672b=shared['timezones'];var _0x310c93=_0x26672b[_0x160602];var _0x4c76ef=_0x26672b[_0x570e93['dialTimezone']];if(!_[_0x411e('0x15')](_0x310c93)&&!_[_0x411e('0x15')](_0x4c76ef)){var _0x2e4944=_0x310c93[_0x411e('0x1b')]-_0x4c76ef['utcOffset'];_0x28c33e=_0x570e93[_0x411e('0x1c')]?_0x570e93[_0x411e('0x1c')]:moment();var _0x442b5a=moment(_0x28c33e)['add'](_0x2e4944,'minutes');_0x4381ef({'ret':_0x442b5a['format'](_0x411e('0x1e'))});}else _0x4381ef({'ret':_0x28c33e});}else _0x4381ef({'ret':_0x28c33e});}else{_0x4381ef({'ret':_0x28c33e});}});}});return 0xa;}var _0x48b89e=function(_0x40ffa4){return new BPromise(function(_0x4664a8,_0x5af4ee){_0x2d4734(_0x40ffa4,_0x56e6b1)[_0x411e('0x18')](function(_0x528b3c){_0x56e6b1['scheduledat']=_0x528b3c[_0x411e('0x1f')];_0x4f9c85[_0x411e('0x20')]['findOne']({'where':{'phone':_0x56e6b1[_0x411e('0x8')],'CampaignId':_0x40ffa4['id']}})[_0x411e('0x18')](function(_0xaa7e08){if(!_[_0x411e('0x15')](_0xaa7e08)){throw new Error('cmContact,\x20afterCreate\x20'+_0x56e6b1[_0x411e('0x8')]+_0x411e('0x2b')+_0x40ffa4['id']);}return _0x4f9c85[_0x411e('0x20')][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1['ListId'],'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1['priority']:0x2,'scheduledat':_0x56e6b1[_0x411e('0x1c')]?_0x56e6b1[_0x411e('0x1c')]:moment()[_0x411e('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x56e6b1[_0x411e('0x25')]?!![]:![],'callbackuniqueid':_0x56e6b1[_0x411e('0x25')]?_0x56e6b1[_0x411e('0x25')]:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()['format'](_0x411e('0x1e')):undefined,'CampaignId':_0x40ffa4['id']});})[_0x411e('0x29')](function(_0xd2ca9c){_0x5af4ee(_0xd2ca9c);});});});};var _0x2df2ad=function(_0x3746ec){return new BPromise(function(_0x44f078,_0x5c144d){_0x2d4734(_0x3746ec,_0x56e6b1)[_0x411e('0x18')](function(_0x4ee55b){_0x56e6b1['scheduledat']=_0x4ee55b[_0x411e('0x1f')];_0x4f9c85[_0x411e('0x20')][_0x411e('0x17')]({'where':{'phone':_0x56e6b1['phone'],'CampaignId':_0x3746ec['id']}})[_0x411e('0x18')](function(_0x5043ce){if(!_[_0x411e('0x15')](_0x5043ce)){throw new Error('cmContact,\x20afterCreate\x20'+_0x56e6b1[_0x411e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3746ec['id']);}return _0x4f9c85['CmHopperFinal'][_0x411e('0x17')]({'where':{'calleridnum':_0x56e6b1[_0x411e('0x8')],'CampaignId':_0x3746ec['id']}});})[_0x411e('0x18')](function(_0x1eede3){if(!_[_0x411e('0x15')](_0x1eede3)){throw new Error(_0x411e('0x27')+_0x56e6b1[_0x411e('0x8')]+_0x411e('0x2d')+_0x3746ec['id']);}return _0x4f9c85['CmHopper'][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1[_0x411e('0x23')],'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1[_0x411e('0x24')]:0x2,'scheduledat':_0x56e6b1['scheduledat']?_0x56e6b1[_0x411e('0x1c')]:moment()['format'](_0x411e('0x1e')),'callback':_0x56e6b1[_0x411e('0x25')]?!![]:![],'callbackuniqueid':_0x56e6b1['callbackUniqueid']?_0x56e6b1[_0x411e('0x25')]:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()[_0x411e('0x14')](_0x411e('0x1e')):undefined,'CampaignId':_0x3746ec['id']});})[_0x411e('0x29')](function(_0x439f7c){_0x5c144d(_0x439f7c);});});});};if(_0x56e6b1[_0x411e('0x23')]){_0x4f9c85[_0x411e('0x16')][_0x411e('0x2e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x411e('0x19')],'include':[{'model':_0x4f9c85['CmList'],'as':'Lists','where':{'id':_0x56e6b1['ListId']}}]})[_0x411e('0x18')](function(_0x8c88ad){if(_0x8c88ad){var _0x58ef0c=[];for(var _0x50d6af=0x0,_0x417610;_0x50d6af<_0x8c88ad[_0x411e('0x2f')];_0x50d6af+=0x1){_0x417610=_0x8c88ad[_0x50d6af][_0x411e('0xf')]({'plain':!![]});switch(_0x417610['dialCheckDuplicateType']){case _0x411e('0x30'):_0x8e3823(_0x417610)[_0x411e('0x29')](_0x2cc45b());break;case _0x411e('0x31'):_0x47c75c(_0x417610)[_0x411e('0x29')](_0x2cc45b());break;default:_0x2d4734(_0x417610,_0x56e6b1)[_0x411e('0x18')](function(_0x5d4314){_0x56e6b1[_0x411e('0x1c')]=_0x5d4314['ret'];_0x4f9c85[_0x411e('0x20')][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1[_0x411e('0x23')],'scheduledat':_0x56e6b1[_0x411e('0x1c')]?_0x56e6b1[_0x411e('0x1c')]:moment()[_0x411e('0x14')](_0x411e('0x1e')),'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1[_0x411e('0x24')]:0x2,'callback':_0x56e6b1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x56e6b1[_0x411e('0x25')]?_0x56e6b1['callbackUniqueid']:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()[_0x411e('0x14')](_0x411e('0x1e')):undefined,'VoiceQueueId':_0x417610['id']})[_0x411e('0x29')](_0x2cc45b());});}}}})[_0x411e('0x18')](function(){return _0x4f9c85[_0x411e('0x16')]['findAll']({'where':{'type':_0x411e('0x32')},'attributes':['id'],'include':[{'model':_0x4f9c85[_0x411e('0x33')],'as':_0x411e('0x34'),'where':{'id':_0x56e6b1[_0x411e('0x23')]}}]})[_0x411e('0x18')](function(_0x48f638){if(_0x48f638){var _0x5a47ce=[];for(var _0x41db1f=0x0,_0x2e1636;_0x41db1f<_0x48f638[_0x411e('0x2f')];_0x41db1f+=0x1){_0x2e1636=_0x48f638[_0x41db1f][_0x411e('0xf')]({'plain':!![]});_0x4f9c85['CmHopperBlack'][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1['ListId'],'VoiceQueueId':_0x2e1636['id']})['catch'](function(_0x5af438){logger[_0x411e('0x10')](_0x411e('0x35'),'afterCreate',_0x5af438[_0x411e('0x36')]);});}}});})[_0x411e('0x18')](function(){return _0x4f9c85['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x4f9c85[_0x411e('0x33')],'as':'Lists','where':{'id':_0x56e6b1[_0x411e('0x23')]}}]})[_0x411e('0x18')](function(_0x775d55){if(_0x775d55){var _0x204f83=[];for(var _0x39ea42=0x0,_0x3c8bf6;_0x39ea42<_0x775d55[_0x411e('0x2f')];_0x39ea42+=0x1){_0x3c8bf6=_0x775d55[_0x39ea42][_0x411e('0xf')]({'plain':!![]});switch(_0x3c8bf6['dialCheckDuplicateType']){case'always':_0x2df2ad(_0x3c8bf6)[_0x411e('0x29')](_0x1a7133());break;case _0x411e('0x31'):_0x48b89e(_0x3c8bf6)[_0x411e('0x29')](_0x1a7133());break;default:_0x4f9c85[_0x411e('0x20')][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1[_0x411e('0x23')],'scheduledat':_0x56e6b1[_0x411e('0x1c')]?_0x56e6b1[_0x411e('0x1c')]:moment()[_0x411e('0x14')](_0x411e('0x1e')),'priority':_0x56e6b1[_0x411e('0x24')]?_0x56e6b1['priority']:0x2,'callback':_0x56e6b1[_0x411e('0x25')]?!![]:![],'callbackuniqueid':_0x56e6b1[_0x411e('0x25')]?_0x56e6b1[_0x411e('0x25')]:undefined,'callbackat':_0x56e6b1[_0x411e('0x25')]?moment()[_0x411e('0x14')](_0x411e('0x1e')):undefined,'CampaignId':_0x3c8bf6['id']})[_0x411e('0x29')](_0x1a7133());}}}});})[_0x411e('0x18')](function(){return _0x4f9c85[_0x411e('0x2a')][_0x411e('0x2e')]({'attributes':['id'],'include':[{'model':_0x4f9c85[_0x411e('0x33')],'as':_0x411e('0x34'),'where':{'id':_0x56e6b1[_0x411e('0x23')]}}]})[_0x411e('0x18')](function(_0x56c657){if(_0x56c657){var _0x4b0e0a=[];for(var _0xaf45dd=0x0,_0x4b4632;_0xaf45dd<_0x56c657[_0x411e('0x2f')];_0xaf45dd+=0x1){_0x4b4632=_0x56c657[_0xaf45dd][_0x411e('0xf')]({'plain':!![]});_0x4f9c85[_0x411e('0x37')][_0x411e('0x2c')]({'phone':_0x56e6b1[_0x411e('0x8')],'ContactId':_0x56e6b1['id'],'ListId':_0x56e6b1[_0x411e('0x23')],'CampaignId':_0x4b4632['id']})[_0x411e('0x29')](function(_0x5f2e61){logger[_0x411e('0x10')]('cmContact,\x20%s,\x20%s',_0x411e('0x12'),_0x5f2e61['message']);});}}});})[_0x411e('0x18')](function(){_0x199810();})[_0x411e('0x29')](function(_0x433fba){logger[_0x411e('0x10')](_0x411e('0x35'),_0x411e('0x12'),_0x433fba['message']);_0x199810(_0x433fba);});}else{_0x199810(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x834dcd,_0x180acf,_0x4785f3){var _0x303dc6=_0x59e20b[_0x411e('0xe')];var _0x3e78ed=_0x834dcd[_0x411e('0xf')]({'plain':!![]});return _0x303dc6[_0x411e('0x20')][_0x411e('0x2e')]({'raw':!![],'where':{'ListId':_0x3e78ed[_0x411e('0x23')],'ContactId':_0x3e78ed['id']}})['then'](function(_0x21544f){if(!_[_0x411e('0x38')](_0x21544f)){var _0xfa9fbb=[];for(var _0x532ad7=0x0;_0x532ad7<_0x21544f[_0x411e('0x2f')];_0x532ad7+=0x1){var _0x4a8143=_0x303dc6[_0x411e('0x20')][_0x411e('0x39')]({'where':{'ListId':_0x21544f[_0x532ad7]['ListId'],'ContactId':_0x21544f[_0x532ad7]['ContactId'],'VoiceQueueId':_0x21544f[_0x532ad7][_0x411e('0x3a')],'CampaignId':_0x21544f[_0x532ad7][_0x411e('0x3b')]}});_0xfa9fbb[_0x411e('0x3c')](_0x4a8143);}return BPromise[_0x411e('0x3d')](_0xfa9fbb);}})[_0x411e('0x18')](function(_0x25b50e){logger[_0x411e('0x3e')](_0x411e('0x3f'),util[_0x411e('0x13')](_0x25b50e,{'showHidden':![],'depth':null}));_0x4785f3();})[_0x411e('0x29')](function(_0x1d06c1){logger[_0x411e('0x10')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x1d06c1,{'showHidden':![],'depth':null}));_0x4785f3(_0x1d06c1);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 23504ef..77d0858 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4ba46f,_0x3678b5){var _0x1b63a1=function(_0x449df9){while(--_0x449df9){_0x4ba46f['push'](_0x4ba46f['shift']());}};_0x1b63a1(++_0x3678b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 7e8d8dc..79026a3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf021=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xf021,0x18f));var _0x1f02=function(_0x1389e3,_0x2ed4bd){_0x1389e3=_0x1389e3-0x0;var _0x3f6873=_0xf021[_0x1389e3];return _0x3f6873;};'use strict';var Sequelize=require(_0x1f02('0x0'));module[_0x1f02('0x1')]={'CmContactId':{'type':Sequelize[_0x1f02('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1f02('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1f02('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x1f02('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x1f02('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xc73e=['INTEGER','sequelize','exports','STRING'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xc73e,0x1e9));var _0xec73=function(_0x749def,_0x3e99c8){_0x749def=_0x749def-0x0;var _0x8331c2=_0xc73e[_0x749def];return _0x8331c2;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xec73('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xec73('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xec73('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d0f17c3..a7cb05e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f95=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','CmContactHasItems','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmContactHasItem','include','catch','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x2f95,0x180));var _0x52f9=function(_0x1d9547,_0x544568){_0x1d9547=_0x1d9547-0x0;var _0x86d9c2=_0x2f95[_0x1d9547];return _0x86d9c2;};'use strict';var emlformat=require(_0x52f9('0x0'));var rimraf=require(_0x52f9('0x1'));var zipdir=require(_0x52f9('0x2'));var jsonpatch=require(_0x52f9('0x3'));var rp=require(_0x52f9('0x4'));var moment=require(_0x52f9('0x5'));var BPromise=require(_0x52f9('0x6'));var Mustache=require(_0x52f9('0x7'));var util=require(_0x52f9('0x8'));var path=require(_0x52f9('0x9'));var sox=require(_0x52f9('0xa'));var csv=require(_0x52f9('0xb'));var ejs=require(_0x52f9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x52f9('0xe'));var deskjs=require(_0x52f9('0xf'));var toCsv=require(_0x52f9('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x52f9('0x10'));var authService=require(_0x52f9('0x11'));var qs=require(_0x52f9('0x12'));var as=require(_0x52f9('0x13'));var hardwareService=require(_0x52f9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x52f9('0x15'));var config=require(_0x52f9('0x16'));var licenseUtil=require(_0x52f9('0x17'));var db=require(_0x52f9('0x18'))['db'];function respondWithStatusCode(_0x186ee0,_0x5c7e43){_0x5c7e43=_0x5c7e43||0xcc;return function(_0xbe8639){if(_0xbe8639){return _0x186ee0[_0x52f9('0x19')](_0x5c7e43);}return _0x186ee0[_0x52f9('0x1a')](_0x5c7e43)['end']();};}function respondWithResult(_0x35c230,_0xcb05fe){_0xcb05fe=_0xcb05fe||0xc8;return function(_0x1461a1){if(_0x1461a1){return _0x35c230[_0x52f9('0x1a')](_0xcb05fe)[_0x52f9('0x1b')](_0x1461a1);}};}function respondWithFilteredResult(_0x25e4cc,_0x16b11b){return function(_0x2f4b36){if(_0x2f4b36){var _0x7eecc9=typeof _0x16b11b[_0x52f9('0x1c')]===_0x52f9('0x1d')&&typeof _0x16b11b[_0x52f9('0x1e')]==='undefined';var _0x2bc490=_0x2f4b36[_0x52f9('0x1f')];var _0x27e7cc=_0x7eecc9?0x0:_0x16b11b[_0x52f9('0x1c')];var _0x321a96=_0x7eecc9?_0x2f4b36[_0x52f9('0x1f')]:_0x16b11b[_0x52f9('0x1c')]+_0x16b11b[_0x52f9('0x1e')];var _0x3abe2b;if(_0x321a96>=_0x2bc490){_0x321a96=_0x2bc490;_0x3abe2b=0xc8;}else{_0x3abe2b=0xce;}_0x25e4cc[_0x52f9('0x1a')](_0x3abe2b);return _0x25e4cc['set'](_0x52f9('0x20'),_0x27e7cc+'-'+_0x321a96+'/'+_0x2bc490)[_0x52f9('0x1b')](_0x2f4b36);}return null;};}function patchUpdates(_0x489de1){return function(_0x3c4e5e){try{jsonpatch['apply'](_0x3c4e5e,_0x489de1,!![]);}catch(_0x5af1c2){return BPromise[_0x52f9('0x21')](_0x5af1c2);}return _0x3c4e5e[_0x52f9('0x22')]();};}function saveUpdates(_0x5bca2c,_0x92ecbd){return function(_0x3f5937){if(_0x3f5937){return _0x3f5937[_0x52f9('0x23')](_0x5bca2c)['then'](function(_0x19ef86){return _0x19ef86;});}return null;};}function removeEntity(_0x35a553,_0x3e4e43){return function(_0x2fc2d9){if(_0x2fc2d9){return _0x2fc2d9[_0x52f9('0x24')]()[_0x52f9('0x25')](function(){var _0x2a80ee=_0x2fc2d9[_0x52f9('0x26')]({'plain':!![]});var _0x4c132b=_0x52f9('0x27');return db['UserProfileResource'][_0x52f9('0x24')]({'where':{'type':_0x4c132b,'resourceId':_0x2a80ee['id']}})[_0x52f9('0x25')](function(){return _0x2fc2d9;});})['then'](function(){_0x35a553[_0x52f9('0x1a')](0xcc)[_0x52f9('0x28')]();});}};}function handleEntityNotFound(_0x10d314,_0x2a2395){return function(_0x5f357e){if(!_0x5f357e){_0x10d314['sendStatus'](0x194);}return _0x5f357e;};}function handleError(_0x297917,_0x3df452){_0x3df452=_0x3df452||0x1f4;return function(_0x20ca7a){logger[_0x52f9('0x29')](_0x20ca7a[_0x52f9('0x2a')]);if(_0x20ca7a[_0x52f9('0x2b')]){delete _0x20ca7a['name'];}_0x297917[_0x52f9('0x1a')](_0x3df452)[_0x52f9('0x2c')](_0x20ca7a);};}exports['index']=function(_0x2d5e3c,_0x304bf6){var _0x316fe4={},_0x7eff1c={},_0x576cdc={'count':0x0,'rows':[]};var _0x39642c=_[_0x52f9('0x2d')](db['CmContactHasItem'][_0x52f9('0x2e')],function(_0x124818){return{'name':_0x124818[_0x52f9('0x2f')],'type':_0x124818['type'][_0x52f9('0x30')]};});_0x7eff1c['model']=_[_0x52f9('0x2d')](_0x39642c,_0x52f9('0x2b'));_0x7eff1c[_0x52f9('0x31')]=_[_0x52f9('0x32')](_0x2d5e3c['query']);_0x7eff1c[_0x52f9('0x33')]=_[_0x52f9('0x34')](_0x7eff1c[_0x52f9('0x35')],_0x7eff1c[_0x52f9('0x31')]);_0x316fe4[_0x52f9('0x36')]=_[_0x52f9('0x34')](_0x7eff1c[_0x52f9('0x35')],qs[_0x52f9('0x37')](_0x2d5e3c['query'][_0x52f9('0x37')]));_0x316fe4['attributes']=_0x316fe4['attributes'][_0x52f9('0x38')]?_0x316fe4[_0x52f9('0x36')]:_0x7eff1c[_0x52f9('0x35')];if(!_0x2d5e3c[_0x52f9('0x31')][_0x52f9('0x39')](_0x52f9('0x3a'))){_0x316fe4[_0x52f9('0x1e')]=qs[_0x52f9('0x1e')](_0x2d5e3c['query'][_0x52f9('0x1e')]);_0x316fe4[_0x52f9('0x1c')]=qs[_0x52f9('0x1c')](_0x2d5e3c['query'][_0x52f9('0x1c')]);}_0x316fe4['order']=qs['sort'](_0x2d5e3c[_0x52f9('0x31')][_0x52f9('0x3b')]);_0x316fe4[_0x52f9('0x3c')]=qs[_0x52f9('0x33')](_[_0x52f9('0x3d')](_0x2d5e3c[_0x52f9('0x31')],_0x7eff1c[_0x52f9('0x33')]),_0x39642c);if(_0x2d5e3c[_0x52f9('0x31')][_0x52f9('0x3e')]){_0x316fe4[_0x52f9('0x3c')]=_[_0x52f9('0x3f')](_0x316fe4[_0x52f9('0x3c')],{'$or':_[_0x52f9('0x2d')](_0x39642c,function(_0x21a73b){if(_0x21a73b[_0x52f9('0x40')]!==_0x52f9('0x41')){var _0x3abcc1={};_0x3abcc1[_0x21a73b[_0x52f9('0x2b')]]={'$like':'%'+_0x2d5e3c[_0x52f9('0x31')][_0x52f9('0x3e')]+'%'};return _0x3abcc1;}})});}_0x316fe4=_['merge']({},_0x316fe4,_0x2d5e3c[_0x52f9('0x42')]);var _0x5ea6a6={'where':_0x316fe4[_0x52f9('0x3c')]};return db[_0x52f9('0x43')]['count'](_0x5ea6a6)[_0x52f9('0x25')](function(_0x1073ae){_0x576cdc[_0x52f9('0x1f')]=_0x1073ae;if(_0x2d5e3c[_0x52f9('0x31')]['includeAll']){_0x316fe4[_0x52f9('0x44')]=[{'all':!![]}];}return db[_0x52f9('0x43')]['findAll'](_0x316fe4);})[_0x52f9('0x25')](function(_0x43f14c){_0x576cdc['rows']=_0x43f14c;return _0x576cdc;})[_0x52f9('0x25')](respondWithFilteredResult(_0x304bf6,_0x316fe4))[_0x52f9('0x45')](handleError(_0x304bf6,null));};exports['show']=function(_0x4652b3,_0x3909ca){var _0x151d1f={'raw':!![],'where':{'id':_0x4652b3['params']['id']}},_0x4990ea={};_0x4990ea[_0x52f9('0x35')]=_[_0x52f9('0x32')](db[_0x52f9('0x43')][_0x52f9('0x2e')]);_0x4990ea['query']=_[_0x52f9('0x32')](_0x4652b3['query']);_0x4990ea['filters']=_['intersection'](_0x4990ea[_0x52f9('0x35')],_0x4990ea[_0x52f9('0x31')]);_0x151d1f[_0x52f9('0x36')]=_[_0x52f9('0x34')](_0x4990ea[_0x52f9('0x35')],qs['fields'](_0x4652b3[_0x52f9('0x31')][_0x52f9('0x37')]));_0x151d1f[_0x52f9('0x36')]=_0x151d1f[_0x52f9('0x36')]['length']?_0x151d1f[_0x52f9('0x36')]:_0x4990ea[_0x52f9('0x35')];if(_0x4652b3[_0x52f9('0x31')][_0x52f9('0x46')]){_0x151d1f[_0x52f9('0x44')]=[{'all':!![]}];}_0x151d1f=_[_0x52f9('0x3f')]({},_0x151d1f,_0x4652b3[_0x52f9('0x42')]);return db[_0x52f9('0x43')]['find'](_0x151d1f)[_0x52f9('0x25')](handleEntityNotFound(_0x3909ca,null))[_0x52f9('0x25')](respondWithResult(_0x3909ca,null))['catch'](handleError(_0x3909ca,null));};exports[_0x52f9('0x47')]=function(_0x368948,_0x3a97c2){return db['CmContactHasItem'][_0x52f9('0x47')](_0x368948[_0x52f9('0x48')],{})[_0x52f9('0x25')](function(_0xdd7255){var _0xde0793=_0x368948[_0x52f9('0x49')][_0x52f9('0x26')]({'plain':!![]});if(!_0xde0793)throw new Error(_0x52f9('0x4a'));if(_0xde0793[_0x52f9('0x4b')]===_0x52f9('0x49')){var _0x404398=_0xdd7255[_0x52f9('0x26')]({'plain':!![]});var _0x36123d=_0x52f9('0x27');return db[_0x52f9('0x4c')][_0x52f9('0x4d')]({'where':{'name':_0x36123d,'userProfileId':_0xde0793[_0x52f9('0x4e')]},'raw':!![]})[_0x52f9('0x25')](function(_0x15b3db){if(_0x15b3db&&_0x15b3db['autoAssociation']===0x0){return db['UserProfileResource'][_0x52f9('0x47')]({'name':_0x404398[_0x52f9('0x2b')],'resourceId':_0x404398['id'],'type':_0x15b3db[_0x52f9('0x2b')],'sectionId':_0x15b3db['id']},{})['then'](function(){return _0xdd7255;});}else{return _0xdd7255;}})[_0x52f9('0x45')](function(_0x4d7afe){logger[_0x52f9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d7afe);throw _0x4d7afe;});}return _0xdd7255;})['then'](respondWithResult(_0x3a97c2,0xc9))['catch'](handleError(_0x3a97c2,null));};exports[_0x52f9('0x23')]=function(_0x5457c5,_0x49015c){if(_0x5457c5[_0x52f9('0x48')]['id']){delete _0x5457c5[_0x52f9('0x48')]['id'];}return db[_0x52f9('0x43')]['find']({'where':{'id':_0x5457c5[_0x52f9('0x4f')]['id']}})[_0x52f9('0x25')](handleEntityNotFound(_0x49015c,null))[_0x52f9('0x25')](saveUpdates(_0x5457c5[_0x52f9('0x48')],null))[_0x52f9('0x25')](respondWithResult(_0x49015c,null))[_0x52f9('0x45')](handleError(_0x49015c,null));};exports[_0x52f9('0x24')]=function(_0x94aa11,_0x16d12b){return db[_0x52f9('0x43')][_0x52f9('0x4d')]({'where':{'id':_0x94aa11['params']['id']}})['then'](handleEntityNotFound(_0x16d12b,null))[_0x52f9('0x25')](removeEntity(_0x16d12b,null))[_0x52f9('0x45')](handleError(_0x16d12b,null));}; \ No newline at end of file +var _0x4be3=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','rows','params','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x4be3,0x148));var _0x34be=function(_0x3a1738,_0x1f8458){_0x3a1738=_0x3a1738-0x0;var _0x3e35d9=_0x4be3[_0x3a1738];return _0x3e35d9;};'use strict';var emlformat=require(_0x34be('0x0'));var rimraf=require(_0x34be('0x1'));var zipdir=require(_0x34be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34be('0x3'));var moment=require(_0x34be('0x4'));var BPromise=require(_0x34be('0x5'));var Mustache=require(_0x34be('0x6'));var util=require(_0x34be('0x7'));var path=require(_0x34be('0x8'));var sox=require(_0x34be('0x9'));var csv=require(_0x34be('0xa'));var ejs=require(_0x34be('0xb'));var fs=require('fs');var fs_extra=require(_0x34be('0xc'));var _=require(_0x34be('0xd'));var squel=require('squel');var crypto=require(_0x34be('0xe'));var jsforce=require(_0x34be('0xf'));var deskjs=require(_0x34be('0x10'));var toCsv=require(_0x34be('0xa'));var querystring=require(_0x34be('0x11'));var Papa=require(_0x34be('0x12'));var Redis=require(_0x34be('0x13'));var authService=require(_0x34be('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x34be('0x15'));var hardwareService=require(_0x34be('0x16'));var logger=require(_0x34be('0x17'))('api');var utils=require(_0x34be('0x18'));var config=require(_0x34be('0x19'));var licenseUtil=require(_0x34be('0x1a'));var db=require(_0x34be('0x1b'))['db'];function respondWithStatusCode(_0xf9fd80,_0x17d38a){_0x17d38a=_0x17d38a||0xcc;return function(_0x2a2087){if(_0x2a2087){return _0xf9fd80[_0x34be('0x1c')](_0x17d38a);}return _0xf9fd80[_0x34be('0x1d')](_0x17d38a)[_0x34be('0x1e')]();};}function respondWithResult(_0x594052,_0x44b834){_0x44b834=_0x44b834||0xc8;return function(_0x1089fe){if(_0x1089fe){return _0x594052[_0x34be('0x1d')](_0x44b834)[_0x34be('0x1f')](_0x1089fe);}};}function respondWithFilteredResult(_0x420d4e,_0x25843f){return function(_0x3487a2){if(_0x3487a2){var _0x2ea075=typeof _0x25843f[_0x34be('0x20')]===_0x34be('0x21')&&typeof _0x25843f[_0x34be('0x22')]===_0x34be('0x21');var _0x5c94a5=_0x3487a2['count'];var _0x467c8c=_0x2ea075?0x0:_0x25843f[_0x34be('0x20')];var _0x29fe11=_0x2ea075?_0x3487a2[_0x34be('0x23')]:_0x25843f[_0x34be('0x20')]+_0x25843f['limit'];var _0x249fbd;if(_0x29fe11>=_0x5c94a5){_0x29fe11=_0x5c94a5;_0x249fbd=0xc8;}else{_0x249fbd=0xce;}_0x420d4e['status'](_0x249fbd);return _0x420d4e[_0x34be('0x24')](_0x34be('0x25'),_0x467c8c+'-'+_0x29fe11+'/'+_0x5c94a5)[_0x34be('0x1f')](_0x3487a2);}return null;};}function patchUpdates(_0xe33985){return function(_0x4f898e){try{jsonpatch[_0x34be('0x26')](_0x4f898e,_0xe33985,!![]);}catch(_0x5de8d5){return BPromise[_0x34be('0x27')](_0x5de8d5);}return _0x4f898e[_0x34be('0x28')]();};}function saveUpdates(_0x53bbb8,_0x382f5e){return function(_0xd13f73){if(_0xd13f73){return _0xd13f73[_0x34be('0x29')](_0x53bbb8)[_0x34be('0x2a')](function(_0x3c8991){return _0x3c8991;});}return null;};}function removeEntity(_0x22b915,_0x25d5c7){return function(_0x3f871e){if(_0x3f871e){return _0x3f871e[_0x34be('0x2b')]()['then'](function(){var _0x620cd=_0x3f871e[_0x34be('0x2c')]({'plain':!![]});var _0x5da8e2=_0x34be('0x2d');return db['UserProfileResource'][_0x34be('0x2b')]({'where':{'type':_0x5da8e2,'resourceId':_0x620cd['id']}})['then'](function(){return _0x3f871e;});})['then'](function(){_0x22b915[_0x34be('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6eb4,_0xc5ef05){return function(_0x17364e){if(!_0x17364e){_0x4c6eb4[_0x34be('0x1c')](0x194);}return _0x17364e;};}function handleError(_0x247d22,_0x3b1b70){_0x3b1b70=_0x3b1b70||0x1f4;return function(_0x84abcb){logger['error'](_0x84abcb[_0x34be('0x2e')]);if(_0x84abcb[_0x34be('0x2f')]){delete _0x84abcb[_0x34be('0x2f')];}_0x247d22[_0x34be('0x1d')](_0x3b1b70)[_0x34be('0x30')](_0x84abcb);};}exports['index']=function(_0x3f321e,_0x4d2075){var _0xd53074={},_0x2fc421={},_0xaaf99d={'count':0x0,'rows':[]};var _0x376daf=_[_0x34be('0x31')](db[_0x34be('0x32')][_0x34be('0x33')],function(_0x117aad){return{'name':_0x117aad[_0x34be('0x34')],'type':_0x117aad['type'][_0x34be('0x35')]};});_0x2fc421[_0x34be('0x36')]=_[_0x34be('0x31')](_0x376daf,_0x34be('0x2f'));_0x2fc421[_0x34be('0x37')]=_['keys'](_0x3f321e[_0x34be('0x37')]);_0x2fc421['filters']=_['intersection'](_0x2fc421['model'],_0x2fc421[_0x34be('0x37')]);_0xd53074[_0x34be('0x38')]=_[_0x34be('0x39')](_0x2fc421[_0x34be('0x36')],qs[_0x34be('0x3a')](_0x3f321e[_0x34be('0x37')]['fields']));_0xd53074[_0x34be('0x38')]=_0xd53074['attributes']['length']?_0xd53074[_0x34be('0x38')]:_0x2fc421[_0x34be('0x36')];if(!_0x3f321e['query'][_0x34be('0x3b')](_0x34be('0x3c'))){_0xd53074[_0x34be('0x22')]=qs['limit'](_0x3f321e[_0x34be('0x37')][_0x34be('0x22')]);_0xd53074[_0x34be('0x20')]=qs['offset'](_0x3f321e['query'][_0x34be('0x20')]);}_0xd53074[_0x34be('0x3d')]=qs[_0x34be('0x3e')](_0x3f321e['query'][_0x34be('0x3e')]);_0xd53074[_0x34be('0x3f')]=qs[_0x34be('0x40')](_[_0x34be('0x41')](_0x3f321e['query'],_0x2fc421[_0x34be('0x40')]),_0x376daf);if(_0x3f321e[_0x34be('0x37')][_0x34be('0x42')]){_0xd53074[_0x34be('0x3f')]=_['merge'](_0xd53074[_0x34be('0x3f')],{'$or':_[_0x34be('0x31')](_0x376daf,function(_0x3a58e9){if(_0x3a58e9[_0x34be('0x43')]!==_0x34be('0x44')){var _0x1dbe5d={};_0x1dbe5d[_0x3a58e9[_0x34be('0x2f')]]={'$like':'%'+_0x3f321e[_0x34be('0x37')][_0x34be('0x42')]+'%'};return _0x1dbe5d;}})});}_0xd53074=_[_0x34be('0x45')]({},_0xd53074,_0x3f321e[_0x34be('0x46')]);var _0x156150={'where':_0xd53074[_0x34be('0x3f')]};return db[_0x34be('0x32')]['count'](_0x156150)[_0x34be('0x2a')](function(_0x3ddcb7){_0xaaf99d['count']=_0x3ddcb7;if(_0x3f321e['query']['includeAll']){_0xd53074[_0x34be('0x47')]=[{'all':!![]}];}return db[_0x34be('0x32')]['findAll'](_0xd53074);})[_0x34be('0x2a')](function(_0xc0be09){_0xaaf99d[_0x34be('0x48')]=_0xc0be09;return _0xaaf99d;})[_0x34be('0x2a')](respondWithFilteredResult(_0x4d2075,_0xd53074))['catch'](handleError(_0x4d2075,null));};exports['show']=function(_0x3c52ac,_0xc9adae){var _0x123012={'raw':!![],'where':{'id':_0x3c52ac[_0x34be('0x49')]['id']}},_0x4b6693={};_0x4b6693['model']=_['keys'](db['CmContactHasItem'][_0x34be('0x33')]);_0x4b6693[_0x34be('0x37')]=_[_0x34be('0x4a')](_0x3c52ac['query']);_0x4b6693[_0x34be('0x40')]=_['intersection'](_0x4b6693[_0x34be('0x36')],_0x4b6693[_0x34be('0x37')]);_0x123012[_0x34be('0x38')]=_[_0x34be('0x39')](_0x4b6693[_0x34be('0x36')],qs[_0x34be('0x3a')](_0x3c52ac['query'][_0x34be('0x3a')]));_0x123012['attributes']=_0x123012[_0x34be('0x38')][_0x34be('0x4b')]?_0x123012[_0x34be('0x38')]:_0x4b6693[_0x34be('0x36')];if(_0x3c52ac[_0x34be('0x37')][_0x34be('0x4c')]){_0x123012[_0x34be('0x47')]=[{'all':!![]}];}_0x123012=_[_0x34be('0x45')]({},_0x123012,_0x3c52ac['options']);return db[_0x34be('0x32')][_0x34be('0x4d')](_0x123012)[_0x34be('0x2a')](handleEntityNotFound(_0xc9adae,null))[_0x34be('0x2a')](respondWithResult(_0xc9adae,null))[_0x34be('0x4e')](handleError(_0xc9adae,null));};exports['create']=function(_0x3e2903,_0x275a84){return db[_0x34be('0x32')][_0x34be('0x4f')](_0x3e2903[_0x34be('0x50')],{})[_0x34be('0x2a')](function(_0x205ce7){var _0x29a56d=_0x3e2903[_0x34be('0x51')]['get']({'plain':!![]});if(!_0x29a56d)throw new Error(_0x34be('0x52'));if(_0x29a56d['role']===_0x34be('0x51')){var _0x5b21db=_0x205ce7[_0x34be('0x2c')]({'plain':!![]});var _0x559395=_0x34be('0x2d');return db[_0x34be('0x53')][_0x34be('0x4d')]({'where':{'name':_0x559395,'userProfileId':_0x29a56d[_0x34be('0x54')]},'raw':!![]})['then'](function(_0x14fd32){if(_0x14fd32&&_0x14fd32[_0x34be('0x55')]===0x0){return db[_0x34be('0x56')][_0x34be('0x4f')]({'name':_0x5b21db['name'],'resourceId':_0x5b21db['id'],'type':_0x14fd32[_0x34be('0x2f')],'sectionId':_0x14fd32['id']},{})[_0x34be('0x2a')](function(){return _0x205ce7;});}else{return _0x205ce7;}})[_0x34be('0x4e')](function(_0x5822c4){logger[_0x34be('0x57')](_0x34be('0x58'),_0x5822c4);throw _0x5822c4;});}return _0x205ce7;})[_0x34be('0x2a')](respondWithResult(_0x275a84,0xc9))[_0x34be('0x4e')](handleError(_0x275a84,null));};exports[_0x34be('0x29')]=function(_0x1822ca,_0x33fba8){if(_0x1822ca[_0x34be('0x50')]['id']){delete _0x1822ca[_0x34be('0x50')]['id'];}return db[_0x34be('0x32')][_0x34be('0x4d')]({'where':{'id':_0x1822ca[_0x34be('0x49')]['id']}})[_0x34be('0x2a')](handleEntityNotFound(_0x33fba8,null))['then'](saveUpdates(_0x1822ca[_0x34be('0x50')],null))[_0x34be('0x2a')](respondWithResult(_0x33fba8,null))[_0x34be('0x4e')](handleError(_0x33fba8,null));};exports[_0x34be('0x2b')]=function(_0x5a5eb3,_0x217297){return db['CmContactHasItem'][_0x34be('0x4d')]({'where':{'id':_0x5a5eb3[_0x34be('0x49')]['id']}})['then'](handleEntityNotFound(_0x217297,null))[_0x34be('0x2a')](removeEntity(_0x217297,null))[_0x34be('0x4e')](handleError(_0x217297,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5644fd8..ddfbcf4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb68=['rimraf','./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','util','api','moment','bluebird','request-promise'];(function(_0x30f31c,_0x2f8ddc){var _0xcef126=function(_0x43699e){while(--_0x43699e){_0x30f31c['push'](_0x30f31c['shift']());}};_0xcef126(++_0x2f8ddc);}(_0xcb68,0x1a2));var _0x8cb6=function(_0x811622,_0x53a2ea){_0x811622=_0x811622-0x0;var _0x1d2a2e=_0xcb68[_0x811622];return _0x1d2a2e;};'use strict';var _=require('lodash');var util=require(_0x8cb6('0x0'));var logger=require('../../config/logger')(_0x8cb6('0x1'));var moment=require(_0x8cb6('0x2'));var BPromise=require(_0x8cb6('0x3'));var rp=require(_0x8cb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cb6('0x5'));var config=require('../../config/environment');var attributes=require(_0x8cb6('0x6'));module['exports']=function(_0x33cc19,_0x3d7a62){return _0x33cc19['define'](_0x8cb6('0x7'),attributes,{'tableName':_0x8cb6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa356=['../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','../../config/logger','request-promise','rimraf'];(function(_0x5510d8,_0x4ad693){var _0x5d2f61=function(_0x5c31ce){while(--_0x5c31ce){_0x5510d8['push'](_0x5510d8['shift']());}};_0x5d2f61(++_0x4ad693);}(_0xa356,0x1ec));var _0x6a35=function(_0x15f3e7,_0x5bbbdf){_0x15f3e7=_0x15f3e7-0x0;var _0x15d66a=_0xa356[_0x15f3e7];return _0x15d66a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a35('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a35('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a35('0x2'));var config=require(_0x6a35('0x3'));var attributes=require(_0x6a35('0x4'));module[_0x6a35('0x5')]=function(_0x2e8a2f,_0x116534){return _0x2e8a2f[_0x6a35('0x6')](_0x6a35('0x7'),attributes,{'tableName':_0x6a35('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index b78d1d4..8c62d59 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e39=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x10c930,_0x49d445){var _0x4f1440=function(_0x1ad327){while(--_0x1ad327){_0x10c930['push'](_0x10c930['shift']());}};_0x4f1440(++_0x49d445);}(_0x9e39,0x159));var _0x99e3=function(_0x995124,_0x52bfec){_0x995124=_0x995124-0x0;var _0x114a81=_0x9e39[_0x995124];return _0x114a81;};'use strict';var _=require(_0x99e3('0x0'));var util=require('util');var moment=require(_0x99e3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99e3('0x2'))['db'];var utils=require(_0x99e3('0x3'));var logger=require(_0x99e3('0x4'))('rpc');var config=require(_0x99e3('0x5'));var jayson=require(_0x99e3('0x6'));var client=jayson[_0x99e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0f86,_0x2ab7b4,_0x19b2e5){return new BPromise(function(_0x58e8f6,_0x5d3206){return client[_0x99e3('0x8')](_0x5f0f86,_0x19b2e5)[_0x99e3('0x9')](function(_0x26db52){logger[_0x99e3('0xa')](_0x99e3('0xb'),_0x2ab7b4,_0x99e3('0xc'));logger[_0x99e3('0xd')](_0x99e3('0xe'),_0x2ab7b4,_0x99e3('0xc'),JSON[_0x99e3('0xf')](_0x26db52));if(_0x26db52[_0x99e3('0x10')]){if(_0x26db52[_0x99e3('0x10')][_0x99e3('0x11')]===0x1f4){logger[_0x99e3('0x10')](_0x99e3('0xb'),_0x2ab7b4,_0x26db52[_0x99e3('0x10')]['message']);return _0x5d3206(_0x26db52[_0x99e3('0x10')][_0x99e3('0x12')]);}logger[_0x99e3('0x10')](_0x99e3('0xb'),_0x2ab7b4,_0x26db52[_0x99e3('0x10')]['message']);return _0x58e8f6(_0x26db52[_0x99e3('0x10')][_0x99e3('0x12')]);}else{logger[_0x99e3('0xa')](_0x99e3('0xb'),_0x2ab7b4,_0x99e3('0xc'));_0x58e8f6(_0x26db52[_0x99e3('0x13')]['message']);}})[_0x99e3('0x14')](function(_0x4a4516){logger[_0x99e3('0x10')](_0x99e3('0xb'),_0x2ab7b4,_0x4a4516);_0x5d3206(_0x4a4516);});});} \ No newline at end of file +var _0xc589=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2b5e15,_0x44227d){var _0x2f3426=function(_0x348866){while(--_0x348866){_0x2b5e15['push'](_0x2b5e15['shift']());}};_0x2f3426(++_0x44227d);}(_0xc589,0x83));var _0x9c58=function(_0x906cd1,_0x2add5b){_0x906cd1=_0x906cd1-0x0;var _0x319288=_0xc589[_0x906cd1];return _0x319288;};'use strict';var _=require(_0x9c58('0x0'));var util=require(_0x9c58('0x1'));var moment=require('moment');var BPromise=require(_0x9c58('0x2'));var rs=require(_0x9c58('0x3'));var fs=require('fs');var Redis=require(_0x9c58('0x4'));var db=require(_0x9c58('0x5'))['db'];var utils=require(_0x9c58('0x6'));var logger=require(_0x9c58('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9c58('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x179652,_0x310afc,_0x1a3841){return new BPromise(function(_0x43fa60,_0x201b25){return client[_0x9c58('0x9')](_0x179652,_0x1a3841)['then'](function(_0x4360c7){logger['info'](_0x9c58('0xa'),_0x310afc,'request\x20sent');logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x310afc,_0x9c58('0xb'),JSON[_0x9c58('0xc')](_0x4360c7));if(_0x4360c7[_0x9c58('0xd')]){if(_0x4360c7[_0x9c58('0xd')]['code']===0x1f4){logger[_0x9c58('0xd')](_0x9c58('0xa'),_0x310afc,_0x4360c7[_0x9c58('0xd')][_0x9c58('0xe')]);return _0x201b25(_0x4360c7[_0x9c58('0xd')][_0x9c58('0xe')]);}logger[_0x9c58('0xd')](_0x9c58('0xa'),_0x310afc,_0x4360c7['error'][_0x9c58('0xe')]);return _0x43fa60(_0x4360c7['error'][_0x9c58('0xe')]);}else{logger[_0x9c58('0xf')](_0x9c58('0xa'),_0x310afc,_0x9c58('0xb'));_0x43fa60(_0x4360c7['result'][_0x9c58('0xe')]);}})[_0x9c58('0x10')](function(_0x4b4fb0){logger[_0x9c58('0xd')](_0x9c58('0xa'),_0x310afc,_0x4b4fb0);_0x201b25(_0x4b4fb0);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4a19b38..17d7ece 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9895=['isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9895,0x113));var _0x5989=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9895[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x5989('0x0'));var util=require('util');var path=require(_0x5989('0x1'));var timeout=require(_0x5989('0x2'));var express=require(_0x5989('0x3'));var router=express[_0x5989('0x4')]();var fs_extra=require(_0x5989('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5989('0x6'));var config=require(_0x5989('0x7'));var controller=require(_0x5989('0x8'));router[_0x5989('0x9')]('/',auth[_0x5989('0xa')](),controller[_0x5989('0xb')]);router['get'](_0x5989('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5989('0xd')]('/',auth[_0x5989('0xa')](),controller[_0x5989('0xe')]);router['put']('/:id',auth[_0x5989('0xa')](),controller[_0x5989('0xf')]);router[_0x5989('0x10')](_0x5989('0xc'),auth['isAuthenticated'](),controller[_0x5989('0x11')]);module[_0x5989('0x12')]=router; \ No newline at end of file +var _0x153b=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x3f5325,_0xc72b7a){var _0x1ad2e5=function(_0x534f25){while(--_0x534f25){_0x3f5325['push'](_0x3f5325['shift']());}};_0x1ad2e5(++_0xc72b7a);}(_0x153b,0x9a));var _0xb153=function(_0x2777d7,_0x3d09f3){_0x2777d7=_0x2777d7-0x0;var _0x1c2c97=_0x153b[_0x2777d7];return _0x1c2c97;};'use strict';var multer=require(_0xb153('0x0'));var util=require(_0xb153('0x1'));var path=require(_0xb153('0x2'));var timeout=require(_0xb153('0x3'));var express=require(_0xb153('0x4'));var router=express[_0xb153('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb153('0x6'));var interaction=require(_0xb153('0x7'));var config=require(_0xb153('0x8'));var controller=require('./cmContactHasItem.controller');router[_0xb153('0x9')]('/',auth[_0xb153('0xa')](),controller['index']);router[_0xb153('0x9')](_0xb153('0xb'),auth[_0xb153('0xa')](),controller[_0xb153('0xc')]);router['post']('/',auth[_0xb153('0xa')](),controller[_0xb153('0xd')]);router[_0xb153('0xe')](_0xb153('0xb'),auth[_0xb153('0xa')](),controller[_0xb153('0xf')]);router[_0xb153('0x10')](_0xb153('0xb'),auth[_0xb153('0xa')](),controller[_0xb153('0x11')]);module[_0xb153('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a971370..443af72 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 _0x743d=['long','select','values','stringify','BOOLEAN','ENUM','voice','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x743d,0x18d));var _0xd743=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x743d[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xd743('0x0')]={'name':{'type':Sequelize[_0xd743('0x1')],'get':function(_0x225ecd){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xd743('0x2')],'allowNull':![],'set':function(_0x511909){this[_0xd743('0x3')](_0xd743('0x4'),_0x511909?_0x511909:this[_0xd743('0x5')](_0xd743('0x6')));}},'type':{'type':Sequelize[_0xd743('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0xd743('0x7')](_0xd743('0x8')),'get':function(){if(this[_0xd743('0x5')]('type')===_0xd743('0x9')){return JSON['parse'](this['getDataValue'](_0xd743('0xa')));}else{return this[_0xd743('0x5')](_0xd743('0xa'));}},'set':function(_0x5d11eb){if(Array['isArray'](_0x5d11eb)){this['setDataValue'](_0xd743('0xa'),JSON[_0xd743('0xb')](_0x5d11eb));}else{this[_0xd743('0x3')](_0xd743('0xa'),_0x5d11eb);}}},'required':{'type':Sequelize[_0xd743('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd743('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd743('0xd')](_0xd743('0xe'))}}; \ No newline at end of file +var _0xd8e3=['long','type','parse','values','isArray','stringify','setDataValue','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT'];(function(_0x15bba8,_0x52e8c7){var _0x5345d2=function(_0x9e0191){while(--_0x9e0191){_0x15bba8['push'](_0x15bba8['shift']());}};_0x5345d2(++_0x52e8c7);}(_0xd8e3,0x87));var _0x3d8e=function(_0x4c0a29,_0xc6a549){_0x4c0a29=_0x4c0a29-0x0;var _0x327f29=_0xd8e3[_0x4c0a29];return _0x327f29;};'use strict';var Sequelize=require(_0x3d8e('0x0'));var _=require(_0x3d8e('0x1'));module[_0x3d8e('0x2')]={'name':{'type':Sequelize[_0x3d8e('0x3')],'get':function(_0x4d8d11){return this[_0x3d8e('0x4')](_0x3d8e('0x5'));}},'alias':{'type':Sequelize[_0x3d8e('0x6')],'allowNull':![],'set':function(_0x1f0a45){this['setDataValue']('alias',_0x1f0a45?_0x1f0a45:this[_0x3d8e('0x4')](_0x3d8e('0x7')));}},'type':{'type':Sequelize[_0x3d8e('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3d8e('0x8')](_0x3d8e('0x9')),'get':function(){if(this['getDataValue'](_0x3d8e('0xa'))==='select'){return JSON[_0x3d8e('0xb')](this[_0x3d8e('0x4')](_0x3d8e('0xc')));}else{return this['getDataValue'](_0x3d8e('0xc'));}},'set':function(_0x2293a9){if(Array[_0x3d8e('0xd')](_0x2293a9)){this['setDataValue'](_0x3d8e('0xc'),JSON[_0x3d8e('0xe')](_0x2293a9));}else{this[_0x3d8e('0xf')](_0x3d8e('0xc'),_0x2293a9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3d8e('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x3d8e('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f1ebff5..41a61e6 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 _0xdc60=['number','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','catch','params','keys','rawAttributes','length','include','update','body','find','create','sequelize','Sequelize','text'];(function(_0x56dcec,_0x5c0797){var _0x2ab264=function(_0x5ee542){while(--_0x5ee542){_0x56dcec['push'](_0x56dcec['shift']());}};_0x2ab264(++_0x5c0797);}(_0xdc60,0x168));var _0x0dc6=function(_0x47f0b6,_0x3daf1a){_0x47f0b6=_0x47f0b6-0x0;var _0x53c469=_0xdc60[_0x47f0b6];return _0x53c469;};'use strict';var emlformat=require(_0x0dc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dc6('0x1'));var jsonpatch=require(_0x0dc6('0x2'));var rp=require(_0x0dc6('0x3'));var moment=require('moment');var BPromise=require(_0x0dc6('0x4'));var Mustache=require(_0x0dc6('0x5'));var util=require(_0x0dc6('0x6'));var path=require(_0x0dc6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0dc6('0x8'));var fs=require('fs');var fs_extra=require(_0x0dc6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0dc6('0xa'));var jsforce=require(_0x0dc6('0xb'));var deskjs=require(_0x0dc6('0xc'));var toCsv=require(_0x0dc6('0xd'));var querystring=require('querystring');var Papa=require(_0x0dc6('0xe'));var Redis=require(_0x0dc6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0dc6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dc6('0x11'));var logger=require(_0x0dc6('0x12'))(_0x0dc6('0x13'));var utils=require(_0x0dc6('0x14'));var config=require(_0x0dc6('0x15'));var licenseUtil=require(_0x0dc6('0x16'));var db=require(_0x0dc6('0x17'))['db'];function respondWithStatusCode(_0x14a3f7,_0x54f57c){_0x54f57c=_0x54f57c||0xcc;return function(_0x9991a3){if(_0x9991a3){return _0x14a3f7[_0x0dc6('0x18')](_0x54f57c);}return _0x14a3f7['status'](_0x54f57c)[_0x0dc6('0x19')]();};}function respondWithResult(_0x1b77ae,_0x47983a){_0x47983a=_0x47983a||0xc8;return function(_0x87b1ef){if(_0x87b1ef){return _0x1b77ae[_0x0dc6('0x1a')](_0x47983a)[_0x0dc6('0x1b')](_0x87b1ef);}};}function respondWithFilteredResult(_0x147fd7,_0x545752){return function(_0x23e8c0){if(_0x23e8c0){var _0x441ae8=typeof _0x545752[_0x0dc6('0x1c')]==='undefined'&&typeof _0x545752['limit']===_0x0dc6('0x1d');var _0x59f6bd=_0x23e8c0[_0x0dc6('0x1e')];var _0x95ba87=_0x441ae8?0x0:_0x545752[_0x0dc6('0x1c')];var _0x5f54ed=_0x441ae8?_0x23e8c0[_0x0dc6('0x1e')]:_0x545752[_0x0dc6('0x1c')]+_0x545752['limit'];var _0xd41ab2;if(_0x5f54ed>=_0x59f6bd){_0x5f54ed=_0x59f6bd;_0xd41ab2=0xc8;}else{_0xd41ab2=0xce;}_0x147fd7[_0x0dc6('0x1a')](_0xd41ab2);return _0x147fd7[_0x0dc6('0x1f')](_0x0dc6('0x20'),_0x95ba87+'-'+_0x5f54ed+'/'+_0x59f6bd)['json'](_0x23e8c0);}return null;};}function patchUpdates(_0x508902){return function(_0x5f4000){try{jsonpatch[_0x0dc6('0x21')](_0x5f4000,_0x508902,!![]);}catch(_0x49651f){return BPromise['reject'](_0x49651f);}return _0x5f4000[_0x0dc6('0x22')]();};}function saveUpdates(_0x175e55,_0x2bcbd1){return function(_0x21b7a5){if(_0x21b7a5){return _0x21b7a5['update'](_0x175e55)[_0x0dc6('0x23')](function(_0x41c81d){return _0x41c81d;});}return null;};}function removeEntity(_0x3cea51,_0x4d2d9e){return function(_0x5b54ea){if(_0x5b54ea){return _0x5b54ea[_0x0dc6('0x24')]()[_0x0dc6('0x23')](function(){_0x3cea51[_0x0dc6('0x1a')](0xcc)[_0x0dc6('0x19')]();});}};}function handleEntityNotFound(_0xe77b5a,_0x7424d4){return function(_0x123936){if(!_0x123936){_0xe77b5a[_0x0dc6('0x18')](0x194);}return _0x123936;};}function handleError(_0x4c2547,_0xa0443b){_0xa0443b=_0xa0443b||0x1f4;return function(_0x4f63e4){logger[_0x0dc6('0x25')](_0x4f63e4[_0x0dc6('0x26')]);if(_0x4f63e4[_0x0dc6('0x27')]){delete _0x4f63e4[_0x0dc6('0x27')];}_0x4c2547['status'](_0xa0443b)[_0x0dc6('0x28')](_0x4f63e4);};}exports[_0x0dc6('0x29')]=function(_0x26df36,_0x519e3f){var _0x5f3986={},_0x5c9a77={},_0x42963b={'count':0x0,'rows':[]};var _0x11f1b8=_[_0x0dc6('0x2a')](db[_0x0dc6('0x2b')]['rawAttributes'],function(_0x2897ba){return{'name':_0x2897ba[_0x0dc6('0x2c')],'type':_0x2897ba['type'][_0x0dc6('0x2d')]};});_0x5c9a77[_0x0dc6('0x2e')]=_[_0x0dc6('0x2f')](_[_0x0dc6('0x2a')](_0x11f1b8,_0x0dc6('0x27')),[_0x0dc6('0x27')]);_0x5c9a77[_0x0dc6('0x30')]=_['keys'](_0x26df36['query']);_0x5c9a77[_0x0dc6('0x31')]=_['intersection'](_0x5c9a77['model'],_0x5c9a77[_0x0dc6('0x30')]);_0x5f3986['attributes']=_[_0x0dc6('0x32')](_0x5c9a77[_0x0dc6('0x2e')],qs[_0x0dc6('0x33')](_0x26df36[_0x0dc6('0x30')]['fields']));_0x5f3986[_0x0dc6('0x34')]=_0x5f3986['attributes']['length']?_0x5f3986[_0x0dc6('0x34')]:_0x5c9a77[_0x0dc6('0x2e')];if(!_0x26df36[_0x0dc6('0x30')][_0x0dc6('0x35')](_0x0dc6('0x36'))){_0x5f3986[_0x0dc6('0x37')]=qs['limit'](_0x26df36[_0x0dc6('0x30')][_0x0dc6('0x37')]);_0x5f3986[_0x0dc6('0x1c')]=qs[_0x0dc6('0x1c')](_0x26df36[_0x0dc6('0x30')]['offset']);}_0x5f3986[_0x0dc6('0x38')]=qs[_0x0dc6('0x39')](_0x26df36[_0x0dc6('0x30')][_0x0dc6('0x39')]);_0x5f3986[_0x0dc6('0x3a')]=qs[_0x0dc6('0x31')](_[_0x0dc6('0x3b')](_0x26df36[_0x0dc6('0x30')],_0x5c9a77['filters']),_0x11f1b8);if(_0x26df36[_0x0dc6('0x30')]['filter']){_0x5f3986['where']=_['merge'](_0x5f3986['where'],{'$or':_[_0x0dc6('0x2a')](_0x11f1b8,function(_0x32ca8b){if(_0x32ca8b[_0x0dc6('0x3c')]!==_0x0dc6('0x3d')){var _0x4450f9={};_0x4450f9[_0x32ca8b['name']]={'$like':'%'+_0x26df36[_0x0dc6('0x30')][_0x0dc6('0x3e')]+'%'};return _0x4450f9;}})});}_0x5f3986=_[_0x0dc6('0x3f')]({},_0x5f3986,_0x26df36[_0x0dc6('0x40')]);var _0xafd0af={'where':_0x5f3986[_0x0dc6('0x3a')]};return db[_0x0dc6('0x2b')][_0x0dc6('0x1e')](_0xafd0af)['then'](function(_0x455b9b){_0x42963b['count']=_0x455b9b;if(_0x26df36['query'][_0x0dc6('0x41')]){_0x5f3986['include']=[{'all':!![]}];}return db[_0x0dc6('0x2b')]['findAll'](_0x5f3986);})[_0x0dc6('0x23')](function(_0x4072c4){_0x42963b[_0x0dc6('0x42')]=_0x4072c4;return _0x42963b;})['then'](respondWithFilteredResult(_0x519e3f,_0x5f3986))[_0x0dc6('0x43')](handleError(_0x519e3f,null));};exports['show']=function(_0x25d35b,_0x2d94fa){var _0x378410={'raw':!![],'where':{'id':_0x25d35b[_0x0dc6('0x44')]['id']}},_0x11d78b={};_0x11d78b[_0x0dc6('0x2e')]=_[_0x0dc6('0x45')](db['CmCustomField'][_0x0dc6('0x46')]);_0x11d78b[_0x0dc6('0x30')]=_[_0x0dc6('0x45')](_0x25d35b[_0x0dc6('0x30')]);_0x11d78b[_0x0dc6('0x31')]=_[_0x0dc6('0x32')](_0x11d78b[_0x0dc6('0x2e')],_0x11d78b[_0x0dc6('0x30')]);_0x378410[_0x0dc6('0x34')]=_['intersection'](_0x11d78b[_0x0dc6('0x2e')],qs['fields'](_0x25d35b[_0x0dc6('0x30')]['fields']));_0x378410[_0x0dc6('0x34')]=_0x378410['attributes'][_0x0dc6('0x47')]?_0x378410[_0x0dc6('0x34')]:_0x11d78b[_0x0dc6('0x2e')];if(_0x25d35b[_0x0dc6('0x30')][_0x0dc6('0x41')]){_0x378410[_0x0dc6('0x48')]=[{'all':!![]}];}_0x378410=_[_0x0dc6('0x3f')]({},_0x378410,_0x25d35b[_0x0dc6('0x40')]);return db[_0x0dc6('0x2b')]['find'](_0x378410)[_0x0dc6('0x23')](handleEntityNotFound(_0x2d94fa,null))['then'](respondWithResult(_0x2d94fa,null))[_0x0dc6('0x43')](handleError(_0x2d94fa,null));};exports[_0x0dc6('0x49')]=function(_0x51865c,_0x204ef5){if(_0x51865c[_0x0dc6('0x4a')]['id']){delete _0x51865c['body']['id'];}return db[_0x0dc6('0x2b')][_0x0dc6('0x4b')]({'where':{'id':_0x51865c['params']['id']}})['then'](handleEntityNotFound(_0x204ef5,null))['then'](saveUpdates(_0x51865c[_0x0dc6('0x4a')],null))[_0x0dc6('0x23')](respondWithResult(_0x204ef5,null))[_0x0dc6('0x43')](handleError(_0x204ef5,null));};exports[_0x0dc6('0x24')]=function(_0x467286,_0x333fb3){return db[_0x0dc6('0x2b')]['find']({'where':{'id':_0x467286[_0x0dc6('0x44')]['id']}})[_0x0dc6('0x23')](handleEntityNotFound(_0x333fb3,null))['then'](removeEntity(_0x333fb3,null))['catch'](handleError(_0x333fb3,null));};exports[_0x0dc6('0x4c')]=function(_0x924492,_0x192930){var _0x387c91;return db[_0x0dc6('0x4d')]['transaction'](function(_0x2c761b){return db['CmCustomField']['create'](_0x924492['body'],{'transaction':_0x2c761b})[_0x0dc6('0x23')](function(_0x3ffac6){_0x387c91=_0x3ffac6;var _0x34c570={'type':db[_0x0dc6('0x4e')]['TEXT'],'transaction':_0x2c761b};switch(_0x924492[_0x0dc6('0x4a')][_0x0dc6('0x3c')]){case _0x0dc6('0x4f'):_0x34c570[_0x0dc6('0x3c')]=db['Sequelize']['TEXT'];break;case _0x0dc6('0x50'):_0x34c570[_0x0dc6('0x3c')]=db['Sequelize']['INTEGER'];break;case _0x0dc6('0x51'):_0x34c570[_0x0dc6('0x3c')]=db['Sequelize']['BOOLEAN'];_0x34c570[_0x0dc6('0x52')]=![];break;default:}return db[_0x0dc6('0x4d')][_0x0dc6('0x53')][_0x0dc6('0x54')](_0x0dc6('0x55'),util[_0x0dc6('0x56')](_0x0dc6('0x57'),_0x387c91['id']),_0x34c570);})[_0x0dc6('0x23')](function(){return _0x387c91;});})['then'](respondWithResult(_0x192930,0xc9))['catch'](handleError(_0x192930,null));}; \ No newline at end of file +var _0x6ff0=['then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','CmCustomField','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','body','create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update'];(function(_0x5c3219,_0x4ae2cc){var _0x3ec16d=function(_0xa1d652){while(--_0xa1d652){_0x5c3219['push'](_0x5c3219['shift']());}};_0x3ec16d(++_0x4ae2cc);}(_0x6ff0,0x196));var _0x06ff=function(_0x3a02c6,_0x595ec6){_0x3a02c6=_0x3a02c6-0x0;var _0x3f7ded=_0x6ff0[_0x3a02c6];return _0x3f7ded;};'use strict';var emlformat=require(_0x06ff('0x0'));var rimraf=require(_0x06ff('0x1'));var zipdir=require(_0x06ff('0x2'));var jsonpatch=require(_0x06ff('0x3'));var rp=require(_0x06ff('0x4'));var moment=require(_0x06ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x06ff('0x6'));var util=require(_0x06ff('0x7'));var path=require(_0x06ff('0x8'));var sox=require(_0x06ff('0x9'));var csv=require(_0x06ff('0xa'));var ejs=require(_0x06ff('0xb'));var fs=require('fs');var fs_extra=require(_0x06ff('0xc'));var _=require(_0x06ff('0xd'));var squel=require('squel');var crypto=require(_0x06ff('0xe'));var jsforce=require(_0x06ff('0xf'));var deskjs=require(_0x06ff('0x10'));var toCsv=require(_0x06ff('0xa'));var querystring=require(_0x06ff('0x11'));var Papa=require('papaparse');var Redis=require(_0x06ff('0x12'));var authService=require(_0x06ff('0x13'));var qs=require(_0x06ff('0x14'));var as=require(_0x06ff('0x15'));var hardwareService=require(_0x06ff('0x16'));var logger=require(_0x06ff('0x17'))(_0x06ff('0x18'));var utils=require(_0x06ff('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x06ff('0x1a'));var db=require(_0x06ff('0x1b'))['db'];function respondWithStatusCode(_0x3c6f1e,_0x3a4354){_0x3a4354=_0x3a4354||0xcc;return function(_0x3b0511){if(_0x3b0511){return _0x3c6f1e[_0x06ff('0x1c')](_0x3a4354);}return _0x3c6f1e[_0x06ff('0x1d')](_0x3a4354)['end']();};}function respondWithResult(_0x5668ad,_0x5e9862){_0x5e9862=_0x5e9862||0xc8;return function(_0x487a6e){if(_0x487a6e){return _0x5668ad['status'](_0x5e9862)[_0x06ff('0x1e')](_0x487a6e);}};}function respondWithFilteredResult(_0x14d079,_0x4f4e99){return function(_0x311594){if(_0x311594){var _0x345def=typeof _0x4f4e99[_0x06ff('0x1f')]===_0x06ff('0x20')&&typeof _0x4f4e99[_0x06ff('0x21')]===_0x06ff('0x20');var _0x1b7304=_0x311594[_0x06ff('0x22')];var _0x2171cf=_0x345def?0x0:_0x4f4e99[_0x06ff('0x1f')];var _0x4271e3=_0x345def?_0x311594[_0x06ff('0x22')]:_0x4f4e99['offset']+_0x4f4e99[_0x06ff('0x21')];var _0x2d26ab;if(_0x4271e3>=_0x1b7304){_0x4271e3=_0x1b7304;_0x2d26ab=0xc8;}else{_0x2d26ab=0xce;}_0x14d079['status'](_0x2d26ab);return _0x14d079[_0x06ff('0x23')](_0x06ff('0x24'),_0x2171cf+'-'+_0x4271e3+'/'+_0x1b7304)[_0x06ff('0x1e')](_0x311594);}return null;};}function patchUpdates(_0x12ccaf){return function(_0x218c56){try{jsonpatch[_0x06ff('0x25')](_0x218c56,_0x12ccaf,!![]);}catch(_0x4cb726){return BPromise['reject'](_0x4cb726);}return _0x218c56['save']();};}function saveUpdates(_0xb23e8f,_0x497d85){return function(_0x16ccfe){if(_0x16ccfe){return _0x16ccfe[_0x06ff('0x26')](_0xb23e8f)[_0x06ff('0x27')](function(_0x36c2d5){return _0x36c2d5;});}return null;};}function removeEntity(_0x201f20,_0x1eeb60){return function(_0x5d88d5){if(_0x5d88d5){return _0x5d88d5[_0x06ff('0x28')]()[_0x06ff('0x27')](function(){_0x201f20[_0x06ff('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57668c,_0x1f30b2){return function(_0x4da6ff){if(!_0x4da6ff){_0x57668c[_0x06ff('0x1c')](0x194);}return _0x4da6ff;};}function handleError(_0x5ccb44,_0x56b219){_0x56b219=_0x56b219||0x1f4;return function(_0x56bf53){logger[_0x06ff('0x29')](_0x56bf53[_0x06ff('0x2a')]);if(_0x56bf53[_0x06ff('0x2b')]){delete _0x56bf53['name'];}_0x5ccb44[_0x06ff('0x1d')](_0x56b219)[_0x06ff('0x2c')](_0x56bf53);};}exports[_0x06ff('0x2d')]=function(_0x375b59,_0x566754){var _0x236831={},_0x27eae9={},_0x2498c0={'count':0x0,'rows':[]};var _0x421f18=_[_0x06ff('0x2e')](db['CmCustomField']['rawAttributes'],function(_0x335823){return{'name':_0x335823[_0x06ff('0x2f')],'type':_0x335823[_0x06ff('0x30')][_0x06ff('0x31')]};});_0x27eae9[_0x06ff('0x32')]=_[_0x06ff('0x33')](_[_0x06ff('0x2e')](_0x421f18,'name'),[_0x06ff('0x2b')]);_0x27eae9[_0x06ff('0x34')]=_[_0x06ff('0x35')](_0x375b59[_0x06ff('0x34')]);_0x27eae9['filters']=_[_0x06ff('0x36')](_0x27eae9['model'],_0x27eae9[_0x06ff('0x34')]);_0x236831[_0x06ff('0x37')]=_[_0x06ff('0x36')](_0x27eae9[_0x06ff('0x32')],qs[_0x06ff('0x38')](_0x375b59[_0x06ff('0x34')][_0x06ff('0x38')]));_0x236831[_0x06ff('0x37')]=_0x236831[_0x06ff('0x37')][_0x06ff('0x39')]?_0x236831[_0x06ff('0x37')]:_0x27eae9['model'];if(!_0x375b59[_0x06ff('0x34')]['hasOwnProperty'](_0x06ff('0x3a'))){_0x236831[_0x06ff('0x21')]=qs['limit'](_0x375b59['query'][_0x06ff('0x21')]);_0x236831[_0x06ff('0x1f')]=qs[_0x06ff('0x1f')](_0x375b59['query'][_0x06ff('0x1f')]);}_0x236831[_0x06ff('0x3b')]=qs[_0x06ff('0x3c')](_0x375b59[_0x06ff('0x34')][_0x06ff('0x3c')]);_0x236831[_0x06ff('0x3d')]=qs[_0x06ff('0x3e')](_['pick'](_0x375b59[_0x06ff('0x34')],_0x27eae9[_0x06ff('0x3e')]),_0x421f18);if(_0x375b59[_0x06ff('0x34')][_0x06ff('0x3f')]){_0x236831[_0x06ff('0x3d')]=_[_0x06ff('0x40')](_0x236831[_0x06ff('0x3d')],{'$or':_[_0x06ff('0x2e')](_0x421f18,function(_0x1bf76e){if(_0x1bf76e['type']!==_0x06ff('0x41')){var _0x528d1a={};_0x528d1a[_0x1bf76e[_0x06ff('0x2b')]]={'$like':'%'+_0x375b59[_0x06ff('0x34')]['filter']+'%'};return _0x528d1a;}})});}_0x236831=_[_0x06ff('0x40')]({},_0x236831,_0x375b59['options']);var _0xbe0d19={'where':_0x236831[_0x06ff('0x3d')]};return db[_0x06ff('0x42')][_0x06ff('0x22')](_0xbe0d19)[_0x06ff('0x27')](function(_0x371461){_0x2498c0['count']=_0x371461;if(_0x375b59['query'][_0x06ff('0x43')]){_0x236831[_0x06ff('0x44')]=[{'all':!![]}];}return db[_0x06ff('0x42')][_0x06ff('0x45')](_0x236831);})[_0x06ff('0x27')](function(_0x4baa68){_0x2498c0[_0x06ff('0x46')]=_0x4baa68;return _0x2498c0;})['then'](respondWithFilteredResult(_0x566754,_0x236831))[_0x06ff('0x47')](handleError(_0x566754,null));};exports['show']=function(_0x2cd1bd,_0x4bb811){var _0x568e6a={'raw':!![],'where':{'id':_0x2cd1bd[_0x06ff('0x48')]['id']}},_0x505016={};_0x505016[_0x06ff('0x32')]=_[_0x06ff('0x35')](db[_0x06ff('0x42')][_0x06ff('0x49')]);_0x505016[_0x06ff('0x34')]=_[_0x06ff('0x35')](_0x2cd1bd['query']);_0x505016[_0x06ff('0x3e')]=_[_0x06ff('0x36')](_0x505016[_0x06ff('0x32')],_0x505016[_0x06ff('0x34')]);_0x568e6a[_0x06ff('0x37')]=_[_0x06ff('0x36')](_0x505016[_0x06ff('0x32')],qs[_0x06ff('0x38')](_0x2cd1bd[_0x06ff('0x34')][_0x06ff('0x38')]));_0x568e6a['attributes']=_0x568e6a['attributes'][_0x06ff('0x39')]?_0x568e6a[_0x06ff('0x37')]:_0x505016[_0x06ff('0x32')];if(_0x2cd1bd['query']['includeAll']){_0x568e6a[_0x06ff('0x44')]=[{'all':!![]}];}_0x568e6a=_[_0x06ff('0x40')]({},_0x568e6a,_0x2cd1bd[_0x06ff('0x4a')]);return db[_0x06ff('0x42')][_0x06ff('0x4b')](_0x568e6a)[_0x06ff('0x27')](handleEntityNotFound(_0x4bb811,null))[_0x06ff('0x27')](respondWithResult(_0x4bb811,null))[_0x06ff('0x47')](handleError(_0x4bb811,null));};exports['update']=function(_0x53280f,_0x123020){if(_0x53280f[_0x06ff('0x4c')]['id']){delete _0x53280f[_0x06ff('0x4c')]['id'];}return db['CmCustomField'][_0x06ff('0x4b')]({'where':{'id':_0x53280f[_0x06ff('0x48')]['id']}})[_0x06ff('0x27')](handleEntityNotFound(_0x123020,null))[_0x06ff('0x27')](saveUpdates(_0x53280f[_0x06ff('0x4c')],null))['then'](respondWithResult(_0x123020,null))[_0x06ff('0x47')](handleError(_0x123020,null));};exports[_0x06ff('0x28')]=function(_0x89fec0,_0x54508b){return db[_0x06ff('0x42')][_0x06ff('0x4b')]({'where':{'id':_0x89fec0[_0x06ff('0x48')]['id']}})['then'](handleEntityNotFound(_0x54508b,null))['then'](removeEntity(_0x54508b,null))['catch'](handleError(_0x54508b,null));};exports[_0x06ff('0x4d')]=function(_0x1fbd21,_0x5d8682){var _0x1e2fc2;return db[_0x06ff('0x4e')][_0x06ff('0x4f')](function(_0x373244){return db[_0x06ff('0x42')][_0x06ff('0x4d')](_0x1fbd21['body'],{'transaction':_0x373244})[_0x06ff('0x27')](function(_0x164ba5){_0x1e2fc2=_0x164ba5;var _0x1cd8ea={'type':db['Sequelize'][_0x06ff('0x50')],'transaction':_0x373244};switch(_0x1fbd21[_0x06ff('0x4c')][_0x06ff('0x30')]){case'text':_0x1cd8ea['type']=db[_0x06ff('0x51')][_0x06ff('0x50')];break;case _0x06ff('0x52'):_0x1cd8ea[_0x06ff('0x30')]=db[_0x06ff('0x51')][_0x06ff('0x53')];break;case _0x06ff('0x54'):_0x1cd8ea[_0x06ff('0x30')]=db[_0x06ff('0x51')][_0x06ff('0x55')];_0x1cd8ea[_0x06ff('0x56')]=![];break;default:}return db[_0x06ff('0x4e')]['queryInterface'][_0x06ff('0x57')]('cm_contacts',util[_0x06ff('0x58')]('cf_%d',_0x1e2fc2['id']),_0x1cd8ea);})[_0x06ff('0x27')](function(){return _0x1e2fc2;});})[_0x06ff('0x27')](respondWithResult(_0x5d8682,0xc9))[_0x06ff('0x47')](handleError(_0x5d8682,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 883fb3b..a544710 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 _0x3779=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x3779,0xf0));var _0x9377=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0x3779[_0x39a04c];return _0x580cb0;};'use strict';var _=require(_0x9377('0x0'));var util=require('util');var logger=require(_0x9377('0x1'))(_0x9377('0x2'));var moment=require('moment');var BPromise=require(_0x9377('0x3'));var rp=require(_0x9377('0x4'));var fs=require('fs');var path=require(_0x9377('0x5'));var rimraf=require(_0x9377('0x6'));var config=require(_0x9377('0x7'));var attributes=require(_0x9377('0x8'));module[_0x9377('0x9')]=function(_0xc023c7,_0x10af85){return _0xc023c7['define'](_0x9377('0xa'),attributes,{'tableName':_0x9377('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56b9=['path','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x22cbfd,_0x42a164){var _0x45a671=function(_0x5c39d0){while(--_0x5c39d0){_0x22cbfd['push'](_0x22cbfd['shift']());}};_0x45a671(++_0x42a164);}(_0x56b9,0x102));var _0x956b=function(_0x86ec6b,_0x177875){_0x86ec6b=_0x86ec6b-0x0;var _0xa62b2b=_0x56b9[_0x86ec6b];return _0xa62b2b;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var logger=require(_0x956b('0x2'))(_0x956b('0x3'));var moment=require(_0x956b('0x4'));var BPromise=require('bluebird');var rp=require(_0x956b('0x5'));var fs=require('fs');var path=require(_0x956b('0x6'));var rimraf=require('rimraf');var config=require(_0x956b('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x956b('0x8')]=function(_0x491a6a,_0x5600f5){return _0x491a6a[_0x956b('0x9')](_0x956b('0xa'),attributes,{'tableName':_0x956b('0xb'),'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 c66cad9..ec52e67 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 _0x4c6e=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4c6e,0x105));var _0xe4c6=function(_0x185ffe,_0x5254a1){_0x185ffe=_0x185ffe-0x0;var _0x570f97=_0x4c6e[_0x185ffe];return _0x570f97;};'use strict';var _=require(_0xe4c6('0x0'));var util=require(_0xe4c6('0x1'));var moment=require(_0xe4c6('0x2'));var BPromise=require(_0xe4c6('0x3'));var rs=require(_0xe4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c6('0x5'))['db'];var utils=require(_0xe4c6('0x6'));var logger=require(_0xe4c6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4c6('0x8')][_0xe4c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4436e1,_0xb3281f,_0x4dd4fe){return new BPromise(function(_0x5d3c27,_0x51d5c4){return client[_0xe4c6('0xa')](_0x4436e1,_0x4dd4fe)['then'](function(_0x2b8dfd){logger[_0xe4c6('0xb')](_0xe4c6('0xc'),_0xb3281f,'request\x20sent');logger[_0xe4c6('0xd')](_0xe4c6('0xe'),_0xb3281f,_0xe4c6('0xf'),JSON['stringify'](_0x2b8dfd));if(_0x2b8dfd['error']){if(_0x2b8dfd[_0xe4c6('0x10')][_0xe4c6('0x11')]===0x1f4){logger[_0xe4c6('0x10')](_0xe4c6('0xc'),_0xb3281f,_0x2b8dfd['error'][_0xe4c6('0x12')]);return _0x51d5c4(_0x2b8dfd[_0xe4c6('0x10')][_0xe4c6('0x12')]);}logger['error'](_0xe4c6('0xc'),_0xb3281f,_0x2b8dfd[_0xe4c6('0x10')][_0xe4c6('0x12')]);return _0x5d3c27(_0x2b8dfd[_0xe4c6('0x10')][_0xe4c6('0x12')]);}else{logger[_0xe4c6('0xb')](_0xe4c6('0xc'),_0xb3281f,'request\x20sent');_0x5d3c27(_0x2b8dfd['result'][_0xe4c6('0x12')]);}})[_0xe4c6('0x13')](function(_0x563de3){logger['error'](_0xe4c6('0xc'),_0xb3281f,_0x563de3);_0x51d5c4(_0x563de3);});});} \ No newline at end of file +var _0xa794=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0xa794,0x1a7));var _0x4a79=function(_0x4afac5,_0x5b77a5){_0x4afac5=_0x4afac5-0x0;var _0x56d756=_0xa794[_0x4afac5];return _0x56d756;};'use strict';var _=require(_0x4a79('0x0'));var util=require(_0x4a79('0x1'));var moment=require(_0x4a79('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a79('0x3'));var db=require(_0x4a79('0x4'))['db'];var utils=require(_0x4a79('0x5'));var logger=require('../../config/logger')(_0x4a79('0x6'));var config=require(_0x4a79('0x7'));var jayson=require(_0x4a79('0x8'));var client=jayson[_0x4a79('0x9')][_0x4a79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e5d3b,_0x4156db,_0x5cdd79){return new BPromise(function(_0x3c7425,_0x438ab3){return client[_0x4a79('0xb')](_0x4e5d3b,_0x5cdd79)[_0x4a79('0xc')](function(_0x1065ee){logger[_0x4a79('0xd')]('CmCustomField,\x20%s,\x20%s',_0x4156db,_0x4a79('0xe'));logger[_0x4a79('0xf')](_0x4a79('0x10'),_0x4156db,_0x4a79('0xe'),JSON[_0x4a79('0x11')](_0x1065ee));if(_0x1065ee[_0x4a79('0x12')]){if(_0x1065ee['error'][_0x4a79('0x13')]===0x1f4){logger[_0x4a79('0x12')](_0x4a79('0x14'),_0x4156db,_0x1065ee['error'][_0x4a79('0x15')]);return _0x438ab3(_0x1065ee[_0x4a79('0x12')][_0x4a79('0x15')]);}logger[_0x4a79('0x12')](_0x4a79('0x14'),_0x4156db,_0x1065ee[_0x4a79('0x12')]['message']);return _0x3c7425(_0x1065ee['error'][_0x4a79('0x15')]);}else{logger[_0x4a79('0xd')](_0x4a79('0x14'),_0x4156db,'request\x20sent');_0x3c7425(_0x1065ee[_0x4a79('0x16')]['message']);}})['catch'](function(_0x4def60){logger[_0x4a79('0x12')](_0x4a79('0x14'),_0x4156db,_0x4def60);_0x438ab3(_0x4def60);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index cb9a1ea..e7d6eee 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 _0xfc76=['index','get','show','post','create','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xfc76,0xb5));var _0x6fc7=function(_0x37b2c1,_0x74b1d4){_0x37b2c1=_0x37b2c1-0x0;var _0x387437=_0xfc76[_0x37b2c1];return _0x387437;};'use strict';var multer=require('multer');var util=require(_0x6fc7('0x0'));var path=require(_0x6fc7('0x1'));var timeout=require(_0x6fc7('0x2'));var express=require(_0x6fc7('0x3'));var router=express[_0x6fc7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6fc7('0x5'));var interaction=require(_0x6fc7('0x6'));var config=require('../../config/environment');var controller=require(_0x6fc7('0x7'));router['get']('/',auth[_0x6fc7('0x8')](),controller[_0x6fc7('0x9')]);router[_0x6fc7('0xa')]('/:id',auth[_0x6fc7('0x8')](),controller[_0x6fc7('0xb')]);router[_0x6fc7('0xc')]('/',auth[_0x6fc7('0x8')](),controller[_0x6fc7('0xd')]);router[_0x6fc7('0xe')]('/:id',auth[_0x6fc7('0x8')](),controller[_0x6fc7('0xf')]);router[_0x6fc7('0x10')](_0x6fc7('0x11'),auth[_0x6fc7('0x8')](),controller[_0x6fc7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5447=['/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index'];(function(_0x52253c,_0x502791){var _0x47d00a=function(_0x3afe84){while(--_0x3afe84){_0x52253c['push'](_0x52253c['shift']());}};_0x47d00a(++_0x502791);}(_0x5447,0xf1));var _0x7544=function(_0x44c90a,_0x12f698){_0x44c90a=_0x44c90a-0x0;var _0xcf3d70=_0x5447[_0x44c90a];return _0xcf3d70;};'use strict';var multer=require(_0x7544('0x0'));var util=require('util');var path=require(_0x7544('0x1'));var timeout=require(_0x7544('0x2'));var express=require('express');var router=express[_0x7544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7544('0x4'));var interaction=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var controller=require(_0x7544('0x7'));router[_0x7544('0x8')]('/',auth[_0x7544('0x9')](),controller[_0x7544('0xa')]);router[_0x7544('0x8')](_0x7544('0xb'),auth[_0x7544('0x9')](),controller[_0x7544('0xc')]);router['post']('/',auth[_0x7544('0x9')](),controller[_0x7544('0xd')]);router[_0x7544('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7544('0xf')](_0x7544('0xb'),auth[_0x7544('0x9')](),controller[_0x7544('0x10')]);module[_0x7544('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8e6fa46..7434139 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 _0xc470=['DATE','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x2ba7f7,_0x539a61){var _0x463fb2=function(_0x2974d9){while(--_0x2974d9){_0x2ba7f7['push'](_0x2ba7f7['shift']());}};_0x463fb2(++_0x539a61);}(_0xc470,0xcb));var _0x0c47=function(_0x4ab6a1,_0x4d64d5){_0x4ab6a1=_0x4ab6a1-0x0;var _0x2a24cc=_0xc470[_0x4ab6a1];return _0x2a24cc;};'use strict';var moment=require(_0x0c47('0x0'));var Sequelize=require('sequelize');module[_0x0c47('0x1')]={'phone':{'type':Sequelize[_0x0c47('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x0c47('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0c47('0x4')](_0x0c47('0x5'))},'countbusyretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0c47('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0c47('0x7')]},'priority':{'type':Sequelize[_0x0c47('0x6')](0x2)[_0x0c47('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0c47('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0c47('0x6')],'unique':_0x0c47('0x9')},'ListId':{'type':Sequelize[_0x0c47('0x6')],'unique':_0x0c47('0x9')},'UserId':{'type':Sequelize[_0x0c47('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x0c47('0x6')],'unique':_0x0c47('0x9')},'CampaignId':{'type':Sequelize[_0x0c47('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c47('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0c47('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0c47('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa3b0=['INTEGER','DATE','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x412eba,_0x41db58){var _0x55e55b=function(_0xb024c2){while(--_0xb024c2){_0x412eba['push'](_0x412eba['shift']());}};_0x55e55b(++_0x41db58);}(_0xa3b0,0x124));var _0x0a3b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa3b0[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require('moment');var Sequelize=require(_0x0a3b('0x0'));module['exports']={'phone':{'type':Sequelize[_0x0a3b('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x0a3b('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0a3b('0x3')](_0x0a3b('0x4'))},'countbusyretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0a3b('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0a3b('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0a3b('0x6')]},'priority':{'type':Sequelize[_0x0a3b('0x5')](0x2)[_0x0a3b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0a3b('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0a3b('0x5')],'unique':_0x0a3b('0x8')},'ListId':{'type':Sequelize[_0x0a3b('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x0a3b('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x0a3b('0x5')],'unique':_0x0a3b('0x8')},'CampaignId':{'type':Sequelize[_0x0a3b('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0a3b('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0a3b('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0a3b('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x0a3b('0x6')],'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 3bef426..fd413b0 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 _0x72b1=['$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','params','catch','create','body','describe','destroy','find','VoiceQueueId','CampaignId','Campaign','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','user','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','findOne','scheduledat','phone','LOCK','UPDATE','CmCompany','Company','CmList','List','VoiceQueue','Queue','getPreviewRecall','recallme','Contact','dialActive','getOpenContacts','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','utcOffset','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','update','sendStatus','stack','name','map','CmHopper','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x72b1,0x16e));var _0x172b=function(_0x434ea5,_0x43a53d){_0x434ea5=_0x434ea5-0x0;var _0x1d030d=_0x72b1[_0x434ea5];return _0x1d030d;};'use strict';var moment=require(_0x172b('0x0'));var _=require('lodash');var qs=require(_0x172b('0x1'));var logger=require(_0x172b('0x2'))(_0x172b('0x3'));var shared=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];function respondWithResult(_0x3fa10d,_0x2c1d6e){_0x2c1d6e=_0x2c1d6e||0xc8;return function(_0x558038){if(_0x558038){return _0x3fa10d[_0x172b('0x6')](_0x2c1d6e)[_0x172b('0x7')](_0x558038);}};}function respondWithFilteredResult(_0x475fd6,_0x222624){return function(_0x571994){if(_0x571994){var _0x345e5e=typeof _0x222624['offset']===_0x172b('0x8')&&typeof _0x222624['limit']===_0x172b('0x8');var _0x2238f1=_0x571994[_0x172b('0x9')];var _0x392f1e=_0x345e5e?0x0:_0x222624['offset'];var _0x3b6daf=_0x345e5e?_0x571994[_0x172b('0x9')]:_0x222624[_0x172b('0xa')]+_0x222624[_0x172b('0xb')];var _0xa4ada9;if(_0x3b6daf>=_0x2238f1){_0x3b6daf=_0x2238f1;_0xa4ada9=0xc8;}else{_0xa4ada9=0xce;}_0x475fd6[_0x172b('0x6')](_0xa4ada9);return _0x475fd6[_0x172b('0xc')]('Content-Range',_0x392f1e+'-'+_0x3b6daf+'/'+_0x2238f1)[_0x172b('0x7')](_0x571994);}return null;};}function saveUpdates(_0x82727f,_0xdf832e){return function(_0x4970f8){if(_0x4970f8){return _0x4970f8[_0x172b('0xd')](_0x82727f)['then'](function(_0x2611c2){return _0x2611c2;});}return null;};}function handleEntityNotFound(_0x81e11e,_0x5239b9){return function(_0x1b7247){if(!_0x1b7247){_0x81e11e[_0x172b('0xe')](0x194);}return _0x1b7247;};}function handleError(_0x2790ed,_0xa28463){_0xa28463=_0xa28463||0x1f4;return function(_0x5b0ab1){logger['error'](_0x5b0ab1[_0x172b('0xf')]);if(_0x5b0ab1[_0x172b('0x10')]){delete _0x5b0ab1[_0x172b('0x10')];}_0x2790ed[_0x172b('0x6')](_0xa28463)['send'](_0x5b0ab1);};}exports['index']=function(_0x10c80b,_0x3b2701){var _0x18c22a={},_0xba7825={},_0x1f20ac={'count':0x0,'rows':[]};var _0x4e7cb9=_[_0x172b('0x11')](db[_0x172b('0x12')][_0x172b('0x13')],function(_0x33c62c){return{'name':_0x33c62c[_0x172b('0x14')],'type':_0x33c62c[_0x172b('0x15')][_0x172b('0x16')]};});_0xba7825['model']=_['map'](_0x4e7cb9,'name');_0xba7825['query']=_[_0x172b('0x17')](_0x10c80b['query']);_0xba7825[_0x172b('0x18')]=_[_0x172b('0x19')](_0xba7825[_0x172b('0x1a')],_0xba7825[_0x172b('0x1b')]);_0xba7825[_0x172b('0x18')]=_[_0x172b('0x1c')](_0xba7825[_0x172b('0x18')],[_0x172b('0x1d'),_0x172b('0x1e'),'$gt',_0x172b('0x1f'),_0x172b('0x20'),_0x172b('0x21'),_0x172b('0x22'),_0x172b('0x23'),_0x172b('0x24'),_0x172b('0x25'),'$notBetween',_0x172b('0x26'),_0x172b('0x27'),'$like',_0x172b('0x28'),_0x172b('0x29'),_0x172b('0x2a'),_0x172b('0x2b'),_0x172b('0x2c'),'$contains',_0x172b('0x2d'),_0x172b('0x2e')]);_0x18c22a['attributes']=_['intersection'](_0xba7825[_0x172b('0x1a')],qs[_0x172b('0x2f')](_0x10c80b[_0x172b('0x1b')][_0x172b('0x2f')]));_0x18c22a[_0x172b('0x30')]=_0x18c22a[_0x172b('0x30')][_0x172b('0x31')]?_0x18c22a[_0x172b('0x30')]:_0xba7825[_0x172b('0x1a')];if(!_0x10c80b[_0x172b('0x1b')][_0x172b('0x32')](_0x172b('0x33'))){_0x18c22a[_0x172b('0xb')]=qs[_0x172b('0xb')](_0x10c80b[_0x172b('0x1b')][_0x172b('0xb')]);_0x18c22a[_0x172b('0xa')]=qs[_0x172b('0xa')](_0x10c80b[_0x172b('0x1b')][_0x172b('0xa')]);}_0x18c22a[_0x172b('0x34')]=qs[_0x172b('0x35')](_0x10c80b[_0x172b('0x1b')][_0x172b('0x35')]);_0x18c22a[_0x172b('0x36')]=qs['filters'](_[_0x172b('0x37')](_0x10c80b[_0x172b('0x1b')],_0xba7825[_0x172b('0x18')]),_0x4e7cb9);if(_0x10c80b['query'][_0x172b('0x38')]){_0x18c22a['where']=_['merge'](_0x18c22a['where'],{'$or':_[_0x172b('0x11')](_0x4e7cb9,function(_0x5cadaa){if(_0x5cadaa['type']!==_0x172b('0x39')){var _0x375cb6={};_0x375cb6[_0x5cadaa[_0x172b('0x10')]]={'$like':'%'+_0x10c80b['query'][_0x172b('0x38')]+'%'};return _0x375cb6;}})});}_0x18c22a=_[_0x172b('0x3a')]({},_0x18c22a,_0x10c80b[_0x172b('0x3b')]);var _0x3c0e6a={'where':_0x18c22a[_0x172b('0x36')]};return db[_0x172b('0x12')][_0x172b('0x9')](_0x3c0e6a)[_0x172b('0x3c')](function(_0x40b14c){_0x1f20ac[_0x172b('0x9')]=_0x40b14c;if(_0x10c80b[_0x172b('0x1b')][_0x172b('0x3d')]){_0x18c22a[_0x172b('0x3e')]=[{'all':!![]}];}return db[_0x172b('0x12')][_0x172b('0x3f')](_0x18c22a);})[_0x172b('0x3c')](function(_0x220e6f){_0x1f20ac[_0x172b('0x40')]=_0x220e6f;return _0x1f20ac;})[_0x172b('0x3c')](respondWithFilteredResult(_0x3b2701,_0x18c22a))['catch'](handleError(_0x3b2701,null));};exports['show']=function(_0x3cb17d,_0x4fc858){var _0x5e8ff6={'raw':!![],'where':{'id':_0x3cb17d[_0x172b('0x41')]['id']}},_0x5321e0={};_0x5321e0[_0x172b('0x1a')]=_[_0x172b('0x17')](db['CmHopper'][_0x172b('0x13')]);_0x5321e0[_0x172b('0x1b')]=_[_0x172b('0x17')](_0x3cb17d['query']);_0x5321e0[_0x172b('0x18')]=_['intersection'](_0x5321e0[_0x172b('0x1a')],_0x5321e0[_0x172b('0x1b')]);_0x5e8ff6[_0x172b('0x30')]=_[_0x172b('0x19')](_0x5321e0[_0x172b('0x1a')],qs[_0x172b('0x2f')](_0x3cb17d[_0x172b('0x1b')]['fields']));_0x5e8ff6[_0x172b('0x30')]=_0x5e8ff6[_0x172b('0x30')][_0x172b('0x31')]?_0x5e8ff6[_0x172b('0x30')]:_0x5321e0[_0x172b('0x1a')];if(_0x3cb17d[_0x172b('0x1b')]['includeAll']){_0x5e8ff6['include']=[{'all':!![]}];}_0x5e8ff6=_[_0x172b('0x3a')]({},_0x5e8ff6,_0x3cb17d['options']);return db['CmHopper']['find'](_0x5e8ff6)[_0x172b('0x3c')](handleEntityNotFound(_0x4fc858,null))[_0x172b('0x3c')](respondWithResult(_0x4fc858,null))[_0x172b('0x42')](handleError(_0x4fc858,null));};exports[_0x172b('0x43')]=function(_0x4a3e63,_0x8c3d6){return db[_0x172b('0x12')][_0x172b('0x43')](_0x4a3e63[_0x172b('0x44')],{})[_0x172b('0x3c')](respondWithResult(_0x8c3d6,0xc9))[_0x172b('0x42')](handleError(_0x8c3d6,null));};exports[_0x172b('0xd')]=function(_0x219e29,_0x17f786){if(_0x219e29[_0x172b('0x44')]['id']){delete _0x219e29[_0x172b('0x44')]['id'];}return db[_0x172b('0x12')]['find']({'where':{'id':_0x219e29[_0x172b('0x41')]['id']}})[_0x172b('0x3c')](handleEntityNotFound(_0x17f786,null))['then'](saveUpdates(_0x219e29['body'],null))[_0x172b('0x3c')](respondWithResult(_0x17f786,null))[_0x172b('0x42')](handleError(_0x17f786,null));};exports[_0x172b('0x45')]=function(_0x571504,_0x3bfdf8){return db['CmHopper']['describe']()[_0x172b('0x3c')](respondWithResult(_0x3bfdf8,null))[_0x172b('0x42')](handleError(_0x3bfdf8,null));};exports[_0x172b('0x46')]=function(_0x3941d4,_0x24ab0c){var _0x230ba3;var _0x3131eb=_0x3941d4[_0x172b('0x41')]['id'];return db[_0x172b('0x12')][_0x172b('0x47')]({'where':{'id':_0x3941d4['params']['id']}})['then'](handleEntityNotFound(_0x24ab0c,null))[_0x172b('0x3c')](function(_0x29ee62){if(_0x29ee62){return _0x29ee62['destroy']()['then'](function(_0x3db238){return _0x3db238;});}})[_0x172b('0x3c')](function(_0x10543d){_0x230ba3=_0x10543d;if(_0x10543d){if(_0x10543d[_0x172b('0x48')]||_0x10543d[_0x172b('0x49')]){return db[_0x10543d[_0x172b('0x48')]?'VoiceQueue':_0x172b('0x4a')]['find']({'where':{'id':_0x10543d['VoiceQueueId']?_0x10543d[_0x172b('0x48')]:_0x10543d[_0x172b('0x49')]},'attributes':['id',_0x172b('0x10')],'raw':!![]});}}})['then'](function(_0x3c2fbd){var _0x1cb872={};if(_0x3c2fbd){_[_0x172b('0x3a')](_0x1cb872,_['omit'](_0x230ba3['dataValues'],[_0x172b('0x4b'),_0x172b('0x4c'),'id']));_0x1cb872[_0x172b('0x4d')]=0x15;_0x1cb872[_0x172b('0x4e')]=_0x172b('0x4f');_0x1cb872[_0x172b('0x50')]=_0x3c2fbd[_0x172b('0x10')];_0x1cb872[_0x172b('0x51')]=_0x3941d4['user'][_0x172b('0x10')];_0x1cb872['UserId']=_0x3941d4['user']['id'];_0x1cb872[_0x172b('0x4f')]=!![];_0x1cb872['deletedat']=moment()[_0x172b('0x52')](_0x172b('0x53'));_0x1cb872[_0x172b('0x54')]=_0x230ba3['phone'];_0x1cb872[_0x172b('0x55')]=_0x230ba3['VoiceQueueId']?_0x172b('0x56'):_0x172b('0x57');return db['CmContact'][_0x172b('0x47')]({'where':{'id':_0x1cb872['ContactId']},'attributes':[_0x172b('0x58'),_0x172b('0x59')]})[_0x172b('0x3c')](function(_0x3914aa){if(!_[_0x172b('0x5a')](_0x24ab0c)&&!_['isNil'](_0x3914aa[_0x172b('0x58')])){_0x1cb872[_0x172b('0x5b')]=_0x3914aa[_0x172b('0x58')];if(!_[_0x172b('0x5a')](_0x3914aa['lastName'])){_0x1cb872[_0x172b('0x5b')]+='\x20'+_0x3914aa['lastName'];}}})[_0x172b('0x5c')](function(){return db[_0x172b('0x5d')][_0x172b('0x43')](_0x1cb872);});}})[_0x172b('0x3c')](function(_0x2cf075){return db[_0x172b('0x5e')]['destroy']({'where':{'CmHopperId':_0x3131eb}});})[_0x172b('0x3c')](function(){return _0x24ab0c[_0x172b('0x6')](0xcc)[_0x172b('0x5f')]();})['catch'](handleError(_0x24ab0c,null));};exports[_0x172b('0x60')]=function(_0x57c3eb,_0x4eff2b){var _0xe975c=[];return db[_0x172b('0x61')][_0x172b('0x45')]()[_0x172b('0x3c')](function(_0x1b6f27){_0xe975c=_[_0x172b('0x17')](_0x1b6f27);return _0x57c3eb[_0x172b('0x62')][_0x172b('0x63')]({'where':{'type':_0x172b('0x64'),'dialActive':!![],'dialMethod':_0x172b('0x65')},'attributes':['id','dialOrderByScheduledAt',_0x172b('0x66')],'raw':!![]});})[_0x172b('0x3c')](function(_0x1f108a){if(_0x1f108a&&_0x1f108a[_0x172b('0x31')]){return db[_0x172b('0x67')][_0x172b('0x68')](function(_0x32d480){var _0x4646fc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x172b('0x52')](_0x172b('0x53'))},'VoiceQueueId':{'$in':_[_0x172b('0x11')](_0x1f108a,'id')},'$or':[{'UserId':null},{'UserId':_0x57c3eb['user']['id']}]};var _0x2a8360={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1f108a)[_0x172b('0x38')]([_0x172b('0x66'),0x0])[_0x172b('0x11')]('id')[_0x172b('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x57c3eb[_0x172b('0x62')]['id']}]};var _0x54e62e={'$or':[_0x4646fc,_0x2a8360]};var _0x575269=[];if(_0x57c3eb[_0x172b('0x44')][_0x172b('0x6a')]&&_0x57c3eb[_0x172b('0x44')][_0x172b('0x6a')]===_0x172b('0x6b')){if(!_[_0x172b('0x6c')](_0x57c3eb[_0x172b('0x44')]['hopperIds'])){_0x54e62e['id']={'$in':_0x57c3eb[_0x172b('0x44')][_0x172b('0x6d')]};}_0x575269=[[_0x172b('0x6e'),_0x172b('0x6f')],[_0x172b('0x70'),_0x1f108a[0x0]['dialOrderByScheduledAt']===_0x172b('0x6f')?_0x172b('0x71'):'ASC'],db[_0x172b('0x67')][_0x172b('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x172b('0x71')]];}else{if(!_[_0x172b('0x6c')](_0x57c3eb[_0x172b('0x44')][_0x172b('0x6d')])){_0x54e62e['id']={'$notIn':_0x57c3eb['body'][_0x172b('0x6d')]};}_0x575269=[[_0x172b('0x6e'),'DESC'],[_0x172b('0x70'),_0x1f108a[0x0]['dialOrderByScheduledAt']],db[_0x172b('0x67')][_0x172b('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x172b('0x6f')]];}return db[_0x172b('0x12')][_0x172b('0x73')]({'attributes':['id',_0x172b('0x74'),_0x172b('0x75'),'recallme'],'where':_0x54e62e,'order':_0x575269,'transaction':_0x32d480,'lock':_0x32d480[_0x172b('0x76')][_0x172b('0x77')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0xe975c,'include':[{'model':db[_0x172b('0x78')],'as':_0x172b('0x79'),'attributes':['id','name']}]},{'model':db[_0x172b('0x7a')],'as':_0x172b('0x7b'),'attributes':['id',_0x172b('0x10')]},{'model':db[_0x172b('0x7c')],'as':_0x172b('0x7d'),'attributes':['id','name','dialActive']}]})['then'](function(_0x4885f9){if(_0x4885f9){return _0x4885f9['update']({'UserId':_0x57c3eb[_0x172b('0x62')]['id']},{'transaction':_0x32d480});}});});}})[_0x172b('0x3c')](handleEntityNotFound(_0x4eff2b,null))['then'](respondWithResult(_0x4eff2b,null))[_0x172b('0x42')](handleError(_0x4eff2b,null));};exports[_0x172b('0x7e')]=function(_0x241d44,_0x7b7b41,_0x1d7de8){var _0x21e7cb=[];var _0x5aca7f=_0x241d44[_0x172b('0x41')]['id'];var _0x3781e4=_0x241d44[_0x172b('0x62')]['id'];return db[_0x172b('0x61')][_0x172b('0x45')]()[_0x172b('0x3c')](function(_0x59583b){_0x21e7cb=_[_0x172b('0x17')](_0x59583b);return db[_0x172b('0x67')][_0x172b('0x68')](function(_0x3cca24){const _0x48cd9e={'id':_0x5aca7f};return db[_0x172b('0x12')]['findOne']({'attributes':['id',_0x172b('0x74'),_0x172b('0x7f')],'where':_0x48cd9e,'transaction':_0x3cca24,'lock':_0x3cca24[_0x172b('0x76')][_0x172b('0x77')],'include':[{'model':db[_0x172b('0x61')],'as':_0x172b('0x80'),'attributes':_0x21e7cb,'include':[{'model':db[_0x172b('0x78')],'as':_0x172b('0x79'),'attributes':['id',_0x172b('0x10')]}]},{'model':db['CmList'],'as':_0x172b('0x7b'),'attributes':['id','name']},{'model':db[_0x172b('0x7c')],'as':_0x172b('0x7d'),'attributes':['id',_0x172b('0x10'),_0x172b('0x81')]}]})[_0x172b('0x3c')](function(_0x4b7577){if(_0x4b7577){return _0x4b7577[_0x172b('0xd')]({'UserId':_0x3781e4},{'transaction':_0x3cca24});}});});})[_0x172b('0x3c')](handleEntityNotFound(_0x7b7b41,null))['then'](respondWithResult(_0x7b7b41,null))[_0x172b('0x42')](handleError(_0x7b7b41,null));};exports[_0x172b('0x82')]=function(_0x2f7855,_0x4bb59f){return _0x2f7855[_0x172b('0x62')][_0x172b('0x63')]({'where':{'type':_0x172b('0x64'),'dialActive':!![],'dialMethod':_0x172b('0x65')},'attributes':['id'],'raw':!![]})[_0x172b('0x3c')](function(_0x297a90){if(_0x297a90&&_0x297a90[_0x172b('0x31')]){return db['CmHopper'][_0x172b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x172b('0x52')](_0x172b('0x53'))},'VoiceQueueId':{'$in':_[_0x172b('0x11')](_0x297a90,'id')},'$or':[{'UserId':null},{'UserId':_0x2f7855[_0x172b('0x62')]['id']}]}});}return 0x0;})[_0x172b('0x3c')](function(_0x1dd677){if(!_[_0x172b('0x5a')](_0x1dd677)&&_['isNumber'](_0x1dd677)){return _0x4bb59f[_0x172b('0x6')](0xc8)[_0x172b('0x7')]({'contacts':_0x1dd677});}else{logger[_0x172b('0x83')](_0x172b('0x84'),_0x172b('0x82'),0x194,_0x172b('0x85'));_0x4bb59f[_0x172b('0xe')](0x194);}})[_0x172b('0x42')](handleError(_0x4bb59f,null));};exports[_0x172b('0x86')]=function(_0x16b0ae,_0x14bf75){var _0x5650d8=shared['timezones'];var _0x5b8a16=[];_[_0x172b('0x11')](_0x5650d8,function(_0x3f7e09){_0x5b8a16['push']({'id':_0x3f7e09['name'],'name':_0x3f7e09['name'],'utcOffset':_0x3f7e09[_0x172b('0x87')]});});return _0x14bf75[_0x172b('0x6')](0xc8)[_0x172b('0x7')]({'tz':_0x5b8a16});};exports['getTimezone']=function(_0x887047,_0x400871){var _0x465847=shared[_0x172b('0x88')];var _0x3906fe={};if(!_['isNil'](_0x465847[_0x887047['body']['id']]))_0x3906fe=_0x465847[_0x887047[_0x172b('0x44')]['id']];return _0x400871['status'](0xc8)[_0x172b('0x7')](_0x3906fe);}; \ No newline at end of file +var _0x89c3=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','CmCompany','CmList','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','update','stack','name','send','map','CmHopper'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89c3,0xff));var _0x389c=function(_0x567820,_0x5110de){_0x567820=_0x567820-0x0;var _0x765290=_0x89c3[_0x567820];return _0x765290;};'use strict';var moment=require(_0x389c('0x0'));var _=require(_0x389c('0x1'));var qs=require(_0x389c('0x2'));var logger=require(_0x389c('0x3'))(_0x389c('0x4'));var shared=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];function respondWithResult(_0x3a2fa4,_0x5c6c68){_0x5c6c68=_0x5c6c68||0xc8;return function(_0x3742ad){if(_0x3742ad){return _0x3a2fa4['status'](_0x5c6c68)[_0x389c('0x7')](_0x3742ad);}};}function respondWithFilteredResult(_0x4bece6,_0x51f5f5){return function(_0x2f3e3f){if(_0x2f3e3f){var _0x4a83ab=typeof _0x51f5f5['offset']===_0x389c('0x8')&&typeof _0x51f5f5[_0x389c('0x9')]===_0x389c('0x8');var _0x2efa82=_0x2f3e3f[_0x389c('0xa')];var _0x1c574b=_0x4a83ab?0x0:_0x51f5f5[_0x389c('0xb')];var _0xd58faa=_0x4a83ab?_0x2f3e3f[_0x389c('0xa')]:_0x51f5f5['offset']+_0x51f5f5[_0x389c('0x9')];var _0xe6852f;if(_0xd58faa>=_0x2efa82){_0xd58faa=_0x2efa82;_0xe6852f=0xc8;}else{_0xe6852f=0xce;}_0x4bece6[_0x389c('0xc')](_0xe6852f);return _0x4bece6[_0x389c('0xd')](_0x389c('0xe'),_0x1c574b+'-'+_0xd58faa+'/'+_0x2efa82)['json'](_0x2f3e3f);}return null;};}function saveUpdates(_0x5d7aa7,_0x2a2d7d){return function(_0x1de33a){if(_0x1de33a){return _0x1de33a[_0x389c('0xf')](_0x5d7aa7)['then'](function(_0x3f2391){return _0x3f2391;});}return null;};}function handleEntityNotFound(_0x4bde6d,_0x36e855){return function(_0x1b1618){if(!_0x1b1618){_0x4bde6d['sendStatus'](0x194);}return _0x1b1618;};}function handleError(_0x1687f2,_0x205e4f){_0x205e4f=_0x205e4f||0x1f4;return function(_0x36c118){logger['error'](_0x36c118[_0x389c('0x10')]);if(_0x36c118[_0x389c('0x11')]){delete _0x36c118[_0x389c('0x11')];}_0x1687f2[_0x389c('0xc')](_0x205e4f)[_0x389c('0x12')](_0x36c118);};}exports['index']=function(_0x5b6ef8,_0x5a2b10){var _0x335c3e={},_0x2e23d2={},_0x55dc03={'count':0x0,'rows':[]};var _0x334f7a=_[_0x389c('0x13')](db[_0x389c('0x14')][_0x389c('0x15')],function(_0xbe8380){return{'name':_0xbe8380[_0x389c('0x16')],'type':_0xbe8380[_0x389c('0x17')][_0x389c('0x18')]};});_0x2e23d2[_0x389c('0x19')]=_['map'](_0x334f7a,_0x389c('0x11'));_0x2e23d2[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x5b6ef8[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1d')](_0x2e23d2['model'],_0x2e23d2[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1e')](_0x2e23d2[_0x389c('0x1c')],['$and',_0x389c('0x1f'),_0x389c('0x20'),'$gte',_0x389c('0x21'),'$lte',_0x389c('0x22'),_0x389c('0x23'),_0x389c('0x24'),_0x389c('0x25'),_0x389c('0x26'),'$in',_0x389c('0x27'),_0x389c('0x28'),_0x389c('0x29'),_0x389c('0x2a'),_0x389c('0x2b'),'$like',_0x389c('0x2c'),'$contains',_0x389c('0x2d'),_0x389c('0x2e')]);_0x335c3e[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x2e23d2['model'],qs[_0x389c('0x30')](_0x5b6ef8[_0x389c('0x1a')]['fields']));_0x335c3e[_0x389c('0x2f')]=_0x335c3e[_0x389c('0x2f')][_0x389c('0x31')]?_0x335c3e[_0x389c('0x2f')]:_0x2e23d2[_0x389c('0x19')];if(!_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x32')](_0x389c('0x33'))){_0x335c3e[_0x389c('0x9')]=qs[_0x389c('0x9')](_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x9')]);_0x335c3e['offset']=qs['offset'](_0x5b6ef8['query'][_0x389c('0xb')]);}_0x335c3e['order']=qs[_0x389c('0x34')](_0x5b6ef8['query'][_0x389c('0x34')]);_0x335c3e[_0x389c('0x35')]=qs[_0x389c('0x1c')](_[_0x389c('0x36')](_0x5b6ef8['query'],_0x2e23d2[_0x389c('0x1c')]),_0x334f7a);if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]){_0x335c3e[_0x389c('0x35')]=_[_0x389c('0x38')](_0x335c3e[_0x389c('0x35')],{'$or':_['map'](_0x334f7a,function(_0x5c84f9){if(_0x5c84f9[_0x389c('0x17')]!==_0x389c('0x39')){var _0x342dd9={};_0x342dd9[_0x5c84f9[_0x389c('0x11')]]={'$like':'%'+_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]+'%'};return _0x342dd9;}})});}_0x335c3e=_[_0x389c('0x38')]({},_0x335c3e,_0x5b6ef8[_0x389c('0x3a')]);var _0x22341d={'where':_0x335c3e[_0x389c('0x35')]};return db[_0x389c('0x14')][_0x389c('0xa')](_0x22341d)[_0x389c('0x3b')](function(_0x55841a){_0x55dc03['count']=_0x55841a;if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x3c')]){_0x335c3e[_0x389c('0x3d')]=[{'all':!![]}];}return db[_0x389c('0x14')][_0x389c('0x3e')](_0x335c3e);})[_0x389c('0x3b')](function(_0x58a7b1){_0x55dc03['rows']=_0x58a7b1;return _0x55dc03;})[_0x389c('0x3b')](respondWithFilteredResult(_0x5a2b10,_0x335c3e))[_0x389c('0x3f')](handleError(_0x5a2b10,null));};exports[_0x389c('0x40')]=function(_0x4d9ec4,_0x39dcd6){var _0x2884c4={'raw':!![],'where':{'id':_0x4d9ec4[_0x389c('0x41')]['id']}},_0x37f4d7={};_0x37f4d7[_0x389c('0x19')]=_[_0x389c('0x1b')](db['CmHopper'][_0x389c('0x15')]);_0x37f4d7[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x4d9ec4[_0x389c('0x1a')]);_0x37f4d7['filters']=_[_0x389c('0x1d')](_0x37f4d7['model'],_0x37f4d7[_0x389c('0x1a')]);_0x2884c4[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x37f4d7[_0x389c('0x19')],qs[_0x389c('0x30')](_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x30')]));_0x2884c4[_0x389c('0x2f')]=_0x2884c4[_0x389c('0x2f')][_0x389c('0x31')]?_0x2884c4[_0x389c('0x2f')]:_0x37f4d7['model'];if(_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x3c')]){_0x2884c4['include']=[{'all':!![]}];}_0x2884c4=_[_0x389c('0x38')]({},_0x2884c4,_0x4d9ec4['options']);return db[_0x389c('0x14')][_0x389c('0x42')](_0x2884c4)[_0x389c('0x3b')](handleEntityNotFound(_0x39dcd6,null))[_0x389c('0x3b')](respondWithResult(_0x39dcd6,null))[_0x389c('0x3f')](handleError(_0x39dcd6,null));};exports[_0x389c('0x43')]=function(_0xc2ef3c,_0x15c23e){return db[_0x389c('0x14')][_0x389c('0x43')](_0xc2ef3c[_0x389c('0x44')],{})[_0x389c('0x3b')](respondWithResult(_0x15c23e,0xc9))[_0x389c('0x3f')](handleError(_0x15c23e,null));};exports['update']=function(_0x575a44,_0x1d8063){if(_0x575a44[_0x389c('0x44')]['id']){delete _0x575a44[_0x389c('0x44')]['id'];}return db['CmHopper'][_0x389c('0x42')]({'where':{'id':_0x575a44[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0x1d8063,null))[_0x389c('0x3b')](saveUpdates(_0x575a44['body'],null))['then'](respondWithResult(_0x1d8063,null))['catch'](handleError(_0x1d8063,null));};exports['describe']=function(_0x425ec4,_0x4a928c){return db['CmHopper'][_0x389c('0x45')]()[_0x389c('0x3b')](respondWithResult(_0x4a928c,null))[_0x389c('0x3f')](handleError(_0x4a928c,null));};exports[_0x389c('0x46')]=function(_0x153db2,_0xd37a48){var _0x3302b8;var _0x556928=_0x153db2[_0x389c('0x41')]['id'];return db[_0x389c('0x14')][_0x389c('0x42')]({'where':{'id':_0x153db2[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0xd37a48,null))[_0x389c('0x3b')](function(_0x483eb8){if(_0x483eb8){return _0x483eb8[_0x389c('0x46')]()['then'](function(_0xf56fb2){return _0xf56fb2;});}})['then'](function(_0x26936d){_0x3302b8=_0x26936d;if(_0x26936d){if(_0x26936d[_0x389c('0x47')]||_0x26936d[_0x389c('0x48')]){return db[_0x26936d[_0x389c('0x47')]?_0x389c('0x49'):_0x389c('0x4a')]['find']({'where':{'id':_0x26936d[_0x389c('0x47')]?_0x26936d[_0x389c('0x47')]:_0x26936d['CampaignId']},'attributes':['id',_0x389c('0x11')],'raw':!![]});}}})[_0x389c('0x3b')](function(_0x8fe5fd){var _0x4a9519={};if(_0x8fe5fd){_[_0x389c('0x38')](_0x4a9519,_[_0x389c('0x4b')](_0x3302b8['dataValues'],[_0x389c('0x4c'),_0x389c('0x4d'),'id']));_0x4a9519['state']=0x15;_0x4a9519[_0x389c('0x4e')]=_0x389c('0x4f');_0x4a9519[_0x389c('0x50')]=_0x8fe5fd[_0x389c('0x11')];_0x4a9519[_0x389c('0x51')]=_0x153db2[_0x389c('0x52')][_0x389c('0x11')];_0x4a9519[_0x389c('0x53')]=_0x153db2[_0x389c('0x52')]['id'];_0x4a9519[_0x389c('0x4f')]=!![];_0x4a9519['deletedat']=moment()[_0x389c('0x54')](_0x389c('0x55'));_0x4a9519[_0x389c('0x56')]=_0x3302b8['phone'];_0x4a9519[_0x389c('0x57')]=_0x3302b8['VoiceQueueId']?'queue':_0x389c('0x58');return db[_0x389c('0x59')][_0x389c('0x42')]({'where':{'id':_0x4a9519[_0x389c('0x5a')]},'attributes':[_0x389c('0x5b'),'lastName']})[_0x389c('0x3b')](function(_0x4a203d){if(!_[_0x389c('0x5c')](_0xd37a48)&&!_['isNil'](_0x4a203d[_0x389c('0x5b')])){_0x4a9519[_0x389c('0x5d')]=_0x4a203d[_0x389c('0x5b')];if(!_[_0x389c('0x5c')](_0x4a203d['lastName'])){_0x4a9519[_0x389c('0x5d')]+='\x20'+_0x4a203d[_0x389c('0x5e')];}}})[_0x389c('0x5f')](function(){return db[_0x389c('0x60')][_0x389c('0x43')](_0x4a9519);});}})['then'](function(_0x5359f5){return db[_0x389c('0x61')]['destroy']({'where':{'CmHopperId':_0x556928}});})[_0x389c('0x3b')](function(){return _0xd37a48[_0x389c('0xc')](0xcc)[_0x389c('0x62')]();})['catch'](handleError(_0xd37a48,null));};exports[_0x389c('0x63')]=function(_0x4bfe42,_0x18d3d7){var _0x5e24a6=[];return db[_0x389c('0x59')]['describe']()[_0x389c('0x3b')](function(_0x1568d4){_0x5e24a6=_[_0x389c('0x1b')](_0x1568d4);return _0x4bfe42[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':_0x389c('0x64'),'dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id','dialOrderByScheduledAt',_0x389c('0x66')],'raw':!![]});})['then'](function(_0x4cbb3d){if(_0x4cbb3d&&_0x4cbb3d[_0x389c('0x31')]){return db[_0x389c('0x67')][_0x389c('0x68')](function(_0x4ce5fd){var _0x4648aa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x4cbb3d,'id')},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2dcdb7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4cbb3d)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x389c('0x13')]('id')[_0x389c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2aecff={'$or':[_0x4648aa,_0x2dcdb7]};var _0x15cc59=[];if(_0x4bfe42['body']['direction']&&_0x4bfe42[_0x389c('0x44')][_0x389c('0x6a')]===_0x389c('0x6b')){if(!_[_0x389c('0x6c')](_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')])){_0x2aecff['id']={'$in':_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')]};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x6f')],[_0x389c('0x70'),_0x4cbb3d[0x0]['dialOrderByScheduledAt']===_0x389c('0x6f')?_0x389c('0x71'):_0x389c('0x6f')],db['sequelize'][_0x389c('0x72')](_0x389c('0x73')),['id',_0x389c('0x71')]];}else{if(!_[_0x389c('0x6c')](_0x4bfe42['body'][_0x389c('0x6d')])){_0x2aecff['id']={'$notIn':_0x4bfe42[_0x389c('0x44')]['hopperIds']};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x71')],[_0x389c('0x70'),_0x4cbb3d[0x0][_0x389c('0x74')]],db[_0x389c('0x67')][_0x389c('0x72')](_0x389c('0x75')),['id',_0x389c('0x6f')]];}return db[_0x389c('0x14')][_0x389c('0x76')]({'attributes':['id',_0x389c('0x77'),'phone',_0x389c('0x78')],'where':_0x2aecff,'order':_0x15cc59,'transaction':_0x4ce5fd,'lock':_0x4ce5fd['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0x5e24a6,'include':[{'model':db['CmCompany'],'as':_0x389c('0x7b'),'attributes':['id',_0x389c('0x11')]}]},{'model':db['CmList'],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),'dialActive']}]})['then'](function(_0x29dea4){if(_0x29dea4){return _0x29dea4[_0x389c('0xf')]({'UserId':_0x4bfe42[_0x389c('0x52')]['id']},{'transaction':_0x4ce5fd});}});});}})[_0x389c('0x3b')](handleEntityNotFound(_0x18d3d7,null))[_0x389c('0x3b')](respondWithResult(_0x18d3d7,null))[_0x389c('0x3f')](handleError(_0x18d3d7,null));};exports['getPreviewRecall']=function(_0x442696,_0x3c9a56,_0x135ebd){var _0xe3b7b2=[];var _0x58885f=_0x442696[_0x389c('0x41')]['id'];var _0x4ec383=_0x442696[_0x389c('0x52')]['id'];return db[_0x389c('0x59')][_0x389c('0x45')]()[_0x389c('0x3b')](function(_0xa82c9){_0xe3b7b2=_[_0x389c('0x1b')](_0xa82c9);return db['sequelize']['transaction'](function(_0x2ba48e){const _0xd258a5={'id':_0x58885f};return db[_0x389c('0x14')]['findOne']({'attributes':['id',_0x389c('0x77'),_0x389c('0x78')],'where':_0xd258a5,'transaction':_0x2ba48e,'lock':_0x2ba48e['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0xe3b7b2,'include':[{'model':db[_0x389c('0x7e')],'as':_0x389c('0x7b'),'attributes':['id','name']}]},{'model':db[_0x389c('0x7f')],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db[_0x389c('0x49')],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),_0x389c('0x80')]}]})[_0x389c('0x3b')](function(_0x255cfd){if(_0x255cfd){return _0x255cfd[_0x389c('0xf')]({'UserId':_0x4ec383},{'transaction':_0x2ba48e});}});});})[_0x389c('0x3b')](handleEntityNotFound(_0x3c9a56,null))['then'](respondWithResult(_0x3c9a56,null))[_0x389c('0x3f')](handleError(_0x3c9a56,null));};exports[_0x389c('0x81')]=function(_0x268d7d,_0x2c21ce){return _0x268d7d[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id'],'raw':!![]})[_0x389c('0x3b')](function(_0x63cb59){if(_0x63cb59&&_0x63cb59[_0x389c('0x31')]){return db['CmHopper'][_0x389c('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x63cb59,'id')},'$or':[{'UserId':null},{'UserId':_0x268d7d[_0x389c('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x5dc5fc){if(!_[_0x389c('0x5c')](_0x5dc5fc)&&_[_0x389c('0x82')](_0x5dc5fc)){return _0x2c21ce[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'contacts':_0x5dc5fc});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x389c('0x81'),0x194,_0x389c('0x83'));_0x2c21ce[_0x389c('0x84')](0x194);}})[_0x389c('0x3f')](handleError(_0x2c21ce,null));};exports[_0x389c('0x85')]=function(_0x4158d0,_0x589598){var _0x1f8960=shared[_0x389c('0x86')];var _0x3c2a60=[];_[_0x389c('0x13')](_0x1f8960,function(_0x458c31){_0x3c2a60[_0x389c('0x87')]({'id':_0x458c31['name'],'name':_0x458c31[_0x389c('0x11')],'utcOffset':_0x458c31[_0x389c('0x88')]});});return _0x589598[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'tz':_0x3c2a60});};exports[_0x389c('0x89')]=function(_0x3d2817,_0x2ea6d8){var _0x34adf5=shared[_0x389c('0x86')];var _0x5589b3={};if(!_[_0x389c('0x5c')](_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']]))_0x5589b3=_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']];return _0x2ea6d8[_0x389c('0xc')](0xc8)[_0x389c('0x7')](_0x5589b3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a7283f7..c551c00 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0xe7c6ee,_0x1028a5){var _0xedf0bf=function(_0x4ec771){while(--_0x4ec771){_0xe7c6ee['push'](_0xe7c6ee['shift']());}};_0xedf0bf(++_0x1028a5);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x10996b,_0x3d0ba4){var _0x41e9da=function(_0x5170a2){while(--_0x5170a2){_0x10996b['push'](_0x10996b['shift']());}};_0x41e9da(++_0x3d0ba4);}(_0x33af,0xec));var _0xf33a=function(_0x4296b3,_0x58c241){_0x4296b3=_0x4296b3-0x0;var _0x146ad8=_0x33af[_0x4296b3];return _0x146ad8;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f81d427..4e149b6 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 _0xf706=['findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','Contact','CmList','List','lodash','util','bluebird','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find','raw','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','debug','DestroyCmHopper','CmContact','transaction','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','describe','length','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone'];(function(_0x35ca9c,_0x44b0c7){var _0x4dd5bd=function(_0x31b1d6){while(--_0x31b1d6){_0x35ca9c['push'](_0x35ca9c['shift']());}};_0x4dd5bd(++_0x44b0c7);}(_0xf706,0x16d));var _0x6f70=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xf706[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x6f70('0x0'));var util=require(_0x6f70('0x1'));var moment=require('moment');var BPromise=require(_0x6f70('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6f70('0x3'));var jayson=require(_0x6f70('0x4'));var client=jayson[_0x6f70('0x5')][_0x6f70('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44b0e3,_0x58a53e,_0x5417c5){return new BPromise(function(_0x92e315,_0x5104fd){return client[_0x6f70('0x7')](_0x44b0e3,_0x5417c5)[_0x6f70('0x8')](function(_0x11cc8c){logger[_0x6f70('0x9')](_0x6f70('0xa'),_0x58a53e,'request\x20sent');logger['debug'](_0x6f70('0xb'),_0x58a53e,'request\x20sent',JSON[_0x6f70('0xc')](_0x11cc8c));if(_0x11cc8c[_0x6f70('0xd')]){if(_0x11cc8c[_0x6f70('0xd')][_0x6f70('0xe')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x58a53e,_0x11cc8c['error'][_0x6f70('0xf')]);return _0x5104fd(_0x11cc8c[_0x6f70('0xd')]['message']);}logger['error'](_0x6f70('0xa'),_0x58a53e,_0x11cc8c['error'][_0x6f70('0xf')]);return _0x92e315(_0x11cc8c[_0x6f70('0xd')][_0x6f70('0xf')]);}else{logger[_0x6f70('0x9')](_0x6f70('0xa'),_0x58a53e,_0x6f70('0x10'));_0x92e315(_0x11cc8c[_0x6f70('0x11')][_0x6f70('0xf')]);}})[_0x6f70('0x12')](function(_0x444b97){logger['error'](_0x6f70('0xa'),_0x58a53e,_0x444b97);_0x5104fd(_0x444b97);});});}exports[_0x6f70('0x13')]=function(_0x4408f7){var _0x381cab=this;return new Promise(function(_0x5e35cd,_0x5aeffa){return db[_0x6f70('0x14')][_0x6f70('0x15')]({'raw':_0x4408f7[_0x6f70('0x16')]?_0x4408f7[_0x6f70('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4408f7[_0x6f70('0x16')]?_0x4408f7[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x4408f7[_0x6f70('0x16')]?_0x4408f7[_0x6f70('0x16')][_0x6f70('0x18')]||null:null,'limit':_0x4408f7['options']?_0x4408f7[_0x6f70('0x16')][_0x6f70('0x19')]||null:null,'include':_0x4408f7[_0x6f70('0x16')]?_0x4408f7['options'][_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x4408f7[_0x6f70('0x16')][_0x6f70('0x1a')],function(_0x1597fe){return{'model':db[_0x1597fe[_0x6f70('0x1c')]],'as':_0x1597fe['as'],'attributes':_0x1597fe[_0x6f70('0x18')],'include':_0x1597fe[_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x1597fe[_0x6f70('0x1a')],function(_0x58d18e){return{'model':db[_0x58d18e[_0x6f70('0x1c')]],'as':_0x58d18e['as'],'attributes':_0x58d18e[_0x6f70('0x18')],'include':_0x58d18e['include']?_[_0x6f70('0x1b')](_0x58d18e[_0x6f70('0x1a')],function(_0x3eb568){return{'model':db[_0x3eb568['model']],'as':_0x3eb568['as'],'attributes':_0x3eb568[_0x6f70('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48846b){logger['info'](_0x6f70('0x13'),_0x4408f7);logger['debug'](_0x6f70('0x13'),_0x4408f7,JSON[_0x6f70('0xc')](_0x48846b));_0x5e35cd(_0x48846b);})[_0x6f70('0x12')](function(_0x1ff400){logger[_0x6f70('0xd')]('GetCmHopper',_0x1ff400[_0x6f70('0xf')],_0x4408f7);_0x5aeffa(_0x381cab['error'](0x1f4,_0x1ff400[_0x6f70('0xf')]));});});};exports[_0x6f70('0x1d')]=function(_0x3969cb){var _0x352ebb=this;return new Promise(function(_0x8f2c44,_0x4fae58){return db[_0x6f70('0x14')][_0x6f70('0x1e')]({'raw':_0x3969cb[_0x6f70('0x16')]?_0x3969cb['options'][_0x6f70('0x1f')]===undefined?!![]:![]:!![],'where':_0x3969cb['options']?_0x3969cb[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x3969cb[_0x6f70('0x16')]?_0x3969cb[_0x6f70('0x16')][_0x6f70('0x18')]||null:null,'include':_0x3969cb[_0x6f70('0x16')]?_0x3969cb[_0x6f70('0x16')][_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x3969cb[_0x6f70('0x16')][_0x6f70('0x1a')],function(_0x4da069){return{'model':db[_0x4da069['model']],'as':_0x4da069['as'],'attributes':_0x4da069['attributes'],'include':_0x4da069[_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x4da069[_0x6f70('0x1a')],function(_0x51903a){return{'model':db[_0x51903a[_0x6f70('0x1c')]],'as':_0x51903a['as'],'attributes':_0x51903a[_0x6f70('0x18')],'include':_0x51903a[_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x51903a[_0x6f70('0x1a')],function(_0x430770){return{'model':db[_0x430770['model']],'as':_0x430770['as'],'attributes':_0x430770[_0x6f70('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f70('0x8')](function(_0xe3d4f7){logger[_0x6f70('0x9')](_0x6f70('0x1d'),_0x3969cb);logger['debug']('ShowCmHopper',_0x3969cb,JSON[_0x6f70('0xc')](_0xe3d4f7));_0x8f2c44(_0xe3d4f7);})['catch'](function(_0x2c1354){logger[_0x6f70('0xd')](_0x6f70('0x1d'),_0x2c1354[_0x6f70('0xf')],_0x3969cb);_0x4fae58(_0x352ebb[_0x6f70('0xd')](0x1f4,_0x2c1354[_0x6f70('0xf')]));});});};exports[_0x6f70('0x20')]=function(_0x51b98d){var _0x59243b=this;return new Promise(function(_0x32449c,_0x277d90){return db[_0x6f70('0x14')]['create'](_0x51b98d[_0x6f70('0x21')],{'raw':_0x51b98d[_0x6f70('0x16')]?_0x51b98d[_0x6f70('0x16')][_0x6f70('0x1f')]===undefined?!![]:![]:!![]})[_0x6f70('0x8')](function(_0x4bb4cd){logger[_0x6f70('0x9')](_0x6f70('0x20'),_0x51b98d);logger['debug'](_0x6f70('0x20'),_0x51b98d,JSON['stringify'](_0x4bb4cd));_0x32449c(_0x4bb4cd);})[_0x6f70('0x12')](function(_0xa53266){logger[_0x6f70('0xd')]('CreateCmHopper',_0xa53266['message'],_0x51b98d);_0x277d90(_0x59243b[_0x6f70('0xd')](0x1f4,_0xa53266['message']));});});};exports[_0x6f70('0x22')]=function(_0x32b45f){var _0x5873a4=this;return new Promise(function(_0x59fbab,_0x59b1c1){return db['CmHopper']['update'](_0x32b45f[_0x6f70('0x21')],{'raw':_0x32b45f[_0x6f70('0x16')]?_0x32b45f[_0x6f70('0x16')][_0x6f70('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32b45f[_0x6f70('0x16')]?_0x32b45f[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x32b45f[_0x6f70('0x16')]?_0x32b45f[_0x6f70('0x16')][_0x6f70('0x18')]||null:null,'limit':_0x32b45f[_0x6f70('0x16')]?_0x32b45f['options'][_0x6f70('0x19')]||null:null})[_0x6f70('0x8')](function(_0x4a029a){logger[_0x6f70('0x9')]('UpdateCmHopper',_0x32b45f);logger[_0x6f70('0x9')](_0x6f70('0x23'),JSON[_0x6f70('0xc')](_0x32b45f[_0x6f70('0x16')]['where']),_0x32b45f[_0x6f70('0x21')][_0x6f70('0x24')]);logger[_0x6f70('0x25')](_0x6f70('0x22'),_0x32b45f,JSON['stringify'](_0x4a029a));_0x59fbab(_0x4a029a);})[_0x6f70('0x12')](function(_0x479dd1){logger[_0x6f70('0xd')]('UpdateCmHopper',_0x479dd1['message'],_0x32b45f);_0x59b1c1(_0x5873a4[_0x6f70('0xd')](0x1f4,_0x479dd1['message']));});});};exports['DestroyCmHopper']=function(_0x580116){var _0x5f4e0e=this;return new Promise(function(_0x418177,_0x43b847){return db['CmHopper']['destroy']({'where':_0x580116[_0x6f70('0x16')]?_0x580116[_0x6f70('0x16')][_0x6f70('0x17')]||null:null})['then'](function(_0x2728fd){logger[_0x6f70('0x9')](_0x6f70('0x26'),_0x580116);logger[_0x6f70('0x25')]('DestroyCmHopper',_0x580116,JSON['stringify'](_0x2728fd));_0x418177(_0x2728fd);})['catch'](function(_0xa11d13){logger['error'](_0x6f70('0x26'),_0xa11d13[_0x6f70('0xf')],_0x580116);_0x43b847(_0x5f4e0e['error'](0x1f4,_0xa11d13[_0x6f70('0xf')]));});});};exports['GetContactDialer']=function(_0x12142d){var _0x110d08=this;return new Promise(function(_0x493acf,_0xa134eb){return db[_0x6f70('0x27')]['describe']()[_0x6f70('0x8')](function(_0x463d52){return db['sequelize'][_0x6f70('0x28')](function(_0x5dedf7){return db[_0x6f70('0x14')]['findAll']({'where':_0x12142d[_0x6f70('0x16')]?_0x12142d[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x12142d[_0x6f70('0x16')]?_0x12142d[_0x6f70('0x16')][_0x6f70('0x18')]||null:null,'limit':_0x12142d[_0x6f70('0x16')]?_0x12142d[_0x6f70('0x16')]['limit']||null:null,'order':_0x12142d['options']?_0x12142d[_0x6f70('0x16')][_0x6f70('0x29')]||null:null,'transaction':_0x5dedf7,'lock':_0x5dedf7[_0x6f70('0x2a')][_0x6f70('0x2b')],'include':[{'model':db[_0x6f70('0x27')],'as':'Contact','attributes':_[_0x6f70('0x2c')](_0x463d52)},{'model':db[_0x6f70('0x2d')],'as':_0x6f70('0x2e'),'attributes':['id',_0x6f70('0x2f'),_0x6f70('0x30')]}]})['then'](function(_0x6fb5ae){var _0x41d5a2=[];var _0xd47cce=[];for(var _0x125713=0x0;_0x125713<_0x6fb5ae['length'];_0x125713+=0x1){var _0x5c29cf=_0x6fb5ae[_0x125713][_0x6f70('0x31')];if(_0x5c29cf===null){_0x41d5a2[_0x6f70('0x32')](_0x6fb5ae[_0x125713][_0x6f70('0x33')](_0x12142d[_0x6f70('0x21')],{'transaction':_0x5dedf7}));}else if(!_0xd47cce[_0x6f70('0x34')](_0x5c29cf)){_0xd47cce['push'](_0x5c29cf);_0x41d5a2[_0x6f70('0x32')](_0x6fb5ae[_0x125713]['update'](_0x12142d[_0x6f70('0x21')],{'transaction':_0x5dedf7}));}}return BPromise[_0x6f70('0x35')](_0x41d5a2);});})[_0x6f70('0x8')](function(_0x14f314){logger[_0x6f70('0x9')]('GetContactDialer',_0x12142d);if(_0x14f314['length']>0x0){logger[_0x6f70('0x9')](_0x6f70('0x36'),_0x14f314[0x0][_0x6f70('0x37')]['id'],_0x14f314[0x0][_0x6f70('0x37')][_0x6f70('0x38')],_0x14f314[0x0]['dataValues'][_0x6f70('0x24')]);}logger['debug'](_0x6f70('0x39'),_0x12142d,JSON[_0x6f70('0xc')](_0x14f314));_0x493acf(_0x14f314);})['catch'](function(_0x20ed8c){logger[_0x6f70('0xd')](_0x6f70('0x39'),_0x20ed8c[_0x6f70('0xf')],_0x12142d);_0xa134eb(_0x110d08[_0x6f70('0xd')](0x1f4,_0x20ed8c[_0x6f70('0xf')]));});});});};exports['MoveContactManagedDialer']=function(_0x3f3ab5){var _0x2d87fb=this;return new Promise(function(_0x5dcfa5,_0x3aacf8){return db[_0x6f70('0x3a')][_0x6f70('0x28')](function(_0x1457f8){return db[_0x6f70('0x3b')][_0x6f70('0x3c')](_0x3f3ab5[_0x6f70('0x21')],{'raw':_0x3f3ab5['options']?_0x3f3ab5[_0x6f70('0x16')][_0x6f70('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x1457f8})[_0x6f70('0x8')](function(){logger[_0x6f70('0x9')](_0x6f70('0x3d'),JSON['stringify'](_0x3f3ab5[_0x6f70('0x16')][_0x6f70('0x17')]),_0x3f3ab5[_0x6f70('0x16')][_0x6f70('0x17')][_0x6f70('0x24')]);return db[_0x6f70('0x14')][_0x6f70('0x3e')]({'where':_0x3f3ab5['options']?_0x3f3ab5[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'transaction':_0x1457f8});});})['then'](function(_0x1a974f){logger['info']('MoveContactManagedDialer',_0x3f3ab5);logger[_0x6f70('0x25')]('MoveContactManagedDialer',_0x3f3ab5,JSON['stringify'](_0x1a974f));_0x5dcfa5(_0x1a974f);})[_0x6f70('0x12')](function(_0x3b25f4){logger[_0x6f70('0xd')]('MoveContactManagedDialer',_0x3b25f4[_0x6f70('0xf')],_0x3f3ab5);_0x3aacf8(_0x2d87fb[_0x6f70('0xd')](0x1f4,_0x3b25f4['message']));});});};exports[_0x6f70('0x3f')]=function(_0x5465a3){var _0x45c9b1=this;return new Promise(function(_0x4f77bf,_0x53f38d){return db[_0x6f70('0x14')][_0x6f70('0x15')]({'raw':_0x5465a3[_0x6f70('0x16')]?_0x5465a3[_0x6f70('0x16')][_0x6f70('0x1f')]===undefined?!![]:![]:!![],'where':_0x5465a3[_0x6f70('0x16')]?_0x5465a3['options'][_0x6f70('0x17')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6f70('0x3a')]['fn']('IF',db['sequelize'][_0x6f70('0x40')](_0x6f70('0x41')+util['format']('\x22%s\x22',moment()[_0x6f70('0x42')](_0x6f70('0x43')))+_0x6f70('0x44')))),_0x6f70('0x45')]]})[_0x6f70('0x8')](function(_0xd0c2b){logger[_0x6f70('0x9')](_0x6f70('0x3f'),_0x5465a3);logger[_0x6f70('0x25')]('CountReScheduled',_0x5465a3,JSON[_0x6f70('0xc')](_0xd0c2b));_0x4f77bf(_0xd0c2b);})[_0x6f70('0x12')](function(_0x11cae8){logger[_0x6f70('0xd')](_0x6f70('0x3f'),_0x11cae8[_0x6f70('0xf')],_0x5465a3);_0x53f38d(_0x45c9b1[_0x6f70('0xd')](0x1f4,_0x11cae8[_0x6f70('0xf')]));});});};exports['GetContactRecallMe']=function(_0x14eaa0){var _0x35db64=this;return new Promise(function(_0x257e7f,_0x6362e3){return db['CmContact'][_0x6f70('0x46')]()[_0x6f70('0x8')](function(_0x3965c0){return db[_0x6f70('0x3a')]['transaction'](function(_0x53698b){return db[_0x6f70('0x14')][_0x6f70('0x15')]({'where':_0x14eaa0[_0x6f70('0x16')]?_0x14eaa0[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x14eaa0['options']?_0x14eaa0['options'][_0x6f70('0x18')]||null:null,'limit':0x1,'order':_0x14eaa0['options']?_0x14eaa0[_0x6f70('0x16')][_0x6f70('0x29')]||null:null,'group':db[_0x6f70('0x14')][_0x6f70('0x31')],'transaction':_0x53698b,'lock':_0x53698b[_0x6f70('0x2a')][_0x6f70('0x2b')],'include':_0x14eaa0[_0x6f70('0x16')]?_0x14eaa0[_0x6f70('0x16')][_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x14eaa0[_0x6f70('0x16')]['include'],function(_0xb2ea02){return{'model':db[_0xb2ea02['model']],'as':_0xb2ea02['as'],'attributes':_0xb2ea02[_0x6f70('0x18')],'include':_0xb2ea02['include']?_[_0x6f70('0x1b')](_0xb2ea02[_0x6f70('0x1a')],function(_0x1c497d){return{'model':db[_0x1c497d[_0x6f70('0x1c')]],'as':_0x1c497d['as'],'attributes':_0x1c497d[_0x6f70('0x18')],'include':_0x1c497d['include']?_[_0x6f70('0x1b')](_0x1c497d[_0x6f70('0x1a')],function(_0x403ed6){return{'model':db[_0x403ed6[_0x6f70('0x1c')]],'as':_0x403ed6['as'],'attributes':_0x403ed6[_0x6f70('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f70('0x8')](function(_0x31285f){var _0x4a6eba=[];for(var _0x1daec0=0x0;_0x1daec0<_0x31285f[_0x6f70('0x47')];_0x1daec0+=0x1){_0x4a6eba['push'](_0x31285f[_0x1daec0][_0x6f70('0x33')](_0x14eaa0[_0x6f70('0x21')],{'transaction':_0x53698b}));}return BPromise[_0x6f70('0x35')](_0x4a6eba);});})['then'](function(_0x5b790a){logger[_0x6f70('0x9')](_0x6f70('0x48'),_0x14eaa0);logger['debug']('GetContactRecallMe',_0x14eaa0,JSON[_0x6f70('0xc')](_0x5b790a));_0x257e7f(_0x5b790a);})[_0x6f70('0x12')](function(_0x1e17d2){logger[_0x6f70('0xd')]('GetContactRecallMe',_0x1e17d2[_0x6f70('0xf')],_0x14eaa0);_0x6362e3(_0x35db64[_0x6f70('0xd')](0x1f4,_0x1e17d2[_0x6f70('0xf')]));});});});};exports[_0x6f70('0x49')]=function(_0x2b7f3e){var _0xa34080=this;return new Promise(function(_0x45d72f,_0xdc7f2c){db[_0x6f70('0x27')][_0x6f70('0x46')]()['then'](function(_0x1c71fc){return db[_0x6f70('0x14')][_0x6f70('0x15')]({'raw':_0x2b7f3e[_0x6f70('0x16')]?_0x2b7f3e['options'][_0x6f70('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b7f3e[_0x6f70('0x16')]?_0x2b7f3e[_0x6f70('0x16')][_0x6f70('0x17')]||null:null,'attributes':_0x2b7f3e['options']?_0x2b7f3e[_0x6f70('0x16')][_0x6f70('0x18')]||null:null,'limit':_0x2b7f3e[_0x6f70('0x16')]?_0x2b7f3e[_0x6f70('0x16')][_0x6f70('0x19')]||null:null,'include':_0x2b7f3e[_0x6f70('0x16')]?_0x2b7f3e[_0x6f70('0x16')][_0x6f70('0x1a')]?_[_0x6f70('0x1b')](_0x2b7f3e['options'][_0x6f70('0x1a')],function(_0x1c7642){return{'model':db[_0x1c7642[_0x6f70('0x1c')]],'as':_0x1c7642['as'],'attributes':_0x1c7642['as']==='Contact'?_[_0x6f70('0x2c')](_0x1c71fc):_0x1c7642[_0x6f70('0x18')],'include':_0x1c7642['include']?_[_0x6f70('0x1b')](_0x1c7642['include'],function(_0x3f0b4d){return{'model':db[_0x3f0b4d[_0x6f70('0x1c')]],'as':_0x3f0b4d['as'],'attributes':_0x3f0b4d[_0x6f70('0x18')],'include':_0x3f0b4d['include']?_['map'](_0x3f0b4d[_0x6f70('0x1a')],function(_0x26fa43){return{'model':db[_0x26fa43[_0x6f70('0x1c')]],'as':_0x26fa43['as'],'attributes':_0x26fa43[_0x6f70('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f70('0x8')](function(_0x5a45e9){logger[_0x6f70('0x9')](_0x6f70('0x13'),_0x2b7f3e);logger[_0x6f70('0x25')](_0x6f70('0x13'),_0x2b7f3e,JSON[_0x6f70('0xc')](_0x5a45e9));_0x45d72f(_0x5a45e9);})['catch'](function(_0x599a6d){logger[_0x6f70('0xd')](_0x6f70('0x13'),_0x599a6d[_0x6f70('0xf')],_0x2b7f3e);_0xdc7f2c(_0xa34080[_0x6f70('0xd')](0x1f4,_0x599a6d[_0x6f70('0xf')]));});});});};exports[_0x6f70('0x4a')]=function(_0x4024b1){var _0x26309f=this;return new Promise(function(_0x23b77f,_0x4a6117){return db[_0x6f70('0x27')][_0x6f70('0x4b')]({'raw':!![],'where':{'phone':_0x4024b1[_0x6f70('0x16')][_0x6f70('0x17')][_0x6f70('0x4c')]},'attributes':['id',_0x6f70('0x4d')],'order':[['id',_0x6f70('0x4e')]]})[_0x6f70('0x8')](function(_0x5c7a44){logger[_0x6f70('0x9')](_0x6f70('0x4f'),_0x4024b1);logger[_0x6f70('0x25')](_0x6f70('0x4f'),_0x4024b1,JSON[_0x6f70('0xc')](_0x5c7a44));_0x23b77f(_0x5c7a44);})[_0x6f70('0x12')](function(_0x3a244f){logger[_0x6f70('0xd')](_0x6f70('0x4f'),_0x3a244f[_0x6f70('0xf')],_0x4024b1);_0x4a6117(_0x26309f[_0x6f70('0xd')](0x1f4,_0x3a244f['message']));});});};exports[_0x6f70('0x50')]=function(_0xc6f3ae){var _0x4509d6=this;return new Promise(function(_0x4296d6,_0x50a7ea){return db[_0x6f70('0x3a')][_0x6f70('0x28')](function(_0x3e0b21){return db[_0x6f70('0x14')][_0x6f70('0x33')](_0xc6f3ae[_0x6f70('0x21')],{'where':{},'transaction':_0x3e0b21})['then'](function(_0x237944){logger[_0x6f70('0x9')](_0x6f70('0x50'),_0xc6f3ae);logger[_0x6f70('0x25')](_0x6f70('0x50'),_0xc6f3ae,JSON['stringify'](_0x237944));_0x4296d6(_0x237944);})[_0x6f70('0x12')](function(_0x3e77a2){logger['error'](_0x6f70('0x50'),_0x3e77a2['message'],_0xc6f3ae);_0x50a7ea(_0x4509d6['error'](0x1f4,_0x3e77a2[_0x6f70('0xf')]));});});});};exports[_0x6f70('0x51')]=function(_0x290052){var _0x199dac=this;var _0x590d4a=_0x290052[_0x6f70('0x21')][_0x6f70('0x17')][_0x6f70('0x52')];var _0x316346=_0x290052[_0x6f70('0x21')][_0x6f70('0x17')][_0x6f70('0x53')];var _0x40336c=_0x290052[_0x6f70('0x21')]['where']['availableAgentsIds'];return new Promise(function(_0x3807bc,_0x5ddc60){return db[_0x6f70('0x14')]['findAll']({'where':{'voiceQueueId':{'$in':_0x590d4a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6f70('0x3a')][_0x6f70('0x40')](_0x6f70('0x54')+_0x316346+'\x20MINUTE'),'$gt':db[_0x6f70('0x3a')][_0x6f70('0x40')]('NOW()')}},'UserId':{'$in':_0x40336c}},'include':[{'model':db[_0x6f70('0x27')],'as':_0x6f70('0x55')},{'model':db['User'],'as':_0x6f70('0x2e'),'attributes':['id','name',_0x6f70('0x30')]},{'model':db[_0x6f70('0x56')],'as':_0x6f70('0x57')}]})[_0x6f70('0x8')](function(_0x5379c4){if(_0x5379c4[_0x6f70('0x47')]>0x0){return db[_0x6f70('0x3a')][_0x6f70('0x28')](function(_0x93e596){return db[_0x6f70('0x14')][_0x6f70('0x33')]({'recallmeNotifiedDate':db[_0x6f70('0x3a')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x5379c4,'id')}},'transaction':_0x93e596})[_0x6f70('0x8')](function(){_0x3807bc(_0x5379c4);})[_0x6f70('0x12')](function(_0x429f26){logger[_0x6f70('0xd')]('CmHopperHandlePreviewRecallNotifications',_0x429f26[_0x6f70('0xf')],_0x290052);_0x5ddc60(_0x199dac[_0x6f70('0xd')](0x1f4,_0x429f26[_0x6f70('0xf')]));});})[_0x6f70('0x12')](function(_0x4b834d){logger['error'](_0x6f70('0x51'),_0x4b834d[_0x6f70('0xf')],_0x290052);_0x5ddc60(_0x199dac[_0x6f70('0xd')](0x1f4,_0x4b834d[_0x6f70('0xf')]));});}else{_0x3807bc(_0x5379c4);}});});}; \ No newline at end of file +var _0x3f61=['voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','CmList','List','lodash','bluebird','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','GetCmHopper','findAll','options','raw','where','attributes','include','map','model','CmHopper','then','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','sequelize','transaction','order','LOCK','CmContact','Contact','keys','User','name','voicePause','length','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3f61,0x10e));var _0x13f6=function(_0x594da7,_0x39d9d8){_0x594da7=_0x594da7-0x0;var _0x4e436f=_0x3f61[_0x594da7];return _0x4e436f;};'use strict';var _=require(_0x13f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13f6('0x1'));var db=require(_0x13f6('0x2'))['db'];var logger=require('../../config/logger')('rpc');var jayson=require(_0x13f6('0x3'));var client=jayson[_0x13f6('0x4')][_0x13f6('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3319ed,_0x5c18cb,_0x2ea3b6){return new BPromise(function(_0x14420f,_0x4cc1ad){return client[_0x13f6('0x6')](_0x3319ed,_0x2ea3b6)['then'](function(_0x1caea5){logger['info']('CmHopper,\x20%s,\x20%s',_0x5c18cb,_0x13f6('0x7'));logger[_0x13f6('0x8')](_0x13f6('0x9'),_0x5c18cb,'request\x20sent',JSON[_0x13f6('0xa')](_0x1caea5));if(_0x1caea5['error']){if(_0x1caea5[_0x13f6('0xb')][_0x13f6('0xc')]===0x1f4){logger[_0x13f6('0xb')](_0x13f6('0xd'),_0x5c18cb,_0x1caea5[_0x13f6('0xb')][_0x13f6('0xe')]);return _0x4cc1ad(_0x1caea5[_0x13f6('0xb')][_0x13f6('0xe')]);}logger[_0x13f6('0xb')](_0x13f6('0xd'),_0x5c18cb,_0x1caea5[_0x13f6('0xb')][_0x13f6('0xe')]);return _0x14420f(_0x1caea5[_0x13f6('0xb')][_0x13f6('0xe')]);}else{logger[_0x13f6('0xf')]('CmHopper,\x20%s,\x20%s',_0x5c18cb,_0x13f6('0x7'));_0x14420f(_0x1caea5[_0x13f6('0x10')]['message']);}})[_0x13f6('0x11')](function(_0xba298a){logger[_0x13f6('0xb')](_0x13f6('0xd'),_0x5c18cb,_0xba298a);_0x4cc1ad(_0xba298a);});});}exports[_0x13f6('0x12')]=function(_0x470033){var _0x47a7ec=this;return new Promise(function(_0x2962fa,_0x2429e7){return db['CmHopper'][_0x13f6('0x13')]({'raw':_0x470033[_0x13f6('0x14')]?_0x470033['options'][_0x13f6('0x15')]===undefined?!![]:![]:!![],'where':_0x470033[_0x13f6('0x14')]?_0x470033[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'attributes':_0x470033[_0x13f6('0x14')]?_0x470033[_0x13f6('0x14')][_0x13f6('0x17')]||null:null,'limit':_0x470033[_0x13f6('0x14')]?_0x470033['options']['limit']||null:null,'include':_0x470033[_0x13f6('0x14')]?_0x470033[_0x13f6('0x14')][_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x470033[_0x13f6('0x14')][_0x13f6('0x18')],function(_0x5383c1){return{'model':db[_0x5383c1[_0x13f6('0x1a')]],'as':_0x5383c1['as'],'attributes':_0x5383c1['attributes'],'include':_0x5383c1['include']?_['map'](_0x5383c1[_0x13f6('0x18')],function(_0x41b594){return{'model':db[_0x41b594[_0x13f6('0x1a')]],'as':_0x41b594['as'],'attributes':_0x41b594[_0x13f6('0x17')],'include':_0x41b594[_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x41b594[_0x13f6('0x18')],function(_0x42fd13){return{'model':db[_0x42fd13[_0x13f6('0x1a')]],'as':_0x42fd13['as'],'attributes':_0x42fd13[_0x13f6('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33c8db){logger[_0x13f6('0xf')]('GetCmHopper',_0x470033);logger['debug'](_0x13f6('0x12'),_0x470033,JSON['stringify'](_0x33c8db));_0x2962fa(_0x33c8db);})['catch'](function(_0x5c0455){logger[_0x13f6('0xb')](_0x13f6('0x12'),_0x5c0455[_0x13f6('0xe')],_0x470033);_0x2429e7(_0x47a7ec[_0x13f6('0xb')](0x1f4,_0x5c0455['message']));});});};exports['ShowCmHopper']=function(_0x5e162f){var _0x17fab2=this;return new Promise(function(_0xc24a88,_0x2416e6){return db[_0x13f6('0x1b')]['find']({'raw':_0x5e162f[_0x13f6('0x14')]?_0x5e162f['options'][_0x13f6('0x15')]===undefined?!![]:![]:!![],'where':_0x5e162f[_0x13f6('0x14')]?_0x5e162f[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'attributes':_0x5e162f[_0x13f6('0x14')]?_0x5e162f['options'][_0x13f6('0x17')]||null:null,'include':_0x5e162f['options']?_0x5e162f[_0x13f6('0x14')][_0x13f6('0x18')]?_['map'](_0x5e162f[_0x13f6('0x14')][_0x13f6('0x18')],function(_0x50ca94){return{'model':db[_0x50ca94[_0x13f6('0x1a')]],'as':_0x50ca94['as'],'attributes':_0x50ca94[_0x13f6('0x17')],'include':_0x50ca94[_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x50ca94['include'],function(_0x197292){return{'model':db[_0x197292['model']],'as':_0x197292['as'],'attributes':_0x197292[_0x13f6('0x17')],'include':_0x197292[_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x197292['include'],function(_0x41dcbf){return{'model':db[_0x41dcbf[_0x13f6('0x1a')]],'as':_0x41dcbf['as'],'attributes':_0x41dcbf[_0x13f6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x13f6('0x1c')](function(_0x46fe41){logger[_0x13f6('0xf')](_0x13f6('0x1d'),_0x5e162f);logger[_0x13f6('0x8')]('ShowCmHopper',_0x5e162f,JSON['stringify'](_0x46fe41));_0xc24a88(_0x46fe41);})[_0x13f6('0x11')](function(_0x317429){logger[_0x13f6('0xb')](_0x13f6('0x1d'),_0x317429[_0x13f6('0xe')],_0x5e162f);_0x2416e6(_0x17fab2[_0x13f6('0xb')](0x1f4,_0x317429[_0x13f6('0xe')]));});});};exports[_0x13f6('0x1e')]=function(_0x5687d1){var _0x435665=this;return new Promise(function(_0x3db545,_0x1ceae0){return db[_0x13f6('0x1b')][_0x13f6('0x1f')](_0x5687d1[_0x13f6('0x20')],{'raw':_0x5687d1['options']?_0x5687d1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x148f05){logger[_0x13f6('0xf')](_0x13f6('0x1e'),_0x5687d1);logger[_0x13f6('0x8')]('CreateCmHopper',_0x5687d1,JSON[_0x13f6('0xa')](_0x148f05));_0x3db545(_0x148f05);})['catch'](function(_0x45a283){logger[_0x13f6('0xb')](_0x13f6('0x1e'),_0x45a283[_0x13f6('0xe')],_0x5687d1);_0x1ceae0(_0x435665[_0x13f6('0xb')](0x1f4,_0x45a283['message']));});});};exports[_0x13f6('0x21')]=function(_0x480265){var _0x3783fa=this;return new Promise(function(_0x433379,_0x45bc5d){return db[_0x13f6('0x1b')][_0x13f6('0x22')](_0x480265[_0x13f6('0x20')],{'raw':_0x480265[_0x13f6('0x14')]?_0x480265['options'][_0x13f6('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480265['options']?_0x480265[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'attributes':_0x480265[_0x13f6('0x14')]?_0x480265[_0x13f6('0x14')][_0x13f6('0x17')]||null:null,'limit':_0x480265['options']?_0x480265[_0x13f6('0x14')][_0x13f6('0x23')]||null:null})[_0x13f6('0x1c')](function(_0x4dd57e){logger['info'](_0x13f6('0x21'),_0x480265);logger[_0x13f6('0xf')](_0x13f6('0x24'),JSON[_0x13f6('0xa')](_0x480265['options'][_0x13f6('0x16')]),_0x480265[_0x13f6('0x20')][_0x13f6('0x25')]);logger[_0x13f6('0x8')]('UpdateCmHopper',_0x480265,JSON[_0x13f6('0xa')](_0x4dd57e));_0x433379(_0x4dd57e);})['catch'](function(_0xfdb84b){logger['error'](_0x13f6('0x21'),_0xfdb84b[_0x13f6('0xe')],_0x480265);_0x45bc5d(_0x3783fa[_0x13f6('0xb')](0x1f4,_0xfdb84b[_0x13f6('0xe')]));});});};exports[_0x13f6('0x26')]=function(_0x42445f){var _0x5ea51a=this;return new Promise(function(_0x1f6dfd,_0x13cba5){return db['CmHopper'][_0x13f6('0x27')]({'where':_0x42445f[_0x13f6('0x14')]?_0x42445f['options'][_0x13f6('0x16')]||null:null})['then'](function(_0x3e7bfa){logger[_0x13f6('0xf')](_0x13f6('0x26'),_0x42445f);logger[_0x13f6('0x8')](_0x13f6('0x26'),_0x42445f,JSON[_0x13f6('0xa')](_0x3e7bfa));_0x1f6dfd(_0x3e7bfa);})[_0x13f6('0x11')](function(_0x3137ea){logger[_0x13f6('0xb')](_0x13f6('0x26'),_0x3137ea['message'],_0x42445f);_0x13cba5(_0x5ea51a[_0x13f6('0xb')](0x1f4,_0x3137ea['message']));});});};exports['GetContactDialer']=function(_0x1f1f12){var _0x403f13=this;return new Promise(function(_0xc0bae5,_0x2ecedd){return db['CmContact'][_0x13f6('0x28')]()[_0x13f6('0x1c')](function(_0x5edf56){return db[_0x13f6('0x29')][_0x13f6('0x2a')](function(_0x3c703c){return db[_0x13f6('0x1b')]['findAll']({'where':_0x1f1f12[_0x13f6('0x14')]?_0x1f1f12[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'attributes':_0x1f1f12[_0x13f6('0x14')]?_0x1f1f12[_0x13f6('0x14')]['attributes']||null:null,'limit':_0x1f1f12[_0x13f6('0x14')]?_0x1f1f12[_0x13f6('0x14')][_0x13f6('0x23')]||null:null,'order':_0x1f1f12[_0x13f6('0x14')]?_0x1f1f12['options'][_0x13f6('0x2b')]||null:null,'transaction':_0x3c703c,'lock':_0x3c703c[_0x13f6('0x2c')]['UPDATE'],'include':[{'model':db[_0x13f6('0x2d')],'as':_0x13f6('0x2e'),'attributes':_[_0x13f6('0x2f')](_0x5edf56)},{'model':db[_0x13f6('0x30')],'as':'Agent','attributes':['id',_0x13f6('0x31'),_0x13f6('0x32')]}]})[_0x13f6('0x1c')](function(_0x51b0a6){var _0x43009c=[];var _0x294219=[];for(var _0x1a1db3=0x0;_0x1a1db3<_0x51b0a6[_0x13f6('0x33')];_0x1a1db3+=0x1){var _0x1e8f93=_0x51b0a6[_0x1a1db3]['UserId'];if(_0x1e8f93===null){_0x43009c[_0x13f6('0x34')](_0x51b0a6[_0x1a1db3]['update'](_0x1f1f12[_0x13f6('0x20')],{'transaction':_0x3c703c}));}else if(!_0x294219[_0x13f6('0x35')](_0x1e8f93)){_0x294219[_0x13f6('0x34')](_0x1e8f93);_0x43009c[_0x13f6('0x34')](_0x51b0a6[_0x1a1db3][_0x13f6('0x22')](_0x1f1f12[_0x13f6('0x20')],{'transaction':_0x3c703c}));}}return BPromise[_0x13f6('0x36')](_0x43009c);});})[_0x13f6('0x1c')](function(_0x383a9e){logger['info'](_0x13f6('0x37'),_0x1f1f12);if(_0x383a9e[_0x13f6('0x33')]>0x0){logger[_0x13f6('0xf')](_0x13f6('0x38'),_0x383a9e[0x0][_0x13f6('0x39')]['id'],_0x383a9e[0x0]['dataValues'][_0x13f6('0x3a')],_0x383a9e[0x0]['dataValues'][_0x13f6('0x25')]);}logger[_0x13f6('0x8')]('GetContactDialer',_0x1f1f12,JSON['stringify'](_0x383a9e));_0xc0bae5(_0x383a9e);})['catch'](function(_0x3644fa){logger[_0x13f6('0xb')](_0x13f6('0x37'),_0x3644fa[_0x13f6('0xe')],_0x1f1f12);_0x2ecedd(_0x403f13[_0x13f6('0xb')](0x1f4,_0x3644fa['message']));});});});};exports[_0x13f6('0x3b')]=function(_0x1a1ecb){var _0x443f55=this;return new Promise(function(_0x4b120d,_0x124990){return db['sequelize'][_0x13f6('0x2a')](function(_0x5ce4d2){return db[_0x13f6('0x3c')][_0x13f6('0x1f')](_0x1a1ecb[_0x13f6('0x20')],{'raw':_0x1a1ecb['options']?_0x1a1ecb[_0x13f6('0x14')][_0x13f6('0x15')]===undefined?!![]:![]:!![],'transaction':_0x5ce4d2})['then'](function(){logger[_0x13f6('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x13f6('0xa')](_0x1a1ecb[_0x13f6('0x14')][_0x13f6('0x16')]),_0x1a1ecb[_0x13f6('0x14')]['where'][_0x13f6('0x25')]);return db[_0x13f6('0x1b')][_0x13f6('0x27')]({'where':_0x1a1ecb['options']?_0x1a1ecb[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'transaction':_0x5ce4d2});});})[_0x13f6('0x1c')](function(_0xa603c0){logger[_0x13f6('0xf')]('MoveContactManagedDialer',_0x1a1ecb);logger[_0x13f6('0x8')](_0x13f6('0x3b'),_0x1a1ecb,JSON[_0x13f6('0xa')](_0xa603c0));_0x4b120d(_0xa603c0);})[_0x13f6('0x11')](function(_0xc49d47){logger[_0x13f6('0xb')](_0x13f6('0x3b'),_0xc49d47[_0x13f6('0xe')],_0x1a1ecb);_0x124990(_0x443f55[_0x13f6('0xb')](0x1f4,_0xc49d47[_0x13f6('0xe')]));});});};exports[_0x13f6('0x3d')]=function(_0xec746a){var _0x2e0c83=this;return new Promise(function(_0x24ed87,_0x2cbfd2){return db[_0x13f6('0x1b')]['findAll']({'raw':_0xec746a[_0x13f6('0x14')]?_0xec746a[_0x13f6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xec746a['options']?_0xec746a['options'][_0x13f6('0x16')]||null:null,'attributes':[[db[_0x13f6('0x29')]['fn'](_0x13f6('0x3e'),db[_0x13f6('0x29')]['fn']('IF',db[_0x13f6('0x29')][_0x13f6('0x3f')](_0x13f6('0x40')+util[_0x13f6('0x41')](_0x13f6('0x42'),moment()[_0x13f6('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x13f6('0x43')))),'contactsRescheduled']]})[_0x13f6('0x1c')](function(_0x1814d2){logger['info'](_0x13f6('0x3d'),_0xec746a);logger[_0x13f6('0x8')](_0x13f6('0x3d'),_0xec746a,JSON['stringify'](_0x1814d2));_0x24ed87(_0x1814d2);})[_0x13f6('0x11')](function(_0x305b1d){logger['error'](_0x13f6('0x3d'),_0x305b1d[_0x13f6('0xe')],_0xec746a);_0x2cbfd2(_0x2e0c83[_0x13f6('0xb')](0x1f4,_0x305b1d[_0x13f6('0xe')]));});});};exports[_0x13f6('0x44')]=function(_0x24d15b){var _0x501cf5=this;return new Promise(function(_0x395098,_0x5ef515){return db[_0x13f6('0x2d')][_0x13f6('0x28')]()[_0x13f6('0x1c')](function(_0x418049){return db[_0x13f6('0x29')][_0x13f6('0x2a')](function(_0x43a027){return db[_0x13f6('0x1b')]['findAll']({'where':_0x24d15b[_0x13f6('0x14')]?_0x24d15b[_0x13f6('0x14')]['where']||null:null,'attributes':_0x24d15b[_0x13f6('0x14')]?_0x24d15b[_0x13f6('0x14')][_0x13f6('0x17')]||null:null,'limit':0x1,'order':_0x24d15b[_0x13f6('0x14')]?_0x24d15b[_0x13f6('0x14')][_0x13f6('0x2b')]||null:null,'group':db[_0x13f6('0x1b')]['UserId'],'transaction':_0x43a027,'lock':_0x43a027[_0x13f6('0x2c')][_0x13f6('0x45')],'include':_0x24d15b[_0x13f6('0x14')]?_0x24d15b[_0x13f6('0x14')][_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x24d15b[_0x13f6('0x14')]['include'],function(_0x5314fa){return{'model':db[_0x5314fa[_0x13f6('0x1a')]],'as':_0x5314fa['as'],'attributes':_0x5314fa[_0x13f6('0x17')],'include':_0x5314fa['include']?_[_0x13f6('0x19')](_0x5314fa['include'],function(_0x42dd61){return{'model':db[_0x42dd61[_0x13f6('0x1a')]],'as':_0x42dd61['as'],'attributes':_0x42dd61[_0x13f6('0x17')],'include':_0x42dd61[_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x42dd61[_0x13f6('0x18')],function(_0x2167a5){return{'model':db[_0x2167a5[_0x13f6('0x1a')]],'as':_0x2167a5['as'],'attributes':_0x2167a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x13f6('0x1c')](function(_0x47175d){var _0x2e0f16=[];for(var _0x47e5bb=0x0;_0x47e5bb<_0x47175d[_0x13f6('0x33')];_0x47e5bb+=0x1){_0x2e0f16[_0x13f6('0x34')](_0x47175d[_0x47e5bb]['update'](_0x24d15b[_0x13f6('0x20')],{'transaction':_0x43a027}));}return BPromise[_0x13f6('0x36')](_0x2e0f16);});})[_0x13f6('0x1c')](function(_0x5ca4df){logger[_0x13f6('0xf')](_0x13f6('0x44'),_0x24d15b);logger[_0x13f6('0x8')]('GetContactRecallMe',_0x24d15b,JSON['stringify'](_0x5ca4df));_0x395098(_0x5ca4df);})[_0x13f6('0x11')](function(_0x2f95c5){logger['error'](_0x13f6('0x44'),_0x2f95c5[_0x13f6('0xe')],_0x24d15b);_0x5ef515(_0x501cf5[_0x13f6('0xb')](0x1f4,_0x2f95c5[_0x13f6('0xe')]));});});});};exports['GetCmHopperPreview']=function(_0x37a58a){var _0x22b931=this;return new Promise(function(_0x4eb707,_0x490bdf){db[_0x13f6('0x2d')][_0x13f6('0x28')]()[_0x13f6('0x1c')](function(_0x23f4fe){return db[_0x13f6('0x1b')][_0x13f6('0x13')]({'raw':_0x37a58a[_0x13f6('0x14')]?_0x37a58a[_0x13f6('0x14')][_0x13f6('0x15')]===undefined?!![]:![]:!![],'where':_0x37a58a['options']?_0x37a58a[_0x13f6('0x14')][_0x13f6('0x16')]||null:null,'attributes':_0x37a58a[_0x13f6('0x14')]?_0x37a58a['options']['attributes']||null:null,'limit':_0x37a58a['options']?_0x37a58a['options'][_0x13f6('0x23')]||null:null,'include':_0x37a58a[_0x13f6('0x14')]?_0x37a58a['options'][_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x37a58a[_0x13f6('0x14')][_0x13f6('0x18')],function(_0x34dedc){return{'model':db[_0x34dedc['model']],'as':_0x34dedc['as'],'attributes':_0x34dedc['as']===_0x13f6('0x2e')?_[_0x13f6('0x2f')](_0x23f4fe):_0x34dedc['attributes'],'include':_0x34dedc[_0x13f6('0x18')]?_['map'](_0x34dedc[_0x13f6('0x18')],function(_0x1cb503){return{'model':db[_0x1cb503[_0x13f6('0x1a')]],'as':_0x1cb503['as'],'attributes':_0x1cb503[_0x13f6('0x17')],'include':_0x1cb503[_0x13f6('0x18')]?_[_0x13f6('0x19')](_0x1cb503[_0x13f6('0x18')],function(_0x2dab98){return{'model':db[_0x2dab98[_0x13f6('0x1a')]],'as':_0x2dab98['as'],'attributes':_0x2dab98[_0x13f6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x13f6('0x1c')](function(_0x403f45){logger[_0x13f6('0xf')](_0x13f6('0x12'),_0x37a58a);logger[_0x13f6('0x8')](_0x13f6('0x12'),_0x37a58a,JSON['stringify'](_0x403f45));_0x4eb707(_0x403f45);})[_0x13f6('0x11')](function(_0x1f3f3d){logger[_0x13f6('0xb')](_0x13f6('0x12'),_0x1f3f3d[_0x13f6('0xe')],_0x37a58a);_0x490bdf(_0x22b931[_0x13f6('0xb')](0x1f4,_0x1f3f3d[_0x13f6('0xe')]));});});});};exports[_0x13f6('0x46')]=function(_0x364c52){var _0x3de63d=this;return new Promise(function(_0x26606c,_0x514e50){return db[_0x13f6('0x2d')][_0x13f6('0x47')]({'raw':!![],'where':{'phone':_0x364c52['options'][_0x13f6('0x16')][_0x13f6('0x48')]},'attributes':['id',_0x13f6('0x49')],'order':[['id',_0x13f6('0x4a')]]})[_0x13f6('0x1c')](function(_0x55659a){logger['info'](_0x13f6('0x4b'),_0x364c52);logger[_0x13f6('0x8')](_0x13f6('0x4b'),_0x364c52,JSON[_0x13f6('0xa')](_0x55659a));_0x26606c(_0x55659a);})[_0x13f6('0x11')](function(_0x713cc0){logger[_0x13f6('0xb')](_0x13f6('0x4b'),_0x713cc0[_0x13f6('0xe')],_0x364c52);_0x514e50(_0x3de63d[_0x13f6('0xb')](0x1f4,_0x713cc0[_0x13f6('0xe')]));});});};exports[_0x13f6('0x4c')]=function(_0x569f23){var _0x403e82=this;return new Promise(function(_0x5c8ad8,_0x55a61e){return db[_0x13f6('0x29')][_0x13f6('0x2a')](function(_0x2526ab){return db[_0x13f6('0x1b')][_0x13f6('0x22')](_0x569f23['body'],{'where':{},'transaction':_0x2526ab})[_0x13f6('0x1c')](function(_0x5bd08e){logger['info']('ResetActiveCalls',_0x569f23);logger['debug'](_0x13f6('0x4c'),_0x569f23,JSON['stringify'](_0x5bd08e));_0x5c8ad8(_0x5bd08e);})['catch'](function(_0xe3541){logger[_0x13f6('0xb')](_0x13f6('0x4c'),_0xe3541[_0x13f6('0xe')],_0x569f23);_0x55a61e(_0x403e82[_0x13f6('0xb')](0x1f4,_0xe3541[_0x13f6('0xe')]));});});});};exports[_0x13f6('0x4d')]=function(_0x177e65){var _0x24e8e0=this;var _0x43e063=_0x177e65[_0x13f6('0x20')][_0x13f6('0x16')][_0x13f6('0x4e')];var _0xa1106c=_0x177e65[_0x13f6('0x20')][_0x13f6('0x16')][_0x13f6('0x4f')];var _0x14b5e7=_0x177e65['body'][_0x13f6('0x16')][_0x13f6('0x50')];return new Promise(function(_0x544eb0,_0xc81c9d){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x43e063},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x13f6('0x29')]['literal'](_0x13f6('0x51')+_0xa1106c+_0x13f6('0x52')),'$gt':db['sequelize']['literal'](_0x13f6('0x53'))}},'UserId':{'$in':_0x14b5e7}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x13f6('0x54'),'attributes':['id',_0x13f6('0x31'),_0x13f6('0x32')]},{'model':db[_0x13f6('0x55')],'as':_0x13f6('0x56')}]})['then'](function(_0x41b164){if(_0x41b164['length']>0x0){return db[_0x13f6('0x29')][_0x13f6('0x2a')](function(_0x182a4d){return db[_0x13f6('0x1b')]['update']({'recallmeNotifiedDate':db[_0x13f6('0x29')][_0x13f6('0x3f')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x41b164,'id')}},'transaction':_0x182a4d})[_0x13f6('0x1c')](function(){_0x544eb0(_0x41b164);})['catch'](function(_0x17ccd8){logger['error'](_0x13f6('0x4d'),_0x17ccd8[_0x13f6('0xe')],_0x177e65);_0xc81c9d(_0x24e8e0[_0x13f6('0xb')](0x1f4,_0x17ccd8[_0x13f6('0xe')]));});})[_0x13f6('0x11')](function(_0x13299c){logger['error'](_0x13f6('0x4d'),_0x13299c[_0x13f6('0xe')],_0x177e65);_0xc81c9d(_0x24e8e0[_0x13f6('0xb')](0x1f4,_0x13299c[_0x13f6('0xe')]));});}else{_0x544eb0(_0x41b164);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2ecd450..ee006a7 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 _0xf8d8=['/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe'];(function(_0x302e16,_0x4fa5c6){var _0x32380e=function(_0x2e86dc){while(--_0x2e86dc){_0x302e16['push'](_0x302e16['shift']());}};_0x32380e(++_0x4fa5c6);}(_0xf8d8,0xc7));var _0x8f8d=function(_0x88eed3,_0x1741d7){_0x88eed3=_0x88eed3-0x0;var _0xf8b3a6=_0xf8d8[_0x88eed3];return _0xf8b3a6;};'use strict';var express=require(_0x8f8d('0x0'));var router=express[_0x8f8d('0x1')]();var auth=require(_0x8f8d('0x2'));var controller=require(_0x8f8d('0x3'));router[_0x8f8d('0x4')]('/',auth[_0x8f8d('0x5')](),controller['index']);router[_0x8f8d('0x4')](_0x8f8d('0x6'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0x7')]);router['get'](_0x8f8d('0x8'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0x9')]);router[_0x8f8d('0x4')](_0x8f8d('0xa'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0xb')]);router[_0x8f8d('0x4')](_0x8f8d('0xc'),auth['isAuthenticated'](),controller[_0x8f8d('0xd')]);router[_0x8f8d('0x4')]('/:id/previewrecall',auth[_0x8f8d('0x5')](),controller['getPreviewRecall']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8f8d('0xe')](_0x8f8d('0xf'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0x10')]);router[_0x8f8d('0xe')](_0x8f8d('0x11'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0x12')]);router[_0x8f8d('0x13')](_0x8f8d('0xc'),auth['isAuthenticated'](),controller[_0x8f8d('0x14')]);router[_0x8f8d('0x15')](_0x8f8d('0xc'),auth[_0x8f8d('0x5')](),controller[_0x8f8d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xbf47=['express','Router','../../components/auth/service','get','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','put','/:id','delete','destroy'];(function(_0x28c3a3,_0x1cc488){var _0x5772fa=function(_0xd5659d){while(--_0xd5659d){_0x28c3a3['push'](_0x28c3a3['shift']());}};_0x5772fa(++_0x1cc488);}(_0xbf47,0x78));var _0x7bf4=function(_0x296cfb,_0x4e5c94){_0x296cfb=_0x296cfb-0x0;var _0x299c45=_0xbf47[_0x296cfb];return _0x299c45;};'use strict';var express=require(_0x7bf4('0x0'));var router=express[_0x7bf4('0x1')]();var auth=require(_0x7bf4('0x2'));var controller=require('./cmHopper.controller');router[_0x7bf4('0x3')]('/',auth[_0x7bf4('0x4')](),controller['index']);router[_0x7bf4('0x3')]('/describe',auth[_0x7bf4('0x4')](),controller['describe']);router[_0x7bf4('0x3')](_0x7bf4('0x5'),auth[_0x7bf4('0x4')](),controller[_0x7bf4('0x6')]);router[_0x7bf4('0x3')](_0x7bf4('0x7'),auth[_0x7bf4('0x4')](),controller[_0x7bf4('0x8')]);router['get']('/:id',auth[_0x7bf4('0x4')](),controller[_0x7bf4('0x9')]);router[_0x7bf4('0x3')](_0x7bf4('0xa'),auth[_0x7bf4('0x4')](),controller['getPreviewRecall']);router[_0x7bf4('0xb')]('/',auth[_0x7bf4('0x4')](),controller[_0x7bf4('0xc')]);router[_0x7bf4('0xb')](_0x7bf4('0xd'),auth[_0x7bf4('0x4')](),controller[_0x7bf4('0xe')]);router[_0x7bf4('0xb')](_0x7bf4('0xf'),auth[_0x7bf4('0x4')](),controller['getTimezone']);router[_0x7bf4('0x10')](_0x7bf4('0x11'),auth[_0x7bf4('0x4')](),controller['update']);router[_0x7bf4('0x12')](_0x7bf4('0x11'),auth[_0x7bf4('0x4')](),controller[_0x7bf4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 466ee4e..d15c72d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8769=['moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x5260ad,_0x1f4603){var _0x55c77e=function(_0x2a2b4b){while(--_0x2a2b4b){_0x5260ad['push'](_0x5260ad['shift']());}};_0x55c77e(++_0x1f4603);}(_0x8769,0x130));var _0x9876=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x8769[_0x26f702];return _0x11417d;};'use strict';var moment=require(_0x9876('0x0'));var Sequelize=require(_0x9876('0x1'));module[_0x9876('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x9876('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9876('0x4')],'defaultValue':moment()[_0x9876('0x5')](_0x9876('0x6'))},'countbusyretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9876('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7289=['DATE','format','moment','sequelize','exports','INTEGER','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x7289,0x18a));var _0x9728=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7289[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0x9728('0x0'));var Sequelize=require(_0x9728('0x1'));module[_0x9728('0x2')]={'CmHopperId':{'type':Sequelize[_0x9728('0x3')]},'phone':{'type':Sequelize[_0x9728('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9728('0x5')],'defaultValue':moment()[_0x9728('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9728('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index fc47b3b..2869d8d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5195=['sendStatus','stack','name','send','CmHopperAdditionalPhone','rawAttributes','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','user','get','role','CmHopperAdditionalPhones','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource'];(function(_0x1b7541,_0x222c38){var _0x2b8e5a=function(_0x43c1a9){while(--_0x43c1a9){_0x1b7541['push'](_0x1b7541['shift']());}};_0x2b8e5a(++_0x222c38);}(_0x5195,0x151));var _0x5519=function(_0x5a213a,_0x2b4a23){_0x5a213a=_0x5a213a-0x0;var _0x3577b3=_0x5195[_0x5a213a];return _0x3577b3;};'use strict';var emlformat=require(_0x5519('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5519('0x1'));var jsonpatch=require(_0x5519('0x2'));var rp=require(_0x5519('0x3'));var moment=require(_0x5519('0x4'));var BPromise=require(_0x5519('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5519('0x6'));var sox=require(_0x5519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5519('0x8'));var _=require(_0x5519('0x9'));var squel=require(_0x5519('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5519('0xb'));var toCsv=require(_0x5519('0xc'));var querystring=require(_0x5519('0xd'));var Papa=require(_0x5519('0xe'));var Redis=require('ioredis');var authService=require(_0x5519('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5519('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5519('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x168795,_0x2c3777){_0x2c3777=_0x2c3777||0xcc;return function(_0x16e948){if(_0x16e948){return _0x168795['sendStatus'](_0x2c3777);}return _0x168795['status'](_0x2c3777)[_0x5519('0x12')]();};}function respondWithResult(_0x1a5936,_0x4c28c1){_0x4c28c1=_0x4c28c1||0xc8;return function(_0x2e08a6){if(_0x2e08a6){return _0x1a5936[_0x5519('0x13')](_0x4c28c1)[_0x5519('0x14')](_0x2e08a6);}};}function respondWithFilteredResult(_0x42fce6,_0x25a8c0){return function(_0x1bb4f1){if(_0x1bb4f1){var _0x27ad7c=typeof _0x25a8c0[_0x5519('0x15')]===_0x5519('0x16')&&typeof _0x25a8c0[_0x5519('0x17')]===_0x5519('0x16');var _0x47c89d=_0x1bb4f1['count'];var _0x292f34=_0x27ad7c?0x0:_0x25a8c0['offset'];var _0xc399ab=_0x27ad7c?_0x1bb4f1[_0x5519('0x18')]:_0x25a8c0[_0x5519('0x15')]+_0x25a8c0['limit'];var _0x3a6f9f;if(_0xc399ab>=_0x47c89d){_0xc399ab=_0x47c89d;_0x3a6f9f=0xc8;}else{_0x3a6f9f=0xce;}_0x42fce6[_0x5519('0x13')](_0x3a6f9f);return _0x42fce6[_0x5519('0x19')](_0x5519('0x1a'),_0x292f34+'-'+_0xc399ab+'/'+_0x47c89d)[_0x5519('0x14')](_0x1bb4f1);}return null;};}function patchUpdates(_0x55761b){return function(_0x20bc5d){try{jsonpatch[_0x5519('0x1b')](_0x20bc5d,_0x55761b,!![]);}catch(_0x3e46b2){return BPromise[_0x5519('0x1c')](_0x3e46b2);}return _0x20bc5d[_0x5519('0x1d')]();};}function saveUpdates(_0x273d8c,_0x173f2e){return function(_0x5a651c){if(_0x5a651c){return _0x5a651c['update'](_0x273d8c)[_0x5519('0x1e')](function(_0x2f92e8){return _0x2f92e8;});}return null;};}function removeEntity(_0x768c71,_0x8e3bbd){return function(_0x38b1c1){if(_0x38b1c1){return _0x38b1c1[_0x5519('0x1f')]()[_0x5519('0x1e')](function(){var _0x1a7321=_0x38b1c1['get']({'plain':!![]});var _0x10f80f='CmHopperAdditionalPhones';return db[_0x5519('0x20')][_0x5519('0x1f')]({'where':{'type':_0x10f80f,'resourceId':_0x1a7321['id']}})[_0x5519('0x1e')](function(){return _0x38b1c1;});})[_0x5519('0x1e')](function(){_0x768c71[_0x5519('0x13')](0xcc)[_0x5519('0x12')]();});}};}function handleEntityNotFound(_0x31b25a,_0x30c218){return function(_0x256f4c){if(!_0x256f4c){_0x31b25a[_0x5519('0x21')](0x194);}return _0x256f4c;};}function handleError(_0x10b2e3,_0x420f20){_0x420f20=_0x420f20||0x1f4;return function(_0xa80ea4){logger['error'](_0xa80ea4[_0x5519('0x22')]);if(_0xa80ea4['name']){delete _0xa80ea4[_0x5519('0x23')];}_0x10b2e3[_0x5519('0x13')](_0x420f20)[_0x5519('0x24')](_0xa80ea4);};}exports['index']=function(_0x341348,_0x4c3349){var _0x18f85a={},_0x32833c={},_0x355df6={'count':0x0,'rows':[]};var _0x210441=_['map'](db[_0x5519('0x25')][_0x5519('0x26')],function(_0x5d9536){return{'name':_0x5d9536['fieldName'],'type':_0x5d9536['type'][_0x5519('0x27')]};});_0x32833c[_0x5519('0x28')]=_[_0x5519('0x29')](_0x210441,_0x5519('0x23'));_0x32833c['query']=_[_0x5519('0x2a')](_0x341348['query']);_0x32833c[_0x5519('0x2b')]=_[_0x5519('0x2c')](_0x32833c[_0x5519('0x28')],_0x32833c[_0x5519('0x2d')]);_0x18f85a[_0x5519('0x2e')]=_['intersection'](_0x32833c['model'],qs[_0x5519('0x2f')](_0x341348['query'][_0x5519('0x2f')]));_0x18f85a[_0x5519('0x2e')]=_0x18f85a[_0x5519('0x2e')][_0x5519('0x30')]?_0x18f85a['attributes']:_0x32833c['model'];if(!_0x341348[_0x5519('0x2d')][_0x5519('0x31')]('nolimit')){_0x18f85a[_0x5519('0x17')]=qs[_0x5519('0x17')](_0x341348[_0x5519('0x2d')]['limit']);_0x18f85a[_0x5519('0x15')]=qs['offset'](_0x341348[_0x5519('0x2d')]['offset']);}_0x18f85a['order']=qs[_0x5519('0x32')](_0x341348[_0x5519('0x2d')][_0x5519('0x32')]);_0x18f85a[_0x5519('0x33')]=qs['filters'](_[_0x5519('0x34')](_0x341348[_0x5519('0x2d')],_0x32833c[_0x5519('0x2b')]),_0x210441);if(_0x341348[_0x5519('0x2d')]['filter']){_0x18f85a['where']=_[_0x5519('0x35')](_0x18f85a[_0x5519('0x33')],{'$or':_[_0x5519('0x29')](_0x210441,function(_0x1c762e){if(_0x1c762e[_0x5519('0x36')]!==_0x5519('0x37')){var _0x200006={};_0x200006[_0x1c762e['name']]={'$like':'%'+_0x341348[_0x5519('0x2d')][_0x5519('0x38')]+'%'};return _0x200006;}})});}_0x18f85a=_[_0x5519('0x35')]({},_0x18f85a,_0x341348['options']);var _0x47fc9c={'where':_0x18f85a['where']};return db[_0x5519('0x25')]['count'](_0x47fc9c)['then'](function(_0x329bd1){_0x355df6[_0x5519('0x18')]=_0x329bd1;if(_0x341348['query'][_0x5519('0x39')]){_0x18f85a[_0x5519('0x3a')]=[{'all':!![]}];}return db[_0x5519('0x25')][_0x5519('0x3b')](_0x18f85a);})[_0x5519('0x1e')](function(_0xe64d33){_0x355df6[_0x5519('0x3c')]=_0xe64d33;return _0x355df6;})[_0x5519('0x1e')](respondWithFilteredResult(_0x4c3349,_0x18f85a))['catch'](handleError(_0x4c3349,null));};exports[_0x5519('0x3d')]=function(_0x371f0e,_0x501676){var _0x69ff7={'raw':!![],'where':{'id':_0x371f0e[_0x5519('0x3e')]['id']}},_0x37e25c={};_0x37e25c[_0x5519('0x28')]=_[_0x5519('0x2a')](db[_0x5519('0x25')][_0x5519('0x26')]);_0x37e25c[_0x5519('0x2d')]=_[_0x5519('0x2a')](_0x371f0e[_0x5519('0x2d')]);_0x37e25c['filters']=_['intersection'](_0x37e25c[_0x5519('0x28')],_0x37e25c[_0x5519('0x2d')]);_0x69ff7[_0x5519('0x2e')]=_[_0x5519('0x2c')](_0x37e25c[_0x5519('0x28')],qs[_0x5519('0x2f')](_0x371f0e[_0x5519('0x2d')][_0x5519('0x2f')]));_0x69ff7[_0x5519('0x2e')]=_0x69ff7[_0x5519('0x2e')][_0x5519('0x30')]?_0x69ff7[_0x5519('0x2e')]:_0x37e25c[_0x5519('0x28')];if(_0x371f0e['query'][_0x5519('0x39')]){_0x69ff7[_0x5519('0x3a')]=[{'all':!![]}];}_0x69ff7=_[_0x5519('0x35')]({},_0x69ff7,_0x371f0e[_0x5519('0x3f')]);return db[_0x5519('0x25')][_0x5519('0x40')](_0x69ff7)[_0x5519('0x1e')](handleEntityNotFound(_0x501676,null))[_0x5519('0x1e')](respondWithResult(_0x501676,null))[_0x5519('0x41')](handleError(_0x501676,null));};exports[_0x5519('0x42')]=function(_0xca684f,_0x1beeb3){return db[_0x5519('0x25')]['create'](_0xca684f['body'],{})[_0x5519('0x1e')](function(_0x22b60c){var _0x2c293f=_0xca684f[_0x5519('0x43')][_0x5519('0x44')]({'plain':!![]});if(!_0x2c293f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c293f[_0x5519('0x45')]===_0x5519('0x43')){var _0x11f1bc=_0x22b60c['get']({'plain':!![]});var _0x3ffff6=_0x5519('0x46');return db['UserProfileSection'][_0x5519('0x40')]({'where':{'name':_0x3ffff6,'userProfileId':_0x2c293f['userProfileId']},'raw':!![]})[_0x5519('0x1e')](function(_0x1591aa){if(_0x1591aa&&_0x1591aa['autoAssociation']===0x0){return db[_0x5519('0x20')]['create']({'name':_0x11f1bc[_0x5519('0x23')],'resourceId':_0x11f1bc['id'],'type':_0x1591aa['name'],'sectionId':_0x1591aa['id']},{})[_0x5519('0x1e')](function(){return _0x22b60c;});}else{return _0x22b60c;}})[_0x5519('0x41')](function(_0x20af9b){logger['error'](_0x5519('0x47'),_0x20af9b);throw _0x20af9b;});}return _0x22b60c;})[_0x5519('0x1e')](respondWithResult(_0x1beeb3,0xc9))[_0x5519('0x41')](handleError(_0x1beeb3,null));};exports[_0x5519('0x48')]=function(_0x1a9102,_0x17915b){if(_0x1a9102[_0x5519('0x49')]['id']){delete _0x1a9102[_0x5519('0x49')]['id'];}return db[_0x5519('0x25')][_0x5519('0x40')]({'where':{'id':_0x1a9102[_0x5519('0x3e')]['id']}})[_0x5519('0x1e')](handleEntityNotFound(_0x17915b,null))[_0x5519('0x1e')](saveUpdates(_0x1a9102[_0x5519('0x49')],null))[_0x5519('0x1e')](respondWithResult(_0x17915b,null))[_0x5519('0x41')](handleError(_0x17915b,null));};exports[_0x5519('0x1f')]=function(_0x29a2ad,_0x571322){return db[_0x5519('0x25')][_0x5519('0x40')]({'where':{'id':_0x29a2ad[_0x5519('0x3e')]['id']}})['then'](handleEntityNotFound(_0x571322,null))[_0x5519('0x1e')](removeEntity(_0x571322,null))[_0x5519('0x41')](handleError(_0x571322,null));}; \ No newline at end of file +var _0x36d2=['findAll','rows','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperAdditionalPhone','include'];(function(_0x59385f,_0x218c19){var _0x3502df=function(_0x80e493){while(--_0x80e493){_0x59385f['push'](_0x59385f['shift']());}};_0x3502df(++_0x218c19);}(_0x36d2,0xb5));var _0x236d=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x36d2[_0x2b55b5];return _0x103d28;};'use strict';var emlformat=require(_0x236d('0x0'));var rimraf=require(_0x236d('0x1'));var zipdir=require(_0x236d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x236d('0x3'));var moment=require(_0x236d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x236d('0x5'));var util=require(_0x236d('0x6'));var path=require(_0x236d('0x7'));var sox=require(_0x236d('0x8'));var csv=require(_0x236d('0x9'));var ejs=require(_0x236d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x236d('0xb'));var squel=require(_0x236d('0xc'));var crypto=require(_0x236d('0xd'));var jsforce=require(_0x236d('0xe'));var deskjs=require(_0x236d('0xf'));var toCsv=require(_0x236d('0x9'));var querystring=require(_0x236d('0x10'));var Papa=require(_0x236d('0x11'));var Redis=require(_0x236d('0x12'));var authService=require(_0x236d('0x13'));var qs=require(_0x236d('0x14'));var as=require(_0x236d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x236d('0x16'))(_0x236d('0x17'));var utils=require(_0x236d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x236d('0x19'))['db'];function respondWithStatusCode(_0x988865,_0x1c28ce){_0x1c28ce=_0x1c28ce||0xcc;return function(_0x3a03e0){if(_0x3a03e0){return _0x988865['sendStatus'](_0x1c28ce);}return _0x988865[_0x236d('0x1a')](_0x1c28ce)[_0x236d('0x1b')]();};}function respondWithResult(_0x30868d,_0x138dd1){_0x138dd1=_0x138dd1||0xc8;return function(_0x4e9691){if(_0x4e9691){return _0x30868d[_0x236d('0x1a')](_0x138dd1)[_0x236d('0x1c')](_0x4e9691);}};}function respondWithFilteredResult(_0xbd3d5,_0xceddf7){return function(_0x3ce8a7){if(_0x3ce8a7){var _0x5a1a49=typeof _0xceddf7[_0x236d('0x1d')]===_0x236d('0x1e')&&typeof _0xceddf7['limit']===_0x236d('0x1e');var _0x56cea0=_0x3ce8a7['count'];var _0x23f6ef=_0x5a1a49?0x0:_0xceddf7[_0x236d('0x1d')];var _0x52d276=_0x5a1a49?_0x3ce8a7[_0x236d('0x1f')]:_0xceddf7[_0x236d('0x1d')]+_0xceddf7['limit'];var _0x165342;if(_0x52d276>=_0x56cea0){_0x52d276=_0x56cea0;_0x165342=0xc8;}else{_0x165342=0xce;}_0xbd3d5[_0x236d('0x1a')](_0x165342);return _0xbd3d5[_0x236d('0x20')](_0x236d('0x21'),_0x23f6ef+'-'+_0x52d276+'/'+_0x56cea0)[_0x236d('0x1c')](_0x3ce8a7);}return null;};}function patchUpdates(_0x3df4cd){return function(_0x4c2f8b){try{jsonpatch[_0x236d('0x22')](_0x4c2f8b,_0x3df4cd,!![]);}catch(_0x416704){return BPromise[_0x236d('0x23')](_0x416704);}return _0x4c2f8b['save']();};}function saveUpdates(_0x15fb15,_0x1def77){return function(_0x251dc8){if(_0x251dc8){return _0x251dc8[_0x236d('0x24')](_0x15fb15)[_0x236d('0x25')](function(_0x353d17){return _0x353d17;});}return null;};}function removeEntity(_0x28b766,_0x42c295){return function(_0x261a3f){if(_0x261a3f){return _0x261a3f[_0x236d('0x26')]()[_0x236d('0x25')](function(){var _0x344ff2=_0x261a3f['get']({'plain':!![]});var _0x473eb8=_0x236d('0x27');return db[_0x236d('0x28')][_0x236d('0x26')]({'where':{'type':_0x473eb8,'resourceId':_0x344ff2['id']}})['then'](function(){return _0x261a3f;});})[_0x236d('0x25')](function(){_0x28b766[_0x236d('0x1a')](0xcc)[_0x236d('0x1b')]();});}};}function handleEntityNotFound(_0x441aa7,_0x2a1636){return function(_0x2445a7){if(!_0x2445a7){_0x441aa7[_0x236d('0x29')](0x194);}return _0x2445a7;};}function handleError(_0x58e5c6,_0x173d14){_0x173d14=_0x173d14||0x1f4;return function(_0x8088b0){logger[_0x236d('0x2a')](_0x8088b0[_0x236d('0x2b')]);if(_0x8088b0[_0x236d('0x2c')]){delete _0x8088b0[_0x236d('0x2c')];}_0x58e5c6[_0x236d('0x1a')](_0x173d14)[_0x236d('0x2d')](_0x8088b0);};}exports[_0x236d('0x2e')]=function(_0x3c89fa,_0x367fb4){var _0x35c302={},_0x15a3ae={},_0x317596={'count':0x0,'rows':[]};var _0x37b930=_['map'](db['CmHopperAdditionalPhone'][_0x236d('0x2f')],function(_0x32d873){return{'name':_0x32d873[_0x236d('0x30')],'type':_0x32d873[_0x236d('0x31')][_0x236d('0x32')]};});_0x15a3ae['model']=_[_0x236d('0x33')](_0x37b930,_0x236d('0x2c'));_0x15a3ae['query']=_[_0x236d('0x34')](_0x3c89fa['query']);_0x15a3ae[_0x236d('0x35')]=_[_0x236d('0x36')](_0x15a3ae[_0x236d('0x37')],_0x15a3ae[_0x236d('0x38')]);_0x35c302[_0x236d('0x39')]=_['intersection'](_0x15a3ae[_0x236d('0x37')],qs['fields'](_0x3c89fa['query'][_0x236d('0x3a')]));_0x35c302[_0x236d('0x39')]=_0x35c302['attributes'][_0x236d('0x3b')]?_0x35c302[_0x236d('0x39')]:_0x15a3ae[_0x236d('0x37')];if(!_0x3c89fa[_0x236d('0x38')][_0x236d('0x3c')]('nolimit')){_0x35c302['limit']=qs['limit'](_0x3c89fa[_0x236d('0x38')]['limit']);_0x35c302[_0x236d('0x1d')]=qs[_0x236d('0x1d')](_0x3c89fa[_0x236d('0x38')][_0x236d('0x1d')]);}_0x35c302[_0x236d('0x3d')]=qs[_0x236d('0x3e')](_0x3c89fa[_0x236d('0x38')][_0x236d('0x3e')]);_0x35c302[_0x236d('0x3f')]=qs[_0x236d('0x35')](_[_0x236d('0x40')](_0x3c89fa[_0x236d('0x38')],_0x15a3ae['filters']),_0x37b930);if(_0x3c89fa['query']['filter']){_0x35c302[_0x236d('0x3f')]=_[_0x236d('0x41')](_0x35c302[_0x236d('0x3f')],{'$or':_[_0x236d('0x33')](_0x37b930,function(_0x312c05){if(_0x312c05['type']!==_0x236d('0x42')){var _0x49aa0f={};_0x49aa0f[_0x312c05[_0x236d('0x2c')]]={'$like':'%'+_0x3c89fa['query'][_0x236d('0x43')]+'%'};return _0x49aa0f;}})});}_0x35c302=_[_0x236d('0x41')]({},_0x35c302,_0x3c89fa[_0x236d('0x44')]);var _0x194888={'where':_0x35c302[_0x236d('0x3f')]};return db[_0x236d('0x45')][_0x236d('0x1f')](_0x194888)[_0x236d('0x25')](function(_0xc3705c){_0x317596[_0x236d('0x1f')]=_0xc3705c;if(_0x3c89fa['query']['includeAll']){_0x35c302[_0x236d('0x46')]=[{'all':!![]}];}return db[_0x236d('0x45')][_0x236d('0x47')](_0x35c302);})[_0x236d('0x25')](function(_0x5cd5da){_0x317596[_0x236d('0x48')]=_0x5cd5da;return _0x317596;})[_0x236d('0x25')](respondWithFilteredResult(_0x367fb4,_0x35c302))['catch'](handleError(_0x367fb4,null));};exports['show']=function(_0x3f75d4,_0x34bbdd){var _0x405b88={'raw':!![],'where':{'id':_0x3f75d4[_0x236d('0x49')]['id']}},_0x6e549={};_0x6e549['model']=_['keys'](db['CmHopperAdditionalPhone'][_0x236d('0x2f')]);_0x6e549[_0x236d('0x38')]=_[_0x236d('0x34')](_0x3f75d4['query']);_0x6e549[_0x236d('0x35')]=_[_0x236d('0x36')](_0x6e549[_0x236d('0x37')],_0x6e549['query']);_0x405b88[_0x236d('0x39')]=_[_0x236d('0x36')](_0x6e549['model'],qs['fields'](_0x3f75d4['query']['fields']));_0x405b88[_0x236d('0x39')]=_0x405b88[_0x236d('0x39')]['length']?_0x405b88[_0x236d('0x39')]:_0x6e549[_0x236d('0x37')];if(_0x3f75d4['query'][_0x236d('0x4a')]){_0x405b88[_0x236d('0x46')]=[{'all':!![]}];}_0x405b88=_[_0x236d('0x41')]({},_0x405b88,_0x3f75d4[_0x236d('0x44')]);return db[_0x236d('0x45')][_0x236d('0x4b')](_0x405b88)['then'](handleEntityNotFound(_0x34bbdd,null))[_0x236d('0x25')](respondWithResult(_0x34bbdd,null))[_0x236d('0x4c')](handleError(_0x34bbdd,null));};exports[_0x236d('0x4d')]=function(_0x4aa6a8,_0x418925){return db[_0x236d('0x45')][_0x236d('0x4d')](_0x4aa6a8[_0x236d('0x4e')],{})[_0x236d('0x25')](function(_0x998c8c){var _0x6f176d=_0x4aa6a8[_0x236d('0x4f')][_0x236d('0x50')]({'plain':!![]});if(!_0x6f176d)throw new Error(_0x236d('0x51'));if(_0x6f176d['role']==='user'){var _0x2805b0=_0x998c8c[_0x236d('0x50')]({'plain':!![]});var _0x5088d2=_0x236d('0x27');return db[_0x236d('0x52')][_0x236d('0x4b')]({'where':{'name':_0x5088d2,'userProfileId':_0x6f176d[_0x236d('0x53')]},'raw':!![]})[_0x236d('0x25')](function(_0x4d7dbd){if(_0x4d7dbd&&_0x4d7dbd['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2805b0[_0x236d('0x2c')],'resourceId':_0x2805b0['id'],'type':_0x4d7dbd['name'],'sectionId':_0x4d7dbd['id']},{})[_0x236d('0x25')](function(){return _0x998c8c;});}else{return _0x998c8c;}})['catch'](function(_0x557493){logger[_0x236d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557493);throw _0x557493;});}return _0x998c8c;})[_0x236d('0x25')](respondWithResult(_0x418925,0xc9))[_0x236d('0x4c')](handleError(_0x418925,null));};exports[_0x236d('0x24')]=function(_0x3d82e6,_0x4ad5e2){if(_0x3d82e6['body']['id']){delete _0x3d82e6[_0x236d('0x4e')]['id'];}return db[_0x236d('0x45')][_0x236d('0x4b')]({'where':{'id':_0x3d82e6['params']['id']}})[_0x236d('0x25')](handleEntityNotFound(_0x4ad5e2,null))[_0x236d('0x25')](saveUpdates(_0x3d82e6[_0x236d('0x4e')],null))['then'](respondWithResult(_0x4ad5e2,null))[_0x236d('0x4c')](handleError(_0x4ad5e2,null));};exports[_0x236d('0x26')]=function(_0x3f72d2,_0x2d4af3){return db[_0x236d('0x45')]['find']({'where':{'id':_0x3f72d2[_0x236d('0x49')]['id']}})[_0x236d('0x25')](handleEntityNotFound(_0x2d4af3,null))[_0x236d('0x25')](removeEntity(_0x2d4af3,null))[_0x236d('0x4c')](handleError(_0x2d4af3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 9a16f78..6d140c9 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30e2=['api','moment','request-promise','path','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','util'];(function(_0x2858f6,_0x4eefba){var _0x80e9e5=function(_0xa5937f){while(--_0xa5937f){_0x2858f6['push'](_0x2858f6['shift']());}};_0x80e9e5(++_0x4eefba);}(_0x30e2,0x6f));var _0x230e=function(_0x55ef8c,_0x44f66c){_0x55ef8c=_0x55ef8c-0x0;var _0x39d9b0=_0x30e2[_0x55ef8c];return _0x39d9b0;};'use strict';var _=require('lodash');var util=require(_0x230e('0x0'));var logger=require('../../config/logger')(_0x230e('0x1'));var moment=require(_0x230e('0x2'));var BPromise=require('bluebird');var rp=require(_0x230e('0x3'));var fs=require('fs');var path=require(_0x230e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x230e('0x5'));module[_0x230e('0x6')]=function(_0x3febd4,_0xf9b5e1){return _0x3febd4['define'](_0x230e('0x7'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf85=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x2fe5f0,_0x3a5878){var _0x5180da=function(_0x55ea68){while(--_0x55ea68){_0x2fe5f0['push'](_0x2fe5f0['shift']());}};_0x5180da(++_0x3a5878);}(_0xdf85,0x12c));var _0x5df8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xdf85[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0x5df8('0x0'));var logger=require('../../config/logger')(_0x5df8('0x1'));var moment=require(_0x5df8('0x2'));var BPromise=require(_0x5df8('0x3'));var rp=require(_0x5df8('0x4'));var fs=require('fs');var path=require(_0x5df8('0x5'));var rimraf=require(_0x5df8('0x6'));var config=require(_0x5df8('0x7'));var attributes=require(_0x5df8('0x8'));module[_0x5df8('0x9')]=function(_0x3a8360,_0x3fc756){return _0x3a8360['define'](_0x5df8('0xa'),attributes,{'tableName':_0x5df8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 106f039..383542c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3854=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countnoanswerretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','countmachineretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring'];(function(_0x86c18f,_0x541256){var _0x28dd92=function(_0x10c10d){while(--_0x10c10d){_0x86c18f['push'](_0x86c18f['shift']());}};_0x28dd92(++_0x541256);}(_0x3854,0x184));var _0x4385=function(_0x43c4f7,_0x362d33){_0x43c4f7=_0x43c4f7-0x0;var _0x376c42=_0x3854[_0x43c4f7];return _0x376c42;};'use strict';var _=require('lodash');var util=require(_0x4385('0x0'));var moment=require(_0x4385('0x1'));var BPromise=require(_0x4385('0x2'));var rs=require(_0x4385('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4385('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4385('0x5'))(_0x4385('0x6'));var config=require(_0x4385('0x7'));var jayson=require(_0x4385('0x8'));var client=jayson['client'][_0x4385('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f49f8,_0x54db25,_0xc693a){return new BPromise(function(_0x4e9304,_0x198d3b){return client['request'](_0x3f49f8,_0xc693a)[_0x4385('0xa')](function(_0x23a34f){logger[_0x4385('0xb')](_0x4385('0xc'),_0x54db25,'request\x20sent');logger['debug'](_0x4385('0xd'),_0x54db25,'request\x20sent',JSON[_0x4385('0xe')](_0x23a34f));if(_0x23a34f['error']){if(_0x23a34f['error']['code']===0x1f4){logger[_0x4385('0xf')](_0x4385('0xc'),_0x54db25,_0x23a34f[_0x4385('0xf')][_0x4385('0x10')]);return _0x198d3b(_0x23a34f['error'][_0x4385('0x10')]);}logger[_0x4385('0xf')](_0x4385('0xc'),_0x54db25,_0x23a34f[_0x4385('0xf')][_0x4385('0x10')]);return _0x4e9304(_0x23a34f['error']['message']);}else{logger['info'](_0x4385('0xc'),_0x54db25,_0x4385('0x11'));_0x4e9304(_0x23a34f[_0x4385('0x12')]['message']);}})[_0x4385('0x13')](function(_0x44e114){logger[_0x4385('0xf')](_0x4385('0xc'),_0x54db25,_0x44e114);_0x198d3b(_0x44e114);});});}exports[_0x4385('0x14')]=function(_0x19b72b){var _0x185478=this;return new Promise(function(_0x10bdb5,_0x2c0742){return db[_0x4385('0x15')][_0x4385('0x16')]({'raw':!![],'where':{'ContactId':_0x19b72b[_0x4385('0x17')]['ContactId'],'ListId':_0x19b72b[_0x4385('0x17')][_0x4385('0x18')],'VoiceQueueId':_0x19b72b[_0x4385('0x17')][_0x4385('0x19')]===undefined?null:_0x19b72b[_0x4385('0x17')]['VoiceQueueId'],'CampaignId':_0x19b72b['body'][_0x4385('0x1a')]===undefined?null:_0x19b72b[_0x4385('0x17')][_0x4385('0x1a')]}})['then'](function(_0x21e201){if(_0x21e201!=null){return db[_0x4385('0x1b')][_0x4385('0x16')]({'raw':!![],'where':{'CmHopperId':_0x21e201['id'],'OrderBy':{'$gt':_0x21e201[_0x4385('0x1c')]}},'order':[['OrderBy','ASC']]})[_0x4385('0xa')](function(_0x5e2766){var _0x31ebaf=0x0;if(_0x5e2766){if(_0x5e2766[_0x4385('0x1d')]+_0x5e2766[_0x4385('0x1e')]+_0x5e2766['countnoanswerretry']+_0x5e2766[_0x4385('0x1f')]+_0x5e2766[_0x4385('0x20')]+_0x5e2766[_0x4385('0x21')]+_0x5e2766['countmachineretry']+_0x5e2766[_0x4385('0x22')]<_0x19b72b[_0x4385('0x23')][_0x4385('0x24')])_0x31ebaf=0x1;_0x10bdb5({'additional':_0x31ebaf});}else{return db[_0x4385('0x1b')][_0x4385('0x16')]({'raw':!![],'where':{'CmHopperId':_0x21e201['id']},'order':[[_0x4385('0x1c'),_0x4385('0x25')]]})[_0x4385('0xa')](function(_0x470e82){var _0x57688c=0x0;if(_0x470e82){if(_0x470e82[_0x4385('0x1d')]+_0x470e82[_0x4385('0x1e')]+_0x470e82[_0x4385('0x26')]+_0x470e82[_0x4385('0x1f')]+_0x470e82[_0x4385('0x20')]+_0x470e82[_0x4385('0x21')]+_0x470e82['countmachineretry']+_0x470e82['countagentrejectretry']<_0x19b72b[_0x4385('0x23')][_0x4385('0x24')])_0x57688c=0x1;_0x10bdb5({'additional':_0x57688c});}else{_0x10bdb5({'additional':0x0});}})[_0x4385('0x13')](function(_0x1de652){logger['error']('VerifyAdditionalPhones',_0x1de652[_0x4385('0x10')]);_0x2c0742(_0x185478[_0x4385('0xf')](0x1f4,_0x1de652[_0x4385('0x10')]));});}})[_0x4385('0x13')](function(_0x5e2047){logger[_0x4385('0xf')](_0x4385('0x14'),_0x5e2047[_0x4385('0x10')]);_0x2c0742(_0x185478['error'](0x1f4,_0x5e2047[_0x4385('0x10')]));});}else _0x10bdb5({'additional':0x0});});});};exports[_0x4385('0x27')]=function(_0x2c285e){var _0x4126ca=this;return new Promise(function(_0x3d3dcd,_0x2f3c78){return db['CmHopper'][_0x4385('0x16')]({'raw':!![],'where':{'ContactId':_0x2c285e[_0x4385('0x17')]['ContactId'],'ListId':_0x2c285e[_0x4385('0x17')]['ListId'],'VoiceQueueId':_0x2c285e[_0x4385('0x17')][_0x4385('0x19')]===undefined?null:_0x2c285e[_0x4385('0x17')][_0x4385('0x19')],'CampaignId':_0x2c285e[_0x4385('0x17')][_0x4385('0x1a')]===undefined?null:_0x2c285e[_0x4385('0x17')][_0x4385('0x1a')]}})[_0x4385('0xa')](function(_0x1ab587){if(_0x1ab587!=null){return db[_0x4385('0x1b')][_0x4385('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1ab587['id'],'OrderBy':{'$gte':_0x1ab587['OrderBy']}},'order':[[_0x4385('0x1c'),_0x4385('0x25')]]})[_0x4385('0xa')](function(_0x20a473){if(_0x20a473)return activateAdditionalPhone(_0x1ab587,_0x2c285e['body'],_0x20a473,_0x2c285e[_0x4385('0x28')],_0x2c285e[_0x4385('0x29')])[_0x4385('0xa')](function(_0x4eee2a){_0x3d3dcd(_0x4eee2a);});else{return db[_0x4385('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1ab587['id']},'order':[[_0x4385('0x1c'),_0x4385('0x25')]]})[_0x4385('0xa')](function(_0x61b1fe){if(_0x61b1fe)return activateAdditionalPhone(_0x1ab587,_0x2c285e[_0x4385('0x17')],_0x61b1fe,_0x2c285e[_0x4385('0x28')],_0x2c285e[_0x4385('0x29')])['then'](function(_0x5ae82b){_0x3d3dcd(_0x5ae82b);});else{_0x3d3dcd({'id':_0x1ab587['id'],'phone':''});}})[_0x4385('0x13')](function(_0x8e5575){logger[_0x4385('0xf')](_0x4385('0x14'),_0x8e5575[_0x4385('0x10')]);_0x2f3c78(_0x4126ca['error'](0x1f4,_0x8e5575[_0x4385('0x10')]));});}})['catch'](function(_0x5bd6a7){logger[_0x4385('0xf')](_0x4385('0x14'),_0x5bd6a7[_0x4385('0x10')]);_0x2f3c78(_0x4126ca[_0x4385('0xf')](0x1f4,_0x5bd6a7[_0x4385('0x10')]));});}else _0x3d3dcd(0x1);});});};function activateAdditionalPhone(_0x2a4ace,_0x420971,_0xfaa024,_0x2189e2,_0x52377e){return new Promise(function(_0x23b881,_0xadb7ba){var _0x5a3d6e;if(_['isNil'](_0xfaa024['scheduledat'])){_0xfaa024[_0x4385('0x2a')]=moment();}if(moment()>moment(_0xfaa024[_0x4385('0x2a')])){_0x5a3d6e=moment()['add'](_0x52377e||0x3,_0x4385('0x2b'));}else{if(_0xfaa024[_0x4385('0x1c')]==0x0){_0x5a3d6e=moment(_0xfaa024[_0x4385('0x2a')]);}else{_0x5a3d6e=moment()[_0x4385('0x2c')](_0x52377e||0x3,_0x4385('0x2b'));}}if(_['isNil'](_0x5a3d6e)){_0x5a3d6e=moment()[_0x4385('0x2c')](_0x52377e||0x3,'minutes');}var _0x3fdc0b={'phone':_0x2a4ace[_0x4385('0x2d')],'active':0x0,'OrderBy':_[_0x4385('0x2e')](_0x2a4ace[_0x4385('0x1c')])?0x0:_0x2a4ace[_0x4385('0x1c')],'scheduledat':moment()[_0x4385('0x2c')](_0x2189e2||0x1,_0x4385('0x2b')),'countbusyretry':_0x420971['countbusyretry'],'countcongestionretry':_0x420971[_0x4385('0x1e')],'countnoanswerretry':_0x420971[_0x4385('0x26')],'countnosuchnumberretry':_0x420971[_0x4385('0x1f')],'countdropretry':_0x420971['countdropretry'],'countabandonedretry':_0x420971['countabandonedretry'],'countmachineretry':_0x420971[_0x4385('0x2f')],'countagentrejectretry':_0x420971['countagentrejectretry'],'createdAt':_0x420971[_0x4385('0x30')],'updatedAt':_0x420971[_0x4385('0x31')]};var _0x15fd92={'CmHopperId':_0x2a4ace['id'],'phone':_0xfaa024['phone'],'active':0x0,'OrderBy':_['isNil'](_0xfaa024['OrderBy'])?0x0:_0xfaa024[_0x4385('0x1c')],'scheduledat':_0x5a3d6e,'countbusyretry':_0xfaa024[_0x4385('0x1d')],'countcongestionretry':_0xfaa024['countcongestionretry'],'countnoanswerretry':_0xfaa024['countnoanswerretry'],'countnosuchnumberretry':_0xfaa024['countnosuchnumberretry'],'countdropretry':_0xfaa024[_0x4385('0x20')],'countabandonedretry':_0xfaa024[_0x4385('0x21')],'countmachineretry':_0xfaa024[_0x4385('0x2f')],'countagentrejectretry':_0xfaa024[_0x4385('0x22')],'createdAt':_0xfaa024[_0x4385('0x30')],'updatedAt':_0xfaa024[_0x4385('0x31')]};return db[_0x4385('0x32')][_0x4385('0x33')](function(_0x25093d){return db[_0x4385('0x1b')][_0x4385('0x34')](_0x3fdc0b,{'where':{'id':_0xfaa024['id']}},{'transaction':_0x25093d})[_0x4385('0xa')](function(){return db['CmHopper'][_0x4385('0x34')](_0x15fd92,{'where':{'id':_0x2a4ace['id']}},{'transaction':_0x25093d});});})['then'](function(_0x4082ad){_0x23b881({'id':_0x2a4ace['id'],'phone':_0xfaa024[_0x4385('0x2d')]});})['catch'](function(_0x48cd5d){logger[_0x4385('0xf')](_0x4385('0x35'),_0x48cd5d['message']);_0xadb7ba({'error':_0x48cd5d['message']});});});}exports[_0x4385('0x36')]=function(_0xcae7b7){var _0x58a70c=this;return new Promise(function(_0x903ab2,_0x1d0643){return db[_0x4385('0x15')]['update'](_0xcae7b7[_0x4385('0x17')][_0x4385('0x37')],{'where':{'id':_0xcae7b7[_0x4385('0x17')]['id']}})[_0x4385('0xa')](function(_0x2647d5){_0x903ab2(_0x2647d5);})[_0x4385('0x13')](function(_0x3b7975){logger[_0x4385('0xf')]('IncrementPreviewCounters',_0x3b7975['message']);_0x1d0643(_0x58a70c[_0x4385('0xf')](0x1f4,_0x3b7975['message']));});});}; \ No newline at end of file +var _0xd12d=['CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','field','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId'];(function(_0x5baae7,_0x5eeefb){var _0xac19c3=function(_0x32e658){while(--_0x32e658){_0x5baae7['push'](_0x5baae7['shift']());}};_0xac19c3(++_0x5eeefb);}(_0xd12d,0xf8));var _0xdd12=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd12d[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd12('0x0'));var BPromise=require('bluebird');var rs=require(_0xdd12('0x1'));var fs=require('fs');var Redis=require(_0xdd12('0x2'));var db=require(_0xdd12('0x3'))['db'];var utils=require(_0xdd12('0x4'));var logger=require(_0xdd12('0x5'))('rpc');var config=require(_0xdd12('0x6'));var jayson=require(_0xdd12('0x7'));var client=jayson[_0xdd12('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c7530,_0x3a9670,_0x3f018b){return new BPromise(function(_0x15bf27,_0x1fd452){return client[_0xdd12('0x9')](_0x5c7530,_0x3f018b)['then'](function(_0x5dfa33){logger[_0xdd12('0xa')](_0xdd12('0xb'),_0x3a9670,'request\x20sent');logger[_0xdd12('0xc')](_0xdd12('0xd'),_0x3a9670,_0xdd12('0xe'),JSON[_0xdd12('0xf')](_0x5dfa33));if(_0x5dfa33[_0xdd12('0x10')]){if(_0x5dfa33['error'][_0xdd12('0x11')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3a9670,_0x5dfa33['error'][_0xdd12('0x12')]);return _0x1fd452(_0x5dfa33[_0xdd12('0x10')][_0xdd12('0x12')]);}logger[_0xdd12('0x10')](_0xdd12('0xb'),_0x3a9670,_0x5dfa33[_0xdd12('0x10')][_0xdd12('0x12')]);return _0x15bf27(_0x5dfa33[_0xdd12('0x10')][_0xdd12('0x12')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3a9670,_0xdd12('0xe'));_0x15bf27(_0x5dfa33[_0xdd12('0x13')]['message']);}})[_0xdd12('0x14')](function(_0x694a13){logger[_0xdd12('0x10')](_0xdd12('0xb'),_0x3a9670,_0x694a13);_0x1fd452(_0x694a13);});});}exports[_0xdd12('0x15')]=function(_0x253e2b){var _0x25bd96=this;return new Promise(function(_0x440469,_0x24c244){return db['CmHopper'][_0xdd12('0x16')]({'raw':!![],'where':{'ContactId':_0x253e2b[_0xdd12('0x17')][_0xdd12('0x18')],'ListId':_0x253e2b[_0xdd12('0x17')][_0xdd12('0x19')],'VoiceQueueId':_0x253e2b[_0xdd12('0x17')]['VoiceQueueId']===undefined?null:_0x253e2b[_0xdd12('0x17')][_0xdd12('0x1a')],'CampaignId':_0x253e2b[_0xdd12('0x17')][_0xdd12('0x1b')]===undefined?null:_0x253e2b[_0xdd12('0x17')][_0xdd12('0x1b')]}})['then'](function(_0x2a8f9d){if(_0x2a8f9d!=null){return db[_0xdd12('0x1c')][_0xdd12('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a8f9d['id'],'OrderBy':{'$gt':_0x2a8f9d[_0xdd12('0x1d')]}},'order':[[_0xdd12('0x1d'),_0xdd12('0x1e')]]})[_0xdd12('0x1f')](function(_0x29c300){var _0x496c28=0x0;if(_0x29c300){if(_0x29c300[_0xdd12('0x20')]+_0x29c300[_0xdd12('0x21')]+_0x29c300[_0xdd12('0x22')]+_0x29c300[_0xdd12('0x23')]+_0x29c300[_0xdd12('0x24')]+_0x29c300[_0xdd12('0x25')]+_0x29c300[_0xdd12('0x26')]+_0x29c300['countagentrejectretry']<_0x253e2b[_0xdd12('0x27')][_0xdd12('0x28')])_0x496c28=0x1;_0x440469({'additional':_0x496c28});}else{return db[_0xdd12('0x1c')][_0xdd12('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a8f9d['id']},'order':[[_0xdd12('0x1d'),'ASC']]})['then'](function(_0xa4cb2a){var _0x4cd4f5=0x0;if(_0xa4cb2a){if(_0xa4cb2a[_0xdd12('0x20')]+_0xa4cb2a[_0xdd12('0x21')]+_0xa4cb2a['countnoanswerretry']+_0xa4cb2a['countnosuchnumberretry']+_0xa4cb2a[_0xdd12('0x24')]+_0xa4cb2a['countabandonedretry']+_0xa4cb2a[_0xdd12('0x26')]+_0xa4cb2a['countagentrejectretry']<_0x253e2b[_0xdd12('0x27')]['dialGlobalMaxRetry'])_0x4cd4f5=0x1;_0x440469({'additional':_0x4cd4f5});}else{_0x440469({'additional':0x0});}})['catch'](function(_0x22caa3){logger[_0xdd12('0x10')](_0xdd12('0x15'),_0x22caa3['message']);_0x24c244(_0x25bd96[_0xdd12('0x10')](0x1f4,_0x22caa3[_0xdd12('0x12')]));});}})[_0xdd12('0x14')](function(_0x5b0ecb){logger[_0xdd12('0x10')](_0xdd12('0x15'),_0x5b0ecb[_0xdd12('0x12')]);_0x24c244(_0x25bd96['error'](0x1f4,_0x5b0ecb[_0xdd12('0x12')]));});}else _0x440469({'additional':0x0});});});};exports[_0xdd12('0x29')]=function(_0x44c974){var _0x15cb96=this;return new Promise(function(_0x1fe54a,_0x3e5005){return db[_0xdd12('0x2a')]['findOne']({'raw':!![],'where':{'ContactId':_0x44c974[_0xdd12('0x17')][_0xdd12('0x18')],'ListId':_0x44c974[_0xdd12('0x17')][_0xdd12('0x19')],'VoiceQueueId':_0x44c974[_0xdd12('0x17')][_0xdd12('0x1a')]===undefined?null:_0x44c974[_0xdd12('0x17')][_0xdd12('0x1a')],'CampaignId':_0x44c974[_0xdd12('0x17')][_0xdd12('0x1b')]===undefined?null:_0x44c974[_0xdd12('0x17')][_0xdd12('0x1b')]}})[_0xdd12('0x1f')](function(_0x2b2f7f){if(_0x2b2f7f!=null){return db['CmHopperAdditionalPhone'][_0xdd12('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2b2f7f['id'],'OrderBy':{'$gte':_0x2b2f7f['OrderBy']}},'order':[[_0xdd12('0x1d'),'ASC']]})[_0xdd12('0x1f')](function(_0x195a08){if(_0x195a08)return activateAdditionalPhone(_0x2b2f7f,_0x44c974[_0xdd12('0x17')],_0x195a08,_0x44c974[_0xdd12('0x2b')],_0x44c974[_0xdd12('0x2c')])[_0xdd12('0x1f')](function(_0x51f8ef){_0x1fe54a(_0x51f8ef);});else{return db[_0xdd12('0x1c')][_0xdd12('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2b2f7f['id']},'order':[[_0xdd12('0x1d'),_0xdd12('0x1e')]]})[_0xdd12('0x1f')](function(_0x1a64d6){if(_0x1a64d6)return activateAdditionalPhone(_0x2b2f7f,_0x44c974[_0xdd12('0x17')],_0x1a64d6,_0x44c974[_0xdd12('0x2b')],_0x44c974[_0xdd12('0x2c')])['then'](function(_0x24ab49){_0x1fe54a(_0x24ab49);});else{_0x1fe54a({'id':_0x2b2f7f['id'],'phone':''});}})[_0xdd12('0x14')](function(_0x32c5f2){logger[_0xdd12('0x10')](_0xdd12('0x15'),_0x32c5f2[_0xdd12('0x12')]);_0x3e5005(_0x15cb96[_0xdd12('0x10')](0x1f4,_0x32c5f2[_0xdd12('0x12')]));});}})['catch'](function(_0x17cc67){logger['error'](_0xdd12('0x15'),_0x17cc67[_0xdd12('0x12')]);_0x3e5005(_0x15cb96[_0xdd12('0x10')](0x1f4,_0x17cc67['message']));});}else _0x1fe54a(0x1);});});};function activateAdditionalPhone(_0x150d5d,_0x1f38e3,_0x134473,_0x3ae61c,_0x752423){return new Promise(function(_0x44c313,_0x4461ad){var _0x8f3eb9;if(_[_0xdd12('0x2d')](_0x134473[_0xdd12('0x2e')])){_0x134473[_0xdd12('0x2e')]=moment();}if(moment()>moment(_0x134473[_0xdd12('0x2e')])){_0x8f3eb9=moment()[_0xdd12('0x2f')](_0x752423||0x3,_0xdd12('0x30'));}else{if(_0x134473[_0xdd12('0x1d')]==0x0){_0x8f3eb9=moment(_0x134473['scheduledat']);}else{_0x8f3eb9=moment()[_0xdd12('0x2f')](_0x752423||0x3,_0xdd12('0x30'));}}if(_[_0xdd12('0x2d')](_0x8f3eb9)){_0x8f3eb9=moment()[_0xdd12('0x2f')](_0x752423||0x3,_0xdd12('0x30'));}var _0x37e0d6={'phone':_0x150d5d[_0xdd12('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x150d5d[_0xdd12('0x1d')])?0x0:_0x150d5d['OrderBy'],'scheduledat':moment()['add'](_0x3ae61c||0x1,_0xdd12('0x30')),'countbusyretry':_0x1f38e3['countbusyretry'],'countcongestionretry':_0x1f38e3[_0xdd12('0x21')],'countnoanswerretry':_0x1f38e3[_0xdd12('0x22')],'countnosuchnumberretry':_0x1f38e3[_0xdd12('0x23')],'countdropretry':_0x1f38e3[_0xdd12('0x24')],'countabandonedretry':_0x1f38e3[_0xdd12('0x25')],'countmachineretry':_0x1f38e3[_0xdd12('0x26')],'countagentrejectretry':_0x1f38e3['countagentrejectretry'],'createdAt':_0x1f38e3[_0xdd12('0x32')],'updatedAt':_0x1f38e3['updatedAt']};var _0xe151f7={'CmHopperId':_0x150d5d['id'],'phone':_0x134473[_0xdd12('0x31')],'active':0x0,'OrderBy':_[_0xdd12('0x2d')](_0x134473[_0xdd12('0x1d')])?0x0:_0x134473[_0xdd12('0x1d')],'scheduledat':_0x8f3eb9,'countbusyretry':_0x134473[_0xdd12('0x20')],'countcongestionretry':_0x134473[_0xdd12('0x21')],'countnoanswerretry':_0x134473[_0xdd12('0x22')],'countnosuchnumberretry':_0x134473[_0xdd12('0x23')],'countdropretry':_0x134473['countdropretry'],'countabandonedretry':_0x134473[_0xdd12('0x25')],'countmachineretry':_0x134473[_0xdd12('0x26')],'countagentrejectretry':_0x134473['countagentrejectretry'],'createdAt':_0x134473[_0xdd12('0x32')],'updatedAt':_0x134473[_0xdd12('0x33')]};return db['sequelize'][_0xdd12('0x34')](function(_0x771277){return db[_0xdd12('0x1c')]['update'](_0x37e0d6,{'where':{'id':_0x134473['id']}},{'transaction':_0x771277})[_0xdd12('0x1f')](function(){return db['CmHopper']['update'](_0xe151f7,{'where':{'id':_0x150d5d['id']}},{'transaction':_0x771277});});})[_0xdd12('0x1f')](function(_0x33ab94){_0x44c313({'id':_0x150d5d['id'],'phone':_0x134473[_0xdd12('0x31')]});})[_0xdd12('0x14')](function(_0x2978a9){logger['error']('activateAdditionalPhone',_0x2978a9[_0xdd12('0x12')]);_0x4461ad({'error':_0x2978a9[_0xdd12('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x1613f7){var _0x25400b=this;return new Promise(function(_0xf1e544,_0x3f218b){return db['CmHopper'][_0xdd12('0x35')](_0x1613f7[_0xdd12('0x17')][_0xdd12('0x36')],{'where':{'id':_0x1613f7[_0xdd12('0x17')]['id']}})[_0xdd12('0x1f')](function(_0x301e48){_0xf1e544(_0x301e48);})[_0xdd12('0x14')](function(_0x36cdea){logger[_0xdd12('0x10')]('IncrementPreviewCounters',_0x36cdea[_0xdd12('0x12')]);_0x3f218b(_0x25400b[_0xdd12('0x10')](0x1f4,_0x36cdea[_0xdd12('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4032338..2593a52 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4091=['show','post','create','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x327ab3,_0x48aff7){var _0x5c33c3=function(_0x2035e7){while(--_0x2035e7){_0x327ab3['push'](_0x327ab3['shift']());}};_0x5c33c3(++_0x48aff7);}(_0x4091,0x181));var _0x1409=function(_0x3ac615,_0x1ba1f1){_0x3ac615=_0x3ac615-0x0;var _0x39048c=_0x4091[_0x3ac615];return _0x39048c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1409('0x0'));var timeout=require(_0x1409('0x1'));var express=require(_0x1409('0x2'));var router=express['Router']();var fs_extra=require(_0x1409('0x3'));var auth=require(_0x1409('0x4'));var interaction=require(_0x1409('0x5'));var config=require(_0x1409('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x1409('0x7')]('/',auth[_0x1409('0x8')](),controller[_0x1409('0x9')]);router[_0x1409('0x7')](_0x1409('0xa'),auth[_0x1409('0x8')](),controller[_0x1409('0xb')]);router[_0x1409('0xc')]('/',auth['isAuthenticated'](),controller[_0x1409('0xd')]);router[_0x1409('0xe')]('/:id',auth[_0x1409('0x8')](),controller[_0x1409('0xf')]);router['delete']('/:id',auth[_0x1409('0x8')](),controller[_0x1409('0x10')]);module[_0x1409('0x11')]=router; \ No newline at end of file +var _0x05e8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','get','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x05e8,0xc9));var _0x805e=function(_0x1791f5,_0x45f5eb){_0x1791f5=_0x1791f5-0x0;var _0x5e1ceb=_0x05e8[_0x1791f5];return _0x5e1ceb;};'use strict';var multer=require(_0x805e('0x0'));var util=require(_0x805e('0x1'));var path=require(_0x805e('0x2'));var timeout=require(_0x805e('0x3'));var express=require('express');var router=express[_0x805e('0x4')]();var fs_extra=require(_0x805e('0x5'));var auth=require(_0x805e('0x6'));var interaction=require(_0x805e('0x7'));var config=require('../../config/environment');var controller=require(_0x805e('0x8'));router['get']('/',auth[_0x805e('0x9')](),controller['index']);router[_0x805e('0xa')]('/:id',auth[_0x805e('0x9')](),controller['show']);router['post']('/',auth[_0x805e('0x9')](),controller[_0x805e('0xb')]);router[_0x805e('0xc')](_0x805e('0xd'),auth[_0x805e('0x9')](),controller['update']);router[_0x805e('0xe')](_0x805e('0xd'),auth[_0x805e('0x9')](),controller[_0x805e('0xf')]);module[_0x805e('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 284e72b..c2df00d 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 _0xb182=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x21be74,_0x40d85a){var _0x573dc6=function(_0x191c35){while(--_0x191c35){_0x21be74['push'](_0x21be74['shift']());}};_0x573dc6(++_0x40d85a);}(_0xb182,0x121));var _0x2b18=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xb182[_0x5c768b];return _0x335af8;};'use strict';var moment=require('moment');var Sequelize=require(_0x2b18('0x0'));module[_0x2b18('0x1')]={'phone':{'type':Sequelize[_0x2b18('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x2b18('0x3')],'unique':_0x2b18('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2b18('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x5d87=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x2f7ecb,_0x9245f9){var _0x1de9da=function(_0x354b36){while(--_0x354b36){_0x2f7ecb['push'](_0x2f7ecb['shift']());}};_0x1de9da(++_0x9245f9);}(_0x5d87,0x16b));var _0x75d8=function(_0x52f37d,_0x5ea258){_0x52f37d=_0x52f37d-0x0;var _0x31595b=_0x5d87[_0x52f37d];return _0x31595b;};'use strict';var moment=require(_0x75d8('0x0'));var Sequelize=require(_0x75d8('0x1'));module[_0x75d8('0x2')]={'phone':{'type':Sequelize[_0x75d8('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x75d8('0x4')],'unique':_0x75d8('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x75d8('0x5')},'VoiceQueueId':{'type':Sequelize[_0x75d8('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2ff786a..92e6207 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 _0x6d21=['error','name','send','index','CmHopperBlack','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','params','length','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','querystring','../../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','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x6d21,0xfd));var _0x16d2=function(_0xcccd92,_0x135e42){_0xcccd92=_0xcccd92-0x0;var _0x34b822=_0x6d21[_0xcccd92];return _0x34b822;};'use strict';var emlformat=require(_0x16d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16d2('0x1'));var jsonpatch=require(_0x16d2('0x2'));var rp=require(_0x16d2('0x3'));var moment=require(_0x16d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x16d2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d2('0x6'));var csv=require(_0x16d2('0x7'));var ejs=require(_0x16d2('0x8'));var fs=require('fs');var fs_extra=require(_0x16d2('0x9'));var _=require('lodash');var squel=require(_0x16d2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16d2('0x7'));var querystring=require(_0x16d2('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x16d2('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x16d2('0xd'));var hardwareService=require(_0x16d2('0xe'));var logger=require(_0x16d2('0xf'))(_0x16d2('0x10'));var utils=require(_0x16d2('0x11'));var config=require(_0x16d2('0x12'));var licenseUtil=require(_0x16d2('0x13'));var db=require(_0x16d2('0x14'))['db'];function respondWithStatusCode(_0x510c3a,_0x359b1a){_0x359b1a=_0x359b1a||0xcc;return function(_0x229703){if(_0x229703){return _0x510c3a['sendStatus'](_0x359b1a);}return _0x510c3a[_0x16d2('0x15')](_0x359b1a)[_0x16d2('0x16')]();};}function respondWithResult(_0x5c9d35,_0x419498){_0x419498=_0x419498||0xc8;return function(_0x7b30ae){if(_0x7b30ae){return _0x5c9d35[_0x16d2('0x15')](_0x419498)[_0x16d2('0x17')](_0x7b30ae);}};}function respondWithFilteredResult(_0x12e294,_0x122028){return function(_0x19595e){if(_0x19595e){var _0x1fa6b1=typeof _0x122028[_0x16d2('0x18')]===_0x16d2('0x19')&&typeof _0x122028['limit']===_0x16d2('0x19');var _0x37df06=_0x19595e['count'];var _0x162eea=_0x1fa6b1?0x0:_0x122028[_0x16d2('0x18')];var _0x36f275=_0x1fa6b1?_0x19595e['count']:_0x122028[_0x16d2('0x18')]+_0x122028['limit'];var _0x1d92af;if(_0x36f275>=_0x37df06){_0x36f275=_0x37df06;_0x1d92af=0xc8;}else{_0x1d92af=0xce;}_0x12e294[_0x16d2('0x15')](_0x1d92af);return _0x12e294[_0x16d2('0x1a')](_0x16d2('0x1b'),_0x162eea+'-'+_0x36f275+'/'+_0x37df06)[_0x16d2('0x17')](_0x19595e);}return null;};}function patchUpdates(_0x2f0100){return function(_0x31b14d){try{jsonpatch[_0x16d2('0x1c')](_0x31b14d,_0x2f0100,!![]);}catch(_0x16d3d0){return BPromise[_0x16d2('0x1d')](_0x16d3d0);}return _0x31b14d[_0x16d2('0x1e')]();};}function saveUpdates(_0x122e3f,_0x14bf60){return function(_0x882a58){if(_0x882a58){return _0x882a58[_0x16d2('0x1f')](_0x122e3f)[_0x16d2('0x20')](function(_0x4076fe){return _0x4076fe;});}return null;};}function removeEntity(_0x59d410,_0x61eb7c){return function(_0x257da9){if(_0x257da9){return _0x257da9[_0x16d2('0x21')]()[_0x16d2('0x20')](function(){_0x59d410['status'](0xcc)[_0x16d2('0x16')]();});}};}function handleEntityNotFound(_0x55b47a,_0x15bb6b){return function(_0x32ec20){if(!_0x32ec20){_0x55b47a[_0x16d2('0x22')](0x194);}return _0x32ec20;};}function handleError(_0x18545a,_0x3b704d){_0x3b704d=_0x3b704d||0x1f4;return function(_0x3243c8){logger[_0x16d2('0x23')](_0x3243c8['stack']);if(_0x3243c8[_0x16d2('0x24')]){delete _0x3243c8[_0x16d2('0x24')];}_0x18545a[_0x16d2('0x15')](_0x3b704d)[_0x16d2('0x25')](_0x3243c8);};}exports[_0x16d2('0x26')]=function(_0x28796c,_0x494bfc){var _0x556cf6={},_0x288ef9={},_0xf657a6={'count':0x0,'rows':[]};var _0x43edf0=_['map'](db[_0x16d2('0x27')][_0x16d2('0x28')],function(_0x1b9092){return{'name':_0x1b9092[_0x16d2('0x29')],'type':_0x1b9092['type'][_0x16d2('0x2a')]};});_0x288ef9[_0x16d2('0x2b')]=_[_0x16d2('0x2c')](_0x43edf0,_0x16d2('0x24'));_0x288ef9[_0x16d2('0x2d')]=_[_0x16d2('0x2e')](_0x28796c['query']);_0x288ef9[_0x16d2('0x2f')]=_[_0x16d2('0x30')](_0x288ef9[_0x16d2('0x2b')],_0x288ef9['query']);_0x556cf6['attributes']=_['intersection'](_0x288ef9[_0x16d2('0x2b')],qs[_0x16d2('0x31')](_0x28796c['query'][_0x16d2('0x31')]));_0x556cf6['attributes']=_0x556cf6[_0x16d2('0x32')]['length']?_0x556cf6[_0x16d2('0x32')]:_0x288ef9['model'];if(!_0x28796c[_0x16d2('0x2d')]['hasOwnProperty'](_0x16d2('0x33'))){_0x556cf6[_0x16d2('0x34')]=qs[_0x16d2('0x34')](_0x28796c['query']['limit']);_0x556cf6[_0x16d2('0x18')]=qs[_0x16d2('0x18')](_0x28796c[_0x16d2('0x2d')][_0x16d2('0x18')]);}_0x556cf6[_0x16d2('0x35')]=qs[_0x16d2('0x36')](_0x28796c[_0x16d2('0x2d')][_0x16d2('0x36')]);_0x556cf6[_0x16d2('0x37')]=qs['filters'](_[_0x16d2('0x38')](_0x28796c[_0x16d2('0x2d')],_0x288ef9[_0x16d2('0x2f')]),_0x43edf0);if(_0x28796c['query'][_0x16d2('0x39')]){_0x556cf6[_0x16d2('0x37')]=_[_0x16d2('0x3a')](_0x556cf6[_0x16d2('0x37')],{'$or':_[_0x16d2('0x2c')](_0x43edf0,function(_0x43e89a){if(_0x43e89a[_0x16d2('0x3b')]!==_0x16d2('0x3c')){var _0x374062={};_0x374062[_0x43e89a['name']]={'$like':'%'+_0x28796c[_0x16d2('0x2d')][_0x16d2('0x39')]+'%'};return _0x374062;}})});}_0x556cf6=_[_0x16d2('0x3a')]({},_0x556cf6,_0x28796c[_0x16d2('0x3d')]);var _0x12b586={'where':_0x556cf6[_0x16d2('0x37')]};return db[_0x16d2('0x27')][_0x16d2('0x3e')](_0x12b586)[_0x16d2('0x20')](function(_0x1c7357){_0xf657a6[_0x16d2('0x3e')]=_0x1c7357;if(_0x28796c['query'][_0x16d2('0x3f')]){_0x556cf6[_0x16d2('0x40')]=[{'all':!![]}];}return db[_0x16d2('0x27')]['findAll'](_0x556cf6);})[_0x16d2('0x20')](function(_0x3c0096){_0xf657a6[_0x16d2('0x41')]=_0x3c0096;return _0xf657a6;})[_0x16d2('0x20')](respondWithFilteredResult(_0x494bfc,_0x556cf6))[_0x16d2('0x42')](handleError(_0x494bfc,null));};exports['show']=function(_0x5d2175,_0xe6f99f){var _0x49a748={'raw':!![],'where':{'id':_0x5d2175[_0x16d2('0x43')]['id']}},_0x42f6bc={};_0x42f6bc[_0x16d2('0x2b')]=_[_0x16d2('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x42f6bc[_0x16d2('0x2d')]=_['keys'](_0x5d2175[_0x16d2('0x2d')]);_0x42f6bc['filters']=_['intersection'](_0x42f6bc[_0x16d2('0x2b')],_0x42f6bc['query']);_0x49a748[_0x16d2('0x32')]=_['intersection'](_0x42f6bc[_0x16d2('0x2b')],qs[_0x16d2('0x31')](_0x5d2175['query'][_0x16d2('0x31')]));_0x49a748[_0x16d2('0x32')]=_0x49a748[_0x16d2('0x32')][_0x16d2('0x44')]?_0x49a748['attributes']:_0x42f6bc[_0x16d2('0x2b')];if(_0x5d2175[_0x16d2('0x2d')]['includeAll']){_0x49a748['include']=[{'all':!![]}];}_0x49a748=_[_0x16d2('0x3a')]({},_0x49a748,_0x5d2175[_0x16d2('0x3d')]);return db['CmHopperBlack'][_0x16d2('0x45')](_0x49a748)[_0x16d2('0x20')](handleEntityNotFound(_0xe6f99f,null))[_0x16d2('0x20')](respondWithResult(_0xe6f99f,null))['catch'](handleError(_0xe6f99f,null));};exports['update']=function(_0xc78a07,_0x5efe27){if(_0xc78a07[_0x16d2('0x46')]['id']){delete _0xc78a07[_0x16d2('0x46')]['id'];}return db[_0x16d2('0x27')][_0x16d2('0x45')]({'where':{'id':_0xc78a07[_0x16d2('0x43')]['id']}})[_0x16d2('0x20')](handleEntityNotFound(_0x5efe27,null))[_0x16d2('0x20')](saveUpdates(_0xc78a07[_0x16d2('0x46')],null))[_0x16d2('0x20')](respondWithResult(_0x5efe27,null))[_0x16d2('0x42')](handleError(_0x5efe27,null));};exports['destroy']=function(_0x584249,_0x348f53){return db[_0x16d2('0x27')][_0x16d2('0x45')]({'where':{'id':_0x584249['params']['id']}})[_0x16d2('0x20')](handleEntityNotFound(_0x348f53,null))['then'](removeEntity(_0x348f53,null))['catch'](handleError(_0x348f53,null));};exports[_0x16d2('0x47')]=function(_0x56caf9,_0x2684a7){return db[_0x16d2('0x27')][_0x16d2('0x47')]()[_0x16d2('0x20')](respondWithResult(_0x2684a7,null))['catch'](handleError(_0x2684a7,null));}; \ No newline at end of file +var _0x857d=['../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','show','includeAll','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3ae818,_0x1a81aa){var _0x354062=function(_0x5308a4){while(--_0x5308a4){_0x3ae818['push'](_0x3ae818['shift']());}};_0x354062(++_0x1a81aa);}(_0x857d,0x15d));var _0xd857=function(_0x4733b6,_0x35291f){_0x4733b6=_0x4733b6-0x0;var _0x1c3f73=_0x857d[_0x4733b6];return _0x1c3f73;};'use strict';var emlformat=require(_0xd857('0x0'));var rimraf=require(_0xd857('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd857('0x2'));var rp=require(_0xd857('0x3'));var moment=require(_0xd857('0x4'));var BPromise=require(_0xd857('0x5'));var Mustache=require('mustache');var util=require(_0xd857('0x6'));var path=require(_0xd857('0x7'));var sox=require('sox');var csv=require(_0xd857('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd857('0x9'));var _=require(_0xd857('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd857('0xb'));var deskjs=require(_0xd857('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd857('0xd'));var Redis=require(_0xd857('0xe'));var authService=require(_0xd857('0xf'));var qs=require(_0xd857('0x10'));var as=require(_0xd857('0x11'));var hardwareService=require(_0xd857('0x12'));var logger=require(_0xd857('0x13'))(_0xd857('0x14'));var utils=require(_0xd857('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd857('0x16'));var db=require(_0xd857('0x17'))['db'];function respondWithStatusCode(_0x4cab81,_0x453069){_0x453069=_0x453069||0xcc;return function(_0x3f209c){if(_0x3f209c){return _0x4cab81['sendStatus'](_0x453069);}return _0x4cab81[_0xd857('0x18')](_0x453069)[_0xd857('0x19')]();};}function respondWithResult(_0x4ab4e4,_0x29b024){_0x29b024=_0x29b024||0xc8;return function(_0x3e025e){if(_0x3e025e){return _0x4ab4e4[_0xd857('0x18')](_0x29b024)['json'](_0x3e025e);}};}function respondWithFilteredResult(_0x14486d,_0x4b3ea5){return function(_0x2aa01d){if(_0x2aa01d){var _0x39c731=typeof _0x4b3ea5[_0xd857('0x1a')]===_0xd857('0x1b')&&typeof _0x4b3ea5[_0xd857('0x1c')]===_0xd857('0x1b');var _0x2bb5be=_0x2aa01d['count'];var _0x2767ea=_0x39c731?0x0:_0x4b3ea5[_0xd857('0x1a')];var _0x5c0acd=_0x39c731?_0x2aa01d[_0xd857('0x1d')]:_0x4b3ea5[_0xd857('0x1a')]+_0x4b3ea5['limit'];var _0x4d3ab4;if(_0x5c0acd>=_0x2bb5be){_0x5c0acd=_0x2bb5be;_0x4d3ab4=0xc8;}else{_0x4d3ab4=0xce;}_0x14486d['status'](_0x4d3ab4);return _0x14486d['set'](_0xd857('0x1e'),_0x2767ea+'-'+_0x5c0acd+'/'+_0x2bb5be)[_0xd857('0x1f')](_0x2aa01d);}return null;};}function patchUpdates(_0x196611){return function(_0x566b11){try{jsonpatch[_0xd857('0x20')](_0x566b11,_0x196611,!![]);}catch(_0x352b71){return BPromise[_0xd857('0x21')](_0x352b71);}return _0x566b11[_0xd857('0x22')]();};}function saveUpdates(_0x455c21,_0x2bb092){return function(_0x35e3f1){if(_0x35e3f1){return _0x35e3f1[_0xd857('0x23')](_0x455c21)[_0xd857('0x24')](function(_0x3c8847){return _0x3c8847;});}return null;};}function removeEntity(_0x1f34bf,_0x41f23b){return function(_0x19a140){if(_0x19a140){return _0x19a140[_0xd857('0x25')]()[_0xd857('0x24')](function(){_0x1f34bf[_0xd857('0x18')](0xcc)[_0xd857('0x19')]();});}};}function handleEntityNotFound(_0x62fe8c,_0x33dea7){return function(_0x1f0222){if(!_0x1f0222){_0x62fe8c[_0xd857('0x26')](0x194);}return _0x1f0222;};}function handleError(_0x26df4a,_0x4a5402){_0x4a5402=_0x4a5402||0x1f4;return function(_0x169d87){logger[_0xd857('0x27')](_0x169d87['stack']);if(_0x169d87[_0xd857('0x28')]){delete _0x169d87['name'];}_0x26df4a[_0xd857('0x18')](_0x4a5402)[_0xd857('0x29')](_0x169d87);};}exports[_0xd857('0x2a')]=function(_0x51b6bb,_0x47924c){var _0x3b2dc1={},_0x1b3c7f={},_0x24d05f={'count':0x0,'rows':[]};var _0xa0bb7d=_[_0xd857('0x2b')](db[_0xd857('0x2c')][_0xd857('0x2d')],function(_0x1cade4){return{'name':_0x1cade4[_0xd857('0x2e')],'type':_0x1cade4[_0xd857('0x2f')][_0xd857('0x30')]};});_0x1b3c7f[_0xd857('0x31')]=_['map'](_0xa0bb7d,'name');_0x1b3c7f['query']=_[_0xd857('0x32')](_0x51b6bb['query']);_0x1b3c7f[_0xd857('0x33')]=_['intersection'](_0x1b3c7f[_0xd857('0x31')],_0x1b3c7f[_0xd857('0x34')]);_0x3b2dc1['attributes']=_[_0xd857('0x35')](_0x1b3c7f[_0xd857('0x31')],qs[_0xd857('0x36')](_0x51b6bb[_0xd857('0x34')]['fields']));_0x3b2dc1[_0xd857('0x37')]=_0x3b2dc1[_0xd857('0x37')][_0xd857('0x38')]?_0x3b2dc1['attributes']:_0x1b3c7f[_0xd857('0x31')];if(!_0x51b6bb['query'][_0xd857('0x39')](_0xd857('0x3a'))){_0x3b2dc1['limit']=qs[_0xd857('0x1c')](_0x51b6bb[_0xd857('0x34')][_0xd857('0x1c')]);_0x3b2dc1[_0xd857('0x1a')]=qs[_0xd857('0x1a')](_0x51b6bb[_0xd857('0x34')][_0xd857('0x1a')]);}_0x3b2dc1['order']=qs[_0xd857('0x3b')](_0x51b6bb['query']['sort']);_0x3b2dc1[_0xd857('0x3c')]=qs[_0xd857('0x33')](_[_0xd857('0x3d')](_0x51b6bb[_0xd857('0x34')],_0x1b3c7f[_0xd857('0x33')]),_0xa0bb7d);if(_0x51b6bb[_0xd857('0x34')][_0xd857('0x3e')]){_0x3b2dc1[_0xd857('0x3c')]=_[_0xd857('0x3f')](_0x3b2dc1['where'],{'$or':_[_0xd857('0x2b')](_0xa0bb7d,function(_0x5f3ed6){if(_0x5f3ed6['type']!=='VIRTUAL'){var _0x725bd5={};_0x725bd5[_0x5f3ed6[_0xd857('0x28')]]={'$like':'%'+_0x51b6bb[_0xd857('0x34')][_0xd857('0x3e')]+'%'};return _0x725bd5;}})});}_0x3b2dc1=_['merge']({},_0x3b2dc1,_0x51b6bb[_0xd857('0x40')]);var _0x20522f={'where':_0x3b2dc1[_0xd857('0x3c')]};return db['CmHopperBlack'][_0xd857('0x1d')](_0x20522f)[_0xd857('0x24')](function(_0x10fe1b){_0x24d05f[_0xd857('0x1d')]=_0x10fe1b;if(_0x51b6bb['query']['includeAll']){_0x3b2dc1[_0xd857('0x41')]=[{'all':!![]}];}return db[_0xd857('0x2c')]['findAll'](_0x3b2dc1);})[_0xd857('0x24')](function(_0x389650){_0x24d05f[_0xd857('0x42')]=_0x389650;return _0x24d05f;})[_0xd857('0x24')](respondWithFilteredResult(_0x47924c,_0x3b2dc1))[_0xd857('0x43')](handleError(_0x47924c,null));};exports[_0xd857('0x44')]=function(_0x95b24a,_0x56891d){var _0x29e6e8={'raw':!![],'where':{'id':_0x95b24a['params']['id']}},_0x181444={};_0x181444[_0xd857('0x31')]=_[_0xd857('0x32')](db['CmHopperBlack'][_0xd857('0x2d')]);_0x181444[_0xd857('0x34')]=_[_0xd857('0x32')](_0x95b24a[_0xd857('0x34')]);_0x181444[_0xd857('0x33')]=_['intersection'](_0x181444[_0xd857('0x31')],_0x181444['query']);_0x29e6e8[_0xd857('0x37')]=_[_0xd857('0x35')](_0x181444[_0xd857('0x31')],qs[_0xd857('0x36')](_0x95b24a[_0xd857('0x34')][_0xd857('0x36')]));_0x29e6e8['attributes']=_0x29e6e8[_0xd857('0x37')][_0xd857('0x38')]?_0x29e6e8[_0xd857('0x37')]:_0x181444['model'];if(_0x95b24a['query'][_0xd857('0x45')]){_0x29e6e8[_0xd857('0x41')]=[{'all':!![]}];}_0x29e6e8=_[_0xd857('0x3f')]({},_0x29e6e8,_0x95b24a[_0xd857('0x40')]);return db[_0xd857('0x2c')]['find'](_0x29e6e8)[_0xd857('0x24')](handleEntityNotFound(_0x56891d,null))[_0xd857('0x24')](respondWithResult(_0x56891d,null))['catch'](handleError(_0x56891d,null));};exports[_0xd857('0x23')]=function(_0x4853d3,_0x3a9e44){if(_0x4853d3[_0xd857('0x46')]['id']){delete _0x4853d3[_0xd857('0x46')]['id'];}return db['CmHopperBlack'][_0xd857('0x47')]({'where':{'id':_0x4853d3[_0xd857('0x48')]['id']}})[_0xd857('0x24')](handleEntityNotFound(_0x3a9e44,null))['then'](saveUpdates(_0x4853d3[_0xd857('0x46')],null))[_0xd857('0x24')](respondWithResult(_0x3a9e44,null))[_0xd857('0x43')](handleError(_0x3a9e44,null));};exports[_0xd857('0x25')]=function(_0x105863,_0x3847cb){return db['CmHopperBlack'][_0xd857('0x47')]({'where':{'id':_0x105863[_0xd857('0x48')]['id']}})[_0xd857('0x24')](handleEntityNotFound(_0x3847cb,null))[_0xd857('0x24')](removeEntity(_0x3847cb,null))[_0xd857('0x43')](handleError(_0x3847cb,null));};exports[_0xd857('0x49')]=function(_0x53b5ad,_0x497211){return db[_0xd857('0x2c')][_0xd857('0x49')]()[_0xd857('0x24')](respondWithResult(_0x497211,null))[_0xd857('0x43')](handleError(_0x497211,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6fba603..4c364aa 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 _0x5b89=['../../config/logger','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0xb1353b,_0x44adad){var _0x4ba33f=function(_0x453bf6){while(--_0x453bf6){_0xb1353b['push'](_0xb1353b['shift']());}};_0x4ba33f(++_0x44adad);}(_0x5b89,0x149));var _0x95b8=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x5b89[_0x5f6a8a];return _0x2cce4d;};'use strict';var _=require('lodash');var util=require(_0x95b8('0x0'));var logger=require(_0x95b8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x95b8('0x2'));var rp=require(_0x95b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95b8('0x4'));var config=require('../../config/environment');var attributes=require(_0x95b8('0x5'));module[_0x95b8('0x6')]=function(_0x3e0407,_0x5b63bd){return _0x3e0407[_0x95b8('0x7')](_0x95b8('0x8'),attributes,{'tableName':_0x95b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde17=['define','CmHopperBlack','cm_hopper_black','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x17ea78,_0x174f0a){var _0x28b98d=function(_0xd567e5){while(--_0xd567e5){_0x17ea78['push'](_0x17ea78['shift']());}};_0x28b98d(++_0x174f0a);}(_0xde17,0x71));var _0x7de1=function(_0x182b48,_0x497d51){_0x182b48=_0x182b48-0x0;var _0x1ece46=_0xde17[_0x182b48];return _0x1ece46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7de1('0x0'))('api');var moment=require(_0x7de1('0x1'));var BPromise=require(_0x7de1('0x2'));var rp=require(_0x7de1('0x3'));var fs=require('fs');var path=require(_0x7de1('0x4'));var rimraf=require(_0x7de1('0x5'));var config=require(_0x7de1('0x6'));var attributes=require(_0x7de1('0x7'));module['exports']=function(_0x19f47d,_0x250b17){return _0x19f47d[_0x7de1('0x8')](_0x7de1('0x9'),attributes,{'tableName':_0x7de1('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 da6f861..7bffebf 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 _0x5d30=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5d30,0x1c9));var _0x05d3=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x5d30[_0x3a3b9e];return _0x148103;};'use strict';var _=require('lodash');var util=require(_0x05d3('0x0'));var moment=require(_0x05d3('0x1'));var BPromise=require(_0x05d3('0x2'));var rs=require(_0x05d3('0x3'));var fs=require('fs');var Redis=require(_0x05d3('0x4'));var db=require(_0x05d3('0x5'))['db'];var utils=require(_0x05d3('0x6'));var logger=require(_0x05d3('0x7'))(_0x05d3('0x8'));var config=require('../../config/environment');var jayson=require(_0x05d3('0x9'));var client=jayson[_0x05d3('0xa')][_0x05d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x151dc9,_0x3e3686,_0x51176f){return new BPromise(function(_0x4c0d64,_0xd61a9b){return client[_0x05d3('0xc')](_0x151dc9,_0x51176f)[_0x05d3('0xd')](function(_0x35ebf6){logger[_0x05d3('0xe')](_0x05d3('0xf'),_0x3e3686,_0x05d3('0x10'));logger[_0x05d3('0x11')](_0x05d3('0x12'),_0x3e3686,_0x05d3('0x10'),JSON['stringify'](_0x35ebf6));if(_0x35ebf6[_0x05d3('0x13')]){if(_0x35ebf6[_0x05d3('0x13')][_0x05d3('0x14')]===0x1f4){logger['error'](_0x05d3('0xf'),_0x3e3686,_0x35ebf6[_0x05d3('0x13')]['message']);return _0xd61a9b(_0x35ebf6[_0x05d3('0x13')][_0x05d3('0x15')]);}logger[_0x05d3('0x13')](_0x05d3('0xf'),_0x3e3686,_0x35ebf6[_0x05d3('0x13')][_0x05d3('0x15')]);return _0x4c0d64(_0x35ebf6[_0x05d3('0x13')]['message']);}else{logger[_0x05d3('0xe')](_0x05d3('0xf'),_0x3e3686,_0x05d3('0x10'));_0x4c0d64(_0x35ebf6[_0x05d3('0x16')][_0x05d3('0x15')]);}})[_0x05d3('0x17')](function(_0x15c9e4){logger['error'](_0x05d3('0xf'),_0x3e3686,_0x15c9e4);_0xd61a9b(_0x15c9e4);});});}exports[_0x05d3('0x18')]=function(_0x108077){var _0x1757ef=this;return new Promise(function(_0x5c5b9f,_0x23993c){return db[_0x05d3('0x19')][_0x05d3('0x1a')]({'raw':_0x108077[_0x05d3('0x1b')]?_0x108077[_0x05d3('0x1b')][_0x05d3('0x1c')]===undefined?!![]:![]:!![],'where':_0x108077[_0x05d3('0x1b')]?_0x108077[_0x05d3('0x1b')][_0x05d3('0x1d')]||null:null,'attributes':_0x108077[_0x05d3('0x1b')]?_0x108077['options'][_0x05d3('0x1e')]||null:null,'limit':_0x108077[_0x05d3('0x1b')]?_0x108077['options'][_0x05d3('0x1f')]||null:null,'include':_0x108077[_0x05d3('0x1b')]?_0x108077[_0x05d3('0x1b')][_0x05d3('0x20')]?_[_0x05d3('0x21')](_0x108077[_0x05d3('0x1b')][_0x05d3('0x20')],function(_0x2dc534){return{'model':db[_0x2dc534[_0x05d3('0x22')]],'as':_0x2dc534['as'],'attributes':_0x2dc534[_0x05d3('0x1e')],'include':_0x2dc534['include']?_[_0x05d3('0x21')](_0x2dc534['include'],function(_0x3692e8){return{'model':db[_0x3692e8['model']],'as':_0x3692e8['as'],'attributes':_0x3692e8[_0x05d3('0x1e')],'include':_0x3692e8[_0x05d3('0x20')]?_[_0x05d3('0x21')](_0x3692e8[_0x05d3('0x20')],function(_0x94c752){return{'model':db[_0x94c752[_0x05d3('0x22')]],'as':_0x94c752['as'],'attributes':_0x94c752[_0x05d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x05d3('0xd')](function(_0x533ef3){logger['info'](_0x05d3('0x18'),_0x108077);logger['debug']('GetCmHopperBlack',_0x108077,JSON[_0x05d3('0x23')](_0x533ef3));_0x5c5b9f(_0x533ef3);})[_0x05d3('0x17')](function(_0x13c207){logger[_0x05d3('0x13')]('GetCmHopperBlack',_0x13c207[_0x05d3('0x15')],_0x108077);_0x23993c(_0x1757ef[_0x05d3('0x13')](0x1f4,_0x13c207['message']));});});};exports[_0x05d3('0x24')]=function(_0x128e35){var _0x1c09e8=this;return new Promise(function(_0x53072e,_0x5cee43){return db[_0x05d3('0x19')][_0x05d3('0x25')](_0x128e35['body'],{'raw':_0x128e35['options']?_0x128e35[_0x05d3('0x1b')][_0x05d3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x128e35['options']?_0x128e35[_0x05d3('0x1b')][_0x05d3('0x1d')]||null:null,'attributes':_0x128e35['options']?_0x128e35[_0x05d3('0x1b')][_0x05d3('0x1e')]||null:null,'limit':_0x128e35[_0x05d3('0x1b')]?_0x128e35[_0x05d3('0x1b')]['limit']||null:null})[_0x05d3('0xd')](function(_0x1eeb03){logger[_0x05d3('0xe')](_0x05d3('0x24'),_0x128e35);logger[_0x05d3('0x11')](_0x05d3('0x24'),_0x128e35,JSON['stringify'](_0x1eeb03));_0x53072e(_0x1eeb03);})[_0x05d3('0x17')](function(_0x41d163){logger[_0x05d3('0x13')](_0x05d3('0x24'),_0x41d163['message'],_0x128e35);_0x5cee43(_0x1c09e8[_0x05d3('0x13')](0x1f4,_0x41d163[_0x05d3('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x568084){var _0x2ae155=this;return new Promise(function(_0x30eef3,_0x2a4303){return db[_0x05d3('0x19')][_0x05d3('0x26')]({'where':_0x568084[_0x05d3('0x1b')]?_0x568084['options'][_0x05d3('0x1d')]||null:null})['then'](function(_0x12fb96){logger[_0x05d3('0xe')]('DestroyCmHopperBlack',_0x568084);logger[_0x05d3('0x11')]('DestroyCmHopperBlack',_0x568084,JSON[_0x05d3('0x23')](_0x12fb96));_0x30eef3(_0x12fb96);})['catch'](function(_0x5d4dbc){logger[_0x05d3('0x13')](_0x05d3('0x27'),_0x5d4dbc[_0x05d3('0x15')],_0x568084);_0x2a4303(_0x2ae155[_0x05d3('0x13')](0x1f4,_0x5d4dbc['message']));});});}; \ No newline at end of file +var _0xa1e4=['jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','debug','update','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c423d,_0x52e413){var _0x4f2b28=function(_0x13f54a){while(--_0x13f54a){_0x2c423d['push'](_0x2c423d['shift']());}};_0x4f2b28(++_0x52e413);}(_0xa1e4,0xb2));var _0x4a1e=function(_0x4def54,_0x36de1d){_0x4def54=_0x4def54-0x0;var _0x137bee=_0xa1e4[_0x4def54];return _0x137bee;};'use strict';var _=require(_0x4a1e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a1e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a1e('0x2'))['db'];var utils=require(_0x4a1e('0x3'));var logger=require(_0x4a1e('0x4'))(_0x4a1e('0x5'));var config=require(_0x4a1e('0x6'));var jayson=require(_0x4a1e('0x7'));var client=jayson[_0x4a1e('0x8')][_0x4a1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3def,_0x172aed,_0x28ee3a){return new BPromise(function(_0x4551ed,_0x2c3db0){return client[_0x4a1e('0xa')](_0x5a3def,_0x28ee3a)[_0x4a1e('0xb')](function(_0x4212a9){logger[_0x4a1e('0xc')](_0x4a1e('0xd'),_0x172aed,_0x4a1e('0xe'));logger['debug'](_0x4a1e('0xf'),_0x172aed,_0x4a1e('0xe'),JSON[_0x4a1e('0x10')](_0x4212a9));if(_0x4212a9[_0x4a1e('0x11')]){if(_0x4212a9[_0x4a1e('0x11')]['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x172aed,_0x4212a9['error'][_0x4a1e('0x12')]);return _0x2c3db0(_0x4212a9['error'][_0x4a1e('0x12')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x172aed,_0x4212a9[_0x4a1e('0x11')][_0x4a1e('0x12')]);return _0x4551ed(_0x4212a9['error'][_0x4a1e('0x12')]);}else{logger[_0x4a1e('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x172aed,_0x4a1e('0xe'));_0x4551ed(_0x4212a9[_0x4a1e('0x13')]['message']);}})[_0x4a1e('0x14')](function(_0x4a5d89){logger[_0x4a1e('0x11')](_0x4a1e('0xd'),_0x172aed,_0x4a5d89);_0x2c3db0(_0x4a5d89);});});}exports[_0x4a1e('0x15')]=function(_0x21e289){var _0x3e0e9b=this;return new Promise(function(_0x58d9fa,_0x147ad6){return db[_0x4a1e('0x16')][_0x4a1e('0x17')]({'raw':_0x21e289['options']?_0x21e289[_0x4a1e('0x18')][_0x4a1e('0x19')]===undefined?!![]:![]:!![],'where':_0x21e289[_0x4a1e('0x18')]?_0x21e289[_0x4a1e('0x18')][_0x4a1e('0x1a')]||null:null,'attributes':_0x21e289['options']?_0x21e289[_0x4a1e('0x18')]['attributes']||null:null,'limit':_0x21e289['options']?_0x21e289[_0x4a1e('0x18')][_0x4a1e('0x1b')]||null:null,'include':_0x21e289['options']?_0x21e289['options'][_0x4a1e('0x1c')]?_[_0x4a1e('0x1d')](_0x21e289[_0x4a1e('0x18')]['include'],function(_0x1bb774){return{'model':db[_0x1bb774['model']],'as':_0x1bb774['as'],'attributes':_0x1bb774['attributes'],'include':_0x1bb774[_0x4a1e('0x1c')]?_[_0x4a1e('0x1d')](_0x1bb774[_0x4a1e('0x1c')],function(_0x31e098){return{'model':db[_0x31e098['model']],'as':_0x31e098['as'],'attributes':_0x31e098[_0x4a1e('0x1e')],'include':_0x31e098['include']?_[_0x4a1e('0x1d')](_0x31e098[_0x4a1e('0x1c')],function(_0x3b9840){return{'model':db[_0x3b9840[_0x4a1e('0x1f')]],'as':_0x3b9840['as'],'attributes':_0x3b9840['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a1e('0xb')](function(_0x26f291){logger[_0x4a1e('0xc')](_0x4a1e('0x15'),_0x21e289);logger[_0x4a1e('0x20')](_0x4a1e('0x15'),_0x21e289,JSON[_0x4a1e('0x10')](_0x26f291));_0x58d9fa(_0x26f291);})[_0x4a1e('0x14')](function(_0x362cf6){logger[_0x4a1e('0x11')]('GetCmHopperBlack',_0x362cf6[_0x4a1e('0x12')],_0x21e289);_0x147ad6(_0x3e0e9b[_0x4a1e('0x11')](0x1f4,_0x362cf6[_0x4a1e('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x554755){var _0x457ac4=this;return new Promise(function(_0xd561,_0x246631){return db[_0x4a1e('0x16')][_0x4a1e('0x21')](_0x554755['body'],{'raw':_0x554755['options']?_0x554755[_0x4a1e('0x18')][_0x4a1e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x554755[_0x4a1e('0x18')]?_0x554755[_0x4a1e('0x18')][_0x4a1e('0x1a')]||null:null,'attributes':_0x554755[_0x4a1e('0x18')]?_0x554755['options'][_0x4a1e('0x1e')]||null:null,'limit':_0x554755[_0x4a1e('0x18')]?_0x554755[_0x4a1e('0x18')]['limit']||null:null})[_0x4a1e('0xb')](function(_0x5bb987){logger[_0x4a1e('0xc')](_0x4a1e('0x22'),_0x554755);logger[_0x4a1e('0x20')]('UpdateCmHopperBlack',_0x554755,JSON['stringify'](_0x5bb987));_0xd561(_0x5bb987);})[_0x4a1e('0x14')](function(_0x2ac5bf){logger[_0x4a1e('0x11')](_0x4a1e('0x22'),_0x2ac5bf['message'],_0x554755);_0x246631(_0x457ac4[_0x4a1e('0x11')](0x1f4,_0x2ac5bf[_0x4a1e('0x12')]));});});};exports[_0x4a1e('0x23')]=function(_0x23c454){var _0x833364=this;return new Promise(function(_0x51686b,_0x59414d){return db[_0x4a1e('0x16')][_0x4a1e('0x24')]({'where':_0x23c454['options']?_0x23c454[_0x4a1e('0x18')][_0x4a1e('0x1a')]||null:null})[_0x4a1e('0xb')](function(_0x1fa82b){logger[_0x4a1e('0xc')](_0x4a1e('0x23'),_0x23c454);logger[_0x4a1e('0x20')](_0x4a1e('0x23'),_0x23c454,JSON[_0x4a1e('0x10')](_0x1fa82b));_0x51686b(_0x1fa82b);})[_0x4a1e('0x14')](function(_0x4b9250){logger['error'](_0x4a1e('0x23'),_0x4b9250[_0x4a1e('0x12')],_0x23c454);_0x59414d(_0x833364['error'](0x1f4,_0x4b9250[_0x4a1e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0f86f02..3aee62e 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 _0x2ef3=['describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','/describe','isAuthenticated'];(function(_0x4df587,_0x55f069){var _0xf372bd=function(_0xc12074){while(--_0xc12074){_0x4df587['push'](_0x4df587['shift']());}};_0xf372bd(++_0x55f069);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f0b7e,_0x377c37){_0x3f0b7e=_0x3f0b7e-0x0;var _0x17238b=_0x2ef3[_0x3f0b7e];return _0x17238b;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x32ef('0x10')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0424=['isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0x0424,0x159));var _0x4042=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x0424[_0x311666];return _0x2bc692;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['describe']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['put'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 5f292a4..530b101 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 _0x3be3=['DATE','INTEGER','STRING','followuptime','diff','seconds','BOOLEAN','moment','exports'];(function(_0x5033d,_0x4a9772){var _0x3063c7=function(_0x5d0271){while(--_0x5d0271){_0x5033d['push'](_0x5033d['shift']());}};_0x3063c7(++_0x4a9772);}(_0x3be3,0x15d));var _0x33be=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x3be3[_0x3ab353];return _0x1e2285;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x33be('0x0'));module[_0x33be('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x33be('0x2')]},'countbusyretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x33be('0x4')]},'originatecalleridname':{'type':Sequelize[_0x33be('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x33be('0x4')]},'starttime':{'type':Sequelize[_0x33be('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x33be('0x2')]},'droptime':{'type':Sequelize[_0x33be('0x2')]},'endtime':{'type':Sequelize[_0x33be('0x2')]},'ringtime':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x33be('0x4')]},'campaign':{'type':Sequelize[_0x33be('0x4')]},'campaigntype':{'type':Sequelize[_0x33be('0x4')]},'membername':{'type':Sequelize[_0x33be('0x4')]},'reason':{'type':Sequelize[_0x33be('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x33be('0x4')]},'dispositionat':{'type':Sequelize[_0x33be('0x2')],'set':function(_0x331686){var _0x1aa277=this['getDataValue']('endtime');if(_0x1aa277&&_0x331686){this['setDataValue'](_0x33be('0x5'),moment(_0x331686)[_0x33be('0x6')](moment(_0x1aa277),_0x33be('0x7')));}}},'amd':{'type':Sequelize[_0x33be('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x33be('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x33be('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x33be('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x33be('0x2')]},'callback':{'type':Sequelize[_0x33be('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x33be('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x33be('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x33be('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x33be('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x33be('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4f9=['diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','setDataValue','followuptime'];(function(_0x159a81,_0x5c0214){var _0x2c0b3b=function(_0x3f89b3){while(--_0x3f89b3){_0x159a81['push'](_0x159a81['shift']());}};_0x2c0b3b(++_0x5c0214);}(_0xd4f9,0x177));var _0x9d4f=function(_0xebd1dd,_0xf1066a){_0xebd1dd=_0xebd1dd-0x0;var _0x3e3d78=_0xd4f9[_0xebd1dd];return _0x3e3d78;};'use strict';var Sequelize=require(_0x9d4f('0x0'));var moment=require(_0x9d4f('0x1'));module[_0x9d4f('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9d4f('0x3')]},'scheduledat':{'type':Sequelize[_0x9d4f('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9d4f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9d4f('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9d4f('0x3')]},'calleridnum':{'type':Sequelize[_0x9d4f('0x3')]},'calleridname':{'type':Sequelize[_0x9d4f('0x3')]},'starttime':{'type':Sequelize[_0x9d4f('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9d4f('0x4')]},'droptime':{'type':Sequelize[_0x9d4f('0x4')]},'endtime':{'type':Sequelize[_0x9d4f('0x4')]},'ringtime':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9d4f('0x3')]},'campaign':{'type':Sequelize[_0x9d4f('0x3')]},'campaigntype':{'type':Sequelize[_0x9d4f('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9d4f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9d4f('0x3')]},'dispositionat':{'type':Sequelize[_0x9d4f('0x4')],'set':function(_0x3ac469){var _0x398f61=this[_0x9d4f('0x6')]('endtime');if(_0x398f61&&_0x3ac469){this[_0x9d4f('0x7')](_0x9d4f('0x8'),moment(_0x3ac469)[_0x9d4f('0x9')](moment(_0x398f61),_0x9d4f('0xa')));}}},'amd':{'type':Sequelize[_0x9d4f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9d4f('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9d4f('0x4')]},'callback':{'type':Sequelize[_0x9d4f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9d4f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x9d4f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9d4f('0x4')]},'recallme':{'type':Sequelize[_0x9d4f('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9d4f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9d4f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9d4f('0x5')],'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 bf1659b..ce5ed21 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 _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x814b,0x1a2));var _0xb814=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x814b[_0x43444b];return _0x392fe5;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file +var _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x5aec6f,_0x597ce5){var _0x55fa01=function(_0x47d351){while(--_0x47d351){_0x5aec6f['push'](_0x5aec6f['shift']());}};_0x55fa01(++_0x597ce5);}(_0x6d38,0x1ef));var _0x86d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6d38[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7332d46..177b153 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 _0xd4e1=['path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4efd88,_0x57b9a3){var _0x37ca3d=function(_0x3291f5){while(--_0x3291f5){_0x4efd88['push'](_0x4efd88['shift']());}};_0x37ca3d(++_0x57b9a3);}(_0xd4e1,0x116));var _0x1d4e=function(_0x49e7f4,_0x1d1b24){_0x49e7f4=_0x49e7f4-0x0;var _0x27d188=_0xd4e1[_0x49e7f4];return _0x27d188;};'use strict';var _=require(_0x1d4e('0x0'));var util=require(_0x1d4e('0x1'));var logger=require(_0x1d4e('0x2'))(_0x1d4e('0x3'));var moment=require(_0x1d4e('0x4'));var BPromise=require(_0x1d4e('0x5'));var rp=require(_0x1d4e('0x6'));var fs=require('fs');var path=require(_0x1d4e('0x7'));var rimraf=require(_0x1d4e('0x8'));var config=require('../../config/environment');var attributes=require(_0x1d4e('0x9'));module[_0x1d4e('0xa')]=function(_0xa4607b,_0x355a0c){return _0xa4607b['define'](_0x1d4e('0xb'),attributes,{'tableName':_0x1d4e('0xc'),'paranoid':![],'indexes':[{'name':_0x1d4e('0xd'),'fields':[_0x1d4e('0xd')]},{'name':_0x1d4e('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a55=['request-promise','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','util','api','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0a55,0xc8));var _0x50a5=function(_0x4639d4,_0x5423b0){_0x4639d4=_0x4639d4-0x0;var _0x360c53=_0x0a55[_0x4639d4];return _0x360c53;};'use strict';var _=require('lodash');var util=require(_0x50a5('0x0'));var logger=require('../../config/logger')(_0x50a5('0x1'));var moment=require(_0x50a5('0x2'));var BPromise=require(_0x50a5('0x3'));var rp=require(_0x50a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50a5('0x5'));var config=require('../../config/environment');var attributes=require(_0x50a5('0x6'));module[_0x50a5('0x7')]=function(_0x2c1fa2,_0x3324e4){return _0x2c1fa2[_0x50a5('0x8')]('CmHopperFinal',attributes,{'tableName':_0x50a5('0x9'),'paranoid':![],'indexes':[{'name':_0x50a5('0xa'),'fields':[_0x50a5('0xa')]},{'name':'uniqueid','fields':[_0x50a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0aa324e..e2c99e5 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5885d9,_0x402333){var _0x5c655e=function(_0x53596c){while(--_0x53596c){_0x5885d9['push'](_0x5885d9['shift']());}};_0x5c655e(++_0x402333);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e3e59,_0x596d22){_0x1e3e59=_0x1e3e59-0x0;var _0x4cdd16=_0xb10b[_0x1e3e59];return _0x4cdd16;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x9c81b5,_0x30bce4){var _0x2c5d12=function(_0x454c8d){while(--_0x454c8d){_0x9c81b5['push'](_0x9c81b5['shift']());}};_0x2c5d12(++_0x30bce4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0xb10b[_0x5cc61d];return _0x2e25d0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e479249..a4b6140 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 _0x3e9c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer'];(function(_0x3249d6,_0x18ad8b){var _0x411b10=function(_0xdca4dc){while(--_0xdca4dc){_0x3249d6['push'](_0x3249d6['shift']());}};_0x411b10(++_0x18ad8b);}(_0x3e9c,0x6f));var _0xc3e9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3e9c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc3e9('0x0'));var util=require(_0xc3e9('0x1'));var path=require(_0xc3e9('0x2'));var timeout=require(_0xc3e9('0x3'));var express=require(_0xc3e9('0x4'));var router=express[_0xc3e9('0x5')]();var fs_extra=require(_0xc3e9('0x6'));var auth=require(_0xc3e9('0x7'));var interaction=require(_0xc3e9('0x8'));var config=require(_0xc3e9('0x9'));var controller=require(_0xc3e9('0xa'));router[_0xc3e9('0xb')]('/',auth[_0xc3e9('0xc')](),controller[_0xc3e9('0xd')]);router[_0xc3e9('0xb')](_0xc3e9('0xe'),auth[_0xc3e9('0xc')](),controller[_0xc3e9('0xf')]);router['get'](_0xc3e9('0x10'),auth[_0xc3e9('0xc')](),controller[_0xc3e9('0x11')]);router[_0xc3e9('0xb')]('/voice/queue/countAttributes/:id',auth[_0xc3e9('0xc')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xc3e9('0xb')](_0xc3e9('0x12'),auth[_0xc3e9('0xc')](),controller[_0xc3e9('0x13')]);router[_0xc3e9('0x14')](_0xc3e9('0x15'),auth[_0xc3e9('0xc')](),controller[_0xc3e9('0x16')]);router['post'](_0xc3e9('0x17'),auth['isAuthenticated'](),controller[_0xc3e9('0x18')]);router['post'](_0xc3e9('0x19'),auth[_0xc3e9('0xc')](),controller['checkContactHopper']);router[_0xc3e9('0x1a')](_0xc3e9('0x10'),auth[_0xc3e9('0xc')](),controller[_0xc3e9('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x79df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','multer','util','connect-timeout','express','Router'];(function(_0x4afa13,_0x30f801){var _0x1e1e84=function(_0x56e78c){while(--_0x56e78c){_0x4afa13['push'](_0x4afa13['shift']());}};_0x1e1e84(++_0x30f801);}(_0x79df,0xee));var _0xf79d=function(_0x31c264,_0x47b316){_0x31c264=_0x31c264-0x0;var _0x4dad86=_0x79df[_0x31c264];return _0x4dad86;};'use strict';var multer=require(_0xf79d('0x0'));var util=require(_0xf79d('0x1'));var path=require('path');var timeout=require(_0xf79d('0x2'));var express=require(_0xf79d('0x3'));var router=express[_0xf79d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf79d('0x5'));var interaction=require(_0xf79d('0x6'));var config=require(_0xf79d('0x7'));var controller=require(_0xf79d('0x8'));router[_0xf79d('0x9')]('/',auth[_0xf79d('0xa')](),controller[_0xf79d('0xb')]);router['get'](_0xf79d('0xc'),auth[_0xf79d('0xa')](),controller[_0xf79d('0xd')]);router['get'](_0xf79d('0xe'),auth[_0xf79d('0xa')](),controller[_0xf79d('0xf')]);router[_0xf79d('0x9')](_0xf79d('0x10'),auth['isAuthenticated'](),controller[_0xf79d('0x11')]);router[_0xf79d('0x9')](_0xf79d('0x12'),auth[_0xf79d('0xa')](),controller[_0xf79d('0x13')]);router['post'](_0xf79d('0x14'),auth[_0xf79d('0xa')](),controller[_0xf79d('0x15')]);router[_0xf79d('0x16')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xf79d('0x17')]);router[_0xf79d('0x16')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xf79d('0x18')]);router[_0xf79d('0x19')](_0xf79d('0xe'),auth[_0xf79d('0xa')](),controller[_0xf79d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 36b7032..668a279 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 _0xa151=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x2e6810,_0x3a2399){var _0x26f9f0=function(_0x349b20){while(--_0x349b20){_0x2e6810['push'](_0x2e6810['shift']());}};_0x26f9f0(++_0x3a2399);}(_0xa151,0x13d));var _0x1a15=function(_0x19c72a,_0x55698a){_0x19c72a=_0x19c72a-0x0;var _0x2f1152=_0xa151[_0x19c72a];return _0x2f1152;};'use strict';var Sequelize=require(_0x1a15('0x0'));module[_0x1a15('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1a15('0x2')]},'scheduledat':{'type':Sequelize[_0x1a15('0x3')]},'countbusyretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1a15('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1a15('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1a15('0x2')]},'starttime':{'type':Sequelize[_0x1a15('0x3')]},'responsetime':{'type':Sequelize[_0x1a15('0x3')]},'answertime':{'type':Sequelize[_0x1a15('0x3')]},'droptime':{'type':Sequelize[_0x1a15('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a15('0x2')]},'campaign':{'type':Sequelize[_0x1a15('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1a15('0x2')]},'reason':{'type':Sequelize[_0x1a15('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1a15('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1a15('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a15('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a15('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1a15('0x3')]},'edited':{'type':Sequelize[_0x1a15('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a15('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1a15('0x2')]}}; \ No newline at end of file +var _0x7e47=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x10b162,_0x102f2c){var _0x21310a=function(_0x2999df){while(--_0x2999df){_0x10b162['push'](_0x10b162['shift']());}};_0x21310a(++_0x102f2c);}(_0x7e47,0x19d));var _0x77e4=function(_0x431e94,_0x459b03){_0x431e94=_0x431e94-0x0;var _0x30f73f=_0x7e47[_0x431e94];return _0x30f73f;};'use strict';var Sequelize=require('sequelize');module[_0x77e4('0x0')]={'state':{'type':Sequelize[_0x77e4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x77e4('0x2')]},'scheduledat':{'type':Sequelize[_0x77e4('0x3')]},'countbusyretry':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x77e4('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x77e4('0x2')]},'calleridnum':{'type':Sequelize[_0x77e4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x77e4('0x3')]},'answertime':{'type':Sequelize[_0x77e4('0x3')]},'droptime':{'type':Sequelize[_0x77e4('0x3')]},'endtime':{'type':Sequelize[_0x77e4('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x77e4('0x2')]},'campaign':{'type':Sequelize[_0x77e4('0x2')]},'campaigntype':{'type':Sequelize[_0x77e4('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x77e4('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x77e4('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x77e4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x77e4('0x3')]},'recallme':{'type':Sequelize[_0x77e4('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x77e4('0x3')]},'edited':{'type':Sequelize[_0x77e4('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x77e4('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x77e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 79ea99a..1b89a52 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 _0x61f6=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','findAll','catch','show','params','include','options','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x61f6,0x198));var _0x661f=function(_0x5906a5,_0x48af0a){_0x5906a5=_0x5906a5-0x0;var _0x1b9a31=_0x61f6[_0x5906a5];return _0x1b9a31;};'use strict';var emlformat=require(_0x661f('0x0'));var rimraf=require(_0x661f('0x1'));var zipdir=require(_0x661f('0x2'));var jsonpatch=require(_0x661f('0x3'));var rp=require(_0x661f('0x4'));var moment=require(_0x661f('0x5'));var BPromise=require(_0x661f('0x6'));var Mustache=require(_0x661f('0x7'));var util=require(_0x661f('0x8'));var path=require(_0x661f('0x9'));var sox=require(_0x661f('0xa'));var csv=require(_0x661f('0xb'));var ejs=require(_0x661f('0xc'));var fs=require('fs');var fs_extra=require(_0x661f('0xd'));var _=require(_0x661f('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x661f('0xb'));var querystring=require(_0x661f('0xf'));var Papa=require('papaparse');var Redis=require(_0x661f('0x10'));var authService=require(_0x661f('0x11'));var qs=require(_0x661f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x661f('0x13'));var config=require(_0x661f('0x14'));var licenseUtil=require(_0x661f('0x15'));var db=require(_0x661f('0x16'))['db'];function respondWithStatusCode(_0x2d42b6,_0x185001){_0x185001=_0x185001||0xcc;return function(_0x236c5c){if(_0x236c5c){return _0x2d42b6[_0x661f('0x17')](_0x185001);}return _0x2d42b6[_0x661f('0x18')](_0x185001)['end']();};}function respondWithResult(_0x15bd92,_0x183252){_0x183252=_0x183252||0xc8;return function(_0x209cce){if(_0x209cce){return _0x15bd92[_0x661f('0x18')](_0x183252)[_0x661f('0x19')](_0x209cce);}};}function respondWithFilteredResult(_0x1245b7,_0x3c6239){return function(_0x22b232){if(_0x22b232){var _0x52f2dc=typeof _0x3c6239[_0x661f('0x1a')]===_0x661f('0x1b')&&typeof _0x3c6239[_0x661f('0x1c')]===_0x661f('0x1b');var _0x2d33ee=_0x22b232['count'];var _0xd154e4=_0x52f2dc?0x0:_0x3c6239[_0x661f('0x1a')];var _0x2e979a=_0x52f2dc?_0x22b232[_0x661f('0x1d')]:_0x3c6239[_0x661f('0x1a')]+_0x3c6239[_0x661f('0x1c')];var _0x4f0a9d;if(_0x2e979a>=_0x2d33ee){_0x2e979a=_0x2d33ee;_0x4f0a9d=0xc8;}else{_0x4f0a9d=0xce;}_0x1245b7[_0x661f('0x18')](_0x4f0a9d);return _0x1245b7['set'](_0x661f('0x1e'),_0xd154e4+'-'+_0x2e979a+'/'+_0x2d33ee)[_0x661f('0x19')](_0x22b232);}return null;};}function patchUpdates(_0x5d10b6){return function(_0x4f0488){try{jsonpatch[_0x661f('0x1f')](_0x4f0488,_0x5d10b6,!![]);}catch(_0x42c619){return BPromise[_0x661f('0x20')](_0x42c619);}return _0x4f0488[_0x661f('0x21')]();};}function saveUpdates(_0x37b97b,_0x4d9632){return function(_0x3b63dd){if(_0x3b63dd){return _0x3b63dd[_0x661f('0x22')](_0x37b97b)[_0x661f('0x23')](function(_0x1e4c90){return _0x1e4c90;});}return null;};}function removeEntity(_0x1859f0,_0x46436b){return function(_0x20fb78){if(_0x20fb78){return _0x20fb78[_0x661f('0x24')]()[_0x661f('0x23')](function(){_0x1859f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x344a49,_0x36d425){return function(_0x3bcf33){if(!_0x3bcf33){_0x344a49['sendStatus'](0x194);}return _0x3bcf33;};}function handleError(_0x29fe0e,_0x537f58){_0x537f58=_0x537f58||0x1f4;return function(_0xaaa8b7){logger[_0x661f('0x25')](_0xaaa8b7[_0x661f('0x26')]);if(_0xaaa8b7['name']){delete _0xaaa8b7[_0x661f('0x27')];}_0x29fe0e['status'](_0x537f58)[_0x661f('0x28')](_0xaaa8b7);};}exports[_0x661f('0x29')]=function(_0x327182,_0x4d3261){var _0x33e13f={},_0x3da4a2={},_0x3811c9={'count':0x0,'rows':[]};var _0x189d32=_[_0x661f('0x2a')](db[_0x661f('0x2b')][_0x661f('0x2c')],function(_0x28e267){return{'name':_0x28e267['fieldName'],'type':_0x28e267[_0x661f('0x2d')][_0x661f('0x2e')]};});_0x3da4a2[_0x661f('0x2f')]=_[_0x661f('0x2a')](_0x189d32,_0x661f('0x27'));_0x3da4a2[_0x661f('0x30')]=_[_0x661f('0x31')](_0x327182[_0x661f('0x30')]);_0x3da4a2[_0x661f('0x32')]=_[_0x661f('0x33')](_0x3da4a2[_0x661f('0x2f')],_0x3da4a2[_0x661f('0x30')]);_0x33e13f['attributes']=_[_0x661f('0x33')](_0x3da4a2[_0x661f('0x2f')],qs[_0x661f('0x34')](_0x327182[_0x661f('0x30')][_0x661f('0x34')]));_0x33e13f[_0x661f('0x35')]=_0x33e13f[_0x661f('0x35')][_0x661f('0x36')]?_0x33e13f[_0x661f('0x35')]:_0x3da4a2['model'];if(!_0x327182[_0x661f('0x30')][_0x661f('0x37')](_0x661f('0x38'))){_0x33e13f['limit']=qs[_0x661f('0x1c')](_0x327182[_0x661f('0x30')][_0x661f('0x1c')]);_0x33e13f[_0x661f('0x1a')]=qs[_0x661f('0x1a')](_0x327182[_0x661f('0x30')][_0x661f('0x1a')]);}_0x33e13f[_0x661f('0x39')]=qs[_0x661f('0x3a')](_0x327182[_0x661f('0x30')][_0x661f('0x3a')]);_0x33e13f[_0x661f('0x3b')]=qs[_0x661f('0x32')](_['pick'](_0x327182[_0x661f('0x30')],_0x3da4a2['filters']),_0x189d32);if(_0x327182['query']['filter']){_0x33e13f[_0x661f('0x3b')]=_[_0x661f('0x3c')](_0x33e13f['where'],{'$or':_[_0x661f('0x2a')](_0x189d32,function(_0x313fe3){if(_0x313fe3[_0x661f('0x2d')]!=='VIRTUAL'){var _0x222d80={};_0x222d80[_0x313fe3['name']]={'$like':'%'+_0x327182[_0x661f('0x30')][_0x661f('0x3d')]+'%'};return _0x222d80;}})});}_0x33e13f=_[_0x661f('0x3c')]({},_0x33e13f,_0x327182['options']);var _0x5664e0={'where':_0x33e13f[_0x661f('0x3b')]};return db[_0x661f('0x2b')][_0x661f('0x1d')](_0x5664e0)['then'](function(_0x45a40e){_0x3811c9[_0x661f('0x1d')]=_0x45a40e;if(_0x327182[_0x661f('0x30')][_0x661f('0x3e')]){_0x33e13f['include']=[{'all':!![]}];}return db[_0x661f('0x2b')][_0x661f('0x3f')](_0x33e13f);})[_0x661f('0x23')](function(_0x3ee99c){_0x3811c9['rows']=_0x3ee99c;return _0x3811c9;})[_0x661f('0x23')](respondWithFilteredResult(_0x4d3261,_0x33e13f))[_0x661f('0x40')](handleError(_0x4d3261,null));};exports[_0x661f('0x41')]=function(_0x1e31fa,_0x3fee6c){var _0x5c3455={'raw':!![],'where':{'id':_0x1e31fa[_0x661f('0x42')]['id']}},_0x17b40b={};_0x17b40b[_0x661f('0x2f')]=_[_0x661f('0x31')](db[_0x661f('0x2b')]['rawAttributes']);_0x17b40b[_0x661f('0x30')]=_[_0x661f('0x31')](_0x1e31fa[_0x661f('0x30')]);_0x17b40b[_0x661f('0x32')]=_[_0x661f('0x33')](_0x17b40b[_0x661f('0x2f')],_0x17b40b[_0x661f('0x30')]);_0x5c3455[_0x661f('0x35')]=_[_0x661f('0x33')](_0x17b40b[_0x661f('0x2f')],qs[_0x661f('0x34')](_0x1e31fa['query']['fields']));_0x5c3455[_0x661f('0x35')]=_0x5c3455[_0x661f('0x35')][_0x661f('0x36')]?_0x5c3455['attributes']:_0x17b40b[_0x661f('0x2f')];if(_0x1e31fa['query'][_0x661f('0x3e')]){_0x5c3455[_0x661f('0x43')]=[{'all':!![]}];}_0x5c3455=_['merge']({},_0x5c3455,_0x1e31fa[_0x661f('0x44')]);return db[_0x661f('0x2b')]['find'](_0x5c3455)[_0x661f('0x23')](handleEntityNotFound(_0x3fee6c,null))[_0x661f('0x23')](respondWithResult(_0x3fee6c,null))['catch'](handleError(_0x3fee6c,null));};exports['create']=function(_0x31e3e1,_0x4c758d){return db[_0x661f('0x2b')]['create'](_0x31e3e1[_0x661f('0x45')],{})[_0x661f('0x23')](respondWithResult(_0x4c758d,0xc9))[_0x661f('0x40')](handleError(_0x4c758d,null));};exports['describe']=function(_0x106c3f,_0x29017d){return db[_0x661f('0x2b')][_0x661f('0x46')]()['then'](respondWithResult(_0x29017d,null))[_0x661f('0x40')](handleError(_0x29017d,null));};exports[_0x661f('0x22')]=function(_0x4ac03e,_0x61b9b8){if(_0x4ac03e[_0x661f('0x45')][_0x661f('0x47')]){delete _0x4ac03e[_0x661f('0x45')]['uniqueid'];}return db[_0x661f('0x2b')][_0x661f('0x48')]({'where':{'uniqueid':_0x4ac03e[_0x661f('0x42')]['id']}})[_0x661f('0x23')](handleEntityNotFound(_0x61b9b8,null))[_0x661f('0x23')](saveUpdates(_0x4ac03e[_0x661f('0x45')],null))[_0x661f('0x23')](respondWithResult(_0x61b9b8,null))['catch'](handleError(_0x61b9b8,null));}; \ No newline at end of file +var _0x98f6=['show','params','intersection','includeAll','options','find','catch','create','body','describe','update','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows'];(function(_0x49e939,_0x281e60){var _0x4830b6=function(_0x4ae670){while(--_0x4ae670){_0x49e939['push'](_0x49e939['shift']());}};_0x4830b6(++_0x281e60);}(_0x98f6,0x1ce));var _0x698f=function(_0x4f1ff3,_0x2736a1){_0x4f1ff3=_0x4f1ff3-0x0;var _0x1768a5=_0x98f6[_0x4f1ff3];return _0x1768a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x698f('0x0'));var zipdir=require(_0x698f('0x1'));var jsonpatch=require(_0x698f('0x2'));var rp=require(_0x698f('0x3'));var moment=require(_0x698f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x698f('0x5'));var util=require(_0x698f('0x6'));var path=require(_0x698f('0x7'));var sox=require('sox');var csv=require(_0x698f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x698f('0x9'));var _=require(_0x698f('0xa'));var squel=require(_0x698f('0xb'));var crypto=require(_0x698f('0xc'));var jsforce=require(_0x698f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x698f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x698f('0xe'));var authService=require(_0x698f('0xf'));var qs=require(_0x698f('0x10'));var as=require(_0x698f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x698f('0x12'));var utils=require(_0x698f('0x13'));var config=require(_0x698f('0x14'));var licenseUtil=require(_0x698f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d781d,_0x4aa7cf){_0x4aa7cf=_0x4aa7cf||0xcc;return function(_0x2333ab){if(_0x2333ab){return _0x1d781d[_0x698f('0x16')](_0x4aa7cf);}return _0x1d781d[_0x698f('0x17')](_0x4aa7cf)['end']();};}function respondWithResult(_0x536160,_0xd25b3f){_0xd25b3f=_0xd25b3f||0xc8;return function(_0x5882a2){if(_0x5882a2){return _0x536160['status'](_0xd25b3f)[_0x698f('0x18')](_0x5882a2);}};}function respondWithFilteredResult(_0x55ca4f,_0x586d42){return function(_0x598175){if(_0x598175){var _0x39b843=typeof _0x586d42['offset']===_0x698f('0x19')&&typeof _0x586d42[_0x698f('0x1a')]===_0x698f('0x19');var _0x4b9bbe=_0x598175[_0x698f('0x1b')];var _0x541f04=_0x39b843?0x0:_0x586d42['offset'];var _0x2432ab=_0x39b843?_0x598175[_0x698f('0x1b')]:_0x586d42[_0x698f('0x1c')]+_0x586d42[_0x698f('0x1a')];var _0x5b6494;if(_0x2432ab>=_0x4b9bbe){_0x2432ab=_0x4b9bbe;_0x5b6494=0xc8;}else{_0x5b6494=0xce;}_0x55ca4f[_0x698f('0x17')](_0x5b6494);return _0x55ca4f[_0x698f('0x1d')](_0x698f('0x1e'),_0x541f04+'-'+_0x2432ab+'/'+_0x4b9bbe)[_0x698f('0x18')](_0x598175);}return null;};}function patchUpdates(_0x5ac61c){return function(_0x5f682f){try{jsonpatch['apply'](_0x5f682f,_0x5ac61c,!![]);}catch(_0xeb260c){return BPromise[_0x698f('0x1f')](_0xeb260c);}return _0x5f682f[_0x698f('0x20')]();};}function saveUpdates(_0x27508b,_0x5bb754){return function(_0x384a22){if(_0x384a22){return _0x384a22['update'](_0x27508b)[_0x698f('0x21')](function(_0x523e13){return _0x523e13;});}return null;};}function removeEntity(_0x497421,_0x29247e){return function(_0x2fb68e){if(_0x2fb68e){return _0x2fb68e[_0x698f('0x22')]()[_0x698f('0x21')](function(){_0x497421[_0x698f('0x17')](0xcc)[_0x698f('0x23')]();});}};}function handleEntityNotFound(_0x32d344,_0x3d819d){return function(_0x4ad08){if(!_0x4ad08){_0x32d344[_0x698f('0x16')](0x194);}return _0x4ad08;};}function handleError(_0x51675b,_0x2fd226){_0x2fd226=_0x2fd226||0x1f4;return function(_0x41d6da){logger['error'](_0x41d6da['stack']);if(_0x41d6da['name']){delete _0x41d6da[_0x698f('0x24')];}_0x51675b[_0x698f('0x17')](_0x2fd226)['send'](_0x41d6da);};}exports[_0x698f('0x25')]=function(_0x1df531,_0x4cfbd2){var _0x195dd6={},_0x16db6a={},_0xf482e={'count':0x0,'rows':[]};var _0xaf5d11=_[_0x698f('0x26')](db[_0x698f('0x27')][_0x698f('0x28')],function(_0x4d94f9){return{'name':_0x4d94f9[_0x698f('0x29')],'type':_0x4d94f9[_0x698f('0x2a')][_0x698f('0x2b')]};});_0x16db6a['model']=_[_0x698f('0x26')](_0xaf5d11,_0x698f('0x24'));_0x16db6a['query']=_[_0x698f('0x2c')](_0x1df531[_0x698f('0x2d')]);_0x16db6a[_0x698f('0x2e')]=_['intersection'](_0x16db6a[_0x698f('0x2f')],_0x16db6a[_0x698f('0x2d')]);_0x195dd6[_0x698f('0x30')]=_['intersection'](_0x16db6a[_0x698f('0x2f')],qs[_0x698f('0x31')](_0x1df531[_0x698f('0x2d')]['fields']));_0x195dd6[_0x698f('0x30')]=_0x195dd6['attributes'][_0x698f('0x32')]?_0x195dd6[_0x698f('0x30')]:_0x16db6a[_0x698f('0x2f')];if(!_0x1df531[_0x698f('0x2d')][_0x698f('0x33')](_0x698f('0x34'))){_0x195dd6['limit']=qs[_0x698f('0x1a')](_0x1df531[_0x698f('0x2d')][_0x698f('0x1a')]);_0x195dd6[_0x698f('0x1c')]=qs[_0x698f('0x1c')](_0x1df531[_0x698f('0x2d')]['offset']);}_0x195dd6[_0x698f('0x35')]=qs['sort'](_0x1df531['query'][_0x698f('0x36')]);_0x195dd6[_0x698f('0x37')]=qs['filters'](_[_0x698f('0x38')](_0x1df531[_0x698f('0x2d')],_0x16db6a[_0x698f('0x2e')]),_0xaf5d11);if(_0x1df531[_0x698f('0x2d')]['filter']){_0x195dd6[_0x698f('0x37')]=_[_0x698f('0x39')](_0x195dd6['where'],{'$or':_[_0x698f('0x26')](_0xaf5d11,function(_0x4d728){if(_0x4d728[_0x698f('0x2a')]!==_0x698f('0x3a')){var _0x486013={};_0x486013[_0x4d728['name']]={'$like':'%'+_0x1df531[_0x698f('0x2d')][_0x698f('0x3b')]+'%'};return _0x486013;}})});}_0x195dd6=_[_0x698f('0x39')]({},_0x195dd6,_0x1df531['options']);var _0x2048a3={'where':_0x195dd6['where']};return db[_0x698f('0x27')][_0x698f('0x1b')](_0x2048a3)['then'](function(_0x32b4e7){_0xf482e[_0x698f('0x1b')]=_0x32b4e7;if(_0x1df531[_0x698f('0x2d')]['includeAll']){_0x195dd6[_0x698f('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x698f('0x3d')](_0x195dd6);})['then'](function(_0x472d6e){_0xf482e[_0x698f('0x3e')]=_0x472d6e;return _0xf482e;})[_0x698f('0x21')](respondWithFilteredResult(_0x4cfbd2,_0x195dd6))['catch'](handleError(_0x4cfbd2,null));};exports[_0x698f('0x3f')]=function(_0x539619,_0x2820ca){var _0x48cd6d={'raw':!![],'where':{'id':_0x539619[_0x698f('0x40')]['id']}},_0x4cf503={};_0x4cf503['model']=_[_0x698f('0x2c')](db[_0x698f('0x27')]['rawAttributes']);_0x4cf503[_0x698f('0x2d')]=_[_0x698f('0x2c')](_0x539619[_0x698f('0x2d')]);_0x4cf503[_0x698f('0x2e')]=_[_0x698f('0x41')](_0x4cf503[_0x698f('0x2f')],_0x4cf503['query']);_0x48cd6d[_0x698f('0x30')]=_['intersection'](_0x4cf503[_0x698f('0x2f')],qs[_0x698f('0x31')](_0x539619[_0x698f('0x2d')]['fields']));_0x48cd6d[_0x698f('0x30')]=_0x48cd6d[_0x698f('0x30')][_0x698f('0x32')]?_0x48cd6d[_0x698f('0x30')]:_0x4cf503[_0x698f('0x2f')];if(_0x539619[_0x698f('0x2d')][_0x698f('0x42')]){_0x48cd6d['include']=[{'all':!![]}];}_0x48cd6d=_[_0x698f('0x39')]({},_0x48cd6d,_0x539619[_0x698f('0x43')]);return db['CmHopperHistory'][_0x698f('0x44')](_0x48cd6d)[_0x698f('0x21')](handleEntityNotFound(_0x2820ca,null))[_0x698f('0x21')](respondWithResult(_0x2820ca,null))[_0x698f('0x45')](handleError(_0x2820ca,null));};exports[_0x698f('0x46')]=function(_0x4650ba,_0xca6069){return db[_0x698f('0x27')]['create'](_0x4650ba[_0x698f('0x47')],{})[_0x698f('0x21')](respondWithResult(_0xca6069,0xc9))['catch'](handleError(_0xca6069,null));};exports[_0x698f('0x48')]=function(_0x47b3ee,_0x1ac541){return db[_0x698f('0x27')]['describe']()[_0x698f('0x21')](respondWithResult(_0x1ac541,null))[_0x698f('0x45')](handleError(_0x1ac541,null));};exports[_0x698f('0x49')]=function(_0x2865a9,_0x215a54){if(_0x2865a9[_0x698f('0x47')][_0x698f('0x4a')]){delete _0x2865a9[_0x698f('0x47')][_0x698f('0x4a')];}return db[_0x698f('0x27')][_0x698f('0x44')]({'where':{'uniqueid':_0x2865a9[_0x698f('0x40')]['id']}})['then'](handleEntityNotFound(_0x215a54,null))[_0x698f('0x21')](saveUpdates(_0x2865a9[_0x698f('0x47')],null))[_0x698f('0x21')](respondWithResult(_0x215a54,null))['catch'](handleError(_0x215a54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fbcfcb9..03c7ab8 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 _0x1967=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment'];(function(_0x5ebe10,_0x10e193){var _0x17b7bb=function(_0x45a02b){while(--_0x45a02b){_0x5ebe10['push'](_0x5ebe10['shift']());}};_0x17b7bb(++_0x10e193);}(_0x1967,0x173));var _0x7196=function(_0xbfbb78,_0x4e4b7b){_0xbfbb78=_0xbfbb78-0x0;var _0x1aed9d=_0x1967[_0xbfbb78];return _0x1aed9d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['endtime']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe77c=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4a847d,_0x11d612){var _0x850668=function(_0x3dc3cf){while(--_0x3dc3cf){_0x4a847d['push'](_0x4a847d['shift']());}};_0x850668(++_0x11d612);}(_0xe77c,0x176));var _0xce77=function(_0x2c976f,_0x4bd2c4){_0x2c976f=_0x2c976f-0x0;var _0x1a1227=_0xe77c[_0x2c976f];return _0x1a1227;};'use strict';var _=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var logger=require(_0xce77('0x2'))('api');var moment=require(_0xce77('0x3'));var BPromise=require(_0xce77('0x4'));var rp=require(_0xce77('0x5'));var fs=require('fs');var path=require(_0xce77('0x6'));var rimraf=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var attributes=require(_0xce77('0x9'));module['exports']=function(_0x5aea39,_0xed47c5){return _0x5aea39['define'](_0xce77('0xa'),attributes,{'tableName':_0xce77('0xb'),'paranoid':![],'indexes':[{'name':_0xce77('0xc'),'fields':['endtime']},{'name':_0xce77('0xd'),'fields':[_0xce77('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 72e84d6..5675511 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 _0x534d=['findAll','options','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','create','body','raw','debug','AvgHandleTime','CmHopperHistory'];(function(_0x23cc7d,_0x553e85){var _0x41abb3=function(_0x3cbbde){while(--_0x3cbbde){_0x23cc7d['push'](_0x23cc7d['shift']());}};_0x41abb3(++_0x553e85);}(_0x534d,0x79));var _0xd534=function(_0xb40d09,_0x33bb41){_0xb40d09=_0xb40d09-0x0;var _0x5b6705=_0x534d[_0xb40d09];return _0x5b6705;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require(_0xd534('0x3'));var rs=require(_0xd534('0x4'));var fs=require('fs');var Redis=require(_0xd534('0x5'));var db=require(_0xd534('0x6'))['db'];var utils=require(_0xd534('0x7'));var logger=require(_0xd534('0x8'))(_0xd534('0x9'));var config=require(_0xd534('0xa'));var jayson=require(_0xd534('0xb'));var client=jayson[_0xd534('0xc')][_0xd534('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db778,_0x3c8772,_0x4419ee){return new BPromise(function(_0x1a00af,_0x2be8e1){return client['request'](_0x1db778,_0x4419ee)[_0xd534('0xe')](function(_0x37a2c8){logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,_0xd534('0x11'));logger['debug'](_0xd534('0x12'),_0x3c8772,_0xd534('0x11'),JSON[_0xd534('0x13')](_0x37a2c8));if(_0x37a2c8[_0xd534('0x14')]){if(_0x37a2c8[_0xd534('0x14')][_0xd534('0x15')]===0x1f4){logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8['error']['message']);return _0x2be8e1(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);return _0x1a00af(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}else{logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,'request\x20sent');_0x1a00af(_0x37a2c8['result'][_0xd534('0x16')]);}})[_0xd534('0x17')](function(_0x398435){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3c8772,_0x398435);_0x2be8e1(_0x398435);});});}exports[_0xd534('0x18')]=function(_0x477b62){var _0x36cc6c=this;return new Promise(function(_0xb097fd,_0x4d02b1){return db['CmHopperHistory'][_0xd534('0x19')](_0x477b62[_0xd534('0x1a')],{'raw':_0x477b62['options']?_0x477b62['options'][_0xd534('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3c0f39){logger[_0xd534('0xf')](_0xd534('0x18'),_0x477b62);logger[_0xd534('0x1c')](_0xd534('0x18'),_0x477b62,JSON['stringify'](_0x3c0f39));_0xb097fd(_0x3c0f39);})['catch'](function(_0x25a176){logger['error'](_0xd534('0x18'),_0x25a176[_0xd534('0x16')],_0x477b62);_0x4d02b1(_0x36cc6c['error'](0x1f4,_0x25a176[_0xd534('0x16')]));});});};exports[_0xd534('0x1d')]=function(_0x3c030e){var _0x2e93fd=this;return new Promise(function(_0x549659,_0x526134){return db[_0xd534('0x1e')][_0xd534('0x1f')]({'raw':_0x3c030e[_0xd534('0x20')]?_0x3c030e['options'][_0xd534('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c030e[_0xd534('0x20')]?_0x3c030e[_0xd534('0x20')]['where']||null:null,'attributes':[[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db['sequelize'][_0xd534('0x23')]('id')),_0xd534('0x24')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')]['literal'](_0xd534('0x25')))),_0xd534('0x26')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x28')))),_0xd534('0x29')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize'][_0xd534('0x27')](_0xd534('0x2a')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xd534('0x21')]['fn'](_0xd534('0x2b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xd534('0x2c')))),_0xd534('0x2d')],[db['sequelize']['fn'](_0xd534('0x2b'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')]['literal'](_0xd534('0x2e')))),_0xd534('0x2f')]]})[_0xd534('0xe')](function(_0x4d9404){logger[_0xd534('0xf')](_0xd534('0x1d'),_0x3c030e);logger[_0xd534('0x1c')]('AvgHandleTime',_0x3c030e,JSON[_0xd534('0x13')](_0x4d9404));_0x549659(_0x4d9404);})[_0xd534('0x17')](function(_0x4fbd5d){logger[_0xd534('0x14')](_0xd534('0x1d'),_0x4fbd5d[_0xd534('0x16')],_0x3c030e);_0x526134(_0x2e93fd[_0xd534('0x14')](0x1f4,_0x4fbd5d['message']));});});};exports[_0xd534('0x30')]=function(_0x4ac69b){var _0x503fe7=this;return new Promise(function(_0x5bda69,_0x3d7980){return db[_0xd534('0x1e')][_0xd534('0x1f')]({'raw':_0x4ac69b[_0xd534('0x20')]?_0x4ac69b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ac69b[_0xd534('0x20')]?_0x4ac69b[_0xd534('0x20')][_0xd534('0x31')]||null:null,'attributes':[[_0xd534('0x32'),_0xd534('0x33')],[db[_0xd534('0x21')]['fn']('COUNT',db[_0xd534('0x21')]['fn']('IF',db['sequelize'][_0xd534('0x27')](_0xd534('0x34')))),_0xd534('0x35')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db['sequelize']['fn']('IF',db[_0xd534('0x21')]['literal'](_0xd534('0x36')))),_0xd534('0x37')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize']['literal'](_0xd534('0x25')))),_0xd534('0x38')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x39')))),'outboundBusyCallsDay'],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize']['literal'](_0xd534('0x3a')))),_0xd534('0x3b')],[db['sequelize']['fn'](_0xd534('0x22'),db['sequelize']['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x3c')))),'outboundDropCallsDayTimeout'],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x3d')))),_0xd534('0x3e')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xd534('0x3f')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')]('`state`\x20=\x2013,\x201,\x20null'))),_0xd534('0x40')],[db['sequelize']['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize'][_0xd534('0x27')](_0xd534('0x41')))),_0xd534('0x42')],[db[_0xd534('0x21')]['fn']('COUNT',db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x43')))),_0xd534('0x44')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xd534('0x27')](_0xd534('0x45')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xd534('0x21')]['fn']('IF',db['sequelize'][_0xd534('0x27')](_0xd534('0x46')))),_0xd534('0x44')],[db[_0xd534('0x21')]['fn']('COUNT',db[_0xd534('0x21')]['fn']('IF',db[_0xd534('0x21')][_0xd534('0x27')](_0xd534('0x47')))),_0xd534('0x48')]],'group':[_0xd534('0x32')]})[_0xd534('0xe')](function(_0x597506){logger[_0xd534('0xf')](_0xd534('0x30'),_0x4ac69b);logger['debug']('GetVoiceQueueHopperHistory',_0x4ac69b,JSON[_0xd534('0x13')](_0x597506));_0x5bda69(_0x597506);})[_0xd534('0x17')](function(_0x439d13){logger[_0xd534('0x14')](_0xd534('0x30'),_0x439d13[_0xd534('0x16')],_0x4ac69b);_0x3d7980(_0x503fe7['error'](0x1f4,_0x439d13[_0xd534('0x16')]));});});};exports[_0xd534('0x49')]=function(_0x2b140a){var _0x4c8e59=this;return new Promise(function(_0x3646a4,_0x4d11e0){return db['CmHopperHistory'][_0xd534('0x1f')]({'raw':_0x2b140a[_0xd534('0x20')]?_0x2b140a[_0xd534('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2b140a[_0xd534('0x20')]?_0x2b140a['options'][_0xd534('0x31')]||null:null,'attributes':[[_0xd534('0x32'),'name'],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db['sequelize'][_0xd534('0x23')]('id')),_0xd534('0x4a')],[db[_0xd534('0x21')]['fn'](_0xd534('0x22'),db[_0xd534('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd534('0x4b')]],'group':[_0xd534('0x32')]})['then'](function(_0x5a35d3){logger[_0xd534('0xf')](_0xd534('0x49'),_0x2b140a);logger[_0xd534('0x1c')]('GetCampaignHopperHistory',_0x2b140a,JSON['stringify'](_0x5a35d3));_0x3646a4(_0x5a35d3);})['catch'](function(_0x24112f){logger[_0xd534('0x14')]('GetCampaignHopperHistory',_0x24112f['message'],_0x2b140a);_0x4d11e0(_0x4c8e59['error'](0x1f4,_0x24112f['message']));});});}; \ No newline at end of file +var _0x323f=['outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','col','ivrAnswerCallsDay','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','CreateCmHopperHistory','body','raw','debug','catch','AvgHandleTime','CmHopperHistory','options','COUNT','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay'];(function(_0x2fc0f1,_0x2b3fe8){var _0x2cf29d=function(_0x34c668){while(--_0x34c668){_0x2fc0f1['push'](_0x2fc0f1['shift']());}};_0x2cf29d(++_0x2b3fe8);}(_0x323f,0xde));var _0xf323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x323f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf323('0x2'));var db=require(_0xf323('0x3'))['db'];var utils=require(_0xf323('0x4'));var logger=require(_0xf323('0x5'))('rpc');var config=require(_0xf323('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf323('0x7')][_0xf323('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b87cd,_0x40e29f,_0x1d6d2b){return new BPromise(function(_0x357b38,_0x3c6430){return client[_0xf323('0x9')](_0x1b87cd,_0x1d6d2b)[_0xf323('0xa')](function(_0x4b9f24){logger[_0xf323('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x40e29f,'request\x20sent');logger['debug'](_0xf323('0xc'),_0x40e29f,_0xf323('0xd'),JSON[_0xf323('0xe')](_0x4b9f24));if(_0x4b9f24['error']){if(_0x4b9f24[_0xf323('0xf')][_0xf323('0x10')]===0x1f4){logger['error'](_0xf323('0x11'),_0x40e29f,_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);return _0x3c6430(_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);}logger[_0xf323('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x40e29f,_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);return _0x357b38(_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);}else{logger['info'](_0xf323('0x11'),_0x40e29f,'request\x20sent');_0x357b38(_0x4b9f24['result'][_0xf323('0x12')]);}})['catch'](function(_0x1f49d3){logger['error'](_0xf323('0x11'),_0x40e29f,_0x1f49d3);_0x3c6430(_0x1f49d3);});});}exports[_0xf323('0x13')]=function(_0x1a1653){var _0x387e13=this;return new Promise(function(_0x1510ec,_0x305ba3){return db['CmHopperHistory']['create'](_0x1a1653[_0xf323('0x14')],{'raw':_0x1a1653['options']?_0x1a1653['options'][_0xf323('0x15')]===undefined?!![]:![]:!![]})[_0xf323('0xa')](function(_0x515c92){logger[_0xf323('0xb')](_0xf323('0x13'),_0x1a1653);logger[_0xf323('0x16')]('CreateCmHopperHistory',_0x1a1653,JSON[_0xf323('0xe')](_0x515c92));_0x1510ec(_0x515c92);})[_0xf323('0x17')](function(_0x4f1240){logger[_0xf323('0xf')](_0xf323('0x13'),_0x4f1240[_0xf323('0x12')],_0x1a1653);_0x305ba3(_0x387e13['error'](0x1f4,_0x4f1240[_0xf323('0x12')]));});});};exports[_0xf323('0x18')]=function(_0x190262){var _0x464b32=this;return new Promise(function(_0x670168,_0x1b0cf2){return db[_0xf323('0x19')]['findAll']({'raw':_0x190262[_0xf323('0x1a')]?_0x190262[_0xf323('0x1a')][_0xf323('0x15')]===undefined?!![]:![]:!![],'where':_0x190262[_0xf323('0x1a')]?_0x190262[_0xf323('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf323('0x1b'),db['sequelize']['col']('id')),_0xf323('0x1c')],[db['sequelize']['fn'](_0xf323('0x1b'),db['sequelize']['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x1f')))),_0xf323('0x20')],[db['sequelize']['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')]['literal'](_0xf323('0x21')))),_0xf323('0x22')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x23'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xf323('0x1d')]['fn'](_0xf323('0x23'),db['sequelize']['fn']('IF',db[_0xf323('0x1d')]['literal'](_0xf323('0x24')))),_0xf323('0x25')]]})['then'](function(_0x2609f1){logger[_0xf323('0xb')](_0xf323('0x18'),_0x190262);logger[_0xf323('0x16')](_0xf323('0x18'),_0x190262,JSON['stringify'](_0x2609f1));_0x670168(_0x2609f1);})[_0xf323('0x17')](function(_0x4b3c9d){logger[_0xf323('0xf')](_0xf323('0x18'),_0x4b3c9d['message'],_0x190262);_0x1b0cf2(_0x464b32[_0xf323('0xf')](0x1f4,_0x4b3c9d[_0xf323('0x12')]));});});};exports[_0xf323('0x26')]=function(_0x420443){var _0x53d535=this;return new Promise(function(_0x3d55e4,_0x13da62){return db['CmHopperHistory'][_0xf323('0x27')]({'raw':_0x420443['options']?_0x420443[_0xf323('0x1a')][_0xf323('0x15')]===undefined?!![]:![]:!![],'where':_0x420443[_0xf323('0x1a')]?_0x420443[_0xf323('0x1a')]['where']||null:null,'attributes':[[_0xf323('0x28'),_0xf323('0x29')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xf323('0x2a')))),_0xf323('0x2b')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x2c')))),_0xf323('0x2d')],[db[_0xf323('0x1d')]['fn']('COUNT',db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x1f')))),_0xf323('0x2e')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db['sequelize']['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x2f')))),_0xf323('0x30')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x31')))),_0xf323('0x32')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xf323('0x33')],[db['sequelize']['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')]['literal'](_0xf323('0x34')))),_0xf323('0x35')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0xf323('0x36')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db['sequelize']['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x37')))),_0xf323('0x38')],[db[_0xf323('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf323('0x1e')](_0xf323('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0xf323('0x3a')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db['sequelize']['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),_0xf323('0x3b')],[db[_0xf323('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x3c')))),'outboundRejectCallsDay'],[db[_0xf323('0x1d')]['fn']('COUNT',db[_0xf323('0x1d')]['fn']('IF',db[_0xf323('0x1d')][_0xf323('0x1e')](_0xf323('0x3d')))),_0xf323('0x3e')]],'group':[_0xf323('0x28')]})[_0xf323('0xa')](function(_0x229640){logger['info'](_0xf323('0x26'),_0x420443);logger[_0xf323('0x16')]('GetVoiceQueueHopperHistory',_0x420443,JSON[_0xf323('0xe')](_0x229640));_0x3d55e4(_0x229640);})[_0xf323('0x17')](function(_0x59c846){logger[_0xf323('0xf')](_0xf323('0x26'),_0x59c846['message'],_0x420443);_0x13da62(_0x53d535[_0xf323('0xf')](0x1f4,_0x59c846[_0xf323('0x12')]));});});};exports[_0xf323('0x3f')]=function(_0x1f2459){var _0xda856e=this;return new Promise(function(_0x12c9a3,_0x12d991){return db[_0xf323('0x19')][_0xf323('0x27')]({'raw':_0x1f2459['options']?_0x1f2459['options'][_0xf323('0x15')]===undefined?!![]:![]:!![],'where':_0x1f2459[_0xf323('0x1a')]?_0x1f2459[_0xf323('0x1a')][_0xf323('0x40')]||null:null,'attributes':[['campaign',_0xf323('0x29')],[db[_0xf323('0x1d')]['fn'](_0xf323('0x1b'),db[_0xf323('0x1d')][_0xf323('0x41')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf323('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xf323('0x42')]],'group':[_0xf323('0x28')]})['then'](function(_0x1bd92a){logger[_0xf323('0xb')](_0xf323('0x3f'),_0x1f2459);logger[_0xf323('0x16')]('GetCampaignHopperHistory',_0x1f2459,JSON['stringify'](_0x1bd92a));_0x12c9a3(_0x1bd92a);})[_0xf323('0x17')](function(_0x478c73){logger[_0xf323('0xf')](_0xf323('0x3f'),_0x478c73[_0xf323('0x12')],_0x1f2459);_0x12d991(_0xda856e[_0xf323('0xf')](0x1f4,_0x478c73[_0xf323('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 35d9eb7..95f0108 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 _0x0640=['describe','/:id','show','post','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe'];(function(_0x3a2a8f,_0x48ba88){var _0x18f5fb=function(_0x2a3415){while(--_0x2a3415){_0x3a2a8f['push'](_0x3a2a8f['shift']());}};_0x18f5fb(++_0x48ba88);}(_0x0640,0x197));var _0x0064=function(_0x24b292,_0x2290a5){_0x24b292=_0x24b292-0x0;var _0x283871=_0x0640[_0x24b292];return _0x283871;};'use strict';var multer=require(_0x0064('0x0'));var util=require('util');var path=require(_0x0064('0x1'));var timeout=require('connect-timeout');var express=require(_0x0064('0x2'));var router=express[_0x0064('0x3')]();var fs_extra=require(_0x0064('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0064('0x5'));var config=require(_0x0064('0x6'));var controller=require(_0x0064('0x7'));router[_0x0064('0x8')]('/',auth[_0x0064('0x9')](),controller['index']);router[_0x0064('0x8')](_0x0064('0xa'),auth[_0x0064('0x9')](),controller[_0x0064('0xb')]);router[_0x0064('0x8')](_0x0064('0xc'),auth['isAuthenticated'](),controller[_0x0064('0xd')]);router[_0x0064('0xe')]('/',auth[_0x0064('0x9')](),controller[_0x0064('0xf')]);router[_0x0064('0x10')](_0x0064('0xc'),auth[_0x0064('0x9')](),controller[_0x0064('0x11')]);module[_0x0064('0x12')]=router; \ No newline at end of file +var _0x86fe=['show','post','isAuthenticated','create','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','./cmHopperHistory.controller','get','/describe','describe'];(function(_0x5b0d7a,_0x51f9a5){var _0x519eeb=function(_0x29709e){while(--_0x29709e){_0x5b0d7a['push'](_0x5b0d7a['shift']());}};_0x519eeb(++_0x51f9a5);}(_0x86fe,0x67));var _0xe86f=function(_0x3a2c62,_0x475621){_0x3a2c62=_0x3a2c62-0x0;var _0x6c7a9e=_0x86fe[_0x3a2c62];return _0x6c7a9e;};'use strict';var multer=require('multer');var util=require(_0xe86f('0x0'));var path=require('path');var timeout=require(_0xe86f('0x1'));var express=require(_0xe86f('0x2'));var router=express[_0xe86f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe86f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe86f('0x5'));router[_0xe86f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe86f('0x7'),auth['isAuthenticated'](),controller[_0xe86f('0x8')]);router[_0xe86f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe86f('0x9')]);router[_0xe86f('0xa')]('/',auth[_0xe86f('0xb')](),controller[_0xe86f('0xc')]);router['put'](_0xe86f('0xd'),auth[_0xe86f('0xb')](),controller[_0xe86f('0xe')]);module[_0xe86f('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e8a28b9..2780c51 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 _0x32c0=['exports','name','STRING','sequelize'];(function(_0x2ad1b8,_0x1ea09b){var _0x52547d=function(_0x33b77c){while(--_0x33b77c){_0x2ad1b8['push'](_0x2ad1b8['shift']());}};_0x52547d(++_0x1ea09b);}(_0x32c0,0x1f3));var _0x032c=function(_0x1fe154,_0x3fb5e8){_0x1fe154=_0x1fe154-0x0;var _0x172f83=_0x32c0[_0x1fe154];return _0x172f83;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x032c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x032c('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x885a=['exports','STRING','name'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x885a,0x180));var _0xa885=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x885a[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'name':{'type':Sequelize[_0xa885('0x1')],'unique':_0xa885('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa885('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e5e5bb6..4bdc454 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 _0x7214=['cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','from','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','setHeader','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','Lists','UserProfileResource','error','stack','send','map','CmList','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','pick','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item'];(function(_0x43c232,_0x2a50ac){var _0x34a159=function(_0x5e2f54){while(--_0x5e2f54){_0x43c232['push'](_0x43c232['shift']());}};_0x34a159(++_0x2a50ac);}(_0x7214,0x172));var _0x4721=function(_0x5ada29,_0x339d44){_0x5ada29=_0x5ada29-0x0;var _0xb65f3=_0x7214[_0x5ada29];return _0xb65f3;};'use strict';var emlformat=require(_0x4721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4721('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4721('0x2'));var moment=require(_0x4721('0x3'));var BPromise=require(_0x4721('0x4'));var Mustache=require(_0x4721('0x5'));var util=require('util');var path=require(_0x4721('0x6'));var sox=require(_0x4721('0x7'));var csv=require(_0x4721('0x8'));var ejs=require(_0x4721('0x9'));var fs=require('fs');var fs_extra=require(_0x4721('0xa'));var _=require(_0x4721('0xb'));var squel=require(_0x4721('0xc'));var crypto=require(_0x4721('0xd'));var jsforce=require(_0x4721('0xe'));var deskjs=require(_0x4721('0xf'));var toCsv=require(_0x4721('0x8'));var querystring=require(_0x4721('0x10'));var Papa=require('papaparse');var Redis=require(_0x4721('0x11'));var authService=require(_0x4721('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4721('0x13'));var hardwareService=require(_0x4721('0x14'));var logger=require(_0x4721('0x15'))(_0x4721('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4721('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x4721('0x18')]=_[_0x4721('0x19')](config['redis'],{'host':_0x4721('0x1a'),'port':0x18eb});var socket=require(_0x4721('0x1b'))(new Redis(config['redis']));require(_0x4721('0x1c'))['register'](socket);function respondWithStatusCode(_0x424ab7,_0xd80705){_0xd80705=_0xd80705||0xcc;return function(_0xcd5148){if(_0xcd5148){return _0x424ab7[_0x4721('0x1d')](_0xd80705);}return _0x424ab7[_0x4721('0x1e')](_0xd80705)[_0x4721('0x1f')]();};}function respondWithResult(_0x3abf49,_0x40ab94){_0x40ab94=_0x40ab94||0xc8;return function(_0x518432){if(_0x518432){return _0x3abf49['status'](_0x40ab94)[_0x4721('0x20')](_0x518432);}};}function respondWithFilteredResult(_0xe72698,_0x3f096b){return function(_0x2f3e49){if(_0x2f3e49){var _0x553575=typeof _0x3f096b[_0x4721('0x21')]===_0x4721('0x22')&&typeof _0x3f096b[_0x4721('0x23')]===_0x4721('0x22');var _0x4043f1=_0x2f3e49[_0x4721('0x24')];var _0x35b563=_0x553575?0x0:_0x3f096b[_0x4721('0x21')];var _0x2efb2a=_0x553575?_0x2f3e49[_0x4721('0x24')]:_0x3f096b['offset']+_0x3f096b[_0x4721('0x23')];var _0x4e4a77;if(_0x2efb2a>=_0x4043f1){_0x2efb2a=_0x4043f1;_0x4e4a77=0xc8;}else{_0x4e4a77=0xce;}_0xe72698[_0x4721('0x1e')](_0x4e4a77);return _0xe72698[_0x4721('0x25')]('Content-Range',_0x35b563+'-'+_0x2efb2a+'/'+_0x4043f1)[_0x4721('0x20')](_0x2f3e49);}return null;};}function patchUpdates(_0x2b250c){return function(_0xd3b253){try{jsonpatch[_0x4721('0x26')](_0xd3b253,_0x2b250c,!![]);}catch(_0x27fb94){return BPromise['reject'](_0x27fb94);}return _0xd3b253[_0x4721('0x27')]();};}function saveUpdates(_0x242d10,_0x2e69dd){return function(_0x52d6f7){if(_0x52d6f7){return _0x52d6f7[_0x4721('0x28')](_0x242d10)[_0x4721('0x29')](function(_0x24179c){return _0x24179c;});}return null;};}function removeEntity(_0x32b323,_0x3fa35d){return function(_0x3fd646){if(_0x3fd646){return _0x3fd646['destroy']()[_0x4721('0x29')](function(){var _0x30d9c8=_0x3fd646['get']({'plain':!![]});var _0x35055e=_0x4721('0x2a');return db[_0x4721('0x2b')]['destroy']({'where':{'type':_0x35055e,'resourceId':_0x30d9c8['id']}})[_0x4721('0x29')](function(){return _0x3fd646;});})[_0x4721('0x29')](function(){_0x32b323[_0x4721('0x1e')](0xcc)[_0x4721('0x1f')]();});}};}function handleEntityNotFound(_0x9c5a98,_0xb20aca){return function(_0x40506f){if(!_0x40506f){_0x9c5a98[_0x4721('0x1d')](0x194);}return _0x40506f;};}function handleError(_0xf6878a,_0x1e2d8d){_0x1e2d8d=_0x1e2d8d||0x1f4;return function(_0x25a647){logger[_0x4721('0x2c')](_0x25a647[_0x4721('0x2d')]);if(_0x25a647['name']){delete _0x25a647['name'];}_0xf6878a[_0x4721('0x1e')](_0x1e2d8d)[_0x4721('0x2e')](_0x25a647);};}exports['index']=function(_0x4630f4,_0x6fd09b){var _0x4bad69={},_0x261d6e={},_0x1aa863={'count':0x0,'rows':[]};var _0x26d9dd=_[_0x4721('0x2f')](db[_0x4721('0x30')]['rawAttributes'],function(_0x42e697){return{'name':_0x42e697[_0x4721('0x31')],'type':_0x42e697[_0x4721('0x32')][_0x4721('0x33')]};});_0x261d6e['model']=_['map'](_0x26d9dd,_0x4721('0x34'));_0x261d6e[_0x4721('0x35')]=_[_0x4721('0x36')](_0x4630f4[_0x4721('0x35')]);_0x261d6e[_0x4721('0x37')]=_[_0x4721('0x38')](_0x261d6e[_0x4721('0x39')],_0x261d6e[_0x4721('0x35')]);_0x4bad69[_0x4721('0x3a')]=_[_0x4721('0x38')](_0x261d6e[_0x4721('0x39')],qs[_0x4721('0x3b')](_0x4630f4[_0x4721('0x35')][_0x4721('0x3b')]));_0x4bad69['attributes']=_0x4bad69[_0x4721('0x3a')][_0x4721('0x3c')]?_0x4bad69[_0x4721('0x3a')]:_0x261d6e[_0x4721('0x39')];if(!_0x4630f4['query'][_0x4721('0x3d')]('nolimit')){_0x4bad69[_0x4721('0x23')]=qs[_0x4721('0x23')](_0x4630f4[_0x4721('0x35')]['limit']);_0x4bad69[_0x4721('0x21')]=qs[_0x4721('0x21')](_0x4630f4[_0x4721('0x35')][_0x4721('0x21')]);}_0x4bad69[_0x4721('0x3e')]=qs['sort'](_0x4630f4[_0x4721('0x35')][_0x4721('0x3f')]);_0x4bad69[_0x4721('0x40')]=qs[_0x4721('0x37')](_['pick'](_0x4630f4[_0x4721('0x35')],_0x261d6e[_0x4721('0x37')]),_0x26d9dd);if(_0x4630f4['query'][_0x4721('0x41')]){_0x4bad69[_0x4721('0x40')]=_[_0x4721('0x42')](_0x4bad69['where'],{'$or':_['map'](_0x26d9dd,function(_0xe7eaf0){if(_0xe7eaf0[_0x4721('0x32')]!==_0x4721('0x43')){var _0x5711ce={};_0x5711ce[_0xe7eaf0['name']]={'$like':'%'+_0x4630f4['query'][_0x4721('0x41')]+'%'};return _0x5711ce;}})});}_0x4bad69=_[_0x4721('0x42')]({},_0x4bad69,_0x4630f4[_0x4721('0x44')]);var _0x26a250={'where':_0x4bad69[_0x4721('0x40')]};return db['CmList'][_0x4721('0x24')](_0x26a250)[_0x4721('0x29')](function(_0x2c511b){_0x1aa863[_0x4721('0x24')]=_0x2c511b;if(_0x4630f4[_0x4721('0x35')][_0x4721('0x45')]){_0x4bad69[_0x4721('0x46')]=[{'all':!![]}];}return db['CmList'][_0x4721('0x47')](_0x4bad69);})[_0x4721('0x29')](function(_0x585e58){_0x1aa863['rows']=_0x585e58;return _0x1aa863;})['then'](respondWithFilteredResult(_0x6fd09b,_0x4bad69))[_0x4721('0x48')](handleError(_0x6fd09b,null));};exports['show']=function(_0x25faad,_0x54804d){var _0x483513={'raw':![],'where':{'id':_0x25faad[_0x4721('0x49')]['id']}},_0x34fb97={};_0x34fb97[_0x4721('0x39')]=_[_0x4721('0x36')](db[_0x4721('0x30')][_0x4721('0x4a')]);_0x34fb97[_0x4721('0x35')]=_['keys'](_0x25faad['query']);_0x34fb97['filters']=_[_0x4721('0x38')](_0x34fb97[_0x4721('0x39')],_0x34fb97[_0x4721('0x35')]);_0x483513[_0x4721('0x3a')]=_['intersection'](_0x34fb97[_0x4721('0x39')],qs[_0x4721('0x3b')](_0x25faad[_0x4721('0x35')][_0x4721('0x3b')]));_0x483513['attributes']=_0x483513[_0x4721('0x3a')][_0x4721('0x3c')]?_0x483513['attributes']:_0x34fb97['model'];if(_0x25faad[_0x4721('0x35')]['includeAll']){_0x483513[_0x4721('0x46')]=[{'all':!![]}];}_0x483513=_[_0x4721('0x42')]({},_0x483513,_0x25faad['options']);return db[_0x4721('0x30')][_0x4721('0x4b')](_0x483513)[_0x4721('0x29')](handleEntityNotFound(_0x54804d,null))['then'](respondWithResult(_0x54804d,null))[_0x4721('0x48')](handleError(_0x54804d,null));};exports[_0x4721('0x4c')]=function(_0x100576,_0x7aa4d4){return db[_0x4721('0x30')][_0x4721('0x4c')](_0x100576[_0x4721('0x4d')],{})[_0x4721('0x29')](function(_0x3082a8){var _0xd2ce70=_0x100576[_0x4721('0x4e')][_0x4721('0x4f')]({'plain':!![]});if(!_0xd2ce70)throw new Error(_0x4721('0x50'));if(_0xd2ce70[_0x4721('0x51')]===_0x4721('0x4e')){var _0x19c56b=_0x3082a8[_0x4721('0x4f')]({'plain':!![]});var _0x49c5e8=_0x4721('0x2a');return db[_0x4721('0x52')][_0x4721('0x4b')]({'where':{'name':_0x49c5e8,'userProfileId':_0xd2ce70['userProfileId']},'raw':!![]})[_0x4721('0x29')](function(_0x4172d8){if(_0x4172d8&&_0x4172d8[_0x4721('0x53')]===0x0){return db['UserProfileResource'][_0x4721('0x4c')]({'name':_0x19c56b[_0x4721('0x34')],'resourceId':_0x19c56b['id'],'type':_0x4172d8['name'],'sectionId':_0x4172d8['id']},{})[_0x4721('0x29')](function(){return _0x3082a8;});}else{return _0x3082a8;}})[_0x4721('0x48')](function(_0x30ff62){logger[_0x4721('0x2c')](_0x4721('0x54'),_0x30ff62);throw _0x30ff62;});}return _0x3082a8;})[_0x4721('0x29')](respondWithResult(_0x7aa4d4,0xc9))[_0x4721('0x48')](handleError(_0x7aa4d4,null));};exports[_0x4721('0x28')]=function(_0x319d02,_0x45e112){if(_0x319d02[_0x4721('0x4d')]['id']){delete _0x319d02[_0x4721('0x4d')]['id'];}return db[_0x4721('0x30')]['find']({'where':{'id':_0x319d02['params']['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x45e112,null))[_0x4721('0x29')](saveUpdates(_0x319d02['body'],null))[_0x4721('0x29')](respondWithResult(_0x45e112,null))[_0x4721('0x48')](handleError(_0x45e112,null));};exports[_0x4721('0x55')]=function(_0x5b1d18,_0xcc94c7){return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x5b1d18[_0x4721('0x49')]['id']}})['then'](handleEntityNotFound(_0xcc94c7,null))[_0x4721('0x29')](removeEntity(_0xcc94c7,null))[_0x4721('0x48')](handleError(_0xcc94c7,null));};exports[_0x4721('0x56')]=function(_0x2923e5,_0x3e6e8b){return db[_0x4721('0x30')][_0x4721('0x56')]()[_0x4721('0x29')](respondWithResult(_0x3e6e8b,null))[_0x4721('0x48')](handleError(_0x3e6e8b,null));};exports[_0x4721('0x57')]=function(_0x4ca005,_0x40a8ec,_0xe41102){if(_0x4ca005[_0x4721('0x4d')]['id']){delete _0x4ca005[_0x4721('0x4d')]['id'];}return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x4ca005[_0x4721('0x49')]['id']}})['then'](handleEntityNotFound(_0x40a8ec,null))['then'](function(_0x3e7f9d){if(_0x3e7f9d){_0x4ca005[_0x4721('0x4d')][_0x4721('0x58')]=_0x3e7f9d['id'];return db[_0x4721('0x59')]['create'](_0x4ca005['body']);}})[_0x4721('0x29')](respondWithResult(_0x40a8ec,null))['catch'](handleError(_0x40a8ec,null));};exports[_0x4721('0x5a')]=function(_0xd9e0a8,_0x5c3a50,_0x441750){var _0x480487={'raw':![],'where':{}};var _0x3b0c1b={};var _0x502e2e={'count':0x0,'rows':[]};return db[_0x4721('0x30')]['findOne']({'where':{'id':_0xd9e0a8['params']['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x5c3a50,null))[_0x4721('0x29')](function(_0x409d60){if(_0x409d60){_0x3b0c1b[_0x4721('0x39')]=_[_0x4721('0x36')](db[_0x4721('0x59')][_0x4721('0x4a')]);_0x3b0c1b[_0x4721('0x35')]=_[_0x4721('0x36')](_0xd9e0a8['query']);_0x3b0c1b[_0x4721('0x37')]=_[_0x4721('0x38')](_0x3b0c1b[_0x4721('0x39')],_0x3b0c1b['query']);_0x480487['attributes']=_[_0x4721('0x38')](_0x3b0c1b['model'],qs[_0x4721('0x3b')](_0xd9e0a8['query'][_0x4721('0x3b')]));_0x480487[_0x4721('0x3a')]=_0x480487['attributes'][_0x4721('0x3c')]?_0x480487[_0x4721('0x3a')]:_0x3b0c1b[_0x4721('0x39')];if(!_0xd9e0a8[_0x4721('0x35')][_0x4721('0x3d')](_0x4721('0x5b'))){_0x480487[_0x4721('0x23')]=qs[_0x4721('0x23')](_0xd9e0a8[_0x4721('0x35')][_0x4721('0x23')]);_0x480487['offset']=qs[_0x4721('0x21')](_0xd9e0a8[_0x4721('0x35')]['offset']);}_0x480487['order']=qs[_0x4721('0x3f')](_0xd9e0a8[_0x4721('0x35')][_0x4721('0x3f')]);_0x480487[_0x4721('0x40')]=qs[_0x4721('0x37')](_[_0x4721('0x5c')](_0xd9e0a8[_0x4721('0x35')],_0x3b0c1b[_0x4721('0x37')]));_0x480487[_0x4721('0x40')][_0x4721('0x58')]=_0x409d60['id'];if(_0xd9e0a8[_0x4721('0x35')][_0x4721('0x41')]){_0x480487[_0x4721('0x40')]=_[_0x4721('0x42')](_0x480487[_0x4721('0x40')],{'$or':_[_0x4721('0x2f')](_0x480487[_0x4721('0x3a')],function(_0x18c8ad){var _0x4c3c37={};_0x4c3c37[_0x18c8ad]={'$like':'%'+_0xd9e0a8[_0x4721('0x35')][_0x4721('0x41')]+'%'};return _0x4c3c37;})});}_0x480487=_[_0x4721('0x42')]({},_0x480487,_0xd9e0a8['options']);return db[_0x4721('0x59')][_0x4721('0x24')]({'where':_0x480487['where']})[_0x4721('0x29')](function(_0x576f39){_0x502e2e[_0x4721('0x24')]=_0x576f39;if(_0xd9e0a8[_0x4721('0x35')]['includeAll']){_0x480487[_0x4721('0x46')]=[{'all':!![]}];}return db[_0x4721('0x59')][_0x4721('0x47')](_0x480487);})[_0x4721('0x29')](function(_0x5842cb){_0x502e2e[_0x4721('0x5d')]=_0x5842cb;return _0x502e2e;});}})['then'](respondWithFilteredResult(_0x5c3a50,_0x480487))['catch'](handleError(_0x5c3a50,null));};exports[_0x4721('0x5e')]=function(_0x20d814,_0x17eb2c,_0xd2c83b){return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x20d814[_0x4721('0x49')]['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x17eb2c,null))[_0x4721('0x29')](function(_0x19a260){if(_0x19a260){return _0x19a260['removeDispositions'](_0x20d814[_0x4721('0x35')][_0x4721('0x5f')]);}})[_0x4721('0x29')](respondWithStatusCode(_0x17eb2c,null))[_0x4721('0x48')](handleError(_0x17eb2c,null));};exports[_0x4721('0x60')]=function(_0x1868e5,_0x24e135,_0x5ebded){return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x1868e5['params']['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x24e135,null))[_0x4721('0x29')](function(_0x59f472){if(_0x59f472){var _0x537aad=[];var _0x281617={'success':[],'errors':[]};return db[_0x4721('0x61')]['describe']()[_0x4721('0x29')](function(_0x2f4a5e){if(_0x1868e5[_0x4721('0x4d')]['tags']&&_[_0x4721('0x62')](_0x1868e5['body'][_0x4721('0x63')])){if(_0x1868e5[_0x4721('0x4d')]['tags'][_0x4721('0x3c')]){_0x1868e5[_0x4721('0x4d')][_0x4721('0x63')]=_0x1868e5[_0x4721('0x4d')]['tags'][_0x4721('0x64')](';')+';';}else{_0x1868e5[_0x4721('0x4d')]['tags']=null;}}else{_0x1868e5['body'][_0x4721('0x63')]=null;}if(_0x1868e5['body']&&_[_0x4721('0x62')](_0x1868e5[_0x4721('0x4d')])){for(var _0x3caae8=0x0;_0x3caae8<_0x1868e5[_0x4721('0x4d')][_0x4721('0x3c')];_0x3caae8+=0x1){_0x1868e5[_0x4721('0x4d')][_0x3caae8]['ListId']=_0x1868e5[_0x4721('0x49')]['id'];_0x537aad[_0x4721('0x65')](_0x1868e5[_0x4721('0x4d')][_0x3caae8]);}return BPromise[_0x4721('0x66')](_0x537aad,function(_0x110656){return db[_0x4721('0x61')][_0x4721('0x4c')](_['omit'](_0x110656,['ids','id'])||{},{'fields':_['keys'](_0x2f4a5e),'raw':!![]})['then'](function(_0x3cd813){_0x281617['success']['push'](_0x3cd813[_0x4721('0x67')]);})[_0x4721('0x48')](function(_0x2c619d){_0x281617['errors'][_0x4721('0x65')]({'data':_0x110656,'error':_0x2c619d[_0x4721('0x68')]});});})[_0x4721('0x29')](function(_0x6f8e52){return _0x281617;})['catch'](function(_0x3d8b02){return _0x3d8b02;});}else{_0x24e135[_0x4721('0x1e')](0x190)[_0x4721('0x20')]({'message':_0x4721('0x69')});}});}})[_0x4721('0x29')](respondWithResult(_0x24e135,null))[_0x4721('0x48')](handleError(_0x24e135,null));};exports[_0x4721('0x6a')]=function(_0x1fd9eb,_0x3a9397,_0x4e9369){var _0x275817;return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x1fd9eb['params']['id']},'include':[{'model':db[_0x4721('0x6b')],'as':'CustomFields'}]})[_0x4721('0x29')](handleEntityNotFound(_0x3a9397,null))[_0x4721('0x29')](function(_0x7dde35){if(_0x7dde35){_0x275817=_0x7dde35;return db[_0x4721('0x61')][_0x4721('0x4a')];}})[_0x4721('0x29')](function(_0x59bd97){if(_0x59bd97){var _0x587393={};var _0x348963={};_0x348963['model']=_[_0x4721('0x6c')](_['keys'](_0x59bd97),_[_0x4721('0x2f')](_0x275817[_0x4721('0x6d')],function(_0x4b3a5c){return util[_0x4721('0x6e')](_0x4721('0x6f'),_0x4b3a5c['id']);}));_0x348963['query']=_[_0x4721('0x36')](_0x1fd9eb['query']);_0x348963['filters']=_[_0x4721('0x38')](_0x348963[_0x4721('0x39')],_0x348963[_0x4721('0x35')]);_0x587393[_0x4721('0x3a')]=_[_0x4721('0x38')](_0x348963[_0x4721('0x39')],qs['fields'](_0x1fd9eb[_0x4721('0x35')]['fields']));_0x587393['attributes']=_0x587393['attributes'][_0x4721('0x3c')]?_0x587393[_0x4721('0x3a')]:_0x348963[_0x4721('0x39')];if(!_0x1fd9eb['query'][_0x4721('0x3d')](_0x4721('0x5b'))){_0x587393['limit']=qs['limit'](_0x1fd9eb[_0x4721('0x35')][_0x4721('0x23')]);_0x587393[_0x4721('0x21')]=qs['offset'](_0x1fd9eb[_0x4721('0x35')][_0x4721('0x21')]);}_0x587393[_0x4721('0x3e')]=qs[_0x4721('0x3f')](_0x1fd9eb[_0x4721('0x35')][_0x4721('0x3f')]);_0x587393[_0x4721('0x40')]=qs[_0x4721('0x37')](_['pick'](_0x1fd9eb[_0x4721('0x35')],_0x348963[_0x4721('0x37')]));_0x587393[_0x4721('0x70')]=!![];if(_0x1fd9eb[_0x4721('0x35')]['filter']){_0x587393['where']=_[_0x4721('0x42')](_0x587393[_0x4721('0x40')],{'$or':_[_0x4721('0x2f')](_0x587393['attributes'],function(_0x382bca){var _0x2b8d52={};_0x2b8d52[_0x382bca]={'$like':'%'+_0x1fd9eb[_0x4721('0x35')][_0x4721('0x41')]+'%'};return _0x2b8d52;})});}_0x587393=_[_0x4721('0x42')]({},_0x587393,_0x1fd9eb[_0x4721('0x44')]);return _0x275817[_0x4721('0x6a')](_0x587393);}})[_0x4721('0x29')](respondWithResult(_0x3a9397,null))[_0x4721('0x48')](handleError(_0x3a9397,null));};exports[_0x4721('0x71')]=function(_0x1cf3f9,_0x30af7c,_0xa071ed){var _0x5a016c;var _0x3e5647;var _0xff5d9f;var _0x18a781=_0x1cf3f9['params']['id'];csv_results=[];return db[_0x4721('0x72')][_0x4721('0x47')]({'attributes':['id',_0x4721('0x34')],'raw':!![],'order':[_0x4721('0x73')]})[_0x4721('0x29')](function(_0x3b4d30){_0x5a016c=_0x3b4d30;var _0x3a5572=_[_0x4721('0x36')](db[_0x4721('0x61')][_0x4721('0x4a')]);return db[_0x4721('0x6b')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0x4721('0x29')](function(_0x19d54c){_0x3e5647=_0x19d54c;var _0x3c84bc=squel[_0x4721('0x74')]()[_0x4721('0x3b')](_0x3a5572)['from'](_0x4721('0x75'),'c')[_0x4721('0x40')](_0x4721('0x76'),_0x18a781)[_0x4721('0x40')](_0x4721('0x77'))[_0x4721('0x78')]();for(var _0x44b9b3=0x0;_0x44b9b3<_0x3e5647[_0x4721('0x3c')];_0x44b9b3++){_0x3c84bc['field'](_0x4721('0x79')+_0x3e5647[_0x44b9b3]['id'],_0x4721('0x7a')+_0x3e5647[_0x44b9b3]['alias']);}for(var _0x44b9b3=0x0;_0x44b9b3<_0x5a016c[_0x4721('0x3c')];_0x44b9b3++){_0x3c84bc['field'](squel['select']()[_0x4721('0x7b')](_0x4721('0x7c'))['from'](_0x4721('0x7d'))[_0x4721('0x40')]('ItemTypeId\x20=\x20?',_0x5a016c[_0x44b9b3]['id'])[_0x4721('0x40')](_0x4721('0x7e')),_0x4721('0x7f')+_0x5a016c[_0x44b9b3][_0x4721('0x34')]);_0x3c84bc[_0x4721('0x7b')](squel[_0x4721('0x74')]()['field'](_0x4721('0x80'))[_0x4721('0x81')](_0x4721('0x7d'))[_0x4721('0x40')](_0x4721('0x82'),_0x5a016c[_0x44b9b3]['id'])[_0x4721('0x40')](_0x4721('0x7e')),_0x4721('0x83')+_0x5a016c[_0x44b9b3][_0x4721('0x34')]);}var _0x531363=[];_0x531363[_0x4721('0x65')](_0x3c84bc['toString']());BPromise[_0x4721('0x66')](_0x531363,handleQuery)[_0x4721('0x29')](function(_0x550d93){handleQuery(_0x3c84bc[_0x4721('0x84')]());var _0xaf8232=csv_results[0x0];if(!_['isEmpty'](_0xaf8232)){var _0xad4413=toCsv(_0xaf8232);var _0x2a2af2=Date[_0x4721('0x85')]();fs[_0x4721('0x86')](util[_0x4721('0x6e')]('/tmp/list_%d_%s.csv',_0x18a781,_0x2a2af2),_0xad4413);_0x30af7c[_0x4721('0x87')]('Content-disposition','attachment;\x20filename='+util[_0x4721('0x6e')](_0x4721('0x88'),_0x18a781,_0x2a2af2));_0x30af7c[_0x4721('0x87')](_0x4721('0x89'),_0x4721('0x8a'));return _0x30af7c[_0x4721('0x8b')](util[_0x4721('0x6e')](_0x4721('0x8c'),_0x18a781,_0x2a2af2));}else{return _0x30af7c[_0x4721('0x1d')](0xcc);}});});});};exports['addCustomField']=function(_0x15aca4,_0x31536a,_0x12e6ef){var _0x463e85;delete _0x15aca4[_0x4721('0x4d')]['id'];return db['CmList'][_0x4721('0x8d')]({'where':{'id':_0x15aca4[_0x4721('0x49')]['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x31536a,null))[_0x4721('0x29')](function(_0x53d649){if(_0x53d649){return db[_0x4721('0x8e')]['transaction'](function(_0x273f82){return db['CmCustomField'][_0x4721('0x4c')](_0x15aca4[_0x4721('0x4d')],{'transaction':_0x273f82})[_0x4721('0x29')](function(_0x5272e1){_0x463e85=_0x5272e1;return _0x53d649[_0x4721('0x8f')](_0x5272e1,{'transaction':_0x273f82});})[_0x4721('0x29')](function(){var _0x33c97a={'type':db[_0x4721('0x90')][_0x4721('0x91')],'transaction':_0x273f82};switch(_0x15aca4[_0x4721('0x4d')][_0x4721('0x32')]){case _0x4721('0x92'):_0x33c97a[_0x4721('0x32')]=db['Sequelize'][_0x4721('0x91')];break;case _0x4721('0x93'):_0x33c97a[_0x4721('0x32')]=db[_0x4721('0x90')][_0x4721('0x94')];break;case _0x4721('0x95'):_0x33c97a[_0x4721('0x32')]=db[_0x4721('0x90')][_0x4721('0x96')];_0x33c97a[_0x4721('0x97')]=![];break;default:}return db[_0x4721('0x8e')][_0x4721('0x98')][_0x4721('0x99')](_0x4721('0x75'),util[_0x4721('0x6e')]('cf_%s',_0x463e85['id']),_0x33c97a);})[_0x4721('0x29')](function(){return _0x463e85;});});}})['then'](respondWithResult(_0x31536a,null))['catch'](handleError(_0x31536a,null));};exports[_0x4721('0x9a')]=function(_0x72689c,_0x1f86e7,_0x4b9955){var _0x317bcb={};var _0x354aa2={};var _0x24950d;var _0x34e2ca;return db[_0x4721('0x30')][_0x4721('0x8d')]({'where':{'id':_0x72689c['params']['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x1f86e7,null))[_0x4721('0x29')](function(_0x4f10cf){if(_0x4f10cf){_0x24950d=_0x4f10cf;_0x354aa2[_0x4721('0x39')]=_[_0x4721('0x36')](db['CmCustomField']['rawAttributes']);_0x354aa2[_0x4721('0x35')]=_[_0x4721('0x36')](_0x72689c['query']);_0x354aa2[_0x4721('0x37')]=_[_0x4721('0x38')](_0x354aa2[_0x4721('0x39')],_0x354aa2[_0x4721('0x35')]);_0x317bcb[_0x4721('0x3a')]=_[_0x4721('0x38')](_0x354aa2['model'],qs[_0x4721('0x3b')](_0x72689c[_0x4721('0x35')][_0x4721('0x3b')]));_0x317bcb[_0x4721('0x3a')]=_0x317bcb['attributes'][_0x4721('0x3c')]?_0x317bcb[_0x4721('0x3a')]:_0x354aa2[_0x4721('0x39')];_0x317bcb[_0x4721('0x3e')]=qs['sort'](_0x72689c[_0x4721('0x35')][_0x4721('0x3f')]);_0x317bcb[_0x4721('0x40')]=qs[_0x4721('0x37')](_[_0x4721('0x5c')](_0x72689c[_0x4721('0x35')],_0x354aa2[_0x4721('0x37')]));_0x317bcb['where']=_[_0x4721('0x42')](_0x317bcb[_0x4721('0x40')],{'$or':[{'ListId':_0x4f10cf['id']},{'ListId':null}]});if(_0x72689c[_0x4721('0x35')][_0x4721('0x41')]){_0x317bcb[_0x4721('0x40')]=_[_0x4721('0x42')](_0x317bcb[_0x4721('0x40')],{'$or':_[_0x4721('0x2f')](_0x317bcb[_0x4721('0x3a')],function(_0x44e8eb){var _0x428cea={};_0x428cea[_0x44e8eb]={'$like':'%'+_0x72689c[_0x4721('0x35')][_0x4721('0x41')]+'%'};return _0x428cea;})});}_0x317bcb=_[_0x4721('0x42')]({},_0x317bcb,_0x72689c[_0x4721('0x44')]);return db[_0x4721('0x6b')][_0x4721('0x9b')](_0x317bcb);}})[_0x4721('0x29')](respondWithResult(_0x1f86e7,null))['catch'](handleError(_0x1f86e7,null));};exports['getGlobalCustomFields']=function(_0x315c6c,_0xc54344){return db[_0x4721('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x4721('0x29')](handleEntityNotFound(_0xc54344,null))[_0x4721('0x29')](function(_0x530fa8){return _0x530fa8;})[_0x4721('0x29')](respondWithResult(_0xc54344,null))[_0x4721('0x48')](handleError(_0xc54344,null));};exports[_0x4721('0x9c')]=function(_0x4b5a59,_0x2b0bcf,_0x46016a){return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x4b5a59[_0x4721('0x49')]['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x2b0bcf,null))[_0x4721('0x29')](function(_0x47964f){if(_0x47964f){return _0x47964f[_0x4721('0x9c')](_0x4b5a59[_0x4721('0x4d')][_0x4721('0x5f')],_[_0x4721('0x9d')](_0x4b5a59[_0x4721('0x4d')],['ids','id'])||{})[_0x4721('0x9e')](function(_0x1d8a66){for(var _0xe3da6a=0x0;_0xe3da6a<_0x4b5a59[_0x4721('0x4d')][_0x4721('0x5f')][_0x4721('0x3c')];_0xe3da6a+=0x1){socket['emit'](_0x4721('0x9f'),{'UserId':Number(_0x4b5a59[_0x4721('0x4d')][_0x4721('0x5f')][_0xe3da6a]),'CmListId':Number(_0x4b5a59[_0x4721('0x49')]['id'])});}return _0x1d8a66;});}})[_0x4721('0x29')](respondWithResult(_0x2b0bcf,null))['catch'](handleError(_0x2b0bcf,null));};exports[_0x4721('0xa0')]=function(_0x34f91a,_0x1634a7,_0x4ce0c6){return db[_0x4721('0x30')][_0x4721('0x4b')]({'where':{'id':_0x34f91a['params']['id']}})['then'](handleEntityNotFound(_0x1634a7,null))[_0x4721('0x29')](function(_0x3a624d){if(_0x3a624d){return _0x3a624d['removeAgents'](_0x34f91a[_0x4721('0x35')][_0x4721('0x5f')])['then'](function(){if(_[_0x4721('0x62')](_0x34f91a['query'][_0x4721('0x5f')])){for(var _0x36b19f=0x0;_0x36b19f<_0x34f91a[_0x4721('0x35')][_0x4721('0x5f')][_0x4721('0x3c')];_0x36b19f+=0x1){socket[_0x4721('0xa1')]('userCmList:remove',{'UserId':Number(_0x34f91a[_0x4721('0x35')][_0x4721('0x5f')][_0x36b19f]),'CmListId':Number(_0x34f91a['params']['id'])});}}else{socket['emit'](_0x4721('0xa2'),{'UserId':Number(_0x34f91a['query'][_0x4721('0x5f')]),'CmListId':Number(_0x34f91a[_0x4721('0x49')]['id'])});}});}})[_0x4721('0x29')](respondWithStatusCode(_0x1634a7,null))[_0x4721('0x48')](handleError(_0x1634a7,null));};exports[_0x4721('0xa3')]=function(_0x5e46c5,_0x2dbd81,_0x5165eb){var _0x3ab944={};var _0x55af0f={};var _0x1c4fad;var _0x180c34;return db[_0x4721('0x30')]['findOne']({'where':{'id':_0x5e46c5[_0x4721('0x49')]['id']}})[_0x4721('0x29')](handleEntityNotFound(_0x2dbd81,null))[_0x4721('0x29')](function(_0x54e4f7){if(_0x54e4f7){_0x1c4fad=_0x54e4f7;_0x55af0f[_0x4721('0x39')]=_[_0x4721('0x36')](db[_0x4721('0xa4')][_0x4721('0x4a')]);_0x55af0f[_0x4721('0x35')]=_[_0x4721('0x36')](_0x5e46c5[_0x4721('0x35')]);_0x55af0f[_0x4721('0x37')]=_[_0x4721('0x38')](_0x55af0f['model'],_0x55af0f['query']);_0x3ab944[_0x4721('0x3a')]=_[_0x4721('0x38')](_0x55af0f[_0x4721('0x39')],qs[_0x4721('0x3b')](_0x5e46c5[_0x4721('0x35')]['fields']));_0x3ab944[_0x4721('0x3a')]=_0x3ab944['attributes'][_0x4721('0x3c')]?_0x3ab944[_0x4721('0x3a')]:_0x55af0f[_0x4721('0x39')];_0x3ab944[_0x4721('0x3e')]=qs['sort'](_0x5e46c5['query'][_0x4721('0x3f')]);_0x3ab944[_0x4721('0x40')]=qs[_0x4721('0x37')](_[_0x4721('0x5c')](_0x5e46c5[_0x4721('0x35')],_0x55af0f['filters']));if(_0x5e46c5[_0x4721('0x35')][_0x4721('0x41')]){_0x3ab944[_0x4721('0x40')]=_['merge'](_0x3ab944['where'],{'$or':_[_0x4721('0x2f')](_0x3ab944['attributes'],function(_0x1ebc50){var _0xf71744={};_0xf71744[_0x1ebc50]={'$like':'%'+_0x5e46c5['query'][_0x4721('0x41')]+'%'};return _0xf71744;})});}_0x3ab944=_[_0x4721('0x42')]({},_0x3ab944,_0x5e46c5[_0x4721('0x44')]);return _0x1c4fad[_0x4721('0xa3')](_0x3ab944);}})[_0x4721('0x29')](function(_0x2b621d){if(_0x2b621d){_0x180c34=_0x2b621d[_0x4721('0x3c')];if(!_0x5e46c5[_0x4721('0x35')]['hasOwnProperty'](_0x4721('0x5b'))){_0x3ab944[_0x4721('0x23')]=qs[_0x4721('0x23')](_0x5e46c5[_0x4721('0x35')][_0x4721('0x23')]);_0x3ab944[_0x4721('0x21')]=qs[_0x4721('0x21')](_0x5e46c5[_0x4721('0x35')][_0x4721('0x21')]);}return _0x1c4fad[_0x4721('0xa3')](_0x3ab944);}})['then'](function(_0x292cfc){if(_0x292cfc){return _0x292cfc?{'count':_0x180c34,'rows':_0x292cfc}:null;}})['then'](respondWithResult(_0x2dbd81,null))[_0x4721('0x48')](handleError(_0x2dbd81,null));};function handleQuery(_0x5c9fe7){logger['info'](_0x5c9fe7);return db[_0x4721('0x8e')][_0x4721('0x35')](_0x5c9fe7)[_0x4721('0x9e')](function(_0x3c0a8d){csv_results[_0x4721('0x65')](_0x3c0a8d);})[_0x4721('0x48')](function(_0x576417){logger[_0x4721('0x2c')](_0x576417['message']);});} \ No newline at end of file +var _0x5393=['send','index','map','CmList','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','params','includeAll','options','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','OrderBy','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','c.cf_','customField_','alias','field','item','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','text/csv','download','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./cmList.socket','register','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x5393,0x1ab));var _0x3539=function(_0x4a4116,_0x1eb092){_0x4a4116=_0x4a4116-0x0;var _0x20d6e1=_0x5393[_0x4a4116];return _0x20d6e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3539('0x0'));var rp=require(_0x3539('0x1'));var moment=require(_0x3539('0x2'));var BPromise=require(_0x3539('0x3'));var Mustache=require(_0x3539('0x4'));var util=require(_0x3539('0x5'));var path=require(_0x3539('0x6'));var sox=require(_0x3539('0x7'));var csv=require(_0x3539('0x8'));var ejs=require(_0x3539('0x9'));var fs=require('fs');var fs_extra=require(_0x3539('0xa'));var _=require(_0x3539('0xb'));var squel=require(_0x3539('0xc'));var crypto=require(_0x3539('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3539('0xe'));var toCsv=require(_0x3539('0x8'));var querystring=require(_0x3539('0xf'));var Papa=require(_0x3539('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3539('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3539('0x12'))('api');var utils=require(_0x3539('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3539('0x14'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x3539('0x15')]=_[_0x3539('0x16')](config['redis'],{'host':_0x3539('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3539('0x18'))[_0x3539('0x19')](socket);function respondWithStatusCode(_0x354790,_0x203bfb){_0x203bfb=_0x203bfb||0xcc;return function(_0x1ae85f){if(_0x1ae85f){return _0x354790['sendStatus'](_0x203bfb);}return _0x354790['status'](_0x203bfb)[_0x3539('0x1a')]();};}function respondWithResult(_0x485d9b,_0x1aab1c){_0x1aab1c=_0x1aab1c||0xc8;return function(_0x3a8b36){if(_0x3a8b36){return _0x485d9b[_0x3539('0x1b')](_0x1aab1c)[_0x3539('0x1c')](_0x3a8b36);}};}function respondWithFilteredResult(_0x4340cb,_0x253148){return function(_0x2c355e){if(_0x2c355e){var _0x27f1a7=typeof _0x253148[_0x3539('0x1d')]==='undefined'&&typeof _0x253148[_0x3539('0x1e')]==='undefined';var _0x3465b1=_0x2c355e[_0x3539('0x1f')];var _0x1d3ab3=_0x27f1a7?0x0:_0x253148['offset'];var _0x20a568=_0x27f1a7?_0x2c355e[_0x3539('0x1f')]:_0x253148[_0x3539('0x1d')]+_0x253148[_0x3539('0x1e')];var _0x2dd041;if(_0x20a568>=_0x3465b1){_0x20a568=_0x3465b1;_0x2dd041=0xc8;}else{_0x2dd041=0xce;}_0x4340cb[_0x3539('0x1b')](_0x2dd041);return _0x4340cb[_0x3539('0x20')](_0x3539('0x21'),_0x1d3ab3+'-'+_0x20a568+'/'+_0x3465b1)['json'](_0x2c355e);}return null;};}function patchUpdates(_0x189629){return function(_0x46c6c4){try{jsonpatch[_0x3539('0x22')](_0x46c6c4,_0x189629,!![]);}catch(_0x3670f6){return BPromise[_0x3539('0x23')](_0x3670f6);}return _0x46c6c4[_0x3539('0x24')]();};}function saveUpdates(_0x183202,_0x309cce){return function(_0x206e68){if(_0x206e68){return _0x206e68[_0x3539('0x25')](_0x183202)[_0x3539('0x26')](function(_0x318a41){return _0x318a41;});}return null;};}function removeEntity(_0x4e7007,_0x3c27d8){return function(_0x4716a8){if(_0x4716a8){return _0x4716a8['destroy']()['then'](function(){var _0x2b1c67=_0x4716a8[_0x3539('0x27')]({'plain':!![]});var _0x6079a5=_0x3539('0x28');return db[_0x3539('0x29')][_0x3539('0x2a')]({'where':{'type':_0x6079a5,'resourceId':_0x2b1c67['id']}})['then'](function(){return _0x4716a8;});})[_0x3539('0x26')](function(){_0x4e7007[_0x3539('0x1b')](0xcc)[_0x3539('0x1a')]();});}};}function handleEntityNotFound(_0x4b7725,_0x39df4f){return function(_0x26ca08){if(!_0x26ca08){_0x4b7725[_0x3539('0x2b')](0x194);}return _0x26ca08;};}function handleError(_0x51b7a7,_0x5003cf){_0x5003cf=_0x5003cf||0x1f4;return function(_0x103090){logger[_0x3539('0x2c')](_0x103090[_0x3539('0x2d')]);if(_0x103090[_0x3539('0x2e')]){delete _0x103090[_0x3539('0x2e')];}_0x51b7a7[_0x3539('0x1b')](_0x5003cf)[_0x3539('0x2f')](_0x103090);};}exports[_0x3539('0x30')]=function(_0x10ac76,_0x246be8){var _0x24f360={},_0xc3595f={},_0x448dd1={'count':0x0,'rows':[]};var _0x490cfe=_[_0x3539('0x31')](db[_0x3539('0x32')][_0x3539('0x33')],function(_0x494176){return{'name':_0x494176['fieldName'],'type':_0x494176[_0x3539('0x34')]['key']};});_0xc3595f[_0x3539('0x35')]=_[_0x3539('0x31')](_0x490cfe,_0x3539('0x2e'));_0xc3595f[_0x3539('0x36')]=_[_0x3539('0x37')](_0x10ac76['query']);_0xc3595f[_0x3539('0x38')]=_[_0x3539('0x39')](_0xc3595f[_0x3539('0x35')],_0xc3595f[_0x3539('0x36')]);_0x24f360['attributes']=_[_0x3539('0x39')](_0xc3595f[_0x3539('0x35')],qs[_0x3539('0x3a')](_0x10ac76['query'][_0x3539('0x3a')]));_0x24f360[_0x3539('0x3b')]=_0x24f360[_0x3539('0x3b')][_0x3539('0x3c')]?_0x24f360[_0x3539('0x3b')]:_0xc3595f[_0x3539('0x35')];if(!_0x10ac76[_0x3539('0x36')][_0x3539('0x3d')](_0x3539('0x3e'))){_0x24f360['limit']=qs[_0x3539('0x1e')](_0x10ac76[_0x3539('0x36')][_0x3539('0x1e')]);_0x24f360[_0x3539('0x1d')]=qs[_0x3539('0x1d')](_0x10ac76[_0x3539('0x36')][_0x3539('0x1d')]);}_0x24f360[_0x3539('0x3f')]=qs[_0x3539('0x40')](_0x10ac76[_0x3539('0x36')][_0x3539('0x40')]);_0x24f360[_0x3539('0x41')]=qs[_0x3539('0x38')](_[_0x3539('0x42')](_0x10ac76[_0x3539('0x36')],_0xc3595f['filters']),_0x490cfe);if(_0x10ac76[_0x3539('0x36')]['filter']){_0x24f360[_0x3539('0x41')]=_[_0x3539('0x43')](_0x24f360[_0x3539('0x41')],{'$or':_['map'](_0x490cfe,function(_0xda9a15){if(_0xda9a15[_0x3539('0x34')]!==_0x3539('0x44')){var _0x9a9d3b={};_0x9a9d3b[_0xda9a15[_0x3539('0x2e')]]={'$like':'%'+_0x10ac76[_0x3539('0x36')][_0x3539('0x45')]+'%'};return _0x9a9d3b;}})});}_0x24f360=_['merge']({},_0x24f360,_0x10ac76['options']);var _0x58f65d={'where':_0x24f360['where']};return db[_0x3539('0x32')][_0x3539('0x1f')](_0x58f65d)[_0x3539('0x26')](function(_0x1b443f){_0x448dd1['count']=_0x1b443f;if(_0x10ac76['query']['includeAll']){_0x24f360[_0x3539('0x46')]=[{'all':!![]}];}return db['CmList'][_0x3539('0x47')](_0x24f360);})[_0x3539('0x26')](function(_0x3252d1){_0x448dd1[_0x3539('0x48')]=_0x3252d1;return _0x448dd1;})[_0x3539('0x26')](respondWithFilteredResult(_0x246be8,_0x24f360))['catch'](handleError(_0x246be8,null));};exports['show']=function(_0x3fd7bd,_0x36c11e){var _0x4d4a17={'raw':![],'where':{'id':_0x3fd7bd[_0x3539('0x49')]['id']}},_0x643c3b={};_0x643c3b[_0x3539('0x35')]=_[_0x3539('0x37')](db[_0x3539('0x32')][_0x3539('0x33')]);_0x643c3b[_0x3539('0x36')]=_[_0x3539('0x37')](_0x3fd7bd['query']);_0x643c3b[_0x3539('0x38')]=_[_0x3539('0x39')](_0x643c3b[_0x3539('0x35')],_0x643c3b['query']);_0x4d4a17['attributes']=_[_0x3539('0x39')](_0x643c3b[_0x3539('0x35')],qs['fields'](_0x3fd7bd[_0x3539('0x36')]['fields']));_0x4d4a17[_0x3539('0x3b')]=_0x4d4a17[_0x3539('0x3b')][_0x3539('0x3c')]?_0x4d4a17[_0x3539('0x3b')]:_0x643c3b['model'];if(_0x3fd7bd[_0x3539('0x36')][_0x3539('0x4a')]){_0x4d4a17[_0x3539('0x46')]=[{'all':!![]}];}_0x4d4a17=_['merge']({},_0x4d4a17,_0x3fd7bd[_0x3539('0x4b')]);return db[_0x3539('0x32')]['find'](_0x4d4a17)[_0x3539('0x26')](handleEntityNotFound(_0x36c11e,null))[_0x3539('0x26')](respondWithResult(_0x36c11e,null))[_0x3539('0x4c')](handleError(_0x36c11e,null));};exports['create']=function(_0x119f80,_0x44f0ab){return db[_0x3539('0x32')]['create'](_0x119f80[_0x3539('0x4d')],{})[_0x3539('0x26')](function(_0x281a13){var _0x4b3be4=_0x119f80['user']['get']({'plain':!![]});if(!_0x4b3be4)throw new Error(_0x3539('0x4e'));if(_0x4b3be4[_0x3539('0x4f')]===_0x3539('0x50')){var _0x5b7c1b=_0x281a13['get']({'plain':!![]});var _0x14ff5b='Lists';return db[_0x3539('0x51')][_0x3539('0x52')]({'where':{'name':_0x14ff5b,'userProfileId':_0x4b3be4[_0x3539('0x53')]},'raw':!![]})[_0x3539('0x26')](function(_0xef8dc8){if(_0xef8dc8&&_0xef8dc8[_0x3539('0x54')]===0x0){return db[_0x3539('0x29')]['create']({'name':_0x5b7c1b[_0x3539('0x2e')],'resourceId':_0x5b7c1b['id'],'type':_0xef8dc8[_0x3539('0x2e')],'sectionId':_0xef8dc8['id']},{})[_0x3539('0x26')](function(){return _0x281a13;});}else{return _0x281a13;}})[_0x3539('0x4c')](function(_0xfc98f1){logger[_0x3539('0x2c')](_0x3539('0x55'),_0xfc98f1);throw _0xfc98f1;});}return _0x281a13;})[_0x3539('0x26')](respondWithResult(_0x44f0ab,0xc9))[_0x3539('0x4c')](handleError(_0x44f0ab,null));};exports[_0x3539('0x25')]=function(_0x16b7ba,_0x14cfaf){if(_0x16b7ba[_0x3539('0x4d')]['id']){delete _0x16b7ba[_0x3539('0x4d')]['id'];}return db[_0x3539('0x32')][_0x3539('0x52')]({'where':{'id':_0x16b7ba[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x14cfaf,null))[_0x3539('0x26')](saveUpdates(_0x16b7ba['body'],null))[_0x3539('0x26')](respondWithResult(_0x14cfaf,null))[_0x3539('0x4c')](handleError(_0x14cfaf,null));};exports[_0x3539('0x2a')]=function(_0x259651,_0x2094d2){return db[_0x3539('0x32')]['find']({'where':{'id':_0x259651['params']['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x2094d2,null))[_0x3539('0x26')](removeEntity(_0x2094d2,null))[_0x3539('0x4c')](handleError(_0x2094d2,null));};exports[_0x3539('0x56')]=function(_0x5ce786,_0x42a172){return db[_0x3539('0x32')][_0x3539('0x56')]()[_0x3539('0x26')](respondWithResult(_0x42a172,null))['catch'](handleError(_0x42a172,null));};exports[_0x3539('0x57')]=function(_0x311e77,_0x51960c,_0x1a1bed){if(_0x311e77['body']['id']){delete _0x311e77['body']['id'];}return db[_0x3539('0x32')][_0x3539('0x52')]({'where':{'id':_0x311e77[_0x3539('0x49')]['id']}})['then'](handleEntityNotFound(_0x51960c,null))[_0x3539('0x26')](function(_0x4b824e){if(_0x4b824e){_0x311e77[_0x3539('0x4d')][_0x3539('0x58')]=_0x4b824e['id'];return db[_0x3539('0x59')][_0x3539('0x5a')](_0x311e77[_0x3539('0x4d')]);}})[_0x3539('0x26')](respondWithResult(_0x51960c,null))[_0x3539('0x4c')](handleError(_0x51960c,null));};exports[_0x3539('0x5b')]=function(_0x15d258,_0x3c146f,_0x9fdf0b){var _0x1c8f41={'raw':![],'where':{}};var _0x30dd41={};var _0x49e0c8={'count':0x0,'rows':[]};return db['CmList'][_0x3539('0x5c')]({'where':{'id':_0x15d258['params']['id']}})['then'](handleEntityNotFound(_0x3c146f,null))['then'](function(_0xfa102a){if(_0xfa102a){_0x30dd41['model']=_['keys'](db[_0x3539('0x59')]['rawAttributes']);_0x30dd41[_0x3539('0x36')]=_[_0x3539('0x37')](_0x15d258[_0x3539('0x36')]);_0x30dd41[_0x3539('0x38')]=_[_0x3539('0x39')](_0x30dd41['model'],_0x30dd41[_0x3539('0x36')]);_0x1c8f41[_0x3539('0x3b')]=_['intersection'](_0x30dd41['model'],qs[_0x3539('0x3a')](_0x15d258[_0x3539('0x36')][_0x3539('0x3a')]));_0x1c8f41[_0x3539('0x3b')]=_0x1c8f41['attributes'][_0x3539('0x3c')]?_0x1c8f41[_0x3539('0x3b')]:_0x30dd41[_0x3539('0x35')];if(!_0x15d258[_0x3539('0x36')][_0x3539('0x3d')](_0x3539('0x3e'))){_0x1c8f41[_0x3539('0x1e')]=qs[_0x3539('0x1e')](_0x15d258[_0x3539('0x36')][_0x3539('0x1e')]);_0x1c8f41[_0x3539('0x1d')]=qs['offset'](_0x15d258[_0x3539('0x36')][_0x3539('0x1d')]);}_0x1c8f41[_0x3539('0x3f')]=qs['sort'](_0x15d258[_0x3539('0x36')][_0x3539('0x40')]);_0x1c8f41[_0x3539('0x41')]=qs[_0x3539('0x38')](_[_0x3539('0x42')](_0x15d258[_0x3539('0x36')],_0x30dd41[_0x3539('0x38')]));_0x1c8f41[_0x3539('0x41')]['ListId']=_0xfa102a['id'];if(_0x15d258[_0x3539('0x36')][_0x3539('0x45')]){_0x1c8f41[_0x3539('0x41')]=_['merge'](_0x1c8f41[_0x3539('0x41')],{'$or':_[_0x3539('0x31')](_0x1c8f41[_0x3539('0x3b')],function(_0x48090e){var _0xc14849={};_0xc14849[_0x48090e]={'$like':'%'+_0x15d258[_0x3539('0x36')][_0x3539('0x45')]+'%'};return _0xc14849;})});}_0x1c8f41=_[_0x3539('0x43')]({},_0x1c8f41,_0x15d258[_0x3539('0x4b')]);return db[_0x3539('0x59')][_0x3539('0x1f')]({'where':_0x1c8f41['where']})['then'](function(_0x5c1c52){_0x49e0c8[_0x3539('0x1f')]=_0x5c1c52;if(_0x15d258[_0x3539('0x36')][_0x3539('0x4a')]){_0x1c8f41[_0x3539('0x46')]=[{'all':!![]}];}return db[_0x3539('0x59')]['findAll'](_0x1c8f41);})[_0x3539('0x26')](function(_0x3ce154){_0x49e0c8['rows']=_0x3ce154;return _0x49e0c8;});}})[_0x3539('0x26')](respondWithFilteredResult(_0x3c146f,_0x1c8f41))[_0x3539('0x4c')](handleError(_0x3c146f,null));};exports[_0x3539('0x5d')]=function(_0x4a7520,_0x3118f8,_0x1c4458){return db[_0x3539('0x32')][_0x3539('0x52')]({'where':{'id':_0x4a7520[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x3118f8,null))['then'](function(_0x32f96d){if(_0x32f96d){return _0x32f96d[_0x3539('0x5d')](_0x4a7520[_0x3539('0x36')][_0x3539('0x5e')]);}})[_0x3539('0x26')](respondWithStatusCode(_0x3118f8,null))[_0x3539('0x4c')](handleError(_0x3118f8,null));};exports[_0x3539('0x5f')]=function(_0x3d7cea,_0x4527c0,_0x4cdcf7){return db['CmList'][_0x3539('0x52')]({'where':{'id':_0x3d7cea[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x4527c0,null))[_0x3539('0x26')](function(_0x414b0a){if(_0x414b0a){var _0x1fddb0=[];var _0x6d5572={'success':[],'errors':[]};return db[_0x3539('0x60')][_0x3539('0x56')]()['then'](function(_0x109a47){if(_0x3d7cea['body'][_0x3539('0x61')]&&_[_0x3539('0x62')](_0x3d7cea[_0x3539('0x4d')][_0x3539('0x61')])){if(_0x3d7cea['body'][_0x3539('0x61')][_0x3539('0x3c')]){_0x3d7cea[_0x3539('0x4d')][_0x3539('0x61')]=_0x3d7cea[_0x3539('0x4d')][_0x3539('0x61')][_0x3539('0x63')](';')+';';}else{_0x3d7cea[_0x3539('0x4d')][_0x3539('0x61')]=null;}}else{_0x3d7cea['body'][_0x3539('0x61')]=null;}if(_0x3d7cea['body']&&_[_0x3539('0x62')](_0x3d7cea[_0x3539('0x4d')])){for(var _0x1b45b8=0x0;_0x1b45b8<_0x3d7cea[_0x3539('0x4d')][_0x3539('0x3c')];_0x1b45b8+=0x1){_0x3d7cea[_0x3539('0x4d')][_0x1b45b8][_0x3539('0x58')]=_0x3d7cea[_0x3539('0x49')]['id'];_0x1fddb0[_0x3539('0x64')](_0x3d7cea[_0x3539('0x4d')][_0x1b45b8]);}return BPromise[_0x3539('0x65')](_0x1fddb0,function(_0x5770b4){return db['CmContact'][_0x3539('0x5a')](_[_0x3539('0x66')](_0x5770b4,[_0x3539('0x5e'),'id'])||{},{'fields':_[_0x3539('0x37')](_0x109a47),'raw':!![]})['then'](function(_0x103c47){_0x6d5572[_0x3539('0x67')][_0x3539('0x64')](_0x103c47[_0x3539('0x68')]);})[_0x3539('0x4c')](function(_0x191c92){_0x6d5572[_0x3539('0x69')][_0x3539('0x64')]({'data':_0x5770b4,'error':_0x191c92['message']});});})['then'](function(_0x10f185){return _0x6d5572;})[_0x3539('0x4c')](function(_0x1309e0){return _0x1309e0;});}else{_0x4527c0[_0x3539('0x1b')](0x190)[_0x3539('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x4527c0,null))['catch'](handleError(_0x4527c0,null));};exports[_0x3539('0x6a')]=function(_0x45368e,_0x2681d3,_0x44acd4){var _0x4fec9f;return db['CmList'][_0x3539('0x52')]({'where':{'id':_0x45368e[_0x3539('0x49')]['id']},'include':[{'model':db[_0x3539('0x6b')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x2681d3,null))['then'](function(_0x3cf6e8){if(_0x3cf6e8){_0x4fec9f=_0x3cf6e8;return db[_0x3539('0x60')][_0x3539('0x33')];}})[_0x3539('0x26')](function(_0x37e9fd){if(_0x37e9fd){var _0x41170a={};var _0x52dfbd={};_0x52dfbd[_0x3539('0x35')]=_[_0x3539('0x6c')](_[_0x3539('0x37')](_0x37e9fd),_[_0x3539('0x31')](_0x4fec9f[_0x3539('0x6d')],function(_0x55ee87){return util[_0x3539('0x6e')](_0x3539('0x6f'),_0x55ee87['id']);}));_0x52dfbd[_0x3539('0x36')]=_[_0x3539('0x37')](_0x45368e[_0x3539('0x36')]);_0x52dfbd[_0x3539('0x38')]=_['intersection'](_0x52dfbd[_0x3539('0x35')],_0x52dfbd[_0x3539('0x36')]);_0x41170a['attributes']=_['intersection'](_0x52dfbd[_0x3539('0x35')],qs['fields'](_0x45368e[_0x3539('0x36')][_0x3539('0x3a')]));_0x41170a[_0x3539('0x3b')]=_0x41170a[_0x3539('0x3b')][_0x3539('0x3c')]?_0x41170a['attributes']:_0x52dfbd[_0x3539('0x35')];if(!_0x45368e[_0x3539('0x36')][_0x3539('0x3d')](_0x3539('0x3e'))){_0x41170a[_0x3539('0x1e')]=qs[_0x3539('0x1e')](_0x45368e['query'][_0x3539('0x1e')]);_0x41170a['offset']=qs[_0x3539('0x1d')](_0x45368e[_0x3539('0x36')][_0x3539('0x1d')]);}_0x41170a[_0x3539('0x3f')]=qs['sort'](_0x45368e[_0x3539('0x36')][_0x3539('0x40')]);_0x41170a[_0x3539('0x41')]=qs['filters'](_[_0x3539('0x42')](_0x45368e[_0x3539('0x36')],_0x52dfbd[_0x3539('0x38')]));_0x41170a[_0x3539('0x70')]=!![];if(_0x45368e['query'][_0x3539('0x45')]){_0x41170a[_0x3539('0x41')]=_[_0x3539('0x43')](_0x41170a[_0x3539('0x41')],{'$or':_[_0x3539('0x31')](_0x41170a[_0x3539('0x3b')],function(_0x504c51){var _0x2fc0a0={};_0x2fc0a0[_0x504c51]={'$like':'%'+_0x45368e[_0x3539('0x36')][_0x3539('0x45')]+'%'};return _0x2fc0a0;})});}_0x41170a=_[_0x3539('0x43')]({},_0x41170a,_0x45368e[_0x3539('0x4b')]);return _0x4fec9f[_0x3539('0x6a')](_0x41170a);}})['then'](respondWithResult(_0x2681d3,null))['catch'](handleError(_0x2681d3,null));};exports[_0x3539('0x71')]=function(_0x1d6dd8,_0x532d16,_0x5bb965){var _0x1859a6;var _0x58af0e;var _0x1e9d77;var _0x3af65f=_0x1d6dd8[_0x3539('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0x3539('0x47')]({'attributes':['id','name'],'raw':!![],'order':[_0x3539('0x72')]})['then'](function(_0xd07a07){_0x1859a6=_0xd07a07;var _0x4bfe2f=_[_0x3539('0x37')](db[_0x3539('0x60')][_0x3539('0x33')]);return db[_0x3539('0x6b')][_0x3539('0x47')]({'raw':!![],'attributes':['id','alias']})[_0x3539('0x26')](function(_0x416e01){_0x58af0e=_0x416e01;var _0x33913c=squel[_0x3539('0x73')]()['fields'](_0x4bfe2f)[_0x3539('0x74')]('cm_contacts','c')['where'](_0x3539('0x75'),_0x3af65f)[_0x3539('0x41')](_0x3539('0x76'))['distinct']();for(var _0x1e0561=0x0;_0x1e0561<_0x58af0e['length'];_0x1e0561++){_0x33913c['field'](_0x3539('0x77')+_0x58af0e[_0x1e0561]['id'],_0x3539('0x78')+_0x58af0e[_0x1e0561][_0x3539('0x79')]);}for(var _0x1e0561=0x0;_0x1e0561<_0x1859a6[_0x3539('0x3c')];_0x1e0561++){_0x33913c[_0x3539('0x7a')](squel[_0x3539('0x73')]()[_0x3539('0x7a')](_0x3539('0x7b'))['from']('cm_contact_has_items')[_0x3539('0x41')]('ItemTypeId\x20=\x20?',_0x1859a6[_0x1e0561]['id'])[_0x3539('0x41')]('CmContactId\x20=\x20c.id'),_0x3539('0x7c')+_0x1859a6[_0x1e0561][_0x3539('0x2e')]);_0x33913c[_0x3539('0x7a')](squel[_0x3539('0x73')]()[_0x3539('0x7a')](_0x3539('0x7d'))['from']('cm_contact_has_items')[_0x3539('0x41')]('ItemTypeId\x20=\x20?',_0x1859a6[_0x1e0561]['id'])[_0x3539('0x41')](_0x3539('0x7e')),_0x3539('0x7f')+_0x1859a6[_0x1e0561][_0x3539('0x2e')]);}var _0xd79ed1=[];_0xd79ed1['push'](_0x33913c[_0x3539('0x80')]());BPromise['each'](_0xd79ed1,handleQuery)[_0x3539('0x26')](function(_0x1cf52f){handleQuery(_0x33913c[_0x3539('0x80')]());var _0x3ae49f=csv_results[0x0];if(!_[_0x3539('0x81')](_0x3ae49f)){var _0x4da74c=toCsv(_0x3ae49f);var _0x26b1c2=Date['now']();fs[_0x3539('0x82')](util[_0x3539('0x6e')](_0x3539('0x83'),_0x3af65f,_0x26b1c2),_0x4da74c);_0x532d16['setHeader']('Content-disposition',_0x3539('0x84')+util[_0x3539('0x6e')](_0x3539('0x85'),_0x3af65f,_0x26b1c2));_0x532d16[_0x3539('0x86')]('Content-type',_0x3539('0x87'));return _0x532d16[_0x3539('0x88')](util[_0x3539('0x6e')](_0x3539('0x83'),_0x3af65f,_0x26b1c2));}else{return _0x532d16[_0x3539('0x2b')](0xcc);}});});});};exports['addCustomField']=function(_0x3fdb44,_0x4dfb9a,_0xe36ed6){var _0x176c39;delete _0x3fdb44[_0x3539('0x4d')]['id'];return db[_0x3539('0x32')]['findOne']({'where':{'id':_0x3fdb44[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x4dfb9a,null))['then'](function(_0x50cc0a){if(_0x50cc0a){return db['sequelize']['transaction'](function(_0x4a893b){return db['CmCustomField']['create'](_0x3fdb44[_0x3539('0x4d')],{'transaction':_0x4a893b})[_0x3539('0x26')](function(_0x23ec3b){_0x176c39=_0x23ec3b;return _0x50cc0a[_0x3539('0x89')](_0x23ec3b,{'transaction':_0x4a893b});})[_0x3539('0x26')](function(){var _0x4c7824={'type':db['Sequelize'][_0x3539('0x8a')],'transaction':_0x4a893b};switch(_0x3fdb44[_0x3539('0x4d')][_0x3539('0x34')]){case _0x3539('0x8b'):_0x4c7824[_0x3539('0x34')]=db[_0x3539('0x8c')]['TEXT'];break;case _0x3539('0x8d'):_0x4c7824[_0x3539('0x34')]=db[_0x3539('0x8c')][_0x3539('0x8e')];break;case _0x3539('0x8f'):_0x4c7824[_0x3539('0x34')]=db['Sequelize'][_0x3539('0x90')];_0x4c7824[_0x3539('0x91')]=![];break;default:}return db[_0x3539('0x92')][_0x3539('0x93')]['addColumn'](_0x3539('0x94'),util['format']('cf_%s',_0x176c39['id']),_0x4c7824);})[_0x3539('0x26')](function(){return _0x176c39;});});}})[_0x3539('0x26')](respondWithResult(_0x4dfb9a,null))['catch'](handleError(_0x4dfb9a,null));};exports['getCustomFields']=function(_0xa50adc,_0xbafe7,_0x311af8){var _0x9dbf7f={};var _0x3d60b8={};var _0x5ef0b4;var _0x3f2902;return db[_0x3539('0x32')]['findOne']({'where':{'id':_0xa50adc[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0xbafe7,null))['then'](function(_0x3a9a59){if(_0x3a9a59){_0x5ef0b4=_0x3a9a59;_0x3d60b8[_0x3539('0x35')]=_[_0x3539('0x37')](db[_0x3539('0x6b')][_0x3539('0x33')]);_0x3d60b8[_0x3539('0x36')]=_[_0x3539('0x37')](_0xa50adc[_0x3539('0x36')]);_0x3d60b8['filters']=_[_0x3539('0x39')](_0x3d60b8[_0x3539('0x35')],_0x3d60b8[_0x3539('0x36')]);_0x9dbf7f['attributes']=_[_0x3539('0x39')](_0x3d60b8[_0x3539('0x35')],qs[_0x3539('0x3a')](_0xa50adc['query']['fields']));_0x9dbf7f[_0x3539('0x3b')]=_0x9dbf7f['attributes'][_0x3539('0x3c')]?_0x9dbf7f[_0x3539('0x3b')]:_0x3d60b8[_0x3539('0x35')];_0x9dbf7f[_0x3539('0x3f')]=qs[_0x3539('0x40')](_0xa50adc[_0x3539('0x36')][_0x3539('0x40')]);_0x9dbf7f[_0x3539('0x41')]=qs[_0x3539('0x38')](_[_0x3539('0x42')](_0xa50adc[_0x3539('0x36')],_0x3d60b8['filters']));_0x9dbf7f['where']=_[_0x3539('0x43')](_0x9dbf7f['where'],{'$or':[{'ListId':_0x3a9a59['id']},{'ListId':null}]});if(_0xa50adc[_0x3539('0x36')][_0x3539('0x45')]){_0x9dbf7f[_0x3539('0x41')]=_[_0x3539('0x43')](_0x9dbf7f[_0x3539('0x41')],{'$or':_[_0x3539('0x31')](_0x9dbf7f['attributes'],function(_0x39539b){var _0x156379={};_0x156379[_0x39539b]={'$like':'%'+_0xa50adc[_0x3539('0x36')]['filter']+'%'};return _0x156379;})});}_0x9dbf7f=_[_0x3539('0x43')]({},_0x9dbf7f,_0xa50adc['options']);return db[_0x3539('0x6b')][_0x3539('0x95')](_0x9dbf7f);}})['then'](respondWithResult(_0xbafe7,null))[_0x3539('0x4c')](handleError(_0xbafe7,null));};exports['getGlobalCustomFields']=function(_0x4f6336,_0x361abc){return db[_0x3539('0x6b')][_0x3539('0x95')]({'where':{'ListId':null}})[_0x3539('0x26')](handleEntityNotFound(_0x361abc,null))[_0x3539('0x26')](function(_0xfdac3e){return _0xfdac3e;})[_0x3539('0x26')](respondWithResult(_0x361abc,null))[_0x3539('0x4c')](handleError(_0x361abc,null));};exports[_0x3539('0x96')]=function(_0x12ac2b,_0x3228c7,_0x1e7914){return db[_0x3539('0x32')][_0x3539('0x52')]({'where':{'id':_0x12ac2b['params']['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x3228c7,null))[_0x3539('0x26')](function(_0x41b0c4){if(_0x41b0c4){return _0x41b0c4[_0x3539('0x96')](_0x12ac2b['body']['ids'],_['omit'](_0x12ac2b[_0x3539('0x4d')],[_0x3539('0x5e'),'id'])||{})[_0x3539('0x97')](function(_0xf9323b){for(var _0x4d5f61=0x0;_0x4d5f61<_0x12ac2b['body'][_0x3539('0x5e')][_0x3539('0x3c')];_0x4d5f61+=0x1){socket['emit'](_0x3539('0x98'),{'UserId':Number(_0x12ac2b['body'][_0x3539('0x5e')][_0x4d5f61]),'CmListId':Number(_0x12ac2b[_0x3539('0x49')]['id'])});}return _0xf9323b;});}})[_0x3539('0x26')](respondWithResult(_0x3228c7,null))[_0x3539('0x4c')](handleError(_0x3228c7,null));};exports[_0x3539('0x99')]=function(_0x519c97,_0x1f1d22,_0x3e0e34){return db[_0x3539('0x32')]['find']({'where':{'id':_0x519c97['params']['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x1f1d22,null))['then'](function(_0x29ef8f){if(_0x29ef8f){return _0x29ef8f['removeAgents'](_0x519c97[_0x3539('0x36')][_0x3539('0x5e')])[_0x3539('0x26')](function(){if(_[_0x3539('0x62')](_0x519c97[_0x3539('0x36')]['ids'])){for(var _0x3114e1=0x0;_0x3114e1<_0x519c97[_0x3539('0x36')][_0x3539('0x5e')][_0x3539('0x3c')];_0x3114e1+=0x1){socket[_0x3539('0x9a')](_0x3539('0x9b'),{'UserId':Number(_0x519c97[_0x3539('0x36')]['ids'][_0x3114e1]),'CmListId':Number(_0x519c97['params']['id'])});}}else{socket['emit'](_0x3539('0x9b'),{'UserId':Number(_0x519c97[_0x3539('0x36')][_0x3539('0x5e')]),'CmListId':Number(_0x519c97['params']['id'])});}});}})[_0x3539('0x26')](respondWithStatusCode(_0x1f1d22,null))[_0x3539('0x4c')](handleError(_0x1f1d22,null));};exports[_0x3539('0x9c')]=function(_0x5541fa,_0x1378c7,_0x1410c9){var _0x11e15f={};var _0x12534b={};var _0x455444;var _0x26cc85;return db['CmList'][_0x3539('0x5c')]({'where':{'id':_0x5541fa[_0x3539('0x49')]['id']}})[_0x3539('0x26')](handleEntityNotFound(_0x1378c7,null))[_0x3539('0x26')](function(_0x1081b2){if(_0x1081b2){_0x455444=_0x1081b2;_0x12534b[_0x3539('0x35')]=_[_0x3539('0x37')](db[_0x3539('0x9d')][_0x3539('0x33')]);_0x12534b[_0x3539('0x36')]=_[_0x3539('0x37')](_0x5541fa[_0x3539('0x36')]);_0x12534b[_0x3539('0x38')]=_[_0x3539('0x39')](_0x12534b[_0x3539('0x35')],_0x12534b[_0x3539('0x36')]);_0x11e15f['attributes']=_[_0x3539('0x39')](_0x12534b[_0x3539('0x35')],qs[_0x3539('0x3a')](_0x5541fa[_0x3539('0x36')][_0x3539('0x3a')]));_0x11e15f['attributes']=_0x11e15f[_0x3539('0x3b')][_0x3539('0x3c')]?_0x11e15f['attributes']:_0x12534b[_0x3539('0x35')];_0x11e15f[_0x3539('0x3f')]=qs[_0x3539('0x40')](_0x5541fa[_0x3539('0x36')][_0x3539('0x40')]);_0x11e15f[_0x3539('0x41')]=qs[_0x3539('0x38')](_['pick'](_0x5541fa['query'],_0x12534b[_0x3539('0x38')]));if(_0x5541fa[_0x3539('0x36')][_0x3539('0x45')]){_0x11e15f[_0x3539('0x41')]=_[_0x3539('0x43')](_0x11e15f[_0x3539('0x41')],{'$or':_[_0x3539('0x31')](_0x11e15f[_0x3539('0x3b')],function(_0x2fcf1c){var _0x5c72a6={};_0x5c72a6[_0x2fcf1c]={'$like':'%'+_0x5541fa[_0x3539('0x36')][_0x3539('0x45')]+'%'};return _0x5c72a6;})});}_0x11e15f=_[_0x3539('0x43')]({},_0x11e15f,_0x5541fa['options']);return _0x455444[_0x3539('0x9c')](_0x11e15f);}})[_0x3539('0x26')](function(_0x4f3152){if(_0x4f3152){_0x26cc85=_0x4f3152['length'];if(!_0x5541fa[_0x3539('0x36')][_0x3539('0x3d')](_0x3539('0x3e'))){_0x11e15f[_0x3539('0x1e')]=qs[_0x3539('0x1e')](_0x5541fa[_0x3539('0x36')][_0x3539('0x1e')]);_0x11e15f['offset']=qs[_0x3539('0x1d')](_0x5541fa['query'][_0x3539('0x1d')]);}return _0x455444[_0x3539('0x9c')](_0x11e15f);}})[_0x3539('0x26')](function(_0x4f9d30){if(_0x4f9d30){return _0x4f9d30?{'count':_0x26cc85,'rows':_0x4f9d30}:null;}})[_0x3539('0x26')](respondWithResult(_0x1378c7,null))[_0x3539('0x4c')](handleError(_0x1378c7,null));};function handleQuery(_0x7f97ee){logger['info'](_0x7f97ee);return db['sequelize'][_0x3539('0x36')](_0x7f97ee)[_0x3539('0x97')](function(_0x52cad4){csv_results[_0x3539('0x64')](_0x52cad4);})[_0x3539('0x4c')](function(_0x378f48){logger['error'](_0x378f48['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 08836d2..6b8fc30 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x36cb4d,_0x2dc7aa){var _0x35ca7c=function(_0x3e8fbf){while(--_0x3e8fbf){_0x36cb4d['push'](_0x36cb4d['shift']());}};_0x35ca7c(++_0x2dc7aa);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x5d897,_0x469fee){var _0xc60754=function(_0x540ea9){while(--_0x540ea9){_0x5d897['push'](_0x5d897['shift']());}};_0xc60754(++_0x469fee);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cab081e..5ec8a8e 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x851ae7,_0x5ad0da){var _0x417421=function(_0x10797d){while(--_0x10797d){_0x851ae7['push'](_0x851ae7['shift']());}};_0x417421(++_0x5ad0da);}(_0xac4a,0x13f));var _0xaac4=function(_0x19220a,_0x3a9c89){_0x19220a=_0x19220a-0x0;var _0x4fdaac=_0xac4a[_0x19220a];return _0x4fdaac;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x345f4d,_0x565bb4){var _0x32a76d=function(_0x566fb4){while(--_0x566fb4){_0x345f4d['push'](_0x345f4d['shift']());}};_0x32a76d(++_0x565bb4);}(_0x1339,0x1ed));var _0x9133=function(_0x172519,_0x3e826f){_0x172519=_0x172519-0x0;var _0x15372b=_0x1339[_0x172519];return _0x15372b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'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 f9153d0..c49e2d6 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 _0x652b=['client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','message','info','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x652b,0x1d8));var _0xb652=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x652b[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0xb652('0x0'));var moment=require(_0xb652('0x1'));var BPromise=require('bluebird');var rs=require(_0xb652('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb652('0x3'));var logger=require(_0xb652('0x4'))(_0xb652('0x5'));var config=require(_0xb652('0x6'));var jayson=require(_0xb652('0x7'));var client=jayson[_0xb652('0x8')]['http']({'port':0x232a});config[_0xb652('0x9')]=_[_0xb652('0xa')](config[_0xb652('0x9')],{'host':_0xb652('0xb'),'port':0x18eb});var socket=require(_0xb652('0xc'))(new Redis(config[_0xb652('0x9')]));require(_0xb652('0xd'))[_0xb652('0xe')](socket);function respondWithRpcPromise(_0x129e46,_0x1f8cee,_0x21565a){return new BPromise(function(_0x3c853c,_0x5afef9){return client[_0xb652('0xf')](_0x129e46,_0x21565a)[_0xb652('0x10')](function(_0xba701){logger['info'](_0xb652('0x11'),_0x1f8cee,_0xb652('0x12'));logger['debug'](_0xb652('0x13'),_0x1f8cee,_0xb652('0x12'),JSON['stringify'](_0xba701));if(_0xba701[_0xb652('0x14')]){if(_0xba701[_0xb652('0x14')]['code']===0x1f4){logger['error'](_0xb652('0x11'),_0x1f8cee,_0xba701[_0xb652('0x14')][_0xb652('0x15')]);return _0x5afef9(_0xba701[_0xb652('0x14')][_0xb652('0x15')]);}logger[_0xb652('0x14')](_0xb652('0x11'),_0x1f8cee,_0xba701[_0xb652('0x14')][_0xb652('0x15')]);return _0x3c853c(_0xba701[_0xb652('0x14')][_0xb652('0x15')]);}else{logger[_0xb652('0x16')](_0xb652('0x11'),_0x1f8cee,_0xb652('0x12'));_0x3c853c(_0xba701[_0xb652('0x17')][_0xb652('0x15')]);}})['catch'](function(_0x428f69){logger['error']('CmList,\x20%s,\x20%s',_0x1f8cee,_0x428f69);_0x5afef9(_0x428f69);});});} \ No newline at end of file +var _0x1501=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x52bb1e,_0x47c818){var _0x15d57d=function(_0x551cd3){while(--_0x551cd3){_0x52bb1e['push'](_0x52bb1e['shift']());}};_0x15d57d(++_0x47c818);}(_0x1501,0x8a));var _0x1150=function(_0x474058,_0x4e1fc5){_0x474058=_0x474058-0x0;var _0x15f033=_0x1501[_0x474058];return _0x15f033;};'use strict';var _=require(_0x1150('0x0'));var util=require('util');var moment=require(_0x1150('0x1'));var BPromise=require(_0x1150('0x2'));var rs=require(_0x1150('0x3'));var fs=require('fs');var Redis=require(_0x1150('0x4'));var db=require(_0x1150('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1150('0x6'))('rpc');var config=require(_0x1150('0x7'));var jayson=require(_0x1150('0x8'));var client=jayson[_0x1150('0x9')][_0x1150('0xa')]({'port':0x232a});config[_0x1150('0xb')]=_[_0x1150('0xc')](config[_0x1150('0xb')],{'host':_0x1150('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1150('0xb')]));require(_0x1150('0xe'))[_0x1150('0xf')](socket);function respondWithRpcPromise(_0x4b0cae,_0x75c71e,_0x1e2d8a){return new BPromise(function(_0x13f6fc,_0x4c363a){return client[_0x1150('0x10')](_0x4b0cae,_0x1e2d8a)[_0x1150('0x11')](function(_0x30e415){logger[_0x1150('0x12')](_0x1150('0x13'),_0x75c71e,_0x1150('0x14'));logger[_0x1150('0x15')](_0x1150('0x16'),_0x75c71e,_0x1150('0x14'),JSON[_0x1150('0x17')](_0x30e415));if(_0x30e415[_0x1150('0x18')]){if(_0x30e415[_0x1150('0x18')]['code']===0x1f4){logger[_0x1150('0x18')](_0x1150('0x13'),_0x75c71e,_0x30e415[_0x1150('0x18')][_0x1150('0x19')]);return _0x4c363a(_0x30e415[_0x1150('0x18')][_0x1150('0x19')]);}logger[_0x1150('0x18')]('CmList,\x20%s,\x20%s',_0x75c71e,_0x30e415[_0x1150('0x18')]['message']);return _0x13f6fc(_0x30e415[_0x1150('0x18')][_0x1150('0x19')]);}else{logger[_0x1150('0x12')](_0x1150('0x13'),_0x75c71e,_0x1150('0x14'));_0x13f6fc(_0x30e415[_0x1150('0x1a')][_0x1150('0x19')]);}})[_0x1150('0x1b')](function(_0x1f89a5){logger['error']('CmList,\x20%s,\x20%s',_0x75c71e,_0x1f89a5);_0x4c363a(_0x1f89a5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 1f7671a..df9b6de 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 _0x000b=['remove','update','emit','cmList:','./cmList.events','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x000b,0xf4));var _0xb000=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x000b[_0x5192de];return _0x4e287e;};'use strict';var CmListEvents=require(_0xb000('0x0'));var events=[_0xb000('0x1'),_0xb000('0x2'),_0xb000('0x3')];function createListener(_0xcceeb0,_0x4436aa){return function(_0x219e90){_0x4436aa[_0xb000('0x4')](_0xcceeb0,_0x219e90);};}function removeListener(_0x2de19d,_0x169b31){return function(){CmListEvents['removeListener'](_0x2de19d,_0x169b31);};}exports['register']=function(_0x42bec){for(var _0x6941=0x0,_0x51f597=events['length'];_0x6941<_0x51f597;_0x6941++){var _0x5d69f3=events[_0x6941];var _0x32cfe4=createListener(_0xb000('0x5')+_0x5d69f3,_0x42bec);CmListEvents['on'](_0x5d69f3,_0x32cfe4);}}; \ No newline at end of file +var _0x71b1=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x48a9d1,_0x38a3d4){var _0x1816fb=function(_0x568bd2){while(--_0x568bd2){_0x48a9d1['push'](_0x48a9d1['shift']());}};_0x1816fb(++_0x38a3d4);}(_0x71b1,0x1c8));var _0x171b=function(_0x3ba095,_0x445aef){_0x3ba095=_0x3ba095-0x0;var _0x135e8c=_0x71b1[_0x3ba095];return _0x135e8c;};'use strict';var CmListEvents=require(_0x171b('0x0'));var events=[_0x171b('0x1'),_0x171b('0x2'),_0x171b('0x3')];function createListener(_0x5430ae,_0x201618){return function(_0x57764e){_0x201618[_0x171b('0x4')](_0x5430ae,_0x57764e);};}function removeListener(_0x28f19e,_0x44b9c9){return function(){CmListEvents[_0x171b('0x5')](_0x28f19e,_0x44b9c9);};}exports[_0x171b('0x6')]=function(_0x43426e){for(var _0x4ff2e8=0x0,_0x351ef5=events[_0x171b('0x7')];_0x4ff2e8<_0x351ef5;_0x4ff2e8++){var _0x136763=events[_0x4ff2e8];var _0x3cba0c=createListener(_0x171b('0x8')+_0x136763,_0x43426e);CmListEvents['on'](_0x136763,_0x3cba0c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 77cac1f..428e48d 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 _0x167e=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x34a14d,_0xc49d24){var _0x2015f2=function(_0x2a0b48){while(--_0x2a0b48){_0x34a14d['push'](_0x34a14d['shift']());}};_0x2015f2(++_0xc49d24);}(_0x167e,0xa3));var _0xe167=function(_0x360765,_0x5867a0){_0x360765=_0x360765-0x0;var _0x5710d1=_0x167e[_0x360765];return _0x5710d1;};'use strict';var multer=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var path=require(_0xe167('0x2'));var timeout=require(_0xe167('0x3'));var express=require(_0xe167('0x4'));var router=express[_0xe167('0x5')]();var fs_extra=require(_0xe167('0x6'));var auth=require(_0xe167('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe167('0x8'));var controller=require('./cmList.controller');router[_0xe167('0x9')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0xb')]);router[_0xe167('0x9')](_0xe167('0xc'),auth['isAuthenticated'](),controller[_0xe167('0xd')]);router['get'](_0xe167('0xe'),auth[_0xe167('0xa')](),controller[_0xe167('0xf')]);router[_0xe167('0x9')](_0xe167('0x10'),auth[_0xe167('0xa')](),controller[_0xe167('0x11')]);router[_0xe167('0x9')]('/:id/dispositions',auth[_0xe167('0xa')](),controller[_0xe167('0x12')]);router['get'](_0xe167('0x13'),auth[_0xe167('0xa')](),controller[_0xe167('0x14')]);router[_0xe167('0x9')](_0xe167('0x15'),auth[_0xe167('0xa')](),controller[_0xe167('0x16')]);router[_0xe167('0x9')](_0xe167('0x17'),auth['isAuthenticated'](),controller[_0xe167('0x18')]);router[_0xe167('0x9')](_0xe167('0x19'),auth[_0xe167('0xa')](),controller['getAgents']);router[_0xe167('0x1a')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0x1b')]);router[_0xe167('0x1a')](_0xe167('0x1c'),auth['isAuthenticated'](),controller[_0xe167('0x1d')]);router[_0xe167('0x1a')](_0xe167('0x13'),auth[_0xe167('0xa')](),controller[_0xe167('0x1e')]);router[_0xe167('0x1a')]('/:id/fields',auth[_0xe167('0xa')](),controller[_0xe167('0x1f')]);router[_0xe167('0x1a')](_0xe167('0x19'),auth[_0xe167('0xa')](),controller['addAgents']);router[_0xe167('0x20')](_0xe167('0x10'),auth[_0xe167('0xa')](),controller[_0xe167('0x21')]);router[_0xe167('0x22')]('/:id',auth[_0xe167('0xa')](),controller[_0xe167('0x23')]);router[_0xe167('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xe167('0x19'),auth[_0xe167('0xa')](),controller[_0xe167('0x24')]);module['exports']=router; \ No newline at end of file +var _0x9251=['/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','put','destroy','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','/global_fields','/:id','show','/:id/dispositions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9251,0x1e6));var _0x1925=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x9251[_0x21090b];return _0x3c68d7;};'use strict';var multer=require('multer');var util=require(_0x1925('0x0'));var path=require(_0x1925('0x1'));var timeout=require(_0x1925('0x2'));var express=require(_0x1925('0x3'));var router=express[_0x1925('0x4')]();var fs_extra=require(_0x1925('0x5'));var auth=require(_0x1925('0x6'));var interaction=require(_0x1925('0x7'));var config=require(_0x1925('0x8'));var controller=require(_0x1925('0x9'));router['get']('/',auth[_0x1925('0xa')](),controller[_0x1925('0xb')]);router[_0x1925('0xc')](_0x1925('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x1925('0xc')](_0x1925('0xe'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x1925('0xc')](_0x1925('0xf'),auth[_0x1925('0xa')](),controller[_0x1925('0x10')]);router['get'](_0x1925('0x11'),auth[_0x1925('0xa')](),controller['getDispositions']);router[_0x1925('0xc')](_0x1925('0x12'),auth[_0x1925('0xa')](),controller[_0x1925('0x13')]);router[_0x1925('0xc')](_0x1925('0x14'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x1925('0xc')](_0x1925('0x15'),auth[_0x1925('0xa')](),controller[_0x1925('0x16')]);router['get']('/:id/users',auth[_0x1925('0xa')](),controller[_0x1925('0x17')]);router[_0x1925('0x18')]('/',auth[_0x1925('0xa')](),controller[_0x1925('0x19')]);router[_0x1925('0x18')]('/:id/dispositions',auth[_0x1925('0xa')](),controller[_0x1925('0x1a')]);router[_0x1925('0x18')](_0x1925('0x12'),auth[_0x1925('0xa')](),controller[_0x1925('0x1b')]);router['post'](_0x1925('0x15'),auth[_0x1925('0xa')](),controller[_0x1925('0x1c')]);router[_0x1925('0x18')](_0x1925('0x1d'),auth[_0x1925('0xa')](),controller['addAgents']);router[_0x1925('0x1e')](_0x1925('0xf'),auth[_0x1925('0xa')](),controller['update']);router['delete']('/:id',auth[_0x1925('0xa')](),controller[_0x1925('0x1f')]);router[_0x1925('0x20')](_0x1925('0x11'),auth['isAuthenticated'](),controller[_0x1925('0x21')]);router[_0x1925('0x20')](_0x1925('0x1d'),auth[_0x1925('0xa')](),controller[_0x1925('0x22')]);module[_0x1925('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d4e553f..9c13a34 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 _0x7973=['STRING','exports','VIRTUAL','getDataValue','field'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x7973,0x105));var _0x3797=function(_0x104b99,_0x15877a){_0x104b99=_0x104b99-0x0;var _0x3ac501=_0x7973[_0x104b99];return _0x3ac501;};'use strict';var Sequelize=require('sequelize');module[_0x3797('0x0')]={'name':{'type':Sequelize[_0x3797('0x1')],'get':function(_0x49f5b1){return this[_0x3797('0x2')](_0x3797('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3797('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3797('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xf0d7=['getDataValue','STRING','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf0d7,0x8a));var _0x7f0d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7f0d('0x0'));module[_0x7f0d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xbd1a8d){return this[_0x7f0d('0x2')]('field');}},'field':{'type':Sequelize[_0x7f0d('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x7f0d('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7f0d('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7f72f0e..1399d75 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(_0x3126a1,_0x2fb75a){var _0x5265ee=function(_0x3786d4){while(--_0x3786d4){_0x3126a1['push'](_0x3126a1['shift']());}};_0x5265ee(++_0x2fb75a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x3e055c,_0x3ed1a5){var _0x1d86fa=function(_0x503e68){while(--_0x503e68){_0x3e055c['push'](_0x3e055c['shift']());}};_0x1d86fa(++_0x3ed1a5);}(_0x7a54,0x106));var _0x47a5=function(_0x349977,_0x2338b2){_0x349977=_0x349977-0x0;var _0x2d8337=_0x7a54[_0x349977];return _0x2d8337;};'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 7ea9f90..d299d62 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 _0xf6bb=['define','../../config/logger','bluebird','path','../../config/environment','./condition.attributes','exports'];(function(_0x4c219e,_0x1cc27e){var _0x20c14a=function(_0x5bc78b){while(--_0x5bc78b){_0x4c219e['push'](_0x4c219e['shift']());}};_0x20c14a(++_0x1cc27e);}(_0xf6bb,0x16d));var _0xbf6b=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xf6bb[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6b('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbf6b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf6b('0x2'));var rimraf=require('rimraf');var config=require(_0xbf6b('0x3'));var attributes=require(_0xbf6b('0x4'));module[_0xbf6b('0x5')]=function(_0x4a78e7,_0x2fcc92){return _0x4a78e7[_0xbf6b('0x6')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a89=['exports','define','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./condition.attributes'];(function(_0x3550d4,_0xa10bca){var _0x1c8ba1=function(_0x141ac5){while(--_0x141ac5){_0x3550d4['push'](_0x3550d4['shift']());}};_0x1c8ba1(++_0xa10bca);}(_0x6a89,0x106));var _0x96a8=function(_0x523892,_0x22883d){_0x523892=_0x523892-0x0;var _0x411888=_0x6a89[_0x523892];return _0x411888;};'use strict';var _=require(_0x96a8('0x0'));var util=require('util');var logger=require(_0x96a8('0x1'))(_0x96a8('0x2'));var moment=require(_0x96a8('0x3'));var BPromise=require(_0x96a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96a8('0x5'));var rimraf=require('rimraf');var config=require(_0x96a8('0x6'));var attributes=require(_0x96a8('0x7'));module[_0x96a8('0x8')]=function(_0x22e59f,_0x4bb224){return _0x22e59f[_0x96a8('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 090710d..f68fe94 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 _0x9706=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x31dac5,_0x1fa6a0){var _0x5e8cb3=function(_0x865f82){while(--_0x865f82){_0x31dac5['push'](_0x31dac5['shift']());}};_0x5e8cb3(++_0x1fa6a0);}(_0x9706,0x133));var _0x6970=function(_0x50cbcd,_0x438ae4){_0x50cbcd=_0x50cbcd-0x0;var _0x148ea1=_0x9706[_0x50cbcd];return _0x148ea1;};'use strict';var _=require(_0x6970('0x0'));var util=require(_0x6970('0x1'));var moment=require(_0x6970('0x2'));var BPromise=require(_0x6970('0x3'));var rs=require(_0x6970('0x4'));var fs=require('fs');var Redis=require(_0x6970('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6970('0x6'));var logger=require('../../config/logger')(_0x6970('0x7'));var config=require(_0x6970('0x8'));var jayson=require(_0x6970('0x9'));var client=jayson['client'][_0x6970('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5755ad,_0x468a93,_0x462319){return new BPromise(function(_0x5481db,_0x193c11){return client['request'](_0x5755ad,_0x462319)[_0x6970('0xb')](function(_0xabd7b0){logger[_0x6970('0xc')]('Condition,\x20%s,\x20%s',_0x468a93,_0x6970('0xd'));logger[_0x6970('0xe')](_0x6970('0xf'),_0x468a93,_0x6970('0xd'),JSON[_0x6970('0x10')](_0xabd7b0));if(_0xabd7b0[_0x6970('0x11')]){if(_0xabd7b0[_0x6970('0x11')][_0x6970('0x12')]===0x1f4){logger[_0x6970('0x11')]('Condition,\x20%s,\x20%s',_0x468a93,_0xabd7b0[_0x6970('0x11')][_0x6970('0x13')]);return _0x193c11(_0xabd7b0[_0x6970('0x11')][_0x6970('0x13')]);}logger[_0x6970('0x11')](_0x6970('0x14'),_0x468a93,_0xabd7b0[_0x6970('0x11')]['message']);return _0x5481db(_0xabd7b0[_0x6970('0x11')][_0x6970('0x13')]);}else{logger[_0x6970('0xc')]('Condition,\x20%s,\x20%s',_0x468a93,_0x6970('0xd'));_0x5481db(_0xabd7b0[_0x6970('0x15')][_0x6970('0x13')]);}})[_0x6970('0x16')](function(_0x230593){logger[_0x6970('0x11')](_0x6970('0x14'),_0x468a93,_0x230593);_0x193c11(_0x230593);});});} \ No newline at end of file +var _0xf528=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xf528,0x192));var _0x8f52=function(_0x1bdcaa,_0x39f120){_0x1bdcaa=_0x1bdcaa-0x0;var _0x5b3dee=_0xf528[_0x1bdcaa];return _0x5b3dee;};'use strict';var _=require(_0x8f52('0x0'));var util=require(_0x8f52('0x1'));var moment=require(_0x8f52('0x2'));var BPromise=require(_0x8f52('0x3'));var rs=require(_0x8f52('0x4'));var fs=require('fs');var Redis=require(_0x8f52('0x5'));var db=require(_0x8f52('0x6'))['db'];var utils=require(_0x8f52('0x7'));var logger=require(_0x8f52('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f52('0x9'));var client=jayson[_0x8f52('0xa')][_0x8f52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x146d23,_0x4a2967,_0x563cb6){return new BPromise(function(_0x19309b,_0x21319c){return client['request'](_0x146d23,_0x563cb6)[_0x8f52('0xc')](function(_0x57b74b){logger[_0x8f52('0xd')](_0x8f52('0xe'),_0x4a2967,_0x8f52('0xf'));logger['debug'](_0x8f52('0x10'),_0x4a2967,'request\x20sent',JSON['stringify'](_0x57b74b));if(_0x57b74b[_0x8f52('0x11')]){if(_0x57b74b['error'][_0x8f52('0x12')]===0x1f4){logger['error'](_0x8f52('0xe'),_0x4a2967,_0x57b74b[_0x8f52('0x11')][_0x8f52('0x13')]);return _0x21319c(_0x57b74b['error'][_0x8f52('0x13')]);}logger['error'](_0x8f52('0xe'),_0x4a2967,_0x57b74b[_0x8f52('0x11')][_0x8f52('0x13')]);return _0x19309b(_0x57b74b['error'][_0x8f52('0x13')]);}else{logger[_0x8f52('0xd')](_0x8f52('0xe'),_0x4a2967,'request\x20sent');_0x19309b(_0x57b74b[_0x8f52('0x14')][_0x8f52('0x13')]);}})['catch'](function(_0x2556ff){logger[_0x8f52('0x11')](_0x8f52('0xe'),_0x4a2967,_0x2556ff);_0x21319c(_0x2556ff);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c728743..67ed788 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 _0xa031=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','isAuthenticated','destroy','multer'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xa031,0x8b));var _0x1a03=function(_0x5c630c,_0xa2e96b){_0x5c630c=_0x5c630c-0x0;var _0x55c4b7=_0xa031[_0x5c630c];return _0x55c4b7;};'use strict';var multer=require(_0x1a03('0x0'));var util=require(_0x1a03('0x1'));var path=require(_0x1a03('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a03('0x3'));var router=express[_0x1a03('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a03('0x5'));var interaction=require(_0x1a03('0x6'));var config=require(_0x1a03('0x7'));var controller=require(_0x1a03('0x8'));router[_0x1a03('0x9')](_0x1a03('0xa'),auth['isAuthenticated'](),controller[_0x1a03('0xb')]);router['delete'](_0x1a03('0xa'),auth[_0x1a03('0xc')](),controller[_0x1a03('0xd')]);module['exports']=router; \ No newline at end of file +var _0xb8fa=['isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','put','/:id'];(function(_0x16a042,_0x5884c8){var _0x208196=function(_0x1dc094){while(--_0x1dc094){_0x16a042['push'](_0x16a042['shift']());}};_0x208196(++_0x5884c8);}(_0xb8fa,0x1b7));var _0xab8f=function(_0x41f95b,_0xad5633){_0x41f95b=_0x41f95b-0x0;var _0x183cd8=_0xb8fa[_0x41f95b];return _0x183cd8;};'use strict';var multer=require(_0xab8f('0x0'));var util=require(_0xab8f('0x1'));var path=require(_0xab8f('0x2'));var timeout=require(_0xab8f('0x3'));var express=require(_0xab8f('0x4'));var router=express['Router']();var fs_extra=require(_0xab8f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab8f('0x6'));var controller=require('./condition.controller');router[_0xab8f('0x7')](_0xab8f('0x8'),auth[_0xab8f('0x9')](),controller[_0xab8f('0xa')]);router[_0xab8f('0xb')](_0xab8f('0x8'),auth[_0xab8f('0x9')](),controller[_0xab8f('0xc')]);module[_0xab8f('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a880860..96cb3d8 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0f9=['sequelize','exports','STRING','name','INTEGER'];(function(_0x5b2a4c,_0x428307){var _0x555f58=function(_0xfd344){while(--_0xfd344){_0x5b2a4c['push'](_0x5b2a4c['shift']());}};_0x555f58(++_0x428307);}(_0xd0f9,0x9b));var _0x9d0f=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xd0f9[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0x9d0f('0x0'));module[_0x9d0f('0x1')]={'name':{'type':Sequelize[_0x9d0f('0x2')],'allowNull':![],'unique':_0x9d0f('0x3')},'OrderBy':{'type':Sequelize[_0x9d0f('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xd265=['sequelize','STRING','INTEGER'];(function(_0x5e738d,_0x5bd22e){var _0x439432=function(_0x540690){while(--_0x540690){_0x5e738d['push'](_0x5e738d['shift']());}};_0x439432(++_0x5bd22e);}(_0xd265,0xc0));var _0x5d26=function(_0x5699db,_0x1652c9){_0x5699db=_0x5699db-0x0;var _0x1e0dc1=_0xd265[_0x5699db];return _0x1e0dc1;};'use strict';var Sequelize=require(_0x5d26('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d26('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x5d26('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5d26('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2129071..a1c43df 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','ContactItemType','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xcaa712,_0x562e5b){var _0x462ef8=function(_0x279076){while(--_0x279076){_0xcaa712['push'](_0xcaa712['shift']());}};_0x462ef8(++_0x562e5b);}(_0x28f2,0x193));var _0x228f=function(_0x281326,_0x15ada8){_0x281326=_0x281326-0x0;var _0x33bfff=_0x28f2[_0x281326];return _0x33bfff;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['ContactItemType'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':!![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x25')]=function(_0x561144,_0x3e9f76){if(_0x561144[_0x228f('0x4e')]['id']){delete _0x561144[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')]['find']({'where':{'id':_0x561144[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](saveUpdates(_0x561144[_0x228f('0x4e')],null))['then'](respondWithResult(_0x3e9f76,null))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports[_0x228f('0x27')]=function(_0x4b516e,_0x32787c){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x4b516e[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x32787c,null))[_0x228f('0x26')](db[_0x228f('0x54')][_0x228f('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4b516e[_0x228f('0x53')]['id']}}))[_0x228f('0x26')](removeEntity(_0x32787c,null))['catch'](handleError(_0x32787c,null));}; \ No newline at end of file +var _0xd4f4=['reject','save','update','destroy','get','ContactItemTypes','then','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xef9172,_0xb4b7b6){_0xef9172=_0xef9172-0x0;var _0x29e2eb=_0xd4f4[_0xef9172];return _0x29e2eb;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['ContactItemType'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['ContactItemType'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['ContactItemType'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](db[_0x4d4f('0x58')][_0x4d4f('0x29')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d8ae6[_0x4d4f('0x4e')]['id']}}))[_0x4d4f('0x2d')](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ef4c0a0..b6a8e99 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9794=['tools_contact_item_types','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./contactItemType.attributes','exports','define'];(function(_0x555048,_0x11572){var _0x13ab62=function(_0x531595){while(--_0x531595){_0x555048['push'](_0x555048['shift']());}};_0x13ab62(++_0x11572);}(_0x9794,0xd2));var _0x4979=function(_0x5d0131,_0x1b1497){_0x5d0131=_0x5d0131-0x0;var _0x3915d8=_0x9794[_0x5d0131];return _0x3915d8;};'use strict';var _=require('lodash');var util=require(_0x4979('0x0'));var logger=require(_0x4979('0x1'))(_0x4979('0x2'));var moment=require(_0x4979('0x3'));var BPromise=require(_0x4979('0x4'));var rp=require(_0x4979('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4979('0x6'));var config=require('../../config/environment');var attributes=require(_0x4979('0x7'));module[_0x4979('0x8')]=function(_0x2cb883,_0xa4d103){return _0x2cb883[_0x4979('0x9')]('ContactItemType',attributes,{'tableName':_0x4979('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8738=['exports','ContactItemType','tools_contact_item_types','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x5d381c,_0x445675){var _0x5d0199=function(_0x3344e3){while(--_0x3344e3){_0x5d381c['push'](_0x5d381c['shift']());}};_0x5d0199(++_0x445675);}(_0x8738,0x7b));var _0x8873=function(_0x3deee0,_0x3042d4){_0x3deee0=_0x3deee0-0x0;var _0xba4241=_0x8738[_0x3deee0];return _0xba4241;};'use strict';var _=require('lodash');var util=require(_0x8873('0x0'));var logger=require(_0x8873('0x1'))(_0x8873('0x2'));var moment=require('moment');var BPromise=require(_0x8873('0x3'));var rp=require(_0x8873('0x4'));var fs=require('fs');var path=require(_0x8873('0x5'));var rimraf=require(_0x8873('0x6'));var config=require(_0x8873('0x7'));var attributes=require(_0x8873('0x8'));module[_0x8873('0x9')]=function(_0x2242a9,_0x534d86){return _0x2242a9['define'](_0x8873('0xa'),attributes,{'tableName':_0x8873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 9993a15..2da6acd 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x360c=['then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','http','request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x360c,0x129));var _0xc360=function(_0x4ec682,_0xfb328f){_0x4ec682=_0x4ec682-0x0;var _0x143568=_0x360c[_0x4ec682];return _0x143568;};'use strict';var _=require(_0xc360('0x0'));var util=require(_0xc360('0x1'));var moment=require(_0xc360('0x2'));var BPromise=require('bluebird');var rs=require(_0xc360('0x3'));var fs=require('fs');var Redis=require(_0xc360('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc360('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc360('0x6'));var client=jayson['client'][_0xc360('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x333c67,_0x5a5595,_0x2ebff3){return new BPromise(function(_0x113e89,_0x444cdd){return client[_0xc360('0x8')](_0x333c67,_0x2ebff3)[_0xc360('0x9')](function(_0x23185b){logger['info'](_0xc360('0xa'),_0x5a5595,_0xc360('0xb'));logger[_0xc360('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5a5595,_0xc360('0xb'),JSON[_0xc360('0xd')](_0x23185b));if(_0x23185b[_0xc360('0xe')]){if(_0x23185b[_0xc360('0xe')][_0xc360('0xf')]===0x1f4){logger[_0xc360('0xe')]('ContactItemType,\x20%s,\x20%s',_0x5a5595,_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);return _0x444cdd(_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);}logger[_0xc360('0xe')](_0xc360('0xa'),_0x5a5595,_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);return _0x113e89(_0x23185b['error']['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x5a5595,_0xc360('0xb'));_0x113e89(_0x23185b['result']['message']);}})[_0xc360('0x11')](function(_0x5bf545){logger[_0xc360('0xe')]('ContactItemType,\x20%s,\x20%s',_0x5a5595,_0x5bf545);_0x444cdd(_0x5bf545);});});} \ No newline at end of file +var _0x2480=['randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2480,0x1c9));var _0x0248=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2480[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x0248('0x0'));var moment=require(_0x0248('0x1'));var BPromise=require(_0x0248('0x2'));var rs=require(_0x0248('0x3'));var fs=require('fs');var Redis=require(_0x0248('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0248('0x5'));var config=require(_0x0248('0x6'));var jayson=require(_0x0248('0x7'));var client=jayson['client'][_0x0248('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31c4e9,_0x50cd43,_0x422dbe){return new BPromise(function(_0x7b9b3,_0x257506){return client[_0x0248('0x9')](_0x31c4e9,_0x422dbe)[_0x0248('0xa')](function(_0x2265ec){logger[_0x0248('0xb')](_0x0248('0xc'),_0x50cd43,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x50cd43,_0x0248('0xd'),JSON[_0x0248('0xe')](_0x2265ec));if(_0x2265ec[_0x0248('0xf')]){if(_0x2265ec[_0x0248('0xf')][_0x0248('0x10')]===0x1f4){logger[_0x0248('0xf')]('ContactItemType,\x20%s,\x20%s',_0x50cd43,_0x2265ec[_0x0248('0xf')][_0x0248('0x11')]);return _0x257506(_0x2265ec['error'][_0x0248('0x11')]);}logger['error'](_0x0248('0xc'),_0x50cd43,_0x2265ec[_0x0248('0xf')]['message']);return _0x7b9b3(_0x2265ec[_0x0248('0xf')]['message']);}else{logger[_0x0248('0xb')](_0x0248('0xc'),_0x50cd43,_0x0248('0xd'));_0x7b9b3(_0x2265ec[_0x0248('0x12')]['message']);}})[_0x0248('0x13')](function(_0x4bdb7d){logger[_0x0248('0xf')]('ContactItemType,\x20%s,\x20%s',_0x50cd43,_0x4bdb7d);_0x257506(_0x4bdb7d);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b483eaf..fcc05ad 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50d1=['/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x50d1,0xcd));var _0x150d=function(_0x3a6104,_0x4fdd9f){_0x3a6104=_0x3a6104-0x0;var _0x6db10c=_0x50d1[_0x3a6104];return _0x6db10c;};'use strict';var multer=require('multer');var util=require(_0x150d('0x0'));var path=require(_0x150d('0x1'));var timeout=require(_0x150d('0x2'));var express=require(_0x150d('0x3'));var router=express['Router']();var fs_extra=require(_0x150d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x150d('0x5'));var config=require(_0x150d('0x6'));var controller=require(_0x150d('0x7'));router[_0x150d('0x8')]('/',auth[_0x150d('0x9')](),controller[_0x150d('0xa')]);router['get'](_0x150d('0xb'),auth[_0x150d('0x9')](),controller['show']);router['post']('/',auth[_0x150d('0x9')](),controller[_0x150d('0xc')]);router[_0x150d('0xd')]('/:id',auth[_0x150d('0x9')](),controller[_0x150d('0xe')]);router[_0x150d('0xf')](_0x150d('0xb'),auth[_0x150d('0x9')](),controller[_0x150d('0x10')]);module[_0x150d('0x11')]=router; \ No newline at end of file +var _0xd318=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated'];(function(_0x1e08e0,_0x1c7e1c){var _0x15ce0e=function(_0x3a41ca){while(--_0x3a41ca){_0x1e08e0['push'](_0x1e08e0['shift']());}};_0x15ce0e(++_0x1c7e1c);}(_0xd318,0xd2));var _0x8d31=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd318[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x8d31('0x0'));var util=require(_0x8d31('0x1'));var path=require(_0x8d31('0x2'));var timeout=require(_0x8d31('0x3'));var express=require(_0x8d31('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d31('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d31('0x6'));var controller=require(_0x8d31('0x7'));router[_0x8d31('0x8')]('/',auth[_0x8d31('0x9')](),controller[_0x8d31('0xa')]);router[_0x8d31('0x8')](_0x8d31('0xb'),auth[_0x8d31('0x9')](),controller[_0x8d31('0xc')]);router[_0x8d31('0xd')]('/',auth[_0x8d31('0x9')](),controller[_0x8d31('0xe')]);router[_0x8d31('0xf')]('/:id',auth[_0x8d31('0x9')](),controller[_0x8d31('0x10')]);router[_0x8d31('0x11')](_0x8d31('0xb'),auth[_0x8d31('0x9')](),controller[_0x8d31('0x12')]);module[_0x8d31('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 237df58..f860b84 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x11f064,_0x49e57d){var _0x1fb0e4=function(_0x5a622e){while(--_0x5a622e){_0x11f064['push'](_0x11f064['shift']());}};_0x1fb0e4(++_0x49e57d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a1633a1..fb26b4a 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 _0x8a97=['error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','Dashboard','findAll','rows','catch','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','updatedAt','omit','createdAt','iframe','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSmsAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','findOne','getItems','eml-format','rimraf','fast-json-patch','request-promise','moment','util','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','../../config/license/util','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus'];(function(_0x201b93,_0x236edc){var _0x35df8b=function(_0x91a6b7){while(--_0x91a6b7){_0x201b93['push'](_0x201b93['shift']());}};_0x35df8b(++_0x236edc);}(_0x8a97,0x14d));var _0x78a9=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x8a97[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0x78a9('0x0'));var rimraf=require(_0x78a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78a9('0x2'));var rp=require(_0x78a9('0x3'));var moment=require(_0x78a9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x78a9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x78a9('0x6'));var ejs=require(_0x78a9('0x7'));var fs=require('fs');var fs_extra=require(_0x78a9('0x8'));var _=require(_0x78a9('0x9'));var squel=require(_0x78a9('0xa'));var crypto=require(_0x78a9('0xb'));var jsforce=require(_0x78a9('0xc'));var deskjs=require(_0x78a9('0xd'));var toCsv=require(_0x78a9('0x6'));var querystring=require(_0x78a9('0xe'));var Papa=require(_0x78a9('0xf'));var Redis=require(_0x78a9('0x10'));var authService=require(_0x78a9('0x11'));var qs=require(_0x78a9('0x12'));var as=require(_0x78a9('0x13'));var hardwareService=require(_0x78a9('0x14'));var logger=require(_0x78a9('0x15'))(_0x78a9('0x16'));var utils=require(_0x78a9('0x17'));var config=require(_0x78a9('0x18'));var licenseUtil=require(_0x78a9('0x19'));var db=require('../../mysqldb')['db'];config[_0x78a9('0x1a')]=_[_0x78a9('0x1b')](config[_0x78a9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x78a9('0x1c'))(new Redis(config[_0x78a9('0x1a')]));require('./dashboard.socket')[_0x78a9('0x1d')](socket);function respondWithStatusCode(_0x393009,_0x1f1d4d){_0x1f1d4d=_0x1f1d4d||0xcc;return function(_0x52c519){if(_0x52c519){return _0x393009['sendStatus'](_0x1f1d4d);}return _0x393009[_0x78a9('0x1e')](_0x1f1d4d)[_0x78a9('0x1f')]();};}function respondWithResult(_0x12c857,_0x5700cb){_0x5700cb=_0x5700cb||0xc8;return function(_0x40c50e){if(_0x40c50e){return _0x12c857[_0x78a9('0x1e')](_0x5700cb)[_0x78a9('0x20')](_0x40c50e);}};}function respondWithFilteredResult(_0x15afff,_0x58aa82){return function(_0x3995bc){if(_0x3995bc){var _0x5a78c2=typeof _0x58aa82[_0x78a9('0x21')]==='undefined'&&typeof _0x58aa82['limit']===_0x78a9('0x22');var _0x5dca07=_0x3995bc[_0x78a9('0x23')];var _0x132e47=_0x5a78c2?0x0:_0x58aa82[_0x78a9('0x21')];var _0x1c8b06=_0x5a78c2?_0x3995bc[_0x78a9('0x23')]:_0x58aa82[_0x78a9('0x21')]+_0x58aa82[_0x78a9('0x24')];var _0x486e11;if(_0x1c8b06>=_0x5dca07){_0x1c8b06=_0x5dca07;_0x486e11=0xc8;}else{_0x486e11=0xce;}_0x15afff[_0x78a9('0x1e')](_0x486e11);return _0x15afff[_0x78a9('0x25')](_0x78a9('0x26'),_0x132e47+'-'+_0x1c8b06+'/'+_0x5dca07)[_0x78a9('0x20')](_0x3995bc);}return null;};}function patchUpdates(_0x4c7f3d){return function(_0x4bc052){try{jsonpatch[_0x78a9('0x27')](_0x4bc052,_0x4c7f3d,!![]);}catch(_0x3eb2ea){return BPromise['reject'](_0x3eb2ea);}return _0x4bc052[_0x78a9('0x28')]();};}function saveUpdates(_0x63937d,_0x54004b){return function(_0x58b0f7){if(_0x58b0f7){return _0x58b0f7[_0x78a9('0x29')](_0x63937d)[_0x78a9('0x2a')](function(_0x52f907){return _0x52f907;});}return null;};}function removeEntity(_0x3dc103,_0x1bc8bd){return function(_0x4e1ee2){if(_0x4e1ee2){return _0x4e1ee2[_0x78a9('0x2b')]()[_0x78a9('0x2a')](function(){var _0x1d2161=_0x4e1ee2[_0x78a9('0x2c')]({'plain':!![]});var _0x418637=_0x78a9('0x2d');return db[_0x78a9('0x2e')][_0x78a9('0x2b')]({'where':{'type':_0x418637,'resourceId':_0x1d2161['id']}})['then'](function(){return _0x4e1ee2;});})[_0x78a9('0x2a')](function(){_0x3dc103[_0x78a9('0x1e')](0xcc)[_0x78a9('0x1f')]();});}};}function handleEntityNotFound(_0x1de033,_0x4b05e6){return function(_0x1e5905){if(!_0x1e5905){_0x1de033[_0x78a9('0x2f')](0x194);}return _0x1e5905;};}function handleError(_0x5dd118,_0x16ae9a){_0x16ae9a=_0x16ae9a||0x1f4;return function(_0x5ba81a){logger[_0x78a9('0x30')](_0x5ba81a[_0x78a9('0x31')]);if(_0x5ba81a[_0x78a9('0x32')]){delete _0x5ba81a['name'];}_0x5dd118['status'](_0x16ae9a)['send'](_0x5ba81a);};}exports[_0x78a9('0x33')]=function(_0x14c0d7,_0x373c36){var _0x118c5b={},_0x5929a3={},_0x1d3002={'count':0x0,'rows':[]};var _0x4c20a8=_['map'](db['Dashboard'][_0x78a9('0x34')],function(_0x524440){return{'name':_0x524440[_0x78a9('0x35')],'type':_0x524440[_0x78a9('0x36')][_0x78a9('0x37')]};});_0x5929a3[_0x78a9('0x38')]=_[_0x78a9('0x39')](_0x4c20a8,_0x78a9('0x32'));_0x5929a3[_0x78a9('0x3a')]=_[_0x78a9('0x3b')](_0x14c0d7[_0x78a9('0x3a')]);_0x5929a3['filters']=_[_0x78a9('0x3c')](_0x5929a3[_0x78a9('0x38')],_0x5929a3[_0x78a9('0x3a')]);_0x118c5b[_0x78a9('0x3d')]=_['intersection'](_0x5929a3[_0x78a9('0x38')],qs[_0x78a9('0x3e')](_0x14c0d7['query'][_0x78a9('0x3e')]));_0x118c5b[_0x78a9('0x3d')]=_0x118c5b[_0x78a9('0x3d')]['length']?_0x118c5b[_0x78a9('0x3d')]:_0x5929a3[_0x78a9('0x38')];if(!_0x14c0d7['query'][_0x78a9('0x3f')](_0x78a9('0x40'))){_0x118c5b[_0x78a9('0x24')]=qs[_0x78a9('0x24')](_0x14c0d7[_0x78a9('0x3a')][_0x78a9('0x24')]);_0x118c5b[_0x78a9('0x21')]=qs[_0x78a9('0x21')](_0x14c0d7[_0x78a9('0x3a')][_0x78a9('0x21')]);}_0x118c5b[_0x78a9('0x41')]=qs[_0x78a9('0x42')](_0x14c0d7['query'][_0x78a9('0x42')]);_0x118c5b['where']=qs[_0x78a9('0x43')](_[_0x78a9('0x44')](_0x14c0d7[_0x78a9('0x3a')],_0x5929a3[_0x78a9('0x43')]),_0x4c20a8);if(_0x14c0d7[_0x78a9('0x3a')]['filter']){_0x118c5b[_0x78a9('0x45')]=_[_0x78a9('0x46')](_0x118c5b['where'],{'$or':_[_0x78a9('0x39')](_0x4c20a8,function(_0x500960){if(_0x500960[_0x78a9('0x36')]!==_0x78a9('0x47')){var _0x46a6ac={};_0x46a6ac[_0x500960['name']]={'$like':'%'+_0x14c0d7[_0x78a9('0x3a')][_0x78a9('0x48')]+'%'};return _0x46a6ac;}})});}_0x118c5b=_[_0x78a9('0x46')]({},_0x118c5b,_0x14c0d7[_0x78a9('0x49')]);var _0x35bc09={'where':_0x118c5b[_0x78a9('0x45')]};return db['Dashboard'][_0x78a9('0x23')](_0x35bc09)['then'](function(_0x2def02){_0x1d3002[_0x78a9('0x23')]=_0x2def02;if(_0x14c0d7[_0x78a9('0x3a')][_0x78a9('0x4a')]){_0x118c5b[_0x78a9('0x4b')]=[{'all':!![]}];}return db[_0x78a9('0x4c')][_0x78a9('0x4d')](_0x118c5b);})[_0x78a9('0x2a')](function(_0x55b96a){_0x1d3002[_0x78a9('0x4e')]=_0x55b96a;return _0x1d3002;})['then'](respondWithFilteredResult(_0x373c36,_0x118c5b))[_0x78a9('0x4f')](handleError(_0x373c36,null));};exports['show']=function(_0x5c5481,_0x47ea84){var _0x244b81={'raw':![],'where':{'id':_0x5c5481['params']['id']}},_0x25cb62={};_0x25cb62[_0x78a9('0x38')]=_[_0x78a9('0x3b')](db[_0x78a9('0x4c')][_0x78a9('0x34')]);_0x25cb62[_0x78a9('0x3a')]=_['keys'](_0x5c5481[_0x78a9('0x3a')]);_0x25cb62[_0x78a9('0x43')]=_['intersection'](_0x25cb62[_0x78a9('0x38')],_0x25cb62[_0x78a9('0x3a')]);_0x244b81[_0x78a9('0x3d')]=_['intersection'](_0x25cb62[_0x78a9('0x38')],qs[_0x78a9('0x3e')](_0x5c5481[_0x78a9('0x3a')]['fields']));_0x244b81[_0x78a9('0x3d')]=_0x244b81[_0x78a9('0x3d')][_0x78a9('0x50')]?_0x244b81[_0x78a9('0x3d')]:_0x25cb62['model'];if(_0x5c5481['query'][_0x78a9('0x4a')]){_0x244b81['include']=[{'all':!![]}];}_0x244b81=_[_0x78a9('0x46')]({},_0x244b81,_0x5c5481['options']);return db['Dashboard']['find'](_0x244b81)['then'](handleEntityNotFound(_0x47ea84,null))[_0x78a9('0x2a')](respondWithResult(_0x47ea84,null))['catch'](handleError(_0x47ea84,null));};exports[_0x78a9('0x51')]=function(_0x28460a,_0x1b8643){return db[_0x78a9('0x4c')][_0x78a9('0x51')](_0x28460a[_0x78a9('0x52')],{})[_0x78a9('0x2a')](function(_0x3e424f){var _0x512373=_0x28460a['user']['get']({'plain':!![]});if(!_0x512373)throw new Error(_0x78a9('0x53'));if(_0x512373[_0x78a9('0x54')]===_0x78a9('0x55')){var _0x2b11f4=_0x3e424f['get']({'plain':!![]});var _0x17fa1a='CustomDashboards';return db[_0x78a9('0x56')]['find']({'where':{'name':_0x17fa1a,'userProfileId':_0x512373[_0x78a9('0x57')]},'raw':!![]})['then'](function(_0x53dfae){if(_0x53dfae&&_0x53dfae['autoAssociation']===0x0){return db['UserProfileResource'][_0x78a9('0x51')]({'name':_0x2b11f4[_0x78a9('0x32')],'resourceId':_0x2b11f4['id'],'type':_0x53dfae['name'],'sectionId':_0x53dfae['id']},{})[_0x78a9('0x2a')](function(){return _0x3e424f;});}else{return _0x3e424f;}})[_0x78a9('0x4f')](function(_0x38e22c){logger[_0x78a9('0x30')](_0x78a9('0x58'),_0x38e22c);throw _0x38e22c;});}return _0x3e424f;})[_0x78a9('0x2a')](respondWithResult(_0x1b8643,0xc9))[_0x78a9('0x4f')](handleError(_0x1b8643,null));};exports[_0x78a9('0x59')]=function(_0x3a4b0e,_0x13bd2f){var _0x577585={'where':{'id':_0x3a4b0e[_0x78a9('0x5a')]['id']}},_0x263756={};_0x263756[_0x78a9('0x38')]=_['keys'](db[_0x78a9('0x4c')][_0x78a9('0x34')]);_0x577585[_0x78a9('0x3d')]=_[_0x78a9('0x3c')](_0x263756['model'],qs[_0x78a9('0x3e')](_0x3a4b0e[_0x78a9('0x3a')][_0x78a9('0x3e')]));_0x577585['attributes']=_0x577585[_0x78a9('0x3d')][_0x78a9('0x50')]?_0x577585[_0x78a9('0x3d')]:_0x263756[_0x78a9('0x38')];if(_0x3a4b0e[_0x78a9('0x3a')][_0x78a9('0x4a')]){_0x577585[_0x78a9('0x4b')]=[{'all':!![]}];}_0x577585=_[_0x78a9('0x46')]({},_0x577585,_0x3a4b0e[_0x78a9('0x49')]);return db[_0x78a9('0x4c')][_0x78a9('0x5b')](_0x577585)['then'](handleEntityNotFound(_0x13bd2f,null))[_0x78a9('0x2a')](function(_0x4a7863){if(_0x4a7863){var _0x2ebbc6=_0x4a7863[_0x78a9('0x2c')]({'plain':!![]});_0x2ebbc6=qs['omit'](_0x2ebbc6,['id','createdAt',_0x78a9('0x5c')]);_0x3a4b0e[_0x78a9('0x52')]=_[_0x78a9('0x5d')](_0x3a4b0e[_0x78a9('0x52')],['id',_0x78a9('0x5e'),'updatedAt']);return db[_0x78a9('0x4c')][_0x78a9('0x51')](_[_0x78a9('0x46')](_0x2ebbc6,_0x3a4b0e[_0x78a9('0x52')]),{'include':_0x3a4b0e[_0x78a9('0x3a')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x49362b){var _0x1e9bd2=_0x3a4b0e[_0x78a9('0x55')][_0x78a9('0x2c')]({'plain':!![]});if(!_0x1e9bd2)throw new Error(_0x78a9('0x53'));if(_0x1e9bd2[_0x78a9('0x54')]===_0x78a9('0x55')){var _0x5053cc=_0x49362b[_0x78a9('0x2c')]({'plain':!![]});var _0x46b346=_0x78a9('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x46b346,'userProfileId':_0x1e9bd2[_0x78a9('0x57')]},'raw':!![]})[_0x78a9('0x2a')](function(_0x4d8811){if(_0x4d8811&&_0x4d8811['autoAssociation']===0x0){return db[_0x78a9('0x2e')][_0x78a9('0x51')]({'name':_0x5053cc[_0x78a9('0x32')],'resourceId':_0x5053cc['id'],'type':_0x4d8811[_0x78a9('0x32')],'sectionId':_0x4d8811['id']},{})[_0x78a9('0x2a')](function(){return _0x49362b;});}else{return _0x49362b;}})[_0x78a9('0x4f')](function(_0x6bc5cc){logger[_0x78a9('0x30')](_0x78a9('0x58'),_0x6bc5cc);throw _0x6bc5cc;});}return _0x49362b;});}})[_0x78a9('0x2a')](respondWithResult(_0x13bd2f,0xc9))[_0x78a9('0x4f')](handleError(_0x13bd2f,null));};exports[_0x78a9('0x29')]=function(_0x2f1f75,_0x1c30f6){if(_0x2f1f75[_0x78a9('0x52')]['id']){delete _0x2f1f75[_0x78a9('0x52')]['id'];}return db[_0x78a9('0x4c')][_0x78a9('0x5b')]({'where':{'id':_0x2f1f75[_0x78a9('0x5a')]['id']}})[_0x78a9('0x2a')](handleEntityNotFound(_0x1c30f6,null))[_0x78a9('0x2a')](saveUpdates(_0x2f1f75[_0x78a9('0x52')],null))['then'](respondWithResult(_0x1c30f6,null))[_0x78a9('0x4f')](handleError(_0x1c30f6,null));};exports['destroy']=function(_0x218c16,_0x4e3672){return db[_0x78a9('0x4c')]['find']({'where':{'id':_0x218c16['params']['id']}})['then'](handleEntityNotFound(_0x4e3672,null))[_0x78a9('0x2a')](removeEntity(_0x4e3672,null))[_0x78a9('0x4f')](handleError(_0x4e3672,null));};function widgetAttributes(_0x52fc5f){try{switch(_0x52fc5f[_0x78a9('0x36')]){case _0x78a9('0x5f'):return[{'name':_0x78a9('0x60'),'value':_0x52fc5f[_0x78a9('0x60')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x0]?_0x52fc5f[_0x78a9('0x61')][0x0]['value']:undefined)||'https://'}];case _0x78a9('0x62'):return[{'name':_0x78a9('0x63'),'value':_0x52fc5f[_0x78a9('0x63')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x0]?_0x52fc5f[_0x78a9('0x61')][0x0]['value']:undefined)||''}];case _0x78a9('0x64'):return[{'name':_0x78a9('0x65'),'value':_0x52fc5f[_0x78a9('0x65')]||(_0x52fc5f['attrs']&&_0x52fc5f[_0x78a9('0x61')][0x0]?_0x52fc5f['attrs'][0x0][_0x78a9('0x66')]:undefined)||_0x78a9('0x67')},{'name':_0x78a9('0x68'),'value':_0x52fc5f['attrTimezone']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x1]?_0x52fc5f[_0x78a9('0x61')][0x1][_0x78a9('0x66')]:undefined)||'0.00'},{'name':_0x78a9('0x69'),'value':_0x52fc5f[_0x78a9('0x69')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x2]?_0x52fc5f[_0x78a9('0x61')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x52fc5f[_0x78a9('0x6a')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f['attrs'][0x0]?_0x52fc5f[_0x78a9('0x61')][0x0][_0x78a9('0x66')]:undefined)||'total'},{'name':_0x78a9('0x6b'),'value':_0x52fc5f[_0x78a9('0x6b')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x1]?_0x52fc5f[_0x78a9('0x61')][0x1]['value']:undefined)||[]},{'name':_0x78a9('0x69'),'value':_0x52fc5f[_0x78a9('0x69')]||(_0x52fc5f['attrs']&&_0x52fc5f[_0x78a9('0x61')][0x2]?_0x52fc5f[_0x78a9('0x61')][0x2][_0x78a9('0x66')]:undefined)||0x14},{'name':_0x78a9('0x6c'),'value':_0x52fc5f['attrChannel']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x3]?_0x52fc5f['attrs'][0x3][_0x78a9('0x66')]:undefined)||_0x78a9('0x6d')},{'name':_0x78a9('0x6e'),'value':_0x52fc5f[_0x78a9('0x6e')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x4]?_0x52fc5f[_0x78a9('0x61')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x52fc5f['attrFaxAccounts']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x5]?_0x52fc5f[_0x78a9('0x61')][0x5][_0x78a9('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x52fc5f['attrSmsAccounts']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x6]?_0x52fc5f[_0x78a9('0x61')][0x6][_0x78a9('0x66')]:undefined)||''},{'name':_0x78a9('0x6f'),'value':_0x52fc5f[_0x78a9('0x6f')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x7]?_0x52fc5f[_0x78a9('0x61')][0x7][_0x78a9('0x66')]:undefined)||''},{'name':_0x78a9('0x70'),'value':_0x52fc5f[_0x78a9('0x70')]||(_0x52fc5f['attrs']&&_0x52fc5f['attrs'][0x8]?_0x52fc5f[_0x78a9('0x61')][0x8]['value']:undefined)||''},{'name':_0x78a9('0x71'),'value':_0x52fc5f['attrChatWebsites']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x9]?_0x52fc5f['attrs'][0x9][_0x78a9('0x66')]:undefined)||''}];case _0x78a9('0x72'):case _0x78a9('0x73'):return[{'name':'attrSerie1','value':_0x52fc5f[_0x78a9('0x74')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f['attrs'][0x0]?_0x52fc5f[_0x78a9('0x61')][0x0][_0x78a9('0x66')]:undefined)||'total'},{'name':_0x78a9('0x75'),'value':_0x52fc5f['attrSerie2']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x1]?_0x52fc5f[_0x78a9('0x61')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x52fc5f['attrSerie3']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f['attrs'][0x2]?_0x52fc5f[_0x78a9('0x61')][0x2][_0x78a9('0x66')]:undefined)||null},{'name':_0x78a9('0x6b'),'value':_0x52fc5f[_0x78a9('0x6b')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x3]?_0x52fc5f[_0x78a9('0x61')][0x3][_0x78a9('0x66')]:undefined)||[]},{'name':_0x78a9('0x6c'),'value':_0x52fc5f[_0x78a9('0x6c')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x4]?_0x52fc5f[_0x78a9('0x61')][0x4][_0x78a9('0x66')]:undefined)||_0x78a9('0x6d')},{'name':_0x78a9('0x6e'),'value':_0x52fc5f[_0x78a9('0x6e')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x5]?_0x52fc5f[_0x78a9('0x61')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x52fc5f['attrFaxAccounts']||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f['attrs'][0x6]?_0x52fc5f[_0x78a9('0x61')][0x6][_0x78a9('0x66')]:undefined)||''},{'name':_0x78a9('0x76'),'value':_0x52fc5f[_0x78a9('0x76')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f['attrs'][0x7]?_0x52fc5f[_0x78a9('0x61')][0x7][_0x78a9('0x66')]:undefined)||''},{'name':_0x78a9('0x6f'),'value':_0x52fc5f[_0x78a9('0x6f')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x8]?_0x52fc5f[_0x78a9('0x61')][0x8][_0x78a9('0x66')]:undefined)||''},{'name':_0x78a9('0x70'),'value':_0x52fc5f[_0x78a9('0x70')]||(_0x52fc5f['attrs']&&_0x52fc5f[_0x78a9('0x61')][0x9]?_0x52fc5f[_0x78a9('0x61')][0x9]['value']:undefined)||''},{'name':_0x78a9('0x71'),'value':_0x52fc5f[_0x78a9('0x71')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0xa]?_0x52fc5f[_0x78a9('0x61')][0xa][_0x78a9('0x66')]:undefined)||''}];case'web-report':return[{'name':_0x78a9('0x77'),'type':_0x52fc5f[_0x78a9('0x78')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x0]?_0x52fc5f['attrs'][0x0][_0x78a9('0x36')]:undefined)||null,'value':_0x52fc5f[_0x78a9('0x77')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x0]?_0x52fc5f['attrs'][0x0][_0x78a9('0x66')]:undefined)||null},{'name':_0x78a9('0x79'),'value':_0x52fc5f[_0x78a9('0x79')]||(_0x52fc5f[_0x78a9('0x61')]&&_0x52fc5f[_0x78a9('0x61')][0x1]?_0x52fc5f[_0x78a9('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x42ba8b){logger[_0x78a9('0x30')](_0x78a9('0x7a'),JSON[_0x78a9('0x7b')](_0x42ba8b));return[];}}exports['addItem']=function(_0x492ad4,_0x552d5a,_0x477af1){if(_0x492ad4[_0x78a9('0x52')]['id']){delete _0x492ad4[_0x78a9('0x52')]['id'];}return db[_0x78a9('0x4c')]['find']({'where':{'id':_0x492ad4[_0x78a9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x552d5a,null))['then'](function(_0x5b3215){if(_0x5b3215){_0x492ad4[_0x78a9('0x52')]['DashboardId']=_0x5b3215['id'];_0x492ad4[_0x78a9('0x52')][_0x78a9('0x61')]=widgetAttributes(_0x492ad4[_0x78a9('0x52')]);return db[_0x78a9('0x7c')]['create'](_0x492ad4[_0x78a9('0x52')]);}})[_0x78a9('0x2a')](respondWithResult(_0x552d5a,null))[_0x78a9('0x4f')](handleError(_0x552d5a,null));};exports['getItems']=function(_0x245a50,_0xde24de,_0x134fca){var _0x1be036={};var _0x4eed97={};var _0x2ee389;var _0x216dd4;return db[_0x78a9('0x4c')][_0x78a9('0x7d')]({'where':{'id':_0x245a50['params']['id']}})[_0x78a9('0x2a')](handleEntityNotFound(_0xde24de,null))[_0x78a9('0x2a')](function(_0x3d4413){if(_0x3d4413){_0x2ee389=_0x3d4413;_0x4eed97[_0x78a9('0x38')]=_[_0x78a9('0x3b')](db[_0x78a9('0x7c')][_0x78a9('0x34')]);_0x4eed97['query']=_[_0x78a9('0x3b')](_0x245a50[_0x78a9('0x3a')]);_0x4eed97['filters']=_['intersection'](_0x4eed97[_0x78a9('0x38')],_0x4eed97['query']);_0x1be036[_0x78a9('0x3d')]=_[_0x78a9('0x3c')](_0x4eed97[_0x78a9('0x38')],qs['fields'](_0x245a50[_0x78a9('0x3a')]['fields']));_0x1be036[_0x78a9('0x3d')]=_0x1be036[_0x78a9('0x3d')]['length']?_0x1be036['attributes']:_0x4eed97[_0x78a9('0x38')];_0x1be036[_0x78a9('0x41')]=qs[_0x78a9('0x42')](_0x245a50[_0x78a9('0x3a')][_0x78a9('0x42')]);_0x1be036['where']=qs['filters'](_[_0x78a9('0x44')](_0x245a50[_0x78a9('0x3a')],_0x4eed97[_0x78a9('0x43')]));if(_0x245a50[_0x78a9('0x3a')]['filter']){_0x1be036['where']=_['merge'](_0x1be036[_0x78a9('0x45')],{'$or':_[_0x78a9('0x39')](_0x1be036['attributes'],function(_0x1b75f5){var _0x4b9042={};_0x4b9042[_0x1b75f5]={'$like':'%'+_0x245a50['query'][_0x78a9('0x48')]+'%'};return _0x4b9042;})});}_0x1be036=_['merge']({},_0x1be036,_0x245a50[_0x78a9('0x49')]);return _0x2ee389[_0x78a9('0x7e')](_0x1be036);}})[_0x78a9('0x2a')](function(_0x3ce1aa){if(_0x3ce1aa){_0x216dd4=_0x3ce1aa['length'];if(!_0x245a50[_0x78a9('0x3a')][_0x78a9('0x3f')](_0x78a9('0x40'))){_0x1be036['limit']=qs[_0x78a9('0x24')](_0x245a50[_0x78a9('0x3a')][_0x78a9('0x24')]);_0x1be036[_0x78a9('0x21')]=qs[_0x78a9('0x21')](_0x245a50['query'][_0x78a9('0x21')]);}return _0x2ee389[_0x78a9('0x7e')](_0x1be036);}})[_0x78a9('0x2a')](function(_0x571241){if(_0x571241){return _0x571241?{'count':_0x216dd4,'rows':_0x571241}:null;}})[_0x78a9('0x2a')](respondWithResult(_0xde24de,null))[_0x78a9('0x4f')](handleError(_0xde24de,null));}; \ No newline at end of file +var _0x021c=['rawAttributes','body','omit','createdAt','role','UserProfileSection','userProfileId','iframe','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','sort','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','options','includeAll','include','findAll','show','keys','length','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params'];(function(_0x35c221,_0x19b148){var _0x484c4a=function(_0x38032c){while(--_0x38032c){_0x35c221['push'](_0x35c221['shift']());}};_0x484c4a(++_0x19b148);}(_0x021c,0x1a6));var _0xc021=function(_0x581aae,_0x2b18ee){_0x581aae=_0x581aae-0x0;var _0x539df2=_0x021c[_0x581aae];return _0x539df2;};'use strict';var emlformat=require(_0xc021('0x0'));var rimraf=require(_0xc021('0x1'));var zipdir=require(_0xc021('0x2'));var jsonpatch=require(_0xc021('0x3'));var rp=require(_0xc021('0x4'));var moment=require('moment');var BPromise=require(_0xc021('0x5'));var Mustache=require(_0xc021('0x6'));var util=require(_0xc021('0x7'));var path=require(_0xc021('0x8'));var sox=require('sox');var csv=require(_0xc021('0x9'));var ejs=require(_0xc021('0xa'));var fs=require('fs');var fs_extra=require(_0xc021('0xb'));var _=require('lodash');var squel=require(_0xc021('0xc'));var crypto=require(_0xc021('0xd'));var jsforce=require(_0xc021('0xe'));var deskjs=require(_0xc021('0xf'));var toCsv=require(_0xc021('0x9'));var querystring=require('querystring');var Papa=require(_0xc021('0x10'));var Redis=require('ioredis');var authService=require(_0xc021('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc021('0x12'));var hardwareService=require(_0xc021('0x13'));var logger=require(_0xc021('0x14'))('api');var utils=require(_0xc021('0x15'));var config=require(_0xc021('0x16'));var licenseUtil=require(_0xc021('0x17'));var db=require('../../mysqldb')['db'];config[_0xc021('0x18')]=_['defaults'](config[_0xc021('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc021('0x19'))(new Redis(config['redis']));require('./dashboard.socket')[_0xc021('0x1a')](socket);function respondWithStatusCode(_0x3f616a,_0x155a38){_0x155a38=_0x155a38||0xcc;return function(_0x3f6574){if(_0x3f6574){return _0x3f616a[_0xc021('0x1b')](_0x155a38);}return _0x3f616a[_0xc021('0x1c')](_0x155a38)[_0xc021('0x1d')]();};}function respondWithResult(_0x47833e,_0x2b36d6){_0x2b36d6=_0x2b36d6||0xc8;return function(_0x41cc1f){if(_0x41cc1f){return _0x47833e[_0xc021('0x1c')](_0x2b36d6)['json'](_0x41cc1f);}};}function respondWithFilteredResult(_0x2814f2,_0x29dc9c){return function(_0x4d4273){if(_0x4d4273){var _0x415ca8=typeof _0x29dc9c[_0xc021('0x1e')]===_0xc021('0x1f')&&typeof _0x29dc9c[_0xc021('0x20')]==='undefined';var _0x1ad328=_0x4d4273[_0xc021('0x21')];var _0x493814=_0x415ca8?0x0:_0x29dc9c['offset'];var _0x5322eb=_0x415ca8?_0x4d4273[_0xc021('0x21')]:_0x29dc9c[_0xc021('0x1e')]+_0x29dc9c['limit'];var _0x218268;if(_0x5322eb>=_0x1ad328){_0x5322eb=_0x1ad328;_0x218268=0xc8;}else{_0x218268=0xce;}_0x2814f2[_0xc021('0x1c')](_0x218268);return _0x2814f2['set'](_0xc021('0x22'),_0x493814+'-'+_0x5322eb+'/'+_0x1ad328)[_0xc021('0x23')](_0x4d4273);}return null;};}function patchUpdates(_0x8a2546){return function(_0x1d2160){try{jsonpatch[_0xc021('0x24')](_0x1d2160,_0x8a2546,!![]);}catch(_0x5b205d){return BPromise[_0xc021('0x25')](_0x5b205d);}return _0x1d2160['save']();};}function saveUpdates(_0x5de1a8,_0x4d5a4a){return function(_0x2aeeac){if(_0x2aeeac){return _0x2aeeac[_0xc021('0x26')](_0x5de1a8)[_0xc021('0x27')](function(_0x26a215){return _0x26a215;});}return null;};}function removeEntity(_0x570710,_0x4a3337){return function(_0xf52922){if(_0xf52922){return _0xf52922[_0xc021('0x28')]()[_0xc021('0x27')](function(){var _0xbe9ac3=_0xf52922[_0xc021('0x29')]({'plain':!![]});var _0x44fa3e=_0xc021('0x2a');return db[_0xc021('0x2b')][_0xc021('0x28')]({'where':{'type':_0x44fa3e,'resourceId':_0xbe9ac3['id']}})[_0xc021('0x27')](function(){return _0xf52922;});})[_0xc021('0x27')](function(){_0x570710[_0xc021('0x1c')](0xcc)[_0xc021('0x1d')]();});}};}function handleEntityNotFound(_0x3d801e,_0x40fa8e){return function(_0x30cf9a){if(!_0x30cf9a){_0x3d801e[_0xc021('0x1b')](0x194);}return _0x30cf9a;};}function handleError(_0x585643,_0x39c099){_0x39c099=_0x39c099||0x1f4;return function(_0x5ad5b5){logger[_0xc021('0x2c')](_0x5ad5b5['stack']);if(_0x5ad5b5[_0xc021('0x2d')]){delete _0x5ad5b5[_0xc021('0x2d')];}_0x585643['status'](_0x39c099)[_0xc021('0x2e')](_0x5ad5b5);};}exports[_0xc021('0x2f')]=function(_0x7cca39,_0x29f1e0){var _0x2fc81e={},_0x34ec97={},_0x36b8b7={'count':0x0,'rows':[]};var _0x3182b9=_[_0xc021('0x30')](db[_0xc021('0x31')]['rawAttributes'],function(_0x5ba70a){return{'name':_0x5ba70a[_0xc021('0x32')],'type':_0x5ba70a[_0xc021('0x33')][_0xc021('0x34')]};});_0x34ec97['model']=_[_0xc021('0x30')](_0x3182b9,'name');_0x34ec97[_0xc021('0x35')]=_['keys'](_0x7cca39[_0xc021('0x35')]);_0x34ec97['filters']=_[_0xc021('0x36')](_0x34ec97[_0xc021('0x37')],_0x34ec97[_0xc021('0x35')]);_0x2fc81e[_0xc021('0x38')]=_[_0xc021('0x36')](_0x34ec97[_0xc021('0x37')],qs[_0xc021('0x39')](_0x7cca39[_0xc021('0x35')][_0xc021('0x39')]));_0x2fc81e['attributes']=_0x2fc81e[_0xc021('0x38')]['length']?_0x2fc81e['attributes']:_0x34ec97[_0xc021('0x37')];if(!_0x7cca39[_0xc021('0x35')][_0xc021('0x3a')](_0xc021('0x3b'))){_0x2fc81e['limit']=qs[_0xc021('0x20')](_0x7cca39[_0xc021('0x35')][_0xc021('0x20')]);_0x2fc81e[_0xc021('0x1e')]=qs['offset'](_0x7cca39[_0xc021('0x35')][_0xc021('0x1e')]);}_0x2fc81e[_0xc021('0x3c')]=qs['sort'](_0x7cca39[_0xc021('0x35')]['sort']);_0x2fc81e[_0xc021('0x3d')]=qs['filters'](_[_0xc021('0x3e')](_0x7cca39[_0xc021('0x35')],_0x34ec97[_0xc021('0x3f')]),_0x3182b9);if(_0x7cca39[_0xc021('0x35')][_0xc021('0x40')]){_0x2fc81e['where']=_[_0xc021('0x41')](_0x2fc81e[_0xc021('0x3d')],{'$or':_[_0xc021('0x30')](_0x3182b9,function(_0x130536){if(_0x130536[_0xc021('0x33')]!=='VIRTUAL'){var _0x3b7924={};_0x3b7924[_0x130536[_0xc021('0x2d')]]={'$like':'%'+_0x7cca39[_0xc021('0x35')][_0xc021('0x40')]+'%'};return _0x3b7924;}})});}_0x2fc81e=_[_0xc021('0x41')]({},_0x2fc81e,_0x7cca39[_0xc021('0x42')]);var _0x26f4d7={'where':_0x2fc81e[_0xc021('0x3d')]};return db[_0xc021('0x31')][_0xc021('0x21')](_0x26f4d7)[_0xc021('0x27')](function(_0xd9a9d3){_0x36b8b7[_0xc021('0x21')]=_0xd9a9d3;if(_0x7cca39[_0xc021('0x35')][_0xc021('0x43')]){_0x2fc81e[_0xc021('0x44')]=[{'all':!![]}];}return db[_0xc021('0x31')][_0xc021('0x45')](_0x2fc81e);})[_0xc021('0x27')](function(_0x15faa6){_0x36b8b7['rows']=_0x15faa6;return _0x36b8b7;})['then'](respondWithFilteredResult(_0x29f1e0,_0x2fc81e))['catch'](handleError(_0x29f1e0,null));};exports[_0xc021('0x46')]=function(_0x34209a,_0x1344b1){var _0x5057f9={'raw':![],'where':{'id':_0x34209a['params']['id']}},_0x4b358f={};_0x4b358f['model']=_[_0xc021('0x47')](db[_0xc021('0x31')]['rawAttributes']);_0x4b358f[_0xc021('0x35')]=_[_0xc021('0x47')](_0x34209a[_0xc021('0x35')]);_0x4b358f[_0xc021('0x3f')]=_[_0xc021('0x36')](_0x4b358f[_0xc021('0x37')],_0x4b358f[_0xc021('0x35')]);_0x5057f9['attributes']=_['intersection'](_0x4b358f[_0xc021('0x37')],qs[_0xc021('0x39')](_0x34209a[_0xc021('0x35')][_0xc021('0x39')]));_0x5057f9['attributes']=_0x5057f9[_0xc021('0x38')][_0xc021('0x48')]?_0x5057f9[_0xc021('0x38')]:_0x4b358f[_0xc021('0x37')];if(_0x34209a[_0xc021('0x35')][_0xc021('0x43')]){_0x5057f9[_0xc021('0x44')]=[{'all':!![]}];}_0x5057f9=_[_0xc021('0x41')]({},_0x5057f9,_0x34209a['options']);return db['Dashboard']['find'](_0x5057f9)[_0xc021('0x27')](handleEntityNotFound(_0x1344b1,null))[_0xc021('0x27')](respondWithResult(_0x1344b1,null))[_0xc021('0x49')](handleError(_0x1344b1,null));};exports['create']=function(_0x77d977,_0x198257){return db[_0xc021('0x31')]['create'](_0x77d977['body'],{})['then'](function(_0x68d6a0){var _0x423373=_0x77d977[_0xc021('0x4a')][_0xc021('0x29')]({'plain':!![]});if(!_0x423373)throw new Error(_0xc021('0x4b'));if(_0x423373['role']===_0xc021('0x4a')){var _0x2c35a8=_0x68d6a0[_0xc021('0x29')]({'plain':!![]});var _0x3bbd8b=_0xc021('0x2a');return db['UserProfileSection'][_0xc021('0x4c')]({'where':{'name':_0x3bbd8b,'userProfileId':_0x423373['userProfileId']},'raw':!![]})[_0xc021('0x27')](function(_0x4d7be7){if(_0x4d7be7&&_0x4d7be7[_0xc021('0x4d')]===0x0){return db[_0xc021('0x2b')][_0xc021('0x4e')]({'name':_0x2c35a8[_0xc021('0x2d')],'resourceId':_0x2c35a8['id'],'type':_0x4d7be7[_0xc021('0x2d')],'sectionId':_0x4d7be7['id']},{})[_0xc021('0x27')](function(){return _0x68d6a0;});}else{return _0x68d6a0;}})[_0xc021('0x49')](function(_0xafec8d){logger[_0xc021('0x2c')](_0xc021('0x4f'),_0xafec8d);throw _0xafec8d;});}return _0x68d6a0;})[_0xc021('0x27')](respondWithResult(_0x198257,0xc9))[_0xc021('0x49')](handleError(_0x198257,null));};exports[_0xc021('0x50')]=function(_0xeb9816,_0x41a7ec){var _0xf1b69b={'where':{'id':_0xeb9816[_0xc021('0x51')]['id']}},_0x2caa06={};_0x2caa06[_0xc021('0x37')]=_[_0xc021('0x47')](db[_0xc021('0x31')][_0xc021('0x52')]);_0xf1b69b[_0xc021('0x38')]=_[_0xc021('0x36')](_0x2caa06[_0xc021('0x37')],qs[_0xc021('0x39')](_0xeb9816[_0xc021('0x35')][_0xc021('0x39')]));_0xf1b69b[_0xc021('0x38')]=_0xf1b69b[_0xc021('0x38')][_0xc021('0x48')]?_0xf1b69b[_0xc021('0x38')]:_0x2caa06[_0xc021('0x37')];if(_0xeb9816[_0xc021('0x35')][_0xc021('0x43')]){_0xf1b69b[_0xc021('0x44')]=[{'all':!![]}];}_0xf1b69b=_[_0xc021('0x41')]({},_0xf1b69b,_0xeb9816[_0xc021('0x42')]);return db[_0xc021('0x31')][_0xc021('0x4c')](_0xf1b69b)['then'](handleEntityNotFound(_0x41a7ec,null))[_0xc021('0x27')](function(_0x2e1872){if(_0x2e1872){var _0xce376a=_0x2e1872[_0xc021('0x29')]({'plain':!![]});_0xce376a=qs['omit'](_0xce376a,['id','createdAt','updatedAt']);_0xeb9816[_0xc021('0x53')]=_[_0xc021('0x54')](_0xeb9816['body'],['id',_0xc021('0x55'),'updatedAt']);return db['Dashboard'][_0xc021('0x4e')](_['merge'](_0xce376a,_0xeb9816[_0xc021('0x53')]),{'include':_0xeb9816['query'][_0xc021('0x43')]?[{'all':!![]}]:undefined})[_0xc021('0x27')](function(_0x5249f2){var _0x4536c9=_0xeb9816[_0xc021('0x4a')][_0xc021('0x29')]({'plain':!![]});if(!_0x4536c9)throw new Error(_0xc021('0x4b'));if(_0x4536c9[_0xc021('0x56')]==='user'){var _0x2a41f7=_0x5249f2[_0xc021('0x29')]({'plain':!![]});var _0x56cdca=_0xc021('0x2a');return db[_0xc021('0x57')][_0xc021('0x4c')]({'where':{'name':_0x56cdca,'userProfileId':_0x4536c9[_0xc021('0x58')]},'raw':!![]})[_0xc021('0x27')](function(_0x22d990){if(_0x22d990&&_0x22d990['autoAssociation']===0x0){return db[_0xc021('0x2b')][_0xc021('0x4e')]({'name':_0x2a41f7[_0xc021('0x2d')],'resourceId':_0x2a41f7['id'],'type':_0x22d990[_0xc021('0x2d')],'sectionId':_0x22d990['id']},{})['then'](function(){return _0x5249f2;});}else{return _0x5249f2;}})['catch'](function(_0x446972){logger[_0xc021('0x2c')](_0xc021('0x4f'),_0x446972);throw _0x446972;});}return _0x5249f2;});}})[_0xc021('0x27')](respondWithResult(_0x41a7ec,0xc9))[_0xc021('0x49')](handleError(_0x41a7ec,null));};exports[_0xc021('0x26')]=function(_0xbfcb30,_0x11468f){if(_0xbfcb30['body']['id']){delete _0xbfcb30[_0xc021('0x53')]['id'];}return db[_0xc021('0x31')][_0xc021('0x4c')]({'where':{'id':_0xbfcb30[_0xc021('0x51')]['id']}})[_0xc021('0x27')](handleEntityNotFound(_0x11468f,null))['then'](saveUpdates(_0xbfcb30[_0xc021('0x53')],null))['then'](respondWithResult(_0x11468f,null))[_0xc021('0x49')](handleError(_0x11468f,null));};exports[_0xc021('0x28')]=function(_0x2236ef,_0x225663){return db[_0xc021('0x31')][_0xc021('0x4c')]({'where':{'id':_0x2236ef[_0xc021('0x51')]['id']}})[_0xc021('0x27')](handleEntityNotFound(_0x225663,null))[_0xc021('0x27')](removeEntity(_0x225663,null))[_0xc021('0x49')](handleError(_0x225663,null));};function widgetAttributes(_0x4d6064){try{switch(_0x4d6064[_0xc021('0x33')]){case _0xc021('0x59'):return[{'name':'attrUrl','value':_0x4d6064['attrUrl']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x0]?_0x4d6064[_0xc021('0x5a')][0x0]['value']:undefined)||_0xc021('0x5b')}];case _0xc021('0x5c'):return[{'name':_0xc021('0x5d'),'value':_0x4d6064[_0xc021('0x5d')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x0]?_0x4d6064[_0xc021('0x5a')][0x0][_0xc021('0x5e')]:undefined)||''}];case _0xc021('0x5f'):return[{'name':_0xc021('0x60'),'value':_0x4d6064[_0xc021('0x60')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x0]?_0x4d6064[_0xc021('0x5a')][0x0][_0xc021('0x5e')]:undefined)||_0xc021('0x61')},{'name':_0xc021('0x62'),'value':_0x4d6064['attrTimezone']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x1]?_0x4d6064[_0xc021('0x5a')][0x1][_0xc021('0x5e')]:undefined)||_0xc021('0x63')},{'name':'attrFontSize','value':_0x4d6064['attrFontSize']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x2]?_0x4d6064[_0xc021('0x5a')][0x2][_0xc021('0x5e')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4d6064['attrMetric']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x0]?_0x4d6064[_0xc021('0x5a')][0x0][_0xc021('0x5e')]:undefined)||'total'},{'name':_0xc021('0x64'),'value':_0x4d6064['attrVoiceQueues']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x1]?_0x4d6064[_0xc021('0x5a')][0x1][_0xc021('0x5e')]:undefined)||[]},{'name':_0xc021('0x65'),'value':_0x4d6064[_0xc021('0x65')]||(_0x4d6064['attrs']&&_0x4d6064['attrs'][0x2]?_0x4d6064[_0xc021('0x5a')][0x2][_0xc021('0x5e')]:undefined)||0x14},{'name':_0xc021('0x66'),'value':_0x4d6064[_0xc021('0x66')]||(_0x4d6064['attrs']&&_0x4d6064['attrs'][0x3]?_0x4d6064[_0xc021('0x5a')][0x3]['value']:undefined)||'voice'},{'name':_0xc021('0x67'),'value':_0x4d6064[_0xc021('0x67')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x4]?_0x4d6064[_0xc021('0x5a')][0x4][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x68'),'value':_0x4d6064[_0xc021('0x68')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x5]?_0x4d6064[_0xc021('0x5a')][0x5]['value']:undefined)||''},{'name':_0xc021('0x69'),'value':_0x4d6064[_0xc021('0x69')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x6]?_0x4d6064['attrs'][0x6][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x6a'),'value':_0x4d6064[_0xc021('0x6a')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x7]?_0x4d6064[_0xc021('0x5a')][0x7][_0xc021('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4d6064[_0xc021('0x6b')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x8]?_0x4d6064[_0xc021('0x5a')][0x8]['value']:undefined)||''},{'name':_0xc021('0x6c'),'value':_0x4d6064['attrChatWebsites']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x9]?_0x4d6064[_0xc021('0x5a')][0x9]['value']:undefined)||''}];case _0xc021('0x6d'):case _0xc021('0x6e'):return[{'name':_0xc021('0x6f'),'value':_0x4d6064[_0xc021('0x6f')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x0]?_0x4d6064[_0xc021('0x5a')][0x0][_0xc021('0x5e')]:undefined)||_0xc021('0x70')},{'name':'attrSerie2','value':_0x4d6064['attrSerie2']||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x1]?_0x4d6064[_0xc021('0x5a')][0x1][_0xc021('0x5e')]:undefined)||null},{'name':_0xc021('0x71'),'value':_0x4d6064[_0xc021('0x71')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064['attrs'][0x2]?_0x4d6064[_0xc021('0x5a')][0x2][_0xc021('0x5e')]:undefined)||null},{'name':_0xc021('0x64'),'value':_0x4d6064[_0xc021('0x64')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x3]?_0x4d6064[_0xc021('0x5a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4d6064[_0xc021('0x66')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x4]?_0x4d6064['attrs'][0x4][_0xc021('0x5e')]:undefined)||'voice'},{'name':_0xc021('0x67'),'value':_0x4d6064[_0xc021('0x67')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x5]?_0x4d6064[_0xc021('0x5a')][0x5][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x68'),'value':_0x4d6064[_0xc021('0x68')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x6]?_0x4d6064['attrs'][0x6]['value']:undefined)||''},{'name':_0xc021('0x69'),'value':_0x4d6064[_0xc021('0x69')]||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x7]?_0x4d6064['attrs'][0x7][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x6a'),'value':_0x4d6064[_0xc021('0x6a')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x8]?_0x4d6064[_0xc021('0x5a')][0x8][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x6b'),'value':_0x4d6064['attrWhatsappAccounts']||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x9]?_0x4d6064[_0xc021('0x5a')][0x9][_0xc021('0x5e')]:undefined)||''},{'name':_0xc021('0x6c'),'value':_0x4d6064['attrChatWebsites']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0xa]?_0x4d6064[_0xc021('0x5a')][0xa][_0xc021('0x5e')]:undefined)||''}];case _0xc021('0x72'):return[{'name':_0xc021('0x73'),'type':_0x4d6064[_0xc021('0x74')]||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x0]?_0x4d6064[_0xc021('0x5a')][0x0][_0xc021('0x33')]:undefined)||null,'value':_0x4d6064['attrReport']||(_0x4d6064[_0xc021('0x5a')]&&_0x4d6064[_0xc021('0x5a')][0x0]?_0x4d6064['attrs'][0x0]['value']:undefined)||null},{'name':_0xc021('0x75'),'value':_0x4d6064['attrRefresh']||(_0x4d6064['attrs']&&_0x4d6064[_0xc021('0x5a')][0x1]?_0x4d6064[_0xc021('0x5a')][0x1][_0xc021('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x17d975){logger[_0xc021('0x2c')](_0xc021('0x76'),JSON[_0xc021('0x77')](_0x17d975));return[];}}exports[_0xc021('0x78')]=function(_0x592939,_0x2d1704,_0xaedab){if(_0x592939[_0xc021('0x53')]['id']){delete _0x592939['body']['id'];}return db[_0xc021('0x31')][_0xc021('0x4c')]({'where':{'id':_0x592939['params']['id']}})[_0xc021('0x27')](handleEntityNotFound(_0x2d1704,null))[_0xc021('0x27')](function(_0x114e51){if(_0x114e51){_0x592939[_0xc021('0x53')][_0xc021('0x79')]=_0x114e51['id'];_0x592939[_0xc021('0x53')][_0xc021('0x5a')]=widgetAttributes(_0x592939[_0xc021('0x53')]);return db[_0xc021('0x7a')][_0xc021('0x4e')](_0x592939['body']);}})[_0xc021('0x27')](respondWithResult(_0x2d1704,null))[_0xc021('0x49')](handleError(_0x2d1704,null));};exports['getItems']=function(_0x189a4f,_0x4490e7,_0x580576){var _0xe9cc77={};var _0x5cff38={};var _0x2ba4f5;var _0x4a7ebe;return db[_0xc021('0x31')][_0xc021('0x7b')]({'where':{'id':_0x189a4f[_0xc021('0x51')]['id']}})['then'](handleEntityNotFound(_0x4490e7,null))[_0xc021('0x27')](function(_0xf724a7){if(_0xf724a7){_0x2ba4f5=_0xf724a7;_0x5cff38[_0xc021('0x37')]=_[_0xc021('0x47')](db['DashboardItem'][_0xc021('0x52')]);_0x5cff38[_0xc021('0x35')]=_[_0xc021('0x47')](_0x189a4f[_0xc021('0x35')]);_0x5cff38[_0xc021('0x3f')]=_['intersection'](_0x5cff38[_0xc021('0x37')],_0x5cff38['query']);_0xe9cc77[_0xc021('0x38')]=_[_0xc021('0x36')](_0x5cff38[_0xc021('0x37')],qs[_0xc021('0x39')](_0x189a4f['query'][_0xc021('0x39')]));_0xe9cc77['attributes']=_0xe9cc77['attributes'][_0xc021('0x48')]?_0xe9cc77[_0xc021('0x38')]:_0x5cff38[_0xc021('0x37')];_0xe9cc77[_0xc021('0x3c')]=qs[_0xc021('0x7c')](_0x189a4f[_0xc021('0x35')][_0xc021('0x7c')]);_0xe9cc77[_0xc021('0x3d')]=qs[_0xc021('0x3f')](_[_0xc021('0x3e')](_0x189a4f['query'],_0x5cff38[_0xc021('0x3f')]));if(_0x189a4f['query'][_0xc021('0x40')]){_0xe9cc77['where']=_[_0xc021('0x41')](_0xe9cc77[_0xc021('0x3d')],{'$or':_[_0xc021('0x30')](_0xe9cc77[_0xc021('0x38')],function(_0x36ae08){var _0x13367e={};_0x13367e[_0x36ae08]={'$like':'%'+_0x189a4f['query'][_0xc021('0x40')]+'%'};return _0x13367e;})});}_0xe9cc77=_[_0xc021('0x41')]({},_0xe9cc77,_0x189a4f[_0xc021('0x42')]);return _0x2ba4f5[_0xc021('0x7d')](_0xe9cc77);}})[_0xc021('0x27')](function(_0x2a9c85){if(_0x2a9c85){_0x4a7ebe=_0x2a9c85[_0xc021('0x48')];if(!_0x189a4f[_0xc021('0x35')][_0xc021('0x3a')]('nolimit')){_0xe9cc77[_0xc021('0x20')]=qs[_0xc021('0x20')](_0x189a4f['query'][_0xc021('0x20')]);_0xe9cc77[_0xc021('0x1e')]=qs['offset'](_0x189a4f[_0xc021('0x35')][_0xc021('0x1e')]);}return _0x2ba4f5[_0xc021('0x7d')](_0xe9cc77);}})['then'](function(_0x52250e){if(_0x52250e){return _0x52250e?{'count':_0x4a7ebe,'rows':_0x52250e}:null;}})[_0xc021('0x27')](respondWithResult(_0x4490e7,null))[_0xc021('0x49')](handleError(_0x4490e7,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index cc9607a..3190c70 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 _0x7f73=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x1886d0,_0x36d4b4){var _0x152689=function(_0x4515e4){while(--_0x4515e4){_0x1886d0['push'](_0x1886d0['shift']());}};_0x152689(++_0x36d4b4);}(_0x7f73,0xfa));var _0x37f7=function(_0x5d8107,_0xac6cff){_0x5d8107=_0x5d8107-0x0;var _0x3c61fd=_0x7f73[_0x5d8107];return _0x3c61fd;};'use strict';var EventEmitter=require(_0x37f7('0x0'));var Dashboard=require(_0x37f7('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x37f7('0x2')](0x0);var events={'afterCreate':_0x37f7('0x3'),'afterUpdate':_0x37f7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1adcd7){return function(_0x5fbc39,_0x412bc7,_0x19f16c){DashboardEvents[_0x37f7('0x5')](_0x1adcd7+':'+_0x5fbc39['id'],_0x5fbc39);DashboardEvents[_0x37f7('0x5')](_0x1adcd7,_0x5fbc39);_0x19f16c(null);};}for(var e in events){if(events[_0x37f7('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x37f7('0x7')]=DashboardEvents; \ No newline at end of file +var _0x872f=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x872f,0x143));var _0xf872=function(_0x462fc9,_0x355e35){_0x462fc9=_0x462fc9-0x0;var _0x240ef1=_0x872f[_0x462fc9];return _0x240ef1;};'use strict';var EventEmitter=require(_0xf872('0x0'));var Dashboard=require(_0xf872('0x1'))['db'][_0xf872('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf872('0x3')](0x0);var events={'afterCreate':_0xf872('0x4'),'afterUpdate':_0xf872('0x5'),'afterDestroy':_0xf872('0x6')};function emitEvent(_0x75c235){return function(_0x3a1126,_0x1a71a9,_0x5338b1){DashboardEvents[_0xf872('0x7')](_0x75c235+':'+_0x3a1126['id'],_0x3a1126);DashboardEvents['emit'](_0x75c235,_0x3a1126);_0x5338b1(null);};}for(var e in events){if(events[_0xf872('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 354161a..f3b14d9 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 _0x927d=['dashboards','util','api','moment','bluebird','rimraf','../../config/environment','exports','Dashboard'];(function(_0x276f8d,_0x46a8ea){var _0x525575=function(_0x9a9137){while(--_0x9a9137){_0x276f8d['push'](_0x276f8d['shift']());}};_0x525575(++_0x46a8ea);}(_0x927d,0x88));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd927('0x0'));var logger=require('../../config/logger')(_0xd927('0x1'));var moment=require(_0xd927('0x2'));var BPromise=require(_0xd927('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd927('0x4'));var config=require(_0xd927('0x5'));var attributes=require('./dashboard.attributes');module[_0xd927('0x6')]=function(_0x5810d9,_0x17ee19){return _0x5810d9['define'](_0xd927('0x7'),attributes,{'tableName':_0xd927('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaede=['api','bluebird','request-promise','path','rimraf','./dashboard.attributes','define','dashboards','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaede,0xf8));var _0xeaed=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xaede[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xeaed('0x0'));var util=require(_0xeaed('0x1'));var logger=require('../../config/logger')(_0xeaed('0x2'));var moment=require('moment');var BPromise=require(_0xeaed('0x3'));var rp=require(_0xeaed('0x4'));var fs=require('fs');var path=require(_0xeaed('0x5'));var rimraf=require(_0xeaed('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaed('0x7'));module['exports']=function(_0x5f4e4b,_0x510438){return _0x5f4e4b[_0xeaed('0x8')]('Dashboard',attributes,{'tableName':_0xeaed('0x9'),'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 44d6e06..9bab9b5 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 _0xcc37=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x140bde,_0x445256){var _0x6b0a88=function(_0x5d9f2c){while(--_0x5d9f2c){_0x140bde['push'](_0x140bde['shift']());}};_0x6b0a88(++_0x445256);}(_0xcc37,0xa7));var _0x7cc3=function(_0x2a18a2,_0x4470ab){_0x2a18a2=_0x2a18a2-0x0;var _0x543c79=_0xcc37[_0x2a18a2];return _0x543c79;};'use strict';var _=require('lodash');var util=require(_0x7cc3('0x0'));var moment=require(_0x7cc3('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cc3('0x2'));var fs=require('fs');var Redis=require(_0x7cc3('0x3'));var db=require(_0x7cc3('0x4'))['db'];var utils=require(_0x7cc3('0x5'));var logger=require(_0x7cc3('0x6'))(_0x7cc3('0x7'));var config=require('../../config/environment');var jayson=require(_0x7cc3('0x8'));var client=jayson[_0x7cc3('0x9')]['http']({'port':0x232a});config[_0x7cc3('0xa')]=_[_0x7cc3('0xb')](config[_0x7cc3('0xa')],{'host':_0x7cc3('0xc'),'port':0x18eb});var socket=require(_0x7cc3('0xd'))(new Redis(config[_0x7cc3('0xa')]));require(_0x7cc3('0xe'))[_0x7cc3('0xf')](socket);function respondWithRpcPromise(_0xf2ab9,_0x631d0,_0x52537f){return new BPromise(function(_0x517ed8,_0x1d0af6){return client[_0x7cc3('0x10')](_0xf2ab9,_0x52537f)[_0x7cc3('0x11')](function(_0x4c8afe){logger['info'](_0x7cc3('0x12'),_0x631d0,_0x7cc3('0x13'));logger[_0x7cc3('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x631d0,_0x7cc3('0x13'),JSON[_0x7cc3('0x15')](_0x4c8afe));if(_0x4c8afe[_0x7cc3('0x16')]){if(_0x4c8afe[_0x7cc3('0x16')]['code']===0x1f4){logger[_0x7cc3('0x16')](_0x7cc3('0x12'),_0x631d0,_0x4c8afe[_0x7cc3('0x16')][_0x7cc3('0x17')]);return _0x1d0af6(_0x4c8afe['error']['message']);}logger[_0x7cc3('0x16')](_0x7cc3('0x12'),_0x631d0,_0x4c8afe[_0x7cc3('0x16')][_0x7cc3('0x17')]);return _0x517ed8(_0x4c8afe[_0x7cc3('0x16')][_0x7cc3('0x17')]);}else{logger['info'](_0x7cc3('0x12'),_0x631d0,_0x7cc3('0x13'));_0x517ed8(_0x4c8afe['result'][_0x7cc3('0x17')]);}})[_0x7cc3('0x18')](function(_0xc71b35){logger['error'](_0x7cc3('0x12'),_0x631d0,_0xc71b35);_0x1d0af6(_0xc71b35);});});} \ No newline at end of file +var _0x565a=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x565a,0x18a));var _0xa565=function(_0x6de9bc,_0x310793){_0x6de9bc=_0x6de9bc-0x0;var _0x586067=_0x565a[_0x6de9bc];return _0x586067;};'use strict';var _=require(_0xa565('0x0'));var util=require(_0xa565('0x1'));var moment=require(_0xa565('0x2'));var BPromise=require(_0xa565('0x3'));var rs=require(_0xa565('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa565('0x5'))['db'];var utils=require(_0xa565('0x6'));var logger=require(_0xa565('0x7'))(_0xa565('0x8'));var config=require(_0xa565('0x9'));var jayson=require(_0xa565('0xa'));var client=jayson[_0xa565('0xb')]['http']({'port':0x232a});config[_0xa565('0xc')]=_[_0xa565('0xd')](config[_0xa565('0xc')],{'host':_0xa565('0xe'),'port':0x18eb});var socket=require(_0xa565('0xf'))(new Redis(config['redis']));require(_0xa565('0x10'))[_0xa565('0x11')](socket);function respondWithRpcPromise(_0x2783e2,_0x56c81e,_0x24ba78){return new BPromise(function(_0x3e96c9,_0x182742){return client[_0xa565('0x12')](_0x2783e2,_0x24ba78)[_0xa565('0x13')](function(_0x1fb8d1){logger[_0xa565('0x14')](_0xa565('0x15'),_0x56c81e,_0xa565('0x16'));logger[_0xa565('0x17')](_0xa565('0x18'),_0x56c81e,'request\x20sent',JSON[_0xa565('0x19')](_0x1fb8d1));if(_0x1fb8d1[_0xa565('0x1a')]){if(_0x1fb8d1[_0xa565('0x1a')]['code']===0x1f4){logger[_0xa565('0x1a')](_0xa565('0x15'),_0x56c81e,_0x1fb8d1['error'][_0xa565('0x1b')]);return _0x182742(_0x1fb8d1[_0xa565('0x1a')][_0xa565('0x1b')]);}logger[_0xa565('0x1a')](_0xa565('0x15'),_0x56c81e,_0x1fb8d1[_0xa565('0x1a')][_0xa565('0x1b')]);return _0x3e96c9(_0x1fb8d1[_0xa565('0x1a')][_0xa565('0x1b')]);}else{logger[_0xa565('0x14')](_0xa565('0x15'),_0x56c81e,_0xa565('0x16'));_0x3e96c9(_0x1fb8d1['result'][_0xa565('0x1b')]);}})[_0xa565('0x1c')](function(_0x3723f6){logger[_0xa565('0x1a')](_0xa565('0x15'),_0x56c81e,_0x3723f6);_0x182742(_0x3723f6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 75e4d8c..16a9c65 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 _0x7862=['dashboard:','save','remove','update','removeListener','register','length'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7862,0xf6));var _0x2786=function(_0x512a62,_0x1b6c2f){_0x512a62=_0x512a62-0x0;var _0x3d3346=_0x7862[_0x512a62];return _0x3d3346;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x2786('0x0'),_0x2786('0x1'),_0x2786('0x2')];function createListener(_0x59e38a,_0x36df0f){return function(_0x316469){_0x36df0f['emit'](_0x59e38a,_0x316469);};}function removeListener(_0x199cf2,_0x37283d){return function(){DashboardEvents[_0x2786('0x3')](_0x199cf2,_0x37283d);};}exports[_0x2786('0x4')]=function(_0x16d9ed){for(var _0x86b344=0x0,_0x412cf4=events[_0x2786('0x5')];_0x86b344<_0x412cf4;_0x86b344++){var _0x6057a3=events[_0x86b344];var _0x22a1bc=createListener(_0x2786('0x6')+_0x6057a3,_0x16d9ed);DashboardEvents['on'](_0x6057a3,_0x22a1bc);}}; \ No newline at end of file +var _0xc0ba=['emit','register','length','save','remove'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc0ba,0xa8));var _0xac0b=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0xc0ba[_0x5869f5];return _0x6beba1;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xac0b('0x0'),_0xac0b('0x1'),'update'];function createListener(_0x346c1f,_0x4040c5){return function(_0x47ac92){_0x4040c5[_0xac0b('0x2')](_0x346c1f,_0x47ac92);};}function removeListener(_0x3b1dbb,_0x4ee469){return function(){DashboardEvents['removeListener'](_0x3b1dbb,_0x4ee469);};}exports[_0xac0b('0x3')]=function(_0x4c1544){for(var _0x15c4fa=0x0,_0xe29e72=events[_0xac0b('0x4')];_0x15c4fa<_0xe29e72;_0x15c4fa++){var _0x17f624=events[_0x15c4fa];var _0x144177=createListener('dashboard:'+_0x17f624,_0x4c1544);DashboardEvents['on'](_0x17f624,_0x144177);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 82e5bd1..bfa4e46 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 _0x4aab=['isAuthenticated','show','/:id/items','create','/:id/clone','clone','/:id','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4aab,0x11b));var _0xb4aa=function(_0x79a3fe,_0x4b97e4){_0x79a3fe=_0x79a3fe-0x0;var _0x1d6ddf=_0x4aab[_0x79a3fe];return _0x1d6ddf;};'use strict';var multer=require(_0xb4aa('0x0'));var util=require(_0xb4aa('0x1'));var path=require(_0xb4aa('0x2'));var timeout=require(_0xb4aa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb4aa('0x4'));var auth=require(_0xb4aa('0x5'));var interaction=require(_0xb4aa('0x6'));var config=require(_0xb4aa('0x7'));var controller=require(_0xb4aa('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb4aa('0x9')]);router[_0xb4aa('0xa')]('/:id',auth[_0xb4aa('0xb')](),controller[_0xb4aa('0xc')]);router[_0xb4aa('0xa')](_0xb4aa('0xd'),auth[_0xb4aa('0xb')](),controller['getItems']);router['post']('/',auth[_0xb4aa('0xb')](),controller[_0xb4aa('0xe')]);router['post'](_0xb4aa('0xf'),auth[_0xb4aa('0xb')](),controller[_0xb4aa('0x10')]);router['post']('/:id/items',auth[_0xb4aa('0xb')](),controller['addItem']);router['put'](_0xb4aa('0x11'),auth['isAuthenticated'](),controller[_0xb4aa('0x12')]);router['delete'](_0xb4aa('0x11'),auth[_0xb4aa('0xb')](),controller[_0xb4aa('0x13')]);module[_0xb4aa('0x14')]=router; \ No newline at end of file +var _0xb5dc=['/:id','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put'];(function(_0x38a0fa,_0x2a345a){var _0x1716bc=function(_0x132ec9){while(--_0x132ec9){_0x38a0fa['push'](_0x38a0fa['shift']());}};_0x1716bc(++_0x2a345a);}(_0xb5dc,0x94));var _0xcb5d=function(_0x4dfc2c,_0x14aee4){_0x4dfc2c=_0x4dfc2c-0x0;var _0x463fdb=_0xb5dc[_0x4dfc2c];return _0x463fdb;};'use strict';var multer=require(_0xcb5d('0x0'));var util=require(_0xcb5d('0x1'));var path=require('path');var timeout=require(_0xcb5d('0x2'));var express=require(_0xcb5d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcb5d('0x4'));var interaction=require(_0xcb5d('0x5'));var config=require(_0xcb5d('0x6'));var controller=require(_0xcb5d('0x7'));router[_0xcb5d('0x8')]('/',auth[_0xcb5d('0x9')](),controller[_0xcb5d('0xa')]);router[_0xcb5d('0x8')]('/:id',auth[_0xcb5d('0x9')](),controller[_0xcb5d('0xb')]);router[_0xcb5d('0x8')](_0xcb5d('0xc'),auth[_0xcb5d('0x9')](),controller[_0xcb5d('0xd')]);router[_0xcb5d('0xe')]('/',auth[_0xcb5d('0x9')](),controller[_0xcb5d('0xf')]);router[_0xcb5d('0xe')](_0xcb5d('0x10'),auth[_0xcb5d('0x9')](),controller[_0xcb5d('0x11')]);router[_0xcb5d('0xe')](_0xcb5d('0xc'),auth[_0xcb5d('0x9')](),controller[_0xcb5d('0x12')]);router[_0xcb5d('0x13')](_0xcb5d('0x14'),auth[_0xcb5d('0x9')](),controller[_0xcb5d('0x15')]);router[_0xcb5d('0x16')](_0xcb5d('0x14'),auth['isAuthenticated'](),controller[_0xcb5d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b140819..ad1e4d0 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 _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x559f83,_0x2eb410){var _0x6f5638=function(_0x5269f5){while(--_0x5269f5){_0x559f83['push'](_0x559f83['shift']());}};_0x6f5638(++_0x2eb410);}(_0xadb5,0xad));var _0x5adb=function(_0x133f20,_0xadc5a2){_0x133f20=_0x133f20-0x0;var _0x398a30=_0xadb5[_0x133f20];return _0x398a30;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x203366,_0x491ea9){var _0x537f10=function(_0x8fc36a){while(--_0x8fc36a){_0x203366['push'](_0x203366['shift']());}};_0x537f10(++_0x491ea9);}(_0x6f47,0xc7));var _0x76f4=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6f47[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('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 54866af..d425486 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 _0xabce=['redis','defaults','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','include','merge','find','catch','params','type','attrs','value','https://','attrPath','clock','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x82b0ee,_0x2d0ee5){var _0x371191=function(_0x1e1957){while(--_0x1e1957){_0x82b0ee['push'](_0x82b0ee['shift']());}};_0x371191(++_0x2d0ee5);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];config[_0xeabc('0x1a')]=_[_0xeabc('0x1b')](config[_0xeabc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1c'))(new Redis(config[_0xeabc('0x1a')]));require(_0xeabc('0x1d'))['register'](socket);function respondWithStatusCode(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xcc;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1e')](_0x3170ea);}return _0x5f4ee8['status'](_0x3170ea)[_0xeabc('0x1f')]();};}function respondWithResult(_0x638976,_0x49f2d8){_0x49f2d8=_0x49f2d8||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x638976[_0xeabc('0x20')](_0x49f2d8)['json'](_0x53fe28);}};}function respondWithFilteredResult(_0x3d0e21,_0x1b64b9){return function(_0x58a3c0){if(_0x58a3c0){var _0x16f08b=typeof _0x1b64b9[_0xeabc('0x21')]===_0xeabc('0x22')&&typeof _0x1b64b9[_0xeabc('0x23')]===_0xeabc('0x22');var _0x5d92e5=_0x58a3c0[_0xeabc('0x24')];var _0x4d68ea=_0x16f08b?0x0:_0x1b64b9[_0xeabc('0x21')];var _0x16530c=_0x16f08b?_0x58a3c0['count']:_0x1b64b9[_0xeabc('0x21')]+_0x1b64b9[_0xeabc('0x23')];var _0x254590;if(_0x16530c>=_0x5d92e5){_0x16530c=_0x5d92e5;_0x254590=0xc8;}else{_0x254590=0xce;}_0x3d0e21[_0xeabc('0x20')](_0x254590);return _0x3d0e21[_0xeabc('0x25')]('Content-Range',_0x4d68ea+'-'+_0x16530c+'/'+_0x5d92e5)[_0xeabc('0x26')](_0x58a3c0);}return null;};}function patchUpdates(_0x10c675){return function(_0x91ab00){try{jsonpatch['apply'](_0x91ab00,_0x10c675,!![]);}catch(_0x457f27){return BPromise[_0xeabc('0x27')](_0x457f27);}return _0x91ab00[_0xeabc('0x28')]();};}function saveUpdates(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['update'](_0x319119)[_0xeabc('0x29')](function(_0x4d4e29){return _0x4d4e29;});}return null;};}function removeEntity(_0x811f0d,_0x12acbd){return function(_0x269621){if(_0x269621){return _0x269621[_0xeabc('0x2a')]()[_0xeabc('0x29')](function(){_0x811f0d[_0xeabc('0x20')](0xcc)[_0xeabc('0x1f')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2b')](_0x48fb52[_0xeabc('0x2c')]);if(_0x48fb52[_0xeabc('0x2d')]){delete _0x48fb52[_0xeabc('0x2d')];}_0x3c1b5b[_0xeabc('0x20')](_0x2b342c)[_0xeabc('0x2e')](_0x48fb52);};}exports[_0xeabc('0x2f')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={'raw':![],'where':{'id':_0x38dc0a['params']['id']}},_0x5b34dd={};_0x5b34dd[_0xeabc('0x30')]=_[_0xeabc('0x31')](db[_0xeabc('0x32')][_0xeabc('0x33')]);_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x31')](_0x38dc0a[_0xeabc('0x34')]);_0x5b34dd['filters']=_[_0xeabc('0x35')](_0x5b34dd[_0xeabc('0x30')],_0x5b34dd[_0xeabc('0x34')]);_0x5ebb86['attributes']=_[_0xeabc('0x35')](_0x5b34dd[_0xeabc('0x30')],qs[_0xeabc('0x36')](_0x38dc0a['query'][_0xeabc('0x36')]));_0x5ebb86[_0xeabc('0x37')]=_0x5ebb86[_0xeabc('0x37')]['length']?_0x5ebb86[_0xeabc('0x37')]:_0x5b34dd[_0xeabc('0x30')];if(_0x38dc0a['query']['includeAll']){_0x5ebb86[_0xeabc('0x38')]=[{'all':!![]}];}_0x5ebb86=_[_0xeabc('0x39')]({},_0x5ebb86,_0x38dc0a['options']);return db[_0xeabc('0x32')][_0xeabc('0x3a')](_0x5ebb86)[_0xeabc('0x29')](handleEntityNotFound(_0x2915c1,null))[_0xeabc('0x29')](respondWithResult(_0x2915c1,null))[_0xeabc('0x3b')](handleError(_0x2915c1,null));};exports['destroy']=function(_0x353e48,_0x5b61fa){return db[_0xeabc('0x32')][_0xeabc('0x3a')]({'where':{'id':_0x353e48[_0xeabc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5b61fa,null))['then'](removeEntity(_0x5b61fa,null))[_0xeabc('0x3b')](handleError(_0x5b61fa,null));};function widgetAttributes(_0x560d4a){try{switch(_0x560d4a[_0xeabc('0x3d')]){case'iframe':return[{'name':'attrUrl','value':_0x560d4a['attrUrl']||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a['attrs'][0x0][_0xeabc('0x3f')]:undefined)||_0xeabc('0x40')}];case'custom':return[{'name':_0xeabc('0x41'),'value':_0x560d4a['attrPath']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x0]?_0x560d4a[_0xeabc('0x3e')][0x0][_0xeabc('0x3f')]:undefined)||''}];case _0xeabc('0x42'):return[{'name':'attrHourFormat','value':_0x560d4a['attrHourFormat']||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a[_0xeabc('0x3e')][0x0][_0xeabc('0x3f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x560d4a[_0xeabc('0x43')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x1]?_0x560d4a[_0xeabc('0x3e')][0x1]['value']:undefined)||_0xeabc('0x44')},{'name':'attrFontSize','value':_0x560d4a['attrFontSize']||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x2]?_0x560d4a[_0xeabc('0x3e')][0x2][_0xeabc('0x3f')]:undefined)||0xc}];case _0xeabc('0x45'):return[{'name':'attrMetric','value':_0x560d4a[_0xeabc('0x46')]||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a[_0xeabc('0x3e')][0x0][_0xeabc('0x3f')]:undefined)||_0xeabc('0x47')},{'name':_0xeabc('0x48'),'value':_0x560d4a['attrVoiceQueues']||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x1]?_0x560d4a['attrs'][0x1][_0xeabc('0x3f')]:undefined)||[]},{'name':_0xeabc('0x49'),'value':_0x560d4a['attrFontSize']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x2]?_0x560d4a[_0xeabc('0x3e')][0x2][_0xeabc('0x3f')]:undefined)||0x14},{'name':_0xeabc('0x4a'),'value':_0x560d4a[_0xeabc('0x4a')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x3]?_0x560d4a[_0xeabc('0x3e')][0x3][_0xeabc('0x3f')]:undefined)||_0xeabc('0x4b')},{'name':_0xeabc('0x4c'),'value':_0x560d4a[_0xeabc('0x4c')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x4]?_0x560d4a[_0xeabc('0x3e')][0x4][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x4d'),'value':_0x560d4a['attrFaxAccounts']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x5]?_0x560d4a[_0xeabc('0x3e')][0x5][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x4e'),'value':_0x560d4a[_0xeabc('0x4e')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x6]?_0x560d4a[_0xeabc('0x3e')][0x6][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x4f'),'value':_0x560d4a[_0xeabc('0x4f')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x7]?_0x560d4a[_0xeabc('0x3e')][0x7][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x50'),'value':_0x560d4a[_0xeabc('0x50')]||(_0x560d4a['attrs']&&_0x560d4a[_0xeabc('0x3e')][0x8]?_0x560d4a[_0xeabc('0x3e')][0x8]['value']:undefined)||''},{'name':_0xeabc('0x51'),'value':_0x560d4a['attrChatWebsites']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x9]?_0x560d4a[_0xeabc('0x3e')][0x9][_0xeabc('0x3f')]:undefined)||''}];case _0xeabc('0x52'):case _0xeabc('0x53'):return[{'name':_0xeabc('0x54'),'value':_0x560d4a[_0xeabc('0x54')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a[_0xeabc('0x3e')][0x0][_0xeabc('0x3f')]:undefined)||'total'},{'name':_0xeabc('0x55'),'value':_0x560d4a[_0xeabc('0x55')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x1]?_0x560d4a['attrs'][0x1][_0xeabc('0x3f')]:undefined)||null},{'name':_0xeabc('0x56'),'value':_0x560d4a[_0xeabc('0x56')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x2]?_0x560d4a[_0xeabc('0x3e')][0x2][_0xeabc('0x3f')]:undefined)||null},{'name':_0xeabc('0x48'),'value':_0x560d4a[_0xeabc('0x48')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x3]?_0x560d4a[_0xeabc('0x3e')][0x3][_0xeabc('0x3f')]:undefined)||[]},{'name':_0xeabc('0x4a'),'value':_0x560d4a['attrChannel']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x4]?_0x560d4a['attrs'][0x4]['value']:undefined)||_0xeabc('0x4b')},{'name':_0xeabc('0x4c'),'value':_0x560d4a[_0xeabc('0x4c')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x5]?_0x560d4a[_0xeabc('0x3e')][0x5]['value']:undefined)||''},{'name':_0xeabc('0x4d'),'value':_0x560d4a[_0xeabc('0x4d')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x6]?_0x560d4a[_0xeabc('0x3e')][0x6][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x4e'),'value':_0x560d4a[_0xeabc('0x4e')]||(_0x560d4a['attrs']&&_0x560d4a['attrs'][0x7]?_0x560d4a[_0xeabc('0x3e')][0x7][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x4f'),'value':_0x560d4a['attrOpenchannelAccounts']||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a['attrs'][0x8]?_0x560d4a['attrs'][0x8][_0xeabc('0x3f')]:undefined)||''},{'name':_0xeabc('0x50'),'value':_0x560d4a[_0xeabc('0x50')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x9]?_0x560d4a[_0xeabc('0x3e')][0x9]['value']:undefined)||''},{'name':_0xeabc('0x51'),'value':_0x560d4a[_0xeabc('0x51')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0xa]?_0x560d4a[_0xeabc('0x3e')][0xa][_0xeabc('0x3f')]:undefined)||''}];case'web-report':return[{'name':_0xeabc('0x57'),'type':_0x560d4a[_0xeabc('0x58')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a[_0xeabc('0x3e')][0x0][_0xeabc('0x3d')]:undefined)||null,'value':_0x560d4a[_0xeabc('0x57')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x0]?_0x560d4a['attrs'][0x0][_0xeabc('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x560d4a[_0xeabc('0x59')]||(_0x560d4a[_0xeabc('0x3e')]&&_0x560d4a[_0xeabc('0x3e')][0x1]?_0x560d4a[_0xeabc('0x3e')][0x1][_0xeabc('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x1a3ef2){logger[_0xeabc('0x2b')](_0xeabc('0x5a'),JSON[_0xeabc('0x5b')](_0x1a3ef2));return[];}}exports[_0xeabc('0x5c')]=function(_0x5702cb,_0x3fa31b){if(_0x5702cb[_0xeabc('0x5d')]){_0x5702cb[_0xeabc('0x5d')][_0xeabc('0x3e')]=widgetAttributes(_0x5702cb['body']);}return db[_0xeabc('0x32')]['create'](_0x5702cb['body'],{})[_0xeabc('0x29')](respondWithResult(_0x3fa31b,0xc9))[_0xeabc('0x3b')](handleError(_0x3fa31b,null));};exports[_0xeabc('0x5e')]=function(_0x1c91e4,_0x4b7730){if(_0x1c91e4['body']['id']){delete _0x1c91e4[_0xeabc('0x5d')]['id'];}_0x1c91e4['body']['attrs']=widgetAttributes(_0x1c91e4[_0xeabc('0x5d')]);return db['DashboardItem']['find']({'where':{'id':_0x1c91e4[_0xeabc('0x3c')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4b7730,null))['then'](saveUpdates(_0x1c91e4['body'],null))[_0xeabc('0x29')](respondWithResult(_0x4b7730,null))['catch'](handleError(_0x4b7730,null));}; \ No newline at end of file +var _0xb0df=['length','includeAll','merge','options','DashboardItem','find','catch','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','value','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','params','model','rawAttributes','query','keys','intersection','fields','attributes'];(function(_0x33a73b,_0x2d367f){var _0x30527e=function(_0x37e06f){while(--_0x37e06f){_0x33a73b['push'](_0x33a73b['shift']());}};_0x30527e(++_0x2d367f);}(_0xb0df,0x85));var _0xfb0d=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xb0df[_0x1d211b];return _0x47c88b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb0d('0x0'));var zipdir=require(_0xfb0d('0x1'));var jsonpatch=require(_0xfb0d('0x2'));var rp=require(_0xfb0d('0x3'));var moment=require(_0xfb0d('0x4'));var BPromise=require(_0xfb0d('0x5'));var Mustache=require(_0xfb0d('0x6'));var util=require(_0xfb0d('0x7'));var path=require(_0xfb0d('0x8'));var sox=require('sox');var csv=require(_0xfb0d('0x9'));var ejs=require(_0xfb0d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb0d('0xb'));var crypto=require(_0xfb0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb0d('0x9'));var querystring=require(_0xfb0d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb0d('0xe'));var authService=require(_0xfb0d('0xf'));var qs=require(_0xfb0d('0x10'));var as=require(_0xfb0d('0x11'));var hardwareService=require(_0xfb0d('0x12'));var logger=require(_0xfb0d('0x13'))('api');var utils=require(_0xfb0d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfb0d('0x15'));var db=require(_0xfb0d('0x16'))['db'];config[_0xfb0d('0x17')]=_[_0xfb0d('0x18')](config[_0xfb0d('0x17')],{'host':_0xfb0d('0x19'),'port':0x18eb});var socket=require(_0xfb0d('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x13ec1c,_0x22b9a1){_0x22b9a1=_0x22b9a1||0xcc;return function(_0x45cc75){if(_0x45cc75){return _0x13ec1c[_0xfb0d('0x1b')](_0x22b9a1);}return _0x13ec1c[_0xfb0d('0x1c')](_0x22b9a1)[_0xfb0d('0x1d')]();};}function respondWithResult(_0xced21c,_0x595903){_0x595903=_0x595903||0xc8;return function(_0x77e8e7){if(_0x77e8e7){return _0xced21c[_0xfb0d('0x1c')](_0x595903)[_0xfb0d('0x1e')](_0x77e8e7);}};}function respondWithFilteredResult(_0x2aa48d,_0x58b1cc){return function(_0x28f8dc){if(_0x28f8dc){var _0x318c5e=typeof _0x58b1cc[_0xfb0d('0x1f')]===_0xfb0d('0x20')&&typeof _0x58b1cc[_0xfb0d('0x21')]===_0xfb0d('0x20');var _0x2778ab=_0x28f8dc['count'];var _0x1b869f=_0x318c5e?0x0:_0x58b1cc[_0xfb0d('0x1f')];var _0x2baa88=_0x318c5e?_0x28f8dc[_0xfb0d('0x22')]:_0x58b1cc[_0xfb0d('0x1f')]+_0x58b1cc[_0xfb0d('0x21')];var _0x2fb83c;if(_0x2baa88>=_0x2778ab){_0x2baa88=_0x2778ab;_0x2fb83c=0xc8;}else{_0x2fb83c=0xce;}_0x2aa48d[_0xfb0d('0x1c')](_0x2fb83c);return _0x2aa48d[_0xfb0d('0x23')](_0xfb0d('0x24'),_0x1b869f+'-'+_0x2baa88+'/'+_0x2778ab)[_0xfb0d('0x1e')](_0x28f8dc);}return null;};}function patchUpdates(_0x5ef220){return function(_0x4f605a){try{jsonpatch[_0xfb0d('0x25')](_0x4f605a,_0x5ef220,!![]);}catch(_0x1b2096){return BPromise['reject'](_0x1b2096);}return _0x4f605a['save']();};}function saveUpdates(_0x3bd70b,_0x7f0f4c){return function(_0x5a1e63){if(_0x5a1e63){return _0x5a1e63[_0xfb0d('0x26')](_0x3bd70b)[_0xfb0d('0x27')](function(_0x1c234c){return _0x1c234c;});}return null;};}function removeEntity(_0x3f27a6,_0xec0688){return function(_0x10c1f9){if(_0x10c1f9){return _0x10c1f9[_0xfb0d('0x28')]()[_0xfb0d('0x27')](function(){_0x3f27a6[_0xfb0d('0x1c')](0xcc)[_0xfb0d('0x1d')]();});}};}function handleEntityNotFound(_0x1c6770,_0x803bdd){return function(_0x5ccecd){if(!_0x5ccecd){_0x1c6770[_0xfb0d('0x1b')](0x194);}return _0x5ccecd;};}function handleError(_0x4313f0,_0x48ba7a){_0x48ba7a=_0x48ba7a||0x1f4;return function(_0x13de4){logger[_0xfb0d('0x29')](_0x13de4[_0xfb0d('0x2a')]);if(_0x13de4[_0xfb0d('0x2b')]){delete _0x13de4['name'];}_0x4313f0['status'](_0x48ba7a)[_0xfb0d('0x2c')](_0x13de4);};}exports['show']=function(_0x21f005,_0x58fdf1){var _0x38bdfc={'raw':![],'where':{'id':_0x21f005[_0xfb0d('0x2d')]['id']}},_0x3093f5={};_0x3093f5[_0xfb0d('0x2e')]=_['keys'](db['DashboardItem'][_0xfb0d('0x2f')]);_0x3093f5[_0xfb0d('0x30')]=_[_0xfb0d('0x31')](_0x21f005[_0xfb0d('0x30')]);_0x3093f5['filters']=_[_0xfb0d('0x32')](_0x3093f5['model'],_0x3093f5[_0xfb0d('0x30')]);_0x38bdfc['attributes']=_[_0xfb0d('0x32')](_0x3093f5[_0xfb0d('0x2e')],qs[_0xfb0d('0x33')](_0x21f005[_0xfb0d('0x30')][_0xfb0d('0x33')]));_0x38bdfc[_0xfb0d('0x34')]=_0x38bdfc['attributes'][_0xfb0d('0x35')]?_0x38bdfc[_0xfb0d('0x34')]:_0x3093f5[_0xfb0d('0x2e')];if(_0x21f005[_0xfb0d('0x30')][_0xfb0d('0x36')]){_0x38bdfc['include']=[{'all':!![]}];}_0x38bdfc=_[_0xfb0d('0x37')]({},_0x38bdfc,_0x21f005[_0xfb0d('0x38')]);return db[_0xfb0d('0x39')][_0xfb0d('0x3a')](_0x38bdfc)['then'](handleEntityNotFound(_0x58fdf1,null))['then'](respondWithResult(_0x58fdf1,null))['catch'](handleError(_0x58fdf1,null));};exports[_0xfb0d('0x28')]=function(_0x127116,_0x2e33e9){return db[_0xfb0d('0x39')][_0xfb0d('0x3a')]({'where':{'id':_0x127116[_0xfb0d('0x2d')]['id']}})[_0xfb0d('0x27')](handleEntityNotFound(_0x2e33e9,null))['then'](removeEntity(_0x2e33e9,null))[_0xfb0d('0x3b')](handleError(_0x2e33e9,null));};function widgetAttributes(_0x3c7ace){try{switch(_0x3c7ace['type']){case'iframe':return[{'name':_0xfb0d('0x3c'),'value':_0x3c7ace[_0xfb0d('0x3c')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x3e')}];case _0xfb0d('0x3f'):return[{'name':_0xfb0d('0x40'),'value':_0x3c7ace[_0xfb0d('0x40')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||''}];case _0xfb0d('0x41'):return[{'name':_0xfb0d('0x42'),'value':_0x3c7ace[_0xfb0d('0x42')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x43')},{'name':_0xfb0d('0x44'),'value':_0x3c7ace[_0xfb0d('0x44')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1]['value']:undefined)||_0xfb0d('0x45')},{'name':'attrFontSize','value':_0x3c7ace[_0xfb0d('0x46')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x2]?_0x3c7ace['attrs'][0x2][_0xfb0d('0x47')]:undefined)||0xc}];case'counter':return[{'name':_0xfb0d('0x48'),'value':_0x3c7ace[_0xfb0d('0x48')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x49')},{'name':'attrVoiceQueues','value':_0x3c7ace[_0xfb0d('0x4a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||[]},{'name':'attrFontSize','value':_0x3c7ace[_0xfb0d('0x46')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x2]?_0x3c7ace[_0xfb0d('0x3d')][0x2][_0xfb0d('0x47')]:undefined)||0x14},{'name':_0xfb0d('0x4b'),'value':_0x3c7ace[_0xfb0d('0x4b')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x3]?_0x3c7ace['attrs'][0x3][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x4c')},{'name':_0xfb0d('0x4d'),'value':_0x3c7ace[_0xfb0d('0x4d')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x4]?_0x3c7ace['attrs'][0x4][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4e'),'value':_0x3c7ace['attrFaxAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x5]?_0x3c7ace['attrs'][0x5][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4f'),'value':_0x3c7ace[_0xfb0d('0x4f')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x6]?_0x3c7ace[_0xfb0d('0x3d')][0x6][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x50'),'value':_0x3c7ace[_0xfb0d('0x50')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x7]?_0x3c7ace[_0xfb0d('0x3d')][0x7][_0xfb0d('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c7ace[_0xfb0d('0x51')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x8]?_0x3c7ace['attrs'][0x8][_0xfb0d('0x47')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c7ace[_0xfb0d('0x52')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x9]?_0x3c7ace[_0xfb0d('0x3d')][0x9]['value']:undefined)||''}];case _0xfb0d('0x53'):case _0xfb0d('0x54'):return[{'name':_0xfb0d('0x55'),'value':_0x3c7ace[_0xfb0d('0x55')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x49')},{'name':_0xfb0d('0x56'),'value':_0x3c7ace[_0xfb0d('0x56')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||null},{'name':_0xfb0d('0x57'),'value':_0x3c7ace['attrSerie3']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x2]?_0x3c7ace[_0xfb0d('0x3d')][0x2][_0xfb0d('0x47')]:undefined)||null},{'name':_0xfb0d('0x4a'),'value':_0x3c7ace[_0xfb0d('0x4a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x3]?_0x3c7ace['attrs'][0x3][_0xfb0d('0x47')]:undefined)||[]},{'name':_0xfb0d('0x4b'),'value':_0x3c7ace[_0xfb0d('0x4b')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x4]?_0x3c7ace[_0xfb0d('0x3d')][0x4][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x4c')},{'name':'attrEmailAccounts','value':_0x3c7ace[_0xfb0d('0x4d')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x5]?_0x3c7ace['attrs'][0x5][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4e'),'value':_0x3c7ace['attrFaxAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x6]?_0x3c7ace[_0xfb0d('0x3d')][0x6][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4f'),'value':_0x3c7ace[_0xfb0d('0x4f')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x7]?_0x3c7ace[_0xfb0d('0x3d')][0x7][_0xfb0d('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c7ace['attrOpenchannelAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x8]?_0x3c7ace[_0xfb0d('0x3d')][0x8][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x51'),'value':_0x3c7ace['attrWhatsappAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x9]?_0x3c7ace[_0xfb0d('0x3d')][0x9][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x52'),'value':_0x3c7ace['attrChatWebsites']||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0xa]?_0x3c7ace[_0xfb0d('0x3d')][0xa][_0xfb0d('0x47')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3c7ace[_0xfb0d('0x58')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['type']:undefined)||null,'value':_0x3c7ace[_0xfb0d('0x59')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||null},{'name':_0xfb0d('0x5a'),'value':_0x3c7ace[_0xfb0d('0x5a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2b6553){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x2b6553));return[];}}exports[_0xfb0d('0x5b')]=function(_0x2d125c,_0x55ece4){if(_0x2d125c['body']){_0x2d125c[_0xfb0d('0x5c')]['attrs']=widgetAttributes(_0x2d125c[_0xfb0d('0x5c')]);}return db[_0xfb0d('0x39')]['create'](_0x2d125c[_0xfb0d('0x5c')],{})[_0xfb0d('0x27')](respondWithResult(_0x55ece4,0xc9))['catch'](handleError(_0x55ece4,null));};exports[_0xfb0d('0x26')]=function(_0x4dea17,_0x345623){if(_0x4dea17[_0xfb0d('0x5c')]['id']){delete _0x4dea17[_0xfb0d('0x5c')]['id'];}_0x4dea17[_0xfb0d('0x5c')][_0xfb0d('0x3d')]=widgetAttributes(_0x4dea17[_0xfb0d('0x5c')]);return db[_0xfb0d('0x39')]['find']({'where':{'id':_0x4dea17[_0xfb0d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x345623,null))[_0xfb0d('0x27')](saveUpdates(_0x4dea17[_0xfb0d('0x5c')],null))[_0xfb0d('0x27')](respondWithResult(_0x345623,null))['catch'](handleError(_0x345623,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 7f0598b..804a04b 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 _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x1d6544,_0x1113cf){_0x1d6544=_0x1d6544-0x0;var _0x209118=_0x8af6[_0x1d6544];return _0x209118;};'use strict';var EventEmitter=require(_0x68af('0x0'));var DashboardItem=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){DashboardItemEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);DashboardItemEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];DashboardItem[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x7c7f=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0xcfd377,_0x1b9dd7){var _0x286769=function(_0xc414b6){while(--_0xc414b6){_0xcfd377['push'](_0xcfd377['shift']());}};_0x286769(++_0x1b9dd7);}(_0x7c7f,0x13d));var _0xf7c7=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x7c7f[_0x22dac7];return _0x3e6cfa;};'use strict';var EventEmitter=require(_0xf7c7('0x0'));var DashboardItem=require(_0xf7c7('0x1'))['db'][_0xf7c7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf7c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7c7('0x4'),'afterDestroy':_0xf7c7('0x5')};function emitEvent(_0x5e830c){return function(_0x371599,_0x113ca,_0x16e2f2){DashboardItemEvents[_0xf7c7('0x6')](_0x5e830c+':'+_0x371599['id'],_0x371599);DashboardItemEvents[_0xf7c7('0x6')](_0x5e830c,_0x371599);_0x16e2f2(null);};}for(var e in events){if(events[_0xf7c7('0x7')](e)){var event=events[e];DashboardItem[_0xf7c7('0x8')](e,emitEvent(event));}}module[_0xf7c7('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e52f9b8..a6e44aa 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 _0xa884=['define','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x81c3bb,_0x170db2){var _0x684738=function(_0xe20a31){while(--_0xe20a31){_0x81c3bb['push'](_0x81c3bb['shift']());}};_0x684738(++_0x170db2);}(_0xa884,0x182));var _0x4a88=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xa884[_0x42c118];return _0x112ebd;};'use strict';var _=require(_0x4a88('0x0'));var util=require(_0x4a88('0x1'));var logger=require(_0x4a88('0x2'))('api');var moment=require(_0x4a88('0x3'));var BPromise=require(_0x4a88('0x4'));var rp=require(_0x4a88('0x5'));var fs=require('fs');var path=require(_0x4a88('0x6'));var rimraf=require(_0x4a88('0x7'));var config=require(_0x4a88('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x4a88('0x9')]=function(_0x57f5fc,_0x4cd5c0){return _0x57f5fc[_0x4a88('0xa')]('DashboardItem',attributes,{'tableName':_0x4a88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f3c=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x3eb88e,_0x2ebd3f){var _0x5ef88e=function(_0x3da0b3){while(--_0x3da0b3){_0x3eb88e['push'](_0x3eb88e['shift']());}};_0x5ef88e(++_0x2ebd3f);}(_0x9f3c,0x12b));var _0xc9f3=function(_0x4e80a7,_0x3936a2){_0x4e80a7=_0x4e80a7-0x0;var _0x189894=_0x9f3c[_0x4e80a7];return _0x189894;};'use strict';var _=require(_0xc9f3('0x0'));var util=require(_0xc9f3('0x1'));var logger=require(_0xc9f3('0x2'))('api');var moment=require(_0xc9f3('0x3'));var BPromise=require(_0xc9f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9f3('0x5'));var rimraf=require(_0xc9f3('0x6'));var config=require(_0xc9f3('0x7'));var attributes=require(_0xc9f3('0x8'));module[_0xc9f3('0x9')]=function(_0x441e82,_0x39effb){return _0x441e82[_0xc9f3('0xa')](_0xc9f3('0xb'),attributes,{'tableName':'dashboard_items','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 778752c..90860b7 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 _0x34ca=['moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util'];(function(_0xc76588,_0x12dd18){var _0x4a008f=function(_0x438595){while(--_0x438595){_0xc76588['push'](_0xc76588['shift']());}};_0x4a008f(++_0x12dd18);}(_0x34ca,0x12a));var _0xa34c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x34ca[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xa34c('0x0'));var moment=require(_0xa34c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa34c('0x2'));var fs=require('fs');var Redis=require(_0xa34c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa34c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa34c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa34c('0x6')][_0xa34c('0x7')]({'port':0x232a});config[_0xa34c('0x8')]=_[_0xa34c('0x9')](config[_0xa34c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa34c('0xa'))(new Redis(config['redis']));require(_0xa34c('0xb'))[_0xa34c('0xc')](socket);function respondWithRpcPromise(_0xca4ad3,_0x1ed649,_0x649f2c){return new BPromise(function(_0x2d961d,_0xcd4fe7){return client['request'](_0xca4ad3,_0x649f2c)[_0xa34c('0xd')](function(_0x29c966){logger[_0xa34c('0xe')](_0xa34c('0xf'),_0x1ed649,_0xa34c('0x10'));logger[_0xa34c('0x11')](_0xa34c('0x12'),_0x1ed649,_0xa34c('0x10'),JSON[_0xa34c('0x13')](_0x29c966));if(_0x29c966[_0xa34c('0x14')]){if(_0x29c966['error'][_0xa34c('0x15')]===0x1f4){logger[_0xa34c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1ed649,_0x29c966[_0xa34c('0x14')][_0xa34c('0x16')]);return _0xcd4fe7(_0x29c966[_0xa34c('0x14')][_0xa34c('0x16')]);}logger[_0xa34c('0x14')](_0xa34c('0xf'),_0x1ed649,_0x29c966[_0xa34c('0x14')][_0xa34c('0x16')]);return _0x2d961d(_0x29c966[_0xa34c('0x14')]['message']);}else{logger[_0xa34c('0xe')](_0xa34c('0xf'),_0x1ed649,'request\x20sent');_0x2d961d(_0x29c966['result']['message']);}})['catch'](function(_0x46b6da){logger[_0xa34c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1ed649,_0x46b6da);_0xcd4fe7(_0x46b6da);});});} \ No newline at end of file +var _0x847c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x847c,0x15f));var _0xc847=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x847c[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xc847('0x0'));var util=require(_0xc847('0x1'));var moment=require(_0xc847('0x2'));var BPromise=require(_0xc847('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc847('0x4'));var db=require(_0xc847('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc847('0x6'))(_0xc847('0x7'));var config=require(_0xc847('0x8'));var jayson=require(_0xc847('0x9'));var client=jayson[_0xc847('0xa')][_0xc847('0xb')]({'port':0x232a});config[_0xc847('0xc')]=_[_0xc847('0xd')](config[_0xc847('0xc')],{'host':_0xc847('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc847('0xc')]));require(_0xc847('0xf'))[_0xc847('0x10')](socket);function respondWithRpcPromise(_0x149e54,_0x3bff3c,_0x11a6dd){return new BPromise(function(_0x5838e5,_0x31abc4){return client[_0xc847('0x11')](_0x149e54,_0x11a6dd)['then'](function(_0x1158ef){logger[_0xc847('0x12')](_0xc847('0x13'),_0x3bff3c,_0xc847('0x14'));logger[_0xc847('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3bff3c,'request\x20sent',JSON[_0xc847('0x16')](_0x1158ef));if(_0x1158ef['error']){if(_0x1158ef[_0xc847('0x17')][_0xc847('0x18')]===0x1f4){logger[_0xc847('0x17')](_0xc847('0x13'),_0x3bff3c,_0x1158ef[_0xc847('0x17')][_0xc847('0x19')]);return _0x31abc4(_0x1158ef[_0xc847('0x17')][_0xc847('0x19')]);}logger[_0xc847('0x17')](_0xc847('0x13'),_0x3bff3c,_0x1158ef[_0xc847('0x17')][_0xc847('0x19')]);return _0x5838e5(_0x1158ef['error'][_0xc847('0x19')]);}else{logger[_0xc847('0x12')](_0xc847('0x13'),_0x3bff3c,_0xc847('0x14'));_0x5838e5(_0x1158ef['result'][_0xc847('0x19')]);}})[_0xc847('0x1a')](function(_0x234023){logger[_0xc847('0x17')](_0xc847('0x13'),_0x3bff3c,_0x234023);_0x31abc4(_0x234023);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 49d599e..814b7ab 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 _0x9701=['removeListener','register','length','save','remove','update'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x9701,0xed));var _0x1970=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9701[_0x14add3];return _0x4a174f;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x1970('0x0'),_0x1970('0x1'),_0x1970('0x2')];function createListener(_0x3d7077,_0x3bb1f6){return function(_0x3b8cd4){_0x3bb1f6['emit'](_0x3d7077,_0x3b8cd4);};}function removeListener(_0x31b0dd,_0x34fca7){return function(){DashboardItemEvents[_0x1970('0x3')](_0x31b0dd,_0x34fca7);};}exports[_0x1970('0x4')]=function(_0x3d7cd2){for(var _0x522f45=0x0,_0x1cb589=events[_0x1970('0x5')];_0x522f45<_0x1cb589;_0x522f45++){var _0x1742af=events[_0x522f45];var _0x2d4f0f=createListener('dashboardItem:'+_0x1742af,_0x3d7cd2);DashboardItemEvents['on'](_0x1742af,_0x2d4f0f);}}; \ No newline at end of file +var _0x60d8=['./dashboardItem.events','save','remove','update','removeListener','length','dashboardItem:'];(function(_0x46f2b8,_0xd45c7b){var _0x795799=function(_0x33a80d){while(--_0x33a80d){_0x46f2b8['push'](_0x46f2b8['shift']());}};_0x795799(++_0xd45c7b);}(_0x60d8,0x134));var _0x860d=function(_0x26dc6e,_0x189910){_0x26dc6e=_0x26dc6e-0x0;var _0x52e53f=_0x60d8[_0x26dc6e];return _0x52e53f;};'use strict';var DashboardItemEvents=require(_0x860d('0x0'));var events=[_0x860d('0x1'),_0x860d('0x2'),_0x860d('0x3')];function createListener(_0x3bc3b3,_0x3785f0){return function(_0x27114e){_0x3785f0['emit'](_0x3bc3b3,_0x27114e);};}function removeListener(_0x48fadd,_0x370786){return function(){DashboardItemEvents[_0x860d('0x4')](_0x48fadd,_0x370786);};}exports['register']=function(_0x43e381){for(var _0x27c2cb=0x0,_0xea293e=events[_0x860d('0x5')];_0x27c2cb<_0xea293e;_0x27c2cb++){var _0x31c601=events[_0x27c2cb];var _0x3f89f4=createListener(_0x860d('0x6')+_0x31c601,_0x43e381);DashboardItemEvents['on'](_0x31c601,_0x3f89f4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index cdf0b84..47e5311 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 _0xd4c5=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x306ac3,_0x465a6b){var _0x1f92c1=function(_0x44e7f9){while(--_0x44e7f9){_0x306ac3['push'](_0x306ac3['shift']());}};_0x1f92c1(++_0x465a6b);}(_0xd4c5,0x92));var _0x5d4c=function(_0x44417b,_0x11e9ec){_0x44417b=_0x44417b-0x0;var _0x3766cc=_0xd4c5[_0x44417b];return _0x3766cc;};'use strict';var multer=require(_0x5d4c('0x0'));var util=require(_0x5d4c('0x1'));var path=require(_0x5d4c('0x2'));var timeout=require(_0x5d4c('0x3'));var express=require('express');var router=express[_0x5d4c('0x4')]();var fs_extra=require(_0x5d4c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5d4c('0x6'));var controller=require('./dashboardItem.controller');router[_0x5d4c('0x7')](_0x5d4c('0x8'),auth[_0x5d4c('0x9')](),controller[_0x5d4c('0xa')]);router[_0x5d4c('0xb')]('/',auth['isAuthenticated'](),controller[_0x5d4c('0xc')]);router[_0x5d4c('0xd')]('/:id',auth[_0x5d4c('0x9')](),controller['update']);router[_0x5d4c('0xe')](_0x5d4c('0x8'),auth[_0x5d4c('0x9')](),controller[_0x5d4c('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb8bc=['../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xb8bc,0x14b));var _0xcb8b=function(_0x5a26bb,_0x188ca2){_0x5a26bb=_0x5a26bb-0x0;var _0x39c5c1=_0xb8bc[_0x5a26bb];return _0x39c5c1;};'use strict';var multer=require(_0xcb8b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb8b('0x1'));var express=require(_0xcb8b('0x2'));var router=express[_0xcb8b('0x3')]();var fs_extra=require(_0xcb8b('0x4'));var auth=require(_0xcb8b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb8b('0x6'));router[_0xcb8b('0x7')](_0xcb8b('0x8'),auth[_0xcb8b('0x9')](),controller['show']);router[_0xcb8b('0xa')]('/',auth['isAuthenticated'](),controller[_0xcb8b('0xb')]);router[_0xcb8b('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xcb8b('0x8'),auth[_0xcb8b('0x9')](),controller[_0xcb8b('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b1621a5..10f59a9 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 _0x0856=['third','exports','STRING','ENUM','first','second'];(function(_0x2041a4,_0x55946d){var _0x5464b8=function(_0x5c6d2f){while(--_0x5c6d2f){_0x2041a4['push'](_0x2041a4['shift']());}};_0x5464b8(++_0x55946d);}(_0x0856,0x18d));var _0x6085=function(_0x4576ba,_0x454810){_0x4576ba=_0x4576ba-0x0;var _0x157a75=_0x0856[_0x4576ba];return _0x157a75;};'use strict';var Sequelize=require('sequelize');module[_0x6085('0x0')]={'name':{'type':Sequelize[_0x6085('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6085('0x2')](_0x6085('0x3'),_0x6085('0x4'),_0x6085('0x5')),'allowNull':![],'defaultValue':_0x6085('0x3')},'description':{'type':Sequelize[_0x6085('0x1')]}}; \ No newline at end of file +var _0x5118=['sequelize','exports','STRING','ENUM','first','second','third'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5118,0xe7));var _0x8511=function(_0xfbc3dc,_0x3a7830){_0xfbc3dc=_0xfbc3dc-0x0;var _0x48c818=_0x5118[_0xfbc3dc];return _0x48c818;};'use strict';var Sequelize=require(_0x8511('0x0'));module[_0x8511('0x1')]={'name':{'type':Sequelize[_0x8511('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8511('0x3')](_0x8511('0x4'),_0x8511('0x5'),_0x8511('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x8511('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3bd8644..063356b 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 _0x1c90=['catch','params','keys','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','map','Disposition','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows'];(function(_0x1fba11,_0x383ade){var _0x43fb8c=function(_0x37f79b){while(--_0x37f79b){_0x1fba11['push'](_0x1fba11['shift']());}};_0x43fb8c(++_0x383ade);}(_0x1c90,0x104));var _0x01c9=function(_0x6137d9,_0x559f8a){_0x6137d9=_0x6137d9-0x0;var _0x5c24c5=_0x1c90[_0x6137d9];return _0x5c24c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01c9('0x0'));var zipdir=require(_0x01c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01c9('0x2'));var BPromise=require(_0x01c9('0x3'));var Mustache=require('mustache');var util=require(_0x01c9('0x4'));var path=require(_0x01c9('0x5'));var sox=require(_0x01c9('0x6'));var csv=require('to-csv');var ejs=require(_0x01c9('0x7'));var fs=require('fs');var fs_extra=require(_0x01c9('0x8'));var _=require(_0x01c9('0x9'));var squel=require(_0x01c9('0xa'));var crypto=require(_0x01c9('0xb'));var jsforce=require(_0x01c9('0xc'));var deskjs=require(_0x01c9('0xd'));var toCsv=require(_0x01c9('0xe'));var querystring=require('querystring');var Papa=require(_0x01c9('0xf'));var Redis=require(_0x01c9('0x10'));var authService=require(_0x01c9('0x11'));var qs=require(_0x01c9('0x12'));var as=require(_0x01c9('0x13'));var hardwareService=require(_0x01c9('0x14'));var logger=require('../../config/logger')(_0x01c9('0x15'));var utils=require(_0x01c9('0x16'));var config=require(_0x01c9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x01c9('0x18'))['db'];function respondWithStatusCode(_0x2c601d,_0x1c9f93){_0x1c9f93=_0x1c9f93||0xcc;return function(_0x3adb02){if(_0x3adb02){return _0x2c601d[_0x01c9('0x19')](_0x1c9f93);}return _0x2c601d[_0x01c9('0x1a')](_0x1c9f93)[_0x01c9('0x1b')]();};}function respondWithResult(_0x120ca9,_0x29fc3d){_0x29fc3d=_0x29fc3d||0xc8;return function(_0x49b8ea){if(_0x49b8ea){return _0x120ca9[_0x01c9('0x1a')](_0x29fc3d)['json'](_0x49b8ea);}};}function respondWithFilteredResult(_0x5ef62f,_0x121100){return function(_0x50d7ec){if(_0x50d7ec){var _0xc387ec=typeof _0x121100[_0x01c9('0x1c')]===_0x01c9('0x1d')&&typeof _0x121100['limit']===_0x01c9('0x1d');var _0x2dc089=_0x50d7ec[_0x01c9('0x1e')];var _0x525f95=_0xc387ec?0x0:_0x121100['offset'];var _0x19b072=_0xc387ec?_0x50d7ec['count']:_0x121100[_0x01c9('0x1c')]+_0x121100[_0x01c9('0x1f')];var _0x4ceb62;if(_0x19b072>=_0x2dc089){_0x19b072=_0x2dc089;_0x4ceb62=0xc8;}else{_0x4ceb62=0xce;}_0x5ef62f['status'](_0x4ceb62);return _0x5ef62f[_0x01c9('0x20')](_0x01c9('0x21'),_0x525f95+'-'+_0x19b072+'/'+_0x2dc089)[_0x01c9('0x22')](_0x50d7ec);}return null;};}function patchUpdates(_0x132014){return function(_0x63a7ca){try{jsonpatch[_0x01c9('0x23')](_0x63a7ca,_0x132014,!![]);}catch(_0x3bf557){return BPromise[_0x01c9('0x24')](_0x3bf557);}return _0x63a7ca['save']();};}function saveUpdates(_0xd2f32b,_0x464ad5){return function(_0x159d94){if(_0x159d94){return _0x159d94['update'](_0xd2f32b)[_0x01c9('0x25')](function(_0x49f3ec){return _0x49f3ec;});}return null;};}function removeEntity(_0x2e7b15,_0x55a2f6){return function(_0x49e4bd){if(_0x49e4bd){return _0x49e4bd[_0x01c9('0x26')]()['then'](function(){var _0x29eed3=_0x49e4bd[_0x01c9('0x27')]({'plain':!![]});var _0x501c83=_0x01c9('0x28');return db[_0x01c9('0x29')][_0x01c9('0x26')]({'where':{'type':_0x501c83,'resourceId':_0x29eed3['id']}})['then'](function(){return _0x49e4bd;});})[_0x01c9('0x25')](function(){_0x2e7b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1491a0,_0x1cef6b){return function(_0x4f27e0){if(!_0x4f27e0){_0x1491a0[_0x01c9('0x19')](0x194);}return _0x4f27e0;};}function handleError(_0x1b752f,_0x3e47d9){_0x3e47d9=_0x3e47d9||0x1f4;return function(_0x3cc3a3){logger[_0x01c9('0x2a')](_0x3cc3a3[_0x01c9('0x2b')]);if(_0x3cc3a3['name']){delete _0x3cc3a3[_0x01c9('0x2c')];}_0x1b752f[_0x01c9('0x1a')](_0x3e47d9)[_0x01c9('0x2d')](_0x3cc3a3);};}exports['index']=function(_0x22d45f,_0xd7277){var _0x56ce21={},_0xb11b7f={},_0x24165d={'count':0x0,'rows':[]};var _0x443ec8=_[_0x01c9('0x2e')](db[_0x01c9('0x2f')]['rawAttributes'],function(_0x29ecca){return{'name':_0x29ecca[_0x01c9('0x30')],'type':_0x29ecca['type'][_0x01c9('0x31')]};});_0xb11b7f[_0x01c9('0x32')]=_[_0x01c9('0x2e')](_0x443ec8,_0x01c9('0x2c'));_0xb11b7f[_0x01c9('0x33')]=_['keys'](_0x22d45f['query']);_0xb11b7f[_0x01c9('0x34')]=_[_0x01c9('0x35')](_0xb11b7f[_0x01c9('0x32')],_0xb11b7f[_0x01c9('0x33')]);_0x56ce21[_0x01c9('0x36')]=_[_0x01c9('0x35')](_0xb11b7f['model'],qs[_0x01c9('0x37')](_0x22d45f['query'][_0x01c9('0x37')]));_0x56ce21[_0x01c9('0x36')]=_0x56ce21[_0x01c9('0x36')]['length']?_0x56ce21['attributes']:_0xb11b7f['model'];if(!_0x22d45f[_0x01c9('0x33')][_0x01c9('0x38')](_0x01c9('0x39'))){_0x56ce21['limit']=qs[_0x01c9('0x1f')](_0x22d45f['query'][_0x01c9('0x1f')]);_0x56ce21['offset']=qs[_0x01c9('0x1c')](_0x22d45f[_0x01c9('0x33')][_0x01c9('0x1c')]);}_0x56ce21['order']=qs[_0x01c9('0x3a')](_0x22d45f[_0x01c9('0x33')][_0x01c9('0x3a')]);_0x56ce21[_0x01c9('0x3b')]=qs[_0x01c9('0x34')](_[_0x01c9('0x3c')](_0x22d45f[_0x01c9('0x33')],_0xb11b7f[_0x01c9('0x34')]),_0x443ec8);if(_0x22d45f[_0x01c9('0x33')]['filter']){_0x56ce21[_0x01c9('0x3b')]=_['merge'](_0x56ce21[_0x01c9('0x3b')],{'$or':_[_0x01c9('0x2e')](_0x443ec8,function(_0x15c2c5){if(_0x15c2c5[_0x01c9('0x3d')]!==_0x01c9('0x3e')){var _0x81fb80={};_0x81fb80[_0x15c2c5['name']]={'$like':'%'+_0x22d45f[_0x01c9('0x33')]['filter']+'%'};return _0x81fb80;}})});}_0x56ce21=_[_0x01c9('0x3f')]({},_0x56ce21,_0x22d45f[_0x01c9('0x40')]);var _0x1f7801={'where':_0x56ce21['where']};return db[_0x01c9('0x2f')][_0x01c9('0x1e')](_0x1f7801)[_0x01c9('0x25')](function(_0x389bfd){_0x24165d[_0x01c9('0x1e')]=_0x389bfd;if(_0x22d45f[_0x01c9('0x33')][_0x01c9('0x41')]){_0x56ce21[_0x01c9('0x42')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56ce21);})[_0x01c9('0x25')](function(_0x29044a){_0x24165d[_0x01c9('0x43')]=_0x29044a;return _0x24165d;})[_0x01c9('0x25')](respondWithFilteredResult(_0xd7277,_0x56ce21))[_0x01c9('0x44')](handleError(_0xd7277,null));};exports['show']=function(_0x4e195b,_0x26682e){var _0x2e3a02={'raw':!![],'where':{'id':_0x4e195b[_0x01c9('0x45')]['id']}},_0x4b168b={};_0x4b168b[_0x01c9('0x32')]=_[_0x01c9('0x46')](db['Disposition'][_0x01c9('0x47')]);_0x4b168b[_0x01c9('0x33')]=_[_0x01c9('0x46')](_0x4e195b[_0x01c9('0x33')]);_0x4b168b[_0x01c9('0x34')]=_[_0x01c9('0x35')](_0x4b168b['model'],_0x4b168b['query']);_0x2e3a02[_0x01c9('0x36')]=_[_0x01c9('0x35')](_0x4b168b['model'],qs[_0x01c9('0x37')](_0x4e195b[_0x01c9('0x33')]['fields']));_0x2e3a02['attributes']=_0x2e3a02[_0x01c9('0x36')][_0x01c9('0x48')]?_0x2e3a02[_0x01c9('0x36')]:_0x4b168b[_0x01c9('0x32')];if(_0x4e195b[_0x01c9('0x33')][_0x01c9('0x41')]){_0x2e3a02[_0x01c9('0x42')]=[{'all':!![]}];}_0x2e3a02=_[_0x01c9('0x3f')]({},_0x2e3a02,_0x4e195b[_0x01c9('0x40')]);return db['Disposition'][_0x01c9('0x49')](_0x2e3a02)['then'](handleEntityNotFound(_0x26682e,null))[_0x01c9('0x25')](respondWithResult(_0x26682e,null))['catch'](handleError(_0x26682e,null));};exports[_0x01c9('0x4a')]=function(_0x27dd3f,_0x8caa31){return db[_0x01c9('0x2f')][_0x01c9('0x4a')](_0x27dd3f[_0x01c9('0x4b')],{})['then'](function(_0xb19cda){var _0x52234d=_0x27dd3f['user'][_0x01c9('0x27')]({'plain':!![]});if(!_0x52234d)throw new Error(_0x01c9('0x4c'));if(_0x52234d[_0x01c9('0x4d')]==='user'){var _0x5dcd20=_0xb19cda['get']({'plain':!![]});var _0x2f08d4='Dispositions';return db[_0x01c9('0x4e')][_0x01c9('0x49')]({'where':{'name':_0x2f08d4,'userProfileId':_0x52234d[_0x01c9('0x4f')]},'raw':!![]})[_0x01c9('0x25')](function(_0x3f343b){if(_0x3f343b&&_0x3f343b[_0x01c9('0x50')]===0x0){return db[_0x01c9('0x29')][_0x01c9('0x4a')]({'name':_0x5dcd20[_0x01c9('0x2c')],'resourceId':_0x5dcd20['id'],'type':_0x3f343b['name'],'sectionId':_0x3f343b['id']},{})[_0x01c9('0x25')](function(){return _0xb19cda;});}else{return _0xb19cda;}})[_0x01c9('0x44')](function(_0x84aa1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x84aa1a);throw _0x84aa1a;});}return _0xb19cda;})[_0x01c9('0x25')](respondWithResult(_0x8caa31,0xc9))[_0x01c9('0x44')](handleError(_0x8caa31,null));};exports[_0x01c9('0x51')]=function(_0x2d57ac,_0x40b330){if(_0x2d57ac[_0x01c9('0x4b')]['id']){delete _0x2d57ac['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x2d57ac['params']['id']}})[_0x01c9('0x25')](handleEntityNotFound(_0x40b330,null))['then'](saveUpdates(_0x2d57ac[_0x01c9('0x4b')],null))['then'](respondWithResult(_0x40b330,null))[_0x01c9('0x44')](handleError(_0x40b330,null));};exports[_0x01c9('0x26')]=function(_0x2d445b,_0x12eca1){return db['Disposition'][_0x01c9('0x49')]({'where':{'id':_0x2d445b[_0x01c9('0x45')]['id']}})[_0x01c9('0x25')](handleEntityNotFound(_0x12eca1,null))[_0x01c9('0x25')](removeEntity(_0x12eca1,null))[_0x01c9('0x44')](handleError(_0x12eca1,null));}; \ No newline at end of file +var _0x3ef1=['zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','status','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','options','Disposition','includeAll','params','include','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf'];(function(_0x506262,_0x574353){var _0x50067b=function(_0xb8dc21){while(--_0xb8dc21){_0x506262['push'](_0x506262['shift']());}};_0x50067b(++_0x574353);}(_0x3ef1,0x99));var _0x13ef=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3ef1[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13ef('0x0'));var zipdir=require(_0x13ef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x13ef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x13ef('0x3'));var util=require(_0x13ef('0x4'));var path=require(_0x13ef('0x5'));var sox=require(_0x13ef('0x6'));var csv=require(_0x13ef('0x7'));var ejs=require(_0x13ef('0x8'));var fs=require('fs');var fs_extra=require(_0x13ef('0x9'));var _=require(_0x13ef('0xa'));var squel=require('squel');var crypto=require(_0x13ef('0xb'));var jsforce=require(_0x13ef('0xc'));var deskjs=require(_0x13ef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13ef('0xe'));var Redis=require(_0x13ef('0xf'));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(_0x13ef('0x10'))(_0x13ef('0x11'));var utils=require('../../config/utils');var config=require(_0x13ef('0x12'));var licenseUtil=require(_0x13ef('0x13'));var db=require(_0x13ef('0x14'))['db'];function respondWithStatusCode(_0x13bb80,_0x5b06de){_0x5b06de=_0x5b06de||0xcc;return function(_0x266656){if(_0x266656){return _0x13bb80[_0x13ef('0x15')](_0x5b06de);}return _0x13bb80['status'](_0x5b06de)[_0x13ef('0x16')]();};}function respondWithResult(_0x5accea,_0xe71169){_0xe71169=_0xe71169||0xc8;return function(_0x3ee519){if(_0x3ee519){return _0x5accea['status'](_0xe71169)[_0x13ef('0x17')](_0x3ee519);}};}function respondWithFilteredResult(_0x3e5113,_0x2a3ee3){return function(_0x2d2544){if(_0x2d2544){var _0x1437e0=typeof _0x2a3ee3[_0x13ef('0x18')]===_0x13ef('0x19')&&typeof _0x2a3ee3['limit']===_0x13ef('0x19');var _0x451626=_0x2d2544[_0x13ef('0x1a')];var _0x261b0d=_0x1437e0?0x0:_0x2a3ee3[_0x13ef('0x18')];var _0x5cf09e=_0x1437e0?_0x2d2544[_0x13ef('0x1a')]:_0x2a3ee3[_0x13ef('0x18')]+_0x2a3ee3['limit'];var _0x2fe315;if(_0x5cf09e>=_0x451626){_0x5cf09e=_0x451626;_0x2fe315=0xc8;}else{_0x2fe315=0xce;}_0x3e5113['status'](_0x2fe315);return _0x3e5113['set']('Content-Range',_0x261b0d+'-'+_0x5cf09e+'/'+_0x451626)['json'](_0x2d2544);}return null;};}function patchUpdates(_0x370c9d){return function(_0x299b00){try{jsonpatch['apply'](_0x299b00,_0x370c9d,!![]);}catch(_0x38db9d){return BPromise[_0x13ef('0x1b')](_0x38db9d);}return _0x299b00[_0x13ef('0x1c')]();};}function saveUpdates(_0x8e9f64,_0x3ef22f){return function(_0x4b617c){if(_0x4b617c){return _0x4b617c[_0x13ef('0x1d')](_0x8e9f64)[_0x13ef('0x1e')](function(_0x1f29c6){return _0x1f29c6;});}return null;};}function removeEntity(_0x3adc62,_0x302d0d){return function(_0x2d8db6){if(_0x2d8db6){return _0x2d8db6[_0x13ef('0x1f')]()[_0x13ef('0x1e')](function(){var _0x586875=_0x2d8db6[_0x13ef('0x20')]({'plain':!![]});var _0x346684=_0x13ef('0x21');return db[_0x13ef('0x22')][_0x13ef('0x1f')]({'where':{'type':_0x346684,'resourceId':_0x586875['id']}})[_0x13ef('0x1e')](function(){return _0x2d8db6;});})[_0x13ef('0x1e')](function(){_0x3adc62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x374344,_0x5bbbda){return function(_0x24069a){if(!_0x24069a){_0x374344[_0x13ef('0x15')](0x194);}return _0x24069a;};}function handleError(_0x5d4bcd,_0xdaf605){_0xdaf605=_0xdaf605||0x1f4;return function(_0x39b5c1){logger[_0x13ef('0x23')](_0x39b5c1[_0x13ef('0x24')]);if(_0x39b5c1[_0x13ef('0x25')]){delete _0x39b5c1[_0x13ef('0x25')];}_0x5d4bcd[_0x13ef('0x26')](_0xdaf605)[_0x13ef('0x27')](_0x39b5c1);};}exports[_0x13ef('0x28')]=function(_0x387bab,_0x13d9e0){var _0x3a4abd={},_0x10e8d1={},_0x32f303={'count':0x0,'rows':[]};var _0xd9f576=_[_0x13ef('0x29')](db['Disposition'][_0x13ef('0x2a')],function(_0xbcd664){return{'name':_0xbcd664[_0x13ef('0x2b')],'type':_0xbcd664[_0x13ef('0x2c')]['key']};});_0x10e8d1[_0x13ef('0x2d')]=_[_0x13ef('0x29')](_0xd9f576,'name');_0x10e8d1['query']=_[_0x13ef('0x2e')](_0x387bab[_0x13ef('0x2f')]);_0x10e8d1[_0x13ef('0x30')]=_[_0x13ef('0x31')](_0x10e8d1['model'],_0x10e8d1[_0x13ef('0x2f')]);_0x3a4abd['attributes']=_[_0x13ef('0x31')](_0x10e8d1[_0x13ef('0x2d')],qs[_0x13ef('0x32')](_0x387bab[_0x13ef('0x2f')][_0x13ef('0x32')]));_0x3a4abd[_0x13ef('0x33')]=_0x3a4abd[_0x13ef('0x33')][_0x13ef('0x34')]?_0x3a4abd['attributes']:_0x10e8d1['model'];if(!_0x387bab['query'][_0x13ef('0x35')](_0x13ef('0x36'))){_0x3a4abd[_0x13ef('0x37')]=qs[_0x13ef('0x37')](_0x387bab[_0x13ef('0x2f')][_0x13ef('0x37')]);_0x3a4abd[_0x13ef('0x18')]=qs[_0x13ef('0x18')](_0x387bab[_0x13ef('0x2f')][_0x13ef('0x18')]);}_0x3a4abd[_0x13ef('0x38')]=qs[_0x13ef('0x39')](_0x387bab['query'][_0x13ef('0x39')]);_0x3a4abd[_0x13ef('0x3a')]=qs[_0x13ef('0x30')](_[_0x13ef('0x3b')](_0x387bab[_0x13ef('0x2f')],_0x10e8d1[_0x13ef('0x30')]),_0xd9f576);if(_0x387bab['query']['filter']){_0x3a4abd[_0x13ef('0x3a')]=_['merge'](_0x3a4abd[_0x13ef('0x3a')],{'$or':_[_0x13ef('0x29')](_0xd9f576,function(_0x93807d){if(_0x93807d[_0x13ef('0x2c')]!==_0x13ef('0x3c')){var _0x16991b={};_0x16991b[_0x93807d[_0x13ef('0x25')]]={'$like':'%'+_0x387bab[_0x13ef('0x2f')][_0x13ef('0x3d')]+'%'};return _0x16991b;}})});}_0x3a4abd=_['merge']({},_0x3a4abd,_0x387bab[_0x13ef('0x3e')]);var _0x382704={'where':_0x3a4abd[_0x13ef('0x3a')]};return db[_0x13ef('0x3f')]['count'](_0x382704)[_0x13ef('0x1e')](function(_0x70f998){_0x32f303['count']=_0x70f998;if(_0x387bab[_0x13ef('0x2f')][_0x13ef('0x40')]){_0x3a4abd['include']=[{'all':!![]}];}return db[_0x13ef('0x3f')]['findAll'](_0x3a4abd);})[_0x13ef('0x1e')](function(_0x5ae26c){_0x32f303['rows']=_0x5ae26c;return _0x32f303;})[_0x13ef('0x1e')](respondWithFilteredResult(_0x13d9e0,_0x3a4abd))['catch'](handleError(_0x13d9e0,null));};exports['show']=function(_0x55856f,_0x301683){var _0x4aa888={'raw':!![],'where':{'id':_0x55856f[_0x13ef('0x41')]['id']}},_0x58e3b8={};_0x58e3b8[_0x13ef('0x2d')]=_[_0x13ef('0x2e')](db[_0x13ef('0x3f')][_0x13ef('0x2a')]);_0x58e3b8[_0x13ef('0x2f')]=_[_0x13ef('0x2e')](_0x55856f['query']);_0x58e3b8['filters']=_[_0x13ef('0x31')](_0x58e3b8['model'],_0x58e3b8[_0x13ef('0x2f')]);_0x4aa888[_0x13ef('0x33')]=_[_0x13ef('0x31')](_0x58e3b8[_0x13ef('0x2d')],qs['fields'](_0x55856f[_0x13ef('0x2f')][_0x13ef('0x32')]));_0x4aa888[_0x13ef('0x33')]=_0x4aa888[_0x13ef('0x33')]['length']?_0x4aa888[_0x13ef('0x33')]:_0x58e3b8[_0x13ef('0x2d')];if(_0x55856f[_0x13ef('0x2f')][_0x13ef('0x40')]){_0x4aa888[_0x13ef('0x42')]=[{'all':!![]}];}_0x4aa888=_[_0x13ef('0x43')]({},_0x4aa888,_0x55856f[_0x13ef('0x3e')]);return db['Disposition']['find'](_0x4aa888)[_0x13ef('0x1e')](handleEntityNotFound(_0x301683,null))[_0x13ef('0x1e')](respondWithResult(_0x301683,null))[_0x13ef('0x44')](handleError(_0x301683,null));};exports['create']=function(_0x4714c3,_0xbffd8d){return db['Disposition'][_0x13ef('0x45')](_0x4714c3['body'],{})[_0x13ef('0x1e')](function(_0x4a2ace){var _0xc96d65=_0x4714c3[_0x13ef('0x46')][_0x13ef('0x20')]({'plain':!![]});if(!_0xc96d65)throw new Error(_0x13ef('0x47'));if(_0xc96d65[_0x13ef('0x48')]===_0x13ef('0x46')){var _0x35b4a5=_0x4a2ace[_0x13ef('0x20')]({'plain':!![]});var _0x25bbdc=_0x13ef('0x21');return db['UserProfileSection'][_0x13ef('0x49')]({'where':{'name':_0x25bbdc,'userProfileId':_0xc96d65[_0x13ef('0x4a')]},'raw':!![]})['then'](function(_0x5921f4){if(_0x5921f4&&_0x5921f4['autoAssociation']===0x0){return db[_0x13ef('0x22')][_0x13ef('0x45')]({'name':_0x35b4a5[_0x13ef('0x25')],'resourceId':_0x35b4a5['id'],'type':_0x5921f4[_0x13ef('0x25')],'sectionId':_0x5921f4['id']},{})[_0x13ef('0x1e')](function(){return _0x4a2ace;});}else{return _0x4a2ace;}})['catch'](function(_0x5fad9d){logger[_0x13ef('0x23')](_0x13ef('0x4b'),_0x5fad9d);throw _0x5fad9d;});}return _0x4a2ace;})[_0x13ef('0x1e')](respondWithResult(_0xbffd8d,0xc9))['catch'](handleError(_0xbffd8d,null));};exports[_0x13ef('0x1d')]=function(_0x219fa9,_0x416b88){if(_0x219fa9[_0x13ef('0x4c')]['id']){delete _0x219fa9[_0x13ef('0x4c')]['id'];}return db[_0x13ef('0x3f')][_0x13ef('0x49')]({'where':{'id':_0x219fa9[_0x13ef('0x41')]['id']}})[_0x13ef('0x1e')](handleEntityNotFound(_0x416b88,null))[_0x13ef('0x1e')](saveUpdates(_0x219fa9['body'],null))[_0x13ef('0x1e')](respondWithResult(_0x416b88,null))[_0x13ef('0x44')](handleError(_0x416b88,null));};exports[_0x13ef('0x1f')]=function(_0x158836,_0x1eac6c){return db['Disposition']['find']({'where':{'id':_0x158836[_0x13ef('0x41')]['id']}})[_0x13ef('0x1e')](handleEntityNotFound(_0x1eac6c,null))[_0x13ef('0x1e')](removeEntity(_0x1eac6c,null))[_0x13ef('0x44')](handleError(_0x1eac6c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 972f452..0f8b8b8 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 _0x7a1e=['../../config/logger','api','moment','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util'];(function(_0x5053d3,_0x29f36c){var _0x552db5=function(_0x2223f9){while(--_0x2223f9){_0x5053d3['push'](_0x5053d3['shift']());}};_0x552db5(++_0x29f36c);}(_0x7a1e,0x16e));var _0xe7a1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7a1e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe7a1('0x0'));var util=require(_0xe7a1('0x1'));var logger=require(_0xe7a1('0x2'))(_0xe7a1('0x3'));var moment=require(_0xe7a1('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a1('0x6'));var config=require('../../config/environment');var attributes=require(_0xe7a1('0x7'));module[_0xe7a1('0x8')]=function(_0x5d015d,_0x1fde24){return _0x5d015d[_0xe7a1('0x9')](_0xe7a1('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xe7a1('0xb'),'fields':[_0xe7a1('0xc'),_0xe7a1('0xd')]},{'unique':!![],'name':_0xe7a1('0xe'),'fields':[_0xe7a1('0xc'),_0xe7a1('0xf')]},{'unique':!![],'name':_0xe7a1('0x10'),'fields':['name',_0xe7a1('0x11')]},{'unique':!![],'name':_0xe7a1('0x12'),'fields':[_0xe7a1('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xe7a1('0x13'),'fields':[_0xe7a1('0xc'),'FaxAccountId']},{'unique':!![],'name':_0xe7a1('0x14'),'fields':[_0xe7a1('0xc'),_0xe7a1('0x15')]},{'unique':!![],'name':_0xe7a1('0x16'),'fields':[_0xe7a1('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ef7=['name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./disposition.attributes','define','tools_dispositions'];(function(_0x3a8d53,_0x2dbdf3){var _0x35d0d7=function(_0x459b36){while(--_0x459b36){_0x3a8d53['push'](_0x3a8d53['shift']());}};_0x35d0d7(++_0x2dbdf3);}(_0x6ef7,0x12e));var _0x76ef=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6ef7[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x76ef('0x0'));var logger=require(_0x76ef('0x1'))(_0x76ef('0x2'));var moment=require(_0x76ef('0x3'));var BPromise=require('bluebird');var rp=require(_0x76ef('0x4'));var fs=require('fs');var path=require(_0x76ef('0x5'));var rimraf=require('rimraf');var config=require(_0x76ef('0x6'));var attributes=require(_0x76ef('0x7'));module['exports']=function(_0x9c5434,_0x489c2c){return _0x9c5434[_0x76ef('0x8')]('Disposition',attributes,{'tableName':_0x76ef('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x76ef('0xa'),'fields':['name',_0x76ef('0xb')]},{'unique':!![],'name':_0x76ef('0xc'),'fields':[_0x76ef('0xd'),_0x76ef('0xe')]},{'unique':!![],'name':_0x76ef('0xf'),'fields':[_0x76ef('0xd'),_0x76ef('0x10')]},{'unique':!![],'name':_0x76ef('0x11'),'fields':[_0x76ef('0xd'),_0x76ef('0x12')]},{'unique':!![],'name':_0x76ef('0x13'),'fields':[_0x76ef('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x76ef('0x14'),'fields':[_0x76ef('0xd'),_0x76ef('0x15')]},{'unique':!![],'name':_0x76ef('0x16'),'fields':[_0x76ef('0xd'),_0x76ef('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 5a08ace..0f71798 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(_0x176b16,_0x33a2df){var _0x448d46=function(_0x5257ae){while(--_0x5257ae){_0x176b16['push'](_0x176b16['shift']());}};_0x448d46(++_0x33a2df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xd1a15c,_0x33aba4){var _0x2daa61=function(_0x5493f8){while(--_0x5493f8){_0xd1a15c['push'](_0xd1a15c['shift']());}};_0x2daa61(++_0x33aba4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 ae99821..f988245 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 _0x8cd6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2b5fad,_0x12981f){var _0x3adfd3=function(_0x4e9d2a){while(--_0x4e9d2a){_0x2b5fad['push'](_0x2b5fad['shift']());}};_0x3adfd3(++_0x12981f);}(_0x8cd6,0x13e));var _0x68cd=function(_0x3285d4,_0x136036){_0x3285d4=_0x3285d4-0x0;var _0x5408c9=_0x8cd6[_0x3285d4];return _0x5408c9;};'use strict';var multer=require(_0x68cd('0x0'));var util=require('util');var path=require(_0x68cd('0x1'));var timeout=require(_0x68cd('0x2'));var express=require(_0x68cd('0x3'));var router=express[_0x68cd('0x4')]();var fs_extra=require(_0x68cd('0x5'));var auth=require(_0x68cd('0x6'));var interaction=require(_0x68cd('0x7'));var config=require(_0x68cd('0x8'));var controller=require(_0x68cd('0x9'));router[_0x68cd('0xa')]('/',auth[_0x68cd('0xb')](),controller['index']);router[_0x68cd('0xa')](_0x68cd('0xc'),auth[_0x68cd('0xb')](),controller[_0x68cd('0xd')]);router[_0x68cd('0xe')]('/',auth[_0x68cd('0xb')](),controller[_0x68cd('0xf')]);router['put'](_0x68cd('0xc'),auth[_0x68cd('0xb')](),controller[_0x68cd('0x10')]);router['delete'](_0x68cd('0xc'),auth['isAuthenticated'](),controller[_0x68cd('0x11')]);module[_0x68cd('0x12')]=router; \ No newline at end of file +var _0xdd4f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0xe3460,_0x5edc07){var _0x19e9f0=function(_0x544efe){while(--_0x544efe){_0xe3460['push'](_0xe3460['shift']());}};_0x19e9f0(++_0x5edc07);}(_0xdd4f,0x1f2));var _0xfdd4=function(_0x49b98f,_0x2b5c8f){_0x49b98f=_0x49b98f-0x0;var _0x2466e7=_0xdd4f[_0x49b98f];return _0x2466e7;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require(_0xfdd4('0x1'));var path=require(_0xfdd4('0x2'));var timeout=require(_0xfdd4('0x3'));var express=require(_0xfdd4('0x4'));var router=express[_0xfdd4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfdd4('0x7'));var controller=require('./disposition.controller');router[_0xfdd4('0x8')]('/',auth[_0xfdd4('0x9')](),controller['index']);router[_0xfdd4('0x8')](_0xfdd4('0xa'),auth[_0xfdd4('0x9')](),controller['show']);router[_0xfdd4('0xb')]('/',auth[_0xfdd4('0x9')](),controller['create']);router[_0xfdd4('0xc')](_0xfdd4('0xa'),auth[_0xfdd4('0x9')](),controller[_0xfdd4('0xd')]);router[_0xfdd4('0xe')]('/:id',auth[_0xfdd4('0x9')](),controller[_0xfdd4('0xf')]);module[_0xfdd4('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 056a3fd..89ff49d 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 _0xd90c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','14400','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd90c,0x71));var _0xcd90=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xd90c[_0x2601b4];return _0x3e3661;};'use strict';var Sequelize=require(_0xcd90('0x0'));module[_0xcd90('0x1')]={'name':{'type':Sequelize[_0xcd90('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcd90('0x2')]},'ecm':{'type':Sequelize[_0xcd90('0x3')]('yes','no'),'defaultValue':_0xcd90('0x4')},'headerinfo':{'type':Sequelize[_0xcd90('0x2')],'defaultValue':_0xcd90('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xcd90('0x6')},'minrate':{'type':Sequelize[_0xcd90('0x3')]('2400',_0xcd90('0x7'),_0xcd90('0x8'),_0xcd90('0x9'),'12000',_0xcd90('0xa')),'defaultValue':_0xcd90('0x7')},'maxrate':{'type':Sequelize[_0xcd90('0x3')](_0xcd90('0xb'),_0xcd90('0x7'),_0xcd90('0x8'),_0xcd90('0x9'),_0xcd90('0xc'),_0xcd90('0xa')),'defaultValue':_0xcd90('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xcd90('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcd90('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcd90('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xcd90('0x3')](_0xcd90('0xf'),_0xcd90('0x10'),_0xcd90('0x11'),_0xcd90('0x12')),'defaultValue':_0xcd90('0xf')},'key':{'type':Sequelize[_0xcd90('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcd90('0x13')],'defaultValue':function(){return _0xcd90('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd90('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd90('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd90('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd90('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xcd90('0x16')},'mandatoryDisposition':{'type':Sequelize[_0xcd90('0x15')],'defaultValue':![],'comment':_0xcd90('0x17'),'set':function(_0x25c465){if(!_0x25c465)this['setDataValue'](_0xcd90('0x18'),null);this[_0xcd90('0x19')](_0xcd90('0x1a'),_0x25c465);}}}; \ No newline at end of file +var _0x14fd=['STRING','ENUM','yes','localstationid','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x276281,_0x2b39b2){var _0x1434e6=function(_0x4da281){while(--_0x4da281){_0x276281['push'](_0x276281['shift']());}};_0x1434e6(++_0x2b39b2);}(_0x14fd,0xa6));var _0xd14f=function(_0x2f1240,_0x432363){_0x2f1240=_0x2f1240-0x0;var _0x5508bd=_0x14fd[_0x2f1240];return _0x5508bd;};'use strict';var Sequelize=require(_0xd14f('0x0'));module[_0xd14f('0x1')]={'name':{'type':Sequelize[_0xd14f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xd14f('0x3')](_0xd14f('0x4'),'no'),'defaultValue':_0xd14f('0x4')},'headerinfo':{'type':Sequelize[_0xd14f('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd14f('0x2')],'unique':_0xd14f('0x5')},'minrate':{'type':Sequelize[_0xd14f('0x3')]('2400',_0xd14f('0x6'),_0xd14f('0x7'),_0xd14f('0x8'),_0xd14f('0x9'),_0xd14f('0xa')),'defaultValue':_0xd14f('0x6')},'maxrate':{'type':Sequelize[_0xd14f('0x3')]('2400',_0xd14f('0x6'),'7200',_0xd14f('0x8'),'12000',_0xd14f('0xa')),'defaultValue':_0xd14f('0xa')},'modem':{'type':Sequelize[_0xd14f('0x2')],'defaultValue':_0xd14f('0xb')},'gateway':{'type':Sequelize[_0xd14f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd14f('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd14f('0x3')](_0xd14f('0xd'),_0xd14f('0xe'),_0xd14f('0xf'),_0xd14f('0x10')),'defaultValue':_0xd14f('0xd')},'key':{'type':Sequelize[_0xd14f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd14f('0x11')],'defaultValue':function(){return _0xd14f('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd14f('0xc')],'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[_0xd14f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd14f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd14f('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xd14f('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd14f('0x15'),'set':function(_0x5bb1bd){if(!_0x5bb1bd)this[_0xd14f('0x16')](_0xd14f('0x17'),null);this[_0xd14f('0x16')]('mandatoryDisposition',_0x5bb1bd);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 87a1ed1..6b42a6c 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 _0x819b=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','localstationid','app','system','description','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','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','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','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','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0xf2a3bf,_0x30b52d){var _0x1d5527=function(_0x3e10d6){while(--_0x3e10d6){_0xf2a3bf['push'](_0xf2a3bf['shift']());}};_0x1d5527(++_0x30b52d);}(_0x819b,0x75));var _0xb819=function(_0x29a09e,_0x178d0d){_0x29a09e=_0x29a09e-0x0;var _0x5c3e2c=_0x819b[_0x29a09e];return _0x5c3e2c;};'use strict';var emlformat=require(_0xb819('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb819('0x1'));var jsonpatch=require(_0xb819('0x2'));var rp=require('request-promise');var moment=require(_0xb819('0x3'));var BPromise=require(_0xb819('0x4'));var Mustache=require(_0xb819('0x5'));var util=require(_0xb819('0x6'));var path=require(_0xb819('0x7'));var sox=require(_0xb819('0x8'));var csv=require(_0xb819('0x9'));var ejs=require(_0xb819('0xa'));var fs=require('fs');var fs_extra=require(_0xb819('0xb'));var _=require(_0xb819('0xc'));var squel=require(_0xb819('0xd'));var crypto=require(_0xb819('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb819('0xf'));var toCsv=require(_0xb819('0x9'));var querystring=require(_0xb819('0x10'));var Papa=require(_0xb819('0x11'));var Redis=require(_0xb819('0x12'));var authService=require(_0xb819('0x13'));var qs=require(_0xb819('0x14'));var as=require(_0xb819('0x15'));var hardwareService=require(_0xb819('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb819('0x17'));var db=require(_0xb819('0x18'))['db'];config[_0xb819('0x19')]=_['defaults'](config[_0xb819('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb819('0x1a'))(new Redis(config[_0xb819('0x19')]));require(_0xb819('0x1b'))[_0xb819('0x1c')](socket);var jayson=require(_0xb819('0x1d'));var client=jayson[_0xb819('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb819('0x1e')][_0xb819('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2e50a3,_0x129c1f,_0x2bd379,_0x1b5014){return new BPromise(function(_0xdda3ed,_0x16f20b){var _0x174c70=_0x1b5014||client;return _0x174c70[_0xb819('0x20')](_0x2e50a3,_0x2bd379)[_0xb819('0x21')](function(_0x35068b){logger[_0xb819('0x22')](_0xb819('0x23'),_0x129c1f,_0xb819('0x24'));logger[_0xb819('0x25')](_0xb819('0x26'),_0x129c1f,_0xb819('0x24'),JSON['stringify'](_0x35068b));if(_0x35068b[_0xb819('0x27')]){if(_0x35068b[_0xb819('0x27')][_0xb819('0x28')]===0x1f4){logger[_0xb819('0x27')](_0xb819('0x23'),_0x129c1f,_0x35068b[_0xb819('0x27')][_0xb819('0x29')]);return _0x16f20b(_0x35068b[_0xb819('0x27')][_0xb819('0x29')]);}logger[_0xb819('0x27')](_0xb819('0x23'),_0x129c1f,_0x35068b[_0xb819('0x27')][_0xb819('0x29')]);return _0xdda3ed(_0x35068b[_0xb819('0x27')]['message']);}else{logger[_0xb819('0x22')](_0xb819('0x23'),_0x129c1f,_0xb819('0x24'));_0xdda3ed(_0x35068b[_0xb819('0x2a')][_0xb819('0x29')]);}})['catch'](function(_0x11eba2){logger['error'](_0xb819('0x23'),_0x129c1f,_0x11eba2);_0x16f20b(_0x11eba2);});});}function respondWithStatusCode(_0x4619ef,_0x335ca2){_0x335ca2=_0x335ca2||0xcc;return function(_0x1a8717){if(_0x1a8717){return _0x4619ef[_0xb819('0x2b')](_0x335ca2);}return _0x4619ef[_0xb819('0x2c')](_0x335ca2)['end']();};}function respondWithResult(_0x21e72d,_0x12b4c2){_0x12b4c2=_0x12b4c2||0xc8;return function(_0x2f92b7){if(_0x2f92b7){return _0x21e72d[_0xb819('0x2c')](_0x12b4c2)[_0xb819('0x2d')](_0x2f92b7);}};}function respondWithFilteredResult(_0x2cca8e,_0x2290a3){return function(_0x1e3ef4){if(_0x1e3ef4){var _0x1ee191=typeof _0x2290a3[_0xb819('0x2e')]===_0xb819('0x2f')&&typeof _0x2290a3[_0xb819('0x30')]==='undefined';var _0x21ba28=_0x1e3ef4[_0xb819('0x31')];var _0x291d08=_0x1ee191?0x0:_0x2290a3[_0xb819('0x2e')];var _0x266a55=_0x1ee191?_0x1e3ef4[_0xb819('0x31')]:_0x2290a3[_0xb819('0x2e')]+_0x2290a3[_0xb819('0x30')];var _0x137feb;if(_0x266a55>=_0x21ba28){_0x266a55=_0x21ba28;_0x137feb=0xc8;}else{_0x137feb=0xce;}_0x2cca8e[_0xb819('0x2c')](_0x137feb);return _0x2cca8e[_0xb819('0x32')](_0xb819('0x33'),_0x291d08+'-'+_0x266a55+'/'+_0x21ba28)[_0xb819('0x2d')](_0x1e3ef4);}return null;};}function patchUpdates(_0x5a163c){return function(_0xa19770){try{jsonpatch[_0xb819('0x34')](_0xa19770,_0x5a163c,!![]);}catch(_0x337a0b){return BPromise['reject'](_0x337a0b);}return _0xa19770['save']();};}function saveUpdates(_0x44ddc5,_0xb56522){return function(_0x1628d4){if(_0x1628d4){return _0x1628d4[_0xb819('0x35')](_0x44ddc5)[_0xb819('0x21')](function(_0x3952fe){return _0x3952fe;});}return null;};}function removeEntity(_0x5b2a97,_0x41dce3){return function(_0x1f1237){if(_0x1f1237){return _0x1f1237[_0xb819('0x36')]()[_0xb819('0x21')](function(){var _0x546f68=_0x1f1237[_0xb819('0x37')]({'plain':!![]});var _0x26082b=_0xb819('0x38');return db[_0xb819('0x39')][_0xb819('0x36')]({'where':{'type':_0x26082b,'resourceId':_0x546f68['id']}})[_0xb819('0x21')](function(){return _0x1f1237;});})[_0xb819('0x21')](function(){_0x5b2a97[_0xb819('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276b94,_0x21a0c8){return function(_0x156597){if(!_0x156597){_0x276b94[_0xb819('0x2b')](0x194);}return _0x156597;};}function handleError(_0x215cc6,_0x12ca6d){_0x12ca6d=_0x12ca6d||0x1f4;return function(_0x2bedb0){logger[_0xb819('0x27')](_0x2bedb0[_0xb819('0x3a')]);if(_0x2bedb0[_0xb819('0x3b')]){delete _0x2bedb0[_0xb819('0x3b')];}_0x215cc6[_0xb819('0x2c')](_0x12ca6d)[_0xb819('0x3c')](_0x2bedb0);};}exports[_0xb819('0x3d')]=function(_0x4a531d,_0x55e960){var _0x487311={'include':[{'model':db[_0xb819('0x3e')],'as':_0xb819('0x3f')}]},_0x20e5e8={},_0xb6e99d={'count':0x0,'rows':[]};var _0x1f5993=_[_0xb819('0x40')](db[_0xb819('0x41')]['rawAttributes'],function(_0x491ee2){return{'name':_0x491ee2[_0xb819('0x42')],'type':_0x491ee2[_0xb819('0x43')]['key']};});_0x20e5e8[_0xb819('0x44')]=_[_0xb819('0x40')](_0x1f5993,'name');_0x20e5e8[_0xb819('0x45')]=_[_0xb819('0x46')](_0x4a531d['query']);_0x20e5e8[_0xb819('0x47')]=_[_0xb819('0x48')](_0x20e5e8[_0xb819('0x44')],_0x20e5e8[_0xb819('0x45')]);_0x487311[_0xb819('0x49')]=_[_0xb819('0x48')](_0x20e5e8['model'],qs['fields'](_0x4a531d[_0xb819('0x45')][_0xb819('0x4a')]));_0x487311[_0xb819('0x49')]=_0x487311[_0xb819('0x49')]['length']?_0x487311[_0xb819('0x49')]:_0x20e5e8['model'];if(!_0x4a531d['query'][_0xb819('0x4b')]('nolimit')){_0x487311[_0xb819('0x30')]=qs[_0xb819('0x30')](_0x4a531d[_0xb819('0x45')]['limit']);_0x487311[_0xb819('0x2e')]=qs['offset'](_0x4a531d[_0xb819('0x45')][_0xb819('0x2e')]);}_0x487311[_0xb819('0x4c')]=qs[_0xb819('0x4d')](_0x4a531d['query'][_0xb819('0x4d')]);_0x487311[_0xb819('0x4e')]=qs[_0xb819('0x47')](_[_0xb819('0x4f')](_0x4a531d['query'],_0x20e5e8['filters']),_0x1f5993);if(_0x4a531d[_0xb819('0x45')][_0xb819('0x50')]){_0x487311[_0xb819('0x4e')]=_[_0xb819('0x51')](_0x487311[_0xb819('0x4e')],{'$or':_[_0xb819('0x40')](_0x1f5993,function(_0x5b153c){if(_0x5b153c[_0xb819('0x43')]!==_0xb819('0x52')){var _0x52d635={};_0x52d635[_0x5b153c[_0xb819('0x3b')]]={'$like':'%'+_0x4a531d['query'][_0xb819('0x50')]+'%'};return _0x52d635;}})});}_0x487311=_[_0xb819('0x51')]({},_0x487311,_0x4a531d['options']);var _0x3efceb={'where':_0x487311[_0xb819('0x4e')]};return db[_0xb819('0x41')][_0xb819('0x31')](_0x3efceb)[_0xb819('0x21')](function(_0x5aa66f){_0xb6e99d[_0xb819('0x31')]=_0x5aa66f;if(_0x4a531d['query'][_0xb819('0x53')]){_0x487311[_0xb819('0x54')]=[{'all':!![]}];}return db[_0xb819('0x41')][_0xb819('0x55')](_0x487311);})[_0xb819('0x21')](function(_0x23194d){_0xb6e99d[_0xb819('0x56')]=_0x23194d;return _0xb6e99d;})['then'](respondWithFilteredResult(_0x55e960,_0x487311))[_0xb819('0x57')](handleError(_0x55e960,null));};exports[_0xb819('0x58')]=function(_0x19255f,_0x38d59c){var _0xa929f0={'raw':![],'where':{'id':_0x19255f[_0xb819('0x59')]['id']},'include':[{'model':db[_0xb819('0x3e')],'as':'mandatoryDispositionPause'}]},_0x44da93={};_0x44da93[_0xb819('0x44')]=_[_0xb819('0x46')](db[_0xb819('0x41')][_0xb819('0x5a')]);_0x44da93[_0xb819('0x45')]=_[_0xb819('0x46')](_0x19255f[_0xb819('0x45')]);_0x44da93[_0xb819('0x47')]=_['intersection'](_0x44da93[_0xb819('0x44')],_0x44da93[_0xb819('0x45')]);_0xa929f0['attributes']=_['intersection'](_0x44da93[_0xb819('0x44')],qs[_0xb819('0x4a')](_0x19255f[_0xb819('0x45')][_0xb819('0x4a')]));_0xa929f0[_0xb819('0x49')]=_0xa929f0[_0xb819('0x49')][_0xb819('0x5b')]?_0xa929f0[_0xb819('0x49')]:_0x44da93[_0xb819('0x44')];if(_0x19255f[_0xb819('0x45')][_0xb819('0x53')]){_0xa929f0[_0xb819('0x54')]=[{'all':!![]}];}_0xa929f0=_[_0xb819('0x51')]({},_0xa929f0,_0x19255f[_0xb819('0x5c')]);return db[_0xb819('0x41')][_0xb819('0x5d')](_0xa929f0)[_0xb819('0x21')](handleEntityNotFound(_0x38d59c,null))[_0xb819('0x21')](respondWithResult(_0x38d59c,null))[_0xb819('0x57')](handleError(_0x38d59c,null));};exports[_0xb819('0x5e')]=function(_0x3f068e,_0x4b2fcc){return db[_0xb819('0x41')][_0xb819('0x5e')](_0x3f068e[_0xb819('0x5f')],{})[_0xb819('0x21')](function(_0x5e7cb5){var _0x331bd5=_0x3f068e[_0xb819('0x60')]['get']({'plain':!![]});if(!_0x331bd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x331bd5[_0xb819('0x61')]==='user'){var _0x579a74=_0x5e7cb5['get']({'plain':!![]});var _0x10c1bf=_0xb819('0x38');return db[_0xb819('0x62')][_0xb819('0x5d')]({'where':{'name':_0x10c1bf,'userProfileId':_0x331bd5[_0xb819('0x63')]},'raw':!![]})['then'](function(_0x9f19e3){if(_0x9f19e3&&_0x9f19e3[_0xb819('0x64')]===0x0){return db[_0xb819('0x39')][_0xb819('0x5e')]({'name':_0x579a74['name'],'resourceId':_0x579a74['id'],'type':_0x9f19e3[_0xb819('0x3b')],'sectionId':_0x9f19e3['id']},{})[_0xb819('0x21')](function(){return _0x5e7cb5;});}else{return _0x5e7cb5;}})[_0xb819('0x57')](function(_0x1e483d){logger[_0xb819('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e483d);throw _0x1e483d;});}return _0x5e7cb5;})[_0xb819('0x21')](respondWithResult(_0x4b2fcc,0xc9))['catch'](handleError(_0x4b2fcc,null));};exports['update']=function(_0x28d349,_0x324849){if(_0x28d349[_0xb819('0x5f')]['id']){delete _0x28d349[_0xb819('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x28d349['params']['id']},'include':[{'model':db[_0xb819('0x3e')],'as':_0xb819('0x3f')}]})[_0xb819('0x21')](handleEntityNotFound(_0x324849,null))[_0xb819('0x21')](saveUpdates(_0x28d349[_0xb819('0x5f')],null))[_0xb819('0x21')](respondWithResult(_0x324849,null))[_0xb819('0x57')](handleError(_0x324849,null));};exports[_0xb819('0x36')]=function(_0x20dfed,_0xf81dd8){return db[_0xb819('0x41')][_0xb819('0x5d')]({'where':{'id':_0x20dfed[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0xf81dd8,null))[_0xb819('0x21')](removeEntity(_0xf81dd8,null))[_0xb819('0x57')](handleError(_0xf81dd8,null));};exports[_0xb819('0x65')]=function(_0x2585da,_0x42f63f){return db[_0xb819('0x41')]['describe']()['then'](respondWithResult(_0x42f63f,null))[_0xb819('0x57')](handleError(_0x42f63f,null));};exports['addDisposition']=function(_0x529798,_0x54e0e0,_0x59acaa){if(_0x529798[_0xb819('0x5f')]['id']){delete _0x529798[_0xb819('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x529798[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x54e0e0,null))[_0xb819('0x21')](function(_0x416283){if(_0x416283){_0x529798['body'][_0xb819('0x66')]=_0x416283['id'];return db[_0xb819('0x67')]['create'](_0x529798[_0xb819('0x5f')]);}})['then'](respondWithResult(_0x54e0e0,null))[_0xb819('0x57')](handleError(_0x54e0e0,null));};exports[_0xb819('0x68')]=function(_0x3d2d16,_0x40cbb4,_0x500766){var _0x4c7a77={'raw':![],'where':{}};var _0x14c571={};var _0x508f02={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3d2d16[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x40cbb4,null))['then'](function(_0x3cd369){if(_0x3cd369){_0x14c571[_0xb819('0x44')]=_[_0xb819('0x46')](db['Disposition'][_0xb819('0x5a')]);_0x14c571[_0xb819('0x45')]=_['keys'](_0x3d2d16[_0xb819('0x45')]);_0x14c571[_0xb819('0x47')]=_['intersection'](_0x14c571['model'],_0x14c571[_0xb819('0x45')]);_0x4c7a77['attributes']=_[_0xb819('0x48')](_0x14c571['model'],qs[_0xb819('0x4a')](_0x3d2d16['query'][_0xb819('0x4a')]));_0x4c7a77[_0xb819('0x49')]=_0x4c7a77[_0xb819('0x49')][_0xb819('0x5b')]?_0x4c7a77[_0xb819('0x49')]:_0x14c571[_0xb819('0x44')];if(!_0x3d2d16[_0xb819('0x45')]['hasOwnProperty']('nolimit')){_0x4c7a77['limit']=qs[_0xb819('0x30')](_0x3d2d16[_0xb819('0x45')][_0xb819('0x30')]);_0x4c7a77[_0xb819('0x2e')]=qs[_0xb819('0x2e')](_0x3d2d16[_0xb819('0x45')][_0xb819('0x2e')]);}_0x4c7a77[_0xb819('0x4c')]=qs[_0xb819('0x4d')](_0x3d2d16['query'][_0xb819('0x4d')]);_0x4c7a77[_0xb819('0x4e')]=qs[_0xb819('0x47')](_[_0xb819('0x4f')](_0x3d2d16[_0xb819('0x45')],_0x14c571[_0xb819('0x47')]));_0x4c7a77['where'][_0xb819('0x66')]=_0x3cd369['id'];if(_0x3d2d16[_0xb819('0x45')][_0xb819('0x50')]){_0x4c7a77['where']=_[_0xb819('0x51')](_0x4c7a77[_0xb819('0x4e')],{'$or':_[_0xb819('0x40')](_0x4c7a77['attributes'],function(_0xa035f3){var _0x979382={};_0x979382[_0xa035f3]={'$like':'%'+_0x3d2d16[_0xb819('0x45')][_0xb819('0x50')]+'%'};return _0x979382;})});}_0x4c7a77=_[_0xb819('0x51')]({},_0x4c7a77,_0x3d2d16[_0xb819('0x5c')]);return db[_0xb819('0x67')][_0xb819('0x31')]({'where':_0x4c7a77[_0xb819('0x4e')]})[_0xb819('0x21')](function(_0x59d912){_0x508f02[_0xb819('0x31')]=_0x59d912;if(_0x3d2d16['query'][_0xb819('0x53')]){_0x4c7a77[_0xb819('0x54')]=[{'all':!![]}];}return db[_0xb819('0x67')][_0xb819('0x55')](_0x4c7a77);})['then'](function(_0x1b488d){_0x508f02[_0xb819('0x56')]=_0x1b488d;return _0x508f02;});}})[_0xb819('0x21')](respondWithFilteredResult(_0x40cbb4,_0x4c7a77))[_0xb819('0x57')](handleError(_0x40cbb4,null));};exports['removeDispositions']=function(_0x492463,_0x30f700,_0x52db99){return db[_0xb819('0x41')][_0xb819('0x5d')]({'where':{'id':_0x492463[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x30f700,null))[_0xb819('0x21')](function(_0x2dd402){if(_0x2dd402){return _0x2dd402[_0xb819('0x69')](_0x492463['query'][_0xb819('0x6a')]);}})[_0xb819('0x21')](respondWithStatusCode(_0x30f700,null))['catch'](handleError(_0x30f700,null));};exports[_0xb819('0x6b')]=function(_0x577053,_0x46a067,_0xc933e8){if(_0x577053['body']['id']){delete _0x577053[_0xb819('0x5f')]['id'];}return db['FaxAccount'][_0xb819('0x5d')]({'where':{'id':_0x577053[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x46a067,null))[_0xb819('0x21')](function(_0x1d9ef3){if(_0x1d9ef3){_0x577053[_0xb819('0x5f')][_0xb819('0x66')]=_0x1d9ef3['id'];return db[_0xb819('0x6c')][_0xb819('0x5e')](_0x577053[_0xb819('0x5f')]);}})['then'](respondWithResult(_0x46a067,null))[_0xb819('0x57')](handleError(_0x46a067,null));};exports[_0xb819('0x6d')]=function(_0x49b928,_0x2aacbf,_0x3042f0){var _0x2969f5={'raw':![],'where':{}};var _0x26df69={};var _0x45b388={'count':0x0,'rows':[]};return db[_0xb819('0x41')][_0xb819('0x6e')]({'where':{'id':_0x49b928[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x2aacbf,null))[_0xb819('0x21')](function(_0x4ea89){if(_0x4ea89){_0x26df69[_0xb819('0x44')]=_[_0xb819('0x46')](db[_0xb819('0x6c')][_0xb819('0x5a')]);_0x26df69[_0xb819('0x45')]=_[_0xb819('0x46')](_0x49b928[_0xb819('0x45')]);_0x26df69[_0xb819('0x47')]=_[_0xb819('0x48')](_0x26df69[_0xb819('0x44')],_0x26df69[_0xb819('0x45')]);_0x2969f5[_0xb819('0x49')]=_[_0xb819('0x48')](_0x26df69[_0xb819('0x44')],qs[_0xb819('0x4a')](_0x49b928['query'][_0xb819('0x4a')]));_0x2969f5['attributes']=_0x2969f5[_0xb819('0x49')][_0xb819('0x5b')]?_0x2969f5[_0xb819('0x49')]:_0x26df69['model'];if(!_0x49b928[_0xb819('0x45')][_0xb819('0x4b')](_0xb819('0x6f'))){_0x2969f5[_0xb819('0x30')]=qs[_0xb819('0x30')](_0x49b928[_0xb819('0x45')][_0xb819('0x30')]);_0x2969f5[_0xb819('0x2e')]=qs[_0xb819('0x2e')](_0x49b928[_0xb819('0x45')][_0xb819('0x2e')]);}_0x2969f5[_0xb819('0x4c')]=qs[_0xb819('0x4d')](_0x49b928[_0xb819('0x45')][_0xb819('0x4d')]);_0x2969f5[_0xb819('0x4e')]=qs[_0xb819('0x47')](_[_0xb819('0x4f')](_0x49b928[_0xb819('0x45')],_0x26df69[_0xb819('0x47')]));_0x2969f5[_0xb819('0x4e')][_0xb819('0x66')]=_0x4ea89['id'];if(_0x49b928[_0xb819('0x45')][_0xb819('0x50')]){_0x2969f5[_0xb819('0x4e')]=_[_0xb819('0x51')](_0x2969f5['where'],{'$or':_[_0xb819('0x40')](_0x2969f5['attributes'],function(_0x2859bc){var _0x215fb1={};_0x215fb1[_0x2859bc]={'$like':'%'+_0x49b928[_0xb819('0x45')]['filter']+'%'};return _0x215fb1;})});}_0x2969f5=_[_0xb819('0x51')]({},_0x2969f5,_0x49b928[_0xb819('0x5c')]);return db['CannedAnswer'][_0xb819('0x31')]({'where':_0x2969f5[_0xb819('0x4e')]})['then'](function(_0x71c969){_0x45b388[_0xb819('0x31')]=_0x71c969;if(_0x49b928[_0xb819('0x45')][_0xb819('0x53')]){_0x2969f5[_0xb819('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2969f5);})[_0xb819('0x21')](function(_0x18a913){_0x45b388['rows']=_0x18a913;return _0x45b388;});}})['then'](respondWithFilteredResult(_0x2aacbf,_0x2969f5))['catch'](handleError(_0x2aacbf,null));};exports['removeAnswers']=function(_0x55c943,_0x146d6c,_0x4ff290){return db['FaxAccount']['find']({'where':{'id':_0x55c943[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x146d6c,null))[_0xb819('0x21')](function(_0x529bde){if(_0x529bde){return _0x529bde[_0xb819('0x70')](_0x55c943[_0xb819('0x45')][_0xb819('0x6a')]);}})[_0xb819('0x21')](respondWithStatusCode(_0x146d6c,null))['catch'](handleError(_0x146d6c,null));};exports[_0xb819('0x71')]=function(_0x21f897,_0x4b40a0,_0x4e18b1){return db['FaxInteraction']['find']({'where':{'id':_0x21f897[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x4b40a0,null))[_0xb819('0x21')](function(_0x584859){if(_0x584859){return _0x584859['addInteraction'](_0x21f897[_0xb819('0x5f')][_0xb819('0x6a')],_[_0xb819('0x72')](_0x21f897[_0xb819('0x5f')],[_0xb819('0x6a'),'id'])||{});}})[_0xb819('0x21')](respondWithResult(_0x4b40a0,null))['catch'](handleError(_0x4b40a0,null));};exports[_0xb819('0x73')]=function(_0x3d3cdf,_0xbc1766,_0x3dac33){var _0x3f85ed={'raw':![],'where':{}};var _0x5a6412={};var _0x3f7651={'count':0x0,'rows':[]};return db[_0xb819('0x41')][_0xb819('0x6e')]({'where':{'id':_0x3d3cdf[_0xb819('0x59')]['id']}})['then'](handleEntityNotFound(_0xbc1766,null))[_0xb819('0x21')](function(_0x4ba517){if(_0x4ba517){_0x5a6412[_0xb819('0x44')]=_[_0xb819('0x46')](db[_0xb819('0x74')][_0xb819('0x5a')]);_0x5a6412[_0xb819('0x45')]=_['keys'](_0x3d3cdf['query']);_0x5a6412[_0xb819('0x47')]=_[_0xb819('0x48')](_0x5a6412[_0xb819('0x44')],_0x5a6412['query']);_0x3f85ed[_0xb819('0x49')]=_[_0xb819('0x48')](_0x5a6412[_0xb819('0x44')],qs[_0xb819('0x4a')](_0x3d3cdf['query'][_0xb819('0x4a')]));_0x3f85ed[_0xb819('0x49')]=_0x3f85ed[_0xb819('0x49')][_0xb819('0x5b')]?_0x3f85ed[_0xb819('0x49')]:_0x5a6412[_0xb819('0x44')];if(!_0x3d3cdf[_0xb819('0x45')][_0xb819('0x4b')]('nolimit')){_0x3f85ed[_0xb819('0x30')]=qs[_0xb819('0x30')](_0x3d3cdf[_0xb819('0x45')][_0xb819('0x30')]);_0x3f85ed[_0xb819('0x2e')]=qs['offset'](_0x3d3cdf['query'][_0xb819('0x2e')]);}_0x3f85ed[_0xb819('0x4c')]=qs[_0xb819('0x4d')](_0x3d3cdf[_0xb819('0x45')][_0xb819('0x4d')]);_0x3f85ed['where']=qs[_0xb819('0x47')](_[_0xb819('0x4f')](_0x3d3cdf[_0xb819('0x45')],_0x5a6412['filters']));_0x3f85ed['where'][_0xb819('0x66')]=_0x4ba517['id'];if(_0x3d3cdf[_0xb819('0x45')]['filter']){_0x3f85ed[_0xb819('0x4e')]=_[_0xb819('0x51')](_0x3f85ed['where'],{'$or':_['map'](_0x3f85ed['attributes'],function(_0x163dc3){var _0x22d629={};_0x22d629[_0x163dc3]={'$like':'%'+_0x3d3cdf[_0xb819('0x45')][_0xb819('0x50')]+'%'};return _0x22d629;})});}_0x3f85ed=_[_0xb819('0x51')]({},_0x3f85ed,_0x3d3cdf['options']);return db[_0xb819('0x74')][_0xb819('0x31')]({'where':_0x3f85ed['where']})[_0xb819('0x21')](function(_0x27fa2d){_0x3f7651['count']=_0x27fa2d;if(_0x3d3cdf[_0xb819('0x45')][_0xb819('0x53')]){_0x3f85ed[_0xb819('0x54')]=[{'model':db[_0xb819('0x75')],'as':_0xb819('0x76'),'required':![]},{'model':db[_0xb819('0x77')],'as':_0xb819('0x78'),'attributes':['name','fullname',_0xb819('0x79')],'required':![]},{'model':db[_0xb819('0x7a')],'as':_0xb819('0x7b'),'attributes':['id',_0xb819('0x3b'),'color'],'where':_0x3d3cdf['query']['tag']?{'id':_0x3d3cdf['query'][_0xb819('0x7c')]}:undefined,'required':_0x3d3cdf[_0xb819('0x45')][_0xb819('0x7c')]?!![]:![]}];}return db[_0xb819('0x74')]['findAll'](_0x3f85ed);})['then'](function(_0x3de496){_0x3f7651[_0xb819('0x56')]=_0x3de496;return _0x3f7651;});}})['then'](respondWithFilteredResult(_0xbc1766,_0x3f85ed))['catch'](handleError(_0xbc1766,null));};exports[_0xb819('0x7d')]=function(_0x20bee9,_0x49549b){var _0x3793c1=_0x20bee9['params']['id'];var _0x2eb592=_0x20bee9[_0xb819('0x5f')];var _0x5a8f54=0xc8;var _0x485c6b=null;return db[_0xb819('0x7e')][_0xb819('0x7f')]({'isolationLevel':db['sequelize'][_0xb819('0x80')][_0xb819('0x81')][_0xb819('0x82')]},function(_0x20c3c1){return db[_0xb819('0x41')][_0xb819('0x6e')]({'where':{'id':_0x3793c1},'transaction':_0x20c3c1})[_0xb819('0x21')](function(_0x9e72b6){if(_0x9e72b6){return db[_0xb819('0x83')]['destroy']({'where':{'FaxAccountId':_0x3793c1},'transaction':_0x20c3c1})[_0xb819('0x21')](function(){var _0x4e8df6=_[_0xb819('0x40')](_0x2eb592,function(_0x3bddfd){_0x3bddfd[_0xb819('0x66')]=_0x3793c1;return _0x3bddfd;});return db[_0xb819('0x83')][_0xb819('0x84')](_0x4e8df6,{'transaction':_0x20c3c1});});}else{_0x5a8f54=0x194;_0x485c6b=[];}});})['then'](function(){if(_0x5a8f54!==0x194){return db[_0xb819('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x3793c1},'order':_0xb819('0x85')})[_0xb819('0x21')](function(_0x100695){_0x485c6b=_0x100695;});}})['catch'](function(_0x4ae994){_0x5a8f54=0x1f4;logger[_0xb819('0x27')](_0x4ae994[_0xb819('0x3a')]);if(_0x4ae994['name']){delete _0x4ae994[_0xb819('0x3b')];}_0x485c6b=_0x4ae994;})[_0xb819('0x86')](function(){if(_0x485c6b===null){_0x49549b[_0xb819('0x2b')](_0x5a8f54);}else{if(_0x5a8f54===0x1f4){_0x49549b[_0xb819('0x2c')](_0x5a8f54)[_0xb819('0x3c')](_0x485c6b);}else{_0x49549b[_0xb819('0x2c')](_0x5a8f54)['json'](_0x485c6b);}}});};exports[_0xb819('0x87')]=function(_0x39f814,_0xf26475,_0x519617){var _0x365c77={};var _0x12b692={};var _0x33ebbb;var _0x17f748;return db[_0xb819('0x41')][_0xb819('0x6e')]({'where':{'id':_0x39f814[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0xf26475,null))[_0xb819('0x21')](function(_0x539ac2){if(_0x539ac2){_0x33ebbb=_0x539ac2;_0x12b692[_0xb819('0x44')]=_['keys'](db[_0xb819('0x83')][_0xb819('0x5a')]);_0x12b692[_0xb819('0x45')]=_[_0xb819('0x46')](_0x39f814['query']);_0x12b692[_0xb819('0x47')]=_['intersection'](_0x12b692[_0xb819('0x44')],_0x12b692['query']);_0x365c77[_0xb819('0x49')]=_['intersection'](_0x12b692[_0xb819('0x44')],qs['fields'](_0x39f814[_0xb819('0x45')][_0xb819('0x4a')]));_0x365c77['attributes']=_0x365c77[_0xb819('0x49')][_0xb819('0x5b')]?_0x365c77[_0xb819('0x49')]:_0x12b692[_0xb819('0x44')];_0x365c77['order']=qs['sort'](_0x39f814[_0xb819('0x45')]['sort']);_0x365c77[_0xb819('0x4e')]=qs[_0xb819('0x47')](_[_0xb819('0x4f')](_0x39f814['query'],_0x12b692[_0xb819('0x47')]));if(_0x39f814[_0xb819('0x45')][_0xb819('0x50')]){_0x365c77['where']=_[_0xb819('0x51')](_0x365c77[_0xb819('0x4e')],{'$or':_[_0xb819('0x40')](_0x365c77[_0xb819('0x49')],function(_0x1a42f5){var _0x28c815={};_0x28c815[_0x1a42f5]={'$like':'%'+_0x39f814[_0xb819('0x45')][_0xb819('0x50')]+'%'};return _0x28c815;})});}_0x365c77=_[_0xb819('0x51')]({},_0x365c77,_0x39f814[_0xb819('0x5c')]);return _0x33ebbb[_0xb819('0x87')](_0x365c77);}})[_0xb819('0x21')](function(_0x5f2acd){if(_0x5f2acd){_0x17f748=_0x5f2acd[_0xb819('0x5b')];if(!_0x39f814[_0xb819('0x45')][_0xb819('0x4b')](_0xb819('0x6f'))){_0x365c77['limit']=qs[_0xb819('0x30')](_0x39f814[_0xb819('0x45')][_0xb819('0x30')]);_0x365c77[_0xb819('0x2e')]=qs[_0xb819('0x2e')](_0x39f814[_0xb819('0x45')]['offset']);}return _0x33ebbb['getApplications'](_0x365c77);}})[_0xb819('0x21')](function(_0x216680){if(_0x216680){return _0x216680?{'count':_0x17f748,'rows':_0x216680}:null;}})['then'](respondWithResult(_0xf26475,null))[_0xb819('0x57')](handleError(_0xf26475,null));};function Extension(_0x3d61ba,_0x13b116,_0x175d47,_0x1d3be0){this[_0xb819('0x88')]=_0xb819('0x89');this['exten']=_0x3d61ba[_0xb819('0x8a')];this[_0xb819('0x8b')]=_0x1d3be0;this[_0xb819('0x43')]=_0xb819('0x8c');this[_0xb819('0x8d')]='Fax\x20Extension';this[_0xb819('0x66')]=_0x3d61ba['id'];this['priority']=_0x13b116;this['appdata']=_0x175d47;}function createExtensionsReciveFax(_0xeca72){var _0x585584=0x1;var _0x3fc244=[];_0x3fc244[_0xb819('0x8e')](new Extension(_0xeca72,_0x585584,'',_0xb819('0x8f')));_0x585584+=0x1;_0x3fc244[_0xb819('0x8e')](new Extension(_0xeca72,_0x585584,_0xb819('0x90'),_0xb819('0x91')));_0x585584+=0x1;for(var _0x2ef136 in _0xeca72){if(_0xeca72['hasOwnProperty'](_0x2ef136)&&(_0x2ef136==='ecm'||_0x2ef136===_0xb819('0x8a')||_0x2ef136===_0xb819('0x92')||_0x2ef136===_0xb819('0x93')||_0x2ef136===_0xb819('0x94')||_0x2ef136===_0xb819('0x95')||_0x2ef136===_0xb819('0x96')||_0x2ef136==='modem'||_0x2ef136==='t38timeout')){_0x3fc244[_0xb819('0x8e')](new Extension(_0xeca72,_0x585584,_0xb819('0x97')+_0x2ef136+')='+_0xeca72[_0x2ef136],'Set'));_0x585584+=0x1;}}_0x3fc244[_0xb819('0x8e')](new Extension(_0xeca72,_0x585584,'6',_0xb819('0x98')));_0x585584+=0x1;_0x3fc244[_0xb819('0x8e')](new Extension(_0xeca72,_0x585584,_0xb819('0x99'),_0xb819('0x9a')));_0x585584=0x0;return _0x3fc244;}exports[_0xb819('0x9b')]=function(_0x366d05,_0x4a7080,_0x4db5a3){var _0x3e5f67;return db[_0xb819('0x7e')][_0xb819('0x7f')](function(_0x13e912){return db[_0xb819('0x41')][_0xb819('0x5e')](_0x366d05['body'],{'transaction':_0x13e912})[_0xb819('0x21')](function(_0x36444d){_0x3e5f67=_0x36444d[_0xb819('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xb819('0x84')](createExtensionsReciveFax(_0x3e5f67),{'transaction':_0x13e912});});})['then'](function(){return _0x3e5f67;})[_0xb819('0x21')](respondWithResult(_0x4a7080,null))[_0xb819('0x57')](handleError(_0x4a7080,null));};exports['updateAccountApplications']=function(_0x3a66bd,_0x10f3cf,_0x5b5062){var _0x47efa9;return db[_0xb819('0x7e')][_0xb819('0x7f')](function(_0x378bd0){return db[_0xb819('0x41')]['update'](_0x3a66bd[_0xb819('0x5f')],{'where':{'id':_0x3a66bd['body']['id']},'transaction':_0x378bd0})[_0xb819('0x21')](function(_0x54b6f7){return db[_0xb819('0x9c')][_0xb819('0x36')]({'where':{'FaxAccountId':_0x3a66bd[_0xb819('0x5f')]['id']},'transaction':_0x378bd0})[_0xb819('0x21')](function(_0x117ba3){return db[_0xb819('0x9c')][_0xb819('0x84')](createExtensionsReciveFax(_[_0xb819('0x72')](_0x3a66bd[_0xb819('0x5f')],[_0xb819('0x9d'),'key',_0xb819('0x9e'),_0xb819('0x9f'),_0xb819('0xa0'),_0xb819('0xa1')])),{'transaction':_0x378bd0});});});})[_0xb819('0x21')](function(){return db[_0xb819('0x41')][_0xb819('0xa2')](_0x3a66bd[_0xb819('0x5f')]['id']);})[_0xb819('0x21')](respondWithResult(_0x10f3cf,null))['catch'](handleError(_0x10f3cf,null));};exports[_0xb819('0xa3')]=function(_0x56f4eb,_0x3da505,_0x3a2e0c){var _0x431099={'raw':!![],'where':{}};var _0x3ae7a2={};var _0x290698={'count':0x0,'rows':[]};return db[_0xb819('0x41')]['findOne']({'where':{'id':_0x56f4eb[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x3da505,null))[_0xb819('0x21')](function(_0x5de27e){if(_0x5de27e){_0x3ae7a2['model']=_['keys'](db[_0xb819('0xa4')][_0xb819('0x5a')]);_0x3ae7a2['query']=_[_0xb819('0x46')](_0x56f4eb[_0xb819('0x45')]);_0x3ae7a2[_0xb819('0x47')]=_[_0xb819('0x48')](_0x3ae7a2[_0xb819('0x44')],_0x3ae7a2[_0xb819('0x45')]);_0x431099[_0xb819('0x49')]=_[_0xb819('0x48')](_0x3ae7a2[_0xb819('0x44')],qs['fields'](_0x56f4eb['query'][_0xb819('0x4a')]));_0x431099['attributes']=_0x431099['attributes'][_0xb819('0x5b')]?_0x431099['attributes']:_0x3ae7a2['model'];if(!_0x56f4eb['query'][_0xb819('0x4b')](_0xb819('0x6f'))){_0x431099[_0xb819('0x30')]=qs['limit'](_0x56f4eb[_0xb819('0x45')][_0xb819('0x30')]);_0x431099[_0xb819('0x2e')]=qs[_0xb819('0x2e')](_0x56f4eb[_0xb819('0x45')][_0xb819('0x2e')]);}_0x431099['order']=qs[_0xb819('0x4d')](_0x56f4eb[_0xb819('0x45')][_0xb819('0x4d')]);_0x431099[_0xb819('0x4e')]=qs['filters'](_[_0xb819('0x4f')](_0x56f4eb[_0xb819('0x45')],_0x3ae7a2[_0xb819('0x47')]));_0x431099['where']['FaxAccountId']=_0x5de27e['id'];if(_0x56f4eb[_0xb819('0x45')][_0xb819('0x50')]){_0x431099['where']=_['merge'](_0x431099[_0xb819('0x4e')],{'$or':_[_0xb819('0x40')](_0x431099['attributes'],function(_0x56b3bf){var _0x147064={};_0x147064[_0x56b3bf]={'$like':'%'+_0x56f4eb[_0xb819('0x45')]['filter']+'%'};return _0x147064;})});}if(_0x56f4eb[_0xb819('0x45')][_0xb819('0xa5')]){var _0x201cab=_0x56f4eb[_0xb819('0x45')][_0xb819('0xa5')]['split'](',');var _0x25fd59={};_0x25fd59[_0x201cab[0x0]]={'$gte':moment(_0x201cab[0x1])[_0xb819('0xa6')](_0xb819('0xa7'))};_0x431099[_0xb819('0x4e')]=_[_0xb819('0x51')](_0x431099[_0xb819('0x4e')],_0x25fd59);}_0x431099=_[_0xb819('0x51')]({},_0x431099,_0x56f4eb['options']);return db[_0xb819('0xa4')][_0xb819('0x31')]({'where':_0x431099['where']})[_0xb819('0x21')](function(_0x4fbf2f){_0x290698['count']=_0x4fbf2f;if(_0x56f4eb[_0xb819('0x45')][_0xb819('0x53')]){_0x431099[_0xb819('0x54')]=[{'all':!![]}];}return db[_0xb819('0xa4')][_0xb819('0x55')](_0x431099);})[_0xb819('0x21')](function(_0x51139d){_0x290698['rows']=_0x51139d;return _0x290698;});}})['then'](respondWithFilteredResult(_0x3da505,_0x431099))[_0xb819('0x57')](handleError(_0x3da505,null));};exports[_0xb819('0x3c')]=function(_0x588647,_0x160230,_0x502960){var _0x36a582,_0x15bbfe={},_0x416b04;if(_0x588647[_0xb819('0x5f')]['to']){_0x416b04=_0x588647[_0xb819('0x5f')]['to'][0x0];}return db[_0xb819('0x41')][_0xb819('0x5d')]({'where':{'id':_0x588647[_0xb819('0x59')]['id']},'include':[{'model':db[_0xb819('0xa8')],'as':_0xb819('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x416b04},'limit':0x1,'order':[[_0xb819('0x9f'),_0xb819('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x160230,null))[_0xb819('0x21')](function(_0x16dbb4){_0x36a582=_0x16dbb4;if(_0x588647[_0xb819('0x5f')][_0xb819('0xab')]&&_0x588647[_0xb819('0x5f')][_0xb819('0xab')][_0xb819('0x5b')]){for(var _0x1772b1=0x0;_0x1772b1<_0x588647[_0xb819('0x5f')]['attachments'][_0xb819('0x5b')];_0x1772b1+=0x1){_0x588647['body'][_0xb819('0xab')][_0x1772b1]={'filename':_0x588647[_0xb819('0x5f')]['attachments'][_0x1772b1][_0xb819('0x3b')],'id':_0x588647[_0xb819('0x5f')][_0xb819('0xab')][_0x1772b1]['id'],'path':path[_0xb819('0xac')](config[_0xb819('0xad')],'server/files/attachments',_0x588647[_0xb819('0x5f')]['attachments'][_0x1772b1][_0xb819('0xae')])};}}return respondWithRpcPromise(_0xb819('0xaf'),_0xb819('0xaf'),{'FaxAccountId':_[_0xb819('0xb0')](_0x588647[_0xb819('0x59')]['id'])?undefined:_0x588647['params']['id'],'path':_[_0xb819('0xb0')](_0x588647[_0xb819('0x5f')][_0xb819('0xab')][0x0][_0xb819('0x7')])?undefined:_0x588647[_0xb819('0x5f')][_0xb819('0xab')][0x0]['path'],'fax':_[_0xb819('0xb0')](_0x588647['body']['to'][0x0])?undefined:_0x588647['body']['to'][0x0]},client9002);})['then'](function(){if(_0x36a582){if(_[_0xb819('0xb0')](_0x588647[_0xb819('0x5f')]['from'])){_0x588647[_0xb819('0x5f')][_0xb819('0xb1')]=util['format'](_0xb819('0xb2'),_0x36a582['name'],_0x36a582[_0xb819('0xb3')]);}if(_0x36a582['List']){if(_0x36a582['List'][_0xb819('0xb4')]['length']){return _0x36a582[_0xb819('0xa9')][_0xb819('0xb4')][0x0];}else{return db[_0xb819('0x75')][_0xb819('0x5e')](_[_0xb819('0xb5')](_0x588647[_0xb819('0x5f')],{'firstName':_0x588647[_0xb819('0x5f')]['to'][0x0],'phone':_0x588647[_0xb819('0x5f')]['to'][0x0],'fax':_0x588647[_0xb819('0x5f')]['to'][0x0],'ListId':_0x36a582[_0xb819('0xa1')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb819('0x21')](function(_0x1a2f55){if(_0x1a2f55){return db[_0xb819('0x74')][_0xb819('0x5d')]({'where':{'ContactId':_0x1a2f55['id'],'closed':![],'FaxAccountId':_0x36a582['id']}})[_0xb819('0x21')](function(_0x727c7f){if(_0x727c7f){return[_0x727c7f,![]];}return db[_0xb819('0x74')]['create']({'UserId':_0x588647['user']['id'],'ContactId':_0x1a2f55['id'],'FaxAccountId':_0x36a582['id'],'fax':_0x588647['body']['to'][0x0],'firstMsgDirection':_0xb819('0xb6'),'Messages':[_[_0xb819('0x51')](_0x588647[_0xb819('0x5f')],{'read':![],'body':_0x588647[_0xb819('0x5f')][_0xb819('0xab')][0x0][_0xb819('0xb7')],'FaxAccountId':_0x36a582['id'],'UserId':_0x588647[_0xb819('0x60')]['id'],'ContactId':_0x1a2f55['id'],'AttachmentId':_0x588647['body'][_0xb819('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xb819('0xa4')],'as':'Messages'}]})[_0xb819('0x21')](function(_0x156145){return[_0x156145,!![]];});});}else{throw new Error(_0xb819('0xb8'));}})[_0xb819('0xb9')](function(_0x2fa2e0,_0x15e4b3){if(_0x15e4b3){return _0x2fa2e0;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x588647['body'][_0xb819('0xab')][0x0]['filename'],'FaxAccountId':_0x36a582['id'],'FaxInteractionId':_0x2fa2e0['id'],'UserId':_0x588647[_0xb819('0x60')]['id'],'ContactId':_0x2fa2e0[_0xb819('0xba')],'AttachmentId':_0x588647[_0xb819('0x5f')][_0xb819('0xab')][0x0]['id']})[_0xb819('0x21')](function(_0x330014){_0x2fa2e0[_0xb819('0xbb')][_0xb819('0xbc')]=[];_0x2fa2e0[_0xb819('0xbb')]['Messages'][_0xb819('0x8e')](_0x330014[_0xb819('0xbb')]);return _0x2fa2e0;});})[_0xb819('0x21')](function(_0x55513a){respondWithRpcPromise('SendFax',_0xb819('0xbd'),{'FaxAccountId':_[_0xb819('0xb0')](_0x588647[_0xb819('0x59')]['id'])?undefined:_0x588647['params']['id'],'path':_['isNil'](_0x588647['body'][_0xb819('0xab')][0x0]['path'])?undefined:_0x588647[_0xb819('0x5f')][_0xb819('0xab')][0x0][_0xb819('0x7')],'fax':_[_0xb819('0xb0')](_0x588647[_0xb819('0x5f')]['to'][0x0])?undefined:_0x588647['body']['to'][0x0],'AttachmentId':_0x588647['body'][_0xb819('0xab')][0x0]['id']},client9002)['then'](function(_0x2209be){logger[_0xb819('0x22')]('SendFaxRpc,\x20%s',_0x2209be);})[_0xb819('0x57')](function(_0x184220){logger[_0xb819('0x22')](_0xb819('0xbe'),_0x184220);});return _0x55513a;})['then'](respondWithResult(_0x160230,null))[_0xb819('0x57')](handleError(_0x160230,null));};exports[_0xb819('0xbf')]=function(_0x1b709f,_0x64c4f8,_0x36cc96){return db[_0xb819('0x41')][_0xb819('0x5d')]({'where':{'id':_0x1b709f[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x64c4f8,null))[_0xb819('0x21')](function(_0x110993){if(_0x110993){return _0x110993[_0xb819('0xbf')](_0x1b709f['body'][_0xb819('0x6a')],_[_0xb819('0x72')](_0x1b709f[_0xb819('0x5f')],['ids','id'])||{})[_0xb819('0xb9')](function(_0x5be859){for(var _0x583042=0x0;_0x583042<_0x1b709f[_0xb819('0x5f')][_0xb819('0x6a')][_0xb819('0x5b')];_0x583042+=0x1){socket['emit'](_0xb819('0xc0'),{'UserId':Number(_0x1b709f['body'][_0xb819('0x6a')][_0x583042]),'FaxAccountId':Number(_0x1b709f[_0xb819('0x59')]['id'])});}return _0x5be859;});}})[_0xb819('0x21')](respondWithResult(_0x64c4f8,null))[_0xb819('0x57')](handleError(_0x64c4f8,null));};exports['removeAgents']=function(_0x5ca03f,_0x3cfbc7,_0x58fd34){return db[_0xb819('0x41')][_0xb819('0x5d')]({'where':{'id':_0x5ca03f[_0xb819('0x59')]['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x3cfbc7,null))['then'](function(_0x5653c8){if(_0x5653c8){return _0x5653c8['removeAgents'](_0x5ca03f[_0xb819('0x45')][_0xb819('0x6a')])[_0xb819('0x21')](function(){if(_[_0xb819('0xc1')](_0x5ca03f['query'][_0xb819('0x6a')])){for(var _0x56d9dc=0x0;_0x56d9dc<_0x5ca03f[_0xb819('0x45')][_0xb819('0x6a')][_0xb819('0x5b')];_0x56d9dc+=0x1){socket[_0xb819('0xc2')](_0xb819('0xc3'),{'UserId':Number(_0x5ca03f[_0xb819('0x45')][_0xb819('0x6a')][_0x56d9dc]),'FaxAccountId':Number(_0x5ca03f['params']['id'])});}}else{socket[_0xb819('0xc2')](_0xb819('0xc3'),{'UserId':Number(_0x5ca03f['query'][_0xb819('0x6a')]),'FaxAccountId':Number(_0x5ca03f[_0xb819('0x59')]['id'])});}});}})[_0xb819('0x21')](respondWithStatusCode(_0x3cfbc7,null))['catch'](handleError(_0x3cfbc7,null));};exports[_0xb819('0xc4')]=function(_0x263c11,_0x343856,_0xf90fd6){var _0x3dbcef={};var _0x2227ab={};var _0x5a4999;var _0xfeea24;return db['FaxAccount'][_0xb819('0x6e')]({'where':{'id':_0x263c11['params']['id']}})[_0xb819('0x21')](handleEntityNotFound(_0x343856,null))[_0xb819('0x21')](function(_0x59cb80){if(_0x59cb80){_0x5a4999=_0x59cb80;_0x2227ab[_0xb819('0x44')]=_['keys'](db[_0xb819('0x77')][_0xb819('0x5a')]);_0x2227ab[_0xb819('0x45')]=_[_0xb819('0x46')](_0x263c11[_0xb819('0x45')]);_0x2227ab[_0xb819('0x47')]=_[_0xb819('0x48')](_0x2227ab[_0xb819('0x44')],_0x2227ab[_0xb819('0x45')]);_0x3dbcef[_0xb819('0x49')]=_[_0xb819('0x48')](_0x2227ab['model'],qs[_0xb819('0x4a')](_0x263c11[_0xb819('0x45')]['fields']));_0x3dbcef[_0xb819('0x49')]=_0x3dbcef[_0xb819('0x49')][_0xb819('0x5b')]?_0x3dbcef[_0xb819('0x49')]:_0x2227ab['model'];_0x3dbcef[_0xb819('0x4c')]=qs['sort'](_0x263c11[_0xb819('0x45')]['sort']);_0x3dbcef[_0xb819('0x4e')]=qs[_0xb819('0x47')](_['pick'](_0x263c11[_0xb819('0x45')],_0x2227ab['filters']));if(_0x263c11[_0xb819('0x45')][_0xb819('0x50')]){_0x3dbcef['where']=_['merge'](_0x3dbcef['where'],{'$or':_[_0xb819('0x40')](_0x3dbcef[_0xb819('0x49')],function(_0x138d6e){var _0x5ae62a={};_0x5ae62a[_0x138d6e]={'$like':'%'+_0x263c11[_0xb819('0x45')][_0xb819('0x50')]+'%'};return _0x5ae62a;})});}_0x3dbcef=_['merge']({},_0x3dbcef,_0x263c11[_0xb819('0x5c')]);return _0x5a4999[_0xb819('0xc4')](_0x3dbcef);}})['then'](function(_0x18275b){if(_0x18275b){_0xfeea24=_0x18275b['length'];if(!_0x263c11[_0xb819('0x45')][_0xb819('0x4b')]('nolimit')){_0x3dbcef[_0xb819('0x30')]=qs[_0xb819('0x30')](_0x263c11[_0xb819('0x45')][_0xb819('0x30')]);_0x3dbcef[_0xb819('0x2e')]=qs[_0xb819('0x2e')](_0x263c11['query']['offset']);}return _0x5a4999['getAgents'](_0x3dbcef);}})['then'](function(_0x14454c){if(_0x14454c){return _0x14454c?{'count':_0xfeea24,'rows':_0x14454c}:null;}})[_0xb819('0x21')](respondWithResult(_0x343856,null))[_0xb819('0x57')](handleError(_0x343856,null));}; \ No newline at end of file +var _0xfc77=['getAnswers','FaxAccountId','removeAnswers','ids','addInteraction','getInteractions','FaxInteraction','CmContact','User','fullname','Tags','tag','addApplications','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','stack','finally','send','getApplications','context','from-voip-provider','localstationid','app','system','description','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','headerinfo','maxrate','minrate','FAXOPT(','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','Send\x20Fax\x20failed','out','filename','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','FaxAccounts','UserProfileResource','end','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','findAll','rows','show','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','filter','include','CannedAnswer'];(function(_0x5d7858,_0x5b16cb){var _0x196892=function(_0xde56eb){while(--_0xde56eb){_0x5d7858['push'](_0x5d7858['shift']());}};_0x196892(++_0x5b16cb);}(_0xfc77,0x1d2));var _0x7fc7=function(_0x39439f,_0x5de32c){_0x39439f=_0x39439f-0x0;var _0x5bb4d7=_0xfc77[_0x39439f];return _0x5bb4d7;};'use strict';var emlformat=require(_0x7fc7('0x0'));var rimraf=require(_0x7fc7('0x1'));var zipdir=require(_0x7fc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7fc7('0x3'));var BPromise=require(_0x7fc7('0x4'));var Mustache=require(_0x7fc7('0x5'));var util=require(_0x7fc7('0x6'));var path=require(_0x7fc7('0x7'));var sox=require('sox');var csv=require(_0x7fc7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fc7('0x9'));var _=require(_0x7fc7('0xa'));var squel=require('squel');var crypto=require(_0x7fc7('0xb'));var jsforce=require(_0x7fc7('0xc'));var deskjs=require(_0x7fc7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7fc7('0xe'));var Papa=require(_0x7fc7('0xf'));var Redis=require('ioredis');var authService=require(_0x7fc7('0x10'));var qs=require(_0x7fc7('0x11'));var as=require(_0x7fc7('0x12'));var hardwareService=require(_0x7fc7('0x13'));var logger=require(_0x7fc7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fc7('0x15'));var licenseUtil=require(_0x7fc7('0x16'));var db=require(_0x7fc7('0x17'))['db'];config[_0x7fc7('0x18')]=_['defaults'](config[_0x7fc7('0x18')],{'host':_0x7fc7('0x19'),'port':0x18eb});var socket=require(_0x7fc7('0x1a'))(new Redis(config[_0x7fc7('0x18')]));require('./faxAccount.socket')[_0x7fc7('0x1b')](socket);var jayson=require(_0x7fc7('0x1c'));var client=jayson[_0x7fc7('0x1d')][_0x7fc7('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7fc7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x541843,_0x2c88ef,_0x34bace,_0x4fba5b){return new BPromise(function(_0x1cd76e,_0x374992){var _0x5492e9=_0x4fba5b||client;return _0x5492e9['request'](_0x541843,_0x34bace)[_0x7fc7('0x1f')](function(_0x5b4eaa){logger[_0x7fc7('0x20')](_0x7fc7('0x21'),_0x2c88ef,_0x7fc7('0x22'));logger[_0x7fc7('0x23')](_0x7fc7('0x24'),_0x2c88ef,_0x7fc7('0x22'),JSON[_0x7fc7('0x25')](_0x5b4eaa));if(_0x5b4eaa[_0x7fc7('0x26')]){if(_0x5b4eaa[_0x7fc7('0x26')][_0x7fc7('0x27')]===0x1f4){logger[_0x7fc7('0x26')](_0x7fc7('0x21'),_0x2c88ef,_0x5b4eaa[_0x7fc7('0x26')][_0x7fc7('0x28')]);return _0x374992(_0x5b4eaa[_0x7fc7('0x26')]['message']);}logger['error'](_0x7fc7('0x21'),_0x2c88ef,_0x5b4eaa[_0x7fc7('0x26')][_0x7fc7('0x28')]);return _0x1cd76e(_0x5b4eaa[_0x7fc7('0x26')][_0x7fc7('0x28')]);}else{logger[_0x7fc7('0x20')](_0x7fc7('0x21'),_0x2c88ef,_0x7fc7('0x22'));_0x1cd76e(_0x5b4eaa[_0x7fc7('0x29')][_0x7fc7('0x28')]);}})[_0x7fc7('0x2a')](function(_0x383b19){logger[_0x7fc7('0x26')](_0x7fc7('0x21'),_0x2c88ef,_0x383b19);_0x374992(_0x383b19);});});}function respondWithStatusCode(_0x51acff,_0x4740bf){_0x4740bf=_0x4740bf||0xcc;return function(_0x40ad88){if(_0x40ad88){return _0x51acff[_0x7fc7('0x2b')](_0x4740bf);}return _0x51acff[_0x7fc7('0x2c')](_0x4740bf)['end']();};}function respondWithResult(_0x1a7988,_0x599afc){_0x599afc=_0x599afc||0xc8;return function(_0x591920){if(_0x591920){return _0x1a7988['status'](_0x599afc)[_0x7fc7('0x2d')](_0x591920);}};}function respondWithFilteredResult(_0x478413,_0x12561d){return function(_0x13db2a){if(_0x13db2a){var _0x263f57=typeof _0x12561d['offset']===_0x7fc7('0x2e')&&typeof _0x12561d[_0x7fc7('0x2f')]===_0x7fc7('0x2e');var _0x4d5f9a=_0x13db2a[_0x7fc7('0x30')];var _0x330ec6=_0x263f57?0x0:_0x12561d['offset'];var _0x3a8555=_0x263f57?_0x13db2a[_0x7fc7('0x30')]:_0x12561d[_0x7fc7('0x31')]+_0x12561d[_0x7fc7('0x2f')];var _0x2e6c0a;if(_0x3a8555>=_0x4d5f9a){_0x3a8555=_0x4d5f9a;_0x2e6c0a=0xc8;}else{_0x2e6c0a=0xce;}_0x478413['status'](_0x2e6c0a);return _0x478413[_0x7fc7('0x32')](_0x7fc7('0x33'),_0x330ec6+'-'+_0x3a8555+'/'+_0x4d5f9a)[_0x7fc7('0x2d')](_0x13db2a);}return null;};}function patchUpdates(_0x1c44ab){return function(_0x2d10e4){try{jsonpatch['apply'](_0x2d10e4,_0x1c44ab,!![]);}catch(_0x4cd31c){return BPromise['reject'](_0x4cd31c);}return _0x2d10e4[_0x7fc7('0x34')]();};}function saveUpdates(_0x365d88,_0x13d273){return function(_0x2c102d){if(_0x2c102d){return _0x2c102d[_0x7fc7('0x35')](_0x365d88)[_0x7fc7('0x1f')](function(_0x564cb5){return _0x564cb5;});}return null;};}function removeEntity(_0x541b20,_0x598dd9){return function(_0x8a61c1){if(_0x8a61c1){return _0x8a61c1[_0x7fc7('0x36')]()['then'](function(){var _0x1d4f5b=_0x8a61c1['get']({'plain':!![]});var _0x5942c2=_0x7fc7('0x37');return db[_0x7fc7('0x38')]['destroy']({'where':{'type':_0x5942c2,'resourceId':_0x1d4f5b['id']}})['then'](function(){return _0x8a61c1;});})[_0x7fc7('0x1f')](function(){_0x541b20[_0x7fc7('0x2c')](0xcc)[_0x7fc7('0x39')]();});}};}function handleEntityNotFound(_0x53d77c,_0x55e281){return function(_0xe114ed){if(!_0xe114ed){_0x53d77c['sendStatus'](0x194);}return _0xe114ed;};}function handleError(_0x326ac1,_0x101ccb){_0x101ccb=_0x101ccb||0x1f4;return function(_0x58ba41){logger[_0x7fc7('0x26')](_0x58ba41['stack']);if(_0x58ba41[_0x7fc7('0x3a')]){delete _0x58ba41[_0x7fc7('0x3a')];}_0x326ac1[_0x7fc7('0x2c')](_0x101ccb)['send'](_0x58ba41);};}exports[_0x7fc7('0x3b')]=function(_0x2490ae,_0x50c5a5){var _0x410b4c={'include':[{'model':db[_0x7fc7('0x3c')],'as':_0x7fc7('0x3d')}]},_0x127ec0={},_0x386aad={'count':0x0,'rows':[]};var _0x4e63c2=_[_0x7fc7('0x3e')](db[_0x7fc7('0x3f')][_0x7fc7('0x40')],function(_0x2a29ec){return{'name':_0x2a29ec[_0x7fc7('0x41')],'type':_0x2a29ec[_0x7fc7('0x42')][_0x7fc7('0x43')]};});_0x127ec0[_0x7fc7('0x44')]=_['map'](_0x4e63c2,'name');_0x127ec0['query']=_[_0x7fc7('0x45')](_0x2490ae[_0x7fc7('0x46')]);_0x127ec0[_0x7fc7('0x47')]=_[_0x7fc7('0x48')](_0x127ec0['model'],_0x127ec0['query']);_0x410b4c[_0x7fc7('0x49')]=_['intersection'](_0x127ec0['model'],qs[_0x7fc7('0x4a')](_0x2490ae[_0x7fc7('0x46')][_0x7fc7('0x4a')]));_0x410b4c[_0x7fc7('0x49')]=_0x410b4c[_0x7fc7('0x49')][_0x7fc7('0x4b')]?_0x410b4c[_0x7fc7('0x49')]:_0x127ec0[_0x7fc7('0x44')];if(!_0x2490ae[_0x7fc7('0x46')][_0x7fc7('0x4c')](_0x7fc7('0x4d'))){_0x410b4c[_0x7fc7('0x2f')]=qs['limit'](_0x2490ae[_0x7fc7('0x46')]['limit']);_0x410b4c[_0x7fc7('0x31')]=qs[_0x7fc7('0x31')](_0x2490ae[_0x7fc7('0x46')][_0x7fc7('0x31')]);}_0x410b4c[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x2490ae[_0x7fc7('0x46')]['sort']);_0x410b4c[_0x7fc7('0x50')]=qs['filters'](_[_0x7fc7('0x51')](_0x2490ae[_0x7fc7('0x46')],_0x127ec0[_0x7fc7('0x47')]),_0x4e63c2);if(_0x2490ae[_0x7fc7('0x46')]['filter']){_0x410b4c[_0x7fc7('0x50')]=_['merge'](_0x410b4c[_0x7fc7('0x50')],{'$or':_[_0x7fc7('0x3e')](_0x4e63c2,function(_0x18da5f){if(_0x18da5f[_0x7fc7('0x42')]!==_0x7fc7('0x52')){var _0x28011b={};_0x28011b[_0x18da5f[_0x7fc7('0x3a')]]={'$like':'%'+_0x2490ae[_0x7fc7('0x46')]['filter']+'%'};return _0x28011b;}})});}_0x410b4c=_[_0x7fc7('0x53')]({},_0x410b4c,_0x2490ae[_0x7fc7('0x54')]);var _0x4a62cd={'where':_0x410b4c[_0x7fc7('0x50')]};return db[_0x7fc7('0x3f')][_0x7fc7('0x30')](_0x4a62cd)['then'](function(_0x3f183f){_0x386aad[_0x7fc7('0x30')]=_0x3f183f;if(_0x2490ae[_0x7fc7('0x46')]['includeAll']){_0x410b4c['include']=[{'all':!![]}];}return db[_0x7fc7('0x3f')][_0x7fc7('0x55')](_0x410b4c);})['then'](function(_0x4d4acc){_0x386aad[_0x7fc7('0x56')]=_0x4d4acc;return _0x386aad;})['then'](respondWithFilteredResult(_0x50c5a5,_0x410b4c))[_0x7fc7('0x2a')](handleError(_0x50c5a5,null));};exports[_0x7fc7('0x57')]=function(_0x3e5b21,_0x252655){var _0x3fdcf7={'raw':![],'where':{'id':_0x3e5b21[_0x7fc7('0x58')]['id']},'include':[{'model':db[_0x7fc7('0x3c')],'as':_0x7fc7('0x3d')}]},_0x4aa3a5={};_0x4aa3a5[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db[_0x7fc7('0x3f')][_0x7fc7('0x40')]);_0x4aa3a5['query']=_['keys'](_0x3e5b21['query']);_0x4aa3a5[_0x7fc7('0x47')]=_[_0x7fc7('0x48')](_0x4aa3a5[_0x7fc7('0x44')],_0x4aa3a5[_0x7fc7('0x46')]);_0x3fdcf7['attributes']=_[_0x7fc7('0x48')](_0x4aa3a5[_0x7fc7('0x44')],qs['fields'](_0x3e5b21[_0x7fc7('0x46')][_0x7fc7('0x4a')]));_0x3fdcf7[_0x7fc7('0x49')]=_0x3fdcf7['attributes']['length']?_0x3fdcf7[_0x7fc7('0x49')]:_0x4aa3a5[_0x7fc7('0x44')];if(_0x3e5b21['query'][_0x7fc7('0x59')]){_0x3fdcf7['include']=[{'all':!![]}];}_0x3fdcf7=_['merge']({},_0x3fdcf7,_0x3e5b21[_0x7fc7('0x54')]);return db[_0x7fc7('0x3f')][_0x7fc7('0x5a')](_0x3fdcf7)[_0x7fc7('0x1f')](handleEntityNotFound(_0x252655,null))[_0x7fc7('0x1f')](respondWithResult(_0x252655,null))['catch'](handleError(_0x252655,null));};exports[_0x7fc7('0x5b')]=function(_0x2b9b66,_0x27da5a){return db[_0x7fc7('0x3f')][_0x7fc7('0x5b')](_0x2b9b66[_0x7fc7('0x5c')],{})[_0x7fc7('0x1f')](function(_0x10e20b){var _0x55f28c=_0x2b9b66['user'][_0x7fc7('0x5d')]({'plain':!![]});if(!_0x55f28c)throw new Error(_0x7fc7('0x5e'));if(_0x55f28c[_0x7fc7('0x5f')]===_0x7fc7('0x60')){var _0x481103=_0x10e20b[_0x7fc7('0x5d')]({'plain':!![]});var _0x38a156=_0x7fc7('0x37');return db['UserProfileSection'][_0x7fc7('0x5a')]({'where':{'name':_0x38a156,'userProfileId':_0x55f28c[_0x7fc7('0x61')]},'raw':!![]})[_0x7fc7('0x1f')](function(_0xb47971){if(_0xb47971&&_0xb47971[_0x7fc7('0x62')]===0x0){return db[_0x7fc7('0x38')][_0x7fc7('0x5b')]({'name':_0x481103[_0x7fc7('0x3a')],'resourceId':_0x481103['id'],'type':_0xb47971[_0x7fc7('0x3a')],'sectionId':_0xb47971['id']},{})[_0x7fc7('0x1f')](function(){return _0x10e20b;});}else{return _0x10e20b;}})[_0x7fc7('0x2a')](function(_0x3a39e2){logger[_0x7fc7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a39e2);throw _0x3a39e2;});}return _0x10e20b;})[_0x7fc7('0x1f')](respondWithResult(_0x27da5a,0xc9))[_0x7fc7('0x2a')](handleError(_0x27da5a,null));};exports[_0x7fc7('0x35')]=function(_0x406a9c,_0x28a201){if(_0x406a9c[_0x7fc7('0x5c')]['id']){delete _0x406a9c['body']['id'];}return db[_0x7fc7('0x3f')][_0x7fc7('0x5a')]({'where':{'id':_0x406a9c['params']['id']},'include':[{'model':db[_0x7fc7('0x3c')],'as':_0x7fc7('0x3d')}]})[_0x7fc7('0x1f')](handleEntityNotFound(_0x28a201,null))[_0x7fc7('0x1f')](saveUpdates(_0x406a9c[_0x7fc7('0x5c')],null))[_0x7fc7('0x1f')](respondWithResult(_0x28a201,null))[_0x7fc7('0x2a')](handleError(_0x28a201,null));};exports[_0x7fc7('0x36')]=function(_0x5624fc,_0x40915a){return db['FaxAccount'][_0x7fc7('0x5a')]({'where':{'id':_0x5624fc['params']['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x40915a,null))['then'](removeEntity(_0x40915a,null))[_0x7fc7('0x2a')](handleError(_0x40915a,null));};exports[_0x7fc7('0x63')]=function(_0xecb49a,_0x129971){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x129971,null))[_0x7fc7('0x2a')](handleError(_0x129971,null));};exports[_0x7fc7('0x64')]=function(_0xcb1f75,_0x23989a,_0x426cc3){if(_0xcb1f75[_0x7fc7('0x5c')]['id']){delete _0xcb1f75[_0x7fc7('0x5c')]['id'];}return db[_0x7fc7('0x3f')]['find']({'where':{'id':_0xcb1f75[_0x7fc7('0x58')]['id']}})['then'](handleEntityNotFound(_0x23989a,null))[_0x7fc7('0x1f')](function(_0x26c352){if(_0x26c352){_0xcb1f75[_0x7fc7('0x5c')]['FaxAccountId']=_0x26c352['id'];return db['Disposition']['create'](_0xcb1f75[_0x7fc7('0x5c')]);}})[_0x7fc7('0x1f')](respondWithResult(_0x23989a,null))[_0x7fc7('0x2a')](handleError(_0x23989a,null));};exports[_0x7fc7('0x65')]=function(_0x4b7d49,_0x244f3b,_0x99dec6){var _0x1df341={'raw':![],'where':{}};var _0x4e7734={};var _0x43ba2f={'count':0x0,'rows':[]};return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x4b7d49[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x244f3b,null))[_0x7fc7('0x1f')](function(_0x53dfb4){if(_0x53dfb4){_0x4e7734[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db[_0x7fc7('0x67')][_0x7fc7('0x40')]);_0x4e7734[_0x7fc7('0x46')]=_[_0x7fc7('0x45')](_0x4b7d49[_0x7fc7('0x46')]);_0x4e7734[_0x7fc7('0x47')]=_['intersection'](_0x4e7734[_0x7fc7('0x44')],_0x4e7734[_0x7fc7('0x46')]);_0x1df341[_0x7fc7('0x49')]=_[_0x7fc7('0x48')](_0x4e7734[_0x7fc7('0x44')],qs[_0x7fc7('0x4a')](_0x4b7d49[_0x7fc7('0x46')]['fields']));_0x1df341['attributes']=_0x1df341['attributes'][_0x7fc7('0x4b')]?_0x1df341[_0x7fc7('0x49')]:_0x4e7734['model'];if(!_0x4b7d49[_0x7fc7('0x46')][_0x7fc7('0x4c')](_0x7fc7('0x4d'))){_0x1df341['limit']=qs[_0x7fc7('0x2f')](_0x4b7d49[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x1df341[_0x7fc7('0x31')]=qs[_0x7fc7('0x31')](_0x4b7d49[_0x7fc7('0x46')][_0x7fc7('0x31')]);}_0x1df341['order']=qs['sort'](_0x4b7d49[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x1df341['where']=qs['filters'](_[_0x7fc7('0x51')](_0x4b7d49[_0x7fc7('0x46')],_0x4e7734[_0x7fc7('0x47')]));_0x1df341[_0x7fc7('0x50')]['FaxAccountId']=_0x53dfb4['id'];if(_0x4b7d49[_0x7fc7('0x46')]['filter']){_0x1df341[_0x7fc7('0x50')]=_[_0x7fc7('0x53')](_0x1df341['where'],{'$or':_[_0x7fc7('0x3e')](_0x1df341[_0x7fc7('0x49')],function(_0x26cd50){var _0x45b5a6={};_0x45b5a6[_0x26cd50]={'$like':'%'+_0x4b7d49['query'][_0x7fc7('0x68')]+'%'};return _0x45b5a6;})});}_0x1df341=_['merge']({},_0x1df341,_0x4b7d49[_0x7fc7('0x54')]);return db['Disposition'][_0x7fc7('0x30')]({'where':_0x1df341[_0x7fc7('0x50')]})[_0x7fc7('0x1f')](function(_0x2ce1dc){_0x43ba2f[_0x7fc7('0x30')]=_0x2ce1dc;if(_0x4b7d49[_0x7fc7('0x46')][_0x7fc7('0x59')]){_0x1df341[_0x7fc7('0x69')]=[{'all':!![]}];}return db[_0x7fc7('0x67')][_0x7fc7('0x55')](_0x1df341);})[_0x7fc7('0x1f')](function(_0x3f188d){_0x43ba2f['rows']=_0x3f188d;return _0x43ba2f;});}})['then'](respondWithFilteredResult(_0x244f3b,_0x1df341))[_0x7fc7('0x2a')](handleError(_0x244f3b,null));};exports['removeDispositions']=function(_0x241b15,_0xa9862c,_0x4bb29a){return db[_0x7fc7('0x3f')]['find']({'where':{'id':_0x241b15[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0xa9862c,null))[_0x7fc7('0x1f')](function(_0x4b8ce4){if(_0x4b8ce4){return _0x4b8ce4['removeDispositions'](_0x241b15[_0x7fc7('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xa9862c,null))[_0x7fc7('0x2a')](handleError(_0xa9862c,null));};exports['addAnswer']=function(_0x582b4e,_0x5cfec2,_0xb04207){if(_0x582b4e[_0x7fc7('0x5c')]['id']){delete _0x582b4e[_0x7fc7('0x5c')]['id'];}return db[_0x7fc7('0x3f')]['find']({'where':{'id':_0x582b4e['params']['id']}})['then'](handleEntityNotFound(_0x5cfec2,null))[_0x7fc7('0x1f')](function(_0x4f52d4){if(_0x4f52d4){_0x582b4e[_0x7fc7('0x5c')]['FaxAccountId']=_0x4f52d4['id'];return db[_0x7fc7('0x6a')][_0x7fc7('0x5b')](_0x582b4e[_0x7fc7('0x5c')]);}})[_0x7fc7('0x1f')](respondWithResult(_0x5cfec2,null))[_0x7fc7('0x2a')](handleError(_0x5cfec2,null));};exports[_0x7fc7('0x6b')]=function(_0x26ac02,_0x1104d5,_0x368810){var _0x25ff3d={'raw':![],'where':{}};var _0x12e1ef={};var _0xded0fd={'count':0x0,'rows':[]};return db[_0x7fc7('0x3f')]['findOne']({'where':{'id':_0x26ac02[_0x7fc7('0x58')]['id']}})['then'](handleEntityNotFound(_0x1104d5,null))[_0x7fc7('0x1f')](function(_0x510875){if(_0x510875){_0x12e1ef[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db[_0x7fc7('0x6a')]['rawAttributes']);_0x12e1ef[_0x7fc7('0x46')]=_[_0x7fc7('0x45')](_0x26ac02[_0x7fc7('0x46')]);_0x12e1ef[_0x7fc7('0x47')]=_['intersection'](_0x12e1ef[_0x7fc7('0x44')],_0x12e1ef['query']);_0x25ff3d[_0x7fc7('0x49')]=_['intersection'](_0x12e1ef[_0x7fc7('0x44')],qs[_0x7fc7('0x4a')](_0x26ac02[_0x7fc7('0x46')][_0x7fc7('0x4a')]));_0x25ff3d[_0x7fc7('0x49')]=_0x25ff3d[_0x7fc7('0x49')][_0x7fc7('0x4b')]?_0x25ff3d[_0x7fc7('0x49')]:_0x12e1ef[_0x7fc7('0x44')];if(!_0x26ac02['query']['hasOwnProperty']('nolimit')){_0x25ff3d[_0x7fc7('0x2f')]=qs[_0x7fc7('0x2f')](_0x26ac02[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x25ff3d['offset']=qs[_0x7fc7('0x31')](_0x26ac02[_0x7fc7('0x46')][_0x7fc7('0x31')]);}_0x25ff3d[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x26ac02[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x25ff3d['where']=qs[_0x7fc7('0x47')](_[_0x7fc7('0x51')](_0x26ac02[_0x7fc7('0x46')],_0x12e1ef['filters']));_0x25ff3d['where'][_0x7fc7('0x6c')]=_0x510875['id'];if(_0x26ac02['query'][_0x7fc7('0x68')]){_0x25ff3d[_0x7fc7('0x50')]=_[_0x7fc7('0x53')](_0x25ff3d[_0x7fc7('0x50')],{'$or':_[_0x7fc7('0x3e')](_0x25ff3d[_0x7fc7('0x49')],function(_0x10a0a4){var _0xe50a62={};_0xe50a62[_0x10a0a4]={'$like':'%'+_0x26ac02['query'][_0x7fc7('0x68')]+'%'};return _0xe50a62;})});}_0x25ff3d=_[_0x7fc7('0x53')]({},_0x25ff3d,_0x26ac02[_0x7fc7('0x54')]);return db[_0x7fc7('0x6a')][_0x7fc7('0x30')]({'where':_0x25ff3d[_0x7fc7('0x50')]})[_0x7fc7('0x1f')](function(_0xbbfe4c){_0xded0fd[_0x7fc7('0x30')]=_0xbbfe4c;if(_0x26ac02['query'][_0x7fc7('0x59')]){_0x25ff3d[_0x7fc7('0x69')]=[{'all':!![]}];}return db[_0x7fc7('0x6a')]['findAll'](_0x25ff3d);})[_0x7fc7('0x1f')](function(_0x4643fa){_0xded0fd[_0x7fc7('0x56')]=_0x4643fa;return _0xded0fd;});}})[_0x7fc7('0x1f')](respondWithFilteredResult(_0x1104d5,_0x25ff3d))[_0x7fc7('0x2a')](handleError(_0x1104d5,null));};exports[_0x7fc7('0x6d')]=function(_0x37be26,_0x52462b,_0x52ca0b){return db[_0x7fc7('0x3f')]['find']({'where':{'id':_0x37be26[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x52462b,null))[_0x7fc7('0x1f')](function(_0x41d0dd){if(_0x41d0dd){return _0x41d0dd['removeAnswers'](_0x37be26[_0x7fc7('0x46')][_0x7fc7('0x6e')]);}})[_0x7fc7('0x1f')](respondWithStatusCode(_0x52462b,null))[_0x7fc7('0x2a')](handleError(_0x52462b,null));};exports[_0x7fc7('0x6f')]=function(_0x504ef5,_0x365f50,_0x3aadc1){return db['FaxInteraction'][_0x7fc7('0x5a')]({'where':{'id':_0x504ef5['params']['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x365f50,null))[_0x7fc7('0x1f')](function(_0x4b061b){if(_0x4b061b){return _0x4b061b[_0x7fc7('0x6f')](_0x504ef5[_0x7fc7('0x5c')][_0x7fc7('0x6e')],_['omit'](_0x504ef5['body'],[_0x7fc7('0x6e'),'id'])||{});}})[_0x7fc7('0x1f')](respondWithResult(_0x365f50,null))[_0x7fc7('0x2a')](handleError(_0x365f50,null));};exports[_0x7fc7('0x70')]=function(_0x3194c9,_0x8a2e56,_0x2cc5f0){var _0x30c286={'raw':![],'where':{}};var _0x59be08={};var _0x495d6c={'count':0x0,'rows':[]};return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x3194c9[_0x7fc7('0x58')]['id']}})['then'](handleEntityNotFound(_0x8a2e56,null))[_0x7fc7('0x1f')](function(_0x58129d){if(_0x58129d){_0x59be08[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db['FaxInteraction']['rawAttributes']);_0x59be08['query']=_[_0x7fc7('0x45')](_0x3194c9[_0x7fc7('0x46')]);_0x59be08['filters']=_['intersection'](_0x59be08[_0x7fc7('0x44')],_0x59be08['query']);_0x30c286[_0x7fc7('0x49')]=_[_0x7fc7('0x48')](_0x59be08[_0x7fc7('0x44')],qs[_0x7fc7('0x4a')](_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x4a')]));_0x30c286[_0x7fc7('0x49')]=_0x30c286['attributes'][_0x7fc7('0x4b')]?_0x30c286[_0x7fc7('0x49')]:_0x59be08[_0x7fc7('0x44')];if(!_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x4c')](_0x7fc7('0x4d'))){_0x30c286[_0x7fc7('0x2f')]=qs[_0x7fc7('0x2f')](_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x30c286[_0x7fc7('0x31')]=qs['offset'](_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x31')]);}_0x30c286[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x30c286[_0x7fc7('0x50')]=qs[_0x7fc7('0x47')](_[_0x7fc7('0x51')](_0x3194c9['query'],_0x59be08['filters']));_0x30c286[_0x7fc7('0x50')]['FaxAccountId']=_0x58129d['id'];if(_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x68')]){_0x30c286[_0x7fc7('0x50')]=_['merge'](_0x30c286['where'],{'$or':_['map'](_0x30c286[_0x7fc7('0x49')],function(_0x2efcf9){var _0x28c02a={};_0x28c02a[_0x2efcf9]={'$like':'%'+_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x68')]+'%'};return _0x28c02a;})});}_0x30c286=_[_0x7fc7('0x53')]({},_0x30c286,_0x3194c9[_0x7fc7('0x54')]);return db[_0x7fc7('0x71')]['count']({'where':_0x30c286[_0x7fc7('0x50')]})[_0x7fc7('0x1f')](function(_0x2b5b21){_0x495d6c[_0x7fc7('0x30')]=_0x2b5b21;if(_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x59')]){_0x30c286['include']=[{'model':db[_0x7fc7('0x72')],'as':'Contact','required':![]},{'model':db[_0x7fc7('0x73')],'as':'Owner','attributes':['name',_0x7fc7('0x74'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x7fc7('0x75'),'attributes':['id',_0x7fc7('0x3a'),'color'],'where':_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x76')]?{'id':_0x3194c9[_0x7fc7('0x46')]['tag']}:undefined,'required':_0x3194c9[_0x7fc7('0x46')][_0x7fc7('0x76')]?!![]:![]}];}return db[_0x7fc7('0x71')][_0x7fc7('0x55')](_0x30c286);})[_0x7fc7('0x1f')](function(_0x22e2b8){_0x495d6c[_0x7fc7('0x56')]=_0x22e2b8;return _0x495d6c;});}})[_0x7fc7('0x1f')](respondWithFilteredResult(_0x8a2e56,_0x30c286))[_0x7fc7('0x2a')](handleError(_0x8a2e56,null));};exports[_0x7fc7('0x77')]=function(_0x4ca180,_0x3beaa3){var _0x1e9c37=_0x4ca180[_0x7fc7('0x58')]['id'];var _0x424eca=_0x4ca180[_0x7fc7('0x5c')];var _0x125820=0xc8;var _0x3f49b7=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x7fc7('0x78')][_0x7fc7('0x79')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4d2444){return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x1e9c37},'transaction':_0x4d2444})['then'](function(_0x331237){if(_0x331237){return db[_0x7fc7('0x7a')][_0x7fc7('0x36')]({'where':{'FaxAccountId':_0x1e9c37},'transaction':_0x4d2444})[_0x7fc7('0x1f')](function(){var _0x6106e5=_[_0x7fc7('0x3e')](_0x424eca,function(_0x44623a){_0x44623a['FaxAccountId']=_0x1e9c37;return _0x44623a;});return db[_0x7fc7('0x7a')][_0x7fc7('0x7b')](_0x6106e5,{'transaction':_0x4d2444});});}else{_0x125820=0x194;_0x3f49b7=[];}});})[_0x7fc7('0x1f')](function(){if(_0x125820!==0x194){return db['FaxApplication'][_0x7fc7('0x7c')]({'where':{'FaxAccountId':_0x1e9c37},'order':'priority'})[_0x7fc7('0x1f')](function(_0x1d044c){_0x3f49b7=_0x1d044c;});}})[_0x7fc7('0x2a')](function(_0x3e1d0f){_0x125820=0x1f4;logger[_0x7fc7('0x26')](_0x3e1d0f[_0x7fc7('0x7d')]);if(_0x3e1d0f[_0x7fc7('0x3a')]){delete _0x3e1d0f[_0x7fc7('0x3a')];}_0x3f49b7=_0x3e1d0f;})[_0x7fc7('0x7e')](function(){if(_0x3f49b7===null){_0x3beaa3[_0x7fc7('0x2b')](_0x125820);}else{if(_0x125820===0x1f4){_0x3beaa3['status'](_0x125820)[_0x7fc7('0x7f')](_0x3f49b7);}else{_0x3beaa3[_0x7fc7('0x2c')](_0x125820)['json'](_0x3f49b7);}}});};exports[_0x7fc7('0x80')]=function(_0x28b583,_0x1085e1,_0x271988){var _0x346537={};var _0x2f025d={};var _0x58b74a;var _0x2a7f9d;return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x28b583[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x1085e1,null))[_0x7fc7('0x1f')](function(_0x4dea0c){if(_0x4dea0c){_0x58b74a=_0x4dea0c;_0x2f025d[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db[_0x7fc7('0x7a')][_0x7fc7('0x40')]);_0x2f025d['query']=_['keys'](_0x28b583[_0x7fc7('0x46')]);_0x2f025d[_0x7fc7('0x47')]=_[_0x7fc7('0x48')](_0x2f025d[_0x7fc7('0x44')],_0x2f025d[_0x7fc7('0x46')]);_0x346537[_0x7fc7('0x49')]=_[_0x7fc7('0x48')](_0x2f025d[_0x7fc7('0x44')],qs['fields'](_0x28b583[_0x7fc7('0x46')][_0x7fc7('0x4a')]));_0x346537[_0x7fc7('0x49')]=_0x346537[_0x7fc7('0x49')][_0x7fc7('0x4b')]?_0x346537[_0x7fc7('0x49')]:_0x2f025d[_0x7fc7('0x44')];_0x346537[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x28b583[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x346537[_0x7fc7('0x50')]=qs[_0x7fc7('0x47')](_['pick'](_0x28b583[_0x7fc7('0x46')],_0x2f025d[_0x7fc7('0x47')]));if(_0x28b583['query'][_0x7fc7('0x68')]){_0x346537[_0x7fc7('0x50')]=_['merge'](_0x346537[_0x7fc7('0x50')],{'$or':_[_0x7fc7('0x3e')](_0x346537['attributes'],function(_0x2e526e){var _0x23d40e={};_0x23d40e[_0x2e526e]={'$like':'%'+_0x28b583[_0x7fc7('0x46')][_0x7fc7('0x68')]+'%'};return _0x23d40e;})});}_0x346537=_[_0x7fc7('0x53')]({},_0x346537,_0x28b583[_0x7fc7('0x54')]);return _0x58b74a[_0x7fc7('0x80')](_0x346537);}})[_0x7fc7('0x1f')](function(_0x57188e){if(_0x57188e){_0x2a7f9d=_0x57188e[_0x7fc7('0x4b')];if(!_0x28b583['query'][_0x7fc7('0x4c')]('nolimit')){_0x346537[_0x7fc7('0x2f')]=qs[_0x7fc7('0x2f')](_0x28b583[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x346537[_0x7fc7('0x31')]=qs[_0x7fc7('0x31')](_0x28b583[_0x7fc7('0x46')]['offset']);}return _0x58b74a[_0x7fc7('0x80')](_0x346537);}})[_0x7fc7('0x1f')](function(_0x214198){if(_0x214198){return _0x214198?{'count':_0x2a7f9d,'rows':_0x214198}:null;}})[_0x7fc7('0x1f')](respondWithResult(_0x1085e1,null))[_0x7fc7('0x2a')](handleError(_0x1085e1,null));};function Extension(_0xf185a,_0x2f4ed6,_0x3d1e1a,_0x20d34d){this[_0x7fc7('0x81')]=_0x7fc7('0x82');this['exten']=_0xf185a[_0x7fc7('0x83')];this[_0x7fc7('0x84')]=_0x20d34d;this[_0x7fc7('0x42')]=_0x7fc7('0x85');this[_0x7fc7('0x86')]='Fax\x20Extension';this[_0x7fc7('0x6c')]=_0xf185a['id'];this[_0x7fc7('0x87')]=_0x2f4ed6;this[_0x7fc7('0x88')]=_0x3d1e1a;}function createExtensionsReciveFax(_0x27c520){var _0x4503ad=0x1;var _0x526bfb=[];_0x526bfb[_0x7fc7('0x89')](new Extension(_0x27c520,_0x4503ad,'',_0x7fc7('0x8a')));_0x4503ad+=0x1;_0x526bfb[_0x7fc7('0x89')](new Extension(_0x27c520,_0x4503ad,_0x7fc7('0x8b'),_0x7fc7('0x8c')));_0x4503ad+=0x1;for(var _0x5a1b2e in _0x27c520){if(_0x27c520[_0x7fc7('0x4c')](_0x5a1b2e)&&(_0x5a1b2e==='ecm'||_0x5a1b2e===_0x7fc7('0x83')||_0x5a1b2e==='gateway'||_0x5a1b2e==='faxdetect'||_0x5a1b2e===_0x7fc7('0x8d')||_0x5a1b2e===_0x7fc7('0x8e')||_0x5a1b2e===_0x7fc7('0x8f')||_0x5a1b2e==='modem'||_0x5a1b2e==='t38timeout')){_0x526bfb[_0x7fc7('0x89')](new Extension(_0x27c520,_0x4503ad,_0x7fc7('0x90')+_0x5a1b2e+')='+_0x27c520[_0x5a1b2e],'Set'));_0x4503ad+=0x1;}}_0x526bfb[_0x7fc7('0x89')](new Extension(_0x27c520,_0x4503ad,'6','Wait'));_0x4503ad+=0x1;_0x526bfb[_0x7fc7('0x89')](new Extension(_0x27c520,_0x4503ad,'/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',_0x7fc7('0x91')));_0x4503ad=0x0;return _0x526bfb;}exports[_0x7fc7('0x92')]=function(_0xb9a323,_0x3e6986,_0x5919aa){var _0x5199b7;return db[_0x7fc7('0x78')][_0x7fc7('0x93')](function(_0x4b9bcf){return db['FaxAccount'][_0x7fc7('0x5b')](_0xb9a323[_0x7fc7('0x5c')],{'transaction':_0x4b9bcf})[_0x7fc7('0x1f')](function(_0x478209){_0x5199b7=_0x478209[_0x7fc7('0x5d')]({'plain':!![]});return db[_0x7fc7('0x94')][_0x7fc7('0x7b')](createExtensionsReciveFax(_0x5199b7),{'transaction':_0x4b9bcf});});})[_0x7fc7('0x1f')](function(){return _0x5199b7;})[_0x7fc7('0x1f')](respondWithResult(_0x3e6986,null))['catch'](handleError(_0x3e6986,null));};exports[_0x7fc7('0x95')]=function(_0x281484,_0x14ea50,_0x3e6f1c){var _0x1318bc;return db[_0x7fc7('0x78')][_0x7fc7('0x93')](function(_0x3ccb85){return db[_0x7fc7('0x3f')]['update'](_0x281484[_0x7fc7('0x5c')],{'where':{'id':_0x281484['body']['id']},'transaction':_0x3ccb85})['then'](function(_0x572515){return db[_0x7fc7('0x94')][_0x7fc7('0x36')]({'where':{'FaxAccountId':_0x281484[_0x7fc7('0x5c')]['id']},'transaction':_0x3ccb85})[_0x7fc7('0x1f')](function(_0x5136df){return db[_0x7fc7('0x94')][_0x7fc7('0x7b')](createExtensionsReciveFax(_[_0x7fc7('0x96')](_0x281484[_0x7fc7('0x5c')],[_0x7fc7('0x97'),'key',_0x7fc7('0x98'),_0x7fc7('0x99'),_0x7fc7('0x9a'),_0x7fc7('0x9b')])),{'transaction':_0x3ccb85});});});})[_0x7fc7('0x1f')](function(){return db['FaxAccount'][_0x7fc7('0x9c')](_0x281484[_0x7fc7('0x5c')]['id']);})[_0x7fc7('0x1f')](respondWithResult(_0x14ea50,null))[_0x7fc7('0x2a')](handleError(_0x14ea50,null));};exports[_0x7fc7('0x9d')]=function(_0x51619d,_0x3de16c,_0x2369a3){var _0x21011b={'raw':!![],'where':{}};var _0x5aa666={};var _0x594d11={'count':0x0,'rows':[]};return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x51619d[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x3de16c,null))[_0x7fc7('0x1f')](function(_0x2a2573){if(_0x2a2573){_0x5aa666[_0x7fc7('0x44')]=_[_0x7fc7('0x45')](db['FaxMessage'][_0x7fc7('0x40')]);_0x5aa666[_0x7fc7('0x46')]=_[_0x7fc7('0x45')](_0x51619d[_0x7fc7('0x46')]);_0x5aa666[_0x7fc7('0x47')]=_['intersection'](_0x5aa666['model'],_0x5aa666[_0x7fc7('0x46')]);_0x21011b[_0x7fc7('0x49')]=_[_0x7fc7('0x48')](_0x5aa666[_0x7fc7('0x44')],qs[_0x7fc7('0x4a')](_0x51619d['query']['fields']));_0x21011b['attributes']=_0x21011b[_0x7fc7('0x49')]['length']?_0x21011b['attributes']:_0x5aa666[_0x7fc7('0x44')];if(!_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x4c')](_0x7fc7('0x4d'))){_0x21011b['limit']=qs[_0x7fc7('0x2f')](_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x21011b[_0x7fc7('0x31')]=qs[_0x7fc7('0x31')](_0x51619d['query']['offset']);}_0x21011b[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x21011b[_0x7fc7('0x50')]=qs[_0x7fc7('0x47')](_['pick'](_0x51619d[_0x7fc7('0x46')],_0x5aa666[_0x7fc7('0x47')]));_0x21011b[_0x7fc7('0x50')][_0x7fc7('0x6c')]=_0x2a2573['id'];if(_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x68')]){_0x21011b[_0x7fc7('0x50')]=_[_0x7fc7('0x53')](_0x21011b[_0x7fc7('0x50')],{'$or':_['map'](_0x21011b[_0x7fc7('0x49')],function(_0x3dd971){var _0x49995d={};_0x49995d[_0x3dd971]={'$like':'%'+_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x68')]+'%'};return _0x49995d;})});}if(_0x51619d[_0x7fc7('0x46')][_0x7fc7('0x9e')]){var _0x2ee4a9=_0x51619d['query']['$gte'][_0x7fc7('0x9f')](',');var _0x181637={};_0x181637[_0x2ee4a9[0x0]]={'$gte':moment(_0x2ee4a9[0x1])[_0x7fc7('0xa0')](_0x7fc7('0xa1'))};_0x21011b[_0x7fc7('0x50')]=_[_0x7fc7('0x53')](_0x21011b[_0x7fc7('0x50')],_0x181637);}_0x21011b=_[_0x7fc7('0x53')]({},_0x21011b,_0x51619d[_0x7fc7('0x54')]);return db[_0x7fc7('0xa2')][_0x7fc7('0x30')]({'where':_0x21011b['where']})[_0x7fc7('0x1f')](function(_0x43df90){_0x594d11['count']=_0x43df90;if(_0x51619d[_0x7fc7('0x46')]['includeAll']){_0x21011b['include']=[{'all':!![]}];}return db['FaxMessage'][_0x7fc7('0x55')](_0x21011b);})['then'](function(_0xb8c7b9){_0x594d11['rows']=_0xb8c7b9;return _0x594d11;});}})[_0x7fc7('0x1f')](respondWithFilteredResult(_0x3de16c,_0x21011b))[_0x7fc7('0x2a')](handleError(_0x3de16c,null));};exports['send']=function(_0x1f63c0,_0x3dd677,_0x39e883){var _0x57a45c,_0x3a4107={},_0x1a76c1;if(_0x1f63c0[_0x7fc7('0x5c')]['to']){_0x1a76c1=_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x1f63c0[_0x7fc7('0x58')]['id']},'include':[{'model':db[_0x7fc7('0xa3')],'as':_0x7fc7('0xa4'),'include':[{'model':db[_0x7fc7('0x72')],'as':_0x7fc7('0xa5'),'where':{'fax':_0x1a76c1},'limit':0x1,'order':[[_0x7fc7('0x99'),_0x7fc7('0xa6')]]}]}]})[_0x7fc7('0x1f')](handleEntityNotFound(_0x3dd677,null))[_0x7fc7('0x1f')](function(_0x4e8e71){_0x57a45c=_0x4e8e71;if(_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')]&&_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')]['length']){for(var _0x4e8e5f=0x0;_0x4e8e5f<_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][_0x7fc7('0x4b')];_0x4e8e5f+=0x1){_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][_0x4e8e5f]={'filename':_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][_0x4e8e5f][_0x7fc7('0x3a')],'id':_0x1f63c0[_0x7fc7('0x5c')]['attachments'][_0x4e8e5f]['id'],'path':path['join'](config[_0x7fc7('0xa8')],_0x7fc7('0xa9'),_0x1f63c0[_0x7fc7('0x5c')]['attachments'][_0x4e8e5f][_0x7fc7('0xaa')])};}}return respondWithRpcPromise(_0x7fc7('0xab'),_0x7fc7('0xab'),{'FaxAccountId':_['isNil'](_0x1f63c0[_0x7fc7('0x58')]['id'])?undefined:_0x1f63c0['params']['id'],'path':_[_0x7fc7('0xac')](_0x1f63c0[_0x7fc7('0x5c')]['attachments'][0x0][_0x7fc7('0x7')])?undefined:_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][0x0][_0x7fc7('0x7')],'fax':_['isNil'](_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0])?undefined:_0x1f63c0['body']['to'][0x0]},client9002);})['then'](function(){if(_0x57a45c){if(_['isNil'](_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xad')])){_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xad')]=util[_0x7fc7('0xa0')](_0x7fc7('0xae'),_0x57a45c[_0x7fc7('0x3a')],_0x57a45c[_0x7fc7('0xaf')]);}if(_0x57a45c[_0x7fc7('0xa4')]){if(_0x57a45c[_0x7fc7('0xa4')][_0x7fc7('0xa5')]['length']){return _0x57a45c[_0x7fc7('0xa4')]['Contacts'][0x0];}else{return db['CmContact'][_0x7fc7('0x5b')](_[_0x7fc7('0xb0')](_0x1f63c0[_0x7fc7('0x5c')],{'firstName':_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0],'phone':_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0],'fax':_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0],'ListId':_0x57a45c[_0x7fc7('0x9b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x7fc7('0xb1'));}})[_0x7fc7('0x1f')](function(_0x80e1f8){if(_0x80e1f8){return db['FaxInteraction'][_0x7fc7('0x5a')]({'where':{'ContactId':_0x80e1f8['id'],'closed':![],'FaxAccountId':_0x57a45c['id']}})['then'](function(_0x46a361){if(_0x46a361){return[_0x46a361,![]];}return db[_0x7fc7('0x71')][_0x7fc7('0x5b')]({'UserId':_0x1f63c0[_0x7fc7('0x60')]['id'],'ContactId':_0x80e1f8['id'],'FaxAccountId':_0x57a45c['id'],'fax':_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0],'firstMsgDirection':_0x7fc7('0xb2'),'Messages':[_[_0x7fc7('0x53')](_0x1f63c0[_0x7fc7('0x5c')],{'read':![],'body':_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][0x0][_0x7fc7('0xb3')],'FaxAccountId':_0x57a45c['id'],'UserId':_0x1f63c0[_0x7fc7('0x60')]['id'],'ContactId':_0x80e1f8['id'],'AttachmentId':_0x1f63c0['body'][_0x7fc7('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x7fc7('0xa2')],'as':_0x7fc7('0xb4')}]})[_0x7fc7('0x1f')](function(_0x5a73f7){return[_0x5a73f7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7fc7('0xb5')](function(_0x28dd23,_0x1fdddf){if(_0x1fdddf){return _0x28dd23;}return db[_0x7fc7('0xa2')][_0x7fc7('0x5b')]({'direction':'out','read':![],'body':_0x1f63c0['body'][_0x7fc7('0xa7')][0x0]['filename'],'FaxAccountId':_0x57a45c['id'],'FaxInteractionId':_0x28dd23['id'],'UserId':_0x1f63c0['user']['id'],'ContactId':_0x28dd23['ContactId'],'AttachmentId':_0x1f63c0['body'][_0x7fc7('0xa7')][0x0]['id']})[_0x7fc7('0x1f')](function(_0x420f98){_0x28dd23[_0x7fc7('0xb6')][_0x7fc7('0xb4')]=[];_0x28dd23['dataValues'][_0x7fc7('0xb4')][_0x7fc7('0x89')](_0x420f98[_0x7fc7('0xb6')]);return _0x28dd23;});})[_0x7fc7('0x1f')](function(_0x2e04e3){respondWithRpcPromise('SendFax',_0x7fc7('0xb7'),{'FaxAccountId':_[_0x7fc7('0xac')](_0x1f63c0[_0x7fc7('0x58')]['id'])?undefined:_0x1f63c0[_0x7fc7('0x58')]['id'],'path':_['isNil'](_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][0x0][_0x7fc7('0x7')])?undefined:_0x1f63c0[_0x7fc7('0x5c')][_0x7fc7('0xa7')][0x0][_0x7fc7('0x7')],'fax':_[_0x7fc7('0xac')](_0x1f63c0['body']['to'][0x0])?undefined:_0x1f63c0[_0x7fc7('0x5c')]['to'][0x0],'AttachmentId':_0x1f63c0['body'][_0x7fc7('0xa7')][0x0]['id']},client9002)[_0x7fc7('0x1f')](function(_0x59b7ef){logger['info'](_0x7fc7('0xb8'),_0x59b7ef);})[_0x7fc7('0x2a')](function(_0xb6b17e){logger['info'](_0x7fc7('0xb8'),_0xb6b17e);});return _0x2e04e3;})[_0x7fc7('0x1f')](respondWithResult(_0x3dd677,null))[_0x7fc7('0x2a')](handleError(_0x3dd677,null));};exports[_0x7fc7('0xb9')]=function(_0x509a41,_0xf3338f,_0x375848){return db[_0x7fc7('0x3f')][_0x7fc7('0x5a')]({'where':{'id':_0x509a41[_0x7fc7('0x58')]['id']}})['then'](handleEntityNotFound(_0xf3338f,null))[_0x7fc7('0x1f')](function(_0x378de8){if(_0x378de8){return _0x378de8[_0x7fc7('0xb9')](_0x509a41['body'][_0x7fc7('0x6e')],_['omit'](_0x509a41[_0x7fc7('0x5c')],[_0x7fc7('0x6e'),'id'])||{})['spread'](function(_0x2835dc){for(var _0xbe0924=0x0;_0xbe0924<_0x509a41[_0x7fc7('0x5c')][_0x7fc7('0x6e')][_0x7fc7('0x4b')];_0xbe0924+=0x1){socket[_0x7fc7('0xba')](_0x7fc7('0xbb'),{'UserId':Number(_0x509a41[_0x7fc7('0x5c')][_0x7fc7('0x6e')][_0xbe0924]),'FaxAccountId':Number(_0x509a41[_0x7fc7('0x58')]['id'])});}return _0x2835dc;});}})['then'](respondWithResult(_0xf3338f,null))['catch'](handleError(_0xf3338f,null));};exports['removeAgents']=function(_0x4e54d7,_0x231ef5,_0x578c50){return db[_0x7fc7('0x3f')][_0x7fc7('0x5a')]({'where':{'id':_0x4e54d7[_0x7fc7('0x58')]['id']}})['then'](handleEntityNotFound(_0x231ef5,null))[_0x7fc7('0x1f')](function(_0xcb6331){if(_0xcb6331){return _0xcb6331[_0x7fc7('0xbc')](_0x4e54d7[_0x7fc7('0x46')][_0x7fc7('0x6e')])['then'](function(){if(_['isArray'](_0x4e54d7[_0x7fc7('0x46')][_0x7fc7('0x6e')])){for(var _0x388d13=0x0;_0x388d13<_0x4e54d7[_0x7fc7('0x46')][_0x7fc7('0x6e')][_0x7fc7('0x4b')];_0x388d13+=0x1){socket[_0x7fc7('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x4e54d7[_0x7fc7('0x46')][_0x7fc7('0x6e')][_0x388d13]),'FaxAccountId':Number(_0x4e54d7[_0x7fc7('0x58')]['id'])});}}else{socket[_0x7fc7('0xba')](_0x7fc7('0xbd'),{'UserId':Number(_0x4e54d7['query'][_0x7fc7('0x6e')]),'FaxAccountId':Number(_0x4e54d7[_0x7fc7('0x58')]['id'])});}});}})[_0x7fc7('0x1f')](respondWithStatusCode(_0x231ef5,null))['catch'](handleError(_0x231ef5,null));};exports[_0x7fc7('0xbe')]=function(_0x45ffdc,_0x4c548e,_0x272e60){var _0x416afc={};var _0x181059={};var _0x1c244d;var _0x4cfd93;return db[_0x7fc7('0x3f')][_0x7fc7('0x66')]({'where':{'id':_0x45ffdc[_0x7fc7('0x58')]['id']}})[_0x7fc7('0x1f')](handleEntityNotFound(_0x4c548e,null))[_0x7fc7('0x1f')](function(_0x1e1920){if(_0x1e1920){_0x1c244d=_0x1e1920;_0x181059[_0x7fc7('0x44')]=_['keys'](db[_0x7fc7('0x73')][_0x7fc7('0x40')]);_0x181059[_0x7fc7('0x46')]=_[_0x7fc7('0x45')](_0x45ffdc[_0x7fc7('0x46')]);_0x181059['filters']=_[_0x7fc7('0x48')](_0x181059[_0x7fc7('0x44')],_0x181059[_0x7fc7('0x46')]);_0x416afc['attributes']=_[_0x7fc7('0x48')](_0x181059[_0x7fc7('0x44')],qs[_0x7fc7('0x4a')](_0x45ffdc['query']['fields']));_0x416afc[_0x7fc7('0x49')]=_0x416afc[_0x7fc7('0x49')][_0x7fc7('0x4b')]?_0x416afc[_0x7fc7('0x49')]:_0x181059[_0x7fc7('0x44')];_0x416afc[_0x7fc7('0x4e')]=qs[_0x7fc7('0x4f')](_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x4f')]);_0x416afc[_0x7fc7('0x50')]=qs[_0x7fc7('0x47')](_[_0x7fc7('0x51')](_0x45ffdc[_0x7fc7('0x46')],_0x181059['filters']));if(_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x68')]){_0x416afc['where']=_[_0x7fc7('0x53')](_0x416afc[_0x7fc7('0x50')],{'$or':_['map'](_0x416afc[_0x7fc7('0x49')],function(_0x342186){var _0x536aba={};_0x536aba[_0x342186]={'$like':'%'+_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x68')]+'%'};return _0x536aba;})});}_0x416afc=_[_0x7fc7('0x53')]({},_0x416afc,_0x45ffdc[_0x7fc7('0x54')]);return _0x1c244d['getAgents'](_0x416afc);}})[_0x7fc7('0x1f')](function(_0x337219){if(_0x337219){_0x4cfd93=_0x337219[_0x7fc7('0x4b')];if(!_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x4c')](_0x7fc7('0x4d'))){_0x416afc[_0x7fc7('0x2f')]=qs[_0x7fc7('0x2f')](_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x2f')]);_0x416afc[_0x7fc7('0x31')]=qs[_0x7fc7('0x31')](_0x45ffdc[_0x7fc7('0x46')][_0x7fc7('0x31')]);}return _0x1c244d['getAgents'](_0x416afc);}})[_0x7fc7('0x1f')](function(_0x1c6671){if(_0x1c6671){return _0x1c6671?{'count':_0x4cfd93,'rows':_0x1c6671}:null;}})[_0x7fc7('0x1f')](respondWithResult(_0x4c548e,null))[_0x7fc7('0x2a')](handleError(_0x4c548e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cbed7db..2719cce 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 _0x8c5a=['hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x59478c,_0x4416cf){var _0x28d205=function(_0x599c6c){while(--_0x599c6c){_0x59478c['push'](_0x59478c['shift']());}};_0x28d205(++_0x4416cf);}(_0x8c5a,0xfc));var _0xa8c5=function(_0x53310e,_0x11336d){_0x53310e=_0x53310e-0x0;var _0x32e9d6=_0x8c5a[_0x53310e];return _0x32e9d6;};'use strict';var EventEmitter=require(_0xa8c5('0x0'));var FaxAccount=require(_0xa8c5('0x1'))['db'][_0xa8c5('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa8c5('0x3')](0x0);var events={'afterCreate':_0xa8c5('0x4'),'afterUpdate':_0xa8c5('0x5'),'afterDestroy':_0xa8c5('0x6')};function emitEvent(_0x28d9c4){return function(_0x44d0a1,_0x95d3b9,_0xdac072){FaxAccountEvents[_0xa8c5('0x7')](_0x28d9c4+':'+_0x44d0a1['id'],_0x44d0a1);FaxAccountEvents[_0xa8c5('0x7')](_0x28d9c4,_0x44d0a1);_0xdac072(null);};}for(var e in events){if(events[_0xa8c5('0x8')](e)){var event=events[e];FaxAccount[_0xa8c5('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xaf23=['hook','exports','FaxAccount','setMaxListeners','save','remove','emit'];(function(_0x58ca94,_0x6bc8fa){var _0x5ad286=function(_0x5d5661){while(--_0x5d5661){_0x58ca94['push'](_0x58ca94['shift']());}};_0x5ad286(++_0x6bc8fa);}(_0xaf23,0x11a));var _0x3af2=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0xaf23[_0x1daebd];return _0x462a89;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x3af2('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3af2('0x1')](0x0);var events={'afterCreate':_0x3af2('0x2'),'afterUpdate':'update','afterDestroy':_0x3af2('0x3')};function emitEvent(_0x3d4943){return function(_0x47dd46,_0x10fc01,_0x4ccefa){FaxAccountEvents[_0x3af2('0x4')](_0x3d4943+':'+_0x47dd46['id'],_0x47dd46);FaxAccountEvents['emit'](_0x3d4943,_0x47dd46);_0x4ccefa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3af2('0x5')](e,emitEvent(event));}}module[_0x3af2('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ac74a5b..a408963 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 _0x74e7=['../../config/logger','api','bluebird','request-promise','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util'];(function(_0x1058ac,_0x1e8378){var _0x28aa14=function(_0x2054b8){while(--_0x2054b8){_0x1058ac['push'](_0x1058ac['shift']());}};_0x28aa14(++_0x1e8378);}(_0x74e7,0xa4));var _0x774e=function(_0xa5352f,_0x580fd7){_0xa5352f=_0xa5352f-0x0;var _0x2a7556=_0x74e7[_0xa5352f];return _0x2a7556;};'use strict';var _=require('lodash');var util=require(_0x774e('0x0'));var logger=require(_0x774e('0x1'))(_0x774e('0x2'));var moment=require('moment');var BPromise=require(_0x774e('0x3'));var rp=require(_0x774e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x774e('0x5'));var config=require('../../config/environment');var attributes=require(_0x774e('0x6'));module[_0x774e('0x7')]=function(_0x505fab,_0x47b834){return _0x505fab[_0x774e('0x8')](_0x774e('0x9'),attributes,{'tableName':_0x774e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1983=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','util'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x1983,0x13f));var _0x3198=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x1983[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0x3198('0x0'));var logger=require(_0x3198('0x1'))(_0x3198('0x2'));var moment=require(_0x3198('0x3'));var BPromise=require('bluebird');var rp=require(_0x3198('0x4'));var fs=require('fs');var path=require(_0x3198('0x5'));var rimraf=require(_0x3198('0x6'));var config=require(_0x3198('0x7'));var attributes=require(_0x3198('0x8'));module[_0x3198('0x9')]=function(_0x247bd5,_0x4bec06){return _0x247bd5['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f7837cc..be38077 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 _0x4c7f=['updatedAt','difference','CompanyId','ListId','isNil','from','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','list','applications','orderBy','priority','length','FaxInteraction','create','Contact\x20not\x20found','close','unmanaged','created','interaction','ContactId','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','FaxAccount,\x20%s,\x20%s','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','keys','createdAt'];(function(_0x56b71e,_0x3858d0){var _0x22623a=function(_0x1f1074){while(--_0x1f1074){_0x56b71e['push'](_0x56b71e['shift']());}};_0x22623a(++_0x3858d0);}(_0x4c7f,0x7e));var _0xf4c7=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4c7f[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0xf4c7('0x0'));var moment=require(_0xf4c7('0x1'));var BPromise=require(_0xf4c7('0x2'));var rs=require(_0xf4c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4c7('0x4'))['db'];var utils=require(_0xf4c7('0x5'));var logger=require(_0xf4c7('0x6'))(_0xf4c7('0x7'));var config=require(_0xf4c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf4c7('0x9')]['http']({'port':0x232c});config[_0xf4c7('0xa')]=_[_0xf4c7('0xb')](config[_0xf4c7('0xa')],{'host':_0xf4c7('0xc'),'port':0x18eb});var socket=require(_0xf4c7('0xd'))(new Redis(config['redis']));require(_0xf4c7('0xe'))[_0xf4c7('0xf')](socket);function respondWithRpcPromise(_0x52d05c,_0x285cbc,_0x4d6fa3){return new BPromise(function(_0x3d9d51,_0x344116){return client[_0xf4c7('0x10')](_0x52d05c,_0x4d6fa3)[_0xf4c7('0x11')](function(_0x1f6984){logger['info']('FaxAccount,\x20%s,\x20%s',_0x285cbc,'request\x20sent');logger[_0xf4c7('0x12')](_0xf4c7('0x13'),_0x285cbc,_0xf4c7('0x14'),JSON[_0xf4c7('0x15')](_0x1f6984));if(_0x1f6984[_0xf4c7('0x16')]){if(_0x1f6984[_0xf4c7('0x16')][_0xf4c7('0x17')]===0x1f4){logger[_0xf4c7('0x16')]('FaxAccount,\x20%s,\x20%s',_0x285cbc,_0x1f6984['error']['message']);return _0x344116(_0x1f6984[_0xf4c7('0x16')][_0xf4c7('0x18')]);}logger[_0xf4c7('0x16')]('FaxAccount,\x20%s,\x20%s',_0x285cbc,_0x1f6984[_0xf4c7('0x16')][_0xf4c7('0x18')]);return _0x3d9d51(_0x1f6984[_0xf4c7('0x16')][_0xf4c7('0x18')]);}else{logger[_0xf4c7('0x19')](_0xf4c7('0x1a'),_0x285cbc,_0xf4c7('0x14'));_0x3d9d51(_0x1f6984[_0xf4c7('0x1b')]['message']);}})['catch'](function(_0x1a7546){logger[_0xf4c7('0x16')](_0xf4c7('0x1a'),_0x285cbc,_0x1a7546);_0x344116(_0x1a7546);});});}exports[_0xf4c7('0x1c')]=function(_0x3b38c9){var _0x2bff67=this;return new Promise(function(_0x2bf5a4,_0xe9aacf){return db[_0xf4c7('0x1d')][_0xf4c7('0x1e')]({'raw':_0x3b38c9[_0xf4c7('0x1f')]?_0x3b38c9['options'][_0xf4c7('0x20')]===undefined?!![]:![]:!![],'where':_0x3b38c9['options']?_0x3b38c9[_0xf4c7('0x1f')][_0xf4c7('0x21')]||null:null,'attributes':_0x3b38c9[_0xf4c7('0x1f')]?_0x3b38c9['options'][_0xf4c7('0x22')]||null:null,'limit':_0x3b38c9[_0xf4c7('0x1f')]?_0x3b38c9[_0xf4c7('0x1f')][_0xf4c7('0x23')]||null:null,'include':_0x3b38c9[_0xf4c7('0x1f')]?_0x3b38c9[_0xf4c7('0x1f')][_0xf4c7('0x24')]?_[_0xf4c7('0x25')](_0x3b38c9['options'][_0xf4c7('0x24')],function(_0x1093e6){return{'model':db[_0x1093e6['model']],'as':_0x1093e6['as'],'attributes':_0x1093e6[_0xf4c7('0x22')],'include':_0x1093e6[_0xf4c7('0x24')]?_['map'](_0x1093e6[_0xf4c7('0x24')],function(_0x64a2bd){return{'model':db[_0x64a2bd[_0xf4c7('0x26')]],'as':_0x64a2bd['as'],'attributes':_0x64a2bd[_0xf4c7('0x22')],'include':_0x64a2bd[_0xf4c7('0x24')]?_['map'](_0x64a2bd[_0xf4c7('0x24')],function(_0xad8cf3){return{'model':db[_0xad8cf3[_0xf4c7('0x26')]],'as':_0xad8cf3['as'],'attributes':_0xad8cf3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e0ab7){logger[_0xf4c7('0x19')](_0xf4c7('0x1c'),_0x3b38c9);logger[_0xf4c7('0x12')](_0xf4c7('0x1c'),_0x3b38c9,JSON['stringify'](_0x5e0ab7));_0x2bf5a4(_0x5e0ab7);})[_0xf4c7('0x27')](function(_0x28c79b){logger[_0xf4c7('0x16')](_0xf4c7('0x1c'),_0x28c79b[_0xf4c7('0x18')],_0x3b38c9);_0xe9aacf(_0x2bff67[_0xf4c7('0x16')](0x1f4,_0x28c79b[_0xf4c7('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x522026,_0x4bf364,_0x325e8c){var _0x2f9129=this;return new Promise(function(_0x32602c,_0x4798a8){var _0x54b573={'body':_0x522026[_0xf4c7('0x28')],'channel':_0xf4c7('0x29')};var _0x353aaa=[];var _0x3af270=[];var _0x1f0f75={};return db[_0xf4c7('0x2a')][_0xf4c7('0x2b')]()[_0xf4c7('0x11')](function(_0x454346){if(!_0x454346){throw new db[(_0xf4c7('0x2c'))]['ValidationError'](_0xf4c7('0x2d'));}_0x353aaa=_['difference'](_[_0xf4c7('0x2e')](_0x454346),[_0xf4c7('0x2f'),_0xf4c7('0x30')]);_0x3af270=_[_0xf4c7('0x31')](_['keys'](_0x454346),['createdAt',_0xf4c7('0x30'),_0xf4c7('0x32'),_0xf4c7('0x33')]);if(_0x522026[_0xf4c7('0x28')]['id']){delete _0x522026[_0xf4c7('0x28')]['id'];}if(_[_0xf4c7('0x34')](_0x522026[_0xf4c7('0x28')][_0xf4c7('0x35')])){throw new db[(_0xf4c7('0x2c'))][(_0xf4c7('0x36'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x522026[_0xf4c7('0x28')]['body'])||_0x522026['body'][_0xf4c7('0x28')]===''){throw new db[(_0xf4c7('0x2c'))][(_0xf4c7('0x36'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf4c7('0x34')](_0x522026[_0xf4c7('0x28')][_0xf4c7('0x37')])){throw new db[(_0xf4c7('0x2c'))][(_0xf4c7('0x36'))](_0xf4c7('0x38')+_0x3af270);}if(!_['includes'](_0x3af270,_0x522026[_0xf4c7('0x28')]['mapKey'])){throw new db[(_0xf4c7('0x2c'))][(_0xf4c7('0x36'))](_0xf4c7('0x39')+_0x3af270);}_0x1f0f75[_0x522026[_0xf4c7('0x28')]['mapKey']]=_0x522026['body']['from'];})[_0xf4c7('0x11')](function(){return db[_0xf4c7('0x1d')][_0xf4c7('0x3a')]({'where':{'id':_0x522026[_0xf4c7('0x3b')]['id']},'include':[{'model':db[_0xf4c7('0x3c')],'as':_0xf4c7('0x3d'),'include':[{'model':db[_0xf4c7('0x2a')],'as':_0xf4c7('0x3e'),'where':_0x1f0f75,'limit':0x1,'order':[[_0xf4c7('0x30'),_0xf4c7('0x3f')]]}]},{'model':db[_0xf4c7('0x40')],'as':_0xf4c7('0x41')}]});})['then'](function(_0x3038d9){if(_0x3038d9&&_0x3038d9[_0xf4c7('0x3d')]){var _0x16edb7=_0x3038d9['get']({'plain':!![]});_0x54b573[_0xf4c7('0x3b')]=_0x16edb7;_0x54b573['applications']=_0x16edb7['Applications'];_0x54b573[_0xf4c7('0x42')]=_0x16edb7[_0xf4c7('0x3d')];_0x54b573[_0xf4c7('0x43')]=_[_0xf4c7('0x44')](_0x54b573['applications'],[_0xf4c7('0x45')],['asc']);if(_0x54b573[_0xf4c7('0x3b')][_0xf4c7('0x41')]){delete _0x54b573[_0xf4c7('0x3b')][_0xf4c7('0x41')];}if(_0x54b573[_0xf4c7('0x3b')][_0xf4c7('0x3d')]&&_0x54b573[_0xf4c7('0x3b')][_0xf4c7('0x3d')][_0xf4c7('0x3e')][_0xf4c7('0x46')]){return _0x54b573[_0xf4c7('0x3b')][_0xf4c7('0x3d')][_0xf4c7('0x3e')][0x0];}var _0x34da34=_['defaults'](_0x522026[_0xf4c7('0x28')],{'firstName':_0x522026['body'][_0xf4c7('0x35')],'ListId':_0x16edb7[_0xf4c7('0x33')]});_0x34da34[_0x522026[_0xf4c7('0x28')][_0xf4c7('0x37')]]=_0x522026[_0xf4c7('0x28')][_0xf4c7('0x35')];return db[_0xf4c7('0x2a')]['create'](_0x34da34,{'fields':_0x353aaa,'raw':!![]});}})[_0xf4c7('0x11')](function(_0x44728f){_0x54b573['contact']=_0x44728f;if(_0x44728f){var _0x381041={'ContactId':_0x44728f['id'],'FaxAccountId':_0x522026[_0xf4c7('0x3b')]['id'],'fax':_0x44728f[_0xf4c7('0x29')]};return db[_0xf4c7('0x47')][_0xf4c7('0x3a')]({'where':{'ContactId':_0x44728f['id'],'closed':![],'FaxAccountId':_0x522026[_0xf4c7('0x3b')]['id']}})[_0xf4c7('0x11')](function(_0x2533a2){if(_0x2533a2){return[_0x2533a2,![]];}return db[_0xf4c7('0x47')][_0xf4c7('0x48')](_0x381041)['then'](function(_0x4cef7f){return[_0x4cef7f,!![]];});});}else{throw new Error(_0xf4c7('0x49'));}})['spread'](function(_0x301dd9,_0x3005eb){var _0x5e70bd=_0x301dd9['get']({'plain':!![]});if(_0x3005eb){if(_0x54b573['account']['autoclose']){_0x54b573[_0xf4c7('0x43')]['push']({'id':0x0,'priority':_0x54b573[_0xf4c7('0x43')][_0xf4c7('0x46')]+0x1,'app':_0xf4c7('0x4a'),'appdata':_0xf4c7('0x4b'),'interval':'*,*,*,*'});}_0x5e70bd[_0xf4c7('0x4c')]=!![];}else{_0x5e70bd[_0xf4c7('0x4c')]=![];}_0x54b573[_0xf4c7('0x4d')]=_0x5e70bd;return db['FaxMessage']['create']({'body':_0x522026['body'][_0xf4c7('0x28')],'FaxAccountId':_0x522026[_0xf4c7('0x3b')]['id'],'FaxInteractionId':_0x301dd9['id'],'direction':'in','ContactId':_0x301dd9[_0xf4c7('0x4e')],'AttachmentId':_0x522026['body']['AttachmentId']});})[_0xf4c7('0x11')](function(_0x31497b){_0x54b573[_0xf4c7('0x18')]=_0x31497b;if(_0x54b573['interaction'][_0xf4c7('0x4f')]){return db['User']['find']({'attributes':['id',_0xf4c7('0x50')],'where':{'id':_0x54b573[_0xf4c7('0x4d')]['UserId']}})['then'](function(_0x5db205){if(_0x5db205){_0x54b573[_0xf4c7('0x43')][_0xf4c7('0x51')]({'id':0x0,'priority':0x0,'app':_0xf4c7('0x52'),'appdata':_0x5db205['name']+','+(_0x54b573['account'][_0xf4c7('0x53')]||0xa),'interval':_0xf4c7('0x54')});}return respondWithRpcPromise('Start','startRouting',_0x54b573);});}return respondWithRpcPromise(_0xf4c7('0x55'),_0xf4c7('0x56'),_0x54b573);})['then'](function(_0x2da7fd){_0x32602c(_0x2da7fd);})[_0xf4c7('0x27')](function(_0x460af0){_0x4798a8(_0x2f9129[_0xf4c7('0x16')](0x1f4,_0x460af0[_0xf4c7('0x18')]));});});}; \ No newline at end of file +var _0x42ed=['model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','get','applications','priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','FaxAccount','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x4cce3e,_0x4a1349){var _0x391e08=function(_0x4b6708){while(--_0x4b6708){_0x4cce3e['push'](_0x4cce3e['shift']());}};_0x391e08(++_0x4a1349);}(_0x42ed,0x142));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd42e('0x0'));var moment=require(_0xd42e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd42e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd42e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd42e('0x4'))(_0xd42e('0x5'));var config=require(_0xd42e('0x6'));var jayson=require(_0xd42e('0x7'));var client=jayson[_0xd42e('0x8')][_0xd42e('0x9')]({'port':0x232c});config[_0xd42e('0xa')]=_['defaults'](config[_0xd42e('0xa')],{'host':_0xd42e('0xb'),'port':0x18eb});var socket=require(_0xd42e('0xc'))(new Redis(config[_0xd42e('0xa')]));require('./faxAccount.socket')[_0xd42e('0xd')](socket);function respondWithRpcPromise(_0x1837e0,_0x90ff7c,_0x38076b){return new BPromise(function(_0x482f38,_0x4097df){return client['request'](_0x1837e0,_0x38076b)[_0xd42e('0xe')](function(_0x153a13){logger['info'](_0xd42e('0xf'),_0x90ff7c,_0xd42e('0x10'));logger[_0xd42e('0x11')](_0xd42e('0x12'),_0x90ff7c,_0xd42e('0x10'),JSON[_0xd42e('0x13')](_0x153a13));if(_0x153a13[_0xd42e('0x14')]){if(_0x153a13['error'][_0xd42e('0x15')]===0x1f4){logger['error'](_0xd42e('0xf'),_0x90ff7c,_0x153a13[_0xd42e('0x14')]['message']);return _0x4097df(_0x153a13[_0xd42e('0x14')][_0xd42e('0x16')]);}logger[_0xd42e('0x14')](_0xd42e('0xf'),_0x90ff7c,_0x153a13['error'][_0xd42e('0x16')]);return _0x482f38(_0x153a13[_0xd42e('0x14')][_0xd42e('0x16')]);}else{logger[_0xd42e('0x17')](_0xd42e('0xf'),_0x90ff7c,_0xd42e('0x10'));_0x482f38(_0x153a13[_0xd42e('0x18')][_0xd42e('0x16')]);}})['catch'](function(_0x486691){logger[_0xd42e('0x14')]('FaxAccount,\x20%s,\x20%s',_0x90ff7c,_0x486691);_0x4097df(_0x486691);});});}exports['GetFaxAccount']=function(_0x2d2c29){var _0x276f78=this;return new Promise(function(_0x3bd25e,_0x32d6f4){return db[_0xd42e('0x19')][_0xd42e('0x1a')]({'raw':_0x2d2c29['options']?_0x2d2c29['options'][_0xd42e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d2c29[_0xd42e('0x1c')]?_0x2d2c29[_0xd42e('0x1c')][_0xd42e('0x1d')]||null:null,'attributes':_0x2d2c29[_0xd42e('0x1c')]?_0x2d2c29[_0xd42e('0x1c')][_0xd42e('0x1e')]||null:null,'limit':_0x2d2c29['options']?_0x2d2c29[_0xd42e('0x1c')][_0xd42e('0x1f')]||null:null,'include':_0x2d2c29['options']?_0x2d2c29[_0xd42e('0x1c')][_0xd42e('0x20')]?_[_0xd42e('0x21')](_0x2d2c29[_0xd42e('0x1c')][_0xd42e('0x20')],function(_0x43c0c0){return{'model':db[_0x43c0c0['model']],'as':_0x43c0c0['as'],'attributes':_0x43c0c0[_0xd42e('0x1e')],'include':_0x43c0c0[_0xd42e('0x20')]?_['map'](_0x43c0c0[_0xd42e('0x20')],function(_0x4b076d){return{'model':db[_0x4b076d[_0xd42e('0x22')]],'as':_0x4b076d['as'],'attributes':_0x4b076d[_0xd42e('0x1e')],'include':_0x4b076d[_0xd42e('0x20')]?_[_0xd42e('0x21')](_0x4b076d[_0xd42e('0x20')],function(_0x3a155b){return{'model':db[_0x3a155b[_0xd42e('0x22')]],'as':_0x3a155b['as'],'attributes':_0x3a155b[_0xd42e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd42e('0xe')](function(_0x23c042){logger['info'](_0xd42e('0x23'),_0x2d2c29);logger[_0xd42e('0x11')](_0xd42e('0x23'),_0x2d2c29,JSON[_0xd42e('0x13')](_0x23c042));_0x3bd25e(_0x23c042);})[_0xd42e('0x24')](function(_0x4e777a){logger['error'](_0xd42e('0x23'),_0x4e777a[_0xd42e('0x16')],_0x2d2c29);_0x32d6f4(_0x276f78['error'](0x1f4,_0x4e777a[_0xd42e('0x16')]));});});};exports[_0xd42e('0x25')]=function(_0x38210a,_0x247935,_0x5ed508){var _0x3551d9=this;return new Promise(function(_0x4856d6,_0x1996c0){var _0xb4549d={'body':_0x38210a[_0xd42e('0x26')],'channel':_0xd42e('0x27')};var _0x22cdac=[];var _0x89c383=[];var _0x1bb8e0={};return db['CmContact'][_0xd42e('0x28')]()[_0xd42e('0xe')](function(_0x58551d){if(!_0x58551d){throw new db[(_0xd42e('0x29'))][(_0xd42e('0x2a'))]('no\x20available\x20attributes');}_0x22cdac=_['difference'](_[_0xd42e('0x2b')](_0x58551d),[_0xd42e('0x2c'),_0xd42e('0x2d')]);_0x89c383=_[_0xd42e('0x2e')](_[_0xd42e('0x2b')](_0x58551d),[_0xd42e('0x2c'),'updatedAt',_0xd42e('0x2f'),_0xd42e('0x30')]);if(_0x38210a['body']['id']){delete _0x38210a[_0xd42e('0x26')]['id'];}if(_[_0xd42e('0x31')](_0x38210a[_0xd42e('0x26')][_0xd42e('0x32')])){throw new db[(_0xd42e('0x29'))]['ValidationError'](_0xd42e('0x33'));}if(_[_0xd42e('0x31')](_0x38210a[_0xd42e('0x26')][_0xd42e('0x26')])||_0x38210a[_0xd42e('0x26')][_0xd42e('0x26')]===''){throw new db[(_0xd42e('0x29'))][(_0xd42e('0x2a'))](_0xd42e('0x34'));}if(_[_0xd42e('0x31')](_0x38210a[_0xd42e('0x26')][_0xd42e('0x35')])){throw new db['Sequelize'][(_0xd42e('0x2a'))](_0xd42e('0x36')+_0x89c383);}if(!_[_0xd42e('0x37')](_0x89c383,_0x38210a['body'][_0xd42e('0x35')])){throw new db[(_0xd42e('0x29'))]['ValidationError'](_0xd42e('0x38')+_0x89c383);}_0x1bb8e0[_0x38210a['body'][_0xd42e('0x35')]]=_0x38210a[_0xd42e('0x26')]['from'];})[_0xd42e('0xe')](function(){return db[_0xd42e('0x19')][_0xd42e('0x39')]({'where':{'id':_0x38210a[_0xd42e('0x3a')]['id']},'include':[{'model':db[_0xd42e('0x3b')],'as':_0xd42e('0x3c'),'include':[{'model':db[_0xd42e('0x3d')],'as':_0xd42e('0x3e'),'where':_0x1bb8e0,'limit':0x1,'order':[[_0xd42e('0x2d'),'DESC']]}]},{'model':db[_0xd42e('0x3f')],'as':_0xd42e('0x40')}]});})[_0xd42e('0xe')](function(_0x248c16){if(_0x248c16&&_0x248c16[_0xd42e('0x3c')]){var _0x352d97=_0x248c16[_0xd42e('0x41')]({'plain':!![]});_0xb4549d['account']=_0x352d97;_0xb4549d['applications']=_0x352d97['Applications'];_0xb4549d['list']=_0x352d97['List'];_0xb4549d[_0xd42e('0x42')]=_['orderBy'](_0xb4549d[_0xd42e('0x42')],[_0xd42e('0x43')],['asc']);if(_0xb4549d[_0xd42e('0x3a')][_0xd42e('0x40')]){delete _0xb4549d[_0xd42e('0x3a')][_0xd42e('0x40')];}if(_0xb4549d['account']['List']&&_0xb4549d[_0xd42e('0x3a')]['List'][_0xd42e('0x3e')][_0xd42e('0x44')]){return _0xb4549d[_0xd42e('0x3a')][_0xd42e('0x3c')][_0xd42e('0x3e')][0x0];}var _0x509ff6=_[_0xd42e('0x45')](_0x38210a['body'],{'firstName':_0x38210a['body']['from'],'ListId':_0x352d97[_0xd42e('0x30')]});_0x509ff6[_0x38210a[_0xd42e('0x26')][_0xd42e('0x35')]]=_0x38210a[_0xd42e('0x26')]['from'];return db[_0xd42e('0x3d')][_0xd42e('0x46')](_0x509ff6,{'fields':_0x22cdac,'raw':!![]});}})['then'](function(_0x40da4d){_0xb4549d[_0xd42e('0x47')]=_0x40da4d;if(_0x40da4d){var _0x2be386={'ContactId':_0x40da4d['id'],'FaxAccountId':_0x38210a[_0xd42e('0x3a')]['id'],'fax':_0x40da4d[_0xd42e('0x27')]};return db[_0xd42e('0x48')][_0xd42e('0x39')]({'where':{'ContactId':_0x40da4d['id'],'closed':![],'FaxAccountId':_0x38210a[_0xd42e('0x3a')]['id']}})[_0xd42e('0xe')](function(_0x5f6288){if(_0x5f6288){return[_0x5f6288,![]];}return db[_0xd42e('0x48')][_0xd42e('0x46')](_0x2be386)[_0xd42e('0xe')](function(_0x4a29a8){return[_0x4a29a8,!![]];});});}else{throw new Error(_0xd42e('0x49'));}})['spread'](function(_0x5e127b,_0x49adbc){var _0x11dccf=_0x5e127b[_0xd42e('0x41')]({'plain':!![]});if(_0x49adbc){if(_0xb4549d['account'][_0xd42e('0x4a')]){_0xb4549d['applications']['push']({'id':0x0,'priority':_0xb4549d['applications'][_0xd42e('0x44')]+0x1,'app':_0xd42e('0x4b'),'appdata':_0xd42e('0x4c'),'interval':'*,*,*,*'});}_0x11dccf[_0xd42e('0x4d')]=!![];}else{_0x11dccf['created']=![];}_0xb4549d[_0xd42e('0x4e')]=_0x11dccf;return db['FaxMessage']['create']({'body':_0x38210a[_0xd42e('0x26')][_0xd42e('0x26')],'FaxAccountId':_0x38210a['account']['id'],'FaxInteractionId':_0x5e127b['id'],'direction':'in','ContactId':_0x5e127b[_0xd42e('0x4f')],'AttachmentId':_0x38210a['body'][_0xd42e('0x50')]});})['then'](function(_0x249a1f){_0xb4549d[_0xd42e('0x16')]=_0x249a1f;if(_0xb4549d[_0xd42e('0x4e')][_0xd42e('0x51')]){return db[_0xd42e('0x52')][_0xd42e('0x39')]({'attributes':['id',_0xd42e('0x53')],'where':{'id':_0xb4549d[_0xd42e('0x4e')][_0xd42e('0x51')]}})[_0xd42e('0xe')](function(_0x660878){if(_0x660878){_0xb4549d[_0xd42e('0x42')][_0xd42e('0x54')]({'id':0x0,'priority':0x0,'app':_0xd42e('0x55'),'appdata':_0x660878[_0xd42e('0x53')]+','+(_0xb4549d[_0xd42e('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0xd42e('0x56')});}return respondWithRpcPromise(_0xd42e('0x57'),_0xd42e('0x58'),_0xb4549d);});}return respondWithRpcPromise(_0xd42e('0x57'),_0xd42e('0x58'),_0xb4549d);})[_0xd42e('0xe')](function(_0x57b987){_0x4856d6(_0x57b987);})[_0xd42e('0x24')](function(_0x1b3f46){_0x1996c0(_0x3551d9['error'](0x1f4,_0x1b3f46['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a9d89d5..da94c4a 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 _0xde9c=['length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener','register'];(function(_0x376226,_0x430f59){var _0x51fa58=function(_0x546ab4){while(--_0x546ab4){_0x376226['push'](_0x376226['shift']());}};_0x51fa58(++_0x430f59);}(_0xde9c,0x152));var _0xcde9=function(_0x5ebbef,_0x76675c){_0x5ebbef=_0x5ebbef-0x0;var _0x195422=_0xde9c[_0x5ebbef];return _0x195422;};'use strict';var FaxAccountEvents=require(_0xcde9('0x0'));var events=['save',_0xcde9('0x1'),_0xcde9('0x2')];function createListener(_0x167d8b,_0x2b9c26){return function(_0x151f89){_0x2b9c26[_0xcde9('0x3')](_0x167d8b,_0x151f89);};}function removeListener(_0x31b100,_0x20006e){return function(){FaxAccountEvents[_0xcde9('0x4')](_0x31b100,_0x20006e);};}exports[_0xcde9('0x5')]=function(_0x2654fb){for(var _0x285e71=0x0,_0x35354d=events[_0xcde9('0x6')];_0x285e71<_0x35354d;_0x285e71++){var _0x4987a3=events[_0x285e71];var _0x53b45d=createListener(_0xcde9('0x7')+_0x4987a3,_0x2654fb);FaxAccountEvents['on'](_0x4987a3,_0x53b45d);}}; \ No newline at end of file +var _0x67e8=['remove','update','emit','register','length','./faxAccount.events','save'];(function(_0x1044bc,_0x2865be){var _0x25d869=function(_0x381b10){while(--_0x381b10){_0x1044bc['push'](_0x1044bc['shift']());}};_0x25d869(++_0x2865be);}(_0x67e8,0xb4));var _0x867e=function(_0x72fcbd,_0x21b050){_0x72fcbd=_0x72fcbd-0x0;var _0x44dca1=_0x67e8[_0x72fcbd];return _0x44dca1;};'use strict';var FaxAccountEvents=require(_0x867e('0x0'));var events=[_0x867e('0x1'),_0x867e('0x2'),_0x867e('0x3')];function createListener(_0x2d8757,_0x272cb3){return function(_0x4ddf6b){_0x272cb3[_0x867e('0x4')](_0x2d8757,_0x4ddf6b);};}function removeListener(_0x12fae5,_0x3bffaa){return function(){FaxAccountEvents['removeListener'](_0x12fae5,_0x3bffaa);};}exports[_0x867e('0x5')]=function(_0x4c5701){for(var _0x4ebd99=0x0,_0x442920=events[_0x867e('0x6')];_0x4ebd99<_0x442920;_0x4ebd99++){var _0x5af2b2=events[_0x4ebd99];var _0x593ddc=createListener('faxAccount:'+_0x5af2b2,_0x4c5701);FaxAccountEvents['on'](_0x5af2b2,_0x593ddc);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 72f8035..c2a3e03 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(_0x373afd,_0x4afa02){var _0x48a7a9=function(_0x5787ce){while(--_0x5787ce){_0x373afd['push'](_0x373afd['shift']());}};_0x48a7a9(++_0x4afa02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0xc752b4,_0x2999c7){var _0x135cd5=function(_0x30de89){while(--_0x30de89){_0xc752b4['push'](_0xc752b4['shift']());}};_0x135cd5(++_0x2999c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 b483be9..6e5f984 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 _0xb8c8=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x2b3d7d,_0x55a11e){var _0x137475=function(_0x42949c){while(--_0x42949c){_0x2b3d7d['push'](_0x2b3d7d['shift']());}};_0x137475(++_0x55a11e);}(_0xb8c8,0xb4));var _0x8b8c=function(_0x2d6a45,_0x318b2d){_0x2d6a45=_0x2d6a45-0x0;var _0x1f5734=_0xb8c8[_0x2d6a45];return _0x1f5734;};'use strict';var Sequelize=require(_0x8b8c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8b8c('0x1')],'allowNull':![],'defaultValue':_0x8b8c('0x2')},'appdata':{'type':Sequelize[_0x8b8c('0x3')]()},'description':{'type':Sequelize[_0x8b8c('0x1')]},'interval':{'type':Sequelize[_0x8b8c('0x1')],'defaultValue':_0x8b8c('0x4')}}; \ No newline at end of file +var _0x49a6=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x49a6,0x147));var _0x649a=function(_0x3f3177,_0x5a2912){_0x3f3177=_0x3f3177-0x0;var _0x3935c0=_0x49a6[_0x3f3177];return _0x3935c0;};'use strict';var Sequelize=require('sequelize');module[_0x649a('0x0')]={'priority':{'type':Sequelize[_0x649a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x649a('0x2')],'allowNull':![],'defaultValue':_0x649a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x649a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x649a('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index af625f0..4c79466 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 _0xac1f=['bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','limit','count','set','Content-Range','apply','then','stack','name','map','FaxApplication','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','eml-format','fast-json-patch'];(function(_0x3a35f1,_0x52e050){var _0x5bdca8=function(_0x48217e){while(--_0x48217e){_0x3a35f1['push'](_0x3a35f1['shift']());}};_0x5bdca8(++_0x52e050);}(_0xac1f,0x17e));var _0xfac1=function(_0x509bc7,_0x1fb56b){_0x509bc7=_0x509bc7-0x0;var _0x15c686=_0xac1f[_0x509bc7];return _0x15c686;};'use strict';var emlformat=require(_0xfac1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfac1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfac1('0x2'));var Mustache=require(_0xfac1('0x3'));var util=require(_0xfac1('0x4'));var path=require('path');var sox=require(_0xfac1('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfac1('0x6'));var _=require(_0xfac1('0x7'));var squel=require(_0xfac1('0x8'));var crypto=require(_0xfac1('0x9'));var jsforce=require(_0xfac1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfac1('0xb'));var querystring=require('querystring');var Papa=require(_0xfac1('0xc'));var Redis=require(_0xfac1('0xd'));var authService=require(_0xfac1('0xe'));var qs=require(_0xfac1('0xf'));var as=require(_0xfac1('0x10'));var hardwareService=require(_0xfac1('0x11'));var logger=require(_0xfac1('0x12'))(_0xfac1('0x13'));var utils=require('../../config/utils');var config=require(_0xfac1('0x14'));var licenseUtil=require(_0xfac1('0x15'));var db=require(_0xfac1('0x16'))['db'];function respondWithStatusCode(_0x51cb2f,_0x2db771){_0x2db771=_0x2db771||0xcc;return function(_0x3b998f){if(_0x3b998f){return _0x51cb2f[_0xfac1('0x17')](_0x2db771);}return _0x51cb2f[_0xfac1('0x18')](_0x2db771)['end']();};}function respondWithResult(_0x294a9e,_0x2d8dd1){_0x2d8dd1=_0x2d8dd1||0xc8;return function(_0x5c64cc){if(_0x5c64cc){return _0x294a9e[_0xfac1('0x18')](_0x2d8dd1)['json'](_0x5c64cc);}};}function respondWithFilteredResult(_0x3ebcd1,_0x4d4960){return function(_0x30ba69){if(_0x30ba69){var _0x4fa690=typeof _0x4d4960[_0xfac1('0x19')]===_0xfac1('0x1a')&&typeof _0x4d4960[_0xfac1('0x1b')]===_0xfac1('0x1a');var _0x2d94d5=_0x30ba69[_0xfac1('0x1c')];var _0x22237a=_0x4fa690?0x0:_0x4d4960['offset'];var _0x40b85e=_0x4fa690?_0x30ba69[_0xfac1('0x1c')]:_0x4d4960[_0xfac1('0x19')]+_0x4d4960[_0xfac1('0x1b')];var _0xebef45;if(_0x40b85e>=_0x2d94d5){_0x40b85e=_0x2d94d5;_0xebef45=0xc8;}else{_0xebef45=0xce;}_0x3ebcd1[_0xfac1('0x18')](_0xebef45);return _0x3ebcd1[_0xfac1('0x1d')](_0xfac1('0x1e'),_0x22237a+'-'+_0x40b85e+'/'+_0x2d94d5)['json'](_0x30ba69);}return null;};}function patchUpdates(_0x14f1fb){return function(_0x2fd264){try{jsonpatch[_0xfac1('0x1f')](_0x2fd264,_0x14f1fb,!![]);}catch(_0x58702c){return BPromise['reject'](_0x58702c);}return _0x2fd264['save']();};}function saveUpdates(_0x3ef75f,_0x1b54c0){return function(_0x485c65){if(_0x485c65){return _0x485c65['update'](_0x3ef75f)[_0xfac1('0x20')](function(_0x4b90c3){return _0x4b90c3;});}return null;};}function removeEntity(_0x28c3cb,_0x4a5ccf){return function(_0x3fa217){if(_0x3fa217){return _0x3fa217['destroy']()['then'](function(){_0x28c3cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x248c72,_0x1aad6f){return function(_0x4ad106){if(!_0x4ad106){_0x248c72[_0xfac1('0x17')](0x194);}return _0x4ad106;};}function handleError(_0x33ae33,_0x35388b){_0x35388b=_0x35388b||0x1f4;return function(_0x377cd3){logger['error'](_0x377cd3[_0xfac1('0x21')]);if(_0x377cd3[_0xfac1('0x22')]){delete _0x377cd3[_0xfac1('0x22')];}_0x33ae33[_0xfac1('0x18')](_0x35388b)['send'](_0x377cd3);};}exports['index']=function(_0x304443,_0x336cc1){var _0x35860d={},_0x5f107c={},_0x17be8f={'count':0x0,'rows':[]};var _0x3b7f4b=_[_0xfac1('0x23')](db[_0xfac1('0x24')]['rawAttributes'],function(_0x544d92){return{'name':_0x544d92['fieldName'],'type':_0x544d92[_0xfac1('0x25')]['key']};});_0x5f107c[_0xfac1('0x26')]=_[_0xfac1('0x23')](_0x3b7f4b,'name');_0x5f107c[_0xfac1('0x27')]=_[_0xfac1('0x28')](_0x304443[_0xfac1('0x27')]);_0x5f107c[_0xfac1('0x29')]=_[_0xfac1('0x2a')](_0x5f107c[_0xfac1('0x26')],_0x5f107c['query']);_0x35860d['attributes']=_[_0xfac1('0x2a')](_0x5f107c[_0xfac1('0x26')],qs[_0xfac1('0x2b')](_0x304443[_0xfac1('0x27')][_0xfac1('0x2b')]));_0x35860d[_0xfac1('0x2c')]=_0x35860d[_0xfac1('0x2c')][_0xfac1('0x2d')]?_0x35860d[_0xfac1('0x2c')]:_0x5f107c['model'];if(!_0x304443[_0xfac1('0x27')][_0xfac1('0x2e')]('nolimit')){_0x35860d[_0xfac1('0x1b')]=qs['limit'](_0x304443[_0xfac1('0x27')]['limit']);_0x35860d['offset']=qs['offset'](_0x304443[_0xfac1('0x27')][_0xfac1('0x19')]);}_0x35860d['order']=qs[_0xfac1('0x2f')](_0x304443[_0xfac1('0x27')]['sort']);_0x35860d[_0xfac1('0x30')]=qs['filters'](_[_0xfac1('0x31')](_0x304443[_0xfac1('0x27')],_0x5f107c[_0xfac1('0x29')]),_0x3b7f4b);if(_0x304443['query'][_0xfac1('0x32')]){_0x35860d[_0xfac1('0x30')]=_[_0xfac1('0x33')](_0x35860d[_0xfac1('0x30')],{'$or':_[_0xfac1('0x23')](_0x3b7f4b,function(_0x556f97){if(_0x556f97[_0xfac1('0x25')]!==_0xfac1('0x34')){var _0x34c0e8={};_0x34c0e8[_0x556f97[_0xfac1('0x22')]]={'$like':'%'+_0x304443['query'][_0xfac1('0x32')]+'%'};return _0x34c0e8;}})});}_0x35860d=_[_0xfac1('0x33')]({},_0x35860d,_0x304443[_0xfac1('0x35')]);var _0x13519b={'where':_0x35860d[_0xfac1('0x30')]};return db['FaxApplication'][_0xfac1('0x1c')](_0x13519b)[_0xfac1('0x20')](function(_0x7f8d4b){_0x17be8f[_0xfac1('0x1c')]=_0x7f8d4b;if(_0x304443[_0xfac1('0x27')][_0xfac1('0x36')]){_0x35860d[_0xfac1('0x37')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x35860d);})[_0xfac1('0x20')](function(_0x2680cc){_0x17be8f[_0xfac1('0x38')]=_0x2680cc;return _0x17be8f;})[_0xfac1('0x20')](respondWithFilteredResult(_0x336cc1,_0x35860d))[_0xfac1('0x39')](handleError(_0x336cc1,null));};exports['show']=function(_0x3d38f1,_0x195876){var _0x187059={'raw':!![],'where':{'id':_0x3d38f1[_0xfac1('0x3a')]['id']}},_0x2fe828={};_0x2fe828['model']=_['keys'](db['FaxApplication'][_0xfac1('0x3b')]);_0x2fe828[_0xfac1('0x27')]=_['keys'](_0x3d38f1['query']);_0x2fe828[_0xfac1('0x29')]=_[_0xfac1('0x2a')](_0x2fe828[_0xfac1('0x26')],_0x2fe828['query']);_0x187059[_0xfac1('0x2c')]=_[_0xfac1('0x2a')](_0x2fe828['model'],qs['fields'](_0x3d38f1['query']['fields']));_0x187059['attributes']=_0x187059[_0xfac1('0x2c')][_0xfac1('0x2d')]?_0x187059[_0xfac1('0x2c')]:_0x2fe828[_0xfac1('0x26')];if(_0x3d38f1['query']['includeAll']){_0x187059[_0xfac1('0x37')]=[{'all':!![]}];}_0x187059=_[_0xfac1('0x33')]({},_0x187059,_0x3d38f1[_0xfac1('0x35')]);return db[_0xfac1('0x24')][_0xfac1('0x3c')](_0x187059)[_0xfac1('0x20')](handleEntityNotFound(_0x195876,null))[_0xfac1('0x20')](respondWithResult(_0x195876,null))[_0xfac1('0x39')](handleError(_0x195876,null));};exports[_0xfac1('0x3d')]=function(_0x191f7f,_0x565890){return db[_0xfac1('0x24')][_0xfac1('0x3d')](_0x191f7f[_0xfac1('0x3e')],{})[_0xfac1('0x20')](respondWithResult(_0x565890,0xc9))['catch'](handleError(_0x565890,null));};exports[_0xfac1('0x3f')]=function(_0x15ba97,_0x5ac12a){if(_0x15ba97[_0xfac1('0x3e')]['id']){delete _0x15ba97[_0xfac1('0x3e')]['id'];}return db[_0xfac1('0x24')][_0xfac1('0x3c')]({'where':{'id':_0x15ba97[_0xfac1('0x3a')]['id']}})[_0xfac1('0x20')](handleEntityNotFound(_0x5ac12a,null))[_0xfac1('0x20')](saveUpdates(_0x15ba97[_0xfac1('0x3e')],null))['then'](respondWithResult(_0x5ac12a,null))[_0xfac1('0x39')](handleError(_0x5ac12a,null));};exports['destroy']=function(_0x1af130,_0x243d54){return db[_0xfac1('0x24')][_0xfac1('0x3c')]({'where':{'id':_0x1af130['params']['id']}})[_0xfac1('0x20')](handleEntityNotFound(_0x243d54,null))[_0xfac1('0x20')](removeEntity(_0x243d54,null))[_0xfac1('0x39')](handleError(_0x243d54,null));}; \ No newline at end of file +var _0x0a83=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','map','options','FaxApplication','includeAll','include','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x1c46c5,_0x41bc70){var _0x4e403c=function(_0x8cf318){while(--_0x8cf318){_0x1c46c5['push'](_0x1c46c5['shift']());}};_0x4e403c(++_0x41bc70);}(_0x0a83,0x10f));var _0x30a8=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x0a83[_0x11ca63];return _0x41f1f6;};'use strict';var emlformat=require(_0x30a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30a8('0x1'));var jsonpatch=require(_0x30a8('0x2'));var rp=require('request-promise');var moment=require(_0x30a8('0x3'));var BPromise=require(_0x30a8('0x4'));var Mustache=require(_0x30a8('0x5'));var util=require(_0x30a8('0x6'));var path=require(_0x30a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30a8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30a8('0x9'));var squel=require('squel');var crypto=require(_0x30a8('0xa'));var jsforce=require(_0x30a8('0xb'));var deskjs=require(_0x30a8('0xc'));var toCsv=require(_0x30a8('0xd'));var querystring=require(_0x30a8('0xe'));var Papa=require(_0x30a8('0xf'));var Redis=require(_0x30a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x30a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a8('0x12'));var logger=require('../../config/logger')(_0x30a8('0x13'));var utils=require(_0x30a8('0x14'));var config=require(_0x30a8('0x15'));var licenseUtil=require(_0x30a8('0x16'));var db=require(_0x30a8('0x17'))['db'];function respondWithStatusCode(_0x5892b6,_0x41a0de){_0x41a0de=_0x41a0de||0xcc;return function(_0x9f37ed){if(_0x9f37ed){return _0x5892b6['sendStatus'](_0x41a0de);}return _0x5892b6[_0x30a8('0x18')](_0x41a0de)[_0x30a8('0x19')]();};}function respondWithResult(_0x74b404,_0x5bd61f){_0x5bd61f=_0x5bd61f||0xc8;return function(_0x397230){if(_0x397230){return _0x74b404[_0x30a8('0x18')](_0x5bd61f)['json'](_0x397230);}};}function respondWithFilteredResult(_0x1c1ccb,_0x58f9a9){return function(_0x53baaa){if(_0x53baaa){var _0x17e780=typeof _0x58f9a9['offset']===_0x30a8('0x1a')&&typeof _0x58f9a9[_0x30a8('0x1b')]===_0x30a8('0x1a');var _0x56c360=_0x53baaa['count'];var _0x1e17b6=_0x17e780?0x0:_0x58f9a9['offset'];var _0x284da6=_0x17e780?_0x53baaa[_0x30a8('0x1c')]:_0x58f9a9[_0x30a8('0x1d')]+_0x58f9a9['limit'];var _0x5863b9;if(_0x284da6>=_0x56c360){_0x284da6=_0x56c360;_0x5863b9=0xc8;}else{_0x5863b9=0xce;}_0x1c1ccb[_0x30a8('0x18')](_0x5863b9);return _0x1c1ccb['set'](_0x30a8('0x1e'),_0x1e17b6+'-'+_0x284da6+'/'+_0x56c360)[_0x30a8('0x1f')](_0x53baaa);}return null;};}function patchUpdates(_0x1228d8){return function(_0x1583a5){try{jsonpatch[_0x30a8('0x20')](_0x1583a5,_0x1228d8,!![]);}catch(_0x578d01){return BPromise[_0x30a8('0x21')](_0x578d01);}return _0x1583a5[_0x30a8('0x22')]();};}function saveUpdates(_0x4f7ea7,_0x235472){return function(_0x3d8064){if(_0x3d8064){return _0x3d8064[_0x30a8('0x23')](_0x4f7ea7)[_0x30a8('0x24')](function(_0x9bf848){return _0x9bf848;});}return null;};}function removeEntity(_0x29782f,_0x5854bb){return function(_0xbaabe1){if(_0xbaabe1){return _0xbaabe1['destroy']()[_0x30a8('0x24')](function(){_0x29782f[_0x30a8('0x18')](0xcc)[_0x30a8('0x19')]();});}};}function handleEntityNotFound(_0x11aaba,_0x31ac9b){return function(_0x151922){if(!_0x151922){_0x11aaba[_0x30a8('0x25')](0x194);}return _0x151922;};}function handleError(_0x203c31,_0x4b0f31){_0x4b0f31=_0x4b0f31||0x1f4;return function(_0x2e0d95){logger[_0x30a8('0x26')](_0x2e0d95['stack']);if(_0x2e0d95[_0x30a8('0x27')]){delete _0x2e0d95['name'];}_0x203c31[_0x30a8('0x18')](_0x4b0f31)['send'](_0x2e0d95);};}exports[_0x30a8('0x28')]=function(_0x5a2446,_0x7d40df){var _0x55fffd={},_0x256da9={},_0x3d0902={'count':0x0,'rows':[]};var _0x133df9=_['map'](db['FaxApplication'][_0x30a8('0x29')],function(_0x328f37){return{'name':_0x328f37['fieldName'],'type':_0x328f37[_0x30a8('0x2a')][_0x30a8('0x2b')]};});_0x256da9['model']=_['map'](_0x133df9,_0x30a8('0x27'));_0x256da9[_0x30a8('0x2c')]=_[_0x30a8('0x2d')](_0x5a2446[_0x30a8('0x2c')]);_0x256da9[_0x30a8('0x2e')]=_[_0x30a8('0x2f')](_0x256da9['model'],_0x256da9[_0x30a8('0x2c')]);_0x55fffd[_0x30a8('0x30')]=_['intersection'](_0x256da9[_0x30a8('0x31')],qs[_0x30a8('0x32')](_0x5a2446['query'][_0x30a8('0x32')]));_0x55fffd['attributes']=_0x55fffd[_0x30a8('0x30')][_0x30a8('0x33')]?_0x55fffd[_0x30a8('0x30')]:_0x256da9[_0x30a8('0x31')];if(!_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x34')]('nolimit')){_0x55fffd[_0x30a8('0x1b')]=qs[_0x30a8('0x1b')](_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x1b')]);_0x55fffd[_0x30a8('0x1d')]=qs['offset'](_0x5a2446['query'][_0x30a8('0x1d')]);}_0x55fffd[_0x30a8('0x35')]=qs[_0x30a8('0x36')](_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x36')]);_0x55fffd['where']=qs[_0x30a8('0x2e')](_[_0x30a8('0x37')](_0x5a2446[_0x30a8('0x2c')],_0x256da9[_0x30a8('0x2e')]),_0x133df9);if(_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x38')]){_0x55fffd['where']=_[_0x30a8('0x39')](_0x55fffd[_0x30a8('0x3a')],{'$or':_[_0x30a8('0x3b')](_0x133df9,function(_0x45000e){if(_0x45000e[_0x30a8('0x2a')]!=='VIRTUAL'){var _0x31c761={};_0x31c761[_0x45000e[_0x30a8('0x27')]]={'$like':'%'+_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x38')]+'%'};return _0x31c761;}})});}_0x55fffd=_[_0x30a8('0x39')]({},_0x55fffd,_0x5a2446[_0x30a8('0x3c')]);var _0x43357f={'where':_0x55fffd[_0x30a8('0x3a')]};return db[_0x30a8('0x3d')][_0x30a8('0x1c')](_0x43357f)['then'](function(_0x37f492){_0x3d0902[_0x30a8('0x1c')]=_0x37f492;if(_0x5a2446[_0x30a8('0x2c')][_0x30a8('0x3e')]){_0x55fffd[_0x30a8('0x3f')]=[{'all':!![]}];}return db[_0x30a8('0x3d')]['findAll'](_0x55fffd);})[_0x30a8('0x24')](function(_0x22d6f1){_0x3d0902[_0x30a8('0x40')]=_0x22d6f1;return _0x3d0902;})[_0x30a8('0x24')](respondWithFilteredResult(_0x7d40df,_0x55fffd))[_0x30a8('0x41')](handleError(_0x7d40df,null));};exports[_0x30a8('0x42')]=function(_0x274ca3,_0x518afb){var _0x2dfdb1={'raw':!![],'where':{'id':_0x274ca3['params']['id']}},_0x394132={};_0x394132[_0x30a8('0x31')]=_[_0x30a8('0x2d')](db['FaxApplication'][_0x30a8('0x29')]);_0x394132[_0x30a8('0x2c')]=_[_0x30a8('0x2d')](_0x274ca3[_0x30a8('0x2c')]);_0x394132[_0x30a8('0x2e')]=_[_0x30a8('0x2f')](_0x394132['model'],_0x394132[_0x30a8('0x2c')]);_0x2dfdb1['attributes']=_[_0x30a8('0x2f')](_0x394132[_0x30a8('0x31')],qs['fields'](_0x274ca3[_0x30a8('0x2c')][_0x30a8('0x32')]));_0x2dfdb1['attributes']=_0x2dfdb1[_0x30a8('0x30')][_0x30a8('0x33')]?_0x2dfdb1[_0x30a8('0x30')]:_0x394132['model'];if(_0x274ca3[_0x30a8('0x2c')][_0x30a8('0x3e')]){_0x2dfdb1[_0x30a8('0x3f')]=[{'all':!![]}];}_0x2dfdb1=_[_0x30a8('0x39')]({},_0x2dfdb1,_0x274ca3[_0x30a8('0x3c')]);return db[_0x30a8('0x3d')][_0x30a8('0x43')](_0x2dfdb1)[_0x30a8('0x24')](handleEntityNotFound(_0x518afb,null))['then'](respondWithResult(_0x518afb,null))[_0x30a8('0x41')](handleError(_0x518afb,null));};exports[_0x30a8('0x44')]=function(_0x4b7cf1,_0x425938){return db[_0x30a8('0x3d')]['create'](_0x4b7cf1[_0x30a8('0x45')],{})[_0x30a8('0x24')](respondWithResult(_0x425938,0xc9))[_0x30a8('0x41')](handleError(_0x425938,null));};exports[_0x30a8('0x23')]=function(_0x4c7908,_0x4cff87){if(_0x4c7908['body']['id']){delete _0x4c7908[_0x30a8('0x45')]['id'];}return db['FaxApplication'][_0x30a8('0x43')]({'where':{'id':_0x4c7908[_0x30a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cff87,null))['then'](saveUpdates(_0x4c7908[_0x30a8('0x45')],null))['then'](respondWithResult(_0x4cff87,null))[_0x30a8('0x41')](handleError(_0x4cff87,null));};exports['destroy']=function(_0x59d40e,_0x1d387e){return db[_0x30a8('0x3d')][_0x30a8('0x43')]({'where':{'id':_0x59d40e[_0x30a8('0x46')]['id']}})[_0x30a8('0x24')](handleEntityNotFound(_0x1d387e,null))['then'](removeEntity(_0x1d387e,null))[_0x30a8('0x41')](handleError(_0x1d387e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 609d6e7..3106ee9 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 _0x0323=['bluebird','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x0323,0x168));var _0x3032=function(_0x5d12c5,_0x36a5d8){_0x5d12c5=_0x5d12c5-0x0;var _0x3ccedf=_0x0323[_0x5d12c5];return _0x3ccedf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3032('0x0'))(_0x3032('0x1'));var moment=require(_0x3032('0x2'));var BPromise=require(_0x3032('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3032('0x4'));var attributes=require(_0x3032('0x5'));module[_0x3032('0x6')]=function(_0x34b248,_0x21a608){return _0x34b248[_0x3032('0x7')](_0x3032('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3032('0x9'),'collate':_0x3032('0xa')});}; \ No newline at end of file +var _0x3dce=['define','FaxApplication','utf8mb4','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x47df6b,_0x9b4e77){var _0x57af35=function(_0x267acc){while(--_0x267acc){_0x47df6b['push'](_0x47df6b['shift']());}};_0x57af35(++_0x9b4e77);}(_0x3dce,0xb3));var _0xe3dc=function(_0x35d4a9,_0x5931d9){_0x35d4a9=_0x35d4a9-0x0;var _0x314aef=_0x3dce[_0x35d4a9];return _0x314aef;};'use strict';var _=require(_0xe3dc('0x0'));var util=require(_0xe3dc('0x1'));var logger=require('../../config/logger')(_0xe3dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3dc('0x3'));var fs=require('fs');var path=require(_0xe3dc('0x4'));var rimraf=require(_0xe3dc('0x5'));var config=require(_0xe3dc('0x6'));var attributes=require('./faxApplication.attributes');module[_0xe3dc('0x7')]=function(_0x4a14d9,_0x2cc86d){return _0x4a14d9[_0xe3dc('0x8')](_0xe3dc('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe3dc('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8dc4281..f71ae58 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 _0x343f=['client','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','debug','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x5bb0ba,_0x3a1803){var _0x551a4e=function(_0x46de11){while(--_0x46de11){_0x5bb0ba['push'](_0x5bb0ba['shift']());}};_0x551a4e(++_0x3a1803);}(_0x343f,0xb6));var _0xf343=function(_0x28570f,_0x5a645f){_0x28570f=_0x28570f-0x0;var _0x43bc5d=_0x343f[_0x28570f];return _0x43bc5d;};'use strict';var _=require(_0xf343('0x0'));var util=require('util');var moment=require(_0xf343('0x1'));var BPromise=require('bluebird');var rs=require(_0xf343('0x2'));var fs=require('fs');var Redis=require(_0xf343('0x3'));var db=require(_0xf343('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf343('0x5'));var config=require(_0xf343('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf343('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d20b,_0x3c09ba,_0x3e83de){return new BPromise(function(_0x3d6e22,_0x14cde5){return client['request'](_0x36d20b,_0x3e83de)[_0xf343('0x8')](function(_0x3ab2d1){logger[_0xf343('0x9')]('FaxApplication,\x20%s,\x20%s',_0x3c09ba,_0xf343('0xa'));logger['debug'](_0xf343('0xb'),_0x3c09ba,_0xf343('0xa'),JSON[_0xf343('0xc')](_0x3ab2d1));if(_0x3ab2d1[_0xf343('0xd')]){if(_0x3ab2d1[_0xf343('0xd')][_0xf343('0xe')]===0x1f4){logger[_0xf343('0xd')](_0xf343('0xf'),_0x3c09ba,_0x3ab2d1['error'][_0xf343('0x10')]);return _0x14cde5(_0x3ab2d1[_0xf343('0xd')][_0xf343('0x10')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x3c09ba,_0x3ab2d1['error']['message']);return _0x3d6e22(_0x3ab2d1[_0xf343('0xd')][_0xf343('0x10')]);}else{logger[_0xf343('0x9')]('FaxApplication,\x20%s,\x20%s',_0x3c09ba,'request\x20sent');_0x3d6e22(_0x3ab2d1[_0xf343('0x11')][_0xf343('0x10')]);}})['catch'](function(_0xa26b83){logger[_0xf343('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3c09ba,_0xa26b83);_0x14cde5(_0xa26b83);});});}exports[_0xf343('0x12')]=function(_0x17eed6){var _0x242a66=this;return new Promise(function(_0x3148e0,_0x473bb4){return db[_0xf343('0x13')]['update'](_0x17eed6[_0xf343('0x14')],{'raw':_0x17eed6[_0xf343('0x15')]?_0x17eed6['options'][_0xf343('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17eed6[_0xf343('0x15')]?_0x17eed6[_0xf343('0x15')]['where']||null:null,'attributes':_0x17eed6[_0xf343('0x15')]?_0x17eed6[_0xf343('0x15')][_0xf343('0x17')]||null:null,'limit':_0x17eed6['options']?_0x17eed6[_0xf343('0x15')][_0xf343('0x18')]||null:null})['then'](function(_0x3152e7){logger[_0xf343('0x9')](_0xf343('0x12'),_0x17eed6);logger[_0xf343('0x19')](_0xf343('0x12'),_0x17eed6,JSON[_0xf343('0xc')](_0x3152e7));_0x3148e0(_0x3152e7);})[_0xf343('0x1a')](function(_0x59929b){logger[_0xf343('0xd')](_0xf343('0x12'),_0x59929b[_0xf343('0x10')],_0x17eed6);_0x473bb4(_0x242a66[_0xf343('0xd')](0x1f4,_0x59929b[_0xf343('0x10')]));});});}; \ No newline at end of file +var _0x7521=['error','code','message','result','catch','update','body','options','raw','where','attributes','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x32ff6d,_0x2d3cfd){var _0x19624f=function(_0x97c4e){while(--_0x97c4e){_0x32ff6d['push'](_0x32ff6d['shift']());}};_0x19624f(++_0x2d3cfd);}(_0x7521,0x8c));var _0x1752=function(_0x2c7615,_0x184b38){_0x2c7615=_0x2c7615-0x0;var _0x5a4a45=_0x7521[_0x2c7615];return _0x5a4a45;};'use strict';var _=require(_0x1752('0x0'));var util=require(_0x1752('0x1'));var moment=require(_0x1752('0x2'));var BPromise=require(_0x1752('0x3'));var rs=require(_0x1752('0x4'));var fs=require('fs');var Redis=require(_0x1752('0x5'));var db=require(_0x1752('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1752('0x7'))(_0x1752('0x8'));var config=require(_0x1752('0x9'));var jayson=require(_0x1752('0xa'));var client=jayson['client'][_0x1752('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b86ad,_0x323a3c,_0x4b3a10){return new BPromise(function(_0x23baa5,_0x1c2d95){return client[_0x1752('0xc')](_0x3b86ad,_0x4b3a10)[_0x1752('0xd')](function(_0x1fdd0a){logger[_0x1752('0xe')](_0x1752('0xf'),_0x323a3c,'request\x20sent');logger[_0x1752('0x10')](_0x1752('0x11'),_0x323a3c,_0x1752('0x12'),JSON[_0x1752('0x13')](_0x1fdd0a));if(_0x1fdd0a[_0x1752('0x14')]){if(_0x1fdd0a[_0x1752('0x14')][_0x1752('0x15')]===0x1f4){logger[_0x1752('0x14')](_0x1752('0xf'),_0x323a3c,_0x1fdd0a[_0x1752('0x14')][_0x1752('0x16')]);return _0x1c2d95(_0x1fdd0a[_0x1752('0x14')][_0x1752('0x16')]);}logger[_0x1752('0x14')]('FaxApplication,\x20%s,\x20%s',_0x323a3c,_0x1fdd0a[_0x1752('0x14')][_0x1752('0x16')]);return _0x23baa5(_0x1fdd0a[_0x1752('0x14')][_0x1752('0x16')]);}else{logger[_0x1752('0xe')](_0x1752('0xf'),_0x323a3c,'request\x20sent');_0x23baa5(_0x1fdd0a[_0x1752('0x17')][_0x1752('0x16')]);}})[_0x1752('0x18')](function(_0x143089){logger[_0x1752('0x14')]('FaxApplication,\x20%s,\x20%s',_0x323a3c,_0x143089);_0x1c2d95(_0x143089);});});}exports['UpdateFaxApplication']=function(_0x498a7c){var _0x134e32=this;return new Promise(function(_0x12dad4,_0x610a07){return db['FaxApplication'][_0x1752('0x19')](_0x498a7c[_0x1752('0x1a')],{'raw':_0x498a7c['options']?_0x498a7c[_0x1752('0x1b')][_0x1752('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x498a7c[_0x1752('0x1b')]?_0x498a7c[_0x1752('0x1b')][_0x1752('0x1d')]||null:null,'attributes':_0x498a7c[_0x1752('0x1b')]?_0x498a7c[_0x1752('0x1b')][_0x1752('0x1e')]||null:null,'limit':_0x498a7c[_0x1752('0x1b')]?_0x498a7c[_0x1752('0x1b')]['limit']||null:null})['then'](function(_0xf22048){logger[_0x1752('0xe')](_0x1752('0x1f'),_0x498a7c);logger[_0x1752('0x10')](_0x1752('0x1f'),_0x498a7c,JSON['stringify'](_0xf22048));_0x12dad4(_0xf22048);})[_0x1752('0x18')](function(_0x558a7e){logger[_0x1752('0x14')]('UpdateFaxApplication',_0x558a7e['message'],_0x498a7c);_0x610a07(_0x134e32[_0x1752('0x14')](0x1f4,_0x558a7e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7acd9a9..4b1c264 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 _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x2c0ee7,_0x5dd85b){var _0xcbc2f=function(_0x49376c){while(--_0x49376c){_0x2c0ee7['push'](_0x2c0ee7['shift']());}};_0xcbc2f(++_0x5dd85b);}(_0x6324,0x142));var _0x4632=function(_0x2deb01,_0x4e741c){_0x2deb01=_0x2deb01-0x0;var _0x3920b3=_0x6324[_0x2deb01];return _0x3920b3;};'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('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x21be56,_0x58490b){var _0x6f6f20=function(_0x12aa6e){while(--_0x12aa6e){_0x21be56['push'](_0x21be56['shift']());}};_0x6f6f20(++_0x58490b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0x5eb8[_0x5944e9];return _0x1098b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5778109..e8a9975 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 _0x29ef=['BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x16295e,_0x4a9b05){var _0x2d9e54=function(_0x396291){while(--_0x396291){_0x16295e['push'](_0x16295e['shift']());}};_0x2d9e54(++_0x4a9b05);}(_0x29ef,0x16c));var _0xf29e=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x29ef[_0x6e1239];return _0x418150;};'use strict';var Sequelize=require(_0xf29e('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf29e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf29e('0x2')]},'disposition':{'type':Sequelize[_0xf29e('0x3')]},'secondDisposition':{'type':Sequelize[_0xf29e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf29e('0x3')]},'read1stAt':{'type':Sequelize[_0xf29e('0x2')]},'fax':{'type':Sequelize[_0xf29e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf29e('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf29e('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf29e('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7128=['ENUM','DATE','out','sequelize','BOOLEAN','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7128,0x1b9));var _0x8712=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x7128[_0xf2628e];return _0x13863a;};'use strict';var Sequelize=require(_0x8712('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8712('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8712('0x2')]},'secondDisposition':{'type':Sequelize[_0x8712('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8712('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x8712('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8712('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8712('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8712('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 25aebcd..2ba2f5d 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 _0x3198=['attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','resolve','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','update','then','error','name','index','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','catch','params','model','keys','attributes','intersection','fields','length','merge','options','find','create','body','destroy','describe','addMessage','FaxMessage','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','map','filter','$gte','split','format','include','rows','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','root','server','files','tmp'];(function(_0xea42b4,_0x27ea39){var _0x3d6f5a=function(_0xce9211){while(--_0xce9211){_0xea42b4['push'](_0xea42b4['shift']());}};_0x3d6f5a(++_0x27ea39);}(_0x3198,0xd8));var _0x8319=function(_0x3d955d,_0x4471a3){_0x3d955d=_0x3d955d-0x0;var _0x29679e=_0x3198[_0x3d955d];return _0x29679e;};'use strict';var rimraf=require(_0x8319('0x0'));var zipdir=require(_0x8319('0x1'));var moment=require(_0x8319('0x2'));var BPromise=require(_0x8319('0x3'));var util=require(_0x8319('0x4'));var path=require(_0x8319('0x5'));var fs=require('fs');var _=require(_0x8319('0x6'));var Redis=require('ioredis');var interaction=require(_0x8319('0x7'));var qs=require(_0x8319('0x8'));var logger=require(_0x8319('0x9'))('api');var config=require(_0x8319('0xa'));var db=require(_0x8319('0xb'))['db'];config[_0x8319('0xc')]=_[_0x8319('0xd')](config['redis'],{'host':_0x8319('0xe'),'port':0x18eb});var socket=require(_0x8319('0xf'))(new Redis(config['redis']));require(_0x8319('0x10'))[_0x8319('0x11')](socket);function respondWithStatusCode(_0x5c7edb,_0x21e849){_0x21e849=_0x21e849||0xcc;return function(_0x5c9ed4){if(_0x5c9ed4){return _0x5c7edb[_0x8319('0x12')](_0x21e849);}return _0x5c7edb['status'](_0x21e849)[_0x8319('0x13')]();};}function respondWithResult(_0x5201ab,_0x45f69d){_0x45f69d=_0x45f69d||0xc8;return function(_0x20be3e){if(_0x20be3e){return _0x5201ab['status'](_0x45f69d)[_0x8319('0x14')](_0x20be3e);}};}function respondWithFilteredResult(_0x4ad3fd,_0x5073d4){return function(_0x4d9eef){if(_0x4d9eef){var _0x40e6a2=typeof _0x5073d4[_0x8319('0x15')]===_0x8319('0x16')&&typeof _0x5073d4[_0x8319('0x17')]==='undefined';var _0x1c2d9b=_0x4d9eef['count'];var _0x245ef0=_0x40e6a2?0x0:_0x5073d4[_0x8319('0x15')];var _0x2dd515=_0x40e6a2?_0x4d9eef[_0x8319('0x18')]:_0x5073d4['offset']+_0x5073d4[_0x8319('0x17')];var _0x2f74f9;if(_0x2dd515>=_0x1c2d9b){_0x2dd515=_0x1c2d9b;_0x2f74f9=0xc8;}else{_0x2f74f9=0xce;}_0x4ad3fd[_0x8319('0x19')](_0x2f74f9);return _0x4ad3fd[_0x8319('0x1a')]('Content-Range',_0x245ef0+'-'+_0x2dd515+'/'+_0x1c2d9b)['json'](_0x4d9eef);}return null;};}function saveUpdates(_0x1c6904){return function(_0x4786d0){if(_0x4786d0){return _0x4786d0[_0x8319('0x1b')](_0x1c6904)[_0x8319('0x1c')](function(_0x24f05c){return _0x24f05c;});}return null;};}function removeEntity(_0x3fa60f){return function(_0x1d8d34){if(_0x1d8d34){return _0x1d8d34['destroy']()[_0x8319('0x1c')](function(){_0x3fa60f[_0x8319('0x19')](0xcc)[_0x8319('0x13')]();});}};}function handleEntityNotFound(_0x1127d5){return function(_0x5814a3){if(!_0x5814a3){_0x1127d5[_0x8319('0x12')](0x194);}return _0x5814a3;};}function handleError(_0x3468c7,_0x5619c5){_0x5619c5=_0x5619c5||0x1f4;return function(_0x469a83){logger[_0x8319('0x1d')](_0x469a83['stack']);if(_0x469a83[_0x8319('0x1e')]){delete _0x469a83[_0x8319('0x1e')];}_0x3468c7[_0x8319('0x19')](_0x5619c5)['send'](_0x469a83);};}exports[_0x8319('0x1f')]=function(_0x41e0a2,_0x49aa82){var _0x532bb3={};var _0xdf2a91=_['map'](db[_0x8319('0x20')][_0x8319('0x21')],function(_0x158b8e){return{'name':_0x158b8e['fieldName'],'type':_0x158b8e[_0x8319('0x22')][_0x8319('0x23')]};});_0x532bb3=qs[_0x8319('0x24')](_0xdf2a91,_0x41e0a2);return interaction[_0x8319('0x25')](_0x8319('0x26'),_0x41e0a2[_0x8319('0x27')],_0x41e0a2['user'],_0x532bb3,_0xdf2a91)[_0x8319('0x1c')](respondWithFilteredResult(_0x49aa82,_0x532bb3))[_0x8319('0x28')](handleError(_0x49aa82,null));};exports['show']=function(_0x351f66,_0x29232d){var _0x933e7c={'raw':![],'where':{'id':_0x351f66[_0x8319('0x29')]['id']}},_0x540840={};_0x540840[_0x8319('0x2a')]=_[_0x8319('0x2b')](db[_0x8319('0x20')][_0x8319('0x21')]);_0x540840[_0x8319('0x27')]=_[_0x8319('0x2b')](_0x351f66[_0x8319('0x27')]);_0x540840['filters']=_['intersection'](_0x540840['model'],_0x540840[_0x8319('0x27')]);_0x933e7c[_0x8319('0x2c')]=_[_0x8319('0x2d')](_0x540840['model'],qs['fields'](_0x351f66[_0x8319('0x27')][_0x8319('0x2e')]));_0x933e7c[_0x8319('0x2c')]=_0x933e7c[_0x8319('0x2c')][_0x8319('0x2f')]?_0x933e7c[_0x8319('0x2c')]:_0x540840['model'];if(_0x351f66[_0x8319('0x27')]['includeAll']){_0x933e7c['include']=[{'all':!![]}];}_0x933e7c=_[_0x8319('0x30')]({},_0x933e7c,_0x351f66[_0x8319('0x31')]);return db['FaxInteraction'][_0x8319('0x32')](_0x933e7c)[_0x8319('0x1c')](handleEntityNotFound(_0x29232d,null))[_0x8319('0x1c')](respondWithResult(_0x29232d,null))[_0x8319('0x28')](handleError(_0x29232d,null));};exports[_0x8319('0x33')]=function(_0x4afd99,_0x1cbc3d){return db[_0x8319('0x20')][_0x8319('0x33')](_0x4afd99['body'],{})[_0x8319('0x1c')](respondWithResult(_0x1cbc3d,0xc9))['catch'](handleError(_0x1cbc3d,null));};exports[_0x8319('0x1b')]=function(_0x3963a1,_0x3623c3){if(_0x3963a1[_0x8319('0x34')]['id']){delete _0x3963a1[_0x8319('0x34')]['id'];}return db[_0x8319('0x20')][_0x8319('0x32')]({'where':{'id':_0x3963a1['params']['id']}})['then'](handleEntityNotFound(_0x3623c3,null))[_0x8319('0x1c')](saveUpdates(_0x3963a1[_0x8319('0x34')],null))[_0x8319('0x1c')](respondWithResult(_0x3623c3,null))['catch'](handleError(_0x3623c3,null));};exports[_0x8319('0x35')]=function(_0x10a1ac,_0x56c873){return db['FaxInteraction'][_0x8319('0x32')]({'where':{'id':_0x10a1ac[_0x8319('0x29')]['id']}})[_0x8319('0x1c')](handleEntityNotFound(_0x56c873,null))[_0x8319('0x1c')](removeEntity(_0x56c873,null))[_0x8319('0x28')](handleError(_0x56c873,null));};exports[_0x8319('0x36')]=function(_0x867785,_0x23b0f2){return db['FaxInteraction'][_0x8319('0x36')]()[_0x8319('0x1c')](respondWithResult(_0x23b0f2,null))[_0x8319('0x28')](handleError(_0x23b0f2,null));};exports[_0x8319('0x37')]=function(_0x2bd8ee,_0x14b9ed){return db[_0x8319('0x38')]['find']({'where':{'id':_0x2bd8ee['params']['id']}})[_0x8319('0x1c')](handleEntityNotFound(_0x14b9ed,null))[_0x8319('0x1c')](function(_0x467b65){if(_0x467b65){return _0x467b65[_0x8319('0x37')](_0x2bd8ee[_0x8319('0x34')][_0x8319('0x39')],_['omit'](_0x2bd8ee['body'],[_0x8319('0x39'),'id'])||{});}})['then'](respondWithResult(_0x14b9ed,null))[_0x8319('0x28')](handleError(_0x14b9ed,null));};exports['getMessages']=function(_0x735ca1,_0x183b32){var _0x9f1fad={'raw':![],'where':{}};var _0xe19168={};var _0x27c090={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8319('0x3a')]({'where':{'id':_0x735ca1[_0x8319('0x29')]['id']}})['then'](handleEntityNotFound(_0x183b32,null))[_0x8319('0x1c')](function(_0x16757d){if(_0x16757d){_0xe19168[_0x8319('0x2a')]=_[_0x8319('0x2b')](db['FaxMessage'][_0x8319('0x21')]);_0xe19168['query']=_[_0x8319('0x2b')](_0x735ca1['query']);_0xe19168[_0x8319('0x3b')]=_[_0x8319('0x2d')](_0xe19168[_0x8319('0x2a')],_0xe19168['query']);_0x9f1fad[_0x8319('0x2c')]=_[_0x8319('0x2d')](_0xe19168[_0x8319('0x2a')],qs[_0x8319('0x2e')](_0x735ca1[_0x8319('0x27')]['fields']));_0x9f1fad['attributes']=_0x9f1fad['attributes'][_0x8319('0x2f')]?_0x9f1fad[_0x8319('0x2c')]:_0xe19168['model'];if(!_0x735ca1[_0x8319('0x27')][_0x8319('0x3c')](_0x8319('0x3d'))){_0x9f1fad[_0x8319('0x17')]=qs['limit'](_0x735ca1[_0x8319('0x27')][_0x8319('0x17')]);_0x9f1fad[_0x8319('0x15')]=qs[_0x8319('0x15')](_0x735ca1[_0x8319('0x27')]['offset']);}_0x9f1fad[_0x8319('0x3e')]=qs['sort'](_0x735ca1[_0x8319('0x27')][_0x8319('0x3f')]);_0x9f1fad[_0x8319('0x40')]=qs[_0x8319('0x3b')](_[_0x8319('0x41')](_0x735ca1[_0x8319('0x27')],_0xe19168[_0x8319('0x3b')]));_0x9f1fad[_0x8319('0x40')][_0x8319('0x42')]=_0x16757d['id'];if(_0x735ca1['query']['filter']){_0x9f1fad[_0x8319('0x40')]=_['merge'](_0x9f1fad[_0x8319('0x40')],{'$or':_[_0x8319('0x43')](_0x9f1fad[_0x8319('0x2c')],function(_0x54401d){var _0x319a2e={};_0x319a2e[_0x54401d]={'$like':'%'+_0x735ca1[_0x8319('0x27')][_0x8319('0x44')]+'%'};return _0x319a2e;})});}if(_0x735ca1['query'][_0x8319('0x45')]){var _0x9121e0=_0x735ca1['query'][_0x8319('0x45')][_0x8319('0x46')](',');var _0x52d159={};_0x52d159[_0x9121e0[0x0]]={'$gte':moment(_0x9121e0[0x1])[_0x8319('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9f1fad[_0x8319('0x40')]=_['merge'](_0x9f1fad[_0x8319('0x40')],_0x52d159);}_0x9f1fad=_['merge']({},_0x9f1fad,_0x735ca1[_0x8319('0x31')]);return db['FaxMessage'][_0x8319('0x18')]({'where':_0x9f1fad[_0x8319('0x40')]})['then'](function(_0x3ec325){_0x27c090[_0x8319('0x18')]=_0x3ec325;if(_0x735ca1[_0x8319('0x27')]['includeAll']){_0x9f1fad[_0x8319('0x48')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x9f1fad);})[_0x8319('0x1c')](function(_0x1b30cc){_0x27c090[_0x8319('0x49')]=_0x1b30cc;return _0x27c090;});}})[_0x8319('0x1c')](respondWithFilteredResult(_0x183b32,_0x9f1fad))[_0x8319('0x28')](handleError(_0x183b32,null));};exports['addTags']=function(_0x3d4327,_0x595e2a){return db['FaxInteraction'][_0x8319('0x32')]({'where':{'id':_0x3d4327[_0x8319('0x29')]['id']}})['then'](handleEntityNotFound(_0x595e2a,null))[_0x8319('0x1c')](function(_0x521258){if(_0x521258){return _0x521258[_0x8319('0x4a')](_0x3d4327[_0x8319('0x34')][_0x8319('0x39')],_['omit'](_0x3d4327[_0x8319('0x34')],['ids','id'])||{})[_0x8319('0x4b')](function(){return db[_0x8319('0x4c')][_0x8319('0x25')]({'attributes':['id',_0x8319('0x1e'),_0x8319('0x4d')],'where':{'id':_0x3d4327[_0x8319('0x34')][_0x8319('0x39')]}});})['then'](function(_0x548e5b){socket[_0x8319('0x4e')]('faxInteractionTags:save',{'id':Number(_0x3d4327[_0x8319('0x29')]['id']),'tags':_0x548e5b||[]});return{'id':Number(_0x3d4327[_0x8319('0x29')]['id']),'tags':_0x548e5b||[]};});}})[_0x8319('0x1c')](respondWithResult(_0x595e2a,null))[_0x8319('0x28')](handleError(_0x595e2a,null));};exports[_0x8319('0x4f')]=function(_0x371a53,_0x3f68ba){return db[_0x8319('0x20')][_0x8319('0x32')]({'where':{'id':_0x371a53[_0x8319('0x29')]['id']}})[_0x8319('0x1c')](handleEntityNotFound(_0x3f68ba,null))[_0x8319('0x1c')](function(_0x2a081c){if(_0x2a081c){return _0x2a081c['removeTags'](_0x371a53[_0x8319('0x27')][_0x8319('0x39')]);}})['then'](respondWithStatusCode(_0x3f68ba,null))['catch'](handleError(_0x3f68ba,null));};exports['download']=function(_0x1acd2e,_0x3953b1){var _0x5b228a=moment()[_0x8319('0x50')]()[_0x8319('0x51')]();var _0x4d3be3=path[_0x8319('0x52')](config[_0x8319('0x53')],_0x8319('0x54'),_0x8319('0x55'),_0x8319('0x56'));var _0x5f2fcc=path[_0x8319('0x52')](config[_0x8319('0x53')],_0x8319('0x54'),_0x8319('0x55'),_0x8319('0x57'));var _0x2d5c6b=path['join'](_0x4d3be3,_0x5b228a);var _0x207a9d=util['format'](_0x8319('0x58'),_0x1acd2e['params']['id'],_0x5b228a);var _0x10144c=path['join'](_0x4d3be3,_0x207a9d);var _0x3ccc89=[];_0x3ccc89[_0x8319('0x59')]({'model':db[_0x8319('0x5a')],'as':_0x8319('0x5a'),'raw':!![]});var _0xd38e12=[{'model':db[_0x8319('0x38')],'as':_0x8319('0x5b'),'attributes':['id',_0x8319('0x34'),'createdAt'],'include':_0x3ccc89}];return db[_0x8319('0x20')]['find']({'where':{'id':_0x1acd2e[_0x8319('0x29')]['id']},'include':_0xd38e12})[_0x8319('0x1c')](handleEntityNotFound(_0x3953b1,null))['then'](function(_0x11fa9e){if(_0x11fa9e&&_0x11fa9e[_0x8319('0x5b')]){var _0x45ce66=_0x11fa9e[_0x8319('0x5c')]({'plain':!![]});fs[_0x8319('0x5d')](_0x2d5c6b);for(var _0x6b917=0x0;_0x6b917<_0x45ce66['Messages'][_0x8319('0x2f')];_0x6b917++){var _0x14faf5=_0x45ce66[_0x8319('0x5b')][_0x6b917]['Attachment'];if(_0x14faf5){var _0x2d3906=path[_0x8319('0x52')](_0x5f2fcc,_0x14faf5[_0x8319('0x5e')]);if(fs[_0x8319('0x5f')](_0x2d3906)){fs['createReadStream'](_0x2d3906)['pipe'](fs[_0x8319('0x60')](path['join'](_0x2d5c6b,_0x14faf5[_0x8319('0x5e')])));}}}return BPromise[_0x8319('0x61')]()[_0x8319('0x1c')](function(){return new BPromise(function(_0x5e1828,_0x1a415c){zipdir(_0x2d5c6b,{'saveTo':_0x10144c},function(_0x9d69f0,_0x345302){if(_0x9d69f0)return _0x1a415c(_0x9d69f0);return _0x5e1828(_0x345302);});})[_0x8319('0x1c')](function(){return new BPromise(function(_0x2e8754,_0x473c40){rimraf(_0x2d5c6b,function(_0x20687c){if(_0x20687c)_0x473c40(_0x20687c);return _0x2e8754();});});})[_0x8319('0x1c')](function(){return _0x3953b1[_0x8319('0x62')](_0x10144c,_0x207a9d,function(_0x459f98){if(_0x459f98){console[_0x8319('0x63')]('err',_0x459f98);}else{fs[_0x8319('0x64')](_0x10144c);}});});});}else{return _0x3953b1[_0x8319('0x12')](0xc8);}})[_0x8319('0x28')](handleError(_0x3953b1,null));}; \ No newline at end of file +var _0x3cc7=['FaxInteractionId','filter','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','spread','findAll','faxInteractionTags:save','removeTags','download','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../config/logger','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','json','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','user','catch','show','params','model','keys','intersection','attributes','fields','include','create','body','update','find','describe','addMessage','FaxMessage','omit','ids','findOne','filters','length','hasOwnProperty','order','where','pick'];(function(_0x53d18b,_0x14c3d9){var _0x27a88a=function(_0x5168a1){while(--_0x5168a1){_0x53d18b['push'](_0x53d18b['shift']());}};_0x27a88a(++_0x14c3d9);}(_0x3cc7,0x19c));var _0x73cc=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x3cc7[_0x45fe9c];return _0x233d48;};'use strict';var rimraf=require(_0x73cc('0x0'));var zipdir=require('zip-dir');var moment=require(_0x73cc('0x1'));var BPromise=require(_0x73cc('0x2'));var util=require(_0x73cc('0x3'));var path=require(_0x73cc('0x4'));var fs=require('fs');var _=require(_0x73cc('0x5'));var Redis=require(_0x73cc('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x73cc('0x7'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x73cc('0x8')],{'host':_0x73cc('0x9'),'port':0x18eb});var socket=require(_0x73cc('0xa'))(new Redis(config[_0x73cc('0x8')]));require(_0x73cc('0xb'))[_0x73cc('0xc')](socket);function respondWithStatusCode(_0x4bfcbf,_0x55cc9f){_0x55cc9f=_0x55cc9f||0xcc;return function(_0x41254a){if(_0x41254a){return _0x4bfcbf[_0x73cc('0xd')](_0x55cc9f);}return _0x4bfcbf[_0x73cc('0xe')](_0x55cc9f)[_0x73cc('0xf')]();};}function respondWithResult(_0x38dc5a,_0xbb712f){_0xbb712f=_0xbb712f||0xc8;return function(_0x5eb995){if(_0x5eb995){return _0x38dc5a[_0x73cc('0xe')](_0xbb712f)['json'](_0x5eb995);}};}function respondWithFilteredResult(_0xa8f164,_0x535ac9){return function(_0x5ce8e4){if(_0x5ce8e4){var _0x30e549=typeof _0x535ac9[_0x73cc('0x10')]===_0x73cc('0x11')&&typeof _0x535ac9['limit']===_0x73cc('0x11');var _0x164e4b=_0x5ce8e4[_0x73cc('0x12')];var _0x37195c=_0x30e549?0x0:_0x535ac9[_0x73cc('0x10')];var _0x93256c=_0x30e549?_0x5ce8e4[_0x73cc('0x12')]:_0x535ac9[_0x73cc('0x10')]+_0x535ac9[_0x73cc('0x13')];var _0x295589;if(_0x93256c>=_0x164e4b){_0x93256c=_0x164e4b;_0x295589=0xc8;}else{_0x295589=0xce;}_0xa8f164[_0x73cc('0xe')](_0x295589);return _0xa8f164['set']('Content-Range',_0x37195c+'-'+_0x93256c+'/'+_0x164e4b)[_0x73cc('0x14')](_0x5ce8e4);}return null;};}function saveUpdates(_0x4006c4){return function(_0x1169c1){if(_0x1169c1){return _0x1169c1['update'](_0x4006c4)[_0x73cc('0x15')](function(_0x392aa2){return _0x392aa2;});}return null;};}function removeEntity(_0x4eda5e){return function(_0x2d7a10){if(_0x2d7a10){return _0x2d7a10[_0x73cc('0x16')]()[_0x73cc('0x15')](function(){_0x4eda5e[_0x73cc('0xe')](0xcc)[_0x73cc('0xf')]();});}};}function handleEntityNotFound(_0x45ef44){return function(_0x3c5c87){if(!_0x3c5c87){_0x45ef44[_0x73cc('0xd')](0x194);}return _0x3c5c87;};}function handleError(_0x55d51e,_0x4559f3){_0x4559f3=_0x4559f3||0x1f4;return function(_0x4f20d0){logger[_0x73cc('0x17')](_0x4f20d0[_0x73cc('0x18')]);if(_0x4f20d0[_0x73cc('0x19')]){delete _0x4f20d0[_0x73cc('0x19')];}_0x55d51e[_0x73cc('0xe')](_0x4559f3)[_0x73cc('0x1a')](_0x4f20d0);};}exports[_0x73cc('0x1b')]=function(_0x28088a,_0x48c22c){var _0x53be11={};var _0x2e4558=_[_0x73cc('0x1c')](db[_0x73cc('0x1d')][_0x73cc('0x1e')],function(_0x47a0ef){return{'name':_0x47a0ef[_0x73cc('0x1f')],'type':_0x47a0ef[_0x73cc('0x20')][_0x73cc('0x21')]};});_0x53be11=qs[_0x73cc('0x22')](_0x2e4558,_0x28088a);return interaction['findAll'](_0x73cc('0x23'),_0x28088a[_0x73cc('0x24')],_0x28088a[_0x73cc('0x25')],_0x53be11,_0x2e4558)[_0x73cc('0x15')](respondWithFilteredResult(_0x48c22c,_0x53be11))[_0x73cc('0x26')](handleError(_0x48c22c,null));};exports[_0x73cc('0x27')]=function(_0x3efe19,_0x6d583b){var _0x3ef4d7={'raw':![],'where':{'id':_0x3efe19[_0x73cc('0x28')]['id']}},_0x1accc2={};_0x1accc2[_0x73cc('0x29')]=_['keys'](db[_0x73cc('0x1d')][_0x73cc('0x1e')]);_0x1accc2[_0x73cc('0x24')]=_[_0x73cc('0x2a')](_0x3efe19['query']);_0x1accc2['filters']=_[_0x73cc('0x2b')](_0x1accc2['model'],_0x1accc2[_0x73cc('0x24')]);_0x3ef4d7[_0x73cc('0x2c')]=_[_0x73cc('0x2b')](_0x1accc2[_0x73cc('0x29')],qs[_0x73cc('0x2d')](_0x3efe19[_0x73cc('0x24')]['fields']));_0x3ef4d7[_0x73cc('0x2c')]=_0x3ef4d7[_0x73cc('0x2c')]['length']?_0x3ef4d7[_0x73cc('0x2c')]:_0x1accc2[_0x73cc('0x29')];if(_0x3efe19[_0x73cc('0x24')]['includeAll']){_0x3ef4d7[_0x73cc('0x2e')]=[{'all':!![]}];}_0x3ef4d7=_['merge']({},_0x3ef4d7,_0x3efe19['options']);return db[_0x73cc('0x1d')]['find'](_0x3ef4d7)[_0x73cc('0x15')](handleEntityNotFound(_0x6d583b,null))[_0x73cc('0x15')](respondWithResult(_0x6d583b,null))['catch'](handleError(_0x6d583b,null));};exports[_0x73cc('0x2f')]=function(_0x3dfc92,_0x2bab1e){return db[_0x73cc('0x1d')][_0x73cc('0x2f')](_0x3dfc92[_0x73cc('0x30')],{})['then'](respondWithResult(_0x2bab1e,0xc9))[_0x73cc('0x26')](handleError(_0x2bab1e,null));};exports[_0x73cc('0x31')]=function(_0x15c5a1,_0xf9f651){if(_0x15c5a1[_0x73cc('0x30')]['id']){delete _0x15c5a1['body']['id'];}return db[_0x73cc('0x1d')]['find']({'where':{'id':_0x15c5a1[_0x73cc('0x28')]['id']}})[_0x73cc('0x15')](handleEntityNotFound(_0xf9f651,null))['then'](saveUpdates(_0x15c5a1[_0x73cc('0x30')],null))[_0x73cc('0x15')](respondWithResult(_0xf9f651,null))[_0x73cc('0x26')](handleError(_0xf9f651,null));};exports[_0x73cc('0x16')]=function(_0x392c80,_0x4556c5){return db['FaxInteraction'][_0x73cc('0x32')]({'where':{'id':_0x392c80[_0x73cc('0x28')]['id']}})[_0x73cc('0x15')](handleEntityNotFound(_0x4556c5,null))[_0x73cc('0x15')](removeEntity(_0x4556c5,null))['catch'](handleError(_0x4556c5,null));};exports[_0x73cc('0x33')]=function(_0x1f6e86,_0x42a74b){return db['FaxInteraction']['describe']()[_0x73cc('0x15')](respondWithResult(_0x42a74b,null))[_0x73cc('0x26')](handleError(_0x42a74b,null));};exports[_0x73cc('0x34')]=function(_0x52b39d,_0x40572f){return db[_0x73cc('0x35')][_0x73cc('0x32')]({'where':{'id':_0x52b39d[_0x73cc('0x28')]['id']}})[_0x73cc('0x15')](handleEntityNotFound(_0x40572f,null))[_0x73cc('0x15')](function(_0x454cf3){if(_0x454cf3){return _0x454cf3[_0x73cc('0x34')](_0x52b39d[_0x73cc('0x30')]['ids'],_[_0x73cc('0x36')](_0x52b39d[_0x73cc('0x30')],[_0x73cc('0x37'),'id'])||{});}})[_0x73cc('0x15')](respondWithResult(_0x40572f,null))[_0x73cc('0x26')](handleError(_0x40572f,null));};exports['getMessages']=function(_0x59c285,_0x87a658){var _0x4fd811={'raw':![],'where':{}};var _0xac0316={};var _0x2b1086={'count':0x0,'rows':[]};return db[_0x73cc('0x1d')][_0x73cc('0x38')]({'where':{'id':_0x59c285[_0x73cc('0x28')]['id']}})['then'](handleEntityNotFound(_0x87a658,null))[_0x73cc('0x15')](function(_0x5a5da4){if(_0x5a5da4){_0xac0316[_0x73cc('0x29')]=_['keys'](db[_0x73cc('0x35')]['rawAttributes']);_0xac0316['query']=_[_0x73cc('0x2a')](_0x59c285[_0x73cc('0x24')]);_0xac0316[_0x73cc('0x39')]=_[_0x73cc('0x2b')](_0xac0316[_0x73cc('0x29')],_0xac0316[_0x73cc('0x24')]);_0x4fd811['attributes']=_[_0x73cc('0x2b')](_0xac0316[_0x73cc('0x29')],qs[_0x73cc('0x2d')](_0x59c285[_0x73cc('0x24')][_0x73cc('0x2d')]));_0x4fd811['attributes']=_0x4fd811['attributes'][_0x73cc('0x3a')]?_0x4fd811[_0x73cc('0x2c')]:_0xac0316['model'];if(!_0x59c285[_0x73cc('0x24')][_0x73cc('0x3b')]('nolimit')){_0x4fd811[_0x73cc('0x13')]=qs[_0x73cc('0x13')](_0x59c285[_0x73cc('0x24')]['limit']);_0x4fd811[_0x73cc('0x10')]=qs['offset'](_0x59c285['query']['offset']);}_0x4fd811[_0x73cc('0x3c')]=qs['sort'](_0x59c285['query']['sort']);_0x4fd811[_0x73cc('0x3d')]=qs[_0x73cc('0x39')](_[_0x73cc('0x3e')](_0x59c285[_0x73cc('0x24')],_0xac0316[_0x73cc('0x39')]));_0x4fd811[_0x73cc('0x3d')][_0x73cc('0x3f')]=_0x5a5da4['id'];if(_0x59c285[_0x73cc('0x24')][_0x73cc('0x40')]){_0x4fd811[_0x73cc('0x3d')]=_[_0x73cc('0x41')](_0x4fd811[_0x73cc('0x3d')],{'$or':_[_0x73cc('0x1c')](_0x4fd811[_0x73cc('0x2c')],function(_0x1d60fc){var _0x22c9d8={};_0x22c9d8[_0x1d60fc]={'$like':'%'+_0x59c285[_0x73cc('0x24')][_0x73cc('0x40')]+'%'};return _0x22c9d8;})});}if(_0x59c285[_0x73cc('0x24')][_0x73cc('0x42')]){var _0x4f3c51=_0x59c285['query'][_0x73cc('0x42')]['split'](',');var _0x1c4082={};_0x1c4082[_0x4f3c51[0x0]]={'$gte':moment(_0x4f3c51[0x1])['format'](_0x73cc('0x43'))};_0x4fd811[_0x73cc('0x3d')]=_['merge'](_0x4fd811[_0x73cc('0x3d')],_0x1c4082);}_0x4fd811=_[_0x73cc('0x41')]({},_0x4fd811,_0x59c285['options']);return db[_0x73cc('0x35')]['count']({'where':_0x4fd811[_0x73cc('0x3d')]})[_0x73cc('0x15')](function(_0x5b5a57){_0x2b1086['count']=_0x5b5a57;if(_0x59c285[_0x73cc('0x24')][_0x73cc('0x44')]){_0x4fd811[_0x73cc('0x2e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4fd811);})[_0x73cc('0x15')](function(_0x43de31){_0x2b1086['rows']=_0x43de31;return _0x2b1086;});}})[_0x73cc('0x15')](respondWithFilteredResult(_0x87a658,_0x4fd811))[_0x73cc('0x26')](handleError(_0x87a658,null));};exports['addTags']=function(_0x3eed8b,_0x3e14e8){return db[_0x73cc('0x1d')][_0x73cc('0x32')]({'where':{'id':_0x3eed8b['params']['id']}})[_0x73cc('0x15')](handleEntityNotFound(_0x3e14e8,null))['then'](function(_0x2ba912){if(_0x2ba912){return _0x2ba912['setTags'](_0x3eed8b[_0x73cc('0x30')][_0x73cc('0x37')],_[_0x73cc('0x36')](_0x3eed8b[_0x73cc('0x30')],[_0x73cc('0x37'),'id'])||{})[_0x73cc('0x45')](function(){return db['Tag'][_0x73cc('0x46')]({'attributes':['id','name','color'],'where':{'id':_0x3eed8b[_0x73cc('0x30')][_0x73cc('0x37')]}});})[_0x73cc('0x15')](function(_0x27378a){socket['emit'](_0x73cc('0x47'),{'id':Number(_0x3eed8b[_0x73cc('0x28')]['id']),'tags':_0x27378a||[]});return{'id':Number(_0x3eed8b[_0x73cc('0x28')]['id']),'tags':_0x27378a||[]};});}})['then'](respondWithResult(_0x3e14e8,null))[_0x73cc('0x26')](handleError(_0x3e14e8,null));};exports[_0x73cc('0x48')]=function(_0x10d649,_0x473a37){return db[_0x73cc('0x1d')][_0x73cc('0x32')]({'where':{'id':_0x10d649[_0x73cc('0x28')]['id']}})[_0x73cc('0x15')](handleEntityNotFound(_0x473a37,null))[_0x73cc('0x15')](function(_0x5db3a9){if(_0x5db3a9){return _0x5db3a9['removeTags'](_0x10d649[_0x73cc('0x24')][_0x73cc('0x37')]);}})[_0x73cc('0x15')](respondWithStatusCode(_0x473a37,null))[_0x73cc('0x26')](handleError(_0x473a37,null));};exports[_0x73cc('0x49')]=function(_0x1a4040,_0x3e1b9c){var _0x87968b=moment()['unix']()[_0x73cc('0x4a')]();var _0x1aa7ed=path['join'](config[_0x73cc('0x4b')],_0x73cc('0x4c'),_0x73cc('0x4d'),_0x73cc('0x4e'));var _0x180dde=path[_0x73cc('0x4f')](config[_0x73cc('0x4b')],_0x73cc('0x4c'),_0x73cc('0x4d'),_0x73cc('0x50'));var _0x5782e6=path[_0x73cc('0x4f')](_0x1aa7ed,_0x87968b);var _0x2f61bc=util['format'](_0x73cc('0x51'),_0x1a4040[_0x73cc('0x28')]['id'],_0x87968b);var _0x187f31=path[_0x73cc('0x4f')](_0x1aa7ed,_0x2f61bc);var _0x21ca1e=[];_0x21ca1e[_0x73cc('0x52')]({'model':db[_0x73cc('0x53')],'as':_0x73cc('0x53'),'raw':!![]});var _0x3c99a2=[{'model':db[_0x73cc('0x35')],'as':_0x73cc('0x54'),'attributes':['id','body',_0x73cc('0x55')],'include':_0x21ca1e}];return db[_0x73cc('0x1d')][_0x73cc('0x32')]({'where':{'id':_0x1a4040[_0x73cc('0x28')]['id']},'include':_0x3c99a2})[_0x73cc('0x15')](handleEntityNotFound(_0x3e1b9c,null))[_0x73cc('0x15')](function(_0xdb637b){if(_0xdb637b&&_0xdb637b[_0x73cc('0x54')]){var _0x3a0897=_0xdb637b['get']({'plain':!![]});fs[_0x73cc('0x56')](_0x5782e6);for(var _0x2050d5=0x0;_0x2050d5<_0x3a0897['Messages']['length'];_0x2050d5++){var _0x4bc66a=_0x3a0897[_0x73cc('0x54')][_0x2050d5]['Attachment'];if(_0x4bc66a){var _0x3d0506=path[_0x73cc('0x4f')](_0x180dde,_0x4bc66a[_0x73cc('0x57')]);if(fs[_0x73cc('0x58')](_0x3d0506)){fs[_0x73cc('0x59')](_0x3d0506)[_0x73cc('0x5a')](fs[_0x73cc('0x5b')](path['join'](_0x5782e6,_0x4bc66a['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x2496aa,_0x2e10e9){zipdir(_0x5782e6,{'saveTo':_0x187f31},function(_0x206d78,_0x3c5d57){if(_0x206d78)return _0x2e10e9(_0x206d78);return _0x2496aa(_0x3c5d57);});})[_0x73cc('0x15')](function(){return new BPromise(function(_0x2f304b,_0x3b6ea3){rimraf(_0x5782e6,function(_0x21bb5f){if(_0x21bb5f)_0x3b6ea3(_0x21bb5f);return _0x2f304b();});});})[_0x73cc('0x15')](function(){return _0x3e1b9c[_0x73cc('0x49')](_0x187f31,_0x2f61bc,function(_0x11c0d0){if(_0x11c0d0){console[_0x73cc('0x5c')](_0x73cc('0x5d'),_0x11c0d0);}else{fs[_0x73cc('0x5e')](_0x187f31);}});});});}else{return _0x3e1b9c[_0x73cc('0xd')](0xc8);}})[_0x73cc('0x26')](handleError(_0x3e1b9c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 73ca888..3cb41da 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 _0x5743=['emit','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','setDataValue','Users','map','unreadMessages'];(function(_0x4174bb,_0x2889f6){var _0x363e33=function(_0x193ce3){while(--_0x193ce3){_0x4174bb['push'](_0x4174bb['shift']());}};_0x363e33(++_0x2889f6);}(_0x5743,0xed));var _0x3574=function(_0x343f1d,_0x2ecc92){_0x343f1d=_0x343f1d-0x0;var _0x54beb9=_0x5743[_0x343f1d];return _0x54beb9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x3574('0x0'))['db'][_0x3574('0x1')];var FaxMessage=require(_0x3574('0x0'))['db'][_0x3574('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3574('0x3'),'afterUpdate':_0x3574('0x4'),'afterDestroy':_0x3574('0x5')};function emitEvent(_0x598c4a){return function(_0x19e13c,_0x38ae33,_0x376b7c){_0x19e13c['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x51c5a7){_0x19e13c[_0x3574('0x6')](_0x3574('0x7'),_0x51c5a7[_0x3574('0x8')](function(_0x2a826f){return{'id':_0x2a826f['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x19e13c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x197631){_0x19e13c['setDataValue'](_0x3574('0x9'),_0x197631['length']);FaxInteractionEvents[_0x3574('0xa')](_0x598c4a+':'+_0x19e13c['id'],_0x19e13c);FaxInteractionEvents[_0x3574('0xa')](_0x598c4a,_0x19e13c);_0x376b7c(null);})['catch'](_0x376b7c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x3574('0xb')](e,emitEvent(event));}}module[_0x3574('0xc')]=FaxInteractionEvents; \ No newline at end of file +var _0xb2eb=['Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','then'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xb2eb,0x199));var _0xbb2e=function(_0x5d8756,_0x1211eb){_0x5d8756=_0x5d8756-0x0;var _0x1379f2=_0xb2eb[_0x5d8756];return _0x1379f2;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xbb2e('0x0'))['db'][_0xbb2e('0x1')];var FaxMessage=require(_0xbb2e('0x0'))['db'][_0xbb2e('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xbb2e('0x3')](0x0);var events={'afterCreate':_0xbb2e('0x4'),'afterUpdate':_0xbb2e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39d638){return function(_0x23e5cd,_0x22df63,_0x2bb720){_0x23e5cd['getUsers']({'attributes':['id'],'raw':!![]})[_0xbb2e('0x6')](function(_0x3f0223){_0x23e5cd['setDataValue'](_0xbb2e('0x7'),_0x3f0223[_0xbb2e('0x8')](function(_0x51c1e9){return{'id':_0x51c1e9['id']};}));return FaxMessage[_0xbb2e('0x9')]({'where':{'FaxInteractionId':_0x23e5cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb2e('0x6')](function(_0x613a36){_0x23e5cd['setDataValue'](_0xbb2e('0xa'),_0x613a36[_0xbb2e('0xb')]);FaxInteractionEvents[_0xbb2e('0xc')](_0x39d638+':'+_0x23e5cd['id'],_0x23e5cd);FaxInteractionEvents[_0xbb2e('0xc')](_0x39d638,_0x23e5cd);_0x2bb720(null);})['catch'](_0x2bb720(null));};}for(var e in events){if(events[_0xbb2e('0xd')](e)){var event=events[e];FaxInteraction[_0xbb2e('0xe')](e,emitEvent(event));}}module[_0xbb2e('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6f848b5..d675860 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 _0xa984=['exports','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xa984,0x15a));var _0x4a98=function(_0x6b8e6,_0x5b5b8d){_0x6b8e6=_0x6b8e6-0x0;var _0x11e8d9=_0xa984[_0x6b8e6];return _0x11e8d9;};'use strict';var _=require(_0x4a98('0x0'));var util=require(_0x4a98('0x1'));var logger=require(_0x4a98('0x2'))(_0x4a98('0x3'));var moment=require(_0x4a98('0x4'));var BPromise=require(_0x4a98('0x5'));var rp=require(_0x4a98('0x6'));var fs=require('fs');var path=require(_0x4a98('0x7'));var rimraf=require(_0x4a98('0x8'));var config=require(_0x4a98('0x9'));var attributes=require(_0x4a98('0xa'));module[_0x4a98('0xb')]=function(_0x35e7f4,_0x310c98){return _0x35e7f4['define']('FaxInteraction',attributes,{'tableName':_0x4a98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d68ad,_0x43bf6d,_0x59e3a5){if(_0x5d68ad[_0x4a98('0xd')]('closed')){_0x5d68ad[_0x4a98('0xe')]=moment()[_0x4a98('0xf')](_0x4a98('0x10'));}_0x59e3a5(null,_0x5d68ad);}}});}; \ No newline at end of file +var _0x43b7=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3b4cea,_0x433ebf){var _0x4b7b98=function(_0x511ad3){while(--_0x511ad3){_0x3b4cea['push'](_0x3b4cea['shift']());}};_0x4b7b98(++_0x433ebf);}(_0x43b7,0x1df));var _0x743b=function(_0x1aff5f,_0x5f0ceb){_0x1aff5f=_0x1aff5f-0x0;var _0x5009c9=_0x43b7[_0x1aff5f];return _0x5009c9;};'use strict';var _=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var logger=require(_0x743b('0x2'))(_0x743b('0x3'));var moment=require(_0x743b('0x4'));var BPromise=require('bluebird');var rp=require(_0x743b('0x5'));var fs=require('fs');var path=require(_0x743b('0x6'));var rimraf=require(_0x743b('0x7'));var config=require(_0x743b('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x743b('0x9')]=function(_0x5c4b29,_0x5e8d1e){return _0x5c4b29[_0x743b('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x107ef9,_0x422eca,_0x4eec18){if(_0x107ef9[_0x743b('0xb')](_0x743b('0xc'))){_0x107ef9[_0x743b('0xd')]=moment()[_0x743b('0xe')](_0x743b('0xf'));}_0x4eec18(null,_0x107ef9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fe19159..be43673 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 _0x9503=['FaxInteraction','update','options','raw','where','attributes','limit','stringify','catch','AddTagsToFaxInteraction','find','addTags','body','ids','spread','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateFaxInteraction'];(function(_0xa86251,_0x535ced){var _0x300ffe=function(_0x4e48ae){while(--_0x4e48ae){_0xa86251['push'](_0xa86251['shift']());}};_0x300ffe(++_0x535ced);}(_0x9503,0x127));var _0x3950=function(_0x589a9f,_0x24b01){_0x589a9f=_0x589a9f-0x0;var _0x14f626=_0x9503[_0x589a9f];return _0x14f626;};'use strict';var _=require(_0x3950('0x0'));var util=require('util');var moment=require(_0x3950('0x1'));var BPromise=require(_0x3950('0x2'));var rs=require(_0x3950('0x3'));var fs=require('fs');var Redis=require(_0x3950('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3950('0x5'))(_0x3950('0x6'));var config=require(_0x3950('0x7'));var jayson=require(_0x3950('0x8'));var client=jayson[_0x3950('0x9')][_0x3950('0xa')]({'port':0x232a});config[_0x3950('0xb')]=_['defaults'](config[_0x3950('0xb')],{'host':_0x3950('0xc'),'port':0x18eb});var socket=require(_0x3950('0xd'))(new Redis(config[_0x3950('0xb')]));require(_0x3950('0xe'))['register'](socket);function respondWithRpcPromise(_0x18b8cb,_0x5608fc,_0x5d55ad){return new BPromise(function(_0x3fb2ae,_0x43ab68){return client['request'](_0x18b8cb,_0x5d55ad)[_0x3950('0xf')](function(_0x190c1f){logger[_0x3950('0x10')](_0x3950('0x11'),_0x5608fc,_0x3950('0x12'));logger[_0x3950('0x13')](_0x3950('0x14'),_0x5608fc,'request\x20sent',JSON['stringify'](_0x190c1f));if(_0x190c1f[_0x3950('0x15')]){if(_0x190c1f[_0x3950('0x15')]['code']===0x1f4){logger[_0x3950('0x15')](_0x3950('0x11'),_0x5608fc,_0x190c1f[_0x3950('0x15')]['message']);return _0x43ab68(_0x190c1f[_0x3950('0x15')][_0x3950('0x16')]);}logger[_0x3950('0x15')](_0x3950('0x11'),_0x5608fc,_0x190c1f[_0x3950('0x15')]['message']);return _0x3fb2ae(_0x190c1f['error'][_0x3950('0x16')]);}else{logger['info'](_0x3950('0x11'),_0x5608fc,_0x3950('0x12'));_0x3fb2ae(_0x190c1f[_0x3950('0x17')][_0x3950('0x16')]);}})['catch'](function(_0x4baba8){logger[_0x3950('0x15')](_0x3950('0x11'),_0x5608fc,_0x4baba8);_0x43ab68(_0x4baba8);});});}exports[_0x3950('0x18')]=function(_0xe5c5cc){var _0x59c386=this;return new Promise(function(_0x1d5979,_0x289d4f){return db[_0x3950('0x19')][_0x3950('0x1a')](_0xe5c5cc['body'],{'raw':_0xe5c5cc['options']?_0xe5c5cc[_0x3950('0x1b')][_0x3950('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe5c5cc['options']?_0xe5c5cc[_0x3950('0x1b')][_0x3950('0x1d')]||null:null,'attributes':_0xe5c5cc[_0x3950('0x1b')]?_0xe5c5cc['options'][_0x3950('0x1e')]||null:null,'limit':_0xe5c5cc[_0x3950('0x1b')]?_0xe5c5cc['options'][_0x3950('0x1f')]||null:null})['then'](function(_0x2de1cd){logger[_0x3950('0x10')](_0x3950('0x18'),_0xe5c5cc);logger['debug'](_0x3950('0x18'),_0xe5c5cc,JSON[_0x3950('0x20')](_0x2de1cd));_0x1d5979(_0x2de1cd);})[_0x3950('0x21')](function(_0xe30807){logger[_0x3950('0x15')](_0x3950('0x18'),_0xe30807[_0x3950('0x16')],_0xe5c5cc);_0x289d4f(_0x59c386[_0x3950('0x15')](0x1f4,_0xe30807[_0x3950('0x16')]));});});};exports[_0x3950('0x22')]=function(_0x5859a3){return new Promise(function(_0x9290f,_0x4e009e){return db[_0x3950('0x19')][_0x3950('0x23')]({'where':_0x5859a3[_0x3950('0x1b')]?_0x5859a3['options'][_0x3950('0x1d')]||null:null})[_0x3950('0xf')](function(_0x10383a){if(_0x10383a){return _0x10383a[_0x3950('0x24')](_0x5859a3[_0x3950('0x25')][_0x3950('0x26')],_['omit'](_0x5859a3[_0x3950('0x25')],[_0x3950('0x26'),'id'])||{});}})[_0x3950('0x27')](function(_0x2f74ae){logger[_0x3950('0x10')]('AddTags',_0x5859a3);logger[_0x3950('0x13')]('AddTags',_0x5859a3,JSON[_0x3950('0x20')](_0x2f74ae));_0x9290f(_0x2f74ae);})['catch'](function(_0x436534){logger[_0x3950('0x15')]('AddTags',_0x436534[_0x3950('0x16')],_0x5859a3);_0x4e009e(_this[_0x3950('0x15')](0x1f4,_0x436534[_0x3950('0x16')]));});});}; \ No newline at end of file +var _0x66d2=['../../config/utils','../../config/environment','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','then','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis'];(function(_0x6acb0c,_0xc85a14){var _0x179220=function(_0x306657){while(--_0x306657){_0x6acb0c['push'](_0x6acb0c['shift']());}};_0x179220(++_0xc85a14);}(_0x66d2,0x1dc));var _0x266d=function(_0x3c683d,_0x12bca1){_0x3c683d=_0x3c683d-0x0;var _0x9745a6=_0x66d2[_0x3c683d];return _0x9745a6;};'use strict';var _=require(_0x266d('0x0'));var util=require(_0x266d('0x1'));var moment=require(_0x266d('0x2'));var BPromise=require(_0x266d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x266d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x266d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x266d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x266d('0x7')]({'port':0x232a});config[_0x266d('0x8')]=_['defaults'](config[_0x266d('0x8')],{'host':_0x266d('0x9'),'port':0x18eb});var socket=require(_0x266d('0xa'))(new Redis(config[_0x266d('0x8')]));require(_0x266d('0xb'))[_0x266d('0xc')](socket);function respondWithRpcPromise(_0x38a503,_0x1f360e,_0x51afd5){return new BPromise(function(_0x4608a8,_0x3e0b6b){return client[_0x266d('0xd')](_0x38a503,_0x51afd5)['then'](function(_0x434952){logger[_0x266d('0xe')](_0x266d('0xf'),_0x1f360e,'request\x20sent');logger[_0x266d('0x10')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1f360e,_0x266d('0x11'),JSON[_0x266d('0x12')](_0x434952));if(_0x434952[_0x266d('0x13')]){if(_0x434952[_0x266d('0x13')][_0x266d('0x14')]===0x1f4){logger[_0x266d('0x13')](_0x266d('0xf'),_0x1f360e,_0x434952[_0x266d('0x13')]['message']);return _0x3e0b6b(_0x434952[_0x266d('0x13')]['message']);}logger[_0x266d('0x13')](_0x266d('0xf'),_0x1f360e,_0x434952[_0x266d('0x13')][_0x266d('0x15')]);return _0x4608a8(_0x434952[_0x266d('0x13')][_0x266d('0x15')]);}else{logger['info'](_0x266d('0xf'),_0x1f360e,_0x266d('0x11'));_0x4608a8(_0x434952[_0x266d('0x16')][_0x266d('0x15')]);}})[_0x266d('0x17')](function(_0x56c17c){logger[_0x266d('0x13')](_0x266d('0xf'),_0x1f360e,_0x56c17c);_0x3e0b6b(_0x56c17c);});});}exports[_0x266d('0x18')]=function(_0x2332f7){var _0x2fe474=this;return new Promise(function(_0x2ea7d1,_0x146359){return db[_0x266d('0x19')][_0x266d('0x1a')](_0x2332f7['body'],{'raw':_0x2332f7[_0x266d('0x1b')]?_0x2332f7[_0x266d('0x1b')][_0x266d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2332f7[_0x266d('0x1b')]?_0x2332f7[_0x266d('0x1b')][_0x266d('0x1d')]||null:null,'attributes':_0x2332f7[_0x266d('0x1b')]?_0x2332f7['options'][_0x266d('0x1e')]||null:null,'limit':_0x2332f7[_0x266d('0x1b')]?_0x2332f7[_0x266d('0x1b')][_0x266d('0x1f')]||null:null})[_0x266d('0x20')](function(_0x416471){logger[_0x266d('0xe')](_0x266d('0x18'),_0x2332f7);logger[_0x266d('0x10')](_0x266d('0x18'),_0x2332f7,JSON['stringify'](_0x416471));_0x2ea7d1(_0x416471);})['catch'](function(_0x1440c6){logger[_0x266d('0x13')]('UpdateFaxInteraction',_0x1440c6[_0x266d('0x15')],_0x2332f7);_0x146359(_0x2fe474[_0x266d('0x13')](0x1f4,_0x1440c6[_0x266d('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0xc9c567){return new Promise(function(_0x39ba35,_0x434d1b){return db[_0x266d('0x19')]['find']({'where':_0xc9c567[_0x266d('0x1b')]?_0xc9c567['options'][_0x266d('0x1d')]||null:null})[_0x266d('0x20')](function(_0x321e6b){if(_0x321e6b){return _0x321e6b['addTags'](_0xc9c567[_0x266d('0x21')][_0x266d('0x22')],_[_0x266d('0x23')](_0xc9c567[_0x266d('0x21')],[_0x266d('0x22'),'id'])||{});}})['spread'](function(_0x23c8b8){logger[_0x266d('0xe')](_0x266d('0x24'),_0xc9c567);logger[_0x266d('0x10')](_0x266d('0x24'),_0xc9c567,JSON[_0x266d('0x12')](_0x23c8b8));_0x39ba35(_0x23c8b8);})[_0x266d('0x17')](function(_0x1a6c06){logger[_0x266d('0x13')](_0x266d('0x24'),_0x1a6c06[_0x266d('0x15')],_0xc9c567);_0x434d1b(_this[_0x266d('0x13')](0x1f4,_0x1a6c06[_0x266d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b81f6e7..730363b 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 _0x51eb=['./faxInteraction.events','save','remove','update','removeListener','length','faxInteraction:'];(function(_0x2724e5,_0x229d74){var _0x4b6621=function(_0x787046){while(--_0x787046){_0x2724e5['push'](_0x2724e5['shift']());}};_0x4b6621(++_0x229d74);}(_0x51eb,0xb6));var _0xb51e=function(_0x2e2d7e,_0x58052a){_0x2e2d7e=_0x2e2d7e-0x0;var _0x46c5b6=_0x51eb[_0x2e2d7e];return _0x46c5b6;};'use strict';var FaxInteractionEvents=require(_0xb51e('0x0'));var events=[_0xb51e('0x1'),_0xb51e('0x2'),_0xb51e('0x3')];function createListener(_0x3a368d,_0x76f7a2){return function(_0x3eba13){_0x76f7a2['emit'](_0x3a368d,_0x3eba13);};}function removeListener(_0x580a9e,_0x2dd4d6){return function(){FaxInteractionEvents[_0xb51e('0x4')](_0x580a9e,_0x2dd4d6);};}exports['register']=function(_0x4851c9){for(var _0x164695=0x0,_0x19d05f=events[_0xb51e('0x5')];_0x164695<_0x19d05f;_0x164695++){var _0x694115=events[_0x164695];var _0x31ef39=createListener(_0xb51e('0x6')+_0x694115,_0x4851c9);FaxInteractionEvents['on'](_0x694115,_0x31ef39);}}; \ No newline at end of file +var _0xc2e0=['save','remove','emit','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x5d061b,_0x930ff8){var _0x1c4310=function(_0x49d135){while(--_0x49d135){_0x5d061b['push'](_0x5d061b['shift']());}};_0x1c4310(++_0x930ff8);}(_0xc2e0,0x19c));var _0x0c2e=function(_0xe2b013,_0x5790ce){_0xe2b013=_0xe2b013-0x0;var _0x37e2cc=_0xc2e0[_0xe2b013];return _0x37e2cc;};'use strict';var FaxInteractionEvents=require(_0x0c2e('0x0'));var events=[_0x0c2e('0x1'),_0x0c2e('0x2'),'update'];function createListener(_0x331c50,_0x219e59){return function(_0x4957a9){_0x219e59[_0x0c2e('0x3')](_0x331c50,_0x4957a9);};}function removeListener(_0x3f4740,_0x1870a0){return function(){FaxInteractionEvents[_0x0c2e('0x4')](_0x3f4740,_0x1870a0);};}exports[_0x0c2e('0x5')]=function(_0x420cfa){for(var _0x437ff9=0x0,_0x271cdc=events['length'];_0x437ff9<_0x271cdc;_0x437ff9++){var _0x102fb8=events[_0x437ff9];var _0x4fefb3=createListener(_0x0c2e('0x6')+_0x102fb8,_0x420cfa);FaxInteractionEvents['on'](_0x102fb8,_0x4fefb3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 21196b9..824301a 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 _0x802c=['create','post','/:id/messages','addMessage','fax','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','/:id/download','download'];(function(_0x1dc1bc,_0x13522c){var _0xe8656e=function(_0x486672){while(--_0x486672){_0x1dc1bc['push'](_0x1dc1bc['shift']());}};_0xe8656e(++_0x13522c);}(_0x802c,0x1dd));var _0xc802=function(_0x1330c2,_0x27a429){_0x1330c2=_0x1330c2-0x0;var _0x170285=_0x802c[_0x1330c2];return _0x170285;};'use strict';var multer=require(_0xc802('0x0'));var util=require(_0xc802('0x1'));var path=require(_0xc802('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc802('0x3')]();var fs_extra=require(_0xc802('0x4'));var auth=require(_0xc802('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc802('0x6'));var controller=require(_0xc802('0x7'));router[_0xc802('0x8')]('/',auth[_0xc802('0x9')](),controller[_0xc802('0xa')]);router[_0xc802('0x8')]('/describe',auth[_0xc802('0x9')](),controller[_0xc802('0xb')]);router[_0xc802('0x8')](_0xc802('0xc'),auth[_0xc802('0x9')](),controller['show']);router[_0xc802('0x8')]('/:id/messages',auth[_0xc802('0x9')](),controller[_0xc802('0xd')]);router[_0xc802('0x8')](_0xc802('0xe'),auth[_0xc802('0x9')](),controller[_0xc802('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc802('0x10')]);router[_0xc802('0x11')](_0xc802('0x12'),auth[_0xc802('0x9')](),controller[_0xc802('0x13')]);router[_0xc802('0x11')]('/:id/tags',auth[_0xc802('0x9')](),interaction['tracked'](_0xc802('0x14'),'faxinteraction:addtags'),controller[_0xc802('0x15')]);router['put'](_0xc802('0xc'),auth[_0xc802('0x9')](),interaction[_0xc802('0x16')](_0xc802('0x14'),_0xc802('0x17')),controller[_0xc802('0x18')]);router[_0xc802('0x19')](_0xc802('0xc'),auth[_0xc802('0x9')](),interaction[_0xc802('0x16')](_0xc802('0x14'),_0xc802('0x1a')),controller['destroy']);router[_0xc802('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xc802('0x1b')]);module[_0xc802('0x1c')]=router; \ No newline at end of file +var _0x44ed=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44ed,0x183));var _0xd44e=function(_0x337d5d,_0x359b4d){_0x337d5d=_0x337d5d-0x0;var _0x3c2a16=_0x44ed[_0x337d5d];return _0x3c2a16;};'use strict';var multer=require(_0xd44e('0x0'));var util=require(_0xd44e('0x1'));var path=require('path');var timeout=require(_0xd44e('0x2'));var express=require(_0xd44e('0x3'));var router=express[_0xd44e('0x4')]();var fs_extra=require(_0xd44e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd44e('0x6'));var config=require(_0xd44e('0x7'));var controller=require(_0xd44e('0x8'));router[_0xd44e('0x9')]('/',auth[_0xd44e('0xa')](),controller[_0xd44e('0xb')]);router[_0xd44e('0x9')](_0xd44e('0xc'),auth[_0xd44e('0xa')](),controller[_0xd44e('0xd')]);router['get'](_0xd44e('0xe'),auth['isAuthenticated'](),controller[_0xd44e('0xf')]);router['get'](_0xd44e('0x10'),auth['isAuthenticated'](),controller[_0xd44e('0x11')]);router[_0xd44e('0x9')](_0xd44e('0x12'),auth[_0xd44e('0xa')](),controller['download']);router[_0xd44e('0x13')]('/',auth['isAuthenticated'](),controller[_0xd44e('0x14')]);router[_0xd44e('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xd44e('0x15'),auth[_0xd44e('0xa')](),interaction['tracked'](_0xd44e('0x16'),_0xd44e('0x17')),controller[_0xd44e('0x18')]);router[_0xd44e('0x19')]('/:id',auth[_0xd44e('0xa')](),interaction[_0xd44e('0x1a')](_0xd44e('0x16'),_0xd44e('0x1b')),controller[_0xd44e('0x1c')]);router['delete'](_0xd44e('0xe'),auth[_0xd44e('0xa')](),interaction[_0xd44e('0x1a')](_0xd44e('0x16'),_0xd44e('0x1d')),controller['destroy']);router[_0xd44e('0x1e')](_0xd44e('0x15'),auth[_0xd44e('0xa')](),controller[_0xd44e('0x1f')]);module[_0xd44e('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 1e1f87f..04306ba 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 _0x0e9f=['BOOLEAN','out','sequelize','exports'];(function(_0xe7616e,_0x32e102){var _0xfbc220=function(_0x327d49){while(--_0x327d49){_0xe7616e['push'](_0xe7616e['shift']());}};_0xfbc220(++_0x32e102);}(_0x0e9f,0x116));var _0xf0e9=function(_0x10f72e,_0x325233){_0x10f72e=_0x10f72e-0x0;var _0x1df770=_0x0e9f[_0x10f72e];return _0x1df770;};'use strict';var Sequelize=require(_0xf0e9('0x0'));module[_0xf0e9('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf0e9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf0e9('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x383d=['medium','BOOLEAN','out','DATE','TEXT'];(function(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd383('0x0')](_0xd383('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd383('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd383('0x3')),'defaultValue':_0xd383('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd383('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd383('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6be229f..c95033c 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 _0xef59=['readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','../../config/logger','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','fullname','create','CmContact','isNil','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','files','attachments','download','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','map','FaxMessage','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','find','body','describe','fax-interactions','accept','read'];(function(_0x1b29a4,_0xe794d3){var _0x2eddbd=function(_0x5c8ef4){while(--_0x5c8ef4){_0x1b29a4['push'](_0x1b29a4['shift']());}};_0x2eddbd(++_0xe794d3);}(_0xef59,0x1da));var _0x9ef5=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0xef59[_0x5c8628];return _0xcbd50e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ef5('0x0'));var zipdir=require(_0x9ef5('0x1'));var jsonpatch=require(_0x9ef5('0x2'));var rp=require('request-promise');var moment=require(_0x9ef5('0x3'));var BPromise=require(_0x9ef5('0x4'));var Mustache=require(_0x9ef5('0x5'));var util=require('util');var path=require(_0x9ef5('0x6'));var sox=require(_0x9ef5('0x7'));var csv=require(_0x9ef5('0x8'));var ejs=require(_0x9ef5('0x9'));var fs=require('fs');var fs_extra=require(_0x9ef5('0xa'));var _=require(_0x9ef5('0xb'));var squel=require(_0x9ef5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9ef5('0x8'));var querystring=require(_0x9ef5('0xd'));var Papa=require(_0x9ef5('0xe'));var Redis=require('ioredis');var authService=require(_0x9ef5('0xf'));var qs=require(_0x9ef5('0x10'));var as=require(_0x9ef5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9ef5('0x12'));var utils=require('../../config/utils');var config=require(_0x9ef5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ef5('0x14'))['db'];config[_0x9ef5('0x15')]=_[_0x9ef5('0x16')](config[_0x9ef5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ef5('0x17'))(new Redis(config[_0x9ef5('0x15')]));require(_0x9ef5('0x18'))[_0x9ef5('0x19')](socket);var jayson=require(_0x9ef5('0x1a'));var client=jayson['client'][_0x9ef5('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x9ef5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2a38a1,_0x198212,_0x33b2c3,_0x6d93b0){return new BPromise(function(_0x7a304d,_0x5854fc){var _0x20a006=_0x6d93b0||client;return _0x20a006[_0x9ef5('0x1c')](_0x2a38a1,_0x33b2c3)[_0x9ef5('0x1d')](function(_0x1390b8){logger['info'](_0x9ef5('0x1e'),_0x198212,_0x9ef5('0x1f'));logger[_0x9ef5('0x20')](_0x9ef5('0x21'),_0x198212,_0x9ef5('0x1f'),JSON[_0x9ef5('0x22')](_0x1390b8));if(_0x1390b8['error']){if(_0x1390b8['error'][_0x9ef5('0x23')]===0x1f4){logger['error'](_0x9ef5('0x1e'),_0x198212,_0x1390b8[_0x9ef5('0x24')][_0x9ef5('0x25')]);return _0x5854fc(_0x1390b8[_0x9ef5('0x24')]['message']);}logger[_0x9ef5('0x24')](_0x9ef5('0x1e'),_0x198212,_0x1390b8['error'][_0x9ef5('0x25')]);return _0x7a304d(_0x1390b8['error']['message']);}else{logger[_0x9ef5('0x26')](_0x9ef5('0x1e'),_0x198212,_0x9ef5('0x1f'));_0x7a304d(_0x1390b8[_0x9ef5('0x27')]['message']);}})[_0x9ef5('0x28')](function(_0x421162){logger['error'](_0x9ef5('0x1e'),_0x198212,_0x421162);_0x5854fc(_0x421162);});});}function respondWithStatusCode(_0x16c0c0,_0x56c92c){_0x56c92c=_0x56c92c||0xcc;return function(_0x251472){if(_0x251472){return _0x16c0c0[_0x9ef5('0x29')](_0x56c92c);}return _0x16c0c0[_0x9ef5('0x2a')](_0x56c92c)[_0x9ef5('0x2b')]();};}function respondWithResult(_0x4fb416,_0x56b49d){_0x56b49d=_0x56b49d||0xc8;return function(_0x41f46b){if(_0x41f46b){return _0x4fb416[_0x9ef5('0x2a')](_0x56b49d)['json'](_0x41f46b);}};}function respondWithFilteredResult(_0x4bdea9,_0x4fe971){return function(_0xb6b39e){if(_0xb6b39e){var _0x3b7a01=typeof _0x4fe971[_0x9ef5('0x2c')]===_0x9ef5('0x2d')&&typeof _0x4fe971[_0x9ef5('0x2e')]===_0x9ef5('0x2d');var _0x3c1e65=_0xb6b39e[_0x9ef5('0x2f')];var _0x4ed636=_0x3b7a01?0x0:_0x4fe971['offset'];var _0x22c044=_0x3b7a01?_0xb6b39e['count']:_0x4fe971['offset']+_0x4fe971['limit'];var _0xf94c71;if(_0x22c044>=_0x3c1e65){_0x22c044=_0x3c1e65;_0xf94c71=0xc8;}else{_0xf94c71=0xce;}_0x4bdea9[_0x9ef5('0x2a')](_0xf94c71);return _0x4bdea9[_0x9ef5('0x30')](_0x9ef5('0x31'),_0x4ed636+'-'+_0x22c044+'/'+_0x3c1e65)[_0x9ef5('0x32')](_0xb6b39e);}return null;};}function patchUpdates(_0x3e8558){return function(_0x22a17f){try{jsonpatch['apply'](_0x22a17f,_0x3e8558,!![]);}catch(_0x4e612d){return BPromise[_0x9ef5('0x33')](_0x4e612d);}return _0x22a17f[_0x9ef5('0x34')]();};}function saveUpdates(_0x458115,_0x3d59f9){return function(_0x2b3baa){if(_0x2b3baa){return _0x2b3baa[_0x9ef5('0x35')](_0x458115)[_0x9ef5('0x1d')](function(_0xccb456){return _0xccb456;});}return null;};}function removeEntity(_0x3d715f,_0x15100c){return function(_0x1dcefd){if(_0x1dcefd){return _0x1dcefd[_0x9ef5('0x36')]()[_0x9ef5('0x1d')](function(){_0x3d715f[_0x9ef5('0x2a')](0xcc)[_0x9ef5('0x2b')]();});}};}function handleEntityNotFound(_0x53d903,_0x2ff4fa){return function(_0x5ea260){if(!_0x5ea260){_0x53d903[_0x9ef5('0x29')](0x194);}return _0x5ea260;};}function handleError(_0x18d9df,_0x121af2){_0x121af2=_0x121af2||0x1f4;return function(_0xe7dee5){logger[_0x9ef5('0x24')](_0xe7dee5[_0x9ef5('0x37')]);if(_0xe7dee5['name']){delete _0xe7dee5[_0x9ef5('0x38')];}_0x18d9df[_0x9ef5('0x2a')](_0x121af2)[_0x9ef5('0x39')](_0xe7dee5);};}exports['index']=function(_0x17171c,_0xc2c5f1){var _0x109b8f={},_0x1f6a50={},_0x95ce3c={'count':0x0,'rows':[]};var _0x541bdd=_[_0x9ef5('0x3a')](db[_0x9ef5('0x3b')][_0x9ef5('0x3c')],function(_0x4059df){return{'name':_0x4059df['fieldName'],'type':_0x4059df['type']['key']};});_0x1f6a50[_0x9ef5('0x3d')]=_[_0x9ef5('0x3a')](_0x541bdd,_0x9ef5('0x38'));_0x1f6a50['query']=_[_0x9ef5('0x3e')](_0x17171c[_0x9ef5('0x3f')]);_0x1f6a50[_0x9ef5('0x40')]=_[_0x9ef5('0x41')](_0x1f6a50[_0x9ef5('0x3d')],_0x1f6a50['query']);_0x109b8f['attributes']=_['intersection'](_0x1f6a50[_0x9ef5('0x3d')],qs['fields'](_0x17171c['query'][_0x9ef5('0x42')]));_0x109b8f[_0x9ef5('0x43')]=_0x109b8f[_0x9ef5('0x43')][_0x9ef5('0x44')]?_0x109b8f['attributes']:_0x1f6a50[_0x9ef5('0x3d')];if(!_0x17171c[_0x9ef5('0x3f')][_0x9ef5('0x45')](_0x9ef5('0x46'))){_0x109b8f[_0x9ef5('0x2e')]=qs[_0x9ef5('0x2e')](_0x17171c[_0x9ef5('0x3f')][_0x9ef5('0x2e')]);_0x109b8f['offset']=qs['offset'](_0x17171c['query'][_0x9ef5('0x2c')]);}_0x109b8f[_0x9ef5('0x47')]=qs[_0x9ef5('0x48')](_0x17171c['query'][_0x9ef5('0x48')]);_0x109b8f[_0x9ef5('0x49')]=qs[_0x9ef5('0x40')](_[_0x9ef5('0x4a')](_0x17171c[_0x9ef5('0x3f')],_0x1f6a50[_0x9ef5('0x40')]),_0x541bdd);if(_0x17171c[_0x9ef5('0x3f')][_0x9ef5('0x4b')]){_0x109b8f['where']=_[_0x9ef5('0x4c')](_0x109b8f['where'],{'$or':_[_0x9ef5('0x3a')](_0x541bdd,function(_0xbe4094){if(_0xbe4094[_0x9ef5('0x4d')]!=='VIRTUAL'){var _0x46ea73={};_0x46ea73[_0xbe4094[_0x9ef5('0x38')]]={'$like':'%'+_0x17171c['query'][_0x9ef5('0x4b')]+'%'};return _0x46ea73;}})});}_0x109b8f=_[_0x9ef5('0x4c')]({},_0x109b8f,_0x17171c[_0x9ef5('0x4e')]);var _0x16eed5={'where':_0x109b8f[_0x9ef5('0x49')]};return db[_0x9ef5('0x3b')][_0x9ef5('0x2f')](_0x16eed5)['then'](function(_0x541007){_0x95ce3c['count']=_0x541007;if(_0x17171c[_0x9ef5('0x3f')][_0x9ef5('0x4f')]){_0x109b8f[_0x9ef5('0x50')]=[{'all':!![]}];}return db[_0x9ef5('0x3b')]['findAll'](_0x109b8f);})[_0x9ef5('0x1d')](function(_0x2323f6){_0x95ce3c[_0x9ef5('0x51')]=_0x2323f6;return _0x95ce3c;})[_0x9ef5('0x1d')](respondWithFilteredResult(_0xc2c5f1,_0x109b8f))[_0x9ef5('0x28')](handleError(_0xc2c5f1,null));};exports[_0x9ef5('0x52')]=function(_0x158b6e,_0x567254){var _0x487265={'raw':!![],'where':{'id':_0x158b6e[_0x9ef5('0x53')]['id']}},_0x24c53b={};_0x24c53b['model']=_[_0x9ef5('0x3e')](db[_0x9ef5('0x3b')][_0x9ef5('0x3c')]);_0x24c53b[_0x9ef5('0x3f')]=_[_0x9ef5('0x3e')](_0x158b6e[_0x9ef5('0x3f')]);_0x24c53b[_0x9ef5('0x40')]=_[_0x9ef5('0x41')](_0x24c53b['model'],_0x24c53b[_0x9ef5('0x3f')]);_0x487265[_0x9ef5('0x43')]=_[_0x9ef5('0x41')](_0x24c53b[_0x9ef5('0x3d')],qs[_0x9ef5('0x42')](_0x158b6e['query']['fields']));_0x487265[_0x9ef5('0x43')]=_0x487265[_0x9ef5('0x43')]['length']?_0x487265[_0x9ef5('0x43')]:_0x24c53b[_0x9ef5('0x3d')];if(_0x158b6e[_0x9ef5('0x3f')][_0x9ef5('0x4f')]){_0x487265['include']=[{'all':!![]}];}_0x487265=_['merge']({},_0x487265,_0x158b6e[_0x9ef5('0x4e')]);return db[_0x9ef5('0x3b')][_0x9ef5('0x54')](_0x487265)[_0x9ef5('0x1d')](handleEntityNotFound(_0x567254,null))['then'](respondWithResult(_0x567254,null))['catch'](handleError(_0x567254,null));};exports['update']=function(_0x59cb72,_0x4cbbf1){if(_0x59cb72['body']['id']){delete _0x59cb72[_0x9ef5('0x55')]['id'];}return db[_0x9ef5('0x3b')]['find']({'where':{'id':_0x59cb72[_0x9ef5('0x53')]['id']}})[_0x9ef5('0x1d')](handleEntityNotFound(_0x4cbbf1,null))[_0x9ef5('0x1d')](saveUpdates(_0x59cb72[_0x9ef5('0x55')],null))[_0x9ef5('0x1d')](respondWithResult(_0x4cbbf1,null))[_0x9ef5('0x28')](handleError(_0x4cbbf1,null));};exports['destroy']=function(_0x39f6fc,_0x3e33cb){return db['FaxMessage'][_0x9ef5('0x54')]({'where':{'id':_0x39f6fc[_0x9ef5('0x53')]['id']}})[_0x9ef5('0x1d')](handleEntityNotFound(_0x3e33cb,null))[_0x9ef5('0x1d')](removeEntity(_0x3e33cb,null))[_0x9ef5('0x28')](handleError(_0x3e33cb,null));};exports[_0x9ef5('0x56')]=function(_0x58d16a,_0x18faad){return db['FaxMessage']['describe']()[_0x9ef5('0x1d')](respondWithResult(_0x18faad,null))['catch'](handleError(_0x18faad,null));};var interaction_log=require('../../config/logger')(_0x9ef5('0x57'));exports[_0x9ef5('0x58')]=function(_0x47f7a0,_0xcbaa37,_0x4c8808){var _0x5ecfcd={'agent':{},'channel':'fax'};if(_0x47f7a0[_0x9ef5('0x55')]['id']){delete _0x47f7a0[_0x9ef5('0x55')]['id'];}_0x47f7a0['body'][_0x9ef5('0x59')]=!![];_0x47f7a0[_0x9ef5('0x55')][_0x9ef5('0x5a')]=moment()[_0x9ef5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x47f7a0[_0x9ef5('0x55')][_0x9ef5('0x5c')]=_0x47f7a0['body']['UserId']||_0x47f7a0[_0x9ef5('0x5d')]['id'];_0x5ecfcd[_0x9ef5('0x5e')]['id']=_0x47f7a0['body'][_0x9ef5('0x5c')];return db[_0x9ef5('0x3b')][_0x9ef5('0x54')]({'where':{'id':_0x47f7a0['params']['id'],'UserId':null}})[_0x9ef5('0x1d')](handleEntityNotFound(_0xcbaa37,null))[_0x9ef5('0x1d')](saveUpdates(_0x47f7a0[_0x9ef5('0x55')],null))[_0x9ef5('0x1d')](function(_0x1fad3f){if(_0x1fad3f){_0x5ecfcd[_0x9ef5('0x25')]=_0x1fad3f[_0x9ef5('0x5f')]({'plain':!![]});return db[_0x9ef5('0x60')]['find']({'where':{'id':_0x1fad3f[_0x9ef5('0x61')]}});}return null;})[_0x9ef5('0x1d')](handleEntityNotFound(_0xcbaa37,null))['then'](function(_0x25bd04){if(_0x25bd04){return _0x25bd04['update']({'UserId':_0x47f7a0['body'][_0x9ef5('0x5c')],'read1stAt':_['isNil'](_0x25bd04[_0x9ef5('0x62')])?moment()['format'](_0x9ef5('0x63')):undefined});}return null;})[_0x9ef5('0x1d')](function(_0xcb7e59){if(_0xcb7e59){_0x5ecfcd[_0x9ef5('0x64')]=_0xcb7e59[_0x9ef5('0x5f')]({'plain':!![]});interaction_log[_0x9ef5('0x26')](_0x9ef5('0x65'),_0x47f7a0[_0x9ef5('0x5d')]['id'],_0x47f7a0[_0x9ef5('0x5d')]['name'],_0x47f7a0['user'][_0x9ef5('0x66')],_0x5ecfcd[_0x9ef5('0x64')]['id'],_0x47f7a0[_0x9ef5('0x55')]?JSON['stringify'](_0x47f7a0[_0x9ef5('0x55')]):_0x9ef5('0x67'));return respondWithRpcPromise(_0x9ef5('0x68'),_0x9ef5('0x69'),_0x5ecfcd);}return null;})['then'](function(_0x460a88){var _0x4b78aa=_0x9ef5('0x6a')+_0x460a88[_0x9ef5('0x25')][_0x9ef5('0x6b')];return db['sequelize'][_0x9ef5('0x3f')](_0x4b78aa,{'type':db[_0x9ef5('0x6c')][_0x9ef5('0x6d')][_0x9ef5('0x6e')],'raw':!![]})[_0x9ef5('0x1d')](function(_0x3b44ed){return _0x3b44ed;});})[_0x9ef5('0x1d')](function(_0x642e85){if(_0x642e85){_0x5ecfcd['message'][_0x9ef5('0x6f')]=_0x642e85[0x0];if(!_0x47f7a0[_0x9ef5('0x55')][_0x9ef5('0x5c')])return;return db[_0x9ef5('0x70')][_0x9ef5('0x54')]({'where':{'id':_0x47f7a0[_0x9ef5('0x55')][_0x9ef5('0x5c')],'role':_0x9ef5('0x5e')},'attributes':['id','name','fullname',_0x9ef5('0x71'),_0x9ef5('0x72')],'raw':!![]});}return null;})[_0x9ef5('0x1d')](function(_0x10d071){if(!_0x10d071)return null;_0x5ecfcd[_0x9ef5('0x25')][_0x9ef5('0x5e')]=_0x10d071;return _0x5ecfcd;})[_0x9ef5('0x1d')](function(_0x326774){if(_0x326774){if(_0x47f7a0[_0x9ef5('0x55')][_0x9ef5('0x73')]){_0x5ecfcd[_0x9ef5('0x25')][_0x9ef5('0x74')]=util[_0x9ef5('0x5b')](_0x9ef5('0x75'),_0x47f7a0['user']['name']);_0x5ecfcd['message'][_0x9ef5('0x76')]=_0x5ecfcd[_0x9ef5('0x76')];_0x5ecfcd[_0x9ef5('0x25')][_0x9ef5('0x77')]=_0x5ecfcd['channel'];_0x5ecfcd['message']['event']=_0x9ef5('0x58');return respondWithRpcPromise('EventManager',_0x9ef5('0x78'),{'event':_0x9ef5('0x79'),'message':_0x5ecfcd[_0x9ef5('0x25')]},client9002)[_0x9ef5('0x1d')](function(){return _0x5ecfcd;});}return _0x5ecfcd;}return null;})['then'](respondWithResult(_0xcbaa37,null))[_0x9ef5('0x28')](handleError(_0xcbaa37,null));};var interaction_log=require(_0x9ef5('0x7a'))(_0x9ef5('0x57'));exports[_0x9ef5('0x33')]=function(_0x973262,_0x10fa94,_0x2190b8){var _0x451b8a={'agent':{},'channel':_0x9ef5('0x7b')};if(_0x973262[_0x9ef5('0x55')]['id']){delete _0x973262['body']['id'];}_0x973262[_0x9ef5('0x55')][_0x9ef5('0x5c')]=_0x973262[_0x9ef5('0x55')][_0x9ef5('0x5c')]||_0x973262[_0x9ef5('0x5d')]['id'];_0x451b8a['agent']['id']=_0x973262['body'][_0x9ef5('0x5c')];return db[_0x9ef5('0x3b')][_0x9ef5('0x54')]({'where':{'id':_0x973262[_0x9ef5('0x53')]['id'],'UserId':null}})[_0x9ef5('0x1d')](handleEntityNotFound(_0x10fa94,null))[_0x9ef5('0x1d')](function(_0x55223c){if(_0x55223c){_0x451b8a[_0x9ef5('0x25')]=_0x55223c[_0x9ef5('0x5f')]({'plain':!![]});return db[_0x9ef5('0x60')][_0x9ef5('0x54')]({'where':{'id':_0x55223c[_0x9ef5('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x10fa94,null))[_0x9ef5('0x1d')](function(_0x5180ef){if(_0x5180ef){_0x451b8a['interaction']=_0x5180ef['get']({'plain':!![]});interaction_log['info'](_0x9ef5('0x7c'),_0x973262['user']['id'],_0x973262[_0x9ef5('0x5d')][_0x9ef5('0x38')],_0x973262[_0x9ef5('0x5d')][_0x9ef5('0x66')],_0x451b8a['interaction']['id'],_0x973262[_0x9ef5('0x55')]?JSON[_0x9ef5('0x22')](_0x973262[_0x9ef5('0x55')]):_0x9ef5('0x67'));return respondWithRpcPromise('RejectMessage',_0x9ef5('0x7d'),_0x451b8a);}return null;})[_0x9ef5('0x1d')](function(_0x504516){var _0x29f179=_0x9ef5('0x6a')+_0x504516[_0x9ef5('0x25')][_0x9ef5('0x6b')];return db[_0x9ef5('0x7e')]['query'](_0x29f179,{'type':db['Sequelize']['QueryTypes'][_0x9ef5('0x6e')],'raw':!![]})[_0x9ef5('0x1d')](function(_0xc83dbb){return _0xc83dbb;});})['then'](function(_0x2104c9){if(_0x2104c9){_0x451b8a[_0x9ef5('0x25')][_0x9ef5('0x6f')]=_0x2104c9[0x0];if(!_0x973262[_0x9ef5('0x55')][_0x9ef5('0x5c')])return;return db[_0x9ef5('0x70')][_0x9ef5('0x54')]({'where':{'id':_0x973262[_0x9ef5('0x55')][_0x9ef5('0x5c')],'role':'agent'},'attributes':['id',_0x9ef5('0x38'),_0x9ef5('0x7f'),_0x9ef5('0x71'),_0x9ef5('0x72')],'raw':!![]});}return null;})[_0x9ef5('0x1d')](function(_0x202270){if(!_0x202270)return null;_0x451b8a[_0x9ef5('0x25')][_0x9ef5('0x5e')]=_0x202270;return _0x451b8a;})['then'](function(_0x283211){if(_0x283211){_0x283211['message'][_0x9ef5('0x74')]=util[_0x9ef5('0x5b')](_0x9ef5('0x75'),_0x973262['user'][_0x9ef5('0x38')]);_0x283211['message'][_0x9ef5('0x76')]=_0x451b8a[_0x9ef5('0x76')];_0x283211[_0x9ef5('0x25')][_0x9ef5('0x77')]=_0x451b8a[_0x9ef5('0x76')];_0x283211['message']['event']=_0x9ef5('0x33');respondWithRpcPromise(_0x9ef5('0x78'),'EventManager',{'event':'rejectmessage','message':_0x283211['message']},client9002);return _0x451b8a;}return null;})[_0x9ef5('0x1d')](respondWithResult(_0x10fa94,null))[_0x9ef5('0x28')](handleError(_0x10fa94,null));};exports[_0x9ef5('0x80')]=function(_0x3d9e6d,_0x1ff6a0){var _0x581447;return db[_0x9ef5('0x3b')][_0x9ef5('0x80')](_0x3d9e6d[_0x9ef5('0x55')],{})[_0x9ef5('0x1d')](function(_0x12d91c){_0x581447=_0x12d91c;return db[_0x9ef5('0x81')]['findOne']({'where':{'id':_0x581447[_0x9ef5('0x6b')]}});})[_0x9ef5('0x1d')](function(_0x2624b9){if(_[_0x9ef5('0x82')](_0x2624b9)){return;}else{_0x581447[_0x9ef5('0x7b')]=_0x2624b9['fax'];return db[_0x9ef5('0x83')][_0x9ef5('0x84')]({'where':{'id':_0x581447['AttachmentId']}});}})['then'](function(_0x1d8194){return respondWithRpcPromise(_0x9ef5('0x85'),'SendFax',{'FaxAccountId':_[_0x9ef5('0x82')](_0x3d9e6d['body'])?undefined:_0x3d9e6d['body'][_0x9ef5('0x86')],'path':_[_0x9ef5('0x82')](_0x1d8194)?undefined:util[_0x9ef5('0x5b')](_0x9ef5('0x87'),_0x1d8194['basename']),'fax':_['isNil'](_0x581447[_0x9ef5('0x7b')])?undefined:_0x581447[_0x9ef5('0x7b')],'AttachmentId':_0x581447['AttachmentId']},client9002);})[_0x9ef5('0x1d')](respondWithResult(_0x1ff6a0,0xc9))['catch'](handleError(_0x1ff6a0,null));};exports['download']=function(_0x1f82c1,_0x223cdf){var _0x27194f=path[_0x9ef5('0x88')](config[_0x9ef5('0x89')],'server',_0x9ef5('0x8a'),_0x9ef5('0x8b'));return db['FaxMessage'][_0x9ef5('0x54')]({'where':{'id':_0x1f82c1['params']['id']},'include':[{'model':db[_0x9ef5('0x83')],'as':'Attachment'}]})[_0x9ef5('0x1d')](handleEntityNotFound(_0x223cdf,null))[_0x9ef5('0x1d')](function(_0x5a9e5f){if(_0x5a9e5f){return _0x223cdf[_0x9ef5('0x8c')](path[_0x9ef5('0x88')](_0x27194f,_0x5a9e5f[_0x9ef5('0x83')]['basename']));}})[_0x9ef5('0x28')](handleError(_0x223cdf,null));}; \ No newline at end of file +var _0xd21f=['request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','undefined','count','set','reject','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','body','find','describe','../../config/logger','fax-interactions','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','attachments','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./faxMessage.socket','jayson/promise','client','http'];(function(_0x402c9f,_0x1a88c8){var _0x1ec3da=function(_0x29e8ae){while(--_0x29e8ae){_0x402c9f['push'](_0x402c9f['shift']());}};_0x1ec3da(++_0x1a88c8);}(_0xd21f,0x189));var _0xfd21=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0xd21f[_0x17823f];return _0x51fc21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd21('0x0'));var zipdir=require(_0xfd21('0x1'));var jsonpatch=require(_0xfd21('0x2'));var rp=require('request-promise');var moment=require(_0xfd21('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfd21('0x4'));var path=require(_0xfd21('0x5'));var sox=require(_0xfd21('0x6'));var csv=require(_0xfd21('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd21('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd21('0x9'));var jsforce=require(_0xfd21('0xa'));var deskjs=require(_0xfd21('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd21('0xc'));var Redis=require(_0xfd21('0xd'));var authService=require(_0xfd21('0xe'));var qs=require(_0xfd21('0xf'));var as=require(_0xfd21('0x10'));var hardwareService=require(_0xfd21('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xfd21('0x12'));var config=require(_0xfd21('0x13'));var licenseUtil=require(_0xfd21('0x14'));var db=require('../../mysqldb')['db'];config[_0xfd21('0x15')]=_[_0xfd21('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd21('0x15')]));require(_0xfd21('0x17'))['register'](socket);var jayson=require(_0xfd21('0x18'));var client=jayson[_0xfd21('0x19')][_0xfd21('0x1a')]({'port':0x232c});var client9002=jayson[_0xfd21('0x19')][_0xfd21('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5d3819,_0x28d28d,_0x35f7c8,_0x39e38c){return new BPromise(function(_0x3cfc0d,_0x4c0547){var _0x110588=_0x39e38c||client;return _0x110588[_0xfd21('0x1b')](_0x5d3819,_0x35f7c8)[_0xfd21('0x1c')](function(_0x30c200){logger[_0xfd21('0x1d')]('FaxMessage,\x20%s,\x20%s',_0x28d28d,_0xfd21('0x1e'));logger[_0xfd21('0x1f')](_0xfd21('0x20'),_0x28d28d,'request\x20sent',JSON[_0xfd21('0x21')](_0x30c200));if(_0x30c200[_0xfd21('0x22')]){if(_0x30c200['error'][_0xfd21('0x23')]===0x1f4){logger[_0xfd21('0x22')]('FaxMessage,\x20%s,\x20%s',_0x28d28d,_0x30c200[_0xfd21('0x22')][_0xfd21('0x24')]);return _0x4c0547(_0x30c200[_0xfd21('0x22')]['message']);}logger['error'](_0xfd21('0x25'),_0x28d28d,_0x30c200['error'][_0xfd21('0x24')]);return _0x3cfc0d(_0x30c200[_0xfd21('0x22')][_0xfd21('0x24')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x28d28d,_0xfd21('0x1e'));_0x3cfc0d(_0x30c200[_0xfd21('0x26')][_0xfd21('0x24')]);}})[_0xfd21('0x27')](function(_0x58ee69){logger[_0xfd21('0x22')](_0xfd21('0x25'),_0x28d28d,_0x58ee69);_0x4c0547(_0x58ee69);});});}function respondWithStatusCode(_0x5d40a3,_0x485559){_0x485559=_0x485559||0xcc;return function(_0x30259b){if(_0x30259b){return _0x5d40a3['sendStatus'](_0x485559);}return _0x5d40a3[_0xfd21('0x28')](_0x485559)[_0xfd21('0x29')]();};}function respondWithResult(_0x2d9ac6,_0x19d05d){_0x19d05d=_0x19d05d||0xc8;return function(_0x531ef6){if(_0x531ef6){return _0x2d9ac6[_0xfd21('0x28')](_0x19d05d)[_0xfd21('0x2a')](_0x531ef6);}};}function respondWithFilteredResult(_0xfe9e17,_0x5e39a2){return function(_0xd8ef28){if(_0xd8ef28){var _0x59f79e=typeof _0x5e39a2[_0xfd21('0x2b')]==='undefined'&&typeof _0x5e39a2[_0xfd21('0x2c')]===_0xfd21('0x2d');var _0x5ccf33=_0xd8ef28['count'];var _0xd61d6=_0x59f79e?0x0:_0x5e39a2['offset'];var _0x492ad6=_0x59f79e?_0xd8ef28[_0xfd21('0x2e')]:_0x5e39a2['offset']+_0x5e39a2[_0xfd21('0x2c')];var _0x5eb308;if(_0x492ad6>=_0x5ccf33){_0x492ad6=_0x5ccf33;_0x5eb308=0xc8;}else{_0x5eb308=0xce;}_0xfe9e17['status'](_0x5eb308);return _0xfe9e17[_0xfd21('0x2f')]('Content-Range',_0xd61d6+'-'+_0x492ad6+'/'+_0x5ccf33)['json'](_0xd8ef28);}return null;};}function patchUpdates(_0x16b015){return function(_0x3408c0){try{jsonpatch['apply'](_0x3408c0,_0x16b015,!![]);}catch(_0x40f2e4){return BPromise[_0xfd21('0x30')](_0x40f2e4);}return _0x3408c0['save']();};}function saveUpdates(_0x3cfcb7,_0x5edc79){return function(_0x3d5509){if(_0x3d5509){return _0x3d5509[_0xfd21('0x31')](_0x3cfcb7)[_0xfd21('0x1c')](function(_0x2c4ccb){return _0x2c4ccb;});}return null;};}function removeEntity(_0x3f3ecb,_0x5d8b56){return function(_0x2e0b69){if(_0x2e0b69){return _0x2e0b69[_0xfd21('0x32')]()[_0xfd21('0x1c')](function(){_0x3f3ecb[_0xfd21('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30941b,_0x145f72){return function(_0x2855b3){if(!_0x2855b3){_0x30941b[_0xfd21('0x33')](0x194);}return _0x2855b3;};}function handleError(_0x19df73,_0x49b45d){_0x49b45d=_0x49b45d||0x1f4;return function(_0x239c53){logger[_0xfd21('0x22')](_0x239c53[_0xfd21('0x34')]);if(_0x239c53[_0xfd21('0x35')]){delete _0x239c53['name'];}_0x19df73['status'](_0x49b45d)[_0xfd21('0x36')](_0x239c53);};}exports[_0xfd21('0x37')]=function(_0x357469,_0x3e105e){var _0xce1421={},_0x4cabc4={},_0x2376b4={'count':0x0,'rows':[]};var _0x1ec803=_[_0xfd21('0x38')](db[_0xfd21('0x39')][_0xfd21('0x3a')],function(_0x232f79){return{'name':_0x232f79[_0xfd21('0x3b')],'type':_0x232f79['type'][_0xfd21('0x3c')]};});_0x4cabc4[_0xfd21('0x3d')]=_[_0xfd21('0x38')](_0x1ec803,'name');_0x4cabc4['query']=_[_0xfd21('0x3e')](_0x357469[_0xfd21('0x3f')]);_0x4cabc4[_0xfd21('0x40')]=_[_0xfd21('0x41')](_0x4cabc4[_0xfd21('0x3d')],_0x4cabc4[_0xfd21('0x3f')]);_0xce1421[_0xfd21('0x42')]=_[_0xfd21('0x41')](_0x4cabc4[_0xfd21('0x3d')],qs[_0xfd21('0x43')](_0x357469['query'][_0xfd21('0x43')]));_0xce1421[_0xfd21('0x42')]=_0xce1421[_0xfd21('0x42')][_0xfd21('0x44')]?_0xce1421['attributes']:_0x4cabc4[_0xfd21('0x3d')];if(!_0x357469['query'][_0xfd21('0x45')](_0xfd21('0x46'))){_0xce1421[_0xfd21('0x2c')]=qs[_0xfd21('0x2c')](_0x357469[_0xfd21('0x3f')]['limit']);_0xce1421[_0xfd21('0x2b')]=qs[_0xfd21('0x2b')](_0x357469[_0xfd21('0x3f')][_0xfd21('0x2b')]);}_0xce1421[_0xfd21('0x47')]=qs[_0xfd21('0x48')](_0x357469['query'][_0xfd21('0x48')]);_0xce1421[_0xfd21('0x49')]=qs['filters'](_[_0xfd21('0x4a')](_0x357469[_0xfd21('0x3f')],_0x4cabc4[_0xfd21('0x40')]),_0x1ec803);if(_0x357469['query'][_0xfd21('0x4b')]){_0xce1421[_0xfd21('0x49')]=_[_0xfd21('0x4c')](_0xce1421['where'],{'$or':_[_0xfd21('0x38')](_0x1ec803,function(_0x119496){if(_0x119496[_0xfd21('0x4d')]!=='VIRTUAL'){var _0x4f6d80={};_0x4f6d80[_0x119496[_0xfd21('0x35')]]={'$like':'%'+_0x357469[_0xfd21('0x3f')][_0xfd21('0x4b')]+'%'};return _0x4f6d80;}})});}_0xce1421=_[_0xfd21('0x4c')]({},_0xce1421,_0x357469[_0xfd21('0x4e')]);var _0x3c61ed={'where':_0xce1421[_0xfd21('0x49')]};return db[_0xfd21('0x39')][_0xfd21('0x2e')](_0x3c61ed)[_0xfd21('0x1c')](function(_0x5b34f6){_0x2376b4[_0xfd21('0x2e')]=_0x5b34f6;if(_0x357469[_0xfd21('0x3f')][_0xfd21('0x4f')]){_0xce1421[_0xfd21('0x50')]=[{'all':!![]}];}return db[_0xfd21('0x39')][_0xfd21('0x51')](_0xce1421);})[_0xfd21('0x1c')](function(_0x5ea5be){_0x2376b4[_0xfd21('0x52')]=_0x5ea5be;return _0x2376b4;})[_0xfd21('0x1c')](respondWithFilteredResult(_0x3e105e,_0xce1421))[_0xfd21('0x27')](handleError(_0x3e105e,null));};exports['show']=function(_0xd68e6a,_0x361d26){var _0x1a03a1={'raw':!![],'where':{'id':_0xd68e6a[_0xfd21('0x53')]['id']}},_0x597e5b={};_0x597e5b['model']=_[_0xfd21('0x3e')](db['FaxMessage'][_0xfd21('0x3a')]);_0x597e5b[_0xfd21('0x3f')]=_[_0xfd21('0x3e')](_0xd68e6a['query']);_0x597e5b['filters']=_[_0xfd21('0x41')](_0x597e5b[_0xfd21('0x3d')],_0x597e5b[_0xfd21('0x3f')]);_0x1a03a1['attributes']=_[_0xfd21('0x41')](_0x597e5b[_0xfd21('0x3d')],qs[_0xfd21('0x43')](_0xd68e6a['query'][_0xfd21('0x43')]));_0x1a03a1[_0xfd21('0x42')]=_0x1a03a1[_0xfd21('0x42')][_0xfd21('0x44')]?_0x1a03a1[_0xfd21('0x42')]:_0x597e5b[_0xfd21('0x3d')];if(_0xd68e6a[_0xfd21('0x3f')][_0xfd21('0x4f')]){_0x1a03a1['include']=[{'all':!![]}];}_0x1a03a1=_['merge']({},_0x1a03a1,_0xd68e6a[_0xfd21('0x4e')]);return db['FaxMessage']['find'](_0x1a03a1)['then'](handleEntityNotFound(_0x361d26,null))[_0xfd21('0x1c')](respondWithResult(_0x361d26,null))[_0xfd21('0x27')](handleError(_0x361d26,null));};exports[_0xfd21('0x31')]=function(_0xe79c4c,_0x1161f7){if(_0xe79c4c[_0xfd21('0x54')]['id']){delete _0xe79c4c['body']['id'];}return db[_0xfd21('0x39')][_0xfd21('0x55')]({'where':{'id':_0xe79c4c[_0xfd21('0x53')]['id']}})[_0xfd21('0x1c')](handleEntityNotFound(_0x1161f7,null))['then'](saveUpdates(_0xe79c4c[_0xfd21('0x54')],null))[_0xfd21('0x1c')](respondWithResult(_0x1161f7,null))['catch'](handleError(_0x1161f7,null));};exports[_0xfd21('0x32')]=function(_0x3003e8,_0x3b1266){return db[_0xfd21('0x39')]['find']({'where':{'id':_0x3003e8['params']['id']}})[_0xfd21('0x1c')](handleEntityNotFound(_0x3b1266,null))[_0xfd21('0x1c')](removeEntity(_0x3b1266,null))[_0xfd21('0x27')](handleError(_0x3b1266,null));};exports[_0xfd21('0x56')]=function(_0x542f1d,_0x45a7f3){return db[_0xfd21('0x39')][_0xfd21('0x56')]()[_0xfd21('0x1c')](respondWithResult(_0x45a7f3,null))['catch'](handleError(_0x45a7f3,null));};var interaction_log=require(_0xfd21('0x57'))(_0xfd21('0x58'));exports['accept']=function(_0x19aaca,_0x354b9b,_0xa9963a){var _0x5357a8={'agent':{},'channel':_0xfd21('0x59')};if(_0x19aaca[_0xfd21('0x54')]['id']){delete _0x19aaca[_0xfd21('0x54')]['id'];}_0x19aaca[_0xfd21('0x54')][_0xfd21('0x5a')]=!![];_0x19aaca[_0xfd21('0x54')]['readAt']=moment()[_0xfd21('0x5b')](_0xfd21('0x5c'));_0x19aaca[_0xfd21('0x54')]['UserId']=_0x19aaca[_0xfd21('0x54')][_0xfd21('0x5d')]||_0x19aaca[_0xfd21('0x5e')]['id'];_0x5357a8[_0xfd21('0x5f')]['id']=_0x19aaca[_0xfd21('0x54')][_0xfd21('0x5d')];return db['FaxMessage'][_0xfd21('0x55')]({'where':{'id':_0x19aaca[_0xfd21('0x53')]['id'],'UserId':null}})[_0xfd21('0x1c')](handleEntityNotFound(_0x354b9b,null))[_0xfd21('0x1c')](saveUpdates(_0x19aaca['body'],null))['then'](function(_0x3047d6){if(_0x3047d6){_0x5357a8[_0xfd21('0x24')]=_0x3047d6['get']({'plain':!![]});return db[_0xfd21('0x60')]['find']({'where':{'id':_0x3047d6[_0xfd21('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x354b9b,null))[_0xfd21('0x1c')](function(_0x4697ee){if(_0x4697ee){return _0x4697ee[_0xfd21('0x31')]({'UserId':_0x19aaca[_0xfd21('0x54')][_0xfd21('0x5d')],'read1stAt':_['isNil'](_0x4697ee['read1stAt'])?moment()['format'](_0xfd21('0x5c')):undefined});}return null;})[_0xfd21('0x1c')](function(_0xa16a5b){if(_0xa16a5b){_0x5357a8[_0xfd21('0x62')]=_0xa16a5b[_0xfd21('0x63')]({'plain':!![]});interaction_log['info'](_0xfd21('0x64'),_0x19aaca[_0xfd21('0x5e')]['id'],_0x19aaca[_0xfd21('0x5e')]['name'],_0x19aaca[_0xfd21('0x5e')][_0xfd21('0x65')],_0x5357a8['interaction']['id'],_0x19aaca[_0xfd21('0x54')]?JSON[_0xfd21('0x21')](_0x19aaca[_0xfd21('0x54')]):_0xfd21('0x66'));return respondWithRpcPromise('AcceptMessage',_0xfd21('0x67'),_0x5357a8);}return null;})[_0xfd21('0x1c')](function(_0x5eb86f){var _0x381335=_0xfd21('0x68')+_0x5eb86f[_0xfd21('0x24')]['ContactId'];return db[_0xfd21('0x69')][_0xfd21('0x3f')](_0x381335,{'type':db[_0xfd21('0x6a')][_0xfd21('0x6b')][_0xfd21('0x6c')],'raw':!![]})[_0xfd21('0x1c')](function(_0x864c2a){return _0x864c2a;});})[_0xfd21('0x1c')](function(_0x2bad21){if(_0x2bad21){_0x5357a8['message'][_0xfd21('0x6d')]=_0x2bad21[0x0];if(!_0x19aaca[_0xfd21('0x54')]['UserId'])return;return db[_0xfd21('0x6e')]['find']({'where':{'id':_0x19aaca[_0xfd21('0x54')][_0xfd21('0x5d')],'role':_0xfd21('0x5f')},'attributes':['id','name',_0xfd21('0x6f'),_0xfd21('0x70'),_0xfd21('0x71')],'raw':!![]});}return null;})['then'](function(_0xd0cfaa){if(!_0xd0cfaa)return null;_0x5357a8[_0xfd21('0x24')][_0xfd21('0x5f')]=_0xd0cfaa;return _0x5357a8;})[_0xfd21('0x1c')](function(_0xc84204){if(_0xc84204){if(_0x19aaca['body'][_0xfd21('0x72')]){_0x5357a8[_0xfd21('0x24')][_0xfd21('0x73')]=util[_0xfd21('0x5b')](_0xfd21('0x74'),_0x19aaca['user'][_0xfd21('0x35')]);_0x5357a8[_0xfd21('0x24')][_0xfd21('0x75')]=_0x5357a8[_0xfd21('0x75')];_0x5357a8[_0xfd21('0x24')][_0xfd21('0x76')]=_0x5357a8[_0xfd21('0x75')];_0x5357a8[_0xfd21('0x24')][_0xfd21('0x77')]=_0xfd21('0x78');return respondWithRpcPromise(_0xfd21('0x79'),_0xfd21('0x79'),{'event':'acceptmessage','message':_0x5357a8[_0xfd21('0x24')]},client9002)[_0xfd21('0x1c')](function(){return _0x5357a8;});}return _0x5357a8;}return null;})['then'](respondWithResult(_0x354b9b,null))[_0xfd21('0x27')](handleError(_0x354b9b,null));};var interaction_log=require(_0xfd21('0x57'))(_0xfd21('0x58'));exports['reject']=function(_0x48a07c,_0x30450d,_0x49e631){var _0x4f62d6={'agent':{},'channel':_0xfd21('0x59')};if(_0x48a07c['body']['id']){delete _0x48a07c[_0xfd21('0x54')]['id'];}_0x48a07c[_0xfd21('0x54')][_0xfd21('0x5d')]=_0x48a07c[_0xfd21('0x54')][_0xfd21('0x5d')]||_0x48a07c[_0xfd21('0x5e')]['id'];_0x4f62d6[_0xfd21('0x5f')]['id']=_0x48a07c['body'][_0xfd21('0x5d')];return db[_0xfd21('0x39')][_0xfd21('0x55')]({'where':{'id':_0x48a07c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30450d,null))[_0xfd21('0x1c')](function(_0x4ef3b3){if(_0x4ef3b3){_0x4f62d6['message']=_0x4ef3b3[_0xfd21('0x63')]({'plain':!![]});return db['FaxInteraction'][_0xfd21('0x55')]({'where':{'id':_0x4ef3b3[_0xfd21('0x61')]}});}return null;})[_0xfd21('0x1c')](handleEntityNotFound(_0x30450d,null))[_0xfd21('0x1c')](function(_0x24173e){if(_0x24173e){_0x4f62d6[_0xfd21('0x62')]=_0x24173e[_0xfd21('0x63')]({'plain':!![]});interaction_log['info'](_0xfd21('0x7a'),_0x48a07c[_0xfd21('0x5e')]['id'],_0x48a07c[_0xfd21('0x5e')][_0xfd21('0x35')],_0x48a07c[_0xfd21('0x5e')][_0xfd21('0x65')],_0x4f62d6['interaction']['id'],_0x48a07c[_0xfd21('0x54')]?JSON[_0xfd21('0x21')](_0x48a07c['body']):_0xfd21('0x66'));return respondWithRpcPromise(_0xfd21('0x7b'),_0xfd21('0x7c'),_0x4f62d6);}return null;})[_0xfd21('0x1c')](function(_0x1abe99){var _0x1e9515=_0xfd21('0x68')+_0x1abe99[_0xfd21('0x24')][_0xfd21('0x7d')];return db[_0xfd21('0x69')][_0xfd21('0x3f')](_0x1e9515,{'type':db[_0xfd21('0x6a')]['QueryTypes'][_0xfd21('0x6c')],'raw':!![]})[_0xfd21('0x1c')](function(_0x573ccd){return _0x573ccd;});})['then'](function(_0x39e24c){if(_0x39e24c){_0x4f62d6['message'][_0xfd21('0x6d')]=_0x39e24c[0x0];if(!_0x48a07c[_0xfd21('0x54')][_0xfd21('0x5d')])return;return db[_0xfd21('0x6e')][_0xfd21('0x55')]({'where':{'id':_0x48a07c[_0xfd21('0x54')]['UserId'],'role':_0xfd21('0x5f')},'attributes':['id',_0xfd21('0x35'),_0xfd21('0x6f'),'email',_0xfd21('0x71')],'raw':!![]});}return null;})[_0xfd21('0x1c')](function(_0x5a7119){if(!_0x5a7119)return null;_0x4f62d6[_0xfd21('0x24')][_0xfd21('0x5f')]=_0x5a7119;return _0x4f62d6;})['then'](function(_0x5403a7){if(_0x5403a7){_0x5403a7[_0xfd21('0x24')][_0xfd21('0x73')]=util[_0xfd21('0x5b')](_0xfd21('0x74'),_0x48a07c['user']['name']);_0x5403a7[_0xfd21('0x24')][_0xfd21('0x75')]=_0x4f62d6[_0xfd21('0x75')];_0x5403a7[_0xfd21('0x24')]['motionChannel']=_0x4f62d6[_0xfd21('0x75')];_0x5403a7[_0xfd21('0x24')]['event']='reject';respondWithRpcPromise('EventManager',_0xfd21('0x79'),{'event':'rejectmessage','message':_0x5403a7[_0xfd21('0x24')]},client9002);return _0x4f62d6;}return null;})[_0xfd21('0x1c')](respondWithResult(_0x30450d,null))['catch'](handleError(_0x30450d,null));};exports[_0xfd21('0x7e')]=function(_0x1d15ed,_0x31f7d6){var _0x52273c;return db['FaxMessage'][_0xfd21('0x7e')](_0x1d15ed['body'],{})['then'](function(_0x2f353e){_0x52273c=_0x2f353e;return db[_0xfd21('0x7f')][_0xfd21('0x80')]({'where':{'id':_0x52273c['ContactId']}});})[_0xfd21('0x1c')](function(_0x30ed4b){if(_[_0xfd21('0x81')](_0x30ed4b)){return;}else{_0x52273c['fax']=_0x30ed4b[_0xfd21('0x59')];return db[_0xfd21('0x82')][_0xfd21('0x80')]({'where':{'id':_0x52273c[_0xfd21('0x83')]}});}})['then'](function(_0x2e404e){return respondWithRpcPromise('SendFax',_0xfd21('0x84'),{'FaxAccountId':_['isNil'](_0x1d15ed[_0xfd21('0x54')])?undefined:_0x1d15ed[_0xfd21('0x54')][_0xfd21('0x85')],'path':_[_0xfd21('0x81')](_0x2e404e)?undefined:util['format'](_0xfd21('0x86'),_0x2e404e[_0xfd21('0x87')]),'fax':_['isNil'](_0x52273c[_0xfd21('0x59')])?undefined:_0x52273c[_0xfd21('0x59')],'AttachmentId':_0x52273c[_0xfd21('0x83')]},client9002);})[_0xfd21('0x1c')](respondWithResult(_0x31f7d6,0xc9))[_0xfd21('0x27')](handleError(_0x31f7d6,null));};exports[_0xfd21('0x88')]=function(_0x12ae60,_0x282fc0){var _0x1f2ecd=path[_0xfd21('0x89')](config[_0xfd21('0x8a')],'server','files',_0xfd21('0x8b'));return db[_0xfd21('0x39')][_0xfd21('0x55')]({'where':{'id':_0x12ae60['params']['id']},'include':[{'model':db[_0xfd21('0x82')],'as':_0xfd21('0x82')}]})[_0xfd21('0x1c')](handleEntityNotFound(_0x282fc0,null))[_0xfd21('0x1c')](function(_0x8d3993){if(_0x8d3993){return _0x282fc0[_0xfd21('0x88')](path[_0xfd21('0x89')](_0x1f2ecd,_0x8d3993[_0xfd21('0x82')][_0xfd21('0x87')]));}})[_0xfd21('0x27')](handleError(_0x282fc0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2f510a9..3078681 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 _0x5ae0=['emit','hasOwnProperty','exports','../../mysqldb','FaxMessage','save','update'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x5ae0,0xf8));var _0x05ae=function(_0x4d4fa5,_0x200d33){_0x4d4fa5=_0x4d4fa5-0x0;var _0x4f2999=_0x5ae0[_0x4d4fa5];return _0x4f2999;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x05ae('0x0'))['db'][_0x05ae('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05ae('0x2'),'afterUpdate':_0x05ae('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd7e47f){return function(_0xaae02b,_0x4aac85,_0x554b43){FaxMessageEvents[_0x05ae('0x4')](_0xd7e47f+':'+_0xaae02b['id'],_0xaae02b);FaxMessageEvents[_0x05ae('0x4')](_0xd7e47f,_0xaae02b);_0x554b43(null);};}for(var e in events){if(events[_0x05ae('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x05ae('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x9ade=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3ad4cc,_0x32815a){var _0x450e4a=function(_0x4c3e24){while(--_0x4c3e24){_0x3ad4cc['push'](_0x3ad4cc['shift']());}};_0x450e4a(++_0x32815a);}(_0x9ade,0x8e));var _0xe9ad=function(_0x518189,_0x280941){_0x518189=_0x518189-0x0;var _0x14f749=_0x9ade[_0x518189];return _0x14f749;};'use strict';var EventEmitter=require(_0xe9ad('0x0'));var FaxMessage=require(_0xe9ad('0x1'))['db'][_0xe9ad('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe9ad('0x3')](0x0);var events={'afterCreate':_0xe9ad('0x4'),'afterUpdate':_0xe9ad('0x5'),'afterDestroy':_0xe9ad('0x6')};function emitEvent(_0x157ca1){return function(_0x468a5b,_0x441278,_0x5ed31d){FaxMessageEvents[_0xe9ad('0x7')](_0x157ca1+':'+_0x468a5b['id'],_0x468a5b);FaxMessageEvents['emit'](_0x157ca1,_0x468a5b);_0x5ed31d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xe9ad('0x8')](e,emitEvent(event));}}module[_0xe9ad('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 48ba865..8f65a6e 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 _0x89ba=['secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x89ba,0x10c));var _0xa89b=function(_0x37d798,_0x483c95){_0x37d798=_0x37d798-0x0;var _0x402b46=_0x89ba[_0x37d798];return _0x402b46;};'use strict';var _=require(_0xa89b('0x0'));var util=require(_0xa89b('0x1'));var logger=require(_0xa89b('0x2'))(_0xa89b('0x3'));var moment=require(_0xa89b('0x4'));var BPromise=require(_0xa89b('0x5'));var rp=require(_0xa89b('0x6'));var fs=require('fs');var path=require(_0xa89b('0x7'));var rimraf=require(_0xa89b('0x8'));var config=require('../../config/environment');var attributes=require(_0xa89b('0x9'));module[_0xa89b('0xa')]=function(_0xb910b8,_0x1b5116){return _0xb910b8[_0xa89b('0xb')](_0xa89b('0xc'),attributes,{'tableName':_0xa89b('0xd'),'paranoid':![],'indexes':[{'name':_0xa89b('0xe'),'fields':[_0xa89b('0xf')],'type':_0xa89b('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12e6bc,_0x32cf25,_0x3b3292){var _0x5a33ae=_0xb910b8[_0xa89b('0x11')];var _0x3315cd=_0x12e6bc['get']({'plain':!![]});if(_0x3315cd[_0xa89b('0x12')][_0xa89b('0x13')]()==='in'||_0x3315cd[_0xa89b('0x12')]['toLowerCase']()==='out'&&!_0x3315cd[_0xa89b('0x14')]&&!_[_0xa89b('0x15')](_0x3315cd[_0xa89b('0x16')])){_0x5a33ae[_0xa89b('0x17')][_0xa89b('0x18')]({'where':{'id':_0x3315cd[_0xa89b('0x19')]}})[_0xa89b('0x1a')](function(_0x11abf7){if(_0x11abf7){_0x11abf7['update']({'lastMsgAt':_0x3315cd[_0xa89b('0x1b')],'lastMsgDirection':_0x3315cd[_0xa89b('0x12')][_0xa89b('0x13')]()});}})[_0xa89b('0x1c')](function(_0x35c717){console[_0xa89b('0x1d')](_0x35c717);});}_0x3b3292();}},'charset':_0xa89b('0x1e'),'collate':_0xa89b('0x1f')});}; \ No newline at end of file +var _0xfd38=['out','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0xfd38,0x12c));var _0x8fd3=function(_0x11c3c9,_0x1709ec){_0x11c3c9=_0x11c3c9-0x0;var _0x4420f5=_0xfd38[_0x11c3c9];return _0x4420f5;};'use strict';var _=require(_0x8fd3('0x0'));var util=require(_0x8fd3('0x1'));var logger=require(_0x8fd3('0x2'))(_0x8fd3('0x3'));var moment=require(_0x8fd3('0x4'));var BPromise=require('bluebird');var rp=require(_0x8fd3('0x5'));var fs=require('fs');var path=require(_0x8fd3('0x6'));var rimraf=require(_0x8fd3('0x7'));var config=require(_0x8fd3('0x8'));var attributes=require('./faxMessage.attributes');module[_0x8fd3('0x9')]=function(_0x1c6551,_0x5bcc05){return _0x1c6551[_0x8fd3('0xa')](_0x8fd3('0xb'),attributes,{'tableName':_0x8fd3('0xc'),'paranoid':![],'indexes':[{'name':_0x8fd3('0xd'),'fields':['body'],'type':_0x8fd3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52db4a,_0x366aa9,_0xf551d9){var _0x5d412b=_0x1c6551[_0x8fd3('0xf')];var _0x4d1f32=_0x52db4a[_0x8fd3('0x10')]({'plain':!![]});if(_0x4d1f32[_0x8fd3('0x11')][_0x8fd3('0x12')]()==='in'||_0x4d1f32[_0x8fd3('0x11')]['toLowerCase']()===_0x8fd3('0x13')&&!_0x4d1f32['secret']&&!_['isNil'](_0x4d1f32[_0x8fd3('0x14')])){_0x5d412b[_0x8fd3('0x15')]['findOne']({'where':{'id':_0x4d1f32[_0x8fd3('0x16')]}})[_0x8fd3('0x17')](function(_0x212178){if(_0x212178){_0x212178[_0x8fd3('0x18')]({'lastMsgAt':_0x4d1f32[_0x8fd3('0x19')],'lastMsgDirection':_0x4d1f32[_0x8fd3('0x11')][_0x8fd3('0x12')]()});}})[_0x8fd3('0x1a')](function(_0x2edfcd){console[_0x8fd3('0x1b')](_0x2edfcd);});}_0xf551d9();}},'charset':'utf8mb4','collate':_0x8fd3('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 48c0a6e..74a973a 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 _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x62cfe,_0x894025){var _0x3ecfda=function(_0x3169d0){while(--_0x3169d0){_0x62cfe['push'](_0x62cfe['shift']());}};_0x3ecfda(++_0x894025);}(_0xe14d,0x1ee));var _0xde14=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xe14d[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file +var _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xbd50,0x196));var _0x0bd5=function(_0x13eebb,_0x503483){_0x13eebb=_0x13eebb-0x0;var _0x17ae04=_0xbd50[_0x13eebb];return _0x17ae04;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a41eee1..32790cd 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 _0x62f3=['save','remove','emit','removeListener','length','faxMessage:','./faxMessage.events'];(function(_0x2fcaa3,_0x2ba904){var _0x8f4089=function(_0x581a3b){while(--_0x581a3b){_0x2fcaa3['push'](_0x2fcaa3['shift']());}};_0x8f4089(++_0x2ba904);}(_0x62f3,0x1d4));var _0x362f=function(_0x10b3e2,_0x93dbb){_0x10b3e2=_0x10b3e2-0x0;var _0x1bb90e=_0x62f3[_0x10b3e2];return _0x1bb90e;};'use strict';var FaxMessageEvents=require(_0x362f('0x0'));var events=[_0x362f('0x1'),_0x362f('0x2'),'update'];function createListener(_0x2409c0,_0x6c01d8){return function(_0x47500d){_0x6c01d8[_0x362f('0x3')](_0x2409c0,_0x47500d);};}function removeListener(_0xcb1266,_0x92102f){return function(){FaxMessageEvents[_0x362f('0x4')](_0xcb1266,_0x92102f);};}exports['register']=function(_0x4c3f64){for(var _0x43fcba=0x0,_0x3d6218=events[_0x362f('0x5')];_0x43fcba<_0x3d6218;_0x43fcba++){var _0xe551bc=events[_0x43fcba];var _0x5d2a0c=createListener(_0x362f('0x6')+_0xe551bc,_0x4c3f64);FaxMessageEvents['on'](_0xe551bc,_0x5d2a0c);}}; \ No newline at end of file +var _0xa1b8=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa1b8,0x78));var _0x8a1b=function(_0x266119,_0x2bbbee){_0x266119=_0x266119-0x0;var _0x208cc9=_0xa1b8[_0x266119];return _0x208cc9;};'use strict';var FaxMessageEvents=require(_0x8a1b('0x0'));var events=[_0x8a1b('0x1'),_0x8a1b('0x2'),_0x8a1b('0x3')];function createListener(_0x26fd54,_0x2d45a9){return function(_0x8abba){_0x2d45a9[_0x8a1b('0x4')](_0x26fd54,_0x8abba);};}function removeListener(_0x5b676f,_0x27d64a){return function(){FaxMessageEvents[_0x8a1b('0x5')](_0x5b676f,_0x27d64a);};}exports[_0x8a1b('0x6')]=function(_0x2b325a){for(var _0x424e1c=0x0,_0x5a2a48=events[_0x8a1b('0x7')];_0x424e1c<_0x5a2a48;_0x424e1c++){var _0x47cc55=events[_0x424e1c];var _0x56f236=createListener(_0x8a1b('0x8')+_0x47cc55,_0x2b325a);FaxMessageEvents['on'](_0x47cc55,_0x56f236);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ec93846..64eba6a 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 _0xdb94=['express','fs-extra','../../components/auth/service','./faxMessage.controller','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/download','download','post','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout'];(function(_0x4a0cf2,_0x30dc69){var _0x1164a6=function(_0x3bffa5){while(--_0x3bffa5){_0x4a0cf2['push'](_0x4a0cf2['shift']());}};_0x1164a6(++_0x30dc69);}(_0xdb94,0xab));var _0x4db9=function(_0x4aa7f5,_0x2a747f){_0x4aa7f5=_0x4aa7f5-0x0;var _0xab2c07=_0xdb94[_0x4aa7f5];return _0xab2c07;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),interaction['tracked'](_0x4db9('0x12'),_0x4db9('0x13')),controller['create']);router['put'](_0x4db9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4db9('0x14')](_0x4db9('0x15'),auth['isAuthenticated'](),controller[_0x4db9('0x16')]);router[_0x4db9('0x14')](_0x4db9('0x17'),auth[_0x4db9('0xd')](),controller['reject']);router['delete'](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller['destroy']);module[_0x4db9('0x18')]=router; \ No newline at end of file +var _0x41bb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout'];(function(_0x34752e,_0x30f8be){var _0x4957f4=function(_0x2db70c){while(--_0x2db70c){_0x34752e['push'](_0x34752e['shift']());}};_0x4957f4(++_0x30f8be);}(_0x41bb,0xc5));var _0xb41b=function(_0x20ac65,_0x1793dd){_0x20ac65=_0x20ac65-0x0;var _0x243780=_0x41bb[_0x20ac65];return _0x243780;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),interaction['tracked'](_0xb41b('0xf'),_0xb41b('0x10')),controller[_0xb41b('0x11')]);router[_0xb41b('0x12')](_0xb41b('0xb'),auth['isAuthenticated'](),controller[_0xb41b('0x13')]);router[_0xb41b('0x12')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xb41b('0x16')]);router[_0xb41b('0x17')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('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 8303483..f8d269c 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 _0xb6fa=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x2795b7,_0x9fdf79){var _0x5e393e=function(_0x50c713){while(--_0x50c713){_0x2795b7['push'](_0x2795b7['shift']());}};_0x5e393e(++_0x9fdf79);}(_0xb6fa,0x18c));var _0xab6f=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xb6fa[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require(_0xab6f('0x0'));module['exports']={'name':{'type':Sequelize[_0xab6f('0x1')],'unique':_0xab6f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab6f('0x1')]},'timeout':{'type':Sequelize[_0xab6f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab6f('0x4')](_0xab6f('0x5'),_0xab6f('0x6'),_0xab6f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xab6f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa342=['name','ENUM','INTEGER','exports','STRING'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa342,0x99));var _0x2a34=function(_0x2c2556,_0x270aad){_0x2c2556=_0x2c2556-0x0;var _0x5386b3=_0xa342[_0x2c2556];return _0x5386b3;};'use strict';var Sequelize=require('sequelize');module[_0x2a34('0x0')]={'name':{'type':Sequelize[_0x2a34('0x1')],'unique':_0x2a34('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a34('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a34('0x3')]('rrmemory','beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2a34('0x4')],'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 2ae0c5d..6fa46ab 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 _0x9316=['count','limit','set','Content-Range','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','FaxQueueId','UserId','agent','faxPause','updatedAt','%s/%s','SIP','createdAt','getTeams','findOne','Team','order','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','isArray','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','json','offset','undefined'];(function(_0x392072,_0x57b434){var _0x5914f6=function(_0x290fb){while(--_0x290fb){_0x392072['push'](_0x392072['shift']());}};_0x5914f6(++_0x57b434);}(_0x9316,0x6e));var _0x6931=function(_0x1e218e,_0x1d73f5){_0x1e218e=_0x1e218e-0x0;var _0x30e2a4=_0x9316[_0x1e218e];return _0x30e2a4;};'use strict';var emlformat=require(_0x6931('0x0'));var rimraf=require(_0x6931('0x1'));var zipdir=require(_0x6931('0x2'));var jsonpatch=require(_0x6931('0x3'));var rp=require('request-promise');var moment=require(_0x6931('0x4'));var BPromise=require(_0x6931('0x5'));var Mustache=require(_0x6931('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6931('0x7'));var csv=require('to-csv');var ejs=require(_0x6931('0x8'));var fs=require('fs');var fs_extra=require(_0x6931('0x9'));var _=require(_0x6931('0xa'));var squel=require(_0x6931('0xb'));var crypto=require(_0x6931('0xc'));var jsforce=require(_0x6931('0xd'));var deskjs=require(_0x6931('0xe'));var toCsv=require(_0x6931('0xf'));var querystring=require(_0x6931('0x10'));var Papa=require(_0x6931('0x11'));var Redis=require(_0x6931('0x12'));var authService=require(_0x6931('0x13'));var qs=require(_0x6931('0x14'));var as=require(_0x6931('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6931('0x16'))(_0x6931('0x17'));var utils=require('../../config/utils');var config=require(_0x6931('0x18'));var licenseUtil=require(_0x6931('0x19'));var db=require(_0x6931('0x1a'))['db'];config[_0x6931('0x1b')]=_[_0x6931('0x1c')](config[_0x6931('0x1b')],{'host':_0x6931('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6931('0x1e'))[_0x6931('0x1f')](socket);function respondWithStatusCode(_0x3f6bad,_0x5e2cbc){_0x5e2cbc=_0x5e2cbc||0xcc;return function(_0x4ecf07){if(_0x4ecf07){return _0x3f6bad['sendStatus'](_0x5e2cbc);}return _0x3f6bad[_0x6931('0x20')](_0x5e2cbc)[_0x6931('0x21')]();};}function respondWithResult(_0x50b693,_0x53a616){_0x53a616=_0x53a616||0xc8;return function(_0x5ec2d7){if(_0x5ec2d7){return _0x50b693[_0x6931('0x20')](_0x53a616)[_0x6931('0x22')](_0x5ec2d7);}};}function respondWithFilteredResult(_0x81f8f9,_0x142a05){return function(_0x33443d){if(_0x33443d){var _0x35d129=typeof _0x142a05[_0x6931('0x23')]===_0x6931('0x24')&&typeof _0x142a05['limit']==='undefined';var _0x4f7d78=_0x33443d[_0x6931('0x25')];var _0x4c6bf4=_0x35d129?0x0:_0x142a05[_0x6931('0x23')];var _0x965dc4=_0x35d129?_0x33443d[_0x6931('0x25')]:_0x142a05[_0x6931('0x23')]+_0x142a05[_0x6931('0x26')];var _0x3a0c1c;if(_0x965dc4>=_0x4f7d78){_0x965dc4=_0x4f7d78;_0x3a0c1c=0xc8;}else{_0x3a0c1c=0xce;}_0x81f8f9[_0x6931('0x20')](_0x3a0c1c);return _0x81f8f9[_0x6931('0x27')](_0x6931('0x28'),_0x4c6bf4+'-'+_0x965dc4+'/'+_0x4f7d78)[_0x6931('0x22')](_0x33443d);}return null;};}function patchUpdates(_0x5d63a7){return function(_0x574a12){try{jsonpatch['apply'](_0x574a12,_0x5d63a7,!![]);}catch(_0x8f5938){return BPromise[_0x6931('0x29')](_0x8f5938);}return _0x574a12[_0x6931('0x2a')]();};}function saveUpdates(_0x222a5e,_0x47ac59){return function(_0x946238){if(_0x946238){return _0x946238['update'](_0x222a5e)[_0x6931('0x2b')](function(_0x3591ed){return _0x3591ed;});}return null;};}function removeEntity(_0x14c5e0,_0x308fe3){return function(_0x1e154c){if(_0x1e154c){return _0x1e154c[_0x6931('0x2c')]()[_0x6931('0x2b')](function(){var _0x5bd929=_0x1e154c[_0x6931('0x2d')]({'plain':!![]});var _0x1a096c='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x1a096c,'resourceId':_0x5bd929['id']}})[_0x6931('0x2b')](function(){return _0x1e154c;});})['then'](function(){_0x14c5e0[_0x6931('0x20')](0xcc)[_0x6931('0x21')]();});}};}function handleEntityNotFound(_0x52ff5f,_0x3874fe){return function(_0x21294e){if(!_0x21294e){_0x52ff5f[_0x6931('0x2e')](0x194);}return _0x21294e;};}function handleError(_0x2d7876,_0x5307df){_0x5307df=_0x5307df||0x1f4;return function(_0x1f18b8){logger[_0x6931('0x2f')](_0x1f18b8[_0x6931('0x30')]);if(_0x1f18b8[_0x6931('0x31')]){delete _0x1f18b8['name'];}_0x2d7876[_0x6931('0x20')](_0x5307df)[_0x6931('0x32')](_0x1f18b8);};}exports[_0x6931('0x33')]=function(_0x4d2ed3,_0x367ca1){var _0x5bc418={},_0xda7957={},_0x25320b={'count':0x0,'rows':[]};var _0x2da397=_[_0x6931('0x34')](db[_0x6931('0x35')][_0x6931('0x36')],function(_0x1cf300){return{'name':_0x1cf300[_0x6931('0x37')],'type':_0x1cf300['type'][_0x6931('0x38')]};});_0xda7957[_0x6931('0x39')]=_[_0x6931('0x34')](_0x2da397,_0x6931('0x31'));_0xda7957[_0x6931('0x3a')]=_[_0x6931('0x3b')](_0x4d2ed3[_0x6931('0x3a')]);_0xda7957['filters']=_[_0x6931('0x3c')](_0xda7957[_0x6931('0x39')],_0xda7957[_0x6931('0x3a')]);_0x5bc418['attributes']=_[_0x6931('0x3c')](_0xda7957[_0x6931('0x39')],qs[_0x6931('0x3d')](_0x4d2ed3['query'][_0x6931('0x3d')]));_0x5bc418[_0x6931('0x3e')]=_0x5bc418['attributes']['length']?_0x5bc418[_0x6931('0x3e')]:_0xda7957[_0x6931('0x39')];if(!_0x4d2ed3[_0x6931('0x3a')][_0x6931('0x3f')]('nolimit')){_0x5bc418[_0x6931('0x26')]=qs[_0x6931('0x26')](_0x4d2ed3['query'][_0x6931('0x26')]);_0x5bc418[_0x6931('0x23')]=qs[_0x6931('0x23')](_0x4d2ed3[_0x6931('0x3a')]['offset']);}_0x5bc418['order']=qs[_0x6931('0x40')](_0x4d2ed3['query'][_0x6931('0x40')]);_0x5bc418[_0x6931('0x41')]=qs[_0x6931('0x42')](_[_0x6931('0x43')](_0x4d2ed3[_0x6931('0x3a')],_0xda7957[_0x6931('0x42')]),_0x2da397);if(_0x4d2ed3[_0x6931('0x3a')][_0x6931('0x44')]){_0x5bc418[_0x6931('0x41')]=_['merge'](_0x5bc418[_0x6931('0x41')],{'$or':_[_0x6931('0x34')](_0x2da397,function(_0x40f6b6){if(_0x40f6b6[_0x6931('0x45')]!==_0x6931('0x46')){var _0x5c69ef={};_0x5c69ef[_0x40f6b6[_0x6931('0x31')]]={'$like':'%'+_0x4d2ed3[_0x6931('0x3a')]['filter']+'%'};return _0x5c69ef;}})});}_0x5bc418=_['merge']({},_0x5bc418,_0x4d2ed3[_0x6931('0x47')]);var _0x51df2e={'where':_0x5bc418[_0x6931('0x41')]};return db[_0x6931('0x35')][_0x6931('0x25')](_0x51df2e)['then'](function(_0x596b0e){_0x25320b[_0x6931('0x25')]=_0x596b0e;if(_0x4d2ed3['query'][_0x6931('0x48')]){_0x5bc418[_0x6931('0x49')]=[{'all':!![]}];}return db[_0x6931('0x35')][_0x6931('0x4a')](_0x5bc418);})[_0x6931('0x2b')](function(_0x12bbc2){_0x25320b[_0x6931('0x4b')]=_0x12bbc2;return _0x25320b;})['then'](respondWithFilteredResult(_0x367ca1,_0x5bc418))[_0x6931('0x4c')](handleError(_0x367ca1,null));};exports[_0x6931('0x4d')]=function(_0x4ba3a5,_0x5ace79){var _0x41a308={'raw':!![],'where':{'id':_0x4ba3a5['params']['id']}},_0x2be917={};_0x2be917['model']=_[_0x6931('0x3b')](db[_0x6931('0x35')][_0x6931('0x36')]);_0x2be917['query']=_[_0x6931('0x3b')](_0x4ba3a5['query']);_0x2be917['filters']=_[_0x6931('0x3c')](_0x2be917['model'],_0x2be917['query']);_0x41a308[_0x6931('0x3e')]=_[_0x6931('0x3c')](_0x2be917[_0x6931('0x39')],qs[_0x6931('0x3d')](_0x4ba3a5['query'][_0x6931('0x3d')]));_0x41a308[_0x6931('0x3e')]=_0x41a308[_0x6931('0x3e')][_0x6931('0x4e')]?_0x41a308[_0x6931('0x3e')]:_0x2be917[_0x6931('0x39')];if(_0x4ba3a5[_0x6931('0x3a')][_0x6931('0x48')]){_0x41a308[_0x6931('0x49')]=[{'all':!![]}];}_0x41a308=_[_0x6931('0x4f')]({},_0x41a308,_0x4ba3a5[_0x6931('0x47')]);return db[_0x6931('0x35')]['find'](_0x41a308)[_0x6931('0x2b')](handleEntityNotFound(_0x5ace79,null))[_0x6931('0x2b')](respondWithResult(_0x5ace79,null))['catch'](handleError(_0x5ace79,null));};exports[_0x6931('0x50')]=function(_0x5c7707,_0x5c41ac){return db[_0x6931('0x35')]['create'](_0x5c7707[_0x6931('0x51')],{})['then'](function(_0x25393e){var _0x3bbe7e=_0x5c7707[_0x6931('0x52')][_0x6931('0x2d')]({'plain':!![]});if(!_0x3bbe7e)throw new Error(_0x6931('0x53'));if(_0x3bbe7e[_0x6931('0x54')]===_0x6931('0x52')){var _0x2e4bda=_0x25393e[_0x6931('0x2d')]({'plain':!![]});var _0x3bc631=_0x6931('0x55');return db['UserProfileSection'][_0x6931('0x56')]({'where':{'name':_0x3bc631,'userProfileId':_0x3bbe7e[_0x6931('0x57')]},'raw':!![]})['then'](function(_0x3b0f36){if(_0x3b0f36&&_0x3b0f36[_0x6931('0x58')]===0x0){return db[_0x6931('0x59')][_0x6931('0x50')]({'name':_0x2e4bda[_0x6931('0x31')],'resourceId':_0x2e4bda['id'],'type':_0x3b0f36[_0x6931('0x31')],'sectionId':_0x3b0f36['id']},{})[_0x6931('0x2b')](function(){return _0x25393e;});}else{return _0x25393e;}})[_0x6931('0x4c')](function(_0x597c80){logger[_0x6931('0x2f')](_0x6931('0x5a'),_0x597c80);throw _0x597c80;});}return _0x25393e;})[_0x6931('0x2b')](respondWithResult(_0x5c41ac,0xc9))[_0x6931('0x4c')](handleError(_0x5c41ac,null));};exports[_0x6931('0x5b')]=function(_0x15d753,_0x54062c){if(_0x15d753[_0x6931('0x51')]['id']){delete _0x15d753['body']['id'];}return db[_0x6931('0x35')][_0x6931('0x56')]({'where':{'id':_0x15d753[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](handleEntityNotFound(_0x54062c,null))[_0x6931('0x2b')](saveUpdates(_0x15d753[_0x6931('0x51')],null))[_0x6931('0x2b')](respondWithResult(_0x54062c,null))[_0x6931('0x4c')](handleError(_0x54062c,null));};exports[_0x6931('0x2c')]=function(_0x13b2b8,_0x5245cf){return db[_0x6931('0x35')][_0x6931('0x56')]({'where':{'id':_0x13b2b8[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](handleEntityNotFound(_0x5245cf,null))[_0x6931('0x2b')](removeEntity(_0x5245cf,null))['catch'](handleError(_0x5245cf,null));};exports[_0x6931('0x5d')]=function(_0x911286,_0x5b6dcf){return db['FaxQueue'][_0x6931('0x5d')]()[_0x6931('0x2b')](respondWithResult(_0x5b6dcf,null))['catch'](handleError(_0x5b6dcf,null));};exports['getMembers']=function(_0x510412,_0x5163cf,_0x46d0c8){var _0x41a705={'raw':!![],'where':{}},_0x16204d={},_0x1b178e;return db[_0x6931('0x35')]['findOne']({'where':{'id':_0x510412[_0x6931('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5163cf,null))['then'](function(_0x2b78f2){if(_0x2b78f2){_0x1b178e=_0x2b78f2['get']({'plain':!![]});_0x16204d[_0x6931('0x39')]=_[_0x6931('0x3b')](db['UserFaxQueue'][_0x6931('0x36')]);_0x16204d[_0x6931('0x3a')]=_[_0x6931('0x3b')](_0x510412[_0x6931('0x3a')]);_0x16204d[_0x6931('0x42')]=_[_0x6931('0x3c')](_0x16204d['model'],_0x16204d[_0x6931('0x3a')]);_0x41a705[_0x6931('0x3e')]=_[_0x6931('0x3c')](_0x16204d[_0x6931('0x39')],qs[_0x6931('0x3d')](_0x510412[_0x6931('0x3a')]['fields']));_0x41a705[_0x6931('0x3e')]=_0x41a705[_0x6931('0x3e')]['length']?_0x41a705[_0x6931('0x3e')]:_0x16204d[_0x6931('0x39')];if(!_0x510412[_0x6931('0x3a')][_0x6931('0x3f')]('nolimit')){_0x41a705[_0x6931('0x26')]=qs[_0x6931('0x26')](_0x510412[_0x6931('0x3a')][_0x6931('0x26')]);_0x41a705[_0x6931('0x23')]=qs['offset'](_0x510412[_0x6931('0x3a')][_0x6931('0x23')]);}_0x41a705['order']=qs[_0x6931('0x40')](_0x510412[_0x6931('0x3a')][_0x6931('0x40')]);_0x41a705['where']=qs[_0x6931('0x42')](_[_0x6931('0x43')](_0x510412[_0x6931('0x3a')],_0x16204d['filters']));_0x41a705[_0x6931('0x41')][_0x6931('0x5e')]=_0x2b78f2['id'];if(_0x510412[_0x6931('0x3a')][_0x6931('0x44')]){_0x41a705['where']=_[_0x6931('0x4f')](_0x41a705[_0x6931('0x41')],{'$or':_[_0x6931('0x34')](_0x41a705[_0x6931('0x3e')],function(_0x3c4d04){var _0x56eb71={};_0x56eb71[_0x3c4d04]={'$like':'%'+_0x510412[_0x6931('0x3a')][_0x6931('0x44')]+'%'};return _0x56eb71;})});}_0x41a705=_[_0x6931('0x4f')]({},_0x41a705,_0x510412[_0x6931('0x47')]);return db['UserFaxQueue']['findAll'](_0x41a705);}})['then'](function(_0x22d4e1){if(_0x22d4e1){return db['User']['findAndCountAll']({'where':{'id':_[_0x6931('0x34')](_0x22d4e1,_0x6931('0x5f')),'role':_0x6931('0x60')},'attributes':['id','name',_0x6931('0x61'),_0x6931('0x62'),'createdAt']});}})['then'](function(_0x4375ce){if(_0x4375ce){return{'count':_0x4375ce[_0x6931('0x25')],'rows':_['map'](_0x4375ce['rows'],function(_0x461e5f){return{'membername':_0x461e5f[_0x6931('0x31')],'UserId':_0x461e5f['id'],'queue_name':_0x1b178e[_0x6931('0x31')],'FaxQueueId':_0x1b178e['id'],'interface':util['format'](_0x6931('0x63'),_0x6931('0x64'),_0x461e5f[_0x6931('0x31')]),'penalty':0x0,'paused':_0x461e5f[_0x6931('0x61')],'createdAt':_0x461e5f[_0x6931('0x65')],'updatedAt':_0x461e5f[_0x6931('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5163cf,_0x41a705))[_0x6931('0x4c')](handleError(_0x5163cf,null));};exports[_0x6931('0x66')]=function(_0x1d7ccf,_0x4f5e7e,_0x423139){var _0x11836f={};var _0x3ffa28={};var _0x47dcc5;var _0x17eedb;return db['FaxQueue'][_0x6931('0x67')]({'where':{'id':_0x1d7ccf['params']['id']}})[_0x6931('0x2b')](handleEntityNotFound(_0x4f5e7e,null))[_0x6931('0x2b')](function(_0x523f5c){if(_0x523f5c){_0x47dcc5=_0x523f5c;_0x3ffa28[_0x6931('0x39')]=_[_0x6931('0x3b')](db[_0x6931('0x68')]['rawAttributes']);_0x3ffa28[_0x6931('0x3a')]=_[_0x6931('0x3b')](_0x1d7ccf[_0x6931('0x3a')]);_0x3ffa28[_0x6931('0x42')]=_['intersection'](_0x3ffa28[_0x6931('0x39')],_0x3ffa28[_0x6931('0x3a')]);_0x11836f[_0x6931('0x3e')]=_[_0x6931('0x3c')](_0x3ffa28[_0x6931('0x39')],qs['fields'](_0x1d7ccf['query'][_0x6931('0x3d')]));_0x11836f['attributes']=_0x11836f[_0x6931('0x3e')][_0x6931('0x4e')]?_0x11836f[_0x6931('0x3e')]:_0x3ffa28[_0x6931('0x39')];_0x11836f[_0x6931('0x69')]=qs['sort'](_0x1d7ccf[_0x6931('0x3a')]['sort']);_0x11836f[_0x6931('0x41')]=qs[_0x6931('0x42')](_[_0x6931('0x43')](_0x1d7ccf[_0x6931('0x3a')],_0x3ffa28[_0x6931('0x42')]));if(_0x1d7ccf['query'][_0x6931('0x44')]){_0x11836f['where']=_['merge'](_0x11836f['where'],{'$or':_[_0x6931('0x34')](_0x11836f['attributes'],function(_0x224c2f){var _0xae9e76={};_0xae9e76[_0x224c2f]={'$like':'%'+_0x1d7ccf[_0x6931('0x3a')][_0x6931('0x44')]+'%'};return _0xae9e76;})});}_0x11836f=_[_0x6931('0x4f')]({},_0x11836f,_0x1d7ccf['options']);return _0x47dcc5[_0x6931('0x66')](_0x11836f);}})[_0x6931('0x2b')](function(_0x100a53){if(_0x100a53){_0x17eedb=_0x100a53[_0x6931('0x4e')];if(!_0x1d7ccf[_0x6931('0x3a')][_0x6931('0x3f')]('nolimit')){_0x11836f['limit']=qs['limit'](_0x1d7ccf[_0x6931('0x3a')][_0x6931('0x26')]);_0x11836f['offset']=qs[_0x6931('0x23')](_0x1d7ccf[_0x6931('0x3a')][_0x6931('0x23')]);}return _0x47dcc5[_0x6931('0x66')](_0x11836f);}})[_0x6931('0x2b')](function(_0x48f3f2){if(_0x48f3f2){return _0x48f3f2?{'count':_0x17eedb,'rows':_0x48f3f2}:null;}})[_0x6931('0x2b')](respondWithResult(_0x4f5e7e,null))[_0x6931('0x4c')](handleError(_0x4f5e7e,null));};exports[_0x6931('0x6a')]=function(_0xdb791,_0xdeb1f3,_0x5307ae){var _0x32a36a=_0xdb791['body'][_0x6931('0x6b')];return db['Team']['findAll']({'where':{'id':_0x32a36a},'attributes':['id'],'include':[{'model':db[_0x6931('0x6c')],'as':_0x6931('0x6d'),'attributes':['id','name',_0x6931('0x6e'),_0x6931('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x36f5f6){if(_0x36f5f6){var _0x398b8c=_[_0x6931('0x70')](_0x36f5f6,function(_0x26c13a){var _0x5afbf8=_0x26c13a[_0x6931('0x2d')]({'plain':!![]});return _0x5afbf8[_0x6931('0x6d')];});return db[_0x6931('0x35')][_0x6931('0x56')]({'where':{'id':_0xdb791[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](function(_0x474a61){return db[_0x6931('0x71')]['transaction'](function(_0x3448da){return _0x474a61[_0x6931('0x6a')](_0x32a36a,{'transaction':_0x3448da})[_0x6931('0x2b')](function(){return BPromise[_0x6931('0x72')](_0x398b8c,function(_0x9d06fa){return db['UserFaxQueue'][_0x6931('0x73')]({'where':{'UserId':_0x9d06fa['id'],'FaxQueueId':_0xdb791[_0x6931('0x5c')]['id']},'transaction':_0x3448da});});})[_0x6931('0x2b')](function(){_0x398b8c[_0x6931('0x74')](function(_0x44bb8b){socket[_0x6931('0x75')]('userFaxQueue:save',{'UserId':_0x44bb8b['id'],'FaxQueueId':_0x474a61['id']});});});});});}})[_0x6931('0x2b')](respondWithStatusCode(_0xdeb1f3,null))[_0x6931('0x4c')](handleError(_0xdeb1f3,null));};exports[_0x6931('0x76')]=function(_0x4a4286,_0x1a5cf6,_0x1cee7e){return db[_0x6931('0x68')][_0x6931('0x4a')]({'where':{'id':_0x4a4286[_0x6931('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6931('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6931('0x2b')](handleEntityNotFound(_0x1a5cf6,null))[_0x6931('0x2b')](function(_0x491383){var _0x2e3f8b=_[_0x6931('0x34')](_0x491383,'id');var _0x4bbfa2=[];var _0x31cb08=[];var _0x4970c7=squel['select']();_0x4970c7['field'](_0x6931('0x77'))[_0x6931('0x78')](_0x6931('0x79'),'tq')[_0x6931('0x7a')](_0x6931('0x7b'),'ut',_0x6931('0x7c'))['where'](_0x6931('0x7d'),_0x4a4286[_0x6931('0x5c')]['id']);for(var _0x530cc2=0x0;_0x530cc2<_0x491383[_0x6931('0x4e')];_0x530cc2+=0x1){let _0x297ef9=_0x491383[_0x530cc2];for(var _0x5a1e2d=0x0;_0x5a1e2d<_0x297ef9[_0x6931('0x6d')]['length'];_0x5a1e2d+=0x1){let _0x5301b2=_0x297ef9[_0x6931('0x6d')][_0x5a1e2d];var _0x250aba=_0x4970c7['clone']();_0x250aba[_0x6931('0x41')](_0x6931('0x7e'),_0x5301b2['id']);_0x31cb08[_0x6931('0x7f')](db[_0x6931('0x71')][_0x6931('0x3a')](_0x250aba[_0x6931('0x80')](),{'type':db['sequelize'][_0x6931('0x81')][_0x6931('0x82')]})[_0x6931('0x2b')](function(_0x2c3321){if(_0x2c3321['length']===0x1){return _0x5301b2['id'];}else{var _0x270824=_[_0x6931('0x83')](_['map'](_0x2c3321,_0x6931('0x84')),function(_0x4007b0){return _[_0x6931('0x85')](_0x2e3f8b,_0x4007b0);});if(_0x270824){return _0x5301b2['id'];}}}));}}return BPromise[_0x6931('0x86')](_0x31cb08)[_0x6931('0x2b')](function(_0x95446){_0x4bbfa2=_(_0x4bbfa2)[_0x6931('0x87')](_0x95446)['compact']()[_0x6931('0x88')]();return db[_0x6931('0x35')][_0x6931('0x56')]({'where':{'id':_0x4a4286[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](function(_0xbc3b37){return db[_0x6931('0x71')][_0x6931('0x89')](function(_0x183809){return _0xbc3b37[_0x6931('0x76')](_0x4a4286[_0x6931('0x3a')]['ids'],{'transaction':_0x183809})['then'](function(){if(!_[_0x6931('0x8a')](_0x4bbfa2)){return _0xbc3b37[_0x6931('0x8b')](_0x4bbfa2,{'transaction':_0x183809});}})[_0x6931('0x2b')](function(){_0x4bbfa2[_0x6931('0x74')](function(_0x4a9dea){socket['emit'](_0x6931('0x8c'),{'UserId':_0x4a9dea,'FaxQueueId':_0xbc3b37['id']});});});});});});})[_0x6931('0x2b')](respondWithStatusCode(_0x1a5cf6,null))[_0x6931('0x4c')](handleError(_0x1a5cf6,null));};exports[_0x6931('0x8d')]=function(_0x23b63b,_0x59796b,_0x3ba3dc){return db[_0x6931('0x35')]['find']({'where':{'id':_0x23b63b[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](handleEntityNotFound(_0x59796b,null))['then'](function(_0x36e8eb){if(_0x36e8eb){return _0x36e8eb[_0x6931('0x8d')](_0x23b63b[_0x6931('0x51')]['ids'],_[_0x6931('0x8e')](_0x23b63b[_0x6931('0x51')],[_0x6931('0x6b'),'id'])||{})['spread'](function(_0x1ef8a8){for(var _0x56ec0c=0x0;_0x56ec0c<_0x23b63b[_0x6931('0x51')][_0x6931('0x6b')][_0x6931('0x4e')];_0x56ec0c+=0x1){socket['emit'](_0x6931('0x8f'),{'UserId':Number(_0x23b63b[_0x6931('0x51')][_0x6931('0x6b')][_0x56ec0c]),'FaxQueueId':Number(_0x23b63b[_0x6931('0x5c')]['id'])});}return _0x1ef8a8;});}})[_0x6931('0x2b')](respondWithResult(_0x59796b,null))[_0x6931('0x4c')](handleError(_0x59796b,null));};exports['removeAgents']=function(_0x5d3272,_0x1e90f6,_0x1559b5){return db['FaxQueue'][_0x6931('0x56')]({'where':{'id':_0x5d3272[_0x6931('0x5c')]['id']}})[_0x6931('0x2b')](handleEntityNotFound(_0x1e90f6,null))[_0x6931('0x2b')](function(_0x3bd20b){if(_0x3bd20b){return _0x3bd20b['removeAgents'](_0x5d3272[_0x6931('0x3a')][_0x6931('0x6b')])[_0x6931('0x2b')](function(){if(_[_0x6931('0x90')](_0x5d3272[_0x6931('0x3a')][_0x6931('0x6b')])){for(var _0x4d2ce6=0x0;_0x4d2ce6<_0x5d3272[_0x6931('0x3a')][_0x6931('0x6b')]['length'];_0x4d2ce6+=0x1){socket[_0x6931('0x75')](_0x6931('0x8c'),{'UserId':Number(_0x5d3272['query']['ids'][_0x4d2ce6]),'FaxQueueId':Number(_0x5d3272[_0x6931('0x5c')]['id'])});}}else{socket[_0x6931('0x75')](_0x6931('0x8c'),{'UserId':Number(_0x5d3272[_0x6931('0x3a')][_0x6931('0x6b')]),'FaxQueueId':Number(_0x5d3272[_0x6931('0x5c')]['id'])});}});}})[_0x6931('0x2b')](respondWithStatusCode(_0x1e90f6,null))[_0x6931('0x4c')](handleError(_0x1e90f6,null));};exports[_0x6931('0x91')]=function(_0x315e27,_0x30ac0e,_0x4675e8){var _0x38ed06={};var _0xd0da72={};var _0x13dfbe;var _0x2ddb0c;return db['FaxQueue'][_0x6931('0x67')]({'where':{'id':_0x315e27[_0x6931('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30ac0e,null))[_0x6931('0x2b')](function(_0x58a06f){if(_0x58a06f){_0x13dfbe=_0x58a06f;_0xd0da72[_0x6931('0x39')]=_[_0x6931('0x3b')](db[_0x6931('0x6c')][_0x6931('0x36')]);_0xd0da72['query']=_[_0x6931('0x3b')](_0x315e27[_0x6931('0x3a')]);_0xd0da72[_0x6931('0x42')]=_[_0x6931('0x3c')](_0xd0da72['model'],_0xd0da72[_0x6931('0x3a')]);_0x38ed06[_0x6931('0x3e')]=_[_0x6931('0x3c')](_0xd0da72[_0x6931('0x39')],qs[_0x6931('0x3d')](_0x315e27['query'][_0x6931('0x3d')]));_0x38ed06[_0x6931('0x3e')]=_0x38ed06[_0x6931('0x3e')][_0x6931('0x4e')]?_0x38ed06['attributes']:_0xd0da72[_0x6931('0x39')];_0x38ed06[_0x6931('0x69')]=qs[_0x6931('0x40')](_0x315e27[_0x6931('0x3a')][_0x6931('0x40')]);_0x38ed06[_0x6931('0x41')]=qs[_0x6931('0x42')](_[_0x6931('0x43')](_0x315e27[_0x6931('0x3a')],_0xd0da72[_0x6931('0x42')]));if(_0x315e27[_0x6931('0x3a')][_0x6931('0x44')]){_0x38ed06[_0x6931('0x41')]=_['merge'](_0x38ed06[_0x6931('0x41')],{'$or':_[_0x6931('0x34')](_0x38ed06[_0x6931('0x3e')],function(_0x2cf665){var _0x402a99={};_0x402a99[_0x2cf665]={'$like':'%'+_0x315e27['query'][_0x6931('0x44')]+'%'};return _0x402a99;})});}_0x38ed06=_['merge']({},_0x38ed06,_0x315e27[_0x6931('0x47')]);return _0x13dfbe[_0x6931('0x91')](_0x38ed06);}})[_0x6931('0x2b')](function(_0x220eae){if(_0x220eae){_0x2ddb0c=_0x220eae[_0x6931('0x4e')];if(!_0x315e27[_0x6931('0x3a')][_0x6931('0x3f')](_0x6931('0x92'))){_0x38ed06[_0x6931('0x26')]=qs[_0x6931('0x26')](_0x315e27[_0x6931('0x3a')]['limit']);_0x38ed06[_0x6931('0x23')]=qs['offset'](_0x315e27[_0x6931('0x3a')][_0x6931('0x23')]);}return _0x13dfbe[_0x6931('0x91')](_0x38ed06);}})['then'](function(_0x75027c){if(_0x75027c){return _0x75027c?{'count':_0x2ddb0c,'rows':_0x75027c}:null;}})['then'](respondWithResult(_0x30ac0e,null))[_0x6931('0x4c')](handleError(_0x30ac0e,null));}; \ No newline at end of file +var _0x8da1=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','Team','getTeams','addTeams','ids','findAll','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Agents','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','FaxQueue','rows','catch','show'];(function(_0x3b35d6,_0x17e26d){var _0x1fcbb8=function(_0x351cab){while(--_0x351cab){_0x3b35d6['push'](_0x3b35d6['shift']());}};_0x1fcbb8(++_0x17e26d);}(_0x8da1,0x152));var _0x18da=function(_0x5b6092,_0x5563bd){_0x5b6092=_0x5b6092-0x0;var _0x3de6aa=_0x8da1[_0x5b6092];return _0x3de6aa;};'use strict';var emlformat=require(_0x18da('0x0'));var rimraf=require(_0x18da('0x1'));var zipdir=require(_0x18da('0x2'));var jsonpatch=require(_0x18da('0x3'));var rp=require(_0x18da('0x4'));var moment=require(_0x18da('0x5'));var BPromise=require(_0x18da('0x6'));var Mustache=require(_0x18da('0x7'));var util=require(_0x18da('0x8'));var path=require(_0x18da('0x9'));var sox=require(_0x18da('0xa'));var csv=require(_0x18da('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18da('0xc'));var _=require(_0x18da('0xd'));var squel=require('squel');var crypto=require(_0x18da('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18da('0xb'));var querystring=require(_0x18da('0xf'));var Papa=require(_0x18da('0x10'));var Redis=require(_0x18da('0x11'));var authService=require(_0x18da('0x12'));var qs=require(_0x18da('0x13'));var as=require(_0x18da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18da('0x15'))('api');var utils=require(_0x18da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x18da('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x18da('0x18')](config[_0x18da('0x19')],{'host':_0x18da('0x1a'),'port':0x18eb});var socket=require(_0x18da('0x1b'))(new Redis(config[_0x18da('0x19')]));require(_0x18da('0x1c'))[_0x18da('0x1d')](socket);function respondWithStatusCode(_0x5afb2e,_0x1a18ae){_0x1a18ae=_0x1a18ae||0xcc;return function(_0x5f27cb){if(_0x5f27cb){return _0x5afb2e[_0x18da('0x1e')](_0x1a18ae);}return _0x5afb2e[_0x18da('0x1f')](_0x1a18ae)[_0x18da('0x20')]();};}function respondWithResult(_0x322293,_0x532e99){_0x532e99=_0x532e99||0xc8;return function(_0x31f71c){if(_0x31f71c){return _0x322293['status'](_0x532e99)[_0x18da('0x21')](_0x31f71c);}};}function respondWithFilteredResult(_0x5898db,_0x16cf1f){return function(_0x25a5c3){if(_0x25a5c3){var _0x5309fe=typeof _0x16cf1f['offset']===_0x18da('0x22')&&typeof _0x16cf1f[_0x18da('0x23')]===_0x18da('0x22');var _0x507582=_0x25a5c3['count'];var _0x4d4963=_0x5309fe?0x0:_0x16cf1f[_0x18da('0x24')];var _0x3c996b=_0x5309fe?_0x25a5c3[_0x18da('0x25')]:_0x16cf1f[_0x18da('0x24')]+_0x16cf1f[_0x18da('0x23')];var _0xfe993f;if(_0x3c996b>=_0x507582){_0x3c996b=_0x507582;_0xfe993f=0xc8;}else{_0xfe993f=0xce;}_0x5898db['status'](_0xfe993f);return _0x5898db['set'](_0x18da('0x26'),_0x4d4963+'-'+_0x3c996b+'/'+_0x507582)[_0x18da('0x21')](_0x25a5c3);}return null;};}function patchUpdates(_0x2b8497){return function(_0x1d7694){try{jsonpatch[_0x18da('0x27')](_0x1d7694,_0x2b8497,!![]);}catch(_0x4274d7){return BPromise[_0x18da('0x28')](_0x4274d7);}return _0x1d7694['save']();};}function saveUpdates(_0x44bbf4,_0x125465){return function(_0x22cc2b){if(_0x22cc2b){return _0x22cc2b[_0x18da('0x29')](_0x44bbf4)[_0x18da('0x2a')](function(_0x300da7){return _0x300da7;});}return null;};}function removeEntity(_0x1874ce,_0x27023c){return function(_0x4c13e8){if(_0x4c13e8){return _0x4c13e8[_0x18da('0x2b')]()['then'](function(){var _0x39ca04=_0x4c13e8[_0x18da('0x2c')]({'plain':!![]});var _0x3cd41f=_0x18da('0x2d');return db[_0x18da('0x2e')][_0x18da('0x2b')]({'where':{'type':_0x3cd41f,'resourceId':_0x39ca04['id']}})[_0x18da('0x2a')](function(){return _0x4c13e8;});})[_0x18da('0x2a')](function(){_0x1874ce[_0x18da('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x480a0e,_0x579daf){return function(_0x493bcf){if(!_0x493bcf){_0x480a0e[_0x18da('0x1e')](0x194);}return _0x493bcf;};}function handleError(_0x190d86,_0x452c38){_0x452c38=_0x452c38||0x1f4;return function(_0x3ca91a){logger[_0x18da('0x2f')](_0x3ca91a[_0x18da('0x30')]);if(_0x3ca91a['name']){delete _0x3ca91a[_0x18da('0x31')];}_0x190d86[_0x18da('0x1f')](_0x452c38)[_0x18da('0x32')](_0x3ca91a);};}exports['index']=function(_0x344137,_0x2f6db9){var _0x2c96bb={},_0x469610={},_0x25f437={'count':0x0,'rows':[]};var _0x327074=_[_0x18da('0x33')](db['FaxQueue'][_0x18da('0x34')],function(_0x50420c){return{'name':_0x50420c[_0x18da('0x35')],'type':_0x50420c['type'][_0x18da('0x36')]};});_0x469610[_0x18da('0x37')]=_['map'](_0x327074,_0x18da('0x31'));_0x469610[_0x18da('0x38')]=_[_0x18da('0x39')](_0x344137['query']);_0x469610[_0x18da('0x3a')]=_[_0x18da('0x3b')](_0x469610[_0x18da('0x37')],_0x469610['query']);_0x2c96bb[_0x18da('0x3c')]=_[_0x18da('0x3b')](_0x469610[_0x18da('0x37')],qs[_0x18da('0x3d')](_0x344137['query'][_0x18da('0x3d')]));_0x2c96bb[_0x18da('0x3c')]=_0x2c96bb[_0x18da('0x3c')][_0x18da('0x3e')]?_0x2c96bb[_0x18da('0x3c')]:_0x469610[_0x18da('0x37')];if(!_0x344137[_0x18da('0x38')]['hasOwnProperty'](_0x18da('0x3f'))){_0x2c96bb[_0x18da('0x23')]=qs['limit'](_0x344137[_0x18da('0x38')]['limit']);_0x2c96bb['offset']=qs[_0x18da('0x24')](_0x344137[_0x18da('0x38')][_0x18da('0x24')]);}_0x2c96bb[_0x18da('0x40')]=qs['sort'](_0x344137[_0x18da('0x38')][_0x18da('0x41')]);_0x2c96bb[_0x18da('0x42')]=qs[_0x18da('0x3a')](_[_0x18da('0x43')](_0x344137[_0x18da('0x38')],_0x469610[_0x18da('0x3a')]),_0x327074);if(_0x344137[_0x18da('0x38')][_0x18da('0x44')]){_0x2c96bb[_0x18da('0x42')]=_[_0x18da('0x45')](_0x2c96bb[_0x18da('0x42')],{'$or':_[_0x18da('0x33')](_0x327074,function(_0x587c8d){if(_0x587c8d[_0x18da('0x46')]!==_0x18da('0x47')){var _0x24e431={};_0x24e431[_0x587c8d[_0x18da('0x31')]]={'$like':'%'+_0x344137['query'][_0x18da('0x44')]+'%'};return _0x24e431;}})});}_0x2c96bb=_[_0x18da('0x45')]({},_0x2c96bb,_0x344137[_0x18da('0x48')]);var _0x30d16a={'where':_0x2c96bb[_0x18da('0x42')]};return db['FaxQueue'][_0x18da('0x25')](_0x30d16a)['then'](function(_0x8f4649){_0x25f437[_0x18da('0x25')]=_0x8f4649;if(_0x344137[_0x18da('0x38')][_0x18da('0x49')]){_0x2c96bb[_0x18da('0x4a')]=[{'all':!![]}];}return db[_0x18da('0x4b')]['findAll'](_0x2c96bb);})[_0x18da('0x2a')](function(_0x311eca){_0x25f437[_0x18da('0x4c')]=_0x311eca;return _0x25f437;})[_0x18da('0x2a')](respondWithFilteredResult(_0x2f6db9,_0x2c96bb))[_0x18da('0x4d')](handleError(_0x2f6db9,null));};exports[_0x18da('0x4e')]=function(_0x444b56,_0x21ae03){var _0x563c17={'raw':!![],'where':{'id':_0x444b56[_0x18da('0x4f')]['id']}},_0x372746={};_0x372746[_0x18da('0x37')]=_[_0x18da('0x39')](db[_0x18da('0x4b')][_0x18da('0x34')]);_0x372746['query']=_['keys'](_0x444b56[_0x18da('0x38')]);_0x372746[_0x18da('0x3a')]=_['intersection'](_0x372746['model'],_0x372746[_0x18da('0x38')]);_0x563c17[_0x18da('0x3c')]=_[_0x18da('0x3b')](_0x372746['model'],qs[_0x18da('0x3d')](_0x444b56[_0x18da('0x38')]['fields']));_0x563c17['attributes']=_0x563c17[_0x18da('0x3c')][_0x18da('0x3e')]?_0x563c17[_0x18da('0x3c')]:_0x372746[_0x18da('0x37')];if(_0x444b56[_0x18da('0x38')]['includeAll']){_0x563c17[_0x18da('0x4a')]=[{'all':!![]}];}_0x563c17=_[_0x18da('0x45')]({},_0x563c17,_0x444b56[_0x18da('0x48')]);return db[_0x18da('0x4b')][_0x18da('0x50')](_0x563c17)[_0x18da('0x2a')](handleEntityNotFound(_0x21ae03,null))[_0x18da('0x2a')](respondWithResult(_0x21ae03,null))['catch'](handleError(_0x21ae03,null));};exports[_0x18da('0x51')]=function(_0x3a6dc3,_0x4f85c5){return db[_0x18da('0x4b')]['create'](_0x3a6dc3[_0x18da('0x52')],{})['then'](function(_0x5a15de){var _0x4a43f4=_0x3a6dc3[_0x18da('0x53')][_0x18da('0x2c')]({'plain':!![]});if(!_0x4a43f4)throw new Error(_0x18da('0x54'));if(_0x4a43f4[_0x18da('0x55')]===_0x18da('0x53')){var _0x46f471=_0x5a15de[_0x18da('0x2c')]({'plain':!![]});var _0x18760f=_0x18da('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x18760f,'userProfileId':_0x4a43f4[_0x18da('0x56')]},'raw':!![]})['then'](function(_0x1c4059){if(_0x1c4059&&_0x1c4059['autoAssociation']===0x0){return db[_0x18da('0x2e')][_0x18da('0x51')]({'name':_0x46f471['name'],'resourceId':_0x46f471['id'],'type':_0x1c4059[_0x18da('0x31')],'sectionId':_0x1c4059['id']},{})[_0x18da('0x2a')](function(){return _0x5a15de;});}else{return _0x5a15de;}})[_0x18da('0x4d')](function(_0x3de602){logger['error'](_0x18da('0x57'),_0x3de602);throw _0x3de602;});}return _0x5a15de;})['then'](respondWithResult(_0x4f85c5,0xc9))[_0x18da('0x4d')](handleError(_0x4f85c5,null));};exports[_0x18da('0x29')]=function(_0x1148f8,_0x36374a){if(_0x1148f8['body']['id']){delete _0x1148f8[_0x18da('0x52')]['id'];}return db[_0x18da('0x4b')][_0x18da('0x50')]({'where':{'id':_0x1148f8[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](handleEntityNotFound(_0x36374a,null))[_0x18da('0x2a')](saveUpdates(_0x1148f8[_0x18da('0x52')],null))[_0x18da('0x2a')](respondWithResult(_0x36374a,null))[_0x18da('0x4d')](handleError(_0x36374a,null));};exports[_0x18da('0x2b')]=function(_0x5d092f,_0x4ea24f){return db[_0x18da('0x4b')][_0x18da('0x50')]({'where':{'id':_0x5d092f[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](handleEntityNotFound(_0x4ea24f,null))[_0x18da('0x2a')](removeEntity(_0x4ea24f,null))[_0x18da('0x4d')](handleError(_0x4ea24f,null));};exports[_0x18da('0x58')]=function(_0x8366aa,_0x478df6){return db['FaxQueue'][_0x18da('0x58')]()[_0x18da('0x2a')](respondWithResult(_0x478df6,null))[_0x18da('0x4d')](handleError(_0x478df6,null));};exports[_0x18da('0x59')]=function(_0x1d7636,_0x187264,_0x34d079){var _0x1091d3={'raw':!![],'where':{}},_0x2b70cd={},_0x2874c5;return db[_0x18da('0x4b')][_0x18da('0x5a')]({'where':{'id':_0x1d7636[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](handleEntityNotFound(_0x187264,null))[_0x18da('0x2a')](function(_0x55f059){if(_0x55f059){_0x2874c5=_0x55f059['get']({'plain':!![]});_0x2b70cd[_0x18da('0x37')]=_[_0x18da('0x39')](db[_0x18da('0x5b')]['rawAttributes']);_0x2b70cd['query']=_['keys'](_0x1d7636[_0x18da('0x38')]);_0x2b70cd[_0x18da('0x3a')]=_[_0x18da('0x3b')](_0x2b70cd['model'],_0x2b70cd['query']);_0x1091d3['attributes']=_[_0x18da('0x3b')](_0x2b70cd[_0x18da('0x37')],qs['fields'](_0x1d7636[_0x18da('0x38')][_0x18da('0x3d')]));_0x1091d3[_0x18da('0x3c')]=_0x1091d3[_0x18da('0x3c')][_0x18da('0x3e')]?_0x1091d3['attributes']:_0x2b70cd['model'];if(!_0x1d7636[_0x18da('0x38')][_0x18da('0x5c')]('nolimit')){_0x1091d3[_0x18da('0x23')]=qs[_0x18da('0x23')](_0x1d7636[_0x18da('0x38')][_0x18da('0x23')]);_0x1091d3[_0x18da('0x24')]=qs[_0x18da('0x24')](_0x1d7636['query']['offset']);}_0x1091d3['order']=qs['sort'](_0x1d7636['query'][_0x18da('0x41')]);_0x1091d3[_0x18da('0x42')]=qs[_0x18da('0x3a')](_[_0x18da('0x43')](_0x1d7636['query'],_0x2b70cd[_0x18da('0x3a')]));_0x1091d3[_0x18da('0x42')][_0x18da('0x5d')]=_0x55f059['id'];if(_0x1d7636['query'][_0x18da('0x44')]){_0x1091d3[_0x18da('0x42')]=_[_0x18da('0x45')](_0x1091d3[_0x18da('0x42')],{'$or':_[_0x18da('0x33')](_0x1091d3[_0x18da('0x3c')],function(_0x52c2fc){var _0x2a1d8b={};_0x2a1d8b[_0x52c2fc]={'$like':'%'+_0x1d7636[_0x18da('0x38')]['filter']+'%'};return _0x2a1d8b;})});}_0x1091d3=_[_0x18da('0x45')]({},_0x1091d3,_0x1d7636[_0x18da('0x48')]);return db[_0x18da('0x5b')]['findAll'](_0x1091d3);}})[_0x18da('0x2a')](function(_0x3cec80){if(_0x3cec80){return db[_0x18da('0x5e')][_0x18da('0x5f')]({'where':{'id':_['map'](_0x3cec80,_0x18da('0x60')),'role':'agent'},'attributes':['id',_0x18da('0x31'),_0x18da('0x61'),_0x18da('0x62'),'createdAt']});}})['then'](function(_0x438f78){if(_0x438f78){return{'count':_0x438f78[_0x18da('0x25')],'rows':_[_0x18da('0x33')](_0x438f78['rows'],function(_0x4e9301){return{'membername':_0x4e9301[_0x18da('0x31')],'UserId':_0x4e9301['id'],'queue_name':_0x2874c5['name'],'FaxQueueId':_0x2874c5['id'],'interface':util[_0x18da('0x63')](_0x18da('0x64'),'SIP',_0x4e9301[_0x18da('0x31')]),'penalty':0x0,'paused':_0x4e9301[_0x18da('0x61')],'createdAt':_0x4e9301['createdAt'],'updatedAt':_0x4e9301[_0x18da('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x18da('0x2a')](respondWithFilteredResult(_0x187264,_0x1091d3))['catch'](handleError(_0x187264,null));};exports['getTeams']=function(_0x9888bb,_0x5579f4,_0x223600){var _0x24c382={};var _0x2f2250={};var _0x5242fa;var _0xcc15e1;return db[_0x18da('0x4b')][_0x18da('0x5a')]({'where':{'id':_0x9888bb[_0x18da('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5579f4,null))['then'](function(_0x573ea1){if(_0x573ea1){_0x5242fa=_0x573ea1;_0x2f2250['model']=_[_0x18da('0x39')](db[_0x18da('0x65')][_0x18da('0x34')]);_0x2f2250[_0x18da('0x38')]=_[_0x18da('0x39')](_0x9888bb[_0x18da('0x38')]);_0x2f2250[_0x18da('0x3a')]=_[_0x18da('0x3b')](_0x2f2250[_0x18da('0x37')],_0x2f2250[_0x18da('0x38')]);_0x24c382[_0x18da('0x3c')]=_[_0x18da('0x3b')](_0x2f2250[_0x18da('0x37')],qs[_0x18da('0x3d')](_0x9888bb[_0x18da('0x38')][_0x18da('0x3d')]));_0x24c382['attributes']=_0x24c382[_0x18da('0x3c')][_0x18da('0x3e')]?_0x24c382['attributes']:_0x2f2250[_0x18da('0x37')];_0x24c382[_0x18da('0x40')]=qs[_0x18da('0x41')](_0x9888bb['query'][_0x18da('0x41')]);_0x24c382[_0x18da('0x42')]=qs['filters'](_[_0x18da('0x43')](_0x9888bb[_0x18da('0x38')],_0x2f2250[_0x18da('0x3a')]));if(_0x9888bb[_0x18da('0x38')][_0x18da('0x44')]){_0x24c382[_0x18da('0x42')]=_[_0x18da('0x45')](_0x24c382['where'],{'$or':_['map'](_0x24c382[_0x18da('0x3c')],function(_0x528d97){var _0xe2caf8={};_0xe2caf8[_0x528d97]={'$like':'%'+_0x9888bb[_0x18da('0x38')][_0x18da('0x44')]+'%'};return _0xe2caf8;})});}_0x24c382=_['merge']({},_0x24c382,_0x9888bb[_0x18da('0x48')]);return _0x5242fa[_0x18da('0x66')](_0x24c382);}})[_0x18da('0x2a')](function(_0x67baca){if(_0x67baca){_0xcc15e1=_0x67baca[_0x18da('0x3e')];if(!_0x9888bb[_0x18da('0x38')][_0x18da('0x5c')](_0x18da('0x3f'))){_0x24c382[_0x18da('0x23')]=qs[_0x18da('0x23')](_0x9888bb[_0x18da('0x38')][_0x18da('0x23')]);_0x24c382[_0x18da('0x24')]=qs[_0x18da('0x24')](_0x9888bb['query']['offset']);}return _0x5242fa[_0x18da('0x66')](_0x24c382);}})[_0x18da('0x2a')](function(_0x1d97dc){if(_0x1d97dc){return _0x1d97dc?{'count':_0xcc15e1,'rows':_0x1d97dc}:null;}})[_0x18da('0x2a')](respondWithResult(_0x5579f4,null))[_0x18da('0x4d')](handleError(_0x5579f4,null));};exports[_0x18da('0x67')]=function(_0x12c092,_0x5498b7,_0x47c9f3){var _0x45522b=_0x12c092[_0x18da('0x52')][_0x18da('0x68')];return db['Team'][_0x18da('0x69')]({'where':{'id':_0x45522b},'attributes':['id'],'include':[{'model':db[_0x18da('0x5e')],'as':'Agents','attributes':['id',_0x18da('0x31'),'online','voicePause',_0x18da('0x6a')],'raw':!![]}]})['then'](function(_0x11527d){if(_0x11527d){var _0x45762e=_['flatMap'](_0x11527d,function(_0x4bf8ce){var _0x2687c9=_0x4bf8ce['get']({'plain':!![]});return _0x2687c9['Agents'];});return db['FaxQueue'][_0x18da('0x50')]({'where':{'id':_0x12c092[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](function(_0xd87e65){return db['sequelize'][_0x18da('0x6b')](function(_0x9d155c){return _0xd87e65['addTeams'](_0x45522b,{'transaction':_0x9d155c})[_0x18da('0x2a')](function(){return BPromise[_0x18da('0x6c')](_0x45762e,function(_0x1305d5){return db[_0x18da('0x5b')][_0x18da('0x6d')]({'where':{'UserId':_0x1305d5['id'],'FaxQueueId':_0x12c092[_0x18da('0x4f')]['id']},'transaction':_0x9d155c});});})['then'](function(){_0x45762e[_0x18da('0x6e')](function(_0x43dc64){socket[_0x18da('0x6f')](_0x18da('0x70'),{'UserId':_0x43dc64['id'],'FaxQueueId':_0xd87e65['id']});});});});});}})['then'](respondWithStatusCode(_0x5498b7,null))[_0x18da('0x4d')](handleError(_0x5498b7,null));};exports[_0x18da('0x71')]=function(_0x5e9178,_0x350cf9,_0x19461d){return db[_0x18da('0x65')][_0x18da('0x69')]({'where':{'id':_0x5e9178[_0x18da('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x18da('0x72'),'attributes':['id'],'raw':!![]}]})[_0x18da('0x2a')](handleEntityNotFound(_0x350cf9,null))[_0x18da('0x2a')](function(_0x26964a){var _0x5a7828=_[_0x18da('0x33')](_0x26964a,'id');var _0x5b7f09=[];var _0x3d9e78=[];var _0x5c36c5=squel['select']();_0x5c36c5[_0x18da('0x73')](_0x18da('0x74'))[_0x18da('0x75')]('team_has_fax_queues','tq')['join'](_0x18da('0x76'),'ut',_0x18da('0x77'))[_0x18da('0x42')](_0x18da('0x78'),_0x5e9178['params']['id']);for(var _0x172464=0x0;_0x172464<_0x26964a['length'];_0x172464+=0x1){let _0x5247e7=_0x26964a[_0x172464];for(var _0x1c12f1=0x0;_0x1c12f1<_0x5247e7[_0x18da('0x72')][_0x18da('0x3e')];_0x1c12f1+=0x1){let _0x59801a=_0x5247e7[_0x18da('0x72')][_0x1c12f1];var _0xfda744=_0x5c36c5['clone']();_0xfda744[_0x18da('0x42')](_0x18da('0x79'),_0x59801a['id']);_0x3d9e78[_0x18da('0x7a')](db[_0x18da('0x7b')][_0x18da('0x38')](_0xfda744[_0x18da('0x7c')](),{'type':db[_0x18da('0x7b')][_0x18da('0x7d')][_0x18da('0x7e')]})[_0x18da('0x2a')](function(_0x388f9a){if(_0x388f9a[_0x18da('0x3e')]===0x1){return _0x59801a['id'];}else{var _0x46ceb9=_['every'](_[_0x18da('0x33')](_0x388f9a,_0x18da('0x7f')),function(_0x3c9ed1){return _['includes'](_0x5a7828,_0x3c9ed1);});if(_0x46ceb9){return _0x59801a['id'];}}}));}}return BPromise[_0x18da('0x80')](_0x3d9e78)['then'](function(_0x240af0){_0x5b7f09=_(_0x5b7f09)[_0x18da('0x81')](_0x240af0)['compact']()[_0x18da('0x82')]();return db[_0x18da('0x4b')][_0x18da('0x50')]({'where':{'id':_0x5e9178[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](function(_0x4e203c){return db[_0x18da('0x7b')]['transaction'](function(_0x46058e){return _0x4e203c['removeTeams'](_0x5e9178[_0x18da('0x38')]['ids'],{'transaction':_0x46058e})[_0x18da('0x2a')](function(){if(!_[_0x18da('0x83')](_0x5b7f09)){return _0x4e203c[_0x18da('0x84')](_0x5b7f09,{'transaction':_0x46058e});}})[_0x18da('0x2a')](function(){_0x5b7f09[_0x18da('0x6e')](function(_0x4d6cc5){socket[_0x18da('0x6f')]('userFaxQueue:remove',{'UserId':_0x4d6cc5,'FaxQueueId':_0x4e203c['id']});});});});});});})[_0x18da('0x2a')](respondWithStatusCode(_0x350cf9,null))['catch'](handleError(_0x350cf9,null));};exports[_0x18da('0x85')]=function(_0x2fcf34,_0x2b4bd5,_0x40b5a8){return db[_0x18da('0x4b')][_0x18da('0x50')]({'where':{'id':_0x2fcf34[_0x18da('0x4f')]['id']}})[_0x18da('0x2a')](handleEntityNotFound(_0x2b4bd5,null))[_0x18da('0x2a')](function(_0x14c954){if(_0x14c954){return _0x14c954[_0x18da('0x85')](_0x2fcf34[_0x18da('0x52')][_0x18da('0x68')],_[_0x18da('0x86')](_0x2fcf34[_0x18da('0x52')],[_0x18da('0x68'),'id'])||{})[_0x18da('0x87')](function(_0x4859b4){for(var _0xaae57e=0x0;_0xaae57e<_0x2fcf34[_0x18da('0x52')]['ids']['length'];_0xaae57e+=0x1){socket['emit'](_0x18da('0x70'),{'UserId':Number(_0x2fcf34[_0x18da('0x52')][_0x18da('0x68')][_0xaae57e]),'FaxQueueId':Number(_0x2fcf34[_0x18da('0x4f')]['id'])});}return _0x4859b4;});}})[_0x18da('0x2a')](respondWithResult(_0x2b4bd5,null))[_0x18da('0x4d')](handleError(_0x2b4bd5,null));};exports[_0x18da('0x84')]=function(_0x5bccd7,_0x146677,_0x2beec8){return db['FaxQueue'][_0x18da('0x50')]({'where':{'id':_0x5bccd7[_0x18da('0x4f')]['id']}})['then'](handleEntityNotFound(_0x146677,null))[_0x18da('0x2a')](function(_0x23d822){if(_0x23d822){return _0x23d822[_0x18da('0x84')](_0x5bccd7[_0x18da('0x38')]['ids'])[_0x18da('0x2a')](function(){if(_[_0x18da('0x88')](_0x5bccd7['query'][_0x18da('0x68')])){for(var _0x1f20c0=0x0;_0x1f20c0<_0x5bccd7[_0x18da('0x38')][_0x18da('0x68')][_0x18da('0x3e')];_0x1f20c0+=0x1){socket['emit'](_0x18da('0x89'),{'UserId':Number(_0x5bccd7[_0x18da('0x38')][_0x18da('0x68')][_0x1f20c0]),'FaxQueueId':Number(_0x5bccd7[_0x18da('0x4f')]['id'])});}}else{socket[_0x18da('0x6f')](_0x18da('0x89'),{'UserId':Number(_0x5bccd7[_0x18da('0x38')][_0x18da('0x68')]),'FaxQueueId':Number(_0x5bccd7['params']['id'])});}});}})[_0x18da('0x2a')](respondWithStatusCode(_0x146677,null))[_0x18da('0x4d')](handleError(_0x146677,null));};exports['getAgents']=function(_0x6c7a09,_0x26a3fd,_0x1111a1){var _0x583fef={};var _0x140a26={};var _0x4344ab;var _0x5dacd7;return db[_0x18da('0x4b')]['findOne']({'where':{'id':_0x6c7a09['params']['id']}})[_0x18da('0x2a')](handleEntityNotFound(_0x26a3fd,null))[_0x18da('0x2a')](function(_0x5655da){if(_0x5655da){_0x4344ab=_0x5655da;_0x140a26[_0x18da('0x37')]=_[_0x18da('0x39')](db['User']['rawAttributes']);_0x140a26[_0x18da('0x38')]=_['keys'](_0x6c7a09[_0x18da('0x38')]);_0x140a26[_0x18da('0x3a')]=_['intersection'](_0x140a26[_0x18da('0x37')],_0x140a26[_0x18da('0x38')]);_0x583fef[_0x18da('0x3c')]=_[_0x18da('0x3b')](_0x140a26[_0x18da('0x37')],qs['fields'](_0x6c7a09[_0x18da('0x38')][_0x18da('0x3d')]));_0x583fef[_0x18da('0x3c')]=_0x583fef[_0x18da('0x3c')][_0x18da('0x3e')]?_0x583fef[_0x18da('0x3c')]:_0x140a26[_0x18da('0x37')];_0x583fef['order']=qs[_0x18da('0x41')](_0x6c7a09[_0x18da('0x38')][_0x18da('0x41')]);_0x583fef['where']=qs[_0x18da('0x3a')](_[_0x18da('0x43')](_0x6c7a09[_0x18da('0x38')],_0x140a26[_0x18da('0x3a')]));if(_0x6c7a09[_0x18da('0x38')][_0x18da('0x44')]){_0x583fef['where']=_[_0x18da('0x45')](_0x583fef[_0x18da('0x42')],{'$or':_['map'](_0x583fef[_0x18da('0x3c')],function(_0x1a391d){var _0x3c36bd={};_0x3c36bd[_0x1a391d]={'$like':'%'+_0x6c7a09['query']['filter']+'%'};return _0x3c36bd;})});}_0x583fef=_[_0x18da('0x45')]({},_0x583fef,_0x6c7a09[_0x18da('0x48')]);return _0x4344ab['getAgents'](_0x583fef);}})[_0x18da('0x2a')](function(_0x4fb85e){if(_0x4fb85e){_0x5dacd7=_0x4fb85e['length'];if(!_0x6c7a09['query'][_0x18da('0x5c')](_0x18da('0x3f'))){_0x583fef[_0x18da('0x23')]=qs[_0x18da('0x23')](_0x6c7a09[_0x18da('0x38')][_0x18da('0x23')]);_0x583fef[_0x18da('0x24')]=qs['offset'](_0x6c7a09['query'][_0x18da('0x24')]);}return _0x4344ab[_0x18da('0x8a')](_0x583fef);}})[_0x18da('0x2a')](function(_0x336fca){if(_0x336fca){return _0x336fca?{'count':_0x5dacd7,'rows':_0x336fca}:null;}})['then'](respondWithResult(_0x26a3fd,null))[_0x18da('0x4d')](handleError(_0x26a3fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ed5ee0e..fcb1d08 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 _0x2596=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','update','emit'];(function(_0x240419,_0x2eb4a6){var _0x18437d=function(_0x3cbc73){while(--_0x3cbc73){_0x240419['push'](_0x240419['shift']());}};_0x18437d(++_0x2eb4a6);}(_0x2596,0xe3));var _0x6259=function(_0x52e130,_0x36a67c){_0x52e130=_0x52e130-0x0;var _0x167346=_0x2596[_0x52e130];return _0x167346;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6259('0x0'))['db'][_0x6259('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6259('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6259('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13cbc4){return function(_0x5bc05c,_0x2154f1,_0x2dfc30){FaxQueueEvents[_0x6259('0x4')](_0x13cbc4+':'+_0x5bc05c['id'],_0x5bc05c);FaxQueueEvents[_0x6259('0x4')](_0x13cbc4,_0x5bc05c);_0x2dfc30(null);};}for(var e in events){if(events[_0x6259('0x5')](e)){var event=events[e];FaxQueue[_0x6259('0x6')](e,emitEvent(event));}}module[_0x6259('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xf364=['emit','hook','events','setMaxListeners','save','update'];(function(_0x4e0fed,_0x17d746){var _0x17555b=function(_0x4091f1){while(--_0x4091f1){_0x4e0fed['push'](_0x4e0fed['shift']());}};_0x17555b(++_0x17d746);}(_0xf364,0xa4));var _0x4f36=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf364[_0x5783f4];return _0x28e380;};'use strict';var EventEmitter=require(_0x4f36('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4f36('0x1')](0x0);var events={'afterCreate':_0x4f36('0x2'),'afterUpdate':_0x4f36('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5840bc){return function(_0x573a04,_0x5e2f5b,_0xe2854d){FaxQueueEvents[_0x4f36('0x4')](_0x5840bc+':'+_0x573a04['id'],_0x573a04);FaxQueueEvents[_0x4f36('0x4')](_0x5840bc,_0x573a04);_0xe2854d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x4f36('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 49b4695..fa678db 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 _0x7351=['api','moment','bluebird','path','rimraf','exports','define','FaxQueue','fax_queues','lodash','../../config/logger'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7351,0x15e));var _0x1735=function(_0xb49ded,_0x28bfdb){_0xb49ded=_0xb49ded-0x0;var _0x337e69=_0x7351[_0xb49ded];return _0x337e69;};'use strict';var _=require(_0x1735('0x0'));var util=require('util');var logger=require(_0x1735('0x1'))(_0x1735('0x2'));var moment=require(_0x1735('0x3'));var BPromise=require(_0x1735('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x1735('0x7')]=function(_0x4f45c5,_0x3ef7f6){return _0x4f45c5[_0x1735('0x8')](_0x1735('0x9'),attributes,{'tableName':_0x1735('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x013e=['define','FaxQueue','fax_queues','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x496c0e,_0xb4d8a8){var _0x386ef1=function(_0x36d025){while(--_0x36d025){_0x496c0e['push'](_0x496c0e['shift']());}};_0x386ef1(++_0xb4d8a8);}(_0x013e,0xae));var _0xe013=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x013e[_0x2cc8bb];return _0x140e40;};'use strict';var _=require(_0xe013('0x0'));var util=require('util');var logger=require(_0xe013('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe013('0x2'));var rp=require(_0xe013('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe013('0x4'));var config=require(_0xe013('0x5'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x2ac63f,_0x323c84){return _0x2ac63f[_0xe013('0x6')](_0xe013('0x7'),attributes,{'tableName':_0xe013('0x8'),'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 e03c63f..843a3b8 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 _0x6d69=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','FaxQueue','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','stringify','catch','ShowFaxQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x56d44b,_0x332713){var _0xc033c8=function(_0x17712b){while(--_0x17712b){_0x56d44b['push'](_0x56d44b['shift']());}};_0xc033c8(++_0x332713);}(_0x6d69,0x134));var _0x96d6=function(_0x5b5b66,_0x2e6210){_0x5b5b66=_0x5b5b66-0x0;var _0x344fee=_0x6d69[_0x5b5b66];return _0x344fee;};'use strict';var _=require(_0x96d6('0x0'));var util=require(_0x96d6('0x1'));var moment=require(_0x96d6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96d6('0x3'));var db=require(_0x96d6('0x4'))['db'];var utils=require(_0x96d6('0x5'));var logger=require(_0x96d6('0x6'))(_0x96d6('0x7'));var config=require(_0x96d6('0x8'));var jayson=require(_0x96d6('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x96d6('0xa')]=_[_0x96d6('0xb')](config[_0x96d6('0xa')],{'host':_0x96d6('0xc'),'port':0x18eb});var socket=require(_0x96d6('0xd'))(new Redis(config['redis']));require(_0x96d6('0xe'))[_0x96d6('0xf')](socket);function respondWithRpcPromise(_0x465fe9,_0x247c35,_0x519caa){return new BPromise(function(_0x50fad6,_0x710832){return client[_0x96d6('0x10')](_0x465fe9,_0x519caa)[_0x96d6('0x11')](function(_0x216f52){logger['info'](_0x96d6('0x12'),_0x247c35,_0x96d6('0x13'));logger[_0x96d6('0x14')](_0x96d6('0x15'),_0x247c35,_0x96d6('0x13'),JSON['stringify'](_0x216f52));if(_0x216f52[_0x96d6('0x16')]){if(_0x216f52[_0x96d6('0x16')][_0x96d6('0x17')]===0x1f4){logger[_0x96d6('0x16')](_0x96d6('0x12'),_0x247c35,_0x216f52['error'][_0x96d6('0x18')]);return _0x710832(_0x216f52[_0x96d6('0x16')][_0x96d6('0x18')]);}logger[_0x96d6('0x16')](_0x96d6('0x12'),_0x247c35,_0x216f52[_0x96d6('0x16')][_0x96d6('0x18')]);return _0x50fad6(_0x216f52[_0x96d6('0x16')]['message']);}else{logger[_0x96d6('0x19')]('FaxQueue,\x20%s,\x20%s',_0x247c35,_0x96d6('0x13'));_0x50fad6(_0x216f52[_0x96d6('0x1a')][_0x96d6('0x18')]);}})['catch'](function(_0x3a2acb){logger[_0x96d6('0x16')](_0x96d6('0x12'),_0x247c35,_0x3a2acb);_0x710832(_0x3a2acb);});});}exports['GetFaxQueue']=function(_0x21583a){var _0x188a2e=this;return new Promise(function(_0x4cf563,_0x265ad7){return db[_0x96d6('0x1b')]['findAll']({'raw':_0x21583a[_0x96d6('0x1c')]?_0x21583a[_0x96d6('0x1c')][_0x96d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x21583a['options']?_0x21583a[_0x96d6('0x1c')][_0x96d6('0x1e')]||null:null,'attributes':_0x21583a[_0x96d6('0x1c')]?_0x21583a['options'][_0x96d6('0x1f')]||null:null,'limit':_0x21583a[_0x96d6('0x1c')]?_0x21583a[_0x96d6('0x1c')][_0x96d6('0x20')]||null:null,'include':_0x21583a[_0x96d6('0x1c')]?_0x21583a[_0x96d6('0x1c')][_0x96d6('0x21')]?_[_0x96d6('0x22')](_0x21583a['options'][_0x96d6('0x21')],function(_0x5e2431){return{'model':db[_0x5e2431[_0x96d6('0x23')]],'as':_0x5e2431['as'],'attributes':_0x5e2431[_0x96d6('0x1f')],'include':_0x5e2431[_0x96d6('0x21')]?_[_0x96d6('0x22')](_0x5e2431[_0x96d6('0x21')],function(_0x4ff5eb){return{'model':db[_0x4ff5eb[_0x96d6('0x23')]],'as':_0x4ff5eb['as'],'attributes':_0x4ff5eb['attributes'],'include':_0x4ff5eb['include']?_[_0x96d6('0x22')](_0x4ff5eb[_0x96d6('0x21')],function(_0x5c51ce){return{'model':db[_0x5c51ce[_0x96d6('0x23')]],'as':_0x5c51ce['as'],'attributes':_0x5c51ce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5349f7){logger['info'](_0x96d6('0x24'),_0x21583a);logger[_0x96d6('0x14')](_0x96d6('0x24'),_0x21583a,JSON[_0x96d6('0x25')](_0x5349f7));_0x4cf563(_0x5349f7);})[_0x96d6('0x26')](function(_0xc64e98){logger[_0x96d6('0x16')](_0x96d6('0x24'),_0xc64e98[_0x96d6('0x18')],_0x21583a);_0x265ad7(_0x188a2e['error'](0x1f4,_0xc64e98[_0x96d6('0x18')]));});});};exports[_0x96d6('0x27')]=function(_0x3b0365){var _0x526130=this;return new Promise(function(_0x4efd6b,_0x450128){return db[_0x96d6('0x1b')][_0x96d6('0x28')]({'raw':_0x3b0365[_0x96d6('0x1c')]?_0x3b0365[_0x96d6('0x1c')][_0x96d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b0365[_0x96d6('0x1c')]?_0x3b0365[_0x96d6('0x1c')][_0x96d6('0x1e')]||null:null,'attributes':_0x3b0365['options']?_0x3b0365[_0x96d6('0x1c')]['attributes']||null:null,'include':_0x3b0365[_0x96d6('0x1c')]?_0x3b0365[_0x96d6('0x1c')][_0x96d6('0x21')]?_['map'](_0x3b0365[_0x96d6('0x1c')][_0x96d6('0x21')],function(_0x303398){return{'model':db[_0x303398[_0x96d6('0x23')]],'as':_0x303398['as'],'attributes':_0x303398[_0x96d6('0x1f')],'include':_0x303398[_0x96d6('0x21')]?_[_0x96d6('0x22')](_0x303398['include'],function(_0x29ed4b){return{'model':db[_0x29ed4b['model']],'as':_0x29ed4b['as'],'attributes':_0x29ed4b[_0x96d6('0x1f')],'include':_0x29ed4b[_0x96d6('0x21')]?_[_0x96d6('0x22')](_0x29ed4b[_0x96d6('0x21')],function(_0x188d29){return{'model':db[_0x188d29[_0x96d6('0x23')]],'as':_0x188d29['as'],'attributes':_0x188d29[_0x96d6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x96d6('0x11')](function(_0x3b5b30){logger['info'](_0x96d6('0x27'),_0x3b0365);logger[_0x96d6('0x14')](_0x96d6('0x27'),_0x3b0365,JSON[_0x96d6('0x25')](_0x3b5b30));_0x4efd6b(_0x3b5b30);})[_0x96d6('0x26')](function(_0x196440){logger[_0x96d6('0x16')](_0x96d6('0x27'),_0x196440[_0x96d6('0x18')],_0x3b0365);_0x450128(_0x526130[_0x96d6('0x16')](0x1f4,_0x196440[_0x96d6('0x18')]));});});}; \ No newline at end of file +var _0xe2f4=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','limit','include','model','map','then','ShowFaxQueue','find','where','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe2f4,0x145));var _0x4e2f=function(_0x3cb530,_0x45c902){_0x3cb530=_0x3cb530-0x0;var _0x9728fc=_0xe2f4[_0x3cb530];return _0x9728fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e2f('0x0'));var BPromise=require('bluebird');var rs=require(_0x4e2f('0x1'));var fs=require('fs');var Redis=require(_0x4e2f('0x2'));var db=require(_0x4e2f('0x3'))['db'];var utils=require(_0x4e2f('0x4'));var logger=require(_0x4e2f('0x5'))(_0x4e2f('0x6'));var config=require(_0x4e2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4e2f('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4e2f('0x9')](config[_0x4e2f('0xa')],{'host':_0x4e2f('0xb'),'port':0x18eb});var socket=require(_0x4e2f('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x4e2f('0xd')](socket);function respondWithRpcPromise(_0x491681,_0x5d1579,_0x276b4e){return new BPromise(function(_0xae0e49,_0x45f58c){return client['request'](_0x491681,_0x276b4e)['then'](function(_0x59ae6a){logger[_0x4e2f('0xe')](_0x4e2f('0xf'),_0x5d1579,_0x4e2f('0x10'));logger[_0x4e2f('0x11')](_0x4e2f('0x12'),_0x5d1579,_0x4e2f('0x10'),JSON['stringify'](_0x59ae6a));if(_0x59ae6a[_0x4e2f('0x13')]){if(_0x59ae6a[_0x4e2f('0x13')][_0x4e2f('0x14')]===0x1f4){logger[_0x4e2f('0x13')](_0x4e2f('0xf'),_0x5d1579,_0x59ae6a[_0x4e2f('0x13')][_0x4e2f('0x15')]);return _0x45f58c(_0x59ae6a['error']['message']);}logger[_0x4e2f('0x13')](_0x4e2f('0xf'),_0x5d1579,_0x59ae6a['error'][_0x4e2f('0x15')]);return _0xae0e49(_0x59ae6a[_0x4e2f('0x13')]['message']);}else{logger[_0x4e2f('0xe')]('FaxQueue,\x20%s,\x20%s',_0x5d1579,_0x4e2f('0x10'));_0xae0e49(_0x59ae6a[_0x4e2f('0x16')][_0x4e2f('0x15')]);}})[_0x4e2f('0x17')](function(_0x35e3ab){logger[_0x4e2f('0x13')](_0x4e2f('0xf'),_0x5d1579,_0x35e3ab);_0x45f58c(_0x35e3ab);});});}exports[_0x4e2f('0x18')]=function(_0x162e07){var _0xe9b750=this;return new Promise(function(_0x5d18ac,_0x2733d6){return db['FaxQueue'][_0x4e2f('0x19')]({'raw':_0x162e07[_0x4e2f('0x1a')]?_0x162e07['options'][_0x4e2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x162e07[_0x4e2f('0x1a')]?_0x162e07[_0x4e2f('0x1a')]['where']||null:null,'attributes':_0x162e07[_0x4e2f('0x1a')]?_0x162e07[_0x4e2f('0x1a')][_0x4e2f('0x1c')]||null:null,'limit':_0x162e07[_0x4e2f('0x1a')]?_0x162e07['options'][_0x4e2f('0x1d')]||null:null,'include':_0x162e07['options']?_0x162e07[_0x4e2f('0x1a')][_0x4e2f('0x1e')]?_['map'](_0x162e07[_0x4e2f('0x1a')][_0x4e2f('0x1e')],function(_0x1948b4){return{'model':db[_0x1948b4[_0x4e2f('0x1f')]],'as':_0x1948b4['as'],'attributes':_0x1948b4[_0x4e2f('0x1c')],'include':_0x1948b4['include']?_['map'](_0x1948b4['include'],function(_0x49fd5a){return{'model':db[_0x49fd5a[_0x4e2f('0x1f')]],'as':_0x49fd5a['as'],'attributes':_0x49fd5a[_0x4e2f('0x1c')],'include':_0x49fd5a[_0x4e2f('0x1e')]?_[_0x4e2f('0x20')](_0x49fd5a[_0x4e2f('0x1e')],function(_0x42ce8f){return{'model':db[_0x42ce8f[_0x4e2f('0x1f')]],'as':_0x42ce8f['as'],'attributes':_0x42ce8f[_0x4e2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4e2f('0x21')](function(_0x3638c9){logger[_0x4e2f('0xe')](_0x4e2f('0x18'),_0x162e07);logger['debug'](_0x4e2f('0x18'),_0x162e07,JSON['stringify'](_0x3638c9));_0x5d18ac(_0x3638c9);})['catch'](function(_0x3eb341){logger[_0x4e2f('0x13')](_0x4e2f('0x18'),_0x3eb341[_0x4e2f('0x15')],_0x162e07);_0x2733d6(_0xe9b750[_0x4e2f('0x13')](0x1f4,_0x3eb341['message']));});});};exports[_0x4e2f('0x22')]=function(_0x58a06b){var _0x762a5a=this;return new Promise(function(_0x433be4,_0x379686){return db['FaxQueue'][_0x4e2f('0x23')]({'raw':_0x58a06b[_0x4e2f('0x1a')]?_0x58a06b[_0x4e2f('0x1a')][_0x4e2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x58a06b[_0x4e2f('0x1a')]?_0x58a06b['options'][_0x4e2f('0x24')]||null:null,'attributes':_0x58a06b[_0x4e2f('0x1a')]?_0x58a06b[_0x4e2f('0x1a')][_0x4e2f('0x1c')]||null:null,'include':_0x58a06b[_0x4e2f('0x1a')]?_0x58a06b[_0x4e2f('0x1a')][_0x4e2f('0x1e')]?_[_0x4e2f('0x20')](_0x58a06b[_0x4e2f('0x1a')][_0x4e2f('0x1e')],function(_0x5697ef){return{'model':db[_0x5697ef['model']],'as':_0x5697ef['as'],'attributes':_0x5697ef[_0x4e2f('0x1c')],'include':_0x5697ef[_0x4e2f('0x1e')]?_[_0x4e2f('0x20')](_0x5697ef['include'],function(_0x47e8dc){return{'model':db[_0x47e8dc[_0x4e2f('0x1f')]],'as':_0x47e8dc['as'],'attributes':_0x47e8dc[_0x4e2f('0x1c')],'include':_0x47e8dc['include']?_['map'](_0x47e8dc[_0x4e2f('0x1e')],function(_0x5a554a){return{'model':db[_0x5a554a['model']],'as':_0x5a554a['as'],'attributes':_0x5a554a[_0x4e2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4e2f('0x21')](function(_0x5ba5b6){logger[_0x4e2f('0xe')](_0x4e2f('0x22'),_0x58a06b);logger['debug'](_0x4e2f('0x22'),_0x58a06b,JSON[_0x4e2f('0x25')](_0x5ba5b6));_0x433be4(_0x5ba5b6);})[_0x4e2f('0x17')](function(_0x1f5fb0){logger[_0x4e2f('0x13')](_0x4e2f('0x22'),_0x1f5fb0[_0x4e2f('0x15')],_0x58a06b);_0x379686(_0x762a5a[_0x4e2f('0x13')](0x1f4,_0x1f5fb0[_0x4e2f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ca6a7b9..9d24d2f 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 _0xa915=['length','faxQueue:','save','remove','update','emit','register'];(function(_0x3a6ac0,_0x1858bd){var _0x1e3adb=function(_0x95f1e8){while(--_0x95f1e8){_0x3a6ac0['push'](_0x3a6ac0['shift']());}};_0x1e3adb(++_0x1858bd);}(_0xa915,0x1d7));var _0x5a91=function(_0xd0dce5,_0x32178e){_0xd0dce5=_0xd0dce5-0x0;var _0x59d673=_0xa915[_0xd0dce5];return _0x59d673;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5a91('0x0'),_0x5a91('0x1'),_0x5a91('0x2')];function createListener(_0x57e822,_0x5153ad){return function(_0x1adb8d){_0x5153ad[_0x5a91('0x3')](_0x57e822,_0x1adb8d);};}function removeListener(_0x50caed,_0x401165){return function(){FaxQueueEvents['removeListener'](_0x50caed,_0x401165);};}exports[_0x5a91('0x4')]=function(_0x1db91b){for(var _0x3f1e25=0x0,_0x1bd28c=events[_0x5a91('0x5')];_0x3f1e25<_0x1bd28c;_0x3f1e25++){var _0x1da3cb=events[_0x3f1e25];var _0xedcee7=createListener(_0x5a91('0x6')+_0x1da3cb,_0x1db91b);FaxQueueEvents['on'](_0x1da3cb,_0xedcee7);}}; \ No newline at end of file +var _0xd4e5=['removeListener','register','length','faxQueue:','save','emit'];(function(_0x51705d,_0x27c14e){var _0x58291f=function(_0x56280b){while(--_0x56280b){_0x51705d['push'](_0x51705d['shift']());}};_0x58291f(++_0x27c14e);}(_0xd4e5,0x1ae));var _0x5d4e=function(_0x147010,_0x225eb4){_0x147010=_0x147010-0x0;var _0x5654a5=_0xd4e5[_0x147010];return _0x5654a5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5d4e('0x0'),'remove','update'];function createListener(_0x102f8d,_0x47e507){return function(_0x3bee1d){_0x47e507[_0x5d4e('0x1')](_0x102f8d,_0x3bee1d);};}function removeListener(_0x4d6829,_0x33a86f){return function(){FaxQueueEvents[_0x5d4e('0x2')](_0x4d6829,_0x33a86f);};}exports[_0x5d4e('0x3')]=function(_0x19c005){for(var _0x374a6b=0x0,_0x560826=events[_0x5d4e('0x4')];_0x374a6b<_0x560826;_0x374a6b++){var _0x95a0d9=events[_0x374a6b];var _0x4c3146=createListener(_0x5d4e('0x5')+_0x95a0d9,_0x19c005);FaxQueueEvents['on'](_0x95a0d9,_0x4c3146);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 450258a..a7fc165 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 _0xa498=['getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams'];(function(_0xf4e617,_0x22e5d0){var _0x9a19d0=function(_0x4934fa){while(--_0x4934fa){_0xf4e617['push'](_0xf4e617['shift']());}};_0x9a19d0(++_0x22e5d0);}(_0xa498,0x1d6));var _0x8a49=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0xa498[_0x134448];return _0x2d52a1;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8a49('0x2')]();var fs_extra=require(_0x8a49('0x3'));var auth=require(_0x8a49('0x4'));var interaction=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var controller=require('./faxQueue.controller');router[_0x8a49('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a49('0x8')]);router[_0x8a49('0x7')](_0x8a49('0x9'),auth['isAuthenticated'](),controller[_0x8a49('0xa')]);router[_0x8a49('0x7')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0xd')]);router[_0x8a49('0x7')]('/:id/members',auth[_0x8a49('0xc')](),controller[_0x8a49('0xe')]);router[_0x8a49('0x7')](_0x8a49('0xf'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x10')]);router[_0x8a49('0x7')](_0x8a49('0x11'),auth[_0x8a49('0xc')](),controller['getAgents']);router[_0x8a49('0x12')]('/',auth[_0x8a49('0xc')](),controller[_0x8a49('0x13')]);router['post'](_0x8a49('0xf'),auth['isAuthenticated'](),controller[_0x8a49('0x14')]);router[_0x8a49('0x12')]('/:id/users',auth[_0x8a49('0xc')](),controller[_0x8a49('0x15')]);router[_0x8a49('0x16')](_0x8a49('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8a49('0x17')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x18')]);router['delete'](_0x8a49('0xf'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x19')]);router[_0x8a49('0x17')](_0x8a49('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x8a49('0x1a')]=router; \ No newline at end of file +var _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x31a8a9,_0xb1c478){var _0x20a5d0=function(_0x100442){while(--_0x100442){_0x31a8a9['push'](_0x31a8a9['shift']());}};_0x20a5d0(++_0xb1c478);}(_0x3e24,0x167));var _0x43e2=function(_0x27618b,_0x114ccf){_0x27618b=_0x27618b-0x0;var _0x2d2987=_0x3e24[_0x27618b];return _0x2d2987;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['get'](_0x43e2('0xf'),auth[_0x43e2('0xa')](),controller['getMembers']);router[_0x43e2('0x9')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x43e2('0x9')](_0x43e2('0x10'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x11')]);router[_0x43e2('0x12')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0x13')]);router[_0x43e2('0x12')](_0x43e2('0x14'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x15')]);router[_0x43e2('0x12')]('/:id/users',auth[_0x43e2('0xa')](),controller[_0x43e2('0x16')]);router[_0x43e2('0x17')](_0x43e2('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x43e2('0x19')](_0x43e2('0x18'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x1a')]);router[_0x43e2('0x19')](_0x43e2('0x14'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x1b')]);router[_0x43e2('0x19')](_0x43e2('0x10'),auth['isAuthenticated'](),controller[_0x43e2('0x1c')]);module[_0x43e2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f8d15aa..aab1a91 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 _0xd25b=['DATE','moment','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd25b,0x7d));var _0xbd25=function(_0x4af2a4,_0x24c7af){_0x4af2a4=_0x4af2a4-0x0;var _0x16f2b8=_0xd25b[_0x4af2a4];return _0x16f2b8;};'use strict';var moment=require(_0xbd25('0x0'));var Sequelize=require('sequelize');module[_0xbd25('0x1')]={'uniqueid':{'type':Sequelize[_0xbd25('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbd25('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbd25('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfaf9=['STRING','DATE','moment','sequelize','exports'];(function(_0x4940cc,_0x59d4e9){var _0x40e974=function(_0x4aa8e3){while(--_0x4aa8e3){_0x4940cc['push'](_0x4940cc['shift']());}};_0x40e974(++_0x59d4e9);}(_0xfaf9,0x16f));var _0x9faf=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xfaf9[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0x9faf('0x0'));var Sequelize=require(_0x9faf('0x1'));module[_0x9faf('0x2')]={'uniqueid':{'type':Sequelize[_0x9faf('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9faf('0x4')]},'leaveAt':{'type':Sequelize[_0x9faf('0x4')]},'acceptAt':{'type':Sequelize[_0x9faf('0x4')]},'exitAt':{'type':Sequelize[_0x9faf('0x4')]},'reason':{'type':Sequelize[_0x9faf('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f8a0639..23a1964 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 _0xd624=['ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','FaxQueueReport','findAll','rows','catch','show','params','fields','length','include','options','create','body','find','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv'];(function(_0x537003,_0x5b1bcc){var _0x2c039d=function(_0x2eaac1){while(--_0x2eaac1){_0x537003['push'](_0x537003['shift']());}};_0x2c039d(++_0x5b1bcc);}(_0xd624,0x124));var _0x4d62=function(_0x1d52c1,_0x12f988){_0x1d52c1=_0x1d52c1-0x0;var _0x475ad6=_0xd624[_0x1d52c1];return _0x475ad6;};'use strict';var emlformat=require(_0x4d62('0x0'));var rimraf=require(_0x4d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d62('0x3'));var util=require(_0x4d62('0x4'));var path=require(_0x4d62('0x5'));var sox=require(_0x4d62('0x6'));var csv=require(_0x4d62('0x7'));var ejs=require(_0x4d62('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d62('0x9'));var crypto=require(_0x4d62('0xa'));var jsforce=require(_0x4d62('0xb'));var deskjs=require(_0x4d62('0xc'));var toCsv=require(_0x4d62('0x7'));var querystring=require('querystring');var Papa=require(_0x4d62('0xd'));var Redis=require(_0x4d62('0xe'));var authService=require(_0x4d62('0xf'));var qs=require(_0x4d62('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d62('0x11'));var logger=require(_0x4d62('0x12'))(_0x4d62('0x13'));var utils=require(_0x4d62('0x14'));var config=require(_0x4d62('0x15'));var licenseUtil=require(_0x4d62('0x16'));var db=require(_0x4d62('0x17'))['db'];function respondWithStatusCode(_0xc94193,_0x3d30a7){_0x3d30a7=_0x3d30a7||0xcc;return function(_0x282d79){if(_0x282d79){return _0xc94193[_0x4d62('0x18')](_0x3d30a7);}return _0xc94193[_0x4d62('0x19')](_0x3d30a7)['end']();};}function respondWithResult(_0x117c68,_0x409910){_0x409910=_0x409910||0xc8;return function(_0x1c6768){if(_0x1c6768){return _0x117c68['status'](_0x409910)[_0x4d62('0x1a')](_0x1c6768);}};}function respondWithFilteredResult(_0x1f3b54,_0x142396){return function(_0x5e2cee){if(_0x5e2cee){var _0x4974f4=typeof _0x142396[_0x4d62('0x1b')]===_0x4d62('0x1c')&&typeof _0x142396['limit']==='undefined';var _0x2e8602=_0x5e2cee[_0x4d62('0x1d')];var _0x54920b=_0x4974f4?0x0:_0x142396[_0x4d62('0x1b')];var _0x27ca77=_0x4974f4?_0x5e2cee[_0x4d62('0x1d')]:_0x142396[_0x4d62('0x1b')]+_0x142396[_0x4d62('0x1e')];var _0x45f78f;if(_0x27ca77>=_0x2e8602){_0x27ca77=_0x2e8602;_0x45f78f=0xc8;}else{_0x45f78f=0xce;}_0x1f3b54[_0x4d62('0x19')](_0x45f78f);return _0x1f3b54[_0x4d62('0x1f')](_0x4d62('0x20'),_0x54920b+'-'+_0x27ca77+'/'+_0x2e8602)[_0x4d62('0x1a')](_0x5e2cee);}return null;};}function patchUpdates(_0x494a8f){return function(_0x5d9e64){try{jsonpatch['apply'](_0x5d9e64,_0x494a8f,!![]);}catch(_0x435035){return BPromise[_0x4d62('0x21')](_0x435035);}return _0x5d9e64[_0x4d62('0x22')]();};}function saveUpdates(_0x5a0796,_0x3a5e4f){return function(_0x16fa3a){if(_0x16fa3a){return _0x16fa3a[_0x4d62('0x23')](_0x5a0796)['then'](function(_0x26c5e3){return _0x26c5e3;});}return null;};}function removeEntity(_0x30c443,_0x1a7ee9){return function(_0x57987b){if(_0x57987b){return _0x57987b[_0x4d62('0x24')]()[_0x4d62('0x25')](function(){_0x30c443['status'](0xcc)[_0x4d62('0x26')]();});}};}function handleEntityNotFound(_0x3b4eee,_0x2a09f9){return function(_0x414a9e){if(!_0x414a9e){_0x3b4eee[_0x4d62('0x18')](0x194);}return _0x414a9e;};}function handleError(_0x4e88cc,_0x5635a9){_0x5635a9=_0x5635a9||0x1f4;return function(_0x40c9c8){logger[_0x4d62('0x27')](_0x40c9c8[_0x4d62('0x28')]);if(_0x40c9c8[_0x4d62('0x29')]){delete _0x40c9c8['name'];}_0x4e88cc['status'](_0x5635a9)['send'](_0x40c9c8);};}exports[_0x4d62('0x2a')]=function(_0x566cce,_0x1b1f0c){var _0x2b76af={},_0x132181={},_0x50e6f0={'count':0x0,'rows':[]};var _0x2c450e=_['map'](db['FaxQueueReport'][_0x4d62('0x2b')],function(_0x5776d6){return{'name':_0x5776d6[_0x4d62('0x2c')],'type':_0x5776d6[_0x4d62('0x2d')][_0x4d62('0x2e')]};});_0x132181[_0x4d62('0x2f')]=_[_0x4d62('0x30')](_0x2c450e,_0x4d62('0x29'));_0x132181[_0x4d62('0x31')]=_[_0x4d62('0x32')](_0x566cce['query']);_0x132181[_0x4d62('0x33')]=_[_0x4d62('0x34')](_0x132181[_0x4d62('0x2f')],_0x132181['query']);_0x2b76af[_0x4d62('0x35')]=_['intersection'](_0x132181['model'],qs['fields'](_0x566cce[_0x4d62('0x31')]['fields']));_0x2b76af['attributes']=_0x2b76af['attributes']['length']?_0x2b76af[_0x4d62('0x35')]:_0x132181[_0x4d62('0x2f')];if(!_0x566cce[_0x4d62('0x31')][_0x4d62('0x36')](_0x4d62('0x37'))){_0x2b76af[_0x4d62('0x1e')]=qs[_0x4d62('0x1e')](_0x566cce[_0x4d62('0x31')][_0x4d62('0x1e')]);_0x2b76af['offset']=qs[_0x4d62('0x1b')](_0x566cce['query']['offset']);}_0x2b76af['order']=qs[_0x4d62('0x38')](_0x566cce[_0x4d62('0x31')][_0x4d62('0x38')]);_0x2b76af[_0x4d62('0x39')]=qs[_0x4d62('0x33')](_[_0x4d62('0x3a')](_0x566cce['query'],_0x132181[_0x4d62('0x33')]),_0x2c450e);if(_0x566cce['query'][_0x4d62('0x3b')]){_0x2b76af[_0x4d62('0x39')]=_[_0x4d62('0x3c')](_0x2b76af[_0x4d62('0x39')],{'$or':_['map'](_0x2c450e,function(_0x31f261){if(_0x31f261[_0x4d62('0x2d')]!=='VIRTUAL'){var _0x4fea95={};_0x4fea95[_0x31f261[_0x4d62('0x29')]]={'$like':'%'+_0x566cce[_0x4d62('0x31')][_0x4d62('0x3b')]+'%'};return _0x4fea95;}})});}_0x2b76af=_['merge']({},_0x2b76af,_0x566cce['options']);var _0x577b45={'where':_0x2b76af['where']};return db['FaxQueueReport']['count'](_0x577b45)[_0x4d62('0x25')](function(_0x3cfd3e){_0x50e6f0[_0x4d62('0x1d')]=_0x3cfd3e;if(_0x566cce[_0x4d62('0x31')][_0x4d62('0x3d')]){_0x2b76af['include']=[{'all':!![]}];}return db[_0x4d62('0x3e')][_0x4d62('0x3f')](_0x2b76af);})['then'](function(_0x178d83){_0x50e6f0[_0x4d62('0x40')]=_0x178d83;return _0x50e6f0;})[_0x4d62('0x25')](respondWithFilteredResult(_0x1b1f0c,_0x2b76af))[_0x4d62('0x41')](handleError(_0x1b1f0c,null));};exports[_0x4d62('0x42')]=function(_0x218017,_0x560d83){var _0x1873a2={'raw':!![],'where':{'id':_0x218017[_0x4d62('0x43')]['id']}},_0x570d11={};_0x570d11[_0x4d62('0x2f')]=_['keys'](db[_0x4d62('0x3e')]['rawAttributes']);_0x570d11[_0x4d62('0x31')]=_[_0x4d62('0x32')](_0x218017[_0x4d62('0x31')]);_0x570d11[_0x4d62('0x33')]=_[_0x4d62('0x34')](_0x570d11['model'],_0x570d11[_0x4d62('0x31')]);_0x1873a2[_0x4d62('0x35')]=_[_0x4d62('0x34')](_0x570d11[_0x4d62('0x2f')],qs[_0x4d62('0x44')](_0x218017[_0x4d62('0x31')][_0x4d62('0x44')]));_0x1873a2[_0x4d62('0x35')]=_0x1873a2[_0x4d62('0x35')][_0x4d62('0x45')]?_0x1873a2[_0x4d62('0x35')]:_0x570d11['model'];if(_0x218017['query'][_0x4d62('0x3d')]){_0x1873a2[_0x4d62('0x46')]=[{'all':!![]}];}_0x1873a2=_[_0x4d62('0x3c')]({},_0x1873a2,_0x218017[_0x4d62('0x47')]);return db[_0x4d62('0x3e')]['find'](_0x1873a2)['then'](handleEntityNotFound(_0x560d83,null))[_0x4d62('0x25')](respondWithResult(_0x560d83,null))[_0x4d62('0x41')](handleError(_0x560d83,null));};exports[_0x4d62('0x48')]=function(_0x388a02,_0x3a8c7e){return db['FaxQueueReport']['create'](_0x388a02[_0x4d62('0x49')],{})['then'](respondWithResult(_0x3a8c7e,0xc9))[_0x4d62('0x41')](handleError(_0x3a8c7e,null));};exports[_0x4d62('0x23')]=function(_0x230798,_0x485fe2){if(_0x230798[_0x4d62('0x49')]['id']){delete _0x230798[_0x4d62('0x49')]['id'];}return db[_0x4d62('0x3e')][_0x4d62('0x4a')]({'where':{'id':_0x230798[_0x4d62('0x43')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x485fe2,null))[_0x4d62('0x25')](saveUpdates(_0x230798[_0x4d62('0x49')],null))[_0x4d62('0x25')](respondWithResult(_0x485fe2,null))[_0x4d62('0x41')](handleError(_0x485fe2,null));};exports[_0x4d62('0x24')]=function(_0x51adc7,_0x1df6a5){return db[_0x4d62('0x3e')][_0x4d62('0x4a')]({'where':{'id':_0x51adc7['params']['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x1df6a5,null))[_0x4d62('0x25')](removeEntity(_0x1df6a5,null))[_0x4d62('0x41')](handleError(_0x1df6a5,null));};exports['describe']=function(_0x4fa78d,_0x412388){return db[_0x4d62('0x3e')]['describe']()['then'](respondWithResult(_0x412388,null))[_0x4d62('0x41')](handleError(_0x412388,null));}; \ No newline at end of file +var _0xa1b9=['update','then','destroy','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save'];(function(_0x203bdc,_0x8570f5){var _0x5d9245=function(_0x335a5d){while(--_0x335a5d){_0x203bdc['push'](_0x203bdc['shift']());}};_0x5d9245(++_0x8570f5);}(_0xa1b9,0x71));var _0x9a1b=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xa1b9[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){_0x37971c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0ff3,_0x52fce9){return function(_0x17704b){if(!_0x17704b){_0x3b0ff3['sendStatus'](0x194);}return _0x17704b;};}function handleError(_0x5e65ce,_0x48e736){_0x48e736=_0x48e736||0x1f4;return function(_0x432a3d){logger['error'](_0x432a3d[_0x9a1b('0x28')]);if(_0x432a3d[_0x9a1b('0x29')]){delete _0x432a3d[_0x9a1b('0x29')];}_0x5e65ce[_0x9a1b('0x1b')](_0x48e736)[_0x9a1b('0x2a')](_0x432a3d);};}exports[_0x9a1b('0x2b')]=function(_0x1c13d6,_0x1453c4){var _0x4070aa={},_0x2d9ca8={},_0x56f3e8={'count':0x0,'rows':[]};var _0x5735a4=_[_0x9a1b('0x2c')](db[_0x9a1b('0x2d')]['rawAttributes'],function(_0x14ea6b){return{'name':_0x14ea6b[_0x9a1b('0x2e')],'type':_0x14ea6b[_0x9a1b('0x2f')][_0x9a1b('0x30')]};});_0x2d9ca8[_0x9a1b('0x31')]=_[_0x9a1b('0x2c')](_0x5735a4,_0x9a1b('0x29'));_0x2d9ca8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x1c13d6['query']);_0x2d9ca8[_0x9a1b('0x34')]=_['intersection'](_0x2d9ca8[_0x9a1b('0x31')],_0x2d9ca8[_0x9a1b('0x32')]);_0x4070aa[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x2d9ca8['model'],qs[_0x9a1b('0x37')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x37')]));_0x4070aa[_0x9a1b('0x35')]=_0x4070aa[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x4070aa[_0x9a1b('0x35')]:_0x2d9ca8[_0x9a1b('0x31')];if(!_0x1c13d6[_0x9a1b('0x32')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x4070aa[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x1f')]);_0x4070aa[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x1c13d6['query'][_0x9a1b('0x21')]);}_0x4070aa[_0x9a1b('0x3a')]=qs[_0x9a1b('0x3b')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3b')]);_0x4070aa[_0x9a1b('0x3c')]=qs[_0x9a1b('0x34')](_[_0x9a1b('0x3d')](_0x1c13d6[_0x9a1b('0x32')],_0x2d9ca8['filters']),_0x5735a4);if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]){_0x4070aa['where']=_[_0x9a1b('0x3f')](_0x4070aa[_0x9a1b('0x3c')],{'$or':_['map'](_0x5735a4,function(_0x47bf8e){if(_0x47bf8e['type']!==_0x9a1b('0x40')){var _0x2adbb9={};_0x2adbb9[_0x47bf8e[_0x9a1b('0x29')]]={'$like':'%'+_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]+'%'};return _0x2adbb9;}})});}_0x4070aa=_['merge']({},_0x4070aa,_0x1c13d6[_0x9a1b('0x41')]);var _0xfa7f44={'where':_0x4070aa[_0x9a1b('0x3c')]};return db[_0x9a1b('0x2d')][_0x9a1b('0x20')](_0xfa7f44)[_0x9a1b('0x26')](function(_0x2faeeb){_0x56f3e8['count']=_0x2faeeb;if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x42')]){_0x4070aa['include']=[{'all':!![]}];}return db[_0x9a1b('0x2d')][_0x9a1b('0x43')](_0x4070aa);})[_0x9a1b('0x26')](function(_0x69c499){_0x56f3e8['rows']=_0x69c499;return _0x56f3e8;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x1453c4,_0x4070aa))[_0x9a1b('0x44')](handleError(_0x1453c4,null));};exports[_0x9a1b('0x45')]=function(_0x3ddcf6,_0x1863d8){var _0x18a606={'raw':!![],'where':{'id':_0x3ddcf6[_0x9a1b('0x46')]['id']}},_0x515bb8={};_0x515bb8[_0x9a1b('0x31')]=_[_0x9a1b('0x33')](db['FaxQueueReport'][_0x9a1b('0x47')]);_0x515bb8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x3ddcf6[_0x9a1b('0x32')]);_0x515bb8[_0x9a1b('0x34')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],_0x515bb8['query']);_0x18a606[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],qs[_0x9a1b('0x37')](_0x3ddcf6['query'][_0x9a1b('0x37')]));_0x18a606[_0x9a1b('0x35')]=_0x18a606[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x18a606[_0x9a1b('0x35')]:_0x515bb8[_0x9a1b('0x31')];if(_0x3ddcf6[_0x9a1b('0x32')]['includeAll']){_0x18a606['include']=[{'all':!![]}];}_0x18a606=_[_0x9a1b('0x3f')]({},_0x18a606,_0x3ddcf6[_0x9a1b('0x41')]);return db['FaxQueueReport'][_0x9a1b('0x48')](_0x18a606)[_0x9a1b('0x26')](handleEntityNotFound(_0x1863d8,null))[_0x9a1b('0x26')](respondWithResult(_0x1863d8,null))['catch'](handleError(_0x1863d8,null));};exports['create']=function(_0x4a98c1,_0x31b879){return db[_0x9a1b('0x2d')]['create'](_0x4a98c1[_0x9a1b('0x49')],{})[_0x9a1b('0x26')](respondWithResult(_0x31b879,0xc9))['catch'](handleError(_0x31b879,null));};exports['update']=function(_0x23e3b8,_0x2ff4b5){if(_0x23e3b8['body']['id']){delete _0x23e3b8[_0x9a1b('0x49')]['id'];}return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x23e3b8[_0x9a1b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ff4b5,null))['then'](saveUpdates(_0x23e3b8['body'],null))[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,null))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x27')]=function(_0x3f9c17,_0x1a608a){return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x3f9c17[_0x9a1b('0x46')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x1a608a,null))[_0x9a1b('0x26')](removeEntity(_0x1a608a,null))[_0x9a1b('0x44')](handleError(_0x1a608a,null));};exports[_0x9a1b('0x4a')]=function(_0x719389,_0x2bc22a){return db['FaxQueueReport']['describe']()[_0x9a1b('0x26')](respondWithResult(_0x2bc22a,null))[_0x9a1b('0x44')](handleError(_0x2bc22a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a2b6d73..8846d97 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36c7d0,_0x10a7e7){var _0x24c064=function(_0x5632b2){while(--_0x5632b2){_0x36c7d0['push'](_0x36c7d0['shift']());}};_0x24c064(++_0x10a7e7);}(_0x4975,0x86));var _0x5497=function(_0x1faabc,_0x11e15c){_0x1faabc=_0x1faabc-0x0;var _0x5e40c4=_0x4975[_0x1faabc];return _0x5e40c4;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x114dbf,_0x3dd101){var _0x5953c9=function(_0x39aeb0){while(--_0x39aeb0){_0x114dbf['push'](_0x114dbf['shift']());}};_0x5953c9(++_0x3dd101);}(_0x7217,0x19e));var _0x7721=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7217[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('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 592ddc7..4f2c4e7 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 _0x976a=['result','FaxQueueReport','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1f8c46,_0xd59a73){var _0x2db71a=function(_0xa925bc){while(--_0xa925bc){_0x1f8c46['push'](_0x1f8c46['shift']());}};_0x2db71a(++_0xd59a73);}(_0x976a,0xcc));var _0xa976=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x976a[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa976('0x0'));var BPromise=require(_0xa976('0x1'));var rs=require(_0xa976('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa976('0x3'))['db'];var utils=require(_0xa976('0x4'));var logger=require(_0xa976('0x5'))('rpc');var config=require(_0xa976('0x6'));var jayson=require(_0xa976('0x7'));var client=jayson[_0xa976('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f48cd,_0x2d3e65,_0x3f913a){return new BPromise(function(_0x1dcf84,_0xbadf79){return client[_0xa976('0x9')](_0x6f48cd,_0x3f913a)[_0xa976('0xa')](function(_0x4ff198){logger[_0xa976('0xb')](_0xa976('0xc'),_0x2d3e65,_0xa976('0xd'));logger[_0xa976('0xe')](_0xa976('0xf'),_0x2d3e65,'request\x20sent',JSON[_0xa976('0x10')](_0x4ff198));if(_0x4ff198['error']){if(_0x4ff198['error'][_0xa976('0x11')]===0x1f4){logger[_0xa976('0x12')](_0xa976('0xc'),_0x2d3e65,_0x4ff198[_0xa976('0x12')][_0xa976('0x13')]);return _0xbadf79(_0x4ff198[_0xa976('0x12')]['message']);}logger[_0xa976('0x12')](_0xa976('0xc'),_0x2d3e65,_0x4ff198['error'][_0xa976('0x13')]);return _0x1dcf84(_0x4ff198['error'][_0xa976('0x13')]);}else{logger['info'](_0xa976('0xc'),_0x2d3e65,_0xa976('0xd'));_0x1dcf84(_0x4ff198[_0xa976('0x14')][_0xa976('0x13')]);}})['catch'](function(_0x49895e){logger[_0xa976('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2d3e65,_0x49895e);_0xbadf79(_0x49895e);});});}exports['CreateFaxQueueReport']=function(_0x1eb2a9){var _0x1d71b4=this;return new Promise(function(_0x5b3ef2,_0x2e01ed){return db[_0xa976('0x15')]['create'](_0x1eb2a9['body'],{'raw':_0x1eb2a9[_0xa976('0x16')]?_0x1eb2a9[_0xa976('0x16')][_0xa976('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x33a403){logger[_0xa976('0xb')](_0xa976('0x18'),_0x1eb2a9);logger[_0xa976('0xe')](_0xa976('0x18'),_0x1eb2a9,JSON[_0xa976('0x10')](_0x33a403));_0x5b3ef2(_0x33a403);})[_0xa976('0x19')](function(_0x57f73f){logger[_0xa976('0x12')](_0xa976('0x18'),_0x57f73f['message'],_0x1eb2a9);_0x2e01ed(_0x1d71b4[_0xa976('0x12')](0x1f4,_0x57f73f['message']));});});};exports[_0xa976('0x1a')]=function(_0x371a9f){var _0x4b62bb=this;return new Promise(function(_0x401afe,_0x2ccdbd){return db['FaxQueueReport'][_0xa976('0x1b')](_0x371a9f[_0xa976('0x1c')],{'raw':_0x371a9f[_0xa976('0x16')]?_0x371a9f[_0xa976('0x16')][_0xa976('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x371a9f[_0xa976('0x16')]?_0x371a9f['options'][_0xa976('0x1d')]||null:null,'attributes':_0x371a9f['options']?_0x371a9f['options'][_0xa976('0x1e')]||null:null,'limit':_0x371a9f[_0xa976('0x16')]?_0x371a9f[_0xa976('0x16')][_0xa976('0x1f')]||null:null})[_0xa976('0xa')](function(_0x341bc3){logger[_0xa976('0xb')](_0xa976('0x1a'),_0x371a9f);logger[_0xa976('0xe')](_0xa976('0x1a'),_0x371a9f,JSON[_0xa976('0x10')](_0x341bc3));_0x401afe(_0x341bc3);})['catch'](function(_0x3121e9){logger[_0xa976('0x12')]('UpdateFaxQueueReport',_0x3121e9[_0xa976('0x13')],_0x371a9f);_0x2ccdbd(_0x4b62bb['error'](0x1f4,_0x3121e9[_0xa976('0x13')]));});});}; \ No newline at end of file +var _0x9165=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','CreateFaxQueueReport','create','body','options','raw','then','catch','FaxQueueReport','where','UpdateFaxQueueReport','util','bluebird','randomstring','ioredis'];(function(_0xd9616,_0x2e2fc6){var _0x2cffeb=function(_0x34c8d9){while(--_0x34c8d9){_0xd9616['push'](_0xd9616['shift']());}};_0x2cffeb(++_0x2e2fc6);}(_0x9165,0x101));var _0x5916=function(_0x41af7e,_0x240917){_0x41af7e=_0x41af7e-0x0;var _0x469fd5=_0x9165[_0x41af7e];return _0x469fd5;};'use strict';var _=require('lodash');var util=require(_0x5916('0x0'));var moment=require('moment');var BPromise=require(_0x5916('0x1'));var rs=require(_0x5916('0x2'));var fs=require('fs');var Redis=require(_0x5916('0x3'));var db=require(_0x5916('0x4'))['db'];var utils=require(_0x5916('0x5'));var logger=require(_0x5916('0x6'))(_0x5916('0x7'));var config=require(_0x5916('0x8'));var jayson=require(_0x5916('0x9'));var client=jayson['client'][_0x5916('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22a480,_0x425756,_0x3f67e4){return new BPromise(function(_0x5bc61e,_0x538922){return client['request'](_0x22a480,_0x3f67e4)['then'](function(_0x5e04a4){logger['info'](_0x5916('0xb'),_0x425756,_0x5916('0xc'));logger[_0x5916('0xd')](_0x5916('0xe'),_0x425756,'request\x20sent',JSON[_0x5916('0xf')](_0x5e04a4));if(_0x5e04a4[_0x5916('0x10')]){if(_0x5e04a4['error']['code']===0x1f4){logger[_0x5916('0x10')](_0x5916('0xb'),_0x425756,_0x5e04a4['error'][_0x5916('0x11')]);return _0x538922(_0x5e04a4[_0x5916('0x10')][_0x5916('0x11')]);}logger['error'](_0x5916('0xb'),_0x425756,_0x5e04a4[_0x5916('0x10')][_0x5916('0x11')]);return _0x5bc61e(_0x5e04a4[_0x5916('0x10')][_0x5916('0x11')]);}else{logger[_0x5916('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x425756,_0x5916('0xc'));_0x5bc61e(_0x5e04a4['result'][_0x5916('0x11')]);}})['catch'](function(_0x56458f){logger[_0x5916('0x10')](_0x5916('0xb'),_0x425756,_0x56458f);_0x538922(_0x56458f);});});}exports[_0x5916('0x13')]=function(_0xa01d8b){var _0x19b08e=this;return new Promise(function(_0x1f88e1,_0x185da1){return db['FaxQueueReport'][_0x5916('0x14')](_0xa01d8b[_0x5916('0x15')],{'raw':_0xa01d8b[_0x5916('0x16')]?_0xa01d8b['options'][_0x5916('0x17')]===undefined?!![]:![]:!![]})[_0x5916('0x18')](function(_0xe8dd05){logger[_0x5916('0x12')](_0x5916('0x13'),_0xa01d8b);logger['debug']('CreateFaxQueueReport',_0xa01d8b,JSON[_0x5916('0xf')](_0xe8dd05));_0x1f88e1(_0xe8dd05);})[_0x5916('0x19')](function(_0x143547){logger[_0x5916('0x10')](_0x5916('0x13'),_0x143547['message'],_0xa01d8b);_0x185da1(_0x19b08e[_0x5916('0x10')](0x1f4,_0x143547[_0x5916('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x17e452){var _0x250de2=this;return new Promise(function(_0x2665f2,_0xef3207){return db[_0x5916('0x1a')]['update'](_0x17e452[_0x5916('0x15')],{'raw':_0x17e452[_0x5916('0x16')]?_0x17e452[_0x5916('0x16')][_0x5916('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e452[_0x5916('0x16')]?_0x17e452['options'][_0x5916('0x1b')]||null:null,'attributes':_0x17e452['options']?_0x17e452[_0x5916('0x16')]['attributes']||null:null,'limit':_0x17e452['options']?_0x17e452[_0x5916('0x16')]['limit']||null:null})['then'](function(_0x2b56a2){logger['info'](_0x5916('0x1c'),_0x17e452);logger[_0x5916('0xd')]('UpdateFaxQueueReport',_0x17e452,JSON[_0x5916('0xf')](_0x2b56a2));_0x2665f2(_0x2b56a2);})[_0x5916('0x19')](function(_0x2c58fe){logger[_0x5916('0x10')]('UpdateFaxQueueReport',_0x2c58fe['message'],_0x17e452);_0xef3207(_0x250de2[_0x5916('0x10')](0x1f4,_0x2c58fe[_0x5916('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a90ab02..c5b02c9 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 _0x55ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','destroy','exports','multer','util','path'];(function(_0x255383,_0x22ec13){var _0x36ef78=function(_0x53222c){while(--_0x53222c){_0x255383['push'](_0x255383['shift']());}};_0x36ef78(++_0x22ec13);}(_0x55ec,0x11a));var _0xc55e=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x55ec[_0x12bcf7];return _0x2825a;};'use strict';var multer=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var path=require(_0xc55e('0x2'));var timeout=require(_0xc55e('0x3'));var express=require(_0xc55e('0x4'));var router=express[_0xc55e('0x5')]();var fs_extra=require(_0xc55e('0x6'));var auth=require(_0xc55e('0x7'));var interaction=require(_0xc55e('0x8'));var config=require('../../config/environment');var controller=require(_0xc55e('0x9'));router[_0xc55e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc55e('0xa')](_0xc55e('0xb'),auth[_0xc55e('0xc')](),controller[_0xc55e('0xd')]);router[_0xc55e('0xa')](_0xc55e('0xe'),auth[_0xc55e('0xc')](),controller[_0xc55e('0xf')]);router['post']('/',auth[_0xc55e('0xc')](),controller[_0xc55e('0x10')]);router['put'](_0xc55e('0xe'),auth[_0xc55e('0xc')](),controller['update']);router['delete'](_0xc55e('0xe'),auth['isAuthenticated'](),controller[_0xc55e('0x11')]);module[_0xc55e('0x12')]=router; \ No newline at end of file +var _0x01c9=['path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','post','put','update','delete','/:id','destroy','exports','util'];(function(_0xc2f5b6,_0x29310f){var _0x2e2207=function(_0x2dd635){while(--_0x2dd635){_0xc2f5b6['push'](_0xc2f5b6['shift']());}};_0x2e2207(++_0x29310f);}(_0x01c9,0xff));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x901c('0x0'));var path=require(_0x901c('0x1'));var timeout=require(_0x901c('0x2'));var express=require(_0x901c('0x3'));var router=express[_0x901c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x901c('0x5'));var controller=require('./faxQueueReport.controller');router[_0x901c('0x6')]('/',auth[_0x901c('0x7')](),controller[_0x901c('0x8')]);router[_0x901c('0x6')]('/describe',auth[_0x901c('0x7')](),controller['describe']);router[_0x901c('0x6')]('/:id',auth[_0x901c('0x7')](),controller['show']);router[_0x901c('0x9')]('/',auth[_0x901c('0x7')](),controller['create']);router[_0x901c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x901c('0xb')]);router[_0x901c('0xc')](_0x901c('0xd'),auth[_0x901c('0x7')](),controller[_0x901c('0xe')]);module[_0x901c('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4268733..87a8133 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4ed786,_0x74f270){var _0x2f0243=function(_0x5642f5){while(--_0x5642f5){_0x4ed786['push'](_0x4ed786['shift']());}};_0x2f0243(++_0x74f270);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0xaa88[_0x1a1b6e];return _0x571e2c;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xc09b83,_0x4a8f7c){var _0x986879=function(_0x55f96f){while(--_0x55f96f){_0xc09b83['push'](_0xc09b83['shift']());}};_0x986879(++_0x4a8f7c);}(_0x54ef,0x112));var _0xf54e=function(_0x174b31,_0x23fbd6){_0x174b31=_0x174b31-0x0;var _0xb42c5a=_0x54ef[_0x174b31];return _0xb42c5a;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e848b2a..6346e5d 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 _0x53e8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs'];(function(_0x3ae349,_0x4c4b64){var _0x4e534c=function(_0x500624){while(--_0x500624){_0x3ae349['push'](_0x3ae349['shift']());}};_0x4e534c(++_0x4c4b64);}(_0x53e8,0x12f));var _0x853e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x53e8[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x853e('0x0'));var rimraf=require(_0x853e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x853e('0x2'));var moment=require(_0x853e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x853e('0x4'));var util=require(_0x853e('0x5'));var path=require(_0x853e('0x6'));var sox=require('sox');var csv=require(_0x853e('0x7'));var ejs=require(_0x853e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x853e('0x9'));var squel=require(_0x853e('0xa'));var crypto=require('crypto');var jsforce=require(_0x853e('0xb'));var deskjs=require(_0x853e('0xc'));var toCsv=require(_0x853e('0x7'));var querystring=require(_0x853e('0xd'));var Papa=require(_0x853e('0xe'));var Redis=require(_0x853e('0xf'));var authService=require(_0x853e('0x10'));var qs=require(_0x853e('0x11'));var as=require(_0x853e('0x12'));var hardwareService=require(_0x853e('0x13'));var logger=require(_0x853e('0x14'))(_0x853e('0x15'));var utils=require(_0x853e('0x16'));var config=require(_0x853e('0x17'));var licenseUtil=require(_0x853e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a82c6,_0x1508bd){_0x1508bd=_0x1508bd||0xcc;return function(_0x589a94){if(_0x589a94){return _0x2a82c6['sendStatus'](_0x1508bd);}return _0x2a82c6[_0x853e('0x19')](_0x1508bd)[_0x853e('0x1a')]();};}function respondWithResult(_0xe20d7d,_0x2f5c14){_0x2f5c14=_0x2f5c14||0xc8;return function(_0x5d941e){if(_0x5d941e){return _0xe20d7d[_0x853e('0x19')](_0x2f5c14)[_0x853e('0x1b')](_0x5d941e);}};}function respondWithFilteredResult(_0x8cf530,_0x37af89){return function(_0x152270){if(_0x152270){var _0x354d92=typeof _0x37af89['offset']===_0x853e('0x1c')&&typeof _0x37af89[_0x853e('0x1d')]===_0x853e('0x1c');var _0xa9eb94=_0x152270['count'];var _0x31261e=_0x354d92?0x0:_0x37af89[_0x853e('0x1e')];var _0x118553=_0x354d92?_0x152270['count']:_0x37af89['offset']+_0x37af89[_0x853e('0x1d')];var _0x1db212;if(_0x118553>=_0xa9eb94){_0x118553=_0xa9eb94;_0x1db212=0xc8;}else{_0x1db212=0xce;}_0x8cf530[_0x853e('0x19')](_0x1db212);return _0x8cf530[_0x853e('0x1f')](_0x853e('0x20'),_0x31261e+'-'+_0x118553+'/'+_0xa9eb94)['json'](_0x152270);}return null;};}function patchUpdates(_0x55a26c){return function(_0xc15a54){try{jsonpatch[_0x853e('0x21')](_0xc15a54,_0x55a26c,!![]);}catch(_0x4f2e71){return BPromise[_0x853e('0x22')](_0x4f2e71);}return _0xc15a54[_0x853e('0x23')]();};}function saveUpdates(_0x5d468d,_0x4e7971){return function(_0x47618c){if(_0x47618c){return _0x47618c[_0x853e('0x24')](_0x5d468d)[_0x853e('0x25')](function(_0x364a8f){return _0x364a8f;});}return null;};}function removeEntity(_0x3c00f8,_0x5771e7){return function(_0x505506){if(_0x505506){return _0x505506[_0x853e('0x26')]()[_0x853e('0x25')](function(){_0x3c00f8[_0x853e('0x19')](0xcc)[_0x853e('0x1a')]();});}};}function handleEntityNotFound(_0x1a29e8,_0x30daeb){return function(_0x3c9eb3){if(!_0x3c9eb3){_0x1a29e8[_0x853e('0x27')](0x194);}return _0x3c9eb3;};}function handleError(_0x52deae,_0x216410){_0x216410=_0x216410||0x1f4;return function(_0x3d62ce){logger[_0x853e('0x28')](_0x3d62ce[_0x853e('0x29')]);if(_0x3d62ce[_0x853e('0x2a')]){delete _0x3d62ce[_0x853e('0x2a')];}_0x52deae[_0x853e('0x19')](_0x216410)[_0x853e('0x2b')](_0x3d62ce);};}exports[_0x853e('0x2c')]=function(_0x4c3ff8,_0x1f96e6){var _0x1456ac={},_0x33ac41={},_0x1ef7cd={'count':0x0,'rows':[]};var _0x59a4aa=_[_0x853e('0x2d')](db[_0x853e('0x2e')]['rawAttributes'],function(_0x3c7262){return{'name':_0x3c7262['fieldName'],'type':_0x3c7262[_0x853e('0x2f')]['key']};});_0x33ac41[_0x853e('0x30')]=_[_0x853e('0x2d')](_0x59a4aa,_0x853e('0x2a'));_0x33ac41[_0x853e('0x31')]=_[_0x853e('0x32')](_0x4c3ff8['query']);_0x33ac41[_0x853e('0x33')]=_[_0x853e('0x34')](_0x33ac41[_0x853e('0x30')],_0x33ac41['query']);_0x1456ac['attributes']=_['intersection'](_0x33ac41['model'],qs[_0x853e('0x35')](_0x4c3ff8['query'][_0x853e('0x35')]));_0x1456ac['attributes']=_0x1456ac['attributes'][_0x853e('0x36')]?_0x1456ac[_0x853e('0x37')]:_0x33ac41[_0x853e('0x30')];if(!_0x4c3ff8[_0x853e('0x31')][_0x853e('0x38')](_0x853e('0x39'))){_0x1456ac[_0x853e('0x1d')]=qs[_0x853e('0x1d')](_0x4c3ff8['query']['limit']);_0x1456ac[_0x853e('0x1e')]=qs[_0x853e('0x1e')](_0x4c3ff8[_0x853e('0x31')][_0x853e('0x1e')]);}_0x1456ac[_0x853e('0x3a')]=qs[_0x853e('0x3b')](_0x4c3ff8['query'][_0x853e('0x3b')]);_0x1456ac[_0x853e('0x3c')]=qs[_0x853e('0x33')](_[_0x853e('0x3d')](_0x4c3ff8['query'],_0x33ac41[_0x853e('0x33')]),_0x59a4aa);if(_0x4c3ff8['query'][_0x853e('0x3e')]){_0x1456ac[_0x853e('0x3c')]=_[_0x853e('0x3f')](_0x1456ac[_0x853e('0x3c')],{'$or':_['map'](_0x59a4aa,function(_0x1aa2f3){if(_0x1aa2f3['type']!==_0x853e('0x40')){var _0x2b2d0f={};_0x2b2d0f[_0x1aa2f3[_0x853e('0x2a')]]={'$like':'%'+_0x4c3ff8['query'][_0x853e('0x3e')]+'%'};return _0x2b2d0f;}})});}_0x1456ac=_[_0x853e('0x3f')]({},_0x1456ac,_0x4c3ff8[_0x853e('0x41')]);var _0x21ad27={'where':_0x1456ac[_0x853e('0x3c')]};return db[_0x853e('0x2e')][_0x853e('0x42')](_0x21ad27)[_0x853e('0x25')](function(_0xdaf8d5){_0x1ef7cd[_0x853e('0x42')]=_0xdaf8d5;if(_0x4c3ff8['query']['includeAll']){_0x1456ac[_0x853e('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x853e('0x44')](_0x1456ac);})[_0x853e('0x25')](function(_0x51d19e){_0x1ef7cd[_0x853e('0x45')]=_0x51d19e;return _0x1ef7cd;})['then'](respondWithFilteredResult(_0x1f96e6,_0x1456ac))['catch'](handleError(_0x1f96e6,null));};exports[_0x853e('0x46')]=function(_0x58999b,_0x39816b){var _0x30c0ca={'raw':!![],'where':{'id':_0x58999b[_0x853e('0x47')]['id']}},_0x51aa25={};_0x51aa25[_0x853e('0x30')]=_[_0x853e('0x32')](db[_0x853e('0x2e')][_0x853e('0x48')]);_0x51aa25['query']=_[_0x853e('0x32')](_0x58999b['query']);_0x51aa25[_0x853e('0x33')]=_[_0x853e('0x34')](_0x51aa25[_0x853e('0x30')],_0x51aa25[_0x853e('0x31')]);_0x30c0ca[_0x853e('0x37')]=_['intersection'](_0x51aa25[_0x853e('0x30')],qs['fields'](_0x58999b[_0x853e('0x31')][_0x853e('0x35')]));_0x30c0ca[_0x853e('0x37')]=_0x30c0ca[_0x853e('0x37')][_0x853e('0x36')]?_0x30c0ca['attributes']:_0x51aa25[_0x853e('0x30')];if(_0x58999b[_0x853e('0x31')][_0x853e('0x49')]){_0x30c0ca[_0x853e('0x43')]=[{'all':!![]}];}_0x30c0ca=_['merge']({},_0x30c0ca,_0x58999b[_0x853e('0x41')]);return db[_0x853e('0x2e')]['find'](_0x30c0ca)[_0x853e('0x25')](handleEntityNotFound(_0x39816b,null))[_0x853e('0x25')](respondWithResult(_0x39816b,null))[_0x853e('0x4a')](handleError(_0x39816b,null));};exports[_0x853e('0x4b')]=function(_0x56fadb,_0x56ba5b){return db[_0x853e('0x2e')][_0x853e('0x4b')](_0x56fadb['body'],{})[_0x853e('0x25')](respondWithResult(_0x56ba5b,0xc9))['catch'](handleError(_0x56ba5b,null));};exports['update']=function(_0x6d772e,_0x21d5c6){if(_0x6d772e[_0x853e('0x4c')]['id']){delete _0x6d772e[_0x853e('0x4c')]['id'];}return db[_0x853e('0x2e')]['find']({'where':{'id':_0x6d772e[_0x853e('0x47')]['id']}})['then'](handleEntityNotFound(_0x21d5c6,null))[_0x853e('0x25')](saveUpdates(_0x6d772e['body'],null))[_0x853e('0x25')](respondWithResult(_0x21d5c6,null))[_0x853e('0x4a')](handleError(_0x21d5c6,null));};exports[_0x853e('0x26')]=function(_0x57bac8,_0x38319b){return db[_0x853e('0x2e')]['find']({'where':{'id':_0x57bac8[_0x853e('0x47')]['id']}})[_0x853e('0x25')](handleEntityNotFound(_0x38319b,null))['then'](removeEntity(_0x38319b,null))['catch'](handleError(_0x38319b,null));};exports[_0x853e('0x4d')]=function(_0x4eae61,_0x1dd9c1){return db[_0x853e('0x2e')][_0x853e('0x4d')]()[_0x853e('0x25')](respondWithResult(_0x1dd9c1,null))[_0x853e('0x4a')](handleError(_0x1dd9c1,null));}; \ No newline at end of file +var _0xd810=['error','stack','name','index','map','FaxTransferReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x1ddcb7,_0x2bc3c6){var _0x4637a0=function(_0x5be6ee){while(--_0x5be6ee){_0x1ddcb7['push'](_0x1ddcb7['shift']());}};_0x4637a0(++_0x2bc3c6);}(_0xd810,0x10f));var _0x0d81=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xd810[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x0d81('0x0'));var rimraf=require(_0x0d81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d81('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d81('0x3'));var Mustache=require(_0x0d81('0x4'));var util=require(_0x0d81('0x5'));var path=require(_0x0d81('0x6'));var sox=require(_0x0d81('0x7'));var csv=require(_0x0d81('0x8'));var ejs=require(_0x0d81('0x9'));var fs=require('fs');var fs_extra=require(_0x0d81('0xa'));var _=require(_0x0d81('0xb'));var squel=require('squel');var crypto=require(_0x0d81('0xc'));var jsforce=require(_0x0d81('0xd'));var deskjs=require(_0x0d81('0xe'));var toCsv=require(_0x0d81('0x8'));var querystring=require(_0x0d81('0xf'));var Papa=require(_0x0d81('0x10'));var Redis=require(_0x0d81('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d81('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d81('0x13'))('api');var utils=require(_0x0d81('0x14'));var config=require(_0x0d81('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d81('0x16'))['db'];function respondWithStatusCode(_0x4dffb9,_0x504c99){_0x504c99=_0x504c99||0xcc;return function(_0x52f28f){if(_0x52f28f){return _0x4dffb9[_0x0d81('0x17')](_0x504c99);}return _0x4dffb9[_0x0d81('0x18')](_0x504c99)[_0x0d81('0x19')]();};}function respondWithResult(_0x239175,_0x47fd3f){_0x47fd3f=_0x47fd3f||0xc8;return function(_0x1ba635){if(_0x1ba635){return _0x239175['status'](_0x47fd3f)[_0x0d81('0x1a')](_0x1ba635);}};}function respondWithFilteredResult(_0xdb34fd,_0x3f49f7){return function(_0x46b7a3){if(_0x46b7a3){var _0x1abef7=typeof _0x3f49f7['offset']===_0x0d81('0x1b')&&typeof _0x3f49f7['limit']==='undefined';var _0x190deb=_0x46b7a3[_0x0d81('0x1c')];var _0x115310=_0x1abef7?0x0:_0x3f49f7[_0x0d81('0x1d')];var _0x1a0e04=_0x1abef7?_0x46b7a3[_0x0d81('0x1c')]:_0x3f49f7['offset']+_0x3f49f7[_0x0d81('0x1e')];var _0x5d04c7;if(_0x1a0e04>=_0x190deb){_0x1a0e04=_0x190deb;_0x5d04c7=0xc8;}else{_0x5d04c7=0xce;}_0xdb34fd[_0x0d81('0x18')](_0x5d04c7);return _0xdb34fd[_0x0d81('0x1f')](_0x0d81('0x20'),_0x115310+'-'+_0x1a0e04+'/'+_0x190deb)[_0x0d81('0x1a')](_0x46b7a3);}return null;};}function patchUpdates(_0x5187dd){return function(_0x386fbe){try{jsonpatch[_0x0d81('0x21')](_0x386fbe,_0x5187dd,!![]);}catch(_0x3c1d27){return BPromise[_0x0d81('0x22')](_0x3c1d27);}return _0x386fbe['save']();};}function saveUpdates(_0x113b55,_0x14a0c8){return function(_0x3d6dd4){if(_0x3d6dd4){return _0x3d6dd4[_0x0d81('0x23')](_0x113b55)[_0x0d81('0x24')](function(_0x581642){return _0x581642;});}return null;};}function removeEntity(_0x5e83e0,_0x2ba309){return function(_0x1d922d){if(_0x1d922d){return _0x1d922d['destroy']()[_0x0d81('0x24')](function(){_0x5e83e0[_0x0d81('0x18')](0xcc)[_0x0d81('0x19')]();});}};}function handleEntityNotFound(_0x45f49c,_0xa14b58){return function(_0x14e5db){if(!_0x14e5db){_0x45f49c['sendStatus'](0x194);}return _0x14e5db;};}function handleError(_0x524f44,_0x4dcf36){_0x4dcf36=_0x4dcf36||0x1f4;return function(_0x58d51b){logger[_0x0d81('0x25')](_0x58d51b[_0x0d81('0x26')]);if(_0x58d51b[_0x0d81('0x27')]){delete _0x58d51b[_0x0d81('0x27')];}_0x524f44[_0x0d81('0x18')](_0x4dcf36)['send'](_0x58d51b);};}exports[_0x0d81('0x28')]=function(_0x8c8c51,_0x29244e){var _0x5d17ee={},_0x45f1a8={},_0x5d535c={'count':0x0,'rows':[]};var _0x40278a=_[_0x0d81('0x29')](db[_0x0d81('0x2a')]['rawAttributes'],function(_0x4b8442){return{'name':_0x4b8442[_0x0d81('0x2b')],'type':_0x4b8442['type'][_0x0d81('0x2c')]};});_0x45f1a8[_0x0d81('0x2d')]=_[_0x0d81('0x29')](_0x40278a,_0x0d81('0x27'));_0x45f1a8[_0x0d81('0x2e')]=_[_0x0d81('0x2f')](_0x8c8c51['query']);_0x45f1a8[_0x0d81('0x30')]=_[_0x0d81('0x31')](_0x45f1a8[_0x0d81('0x2d')],_0x45f1a8[_0x0d81('0x2e')]);_0x5d17ee['attributes']=_[_0x0d81('0x31')](_0x45f1a8['model'],qs[_0x0d81('0x32')](_0x8c8c51['query']['fields']));_0x5d17ee[_0x0d81('0x33')]=_0x5d17ee[_0x0d81('0x33')]['length']?_0x5d17ee[_0x0d81('0x33')]:_0x45f1a8['model'];if(!_0x8c8c51['query'][_0x0d81('0x34')](_0x0d81('0x35'))){_0x5d17ee[_0x0d81('0x1e')]=qs[_0x0d81('0x1e')](_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x1e')]);_0x5d17ee[_0x0d81('0x1d')]=qs[_0x0d81('0x1d')](_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x1d')]);}_0x5d17ee[_0x0d81('0x36')]=qs[_0x0d81('0x37')](_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x37')]);_0x5d17ee[_0x0d81('0x38')]=qs[_0x0d81('0x30')](_[_0x0d81('0x39')](_0x8c8c51['query'],_0x45f1a8[_0x0d81('0x30')]),_0x40278a);if(_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x3a')]){_0x5d17ee[_0x0d81('0x38')]=_[_0x0d81('0x3b')](_0x5d17ee[_0x0d81('0x38')],{'$or':_['map'](_0x40278a,function(_0x109d76){if(_0x109d76[_0x0d81('0x3c')]!==_0x0d81('0x3d')){var _0x55f0a1={};_0x55f0a1[_0x109d76[_0x0d81('0x27')]]={'$like':'%'+_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x3a')]+'%'};return _0x55f0a1;}})});}_0x5d17ee=_[_0x0d81('0x3b')]({},_0x5d17ee,_0x8c8c51[_0x0d81('0x3e')]);var _0x42d785={'where':_0x5d17ee[_0x0d81('0x38')]};return db['FaxTransferReport'][_0x0d81('0x1c')](_0x42d785)['then'](function(_0x790dd7){_0x5d535c[_0x0d81('0x1c')]=_0x790dd7;if(_0x8c8c51[_0x0d81('0x2e')][_0x0d81('0x3f')]){_0x5d17ee[_0x0d81('0x40')]=[{'all':!![]}];}return db[_0x0d81('0x2a')][_0x0d81('0x41')](_0x5d17ee);})[_0x0d81('0x24')](function(_0x5cc653){_0x5d535c[_0x0d81('0x42')]=_0x5cc653;return _0x5d535c;})[_0x0d81('0x24')](respondWithFilteredResult(_0x29244e,_0x5d17ee))[_0x0d81('0x43')](handleError(_0x29244e,null));};exports[_0x0d81('0x44')]=function(_0x1fd5d4,_0xadca5f){var _0x2a654b={'raw':!![],'where':{'id':_0x1fd5d4[_0x0d81('0x45')]['id']}},_0x3c2764={};_0x3c2764[_0x0d81('0x2d')]=_[_0x0d81('0x2f')](db[_0x0d81('0x2a')][_0x0d81('0x46')]);_0x3c2764[_0x0d81('0x2e')]=_[_0x0d81('0x2f')](_0x1fd5d4[_0x0d81('0x2e')]);_0x3c2764['filters']=_[_0x0d81('0x31')](_0x3c2764[_0x0d81('0x2d')],_0x3c2764[_0x0d81('0x2e')]);_0x2a654b[_0x0d81('0x33')]=_[_0x0d81('0x31')](_0x3c2764[_0x0d81('0x2d')],qs[_0x0d81('0x32')](_0x1fd5d4['query']['fields']));_0x2a654b[_0x0d81('0x33')]=_0x2a654b[_0x0d81('0x33')][_0x0d81('0x47')]?_0x2a654b[_0x0d81('0x33')]:_0x3c2764[_0x0d81('0x2d')];if(_0x1fd5d4[_0x0d81('0x2e')][_0x0d81('0x3f')]){_0x2a654b['include']=[{'all':!![]}];}_0x2a654b=_[_0x0d81('0x3b')]({},_0x2a654b,_0x1fd5d4[_0x0d81('0x3e')]);return db['FaxTransferReport'][_0x0d81('0x48')](_0x2a654b)[_0x0d81('0x24')](handleEntityNotFound(_0xadca5f,null))[_0x0d81('0x24')](respondWithResult(_0xadca5f,null))[_0x0d81('0x43')](handleError(_0xadca5f,null));};exports['create']=function(_0x17e86e,_0x48ccc9){return db[_0x0d81('0x2a')][_0x0d81('0x49')](_0x17e86e[_0x0d81('0x4a')],{})[_0x0d81('0x24')](respondWithResult(_0x48ccc9,0xc9))['catch'](handleError(_0x48ccc9,null));};exports[_0x0d81('0x23')]=function(_0x29247a,_0x56154a){if(_0x29247a[_0x0d81('0x4a')]['id']){delete _0x29247a['body']['id'];}return db[_0x0d81('0x2a')]['find']({'where':{'id':_0x29247a[_0x0d81('0x45')]['id']}})[_0x0d81('0x24')](handleEntityNotFound(_0x56154a,null))[_0x0d81('0x24')](saveUpdates(_0x29247a[_0x0d81('0x4a')],null))[_0x0d81('0x24')](respondWithResult(_0x56154a,null))[_0x0d81('0x43')](handleError(_0x56154a,null));};exports[_0x0d81('0x4b')]=function(_0x53d3e9,_0x59dada){return db[_0x0d81('0x2a')][_0x0d81('0x48')]({'where':{'id':_0x53d3e9[_0x0d81('0x45')]['id']}})[_0x0d81('0x24')](handleEntityNotFound(_0x59dada,null))[_0x0d81('0x24')](removeEntity(_0x59dada,null))['catch'](handleError(_0x59dada,null));};exports[_0x0d81('0x4c')]=function(_0x12c95a,_0x399686){return db['FaxTransferReport'][_0x0d81('0x4c')]()[_0x0d81('0x24')](respondWithResult(_0x399686,null))[_0x0d81('0x43')](handleError(_0x399686,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bb44633..899a7a6 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 _0xebe1=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0xbb8c8c,_0xb1f7d9){var _0x18e5dd=function(_0x1419d5){while(--_0x1419d5){_0xbb8c8c['push'](_0xbb8c8c['shift']());}};_0x18e5dd(++_0xb1f7d9);}(_0xebe1,0x19a));var _0x1ebe=function(_0x29d5ac,_0x350be9){_0x29d5ac=_0x29d5ac-0x0;var _0x1a520a=_0xebe1[_0x29d5ac];return _0x1a520a;};'use strict';var _=require(_0x1ebe('0x0'));var util=require(_0x1ebe('0x1'));var logger=require(_0x1ebe('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1ebe('0x3'));var rp=require(_0x1ebe('0x4'));var fs=require('fs');var path=require(_0x1ebe('0x5'));var rimraf=require(_0x1ebe('0x6'));var config=require(_0x1ebe('0x7'));var attributes=require(_0x1ebe('0x8'));module[_0x1ebe('0x9')]=function(_0x101fd5,_0x5a98e1){return _0x101fd5[_0x1ebe('0xa')](_0x1ebe('0xb'),attributes,{'tableName':_0x1ebe('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1ebe('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d95=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d95,0xa7));var _0x54d9=function(_0x44d2a8,_0x337c45){_0x44d2a8=_0x44d2a8-0x0;var _0x53b4bf=_0x4d95[_0x44d2a8];return _0x53b4bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54d9('0x0'))(_0x54d9('0x1'));var moment=require(_0x54d9('0x2'));var BPromise=require(_0x54d9('0x3'));var rp=require(_0x54d9('0x4'));var fs=require('fs');var path=require(_0x54d9('0x5'));var rimraf=require('rimraf');var config=require(_0x54d9('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x54d9('0x7')]=function(_0x2539a2,_0xabdf6d){return _0x2539a2[_0x54d9('0x8')](_0x54d9('0x9'),attributes,{'tableName':_0x54d9('0xa'),'paranoid':![],'indexes':[{'name':_0x54d9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7e0fb65..294546e 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 _0x9788=['client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9788,0x115));var _0x8978=function(_0x52b60d,_0x3245a4){_0x52b60d=_0x52b60d-0x0;var _0x2390fe=_0x9788[_0x52b60d];return _0x2390fe;};'use strict';var _=require(_0x8978('0x0'));var util=require(_0x8978('0x1'));var moment=require(_0x8978('0x2'));var BPromise=require(_0x8978('0x3'));var rs=require(_0x8978('0x4'));var fs=require('fs');var Redis=require(_0x8978('0x5'));var db=require(_0x8978('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8978('0x7'))(_0x8978('0x8'));var config=require(_0x8978('0x9'));var jayson=require(_0x8978('0xa'));var client=jayson[_0x8978('0xb')][_0x8978('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x342848,_0x394c3f,_0x873709){return new BPromise(function(_0x471b30,_0x4ea680){return client[_0x8978('0xd')](_0x342848,_0x873709)[_0x8978('0xe')](function(_0x244396){logger[_0x8978('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x394c3f,_0x8978('0x10'));logger['debug'](_0x8978('0x11'),_0x394c3f,'request\x20sent',JSON['stringify'](_0x244396));if(_0x244396[_0x8978('0x12')]){if(_0x244396['error'][_0x8978('0x13')]===0x1f4){logger[_0x8978('0x12')](_0x8978('0x14'),_0x394c3f,_0x244396[_0x8978('0x12')]['message']);return _0x4ea680(_0x244396[_0x8978('0x12')][_0x8978('0x15')]);}logger[_0x8978('0x12')](_0x8978('0x14'),_0x394c3f,_0x244396['error'][_0x8978('0x15')]);return _0x471b30(_0x244396[_0x8978('0x12')][_0x8978('0x15')]);}else{logger['info'](_0x8978('0x14'),_0x394c3f,_0x8978('0x10'));_0x471b30(_0x244396[_0x8978('0x16')]['message']);}})[_0x8978('0x17')](function(_0x32f247){logger['error'](_0x8978('0x14'),_0x394c3f,_0x32f247);_0x4ea680(_0x32f247);});});} \ No newline at end of file +var _0x246f=['FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','debug'];(function(_0x23692,_0x3369cc){var _0x14fa60=function(_0x617970){while(--_0x617970){_0x23692['push'](_0x23692['shift']());}};_0x14fa60(++_0x3369cc);}(_0x246f,0xa9));var _0xf246=function(_0x2a39e0,_0x3231da){_0x2a39e0=_0x2a39e0-0x0;var _0x377c37=_0x246f[_0x2a39e0];return _0x377c37;};'use strict';var _=require('lodash');var util=require(_0xf246('0x0'));var moment=require('moment');var BPromise=require(_0xf246('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf246('0x2'));var db=require(_0xf246('0x3'))['db'];var utils=require(_0xf246('0x4'));var logger=require('../../config/logger')(_0xf246('0x5'));var config=require(_0xf246('0x6'));var jayson=require(_0xf246('0x7'));var client=jayson['client'][_0xf246('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcf45e,_0x3608aa,_0x31c263){return new BPromise(function(_0x419cd5,_0x56301f){return client['request'](_0xcf45e,_0x31c263)['then'](function(_0x5da51c){logger[_0xf246('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x3608aa,'request\x20sent');logger[_0xf246('0xa')](_0xf246('0xb'),_0x3608aa,_0xf246('0xc'),JSON[_0xf246('0xd')](_0x5da51c));if(_0x5da51c[_0xf246('0xe')]){if(_0x5da51c['error'][_0xf246('0xf')]===0x1f4){logger[_0xf246('0xe')](_0xf246('0x10'),_0x3608aa,_0x5da51c[_0xf246('0xe')][_0xf246('0x11')]);return _0x56301f(_0x5da51c[_0xf246('0xe')][_0xf246('0x11')]);}logger[_0xf246('0xe')](_0xf246('0x10'),_0x3608aa,_0x5da51c['error'][_0xf246('0x11')]);return _0x419cd5(_0x5da51c[_0xf246('0xe')][_0xf246('0x11')]);}else{logger[_0xf246('0x9')](_0xf246('0x10'),_0x3608aa,_0xf246('0xc'));_0x419cd5(_0x5da51c['result'][_0xf246('0x11')]);}})['catch'](function(_0x2380d2){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3608aa,_0x2380d2);_0x56301f(_0x2380d2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2d3a533..9bcef06 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 _0x7b03=['index','/describe','describe','get','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7b03,0xc7));var _0x37b0=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x7b03[_0x3358ba];return _0x296e73;};'use strict';var multer=require(_0x37b0('0x0'));var util=require(_0x37b0('0x1'));var path=require(_0x37b0('0x2'));var timeout=require(_0x37b0('0x3'));var express=require('express');var router=express[_0x37b0('0x4')]();var fs_extra=require(_0x37b0('0x5'));var auth=require(_0x37b0('0x6'));var interaction=require(_0x37b0('0x7'));var config=require(_0x37b0('0x8'));var controller=require(_0x37b0('0x9'));router['get']('/',auth[_0x37b0('0xa')](),controller[_0x37b0('0xb')]);router['get'](_0x37b0('0xc'),auth[_0x37b0('0xa')](),controller[_0x37b0('0xd')]);router[_0x37b0('0xe')](_0x37b0('0xf'),auth[_0x37b0('0xa')](),controller[_0x37b0('0x10')]);router[_0x37b0('0x11')]('/',auth[_0x37b0('0xa')](),controller[_0x37b0('0x12')]);router['put'](_0x37b0('0xf'),auth[_0x37b0('0xa')](),controller['update']);router['delete'](_0x37b0('0xf'),auth[_0x37b0('0xa')](),controller[_0x37b0('0x13')]);module[_0x37b0('0x14')]=router; \ No newline at end of file +var _0x7536=['get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x2b73a8,_0x395a14){var _0x1a91cc=function(_0x5402c5){while(--_0x5402c5){_0x2b73a8['push'](_0x2b73a8['shift']());}};_0x1a91cc(++_0x395a14);}(_0x7536,0x6f));var _0x6753=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x7536[_0x364048];return _0x591678;};'use strict';var multer=require(_0x6753('0x0'));var util=require('util');var path=require(_0x6753('0x1'));var timeout=require(_0x6753('0x2'));var express=require('express');var router=express[_0x6753('0x3')]();var fs_extra=require(_0x6753('0x4'));var auth=require(_0x6753('0x5'));var interaction=require(_0x6753('0x6'));var config=require(_0x6753('0x7'));var controller=require(_0x6753('0x8'));router[_0x6753('0x9')]('/',auth['isAuthenticated'](),controller[_0x6753('0xa')]);router[_0x6753('0x9')](_0x6753('0xb'),auth[_0x6753('0xc')](),controller[_0x6753('0xd')]);router['get'](_0x6753('0xe'),auth['isAuthenticated'](),controller[_0x6753('0xf')]);router['post']('/',auth[_0x6753('0xc')](),controller[_0x6753('0x10')]);router[_0x6753('0x11')](_0x6753('0xe'),auth['isAuthenticated'](),controller[_0x6753('0x12')]);router[_0x6753('0x13')](_0x6753('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 72fe355..251ccb5 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 _0x2847=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','create','addConfiguration','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11560a,_0x19e152){var _0x2f53f3=function(_0x32f0a8){while(--_0x32f0a8){_0x11560a['push'](_0x11560a['shift']());}};_0x2f53f3(++_0x19e152);}(_0x2847,0x173));var _0x7284=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0x2847[_0x542f45];return _0x38c609;};'use strict';var multer=require(_0x7284('0x0'));var util=require(_0x7284('0x1'));var path=require(_0x7284('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7284('0x3')]();var fs_extra=require(_0x7284('0x4'));var auth=require(_0x7284('0x5'));var interaction=require(_0x7284('0x6'));var config=require(_0x7284('0x7'));var controller=require(_0x7284('0x8'));router[_0x7284('0x9')]('/',auth[_0x7284('0xa')](),controller['index']);router[_0x7284('0x9')](_0x7284('0xb'),auth[_0x7284('0xa')](),controller[_0x7284('0xc')]);router[_0x7284('0x9')](_0x7284('0xd'),auth[_0x7284('0xa')](),controller[_0x7284('0xe')]);router['get']('/:id/fields',auth[_0x7284('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x7284('0xf')]);router['post'](_0x7284('0xd'),auth[_0x7284('0xa')](),controller[_0x7284('0x10')]);router[_0x7284('0x11')](_0x7284('0xb'),auth[_0x7284('0xa')](),controller['update']);router[_0x7284('0x12')]('/:id',auth[_0x7284('0xa')](),controller[_0x7284('0x13')]);module[_0x7284('0x14')]=router; \ No newline at end of file +var _0x3606=['put','update','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','create','post','addConfiguration'];(function(_0x23bf11,_0x3c3292){var _0x3ff5c3=function(_0x1dc116){while(--_0x1dc116){_0x23bf11['push'](_0x23bf11['shift']());}};_0x3ff5c3(++_0x3c3292);}(_0x3606,0x1f2));var _0x6360=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x3606[_0x292f93];return _0x5a94b1;};'use strict';var multer=require(_0x6360('0x0'));var util=require('util');var path=require(_0x6360('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6360('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6360('0x3'));var config=require(_0x6360('0x4'));var controller=require(_0x6360('0x5'));router[_0x6360('0x6')]('/',auth['isAuthenticated'](),controller[_0x6360('0x7')]);router[_0x6360('0x6')](_0x6360('0x8'),auth[_0x6360('0x9')](),controller[_0x6360('0xa')]);router[_0x6360('0x6')](_0x6360('0xb'),auth[_0x6360('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x6360('0x9')](),controller['getFields']);router['post']('/',auth[_0x6360('0x9')](),controller[_0x6360('0xc')]);router[_0x6360('0xd')](_0x6360('0xb'),auth[_0x6360('0x9')](),controller[_0x6360('0xe')]);router[_0x6360('0xf')](_0x6360('0x8'),auth[_0x6360('0x9')](),controller[_0x6360('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6360('0x11')]);module[_0x6360('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9dd42c4..f947545 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 _0x8924=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x5d954a,_0x10e4b9){var _0x2c8dc9=function(_0x16870b){while(--_0x16870b){_0x5d954a['push'](_0x5d954a['shift']());}};_0x2c8dc9(++_0x10e4b9);}(_0x8924,0x6a));var _0x4892=function(_0xa5a920,_0x2d8772){_0xa5a920=_0xa5a920-0x0;var _0x596618=_0x8924[_0xa5a920];return _0x596618;};'use strict';var Sequelize=require(_0x4892('0x0'));module[_0x4892('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4892('0x2')]},'remoteUri':{'type':Sequelize[_0x4892('0x2')]},'authType':{'type':Sequelize[_0x4892('0x3')]('basic'),'defaultValue':_0x4892('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x4892('0x2')]},'consumerSecret':{'type':Sequelize[_0x4892('0x2')]},'token':{'type':Sequelize[_0x4892('0x2')]},'tokenSecret':{'type':Sequelize[_0x4892('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4892('0x3')](_0x4892('0x5'),_0x4892('0x6')),'defaultValue':_0x4892('0x5')}}; \ No newline at end of file +var _0xde89=['sequelize','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x1a5eb0,_0x1f8fbb){var _0x30f9ba=function(_0x8f1caa){while(--_0x8f1caa){_0x1a5eb0['push'](_0x1a5eb0['shift']());}};_0x30f9ba(++_0x1f8fbb);}(_0xde89,0x108));var _0x9de8=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xde89[_0x280f4a];return _0x1bb157;};'use strict';var Sequelize=require(_0x9de8('0x0'));module['exports']={'name':{'type':Sequelize[_0x9de8('0x1')]},'description':{'type':Sequelize[_0x9de8('0x1')]},'username':{'type':Sequelize[_0x9de8('0x1')]},'remoteUri':{'type':Sequelize[_0x9de8('0x1')]},'authType':{'type':Sequelize[_0x9de8('0x2')]('basic'),'defaultValue':_0x9de8('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9de8('0x1')]},'consumerSecret':{'type':Sequelize[_0x9de8('0x1')]},'token':{'type':Sequelize[_0x9de8('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9de8('0x2')]('integrationTab',_0x9de8('0x4')),'defaultValue':_0x9de8('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index eef61c8..181a0e8 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 _0x670a=['moment','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','DeskAccount','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise'];(function(_0x2651eb,_0x582d6e){var _0x2d9948=function(_0x981903){while(--_0x981903){_0x2651eb['push'](_0x2651eb['shift']());}};_0x2d9948(++_0x582d6e);}(_0x670a,0xed));var _0xa670=function(_0x217a7d,_0x44e36e){_0x217a7d=_0x217a7d-0x0;var _0x1afb74=_0x670a[_0x217a7d];return _0x1afb74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa670('0x0'));var zipdir=require(_0xa670('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa670('0x2'));var moment=require(_0xa670('0x3'));var BPromise=require(_0xa670('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa670('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa670('0x6'));var fs=require('fs');var fs_extra=require(_0xa670('0x7'));var _=require('lodash');var squel=require(_0xa670('0x8'));var crypto=require(_0xa670('0x9'));var jsforce=require(_0xa670('0xa'));var deskjs=require(_0xa670('0xb'));var toCsv=require(_0xa670('0xc'));var querystring=require(_0xa670('0xd'));var Papa=require(_0xa670('0xe'));var Redis=require(_0xa670('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa670('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa670('0x11'));var logger=require(_0xa670('0x12'))(_0xa670('0x13'));var utils=require(_0xa670('0x14'));var config=require(_0xa670('0x15'));var licenseUtil=require(_0xa670('0x16'));var db=require(_0xa670('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42c63c,_0x260048){_0x260048=_0x260048||0xcc;return function(_0x37c312){if(_0x37c312){return _0x42c63c[_0xa670('0x18')](_0x260048);}return _0x42c63c[_0xa670('0x19')](_0x260048)[_0xa670('0x1a')]();};}function respondWithResult(_0x52c08c,_0x39183e){_0x39183e=_0x39183e||0xc8;return function(_0xf44ecb){if(_0xf44ecb){return _0x52c08c[_0xa670('0x19')](_0x39183e)['json'](_0xf44ecb);}};}function respondWithFilteredResult(_0x53bc68,_0x40aac7){return function(_0x721a5b){if(_0x721a5b){var _0x331ca8=typeof _0x40aac7[_0xa670('0x1b')]===_0xa670('0x1c')&&typeof _0x40aac7['limit']==='undefined';var _0x1bfeb2=_0x721a5b[_0xa670('0x1d')];var _0x488089=_0x331ca8?0x0:_0x40aac7[_0xa670('0x1b')];var _0x518ad3=_0x331ca8?_0x721a5b[_0xa670('0x1d')]:_0x40aac7[_0xa670('0x1b')]+_0x40aac7[_0xa670('0x1e')];var _0x4e9be2;if(_0x518ad3>=_0x1bfeb2){_0x518ad3=_0x1bfeb2;_0x4e9be2=0xc8;}else{_0x4e9be2=0xce;}_0x53bc68[_0xa670('0x19')](_0x4e9be2);return _0x53bc68[_0xa670('0x1f')](_0xa670('0x20'),_0x488089+'-'+_0x518ad3+'/'+_0x1bfeb2)[_0xa670('0x21')](_0x721a5b);}return null;};}function patchUpdates(_0x2b1b72){return function(_0x35f411){try{jsonpatch[_0xa670('0x22')](_0x35f411,_0x2b1b72,!![]);}catch(_0x34da35){return BPromise[_0xa670('0x23')](_0x34da35);}return _0x35f411[_0xa670('0x24')]();};}function saveUpdates(_0x159728,_0x56e20f){return function(_0x1de7b7){if(_0x1de7b7){return _0x1de7b7[_0xa670('0x25')](_0x159728)[_0xa670('0x26')](function(_0x54774d){return _0x54774d;});}return null;};}function removeEntity(_0x157b2f,_0x13febd){return function(_0x3876b0){if(_0x3876b0){return _0x3876b0['destroy']()[_0xa670('0x26')](function(){_0x157b2f[_0xa670('0x19')](0xcc)[_0xa670('0x1a')]();});}};}function handleEntityNotFound(_0x65fe73,_0x15452b){return function(_0x3d1e7d){if(!_0x3d1e7d){_0x65fe73[_0xa670('0x18')](0x194);}return _0x3d1e7d;};}function handleError(_0x5603ea,_0x73608b){_0x73608b=_0x73608b||0x1f4;return function(_0x53c754){logger[_0xa670('0x27')](_0x53c754[_0xa670('0x28')]);if(_0x53c754[_0xa670('0x29')]){delete _0x53c754[_0xa670('0x29')];}_0x5603ea['status'](_0x73608b)[_0xa670('0x2a')](_0x53c754);};}exports[_0xa670('0x2b')]=function(_0x19991f,_0x5d0764){var _0x39c538={},_0x102eaa={},_0x22e06c={'count':0x0,'rows':[]};var _0x1344dd=_[_0xa670('0x2c')](db['DeskAccount'][_0xa670('0x2d')],function(_0x55d79f){return{'name':_0x55d79f[_0xa670('0x2e')],'type':_0x55d79f[_0xa670('0x2f')][_0xa670('0x30')]};});_0x102eaa[_0xa670('0x31')]=_[_0xa670('0x2c')](_0x1344dd,'name');_0x102eaa[_0xa670('0x32')]=_[_0xa670('0x33')](_0x19991f[_0xa670('0x32')]);_0x102eaa['filters']=_[_0xa670('0x34')](_0x102eaa[_0xa670('0x31')],_0x102eaa[_0xa670('0x32')]);_0x39c538[_0xa670('0x35')]=_[_0xa670('0x34')](_0x102eaa[_0xa670('0x31')],qs[_0xa670('0x36')](_0x19991f[_0xa670('0x32')][_0xa670('0x36')]));_0x39c538[_0xa670('0x35')]=_0x39c538[_0xa670('0x35')][_0xa670('0x37')]?_0x39c538[_0xa670('0x35')]:_0x102eaa['model'];if(!_0x19991f[_0xa670('0x32')][_0xa670('0x38')](_0xa670('0x39'))){_0x39c538[_0xa670('0x1e')]=qs[_0xa670('0x1e')](_0x19991f[_0xa670('0x32')][_0xa670('0x1e')]);_0x39c538[_0xa670('0x1b')]=qs[_0xa670('0x1b')](_0x19991f['query'][_0xa670('0x1b')]);}_0x39c538[_0xa670('0x3a')]=qs[_0xa670('0x3b')](_0x19991f['query'][_0xa670('0x3b')]);_0x39c538['where']=qs['filters'](_[_0xa670('0x3c')](_0x19991f[_0xa670('0x32')],_0x102eaa[_0xa670('0x3d')]),_0x1344dd);if(_0x19991f[_0xa670('0x32')][_0xa670('0x3e')]){_0x39c538[_0xa670('0x3f')]=_[_0xa670('0x40')](_0x39c538['where'],{'$or':_[_0xa670('0x2c')](_0x1344dd,function(_0x55351d){if(_0x55351d['type']!==_0xa670('0x41')){var _0x17dc2b={};_0x17dc2b[_0x55351d[_0xa670('0x29')]]={'$like':'%'+_0x19991f[_0xa670('0x32')][_0xa670('0x3e')]+'%'};return _0x17dc2b;}})});}_0x39c538=_[_0xa670('0x40')]({},_0x39c538,_0x19991f['options']);var _0x25dcc1={'where':_0x39c538[_0xa670('0x3f')]};return db[_0xa670('0x42')][_0xa670('0x1d')](_0x25dcc1)[_0xa670('0x26')](function(_0x3cb19b){_0x22e06c[_0xa670('0x1d')]=_0x3cb19b;if(_0x19991f['query']['includeAll']){_0x39c538[_0xa670('0x43')]=[{'all':!![]}];}return db[_0xa670('0x42')][_0xa670('0x44')](_0x39c538);})[_0xa670('0x26')](function(_0x42e519){_0x22e06c[_0xa670('0x45')]=_0x42e519;return _0x22e06c;})[_0xa670('0x26')](respondWithFilteredResult(_0x5d0764,_0x39c538))[_0xa670('0x46')](handleError(_0x5d0764,null));};exports[_0xa670('0x47')]=function(_0x759a0c,_0x174879){var _0x3ef585={'raw':![],'where':{'id':_0x759a0c['params']['id']}},_0x43d298={};_0x43d298['model']=_['keys'](db[_0xa670('0x42')]['rawAttributes']);_0x43d298[_0xa670('0x32')]=_['keys'](_0x759a0c[_0xa670('0x32')]);_0x43d298[_0xa670('0x3d')]=_[_0xa670('0x34')](_0x43d298[_0xa670('0x31')],_0x43d298['query']);_0x3ef585[_0xa670('0x35')]=_[_0xa670('0x34')](_0x43d298[_0xa670('0x31')],qs[_0xa670('0x36')](_0x759a0c[_0xa670('0x32')][_0xa670('0x36')]));_0x3ef585[_0xa670('0x35')]=_0x3ef585[_0xa670('0x35')][_0xa670('0x37')]?_0x3ef585[_0xa670('0x35')]:_0x43d298[_0xa670('0x31')];if(_0x759a0c[_0xa670('0x32')][_0xa670('0x48')]){_0x3ef585[_0xa670('0x43')]=[{'all':!![]}];}_0x3ef585=_[_0xa670('0x40')]({},_0x3ef585,_0x759a0c[_0xa670('0x49')]);return db[_0xa670('0x42')][_0xa670('0x4a')](_0x3ef585)['then'](handleEntityNotFound(_0x174879,null))[_0xa670('0x26')](respondWithResult(_0x174879,null))[_0xa670('0x46')](handleError(_0x174879,null));};exports[_0xa670('0x4b')]=function(_0x109823,_0x3b53f3){return db[_0xa670('0x42')][_0xa670('0x4b')](_0x109823[_0xa670('0x4c')],{})[_0xa670('0x26')](respondWithResult(_0x3b53f3,0xc9))[_0xa670('0x46')](handleError(_0x3b53f3,null));};exports[_0xa670('0x25')]=function(_0x2c92cd,_0x21a2ee){if(_0x2c92cd[_0xa670('0x4c')]['id']){delete _0x2c92cd[_0xa670('0x4c')]['id'];}return db[_0xa670('0x42')][_0xa670('0x4a')]({'where':{'id':_0x2c92cd[_0xa670('0x4d')]['id']}})[_0xa670('0x26')](handleEntityNotFound(_0x21a2ee,null))[_0xa670('0x26')](saveUpdates(_0x2c92cd[_0xa670('0x4c')],null))['then'](respondWithResult(_0x21a2ee,null))[_0xa670('0x46')](handleError(_0x21a2ee,null));};exports[_0xa670('0x4e')]=function(_0x2af1f0,_0x5ceb36){return db['DeskAccount'][_0xa670('0x4a')]({'where':{'id':_0x2af1f0['params']['id']}})['then'](handleEntityNotFound(_0x5ceb36,null))[_0xa670('0x26')](removeEntity(_0x5ceb36,null))[_0xa670('0x46')](handleError(_0x5ceb36,null));};exports[_0xa670('0x4f')]=function(_0x5b3ec1,_0x55c396,_0x12b109){var _0x484525={};var _0x489066={};var _0x514779;var _0x190fdd;return db['DeskAccount'][_0xa670('0x50')]({'where':{'id':_0x5b3ec1['params']['id']}})['then'](handleEntityNotFound(_0x55c396,null))['then'](function(_0x59ae42){if(_0x59ae42){_0x514779=_0x59ae42;_0x489066['model']=_[_0xa670('0x33')](db[_0xa670('0x51')]['rawAttributes']);_0x489066[_0xa670('0x32')]=_['keys'](_0x5b3ec1['query']);_0x489066[_0xa670('0x3d')]=_[_0xa670('0x34')](_0x489066[_0xa670('0x31')],_0x489066[_0xa670('0x32')]);_0x484525['attributes']=_[_0xa670('0x34')](_0x489066[_0xa670('0x31')],qs[_0xa670('0x36')](_0x5b3ec1[_0xa670('0x32')][_0xa670('0x36')]));_0x484525[_0xa670('0x35')]=_0x484525['attributes'][_0xa670('0x37')]?_0x484525[_0xa670('0x35')]:_0x489066['model'];_0x484525['order']=qs[_0xa670('0x3b')](_0x5b3ec1['query'][_0xa670('0x3b')]);_0x484525['where']=qs[_0xa670('0x3d')](_[_0xa670('0x3c')](_0x5b3ec1[_0xa670('0x32')],_0x489066[_0xa670('0x3d')]));if(_0x5b3ec1[_0xa670('0x32')]['filter']){_0x484525[_0xa670('0x3f')]=_[_0xa670('0x40')](_0x484525[_0xa670('0x3f')],{'$or':_['map'](_0x484525['attributes'],function(_0x5a5b9a){var _0x292d17={};_0x292d17[_0x5a5b9a]={'$like':'%'+_0x5b3ec1[_0xa670('0x32')]['filter']+'%'};return _0x292d17;})});}_0x484525=_[_0xa670('0x40')]({},_0x484525,_0x5b3ec1['options']);return _0x514779[_0xa670('0x4f')](_0x484525);}})[_0xa670('0x26')](function(_0x554746){if(_0x554746){_0x190fdd=_0x554746['length'];if(!_0x5b3ec1[_0xa670('0x32')][_0xa670('0x38')](_0xa670('0x39'))){_0x484525['limit']=qs['limit'](_0x5b3ec1[_0xa670('0x32')][_0xa670('0x1e')]);_0x484525['offset']=qs[_0xa670('0x1b')](_0x5b3ec1[_0xa670('0x32')][_0xa670('0x1b')]);}return _0x514779['getConfigurations'](_0x484525);}})['then'](function(_0x11243e){if(_0x11243e){return _0x11243e?{'count':_0x190fdd,'rows':_0x11243e}:null;}})['then'](respondWithResult(_0x55c396,null))[_0xa670('0x46')](handleError(_0x55c396,null));};exports[_0xa670('0x52')]=function(_0x1395d7,_0x2f6102,_0x57f9cd){if(_0x1395d7[_0xa670('0x4c')]['id']){delete _0x1395d7[_0xa670('0x4c')]['id'];}return db[_0xa670('0x42')]['findOne']({'where':{'id':_0x1395d7[_0xa670('0x4d')]['id']}})[_0xa670('0x26')](handleEntityNotFound(_0x2f6102,null))[_0xa670('0x26')](function(_0x193088){if(_0x193088){_0x1395d7[_0xa670('0x4c')][_0xa670('0x53')]=_0x193088['id'];_0x1395d7[_0xa670('0x4c')]['Subjects']=integrations[_0xa670('0x54')](_0x1395d7[_0xa670('0x4c')][_0xa670('0x55')],_0x1395d7[_0xa670('0x4c')][_0xa670('0x2f')]);_0x1395d7[_0xa670('0x4c')][_0xa670('0x56')]=integrations[_0xa670('0x57')](_0x1395d7[_0xa670('0x4c')][_0xa670('0x55')],_0x1395d7[_0xa670('0x4c')]['type']);return db[_0xa670('0x51')]['create'](_0x1395d7[_0xa670('0x4c')],{'include':[{'model':db[_0xa670('0x58')],'as':_0xa670('0x59')},{'model':db[_0xa670('0x58')],'as':'Descriptions'}]});}return null;})[_0xa670('0x26')](respondWithResult(_0x2f6102,null))[_0xa670('0x46')](handleError(_0x2f6102,null));};exports[_0xa670('0x5a')]=function(_0x379857,_0x333c38,_0x59f498){var _0x5bcdd3=[{'name':_0xa670('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 _0xd62013='';return db[_0xa670('0x42')][_0xa670('0x50')]({'where':{'id':_0x379857[_0xa670('0x4d')]['id']},'attributes':['id',_0xa670('0x5c'),_0xa670('0x5d'),_0xa670('0x5e'),_0xa670('0x5f'),_0xa670('0x60'),_0xa670('0x61'),_0xa670('0x62'),'tokenSecret']})[_0xa670('0x26')](handleEntityNotFound(_0x333c38,null))[_0xa670('0x26')](function(_0x5a1294){if(_0x5a1294){_0xd62013=_0x5a1294[_0xa670('0x5c')];var _0x3448ef=_0xd62013[_0xa670('0x63')](-0x1);if(_0x3448ef==='/'){_0xd62013=_0xd62013['substring'](0x0,_0xd62013[_0xa670('0x64')](_0x3448ef));}var _0x17fa8b={'method':_0xa670('0x65'),'uri':util[_0xa670('0x66')](_0xa670('0x67'),_0xd62013),'headers':{'Content-Type':_0xa670('0x68'),'Accept':_0xa670('0x68')},'json':!![]};if(_0x5a1294[_0xa670('0x5d')]===_0xa670('0x69')){_0x17fa8b[_0xa670('0x6a')][_0xa670('0x6b')]=util['format'](_0xa670('0x6c'),new Buffer(util['format'](_0xa670('0x6d'),_0x5a1294[_0xa670('0x5e')],_0x5a1294[_0xa670('0x5f')]))[_0xa670('0x6e')](_0xa670('0x6f')));}return rp(_0x17fa8b)['then'](function(_0x22a13e){return _0x5bcdd3['concat'](_[_0xa670('0x2c')](_0x22a13e[_0xa670('0x70')][_0xa670('0x71')],function(_0x13cfbf){return{'id':_0x13cfbf[_0xa670('0x29')],'name':_0x13cfbf[_0xa670('0x29')],'type':_0x13cfbf[_0xa670('0x2f')],'active':_0x13cfbf[_0xa670('0x72')],'label':_0x13cfbf['label'],'custom':!![]};}));});}})[_0xa670('0x26')](function(_0x1985a7){return{'count':_0x1985a7['length'],'rows':_0x1985a7};})[_0xa670('0x26')](respondWithResult(_0x333c38,null))['catch'](function(_0x1887e5){var _0x1dacc5=_0x379857['query']['test']?0x1f4:_0x1887e5['statusCode']||0x1f4;logger[_0xa670('0x27')](_0xa670('0x73'),_0xa670('0x5a'),_0x1dacc5,JSON[_0xa670('0x74')](_0x1887e5));delete _0x1887e5['name'];if(_0x1dacc5===0x191){_0x1dacc5=0x190;}_0x333c38[_0xa670('0x19')](_0x1dacc5)[_0xa670('0x2a')](_0x379857[_0xa670('0x32')][_0xa670('0x75')]?{'message':_0xa670('0x76'),'statusCode':_0x1887e5[_0xa670('0x77')]}:_0x1887e5);});}; \ No newline at end of file +var _0x021d=['body','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x021d,0x12a));var _0xd021=function(_0x1603d5,_0xc0b7ba){_0x1603d5=_0x1603d5-0x0;var _0x4b0e46=_0x021d[_0x1603d5];return _0x4b0e46;};'use strict';var emlformat=require(_0xd021('0x0'));var rimraf=require(_0xd021('0x1'));var zipdir=require(_0xd021('0x2'));var jsonpatch=require(_0xd021('0x3'));var rp=require(_0xd021('0x4'));var moment=require(_0xd021('0x5'));var BPromise=require(_0xd021('0x6'));var Mustache=require(_0xd021('0x7'));var util=require(_0xd021('0x8'));var path=require(_0xd021('0x9'));var sox=require(_0xd021('0xa'));var csv=require(_0xd021('0xb'));var ejs=require(_0xd021('0xc'));var fs=require('fs');var fs_extra=require(_0xd021('0xd'));var _=require(_0xd021('0xe'));var squel=require(_0xd021('0xf'));var crypto=require(_0xd021('0x10'));var jsforce=require(_0xd021('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xd021('0xb'));var querystring=require(_0xd021('0x12'));var Papa=require(_0xd021('0x13'));var Redis=require(_0xd021('0x14'));var authService=require(_0xd021('0x15'));var qs=require(_0xd021('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd021('0x17'));var logger=require(_0xd021('0x18'))(_0xd021('0x19'));var utils=require(_0xd021('0x1a'));var config=require(_0xd021('0x1b'));var licenseUtil=require(_0xd021('0x1c'));var db=require(_0xd021('0x1d'))['db'];var integrations=require(_0xd021('0x1e'));function respondWithStatusCode(_0x5454ff,_0x3d10f4){_0x3d10f4=_0x3d10f4||0xcc;return function(_0xbcf8e6){if(_0xbcf8e6){return _0x5454ff['sendStatus'](_0x3d10f4);}return _0x5454ff[_0xd021('0x1f')](_0x3d10f4)['end']();};}function respondWithResult(_0x56987d,_0x412163){_0x412163=_0x412163||0xc8;return function(_0x56220c){if(_0x56220c){return _0x56987d[_0xd021('0x1f')](_0x412163)[_0xd021('0x20')](_0x56220c);}};}function respondWithFilteredResult(_0x3702eb,_0x1b2159){return function(_0x26bd41){if(_0x26bd41){var _0x166b93=typeof _0x1b2159[_0xd021('0x21')]===_0xd021('0x22')&&typeof _0x1b2159['limit']===_0xd021('0x22');var _0x570835=_0x26bd41[_0xd021('0x23')];var _0x4d29ac=_0x166b93?0x0:_0x1b2159[_0xd021('0x21')];var _0x5c2356=_0x166b93?_0x26bd41['count']:_0x1b2159[_0xd021('0x21')]+_0x1b2159[_0xd021('0x24')];var _0x293f21;if(_0x5c2356>=_0x570835){_0x5c2356=_0x570835;_0x293f21=0xc8;}else{_0x293f21=0xce;}_0x3702eb['status'](_0x293f21);return _0x3702eb[_0xd021('0x25')]('Content-Range',_0x4d29ac+'-'+_0x5c2356+'/'+_0x570835)[_0xd021('0x20')](_0x26bd41);}return null;};}function patchUpdates(_0x215432){return function(_0xf8de15){try{jsonpatch['apply'](_0xf8de15,_0x215432,!![]);}catch(_0x32c2db){return BPromise[_0xd021('0x26')](_0x32c2db);}return _0xf8de15[_0xd021('0x27')]();};}function saveUpdates(_0x4a8b67,_0x403d09){return function(_0x20234a){if(_0x20234a){return _0x20234a[_0xd021('0x28')](_0x4a8b67)[_0xd021('0x29')](function(_0x324172){return _0x324172;});}return null;};}function removeEntity(_0x205eb1,_0x51d5d6){return function(_0x102764){if(_0x102764){return _0x102764[_0xd021('0x2a')]()['then'](function(){_0x205eb1[_0xd021('0x1f')](0xcc)[_0xd021('0x2b')]();});}};}function handleEntityNotFound(_0x5dc971,_0x3f6a46){return function(_0x235449){if(!_0x235449){_0x5dc971[_0xd021('0x2c')](0x194);}return _0x235449;};}function handleError(_0x59b624,_0x4ce8ef){_0x4ce8ef=_0x4ce8ef||0x1f4;return function(_0x3c7971){logger[_0xd021('0x2d')](_0x3c7971[_0xd021('0x2e')]);if(_0x3c7971[_0xd021('0x2f')]){delete _0x3c7971[_0xd021('0x2f')];}_0x59b624[_0xd021('0x1f')](_0x4ce8ef)[_0xd021('0x30')](_0x3c7971);};}exports[_0xd021('0x31')]=function(_0x2430b6,_0x32c15e){var _0x582263={},_0x4d3c13={},_0x38cf64={'count':0x0,'rows':[]};var _0x383682=_[_0xd021('0x32')](db['DeskAccount'][_0xd021('0x33')],function(_0x10f61){return{'name':_0x10f61[_0xd021('0x34')],'type':_0x10f61[_0xd021('0x35')]['key']};});_0x4d3c13[_0xd021('0x36')]=_[_0xd021('0x32')](_0x383682,_0xd021('0x2f'));_0x4d3c13['query']=_['keys'](_0x2430b6[_0xd021('0x37')]);_0x4d3c13[_0xd021('0x38')]=_['intersection'](_0x4d3c13[_0xd021('0x36')],_0x4d3c13[_0xd021('0x37')]);_0x582263['attributes']=_[_0xd021('0x39')](_0x4d3c13[_0xd021('0x36')],qs['fields'](_0x2430b6['query'][_0xd021('0x3a')]));_0x582263[_0xd021('0x3b')]=_0x582263['attributes'][_0xd021('0x3c')]?_0x582263[_0xd021('0x3b')]:_0x4d3c13[_0xd021('0x36')];if(!_0x2430b6[_0xd021('0x37')][_0xd021('0x3d')](_0xd021('0x3e'))){_0x582263['limit']=qs[_0xd021('0x24')](_0x2430b6['query']['limit']);_0x582263[_0xd021('0x21')]=qs[_0xd021('0x21')](_0x2430b6['query']['offset']);}_0x582263[_0xd021('0x3f')]=qs[_0xd021('0x40')](_0x2430b6[_0xd021('0x37')][_0xd021('0x40')]);_0x582263['where']=qs[_0xd021('0x38')](_[_0xd021('0x41')](_0x2430b6[_0xd021('0x37')],_0x4d3c13[_0xd021('0x38')]),_0x383682);if(_0x2430b6[_0xd021('0x37')][_0xd021('0x42')]){_0x582263[_0xd021('0x43')]=_[_0xd021('0x44')](_0x582263[_0xd021('0x43')],{'$or':_[_0xd021('0x32')](_0x383682,function(_0x28fc80){if(_0x28fc80[_0xd021('0x35')]!=='VIRTUAL'){var _0x343b84={};_0x343b84[_0x28fc80[_0xd021('0x2f')]]={'$like':'%'+_0x2430b6[_0xd021('0x37')][_0xd021('0x42')]+'%'};return _0x343b84;}})});}_0x582263=_[_0xd021('0x44')]({},_0x582263,_0x2430b6[_0xd021('0x45')]);var _0x2e4365={'where':_0x582263[_0xd021('0x43')]};return db[_0xd021('0x46')][_0xd021('0x23')](_0x2e4365)[_0xd021('0x29')](function(_0x3b1b37){_0x38cf64['count']=_0x3b1b37;if(_0x2430b6[_0xd021('0x37')][_0xd021('0x47')]){_0x582263[_0xd021('0x48')]=[{'all':!![]}];}return db['DeskAccount'][_0xd021('0x49')](_0x582263);})[_0xd021('0x29')](function(_0x39fec2){_0x38cf64[_0xd021('0x4a')]=_0x39fec2;return _0x38cf64;})[_0xd021('0x29')](respondWithFilteredResult(_0x32c15e,_0x582263))[_0xd021('0x4b')](handleError(_0x32c15e,null));};exports[_0xd021('0x4c')]=function(_0x20b341,_0x353251){var _0x5675a7={'raw':![],'where':{'id':_0x20b341['params']['id']}},_0x394e24={};_0x394e24[_0xd021('0x36')]=_[_0xd021('0x4d')](db[_0xd021('0x46')]['rawAttributes']);_0x394e24[_0xd021('0x37')]=_['keys'](_0x20b341[_0xd021('0x37')]);_0x394e24[_0xd021('0x38')]=_[_0xd021('0x39')](_0x394e24[_0xd021('0x36')],_0x394e24[_0xd021('0x37')]);_0x5675a7[_0xd021('0x3b')]=_['intersection'](_0x394e24[_0xd021('0x36')],qs['fields'](_0x20b341[_0xd021('0x37')][_0xd021('0x3a')]));_0x5675a7[_0xd021('0x3b')]=_0x5675a7[_0xd021('0x3b')][_0xd021('0x3c')]?_0x5675a7['attributes']:_0x394e24['model'];if(_0x20b341[_0xd021('0x37')][_0xd021('0x47')]){_0x5675a7['include']=[{'all':!![]}];}_0x5675a7=_[_0xd021('0x44')]({},_0x5675a7,_0x20b341['options']);return db[_0xd021('0x46')][_0xd021('0x4e')](_0x5675a7)['then'](handleEntityNotFound(_0x353251,null))[_0xd021('0x29')](respondWithResult(_0x353251,null))[_0xd021('0x4b')](handleError(_0x353251,null));};exports[_0xd021('0x4f')]=function(_0x83124d,_0xeb236){return db[_0xd021('0x46')]['create'](_0x83124d['body'],{})['then'](respondWithResult(_0xeb236,0xc9))[_0xd021('0x4b')](handleError(_0xeb236,null));};exports[_0xd021('0x28')]=function(_0x3c9924,_0x47f76e){if(_0x3c9924['body']['id']){delete _0x3c9924[_0xd021('0x50')]['id'];}return db[_0xd021('0x46')][_0xd021('0x4e')]({'where':{'id':_0x3c9924[_0xd021('0x51')]['id']}})[_0xd021('0x29')](handleEntityNotFound(_0x47f76e,null))[_0xd021('0x29')](saveUpdates(_0x3c9924[_0xd021('0x50')],null))['then'](respondWithResult(_0x47f76e,null))[_0xd021('0x4b')](handleError(_0x47f76e,null));};exports[_0xd021('0x2a')]=function(_0x34ea3c,_0x79394d){return db[_0xd021('0x46')][_0xd021('0x4e')]({'where':{'id':_0x34ea3c['params']['id']}})['then'](handleEntityNotFound(_0x79394d,null))[_0xd021('0x29')](removeEntity(_0x79394d,null))['catch'](handleError(_0x79394d,null));};exports[_0xd021('0x52')]=function(_0x1e781b,_0x4403b7,_0x317307){var _0x4939eb={};var _0x5e894e={};var _0x24539c;var _0x4be485;return db[_0xd021('0x46')]['findOne']({'where':{'id':_0x1e781b[_0xd021('0x51')]['id']}})[_0xd021('0x29')](handleEntityNotFound(_0x4403b7,null))['then'](function(_0x330f61){if(_0x330f61){_0x24539c=_0x330f61;_0x5e894e[_0xd021('0x36')]=_[_0xd021('0x4d')](db[_0xd021('0x53')][_0xd021('0x33')]);_0x5e894e[_0xd021('0x37')]=_['keys'](_0x1e781b[_0xd021('0x37')]);_0x5e894e['filters']=_['intersection'](_0x5e894e[_0xd021('0x36')],_0x5e894e[_0xd021('0x37')]);_0x4939eb['attributes']=_[_0xd021('0x39')](_0x5e894e[_0xd021('0x36')],qs[_0xd021('0x3a')](_0x1e781b[_0xd021('0x37')][_0xd021('0x3a')]));_0x4939eb[_0xd021('0x3b')]=_0x4939eb[_0xd021('0x3b')][_0xd021('0x3c')]?_0x4939eb[_0xd021('0x3b')]:_0x5e894e['model'];_0x4939eb['order']=qs[_0xd021('0x40')](_0x1e781b['query'][_0xd021('0x40')]);_0x4939eb['where']=qs[_0xd021('0x38')](_[_0xd021('0x41')](_0x1e781b[_0xd021('0x37')],_0x5e894e[_0xd021('0x38')]));if(_0x1e781b['query'][_0xd021('0x42')]){_0x4939eb['where']=_[_0xd021('0x44')](_0x4939eb[_0xd021('0x43')],{'$or':_[_0xd021('0x32')](_0x4939eb[_0xd021('0x3b')],function(_0x5ba0cb){var _0x50e301={};_0x50e301[_0x5ba0cb]={'$like':'%'+_0x1e781b[_0xd021('0x37')]['filter']+'%'};return _0x50e301;})});}_0x4939eb=_['merge']({},_0x4939eb,_0x1e781b[_0xd021('0x45')]);return _0x24539c[_0xd021('0x52')](_0x4939eb);}})['then'](function(_0x57a627){if(_0x57a627){_0x4be485=_0x57a627['length'];if(!_0x1e781b[_0xd021('0x37')][_0xd021('0x3d')](_0xd021('0x3e'))){_0x4939eb[_0xd021('0x24')]=qs[_0xd021('0x24')](_0x1e781b[_0xd021('0x37')][_0xd021('0x24')]);_0x4939eb[_0xd021('0x21')]=qs[_0xd021('0x21')](_0x1e781b[_0xd021('0x37')][_0xd021('0x21')]);}return _0x24539c[_0xd021('0x52')](_0x4939eb);}})[_0xd021('0x29')](function(_0xd49631){if(_0xd49631){return _0xd49631?{'count':_0x4be485,'rows':_0xd49631}:null;}})[_0xd021('0x29')](respondWithResult(_0x4403b7,null))[_0xd021('0x4b')](handleError(_0x4403b7,null));};exports[_0xd021('0x54')]=function(_0x715515,_0x1f41f0,_0x56c849){if(_0x715515[_0xd021('0x50')]['id']){delete _0x715515['body']['id'];}return db[_0xd021('0x46')][_0xd021('0x55')]({'where':{'id':_0x715515[_0xd021('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f41f0,null))[_0xd021('0x29')](function(_0x17d64d){if(_0x17d64d){_0x715515[_0xd021('0x50')][_0xd021('0x56')]=_0x17d64d['id'];_0x715515[_0xd021('0x50')][_0xd021('0x57')]=integrations[_0xd021('0x58')](_0x715515[_0xd021('0x50')][_0xd021('0x59')],_0x715515[_0xd021('0x50')][_0xd021('0x35')]);_0x715515['body'][_0xd021('0x5a')]=integrations[_0xd021('0x5b')](_0x715515[_0xd021('0x50')][_0xd021('0x59')],_0x715515[_0xd021('0x50')]['type']);return db[_0xd021('0x53')][_0xd021('0x4f')](_0x715515[_0xd021('0x50')],{'include':[{'model':db[_0xd021('0x5c')],'as':'Subjects'},{'model':db[_0xd021('0x5c')],'as':'Descriptions'}]});}return null;})[_0xd021('0x29')](respondWithResult(_0x1f41f0,null))[_0xd021('0x4b')](handleError(_0x1f41f0,null));};exports[_0xd021('0x5d')]=function(_0x305ec3,_0x19b43d,_0x21a4ab){var _0xd9696b=[{'name':_0xd021('0x5e'),'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 _0x5c0b75='';return db[_0xd021('0x46')][_0xd021('0x55')]({'where':{'id':_0x305ec3['params']['id']},'attributes':['id',_0xd021('0x5f'),_0xd021('0x60'),_0xd021('0x61'),_0xd021('0x62'),_0xd021('0x63'),_0xd021('0x64'),_0xd021('0x65'),_0xd021('0x66')]})[_0xd021('0x29')](handleEntityNotFound(_0x19b43d,null))[_0xd021('0x29')](function(_0x2999f2){if(_0x2999f2){_0x5c0b75=_0x2999f2[_0xd021('0x5f')];var _0x21d28a=_0x5c0b75[_0xd021('0x67')](-0x1);if(_0x21d28a==='/'){_0x5c0b75=_0x5c0b75[_0xd021('0x68')](0x0,_0x5c0b75[_0xd021('0x69')](_0x21d28a));}var _0x458ec8={'method':_0xd021('0x6a'),'uri':util[_0xd021('0x6b')](_0xd021('0x6c'),_0x5c0b75),'headers':{'Content-Type':_0xd021('0x6d'),'Accept':_0xd021('0x6d')},'json':!![]};if(_0x2999f2[_0xd021('0x60')]==='basic'){_0x458ec8[_0xd021('0x6e')][_0xd021('0x6f')]=util['format'](_0xd021('0x70'),new Buffer(util[_0xd021('0x6b')](_0xd021('0x71'),_0x2999f2[_0xd021('0x61')],_0x2999f2['password']))[_0xd021('0x72')](_0xd021('0x73')));}return rp(_0x458ec8)['then'](function(_0x531f70){return _0xd9696b[_0xd021('0x74')](_[_0xd021('0x32')](_0x531f70[_0xd021('0x75')][_0xd021('0x76')],function(_0x5ccd0e){return{'id':_0x5ccd0e['name'],'name':_0x5ccd0e['name'],'type':_0x5ccd0e[_0xd021('0x35')],'active':_0x5ccd0e[_0xd021('0x77')],'label':_0x5ccd0e[_0xd021('0x78')],'custom':!![]};}));});}})[_0xd021('0x29')](function(_0x177f05){return{'count':_0x177f05['length'],'rows':_0x177f05};})[_0xd021('0x29')](respondWithResult(_0x19b43d,null))[_0xd021('0x4b')](function(_0x362278){var _0x1d83f1=_0x305ec3[_0xd021('0x37')]['test']?0x1f4:_0x362278[_0xd021('0x79')]||0x1f4;logger['error'](_0xd021('0x7a'),'getFields',_0x1d83f1,JSON[_0xd021('0x7b')](_0x362278));delete _0x362278[_0xd021('0x2f')];if(_0x1d83f1===0x191){_0x1d83f1=0x190;}_0x19b43d[_0xd021('0x1f')](_0x1d83f1)[_0xd021('0x30')](_0x305ec3[_0xd021('0x37')][_0xd021('0x7c')]?{'message':_0xd021('0x7d'),'statusCode':_0x362278[_0xd021('0x79')]}:_0x362278);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4b3f915..1e7f872 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 _0x508a=['path','../../config/environment','define','int_desk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x477962,_0x10c034){var _0x1b904a=function(_0x49b4b5){while(--_0x49b4b5){_0x477962['push'](_0x477962['shift']());}};_0x1b904a(++_0x10c034);}(_0x508a,0xc1));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require(_0xa508('0x1'));var logger=require(_0xa508('0x2'))(_0xa508('0x3'));var moment=require('moment');var BPromise=require(_0xa508('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa508('0x5'));var rimraf=require('rimraf');var config=require(_0xa508('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1cf46a,_0x22c76d){return _0x1cf46a[_0xa508('0x7')]('DeskAccount',attributes,{'tableName':_0xa508('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c0c=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0x3d90df,_0x4c5e16){var _0x524207=function(_0x3d335b){while(--_0x3d335b){_0x3d90df['push'](_0x3d90df['shift']());}};_0x524207(++_0x4c5e16);}(_0x1c0c,0xaa));var _0xc1c0=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1c0c[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0xc1c0('0x0'));var logger=require(_0xc1c0('0x1'))('api');var moment=require(_0xc1c0('0x2'));var BPromise=require('bluebird');var rp=require(_0xc1c0('0x3'));var fs=require('fs');var path=require(_0xc1c0('0x4'));var rimraf=require('rimraf');var config=require(_0xc1c0('0x5'));var attributes=require(_0xc1c0('0x6'));var integrations=require(_0xc1c0('0x7'));module['exports']=function(_0x13c444,_0x20e64a){return _0x13c444['define'](_0xc1c0('0x8'),attributes,{'tableName':_0xc1c0('0x9'),'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 c0bf2e6..e82d9bd 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 _0xb351=['raw','where','limit','map','model','attributes','include','then','ShowDeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options'];(function(_0x14bbfa,_0x5293a4){var _0x55911e=function(_0x52bb28){while(--_0x52bb28){_0x14bbfa['push'](_0x14bbfa['shift']());}};_0x55911e(++_0x5293a4);}(_0xb351,0x1eb));var _0x1b35=function(_0x1e2372,_0x2ea876){_0x1e2372=_0x1e2372-0x0;var _0x4cd59b=_0xb351[_0x1e2372];return _0x4cd59b;};'use strict';var _=require(_0x1b35('0x0'));var util=require(_0x1b35('0x1'));var moment=require(_0x1b35('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b35('0x3'));var fs=require('fs');var Redis=require(_0x1b35('0x4'));var db=require(_0x1b35('0x5'))['db'];var utils=require(_0x1b35('0x6'));var logger=require(_0x1b35('0x7'))(_0x1b35('0x8'));var config=require(_0x1b35('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38aab0,_0x554e59,_0x1f0b78){return new BPromise(function(_0x4de123,_0x108e18){return client[_0x1b35('0xb')](_0x38aab0,_0x1f0b78)['then'](function(_0x54b81e){logger[_0x1b35('0xc')](_0x1b35('0xd'),_0x554e59,_0x1b35('0xe'));logger[_0x1b35('0xf')](_0x1b35('0x10'),_0x554e59,'request\x20sent',JSON[_0x1b35('0x11')](_0x54b81e));if(_0x54b81e[_0x1b35('0x12')]){if(_0x54b81e['error'][_0x1b35('0x13')]===0x1f4){logger['error'](_0x1b35('0xd'),_0x554e59,_0x54b81e['error']['message']);return _0x108e18(_0x54b81e[_0x1b35('0x12')][_0x1b35('0x14')]);}logger[_0x1b35('0x12')]('DeskAccount,\x20%s,\x20%s',_0x554e59,_0x54b81e[_0x1b35('0x12')]['message']);return _0x4de123(_0x54b81e[_0x1b35('0x12')][_0x1b35('0x14')]);}else{logger[_0x1b35('0xc')]('DeskAccount,\x20%s,\x20%s',_0x554e59,_0x1b35('0xe'));_0x4de123(_0x54b81e[_0x1b35('0x15')]['message']);}})[_0x1b35('0x16')](function(_0x3a68b6){logger[_0x1b35('0x12')]('DeskAccount,\x20%s,\x20%s',_0x554e59,_0x3a68b6);_0x108e18(_0x3a68b6);});});}exports[_0x1b35('0x17')]=function(_0x23ca5d){var _0x2d186f=this;return new Promise(function(_0x4da59c,_0x39800e){return db[_0x1b35('0x18')][_0x1b35('0x19')]({'raw':_0x23ca5d[_0x1b35('0x1a')]?_0x23ca5d['options'][_0x1b35('0x1b')]===undefined?!![]:![]:!![],'where':_0x23ca5d[_0x1b35('0x1a')]?_0x23ca5d['options'][_0x1b35('0x1c')]||null:null,'attributes':_0x23ca5d['options']?_0x23ca5d['options']['attributes']||null:null,'limit':_0x23ca5d[_0x1b35('0x1a')]?_0x23ca5d[_0x1b35('0x1a')][_0x1b35('0x1d')]||null:null,'include':_0x23ca5d[_0x1b35('0x1a')]?_0x23ca5d[_0x1b35('0x1a')]['include']?_[_0x1b35('0x1e')](_0x23ca5d[_0x1b35('0x1a')]['include'],function(_0x3fa757){return{'model':db[_0x3fa757[_0x1b35('0x1f')]],'as':_0x3fa757['as'],'attributes':_0x3fa757[_0x1b35('0x20')],'include':_0x3fa757[_0x1b35('0x21')]?_[_0x1b35('0x1e')](_0x3fa757[_0x1b35('0x21')],function(_0x4f6df0){return{'model':db[_0x4f6df0[_0x1b35('0x1f')]],'as':_0x4f6df0['as'],'attributes':_0x4f6df0[_0x1b35('0x20')],'include':_0x4f6df0[_0x1b35('0x21')]?_[_0x1b35('0x1e')](_0x4f6df0[_0x1b35('0x21')],function(_0x427524){return{'model':db[_0x427524['model']],'as':_0x427524['as'],'attributes':_0x427524[_0x1b35('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1b35('0x22')](function(_0x54f934){logger[_0x1b35('0xc')](_0x1b35('0x17'),_0x23ca5d);logger[_0x1b35('0xf')](_0x1b35('0x17'),_0x23ca5d,JSON[_0x1b35('0x11')](_0x54f934));_0x4da59c(_0x54f934);})[_0x1b35('0x16')](function(_0x3c96d){logger[_0x1b35('0x12')](_0x1b35('0x17'),_0x3c96d[_0x1b35('0x14')],_0x23ca5d);_0x39800e(_0x2d186f['error'](0x1f4,_0x3c96d[_0x1b35('0x14')]));});});};exports[_0x1b35('0x23')]=function(_0x969182){var _0x761c8f=this;return new Promise(function(_0x52998a,_0x20a171){return db['DeskAccount'][_0x1b35('0x24')]({'raw':_0x969182[_0x1b35('0x1a')]?_0x969182[_0x1b35('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x969182[_0x1b35('0x1a')]?_0x969182[_0x1b35('0x1a')][_0x1b35('0x1c')]||null:null,'attributes':_0x969182[_0x1b35('0x1a')]?_0x969182[_0x1b35('0x1a')][_0x1b35('0x20')]||null:null,'include':_0x969182[_0x1b35('0x1a')]?_0x969182[_0x1b35('0x1a')][_0x1b35('0x21')]?_[_0x1b35('0x1e')](_0x969182['options']['include'],function(_0xfe56c6){return{'model':db[_0xfe56c6[_0x1b35('0x1f')]],'as':_0xfe56c6['as'],'attributes':_0xfe56c6[_0x1b35('0x20')],'include':_0xfe56c6[_0x1b35('0x21')]?_[_0x1b35('0x1e')](_0xfe56c6[_0x1b35('0x21')],function(_0x363229){return{'model':db[_0x363229[_0x1b35('0x1f')]],'as':_0x363229['as'],'attributes':_0x363229['attributes'],'include':_0x363229[_0x1b35('0x21')]?_[_0x1b35('0x1e')](_0x363229[_0x1b35('0x21')],function(_0x3e19cf){return{'model':db[_0x3e19cf[_0x1b35('0x1f')]],'as':_0x3e19cf['as'],'attributes':_0x3e19cf[_0x1b35('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1b35('0x22')](function(_0x3ddaa6){logger[_0x1b35('0xc')](_0x1b35('0x23'),_0x969182);logger[_0x1b35('0xf')](_0x1b35('0x23'),_0x969182,JSON['stringify'](_0x3ddaa6));_0x52998a(_0x3ddaa6);})[_0x1b35('0x16')](function(_0x279d0c){logger[_0x1b35('0x12')](_0x1b35('0x23'),_0x279d0c[_0x1b35('0x14')],_0x969182);_0x20a171(_0x761c8f[_0x1b35('0x12')](0x1f4,_0x279d0c[_0x1b35('0x14')]));});});}; \ No newline at end of file +var _0x2512=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','DeskAccount,\x20%s,\x20%s','error','message','request\x20sent','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowDeskAccount','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2512,0xae));var _0x2251=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x2512[_0x101a17];return _0x3b76ee;};'use strict';var _=require(_0x2251('0x0'));var util=require(_0x2251('0x1'));var moment=require('moment');var BPromise=require(_0x2251('0x2'));var rs=require(_0x2251('0x3'));var fs=require('fs');var Redis=require(_0x2251('0x4'));var db=require(_0x2251('0x5'))['db'];var utils=require(_0x2251('0x6'));var logger=require('../../config/logger')(_0x2251('0x7'));var config=require(_0x2251('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2251('0x9')][_0x2251('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353df7,_0x233521,_0x176463){return new BPromise(function(_0x3c61da,_0x50fd48){return client[_0x2251('0xb')](_0x353df7,_0x176463)[_0x2251('0xc')](function(_0x543351){logger[_0x2251('0xd')]('DeskAccount,\x20%s,\x20%s',_0x233521,'request\x20sent');logger[_0x2251('0xe')](_0x2251('0xf'),_0x233521,'request\x20sent',JSON[_0x2251('0x10')](_0x543351));if(_0x543351['error']){if(_0x543351['error'][_0x2251('0x11')]===0x1f4){logger['error'](_0x2251('0x12'),_0x233521,_0x543351[_0x2251('0x13')]['message']);return _0x50fd48(_0x543351[_0x2251('0x13')][_0x2251('0x14')]);}logger[_0x2251('0x13')]('DeskAccount,\x20%s,\x20%s',_0x233521,_0x543351[_0x2251('0x13')]['message']);return _0x3c61da(_0x543351['error'][_0x2251('0x14')]);}else{logger[_0x2251('0xd')](_0x2251('0x12'),_0x233521,_0x2251('0x15'));_0x3c61da(_0x543351['result'][_0x2251('0x14')]);}})[_0x2251('0x16')](function(_0x374b59){logger['error']('DeskAccount,\x20%s,\x20%s',_0x233521,_0x374b59);_0x50fd48(_0x374b59);});});}exports[_0x2251('0x17')]=function(_0x2a08bf){var _0x5d471e=this;return new Promise(function(_0x45942c,_0x4a4dd0){return db[_0x2251('0x18')][_0x2251('0x19')]({'raw':_0x2a08bf[_0x2251('0x1a')]?_0x2a08bf[_0x2251('0x1a')][_0x2251('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a08bf[_0x2251('0x1a')]?_0x2a08bf[_0x2251('0x1a')][_0x2251('0x1c')]||null:null,'attributes':_0x2a08bf[_0x2251('0x1a')]?_0x2a08bf[_0x2251('0x1a')][_0x2251('0x1d')]||null:null,'limit':_0x2a08bf[_0x2251('0x1a')]?_0x2a08bf[_0x2251('0x1a')]['limit']||null:null,'include':_0x2a08bf['options']?_0x2a08bf[_0x2251('0x1a')][_0x2251('0x1e')]?_[_0x2251('0x1f')](_0x2a08bf[_0x2251('0x1a')]['include'],function(_0x441bf3){return{'model':db[_0x441bf3['model']],'as':_0x441bf3['as'],'attributes':_0x441bf3[_0x2251('0x1d')],'include':_0x441bf3[_0x2251('0x1e')]?_['map'](_0x441bf3['include'],function(_0x504333){return{'model':db[_0x504333[_0x2251('0x20')]],'as':_0x504333['as'],'attributes':_0x504333[_0x2251('0x1d')],'include':_0x504333['include']?_[_0x2251('0x1f')](_0x504333[_0x2251('0x1e')],function(_0x3c1b70){return{'model':db[_0x3c1b70[_0x2251('0x20')]],'as':_0x3c1b70['as'],'attributes':_0x3c1b70[_0x2251('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2251('0xc')](function(_0x18e468){logger[_0x2251('0xd')](_0x2251('0x17'),_0x2a08bf);logger[_0x2251('0xe')](_0x2251('0x17'),_0x2a08bf,JSON[_0x2251('0x10')](_0x18e468));_0x45942c(_0x18e468);})[_0x2251('0x16')](function(_0x40a029){logger[_0x2251('0x13')](_0x2251('0x17'),_0x40a029['message'],_0x2a08bf);_0x4a4dd0(_0x5d471e[_0x2251('0x13')](0x1f4,_0x40a029['message']));});});};exports['ShowDeskAccount']=function(_0x12ba45){var _0x146f3a=this;return new Promise(function(_0x1ee2e1,_0x51a5e0){return db[_0x2251('0x18')][_0x2251('0x21')]({'raw':_0x12ba45[_0x2251('0x1a')]?_0x12ba45[_0x2251('0x1a')][_0x2251('0x1b')]===undefined?!![]:![]:!![],'where':_0x12ba45[_0x2251('0x1a')]?_0x12ba45[_0x2251('0x1a')][_0x2251('0x1c')]||null:null,'attributes':_0x12ba45[_0x2251('0x1a')]?_0x12ba45[_0x2251('0x1a')][_0x2251('0x1d')]||null:null,'include':_0x12ba45[_0x2251('0x1a')]?_0x12ba45[_0x2251('0x1a')]['include']?_[_0x2251('0x1f')](_0x12ba45[_0x2251('0x1a')][_0x2251('0x1e')],function(_0x510394){return{'model':db[_0x510394['model']],'as':_0x510394['as'],'attributes':_0x510394[_0x2251('0x1d')],'include':_0x510394['include']?_[_0x2251('0x1f')](_0x510394[_0x2251('0x1e')],function(_0x3d488b){return{'model':db[_0x3d488b[_0x2251('0x20')]],'as':_0x3d488b['as'],'attributes':_0x3d488b[_0x2251('0x1d')],'include':_0x3d488b[_0x2251('0x1e')]?_[_0x2251('0x1f')](_0x3d488b[_0x2251('0x1e')],function(_0x2bdb8b){return{'model':db[_0x2bdb8b['model']],'as':_0x2bdb8b['as'],'attributes':_0x2bdb8b[_0x2251('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24c450){logger[_0x2251('0xd')](_0x2251('0x22'),_0x12ba45);logger['debug'](_0x2251('0x22'),_0x12ba45,JSON['stringify'](_0x24c450));_0x1ee2e1(_0x24c450);})[_0x2251('0x16')](function(_0x2a6258){logger[_0x2251('0x13')](_0x2251('0x22'),_0x2a6258[_0x2251('0x14')],_0x12ba45);_0x51a5e0(_0x146f3a['error'](0x1f4,_0x2a6258['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fd55842..e249c5b 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x466d9c,_0x41e552){var _0x1787f4=function(_0x1c6f40){while(--_0x1c6f40){_0x466d9c['push'](_0x466d9c['shift']());}};_0x1787f4(++_0x41e552);}(_0x7217,0x19e));var _0x7721=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7217[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x538a45,_0x4b577f){var _0x5e81b0=function(_0x1b8db2){while(--_0x1b8db2){_0x538a45['push'](_0x538a45['shift']());}};_0x5e81b0(++_0x4b577f);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index aa6c1e6..a2559f3 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 _0x2f6e=['STRING'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x2f6e,0x165));var _0xe2f6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2f6e[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe2f6('0x0')]},'description':{'type':Sequelize[_0xe2f6('0x0')]}}; \ No newline at end of file +var _0x5550=['exports','STRING','sequelize'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x5550,0xf5));var _0x0555=function(_0x369aa4,_0x86e6b5){_0x369aa4=_0x369aa4-0x0;var _0x3a7787=_0x5550[_0x369aa4];return _0x3a7787;};'use strict';var Sequelize=require(_0x0555('0x0'));module[_0x0555('0x1')]={'name':{'type':Sequelize[_0x0555('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 13ab500..50eea50 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 _0x8c63=['end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','length','include','find','create','body','update','params','DeskField','nolimit','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x378830,_0xb532d7){var _0x4e4348=function(_0x496bc4){while(--_0x496bc4){_0x378830['push'](_0x378830['shift']());}};_0x4e4348(++_0xb532d7);}(_0x8c63,0x88));var _0x38c6=function(_0x233ade,_0x349718){_0x233ade=_0x233ade-0x0;var _0x31ae9d=_0x8c63[_0x233ade];return _0x31ae9d;};'use strict';var emlformat=require(_0x38c6('0x0'));var rimraf=require(_0x38c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38c6('0x2'));var rp=require('request-promise');var moment=require(_0x38c6('0x3'));var BPromise=require(_0x38c6('0x4'));var Mustache=require(_0x38c6('0x5'));var util=require(_0x38c6('0x6'));var path=require(_0x38c6('0x7'));var sox=require(_0x38c6('0x8'));var csv=require(_0x38c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38c6('0xa'));var _=require(_0x38c6('0xb'));var squel=require('squel');var crypto=require(_0x38c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x38c6('0xd'));var toCsv=require(_0x38c6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x38c6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x38c6('0xf'));var as=require(_0x38c6('0x10'));var hardwareService=require(_0x38c6('0x11'));var logger=require('../../config/logger')(_0x38c6('0x12'));var utils=require('../../config/utils');var config=require(_0x38c6('0x13'));var licenseUtil=require(_0x38c6('0x14'));var db=require(_0x38c6('0x15'))['db'];function respondWithStatusCode(_0xbd8995,_0x3e876f){_0x3e876f=_0x3e876f||0xcc;return function(_0xdbb548){if(_0xdbb548){return _0xbd8995[_0x38c6('0x16')](_0x3e876f);}return _0xbd8995[_0x38c6('0x17')](_0x3e876f)[_0x38c6('0x18')]();};}function respondWithResult(_0x481090,_0x54de4d){_0x54de4d=_0x54de4d||0xc8;return function(_0x273d6b){if(_0x273d6b){return _0x481090[_0x38c6('0x17')](_0x54de4d)[_0x38c6('0x19')](_0x273d6b);}};}function respondWithFilteredResult(_0xf099f,_0x2a1a4c){return function(_0x1a3723){if(_0x1a3723){var _0x455c88=typeof _0x2a1a4c[_0x38c6('0x1a')]==='undefined'&&typeof _0x2a1a4c[_0x38c6('0x1b')]===_0x38c6('0x1c');var _0x2a7770=_0x1a3723[_0x38c6('0x1d')];var _0x4dd748=_0x455c88?0x0:_0x2a1a4c[_0x38c6('0x1a')];var _0x545576=_0x455c88?_0x1a3723[_0x38c6('0x1d')]:_0x2a1a4c[_0x38c6('0x1a')]+_0x2a1a4c[_0x38c6('0x1b')];var _0x25899a;if(_0x545576>=_0x2a7770){_0x545576=_0x2a7770;_0x25899a=0xc8;}else{_0x25899a=0xce;}_0xf099f['status'](_0x25899a);return _0xf099f[_0x38c6('0x1e')]('Content-Range',_0x4dd748+'-'+_0x545576+'/'+_0x2a7770)[_0x38c6('0x19')](_0x1a3723);}return null;};}function patchUpdates(_0x2c56fc){return function(_0x41e6e0){try{jsonpatch[_0x38c6('0x1f')](_0x41e6e0,_0x2c56fc,!![]);}catch(_0x4e07bb){return BPromise[_0x38c6('0x20')](_0x4e07bb);}return _0x41e6e0[_0x38c6('0x21')]();};}function saveUpdates(_0x6afbb6,_0x50d8d5){return function(_0x4c7739){if(_0x4c7739){return _0x4c7739['update'](_0x6afbb6)[_0x38c6('0x22')](function(_0x26e486){return _0x26e486;});}return null;};}function removeEntity(_0x258db1,_0x4a59d2){return function(_0x5cdc28){if(_0x5cdc28){return _0x5cdc28[_0x38c6('0x23')]()[_0x38c6('0x22')](function(){_0x258db1[_0x38c6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300b4a,_0x2dfe9c){return function(_0x5a328){if(!_0x5a328){_0x300b4a[_0x38c6('0x16')](0x194);}return _0x5a328;};}function handleError(_0x337620,_0xd8c886){_0xd8c886=_0xd8c886||0x1f4;return function(_0x516c07){logger['error'](_0x516c07['stack']);if(_0x516c07[_0x38c6('0x24')]){delete _0x516c07[_0x38c6('0x24')];}_0x337620[_0x38c6('0x17')](_0xd8c886)['send'](_0x516c07);};}exports[_0x38c6('0x25')]=function(_0x208462,_0x29cd1e){var _0x154e9a={},_0x1b24fa={},_0x5e6167={'count':0x0,'rows':[]};var _0x21257a=_[_0x38c6('0x26')](db[_0x38c6('0x27')][_0x38c6('0x28')],function(_0x529027){return{'name':_0x529027[_0x38c6('0x29')],'type':_0x529027[_0x38c6('0x2a')][_0x38c6('0x2b')]};});_0x1b24fa[_0x38c6('0x2c')]=_['map'](_0x21257a,_0x38c6('0x24'));_0x1b24fa[_0x38c6('0x2d')]=_[_0x38c6('0x2e')](_0x208462[_0x38c6('0x2d')]);_0x1b24fa['filters']=_[_0x38c6('0x2f')](_0x1b24fa['model'],_0x1b24fa['query']);_0x154e9a[_0x38c6('0x30')]=_[_0x38c6('0x2f')](_0x1b24fa[_0x38c6('0x2c')],qs[_0x38c6('0x31')](_0x208462['query'][_0x38c6('0x31')]));_0x154e9a[_0x38c6('0x30')]=_0x154e9a[_0x38c6('0x30')]['length']?_0x154e9a['attributes']:_0x1b24fa[_0x38c6('0x2c')];if(!_0x208462[_0x38c6('0x2d')][_0x38c6('0x32')]('nolimit')){_0x154e9a[_0x38c6('0x1b')]=qs['limit'](_0x208462[_0x38c6('0x2d')][_0x38c6('0x1b')]);_0x154e9a[_0x38c6('0x1a')]=qs['offset'](_0x208462[_0x38c6('0x2d')]['offset']);}_0x154e9a[_0x38c6('0x33')]=qs[_0x38c6('0x34')](_0x208462[_0x38c6('0x2d')][_0x38c6('0x34')]);_0x154e9a['where']=qs[_0x38c6('0x35')](_[_0x38c6('0x36')](_0x208462[_0x38c6('0x2d')],_0x1b24fa['filters']),_0x21257a);if(_0x208462[_0x38c6('0x2d')][_0x38c6('0x37')]){_0x154e9a[_0x38c6('0x38')]=_[_0x38c6('0x39')](_0x154e9a[_0x38c6('0x38')],{'$or':_[_0x38c6('0x26')](_0x21257a,function(_0x48386a){if(_0x48386a[_0x38c6('0x2a')]!==_0x38c6('0x3a')){var _0x2349bb={};_0x2349bb[_0x48386a[_0x38c6('0x24')]]={'$like':'%'+_0x208462['query'][_0x38c6('0x37')]+'%'};return _0x2349bb;}})});}_0x154e9a=_[_0x38c6('0x39')]({},_0x154e9a,_0x208462[_0x38c6('0x3b')]);var _0x577014={'where':_0x154e9a[_0x38c6('0x38')]};return db[_0x38c6('0x27')]['count'](_0x577014)[_0x38c6('0x22')](function(_0x9b3f4d){_0x5e6167[_0x38c6('0x1d')]=_0x9b3f4d;if(_0x208462[_0x38c6('0x2d')][_0x38c6('0x3c')]){_0x154e9a['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x154e9a);})[_0x38c6('0x22')](function(_0x1161b1){_0x5e6167[_0x38c6('0x3d')]=_0x1161b1;return _0x5e6167;})[_0x38c6('0x22')](respondWithFilteredResult(_0x29cd1e,_0x154e9a))[_0x38c6('0x3e')](handleError(_0x29cd1e,null));};exports['show']=function(_0x569e27,_0x3e393c){var _0x3c2e73={'raw':![],'where':{'id':_0x569e27['params']['id']}},_0x56dd2e={};_0x56dd2e[_0x38c6('0x2c')]=_['keys'](db[_0x38c6('0x27')][_0x38c6('0x28')]);_0x56dd2e['query']=_[_0x38c6('0x2e')](_0x569e27[_0x38c6('0x2d')]);_0x56dd2e[_0x38c6('0x35')]=_[_0x38c6('0x2f')](_0x56dd2e[_0x38c6('0x2c')],_0x56dd2e[_0x38c6('0x2d')]);_0x3c2e73[_0x38c6('0x30')]=_['intersection'](_0x56dd2e[_0x38c6('0x2c')],qs[_0x38c6('0x31')](_0x569e27[_0x38c6('0x2d')][_0x38c6('0x31')]));_0x3c2e73[_0x38c6('0x30')]=_0x3c2e73[_0x38c6('0x30')][_0x38c6('0x3f')]?_0x3c2e73[_0x38c6('0x30')]:_0x56dd2e[_0x38c6('0x2c')];if(_0x569e27['query'][_0x38c6('0x3c')]){_0x3c2e73[_0x38c6('0x40')]=[{'all':!![]}];}_0x3c2e73=_['merge']({},_0x3c2e73,_0x569e27['options']);return db['DeskConfiguration'][_0x38c6('0x41')](_0x3c2e73)[_0x38c6('0x22')](handleEntityNotFound(_0x3e393c,null))[_0x38c6('0x22')](respondWithResult(_0x3e393c,null))[_0x38c6('0x3e')](handleError(_0x3e393c,null));};exports[_0x38c6('0x42')]=function(_0x2448ba,_0x5194fb){return db[_0x38c6('0x27')][_0x38c6('0x42')](_0x2448ba[_0x38c6('0x43')],{})['then'](respondWithResult(_0x5194fb,0xc9))[_0x38c6('0x3e')](handleError(_0x5194fb,null));};exports[_0x38c6('0x44')]=function(_0x5cfe22,_0x43893d){if(_0x5cfe22[_0x38c6('0x43')]['id']){delete _0x5cfe22['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x5cfe22[_0x38c6('0x45')]['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x43893d,null))[_0x38c6('0x22')](saveUpdates(_0x5cfe22[_0x38c6('0x43')],null))[_0x38c6('0x22')](respondWithResult(_0x43893d,null))[_0x38c6('0x3e')](handleError(_0x43893d,null));};exports[_0x38c6('0x23')]=function(_0x3ecd3a,_0x3b2882){return db[_0x38c6('0x27')]['find']({'where':{'id':_0x3ecd3a[_0x38c6('0x45')]['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x3b2882,null))[_0x38c6('0x22')](removeEntity(_0x3b2882,null))['catch'](handleError(_0x3b2882,null));};exports['getFields']=function(_0x579612,_0x3213bc,_0x598be7){var _0x41aa7f={};var _0xe369b0={};var _0x5036ee;var _0x52565a;return db[_0x38c6('0x27')]['findOne']({'where':{'id':_0x579612[_0x38c6('0x45')]['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x3213bc,null))[_0x38c6('0x22')](function(_0x1a822f){if(_0x1a822f){_0x5036ee=_0x1a822f;_0xe369b0['model']=_[_0x38c6('0x2e')](db[_0x38c6('0x46')][_0x38c6('0x28')]);_0xe369b0['query']=_['keys'](_0x579612[_0x38c6('0x2d')]);_0xe369b0[_0x38c6('0x35')]=_['intersection'](_0xe369b0[_0x38c6('0x2c')],_0xe369b0[_0x38c6('0x2d')]);_0x41aa7f['attributes']=_[_0x38c6('0x2f')](_0xe369b0['model'],qs['fields'](_0x579612[_0x38c6('0x2d')]['fields']));_0x41aa7f['attributes']=_0x41aa7f['attributes'][_0x38c6('0x3f')]?_0x41aa7f['attributes']:_0xe369b0[_0x38c6('0x2c')];_0x41aa7f[_0x38c6('0x33')]=qs['sort'](_0x579612['query'][_0x38c6('0x34')]);_0x41aa7f[_0x38c6('0x38')]=qs['filters'](_[_0x38c6('0x36')](_0x579612['query'],_0xe369b0[_0x38c6('0x35')]));if(_0x579612[_0x38c6('0x2d')][_0x38c6('0x37')]){_0x41aa7f['where']=_[_0x38c6('0x39')](_0x41aa7f[_0x38c6('0x38')],{'$or':_[_0x38c6('0x26')](_0x41aa7f['attributes'],function(_0x5b9ac3){var _0x165da9={};_0x165da9[_0x5b9ac3]={'$like':'%'+_0x579612[_0x38c6('0x2d')]['filter']+'%'};return _0x165da9;})});}_0x41aa7f=_[_0x38c6('0x39')]({},_0x41aa7f,_0x579612[_0x38c6('0x3b')]);return _0x5036ee['getFields'](_0x41aa7f);}})['then'](function(_0x34598f){if(_0x34598f){_0x52565a=_0x34598f[_0x38c6('0x3f')];if(!_0x579612['query']['hasOwnProperty'](_0x38c6('0x47'))){_0x41aa7f[_0x38c6('0x1b')]=qs[_0x38c6('0x1b')](_0x579612['query'][_0x38c6('0x1b')]);_0x41aa7f[_0x38c6('0x1a')]=qs[_0x38c6('0x1a')](_0x579612['query'][_0x38c6('0x1a')]);}return _0x5036ee[_0x38c6('0x48')](_0x41aa7f);}})[_0x38c6('0x22')](function(_0x539db7){if(_0x539db7){return _0x539db7?{'count':_0x52565a,'rows':_0x539db7}:null;}})[_0x38c6('0x22')](respondWithResult(_0x3213bc,null))[_0x38c6('0x3e')](handleError(_0x3213bc,null));};exports[_0x38c6('0x49')]=function(_0x44fd70,_0x2b37d1,_0x32ec19){var _0x277c9f={};var _0x41e643={};var _0x12c751;var _0x50f720;return db[_0x38c6('0x27')]['findOne']({'where':{'id':_0x44fd70['params']['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x2b37d1,null))[_0x38c6('0x22')](function(_0x581f38){if(_0x581f38){_0x12c751=_0x581f38;_0x41e643[_0x38c6('0x2c')]=_[_0x38c6('0x2e')](db[_0x38c6('0x46')][_0x38c6('0x28')]);_0x41e643[_0x38c6('0x2d')]=_[_0x38c6('0x2e')](_0x44fd70[_0x38c6('0x2d')]);_0x41e643[_0x38c6('0x35')]=_['intersection'](_0x41e643[_0x38c6('0x2c')],_0x41e643[_0x38c6('0x2d')]);_0x277c9f[_0x38c6('0x30')]=_[_0x38c6('0x2f')](_0x41e643[_0x38c6('0x2c')],qs[_0x38c6('0x31')](_0x44fd70[_0x38c6('0x2d')][_0x38c6('0x31')]));_0x277c9f[_0x38c6('0x30')]=_0x277c9f['attributes'][_0x38c6('0x3f')]?_0x277c9f[_0x38c6('0x30')]:_0x41e643[_0x38c6('0x2c')];_0x277c9f[_0x38c6('0x33')]=qs[_0x38c6('0x34')](_0x44fd70[_0x38c6('0x2d')][_0x38c6('0x34')]);_0x277c9f[_0x38c6('0x38')]=qs[_0x38c6('0x35')](_[_0x38c6('0x36')](_0x44fd70[_0x38c6('0x2d')],_0x41e643['filters']));if(_0x44fd70[_0x38c6('0x2d')]['filter']){_0x277c9f[_0x38c6('0x38')]=_['merge'](_0x277c9f['where'],{'$or':_[_0x38c6('0x26')](_0x277c9f[_0x38c6('0x30')],function(_0x30767b){var _0x50e735={};_0x50e735[_0x30767b]={'$like':'%'+_0x44fd70['query'][_0x38c6('0x37')]+'%'};return _0x50e735;})});}_0x277c9f=_[_0x38c6('0x39')]({},_0x277c9f,_0x44fd70[_0x38c6('0x3b')]);return _0x12c751[_0x38c6('0x49')](_0x277c9f);}})[_0x38c6('0x22')](function(_0x5aa9a6){if(_0x5aa9a6){_0x50f720=_0x5aa9a6[_0x38c6('0x3f')];if(!_0x44fd70[_0x38c6('0x2d')][_0x38c6('0x32')]('nolimit')){_0x277c9f[_0x38c6('0x1b')]=qs['limit'](_0x44fd70['query'][_0x38c6('0x1b')]);_0x277c9f['offset']=qs[_0x38c6('0x1a')](_0x44fd70[_0x38c6('0x2d')][_0x38c6('0x1a')]);}return _0x12c751[_0x38c6('0x49')](_0x277c9f);}})[_0x38c6('0x22')](function(_0xa99133){if(_0xa99133){return _0xa99133?{'count':_0x50f720,'rows':_0xa99133}:null;}})['then'](respondWithResult(_0x2b37d1,null))['catch'](handleError(_0x2b37d1,null));};exports['getDescriptions']=function(_0x51ed89,_0x35306c,_0x4be9c5){var _0x5ef5c0={};var _0x5e4af8={};var _0x1a2b91;var _0x3a12ba;return db[_0x38c6('0x27')][_0x38c6('0x4a')]({'where':{'id':_0x51ed89[_0x38c6('0x45')]['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x35306c,null))['then'](function(_0x1d3722){if(_0x1d3722){_0x1a2b91=_0x1d3722;_0x5e4af8[_0x38c6('0x2c')]=_[_0x38c6('0x2e')](db[_0x38c6('0x46')]['rawAttributes']);_0x5e4af8['query']=_['keys'](_0x51ed89[_0x38c6('0x2d')]);_0x5e4af8['filters']=_[_0x38c6('0x2f')](_0x5e4af8[_0x38c6('0x2c')],_0x5e4af8['query']);_0x5ef5c0[_0x38c6('0x30')]=_[_0x38c6('0x2f')](_0x5e4af8[_0x38c6('0x2c')],qs[_0x38c6('0x31')](_0x51ed89[_0x38c6('0x2d')][_0x38c6('0x31')]));_0x5ef5c0[_0x38c6('0x30')]=_0x5ef5c0[_0x38c6('0x30')]['length']?_0x5ef5c0[_0x38c6('0x30')]:_0x5e4af8[_0x38c6('0x2c')];_0x5ef5c0[_0x38c6('0x33')]=qs[_0x38c6('0x34')](_0x51ed89[_0x38c6('0x2d')][_0x38c6('0x34')]);_0x5ef5c0[_0x38c6('0x38')]=qs['filters'](_[_0x38c6('0x36')](_0x51ed89[_0x38c6('0x2d')],_0x5e4af8['filters']));if(_0x51ed89['query'][_0x38c6('0x37')]){_0x5ef5c0[_0x38c6('0x38')]=_['merge'](_0x5ef5c0[_0x38c6('0x38')],{'$or':_[_0x38c6('0x26')](_0x5ef5c0[_0x38c6('0x30')],function(_0x276c6b){var _0x3d68e3={};_0x3d68e3[_0x276c6b]={'$like':'%'+_0x51ed89[_0x38c6('0x2d')][_0x38c6('0x37')]+'%'};return _0x3d68e3;})});}_0x5ef5c0=_[_0x38c6('0x39')]({},_0x5ef5c0,_0x51ed89[_0x38c6('0x3b')]);return _0x1a2b91[_0x38c6('0x4b')](_0x5ef5c0);}})[_0x38c6('0x22')](function(_0x3ba447){if(_0x3ba447){_0x3a12ba=_0x3ba447['length'];if(!_0x51ed89[_0x38c6('0x2d')][_0x38c6('0x32')]('nolimit')){_0x5ef5c0[_0x38c6('0x1b')]=qs[_0x38c6('0x1b')](_0x51ed89[_0x38c6('0x2d')][_0x38c6('0x1b')]);_0x5ef5c0[_0x38c6('0x1a')]=qs[_0x38c6('0x1a')](_0x51ed89['query'][_0x38c6('0x1a')]);}return _0x1a2b91[_0x38c6('0x4b')](_0x5ef5c0);}})[_0x38c6('0x22')](function(_0x45e571){if(_0x45e571){return _0x45e571?{'count':_0x3a12ba,'rows':_0x45e571}:null;}})[_0x38c6('0x22')](respondWithResult(_0x35306c,null))['catch'](handleError(_0x35306c,null));};exports[_0x38c6('0x4c')]=function(_0x33c33e,_0x59bb79,_0x21d3ca){var _0x3cb1fe={};var _0xcc990b={};var _0x180429;var _0x52ae56;return db[_0x38c6('0x27')][_0x38c6('0x4a')]({'where':{'id':_0x33c33e[_0x38c6('0x45')]['id']}})[_0x38c6('0x22')](handleEntityNotFound(_0x59bb79,null))['then'](function(_0x2306fd){if(_0x2306fd){_0x180429=_0x2306fd;_0xcc990b['model']=_[_0x38c6('0x2e')](db[_0x38c6('0x4d')][_0x38c6('0x28')]);_0xcc990b[_0x38c6('0x2d')]=_[_0x38c6('0x2e')](_0x33c33e[_0x38c6('0x2d')]);_0xcc990b[_0x38c6('0x35')]=_[_0x38c6('0x2f')](_0xcc990b[_0x38c6('0x2c')],_0xcc990b[_0x38c6('0x2d')]);_0x3cb1fe[_0x38c6('0x30')]=_[_0x38c6('0x2f')](_0xcc990b[_0x38c6('0x2c')],qs[_0x38c6('0x31')](_0x33c33e[_0x38c6('0x2d')][_0x38c6('0x31')]));_0x3cb1fe[_0x38c6('0x30')]=_0x3cb1fe[_0x38c6('0x30')]['length']?_0x3cb1fe[_0x38c6('0x30')]:_0xcc990b[_0x38c6('0x2c')];_0x3cb1fe['order']=qs[_0x38c6('0x34')](_0x33c33e[_0x38c6('0x2d')][_0x38c6('0x34')]);_0x3cb1fe[_0x38c6('0x38')]=qs[_0x38c6('0x35')](_[_0x38c6('0x36')](_0x33c33e['query'],_0xcc990b[_0x38c6('0x35')]));if(_0x33c33e['query'][_0x38c6('0x37')]){_0x3cb1fe[_0x38c6('0x38')]=_['merge'](_0x3cb1fe[_0x38c6('0x38')],{'$or':_[_0x38c6('0x26')](_0x3cb1fe[_0x38c6('0x30')],function(_0x811fe9){var _0x1b3477={};_0x1b3477[_0x811fe9]={'$like':'%'+_0x33c33e[_0x38c6('0x2d')][_0x38c6('0x37')]+'%'};return _0x1b3477;})});}_0x3cb1fe=_[_0x38c6('0x39')]({},_0x3cb1fe,_0x33c33e[_0x38c6('0x3b')]);return _0x180429[_0x38c6('0x4c')](_0x3cb1fe);}})[_0x38c6('0x22')](function(_0x45e07b){if(_0x45e07b){_0x52ae56=_0x45e07b['length'];if(!_0x33c33e['query'][_0x38c6('0x32')](_0x38c6('0x47'))){_0x3cb1fe[_0x38c6('0x1b')]=qs[_0x38c6('0x1b')](_0x33c33e[_0x38c6('0x2d')][_0x38c6('0x1b')]);_0x3cb1fe[_0x38c6('0x1a')]=qs['offset'](_0x33c33e[_0x38c6('0x2d')][_0x38c6('0x1a')]);}return _0x180429['getTags'](_0x3cb1fe);}})[_0x38c6('0x22')](function(_0x9a028f){if(_0x9a028f){return _0x9a028f?{'count':_0x52ae56,'rows':_0x9a028f}:null;}})['then'](respondWithResult(_0x59bb79,null))[_0x38c6('0x3e')](handleError(_0x59bb79,null));};exports[_0x38c6('0x4e')]=function(_0x55acd6,_0x4ff69a,_0x240a2a){if(_0x55acd6[_0x38c6('0x43')]['id']){delete _0x55acd6[_0x38c6('0x43')]['id'];}return db[_0x38c6('0x27')][_0x38c6('0x4a')]({'where':{'id':_0x55acd6[_0x38c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ff69a,null))[_0x38c6('0x22')](function(_0x16a778){if(_0x16a778){return _0x16a778['setTags'](_0x55acd6[_0x38c6('0x43')][_0x38c6('0x4f')]||[]);}return null;})[_0x38c6('0x22')](respondWithResult(_0x4ff69a,null))[_0x38c6('0x3e')](handleError(_0x4ff69a,null));}; \ No newline at end of file +var _0x63e3=['offset','limit','set','apply','reject','save','update','destroy','then','end','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','body','getFields','DeskField','getSubjects','findOne','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x63e3,0x18b));var _0x363e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x63e3[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x363e('0x0'));var rimraf=require(_0x363e('0x1'));var zipdir=require(_0x363e('0x2'));var jsonpatch=require(_0x363e('0x3'));var rp=require(_0x363e('0x4'));var moment=require(_0x363e('0x5'));var BPromise=require(_0x363e('0x6'));var Mustache=require(_0x363e('0x7'));var util=require('util');var path=require(_0x363e('0x8'));var sox=require(_0x363e('0x9'));var csv=require(_0x363e('0xa'));var ejs=require(_0x363e('0xb'));var fs=require('fs');var fs_extra=require(_0x363e('0xc'));var _=require(_0x363e('0xd'));var squel=require('squel');var crypto=require(_0x363e('0xe'));var jsforce=require(_0x363e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x363e('0xa'));var querystring=require(_0x363e('0x10'));var Papa=require(_0x363e('0x11'));var Redis=require(_0x363e('0x12'));var authService=require(_0x363e('0x13'));var qs=require(_0x363e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x363e('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x363e('0x16'));var licenseUtil=require(_0x363e('0x17'));var db=require(_0x363e('0x18'))['db'];function respondWithStatusCode(_0x36bc10,_0x576eee){_0x576eee=_0x576eee||0xcc;return function(_0x3e1d4f){if(_0x3e1d4f){return _0x36bc10[_0x363e('0x19')](_0x576eee);}return _0x36bc10[_0x363e('0x1a')](_0x576eee)['end']();};}function respondWithResult(_0xb629cb,_0x44d328){_0x44d328=_0x44d328||0xc8;return function(_0x2ca596){if(_0x2ca596){return _0xb629cb[_0x363e('0x1a')](_0x44d328)[_0x363e('0x1b')](_0x2ca596);}};}function respondWithFilteredResult(_0x136eec,_0xd7a638){return function(_0x2eee6b){if(_0x2eee6b){var _0x282ea0=typeof _0xd7a638['offset']==='undefined'&&typeof _0xd7a638['limit']===_0x363e('0x1c');var _0x22791f=_0x2eee6b[_0x363e('0x1d')];var _0x174495=_0x282ea0?0x0:_0xd7a638['offset'];var _0x51b72a=_0x282ea0?_0x2eee6b[_0x363e('0x1d')]:_0xd7a638[_0x363e('0x1e')]+_0xd7a638[_0x363e('0x1f')];var _0x581d4e;if(_0x51b72a>=_0x22791f){_0x51b72a=_0x22791f;_0x581d4e=0xc8;}else{_0x581d4e=0xce;}_0x136eec[_0x363e('0x1a')](_0x581d4e);return _0x136eec[_0x363e('0x20')]('Content-Range',_0x174495+'-'+_0x51b72a+'/'+_0x22791f)[_0x363e('0x1b')](_0x2eee6b);}return null;};}function patchUpdates(_0x13844a){return function(_0xdf2ba8){try{jsonpatch[_0x363e('0x21')](_0xdf2ba8,_0x13844a,!![]);}catch(_0x12f0b0){return BPromise[_0x363e('0x22')](_0x12f0b0);}return _0xdf2ba8[_0x363e('0x23')]();};}function saveUpdates(_0x1ca90b,_0x2b34d5){return function(_0x3347b9){if(_0x3347b9){return _0x3347b9[_0x363e('0x24')](_0x1ca90b)['then'](function(_0x48f787){return _0x48f787;});}return null;};}function removeEntity(_0x3b3c7e,_0x5b3414){return function(_0x478b9b){if(_0x478b9b){return _0x478b9b[_0x363e('0x25')]()[_0x363e('0x26')](function(){_0x3b3c7e[_0x363e('0x1a')](0xcc)[_0x363e('0x27')]();});}};}function handleEntityNotFound(_0x5653bd,_0x5a6660){return function(_0x2f9999){if(!_0x2f9999){_0x5653bd[_0x363e('0x19')](0x194);}return _0x2f9999;};}function handleError(_0x18e39c,_0x105d16){_0x105d16=_0x105d16||0x1f4;return function(_0x2e7da9){logger['error'](_0x2e7da9[_0x363e('0x28')]);if(_0x2e7da9[_0x363e('0x29')]){delete _0x2e7da9[_0x363e('0x29')];}_0x18e39c[_0x363e('0x1a')](_0x105d16)[_0x363e('0x2a')](_0x2e7da9);};}exports['index']=function(_0x346d14,_0x29f03a){var _0x488324={},_0x5eaa6b={},_0x424c3e={'count':0x0,'rows':[]};var _0x27f34d=_['map'](db['DeskConfiguration'][_0x363e('0x2b')],function(_0x48ed17){return{'name':_0x48ed17[_0x363e('0x2c')],'type':_0x48ed17[_0x363e('0x2d')][_0x363e('0x2e')]};});_0x5eaa6b[_0x363e('0x2f')]=_[_0x363e('0x30')](_0x27f34d,_0x363e('0x29'));_0x5eaa6b[_0x363e('0x31')]=_['keys'](_0x346d14['query']);_0x5eaa6b[_0x363e('0x32')]=_[_0x363e('0x33')](_0x5eaa6b[_0x363e('0x2f')],_0x5eaa6b[_0x363e('0x31')]);_0x488324[_0x363e('0x34')]=_[_0x363e('0x33')](_0x5eaa6b['model'],qs['fields'](_0x346d14[_0x363e('0x31')]['fields']));_0x488324[_0x363e('0x34')]=_0x488324[_0x363e('0x34')]['length']?_0x488324[_0x363e('0x34')]:_0x5eaa6b['model'];if(!_0x346d14[_0x363e('0x31')]['hasOwnProperty'](_0x363e('0x35'))){_0x488324['limit']=qs[_0x363e('0x1f')](_0x346d14['query'][_0x363e('0x1f')]);_0x488324[_0x363e('0x1e')]=qs[_0x363e('0x1e')](_0x346d14[_0x363e('0x31')][_0x363e('0x1e')]);}_0x488324[_0x363e('0x36')]=qs[_0x363e('0x37')](_0x346d14['query']['sort']);_0x488324['where']=qs[_0x363e('0x32')](_[_0x363e('0x38')](_0x346d14[_0x363e('0x31')],_0x5eaa6b[_0x363e('0x32')]),_0x27f34d);if(_0x346d14[_0x363e('0x31')][_0x363e('0x39')]){_0x488324[_0x363e('0x3a')]=_[_0x363e('0x3b')](_0x488324[_0x363e('0x3a')],{'$or':_[_0x363e('0x30')](_0x27f34d,function(_0x347505){if(_0x347505['type']!==_0x363e('0x3c')){var _0x1de100={};_0x1de100[_0x347505[_0x363e('0x29')]]={'$like':'%'+_0x346d14[_0x363e('0x31')]['filter']+'%'};return _0x1de100;}})});}_0x488324=_[_0x363e('0x3b')]({},_0x488324,_0x346d14[_0x363e('0x3d')]);var _0xe47c37={'where':_0x488324['where']};return db[_0x363e('0x3e')]['count'](_0xe47c37)['then'](function(_0x1556f7){_0x424c3e['count']=_0x1556f7;if(_0x346d14[_0x363e('0x31')][_0x363e('0x3f')]){_0x488324['include']=[{'all':!![]}];}return db[_0x363e('0x3e')][_0x363e('0x40')](_0x488324);})[_0x363e('0x26')](function(_0xdb1c3f){_0x424c3e[_0x363e('0x41')]=_0xdb1c3f;return _0x424c3e;})[_0x363e('0x26')](respondWithFilteredResult(_0x29f03a,_0x488324))[_0x363e('0x42')](handleError(_0x29f03a,null));};exports[_0x363e('0x43')]=function(_0x387bb4,_0x3eb457){var _0x1ca153={'raw':![],'where':{'id':_0x387bb4[_0x363e('0x44')]['id']}},_0xdffd67={};_0xdffd67[_0x363e('0x2f')]=_[_0x363e('0x45')](db[_0x363e('0x3e')][_0x363e('0x2b')]);_0xdffd67[_0x363e('0x31')]=_[_0x363e('0x45')](_0x387bb4['query']);_0xdffd67[_0x363e('0x32')]=_[_0x363e('0x33')](_0xdffd67[_0x363e('0x2f')],_0xdffd67[_0x363e('0x31')]);_0x1ca153['attributes']=_['intersection'](_0xdffd67[_0x363e('0x2f')],qs[_0x363e('0x46')](_0x387bb4[_0x363e('0x31')][_0x363e('0x46')]));_0x1ca153['attributes']=_0x1ca153[_0x363e('0x34')][_0x363e('0x47')]?_0x1ca153[_0x363e('0x34')]:_0xdffd67[_0x363e('0x2f')];if(_0x387bb4['query']['includeAll']){_0x1ca153[_0x363e('0x48')]=[{'all':!![]}];}_0x1ca153=_[_0x363e('0x3b')]({},_0x1ca153,_0x387bb4[_0x363e('0x3d')]);return db[_0x363e('0x3e')][_0x363e('0x49')](_0x1ca153)[_0x363e('0x26')](handleEntityNotFound(_0x3eb457,null))[_0x363e('0x26')](respondWithResult(_0x3eb457,null))['catch'](handleError(_0x3eb457,null));};exports[_0x363e('0x4a')]=function(_0x10b744,_0xdb0027){return db[_0x363e('0x3e')][_0x363e('0x4a')](_0x10b744['body'],{})[_0x363e('0x26')](respondWithResult(_0xdb0027,0xc9))[_0x363e('0x42')](handleError(_0xdb0027,null));};exports['update']=function(_0x1a48a7,_0x496f42){if(_0x1a48a7[_0x363e('0x4b')]['id']){delete _0x1a48a7[_0x363e('0x4b')]['id'];}return db[_0x363e('0x3e')][_0x363e('0x49')]({'where':{'id':_0x1a48a7[_0x363e('0x44')]['id']}})['then'](handleEntityNotFound(_0x496f42,null))['then'](saveUpdates(_0x1a48a7[_0x363e('0x4b')],null))[_0x363e('0x26')](respondWithResult(_0x496f42,null))[_0x363e('0x42')](handleError(_0x496f42,null));};exports[_0x363e('0x25')]=function(_0x1f28d2,_0x579bb7){return db['DeskConfiguration']['find']({'where':{'id':_0x1f28d2[_0x363e('0x44')]['id']}})[_0x363e('0x26')](handleEntityNotFound(_0x579bb7,null))[_0x363e('0x26')](removeEntity(_0x579bb7,null))[_0x363e('0x42')](handleError(_0x579bb7,null));};exports[_0x363e('0x4c')]=function(_0xd15062,_0x3f29ad,_0x333c39){var _0x171286={};var _0x49af3b={};var _0x116a6c;var _0x421155;return db['DeskConfiguration']['findOne']({'where':{'id':_0xd15062['params']['id']}})[_0x363e('0x26')](handleEntityNotFound(_0x3f29ad,null))[_0x363e('0x26')](function(_0x3b0c10){if(_0x3b0c10){_0x116a6c=_0x3b0c10;_0x49af3b[_0x363e('0x2f')]=_[_0x363e('0x45')](db[_0x363e('0x4d')][_0x363e('0x2b')]);_0x49af3b[_0x363e('0x31')]=_[_0x363e('0x45')](_0xd15062[_0x363e('0x31')]);_0x49af3b[_0x363e('0x32')]=_[_0x363e('0x33')](_0x49af3b[_0x363e('0x2f')],_0x49af3b[_0x363e('0x31')]);_0x171286[_0x363e('0x34')]=_[_0x363e('0x33')](_0x49af3b[_0x363e('0x2f')],qs[_0x363e('0x46')](_0xd15062[_0x363e('0x31')][_0x363e('0x46')]));_0x171286[_0x363e('0x34')]=_0x171286[_0x363e('0x34')][_0x363e('0x47')]?_0x171286[_0x363e('0x34')]:_0x49af3b[_0x363e('0x2f')];_0x171286[_0x363e('0x36')]=qs[_0x363e('0x37')](_0xd15062['query'][_0x363e('0x37')]);_0x171286[_0x363e('0x3a')]=qs['filters'](_[_0x363e('0x38')](_0xd15062['query'],_0x49af3b['filters']));if(_0xd15062[_0x363e('0x31')]['filter']){_0x171286['where']=_[_0x363e('0x3b')](_0x171286[_0x363e('0x3a')],{'$or':_[_0x363e('0x30')](_0x171286[_0x363e('0x34')],function(_0x2c7b0a){var _0x13fbb3={};_0x13fbb3[_0x2c7b0a]={'$like':'%'+_0xd15062['query']['filter']+'%'};return _0x13fbb3;})});}_0x171286=_[_0x363e('0x3b')]({},_0x171286,_0xd15062[_0x363e('0x3d')]);return _0x116a6c[_0x363e('0x4c')](_0x171286);}})[_0x363e('0x26')](function(_0x10e359){if(_0x10e359){_0x421155=_0x10e359[_0x363e('0x47')];if(!_0xd15062[_0x363e('0x31')]['hasOwnProperty'](_0x363e('0x35'))){_0x171286[_0x363e('0x1f')]=qs[_0x363e('0x1f')](_0xd15062['query'][_0x363e('0x1f')]);_0x171286['offset']=qs[_0x363e('0x1e')](_0xd15062[_0x363e('0x31')][_0x363e('0x1e')]);}return _0x116a6c[_0x363e('0x4c')](_0x171286);}})['then'](function(_0x1f5dd9){if(_0x1f5dd9){return _0x1f5dd9?{'count':_0x421155,'rows':_0x1f5dd9}:null;}})['then'](respondWithResult(_0x3f29ad,null))['catch'](handleError(_0x3f29ad,null));};exports[_0x363e('0x4e')]=function(_0x48819d,_0x3caf89,_0x5eee4f){var _0x2535db={};var _0x40356a={};var _0x3eb770;var _0x44c17b;return db[_0x363e('0x3e')][_0x363e('0x4f')]({'where':{'id':_0x48819d[_0x363e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3caf89,null))[_0x363e('0x26')](function(_0x14486b){if(_0x14486b){_0x3eb770=_0x14486b;_0x40356a[_0x363e('0x2f')]=_['keys'](db[_0x363e('0x4d')][_0x363e('0x2b')]);_0x40356a[_0x363e('0x31')]=_[_0x363e('0x45')](_0x48819d[_0x363e('0x31')]);_0x40356a['filters']=_[_0x363e('0x33')](_0x40356a[_0x363e('0x2f')],_0x40356a[_0x363e('0x31')]);_0x2535db['attributes']=_[_0x363e('0x33')](_0x40356a['model'],qs[_0x363e('0x46')](_0x48819d[_0x363e('0x31')][_0x363e('0x46')]));_0x2535db[_0x363e('0x34')]=_0x2535db[_0x363e('0x34')][_0x363e('0x47')]?_0x2535db[_0x363e('0x34')]:_0x40356a[_0x363e('0x2f')];_0x2535db[_0x363e('0x36')]=qs[_0x363e('0x37')](_0x48819d[_0x363e('0x31')][_0x363e('0x37')]);_0x2535db[_0x363e('0x3a')]=qs[_0x363e('0x32')](_[_0x363e('0x38')](_0x48819d[_0x363e('0x31')],_0x40356a[_0x363e('0x32')]));if(_0x48819d[_0x363e('0x31')]['filter']){_0x2535db[_0x363e('0x3a')]=_['merge'](_0x2535db[_0x363e('0x3a')],{'$or':_[_0x363e('0x30')](_0x2535db[_0x363e('0x34')],function(_0x3eaca8){var _0x53f51e={};_0x53f51e[_0x3eaca8]={'$like':'%'+_0x48819d[_0x363e('0x31')][_0x363e('0x39')]+'%'};return _0x53f51e;})});}_0x2535db=_[_0x363e('0x3b')]({},_0x2535db,_0x48819d[_0x363e('0x3d')]);return _0x3eb770[_0x363e('0x4e')](_0x2535db);}})[_0x363e('0x26')](function(_0x41ac95){if(_0x41ac95){_0x44c17b=_0x41ac95[_0x363e('0x47')];if(!_0x48819d[_0x363e('0x31')][_0x363e('0x50')](_0x363e('0x35'))){_0x2535db['limit']=qs[_0x363e('0x1f')](_0x48819d[_0x363e('0x31')][_0x363e('0x1f')]);_0x2535db[_0x363e('0x1e')]=qs[_0x363e('0x1e')](_0x48819d['query'][_0x363e('0x1e')]);}return _0x3eb770[_0x363e('0x4e')](_0x2535db);}})[_0x363e('0x26')](function(_0x4b7568){if(_0x4b7568){return _0x4b7568?{'count':_0x44c17b,'rows':_0x4b7568}:null;}})[_0x363e('0x26')](respondWithResult(_0x3caf89,null))[_0x363e('0x42')](handleError(_0x3caf89,null));};exports[_0x363e('0x51')]=function(_0x6f2122,_0x567e04,_0x36bf83){var _0x384387={};var _0x520b3e={};var _0x3123f1;var _0xc44547;return db[_0x363e('0x3e')][_0x363e('0x4f')]({'where':{'id':_0x6f2122['params']['id']}})[_0x363e('0x26')](handleEntityNotFound(_0x567e04,null))[_0x363e('0x26')](function(_0x16c654){if(_0x16c654){_0x3123f1=_0x16c654;_0x520b3e[_0x363e('0x2f')]=_[_0x363e('0x45')](db[_0x363e('0x4d')][_0x363e('0x2b')]);_0x520b3e[_0x363e('0x31')]=_[_0x363e('0x45')](_0x6f2122['query']);_0x520b3e['filters']=_[_0x363e('0x33')](_0x520b3e[_0x363e('0x2f')],_0x520b3e[_0x363e('0x31')]);_0x384387['attributes']=_[_0x363e('0x33')](_0x520b3e[_0x363e('0x2f')],qs[_0x363e('0x46')](_0x6f2122[_0x363e('0x31')][_0x363e('0x46')]));_0x384387[_0x363e('0x34')]=_0x384387[_0x363e('0x34')][_0x363e('0x47')]?_0x384387['attributes']:_0x520b3e[_0x363e('0x2f')];_0x384387[_0x363e('0x36')]=qs[_0x363e('0x37')](_0x6f2122[_0x363e('0x31')]['sort']);_0x384387[_0x363e('0x3a')]=qs['filters'](_[_0x363e('0x38')](_0x6f2122[_0x363e('0x31')],_0x520b3e[_0x363e('0x32')]));if(_0x6f2122[_0x363e('0x31')]['filter']){_0x384387[_0x363e('0x3a')]=_[_0x363e('0x3b')](_0x384387[_0x363e('0x3a')],{'$or':_[_0x363e('0x30')](_0x384387[_0x363e('0x34')],function(_0x4d49e6){var _0x4527c5={};_0x4527c5[_0x4d49e6]={'$like':'%'+_0x6f2122[_0x363e('0x31')][_0x363e('0x39')]+'%'};return _0x4527c5;})});}_0x384387=_['merge']({},_0x384387,_0x6f2122[_0x363e('0x3d')]);return _0x3123f1[_0x363e('0x51')](_0x384387);}})[_0x363e('0x26')](function(_0x55c2bc){if(_0x55c2bc){_0xc44547=_0x55c2bc[_0x363e('0x47')];if(!_0x6f2122[_0x363e('0x31')][_0x363e('0x50')](_0x363e('0x35'))){_0x384387[_0x363e('0x1f')]=qs[_0x363e('0x1f')](_0x6f2122[_0x363e('0x31')][_0x363e('0x1f')]);_0x384387[_0x363e('0x1e')]=qs[_0x363e('0x1e')](_0x6f2122[_0x363e('0x31')]['offset']);}return _0x3123f1[_0x363e('0x51')](_0x384387);}})['then'](function(_0x86c512){if(_0x86c512){return _0x86c512?{'count':_0xc44547,'rows':_0x86c512}:null;}})[_0x363e('0x26')](respondWithResult(_0x567e04,null))[_0x363e('0x42')](handleError(_0x567e04,null));};exports['getTags']=function(_0x3694b6,_0xc5d0db,_0x15a26c){var _0x35b3f9={};var _0x5ea0e2={};var _0xea9011;var _0x238776;return db['DeskConfiguration'][_0x363e('0x4f')]({'where':{'id':_0x3694b6['params']['id']}})[_0x363e('0x26')](handleEntityNotFound(_0xc5d0db,null))[_0x363e('0x26')](function(_0x4227e9){if(_0x4227e9){_0xea9011=_0x4227e9;_0x5ea0e2[_0x363e('0x2f')]=_[_0x363e('0x45')](db['Tag'][_0x363e('0x2b')]);_0x5ea0e2['query']=_[_0x363e('0x45')](_0x3694b6['query']);_0x5ea0e2[_0x363e('0x32')]=_[_0x363e('0x33')](_0x5ea0e2[_0x363e('0x2f')],_0x5ea0e2[_0x363e('0x31')]);_0x35b3f9[_0x363e('0x34')]=_[_0x363e('0x33')](_0x5ea0e2[_0x363e('0x2f')],qs['fields'](_0x3694b6[_0x363e('0x31')]['fields']));_0x35b3f9[_0x363e('0x34')]=_0x35b3f9['attributes']['length']?_0x35b3f9[_0x363e('0x34')]:_0x5ea0e2['model'];_0x35b3f9[_0x363e('0x36')]=qs['sort'](_0x3694b6[_0x363e('0x31')][_0x363e('0x37')]);_0x35b3f9[_0x363e('0x3a')]=qs[_0x363e('0x32')](_[_0x363e('0x38')](_0x3694b6['query'],_0x5ea0e2[_0x363e('0x32')]));if(_0x3694b6[_0x363e('0x31')][_0x363e('0x39')]){_0x35b3f9[_0x363e('0x3a')]=_[_0x363e('0x3b')](_0x35b3f9[_0x363e('0x3a')],{'$or':_[_0x363e('0x30')](_0x35b3f9[_0x363e('0x34')],function(_0x2c3dbc){var _0x925941={};_0x925941[_0x2c3dbc]={'$like':'%'+_0x3694b6[_0x363e('0x31')][_0x363e('0x39')]+'%'};return _0x925941;})});}_0x35b3f9=_['merge']({},_0x35b3f9,_0x3694b6[_0x363e('0x3d')]);return _0xea9011[_0x363e('0x52')](_0x35b3f9);}})[_0x363e('0x26')](function(_0x223e73){if(_0x223e73){_0x238776=_0x223e73[_0x363e('0x47')];if(!_0x3694b6['query'][_0x363e('0x50')](_0x363e('0x35'))){_0x35b3f9[_0x363e('0x1f')]=qs[_0x363e('0x1f')](_0x3694b6[_0x363e('0x31')][_0x363e('0x1f')]);_0x35b3f9[_0x363e('0x1e')]=qs[_0x363e('0x1e')](_0x3694b6[_0x363e('0x31')]['offset']);}return _0xea9011[_0x363e('0x52')](_0x35b3f9);}})[_0x363e('0x26')](function(_0x1a0020){if(_0x1a0020){return _0x1a0020?{'count':_0x238776,'rows':_0x1a0020}:null;}})[_0x363e('0x26')](respondWithResult(_0xc5d0db,null))[_0x363e('0x42')](handleError(_0xc5d0db,null));};exports['setTags']=function(_0x20ea2f,_0x5f210f,_0x3b3e9e){if(_0x20ea2f[_0x363e('0x4b')]['id']){delete _0x20ea2f[_0x363e('0x4b')]['id'];}return db[_0x363e('0x3e')][_0x363e('0x4f')]({'where':{'id':_0x20ea2f[_0x363e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f210f,null))['then'](function(_0x1ed130){if(_0x1ed130){return _0x1ed130[_0x363e('0x53')](_0x20ea2f[_0x363e('0x4b')][_0x363e('0x54')]||[]);}return null;})[_0x363e('0x26')](respondWithResult(_0x5f210f,null))['catch'](handleError(_0x5f210f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0344020..f5b78b6 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 _0xd187=['api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0xd187,0x1ba));var _0x7d18=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0xd187[_0x40d078];return _0x46fc81;};'use strict';var _=require('lodash');var util=require(_0x7d18('0x0'));var logger=require(_0x7d18('0x1'))(_0x7d18('0x2'));var moment=require(_0x7d18('0x3'));var BPromise=require(_0x7d18('0x4'));var rp=require(_0x7d18('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d18('0x6'));var attributes=require(_0x7d18('0x7'));module[_0x7d18('0x8')]=function(_0x121cfb,_0x14b13e){return _0x121cfb[_0x7d18('0x9')](_0x7d18('0xa'),attributes,{'tableName':_0x7d18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3108=['../../config/logger','api','bluebird','../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x3108,0x1b7));var _0x8310=function(_0x3f604d,_0x57b887){_0x3f604d=_0x3f604d-0x0;var _0x1e4e15=_0x3108[_0x3f604d];return _0x1e4e15;};'use strict';var _=require(_0x8310('0x0'));var util=require(_0x8310('0x1'));var logger=require(_0x8310('0x2'))(_0x8310('0x3'));var moment=require('moment');var BPromise=require(_0x8310('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8310('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0x8310('0x6')]=function(_0x406b27,_0x3450c4){return _0x406b27['define'](_0x8310('0x7'),attributes,{'tableName':_0x8310('0x8'),'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 a088b91..83ca254 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 _0xe195=['jayson/promise','client','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2cbb42,_0x5862e8){var _0x1d4266=function(_0x16d166){while(--_0x16d166){_0x2cbb42['push'](_0x2cbb42['shift']());}};_0x1d4266(++_0x5862e8);}(_0xe195,0x1c6));var _0x5e19=function(_0x3e5992,_0xd30d25){_0x3e5992=_0x3e5992-0x0;var _0x2abeac=_0xe195[_0x3e5992];return _0x2abeac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e19('0x0'));var BPromise=require(_0x5e19('0x1'));var rs=require(_0x5e19('0x2'));var fs=require('fs');var Redis=require(_0x5e19('0x3'));var db=require(_0x5e19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e19('0x5'))(_0x5e19('0x6'));var config=require(_0x5e19('0x7'));var jayson=require(_0x5e19('0x8'));var client=jayson[_0x5e19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca278,_0x50b913,_0x1e40c4){return new BPromise(function(_0x21e440,_0x377428){return client[_0x5e19('0xa')](_0x2ca278,_0x1e40c4)['then'](function(_0x3a1974){logger['info'](_0x5e19('0xb'),_0x50b913,_0x5e19('0xc'));logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x50b913,_0x5e19('0xc'),JSON[_0x5e19('0xf')](_0x3a1974));if(_0x3a1974[_0x5e19('0x10')]){if(_0x3a1974['error'][_0x5e19('0x11')]===0x1f4){logger[_0x5e19('0x10')](_0x5e19('0xb'),_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x377428(_0x3a1974['error'][_0x5e19('0x12')]);}logger[_0x5e19('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x21e440(_0x3a1974[_0x5e19('0x10')]['message']);}else{logger['info'](_0x5e19('0xb'),_0x50b913,'request\x20sent');_0x21e440(_0x3a1974[_0x5e19('0x13')][_0x5e19('0x12')]);}})[_0x5e19('0x14')](function(_0x5e72a3){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x50b913,_0x5e72a3);_0x377428(_0x5e72a3);});});} \ No newline at end of file +var _0x6f18=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2c7328,_0x2da341){var _0x543a65=function(_0x1e841f){while(--_0x1e841f){_0x2c7328['push'](_0x2c7328['shift']());}};_0x543a65(++_0x2da341);}(_0x6f18,0x1b4));var _0x86f1=function(_0x32f8e0,_0x29a96d){_0x32f8e0=_0x32f8e0-0x0;var _0x377e07=_0x6f18[_0x32f8e0];return _0x377e07;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var moment=require(_0x86f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x86f1('0x2'));var fs=require('fs');var Redis=require(_0x86f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86f1('0x4'));var logger=require(_0x86f1('0x5'))('rpc');var config=require(_0x86f1('0x6'));var jayson=require(_0x86f1('0x7'));var client=jayson[_0x86f1('0x8')][_0x86f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x403f48,_0x4c7943,_0x5b0f45){return new BPromise(function(_0x3cc3c5,_0x3223eb){return client[_0x86f1('0xa')](_0x403f48,_0x5b0f45)[_0x86f1('0xb')](function(_0x4f1f6e){logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,_0x86f1('0xe'));logger[_0x86f1('0xf')](_0x86f1('0x10'),_0x4c7943,_0x86f1('0xe'),JSON[_0x86f1('0x11')](_0x4f1f6e));if(_0x4f1f6e[_0x86f1('0x12')]){if(_0x4f1f6e['error'][_0x86f1('0x13')]===0x1f4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3223eb(_0x4f1f6e[_0x86f1('0x12')]['message']);}logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3cc3c5(_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);}else{logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,'request\x20sent');_0x3cc3c5(_0x4f1f6e[_0x86f1('0x15')][_0x86f1('0x14')]);}})[_0x86f1('0x16')](function(_0x4452c4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4452c4);_0x3223eb(_0x4452c4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 14f70d0..f0ce70f 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 _0x011a=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy'];(function(_0x259275,_0x48e2d7){var _0x564963=function(_0x39b61d){while(--_0x39b61d){_0x259275['push'](_0x259275['shift']());}};_0x564963(++_0x48e2d7);}(_0x011a,0x1c8));var _0xa011=function(_0x3027b1,_0x282484){_0x3027b1=_0x3027b1-0x0;var _0x59447f=_0x011a[_0x3027b1];return _0x59447f;};'use strict';var multer=require(_0xa011('0x0'));var util=require(_0xa011('0x1'));var path=require(_0xa011('0x2'));var timeout=require(_0xa011('0x3'));var express=require('express');var router=express[_0xa011('0x4')]();var fs_extra=require(_0xa011('0x5'));var auth=require(_0xa011('0x6'));var interaction=require(_0xa011('0x7'));var config=require(_0xa011('0x8'));var controller=require(_0xa011('0x9'));router[_0xa011('0xa')]('/',auth[_0xa011('0xb')](),controller['index']);router['get']('/:id',auth[_0xa011('0xb')](),controller['show']);router[_0xa011('0xc')]('/',auth['isAuthenticated'](),controller[_0xa011('0xd')]);router[_0xa011('0xe')]('/:id',auth[_0xa011('0xb')](),controller[_0xa011('0xf')]);router[_0xa011('0x10')](_0xa011('0x11'),auth[_0xa011('0xb')](),controller[_0xa011('0x12')]);module['exports']=router; \ No newline at end of file +var _0x59ac=['index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x6bd842,_0x21378d){var _0x3e5c0d=function(_0x1ac00f){while(--_0x1ac00f){_0x6bd842['push'](_0x6bd842['shift']());}};_0x3e5c0d(++_0x21378d);}(_0x59ac,0x73));var _0xc59a=function(_0x513d09,_0x5cd567){_0x513d09=_0x513d09-0x0;var _0x1b6eb9=_0x59ac[_0x513d09];return _0x1b6eb9;};'use strict';var multer=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var path=require(_0xc59a('0x2'));var timeout=require(_0xc59a('0x3'));var express=require(_0xc59a('0x4'));var router=express['Router']();var fs_extra=require(_0xc59a('0x5'));var auth=require(_0xc59a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc59a('0x7'));var controller=require(_0xc59a('0x8'));router[_0xc59a('0x9')]('/',auth[_0xc59a('0xa')](),controller[_0xc59a('0xb')]);router['get'](_0xc59a('0xc'),auth['isAuthenticated'](),controller[_0xc59a('0xd')]);router['post']('/',auth[_0xc59a('0xa')](),controller['create']);router[_0xc59a('0xe')]('/:id',auth[_0xc59a('0xa')](),controller['update']);router[_0xc59a('0xf')]('/:id',auth[_0xc59a('0xa')](),controller[_0xc59a('0x10')]);module[_0xc59a('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 75538de..9b30ca2 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 _0x65ee=['picklist','STRING','ENUM','sequelize','exports','string','variable','customVariable'];(function(_0x32ca3d,_0x18d639){var _0x22ef70=function(_0x547ddb){while(--_0x547ddb){_0x32ca3d['push'](_0x32ca3d['shift']());}};_0x22ef70(++_0x18d639);}(_0x65ee,0xd3));var _0xe65e=function(_0xcea152,_0x3495bb){_0xcea152=_0xcea152-0x0;var _0x42110c=_0x65ee[_0xcea152];return _0x42110c;};'use strict';var Sequelize=require(_0xe65e('0x0'));module[_0xe65e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe65e('0x2'),_0xe65e('0x3'),_0xe65e('0x4'),'keyValue',_0xe65e('0x5')),'defaultValue':_0xe65e('0x2')},'content':{'type':Sequelize[_0xe65e('0x6')]},'key':{'type':Sequelize[_0xe65e('0x6')]},'keyType':{'type':Sequelize[_0xe65e('0x7')](_0xe65e('0x2'),_0xe65e('0x3'),_0xe65e('0x4'))},'keyContent':{'type':Sequelize[_0xe65e('0x6')]},'idField':{'type':Sequelize[_0xe65e('0x6')]},'nameField':{'type':Sequelize[_0xe65e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe65e('0x6')]}}; \ No newline at end of file +var _0xb1a1=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xb1a1,0xf7));var _0x1b1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1a1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1b1a('0x0'));module[_0x1b1a('0x1')]={'type':{'type':Sequelize[_0x1b1a('0x2')](_0x1b1a('0x3'),_0x1b1a('0x4'),_0x1b1a('0x5'),_0x1b1a('0x6'),_0x1b1a('0x7')),'defaultValue':_0x1b1a('0x3')},'content':{'type':Sequelize[_0x1b1a('0x8')]},'key':{'type':Sequelize[_0x1b1a('0x8')]},'keyType':{'type':Sequelize[_0x1b1a('0x2')](_0x1b1a('0x3'),_0x1b1a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1b1a('0x8')]},'idField':{'type':Sequelize[_0x1b1a('0x8')]},'nameField':{'type':Sequelize[_0x1b1a('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b1a('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6162d03..41b3e04 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 _0x53ab=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x1183d3,_0x3fc6c9){var _0x3cfa9e=function(_0x219d23){while(--_0x219d23){_0x1183d3['push'](_0x1183d3['shift']());}};_0x3cfa9e(++_0x3fc6c9);}(_0x53ab,0x130));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb53a('0x0'));var rimraf=require(_0xb53a('0x1'));var zipdir=require(_0xb53a('0x2'));var jsonpatch=require(_0xb53a('0x3'));var rp=require(_0xb53a('0x4'));var moment=require(_0xb53a('0x5'));var BPromise=require(_0xb53a('0x6'));var Mustache=require(_0xb53a('0x7'));var util=require(_0xb53a('0x8'));var path=require(_0xb53a('0x9'));var sox=require('sox');var csv=require(_0xb53a('0xa'));var ejs=require(_0xb53a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb53a('0xc'));var squel=require(_0xb53a('0xd'));var crypto=require('crypto');var jsforce=require(_0xb53a('0xe'));var deskjs=require(_0xb53a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb53a('0x10'));var Papa=require(_0xb53a('0x11'));var Redis=require(_0xb53a('0x12'));var authService=require(_0xb53a('0x13'));var qs=require(_0xb53a('0x14'));var as=require(_0xb53a('0x15'));var hardwareService=require(_0xb53a('0x16'));var logger=require(_0xb53a('0x17'))(_0xb53a('0x18'));var utils=require('../../config/utils');var config=require(_0xb53a('0x19'));var licenseUtil=require(_0xb53a('0x1a'));var db=require(_0xb53a('0x1b'))['db'];function respondWithStatusCode(_0x38d6e5,_0x7f10a2){_0x7f10a2=_0x7f10a2||0xcc;return function(_0x53bf98){if(_0x53bf98){return _0x38d6e5[_0xb53a('0x1c')](_0x7f10a2);}return _0x38d6e5['status'](_0x7f10a2)['end']();};}function respondWithResult(_0x5a7657,_0x4c339f){_0x4c339f=_0x4c339f||0xc8;return function(_0x37cb1e){if(_0x37cb1e){return _0x5a7657[_0xb53a('0x1d')](_0x4c339f)[_0xb53a('0x1e')](_0x37cb1e);}};}function respondWithFilteredResult(_0x5d2978,_0x10c0c8){return function(_0x18b982){if(_0x18b982){var _0x11a337=typeof _0x10c0c8['offset']===_0xb53a('0x1f')&&typeof _0x10c0c8['limit']===_0xb53a('0x1f');var _0x473376=_0x18b982[_0xb53a('0x20')];var _0x4b94f5=_0x11a337?0x0:_0x10c0c8[_0xb53a('0x21')];var _0x5c2856=_0x11a337?_0x18b982[_0xb53a('0x20')]:_0x10c0c8[_0xb53a('0x21')]+_0x10c0c8[_0xb53a('0x22')];var _0x334113;if(_0x5c2856>=_0x473376){_0x5c2856=_0x473376;_0x334113=0xc8;}else{_0x334113=0xce;}_0x5d2978[_0xb53a('0x1d')](_0x334113);return _0x5d2978['set'](_0xb53a('0x23'),_0x4b94f5+'-'+_0x5c2856+'/'+_0x473376)['json'](_0x18b982);}return null;};}function patchUpdates(_0x324501){return function(_0x899b2d){try{jsonpatch[_0xb53a('0x24')](_0x899b2d,_0x324501,!![]);}catch(_0x4d4388){return BPromise[_0xb53a('0x25')](_0x4d4388);}return _0x899b2d[_0xb53a('0x26')]();};}function saveUpdates(_0x505f04,_0x135a3b){return function(_0x5c9067){if(_0x5c9067){return _0x5c9067[_0xb53a('0x27')](_0x505f04)['then'](function(_0x46d5cf){return _0x46d5cf;});}return null;};}function removeEntity(_0x39ad0e,_0x44a97c){return function(_0x1f8992){if(_0x1f8992){return _0x1f8992[_0xb53a('0x28')]()[_0xb53a('0x29')](function(){_0x39ad0e[_0xb53a('0x1d')](0xcc)[_0xb53a('0x2a')]();});}};}function handleEntityNotFound(_0x50439a,_0xa07add){return function(_0x202afa){if(!_0x202afa){_0x50439a[_0xb53a('0x1c')](0x194);}return _0x202afa;};}function handleError(_0xf4e934,_0x440dfc){_0x440dfc=_0x440dfc||0x1f4;return function(_0x4cb0d4){logger[_0xb53a('0x2b')](_0x4cb0d4[_0xb53a('0x2c')]);if(_0x4cb0d4[_0xb53a('0x2d')]){delete _0x4cb0d4['name'];}_0xf4e934['status'](_0x440dfc)[_0xb53a('0x2e')](_0x4cb0d4);};}exports['index']=function(_0x182317,_0x45bff6){var _0xa6bcee={},_0x5045fa={},_0x2a3457={'count':0x0,'rows':[]};var _0x74d913=_[_0xb53a('0x2f')](db[_0xb53a('0x30')][_0xb53a('0x31')],function(_0x7184b9){return{'name':_0x7184b9[_0xb53a('0x32')],'type':_0x7184b9[_0xb53a('0x33')]['key']};});_0x5045fa[_0xb53a('0x34')]=_[_0xb53a('0x2f')](_0x74d913,_0xb53a('0x2d'));_0x5045fa[_0xb53a('0x35')]=_['keys'](_0x182317[_0xb53a('0x35')]);_0x5045fa['filters']=_['intersection'](_0x5045fa[_0xb53a('0x34')],_0x5045fa[_0xb53a('0x35')]);_0xa6bcee[_0xb53a('0x36')]=_[_0xb53a('0x37')](_0x5045fa[_0xb53a('0x34')],qs[_0xb53a('0x38')](_0x182317[_0xb53a('0x35')][_0xb53a('0x38')]));_0xa6bcee[_0xb53a('0x36')]=_0xa6bcee[_0xb53a('0x36')]['length']?_0xa6bcee['attributes']:_0x5045fa[_0xb53a('0x34')];if(!_0x182317[_0xb53a('0x35')][_0xb53a('0x39')](_0xb53a('0x3a'))){_0xa6bcee[_0xb53a('0x22')]=qs[_0xb53a('0x22')](_0x182317[_0xb53a('0x35')][_0xb53a('0x22')]);_0xa6bcee['offset']=qs[_0xb53a('0x21')](_0x182317[_0xb53a('0x35')][_0xb53a('0x21')]);}_0xa6bcee[_0xb53a('0x3b')]=qs['sort'](_0x182317['query'][_0xb53a('0x3c')]);_0xa6bcee[_0xb53a('0x3d')]=qs[_0xb53a('0x3e')](_[_0xb53a('0x3f')](_0x182317[_0xb53a('0x35')],_0x5045fa['filters']),_0x74d913);if(_0x182317[_0xb53a('0x35')]['filter']){_0xa6bcee[_0xb53a('0x3d')]=_[_0xb53a('0x40')](_0xa6bcee[_0xb53a('0x3d')],{'$or':_[_0xb53a('0x2f')](_0x74d913,function(_0x3ceab0){if(_0x3ceab0['type']!=='VIRTUAL'){var _0x7856ec={};_0x7856ec[_0x3ceab0[_0xb53a('0x2d')]]={'$like':'%'+_0x182317[_0xb53a('0x35')][_0xb53a('0x41')]+'%'};return _0x7856ec;}})});}_0xa6bcee=_['merge']({},_0xa6bcee,_0x182317[_0xb53a('0x42')]);var _0x500e56={'where':_0xa6bcee[_0xb53a('0x3d')]};return db['DeskField'][_0xb53a('0x20')](_0x500e56)[_0xb53a('0x29')](function(_0x3dca7c){_0x2a3457[_0xb53a('0x20')]=_0x3dca7c;if(_0x182317[_0xb53a('0x35')][_0xb53a('0x43')]){_0xa6bcee[_0xb53a('0x44')]=[{'all':!![]}];}return db[_0xb53a('0x30')][_0xb53a('0x45')](_0xa6bcee);})['then'](function(_0x3f2e85){_0x2a3457[_0xb53a('0x46')]=_0x3f2e85;return _0x2a3457;})[_0xb53a('0x29')](respondWithFilteredResult(_0x45bff6,_0xa6bcee))[_0xb53a('0x47')](handleError(_0x45bff6,null));};exports[_0xb53a('0x48')]=function(_0x3789c2,_0x24078f){var _0x300eaf={'raw':!![],'where':{'id':_0x3789c2['params']['id']}},_0x23e56b={};_0x23e56b[_0xb53a('0x34')]=_[_0xb53a('0x49')](db[_0xb53a('0x30')][_0xb53a('0x31')]);_0x23e56b[_0xb53a('0x35')]=_[_0xb53a('0x49')](_0x3789c2[_0xb53a('0x35')]);_0x23e56b[_0xb53a('0x3e')]=_[_0xb53a('0x37')](_0x23e56b[_0xb53a('0x34')],_0x23e56b[_0xb53a('0x35')]);_0x300eaf[_0xb53a('0x36')]=_[_0xb53a('0x37')](_0x23e56b[_0xb53a('0x34')],qs[_0xb53a('0x38')](_0x3789c2[_0xb53a('0x35')][_0xb53a('0x38')]));_0x300eaf['attributes']=_0x300eaf['attributes'][_0xb53a('0x4a')]?_0x300eaf['attributes']:_0x23e56b[_0xb53a('0x34')];if(_0x3789c2[_0xb53a('0x35')][_0xb53a('0x43')]){_0x300eaf[_0xb53a('0x44')]=[{'all':!![]}];}_0x300eaf=_[_0xb53a('0x40')]({},_0x300eaf,_0x3789c2[_0xb53a('0x42')]);return db[_0xb53a('0x30')]['find'](_0x300eaf)[_0xb53a('0x29')](handleEntityNotFound(_0x24078f,null))['then'](respondWithResult(_0x24078f,null))['catch'](handleError(_0x24078f,null));};exports['create']=function(_0x1cbbf0,_0x508b99){return db[_0xb53a('0x30')][_0xb53a('0x4b')](_0x1cbbf0[_0xb53a('0x4c')],{})[_0xb53a('0x29')](respondWithResult(_0x508b99,0xc9))[_0xb53a('0x47')](handleError(_0x508b99,null));};exports[_0xb53a('0x27')]=function(_0x33da3a,_0x2f8169){if(_0x33da3a[_0xb53a('0x4c')]['id']){delete _0x33da3a[_0xb53a('0x4c')]['id'];}return db[_0xb53a('0x30')][_0xb53a('0x4d')]({'where':{'id':_0x33da3a[_0xb53a('0x4e')]['id']}})[_0xb53a('0x29')](handleEntityNotFound(_0x2f8169,null))[_0xb53a('0x29')](saveUpdates(_0x33da3a['body'],null))[_0xb53a('0x29')](respondWithResult(_0x2f8169,null))[_0xb53a('0x47')](handleError(_0x2f8169,null));};exports['destroy']=function(_0x395fed,_0x49cbb4){return db['DeskField'][_0xb53a('0x4d')]({'where':{'id':_0x395fed['params']['id']}})['then'](handleEntityNotFound(_0x49cbb4,null))['then'](removeEntity(_0x49cbb4,null))['catch'](handleError(_0x49cbb4,null));}; \ No newline at end of file +var _0x126e=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','DeskField','rawAttributes','type','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','show','params','intersection','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x38f6ee,_0xf06a6c){var _0x49aeef=function(_0x1f1262){while(--_0x1f1262){_0x38f6ee['push'](_0x38f6ee['shift']());}};_0x49aeef(++_0xf06a6c);}(_0x126e,0x108));var _0xe126=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x126e[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe126('0x0'));var zipdir=require(_0xe126('0x1'));var jsonpatch=require(_0xe126('0x2'));var rp=require(_0xe126('0x3'));var moment=require(_0xe126('0x4'));var BPromise=require(_0xe126('0x5'));var Mustache=require('mustache');var util=require(_0xe126('0x6'));var path=require(_0xe126('0x7'));var sox=require(_0xe126('0x8'));var csv=require(_0xe126('0x9'));var ejs=require(_0xe126('0xa'));var fs=require('fs');var fs_extra=require(_0xe126('0xb'));var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0x9'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=typeof _0x10bc24[_0xe126('0x1c')]===_0xe126('0x1d')&&typeof _0x10bc24[_0xe126('0x1e')]==='undefined';var _0x2b0baa=_0x38b0c0['count'];var _0x46c98a=_0x5e52d1?0x0:_0x10bc24[_0xe126('0x1c')];var _0x19b0a3=_0x5e52d1?_0x38b0c0[_0xe126('0x1f')]:_0x10bc24[_0xe126('0x1c')]+_0x10bc24[_0xe126('0x1e')];var _0x20874b;if(_0x19b0a3>=_0x2b0baa){_0x19b0a3=_0x2b0baa;_0x20874b=0xc8;}else{_0x20874b=0xce;}_0x28d7dd[_0xe126('0x19')](_0x20874b);return _0x28d7dd['set'](_0xe126('0x20'),_0x46c98a+'-'+_0x19b0a3+'/'+_0x2b0baa)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x35ab64){return function(_0x2e5617){try{jsonpatch[_0xe126('0x21')](_0x2e5617,_0x35ab64,!![]);}catch(_0x24076e){return BPromise[_0xe126('0x22')](_0x24076e);}return _0x2e5617[_0xe126('0x23')]();};}function saveUpdates(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x24')](_0x5257bc)[_0xe126('0x25')](function(_0x5f1ce1){return _0x5f1ce1;});}return null;};}function removeEntity(_0x5381e1,_0x47f179){return function(_0x4807d3){if(_0x4807d3){return _0x4807d3[_0xe126('0x26')]()['then'](function(){_0x5381e1[_0xe126('0x19')](0xcc)[_0xe126('0x1a')]();});}};}function handleEntityNotFound(_0x4157ed,_0x1674c9){return function(_0x532409){if(!_0x532409){_0x4157ed['sendStatus'](0x194);}return _0x532409;};}function handleError(_0x26482f,_0x4facea){_0x4facea=_0x4facea||0x1f4;return function(_0x3f5de5){logger[_0xe126('0x27')](_0x3f5de5[_0xe126('0x28')]);if(_0x3f5de5['name']){delete _0x3f5de5[_0xe126('0x29')];}_0x26482f[_0xe126('0x19')](_0x4facea)['send'](_0x3f5de5);};}exports[_0xe126('0x2a')]=function(_0x259059,_0x5a8b2a){var _0x9d9e28={},_0x1fb354={},_0x29dec4={'count':0x0,'rows':[]};var _0x181ccc=_['map'](db[_0xe126('0x2b')][_0xe126('0x2c')],function(_0x5e7bab){return{'name':_0x5e7bab['fieldName'],'type':_0x5e7bab[_0xe126('0x2d')]['key']};});_0x1fb354[_0xe126('0x2e')]=_[_0xe126('0x2f')](_0x181ccc,_0xe126('0x29'));_0x1fb354['query']=_[_0xe126('0x30')](_0x259059[_0xe126('0x31')]);_0x1fb354[_0xe126('0x32')]=_['intersection'](_0x1fb354[_0xe126('0x2e')],_0x1fb354[_0xe126('0x31')]);_0x9d9e28['attributes']=_['intersection'](_0x1fb354[_0xe126('0x2e')],qs[_0xe126('0x33')](_0x259059[_0xe126('0x31')][_0xe126('0x33')]));_0x9d9e28[_0xe126('0x34')]=_0x9d9e28[_0xe126('0x34')][_0xe126('0x35')]?_0x9d9e28[_0xe126('0x34')]:_0x1fb354['model'];if(!_0x259059[_0xe126('0x31')][_0xe126('0x36')](_0xe126('0x37'))){_0x9d9e28[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x259059[_0xe126('0x31')]['limit']);_0x9d9e28[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x259059[_0xe126('0x31')][_0xe126('0x1c')]);}_0x9d9e28[_0xe126('0x38')]=qs['sort'](_0x259059[_0xe126('0x31')][_0xe126('0x39')]);_0x9d9e28[_0xe126('0x3a')]=qs[_0xe126('0x32')](_['pick'](_0x259059[_0xe126('0x31')],_0x1fb354[_0xe126('0x32')]),_0x181ccc);if(_0x259059[_0xe126('0x31')][_0xe126('0x3b')]){_0x9d9e28[_0xe126('0x3a')]=_[_0xe126('0x3c')](_0x9d9e28['where'],{'$or':_[_0xe126('0x2f')](_0x181ccc,function(_0x1a8edf){if(_0x1a8edf[_0xe126('0x2d')]!=='VIRTUAL'){var _0x5073bc={};_0x5073bc[_0x1a8edf[_0xe126('0x29')]]={'$like':'%'+_0x259059[_0xe126('0x31')][_0xe126('0x3b')]+'%'};return _0x5073bc;}})});}_0x9d9e28=_[_0xe126('0x3c')]({},_0x9d9e28,_0x259059[_0xe126('0x3d')]);var _0x1c128d={'where':_0x9d9e28['where']};return db[_0xe126('0x2b')][_0xe126('0x1f')](_0x1c128d)['then'](function(_0x4eb3d7){_0x29dec4[_0xe126('0x1f')]=_0x4eb3d7;if(_0x259059[_0xe126('0x31')]['includeAll']){_0x9d9e28[_0xe126('0x3e')]=[{'all':!![]}];}return db[_0xe126('0x2b')]['findAll'](_0x9d9e28);})[_0xe126('0x25')](function(_0x366754){_0x29dec4['rows']=_0x366754;return _0x29dec4;})[_0xe126('0x25')](respondWithFilteredResult(_0x5a8b2a,_0x9d9e28))['catch'](handleError(_0x5a8b2a,null));};exports[_0xe126('0x3f')]=function(_0x23d1d8,_0x5d5111){var _0x3613de={'raw':!![],'where':{'id':_0x23d1d8[_0xe126('0x40')]['id']}},_0x149b84={};_0x149b84['model']=_[_0xe126('0x30')](db['DeskField'][_0xe126('0x2c')]);_0x149b84[_0xe126('0x31')]=_[_0xe126('0x30')](_0x23d1d8[_0xe126('0x31')]);_0x149b84[_0xe126('0x32')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],_0x149b84[_0xe126('0x31')]);_0x3613de[_0xe126('0x34')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],qs['fields'](_0x23d1d8['query'][_0xe126('0x33')]));_0x3613de[_0xe126('0x34')]=_0x3613de['attributes'][_0xe126('0x35')]?_0x3613de[_0xe126('0x34')]:_0x149b84[_0xe126('0x2e')];if(_0x23d1d8[_0xe126('0x31')]['includeAll']){_0x3613de[_0xe126('0x3e')]=[{'all':!![]}];}_0x3613de=_[_0xe126('0x3c')]({},_0x3613de,_0x23d1d8[_0xe126('0x3d')]);return db[_0xe126('0x2b')][_0xe126('0x42')](_0x3613de)[_0xe126('0x25')](handleEntityNotFound(_0x5d5111,null))[_0xe126('0x25')](respondWithResult(_0x5d5111,null))[_0xe126('0x43')](handleError(_0x5d5111,null));};exports[_0xe126('0x44')]=function(_0xccc25d,_0x23007d){return db[_0xe126('0x2b')][_0xe126('0x44')](_0xccc25d['body'],{})['then'](respondWithResult(_0x23007d,0xc9))['catch'](handleError(_0x23007d,null));};exports['update']=function(_0xe642ae,_0x8d5abd){if(_0xe642ae[_0xe126('0x45')]['id']){delete _0xe642ae[_0xe126('0x45')]['id'];}return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0xe642ae[_0xe126('0x40')]['id']}})['then'](handleEntityNotFound(_0x8d5abd,null))['then'](saveUpdates(_0xe642ae[_0xe126('0x45')],null))[_0xe126('0x25')](respondWithResult(_0x8d5abd,null))['catch'](handleError(_0x8d5abd,null));};exports[_0xe126('0x26')]=function(_0x209002,_0x518e43){return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0x209002['params']['id']}})['then'](handleEntityNotFound(_0x518e43,null))[_0xe126('0x25')](removeEntity(_0x518e43,null))[_0xe126('0x43')](handleError(_0x518e43,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e544a57..ee6c111 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 _0xcd2f=['request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x5b8702,_0x29cb76){var _0x3f7217=function(_0x1a0a4c){while(--_0x1a0a4c){_0x5b8702['push'](_0x5b8702['shift']());}};_0x3f7217(++_0x29cb76);}(_0xcd2f,0xdc));var _0xfcd2=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xcd2f[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xfcd2('0x0'));var util=require(_0xfcd2('0x1'));var logger=require(_0xfcd2('0x2'))(_0xfcd2('0x3'));var moment=require(_0xfcd2('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcd2('0x5'));var fs=require('fs');var path=require(_0xfcd2('0x6'));var rimraf=require(_0xfcd2('0x7'));var config=require('../../config/environment');var attributes=require(_0xfcd2('0x8'));module[_0xfcd2('0x9')]=function(_0xe8b090,_0x4ab541){return _0xe8b090[_0xfcd2('0xa')](_0xfcd2('0xb'),attributes,{'tableName':_0xfcd2('0xc'),'paranoid':![],'indexes':[{'name':_0xfcd2('0xd'),'fields':['idField',_0xfcd2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc7a=['int_desk_fields','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','./intDeskField.attributes','exports','define','DeskField'];(function(_0x2e3740,_0x56cd3e){var _0x1cfb48=function(_0x45ea86){while(--_0x45ea86){_0x2e3740['push'](_0x2e3740['shift']());}};_0x1cfb48(++_0x56cd3e);}(_0xbc7a,0x1b2));var _0xabc7=function(_0x3a5be9,_0x30ce9f){_0x3a5be9=_0x3a5be9-0x0;var _0x4adced=_0xbc7a[_0x3a5be9];return _0x4adced;};'use strict';var _=require(_0xabc7('0x0'));var util=require('util');var logger=require(_0xabc7('0x1'))('api');var moment=require(_0xabc7('0x2'));var BPromise=require(_0xabc7('0x3'));var rp=require(_0xabc7('0x4'));var fs=require('fs');var path=require(_0xabc7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xabc7('0x6'));module[_0xabc7('0x7')]=function(_0x15f396,_0x4f75b4){return _0x15f396[_0xabc7('0x8')](_0xabc7('0x9'),attributes,{'tableName':_0xabc7('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xabc7('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4c1ba6e..f25bc5e 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 _0xbc9e=['stringify','error','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x27b2b5,_0x4006b8){var _0x97e614=function(_0x13ae2e){while(--_0x13ae2e){_0x27b2b5['push'](_0x27b2b5['shift']());}};_0x97e614(++_0x4006b8);}(_0xbc9e,0xb5));var _0xebc9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbc9e[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xebc9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebc9('0x1'));var db=require(_0xebc9('0x2'))['db'];var utils=require(_0xebc9('0x3'));var logger=require(_0xebc9('0x4'))(_0xebc9('0x5'));var config=require(_0xebc9('0x6'));var jayson=require(_0xebc9('0x7'));var client=jayson[_0xebc9('0x8')][_0xebc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc95ab1,_0x35fad6,_0x20e843){return new BPromise(function(_0x5c2a40,_0x5415bd){return client[_0xebc9('0xa')](_0xc95ab1,_0x20e843)[_0xebc9('0xb')](function(_0xd57b21){logger[_0xebc9('0xc')](_0xebc9('0xd'),_0x35fad6,'request\x20sent');logger[_0xebc9('0xe')](_0xebc9('0xf'),_0x35fad6,_0xebc9('0x10'),JSON[_0xebc9('0x11')](_0xd57b21));if(_0xd57b21[_0xebc9('0x12')]){if(_0xd57b21[_0xebc9('0x12')]['code']===0x1f4){logger[_0xebc9('0x12')]('DeskField,\x20%s,\x20%s',_0x35fad6,_0xd57b21[_0xebc9('0x12')][_0xebc9('0x13')]);return _0x5415bd(_0xd57b21['error'][_0xebc9('0x13')]);}logger[_0xebc9('0x12')]('DeskField,\x20%s,\x20%s',_0x35fad6,_0xd57b21['error'][_0xebc9('0x13')]);return _0x5c2a40(_0xd57b21[_0xebc9('0x12')]['message']);}else{logger['info'](_0xebc9('0xd'),_0x35fad6,_0xebc9('0x10'));_0x5c2a40(_0xd57b21[_0xebc9('0x14')][_0xebc9('0x13')]);}})[_0xebc9('0x15')](function(_0x37cfec){logger[_0xebc9('0x12')](_0xebc9('0xd'),_0x35fad6,_0x37cfec);_0x5415bd(_0x37cfec);});});} \ No newline at end of file +var _0x059f=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','error','code','message','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x059f,0xc5));var _0xf059=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x059f[_0x5678b5];return _0x4c09a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf059('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf059('0x1'))['db'];var utils=require(_0xf059('0x2'));var logger=require(_0xf059('0x3'))('rpc');var config=require(_0xf059('0x4'));var jayson=require(_0xf059('0x5'));var client=jayson[_0xf059('0x6')][_0xf059('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40e3d4,_0x197d16,_0x474b2f){return new BPromise(function(_0x2b7e44,_0x359b87){return client[_0xf059('0x8')](_0x40e3d4,_0x474b2f)[_0xf059('0x9')](function(_0x436e74){logger[_0xf059('0xa')](_0xf059('0xb'),_0x197d16,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x197d16,_0xf059('0xc'),JSON['stringify'](_0x436e74));if(_0x436e74[_0xf059('0xd')]){if(_0x436e74['error'][_0xf059('0xe')]===0x1f4){logger[_0xf059('0xd')](_0xf059('0xb'),_0x197d16,_0x436e74[_0xf059('0xd')][_0xf059('0xf')]);return _0x359b87(_0x436e74[_0xf059('0xd')]['message']);}logger[_0xf059('0xd')](_0xf059('0xb'),_0x197d16,_0x436e74[_0xf059('0xd')][_0xf059('0xf')]);return _0x2b7e44(_0x436e74[_0xf059('0xd')]['message']);}else{logger[_0xf059('0xa')](_0xf059('0xb'),_0x197d16,'request\x20sent');_0x2b7e44(_0x436e74['result'][_0xf059('0xf')]);}})[_0xf059('0x10')](function(_0x45892b){logger[_0xf059('0xd')](_0xf059('0xb'),_0x197d16,_0x45892b);_0x359b87(_0x45892b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0a47f47..055b552 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 _0xe597=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xe597,0xdb));var _0x7e59=function(_0x230721,_0x239b87){_0x230721=_0x230721-0x0;var _0x2cf8a0=_0xe597[_0x230721];return _0x2cf8a0;};'use strict';var multer=require(_0x7e59('0x0'));var util=require(_0x7e59('0x1'));var path=require(_0x7e59('0x2'));var timeout=require(_0x7e59('0x3'));var express=require(_0x7e59('0x4'));var router=express[_0x7e59('0x5')]();var fs_extra=require(_0x7e59('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7e59('0x7'));var config=require(_0x7e59('0x8'));var controller=require(_0x7e59('0x9'));router[_0x7e59('0xa')]('/',auth[_0x7e59('0xb')](),controller[_0x7e59('0xc')]);router[_0x7e59('0xa')](_0x7e59('0xd'),auth[_0x7e59('0xb')](),controller['show']);router[_0x7e59('0xa')](_0x7e59('0xe'),auth[_0x7e59('0xb')](),controller[_0x7e59('0xf')]);router[_0x7e59('0xa')](_0x7e59('0x10'),auth[_0x7e59('0xb')](),controller[_0x7e59('0x11')]);router[_0x7e59('0x12')]('/',auth[_0x7e59('0xb')](),controller['create']);router[_0x7e59('0x12')](_0x7e59('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x7e59('0xd'),auth[_0x7e59('0xb')](),controller[_0x7e59('0x13')]);router[_0x7e59('0x14')](_0x7e59('0xd'),auth[_0x7e59('0xb')](),controller[_0x7e59('0x15')]);module[_0x7e59('0x16')]=router; \ No newline at end of file +var _0x223a=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy'];(function(_0x1b2cd4,_0x220d18){var _0x3e2ff5=function(_0x5ef59c){while(--_0x5ef59c){_0x1b2cd4['push'](_0x1b2cd4['shift']());}};_0x3e2ff5(++_0x220d18);}(_0x223a,0x168));var _0xa223=function(_0x3cfc62,_0x27d5b5){_0x3cfc62=_0x3cfc62-0x0;var _0x428754=_0x223a[_0x3cfc62];return _0x428754;};'use strict';var multer=require(_0xa223('0x0'));var util=require(_0xa223('0x1'));var path=require(_0xa223('0x2'));var timeout=require(_0xa223('0x3'));var express=require('express');var router=express[_0xa223('0x4')]();var fs_extra=require(_0xa223('0x5'));var auth=require(_0xa223('0x6'));var interaction=require(_0xa223('0x7'));var config=require(_0xa223('0x8'));var controller=require(_0xa223('0x9'));router[_0xa223('0xa')]('/',auth[_0xa223('0xb')](),controller[_0xa223('0xc')]);router[_0xa223('0xa')](_0xa223('0xd'),auth['isAuthenticated'](),controller[_0xa223('0xe')]);router[_0xa223('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa223('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa223('0xf')]);router['post']('/',auth[_0xa223('0xb')](),controller[_0xa223('0x10')]);router[_0xa223('0x11')](_0xa223('0x12'),auth['isAuthenticated'](),controller[_0xa223('0x13')]);router[_0xa223('0x14')](_0xa223('0xd'),auth['isAuthenticated'](),controller[_0xa223('0x15')]);router[_0xa223('0x16')](_0xa223('0xd'),auth[_0xa223('0xb')](),controller[_0xa223('0x17')]);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 0ffc20d..45aeb50 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 _0x7676=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0x7676,0xb8));var _0x6767=function(_0xe6480d,_0xe1f2c3){_0xe6480d=_0xe6480d-0x0;var _0x55101e=_0x7676[_0xe6480d];return _0x55101e;};'use strict';var Sequelize=require(_0x6767('0x0'));module[_0x6767('0x1')]={'name':{'type':Sequelize[_0x6767('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6767('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6767('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6767('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6767('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6767('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1c9a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x534876,_0x39e90e){var _0x17db8b=function(_0x44f263){while(--_0x44f263){_0x534876['push'](_0x534876['shift']());}};_0x17db8b(++_0x39e90e);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x4338b6,_0x461297){_0x4338b6=_0x4338b6-0x0;var _0x4be419=_0x1c9a[_0x4338b6];return _0x4be419;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module[_0xa1c9('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1c9('0x2')]},'password':{'type':Sequelize[_0xa1c9('0x2')]},'remoteUri':{'type':Sequelize[_0xa1c9('0x2')]},'tenantId':{'type':Sequelize[_0xa1c9('0x2')]},'clientId':{'type':Sequelize[_0xa1c9('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b300f4a..7cfb2e6 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 _0xfd11=['Dynamics365Account','findAll','catch','params','find','create','body','getConfigurations','Dynamics365Configuration','order','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','description','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','send','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include'];(function(_0x407836,_0xa1b373){var _0x1dcd8a=function(_0x2f6b28){while(--_0x2f6b28){_0x407836['push'](_0x407836['shift']());}};_0x1dcd8a(++_0xa1b373);}(_0xfd11,0x13a));var _0x1fd1=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xfd11[_0x1ae4a9];return _0x54d0b0;};'use strict';var rp=require('request-promise');var util=require(_0x1fd1('0x0'));var _=require(_0x1fd1('0x1'));var qs=require(_0x1fd1('0x2'));var logger=require(_0x1fd1('0x3'))(_0x1fd1('0x4'));var db=require(_0x1fd1('0x5'))['db'];var integrations=require(_0x1fd1('0x6'));function respondWithResult(_0x261e5a,_0x3adf66){_0x3adf66=_0x3adf66||0xc8;return function(_0x4810b9){if(_0x4810b9){return _0x261e5a[_0x1fd1('0x7')](_0x3adf66)[_0x1fd1('0x8')](_0x4810b9);}};}function respondWithFilteredResult(_0x45b681,_0x59ac4b){return function(_0x1ed666){if(_0x1ed666){var _0x35308b=typeof _0x59ac4b[_0x1fd1('0x9')]===_0x1fd1('0xa')&&typeof _0x59ac4b['limit']==='undefined';var _0x51ee4a=_0x1ed666['count'];var _0x36d65c=_0x35308b?0x0:_0x59ac4b[_0x1fd1('0x9')];var _0x13f954=_0x35308b?_0x1ed666['count']:_0x59ac4b['offset']+_0x59ac4b['limit'];var _0x5156a7;if(_0x13f954>=_0x51ee4a){_0x13f954=_0x51ee4a;_0x5156a7=0xc8;}else{_0x5156a7=0xce;}_0x45b681[_0x1fd1('0x7')](_0x5156a7);return _0x45b681['set']('Content-Range',_0x36d65c+'-'+_0x13f954+'/'+_0x51ee4a)[_0x1fd1('0x8')](_0x1ed666);}return null;};}function saveUpdates(_0x212b08){return function(_0xbd48a6){if(_0xbd48a6){return _0xbd48a6[_0x1fd1('0xb')](_0x212b08)[_0x1fd1('0xc')](function(_0x4fbd1b){return _0x4fbd1b;});}return null;};}function removeEntity(_0xe26537){return function(_0x2b8e4e){if(_0x2b8e4e){return _0x2b8e4e[_0x1fd1('0xd')]()[_0x1fd1('0xc')](function(){_0xe26537['status'](0xcc)[_0x1fd1('0xe')]();});}};}function handleEntityNotFound(_0x55217c){return function(_0x213526){if(!_0x213526){_0x55217c['sendStatus'](0x194);}return _0x213526;};}function handleError(_0x5d696a,_0x49c5c6){_0x49c5c6=_0x49c5c6||0x1f4;return function(_0x3b0907){logger[_0x1fd1('0xf')](_0x3b0907[_0x1fd1('0x10')]);if(_0x3b0907[_0x1fd1('0x11')]){delete _0x3b0907[_0x1fd1('0x11')];}_0x5d696a[_0x1fd1('0x7')](_0x49c5c6)['send'](_0x3b0907);};}exports[_0x1fd1('0x12')]=function(_0x313296,_0x1c1dbd){var _0x50b60a={},_0x230037={},_0x192faa={'count':0x0,'rows':[]};var _0x56f77f=_['map'](db['Dynamics365Account'][_0x1fd1('0x13')],function(_0x11886b){return{'name':_0x11886b[_0x1fd1('0x14')],'type':_0x11886b[_0x1fd1('0x15')][_0x1fd1('0x16')]};});_0x230037[_0x1fd1('0x17')]=_[_0x1fd1('0x18')](_0x56f77f,_0x1fd1('0x11'));_0x230037[_0x1fd1('0x19')]=_[_0x1fd1('0x1a')](_0x313296[_0x1fd1('0x19')]);_0x230037[_0x1fd1('0x1b')]=_[_0x1fd1('0x1c')](_0x230037['model'],_0x230037[_0x1fd1('0x19')]);_0x50b60a[_0x1fd1('0x1d')]=_[_0x1fd1('0x1c')](_0x230037[_0x1fd1('0x17')],qs[_0x1fd1('0x1e')](_0x313296[_0x1fd1('0x19')]['fields']));_0x50b60a['attributes']=_0x50b60a['attributes'][_0x1fd1('0x1f')]?_0x50b60a[_0x1fd1('0x1d')]:_0x230037[_0x1fd1('0x17')];if(!_0x313296[_0x1fd1('0x19')]['hasOwnProperty'](_0x1fd1('0x20'))){_0x50b60a['limit']=qs['limit'](_0x313296[_0x1fd1('0x19')][_0x1fd1('0x21')]);_0x50b60a['offset']=qs['offset'](_0x313296[_0x1fd1('0x19')]['offset']);}_0x50b60a['order']=qs[_0x1fd1('0x22')](_0x313296[_0x1fd1('0x19')][_0x1fd1('0x22')]);_0x50b60a[_0x1fd1('0x23')]=qs[_0x1fd1('0x1b')](_[_0x1fd1('0x24')](_0x313296[_0x1fd1('0x19')],_0x230037['filters']),_0x56f77f);if(_0x313296['query']['filter']){_0x50b60a[_0x1fd1('0x23')]=_[_0x1fd1('0x25')](_0x50b60a[_0x1fd1('0x23')],{'$or':_[_0x1fd1('0x18')](_0x56f77f,function(_0xf8ca63){if(_0xf8ca63[_0x1fd1('0x15')]!==_0x1fd1('0x26')){var _0x304e9e={};_0x304e9e[_0xf8ca63[_0x1fd1('0x11')]]={'$like':'%'+_0x313296[_0x1fd1('0x19')][_0x1fd1('0x27')]+'%'};return _0x304e9e;}})});}_0x50b60a=_[_0x1fd1('0x25')]({},_0x50b60a,_0x313296[_0x1fd1('0x28')]);var _0x5737f3={'where':_0x50b60a[_0x1fd1('0x23')]};return db['Dynamics365Account']['count'](_0x5737f3)[_0x1fd1('0xc')](function(_0x34e9aa){_0x192faa[_0x1fd1('0x29')]=_0x34e9aa;if(_0x313296[_0x1fd1('0x19')][_0x1fd1('0x2a')]){_0x50b60a[_0x1fd1('0x2b')]=[{'all':!![]}];}return db[_0x1fd1('0x2c')][_0x1fd1('0x2d')](_0x50b60a);})['then'](function(_0x528bf0){_0x192faa['rows']=_0x528bf0;return _0x192faa;})[_0x1fd1('0xc')](respondWithFilteredResult(_0x1c1dbd,_0x50b60a))[_0x1fd1('0x2e')](handleError(_0x1c1dbd,null));};exports['show']=function(_0x12595d,_0x56dfae){var _0x117c67={'raw':![],'where':{'id':_0x12595d[_0x1fd1('0x2f')]['id']}},_0x3c00c6={};_0x3c00c6['model']=_[_0x1fd1('0x1a')](db[_0x1fd1('0x2c')][_0x1fd1('0x13')]);_0x3c00c6[_0x1fd1('0x19')]=_['keys'](_0x12595d['query']);_0x3c00c6[_0x1fd1('0x1b')]=_['intersection'](_0x3c00c6[_0x1fd1('0x17')],_0x3c00c6[_0x1fd1('0x19')]);_0x117c67[_0x1fd1('0x1d')]=_[_0x1fd1('0x1c')](_0x3c00c6[_0x1fd1('0x17')],qs[_0x1fd1('0x1e')](_0x12595d[_0x1fd1('0x19')][_0x1fd1('0x1e')]));_0x117c67[_0x1fd1('0x1d')]=_0x117c67['attributes'][_0x1fd1('0x1f')]?_0x117c67[_0x1fd1('0x1d')]:_0x3c00c6[_0x1fd1('0x17')];if(_0x12595d[_0x1fd1('0x19')][_0x1fd1('0x2a')]){_0x117c67[_0x1fd1('0x2b')]=[{'all':!![]}];}_0x117c67=_[_0x1fd1('0x25')]({},_0x117c67,_0x12595d[_0x1fd1('0x28')]);return db[_0x1fd1('0x2c')][_0x1fd1('0x30')](_0x117c67)[_0x1fd1('0xc')](handleEntityNotFound(_0x56dfae,null))[_0x1fd1('0xc')](respondWithResult(_0x56dfae,null))[_0x1fd1('0x2e')](handleError(_0x56dfae,null));};exports[_0x1fd1('0x31')]=function(_0x35af0a,_0x8e7d86){return db['Dynamics365Account']['create'](_0x35af0a[_0x1fd1('0x32')],{})[_0x1fd1('0xc')](respondWithResult(_0x8e7d86,0xc9))[_0x1fd1('0x2e')](handleError(_0x8e7d86,null));};exports[_0x1fd1('0xb')]=function(_0x4d5fd,_0x4f52ef){if(_0x4d5fd[_0x1fd1('0x32')]['id']){delete _0x4d5fd[_0x1fd1('0x32')]['id'];}return db[_0x1fd1('0x2c')][_0x1fd1('0x30')]({'where':{'id':_0x4d5fd['params']['id']}})[_0x1fd1('0xc')](handleEntityNotFound(_0x4f52ef,null))[_0x1fd1('0xc')](saveUpdates(_0x4d5fd['body'],null))[_0x1fd1('0xc')](respondWithResult(_0x4f52ef,null))['catch'](handleError(_0x4f52ef,null));};exports[_0x1fd1('0xd')]=function(_0x256825,_0x5f3a3f){return db['Dynamics365Account'][_0x1fd1('0x30')]({'where':{'id':_0x256825[_0x1fd1('0x2f')]['id']}})[_0x1fd1('0xc')](handleEntityNotFound(_0x5f3a3f,null))[_0x1fd1('0xc')](removeEntity(_0x5f3a3f,null))['catch'](handleError(_0x5f3a3f,null));};exports[_0x1fd1('0x33')]=function(_0x3f64a6,_0x8cebea){var _0x1740e3={};var _0x465454={};var _0x174382;var _0x5575b4;return db[_0x1fd1('0x2c')]['findOne']({'where':{'id':_0x3f64a6[_0x1fd1('0x2f')]['id']}})[_0x1fd1('0xc')](handleEntityNotFound(_0x8cebea,null))[_0x1fd1('0xc')](function(_0x38d45b){if(_0x38d45b){_0x174382=_0x38d45b;_0x465454[_0x1fd1('0x17')]=_[_0x1fd1('0x1a')](db[_0x1fd1('0x34')][_0x1fd1('0x13')]);_0x465454[_0x1fd1('0x19')]=_[_0x1fd1('0x1a')](_0x3f64a6[_0x1fd1('0x19')]);_0x465454[_0x1fd1('0x1b')]=_['intersection'](_0x465454[_0x1fd1('0x17')],_0x465454['query']);_0x1740e3['attributes']=_[_0x1fd1('0x1c')](_0x465454['model'],qs[_0x1fd1('0x1e')](_0x3f64a6['query'][_0x1fd1('0x1e')]));_0x1740e3[_0x1fd1('0x1d')]=_0x1740e3[_0x1fd1('0x1d')]['length']?_0x1740e3[_0x1fd1('0x1d')]:_0x465454[_0x1fd1('0x17')];_0x1740e3[_0x1fd1('0x35')]=qs[_0x1fd1('0x22')](_0x3f64a6[_0x1fd1('0x19')]['sort']);_0x1740e3['where']=qs[_0x1fd1('0x1b')](_[_0x1fd1('0x24')](_0x3f64a6[_0x1fd1('0x19')],_0x465454[_0x1fd1('0x1b')]));if(_0x3f64a6[_0x1fd1('0x19')]['filter']){_0x1740e3[_0x1fd1('0x23')]=_[_0x1fd1('0x25')](_0x1740e3[_0x1fd1('0x23')],{'$or':_[_0x1fd1('0x18')](_0x1740e3[_0x1fd1('0x1d')],function(_0x1a4556){var _0x190c96={};_0x190c96[_0x1a4556]={'$like':'%'+_0x3f64a6[_0x1fd1('0x19')]['filter']+'%'};return _0x190c96;})});}_0x1740e3=_[_0x1fd1('0x25')]({},_0x1740e3,_0x3f64a6[_0x1fd1('0x28')]);return _0x174382[_0x1fd1('0x33')](_0x1740e3);}})[_0x1fd1('0xc')](function(_0x44e5a9){if(_0x44e5a9){_0x5575b4=_0x44e5a9['length'];if(!_0x3f64a6['query'][_0x1fd1('0x36')](_0x1fd1('0x20'))){_0x1740e3[_0x1fd1('0x21')]=qs['limit'](_0x3f64a6[_0x1fd1('0x19')]['limit']);_0x1740e3[_0x1fd1('0x9')]=qs['offset'](_0x3f64a6['query'][_0x1fd1('0x9')]);}return _0x174382[_0x1fd1('0x33')](_0x1740e3);}})['then'](function(_0x30230a){if(_0x30230a){return _0x30230a?{'count':_0x5575b4,'rows':_0x30230a}:null;}})['then'](respondWithResult(_0x8cebea,null))['catch'](handleError(_0x8cebea,null));};exports[_0x1fd1('0x37')]=function(_0x185ad5,_0x27b2da){if(_0x185ad5[_0x1fd1('0x32')]['id']){delete _0x185ad5[_0x1fd1('0x32')]['id'];}return db['Dynamics365Account'][_0x1fd1('0x38')]({'where':{'id':_0x185ad5[_0x1fd1('0x2f')]['id']}})['then'](handleEntityNotFound(_0x27b2da,null))[_0x1fd1('0xc')](function(_0x3bf0c6){if(_0x3bf0c6){_0x185ad5[_0x1fd1('0x32')][_0x1fd1('0x39')]=_0x3bf0c6['id'];_0x185ad5['body'][_0x1fd1('0x3a')]=integrations['getSubjects'](_0x185ad5[_0x1fd1('0x32')]['channel'],_0x185ad5[_0x1fd1('0x32')][_0x1fd1('0x15')]);_0x185ad5[_0x1fd1('0x32')][_0x1fd1('0x3b')]=integrations[_0x1fd1('0x3c')](_0x185ad5[_0x1fd1('0x32')]['channel'],_0x185ad5[_0x1fd1('0x32')][_0x1fd1('0x15')]);return db[_0x1fd1('0x34')][_0x1fd1('0x31')](_0x185ad5['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x1fd1('0xc')](respondWithResult(_0x27b2da,null))['catch'](handleError(_0x27b2da,null));};function sanitizeRemoteUri(_0x22f78a){var _0x39cdd6=_0x22f78a[_0x1fd1('0x3d')](-0x1);if(_0x39cdd6==='/')return _0x22f78a[_0x1fd1('0x3e')](0x0,_0x22f78a[_0x1fd1('0x3f')](_0x39cdd6));return _0x22f78a;}function getWebApiUrl(_0x3b2482){return util['format'](_0x1fd1('0x40'),_0x3b2482);}exports['getFields']=function(_0x314102,_0x19a152){var _0xfe5a2a=_0x314102[_0x1fd1('0x19')][_0x1fd1('0x41')];var _0x29f9bf=_0xfe5a2a===_0x1fd1('0x42')?_0x1fd1('0x43'):_0x1fd1('0x44');var _0xb05aee='';var _0x146292='';var _0x52af96='';var _0x3d809c='';var _0x37066c='';var _0x473edf='';var _0x36ca2e='';var _0x1f9c4f='';var _0x1af2cb=['title',_0x1fd1('0x45'),'customerid','ownerid','caseorigincode',_0x1fd1('0x46'),_0x1fd1('0x47'),'regardingobjectid',_0x1fd1('0x48'),_0x1fd1('0x49')];var _0x366e8f=[_0x1fd1('0x4a'),_0x1fd1('0x4b'),_0x1fd1('0x4c'),_0x1fd1('0x4d'),_0x1fd1('0x4e'),'contactidyominame',_0x1fd1('0x4f'),_0x1fd1('0x50'),_0x1fd1('0x51'),_0x1fd1('0x52'),_0x1fd1('0x53'),_0x1fd1('0x54'),_0x1fd1('0x55'),_0x1fd1('0x56'),_0x1fd1('0x57'),_0x1fd1('0x58'),'customeridtype',_0x1fd1('0x59'),_0x1fd1('0x5a'),_0x1fd1('0x5b'),_0x1fd1('0x5c'),'entityimage_url',_0x1fd1('0x5d'),'exchangerate','firstresponsebykpiidname',_0x1fd1('0x5e'),_0x1fd1('0x5f'),'influencescore',_0x1fd1('0x60'),_0x1fd1('0x61'),'masteridname',_0x1fd1('0x62'),'modifiedbyexternalpartyyominame',_0x1fd1('0x63'),_0x1fd1('0x64'),_0x1fd1('0x65'),_0x1fd1('0x66'),_0x1fd1('0x67'),_0x1fd1('0x68'),_0x1fd1('0x69'),'numberofchildincidents',_0x1fd1('0x6a'),_0x1fd1('0x6b'),_0x1fd1('0x6c'),'owneridtype',_0x1fd1('0x6d'),_0x1fd1('0x6e'),_0x1fd1('0x6f'),'primarycontactidyominame',_0x1fd1('0x70'),_0x1fd1('0x71'),_0x1fd1('0x72'),_0x1fd1('0x73'),_0x1fd1('0x74'),'responseby',_0x1fd1('0x75'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x1fd1('0x76'),_0x1fd1('0x77'),_0x1fd1('0x78'),_0x1fd1('0x79'),'subjectidname','ticketnumber',_0x1fd1('0x7a'),'transactioncurrencyidname',_0x1fd1('0x7b'),_0x1fd1('0x7c'),'versionnumber'];var _0x4fbac9=_0x1af2cb['concat'](_0x366e8f);return db[_0x1fd1('0x2c')][_0x1fd1('0x38')]({'where':{'id':_0x314102[_0x1fd1('0x2f')]['id']},'attributes':['id',_0x1fd1('0x7d'),_0x1fd1('0x7e'),_0x1fd1('0x7f'),_0x1fd1('0x80'),'clientId',_0x1fd1('0x81'),_0x1fd1('0x82')],'include':[{'model':db[_0x1fd1('0x83')],'as':_0x1fd1('0x83'),'attributes':['id',_0x1fd1('0x84'),_0x1fd1('0x85')]}]})[_0x1fd1('0xc')](handleEntityNotFound(_0x19a152,null))['then'](function(_0x444277){if(_0x444277){if(_0x444277[_0x1fd1('0x82')]){_0x444277[_0x1fd1('0x86')]=_0x444277[_0x1fd1('0x83')]['data5'];_0x1f9c4f=sanitizeRemoteUri(_0x444277[_0x1fd1('0x83')][_0x1fd1('0x85')]);_0x36ca2e=getWebApiUrl(_0x1f9c4f);return _0x444277;}_0x1f9c4f=sanitizeRemoteUri(_0x444277['remoteUri']);_0x36ca2e=getWebApiUrl(_0x1f9c4f);var _0x31f973={'method':_0x1fd1('0x87'),'uri':'https://login.microsoftonline.com/'+_0x444277[_0x1fd1('0x80')]+_0x1fd1('0x88'),'form':{'client_id':_0x444277[_0x1fd1('0x89')],'resource':_0x1f9c4f,'username':_0x444277[_0x1fd1('0x7d')],'password':_0x444277[_0x1fd1('0x7e')],'grant_type':_0x1fd1('0x7e'),'client_secret':_0x444277[_0x1fd1('0x81')]},'json':!![]};return rp(_0x31f973);}})[_0x1fd1('0xc')](function(_0x23251d){_0x473edf=_0x23251d[_0x1fd1('0x86')];var _0x52e98a={'method':_0x1fd1('0x8a'),'uri':encodeURI(_0x36ca2e+_0x1fd1('0x8b')+_0x29f9bf+'\x27'),'headers':{'Authorization':_0x1fd1('0x8c')+_0x473edf,'If-None-Match':null,'OData-Version':_0x1fd1('0x8d')},'json':!![]};return rp(_0x52e98a);})[_0x1fd1('0xc')](function(_0x2ca379){var _0xbd9ec9=_0x2ca379[_0x1fd1('0x8e')][0x0];var _0x2f957c=_0xbd9ec9[_0x1fd1('0x8f')];var _0x513781={'method':_0x1fd1('0x8a'),'uri':_0x36ca2e+'EntityDefinitions('+_0x2f957c+_0x1fd1('0x90'),'headers':{'Authorization':_0x1fd1('0x8c')+_0x473edf,'If-None-Match':null,'OData-Version':_0x1fd1('0x8d')},'json':!![]};return rp(_0x513781);})[_0x1fd1('0xc')](function(_0x58a57c){_0xb05aee=_0x58a57c;_0x146292=_0xb05aee['Attributes'];_0x146292=_['remove'](_0x146292,function(_0x412974){return!_0x4fbac9[_0x1fd1('0x91')](_0x412974[_0x1fd1('0x92')]);});var _0x13855c=[];var _0x536159=[];_0x146292[_0x1fd1('0x93')](function(_0x132831){if(_0x132831[_0x1fd1('0x94')]){var _0x4d410d=_0x132831['@odata.type']['substring'](_0x132831[_0x1fd1('0x94')][_0x1fd1('0x3f')]('.')+0x1);if(_0x4d410d==='PicklistAttributeMetadata'){_0x13855c[_0x1fd1('0x95')](getSelectList(_0x36ca2e,_0xfe5a2a,_0x536159,_0xb05aee[_0x1fd1('0x8f')],_0x132831['MetadataId'],_0x473edf));}}});return Promise[_0x1fd1('0x96')](_0x13855c);})[_0x1fd1('0xc')](function(_0x305373){_0x52af96=_0x305373[0x0];var _0x2f7150=[];var _0x34dd39=[];_0x146292[_0x1fd1('0x93')](function(_0x171f62){if(!_['isNil'](_0x171f62['@odata.type'])){var _0x20b716=_0x171f62[_0x1fd1('0x94')][_0x1fd1('0x3e')](_0x171f62['@odata.type'][_0x1fd1('0x3f')]('.')+0x1);if(_0x20b716===_0x1fd1('0x97')){_0x2f7150[_0x1fd1('0x95')](getBooleanList(_0x36ca2e,_0xfe5a2a,_0x34dd39,_0xb05aee[_0x1fd1('0x8f')],_0x171f62[_0x1fd1('0x8f')],_0x473edf));}}});return Promise[_0x1fd1('0x96')](_0x2f7150);})[_0x1fd1('0xc')](function(_0x8b6d48){_0x3d809c=_0x8b6d48[0x0];var _0x29c487=[];var _0x1ab6c0=[];_0x146292[_0x1fd1('0x93')](function(_0x2068f5){if(_0x2068f5[_0x1fd1('0x94')]){var _0x1f5b0b=_0x2068f5[_0x1fd1('0x94')][_0x1fd1('0x3e')](_0x2068f5[_0x1fd1('0x94')][_0x1fd1('0x3f')]('.')+0x1);if(_0x1f5b0b===_0x1fd1('0x98')||_0x1f5b0b===_0x1fd1('0x99')||_0x1f5b0b===_0x1fd1('0x9a')||_0x1f5b0b===_0x1fd1('0x9b')||_0x1f5b0b===_0x1fd1('0x9c')||_0x1f5b0b==='DateTimeAttributeMetadata'||_0x1f5b0b===_0x1fd1('0x9d')||_0x1f5b0b==='EntityNameAttributeMetadata'||_0x1f5b0b===_0x1fd1('0x9e')||_0x1f5b0b===_0x1fd1('0x9f')){_0x29c487[_0x1fd1('0x95')](getInputList(_0x36ca2e,_0xfe5a2a,_0x1f5b0b,_0x1ab6c0,_0xb05aee['MetadataId'],_0x2068f5['MetadataId'],_0x473edf));}}});return Promise[_0x1fd1('0x96')](_0x29c487);})[_0x1fd1('0xc')](function(_0x30e94b){_0x37066c=_0x30e94b[0x0];var _0x59f555=_0x52af96[_0x1fd1('0xa0')](_0x3d809c)[_0x1fd1('0xa0')](_0x37066c);var _0x57ea37={'count':_0x59f555[_0x1fd1('0x1f')],'rows':_0x59f555};return _0x57ea37;})[_0x1fd1('0xc')](respondWithResult(_0x19a152,null))[_0x1fd1('0x2e')](function(_0x18d379){var _0x2fade4=_0x314102['query']['test']?0x1f4:_0x18d379[_0x1fd1('0xa1')]||0x1f4;logger[_0x1fd1('0xf')](_0x18d379[_0x1fd1('0x10')]);delete _0x18d379['name'];if(_0x2fade4===0x191){_0x2fade4=0x190;}_0x19a152[_0x1fd1('0x7')](_0x2fade4)[_0x1fd1('0xa2')](_0x314102[_0x1fd1('0x19')][_0x1fd1('0xa3')]?{'message':_0x1fd1('0xa4'),'statusCode':_0x18d379[_0x1fd1('0xa1')]}:_0x18d379);});};function getSelectList(_0x7d4b9b,_0x267c17,_0x224ffd,_0x19779f,_0x2faa9f,_0x445f0e){var _0x3a294f={'method':_0x1fd1('0x8a'),'uri':_0x7d4b9b+_0x1fd1('0xa5')+_0x19779f+_0x1fd1('0xa6')+_0x2faa9f+_0x1fd1('0xa7')+_0x1fd1('0xa8'),'headers':{'Authorization':_0x1fd1('0x8c')+_0x445f0e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a294f)[_0x1fd1('0xc')](function(_0x7ca6c3){var _0x36dfaf=[];var _0x148a21=_0x7ca6c3['OptionSet'][_0x1fd1('0xa9')];_0x148a21[_0x1fd1('0x93')](function(_0x1660ff){_0x36dfaf[_0x1fd1('0x95')]({'name':_0x1660ff[_0x1fd1('0xaa')][_0x1fd1('0xab')][_0x1fd1('0xaa')],'value':String(_0x1660ff['Value'])});});var _0x4c6636={'id':_0x267c17+'_'+_0x7ca6c3[_0x1fd1('0x92')],'name':_0x7ca6c3['DisplayName'][_0x1fd1('0xab')][_0x1fd1('0xaa')],'custom':![],'options':_0x36dfaf};_0x224ffd['push'](_0x4c6636);return _0x224ffd;});}function getBooleanList(_0x2b30cb,_0x49e387,_0x3de451,_0x2990fb,_0x49ac9f,_0x18a89b){var _0x4d18ec={'method':'GET','uri':_0x2b30cb+_0x1fd1('0xa5')+_0x2990fb+_0x1fd1('0xa6')+_0x49ac9f+_0x1fd1('0xac'),'headers':{'Authorization':_0x1fd1('0x8c')+_0x18a89b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d18ec)['then'](function(_0x257043){var _0x57a080=[];_0x57a080[_0x1fd1('0x95')]({'name':_0x257043[_0x1fd1('0xad')][_0x1fd1('0xae')][_0x1fd1('0xaa')][_0x1fd1('0xab')][_0x1fd1('0xaa')],'value':'true'},{'name':_0x257043[_0x1fd1('0xad')]['FalseOption']['Label'][_0x1fd1('0xab')]['Label'],'value':_0x1fd1('0xaf')});var _0x3c42fc={'id':_0x49e387+'_'+_0x257043[_0x1fd1('0x92')],'name':_0x257043[_0x1fd1('0xb0')][_0x1fd1('0xab')][_0x1fd1('0xaa')],'custom':![],'options':_0x57a080};_0x3de451[_0x1fd1('0x95')](_0x3c42fc);return _0x3de451;});}function getInputList(_0x144e73,_0x3bde6a,_0x4fb3b4,_0x1f7ffc,_0x35a4a9,_0x159da2,_0x4bcb51){var _0x4bdf5c={'method':_0x1fd1('0x8a'),'uri':_0x144e73+_0x1fd1('0xa5')+_0x35a4a9+_0x1fd1('0xa6')+_0x159da2+_0x1fd1('0xb1')+_0x4fb3b4+_0x1fd1('0xb2'),'headers':{'Authorization':_0x1fd1('0x8c')+_0x4bcb51,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4bdf5c)[_0x1fd1('0xc')](function(_0x5e1a52){var _0x427e31={'id':_0x3bde6a+'_'+_0x5e1a52[_0x1fd1('0x92')],'name':_0x5e1a52[_0x1fd1('0xb0')][_0x1fd1('0xab')]?_0x5e1a52[_0x1fd1('0xb0')][_0x1fd1('0xab')][_0x1fd1('0xaa')]:_0x5e1a52[_0x1fd1('0x92')],'custom':![],'options':[]};_0x1f7ffc[_0x1fd1('0x95')](_0x427e31);return _0x1f7ffc;});} \ No newline at end of file +var _0x3aa2=['findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','remoteUri','tenantId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','/oauth2/token','clientId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','DisplayName',')/Attributes(','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','update','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','merge','create','body','getConfigurations','Dynamics365Configuration','pick','hasOwnProperty','nolimit','addConfiguration'];(function(_0x33b953,_0x180f06){var _0x148c7b=function(_0xfc75e5){while(--_0xfc75e5){_0x33b953['push'](_0x33b953['shift']());}};_0x148c7b(++_0x180f06);}(_0x3aa2,0x13b));var _0x23aa=function(_0x106db6,_0xd6decc){_0x106db6=_0x106db6-0x0;var _0x4dc175=_0x3aa2[_0x106db6];return _0x4dc175;};'use strict';var rp=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var _=require('lodash');var qs=require(_0x23aa('0x2'));var logger=require('../../config/logger')('api');var db=require(_0x23aa('0x3'))['db'];var integrations=require(_0x23aa('0x4'));function respondWithResult(_0x556204,_0x38c0ab){_0x38c0ab=_0x38c0ab||0xc8;return function(_0x5b9038){if(_0x5b9038){return _0x556204[_0x23aa('0x5')](_0x38c0ab)[_0x23aa('0x6')](_0x5b9038);}};}function respondWithFilteredResult(_0x4868c2,_0x461bde){return function(_0xacc1a7){if(_0xacc1a7){var _0x31e9e4=typeof _0x461bde['offset']===_0x23aa('0x7')&&typeof _0x461bde[_0x23aa('0x8')]===_0x23aa('0x7');var _0x5c2595=_0xacc1a7['count'];var _0xb70adc=_0x31e9e4?0x0:_0x461bde['offset'];var _0x3f9456=_0x31e9e4?_0xacc1a7[_0x23aa('0x9')]:_0x461bde[_0x23aa('0xa')]+_0x461bde[_0x23aa('0x8')];var _0x106b13;if(_0x3f9456>=_0x5c2595){_0x3f9456=_0x5c2595;_0x106b13=0xc8;}else{_0x106b13=0xce;}_0x4868c2[_0x23aa('0x5')](_0x106b13);return _0x4868c2[_0x23aa('0xb')]('Content-Range',_0xb70adc+'-'+_0x3f9456+'/'+_0x5c2595)['json'](_0xacc1a7);}return null;};}function saveUpdates(_0x4f9c72){return function(_0x1f71ef){if(_0x1f71ef){return _0x1f71ef[_0x23aa('0xc')](_0x4f9c72)[_0x23aa('0xd')](function(_0x1d3725){return _0x1d3725;});}return null;};}function removeEntity(_0xeab146){return function(_0x284fab){if(_0x284fab){return _0x284fab[_0x23aa('0xe')]()[_0x23aa('0xd')](function(){_0xeab146['status'](0xcc)[_0x23aa('0xf')]();});}};}function handleEntityNotFound(_0x4d83ca){return function(_0x5dacbe){if(!_0x5dacbe){_0x4d83ca[_0x23aa('0x10')](0x194);}return _0x5dacbe;};}function handleError(_0x409c47,_0xe66a17){_0xe66a17=_0xe66a17||0x1f4;return function(_0x4300a0){logger[_0x23aa('0x11')](_0x4300a0[_0x23aa('0x12')]);if(_0x4300a0['name']){delete _0x4300a0[_0x23aa('0x13')];}_0x409c47[_0x23aa('0x5')](_0xe66a17)['send'](_0x4300a0);};}exports['index']=function(_0x4d660f,_0x5aee45){var _0x443933={},_0xa002fb={},_0x14a8a={'count':0x0,'rows':[]};var _0x545ac6=_[_0x23aa('0x14')](db[_0x23aa('0x15')]['rawAttributes'],function(_0x1c38cd){return{'name':_0x1c38cd[_0x23aa('0x16')],'type':_0x1c38cd[_0x23aa('0x17')][_0x23aa('0x18')]};});_0xa002fb[_0x23aa('0x19')]=_[_0x23aa('0x14')](_0x545ac6,_0x23aa('0x13'));_0xa002fb[_0x23aa('0x1a')]=_[_0x23aa('0x1b')](_0x4d660f['query']);_0xa002fb[_0x23aa('0x1c')]=_[_0x23aa('0x1d')](_0xa002fb[_0x23aa('0x19')],_0xa002fb[_0x23aa('0x1a')]);_0x443933['attributes']=_[_0x23aa('0x1d')](_0xa002fb['model'],qs[_0x23aa('0x1e')](_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x1e')]));_0x443933['attributes']=_0x443933[_0x23aa('0x1f')][_0x23aa('0x20')]?_0x443933[_0x23aa('0x1f')]:_0xa002fb[_0x23aa('0x19')];if(!_0x4d660f[_0x23aa('0x1a')]['hasOwnProperty']('nolimit')){_0x443933[_0x23aa('0x8')]=qs[_0x23aa('0x8')](_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x8')]);_0x443933[_0x23aa('0xa')]=qs[_0x23aa('0xa')](_0x4d660f[_0x23aa('0x1a')][_0x23aa('0xa')]);}_0x443933[_0x23aa('0x21')]=qs[_0x23aa('0x22')](_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x22')]);_0x443933[_0x23aa('0x23')]=qs[_0x23aa('0x1c')](_['pick'](_0x4d660f['query'],_0xa002fb[_0x23aa('0x1c')]),_0x545ac6);if(_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x24')]){_0x443933['where']=_['merge'](_0x443933[_0x23aa('0x23')],{'$or':_[_0x23aa('0x14')](_0x545ac6,function(_0x46553e){if(_0x46553e['type']!==_0x23aa('0x25')){var _0x425c8f={};_0x425c8f[_0x46553e['name']]={'$like':'%'+_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x24')]+'%'};return _0x425c8f;}})});}_0x443933=_['merge']({},_0x443933,_0x4d660f[_0x23aa('0x26')]);var _0x348283={'where':_0x443933['where']};return db[_0x23aa('0x15')][_0x23aa('0x9')](_0x348283)[_0x23aa('0xd')](function(_0x230a77){_0x14a8a[_0x23aa('0x9')]=_0x230a77;if(_0x4d660f[_0x23aa('0x1a')][_0x23aa('0x27')]){_0x443933['include']=[{'all':!![]}];}return db[_0x23aa('0x15')][_0x23aa('0x28')](_0x443933);})[_0x23aa('0xd')](function(_0x58a6af){_0x14a8a['rows']=_0x58a6af;return _0x14a8a;})[_0x23aa('0xd')](respondWithFilteredResult(_0x5aee45,_0x443933))[_0x23aa('0x29')](handleError(_0x5aee45,null));};exports[_0x23aa('0x2a')]=function(_0x48256d,_0x415e93){var _0x377520={'raw':![],'where':{'id':_0x48256d[_0x23aa('0x2b')]['id']}},_0x3dc3b6={};_0x3dc3b6[_0x23aa('0x19')]=_[_0x23aa('0x1b')](db[_0x23aa('0x15')][_0x23aa('0x2c')]);_0x3dc3b6[_0x23aa('0x1a')]=_[_0x23aa('0x1b')](_0x48256d[_0x23aa('0x1a')]);_0x3dc3b6[_0x23aa('0x1c')]=_['intersection'](_0x3dc3b6['model'],_0x3dc3b6[_0x23aa('0x1a')]);_0x377520['attributes']=_['intersection'](_0x3dc3b6[_0x23aa('0x19')],qs['fields'](_0x48256d[_0x23aa('0x1a')][_0x23aa('0x1e')]));_0x377520[_0x23aa('0x1f')]=_0x377520['attributes'][_0x23aa('0x20')]?_0x377520[_0x23aa('0x1f')]:_0x3dc3b6[_0x23aa('0x19')];if(_0x48256d[_0x23aa('0x1a')][_0x23aa('0x27')]){_0x377520[_0x23aa('0x2d')]=[{'all':!![]}];}_0x377520=_[_0x23aa('0x2e')]({},_0x377520,_0x48256d['options']);return db[_0x23aa('0x15')]['find'](_0x377520)[_0x23aa('0xd')](handleEntityNotFound(_0x415e93,null))['then'](respondWithResult(_0x415e93,null))['catch'](handleError(_0x415e93,null));};exports['create']=function(_0x284b94,_0x4e04de){return db['Dynamics365Account'][_0x23aa('0x2f')](_0x284b94[_0x23aa('0x30')],{})[_0x23aa('0xd')](respondWithResult(_0x4e04de,0xc9))[_0x23aa('0x29')](handleError(_0x4e04de,null));};exports[_0x23aa('0xc')]=function(_0x570f18,_0x5efce0){if(_0x570f18[_0x23aa('0x30')]['id']){delete _0x570f18[_0x23aa('0x30')]['id'];}return db[_0x23aa('0x15')]['find']({'where':{'id':_0x570f18[_0x23aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5efce0,null))[_0x23aa('0xd')](saveUpdates(_0x570f18[_0x23aa('0x30')],null))[_0x23aa('0xd')](respondWithResult(_0x5efce0,null))['catch'](handleError(_0x5efce0,null));};exports[_0x23aa('0xe')]=function(_0x22058c,_0x5e373f){return db[_0x23aa('0x15')]['find']({'where':{'id':_0x22058c[_0x23aa('0x2b')]['id']}})[_0x23aa('0xd')](handleEntityNotFound(_0x5e373f,null))[_0x23aa('0xd')](removeEntity(_0x5e373f,null))[_0x23aa('0x29')](handleError(_0x5e373f,null));};exports[_0x23aa('0x31')]=function(_0x59ca03,_0x3b9212){var _0x396173={};var _0x4ef5f4={};var _0x284533;var _0x31df62;return db[_0x23aa('0x15')]['findOne']({'where':{'id':_0x59ca03[_0x23aa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3b9212,null))[_0x23aa('0xd')](function(_0xf6c40){if(_0xf6c40){_0x284533=_0xf6c40;_0x4ef5f4[_0x23aa('0x19')]=_[_0x23aa('0x1b')](db[_0x23aa('0x32')]['rawAttributes']);_0x4ef5f4[_0x23aa('0x1a')]=_[_0x23aa('0x1b')](_0x59ca03['query']);_0x4ef5f4[_0x23aa('0x1c')]=_[_0x23aa('0x1d')](_0x4ef5f4[_0x23aa('0x19')],_0x4ef5f4[_0x23aa('0x1a')]);_0x396173[_0x23aa('0x1f')]=_['intersection'](_0x4ef5f4[_0x23aa('0x19')],qs[_0x23aa('0x1e')](_0x59ca03[_0x23aa('0x1a')][_0x23aa('0x1e')]));_0x396173[_0x23aa('0x1f')]=_0x396173[_0x23aa('0x1f')][_0x23aa('0x20')]?_0x396173[_0x23aa('0x1f')]:_0x4ef5f4['model'];_0x396173[_0x23aa('0x21')]=qs[_0x23aa('0x22')](_0x59ca03[_0x23aa('0x1a')][_0x23aa('0x22')]);_0x396173['where']=qs[_0x23aa('0x1c')](_[_0x23aa('0x33')](_0x59ca03[_0x23aa('0x1a')],_0x4ef5f4[_0x23aa('0x1c')]));if(_0x59ca03['query']['filter']){_0x396173[_0x23aa('0x23')]=_[_0x23aa('0x2e')](_0x396173[_0x23aa('0x23')],{'$or':_[_0x23aa('0x14')](_0x396173[_0x23aa('0x1f')],function(_0x1fdca9){var _0x1a50ec={};_0x1a50ec[_0x1fdca9]={'$like':'%'+_0x59ca03[_0x23aa('0x1a')][_0x23aa('0x24')]+'%'};return _0x1a50ec;})});}_0x396173=_[_0x23aa('0x2e')]({},_0x396173,_0x59ca03[_0x23aa('0x26')]);return _0x284533[_0x23aa('0x31')](_0x396173);}})[_0x23aa('0xd')](function(_0x1effd3){if(_0x1effd3){_0x31df62=_0x1effd3[_0x23aa('0x20')];if(!_0x59ca03['query'][_0x23aa('0x34')](_0x23aa('0x35'))){_0x396173[_0x23aa('0x8')]=qs[_0x23aa('0x8')](_0x59ca03[_0x23aa('0x1a')][_0x23aa('0x8')]);_0x396173[_0x23aa('0xa')]=qs['offset'](_0x59ca03[_0x23aa('0x1a')][_0x23aa('0xa')]);}return _0x284533['getConfigurations'](_0x396173);}})[_0x23aa('0xd')](function(_0x2b04dc){if(_0x2b04dc){return _0x2b04dc?{'count':_0x31df62,'rows':_0x2b04dc}:null;}})[_0x23aa('0xd')](respondWithResult(_0x3b9212,null))[_0x23aa('0x29')](handleError(_0x3b9212,null));};exports[_0x23aa('0x36')]=function(_0x3f336f,_0x4a3714){if(_0x3f336f[_0x23aa('0x30')]['id']){delete _0x3f336f[_0x23aa('0x30')]['id'];}return db[_0x23aa('0x15')][_0x23aa('0x37')]({'where':{'id':_0x3f336f['params']['id']}})[_0x23aa('0xd')](handleEntityNotFound(_0x4a3714,null))[_0x23aa('0xd')](function(_0x3bc38c){if(_0x3bc38c){_0x3f336f[_0x23aa('0x30')][_0x23aa('0x38')]=_0x3bc38c['id'];_0x3f336f[_0x23aa('0x30')][_0x23aa('0x39')]=integrations[_0x23aa('0x3a')](_0x3f336f[_0x23aa('0x30')][_0x23aa('0x3b')],_0x3f336f[_0x23aa('0x30')][_0x23aa('0x17')]);_0x3f336f['body'][_0x23aa('0x3c')]=integrations[_0x23aa('0x3d')](_0x3f336f['body'][_0x23aa('0x3b')],_0x3f336f['body'][_0x23aa('0x17')]);return db['Dynamics365Configuration'][_0x23aa('0x2f')](_0x3f336f[_0x23aa('0x30')],{'include':[{'model':db[_0x23aa('0x3e')],'as':_0x23aa('0x39')},{'model':db[_0x23aa('0x3e')],'as':_0x23aa('0x3c')}]});}return null;})['then'](respondWithResult(_0x4a3714,null))[_0x23aa('0x29')](handleError(_0x4a3714,null));};function sanitizeRemoteUri(_0x582252){var _0x34573a=_0x582252[_0x23aa('0x3f')](-0x1);if(_0x34573a==='/')return _0x582252['substring'](0x0,_0x582252[_0x23aa('0x40')](_0x34573a));return _0x582252;}function getWebApiUrl(_0x210529){return util[_0x23aa('0x41')](_0x23aa('0x42'),_0x210529);}exports['getFields']=function(_0x11475d,_0xc63470){var _0x13c3ce=_0x11475d[_0x23aa('0x1a')][_0x23aa('0x43')];var _0x4fe580=_0x13c3ce===_0x23aa('0x44')?'Incident':_0x23aa('0x45');var _0x3f5c0c='';var _0x5bcbbf='';var _0x194cde='';var _0x14eef3='';var _0x363fa9='';var _0x280ae8='';var _0x4f561e='';var _0x6977b='';var _0x5601e0=['title',_0x23aa('0x46'),_0x23aa('0x47'),_0x23aa('0x48'),_0x23aa('0x49'),_0x23aa('0x4a'),_0x23aa('0x4b'),_0x23aa('0x4c'),_0x23aa('0x4d'),_0x23aa('0x4e')];var _0x3a9f39=[_0x23aa('0x4f'),_0x23aa('0x50'),_0x23aa('0x51'),_0x23aa('0x52'),'contactidname','contactidyominame','contractdetailidname',_0x23aa('0x53'),_0x23aa('0x54'),_0x23aa('0x55'),'createdbyname',_0x23aa('0x56'),_0x23aa('0x57'),'createdonbehalfbyname',_0x23aa('0x58'),_0x23aa('0x59'),_0x23aa('0x5a'),_0x23aa('0x5b'),_0x23aa('0x5c'),_0x23aa('0x5d'),_0x23aa('0x5e'),_0x23aa('0x5f'),'escalatedon',_0x23aa('0x60'),_0x23aa('0x61'),_0x23aa('0x62'),'importsequencenumber',_0x23aa('0x63'),_0x23aa('0x64'),_0x23aa('0x65'),'masteridname',_0x23aa('0x66'),_0x23aa('0x67'),_0x23aa('0x68'),_0x23aa('0x69'),_0x23aa('0x6a'),_0x23aa('0x6b'),'modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0x23aa('0x6c'),_0x23aa('0x6d'),_0x23aa('0x6e'),_0x23aa('0x6f'),_0x23aa('0x70'),'owneridyominame','parentcaseidname',_0x23aa('0x71'),_0x23aa('0x72'),'prioritycodename',_0x23aa('0x73'),_0x23aa('0x74'),'resolveby',_0x23aa('0x75'),_0x23aa('0x76'),'responsiblecontactidname',_0x23aa('0x77'),_0x23aa('0x78'),_0x23aa('0x79'),_0x23aa('0x7a'),_0x23aa('0x7b'),_0x23aa('0x7c'),_0x23aa('0x7d'),_0x23aa('0x7e'),_0x23aa('0x7f'),'timezoneruleversionnumber',_0x23aa('0x80'),_0x23aa('0x81'),_0x23aa('0x82'),'versionnumber'];var _0x2cb555=_0x5601e0['concat'](_0x3a9f39);return db[_0x23aa('0x15')][_0x23aa('0x37')]({'where':{'id':_0x11475d['params']['id']},'attributes':['id',_0x23aa('0x83'),'password',_0x23aa('0x84'),_0x23aa('0x85'),'clientId',_0x23aa('0x86'),'modernAuthentication'],'include':[{'model':db[_0x23aa('0x87')],'as':_0x23aa('0x87'),'attributes':['id',_0x23aa('0x88'),'data7']}]})[_0x23aa('0xd')](handleEntityNotFound(_0xc63470,null))[_0x23aa('0xd')](function(_0x1878c3){if(_0x1878c3){if(_0x1878c3[_0x23aa('0x89')]){_0x1878c3[_0x23aa('0x8a')]=_0x1878c3['CloudProvider']['data5'];_0x6977b=sanitizeRemoteUri(_0x1878c3[_0x23aa('0x87')][_0x23aa('0x8b')]);_0x4f561e=getWebApiUrl(_0x6977b);return _0x1878c3;}_0x6977b=sanitizeRemoteUri(_0x1878c3['remoteUri']);_0x4f561e=getWebApiUrl(_0x6977b);var _0xd0fac9={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x1878c3['tenantId']+_0x23aa('0x8c'),'form':{'client_id':_0x1878c3[_0x23aa('0x8d')],'resource':_0x6977b,'username':_0x1878c3[_0x23aa('0x83')],'password':_0x1878c3[_0x23aa('0x8e')],'grant_type':_0x23aa('0x8e'),'client_secret':_0x1878c3[_0x23aa('0x86')]},'json':!![]};return rp(_0xd0fac9);}})[_0x23aa('0xd')](function(_0x2e24cd){_0x280ae8=_0x2e24cd[_0x23aa('0x8a')];var _0x234055={'method':_0x23aa('0x8f'),'uri':encodeURI(_0x4f561e+_0x23aa('0x90')+_0x4fe580+'\x27'),'headers':{'Authorization':_0x23aa('0x91')+_0x280ae8,'If-None-Match':null,'OData-Version':_0x23aa('0x92')},'json':!![]};return rp(_0x234055);})[_0x23aa('0xd')](function(_0x1273d9){var _0x339ff1=_0x1273d9[_0x23aa('0x93')][0x0];var _0x4c4075=_0x339ff1[_0x23aa('0x94')];var _0xa38255={'method':_0x23aa('0x8f'),'uri':_0x4f561e+'EntityDefinitions('+_0x4c4075+_0x23aa('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x280ae8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xa38255);})[_0x23aa('0xd')](function(_0x17474f){_0x3f5c0c=_0x17474f;_0x5bcbbf=_0x3f5c0c['Attributes'];_0x5bcbbf=_[_0x23aa('0x96')](_0x5bcbbf,function(_0x4659e0){return!_0x2cb555[_0x23aa('0x97')](_0x4659e0[_0x23aa('0x98')]);});var _0x312878=[];var _0x3982dc=[];_0x5bcbbf['forEach'](function(_0x3dc05b){if(_0x3dc05b[_0x23aa('0x99')]){var _0x563108=_0x3dc05b['@odata.type'][_0x23aa('0x9a')](_0x3dc05b[_0x23aa('0x99')][_0x23aa('0x40')]('.')+0x1);if(_0x563108===_0x23aa('0x9b')){_0x312878[_0x23aa('0x9c')](getSelectList(_0x4f561e,_0x13c3ce,_0x3982dc,_0x3f5c0c['MetadataId'],_0x3dc05b[_0x23aa('0x94')],_0x280ae8));}}});return Promise[_0x23aa('0x9d')](_0x312878);})[_0x23aa('0xd')](function(_0x286dc9){_0x194cde=_0x286dc9[0x0];var _0x246783=[];var _0x11e1bf=[];_0x5bcbbf[_0x23aa('0x9e')](function(_0x31af91){if(!_[_0x23aa('0x9f')](_0x31af91[_0x23aa('0x99')])){var _0x1d5453=_0x31af91['@odata.type'][_0x23aa('0x9a')](_0x31af91[_0x23aa('0x99')][_0x23aa('0x40')]('.')+0x1);if(_0x1d5453===_0x23aa('0xa0')){_0x246783['push'](getBooleanList(_0x4f561e,_0x13c3ce,_0x11e1bf,_0x3f5c0c[_0x23aa('0x94')],_0x31af91['MetadataId'],_0x280ae8));}}});return Promise[_0x23aa('0x9d')](_0x246783);})[_0x23aa('0xd')](function(_0x1db44e){_0x14eef3=_0x1db44e[0x0];var _0x12f8cc=[];var _0x3b4580=[];_0x5bcbbf[_0x23aa('0x9e')](function(_0x50bcb3){if(_0x50bcb3[_0x23aa('0x99')]){var _0x221fb0=_0x50bcb3[_0x23aa('0x99')]['substring'](_0x50bcb3[_0x23aa('0x99')][_0x23aa('0x40')]('.')+0x1);if(_0x221fb0==='StringAttributeMetadata'||_0x221fb0===_0x23aa('0xa1')||_0x221fb0==='BigIntAttributeMetadata'||_0x221fb0===_0x23aa('0xa2')||_0x221fb0===_0x23aa('0xa3')||_0x221fb0===_0x23aa('0xa4')||_0x221fb0===_0x23aa('0xa5')||_0x221fb0==='EntityNameAttributeMetadata'||_0x221fb0==='StateAttributeMetadata'||_0x221fb0===_0x23aa('0xa6')){_0x12f8cc[_0x23aa('0x9c')](getInputList(_0x4f561e,_0x13c3ce,_0x221fb0,_0x3b4580,_0x3f5c0c[_0x23aa('0x94')],_0x50bcb3[_0x23aa('0x94')],_0x280ae8));}}});return Promise[_0x23aa('0x9d')](_0x12f8cc);})[_0x23aa('0xd')](function(_0x760653){_0x363fa9=_0x760653[0x0];var _0x3b0e30=_0x194cde[_0x23aa('0xa7')](_0x14eef3)['concat'](_0x363fa9);var _0x5ae573={'count':_0x3b0e30['length'],'rows':_0x3b0e30};return _0x5ae573;})[_0x23aa('0xd')](respondWithResult(_0xc63470,null))[_0x23aa('0x29')](function(_0x306639){var _0x3b58d5=_0x11475d[_0x23aa('0x1a')][_0x23aa('0xa8')]?0x1f4:_0x306639[_0x23aa('0xa9')]||0x1f4;logger[_0x23aa('0x11')](_0x306639[_0x23aa('0x12')]);delete _0x306639['name'];if(_0x3b58d5===0x191){_0x3b58d5=0x190;}_0xc63470[_0x23aa('0x5')](_0x3b58d5)[_0x23aa('0xaa')](_0x11475d['query'][_0x23aa('0xa8')]?{'message':_0x23aa('0xab'),'statusCode':_0x306639[_0x23aa('0xa9')]}:_0x306639);});};function getSelectList(_0x400f57,_0x3b490e,_0x3faeb8,_0x1a705f,_0xfe136e,_0x2d5653){var _0x1ff17d={'method':'GET','uri':_0x400f57+'EntityDefinitions('+_0x1a705f+')/Attributes('+_0xfe136e+_0x23aa('0xac')+_0x23aa('0xad'),'headers':{'Authorization':_0x23aa('0x91')+_0x2d5653,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ff17d)['then'](function(_0x38b324){var _0x4ebf65=[];var _0x45f40c=_0x38b324[_0x23aa('0xae')][_0x23aa('0xaf')];_0x45f40c[_0x23aa('0x9e')](function(_0x40fc91){_0x4ebf65[_0x23aa('0x9c')]({'name':_0x40fc91['Label']['UserLocalizedLabel'][_0x23aa('0xb0')],'value':String(_0x40fc91['Value'])});});var _0x1b5144={'id':_0x3b490e+'_'+_0x38b324[_0x23aa('0x98')],'name':_0x38b324['DisplayName'][_0x23aa('0xb1')]['Label'],'custom':![],'options':_0x4ebf65};_0x3faeb8[_0x23aa('0x9c')](_0x1b5144);return _0x3faeb8;});}function getBooleanList(_0x48bae6,_0x24badf,_0x37dae8,_0x40bb5a,_0x47c579,_0x4367fc){var _0x743292={'method':_0x23aa('0x8f'),'uri':_0x48bae6+_0x23aa('0xb2')+_0x40bb5a+')/Attributes('+_0x47c579+_0x23aa('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x4367fc,'If-None-Match':null,'OData-Version':_0x23aa('0x92')},'json':!![]};return rp(_0x743292)[_0x23aa('0xd')](function(_0x414eb6){var _0x240f63=[];_0x240f63[_0x23aa('0x9c')]({'name':_0x414eb6[_0x23aa('0xae')]['TrueOption'][_0x23aa('0xb0')][_0x23aa('0xb1')][_0x23aa('0xb0')],'value':'true'},{'name':_0x414eb6['OptionSet'][_0x23aa('0xb4')][_0x23aa('0xb0')][_0x23aa('0xb1')][_0x23aa('0xb0')],'value':_0x23aa('0xb5')});var _0x6df65c={'id':_0x24badf+'_'+_0x414eb6['LogicalName'],'name':_0x414eb6[_0x23aa('0xb6')][_0x23aa('0xb1')][_0x23aa('0xb0')],'custom':![],'options':_0x240f63};_0x37dae8[_0x23aa('0x9c')](_0x6df65c);return _0x37dae8;});}function getInputList(_0x629d14,_0x2c4147,_0x599c97,_0x4dd983,_0xd0e97d,_0xc71694,_0x248e5c){var _0x4df176={'method':_0x23aa('0x8f'),'uri':_0x629d14+_0x23aa('0xb2')+_0xd0e97d+_0x23aa('0xb7')+_0xc71694+')/Microsoft.Dynamics.CRM.'+_0x599c97+_0x23aa('0xb8'),'headers':{'Authorization':_0x23aa('0x91')+_0x248e5c,'If-None-Match':null,'OData-Version':_0x23aa('0x92')},'json':!![]};return rp(_0x4df176)[_0x23aa('0xd')](function(_0x4fd488){var _0x75b35d={'id':_0x2c4147+'_'+_0x4fd488[_0x23aa('0x98')],'name':_0x4fd488[_0x23aa('0xb6')][_0x23aa('0xb1')]?_0x4fd488[_0x23aa('0xb6')][_0x23aa('0xb1')][_0x23aa('0xb0')]:_0x4fd488['LogicalName'],'custom':![],'options':[]};_0x4dd983['push'](_0x75b35d);return _0x4dd983;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e160185..ef86d24 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x361cf1,_0x14e633){var _0x37c499=function(_0x270461){while(--_0x270461){_0x361cf1['push'](_0x361cf1['shift']());}};_0x37c499(++_0x14e633);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xc7bbad,_0x422549){var _0x11a8ee=function(_0x595ab4){while(--_0x595ab4){_0xc7bbad['push'](_0xc7bbad['shift']());}};_0x11a8ee(++_0x422549);}(_0x757a,0xde));var _0xa757=function(_0x3533da,_0x43e1a0){_0x3533da=_0x3533da-0x0;var _0x318a7c=_0x757a[_0x3533da];return _0x318a7c;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 8a28a69..d3d03e2 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 _0x3ea3=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0xde47a6,_0x110228){var _0x5bb183=function(_0x23773a){while(--_0x23773a){_0xde47a6['push'](_0xde47a6['shift']());}};_0x5bb183(++_0x110228);}(_0x3ea3,0x175));var _0x33ea=function(_0x3ebccf,_0x38937e){_0x3ebccf=_0x3ebccf-0x0;var _0x55ee31=_0x3ea3[_0x3ebccf];return _0x55ee31;};'use strict';var _=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var moment=require(_0x33ea('0x2'));var BPromise=require(_0x33ea('0x3'));var rs=require(_0x33ea('0x4'));var fs=require('fs');var Redis=require(_0x33ea('0x5'));var db=require(_0x33ea('0x6'))['db'];var utils=require(_0x33ea('0x7'));var logger=require(_0x33ea('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x33ea('0x9')][_0x33ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157679,_0x4da21e,_0x3858df){return new BPromise(function(_0x5c8b0f,_0x1e7264){return client[_0x33ea('0xb')](_0x157679,_0x3858df)['then'](function(_0x25f8bb){logger[_0x33ea('0xc')](_0x33ea('0xd'),_0x4da21e,_0x33ea('0xe'));logger[_0x33ea('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4da21e,'request\x20sent',JSON['stringify'](_0x25f8bb));if(_0x25f8bb['error']){if(_0x25f8bb[_0x33ea('0x10')]['code']===0x1f4){logger[_0x33ea('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x4da21e,_0x25f8bb[_0x33ea('0x10')]['message']);return _0x1e7264(_0x25f8bb[_0x33ea('0x10')][_0x33ea('0x11')]);}logger[_0x33ea('0x10')](_0x33ea('0xd'),_0x4da21e,_0x25f8bb[_0x33ea('0x10')][_0x33ea('0x11')]);return _0x5c8b0f(_0x25f8bb[_0x33ea('0x10')][_0x33ea('0x11')]);}else{logger[_0x33ea('0xc')](_0x33ea('0xd'),_0x4da21e,_0x33ea('0xe'));_0x5c8b0f(_0x25f8bb[_0x33ea('0x12')][_0x33ea('0x11')]);}})['catch'](function(_0x20fc57){logger[_0x33ea('0x10')](_0x33ea('0xd'),_0x4da21e,_0x20fc57);_0x1e7264(_0x20fc57);});});}exports[_0x33ea('0x13')]=function(_0xb49cf3){var _0x33016a=this;return new Promise(function(_0x468f2e,_0x234212){return db[_0x33ea('0x14')][_0x33ea('0x15')]({'raw':_0xb49cf3['options']?_0xb49cf3[_0x33ea('0x16')][_0x33ea('0x17')]===undefined?!![]:![]:!![],'where':_0xb49cf3[_0x33ea('0x16')]?_0xb49cf3[_0x33ea('0x16')][_0x33ea('0x18')]||null:null,'attributes':_0xb49cf3[_0x33ea('0x16')]?_0xb49cf3[_0x33ea('0x16')][_0x33ea('0x19')]||null:null,'limit':_0xb49cf3[_0x33ea('0x16')]?_0xb49cf3['options'][_0x33ea('0x1a')]||null:null,'include':_0xb49cf3['options']?_0xb49cf3['options'][_0x33ea('0x1b')]?_[_0x33ea('0x1c')](_0xb49cf3[_0x33ea('0x16')][_0x33ea('0x1b')],function(_0x23bc52){return{'model':db[_0x23bc52[_0x33ea('0x1d')]],'as':_0x23bc52['as'],'attributes':_0x23bc52[_0x33ea('0x19')],'include':_0x23bc52[_0x33ea('0x1b')]?_[_0x33ea('0x1c')](_0x23bc52[_0x33ea('0x1b')],function(_0x95086d){return{'model':db[_0x95086d[_0x33ea('0x1d')]],'as':_0x95086d['as'],'attributes':_0x95086d[_0x33ea('0x19')],'include':_0x95086d['include']?_[_0x33ea('0x1c')](_0x95086d['include'],function(_0x4b4be8){return{'model':db[_0x4b4be8['model']],'as':_0x4b4be8['as'],'attributes':_0x4b4be8[_0x33ea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x33ea('0x1e')](function(_0x5d1e0f){logger['info'](_0x33ea('0x13'),_0xb49cf3);logger[_0x33ea('0xf')]('GetDynamics365Account',_0xb49cf3,JSON[_0x33ea('0x1f')](_0x5d1e0f));_0x468f2e(_0x5d1e0f);})[_0x33ea('0x20')](function(_0x49819f){logger['error'](_0x33ea('0x13'),_0x49819f[_0x33ea('0x11')],_0xb49cf3);_0x234212(_0x33016a[_0x33ea('0x10')](0x1f4,_0x49819f[_0x33ea('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x255d3c){var _0x26714a=this;return new Promise(function(_0x30702a,_0x40655e){return db['Dynamics365Account'][_0x33ea('0x21')]({'raw':_0x255d3c[_0x33ea('0x16')]?_0x255d3c[_0x33ea('0x16')][_0x33ea('0x17')]===undefined?!![]:![]:!![],'where':_0x255d3c[_0x33ea('0x16')]?_0x255d3c[_0x33ea('0x16')][_0x33ea('0x18')]||null:null,'attributes':_0x255d3c[_0x33ea('0x16')]?_0x255d3c[_0x33ea('0x16')]['attributes']||null:null,'include':_0x255d3c[_0x33ea('0x16')]?_0x255d3c['options'][_0x33ea('0x1b')]?_[_0x33ea('0x1c')](_0x255d3c[_0x33ea('0x16')][_0x33ea('0x1b')],function(_0x5f2998){return{'model':db[_0x5f2998[_0x33ea('0x1d')]],'as':_0x5f2998['as'],'attributes':_0x5f2998[_0x33ea('0x19')],'include':_0x5f2998['include']?_[_0x33ea('0x1c')](_0x5f2998[_0x33ea('0x1b')],function(_0x5a7c19){return{'model':db[_0x5a7c19[_0x33ea('0x1d')]],'as':_0x5a7c19['as'],'attributes':_0x5a7c19['attributes'],'include':_0x5a7c19['include']?_[_0x33ea('0x1c')](_0x5a7c19['include'],function(_0x542781){return{'model':db[_0x542781[_0x33ea('0x1d')]],'as':_0x542781['as'],'attributes':_0x542781[_0x33ea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x33ea('0x1e')](function(_0x2c2ab8){logger[_0x33ea('0xc')](_0x33ea('0x22'),_0x255d3c);logger[_0x33ea('0xf')](_0x33ea('0x22'),_0x255d3c,JSON['stringify'](_0x2c2ab8));_0x30702a(_0x2c2ab8);})['catch'](function(_0x544cec){logger['error'](_0x33ea('0x22'),_0x544cec[_0x33ea('0x11')],_0x255d3c);_0x40655e(_0x26714a[_0x33ea('0x10')](0x1f4,_0x544cec[_0x33ea('0x11')]));});});}; \ No newline at end of file +var _0xf3f5=['where','limit','include','map','model','attributes','then','find','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','options'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xf3f5,0xdb));var _0x5f3f=function(_0x1272c3,_0x4b5cd6){_0x1272c3=_0x1272c3-0x0;var _0x560f17=_0xf3f5[_0x1272c3];return _0x560f17;};'use strict';var _=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var moment=require('moment');var BPromise=require(_0x5f3f('0x2'));var rs=require(_0x5f3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f3f('0x4'))['db'];var utils=require(_0x5f3f('0x5'));var logger=require(_0x5f3f('0x6'))(_0x5f3f('0x7'));var config=require(_0x5f3f('0x8'));var jayson=require(_0x5f3f('0x9'));var client=jayson[_0x5f3f('0xa')][_0x5f3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4987bf,_0x1c5bc1,_0x3cde3e){return new BPromise(function(_0x10a2d3,_0x2787a9){return client[_0x5f3f('0xc')](_0x4987bf,_0x3cde3e)['then'](function(_0x2ad1f5){logger[_0x5f3f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x1c5bc1,'request\x20sent');logger[_0x5f3f('0xe')](_0x5f3f('0xf'),_0x1c5bc1,_0x5f3f('0x10'),JSON[_0x5f3f('0x11')](_0x2ad1f5));if(_0x2ad1f5[_0x5f3f('0x12')]){if(_0x2ad1f5[_0x5f3f('0x12')]['code']===0x1f4){logger[_0x5f3f('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x1c5bc1,_0x2ad1f5['error']['message']);return _0x2787a9(_0x2ad1f5[_0x5f3f('0x12')][_0x5f3f('0x13')]);}logger[_0x5f3f('0x12')](_0x5f3f('0x14'),_0x1c5bc1,_0x2ad1f5[_0x5f3f('0x12')]['message']);return _0x10a2d3(_0x2ad1f5[_0x5f3f('0x12')]['message']);}else{logger[_0x5f3f('0xd')](_0x5f3f('0x14'),_0x1c5bc1,'request\x20sent');_0x10a2d3(_0x2ad1f5[_0x5f3f('0x15')][_0x5f3f('0x13')]);}})[_0x5f3f('0x16')](function(_0xbc060b){logger[_0x5f3f('0x12')](_0x5f3f('0x14'),_0x1c5bc1,_0xbc060b);_0x2787a9(_0xbc060b);});});}exports[_0x5f3f('0x17')]=function(_0x55c17c){var _0x3874e7=this;return new Promise(function(_0x318d58,_0x5a35a6){return db[_0x5f3f('0x18')]['findAll']({'raw':_0x55c17c[_0x5f3f('0x19')]?_0x55c17c[_0x5f3f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x55c17c[_0x5f3f('0x19')]?_0x55c17c[_0x5f3f('0x19')][_0x5f3f('0x1a')]||null:null,'attributes':_0x55c17c[_0x5f3f('0x19')]?_0x55c17c[_0x5f3f('0x19')]['attributes']||null:null,'limit':_0x55c17c[_0x5f3f('0x19')]?_0x55c17c[_0x5f3f('0x19')][_0x5f3f('0x1b')]||null:null,'include':_0x55c17c['options']?_0x55c17c[_0x5f3f('0x19')][_0x5f3f('0x1c')]?_[_0x5f3f('0x1d')](_0x55c17c['options'][_0x5f3f('0x1c')],function(_0x25810e){return{'model':db[_0x25810e[_0x5f3f('0x1e')]],'as':_0x25810e['as'],'attributes':_0x25810e[_0x5f3f('0x1f')],'include':_0x25810e[_0x5f3f('0x1c')]?_['map'](_0x25810e['include'],function(_0x8f70cf){return{'model':db[_0x8f70cf['model']],'as':_0x8f70cf['as'],'attributes':_0x8f70cf[_0x5f3f('0x1f')],'include':_0x8f70cf['include']?_['map'](_0x8f70cf['include'],function(_0x574499){return{'model':db[_0x574499['model']],'as':_0x574499['as'],'attributes':_0x574499[_0x5f3f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f3f('0x20')](function(_0x1d38fa){logger[_0x5f3f('0xd')](_0x5f3f('0x17'),_0x55c17c);logger[_0x5f3f('0xe')](_0x5f3f('0x17'),_0x55c17c,JSON['stringify'](_0x1d38fa));_0x318d58(_0x1d38fa);})['catch'](function(_0x305a96){logger['error']('GetDynamics365Account',_0x305a96['message'],_0x55c17c);_0x5a35a6(_0x3874e7[_0x5f3f('0x12')](0x1f4,_0x305a96['message']));});});};exports['ShowDynamics365Account']=function(_0x81f30a){var _0x230e71=this;return new Promise(function(_0x1f64e4,_0x21a819){return db[_0x5f3f('0x18')][_0x5f3f('0x21')]({'raw':_0x81f30a[_0x5f3f('0x19')]?_0x81f30a['options']['raw']===undefined?!![]:![]:!![],'where':_0x81f30a[_0x5f3f('0x19')]?_0x81f30a[_0x5f3f('0x19')][_0x5f3f('0x1a')]||null:null,'attributes':_0x81f30a[_0x5f3f('0x19')]?_0x81f30a[_0x5f3f('0x19')][_0x5f3f('0x1f')]||null:null,'include':_0x81f30a[_0x5f3f('0x19')]?_0x81f30a[_0x5f3f('0x19')][_0x5f3f('0x1c')]?_[_0x5f3f('0x1d')](_0x81f30a['options'][_0x5f3f('0x1c')],function(_0x120b3b){return{'model':db[_0x120b3b[_0x5f3f('0x1e')]],'as':_0x120b3b['as'],'attributes':_0x120b3b['attributes'],'include':_0x120b3b[_0x5f3f('0x1c')]?_['map'](_0x120b3b[_0x5f3f('0x1c')],function(_0x5c069f){return{'model':db[_0x5c069f['model']],'as':_0x5c069f['as'],'attributes':_0x5c069f[_0x5f3f('0x1f')],'include':_0x5c069f[_0x5f3f('0x1c')]?_['map'](_0x5c069f[_0x5f3f('0x1c')],function(_0x21ffe7){return{'model':db[_0x21ffe7[_0x5f3f('0x1e')]],'as':_0x21ffe7['as'],'attributes':_0x21ffe7[_0x5f3f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f3f('0x20')](function(_0x2fe98d){logger[_0x5f3f('0xd')](_0x5f3f('0x22'),_0x81f30a);logger['debug'](_0x5f3f('0x22'),_0x81f30a,JSON['stringify'](_0x2fe98d));_0x1f64e4(_0x2fe98d);})['catch'](function(_0x3ab941){logger[_0x5f3f('0x12')](_0x5f3f('0x22'),_0x3ab941['message'],_0x81f30a);_0x21a819(_0x230e71['error'](0x1f4,_0x3ab941['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b4e6a1b..4aeba63 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 _0xb982=['index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x211032,_0xf3b31a){var _0x1879ee=function(_0x3c9609){while(--_0x3c9609){_0x211032['push'](_0x211032['shift']());}};_0x1879ee(++_0xf3b31a);}(_0xb982,0x15e));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b98('0x0'));var timeout=require(_0x2b98('0x1'));var express=require(_0x2b98('0x2'));var router=express[_0x2b98('0x3')]();var fs_extra=require(_0x2b98('0x4'));var auth=require(_0x2b98('0x5'));var interaction=require(_0x2b98('0x6'));var config=require(_0x2b98('0x7'));var controller=require(_0x2b98('0x8'));router[_0x2b98('0x9')]('/',auth['isAuthenticated'](),controller[_0x2b98('0xa')]);router[_0x2b98('0x9')](_0x2b98('0xb'),auth[_0x2b98('0xc')](),controller[_0x2b98('0xd')]);router[_0x2b98('0x9')]('/:id/fields',auth[_0x2b98('0xc')](),controller[_0x2b98('0xe')]);router['get'](_0x2b98('0xf'),auth['isAuthenticated'](),controller[_0x2b98('0x10')]);router[_0x2b98('0x9')](_0x2b98('0x11'),auth[_0x2b98('0xc')](),controller[_0x2b98('0x12')]);router['post']('/',auth[_0x2b98('0xc')](),controller['create']);router[_0x2b98('0x13')](_0x2b98('0xb'),auth[_0x2b98('0xc')](),controller[_0x2b98('0x14')]);router[_0x2b98('0x15')](_0x2b98('0xb'),auth['isAuthenticated'](),controller[_0x2b98('0x16')]);module[_0x2b98('0x17')]=router; \ No newline at end of file +var _0xe139=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','show','/:id/fields','getFields'];(function(_0x33cf66,_0x30e414){var _0x3a400b=function(_0x29130b){while(--_0x29130b){_0x33cf66['push'](_0x33cf66['shift']());}};_0x3a400b(++_0x30e414);}(_0xe139,0x1eb));var _0x9e13=function(_0x2a06ae,_0xc4e8a3){_0x2a06ae=_0x2a06ae-0x0;var _0x2360e1=_0xe139[_0x2a06ae];return _0x2360e1;};'use strict';var multer=require(_0x9e13('0x0'));var util=require('util');var path=require(_0x9e13('0x1'));var timeout=require(_0x9e13('0x2'));var express=require(_0x9e13('0x3'));var router=express['Router']();var fs_extra=require(_0x9e13('0x4'));var auth=require(_0x9e13('0x5'));var interaction=require(_0x9e13('0x6'));var config=require(_0x9e13('0x7'));var controller=require(_0x9e13('0x8'));router['get']('/',auth[_0x9e13('0x9')](),controller[_0x9e13('0xa')]);router[_0x9e13('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9e13('0xc')]);router[_0x9e13('0xb')](_0x9e13('0xd'),auth[_0x9e13('0x9')](),controller[_0x9e13('0xe')]);router[_0x9e13('0xb')](_0x9e13('0xf'),auth[_0x9e13('0x9')](),controller[_0x9e13('0x10')]);router[_0x9e13('0xb')](_0x9e13('0x11'),auth[_0x9e13('0x9')](),controller[_0x9e13('0x12')]);router[_0x9e13('0x13')]('/',auth[_0x9e13('0x9')](),controller['create']);router[_0x9e13('0x14')](_0x9e13('0x15'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x9e13('0x9')](),controller[_0x9e13('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 8c0b5d7..aa2baf4 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 _0xce19=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','contact'];(function(_0x430290,_0x94c0cd){var _0x1c5d5e=function(_0x34d270){while(--_0x34d270){_0x430290['push'](_0x430290['shift']());}};_0x1c5d5e(++_0x94c0cd);}(_0xce19,0x77));var _0x9ce1=function(_0x565e14,_0x1bd0f2){_0x565e14=_0x565e14-0x0;var _0x5ada4a=_0xce19[_0x565e14];return _0x5ada4a;};'use strict';var Sequelize=require(_0x9ce1('0x0'));module[_0x9ce1('0x1')]={'name':{'type':Sequelize[_0x9ce1('0x2')]},'description':{'type':Sequelize[_0x9ce1('0x2')]},'ticketType':{'type':Sequelize[_0x9ce1('0x3')](_0x9ce1('0x4'),_0x9ce1('0x5')),'defaultValue':_0x9ce1('0x4')},'moduleCreate':{'type':Sequelize[_0x9ce1('0x3')](_0x9ce1('0x6'),_0x9ce1('0x7')),'defaultValue':_0x9ce1('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9ce1('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9ce1('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb41b=['phonecall','ENUM','nothing','BOOLEAN','sequelize','STRING','incident'];(function(_0x5932a1,_0x1a8e01){var _0x45947b=function(_0x249306){while(--_0x249306){_0x5932a1['push'](_0x5932a1['shift']());}};_0x45947b(++_0x1a8e01);}(_0xb41b,0xc8));var _0xbb41=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb41b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xbb41('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb41('0x1')]},'description':{'type':Sequelize[_0xbb41('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xbb41('0x2'),_0xbb41('0x3')),'defaultValue':_0xbb41('0x2')},'moduleCreate':{'type':Sequelize[_0xbb41('0x4')]('contact',_0xbb41('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xbb41('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xbb41('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e9281d7..287a938 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 _0xd786=['set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_0xd786,0x1e2));var _0x6d78=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd786[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x6d78('0x0'));var rimraf=require(_0x6d78('0x1'));var zipdir=require(_0x6d78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d78('0x3'));var BPromise=require(_0x6d78('0x4'));var Mustache=require(_0x6d78('0x5'));var util=require(_0x6d78('0x6'));var path=require(_0x6d78('0x7'));var sox=require(_0x6d78('0x8'));var csv=require(_0x6d78('0x9'));var ejs=require(_0x6d78('0xa'));var fs=require('fs');var fs_extra=require(_0x6d78('0xb'));var _=require(_0x6d78('0xc'));var squel=require(_0x6d78('0xd'));var crypto=require('crypto');var jsforce=require(_0x6d78('0xe'));var deskjs=require(_0x6d78('0xf'));var toCsv=require(_0x6d78('0x9'));var querystring=require(_0x6d78('0x10'));var Papa=require(_0x6d78('0x11'));var Redis=require(_0x6d78('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6d78('0x13'));var as=require(_0x6d78('0x14'));var hardwareService=require(_0x6d78('0x15'));var logger=require(_0x6d78('0x16'))(_0x6d78('0x17'));var utils=require(_0x6d78('0x18'));var config=require(_0x6d78('0x19'));var licenseUtil=require(_0x6d78('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593de6,_0x4fb63b){_0x4fb63b=_0x4fb63b||0xcc;return function(_0x5529a4){if(_0x5529a4){return _0x593de6['sendStatus'](_0x4fb63b);}return _0x593de6[_0x6d78('0x1b')](_0x4fb63b)[_0x6d78('0x1c')]();};}function respondWithResult(_0x5cfd7b,_0x394b70){_0x394b70=_0x394b70||0xc8;return function(_0xdcfa97){if(_0xdcfa97){return _0x5cfd7b[_0x6d78('0x1b')](_0x394b70)[_0x6d78('0x1d')](_0xdcfa97);}};}function respondWithFilteredResult(_0x30cc2b,_0xd3f7a7){return function(_0x258aa6){if(_0x258aa6){var _0x1f0af2=typeof _0xd3f7a7[_0x6d78('0x1e')]==='undefined'&&typeof _0xd3f7a7[_0x6d78('0x1f')]===_0x6d78('0x20');var _0x1b59e0=_0x258aa6[_0x6d78('0x21')];var _0x40f6f9=_0x1f0af2?0x0:_0xd3f7a7[_0x6d78('0x1e')];var _0x3eb00d=_0x1f0af2?_0x258aa6['count']:_0xd3f7a7['offset']+_0xd3f7a7[_0x6d78('0x1f')];var _0x5af6ae;if(_0x3eb00d>=_0x1b59e0){_0x3eb00d=_0x1b59e0;_0x5af6ae=0xc8;}else{_0x5af6ae=0xce;}_0x30cc2b[_0x6d78('0x1b')](_0x5af6ae);return _0x30cc2b[_0x6d78('0x22')](_0x6d78('0x23'),_0x40f6f9+'-'+_0x3eb00d+'/'+_0x1b59e0)[_0x6d78('0x1d')](_0x258aa6);}return null;};}function patchUpdates(_0xa770e8){return function(_0x1566d4){try{jsonpatch[_0x6d78('0x24')](_0x1566d4,_0xa770e8,!![]);}catch(_0x4ae2b5){return BPromise[_0x6d78('0x25')](_0x4ae2b5);}return _0x1566d4['save']();};}function saveUpdates(_0x59bbe6,_0x3ac96a){return function(_0x13f59f){if(_0x13f59f){return _0x13f59f[_0x6d78('0x26')](_0x59bbe6)[_0x6d78('0x27')](function(_0x53e767){return _0x53e767;});}return null;};}function removeEntity(_0x571838,_0x19168e){return function(_0x1d7543){if(_0x1d7543){return _0x1d7543[_0x6d78('0x28')]()[_0x6d78('0x27')](function(){_0x571838[_0x6d78('0x1b')](0xcc)[_0x6d78('0x1c')]();});}};}function handleEntityNotFound(_0x3067e2,_0x4deeaf){return function(_0x2d546c){if(!_0x2d546c){_0x3067e2[_0x6d78('0x29')](0x194);}return _0x2d546c;};}function handleError(_0x3a2208,_0x55860a){_0x55860a=_0x55860a||0x1f4;return function(_0x312059){logger[_0x6d78('0x2a')](_0x312059[_0x6d78('0x2b')]);if(_0x312059[_0x6d78('0x2c')]){delete _0x312059[_0x6d78('0x2c')];}_0x3a2208[_0x6d78('0x1b')](_0x55860a)[_0x6d78('0x2d')](_0x312059);};}exports[_0x6d78('0x2e')]=function(_0x5a201b,_0xaa1f9d){var _0x187f06={},_0x493489={},_0xe8b582={'count':0x0,'rows':[]};var _0x294c64=_['map'](db[_0x6d78('0x2f')][_0x6d78('0x30')],function(_0x3923c3){return{'name':_0x3923c3[_0x6d78('0x31')],'type':_0x3923c3['type'][_0x6d78('0x32')]};});_0x493489[_0x6d78('0x33')]=_[_0x6d78('0x34')](_0x294c64,_0x6d78('0x2c'));_0x493489[_0x6d78('0x35')]=_[_0x6d78('0x36')](_0x5a201b[_0x6d78('0x35')]);_0x493489['filters']=_['intersection'](_0x493489[_0x6d78('0x33')],_0x493489[_0x6d78('0x35')]);_0x187f06['attributes']=_['intersection'](_0x493489[_0x6d78('0x33')],qs[_0x6d78('0x37')](_0x5a201b[_0x6d78('0x35')][_0x6d78('0x37')]));_0x187f06[_0x6d78('0x38')]=_0x187f06[_0x6d78('0x38')][_0x6d78('0x39')]?_0x187f06['attributes']:_0x493489[_0x6d78('0x33')];if(!_0x5a201b['query'][_0x6d78('0x3a')](_0x6d78('0x3b'))){_0x187f06[_0x6d78('0x1f')]=qs[_0x6d78('0x1f')](_0x5a201b[_0x6d78('0x35')][_0x6d78('0x1f')]);_0x187f06[_0x6d78('0x1e')]=qs['offset'](_0x5a201b['query'][_0x6d78('0x1e')]);}_0x187f06[_0x6d78('0x3c')]=qs['sort'](_0x5a201b['query'][_0x6d78('0x3d')]);_0x187f06[_0x6d78('0x3e')]=qs[_0x6d78('0x3f')](_[_0x6d78('0x40')](_0x5a201b['query'],_0x493489[_0x6d78('0x3f')]),_0x294c64);if(_0x5a201b[_0x6d78('0x35')][_0x6d78('0x41')]){_0x187f06[_0x6d78('0x3e')]=_[_0x6d78('0x42')](_0x187f06[_0x6d78('0x3e')],{'$or':_[_0x6d78('0x34')](_0x294c64,function(_0x4944c6){if(_0x4944c6[_0x6d78('0x43')]!==_0x6d78('0x44')){var _0xd0096b={};_0xd0096b[_0x4944c6[_0x6d78('0x2c')]]={'$like':'%'+_0x5a201b[_0x6d78('0x35')]['filter']+'%'};return _0xd0096b;}})});}_0x187f06=_[_0x6d78('0x42')]({},_0x187f06,_0x5a201b['options']);var _0x2ed40a={'where':_0x187f06[_0x6d78('0x3e')]};return db['Dynamics365Configuration'][_0x6d78('0x21')](_0x2ed40a)[_0x6d78('0x27')](function(_0xcf6c7e){_0xe8b582[_0x6d78('0x21')]=_0xcf6c7e;if(_0x5a201b[_0x6d78('0x35')]['includeAll']){_0x187f06[_0x6d78('0x45')]=[{'all':!![]}];}return db[_0x6d78('0x2f')][_0x6d78('0x46')](_0x187f06);})[_0x6d78('0x27')](function(_0x52662c){_0xe8b582[_0x6d78('0x47')]=_0x52662c;return _0xe8b582;})[_0x6d78('0x27')](respondWithFilteredResult(_0xaa1f9d,_0x187f06))[_0x6d78('0x48')](handleError(_0xaa1f9d,null));};exports[_0x6d78('0x49')]=function(_0x3ac4bb,_0x35c1d2){var _0x43d06d={'raw':![],'where':{'id':_0x3ac4bb[_0x6d78('0x4a')]['id']}},_0x5393dc={};_0x5393dc[_0x6d78('0x33')]=_['keys'](db[_0x6d78('0x2f')][_0x6d78('0x30')]);_0x5393dc['query']=_['keys'](_0x3ac4bb[_0x6d78('0x35')]);_0x5393dc[_0x6d78('0x3f')]=_[_0x6d78('0x4b')](_0x5393dc[_0x6d78('0x33')],_0x5393dc[_0x6d78('0x35')]);_0x43d06d[_0x6d78('0x38')]=_[_0x6d78('0x4b')](_0x5393dc[_0x6d78('0x33')],qs['fields'](_0x3ac4bb[_0x6d78('0x35')][_0x6d78('0x37')]));_0x43d06d[_0x6d78('0x38')]=_0x43d06d[_0x6d78('0x38')][_0x6d78('0x39')]?_0x43d06d[_0x6d78('0x38')]:_0x5393dc[_0x6d78('0x33')];if(_0x3ac4bb[_0x6d78('0x35')][_0x6d78('0x4c')]){_0x43d06d[_0x6d78('0x45')]=[{'all':!![]}];}_0x43d06d=_['merge']({},_0x43d06d,_0x3ac4bb[_0x6d78('0x4d')]);return db[_0x6d78('0x2f')][_0x6d78('0x4e')](_0x43d06d)[_0x6d78('0x27')](handleEntityNotFound(_0x35c1d2,null))['then'](respondWithResult(_0x35c1d2,null))[_0x6d78('0x48')](handleError(_0x35c1d2,null));};exports['create']=function(_0x3f0e41,_0x4e1817){return db[_0x6d78('0x2f')][_0x6d78('0x4f')](_0x3f0e41[_0x6d78('0x50')],{})[_0x6d78('0x27')](respondWithResult(_0x4e1817,0xc9))[_0x6d78('0x48')](handleError(_0x4e1817,null));};exports['update']=function(_0x5b042d,_0x3a12e8){if(_0x5b042d[_0x6d78('0x50')]['id']){delete _0x5b042d[_0x6d78('0x50')]['id'];}return db[_0x6d78('0x2f')]['find']({'where':{'id':_0x5b042d[_0x6d78('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a12e8,null))[_0x6d78('0x27')](saveUpdates(_0x5b042d[_0x6d78('0x50')],null))[_0x6d78('0x27')](respondWithResult(_0x3a12e8,null))[_0x6d78('0x48')](handleError(_0x3a12e8,null));};exports['destroy']=function(_0x45b0b5,_0x1d3703){return db[_0x6d78('0x2f')][_0x6d78('0x4e')]({'where':{'id':_0x45b0b5[_0x6d78('0x4a')]['id']}})[_0x6d78('0x27')](handleEntityNotFound(_0x1d3703,null))[_0x6d78('0x27')](removeEntity(_0x1d3703,null))[_0x6d78('0x48')](handleError(_0x1d3703,null));};exports[_0x6d78('0x51')]=function(_0x30601e,_0x2f1512,_0x1c7dbe){var _0x35e0ae={};var _0x4b60c8={};var _0x10d8de;var _0x31f508;return db[_0x6d78('0x2f')][_0x6d78('0x52')]({'where':{'id':_0x30601e[_0x6d78('0x4a')]['id']}})[_0x6d78('0x27')](handleEntityNotFound(_0x2f1512,null))[_0x6d78('0x27')](function(_0x37e5c9){if(_0x37e5c9){_0x10d8de=_0x37e5c9;_0x4b60c8['model']=_[_0x6d78('0x36')](db[_0x6d78('0x53')][_0x6d78('0x30')]);_0x4b60c8[_0x6d78('0x35')]=_[_0x6d78('0x36')](_0x30601e[_0x6d78('0x35')]);_0x4b60c8[_0x6d78('0x3f')]=_[_0x6d78('0x4b')](_0x4b60c8[_0x6d78('0x33')],_0x4b60c8['query']);_0x35e0ae[_0x6d78('0x38')]=_[_0x6d78('0x4b')](_0x4b60c8[_0x6d78('0x33')],qs[_0x6d78('0x37')](_0x30601e[_0x6d78('0x35')]['fields']));_0x35e0ae[_0x6d78('0x38')]=_0x35e0ae[_0x6d78('0x38')][_0x6d78('0x39')]?_0x35e0ae['attributes']:_0x4b60c8[_0x6d78('0x33')];_0x35e0ae[_0x6d78('0x3c')]=qs[_0x6d78('0x3d')](_0x30601e[_0x6d78('0x35')][_0x6d78('0x3d')]);_0x35e0ae[_0x6d78('0x3e')]=qs[_0x6d78('0x3f')](_[_0x6d78('0x40')](_0x30601e[_0x6d78('0x35')],_0x4b60c8[_0x6d78('0x3f')]));if(_0x30601e[_0x6d78('0x35')]['filter']){_0x35e0ae[_0x6d78('0x3e')]=_[_0x6d78('0x42')](_0x35e0ae['where'],{'$or':_[_0x6d78('0x34')](_0x35e0ae[_0x6d78('0x38')],function(_0x32e22f){var _0xfad510={};_0xfad510[_0x32e22f]={'$like':'%'+_0x30601e[_0x6d78('0x35')][_0x6d78('0x41')]+'%'};return _0xfad510;})});}_0x35e0ae=_[_0x6d78('0x42')]({},_0x35e0ae,_0x30601e[_0x6d78('0x4d')]);return _0x10d8de[_0x6d78('0x51')](_0x35e0ae);}})[_0x6d78('0x27')](function(_0x2f6707){if(_0x2f6707){_0x31f508=_0x2f6707[_0x6d78('0x39')];if(!_0x30601e[_0x6d78('0x35')][_0x6d78('0x3a')]('nolimit')){_0x35e0ae[_0x6d78('0x1f')]=qs[_0x6d78('0x1f')](_0x30601e['query']['limit']);_0x35e0ae['offset']=qs['offset'](_0x30601e[_0x6d78('0x35')][_0x6d78('0x1e')]);}return _0x10d8de[_0x6d78('0x51')](_0x35e0ae);}})['then'](function(_0x45f540){if(_0x45f540){return _0x45f540?{'count':_0x31f508,'rows':_0x45f540}:null;}})[_0x6d78('0x27')](respondWithResult(_0x2f1512,null))['catch'](handleError(_0x2f1512,null));};exports['getSubjects']=function(_0x29ec97,_0x2dbfc8,_0x1e2555){var _0x21d592={};var _0x25cc77={};var _0x45a2c1;var _0x5606da;return db[_0x6d78('0x2f')][_0x6d78('0x52')]({'where':{'id':_0x29ec97[_0x6d78('0x4a')]['id']}})[_0x6d78('0x27')](handleEntityNotFound(_0x2dbfc8,null))[_0x6d78('0x27')](function(_0x418d1d){if(_0x418d1d){_0x45a2c1=_0x418d1d;_0x25cc77[_0x6d78('0x33')]=_[_0x6d78('0x36')](db['Dynamics365Field'][_0x6d78('0x30')]);_0x25cc77['query']=_[_0x6d78('0x36')](_0x29ec97[_0x6d78('0x35')]);_0x25cc77[_0x6d78('0x3f')]=_[_0x6d78('0x4b')](_0x25cc77['model'],_0x25cc77[_0x6d78('0x35')]);_0x21d592[_0x6d78('0x38')]=_[_0x6d78('0x4b')](_0x25cc77[_0x6d78('0x33')],qs['fields'](_0x29ec97[_0x6d78('0x35')][_0x6d78('0x37')]));_0x21d592['attributes']=_0x21d592[_0x6d78('0x38')][_0x6d78('0x39')]?_0x21d592['attributes']:_0x25cc77[_0x6d78('0x33')];_0x21d592['order']=qs['sort'](_0x29ec97[_0x6d78('0x35')]['sort']);_0x21d592[_0x6d78('0x3e')]=qs['filters'](_['pick'](_0x29ec97['query'],_0x25cc77['filters']));if(_0x29ec97['query'][_0x6d78('0x41')]){_0x21d592[_0x6d78('0x3e')]=_[_0x6d78('0x42')](_0x21d592[_0x6d78('0x3e')],{'$or':_[_0x6d78('0x34')](_0x21d592[_0x6d78('0x38')],function(_0x12d919){var _0x3de8d6={};_0x3de8d6[_0x12d919]={'$like':'%'+_0x29ec97[_0x6d78('0x35')][_0x6d78('0x41')]+'%'};return _0x3de8d6;})});}_0x21d592=_[_0x6d78('0x42')]({},_0x21d592,_0x29ec97['options']);return _0x45a2c1[_0x6d78('0x54')](_0x21d592);}})[_0x6d78('0x27')](function(_0x50ea62){if(_0x50ea62){_0x5606da=_0x50ea62[_0x6d78('0x39')];if(!_0x29ec97['query']['hasOwnProperty']('nolimit')){_0x21d592[_0x6d78('0x1f')]=qs[_0x6d78('0x1f')](_0x29ec97['query'][_0x6d78('0x1f')]);_0x21d592['offset']=qs[_0x6d78('0x1e')](_0x29ec97[_0x6d78('0x35')]['offset']);}return _0x45a2c1['getSubjects'](_0x21d592);}})['then'](function(_0x5666b1){if(_0x5666b1){return _0x5666b1?{'count':_0x5606da,'rows':_0x5666b1}:null;}})[_0x6d78('0x27')](respondWithResult(_0x2dbfc8,null))[_0x6d78('0x48')](handleError(_0x2dbfc8,null));};exports[_0x6d78('0x55')]=function(_0x16659f,_0x13ef33,_0x30809e){var _0x418c75={};var _0xed9400={};var _0x2098eb;var _0x4a9c04;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x16659f['params']['id']}})[_0x6d78('0x27')](handleEntityNotFound(_0x13ef33,null))[_0x6d78('0x27')](function(_0x44fd78){if(_0x44fd78){_0x2098eb=_0x44fd78;_0xed9400[_0x6d78('0x33')]=_[_0x6d78('0x36')](db[_0x6d78('0x53')][_0x6d78('0x30')]);_0xed9400[_0x6d78('0x35')]=_[_0x6d78('0x36')](_0x16659f[_0x6d78('0x35')]);_0xed9400[_0x6d78('0x3f')]=_['intersection'](_0xed9400[_0x6d78('0x33')],_0xed9400['query']);_0x418c75[_0x6d78('0x38')]=_[_0x6d78('0x4b')](_0xed9400[_0x6d78('0x33')],qs['fields'](_0x16659f[_0x6d78('0x35')][_0x6d78('0x37')]));_0x418c75[_0x6d78('0x38')]=_0x418c75['attributes']['length']?_0x418c75[_0x6d78('0x38')]:_0xed9400[_0x6d78('0x33')];_0x418c75['order']=qs[_0x6d78('0x3d')](_0x16659f[_0x6d78('0x35')][_0x6d78('0x3d')]);_0x418c75[_0x6d78('0x3e')]=qs[_0x6d78('0x3f')](_['pick'](_0x16659f[_0x6d78('0x35')],_0xed9400[_0x6d78('0x3f')]));if(_0x16659f[_0x6d78('0x35')]['filter']){_0x418c75[_0x6d78('0x3e')]=_[_0x6d78('0x42')](_0x418c75[_0x6d78('0x3e')],{'$or':_[_0x6d78('0x34')](_0x418c75[_0x6d78('0x38')],function(_0x513e10){var _0x4ccb1d={};_0x4ccb1d[_0x513e10]={'$like':'%'+_0x16659f[_0x6d78('0x35')][_0x6d78('0x41')]+'%'};return _0x4ccb1d;})});}_0x418c75=_[_0x6d78('0x42')]({},_0x418c75,_0x16659f['options']);return _0x2098eb[_0x6d78('0x55')](_0x418c75);}})[_0x6d78('0x27')](function(_0x4bff8c){if(_0x4bff8c){_0x4a9c04=_0x4bff8c[_0x6d78('0x39')];if(!_0x16659f[_0x6d78('0x35')][_0x6d78('0x3a')](_0x6d78('0x3b'))){_0x418c75['limit']=qs['limit'](_0x16659f[_0x6d78('0x35')][_0x6d78('0x1f')]);_0x418c75[_0x6d78('0x1e')]=qs[_0x6d78('0x1e')](_0x16659f['query'][_0x6d78('0x1e')]);}return _0x2098eb[_0x6d78('0x55')](_0x418c75);}})[_0x6d78('0x27')](function(_0x2eb44b){if(_0x2eb44b){return _0x2eb44b?{'count':_0x4a9c04,'rows':_0x2eb44b}:null;}})[_0x6d78('0x27')](respondWithResult(_0x13ef33,null))[_0x6d78('0x48')](handleError(_0x13ef33,null));}; \ No newline at end of file +var _0xf60a=['find','create','body','params','getFields','findOne','options','getSubjects','Dynamics365Field','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','update','then','destroy','error','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','include','findAll','catch'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0xf60a,0xee));var _0xaf60=function(_0x585b86,_0x515d4b){_0x585b86=_0x585b86-0x0;var _0x5f949e=_0xf60a[_0x585b86];return _0x5f949e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf60('0x1'));var rp=require(_0xaf60('0x2'));var moment=require(_0xaf60('0x3'));var BPromise=require(_0xaf60('0x4'));var Mustache=require(_0xaf60('0x5'));var util=require('util');var path=require(_0xaf60('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf60('0x7'));var fs=require('fs');var fs_extra=require(_0xaf60('0x8'));var _=require(_0xaf60('0x9'));var squel=require('squel');var crypto=require(_0xaf60('0xa'));var jsforce=require(_0xaf60('0xb'));var deskjs=require(_0xaf60('0xc'));var toCsv=require(_0xaf60('0xd'));var querystring=require('querystring');var Papa=require(_0xaf60('0xe'));var Redis=require(_0xaf60('0xf'));var authService=require(_0xaf60('0x10'));var qs=require(_0xaf60('0x11'));var as=require(_0xaf60('0x12'));var hardwareService=require(_0xaf60('0x13'));var logger=require(_0xaf60('0x14'))(_0xaf60('0x15'));var utils=require(_0xaf60('0x16'));var config=require(_0xaf60('0x17'));var licenseUtil=require(_0xaf60('0x18'));var db=require(_0xaf60('0x19'))['db'];function respondWithStatusCode(_0xf1bfa3,_0x1f77e0){_0x1f77e0=_0x1f77e0||0xcc;return function(_0xf72daf){if(_0xf72daf){return _0xf1bfa3[_0xaf60('0x1a')](_0x1f77e0);}return _0xf1bfa3[_0xaf60('0x1b')](_0x1f77e0)[_0xaf60('0x1c')]();};}function respondWithResult(_0x4a5576,_0x5ed321){_0x5ed321=_0x5ed321||0xc8;return function(_0x916834){if(_0x916834){return _0x4a5576[_0xaf60('0x1b')](_0x5ed321)[_0xaf60('0x1d')](_0x916834);}};}function respondWithFilteredResult(_0x18769b,_0xadad66){return function(_0x3a242f){if(_0x3a242f){var _0x166de0=typeof _0xadad66['offset']===_0xaf60('0x1e')&&typeof _0xadad66[_0xaf60('0x1f')]===_0xaf60('0x1e');var _0x538618=_0x3a242f[_0xaf60('0x20')];var _0x447b92=_0x166de0?0x0:_0xadad66['offset'];var _0x116283=_0x166de0?_0x3a242f[_0xaf60('0x20')]:_0xadad66['offset']+_0xadad66[_0xaf60('0x1f')];var _0x3fc942;if(_0x116283>=_0x538618){_0x116283=_0x538618;_0x3fc942=0xc8;}else{_0x3fc942=0xce;}_0x18769b[_0xaf60('0x1b')](_0x3fc942);return _0x18769b[_0xaf60('0x21')]('Content-Range',_0x447b92+'-'+_0x116283+'/'+_0x538618)[_0xaf60('0x1d')](_0x3a242f);}return null;};}function patchUpdates(_0x4825f5){return function(_0x43c8bb){try{jsonpatch['apply'](_0x43c8bb,_0x4825f5,!![]);}catch(_0x18a155){return BPromise['reject'](_0x18a155);}return _0x43c8bb['save']();};}function saveUpdates(_0x2e8af0,_0x2d02df){return function(_0xebddfa){if(_0xebddfa){return _0xebddfa[_0xaf60('0x22')](_0x2e8af0)[_0xaf60('0x23')](function(_0x4ee686){return _0x4ee686;});}return null;};}function removeEntity(_0xc300f7,_0xea6435){return function(_0x2955b0){if(_0x2955b0){return _0x2955b0[_0xaf60('0x24')]()[_0xaf60('0x23')](function(){_0xc300f7[_0xaf60('0x1b')](0xcc)[_0xaf60('0x1c')]();});}};}function handleEntityNotFound(_0x2d5a57,_0x31e122){return function(_0xcae88e){if(!_0xcae88e){_0x2d5a57['sendStatus'](0x194);}return _0xcae88e;};}function handleError(_0x396cca,_0x3fe631){_0x3fe631=_0x3fe631||0x1f4;return function(_0x535433){logger[_0xaf60('0x25')](_0x535433['stack']);if(_0x535433[_0xaf60('0x26')]){delete _0x535433[_0xaf60('0x26')];}_0x396cca[_0xaf60('0x1b')](_0x3fe631)[_0xaf60('0x27')](_0x535433);};}exports['index']=function(_0x1c2b6e,_0x5db17f){var _0xfc8178={},_0x4c76ed={},_0x5b77d6={'count':0x0,'rows':[]};var _0x29020b=_[_0xaf60('0x28')](db[_0xaf60('0x29')][_0xaf60('0x2a')],function(_0xc84fdd){return{'name':_0xc84fdd[_0xaf60('0x2b')],'type':_0xc84fdd[_0xaf60('0x2c')][_0xaf60('0x2d')]};});_0x4c76ed[_0xaf60('0x2e')]=_[_0xaf60('0x28')](_0x29020b,_0xaf60('0x26'));_0x4c76ed[_0xaf60('0x2f')]=_[_0xaf60('0x30')](_0x1c2b6e[_0xaf60('0x2f')]);_0x4c76ed[_0xaf60('0x31')]=_['intersection'](_0x4c76ed[_0xaf60('0x2e')],_0x4c76ed[_0xaf60('0x2f')]);_0xfc8178[_0xaf60('0x32')]=_[_0xaf60('0x33')](_0x4c76ed['model'],qs[_0xaf60('0x34')](_0x1c2b6e[_0xaf60('0x2f')]['fields']));_0xfc8178[_0xaf60('0x32')]=_0xfc8178['attributes'][_0xaf60('0x35')]?_0xfc8178[_0xaf60('0x32')]:_0x4c76ed[_0xaf60('0x2e')];if(!_0x1c2b6e[_0xaf60('0x2f')][_0xaf60('0x36')](_0xaf60('0x37'))){_0xfc8178[_0xaf60('0x1f')]=qs[_0xaf60('0x1f')](_0x1c2b6e[_0xaf60('0x2f')]['limit']);_0xfc8178['offset']=qs[_0xaf60('0x38')](_0x1c2b6e[_0xaf60('0x2f')][_0xaf60('0x38')]);}_0xfc8178[_0xaf60('0x39')]=qs[_0xaf60('0x3a')](_0x1c2b6e[_0xaf60('0x2f')]['sort']);_0xfc8178[_0xaf60('0x3b')]=qs['filters'](_[_0xaf60('0x3c')](_0x1c2b6e[_0xaf60('0x2f')],_0x4c76ed[_0xaf60('0x31')]),_0x29020b);if(_0x1c2b6e[_0xaf60('0x2f')]['filter']){_0xfc8178[_0xaf60('0x3b')]=_[_0xaf60('0x3d')](_0xfc8178[_0xaf60('0x3b')],{'$or':_[_0xaf60('0x28')](_0x29020b,function(_0x2bfbab){if(_0x2bfbab[_0xaf60('0x2c')]!=='VIRTUAL'){var _0x4a83d7={};_0x4a83d7[_0x2bfbab[_0xaf60('0x26')]]={'$like':'%'+_0x1c2b6e[_0xaf60('0x2f')][_0xaf60('0x3e')]+'%'};return _0x4a83d7;}})});}_0xfc8178=_[_0xaf60('0x3d')]({},_0xfc8178,_0x1c2b6e['options']);var _0x42a8cd={'where':_0xfc8178['where']};return db['Dynamics365Configuration'][_0xaf60('0x20')](_0x42a8cd)['then'](function(_0x5f541a){_0x5b77d6['count']=_0x5f541a;if(_0x1c2b6e[_0xaf60('0x2f')]['includeAll']){_0xfc8178[_0xaf60('0x3f')]=[{'all':!![]}];}return db[_0xaf60('0x29')][_0xaf60('0x40')](_0xfc8178);})[_0xaf60('0x23')](function(_0x1a4047){_0x5b77d6['rows']=_0x1a4047;return _0x5b77d6;})['then'](respondWithFilteredResult(_0x5db17f,_0xfc8178))[_0xaf60('0x41')](handleError(_0x5db17f,null));};exports['show']=function(_0x53878d,_0x238202){var _0x121248={'raw':![],'where':{'id':_0x53878d['params']['id']}},_0x1fe417={};_0x1fe417[_0xaf60('0x2e')]=_[_0xaf60('0x30')](db[_0xaf60('0x29')][_0xaf60('0x2a')]);_0x1fe417[_0xaf60('0x2f')]=_['keys'](_0x53878d[_0xaf60('0x2f')]);_0x1fe417[_0xaf60('0x31')]=_['intersection'](_0x1fe417[_0xaf60('0x2e')],_0x1fe417[_0xaf60('0x2f')]);_0x121248['attributes']=_[_0xaf60('0x33')](_0x1fe417[_0xaf60('0x2e')],qs[_0xaf60('0x34')](_0x53878d['query'][_0xaf60('0x34')]));_0x121248[_0xaf60('0x32')]=_0x121248[_0xaf60('0x32')][_0xaf60('0x35')]?_0x121248[_0xaf60('0x32')]:_0x1fe417[_0xaf60('0x2e')];if(_0x53878d[_0xaf60('0x2f')]['includeAll']){_0x121248[_0xaf60('0x3f')]=[{'all':!![]}];}_0x121248=_[_0xaf60('0x3d')]({},_0x121248,_0x53878d['options']);return db[_0xaf60('0x29')][_0xaf60('0x42')](_0x121248)[_0xaf60('0x23')](handleEntityNotFound(_0x238202,null))[_0xaf60('0x23')](respondWithResult(_0x238202,null))[_0xaf60('0x41')](handleError(_0x238202,null));};exports[_0xaf60('0x43')]=function(_0x683479,_0xe1aaeb){return db['Dynamics365Configuration'][_0xaf60('0x43')](_0x683479[_0xaf60('0x44')],{})[_0xaf60('0x23')](respondWithResult(_0xe1aaeb,0xc9))[_0xaf60('0x41')](handleError(_0xe1aaeb,null));};exports[_0xaf60('0x22')]=function(_0x5927b6,_0x46c7c2){if(_0x5927b6[_0xaf60('0x44')]['id']){delete _0x5927b6[_0xaf60('0x44')]['id'];}return db[_0xaf60('0x29')][_0xaf60('0x42')]({'where':{'id':_0x5927b6[_0xaf60('0x45')]['id']}})[_0xaf60('0x23')](handleEntityNotFound(_0x46c7c2,null))[_0xaf60('0x23')](saveUpdates(_0x5927b6[_0xaf60('0x44')],null))[_0xaf60('0x23')](respondWithResult(_0x46c7c2,null))[_0xaf60('0x41')](handleError(_0x46c7c2,null));};exports[_0xaf60('0x24')]=function(_0x4e665e,_0x2ddd48){return db['Dynamics365Configuration'][_0xaf60('0x42')]({'where':{'id':_0x4e665e[_0xaf60('0x45')]['id']}})[_0xaf60('0x23')](handleEntityNotFound(_0x2ddd48,null))[_0xaf60('0x23')](removeEntity(_0x2ddd48,null))[_0xaf60('0x41')](handleError(_0x2ddd48,null));};exports[_0xaf60('0x46')]=function(_0x64e10,_0xdb81e8,_0x43ea82){var _0x20de71={};var _0x54807f={};var _0x55fba9;var _0xac2ae9;return db[_0xaf60('0x29')][_0xaf60('0x47')]({'where':{'id':_0x64e10[_0xaf60('0x45')]['id']}})['then'](handleEntityNotFound(_0xdb81e8,null))[_0xaf60('0x23')](function(_0x850327){if(_0x850327){_0x55fba9=_0x850327;_0x54807f[_0xaf60('0x2e')]=_[_0xaf60('0x30')](db['Dynamics365Field'][_0xaf60('0x2a')]);_0x54807f['query']=_[_0xaf60('0x30')](_0x64e10[_0xaf60('0x2f')]);_0x54807f[_0xaf60('0x31')]=_[_0xaf60('0x33')](_0x54807f[_0xaf60('0x2e')],_0x54807f['query']);_0x20de71[_0xaf60('0x32')]=_[_0xaf60('0x33')](_0x54807f[_0xaf60('0x2e')],qs[_0xaf60('0x34')](_0x64e10['query']['fields']));_0x20de71['attributes']=_0x20de71['attributes'][_0xaf60('0x35')]?_0x20de71[_0xaf60('0x32')]:_0x54807f[_0xaf60('0x2e')];_0x20de71['order']=qs[_0xaf60('0x3a')](_0x64e10['query'][_0xaf60('0x3a')]);_0x20de71[_0xaf60('0x3b')]=qs[_0xaf60('0x31')](_[_0xaf60('0x3c')](_0x64e10[_0xaf60('0x2f')],_0x54807f[_0xaf60('0x31')]));if(_0x64e10['query'][_0xaf60('0x3e')]){_0x20de71[_0xaf60('0x3b')]=_[_0xaf60('0x3d')](_0x20de71[_0xaf60('0x3b')],{'$or':_['map'](_0x20de71[_0xaf60('0x32')],function(_0xdbb7ac){var _0x16e571={};_0x16e571[_0xdbb7ac]={'$like':'%'+_0x64e10[_0xaf60('0x2f')][_0xaf60('0x3e')]+'%'};return _0x16e571;})});}_0x20de71=_[_0xaf60('0x3d')]({},_0x20de71,_0x64e10[_0xaf60('0x48')]);return _0x55fba9[_0xaf60('0x46')](_0x20de71);}})[_0xaf60('0x23')](function(_0x2e4169){if(_0x2e4169){_0xac2ae9=_0x2e4169['length'];if(!_0x64e10[_0xaf60('0x2f')][_0xaf60('0x36')](_0xaf60('0x37'))){_0x20de71[_0xaf60('0x1f')]=qs[_0xaf60('0x1f')](_0x64e10['query'][_0xaf60('0x1f')]);_0x20de71['offset']=qs[_0xaf60('0x38')](_0x64e10[_0xaf60('0x2f')][_0xaf60('0x38')]);}return _0x55fba9['getFields'](_0x20de71);}})['then'](function(_0x1d2c5b){if(_0x1d2c5b){return _0x1d2c5b?{'count':_0xac2ae9,'rows':_0x1d2c5b}:null;}})['then'](respondWithResult(_0xdb81e8,null))[_0xaf60('0x41')](handleError(_0xdb81e8,null));};exports[_0xaf60('0x49')]=function(_0x12257f,_0x2e0cdb,_0x2b104c){var _0x122c74={};var _0x34803d={};var _0x524dbb;var _0x48155b;return db[_0xaf60('0x29')]['findOne']({'where':{'id':_0x12257f[_0xaf60('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e0cdb,null))[_0xaf60('0x23')](function(_0x52edb7){if(_0x52edb7){_0x524dbb=_0x52edb7;_0x34803d[_0xaf60('0x2e')]=_[_0xaf60('0x30')](db[_0xaf60('0x4a')][_0xaf60('0x2a')]);_0x34803d[_0xaf60('0x2f')]=_[_0xaf60('0x30')](_0x12257f[_0xaf60('0x2f')]);_0x34803d[_0xaf60('0x31')]=_[_0xaf60('0x33')](_0x34803d[_0xaf60('0x2e')],_0x34803d['query']);_0x122c74[_0xaf60('0x32')]=_[_0xaf60('0x33')](_0x34803d[_0xaf60('0x2e')],qs[_0xaf60('0x34')](_0x12257f[_0xaf60('0x2f')][_0xaf60('0x34')]));_0x122c74[_0xaf60('0x32')]=_0x122c74['attributes'][_0xaf60('0x35')]?_0x122c74[_0xaf60('0x32')]:_0x34803d[_0xaf60('0x2e')];_0x122c74[_0xaf60('0x39')]=qs[_0xaf60('0x3a')](_0x12257f['query'][_0xaf60('0x3a')]);_0x122c74[_0xaf60('0x3b')]=qs[_0xaf60('0x31')](_[_0xaf60('0x3c')](_0x12257f[_0xaf60('0x2f')],_0x34803d[_0xaf60('0x31')]));if(_0x12257f[_0xaf60('0x2f')][_0xaf60('0x3e')]){_0x122c74[_0xaf60('0x3b')]=_[_0xaf60('0x3d')](_0x122c74[_0xaf60('0x3b')],{'$or':_[_0xaf60('0x28')](_0x122c74[_0xaf60('0x32')],function(_0x4548cf){var _0x465955={};_0x465955[_0x4548cf]={'$like':'%'+_0x12257f[_0xaf60('0x2f')][_0xaf60('0x3e')]+'%'};return _0x465955;})});}_0x122c74=_['merge']({},_0x122c74,_0x12257f[_0xaf60('0x48')]);return _0x524dbb['getSubjects'](_0x122c74);}})['then'](function(_0x36db89){if(_0x36db89){_0x48155b=_0x36db89[_0xaf60('0x35')];if(!_0x12257f[_0xaf60('0x2f')]['hasOwnProperty'](_0xaf60('0x37'))){_0x122c74['limit']=qs['limit'](_0x12257f[_0xaf60('0x2f')][_0xaf60('0x1f')]);_0x122c74[_0xaf60('0x38')]=qs['offset'](_0x12257f['query'][_0xaf60('0x38')]);}return _0x524dbb['getSubjects'](_0x122c74);}})[_0xaf60('0x23')](function(_0x402159){if(_0x402159){return _0x402159?{'count':_0x48155b,'rows':_0x402159}:null;}})['then'](respondWithResult(_0x2e0cdb,null))[_0xaf60('0x41')](handleError(_0x2e0cdb,null));};exports['getDescriptions']=function(_0x38c388,_0x20515d,_0x5e6f68){var _0x1c0fbc={};var _0x5d2018={};var _0x56a1e1;var _0x5901c0;return db[_0xaf60('0x29')][_0xaf60('0x47')]({'where':{'id':_0x38c388[_0xaf60('0x45')]['id']}})['then'](handleEntityNotFound(_0x20515d,null))[_0xaf60('0x23')](function(_0x140348){if(_0x140348){_0x56a1e1=_0x140348;_0x5d2018['model']=_['keys'](db[_0xaf60('0x4a')][_0xaf60('0x2a')]);_0x5d2018[_0xaf60('0x2f')]=_['keys'](_0x38c388['query']);_0x5d2018[_0xaf60('0x31')]=_[_0xaf60('0x33')](_0x5d2018[_0xaf60('0x2e')],_0x5d2018[_0xaf60('0x2f')]);_0x1c0fbc[_0xaf60('0x32')]=_[_0xaf60('0x33')](_0x5d2018['model'],qs[_0xaf60('0x34')](_0x38c388[_0xaf60('0x2f')]['fields']));_0x1c0fbc[_0xaf60('0x32')]=_0x1c0fbc['attributes'][_0xaf60('0x35')]?_0x1c0fbc['attributes']:_0x5d2018[_0xaf60('0x2e')];_0x1c0fbc[_0xaf60('0x39')]=qs['sort'](_0x38c388[_0xaf60('0x2f')]['sort']);_0x1c0fbc[_0xaf60('0x3b')]=qs[_0xaf60('0x31')](_[_0xaf60('0x3c')](_0x38c388[_0xaf60('0x2f')],_0x5d2018[_0xaf60('0x31')]));if(_0x38c388[_0xaf60('0x2f')][_0xaf60('0x3e')]){_0x1c0fbc[_0xaf60('0x3b')]=_[_0xaf60('0x3d')](_0x1c0fbc['where'],{'$or':_['map'](_0x1c0fbc['attributes'],function(_0x3b3377){var _0x6f0aa4={};_0x6f0aa4[_0x3b3377]={'$like':'%'+_0x38c388[_0xaf60('0x2f')]['filter']+'%'};return _0x6f0aa4;})});}_0x1c0fbc=_['merge']({},_0x1c0fbc,_0x38c388['options']);return _0x56a1e1[_0xaf60('0x4b')](_0x1c0fbc);}})[_0xaf60('0x23')](function(_0x292244){if(_0x292244){_0x5901c0=_0x292244[_0xaf60('0x35')];if(!_0x38c388[_0xaf60('0x2f')]['hasOwnProperty'](_0xaf60('0x37'))){_0x1c0fbc[_0xaf60('0x1f')]=qs[_0xaf60('0x1f')](_0x38c388[_0xaf60('0x2f')][_0xaf60('0x1f')]);_0x1c0fbc[_0xaf60('0x38')]=qs[_0xaf60('0x38')](_0x38c388['query'][_0xaf60('0x38')]);}return _0x56a1e1[_0xaf60('0x4b')](_0x1c0fbc);}})[_0xaf60('0x23')](function(_0x2e67cd){if(_0x2e67cd){return _0x2e67cd?{'count':_0x5901c0,'rows':_0x2e67cd}:null;}})[_0xaf60('0x23')](respondWithResult(_0x20515d,null))['catch'](handleError(_0x20515d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 112a4cc..4cbe995 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x3a129e,_0x4f871c){var _0x15f294=function(_0x5d1dd3){while(--_0x5d1dd3){_0x3a129e['push'](_0x3a129e['shift']());}};_0x15f294(++_0x4f871c);}(_0xb821,0xa7));var _0x1b82=function(_0x5a9c4d,_0x443f7f){_0x5a9c4d=_0x5a9c4d-0x0;var _0x409e45=_0xb821[_0x5a9c4d];return _0x409e45;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe14d,0x1ee));var _0xde14=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe14d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'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 9ac1bc0..db313c8 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 _0x3e8a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','randomstring'];(function(_0x36c6f0,_0x108e57){var _0x41b929=function(_0x5cbc58){while(--_0x5cbc58){_0x36c6f0['push'](_0x36c6f0['shift']());}};_0x41b929(++_0x108e57);}(_0x3e8a,0xe2));var _0xa3e8=function(_0x513213,_0x46a450){_0x513213=_0x513213-0x0;var _0x55d9d8=_0x3e8a[_0x513213];return _0x55d9d8;};'use strict';var _=require(_0xa3e8('0x0'));var util=require('util');var moment=require(_0xa3e8('0x1'));var BPromise=require(_0xa3e8('0x2'));var rs=require(_0xa3e8('0x3'));var fs=require('fs');var Redis=require(_0xa3e8('0x4'));var db=require(_0xa3e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3e8('0x6'))(_0xa3e8('0x7'));var config=require(_0xa3e8('0x8'));var jayson=require(_0xa3e8('0x9'));var client=jayson[_0xa3e8('0xa')][_0xa3e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c4270,_0xee776a,_0x427324){return new BPromise(function(_0x4a48df,_0x5f3bbf){return client[_0xa3e8('0xc')](_0x1c4270,_0x427324)[_0xa3e8('0xd')](function(_0x5b1db8){logger['info'](_0xa3e8('0xe'),_0xee776a,_0xa3e8('0xf'));logger[_0xa3e8('0x10')](_0xa3e8('0x11'),_0xee776a,_0xa3e8('0xf'),JSON[_0xa3e8('0x12')](_0x5b1db8));if(_0x5b1db8[_0xa3e8('0x13')]){if(_0x5b1db8[_0xa3e8('0x13')][_0xa3e8('0x14')]===0x1f4){logger[_0xa3e8('0x13')](_0xa3e8('0xe'),_0xee776a,_0x5b1db8['error'][_0xa3e8('0x15')]);return _0x5f3bbf(_0x5b1db8[_0xa3e8('0x13')][_0xa3e8('0x15')]);}logger['error'](_0xa3e8('0xe'),_0xee776a,_0x5b1db8[_0xa3e8('0x13')]['message']);return _0x4a48df(_0x5b1db8['error'][_0xa3e8('0x15')]);}else{logger[_0xa3e8('0x16')](_0xa3e8('0xe'),_0xee776a,_0xa3e8('0xf'));_0x4a48df(_0x5b1db8['result']['message']);}})['catch'](function(_0x3d3d2b){logger[_0xa3e8('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0xee776a,_0x3d3d2b);_0x5f3bbf(_0x3d3d2b);});});} \ No newline at end of file +var _0x3ee7=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x4dbe30,_0x8172db){var _0x2a9a44=function(_0x3e7e76){while(--_0x3e7e76){_0x4dbe30['push'](_0x4dbe30['shift']());}};_0x2a9a44(++_0x8172db);}(_0x3ee7,0x183));var _0x73ee=function(_0x46684e,_0x2dbf59){_0x46684e=_0x46684e-0x0;var _0x27e43f=_0x3ee7[_0x46684e];return _0x27e43f;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var moment=require(_0x73ee('0x1'));var BPromise=require(_0x73ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73ee('0x3'))['db'];var utils=require(_0x73ee('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x73ee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x73ee('0x6')][_0x73ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9d25c8,_0x35337f,_0x4eeff7){return new BPromise(function(_0x13b8ab,_0x1a8d75){return client[_0x73ee('0x8')](_0x9d25c8,_0x4eeff7)[_0x73ee('0x9')](function(_0x35a4a9){logger[_0x73ee('0xa')](_0x73ee('0xb'),_0x35337f,_0x73ee('0xc'));logger[_0x73ee('0xd')](_0x73ee('0xe'),_0x35337f,_0x73ee('0xc'),JSON[_0x73ee('0xf')](_0x35a4a9));if(_0x35a4a9[_0x73ee('0x10')]){if(_0x35a4a9['error'][_0x73ee('0x11')]===0x1f4){logger[_0x73ee('0x10')](_0x73ee('0xb'),_0x35337f,_0x35a4a9[_0x73ee('0x10')][_0x73ee('0x12')]);return _0x1a8d75(_0x35a4a9[_0x73ee('0x10')][_0x73ee('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x35337f,_0x35a4a9[_0x73ee('0x10')][_0x73ee('0x12')]);return _0x13b8ab(_0x35a4a9['error'][_0x73ee('0x12')]);}else{logger[_0x73ee('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x35337f,_0x73ee('0xc'));_0x13b8ab(_0x35a4a9[_0x73ee('0x13')]['message']);}})['catch'](function(_0xbe8669){logger[_0x73ee('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x35337f,_0xbe8669);_0x1a8d75(_0xbe8669);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bd2b70a..00931a0 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 _0x014c=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x17550c,_0x4f9e05){var _0xded30f=function(_0x13045b){while(--_0x13045b){_0x17550c['push'](_0x17550c['shift']());}};_0xded30f(++_0x4f9e05);}(_0x014c,0x1b0));var _0xc014=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x014c[_0x4a6cf8];return _0x22205e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc014('0x0'));var express=require('express');var router=express[_0xc014('0x1')]();var fs_extra=require(_0xc014('0x2'));var auth=require(_0xc014('0x3'));var interaction=require(_0xc014('0x4'));var config=require(_0xc014('0x5'));var controller=require(_0xc014('0x6'));router[_0xc014('0x7')]('/',auth[_0xc014('0x8')](),controller[_0xc014('0x9')]);router[_0xc014('0x7')]('/:id',auth[_0xc014('0x8')](),controller[_0xc014('0xa')]);router[_0xc014('0xb')]('/',auth['isAuthenticated'](),controller[_0xc014('0xc')]);router[_0xc014('0xd')](_0xc014('0xe'),auth[_0xc014('0x8')](),controller[_0xc014('0xf')]);router[_0xc014('0x10')](_0xc014('0xe'),auth[_0xc014('0x8')](),controller[_0xc014('0x11')]);module[_0xc014('0x12')]=router; \ No newline at end of file +var _0x5413=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9f1335,_0x4106eb){var _0x53dacc=function(_0xc0bc22){while(--_0xc0bc22){_0x9f1335['push'](_0x9f1335['shift']());}};_0x53dacc(++_0x4106eb);}(_0x5413,0x138));var _0x3541=function(_0x382190,_0x353cb4){_0x382190=_0x382190-0x0;var _0x5a8376=_0x5413[_0x382190];return _0x5a8376;};'use strict';var multer=require(_0x3541('0x0'));var util=require(_0x3541('0x1'));var path=require('path');var timeout=require(_0x3541('0x2'));var express=require('express');var router=express[_0x3541('0x3')]();var fs_extra=require(_0x3541('0x4'));var auth=require(_0x3541('0x5'));var interaction=require(_0x3541('0x6'));var config=require(_0x3541('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x3541('0x8')]('/',auth[_0x3541('0x9')](),controller[_0x3541('0xa')]);router[_0x3541('0x8')](_0x3541('0xb'),auth[_0x3541('0x9')](),controller[_0x3541('0xc')]);router[_0x3541('0xd')]('/',auth['isAuthenticated'](),controller[_0x3541('0xe')]);router[_0x3541('0xf')](_0x3541('0xb'),auth['isAuthenticated'](),controller[_0x3541('0x10')]);router[_0x3541('0x11')]('/:id',auth[_0x3541('0x9')](),controller[_0x3541('0x12')]);module[_0x3541('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index cf0b3f8..6139d74 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 _0x154f=['sequelize','variable','keyValue','picklist','string','STRING','customVariable'];(function(_0x4170bb,_0x123bfe){var _0x3a1060=function(_0x33290f){while(--_0x33290f){_0x4170bb['push'](_0x4170bb['shift']());}};_0x3a1060(++_0x123bfe);}(_0x154f,0x93));var _0xf154=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x154f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf154('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xf154('0x1'),'customVariable',_0xf154('0x2'),_0xf154('0x3')),'defaultValue':_0xf154('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf154('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf154('0x4'),_0xf154('0x1'),_0xf154('0x6'))},'keyContent':{'type':Sequelize[_0xf154('0x5')]},'idField':{'type':Sequelize[_0xf154('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8826=['keyValue','variable','STRING','BOOLEAN','ENUM','string','customVariable'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x8826,0x97));var _0x6882=function(_0x307362,_0x53c65f){_0x307362=_0x307362-0x0;var _0x5d902b=_0x8826[_0x307362];return _0x5d902b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6882('0x0')](_0x6882('0x1'),'variable',_0x6882('0x2'),_0x6882('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6882('0x0')](_0x6882('0x1'),_0x6882('0x4'),_0x6882('0x2'))},'keyContent':{'type':Sequelize[_0x6882('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6882('0x5')]},'customField':{'type':Sequelize[_0x6882('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6882('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b51182b..307d94e 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 _0x406a=['error','stack','name','send','map','rawAttributes','fieldName','type','keys','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Dynamics365Field','then','includeAll','include','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update'];(function(_0x47b359,_0x4cac22){var _0x2359ce=function(_0x5a5426){while(--_0x5a5426){_0x47b359['push'](_0x47b359['shift']());}};_0x2359ce(++_0x4cac22);}(_0x406a,0xaf));var _0xa406=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x406a[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0xa406('0x0'));var rimraf=require(_0xa406('0x1'));var zipdir=require(_0xa406('0x2'));var jsonpatch=require(_0xa406('0x3'));var rp=require('request-promise');var moment=require(_0xa406('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa406('0x5'));var util=require(_0xa406('0x6'));var path=require(_0xa406('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa406('0x8'));var fs=require('fs');var fs_extra=require(_0xa406('0x9'));var _=require(_0xa406('0xa'));var squel=require(_0xa406('0xb'));var crypto=require(_0xa406('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa406('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa406('0xe'));var Redis=require(_0xa406('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa406('0x10'));var hardwareService=require(_0xa406('0x11'));var logger=require(_0xa406('0x12'))(_0xa406('0x13'));var utils=require('../../config/utils');var config=require(_0xa406('0x14'));var licenseUtil=require(_0xa406('0x15'));var db=require(_0xa406('0x16'))['db'];function respondWithStatusCode(_0x349a56,_0x251183){_0x251183=_0x251183||0xcc;return function(_0xc36545){if(_0xc36545){return _0x349a56[_0xa406('0x17')](_0x251183);}return _0x349a56[_0xa406('0x18')](_0x251183)[_0xa406('0x19')]();};}function respondWithResult(_0x149932,_0xc20590){_0xc20590=_0xc20590||0xc8;return function(_0x5cc7e8){if(_0x5cc7e8){return _0x149932[_0xa406('0x18')](_0xc20590)[_0xa406('0x1a')](_0x5cc7e8);}};}function respondWithFilteredResult(_0xd170e9,_0xe4a2a6){return function(_0x10ec65){if(_0x10ec65){var _0x582511=typeof _0xe4a2a6['offset']===_0xa406('0x1b')&&typeof _0xe4a2a6[_0xa406('0x1c')]===_0xa406('0x1b');var _0x434291=_0x10ec65[_0xa406('0x1d')];var _0x3bd1e7=_0x582511?0x0:_0xe4a2a6[_0xa406('0x1e')];var _0x21e158=_0x582511?_0x10ec65[_0xa406('0x1d')]:_0xe4a2a6[_0xa406('0x1e')]+_0xe4a2a6['limit'];var _0x47eb95;if(_0x21e158>=_0x434291){_0x21e158=_0x434291;_0x47eb95=0xc8;}else{_0x47eb95=0xce;}_0xd170e9['status'](_0x47eb95);return _0xd170e9['set']('Content-Range',_0x3bd1e7+'-'+_0x21e158+'/'+_0x434291)[_0xa406('0x1a')](_0x10ec65);}return null;};}function patchUpdates(_0x26ebd4){return function(_0x2ea462){try{jsonpatch[_0xa406('0x1f')](_0x2ea462,_0x26ebd4,!![]);}catch(_0x1dde38){return BPromise[_0xa406('0x20')](_0x1dde38);}return _0x2ea462[_0xa406('0x21')]();};}function saveUpdates(_0xe4e8ff,_0x2b4360){return function(_0x144702){if(_0x144702){return _0x144702[_0xa406('0x22')](_0xe4e8ff)['then'](function(_0x1ea205){return _0x1ea205;});}return null;};}function removeEntity(_0x17bac0,_0x143471){return function(_0x5f0487){if(_0x5f0487){return _0x5f0487['destroy']()['then'](function(){_0x17bac0[_0xa406('0x18')](0xcc)[_0xa406('0x19')]();});}};}function handleEntityNotFound(_0x4fbb7a,_0x1443c6){return function(_0x57ec1c){if(!_0x57ec1c){_0x4fbb7a[_0xa406('0x17')](0x194);}return _0x57ec1c;};}function handleError(_0x53e277,_0x483069){_0x483069=_0x483069||0x1f4;return function(_0x453d54){logger[_0xa406('0x23')](_0x453d54[_0xa406('0x24')]);if(_0x453d54[_0xa406('0x25')]){delete _0x453d54[_0xa406('0x25')];}_0x53e277[_0xa406('0x18')](_0x483069)[_0xa406('0x26')](_0x453d54);};}exports['index']=function(_0x1c5809,_0x2a344a){var _0x35f1c2={},_0x34da91={},_0x29d8ac={'count':0x0,'rows':[]};var _0x492ae3=_[_0xa406('0x27')](db['Dynamics365Field'][_0xa406('0x28')],function(_0x26a297){return{'name':_0x26a297[_0xa406('0x29')],'type':_0x26a297[_0xa406('0x2a')]['key']};});_0x34da91['model']=_[_0xa406('0x27')](_0x492ae3,'name');_0x34da91['query']=_[_0xa406('0x2b')](_0x1c5809['query']);_0x34da91[_0xa406('0x2c')]=_[_0xa406('0x2d')](_0x34da91['model'],_0x34da91['query']);_0x35f1c2[_0xa406('0x2e')]=_[_0xa406('0x2d')](_0x34da91['model'],qs[_0xa406('0x2f')](_0x1c5809[_0xa406('0x30')][_0xa406('0x2f')]));_0x35f1c2[_0xa406('0x2e')]=_0x35f1c2[_0xa406('0x2e')][_0xa406('0x31')]?_0x35f1c2[_0xa406('0x2e')]:_0x34da91[_0xa406('0x32')];if(!_0x1c5809['query'][_0xa406('0x33')](_0xa406('0x34'))){_0x35f1c2[_0xa406('0x1c')]=qs[_0xa406('0x1c')](_0x1c5809[_0xa406('0x30')][_0xa406('0x1c')]);_0x35f1c2[_0xa406('0x1e')]=qs['offset'](_0x1c5809['query'][_0xa406('0x1e')]);}_0x35f1c2[_0xa406('0x35')]=qs[_0xa406('0x36')](_0x1c5809['query']['sort']);_0x35f1c2[_0xa406('0x37')]=qs[_0xa406('0x2c')](_[_0xa406('0x38')](_0x1c5809[_0xa406('0x30')],_0x34da91[_0xa406('0x2c')]),_0x492ae3);if(_0x1c5809[_0xa406('0x30')]['filter']){_0x35f1c2['where']=_['merge'](_0x35f1c2[_0xa406('0x37')],{'$or':_[_0xa406('0x27')](_0x492ae3,function(_0x1d4f13){if(_0x1d4f13[_0xa406('0x2a')]!==_0xa406('0x39')){var _0x366c5f={};_0x366c5f[_0x1d4f13[_0xa406('0x25')]]={'$like':'%'+_0x1c5809[_0xa406('0x30')][_0xa406('0x3a')]+'%'};return _0x366c5f;}})});}_0x35f1c2=_[_0xa406('0x3b')]({},_0x35f1c2,_0x1c5809[_0xa406('0x3c')]);var _0x298132={'where':_0x35f1c2[_0xa406('0x37')]};return db[_0xa406('0x3d')][_0xa406('0x1d')](_0x298132)[_0xa406('0x3e')](function(_0x4f1119){_0x29d8ac[_0xa406('0x1d')]=_0x4f1119;if(_0x1c5809[_0xa406('0x30')][_0xa406('0x3f')]){_0x35f1c2[_0xa406('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x35f1c2);})['then'](function(_0x280d2f){_0x29d8ac['rows']=_0x280d2f;return _0x29d8ac;})[_0xa406('0x3e')](respondWithFilteredResult(_0x2a344a,_0x35f1c2))[_0xa406('0x41')](handleError(_0x2a344a,null));};exports['show']=function(_0x551f40,_0x33d458){var _0x18a7cd={'raw':!![],'where':{'id':_0x551f40[_0xa406('0x42')]['id']}},_0x56e40a={};_0x56e40a[_0xa406('0x32')]=_[_0xa406('0x2b')](db['Dynamics365Field'][_0xa406('0x28')]);_0x56e40a[_0xa406('0x30')]=_['keys'](_0x551f40[_0xa406('0x30')]);_0x56e40a[_0xa406('0x2c')]=_[_0xa406('0x2d')](_0x56e40a[_0xa406('0x32')],_0x56e40a[_0xa406('0x30')]);_0x18a7cd[_0xa406('0x2e')]=_[_0xa406('0x2d')](_0x56e40a[_0xa406('0x32')],qs['fields'](_0x551f40[_0xa406('0x30')][_0xa406('0x2f')]));_0x18a7cd[_0xa406('0x2e')]=_0x18a7cd[_0xa406('0x2e')][_0xa406('0x31')]?_0x18a7cd['attributes']:_0x56e40a[_0xa406('0x32')];if(_0x551f40[_0xa406('0x30')][_0xa406('0x3f')]){_0x18a7cd[_0xa406('0x40')]=[{'all':!![]}];}_0x18a7cd=_['merge']({},_0x18a7cd,_0x551f40[_0xa406('0x3c')]);return db['Dynamics365Field'][_0xa406('0x43')](_0x18a7cd)[_0xa406('0x3e')](handleEntityNotFound(_0x33d458,null))[_0xa406('0x3e')](respondWithResult(_0x33d458,null))[_0xa406('0x41')](handleError(_0x33d458,null));};exports[_0xa406('0x44')]=function(_0x1226eb,_0x3eb602){return db[_0xa406('0x3d')]['create'](_0x1226eb[_0xa406('0x45')],{})[_0xa406('0x3e')](respondWithResult(_0x3eb602,0xc9))[_0xa406('0x41')](handleError(_0x3eb602,null));};exports[_0xa406('0x22')]=function(_0x128cd2,_0x14bcad){if(_0x128cd2[_0xa406('0x45')]['id']){delete _0x128cd2[_0xa406('0x45')]['id'];}return db['Dynamics365Field'][_0xa406('0x43')]({'where':{'id':_0x128cd2[_0xa406('0x42')]['id']}})[_0xa406('0x3e')](handleEntityNotFound(_0x14bcad,null))[_0xa406('0x3e')](saveUpdates(_0x128cd2['body'],null))[_0xa406('0x3e')](respondWithResult(_0x14bcad,null))[_0xa406('0x41')](handleError(_0x14bcad,null));};exports['destroy']=function(_0x4c818b,_0x3d1b8c){return db[_0xa406('0x3d')][_0xa406('0x43')]({'where':{'id':_0x4c818b[_0xa406('0x42')]['id']}})[_0xa406('0x3e')](handleEntityNotFound(_0x3d1b8c,null))[_0xa406('0x3e')](removeEntity(_0x3d1b8c,null))[_0xa406('0x41')](handleError(_0x3d1b8c,null));}; \ No newline at end of file +var _0x71e7=['nolimit','sort','filters','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','fieldName','key','query','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x5cca0d,_0x50867c){var _0x4f2c03=function(_0x310d4b){while(--_0x310d4b){_0x5cca0d['push'](_0x5cca0d['shift']());}};_0x4f2c03(++_0x50867c);}(_0x71e7,0xae));var _0x771e=function(_0x39a40e,_0x51b0d0){_0x39a40e=_0x39a40e-0x0;var _0x3f59cc=_0x71e7[_0x39a40e];return _0x3f59cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x771e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x771e('0x1'));var rp=require(_0x771e('0x2'));var moment=require(_0x771e('0x3'));var BPromise=require(_0x771e('0x4'));var Mustache=require(_0x771e('0x5'));var util=require(_0x771e('0x6'));var path=require(_0x771e('0x7'));var sox=require('sox');var csv=require(_0x771e('0x8'));var ejs=require(_0x771e('0x9'));var fs=require('fs');var fs_extra=require(_0x771e('0xa'));var _=require(_0x771e('0xb'));var squel=require(_0x771e('0xc'));var crypto=require('crypto');var jsforce=require(_0x771e('0xd'));var deskjs=require(_0x771e('0xe'));var toCsv=require(_0x771e('0x8'));var querystring=require(_0x771e('0xf'));var Papa=require(_0x771e('0x10'));var Redis=require(_0x771e('0x11'));var authService=require(_0x771e('0x12'));var qs=require(_0x771e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x771e('0x14'));var logger=require(_0x771e('0x15'))(_0x771e('0x16'));var utils=require(_0x771e('0x17'));var config=require(_0x771e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x771e('0x19'))['db'];function respondWithStatusCode(_0x4482c2,_0x34c195){_0x34c195=_0x34c195||0xcc;return function(_0x493541){if(_0x493541){return _0x4482c2['sendStatus'](_0x34c195);}return _0x4482c2[_0x771e('0x1a')](_0x34c195)['end']();};}function respondWithResult(_0x193f58,_0xb68f4b){_0xb68f4b=_0xb68f4b||0xc8;return function(_0xbbccac){if(_0xbbccac){return _0x193f58[_0x771e('0x1a')](_0xb68f4b)[_0x771e('0x1b')](_0xbbccac);}};}function respondWithFilteredResult(_0x5ef822,_0x1d6125){return function(_0x27389a){if(_0x27389a){var _0x576aa9=typeof _0x1d6125[_0x771e('0x1c')]===_0x771e('0x1d')&&typeof _0x1d6125[_0x771e('0x1e')]===_0x771e('0x1d');var _0x84ae13=_0x27389a[_0x771e('0x1f')];var _0x4bd504=_0x576aa9?0x0:_0x1d6125['offset'];var _0x5b9914=_0x576aa9?_0x27389a[_0x771e('0x1f')]:_0x1d6125[_0x771e('0x1c')]+_0x1d6125[_0x771e('0x1e')];var _0x4f56bd;if(_0x5b9914>=_0x84ae13){_0x5b9914=_0x84ae13;_0x4f56bd=0xc8;}else{_0x4f56bd=0xce;}_0x5ef822[_0x771e('0x1a')](_0x4f56bd);return _0x5ef822[_0x771e('0x20')]('Content-Range',_0x4bd504+'-'+_0x5b9914+'/'+_0x84ae13)[_0x771e('0x1b')](_0x27389a);}return null;};}function patchUpdates(_0x185334){return function(_0x25efc0){try{jsonpatch[_0x771e('0x21')](_0x25efc0,_0x185334,!![]);}catch(_0x258ed7){return BPromise['reject'](_0x258ed7);}return _0x25efc0[_0x771e('0x22')]();};}function saveUpdates(_0x2bcc39,_0xa0c325){return function(_0x308692){if(_0x308692){return _0x308692['update'](_0x2bcc39)['then'](function(_0x9d576e){return _0x9d576e;});}return null;};}function removeEntity(_0x35de38,_0x2ad769){return function(_0x2fb9ab){if(_0x2fb9ab){return _0x2fb9ab[_0x771e('0x23')]()['then'](function(){_0x35de38[_0x771e('0x1a')](0xcc)[_0x771e('0x24')]();});}};}function handleEntityNotFound(_0x377a15,_0x118474){return function(_0x291a2c){if(!_0x291a2c){_0x377a15[_0x771e('0x25')](0x194);}return _0x291a2c;};}function handleError(_0xa7577b,_0x15c869){_0x15c869=_0x15c869||0x1f4;return function(_0x7b9dc7){logger[_0x771e('0x26')](_0x7b9dc7[_0x771e('0x27')]);if(_0x7b9dc7['name']){delete _0x7b9dc7[_0x771e('0x28')];}_0xa7577b[_0x771e('0x1a')](_0x15c869)[_0x771e('0x29')](_0x7b9dc7);};}exports[_0x771e('0x2a')]=function(_0x48ddbd,_0x484f18){var _0x24366c={},_0x3a6592={},_0x472e80={'count':0x0,'rows':[]};var _0x13bd31=_[_0x771e('0x2b')](db[_0x771e('0x2c')]['rawAttributes'],function(_0x5e2794){return{'name':_0x5e2794[_0x771e('0x2d')],'type':_0x5e2794['type'][_0x771e('0x2e')]};});_0x3a6592['model']=_[_0x771e('0x2b')](_0x13bd31,_0x771e('0x28'));_0x3a6592[_0x771e('0x2f')]=_['keys'](_0x48ddbd['query']);_0x3a6592['filters']=_[_0x771e('0x30')](_0x3a6592['model'],_0x3a6592[_0x771e('0x2f')]);_0x24366c[_0x771e('0x31')]=_[_0x771e('0x30')](_0x3a6592[_0x771e('0x32')],qs['fields'](_0x48ddbd[_0x771e('0x2f')][_0x771e('0x33')]));_0x24366c['attributes']=_0x24366c[_0x771e('0x31')][_0x771e('0x34')]?_0x24366c['attributes']:_0x3a6592[_0x771e('0x32')];if(!_0x48ddbd[_0x771e('0x2f')][_0x771e('0x35')](_0x771e('0x36'))){_0x24366c['limit']=qs[_0x771e('0x1e')](_0x48ddbd['query'][_0x771e('0x1e')]);_0x24366c[_0x771e('0x1c')]=qs['offset'](_0x48ddbd[_0x771e('0x2f')][_0x771e('0x1c')]);}_0x24366c['order']=qs[_0x771e('0x37')](_0x48ddbd[_0x771e('0x2f')][_0x771e('0x37')]);_0x24366c['where']=qs['filters'](_['pick'](_0x48ddbd['query'],_0x3a6592[_0x771e('0x38')]),_0x13bd31);if(_0x48ddbd[_0x771e('0x2f')][_0x771e('0x39')]){_0x24366c['where']=_[_0x771e('0x3a')](_0x24366c[_0x771e('0x3b')],{'$or':_[_0x771e('0x2b')](_0x13bd31,function(_0x56b3e0){if(_0x56b3e0['type']!==_0x771e('0x3c')){var _0x5c8446={};_0x5c8446[_0x56b3e0['name']]={'$like':'%'+_0x48ddbd['query'][_0x771e('0x39')]+'%'};return _0x5c8446;}})});}_0x24366c=_[_0x771e('0x3a')]({},_0x24366c,_0x48ddbd[_0x771e('0x3d')]);var _0x526400={'where':_0x24366c['where']};return db[_0x771e('0x2c')]['count'](_0x526400)[_0x771e('0x3e')](function(_0x5f4afb){_0x472e80[_0x771e('0x1f')]=_0x5f4afb;if(_0x48ddbd[_0x771e('0x2f')][_0x771e('0x3f')]){_0x24366c[_0x771e('0x40')]=[{'all':!![]}];}return db[_0x771e('0x2c')][_0x771e('0x41')](_0x24366c);})['then'](function(_0x2baa68){_0x472e80[_0x771e('0x42')]=_0x2baa68;return _0x472e80;})[_0x771e('0x3e')](respondWithFilteredResult(_0x484f18,_0x24366c))[_0x771e('0x43')](handleError(_0x484f18,null));};exports[_0x771e('0x44')]=function(_0x517343,_0x51ee06){var _0x20eb0b={'raw':!![],'where':{'id':_0x517343['params']['id']}},_0x81ec15={};_0x81ec15[_0x771e('0x32')]=_[_0x771e('0x45')](db[_0x771e('0x2c')][_0x771e('0x46')]);_0x81ec15[_0x771e('0x2f')]=_[_0x771e('0x45')](_0x517343['query']);_0x81ec15['filters']=_[_0x771e('0x30')](_0x81ec15[_0x771e('0x32')],_0x81ec15['query']);_0x20eb0b[_0x771e('0x31')]=_[_0x771e('0x30')](_0x81ec15['model'],qs['fields'](_0x517343[_0x771e('0x2f')][_0x771e('0x33')]));_0x20eb0b['attributes']=_0x20eb0b['attributes'][_0x771e('0x34')]?_0x20eb0b[_0x771e('0x31')]:_0x81ec15['model'];if(_0x517343[_0x771e('0x2f')][_0x771e('0x3f')]){_0x20eb0b[_0x771e('0x40')]=[{'all':!![]}];}_0x20eb0b=_['merge']({},_0x20eb0b,_0x517343[_0x771e('0x3d')]);return db[_0x771e('0x2c')][_0x771e('0x47')](_0x20eb0b)[_0x771e('0x3e')](handleEntityNotFound(_0x51ee06,null))[_0x771e('0x3e')](respondWithResult(_0x51ee06,null))[_0x771e('0x43')](handleError(_0x51ee06,null));};exports['create']=function(_0x3ef386,_0x71e9c1){return db[_0x771e('0x2c')][_0x771e('0x48')](_0x3ef386[_0x771e('0x49')],{})[_0x771e('0x3e')](respondWithResult(_0x71e9c1,0xc9))['catch'](handleError(_0x71e9c1,null));};exports[_0x771e('0x4a')]=function(_0x207959,_0x15449e){if(_0x207959[_0x771e('0x49')]['id']){delete _0x207959[_0x771e('0x49')]['id'];}return db[_0x771e('0x2c')][_0x771e('0x47')]({'where':{'id':_0x207959[_0x771e('0x4b')]['id']}})[_0x771e('0x3e')](handleEntityNotFound(_0x15449e,null))[_0x771e('0x3e')](saveUpdates(_0x207959['body'],null))['then'](respondWithResult(_0x15449e,null))['catch'](handleError(_0x15449e,null));};exports['destroy']=function(_0x5f52ba,_0x2c4439){return db['Dynamics365Field'][_0x771e('0x47')]({'where':{'id':_0x5f52ba[_0x771e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c4439,null))[_0x771e('0x3e')](removeEntity(_0x2c4439,null))[_0x771e('0x43')](handleError(_0x2c4439,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c0d01e5..48c3288 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 _0x79c1=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x33d820,_0x153a07){var _0x48d623=function(_0x16d76d){while(--_0x16d76d){_0x33d820['push'](_0x33d820['shift']());}};_0x48d623(++_0x153a07);}(_0x79c1,0xea));var _0x179c=function(_0x32c8aa,_0x3d0d7e){_0x32c8aa=_0x32c8aa-0x0;var _0x5ad8dc=_0x79c1[_0x32c8aa];return _0x5ad8dc;};'use strict';var _=require(_0x179c('0x0'));var util=require(_0x179c('0x1'));var logger=require('../../config/logger')(_0x179c('0x2'));var moment=require(_0x179c('0x3'));var BPromise=require(_0x179c('0x4'));var rp=require(_0x179c('0x5'));var fs=require('fs');var path=require(_0x179c('0x6'));var rimraf=require(_0x179c('0x7'));var config=require(_0x179c('0x8'));var attributes=require(_0x179c('0x9'));module['exports']=function(_0x4606e0,_0x1ece8d){return _0x4606e0[_0x179c('0xa')](_0x179c('0xb'),attributes,{'tableName':_0x179c('0xc'),'paranoid':![],'indexes':[{'name':_0x179c('0xd'),'fields':[_0x179c('0xe'),_0x179c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d4=['api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','dynamics365_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x1dfcbf,_0x17a7b6){var _0x47ac22=function(_0x2e615d){while(--_0x2e615d){_0x1dfcbf['push'](_0x1dfcbf['shift']());}};_0x47ac22(++_0x17a7b6);}(_0xe7d4,0x82));var _0x4e7d=function(_0x425f53,_0x226d1b){_0x425f53=_0x425f53-0x0;var _0x44364c=_0xe7d4[_0x425f53];return _0x44364c;};'use strict';var _=require('lodash');var util=require(_0x4e7d('0x0'));var logger=require(_0x4e7d('0x1'))(_0x4e7d('0x2'));var moment=require(_0x4e7d('0x3'));var BPromise=require(_0x4e7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e7d('0x5'));var rimraf=require(_0x4e7d('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e7d('0x7'));module[_0x4e7d('0x8')]=function(_0x5528ce,_0x29da20){return _0x5528ce['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4e7d('0x9'),'fields':[_0x4e7d('0xa'),_0x4e7d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 917274e..4affac7 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 _0xa581=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0x9bd2d4,_0x4deb9b){var _0x4da5fc=function(_0x49a971){while(--_0x49a971){_0x9bd2d4['push'](_0x9bd2d4['shift']());}};_0x4da5fc(++_0x4deb9b);}(_0xa581,0x7b));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a58('0x0'));var util=require('util');var moment=require(_0x1a58('0x1'));var BPromise=require(_0x1a58('0x2'));var rs=require(_0x1a58('0x3'));var fs=require('fs');var Redis=require(_0x1a58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a58('0x5'));var logger=require('../../config/logger')(_0x1a58('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a58('0x7'));var client=jayson[_0x1a58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3c0f,_0x3ff9fb,_0x5f18ad){return new BPromise(function(_0x34713,_0x335bf6){return client[_0x1a58('0x9')](_0x5b3c0f,_0x5f18ad)['then'](function(_0x280485){logger[_0x1a58('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x3ff9fb,'request\x20sent');logger[_0x1a58('0xb')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3ff9fb,_0x1a58('0xc'),JSON[_0x1a58('0xd')](_0x280485));if(_0x280485[_0x1a58('0xe')]){if(_0x280485[_0x1a58('0xe')][_0x1a58('0xf')]===0x1f4){logger[_0x1a58('0xe')](_0x1a58('0x10'),_0x3ff9fb,_0x280485[_0x1a58('0xe')][_0x1a58('0x11')]);return _0x335bf6(_0x280485[_0x1a58('0xe')][_0x1a58('0x11')]);}logger[_0x1a58('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3ff9fb,_0x280485['error'][_0x1a58('0x11')]);return _0x34713(_0x280485[_0x1a58('0xe')][_0x1a58('0x11')]);}else{logger[_0x1a58('0xa')](_0x1a58('0x10'),_0x3ff9fb,'request\x20sent');_0x34713(_0x280485[_0x1a58('0x12')][_0x1a58('0x11')]);}})[_0x1a58('0x13')](function(_0x53140e){logger['error'](_0x1a58('0x10'),_0x3ff9fb,_0x53140e);_0x335bf6(_0x53140e);});});} \ No newline at end of file +var _0xc632=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x245c63,_0x522c98){var _0x189124=function(_0x3ea159){while(--_0x3ea159){_0x245c63['push'](_0x245c63['shift']());}};_0x189124(++_0x522c98);}(_0xc632,0xaf));var _0x2c63=function(_0x33d320,_0x108157){_0x33d320=_0x33d320-0x0;var _0xef63fa=_0xc632[_0x33d320];return _0xef63fa;};'use strict';var _=require(_0x2c63('0x0'));var util=require(_0x2c63('0x1'));var moment=require('moment');var BPromise=require(_0x2c63('0x2'));var rs=require(_0x2c63('0x3'));var fs=require('fs');var Redis=require(_0x2c63('0x4'));var db=require(_0x2c63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c63('0x6'))(_0x2c63('0x7'));var config=require(_0x2c63('0x8'));var jayson=require(_0x2c63('0x9'));var client=jayson[_0x2c63('0xa')][_0x2c63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10749e,_0x4c46ca,_0x3d62eb){return new BPromise(function(_0x1af427,_0xc9b8b5){return client[_0x2c63('0xc')](_0x10749e,_0x3d62eb)[_0x2c63('0xd')](function(_0x1c1aa4){logger[_0x2c63('0xe')](_0x2c63('0xf'),_0x4c46ca,_0x2c63('0x10'));logger[_0x2c63('0x11')](_0x2c63('0x12'),_0x4c46ca,_0x2c63('0x10'),JSON[_0x2c63('0x13')](_0x1c1aa4));if(_0x1c1aa4[_0x2c63('0x14')]){if(_0x1c1aa4[_0x2c63('0x14')][_0x2c63('0x15')]===0x1f4){logger['error'](_0x2c63('0xf'),_0x4c46ca,_0x1c1aa4[_0x2c63('0x14')][_0x2c63('0x16')]);return _0xc9b8b5(_0x1c1aa4[_0x2c63('0x14')]['message']);}logger[_0x2c63('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x4c46ca,_0x1c1aa4['error']['message']);return _0x1af427(_0x1c1aa4[_0x2c63('0x14')][_0x2c63('0x16')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4c46ca,_0x2c63('0x10'));_0x1af427(_0x1c1aa4[_0x2c63('0x17')]['message']);}})[_0x2c63('0x18')](function(_0x216872){logger[_0x2c63('0x14')](_0x2c63('0xf'),_0x4c46ca,_0x216872);_0xc9b8b5(_0x216872);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index cc6d6e4..c98e654 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 _0xfe05=['post','/:id/configurations','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','index','get','isAuthenticated','getConfigurations','/:id/fields','getFields','create'];(function(_0x42808b,_0xd65671){var _0xb1c527=function(_0x36330d){while(--_0x36330d){_0x42808b['push'](_0x42808b['shift']());}};_0xb1c527(++_0xd65671);}(_0xfe05,0xb7));var _0x5fe0=function(_0x1606c9,_0xa13cd){_0x1606c9=_0x1606c9-0x0;var _0x4e0fdd=_0xfe05[_0x1606c9];return _0x4e0fdd;};'use strict';var multer=require(_0x5fe0('0x0'));var util=require(_0x5fe0('0x1'));var path=require(_0x5fe0('0x2'));var timeout=require(_0x5fe0('0x3'));var express=require('express');var router=express[_0x5fe0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5fe0('0x5'));var interaction=require(_0x5fe0('0x6'));var config=require('../../config/environment');var controller=require(_0x5fe0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5fe0('0x8')]);router[_0x5fe0('0x9')]('/:id',auth[_0x5fe0('0xa')](),controller['show']);router[_0x5fe0('0x9')]('/:id/configurations',auth[_0x5fe0('0xa')](),controller[_0x5fe0('0xb')]);router['get'](_0x5fe0('0xc'),auth[_0x5fe0('0xa')](),controller[_0x5fe0('0xd')]);router['post']('/',auth[_0x5fe0('0xa')](),controller[_0x5fe0('0xe')]);router[_0x5fe0('0xf')](_0x5fe0('0x10'),auth['isAuthenticated'](),controller[_0x5fe0('0x11')]);router[_0x5fe0('0x12')](_0x5fe0('0x13'),auth[_0x5fe0('0xa')](),controller['update']);router[_0x5fe0('0x14')](_0x5fe0('0x13'),auth[_0x5fe0('0xa')](),controller[_0x5fe0('0x15')]);module['exports']=router; \ No newline at end of file +var _0x73f8=['destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x330490,_0x57759e){var _0x591273=function(_0x191676){while(--_0x191676){_0x330490['push'](_0x330490['shift']());}};_0x591273(++_0x57759e);}(_0x73f8,0xe8));var _0x873f=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x73f8[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x873f('0x0'));var util=require('util');var path=require(_0x873f('0x1'));var timeout=require('connect-timeout');var express=require(_0x873f('0x2'));var router=express[_0x873f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x873f('0x4'));var config=require(_0x873f('0x5'));var controller=require(_0x873f('0x6'));router[_0x873f('0x7')]('/',auth[_0x873f('0x8')](),controller[_0x873f('0x9')]);router[_0x873f('0x7')](_0x873f('0xa'),auth[_0x873f('0x8')](),controller[_0x873f('0xb')]);router['get'](_0x873f('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x873f('0x7')](_0x873f('0xd'),auth[_0x873f('0x8')](),controller[_0x873f('0xe')]);router[_0x873f('0xf')]('/',auth['isAuthenticated'](),controller[_0x873f('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x873f('0x11')]);router[_0x873f('0x12')](_0x873f('0xa'),auth[_0x873f('0x8')](),controller['update']);router[_0x873f('0x13')](_0x873f('0xa'),auth[_0x873f('0x8')](),controller[_0x873f('0x14')]);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 3c9deb4..c70f8fd 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(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'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 _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0x781d,0x14a));var _0xd781=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x781d[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ae24b72..d35cd7c 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 _0xd64b=['end','json','offset','limit','undefined','count','Content-Range','apply','update','then','stack','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','rows','catch','show','params','keys','includeAll','include','merge','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x1a3a02,_0x90bb8b){var _0x11add6=function(_0x205350){while(--_0x205350){_0x1a3a02['push'](_0x1a3a02['shift']());}};_0x11add6(++_0x90bb8b);}(_0xd64b,0xc1));var _0xbd64=function(_0x283cf6,_0x14e096){_0x283cf6=_0x283cf6-0x0;var _0x4b40e5=_0xd64b[_0x283cf6];return _0x4b40e5;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbd64('0x16'));function respondWithStatusCode(_0x2729d8,_0x3a941c){_0x3a941c=_0x3a941c||0xcc;return function(_0x2183e2){if(_0x2183e2){return _0x2729d8[_0xbd64('0x17')](_0x3a941c);}return _0x2729d8[_0xbd64('0x18')](_0x3a941c)[_0xbd64('0x19')]();};}function respondWithResult(_0x269e2f,_0x2b5808){_0x2b5808=_0x2b5808||0xc8;return function(_0x4ae471){if(_0x4ae471){return _0x269e2f[_0xbd64('0x18')](_0x2b5808)[_0xbd64('0x1a')](_0x4ae471);}};}function respondWithFilteredResult(_0x3ff550,_0x32fd34){return function(_0x29fc16){if(_0x29fc16){var _0x49a914=typeof _0x32fd34[_0xbd64('0x1b')]==='undefined'&&typeof _0x32fd34[_0xbd64('0x1c')]===_0xbd64('0x1d');var _0x3aef70=_0x29fc16[_0xbd64('0x1e')];var _0x17d015=_0x49a914?0x0:_0x32fd34[_0xbd64('0x1b')];var _0xa5491d=_0x49a914?_0x29fc16[_0xbd64('0x1e')]:_0x32fd34['offset']+_0x32fd34[_0xbd64('0x1c')];var _0x1f618b;if(_0xa5491d>=_0x3aef70){_0xa5491d=_0x3aef70;_0x1f618b=0xc8;}else{_0x1f618b=0xce;}_0x3ff550['status'](_0x1f618b);return _0x3ff550['set'](_0xbd64('0x1f'),_0x17d015+'-'+_0xa5491d+'/'+_0x3aef70)[_0xbd64('0x1a')](_0x29fc16);}return null;};}function patchUpdates(_0x196d21){return function(_0x39e2eb){try{jsonpatch[_0xbd64('0x20')](_0x39e2eb,_0x196d21,!![]);}catch(_0x816e00){return BPromise['reject'](_0x816e00);}return _0x39e2eb['save']();};}function saveUpdates(_0x6038f,_0x41f2f){return function(_0x12f67b){if(_0x12f67b){return _0x12f67b[_0xbd64('0x21')](_0x6038f)['then'](function(_0x51d118){return _0x51d118;});}return null;};}function removeEntity(_0x28497c,_0x4afaff){return function(_0x46ab38){if(_0x46ab38){return _0x46ab38['destroy']()[_0xbd64('0x22')](function(){_0x28497c[_0xbd64('0x18')](0xcc)[_0xbd64('0x19')]();});}};}function handleEntityNotFound(_0x2d0993,_0x5ae417){return function(_0x9d0fb8){if(!_0x9d0fb8){_0x2d0993[_0xbd64('0x17')](0x194);}return _0x9d0fb8;};}function handleError(_0x13f527,_0x2a44d0){_0x2a44d0=_0x2a44d0||0x1f4;return function(_0x4d1563){logger['error'](_0x4d1563[_0xbd64('0x23')]);if(_0x4d1563['name']){delete _0x4d1563['name'];}_0x13f527[_0xbd64('0x18')](_0x2a44d0)['send'](_0x4d1563);};}exports[_0xbd64('0x24')]=function(_0x5300e8,_0x28199c){var _0x5d8c35={},_0x1db9f3={},_0x3c0eaf={'count':0x0,'rows':[]};var _0x3be63a=_[_0xbd64('0x25')](db[_0xbd64('0x26')][_0xbd64('0x27')],function(_0x4ed44a){return{'name':_0x4ed44a[_0xbd64('0x28')],'type':_0x4ed44a[_0xbd64('0x29')][_0xbd64('0x2a')]};});_0x1db9f3[_0xbd64('0x2b')]=_[_0xbd64('0x25')](_0x3be63a,_0xbd64('0x2c'));_0x1db9f3['query']=_['keys'](_0x5300e8[_0xbd64('0x2d')]);_0x1db9f3['filters']=_[_0xbd64('0x2e')](_0x1db9f3[_0xbd64('0x2b')],_0x1db9f3['query']);_0x5d8c35['attributes']=_[_0xbd64('0x2e')](_0x1db9f3['model'],qs['fields'](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x5d8c35[_0xbd64('0x30')]=_0x5d8c35['attributes'][_0xbd64('0x31')]?_0x5d8c35['attributes']:_0x1db9f3[_0xbd64('0x2b')];if(!_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x32')](_0xbd64('0x33'))){_0x5d8c35[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x5300e8['query']['limit']);_0x5d8c35[_0xbd64('0x1b')]=qs[_0xbd64('0x1b')](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x1b')]);}_0x5d8c35[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x5300e8['query']['sort']);_0x5d8c35[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x5300e8['query'],_0x1db9f3['filters']),_0x3be63a);if(_0x5300e8[_0xbd64('0x2d')]['filter']){_0x5d8c35[_0xbd64('0x36')]=_['merge'](_0x5d8c35[_0xbd64('0x36')],{'$or':_[_0xbd64('0x25')](_0x3be63a,function(_0x550221){if(_0x550221[_0xbd64('0x29')]!=='VIRTUAL'){var _0x534091={};_0x534091[_0x550221[_0xbd64('0x2c')]]={'$like':'%'+_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x534091;}})});}_0x5d8c35=_['merge']({},_0x5d8c35,_0x5300e8['options']);var _0x5d6bcf={'where':_0x5d8c35[_0xbd64('0x36')]};return db[_0xbd64('0x26')]['count'](_0x5d6bcf)[_0xbd64('0x22')](function(_0x34b19a){_0x3c0eaf[_0xbd64('0x1e')]=_0x34b19a;if(_0x5300e8[_0xbd64('0x2d')]['includeAll']){_0x5d8c35['include']=[{'all':!![]}];}return db[_0xbd64('0x26')]['findAll'](_0x5d8c35);})['then'](function(_0x231fa6){_0x3c0eaf[_0xbd64('0x3a')]=_0x231fa6;return _0x3c0eaf;})[_0xbd64('0x22')](respondWithFilteredResult(_0x28199c,_0x5d8c35))[_0xbd64('0x3b')](handleError(_0x28199c,null));};exports[_0xbd64('0x3c')]=function(_0x3155b3,_0x247775){var _0x762380={'raw':![],'where':{'id':_0x3155b3[_0xbd64('0x3d')]['id']}},_0x4870fd={};_0x4870fd[_0xbd64('0x2b')]=_['keys'](db[_0xbd64('0x26')][_0xbd64('0x27')]);_0x4870fd[_0xbd64('0x2d')]=_[_0xbd64('0x3e')](_0x3155b3[_0xbd64('0x2d')]);_0x4870fd[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0x4870fd['model'],_0x4870fd[_0xbd64('0x2d')]);_0x762380['attributes']=_[_0xbd64('0x2e')](_0x4870fd['model'],qs[_0xbd64('0x2f')](_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x762380['attributes']=_0x762380[_0xbd64('0x30')]['length']?_0x762380['attributes']:_0x4870fd['model'];if(_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x3f')]){_0x762380[_0xbd64('0x40')]=[{'all':!![]}];}_0x762380=_[_0xbd64('0x41')]({},_0x762380,_0x3155b3[_0xbd64('0x42')]);return db[_0xbd64('0x26')][_0xbd64('0x43')](_0x762380)['then'](handleEntityNotFound(_0x247775,null))[_0xbd64('0x22')](respondWithResult(_0x247775,null))[_0xbd64('0x3b')](handleError(_0x247775,null));};exports[_0xbd64('0x44')]=function(_0x4e5efe,_0x105bee){return db[_0xbd64('0x26')][_0xbd64('0x44')](_0x4e5efe[_0xbd64('0x45')],{})[_0xbd64('0x22')](respondWithResult(_0x105bee,0xc9))['catch'](handleError(_0x105bee,null));};exports[_0xbd64('0x21')]=function(_0x1a9ec8,_0x2a8011){if(_0x1a9ec8[_0xbd64('0x45')]['id']){delete _0x1a9ec8['body']['id'];}return db['FreshdeskAccount'][_0xbd64('0x43')]({'where':{'id':_0x1a9ec8[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2a8011,null))[_0xbd64('0x22')](saveUpdates(_0x1a9ec8[_0xbd64('0x45')],null))[_0xbd64('0x22')](respondWithResult(_0x2a8011,null))[_0xbd64('0x3b')](handleError(_0x2a8011,null));};exports[_0xbd64('0x46')]=function(_0x460158,_0x2709b2){return db[_0xbd64('0x26')][_0xbd64('0x43')]({'where':{'id':_0x460158[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2709b2,null))[_0xbd64('0x22')](removeEntity(_0x2709b2,null))['catch'](handleError(_0x2709b2,null));};exports[_0xbd64('0x47')]=function(_0x4952db,_0x5ede67,_0x552c95){var _0x4aa662={};var _0xced0ca={};var _0x2f56df;var _0x5480f5;return db[_0xbd64('0x26')][_0xbd64('0x48')]({'where':{'id':_0x4952db[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ede67,null))[_0xbd64('0x22')](function(_0x371bad){if(_0x371bad){_0x2f56df=_0x371bad;_0xced0ca[_0xbd64('0x2b')]=_[_0xbd64('0x3e')](db[_0xbd64('0x49')][_0xbd64('0x27')]);_0xced0ca['query']=_['keys'](_0x4952db['query']);_0xced0ca[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],_0xced0ca[_0xbd64('0x2d')]);_0x4aa662['attributes']=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],qs[_0xbd64('0x2f')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x4aa662[_0xbd64('0x30')]=_0x4aa662['attributes'][_0xbd64('0x31')]?_0x4aa662[_0xbd64('0x30')]:_0xced0ca[_0xbd64('0x2b')];_0x4aa662[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x35')]);_0x4aa662[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x4952db[_0xbd64('0x2d')],_0xced0ca[_0xbd64('0x37')]));if(_0x4952db['query']['filter']){_0x4aa662[_0xbd64('0x36')]=_[_0xbd64('0x41')](_0x4aa662['where'],{'$or':_['map'](_0x4aa662[_0xbd64('0x30')],function(_0x12bc56){var _0x49051a={};_0x49051a[_0x12bc56]={'$like':'%'+_0x4952db[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x49051a;})});}_0x4aa662=_[_0xbd64('0x41')]({},_0x4aa662,_0x4952db[_0xbd64('0x42')]);return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x2d788){if(_0x2d788){_0x5480f5=_0x2d788[_0xbd64('0x31')];if(!_0x4952db[_0xbd64('0x2d')]['hasOwnProperty'](_0xbd64('0x33'))){_0x4aa662[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x4952db['query'][_0xbd64('0x1c')]);_0x4aa662[_0xbd64('0x1b')]=qs['offset'](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x1b')]);}return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x3615bc){if(_0x3615bc){return _0x3615bc?{'count':_0x5480f5,'rows':_0x3615bc}:null;}})[_0xbd64('0x22')](respondWithResult(_0x5ede67,null))['catch'](handleError(_0x5ede67,null));};exports[_0xbd64('0x4a')]=function(_0x1f3bd0,_0xc57eb1,_0x28d899){if(_0x1f3bd0['body']['id']){delete _0x1f3bd0[_0xbd64('0x45')]['id'];}return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x1f3bd0[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0xbd64('0x22')](function(_0x10e269){if(_0x10e269){_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4b')]=_0x10e269['id'];_0x1f3bd0['body'][_0xbd64('0x4c')]=integrations[_0xbd64('0x4d')](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);_0x1f3bd0['body']['Descriptions']=integrations['getDescriptions'](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);return db[_0xbd64('0x49')][_0xbd64('0x44')](_0x1f3bd0['body'],{'include':[{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x4c')},{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x50')}]});}return null;})[_0xbd64('0x22')](respondWithResult(_0xc57eb1,null))[_0xbd64('0x3b')](handleError(_0xc57eb1,null));};exports[_0xbd64('0x51')]=function(_0x3d7e47,_0x301f42,_0x18e724){var _0x32e611='';return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x3d7e47['params']['id']},'attributes':['id',_0xbd64('0x52'),_0xbd64('0x53')]})[_0xbd64('0x22')](handleEntityNotFound(_0x301f42,null))['then'](function(_0x9b99b3){if(_0x9b99b3){_0x32e611=_0x9b99b3['remoteUri'];var _0x18bad6=_0x32e611[_0xbd64('0x54')](-0x1);if(_0x18bad6==='/'){_0x32e611=_0x32e611[_0xbd64('0x55')](0x0,_0x32e611[_0xbd64('0x56')](_0x18bad6));}return rp({'method':'GET','uri':util[_0xbd64('0x57')]('%s/%s',_0x32e611,_0xbd64('0x58')),'headers':{'Authorization':util[_0xbd64('0x57')](_0xbd64('0x59'),new Buffer(util[_0xbd64('0x57')](_0xbd64('0x5a'),_0x9b99b3['apiKey']))[_0xbd64('0x5b')](_0xbd64('0x5c')))},'json':!![]});}})['then'](function(_0x2b95a0){if(_0x2b95a0){var _0x16c9f7=[_0xbd64('0x5d'),_0xbd64('0x5e'),'agent',_0xbd64('0x5f'),'status',_0xbd64('0x60'),_0xbd64('0x61'),_0xbd64('0x62'),'ticket_type','group','company'];_['remove'](_0x2b95a0,function(_0x3cdf64){return _0x16c9f7[_0xbd64('0x63')](_0x3cdf64[_0xbd64('0x2c')])||!_0x3cdf64[_0xbd64('0x64')]&&_0x3cdf64[_0xbd64('0x29')]!=='custom_text'&&_0x3cdf64[_0xbd64('0x29')]!==_0xbd64('0x65');});return{'count':_0x2b95a0[_0xbd64('0x31')],'rows':_[_0xbd64('0x25')](_0x2b95a0,function(_0x23b455){return{'id':_0x23b455['name'],'name':_0x23b455[_0xbd64('0x66')],'custom':!_0x23b455[_0xbd64('0x64')],'options':_0x23b455[_0xbd64('0x67')]?_[_0xbd64('0x25')](_0x23b455['choices'],function(_0x58957a){return{'name':_[_0xbd64('0x68')](_0x58957a),'value':_0x58957a};}):[]};})};}})[_0xbd64('0x22')](respondWithResult(_0x301f42,null))[_0xbd64('0x3b')](function(_0x2c8932){var _0x18b0f0=_0x3d7e47[_0xbd64('0x2d')][_0xbd64('0x69')]?0x1f4:_0x2c8932[_0xbd64('0x6a')]||0x1f4;logger['error'](_0xbd64('0x6b'),'getFields',_0x18b0f0,JSON[_0xbd64('0x6c')](_0x2c8932));delete _0x2c8932[_0xbd64('0x2c')];if(_0x18b0f0===0x191){_0x18b0f0=0x190;}_0x301f42[_0xbd64('0x18')](_0x18b0f0)['send'](_0x3d7e47[_0xbd64('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2c8932[_0xbd64('0x6a')]}:_0x2c8932);});}; \ No newline at end of file +var _0x780f=['request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','send','index','map','FreshdeskAccount','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','requester','agent','description','priority','group','ticket_type','company','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x10842e,_0x3190fc){var _0x47a7e6=function(_0x3a5c29){while(--_0x3a5c29){_0x10842e['push'](_0x10842e['shift']());}};_0x47a7e6(++_0x3190fc);}(_0x780f,0x6c));var _0xf780=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x780f[_0x487496];return _0x539dc8;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];var integrations=require(_0xf780('0x1a'));function respondWithStatusCode(_0x5f04e1,_0x24aa4f){_0x24aa4f=_0x24aa4f||0xcc;return function(_0xcf2da6){if(_0xcf2da6){return _0x5f04e1[_0xf780('0x1b')](_0x24aa4f);}return _0x5f04e1[_0xf780('0x1c')](_0x24aa4f)['end']();};}function respondWithResult(_0x5a64bc,_0x4be599){_0x4be599=_0x4be599||0xc8;return function(_0x2a19fb){if(_0x2a19fb){return _0x5a64bc[_0xf780('0x1c')](_0x4be599)[_0xf780('0x1d')](_0x2a19fb);}};}function respondWithFilteredResult(_0x187b6d,_0x206d34){return function(_0x335ba6){if(_0x335ba6){var _0x422ef4=typeof _0x206d34['offset']===_0xf780('0x1e')&&typeof _0x206d34[_0xf780('0x1f')]===_0xf780('0x1e');var _0x113834=_0x335ba6[_0xf780('0x20')];var _0x188554=_0x422ef4?0x0:_0x206d34['offset'];var _0x3ede41=_0x422ef4?_0x335ba6[_0xf780('0x20')]:_0x206d34['offset']+_0x206d34[_0xf780('0x1f')];var _0x3fe0a7;if(_0x3ede41>=_0x113834){_0x3ede41=_0x113834;_0x3fe0a7=0xc8;}else{_0x3fe0a7=0xce;}_0x187b6d['status'](_0x3fe0a7);return _0x187b6d[_0xf780('0x21')](_0xf780('0x22'),_0x188554+'-'+_0x3ede41+'/'+_0x113834)[_0xf780('0x1d')](_0x335ba6);}return null;};}function patchUpdates(_0x4065bb){return function(_0x352cf1){try{jsonpatch[_0xf780('0x23')](_0x352cf1,_0x4065bb,!![]);}catch(_0x504f6f){return BPromise[_0xf780('0x24')](_0x504f6f);}return _0x352cf1['save']();};}function saveUpdates(_0x5853ea,_0x45d80e){return function(_0x51b921){if(_0x51b921){return _0x51b921[_0xf780('0x25')](_0x5853ea)['then'](function(_0x2fcb2d){return _0x2fcb2d;});}return null;};}function removeEntity(_0x373dce,_0x4f59b1){return function(_0x3a8327){if(_0x3a8327){return _0x3a8327['destroy']()[_0xf780('0x26')](function(){_0x373dce[_0xf780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589208,_0x3710bb){return function(_0x1ef4f1){if(!_0x1ef4f1){_0x589208[_0xf780('0x1b')](0x194);}return _0x1ef4f1;};}function handleError(_0x40d9c9,_0x458c76){_0x458c76=_0x458c76||0x1f4;return function(_0x2bd6cf){logger[_0xf780('0x27')](_0x2bd6cf['stack']);if(_0x2bd6cf['name']){delete _0x2bd6cf['name'];}_0x40d9c9[_0xf780('0x1c')](_0x458c76)[_0xf780('0x28')](_0x2bd6cf);};}exports[_0xf780('0x29')]=function(_0x4ef8c3,_0x4ed256){var _0x36bc63={},_0x149190={},_0x2b832d={'count':0x0,'rows':[]};var _0x5e6b25=_[_0xf780('0x2a')](db[_0xf780('0x2b')][_0xf780('0x2c')],function(_0x302594){return{'name':_0x302594['fieldName'],'type':_0x302594[_0xf780('0x2d')]['key']};});_0x149190[_0xf780('0x2e')]=_[_0xf780('0x2a')](_0x5e6b25,_0xf780('0x2f'));_0x149190[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4ef8c3[_0xf780('0x30')]);_0x149190[_0xf780('0x32')]=_[_0xf780('0x33')](_0x149190['model'],_0x149190[_0xf780('0x30')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x33')](_0x149190[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4ef8c3['query'][_0xf780('0x35')]));_0x36bc63['attributes']=_0x36bc63[_0xf780('0x34')][_0xf780('0x36')]?_0x36bc63[_0xf780('0x34')]:_0x149190['model'];if(!_0x4ef8c3[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x36bc63[_0xf780('0x1f')]=qs['limit'](_0x4ef8c3[_0xf780('0x30')]['limit']);_0x36bc63[_0xf780('0x39')]=qs['offset'](_0x4ef8c3['query'][_0xf780('0x39')]);}_0x36bc63['order']=qs[_0xf780('0x3a')](_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3a')]);_0x36bc63[_0xf780('0x3b')]=qs['filters'](_[_0xf780('0x3c')](_0x4ef8c3[_0xf780('0x30')],_0x149190[_0xf780('0x32')]),_0x5e6b25);if(_0x4ef8c3[_0xf780('0x30')]['filter']){_0x36bc63[_0xf780('0x3b')]=_[_0xf780('0x3d')](_0x36bc63[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x5e6b25,function(_0x1a5ebf){if(_0x1a5ebf['type']!=='VIRTUAL'){var _0x3297c9={};_0x3297c9[_0x1a5ebf[_0xf780('0x2f')]]={'$like':'%'+_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x3297c9;}})});}_0x36bc63=_[_0xf780('0x3d')]({},_0x36bc63,_0x4ef8c3['options']);var _0x1c8eb3={'where':_0x36bc63['where']};return db[_0xf780('0x2b')][_0xf780('0x20')](_0x1c8eb3)[_0xf780('0x26')](function(_0x120465){_0x2b832d['count']=_0x120465;if(_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3f')]){_0x36bc63[_0xf780('0x40')]=[{'all':!![]}];}return db[_0xf780('0x2b')][_0xf780('0x41')](_0x36bc63);})[_0xf780('0x26')](function(_0x2109dc){_0x2b832d[_0xf780('0x42')]=_0x2109dc;return _0x2b832d;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ed256,_0x36bc63))[_0xf780('0x43')](handleError(_0x4ed256,null));};exports[_0xf780('0x44')]=function(_0x30a036,_0x406a9e){var _0x42a710={'raw':![],'where':{'id':_0x30a036[_0xf780('0x45')]['id']}},_0x558b9a={};_0x558b9a['model']=_[_0xf780('0x31')](db[_0xf780('0x2b')]['rawAttributes']);_0x558b9a['query']=_['keys'](_0x30a036['query']);_0x558b9a[_0xf780('0x32')]=_['intersection'](_0x558b9a[_0xf780('0x2e')],_0x558b9a[_0xf780('0x30')]);_0x42a710[_0xf780('0x34')]=_[_0xf780('0x33')](_0x558b9a[_0xf780('0x2e')],qs['fields'](_0x30a036['query']['fields']));_0x42a710['attributes']=_0x42a710[_0xf780('0x34')][_0xf780('0x36')]?_0x42a710[_0xf780('0x34')]:_0x558b9a[_0xf780('0x2e')];if(_0x30a036[_0xf780('0x30')][_0xf780('0x3f')]){_0x42a710['include']=[{'all':!![]}];}_0x42a710=_[_0xf780('0x3d')]({},_0x42a710,_0x30a036[_0xf780('0x46')]);return db[_0xf780('0x2b')][_0xf780('0x47')](_0x42a710)[_0xf780('0x26')](handleEntityNotFound(_0x406a9e,null))[_0xf780('0x26')](respondWithResult(_0x406a9e,null))['catch'](handleError(_0x406a9e,null));};exports[_0xf780('0x48')]=function(_0x5c4170,_0x2f08f3){return db['FreshdeskAccount'][_0xf780('0x48')](_0x5c4170['body'],{})['then'](respondWithResult(_0x2f08f3,0xc9))[_0xf780('0x43')](handleError(_0x2f08f3,null));};exports[_0xf780('0x25')]=function(_0x189717,_0x2946a1){if(_0x189717['body']['id']){delete _0x189717[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x47')]({'where':{'id':_0x189717[_0xf780('0x45')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x2946a1,null))['then'](saveUpdates(_0x189717[_0xf780('0x49')],null))['then'](respondWithResult(_0x2946a1,null))[_0xf780('0x43')](handleError(_0x2946a1,null));};exports[_0xf780('0x4a')]=function(_0x22c52d,_0x45ae96){return db[_0xf780('0x2b')]['find']({'where':{'id':_0x22c52d['params']['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x45ae96,null))[_0xf780('0x26')](removeEntity(_0x45ae96,null))[_0xf780('0x43')](handleError(_0x45ae96,null));};exports[_0xf780('0x4b')]=function(_0x4eebe5,_0x4094d5,_0x476354){var _0x180507={};var _0x3f71d2={};var _0x42bcc6;var _0x3b98c7;return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4eebe5[_0xf780('0x45')]['id']}})['then'](handleEntityNotFound(_0x4094d5,null))[_0xf780('0x26')](function(_0x1f1907){if(_0x1f1907){_0x42bcc6=_0x1f1907;_0x3f71d2[_0xf780('0x2e')]=_[_0xf780('0x31')](db[_0xf780('0x4d')][_0xf780('0x2c')]);_0x3f71d2[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4eebe5[_0xf780('0x30')]);_0x3f71d2[_0xf780('0x32')]=_[_0xf780('0x33')](_0x3f71d2[_0xf780('0x2e')],_0x3f71d2['query']);_0x180507[_0xf780('0x34')]=_['intersection'](_0x3f71d2[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4eebe5['query']['fields']));_0x180507['attributes']=_0x180507[_0xf780('0x34')][_0xf780('0x36')]?_0x180507[_0xf780('0x34')]:_0x3f71d2['model'];_0x180507['order']=qs['sort'](_0x4eebe5[_0xf780('0x30')]['sort']);_0x180507[_0xf780('0x3b')]=qs[_0xf780('0x32')](_[_0xf780('0x3c')](_0x4eebe5['query'],_0x3f71d2[_0xf780('0x32')]));if(_0x4eebe5['query'][_0xf780('0x3e')]){_0x180507[_0xf780('0x3b')]=_['merge'](_0x180507[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x180507[_0xf780('0x34')],function(_0x1c6799){var _0x2abf0e={};_0x2abf0e[_0x1c6799]={'$like':'%'+_0x4eebe5[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x2abf0e;})});}_0x180507=_['merge']({},_0x180507,_0x4eebe5['options']);return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x586545){if(_0x586545){_0x3b98c7=_0x586545[_0xf780('0x36')];if(!_0x4eebe5[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x180507[_0xf780('0x1f')]=qs['limit'](_0x4eebe5['query'][_0xf780('0x1f')]);_0x180507['offset']=qs[_0xf780('0x39')](_0x4eebe5['query'][_0xf780('0x39')]);}return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x42ec59){if(_0x42ec59){return _0x42ec59?{'count':_0x3b98c7,'rows':_0x42ec59}:null;}})[_0xf780('0x26')](respondWithResult(_0x4094d5,null))['catch'](handleError(_0x4094d5,null));};exports[_0xf780('0x4e')]=function(_0x20dc15,_0x2a9180,_0x4a420f){if(_0x20dc15['body']['id']){delete _0x20dc15[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x4c')]({'where':{'id':_0x20dc15['params']['id']}})['then'](handleEntityNotFound(_0x2a9180,null))[_0xf780('0x26')](function(_0x24bdcb){if(_0x24bdcb){_0x20dc15[_0xf780('0x49')][_0xf780('0x4f')]=_0x24bdcb['id'];_0x20dc15[_0xf780('0x49')][_0xf780('0x50')]=integrations['getSubjects'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')]['type']);_0x20dc15['body'][_0xf780('0x52')]=integrations['getDescriptions'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')][_0xf780('0x2d')]);return db[_0xf780('0x4d')][_0xf780('0x48')](_0x20dc15[_0xf780('0x49')],{'include':[{'model':db[_0xf780('0x53')],'as':_0xf780('0x50')},{'model':db[_0xf780('0x53')],'as':_0xf780('0x52')}]});}return null;})[_0xf780('0x26')](respondWithResult(_0x2a9180,null))[_0xf780('0x43')](handleError(_0x2a9180,null));};exports[_0xf780('0x54')]=function(_0x4110fb,_0x2ee4ae,_0x5a64aa){var _0x70e8ad='';return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4110fb[_0xf780('0x45')]['id']},'attributes':['id',_0xf780('0x55'),'apiKey']})[_0xf780('0x26')](handleEntityNotFound(_0x2ee4ae,null))[_0xf780('0x26')](function(_0x1aad32){if(_0x1aad32){_0x70e8ad=_0x1aad32[_0xf780('0x55')];var _0x3371f7=_0x70e8ad[_0xf780('0x56')](-0x1);if(_0x3371f7==='/'){_0x70e8ad=_0x70e8ad[_0xf780('0x57')](0x0,_0x70e8ad[_0xf780('0x58')](_0x3371f7));}return rp({'method':_0xf780('0x59'),'uri':util[_0xf780('0x5a')](_0xf780('0x5b'),_0x70e8ad,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xf780('0x5a')]('Basic\x20%s',new Buffer(util['format'](_0xf780('0x5c'),_0x1aad32['apiKey']))[_0xf780('0x5d')](_0xf780('0x5e')))},'json':!![]});}})['then'](function(_0x46636a){if(_0x46636a){var _0x380601=[_0xf780('0x5f'),'subject',_0xf780('0x60'),_0xf780('0x61'),_0xf780('0x1c'),_0xf780('0x62'),_0xf780('0x63'),'source',_0xf780('0x64'),_0xf780('0x63'),_0xf780('0x65')];_['remove'](_0x46636a,function(_0x297052){return _0x380601['includes'](_0x297052[_0xf780('0x2f')])||!_0x297052[_0xf780('0x66')]&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x67')&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x68');});return{'count':_0x46636a[_0xf780('0x36')],'rows':_['map'](_0x46636a,function(_0x439082){return{'id':_0x439082[_0xf780('0x2f')],'name':_0x439082[_0xf780('0x69')],'custom':!_0x439082['default'],'options':_0x439082[_0xf780('0x6a')]?_[_0xf780('0x2a')](_0x439082[_0xf780('0x6a')],function(_0x5a8e82){return{'name':_[_0xf780('0x6b')](_0x5a8e82),'value':_0x5a8e82};}):[]};})};}})[_0xf780('0x26')](respondWithResult(_0x2ee4ae,null))[_0xf780('0x43')](function(_0x3d6dfb){var _0x4c527e=_0x4110fb[_0xf780('0x30')][_0xf780('0x6c')]?0x1f4:_0x3d6dfb[_0xf780('0x6d')]||0x1f4;logger[_0xf780('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xf780('0x54'),_0x4c527e,JSON[_0xf780('0x6e')](_0x3d6dfb));delete _0x3d6dfb[_0xf780('0x2f')];if(_0x4c527e===0x191){_0x4c527e=0x190;}_0x2ee4ae[_0xf780('0x1c')](_0x4c527e)['send'](_0x4110fb[_0xf780('0x30')]['test']?{'message':_0xf780('0x6f'),'statusCode':_0x3d6dfb[_0xf780('0x6d')]}:_0x3d6dfb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index fd73843..72f92e5 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 _0x801d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x58a1f2,_0x4ef14c){var _0x557457=function(_0x4fc8ff){while(--_0x4fc8ff){_0x58a1f2['push'](_0x58a1f2['shift']());}};_0x557457(++_0x4ef14c);}(_0x801d,0xa6));var _0xd801=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x801d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd801('0x0'));var util=require(_0xd801('0x1'));var logger=require(_0xd801('0x2'))(_0xd801('0x3'));var moment=require(_0xd801('0x4'));var BPromise=require(_0xd801('0x5'));var rp=require(_0xd801('0x6'));var fs=require('fs');var path=require(_0xd801('0x7'));var rimraf=require(_0xd801('0x8'));var config=require(_0xd801('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd801('0xa'));module[_0xd801('0xb')]=function(_0xb254ec,_0x43e8bc){return _0xb254ec[_0xd801('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ff2=['api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x3a2bd7,_0x4840d5){var _0x587752=function(_0x2bec2d){while(--_0x2bec2d){_0x3a2bd7['push'](_0x3a2bd7['shift']());}};_0x587752(++_0x4840d5);}(_0x2ff2,0x65));var _0x22ff=function(_0x498381,_0x122bfc){_0x498381=_0x498381-0x0;var _0x7e0ae8=_0x2ff2[_0x498381];return _0x7e0ae8;};'use strict';var _=require(_0x22ff('0x0'));var util=require(_0x22ff('0x1'));var logger=require(_0x22ff('0x2'))(_0x22ff('0x3'));var moment=require(_0x22ff('0x4'));var BPromise=require(_0x22ff('0x5'));var rp=require(_0x22ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x22ff('0x7'));var attributes=require(_0x22ff('0x8'));var integrations=require(_0x22ff('0x9'));module[_0x22ff('0xa')]=function(_0x42a439,_0x995bf3){return _0x42a439[_0x22ff('0xb')]('FreshdeskAccount',attributes,{'tableName':_0x22ff('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 1ea7cd1..bf730c9 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 _0x5966=['code','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','map','model','then','ShowFreshdeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0x5966,0x97));var _0x6596=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5966[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6596('0x0'));var util=require(_0x6596('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6596('0x2'));var db=require(_0x6596('0x3'))['db'];var utils=require(_0x6596('0x4'));var logger=require(_0x6596('0x5'))(_0x6596('0x6'));var config=require(_0x6596('0x7'));var jayson=require(_0x6596('0x8'));var client=jayson[_0x6596('0x9')][_0x6596('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56d2f8,_0x51ef04,_0x5c5a94){return new BPromise(function(_0x1227fb,_0x2125ca){return client[_0x6596('0xb')](_0x56d2f8,_0x5c5a94)['then'](function(_0x37c46b){logger[_0x6596('0xc')](_0x6596('0xd'),_0x51ef04,_0x6596('0xe'));logger[_0x6596('0xf')](_0x6596('0x10'),_0x51ef04,_0x6596('0xe'),JSON[_0x6596('0x11')](_0x37c46b));if(_0x37c46b[_0x6596('0x12')]){if(_0x37c46b[_0x6596('0x12')][_0x6596('0x13')]===0x1f4){logger['error'](_0x6596('0xd'),_0x51ef04,_0x37c46b[_0x6596('0x12')][_0x6596('0x14')]);return _0x2125ca(_0x37c46b[_0x6596('0x12')]['message']);}logger[_0x6596('0x12')](_0x6596('0xd'),_0x51ef04,_0x37c46b['error'][_0x6596('0x14')]);return _0x1227fb(_0x37c46b[_0x6596('0x12')][_0x6596('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x51ef04,_0x6596('0xe'));_0x1227fb(_0x37c46b['result'][_0x6596('0x14')]);}})[_0x6596('0x15')](function(_0x14bf86){logger[_0x6596('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x51ef04,_0x14bf86);_0x2125ca(_0x14bf86);});});}exports[_0x6596('0x16')]=function(_0x198ada){var _0x294853=this;return new Promise(function(_0x1b8c54,_0x59b827){return db[_0x6596('0x17')]['findAll']({'raw':_0x198ada[_0x6596('0x18')]?_0x198ada['options'][_0x6596('0x19')]===undefined?!![]:![]:!![],'where':_0x198ada['options']?_0x198ada['options'][_0x6596('0x1a')]||null:null,'attributes':_0x198ada['options']?_0x198ada[_0x6596('0x18')][_0x6596('0x1b')]||null:null,'limit':_0x198ada[_0x6596('0x18')]?_0x198ada[_0x6596('0x18')]['limit']||null:null,'include':_0x198ada[_0x6596('0x18')]?_0x198ada[_0x6596('0x18')][_0x6596('0x1c')]?_['map'](_0x198ada[_0x6596('0x18')][_0x6596('0x1c')],function(_0x36f506){return{'model':db[_0x36f506['model']],'as':_0x36f506['as'],'attributes':_0x36f506[_0x6596('0x1b')],'include':_0x36f506[_0x6596('0x1c')]?_[_0x6596('0x1d')](_0x36f506['include'],function(_0x549e7f){return{'model':db[_0x549e7f[_0x6596('0x1e')]],'as':_0x549e7f['as'],'attributes':_0x549e7f[_0x6596('0x1b')],'include':_0x549e7f['include']?_[_0x6596('0x1d')](_0x549e7f[_0x6596('0x1c')],function(_0x348f49){return{'model':db[_0x348f49[_0x6596('0x1e')]],'as':_0x348f49['as'],'attributes':_0x348f49[_0x6596('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6596('0x1f')](function(_0x1cf75a){logger[_0x6596('0xc')](_0x6596('0x16'),_0x198ada);logger[_0x6596('0xf')](_0x6596('0x16'),_0x198ada,JSON[_0x6596('0x11')](_0x1cf75a));_0x1b8c54(_0x1cf75a);})[_0x6596('0x15')](function(_0xaff0fc){logger[_0x6596('0x12')]('GetFreshdeskAccount',_0xaff0fc[_0x6596('0x14')],_0x198ada);_0x59b827(_0x294853['error'](0x1f4,_0xaff0fc[_0x6596('0x14')]));});});};exports[_0x6596('0x20')]=function(_0x2796c3){var _0x67b005=this;return new Promise(function(_0x1962d4,_0x58cf58){return db[_0x6596('0x17')][_0x6596('0x21')]({'raw':_0x2796c3[_0x6596('0x18')]?_0x2796c3['options'][_0x6596('0x19')]===undefined?!![]:![]:!![],'where':_0x2796c3['options']?_0x2796c3['options'][_0x6596('0x1a')]||null:null,'attributes':_0x2796c3[_0x6596('0x18')]?_0x2796c3[_0x6596('0x18')]['attributes']||null:null,'include':_0x2796c3[_0x6596('0x18')]?_0x2796c3['options'][_0x6596('0x1c')]?_[_0x6596('0x1d')](_0x2796c3['options'][_0x6596('0x1c')],function(_0x4ca740){return{'model':db[_0x4ca740[_0x6596('0x1e')]],'as':_0x4ca740['as'],'attributes':_0x4ca740[_0x6596('0x1b')],'include':_0x4ca740[_0x6596('0x1c')]?_[_0x6596('0x1d')](_0x4ca740[_0x6596('0x1c')],function(_0x1c0fff){return{'model':db[_0x1c0fff[_0x6596('0x1e')]],'as':_0x1c0fff['as'],'attributes':_0x1c0fff['attributes'],'include':_0x1c0fff[_0x6596('0x1c')]?_['map'](_0x1c0fff[_0x6596('0x1c')],function(_0x14372c){return{'model':db[_0x14372c['model']],'as':_0x14372c['as'],'attributes':_0x14372c[_0x6596('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x509dd8){logger[_0x6596('0xc')]('ShowFreshdeskAccount',_0x2796c3);logger[_0x6596('0xf')](_0x6596('0x20'),_0x2796c3,JSON['stringify'](_0x509dd8));_0x1962d4(_0x509dd8);})['catch'](function(_0x604df3){logger['error']('ShowFreshdeskAccount',_0x604df3[_0x6596('0x14')],_0x2796c3);_0x58cf58(_0x67b005['error'](0x1f4,_0x604df3[_0x6596('0x14')]));});});}; \ No newline at end of file +var _0x2bf7=['rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','then','catch','raw','where','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2db59e,_0x235f1b){var _0x18fe4b=function(_0x4b479d){while(--_0x4b479d){_0x2db59e['push'](_0x2db59e['shift']());}};_0x18fe4b(++_0x235f1b);}(_0x2bf7,0x1e8));var _0x72bf=function(_0x133ac4,_0x412123){_0x133ac4=_0x133ac4-0x0;var _0x28c528=_0x2bf7[_0x133ac4];return _0x28c528;};'use strict';var _=require(_0x72bf('0x0'));var util=require(_0x72bf('0x1'));var moment=require(_0x72bf('0x2'));var BPromise=require(_0x72bf('0x3'));var rs=require(_0x72bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x72bf('0x6'))(_0x72bf('0x7'));var config=require(_0x72bf('0x8'));var jayson=require(_0x72bf('0x9'));var client=jayson['client'][_0x72bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x521b54,_0xeadc71,_0x2fa6da){return new BPromise(function(_0x317e1f,_0x21c964){return client[_0x72bf('0xb')](_0x521b54,_0x2fa6da)['then'](function(_0x44a664){logger[_0x72bf('0xc')](_0x72bf('0xd'),_0xeadc71,'request\x20sent');logger[_0x72bf('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xeadc71,'request\x20sent',JSON[_0x72bf('0xf')](_0x44a664));if(_0x44a664[_0x72bf('0x10')]){if(_0x44a664[_0x72bf('0x10')]['code']===0x1f4){logger[_0x72bf('0x10')](_0x72bf('0xd'),_0xeadc71,_0x44a664[_0x72bf('0x10')][_0x72bf('0x11')]);return _0x21c964(_0x44a664[_0x72bf('0x10')][_0x72bf('0x11')]);}logger[_0x72bf('0x10')](_0x72bf('0xd'),_0xeadc71,_0x44a664[_0x72bf('0x10')][_0x72bf('0x11')]);return _0x317e1f(_0x44a664[_0x72bf('0x10')][_0x72bf('0x11')]);}else{logger[_0x72bf('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0xeadc71,_0x72bf('0x12'));_0x317e1f(_0x44a664['result']['message']);}})['catch'](function(_0x259371){logger['error'](_0x72bf('0xd'),_0xeadc71,_0x259371);_0x21c964(_0x259371);});});}exports[_0x72bf('0x13')]=function(_0x1d4fc8){var _0x3fdc7c=this;return new Promise(function(_0x374531,_0x599f46){return db[_0x72bf('0x14')][_0x72bf('0x15')]({'raw':_0x1d4fc8[_0x72bf('0x16')]?_0x1d4fc8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d4fc8[_0x72bf('0x16')]?_0x1d4fc8[_0x72bf('0x16')]['where']||null:null,'attributes':_0x1d4fc8[_0x72bf('0x16')]?_0x1d4fc8[_0x72bf('0x16')][_0x72bf('0x17')]||null:null,'limit':_0x1d4fc8[_0x72bf('0x16')]?_0x1d4fc8['options'][_0x72bf('0x18')]||null:null,'include':_0x1d4fc8['options']?_0x1d4fc8['options'][_0x72bf('0x19')]?_[_0x72bf('0x1a')](_0x1d4fc8['options'][_0x72bf('0x19')],function(_0x37155d){return{'model':db[_0x37155d[_0x72bf('0x1b')]],'as':_0x37155d['as'],'attributes':_0x37155d[_0x72bf('0x17')],'include':_0x37155d[_0x72bf('0x19')]?_[_0x72bf('0x1a')](_0x37155d['include'],function(_0x14484a){return{'model':db[_0x14484a[_0x72bf('0x1b')]],'as':_0x14484a['as'],'attributes':_0x14484a['attributes'],'include':_0x14484a[_0x72bf('0x19')]?_[_0x72bf('0x1a')](_0x14484a[_0x72bf('0x19')],function(_0x17ca0d){return{'model':db[_0x17ca0d[_0x72bf('0x1b')]],'as':_0x17ca0d['as'],'attributes':_0x17ca0d[_0x72bf('0x17')]};}):[]};}):[]};}):[]:[]})[_0x72bf('0x1c')](function(_0xc9db43){logger[_0x72bf('0xc')](_0x72bf('0x13'),_0x1d4fc8);logger[_0x72bf('0xe')](_0x72bf('0x13'),_0x1d4fc8,JSON[_0x72bf('0xf')](_0xc9db43));_0x374531(_0xc9db43);})[_0x72bf('0x1d')](function(_0x2bc046){logger[_0x72bf('0x10')]('GetFreshdeskAccount',_0x2bc046[_0x72bf('0x11')],_0x1d4fc8);_0x599f46(_0x3fdc7c[_0x72bf('0x10')](0x1f4,_0x2bc046[_0x72bf('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x4725dd){var _0x536fdb=this;return new Promise(function(_0x2e97df,_0x310c35){return db['FreshdeskAccount']['find']({'raw':_0x4725dd['options']?_0x4725dd[_0x72bf('0x16')][_0x72bf('0x1e')]===undefined?!![]:![]:!![],'where':_0x4725dd[_0x72bf('0x16')]?_0x4725dd[_0x72bf('0x16')][_0x72bf('0x1f')]||null:null,'attributes':_0x4725dd['options']?_0x4725dd[_0x72bf('0x16')][_0x72bf('0x17')]||null:null,'include':_0x4725dd['options']?_0x4725dd[_0x72bf('0x16')][_0x72bf('0x19')]?_[_0x72bf('0x1a')](_0x4725dd[_0x72bf('0x16')][_0x72bf('0x19')],function(_0x2bd13e){return{'model':db[_0x2bd13e[_0x72bf('0x1b')]],'as':_0x2bd13e['as'],'attributes':_0x2bd13e[_0x72bf('0x17')],'include':_0x2bd13e[_0x72bf('0x19')]?_[_0x72bf('0x1a')](_0x2bd13e[_0x72bf('0x19')],function(_0x5000a3){return{'model':db[_0x5000a3[_0x72bf('0x1b')]],'as':_0x5000a3['as'],'attributes':_0x5000a3[_0x72bf('0x17')],'include':_0x5000a3[_0x72bf('0x19')]?_['map'](_0x5000a3[_0x72bf('0x19')],function(_0x3935bf){return{'model':db[_0x3935bf[_0x72bf('0x1b')]],'as':_0x3935bf['as'],'attributes':_0x3935bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x72bf('0x1c')](function(_0x2f4c96){logger[_0x72bf('0xc')](_0x72bf('0x20'),_0x4725dd);logger[_0x72bf('0xe')](_0x72bf('0x20'),_0x4725dd,JSON['stringify'](_0x2f4c96));_0x2e97df(_0x2f4c96);})[_0x72bf('0x1d')](function(_0x1aa9f7){logger['error'](_0x72bf('0x20'),_0x1aa9f7['message'],_0x4725dd);_0x310c35(_0x536fdb[_0x72bf('0x10')](0x1f4,_0x1aa9f7['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1ba9b23..203154a 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 _0x3f8e=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','get','/:id/tags','getTags','post','create','delete','destroy'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3f8e,0xc1));var _0xe3f8=function(_0x1ffd41,_0x5e7f36){_0x1ffd41=_0x1ffd41-0x0;var _0x2ba0eb=_0x3f8e[_0x1ffd41];return _0x2ba0eb;};'use strict';var multer=require('multer');var util=require(_0xe3f8('0x0'));var path=require('path');var timeout=require(_0xe3f8('0x1'));var express=require(_0xe3f8('0x2'));var router=express['Router']();var fs_extra=require(_0xe3f8('0x3'));var auth=require(_0xe3f8('0x4'));var interaction=require(_0xe3f8('0x5'));var config=require(_0xe3f8('0x6'));var controller=require(_0xe3f8('0x7'));router['get']('/',auth[_0xe3f8('0x8')](),controller[_0xe3f8('0x9')]);router['get'](_0xe3f8('0xa'),auth[_0xe3f8('0x8')](),controller['show']);router['get'](_0xe3f8('0xb'),auth[_0xe3f8('0x8')](),controller[_0xe3f8('0xc')]);router['get'](_0xe3f8('0xd'),auth[_0xe3f8('0x8')](),controller['getSubjects']);router['get'](_0xe3f8('0xe'),auth[_0xe3f8('0x8')](),controller[_0xe3f8('0xf')]);router[_0xe3f8('0x10')](_0xe3f8('0x11'),auth[_0xe3f8('0x8')](),controller[_0xe3f8('0x12')]);router[_0xe3f8('0x13')]('/',auth[_0xe3f8('0x8')](),controller[_0xe3f8('0x14')]);router['post'](_0xe3f8('0x11'),auth[_0xe3f8('0x8')](),controller['setTags']);router['put'](_0xe3f8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe3f8('0x15')](_0xe3f8('0xa'),auth[_0xe3f8('0x8')](),controller[_0xe3f8('0x16')]);module[_0xe3f8('0x17')]=router; \ No newline at end of file +var _0x0815=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','/:id/tags','getTags'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0815,0x150));var _0x5081=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0815[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x5081('0x0'));var util=require('util');var path=require(_0x5081('0x1'));var timeout=require(_0x5081('0x2'));var express=require(_0x5081('0x3'));var router=express['Router']();var fs_extra=require(_0x5081('0x4'));var auth=require(_0x5081('0x5'));var interaction=require(_0x5081('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x5081('0x7')]('/',auth[_0x5081('0x8')](),controller[_0x5081('0x9')]);router[_0x5081('0x7')](_0x5081('0xa'),auth[_0x5081('0x8')](),controller['show']);router[_0x5081('0x7')](_0x5081('0xb'),auth[_0x5081('0x8')](),controller['getFields']);router['get'](_0x5081('0xc'),auth[_0x5081('0x8')](),controller['getSubjects']);router[_0x5081('0x7')]('/:id/descriptions',auth[_0x5081('0x8')](),controller[_0x5081('0xd')]);router['get'](_0x5081('0xe'),auth[_0x5081('0x8')](),controller[_0x5081('0xf')]);router[_0x5081('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5081('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x5081('0x11')](_0x5081('0xa'),auth['isAuthenticated'](),controller[_0x5081('0x12')]);router[_0x5081('0x13')](_0x5081('0xa'),auth[_0x5081('0x8')](),controller[_0x5081('0x14')]);module[_0x5081('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 282fcec..202f518 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 _0xc0c0=['sequelize','exports','STRING'];(function(_0x52c42a,_0x24fa3b){var _0x41d97e=function(_0x2d09e7){while(--_0x2d09e7){_0x52c42a['push'](_0x52c42a['shift']());}};_0x41d97e(++_0x24fa3b);}(_0xc0c0,0x129));var _0x0c0c=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xc0c0[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0x0c0c('0x0'));module[_0x0c0c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c0c('0x2')]}}; \ No newline at end of file +var _0x4735=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4735,0x175));var _0x5473=function(_0x292434,_0x9a1d0e){_0x292434=_0x292434-0x0;var _0x3cce65=_0x4735[_0x292434];return _0x3cce65;};'use strict';var Sequelize=require('sequelize');module[_0x5473('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5473('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index dd9cf8c..e11ac08 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 _0x4183=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','getFields','findOne','FreshdeskField','getDescriptions','getTags','Tag','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','offset','count','limit','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','FreshdeskConfiguration','key','map','query'];(function(_0x167eb8,_0x490047){var _0x332e1b=function(_0x2702b7){while(--_0x2702b7){_0x167eb8['push'](_0x167eb8['shift']());}};_0x332e1b(++_0x490047);}(_0x4183,0x1ac));var _0x3418=function(_0x4611d0,_0x2046e8){_0x4611d0=_0x4611d0-0x0;var _0x5c7481=_0x4183[_0x4611d0];return _0x5c7481;};'use strict';var emlformat=require(_0x3418('0x0'));var rimraf=require(_0x3418('0x1'));var zipdir=require(_0x3418('0x2'));var jsonpatch=require(_0x3418('0x3'));var rp=require(_0x3418('0x4'));var moment=require(_0x3418('0x5'));var BPromise=require(_0x3418('0x6'));var Mustache=require(_0x3418('0x7'));var util=require(_0x3418('0x8'));var path=require('path');var sox=require(_0x3418('0x9'));var csv=require(_0x3418('0xa'));var ejs=require(_0x3418('0xb'));var fs=require('fs');var fs_extra=require(_0x3418('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3418('0xa'));var querystring=require(_0x3418('0xd'));var Papa=require(_0x3418('0xe'));var Redis=require(_0x3418('0xf'));var authService=require(_0x3418('0x10'));var qs=require(_0x3418('0x11'));var as=require(_0x3418('0x12'));var hardwareService=require(_0x3418('0x13'));var logger=require(_0x3418('0x14'))(_0x3418('0x15'));var utils=require(_0x3418('0x16'));var config=require(_0x3418('0x17'));var licenseUtil=require(_0x3418('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe122fd,_0x4f86c9){_0x4f86c9=_0x4f86c9||0xcc;return function(_0x1772a2){if(_0x1772a2){return _0xe122fd['sendStatus'](_0x4f86c9);}return _0xe122fd[_0x3418('0x19')](_0x4f86c9)[_0x3418('0x1a')]();};}function respondWithResult(_0x3f8365,_0x154637){_0x154637=_0x154637||0xc8;return function(_0x10d650){if(_0x10d650){return _0x3f8365[_0x3418('0x19')](_0x154637)[_0x3418('0x1b')](_0x10d650);}};}function respondWithFilteredResult(_0x18df85,_0x165239){return function(_0x30052f){if(_0x30052f){var _0x19488f=typeof _0x165239['offset']===_0x3418('0x1c')&&typeof _0x165239['limit']===_0x3418('0x1c');var _0x2d63d5=_0x30052f['count'];var _0x5c796b=_0x19488f?0x0:_0x165239[_0x3418('0x1d')];var _0x32273b=_0x19488f?_0x30052f[_0x3418('0x1e')]:_0x165239[_0x3418('0x1d')]+_0x165239[_0x3418('0x1f')];var _0x53c774;if(_0x32273b>=_0x2d63d5){_0x32273b=_0x2d63d5;_0x53c774=0xc8;}else{_0x53c774=0xce;}_0x18df85[_0x3418('0x19')](_0x53c774);return _0x18df85['set'](_0x3418('0x20'),_0x5c796b+'-'+_0x32273b+'/'+_0x2d63d5)[_0x3418('0x1b')](_0x30052f);}return null;};}function patchUpdates(_0xcd2ae9){return function(_0x554767){try{jsonpatch['apply'](_0x554767,_0xcd2ae9,!![]);}catch(_0x164a80){return BPromise[_0x3418('0x21')](_0x164a80);}return _0x554767[_0x3418('0x22')]();};}function saveUpdates(_0x5cc78d,_0xf4d566){return function(_0x4d62d2){if(_0x4d62d2){return _0x4d62d2[_0x3418('0x23')](_0x5cc78d)[_0x3418('0x24')](function(_0x1edd9d){return _0x1edd9d;});}return null;};}function removeEntity(_0x16455a,_0x2c3908){return function(_0xcef199){if(_0xcef199){return _0xcef199['destroy']()[_0x3418('0x24')](function(){_0x16455a[_0x3418('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa7679,_0x53e032){return function(_0x31ca80){if(!_0x31ca80){_0xa7679[_0x3418('0x25')](0x194);}return _0x31ca80;};}function handleError(_0x2040b0,_0x2617ca){_0x2617ca=_0x2617ca||0x1f4;return function(_0x3df359){logger[_0x3418('0x26')](_0x3df359['stack']);if(_0x3df359[_0x3418('0x27')]){delete _0x3df359[_0x3418('0x27')];}_0x2040b0[_0x3418('0x19')](_0x2617ca)[_0x3418('0x28')](_0x3df359);};}exports[_0x3418('0x29')]=function(_0x2f2730,_0x381cb9){var _0x1bd43e={},_0x3448dd={},_0x1abe9e={'count':0x0,'rows':[]};var _0x595db2=_['map'](db[_0x3418('0x2a')]['rawAttributes'],function(_0x1b06f7){return{'name':_0x1b06f7['fieldName'],'type':_0x1b06f7['type'][_0x3418('0x2b')]};});_0x3448dd['model']=_[_0x3418('0x2c')](_0x595db2,_0x3418('0x27'));_0x3448dd[_0x3418('0x2d')]=_[_0x3418('0x2e')](_0x2f2730[_0x3418('0x2d')]);_0x3448dd[_0x3418('0x2f')]=_[_0x3418('0x30')](_0x3448dd[_0x3418('0x31')],_0x3448dd[_0x3418('0x2d')]);_0x1bd43e[_0x3418('0x32')]=_[_0x3418('0x30')](_0x3448dd[_0x3418('0x31')],qs[_0x3418('0x33')](_0x2f2730[_0x3418('0x2d')][_0x3418('0x33')]));_0x1bd43e[_0x3418('0x32')]=_0x1bd43e[_0x3418('0x32')][_0x3418('0x34')]?_0x1bd43e[_0x3418('0x32')]:_0x3448dd[_0x3418('0x31')];if(!_0x2f2730[_0x3418('0x2d')][_0x3418('0x35')](_0x3418('0x36'))){_0x1bd43e['limit']=qs[_0x3418('0x1f')](_0x2f2730[_0x3418('0x2d')][_0x3418('0x1f')]);_0x1bd43e[_0x3418('0x1d')]=qs[_0x3418('0x1d')](_0x2f2730[_0x3418('0x2d')][_0x3418('0x1d')]);}_0x1bd43e[_0x3418('0x37')]=qs[_0x3418('0x38')](_0x2f2730['query']['sort']);_0x1bd43e[_0x3418('0x39')]=qs['filters'](_[_0x3418('0x3a')](_0x2f2730[_0x3418('0x2d')],_0x3448dd['filters']),_0x595db2);if(_0x2f2730[_0x3418('0x2d')][_0x3418('0x3b')]){_0x1bd43e[_0x3418('0x39')]=_[_0x3418('0x3c')](_0x1bd43e[_0x3418('0x39')],{'$or':_[_0x3418('0x2c')](_0x595db2,function(_0x47e925){if(_0x47e925['type']!==_0x3418('0x3d')){var _0x35a3ae={};_0x35a3ae[_0x47e925[_0x3418('0x27')]]={'$like':'%'+_0x2f2730[_0x3418('0x2d')][_0x3418('0x3b')]+'%'};return _0x35a3ae;}})});}_0x1bd43e=_[_0x3418('0x3c')]({},_0x1bd43e,_0x2f2730[_0x3418('0x3e')]);var _0x42ddf7={'where':_0x1bd43e['where']};return db[_0x3418('0x2a')][_0x3418('0x1e')](_0x42ddf7)['then'](function(_0x282d0d){_0x1abe9e[_0x3418('0x1e')]=_0x282d0d;if(_0x2f2730[_0x3418('0x2d')][_0x3418('0x3f')]){_0x1bd43e['include']=[{'all':!![]}];}return db[_0x3418('0x2a')]['findAll'](_0x1bd43e);})[_0x3418('0x24')](function(_0xf473c){_0x1abe9e[_0x3418('0x40')]=_0xf473c;return _0x1abe9e;})[_0x3418('0x24')](respondWithFilteredResult(_0x381cb9,_0x1bd43e))[_0x3418('0x41')](handleError(_0x381cb9,null));};exports[_0x3418('0x42')]=function(_0x36c99a,_0xae2766){var _0x316fea={'raw':![],'where':{'id':_0x36c99a[_0x3418('0x43')]['id']}},_0x27eac9={};_0x27eac9[_0x3418('0x31')]=_[_0x3418('0x2e')](db[_0x3418('0x2a')][_0x3418('0x44')]);_0x27eac9[_0x3418('0x2d')]=_[_0x3418('0x2e')](_0x36c99a[_0x3418('0x2d')]);_0x27eac9[_0x3418('0x2f')]=_[_0x3418('0x30')](_0x27eac9['model'],_0x27eac9[_0x3418('0x2d')]);_0x316fea['attributes']=_['intersection'](_0x27eac9[_0x3418('0x31')],qs[_0x3418('0x33')](_0x36c99a[_0x3418('0x2d')][_0x3418('0x33')]));_0x316fea[_0x3418('0x32')]=_0x316fea[_0x3418('0x32')][_0x3418('0x34')]?_0x316fea['attributes']:_0x27eac9[_0x3418('0x31')];if(_0x36c99a[_0x3418('0x2d')][_0x3418('0x3f')]){_0x316fea[_0x3418('0x45')]=[{'all':!![]}];}_0x316fea=_[_0x3418('0x3c')]({},_0x316fea,_0x36c99a[_0x3418('0x3e')]);return db[_0x3418('0x2a')][_0x3418('0x46')](_0x316fea)['then'](handleEntityNotFound(_0xae2766,null))[_0x3418('0x24')](respondWithResult(_0xae2766,null))[_0x3418('0x41')](handleError(_0xae2766,null));};exports['create']=function(_0x4fe599,_0x9aef4f){return db['FreshdeskConfiguration'][_0x3418('0x47')](_0x4fe599[_0x3418('0x48')],{})['then'](respondWithResult(_0x9aef4f,0xc9))['catch'](handleError(_0x9aef4f,null));};exports[_0x3418('0x23')]=function(_0x4033c4,_0xda959c){if(_0x4033c4[_0x3418('0x48')]['id']){delete _0x4033c4[_0x3418('0x48')]['id'];}return db[_0x3418('0x2a')]['find']({'where':{'id':_0x4033c4['params']['id']}})[_0x3418('0x24')](handleEntityNotFound(_0xda959c,null))[_0x3418('0x24')](saveUpdates(_0x4033c4[_0x3418('0x48')],null))[_0x3418('0x24')](respondWithResult(_0xda959c,null))[_0x3418('0x41')](handleError(_0xda959c,null));};exports['destroy']=function(_0x6aa8b5,_0x1267c2){return db[_0x3418('0x2a')][_0x3418('0x46')]({'where':{'id':_0x6aa8b5[_0x3418('0x43')]['id']}})[_0x3418('0x24')](handleEntityNotFound(_0x1267c2,null))[_0x3418('0x24')](removeEntity(_0x1267c2,null))[_0x3418('0x41')](handleError(_0x1267c2,null));};exports[_0x3418('0x49')]=function(_0x1ad5a8,_0x107c00,_0x1ba142){var _0x4e8e99={};var _0x1d3ecf={};var _0x466793;var _0x4ae89a;return db[_0x3418('0x2a')]['findOne']({'where':{'id':_0x1ad5a8[_0x3418('0x43')]['id']}})[_0x3418('0x24')](handleEntityNotFound(_0x107c00,null))['then'](function(_0x3a435d){if(_0x3a435d){_0x466793=_0x3a435d;_0x1d3ecf['model']=_[_0x3418('0x2e')](db['FreshdeskField']['rawAttributes']);_0x1d3ecf[_0x3418('0x2d')]=_[_0x3418('0x2e')](_0x1ad5a8['query']);_0x1d3ecf[_0x3418('0x2f')]=_[_0x3418('0x30')](_0x1d3ecf[_0x3418('0x31')],_0x1d3ecf[_0x3418('0x2d')]);_0x4e8e99[_0x3418('0x32')]=_[_0x3418('0x30')](_0x1d3ecf[_0x3418('0x31')],qs[_0x3418('0x33')](_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x33')]));_0x4e8e99[_0x3418('0x32')]=_0x4e8e99[_0x3418('0x32')]['length']?_0x4e8e99[_0x3418('0x32')]:_0x1d3ecf['model'];_0x4e8e99[_0x3418('0x37')]=qs[_0x3418('0x38')](_0x1ad5a8['query'][_0x3418('0x38')]);_0x4e8e99[_0x3418('0x39')]=qs[_0x3418('0x2f')](_[_0x3418('0x3a')](_0x1ad5a8[_0x3418('0x2d')],_0x1d3ecf[_0x3418('0x2f')]));if(_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x3b')]){_0x4e8e99[_0x3418('0x39')]=_[_0x3418('0x3c')](_0x4e8e99['where'],{'$or':_['map'](_0x4e8e99[_0x3418('0x32')],function(_0x6c6b7b){var _0x1af10b={};_0x1af10b[_0x6c6b7b]={'$like':'%'+_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x3b')]+'%'};return _0x1af10b;})});}_0x4e8e99=_[_0x3418('0x3c')]({},_0x4e8e99,_0x1ad5a8[_0x3418('0x3e')]);return _0x466793[_0x3418('0x49')](_0x4e8e99);}})[_0x3418('0x24')](function(_0x161527){if(_0x161527){_0x4ae89a=_0x161527[_0x3418('0x34')];if(!_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x35')](_0x3418('0x36'))){_0x4e8e99[_0x3418('0x1f')]=qs[_0x3418('0x1f')](_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x1f')]);_0x4e8e99[_0x3418('0x1d')]=qs[_0x3418('0x1d')](_0x1ad5a8[_0x3418('0x2d')][_0x3418('0x1d')]);}return _0x466793[_0x3418('0x49')](_0x4e8e99);}})[_0x3418('0x24')](function(_0x9f726d){if(_0x9f726d){return _0x9f726d?{'count':_0x4ae89a,'rows':_0x9f726d}:null;}})['then'](respondWithResult(_0x107c00,null))[_0x3418('0x41')](handleError(_0x107c00,null));};exports['getSubjects']=function(_0x4de7b6,_0x364234,_0x3c43c4){var _0xba19fe={};var _0x29dda5={};var _0x5502a7;var _0x66a958;return db[_0x3418('0x2a')][_0x3418('0x4a')]({'where':{'id':_0x4de7b6[_0x3418('0x43')]['id']}})[_0x3418('0x24')](handleEntityNotFound(_0x364234,null))['then'](function(_0x3e0e25){if(_0x3e0e25){_0x5502a7=_0x3e0e25;_0x29dda5[_0x3418('0x31')]=_[_0x3418('0x2e')](db[_0x3418('0x4b')][_0x3418('0x44')]);_0x29dda5[_0x3418('0x2d')]=_['keys'](_0x4de7b6[_0x3418('0x2d')]);_0x29dda5['filters']=_[_0x3418('0x30')](_0x29dda5[_0x3418('0x31')],_0x29dda5['query']);_0xba19fe[_0x3418('0x32')]=_[_0x3418('0x30')](_0x29dda5['model'],qs[_0x3418('0x33')](_0x4de7b6[_0x3418('0x2d')][_0x3418('0x33')]));_0xba19fe['attributes']=_0xba19fe[_0x3418('0x32')][_0x3418('0x34')]?_0xba19fe['attributes']:_0x29dda5['model'];_0xba19fe[_0x3418('0x37')]=qs[_0x3418('0x38')](_0x4de7b6[_0x3418('0x2d')][_0x3418('0x38')]);_0xba19fe[_0x3418('0x39')]=qs[_0x3418('0x2f')](_[_0x3418('0x3a')](_0x4de7b6['query'],_0x29dda5[_0x3418('0x2f')]));if(_0x4de7b6[_0x3418('0x2d')][_0x3418('0x3b')]){_0xba19fe[_0x3418('0x39')]=_['merge'](_0xba19fe[_0x3418('0x39')],{'$or':_[_0x3418('0x2c')](_0xba19fe[_0x3418('0x32')],function(_0x383445){var _0x4893ff={};_0x4893ff[_0x383445]={'$like':'%'+_0x4de7b6[_0x3418('0x2d')]['filter']+'%'};return _0x4893ff;})});}_0xba19fe=_[_0x3418('0x3c')]({},_0xba19fe,_0x4de7b6['options']);return _0x5502a7['getSubjects'](_0xba19fe);}})[_0x3418('0x24')](function(_0x472633){if(_0x472633){_0x66a958=_0x472633[_0x3418('0x34')];if(!_0x4de7b6[_0x3418('0x2d')][_0x3418('0x35')](_0x3418('0x36'))){_0xba19fe['limit']=qs[_0x3418('0x1f')](_0x4de7b6[_0x3418('0x2d')][_0x3418('0x1f')]);_0xba19fe[_0x3418('0x1d')]=qs[_0x3418('0x1d')](_0x4de7b6[_0x3418('0x2d')][_0x3418('0x1d')]);}return _0x5502a7['getSubjects'](_0xba19fe);}})[_0x3418('0x24')](function(_0x4d43bd){if(_0x4d43bd){return _0x4d43bd?{'count':_0x66a958,'rows':_0x4d43bd}:null;}})['then'](respondWithResult(_0x364234,null))['catch'](handleError(_0x364234,null));};exports[_0x3418('0x4c')]=function(_0xf67f42,_0x4a7b7e,_0x186d1e){var _0x2a3b85={};var _0x4eeb73={};var _0x59c933;var _0x3293fa;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xf67f42[_0x3418('0x43')]['id']}})[_0x3418('0x24')](handleEntityNotFound(_0x4a7b7e,null))[_0x3418('0x24')](function(_0x23a87c){if(_0x23a87c){_0x59c933=_0x23a87c;_0x4eeb73['model']=_['keys'](db[_0x3418('0x4b')]['rawAttributes']);_0x4eeb73[_0x3418('0x2d')]=_[_0x3418('0x2e')](_0xf67f42['query']);_0x4eeb73[_0x3418('0x2f')]=_[_0x3418('0x30')](_0x4eeb73['model'],_0x4eeb73[_0x3418('0x2d')]);_0x2a3b85[_0x3418('0x32')]=_[_0x3418('0x30')](_0x4eeb73[_0x3418('0x31')],qs[_0x3418('0x33')](_0xf67f42[_0x3418('0x2d')][_0x3418('0x33')]));_0x2a3b85[_0x3418('0x32')]=_0x2a3b85[_0x3418('0x32')][_0x3418('0x34')]?_0x2a3b85['attributes']:_0x4eeb73[_0x3418('0x31')];_0x2a3b85[_0x3418('0x37')]=qs[_0x3418('0x38')](_0xf67f42[_0x3418('0x2d')][_0x3418('0x38')]);_0x2a3b85['where']=qs['filters'](_[_0x3418('0x3a')](_0xf67f42[_0x3418('0x2d')],_0x4eeb73[_0x3418('0x2f')]));if(_0xf67f42['query']['filter']){_0x2a3b85[_0x3418('0x39')]=_[_0x3418('0x3c')](_0x2a3b85[_0x3418('0x39')],{'$or':_[_0x3418('0x2c')](_0x2a3b85[_0x3418('0x32')],function(_0x481586){var _0x44b241={};_0x44b241[_0x481586]={'$like':'%'+_0xf67f42[_0x3418('0x2d')]['filter']+'%'};return _0x44b241;})});}_0x2a3b85=_[_0x3418('0x3c')]({},_0x2a3b85,_0xf67f42['options']);return _0x59c933[_0x3418('0x4c')](_0x2a3b85);}})[_0x3418('0x24')](function(_0x108c6e){if(_0x108c6e){_0x3293fa=_0x108c6e[_0x3418('0x34')];if(!_0xf67f42[_0x3418('0x2d')][_0x3418('0x35')](_0x3418('0x36'))){_0x2a3b85[_0x3418('0x1f')]=qs[_0x3418('0x1f')](_0xf67f42[_0x3418('0x2d')][_0x3418('0x1f')]);_0x2a3b85['offset']=qs[_0x3418('0x1d')](_0xf67f42[_0x3418('0x2d')][_0x3418('0x1d')]);}return _0x59c933[_0x3418('0x4c')](_0x2a3b85);}})[_0x3418('0x24')](function(_0x1047d9){if(_0x1047d9){return _0x1047d9?{'count':_0x3293fa,'rows':_0x1047d9}:null;}})['then'](respondWithResult(_0x4a7b7e,null))[_0x3418('0x41')](handleError(_0x4a7b7e,null));};exports[_0x3418('0x4d')]=function(_0x2a3c62,_0x4d1401,_0x11353d){var _0x144ee9={};var _0x2f143c={};var _0x232d06;var _0x1fffb8;return db[_0x3418('0x2a')][_0x3418('0x4a')]({'where':{'id':_0x2a3c62[_0x3418('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d1401,null))[_0x3418('0x24')](function(_0x302b11){if(_0x302b11){_0x232d06=_0x302b11;_0x2f143c[_0x3418('0x31')]=_[_0x3418('0x2e')](db[_0x3418('0x4e')][_0x3418('0x44')]);_0x2f143c[_0x3418('0x2d')]=_[_0x3418('0x2e')](_0x2a3c62[_0x3418('0x2d')]);_0x2f143c[_0x3418('0x2f')]=_[_0x3418('0x30')](_0x2f143c[_0x3418('0x31')],_0x2f143c[_0x3418('0x2d')]);_0x144ee9[_0x3418('0x32')]=_[_0x3418('0x30')](_0x2f143c[_0x3418('0x31')],qs[_0x3418('0x33')](_0x2a3c62[_0x3418('0x2d')]['fields']));_0x144ee9[_0x3418('0x32')]=_0x144ee9[_0x3418('0x32')]['length']?_0x144ee9[_0x3418('0x32')]:_0x2f143c[_0x3418('0x31')];_0x144ee9[_0x3418('0x37')]=qs[_0x3418('0x38')](_0x2a3c62[_0x3418('0x2d')][_0x3418('0x38')]);_0x144ee9[_0x3418('0x39')]=qs[_0x3418('0x2f')](_[_0x3418('0x3a')](_0x2a3c62[_0x3418('0x2d')],_0x2f143c[_0x3418('0x2f')]));if(_0x2a3c62[_0x3418('0x2d')][_0x3418('0x3b')]){_0x144ee9[_0x3418('0x39')]=_['merge'](_0x144ee9[_0x3418('0x39')],{'$or':_[_0x3418('0x2c')](_0x144ee9[_0x3418('0x32')],function(_0x1dabca){var _0x11420a={};_0x11420a[_0x1dabca]={'$like':'%'+_0x2a3c62['query'][_0x3418('0x3b')]+'%'};return _0x11420a;})});}_0x144ee9=_['merge']({},_0x144ee9,_0x2a3c62[_0x3418('0x3e')]);return _0x232d06[_0x3418('0x4d')](_0x144ee9);}})[_0x3418('0x24')](function(_0x58caa9){if(_0x58caa9){_0x1fffb8=_0x58caa9[_0x3418('0x34')];if(!_0x2a3c62[_0x3418('0x2d')][_0x3418('0x35')](_0x3418('0x36'))){_0x144ee9[_0x3418('0x1f')]=qs['limit'](_0x2a3c62['query'][_0x3418('0x1f')]);_0x144ee9[_0x3418('0x1d')]=qs[_0x3418('0x1d')](_0x2a3c62['query'][_0x3418('0x1d')]);}return _0x232d06[_0x3418('0x4d')](_0x144ee9);}})[_0x3418('0x24')](function(_0x14ee49){if(_0x14ee49){return _0x14ee49?{'count':_0x1fffb8,'rows':_0x14ee49}:null;}})[_0x3418('0x24')](respondWithResult(_0x4d1401,null))[_0x3418('0x41')](handleError(_0x4d1401,null));};exports['setTags']=function(_0x212e0a,_0x5ea7d2,_0x2fc905){if(_0x212e0a['body']['id']){delete _0x212e0a[_0x3418('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x3418('0x4a')]({'where':{'id':_0x212e0a[_0x3418('0x43')]['id']}})[_0x3418('0x24')](handleEntityNotFound(_0x5ea7d2,null))['then'](function(_0x7e5b5e){if(_0x7e5b5e){return _0x7e5b5e['setTags'](_0x212e0a[_0x3418('0x48')]['ids']||[]);}return null;})[_0x3418('0x24')](respondWithResult(_0x5ea7d2,null))[_0x3418('0x41')](handleError(_0x5ea7d2,null));}; \ No newline at end of file +var _0x5806=['bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','type','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','getFields','findOne','FreshdeskField','order','filter','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x5806,0xa9));var _0x6580=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x5806[_0x30f030];return _0xf7614f;};'use strict';var emlformat=require(_0x6580('0x0'));var rimraf=require(_0x6580('0x1'));var zipdir=require(_0x6580('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6580('0x3'));var moment=require(_0x6580('0x4'));var BPromise=require(_0x6580('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6580('0x6'));var sox=require(_0x6580('0x7'));var csv=require('to-csv');var ejs=require(_0x6580('0x8'));var fs=require('fs');var fs_extra=require(_0x6580('0x9'));var _=require(_0x6580('0xa'));var squel=require(_0x6580('0xb'));var crypto=require('crypto');var jsforce=require(_0x6580('0xc'));var deskjs=require(_0x6580('0xd'));var toCsv=require(_0x6580('0xe'));var querystring=require(_0x6580('0xf'));var Papa=require(_0x6580('0x10'));var Redis=require(_0x6580('0x11'));var authService=require(_0x6580('0x12'));var qs=require(_0x6580('0x13'));var as=require(_0x6580('0x14'));var hardwareService=require(_0x6580('0x15'));var logger=require(_0x6580('0x16'))(_0x6580('0x17'));var utils=require(_0x6580('0x18'));var config=require(_0x6580('0x19'));var licenseUtil=require(_0x6580('0x1a'));var db=require(_0x6580('0x1b'))['db'];function respondWithStatusCode(_0x2356e0,_0x327a93){_0x327a93=_0x327a93||0xcc;return function(_0x35c583){if(_0x35c583){return _0x2356e0['sendStatus'](_0x327a93);}return _0x2356e0[_0x6580('0x1c')](_0x327a93)[_0x6580('0x1d')]();};}function respondWithResult(_0x343e69,_0x4bb6f8){_0x4bb6f8=_0x4bb6f8||0xc8;return function(_0x3827c3){if(_0x3827c3){return _0x343e69['status'](_0x4bb6f8)[_0x6580('0x1e')](_0x3827c3);}};}function respondWithFilteredResult(_0x245386,_0xff5725){return function(_0xa492a8){if(_0xa492a8){var _0x4b3a9d=typeof _0xff5725[_0x6580('0x1f')]==='undefined'&&typeof _0xff5725[_0x6580('0x20')]==='undefined';var _0x5ee936=_0xa492a8['count'];var _0x17750d=_0x4b3a9d?0x0:_0xff5725['offset'];var _0x45f908=_0x4b3a9d?_0xa492a8[_0x6580('0x21')]:_0xff5725[_0x6580('0x1f')]+_0xff5725[_0x6580('0x20')];var _0x560216;if(_0x45f908>=_0x5ee936){_0x45f908=_0x5ee936;_0x560216=0xc8;}else{_0x560216=0xce;}_0x245386[_0x6580('0x1c')](_0x560216);return _0x245386[_0x6580('0x22')]('Content-Range',_0x17750d+'-'+_0x45f908+'/'+_0x5ee936)[_0x6580('0x1e')](_0xa492a8);}return null;};}function patchUpdates(_0x117158){return function(_0x21ae38){try{jsonpatch[_0x6580('0x23')](_0x21ae38,_0x117158,!![]);}catch(_0x1dab7c){return BPromise[_0x6580('0x24')](_0x1dab7c);}return _0x21ae38[_0x6580('0x25')]();};}function saveUpdates(_0x20d57c,_0x52056f){return function(_0x345126){if(_0x345126){return _0x345126[_0x6580('0x26')](_0x20d57c)[_0x6580('0x27')](function(_0x23afb8){return _0x23afb8;});}return null;};}function removeEntity(_0x2d7c4d,_0x2dd20e){return function(_0x1f4a20){if(_0x1f4a20){return _0x1f4a20[_0x6580('0x28')]()['then'](function(){_0x2d7c4d['status'](0xcc)[_0x6580('0x1d')]();});}};}function handleEntityNotFound(_0x493c3f,_0x53b980){return function(_0x3f3c36){if(!_0x3f3c36){_0x493c3f[_0x6580('0x29')](0x194);}return _0x3f3c36;};}function handleError(_0x4e9065,_0x5bdcfc){_0x5bdcfc=_0x5bdcfc||0x1f4;return function(_0x522692){logger['error'](_0x522692['stack']);if(_0x522692[_0x6580('0x2a')]){delete _0x522692['name'];}_0x4e9065[_0x6580('0x1c')](_0x5bdcfc)['send'](_0x522692);};}exports[_0x6580('0x2b')]=function(_0x323098,_0x292dde){var _0x3436ef={},_0x462830={},_0xf3f86={'count':0x0,'rows':[]};var _0x18b522=_[_0x6580('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x161a6f){return{'name':_0x161a6f[_0x6580('0x2d')],'type':_0x161a6f['type'][_0x6580('0x2e')]};});_0x462830[_0x6580('0x2f')]=_[_0x6580('0x2c')](_0x18b522,_0x6580('0x2a'));_0x462830[_0x6580('0x30')]=_[_0x6580('0x31')](_0x323098[_0x6580('0x30')]);_0x462830[_0x6580('0x32')]=_[_0x6580('0x33')](_0x462830[_0x6580('0x2f')],_0x462830[_0x6580('0x30')]);_0x3436ef[_0x6580('0x34')]=_[_0x6580('0x33')](_0x462830[_0x6580('0x2f')],qs['fields'](_0x323098[_0x6580('0x30')][_0x6580('0x35')]));_0x3436ef[_0x6580('0x34')]=_0x3436ef['attributes'][_0x6580('0x36')]?_0x3436ef[_0x6580('0x34')]:_0x462830[_0x6580('0x2f')];if(!_0x323098[_0x6580('0x30')]['hasOwnProperty'](_0x6580('0x37'))){_0x3436ef['limit']=qs['limit'](_0x323098['query'][_0x6580('0x20')]);_0x3436ef[_0x6580('0x1f')]=qs['offset'](_0x323098[_0x6580('0x30')][_0x6580('0x1f')]);}_0x3436ef['order']=qs['sort'](_0x323098[_0x6580('0x30')][_0x6580('0x38')]);_0x3436ef[_0x6580('0x39')]=qs[_0x6580('0x32')](_[_0x6580('0x3a')](_0x323098[_0x6580('0x30')],_0x462830[_0x6580('0x32')]),_0x18b522);if(_0x323098[_0x6580('0x30')]['filter']){_0x3436ef['where']=_['merge'](_0x3436ef[_0x6580('0x39')],{'$or':_['map'](_0x18b522,function(_0xdf04c4){if(_0xdf04c4[_0x6580('0x3b')]!==_0x6580('0x3c')){var _0x1a3fdc={};_0x1a3fdc[_0xdf04c4[_0x6580('0x2a')]]={'$like':'%'+_0x323098['query']['filter']+'%'};return _0x1a3fdc;}})});}_0x3436ef=_['merge']({},_0x3436ef,_0x323098[_0x6580('0x3d')]);var _0x1eb94c={'where':_0x3436ef[_0x6580('0x39')]};return db['FreshdeskConfiguration'][_0x6580('0x21')](_0x1eb94c)[_0x6580('0x27')](function(_0xe09d8e){_0xf3f86[_0x6580('0x21')]=_0xe09d8e;if(_0x323098[_0x6580('0x30')][_0x6580('0x3e')]){_0x3436ef[_0x6580('0x3f')]=[{'all':!![]}];}return db[_0x6580('0x40')][_0x6580('0x41')](_0x3436ef);})[_0x6580('0x27')](function(_0x3f0354){_0xf3f86[_0x6580('0x42')]=_0x3f0354;return _0xf3f86;})['then'](respondWithFilteredResult(_0x292dde,_0x3436ef))[_0x6580('0x43')](handleError(_0x292dde,null));};exports[_0x6580('0x44')]=function(_0x4afa18,_0x45c1cb){var _0x544ff8={'raw':![],'where':{'id':_0x4afa18[_0x6580('0x45')]['id']}},_0x117a97={};_0x117a97['model']=_[_0x6580('0x31')](db[_0x6580('0x40')][_0x6580('0x46')]);_0x117a97[_0x6580('0x30')]=_[_0x6580('0x31')](_0x4afa18['query']);_0x117a97[_0x6580('0x32')]=_[_0x6580('0x33')](_0x117a97[_0x6580('0x2f')],_0x117a97['query']);_0x544ff8['attributes']=_[_0x6580('0x33')](_0x117a97[_0x6580('0x2f')],qs[_0x6580('0x35')](_0x4afa18[_0x6580('0x30')][_0x6580('0x35')]));_0x544ff8[_0x6580('0x34')]=_0x544ff8[_0x6580('0x34')][_0x6580('0x36')]?_0x544ff8[_0x6580('0x34')]:_0x117a97[_0x6580('0x2f')];if(_0x4afa18['query'][_0x6580('0x3e')]){_0x544ff8[_0x6580('0x3f')]=[{'all':!![]}];}_0x544ff8=_[_0x6580('0x47')]({},_0x544ff8,_0x4afa18['options']);return db[_0x6580('0x40')][_0x6580('0x48')](_0x544ff8)[_0x6580('0x27')](handleEntityNotFound(_0x45c1cb,null))[_0x6580('0x27')](respondWithResult(_0x45c1cb,null))[_0x6580('0x43')](handleError(_0x45c1cb,null));};exports[_0x6580('0x49')]=function(_0x4cf640,_0x2e979c){return db[_0x6580('0x40')][_0x6580('0x49')](_0x4cf640[_0x6580('0x4a')],{})['then'](respondWithResult(_0x2e979c,0xc9))['catch'](handleError(_0x2e979c,null));};exports[_0x6580('0x26')]=function(_0x52fda8,_0x1e1f9b){if(_0x52fda8[_0x6580('0x4a')]['id']){delete _0x52fda8[_0x6580('0x4a')]['id'];}return db[_0x6580('0x40')]['find']({'where':{'id':_0x52fda8[_0x6580('0x45')]['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x1e1f9b,null))['then'](saveUpdates(_0x52fda8[_0x6580('0x4a')],null))[_0x6580('0x27')](respondWithResult(_0x1e1f9b,null))[_0x6580('0x43')](handleError(_0x1e1f9b,null));};exports[_0x6580('0x28')]=function(_0x4a1c05,_0x2e484d){return db['FreshdeskConfiguration'][_0x6580('0x48')]({'where':{'id':_0x4a1c05[_0x6580('0x45')]['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x2e484d,null))[_0x6580('0x27')](removeEntity(_0x2e484d,null))[_0x6580('0x43')](handleError(_0x2e484d,null));};exports[_0x6580('0x4b')]=function(_0x26b43c,_0x2576e7,_0x4e9a1f){var _0x1477b1={};var _0x34de2d={};var _0x53bb53;var _0x11aba1;return db[_0x6580('0x40')][_0x6580('0x4c')]({'where':{'id':_0x26b43c[_0x6580('0x45')]['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x2576e7,null))['then'](function(_0x3762d5){if(_0x3762d5){_0x53bb53=_0x3762d5;_0x34de2d['model']=_[_0x6580('0x31')](db[_0x6580('0x4d')][_0x6580('0x46')]);_0x34de2d[_0x6580('0x30')]=_[_0x6580('0x31')](_0x26b43c[_0x6580('0x30')]);_0x34de2d[_0x6580('0x32')]=_[_0x6580('0x33')](_0x34de2d[_0x6580('0x2f')],_0x34de2d[_0x6580('0x30')]);_0x1477b1[_0x6580('0x34')]=_[_0x6580('0x33')](_0x34de2d[_0x6580('0x2f')],qs['fields'](_0x26b43c['query'][_0x6580('0x35')]));_0x1477b1[_0x6580('0x34')]=_0x1477b1[_0x6580('0x34')][_0x6580('0x36')]?_0x1477b1[_0x6580('0x34')]:_0x34de2d[_0x6580('0x2f')];_0x1477b1[_0x6580('0x4e')]=qs[_0x6580('0x38')](_0x26b43c['query'][_0x6580('0x38')]);_0x1477b1[_0x6580('0x39')]=qs['filters'](_['pick'](_0x26b43c['query'],_0x34de2d[_0x6580('0x32')]));if(_0x26b43c['query'][_0x6580('0x4f')]){_0x1477b1[_0x6580('0x39')]=_[_0x6580('0x47')](_0x1477b1[_0x6580('0x39')],{'$or':_[_0x6580('0x2c')](_0x1477b1[_0x6580('0x34')],function(_0x59ff64){var _0xf94740={};_0xf94740[_0x59ff64]={'$like':'%'+_0x26b43c['query'][_0x6580('0x4f')]+'%'};return _0xf94740;})});}_0x1477b1=_[_0x6580('0x47')]({},_0x1477b1,_0x26b43c[_0x6580('0x3d')]);return _0x53bb53[_0x6580('0x4b')](_0x1477b1);}})['then'](function(_0x229588){if(_0x229588){_0x11aba1=_0x229588['length'];if(!_0x26b43c['query'][_0x6580('0x50')](_0x6580('0x37'))){_0x1477b1[_0x6580('0x20')]=qs[_0x6580('0x20')](_0x26b43c[_0x6580('0x30')][_0x6580('0x20')]);_0x1477b1['offset']=qs[_0x6580('0x1f')](_0x26b43c[_0x6580('0x30')][_0x6580('0x1f')]);}return _0x53bb53[_0x6580('0x4b')](_0x1477b1);}})[_0x6580('0x27')](function(_0x101579){if(_0x101579){return _0x101579?{'count':_0x11aba1,'rows':_0x101579}:null;}})['then'](respondWithResult(_0x2576e7,null))[_0x6580('0x43')](handleError(_0x2576e7,null));};exports['getSubjects']=function(_0x25ca93,_0x432338,_0x5c6304){var _0x2e507b={};var _0x2ec8d7={};var _0x335e86;var _0x51f5b3;return db['FreshdeskConfiguration'][_0x6580('0x4c')]({'where':{'id':_0x25ca93[_0x6580('0x45')]['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x432338,null))[_0x6580('0x27')](function(_0x5c7ada){if(_0x5c7ada){_0x335e86=_0x5c7ada;_0x2ec8d7['model']=_[_0x6580('0x31')](db['FreshdeskField'][_0x6580('0x46')]);_0x2ec8d7[_0x6580('0x30')]=_[_0x6580('0x31')](_0x25ca93[_0x6580('0x30')]);_0x2ec8d7[_0x6580('0x32')]=_[_0x6580('0x33')](_0x2ec8d7[_0x6580('0x2f')],_0x2ec8d7['query']);_0x2e507b[_0x6580('0x34')]=_[_0x6580('0x33')](_0x2ec8d7[_0x6580('0x2f')],qs[_0x6580('0x35')](_0x25ca93[_0x6580('0x30')][_0x6580('0x35')]));_0x2e507b[_0x6580('0x34')]=_0x2e507b['attributes'][_0x6580('0x36')]?_0x2e507b[_0x6580('0x34')]:_0x2ec8d7['model'];_0x2e507b[_0x6580('0x4e')]=qs['sort'](_0x25ca93['query'][_0x6580('0x38')]);_0x2e507b[_0x6580('0x39')]=qs['filters'](_['pick'](_0x25ca93[_0x6580('0x30')],_0x2ec8d7[_0x6580('0x32')]));if(_0x25ca93['query'][_0x6580('0x4f')]){_0x2e507b['where']=_[_0x6580('0x47')](_0x2e507b[_0x6580('0x39')],{'$or':_[_0x6580('0x2c')](_0x2e507b['attributes'],function(_0x35194a){var _0x4095ee={};_0x4095ee[_0x35194a]={'$like':'%'+_0x25ca93['query'][_0x6580('0x4f')]+'%'};return _0x4095ee;})});}_0x2e507b=_[_0x6580('0x47')]({},_0x2e507b,_0x25ca93['options']);return _0x335e86[_0x6580('0x51')](_0x2e507b);}})[_0x6580('0x27')](function(_0x528771){if(_0x528771){_0x51f5b3=_0x528771[_0x6580('0x36')];if(!_0x25ca93[_0x6580('0x30')][_0x6580('0x50')]('nolimit')){_0x2e507b['limit']=qs[_0x6580('0x20')](_0x25ca93[_0x6580('0x30')][_0x6580('0x20')]);_0x2e507b[_0x6580('0x1f')]=qs['offset'](_0x25ca93['query']['offset']);}return _0x335e86['getSubjects'](_0x2e507b);}})[_0x6580('0x27')](function(_0x120109){if(_0x120109){return _0x120109?{'count':_0x51f5b3,'rows':_0x120109}:null;}})[_0x6580('0x27')](respondWithResult(_0x432338,null))[_0x6580('0x43')](handleError(_0x432338,null));};exports[_0x6580('0x52')]=function(_0x1aa259,_0x57a92e,_0x350d5a){var _0x2d871f={};var _0x561878={};var _0x5fe4bb;var _0x4b3650;return db[_0x6580('0x40')]['findOne']({'where':{'id':_0x1aa259['params']['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x57a92e,null))[_0x6580('0x27')](function(_0x49b532){if(_0x49b532){_0x5fe4bb=_0x49b532;_0x561878[_0x6580('0x2f')]=_[_0x6580('0x31')](db['FreshdeskField'][_0x6580('0x46')]);_0x561878[_0x6580('0x30')]=_[_0x6580('0x31')](_0x1aa259['query']);_0x561878[_0x6580('0x32')]=_['intersection'](_0x561878['model'],_0x561878['query']);_0x2d871f[_0x6580('0x34')]=_[_0x6580('0x33')](_0x561878[_0x6580('0x2f')],qs['fields'](_0x1aa259['query'][_0x6580('0x35')]));_0x2d871f[_0x6580('0x34')]=_0x2d871f[_0x6580('0x34')]['length']?_0x2d871f[_0x6580('0x34')]:_0x561878[_0x6580('0x2f')];_0x2d871f['order']=qs[_0x6580('0x38')](_0x1aa259[_0x6580('0x30')][_0x6580('0x38')]);_0x2d871f[_0x6580('0x39')]=qs[_0x6580('0x32')](_[_0x6580('0x3a')](_0x1aa259[_0x6580('0x30')],_0x561878[_0x6580('0x32')]));if(_0x1aa259[_0x6580('0x30')][_0x6580('0x4f')]){_0x2d871f['where']=_['merge'](_0x2d871f[_0x6580('0x39')],{'$or':_[_0x6580('0x2c')](_0x2d871f[_0x6580('0x34')],function(_0x55c8c5){var _0xde96bf={};_0xde96bf[_0x55c8c5]={'$like':'%'+_0x1aa259['query'][_0x6580('0x4f')]+'%'};return _0xde96bf;})});}_0x2d871f=_['merge']({},_0x2d871f,_0x1aa259[_0x6580('0x3d')]);return _0x5fe4bb[_0x6580('0x52')](_0x2d871f);}})[_0x6580('0x27')](function(_0x8bac8e){if(_0x8bac8e){_0x4b3650=_0x8bac8e[_0x6580('0x36')];if(!_0x1aa259[_0x6580('0x30')]['hasOwnProperty'](_0x6580('0x37'))){_0x2d871f['limit']=qs[_0x6580('0x20')](_0x1aa259[_0x6580('0x30')][_0x6580('0x20')]);_0x2d871f[_0x6580('0x1f')]=qs[_0x6580('0x1f')](_0x1aa259[_0x6580('0x30')][_0x6580('0x1f')]);}return _0x5fe4bb[_0x6580('0x52')](_0x2d871f);}})['then'](function(_0x2a4416){if(_0x2a4416){return _0x2a4416?{'count':_0x4b3650,'rows':_0x2a4416}:null;}})[_0x6580('0x27')](respondWithResult(_0x57a92e,null))['catch'](handleError(_0x57a92e,null));};exports[_0x6580('0x53')]=function(_0x4a3853,_0x59e85e,_0x239038){var _0x4af2a6={};var _0x5f08f1={};var _0x2c86d4;var _0xd0d518;return db[_0x6580('0x40')][_0x6580('0x4c')]({'where':{'id':_0x4a3853[_0x6580('0x45')]['id']}})['then'](handleEntityNotFound(_0x59e85e,null))[_0x6580('0x27')](function(_0x5dc3d0){if(_0x5dc3d0){_0x2c86d4=_0x5dc3d0;_0x5f08f1[_0x6580('0x2f')]=_[_0x6580('0x31')](db[_0x6580('0x54')]['rawAttributes']);_0x5f08f1[_0x6580('0x30')]=_[_0x6580('0x31')](_0x4a3853[_0x6580('0x30')]);_0x5f08f1[_0x6580('0x32')]=_[_0x6580('0x33')](_0x5f08f1[_0x6580('0x2f')],_0x5f08f1[_0x6580('0x30')]);_0x4af2a6[_0x6580('0x34')]=_['intersection'](_0x5f08f1[_0x6580('0x2f')],qs['fields'](_0x4a3853[_0x6580('0x30')][_0x6580('0x35')]));_0x4af2a6[_0x6580('0x34')]=_0x4af2a6[_0x6580('0x34')]['length']?_0x4af2a6['attributes']:_0x5f08f1[_0x6580('0x2f')];_0x4af2a6[_0x6580('0x4e')]=qs[_0x6580('0x38')](_0x4a3853[_0x6580('0x30')]['sort']);_0x4af2a6[_0x6580('0x39')]=qs[_0x6580('0x32')](_[_0x6580('0x3a')](_0x4a3853[_0x6580('0x30')],_0x5f08f1[_0x6580('0x32')]));if(_0x4a3853['query'][_0x6580('0x4f')]){_0x4af2a6[_0x6580('0x39')]=_[_0x6580('0x47')](_0x4af2a6[_0x6580('0x39')],{'$or':_[_0x6580('0x2c')](_0x4af2a6[_0x6580('0x34')],function(_0x6a3feb){var _0x199947={};_0x199947[_0x6a3feb]={'$like':'%'+_0x4a3853['query'][_0x6580('0x4f')]+'%'};return _0x199947;})});}_0x4af2a6=_['merge']({},_0x4af2a6,_0x4a3853[_0x6580('0x3d')]);return _0x2c86d4[_0x6580('0x53')](_0x4af2a6);}})[_0x6580('0x27')](function(_0x336454){if(_0x336454){_0xd0d518=_0x336454[_0x6580('0x36')];if(!_0x4a3853[_0x6580('0x30')]['hasOwnProperty'](_0x6580('0x37'))){_0x4af2a6[_0x6580('0x20')]=qs['limit'](_0x4a3853[_0x6580('0x30')]['limit']);_0x4af2a6['offset']=qs[_0x6580('0x1f')](_0x4a3853[_0x6580('0x30')][_0x6580('0x1f')]);}return _0x2c86d4['getTags'](_0x4af2a6);}})[_0x6580('0x27')](function(_0x50ac5a){if(_0x50ac5a){return _0x50ac5a?{'count':_0xd0d518,'rows':_0x50ac5a}:null;}})[_0x6580('0x27')](respondWithResult(_0x59e85e,null))['catch'](handleError(_0x59e85e,null));};exports[_0x6580('0x55')]=function(_0x23cbc8,_0x3694c7,_0x2d82a1){if(_0x23cbc8[_0x6580('0x4a')]['id']){delete _0x23cbc8['body']['id'];}return db[_0x6580('0x40')][_0x6580('0x4c')]({'where':{'id':_0x23cbc8[_0x6580('0x45')]['id']}})[_0x6580('0x27')](handleEntityNotFound(_0x3694c7,null))[_0x6580('0x27')](function(_0x3c0007){if(_0x3c0007){return _0x3c0007[_0x6580('0x55')](_0x23cbc8[_0x6580('0x4a')][_0x6580('0x56')]||[]);}return null;})[_0x6580('0x27')](respondWithResult(_0x3694c7,null))[_0x6580('0x43')](handleError(_0x3694c7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a6935f6..febe96a 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 _0x454d=['../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x35ec86,_0x1c34d3){var _0x1721b5=function(_0x1192fd){while(--_0x1192fd){_0x35ec86['push'](_0x35ec86['shift']());}};_0x1721b5(++_0x1c34d3);}(_0x454d,0xef));var _0xd454=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x454d[_0x11dc39];return _0x457277;};'use strict';var _=require('lodash');var util=require(_0xd454('0x0'));var logger=require(_0xd454('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd454('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd454('0x3'));var rimraf=require(_0xd454('0x4'));var config=require(_0xd454('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd454('0x6')]=function(_0x42a4b1,_0x483c86){return _0x42a4b1[_0xd454('0x7')](_0xd454('0x8'),attributes,{'tableName':_0xd454('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc38d=['bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment'];(function(_0x30bc94,_0x125ed6){var _0x21bb50=function(_0x323f1b){while(--_0x323f1b){_0x30bc94['push'](_0x30bc94['shift']());}};_0x21bb50(++_0x125ed6);}(_0xc38d,0x7e));var _0xdc38=function(_0x41c628,_0x4ce4f4){_0x41c628=_0x41c628-0x0;var _0x171146=_0xc38d[_0x41c628];return _0x171146;};'use strict';var _=require('lodash');var util=require(_0xdc38('0x0'));var logger=require(_0xdc38('0x1'))(_0xdc38('0x2'));var moment=require(_0xdc38('0x3'));var BPromise=require(_0xdc38('0x4'));var rp=require(_0xdc38('0x5'));var fs=require('fs');var path=require(_0xdc38('0x6'));var rimraf=require('rimraf');var config=require(_0xdc38('0x7'));var attributes=require(_0xdc38('0x8'));module[_0xdc38('0x9')]=function(_0x108f44,_0x4e7fb5){return _0x108f44[_0xdc38('0xa')](_0xdc38('0xb'),attributes,{'tableName':_0xdc38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 06ed4e0..2e0d394 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 _0x04f6=['error','message','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x208aa4,_0x5cfa46){var _0xa8d8ee=function(_0x104f2c){while(--_0x104f2c){_0x208aa4['push'](_0x208aa4['shift']());}};_0xa8d8ee(++_0x5cfa46);}(_0x04f6,0x111));var _0x604f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x04f6[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x604f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x604f('0x1'));var db=require(_0x604f('0x2'))['db'];var utils=require(_0x604f('0x3'));var logger=require('../../config/logger')(_0x604f('0x4'));var config=require(_0x604f('0x5'));var jayson=require(_0x604f('0x6'));var client=jayson[_0x604f('0x7')][_0x604f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x635a7,_0x3b5a52,_0x3b9b61){return new BPromise(function(_0x3d75a5,_0x4784e5){return client['request'](_0x635a7,_0x3b9b61)[_0x604f('0x9')](function(_0x26479c){logger[_0x604f('0xa')](_0x604f('0xb'),_0x3b5a52,'request\x20sent');logger[_0x604f('0xc')](_0x604f('0xd'),_0x3b5a52,_0x604f('0xe'),JSON['stringify'](_0x26479c));if(_0x26479c['error']){if(_0x26479c[_0x604f('0xf')]['code']===0x1f4){logger[_0x604f('0xf')](_0x604f('0xb'),_0x3b5a52,_0x26479c[_0x604f('0xf')][_0x604f('0x10')]);return _0x4784e5(_0x26479c[_0x604f('0xf')]['message']);}logger[_0x604f('0xf')](_0x604f('0xb'),_0x3b5a52,_0x26479c['error']['message']);return _0x3d75a5(_0x26479c[_0x604f('0xf')][_0x604f('0x10')]);}else{logger['info'](_0x604f('0xb'),_0x3b5a52,_0x604f('0xe'));_0x3d75a5(_0x26479c['result']['message']);}})[_0x604f('0x11')](function(_0x17d9d4){logger['error'](_0x604f('0xb'),_0x3b5a52,_0x17d9d4);_0x4784e5(_0x17d9d4);});});} \ No newline at end of file +var _0x047a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','error','message','result','catch'];(function(_0x53615d,_0x5aebce){var _0x5146ed=function(_0x4d2d74){while(--_0x4d2d74){_0x53615d['push'](_0x53615d['shift']());}};_0x5146ed(++_0x5aebce);}(_0x047a,0xfc));var _0xa047=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x047a[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0xa047('0x0'));var util=require(_0xa047('0x1'));var moment=require(_0xa047('0x2'));var BPromise=require(_0xa047('0x3'));var rs=require(_0xa047('0x4'));var fs=require('fs');var Redis=require(_0xa047('0x5'));var db=require(_0xa047('0x6'))['db'];var utils=require(_0xa047('0x7'));var logger=require(_0xa047('0x8'))(_0xa047('0x9'));var config=require('../../config/environment');var jayson=require(_0xa047('0xa'));var client=jayson['client'][_0xa047('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c5e49,_0x20b756,_0x3c4c23){return new BPromise(function(_0x3119ba,_0x2f6d99){return client[_0xa047('0xc')](_0x4c5e49,_0x3c4c23)[_0xa047('0xd')](function(_0x39ccb9){logger[_0xa047('0xe')](_0xa047('0xf'),_0x20b756,'request\x20sent');logger[_0xa047('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20b756,'request\x20sent',JSON['stringify'](_0x39ccb9));if(_0x39ccb9[_0xa047('0x11')]){if(_0x39ccb9[_0xa047('0x11')]['code']===0x1f4){logger['error'](_0xa047('0xf'),_0x20b756,_0x39ccb9[_0xa047('0x11')][_0xa047('0x12')]);return _0x2f6d99(_0x39ccb9[_0xa047('0x11')][_0xa047('0x12')]);}logger[_0xa047('0x11')](_0xa047('0xf'),_0x20b756,_0x39ccb9[_0xa047('0x11')][_0xa047('0x12')]);return _0x3119ba(_0x39ccb9[_0xa047('0x11')]['message']);}else{logger[_0xa047('0xe')](_0xa047('0xf'),_0x20b756,'request\x20sent');_0x3119ba(_0x39ccb9[_0xa047('0x13')][_0xa047('0x12')]);}})[_0xa047('0x14')](function(_0x10332a){logger[_0xa047('0x11')](_0xa047('0xf'),_0x20b756,_0x10332a);_0x2f6d99(_0x10332a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f15b1ff..c9ea813 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 _0x9e87=['show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x2e0bfa,_0x35ded8){var _0x479a71=function(_0x4eb4ae){while(--_0x4eb4ae){_0x2e0bfa['push'](_0x2e0bfa['shift']());}};_0x479a71(++_0x35ded8);}(_0x9e87,0x195));var _0x79e8=function(_0x78699f,_0x9b5e13){_0x78699f=_0x78699f-0x0;var _0x26bfc7=_0x9e87[_0x78699f];return _0x26bfc7;};'use strict';var multer=require(_0x79e8('0x0'));var util=require(_0x79e8('0x1'));var path=require(_0x79e8('0x2'));var timeout=require(_0x79e8('0x3'));var express=require(_0x79e8('0x4'));var router=express[_0x79e8('0x5')]();var fs_extra=require(_0x79e8('0x6'));var auth=require(_0x79e8('0x7'));var interaction=require(_0x79e8('0x8'));var config=require(_0x79e8('0x9'));var controller=require(_0x79e8('0xa'));router['get']('/',auth[_0x79e8('0xb')](),controller[_0x79e8('0xc')]);router[_0x79e8('0xd')](_0x79e8('0xe'),auth['isAuthenticated'](),controller[_0x79e8('0xf')]);router[_0x79e8('0x10')]('/',auth[_0x79e8('0xb')](),controller['create']);router[_0x79e8('0x11')](_0x79e8('0xe'),auth[_0x79e8('0xb')](),controller[_0x79e8('0x12')]);router[_0x79e8('0x13')](_0x79e8('0xe'),auth[_0x79e8('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x513f=['get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x513f,0x1d3));var _0xf513=function(_0x587fe4,_0x2eebd8){_0x587fe4=_0x587fe4-0x0;var _0x10a29e=_0x513f[_0x587fe4];return _0x10a29e;};'use strict';var multer=require('multer');var util=require(_0xf513('0x0'));var path=require(_0xf513('0x1'));var timeout=require(_0xf513('0x2'));var express=require('express');var router=express[_0xf513('0x3')]();var fs_extra=require(_0xf513('0x4'));var auth=require(_0xf513('0x5'));var interaction=require(_0xf513('0x6'));var config=require(_0xf513('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xf513('0x8')]('/',auth[_0xf513('0x9')](),controller[_0xf513('0xa')]);router[_0xf513('0x8')]('/:id',auth[_0xf513('0x9')](),controller[_0xf513('0xb')]);router['post']('/',auth[_0xf513('0x9')](),controller[_0xf513('0xc')]);router[_0xf513('0xd')](_0xf513('0xe'),auth[_0xf513('0x9')](),controller[_0xf513('0xf')]);router[_0xf513('0x10')](_0xf513('0xe'),auth[_0xf513('0x9')](),controller[_0xf513('0x11')]);module[_0xf513('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c70b262..b01307e 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 _0x548d=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x1daa13,_0x28a05f){var _0x39097d=function(_0x550364){while(--_0x550364){_0x1daa13['push'](_0x1daa13['shift']());}};_0x39097d(++_0x28a05f);}(_0x548d,0x1e8));var _0xd548=function(_0x35d8be,_0x530a24){_0x35d8be=_0x35d8be-0x0;var _0x25ec32=_0x548d[_0x35d8be];return _0x25ec32;};'use strict';var Sequelize=require(_0xd548('0x0'));module[_0xd548('0x1')]={'type':{'type':Sequelize[_0xd548('0x2')](_0xd548('0x3'),_0xd548('0x4'),'customVariable',_0xd548('0x5'),_0xd548('0x6')),'defaultValue':_0xd548('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd548('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xd548('0x3'),_0xd548('0x4'),_0xd548('0x8'))},'keyContent':{'type':Sequelize[_0xd548('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd548('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2550=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x59cd25,_0x55b586){var _0x1efadf=function(_0x4b66dc){while(--_0x4b66dc){_0x59cd25['push'](_0x59cd25['shift']());}};_0x1efadf(++_0x55b586);}(_0x2550,0xa0));var _0x0255=function(_0x51b739,_0x432ddc){_0x51b739=_0x51b739-0x0;var _0x22ce9f=_0x2550[_0x51b739];return _0x22ce9f;};'use strict';var Sequelize=require(_0x0255('0x0'));module[_0x0255('0x1')]={'type':{'type':Sequelize[_0x0255('0x2')](_0x0255('0x3'),_0x0255('0x4'),_0x0255('0x5'),_0x0255('0x6'),_0x0255('0x7')),'defaultValue':_0x0255('0x3')},'content':{'type':Sequelize[_0x0255('0x8')]},'key':{'type':Sequelize[_0x0255('0x8')]},'keyType':{'type':Sequelize[_0x0255('0x2')](_0x0255('0x3'),'variable',_0x0255('0x5'))},'keyContent':{'type':Sequelize[_0x0255('0x8')]},'idField':{'type':Sequelize[_0x0255('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0255('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0255('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1bc85c8..a75fe16 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 _0xde2c=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','show','find','create','body','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xde2c,0x7f));var _0xcde2=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xde2c[_0x152449];return _0x5b58b2;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];function respondWithStatusCode(_0x932b90,_0x1ea4bb){_0x1ea4bb=_0x1ea4bb||0xcc;return function(_0x599294){if(_0x599294){return _0x932b90[_0xcde2('0x1a')](_0x1ea4bb);}return _0x932b90['status'](_0x1ea4bb)[_0xcde2('0x1b')]();};}function respondWithResult(_0x4f0ac9,_0x4b0e0e){_0x4b0e0e=_0x4b0e0e||0xc8;return function(_0x34e079){if(_0x34e079){return _0x4f0ac9[_0xcde2('0x1c')](_0x4b0e0e)[_0xcde2('0x1d')](_0x34e079);}};}function respondWithFilteredResult(_0x19b54b,_0x11665c){return function(_0x5312c7){if(_0x5312c7){var _0x39b023=typeof _0x11665c['offset']===_0xcde2('0x1e')&&typeof _0x11665c[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x1f1858=_0x5312c7['count'];var _0x4fd5aa=_0x39b023?0x0:_0x11665c['offset'];var _0x2b4468=_0x39b023?_0x5312c7['count']:_0x11665c[_0xcde2('0x20')]+_0x11665c[_0xcde2('0x1f')];var _0x252372;if(_0x2b4468>=_0x1f1858){_0x2b4468=_0x1f1858;_0x252372=0xc8;}else{_0x252372=0xce;}_0x19b54b['status'](_0x252372);return _0x19b54b[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fd5aa+'-'+_0x2b4468+'/'+_0x1f1858)[_0xcde2('0x1d')](_0x5312c7);}return null;};}function patchUpdates(_0x3c1d7e){return function(_0x43df7a){try{jsonpatch['apply'](_0x43df7a,_0x3c1d7e,!![]);}catch(_0x4bce90){return BPromise['reject'](_0x4bce90);}return _0x43df7a[_0xcde2('0x23')]();};}function saveUpdates(_0x3e5170,_0x2c9562){return function(_0x4063d4){if(_0x4063d4){return _0x4063d4[_0xcde2('0x24')](_0x3e5170)['then'](function(_0x1104b8){return _0x1104b8;});}return null;};}function removeEntity(_0x52368b,_0x280d8c){return function(_0xb2123c){if(_0xb2123c){return _0xb2123c[_0xcde2('0x25')]()['then'](function(){_0x52368b['status'](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x207a12,_0x3e8aaf){return function(_0x217ec9){if(!_0x217ec9){_0x207a12[_0xcde2('0x1a')](0x194);}return _0x217ec9;};}function handleError(_0x5a5b92,_0x2d1d17){_0x2d1d17=_0x2d1d17||0x1f4;return function(_0x45275a){logger[_0xcde2('0x26')](_0x45275a['stack']);if(_0x45275a[_0xcde2('0x27')]){delete _0x45275a[_0xcde2('0x27')];}_0x5a5b92[_0xcde2('0x1c')](_0x2d1d17)[_0xcde2('0x28')](_0x45275a);};}exports[_0xcde2('0x29')]=function(_0x5b2b7,_0x40b12c){var _0x3e492f={},_0x5bf1e6={},_0x3c3c01={'count':0x0,'rows':[]};var _0x4a0826=_[_0xcde2('0x2a')](db[_0xcde2('0x2b')][_0xcde2('0x2c')],function(_0x49cb58){return{'name':_0x49cb58[_0xcde2('0x2d')],'type':_0x49cb58[_0xcde2('0x2e')]['key']};});_0x5bf1e6[_0xcde2('0x2f')]=_[_0xcde2('0x2a')](_0x4a0826,_0xcde2('0x27'));_0x5bf1e6[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x5b2b7[_0xcde2('0x30')]);_0x5bf1e6[_0xcde2('0x32')]=_[_0xcde2('0x33')](_0x5bf1e6['model'],_0x5bf1e6[_0xcde2('0x30')]);_0x3e492f[_0xcde2('0x34')]=_[_0xcde2('0x33')](_0x5bf1e6[_0xcde2('0x2f')],qs['fields'](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x35')]));_0x3e492f[_0xcde2('0x34')]=_0x3e492f[_0xcde2('0x34')]['length']?_0x3e492f[_0xcde2('0x34')]:_0x5bf1e6[_0xcde2('0x2f')];if(!_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x36')]('nolimit')){_0x3e492f[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x1f')]);_0x3e492f[_0xcde2('0x20')]=qs['offset'](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x20')]);}_0x3e492f[_0xcde2('0x37')]=qs[_0xcde2('0x38')](_0x5b2b7['query']['sort']);_0x3e492f[_0xcde2('0x39')]=qs[_0xcde2('0x32')](_[_0xcde2('0x3a')](_0x5b2b7[_0xcde2('0x30')],_0x5bf1e6[_0xcde2('0x32')]),_0x4a0826);if(_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x3b')]){_0x3e492f[_0xcde2('0x39')]=_[_0xcde2('0x3c')](_0x3e492f['where'],{'$or':_[_0xcde2('0x2a')](_0x4a0826,function(_0x766279){if(_0x766279[_0xcde2('0x2e')]!==_0xcde2('0x3d')){var _0x2a73df={};_0x2a73df[_0x766279['name']]={'$like':'%'+_0x5b2b7['query'][_0xcde2('0x3b')]+'%'};return _0x2a73df;}})});}_0x3e492f=_[_0xcde2('0x3c')]({},_0x3e492f,_0x5b2b7[_0xcde2('0x3e')]);var _0x383899={'where':_0x3e492f[_0xcde2('0x39')]};return db[_0xcde2('0x2b')]['count'](_0x383899)['then'](function(_0x5160c2){_0x3c3c01[_0xcde2('0x3f')]=_0x5160c2;if(_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x40')]){_0x3e492f[_0xcde2('0x41')]=[{'all':!![]}];}return db[_0xcde2('0x2b')][_0xcde2('0x42')](_0x3e492f);})[_0xcde2('0x43')](function(_0x49b862){_0x3c3c01['rows']=_0x49b862;return _0x3c3c01;})[_0xcde2('0x43')](respondWithFilteredResult(_0x40b12c,_0x3e492f))['catch'](handleError(_0x40b12c,null));};exports[_0xcde2('0x44')]=function(_0x4fc7bf,_0x1126b2){var _0x3239a0={'raw':!![],'where':{'id':_0x4fc7bf['params']['id']}},_0x2cf372={};_0x2cf372[_0xcde2('0x2f')]=_['keys'](db[_0xcde2('0x2b')][_0xcde2('0x2c')]);_0x2cf372[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x4fc7bf[_0xcde2('0x30')]);_0x2cf372[_0xcde2('0x32')]=_['intersection'](_0x2cf372['model'],_0x2cf372[_0xcde2('0x30')]);_0x3239a0['attributes']=_['intersection'](_0x2cf372[_0xcde2('0x2f')],qs['fields'](_0x4fc7bf[_0xcde2('0x30')][_0xcde2('0x35')]));_0x3239a0['attributes']=_0x3239a0[_0xcde2('0x34')]['length']?_0x3239a0['attributes']:_0x2cf372[_0xcde2('0x2f')];if(_0x4fc7bf[_0xcde2('0x30')]['includeAll']){_0x3239a0[_0xcde2('0x41')]=[{'all':!![]}];}_0x3239a0=_['merge']({},_0x3239a0,_0x4fc7bf[_0xcde2('0x3e')]);return db[_0xcde2('0x2b')][_0xcde2('0x45')](_0x3239a0)[_0xcde2('0x43')](handleEntityNotFound(_0x1126b2,null))[_0xcde2('0x43')](respondWithResult(_0x1126b2,null))['catch'](handleError(_0x1126b2,null));};exports[_0xcde2('0x46')]=function(_0x3e4fc0,_0x40d14b){return db[_0xcde2('0x2b')]['create'](_0x3e4fc0['body'],{})[_0xcde2('0x43')](respondWithResult(_0x40d14b,0xc9))['catch'](handleError(_0x40d14b,null));};exports[_0xcde2('0x24')]=function(_0x3e9e79,_0x381bd4){if(_0x3e9e79[_0xcde2('0x47')]['id']){delete _0x3e9e79[_0xcde2('0x47')]['id'];}return db[_0xcde2('0x2b')]['find']({'where':{'id':_0x3e9e79[_0xcde2('0x48')]['id']}})['then'](handleEntityNotFound(_0x381bd4,null))[_0xcde2('0x43')](saveUpdates(_0x3e9e79['body'],null))[_0xcde2('0x43')](respondWithResult(_0x381bd4,null))[_0xcde2('0x49')](handleError(_0x381bd4,null));};exports[_0xcde2('0x25')]=function(_0x16cddb,_0x446cf0){return db[_0xcde2('0x2b')]['find']({'where':{'id':_0x16cddb[_0xcde2('0x48')]['id']}})['then'](handleEntityNotFound(_0x446cf0,null))[_0xcde2('0x43')](removeEntity(_0x446cf0,null))[_0xcde2('0x49')](handleError(_0x446cf0,null));}; \ No newline at end of file +var _0x9567=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body'];(function(_0x4a29fc,_0x224157){var _0x5932b0=function(_0x16e5da){while(--_0x16e5da){_0x4a29fc['push'](_0x4a29fc['shift']());}};_0x5932b0(++_0x224157);}(_0x9567,0xdc));var _0x7956=function(_0x2dab66,_0x27490e){_0x2dab66=_0x2dab66-0x0;var _0x2f4466=_0x9567[_0x2dab66];return _0x2f4466;};'use strict';var emlformat=require(_0x7956('0x0'));var rimraf=require(_0x7956('0x1'));var zipdir=require(_0x7956('0x2'));var jsonpatch=require(_0x7956('0x3'));var rp=require(_0x7956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7956('0x5'));var util=require(_0x7956('0x6'));var path=require('path');var sox=require(_0x7956('0x7'));var csv=require('to-csv');var ejs=require(_0x7956('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7956('0x9'));var squel=require(_0x7956('0xa'));var crypto=require('crypto');var jsforce=require(_0x7956('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7956('0xc'));var querystring=require(_0x7956('0xd'));var Papa=require('papaparse');var Redis=require(_0x7956('0xe'));var authService=require(_0x7956('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7956('0x10'));var hardwareService=require(_0x7956('0x11'));var logger=require(_0x7956('0x12'))('api');var utils=require(_0x7956('0x13'));var config=require(_0x7956('0x14'));var licenseUtil=require(_0x7956('0x15'));var db=require(_0x7956('0x16'))['db'];function respondWithStatusCode(_0x5b3531,_0x1d2e5d){_0x1d2e5d=_0x1d2e5d||0xcc;return function(_0x9d985e){if(_0x9d985e){return _0x5b3531[_0x7956('0x17')](_0x1d2e5d);}return _0x5b3531['status'](_0x1d2e5d)[_0x7956('0x18')]();};}function respondWithResult(_0x43c7f6,_0x248b79){_0x248b79=_0x248b79||0xc8;return function(_0x3a408a){if(_0x3a408a){return _0x43c7f6[_0x7956('0x19')](_0x248b79)[_0x7956('0x1a')](_0x3a408a);}};}function respondWithFilteredResult(_0x197360,_0x436573){return function(_0x24ea8d){if(_0x24ea8d){var _0x6a6d78=typeof _0x436573[_0x7956('0x1b')]===_0x7956('0x1c')&&typeof _0x436573[_0x7956('0x1d')]===_0x7956('0x1c');var _0x1e8040=_0x24ea8d[_0x7956('0x1e')];var _0x5e6b90=_0x6a6d78?0x0:_0x436573['offset'];var _0x10b29c=_0x6a6d78?_0x24ea8d[_0x7956('0x1e')]:_0x436573['offset']+_0x436573[_0x7956('0x1d')];var _0x584922;if(_0x10b29c>=_0x1e8040){_0x10b29c=_0x1e8040;_0x584922=0xc8;}else{_0x584922=0xce;}_0x197360[_0x7956('0x19')](_0x584922);return _0x197360[_0x7956('0x1f')]('Content-Range',_0x5e6b90+'-'+_0x10b29c+'/'+_0x1e8040)[_0x7956('0x1a')](_0x24ea8d);}return null;};}function patchUpdates(_0x2e31cd){return function(_0xc500bd){try{jsonpatch['apply'](_0xc500bd,_0x2e31cd,!![]);}catch(_0x8a58ea){return BPromise['reject'](_0x8a58ea);}return _0xc500bd[_0x7956('0x20')]();};}function saveUpdates(_0x5100d8,_0x427500){return function(_0x8a7165){if(_0x8a7165){return _0x8a7165[_0x7956('0x21')](_0x5100d8)[_0x7956('0x22')](function(_0x4d4d95){return _0x4d4d95;});}return null;};}function removeEntity(_0x19c033,_0x3f13b7){return function(_0x432a2d){if(_0x432a2d){return _0x432a2d['destroy']()['then'](function(){_0x19c033[_0x7956('0x19')](0xcc)[_0x7956('0x18')]();});}};}function handleEntityNotFound(_0x40d2d6,_0x1c407a){return function(_0x4572b2){if(!_0x4572b2){_0x40d2d6['sendStatus'](0x194);}return _0x4572b2;};}function handleError(_0x34c17f,_0x11eb8b){_0x11eb8b=_0x11eb8b||0x1f4;return function(_0xe39d1d){logger[_0x7956('0x23')](_0xe39d1d[_0x7956('0x24')]);if(_0xe39d1d[_0x7956('0x25')]){delete _0xe39d1d['name'];}_0x34c17f[_0x7956('0x19')](_0x11eb8b)[_0x7956('0x26')](_0xe39d1d);};}exports[_0x7956('0x27')]=function(_0x3de345,_0xe7d52){var _0x17c724={},_0x12cc06={},_0x30a8d1={'count':0x0,'rows':[]};var _0x2f248d=_[_0x7956('0x28')](db[_0x7956('0x29')][_0x7956('0x2a')],function(_0x21fb1b){return{'name':_0x21fb1b[_0x7956('0x2b')],'type':_0x21fb1b[_0x7956('0x2c')][_0x7956('0x2d')]};});_0x12cc06[_0x7956('0x2e')]=_[_0x7956('0x28')](_0x2f248d,_0x7956('0x25'));_0x12cc06[_0x7956('0x2f')]=_['keys'](_0x3de345[_0x7956('0x2f')]);_0x12cc06[_0x7956('0x30')]=_[_0x7956('0x31')](_0x12cc06[_0x7956('0x2e')],_0x12cc06[_0x7956('0x2f')]);_0x17c724[_0x7956('0x32')]=_['intersection'](_0x12cc06[_0x7956('0x2e')],qs[_0x7956('0x33')](_0x3de345['query'][_0x7956('0x33')]));_0x17c724[_0x7956('0x32')]=_0x17c724[_0x7956('0x32')][_0x7956('0x34')]?_0x17c724[_0x7956('0x32')]:_0x12cc06[_0x7956('0x2e')];if(!_0x3de345[_0x7956('0x2f')][_0x7956('0x35')](_0x7956('0x36'))){_0x17c724[_0x7956('0x1d')]=qs[_0x7956('0x1d')](_0x3de345[_0x7956('0x2f')][_0x7956('0x1d')]);_0x17c724[_0x7956('0x1b')]=qs[_0x7956('0x1b')](_0x3de345[_0x7956('0x2f')]['offset']);}_0x17c724[_0x7956('0x37')]=qs[_0x7956('0x38')](_0x3de345['query'][_0x7956('0x38')]);_0x17c724['where']=qs[_0x7956('0x30')](_['pick'](_0x3de345['query'],_0x12cc06[_0x7956('0x30')]),_0x2f248d);if(_0x3de345['query'][_0x7956('0x39')]){_0x17c724[_0x7956('0x3a')]=_[_0x7956('0x3b')](_0x17c724[_0x7956('0x3a')],{'$or':_[_0x7956('0x28')](_0x2f248d,function(_0x79dc18){if(_0x79dc18[_0x7956('0x2c')]!==_0x7956('0x3c')){var _0x4720d3={};_0x4720d3[_0x79dc18['name']]={'$like':'%'+_0x3de345[_0x7956('0x2f')]['filter']+'%'};return _0x4720d3;}})});}_0x17c724=_[_0x7956('0x3b')]({},_0x17c724,_0x3de345[_0x7956('0x3d')]);var _0x2d8d74={'where':_0x17c724[_0x7956('0x3a')]};return db['FreshdeskField'][_0x7956('0x1e')](_0x2d8d74)[_0x7956('0x22')](function(_0x5825e5){_0x30a8d1['count']=_0x5825e5;if(_0x3de345[_0x7956('0x2f')]['includeAll']){_0x17c724[_0x7956('0x3e')]=[{'all':!![]}];}return db[_0x7956('0x29')][_0x7956('0x3f')](_0x17c724);})['then'](function(_0x387237){_0x30a8d1[_0x7956('0x40')]=_0x387237;return _0x30a8d1;})['then'](respondWithFilteredResult(_0xe7d52,_0x17c724))[_0x7956('0x41')](handleError(_0xe7d52,null));};exports['show']=function(_0xbe3f24,_0x46f78e){var _0x1968ab={'raw':!![],'where':{'id':_0xbe3f24[_0x7956('0x42')]['id']}},_0x31cea9={};_0x31cea9['model']=_['keys'](db[_0x7956('0x29')][_0x7956('0x2a')]);_0x31cea9[_0x7956('0x2f')]=_[_0x7956('0x43')](_0xbe3f24[_0x7956('0x2f')]);_0x31cea9[_0x7956('0x30')]=_['intersection'](_0x31cea9[_0x7956('0x2e')],_0x31cea9[_0x7956('0x2f')]);_0x1968ab[_0x7956('0x32')]=_[_0x7956('0x31')](_0x31cea9[_0x7956('0x2e')],qs[_0x7956('0x33')](_0xbe3f24[_0x7956('0x2f')][_0x7956('0x33')]));_0x1968ab[_0x7956('0x32')]=_0x1968ab[_0x7956('0x32')][_0x7956('0x34')]?_0x1968ab[_0x7956('0x32')]:_0x31cea9[_0x7956('0x2e')];if(_0xbe3f24[_0x7956('0x2f')][_0x7956('0x44')]){_0x1968ab['include']=[{'all':!![]}];}_0x1968ab=_[_0x7956('0x3b')]({},_0x1968ab,_0xbe3f24['options']);return db['FreshdeskField'][_0x7956('0x45')](_0x1968ab)[_0x7956('0x22')](handleEntityNotFound(_0x46f78e,null))[_0x7956('0x22')](respondWithResult(_0x46f78e,null))[_0x7956('0x41')](handleError(_0x46f78e,null));};exports[_0x7956('0x46')]=function(_0x45c90f,_0x441404){return db[_0x7956('0x29')][_0x7956('0x46')](_0x45c90f[_0x7956('0x47')],{})[_0x7956('0x22')](respondWithResult(_0x441404,0xc9))[_0x7956('0x41')](handleError(_0x441404,null));};exports[_0x7956('0x21')]=function(_0x2ba635,_0x3158aa){if(_0x2ba635[_0x7956('0x47')]['id']){delete _0x2ba635[_0x7956('0x47')]['id'];}return db[_0x7956('0x29')][_0x7956('0x45')]({'where':{'id':_0x2ba635[_0x7956('0x42')]['id']}})[_0x7956('0x22')](handleEntityNotFound(_0x3158aa,null))[_0x7956('0x22')](saveUpdates(_0x2ba635['body'],null))[_0x7956('0x22')](respondWithResult(_0x3158aa,null))[_0x7956('0x41')](handleError(_0x3158aa,null));};exports[_0x7956('0x48')]=function(_0x493092,_0x385fb3){return db['FreshdeskField'][_0x7956('0x45')]({'where':{'id':_0x493092[_0x7956('0x42')]['id']}})['then'](handleEntityNotFound(_0x385fb3,null))[_0x7956('0x22')](removeEntity(_0x385fb3,null))[_0x7956('0x41')](handleError(_0x385fb3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index bf0aa8e..c3489ce 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 _0xb223=['freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x2f443e,_0x423c28){var _0x1def60=function(_0x11f64f){while(--_0x11f64f){_0x2f443e['push'](_0x2f443e['shift']());}};_0x1def60(++_0x423c28);}(_0xb223,0x157));var _0x3b22=function(_0x78bdbc,_0x193a0b){_0x78bdbc=_0x78bdbc-0x0;var _0xa63334=_0xb223[_0x78bdbc];return _0xa63334;};'use strict';var _=require(_0x3b22('0x0'));var util=require(_0x3b22('0x1'));var logger=require('../../config/logger')(_0x3b22('0x2'));var moment=require(_0x3b22('0x3'));var BPromise=require(_0x3b22('0x4'));var rp=require(_0x3b22('0x5'));var fs=require('fs');var path=require(_0x3b22('0x6'));var rimraf=require(_0x3b22('0x7'));var config=require(_0x3b22('0x8'));var attributes=require(_0x3b22('0x9'));module[_0x3b22('0xa')]=function(_0xcf32b9,_0x58096f){return _0xcf32b9[_0x3b22('0xb')](_0x3b22('0xc'),attributes,{'tableName':_0x3b22('0xd'),'paranoid':![],'indexes':[{'name':_0x3b22('0xe'),'fields':[_0x3b22('0xf'),_0x3b22('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfaa=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x54dcc0,_0x3d2b5c){var _0x57afa4=function(_0xdaef2b){while(--_0xdaef2b){_0x54dcc0['push'](_0x54dcc0['shift']());}};_0x57afa4(++_0x3d2b5c);}(_0xdfaa,0x14a));var _0xadfa=function(_0x4d1c6a,_0x3b99a6){_0x4d1c6a=_0x4d1c6a-0x0;var _0x51f4d4=_0xdfaa[_0x4d1c6a];return _0x51f4d4;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var logger=require(_0xadfa('0x2'))(_0xadfa('0x3'));var moment=require(_0xadfa('0x4'));var BPromise=require('bluebird');var rp=require(_0xadfa('0x5'));var fs=require('fs');var path=require(_0xadfa('0x6'));var rimraf=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var attributes=require(_0xadfa('0x9'));module[_0xadfa('0xa')]=function(_0x1c2ae4,_0x1c9e2a){return _0x1c2ae4[_0xadfa('0xb')](_0xadfa('0xc'),attributes,{'tableName':_0xadfa('0xd'),'paranoid':![],'indexes':[{'name':_0xadfa('0xe'),'fields':['idField','FieldId'],'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 f48848a..3147285 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 _0x3a8d=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x3a8d,0xec));var _0xd3a8=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x3a8d[_0x553a87];return _0x12d1e6;};'use strict';var _=require('lodash');var util=require(_0xd3a8('0x0'));var moment=require(_0xd3a8('0x1'));var BPromise=require(_0xd3a8('0x2'));var rs=require(_0xd3a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd3a8('0x4'));var logger=require(_0xd3a8('0x5'))(_0xd3a8('0x6'));var config=require(_0xd3a8('0x7'));var jayson=require(_0xd3a8('0x8'));var client=jayson[_0xd3a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fa46a,_0x58aac5,_0x46170f){return new BPromise(function(_0x24d22c,_0x3d3db7){return client[_0xd3a8('0xa')](_0x1fa46a,_0x46170f)[_0xd3a8('0xb')](function(_0x58c4d7){logger[_0xd3a8('0xc')](_0xd3a8('0xd'),_0x58aac5,_0xd3a8('0xe'));logger[_0xd3a8('0xf')](_0xd3a8('0x10'),_0x58aac5,_0xd3a8('0xe'),JSON[_0xd3a8('0x11')](_0x58c4d7));if(_0x58c4d7[_0xd3a8('0x12')]){if(_0x58c4d7[_0xd3a8('0x12')][_0xd3a8('0x13')]===0x1f4){logger[_0xd3a8('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x58aac5,_0x58c4d7[_0xd3a8('0x12')]['message']);return _0x3d3db7(_0x58c4d7[_0xd3a8('0x12')][_0xd3a8('0x14')]);}logger['error'](_0xd3a8('0xd'),_0x58aac5,_0x58c4d7['error'][_0xd3a8('0x14')]);return _0x24d22c(_0x58c4d7['error'][_0xd3a8('0x14')]);}else{logger[_0xd3a8('0xc')](_0xd3a8('0xd'),_0x58aac5,'request\x20sent');_0x24d22c(_0x58c4d7[_0xd3a8('0x15')][_0xd3a8('0x14')]);}})[_0xd3a8('0x16')](function(_0x538d9e){logger[_0xd3a8('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x58aac5,_0x538d9e);_0x3d3db7(_0x538d9e);});});} \ No newline at end of file +var _0x5741=['jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dafeb,_0x330c65){var _0x4ac1f0=function(_0x27af26){while(--_0x27af26){_0x3dafeb['push'](_0x3dafeb['shift']());}};_0x4ac1f0(++_0x330c65);}(_0x5741,0x175));var _0x1574=function(_0x2f32a8,_0x1d1646){_0x2f32a8=_0x2f32a8-0x0;var _0x2f4b17=_0x5741[_0x2f32a8];return _0x2f4b17;};'use strict';var _=require(_0x1574('0x0'));var util=require('util');var moment=require(_0x1574('0x1'));var BPromise=require('bluebird');var rs=require(_0x1574('0x2'));var fs=require('fs');var Redis=require(_0x1574('0x3'));var db=require(_0x1574('0x4'))['db'];var utils=require(_0x1574('0x5'));var logger=require('../../config/logger')(_0x1574('0x6'));var config=require('../../config/environment');var jayson=require(_0x1574('0x7'));var client=jayson[_0x1574('0x8')][_0x1574('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x72aba7,_0x55656b,_0x46ae08){return new BPromise(function(_0x34c8a3,_0x3b3dfa){return client[_0x1574('0xa')](_0x72aba7,_0x46ae08)['then'](function(_0x1bd59f){logger[_0x1574('0xb')](_0x1574('0xc'),_0x55656b,_0x1574('0xd'));logger[_0x1574('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x55656b,_0x1574('0xd'),JSON['stringify'](_0x1bd59f));if(_0x1bd59f[_0x1574('0xf')]){if(_0x1bd59f[_0x1574('0xf')][_0x1574('0x10')]===0x1f4){logger[_0x1574('0xf')](_0x1574('0xc'),_0x55656b,_0x1bd59f[_0x1574('0xf')][_0x1574('0x11')]);return _0x3b3dfa(_0x1bd59f['error']['message']);}logger['error'](_0x1574('0xc'),_0x55656b,_0x1bd59f[_0x1574('0xf')][_0x1574('0x11')]);return _0x34c8a3(_0x1bd59f[_0x1574('0xf')][_0x1574('0x11')]);}else{logger['info'](_0x1574('0xc'),_0x55656b,_0x1574('0xd'));_0x34c8a3(_0x1bd59f[_0x1574('0x12')][_0x1574('0x11')]);}})[_0x1574('0x13')](function(_0x4b3939){logger[_0x1574('0xf')](_0x1574('0xc'),_0x55656b,_0x4b3939);_0x3b3dfa(_0x4b3939);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 79f0499..4051f17 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 _0x1d2d=['multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports'];(function(_0x2b18e6,_0x4ff8ef){var _0x5d41bd=function(_0x412466){while(--_0x412466){_0x2b18e6['push'](_0x2b18e6['shift']());}};_0x5d41bd(++_0x4ff8ef);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5a245c,_0x1d869b){_0x5a245c=_0x5a245c-0x0;var _0x2931e1=_0x1d2d[_0x5a245c];return _0x2931e1;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/:id',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x11')]);router['post'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x12')]);router[_0xd1d2('0x13')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x16')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller['destroy']);module[_0xd1d2('0x17')]=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(_0x53e24a,_0x120ce2){var _0x174c9e=function(_0x36a65c){while(--_0x36a65c){_0x53e24a['push'](_0x53e24a['shift']());}};_0x174c9e(++_0x120ce2);}(_0x91a7,0xe7));var _0x791a=function(_0x4d4a66,_0x3b69f6){_0x4d4a66=_0x4d4a66-0x0;var _0x28570e=_0x91a7[_0x4d4a66];return _0x28570e;};'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 c7b86fd..67d9565 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 _0x5f2f=['exports','STRING','username','sequelize'];(function(_0x279f56,_0x392730){var _0x27bf1e=function(_0x536f39){while(--_0x536f39){_0x279f56['push'](_0x279f56['shift']());}};_0x27bf1e(++_0x392730);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52969d,_0x91226d){_0x52969d=_0x52969d-0x0;var _0x4970fe=_0x5f2f[_0x52969d];return _0x4970fe;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'apiKey':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x31d15a,_0x2eace5){var _0x1405c5=function(_0x53fd96){while(--_0x53fd96){_0x31d15a['push'](_0x31d15a['shift']());}};_0x1405c5(++_0x2eace5);}(_0x627e,0x14a));var _0xe627=function(_0x4d6e20,_0x4b7a6b){_0x4d6e20=_0x4d6e20-0x0;var _0x398ba5=_0x627e[_0x4d6e20];return _0x398ba5;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 14d2b08..ecf2aca 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 _0xb56d=['Subjects','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','format','%s%s','users','Requested\x20Resource\x20not\x20Found','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','end','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField'];(function(_0x3de04d,_0x322289){var _0x32a6b9=function(_0x2b5ee9){while(--_0x2b5ee9){_0x3de04d['push'](_0x3de04d['shift']());}};_0x32a6b9(++_0x322289);}(_0xb56d,0x75));var _0xdb56=function(_0x227027,_0x423ef5){_0x227027=_0x227027-0x0;var _0x121bf5=_0xb56d[_0x227027];return _0x121bf5;};'use strict';var emlformat=require(_0xdb56('0x0'));var rimraf=require(_0xdb56('0x1'));var zipdir=require(_0xdb56('0x2'));var jsonpatch=require(_0xdb56('0x3'));var rp=require(_0xdb56('0x4'));var moment=require('moment');var BPromise=require(_0xdb56('0x5'));var Mustache=require('mustache');var util=require(_0xdb56('0x6'));var path=require(_0xdb56('0x7'));var sox=require(_0xdb56('0x8'));var csv=require(_0xdb56('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb56('0xa'));var squel=require(_0xdb56('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb56('0xc'));var deskjs=require(_0xdb56('0xd'));var toCsv=require(_0xdb56('0x9'));var querystring=require('querystring');var Papa=require(_0xdb56('0xe'));var Redis=require(_0xdb56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdb56('0x10'));var as=require(_0xdb56('0x11'));var hardwareService=require(_0xdb56('0x12'));var logger=require(_0xdb56('0x13'))('api');var utils=require(_0xdb56('0x14'));var config=require(_0xdb56('0x15'));var licenseUtil=require(_0xdb56('0x16'));var db=require(_0xdb56('0x17'))['db'];var integrations=require(_0xdb56('0x18'));function respondWithStatusCode(_0xae9a2a,_0x18cce6){_0x18cce6=_0x18cce6||0xcc;return function(_0xb5a17e){if(_0xb5a17e){return _0xae9a2a['sendStatus'](_0x18cce6);}return _0xae9a2a[_0xdb56('0x19')](_0x18cce6)['end']();};}function respondWithResult(_0xee5e2a,_0x5828b4){_0x5828b4=_0x5828b4||0xc8;return function(_0x2d5335){if(_0x2d5335){return _0xee5e2a['status'](_0x5828b4)[_0xdb56('0x1a')](_0x2d5335);}};}function respondWithFilteredResult(_0x305f53,_0x1b29c7){return function(_0x1b2054){if(_0x1b2054){var _0x4aba9d=typeof _0x1b29c7[_0xdb56('0x1b')]==='undefined'&&typeof _0x1b29c7[_0xdb56('0x1c')]===_0xdb56('0x1d');var _0x448860=_0x1b2054[_0xdb56('0x1e')];var _0x12f03d=_0x4aba9d?0x0:_0x1b29c7[_0xdb56('0x1b')];var _0xa3649f=_0x4aba9d?_0x1b2054[_0xdb56('0x1e')]:_0x1b29c7['offset']+_0x1b29c7[_0xdb56('0x1c')];var _0x3d9240;if(_0xa3649f>=_0x448860){_0xa3649f=_0x448860;_0x3d9240=0xc8;}else{_0x3d9240=0xce;}_0x305f53[_0xdb56('0x19')](_0x3d9240);return _0x305f53['set'](_0xdb56('0x1f'),_0x12f03d+'-'+_0xa3649f+'/'+_0x448860)[_0xdb56('0x1a')](_0x1b2054);}return null;};}function patchUpdates(_0x14ef5f){return function(_0x1e1ab6){try{jsonpatch[_0xdb56('0x20')](_0x1e1ab6,_0x14ef5f,!![]);}catch(_0x3b4865){return BPromise['reject'](_0x3b4865);}return _0x1e1ab6['save']();};}function saveUpdates(_0x3a2b7b,_0x4347b4){return function(_0xcaff29){if(_0xcaff29){return _0xcaff29['update'](_0x3a2b7b)[_0xdb56('0x21')](function(_0x4613da){return _0x4613da;});}return null;};}function removeEntity(_0x947bd7,_0x5e3a15){return function(_0x22ecc4){if(_0x22ecc4){return _0x22ecc4[_0xdb56('0x22')]()[_0xdb56('0x21')](function(){_0x947bd7[_0xdb56('0x19')](0xcc)[_0xdb56('0x23')]();});}};}function handleEntityNotFound(_0xc4a300,_0x313417){return function(_0x56aebb){if(!_0x56aebb){_0xc4a300['sendStatus'](0x194);}return _0x56aebb;};}function handleError(_0x3202d8,_0x487c80){_0x487c80=_0x487c80||0x1f4;return function(_0x3957e2){logger['error'](_0x3957e2['stack']);if(_0x3957e2['name']){delete _0x3957e2[_0xdb56('0x24')];}_0x3202d8['status'](_0x487c80)[_0xdb56('0x25')](_0x3957e2);};}exports[_0xdb56('0x26')]=function(_0x12a49a,_0xf6bd75){var _0xfd5073={},_0x346727={},_0x42d30e={'count':0x0,'rows':[]};var _0x210c10=_[_0xdb56('0x27')](db[_0xdb56('0x28')][_0xdb56('0x29')],function(_0x3c8234){return{'name':_0x3c8234[_0xdb56('0x2a')],'type':_0x3c8234[_0xdb56('0x2b')]['key']};});_0x346727[_0xdb56('0x2c')]=_[_0xdb56('0x27')](_0x210c10,_0xdb56('0x24'));_0x346727[_0xdb56('0x2d')]=_[_0xdb56('0x2e')](_0x12a49a[_0xdb56('0x2d')]);_0x346727[_0xdb56('0x2f')]=_['intersection'](_0x346727[_0xdb56('0x2c')],_0x346727[_0xdb56('0x2d')]);_0xfd5073[_0xdb56('0x30')]=_[_0xdb56('0x31')](_0x346727[_0xdb56('0x2c')],qs[_0xdb56('0x32')](_0x12a49a[_0xdb56('0x2d')][_0xdb56('0x32')]));_0xfd5073[_0xdb56('0x30')]=_0xfd5073[_0xdb56('0x30')][_0xdb56('0x33')]?_0xfd5073['attributes']:_0x346727[_0xdb56('0x2c')];if(!_0x12a49a['query'][_0xdb56('0x34')](_0xdb56('0x35'))){_0xfd5073[_0xdb56('0x1c')]=qs[_0xdb56('0x1c')](_0x12a49a[_0xdb56('0x2d')][_0xdb56('0x1c')]);_0xfd5073['offset']=qs[_0xdb56('0x1b')](_0x12a49a[_0xdb56('0x2d')]['offset']);}_0xfd5073[_0xdb56('0x36')]=qs['sort'](_0x12a49a['query'][_0xdb56('0x37')]);_0xfd5073['where']=qs[_0xdb56('0x2f')](_['pick'](_0x12a49a[_0xdb56('0x2d')],_0x346727[_0xdb56('0x2f')]),_0x210c10);if(_0x12a49a['query'][_0xdb56('0x38')]){_0xfd5073[_0xdb56('0x39')]=_[_0xdb56('0x3a')](_0xfd5073[_0xdb56('0x39')],{'$or':_['map'](_0x210c10,function(_0x2c67ad){if(_0x2c67ad[_0xdb56('0x2b')]!=='VIRTUAL'){var _0x32b0f5={};_0x32b0f5[_0x2c67ad[_0xdb56('0x24')]]={'$like':'%'+_0x12a49a['query'][_0xdb56('0x38')]+'%'};return _0x32b0f5;}})});}_0xfd5073=_['merge']({},_0xfd5073,_0x12a49a['options']);var _0x5ad5f1={'where':_0xfd5073['where']};return db[_0xdb56('0x28')][_0xdb56('0x1e')](_0x5ad5f1)[_0xdb56('0x21')](function(_0x5e70c5){_0x42d30e[_0xdb56('0x1e')]=_0x5e70c5;if(_0x12a49a[_0xdb56('0x2d')][_0xdb56('0x3b')]){_0xfd5073[_0xdb56('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xdb56('0x3d')](_0xfd5073);})['then'](function(_0x358231){_0x42d30e[_0xdb56('0x3e')]=_0x358231;return _0x42d30e;})['then'](respondWithFilteredResult(_0xf6bd75,_0xfd5073))[_0xdb56('0x3f')](handleError(_0xf6bd75,null));};exports[_0xdb56('0x40')]=function(_0x21232e,_0x2362e3){var _0x168355={'raw':![],'where':{'id':_0x21232e[_0xdb56('0x41')]['id']}},_0x1a32f3={};_0x1a32f3[_0xdb56('0x2c')]=_[_0xdb56('0x2e')](db[_0xdb56('0x28')][_0xdb56('0x29')]);_0x1a32f3['query']=_['keys'](_0x21232e['query']);_0x1a32f3[_0xdb56('0x2f')]=_[_0xdb56('0x31')](_0x1a32f3['model'],_0x1a32f3['query']);_0x168355[_0xdb56('0x30')]=_[_0xdb56('0x31')](_0x1a32f3[_0xdb56('0x2c')],qs[_0xdb56('0x32')](_0x21232e[_0xdb56('0x2d')]['fields']));_0x168355[_0xdb56('0x30')]=_0x168355[_0xdb56('0x30')][_0xdb56('0x33')]?_0x168355['attributes']:_0x1a32f3[_0xdb56('0x2c')];if(_0x21232e['query'][_0xdb56('0x3b')]){_0x168355['include']=[{'all':!![]}];}_0x168355=_[_0xdb56('0x3a')]({},_0x168355,_0x21232e[_0xdb56('0x42')]);return db['FreshsalesAccount']['find'](_0x168355)[_0xdb56('0x21')](handleEntityNotFound(_0x2362e3,null))[_0xdb56('0x21')](respondWithResult(_0x2362e3,null))[_0xdb56('0x3f')](handleError(_0x2362e3,null));};exports[_0xdb56('0x43')]=function(_0x2f4f76,_0x325804){return db[_0xdb56('0x28')]['create'](_0x2f4f76['body'],{})[_0xdb56('0x21')](respondWithResult(_0x325804,0xc9))[_0xdb56('0x3f')](handleError(_0x325804,null));};exports[_0xdb56('0x44')]=function(_0x491f00,_0x37c3b6){if(_0x491f00[_0xdb56('0x45')]['id']){delete _0x491f00[_0xdb56('0x45')]['id'];}return db[_0xdb56('0x28')]['find']({'where':{'id':_0x491f00[_0xdb56('0x41')]['id']}})[_0xdb56('0x21')](handleEntityNotFound(_0x37c3b6,null))[_0xdb56('0x21')](saveUpdates(_0x491f00['body'],null))[_0xdb56('0x21')](respondWithResult(_0x37c3b6,null))[_0xdb56('0x3f')](handleError(_0x37c3b6,null));};exports[_0xdb56('0x22')]=function(_0x3ae216,_0x1754df){return db[_0xdb56('0x28')][_0xdb56('0x46')]({'where':{'id':_0x3ae216['params']['id']}})[_0xdb56('0x21')](handleEntityNotFound(_0x1754df,null))[_0xdb56('0x21')](removeEntity(_0x1754df,null))[_0xdb56('0x3f')](handleError(_0x1754df,null));};exports[_0xdb56('0x47')]=function(_0x3fba0b,_0x5befc1,_0x101cd9){var _0x539cc1={};var _0x498227={};var _0x2e0a93;var _0x366703;return db[_0xdb56('0x28')][_0xdb56('0x48')]({'where':{'id':_0x3fba0b['params']['id']}})[_0xdb56('0x21')](handleEntityNotFound(_0x5befc1,null))[_0xdb56('0x21')](function(_0x494489){if(_0x494489){_0x2e0a93=_0x494489;_0x498227[_0xdb56('0x2c')]=_[_0xdb56('0x2e')](db[_0xdb56('0x49')][_0xdb56('0x29')]);_0x498227[_0xdb56('0x2d')]=_[_0xdb56('0x2e')](_0x3fba0b['query']);_0x498227[_0xdb56('0x2f')]=_[_0xdb56('0x31')](_0x498227['model'],_0x498227['query']);_0x539cc1['attributes']=_[_0xdb56('0x31')](_0x498227[_0xdb56('0x2c')],qs[_0xdb56('0x32')](_0x3fba0b[_0xdb56('0x2d')][_0xdb56('0x32')]));_0x539cc1[_0xdb56('0x30')]=_0x539cc1[_0xdb56('0x30')][_0xdb56('0x33')]?_0x539cc1[_0xdb56('0x30')]:_0x498227['model'];_0x539cc1[_0xdb56('0x36')]=qs[_0xdb56('0x37')](_0x3fba0b[_0xdb56('0x2d')][_0xdb56('0x37')]);_0x539cc1[_0xdb56('0x39')]=qs[_0xdb56('0x2f')](_[_0xdb56('0x4a')](_0x3fba0b[_0xdb56('0x2d')],_0x498227[_0xdb56('0x2f')]));if(_0x3fba0b[_0xdb56('0x2d')]['filter']){_0x539cc1['where']=_[_0xdb56('0x3a')](_0x539cc1[_0xdb56('0x39')],{'$or':_[_0xdb56('0x27')](_0x539cc1[_0xdb56('0x30')],function(_0x543bc6){var _0x5728b6={};_0x5728b6[_0x543bc6]={'$like':'%'+_0x3fba0b['query'][_0xdb56('0x38')]+'%'};return _0x5728b6;})});}_0x539cc1=_[_0xdb56('0x3a')]({},_0x539cc1,_0x3fba0b[_0xdb56('0x42')]);return _0x2e0a93[_0xdb56('0x47')](_0x539cc1);}})[_0xdb56('0x21')](function(_0x7050c9){if(_0x7050c9){_0x366703=_0x7050c9[_0xdb56('0x33')];if(!_0x3fba0b[_0xdb56('0x2d')]['hasOwnProperty'](_0xdb56('0x35'))){_0x539cc1[_0xdb56('0x1c')]=qs[_0xdb56('0x1c')](_0x3fba0b[_0xdb56('0x2d')]['limit']);_0x539cc1[_0xdb56('0x1b')]=qs['offset'](_0x3fba0b['query'][_0xdb56('0x1b')]);}return _0x2e0a93[_0xdb56('0x47')](_0x539cc1);}})['then'](function(_0x402d85){if(_0x402d85){return _0x402d85?{'count':_0x366703,'rows':_0x402d85}:null;}})[_0xdb56('0x21')](respondWithResult(_0x5befc1,null))[_0xdb56('0x3f')](handleError(_0x5befc1,null));};exports['addConfiguration']=function(_0x3157fd,_0x557490,_0x48f355){if(_0x3157fd[_0xdb56('0x45')]['id']){delete _0x3157fd['body']['id'];}return db['FreshsalesAccount'][_0xdb56('0x48')]({'where':{'id':_0x3157fd[_0xdb56('0x41')]['id']}})[_0xdb56('0x21')](handleEntityNotFound(_0x557490,null))[_0xdb56('0x21')](function(_0x181595){if(_0x181595){_0x3157fd[_0xdb56('0x45')][_0xdb56('0x4b')]=_0x181595['id'];_0x3157fd[_0xdb56('0x45')]['Subjects']=integrations[_0xdb56('0x4c')](_0x3157fd[_0xdb56('0x45')][_0xdb56('0x4d')],_0x3157fd['body'][_0xdb56('0x2b')]);_0x3157fd[_0xdb56('0x45')][_0xdb56('0x4e')]=integrations[_0xdb56('0x4f')](_0x3157fd[_0xdb56('0x45')][_0xdb56('0x4d')],_0x3157fd[_0xdb56('0x45')]['type']);return db['FreshsalesConfiguration'][_0xdb56('0x43')](_0x3157fd[_0xdb56('0x45')],{'include':[{'model':db[_0xdb56('0x50')],'as':_0xdb56('0x51')},{'model':db['FreshsalesField'],'as':_0xdb56('0x4e')}]});}return null;})['then'](respondWithResult(_0x557490,null))[_0xdb56('0x3f')](handleError(_0x557490,null));};exports[_0xdb56('0x52')]=function(_0x287354,_0x4bd801,_0x4087dc){var _0x73513f='';var _0x20e80e='';return db[_0xdb56('0x28')][_0xdb56('0x48')]({'where':{'id':_0x287354[_0xdb56('0x41')]['id']},'attributes':['id','username',_0xdb56('0x53'),_0xdb56('0x54')]})['then'](handleEntityNotFound(_0x4bd801,null))[_0xdb56('0x21')](function(_0x18c8d0){if(_0x18c8d0){_0x20e80e=_0x18c8d0[_0xdb56('0x55')];_0x73513f=_0x18c8d0[_0xdb56('0x53')];var _0x2c94cf=_0x18c8d0[_0xdb56('0x53')][_0xdb56('0x56')](-0x1);if(_0x2c94cf==='/'){_0x73513f=_0x73513f[_0xdb56('0x57')](0x0,_0x73513f[_0xdb56('0x58')](_0x2c94cf));}return rp({'method':'GET','uri':util[_0xdb56('0x59')](_0xdb56('0x5a'),_0x73513f,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x18c8d0[_0xdb56('0x54')]},'json':!![]});}})[_0xdb56('0x21')](function(_0x34fbf2){if(_0x34fbf2){var _0x1e1aee=_0x34fbf2[_0xdb56('0x5b')];var _0x2c1352=![];var _0xb59a45=null;for(_0xb59a45=0x0;_0xb59a45<_0x1e1aee['length'];_0xb59a45++){if(_0x1e1aee[_0xb59a45]['email']===_0x20e80e){_0x2c1352=!![];}}if(_0x2c1352){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xdb56('0x5c')});}}})[_0xdb56('0x21')](respondWithResult(_0x4bd801,null))[_0xdb56('0x3f')](function(_0x1246d7){var _0x3b7323=_0x287354[_0xdb56('0x2d')]['test']?0x1f4:_0x1246d7['statusCode']||0x1f4;logger[_0xdb56('0x5d')](_0xdb56('0x5e'),_0xdb56('0x52'),_0x3b7323,JSON[_0xdb56('0x5f')](_0x1246d7));delete _0x1246d7[_0xdb56('0x24')];if(_0x3b7323===0x191){_0x3b7323=0x190;}_0x4bd801[_0xdb56('0x19')](_0x3b7323)[_0xdb56('0x25')](_0x287354['query'][_0xdb56('0x60')]?{'message':_0xdb56('0x61'),'statusCode':_0x1246d7[_0xdb56('0x62')]}:_0x1246d7);});}; \ No newline at end of file +var _0x047c=['../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','sendStatus','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','catch','show','params','keys','includeAll','find','create','body','findOne','FreshsalesConfiguration','pick','options','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','Descriptions','channel','FreshsalesField','username','remoteUri','slice','lastIndexOf','format','%s%s','apiKey','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x047c,0x111));var _0xc047=function(_0x258690,_0x227ed1){_0x258690=_0x258690-0x0;var _0x261526=_0x047c[_0x258690];return _0x261526;};'use strict';var emlformat=require(_0xc047('0x0'));var rimraf=require(_0xc047('0x1'));var zipdir=require(_0xc047('0x2'));var jsonpatch=require(_0xc047('0x3'));var rp=require(_0xc047('0x4'));var moment=require(_0xc047('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc047('0x6'));var util=require('util');var path=require(_0xc047('0x7'));var sox=require(_0xc047('0x8'));var csv=require(_0xc047('0x9'));var ejs=require(_0xc047('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc047('0xb'));var crypto=require(_0xc047('0xc'));var jsforce=require(_0xc047('0xd'));var deskjs=require(_0xc047('0xe'));var toCsv=require(_0xc047('0x9'));var querystring=require(_0xc047('0xf'));var Papa=require(_0xc047('0x10'));var Redis=require(_0xc047('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc047('0x12'));var as=require(_0xc047('0x13'));var hardwareService=require(_0xc047('0x14'));var logger=require(_0xc047('0x15'))(_0xc047('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc047('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc047('0x18'));function respondWithStatusCode(_0x307c95,_0x119a7a){_0x119a7a=_0x119a7a||0xcc;return function(_0x10e429){if(_0x10e429){return _0x307c95['sendStatus'](_0x119a7a);}return _0x307c95[_0xc047('0x19')](_0x119a7a)[_0xc047('0x1a')]();};}function respondWithResult(_0x35fc62,_0x48944a){_0x48944a=_0x48944a||0xc8;return function(_0xfef2d1){if(_0xfef2d1){return _0x35fc62[_0xc047('0x19')](_0x48944a)[_0xc047('0x1b')](_0xfef2d1);}};}function respondWithFilteredResult(_0x2e28f0,_0x5a6604){return function(_0x4cda19){if(_0x4cda19){var _0x598d57=typeof _0x5a6604['offset']===_0xc047('0x1c')&&typeof _0x5a6604['limit']===_0xc047('0x1c');var _0x3ec032=_0x4cda19[_0xc047('0x1d')];var _0x5a615d=_0x598d57?0x0:_0x5a6604[_0xc047('0x1e')];var _0x5f2246=_0x598d57?_0x4cda19[_0xc047('0x1d')]:_0x5a6604['offset']+_0x5a6604[_0xc047('0x1f')];var _0xe6dc9c;if(_0x5f2246>=_0x3ec032){_0x5f2246=_0x3ec032;_0xe6dc9c=0xc8;}else{_0xe6dc9c=0xce;}_0x2e28f0[_0xc047('0x19')](_0xe6dc9c);return _0x2e28f0['set']('Content-Range',_0x5a615d+'-'+_0x5f2246+'/'+_0x3ec032)[_0xc047('0x1b')](_0x4cda19);}return null;};}function patchUpdates(_0x1f2259){return function(_0x2b5a59){try{jsonpatch[_0xc047('0x20')](_0x2b5a59,_0x1f2259,!![]);}catch(_0x5b4405){return BPromise[_0xc047('0x21')](_0x5b4405);}return _0x2b5a59[_0xc047('0x22')]();};}function saveUpdates(_0x5af5ad,_0x1f07e0){return function(_0x227d7f){if(_0x227d7f){return _0x227d7f[_0xc047('0x23')](_0x5af5ad)[_0xc047('0x24')](function(_0x95c102){return _0x95c102;});}return null;};}function removeEntity(_0x35f1d9,_0x53d893){return function(_0x3c93cf){if(_0x3c93cf){return _0x3c93cf['destroy']()[_0xc047('0x24')](function(){_0x35f1d9[_0xc047('0x19')](0xcc)[_0xc047('0x1a')]();});}};}function handleEntityNotFound(_0x1170fe,_0x461cb2){return function(_0x17a18f){if(!_0x17a18f){_0x1170fe[_0xc047('0x25')](0x194);}return _0x17a18f;};}function handleError(_0x1d278e,_0x1395da){_0x1395da=_0x1395da||0x1f4;return function(_0x3ddf66){logger['error'](_0x3ddf66[_0xc047('0x26')]);if(_0x3ddf66['name']){delete _0x3ddf66[_0xc047('0x27')];}_0x1d278e[_0xc047('0x19')](_0x1395da)[_0xc047('0x28')](_0x3ddf66);};}exports[_0xc047('0x29')]=function(_0x3ba79b,_0x9d6552){var _0x477709={},_0x45b8b8={},_0xa97abe={'count':0x0,'rows':[]};var _0x352276=_['map'](db[_0xc047('0x2a')][_0xc047('0x2b')],function(_0x361a35){return{'name':_0x361a35[_0xc047('0x2c')],'type':_0x361a35[_0xc047('0x2d')][_0xc047('0x2e')]};});_0x45b8b8[_0xc047('0x2f')]=_[_0xc047('0x30')](_0x352276,_0xc047('0x27'));_0x45b8b8[_0xc047('0x31')]=_['keys'](_0x3ba79b[_0xc047('0x31')]);_0x45b8b8[_0xc047('0x32')]=_[_0xc047('0x33')](_0x45b8b8[_0xc047('0x2f')],_0x45b8b8[_0xc047('0x31')]);_0x477709['attributes']=_[_0xc047('0x33')](_0x45b8b8[_0xc047('0x2f')],qs[_0xc047('0x34')](_0x3ba79b['query'][_0xc047('0x34')]));_0x477709[_0xc047('0x35')]=_0x477709[_0xc047('0x35')][_0xc047('0x36')]?_0x477709[_0xc047('0x35')]:_0x45b8b8[_0xc047('0x2f')];if(!_0x3ba79b[_0xc047('0x31')][_0xc047('0x37')]('nolimit')){_0x477709[_0xc047('0x1f')]=qs[_0xc047('0x1f')](_0x3ba79b['query']['limit']);_0x477709[_0xc047('0x1e')]=qs[_0xc047('0x1e')](_0x3ba79b[_0xc047('0x31')][_0xc047('0x1e')]);}_0x477709[_0xc047('0x38')]=qs['sort'](_0x3ba79b[_0xc047('0x31')][_0xc047('0x39')]);_0x477709[_0xc047('0x3a')]=qs[_0xc047('0x32')](_['pick'](_0x3ba79b['query'],_0x45b8b8[_0xc047('0x32')]),_0x352276);if(_0x3ba79b[_0xc047('0x31')][_0xc047('0x3b')]){_0x477709[_0xc047('0x3a')]=_[_0xc047('0x3c')](_0x477709[_0xc047('0x3a')],{'$or':_[_0xc047('0x30')](_0x352276,function(_0x58ace5){if(_0x58ace5['type']!==_0xc047('0x3d')){var _0x5a73a2={};_0x5a73a2[_0x58ace5[_0xc047('0x27')]]={'$like':'%'+_0x3ba79b['query'][_0xc047('0x3b')]+'%'};return _0x5a73a2;}})});}_0x477709=_[_0xc047('0x3c')]({},_0x477709,_0x3ba79b['options']);var _0x23cb8c={'where':_0x477709[_0xc047('0x3a')]};return db['FreshsalesAccount']['count'](_0x23cb8c)[_0xc047('0x24')](function(_0xe94c0e){_0xa97abe[_0xc047('0x1d')]=_0xe94c0e;if(_0x3ba79b[_0xc047('0x31')]['includeAll']){_0x477709[_0xc047('0x3e')]=[{'all':!![]}];}return db[_0xc047('0x2a')]['findAll'](_0x477709);})[_0xc047('0x24')](function(_0x52a138){_0xa97abe['rows']=_0x52a138;return _0xa97abe;})[_0xc047('0x24')](respondWithFilteredResult(_0x9d6552,_0x477709))[_0xc047('0x3f')](handleError(_0x9d6552,null));};exports[_0xc047('0x40')]=function(_0x564984,_0x419d40){var _0x4a10f3={'raw':![],'where':{'id':_0x564984[_0xc047('0x41')]['id']}},_0x3320e9={};_0x3320e9[_0xc047('0x2f')]=_[_0xc047('0x42')](db[_0xc047('0x2a')][_0xc047('0x2b')]);_0x3320e9[_0xc047('0x31')]=_[_0xc047('0x42')](_0x564984['query']);_0x3320e9[_0xc047('0x32')]=_[_0xc047('0x33')](_0x3320e9[_0xc047('0x2f')],_0x3320e9[_0xc047('0x31')]);_0x4a10f3['attributes']=_[_0xc047('0x33')](_0x3320e9[_0xc047('0x2f')],qs[_0xc047('0x34')](_0x564984[_0xc047('0x31')][_0xc047('0x34')]));_0x4a10f3[_0xc047('0x35')]=_0x4a10f3[_0xc047('0x35')][_0xc047('0x36')]?_0x4a10f3['attributes']:_0x3320e9[_0xc047('0x2f')];if(_0x564984['query'][_0xc047('0x43')]){_0x4a10f3[_0xc047('0x3e')]=[{'all':!![]}];}_0x4a10f3=_[_0xc047('0x3c')]({},_0x4a10f3,_0x564984['options']);return db[_0xc047('0x2a')][_0xc047('0x44')](_0x4a10f3)['then'](handleEntityNotFound(_0x419d40,null))[_0xc047('0x24')](respondWithResult(_0x419d40,null))[_0xc047('0x3f')](handleError(_0x419d40,null));};exports[_0xc047('0x45')]=function(_0x53f216,_0xd1fc0c){return db[_0xc047('0x2a')][_0xc047('0x45')](_0x53f216[_0xc047('0x46')],{})[_0xc047('0x24')](respondWithResult(_0xd1fc0c,0xc9))[_0xc047('0x3f')](handleError(_0xd1fc0c,null));};exports['update']=function(_0x410df8,_0x25c982){if(_0x410df8[_0xc047('0x46')]['id']){delete _0x410df8['body']['id'];}return db[_0xc047('0x2a')][_0xc047('0x44')]({'where':{'id':_0x410df8[_0xc047('0x41')]['id']}})['then'](handleEntityNotFound(_0x25c982,null))['then'](saveUpdates(_0x410df8[_0xc047('0x46')],null))[_0xc047('0x24')](respondWithResult(_0x25c982,null))[_0xc047('0x3f')](handleError(_0x25c982,null));};exports['destroy']=function(_0x975c32,_0x50e44c){return db[_0xc047('0x2a')][_0xc047('0x44')]({'where':{'id':_0x975c32['params']['id']}})[_0xc047('0x24')](handleEntityNotFound(_0x50e44c,null))[_0xc047('0x24')](removeEntity(_0x50e44c,null))['catch'](handleError(_0x50e44c,null));};exports['getConfigurations']=function(_0x36e7cd,_0x123769,_0x2de711){var _0x592441={};var _0xc6c834={};var _0x29a020;var _0x470a61;return db[_0xc047('0x2a')][_0xc047('0x47')]({'where':{'id':_0x36e7cd[_0xc047('0x41')]['id']}})[_0xc047('0x24')](handleEntityNotFound(_0x123769,null))[_0xc047('0x24')](function(_0x1fee3f){if(_0x1fee3f){_0x29a020=_0x1fee3f;_0xc6c834[_0xc047('0x2f')]=_[_0xc047('0x42')](db[_0xc047('0x48')][_0xc047('0x2b')]);_0xc6c834[_0xc047('0x31')]=_[_0xc047('0x42')](_0x36e7cd[_0xc047('0x31')]);_0xc6c834[_0xc047('0x32')]=_[_0xc047('0x33')](_0xc6c834[_0xc047('0x2f')],_0xc6c834[_0xc047('0x31')]);_0x592441[_0xc047('0x35')]=_[_0xc047('0x33')](_0xc6c834[_0xc047('0x2f')],qs[_0xc047('0x34')](_0x36e7cd[_0xc047('0x31')][_0xc047('0x34')]));_0x592441[_0xc047('0x35')]=_0x592441[_0xc047('0x35')][_0xc047('0x36')]?_0x592441[_0xc047('0x35')]:_0xc6c834['model'];_0x592441[_0xc047('0x38')]=qs[_0xc047('0x39')](_0x36e7cd[_0xc047('0x31')]['sort']);_0x592441[_0xc047('0x3a')]=qs[_0xc047('0x32')](_[_0xc047('0x49')](_0x36e7cd[_0xc047('0x31')],_0xc6c834[_0xc047('0x32')]));if(_0x36e7cd['query'][_0xc047('0x3b')]){_0x592441[_0xc047('0x3a')]=_[_0xc047('0x3c')](_0x592441['where'],{'$or':_[_0xc047('0x30')](_0x592441[_0xc047('0x35')],function(_0x2a814c){var _0x1998cf={};_0x1998cf[_0x2a814c]={'$like':'%'+_0x36e7cd[_0xc047('0x31')][_0xc047('0x3b')]+'%'};return _0x1998cf;})});}_0x592441=_['merge']({},_0x592441,_0x36e7cd[_0xc047('0x4a')]);return _0x29a020[_0xc047('0x4b')](_0x592441);}})[_0xc047('0x24')](function(_0x3d61c0){if(_0x3d61c0){_0x470a61=_0x3d61c0['length'];if(!_0x36e7cd[_0xc047('0x31')][_0xc047('0x37')](_0xc047('0x4c'))){_0x592441[_0xc047('0x1f')]=qs[_0xc047('0x1f')](_0x36e7cd[_0xc047('0x31')][_0xc047('0x1f')]);_0x592441['offset']=qs['offset'](_0x36e7cd[_0xc047('0x31')][_0xc047('0x1e')]);}return _0x29a020[_0xc047('0x4b')](_0x592441);}})[_0xc047('0x24')](function(_0x42fb8d){if(_0x42fb8d){return _0x42fb8d?{'count':_0x470a61,'rows':_0x42fb8d}:null;}})['then'](respondWithResult(_0x123769,null))[_0xc047('0x3f')](handleError(_0x123769,null));};exports[_0xc047('0x4d')]=function(_0x3a9516,_0x207b68,_0x20af76){if(_0x3a9516[_0xc047('0x46')]['id']){delete _0x3a9516[_0xc047('0x46')]['id'];}return db[_0xc047('0x2a')]['findOne']({'where':{'id':_0x3a9516[_0xc047('0x41')]['id']}})[_0xc047('0x24')](handleEntityNotFound(_0x207b68,null))['then'](function(_0x79f3f6){if(_0x79f3f6){_0x3a9516[_0xc047('0x46')][_0xc047('0x4e')]=_0x79f3f6['id'];_0x3a9516[_0xc047('0x46')][_0xc047('0x4f')]=integrations['getSubjects'](_0x3a9516[_0xc047('0x46')]['channel'],_0x3a9516[_0xc047('0x46')]['type']);_0x3a9516[_0xc047('0x46')][_0xc047('0x50')]=integrations['getDescriptions'](_0x3a9516['body'][_0xc047('0x51')],_0x3a9516['body']['type']);return db[_0xc047('0x48')][_0xc047('0x45')](_0x3a9516[_0xc047('0x46')],{'include':[{'model':db['FreshsalesField'],'as':_0xc047('0x4f')},{'model':db[_0xc047('0x52')],'as':_0xc047('0x50')}]});}return null;})['then'](respondWithResult(_0x207b68,null))[_0xc047('0x3f')](handleError(_0x207b68,null));};exports['getFields']=function(_0x35f858,_0x901d80,_0x4222fc){var _0x314ee9='';var _0x3d000b='';return db[_0xc047('0x2a')][_0xc047('0x47')]({'where':{'id':_0x35f858[_0xc047('0x41')]['id']},'attributes':['id',_0xc047('0x53'),_0xc047('0x54'),'apiKey']})['then'](handleEntityNotFound(_0x901d80,null))[_0xc047('0x24')](function(_0x4d1f47){if(_0x4d1f47){_0x3d000b=_0x4d1f47[_0xc047('0x53')];_0x314ee9=_0x4d1f47[_0xc047('0x54')];var _0x1d1e3a=_0x4d1f47[_0xc047('0x54')][_0xc047('0x55')](-0x1);if(_0x1d1e3a==='/'){_0x314ee9=_0x314ee9['substring'](0x0,_0x314ee9[_0xc047('0x56')](_0x1d1e3a));}return rp({'method':'GET','uri':util[_0xc047('0x57')](_0xc047('0x58'),_0x314ee9,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x4d1f47[_0xc047('0x59')]},'json':!![]});}})[_0xc047('0x24')](function(_0x332828){if(_0x332828){var _0x5d8e11=_0x332828['users'];var _0x26b562=![];var _0x1cb833=null;for(_0x1cb833=0x0;_0x1cb833<_0x5d8e11[_0xc047('0x36')];_0x1cb833++){if(_0x5d8e11[_0x1cb833][_0xc047('0x5a')]===_0x3d000b){_0x26b562=!![];}}if(_0x26b562){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xc047('0x24')](respondWithResult(_0x901d80,null))[_0xc047('0x3f')](function(_0x4a0906){var _0x259090=_0x35f858[_0xc047('0x31')][_0xc047('0x5b')]?0x1f4:_0x4a0906[_0xc047('0x5c')]||0x1f4;logger[_0xc047('0x5d')](_0xc047('0x5e'),_0xc047('0x5f'),_0x259090,JSON[_0xc047('0x60')](_0x4a0906));delete _0x4a0906[_0xc047('0x27')];if(_0x259090===0x191){_0x259090=0x190;}_0x901d80[_0xc047('0x19')](_0x259090)['send'](_0x35f858[_0xc047('0x31')]['test']?{'message':_0xc047('0x61'),'statusCode':_0x4a0906[_0xc047('0x5c')]}:_0x4a0906);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f23391d..e6dc44e 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts'];(function(_0x247384,_0xf7a348){var _0x41734e=function(_0x4d7406){while(--_0x4d7406){_0x247384['push'](_0x247384['shift']());}};_0x41734e(++_0xf7a348);}(_0x1261,0x144));var _0x1126=function(_0x571339,_0x5bcafb){_0x571339=_0x571339-0x0;var _0x5af8a6=_0x1261[_0x571339];return _0x5af8a6;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40ba58,_0x907180){return _0x40ba58['define'](_0x1126('0xa'),attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xadb5,0xad));var _0x5adb=function(_0x5bd170,_0x4659e1){_0x5bd170=_0x5bd170-0x0;var _0x18ad01=_0xadb5[_0x5bd170];return _0x18ad01;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5adb('0x7'));module[_0x5adb('0x8')]=function(_0x3e2555,_0x3213e8){return _0x3e2555[_0x5adb('0x9')](_0x5adb('0xa'),attributes,{'tableName':_0x5adb('0xb'),'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 43c7fd9..e0a36c4 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 _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x273fd1,_0x388bbe){_0x273fd1=_0x273fd1-0x0;var _0x5d3dbf=_0x0a6b[_0x273fd1];return _0x5d3dbf;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file +var _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 06edc79..e0b4ca2 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 _0x9f5a=['index','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9f5a,0x100));var _0xa9f5=function(_0x2fa385,_0x79d0d){_0x2fa385=_0x2fa385-0x0;var _0x97ff30=_0x9f5a[_0x2fa385];return _0x97ff30;};'use strict';var multer=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var path=require('path');var timeout=require(_0xa9f5('0x2'));var express=require(_0xa9f5('0x3'));var router=express['Router']();var fs_extra=require(_0xa9f5('0x4'));var auth=require(_0xa9f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f5('0x6'));var controller=require(_0xa9f5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9f5('0x8')]);router[_0xa9f5('0x9')]('/:id',auth[_0xa9f5('0xa')](),controller[_0xa9f5('0xb')]);router[_0xa9f5('0x9')](_0xa9f5('0xc'),auth[_0xa9f5('0xa')](),controller[_0xa9f5('0xd')]);router[_0xa9f5('0x9')](_0xa9f5('0xe'),auth['isAuthenticated'](),controller[_0xa9f5('0xf')]);router[_0xa9f5('0x9')](_0xa9f5('0x10'),auth[_0xa9f5('0xa')](),controller['getFields']);router[_0xa9f5('0x11')]('/',auth[_0xa9f5('0xa')](),controller[_0xa9f5('0x12')]);router[_0xa9f5('0x13')]('/:id',auth[_0xa9f5('0xa')](),controller[_0xa9f5('0x14')]);router[_0xa9f5('0x15')](_0xa9f5('0x16'),auth[_0xa9f5('0xa')](),controller[_0xa9f5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1a30=['/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','show','getSubjects','get','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete'];(function(_0x1b4ca5,_0xa03ed){var _0x5f28c3=function(_0x16fb55){while(--_0x16fb55){_0x1b4ca5['push'](_0x1b4ca5['shift']());}};_0x5f28c3(++_0xa03ed);}(_0x1a30,0xc3));var _0x01a3=function(_0x338290,_0x4cbcc0){_0x338290=_0x338290-0x0;var _0x1db04a=_0x1a30[_0x338290];return _0x1db04a;};'use strict';var multer=require(_0x01a3('0x0'));var util=require('util');var path=require(_0x01a3('0x1'));var timeout=require(_0x01a3('0x2'));var express=require('express');var router=express[_0x01a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x01a3('0x4'));var interaction=require(_0x01a3('0x5'));var config=require('../../config/environment');var controller=require(_0x01a3('0x6'));router['get']('/',auth[_0x01a3('0x7')](),controller[_0x01a3('0x8')]);router['get']('/:id',auth[_0x01a3('0x7')](),controller[_0x01a3('0x9')]);router['get']('/:id/subjects',auth[_0x01a3('0x7')](),controller[_0x01a3('0xa')]);router[_0x01a3('0xb')](_0x01a3('0xc'),auth[_0x01a3('0x7')](),controller[_0x01a3('0xd')]);router[_0x01a3('0xb')](_0x01a3('0xe'),auth[_0x01a3('0x7')](),controller[_0x01a3('0xf')]);router[_0x01a3('0x10')]('/',auth['isAuthenticated'](),controller[_0x01a3('0x11')]);router[_0x01a3('0x12')]('/:id',auth[_0x01a3('0x7')](),controller[_0x01a3('0x13')]);router[_0x01a3('0x14')](_0x01a3('0x15'),auth[_0x01a3('0x7')](),controller[_0x01a3('0x16')]);module[_0x01a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 73403fd..f99565b 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 _0xd9ce=['sequelize','STRING'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xd9ce,0x1c6));var _0xed9c=function(_0x5dc9f5,_0x5362c7){_0x5dc9f5=_0x5dc9f5-0x0;var _0x4faea5=_0xd9ce[_0x5dc9f5];return _0x4faea5;};'use strict';var Sequelize=require(_0xed9c('0x0'));module['exports']={'name':{'type':Sequelize[_0xed9c('0x1')]},'description':{'type':Sequelize[_0xed9c('0x1')]}}; \ No newline at end of file +var _0xf09b=['STRING','sequelize','exports'];(function(_0x5489b3,_0x405850){var _0x27c6e6=function(_0x4e87d1){while(--_0x4e87d1){_0x5489b3['push'](_0x5489b3['shift']());}};_0x27c6e6(++_0x405850);}(_0xf09b,0x94));var _0xbf09=function(_0x1634f7,_0x54fabf){_0x1634f7=_0x1634f7-0x0;var _0x1f314f=_0xf09b[_0x1634f7];return _0x1f314f;};'use strict';var Sequelize=require(_0xbf09('0x0'));module[_0xbf09('0x1')]={'name':{'type':Sequelize[_0xbf09('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8f8eece..caf2f2f 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 _0xe382=['params','includeAll','options','find','create','body','findOne','FreshsalesField','pick','getSubjects','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','catch','show'];(function(_0x2b33e8,_0x2e01fe){var _0x1e9cce=function(_0x2d4e95){while(--_0x2d4e95){_0x2b33e8['push'](_0x2b33e8['shift']());}};_0x1e9cce(++_0x2e01fe);}(_0xe382,0x150));var _0x2e38=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xe382[_0x38eb23];return _0x48506a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e38('0x0'));var zipdir=require(_0x2e38('0x1'));var jsonpatch=require(_0x2e38('0x2'));var rp=require(_0x2e38('0x3'));var moment=require(_0x2e38('0x4'));var BPromise=require(_0x2e38('0x5'));var Mustache=require(_0x2e38('0x6'));var util=require(_0x2e38('0x7'));var path=require(_0x2e38('0x8'));var sox=require('sox');var csv=require(_0x2e38('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e38('0xa'));var _=require('lodash');var squel=require(_0x2e38('0xb'));var crypto=require(_0x2e38('0xc'));var jsforce=require(_0x2e38('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2e38('0x9'));var querystring=require(_0x2e38('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2e38('0xf'));var qs=require(_0x2e38('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e38('0x11'));var logger=require(_0x2e38('0x12'))(_0x2e38('0x13'));var utils=require(_0x2e38('0x14'));var config=require(_0x2e38('0x15'));var licenseUtil=require(_0x2e38('0x16'));var db=require(_0x2e38('0x17'))['db'];function respondWithStatusCode(_0x419a15,_0x1c1059){_0x1c1059=_0x1c1059||0xcc;return function(_0x3dc39a){if(_0x3dc39a){return _0x419a15[_0x2e38('0x18')](_0x1c1059);}return _0x419a15[_0x2e38('0x19')](_0x1c1059)[_0x2e38('0x1a')]();};}function respondWithResult(_0x50ccdf,_0x48fc8f){_0x48fc8f=_0x48fc8f||0xc8;return function(_0x249cfe){if(_0x249cfe){return _0x50ccdf[_0x2e38('0x19')](_0x48fc8f)[_0x2e38('0x1b')](_0x249cfe);}};}function respondWithFilteredResult(_0x43929a,_0x24ae13){return function(_0x2637cb){if(_0x2637cb){var _0x1ada4d=typeof _0x24ae13[_0x2e38('0x1c')]===_0x2e38('0x1d')&&typeof _0x24ae13['limit']===_0x2e38('0x1d');var _0x50f811=_0x2637cb[_0x2e38('0x1e')];var _0x26779e=_0x1ada4d?0x0:_0x24ae13['offset'];var _0x339fbc=_0x1ada4d?_0x2637cb[_0x2e38('0x1e')]:_0x24ae13['offset']+_0x24ae13[_0x2e38('0x1f')];var _0x5297d4;if(_0x339fbc>=_0x50f811){_0x339fbc=_0x50f811;_0x5297d4=0xc8;}else{_0x5297d4=0xce;}_0x43929a['status'](_0x5297d4);return _0x43929a[_0x2e38('0x20')](_0x2e38('0x21'),_0x26779e+'-'+_0x339fbc+'/'+_0x50f811)[_0x2e38('0x1b')](_0x2637cb);}return null;};}function patchUpdates(_0x275a0c){return function(_0x4b4a25){try{jsonpatch[_0x2e38('0x22')](_0x4b4a25,_0x275a0c,!![]);}catch(_0x102b35){return BPromise[_0x2e38('0x23')](_0x102b35);}return _0x4b4a25[_0x2e38('0x24')]();};}function saveUpdates(_0x55fa6d,_0x2ba2a3){return function(_0x411748){if(_0x411748){return _0x411748[_0x2e38('0x25')](_0x55fa6d)[_0x2e38('0x26')](function(_0x12b0ad){return _0x12b0ad;});}return null;};}function removeEntity(_0x113e7f,_0x46ac7c){return function(_0x289b69){if(_0x289b69){return _0x289b69[_0x2e38('0x27')]()[_0x2e38('0x26')](function(){_0x113e7f[_0x2e38('0x19')](0xcc)[_0x2e38('0x1a')]();});}};}function handleEntityNotFound(_0x3a40e6,_0x4fba9f){return function(_0x2753c1){if(!_0x2753c1){_0x3a40e6[_0x2e38('0x18')](0x194);}return _0x2753c1;};}function handleError(_0x5df514,_0x129391){_0x129391=_0x129391||0x1f4;return function(_0x285faf){logger['error'](_0x285faf[_0x2e38('0x28')]);if(_0x285faf['name']){delete _0x285faf[_0x2e38('0x29')];}_0x5df514['status'](_0x129391)[_0x2e38('0x2a')](_0x285faf);};}exports[_0x2e38('0x2b')]=function(_0xcd7e2a,_0x3a583e){var _0x52ea4f={},_0x55b0c5={},_0xb7608c={'count':0x0,'rows':[]};var _0x5e397f=_[_0x2e38('0x2c')](db[_0x2e38('0x2d')][_0x2e38('0x2e')],function(_0x36e611){return{'name':_0x36e611[_0x2e38('0x2f')],'type':_0x36e611[_0x2e38('0x30')]['key']};});_0x55b0c5[_0x2e38('0x31')]=_[_0x2e38('0x2c')](_0x5e397f,'name');_0x55b0c5[_0x2e38('0x32')]=_[_0x2e38('0x33')](_0xcd7e2a[_0x2e38('0x32')]);_0x55b0c5['filters']=_[_0x2e38('0x34')](_0x55b0c5[_0x2e38('0x31')],_0x55b0c5[_0x2e38('0x32')]);_0x52ea4f[_0x2e38('0x35')]=_[_0x2e38('0x34')](_0x55b0c5[_0x2e38('0x31')],qs[_0x2e38('0x36')](_0xcd7e2a[_0x2e38('0x32')]['fields']));_0x52ea4f[_0x2e38('0x35')]=_0x52ea4f['attributes'][_0x2e38('0x37')]?_0x52ea4f[_0x2e38('0x35')]:_0x55b0c5[_0x2e38('0x31')];if(!_0xcd7e2a[_0x2e38('0x32')][_0x2e38('0x38')](_0x2e38('0x39'))){_0x52ea4f[_0x2e38('0x1f')]=qs[_0x2e38('0x1f')](_0xcd7e2a[_0x2e38('0x32')][_0x2e38('0x1f')]);_0x52ea4f[_0x2e38('0x1c')]=qs['offset'](_0xcd7e2a[_0x2e38('0x32')][_0x2e38('0x1c')]);}_0x52ea4f[_0x2e38('0x3a')]=qs[_0x2e38('0x3b')](_0xcd7e2a[_0x2e38('0x32')][_0x2e38('0x3b')]);_0x52ea4f[_0x2e38('0x3c')]=qs[_0x2e38('0x3d')](_['pick'](_0xcd7e2a[_0x2e38('0x32')],_0x55b0c5[_0x2e38('0x3d')]),_0x5e397f);if(_0xcd7e2a[_0x2e38('0x32')][_0x2e38('0x3e')]){_0x52ea4f[_0x2e38('0x3c')]=_[_0x2e38('0x3f')](_0x52ea4f[_0x2e38('0x3c')],{'$or':_[_0x2e38('0x2c')](_0x5e397f,function(_0x149b8c){if(_0x149b8c[_0x2e38('0x30')]!==_0x2e38('0x40')){var _0x42b1d4={};_0x42b1d4[_0x149b8c[_0x2e38('0x29')]]={'$like':'%'+_0xcd7e2a[_0x2e38('0x32')]['filter']+'%'};return _0x42b1d4;}})});}_0x52ea4f=_[_0x2e38('0x3f')]({},_0x52ea4f,_0xcd7e2a['options']);var _0x39b71a={'where':_0x52ea4f[_0x2e38('0x3c')]};return db['FreshsalesConfiguration'][_0x2e38('0x1e')](_0x39b71a)[_0x2e38('0x26')](function(_0x7ad3ae){_0xb7608c[_0x2e38('0x1e')]=_0x7ad3ae;if(_0xcd7e2a['query']['includeAll']){_0x52ea4f[_0x2e38('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2e38('0x42')](_0x52ea4f);})['then'](function(_0x4dfdf0){_0xb7608c['rows']=_0x4dfdf0;return _0xb7608c;})['then'](respondWithFilteredResult(_0x3a583e,_0x52ea4f))[_0x2e38('0x43')](handleError(_0x3a583e,null));};exports[_0x2e38('0x44')]=function(_0x29446a,_0x5e4ebe){var _0x9f6c03={'raw':![],'where':{'id':_0x29446a[_0x2e38('0x45')]['id']}},_0x184184={};_0x184184[_0x2e38('0x31')]=_[_0x2e38('0x33')](db[_0x2e38('0x2d')][_0x2e38('0x2e')]);_0x184184[_0x2e38('0x32')]=_[_0x2e38('0x33')](_0x29446a[_0x2e38('0x32')]);_0x184184[_0x2e38('0x3d')]=_['intersection'](_0x184184[_0x2e38('0x31')],_0x184184['query']);_0x9f6c03[_0x2e38('0x35')]=_['intersection'](_0x184184[_0x2e38('0x31')],qs[_0x2e38('0x36')](_0x29446a[_0x2e38('0x32')][_0x2e38('0x36')]));_0x9f6c03[_0x2e38('0x35')]=_0x9f6c03[_0x2e38('0x35')][_0x2e38('0x37')]?_0x9f6c03[_0x2e38('0x35')]:_0x184184['model'];if(_0x29446a[_0x2e38('0x32')][_0x2e38('0x46')]){_0x9f6c03[_0x2e38('0x41')]=[{'all':!![]}];}_0x9f6c03=_[_0x2e38('0x3f')]({},_0x9f6c03,_0x29446a[_0x2e38('0x47')]);return db[_0x2e38('0x2d')][_0x2e38('0x48')](_0x9f6c03)[_0x2e38('0x26')](handleEntityNotFound(_0x5e4ebe,null))[_0x2e38('0x26')](respondWithResult(_0x5e4ebe,null))[_0x2e38('0x43')](handleError(_0x5e4ebe,null));};exports['create']=function(_0x56bd4d,_0x2642b8){return db[_0x2e38('0x2d')][_0x2e38('0x49')](_0x56bd4d['body'],{})[_0x2e38('0x26')](respondWithResult(_0x2642b8,0xc9))['catch'](handleError(_0x2642b8,null));};exports['update']=function(_0xeae80,_0x133c85){if(_0xeae80[_0x2e38('0x4a')]['id']){delete _0xeae80['body']['id'];}return db[_0x2e38('0x2d')][_0x2e38('0x48')]({'where':{'id':_0xeae80[_0x2e38('0x45')]['id']}})['then'](handleEntityNotFound(_0x133c85,null))[_0x2e38('0x26')](saveUpdates(_0xeae80[_0x2e38('0x4a')],null))['then'](respondWithResult(_0x133c85,null))[_0x2e38('0x43')](handleError(_0x133c85,null));};exports[_0x2e38('0x27')]=function(_0x26fcb3,_0x1aa656){return db[_0x2e38('0x2d')]['find']({'where':{'id':_0x26fcb3[_0x2e38('0x45')]['id']}})[_0x2e38('0x26')](handleEntityNotFound(_0x1aa656,null))[_0x2e38('0x26')](removeEntity(_0x1aa656,null))[_0x2e38('0x43')](handleError(_0x1aa656,null));};exports['getSubjects']=function(_0x2cf516,_0x382b6b,_0x23dbf9){var _0x5dd787={};var _0x1c7d8b={};var _0x1450be;var _0x15619b;return db[_0x2e38('0x2d')][_0x2e38('0x4b')]({'where':{'id':_0x2cf516['params']['id']}})[_0x2e38('0x26')](handleEntityNotFound(_0x382b6b,null))[_0x2e38('0x26')](function(_0x4d113f){if(_0x4d113f){_0x1450be=_0x4d113f;_0x1c7d8b['model']=_[_0x2e38('0x33')](db[_0x2e38('0x4c')][_0x2e38('0x2e')]);_0x1c7d8b[_0x2e38('0x32')]=_[_0x2e38('0x33')](_0x2cf516[_0x2e38('0x32')]);_0x1c7d8b[_0x2e38('0x3d')]=_[_0x2e38('0x34')](_0x1c7d8b[_0x2e38('0x31')],_0x1c7d8b[_0x2e38('0x32')]);_0x5dd787['attributes']=_['intersection'](_0x1c7d8b[_0x2e38('0x31')],qs['fields'](_0x2cf516['query'][_0x2e38('0x36')]));_0x5dd787[_0x2e38('0x35')]=_0x5dd787[_0x2e38('0x35')][_0x2e38('0x37')]?_0x5dd787[_0x2e38('0x35')]:_0x1c7d8b['model'];_0x5dd787[_0x2e38('0x3a')]=qs[_0x2e38('0x3b')](_0x2cf516[_0x2e38('0x32')][_0x2e38('0x3b')]);_0x5dd787[_0x2e38('0x3c')]=qs[_0x2e38('0x3d')](_[_0x2e38('0x4d')](_0x2cf516[_0x2e38('0x32')],_0x1c7d8b[_0x2e38('0x3d')]));if(_0x2cf516[_0x2e38('0x32')]['filter']){_0x5dd787[_0x2e38('0x3c')]=_[_0x2e38('0x3f')](_0x5dd787[_0x2e38('0x3c')],{'$or':_['map'](_0x5dd787[_0x2e38('0x35')],function(_0x296f48){var _0x4503ef={};_0x4503ef[_0x296f48]={'$like':'%'+_0x2cf516[_0x2e38('0x32')][_0x2e38('0x3e')]+'%'};return _0x4503ef;})});}_0x5dd787=_[_0x2e38('0x3f')]({},_0x5dd787,_0x2cf516['options']);return _0x1450be[_0x2e38('0x4e')](_0x5dd787);}})['then'](function(_0x4d966d){if(_0x4d966d){_0x15619b=_0x4d966d['length'];if(!_0x2cf516[_0x2e38('0x32')][_0x2e38('0x38')]('nolimit')){_0x5dd787['limit']=qs[_0x2e38('0x1f')](_0x2cf516[_0x2e38('0x32')][_0x2e38('0x1f')]);_0x5dd787[_0x2e38('0x1c')]=qs[_0x2e38('0x1c')](_0x2cf516[_0x2e38('0x32')]['offset']);}return _0x1450be[_0x2e38('0x4e')](_0x5dd787);}})[_0x2e38('0x26')](function(_0x596f9e){if(_0x596f9e){return _0x596f9e?{'count':_0x15619b,'rows':_0x596f9e}:null;}})[_0x2e38('0x26')](respondWithResult(_0x382b6b,null))['catch'](handleError(_0x382b6b,null));};exports[_0x2e38('0x4f')]=function(_0x4a6cd8,_0x239792,_0x43a918){var _0x3d57a5={};var _0x1cc20b={};var _0x1c2745;var _0x4e1ac2;return db[_0x2e38('0x2d')][_0x2e38('0x4b')]({'where':{'id':_0x4a6cd8[_0x2e38('0x45')]['id']}})[_0x2e38('0x26')](handleEntityNotFound(_0x239792,null))['then'](function(_0x325b91){if(_0x325b91){_0x1c2745=_0x325b91;_0x1cc20b[_0x2e38('0x31')]=_['keys'](db[_0x2e38('0x4c')]['rawAttributes']);_0x1cc20b['query']=_[_0x2e38('0x33')](_0x4a6cd8[_0x2e38('0x32')]);_0x1cc20b['filters']=_['intersection'](_0x1cc20b['model'],_0x1cc20b[_0x2e38('0x32')]);_0x3d57a5[_0x2e38('0x35')]=_[_0x2e38('0x34')](_0x1cc20b['model'],qs[_0x2e38('0x36')](_0x4a6cd8[_0x2e38('0x32')][_0x2e38('0x36')]));_0x3d57a5['attributes']=_0x3d57a5[_0x2e38('0x35')][_0x2e38('0x37')]?_0x3d57a5[_0x2e38('0x35')]:_0x1cc20b[_0x2e38('0x31')];_0x3d57a5[_0x2e38('0x3a')]=qs[_0x2e38('0x3b')](_0x4a6cd8[_0x2e38('0x32')][_0x2e38('0x3b')]);_0x3d57a5[_0x2e38('0x3c')]=qs[_0x2e38('0x3d')](_['pick'](_0x4a6cd8[_0x2e38('0x32')],_0x1cc20b[_0x2e38('0x3d')]));if(_0x4a6cd8[_0x2e38('0x32')]['filter']){_0x3d57a5['where']=_['merge'](_0x3d57a5[_0x2e38('0x3c')],{'$or':_[_0x2e38('0x2c')](_0x3d57a5[_0x2e38('0x35')],function(_0x1da5f6){var _0x285cb2={};_0x285cb2[_0x1da5f6]={'$like':'%'+_0x4a6cd8[_0x2e38('0x32')][_0x2e38('0x3e')]+'%'};return _0x285cb2;})});}_0x3d57a5=_['merge']({},_0x3d57a5,_0x4a6cd8[_0x2e38('0x47')]);return _0x1c2745[_0x2e38('0x4f')](_0x3d57a5);}})['then'](function(_0x6cf77a){if(_0x6cf77a){_0x4e1ac2=_0x6cf77a[_0x2e38('0x37')];if(!_0x4a6cd8['query']['hasOwnProperty'](_0x2e38('0x39'))){_0x3d57a5['limit']=qs[_0x2e38('0x1f')](_0x4a6cd8[_0x2e38('0x32')][_0x2e38('0x1f')]);_0x3d57a5[_0x2e38('0x1c')]=qs['offset'](_0x4a6cd8[_0x2e38('0x32')][_0x2e38('0x1c')]);}return _0x1c2745['getDescriptions'](_0x3d57a5);}})[_0x2e38('0x26')](function(_0x257fba){if(_0x257fba){return _0x257fba?{'count':_0x4e1ac2,'rows':_0x257fba}:null;}})[_0x2e38('0x26')](respondWithResult(_0x239792,null))[_0x2e38('0x43')](handleError(_0x239792,null));};exports[_0x2e38('0x50')]=function(_0x227013,_0x484414,_0x1baa69){var _0x5a6fe4={};var _0x214405={};var _0x2a75ee;var _0x362542;return db[_0x2e38('0x2d')]['findOne']({'where':{'id':_0x227013[_0x2e38('0x45')]['id']}})['then'](handleEntityNotFound(_0x484414,null))['then'](function(_0x4ca0d2){if(_0x4ca0d2){_0x2a75ee=_0x4ca0d2;_0x214405[_0x2e38('0x31')]=_[_0x2e38('0x33')](db[_0x2e38('0x4c')]['rawAttributes']);_0x214405[_0x2e38('0x32')]=_[_0x2e38('0x33')](_0x227013['query']);_0x214405['filters']=_['intersection'](_0x214405[_0x2e38('0x31')],_0x214405[_0x2e38('0x32')]);_0x5a6fe4['attributes']=_['intersection'](_0x214405[_0x2e38('0x31')],qs[_0x2e38('0x36')](_0x227013[_0x2e38('0x32')][_0x2e38('0x36')]));_0x5a6fe4[_0x2e38('0x35')]=_0x5a6fe4[_0x2e38('0x35')][_0x2e38('0x37')]?_0x5a6fe4[_0x2e38('0x35')]:_0x214405[_0x2e38('0x31')];_0x5a6fe4[_0x2e38('0x3a')]=qs['sort'](_0x227013[_0x2e38('0x32')][_0x2e38('0x3b')]);_0x5a6fe4[_0x2e38('0x3c')]=qs[_0x2e38('0x3d')](_[_0x2e38('0x4d')](_0x227013['query'],_0x214405[_0x2e38('0x3d')]));if(_0x227013[_0x2e38('0x32')][_0x2e38('0x3e')]){_0x5a6fe4[_0x2e38('0x3c')]=_[_0x2e38('0x3f')](_0x5a6fe4['where'],{'$or':_[_0x2e38('0x2c')](_0x5a6fe4[_0x2e38('0x35')],function(_0x24675d){var _0x5631d8={};_0x5631d8[_0x24675d]={'$like':'%'+_0x227013['query'][_0x2e38('0x3e')]+'%'};return _0x5631d8;})});}_0x5a6fe4=_[_0x2e38('0x3f')]({},_0x5a6fe4,_0x227013[_0x2e38('0x47')]);return _0x2a75ee[_0x2e38('0x50')](_0x5a6fe4);}})['then'](function(_0x8e95fb){if(_0x8e95fb){_0x362542=_0x8e95fb[_0x2e38('0x37')];if(!_0x227013['query'][_0x2e38('0x38')]('nolimit')){_0x5a6fe4[_0x2e38('0x1f')]=qs[_0x2e38('0x1f')](_0x227013[_0x2e38('0x32')][_0x2e38('0x1f')]);_0x5a6fe4['offset']=qs['offset'](_0x227013[_0x2e38('0x32')][_0x2e38('0x1c')]);}return _0x2a75ee[_0x2e38('0x50')](_0x5a6fe4);}})[_0x2e38('0x26')](function(_0xc9e809){if(_0xc9e809){return _0xc9e809?{'count':_0x362542,'rows':_0xc9e809}:null;}})[_0x2e38('0x26')](respondWithResult(_0x484414,null))[_0x2e38('0x43')](handleError(_0x484414,null));}; \ No newline at end of file +var _0xef7e=['save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xef7e,0x125));var _0xeef7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef7e[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xeef7('0x0'));var rimraf=require(_0xeef7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef7('0x2'));var rp=require(_0xeef7('0x3'));var moment=require(_0xeef7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeef7('0x5'));var path=require('path');var sox=require(_0xeef7('0x6'));var csv=require(_0xeef7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeef7('0x8'));var squel=require(_0xeef7('0x9'));var crypto=require(_0xeef7('0xa'));var jsforce=require(_0xeef7('0xb'));var deskjs=require(_0xeef7('0xc'));var toCsv=require(_0xeef7('0x7'));var querystring=require(_0xeef7('0xd'));var Papa=require(_0xeef7('0xe'));var Redis=require(_0xeef7('0xf'));var authService=require(_0xeef7('0x10'));var qs=require(_0xeef7('0x11'));var as=require(_0xeef7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeef7('0x13'))('api');var utils=require(_0xeef7('0x14'));var config=require(_0xeef7('0x15'));var licenseUtil=require(_0xeef7('0x16'));var db=require(_0xeef7('0x17'))['db'];function respondWithStatusCode(_0x1ece89,_0x5c422f){_0x5c422f=_0x5c422f||0xcc;return function(_0x17f432){if(_0x17f432){return _0x1ece89[_0xeef7('0x18')](_0x5c422f);}return _0x1ece89[_0xeef7('0x19')](_0x5c422f)[_0xeef7('0x1a')]();};}function respondWithResult(_0x2b7994,_0x40406c){_0x40406c=_0x40406c||0xc8;return function(_0x538ec6){if(_0x538ec6){return _0x2b7994['status'](_0x40406c)[_0xeef7('0x1b')](_0x538ec6);}};}function respondWithFilteredResult(_0x480c30,_0x597098){return function(_0x36ed47){if(_0x36ed47){var _0x589c54=typeof _0x597098[_0xeef7('0x1c')]===_0xeef7('0x1d')&&typeof _0x597098[_0xeef7('0x1e')]===_0xeef7('0x1d');var _0x5300fd=_0x36ed47[_0xeef7('0x1f')];var _0x43618d=_0x589c54?0x0:_0x597098[_0xeef7('0x1c')];var _0x25f9af=_0x589c54?_0x36ed47[_0xeef7('0x1f')]:_0x597098[_0xeef7('0x1c')]+_0x597098[_0xeef7('0x1e')];var _0x3e1eee;if(_0x25f9af>=_0x5300fd){_0x25f9af=_0x5300fd;_0x3e1eee=0xc8;}else{_0x3e1eee=0xce;}_0x480c30[_0xeef7('0x19')](_0x3e1eee);return _0x480c30['set'](_0xeef7('0x20'),_0x43618d+'-'+_0x25f9af+'/'+_0x5300fd)[_0xeef7('0x1b')](_0x36ed47);}return null;};}function patchUpdates(_0x1e6345){return function(_0x1fa016){try{jsonpatch[_0xeef7('0x21')](_0x1fa016,_0x1e6345,!![]);}catch(_0x49b8ee){return BPromise[_0xeef7('0x22')](_0x49b8ee);}return _0x1fa016[_0xeef7('0x23')]();};}function saveUpdates(_0x1a7348,_0x11c25f){return function(_0xa1c2a1){if(_0xa1c2a1){return _0xa1c2a1[_0xeef7('0x24')](_0x1a7348)[_0xeef7('0x25')](function(_0x3dbaf6){return _0x3dbaf6;});}return null;};}function removeEntity(_0x2ef469,_0x975041){return function(_0xb6d7b7){if(_0xb6d7b7){return _0xb6d7b7[_0xeef7('0x26')]()[_0xeef7('0x25')](function(){_0x2ef469[_0xeef7('0x19')](0xcc)[_0xeef7('0x1a')]();});}};}function handleEntityNotFound(_0x4d1470,_0x2bae15){return function(_0x1f73ed){if(!_0x1f73ed){_0x4d1470[_0xeef7('0x18')](0x194);}return _0x1f73ed;};}function handleError(_0x294b54,_0x20227e){_0x20227e=_0x20227e||0x1f4;return function(_0x43a01f){logger[_0xeef7('0x27')](_0x43a01f[_0xeef7('0x28')]);if(_0x43a01f[_0xeef7('0x29')]){delete _0x43a01f[_0xeef7('0x29')];}_0x294b54['status'](_0x20227e)[_0xeef7('0x2a')](_0x43a01f);};}exports[_0xeef7('0x2b')]=function(_0x4c8fce,_0x2ea0ce){var _0x421438={},_0x28ffa6={},_0x150aea={'count':0x0,'rows':[]};var _0x15acc6=_[_0xeef7('0x2c')](db[_0xeef7('0x2d')][_0xeef7('0x2e')],function(_0x56b18b){return{'name':_0x56b18b['fieldName'],'type':_0x56b18b[_0xeef7('0x2f')][_0xeef7('0x30')]};});_0x28ffa6[_0xeef7('0x31')]=_[_0xeef7('0x2c')](_0x15acc6,_0xeef7('0x29'));_0x28ffa6[_0xeef7('0x32')]=_[_0xeef7('0x33')](_0x4c8fce[_0xeef7('0x32')]);_0x28ffa6['filters']=_[_0xeef7('0x34')](_0x28ffa6[_0xeef7('0x31')],_0x28ffa6['query']);_0x421438[_0xeef7('0x35')]=_[_0xeef7('0x34')](_0x28ffa6[_0xeef7('0x31')],qs[_0xeef7('0x36')](_0x4c8fce[_0xeef7('0x32')]['fields']));_0x421438[_0xeef7('0x35')]=_0x421438[_0xeef7('0x35')][_0xeef7('0x37')]?_0x421438['attributes']:_0x28ffa6[_0xeef7('0x31')];if(!_0x4c8fce[_0xeef7('0x32')][_0xeef7('0x38')]('nolimit')){_0x421438[_0xeef7('0x1e')]=qs[_0xeef7('0x1e')](_0x4c8fce[_0xeef7('0x32')][_0xeef7('0x1e')]);_0x421438['offset']=qs[_0xeef7('0x1c')](_0x4c8fce['query'][_0xeef7('0x1c')]);}_0x421438[_0xeef7('0x39')]=qs[_0xeef7('0x3a')](_0x4c8fce['query']['sort']);_0x421438[_0xeef7('0x3b')]=qs[_0xeef7('0x3c')](_[_0xeef7('0x3d')](_0x4c8fce[_0xeef7('0x32')],_0x28ffa6[_0xeef7('0x3c')]),_0x15acc6);if(_0x4c8fce[_0xeef7('0x32')]['filter']){_0x421438[_0xeef7('0x3b')]=_['merge'](_0x421438[_0xeef7('0x3b')],{'$or':_[_0xeef7('0x2c')](_0x15acc6,function(_0xdad2e8){if(_0xdad2e8[_0xeef7('0x2f')]!==_0xeef7('0x3e')){var _0x70f6ef={};_0x70f6ef[_0xdad2e8[_0xeef7('0x29')]]={'$like':'%'+_0x4c8fce[_0xeef7('0x32')][_0xeef7('0x3f')]+'%'};return _0x70f6ef;}})});}_0x421438=_[_0xeef7('0x40')]({},_0x421438,_0x4c8fce[_0xeef7('0x41')]);var _0x50d9b5={'where':_0x421438['where']};return db[_0xeef7('0x2d')][_0xeef7('0x1f')](_0x50d9b5)[_0xeef7('0x25')](function(_0x60d28a){_0x150aea[_0xeef7('0x1f')]=_0x60d28a;if(_0x4c8fce['query'][_0xeef7('0x42')]){_0x421438[_0xeef7('0x43')]=[{'all':!![]}];}return db[_0xeef7('0x2d')][_0xeef7('0x44')](_0x421438);})[_0xeef7('0x25')](function(_0x336313){_0x150aea[_0xeef7('0x45')]=_0x336313;return _0x150aea;})['then'](respondWithFilteredResult(_0x2ea0ce,_0x421438))['catch'](handleError(_0x2ea0ce,null));};exports[_0xeef7('0x46')]=function(_0x346698,_0x39090e){var _0x329b59={'raw':![],'where':{'id':_0x346698[_0xeef7('0x47')]['id']}},_0x413e10={};_0x413e10[_0xeef7('0x31')]=_['keys'](db['FreshsalesConfiguration'][_0xeef7('0x2e')]);_0x413e10['query']=_[_0xeef7('0x33')](_0x346698['query']);_0x413e10['filters']=_[_0xeef7('0x34')](_0x413e10[_0xeef7('0x31')],_0x413e10['query']);_0x329b59[_0xeef7('0x35')]=_['intersection'](_0x413e10[_0xeef7('0x31')],qs[_0xeef7('0x36')](_0x346698[_0xeef7('0x32')]['fields']));_0x329b59[_0xeef7('0x35')]=_0x329b59[_0xeef7('0x35')][_0xeef7('0x37')]?_0x329b59[_0xeef7('0x35')]:_0x413e10[_0xeef7('0x31')];if(_0x346698[_0xeef7('0x32')][_0xeef7('0x42')]){_0x329b59[_0xeef7('0x43')]=[{'all':!![]}];}_0x329b59=_[_0xeef7('0x40')]({},_0x329b59,_0x346698[_0xeef7('0x41')]);return db[_0xeef7('0x2d')][_0xeef7('0x48')](_0x329b59)['then'](handleEntityNotFound(_0x39090e,null))[_0xeef7('0x25')](respondWithResult(_0x39090e,null))['catch'](handleError(_0x39090e,null));};exports['create']=function(_0x111eb7,_0x1af30d){return db[_0xeef7('0x2d')][_0xeef7('0x49')](_0x111eb7[_0xeef7('0x4a')],{})['then'](respondWithResult(_0x1af30d,0xc9))[_0xeef7('0x4b')](handleError(_0x1af30d,null));};exports[_0xeef7('0x24')]=function(_0x22131e,_0x399bd2){if(_0x22131e[_0xeef7('0x4a')]['id']){delete _0x22131e[_0xeef7('0x4a')]['id'];}return db[_0xeef7('0x2d')][_0xeef7('0x48')]({'where':{'id':_0x22131e[_0xeef7('0x47')]['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0x399bd2,null))[_0xeef7('0x25')](saveUpdates(_0x22131e[_0xeef7('0x4a')],null))['then'](respondWithResult(_0x399bd2,null))[_0xeef7('0x4b')](handleError(_0x399bd2,null));};exports[_0xeef7('0x26')]=function(_0x38f4c8,_0x83fb45){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x38f4c8[_0xeef7('0x47')]['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0x83fb45,null))[_0xeef7('0x25')](removeEntity(_0x83fb45,null))[_0xeef7('0x4b')](handleError(_0x83fb45,null));};exports[_0xeef7('0x4c')]=function(_0x42d167,_0x212280,_0xaa181f){var _0x2f335b={};var _0x2d90d0={};var _0xe3eb20;var _0x4d18b6;return db['FreshsalesConfiguration'][_0xeef7('0x4d')]({'where':{'id':_0x42d167['params']['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0x212280,null))[_0xeef7('0x25')](function(_0x5cd4cc){if(_0x5cd4cc){_0xe3eb20=_0x5cd4cc;_0x2d90d0[_0xeef7('0x31')]=_[_0xeef7('0x33')](db[_0xeef7('0x4e')][_0xeef7('0x2e')]);_0x2d90d0['query']=_[_0xeef7('0x33')](_0x42d167['query']);_0x2d90d0[_0xeef7('0x3c')]=_[_0xeef7('0x34')](_0x2d90d0[_0xeef7('0x31')],_0x2d90d0[_0xeef7('0x32')]);_0x2f335b['attributes']=_[_0xeef7('0x34')](_0x2d90d0['model'],qs[_0xeef7('0x36')](_0x42d167['query'][_0xeef7('0x36')]));_0x2f335b[_0xeef7('0x35')]=_0x2f335b[_0xeef7('0x35')][_0xeef7('0x37')]?_0x2f335b[_0xeef7('0x35')]:_0x2d90d0['model'];_0x2f335b[_0xeef7('0x39')]=qs[_0xeef7('0x3a')](_0x42d167['query'][_0xeef7('0x3a')]);_0x2f335b[_0xeef7('0x3b')]=qs[_0xeef7('0x3c')](_[_0xeef7('0x3d')](_0x42d167[_0xeef7('0x32')],_0x2d90d0[_0xeef7('0x3c')]));if(_0x42d167[_0xeef7('0x32')][_0xeef7('0x3f')]){_0x2f335b[_0xeef7('0x3b')]=_[_0xeef7('0x40')](_0x2f335b[_0xeef7('0x3b')],{'$or':_[_0xeef7('0x2c')](_0x2f335b[_0xeef7('0x35')],function(_0x5a194c){var _0x560f62={};_0x560f62[_0x5a194c]={'$like':'%'+_0x42d167[_0xeef7('0x32')][_0xeef7('0x3f')]+'%'};return _0x560f62;})});}_0x2f335b=_['merge']({},_0x2f335b,_0x42d167[_0xeef7('0x41')]);return _0xe3eb20['getSubjects'](_0x2f335b);}})[_0xeef7('0x25')](function(_0x44d714){if(_0x44d714){_0x4d18b6=_0x44d714[_0xeef7('0x37')];if(!_0x42d167['query'][_0xeef7('0x38')](_0xeef7('0x4f'))){_0x2f335b[_0xeef7('0x1e')]=qs['limit'](_0x42d167[_0xeef7('0x32')][_0xeef7('0x1e')]);_0x2f335b['offset']=qs[_0xeef7('0x1c')](_0x42d167['query'][_0xeef7('0x1c')]);}return _0xe3eb20[_0xeef7('0x4c')](_0x2f335b);}})[_0xeef7('0x25')](function(_0x1cb3a3){if(_0x1cb3a3){return _0x1cb3a3?{'count':_0x4d18b6,'rows':_0x1cb3a3}:null;}})[_0xeef7('0x25')](respondWithResult(_0x212280,null))[_0xeef7('0x4b')](handleError(_0x212280,null));};exports[_0xeef7('0x50')]=function(_0x4cec5c,_0xd236e6,_0x518ded){var _0x128009={};var _0x7c4f6b={};var _0x53669a;var _0x3209b8;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4cec5c[_0xeef7('0x47')]['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0xd236e6,null))[_0xeef7('0x25')](function(_0x1db6dd){if(_0x1db6dd){_0x53669a=_0x1db6dd;_0x7c4f6b[_0xeef7('0x31')]=_[_0xeef7('0x33')](db['FreshsalesField'][_0xeef7('0x2e')]);_0x7c4f6b['query']=_[_0xeef7('0x33')](_0x4cec5c[_0xeef7('0x32')]);_0x7c4f6b[_0xeef7('0x3c')]=_[_0xeef7('0x34')](_0x7c4f6b[_0xeef7('0x31')],_0x7c4f6b[_0xeef7('0x32')]);_0x128009[_0xeef7('0x35')]=_[_0xeef7('0x34')](_0x7c4f6b[_0xeef7('0x31')],qs[_0xeef7('0x36')](_0x4cec5c[_0xeef7('0x32')]['fields']));_0x128009[_0xeef7('0x35')]=_0x128009['attributes'][_0xeef7('0x37')]?_0x128009[_0xeef7('0x35')]:_0x7c4f6b[_0xeef7('0x31')];_0x128009['order']=qs[_0xeef7('0x3a')](_0x4cec5c[_0xeef7('0x32')][_0xeef7('0x3a')]);_0x128009[_0xeef7('0x3b')]=qs[_0xeef7('0x3c')](_[_0xeef7('0x3d')](_0x4cec5c[_0xeef7('0x32')],_0x7c4f6b[_0xeef7('0x3c')]));if(_0x4cec5c[_0xeef7('0x32')][_0xeef7('0x3f')]){_0x128009['where']=_['merge'](_0x128009[_0xeef7('0x3b')],{'$or':_[_0xeef7('0x2c')](_0x128009[_0xeef7('0x35')],function(_0x3b862f){var _0xdcd67a={};_0xdcd67a[_0x3b862f]={'$like':'%'+_0x4cec5c[_0xeef7('0x32')][_0xeef7('0x3f')]+'%'};return _0xdcd67a;})});}_0x128009=_[_0xeef7('0x40')]({},_0x128009,_0x4cec5c[_0xeef7('0x41')]);return _0x53669a[_0xeef7('0x50')](_0x128009);}})['then'](function(_0x5940bd){if(_0x5940bd){_0x3209b8=_0x5940bd[_0xeef7('0x37')];if(!_0x4cec5c['query']['hasOwnProperty'](_0xeef7('0x4f'))){_0x128009[_0xeef7('0x1e')]=qs[_0xeef7('0x1e')](_0x4cec5c[_0xeef7('0x32')]['limit']);_0x128009[_0xeef7('0x1c')]=qs[_0xeef7('0x1c')](_0x4cec5c[_0xeef7('0x32')][_0xeef7('0x1c')]);}return _0x53669a['getDescriptions'](_0x128009);}})[_0xeef7('0x25')](function(_0x33a9ee){if(_0x33a9ee){return _0x33a9ee?{'count':_0x3209b8,'rows':_0x33a9ee}:null;}})[_0xeef7('0x25')](respondWithResult(_0xd236e6,null))[_0xeef7('0x4b')](handleError(_0xd236e6,null));};exports[_0xeef7('0x51')]=function(_0x427398,_0x5d151a,_0x1dc4f1){var _0x4446f5={};var _0x551486={};var _0x2684d2;var _0x43d91d;return db[_0xeef7('0x2d')][_0xeef7('0x4d')]({'where':{'id':_0x427398[_0xeef7('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d151a,null))[_0xeef7('0x25')](function(_0xd6d30d){if(_0xd6d30d){_0x2684d2=_0xd6d30d;_0x551486[_0xeef7('0x31')]=_['keys'](db[_0xeef7('0x4e')][_0xeef7('0x2e')]);_0x551486[_0xeef7('0x32')]=_[_0xeef7('0x33')](_0x427398[_0xeef7('0x32')]);_0x551486[_0xeef7('0x3c')]=_[_0xeef7('0x34')](_0x551486[_0xeef7('0x31')],_0x551486[_0xeef7('0x32')]);_0x4446f5[_0xeef7('0x35')]=_[_0xeef7('0x34')](_0x551486[_0xeef7('0x31')],qs['fields'](_0x427398['query'][_0xeef7('0x36')]));_0x4446f5[_0xeef7('0x35')]=_0x4446f5[_0xeef7('0x35')]['length']?_0x4446f5[_0xeef7('0x35')]:_0x551486[_0xeef7('0x31')];_0x4446f5[_0xeef7('0x39')]=qs[_0xeef7('0x3a')](_0x427398[_0xeef7('0x32')][_0xeef7('0x3a')]);_0x4446f5[_0xeef7('0x3b')]=qs[_0xeef7('0x3c')](_[_0xeef7('0x3d')](_0x427398[_0xeef7('0x32')],_0x551486[_0xeef7('0x3c')]));if(_0x427398[_0xeef7('0x32')][_0xeef7('0x3f')]){_0x4446f5[_0xeef7('0x3b')]=_[_0xeef7('0x40')](_0x4446f5[_0xeef7('0x3b')],{'$or':_[_0xeef7('0x2c')](_0x4446f5[_0xeef7('0x35')],function(_0x1e80c6){var _0x186e87={};_0x186e87[_0x1e80c6]={'$like':'%'+_0x427398[_0xeef7('0x32')]['filter']+'%'};return _0x186e87;})});}_0x4446f5=_[_0xeef7('0x40')]({},_0x4446f5,_0x427398[_0xeef7('0x41')]);return _0x2684d2['getFields'](_0x4446f5);}})['then'](function(_0x346bae){if(_0x346bae){_0x43d91d=_0x346bae[_0xeef7('0x37')];if(!_0x427398['query'][_0xeef7('0x38')](_0xeef7('0x4f'))){_0x4446f5[_0xeef7('0x1e')]=qs[_0xeef7('0x1e')](_0x427398[_0xeef7('0x32')][_0xeef7('0x1e')]);_0x4446f5[_0xeef7('0x1c')]=qs[_0xeef7('0x1c')](_0x427398['query']['offset']);}return _0x2684d2[_0xeef7('0x51')](_0x4446f5);}})[_0xeef7('0x25')](function(_0x409d44){if(_0x409d44){return _0x409d44?{'count':_0x43d91d,'rows':_0x409d44}:null;}})[_0xeef7('0x25')](respondWithResult(_0x5d151a,null))['catch'](handleError(_0x5d151a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index df6d431..d715faa 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 _0x4dac=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x2464a,_0x1905f3){var _0xda20df=function(_0x4b551a){while(--_0x4b551a){_0x2464a['push'](_0x2464a['shift']());}};_0xda20df(++_0x1905f3);}(_0x4dac,0x19d));var _0xc4da=function(_0x2d4c59,_0xc7dea0){_0x2d4c59=_0x2d4c59-0x0;var _0x134b9b=_0x4dac[_0x2d4c59];return _0x134b9b;};'use strict';var _=require(_0xc4da('0x0'));var util=require(_0xc4da('0x1'));var logger=require(_0xc4da('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc4da('0x3'));var rp=require(_0xc4da('0x4'));var fs=require('fs');var path=require(_0xc4da('0x5'));var rimraf=require(_0xc4da('0x6'));var config=require(_0xc4da('0x7'));var attributes=require(_0xc4da('0x8'));module[_0xc4da('0x9')]=function(_0x35d2ba,_0x276a5c){return _0x35d2ba[_0xc4da('0xa')](_0xc4da('0xb'),attributes,{'tableName':_0xc4da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5b2=['util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations'];(function(_0x49bde9,_0x35565c){var _0x1068b7=function(_0x509a6c){while(--_0x509a6c){_0x49bde9['push'](_0x49bde9['shift']());}};_0x1068b7(++_0x35565c);}(_0xa5b2,0x18c));var _0x2a5b=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0xa5b2[_0x7f3667];return _0x2c4c24;};'use strict';var _=require('lodash');var util=require(_0x2a5b('0x0'));var logger=require(_0x2a5b('0x1'))(_0x2a5b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a5b('0x3'));var fs=require('fs');var path=require(_0x2a5b('0x4'));var rimraf=require('rimraf');var config=require(_0x2a5b('0x5'));var attributes=require(_0x2a5b('0x6'));module['exports']=function(_0x301e92,_0x358fb3){return _0x301e92[_0x2a5b('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0x2a5b('0x8'),'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 98858a6..d272548 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 _0x5f0f=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x5f0f,0xbe));var _0xf5f0=function(_0x23a398,_0x544648){_0x23a398=_0x23a398-0x0;var _0x5077de=_0x5f0f[_0x23a398];return _0x5077de;};'use strict';var _=require(_0xf5f0('0x0'));var util=require('util');var moment=require(_0xf5f0('0x1'));var BPromise=require(_0xf5f0('0x2'));var rs=require(_0xf5f0('0x3'));var fs=require('fs');var Redis=require(_0xf5f0('0x4'));var db=require(_0xf5f0('0x5'))['db'];var utils=require(_0xf5f0('0x6'));var logger=require(_0xf5f0('0x7'))('rpc');var config=require(_0xf5f0('0x8'));var jayson=require(_0xf5f0('0x9'));var client=jayson[_0xf5f0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2da6eb,_0x1a1f50,_0x1ca695){return new BPromise(function(_0x5c9ecc,_0x281197){return client[_0xf5f0('0xb')](_0x2da6eb,_0x1ca695)['then'](function(_0x5efc2f){logger['info'](_0xf5f0('0xc'),_0x1a1f50,_0xf5f0('0xd'));logger[_0xf5f0('0xe')](_0xf5f0('0xf'),_0x1a1f50,_0xf5f0('0xd'),JSON['stringify'](_0x5efc2f));if(_0x5efc2f[_0xf5f0('0x10')]){if(_0x5efc2f['error'][_0xf5f0('0x11')]===0x1f4){logger[_0xf5f0('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a1f50,_0x5efc2f[_0xf5f0('0x10')][_0xf5f0('0x12')]);return _0x281197(_0x5efc2f[_0xf5f0('0x10')]['message']);}logger[_0xf5f0('0x10')](_0xf5f0('0xc'),_0x1a1f50,_0x5efc2f['error'][_0xf5f0('0x12')]);return _0x5c9ecc(_0x5efc2f['error'][_0xf5f0('0x12')]);}else{logger['info'](_0xf5f0('0xc'),_0x1a1f50,_0xf5f0('0xd'));_0x5c9ecc(_0x5efc2f[_0xf5f0('0x13')][_0xf5f0('0x12')]);}})[_0xf5f0('0x14')](function(_0xea778d){logger[_0xf5f0('0x10')](_0xf5f0('0xc'),_0x1a1f50,_0xea778d);_0x281197(_0xea778d);});});} \ No newline at end of file +var _0x5321=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x5321,0x1dd));var _0x1532=function(_0x4be37b,_0x418d39){_0x4be37b=_0x4be37b-0x0;var _0x416a2e=_0x5321[_0x4be37b];return _0x416a2e;};'use strict';var _=require(_0x1532('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1532('0x1'));var fs=require('fs');var Redis=require(_0x1532('0x2'));var db=require(_0x1532('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1532('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1532('0x5'));var client=jayson['client'][_0x1532('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3bdb14,_0x2a5030,_0x409f2c){return new BPromise(function(_0x51257f,_0x41c4bf){return client[_0x1532('0x7')](_0x3bdb14,_0x409f2c)[_0x1532('0x8')](function(_0x2f29c6){logger[_0x1532('0x9')](_0x1532('0xa'),_0x2a5030,_0x1532('0xb'));logger[_0x1532('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2a5030,_0x1532('0xb'),JSON['stringify'](_0x2f29c6));if(_0x2f29c6['error']){if(_0x2f29c6[_0x1532('0xd')][_0x1532('0xe')]===0x1f4){logger[_0x1532('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2a5030,_0x2f29c6['error'][_0x1532('0xf')]);return _0x41c4bf(_0x2f29c6[_0x1532('0xd')]['message']);}logger[_0x1532('0xd')](_0x1532('0xa'),_0x2a5030,_0x2f29c6[_0x1532('0xd')]['message']);return _0x51257f(_0x2f29c6[_0x1532('0xd')][_0x1532('0xf')]);}else{logger[_0x1532('0x9')](_0x1532('0xa'),_0x2a5030,_0x1532('0xb'));_0x51257f(_0x2f29c6[_0x1532('0x10')]['message']);}})[_0x1532('0x11')](function(_0x5be6ca){logger['error'](_0x1532('0xa'),_0x2a5030,_0x5be6ca);_0x41c4bf(_0x5be6ca);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 053a356..e47c4f2 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 _0xa2ab=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa2ab,0xa7));var _0xba2a=function(_0x355dd1,_0x23770b){_0x355dd1=_0x355dd1-0x0;var _0x3110f1=_0xa2ab[_0x355dd1];return _0x3110f1;};'use strict';var multer=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var path=require(_0xba2a('0x2'));var timeout=require('connect-timeout');var express=require(_0xba2a('0x3'));var router=express[_0xba2a('0x4')]();var fs_extra=require(_0xba2a('0x5'));var auth=require(_0xba2a('0x6'));var interaction=require(_0xba2a('0x7'));var config=require(_0xba2a('0x8'));var controller=require(_0xba2a('0x9'));router['get']('/',auth[_0xba2a('0xa')](),controller[_0xba2a('0xb')]);router[_0xba2a('0xc')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0xd')]);router[_0xba2a('0xe')]('/',auth[_0xba2a('0xa')](),controller['create']);router[_0xba2a('0xf')](_0xba2a('0x10'),auth[_0xba2a('0xa')](),controller[_0xba2a('0x11')]);router[_0xba2a('0x12')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0x13')]);module[_0xba2a('0x14')]=router; \ No newline at end of file +var _0xae79=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x363c31,_0x23a304){var _0x547e96=function(_0xb58db7){while(--_0xb58db7){_0x363c31['push'](_0x363c31['shift']());}};_0x547e96(++_0x23a304);}(_0xae79,0x1d3));var _0x9ae7=function(_0x4be42f,_0x4d1815){_0x4be42f=_0x4be42f-0x0;var _0x2bc2d4=_0xae79[_0x4be42f];return _0x2bc2d4;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var fs_extra=require(_0x9ae7('0x6'));var auth=require(_0x9ae7('0x7'));var interaction=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var controller=require(_0x9ae7('0xa'));router[_0x9ae7('0xb')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xd')]);router[_0x9ae7('0xb')]('/:id',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xf')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x10')]);router[_0x9ae7('0x11')]('/:id',auth[_0x9ae7('0xc')](),controller['update']);router[_0x9ae7('0x12')](_0x9ae7('0x13'),auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x14')]);module[_0x9ae7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2decc7b..a2efc6b 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 _0x2449=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2449,0x114));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9244('0x0'));module[_0x9244('0x1')]={'type':{'type':Sequelize[_0x9244('0x2')](_0x9244('0x3'),_0x9244('0x4'),_0x9244('0x5'),'keyValue',_0x9244('0x6')),'defaultValue':_0x9244('0x3')},'content':{'type':Sequelize[_0x9244('0x7')]},'key':{'type':Sequelize[_0x9244('0x7')]},'keyType':{'type':Sequelize[_0x9244('0x2')](_0x9244('0x3'),_0x9244('0x4'),_0x9244('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9244('0x7')]},'customField':{'type':Sequelize[_0x9244('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7db4=['BOOLEAN','ENUM','string','STRING','variable','customVariable'];(function(_0x2d3b3b,_0x5b6a72){var _0x2a4392=function(_0x22fef5){while(--_0x22fef5){_0x2d3b3b['push'](_0x2d3b3b['shift']());}};_0x2a4392(++_0x5b6a72);}(_0x7db4,0x1e1));var _0x47db=function(_0x394327,_0x2fd4e3){_0x394327=_0x394327-0x0;var _0x2854c3=_0x7db4[_0x394327];return _0x2854c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x47db('0x0')](_0x47db('0x1'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x47db('0x1')},'content':{'type':Sequelize[_0x47db('0x2')]},'key':{'type':Sequelize[_0x47db('0x2')]},'keyType':{'type':Sequelize[_0x47db('0x0')](_0x47db('0x1'),_0x47db('0x3'),_0x47db('0x4'))},'keyContent':{'type':Sequelize[_0x47db('0x2')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x47db('0x2')]},'customField':{'type':Sequelize[_0x47db('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47db('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 261f4f8..df47633 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 _0x995f=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','FreshsalesField','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4032bc,_0x13bac6){var _0xef97b=function(_0x416ab2){while(--_0x416ab2){_0x4032bc['push'](_0x4032bc['shift']());}};_0xef97b(++_0x13bac6);}(_0x995f,0x1a8));var _0xf995=function(_0x337293,_0x2a571d){_0x337293=_0x337293-0x0;var _0x2f7075=_0x995f[_0x337293];return _0x2f7075;};'use strict';var emlformat=require(_0xf995('0x0'));var rimraf=require(_0xf995('0x1'));var zipdir=require(_0xf995('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf995('0x3'));var moment=require(_0xf995('0x4'));var BPromise=require(_0xf995('0x5'));var Mustache=require('mustache');var util=require(_0xf995('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf995('0x7'));var ejs=require(_0xf995('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf995('0x9'));var squel=require('squel');var crypto=require(_0xf995('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf995('0xb'));var toCsv=require(_0xf995('0x7'));var querystring=require(_0xf995('0xc'));var Papa=require(_0xf995('0xd'));var Redis=require('ioredis');var authService=require(_0xf995('0xe'));var qs=require(_0xf995('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf995('0x10'));var logger=require(_0xf995('0x11'))(_0xf995('0x12'));var utils=require(_0xf995('0x13'));var config=require(_0xf995('0x14'));var licenseUtil=require(_0xf995('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387db5,_0x35bc3d){_0x35bc3d=_0x35bc3d||0xcc;return function(_0x5ea169){if(_0x5ea169){return _0x387db5[_0xf995('0x16')](_0x35bc3d);}return _0x387db5[_0xf995('0x17')](_0x35bc3d)[_0xf995('0x18')]();};}function respondWithResult(_0x53b669,_0x31cff9){_0x31cff9=_0x31cff9||0xc8;return function(_0x55c89c){if(_0x55c89c){return _0x53b669[_0xf995('0x17')](_0x31cff9)[_0xf995('0x19')](_0x55c89c);}};}function respondWithFilteredResult(_0x42de7a,_0x426d0d){return function(_0x39b659){if(_0x39b659){var _0x2098a8=typeof _0x426d0d[_0xf995('0x1a')]===_0xf995('0x1b')&&typeof _0x426d0d[_0xf995('0x1c')]==='undefined';var _0x3a66e5=_0x39b659[_0xf995('0x1d')];var _0x44a9c6=_0x2098a8?0x0:_0x426d0d[_0xf995('0x1a')];var _0x330da9=_0x2098a8?_0x39b659[_0xf995('0x1d')]:_0x426d0d[_0xf995('0x1a')]+_0x426d0d['limit'];var _0x4ffee4;if(_0x330da9>=_0x3a66e5){_0x330da9=_0x3a66e5;_0x4ffee4=0xc8;}else{_0x4ffee4=0xce;}_0x42de7a[_0xf995('0x17')](_0x4ffee4);return _0x42de7a['set'](_0xf995('0x1e'),_0x44a9c6+'-'+_0x330da9+'/'+_0x3a66e5)[_0xf995('0x19')](_0x39b659);}return null;};}function patchUpdates(_0x4b6b51){return function(_0x4ad073){try{jsonpatch[_0xf995('0x1f')](_0x4ad073,_0x4b6b51,!![]);}catch(_0x26e943){return BPromise[_0xf995('0x20')](_0x26e943);}return _0x4ad073['save']();};}function saveUpdates(_0x33fa7d,_0x116024){return function(_0x547e41){if(_0x547e41){return _0x547e41[_0xf995('0x21')](_0x33fa7d)['then'](function(_0x367117){return _0x367117;});}return null;};}function removeEntity(_0x470c88,_0x4369a2){return function(_0x15d0b9){if(_0x15d0b9){return _0x15d0b9[_0xf995('0x22')]()['then'](function(){_0x470c88['status'](0xcc)[_0xf995('0x18')]();});}};}function handleEntityNotFound(_0x3db28a,_0x2c49ad){return function(_0x4387a6){if(!_0x4387a6){_0x3db28a[_0xf995('0x16')](0x194);}return _0x4387a6;};}function handleError(_0x2ec813,_0x1dbe48){_0x1dbe48=_0x1dbe48||0x1f4;return function(_0x52a1be){logger[_0xf995('0x23')](_0x52a1be[_0xf995('0x24')]);if(_0x52a1be['name']){delete _0x52a1be[_0xf995('0x25')];}_0x2ec813['status'](_0x1dbe48)[_0xf995('0x26')](_0x52a1be);};}exports[_0xf995('0x27')]=function(_0x3e6930,_0x5b60fd){var _0x5339d7={},_0x5d1002={},_0x46ad8e={'count':0x0,'rows':[]};var _0x32ab24=_[_0xf995('0x28')](db['FreshsalesField'][_0xf995('0x29')],function(_0x44bc8d){return{'name':_0x44bc8d[_0xf995('0x2a')],'type':_0x44bc8d[_0xf995('0x2b')][_0xf995('0x2c')]};});_0x5d1002['model']=_['map'](_0x32ab24,_0xf995('0x25'));_0x5d1002[_0xf995('0x2d')]=_[_0xf995('0x2e')](_0x3e6930[_0xf995('0x2d')]);_0x5d1002[_0xf995('0x2f')]=_[_0xf995('0x30')](_0x5d1002[_0xf995('0x31')],_0x5d1002[_0xf995('0x2d')]);_0x5339d7['attributes']=_[_0xf995('0x30')](_0x5d1002[_0xf995('0x31')],qs[_0xf995('0x32')](_0x3e6930[_0xf995('0x2d')][_0xf995('0x32')]));_0x5339d7[_0xf995('0x33')]=_0x5339d7[_0xf995('0x33')][_0xf995('0x34')]?_0x5339d7[_0xf995('0x33')]:_0x5d1002[_0xf995('0x31')];if(!_0x3e6930['query'][_0xf995('0x35')](_0xf995('0x36'))){_0x5339d7[_0xf995('0x1c')]=qs['limit'](_0x3e6930['query'][_0xf995('0x1c')]);_0x5339d7[_0xf995('0x1a')]=qs[_0xf995('0x1a')](_0x3e6930['query'][_0xf995('0x1a')]);}_0x5339d7[_0xf995('0x37')]=qs[_0xf995('0x38')](_0x3e6930[_0xf995('0x2d')]['sort']);_0x5339d7['where']=qs[_0xf995('0x2f')](_['pick'](_0x3e6930[_0xf995('0x2d')],_0x5d1002['filters']),_0x32ab24);if(_0x3e6930[_0xf995('0x2d')][_0xf995('0x39')]){_0x5339d7[_0xf995('0x3a')]=_[_0xf995('0x3b')](_0x5339d7[_0xf995('0x3a')],{'$or':_['map'](_0x32ab24,function(_0x2cc8f9){if(_0x2cc8f9[_0xf995('0x2b')]!==_0xf995('0x3c')){var _0xb2b834={};_0xb2b834[_0x2cc8f9['name']]={'$like':'%'+_0x3e6930['query'][_0xf995('0x39')]+'%'};return _0xb2b834;}})});}_0x5339d7=_[_0xf995('0x3b')]({},_0x5339d7,_0x3e6930[_0xf995('0x3d')]);var _0x59470d={'where':_0x5339d7[_0xf995('0x3a')]};return db[_0xf995('0x3e')][_0xf995('0x1d')](_0x59470d)[_0xf995('0x3f')](function(_0x293c04){_0x46ad8e[_0xf995('0x1d')]=_0x293c04;if(_0x3e6930[_0xf995('0x2d')][_0xf995('0x40')]){_0x5339d7[_0xf995('0x41')]=[{'all':!![]}];}return db['FreshsalesField'][_0xf995('0x42')](_0x5339d7);})[_0xf995('0x3f')](function(_0x30bf05){_0x46ad8e[_0xf995('0x43')]=_0x30bf05;return _0x46ad8e;})[_0xf995('0x3f')](respondWithFilteredResult(_0x5b60fd,_0x5339d7))['catch'](handleError(_0x5b60fd,null));};exports[_0xf995('0x44')]=function(_0x253ef4,_0x21306a){var _0x1c2f89={'raw':!![],'where':{'id':_0x253ef4[_0xf995('0x45')]['id']}},_0x40f76f={};_0x40f76f[_0xf995('0x31')]=_[_0xf995('0x2e')](db[_0xf995('0x3e')][_0xf995('0x29')]);_0x40f76f['query']=_[_0xf995('0x2e')](_0x253ef4['query']);_0x40f76f[_0xf995('0x2f')]=_[_0xf995('0x30')](_0x40f76f[_0xf995('0x31')],_0x40f76f[_0xf995('0x2d')]);_0x1c2f89[_0xf995('0x33')]=_[_0xf995('0x30')](_0x40f76f[_0xf995('0x31')],qs[_0xf995('0x32')](_0x253ef4[_0xf995('0x2d')]['fields']));_0x1c2f89['attributes']=_0x1c2f89[_0xf995('0x33')][_0xf995('0x34')]?_0x1c2f89['attributes']:_0x40f76f[_0xf995('0x31')];if(_0x253ef4[_0xf995('0x2d')][_0xf995('0x40')]){_0x1c2f89[_0xf995('0x41')]=[{'all':!![]}];}_0x1c2f89=_[_0xf995('0x3b')]({},_0x1c2f89,_0x253ef4['options']);return db['FreshsalesField'][_0xf995('0x46')](_0x1c2f89)[_0xf995('0x3f')](handleEntityNotFound(_0x21306a,null))[_0xf995('0x3f')](respondWithResult(_0x21306a,null))[_0xf995('0x47')](handleError(_0x21306a,null));};exports[_0xf995('0x48')]=function(_0x379640,_0x469928){return db[_0xf995('0x3e')][_0xf995('0x48')](_0x379640[_0xf995('0x49')],{})['then'](respondWithResult(_0x469928,0xc9))[_0xf995('0x47')](handleError(_0x469928,null));};exports[_0xf995('0x21')]=function(_0x1fb753,_0x4421fe){if(_0x1fb753[_0xf995('0x49')]['id']){delete _0x1fb753[_0xf995('0x49')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x1fb753[_0xf995('0x45')]['id']}})[_0xf995('0x3f')](handleEntityNotFound(_0x4421fe,null))[_0xf995('0x3f')](saveUpdates(_0x1fb753[_0xf995('0x49')],null))['then'](respondWithResult(_0x4421fe,null))['catch'](handleError(_0x4421fe,null));};exports[_0xf995('0x22')]=function(_0x292df9,_0x1cb806){return db[_0xf995('0x3e')][_0xf995('0x46')]({'where':{'id':_0x292df9[_0xf995('0x45')]['id']}})[_0xf995('0x3f')](handleEntityNotFound(_0x1cb806,null))[_0xf995('0x3f')](removeEntity(_0x1cb806,null))[_0xf995('0x47')](handleError(_0x1cb806,null));}; \ No newline at end of file +var _0x1fb2=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','FreshsalesField','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x1fb2,0xd2));var _0x21fb=function(_0x48c00a,_0x473dc3){_0x48c00a=_0x48c00a-0x0;var _0x24c264=_0x1fb2[_0x48c00a];return _0x24c264;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21fb('0x0'));var zipdir=require(_0x21fb('0x1'));var jsonpatch=require(_0x21fb('0x2'));var rp=require(_0x21fb('0x3'));var moment=require(_0x21fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x21fb('0x5'));var util=require(_0x21fb('0x6'));var path=require(_0x21fb('0x7'));var sox=require(_0x21fb('0x8'));var csv=require(_0x21fb('0x9'));var ejs=require(_0x21fb('0xa'));var fs=require('fs');var fs_extra=require(_0x21fb('0xb'));var _=require(_0x21fb('0xc'));var squel=require(_0x21fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x21fb('0xe'));var deskjs=require(_0x21fb('0xf'));var toCsv=require(_0x21fb('0x9'));var querystring=require('querystring');var Papa=require(_0x21fb('0x10'));var Redis=require(_0x21fb('0x11'));var authService=require(_0x21fb('0x12'));var qs=require(_0x21fb('0x13'));var as=require(_0x21fb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21fb('0x15'))('api');var utils=require(_0x21fb('0x16'));var config=require(_0x21fb('0x17'));var licenseUtil=require(_0x21fb('0x18'));var db=require(_0x21fb('0x19'))['db'];function respondWithStatusCode(_0x1969af,_0x5f1955){_0x5f1955=_0x5f1955||0xcc;return function(_0x538e8b){if(_0x538e8b){return _0x1969af['sendStatus'](_0x5f1955);}return _0x1969af[_0x21fb('0x1a')](_0x5f1955)[_0x21fb('0x1b')]();};}function respondWithResult(_0x46add3,_0x3cb37c){_0x3cb37c=_0x3cb37c||0xc8;return function(_0x3f8fe7){if(_0x3f8fe7){return _0x46add3[_0x21fb('0x1a')](_0x3cb37c)[_0x21fb('0x1c')](_0x3f8fe7);}};}function respondWithFilteredResult(_0x4a1d0b,_0x21f829){return function(_0x90d3c0){if(_0x90d3c0){var _0x542922=typeof _0x21f829[_0x21fb('0x1d')]===_0x21fb('0x1e')&&typeof _0x21f829['limit']==='undefined';var _0x4aa3f2=_0x90d3c0[_0x21fb('0x1f')];var _0x3f8065=_0x542922?0x0:_0x21f829[_0x21fb('0x1d')];var _0x1eeafa=_0x542922?_0x90d3c0[_0x21fb('0x1f')]:_0x21f829[_0x21fb('0x1d')]+_0x21f829[_0x21fb('0x20')];var _0x14b4a5;if(_0x1eeafa>=_0x4aa3f2){_0x1eeafa=_0x4aa3f2;_0x14b4a5=0xc8;}else{_0x14b4a5=0xce;}_0x4a1d0b[_0x21fb('0x1a')](_0x14b4a5);return _0x4a1d0b[_0x21fb('0x21')](_0x21fb('0x22'),_0x3f8065+'-'+_0x1eeafa+'/'+_0x4aa3f2)[_0x21fb('0x1c')](_0x90d3c0);}return null;};}function patchUpdates(_0x1eadcf){return function(_0x1036e1){try{jsonpatch[_0x21fb('0x23')](_0x1036e1,_0x1eadcf,!![]);}catch(_0x75aba1){return BPromise['reject'](_0x75aba1);}return _0x1036e1[_0x21fb('0x24')]();};}function saveUpdates(_0x5a2648,_0x29f2f1){return function(_0xb2acf2){if(_0xb2acf2){return _0xb2acf2[_0x21fb('0x25')](_0x5a2648)[_0x21fb('0x26')](function(_0x5789ea){return _0x5789ea;});}return null;};}function removeEntity(_0x29b037,_0x53f9b9){return function(_0x42d93f){if(_0x42d93f){return _0x42d93f['destroy']()[_0x21fb('0x26')](function(){_0x29b037['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aea4b,_0x38d1fc){return function(_0x5be1b7){if(!_0x5be1b7){_0x5aea4b[_0x21fb('0x27')](0x194);}return _0x5be1b7;};}function handleError(_0x536969,_0x3ebc1a){_0x3ebc1a=_0x3ebc1a||0x1f4;return function(_0x5f172c){logger['error'](_0x5f172c[_0x21fb('0x28')]);if(_0x5f172c[_0x21fb('0x29')]){delete _0x5f172c['name'];}_0x536969[_0x21fb('0x1a')](_0x3ebc1a)[_0x21fb('0x2a')](_0x5f172c);};}exports['index']=function(_0x19894e,_0x40c8be){var _0x3bc9c8={},_0x230c19={},_0x162b42={'count':0x0,'rows':[]};var _0x26eb9a=_[_0x21fb('0x2b')](db['FreshsalesField'][_0x21fb('0x2c')],function(_0x5d2b56){return{'name':_0x5d2b56['fieldName'],'type':_0x5d2b56['type'][_0x21fb('0x2d')]};});_0x230c19[_0x21fb('0x2e')]=_[_0x21fb('0x2b')](_0x26eb9a,_0x21fb('0x29'));_0x230c19['query']=_[_0x21fb('0x2f')](_0x19894e[_0x21fb('0x30')]);_0x230c19[_0x21fb('0x31')]=_[_0x21fb('0x32')](_0x230c19[_0x21fb('0x2e')],_0x230c19[_0x21fb('0x30')]);_0x3bc9c8['attributes']=_[_0x21fb('0x32')](_0x230c19['model'],qs[_0x21fb('0x33')](_0x19894e[_0x21fb('0x30')][_0x21fb('0x33')]));_0x3bc9c8['attributes']=_0x3bc9c8['attributes'][_0x21fb('0x34')]?_0x3bc9c8[_0x21fb('0x35')]:_0x230c19[_0x21fb('0x2e')];if(!_0x19894e[_0x21fb('0x30')]['hasOwnProperty'](_0x21fb('0x36'))){_0x3bc9c8[_0x21fb('0x20')]=qs[_0x21fb('0x20')](_0x19894e[_0x21fb('0x30')][_0x21fb('0x20')]);_0x3bc9c8[_0x21fb('0x1d')]=qs['offset'](_0x19894e[_0x21fb('0x30')][_0x21fb('0x1d')]);}_0x3bc9c8[_0x21fb('0x37')]=qs[_0x21fb('0x38')](_0x19894e['query'][_0x21fb('0x38')]);_0x3bc9c8[_0x21fb('0x39')]=qs[_0x21fb('0x31')](_[_0x21fb('0x3a')](_0x19894e[_0x21fb('0x30')],_0x230c19['filters']),_0x26eb9a);if(_0x19894e['query'][_0x21fb('0x3b')]){_0x3bc9c8[_0x21fb('0x39')]=_['merge'](_0x3bc9c8[_0x21fb('0x39')],{'$or':_['map'](_0x26eb9a,function(_0xc6a844){if(_0xc6a844[_0x21fb('0x3c')]!=='VIRTUAL'){var _0x38d403={};_0x38d403[_0xc6a844['name']]={'$like':'%'+_0x19894e['query'][_0x21fb('0x3b')]+'%'};return _0x38d403;}})});}_0x3bc9c8=_[_0x21fb('0x3d')]({},_0x3bc9c8,_0x19894e[_0x21fb('0x3e')]);var _0x452789={'where':_0x3bc9c8[_0x21fb('0x39')]};return db['FreshsalesField'][_0x21fb('0x1f')](_0x452789)['then'](function(_0x43ea0e){_0x162b42[_0x21fb('0x1f')]=_0x43ea0e;if(_0x19894e[_0x21fb('0x30')][_0x21fb('0x3f')]){_0x3bc9c8[_0x21fb('0x40')]=[{'all':!![]}];}return db[_0x21fb('0x41')][_0x21fb('0x42')](_0x3bc9c8);})[_0x21fb('0x26')](function(_0x52b1b2){_0x162b42[_0x21fb('0x43')]=_0x52b1b2;return _0x162b42;})[_0x21fb('0x26')](respondWithFilteredResult(_0x40c8be,_0x3bc9c8))[_0x21fb('0x44')](handleError(_0x40c8be,null));};exports[_0x21fb('0x45')]=function(_0x42b3bb,_0x5262b1){var _0x22285b={'raw':!![],'where':{'id':_0x42b3bb[_0x21fb('0x46')]['id']}},_0x1fffd8={};_0x1fffd8[_0x21fb('0x2e')]=_['keys'](db['FreshsalesField'][_0x21fb('0x2c')]);_0x1fffd8['query']=_[_0x21fb('0x2f')](_0x42b3bb[_0x21fb('0x30')]);_0x1fffd8[_0x21fb('0x31')]=_[_0x21fb('0x32')](_0x1fffd8['model'],_0x1fffd8[_0x21fb('0x30')]);_0x22285b['attributes']=_[_0x21fb('0x32')](_0x1fffd8[_0x21fb('0x2e')],qs[_0x21fb('0x33')](_0x42b3bb[_0x21fb('0x30')][_0x21fb('0x33')]));_0x22285b[_0x21fb('0x35')]=_0x22285b['attributes'][_0x21fb('0x34')]?_0x22285b[_0x21fb('0x35')]:_0x1fffd8['model'];if(_0x42b3bb[_0x21fb('0x30')][_0x21fb('0x3f')]){_0x22285b[_0x21fb('0x40')]=[{'all':!![]}];}_0x22285b=_['merge']({},_0x22285b,_0x42b3bb[_0x21fb('0x3e')]);return db[_0x21fb('0x41')][_0x21fb('0x47')](_0x22285b)[_0x21fb('0x26')](handleEntityNotFound(_0x5262b1,null))['then'](respondWithResult(_0x5262b1,null))['catch'](handleError(_0x5262b1,null));};exports[_0x21fb('0x48')]=function(_0x8d8d8,_0x3b8a49){return db[_0x21fb('0x41')][_0x21fb('0x48')](_0x8d8d8[_0x21fb('0x49')],{})[_0x21fb('0x26')](respondWithResult(_0x3b8a49,0xc9))['catch'](handleError(_0x3b8a49,null));};exports[_0x21fb('0x25')]=function(_0x738e7e,_0x5a1fa3){if(_0x738e7e['body']['id']){delete _0x738e7e[_0x21fb('0x49')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x738e7e[_0x21fb('0x46')]['id']}})[_0x21fb('0x26')](handleEntityNotFound(_0x5a1fa3,null))[_0x21fb('0x26')](saveUpdates(_0x738e7e[_0x21fb('0x49')],null))['then'](respondWithResult(_0x5a1fa3,null))[_0x21fb('0x44')](handleError(_0x5a1fa3,null));};exports[_0x21fb('0x4a')]=function(_0x16c9a2,_0x6194e){return db[_0x21fb('0x41')]['find']({'where':{'id':_0x16c9a2['params']['id']}})[_0x21fb('0x26')](handleEntityNotFound(_0x6194e,null))['then'](removeEntity(_0x6194e,null))[_0x21fb('0x44')](handleError(_0x6194e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 87be0bb..f199896 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 _0x881e=['rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','../../config/logger','api','bluebird','path'];(function(_0x24cb9f,_0x38c86b){var _0x5828c3=function(_0x580745){while(--_0x580745){_0x24cb9f['push'](_0x24cb9f['shift']());}};_0x5828c3(++_0x38c86b);}(_0x881e,0x146));var _0xe881=function(_0xa9dc19,_0x48b11e){_0xa9dc19=_0xa9dc19-0x0;var _0xd4ae11=_0x881e[_0xa9dc19];return _0xd4ae11;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe881('0x0'))(_0xe881('0x1'));var moment=require('moment');var BPromise=require(_0xe881('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe881('0x3'));var rimraf=require(_0xe881('0x4'));var config=require(_0xe881('0x5'));var attributes=require(_0xe881('0x6'));module['exports']=function(_0x1d9bc0,_0xa4fe06){return _0x1d9bc0['define'](_0xe881('0x7'),attributes,{'tableName':_0xe881('0x8'),'paranoid':![],'indexes':[{'name':_0xe881('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d1=['freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x89ee16,_0x34c46e){_0x89ee16=_0x89ee16-0x0;var _0x2c165f=_0xd7d1[_0x89ee16];return _0x2c165f;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[{'name':_0x1d7d('0xf'),'fields':[_0x1d7d('0x10'),_0x1d7d('0x11')],'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 f907ef4..c2a1515 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(_0x48e8cb,_0x153076){var _0x452d7d=function(_0x3e51f8){while(--_0x3e51f8){_0x48e8cb['push'](_0x48e8cb['shift']());}};_0x452d7d(++_0x153076);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xf46e1b,_0x578683){_0xf46e1b=_0xf46e1b-0x0;var _0x3c80f3=_0xdbf5[_0xf46e1b];return _0x3c80f3;};'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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x22ae14,_0xe24a5e){var _0x3a1b75=function(_0x570377){while(--_0x570377){_0x22ae14['push'](_0x22ae14['shift']());}};_0x3a1b75(++_0xe24a5e);}(_0x33af,0xec));var _0xf33a=function(_0x286c4a,_0x3d559d){_0x286c4a=_0x286c4a-0x0;var _0x476a25=_0x33af[_0x286c4a];return _0x476a25;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5036719..1d8263d 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x6b0982,_0x309be6){var _0x47b059=function(_0x2d3f25){while(--_0x2d3f25){_0x6b0982['push'](_0x6b0982['shift']());}};_0x47b059(++_0x309be6);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x617e5d,_0x4d1c41){var _0x46b28f=function(_0x578202){while(--_0x578202){_0x617e5d['push'](_0x617e5d['shift']());}};_0x46b28f(++_0x4d1c41);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 f2c45f8..d63979a 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 _0x1c3d=['exports','STRING','username','ENUM','integrationTab'];(function(_0x55d76f,_0x3ec4e8){var _0x27f726=function(_0x5ccf34){while(--_0x5ccf34){_0x55d76f['push'](_0x55d76f['shift']());}};_0x27f726(++_0x3ec4e8);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x167281,_0x1cbdcf){_0x167281=_0x167281-0x0;var _0x175151=_0x1c3d[_0x167281];return _0x175151;};'use strict';var Sequelize=require('sequelize');module[_0xd1c3('0x0')]={'name':{'type':Sequelize[_0xd1c3('0x1')]},'description':{'type':Sequelize[_0xd1c3('0x1')]},'username':{'type':Sequelize[_0xd1c3('0x1')],'unique':_0xd1c3('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd1c3('0x1')]},'clientSecret':{'type':Sequelize[_0xd1c3('0x1')]},'securityToken':{'type':Sequelize[_0xd1c3('0x1')]},'serverUrl':{'type':Sequelize[_0xd1c3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd1c3('0x3')](_0xd1c3('0x4'),'newTab'),'defaultValue':_0xd1c3('0x4')}}; \ No newline at end of file +var _0x0268=['username','ENUM','newTab','integrationTab','sequelize','STRING'];(function(_0x2822b3,_0x49842b){var _0x4b9178=function(_0x265ccd){while(--_0x265ccd){_0x2822b3['push'](_0x2822b3['shift']());}};_0x4b9178(++_0x49842b);}(_0x0268,0x17e));var _0x8026=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0268[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x8026('0x0'));module['exports']={'name':{'type':Sequelize[_0x8026('0x1')]},'description':{'type':Sequelize[_0x8026('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x8026('0x2')},'remoteUri':{'type':Sequelize[_0x8026('0x1')]},'password':{'type':Sequelize[_0x8026('0x1')]},'clientId':{'type':Sequelize[_0x8026('0x1')]},'clientSecret':{'type':Sequelize[_0x8026('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8026('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8026('0x3')]('integrationTab',_0x8026('0x4')),'defaultValue':_0x8026('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0ad8880..500cd57 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 _0x3164=['isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','includes','label','value','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','lastIndexOf','clientId'];(function(_0x45cea1,_0x45db40){var _0xda8ddd=function(_0x43062d){while(--_0x43062d){_0x45cea1['push'](_0x45cea1['shift']());}};_0xda8ddd(++_0x45db40);}(_0x3164,0x10f));var _0x4316=function(_0x44bf66,_0xe56e4d){_0x44bf66=_0x44bf66-0x0;var _0x207832=_0x3164[_0x44bf66];return _0x207832;};'use strict';var emlformat=require(_0x4316('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4316('0x1'));var jsonpatch=require(_0x4316('0x2'));var rp=require(_0x4316('0x3'));var moment=require('moment');var BPromise=require(_0x4316('0x4'));var Mustache=require(_0x4316('0x5'));var util=require('util');var path=require(_0x4316('0x6'));var sox=require(_0x4316('0x7'));var csv=require('to-csv');var ejs=require(_0x4316('0x8'));var fs=require('fs');var fs_extra=require(_0x4316('0x9'));var _=require(_0x4316('0xa'));var squel=require(_0x4316('0xb'));var crypto=require(_0x4316('0xc'));var jsforce=require(_0x4316('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4316('0xe'));var Redis=require(_0x4316('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4316('0x10'));var as=require(_0x4316('0x11'));var hardwareService=require(_0x4316('0x12'));var logger=require(_0x4316('0x13'))(_0x4316('0x14'));var utils=require(_0x4316('0x15'));var config=require(_0x4316('0x16'));var licenseUtil=require(_0x4316('0x17'));var db=require(_0x4316('0x18'))['db'];var integrations=require(_0x4316('0x19'));function respondWithStatusCode(_0x3f62ee,_0x41ba20){_0x41ba20=_0x41ba20||0xcc;return function(_0x3653e3){if(_0x3653e3){return _0x3f62ee[_0x4316('0x1a')](_0x41ba20);}return _0x3f62ee[_0x4316('0x1b')](_0x41ba20)[_0x4316('0x1c')]();};}function respondWithResult(_0x3c43fa,_0x1af722){_0x1af722=_0x1af722||0xc8;return function(_0x2b4a68){if(_0x2b4a68){return _0x3c43fa['status'](_0x1af722)[_0x4316('0x1d')](_0x2b4a68);}};}function respondWithFilteredResult(_0x14b613,_0x49abdd){return function(_0x5df3c8){if(_0x5df3c8){var _0xfeb381=typeof _0x49abdd[_0x4316('0x1e')]==='undefined'&&typeof _0x49abdd[_0x4316('0x1f')]===_0x4316('0x20');var _0x31ae7d=_0x5df3c8[_0x4316('0x21')];var _0x1aec2b=_0xfeb381?0x0:_0x49abdd[_0x4316('0x1e')];var _0x178c1e=_0xfeb381?_0x5df3c8[_0x4316('0x21')]:_0x49abdd['offset']+_0x49abdd[_0x4316('0x1f')];var _0x2fe753;if(_0x178c1e>=_0x31ae7d){_0x178c1e=_0x31ae7d;_0x2fe753=0xc8;}else{_0x2fe753=0xce;}_0x14b613[_0x4316('0x1b')](_0x2fe753);return _0x14b613[_0x4316('0x22')](_0x4316('0x23'),_0x1aec2b+'-'+_0x178c1e+'/'+_0x31ae7d)[_0x4316('0x1d')](_0x5df3c8);}return null;};}function patchUpdates(_0x59c8cb){return function(_0x5798ab){try{jsonpatch[_0x4316('0x24')](_0x5798ab,_0x59c8cb,!![]);}catch(_0x20943c){return BPromise[_0x4316('0x25')](_0x20943c);}return _0x5798ab[_0x4316('0x26')]();};}function saveUpdates(_0x2c0793,_0x45e11b){return function(_0x43ca53){if(_0x43ca53){return _0x43ca53[_0x4316('0x27')](_0x2c0793)[_0x4316('0x28')](function(_0xb25f){return _0xb25f;});}return null;};}function removeEntity(_0x1db632,_0x101eba){return function(_0x326083){if(_0x326083){return _0x326083['destroy']()[_0x4316('0x28')](function(){_0x1db632['status'](0xcc)[_0x4316('0x1c')]();});}};}function handleEntityNotFound(_0xe66a4c,_0xf410e9){return function(_0x457400){if(!_0x457400){_0xe66a4c[_0x4316('0x1a')](0x194);}return _0x457400;};}function handleError(_0x19937c,_0x29e792){_0x29e792=_0x29e792||0x1f4;return function(_0x1d3d0e){logger['error'](_0x1d3d0e[_0x4316('0x29')]);if(_0x1d3d0e[_0x4316('0x2a')]){delete _0x1d3d0e[_0x4316('0x2a')];}_0x19937c[_0x4316('0x1b')](_0x29e792)[_0x4316('0x2b')](_0x1d3d0e);};}exports[_0x4316('0x2c')]=function(_0x54c888,_0x5715fb){var _0x50a7df={},_0x152898={},_0x53f64b={'count':0x0,'rows':[]};var _0x5a77c5=_[_0x4316('0x2d')](db[_0x4316('0x2e')][_0x4316('0x2f')],function(_0x26c094){return{'name':_0x26c094[_0x4316('0x30')],'type':_0x26c094['type'][_0x4316('0x31')]};});_0x152898[_0x4316('0x32')]=_[_0x4316('0x2d')](_0x5a77c5,_0x4316('0x2a'));_0x152898['query']=_[_0x4316('0x33')](_0x54c888['query']);_0x152898[_0x4316('0x34')]=_['intersection'](_0x152898[_0x4316('0x32')],_0x152898[_0x4316('0x35')]);_0x50a7df[_0x4316('0x36')]=_['intersection'](_0x152898[_0x4316('0x32')],qs[_0x4316('0x37')](_0x54c888[_0x4316('0x35')][_0x4316('0x37')]));_0x50a7df[_0x4316('0x36')]=_0x50a7df[_0x4316('0x36')][_0x4316('0x38')]?_0x50a7df['attributes']:_0x152898[_0x4316('0x32')];if(!_0x54c888[_0x4316('0x35')][_0x4316('0x39')]('nolimit')){_0x50a7df[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x54c888[_0x4316('0x35')][_0x4316('0x1f')]);_0x50a7df[_0x4316('0x1e')]=qs[_0x4316('0x1e')](_0x54c888['query']['offset']);}_0x50a7df[_0x4316('0x3a')]=qs['sort'](_0x54c888[_0x4316('0x35')][_0x4316('0x3b')]);_0x50a7df[_0x4316('0x3c')]=qs[_0x4316('0x34')](_[_0x4316('0x3d')](_0x54c888['query'],_0x152898[_0x4316('0x34')]),_0x5a77c5);if(_0x54c888[_0x4316('0x35')][_0x4316('0x3e')]){_0x50a7df['where']=_['merge'](_0x50a7df[_0x4316('0x3c')],{'$or':_[_0x4316('0x2d')](_0x5a77c5,function(_0x59803f){if(_0x59803f[_0x4316('0x3f')]!==_0x4316('0x40')){var _0x5d8869={};_0x5d8869[_0x59803f[_0x4316('0x2a')]]={'$like':'%'+_0x54c888['query'][_0x4316('0x3e')]+'%'};return _0x5d8869;}})});}_0x50a7df=_[_0x4316('0x41')]({},_0x50a7df,_0x54c888[_0x4316('0x42')]);var _0x1d75bf={'where':_0x50a7df[_0x4316('0x3c')]};return db[_0x4316('0x2e')]['count'](_0x1d75bf)[_0x4316('0x28')](function(_0x291ec0){_0x53f64b[_0x4316('0x21')]=_0x291ec0;if(_0x54c888['query'][_0x4316('0x43')]){_0x50a7df[_0x4316('0x44')]=[{'all':!![]}];}return db[_0x4316('0x2e')][_0x4316('0x45')](_0x50a7df);})[_0x4316('0x28')](function(_0x3aa40e){_0x53f64b[_0x4316('0x46')]=_0x3aa40e;return _0x53f64b;})[_0x4316('0x28')](respondWithFilteredResult(_0x5715fb,_0x50a7df))[_0x4316('0x47')](handleError(_0x5715fb,null));};exports[_0x4316('0x48')]=function(_0x140776,_0x3ba016){var _0x2d6aee={'raw':![],'where':{'id':_0x140776[_0x4316('0x49')]['id']}},_0x20b67e={};_0x20b67e[_0x4316('0x32')]=_[_0x4316('0x33')](db[_0x4316('0x2e')][_0x4316('0x2f')]);_0x20b67e[_0x4316('0x35')]=_[_0x4316('0x33')](_0x140776[_0x4316('0x35')]);_0x20b67e[_0x4316('0x34')]=_[_0x4316('0x4a')](_0x20b67e[_0x4316('0x32')],_0x20b67e[_0x4316('0x35')]);_0x2d6aee['attributes']=_[_0x4316('0x4a')](_0x20b67e[_0x4316('0x32')],qs[_0x4316('0x37')](_0x140776['query']['fields']));_0x2d6aee[_0x4316('0x36')]=_0x2d6aee[_0x4316('0x36')][_0x4316('0x38')]?_0x2d6aee[_0x4316('0x36')]:_0x20b67e[_0x4316('0x32')];if(_0x140776[_0x4316('0x35')]['includeAll']){_0x2d6aee[_0x4316('0x44')]=[{'all':!![]}];}_0x2d6aee=_[_0x4316('0x41')]({},_0x2d6aee,_0x140776[_0x4316('0x42')]);return db[_0x4316('0x2e')][_0x4316('0x4b')](_0x2d6aee)['then'](handleEntityNotFound(_0x3ba016,null))['then'](respondWithResult(_0x3ba016,null))[_0x4316('0x47')](handleError(_0x3ba016,null));};exports['create']=function(_0x154b9f,_0x31eef2){return db[_0x4316('0x2e')][_0x4316('0x4c')](_0x154b9f[_0x4316('0x4d')],{})[_0x4316('0x28')](respondWithResult(_0x31eef2,0xc9))[_0x4316('0x47')](handleError(_0x31eef2,null));};exports['update']=function(_0x32b72b,_0x2cd9d6){if(_0x32b72b[_0x4316('0x4d')]['id']){delete _0x32b72b['body']['id'];}return db[_0x4316('0x2e')][_0x4316('0x4b')]({'where':{'id':_0x32b72b[_0x4316('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cd9d6,null))[_0x4316('0x28')](saveUpdates(_0x32b72b['body'],null))[_0x4316('0x28')](respondWithResult(_0x2cd9d6,null))[_0x4316('0x47')](handleError(_0x2cd9d6,null));};exports['destroy']=function(_0x4fddb6,_0x13b642){return db['SalesforceAccount']['find']({'where':{'id':_0x4fddb6['params']['id']}})[_0x4316('0x28')](handleEntityNotFound(_0x13b642,null))[_0x4316('0x28')](removeEntity(_0x13b642,null))[_0x4316('0x47')](handleError(_0x13b642,null));};exports[_0x4316('0x4e')]=function(_0x4d131c,_0x2d6a2f,_0x44607a){var _0x4e42f0={};var _0x2f6be9={};var _0xaedc2f;var _0x394f30;return db[_0x4316('0x2e')]['findOne']({'where':{'id':_0x4d131c[_0x4316('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d6a2f,null))[_0x4316('0x28')](function(_0x515b4c){if(_0x515b4c){_0xaedc2f=_0x515b4c;_0x2f6be9[_0x4316('0x32')]=_[_0x4316('0x33')](db['SalesforceConfiguration'][_0x4316('0x2f')]);_0x2f6be9[_0x4316('0x35')]=_[_0x4316('0x33')](_0x4d131c[_0x4316('0x35')]);_0x2f6be9[_0x4316('0x34')]=_['intersection'](_0x2f6be9[_0x4316('0x32')],_0x2f6be9[_0x4316('0x35')]);_0x4e42f0[_0x4316('0x36')]=_[_0x4316('0x4a')](_0x2f6be9[_0x4316('0x32')],qs[_0x4316('0x37')](_0x4d131c[_0x4316('0x35')][_0x4316('0x37')]));_0x4e42f0['attributes']=_0x4e42f0[_0x4316('0x36')][_0x4316('0x38')]?_0x4e42f0[_0x4316('0x36')]:_0x2f6be9[_0x4316('0x32')];_0x4e42f0[_0x4316('0x3a')]=qs[_0x4316('0x3b')](_0x4d131c[_0x4316('0x35')][_0x4316('0x3b')]);_0x4e42f0['where']=qs[_0x4316('0x34')](_[_0x4316('0x3d')](_0x4d131c[_0x4316('0x35')],_0x2f6be9['filters']));if(_0x4d131c[_0x4316('0x35')][_0x4316('0x3e')]){_0x4e42f0[_0x4316('0x3c')]=_['merge'](_0x4e42f0[_0x4316('0x3c')],{'$or':_[_0x4316('0x2d')](_0x4e42f0[_0x4316('0x36')],function(_0x23de84){var _0x3141c8={};_0x3141c8[_0x23de84]={'$like':'%'+_0x4d131c['query']['filter']+'%'};return _0x3141c8;})});}_0x4e42f0=_[_0x4316('0x41')]({},_0x4e42f0,_0x4d131c[_0x4316('0x42')]);return _0xaedc2f[_0x4316('0x4e')](_0x4e42f0);}})[_0x4316('0x28')](function(_0x4877be){if(_0x4877be){_0x394f30=_0x4877be[_0x4316('0x38')];if(!_0x4d131c[_0x4316('0x35')][_0x4316('0x39')]('nolimit')){_0x4e42f0[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x4d131c['query']['limit']);_0x4e42f0[_0x4316('0x1e')]=qs[_0x4316('0x1e')](_0x4d131c[_0x4316('0x35')][_0x4316('0x1e')]);}return _0xaedc2f[_0x4316('0x4e')](_0x4e42f0);}})[_0x4316('0x28')](function(_0x39e88a){if(_0x39e88a){return _0x39e88a?{'count':_0x394f30,'rows':_0x39e88a}:null;}})['then'](respondWithResult(_0x2d6a2f,null))[_0x4316('0x47')](handleError(_0x2d6a2f,null));};exports[_0x4316('0x4f')]=function(_0x5da4df,_0x93cf33,_0xef61d8){if(_0x5da4df[_0x4316('0x4d')]['id']){delete _0x5da4df[_0x4316('0x4d')]['id'];}return db[_0x4316('0x2e')][_0x4316('0x50')]({'where':{'id':_0x5da4df['params']['id']}})['then'](handleEntityNotFound(_0x93cf33,null))[_0x4316('0x28')](function(_0x740011){if(_0x740011){_0x5da4df[_0x4316('0x4d')][_0x4316('0x51')]=_0x740011['id'];_0x5da4df[_0x4316('0x4d')][_0x4316('0x52')]=integrations[_0x4316('0x53')](_0x5da4df['body'][_0x4316('0x54')],_0x5da4df[_0x4316('0x4d')][_0x4316('0x3f')]);_0x5da4df[_0x4316('0x4d')][_0x4316('0x55')]=integrations[_0x4316('0x56')](_0x5da4df['body'][_0x4316('0x54')],_0x5da4df[_0x4316('0x4d')][_0x4316('0x3f')]);return db[_0x4316('0x57')][_0x4316('0x4c')](_0x5da4df[_0x4316('0x4d')],{'include':[{'model':db[_0x4316('0x58')],'as':_0x4316('0x52')},{'model':db[_0x4316('0x58')],'as':_0x4316('0x55')}]});}return null;})['then'](respondWithResult(_0x93cf33,null))[_0x4316('0x47')](handleError(_0x93cf33,null));};exports[_0x4316('0x59')]=function(_0x488350,_0x291f02,_0x306cc8){var _0x5bee36;var _0x246efb='';var _0x2f246e=_0x4316('0x5a');return db[_0x4316('0x2e')][_0x4316('0x50')]({'where':{'id':_0x488350['params']['id']},'attributes':['id',_0x4316('0x5b'),'clientId',_0x4316('0x5c'),_0x4316('0x5d'),_0x4316('0x5e'),_0x4316('0x5f')]})[_0x4316('0x28')](handleEntityNotFound(_0x291f02,null))['then'](function(_0x4ee181){if(_0x4ee181){_0x246efb=_0x4ee181[_0x4316('0x5b')];var _0x35913e=_0x246efb['slice'](-0x1);if(_0x35913e==='/'){_0x246efb=_0x246efb['substring'](0x0,_0x246efb[_0x4316('0x60')](_0x35913e));}_0x5bee36=new jsforce['Connection']({'oauth2':{'loginUrl':_0x246efb,'clientId':_0x4ee181[_0x4316('0x61')],'clientSecret':_0x4ee181[_0x4316('0x5c')]}});return _0x5bee36['login'](_0x4ee181['username'],_0x4ee181['password']['concat'](_0x4ee181[_0x4316('0x5f')]));}})[_0x4316('0x28')](function(_0x52e2cb){if(_0x52e2cb){if(!_[_0x4316('0x62')](_0x488350[_0x4316('0x35')]['ticketType'])){_0x2f246e=_0x488350['query']['ticketType'];}return _0x5bee36[_0x4316('0x63')](_0x2f246e)[_0x4316('0x64')]();}})['then'](function(_0x536a85){var _0x2dd827=[_0x4316('0x65'),_0x4316('0x66'),_0x4316('0x67'),_0x4316('0x68'),_0x4316('0x69'),_0x4316('0x6a')];var _0x5d1dca=[_0x4316('0x6b'),_0x4316('0x6c'),'picklist',_0x4316('0x6d'),'email',_0x4316('0x6e'),_0x4316('0x6f')];if(_0x536a85){_['remove'](_0x536a85[_0x4316('0x37')],function(_0x4303d9){return _0x2dd827[_0x4316('0x70')](_0x4303d9[_0x4316('0x2a')])||!_0x5d1dca[_0x4316('0x70')](_0x4303d9[_0x4316('0x3f')]);});return{'count':_0x536a85[_0x4316('0x37')][_0x4316('0x38')],'rows':_[_0x4316('0x2d')](_0x536a85['fields'],function(_0xa02e53){return{'id':_0xa02e53[_0x4316('0x2a')],'name':_0xa02e53[_0x4316('0x71')],'custom':_0xa02e53['custom'],'options':_0xa02e53['picklistValues'][_0x4316('0x38')]>0x0?_['map'](_0xa02e53['picklistValues'],function(_0x4e38aa){return{'name':_0x4e38aa[_0x4316('0x71')],'value':_0x4e38aa[_0x4316('0x72')]};}):_0xa02e53[_0x4316('0x3f')]==_0x4316('0x6d')?[{'name':_0x4316('0x73'),'value':_0x4316('0x74')},{'name':_0x4316('0x75'),'value':_0x4316('0x76')}]:[]};})};}})[_0x4316('0x28')](respondWithResult(_0x291f02,null))[_0x4316('0x47')](function(_0x5996dd){var _0x19b07e=_0x488350['query'][_0x4316('0x77')]?0x1f4:_0x5996dd[_0x4316('0x78')]||0x1f4;logger[_0x4316('0x79')](_0x4316('0x7a'),_0x4316('0x59'),_0x19b07e,JSON['stringify'](_0x5996dd));delete _0x5996dd['name'];if(_0x19b07e===0x191){_0x19b07e=0x190;}_0x291f02[_0x4316('0x1b')](_0x19b07e)[_0x4316('0x2b')](_0x488350[_0x4316('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5996dd[_0x4316('0x78')]}:_0x5996dd);});}; \ No newline at end of file +var _0x8d8e=['stack','name','send','index','map','SalesforceAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','SalesforceConfiguration','Subjects','SalesforceField','getFields','remoteUri','clientSecret','username','securityToken','substring','lastIndexOf','Connection','clientId','login','concat','ticketType','sobject','describe','ActivityDate','IsRecurrence','Description','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d8e,0x1be));var _0xe8d8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8d8e[_0x33032e];return _0x13316b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8d8('0x0'));var zipdir=require(_0xe8d8('0x1'));var jsonpatch=require(_0xe8d8('0x2'));var rp=require(_0xe8d8('0x3'));var moment=require('moment');var BPromise=require(_0xe8d8('0x4'));var Mustache=require(_0xe8d8('0x5'));var util=require('util');var path=require(_0xe8d8('0x6'));var sox=require('sox');var csv=require(_0xe8d8('0x7'));var ejs=require(_0xe8d8('0x8'));var fs=require('fs');var fs_extra=require(_0xe8d8('0x9'));var _=require(_0xe8d8('0xa'));var squel=require('squel');var crypto=require(_0xe8d8('0xb'));var jsforce=require(_0xe8d8('0xc'));var deskjs=require(_0xe8d8('0xd'));var toCsv=require(_0xe8d8('0x7'));var querystring=require(_0xe8d8('0xe'));var Papa=require(_0xe8d8('0xf'));var Redis=require(_0xe8d8('0x10'));var authService=require(_0xe8d8('0x11'));var qs=require(_0xe8d8('0x12'));var as=require(_0xe8d8('0x13'));var hardwareService=require(_0xe8d8('0x14'));var logger=require(_0xe8d8('0x15'))(_0xe8d8('0x16'));var utils=require(_0xe8d8('0x17'));var config=require(_0xe8d8('0x18'));var licenseUtil=require(_0xe8d8('0x19'));var db=require(_0xe8d8('0x1a'))['db'];var integrations=require(_0xe8d8('0x1b'));function respondWithStatusCode(_0x3de690,_0x488e68){_0x488e68=_0x488e68||0xcc;return function(_0x58e57d){if(_0x58e57d){return _0x3de690[_0xe8d8('0x1c')](_0x488e68);}return _0x3de690[_0xe8d8('0x1d')](_0x488e68)['end']();};}function respondWithResult(_0xf73f3,_0x1cc3b7){_0x1cc3b7=_0x1cc3b7||0xc8;return function(_0x2db0df){if(_0x2db0df){return _0xf73f3[_0xe8d8('0x1d')](_0x1cc3b7)[_0xe8d8('0x1e')](_0x2db0df);}};}function respondWithFilteredResult(_0x3328f4,_0x54f418){return function(_0x73c823){if(_0x73c823){var _0xba0a8a=typeof _0x54f418[_0xe8d8('0x1f')]===_0xe8d8('0x20')&&typeof _0x54f418[_0xe8d8('0x21')]==='undefined';var _0x3f49b0=_0x73c823[_0xe8d8('0x22')];var _0x2839a3=_0xba0a8a?0x0:_0x54f418['offset'];var _0x198d0e=_0xba0a8a?_0x73c823[_0xe8d8('0x22')]:_0x54f418[_0xe8d8('0x1f')]+_0x54f418[_0xe8d8('0x21')];var _0xa3966b;if(_0x198d0e>=_0x3f49b0){_0x198d0e=_0x3f49b0;_0xa3966b=0xc8;}else{_0xa3966b=0xce;}_0x3328f4[_0xe8d8('0x1d')](_0xa3966b);return _0x3328f4[_0xe8d8('0x23')](_0xe8d8('0x24'),_0x2839a3+'-'+_0x198d0e+'/'+_0x3f49b0)['json'](_0x73c823);}return null;};}function patchUpdates(_0x4d2de7){return function(_0x5bdba5){try{jsonpatch[_0xe8d8('0x25')](_0x5bdba5,_0x4d2de7,!![]);}catch(_0x13ebd7){return BPromise[_0xe8d8('0x26')](_0x13ebd7);}return _0x5bdba5[_0xe8d8('0x27')]();};}function saveUpdates(_0x4430a9,_0x3f64fa){return function(_0x848561){if(_0x848561){return _0x848561[_0xe8d8('0x28')](_0x4430a9)['then'](function(_0x54bba3){return _0x54bba3;});}return null;};}function removeEntity(_0x308452,_0x4ddd06){return function(_0x322fd5){if(_0x322fd5){return _0x322fd5[_0xe8d8('0x29')]()['then'](function(){_0x308452[_0xe8d8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b740,_0x1d9f63){return function(_0x50a9ef){if(!_0x50a9ef){_0x15b740['sendStatus'](0x194);}return _0x50a9ef;};}function handleError(_0x2d7832,_0x300664){_0x300664=_0x300664||0x1f4;return function(_0x299565){logger['error'](_0x299565[_0xe8d8('0x2a')]);if(_0x299565['name']){delete _0x299565[_0xe8d8('0x2b')];}_0x2d7832['status'](_0x300664)[_0xe8d8('0x2c')](_0x299565);};}exports[_0xe8d8('0x2d')]=function(_0x573157,_0x2e862e){var _0x42e8c1={},_0x2d687c={},_0x2041c9={'count':0x0,'rows':[]};var _0x10ced4=_[_0xe8d8('0x2e')](db[_0xe8d8('0x2f')]['rawAttributes'],function(_0x157adf){return{'name':_0x157adf[_0xe8d8('0x30')],'type':_0x157adf[_0xe8d8('0x31')][_0xe8d8('0x32')]};});_0x2d687c['model']=_[_0xe8d8('0x2e')](_0x10ced4,'name');_0x2d687c[_0xe8d8('0x33')]=_['keys'](_0x573157[_0xe8d8('0x33')]);_0x2d687c[_0xe8d8('0x34')]=_[_0xe8d8('0x35')](_0x2d687c[_0xe8d8('0x36')],_0x2d687c[_0xe8d8('0x33')]);_0x42e8c1[_0xe8d8('0x37')]=_[_0xe8d8('0x35')](_0x2d687c[_0xe8d8('0x36')],qs[_0xe8d8('0x38')](_0x573157[_0xe8d8('0x33')][_0xe8d8('0x38')]));_0x42e8c1[_0xe8d8('0x37')]=_0x42e8c1[_0xe8d8('0x37')][_0xe8d8('0x39')]?_0x42e8c1[_0xe8d8('0x37')]:_0x2d687c['model'];if(!_0x573157[_0xe8d8('0x33')][_0xe8d8('0x3a')](_0xe8d8('0x3b'))){_0x42e8c1['limit']=qs[_0xe8d8('0x21')](_0x573157['query'][_0xe8d8('0x21')]);_0x42e8c1[_0xe8d8('0x1f')]=qs[_0xe8d8('0x1f')](_0x573157[_0xe8d8('0x33')]['offset']);}_0x42e8c1['order']=qs['sort'](_0x573157[_0xe8d8('0x33')]['sort']);_0x42e8c1[_0xe8d8('0x3c')]=qs['filters'](_[_0xe8d8('0x3d')](_0x573157[_0xe8d8('0x33')],_0x2d687c[_0xe8d8('0x34')]),_0x10ced4);if(_0x573157[_0xe8d8('0x33')]['filter']){_0x42e8c1[_0xe8d8('0x3c')]=_[_0xe8d8('0x3e')](_0x42e8c1[_0xe8d8('0x3c')],{'$or':_['map'](_0x10ced4,function(_0x44898e){if(_0x44898e[_0xe8d8('0x31')]!=='VIRTUAL'){var _0x389a87={};_0x389a87[_0x44898e[_0xe8d8('0x2b')]]={'$like':'%'+_0x573157[_0xe8d8('0x33')][_0xe8d8('0x3f')]+'%'};return _0x389a87;}})});}_0x42e8c1=_[_0xe8d8('0x3e')]({},_0x42e8c1,_0x573157['options']);var _0xc3d8db={'where':_0x42e8c1[_0xe8d8('0x3c')]};return db[_0xe8d8('0x2f')][_0xe8d8('0x22')](_0xc3d8db)[_0xe8d8('0x40')](function(_0xa7a26e){_0x2041c9[_0xe8d8('0x22')]=_0xa7a26e;if(_0x573157['query'][_0xe8d8('0x41')]){_0x42e8c1[_0xe8d8('0x42')]=[{'all':!![]}];}return db[_0xe8d8('0x2f')][_0xe8d8('0x43')](_0x42e8c1);})[_0xe8d8('0x40')](function(_0x43fbc7){_0x2041c9[_0xe8d8('0x44')]=_0x43fbc7;return _0x2041c9;})[_0xe8d8('0x40')](respondWithFilteredResult(_0x2e862e,_0x42e8c1))[_0xe8d8('0x45')](handleError(_0x2e862e,null));};exports[_0xe8d8('0x46')]=function(_0x3ff8b7,_0x33930d){var _0x28a917={'raw':![],'where':{'id':_0x3ff8b7[_0xe8d8('0x47')]['id']}},_0x31b8ba={};_0x31b8ba[_0xe8d8('0x36')]=_[_0xe8d8('0x48')](db['SalesforceAccount'][_0xe8d8('0x49')]);_0x31b8ba['query']=_['keys'](_0x3ff8b7['query']);_0x31b8ba[_0xe8d8('0x34')]=_[_0xe8d8('0x35')](_0x31b8ba[_0xe8d8('0x36')],_0x31b8ba['query']);_0x28a917[_0xe8d8('0x37')]=_['intersection'](_0x31b8ba['model'],qs['fields'](_0x3ff8b7[_0xe8d8('0x33')][_0xe8d8('0x38')]));_0x28a917['attributes']=_0x28a917['attributes'][_0xe8d8('0x39')]?_0x28a917[_0xe8d8('0x37')]:_0x31b8ba['model'];if(_0x3ff8b7['query'][_0xe8d8('0x41')]){_0x28a917['include']=[{'all':!![]}];}_0x28a917=_['merge']({},_0x28a917,_0x3ff8b7[_0xe8d8('0x4a')]);return db[_0xe8d8('0x2f')][_0xe8d8('0x4b')](_0x28a917)['then'](handleEntityNotFound(_0x33930d,null))[_0xe8d8('0x40')](respondWithResult(_0x33930d,null))[_0xe8d8('0x45')](handleError(_0x33930d,null));};exports[_0xe8d8('0x4c')]=function(_0xfb67e0,_0x534a43){return db[_0xe8d8('0x2f')][_0xe8d8('0x4c')](_0xfb67e0[_0xe8d8('0x4d')],{})[_0xe8d8('0x40')](respondWithResult(_0x534a43,0xc9))['catch'](handleError(_0x534a43,null));};exports[_0xe8d8('0x28')]=function(_0x13381a,_0x1006d4){if(_0x13381a[_0xe8d8('0x4d')]['id']){delete _0x13381a[_0xe8d8('0x4d')]['id'];}return db['SalesforceAccount'][_0xe8d8('0x4b')]({'where':{'id':_0x13381a[_0xe8d8('0x47')]['id']}})['then'](handleEntityNotFound(_0x1006d4,null))[_0xe8d8('0x40')](saveUpdates(_0x13381a[_0xe8d8('0x4d')],null))[_0xe8d8('0x40')](respondWithResult(_0x1006d4,null))[_0xe8d8('0x45')](handleError(_0x1006d4,null));};exports[_0xe8d8('0x29')]=function(_0x35bf3a,_0x476030){return db['SalesforceAccount'][_0xe8d8('0x4b')]({'where':{'id':_0x35bf3a['params']['id']}})[_0xe8d8('0x40')](handleEntityNotFound(_0x476030,null))['then'](removeEntity(_0x476030,null))['catch'](handleError(_0x476030,null));};exports[_0xe8d8('0x4e')]=function(_0x273a6a,_0x54d6f0,_0x3794c0){var _0x34857e={};var _0x45790d={};var _0x4f081d;var _0x51e3df;return db[_0xe8d8('0x2f')][_0xe8d8('0x4f')]({'where':{'id':_0x273a6a[_0xe8d8('0x47')]['id']}})[_0xe8d8('0x40')](handleEntityNotFound(_0x54d6f0,null))[_0xe8d8('0x40')](function(_0x6b3343){if(_0x6b3343){_0x4f081d=_0x6b3343;_0x45790d[_0xe8d8('0x36')]=_[_0xe8d8('0x48')](db['SalesforceConfiguration'][_0xe8d8('0x49')]);_0x45790d[_0xe8d8('0x33')]=_[_0xe8d8('0x48')](_0x273a6a['query']);_0x45790d[_0xe8d8('0x34')]=_['intersection'](_0x45790d['model'],_0x45790d[_0xe8d8('0x33')]);_0x34857e[_0xe8d8('0x37')]=_[_0xe8d8('0x35')](_0x45790d[_0xe8d8('0x36')],qs[_0xe8d8('0x38')](_0x273a6a['query'][_0xe8d8('0x38')]));_0x34857e[_0xe8d8('0x37')]=_0x34857e[_0xe8d8('0x37')]['length']?_0x34857e[_0xe8d8('0x37')]:_0x45790d[_0xe8d8('0x36')];_0x34857e['order']=qs['sort'](_0x273a6a[_0xe8d8('0x33')]['sort']);_0x34857e[_0xe8d8('0x3c')]=qs[_0xe8d8('0x34')](_[_0xe8d8('0x3d')](_0x273a6a[_0xe8d8('0x33')],_0x45790d[_0xe8d8('0x34')]));if(_0x273a6a[_0xe8d8('0x33')]['filter']){_0x34857e['where']=_[_0xe8d8('0x3e')](_0x34857e['where'],{'$or':_[_0xe8d8('0x2e')](_0x34857e[_0xe8d8('0x37')],function(_0x1b4d39){var _0xcf1405={};_0xcf1405[_0x1b4d39]={'$like':'%'+_0x273a6a[_0xe8d8('0x33')][_0xe8d8('0x3f')]+'%'};return _0xcf1405;})});}_0x34857e=_[_0xe8d8('0x3e')]({},_0x34857e,_0x273a6a[_0xe8d8('0x4a')]);return _0x4f081d[_0xe8d8('0x4e')](_0x34857e);}})[_0xe8d8('0x40')](function(_0x1f02c5){if(_0x1f02c5){_0x51e3df=_0x1f02c5[_0xe8d8('0x39')];if(!_0x273a6a['query'][_0xe8d8('0x3a')](_0xe8d8('0x3b'))){_0x34857e[_0xe8d8('0x21')]=qs[_0xe8d8('0x21')](_0x273a6a[_0xe8d8('0x33')]['limit']);_0x34857e[_0xe8d8('0x1f')]=qs[_0xe8d8('0x1f')](_0x273a6a[_0xe8d8('0x33')]['offset']);}return _0x4f081d[_0xe8d8('0x4e')](_0x34857e);}})[_0xe8d8('0x40')](function(_0x475bc5){if(_0x475bc5){return _0x475bc5?{'count':_0x51e3df,'rows':_0x475bc5}:null;}})['then'](respondWithResult(_0x54d6f0,null))[_0xe8d8('0x45')](handleError(_0x54d6f0,null));};exports['addConfiguration']=function(_0x1621ff,_0x34ebaf,_0x17825e){if(_0x1621ff[_0xe8d8('0x4d')]['id']){delete _0x1621ff[_0xe8d8('0x4d')]['id'];}return db[_0xe8d8('0x2f')][_0xe8d8('0x4f')]({'where':{'id':_0x1621ff[_0xe8d8('0x47')]['id']}})[_0xe8d8('0x40')](handleEntityNotFound(_0x34ebaf,null))[_0xe8d8('0x40')](function(_0x537f76){if(_0x537f76){_0x1621ff[_0xe8d8('0x4d')][_0xe8d8('0x50')]=_0x537f76['id'];_0x1621ff[_0xe8d8('0x4d')]['Subjects']=integrations[_0xe8d8('0x51')](_0x1621ff[_0xe8d8('0x4d')][_0xe8d8('0x52')],_0x1621ff[_0xe8d8('0x4d')][_0xe8d8('0x31')]);_0x1621ff[_0xe8d8('0x4d')][_0xe8d8('0x53')]=integrations['getDescriptions'](_0x1621ff['body'][_0xe8d8('0x52')],_0x1621ff[_0xe8d8('0x4d')]['type']);return db[_0xe8d8('0x54')][_0xe8d8('0x4c')](_0x1621ff[_0xe8d8('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0xe8d8('0x55')},{'model':db[_0xe8d8('0x56')],'as':_0xe8d8('0x53')}]});}return null;})[_0xe8d8('0x40')](respondWithResult(_0x34ebaf,null))[_0xe8d8('0x45')](handleError(_0x34ebaf,null));};exports[_0xe8d8('0x57')]=function(_0x434719,_0x1062e4,_0x2dc53c){var _0x245efc;var _0x647a93='';var _0x56239c='Task';return db[_0xe8d8('0x2f')]['findOne']({'where':{'id':_0x434719[_0xe8d8('0x47')]['id']},'attributes':['id',_0xe8d8('0x58'),'clientId',_0xe8d8('0x59'),_0xe8d8('0x5a'),'password',_0xe8d8('0x5b')]})['then'](handleEntityNotFound(_0x1062e4,null))[_0xe8d8('0x40')](function(_0x36b849){if(_0x36b849){_0x647a93=_0x36b849[_0xe8d8('0x58')];var _0x21c372=_0x647a93['slice'](-0x1);if(_0x21c372==='/'){_0x647a93=_0x647a93[_0xe8d8('0x5c')](0x0,_0x647a93[_0xe8d8('0x5d')](_0x21c372));}_0x245efc=new jsforce[(_0xe8d8('0x5e'))]({'oauth2':{'loginUrl':_0x647a93,'clientId':_0x36b849[_0xe8d8('0x5f')],'clientSecret':_0x36b849[_0xe8d8('0x59')]}});return _0x245efc[_0xe8d8('0x60')](_0x36b849[_0xe8d8('0x5a')],_0x36b849['password'][_0xe8d8('0x61')](_0x36b849[_0xe8d8('0x5b')]));}})[_0xe8d8('0x40')](function(_0x5a77a6){if(_0x5a77a6){if(!_['isNil'](_0x434719[_0xe8d8('0x33')][_0xe8d8('0x62')])){_0x56239c=_0x434719[_0xe8d8('0x33')][_0xe8d8('0x62')];}return _0x245efc[_0xe8d8('0x63')](_0x56239c)[_0xe8d8('0x64')]();}})['then'](function(_0x364b70){var _0x541240=['OwnerId',_0xe8d8('0x65'),'IsReminderSet',_0xe8d8('0x66'),'Subject',_0xe8d8('0x67')];var _0x1b1e40=['string',_0xe8d8('0x68'),_0xe8d8('0x69'),_0xe8d8('0x6a'),'email','textarea',_0xe8d8('0x6b')];if(_0x364b70){_[_0xe8d8('0x6c')](_0x364b70[_0xe8d8('0x38')],function(_0x12c880){return _0x541240[_0xe8d8('0x6d')](_0x12c880['name'])||!_0x1b1e40[_0xe8d8('0x6d')](_0x12c880['type']);});return{'count':_0x364b70[_0xe8d8('0x38')][_0xe8d8('0x39')],'rows':_[_0xe8d8('0x2e')](_0x364b70['fields'],function(_0x30aeaa){return{'id':_0x30aeaa[_0xe8d8('0x2b')],'name':_0x30aeaa[_0xe8d8('0x6e')],'custom':_0x30aeaa[_0xe8d8('0x6f')],'options':_0x30aeaa['picklistValues'][_0xe8d8('0x39')]>0x0?_[_0xe8d8('0x2e')](_0x30aeaa[_0xe8d8('0x70')],function(_0xb29863){return{'name':_0xb29863[_0xe8d8('0x6e')],'value':_0xb29863[_0xe8d8('0x71')]};}):_0x30aeaa[_0xe8d8('0x31')]==_0xe8d8('0x6a')?[{'name':_0xe8d8('0x72'),'value':'true'},{'name':_0xe8d8('0x73'),'value':_0xe8d8('0x74')}]:[]};})};}})[_0xe8d8('0x40')](respondWithResult(_0x1062e4,null))[_0xe8d8('0x45')](function(_0x33d88c){var _0x50eb18=_0x434719[_0xe8d8('0x33')][_0xe8d8('0x75')]?0x1f4:_0x33d88c[_0xe8d8('0x76')]||0x1f4;logger[_0xe8d8('0x77')](_0xe8d8('0x78'),_0xe8d8('0x57'),_0x50eb18,JSON[_0xe8d8('0x79')](_0x33d88c));delete _0x33d88c[_0xe8d8('0x2b')];if(_0x50eb18===0x191){_0x50eb18=0x190;}_0x1062e4['status'](_0x50eb18)['send'](_0x434719['query'][_0xe8d8('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x33d88c[_0xe8d8('0x76')]}:_0x33d88c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 432d8fd..2ebadc9 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 _0xc89e=['path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','request-promise'];(function(_0x256f5d,_0x170f8c){var _0x5b332f=function(_0x38c3a6){while(--_0x38c3a6){_0x256f5d['push'](_0x256f5d['shift']());}};_0x5b332f(++_0x170f8c);}(_0xc89e,0x10c));var _0xec89=function(_0x589144,_0x417fcc){_0x589144=_0x589144-0x0;var _0x28658f=_0xc89e[_0x589144];return _0x28658f;};'use strict';var _=require('lodash');var util=require(_0xec89('0x0'));var logger=require(_0xec89('0x1'))(_0xec89('0x2'));var moment=require(_0xec89('0x3'));var BPromise=require('bluebird');var rp=require(_0xec89('0x4'));var fs=require('fs');var path=require(_0xec89('0x5'));var rimraf=require(_0xec89('0x6'));var config=require('../../config/environment');var attributes=require(_0xec89('0x7'));var integrations=require(_0xec89('0x8'));module[_0xec89('0x9')]=function(_0x25cc08,_0x3c7332){return _0x25cc08[_0xec89('0xa')](_0xec89('0xb'),attributes,{'tableName':_0xec89('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8891=['SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','request-promise','rimraf','exports'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x8891,0x119));var _0x1889=function(_0x113566,_0x78c52a){_0x113566=_0x113566-0x0;var _0x359407=_0x8891[_0x113566];return _0x359407;};'use strict';var _=require(_0x1889('0x0'));var util=require(_0x1889('0x1'));var logger=require('../../config/logger')(_0x1889('0x2'));var moment=require(_0x1889('0x3'));var BPromise=require('bluebird');var rp=require(_0x1889('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1889('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1889('0x6')]=function(_0x46b16b,_0x3fc592){return _0x46b16b['define'](_0x1889('0x7'),attributes,{'tableName':_0x1889('0x8'),'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 db14724..6168ba6 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 _0x109f=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','SalesforceAccount','findAll','options','where','map','include','model','attributes','GetSalesforceAccount','ShowSalesforceAccount','find','raw','stringify','lodash','util','moment'];(function(_0x29a948,_0x4f523a){var _0x42849e=function(_0x49293c){while(--_0x49293c){_0x29a948['push'](_0x29a948['shift']());}};_0x42849e(++_0x4f523a);}(_0x109f,0x115));var _0xf109=function(_0x575c25,_0x56800c){_0x575c25=_0x575c25-0x0;var _0x4df2ec=_0x109f[_0x575c25];return _0x4df2ec;};'use strict';var _=require(_0xf109('0x0'));var util=require(_0xf109('0x1'));var moment=require(_0xf109('0x2'));var BPromise=require(_0xf109('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf109('0x4'));var db=require(_0xf109('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf109('0x6'))(_0xf109('0x7'));var config=require(_0xf109('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf109('0x9')][_0xf109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ccb81,_0x4e7d71,_0x2d870d){return new BPromise(function(_0x337d90,_0x1a2e97){return client[_0xf109('0xb')](_0x2ccb81,_0x2d870d)[_0xf109('0xc')](function(_0x38bccc){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4e7d71,'request\x20sent');logger[_0xf109('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4e7d71,_0xf109('0xe'),JSON['stringify'](_0x38bccc));if(_0x38bccc[_0xf109('0xf')]){if(_0x38bccc[_0xf109('0xf')][_0xf109('0x10')]===0x1f4){logger[_0xf109('0xf')](_0xf109('0x11'),_0x4e7d71,_0x38bccc[_0xf109('0xf')]['message']);return _0x1a2e97(_0x38bccc['error'][_0xf109('0x12')]);}logger[_0xf109('0xf')](_0xf109('0x11'),_0x4e7d71,_0x38bccc[_0xf109('0xf')][_0xf109('0x12')]);return _0x337d90(_0x38bccc[_0xf109('0xf')][_0xf109('0x12')]);}else{logger[_0xf109('0x13')](_0xf109('0x11'),_0x4e7d71,_0xf109('0xe'));_0x337d90(_0x38bccc[_0xf109('0x14')][_0xf109('0x12')]);}})[_0xf109('0x15')](function(_0x5d4057){logger[_0xf109('0xf')](_0xf109('0x11'),_0x4e7d71,_0x5d4057);_0x1a2e97(_0x5d4057);});});}exports['GetSalesforceAccount']=function(_0x5c8db2){var _0x21691c=this;return new Promise(function(_0x5b4fc3,_0x32e39b){return db[_0xf109('0x16')][_0xf109('0x17')]({'raw':_0x5c8db2[_0xf109('0x18')]?_0x5c8db2[_0xf109('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8db2[_0xf109('0x18')]?_0x5c8db2[_0xf109('0x18')][_0xf109('0x19')]||null:null,'attributes':_0x5c8db2[_0xf109('0x18')]?_0x5c8db2[_0xf109('0x18')]['attributes']||null:null,'limit':_0x5c8db2[_0xf109('0x18')]?_0x5c8db2[_0xf109('0x18')]['limit']||null:null,'include':_0x5c8db2[_0xf109('0x18')]?_0x5c8db2[_0xf109('0x18')]['include']?_[_0xf109('0x1a')](_0x5c8db2[_0xf109('0x18')][_0xf109('0x1b')],function(_0xf3124){return{'model':db[_0xf3124[_0xf109('0x1c')]],'as':_0xf3124['as'],'attributes':_0xf3124[_0xf109('0x1d')],'include':_0xf3124['include']?_[_0xf109('0x1a')](_0xf3124[_0xf109('0x1b')],function(_0x5471ab){return{'model':db[_0x5471ab[_0xf109('0x1c')]],'as':_0x5471ab['as'],'attributes':_0x5471ab[_0xf109('0x1d')],'include':_0x5471ab[_0xf109('0x1b')]?_[_0xf109('0x1a')](_0x5471ab[_0xf109('0x1b')],function(_0x439a4d){return{'model':db[_0x439a4d[_0xf109('0x1c')]],'as':_0x439a4d['as'],'attributes':_0x439a4d[_0xf109('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf109('0xc')](function(_0x1316d3){logger['info'](_0xf109('0x1e'),_0x5c8db2);logger[_0xf109('0xd')](_0xf109('0x1e'),_0x5c8db2,JSON['stringify'](_0x1316d3));_0x5b4fc3(_0x1316d3);})[_0xf109('0x15')](function(_0x234a9d){logger[_0xf109('0xf')]('GetSalesforceAccount',_0x234a9d['message'],_0x5c8db2);_0x32e39b(_0x21691c['error'](0x1f4,_0x234a9d[_0xf109('0x12')]));});});};exports[_0xf109('0x1f')]=function(_0x418508){var _0x2e1dee=this;return new Promise(function(_0x5b89dc,_0x5c8314){return db['SalesforceAccount'][_0xf109('0x20')]({'raw':_0x418508['options']?_0x418508[_0xf109('0x18')][_0xf109('0x21')]===undefined?!![]:![]:!![],'where':_0x418508[_0xf109('0x18')]?_0x418508[_0xf109('0x18')]['where']||null:null,'attributes':_0x418508[_0xf109('0x18')]?_0x418508[_0xf109('0x18')][_0xf109('0x1d')]||null:null,'include':_0x418508['options']?_0x418508['options'][_0xf109('0x1b')]?_['map'](_0x418508[_0xf109('0x18')]['include'],function(_0x4747ad){return{'model':db[_0x4747ad['model']],'as':_0x4747ad['as'],'attributes':_0x4747ad[_0xf109('0x1d')],'include':_0x4747ad[_0xf109('0x1b')]?_[_0xf109('0x1a')](_0x4747ad[_0xf109('0x1b')],function(_0x23c588){return{'model':db[_0x23c588[_0xf109('0x1c')]],'as':_0x23c588['as'],'attributes':_0x23c588[_0xf109('0x1d')],'include':_0x23c588[_0xf109('0x1b')]?_[_0xf109('0x1a')](_0x23c588[_0xf109('0x1b')],function(_0x2899ae){return{'model':db[_0x2899ae['model']],'as':_0x2899ae['as'],'attributes':_0x2899ae[_0xf109('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10314d){logger['info']('ShowSalesforceAccount',_0x418508);logger[_0xf109('0xd')]('ShowSalesforceAccount',_0x418508,JSON[_0xf109('0x22')](_0x10314d));_0x5b89dc(_0x10314d);})[_0xf109('0x15')](function(_0x195bbd){logger[_0xf109('0xf')](_0xf109('0x1f'),_0x195bbd[_0xf109('0x12')],_0x418508);_0x5c8314(_0x2e1dee[_0xf109('0xf')](0x1f4,_0x195bbd[_0xf109('0x12')]));});});}; \ No newline at end of file +var _0x3192=['attributes','include','GetSalesforceAccount','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','catch','SalesforceAccount','options','where','limit','map','model'];(function(_0x5b0307,_0x52e2f3){var _0x1285d7=function(_0x1fe1f9){while(--_0x1fe1f9){_0x5b0307['push'](_0x5b0307['shift']());}};_0x1285d7(++_0x52e2f3);}(_0x3192,0x191));var _0x2319=function(_0xb9d5c9,_0x1b6622){_0xb9d5c9=_0xb9d5c9-0x0;var _0x512aee=_0x3192[_0xb9d5c9];return _0x512aee;};'use strict';var _=require('lodash');var util=require(_0x2319('0x0'));var moment=require(_0x2319('0x1'));var BPromise=require(_0x2319('0x2'));var rs=require(_0x2319('0x3'));var fs=require('fs');var Redis=require(_0x2319('0x4'));var db=require(_0x2319('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2319('0x6'))(_0x2319('0x7'));var config=require('../../config/environment');var jayson=require(_0x2319('0x8'));var client=jayson[_0x2319('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2407e9,_0x5f2127,_0x2b6812){return new BPromise(function(_0x2f93b2,_0x1cb208){return client[_0x2319('0xa')](_0x2407e9,_0x2b6812)[_0x2319('0xb')](function(_0x501cf5){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x5f2127,_0x2319('0xc'));logger[_0x2319('0xd')](_0x2319('0xe'),_0x5f2127,_0x2319('0xc'),JSON[_0x2319('0xf')](_0x501cf5));if(_0x501cf5[_0x2319('0x10')]){if(_0x501cf5['error'][_0x2319('0x11')]===0x1f4){logger[_0x2319('0x10')](_0x2319('0x12'),_0x5f2127,_0x501cf5[_0x2319('0x10')][_0x2319('0x13')]);return _0x1cb208(_0x501cf5[_0x2319('0x10')][_0x2319('0x13')]);}logger[_0x2319('0x10')](_0x2319('0x12'),_0x5f2127,_0x501cf5[_0x2319('0x10')][_0x2319('0x13')]);return _0x2f93b2(_0x501cf5[_0x2319('0x10')][_0x2319('0x13')]);}else{logger[_0x2319('0x14')](_0x2319('0x12'),_0x5f2127,_0x2319('0xc'));_0x2f93b2(_0x501cf5['result'][_0x2319('0x13')]);}})[_0x2319('0x15')](function(_0x222af5){logger[_0x2319('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5f2127,_0x222af5);_0x1cb208(_0x222af5);});});}exports['GetSalesforceAccount']=function(_0x5afe71){var _0x1c11fe=this;return new Promise(function(_0x489c4f,_0x406b93){return db[_0x2319('0x16')]['findAll']({'raw':_0x5afe71['options']?_0x5afe71[_0x2319('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5afe71[_0x2319('0x17')]?_0x5afe71[_0x2319('0x17')][_0x2319('0x18')]||null:null,'attributes':_0x5afe71[_0x2319('0x17')]?_0x5afe71[_0x2319('0x17')]['attributes']||null:null,'limit':_0x5afe71[_0x2319('0x17')]?_0x5afe71[_0x2319('0x17')][_0x2319('0x19')]||null:null,'include':_0x5afe71[_0x2319('0x17')]?_0x5afe71[_0x2319('0x17')]['include']?_[_0x2319('0x1a')](_0x5afe71['options']['include'],function(_0x3b2155){return{'model':db[_0x3b2155[_0x2319('0x1b')]],'as':_0x3b2155['as'],'attributes':_0x3b2155[_0x2319('0x1c')],'include':_0x3b2155[_0x2319('0x1d')]?_[_0x2319('0x1a')](_0x3b2155[_0x2319('0x1d')],function(_0x42c75e){return{'model':db[_0x42c75e[_0x2319('0x1b')]],'as':_0x42c75e['as'],'attributes':_0x42c75e[_0x2319('0x1c')],'include':_0x42c75e[_0x2319('0x1d')]?_[_0x2319('0x1a')](_0x42c75e[_0x2319('0x1d')],function(_0x503e1e){return{'model':db[_0x503e1e['model']],'as':_0x503e1e['as'],'attributes':_0x503e1e[_0x2319('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2319('0xb')](function(_0x33a683){logger[_0x2319('0x14')]('GetSalesforceAccount',_0x5afe71);logger[_0x2319('0xd')](_0x2319('0x1e'),_0x5afe71,JSON[_0x2319('0xf')](_0x33a683));_0x489c4f(_0x33a683);})[_0x2319('0x15')](function(_0x3ded05){logger[_0x2319('0x10')]('GetSalesforceAccount',_0x3ded05['message'],_0x5afe71);_0x406b93(_0x1c11fe[_0x2319('0x10')](0x1f4,_0x3ded05[_0x2319('0x13')]));});});};exports[_0x2319('0x1f')]=function(_0x36dbb1){var _0x7edcfb=this;return new Promise(function(_0x13bf3d,_0x43df63){return db[_0x2319('0x16')][_0x2319('0x20')]({'raw':_0x36dbb1[_0x2319('0x17')]?_0x36dbb1[_0x2319('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x36dbb1[_0x2319('0x17')]?_0x36dbb1[_0x2319('0x17')][_0x2319('0x18')]||null:null,'attributes':_0x36dbb1[_0x2319('0x17')]?_0x36dbb1[_0x2319('0x17')]['attributes']||null:null,'include':_0x36dbb1[_0x2319('0x17')]?_0x36dbb1[_0x2319('0x17')][_0x2319('0x1d')]?_[_0x2319('0x1a')](_0x36dbb1[_0x2319('0x17')][_0x2319('0x1d')],function(_0xd40bf){return{'model':db[_0xd40bf[_0x2319('0x1b')]],'as':_0xd40bf['as'],'attributes':_0xd40bf[_0x2319('0x1c')],'include':_0xd40bf[_0x2319('0x1d')]?_[_0x2319('0x1a')](_0xd40bf[_0x2319('0x1d')],function(_0x3e9f80){return{'model':db[_0x3e9f80[_0x2319('0x1b')]],'as':_0x3e9f80['as'],'attributes':_0x3e9f80['attributes'],'include':_0x3e9f80['include']?_[_0x2319('0x1a')](_0x3e9f80['include'],function(_0x4d3c2e){return{'model':db[_0x4d3c2e[_0x2319('0x1b')]],'as':_0x4d3c2e['as'],'attributes':_0x4d3c2e[_0x2319('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2319('0xb')](function(_0x2abb93){logger[_0x2319('0x14')](_0x2319('0x1f'),_0x36dbb1);logger[_0x2319('0xd')]('ShowSalesforceAccount',_0x36dbb1,JSON[_0x2319('0xf')](_0x2abb93));_0x13bf3d(_0x2abb93);})[_0x2319('0x15')](function(_0x3e9148){logger[_0x2319('0x10')](_0x2319('0x1f'),_0x3e9148[_0x2319('0x13')],_0x36dbb1);_0x43df63(_0x7edcfb[_0x2319('0x10')](0x1f4,_0x3e9148[_0x2319('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0d96059..f449689 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xdb28,0x106));var _0x8db2=function(_0x313b62,_0x4c7284){_0x313b62=_0x313b62-0x0;var _0x244e3c=_0xdb28[_0x313b62];return _0x244e3c;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x4254c4,_0x403a9a){var _0x2c3ba7=function(_0x13504f){while(--_0x13504f){_0x4254c4['push'](_0x4254c4['shift']());}};_0x2c3ba7(++_0x403a9a);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e61f1,_0x442513){_0x5e61f1=_0x5e61f1-0x0;var _0x1f62a8=_0x2ef3[_0x5e61f1];return _0x1f62a8;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index daa8c03..c288c9c 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 _0x871a=['contact_lead','nothing','contact','sequelize','STRING','ENUM','Case','Task','lead','account_contact_lead'];(function(_0x256306,_0x561eea){var _0x52f090=function(_0x368114){while(--_0x368114){_0x256306['push'](_0x256306['shift']());}};_0x52f090(++_0x561eea);}(_0x871a,0x7b));var _0xa871=function(_0x448774,_0x45ddc7){_0x448774=_0x448774-0x0;var _0x46b2f6=_0x871a[_0x448774];return _0x46b2f6;};'use strict';var Sequelize=require(_0xa871('0x0'));module['exports']={'name':{'type':Sequelize[_0xa871('0x1')]},'description':{'type':Sequelize[_0xa871('0x1')]},'ticketType':{'type':Sequelize[_0xa871('0x2')]('Task',_0xa871('0x3')),'defaultValue':_0xa871('0x4')},'moduleSearch':{'type':Sequelize[_0xa871('0x2')]('contact_lead','contact',_0xa871('0x5'),_0xa871('0x6'),'account'),'defaultValue':_0xa871('0x7')},'moduleCreate':{'type':Sequelize[_0xa871('0x2')](_0xa871('0x8'),_0xa871('0x9'),_0xa871('0x5'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa871('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xa871('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xa871('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xa871('0x1')]}}; \ No newline at end of file +var _0x1fb5=['account_contact_lead','account','nothing','STRING','sequelize','ENUM','Task','contact_lead','contact','lead'];(function(_0x4e3741,_0x1cdb18){var _0x59a670=function(_0x5403c5){while(--_0x5403c5){_0x4e3741['push'](_0x4e3741['shift']());}};_0x59a670(++_0x1cdb18);}(_0x1fb5,0xa4));var _0x51fb=function(_0x192881,_0x9570e3){_0x192881=_0x192881-0x0;var _0x160717=_0x1fb5[_0x192881];return _0x160717;};'use strict';var Sequelize=require(_0x51fb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x51fb('0x1')](_0x51fb('0x2'),'Case'),'defaultValue':_0x51fb('0x2')},'moduleSearch':{'type':Sequelize[_0x51fb('0x1')](_0x51fb('0x3'),_0x51fb('0x4'),_0x51fb('0x5'),_0x51fb('0x6'),_0x51fb('0x7')),'defaultValue':_0x51fb('0x3')},'moduleCreate':{'type':Sequelize[_0x51fb('0x1')](_0x51fb('0x8'),_0x51fb('0x4'),_0x51fb('0x5'),'account'),'defaultValue':_0x51fb('0x5')},'leadId':{'type':Sequelize[_0x51fb('0x9')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x51fb('0x9')]},'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 21b74ce..f72b52a 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 _0x7408=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','create','body','find','params','destroy','getFields','SalesforceField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/hardware','api','../../config/utils'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x7408,0x8d));var _0x8740=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x7408[_0x54defc];return _0x1955d3;};'use strict';var emlformat=require(_0x8740('0x0'));var rimraf=require(_0x8740('0x1'));var zipdir=require(_0x8740('0x2'));var jsonpatch=require(_0x8740('0x3'));var rp=require(_0x8740('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8740('0x5'));var path=require('path');var sox=require(_0x8740('0x6'));var csv=require(_0x8740('0x7'));var ejs=require(_0x8740('0x8'));var fs=require('fs');var fs_extra=require(_0x8740('0x9'));var _=require(_0x8740('0xa'));var squel=require(_0x8740('0xb'));var crypto=require(_0x8740('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8740('0xd'));var toCsv=require(_0x8740('0x7'));var querystring=require(_0x8740('0xe'));var Papa=require(_0x8740('0xf'));var Redis=require(_0x8740('0x10'));var authService=require(_0x8740('0x11'));var qs=require(_0x8740('0x12'));var as=require(_0x8740('0x13'));var hardwareService=require(_0x8740('0x14'));var logger=require('../../config/logger')(_0x8740('0x15'));var utils=require(_0x8740('0x16'));var config=require(_0x8740('0x17'));var licenseUtil=require(_0x8740('0x18'));var db=require(_0x8740('0x19'))['db'];function respondWithStatusCode(_0x4244c5,_0x16973a){_0x16973a=_0x16973a||0xcc;return function(_0x2ea7de){if(_0x2ea7de){return _0x4244c5[_0x8740('0x1a')](_0x16973a);}return _0x4244c5[_0x8740('0x1b')](_0x16973a)[_0x8740('0x1c')]();};}function respondWithResult(_0x1eace6,_0x576707){_0x576707=_0x576707||0xc8;return function(_0x108d8f){if(_0x108d8f){return _0x1eace6['status'](_0x576707)[_0x8740('0x1d')](_0x108d8f);}};}function respondWithFilteredResult(_0x4136d3,_0x4a1829){return function(_0x5a5451){if(_0x5a5451){var _0x32c1b1=typeof _0x4a1829[_0x8740('0x1e')]===_0x8740('0x1f')&&typeof _0x4a1829['limit']===_0x8740('0x1f');var _0x913be9=_0x5a5451[_0x8740('0x20')];var _0x5e6223=_0x32c1b1?0x0:_0x4a1829[_0x8740('0x1e')];var _0x4a42f6=_0x32c1b1?_0x5a5451['count']:_0x4a1829[_0x8740('0x1e')]+_0x4a1829[_0x8740('0x21')];var _0x326fca;if(_0x4a42f6>=_0x913be9){_0x4a42f6=_0x913be9;_0x326fca=0xc8;}else{_0x326fca=0xce;}_0x4136d3[_0x8740('0x1b')](_0x326fca);return _0x4136d3[_0x8740('0x22')]('Content-Range',_0x5e6223+'-'+_0x4a42f6+'/'+_0x913be9)[_0x8740('0x1d')](_0x5a5451);}return null;};}function patchUpdates(_0x9f7e8e){return function(_0x3e9346){try{jsonpatch[_0x8740('0x23')](_0x3e9346,_0x9f7e8e,!![]);}catch(_0x524d92){return BPromise[_0x8740('0x24')](_0x524d92);}return _0x3e9346['save']();};}function saveUpdates(_0x5f0962,_0x5a9dad){return function(_0x2c2edc){if(_0x2c2edc){return _0x2c2edc[_0x8740('0x25')](_0x5f0962)[_0x8740('0x26')](function(_0x2bc45a){return _0x2bc45a;});}return null;};}function removeEntity(_0xad4c56,_0x2884fb){return function(_0x4b2d49){if(_0x4b2d49){return _0x4b2d49['destroy']()[_0x8740('0x26')](function(){_0xad4c56['status'](0xcc)[_0x8740('0x1c')]();});}};}function handleEntityNotFound(_0x30617f,_0x7bc0da){return function(_0x59a3e7){if(!_0x59a3e7){_0x30617f[_0x8740('0x1a')](0x194);}return _0x59a3e7;};}function handleError(_0x170fb2,_0x445a3c){_0x445a3c=_0x445a3c||0x1f4;return function(_0x16299e){logger[_0x8740('0x27')](_0x16299e[_0x8740('0x28')]);if(_0x16299e[_0x8740('0x29')]){delete _0x16299e[_0x8740('0x29')];}_0x170fb2[_0x8740('0x1b')](_0x445a3c)[_0x8740('0x2a')](_0x16299e);};}exports['index']=function(_0x9dc523,_0x7b51d1){var _0x383936={},_0x1aba31={},_0xfbfe26={'count':0x0,'rows':[]};var _0x4ce6df=_[_0x8740('0x2b')](db[_0x8740('0x2c')][_0x8740('0x2d')],function(_0x4bcda6){return{'name':_0x4bcda6[_0x8740('0x2e')],'type':_0x4bcda6[_0x8740('0x2f')][_0x8740('0x30')]};});_0x1aba31[_0x8740('0x31')]=_[_0x8740('0x2b')](_0x4ce6df,_0x8740('0x29'));_0x1aba31['query']=_[_0x8740('0x32')](_0x9dc523[_0x8740('0x33')]);_0x1aba31[_0x8740('0x34')]=_[_0x8740('0x35')](_0x1aba31['model'],_0x1aba31['query']);_0x383936[_0x8740('0x36')]=_[_0x8740('0x35')](_0x1aba31[_0x8740('0x31')],qs[_0x8740('0x37')](_0x9dc523[_0x8740('0x33')]['fields']));_0x383936[_0x8740('0x36')]=_0x383936[_0x8740('0x36')][_0x8740('0x38')]?_0x383936[_0x8740('0x36')]:_0x1aba31[_0x8740('0x31')];if(!_0x9dc523[_0x8740('0x33')][_0x8740('0x39')](_0x8740('0x3a'))){_0x383936['limit']=qs[_0x8740('0x21')](_0x9dc523['query'][_0x8740('0x21')]);_0x383936['offset']=qs[_0x8740('0x1e')](_0x9dc523[_0x8740('0x33')][_0x8740('0x1e')]);}_0x383936[_0x8740('0x3b')]=qs[_0x8740('0x3c')](_0x9dc523[_0x8740('0x33')][_0x8740('0x3c')]);_0x383936[_0x8740('0x3d')]=qs[_0x8740('0x34')](_[_0x8740('0x3e')](_0x9dc523[_0x8740('0x33')],_0x1aba31[_0x8740('0x34')]),_0x4ce6df);if(_0x9dc523[_0x8740('0x33')][_0x8740('0x3f')]){_0x383936['where']=_[_0x8740('0x40')](_0x383936[_0x8740('0x3d')],{'$or':_[_0x8740('0x2b')](_0x4ce6df,function(_0x5f2cd2){if(_0x5f2cd2[_0x8740('0x2f')]!==_0x8740('0x41')){var _0x4ad438={};_0x4ad438[_0x5f2cd2[_0x8740('0x29')]]={'$like':'%'+_0x9dc523['query'][_0x8740('0x3f')]+'%'};return _0x4ad438;}})});}_0x383936=_['merge']({},_0x383936,_0x9dc523[_0x8740('0x42')]);var _0x21fbd4={'where':_0x383936[_0x8740('0x3d')]};return db[_0x8740('0x2c')][_0x8740('0x20')](_0x21fbd4)[_0x8740('0x26')](function(_0x1d2dbe){_0xfbfe26[_0x8740('0x20')]=_0x1d2dbe;if(_0x9dc523[_0x8740('0x33')]['includeAll']){_0x383936['include']=[{'all':!![]}];}return db[_0x8740('0x2c')][_0x8740('0x43')](_0x383936);})['then'](function(_0x3ab1f9){_0xfbfe26[_0x8740('0x44')]=_0x3ab1f9;return _0xfbfe26;})[_0x8740('0x26')](respondWithFilteredResult(_0x7b51d1,_0x383936))[_0x8740('0x45')](handleError(_0x7b51d1,null));};exports[_0x8740('0x46')]=function(_0x37cd28,_0x560c33){var _0x44608d={'raw':![],'where':{'id':_0x37cd28['params']['id']}},_0x1ed661={};_0x1ed661['model']=_[_0x8740('0x32')](db[_0x8740('0x2c')][_0x8740('0x2d')]);_0x1ed661[_0x8740('0x33')]=_[_0x8740('0x32')](_0x37cd28[_0x8740('0x33')]);_0x1ed661[_0x8740('0x34')]=_[_0x8740('0x35')](_0x1ed661[_0x8740('0x31')],_0x1ed661[_0x8740('0x33')]);_0x44608d[_0x8740('0x36')]=_[_0x8740('0x35')](_0x1ed661[_0x8740('0x31')],qs[_0x8740('0x37')](_0x37cd28[_0x8740('0x33')]['fields']));_0x44608d['attributes']=_0x44608d['attributes'][_0x8740('0x38')]?_0x44608d[_0x8740('0x36')]:_0x1ed661[_0x8740('0x31')];if(_0x37cd28[_0x8740('0x33')][_0x8740('0x47')]){_0x44608d['include']=[{'all':!![]}];}_0x44608d=_['merge']({},_0x44608d,_0x37cd28[_0x8740('0x42')]);return db[_0x8740('0x2c')]['find'](_0x44608d)['then'](handleEntityNotFound(_0x560c33,null))[_0x8740('0x26')](respondWithResult(_0x560c33,null))[_0x8740('0x45')](handleError(_0x560c33,null));};exports[_0x8740('0x48')]=function(_0x306324,_0x160fc1){return db[_0x8740('0x2c')][_0x8740('0x48')](_0x306324['body'],{})['then'](respondWithResult(_0x160fc1,0xc9))[_0x8740('0x45')](handleError(_0x160fc1,null));};exports['update']=function(_0xd96937,_0x3d4860){if(_0xd96937['body']['id']){delete _0xd96937[_0x8740('0x49')]['id'];}return db[_0x8740('0x2c')][_0x8740('0x4a')]({'where':{'id':_0xd96937[_0x8740('0x4b')]['id']}})[_0x8740('0x26')](handleEntityNotFound(_0x3d4860,null))[_0x8740('0x26')](saveUpdates(_0xd96937['body'],null))[_0x8740('0x26')](respondWithResult(_0x3d4860,null))[_0x8740('0x45')](handleError(_0x3d4860,null));};exports[_0x8740('0x4c')]=function(_0x1d9456,_0x1a831d){return db[_0x8740('0x2c')]['find']({'where':{'id':_0x1d9456[_0x8740('0x4b')]['id']}})[_0x8740('0x26')](handleEntityNotFound(_0x1a831d,null))[_0x8740('0x26')](removeEntity(_0x1a831d,null))[_0x8740('0x45')](handleError(_0x1a831d,null));};exports[_0x8740('0x4d')]=function(_0x13473d,_0x5d3802,_0x4e55bb){var _0x76acb6={};var _0x4e3fb3={};var _0x3d94ce;var _0x31c0a0;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x13473d['params']['id']}})[_0x8740('0x26')](handleEntityNotFound(_0x5d3802,null))['then'](function(_0x4bf6fa){if(_0x4bf6fa){_0x3d94ce=_0x4bf6fa;_0x4e3fb3[_0x8740('0x31')]=_[_0x8740('0x32')](db[_0x8740('0x4e')][_0x8740('0x2d')]);_0x4e3fb3['query']=_[_0x8740('0x32')](_0x13473d[_0x8740('0x33')]);_0x4e3fb3[_0x8740('0x34')]=_[_0x8740('0x35')](_0x4e3fb3[_0x8740('0x31')],_0x4e3fb3[_0x8740('0x33')]);_0x76acb6[_0x8740('0x36')]=_[_0x8740('0x35')](_0x4e3fb3[_0x8740('0x31')],qs['fields'](_0x13473d['query'][_0x8740('0x37')]));_0x76acb6[_0x8740('0x36')]=_0x76acb6[_0x8740('0x36')][_0x8740('0x38')]?_0x76acb6['attributes']:_0x4e3fb3[_0x8740('0x31')];_0x76acb6[_0x8740('0x3b')]=qs['sort'](_0x13473d[_0x8740('0x33')][_0x8740('0x3c')]);_0x76acb6[_0x8740('0x3d')]=qs[_0x8740('0x34')](_[_0x8740('0x3e')](_0x13473d[_0x8740('0x33')],_0x4e3fb3[_0x8740('0x34')]));if(_0x13473d['query'][_0x8740('0x3f')]){_0x76acb6['where']=_[_0x8740('0x40')](_0x76acb6['where'],{'$or':_[_0x8740('0x2b')](_0x76acb6[_0x8740('0x36')],function(_0x441cac){var _0x5d3bde={};_0x5d3bde[_0x441cac]={'$like':'%'+_0x13473d[_0x8740('0x33')][_0x8740('0x3f')]+'%'};return _0x5d3bde;})});}_0x76acb6=_[_0x8740('0x40')]({},_0x76acb6,_0x13473d['options']);return _0x3d94ce[_0x8740('0x4d')](_0x76acb6);}})['then'](function(_0x1b54ee){if(_0x1b54ee){_0x31c0a0=_0x1b54ee['length'];if(!_0x13473d[_0x8740('0x33')][_0x8740('0x39')](_0x8740('0x3a'))){_0x76acb6[_0x8740('0x21')]=qs['limit'](_0x13473d[_0x8740('0x33')][_0x8740('0x21')]);_0x76acb6[_0x8740('0x1e')]=qs[_0x8740('0x1e')](_0x13473d[_0x8740('0x33')][_0x8740('0x1e')]);}return _0x3d94ce[_0x8740('0x4d')](_0x76acb6);}})[_0x8740('0x26')](function(_0x18569b){if(_0x18569b){return _0x18569b?{'count':_0x31c0a0,'rows':_0x18569b}:null;}})[_0x8740('0x26')](respondWithResult(_0x5d3802,null))['catch'](handleError(_0x5d3802,null));};exports[_0x8740('0x4f')]=function(_0x2172db,_0x5da6af,_0x3d9cec){var _0x177a3b={};var _0x43223a={};var _0x2dbd97;var _0x5c2d6f;return db[_0x8740('0x2c')][_0x8740('0x50')]({'where':{'id':_0x2172db[_0x8740('0x4b')]['id']}})[_0x8740('0x26')](handleEntityNotFound(_0x5da6af,null))[_0x8740('0x26')](function(_0x3e261b){if(_0x3e261b){_0x2dbd97=_0x3e261b;_0x43223a[_0x8740('0x31')]=_[_0x8740('0x32')](db[_0x8740('0x4e')][_0x8740('0x2d')]);_0x43223a[_0x8740('0x33')]=_[_0x8740('0x32')](_0x2172db[_0x8740('0x33')]);_0x43223a[_0x8740('0x34')]=_[_0x8740('0x35')](_0x43223a[_0x8740('0x31')],_0x43223a[_0x8740('0x33')]);_0x177a3b[_0x8740('0x36')]=_['intersection'](_0x43223a[_0x8740('0x31')],qs['fields'](_0x2172db[_0x8740('0x33')]['fields']));_0x177a3b[_0x8740('0x36')]=_0x177a3b[_0x8740('0x36')][_0x8740('0x38')]?_0x177a3b[_0x8740('0x36')]:_0x43223a[_0x8740('0x31')];_0x177a3b['order']=qs[_0x8740('0x3c')](_0x2172db[_0x8740('0x33')][_0x8740('0x3c')]);_0x177a3b[_0x8740('0x3d')]=qs['filters'](_[_0x8740('0x3e')](_0x2172db['query'],_0x43223a[_0x8740('0x34')]));if(_0x2172db[_0x8740('0x33')][_0x8740('0x3f')]){_0x177a3b[_0x8740('0x3d')]=_[_0x8740('0x40')](_0x177a3b['where'],{'$or':_[_0x8740('0x2b')](_0x177a3b[_0x8740('0x36')],function(_0x325dc0){var _0x54b0dd={};_0x54b0dd[_0x325dc0]={'$like':'%'+_0x2172db[_0x8740('0x33')][_0x8740('0x3f')]+'%'};return _0x54b0dd;})});}_0x177a3b=_[_0x8740('0x40')]({},_0x177a3b,_0x2172db[_0x8740('0x42')]);return _0x2dbd97[_0x8740('0x4f')](_0x177a3b);}})[_0x8740('0x26')](function(_0x4ca5e9){if(_0x4ca5e9){_0x5c2d6f=_0x4ca5e9[_0x8740('0x38')];if(!_0x2172db['query']['hasOwnProperty'](_0x8740('0x3a'))){_0x177a3b[_0x8740('0x21')]=qs[_0x8740('0x21')](_0x2172db[_0x8740('0x33')]['limit']);_0x177a3b['offset']=qs[_0x8740('0x1e')](_0x2172db[_0x8740('0x33')][_0x8740('0x1e')]);}return _0x2dbd97[_0x8740('0x4f')](_0x177a3b);}})[_0x8740('0x26')](function(_0x8fe66b){if(_0x8fe66b){return _0x8fe66b?{'count':_0x5c2d6f,'rows':_0x8fe66b}:null;}})[_0x8740('0x26')](respondWithResult(_0x5da6af,null))['catch'](handleError(_0x5da6af,null));};exports['getDescriptions']=function(_0x2ee4bd,_0x6eae70,_0xe1006c){var _0x22df73={};var _0x2bfaf0={};var _0x430a8b;var _0x332e10;return db[_0x8740('0x2c')]['findOne']({'where':{'id':_0x2ee4bd[_0x8740('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6eae70,null))[_0x8740('0x26')](function(_0x16eb71){if(_0x16eb71){_0x430a8b=_0x16eb71;_0x2bfaf0['model']=_[_0x8740('0x32')](db[_0x8740('0x4e')][_0x8740('0x2d')]);_0x2bfaf0[_0x8740('0x33')]=_[_0x8740('0x32')](_0x2ee4bd['query']);_0x2bfaf0[_0x8740('0x34')]=_[_0x8740('0x35')](_0x2bfaf0['model'],_0x2bfaf0[_0x8740('0x33')]);_0x22df73[_0x8740('0x36')]=_[_0x8740('0x35')](_0x2bfaf0[_0x8740('0x31')],qs['fields'](_0x2ee4bd[_0x8740('0x33')][_0x8740('0x37')]));_0x22df73[_0x8740('0x36')]=_0x22df73[_0x8740('0x36')][_0x8740('0x38')]?_0x22df73[_0x8740('0x36')]:_0x2bfaf0['model'];_0x22df73[_0x8740('0x3b')]=qs[_0x8740('0x3c')](_0x2ee4bd[_0x8740('0x33')][_0x8740('0x3c')]);_0x22df73[_0x8740('0x3d')]=qs[_0x8740('0x34')](_[_0x8740('0x3e')](_0x2ee4bd['query'],_0x2bfaf0[_0x8740('0x34')]));if(_0x2ee4bd[_0x8740('0x33')]['filter']){_0x22df73[_0x8740('0x3d')]=_['merge'](_0x22df73['where'],{'$or':_[_0x8740('0x2b')](_0x22df73[_0x8740('0x36')],function(_0xc3c2f9){var _0x5acf71={};_0x5acf71[_0xc3c2f9]={'$like':'%'+_0x2ee4bd[_0x8740('0x33')][_0x8740('0x3f')]+'%'};return _0x5acf71;})});}_0x22df73=_[_0x8740('0x40')]({},_0x22df73,_0x2ee4bd[_0x8740('0x42')]);return _0x430a8b['getDescriptions'](_0x22df73);}})[_0x8740('0x26')](function(_0xa299c5){if(_0xa299c5){_0x332e10=_0xa299c5['length'];if(!_0x2ee4bd[_0x8740('0x33')]['hasOwnProperty'](_0x8740('0x3a'))){_0x22df73['limit']=qs[_0x8740('0x21')](_0x2ee4bd[_0x8740('0x33')][_0x8740('0x21')]);_0x22df73[_0x8740('0x1e')]=qs['offset'](_0x2ee4bd['query']['offset']);}return _0x430a8b[_0x8740('0x51')](_0x22df73);}})['then'](function(_0x36f913){if(_0x36f913){return _0x36f913?{'count':_0x332e10,'rows':_0x36f913}:null;}})[_0x8740('0x26')](respondWithResult(_0x6eae70,null))[_0x8740('0x45')](handleError(_0x6eae70,null));}; \ No newline at end of file +var _0xcb70=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../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','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','bluebird'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xcb70,0xf3));var _0x0cb7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xcb70[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x0cb7('0x0'));var rimraf=require(_0x0cb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0cb7('0x2'));var Mustache=require(_0x0cb7('0x3'));var util=require(_0x0cb7('0x4'));var path=require(_0x0cb7('0x5'));var sox=require(_0x0cb7('0x6'));var csv=require(_0x0cb7('0x7'));var ejs=require(_0x0cb7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cb7('0x9'));var squel=require(_0x0cb7('0xa'));var crypto=require(_0x0cb7('0xb'));var jsforce=require(_0x0cb7('0xc'));var deskjs=require(_0x0cb7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cb7('0xe'));var Redis=require(_0x0cb7('0xf'));var authService=require(_0x0cb7('0x10'));var qs=require(_0x0cb7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cb7('0x12'));var logger=require(_0x0cb7('0x13'))(_0x0cb7('0x14'));var utils=require('../../config/utils');var config=require(_0x0cb7('0x15'));var licenseUtil=require(_0x0cb7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f3fae,_0x2398a2){_0x2398a2=_0x2398a2||0xcc;return function(_0x3cefd7){if(_0x3cefd7){return _0x2f3fae[_0x0cb7('0x17')](_0x2398a2);}return _0x2f3fae[_0x0cb7('0x18')](_0x2398a2)[_0x0cb7('0x19')]();};}function respondWithResult(_0x5ab079,_0x5de370){_0x5de370=_0x5de370||0xc8;return function(_0x4edd49){if(_0x4edd49){return _0x5ab079[_0x0cb7('0x18')](_0x5de370)['json'](_0x4edd49);}};}function respondWithFilteredResult(_0x5e763f,_0x36d903){return function(_0x25b8f7){if(_0x25b8f7){var _0xb81a2b=typeof _0x36d903['offset']===_0x0cb7('0x1a')&&typeof _0x36d903[_0x0cb7('0x1b')]===_0x0cb7('0x1a');var _0xecbe75=_0x25b8f7[_0x0cb7('0x1c')];var _0x3bf1ba=_0xb81a2b?0x0:_0x36d903[_0x0cb7('0x1d')];var _0x3dd7cf=_0xb81a2b?_0x25b8f7['count']:_0x36d903[_0x0cb7('0x1d')]+_0x36d903[_0x0cb7('0x1b')];var _0x3fed99;if(_0x3dd7cf>=_0xecbe75){_0x3dd7cf=_0xecbe75;_0x3fed99=0xc8;}else{_0x3fed99=0xce;}_0x5e763f[_0x0cb7('0x18')](_0x3fed99);return _0x5e763f[_0x0cb7('0x1e')](_0x0cb7('0x1f'),_0x3bf1ba+'-'+_0x3dd7cf+'/'+_0xecbe75)[_0x0cb7('0x20')](_0x25b8f7);}return null;};}function patchUpdates(_0x3bb7ae){return function(_0x124ba0){try{jsonpatch[_0x0cb7('0x21')](_0x124ba0,_0x3bb7ae,!![]);}catch(_0x3d6c68){return BPromise[_0x0cb7('0x22')](_0x3d6c68);}return _0x124ba0[_0x0cb7('0x23')]();};}function saveUpdates(_0x58a585,_0x44a7a5){return function(_0x30a311){if(_0x30a311){return _0x30a311[_0x0cb7('0x24')](_0x58a585)[_0x0cb7('0x25')](function(_0x29d581){return _0x29d581;});}return null;};}function removeEntity(_0x48e9c3,_0x4a3dc4){return function(_0x107e7b){if(_0x107e7b){return _0x107e7b[_0x0cb7('0x26')]()[_0x0cb7('0x25')](function(){_0x48e9c3['status'](0xcc)[_0x0cb7('0x19')]();});}};}function handleEntityNotFound(_0x26ec77,_0x4ed738){return function(_0x4df18b){if(!_0x4df18b){_0x26ec77[_0x0cb7('0x17')](0x194);}return _0x4df18b;};}function handleError(_0x197dac,_0x51aced){_0x51aced=_0x51aced||0x1f4;return function(_0x195ec7){logger[_0x0cb7('0x27')](_0x195ec7[_0x0cb7('0x28')]);if(_0x195ec7[_0x0cb7('0x29')]){delete _0x195ec7[_0x0cb7('0x29')];}_0x197dac[_0x0cb7('0x18')](_0x51aced)['send'](_0x195ec7);};}exports[_0x0cb7('0x2a')]=function(_0x43c054,_0xf85c9f){var _0x13b1a1={},_0x5080b1={},_0x17ba7d={'count':0x0,'rows':[]};var _0x20fcf2=_['map'](db[_0x0cb7('0x2b')][_0x0cb7('0x2c')],function(_0x7face8){return{'name':_0x7face8[_0x0cb7('0x2d')],'type':_0x7face8[_0x0cb7('0x2e')][_0x0cb7('0x2f')]};});_0x5080b1[_0x0cb7('0x30')]=_['map'](_0x20fcf2,_0x0cb7('0x29'));_0x5080b1[_0x0cb7('0x31')]=_[_0x0cb7('0x32')](_0x43c054['query']);_0x5080b1[_0x0cb7('0x33')]=_[_0x0cb7('0x34')](_0x5080b1['model'],_0x5080b1[_0x0cb7('0x31')]);_0x13b1a1['attributes']=_[_0x0cb7('0x34')](_0x5080b1[_0x0cb7('0x30')],qs['fields'](_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x35')]));_0x13b1a1[_0x0cb7('0x36')]=_0x13b1a1['attributes'][_0x0cb7('0x37')]?_0x13b1a1[_0x0cb7('0x36')]:_0x5080b1[_0x0cb7('0x30')];if(!_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x38')](_0x0cb7('0x39'))){_0x13b1a1[_0x0cb7('0x1b')]=qs[_0x0cb7('0x1b')](_0x43c054['query']['limit']);_0x13b1a1[_0x0cb7('0x1d')]=qs[_0x0cb7('0x1d')](_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x1d')]);}_0x13b1a1[_0x0cb7('0x3a')]=qs[_0x0cb7('0x3b')](_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x3b')]);_0x13b1a1['where']=qs['filters'](_[_0x0cb7('0x3c')](_0x43c054[_0x0cb7('0x31')],_0x5080b1[_0x0cb7('0x33')]),_0x20fcf2);if(_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x3d')]){_0x13b1a1[_0x0cb7('0x3e')]=_['merge'](_0x13b1a1[_0x0cb7('0x3e')],{'$or':_[_0x0cb7('0x3f')](_0x20fcf2,function(_0x3ac84a){if(_0x3ac84a[_0x0cb7('0x2e')]!==_0x0cb7('0x40')){var _0x542a0a={};_0x542a0a[_0x3ac84a[_0x0cb7('0x29')]]={'$like':'%'+_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x3d')]+'%'};return _0x542a0a;}})});}_0x13b1a1=_[_0x0cb7('0x41')]({},_0x13b1a1,_0x43c054[_0x0cb7('0x42')]);var _0x48b3cb={'where':_0x13b1a1['where']};return db['SalesforceConfiguration'][_0x0cb7('0x1c')](_0x48b3cb)[_0x0cb7('0x25')](function(_0x5f5105){_0x17ba7d['count']=_0x5f5105;if(_0x43c054[_0x0cb7('0x31')][_0x0cb7('0x43')]){_0x13b1a1[_0x0cb7('0x44')]=[{'all':!![]}];}return db[_0x0cb7('0x2b')][_0x0cb7('0x45')](_0x13b1a1);})[_0x0cb7('0x25')](function(_0x1e7c9a){_0x17ba7d[_0x0cb7('0x46')]=_0x1e7c9a;return _0x17ba7d;})[_0x0cb7('0x25')](respondWithFilteredResult(_0xf85c9f,_0x13b1a1))[_0x0cb7('0x47')](handleError(_0xf85c9f,null));};exports[_0x0cb7('0x48')]=function(_0x5f4a07,_0x5e47d5){var _0xae294b={'raw':![],'where':{'id':_0x5f4a07[_0x0cb7('0x49')]['id']}},_0x52d4de={};_0x52d4de['model']=_['keys'](db['SalesforceConfiguration'][_0x0cb7('0x2c')]);_0x52d4de[_0x0cb7('0x31')]=_[_0x0cb7('0x32')](_0x5f4a07[_0x0cb7('0x31')]);_0x52d4de[_0x0cb7('0x33')]=_[_0x0cb7('0x34')](_0x52d4de[_0x0cb7('0x30')],_0x52d4de[_0x0cb7('0x31')]);_0xae294b[_0x0cb7('0x36')]=_[_0x0cb7('0x34')](_0x52d4de[_0x0cb7('0x30')],qs[_0x0cb7('0x35')](_0x5f4a07[_0x0cb7('0x31')][_0x0cb7('0x35')]));_0xae294b['attributes']=_0xae294b[_0x0cb7('0x36')]['length']?_0xae294b[_0x0cb7('0x36')]:_0x52d4de['model'];if(_0x5f4a07[_0x0cb7('0x31')]['includeAll']){_0xae294b[_0x0cb7('0x44')]=[{'all':!![]}];}_0xae294b=_[_0x0cb7('0x41')]({},_0xae294b,_0x5f4a07[_0x0cb7('0x42')]);return db[_0x0cb7('0x2b')][_0x0cb7('0x4a')](_0xae294b)[_0x0cb7('0x25')](handleEntityNotFound(_0x5e47d5,null))[_0x0cb7('0x25')](respondWithResult(_0x5e47d5,null))['catch'](handleError(_0x5e47d5,null));};exports[_0x0cb7('0x4b')]=function(_0x159f11,_0xf14438){return db['SalesforceConfiguration'][_0x0cb7('0x4b')](_0x159f11[_0x0cb7('0x4c')],{})[_0x0cb7('0x25')](respondWithResult(_0xf14438,0xc9))[_0x0cb7('0x47')](handleError(_0xf14438,null));};exports[_0x0cb7('0x24')]=function(_0x2831de,_0x2ae9b2){if(_0x2831de['body']['id']){delete _0x2831de[_0x0cb7('0x4c')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x2831de[_0x0cb7('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ae9b2,null))[_0x0cb7('0x25')](saveUpdates(_0x2831de[_0x0cb7('0x4c')],null))[_0x0cb7('0x25')](respondWithResult(_0x2ae9b2,null))[_0x0cb7('0x47')](handleError(_0x2ae9b2,null));};exports['destroy']=function(_0x35fc9b,_0x530ec0){return db['SalesforceConfiguration'][_0x0cb7('0x4a')]({'where':{'id':_0x35fc9b[_0x0cb7('0x49')]['id']}})['then'](handleEntityNotFound(_0x530ec0,null))['then'](removeEntity(_0x530ec0,null))[_0x0cb7('0x47')](handleError(_0x530ec0,null));};exports[_0x0cb7('0x4d')]=function(_0x4b6f1a,_0x2428d0,_0xc78c59){var _0x1db874={};var _0x45cc29={};var _0x24f7f1;var _0x110f76;return db['SalesforceConfiguration'][_0x0cb7('0x4e')]({'where':{'id':_0x4b6f1a['params']['id']}})[_0x0cb7('0x25')](handleEntityNotFound(_0x2428d0,null))['then'](function(_0x45a0d5){if(_0x45a0d5){_0x24f7f1=_0x45a0d5;_0x45cc29[_0x0cb7('0x30')]=_['keys'](db[_0x0cb7('0x4f')][_0x0cb7('0x2c')]);_0x45cc29[_0x0cb7('0x31')]=_[_0x0cb7('0x32')](_0x4b6f1a[_0x0cb7('0x31')]);_0x45cc29['filters']=_[_0x0cb7('0x34')](_0x45cc29[_0x0cb7('0x30')],_0x45cc29['query']);_0x1db874[_0x0cb7('0x36')]=_[_0x0cb7('0x34')](_0x45cc29[_0x0cb7('0x30')],qs[_0x0cb7('0x35')](_0x4b6f1a['query'][_0x0cb7('0x35')]));_0x1db874['attributes']=_0x1db874[_0x0cb7('0x36')][_0x0cb7('0x37')]?_0x1db874[_0x0cb7('0x36')]:_0x45cc29[_0x0cb7('0x30')];_0x1db874['order']=qs[_0x0cb7('0x3b')](_0x4b6f1a[_0x0cb7('0x31')][_0x0cb7('0x3b')]);_0x1db874[_0x0cb7('0x3e')]=qs['filters'](_['pick'](_0x4b6f1a[_0x0cb7('0x31')],_0x45cc29[_0x0cb7('0x33')]));if(_0x4b6f1a[_0x0cb7('0x31')][_0x0cb7('0x3d')]){_0x1db874[_0x0cb7('0x3e')]=_['merge'](_0x1db874[_0x0cb7('0x3e')],{'$or':_[_0x0cb7('0x3f')](_0x1db874[_0x0cb7('0x36')],function(_0x55b01a){var _0x25f2b4={};_0x25f2b4[_0x55b01a]={'$like':'%'+_0x4b6f1a[_0x0cb7('0x31')][_0x0cb7('0x3d')]+'%'};return _0x25f2b4;})});}_0x1db874=_[_0x0cb7('0x41')]({},_0x1db874,_0x4b6f1a[_0x0cb7('0x42')]);return _0x24f7f1[_0x0cb7('0x4d')](_0x1db874);}})['then'](function(_0x1f1378){if(_0x1f1378){_0x110f76=_0x1f1378[_0x0cb7('0x37')];if(!_0x4b6f1a[_0x0cb7('0x31')]['hasOwnProperty'](_0x0cb7('0x39'))){_0x1db874[_0x0cb7('0x1b')]=qs[_0x0cb7('0x1b')](_0x4b6f1a[_0x0cb7('0x31')][_0x0cb7('0x1b')]);_0x1db874[_0x0cb7('0x1d')]=qs['offset'](_0x4b6f1a[_0x0cb7('0x31')][_0x0cb7('0x1d')]);}return _0x24f7f1['getFields'](_0x1db874);}})['then'](function(_0x2de9ff){if(_0x2de9ff){return _0x2de9ff?{'count':_0x110f76,'rows':_0x2de9ff}:null;}})[_0x0cb7('0x25')](respondWithResult(_0x2428d0,null))[_0x0cb7('0x47')](handleError(_0x2428d0,null));};exports['getSubjects']=function(_0x1f1630,_0x473772,_0x23a0a1){var _0x509834={};var _0x45a2f0={};var _0x448fab;var _0x424282;return db[_0x0cb7('0x2b')]['findOne']({'where':{'id':_0x1f1630[_0x0cb7('0x49')]['id']}})['then'](handleEntityNotFound(_0x473772,null))[_0x0cb7('0x25')](function(_0x48ae9e){if(_0x48ae9e){_0x448fab=_0x48ae9e;_0x45a2f0['model']=_[_0x0cb7('0x32')](db[_0x0cb7('0x4f')]['rawAttributes']);_0x45a2f0[_0x0cb7('0x31')]=_[_0x0cb7('0x32')](_0x1f1630[_0x0cb7('0x31')]);_0x45a2f0['filters']=_[_0x0cb7('0x34')](_0x45a2f0[_0x0cb7('0x30')],_0x45a2f0[_0x0cb7('0x31')]);_0x509834['attributes']=_[_0x0cb7('0x34')](_0x45a2f0[_0x0cb7('0x30')],qs[_0x0cb7('0x35')](_0x1f1630[_0x0cb7('0x31')][_0x0cb7('0x35')]));_0x509834['attributes']=_0x509834['attributes'][_0x0cb7('0x37')]?_0x509834[_0x0cb7('0x36')]:_0x45a2f0[_0x0cb7('0x30')];_0x509834[_0x0cb7('0x3a')]=qs[_0x0cb7('0x3b')](_0x1f1630['query']['sort']);_0x509834[_0x0cb7('0x3e')]=qs[_0x0cb7('0x33')](_[_0x0cb7('0x3c')](_0x1f1630[_0x0cb7('0x31')],_0x45a2f0['filters']));if(_0x1f1630['query'][_0x0cb7('0x3d')]){_0x509834['where']=_[_0x0cb7('0x41')](_0x509834[_0x0cb7('0x3e')],{'$or':_['map'](_0x509834['attributes'],function(_0x3b228f){var _0x24d413={};_0x24d413[_0x3b228f]={'$like':'%'+_0x1f1630[_0x0cb7('0x31')]['filter']+'%'};return _0x24d413;})});}_0x509834=_[_0x0cb7('0x41')]({},_0x509834,_0x1f1630[_0x0cb7('0x42')]);return _0x448fab['getSubjects'](_0x509834);}})[_0x0cb7('0x25')](function(_0x466d90){if(_0x466d90){_0x424282=_0x466d90[_0x0cb7('0x37')];if(!_0x1f1630[_0x0cb7('0x31')][_0x0cb7('0x38')](_0x0cb7('0x39'))){_0x509834['limit']=qs[_0x0cb7('0x1b')](_0x1f1630['query'][_0x0cb7('0x1b')]);_0x509834['offset']=qs[_0x0cb7('0x1d')](_0x1f1630['query'][_0x0cb7('0x1d')]);}return _0x448fab[_0x0cb7('0x50')](_0x509834);}})['then'](function(_0x4b9089){if(_0x4b9089){return _0x4b9089?{'count':_0x424282,'rows':_0x4b9089}:null;}})[_0x0cb7('0x25')](respondWithResult(_0x473772,null))[_0x0cb7('0x47')](handleError(_0x473772,null));};exports['getDescriptions']=function(_0xde01f4,_0x4d8642,_0xc4e707){var _0x86234c={};var _0xbcd513={};var _0x3b95e8;var _0x4d54af;return db[_0x0cb7('0x2b')][_0x0cb7('0x4e')]({'where':{'id':_0xde01f4[_0x0cb7('0x49')]['id']}})[_0x0cb7('0x25')](handleEntityNotFound(_0x4d8642,null))['then'](function(_0x28aa83){if(_0x28aa83){_0x3b95e8=_0x28aa83;_0xbcd513[_0x0cb7('0x30')]=_['keys'](db[_0x0cb7('0x4f')][_0x0cb7('0x2c')]);_0xbcd513[_0x0cb7('0x31')]=_['keys'](_0xde01f4[_0x0cb7('0x31')]);_0xbcd513[_0x0cb7('0x33')]=_[_0x0cb7('0x34')](_0xbcd513['model'],_0xbcd513[_0x0cb7('0x31')]);_0x86234c[_0x0cb7('0x36')]=_[_0x0cb7('0x34')](_0xbcd513[_0x0cb7('0x30')],qs[_0x0cb7('0x35')](_0xde01f4['query']['fields']));_0x86234c[_0x0cb7('0x36')]=_0x86234c[_0x0cb7('0x36')][_0x0cb7('0x37')]?_0x86234c[_0x0cb7('0x36')]:_0xbcd513[_0x0cb7('0x30')];_0x86234c[_0x0cb7('0x3a')]=qs[_0x0cb7('0x3b')](_0xde01f4['query'][_0x0cb7('0x3b')]);_0x86234c['where']=qs[_0x0cb7('0x33')](_[_0x0cb7('0x3c')](_0xde01f4[_0x0cb7('0x31')],_0xbcd513['filters']));if(_0xde01f4['query'][_0x0cb7('0x3d')]){_0x86234c[_0x0cb7('0x3e')]=_[_0x0cb7('0x41')](_0x86234c[_0x0cb7('0x3e')],{'$or':_[_0x0cb7('0x3f')](_0x86234c[_0x0cb7('0x36')],function(_0x259dd9){var _0x124ed5={};_0x124ed5[_0x259dd9]={'$like':'%'+_0xde01f4[_0x0cb7('0x31')]['filter']+'%'};return _0x124ed5;})});}_0x86234c=_['merge']({},_0x86234c,_0xde01f4[_0x0cb7('0x42')]);return _0x3b95e8[_0x0cb7('0x51')](_0x86234c);}})['then'](function(_0x2e8223){if(_0x2e8223){_0x4d54af=_0x2e8223[_0x0cb7('0x37')];if(!_0xde01f4[_0x0cb7('0x31')][_0x0cb7('0x38')](_0x0cb7('0x39'))){_0x86234c[_0x0cb7('0x1b')]=qs[_0x0cb7('0x1b')](_0xde01f4['query']['limit']);_0x86234c['offset']=qs[_0x0cb7('0x1d')](_0xde01f4['query'][_0x0cb7('0x1d')]);}return _0x3b95e8[_0x0cb7('0x51')](_0x86234c);}})[_0x0cb7('0x25')](function(_0x27f8e5){if(_0x27f8e5){return _0x27f8e5?{'count':_0x4d54af,'rows':_0x27f8e5}:null;}})[_0x0cb7('0x25')](respondWithResult(_0x4d8642,null))['catch'](handleError(_0x4d8642,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7e6fecd..0f89136 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 _0xdac8=['api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','../../config/logger'];(function(_0x15afbe,_0xe70dd8){var _0x219832=function(_0x313800){while(--_0x313800){_0x15afbe['push'](_0x15afbe['shift']());}};_0x219832(++_0xe70dd8);}(_0xdac8,0x1ef));var _0x8dac=function(_0x1d86d7,_0x339449){_0x1d86d7=_0x1d86d7-0x0;var _0x1ea968=_0xdac8[_0x1d86d7];return _0x1ea968;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8dac('0x0'))(_0x8dac('0x1'));var moment=require('moment');var BPromise=require(_0x8dac('0x2'));var rp=require(_0x8dac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dac('0x4'));var config=require(_0x8dac('0x5'));var attributes=require(_0x8dac('0x6'));module['exports']=function(_0x1f5509,_0x1ab934){return _0x1f5509['define'](_0x8dac('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc288=['bluebird','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api'];(function(_0x2ea900,_0xd4c112){var _0x20ab6e=function(_0x4cc0ca){while(--_0x4cc0ca){_0x2ea900['push'](_0x2ea900['shift']());}};_0x20ab6e(++_0xd4c112);}(_0xc288,0x9c));var _0x8c28=function(_0x1e8d79,_0x41dc9b){_0x1e8d79=_0x1e8d79-0x0;var _0x65e836=_0xc288[_0x1e8d79];return _0x65e836;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var moment=require('moment');var BPromise=require(_0x8c28('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c28('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c28('0x6'));module[_0x8c28('0x7')]=function(_0xd7ff3c,_0x1fd9e3){return _0xd7ff3c[_0x8c28('0x8')](_0x8c28('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a7b73b4..d2d29e0 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 _0x8727=['code','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2dc367,_0x591c8a){var _0x14845a=function(_0xaef88b){while(--_0xaef88b){_0x2dc367['push'](_0x2dc367['shift']());}};_0x14845a(++_0x591c8a);}(_0x8727,0x147));var _0x7872=function(_0xdc43a4,_0x36fdd0){_0xdc43a4=_0xdc43a4-0x0;var _0x4cc4d3=_0x8727[_0xdc43a4];return _0x4cc4d3;};'use strict';var _=require(_0x7872('0x0'));var util=require(_0x7872('0x1'));var moment=require(_0x7872('0x2'));var BPromise=require(_0x7872('0x3'));var rs=require(_0x7872('0x4'));var fs=require('fs');var Redis=require(_0x7872('0x5'));var db=require(_0x7872('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7872('0x7'))(_0x7872('0x8'));var config=require(_0x7872('0x9'));var jayson=require(_0x7872('0xa'));var client=jayson[_0x7872('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xae230,_0x10ecc1,_0x19f219){return new BPromise(function(_0x2faeab,_0x5ed5a3){return client[_0x7872('0xc')](_0xae230,_0x19f219)[_0x7872('0xd')](function(_0xebc50){logger[_0x7872('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x10ecc1,_0x7872('0xf'));logger[_0x7872('0x10')](_0x7872('0x11'),_0x10ecc1,'request\x20sent',JSON['stringify'](_0xebc50));if(_0xebc50['error']){if(_0xebc50['error'][_0x7872('0x12')]===0x1f4){logger[_0x7872('0x13')](_0x7872('0x14'),_0x10ecc1,_0xebc50[_0x7872('0x13')][_0x7872('0x15')]);return _0x5ed5a3(_0xebc50['error'][_0x7872('0x15')]);}logger[_0x7872('0x13')](_0x7872('0x14'),_0x10ecc1,_0xebc50[_0x7872('0x13')][_0x7872('0x15')]);return _0x2faeab(_0xebc50['error'][_0x7872('0x15')]);}else{logger[_0x7872('0xe')](_0x7872('0x14'),_0x10ecc1,'request\x20sent');_0x2faeab(_0xebc50[_0x7872('0x16')][_0x7872('0x15')]);}})['catch'](function(_0x4014be){logger[_0x7872('0x13')](_0x7872('0x14'),_0x10ecc1,_0x4014be);_0x5ed5a3(_0x4014be);});});} \ No newline at end of file +var _0xafc8=['../../config/environment','client','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x4b6f99,_0x320a09){var _0x104c09=function(_0x4bd16a){while(--_0x4bd16a){_0x4b6f99['push'](_0x4b6f99['shift']());}};_0x104c09(++_0x320a09);}(_0xafc8,0x1bc));var _0x8afc=function(_0x4b9797,_0x463db4){_0x4b9797=_0x4b9797-0x0;var _0x523515=_0xafc8[_0x4b9797];return _0x523515;};'use strict';var _=require(_0x8afc('0x0'));var util=require(_0x8afc('0x1'));var moment=require(_0x8afc('0x2'));var BPromise=require(_0x8afc('0x3'));var rs=require(_0x8afc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8afc('0x5'))('rpc');var config=require(_0x8afc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8afc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42f229,_0x3aa25f,_0x330c77){return new BPromise(function(_0x155fd3,_0x4b8c94){return client[_0x8afc('0x8')](_0x42f229,_0x330c77)[_0x8afc('0x9')](function(_0x4323ec){logger['info'](_0x8afc('0xa'),_0x3aa25f,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa25f,_0x8afc('0xb'),JSON[_0x8afc('0xc')](_0x4323ec));if(_0x4323ec[_0x8afc('0xd')]){if(_0x4323ec[_0x8afc('0xd')][_0x8afc('0xe')]===0x1f4){logger[_0x8afc('0xd')](_0x8afc('0xa'),_0x3aa25f,_0x4323ec[_0x8afc('0xd')][_0x8afc('0xf')]);return _0x4b8c94(_0x4323ec[_0x8afc('0xd')][_0x8afc('0xf')]);}logger[_0x8afc('0xd')](_0x8afc('0xa'),_0x3aa25f,_0x4323ec[_0x8afc('0xd')][_0x8afc('0xf')]);return _0x155fd3(_0x4323ec[_0x8afc('0xd')][_0x8afc('0xf')]);}else{logger[_0x8afc('0x10')](_0x8afc('0xa'),_0x3aa25f,'request\x20sent');_0x155fd3(_0x4323ec[_0x8afc('0x11')][_0x8afc('0xf')]);}})['catch'](function(_0x7d0644){logger[_0x8afc('0xd')](_0x8afc('0xa'),_0x3aa25f,_0x7d0644);_0x4b8c94(_0x7d0644);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4cddc00..e3afecc 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 _0xe96a=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xe96a,0x1cb));var _0xae96=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xe96a[_0x4a9beb];return _0x2d4c58;};'use strict';var multer=require(_0xae96('0x0'));var util=require(_0xae96('0x1'));var path=require(_0xae96('0x2'));var timeout=require('connect-timeout');var express=require(_0xae96('0x3'));var router=express[_0xae96('0x4')]();var fs_extra=require(_0xae96('0x5'));var auth=require(_0xae96('0x6'));var interaction=require(_0xae96('0x7'));var config=require('../../config/environment');var controller=require(_0xae96('0x8'));router['get']('/',auth[_0xae96('0x9')](),controller[_0xae96('0xa')]);router[_0xae96('0xb')](_0xae96('0xc'),auth[_0xae96('0x9')](),controller[_0xae96('0xd')]);router[_0xae96('0xe')]('/',auth[_0xae96('0x9')](),controller[_0xae96('0xf')]);router[_0xae96('0x10')]('/:id',auth[_0xae96('0x9')](),controller[_0xae96('0x11')]);router['delete']('/:id',auth[_0xae96('0x9')](),controller[_0xae96('0x12')]);module[_0xae96('0x13')]=router; \ No newline at end of file +var _0xfffa=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','create','delete'];(function(_0x2d8a75,_0x40111b){var _0x3f1937=function(_0x20a78f){while(--_0x20a78f){_0x2d8a75['push'](_0x2d8a75['shift']());}};_0x3f1937(++_0x40111b);}(_0xfffa,0xf1));var _0xafff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfffa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xafff('0x0'));var util=require(_0xafff('0x1'));var path=require('path');var timeout=require(_0xafff('0x2'));var express=require(_0xafff('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xafff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xafff('0x5'));var controller=require(_0xafff('0x6'));router[_0xafff('0x7')]('/',auth['isAuthenticated'](),controller[_0xafff('0x8')]);router[_0xafff('0x7')](_0xafff('0x9'),auth['isAuthenticated'](),controller[_0xafff('0xa')]);router[_0xafff('0xb')]('/',auth[_0xafff('0xc')](),controller[_0xafff('0xd')]);router['put'](_0xafff('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xafff('0xe')](_0xafff('0x9'),auth[_0xafff('0xc')](),controller[_0xafff('0xf')]);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 a05fe93..5cb5841 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 _0x0bf8=['string','variable','keyValue','STRING','customVariable','exports','ENUM'];(function(_0x502e2c,_0x28722b){var _0xb7947c=function(_0x5aa360){while(--_0x5aa360){_0x502e2c['push'](_0x502e2c['shift']());}};_0xb7947c(++_0x28722b);}(_0x0bf8,0x194));var _0x80bf=function(_0x5b2e7f,_0x4cf29a){_0x5b2e7f=_0x5b2e7f-0x0;var _0x6d6f90=_0x0bf8[_0x5b2e7f];return _0x6d6f90;};'use strict';var Sequelize=require('sequelize');module[_0x80bf('0x0')]={'type':{'type':Sequelize[_0x80bf('0x1')](_0x80bf('0x2'),_0x80bf('0x3'),'customVariable',_0x80bf('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x80bf('0x5')]},'keyType':{'type':Sequelize[_0x80bf('0x1')](_0x80bf('0x2'),_0x80bf('0x3'),_0x80bf('0x6'))},'keyContent':{'type':Sequelize[_0x80bf('0x5')]},'idField':{'type':Sequelize[_0x80bf('0x5')]},'variableName':{'type':Sequelize[_0x80bf('0x5')]}}; \ No newline at end of file +var _0xf251=['customVariable','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x46d326,_0x358e38){var _0x5d50fa=function(_0x2c22e1){while(--_0x2c22e1){_0x46d326['push'](_0x46d326['shift']());}};_0x5d50fa(++_0x358e38);}(_0xf251,0x1a1));var _0x1f25=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0xf251[_0x2be240];return _0x123543;};'use strict';var Sequelize=require(_0x1f25('0x0'));module[_0x1f25('0x1')]={'type':{'type':Sequelize[_0x1f25('0x2')](_0x1f25('0x3'),'variable','customVariable',_0x1f25('0x4'),_0x1f25('0x5')),'defaultValue':_0x1f25('0x3')},'content':{'type':Sequelize[_0x1f25('0x6')]},'key':{'type':Sequelize[_0x1f25('0x6')]},'keyType':{'type':Sequelize[_0x1f25('0x2')](_0x1f25('0x3'),'variable',_0x1f25('0x7'))},'keyContent':{'type':Sequelize[_0x1f25('0x6')]},'idField':{'type':Sequelize[_0x1f25('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index df5ea64..09d297d 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 _0x7b39=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceField','rawAttributes'];(function(_0x359f73,_0x3e91f7){var _0x57fcc6=function(_0x29783e){while(--_0x29783e){_0x359f73['push'](_0x359f73['shift']());}};_0x57fcc6(++_0x3e91f7);}(_0x7b39,0xaa));var _0x97b3=function(_0x15f236,_0x59a12b){_0x15f236=_0x15f236-0x0;var _0x3645c0=_0x7b39[_0x15f236];return _0x3645c0;};'use strict';var emlformat=require(_0x97b3('0x0'));var rimraf=require(_0x97b3('0x1'));var zipdir=require(_0x97b3('0x2'));var jsonpatch=require(_0x97b3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x97b3('0x4'));var Mustache=require(_0x97b3('0x5'));var util=require('util');var path=require(_0x97b3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97b3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97b3('0x8'));var squel=require(_0x97b3('0x9'));var crypto=require('crypto');var jsforce=require(_0x97b3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x97b3('0xb'));var querystring=require(_0x97b3('0xc'));var Papa=require(_0x97b3('0xd'));var Redis=require(_0x97b3('0xe'));var authService=require(_0x97b3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97b3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97b3('0x11'))(_0x97b3('0x12'));var utils=require(_0x97b3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x97b3('0x14'));var db=require(_0x97b3('0x15'))['db'];function respondWithStatusCode(_0x317c9b,_0x382bca){_0x382bca=_0x382bca||0xcc;return function(_0xa59b0e){if(_0xa59b0e){return _0x317c9b[_0x97b3('0x16')](_0x382bca);}return _0x317c9b[_0x97b3('0x17')](_0x382bca)[_0x97b3('0x18')]();};}function respondWithResult(_0x850b9a,_0x78cf74){_0x78cf74=_0x78cf74||0xc8;return function(_0x339252){if(_0x339252){return _0x850b9a[_0x97b3('0x17')](_0x78cf74)[_0x97b3('0x19')](_0x339252);}};}function respondWithFilteredResult(_0x2ce13f,_0x21abc3){return function(_0x18dbff){if(_0x18dbff){var _0x5f293b=typeof _0x21abc3['offset']===_0x97b3('0x1a')&&typeof _0x21abc3[_0x97b3('0x1b')]===_0x97b3('0x1a');var _0x190ba7=_0x18dbff[_0x97b3('0x1c')];var _0x4a7fda=_0x5f293b?0x0:_0x21abc3[_0x97b3('0x1d')];var _0x38a4ec=_0x5f293b?_0x18dbff[_0x97b3('0x1c')]:_0x21abc3[_0x97b3('0x1d')]+_0x21abc3[_0x97b3('0x1b')];var _0x7bd85f;if(_0x38a4ec>=_0x190ba7){_0x38a4ec=_0x190ba7;_0x7bd85f=0xc8;}else{_0x7bd85f=0xce;}_0x2ce13f['status'](_0x7bd85f);return _0x2ce13f[_0x97b3('0x1e')]('Content-Range',_0x4a7fda+'-'+_0x38a4ec+'/'+_0x190ba7)[_0x97b3('0x19')](_0x18dbff);}return null;};}function patchUpdates(_0x4d9338){return function(_0x41c88c){try{jsonpatch[_0x97b3('0x1f')](_0x41c88c,_0x4d9338,!![]);}catch(_0x5e0353){return BPromise[_0x97b3('0x20')](_0x5e0353);}return _0x41c88c[_0x97b3('0x21')]();};}function saveUpdates(_0x550b27,_0x345cdb){return function(_0x423d79){if(_0x423d79){return _0x423d79[_0x97b3('0x22')](_0x550b27)[_0x97b3('0x23')](function(_0x47ad4e){return _0x47ad4e;});}return null;};}function removeEntity(_0x19941f,_0x538df8){return function(_0x2afd66){if(_0x2afd66){return _0x2afd66[_0x97b3('0x24')]()['then'](function(){_0x19941f[_0x97b3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x168dc9,_0x3ad327){return function(_0x1a19bb){if(!_0x1a19bb){_0x168dc9[_0x97b3('0x16')](0x194);}return _0x1a19bb;};}function handleError(_0x18ec1d,_0x24183a){_0x24183a=_0x24183a||0x1f4;return function(_0x39e279){logger['error'](_0x39e279[_0x97b3('0x25')]);if(_0x39e279[_0x97b3('0x26')]){delete _0x39e279['name'];}_0x18ec1d[_0x97b3('0x17')](_0x24183a)['send'](_0x39e279);};}exports[_0x97b3('0x27')]=function(_0x57b750,_0x283054){var _0x158f08={},_0xa026b5={},_0x2c1a49={'count':0x0,'rows':[]};var _0x1ee330=_[_0x97b3('0x28')](db[_0x97b3('0x29')][_0x97b3('0x2a')],function(_0x55dc88){return{'name':_0x55dc88[_0x97b3('0x2b')],'type':_0x55dc88[_0x97b3('0x2c')][_0x97b3('0x2d')]};});_0xa026b5[_0x97b3('0x2e')]=_[_0x97b3('0x28')](_0x1ee330,_0x97b3('0x26'));_0xa026b5[_0x97b3('0x2f')]=_[_0x97b3('0x30')](_0x57b750[_0x97b3('0x2f')]);_0xa026b5[_0x97b3('0x31')]=_[_0x97b3('0x32')](_0xa026b5['model'],_0xa026b5[_0x97b3('0x2f')]);_0x158f08[_0x97b3('0x33')]=_['intersection'](_0xa026b5['model'],qs[_0x97b3('0x34')](_0x57b750[_0x97b3('0x2f')][_0x97b3('0x34')]));_0x158f08['attributes']=_0x158f08['attributes'][_0x97b3('0x35')]?_0x158f08['attributes']:_0xa026b5[_0x97b3('0x2e')];if(!_0x57b750['query'][_0x97b3('0x36')](_0x97b3('0x37'))){_0x158f08['limit']=qs['limit'](_0x57b750['query']['limit']);_0x158f08[_0x97b3('0x1d')]=qs[_0x97b3('0x1d')](_0x57b750[_0x97b3('0x2f')][_0x97b3('0x1d')]);}_0x158f08[_0x97b3('0x38')]=qs['sort'](_0x57b750[_0x97b3('0x2f')]['sort']);_0x158f08[_0x97b3('0x39')]=qs[_0x97b3('0x31')](_['pick'](_0x57b750[_0x97b3('0x2f')],_0xa026b5[_0x97b3('0x31')]),_0x1ee330);if(_0x57b750[_0x97b3('0x2f')]['filter']){_0x158f08[_0x97b3('0x39')]=_[_0x97b3('0x3a')](_0x158f08[_0x97b3('0x39')],{'$or':_[_0x97b3('0x28')](_0x1ee330,function(_0x43749b){if(_0x43749b['type']!==_0x97b3('0x3b')){var _0x1f6294={};_0x1f6294[_0x43749b[_0x97b3('0x26')]]={'$like':'%'+_0x57b750[_0x97b3('0x2f')]['filter']+'%'};return _0x1f6294;}})});}_0x158f08=_['merge']({},_0x158f08,_0x57b750['options']);var _0x3e1805={'where':_0x158f08[_0x97b3('0x39')]};return db['SalesforceField'][_0x97b3('0x1c')](_0x3e1805)[_0x97b3('0x23')](function(_0x2750ac){_0x2c1a49[_0x97b3('0x1c')]=_0x2750ac;if(_0x57b750[_0x97b3('0x2f')][_0x97b3('0x3c')]){_0x158f08[_0x97b3('0x3d')]=[{'all':!![]}];}return db[_0x97b3('0x29')][_0x97b3('0x3e')](_0x158f08);})['then'](function(_0x2f68b4){_0x2c1a49[_0x97b3('0x3f')]=_0x2f68b4;return _0x2c1a49;})[_0x97b3('0x23')](respondWithFilteredResult(_0x283054,_0x158f08))['catch'](handleError(_0x283054,null));};exports[_0x97b3('0x40')]=function(_0x31d0e2,_0x24e1df){var _0x37f274={'raw':!![],'where':{'id':_0x31d0e2[_0x97b3('0x41')]['id']}},_0x3074fa={};_0x3074fa['model']=_[_0x97b3('0x30')](db[_0x97b3('0x29')]['rawAttributes']);_0x3074fa[_0x97b3('0x2f')]=_[_0x97b3('0x30')](_0x31d0e2['query']);_0x3074fa['filters']=_[_0x97b3('0x32')](_0x3074fa[_0x97b3('0x2e')],_0x3074fa['query']);_0x37f274[_0x97b3('0x33')]=_[_0x97b3('0x32')](_0x3074fa[_0x97b3('0x2e')],qs['fields'](_0x31d0e2[_0x97b3('0x2f')][_0x97b3('0x34')]));_0x37f274[_0x97b3('0x33')]=_0x37f274[_0x97b3('0x33')][_0x97b3('0x35')]?_0x37f274[_0x97b3('0x33')]:_0x3074fa[_0x97b3('0x2e')];if(_0x31d0e2[_0x97b3('0x2f')][_0x97b3('0x3c')]){_0x37f274[_0x97b3('0x3d')]=[{'all':!![]}];}_0x37f274=_[_0x97b3('0x3a')]({},_0x37f274,_0x31d0e2[_0x97b3('0x42')]);return db[_0x97b3('0x29')][_0x97b3('0x43')](_0x37f274)[_0x97b3('0x23')](handleEntityNotFound(_0x24e1df,null))[_0x97b3('0x23')](respondWithResult(_0x24e1df,null))[_0x97b3('0x44')](handleError(_0x24e1df,null));};exports[_0x97b3('0x45')]=function(_0x4ad0bb,_0x4f630b){return db[_0x97b3('0x29')]['create'](_0x4ad0bb[_0x97b3('0x46')],{})[_0x97b3('0x23')](respondWithResult(_0x4f630b,0xc9))[_0x97b3('0x44')](handleError(_0x4f630b,null));};exports[_0x97b3('0x22')]=function(_0x5232c3,_0x375073){if(_0x5232c3[_0x97b3('0x46')]['id']){delete _0x5232c3[_0x97b3('0x46')]['id'];}return db[_0x97b3('0x29')]['find']({'where':{'id':_0x5232c3[_0x97b3('0x41')]['id']}})[_0x97b3('0x23')](handleEntityNotFound(_0x375073,null))[_0x97b3('0x23')](saveUpdates(_0x5232c3['body'],null))['then'](respondWithResult(_0x375073,null))[_0x97b3('0x44')](handleError(_0x375073,null));};exports[_0x97b3('0x24')]=function(_0x2a6913,_0x4d3ee6){return db['SalesforceField'][_0x97b3('0x43')]({'where':{'id':_0x2a6913[_0x97b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d3ee6,null))['then'](removeEntity(_0x4d3ee6,null))[_0x97b3('0x44')](handleError(_0x4d3ee6,null));}; \ No newline at end of file +var _0x6f4f=['query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','SalesforceField','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','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/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model'];(function(_0x1d184e,_0x666836){var _0x57b537=function(_0x58d0dc){while(--_0x58d0dc){_0x1d184e['push'](_0x1d184e['shift']());}};_0x57b537(++_0x666836);}(_0x6f4f,0x195));var _0xf6f4=function(_0x5b2809,_0x8b5856){_0x5b2809=_0x5b2809-0x0;var _0x39d9df=_0x6f4f[_0x5b2809];return _0x39d9df;};'use strict';var emlformat=require(_0xf6f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6f4('0x1'));var jsonpatch=require(_0xf6f4('0x2'));var rp=require(_0xf6f4('0x3'));var moment=require(_0xf6f4('0x4'));var BPromise=require(_0xf6f4('0x5'));var Mustache=require(_0xf6f4('0x6'));var util=require(_0xf6f4('0x7'));var path=require(_0xf6f4('0x8'));var sox=require('sox');var csv=require(_0xf6f4('0x9'));var ejs=require(_0xf6f4('0xa'));var fs=require('fs');var fs_extra=require(_0xf6f4('0xb'));var _=require(_0xf6f4('0xc'));var squel=require(_0xf6f4('0xd'));var crypto=require(_0xf6f4('0xe'));var jsforce=require(_0xf6f4('0xf'));var deskjs=require(_0xf6f4('0x10'));var toCsv=require(_0xf6f4('0x9'));var querystring=require(_0xf6f4('0x11'));var Papa=require(_0xf6f4('0x12'));var Redis=require(_0xf6f4('0x13'));var authService=require(_0xf6f4('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6f4('0x15'));var logger=require(_0xf6f4('0x16'))(_0xf6f4('0x17'));var utils=require('../../config/utils');var config=require(_0xf6f4('0x18'));var licenseUtil=require(_0xf6f4('0x19'));var db=require(_0xf6f4('0x1a'))['db'];function respondWithStatusCode(_0x56b301,_0x10278d){_0x10278d=_0x10278d||0xcc;return function(_0x2f82f1){if(_0x2f82f1){return _0x56b301[_0xf6f4('0x1b')](_0x10278d);}return _0x56b301[_0xf6f4('0x1c')](_0x10278d)[_0xf6f4('0x1d')]();};}function respondWithResult(_0x1e551e,_0x10aaf3){_0x10aaf3=_0x10aaf3||0xc8;return function(_0x3191ab){if(_0x3191ab){return _0x1e551e[_0xf6f4('0x1c')](_0x10aaf3)[_0xf6f4('0x1e')](_0x3191ab);}};}function respondWithFilteredResult(_0x21c6c0,_0x18fc1d){return function(_0x1bb244){if(_0x1bb244){var _0x2f8cf5=typeof _0x18fc1d[_0xf6f4('0x1f')]===_0xf6f4('0x20')&&typeof _0x18fc1d[_0xf6f4('0x21')]===_0xf6f4('0x20');var _0x579746=_0x1bb244[_0xf6f4('0x22')];var _0x56c510=_0x2f8cf5?0x0:_0x18fc1d['offset'];var _0x5d88b3=_0x2f8cf5?_0x1bb244[_0xf6f4('0x22')]:_0x18fc1d[_0xf6f4('0x1f')]+_0x18fc1d[_0xf6f4('0x21')];var _0x4f7570;if(_0x5d88b3>=_0x579746){_0x5d88b3=_0x579746;_0x4f7570=0xc8;}else{_0x4f7570=0xce;}_0x21c6c0[_0xf6f4('0x1c')](_0x4f7570);return _0x21c6c0[_0xf6f4('0x23')](_0xf6f4('0x24'),_0x56c510+'-'+_0x5d88b3+'/'+_0x579746)[_0xf6f4('0x1e')](_0x1bb244);}return null;};}function patchUpdates(_0x5615e5){return function(_0x496dec){try{jsonpatch[_0xf6f4('0x25')](_0x496dec,_0x5615e5,!![]);}catch(_0x4124f0){return BPromise[_0xf6f4('0x26')](_0x4124f0);}return _0x496dec['save']();};}function saveUpdates(_0x52b24a,_0x2475d7){return function(_0xf90f40){if(_0xf90f40){return _0xf90f40[_0xf6f4('0x27')](_0x52b24a)[_0xf6f4('0x28')](function(_0x32ad8c){return _0x32ad8c;});}return null;};}function removeEntity(_0x126c60,_0x5cc5e6){return function(_0x1ce548){if(_0x1ce548){return _0x1ce548[_0xf6f4('0x29')]()[_0xf6f4('0x28')](function(){_0x126c60['status'](0xcc)[_0xf6f4('0x1d')]();});}};}function handleEntityNotFound(_0x36ffa7,_0x4021dc){return function(_0x3e1821){if(!_0x3e1821){_0x36ffa7[_0xf6f4('0x1b')](0x194);}return _0x3e1821;};}function handleError(_0x22411c,_0x13d2a2){_0x13d2a2=_0x13d2a2||0x1f4;return function(_0x34324c){logger[_0xf6f4('0x2a')](_0x34324c[_0xf6f4('0x2b')]);if(_0x34324c[_0xf6f4('0x2c')]){delete _0x34324c['name'];}_0x22411c[_0xf6f4('0x1c')](_0x13d2a2)[_0xf6f4('0x2d')](_0x34324c);};}exports[_0xf6f4('0x2e')]=function(_0x59a27d,_0x47b24d){var _0x48f4ee={},_0x42890c={},_0x3019a7={'count':0x0,'rows':[]};var _0x2def88=_[_0xf6f4('0x2f')](db['SalesforceField'][_0xf6f4('0x30')],function(_0x40a8f1){return{'name':_0x40a8f1['fieldName'],'type':_0x40a8f1[_0xf6f4('0x31')]['key']};});_0x42890c[_0xf6f4('0x32')]=_['map'](_0x2def88,_0xf6f4('0x2c'));_0x42890c[_0xf6f4('0x33')]=_[_0xf6f4('0x34')](_0x59a27d[_0xf6f4('0x33')]);_0x42890c[_0xf6f4('0x35')]=_[_0xf6f4('0x36')](_0x42890c[_0xf6f4('0x32')],_0x42890c[_0xf6f4('0x33')]);_0x48f4ee['attributes']=_[_0xf6f4('0x36')](_0x42890c[_0xf6f4('0x32')],qs[_0xf6f4('0x37')](_0x59a27d['query'][_0xf6f4('0x37')]));_0x48f4ee[_0xf6f4('0x38')]=_0x48f4ee[_0xf6f4('0x38')][_0xf6f4('0x39')]?_0x48f4ee[_0xf6f4('0x38')]:_0x42890c[_0xf6f4('0x32')];if(!_0x59a27d['query']['hasOwnProperty']('nolimit')){_0x48f4ee[_0xf6f4('0x21')]=qs[_0xf6f4('0x21')](_0x59a27d[_0xf6f4('0x33')][_0xf6f4('0x21')]);_0x48f4ee['offset']=qs[_0xf6f4('0x1f')](_0x59a27d['query']['offset']);}_0x48f4ee[_0xf6f4('0x3a')]=qs[_0xf6f4('0x3b')](_0x59a27d['query']['sort']);_0x48f4ee['where']=qs[_0xf6f4('0x35')](_['pick'](_0x59a27d[_0xf6f4('0x33')],_0x42890c[_0xf6f4('0x35')]),_0x2def88);if(_0x59a27d[_0xf6f4('0x33')]['filter']){_0x48f4ee[_0xf6f4('0x3c')]=_[_0xf6f4('0x3d')](_0x48f4ee[_0xf6f4('0x3c')],{'$or':_['map'](_0x2def88,function(_0x177c3d){if(_0x177c3d[_0xf6f4('0x31')]!==_0xf6f4('0x3e')){var _0x303c9b={};_0x303c9b[_0x177c3d[_0xf6f4('0x2c')]]={'$like':'%'+_0x59a27d[_0xf6f4('0x33')][_0xf6f4('0x3f')]+'%'};return _0x303c9b;}})});}_0x48f4ee=_[_0xf6f4('0x3d')]({},_0x48f4ee,_0x59a27d[_0xf6f4('0x40')]);var _0x2c13fb={'where':_0x48f4ee['where']};return db[_0xf6f4('0x41')]['count'](_0x2c13fb)['then'](function(_0x4143d9){_0x3019a7[_0xf6f4('0x22')]=_0x4143d9;if(_0x59a27d['query'][_0xf6f4('0x42')]){_0x48f4ee[_0xf6f4('0x43')]=[{'all':!![]}];}return db[_0xf6f4('0x41')][_0xf6f4('0x44')](_0x48f4ee);})[_0xf6f4('0x28')](function(_0x4be728){_0x3019a7[_0xf6f4('0x45')]=_0x4be728;return _0x3019a7;})[_0xf6f4('0x28')](respondWithFilteredResult(_0x47b24d,_0x48f4ee))[_0xf6f4('0x46')](handleError(_0x47b24d,null));};exports[_0xf6f4('0x47')]=function(_0x5f4e5d,_0x388aff){var _0x35aaed={'raw':!![],'where':{'id':_0x5f4e5d['params']['id']}},_0x25f87f={};_0x25f87f[_0xf6f4('0x32')]=_[_0xf6f4('0x34')](db[_0xf6f4('0x41')]['rawAttributes']);_0x25f87f[_0xf6f4('0x33')]=_[_0xf6f4('0x34')](_0x5f4e5d[_0xf6f4('0x33')]);_0x25f87f[_0xf6f4('0x35')]=_[_0xf6f4('0x36')](_0x25f87f[_0xf6f4('0x32')],_0x25f87f[_0xf6f4('0x33')]);_0x35aaed[_0xf6f4('0x38')]=_[_0xf6f4('0x36')](_0x25f87f[_0xf6f4('0x32')],qs[_0xf6f4('0x37')](_0x5f4e5d[_0xf6f4('0x33')][_0xf6f4('0x37')]));_0x35aaed['attributes']=_0x35aaed['attributes'][_0xf6f4('0x39')]?_0x35aaed['attributes']:_0x25f87f['model'];if(_0x5f4e5d[_0xf6f4('0x33')][_0xf6f4('0x42')]){_0x35aaed[_0xf6f4('0x43')]=[{'all':!![]}];}_0x35aaed=_['merge']({},_0x35aaed,_0x5f4e5d[_0xf6f4('0x40')]);return db[_0xf6f4('0x41')][_0xf6f4('0x48')](_0x35aaed)[_0xf6f4('0x28')](handleEntityNotFound(_0x388aff,null))[_0xf6f4('0x28')](respondWithResult(_0x388aff,null))[_0xf6f4('0x46')](handleError(_0x388aff,null));};exports[_0xf6f4('0x49')]=function(_0x14a4b2,_0x507853){return db['SalesforceField'][_0xf6f4('0x49')](_0x14a4b2[_0xf6f4('0x4a')],{})[_0xf6f4('0x28')](respondWithResult(_0x507853,0xc9))[_0xf6f4('0x46')](handleError(_0x507853,null));};exports[_0xf6f4('0x27')]=function(_0x2ea837,_0x43509c){if(_0x2ea837['body']['id']){delete _0x2ea837[_0xf6f4('0x4a')]['id'];}return db[_0xf6f4('0x41')][_0xf6f4('0x48')]({'where':{'id':_0x2ea837[_0xf6f4('0x4b')]['id']}})[_0xf6f4('0x28')](handleEntityNotFound(_0x43509c,null))[_0xf6f4('0x28')](saveUpdates(_0x2ea837[_0xf6f4('0x4a')],null))[_0xf6f4('0x28')](respondWithResult(_0x43509c,null))['catch'](handleError(_0x43509c,null));};exports['destroy']=function(_0x3b999b,_0x20d23e){return db[_0xf6f4('0x41')]['find']({'where':{'id':_0x3b999b[_0xf6f4('0x4b')]['id']}})[_0xf6f4('0x28')](handleEntityNotFound(_0x20d23e,null))[_0xf6f4('0x28')](removeEntity(_0x20d23e,null))[_0xf6f4('0x46')](handleError(_0x20d23e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1469e7c..96da20a 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 _0x2f2f=['define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0x2f2f,0x66));var _0xf2f2=function(_0x454e4e,_0x5abc05){_0x454e4e=_0x454e4e-0x0;var _0x22a5f7=_0x2f2f[_0x454e4e];return _0x22a5f7;};'use strict';var _=require(_0xf2f2('0x0'));var util=require(_0xf2f2('0x1'));var logger=require(_0xf2f2('0x2'))(_0xf2f2('0x3'));var moment=require('moment');var BPromise=require(_0xf2f2('0x4'));var rp=require(_0xf2f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2f2('0x6'));var config=require(_0xf2f2('0x7'));var attributes=require(_0xf2f2('0x8'));module[_0xf2f2('0x9')]=function(_0x5e01b1,_0xe98d21){return _0x5e01b1[_0xf2f2('0xa')]('SalesforceField',attributes,{'tableName':_0xf2f2('0xb'),'paranoid':![],'indexes':[{'name':_0xf2f2('0xc'),'fields':[_0xf2f2('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e0a=['idField','FieldId','util','moment','bluebird','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x4e0a,0x1a6));var _0xa4e0=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x4e0a[_0xcb19e1];return _0x121872;};'use strict';var _=require('lodash');var util=require(_0xa4e0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa4e0('0x1'));var BPromise=require(_0xa4e0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa4e0('0x3'));var config=require(_0xa4e0('0x4'));var attributes=require('./intSalesforceField.attributes');module[_0xa4e0('0x5')]=function(_0x34aad8,_0xa4900c){return _0x34aad8[_0xa4e0('0x6')](_0xa4e0('0x7'),attributes,{'tableName':_0xa4e0('0x8'),'paranoid':![],'indexes':[{'name':_0xa4e0('0x9'),'fields':[_0xa4e0('0xa'),_0xa4e0('0xb')],'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 1cc0746..28843c1 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 _0x842f=['request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x2d7314,_0x21f24d){var _0x349b1a=function(_0x23e318){while(--_0x23e318){_0x2d7314['push'](_0x2d7314['shift']());}};_0x349b1a(++_0x21f24d);}(_0x842f,0x10e));var _0xf842=function(_0x4e7012,_0x5d5f73){_0x4e7012=_0x4e7012-0x0;var _0xcd56d5=_0x842f[_0x4e7012];return _0xcd56d5;};'use strict';var _=require('lodash');var util=require(_0xf842('0x0'));var moment=require(_0xf842('0x1'));var BPromise=require(_0xf842('0x2'));var rs=require(_0xf842('0x3'));var fs=require('fs');var Redis=require(_0xf842('0x4'));var db=require(_0xf842('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf842('0x6'))(_0xf842('0x7'));var config=require(_0xf842('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf842('0x9')][_0xf842('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20deb6,_0x558a59,_0x238056){return new BPromise(function(_0x2dd487,_0x4df90a){return client[_0xf842('0xb')](_0x20deb6,_0x238056)[_0xf842('0xc')](function(_0x3ea153){logger[_0xf842('0xd')](_0xf842('0xe'),_0x558a59,'request\x20sent');logger['debug'](_0xf842('0xf'),_0x558a59,_0xf842('0x10'),JSON[_0xf842('0x11')](_0x3ea153));if(_0x3ea153[_0xf842('0x12')]){if(_0x3ea153[_0xf842('0x12')]['code']===0x1f4){logger['error'](_0xf842('0xe'),_0x558a59,_0x3ea153[_0xf842('0x12')][_0xf842('0x13')]);return _0x4df90a(_0x3ea153[_0xf842('0x12')][_0xf842('0x13')]);}logger['error'](_0xf842('0xe'),_0x558a59,_0x3ea153[_0xf842('0x12')]['message']);return _0x2dd487(_0x3ea153[_0xf842('0x12')][_0xf842('0x13')]);}else{logger[_0xf842('0xd')](_0xf842('0xe'),_0x558a59,'request\x20sent');_0x2dd487(_0x3ea153[_0xf842('0x14')][_0xf842('0x13')]);}})[_0xf842('0x15')](function(_0x966042){logger[_0xf842('0x12')](_0xf842('0xe'),_0x558a59,_0x966042);_0x4df90a(_0x966042);});});} \ No newline at end of file +var _0x1a49=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5427ad,_0x44b2db){var _0x2c14b4=function(_0x5f4434){while(--_0x5f4434){_0x5427ad['push'](_0x5427ad['shift']());}};_0x2c14b4(++_0x44b2db);}(_0x1a49,0x172));var _0x91a4=function(_0x314dd3,_0x452bd3){_0x314dd3=_0x314dd3-0x0;var _0x2efc6c=_0x1a49[_0x314dd3];return _0x2efc6c;};'use strict';var _=require(_0x91a4('0x0'));var util=require(_0x91a4('0x1'));var moment=require(_0x91a4('0x2'));var BPromise=require(_0x91a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91a4('0x5'))(_0x91a4('0x6'));var config=require(_0x91a4('0x7'));var jayson=require(_0x91a4('0x8'));var client=jayson[_0x91a4('0x9')][_0x91a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x83e924,_0x15710e,_0x26ba2e){return new BPromise(function(_0x4e6f52,_0x39eb12){return client[_0x91a4('0xb')](_0x83e924,_0x26ba2e)[_0x91a4('0xc')](function(_0xd1470){logger[_0x91a4('0xd')](_0x91a4('0xe'),_0x15710e,_0x91a4('0xf'));logger[_0x91a4('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x15710e,'request\x20sent',JSON[_0x91a4('0x11')](_0xd1470));if(_0xd1470[_0x91a4('0x12')]){if(_0xd1470['error']['code']===0x1f4){logger[_0x91a4('0x12')](_0x91a4('0xe'),_0x15710e,_0xd1470[_0x91a4('0x12')][_0x91a4('0x13')]);return _0x39eb12(_0xd1470[_0x91a4('0x12')][_0x91a4('0x13')]);}logger[_0x91a4('0x12')]('SalesforceField,\x20%s,\x20%s',_0x15710e,_0xd1470['error'][_0x91a4('0x13')]);return _0x4e6f52(_0xd1470[_0x91a4('0x12')]['message']);}else{logger[_0x91a4('0xd')]('SalesforceField,\x20%s,\x20%s',_0x15710e,_0x91a4('0xf'));_0x4e6f52(_0xd1470['result'][_0x91a4('0x13')]);}})['catch'](function(_0x3a0ce7){logger['error'](_0x91a4('0xe'),_0x15710e,_0x3a0ce7);_0x39eb12(_0x3a0ce7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1439184..e21f3b3 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 _0xd3d1=['./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3d1,0x172));var _0x1d3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd3d1[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['getConfigurations']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x12')]);router[_0x1d3d('0x11')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x13')]);router['put'](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller['update']);router['delete'](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0d9f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','post','addConfiguration','/:id','update','delete','exports','multer','util','path','express','Router'];(function(_0x232a12,_0x5ccaff){var _0x43aaa7=function(_0x2d81e2){while(--_0x2d81e2){_0x232a12['push'](_0x232a12['shift']());}};_0x43aaa7(++_0x5ccaff);}(_0x0d9f,0x136));var _0xf0d9=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x0d9f[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require(_0xf0d9('0x0'));var util=require(_0xf0d9('0x1'));var path=require(_0xf0d9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0d9('0x3'));var router=express[_0xf0d9('0x4')]();var fs_extra=require(_0xf0d9('0x5'));var auth=require(_0xf0d9('0x6'));var interaction=require(_0xf0d9('0x7'));var config=require(_0xf0d9('0x8'));var controller=require(_0xf0d9('0x9'));router[_0xf0d9('0xa')]('/',auth[_0xf0d9('0xb')](),controller[_0xf0d9('0xc')]);router[_0xf0d9('0xa')]('/:id',auth[_0xf0d9('0xb')](),controller[_0xf0d9('0xd')]);router[_0xf0d9('0xa')](_0xf0d9('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf0d9('0xa')]('/:id/fields',auth[_0xf0d9('0xb')](),controller['getFields']);router[_0xf0d9('0xf')]('/',auth[_0xf0d9('0xb')](),controller['create']);router[_0xf0d9('0xf')](_0xf0d9('0xe'),auth[_0xf0d9('0xb')](),controller[_0xf0d9('0x10')]);router['put'](_0xf0d9('0x11'),auth[_0xf0d9('0xb')](),controller[_0xf0d9('0x12')]);router[_0xf0d9('0x13')](_0xf0d9('0x11'),auth[_0xf0d9('0xb')](),controller['destroy']);module[_0xf0d9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index fbf7371..7874237 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 _0x7322=['STRING','username','remoteUri','sequelize','exports'];(function(_0x25b870,_0x1291a5){var _0x5f7597=function(_0x48206c){while(--_0x48206c){_0x25b870['push'](_0x25b870['shift']());}};_0x5f7597(++_0x1291a5);}(_0x7322,0x12f));var _0x2732=function(_0x3f4f3b,_0x2d7be2){_0x3f4f3b=_0x3f4f3b-0x0;var _0xfc6f02=_0x7322[_0x3f4f3b];return _0xfc6f02;};'use strict';var Sequelize=require(_0x2732('0x0'));module[_0x2732('0x1')]={'name':{'type':Sequelize[_0x2732('0x2')]},'description':{'type':Sequelize[_0x2732('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2732('0x3')},'password':{'type':Sequelize[_0x2732('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2732('0x2')],'unique':_0x2732('0x4')},'serverUrl':{'type':Sequelize[_0x2732('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6459=['sequelize','exports','STRING','username','remoteUri'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x6459,0x136));var _0x9645=function(_0x1cf2db,_0x129653){_0x1cf2db=_0x1cf2db-0x0;var _0x428b64=_0x6459[_0x1cf2db];return _0x428b64;};'use strict';var Sequelize=require(_0x9645('0x0'));module[_0x9645('0x1')]={'name':{'type':Sequelize[_0x9645('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x9645('0x3')},'password':{'type':Sequelize[_0x9645('0x2')]},'email':{'type':Sequelize[_0x9645('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9645('0x4')},'serverUrl':{'type':Sequelize[_0x9645('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 9644f4d..33790d3 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 _0x130b=['findAll','catch','show','params','keys','rawAttributes','length','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','hold_reason','subcategory','close_code','incident_state','severity','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','sys_domain_path','rfc','expected_start','business_duration','group_list','reopened_time','approval_set','work_notes','short_description','correlation_display','additional_assignee_list','calendar_duration','notify','close_notes','sys_id','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','location','category','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','log','TCL:\x20_object','internalType','label','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','false','inactive','value','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','map','model','query','filters','intersection','attributes','fields','order','sort','pick','filter','merge','where','type','VIRTUAL','options','ServicenowAccount','includeAll','include'];(function(_0x4269c8,_0xd07196){var _0x2e6901=function(_0x10cd8e){while(--_0x10cd8e){_0x4269c8['push'](_0x4269c8['shift']());}};_0x2e6901(++_0xd07196);}(_0x130b,0x11d));var _0xb130=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x130b[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0xb130('0x0'));var rimraf=require(_0xb130('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb130('0x2'));var BPromise=require(_0xb130('0x3'));var Mustache=require('mustache');var util=require(_0xb130('0x4'));var path=require(_0xb130('0x5'));var sox=require(_0xb130('0x6'));var csv=require(_0xb130('0x7'));var ejs=require(_0xb130('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb130('0x9'));var deskjs=require(_0xb130('0xa'));var toCsv=require(_0xb130('0x7'));var querystring=require('querystring');var Papa=require(_0xb130('0xb'));var Redis=require(_0xb130('0xc'));var authService=require(_0xb130('0xd'));var qs=require(_0xb130('0xe'));var as=require(_0xb130('0xf'));var hardwareService=require(_0xb130('0x10'));var logger=require(_0xb130('0x11'))(_0xb130('0x12'));var utils=require(_0xb130('0x13'));var config=require(_0xb130('0x14'));var licenseUtil=require(_0xb130('0x15'));var db=require(_0xb130('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2b1120,_0x2f8f71){_0x2f8f71=_0x2f8f71||0xcc;return function(_0x18e8f3){if(_0x18e8f3){return _0x2b1120[_0xb130('0x17')](_0x2f8f71);}return _0x2b1120['status'](_0x2f8f71)['end']();};}function respondWithResult(_0x16816b,_0x4b63df){_0x4b63df=_0x4b63df||0xc8;return function(_0x2c2987){if(_0x2c2987){return _0x16816b[_0xb130('0x18')](_0x4b63df)[_0xb130('0x19')](_0x2c2987);}};}function respondWithFilteredResult(_0x502244,_0x278dc3){return function(_0x1bf9f1){if(_0x1bf9f1){var _0x5335ff=typeof _0x278dc3[_0xb130('0x1a')]===_0xb130('0x1b')&&typeof _0x278dc3[_0xb130('0x1c')]===_0xb130('0x1b');var _0x22fe54=_0x1bf9f1['count'];var _0x498ab4=_0x5335ff?0x0:_0x278dc3['offset'];var _0x75bf64=_0x5335ff?_0x1bf9f1[_0xb130('0x1d')]:_0x278dc3[_0xb130('0x1a')]+_0x278dc3['limit'];var _0x4b4117;if(_0x75bf64>=_0x22fe54){_0x75bf64=_0x22fe54;_0x4b4117=0xc8;}else{_0x4b4117=0xce;}_0x502244[_0xb130('0x18')](_0x4b4117);return _0x502244['set'](_0xb130('0x1e'),_0x498ab4+'-'+_0x75bf64+'/'+_0x22fe54)['json'](_0x1bf9f1);}return null;};}function patchUpdates(_0x3b866b){return function(_0x5c9e60){try{jsonpatch['apply'](_0x5c9e60,_0x3b866b,!![]);}catch(_0x480e9b){return BPromise[_0xb130('0x1f')](_0x480e9b);}return _0x5c9e60[_0xb130('0x20')]();};}function saveUpdates(_0x3f9c58,_0x5bfcee){return function(_0xb8b2fa){if(_0xb8b2fa){return _0xb8b2fa[_0xb130('0x21')](_0x3f9c58)[_0xb130('0x22')](function(_0x4b9842){return _0x4b9842;});}return null;};}function removeEntity(_0x41e0db,_0x27c8e1){return function(_0x29582c){if(_0x29582c){return _0x29582c['destroy']()[_0xb130('0x22')](function(){_0x41e0db[_0xb130('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa77c,_0x42b2dc){return function(_0x54e5d4){if(!_0x54e5d4){_0xaa77c[_0xb130('0x17')](0x194);}return _0x54e5d4;};}function handleError(_0x55ccd9,_0x558c00){_0x558c00=_0x558c00||0x1f4;return function(_0x55ecec){logger[_0xb130('0x23')](_0x55ecec[_0xb130('0x24')]);if(_0x55ecec[_0xb130('0x25')]){delete _0x55ecec[_0xb130('0x25')];}_0x55ccd9[_0xb130('0x18')](_0x558c00)['send'](_0x55ecec);};}exports['index']=function(_0xa60cbc,_0x1bc445){var _0x1ea545={},_0x2b13d2={},_0x25aa41={'count':0x0,'rows':[]};var _0xe76e9=_[_0xb130('0x26')](db['ServicenowAccount']['rawAttributes'],function(_0x2514db){return{'name':_0x2514db['fieldName'],'type':_0x2514db['type']['key']};});_0x2b13d2[_0xb130('0x27')]=_[_0xb130('0x26')](_0xe76e9,_0xb130('0x25'));_0x2b13d2[_0xb130('0x28')]=_['keys'](_0xa60cbc[_0xb130('0x28')]);_0x2b13d2[_0xb130('0x29')]=_[_0xb130('0x2a')](_0x2b13d2['model'],_0x2b13d2['query']);_0x1ea545[_0xb130('0x2b')]=_[_0xb130('0x2a')](_0x2b13d2[_0xb130('0x27')],qs['fields'](_0xa60cbc[_0xb130('0x28')][_0xb130('0x2c')]));_0x1ea545[_0xb130('0x2b')]=_0x1ea545[_0xb130('0x2b')]['length']?_0x1ea545[_0xb130('0x2b')]:_0x2b13d2[_0xb130('0x27')];if(!_0xa60cbc['query']['hasOwnProperty']('nolimit')){_0x1ea545[_0xb130('0x1c')]=qs[_0xb130('0x1c')](_0xa60cbc[_0xb130('0x28')]['limit']);_0x1ea545[_0xb130('0x1a')]=qs[_0xb130('0x1a')](_0xa60cbc[_0xb130('0x28')]['offset']);}_0x1ea545[_0xb130('0x2d')]=qs[_0xb130('0x2e')](_0xa60cbc['query'][_0xb130('0x2e')]);_0x1ea545['where']=qs[_0xb130('0x29')](_[_0xb130('0x2f')](_0xa60cbc[_0xb130('0x28')],_0x2b13d2[_0xb130('0x29')]),_0xe76e9);if(_0xa60cbc[_0xb130('0x28')][_0xb130('0x30')]){_0x1ea545['where']=_[_0xb130('0x31')](_0x1ea545[_0xb130('0x32')],{'$or':_['map'](_0xe76e9,function(_0x1619fb){if(_0x1619fb[_0xb130('0x33')]!==_0xb130('0x34')){var _0x495cd4={};_0x495cd4[_0x1619fb[_0xb130('0x25')]]={'$like':'%'+_0xa60cbc[_0xb130('0x28')]['filter']+'%'};return _0x495cd4;}})});}_0x1ea545=_['merge']({},_0x1ea545,_0xa60cbc[_0xb130('0x35')]);var _0x36727a={'where':_0x1ea545[_0xb130('0x32')]};return db[_0xb130('0x36')]['count'](_0x36727a)[_0xb130('0x22')](function(_0x3d7851){_0x25aa41['count']=_0x3d7851;if(_0xa60cbc['query'][_0xb130('0x37')]){_0x1ea545[_0xb130('0x38')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb130('0x39')](_0x1ea545);})[_0xb130('0x22')](function(_0x324c1b){_0x25aa41['rows']=_0x324c1b;return _0x25aa41;})[_0xb130('0x22')](respondWithFilteredResult(_0x1bc445,_0x1ea545))[_0xb130('0x3a')](handleError(_0x1bc445,null));};exports[_0xb130('0x3b')]=function(_0x43e493,_0x18fc60){var _0x21927f={'raw':![],'where':{'id':_0x43e493[_0xb130('0x3c')]['id']}},_0x33f439={};_0x33f439[_0xb130('0x27')]=_[_0xb130('0x3d')](db['ServicenowAccount'][_0xb130('0x3e')]);_0x33f439[_0xb130('0x28')]=_[_0xb130('0x3d')](_0x43e493[_0xb130('0x28')]);_0x33f439[_0xb130('0x29')]=_['intersection'](_0x33f439[_0xb130('0x27')],_0x33f439[_0xb130('0x28')]);_0x21927f[_0xb130('0x2b')]=_[_0xb130('0x2a')](_0x33f439[_0xb130('0x27')],qs[_0xb130('0x2c')](_0x43e493['query']['fields']));_0x21927f['attributes']=_0x21927f['attributes'][_0xb130('0x3f')]?_0x21927f[_0xb130('0x2b')]:_0x33f439[_0xb130('0x27')];if(_0x43e493[_0xb130('0x28')][_0xb130('0x37')]){_0x21927f['include']=[{'all':!![]}];}_0x21927f=_['merge']({},_0x21927f,_0x43e493[_0xb130('0x35')]);return db['ServicenowAccount'][_0xb130('0x40')](_0x21927f)['then'](handleEntityNotFound(_0x18fc60,null))[_0xb130('0x22')](respondWithResult(_0x18fc60,null))[_0xb130('0x3a')](handleError(_0x18fc60,null));};exports[_0xb130('0x41')]=function(_0x4c4140,_0x37cb4f){return db[_0xb130('0x36')][_0xb130('0x41')](_0x4c4140[_0xb130('0x42')],{})[_0xb130('0x22')](respondWithResult(_0x37cb4f,0xc9))['catch'](handleError(_0x37cb4f,null));};exports[_0xb130('0x21')]=function(_0x578c4f,_0x31cdd5){if(_0x578c4f[_0xb130('0x42')]['id']){delete _0x578c4f[_0xb130('0x42')]['id'];}return db[_0xb130('0x36')][_0xb130('0x40')]({'where':{'id':_0x578c4f[_0xb130('0x3c')]['id']}})[_0xb130('0x22')](handleEntityNotFound(_0x31cdd5,null))[_0xb130('0x22')](saveUpdates(_0x578c4f[_0xb130('0x42')],null))['then'](respondWithResult(_0x31cdd5,null))[_0xb130('0x3a')](handleError(_0x31cdd5,null));};exports[_0xb130('0x43')]=function(_0x20765f,_0x491620){return db[_0xb130('0x36')][_0xb130('0x40')]({'where':{'id':_0x20765f[_0xb130('0x3c')]['id']}})[_0xb130('0x22')](handleEntityNotFound(_0x491620,null))[_0xb130('0x22')](removeEntity(_0x491620,null))['catch'](handleError(_0x491620,null));};exports[_0xb130('0x44')]=function(_0x2c7efa,_0x2102e8,_0x28cbfe){var _0x99083e={};var _0x45be64={};var _0x36ce5c;var _0x46a9a0;return db[_0xb130('0x36')][_0xb130('0x45')]({'where':{'id':_0x2c7efa[_0xb130('0x3c')]['id']}})[_0xb130('0x22')](handleEntityNotFound(_0x2102e8,null))[_0xb130('0x22')](function(_0xd05949){if(_0xd05949){_0x36ce5c=_0xd05949;_0x45be64['model']=_[_0xb130('0x3d')](db[_0xb130('0x46')][_0xb130('0x3e')]);_0x45be64[_0xb130('0x28')]=_[_0xb130('0x3d')](_0x2c7efa['query']);_0x45be64[_0xb130('0x29')]=_['intersection'](_0x45be64[_0xb130('0x27')],_0x45be64[_0xb130('0x28')]);_0x99083e[_0xb130('0x2b')]=_[_0xb130('0x2a')](_0x45be64[_0xb130('0x27')],qs[_0xb130('0x2c')](_0x2c7efa[_0xb130('0x28')]['fields']));_0x99083e['attributes']=_0x99083e[_0xb130('0x2b')][_0xb130('0x3f')]?_0x99083e[_0xb130('0x2b')]:_0x45be64['model'];_0x99083e['order']=qs[_0xb130('0x2e')](_0x2c7efa[_0xb130('0x28')]['sort']);_0x99083e['where']=qs[_0xb130('0x29')](_['pick'](_0x2c7efa[_0xb130('0x28')],_0x45be64[_0xb130('0x29')]));if(_0x2c7efa[_0xb130('0x28')][_0xb130('0x30')]){_0x99083e['where']=_['merge'](_0x99083e[_0xb130('0x32')],{'$or':_[_0xb130('0x26')](_0x99083e[_0xb130('0x2b')],function(_0x55e8a3){var _0x5ef5a2={};_0x5ef5a2[_0x55e8a3]={'$like':'%'+_0x2c7efa[_0xb130('0x28')][_0xb130('0x30')]+'%'};return _0x5ef5a2;})});}_0x99083e=_[_0xb130('0x31')]({},_0x99083e,_0x2c7efa[_0xb130('0x35')]);return _0x36ce5c[_0xb130('0x44')](_0x99083e);}})['then'](function(_0x2ee349){if(_0x2ee349){_0x46a9a0=_0x2ee349[_0xb130('0x3f')];if(!_0x2c7efa[_0xb130('0x28')]['hasOwnProperty'](_0xb130('0x47'))){_0x99083e['limit']=qs[_0xb130('0x1c')](_0x2c7efa[_0xb130('0x28')][_0xb130('0x1c')]);_0x99083e[_0xb130('0x1a')]=qs['offset'](_0x2c7efa[_0xb130('0x28')][_0xb130('0x1a')]);}return _0x36ce5c[_0xb130('0x44')](_0x99083e);}})[_0xb130('0x22')](function(_0x647af3){if(_0x647af3){return _0x647af3?{'count':_0x46a9a0,'rows':_0x647af3}:null;}})[_0xb130('0x22')](respondWithResult(_0x2102e8,null))[_0xb130('0x3a')](handleError(_0x2102e8,null));};exports[_0xb130('0x48')]=function(_0x42cbbc,_0xceeec3,_0x1b372e){if(_0x42cbbc[_0xb130('0x42')]['id']){delete _0x42cbbc['body']['id'];}return db[_0xb130('0x36')][_0xb130('0x45')]({'where':{'id':_0x42cbbc[_0xb130('0x3c')]['id']}})[_0xb130('0x22')](handleEntityNotFound(_0xceeec3,null))[_0xb130('0x22')](function(_0x53f287){if(_0x53f287){_0x42cbbc['body'][_0xb130('0x49')]=_0x53f287['id'];_0x42cbbc[_0xb130('0x42')][_0xb130('0x4a')]=integrations[_0xb130('0x4b')](_0x42cbbc[_0xb130('0x42')][_0xb130('0x4c')],_0x42cbbc['body']['type']);_0x42cbbc[_0xb130('0x42')][_0xb130('0x4d')]=integrations['getDescriptions'](_0x42cbbc['body'][_0xb130('0x4c')],_0x42cbbc[_0xb130('0x42')][_0xb130('0x33')]);return db[_0xb130('0x46')]['create'](_0x42cbbc['body'],{'include':[{'model':db[_0xb130('0x4e')],'as':_0xb130('0x4a')},{'model':db[_0xb130('0x4e')],'as':_0xb130('0x4d')}]});}return null;})[_0xb130('0x22')](respondWithResult(_0xceeec3,null))[_0xb130('0x3a')](handleError(_0xceeec3,null));};exports[_0xb130('0x4f')]=function(_0x1dbe4c,_0x2c35b0,_0xa6ad51){var _0x27ce88=['made_sla',_0xb130('0x50'),'knowledge',_0xb130('0x51'),_0xb130('0x52'),'notify',_0xb130('0x53'),_0xb130('0x54'),'category'];var _0x52782d=[_0xb130('0x55'),_0xb130('0x56'),_0xb130('0x57'),_0xb130('0x58'),_0xb130('0x59'),'sys_updated_on',_0xb130('0x5a'),'hold_reason',_0xb130('0x5b'),_0xb130('0x5c'),'resolved_by',_0xb130('0x5d'),_0xb130('0x5e'),_0xb130('0x5f'),_0xb130('0x60'),_0xb130('0x61'),_0xb130('0x62'),'sys_created_by',_0xb130('0x63'),'order',_0xb130('0x64'),_0xb130('0x65'),_0xb130('0x66'),'delivery_plan','impact',_0xb130('0x67'),_0xb130('0x68'),'business_service','priority',_0xb130('0x69'),_0xb130('0x6a'),'time_worked',_0xb130('0x6b'),'opened_at',_0xb130('0x6c'),_0xb130('0x6d'),'work_end',_0xb130('0x6e'),'resolved_at','caller_id',_0xb130('0x6f'),_0xb130('0x51'),_0xb130('0x70'),_0xb130('0x71'),'close_code',_0xb130('0x72'),'delivery_task','work_start','assignment_group','business_stc',_0xb130('0x73'),'description',_0xb130('0x74'),_0xb130('0x75'),'sys_class_name',_0xb130('0x76'),'closed_by','follow_up','parent_incident',_0xb130('0x77'),_0xb130('0x78'),'reopened_by','incident_state',_0xb130('0x79'),_0xb130('0x7a'),_0xb130('0x7b'),'reassignment_count',_0xb130('0x7c'),_0xb130('0x7d'),_0xb130('0x54'),_0xb130('0x7e'),_0xb130('0x7f'),_0xb130('0x80'),_0xb130('0x81'),_0xb130('0x82'),_0xb130('0x83'),'reopen_count',_0xb130('0x84'),_0xb130('0x85'),_0xb130('0x86'),'correlation_id',_0xb130('0x87'),_0xb130('0x88')];var _0x593c63='';var _0x1f92a9='';var _0x2c1705=[];var _0x1b1946='';var _0x717129='';var _0x1aa313=[];var _0x14f166='';var _0x129475='';var _0x1dc7dc={};var _0x2b6a6b='';return db[_0xb130('0x36')][_0xb130('0x45')]({'where':{'id':_0x1dbe4c['params']['id']},'attributes':['id',_0xb130('0x89'),_0xb130('0x8a'),_0xb130('0x8b'),_0xb130('0x8c'),'serverUrl']})['then'](handleEntityNotFound(_0x2c35b0,null))[_0xb130('0x22')](function(_0x1ef280){if(_0x1ef280){_0x2b6a6b=_0x1ef280['remoteUri'];var _0x211907=_0x2b6a6b[_0xb130('0x8d')](-0x1);if(_0x211907==='/'){_0x2b6a6b=_0x2b6a6b[_0xb130('0x8e')](0x0,_0x2b6a6b['lastIndexOf'](_0x211907));}_0x129475=util[_0xb130('0x8f')](_0xb130('0x90'),_0x2b6a6b);_0x14f166=util[_0xb130('0x8f')](_0xb130('0x91'),_0x2b6a6b);_0x1dc7dc={'user':_0x1ef280['username'],'pass':_0x1ef280[_0xb130('0x8a')]};var _0x40d66a={'method':_0xb130('0x92'),'uri':_0x129475+_0xb130('0x93'),'auth':_0x1dc7dc,'json':!![]};return rp(_0x40d66a);}})[_0xb130('0x22')](function(_0x2bef15){if(_0x2bef15[_0xb130('0x94')][_0xb130('0x3f')]>0x0){_0x593c63=_0x2bef15[_0xb130('0x94')];}console['log'](_0xb130('0x95'),_0x593c63);_0x1aa313=[];_0x1f92a9=Object[_0xb130('0x96')]([],_0x593c63);_[_0xb130('0x97')](_0x1f92a9,function(_0x235245){return!_0x27ce88[_0xb130('0x98')](_0x235245[_0xb130('0x25')]);});_0x1f92a9[_0xb130('0x99')](function(_0x3334dc){var _0x217c5c=createFieldObject(_0x14f166,_0x1dc7dc,_0x3334dc['internalType'],_0x3334dc[_0xb130('0x25')],_0x3334dc['label'],![]);_0x1aa313[_0xb130('0x9a')](_0x217c5c);});return Promise[_0xb130('0x9b')](_0x1aa313);})['then'](function(_0x121c13){_0x2c1705=_0x121c13;_0x1b1946=Object[_0xb130('0x96')]([],_0x593c63);console[_0xb130('0x9c')](_0xb130('0x9d'),_0x593c63);_[_0xb130('0x97')](_0x1b1946,function(_0x3c9978){return _0x52782d['includes'](_0x3c9978[_0xb130('0x25')]);});console[_0xb130('0x9c')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1b1946);_0x1aa313=[];_0x1b1946[_0xb130('0x99')](function(_0x1ff4e0){var _0x55a0a1=createFieldObject(_0x14f166,_0x1dc7dc,_0x1ff4e0[_0xb130('0x9e')],_0x1ff4e0[_0xb130('0x25')],_0x1ff4e0[_0xb130('0x9f')],!![]);_0x1aa313[_0xb130('0x9a')](_0x55a0a1);});return Promise[_0xb130('0x9b')](_0x1aa313);})['then'](function(_0x2f0048){_0x717129=_0x2f0048;var _0x40ec96=_0x2c1705[_0xb130('0xa0')](_0x717129);return{'count':_0x40ec96['length'],'rows':_0x40ec96};})[_0xb130('0x22')](respondWithResult(_0x2c35b0,null))[_0xb130('0x3a')](function(_0x1aac95){console['log'](_0xb130('0xa1')+_0x1aac95);var _0x527095=_0x1dbe4c[_0xb130('0x28')][_0xb130('0xa2')]?0x1f4:_0x1aac95[_0xb130('0xa3')]||0x1f4;logger[_0xb130('0x23')](_0x1aac95[_0xb130('0x24')]);delete _0x1aac95[_0xb130('0x25')];if(_0x527095===0x191){_0x527095=0x190;}_0x2c35b0[_0xb130('0x18')](_0x527095)[_0xb130('0xa4')](_0x1dbe4c[_0xb130('0x28')][_0xb130('0xa2')]?{'message':_0xb130('0xa5'),'statusCode':_0x1aac95['statusCode']}:_0x1aac95);});};function createFieldObject(_0x5e2594,_0x1bf78e,_0x220ecc,_0x10b099,_0x5b8b23,_0x5482ba){return new Promise(function(_0x292703,_0x19438e){var _0x398bd5={'id':_0x10b099,'name':_0x5b8b23,'custom':_0x5482ba};if(_0x220ecc===_0xb130('0xa6')){_0x398bd5['options']=[{'name':_0xb130('0xa7'),'value':'true'},{'name':'False','value':_0xb130('0xa8')}];_0x292703(_0x398bd5);}else{var _0x3d7647={'method':_0xb130('0x92'),'uri':_0x5e2594+'sys_choice?sysparm_query=name=incident^element='+_0x10b099,'auth':_0x1bf78e,'json':!![]};return rp(_0x3d7647)[_0xb130('0x22')](function(_0x5ee951){var _0x59ad72=[];if(_0x5ee951['result']['length']>0x0){_0x5ee951[_0xb130('0x94')]['forEach'](function(_0x4022da){if(_0x4022da[_0xb130('0xa9')]===_0xb130('0xa8')){var _0x53e716={'name':_0x4022da['label'],'value':_0x4022da[_0xb130('0xaa')]};_0x59ad72[_0xb130('0x9a')](_0x53e716);}});}_0x398bd5[_0xb130('0x35')]=_0x59ad72;if(_0x398bd5['options']['length']>0x0){_0x292703(_0x398bd5);}else{if(_0x5482ba==![]){_0x292703();}else{_0x292703(_0x398bd5);}}});}});} \ No newline at end of file +var _0xd94c=['cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','reassignment_count','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','concat','test','stack','statusCode','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','find','findOne','ServicenowConfiguration','pick','filter','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','close_code','incident_state','category','parent','caused_by','watch_list','sys_updated_on','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','knowledge','closed_at'];(function(_0x3faa40,_0x4042c4){var _0x1992cf=function(_0x3aabbf){while(--_0x3aabbf){_0x3faa40['push'](_0x3faa40['shift']());}};_0x1992cf(++_0x4042c4);}(_0xd94c,0xfb));var _0xcd94=function(_0x27b967,_0x47be1f){_0x27b967=_0x27b967-0x0;var _0x36a6dc=_0xd94c[_0x27b967];return _0x36a6dc;};'use strict';var emlformat=require(_0xcd94('0x0'));var rimraf=require(_0xcd94('0x1'));var zipdir=require(_0xcd94('0x2'));var jsonpatch=require(_0xcd94('0x3'));var rp=require('request-promise');var moment=require(_0xcd94('0x4'));var BPromise=require(_0xcd94('0x5'));var Mustache=require(_0xcd94('0x6'));var util=require(_0xcd94('0x7'));var path=require(_0xcd94('0x8'));var sox=require(_0xcd94('0x9'));var csv=require(_0xcd94('0xa'));var ejs=require(_0xcd94('0xb'));var fs=require('fs');var fs_extra=require(_0xcd94('0xc'));var _=require(_0xcd94('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd94('0xe'));var deskjs=require(_0xcd94('0xf'));var toCsv=require(_0xcd94('0xa'));var querystring=require(_0xcd94('0x10'));var Papa=require(_0xcd94('0x11'));var Redis=require(_0xcd94('0x12'));var authService=require(_0xcd94('0x13'));var qs=require(_0xcd94('0x14'));var as=require(_0xcd94('0x15'));var hardwareService=require(_0xcd94('0x16'));var logger=require(_0xcd94('0x17'))(_0xcd94('0x18'));var utils=require(_0xcd94('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd94('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b348b,_0x548e95){_0x548e95=_0x548e95||0xcc;return function(_0x306842){if(_0x306842){return _0x4b348b[_0xcd94('0x1b')](_0x548e95);}return _0x4b348b['status'](_0x548e95)[_0xcd94('0x1c')]();};}function respondWithResult(_0x5c9e03,_0x1f2171){_0x1f2171=_0x1f2171||0xc8;return function(_0x45e09e){if(_0x45e09e){return _0x5c9e03[_0xcd94('0x1d')](_0x1f2171)[_0xcd94('0x1e')](_0x45e09e);}};}function respondWithFilteredResult(_0x1fe315,_0x28e127){return function(_0x515db4){if(_0x515db4){var _0x3de5a5=typeof _0x28e127[_0xcd94('0x1f')]==='undefined'&&typeof _0x28e127['limit']==='undefined';var _0x1fec43=_0x515db4[_0xcd94('0x20')];var _0x2e7b4c=_0x3de5a5?0x0:_0x28e127[_0xcd94('0x1f')];var _0x2100de=_0x3de5a5?_0x515db4[_0xcd94('0x20')]:_0x28e127[_0xcd94('0x1f')]+_0x28e127[_0xcd94('0x21')];var _0x18b418;if(_0x2100de>=_0x1fec43){_0x2100de=_0x1fec43;_0x18b418=0xc8;}else{_0x18b418=0xce;}_0x1fe315[_0xcd94('0x1d')](_0x18b418);return _0x1fe315[_0xcd94('0x22')](_0xcd94('0x23'),_0x2e7b4c+'-'+_0x2100de+'/'+_0x1fec43)[_0xcd94('0x1e')](_0x515db4);}return null;};}function patchUpdates(_0x5a95bf){return function(_0x3ac5a8){try{jsonpatch['apply'](_0x3ac5a8,_0x5a95bf,!![]);}catch(_0x3c0f8e){return BPromise[_0xcd94('0x24')](_0x3c0f8e);}return _0x3ac5a8[_0xcd94('0x25')]();};}function saveUpdates(_0x16c6b3,_0x3a7a2f){return function(_0x482ff3){if(_0x482ff3){return _0x482ff3[_0xcd94('0x26')](_0x16c6b3)[_0xcd94('0x27')](function(_0x5720d4){return _0x5720d4;});}return null;};}function removeEntity(_0x196bf0,_0x275ece){return function(_0x30c3f6){if(_0x30c3f6){return _0x30c3f6[_0xcd94('0x28')]()[_0xcd94('0x27')](function(){_0x196bf0[_0xcd94('0x1d')](0xcc)[_0xcd94('0x1c')]();});}};}function handleEntityNotFound(_0x4fdd88,_0x4ef4cc){return function(_0xb77b91){if(!_0xb77b91){_0x4fdd88[_0xcd94('0x1b')](0x194);}return _0xb77b91;};}function handleError(_0x2a4b5a,_0xfd372d){_0xfd372d=_0xfd372d||0x1f4;return function(_0x1106bd){logger['error'](_0x1106bd['stack']);if(_0x1106bd[_0xcd94('0x29')]){delete _0x1106bd[_0xcd94('0x29')];}_0x2a4b5a[_0xcd94('0x1d')](_0xfd372d)[_0xcd94('0x2a')](_0x1106bd);};}exports[_0xcd94('0x2b')]=function(_0x47e5f2,_0x3efe88){var _0x160cca={},_0x1e6c98={},_0xd3a8ae={'count':0x0,'rows':[]};var _0x2286b2=_[_0xcd94('0x2c')](db[_0xcd94('0x2d')][_0xcd94('0x2e')],function(_0x2a85a0){return{'name':_0x2a85a0[_0xcd94('0x2f')],'type':_0x2a85a0['type'][_0xcd94('0x30')]};});_0x1e6c98[_0xcd94('0x31')]=_['map'](_0x2286b2,'name');_0x1e6c98[_0xcd94('0x32')]=_[_0xcd94('0x33')](_0x47e5f2[_0xcd94('0x32')]);_0x1e6c98['filters']=_['intersection'](_0x1e6c98[_0xcd94('0x31')],_0x1e6c98[_0xcd94('0x32')]);_0x160cca[_0xcd94('0x34')]=_[_0xcd94('0x35')](_0x1e6c98[_0xcd94('0x31')],qs[_0xcd94('0x36')](_0x47e5f2[_0xcd94('0x32')]['fields']));_0x160cca['attributes']=_0x160cca['attributes'][_0xcd94('0x37')]?_0x160cca[_0xcd94('0x34')]:_0x1e6c98[_0xcd94('0x31')];if(!_0x47e5f2[_0xcd94('0x32')]['hasOwnProperty'](_0xcd94('0x38'))){_0x160cca['limit']=qs['limit'](_0x47e5f2[_0xcd94('0x32')][_0xcd94('0x21')]);_0x160cca['offset']=qs[_0xcd94('0x1f')](_0x47e5f2[_0xcd94('0x32')][_0xcd94('0x1f')]);}_0x160cca[_0xcd94('0x39')]=qs[_0xcd94('0x3a')](_0x47e5f2[_0xcd94('0x32')]['sort']);_0x160cca['where']=qs[_0xcd94('0x3b')](_['pick'](_0x47e5f2[_0xcd94('0x32')],_0x1e6c98[_0xcd94('0x3b')]),_0x2286b2);if(_0x47e5f2[_0xcd94('0x32')]['filter']){_0x160cca[_0xcd94('0x3c')]=_[_0xcd94('0x3d')](_0x160cca[_0xcd94('0x3c')],{'$or':_[_0xcd94('0x2c')](_0x2286b2,function(_0x1f2139){if(_0x1f2139[_0xcd94('0x3e')]!==_0xcd94('0x3f')){var _0x36bb63={};_0x36bb63[_0x1f2139['name']]={'$like':'%'+_0x47e5f2[_0xcd94('0x32')]['filter']+'%'};return _0x36bb63;}})});}_0x160cca=_[_0xcd94('0x3d')]({},_0x160cca,_0x47e5f2[_0xcd94('0x40')]);var _0x1941d6={'where':_0x160cca[_0xcd94('0x3c')]};return db[_0xcd94('0x2d')][_0xcd94('0x20')](_0x1941d6)[_0xcd94('0x27')](function(_0x38d447){_0xd3a8ae[_0xcd94('0x20')]=_0x38d447;if(_0x47e5f2['query'][_0xcd94('0x41')]){_0x160cca['include']=[{'all':!![]}];}return db[_0xcd94('0x2d')][_0xcd94('0x42')](_0x160cca);})['then'](function(_0x2ef51a){_0xd3a8ae['rows']=_0x2ef51a;return _0xd3a8ae;})['then'](respondWithFilteredResult(_0x3efe88,_0x160cca))[_0xcd94('0x43')](handleError(_0x3efe88,null));};exports[_0xcd94('0x44')]=function(_0x457a0d,_0x2ddb03){var _0x41b0c4={'raw':![],'where':{'id':_0x457a0d[_0xcd94('0x45')]['id']}},_0x3ce11f={};_0x3ce11f[_0xcd94('0x31')]=_[_0xcd94('0x33')](db[_0xcd94('0x2d')][_0xcd94('0x2e')]);_0x3ce11f[_0xcd94('0x32')]=_[_0xcd94('0x33')](_0x457a0d[_0xcd94('0x32')]);_0x3ce11f['filters']=_[_0xcd94('0x35')](_0x3ce11f[_0xcd94('0x31')],_0x3ce11f[_0xcd94('0x32')]);_0x41b0c4['attributes']=_[_0xcd94('0x35')](_0x3ce11f[_0xcd94('0x31')],qs['fields'](_0x457a0d[_0xcd94('0x32')][_0xcd94('0x36')]));_0x41b0c4[_0xcd94('0x34')]=_0x41b0c4[_0xcd94('0x34')]['length']?_0x41b0c4[_0xcd94('0x34')]:_0x3ce11f[_0xcd94('0x31')];if(_0x457a0d['query'][_0xcd94('0x41')]){_0x41b0c4[_0xcd94('0x46')]=[{'all':!![]}];}_0x41b0c4=_[_0xcd94('0x3d')]({},_0x41b0c4,_0x457a0d[_0xcd94('0x40')]);return db[_0xcd94('0x2d')]['find'](_0x41b0c4)['then'](handleEntityNotFound(_0x2ddb03,null))[_0xcd94('0x27')](respondWithResult(_0x2ddb03,null))[_0xcd94('0x43')](handleError(_0x2ddb03,null));};exports[_0xcd94('0x47')]=function(_0x3cba1e,_0xec506f){return db['ServicenowAccount'][_0xcd94('0x47')](_0x3cba1e[_0xcd94('0x48')],{})['then'](respondWithResult(_0xec506f,0xc9))[_0xcd94('0x43')](handleError(_0xec506f,null));};exports['update']=function(_0x4b57db,_0x4127b8){if(_0x4b57db[_0xcd94('0x48')]['id']){delete _0x4b57db[_0xcd94('0x48')]['id'];}return db[_0xcd94('0x2d')][_0xcd94('0x49')]({'where':{'id':_0x4b57db['params']['id']}})[_0xcd94('0x27')](handleEntityNotFound(_0x4127b8,null))[_0xcd94('0x27')](saveUpdates(_0x4b57db['body'],null))[_0xcd94('0x27')](respondWithResult(_0x4127b8,null))['catch'](handleError(_0x4127b8,null));};exports[_0xcd94('0x28')]=function(_0x4991bb,_0x43ff6d){return db['ServicenowAccount'][_0xcd94('0x49')]({'where':{'id':_0x4991bb['params']['id']}})['then'](handleEntityNotFound(_0x43ff6d,null))[_0xcd94('0x27')](removeEntity(_0x43ff6d,null))[_0xcd94('0x43')](handleError(_0x43ff6d,null));};exports['getConfigurations']=function(_0x239345,_0x135cb6,_0x4232ed){var _0x3c952e={};var _0x1dac78={};var _0x38047b;var _0x2af11e;return db[_0xcd94('0x2d')][_0xcd94('0x4a')]({'where':{'id':_0x239345[_0xcd94('0x45')]['id']}})['then'](handleEntityNotFound(_0x135cb6,null))[_0xcd94('0x27')](function(_0xa5c294){if(_0xa5c294){_0x38047b=_0xa5c294;_0x1dac78[_0xcd94('0x31')]=_[_0xcd94('0x33')](db[_0xcd94('0x4b')][_0xcd94('0x2e')]);_0x1dac78[_0xcd94('0x32')]=_[_0xcd94('0x33')](_0x239345[_0xcd94('0x32')]);_0x1dac78[_0xcd94('0x3b')]=_[_0xcd94('0x35')](_0x1dac78[_0xcd94('0x31')],_0x1dac78[_0xcd94('0x32')]);_0x3c952e[_0xcd94('0x34')]=_[_0xcd94('0x35')](_0x1dac78['model'],qs[_0xcd94('0x36')](_0x239345['query']['fields']));_0x3c952e['attributes']=_0x3c952e['attributes'][_0xcd94('0x37')]?_0x3c952e['attributes']:_0x1dac78['model'];_0x3c952e[_0xcd94('0x39')]=qs[_0xcd94('0x3a')](_0x239345[_0xcd94('0x32')][_0xcd94('0x3a')]);_0x3c952e[_0xcd94('0x3c')]=qs[_0xcd94('0x3b')](_[_0xcd94('0x4c')](_0x239345[_0xcd94('0x32')],_0x1dac78[_0xcd94('0x3b')]));if(_0x239345[_0xcd94('0x32')][_0xcd94('0x4d')]){_0x3c952e['where']=_[_0xcd94('0x3d')](_0x3c952e['where'],{'$or':_[_0xcd94('0x2c')](_0x3c952e[_0xcd94('0x34')],function(_0x313878){var _0x1ce26c={};_0x1ce26c[_0x313878]={'$like':'%'+_0x239345[_0xcd94('0x32')][_0xcd94('0x4d')]+'%'};return _0x1ce26c;})});}_0x3c952e=_[_0xcd94('0x3d')]({},_0x3c952e,_0x239345[_0xcd94('0x40')]);return _0x38047b[_0xcd94('0x4e')](_0x3c952e);}})[_0xcd94('0x27')](function(_0x4c9b0e){if(_0x4c9b0e){_0x2af11e=_0x4c9b0e[_0xcd94('0x37')];if(!_0x239345[_0xcd94('0x32')][_0xcd94('0x4f')](_0xcd94('0x38'))){_0x3c952e['limit']=qs[_0xcd94('0x21')](_0x239345[_0xcd94('0x32')]['limit']);_0x3c952e['offset']=qs['offset'](_0x239345[_0xcd94('0x32')][_0xcd94('0x1f')]);}return _0x38047b[_0xcd94('0x4e')](_0x3c952e);}})['then'](function(_0x1e2ded){if(_0x1e2ded){return _0x1e2ded?{'count':_0x2af11e,'rows':_0x1e2ded}:null;}})[_0xcd94('0x27')](respondWithResult(_0x135cb6,null))['catch'](handleError(_0x135cb6,null));};exports[_0xcd94('0x50')]=function(_0x57b4f3,_0x8e88ad,_0x1dd8b7){if(_0x57b4f3[_0xcd94('0x48')]['id']){delete _0x57b4f3[_0xcd94('0x48')]['id'];}return db[_0xcd94('0x2d')][_0xcd94('0x4a')]({'where':{'id':_0x57b4f3['params']['id']}})[_0xcd94('0x27')](handleEntityNotFound(_0x8e88ad,null))[_0xcd94('0x27')](function(_0x29c435){if(_0x29c435){_0x57b4f3[_0xcd94('0x48')][_0xcd94('0x51')]=_0x29c435['id'];_0x57b4f3[_0xcd94('0x48')][_0xcd94('0x52')]=integrations['getSubjects'](_0x57b4f3[_0xcd94('0x48')][_0xcd94('0x53')],_0x57b4f3['body'][_0xcd94('0x3e')]);_0x57b4f3[_0xcd94('0x48')][_0xcd94('0x54')]=integrations[_0xcd94('0x55')](_0x57b4f3[_0xcd94('0x48')][_0xcd94('0x53')],_0x57b4f3['body'][_0xcd94('0x3e')]);return db[_0xcd94('0x4b')][_0xcd94('0x47')](_0x57b4f3[_0xcd94('0x48')],{'include':[{'model':db[_0xcd94('0x56')],'as':'Subjects'},{'model':db[_0xcd94('0x56')],'as':_0xcd94('0x54')}]});}return null;})[_0xcd94('0x27')](respondWithResult(_0x8e88ad,null))[_0xcd94('0x43')](handleError(_0x8e88ad,null));};exports[_0xcd94('0x57')]=function(_0xb9b1d7,_0x576f0a,_0xf73b4c){var _0x44c54b=[_0xcd94('0x58'),_0xcd94('0x59'),'knowledge','subcategory',_0xcd94('0x5a'),'notify',_0xcd94('0x5b'),'severity',_0xcd94('0x5c')];var _0x5bdc13=[_0xcd94('0x5d'),_0xcd94('0x58'),_0xcd94('0x5e'),_0xcd94('0x5f'),'upon_reject',_0xcd94('0x60'),'child_incidents',_0xcd94('0x59'),'approval_history','number',_0xcd94('0x61'),_0xcd94('0x62'),_0xcd94('0x63'),'user_input',_0xcd94('0x64'),_0xcd94('0x65'),'state',_0xcd94('0x66'),_0xcd94('0x67'),_0xcd94('0x39'),'calendar_stc',_0xcd94('0x68'),_0xcd94('0x69'),_0xcd94('0x6a'),'impact',_0xcd94('0x6b'),'work_notes_list',_0xcd94('0x6c'),_0xcd94('0x6d'),_0xcd94('0x6e'),'rfc','time_worked',_0xcd94('0x6f'),_0xcd94('0x70'),_0xcd94('0x71'),_0xcd94('0x72'),_0xcd94('0x73'),_0xcd94('0x74'),'resolved_at','caller_id',_0xcd94('0x75'),_0xcd94('0x76'),_0xcd94('0x77'),_0xcd94('0x78'),'close_code',_0xcd94('0x79'),_0xcd94('0x7a'),_0xcd94('0x7b'),_0xcd94('0x7c'),_0xcd94('0x7d'),_0xcd94('0x7e'),_0xcd94('0x7f'),_0xcd94('0x80'),'notify',_0xcd94('0x81'),'close_notes','closed_by',_0xcd94('0x82'),_0xcd94('0x83'),_0xcd94('0x84'),_0xcd94('0x85'),'reopened_by',_0xcd94('0x5b'),_0xcd94('0x86'),_0xcd94('0x87'),'company',_0xcd94('0x88'),'activity_due',_0xcd94('0x89'),'severity',_0xcd94('0x8a'),_0xcd94('0x8b'),_0xcd94('0x8c'),'comments_and_work_notes','due_date',_0xcd94('0x8d'),_0xcd94('0x8e'),_0xcd94('0x8f'),_0xcd94('0x90'),_0xcd94('0x91'),'correlation_id',_0xcd94('0x92'),_0xcd94('0x5c')];var _0x1de176='';var _0x1329a5='';var _0x6a582c=[];var _0x4532b4='';var _0x6d7cb4='';var _0x5ecf9a=[];var _0xf35e2b='';var _0x186dab='';var _0x31c1dc={};var _0x5435ab='';return db[_0xcd94('0x2d')][_0xcd94('0x4a')]({'where':{'id':_0xb9b1d7[_0xcd94('0x45')]['id']},'attributes':['id',_0xcd94('0x93'),'password',_0xcd94('0x94'),_0xcd94('0x95'),'serverUrl']})[_0xcd94('0x27')](handleEntityNotFound(_0x576f0a,null))[_0xcd94('0x27')](function(_0x551459){if(_0x551459){_0x5435ab=_0x551459[_0xcd94('0x95')];var _0x347fa0=_0x5435ab[_0xcd94('0x96')](-0x1);if(_0x347fa0==='/'){_0x5435ab=_0x5435ab[_0xcd94('0x97')](0x0,_0x5435ab[_0xcd94('0x98')](_0x347fa0));}_0x186dab=util[_0xcd94('0x99')]('%s/api/now/doc/table/schema/',_0x5435ab);_0xf35e2b=util['format'](_0xcd94('0x9a'),_0x5435ab);_0x31c1dc={'user':_0x551459[_0xcd94('0x93')],'pass':_0x551459[_0xcd94('0x9b')]};var _0x55d25d={'method':'GET','uri':_0x186dab+_0xcd94('0x9c'),'auth':_0x31c1dc,'json':!![]};return rp(_0x55d25d);}})[_0xcd94('0x27')](function(_0x4b1f14){if(_0x4b1f14['result'][_0xcd94('0x37')]>0x0){_0x1de176=_0x4b1f14[_0xcd94('0x9d')];}console[_0xcd94('0x9e')](_0xcd94('0x9f'),_0x1de176);_0x5ecf9a=[];_0x1329a5=Object[_0xcd94('0xa0')]([],_0x1de176);_[_0xcd94('0xa1')](_0x1329a5,function(_0x4c27a2){return!_0x44c54b['includes'](_0x4c27a2['name']);});_0x1329a5[_0xcd94('0xa2')](function(_0x42c68f){var _0x3a4001=createFieldObject(_0xf35e2b,_0x31c1dc,_0x42c68f[_0xcd94('0xa3')],_0x42c68f[_0xcd94('0x29')],_0x42c68f[_0xcd94('0xa4')],![]);_0x5ecf9a[_0xcd94('0xa5')](_0x3a4001);});return Promise[_0xcd94('0xa6')](_0x5ecf9a);})[_0xcd94('0x27')](function(_0x33dea7){_0x6a582c=_0x33dea7;_0x4532b4=Object[_0xcd94('0xa0')]([],_0x1de176);console[_0xcd94('0x9e')]('TCL:\x20_object',_0x1de176);_[_0xcd94('0xa1')](_0x4532b4,function(_0x1f728d){return _0x5bdc13['includes'](_0x1f728d[_0xcd94('0x29')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4532b4);_0x5ecf9a=[];_0x4532b4[_0xcd94('0xa2')](function(_0x42639a){var _0x1673c4=createFieldObject(_0xf35e2b,_0x31c1dc,_0x42639a[_0xcd94('0xa3')],_0x42639a[_0xcd94('0x29')],_0x42639a[_0xcd94('0xa4')],!![]);_0x5ecf9a['push'](_0x1673c4);});return Promise['all'](_0x5ecf9a);})['then'](function(_0x54213e){_0x6d7cb4=_0x54213e;var _0x25d2a0=_0x6a582c[_0xcd94('0xa7')](_0x6d7cb4);return{'count':_0x25d2a0[_0xcd94('0x37')],'rows':_0x25d2a0};})[_0xcd94('0x27')](respondWithResult(_0x576f0a,null))[_0xcd94('0x43')](function(_0x4c0fda){console['log']('ServiceNow\x20error:\x20'+_0x4c0fda);var _0x436c82=_0xb9b1d7[_0xcd94('0x32')][_0xcd94('0xa8')]?0x1f4:_0x4c0fda['statusCode']||0x1f4;logger['error'](_0x4c0fda[_0xcd94('0xa9')]);delete _0x4c0fda[_0xcd94('0x29')];if(_0x436c82===0x191){_0x436c82=0x190;}_0x576f0a[_0xcd94('0x1d')](_0x436c82)[_0xcd94('0x2a')](_0xb9b1d7[_0xcd94('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4c0fda[_0xcd94('0xaa')]}:_0x4c0fda);});};function createFieldObject(_0x14460e,_0x23c7a4,_0x47a56b,_0x4f4519,_0xc705d2,_0x558ee5){return new Promise(function(_0x316385,_0x4f5866){var _0x3ec84f={'id':_0x4f4519,'name':_0xc705d2,'custom':_0x558ee5};if(_0x47a56b==='boolean'){_0x3ec84f[_0xcd94('0x40')]=[{'name':_0xcd94('0xab'),'value':'true'},{'name':_0xcd94('0xac'),'value':_0xcd94('0xad')}];_0x316385(_0x3ec84f);}else{var _0x2c2202={'method':_0xcd94('0xae'),'uri':_0x14460e+_0xcd94('0xaf')+_0x4f4519,'auth':_0x23c7a4,'json':!![]};return rp(_0x2c2202)['then'](function(_0x42a4c4){var _0x5ba23b=[];if(_0x42a4c4[_0xcd94('0x9d')][_0xcd94('0x37')]>0x0){_0x42a4c4[_0xcd94('0x9d')][_0xcd94('0xa2')](function(_0x1b0a7b){if(_0x1b0a7b[_0xcd94('0xb0')]==='false'){var _0xa70a82={'name':_0x1b0a7b['label'],'value':_0x1b0a7b[_0xcd94('0xb1')]};_0x5ba23b['push'](_0xa70a82);}});}_0x3ec84f[_0xcd94('0x40')]=_0x5ba23b;if(_0x3ec84f[_0xcd94('0x40')][_0xcd94('0x37')]>0x0){_0x316385(_0x3ec84f);}else{if(_0x558ee5==![]){_0x316385();}else{_0x316385(_0x3ec84f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d9c8e28..de427e3 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x328db0,_0x19d1fa){var _0x4f6d29=function(_0x549b66){while(--_0x549b66){_0x328db0['push'](_0x328db0['shift']());}};_0x4f6d29(++_0x19d1fa);}(_0xeda8,0x104));var _0x8eda=function(_0x950cbc,_0x5a91e2){_0x950cbc=_0x950cbc-0x0;var _0x1168bb=_0xeda8[_0x950cbc];return _0x1168bb;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'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(_0x4ea98d,_0x5c3a56){var _0x151023=function(_0x328f24){while(--_0x328f24){_0x4ea98d['push'](_0x4ea98d['shift']());}};_0x151023(++_0x5c3a56);}(_0xeff8,0x186));var _0x8eff=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xeff8[_0x2f5ac5];return _0x37c9a8;};'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 2c4c2c1..5d739ae 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 _0xd7ea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','findAll','options','where','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','find','raw','attributes','lodash','bluebird','randomstring'];(function(_0x4343e4,_0x4a4316){var _0x5ab5ad=function(_0x5a4e17){while(--_0x5a4e17){_0x4343e4['push'](_0x4343e4['shift']());}};_0x5ab5ad(++_0x4a4316);}(_0xd7ea,0x173));var _0xad7e=function(_0x3fb7d8,_0x38df95){_0x3fb7d8=_0x3fb7d8-0x0;var _0x3f09b5=_0xd7ea[_0x3fb7d8];return _0x3f09b5;};'use strict';var _=require(_0xad7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad7e('0x1'));var rs=require(_0xad7e('0x2'));var fs=require('fs');var Redis=require(_0xad7e('0x3'));var db=require(_0xad7e('0x4'))['db'];var utils=require(_0xad7e('0x5'));var logger=require(_0xad7e('0x6'))(_0xad7e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad7e('0x8')][_0xad7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f1ec,_0x542829,_0x2ef83e){return new BPromise(function(_0x2acb75,_0x56dd44){return client[_0xad7e('0xa')](_0x49f1ec,_0x2ef83e)[_0xad7e('0xb')](function(_0x4fe452){logger[_0xad7e('0xc')](_0xad7e('0xd'),_0x542829,'request\x20sent');logger[_0xad7e('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x542829,_0xad7e('0xf'),JSON[_0xad7e('0x10')](_0x4fe452));if(_0x4fe452['error']){if(_0x4fe452[_0xad7e('0x11')]['code']===0x1f4){logger[_0xad7e('0x11')](_0xad7e('0xd'),_0x542829,_0x4fe452[_0xad7e('0x11')][_0xad7e('0x12')]);return _0x56dd44(_0x4fe452[_0xad7e('0x11')]['message']);}logger[_0xad7e('0x11')](_0xad7e('0xd'),_0x542829,_0x4fe452['error'][_0xad7e('0x12')]);return _0x2acb75(_0x4fe452[_0xad7e('0x11')][_0xad7e('0x12')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x542829,_0xad7e('0xf'));_0x2acb75(_0x4fe452[_0xad7e('0x13')][_0xad7e('0x12')]);}})[_0xad7e('0x14')](function(_0x2ef2a3){logger['error'](_0xad7e('0xd'),_0x542829,_0x2ef2a3);_0x56dd44(_0x2ef2a3);});});}exports[_0xad7e('0x15')]=function(_0x202c6a){var _0x1959b5=this;return new Promise(function(_0x20ad9f,_0x4ccd03){return db['ServicenowAccount'][_0xad7e('0x16')]({'raw':_0x202c6a[_0xad7e('0x17')]?_0x202c6a[_0xad7e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x202c6a[_0xad7e('0x17')]?_0x202c6a['options'][_0xad7e('0x18')]||null:null,'attributes':_0x202c6a['options']?_0x202c6a[_0xad7e('0x17')]['attributes']||null:null,'limit':_0x202c6a[_0xad7e('0x17')]?_0x202c6a[_0xad7e('0x17')][_0xad7e('0x19')]||null:null,'include':_0x202c6a['options']?_0x202c6a[_0xad7e('0x17')][_0xad7e('0x1a')]?_[_0xad7e('0x1b')](_0x202c6a[_0xad7e('0x17')]['include'],function(_0x5c027c){return{'model':db[_0x5c027c['model']],'as':_0x5c027c['as'],'attributes':_0x5c027c['attributes'],'include':_0x5c027c[_0xad7e('0x1a')]?_[_0xad7e('0x1b')](_0x5c027c[_0xad7e('0x1a')],function(_0x4a8575){return{'model':db[_0x4a8575[_0xad7e('0x1c')]],'as':_0x4a8575['as'],'attributes':_0x4a8575['attributes'],'include':_0x4a8575[_0xad7e('0x1a')]?_['map'](_0x4a8575['include'],function(_0x2b7147){return{'model':db[_0x2b7147['model']],'as':_0x2b7147['as'],'attributes':_0x2b7147['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52267b){logger[_0xad7e('0xc')](_0xad7e('0x15'),_0x202c6a);logger[_0xad7e('0xe')]('GetServicenowAccount',_0x202c6a,JSON[_0xad7e('0x10')](_0x52267b));_0x20ad9f(_0x52267b);})[_0xad7e('0x14')](function(_0x10e7cc){logger[_0xad7e('0x11')](_0xad7e('0x15'),_0x10e7cc['message'],_0x202c6a);_0x4ccd03(_0x1959b5['error'](0x1f4,_0x10e7cc['message']));});});};exports[_0xad7e('0x1d')]=function(_0x5abc67){var _0x5aa9bc=this;return new Promise(function(_0x3b80d7,_0x154504){return db[_0xad7e('0x1e')][_0xad7e('0x1f')]({'raw':_0x5abc67['options']?_0x5abc67[_0xad7e('0x17')][_0xad7e('0x20')]===undefined?!![]:![]:!![],'where':_0x5abc67[_0xad7e('0x17')]?_0x5abc67[_0xad7e('0x17')][_0xad7e('0x18')]||null:null,'attributes':_0x5abc67[_0xad7e('0x17')]?_0x5abc67[_0xad7e('0x17')]['attributes']||null:null,'include':_0x5abc67['options']?_0x5abc67[_0xad7e('0x17')][_0xad7e('0x1a')]?_[_0xad7e('0x1b')](_0x5abc67[_0xad7e('0x17')][_0xad7e('0x1a')],function(_0x324677){return{'model':db[_0x324677[_0xad7e('0x1c')]],'as':_0x324677['as'],'attributes':_0x324677[_0xad7e('0x21')],'include':_0x324677[_0xad7e('0x1a')]?_[_0xad7e('0x1b')](_0x324677[_0xad7e('0x1a')],function(_0x2f3751){return{'model':db[_0x2f3751[_0xad7e('0x1c')]],'as':_0x2f3751['as'],'attributes':_0x2f3751['attributes'],'include':_0x2f3751['include']?_[_0xad7e('0x1b')](_0x2f3751[_0xad7e('0x1a')],function(_0x7e5f4){return{'model':db[_0x7e5f4[_0xad7e('0x1c')]],'as':_0x7e5f4['as'],'attributes':_0x7e5f4[_0xad7e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xad7e('0xb')](function(_0x10ebb9){logger['info'](_0xad7e('0x1d'),_0x5abc67);logger[_0xad7e('0xe')]('ShowServicenowAccount',_0x5abc67,JSON[_0xad7e('0x10')](_0x10ebb9));_0x3b80d7(_0x10ebb9);})['catch'](function(_0x138795){logger['error'](_0xad7e('0x1d'),_0x138795[_0xad7e('0x12')],_0x5abc67);_0x154504(_0x5aa9bc[_0xad7e('0x11')](0x1f4,_0x138795[_0xad7e('0x12')]));});});}; \ No newline at end of file +var _0xecda=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x56c418,_0x6ca1b){var _0x11837c=function(_0x4ac3ec){while(--_0x4ac3ec){_0x56c418['push'](_0x56c418['shift']());}};_0x11837c(++_0x6ca1b);}(_0xecda,0x199));var _0xaecd=function(_0x9c4e0f,_0x302efc){_0x9c4e0f=_0x9c4e0f-0x0;var _0x206809=_0xecda[_0x9c4e0f];return _0x206809;};'use strict';var _=require(_0xaecd('0x0'));var util=require(_0xaecd('0x1'));var moment=require(_0xaecd('0x2'));var BPromise=require(_0xaecd('0x3'));var rs=require(_0xaecd('0x4'));var fs=require('fs');var Redis=require(_0xaecd('0x5'));var db=require(_0xaecd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaecd('0x7'))(_0xaecd('0x8'));var config=require(_0xaecd('0x9'));var jayson=require(_0xaecd('0xa'));var client=jayson[_0xaecd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca18d,_0x599eeb,_0x221962){return new BPromise(function(_0x1b3530,_0x27688c){return client[_0xaecd('0xc')](_0x1ca18d,_0x221962)[_0xaecd('0xd')](function(_0x5332c5){logger[_0xaecd('0xe')](_0xaecd('0xf'),_0x599eeb,_0xaecd('0x10'));logger[_0xaecd('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x599eeb,_0xaecd('0x10'),JSON[_0xaecd('0x12')](_0x5332c5));if(_0x5332c5[_0xaecd('0x13')]){if(_0x5332c5[_0xaecd('0x13')]['code']===0x1f4){logger[_0xaecd('0x13')](_0xaecd('0xf'),_0x599eeb,_0x5332c5['error'][_0xaecd('0x14')]);return _0x27688c(_0x5332c5[_0xaecd('0x13')][_0xaecd('0x14')]);}logger[_0xaecd('0x13')](_0xaecd('0xf'),_0x599eeb,_0x5332c5[_0xaecd('0x13')][_0xaecd('0x14')]);return _0x1b3530(_0x5332c5[_0xaecd('0x13')]['message']);}else{logger[_0xaecd('0xe')](_0xaecd('0xf'),_0x599eeb,'request\x20sent');_0x1b3530(_0x5332c5[_0xaecd('0x15')]['message']);}})[_0xaecd('0x16')](function(_0xca9b41){logger['error'](_0xaecd('0xf'),_0x599eeb,_0xca9b41);_0x27688c(_0xca9b41);});});}exports[_0xaecd('0x17')]=function(_0x1019ac){var _0x4bdec3=this;return new Promise(function(_0x36907f,_0x31b05b){return db[_0xaecd('0x18')][_0xaecd('0x19')]({'raw':_0x1019ac[_0xaecd('0x1a')]?_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1b')]===undefined?!![]:![]:!![],'where':_0x1019ac[_0xaecd('0x1a')]?_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1c')]||null:null,'attributes':_0x1019ac[_0xaecd('0x1a')]?_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1d')]||null:null,'limit':_0x1019ac[_0xaecd('0x1a')]?_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1e')]||null:null,'include':_0x1019ac[_0xaecd('0x1a')]?_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1f')]?_[_0xaecd('0x20')](_0x1019ac[_0xaecd('0x1a')][_0xaecd('0x1f')],function(_0x4ecdb8){return{'model':db[_0x4ecdb8[_0xaecd('0x21')]],'as':_0x4ecdb8['as'],'attributes':_0x4ecdb8[_0xaecd('0x1d')],'include':_0x4ecdb8[_0xaecd('0x1f')]?_[_0xaecd('0x20')](_0x4ecdb8['include'],function(_0x359d59){return{'model':db[_0x359d59[_0xaecd('0x21')]],'as':_0x359d59['as'],'attributes':_0x359d59[_0xaecd('0x1d')],'include':_0x359d59['include']?_['map'](_0x359d59[_0xaecd('0x1f')],function(_0x3b7f35){return{'model':db[_0x3b7f35[_0xaecd('0x21')]],'as':_0x3b7f35['as'],'attributes':_0x3b7f35[_0xaecd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaecd('0xd')](function(_0x40be26){logger['info'](_0xaecd('0x17'),_0x1019ac);logger[_0xaecd('0x11')](_0xaecd('0x17'),_0x1019ac,JSON[_0xaecd('0x12')](_0x40be26));_0x36907f(_0x40be26);})[_0xaecd('0x16')](function(_0x52269c){logger[_0xaecd('0x13')]('GetServicenowAccount',_0x52269c[_0xaecd('0x14')],_0x1019ac);_0x31b05b(_0x4bdec3[_0xaecd('0x13')](0x1f4,_0x52269c[_0xaecd('0x14')]));});});};exports[_0xaecd('0x22')]=function(_0x4d79ae){var _0x1adcbc=this;return new Promise(function(_0x5c6a2b,_0x318f8a){return db[_0xaecd('0x18')][_0xaecd('0x23')]({'raw':_0x4d79ae[_0xaecd('0x1a')]?_0x4d79ae[_0xaecd('0x1a')][_0xaecd('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d79ae['options']?_0x4d79ae[_0xaecd('0x1a')][_0xaecd('0x1c')]||null:null,'attributes':_0x4d79ae[_0xaecd('0x1a')]?_0x4d79ae[_0xaecd('0x1a')][_0xaecd('0x1d')]||null:null,'include':_0x4d79ae[_0xaecd('0x1a')]?_0x4d79ae[_0xaecd('0x1a')][_0xaecd('0x1f')]?_[_0xaecd('0x20')](_0x4d79ae[_0xaecd('0x1a')][_0xaecd('0x1f')],function(_0x52d8bd){return{'model':db[_0x52d8bd[_0xaecd('0x21')]],'as':_0x52d8bd['as'],'attributes':_0x52d8bd[_0xaecd('0x1d')],'include':_0x52d8bd[_0xaecd('0x1f')]?_[_0xaecd('0x20')](_0x52d8bd[_0xaecd('0x1f')],function(_0x19eafb){return{'model':db[_0x19eafb[_0xaecd('0x21')]],'as':_0x19eafb['as'],'attributes':_0x19eafb[_0xaecd('0x1d')],'include':_0x19eafb[_0xaecd('0x1f')]?_[_0xaecd('0x20')](_0x19eafb['include'],function(_0x1b65a2){return{'model':db[_0x1b65a2[_0xaecd('0x21')]],'as':_0x1b65a2['as'],'attributes':_0x1b65a2[_0xaecd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaecd('0xd')](function(_0x115ae3){logger[_0xaecd('0xe')](_0xaecd('0x22'),_0x4d79ae);logger['debug'](_0xaecd('0x22'),_0x4d79ae,JSON[_0xaecd('0x12')](_0x115ae3));_0x5c6a2b(_0x115ae3);})[_0xaecd('0x16')](function(_0x4a5c3b){logger['error'](_0xaecd('0x22'),_0x4a5c3b[_0xaecd('0x14')],_0x4d79ae);_0x318f8a(_0x1adcbc[_0xaecd('0x13')](0x1f4,_0x4a5c3b[_0xaecd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b5601e3..b28e587 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 _0x974b=['put','/:id','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1ca9c7,_0x435bbb){var _0x36500a=function(_0x151f7f){while(--_0x151f7f){_0x1ca9c7['push'](_0x1ca9c7['shift']());}};_0x36500a(++_0x435bbb);}(_0x974b,0x1e5));var _0xb974=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x974b[_0xb02766];return _0x560e6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb974('0x0'));var timeout=require(_0xb974('0x1'));var express=require(_0xb974('0x2'));var router=express[_0xb974('0x3')]();var fs_extra=require(_0xb974('0x4'));var auth=require(_0xb974('0x5'));var interaction=require(_0xb974('0x6'));var config=require(_0xb974('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb974('0x8')]);router[_0xb974('0x9')]('/:id',auth[_0xb974('0xa')](),controller[_0xb974('0xb')]);router[_0xb974('0x9')](_0xb974('0xc'),auth[_0xb974('0xa')](),controller['getFields']);router['get'](_0xb974('0xd'),auth['isAuthenticated'](),controller[_0xb974('0xe')]);router[_0xb974('0x9')](_0xb974('0xf'),auth[_0xb974('0xa')](),controller[_0xb974('0x10')]);router[_0xb974('0x11')]('/',auth[_0xb974('0xa')](),controller[_0xb974('0x12')]);router[_0xb974('0x13')](_0xb974('0x14'),auth[_0xb974('0xa')](),controller[_0xb974('0x15')]);router[_0xb974('0x16')](_0xb974('0x14'),auth[_0xb974('0xa')](),controller[_0xb974('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcf4a=['isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get'];(function(_0x4dca1d,_0x26be83){var _0x17646b=function(_0x468208){while(--_0x468208){_0x4dca1d['push'](_0x4dca1d['shift']());}};_0x17646b(++_0x26be83);}(_0xcf4a,0x17d));var _0xacf4=function(_0x1a87f5,_0x256539){_0x1a87f5=_0x1a87f5-0x0;var _0x38d467=_0xcf4a[_0x1a87f5];return _0x38d467;};'use strict';var multer=require(_0xacf4('0x0'));var util=require(_0xacf4('0x1'));var path=require(_0xacf4('0x2'));var timeout=require(_0xacf4('0x3'));var express=require(_0xacf4('0x4'));var router=express[_0xacf4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xacf4('0x6'));var interaction=require(_0xacf4('0x7'));var config=require('../../config/environment');var controller=require(_0xacf4('0x8'));router[_0xacf4('0x9')]('/',auth[_0xacf4('0xa')](),controller[_0xacf4('0xb')]);router[_0xacf4('0x9')]('/:id',auth[_0xacf4('0xa')](),controller[_0xacf4('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xacf4('0xd')]);router[_0xacf4('0x9')](_0xacf4('0xe'),auth[_0xacf4('0xa')](),controller['getSubjects']);router[_0xacf4('0x9')](_0xacf4('0xf'),auth[_0xacf4('0xa')](),controller[_0xacf4('0x10')]);router[_0xacf4('0x11')]('/',auth[_0xacf4('0xa')](),controller[_0xacf4('0x12')]);router[_0xacf4('0x13')]('/:id',auth[_0xacf4('0xa')](),controller[_0xacf4('0x14')]);router[_0xacf4('0x15')]('/:id',auth[_0xacf4('0xa')](),controller[_0xacf4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 192d03e..9bd6ec0 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 _0x8092=['sequelize','exports','STRING'];(function(_0xecd01b,_0x35a6b1){var _0x473b85=function(_0x552f6a){while(--_0x552f6a){_0xecd01b['push'](_0xecd01b['shift']());}};_0x473b85(++_0x35a6b1);}(_0x8092,0x1b3));var _0x2809=function(_0x5e57cd,_0x486ece){_0x5e57cd=_0x5e57cd-0x0;var _0x3a96b2=_0x8092[_0x5e57cd];return _0x3a96b2;};'use strict';var Sequelize=require(_0x2809('0x0'));module[_0x2809('0x1')]={'name':{'type':Sequelize[_0x2809('0x2')]},'description':{'type':Sequelize[_0x2809('0x2')]}}; \ No newline at end of file +var _0x649f=['sequelize','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x649f,0x7c));var _0xf649=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x649f[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0xf649('0x0'));module[_0xf649('0x1')]={'name':{'type':Sequelize['STRING']},'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 42dbecd..8273a7c 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 _0xd254=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','error','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x312b06,_0x5ad05e){var _0x54dd60=function(_0x837599){while(--_0x837599){_0x312b06['push'](_0x312b06['shift']());}};_0x54dd60(++_0x5ad05e);}(_0xd254,0x6d));var _0x4d25=function(_0x49d7b3,_0x2755b2){_0x49d7b3=_0x49d7b3-0x0;var _0x184323=_0xd254[_0x49d7b3];return _0x184323;};'use strict';var emlformat=require(_0x4d25('0x0'));var rimraf=require(_0x4d25('0x1'));var zipdir=require(_0x4d25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d25('0x3'));var moment=require(_0x4d25('0x4'));var BPromise=require(_0x4d25('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d25('0x6'));var sox=require(_0x4d25('0x7'));var csv=require(_0x4d25('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d25('0x9'));var _=require(_0x4d25('0xa'));var squel=require(_0x4d25('0xb'));var crypto=require(_0x4d25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d25('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d25('0xe'));var Redis=require(_0x4d25('0xf'));var authService=require(_0x4d25('0x10'));var qs=require(_0x4d25('0x11'));var as=require(_0x4d25('0x12'));var hardwareService=require(_0x4d25('0x13'));var logger=require(_0x4d25('0x14'))(_0x4d25('0x15'));var utils=require('../../config/utils');var config=require(_0x4d25('0x16'));var licenseUtil=require(_0x4d25('0x17'));var db=require(_0x4d25('0x18'))['db'];function respondWithStatusCode(_0x5e04cc,_0x4bb5ef){_0x4bb5ef=_0x4bb5ef||0xcc;return function(_0x1a1f22){if(_0x1a1f22){return _0x5e04cc[_0x4d25('0x19')](_0x4bb5ef);}return _0x5e04cc['status'](_0x4bb5ef)[_0x4d25('0x1a')]();};}function respondWithResult(_0x1dad2d,_0x55085a){_0x55085a=_0x55085a||0xc8;return function(_0x3ec07c){if(_0x3ec07c){return _0x1dad2d['status'](_0x55085a)[_0x4d25('0x1b')](_0x3ec07c);}};}function respondWithFilteredResult(_0x140707,_0x5db1d2){return function(_0x61f1dd){if(_0x61f1dd){var _0x50c320=typeof _0x5db1d2[_0x4d25('0x1c')]===_0x4d25('0x1d')&&typeof _0x5db1d2[_0x4d25('0x1e')]===_0x4d25('0x1d');var _0x4e2e4e=_0x61f1dd[_0x4d25('0x1f')];var _0x29020a=_0x50c320?0x0:_0x5db1d2[_0x4d25('0x1c')];var _0x32e191=_0x50c320?_0x61f1dd[_0x4d25('0x1f')]:_0x5db1d2['offset']+_0x5db1d2[_0x4d25('0x1e')];var _0x68a46e;if(_0x32e191>=_0x4e2e4e){_0x32e191=_0x4e2e4e;_0x68a46e=0xc8;}else{_0x68a46e=0xce;}_0x140707[_0x4d25('0x20')](_0x68a46e);return _0x140707[_0x4d25('0x21')](_0x4d25('0x22'),_0x29020a+'-'+_0x32e191+'/'+_0x4e2e4e)[_0x4d25('0x1b')](_0x61f1dd);}return null;};}function patchUpdates(_0x128534){return function(_0x172408){try{jsonpatch['apply'](_0x172408,_0x128534,!![]);}catch(_0x3558cb){return BPromise[_0x4d25('0x23')](_0x3558cb);}return _0x172408[_0x4d25('0x24')]();};}function saveUpdates(_0x5497d1,_0x4d3d8e){return function(_0xf1caf4){if(_0xf1caf4){return _0xf1caf4['update'](_0x5497d1)[_0x4d25('0x25')](function(_0x405e2f){return _0x405e2f;});}return null;};}function removeEntity(_0x3607b0,_0x19c549){return function(_0x5e1946){if(_0x5e1946){return _0x5e1946['destroy']()['then'](function(){_0x3607b0['status'](0xcc)[_0x4d25('0x1a')]();});}};}function handleEntityNotFound(_0x1487ce,_0x5ec841){return function(_0x1f8a5c){if(!_0x1f8a5c){_0x1487ce[_0x4d25('0x19')](0x194);}return _0x1f8a5c;};}function handleError(_0x433b53,_0x1e0a86){_0x1e0a86=_0x1e0a86||0x1f4;return function(_0x589ea8){logger[_0x4d25('0x26')](_0x589ea8['stack']);if(_0x589ea8[_0x4d25('0x27')]){delete _0x589ea8[_0x4d25('0x27')];}_0x433b53[_0x4d25('0x20')](_0x1e0a86)[_0x4d25('0x28')](_0x589ea8);};}exports[_0x4d25('0x29')]=function(_0x14d67b,_0x18f847){var _0x44ccaf={},_0x127198={},_0x1ad7d3={'count':0x0,'rows':[]};var _0x17e789=_[_0x4d25('0x2a')](db[_0x4d25('0x2b')][_0x4d25('0x2c')],function(_0x2ee6d1){return{'name':_0x2ee6d1['fieldName'],'type':_0x2ee6d1[_0x4d25('0x2d')][_0x4d25('0x2e')]};});_0x127198[_0x4d25('0x2f')]=_[_0x4d25('0x2a')](_0x17e789,_0x4d25('0x27'));_0x127198[_0x4d25('0x30')]=_[_0x4d25('0x31')](_0x14d67b[_0x4d25('0x30')]);_0x127198[_0x4d25('0x32')]=_[_0x4d25('0x33')](_0x127198[_0x4d25('0x2f')],_0x127198[_0x4d25('0x30')]);_0x44ccaf[_0x4d25('0x34')]=_[_0x4d25('0x33')](_0x127198['model'],qs[_0x4d25('0x35')](_0x14d67b[_0x4d25('0x30')][_0x4d25('0x35')]));_0x44ccaf[_0x4d25('0x34')]=_0x44ccaf['attributes'][_0x4d25('0x36')]?_0x44ccaf['attributes']:_0x127198[_0x4d25('0x2f')];if(!_0x14d67b[_0x4d25('0x30')][_0x4d25('0x37')](_0x4d25('0x38'))){_0x44ccaf['limit']=qs[_0x4d25('0x1e')](_0x14d67b[_0x4d25('0x30')]['limit']);_0x44ccaf[_0x4d25('0x1c')]=qs[_0x4d25('0x1c')](_0x14d67b[_0x4d25('0x30')][_0x4d25('0x1c')]);}_0x44ccaf[_0x4d25('0x39')]=qs[_0x4d25('0x3a')](_0x14d67b[_0x4d25('0x30')]['sort']);_0x44ccaf[_0x4d25('0x3b')]=qs[_0x4d25('0x32')](_[_0x4d25('0x3c')](_0x14d67b['query'],_0x127198['filters']),_0x17e789);if(_0x14d67b['query'][_0x4d25('0x3d')]){_0x44ccaf[_0x4d25('0x3b')]=_['merge'](_0x44ccaf[_0x4d25('0x3b')],{'$or':_['map'](_0x17e789,function(_0x53def0){if(_0x53def0[_0x4d25('0x2d')]!==_0x4d25('0x3e')){var _0x29cd69={};_0x29cd69[_0x53def0[_0x4d25('0x27')]]={'$like':'%'+_0x14d67b['query'][_0x4d25('0x3d')]+'%'};return _0x29cd69;}})});}_0x44ccaf=_[_0x4d25('0x3f')]({},_0x44ccaf,_0x14d67b[_0x4d25('0x40')]);var _0x56d364={'where':_0x44ccaf[_0x4d25('0x3b')]};return db[_0x4d25('0x2b')][_0x4d25('0x1f')](_0x56d364)[_0x4d25('0x25')](function(_0x3c858c){_0x1ad7d3['count']=_0x3c858c;if(_0x14d67b[_0x4d25('0x30')][_0x4d25('0x41')]){_0x44ccaf[_0x4d25('0x42')]=[{'all':!![]}];}return db[_0x4d25('0x2b')][_0x4d25('0x43')](_0x44ccaf);})[_0x4d25('0x25')](function(_0x1a85be){_0x1ad7d3[_0x4d25('0x44')]=_0x1a85be;return _0x1ad7d3;})[_0x4d25('0x25')](respondWithFilteredResult(_0x18f847,_0x44ccaf))[_0x4d25('0x45')](handleError(_0x18f847,null));};exports[_0x4d25('0x46')]=function(_0xd1659a,_0x1ec880){var _0x17281c={'raw':![],'where':{'id':_0xd1659a[_0x4d25('0x47')]['id']}},_0xb9b89e={};_0xb9b89e[_0x4d25('0x2f')]=_[_0x4d25('0x31')](db[_0x4d25('0x2b')][_0x4d25('0x2c')]);_0xb9b89e[_0x4d25('0x30')]=_[_0x4d25('0x31')](_0xd1659a[_0x4d25('0x30')]);_0xb9b89e[_0x4d25('0x32')]=_[_0x4d25('0x33')](_0xb9b89e[_0x4d25('0x2f')],_0xb9b89e[_0x4d25('0x30')]);_0x17281c[_0x4d25('0x34')]=_[_0x4d25('0x33')](_0xb9b89e[_0x4d25('0x2f')],qs[_0x4d25('0x35')](_0xd1659a[_0x4d25('0x30')]['fields']));_0x17281c['attributes']=_0x17281c[_0x4d25('0x34')][_0x4d25('0x36')]?_0x17281c[_0x4d25('0x34')]:_0xb9b89e[_0x4d25('0x2f')];if(_0xd1659a[_0x4d25('0x30')][_0x4d25('0x41')]){_0x17281c[_0x4d25('0x42')]=[{'all':!![]}];}_0x17281c=_[_0x4d25('0x3f')]({},_0x17281c,_0xd1659a[_0x4d25('0x40')]);return db[_0x4d25('0x2b')][_0x4d25('0x48')](_0x17281c)[_0x4d25('0x25')](handleEntityNotFound(_0x1ec880,null))[_0x4d25('0x25')](respondWithResult(_0x1ec880,null))['catch'](handleError(_0x1ec880,null));};exports[_0x4d25('0x49')]=function(_0x4397df,_0x2893e7){return db[_0x4d25('0x2b')][_0x4d25('0x49')](_0x4397df[_0x4d25('0x4a')],{})['then'](respondWithResult(_0x2893e7,0xc9))['catch'](handleError(_0x2893e7,null));};exports[_0x4d25('0x4b')]=function(_0x37981a,_0x10cab3){if(_0x37981a[_0x4d25('0x4a')]['id']){delete _0x37981a[_0x4d25('0x4a')]['id'];}return db[_0x4d25('0x2b')]['find']({'where':{'id':_0x37981a[_0x4d25('0x47')]['id']}})['then'](handleEntityNotFound(_0x10cab3,null))[_0x4d25('0x25')](saveUpdates(_0x37981a[_0x4d25('0x4a')],null))['then'](respondWithResult(_0x10cab3,null))[_0x4d25('0x45')](handleError(_0x10cab3,null));};exports['destroy']=function(_0x1cca13,_0x4e424b){return db['ServicenowConfiguration']['find']({'where':{'id':_0x1cca13[_0x4d25('0x47')]['id']}})[_0x4d25('0x25')](handleEntityNotFound(_0x4e424b,null))[_0x4d25('0x25')](removeEntity(_0x4e424b,null))['catch'](handleError(_0x4e424b,null));};exports[_0x4d25('0x4c')]=function(_0x56137d,_0x505aef,_0x19beca){var _0x397090={};var _0x924fb1={};var _0x16ccd4;var _0x397940;return db[_0x4d25('0x2b')][_0x4d25('0x4d')]({'where':{'id':_0x56137d['params']['id']}})[_0x4d25('0x25')](handleEntityNotFound(_0x505aef,null))[_0x4d25('0x25')](function(_0x3d8a81){if(_0x3d8a81){_0x16ccd4=_0x3d8a81;_0x924fb1[_0x4d25('0x2f')]=_[_0x4d25('0x31')](db['ServicenowField'][_0x4d25('0x2c')]);_0x924fb1[_0x4d25('0x30')]=_[_0x4d25('0x31')](_0x56137d[_0x4d25('0x30')]);_0x924fb1[_0x4d25('0x32')]=_[_0x4d25('0x33')](_0x924fb1['model'],_0x924fb1['query']);_0x397090[_0x4d25('0x34')]=_[_0x4d25('0x33')](_0x924fb1[_0x4d25('0x2f')],qs[_0x4d25('0x35')](_0x56137d[_0x4d25('0x30')][_0x4d25('0x35')]));_0x397090[_0x4d25('0x34')]=_0x397090[_0x4d25('0x34')][_0x4d25('0x36')]?_0x397090[_0x4d25('0x34')]:_0x924fb1[_0x4d25('0x2f')];_0x397090[_0x4d25('0x39')]=qs[_0x4d25('0x3a')](_0x56137d[_0x4d25('0x30')][_0x4d25('0x3a')]);_0x397090['where']=qs[_0x4d25('0x32')](_[_0x4d25('0x3c')](_0x56137d[_0x4d25('0x30')],_0x924fb1['filters']));if(_0x56137d['query'][_0x4d25('0x3d')]){_0x397090[_0x4d25('0x3b')]=_['merge'](_0x397090[_0x4d25('0x3b')],{'$or':_[_0x4d25('0x2a')](_0x397090[_0x4d25('0x34')],function(_0x56f82a){var _0x331d27={};_0x331d27[_0x56f82a]={'$like':'%'+_0x56137d[_0x4d25('0x30')]['filter']+'%'};return _0x331d27;})});}_0x397090=_[_0x4d25('0x3f')]({},_0x397090,_0x56137d['options']);return _0x16ccd4[_0x4d25('0x4c')](_0x397090);}})['then'](function(_0x53be1b){if(_0x53be1b){_0x397940=_0x53be1b[_0x4d25('0x36')];if(!_0x56137d[_0x4d25('0x30')][_0x4d25('0x37')](_0x4d25('0x38'))){_0x397090[_0x4d25('0x1e')]=qs[_0x4d25('0x1e')](_0x56137d[_0x4d25('0x30')][_0x4d25('0x1e')]);_0x397090[_0x4d25('0x1c')]=qs[_0x4d25('0x1c')](_0x56137d['query'][_0x4d25('0x1c')]);}return _0x16ccd4[_0x4d25('0x4c')](_0x397090);}})[_0x4d25('0x25')](function(_0x3a5caa){if(_0x3a5caa){return _0x3a5caa?{'count':_0x397940,'rows':_0x3a5caa}:null;}})['then'](respondWithResult(_0x505aef,null))[_0x4d25('0x45')](handleError(_0x505aef,null));};exports[_0x4d25('0x4e')]=function(_0x18310d,_0x1a3f4c,_0x4fee60){var _0x5313e5={};var _0x69ed76={};var _0xe2647;var _0xea141a;return db[_0x4d25('0x2b')]['findOne']({'where':{'id':_0x18310d[_0x4d25('0x47')]['id']}})[_0x4d25('0x25')](handleEntityNotFound(_0x1a3f4c,null))[_0x4d25('0x25')](function(_0x1aa65b){if(_0x1aa65b){_0xe2647=_0x1aa65b;_0x69ed76[_0x4d25('0x2f')]=_['keys'](db[_0x4d25('0x4f')][_0x4d25('0x2c')]);_0x69ed76['query']=_[_0x4d25('0x31')](_0x18310d['query']);_0x69ed76[_0x4d25('0x32')]=_[_0x4d25('0x33')](_0x69ed76[_0x4d25('0x2f')],_0x69ed76[_0x4d25('0x30')]);_0x5313e5[_0x4d25('0x34')]=_[_0x4d25('0x33')](_0x69ed76[_0x4d25('0x2f')],qs[_0x4d25('0x35')](_0x18310d[_0x4d25('0x30')][_0x4d25('0x35')]));_0x5313e5[_0x4d25('0x34')]=_0x5313e5[_0x4d25('0x34')]['length']?_0x5313e5[_0x4d25('0x34')]:_0x69ed76[_0x4d25('0x2f')];_0x5313e5[_0x4d25('0x39')]=qs[_0x4d25('0x3a')](_0x18310d['query'][_0x4d25('0x3a')]);_0x5313e5[_0x4d25('0x3b')]=qs[_0x4d25('0x32')](_[_0x4d25('0x3c')](_0x18310d['query'],_0x69ed76[_0x4d25('0x32')]));if(_0x18310d[_0x4d25('0x30')][_0x4d25('0x3d')]){_0x5313e5[_0x4d25('0x3b')]=_[_0x4d25('0x3f')](_0x5313e5[_0x4d25('0x3b')],{'$or':_[_0x4d25('0x2a')](_0x5313e5['attributes'],function(_0x5f4679){var _0x59788d={};_0x59788d[_0x5f4679]={'$like':'%'+_0x18310d[_0x4d25('0x30')][_0x4d25('0x3d')]+'%'};return _0x59788d;})});}_0x5313e5=_[_0x4d25('0x3f')]({},_0x5313e5,_0x18310d[_0x4d25('0x40')]);return _0xe2647[_0x4d25('0x4e')](_0x5313e5);}})[_0x4d25('0x25')](function(_0x3c9e39){if(_0x3c9e39){_0xea141a=_0x3c9e39[_0x4d25('0x36')];if(!_0x18310d['query'][_0x4d25('0x37')](_0x4d25('0x38'))){_0x5313e5[_0x4d25('0x1e')]=qs[_0x4d25('0x1e')](_0x18310d[_0x4d25('0x30')]['limit']);_0x5313e5[_0x4d25('0x1c')]=qs['offset'](_0x18310d['query'][_0x4d25('0x1c')]);}return _0xe2647['getSubjects'](_0x5313e5);}})[_0x4d25('0x25')](function(_0x25c96e){if(_0x25c96e){return _0x25c96e?{'count':_0xea141a,'rows':_0x25c96e}:null;}})[_0x4d25('0x25')](respondWithResult(_0x1a3f4c,null))[_0x4d25('0x45')](handleError(_0x1a3f4c,null));};exports[_0x4d25('0x50')]=function(_0xe24e85,_0xc7f2e5,_0x3466ed){var _0x2d448a={};var _0x48fc28={};var _0x5d9114;var _0x3a983a;return db[_0x4d25('0x2b')]['findOne']({'where':{'id':_0xe24e85[_0x4d25('0x47')]['id']}})[_0x4d25('0x25')](handleEntityNotFound(_0xc7f2e5,null))[_0x4d25('0x25')](function(_0x16c891){if(_0x16c891){_0x5d9114=_0x16c891;_0x48fc28['model']=_['keys'](db[_0x4d25('0x4f')]['rawAttributes']);_0x48fc28[_0x4d25('0x30')]=_[_0x4d25('0x31')](_0xe24e85['query']);_0x48fc28[_0x4d25('0x32')]=_['intersection'](_0x48fc28[_0x4d25('0x2f')],_0x48fc28[_0x4d25('0x30')]);_0x2d448a[_0x4d25('0x34')]=_[_0x4d25('0x33')](_0x48fc28[_0x4d25('0x2f')],qs['fields'](_0xe24e85[_0x4d25('0x30')]['fields']));_0x2d448a['attributes']=_0x2d448a[_0x4d25('0x34')][_0x4d25('0x36')]?_0x2d448a[_0x4d25('0x34')]:_0x48fc28[_0x4d25('0x2f')];_0x2d448a['order']=qs[_0x4d25('0x3a')](_0xe24e85[_0x4d25('0x30')][_0x4d25('0x3a')]);_0x2d448a['where']=qs[_0x4d25('0x32')](_[_0x4d25('0x3c')](_0xe24e85[_0x4d25('0x30')],_0x48fc28[_0x4d25('0x32')]));if(_0xe24e85[_0x4d25('0x30')]['filter']){_0x2d448a[_0x4d25('0x3b')]=_[_0x4d25('0x3f')](_0x2d448a[_0x4d25('0x3b')],{'$or':_['map'](_0x2d448a[_0x4d25('0x34')],function(_0xf3a26d){var _0x2f1207={};_0x2f1207[_0xf3a26d]={'$like':'%'+_0xe24e85['query'][_0x4d25('0x3d')]+'%'};return _0x2f1207;})});}_0x2d448a=_[_0x4d25('0x3f')]({},_0x2d448a,_0xe24e85['options']);return _0x5d9114['getDescriptions'](_0x2d448a);}})['then'](function(_0x2bf803){if(_0x2bf803){_0x3a983a=_0x2bf803[_0x4d25('0x36')];if(!_0xe24e85[_0x4d25('0x30')][_0x4d25('0x37')](_0x4d25('0x38'))){_0x2d448a['limit']=qs[_0x4d25('0x1e')](_0xe24e85['query']['limit']);_0x2d448a['offset']=qs['offset'](_0xe24e85[_0x4d25('0x30')]['offset']);}return _0x5d9114[_0x4d25('0x50')](_0x2d448a);}})[_0x4d25('0x25')](function(_0xc57840){if(_0xc57840){return _0xc57840?{'count':_0x3a983a,'rows':_0xc57840}:null;}})[_0x4d25('0x25')](respondWithResult(_0xc7f2e5,null))['catch'](handleError(_0xc7f2e5,null));}; \ No newline at end of file +var _0x25bd=['filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','rawAttributes','getSubjects','findOne','ServicenowField','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x25bd,0x14e));var _0xd25b=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x25bd[_0x474bc0];return _0x4b24cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd25b('0x0'));var zipdir=require(_0xd25b('0x1'));var jsonpatch=require(_0xd25b('0x2'));var rp=require(_0xd25b('0x3'));var moment=require(_0xd25b('0x4'));var BPromise=require(_0xd25b('0x5'));var Mustache=require(_0xd25b('0x6'));var util=require(_0xd25b('0x7'));var path=require(_0xd25b('0x8'));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(_0xd25b('0x9'));var squel=require(_0xd25b('0xa'));var crypto=require(_0xd25b('0xb'));var jsforce=require(_0xd25b('0xc'));var deskjs=require(_0xd25b('0xd'));var toCsv=require(_0xd25b('0xe'));var querystring=require('querystring');var Papa=require(_0xd25b('0xf'));var Redis=require('ioredis');var authService=require(_0xd25b('0x10'));var qs=require(_0xd25b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd25b('0x12'));var logger=require(_0xd25b('0x13'))('api');var utils=require(_0xd25b('0x14'));var config=require(_0xd25b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108438,_0x2e53cb){_0x2e53cb=_0x2e53cb||0xcc;return function(_0x440810){if(_0x440810){return _0x108438[_0xd25b('0x16')](_0x2e53cb);}return _0x108438[_0xd25b('0x17')](_0x2e53cb)[_0xd25b('0x18')]();};}function respondWithResult(_0x5293dd,_0x1afe2e){_0x1afe2e=_0x1afe2e||0xc8;return function(_0x2ce01a){if(_0x2ce01a){return _0x5293dd['status'](_0x1afe2e)[_0xd25b('0x19')](_0x2ce01a);}};}function respondWithFilteredResult(_0x562258,_0x2f0287){return function(_0x402423){if(_0x402423){var _0x50f103=typeof _0x2f0287[_0xd25b('0x1a')]==='undefined'&&typeof _0x2f0287[_0xd25b('0x1b')]===_0xd25b('0x1c');var _0x1b7a41=_0x402423[_0xd25b('0x1d')];var _0x2a198b=_0x50f103?0x0:_0x2f0287[_0xd25b('0x1a')];var _0x2dde62=_0x50f103?_0x402423['count']:_0x2f0287[_0xd25b('0x1a')]+_0x2f0287[_0xd25b('0x1b')];var _0x27cc7f;if(_0x2dde62>=_0x1b7a41){_0x2dde62=_0x1b7a41;_0x27cc7f=0xc8;}else{_0x27cc7f=0xce;}_0x562258[_0xd25b('0x17')](_0x27cc7f);return _0x562258['set'](_0xd25b('0x1e'),_0x2a198b+'-'+_0x2dde62+'/'+_0x1b7a41)[_0xd25b('0x19')](_0x402423);}return null;};}function patchUpdates(_0x36127e){return function(_0x3a0bcc){try{jsonpatch[_0xd25b('0x1f')](_0x3a0bcc,_0x36127e,!![]);}catch(_0x33bb52){return BPromise[_0xd25b('0x20')](_0x33bb52);}return _0x3a0bcc[_0xd25b('0x21')]();};}function saveUpdates(_0x4e5f0f,_0x436f3d){return function(_0x25cc88){if(_0x25cc88){return _0x25cc88[_0xd25b('0x22')](_0x4e5f0f)[_0xd25b('0x23')](function(_0x1a882b){return _0x1a882b;});}return null;};}function removeEntity(_0x26dc40,_0x54bd79){return function(_0x4479db){if(_0x4479db){return _0x4479db[_0xd25b('0x24')]()[_0xd25b('0x23')](function(){_0x26dc40['status'](0xcc)[_0xd25b('0x18')]();});}};}function handleEntityNotFound(_0x4542ea,_0x3623c2){return function(_0xda7e60){if(!_0xda7e60){_0x4542ea['sendStatus'](0x194);}return _0xda7e60;};}function handleError(_0x9d4092,_0x495881){_0x495881=_0x495881||0x1f4;return function(_0x34478f){logger['error'](_0x34478f[_0xd25b('0x25')]);if(_0x34478f[_0xd25b('0x26')]){delete _0x34478f['name'];}_0x9d4092[_0xd25b('0x17')](_0x495881)[_0xd25b('0x27')](_0x34478f);};}exports[_0xd25b('0x28')]=function(_0x49eb7d,_0x22cd9d){var _0x4c0c72={},_0x1e5d7d={},_0x37c7b6={'count':0x0,'rows':[]};var _0x4ab39e=_[_0xd25b('0x29')](db['ServicenowConfiguration']['rawAttributes'],function(_0xf8324b){return{'name':_0xf8324b['fieldName'],'type':_0xf8324b[_0xd25b('0x2a')]['key']};});_0x1e5d7d[_0xd25b('0x2b')]=_[_0xd25b('0x29')](_0x4ab39e,'name');_0x1e5d7d[_0xd25b('0x2c')]=_[_0xd25b('0x2d')](_0x49eb7d[_0xd25b('0x2c')]);_0x1e5d7d[_0xd25b('0x2e')]=_[_0xd25b('0x2f')](_0x1e5d7d[_0xd25b('0x2b')],_0x1e5d7d['query']);_0x4c0c72[_0xd25b('0x30')]=_[_0xd25b('0x2f')](_0x1e5d7d[_0xd25b('0x2b')],qs[_0xd25b('0x31')](_0x49eb7d[_0xd25b('0x2c')][_0xd25b('0x31')]));_0x4c0c72[_0xd25b('0x30')]=_0x4c0c72['attributes'][_0xd25b('0x32')]?_0x4c0c72['attributes']:_0x1e5d7d[_0xd25b('0x2b')];if(!_0x49eb7d[_0xd25b('0x2c')][_0xd25b('0x33')](_0xd25b('0x34'))){_0x4c0c72[_0xd25b('0x1b')]=qs[_0xd25b('0x1b')](_0x49eb7d[_0xd25b('0x2c')][_0xd25b('0x1b')]);_0x4c0c72[_0xd25b('0x1a')]=qs[_0xd25b('0x1a')](_0x49eb7d[_0xd25b('0x2c')]['offset']);}_0x4c0c72['order']=qs[_0xd25b('0x35')](_0x49eb7d[_0xd25b('0x2c')]['sort']);_0x4c0c72[_0xd25b('0x36')]=qs[_0xd25b('0x2e')](_[_0xd25b('0x37')](_0x49eb7d['query'],_0x1e5d7d[_0xd25b('0x2e')]),_0x4ab39e);if(_0x49eb7d[_0xd25b('0x2c')][_0xd25b('0x38')]){_0x4c0c72[_0xd25b('0x36')]=_[_0xd25b('0x39')](_0x4c0c72[_0xd25b('0x36')],{'$or':_[_0xd25b('0x29')](_0x4ab39e,function(_0x264ffa){if(_0x264ffa[_0xd25b('0x2a')]!==_0xd25b('0x3a')){var _0x2ae4d8={};_0x2ae4d8[_0x264ffa[_0xd25b('0x26')]]={'$like':'%'+_0x49eb7d[_0xd25b('0x2c')]['filter']+'%'};return _0x2ae4d8;}})});}_0x4c0c72=_[_0xd25b('0x39')]({},_0x4c0c72,_0x49eb7d[_0xd25b('0x3b')]);var _0x3d282e={'where':_0x4c0c72['where']};return db[_0xd25b('0x3c')][_0xd25b('0x1d')](_0x3d282e)[_0xd25b('0x23')](function(_0x43afd3){_0x37c7b6[_0xd25b('0x1d')]=_0x43afd3;if(_0x49eb7d[_0xd25b('0x2c')][_0xd25b('0x3d')]){_0x4c0c72[_0xd25b('0x3e')]=[{'all':!![]}];}return db[_0xd25b('0x3c')][_0xd25b('0x3f')](_0x4c0c72);})[_0xd25b('0x23')](function(_0x583d29){_0x37c7b6[_0xd25b('0x40')]=_0x583d29;return _0x37c7b6;})[_0xd25b('0x23')](respondWithFilteredResult(_0x22cd9d,_0x4c0c72))[_0xd25b('0x41')](handleError(_0x22cd9d,null));};exports[_0xd25b('0x42')]=function(_0x5ed7de,_0xec234b){var _0x282f7f={'raw':![],'where':{'id':_0x5ed7de[_0xd25b('0x43')]['id']}},_0x611d94={};_0x611d94[_0xd25b('0x2b')]=_['keys'](db[_0xd25b('0x3c')]['rawAttributes']);_0x611d94[_0xd25b('0x2c')]=_[_0xd25b('0x2d')](_0x5ed7de[_0xd25b('0x2c')]);_0x611d94[_0xd25b('0x2e')]=_['intersection'](_0x611d94[_0xd25b('0x2b')],_0x611d94[_0xd25b('0x2c')]);_0x282f7f[_0xd25b('0x30')]=_['intersection'](_0x611d94['model'],qs[_0xd25b('0x31')](_0x5ed7de[_0xd25b('0x2c')]['fields']));_0x282f7f[_0xd25b('0x30')]=_0x282f7f[_0xd25b('0x30')]['length']?_0x282f7f[_0xd25b('0x30')]:_0x611d94[_0xd25b('0x2b')];if(_0x5ed7de[_0xd25b('0x2c')][_0xd25b('0x3d')]){_0x282f7f[_0xd25b('0x3e')]=[{'all':!![]}];}_0x282f7f=_[_0xd25b('0x39')]({},_0x282f7f,_0x5ed7de['options']);return db['ServicenowConfiguration'][_0xd25b('0x44')](_0x282f7f)['then'](handleEntityNotFound(_0xec234b,null))[_0xd25b('0x23')](respondWithResult(_0xec234b,null))[_0xd25b('0x41')](handleError(_0xec234b,null));};exports['create']=function(_0x4a49b7,_0x343f42){return db[_0xd25b('0x3c')][_0xd25b('0x45')](_0x4a49b7['body'],{})['then'](respondWithResult(_0x343f42,0xc9))[_0xd25b('0x41')](handleError(_0x343f42,null));};exports['update']=function(_0x1399fe,_0x5536a5){if(_0x1399fe['body']['id']){delete _0x1399fe[_0xd25b('0x46')]['id'];}return db[_0xd25b('0x3c')]['find']({'where':{'id':_0x1399fe[_0xd25b('0x43')]['id']}})[_0xd25b('0x23')](handleEntityNotFound(_0x5536a5,null))[_0xd25b('0x23')](saveUpdates(_0x1399fe[_0xd25b('0x46')],null))[_0xd25b('0x23')](respondWithResult(_0x5536a5,null))[_0xd25b('0x41')](handleError(_0x5536a5,null));};exports[_0xd25b('0x24')]=function(_0x3ca3e3,_0x504f38){return db['ServicenowConfiguration']['find']({'where':{'id':_0x3ca3e3[_0xd25b('0x43')]['id']}})['then'](handleEntityNotFound(_0x504f38,null))[_0xd25b('0x23')](removeEntity(_0x504f38,null))['catch'](handleError(_0x504f38,null));};exports[_0xd25b('0x47')]=function(_0x17cb9d,_0x4cdba6,_0x30b86d){var _0x484e12={};var _0x31f576={};var _0x46caee;var _0x6566db;return db[_0xd25b('0x3c')]['findOne']({'where':{'id':_0x17cb9d[_0xd25b('0x43')]['id']}})[_0xd25b('0x23')](handleEntityNotFound(_0x4cdba6,null))[_0xd25b('0x23')](function(_0xcfc40c){if(_0xcfc40c){_0x46caee=_0xcfc40c;_0x31f576[_0xd25b('0x2b')]=_[_0xd25b('0x2d')](db['ServicenowField'][_0xd25b('0x48')]);_0x31f576[_0xd25b('0x2c')]=_[_0xd25b('0x2d')](_0x17cb9d[_0xd25b('0x2c')]);_0x31f576['filters']=_['intersection'](_0x31f576[_0xd25b('0x2b')],_0x31f576[_0xd25b('0x2c')]);_0x484e12[_0xd25b('0x30')]=_['intersection'](_0x31f576[_0xd25b('0x2b')],qs['fields'](_0x17cb9d['query']['fields']));_0x484e12['attributes']=_0x484e12[_0xd25b('0x30')][_0xd25b('0x32')]?_0x484e12[_0xd25b('0x30')]:_0x31f576[_0xd25b('0x2b')];_0x484e12['order']=qs['sort'](_0x17cb9d[_0xd25b('0x2c')][_0xd25b('0x35')]);_0x484e12['where']=qs[_0xd25b('0x2e')](_[_0xd25b('0x37')](_0x17cb9d[_0xd25b('0x2c')],_0x31f576[_0xd25b('0x2e')]));if(_0x17cb9d[_0xd25b('0x2c')][_0xd25b('0x38')]){_0x484e12[_0xd25b('0x36')]=_[_0xd25b('0x39')](_0x484e12[_0xd25b('0x36')],{'$or':_['map'](_0x484e12[_0xd25b('0x30')],function(_0x312701){var _0x513fee={};_0x513fee[_0x312701]={'$like':'%'+_0x17cb9d['query'][_0xd25b('0x38')]+'%'};return _0x513fee;})});}_0x484e12=_[_0xd25b('0x39')]({},_0x484e12,_0x17cb9d['options']);return _0x46caee[_0xd25b('0x47')](_0x484e12);}})[_0xd25b('0x23')](function(_0x19f44d){if(_0x19f44d){_0x6566db=_0x19f44d[_0xd25b('0x32')];if(!_0x17cb9d['query'][_0xd25b('0x33')](_0xd25b('0x34'))){_0x484e12[_0xd25b('0x1b')]=qs['limit'](_0x17cb9d[_0xd25b('0x2c')]['limit']);_0x484e12[_0xd25b('0x1a')]=qs['offset'](_0x17cb9d[_0xd25b('0x2c')][_0xd25b('0x1a')]);}return _0x46caee[_0xd25b('0x47')](_0x484e12);}})[_0xd25b('0x23')](function(_0x2074d5){if(_0x2074d5){return _0x2074d5?{'count':_0x6566db,'rows':_0x2074d5}:null;}})[_0xd25b('0x23')](respondWithResult(_0x4cdba6,null))['catch'](handleError(_0x4cdba6,null));};exports[_0xd25b('0x49')]=function(_0x4f3f2b,_0x47fa9e,_0x261a8e){var _0x3a7b27={};var _0x4c3e2a={};var _0x3da37f;var _0x5481d;return db['ServicenowConfiguration'][_0xd25b('0x4a')]({'where':{'id':_0x4f3f2b[_0xd25b('0x43')]['id']}})[_0xd25b('0x23')](handleEntityNotFound(_0x47fa9e,null))['then'](function(_0x1ead8f){if(_0x1ead8f){_0x3da37f=_0x1ead8f;_0x4c3e2a[_0xd25b('0x2b')]=_[_0xd25b('0x2d')](db[_0xd25b('0x4b')][_0xd25b('0x48')]);_0x4c3e2a[_0xd25b('0x2c')]=_[_0xd25b('0x2d')](_0x4f3f2b[_0xd25b('0x2c')]);_0x4c3e2a['filters']=_['intersection'](_0x4c3e2a[_0xd25b('0x2b')],_0x4c3e2a[_0xd25b('0x2c')]);_0x3a7b27[_0xd25b('0x30')]=_['intersection'](_0x4c3e2a[_0xd25b('0x2b')],qs[_0xd25b('0x31')](_0x4f3f2b[_0xd25b('0x2c')][_0xd25b('0x31')]));_0x3a7b27['attributes']=_0x3a7b27[_0xd25b('0x30')][_0xd25b('0x32')]?_0x3a7b27[_0xd25b('0x30')]:_0x4c3e2a[_0xd25b('0x2b')];_0x3a7b27[_0xd25b('0x4c')]=qs['sort'](_0x4f3f2b[_0xd25b('0x2c')][_0xd25b('0x35')]);_0x3a7b27[_0xd25b('0x36')]=qs[_0xd25b('0x2e')](_[_0xd25b('0x37')](_0x4f3f2b[_0xd25b('0x2c')],_0x4c3e2a[_0xd25b('0x2e')]));if(_0x4f3f2b['query'][_0xd25b('0x38')]){_0x3a7b27[_0xd25b('0x36')]=_['merge'](_0x3a7b27[_0xd25b('0x36')],{'$or':_[_0xd25b('0x29')](_0x3a7b27[_0xd25b('0x30')],function(_0x5e50a8){var _0x47c3bf={};_0x47c3bf[_0x5e50a8]={'$like':'%'+_0x4f3f2b['query'][_0xd25b('0x38')]+'%'};return _0x47c3bf;})});}_0x3a7b27=_['merge']({},_0x3a7b27,_0x4f3f2b[_0xd25b('0x3b')]);return _0x3da37f[_0xd25b('0x49')](_0x3a7b27);}})['then'](function(_0x372637){if(_0x372637){_0x5481d=_0x372637[_0xd25b('0x32')];if(!_0x4f3f2b[_0xd25b('0x2c')][_0xd25b('0x33')](_0xd25b('0x34'))){_0x3a7b27[_0xd25b('0x1b')]=qs[_0xd25b('0x1b')](_0x4f3f2b['query'][_0xd25b('0x1b')]);_0x3a7b27[_0xd25b('0x1a')]=qs[_0xd25b('0x1a')](_0x4f3f2b[_0xd25b('0x2c')][_0xd25b('0x1a')]);}return _0x3da37f[_0xd25b('0x49')](_0x3a7b27);}})[_0xd25b('0x23')](function(_0x47370c){if(_0x47370c){return _0x47370c?{'count':_0x5481d,'rows':_0x47370c}:null;}})[_0xd25b('0x23')](respondWithResult(_0x47fa9e,null))[_0xd25b('0x41')](handleError(_0x47fa9e,null));};exports[_0xd25b('0x4d')]=function(_0x58b91e,_0x4dc195,_0x4a97d6){var _0x2af531={};var _0x58b3f6={};var _0x3bb90e;var _0xd95290;return db[_0xd25b('0x3c')][_0xd25b('0x4a')]({'where':{'id':_0x58b91e[_0xd25b('0x43')]['id']}})[_0xd25b('0x23')](handleEntityNotFound(_0x4dc195,null))['then'](function(_0x144c6c){if(_0x144c6c){_0x3bb90e=_0x144c6c;_0x58b3f6['model']=_[_0xd25b('0x2d')](db[_0xd25b('0x4b')]['rawAttributes']);_0x58b3f6[_0xd25b('0x2c')]=_['keys'](_0x58b91e[_0xd25b('0x2c')]);_0x58b3f6[_0xd25b('0x2e')]=_[_0xd25b('0x2f')](_0x58b3f6[_0xd25b('0x2b')],_0x58b3f6[_0xd25b('0x2c')]);_0x2af531[_0xd25b('0x30')]=_[_0xd25b('0x2f')](_0x58b3f6[_0xd25b('0x2b')],qs[_0xd25b('0x31')](_0x58b91e[_0xd25b('0x2c')][_0xd25b('0x31')]));_0x2af531[_0xd25b('0x30')]=_0x2af531[_0xd25b('0x30')][_0xd25b('0x32')]?_0x2af531[_0xd25b('0x30')]:_0x58b3f6['model'];_0x2af531[_0xd25b('0x4c')]=qs[_0xd25b('0x35')](_0x58b91e['query'][_0xd25b('0x35')]);_0x2af531[_0xd25b('0x36')]=qs[_0xd25b('0x2e')](_[_0xd25b('0x37')](_0x58b91e[_0xd25b('0x2c')],_0x58b3f6[_0xd25b('0x2e')]));if(_0x58b91e['query'][_0xd25b('0x38')]){_0x2af531[_0xd25b('0x36')]=_[_0xd25b('0x39')](_0x2af531['where'],{'$or':_[_0xd25b('0x29')](_0x2af531[_0xd25b('0x30')],function(_0x14b272){var _0x41a69d={};_0x41a69d[_0x14b272]={'$like':'%'+_0x58b91e[_0xd25b('0x2c')][_0xd25b('0x38')]+'%'};return _0x41a69d;})});}_0x2af531=_[_0xd25b('0x39')]({},_0x2af531,_0x58b91e[_0xd25b('0x3b')]);return _0x3bb90e[_0xd25b('0x4d')](_0x2af531);}})[_0xd25b('0x23')](function(_0x2ee449){if(_0x2ee449){_0xd95290=_0x2ee449[_0xd25b('0x32')];if(!_0x58b91e[_0xd25b('0x2c')][_0xd25b('0x33')](_0xd25b('0x34'))){_0x2af531['limit']=qs[_0xd25b('0x1b')](_0x58b91e[_0xd25b('0x2c')][_0xd25b('0x1b')]);_0x2af531[_0xd25b('0x1a')]=qs['offset'](_0x58b91e['query'][_0xd25b('0x1a')]);}return _0x3bb90e[_0xd25b('0x4d')](_0x2af531);}})['then'](function(_0x29a27e){if(_0x29a27e){return _0x29a27e?{'count':_0xd95290,'rows':_0x29a27e}:null;}})['then'](respondWithResult(_0x4dc195,null))[_0xd25b('0x41')](handleError(_0x4dc195,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index bebafd6..44a9785 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 _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','../../config/logger','api'];(function(_0x5a4e5f,_0x4d97bd){var _0x5cddff=function(_0x2a5a73){while(--_0x2a5a73){_0x5a4e5f['push'](_0x5a4e5f['shift']());}};_0x5cddff(++_0x4d97bd);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x43592c,_0x270707){_0x43592c=_0x43592c-0x0;var _0x18dca2=_0xaebd[_0x43592c];return _0x18dca2;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5525=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x14127d,_0x3f8251){var _0x13dd3e=function(_0x5eee2c){while(--_0x5eee2c){_0x14127d['push'](_0x14127d['shift']());}};_0x13dd3e(++_0x3f8251);}(_0x5525,0xd1));var _0x5552=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5525[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var logger=require(_0x5552('0x2'))(_0x5552('0x3'));var moment=require(_0x5552('0x4'));var BPromise=require(_0x5552('0x5'));var rp=require(_0x5552('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5552('0x7'));var config=require(_0x5552('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x5552('0x9')]=function(_0x3fe1fb,_0x96ff0a){return _0x3fe1fb[_0x5552('0xa')](_0x5552('0xb'),attributes,{'tableName':_0x5552('0xc'),'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 7bf2fdd..cba27f6 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 _0xde61=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x39d152,_0x59fb41){var _0x2d9fba=function(_0x3d4f28){while(--_0x3d4f28){_0x39d152['push'](_0x39d152['shift']());}};_0x2d9fba(++_0x59fb41);}(_0xde61,0x1cf));var _0x1de6=function(_0xe79212,_0x37f1b9){_0xe79212=_0xe79212-0x0;var _0x508219=_0xde61[_0xe79212];return _0x508219;};'use strict';var _=require(_0x1de6('0x0'));var util=require(_0x1de6('0x1'));var moment=require(_0x1de6('0x2'));var BPromise=require(_0x1de6('0x3'));var rs=require(_0x1de6('0x4'));var fs=require('fs');var Redis=require(_0x1de6('0x5'));var db=require(_0x1de6('0x6'))['db'];var utils=require(_0x1de6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1de6('0x8'));var jayson=require(_0x1de6('0x9'));var client=jayson[_0x1de6('0xa')][_0x1de6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9474,_0x1fe533,_0x1a012b){return new BPromise(function(_0xb40ddb,_0x4436fb){return client[_0x1de6('0xc')](_0x1f9474,_0x1a012b)['then'](function(_0x281452){logger[_0x1de6('0xd')](_0x1de6('0xe'),_0x1fe533,'request\x20sent');logger['debug'](_0x1de6('0xf'),_0x1fe533,_0x1de6('0x10'),JSON[_0x1de6('0x11')](_0x281452));if(_0x281452[_0x1de6('0x12')]){if(_0x281452[_0x1de6('0x12')][_0x1de6('0x13')]===0x1f4){logger[_0x1de6('0x12')](_0x1de6('0xe'),_0x1fe533,_0x281452['error'][_0x1de6('0x14')]);return _0x4436fb(_0x281452[_0x1de6('0x12')][_0x1de6('0x14')]);}logger[_0x1de6('0x12')](_0x1de6('0xe'),_0x1fe533,_0x281452[_0x1de6('0x12')]['message']);return _0xb40ddb(_0x281452[_0x1de6('0x12')]['message']);}else{logger['info'](_0x1de6('0xe'),_0x1fe533,_0x1de6('0x10'));_0xb40ddb(_0x281452[_0x1de6('0x15')][_0x1de6('0x14')]);}})[_0x1de6('0x16')](function(_0x3b9b87){logger[_0x1de6('0x12')](_0x1de6('0xe'),_0x1fe533,_0x3b9b87);_0x4436fb(_0x3b9b87);});});} \ No newline at end of file +var _0x74f2=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x74f2,0x199));var _0x274f=function(_0x5dc4ca,_0x3588ca){_0x5dc4ca=_0x5dc4ca-0x0;var _0x4e3376=_0x74f2[_0x5dc4ca];return _0x4e3376;};'use strict';var _=require(_0x274f('0x0'));var util=require(_0x274f('0x1'));var moment=require(_0x274f('0x2'));var BPromise=require(_0x274f('0x3'));var rs=require(_0x274f('0x4'));var fs=require('fs');var Redis=require(_0x274f('0x5'));var db=require(_0x274f('0x6'))['db'];var utils=require(_0x274f('0x7'));var logger=require(_0x274f('0x8'))(_0x274f('0x9'));var config=require('../../config/environment');var jayson=require(_0x274f('0xa'));var client=jayson[_0x274f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411a1a,_0x29f4b0,_0x32bce1){return new BPromise(function(_0x299e05,_0x12d4dc){return client[_0x274f('0xc')](_0x411a1a,_0x32bce1)[_0x274f('0xd')](function(_0x33ad8d){logger['info'](_0x274f('0xe'),_0x29f4b0,_0x274f('0xf'));logger[_0x274f('0x10')](_0x274f('0x11'),_0x29f4b0,_0x274f('0xf'),JSON[_0x274f('0x12')](_0x33ad8d));if(_0x33ad8d['error']){if(_0x33ad8d[_0x274f('0x13')][_0x274f('0x14')]===0x1f4){logger['error'](_0x274f('0xe'),_0x29f4b0,_0x33ad8d[_0x274f('0x13')][_0x274f('0x15')]);return _0x12d4dc(_0x33ad8d[_0x274f('0x13')][_0x274f('0x15')]);}logger[_0x274f('0x13')](_0x274f('0xe'),_0x29f4b0,_0x33ad8d['error'][_0x274f('0x15')]);return _0x299e05(_0x33ad8d['error']['message']);}else{logger[_0x274f('0x16')]('ServicenowConfiguration,\x20%s,\x20%s',_0x29f4b0,_0x274f('0xf'));_0x299e05(_0x33ad8d[_0x274f('0x17')][_0x274f('0x15')]);}})['catch'](function(_0x524ebf){logger[_0x274f('0x13')](_0x274f('0xe'),_0x29f4b0,_0x524ebf);_0x12d4dc(_0x524ebf);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6388a80..c1f7fe7 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 _0xfcb6=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','isAuthenticated','get','/:id','post','create','update','delete','destroy'];(function(_0x399319,_0x281986){var _0x2561cc=function(_0x167d6c){while(--_0x167d6c){_0x399319['push'](_0x399319['shift']());}};_0x2561cc(++_0x281986);}(_0xfcb6,0x1a1));var _0x6fcb=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xfcb6[_0x49d19d];return _0x4ebef1;};'use strict';var multer=require('multer');var util=require(_0x6fcb('0x0'));var path=require('path');var timeout=require(_0x6fcb('0x1'));var express=require(_0x6fcb('0x2'));var router=express[_0x6fcb('0x3')]();var fs_extra=require(_0x6fcb('0x4'));var auth=require(_0x6fcb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6fcb('0x6'));router['get']('/',auth[_0x6fcb('0x7')](),controller['index']);router[_0x6fcb('0x8')](_0x6fcb('0x9'),auth[_0x6fcb('0x7')](),controller['show']);router[_0x6fcb('0xa')]('/',auth[_0x6fcb('0x7')](),controller[_0x6fcb('0xb')]);router['put'](_0x6fcb('0x9'),auth[_0x6fcb('0x7')](),controller[_0x6fcb('0xc')]);router[_0x6fcb('0xd')](_0x6fcb('0x9'),auth[_0x6fcb('0x7')](),controller[_0x6fcb('0xe')]);module[_0x6fcb('0xf')]=router; \ No newline at end of file +var _0x04dd=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x04dd,0x10b));var _0xd04d=function(_0x779496,_0x9b0b0b){_0x779496=_0x779496-0x0;var _0x472493=_0x04dd[_0x779496];return _0x472493;};'use strict';var multer=require(_0xd04d('0x0'));var util=require(_0xd04d('0x1'));var path=require(_0xd04d('0x2'));var timeout=require(_0xd04d('0x3'));var express=require(_0xd04d('0x4'));var router=express[_0xd04d('0x5')]();var fs_extra=require(_0xd04d('0x6'));var auth=require(_0xd04d('0x7'));var interaction=require(_0xd04d('0x8'));var config=require(_0xd04d('0x9'));var controller=require('./intServicenowField.controller');router[_0xd04d('0xa')]('/',auth[_0xd04d('0xb')](),controller[_0xd04d('0xc')]);router['get'](_0xd04d('0xd'),auth[_0xd04d('0xb')](),controller[_0xd04d('0xe')]);router['post']('/',auth[_0xd04d('0xb')](),controller[_0xd04d('0xf')]);router[_0xd04d('0x10')](_0xd04d('0xd'),auth['isAuthenticated'](),controller[_0xd04d('0x11')]);router[_0xd04d('0x12')]('/:id',auth[_0xd04d('0xb')](),controller['destroy']);module[_0xd04d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1012c14..b27ae7f 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 _0x4f11=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x4f11,0x1a7));var _0x14f1=function(_0x2f1a76,_0x518ec9){_0x2f1a76=_0x2f1a76-0x0;var _0x1bd43f=_0x4f11[_0x2f1a76];return _0x1bd43f;};'use strict';var Sequelize=require(_0x14f1('0x0'));module[_0x14f1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x14f1('0x2'),_0x14f1('0x3'),_0x14f1('0x4'),'keyValue',_0x14f1('0x5')),'defaultValue':_0x14f1('0x2')},'content':{'type':Sequelize[_0x14f1('0x6')]},'key':{'type':Sequelize[_0x14f1('0x6')]},'keyType':{'type':Sequelize[_0x14f1('0x7')]('string',_0x14f1('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x14f1('0x6')]},'idField':{'type':Sequelize[_0x14f1('0x6')]},'nameField':{'type':Sequelize[_0x14f1('0x6')]},'customField':{'type':Sequelize[_0x14f1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x14f1('0x6')]}}; \ No newline at end of file +var _0x7a90=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3e0ff3,_0x4052d0){var _0x212bd9=function(_0x505bdb){while(--_0x505bdb){_0x3e0ff3['push'](_0x3e0ff3['shift']());}};_0x212bd9(++_0x4052d0);}(_0x7a90,0x17b));var _0x07a9=function(_0x47da47,_0x5752de){_0x47da47=_0x47da47-0x0;var _0x4d6fd2=_0x7a90[_0x47da47];return _0x4d6fd2;};'use strict';var Sequelize=require(_0x07a9('0x0'));module[_0x07a9('0x1')]={'type':{'type':Sequelize[_0x07a9('0x2')](_0x07a9('0x3'),_0x07a9('0x4'),_0x07a9('0x5'),'keyValue','picklist'),'defaultValue':_0x07a9('0x3')},'content':{'type':Sequelize[_0x07a9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x07a9('0x2')](_0x07a9('0x3'),_0x07a9('0x4'),_0x07a9('0x5'))},'keyContent':{'type':Sequelize[_0x07a9('0x6')]},'idField':{'type':Sequelize[_0x07a9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x07a9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07a9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e460625..ae66aff 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 _0xf90e=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x33ec76,_0x2e1a70){var _0x504e07=function(_0x26fc5f){while(--_0x26fc5f){_0x33ec76['push'](_0x33ec76['shift']());}};_0x504e07(++_0x2e1a70);}(_0xf90e,0x14d));var _0xef90=function(_0x31978a,_0x4d5869){_0x31978a=_0x31978a-0x0;var _0x21d825=_0xf90e[_0x31978a];return _0x21d825;};'use strict';var emlformat=require(_0xef90('0x0'));var rimraf=require(_0xef90('0x1'));var zipdir=require(_0xef90('0x2'));var jsonpatch=require(_0xef90('0x3'));var rp=require(_0xef90('0x4'));var moment=require(_0xef90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xef90('0x6'));var util=require(_0xef90('0x7'));var path=require(_0xef90('0x8'));var sox=require(_0xef90('0x9'));var csv=require(_0xef90('0xa'));var ejs=require(_0xef90('0xb'));var fs=require('fs');var fs_extra=require(_0xef90('0xc'));var _=require(_0xef90('0xd'));var squel=require(_0xef90('0xe'));var crypto=require(_0xef90('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xef90('0xa'));var querystring=require(_0xef90('0x10'));var Papa=require(_0xef90('0x11'));var Redis=require(_0xef90('0x12'));var authService=require(_0xef90('0x13'));var qs=require(_0xef90('0x14'));var as=require(_0xef90('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef90('0x16'));var utils=require(_0xef90('0x17'));var config=require(_0xef90('0x18'));var licenseUtil=require(_0xef90('0x19'));var db=require(_0xef90('0x1a'))['db'];function respondWithStatusCode(_0x42985f,_0x301118){_0x301118=_0x301118||0xcc;return function(_0x512ece){if(_0x512ece){return _0x42985f['sendStatus'](_0x301118);}return _0x42985f['status'](_0x301118)[_0xef90('0x1b')]();};}function respondWithResult(_0x4921d1,_0x2269be){_0x2269be=_0x2269be||0xc8;return function(_0x1f6ef4){if(_0x1f6ef4){return _0x4921d1[_0xef90('0x1c')](_0x2269be)[_0xef90('0x1d')](_0x1f6ef4);}};}function respondWithFilteredResult(_0x4e58b9,_0x202de1){return function(_0x137456){if(_0x137456){var _0x4c3134=typeof _0x202de1['offset']===_0xef90('0x1e')&&typeof _0x202de1[_0xef90('0x1f')]===_0xef90('0x1e');var _0x1b51c5=_0x137456[_0xef90('0x20')];var _0x53750c=_0x4c3134?0x0:_0x202de1[_0xef90('0x21')];var _0x43474e=_0x4c3134?_0x137456[_0xef90('0x20')]:_0x202de1['offset']+_0x202de1['limit'];var _0x124f72;if(_0x43474e>=_0x1b51c5){_0x43474e=_0x1b51c5;_0x124f72=0xc8;}else{_0x124f72=0xce;}_0x4e58b9[_0xef90('0x1c')](_0x124f72);return _0x4e58b9[_0xef90('0x22')](_0xef90('0x23'),_0x53750c+'-'+_0x43474e+'/'+_0x1b51c5)['json'](_0x137456);}return null;};}function patchUpdates(_0x32cc31){return function(_0x52b412){try{jsonpatch['apply'](_0x52b412,_0x32cc31,!![]);}catch(_0x1ff229){return BPromise[_0xef90('0x24')](_0x1ff229);}return _0x52b412['save']();};}function saveUpdates(_0x4421c8,_0x21907a){return function(_0x162a95){if(_0x162a95){return _0x162a95[_0xef90('0x25')](_0x4421c8)[_0xef90('0x26')](function(_0x159288){return _0x159288;});}return null;};}function removeEntity(_0x4f1448,_0x3e031c){return function(_0x47ad08){if(_0x47ad08){return _0x47ad08[_0xef90('0x27')]()[_0xef90('0x26')](function(){_0x4f1448['status'](0xcc)[_0xef90('0x1b')]();});}};}function handleEntityNotFound(_0x3b9248,_0x13b42f){return function(_0x3454fc){if(!_0x3454fc){_0x3b9248[_0xef90('0x28')](0x194);}return _0x3454fc;};}function handleError(_0x4777ed,_0x1e37b9){_0x1e37b9=_0x1e37b9||0x1f4;return function(_0x349cb9){logger[_0xef90('0x29')](_0x349cb9[_0xef90('0x2a')]);if(_0x349cb9[_0xef90('0x2b')]){delete _0x349cb9[_0xef90('0x2b')];}_0x4777ed[_0xef90('0x1c')](_0x1e37b9)[_0xef90('0x2c')](_0x349cb9);};}exports[_0xef90('0x2d')]=function(_0x1074a3,_0x6f6ba9){var _0x16b638={},_0x514ec0={},_0x5cd1e5={'count':0x0,'rows':[]};var _0x372757=_[_0xef90('0x2e')](db[_0xef90('0x2f')][_0xef90('0x30')],function(_0x3fd00b){return{'name':_0x3fd00b[_0xef90('0x31')],'type':_0x3fd00b[_0xef90('0x32')][_0xef90('0x33')]};});_0x514ec0[_0xef90('0x34')]=_[_0xef90('0x2e')](_0x372757,_0xef90('0x2b'));_0x514ec0['query']=_[_0xef90('0x35')](_0x1074a3[_0xef90('0x36')]);_0x514ec0[_0xef90('0x37')]=_[_0xef90('0x38')](_0x514ec0[_0xef90('0x34')],_0x514ec0[_0xef90('0x36')]);_0x16b638[_0xef90('0x39')]=_[_0xef90('0x38')](_0x514ec0[_0xef90('0x34')],qs[_0xef90('0x3a')](_0x1074a3[_0xef90('0x36')][_0xef90('0x3a')]));_0x16b638[_0xef90('0x39')]=_0x16b638[_0xef90('0x39')]['length']?_0x16b638[_0xef90('0x39')]:_0x514ec0[_0xef90('0x34')];if(!_0x1074a3[_0xef90('0x36')][_0xef90('0x3b')](_0xef90('0x3c'))){_0x16b638[_0xef90('0x1f')]=qs[_0xef90('0x1f')](_0x1074a3[_0xef90('0x36')][_0xef90('0x1f')]);_0x16b638['offset']=qs[_0xef90('0x21')](_0x1074a3[_0xef90('0x36')]['offset']);}_0x16b638[_0xef90('0x3d')]=qs[_0xef90('0x3e')](_0x1074a3[_0xef90('0x36')][_0xef90('0x3e')]);_0x16b638[_0xef90('0x3f')]=qs[_0xef90('0x37')](_['pick'](_0x1074a3[_0xef90('0x36')],_0x514ec0['filters']),_0x372757);if(_0x1074a3[_0xef90('0x36')][_0xef90('0x40')]){_0x16b638[_0xef90('0x3f')]=_[_0xef90('0x41')](_0x16b638[_0xef90('0x3f')],{'$or':_[_0xef90('0x2e')](_0x372757,function(_0x1d68bb){if(_0x1d68bb[_0xef90('0x32')]!==_0xef90('0x42')){var _0x4e0588={};_0x4e0588[_0x1d68bb[_0xef90('0x2b')]]={'$like':'%'+_0x1074a3[_0xef90('0x36')][_0xef90('0x40')]+'%'};return _0x4e0588;}})});}_0x16b638=_[_0xef90('0x41')]({},_0x16b638,_0x1074a3[_0xef90('0x43')]);var _0x31e043={'where':_0x16b638[_0xef90('0x3f')]};return db[_0xef90('0x2f')][_0xef90('0x20')](_0x31e043)[_0xef90('0x26')](function(_0x2b5c27){_0x5cd1e5[_0xef90('0x20')]=_0x2b5c27;if(_0x1074a3[_0xef90('0x36')][_0xef90('0x44')]){_0x16b638[_0xef90('0x45')]=[{'all':!![]}];}return db[_0xef90('0x2f')][_0xef90('0x46')](_0x16b638);})[_0xef90('0x26')](function(_0x841653){_0x5cd1e5[_0xef90('0x47')]=_0x841653;return _0x5cd1e5;})['then'](respondWithFilteredResult(_0x6f6ba9,_0x16b638))[_0xef90('0x48')](handleError(_0x6f6ba9,null));};exports[_0xef90('0x49')]=function(_0x1c0b96,_0x2b9b66){var _0x45976d={'raw':!![],'where':{'id':_0x1c0b96[_0xef90('0x4a')]['id']}},_0x55d43e={};_0x55d43e[_0xef90('0x34')]=_[_0xef90('0x35')](db['ServicenowField'][_0xef90('0x30')]);_0x55d43e[_0xef90('0x36')]=_[_0xef90('0x35')](_0x1c0b96[_0xef90('0x36')]);_0x55d43e[_0xef90('0x37')]=_[_0xef90('0x38')](_0x55d43e[_0xef90('0x34')],_0x55d43e[_0xef90('0x36')]);_0x45976d[_0xef90('0x39')]=_[_0xef90('0x38')](_0x55d43e['model'],qs['fields'](_0x1c0b96[_0xef90('0x36')][_0xef90('0x3a')]));_0x45976d[_0xef90('0x39')]=_0x45976d[_0xef90('0x39')][_0xef90('0x4b')]?_0x45976d['attributes']:_0x55d43e[_0xef90('0x34')];if(_0x1c0b96[_0xef90('0x36')][_0xef90('0x44')]){_0x45976d[_0xef90('0x45')]=[{'all':!![]}];}_0x45976d=_[_0xef90('0x41')]({},_0x45976d,_0x1c0b96[_0xef90('0x43')]);return db[_0xef90('0x2f')][_0xef90('0x4c')](_0x45976d)[_0xef90('0x26')](handleEntityNotFound(_0x2b9b66,null))['then'](respondWithResult(_0x2b9b66,null))['catch'](handleError(_0x2b9b66,null));};exports['create']=function(_0x40aeb5,_0x302dba){return db[_0xef90('0x2f')][_0xef90('0x4d')](_0x40aeb5[_0xef90('0x4e')],{})[_0xef90('0x26')](respondWithResult(_0x302dba,0xc9))['catch'](handleError(_0x302dba,null));};exports[_0xef90('0x25')]=function(_0x30d721,_0x20afc){if(_0x30d721[_0xef90('0x4e')]['id']){delete _0x30d721[_0xef90('0x4e')]['id'];}return db[_0xef90('0x2f')][_0xef90('0x4c')]({'where':{'id':_0x30d721[_0xef90('0x4a')]['id']}})[_0xef90('0x26')](handleEntityNotFound(_0x20afc,null))[_0xef90('0x26')](saveUpdates(_0x30d721[_0xef90('0x4e')],null))['then'](respondWithResult(_0x20afc,null))[_0xef90('0x48')](handleError(_0x20afc,null));};exports[_0xef90('0x27')]=function(_0x3a7f35,_0x13277e){return db[_0xef90('0x2f')][_0xef90('0x4c')]({'where':{'id':_0x3a7f35[_0xef90('0x4a')]['id']}})[_0xef90('0x26')](handleEntityNotFound(_0x13277e,null))[_0xef90('0x26')](removeEntity(_0x13277e,null))[_0xef90('0x48')](handleError(_0x13277e,null));}; \ No newline at end of file +var _0xa1ca=['map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','ServicenowField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x116b8e,_0x1da172){var _0x3a884b=function(_0x15a3fe){while(--_0x15a3fe){_0x116b8e['push'](_0x116b8e['shift']());}};_0x3a884b(++_0x1da172);}(_0xa1ca,0x1d4));var _0xaa1c=function(_0x496c30,_0x4f32cf){_0x496c30=_0x496c30-0x0;var _0x168fbb=_0xa1ca[_0x496c30];return _0x168fbb;};'use strict';var emlformat=require(_0xaa1c('0x0'));var rimraf=require(_0xaa1c('0x1'));var zipdir=require(_0xaa1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa1c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa1c('0x4'));var util=require(_0xaa1c('0x5'));var path=require('path');var sox=require(_0xaa1c('0x6'));var csv=require('to-csv');var ejs=require(_0xaa1c('0x7'));var fs=require('fs');var fs_extra=require(_0xaa1c('0x8'));var _=require('lodash');var squel=require(_0xaa1c('0x9'));var crypto=require(_0xaa1c('0xa'));var jsforce=require(_0xaa1c('0xb'));var deskjs=require(_0xaa1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaa1c('0xd'));var Papa=require(_0xaa1c('0xe'));var Redis=require('ioredis');var authService=require(_0xaa1c('0xf'));var qs=require(_0xaa1c('0x10'));var as=require(_0xaa1c('0x11'));var hardwareService=require(_0xaa1c('0x12'));var logger=require(_0xaa1c('0x13'))(_0xaa1c('0x14'));var utils=require('../../config/utils');var config=require(_0xaa1c('0x15'));var licenseUtil=require(_0xaa1c('0x16'));var db=require(_0xaa1c('0x17'))['db'];function respondWithStatusCode(_0x4746aa,_0x233616){_0x233616=_0x233616||0xcc;return function(_0x20412e){if(_0x20412e){return _0x4746aa[_0xaa1c('0x18')](_0x233616);}return _0x4746aa[_0xaa1c('0x19')](_0x233616)[_0xaa1c('0x1a')]();};}function respondWithResult(_0x46133f,_0x313a6d){_0x313a6d=_0x313a6d||0xc8;return function(_0x45fef0){if(_0x45fef0){return _0x46133f[_0xaa1c('0x19')](_0x313a6d)[_0xaa1c('0x1b')](_0x45fef0);}};}function respondWithFilteredResult(_0x1676c0,_0x3a2f54){return function(_0x8f374b){if(_0x8f374b){var _0x36890f=typeof _0x3a2f54[_0xaa1c('0x1c')]===_0xaa1c('0x1d')&&typeof _0x3a2f54[_0xaa1c('0x1e')]==='undefined';var _0x18c56c=_0x8f374b[_0xaa1c('0x1f')];var _0x5ca69a=_0x36890f?0x0:_0x3a2f54['offset'];var _0xc9842e=_0x36890f?_0x8f374b[_0xaa1c('0x1f')]:_0x3a2f54[_0xaa1c('0x1c')]+_0x3a2f54[_0xaa1c('0x1e')];var _0x1f165a;if(_0xc9842e>=_0x18c56c){_0xc9842e=_0x18c56c;_0x1f165a=0xc8;}else{_0x1f165a=0xce;}_0x1676c0[_0xaa1c('0x19')](_0x1f165a);return _0x1676c0['set'](_0xaa1c('0x20'),_0x5ca69a+'-'+_0xc9842e+'/'+_0x18c56c)[_0xaa1c('0x1b')](_0x8f374b);}return null;};}function patchUpdates(_0x286c11){return function(_0x31f041){try{jsonpatch['apply'](_0x31f041,_0x286c11,!![]);}catch(_0x2def5c){return BPromise[_0xaa1c('0x21')](_0x2def5c);}return _0x31f041[_0xaa1c('0x22')]();};}function saveUpdates(_0x4dfe2d,_0x41607b){return function(_0x33a28d){if(_0x33a28d){return _0x33a28d[_0xaa1c('0x23')](_0x4dfe2d)[_0xaa1c('0x24')](function(_0xc6871){return _0xc6871;});}return null;};}function removeEntity(_0x2c4e33,_0x2871d8){return function(_0x99f388){if(_0x99f388){return _0x99f388[_0xaa1c('0x25')]()[_0xaa1c('0x24')](function(){_0x2c4e33[_0xaa1c('0x19')](0xcc)[_0xaa1c('0x1a')]();});}};}function handleEntityNotFound(_0x3e097d,_0x853941){return function(_0x1b5b89){if(!_0x1b5b89){_0x3e097d[_0xaa1c('0x18')](0x194);}return _0x1b5b89;};}function handleError(_0x3ceb62,_0x5c4a4f){_0x5c4a4f=_0x5c4a4f||0x1f4;return function(_0x40d0b9){logger[_0xaa1c('0x26')](_0x40d0b9[_0xaa1c('0x27')]);if(_0x40d0b9['name']){delete _0x40d0b9[_0xaa1c('0x28')];}_0x3ceb62[_0xaa1c('0x19')](_0x5c4a4f)[_0xaa1c('0x29')](_0x40d0b9);};}exports[_0xaa1c('0x2a')]=function(_0x59d687,_0x4e5809){var _0xd9eb31={},_0x166ccf={},_0x2c4c9b={'count':0x0,'rows':[]};var _0x230c31=_[_0xaa1c('0x2b')](db['ServicenowField'][_0xaa1c('0x2c')],function(_0x521086){return{'name':_0x521086['fieldName'],'type':_0x521086['type'][_0xaa1c('0x2d')]};});_0x166ccf['model']=_[_0xaa1c('0x2b')](_0x230c31,_0xaa1c('0x28'));_0x166ccf['query']=_['keys'](_0x59d687[_0xaa1c('0x2e')]);_0x166ccf[_0xaa1c('0x2f')]=_[_0xaa1c('0x30')](_0x166ccf[_0xaa1c('0x31')],_0x166ccf[_0xaa1c('0x2e')]);_0xd9eb31[_0xaa1c('0x32')]=_['intersection'](_0x166ccf['model'],qs[_0xaa1c('0x33')](_0x59d687[_0xaa1c('0x2e')][_0xaa1c('0x33')]));_0xd9eb31['attributes']=_0xd9eb31[_0xaa1c('0x32')][_0xaa1c('0x34')]?_0xd9eb31['attributes']:_0x166ccf[_0xaa1c('0x31')];if(!_0x59d687[_0xaa1c('0x2e')]['hasOwnProperty'](_0xaa1c('0x35'))){_0xd9eb31[_0xaa1c('0x1e')]=qs[_0xaa1c('0x1e')](_0x59d687['query']['limit']);_0xd9eb31[_0xaa1c('0x1c')]=qs['offset'](_0x59d687[_0xaa1c('0x2e')]['offset']);}_0xd9eb31[_0xaa1c('0x36')]=qs[_0xaa1c('0x37')](_0x59d687[_0xaa1c('0x2e')][_0xaa1c('0x37')]);_0xd9eb31[_0xaa1c('0x38')]=qs[_0xaa1c('0x2f')](_['pick'](_0x59d687['query'],_0x166ccf[_0xaa1c('0x2f')]),_0x230c31);if(_0x59d687['query'][_0xaa1c('0x39')]){_0xd9eb31[_0xaa1c('0x38')]=_[_0xaa1c('0x3a')](_0xd9eb31[_0xaa1c('0x38')],{'$or':_[_0xaa1c('0x2b')](_0x230c31,function(_0x300d0a){if(_0x300d0a[_0xaa1c('0x3b')]!==_0xaa1c('0x3c')){var _0x93c54f={};_0x93c54f[_0x300d0a[_0xaa1c('0x28')]]={'$like':'%'+_0x59d687[_0xaa1c('0x2e')][_0xaa1c('0x39')]+'%'};return _0x93c54f;}})});}_0xd9eb31=_[_0xaa1c('0x3a')]({},_0xd9eb31,_0x59d687['options']);var _0x17361f={'where':_0xd9eb31[_0xaa1c('0x38')]};return db[_0xaa1c('0x3d')]['count'](_0x17361f)[_0xaa1c('0x24')](function(_0x145e0f){_0x2c4c9b[_0xaa1c('0x1f')]=_0x145e0f;if(_0x59d687[_0xaa1c('0x2e')][_0xaa1c('0x3e')]){_0xd9eb31[_0xaa1c('0x3f')]=[{'all':!![]}];}return db[_0xaa1c('0x3d')][_0xaa1c('0x40')](_0xd9eb31);})[_0xaa1c('0x24')](function(_0x1bd334){_0x2c4c9b[_0xaa1c('0x41')]=_0x1bd334;return _0x2c4c9b;})[_0xaa1c('0x24')](respondWithFilteredResult(_0x4e5809,_0xd9eb31))[_0xaa1c('0x42')](handleError(_0x4e5809,null));};exports[_0xaa1c('0x43')]=function(_0x465ed0,_0x3e7bc7){var _0x3aaee4={'raw':!![],'where':{'id':_0x465ed0[_0xaa1c('0x44')]['id']}},_0x14de18={};_0x14de18[_0xaa1c('0x31')]=_['keys'](db[_0xaa1c('0x3d')][_0xaa1c('0x2c')]);_0x14de18[_0xaa1c('0x2e')]=_['keys'](_0x465ed0[_0xaa1c('0x2e')]);_0x14de18[_0xaa1c('0x2f')]=_['intersection'](_0x14de18[_0xaa1c('0x31')],_0x14de18[_0xaa1c('0x2e')]);_0x3aaee4[_0xaa1c('0x32')]=_[_0xaa1c('0x30')](_0x14de18[_0xaa1c('0x31')],qs['fields'](_0x465ed0[_0xaa1c('0x2e')][_0xaa1c('0x33')]));_0x3aaee4[_0xaa1c('0x32')]=_0x3aaee4[_0xaa1c('0x32')][_0xaa1c('0x34')]?_0x3aaee4['attributes']:_0x14de18[_0xaa1c('0x31')];if(_0x465ed0[_0xaa1c('0x2e')][_0xaa1c('0x3e')]){_0x3aaee4[_0xaa1c('0x3f')]=[{'all':!![]}];}_0x3aaee4=_[_0xaa1c('0x3a')]({},_0x3aaee4,_0x465ed0[_0xaa1c('0x45')]);return db[_0xaa1c('0x3d')][_0xaa1c('0x46')](_0x3aaee4)['then'](handleEntityNotFound(_0x3e7bc7,null))[_0xaa1c('0x24')](respondWithResult(_0x3e7bc7,null))['catch'](handleError(_0x3e7bc7,null));};exports[_0xaa1c('0x47')]=function(_0xb86bfa,_0x2ed634){return db[_0xaa1c('0x3d')][_0xaa1c('0x47')](_0xb86bfa[_0xaa1c('0x48')],{})[_0xaa1c('0x24')](respondWithResult(_0x2ed634,0xc9))['catch'](handleError(_0x2ed634,null));};exports[_0xaa1c('0x23')]=function(_0x24d0b6,_0x46eaf8){if(_0x24d0b6[_0xaa1c('0x48')]['id']){delete _0x24d0b6[_0xaa1c('0x48')]['id'];}return db[_0xaa1c('0x3d')]['find']({'where':{'id':_0x24d0b6[_0xaa1c('0x44')]['id']}})[_0xaa1c('0x24')](handleEntityNotFound(_0x46eaf8,null))['then'](saveUpdates(_0x24d0b6['body'],null))[_0xaa1c('0x24')](respondWithResult(_0x46eaf8,null))[_0xaa1c('0x42')](handleError(_0x46eaf8,null));};exports['destroy']=function(_0x39597e,_0x37957b){return db[_0xaa1c('0x3d')][_0xaa1c('0x46')]({'where':{'id':_0x39597e[_0xaa1c('0x44')]['id']}})[_0xaa1c('0x24')](handleEntityNotFound(_0x37957b,null))['then'](removeEntity(_0x37957b,null))[_0xaa1c('0x42')](handleError(_0x37957b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index aac89ee..325c6b4 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 _0xc752=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index'];(function(_0x3f18f8,_0x50664c){var _0x7481d4=function(_0x4883b0){while(--_0x4883b0){_0x3f18f8['push'](_0x3f18f8['shift']());}};_0x7481d4(++_0x50664c);}(_0xc752,0xd3));var _0x2c75=function(_0x2519fc,_0x3b9b29){_0x2519fc=_0x2519fc-0x0;var _0x34444e=_0xc752[_0x2519fc];return _0x34444e;};'use strict';var _=require(_0x2c75('0x0'));var util=require(_0x2c75('0x1'));var logger=require(_0x2c75('0x2'))(_0x2c75('0x3'));var moment=require(_0x2c75('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c75('0x5'));var fs=require('fs');var path=require(_0x2c75('0x6'));var rimraf=require(_0x2c75('0x7'));var config=require(_0x2c75('0x8'));var attributes=require(_0x2c75('0x9'));module[_0x2c75('0xa')]=function(_0x4b57a7,_0x33995c){return _0x4b57a7[_0x2c75('0xb')](_0x2c75('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2c75('0xd'),'fields':['idField',_0x2c75('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x380f=['define','ServicenowField','int_servicenow_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intServicenowField.attributes','exports'];(function(_0xa6c46,_0x4800d9){var _0x3017c9=function(_0x579f54){while(--_0x579f54){_0xa6c46['push'](_0xa6c46['shift']());}};_0x3017c9(++_0x4800d9);}(_0x380f,0x1cb));var _0xf380=function(_0x24a3bc,_0x53a1d8){_0x24a3bc=_0x24a3bc-0x0;var _0x581aad=_0x380f[_0x24a3bc];return _0x581aad;};'use strict';var _=require(_0xf380('0x0'));var util=require(_0xf380('0x1'));var logger=require(_0xf380('0x2'))(_0xf380('0x3'));var moment=require(_0xf380('0x4'));var BPromise=require(_0xf380('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf380('0x6'));var attributes=require(_0xf380('0x7'));module[_0xf380('0x8')]=function(_0x5cf613,_0x109bfb){return _0x5cf613[_0xf380('0x9')](_0xf380('0xa'),attributes,{'tableName':_0xf380('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xf380('0xc')],'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 e2ac9b4..8e33760 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x4f12a2,_0x6366b2){var _0x4ccacc=function(_0x181232){while(--_0x181232){_0x4f12a2['push'](_0x4f12a2['shift']());}};_0x4ccacc(++_0x6366b2);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x166601,_0x345c08){_0x166601=_0x166601-0x0;var _0x7695d9=_0x9ffd[_0x166601];return _0x7695d9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5bd8b3,_0x26a7ac){var _0x323c25=function(_0x2184e4){while(--_0x2184e4){_0x5bd8b3['push'](_0x5bd8b3['shift']());}};_0x323c25(++_0x26a7ac);}(_0xaa88,0x137));var _0x8aa8=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0xaa88[_0x30f030];return _0xf7614f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 8024e54..903b526 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(_0x557d4c,_0x379e05){var _0x3ce199=function(_0x276eca){while(--_0x276eca){_0x557d4c['push'](_0x557d4c['shift']());}};_0x3ce199(++_0x379e05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x58a560,_0x440a3b){var _0x5c56a6=function(_0x3df773){while(--_0x3df773){_0x58a560['push'](_0x58a560['shift']());}};_0x5c56a6(++_0x440a3b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e397b30..a51d01e 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(_0x18b208,_0x4d9912){var _0x2d5e80=function(_0x181b66){while(--_0x181b66){_0x18b208['push'](_0x18b208['shift']());}};_0x2d5e80(++_0x4d9912);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5eb36b,_0x2eba52){var _0x5b8ac5=function(_0x2e7557){while(--_0x2e7557){_0x5eb36b['push'](_0x5eb36b['shift']());}};_0x5b8ac5(++_0x2eba52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 a247b7f..8529dc5 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 _0x6a6a=['error','name','send','map','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','Password\x20Expired','/service/v4_1/rest.php','Calls','values','remove','includes','label','endsWith','value','statusCode','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then'];(function(_0x3c8afe,_0x11a0b3){var _0x24c9f9=function(_0x32eec8){while(--_0x32eec8){_0x3c8afe['push'](_0x3c8afe['shift']());}};_0x24c9f9(++_0x11a0b3);}(_0x6a6a,0xc3));var _0xa6a6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6a6a[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xa6a6('0x0'));var rimraf=require(_0xa6a6('0x1'));var zipdir=require(_0xa6a6('0x2'));var jsonpatch=require(_0xa6a6('0x3'));var rp=require(_0xa6a6('0x4'));var moment=require(_0xa6a6('0x5'));var BPromise=require(_0xa6a6('0x6'));var Mustache=require('mustache');var util=require(_0xa6a6('0x7'));var path=require(_0xa6a6('0x8'));var sox=require(_0xa6a6('0x9'));var csv=require('to-csv');var ejs=require(_0xa6a6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa6a6('0xb'));var crypto=require(_0xa6a6('0xc'));var jsforce=require(_0xa6a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa6a6('0xe'));var querystring=require(_0xa6a6('0xf'));var Papa=require('papaparse');var Redis=require(_0xa6a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa6a6('0x11'));var as=require(_0xa6a6('0x12'));var hardwareService=require(_0xa6a6('0x13'));var logger=require(_0xa6a6('0x14'))(_0xa6a6('0x15'));var utils=require(_0xa6a6('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa6a6('0x17'))['db'];var integrations=require(_0xa6a6('0x18'));function respondWithStatusCode(_0x27c21d,_0x2eb451){_0x2eb451=_0x2eb451||0xcc;return function(_0x25e498){if(_0x25e498){return _0x27c21d[_0xa6a6('0x19')](_0x2eb451);}return _0x27c21d[_0xa6a6('0x1a')](_0x2eb451)[_0xa6a6('0x1b')]();};}function respondWithResult(_0x3f8d59,_0x5a2846){_0x5a2846=_0x5a2846||0xc8;return function(_0x3beac5){if(_0x3beac5){return _0x3f8d59[_0xa6a6('0x1a')](_0x5a2846)[_0xa6a6('0x1c')](_0x3beac5);}};}function respondWithFilteredResult(_0x4014aa,_0x4f81b8){return function(_0x397c7c){if(_0x397c7c){var _0xfa8bed=typeof _0x4f81b8[_0xa6a6('0x1d')]===_0xa6a6('0x1e')&&typeof _0x4f81b8[_0xa6a6('0x1f')]===_0xa6a6('0x1e');var _0x47cf20=_0x397c7c[_0xa6a6('0x20')];var _0x205c1a=_0xfa8bed?0x0:_0x4f81b8[_0xa6a6('0x1d')];var _0x3cb8bc=_0xfa8bed?_0x397c7c[_0xa6a6('0x20')]:_0x4f81b8[_0xa6a6('0x1d')]+_0x4f81b8[_0xa6a6('0x1f')];var _0x48667e;if(_0x3cb8bc>=_0x47cf20){_0x3cb8bc=_0x47cf20;_0x48667e=0xc8;}else{_0x48667e=0xce;}_0x4014aa[_0xa6a6('0x1a')](_0x48667e);return _0x4014aa[_0xa6a6('0x21')](_0xa6a6('0x22'),_0x205c1a+'-'+_0x3cb8bc+'/'+_0x47cf20)[_0xa6a6('0x1c')](_0x397c7c);}return null;};}function patchUpdates(_0x241683){return function(_0x14fc71){try{jsonpatch['apply'](_0x14fc71,_0x241683,!![]);}catch(_0x897f2f){return BPromise[_0xa6a6('0x23')](_0x897f2f);}return _0x14fc71['save']();};}function saveUpdates(_0x4b937b,_0x1a8453){return function(_0x42dd4e){if(_0x42dd4e){return _0x42dd4e[_0xa6a6('0x24')](_0x4b937b)['then'](function(_0x4f01aa){return _0x4f01aa;});}return null;};}function removeEntity(_0x3ebab9,_0xb7c72){return function(_0xdfc0b2){if(_0xdfc0b2){return _0xdfc0b2[_0xa6a6('0x25')]()[_0xa6a6('0x26')](function(){_0x3ebab9[_0xa6a6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5119f8,_0x745ab8){return function(_0x5ce78f){if(!_0x5ce78f){_0x5119f8[_0xa6a6('0x19')](0x194);}return _0x5ce78f;};}function handleError(_0x351ef5,_0x38a76d){_0x38a76d=_0x38a76d||0x1f4;return function(_0x5567fe){logger[_0xa6a6('0x27')](_0x5567fe['stack']);if(_0x5567fe[_0xa6a6('0x28')]){delete _0x5567fe[_0xa6a6('0x28')];}_0x351ef5[_0xa6a6('0x1a')](_0x38a76d)[_0xa6a6('0x29')](_0x5567fe);};}exports['index']=function(_0x139cd7,_0x276012){var _0x7e7e09={},_0x424ba5={},_0xe18368={'count':0x0,'rows':[]};var _0x36534e=_[_0xa6a6('0x2a')](db['SugarcrmAccount'][_0xa6a6('0x2b')],function(_0x1ea8c5){return{'name':_0x1ea8c5['fieldName'],'type':_0x1ea8c5['type']['key']};});_0x424ba5['model']=_[_0xa6a6('0x2a')](_0x36534e,'name');_0x424ba5['query']=_[_0xa6a6('0x2c')](_0x139cd7[_0xa6a6('0x2d')]);_0x424ba5[_0xa6a6('0x2e')]=_[_0xa6a6('0x2f')](_0x424ba5[_0xa6a6('0x30')],_0x424ba5[_0xa6a6('0x2d')]);_0x7e7e09[_0xa6a6('0x31')]=_[_0xa6a6('0x2f')](_0x424ba5[_0xa6a6('0x30')],qs[_0xa6a6('0x32')](_0x139cd7[_0xa6a6('0x2d')][_0xa6a6('0x32')]));_0x7e7e09[_0xa6a6('0x31')]=_0x7e7e09[_0xa6a6('0x31')][_0xa6a6('0x33')]?_0x7e7e09[_0xa6a6('0x31')]:_0x424ba5[_0xa6a6('0x30')];if(!_0x139cd7[_0xa6a6('0x2d')][_0xa6a6('0x34')](_0xa6a6('0x35'))){_0x7e7e09[_0xa6a6('0x1f')]=qs['limit'](_0x139cd7['query'][_0xa6a6('0x1f')]);_0x7e7e09['offset']=qs['offset'](_0x139cd7[_0xa6a6('0x2d')][_0xa6a6('0x1d')]);}_0x7e7e09[_0xa6a6('0x36')]=qs[_0xa6a6('0x37')](_0x139cd7['query']['sort']);_0x7e7e09[_0xa6a6('0x38')]=qs[_0xa6a6('0x2e')](_[_0xa6a6('0x39')](_0x139cd7[_0xa6a6('0x2d')],_0x424ba5[_0xa6a6('0x2e')]),_0x36534e);if(_0x139cd7['query'][_0xa6a6('0x3a')]){_0x7e7e09[_0xa6a6('0x38')]=_[_0xa6a6('0x3b')](_0x7e7e09['where'],{'$or':_[_0xa6a6('0x2a')](_0x36534e,function(_0x570012){if(_0x570012['type']!==_0xa6a6('0x3c')){var _0x59fd73={};_0x59fd73[_0x570012['name']]={'$like':'%'+_0x139cd7[_0xa6a6('0x2d')]['filter']+'%'};return _0x59fd73;}})});}_0x7e7e09=_['merge']({},_0x7e7e09,_0x139cd7[_0xa6a6('0x3d')]);var _0x21e292={'where':_0x7e7e09[_0xa6a6('0x38')]};return db['SugarcrmAccount'][_0xa6a6('0x20')](_0x21e292)[_0xa6a6('0x26')](function(_0x2927a4){_0xe18368['count']=_0x2927a4;if(_0x139cd7['query']['includeAll']){_0x7e7e09['include']=[{'all':!![]}];}return db[_0xa6a6('0x3e')][_0xa6a6('0x3f')](_0x7e7e09);})[_0xa6a6('0x26')](function(_0x326e8f){_0xe18368[_0xa6a6('0x40')]=_0x326e8f;return _0xe18368;})[_0xa6a6('0x26')](respondWithFilteredResult(_0x276012,_0x7e7e09))[_0xa6a6('0x41')](handleError(_0x276012,null));};exports[_0xa6a6('0x42')]=function(_0x16d3f2,_0x17cf8d){var _0x154138={'raw':![],'where':{'id':_0x16d3f2[_0xa6a6('0x43')]['id']}},_0xc6a96c={};_0xc6a96c[_0xa6a6('0x30')]=_[_0xa6a6('0x2c')](db[_0xa6a6('0x3e')][_0xa6a6('0x2b')]);_0xc6a96c['query']=_['keys'](_0x16d3f2[_0xa6a6('0x2d')]);_0xc6a96c[_0xa6a6('0x2e')]=_['intersection'](_0xc6a96c[_0xa6a6('0x30')],_0xc6a96c[_0xa6a6('0x2d')]);_0x154138[_0xa6a6('0x31')]=_[_0xa6a6('0x2f')](_0xc6a96c[_0xa6a6('0x30')],qs[_0xa6a6('0x32')](_0x16d3f2[_0xa6a6('0x2d')]['fields']));_0x154138[_0xa6a6('0x31')]=_0x154138[_0xa6a6('0x31')][_0xa6a6('0x33')]?_0x154138[_0xa6a6('0x31')]:_0xc6a96c[_0xa6a6('0x30')];if(_0x16d3f2['query'][_0xa6a6('0x44')]){_0x154138['include']=[{'all':!![]}];}_0x154138=_['merge']({},_0x154138,_0x16d3f2[_0xa6a6('0x3d')]);return db[_0xa6a6('0x3e')]['find'](_0x154138)[_0xa6a6('0x26')](handleEntityNotFound(_0x17cf8d,null))[_0xa6a6('0x26')](respondWithResult(_0x17cf8d,null))[_0xa6a6('0x41')](handleError(_0x17cf8d,null));};exports[_0xa6a6('0x45')]=function(_0x2eb0cb,_0x4c13fd){return db[_0xa6a6('0x3e')][_0xa6a6('0x45')](_0x2eb0cb[_0xa6a6('0x46')],{})[_0xa6a6('0x26')](respondWithResult(_0x4c13fd,0xc9))[_0xa6a6('0x41')](handleError(_0x4c13fd,null));};exports['update']=function(_0x3f5380,_0x129c51){if(_0x3f5380[_0xa6a6('0x46')]['id']){delete _0x3f5380[_0xa6a6('0x46')]['id'];}return db[_0xa6a6('0x3e')][_0xa6a6('0x47')]({'where':{'id':_0x3f5380[_0xa6a6('0x43')]['id']}})['then'](handleEntityNotFound(_0x129c51,null))[_0xa6a6('0x26')](saveUpdates(_0x3f5380[_0xa6a6('0x46')],null))[_0xa6a6('0x26')](respondWithResult(_0x129c51,null))[_0xa6a6('0x41')](handleError(_0x129c51,null));};exports[_0xa6a6('0x25')]=function(_0x5bd02d,_0x3d720c){return db[_0xa6a6('0x3e')]['find']({'where':{'id':_0x5bd02d[_0xa6a6('0x43')]['id']}})[_0xa6a6('0x26')](handleEntityNotFound(_0x3d720c,null))[_0xa6a6('0x26')](removeEntity(_0x3d720c,null))['catch'](handleError(_0x3d720c,null));};exports[_0xa6a6('0x48')]=function(_0x5d77ce,_0x243ae1,_0x4a755e){var _0x5a9318={};var _0x268b84={};var _0x2d9a00;var _0x2e8204;return db[_0xa6a6('0x3e')][_0xa6a6('0x49')]({'where':{'id':_0x5d77ce[_0xa6a6('0x43')]['id']}})[_0xa6a6('0x26')](handleEntityNotFound(_0x243ae1,null))[_0xa6a6('0x26')](function(_0x80c9f8){if(_0x80c9f8){_0x2d9a00=_0x80c9f8;_0x268b84[_0xa6a6('0x30')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x268b84[_0xa6a6('0x2d')]=_[_0xa6a6('0x2c')](_0x5d77ce['query']);_0x268b84['filters']=_[_0xa6a6('0x2f')](_0x268b84[_0xa6a6('0x30')],_0x268b84[_0xa6a6('0x2d')]);_0x5a9318[_0xa6a6('0x31')]=_['intersection'](_0x268b84[_0xa6a6('0x30')],qs[_0xa6a6('0x32')](_0x5d77ce[_0xa6a6('0x2d')][_0xa6a6('0x32')]));_0x5a9318['attributes']=_0x5a9318[_0xa6a6('0x31')][_0xa6a6('0x33')]?_0x5a9318[_0xa6a6('0x31')]:_0x268b84[_0xa6a6('0x30')];_0x5a9318[_0xa6a6('0x36')]=qs[_0xa6a6('0x37')](_0x5d77ce[_0xa6a6('0x2d')][_0xa6a6('0x37')]);_0x5a9318[_0xa6a6('0x38')]=qs[_0xa6a6('0x2e')](_[_0xa6a6('0x39')](_0x5d77ce['query'],_0x268b84[_0xa6a6('0x2e')]));if(_0x5d77ce['query'][_0xa6a6('0x3a')]){_0x5a9318[_0xa6a6('0x38')]=_[_0xa6a6('0x3b')](_0x5a9318[_0xa6a6('0x38')],{'$or':_[_0xa6a6('0x2a')](_0x5a9318[_0xa6a6('0x31')],function(_0x461a51){var _0x5b5e9b={};_0x5b5e9b[_0x461a51]={'$like':'%'+_0x5d77ce[_0xa6a6('0x2d')][_0xa6a6('0x3a')]+'%'};return _0x5b5e9b;})});}_0x5a9318=_['merge']({},_0x5a9318,_0x5d77ce[_0xa6a6('0x3d')]);return _0x2d9a00[_0xa6a6('0x48')](_0x5a9318);}})[_0xa6a6('0x26')](function(_0x18047b){if(_0x18047b){_0x2e8204=_0x18047b['length'];if(!_0x5d77ce[_0xa6a6('0x2d')]['hasOwnProperty']('nolimit')){_0x5a9318[_0xa6a6('0x1f')]=qs[_0xa6a6('0x1f')](_0x5d77ce[_0xa6a6('0x2d')][_0xa6a6('0x1f')]);_0x5a9318[_0xa6a6('0x1d')]=qs[_0xa6a6('0x1d')](_0x5d77ce[_0xa6a6('0x2d')][_0xa6a6('0x1d')]);}return _0x2d9a00[_0xa6a6('0x48')](_0x5a9318);}})[_0xa6a6('0x26')](function(_0x3bc674){if(_0x3bc674){return _0x3bc674?{'count':_0x2e8204,'rows':_0x3bc674}:null;}})[_0xa6a6('0x26')](respondWithResult(_0x243ae1,null))[_0xa6a6('0x41')](handleError(_0x243ae1,null));};exports[_0xa6a6('0x4a')]=function(_0x43b080,_0x255097,_0x39e6c4){if(_0x43b080[_0xa6a6('0x46')]['id']){delete _0x43b080['body']['id'];}return db['SugarcrmAccount'][_0xa6a6('0x49')]({'where':{'id':_0x43b080[_0xa6a6('0x43')]['id']}})['then'](handleEntityNotFound(_0x255097,null))[_0xa6a6('0x26')](function(_0x4e67ea){if(_0x4e67ea){_0x43b080[_0xa6a6('0x46')][_0xa6a6('0x4b')]=_0x4e67ea['id'];_0x43b080['body'][_0xa6a6('0x4c')]=integrations['getSubjects'](_0x43b080[_0xa6a6('0x46')][_0xa6a6('0x4d')],_0x43b080[_0xa6a6('0x46')][_0xa6a6('0x4e')]);_0x43b080[_0xa6a6('0x46')][_0xa6a6('0x4f')]=integrations[_0xa6a6('0x50')](_0x43b080[_0xa6a6('0x46')]['channel'],_0x43b080[_0xa6a6('0x46')][_0xa6a6('0x4e')]);return db[_0xa6a6('0x51')][_0xa6a6('0x45')](_0x43b080[_0xa6a6('0x46')],{'include':[{'model':db[_0xa6a6('0x52')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x255097,null))[_0xa6a6('0x41')](handleError(_0x255097,null));};exports[_0xa6a6('0x53')]=function(_0x427241,_0x26fd09,_0x5a40bd){var _0xd14d4c='';var _0x42d223=['id',_0xa6a6('0x28'),_0xa6a6('0x54'),_0xa6a6('0x55'),_0xa6a6('0x56'),_0xa6a6('0x57'),'duration_hours',_0xa6a6('0x58'),_0xa6a6('0x59'),_0xa6a6('0x5a'),'parent_name',_0xa6a6('0x5b')];return db[_0xa6a6('0x3e')]['findOne']({'where':{'id':_0x427241[_0xa6a6('0x43')]['id']},'attributes':['id',_0xa6a6('0x5c'),_0xa6a6('0x5d'),_0xa6a6('0x5e')]})[_0xa6a6('0x26')](handleEntityNotFound(_0x26fd09,null))[_0xa6a6('0x26')](function(_0x1c41e6){if(_0x1c41e6){_0xd14d4c=_0x1c41e6['remoteUri'];var _0x3a33d1=_0xd14d4c[_0xa6a6('0x5f')](-0x1);if(_0x3a33d1==='/'){_0xd14d4c=_0xd14d4c[_0xa6a6('0x60')](0x0,_0xd14d4c[_0xa6a6('0x61')](_0x3a33d1));}return rp({'method':_0xa6a6('0x62'),'uri':util[_0xa6a6('0x63')](_0xa6a6('0x64'),_0xd14d4c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa6a6('0x65'),'input_type':_0xa6a6('0x66'),'response_type':'JSON','rest_data':JSON[_0xa6a6('0x67')]({'user_auth':{'user_name':_0x1c41e6[_0xa6a6('0x5c')],'password':_0x1c41e6[_0xa6a6('0x5d')],'encryption':_0xa6a6('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xa6a6('0x26')](function(_0x4930e4){if(_0x4930e4&&_0x4930e4['name']!=='Invalid\x20Login'&&_0x4930e4['name']!==_0xa6a6('0x69')){return rp({'method':_0xa6a6('0x62'),'uri':util[_0xa6a6('0x63')](_0xa6a6('0x64'),_0xd14d4c,_0xa6a6('0x6a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xa6a6('0x66'),'response_type':_0xa6a6('0x66'),'rest_data':JSON[_0xa6a6('0x67')]({'session':_0x4930e4['id'],'module_name':_0xa6a6('0x6b')})}})['then'](function(_0x4f31d2){if(_0x4f31d2){var _0x3ace7a=_[_0xa6a6('0x6c')](_0x4f31d2['module_fields']);_[_0xa6a6('0x6d')](_0x3ace7a,function(_0x3193b9){return _0x42d223[_0xa6a6('0x6e')](_0x3193b9['name']);});return{'count':_0x3ace7a[_0xa6a6('0x33')],'rows':_[_0xa6a6('0x2a')](_0x3ace7a,function(_0x7365d8){return{'id':_0x7365d8[_0xa6a6('0x28')],'name':_0x7365d8[_0xa6a6('0x6f')],'custom':_[_0xa6a6('0x70')](_0x7365d8[_0xa6a6('0x28')],'_c')?!![]:![],'options':_0x7365d8['options']?_[_0xa6a6('0x2a')](_[_0xa6a6('0x6c')](_0x7365d8[_0xa6a6('0x3d')]),function(_0x208b98){return{'name':_0x208b98[_0xa6a6('0x71')],'value':_0x208b98[_0xa6a6('0x28')]};}):[]};})};}})[_0xa6a6('0x26')](respondWithResult(_0x26fd09,null))[_0xa6a6('0x41')](function(_0x51b2f2){var _0x380c95=_0x427241[_0xa6a6('0x2d')]['test']?0x1f4:_0x51b2f2[_0xa6a6('0x72')]||0x1f4;logger[_0xa6a6('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xa6a6('0x53'),_0x380c95,JSON[_0xa6a6('0x67')](_0x51b2f2));delete _0x51b2f2[_0xa6a6('0x28')];if(_0x380c95===0x191){_0x380c95=0x190;}_0x26fd09[_0xa6a6('0x1a')](_0x380c95)[_0xa6a6('0x29')](_0x427241['query'][_0xa6a6('0x73')]?{'message':_0xa6a6('0x74'),'statusCode':_0x51b2f2[_0xa6a6('0x72')]}:_0x51b2f2);});}else{var _0x28e0a9=0x1f4;_0x26fd09[_0xa6a6('0x1a')](_0x28e0a9)[_0xa6a6('0x29')]({'message':_0xa6a6('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfeb3=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','rawAttributes','intersection','fields','includeAll','find','create','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','includes','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','destroy','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters'];(function(_0x30abcb,_0x397710){var _0x1af9c3=function(_0x183453){while(--_0x183453){_0x30abcb['push'](_0x30abcb['shift']());}};_0x1af9c3(++_0x397710);}(_0xfeb3,0x19b));var _0x3feb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfeb3[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x3feb('0x0'));var rimraf=require(_0x3feb('0x1'));var zipdir=require(_0x3feb('0x2'));var jsonpatch=require(_0x3feb('0x3'));var rp=require(_0x3feb('0x4'));var moment=require('moment');var BPromise=require(_0x3feb('0x5'));var Mustache=require(_0x3feb('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3feb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3feb('0x8'));var _=require(_0x3feb('0x9'));var squel=require(_0x3feb('0xa'));var crypto=require(_0x3feb('0xb'));var jsforce=require(_0x3feb('0xc'));var deskjs=require(_0x3feb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3feb('0xe'));var Papa=require('papaparse');var Redis=require(_0x3feb('0xf'));var authService=require(_0x3feb('0x10'));var qs=require(_0x3feb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3feb('0x12'));var logger=require('../../config/logger')(_0x3feb('0x13'));var utils=require('../../config/utils');var config=require(_0x3feb('0x14'));var licenseUtil=require(_0x3feb('0x15'));var db=require(_0x3feb('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a498f,_0x1aa2fc){_0x1aa2fc=_0x1aa2fc||0xcc;return function(_0x202dae){if(_0x202dae){return _0x1a498f[_0x3feb('0x17')](_0x1aa2fc);}return _0x1a498f['status'](_0x1aa2fc)[_0x3feb('0x18')]();};}function respondWithResult(_0x32292d,_0x552bad){_0x552bad=_0x552bad||0xc8;return function(_0xcc9030){if(_0xcc9030){return _0x32292d[_0x3feb('0x19')](_0x552bad)[_0x3feb('0x1a')](_0xcc9030);}};}function respondWithFilteredResult(_0xf95d50,_0x45024d){return function(_0x1c1ee4){if(_0x1c1ee4){var _0x5214b1=typeof _0x45024d[_0x3feb('0x1b')]===_0x3feb('0x1c')&&typeof _0x45024d[_0x3feb('0x1d')]===_0x3feb('0x1c');var _0x47fdc9=_0x1c1ee4[_0x3feb('0x1e')];var _0x1e1e32=_0x5214b1?0x0:_0x45024d[_0x3feb('0x1b')];var _0x491393=_0x5214b1?_0x1c1ee4['count']:_0x45024d[_0x3feb('0x1b')]+_0x45024d[_0x3feb('0x1d')];var _0x5bfc80;if(_0x491393>=_0x47fdc9){_0x491393=_0x47fdc9;_0x5bfc80=0xc8;}else{_0x5bfc80=0xce;}_0xf95d50['status'](_0x5bfc80);return _0xf95d50['set']('Content-Range',_0x1e1e32+'-'+_0x491393+'/'+_0x47fdc9)[_0x3feb('0x1a')](_0x1c1ee4);}return null;};}function patchUpdates(_0x48d2d7){return function(_0x2fdf75){try{jsonpatch['apply'](_0x2fdf75,_0x48d2d7,!![]);}catch(_0x316998){return BPromise[_0x3feb('0x1f')](_0x316998);}return _0x2fdf75[_0x3feb('0x20')]();};}function saveUpdates(_0x24c2c3,_0x41d6bb){return function(_0x3f0282){if(_0x3f0282){return _0x3f0282[_0x3feb('0x21')](_0x24c2c3)['then'](function(_0x232b19){return _0x232b19;});}return null;};}function removeEntity(_0x4fc528,_0x47e570){return function(_0x3875c0){if(_0x3875c0){return _0x3875c0[_0x3feb('0x22')]()['then'](function(){_0x4fc528['status'](0xcc)[_0x3feb('0x18')]();});}};}function handleEntityNotFound(_0x25403d,_0x4ccb92){return function(_0x4b30b3){if(!_0x4b30b3){_0x25403d[_0x3feb('0x17')](0x194);}return _0x4b30b3;};}function handleError(_0x2c5f1b,_0x2f36d0){_0x2f36d0=_0x2f36d0||0x1f4;return function(_0x415589){logger[_0x3feb('0x23')](_0x415589[_0x3feb('0x24')]);if(_0x415589[_0x3feb('0x25')]){delete _0x415589['name'];}_0x2c5f1b[_0x3feb('0x19')](_0x2f36d0)[_0x3feb('0x26')](_0x415589);};}exports[_0x3feb('0x27')]=function(_0xabde7b,_0xe92ea0){var _0x598533={},_0x558674={},_0x178b3d={'count':0x0,'rows':[]};var _0x18c190=_[_0x3feb('0x28')](db[_0x3feb('0x29')]['rawAttributes'],function(_0x49b56a){return{'name':_0x49b56a[_0x3feb('0x2a')],'type':_0x49b56a[_0x3feb('0x2b')][_0x3feb('0x2c')]};});_0x558674[_0x3feb('0x2d')]=_[_0x3feb('0x28')](_0x18c190,'name');_0x558674[_0x3feb('0x2e')]=_[_0x3feb('0x2f')](_0xabde7b['query']);_0x558674[_0x3feb('0x30')]=_['intersection'](_0x558674[_0x3feb('0x2d')],_0x558674[_0x3feb('0x2e')]);_0x598533[_0x3feb('0x31')]=_['intersection'](_0x558674[_0x3feb('0x2d')],qs['fields'](_0xabde7b[_0x3feb('0x2e')]['fields']));_0x598533[_0x3feb('0x31')]=_0x598533['attributes'][_0x3feb('0x32')]?_0x598533[_0x3feb('0x31')]:_0x558674[_0x3feb('0x2d')];if(!_0xabde7b[_0x3feb('0x2e')][_0x3feb('0x33')](_0x3feb('0x34'))){_0x598533[_0x3feb('0x1d')]=qs[_0x3feb('0x1d')](_0xabde7b[_0x3feb('0x2e')][_0x3feb('0x1d')]);_0x598533['offset']=qs[_0x3feb('0x1b')](_0xabde7b['query'][_0x3feb('0x1b')]);}_0x598533[_0x3feb('0x35')]=qs[_0x3feb('0x36')](_0xabde7b[_0x3feb('0x2e')][_0x3feb('0x36')]);_0x598533[_0x3feb('0x37')]=qs[_0x3feb('0x30')](_[_0x3feb('0x38')](_0xabde7b['query'],_0x558674['filters']),_0x18c190);if(_0xabde7b[_0x3feb('0x2e')][_0x3feb('0x39')]){_0x598533[_0x3feb('0x37')]=_[_0x3feb('0x3a')](_0x598533[_0x3feb('0x37')],{'$or':_[_0x3feb('0x28')](_0x18c190,function(_0x404534){if(_0x404534[_0x3feb('0x2b')]!==_0x3feb('0x3b')){var _0x4e72d6={};_0x4e72d6[_0x404534['name']]={'$like':'%'+_0xabde7b[_0x3feb('0x2e')][_0x3feb('0x39')]+'%'};return _0x4e72d6;}})});}_0x598533=_[_0x3feb('0x3a')]({},_0x598533,_0xabde7b[_0x3feb('0x3c')]);var _0x2b71ad={'where':_0x598533[_0x3feb('0x37')]};return db[_0x3feb('0x29')][_0x3feb('0x1e')](_0x2b71ad)[_0x3feb('0x3d')](function(_0x276d02){_0x178b3d[_0x3feb('0x1e')]=_0x276d02;if(_0xabde7b[_0x3feb('0x2e')]['includeAll']){_0x598533[_0x3feb('0x3e')]=[{'all':!![]}];}return db[_0x3feb('0x29')][_0x3feb('0x3f')](_0x598533);})[_0x3feb('0x3d')](function(_0x6467d4){_0x178b3d[_0x3feb('0x40')]=_0x6467d4;return _0x178b3d;})[_0x3feb('0x3d')](respondWithFilteredResult(_0xe92ea0,_0x598533))[_0x3feb('0x41')](handleError(_0xe92ea0,null));};exports['show']=function(_0x3488c9,_0x367efe){var _0x3e0c53={'raw':![],'where':{'id':_0x3488c9[_0x3feb('0x42')]['id']}},_0x4aba5d={};_0x4aba5d[_0x3feb('0x2d')]=_[_0x3feb('0x2f')](db[_0x3feb('0x29')][_0x3feb('0x43')]);_0x4aba5d[_0x3feb('0x2e')]=_[_0x3feb('0x2f')](_0x3488c9[_0x3feb('0x2e')]);_0x4aba5d[_0x3feb('0x30')]=_[_0x3feb('0x44')](_0x4aba5d['model'],_0x4aba5d[_0x3feb('0x2e')]);_0x3e0c53[_0x3feb('0x31')]=_[_0x3feb('0x44')](_0x4aba5d[_0x3feb('0x2d')],qs[_0x3feb('0x45')](_0x3488c9[_0x3feb('0x2e')][_0x3feb('0x45')]));_0x3e0c53['attributes']=_0x3e0c53[_0x3feb('0x31')][_0x3feb('0x32')]?_0x3e0c53['attributes']:_0x4aba5d[_0x3feb('0x2d')];if(_0x3488c9['query'][_0x3feb('0x46')]){_0x3e0c53[_0x3feb('0x3e')]=[{'all':!![]}];}_0x3e0c53=_[_0x3feb('0x3a')]({},_0x3e0c53,_0x3488c9[_0x3feb('0x3c')]);return db[_0x3feb('0x29')][_0x3feb('0x47')](_0x3e0c53)[_0x3feb('0x3d')](handleEntityNotFound(_0x367efe,null))[_0x3feb('0x3d')](respondWithResult(_0x367efe,null))[_0x3feb('0x41')](handleError(_0x367efe,null));};exports[_0x3feb('0x48')]=function(_0x1a5d0c,_0x59afbf){return db['SugarcrmAccount']['create'](_0x1a5d0c['body'],{})[_0x3feb('0x3d')](respondWithResult(_0x59afbf,0xc9))['catch'](handleError(_0x59afbf,null));};exports[_0x3feb('0x21')]=function(_0x3cde26,_0xb01dc6){if(_0x3cde26[_0x3feb('0x49')]['id']){delete _0x3cde26[_0x3feb('0x49')]['id'];}return db[_0x3feb('0x29')][_0x3feb('0x47')]({'where':{'id':_0x3cde26[_0x3feb('0x42')]['id']}})[_0x3feb('0x3d')](handleEntityNotFound(_0xb01dc6,null))[_0x3feb('0x3d')](saveUpdates(_0x3cde26[_0x3feb('0x49')],null))['then'](respondWithResult(_0xb01dc6,null))[_0x3feb('0x41')](handleError(_0xb01dc6,null));};exports[_0x3feb('0x22')]=function(_0x1ca519,_0x2f5109){return db[_0x3feb('0x29')][_0x3feb('0x47')]({'where':{'id':_0x1ca519[_0x3feb('0x42')]['id']}})[_0x3feb('0x3d')](handleEntityNotFound(_0x2f5109,null))['then'](removeEntity(_0x2f5109,null))[_0x3feb('0x41')](handleError(_0x2f5109,null));};exports[_0x3feb('0x4a')]=function(_0x1eb0b2,_0x1f75b3,_0x11da2a){var _0x4ccab4={};var _0x4e6ed6={};var _0x487419;var _0x2dd7ad;return db[_0x3feb('0x29')]['findOne']({'where':{'id':_0x1eb0b2[_0x3feb('0x42')]['id']}})[_0x3feb('0x3d')](handleEntityNotFound(_0x1f75b3,null))[_0x3feb('0x3d')](function(_0x573c22){if(_0x573c22){_0x487419=_0x573c22;_0x4e6ed6[_0x3feb('0x2d')]=_[_0x3feb('0x2f')](db[_0x3feb('0x4b')][_0x3feb('0x43')]);_0x4e6ed6['query']=_['keys'](_0x1eb0b2[_0x3feb('0x2e')]);_0x4e6ed6[_0x3feb('0x30')]=_['intersection'](_0x4e6ed6[_0x3feb('0x2d')],_0x4e6ed6[_0x3feb('0x2e')]);_0x4ccab4[_0x3feb('0x31')]=_[_0x3feb('0x44')](_0x4e6ed6[_0x3feb('0x2d')],qs[_0x3feb('0x45')](_0x1eb0b2['query'][_0x3feb('0x45')]));_0x4ccab4[_0x3feb('0x31')]=_0x4ccab4[_0x3feb('0x31')]['length']?_0x4ccab4[_0x3feb('0x31')]:_0x4e6ed6[_0x3feb('0x2d')];_0x4ccab4['order']=qs[_0x3feb('0x36')](_0x1eb0b2[_0x3feb('0x2e')][_0x3feb('0x36')]);_0x4ccab4[_0x3feb('0x37')]=qs[_0x3feb('0x30')](_[_0x3feb('0x38')](_0x1eb0b2[_0x3feb('0x2e')],_0x4e6ed6[_0x3feb('0x30')]));if(_0x1eb0b2[_0x3feb('0x2e')][_0x3feb('0x39')]){_0x4ccab4[_0x3feb('0x37')]=_[_0x3feb('0x3a')](_0x4ccab4[_0x3feb('0x37')],{'$or':_['map'](_0x4ccab4[_0x3feb('0x31')],function(_0x406014){var _0xd2612b={};_0xd2612b[_0x406014]={'$like':'%'+_0x1eb0b2[_0x3feb('0x2e')]['filter']+'%'};return _0xd2612b;})});}_0x4ccab4=_[_0x3feb('0x3a')]({},_0x4ccab4,_0x1eb0b2[_0x3feb('0x3c')]);return _0x487419[_0x3feb('0x4a')](_0x4ccab4);}})['then'](function(_0x423f27){if(_0x423f27){_0x2dd7ad=_0x423f27[_0x3feb('0x32')];if(!_0x1eb0b2[_0x3feb('0x2e')][_0x3feb('0x33')](_0x3feb('0x34'))){_0x4ccab4['limit']=qs[_0x3feb('0x1d')](_0x1eb0b2[_0x3feb('0x2e')][_0x3feb('0x1d')]);_0x4ccab4[_0x3feb('0x1b')]=qs['offset'](_0x1eb0b2['query']['offset']);}return _0x487419[_0x3feb('0x4a')](_0x4ccab4);}})['then'](function(_0x4e6e5c){if(_0x4e6e5c){return _0x4e6e5c?{'count':_0x2dd7ad,'rows':_0x4e6e5c}:null;}})[_0x3feb('0x3d')](respondWithResult(_0x1f75b3,null))['catch'](handleError(_0x1f75b3,null));};exports[_0x3feb('0x4c')]=function(_0x29aff8,_0xd0c91,_0x50eb0a){if(_0x29aff8['body']['id']){delete _0x29aff8[_0x3feb('0x49')]['id'];}return db['SugarcrmAccount'][_0x3feb('0x4d')]({'where':{'id':_0x29aff8[_0x3feb('0x42')]['id']}})[_0x3feb('0x3d')](handleEntityNotFound(_0xd0c91,null))[_0x3feb('0x3d')](function(_0x3c17bf){if(_0x3c17bf){_0x29aff8[_0x3feb('0x49')]['AccountId']=_0x3c17bf['id'];_0x29aff8[_0x3feb('0x49')][_0x3feb('0x4e')]=integrations['getSubjects'](_0x29aff8[_0x3feb('0x49')][_0x3feb('0x4f')],_0x29aff8['body'][_0x3feb('0x2b')]);_0x29aff8[_0x3feb('0x49')]['Descriptions']=integrations[_0x3feb('0x50')](_0x29aff8[_0x3feb('0x49')][_0x3feb('0x4f')],_0x29aff8[_0x3feb('0x49')][_0x3feb('0x2b')]);return db[_0x3feb('0x4b')][_0x3feb('0x48')](_0x29aff8[_0x3feb('0x49')],{'include':[{'model':db[_0x3feb('0x51')],'as':_0x3feb('0x4e')},{'model':db[_0x3feb('0x51')],'as':_0x3feb('0x52')}]});}return null;})['then'](respondWithResult(_0xd0c91,null))[_0x3feb('0x41')](handleError(_0xd0c91,null));};exports[_0x3feb('0x53')]=function(_0x88027c,_0x4c663e,_0x21c12a){var _0x3f34f0='';var _0xfef98d=['id','name',_0x3feb('0x54'),_0x3feb('0x55'),_0x3feb('0x56'),_0x3feb('0x57'),'duration_hours',_0x3feb('0x58'),'parent_id',_0x3feb('0x59'),_0x3feb('0x5a'),'direction'];return db['SugarcrmAccount'][_0x3feb('0x4d')]({'where':{'id':_0x88027c[_0x3feb('0x42')]['id']},'attributes':['id',_0x3feb('0x5b'),_0x3feb('0x5c'),_0x3feb('0x5d')]})[_0x3feb('0x3d')](handleEntityNotFound(_0x4c663e,null))[_0x3feb('0x3d')](function(_0x3d1c24){if(_0x3d1c24){_0x3f34f0=_0x3d1c24['remoteUri'];var _0x40e7b1=_0x3f34f0[_0x3feb('0x5e')](-0x1);if(_0x40e7b1==='/'){_0x3f34f0=_0x3f34f0[_0x3feb('0x5f')](0x0,_0x3f34f0['lastIndexOf'](_0x40e7b1));}return rp({'method':_0x3feb('0x60'),'uri':util[_0x3feb('0x61')](_0x3feb('0x62'),_0x3f34f0,_0x3feb('0x63')),'json':!![],'form':{'method':_0x3feb('0x64'),'input_type':_0x3feb('0x65'),'response_type':'JSON','rest_data':JSON[_0x3feb('0x66')]({'user_auth':{'user_name':_0x3d1c24[_0x3feb('0x5b')],'password':_0x3d1c24['password'],'encryption':_0x3feb('0x67')},'application':_0x3feb('0x68')})}});}})[_0x3feb('0x3d')](function(_0x274180){if(_0x274180&&_0x274180['name']!==_0x3feb('0x69')&&_0x274180[_0x3feb('0x25')]!==_0x3feb('0x6a')){return rp({'method':_0x3feb('0x60'),'uri':util[_0x3feb('0x61')]('%s%s',_0x3f34f0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x3feb('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x274180['id'],'module_name':_0x3feb('0x6b')})}})['then'](function(_0x53c6db){if(_0x53c6db){var _0x228967=_['values'](_0x53c6db[_0x3feb('0x6c')]);_['remove'](_0x228967,function(_0x333340){return _0xfef98d[_0x3feb('0x6d')](_0x333340[_0x3feb('0x25')]);});return{'count':_0x228967[_0x3feb('0x32')],'rows':_[_0x3feb('0x28')](_0x228967,function(_0x41587d){return{'id':_0x41587d[_0x3feb('0x25')],'name':_0x41587d['label'],'custom':_['endsWith'](_0x41587d[_0x3feb('0x25')],'_c')?!![]:![],'options':_0x41587d['options']?_[_0x3feb('0x28')](_['values'](_0x41587d[_0x3feb('0x3c')]),function(_0x2e0a39){return{'name':_0x2e0a39[_0x3feb('0x6e')],'value':_0x2e0a39[_0x3feb('0x25')]};}):[]};})};}})['then'](respondWithResult(_0x4c663e,null))[_0x3feb('0x41')](function(_0x9e848e){var _0x2f763f=_0x88027c[_0x3feb('0x2e')][_0x3feb('0x6f')]?0x1f4:_0x9e848e[_0x3feb('0x70')]||0x1f4;logger[_0x3feb('0x23')](_0x3feb('0x71'),'getFields',_0x2f763f,JSON[_0x3feb('0x66')](_0x9e848e));delete _0x9e848e[_0x3feb('0x25')];if(_0x2f763f===0x191){_0x2f763f=0x190;}_0x4c663e[_0x3feb('0x19')](_0x2f763f)[_0x3feb('0x26')](_0x88027c['query'][_0x3feb('0x6f')]?{'message':_0x3feb('0x72'),'statusCode':_0x9e848e[_0x3feb('0x70')]}:_0x9e848e);});}else{var _0x29828a=0x1f4;_0x4c663e[_0x3feb('0x19')](_0x29828a)['send']({'message':_0x3feb('0x72'),'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 ba848ee..de4434f 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 _0xae6c=['define','SugarcrmAccount','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x2b4f10,_0x4f92fa){var _0x1b0fcb=function(_0x477fd3){while(--_0x477fd3){_0x2b4f10['push'](_0x2b4f10['shift']());}};_0x1b0fcb(++_0x4f92fa);}(_0xae6c,0x7a));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcae6('0x0'));var util=require('util');var logger=require(_0xcae6('0x1'))(_0xcae6('0x2'));var moment=require(_0xcae6('0x3'));var BPromise=require(_0xcae6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcae6('0x5'));var rimraf=require('rimraf');var config=require(_0xcae6('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xcae6('0x7')]=function(_0x54ec58,_0x32337b){return _0x54ec58[_0xcae6('0x8')](_0xcae6('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0da=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x5964c6,_0x4fe4fd){var _0x5f4e4b=function(_0x159412){while(--_0x159412){_0x5964c6['push'](_0x5964c6['shift']());}};_0x5f4e4b(++_0x4fe4fd);}(_0xd0da,0x1b1));var _0xad0d=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0xd0da[_0x421196];return _0x2738af;};'use strict';var _=require(_0xad0d('0x0'));var util=require(_0xad0d('0x1'));var logger=require(_0xad0d('0x2'))(_0xad0d('0x3'));var moment=require(_0xad0d('0x4'));var BPromise=require('bluebird');var rp=require(_0xad0d('0x5'));var fs=require('fs');var path=require(_0xad0d('0x6'));var rimraf=require(_0xad0d('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xad0d('0x8'));module['exports']=function(_0x5cfc7d,_0xc14f42){return _0x5cfc7d[_0xad0d('0x9')](_0xad0d('0xa'),attributes,{'tableName':_0xad0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 9ef36d4..57451b5 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 _0x631e=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3c98ad,_0x2912bb){var _0x468c11=function(_0x543c38){while(--_0x543c38){_0x3c98ad['push'](_0x3c98ad['shift']());}};_0x468c11(++_0x2912bb);}(_0x631e,0x9f));var _0xe631=function(_0x4b8241,_0x1ccd07){_0x4b8241=_0x4b8241-0x0;var _0x530cb4=_0x631e[_0x4b8241];return _0x530cb4;};'use strict';var _=require(_0xe631('0x0'));var util=require(_0xe631('0x1'));var moment=require(_0xe631('0x2'));var BPromise=require(_0xe631('0x3'));var rs=require(_0xe631('0x4'));var fs=require('fs');var Redis=require(_0xe631('0x5'));var db=require(_0xe631('0x6'))['db'];var utils=require(_0xe631('0x7'));var logger=require('../../config/logger')(_0xe631('0x8'));var config=require('../../config/environment');var jayson=require(_0xe631('0x9'));var client=jayson[_0xe631('0xa')][_0xe631('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563fcc,_0x39565c,_0x3ddf2a){return new BPromise(function(_0x47d2e4,_0x33298f){return client[_0xe631('0xc')](_0x563fcc,_0x3ddf2a)['then'](function(_0x386ab6){logger[_0xe631('0xd')](_0xe631('0xe'),_0x39565c,_0xe631('0xf'));logger[_0xe631('0x10')](_0xe631('0x11'),_0x39565c,_0xe631('0xf'),JSON[_0xe631('0x12')](_0x386ab6));if(_0x386ab6[_0xe631('0x13')]){if(_0x386ab6['error']['code']===0x1f4){logger[_0xe631('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x39565c,_0x386ab6['error']['message']);return _0x33298f(_0x386ab6[_0xe631('0x13')][_0xe631('0x14')]);}logger[_0xe631('0x13')](_0xe631('0xe'),_0x39565c,_0x386ab6[_0xe631('0x13')][_0xe631('0x14')]);return _0x47d2e4(_0x386ab6['error'][_0xe631('0x14')]);}else{logger[_0xe631('0xd')](_0xe631('0xe'),_0x39565c,'request\x20sent');_0x47d2e4(_0x386ab6[_0xe631('0x15')]['message']);}})[_0xe631('0x16')](function(_0x31c533){logger[_0xe631('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x39565c,_0x31c533);_0x33298f(_0x31c533);});});}exports[_0xe631('0x17')]=function(_0x34381d){var _0x256b8a=this;return new Promise(function(_0x4e9c7c,_0x1ad422){return db[_0xe631('0x18')][_0xe631('0x19')]({'raw':_0x34381d[_0xe631('0x1a')]?_0x34381d[_0xe631('0x1a')][_0xe631('0x1b')]===undefined?!![]:![]:!![],'where':_0x34381d['options']?_0x34381d[_0xe631('0x1a')][_0xe631('0x1c')]||null:null,'attributes':_0x34381d[_0xe631('0x1a')]?_0x34381d[_0xe631('0x1a')][_0xe631('0x1d')]||null:null,'limit':_0x34381d[_0xe631('0x1a')]?_0x34381d['options'][_0xe631('0x1e')]||null:null,'include':_0x34381d['options']?_0x34381d[_0xe631('0x1a')]['include']?_[_0xe631('0x1f')](_0x34381d[_0xe631('0x1a')][_0xe631('0x20')],function(_0x473527){return{'model':db[_0x473527[_0xe631('0x21')]],'as':_0x473527['as'],'attributes':_0x473527[_0xe631('0x1d')],'include':_0x473527[_0xe631('0x20')]?_[_0xe631('0x1f')](_0x473527['include'],function(_0x289c69){return{'model':db[_0x289c69[_0xe631('0x21')]],'as':_0x289c69['as'],'attributes':_0x289c69[_0xe631('0x1d')],'include':_0x289c69['include']?_[_0xe631('0x1f')](_0x289c69['include'],function(_0x4288ee){return{'model':db[_0x4288ee[_0xe631('0x21')]],'as':_0x4288ee['as'],'attributes':_0x4288ee[_0xe631('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11bad6){logger[_0xe631('0xd')]('GetSugarcrmAccount',_0x34381d);logger[_0xe631('0x10')](_0xe631('0x17'),_0x34381d,JSON['stringify'](_0x11bad6));_0x4e9c7c(_0x11bad6);})[_0xe631('0x16')](function(_0x46606b){logger[_0xe631('0x13')](_0xe631('0x17'),_0x46606b[_0xe631('0x14')],_0x34381d);_0x1ad422(_0x256b8a[_0xe631('0x13')](0x1f4,_0x46606b[_0xe631('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x5c24f6){var _0x4e7df3=this;return new Promise(function(_0x26d999,_0xcc6be9){return db[_0xe631('0x18')]['find']({'raw':_0x5c24f6[_0xe631('0x1a')]?_0x5c24f6[_0xe631('0x1a')][_0xe631('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c24f6[_0xe631('0x1a')]?_0x5c24f6[_0xe631('0x1a')][_0xe631('0x1c')]||null:null,'attributes':_0x5c24f6[_0xe631('0x1a')]?_0x5c24f6[_0xe631('0x1a')][_0xe631('0x1d')]||null:null,'include':_0x5c24f6[_0xe631('0x1a')]?_0x5c24f6['options'][_0xe631('0x20')]?_[_0xe631('0x1f')](_0x5c24f6[_0xe631('0x1a')]['include'],function(_0x34890d){return{'model':db[_0x34890d['model']],'as':_0x34890d['as'],'attributes':_0x34890d['attributes'],'include':_0x34890d['include']?_['map'](_0x34890d[_0xe631('0x20')],function(_0x4a56cc){return{'model':db[_0x4a56cc['model']],'as':_0x4a56cc['as'],'attributes':_0x4a56cc[_0xe631('0x1d')],'include':_0x4a56cc[_0xe631('0x20')]?_[_0xe631('0x1f')](_0x4a56cc['include'],function(_0x1f2a01){return{'model':db[_0x1f2a01[_0xe631('0x21')]],'as':_0x1f2a01['as'],'attributes':_0x1f2a01[_0xe631('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe631('0x22')](function(_0x5e0889){logger[_0xe631('0xd')](_0xe631('0x23'),_0x5c24f6);logger[_0xe631('0x10')](_0xe631('0x23'),_0x5c24f6,JSON[_0xe631('0x12')](_0x5e0889));_0x26d999(_0x5e0889);})['catch'](function(_0x2a1543){logger[_0xe631('0x13')](_0xe631('0x23'),_0x2a1543[_0xe631('0x14')],_0x5c24f6);_0xcc6be9(_0x4e7df3[_0xe631('0x13')](0x1f4,_0x2a1543[_0xe631('0x14')]));});});}; \ No newline at end of file +var _0xdedf=['GetSugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowSugarcrmAccount','find','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1a1460,_0x539531){var _0x33ab03=function(_0x26a04b){while(--_0x26a04b){_0x1a1460['push'](_0x1a1460['shift']());}};_0x33ab03(++_0x539531);}(_0xdedf,0x1e9));var _0xfded=function(_0x58e302,_0x1bb64a){_0x58e302=_0x58e302-0x0;var _0x17306b=_0xdedf[_0x58e302];return _0x17306b;};'use strict';var _=require('lodash');var util=require(_0xfded('0x0'));var moment=require(_0xfded('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfded('0x2'));var db=require(_0xfded('0x3'))['db'];var utils=require(_0xfded('0x4'));var logger=require(_0xfded('0x5'))(_0xfded('0x6'));var config=require(_0xfded('0x7'));var jayson=require(_0xfded('0x8'));var client=jayson['client'][_0xfded('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f81f,_0x5acc67,_0x18b8ca){return new BPromise(function(_0x3f0374,_0x5d31f4){return client[_0xfded('0xa')](_0x33f81f,_0x18b8ca)[_0xfded('0xb')](function(_0x2e1e1f){logger[_0xfded('0xc')](_0xfded('0xd'),_0x5acc67,_0xfded('0xe'));logger[_0xfded('0xf')](_0xfded('0x10'),_0x5acc67,'request\x20sent',JSON['stringify'](_0x2e1e1f));if(_0x2e1e1f[_0xfded('0x11')]){if(_0x2e1e1f[_0xfded('0x11')][_0xfded('0x12')]===0x1f4){logger[_0xfded('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x5acc67,_0x2e1e1f[_0xfded('0x11')][_0xfded('0x13')]);return _0x5d31f4(_0x2e1e1f['error']['message']);}logger['error'](_0xfded('0xd'),_0x5acc67,_0x2e1e1f[_0xfded('0x11')][_0xfded('0x13')]);return _0x3f0374(_0x2e1e1f[_0xfded('0x11')][_0xfded('0x13')]);}else{logger[_0xfded('0xc')](_0xfded('0xd'),_0x5acc67,_0xfded('0xe'));_0x3f0374(_0x2e1e1f[_0xfded('0x14')][_0xfded('0x13')]);}})['catch'](function(_0x234795){logger['error'](_0xfded('0xd'),_0x5acc67,_0x234795);_0x5d31f4(_0x234795);});});}exports[_0xfded('0x15')]=function(_0x31c43a){var _0x445e3a=this;return new Promise(function(_0x56e690,_0x129d40){return db['SugarcrmAccount'][_0xfded('0x16')]({'raw':_0x31c43a['options']?_0x31c43a[_0xfded('0x17')][_0xfded('0x18')]===undefined?!![]:![]:!![],'where':_0x31c43a[_0xfded('0x17')]?_0x31c43a['options'][_0xfded('0x19')]||null:null,'attributes':_0x31c43a[_0xfded('0x17')]?_0x31c43a[_0xfded('0x17')][_0xfded('0x1a')]||null:null,'limit':_0x31c43a[_0xfded('0x17')]?_0x31c43a[_0xfded('0x17')]['limit']||null:null,'include':_0x31c43a[_0xfded('0x17')]?_0x31c43a['options'][_0xfded('0x1b')]?_[_0xfded('0x1c')](_0x31c43a[_0xfded('0x17')][_0xfded('0x1b')],function(_0x5d50b7){return{'model':db[_0x5d50b7[_0xfded('0x1d')]],'as':_0x5d50b7['as'],'attributes':_0x5d50b7[_0xfded('0x1a')],'include':_0x5d50b7[_0xfded('0x1b')]?_[_0xfded('0x1c')](_0x5d50b7[_0xfded('0x1b')],function(_0x558cfb){return{'model':db[_0x558cfb[_0xfded('0x1d')]],'as':_0x558cfb['as'],'attributes':_0x558cfb['attributes'],'include':_0x558cfb[_0xfded('0x1b')]?_['map'](_0x558cfb[_0xfded('0x1b')],function(_0x557980){return{'model':db[_0x557980[_0xfded('0x1d')]],'as':_0x557980['as'],'attributes':_0x557980[_0xfded('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfded('0xb')](function(_0x1c9368){logger[_0xfded('0xc')](_0xfded('0x15'),_0x31c43a);logger['debug'](_0xfded('0x15'),_0x31c43a,JSON['stringify'](_0x1c9368));_0x56e690(_0x1c9368);})[_0xfded('0x1e')](function(_0xd2e804){logger[_0xfded('0x11')]('GetSugarcrmAccount',_0xd2e804[_0xfded('0x13')],_0x31c43a);_0x129d40(_0x445e3a[_0xfded('0x11')](0x1f4,_0xd2e804[_0xfded('0x13')]));});});};exports[_0xfded('0x1f')]=function(_0x1e73a2){var _0x41b4bb=this;return new Promise(function(_0x54c98f,_0x50d57d){return db['SugarcrmAccount'][_0xfded('0x20')]({'raw':_0x1e73a2[_0xfded('0x17')]?_0x1e73a2[_0xfded('0x17')][_0xfded('0x18')]===undefined?!![]:![]:!![],'where':_0x1e73a2[_0xfded('0x17')]?_0x1e73a2[_0xfded('0x17')]['where']||null:null,'attributes':_0x1e73a2[_0xfded('0x17')]?_0x1e73a2[_0xfded('0x17')]['attributes']||null:null,'include':_0x1e73a2[_0xfded('0x17')]?_0x1e73a2[_0xfded('0x17')][_0xfded('0x1b')]?_[_0xfded('0x1c')](_0x1e73a2[_0xfded('0x17')][_0xfded('0x1b')],function(_0x5b6132){return{'model':db[_0x5b6132[_0xfded('0x1d')]],'as':_0x5b6132['as'],'attributes':_0x5b6132[_0xfded('0x1a')],'include':_0x5b6132[_0xfded('0x1b')]?_[_0xfded('0x1c')](_0x5b6132[_0xfded('0x1b')],function(_0xbd377d){return{'model':db[_0xbd377d['model']],'as':_0xbd377d['as'],'attributes':_0xbd377d[_0xfded('0x1a')],'include':_0xbd377d[_0xfded('0x1b')]?_[_0xfded('0x1c')](_0xbd377d[_0xfded('0x1b')],function(_0x131800){return{'model':db[_0x131800[_0xfded('0x1d')]],'as':_0x131800['as'],'attributes':_0x131800['attributes']};}):[]};}):[]};}):[]:[]})[_0xfded('0xb')](function(_0x40f33b){logger[_0xfded('0xc')](_0xfded('0x1f'),_0x1e73a2);logger[_0xfded('0xf')](_0xfded('0x1f'),_0x1e73a2,JSON[_0xfded('0x21')](_0x40f33b));_0x54c98f(_0x40f33b);})['catch'](function(_0x3120f3){logger[_0xfded('0x11')](_0xfded('0x1f'),_0x3120f3['message'],_0x1e73a2);_0x50d57d(_0x41b4bb['error'](0x1f4,_0x3120f3[_0xfded('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 78fa8da..26f9d82 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 _0x3f1c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3f1c,0x193));var _0xc3f1=function(_0x3fdae9,_0x5d41f7){_0x3fdae9=_0x3fdae9-0x0;var _0x551ff9=_0x3f1c[_0x3fdae9];return _0x551ff9;};'use strict';var multer=require(_0xc3f1('0x0'));var util=require(_0xc3f1('0x1'));var path=require(_0xc3f1('0x2'));var timeout=require(_0xc3f1('0x3'));var express=require(_0xc3f1('0x4'));var router=express[_0xc3f1('0x5')]();var fs_extra=require(_0xc3f1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc3f1('0x7'));var config=require('../../config/environment');var controller=require(_0xc3f1('0x8'));router[_0xc3f1('0x9')]('/',auth[_0xc3f1('0xa')](),controller['index']);router[_0xc3f1('0x9')](_0xc3f1('0xb'),auth[_0xc3f1('0xa')](),controller[_0xc3f1('0xc')]);router[_0xc3f1('0x9')](_0xc3f1('0xd'),auth['isAuthenticated'](),controller[_0xc3f1('0xe')]);router['get'](_0xc3f1('0xf'),auth[_0xc3f1('0xa')](),controller[_0xc3f1('0x10')]);router[_0xc3f1('0x9')](_0xc3f1('0x11'),auth[_0xc3f1('0xa')](),controller[_0xc3f1('0x12')]);router[_0xc3f1('0x13')]('/',auth[_0xc3f1('0xa')](),controller['create']);router[_0xc3f1('0x14')](_0xc3f1('0xb'),auth[_0xc3f1('0xa')](),controller[_0xc3f1('0x15')]);router[_0xc3f1('0x16')](_0xc3f1('0xb'),auth[_0xc3f1('0xa')](),controller[_0xc3f1('0x17')]);module[_0xc3f1('0x18')]=router; \ No newline at end of file +var _0x464f=['/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x464f,0xc8));var _0xf464=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x464f[_0x503790];return _0x388092;};'use strict';var multer=require(_0xf464('0x0'));var util=require(_0xf464('0x1'));var path=require(_0xf464('0x2'));var timeout=require(_0xf464('0x3'));var express=require('express');var router=express[_0xf464('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf464('0x5'));var config=require(_0xf464('0x6'));var controller=require(_0xf464('0x7'));router[_0xf464('0x8')]('/',auth[_0xf464('0x9')](),controller[_0xf464('0xa')]);router[_0xf464('0x8')](_0xf464('0xb'),auth['isAuthenticated'](),controller[_0xf464('0xc')]);router[_0xf464('0x8')](_0xf464('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xf464('0x8')](_0xf464('0xe'),auth[_0xf464('0x9')](),controller[_0xf464('0xf')]);router[_0xf464('0x8')](_0xf464('0x10'),auth[_0xf464('0x9')](),controller[_0xf464('0x11')]);router[_0xf464('0x12')]('/',auth[_0xf464('0x9')](),controller[_0xf464('0x13')]);router[_0xf464('0x14')]('/:id',auth[_0xf464('0x9')](),controller[_0xf464('0x15')]);router[_0xf464('0x16')](_0xf464('0xb'),auth[_0xf464('0x9')](),controller['destroy']);module[_0xf464('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 96131c1..f291163 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 _0x4a87=['sequelize','exports','STRING'];(function(_0x91cf10,_0x2bb015){var _0x3f6788=function(_0x5d9246){while(--_0x5d9246){_0x91cf10['push'](_0x91cf10['shift']());}};_0x3f6788(++_0x2bb015);}(_0x4a87,0xe4));var _0x74a8=function(_0x9f4631,_0x1e8618){_0x9f4631=_0x9f4631-0x0;var _0x2b6faa=_0x4a87[_0x9f4631];return _0x2b6faa;};'use strict';var Sequelize=require(_0x74a8('0x0'));module[_0x74a8('0x1')]={'name':{'type':Sequelize[_0x74a8('0x2')]},'description':{'type':Sequelize[_0x74a8('0x2')]}}; \ No newline at end of file +var _0x972d=['sequelize','exports'];(function(_0x7f62cb,_0x2293d8){var _0x2932c0=function(_0x1df239){while(--_0x1df239){_0x7f62cb['push'](_0x7f62cb['shift']());}};_0x2932c0(++_0x2293d8);}(_0x972d,0x1a2));var _0xd972=function(_0x4b5a36,_0x112b21){_0x4b5a36=_0x4b5a36-0x0;var _0x5a49f5=_0x972d[_0x4b5a36];return _0x5a49f5;};'use strict';var Sequelize=require(_0xd972('0x0'));module[_0xd972('0x1')]={'name':{'type':Sequelize['STRING']},'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 5f2031a..2b49fc1 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 _0xb50e=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','SugarcrmConfiguration','findAll','catch','show','keys','include','find','create','body','params','destroy','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise'];(function(_0x1b7547,_0x56d61c){var _0x2a4c21=function(_0x4c5cf8){while(--_0x4c5cf8){_0x1b7547['push'](_0x1b7547['shift']());}};_0x2a4c21(++_0x56d61c);}(_0xb50e,0x178));var _0xeb50=function(_0x35f969,_0x2c03bd){_0x35f969=_0x35f969-0x0;var _0x373c46=_0xb50e[_0x35f969];return _0x373c46;};'use strict';var emlformat=require(_0xeb50('0x0'));var rimraf=require(_0xeb50('0x1'));var zipdir=require(_0xeb50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb50('0x3'));var moment=require(_0xeb50('0x4'));var BPromise=require(_0xeb50('0x5'));var Mustache=require(_0xeb50('0x6'));var util=require(_0xeb50('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb50('0x8'));var ejs=require(_0xeb50('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb50('0xa'));var squel=require(_0xeb50('0xb'));var crypto=require('crypto');var jsforce=require(_0xeb50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeb50('0x8'));var querystring=require('querystring');var Papa=require(_0xeb50('0xd'));var Redis=require(_0xeb50('0xe'));var authService=require(_0xeb50('0xf'));var qs=require(_0xeb50('0x10'));var as=require(_0xeb50('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb50('0x12'));var utils=require('../../config/utils');var config=require(_0xeb50('0x13'));var licenseUtil=require(_0xeb50('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361015,_0x2e5770){_0x2e5770=_0x2e5770||0xcc;return function(_0x3ce60e){if(_0x3ce60e){return _0x361015[_0xeb50('0x15')](_0x2e5770);}return _0x361015[_0xeb50('0x16')](_0x2e5770)['end']();};}function respondWithResult(_0xd30af8,_0x46ebbf){_0x46ebbf=_0x46ebbf||0xc8;return function(_0x1d6b5d){if(_0x1d6b5d){return _0xd30af8[_0xeb50('0x16')](_0x46ebbf)['json'](_0x1d6b5d);}};}function respondWithFilteredResult(_0x5ee6d3,_0x34acc6){return function(_0x354eca){if(_0x354eca){var _0x564c3e=typeof _0x34acc6[_0xeb50('0x17')]===_0xeb50('0x18')&&typeof _0x34acc6[_0xeb50('0x19')]==='undefined';var _0x262af6=_0x354eca['count'];var _0x527983=_0x564c3e?0x0:_0x34acc6[_0xeb50('0x17')];var _0x3099f0=_0x564c3e?_0x354eca[_0xeb50('0x1a')]:_0x34acc6['offset']+_0x34acc6[_0xeb50('0x19')];var _0x2878d1;if(_0x3099f0>=_0x262af6){_0x3099f0=_0x262af6;_0x2878d1=0xc8;}else{_0x2878d1=0xce;}_0x5ee6d3[_0xeb50('0x16')](_0x2878d1);return _0x5ee6d3['set']('Content-Range',_0x527983+'-'+_0x3099f0+'/'+_0x262af6)['json'](_0x354eca);}return null;};}function patchUpdates(_0x2f7f52){return function(_0x584dfb){try{jsonpatch[_0xeb50('0x1b')](_0x584dfb,_0x2f7f52,!![]);}catch(_0x199fcf){return BPromise[_0xeb50('0x1c')](_0x199fcf);}return _0x584dfb[_0xeb50('0x1d')]();};}function saveUpdates(_0x2abd53,_0x40f16b){return function(_0x237543){if(_0x237543){return _0x237543[_0xeb50('0x1e')](_0x2abd53)['then'](function(_0x1ea1b4){return _0x1ea1b4;});}return null;};}function removeEntity(_0x50978f,_0x5c4881){return function(_0x3b1c7b){if(_0x3b1c7b){return _0x3b1c7b['destroy']()[_0xeb50('0x1f')](function(){_0x50978f[_0xeb50('0x16')](0xcc)[_0xeb50('0x20')]();});}};}function handleEntityNotFound(_0x93ec24,_0x3dbace){return function(_0x140ffd){if(!_0x140ffd){_0x93ec24[_0xeb50('0x15')](0x194);}return _0x140ffd;};}function handleError(_0x21729b,_0x234025){_0x234025=_0x234025||0x1f4;return function(_0xff3a61){logger[_0xeb50('0x21')](_0xff3a61[_0xeb50('0x22')]);if(_0xff3a61[_0xeb50('0x23')]){delete _0xff3a61[_0xeb50('0x23')];}_0x21729b[_0xeb50('0x16')](_0x234025)[_0xeb50('0x24')](_0xff3a61);};}exports[_0xeb50('0x25')]=function(_0x1d8835,_0xea7b40){var _0x5cedb7={},_0xea6af={},_0x2e07d1={'count':0x0,'rows':[]};var _0x440225=_[_0xeb50('0x26')](db['SugarcrmConfiguration'][_0xeb50('0x27')],function(_0x4f1411){return{'name':_0x4f1411['fieldName'],'type':_0x4f1411[_0xeb50('0x28')][_0xeb50('0x29')]};});_0xea6af[_0xeb50('0x2a')]=_[_0xeb50('0x26')](_0x440225,_0xeb50('0x23'));_0xea6af[_0xeb50('0x2b')]=_['keys'](_0x1d8835[_0xeb50('0x2b')]);_0xea6af['filters']=_[_0xeb50('0x2c')](_0xea6af[_0xeb50('0x2a')],_0xea6af[_0xeb50('0x2b')]);_0x5cedb7[_0xeb50('0x2d')]=_[_0xeb50('0x2c')](_0xea6af[_0xeb50('0x2a')],qs[_0xeb50('0x2e')](_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x2e')]));_0x5cedb7[_0xeb50('0x2d')]=_0x5cedb7[_0xeb50('0x2d')][_0xeb50('0x2f')]?_0x5cedb7[_0xeb50('0x2d')]:_0xea6af[_0xeb50('0x2a')];if(!_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x30')](_0xeb50('0x31'))){_0x5cedb7[_0xeb50('0x19')]=qs['limit'](_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x19')]);_0x5cedb7['offset']=qs[_0xeb50('0x17')](_0x1d8835[_0xeb50('0x2b')]['offset']);}_0x5cedb7[_0xeb50('0x32')]=qs[_0xeb50('0x33')](_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x33')]);_0x5cedb7['where']=qs[_0xeb50('0x34')](_[_0xeb50('0x35')](_0x1d8835[_0xeb50('0x2b')],_0xea6af[_0xeb50('0x34')]),_0x440225);if(_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x36')]){_0x5cedb7[_0xeb50('0x37')]=_[_0xeb50('0x38')](_0x5cedb7[_0xeb50('0x37')],{'$or':_['map'](_0x440225,function(_0x453d9f){if(_0x453d9f['type']!==_0xeb50('0x39')){var _0x10afbb={};_0x10afbb[_0x453d9f[_0xeb50('0x23')]]={'$like':'%'+_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x36')]+'%'};return _0x10afbb;}})});}_0x5cedb7=_['merge']({},_0x5cedb7,_0x1d8835[_0xeb50('0x3a')]);var _0x261ac2={'where':_0x5cedb7['where']};return db['SugarcrmConfiguration'][_0xeb50('0x1a')](_0x261ac2)['then'](function(_0x3e5593){_0x2e07d1['count']=_0x3e5593;if(_0x1d8835[_0xeb50('0x2b')][_0xeb50('0x3b')]){_0x5cedb7['include']=[{'all':!![]}];}return db[_0xeb50('0x3c')][_0xeb50('0x3d')](_0x5cedb7);})[_0xeb50('0x1f')](function(_0x2435f){_0x2e07d1['rows']=_0x2435f;return _0x2e07d1;})[_0xeb50('0x1f')](respondWithFilteredResult(_0xea7b40,_0x5cedb7))[_0xeb50('0x3e')](handleError(_0xea7b40,null));};exports[_0xeb50('0x3f')]=function(_0x21153a,_0x54e4d5){var _0x88a5e6={'raw':![],'where':{'id':_0x21153a['params']['id']}},_0xbabdb4={};_0xbabdb4['model']=_['keys'](db[_0xeb50('0x3c')][_0xeb50('0x27')]);_0xbabdb4['query']=_[_0xeb50('0x40')](_0x21153a[_0xeb50('0x2b')]);_0xbabdb4[_0xeb50('0x34')]=_[_0xeb50('0x2c')](_0xbabdb4[_0xeb50('0x2a')],_0xbabdb4[_0xeb50('0x2b')]);_0x88a5e6[_0xeb50('0x2d')]=_['intersection'](_0xbabdb4[_0xeb50('0x2a')],qs[_0xeb50('0x2e')](_0x21153a[_0xeb50('0x2b')]['fields']));_0x88a5e6[_0xeb50('0x2d')]=_0x88a5e6[_0xeb50('0x2d')][_0xeb50('0x2f')]?_0x88a5e6[_0xeb50('0x2d')]:_0xbabdb4['model'];if(_0x21153a[_0xeb50('0x2b')][_0xeb50('0x3b')]){_0x88a5e6[_0xeb50('0x41')]=[{'all':!![]}];}_0x88a5e6=_['merge']({},_0x88a5e6,_0x21153a[_0xeb50('0x3a')]);return db[_0xeb50('0x3c')][_0xeb50('0x42')](_0x88a5e6)['then'](handleEntityNotFound(_0x54e4d5,null))['then'](respondWithResult(_0x54e4d5,null))[_0xeb50('0x3e')](handleError(_0x54e4d5,null));};exports['create']=function(_0x409af0,_0x10a58e){return db[_0xeb50('0x3c')][_0xeb50('0x43')](_0x409af0[_0xeb50('0x44')],{})[_0xeb50('0x1f')](respondWithResult(_0x10a58e,0xc9))[_0xeb50('0x3e')](handleError(_0x10a58e,null));};exports[_0xeb50('0x1e')]=function(_0x27355f,_0x595f33){if(_0x27355f['body']['id']){delete _0x27355f[_0xeb50('0x44')]['id'];}return db[_0xeb50('0x3c')]['find']({'where':{'id':_0x27355f[_0xeb50('0x45')]['id']}})[_0xeb50('0x1f')](handleEntityNotFound(_0x595f33,null))[_0xeb50('0x1f')](saveUpdates(_0x27355f['body'],null))['then'](respondWithResult(_0x595f33,null))[_0xeb50('0x3e')](handleError(_0x595f33,null));};exports[_0xeb50('0x46')]=function(_0x386ba8,_0x4436a7){return db[_0xeb50('0x3c')][_0xeb50('0x42')]({'where':{'id':_0x386ba8[_0xeb50('0x45')]['id']}})[_0xeb50('0x1f')](handleEntityNotFound(_0x4436a7,null))[_0xeb50('0x1f')](removeEntity(_0x4436a7,null))[_0xeb50('0x3e')](handleError(_0x4436a7,null));};exports[_0xeb50('0x47')]=function(_0x2889e8,_0x1200d5,_0x4e8d5d){var _0x61e91d={};var _0x1cb547={};var _0x1441af;var _0x4cb2e2;return db[_0xeb50('0x3c')]['findOne']({'where':{'id':_0x2889e8[_0xeb50('0x45')]['id']}})[_0xeb50('0x1f')](handleEntityNotFound(_0x1200d5,null))['then'](function(_0x401271){if(_0x401271){_0x1441af=_0x401271;_0x1cb547['model']=_['keys'](db[_0xeb50('0x48')][_0xeb50('0x27')]);_0x1cb547[_0xeb50('0x2b')]=_['keys'](_0x2889e8[_0xeb50('0x2b')]);_0x1cb547[_0xeb50('0x34')]=_['intersection'](_0x1cb547[_0xeb50('0x2a')],_0x1cb547[_0xeb50('0x2b')]);_0x61e91d[_0xeb50('0x2d')]=_[_0xeb50('0x2c')](_0x1cb547[_0xeb50('0x2a')],qs[_0xeb50('0x2e')](_0x2889e8[_0xeb50('0x2b')][_0xeb50('0x2e')]));_0x61e91d[_0xeb50('0x2d')]=_0x61e91d[_0xeb50('0x2d')][_0xeb50('0x2f')]?_0x61e91d[_0xeb50('0x2d')]:_0x1cb547[_0xeb50('0x2a')];_0x61e91d[_0xeb50('0x32')]=qs[_0xeb50('0x33')](_0x2889e8['query'][_0xeb50('0x33')]);_0x61e91d[_0xeb50('0x37')]=qs[_0xeb50('0x34')](_[_0xeb50('0x35')](_0x2889e8[_0xeb50('0x2b')],_0x1cb547[_0xeb50('0x34')]));if(_0x2889e8[_0xeb50('0x2b')][_0xeb50('0x36')]){_0x61e91d[_0xeb50('0x37')]=_[_0xeb50('0x38')](_0x61e91d[_0xeb50('0x37')],{'$or':_['map'](_0x61e91d[_0xeb50('0x2d')],function(_0x204422){var _0x4dff5c={};_0x4dff5c[_0x204422]={'$like':'%'+_0x2889e8['query']['filter']+'%'};return _0x4dff5c;})});}_0x61e91d=_[_0xeb50('0x38')]({},_0x61e91d,_0x2889e8[_0xeb50('0x3a')]);return _0x1441af[_0xeb50('0x47')](_0x61e91d);}})[_0xeb50('0x1f')](function(_0xee42ad){if(_0xee42ad){_0x4cb2e2=_0xee42ad[_0xeb50('0x2f')];if(!_0x2889e8['query'][_0xeb50('0x30')](_0xeb50('0x31'))){_0x61e91d[_0xeb50('0x19')]=qs[_0xeb50('0x19')](_0x2889e8[_0xeb50('0x2b')][_0xeb50('0x19')]);_0x61e91d[_0xeb50('0x17')]=qs[_0xeb50('0x17')](_0x2889e8[_0xeb50('0x2b')][_0xeb50('0x17')]);}return _0x1441af['getFields'](_0x61e91d);}})[_0xeb50('0x1f')](function(_0x3c7a94){if(_0x3c7a94){return _0x3c7a94?{'count':_0x4cb2e2,'rows':_0x3c7a94}:null;}})[_0xeb50('0x1f')](respondWithResult(_0x1200d5,null))[_0xeb50('0x3e')](handleError(_0x1200d5,null));};exports[_0xeb50('0x49')]=function(_0x1442af,_0x109ee3,_0x401ad0){var _0x1aa627={};var _0x4ccb51={};var _0x1fa641;var _0x20e61f;return db[_0xeb50('0x3c')][_0xeb50('0x4a')]({'where':{'id':_0x1442af['params']['id']}})[_0xeb50('0x1f')](handleEntityNotFound(_0x109ee3,null))[_0xeb50('0x1f')](function(_0x26e6d0){if(_0x26e6d0){_0x1fa641=_0x26e6d0;_0x4ccb51[_0xeb50('0x2a')]=_[_0xeb50('0x40')](db['SugarcrmField'][_0xeb50('0x27')]);_0x4ccb51['query']=_[_0xeb50('0x40')](_0x1442af[_0xeb50('0x2b')]);_0x4ccb51[_0xeb50('0x34')]=_[_0xeb50('0x2c')](_0x4ccb51[_0xeb50('0x2a')],_0x4ccb51['query']);_0x1aa627[_0xeb50('0x2d')]=_[_0xeb50('0x2c')](_0x4ccb51[_0xeb50('0x2a')],qs[_0xeb50('0x2e')](_0x1442af['query'][_0xeb50('0x2e')]));_0x1aa627[_0xeb50('0x2d')]=_0x1aa627[_0xeb50('0x2d')][_0xeb50('0x2f')]?_0x1aa627['attributes']:_0x4ccb51[_0xeb50('0x2a')];_0x1aa627[_0xeb50('0x32')]=qs[_0xeb50('0x33')](_0x1442af['query']['sort']);_0x1aa627['where']=qs[_0xeb50('0x34')](_[_0xeb50('0x35')](_0x1442af[_0xeb50('0x2b')],_0x4ccb51[_0xeb50('0x34')]));if(_0x1442af[_0xeb50('0x2b')][_0xeb50('0x36')]){_0x1aa627[_0xeb50('0x37')]=_['merge'](_0x1aa627[_0xeb50('0x37')],{'$or':_['map'](_0x1aa627['attributes'],function(_0x5891de){var _0x301e91={};_0x301e91[_0x5891de]={'$like':'%'+_0x1442af[_0xeb50('0x2b')][_0xeb50('0x36')]+'%'};return _0x301e91;})});}_0x1aa627=_[_0xeb50('0x38')]({},_0x1aa627,_0x1442af[_0xeb50('0x3a')]);return _0x1fa641['getSubjects'](_0x1aa627);}})[_0xeb50('0x1f')](function(_0x2c4cc4){if(_0x2c4cc4){_0x20e61f=_0x2c4cc4[_0xeb50('0x2f')];if(!_0x1442af['query'][_0xeb50('0x30')](_0xeb50('0x31'))){_0x1aa627[_0xeb50('0x19')]=qs['limit'](_0x1442af['query']['limit']);_0x1aa627[_0xeb50('0x17')]=qs[_0xeb50('0x17')](_0x1442af[_0xeb50('0x2b')]['offset']);}return _0x1fa641['getSubjects'](_0x1aa627);}})['then'](function(_0x45a06){if(_0x45a06){return _0x45a06?{'count':_0x20e61f,'rows':_0x45a06}:null;}})[_0xeb50('0x1f')](respondWithResult(_0x109ee3,null))[_0xeb50('0x3e')](handleError(_0x109ee3,null));};exports['getDescriptions']=function(_0x35cf6d,_0x169470,_0x139358){var _0x595d54={};var _0x2d39f0={};var _0x329e68;var _0x37b6b7;return db[_0xeb50('0x3c')][_0xeb50('0x4a')]({'where':{'id':_0x35cf6d[_0xeb50('0x45')]['id']}})[_0xeb50('0x1f')](handleEntityNotFound(_0x169470,null))[_0xeb50('0x1f')](function(_0x1c7e41){if(_0x1c7e41){_0x329e68=_0x1c7e41;_0x2d39f0[_0xeb50('0x2a')]=_[_0xeb50('0x40')](db['SugarcrmField'][_0xeb50('0x27')]);_0x2d39f0[_0xeb50('0x2b')]=_['keys'](_0x35cf6d['query']);_0x2d39f0[_0xeb50('0x34')]=_[_0xeb50('0x2c')](_0x2d39f0[_0xeb50('0x2a')],_0x2d39f0['query']);_0x595d54[_0xeb50('0x2d')]=_['intersection'](_0x2d39f0[_0xeb50('0x2a')],qs[_0xeb50('0x2e')](_0x35cf6d['query'][_0xeb50('0x2e')]));_0x595d54['attributes']=_0x595d54[_0xeb50('0x2d')][_0xeb50('0x2f')]?_0x595d54[_0xeb50('0x2d')]:_0x2d39f0[_0xeb50('0x2a')];_0x595d54[_0xeb50('0x32')]=qs['sort'](_0x35cf6d[_0xeb50('0x2b')]['sort']);_0x595d54['where']=qs[_0xeb50('0x34')](_[_0xeb50('0x35')](_0x35cf6d['query'],_0x2d39f0[_0xeb50('0x34')]));if(_0x35cf6d[_0xeb50('0x2b')][_0xeb50('0x36')]){_0x595d54['where']=_[_0xeb50('0x38')](_0x595d54['where'],{'$or':_[_0xeb50('0x26')](_0x595d54[_0xeb50('0x2d')],function(_0x3340da){var _0x4204a8={};_0x4204a8[_0x3340da]={'$like':'%'+_0x35cf6d[_0xeb50('0x2b')][_0xeb50('0x36')]+'%'};return _0x4204a8;})});}_0x595d54=_[_0xeb50('0x38')]({},_0x595d54,_0x35cf6d[_0xeb50('0x3a')]);return _0x329e68[_0xeb50('0x4b')](_0x595d54);}})[_0xeb50('0x1f')](function(_0x28a55a){if(_0x28a55a){_0x37b6b7=_0x28a55a[_0xeb50('0x2f')];if(!_0x35cf6d['query']['hasOwnProperty'](_0xeb50('0x31'))){_0x595d54[_0xeb50('0x19')]=qs[_0xeb50('0x19')](_0x35cf6d[_0xeb50('0x2b')][_0xeb50('0x19')]);_0x595d54[_0xeb50('0x17')]=qs['offset'](_0x35cf6d[_0xeb50('0x2b')][_0xeb50('0x17')]);}return _0x329e68[_0xeb50('0x4b')](_0x595d54);}})[_0xeb50('0x1f')](function(_0x1c86b4){if(_0x1c86b4){return _0x1c86b4?{'count':_0x37b6b7,'rows':_0x1c86b4}:null;}})['then'](respondWithResult(_0x169470,null))[_0xeb50('0x3e')](handleError(_0x169470,null));}; \ No newline at end of file +var _0xc4af=['offset','limit','undefined','count','apply','reject','save','update','then','destroy','stack','name','SugarcrmConfiguration','rawAttributes','type','model','query','filters','attributes','fields','length','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','options','find','create','body','findOne','SugarcrmField','intersection','order','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc4af,0x152));var _0xfc4a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc4af[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0xfc4a('0x0'));var rimraf=require(_0xfc4a('0x1'));var zipdir=require(_0xfc4a('0x2'));var jsonpatch=require(_0xfc4a('0x3'));var rp=require(_0xfc4a('0x4'));var moment=require(_0xfc4a('0x5'));var BPromise=require(_0xfc4a('0x6'));var Mustache=require('mustache');var util=require(_0xfc4a('0x7'));var path=require('path');var sox=require(_0xfc4a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc4a('0x9'));var squel=require(_0xfc4a('0xa'));var crypto=require(_0xfc4a('0xb'));var jsforce=require(_0xfc4a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc4a('0xd'));var querystring=require(_0xfc4a('0xe'));var Papa=require(_0xfc4a('0xf'));var Redis=require(_0xfc4a('0x10'));var authService=require(_0xfc4a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfc4a('0x12'));var utils=require(_0xfc4a('0x13'));var config=require(_0xfc4a('0x14'));var licenseUtil=require(_0xfc4a('0x15'));var db=require(_0xfc4a('0x16'))['db'];function respondWithStatusCode(_0x1141a4,_0x59f31a){_0x59f31a=_0x59f31a||0xcc;return function(_0x931e54){if(_0x931e54){return _0x1141a4[_0xfc4a('0x17')](_0x59f31a);}return _0x1141a4[_0xfc4a('0x18')](_0x59f31a)[_0xfc4a('0x19')]();};}function respondWithResult(_0x591e72,_0x85c388){_0x85c388=_0x85c388||0xc8;return function(_0xfae654){if(_0xfae654){return _0x591e72['status'](_0x85c388)[_0xfc4a('0x1a')](_0xfae654);}};}function respondWithFilteredResult(_0x5df73d,_0x35dd89){return function(_0x454e18){if(_0x454e18){var _0x33d9a6=typeof _0x35dd89[_0xfc4a('0x1b')]==='undefined'&&typeof _0x35dd89[_0xfc4a('0x1c')]===_0xfc4a('0x1d');var _0x43c90d=_0x454e18[_0xfc4a('0x1e')];var _0x15f522=_0x33d9a6?0x0:_0x35dd89['offset'];var _0x15e169=_0x33d9a6?_0x454e18[_0xfc4a('0x1e')]:_0x35dd89[_0xfc4a('0x1b')]+_0x35dd89['limit'];var _0x3ea3c2;if(_0x15e169>=_0x43c90d){_0x15e169=_0x43c90d;_0x3ea3c2=0xc8;}else{_0x3ea3c2=0xce;}_0x5df73d[_0xfc4a('0x18')](_0x3ea3c2);return _0x5df73d['set']('Content-Range',_0x15f522+'-'+_0x15e169+'/'+_0x43c90d)[_0xfc4a('0x1a')](_0x454e18);}return null;};}function patchUpdates(_0x421aff){return function(_0x1cb9d9){try{jsonpatch[_0xfc4a('0x1f')](_0x1cb9d9,_0x421aff,!![]);}catch(_0xbbc4bb){return BPromise[_0xfc4a('0x20')](_0xbbc4bb);}return _0x1cb9d9[_0xfc4a('0x21')]();};}function saveUpdates(_0x3926d5,_0x46532b){return function(_0x219592){if(_0x219592){return _0x219592[_0xfc4a('0x22')](_0x3926d5)[_0xfc4a('0x23')](function(_0x45637c){return _0x45637c;});}return null;};}function removeEntity(_0x279815,_0x1adfb9){return function(_0x57633e){if(_0x57633e){return _0x57633e[_0xfc4a('0x24')]()['then'](function(){_0x279815[_0xfc4a('0x18')](0xcc)[_0xfc4a('0x19')]();});}};}function handleEntityNotFound(_0x217396,_0x3b4b3c){return function(_0x40d01f){if(!_0x40d01f){_0x217396[_0xfc4a('0x17')](0x194);}return _0x40d01f;};}function handleError(_0xda500,_0x5811af){_0x5811af=_0x5811af||0x1f4;return function(_0x1da71a){logger['error'](_0x1da71a[_0xfc4a('0x25')]);if(_0x1da71a[_0xfc4a('0x26')]){delete _0x1da71a[_0xfc4a('0x26')];}_0xda500['status'](_0x5811af)['send'](_0x1da71a);};}exports['index']=function(_0x4bcae0,_0x1ef66b){var _0x38da6b={},_0xda2265={},_0x1626e1={'count':0x0,'rows':[]};var _0x446d04=_['map'](db[_0xfc4a('0x27')][_0xfc4a('0x28')],function(_0x1c6b8d){return{'name':_0x1c6b8d['fieldName'],'type':_0x1c6b8d[_0xfc4a('0x29')]['key']};});_0xda2265[_0xfc4a('0x2a')]=_['map'](_0x446d04,'name');_0xda2265[_0xfc4a('0x2b')]=_['keys'](_0x4bcae0[_0xfc4a('0x2b')]);_0xda2265[_0xfc4a('0x2c')]=_['intersection'](_0xda2265[_0xfc4a('0x2a')],_0xda2265[_0xfc4a('0x2b')]);_0x38da6b[_0xfc4a('0x2d')]=_['intersection'](_0xda2265['model'],qs[_0xfc4a('0x2e')](_0x4bcae0[_0xfc4a('0x2b')][_0xfc4a('0x2e')]));_0x38da6b[_0xfc4a('0x2d')]=_0x38da6b[_0xfc4a('0x2d')][_0xfc4a('0x2f')]?_0x38da6b[_0xfc4a('0x2d')]:_0xda2265[_0xfc4a('0x2a')];if(!_0x4bcae0[_0xfc4a('0x2b')]['hasOwnProperty']('nolimit')){_0x38da6b[_0xfc4a('0x1c')]=qs[_0xfc4a('0x1c')](_0x4bcae0['query'][_0xfc4a('0x1c')]);_0x38da6b['offset']=qs['offset'](_0x4bcae0[_0xfc4a('0x2b')]['offset']);}_0x38da6b['order']=qs[_0xfc4a('0x30')](_0x4bcae0[_0xfc4a('0x2b')][_0xfc4a('0x30')]);_0x38da6b[_0xfc4a('0x31')]=qs[_0xfc4a('0x2c')](_[_0xfc4a('0x32')](_0x4bcae0['query'],_0xda2265[_0xfc4a('0x2c')]),_0x446d04);if(_0x4bcae0[_0xfc4a('0x2b')][_0xfc4a('0x33')]){_0x38da6b[_0xfc4a('0x31')]=_['merge'](_0x38da6b[_0xfc4a('0x31')],{'$or':_[_0xfc4a('0x34')](_0x446d04,function(_0x1a20fe){if(_0x1a20fe['type']!==_0xfc4a('0x35')){var _0x262967={};_0x262967[_0x1a20fe['name']]={'$like':'%'+_0x4bcae0[_0xfc4a('0x2b')][_0xfc4a('0x33')]+'%'};return _0x262967;}})});}_0x38da6b=_[_0xfc4a('0x36')]({},_0x38da6b,_0x4bcae0['options']);var _0x39f3b0={'where':_0x38da6b[_0xfc4a('0x31')]};return db['SugarcrmConfiguration'][_0xfc4a('0x1e')](_0x39f3b0)[_0xfc4a('0x23')](function(_0x4f61c2){_0x1626e1[_0xfc4a('0x1e')]=_0x4f61c2;if(_0x4bcae0[_0xfc4a('0x2b')][_0xfc4a('0x37')]){_0x38da6b[_0xfc4a('0x38')]=[{'all':!![]}];}return db[_0xfc4a('0x27')]['findAll'](_0x38da6b);})[_0xfc4a('0x23')](function(_0x5ed472){_0x1626e1[_0xfc4a('0x39')]=_0x5ed472;return _0x1626e1;})[_0xfc4a('0x23')](respondWithFilteredResult(_0x1ef66b,_0x38da6b))[_0xfc4a('0x3a')](handleError(_0x1ef66b,null));};exports['show']=function(_0x3da1c8,_0x2870ab){var _0x445efa={'raw':![],'where':{'id':_0x3da1c8[_0xfc4a('0x3b')]['id']}},_0x1c96b7={};_0x1c96b7[_0xfc4a('0x2a')]=_['keys'](db['SugarcrmConfiguration'][_0xfc4a('0x28')]);_0x1c96b7[_0xfc4a('0x2b')]=_[_0xfc4a('0x3c')](_0x3da1c8[_0xfc4a('0x2b')]);_0x1c96b7[_0xfc4a('0x2c')]=_['intersection'](_0x1c96b7[_0xfc4a('0x2a')],_0x1c96b7[_0xfc4a('0x2b')]);_0x445efa[_0xfc4a('0x2d')]=_['intersection'](_0x1c96b7[_0xfc4a('0x2a')],qs[_0xfc4a('0x2e')](_0x3da1c8['query'][_0xfc4a('0x2e')]));_0x445efa[_0xfc4a('0x2d')]=_0x445efa[_0xfc4a('0x2d')]['length']?_0x445efa[_0xfc4a('0x2d')]:_0x1c96b7[_0xfc4a('0x2a')];if(_0x3da1c8[_0xfc4a('0x2b')][_0xfc4a('0x37')]){_0x445efa[_0xfc4a('0x38')]=[{'all':!![]}];}_0x445efa=_['merge']({},_0x445efa,_0x3da1c8[_0xfc4a('0x3d')]);return db[_0xfc4a('0x27')][_0xfc4a('0x3e')](_0x445efa)['then'](handleEntityNotFound(_0x2870ab,null))['then'](respondWithResult(_0x2870ab,null))[_0xfc4a('0x3a')](handleError(_0x2870ab,null));};exports[_0xfc4a('0x3f')]=function(_0x2634e2,_0x5ea163){return db[_0xfc4a('0x27')][_0xfc4a('0x3f')](_0x2634e2[_0xfc4a('0x40')],{})[_0xfc4a('0x23')](respondWithResult(_0x5ea163,0xc9))[_0xfc4a('0x3a')](handleError(_0x5ea163,null));};exports['update']=function(_0x3d9d1a,_0xa43368){if(_0x3d9d1a[_0xfc4a('0x40')]['id']){delete _0x3d9d1a[_0xfc4a('0x40')]['id'];}return db[_0xfc4a('0x27')][_0xfc4a('0x3e')]({'where':{'id':_0x3d9d1a['params']['id']}})[_0xfc4a('0x23')](handleEntityNotFound(_0xa43368,null))[_0xfc4a('0x23')](saveUpdates(_0x3d9d1a['body'],null))['then'](respondWithResult(_0xa43368,null))[_0xfc4a('0x3a')](handleError(_0xa43368,null));};exports[_0xfc4a('0x24')]=function(_0x188366,_0x4a5746){return db[_0xfc4a('0x27')][_0xfc4a('0x3e')]({'where':{'id':_0x188366['params']['id']}})['then'](handleEntityNotFound(_0x4a5746,null))[_0xfc4a('0x23')](removeEntity(_0x4a5746,null))['catch'](handleError(_0x4a5746,null));};exports['getFields']=function(_0x2568ea,_0x257661,_0x5d076e){var _0x1e78c0={};var _0x37bf00={};var _0x143191;var _0x315d94;return db[_0xfc4a('0x27')][_0xfc4a('0x41')]({'where':{'id':_0x2568ea[_0xfc4a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x257661,null))[_0xfc4a('0x23')](function(_0x2ae7d4){if(_0x2ae7d4){_0x143191=_0x2ae7d4;_0x37bf00['model']=_[_0xfc4a('0x3c')](db[_0xfc4a('0x42')][_0xfc4a('0x28')]);_0x37bf00[_0xfc4a('0x2b')]=_[_0xfc4a('0x3c')](_0x2568ea[_0xfc4a('0x2b')]);_0x37bf00[_0xfc4a('0x2c')]=_[_0xfc4a('0x43')](_0x37bf00['model'],_0x37bf00[_0xfc4a('0x2b')]);_0x1e78c0[_0xfc4a('0x2d')]=_[_0xfc4a('0x43')](_0x37bf00[_0xfc4a('0x2a')],qs[_0xfc4a('0x2e')](_0x2568ea[_0xfc4a('0x2b')]['fields']));_0x1e78c0[_0xfc4a('0x2d')]=_0x1e78c0[_0xfc4a('0x2d')][_0xfc4a('0x2f')]?_0x1e78c0['attributes']:_0x37bf00[_0xfc4a('0x2a')];_0x1e78c0[_0xfc4a('0x44')]=qs['sort'](_0x2568ea['query'][_0xfc4a('0x30')]);_0x1e78c0[_0xfc4a('0x31')]=qs['filters'](_[_0xfc4a('0x32')](_0x2568ea[_0xfc4a('0x2b')],_0x37bf00[_0xfc4a('0x2c')]));if(_0x2568ea['query'][_0xfc4a('0x33')]){_0x1e78c0[_0xfc4a('0x31')]=_[_0xfc4a('0x36')](_0x1e78c0['where'],{'$or':_[_0xfc4a('0x34')](_0x1e78c0['attributes'],function(_0x486547){var _0x34dce2={};_0x34dce2[_0x486547]={'$like':'%'+_0x2568ea['query'][_0xfc4a('0x33')]+'%'};return _0x34dce2;})});}_0x1e78c0=_[_0xfc4a('0x36')]({},_0x1e78c0,_0x2568ea[_0xfc4a('0x3d')]);return _0x143191['getFields'](_0x1e78c0);}})[_0xfc4a('0x23')](function(_0x3667fe){if(_0x3667fe){_0x315d94=_0x3667fe[_0xfc4a('0x2f')];if(!_0x2568ea[_0xfc4a('0x2b')]['hasOwnProperty'](_0xfc4a('0x45'))){_0x1e78c0[_0xfc4a('0x1c')]=qs[_0xfc4a('0x1c')](_0x2568ea['query'][_0xfc4a('0x1c')]);_0x1e78c0[_0xfc4a('0x1b')]=qs['offset'](_0x2568ea[_0xfc4a('0x2b')][_0xfc4a('0x1b')]);}return _0x143191['getFields'](_0x1e78c0);}})[_0xfc4a('0x23')](function(_0x20e656){if(_0x20e656){return _0x20e656?{'count':_0x315d94,'rows':_0x20e656}:null;}})[_0xfc4a('0x23')](respondWithResult(_0x257661,null))[_0xfc4a('0x3a')](handleError(_0x257661,null));};exports['getSubjects']=function(_0x528b65,_0x41dc18,_0xfd3778){var _0x29fd69={};var _0xd1c46c={};var _0x28f938;var _0x1c8b89;return db[_0xfc4a('0x27')][_0xfc4a('0x41')]({'where':{'id':_0x528b65[_0xfc4a('0x3b')]['id']}})[_0xfc4a('0x23')](handleEntityNotFound(_0x41dc18,null))[_0xfc4a('0x23')](function(_0xa97ed8){if(_0xa97ed8){_0x28f938=_0xa97ed8;_0xd1c46c[_0xfc4a('0x2a')]=_[_0xfc4a('0x3c')](db[_0xfc4a('0x42')][_0xfc4a('0x28')]);_0xd1c46c[_0xfc4a('0x2b')]=_[_0xfc4a('0x3c')](_0x528b65['query']);_0xd1c46c[_0xfc4a('0x2c')]=_[_0xfc4a('0x43')](_0xd1c46c['model'],_0xd1c46c[_0xfc4a('0x2b')]);_0x29fd69['attributes']=_['intersection'](_0xd1c46c[_0xfc4a('0x2a')],qs[_0xfc4a('0x2e')](_0x528b65[_0xfc4a('0x2b')]['fields']));_0x29fd69[_0xfc4a('0x2d')]=_0x29fd69[_0xfc4a('0x2d')][_0xfc4a('0x2f')]?_0x29fd69[_0xfc4a('0x2d')]:_0xd1c46c['model'];_0x29fd69[_0xfc4a('0x44')]=qs[_0xfc4a('0x30')](_0x528b65['query'][_0xfc4a('0x30')]);_0x29fd69[_0xfc4a('0x31')]=qs['filters'](_[_0xfc4a('0x32')](_0x528b65[_0xfc4a('0x2b')],_0xd1c46c['filters']));if(_0x528b65['query'][_0xfc4a('0x33')]){_0x29fd69['where']=_['merge'](_0x29fd69[_0xfc4a('0x31')],{'$or':_[_0xfc4a('0x34')](_0x29fd69[_0xfc4a('0x2d')],function(_0x95988a){var _0x6164cb={};_0x6164cb[_0x95988a]={'$like':'%'+_0x528b65[_0xfc4a('0x2b')][_0xfc4a('0x33')]+'%'};return _0x6164cb;})});}_0x29fd69=_[_0xfc4a('0x36')]({},_0x29fd69,_0x528b65[_0xfc4a('0x3d')]);return _0x28f938[_0xfc4a('0x46')](_0x29fd69);}})[_0xfc4a('0x23')](function(_0x4a7f76){if(_0x4a7f76){_0x1c8b89=_0x4a7f76[_0xfc4a('0x2f')];if(!_0x528b65[_0xfc4a('0x2b')][_0xfc4a('0x47')](_0xfc4a('0x45'))){_0x29fd69['limit']=qs['limit'](_0x528b65[_0xfc4a('0x2b')][_0xfc4a('0x1c')]);_0x29fd69[_0xfc4a('0x1b')]=qs[_0xfc4a('0x1b')](_0x528b65[_0xfc4a('0x2b')][_0xfc4a('0x1b')]);}return _0x28f938[_0xfc4a('0x46')](_0x29fd69);}})[_0xfc4a('0x23')](function(_0x5d92bb){if(_0x5d92bb){return _0x5d92bb?{'count':_0x1c8b89,'rows':_0x5d92bb}:null;}})[_0xfc4a('0x23')](respondWithResult(_0x41dc18,null))[_0xfc4a('0x3a')](handleError(_0x41dc18,null));};exports[_0xfc4a('0x48')]=function(_0x43ac50,_0x2a495a,_0x300029){var _0x475626={};var _0x437f86={};var _0xbcc712;var _0x55c759;return db['SugarcrmConfiguration'][_0xfc4a('0x41')]({'where':{'id':_0x43ac50[_0xfc4a('0x3b')]['id']}})[_0xfc4a('0x23')](handleEntityNotFound(_0x2a495a,null))['then'](function(_0x3b72c4){if(_0x3b72c4){_0xbcc712=_0x3b72c4;_0x437f86['model']=_[_0xfc4a('0x3c')](db[_0xfc4a('0x42')][_0xfc4a('0x28')]);_0x437f86[_0xfc4a('0x2b')]=_[_0xfc4a('0x3c')](_0x43ac50[_0xfc4a('0x2b')]);_0x437f86[_0xfc4a('0x2c')]=_[_0xfc4a('0x43')](_0x437f86[_0xfc4a('0x2a')],_0x437f86[_0xfc4a('0x2b')]);_0x475626[_0xfc4a('0x2d')]=_[_0xfc4a('0x43')](_0x437f86['model'],qs[_0xfc4a('0x2e')](_0x43ac50[_0xfc4a('0x2b')][_0xfc4a('0x2e')]));_0x475626[_0xfc4a('0x2d')]=_0x475626['attributes']['length']?_0x475626[_0xfc4a('0x2d')]:_0x437f86[_0xfc4a('0x2a')];_0x475626[_0xfc4a('0x44')]=qs[_0xfc4a('0x30')](_0x43ac50['query'][_0xfc4a('0x30')]);_0x475626[_0xfc4a('0x31')]=qs[_0xfc4a('0x2c')](_[_0xfc4a('0x32')](_0x43ac50['query'],_0x437f86[_0xfc4a('0x2c')]));if(_0x43ac50[_0xfc4a('0x2b')][_0xfc4a('0x33')]){_0x475626[_0xfc4a('0x31')]=_[_0xfc4a('0x36')](_0x475626[_0xfc4a('0x31')],{'$or':_[_0xfc4a('0x34')](_0x475626[_0xfc4a('0x2d')],function(_0x35e2fd){var _0x376e02={};_0x376e02[_0x35e2fd]={'$like':'%'+_0x43ac50[_0xfc4a('0x2b')]['filter']+'%'};return _0x376e02;})});}_0x475626=_['merge']({},_0x475626,_0x43ac50['options']);return _0xbcc712[_0xfc4a('0x48')](_0x475626);}})[_0xfc4a('0x23')](function(_0x560fb7){if(_0x560fb7){_0x55c759=_0x560fb7[_0xfc4a('0x2f')];if(!_0x43ac50[_0xfc4a('0x2b')][_0xfc4a('0x47')]('nolimit')){_0x475626[_0xfc4a('0x1c')]=qs[_0xfc4a('0x1c')](_0x43ac50[_0xfc4a('0x2b')][_0xfc4a('0x1c')]);_0x475626[_0xfc4a('0x1b')]=qs['offset'](_0x43ac50[_0xfc4a('0x2b')][_0xfc4a('0x1b')]);}return _0xbcc712['getDescriptions'](_0x475626);}})[_0xfc4a('0x23')](function(_0x33b870){if(_0x33b870){return _0x33b870?{'count':_0x55c759,'rows':_0x33b870}:null;}})['then'](respondWithResult(_0x2a495a,null))[_0xfc4a('0x3a')](handleError(_0x2a495a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 65bd8a8..d5eb929 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 _0x1bec=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x1bec,0x186));var _0xc1be=function(_0xdae8e6,_0x34854a){_0xdae8e6=_0xdae8e6-0x0;var _0x24c7a7=_0x1bec[_0xdae8e6];return _0x24c7a7;};'use strict';var _=require(_0xc1be('0x0'));var util=require(_0xc1be('0x1'));var logger=require(_0xc1be('0x2'))(_0xc1be('0x3'));var moment=require(_0xc1be('0x4'));var BPromise=require(_0xc1be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1be('0x6'));var rimraf=require(_0xc1be('0x7'));var config=require(_0xc1be('0x8'));var attributes=require(_0xc1be('0x9'));module['exports']=function(_0x22a988,_0xc75e0f){return _0x22a988[_0xc1be('0xa')](_0xc1be('0xb'),attributes,{'tableName':_0xc1be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b2=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x311ac2,_0x1c2732){var _0x7f34ac=function(_0x2cc2e9){while(--_0x2cc2e9){_0x311ac2['push'](_0x311ac2['shift']());}};_0x7f34ac(++_0x1c2732);}(_0xd2b2,0x107));var _0x2d2b=function(_0x2a1f8,_0x2ce877){_0x2a1f8=_0x2a1f8-0x0;var _0x50382a=_0xd2b2[_0x2a1f8];return _0x50382a;};'use strict';var _=require(_0x2d2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d2b('0x1'));var moment=require(_0x2d2b('0x2'));var BPromise=require(_0x2d2b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d2b('0x4'));var config=require(_0x2d2b('0x5'));var attributes=require(_0x2d2b('0x6'));module[_0x2d2b('0x7')]=function(_0x1dd9e6,_0x1a2e56){return _0x1dd9e6['define'](_0x2d2b('0x8'),attributes,{'tableName':_0x2d2b('0x9'),'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 3f9f55c..e463474 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 _0xf119=['then','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x2ab203,_0x2318a1){var _0x105cb1=function(_0x183b47){while(--_0x183b47){_0x2ab203['push'](_0x2ab203['shift']());}};_0x105cb1(++_0x2318a1);}(_0xf119,0x1d0));var _0x9f11=function(_0x2db3a8,_0x4e55a1){_0x2db3a8=_0x2db3a8-0x0;var _0x2f881a=_0xf119[_0x2db3a8];return _0x2f881a;};'use strict';var _=require(_0x9f11('0x0'));var util=require('util');var moment=require(_0x9f11('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f11('0x2'));var fs=require('fs');var Redis=require(_0x9f11('0x3'));var db=require(_0x9f11('0x4'))['db'];var utils=require(_0x9f11('0x5'));var logger=require(_0x9f11('0x6'))(_0x9f11('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f11('0x8')][_0x9f11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcebd95,_0x5d6710,_0x5dfd06){return new BPromise(function(_0x4b0f18,_0x5bcade){return client[_0x9f11('0xa')](_0xcebd95,_0x5dfd06)[_0x9f11('0xb')](function(_0x471ccd){logger['info'](_0x9f11('0xc'),_0x5d6710,'request\x20sent');logger['debug'](_0x9f11('0xd'),_0x5d6710,'request\x20sent',JSON[_0x9f11('0xe')](_0x471ccd));if(_0x471ccd[_0x9f11('0xf')]){if(_0x471ccd[_0x9f11('0xf')][_0x9f11('0x10')]===0x1f4){logger[_0x9f11('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d6710,_0x471ccd[_0x9f11('0xf')][_0x9f11('0x11')]);return _0x5bcade(_0x471ccd[_0x9f11('0xf')][_0x9f11('0x11')]);}logger['error'](_0x9f11('0xc'),_0x5d6710,_0x471ccd['error']['message']);return _0x4b0f18(_0x471ccd[_0x9f11('0xf')][_0x9f11('0x11')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d6710,'request\x20sent');_0x4b0f18(_0x471ccd['result'][_0x9f11('0x11')]);}})[_0x9f11('0x12')](function(_0x3f267d){logger[_0x9f11('0xf')](_0x9f11('0xc'),_0x5d6710,_0x3f267d);_0x5bcade(_0x3f267d);});});} \ No newline at end of file +var _0xc0d3=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x43d6fe,_0x523a4a){var _0x58b13f=function(_0x28cb33){while(--_0x28cb33){_0x43d6fe['push'](_0x43d6fe['shift']());}};_0x58b13f(++_0x523a4a);}(_0xc0d3,0xf1));var _0x3c0d=function(_0x32bd2c,_0x44d375){_0x32bd2c=_0x32bd2c-0x0;var _0x3e9621=_0xc0d3[_0x32bd2c];return _0x3e9621;};'use strict';var _=require(_0x3c0d('0x0'));var util=require(_0x3c0d('0x1'));var moment=require(_0x3c0d('0x2'));var BPromise=require(_0x3c0d('0x3'));var rs=require(_0x3c0d('0x4'));var fs=require('fs');var Redis=require(_0x3c0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c0d('0x6'));var logger=require('../../config/logger')(_0x3c0d('0x7'));var config=require(_0x3c0d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x721517,_0x3b7561,_0x168ea8){return new BPromise(function(_0x3a3918,_0x2033e9){return client[_0x3c0d('0xa')](_0x721517,_0x168ea8)[_0x3c0d('0xb')](function(_0x499b6d){logger[_0x3c0d('0xc')](_0x3c0d('0xd'),_0x3b7561,_0x3c0d('0xe'));logger[_0x3c0d('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3b7561,_0x3c0d('0xe'),JSON['stringify'](_0x499b6d));if(_0x499b6d[_0x3c0d('0x10')]){if(_0x499b6d[_0x3c0d('0x10')][_0x3c0d('0x11')]===0x1f4){logger[_0x3c0d('0x10')](_0x3c0d('0xd'),_0x3b7561,_0x499b6d[_0x3c0d('0x10')][_0x3c0d('0x12')]);return _0x2033e9(_0x499b6d['error']['message']);}logger[_0x3c0d('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3b7561,_0x499b6d[_0x3c0d('0x10')][_0x3c0d('0x12')]);return _0x3a3918(_0x499b6d[_0x3c0d('0x10')]['message']);}else{logger[_0x3c0d('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3b7561,_0x3c0d('0xe'));_0x3a3918(_0x499b6d[_0x3c0d('0x13')][_0x3c0d('0x12')]);}})['catch'](function(_0x443683){logger[_0x3c0d('0x10')](_0x3c0d('0xd'),_0x3b7561,_0x443683);_0x2033e9(_0x443683);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0cef40b..f278b9f 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 _0x3d31=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x240a6c,_0x204289){var _0x6f469b=function(_0x2f000b){while(--_0x2f000b){_0x240a6c['push'](_0x240a6c['shift']());}};_0x6f469b(++_0x204289);}(_0x3d31,0x107));var _0x13d3=function(_0x14b51d,_0x41ef6a){_0x14b51d=_0x14b51d-0x0;var _0x4e8f21=_0x3d31[_0x14b51d];return _0x4e8f21;};'use strict';var multer=require(_0x13d3('0x0'));var util=require(_0x13d3('0x1'));var path=require(_0x13d3('0x2'));var timeout=require(_0x13d3('0x3'));var express=require(_0x13d3('0x4'));var router=express[_0x13d3('0x5')]();var fs_extra=require(_0x13d3('0x6'));var auth=require(_0x13d3('0x7'));var interaction=require(_0x13d3('0x8'));var config=require(_0x13d3('0x9'));var controller=require('./intSugarcrmField.controller');router[_0x13d3('0xa')]('/',auth[_0x13d3('0xb')](),controller[_0x13d3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x13d3('0xd')]);router[_0x13d3('0xe')]('/',auth[_0x13d3('0xb')](),controller['create']);router[_0x13d3('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x13d3('0x10')](_0x13d3('0x11'),auth[_0x13d3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcac2=['../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f7a9f,_0x55ab15){var _0x4e7279=function(_0x285c79){while(--_0x285c79){_0x3f7a9f['push'](_0x3f7a9f['shift']());}};_0x4e7279(++_0x55ab15);}(_0xcac2,0x69));var _0x2cac=function(_0xa7e63b,_0x26dae0){_0xa7e63b=_0xa7e63b-0x0;var _0x23b962=_0xcac2[_0xa7e63b];return _0x23b962;};'use strict';var multer=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var path=require(_0x2cac('0x2'));var timeout=require(_0x2cac('0x3'));var express=require(_0x2cac('0x4'));var router=express[_0x2cac('0x5')]();var fs_extra=require(_0x2cac('0x6'));var auth=require(_0x2cac('0x7'));var interaction=require(_0x2cac('0x8'));var config=require(_0x2cac('0x9'));var controller=require(_0x2cac('0xa'));router[_0x2cac('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cac('0xb')](_0x2cac('0xc'),auth[_0x2cac('0xd')](),controller[_0x2cac('0xe')]);router[_0x2cac('0xf')]('/',auth[_0x2cac('0xd')](),controller[_0x2cac('0x10')]);router[_0x2cac('0x11')](_0x2cac('0xc'),auth[_0x2cac('0xd')](),controller['update']);router['delete'](_0x2cac('0xc'),auth[_0x2cac('0xd')](),controller['destroy']);module[_0x2cac('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 12053d1..ed9b2bd 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 _0x358d=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x1f596d,_0x4d3ad7){var _0x264b60=function(_0x244138){while(--_0x244138){_0x1f596d['push'](_0x1f596d['shift']());}};_0x264b60(++_0x4d3ad7);}(_0x358d,0xe7));var _0xd358=function(_0x291728,_0x5f4842){_0x291728=_0x291728-0x0;var _0x10444c=_0x358d[_0x291728];return _0x10444c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd358('0x0')](_0xd358('0x1'),_0xd358('0x2'),_0xd358('0x3'),_0xd358('0x4'),_0xd358('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd358('0x6')]},'key':{'type':Sequelize[_0xd358('0x6')]},'keyType':{'type':Sequelize[_0xd358('0x0')]('string',_0xd358('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xd358('0x6')]},'idField':{'type':Sequelize[_0xd358('0x6')]},'nameField':{'type':Sequelize[_0xd358('0x6')]},'customField':{'type':Sequelize[_0xd358('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d94=['BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x2cb03a,_0x4b53e6){var _0xe38608=function(_0x359a7f){while(--_0x359a7f){_0x2cb03a['push'](_0x2cb03a['shift']());}};_0xe38608(++_0x4b53e6);}(_0x8d94,0x99));var _0x48d9=function(_0x444cc0,_0x2cbe53){_0x444cc0=_0x444cc0-0x0;var _0x397682=_0x8d94[_0x444cc0];return _0x397682;};'use strict';var Sequelize=require(_0x48d9('0x0'));module[_0x48d9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x48d9('0x2'),_0x48d9('0x3'),_0x48d9('0x4'),'picklist'),'defaultValue':_0x48d9('0x5')},'content':{'type':Sequelize[_0x48d9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x48d9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x48d9('0x6')]},'nameField':{'type':Sequelize[_0x48d9('0x6')]},'customField':{'type':Sequelize[_0x48d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 96b3078..626b034 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 _0x1a06=['count','offset','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','fields','length','attributes','sort','where','pick','filter','merge','options','includeAll','include','SugarcrmField','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','end','status','json','limit'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x1a06,0x6a));var _0x61a0=function(_0x202433,_0x248e64){_0x202433=_0x202433-0x0;var _0xc7522=_0x1a06[_0x202433];return _0xc7522;};'use strict';var emlformat=require(_0x61a0('0x0'));var rimraf=require(_0x61a0('0x1'));var zipdir=require(_0x61a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61a0('0x3'));var BPromise=require(_0x61a0('0x4'));var Mustache=require(_0x61a0('0x5'));var util=require('util');var path=require(_0x61a0('0x6'));var sox=require(_0x61a0('0x7'));var csv=require(_0x61a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61a0('0x9'));var _=require(_0x61a0('0xa'));var squel=require(_0x61a0('0xb'));var crypto=require('crypto');var jsforce=require(_0x61a0('0xc'));var deskjs=require(_0x61a0('0xd'));var toCsv=require(_0x61a0('0x8'));var querystring=require(_0x61a0('0xe'));var Papa=require('papaparse');var Redis=require(_0x61a0('0xf'));var authService=require(_0x61a0('0x10'));var qs=require(_0x61a0('0x11'));var as=require(_0x61a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61a0('0x13'))('api');var utils=require(_0x61a0('0x14'));var config=require(_0x61a0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd0077f,_0x34779e){_0x34779e=_0x34779e||0xcc;return function(_0x5041fd){if(_0x5041fd){return _0xd0077f['sendStatus'](_0x34779e);}return _0xd0077f['status'](_0x34779e)[_0x61a0('0x16')]();};}function respondWithResult(_0x24e041,_0x5cc645){_0x5cc645=_0x5cc645||0xc8;return function(_0x3d011a){if(_0x3d011a){return _0x24e041[_0x61a0('0x17')](_0x5cc645)[_0x61a0('0x18')](_0x3d011a);}};}function respondWithFilteredResult(_0x1be829,_0x506e29){return function(_0x5bd673){if(_0x5bd673){var _0x20f547=typeof _0x506e29['offset']==='undefined'&&typeof _0x506e29[_0x61a0('0x19')]==='undefined';var _0x379776=_0x5bd673[_0x61a0('0x1a')];var _0x23f61c=_0x20f547?0x0:_0x506e29['offset'];var _0x2608b0=_0x20f547?_0x5bd673[_0x61a0('0x1a')]:_0x506e29[_0x61a0('0x1b')]+_0x506e29[_0x61a0('0x19')];var _0x1122ae;if(_0x2608b0>=_0x379776){_0x2608b0=_0x379776;_0x1122ae=0xc8;}else{_0x1122ae=0xce;}_0x1be829[_0x61a0('0x17')](_0x1122ae);return _0x1be829['set']('Content-Range',_0x23f61c+'-'+_0x2608b0+'/'+_0x379776)[_0x61a0('0x18')](_0x5bd673);}return null;};}function patchUpdates(_0x28f8db){return function(_0x98e11){try{jsonpatch[_0x61a0('0x1c')](_0x98e11,_0x28f8db,!![]);}catch(_0x25eaaf){return BPromise['reject'](_0x25eaaf);}return _0x98e11[_0x61a0('0x1d')]();};}function saveUpdates(_0x18b53e,_0x4d480e){return function(_0x241e86){if(_0x241e86){return _0x241e86[_0x61a0('0x1e')](_0x18b53e)[_0x61a0('0x1f')](function(_0x17726c){return _0x17726c;});}return null;};}function removeEntity(_0x1a4425,_0x35c361){return function(_0xb05558){if(_0xb05558){return _0xb05558[_0x61a0('0x20')]()['then'](function(){_0x1a4425[_0x61a0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7055,_0x297ae8){return function(_0x53f811){if(!_0x53f811){_0x3c7055[_0x61a0('0x21')](0x194);}return _0x53f811;};}function handleError(_0x19afb4,_0x2d9241){_0x2d9241=_0x2d9241||0x1f4;return function(_0x254348){logger[_0x61a0('0x22')](_0x254348[_0x61a0('0x23')]);if(_0x254348['name']){delete _0x254348[_0x61a0('0x24')];}_0x19afb4[_0x61a0('0x17')](_0x2d9241)[_0x61a0('0x25')](_0x254348);};}exports[_0x61a0('0x26')]=function(_0x39e677,_0x3c51d5){var _0x1d67ed={},_0x469e8a={},_0xbd5e1b={'count':0x0,'rows':[]};var _0x754846=_[_0x61a0('0x27')](db['SugarcrmField'][_0x61a0('0x28')],function(_0x3e1465){return{'name':_0x3e1465['fieldName'],'type':_0x3e1465[_0x61a0('0x29')][_0x61a0('0x2a')]};});_0x469e8a[_0x61a0('0x2b')]=_[_0x61a0('0x27')](_0x754846,_0x61a0('0x24'));_0x469e8a[_0x61a0('0x2c')]=_[_0x61a0('0x2d')](_0x39e677['query']);_0x469e8a[_0x61a0('0x2e')]=_['intersection'](_0x469e8a[_0x61a0('0x2b')],_0x469e8a[_0x61a0('0x2c')]);_0x1d67ed['attributes']=_['intersection'](_0x469e8a['model'],qs[_0x61a0('0x2f')](_0x39e677[_0x61a0('0x2c')][_0x61a0('0x2f')]));_0x1d67ed['attributes']=_0x1d67ed['attributes'][_0x61a0('0x30')]?_0x1d67ed[_0x61a0('0x31')]:_0x469e8a['model'];if(!_0x39e677[_0x61a0('0x2c')]['hasOwnProperty']('nolimit')){_0x1d67ed['limit']=qs['limit'](_0x39e677[_0x61a0('0x2c')]['limit']);_0x1d67ed[_0x61a0('0x1b')]=qs[_0x61a0('0x1b')](_0x39e677[_0x61a0('0x2c')]['offset']);}_0x1d67ed['order']=qs[_0x61a0('0x32')](_0x39e677['query'][_0x61a0('0x32')]);_0x1d67ed[_0x61a0('0x33')]=qs[_0x61a0('0x2e')](_[_0x61a0('0x34')](_0x39e677[_0x61a0('0x2c')],_0x469e8a[_0x61a0('0x2e')]),_0x754846);if(_0x39e677[_0x61a0('0x2c')][_0x61a0('0x35')]){_0x1d67ed[_0x61a0('0x33')]=_[_0x61a0('0x36')](_0x1d67ed[_0x61a0('0x33')],{'$or':_[_0x61a0('0x27')](_0x754846,function(_0x565993){if(_0x565993['type']!=='VIRTUAL'){var _0x3c4f81={};_0x3c4f81[_0x565993[_0x61a0('0x24')]]={'$like':'%'+_0x39e677['query'][_0x61a0('0x35')]+'%'};return _0x3c4f81;}})});}_0x1d67ed=_[_0x61a0('0x36')]({},_0x1d67ed,_0x39e677[_0x61a0('0x37')]);var _0x528547={'where':_0x1d67ed['where']};return db['SugarcrmField'][_0x61a0('0x1a')](_0x528547)[_0x61a0('0x1f')](function(_0x989158){_0xbd5e1b[_0x61a0('0x1a')]=_0x989158;if(_0x39e677[_0x61a0('0x2c')][_0x61a0('0x38')]){_0x1d67ed[_0x61a0('0x39')]=[{'all':!![]}];}return db[_0x61a0('0x3a')]['findAll'](_0x1d67ed);})[_0x61a0('0x1f')](function(_0x4a2b3b){_0xbd5e1b[_0x61a0('0x3b')]=_0x4a2b3b;return _0xbd5e1b;})[_0x61a0('0x1f')](respondWithFilteredResult(_0x3c51d5,_0x1d67ed))[_0x61a0('0x3c')](handleError(_0x3c51d5,null));};exports[_0x61a0('0x3d')]=function(_0x3b642d,_0x11ac75){var _0x4fa712={'raw':!![],'where':{'id':_0x3b642d[_0x61a0('0x3e')]['id']}},_0x41ebe0={};_0x41ebe0['model']=_[_0x61a0('0x2d')](db[_0x61a0('0x3a')][_0x61a0('0x28')]);_0x41ebe0[_0x61a0('0x2c')]=_[_0x61a0('0x2d')](_0x3b642d[_0x61a0('0x2c')]);_0x41ebe0['filters']=_['intersection'](_0x41ebe0[_0x61a0('0x2b')],_0x41ebe0['query']);_0x4fa712['attributes']=_['intersection'](_0x41ebe0[_0x61a0('0x2b')],qs[_0x61a0('0x2f')](_0x3b642d[_0x61a0('0x2c')][_0x61a0('0x2f')]));_0x4fa712['attributes']=_0x4fa712[_0x61a0('0x31')]['length']?_0x4fa712[_0x61a0('0x31')]:_0x41ebe0[_0x61a0('0x2b')];if(_0x3b642d[_0x61a0('0x2c')][_0x61a0('0x38')]){_0x4fa712[_0x61a0('0x39')]=[{'all':!![]}];}_0x4fa712=_[_0x61a0('0x36')]({},_0x4fa712,_0x3b642d[_0x61a0('0x37')]);return db['SugarcrmField'][_0x61a0('0x3f')](_0x4fa712)[_0x61a0('0x1f')](handleEntityNotFound(_0x11ac75,null))['then'](respondWithResult(_0x11ac75,null))['catch'](handleError(_0x11ac75,null));};exports[_0x61a0('0x40')]=function(_0x3c5286,_0x175704){return db[_0x61a0('0x3a')][_0x61a0('0x40')](_0x3c5286['body'],{})[_0x61a0('0x1f')](respondWithResult(_0x175704,0xc9))[_0x61a0('0x3c')](handleError(_0x175704,null));};exports[_0x61a0('0x1e')]=function(_0x323f19,_0x5c3cbc){if(_0x323f19[_0x61a0('0x41')]['id']){delete _0x323f19[_0x61a0('0x41')]['id'];}return db[_0x61a0('0x3a')][_0x61a0('0x3f')]({'where':{'id':_0x323f19['params']['id']}})[_0x61a0('0x1f')](handleEntityNotFound(_0x5c3cbc,null))['then'](saveUpdates(_0x323f19['body'],null))[_0x61a0('0x1f')](respondWithResult(_0x5c3cbc,null))['catch'](handleError(_0x5c3cbc,null));};exports[_0x61a0('0x20')]=function(_0x5565c1,_0x3e9ed3){return db['SugarcrmField'][_0x61a0('0x3f')]({'where':{'id':_0x5565c1['params']['id']}})[_0x61a0('0x1f')](handleEntityNotFound(_0x3e9ed3,null))[_0x61a0('0x1f')](removeEntity(_0x3e9ed3,null))[_0x61a0('0x3c')](handleError(_0x3e9ed3,null));}; \ No newline at end of file +var _0x4af6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SugarcrmField','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x1ec6c8,_0x72ff6){var _0x16701c=function(_0x4fd69f){while(--_0x4fd69f){_0x1ec6c8['push'](_0x1ec6c8['shift']());}};_0x16701c(++_0x72ff6);}(_0x4af6,0xd8));var _0x64af=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4af6[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x64af('0x0'));var rimraf=require(_0x64af('0x1'));var zipdir=require(_0x64af('0x2'));var jsonpatch=require(_0x64af('0x3'));var rp=require(_0x64af('0x4'));var moment=require(_0x64af('0x5'));var BPromise=require(_0x64af('0x6'));var Mustache=require(_0x64af('0x7'));var util=require(_0x64af('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x64af('0x9'));var ejs=require(_0x64af('0xa'));var fs=require('fs');var fs_extra=require(_0x64af('0xb'));var _=require('lodash');var squel=require(_0x64af('0xc'));var crypto=require('crypto');var jsforce=require(_0x64af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x64af('0x9'));var querystring=require(_0x64af('0xe'));var Papa=require(_0x64af('0xf'));var Redis=require(_0x64af('0x10'));var authService=require(_0x64af('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x64af('0x12'));var hardwareService=require(_0x64af('0x13'));var logger=require(_0x64af('0x14'))(_0x64af('0x15'));var utils=require(_0x64af('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1492,_0x50105b){_0x50105b=_0x50105b||0xcc;return function(_0x201252){if(_0x201252){return _0x3e1492['sendStatus'](_0x50105b);}return _0x3e1492['status'](_0x50105b)['end']();};}function respondWithResult(_0x11f97a,_0x4ee449){_0x4ee449=_0x4ee449||0xc8;return function(_0x3d4f09){if(_0x3d4f09){return _0x11f97a[_0x64af('0x17')](_0x4ee449)[_0x64af('0x18')](_0x3d4f09);}};}function respondWithFilteredResult(_0x27fab5,_0x44cd0c){return function(_0x3da3c8){if(_0x3da3c8){var _0x548776=typeof _0x44cd0c[_0x64af('0x19')]==='undefined'&&typeof _0x44cd0c[_0x64af('0x1a')]==='undefined';var _0x4f2254=_0x3da3c8[_0x64af('0x1b')];var _0x404dc2=_0x548776?0x0:_0x44cd0c[_0x64af('0x19')];var _0x132161=_0x548776?_0x3da3c8[_0x64af('0x1b')]:_0x44cd0c[_0x64af('0x19')]+_0x44cd0c[_0x64af('0x1a')];var _0x4ebac9;if(_0x132161>=_0x4f2254){_0x132161=_0x4f2254;_0x4ebac9=0xc8;}else{_0x4ebac9=0xce;}_0x27fab5['status'](_0x4ebac9);return _0x27fab5[_0x64af('0x1c')](_0x64af('0x1d'),_0x404dc2+'-'+_0x132161+'/'+_0x4f2254)[_0x64af('0x18')](_0x3da3c8);}return null;};}function patchUpdates(_0x3786eb){return function(_0x12ce21){try{jsonpatch[_0x64af('0x1e')](_0x12ce21,_0x3786eb,!![]);}catch(_0x446bb6){return BPromise[_0x64af('0x1f')](_0x446bb6);}return _0x12ce21[_0x64af('0x20')]();};}function saveUpdates(_0x3d756e,_0x23fd7c){return function(_0x3f9af0){if(_0x3f9af0){return _0x3f9af0[_0x64af('0x21')](_0x3d756e)[_0x64af('0x22')](function(_0x68b6f9){return _0x68b6f9;});}return null;};}function removeEntity(_0x59e08,_0x44cc9b){return function(_0x555282){if(_0x555282){return _0x555282[_0x64af('0x23')]()['then'](function(){_0x59e08[_0x64af('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1afc9a,_0x482d5b){return function(_0x251201){if(!_0x251201){_0x1afc9a[_0x64af('0x24')](0x194);}return _0x251201;};}function handleError(_0x5da588,_0xeb41ed){_0xeb41ed=_0xeb41ed||0x1f4;return function(_0x13425d){logger[_0x64af('0x25')](_0x13425d[_0x64af('0x26')]);if(_0x13425d[_0x64af('0x27')]){delete _0x13425d[_0x64af('0x27')];}_0x5da588['status'](_0xeb41ed)[_0x64af('0x28')](_0x13425d);};}exports[_0x64af('0x29')]=function(_0x3573f0,_0x1760b6){var _0x3bc772={},_0x5ed72d={},_0x16761b={'count':0x0,'rows':[]};var _0x1fd4f2=_['map'](db[_0x64af('0x2a')][_0x64af('0x2b')],function(_0x5a1af3){return{'name':_0x5a1af3['fieldName'],'type':_0x5a1af3[_0x64af('0x2c')]['key']};});_0x5ed72d[_0x64af('0x2d')]=_['map'](_0x1fd4f2,'name');_0x5ed72d[_0x64af('0x2e')]=_['keys'](_0x3573f0[_0x64af('0x2e')]);_0x5ed72d[_0x64af('0x2f')]=_[_0x64af('0x30')](_0x5ed72d[_0x64af('0x2d')],_0x5ed72d[_0x64af('0x2e')]);_0x3bc772[_0x64af('0x31')]=_[_0x64af('0x30')](_0x5ed72d['model'],qs['fields'](_0x3573f0[_0x64af('0x2e')][_0x64af('0x32')]));_0x3bc772[_0x64af('0x31')]=_0x3bc772[_0x64af('0x31')][_0x64af('0x33')]?_0x3bc772[_0x64af('0x31')]:_0x5ed72d[_0x64af('0x2d')];if(!_0x3573f0[_0x64af('0x2e')][_0x64af('0x34')](_0x64af('0x35'))){_0x3bc772[_0x64af('0x1a')]=qs[_0x64af('0x1a')](_0x3573f0['query']['limit']);_0x3bc772['offset']=qs[_0x64af('0x19')](_0x3573f0[_0x64af('0x2e')][_0x64af('0x19')]);}_0x3bc772[_0x64af('0x36')]=qs[_0x64af('0x37')](_0x3573f0[_0x64af('0x2e')]['sort']);_0x3bc772[_0x64af('0x38')]=qs[_0x64af('0x2f')](_[_0x64af('0x39')](_0x3573f0[_0x64af('0x2e')],_0x5ed72d['filters']),_0x1fd4f2);if(_0x3573f0[_0x64af('0x2e')][_0x64af('0x3a')]){_0x3bc772[_0x64af('0x38')]=_[_0x64af('0x3b')](_0x3bc772['where'],{'$or':_[_0x64af('0x3c')](_0x1fd4f2,function(_0x538e51){if(_0x538e51[_0x64af('0x2c')]!==_0x64af('0x3d')){var _0x35e7c3={};_0x35e7c3[_0x538e51['name']]={'$like':'%'+_0x3573f0[_0x64af('0x2e')][_0x64af('0x3a')]+'%'};return _0x35e7c3;}})});}_0x3bc772=_['merge']({},_0x3bc772,_0x3573f0[_0x64af('0x3e')]);var _0xf93f33={'where':_0x3bc772['where']};return db[_0x64af('0x2a')][_0x64af('0x1b')](_0xf93f33)['then'](function(_0x5a979a){_0x16761b[_0x64af('0x1b')]=_0x5a979a;if(_0x3573f0[_0x64af('0x2e')]['includeAll']){_0x3bc772['include']=[{'all':!![]}];}return db[_0x64af('0x2a')][_0x64af('0x3f')](_0x3bc772);})[_0x64af('0x22')](function(_0x445a68){_0x16761b[_0x64af('0x40')]=_0x445a68;return _0x16761b;})[_0x64af('0x22')](respondWithFilteredResult(_0x1760b6,_0x3bc772))['catch'](handleError(_0x1760b6,null));};exports[_0x64af('0x41')]=function(_0x5437ae,_0x385e58){var _0x4da023={'raw':!![],'where':{'id':_0x5437ae[_0x64af('0x42')]['id']}},_0x22de31={};_0x22de31[_0x64af('0x2d')]=_['keys'](db[_0x64af('0x2a')][_0x64af('0x2b')]);_0x22de31['query']=_['keys'](_0x5437ae[_0x64af('0x2e')]);_0x22de31[_0x64af('0x2f')]=_[_0x64af('0x30')](_0x22de31[_0x64af('0x2d')],_0x22de31[_0x64af('0x2e')]);_0x4da023[_0x64af('0x31')]=_[_0x64af('0x30')](_0x22de31[_0x64af('0x2d')],qs[_0x64af('0x32')](_0x5437ae[_0x64af('0x2e')][_0x64af('0x32')]));_0x4da023[_0x64af('0x31')]=_0x4da023[_0x64af('0x31')][_0x64af('0x33')]?_0x4da023[_0x64af('0x31')]:_0x22de31[_0x64af('0x2d')];if(_0x5437ae['query'][_0x64af('0x43')]){_0x4da023[_0x64af('0x44')]=[{'all':!![]}];}_0x4da023=_[_0x64af('0x3b')]({},_0x4da023,_0x5437ae['options']);return db['SugarcrmField'][_0x64af('0x45')](_0x4da023)[_0x64af('0x22')](handleEntityNotFound(_0x385e58,null))[_0x64af('0x22')](respondWithResult(_0x385e58,null))[_0x64af('0x46')](handleError(_0x385e58,null));};exports[_0x64af('0x47')]=function(_0x51246e,_0x21fea2){return db[_0x64af('0x2a')][_0x64af('0x47')](_0x51246e['body'],{})[_0x64af('0x22')](respondWithResult(_0x21fea2,0xc9))[_0x64af('0x46')](handleError(_0x21fea2,null));};exports[_0x64af('0x21')]=function(_0x4b7c72,_0x5720a5){if(_0x4b7c72[_0x64af('0x48')]['id']){delete _0x4b7c72[_0x64af('0x48')]['id'];}return db[_0x64af('0x2a')][_0x64af('0x45')]({'where':{'id':_0x4b7c72['params']['id']}})['then'](handleEntityNotFound(_0x5720a5,null))[_0x64af('0x22')](saveUpdates(_0x4b7c72[_0x64af('0x48')],null))[_0x64af('0x22')](respondWithResult(_0x5720a5,null))[_0x64af('0x46')](handleError(_0x5720a5,null));};exports[_0x64af('0x23')]=function(_0x2ad948,_0x1befe3){return db[_0x64af('0x2a')][_0x64af('0x45')]({'where':{'id':_0x2ad948[_0x64af('0x42')]['id']}})[_0x64af('0x22')](handleEntityNotFound(_0x1befe3,null))[_0x64af('0x22')](removeEntity(_0x1befe3,null))[_0x64af('0x46')](handleError(_0x1befe3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7a19e73..e94daa9 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 _0xefdd=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','lodash'];(function(_0x3be2ae,_0x18e6cf){var _0x39fff1=function(_0x3ad8fd){while(--_0x3ad8fd){_0x3be2ae['push'](_0x3be2ae['shift']());}};_0x39fff1(++_0x18e6cf);}(_0xefdd,0x167));var _0xdefd=function(_0x1f350e,_0x2e0069){_0x1f350e=_0x1f350e-0x0;var _0x131263=_0xefdd[_0x1f350e];return _0x131263;};'use strict';var _=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var logger=require(_0xdefd('0x2'))(_0xdefd('0x3'));var moment=require(_0xdefd('0x4'));var BPromise=require(_0xdefd('0x5'));var rp=require(_0xdefd('0x6'));var fs=require('fs');var path=require(_0xdefd('0x7'));var rimraf=require('rimraf');var config=require(_0xdefd('0x8'));var attributes=require(_0xdefd('0x9'));module[_0xdefd('0xa')]=function(_0x5aee8b,_0x7e0b6f){return _0x5aee8b[_0xdefd('0xb')](_0xdefd('0xc'),attributes,{'tableName':_0xdefd('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xdefd('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd56=['define','sugarcrm_unique_index','idField','util','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcd56,0x107));var _0x6cd5=function(_0x2dfbe5,_0x566aab){_0x2dfbe5=_0x2dfbe5-0x0;var _0x437e72=_0xcd56[_0x2dfbe5];return _0x437e72;};'use strict';var _=require('lodash');var util=require(_0x6cd5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6cd5('0x1'));var BPromise=require(_0x6cd5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cd5('0x3'));var rimraf=require(_0x6cd5('0x4'));var config=require(_0x6cd5('0x5'));var attributes=require(_0x6cd5('0x6'));module['exports']=function(_0x391d23,_0x610843){return _0x391d23[_0x6cd5('0x7')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6cd5('0x8'),'fields':[_0x6cd5('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 8949078..6ab6567 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 _0x41d1=['SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x158b25,_0x2d3453){var _0x3a8bd8=function(_0x4ef65b){while(--_0x4ef65b){_0x158b25['push'](_0x158b25['shift']());}};_0x3a8bd8(++_0x2d3453);}(_0x41d1,0x93));var _0x141d=function(_0x3ba9ec,_0x49c244){_0x3ba9ec=_0x3ba9ec-0x0;var _0x39f681=_0x41d1[_0x3ba9ec];return _0x39f681;};'use strict';var _=require(_0x141d('0x0'));var util=require(_0x141d('0x1'));var moment=require(_0x141d('0x2'));var BPromise=require(_0x141d('0x3'));var rs=require(_0x141d('0x4'));var fs=require('fs');var Redis=require(_0x141d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x141d('0x6'))('rpc');var config=require(_0x141d('0x7'));var jayson=require(_0x141d('0x8'));var client=jayson['client'][_0x141d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4674ca,_0x1ec9c9,_0x51ac50){return new BPromise(function(_0x5320e0,_0x5428f5){return client[_0x141d('0xa')](_0x4674ca,_0x51ac50)[_0x141d('0xb')](function(_0x342da9){logger[_0x141d('0xc')](_0x141d('0xd'),_0x1ec9c9,_0x141d('0xe'));logger['debug'](_0x141d('0xf'),_0x1ec9c9,'request\x20sent',JSON['stringify'](_0x342da9));if(_0x342da9[_0x141d('0x10')]){if(_0x342da9[_0x141d('0x10')][_0x141d('0x11')]===0x1f4){logger[_0x141d('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x1ec9c9,_0x342da9[_0x141d('0x10')][_0x141d('0x12')]);return _0x5428f5(_0x342da9[_0x141d('0x10')][_0x141d('0x12')]);}logger[_0x141d('0x10')](_0x141d('0xd'),_0x1ec9c9,_0x342da9[_0x141d('0x10')][_0x141d('0x12')]);return _0x5320e0(_0x342da9['error'][_0x141d('0x12')]);}else{logger[_0x141d('0xc')](_0x141d('0xd'),_0x1ec9c9,_0x141d('0xe'));_0x5320e0(_0x342da9['result'][_0x141d('0x12')]);}})[_0x141d('0x13')](function(_0x560370){logger['error'](_0x141d('0xd'),_0x1ec9c9,_0x560370);_0x5428f5(_0x560370);});});} \ No newline at end of file +var _0x1045=['../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1045,0x68));var _0x5104=function(_0xe39a97,_0x569662){_0xe39a97=_0xe39a97-0x0;var _0x156eff=_0x1045[_0xe39a97];return _0x156eff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5104('0x0'));var BPromise=require(_0x5104('0x1'));var rs=require(_0x5104('0x2'));var fs=require('fs');var Redis=require(_0x5104('0x3'));var db=require(_0x5104('0x4'))['db'];var utils=require(_0x5104('0x5'));var logger=require(_0x5104('0x6'))('rpc');var config=require(_0x5104('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5104('0x8')][_0x5104('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4083c2,_0x4708dc,_0x52e610){return new BPromise(function(_0x1f95d8,_0x42cd02){return client[_0x5104('0xa')](_0x4083c2,_0x52e610)[_0x5104('0xb')](function(_0x98b0d){logger[_0x5104('0xc')](_0x5104('0xd'),_0x4708dc,_0x5104('0xe'));logger[_0x5104('0xf')](_0x5104('0x10'),_0x4708dc,_0x5104('0xe'),JSON['stringify'](_0x98b0d));if(_0x98b0d[_0x5104('0x11')]){if(_0x98b0d[_0x5104('0x11')][_0x5104('0x12')]===0x1f4){logger['error'](_0x5104('0xd'),_0x4708dc,_0x98b0d['error'][_0x5104('0x13')]);return _0x42cd02(_0x98b0d['error'][_0x5104('0x13')]);}logger[_0x5104('0x11')](_0x5104('0xd'),_0x4708dc,_0x98b0d[_0x5104('0x11')][_0x5104('0x13')]);return _0x1f95d8(_0x98b0d[_0x5104('0x11')][_0x5104('0x13')]);}else{logger[_0x5104('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x4708dc,_0x5104('0xe'));_0x1f95d8(_0x98b0d[_0x5104('0x14')][_0x5104('0x13')]);}})[_0x5104('0x15')](function(_0x2f0084){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4708dc,_0x2f0084);_0x42cd02(_0x2f0084);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4221d8c..7cdfa0f 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 _0x0a62=['Router','fs-extra','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1e2c04,_0x7d2021){var _0x1b596f=function(_0x2ae1a2){while(--_0x2ae1a2){_0x1e2c04['push'](_0x1e2c04['shift']());}};_0x1b596f(++_0x7d2021);}(_0x0a62,0x119));var _0x20a6=function(_0x85cb49,_0x50a08a){_0x85cb49=_0x85cb49-0x0;var _0x52f463=_0x0a62[_0x85cb49];return _0x52f463;};'use strict';var multer=require(_0x20a6('0x0'));var util=require(_0x20a6('0x1'));var path=require(_0x20a6('0x2'));var timeout=require(_0x20a6('0x3'));var express=require(_0x20a6('0x4'));var router=express[_0x20a6('0x5')]();var fs_extra=require(_0x20a6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x20a6('0x7'));var controller=require(_0x20a6('0x8'));router['get']('/',auth[_0x20a6('0x9')](),controller[_0x20a6('0xa')]);router[_0x20a6('0xb')](_0x20a6('0xc'),auth[_0x20a6('0x9')](),controller[_0x20a6('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x20a6('0xb')](_0x20a6('0xe'),auth[_0x20a6('0x9')](),controller[_0x20a6('0xf')]);router['post']('/',auth[_0x20a6('0x9')](),controller[_0x20a6('0x10')]);router[_0x20a6('0x11')](_0x20a6('0x12'),auth[_0x20a6('0x9')](),controller['addConfiguration']);router['put'](_0x20a6('0xc'),auth[_0x20a6('0x9')](),controller[_0x20a6('0x13')]);router[_0x20a6('0x14')](_0x20a6('0xc'),auth[_0x20a6('0x9')](),controller[_0x20a6('0x15')]);module['exports']=router; \ No newline at end of file +var _0x394e=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xc54563,_0x438d27){var _0xb9b8aa=function(_0x45a187){while(--_0x45a187){_0xc54563['push'](_0xc54563['shift']());}};_0xb9b8aa(++_0x438d27);}(_0x394e,0x88));var _0xe394=function(_0x245327,_0x2bbe5f){_0x245327=_0x245327-0x0;var _0x4d441c=_0x394e[_0x245327];return _0x4d441c;};'use strict';var multer=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var path=require('path');var timeout=require(_0xe394('0x2'));var express=require(_0xe394('0x3'));var router=express[_0xe394('0x4')]();var fs_extra=require(_0xe394('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var controller=require(_0xe394('0x8'));router[_0xe394('0x9')]('/',auth[_0xe394('0xa')](),controller[_0xe394('0xb')]);router[_0xe394('0x9')](_0xe394('0xc'),auth[_0xe394('0xa')](),controller[_0xe394('0xd')]);router[_0xe394('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe394('0x9')](_0xe394('0xe'),auth[_0xe394('0xa')](),controller[_0xe394('0xf')]);router[_0xe394('0x10')]('/',auth[_0xe394('0xa')](),controller[_0xe394('0x11')]);router[_0xe394('0x10')](_0xe394('0x12'),auth[_0xe394('0xa')](),controller[_0xe394('0x13')]);router[_0xe394('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe394('0x15')](_0xe394('0xc'),auth['isAuthenticated'](),controller[_0xe394('0x16')]);module[_0xe394('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index dfb9e22..1af879c 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 _0xf1c9=['exports','STRING','HelpDesk','sequelize'];(function(_0x3e5de0,_0x1942a4){var _0x6a1dfb=function(_0x59f260){while(--_0x59f260){_0x3e5de0['push'](_0x3e5de0['shift']());}};_0x6a1dfb(++_0x1942a4);}(_0xf1c9,0xf3));var _0x9f1c=function(_0x1effe5,_0x508d5d){_0x1effe5=_0x1effe5-0x0;var _0x5aaae4=_0xf1c9[_0x1effe5];return _0x5aaae4;};'use strict';var Sequelize=require(_0x9f1c('0x0'));module[_0x9f1c('0x1')]={'name':{'type':Sequelize[_0x9f1c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9f1c('0x2')]},'username':{'type':Sequelize[_0x9f1c('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f1c('0x3')},'remoteUri':{'type':Sequelize[_0x9f1c('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9f1c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b2d=['sequelize','STRING','HelpDesk'];(function(_0x2e1dae,_0x4d703e){var _0x444954=function(_0x4cd25b){while(--_0x4cd25b){_0x2e1dae['push'](_0x2e1dae['shift']());}};_0x444954(++_0x4d703e);}(_0x5b2d,0x108));var _0xd5b2=function(_0x484613,_0x1d6ae0){_0x484613=_0x484613-0x0;var _0x46812f=_0x5b2d[_0x484613];return _0x46812f;};'use strict';var Sequelize=require(_0xd5b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xd5b2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd5b2('0x1')]},'username':{'type':Sequelize[_0xd5b2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd5b2('0x1')],'allowNull':![],'defaultValue':_0xd5b2('0x2')},'remoteUri':{'type':Sequelize[_0xd5b2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd5b2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd5b2('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 8f76c23..1c2d60b 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 _0xd34b=['body','destroy','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','token','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','options','then','VtigerAccount','findAll','catch','show','params','includeAll','find','create'];(function(_0x52e42b,_0x1fb85b){var _0x34e29a=function(_0x330762){while(--_0x330762){_0x52e42b['push'](_0x52e42b['shift']());}};_0x34e29a(++_0x1fb85b);}(_0xd34b,0xad));var _0xbd34=function(_0x45a98f,_0x306005){_0x45a98f=_0x45a98f-0x0;var _0x557328=_0xd34b[_0x45a98f];return _0x557328;};'use strict';var emlformat=require(_0xbd34('0x0'));var rimraf=require(_0xbd34('0x1'));var zipdir=require(_0xbd34('0x2'));var jsonpatch=require(_0xbd34('0x3'));var rp=require(_0xbd34('0x4'));var moment=require(_0xbd34('0x5'));var BPromise=require(_0xbd34('0x6'));var Mustache=require(_0xbd34('0x7'));var util=require(_0xbd34('0x8'));var path=require(_0xbd34('0x9'));var sox=require(_0xbd34('0xa'));var csv=require(_0xbd34('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd34('0xc'));var _=require(_0xbd34('0xd'));var squel=require(_0xbd34('0xe'));var crypto=require(_0xbd34('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbd34('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbd34('0x11'));var Papa=require(_0xbd34('0x12'));var Redis=require(_0xbd34('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd34('0x14'));var as=require(_0xbd34('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd34('0x16'))('api');var utils=require(_0xbd34('0x17'));var config=require(_0xbd34('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd34('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c8a8e,_0x5cff8a){_0x5cff8a=_0x5cff8a||0xcc;return function(_0x58b1f5){if(_0x58b1f5){return _0x1c8a8e[_0xbd34('0x1a')](_0x5cff8a);}return _0x1c8a8e[_0xbd34('0x1b')](_0x5cff8a)[_0xbd34('0x1c')]();};}function respondWithResult(_0x431413,_0x3d3bfb){_0x3d3bfb=_0x3d3bfb||0xc8;return function(_0x4712bb){if(_0x4712bb){return _0x431413[_0xbd34('0x1b')](_0x3d3bfb)['json'](_0x4712bb);}};}function respondWithFilteredResult(_0x582089,_0xa0513c){return function(_0xe8469b){if(_0xe8469b){var _0x3b6e69=typeof _0xa0513c[_0xbd34('0x1d')]==='undefined'&&typeof _0xa0513c[_0xbd34('0x1e')]===_0xbd34('0x1f');var _0x43174b=_0xe8469b['count'];var _0x10b578=_0x3b6e69?0x0:_0xa0513c['offset'];var _0x2b1b76=_0x3b6e69?_0xe8469b[_0xbd34('0x20')]:_0xa0513c[_0xbd34('0x1d')]+_0xa0513c[_0xbd34('0x1e')];var _0xdceb2d;if(_0x2b1b76>=_0x43174b){_0x2b1b76=_0x43174b;_0xdceb2d=0xc8;}else{_0xdceb2d=0xce;}_0x582089[_0xbd34('0x1b')](_0xdceb2d);return _0x582089[_0xbd34('0x21')](_0xbd34('0x22'),_0x10b578+'-'+_0x2b1b76+'/'+_0x43174b)['json'](_0xe8469b);}return null;};}function patchUpdates(_0x3e95d2){return function(_0x16182e){try{jsonpatch[_0xbd34('0x23')](_0x16182e,_0x3e95d2,!![]);}catch(_0x288153){return BPromise['reject'](_0x288153);}return _0x16182e['save']();};}function saveUpdates(_0x5e5c7c,_0x586f12){return function(_0x5a4878){if(_0x5a4878){return _0x5a4878['update'](_0x5e5c7c)['then'](function(_0xeaf94e){return _0xeaf94e;});}return null;};}function removeEntity(_0x1aa5a8,_0x54f783){return function(_0xcaf440){if(_0xcaf440){return _0xcaf440['destroy']()['then'](function(){_0x1aa5a8['status'](0xcc)[_0xbd34('0x1c')]();});}};}function handleEntityNotFound(_0x4f44eb,_0x2a3877){return function(_0xb39e93){if(!_0xb39e93){_0x4f44eb[_0xbd34('0x1a')](0x194);}return _0xb39e93;};}function handleError(_0x3d220d,_0x199fbc){_0x199fbc=_0x199fbc||0x1f4;return function(_0x15399b){logger[_0xbd34('0x24')](_0x15399b[_0xbd34('0x25')]);if(_0x15399b['name']){delete _0x15399b[_0xbd34('0x26')];}_0x3d220d[_0xbd34('0x1b')](_0x199fbc)[_0xbd34('0x27')](_0x15399b);};}exports[_0xbd34('0x28')]=function(_0x2a0f3,_0x5a03bf){var _0x1c44e4={},_0x2111f3={},_0x2cf821={'count':0x0,'rows':[]};var _0x1a7639=_[_0xbd34('0x29')](db['VtigerAccount'][_0xbd34('0x2a')],function(_0x10126a){return{'name':_0x10126a['fieldName'],'type':_0x10126a['type'][_0xbd34('0x2b')]};});_0x2111f3[_0xbd34('0x2c')]=_['map'](_0x1a7639,_0xbd34('0x26'));_0x2111f3[_0xbd34('0x2d')]=_[_0xbd34('0x2e')](_0x2a0f3['query']);_0x2111f3['filters']=_[_0xbd34('0x2f')](_0x2111f3[_0xbd34('0x2c')],_0x2111f3['query']);_0x1c44e4['attributes']=_[_0xbd34('0x2f')](_0x2111f3[_0xbd34('0x2c')],qs[_0xbd34('0x30')](_0x2a0f3['query']['fields']));_0x1c44e4[_0xbd34('0x31')]=_0x1c44e4[_0xbd34('0x31')][_0xbd34('0x32')]?_0x1c44e4[_0xbd34('0x31')]:_0x2111f3[_0xbd34('0x2c')];if(!_0x2a0f3[_0xbd34('0x2d')]['hasOwnProperty'](_0xbd34('0x33'))){_0x1c44e4[_0xbd34('0x1e')]=qs[_0xbd34('0x1e')](_0x2a0f3[_0xbd34('0x2d')][_0xbd34('0x1e')]);_0x1c44e4[_0xbd34('0x1d')]=qs[_0xbd34('0x1d')](_0x2a0f3[_0xbd34('0x2d')][_0xbd34('0x1d')]);}_0x1c44e4['order']=qs[_0xbd34('0x34')](_0x2a0f3[_0xbd34('0x2d')][_0xbd34('0x34')]);_0x1c44e4[_0xbd34('0x35')]=qs[_0xbd34('0x36')](_[_0xbd34('0x37')](_0x2a0f3[_0xbd34('0x2d')],_0x2111f3[_0xbd34('0x36')]),_0x1a7639);if(_0x2a0f3[_0xbd34('0x2d')][_0xbd34('0x38')]){_0x1c44e4[_0xbd34('0x35')]=_[_0xbd34('0x39')](_0x1c44e4['where'],{'$or':_['map'](_0x1a7639,function(_0x4edb64){if(_0x4edb64[_0xbd34('0x3a')]!=='VIRTUAL'){var _0x5d3dbf={};_0x5d3dbf[_0x4edb64[_0xbd34('0x26')]]={'$like':'%'+_0x2a0f3[_0xbd34('0x2d')][_0xbd34('0x38')]+'%'};return _0x5d3dbf;}})});}_0x1c44e4=_['merge']({},_0x1c44e4,_0x2a0f3[_0xbd34('0x3b')]);var _0x47fbd9={'where':_0x1c44e4[_0xbd34('0x35')]};return db['VtigerAccount'][_0xbd34('0x20')](_0x47fbd9)[_0xbd34('0x3c')](function(_0x11c117){_0x2cf821['count']=_0x11c117;if(_0x2a0f3['query']['includeAll']){_0x1c44e4['include']=[{'all':!![]}];}return db[_0xbd34('0x3d')][_0xbd34('0x3e')](_0x1c44e4);})['then'](function(_0x32b6f3){_0x2cf821['rows']=_0x32b6f3;return _0x2cf821;})[_0xbd34('0x3c')](respondWithFilteredResult(_0x5a03bf,_0x1c44e4))[_0xbd34('0x3f')](handleError(_0x5a03bf,null));};exports[_0xbd34('0x40')]=function(_0x2d4253,_0x2592c3){var _0x56186a={'raw':![],'where':{'id':_0x2d4253[_0xbd34('0x41')]['id']}},_0xc961ba={};_0xc961ba[_0xbd34('0x2c')]=_['keys'](db[_0xbd34('0x3d')]['rawAttributes']);_0xc961ba[_0xbd34('0x2d')]=_[_0xbd34('0x2e')](_0x2d4253['query']);_0xc961ba['filters']=_['intersection'](_0xc961ba[_0xbd34('0x2c')],_0xc961ba[_0xbd34('0x2d')]);_0x56186a[_0xbd34('0x31')]=_[_0xbd34('0x2f')](_0xc961ba['model'],qs['fields'](_0x2d4253[_0xbd34('0x2d')]['fields']));_0x56186a[_0xbd34('0x31')]=_0x56186a[_0xbd34('0x31')][_0xbd34('0x32')]?_0x56186a[_0xbd34('0x31')]:_0xc961ba[_0xbd34('0x2c')];if(_0x2d4253[_0xbd34('0x2d')][_0xbd34('0x42')]){_0x56186a['include']=[{'all':!![]}];}_0x56186a=_[_0xbd34('0x39')]({},_0x56186a,_0x2d4253[_0xbd34('0x3b')]);return db[_0xbd34('0x3d')][_0xbd34('0x43')](_0x56186a)[_0xbd34('0x3c')](handleEntityNotFound(_0x2592c3,null))[_0xbd34('0x3c')](respondWithResult(_0x2592c3,null))['catch'](handleError(_0x2592c3,null));};exports[_0xbd34('0x44')]=function(_0x1ae5ee,_0x482ac1){return db[_0xbd34('0x3d')][_0xbd34('0x44')](_0x1ae5ee[_0xbd34('0x45')],{})[_0xbd34('0x3c')](respondWithResult(_0x482ac1,0xc9))[_0xbd34('0x3f')](handleError(_0x482ac1,null));};exports['update']=function(_0x51b27a,_0x49bfaf){if(_0x51b27a['body']['id']){delete _0x51b27a[_0xbd34('0x45')]['id'];}return db[_0xbd34('0x3d')]['find']({'where':{'id':_0x51b27a[_0xbd34('0x41')]['id']}})[_0xbd34('0x3c')](handleEntityNotFound(_0x49bfaf,null))['then'](saveUpdates(_0x51b27a[_0xbd34('0x45')],null))[_0xbd34('0x3c')](respondWithResult(_0x49bfaf,null))['catch'](handleError(_0x49bfaf,null));};exports[_0xbd34('0x46')]=function(_0xeaae1a,_0x34c62e){return db[_0xbd34('0x3d')][_0xbd34('0x43')]({'where':{'id':_0xeaae1a[_0xbd34('0x41')]['id']}})[_0xbd34('0x3c')](handleEntityNotFound(_0x34c62e,null))[_0xbd34('0x3c')](removeEntity(_0x34c62e,null))[_0xbd34('0x3f')](handleError(_0x34c62e,null));};exports[_0xbd34('0x47')]=function(_0x3f957f,_0x38d2fb,_0x59f3c){var _0x351776={};var _0x331805={};var _0x182071;var _0x149aaa;return db['VtigerAccount'][_0xbd34('0x48')]({'where':{'id':_0x3f957f[_0xbd34('0x41')]['id']}})['then'](handleEntityNotFound(_0x38d2fb,null))[_0xbd34('0x3c')](function(_0x5df6d0){if(_0x5df6d0){_0x182071=_0x5df6d0;_0x331805['model']=_['keys'](db[_0xbd34('0x49')][_0xbd34('0x2a')]);_0x331805['query']=_[_0xbd34('0x2e')](_0x3f957f[_0xbd34('0x2d')]);_0x331805[_0xbd34('0x36')]=_[_0xbd34('0x2f')](_0x331805['model'],_0x331805['query']);_0x351776['attributes']=_['intersection'](_0x331805[_0xbd34('0x2c')],qs[_0xbd34('0x30')](_0x3f957f[_0xbd34('0x2d')][_0xbd34('0x30')]));_0x351776[_0xbd34('0x31')]=_0x351776['attributes']['length']?_0x351776[_0xbd34('0x31')]:_0x331805['model'];_0x351776[_0xbd34('0x4a')]=qs['sort'](_0x3f957f[_0xbd34('0x2d')]['sort']);_0x351776[_0xbd34('0x35')]=qs['filters'](_[_0xbd34('0x37')](_0x3f957f[_0xbd34('0x2d')],_0x331805['filters']));if(_0x3f957f[_0xbd34('0x2d')][_0xbd34('0x38')]){_0x351776[_0xbd34('0x35')]=_[_0xbd34('0x39')](_0x351776[_0xbd34('0x35')],{'$or':_['map'](_0x351776[_0xbd34('0x31')],function(_0x1b9dfd){var _0x4a1204={};_0x4a1204[_0x1b9dfd]={'$like':'%'+_0x3f957f['query'][_0xbd34('0x38')]+'%'};return _0x4a1204;})});}_0x351776=_[_0xbd34('0x39')]({},_0x351776,_0x3f957f[_0xbd34('0x3b')]);return _0x182071[_0xbd34('0x47')](_0x351776);}})['then'](function(_0x1d972b){if(_0x1d972b){_0x149aaa=_0x1d972b[_0xbd34('0x32')];if(!_0x3f957f[_0xbd34('0x2d')][_0xbd34('0x4b')](_0xbd34('0x33'))){_0x351776[_0xbd34('0x1e')]=qs[_0xbd34('0x1e')](_0x3f957f[_0xbd34('0x2d')][_0xbd34('0x1e')]);_0x351776[_0xbd34('0x1d')]=qs[_0xbd34('0x1d')](_0x3f957f[_0xbd34('0x2d')]['offset']);}return _0x182071[_0xbd34('0x47')](_0x351776);}})['then'](function(_0x5a9ad7){if(_0x5a9ad7){return _0x5a9ad7?{'count':_0x149aaa,'rows':_0x5a9ad7}:null;}})[_0xbd34('0x3c')](respondWithResult(_0x38d2fb,null))[_0xbd34('0x3f')](handleError(_0x38d2fb,null));};exports[_0xbd34('0x4c')]=function(_0x4730ac,_0x1fd9db,_0x1308b4){if(_0x4730ac[_0xbd34('0x45')]['id']){delete _0x4730ac[_0xbd34('0x45')]['id'];}return db['VtigerAccount'][_0xbd34('0x48')]({'where':{'id':_0x4730ac['params']['id']}})[_0xbd34('0x3c')](handleEntityNotFound(_0x1fd9db,null))[_0xbd34('0x3c')](function(_0x4f39ea){if(_0x4f39ea){_0x4730ac['body'][_0xbd34('0x4d')]=_0x4f39ea['id'];_0x4730ac[_0xbd34('0x45')][_0xbd34('0x4e')]=integrations[_0xbd34('0x4f')](_0x4730ac['body'][_0xbd34('0x50')],_0x4730ac[_0xbd34('0x45')]['type']);_0x4730ac[_0xbd34('0x45')][_0xbd34('0x51')]=integrations[_0xbd34('0x52')](_0x4730ac[_0xbd34('0x45')][_0xbd34('0x50')],_0x4730ac[_0xbd34('0x45')][_0xbd34('0x3a')]);return db[_0xbd34('0x49')]['create'](_0x4730ac['body'],{'include':[{'model':db[_0xbd34('0x53')],'as':_0xbd34('0x4e')},{'model':db[_0xbd34('0x53')],'as':_0xbd34('0x51')}]});}return null;})[_0xbd34('0x3c')](respondWithResult(_0x1fd9db,null))['catch'](handleError(_0x1fd9db,null));};var md5=require(_0xbd34('0x54'));exports[_0xbd34('0x55')]=function(_0x154098,_0x42b718,_0x2fae32){var _0x5d562b=null;var _0x2a549b=null;var _0x5318d5=null;var _0x3785f5=null;var _0x21ae67='';return db['VtigerAccount'][_0xbd34('0x48')]({'where':{'id':_0x154098[_0xbd34('0x41')]['id']},'attributes':['id',_0xbd34('0x26'),_0xbd34('0x56'),_0xbd34('0x57'),_0xbd34('0x58'),_0xbd34('0x59'),_0xbd34('0x5a'),_0xbd34('0x5b')]})[_0xbd34('0x3c')](handleEntityNotFound(_0x42b718,null))[_0xbd34('0x3c')](function(_0x274aa6){if(_0x274aa6){_0x5d562b=_0x274aa6[_0xbd34('0x56')];_0x2a549b=_0x274aa6[_0xbd34('0x5b')];_0x5318d5=_0x274aa6[_0xbd34('0x58')];_0x21ae67=_0x274aa6[_0xbd34('0x59')];var _0x6e8ec3=_0x21ae67['slice'](-0x1);if(_0x6e8ec3==='/'){_0x21ae67=_0x21ae67[_0xbd34('0x5c')](0x0,_0x21ae67[_0xbd34('0x5d')](_0x6e8ec3));}_0x3785f5=util['format'](_0xbd34('0x5e'),_0x21ae67);var _0x7929e8={'method':_0xbd34('0x5f'),'uri':_0x3785f5,'qs':{'operation':_0xbd34('0x60'),'username':_0x274aa6[_0xbd34('0x56')]},'json':!![]};return rp(_0x7929e8);}})['then'](function(_0x56051e){if(_0x56051e[_0xbd34('0x61')]){var _0x4367f7={'method':_0xbd34('0x62'),'uri':_0x3785f5,'form':{'operation':_0xbd34('0x63'),'username':_0x5d562b,'accessKey':md5(_0x56051e['result'][_0xbd34('0x64')]+_0x2a549b)},'json':!![]};return rp(_0x4367f7);}})[_0xbd34('0x3c')](function(_0x32fd8d){if(_0x32fd8d['success']){var _0x48104={'method':'GET','uri':_0x3785f5,'qs':{'operation':'describe','username':_0x5d562b,'sessionName':_0x32fd8d[_0xbd34('0x65')][_0xbd34('0x66')],'elementType':_0x5318d5},'json':!![]};return rp(_0x48104);}})['then'](function(_0x4166bc){if(_0x4166bc[_0xbd34('0x61')]){var _0xc271cd=[_0xbd34('0x67'),_0xbd34('0x68'),_0xbd34('0x69')];_[_0xbd34('0x6a')](_0x4166bc[_0xbd34('0x65')][_0xbd34('0x30')],function(_0x5b0875){return _0xc271cd[_0xbd34('0x6b')](_0x5b0875[_0xbd34('0x3a')][_0xbd34('0x26')]);});_['remove'](_0x4166bc[_0xbd34('0x65')][_0xbd34('0x30')],function(_0x4cc980){return _0x4cc980[_0xbd34('0x6c')]===_0xbd34('0x6d');});return{'count':_0x4166bc[_0xbd34('0x65')][_0xbd34('0x30')][_0xbd34('0x32')],'rows':_['map'](_0x4166bc[_0xbd34('0x65')][_0xbd34('0x30')],function(_0x926516){return{'id':_0x926516[_0xbd34('0x26')],'name':_0x926516[_0xbd34('0x6e')],'custom':_[_0xbd34('0x6f')](_0x926516[_0xbd34('0x26')],_0xbd34('0x70'))?!![]:![],'options':_0x926516['type'][_0xbd34('0x26')]===_0xbd34('0x71')&&_0x926516[_0xbd34('0x3a')][_0xbd34('0x72')][_0xbd34('0x32')]>0x0?_[_0xbd34('0x29')](_0x926516[_0xbd34('0x3a')][_0xbd34('0x72')],function(_0x318a56){return{'name':_0x318a56[_0xbd34('0x6e')],'value':_0x318a56[_0xbd34('0x73')]};}):[]};})};}})['then'](respondWithResult(_0x42b718,null))[_0xbd34('0x3f')](function(_0x5b749a){console[_0xbd34('0x74')]('vTiger\x20error:\x20'+_0x5b749a);var _0x353e8b=_0x154098[_0xbd34('0x2d')][_0xbd34('0x75')]?0x1f4:_0x5b749a[_0xbd34('0x76')]||0x1f4;logger[_0xbd34('0x24')](_0xbd34('0x77'),'getFields',_0x353e8b,JSON['stringify'](_0x5b749a));delete _0x5b749a['name'];if(_0x353e8b===0x191){_0x353e8b=0x190;}_0x42b718['status'](_0x353e8b)[_0xbd34('0x27')](_0x154098[_0xbd34('0x2d')][_0xbd34('0x75')]?{'message':_0xbd34('0x78'),'statusCode':_0x5b749a['statusCode']}:_0x5b749a);});}; \ No newline at end of file +var _0xe515=['value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','VtigerAccount','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','sort','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','cf_','picklist','picklistValues'];(function(_0x53ab50,_0x44f989){var _0x51aa0f=function(_0x2af16f){while(--_0x2af16f){_0x53ab50['push'](_0x53ab50['shift']());}};_0x51aa0f(++_0x44f989);}(_0xe515,0x17f));var _0x5e51=function(_0x55f7a3,_0x1563bf){_0x55f7a3=_0x55f7a3-0x0;var _0x4b6edc=_0xe515[_0x55f7a3];return _0x4b6edc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e51('0x0'));var zipdir=require(_0x5e51('0x1'));var jsonpatch=require(_0x5e51('0x2'));var rp=require('request-promise');var moment=require(_0x5e51('0x3'));var BPromise=require(_0x5e51('0x4'));var Mustache=require(_0x5e51('0x5'));var util=require(_0x5e51('0x6'));var path=require(_0x5e51('0x7'));var sox=require('sox');var csv=require(_0x5e51('0x8'));var ejs=require(_0x5e51('0x9'));var fs=require('fs');var fs_extra=require(_0x5e51('0xa'));var _=require(_0x5e51('0xb'));var squel=require('squel');var crypto=require(_0x5e51('0xc'));var jsforce=require(_0x5e51('0xd'));var deskjs=require(_0x5e51('0xe'));var toCsv=require(_0x5e51('0x8'));var querystring=require(_0x5e51('0xf'));var Papa=require(_0x5e51('0x10'));var Redis=require('ioredis');var authService=require(_0x5e51('0x11'));var qs=require(_0x5e51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e51('0x13'))(_0x5e51('0x14'));var utils=require(_0x5e51('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5e51('0x16'));var db=require(_0x5e51('0x17'))['db'];var integrations=require(_0x5e51('0x18'));function respondWithStatusCode(_0x2925ce,_0x18447c){_0x18447c=_0x18447c||0xcc;return function(_0x1be78d){if(_0x1be78d){return _0x2925ce[_0x5e51('0x19')](_0x18447c);}return _0x2925ce['status'](_0x18447c)[_0x5e51('0x1a')]();};}function respondWithResult(_0x371c08,_0x421eed){_0x421eed=_0x421eed||0xc8;return function(_0x14c191){if(_0x14c191){return _0x371c08[_0x5e51('0x1b')](_0x421eed)[_0x5e51('0x1c')](_0x14c191);}};}function respondWithFilteredResult(_0x1ba673,_0x9a5d65){return function(_0x526db2){if(_0x526db2){var _0x384c38=typeof _0x9a5d65[_0x5e51('0x1d')]===_0x5e51('0x1e')&&typeof _0x9a5d65['limit']==='undefined';var _0x7ec911=_0x526db2['count'];var _0xc63954=_0x384c38?0x0:_0x9a5d65['offset'];var _0x183881=_0x384c38?_0x526db2['count']:_0x9a5d65[_0x5e51('0x1d')]+_0x9a5d65[_0x5e51('0x1f')];var _0x5b588c;if(_0x183881>=_0x7ec911){_0x183881=_0x7ec911;_0x5b588c=0xc8;}else{_0x5b588c=0xce;}_0x1ba673['status'](_0x5b588c);return _0x1ba673[_0x5e51('0x20')](_0x5e51('0x21'),_0xc63954+'-'+_0x183881+'/'+_0x7ec911)['json'](_0x526db2);}return null;};}function patchUpdates(_0x1f2086){return function(_0x1d810e){try{jsonpatch[_0x5e51('0x22')](_0x1d810e,_0x1f2086,!![]);}catch(_0x36c3de){return BPromise[_0x5e51('0x23')](_0x36c3de);}return _0x1d810e[_0x5e51('0x24')]();};}function saveUpdates(_0x59b7aa,_0x2b9b3c){return function(_0x1b4a1c){if(_0x1b4a1c){return _0x1b4a1c[_0x5e51('0x25')](_0x59b7aa)['then'](function(_0x39bc4d){return _0x39bc4d;});}return null;};}function removeEntity(_0x4ca65d,_0x4465e7){return function(_0x5b6d53){if(_0x5b6d53){return _0x5b6d53[_0x5e51('0x26')]()[_0x5e51('0x27')](function(){_0x4ca65d[_0x5e51('0x1b')](0xcc)[_0x5e51('0x1a')]();});}};}function handleEntityNotFound(_0x570599,_0x1060f5){return function(_0x31209b){if(!_0x31209b){_0x570599[_0x5e51('0x19')](0x194);}return _0x31209b;};}function handleError(_0x16d31e,_0x36e299){_0x36e299=_0x36e299||0x1f4;return function(_0x5cc59b){logger[_0x5e51('0x28')](_0x5cc59b[_0x5e51('0x29')]);if(_0x5cc59b[_0x5e51('0x2a')]){delete _0x5cc59b['name'];}_0x16d31e[_0x5e51('0x1b')](_0x36e299)[_0x5e51('0x2b')](_0x5cc59b);};}exports[_0x5e51('0x2c')]=function(_0x3c577f,_0x42d8b7){var _0x338e29={},_0x512dea={},_0x3e27d8={'count':0x0,'rows':[]};var _0x52b698=_[_0x5e51('0x2d')](db['VtigerAccount'][_0x5e51('0x2e')],function(_0x3386ba){return{'name':_0x3386ba['fieldName'],'type':_0x3386ba[_0x5e51('0x2f')][_0x5e51('0x30')]};});_0x512dea['model']=_[_0x5e51('0x2d')](_0x52b698,'name');_0x512dea['query']=_[_0x5e51('0x31')](_0x3c577f[_0x5e51('0x32')]);_0x512dea[_0x5e51('0x33')]=_[_0x5e51('0x34')](_0x512dea[_0x5e51('0x35')],_0x512dea['query']);_0x338e29[_0x5e51('0x36')]=_[_0x5e51('0x34')](_0x512dea[_0x5e51('0x35')],qs['fields'](_0x3c577f[_0x5e51('0x32')][_0x5e51('0x37')]));_0x338e29['attributes']=_0x338e29[_0x5e51('0x36')]['length']?_0x338e29[_0x5e51('0x36')]:_0x512dea[_0x5e51('0x35')];if(!_0x3c577f[_0x5e51('0x32')][_0x5e51('0x38')](_0x5e51('0x39'))){_0x338e29[_0x5e51('0x1f')]=qs[_0x5e51('0x1f')](_0x3c577f[_0x5e51('0x32')][_0x5e51('0x1f')]);_0x338e29[_0x5e51('0x1d')]=qs[_0x5e51('0x1d')](_0x3c577f[_0x5e51('0x32')]['offset']);}_0x338e29[_0x5e51('0x3a')]=qs['sort'](_0x3c577f[_0x5e51('0x32')]['sort']);_0x338e29['where']=qs['filters'](_['pick'](_0x3c577f[_0x5e51('0x32')],_0x512dea[_0x5e51('0x33')]),_0x52b698);if(_0x3c577f['query'][_0x5e51('0x3b')]){_0x338e29[_0x5e51('0x3c')]=_['merge'](_0x338e29[_0x5e51('0x3c')],{'$or':_['map'](_0x52b698,function(_0x3d343b){if(_0x3d343b['type']!==_0x5e51('0x3d')){var _0x4960ce={};_0x4960ce[_0x3d343b[_0x5e51('0x2a')]]={'$like':'%'+_0x3c577f[_0x5e51('0x32')][_0x5e51('0x3b')]+'%'};return _0x4960ce;}})});}_0x338e29=_[_0x5e51('0x3e')]({},_0x338e29,_0x3c577f[_0x5e51('0x3f')]);var _0x3aa192={'where':_0x338e29[_0x5e51('0x3c')]};return db[_0x5e51('0x40')][_0x5e51('0x41')](_0x3aa192)[_0x5e51('0x27')](function(_0x1965ff){_0x3e27d8[_0x5e51('0x41')]=_0x1965ff;if(_0x3c577f[_0x5e51('0x32')][_0x5e51('0x42')]){_0x338e29[_0x5e51('0x43')]=[{'all':!![]}];}return db[_0x5e51('0x40')][_0x5e51('0x44')](_0x338e29);})[_0x5e51('0x27')](function(_0x5f2bfd){_0x3e27d8[_0x5e51('0x45')]=_0x5f2bfd;return _0x3e27d8;})[_0x5e51('0x27')](respondWithFilteredResult(_0x42d8b7,_0x338e29))[_0x5e51('0x46')](handleError(_0x42d8b7,null));};exports['show']=function(_0x26faf4,_0x21b6f4){var _0x4f6728={'raw':![],'where':{'id':_0x26faf4[_0x5e51('0x47')]['id']}},_0x47bfb4={};_0x47bfb4['model']=_['keys'](db['VtigerAccount'][_0x5e51('0x2e')]);_0x47bfb4['query']=_['keys'](_0x26faf4['query']);_0x47bfb4[_0x5e51('0x33')]=_[_0x5e51('0x34')](_0x47bfb4[_0x5e51('0x35')],_0x47bfb4[_0x5e51('0x32')]);_0x4f6728['attributes']=_[_0x5e51('0x34')](_0x47bfb4['model'],qs[_0x5e51('0x37')](_0x26faf4[_0x5e51('0x32')][_0x5e51('0x37')]));_0x4f6728[_0x5e51('0x36')]=_0x4f6728['attributes'][_0x5e51('0x48')]?_0x4f6728[_0x5e51('0x36')]:_0x47bfb4['model'];if(_0x26faf4['query'][_0x5e51('0x42')]){_0x4f6728['include']=[{'all':!![]}];}_0x4f6728=_['merge']({},_0x4f6728,_0x26faf4[_0x5e51('0x3f')]);return db[_0x5e51('0x40')][_0x5e51('0x49')](_0x4f6728)['then'](handleEntityNotFound(_0x21b6f4,null))['then'](respondWithResult(_0x21b6f4,null))[_0x5e51('0x46')](handleError(_0x21b6f4,null));};exports[_0x5e51('0x4a')]=function(_0x117ed8,_0x73b84){return db[_0x5e51('0x40')][_0x5e51('0x4a')](_0x117ed8['body'],{})[_0x5e51('0x27')](respondWithResult(_0x73b84,0xc9))[_0x5e51('0x46')](handleError(_0x73b84,null));};exports[_0x5e51('0x25')]=function(_0x2967b5,_0xf9967f){if(_0x2967b5[_0x5e51('0x4b')]['id']){delete _0x2967b5[_0x5e51('0x4b')]['id'];}return db['VtigerAccount'][_0x5e51('0x49')]({'where':{'id':_0x2967b5['params']['id']}})[_0x5e51('0x27')](handleEntityNotFound(_0xf9967f,null))[_0x5e51('0x27')](saveUpdates(_0x2967b5[_0x5e51('0x4b')],null))[_0x5e51('0x27')](respondWithResult(_0xf9967f,null))[_0x5e51('0x46')](handleError(_0xf9967f,null));};exports[_0x5e51('0x26')]=function(_0x34c0cc,_0x50330b){return db['VtigerAccount'][_0x5e51('0x49')]({'where':{'id':_0x34c0cc['params']['id']}})[_0x5e51('0x27')](handleEntityNotFound(_0x50330b,null))[_0x5e51('0x27')](removeEntity(_0x50330b,null))['catch'](handleError(_0x50330b,null));};exports[_0x5e51('0x4c')]=function(_0x48ffb2,_0x36953c,_0x4f172f){var _0x5de8a7={};var _0xa616cd={};var _0x1de445;var _0x103756;return db[_0x5e51('0x40')][_0x5e51('0x4d')]({'where':{'id':_0x48ffb2[_0x5e51('0x47')]['id']}})['then'](handleEntityNotFound(_0x36953c,null))[_0x5e51('0x27')](function(_0x5641f5){if(_0x5641f5){_0x1de445=_0x5641f5;_0xa616cd[_0x5e51('0x35')]=_['keys'](db[_0x5e51('0x4e')]['rawAttributes']);_0xa616cd[_0x5e51('0x32')]=_[_0x5e51('0x31')](_0x48ffb2[_0x5e51('0x32')]);_0xa616cd[_0x5e51('0x33')]=_[_0x5e51('0x34')](_0xa616cd[_0x5e51('0x35')],_0xa616cd[_0x5e51('0x32')]);_0x5de8a7[_0x5e51('0x36')]=_[_0x5e51('0x34')](_0xa616cd['model'],qs[_0x5e51('0x37')](_0x48ffb2[_0x5e51('0x32')][_0x5e51('0x37')]));_0x5de8a7['attributes']=_0x5de8a7[_0x5e51('0x36')][_0x5e51('0x48')]?_0x5de8a7[_0x5e51('0x36')]:_0xa616cd['model'];_0x5de8a7['order']=qs[_0x5e51('0x4f')](_0x48ffb2[_0x5e51('0x32')][_0x5e51('0x4f')]);_0x5de8a7[_0x5e51('0x3c')]=qs[_0x5e51('0x33')](_['pick'](_0x48ffb2[_0x5e51('0x32')],_0xa616cd[_0x5e51('0x33')]));if(_0x48ffb2['query'][_0x5e51('0x3b')]){_0x5de8a7[_0x5e51('0x3c')]=_[_0x5e51('0x3e')](_0x5de8a7['where'],{'$or':_[_0x5e51('0x2d')](_0x5de8a7[_0x5e51('0x36')],function(_0x4fddd4){var _0x5eaf02={};_0x5eaf02[_0x4fddd4]={'$like':'%'+_0x48ffb2[_0x5e51('0x32')][_0x5e51('0x3b')]+'%'};return _0x5eaf02;})});}_0x5de8a7=_[_0x5e51('0x3e')]({},_0x5de8a7,_0x48ffb2[_0x5e51('0x3f')]);return _0x1de445[_0x5e51('0x4c')](_0x5de8a7);}})[_0x5e51('0x27')](function(_0x158c92){if(_0x158c92){_0x103756=_0x158c92['length'];if(!_0x48ffb2[_0x5e51('0x32')]['hasOwnProperty'](_0x5e51('0x39'))){_0x5de8a7[_0x5e51('0x1f')]=qs['limit'](_0x48ffb2['query'][_0x5e51('0x1f')]);_0x5de8a7[_0x5e51('0x1d')]=qs[_0x5e51('0x1d')](_0x48ffb2[_0x5e51('0x32')]['offset']);}return _0x1de445[_0x5e51('0x4c')](_0x5de8a7);}})[_0x5e51('0x27')](function(_0x498d79){if(_0x498d79){return _0x498d79?{'count':_0x103756,'rows':_0x498d79}:null;}})[_0x5e51('0x27')](respondWithResult(_0x36953c,null))[_0x5e51('0x46')](handleError(_0x36953c,null));};exports[_0x5e51('0x50')]=function(_0x56ff1e,_0x417aee,_0x776cfb){if(_0x56ff1e[_0x5e51('0x4b')]['id']){delete _0x56ff1e['body']['id'];}return db[_0x5e51('0x40')]['findOne']({'where':{'id':_0x56ff1e['params']['id']}})['then'](handleEntityNotFound(_0x417aee,null))[_0x5e51('0x27')](function(_0x178323){if(_0x178323){_0x56ff1e[_0x5e51('0x4b')][_0x5e51('0x51')]=_0x178323['id'];_0x56ff1e[_0x5e51('0x4b')]['Subjects']=integrations[_0x5e51('0x52')](_0x56ff1e[_0x5e51('0x4b')][_0x5e51('0x53')],_0x56ff1e['body'][_0x5e51('0x2f')]);_0x56ff1e['body'][_0x5e51('0x54')]=integrations[_0x5e51('0x55')](_0x56ff1e[_0x5e51('0x4b')][_0x5e51('0x53')],_0x56ff1e[_0x5e51('0x4b')][_0x5e51('0x2f')]);return db[_0x5e51('0x4e')][_0x5e51('0x4a')](_0x56ff1e[_0x5e51('0x4b')],{'include':[{'model':db[_0x5e51('0x56')],'as':_0x5e51('0x57')},{'model':db['VtigerField'],'as':_0x5e51('0x54')}]});}return null;})[_0x5e51('0x27')](respondWithResult(_0x417aee,null))['catch'](handleError(_0x417aee,null));};var md5=require(_0x5e51('0x58'));exports['getFields']=function(_0x3c323c,_0x11bc0a,_0x3349b1){var _0xe86297=null;var _0x141731=null;var _0x385e9b=null;var _0x10f369=null;var _0x7d1ba8='';return db['VtigerAccount']['findOne']({'where':{'id':_0x3c323c['params']['id']},'attributes':['id','name',_0x5e51('0x59'),_0x5e51('0x5a'),_0x5e51('0x5b'),_0x5e51('0x5c'),_0x5e51('0x5d'),_0x5e51('0x5e')]})[_0x5e51('0x27')](handleEntityNotFound(_0x11bc0a,null))[_0x5e51('0x27')](function(_0x37016f){if(_0x37016f){_0xe86297=_0x37016f[_0x5e51('0x59')];_0x141731=_0x37016f['accessKey'];_0x385e9b=_0x37016f[_0x5e51('0x5b')];_0x7d1ba8=_0x37016f['remoteUri'];var _0x1c98f1=_0x7d1ba8[_0x5e51('0x5f')](-0x1);if(_0x1c98f1==='/'){_0x7d1ba8=_0x7d1ba8[_0x5e51('0x60')](0x0,_0x7d1ba8[_0x5e51('0x61')](_0x1c98f1));}_0x10f369=util[_0x5e51('0x62')]('%s/webservice.php',_0x7d1ba8);var _0x3b4752={'method':_0x5e51('0x63'),'uri':_0x10f369,'qs':{'operation':_0x5e51('0x64'),'username':_0x37016f[_0x5e51('0x59')]},'json':!![]};return rp(_0x3b4752);}})['then'](function(_0x55222c){if(_0x55222c[_0x5e51('0x65')]){var _0x291e9a={'method':_0x5e51('0x66'),'uri':_0x10f369,'form':{'operation':'login','username':_0xe86297,'accessKey':md5(_0x55222c[_0x5e51('0x67')][_0x5e51('0x68')]+_0x141731)},'json':!![]};return rp(_0x291e9a);}})['then'](function(_0x12820d){if(_0x12820d['success']){var _0x431ba8={'method':'GET','uri':_0x10f369,'qs':{'operation':_0x5e51('0x69'),'username':_0xe86297,'sessionName':_0x12820d['result'][_0x5e51('0x6a')],'elementType':_0x385e9b},'json':!![]};return rp(_0x431ba8);}})[_0x5e51('0x27')](function(_0x297398){if(_0x297398[_0x5e51('0x65')]){var _0x1b3e10=[_0x5e51('0x6b'),_0x5e51('0x6c'),_0x5e51('0x6d')];_[_0x5e51('0x6e')](_0x297398[_0x5e51('0x67')][_0x5e51('0x37')],function(_0x1d59a1){return _0x1b3e10['includes'](_0x1d59a1[_0x5e51('0x2f')][_0x5e51('0x2a')]);});_[_0x5e51('0x6e')](_0x297398[_0x5e51('0x67')]['fields'],function(_0x422ff3){return _0x422ff3[_0x5e51('0x6f')]===_0x5e51('0x70');});return{'count':_0x297398[_0x5e51('0x67')]['fields'][_0x5e51('0x48')],'rows':_[_0x5e51('0x2d')](_0x297398['result'][_0x5e51('0x37')],function(_0x17b224){return{'id':_0x17b224['name'],'name':_0x17b224[_0x5e51('0x71')],'custom':_['startsWith'](_0x17b224['name'],_0x5e51('0x72'))?!![]:![],'options':_0x17b224[_0x5e51('0x2f')][_0x5e51('0x2a')]===_0x5e51('0x73')&&_0x17b224[_0x5e51('0x2f')][_0x5e51('0x74')]['length']>0x0?_[_0x5e51('0x2d')](_0x17b224['type'][_0x5e51('0x74')],function(_0x56cbd4){return{'name':_0x56cbd4['label'],'value':_0x56cbd4[_0x5e51('0x75')]};}):[]};})};}})[_0x5e51('0x27')](respondWithResult(_0x11bc0a,null))[_0x5e51('0x46')](function(_0x5a067){console[_0x5e51('0x76')](_0x5e51('0x77')+_0x5a067);var _0x484b94=_0x3c323c[_0x5e51('0x32')][_0x5e51('0x78')]?0x1f4:_0x5a067[_0x5e51('0x79')]||0x1f4;logger['error'](_0x5e51('0x7a'),_0x5e51('0x7b'),_0x484b94,JSON['stringify'](_0x5a067));delete _0x5a067['name'];if(_0x484b94===0x191){_0x484b94=0x190;}_0x11bc0a[_0x5e51('0x1b')](_0x484b94)[_0x5e51('0x2b')](_0x3c323c[_0x5e51('0x32')][_0x5e51('0x78')]?{'message':_0x5e51('0x7c'),'statusCode':_0x5a067['statusCode']}:_0x5a067);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e7e80c0..286f17e 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 _0x50ce=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x41b306,_0x46347f){var _0x1039a4=function(_0x2534bd){while(--_0x2534bd){_0x41b306['push'](_0x41b306['shift']());}};_0x1039a4(++_0x46347f);}(_0x50ce,0x189));var _0xe50c=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x50ce[_0x385c76];return _0x5c8367;};'use strict';var _=require(_0xe50c('0x0'));var util=require(_0xe50c('0x1'));var logger=require(_0xe50c('0x2'))('api');var moment=require(_0xe50c('0x3'));var BPromise=require(_0xe50c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe50c('0x5'));var rimraf=require('rimraf');var config=require(_0xe50c('0x6'));var attributes=require(_0xe50c('0x7'));var integrations=require(_0xe50c('0x8'));module[_0xe50c('0x9')]=function(_0x57ad3f,_0x3dc366){return _0x57ad3f[_0xe50c('0xa')](_0xe50c('0xb'),attributes,{'tableName':_0xe50c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x956b=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','moment','bluebird','path','rimraf'];(function(_0xc66f5b,_0x4205cf){var _0x1404d5=function(_0x511bea){while(--_0x511bea){_0xc66f5b['push'](_0xc66f5b['shift']());}};_0x1404d5(++_0x4205cf);}(_0x956b,0x16e));var _0xb956=function(_0xb26a38,_0x325f24){_0xb26a38=_0xb26a38-0x0;var _0x53d594=_0x956b[_0xb26a38];return _0x53d594;};'use strict';var _=require(_0xb956('0x0'));var util=require(_0xb956('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb956('0x2'));var BPromise=require(_0xb956('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb956('0x4'));var rimraf=require(_0xb956('0x5'));var config=require(_0xb956('0x6'));var attributes=require(_0xb956('0x7'));var integrations=require(_0xb956('0x8'));module['exports']=function(_0x306199,_0x26eedd){return _0x306199[_0xb956('0x9')](_0xb956('0xa'),attributes,{'tableName':_0xb956('0xb'),'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 d915ade..19ea83b 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 _0xae60=['result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','include','map','model','raw','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1dbf4f,_0x33aede){var _0x2a565b=function(_0x2bd619){while(--_0x2bd619){_0x1dbf4f['push'](_0x1dbf4f['shift']());}};_0x2a565b(++_0x33aede);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xae60[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VtigerAccount,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')]({'raw':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'limit':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['limit']||null:null,'include':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0xda4f01[_0x0ae6('0x1a')]['include'],function(_0x296a9d){return{'model':db[_0x296a9d[_0x0ae6('0x1f')]],'as':_0x296a9d['as'],'attributes':_0x296a9d[_0x0ae6('0x1c')],'include':_0x296a9d[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x296a9d[_0x0ae6('0x1d')],function(_0x5b86fe){return{'model':db[_0x5b86fe[_0x0ae6('0x1f')]],'as':_0x5b86fe['as'],'attributes':_0x5b86fe[_0x0ae6('0x1c')],'include':_0x5b86fe['include']?_['map'](_0x5b86fe[_0x0ae6('0x1d')],function(_0x3255a7){return{'model':db[_0x3255a7[_0x0ae6('0x1f')]],'as':_0x3255a7['as'],'attributes':_0x3255a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ae6('0xb')](function(_0xb68cbe){logger[_0x0ae6('0xc')]('GetVtigerAccount',_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0xb68cbe));_0x2fdf25(_0xb68cbe);})[_0x0ae6('0x16')](function(_0x14eed5){logger[_0x0ae6('0x12')]('GetVtigerAccount',_0x14eed5['message'],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x14eed5[_0x0ae6('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4a06f1){var _0x1ca059=this;return new Promise(function(_0x278577,_0x714c6d){return db[_0x0ae6('0x18')]['find']({'raw':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x20')]===undefined?!![]:![]:!![],'where':_0x4a06f1['options']?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'include':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x4a06f1[_0x0ae6('0x1a')]['include'],function(_0x2410bd){return{'model':db[_0x2410bd[_0x0ae6('0x1f')]],'as':_0x2410bd['as'],'attributes':_0x2410bd['attributes'],'include':_0x2410bd[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x2410bd[_0x0ae6('0x1d')],function(_0x5b9662){return{'model':db[_0x5b9662[_0x0ae6('0x1f')]],'as':_0x5b9662['as'],'attributes':_0x5b9662['attributes'],'include':_0x5b9662['include']?_[_0x0ae6('0x1e')](_0x5b9662[_0x0ae6('0x1d')],function(_0x18fc19){return{'model':db[_0x18fc19[_0x0ae6('0x1f')]],'as':_0x18fc19['as'],'attributes':_0x18fc19[_0x0ae6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x584dc8){logger[_0x0ae6('0xc')]('ShowVtigerAccount',_0x4a06f1);logger[_0x0ae6('0xe')]('ShowVtigerAccount',_0x4a06f1,JSON[_0x0ae6('0x11')](_0x584dc8));_0x278577(_0x584dc8);})['catch'](function(_0x7998e3){logger[_0x0ae6('0x12')](_0x0ae6('0x21'),_0x7998e3[_0x0ae6('0x14')],_0x4a06f1);_0x714c6d(_0x1ca059['error'](0x1f4,_0x7998e3['message']));});});}; \ No newline at end of file +var _0xae60=['result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','include','map','model','raw','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x287504,_0x582f38){var _0x3d82d0=function(_0x32380f){while(--_0x32380f){_0x287504['push'](_0x287504['shift']());}};_0x3d82d0(++_0x582f38);}(_0xae60,0x1c7));var _0x0ae6=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xae60[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VtigerAccount,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')]({'raw':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'limit':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['limit']||null:null,'include':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0xda4f01[_0x0ae6('0x1a')]['include'],function(_0x296a9d){return{'model':db[_0x296a9d[_0x0ae6('0x1f')]],'as':_0x296a9d['as'],'attributes':_0x296a9d[_0x0ae6('0x1c')],'include':_0x296a9d[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x296a9d[_0x0ae6('0x1d')],function(_0x5b86fe){return{'model':db[_0x5b86fe[_0x0ae6('0x1f')]],'as':_0x5b86fe['as'],'attributes':_0x5b86fe[_0x0ae6('0x1c')],'include':_0x5b86fe['include']?_['map'](_0x5b86fe[_0x0ae6('0x1d')],function(_0x3255a7){return{'model':db[_0x3255a7[_0x0ae6('0x1f')]],'as':_0x3255a7['as'],'attributes':_0x3255a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ae6('0xb')](function(_0xb68cbe){logger[_0x0ae6('0xc')]('GetVtigerAccount',_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0xb68cbe));_0x2fdf25(_0xb68cbe);})[_0x0ae6('0x16')](function(_0x14eed5){logger[_0x0ae6('0x12')]('GetVtigerAccount',_0x14eed5['message'],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x14eed5[_0x0ae6('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4a06f1){var _0x1ca059=this;return new Promise(function(_0x278577,_0x714c6d){return db[_0x0ae6('0x18')]['find']({'raw':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x20')]===undefined?!![]:![]:!![],'where':_0x4a06f1['options']?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'include':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x4a06f1[_0x0ae6('0x1a')]['include'],function(_0x2410bd){return{'model':db[_0x2410bd[_0x0ae6('0x1f')]],'as':_0x2410bd['as'],'attributes':_0x2410bd['attributes'],'include':_0x2410bd[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x2410bd[_0x0ae6('0x1d')],function(_0x5b9662){return{'model':db[_0x5b9662[_0x0ae6('0x1f')]],'as':_0x5b9662['as'],'attributes':_0x5b9662['attributes'],'include':_0x5b9662['include']?_[_0x0ae6('0x1e')](_0x5b9662[_0x0ae6('0x1d')],function(_0x18fc19){return{'model':db[_0x18fc19[_0x0ae6('0x1f')]],'as':_0x18fc19['as'],'attributes':_0x18fc19[_0x0ae6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x584dc8){logger[_0x0ae6('0xc')]('ShowVtigerAccount',_0x4a06f1);logger[_0x0ae6('0xe')]('ShowVtigerAccount',_0x4a06f1,JSON[_0x0ae6('0x11')](_0x584dc8));_0x278577(_0x584dc8);})['catch'](function(_0x7998e3){logger[_0x0ae6('0x12')](_0x0ae6('0x21'),_0x7998e3[_0x0ae6('0x14')],_0x4a06f1);_0x714c6d(_0x1ca059['error'](0x1f4,_0x7998e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bd52c8a..0d42dd8 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 _0xb3ba=['destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2656b5,_0x5de18c){var _0xa9ceae=function(_0x412bec){while(--_0x412bec){_0x2656b5['push'](_0x2656b5['shift']());}};_0xa9ceae(++_0x5de18c);}(_0xb3ba,0xb6));var _0xab3b=function(_0x3d9626,_0x13d5ce){_0x3d9626=_0x3d9626-0x0;var _0x1a976b=_0xb3ba[_0x3d9626];return _0x1a976b;};'use strict';var multer=require(_0xab3b('0x0'));var util=require(_0xab3b('0x1'));var path=require('path');var timeout=require(_0xab3b('0x2'));var express=require(_0xab3b('0x3'));var router=express[_0xab3b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab3b('0x5'));var controller=require(_0xab3b('0x6'));router['get']('/',auth[_0xab3b('0x7')](),controller['index']);router['get'](_0xab3b('0x8'),auth['isAuthenticated'](),controller[_0xab3b('0x9')]);router[_0xab3b('0xa')]('/:id/fields',auth[_0xab3b('0x7')](),controller['getFields']);router[_0xab3b('0xa')](_0xab3b('0xb'),auth[_0xab3b('0x7')](),controller[_0xab3b('0xc')]);router[_0xab3b('0xa')](_0xab3b('0xd'),auth['isAuthenticated'](),controller[_0xab3b('0xe')]);router[_0xab3b('0xf')]('/',auth[_0xab3b('0x7')](),controller[_0xab3b('0x10')]);router[_0xab3b('0x11')]('/:id',auth[_0xab3b('0x7')](),controller['update']);router['delete'](_0xab3b('0x8'),auth[_0xab3b('0x7')](),controller[_0xab3b('0x12')]);module[_0xab3b('0x13')]=router; \ No newline at end of file +var _0x5408=['show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5d0b48,_0x2bdd35){var _0x4ee67f=function(_0xb9c068){while(--_0xb9c068){_0x5d0b48['push'](_0x5d0b48['shift']());}};_0x4ee67f(++_0x2bdd35);}(_0x5408,0x160));var _0x8540=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x5408[_0x5575cd];return _0x4979a0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8540('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8540('0x1'));var interaction=require(_0x8540('0x2'));var config=require(_0x8540('0x3'));var controller=require(_0x8540('0x4'));router[_0x8540('0x5')]('/',auth[_0x8540('0x6')](),controller[_0x8540('0x7')]);router[_0x8540('0x5')](_0x8540('0x8'),auth[_0x8540('0x6')](),controller[_0x8540('0x9')]);router['get']('/:id/fields',auth[_0x8540('0x6')](),controller[_0x8540('0xa')]);router[_0x8540('0x5')](_0x8540('0xb'),auth[_0x8540('0x6')](),controller['getSubjects']);router['get'](_0x8540('0xc'),auth['isAuthenticated'](),controller[_0x8540('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8540('0xe')]);router[_0x8540('0xf')](_0x8540('0x8'),auth[_0x8540('0x6')](),controller[_0x8540('0x10')]);router[_0x8540('0x11')]('/:id',auth[_0x8540('0x6')](),controller[_0x8540('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 19b6181..c4cef75 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 _0x325c=['sequelize','exports','STRING'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x325c,0x75));var _0xc325=function(_0x46376c,_0x562f7a){_0x46376c=_0x46376c-0x0;var _0x538ac4=_0x325c[_0x46376c];return _0x538ac4;};'use strict';var Sequelize=require(_0xc325('0x0'));module[_0xc325('0x1')]={'name':{'type':Sequelize[_0xc325('0x2')]},'description':{'type':Sequelize[_0xc325('0x2')]}}; \ No newline at end of file +var _0xe541=['STRING','exports'];(function(_0x3cc420,_0xa00025){var _0x34bab3=function(_0x246ed3){while(--_0x246ed3){_0x3cc420['push'](_0x3cc420['shift']());}};_0x34bab3(++_0xa00025);}(_0xe541,0x6b));var _0x1e54=function(_0x177c0f,_0x324360){_0x177c0f=_0x177c0f-0x0;var _0x1f4d28=_0xe541[_0x177c0f];return _0x1f4d28;};'use strict';var Sequelize=require('sequelize');module[_0x1e54('0x0')]={'name':{'type':Sequelize[_0x1e54('0x1')]},'description':{'type':Sequelize[_0x1e54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 9f750e7..1495e32 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 _0x88fa=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','apply','reject','save','then','sendStatus','name','send','map','VtigerConfiguration','rawAttributes','type','query','keys','filters','model'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x88fa,0x1d3));var _0xa88f=function(_0x5e1854,_0x48fb60){_0x5e1854=_0x5e1854-0x0;var _0x50eaee=_0x88fa[_0x5e1854];return _0x50eaee;};'use strict';var emlformat=require(_0xa88f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa88f('0x1'));var jsonpatch=require(_0xa88f('0x2'));var rp=require(_0xa88f('0x3'));var moment=require(_0xa88f('0x4'));var BPromise=require(_0xa88f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa88f('0x6'));var sox=require(_0xa88f('0x7'));var csv=require(_0xa88f('0x8'));var ejs=require(_0xa88f('0x9'));var fs=require('fs');var fs_extra=require(_0xa88f('0xa'));var _=require('lodash');var squel=require(_0xa88f('0xb'));var crypto=require(_0xa88f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa88f('0x8'));var querystring=require(_0xa88f('0xd'));var Papa=require(_0xa88f('0xe'));var Redis=require(_0xa88f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa88f('0x10'));var as=require(_0xa88f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa88f('0x12'))('api');var utils=require(_0xa88f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa88f('0x14'));var db=require(_0xa88f('0x15'))['db'];function respondWithStatusCode(_0xf27659,_0x25e7a7){_0x25e7a7=_0x25e7a7||0xcc;return function(_0x34d842){if(_0x34d842){return _0xf27659['sendStatus'](_0x25e7a7);}return _0xf27659[_0xa88f('0x16')](_0x25e7a7)[_0xa88f('0x17')]();};}function respondWithResult(_0x3b8d2c,_0x1ac913){_0x1ac913=_0x1ac913||0xc8;return function(_0x23bea){if(_0x23bea){return _0x3b8d2c[_0xa88f('0x16')](_0x1ac913)['json'](_0x23bea);}};}function respondWithFilteredResult(_0x16c656,_0x2e4b7f){return function(_0x3ffa25){if(_0x3ffa25){var _0x5dac52=typeof _0x2e4b7f[_0xa88f('0x18')]===_0xa88f('0x19')&&typeof _0x2e4b7f['limit']===_0xa88f('0x19');var _0x23f774=_0x3ffa25[_0xa88f('0x1a')];var _0x3ca1df=_0x5dac52?0x0:_0x2e4b7f[_0xa88f('0x18')];var _0x33a044=_0x5dac52?_0x3ffa25[_0xa88f('0x1a')]:_0x2e4b7f['offset']+_0x2e4b7f[_0xa88f('0x1b')];var _0x4bc4eb;if(_0x33a044>=_0x23f774){_0x33a044=_0x23f774;_0x4bc4eb=0xc8;}else{_0x4bc4eb=0xce;}_0x16c656[_0xa88f('0x16')](_0x4bc4eb);return _0x16c656[_0xa88f('0x1c')]('Content-Range',_0x3ca1df+'-'+_0x33a044+'/'+_0x23f774)['json'](_0x3ffa25);}return null;};}function patchUpdates(_0x1e8030){return function(_0x10b3e8){try{jsonpatch[_0xa88f('0x1d')](_0x10b3e8,_0x1e8030,!![]);}catch(_0x420055){return BPromise[_0xa88f('0x1e')](_0x420055);}return _0x10b3e8[_0xa88f('0x1f')]();};}function saveUpdates(_0x2b2278,_0x4f4b70){return function(_0x260083){if(_0x260083){return _0x260083['update'](_0x2b2278)['then'](function(_0x11b3c9){return _0x11b3c9;});}return null;};}function removeEntity(_0x4328a2,_0x1d6cf3){return function(_0x37cdf0){if(_0x37cdf0){return _0x37cdf0['destroy']()[_0xa88f('0x20')](function(){_0x4328a2[_0xa88f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9328,_0x460938){return function(_0xc09174){if(!_0xc09174){_0x3c9328[_0xa88f('0x21')](0x194);}return _0xc09174;};}function handleError(_0x1e02b9,_0x365596){_0x365596=_0x365596||0x1f4;return function(_0x207392){logger['error'](_0x207392['stack']);if(_0x207392[_0xa88f('0x22')]){delete _0x207392[_0xa88f('0x22')];}_0x1e02b9[_0xa88f('0x16')](_0x365596)[_0xa88f('0x23')](_0x207392);};}exports['index']=function(_0x1d87be,_0x50cae7){var _0x120e08={},_0x122e88={},_0x4c67dd={'count':0x0,'rows':[]};var _0x4ee8c3=_[_0xa88f('0x24')](db[_0xa88f('0x25')][_0xa88f('0x26')],function(_0x26655b){return{'name':_0x26655b['fieldName'],'type':_0x26655b[_0xa88f('0x27')]['key']};});_0x122e88['model']=_['map'](_0x4ee8c3,_0xa88f('0x22'));_0x122e88[_0xa88f('0x28')]=_[_0xa88f('0x29')](_0x1d87be[_0xa88f('0x28')]);_0x122e88[_0xa88f('0x2a')]=_['intersection'](_0x122e88[_0xa88f('0x2b')],_0x122e88[_0xa88f('0x28')]);_0x120e08['attributes']=_[_0xa88f('0x2c')](_0x122e88[_0xa88f('0x2b')],qs[_0xa88f('0x2d')](_0x1d87be['query'][_0xa88f('0x2d')]));_0x120e08[_0xa88f('0x2e')]=_0x120e08[_0xa88f('0x2e')][_0xa88f('0x2f')]?_0x120e08['attributes']:_0x122e88[_0xa88f('0x2b')];if(!_0x1d87be[_0xa88f('0x28')][_0xa88f('0x30')](_0xa88f('0x31'))){_0x120e08[_0xa88f('0x1b')]=qs[_0xa88f('0x1b')](_0x1d87be[_0xa88f('0x28')][_0xa88f('0x1b')]);_0x120e08['offset']=qs['offset'](_0x1d87be['query'][_0xa88f('0x18')]);}_0x120e08[_0xa88f('0x32')]=qs['sort'](_0x1d87be[_0xa88f('0x28')][_0xa88f('0x33')]);_0x120e08['where']=qs[_0xa88f('0x2a')](_[_0xa88f('0x34')](_0x1d87be[_0xa88f('0x28')],_0x122e88['filters']),_0x4ee8c3);if(_0x1d87be[_0xa88f('0x28')]['filter']){_0x120e08[_0xa88f('0x35')]=_[_0xa88f('0x36')](_0x120e08['where'],{'$or':_['map'](_0x4ee8c3,function(_0x37603c){if(_0x37603c['type']!==_0xa88f('0x37')){var _0x5af9ae={};_0x5af9ae[_0x37603c[_0xa88f('0x22')]]={'$like':'%'+_0x1d87be[_0xa88f('0x28')][_0xa88f('0x38')]+'%'};return _0x5af9ae;}})});}_0x120e08=_[_0xa88f('0x36')]({},_0x120e08,_0x1d87be[_0xa88f('0x39')]);var _0xe7aabb={'where':_0x120e08[_0xa88f('0x35')]};return db[_0xa88f('0x25')]['count'](_0xe7aabb)[_0xa88f('0x20')](function(_0xc67e2b){_0x4c67dd[_0xa88f('0x1a')]=_0xc67e2b;if(_0x1d87be[_0xa88f('0x28')][_0xa88f('0x3a')]){_0x120e08[_0xa88f('0x3b')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa88f('0x3c')](_0x120e08);})[_0xa88f('0x20')](function(_0x4813b4){_0x4c67dd[_0xa88f('0x3d')]=_0x4813b4;return _0x4c67dd;})[_0xa88f('0x20')](respondWithFilteredResult(_0x50cae7,_0x120e08))[_0xa88f('0x3e')](handleError(_0x50cae7,null));};exports[_0xa88f('0x3f')]=function(_0x142502,_0x3ea56a){var _0x425a87={'raw':![],'where':{'id':_0x142502[_0xa88f('0x40')]['id']}},_0x2b2d4d={};_0x2b2d4d['model']=_['keys'](db[_0xa88f('0x25')][_0xa88f('0x26')]);_0x2b2d4d[_0xa88f('0x28')]=_[_0xa88f('0x29')](_0x142502[_0xa88f('0x28')]);_0x2b2d4d[_0xa88f('0x2a')]=_[_0xa88f('0x2c')](_0x2b2d4d['model'],_0x2b2d4d[_0xa88f('0x28')]);_0x425a87[_0xa88f('0x2e')]=_['intersection'](_0x2b2d4d['model'],qs[_0xa88f('0x2d')](_0x142502[_0xa88f('0x28')][_0xa88f('0x2d')]));_0x425a87[_0xa88f('0x2e')]=_0x425a87[_0xa88f('0x2e')][_0xa88f('0x2f')]?_0x425a87[_0xa88f('0x2e')]:_0x2b2d4d[_0xa88f('0x2b')];if(_0x142502[_0xa88f('0x28')][_0xa88f('0x3a')]){_0x425a87[_0xa88f('0x3b')]=[{'all':!![]}];}_0x425a87=_[_0xa88f('0x36')]({},_0x425a87,_0x142502['options']);return db['VtigerConfiguration'][_0xa88f('0x41')](_0x425a87)[_0xa88f('0x20')](handleEntityNotFound(_0x3ea56a,null))[_0xa88f('0x20')](respondWithResult(_0x3ea56a,null))[_0xa88f('0x3e')](handleError(_0x3ea56a,null));};exports[_0xa88f('0x42')]=function(_0x3c557f,_0x423fb7){return db[_0xa88f('0x25')][_0xa88f('0x42')](_0x3c557f['body'],{})[_0xa88f('0x20')](respondWithResult(_0x423fb7,0xc9))['catch'](handleError(_0x423fb7,null));};exports['update']=function(_0x392b19,_0x3c662b){if(_0x392b19[_0xa88f('0x43')]['id']){delete _0x392b19[_0xa88f('0x43')]['id'];}return db[_0xa88f('0x25')]['find']({'where':{'id':_0x392b19[_0xa88f('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c662b,null))[_0xa88f('0x20')](saveUpdates(_0x392b19[_0xa88f('0x43')],null))['then'](respondWithResult(_0x3c662b,null))['catch'](handleError(_0x3c662b,null));};exports['destroy']=function(_0x37f233,_0x50587b){return db[_0xa88f('0x25')]['find']({'where':{'id':_0x37f233[_0xa88f('0x40')]['id']}})['then'](handleEntityNotFound(_0x50587b,null))[_0xa88f('0x20')](removeEntity(_0x50587b,null))['catch'](handleError(_0x50587b,null));};exports[_0xa88f('0x44')]=function(_0x20d8f9,_0x2f21bb,_0xa92166){var _0x3ee616={};var _0x4a8cd4={};var _0x249ed9;var _0x429ee4;return db[_0xa88f('0x25')]['findOne']({'where':{'id':_0x20d8f9[_0xa88f('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f21bb,null))['then'](function(_0x47c1e9){if(_0x47c1e9){_0x249ed9=_0x47c1e9;_0x4a8cd4[_0xa88f('0x2b')]=_[_0xa88f('0x29')](db[_0xa88f('0x45')][_0xa88f('0x26')]);_0x4a8cd4[_0xa88f('0x28')]=_[_0xa88f('0x29')](_0x20d8f9[_0xa88f('0x28')]);_0x4a8cd4[_0xa88f('0x2a')]=_[_0xa88f('0x2c')](_0x4a8cd4['model'],_0x4a8cd4[_0xa88f('0x28')]);_0x3ee616['attributes']=_[_0xa88f('0x2c')](_0x4a8cd4['model'],qs[_0xa88f('0x2d')](_0x20d8f9[_0xa88f('0x28')]['fields']));_0x3ee616[_0xa88f('0x2e')]=_0x3ee616[_0xa88f('0x2e')][_0xa88f('0x2f')]?_0x3ee616[_0xa88f('0x2e')]:_0x4a8cd4[_0xa88f('0x2b')];_0x3ee616[_0xa88f('0x32')]=qs[_0xa88f('0x33')](_0x20d8f9[_0xa88f('0x28')]['sort']);_0x3ee616['where']=qs['filters'](_[_0xa88f('0x34')](_0x20d8f9['query'],_0x4a8cd4[_0xa88f('0x2a')]));if(_0x20d8f9[_0xa88f('0x28')][_0xa88f('0x38')]){_0x3ee616[_0xa88f('0x35')]=_[_0xa88f('0x36')](_0x3ee616[_0xa88f('0x35')],{'$or':_[_0xa88f('0x24')](_0x3ee616['attributes'],function(_0x246d6e){var _0x4ab13d={};_0x4ab13d[_0x246d6e]={'$like':'%'+_0x20d8f9[_0xa88f('0x28')][_0xa88f('0x38')]+'%'};return _0x4ab13d;})});}_0x3ee616=_[_0xa88f('0x36')]({},_0x3ee616,_0x20d8f9[_0xa88f('0x39')]);return _0x249ed9[_0xa88f('0x44')](_0x3ee616);}})[_0xa88f('0x20')](function(_0x582e53){if(_0x582e53){_0x429ee4=_0x582e53[_0xa88f('0x2f')];if(!_0x20d8f9[_0xa88f('0x28')][_0xa88f('0x30')](_0xa88f('0x31'))){_0x3ee616['limit']=qs[_0xa88f('0x1b')](_0x20d8f9[_0xa88f('0x28')][_0xa88f('0x1b')]);_0x3ee616[_0xa88f('0x18')]=qs['offset'](_0x20d8f9[_0xa88f('0x28')][_0xa88f('0x18')]);}return _0x249ed9['getFields'](_0x3ee616);}})[_0xa88f('0x20')](function(_0x5a0c8c){if(_0x5a0c8c){return _0x5a0c8c?{'count':_0x429ee4,'rows':_0x5a0c8c}:null;}})[_0xa88f('0x20')](respondWithResult(_0x2f21bb,null))['catch'](handleError(_0x2f21bb,null));};exports[_0xa88f('0x46')]=function(_0x100429,_0x15ac59,_0x16293a){var _0x29a9a5={};var _0x4742a7={};var _0x4c6b79;var _0x515fff;return db[_0xa88f('0x25')][_0xa88f('0x47')]({'where':{'id':_0x100429[_0xa88f('0x40')]['id']}})[_0xa88f('0x20')](handleEntityNotFound(_0x15ac59,null))[_0xa88f('0x20')](function(_0x91d269){if(_0x91d269){_0x4c6b79=_0x91d269;_0x4742a7[_0xa88f('0x2b')]=_['keys'](db['VtigerField']['rawAttributes']);_0x4742a7['query']=_[_0xa88f('0x29')](_0x100429[_0xa88f('0x28')]);_0x4742a7[_0xa88f('0x2a')]=_[_0xa88f('0x2c')](_0x4742a7[_0xa88f('0x2b')],_0x4742a7[_0xa88f('0x28')]);_0x29a9a5[_0xa88f('0x2e')]=_[_0xa88f('0x2c')](_0x4742a7[_0xa88f('0x2b')],qs['fields'](_0x100429[_0xa88f('0x28')][_0xa88f('0x2d')]));_0x29a9a5[_0xa88f('0x2e')]=_0x29a9a5[_0xa88f('0x2e')][_0xa88f('0x2f')]?_0x29a9a5[_0xa88f('0x2e')]:_0x4742a7['model'];_0x29a9a5['order']=qs[_0xa88f('0x33')](_0x100429[_0xa88f('0x28')]['sort']);_0x29a9a5[_0xa88f('0x35')]=qs[_0xa88f('0x2a')](_[_0xa88f('0x34')](_0x100429[_0xa88f('0x28')],_0x4742a7[_0xa88f('0x2a')]));if(_0x100429[_0xa88f('0x28')][_0xa88f('0x38')]){_0x29a9a5['where']=_[_0xa88f('0x36')](_0x29a9a5[_0xa88f('0x35')],{'$or':_[_0xa88f('0x24')](_0x29a9a5[_0xa88f('0x2e')],function(_0xb55e5c){var _0x2eaf08={};_0x2eaf08[_0xb55e5c]={'$like':'%'+_0x100429['query'][_0xa88f('0x38')]+'%'};return _0x2eaf08;})});}_0x29a9a5=_['merge']({},_0x29a9a5,_0x100429[_0xa88f('0x39')]);return _0x4c6b79[_0xa88f('0x46')](_0x29a9a5);}})['then'](function(_0x4814c8){if(_0x4814c8){_0x515fff=_0x4814c8['length'];if(!_0x100429[_0xa88f('0x28')][_0xa88f('0x30')]('nolimit')){_0x29a9a5['limit']=qs[_0xa88f('0x1b')](_0x100429[_0xa88f('0x28')][_0xa88f('0x1b')]);_0x29a9a5[_0xa88f('0x18')]=qs[_0xa88f('0x18')](_0x100429[_0xa88f('0x28')][_0xa88f('0x18')]);}return _0x4c6b79['getSubjects'](_0x29a9a5);}})['then'](function(_0xf49ee8){if(_0xf49ee8){return _0xf49ee8?{'count':_0x515fff,'rows':_0xf49ee8}:null;}})[_0xa88f('0x20')](respondWithResult(_0x15ac59,null))['catch'](handleError(_0x15ac59,null));};exports[_0xa88f('0x48')]=function(_0x2b2663,_0x1b3399,_0x333b06){var _0x44c872={};var _0x4bbcb5={};var _0x32ed1d;var _0x1e5af5;return db[_0xa88f('0x25')]['findOne']({'where':{'id':_0x2b2663[_0xa88f('0x40')]['id']}})[_0xa88f('0x20')](handleEntityNotFound(_0x1b3399,null))[_0xa88f('0x20')](function(_0x465f15){if(_0x465f15){_0x32ed1d=_0x465f15;_0x4bbcb5[_0xa88f('0x2b')]=_[_0xa88f('0x29')](db['VtigerField'][_0xa88f('0x26')]);_0x4bbcb5['query']=_['keys'](_0x2b2663['query']);_0x4bbcb5['filters']=_[_0xa88f('0x2c')](_0x4bbcb5[_0xa88f('0x2b')],_0x4bbcb5[_0xa88f('0x28')]);_0x44c872['attributes']=_[_0xa88f('0x2c')](_0x4bbcb5[_0xa88f('0x2b')],qs['fields'](_0x2b2663[_0xa88f('0x28')][_0xa88f('0x2d')]));_0x44c872['attributes']=_0x44c872[_0xa88f('0x2e')][_0xa88f('0x2f')]?_0x44c872[_0xa88f('0x2e')]:_0x4bbcb5[_0xa88f('0x2b')];_0x44c872[_0xa88f('0x32')]=qs[_0xa88f('0x33')](_0x2b2663['query']['sort']);_0x44c872[_0xa88f('0x35')]=qs[_0xa88f('0x2a')](_[_0xa88f('0x34')](_0x2b2663[_0xa88f('0x28')],_0x4bbcb5['filters']));if(_0x2b2663[_0xa88f('0x28')][_0xa88f('0x38')]){_0x44c872[_0xa88f('0x35')]=_['merge'](_0x44c872['where'],{'$or':_[_0xa88f('0x24')](_0x44c872[_0xa88f('0x2e')],function(_0x644860){var _0x479cdf={};_0x479cdf[_0x644860]={'$like':'%'+_0x2b2663['query'][_0xa88f('0x38')]+'%'};return _0x479cdf;})});}_0x44c872=_[_0xa88f('0x36')]({},_0x44c872,_0x2b2663[_0xa88f('0x39')]);return _0x32ed1d[_0xa88f('0x48')](_0x44c872);}})['then'](function(_0x4c5837){if(_0x4c5837){_0x1e5af5=_0x4c5837[_0xa88f('0x2f')];if(!_0x2b2663[_0xa88f('0x28')]['hasOwnProperty']('nolimit')){_0x44c872['limit']=qs['limit'](_0x2b2663[_0xa88f('0x28')]['limit']);_0x44c872[_0xa88f('0x18')]=qs[_0xa88f('0x18')](_0x2b2663[_0xa88f('0x28')][_0xa88f('0x18')]);}return _0x32ed1d['getDescriptions'](_0x44c872);}})[_0xa88f('0x20')](function(_0x4e524b){if(_0x4e524b){return _0x4e524b?{'count':_0x1e5af5,'rows':_0x4e524b}:null;}})[_0xa88f('0x20')](respondWithResult(_0x1b3399,null))[_0xa88f('0x3e')](handleError(_0x1b3399,null));}; \ No newline at end of file +var _0x6668=['request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','fields','length','include','find','body','getFields','findOne','pick','getSubjects','getDescriptions','VtigerField','eml-format','rimraf','fast-json-patch'];(function(_0x40f98f,_0x3bcd3a){var _0x524783=function(_0x213718){while(--_0x213718){_0x40f98f['push'](_0x40f98f['shift']());}};_0x524783(++_0x3bcd3a);}(_0x6668,0xf0));var _0x8666=function(_0x68cae0,_0x7d78cd){_0x68cae0=_0x68cae0-0x0;var _0x5e7200=_0x6668[_0x68cae0];return _0x5e7200;};'use strict';var emlformat=require(_0x8666('0x0'));var rimraf=require(_0x8666('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8666('0x2'));var rp=require(_0x8666('0x3'));var moment=require(_0x8666('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8666('0x5'));var util=require('util');var path=require(_0x8666('0x6'));var sox=require(_0x8666('0x7'));var csv=require(_0x8666('0x8'));var ejs=require(_0x8666('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8666('0xa'));var crypto=require(_0x8666('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8666('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8666('0xd'));var Papa=require(_0x8666('0xe'));var Redis=require(_0x8666('0xf'));var authService=require(_0x8666('0x10'));var qs=require(_0x8666('0x11'));var as=require(_0x8666('0x12'));var hardwareService=require(_0x8666('0x13'));var logger=require(_0x8666('0x14'))(_0x8666('0x15'));var utils=require(_0x8666('0x16'));var config=require(_0x8666('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8666('0x18'))['db'];function respondWithStatusCode(_0x44d260,_0x979298){_0x979298=_0x979298||0xcc;return function(_0x176980){if(_0x176980){return _0x44d260[_0x8666('0x19')](_0x979298);}return _0x44d260['status'](_0x979298)[_0x8666('0x1a')]();};}function respondWithResult(_0x529bd1,_0x233a45){_0x233a45=_0x233a45||0xc8;return function(_0x1a400d){if(_0x1a400d){return _0x529bd1[_0x8666('0x1b')](_0x233a45)['json'](_0x1a400d);}};}function respondWithFilteredResult(_0x4c46e1,_0x29c397){return function(_0x14e09b){if(_0x14e09b){var _0x38d5ff=typeof _0x29c397[_0x8666('0x1c')]===_0x8666('0x1d')&&typeof _0x29c397['limit']===_0x8666('0x1d');var _0x1e55c4=_0x14e09b['count'];var _0x7af333=_0x38d5ff?0x0:_0x29c397[_0x8666('0x1c')];var _0x58991d=_0x38d5ff?_0x14e09b['count']:_0x29c397[_0x8666('0x1c')]+_0x29c397['limit'];var _0x1d2a7d;if(_0x58991d>=_0x1e55c4){_0x58991d=_0x1e55c4;_0x1d2a7d=0xc8;}else{_0x1d2a7d=0xce;}_0x4c46e1[_0x8666('0x1b')](_0x1d2a7d);return _0x4c46e1[_0x8666('0x1e')](_0x8666('0x1f'),_0x7af333+'-'+_0x58991d+'/'+_0x1e55c4)[_0x8666('0x20')](_0x14e09b);}return null;};}function patchUpdates(_0x14efe2){return function(_0x354645){try{jsonpatch[_0x8666('0x21')](_0x354645,_0x14efe2,!![]);}catch(_0x22fa6e){return BPromise[_0x8666('0x22')](_0x22fa6e);}return _0x354645[_0x8666('0x23')]();};}function saveUpdates(_0xd1ab50,_0x50c5b4){return function(_0x7c2f1){if(_0x7c2f1){return _0x7c2f1[_0x8666('0x24')](_0xd1ab50)[_0x8666('0x25')](function(_0x5e5526){return _0x5e5526;});}return null;};}function removeEntity(_0x3f0fd3,_0x5c6ea7){return function(_0x21a327){if(_0x21a327){return _0x21a327[_0x8666('0x26')]()['then'](function(){_0x3f0fd3[_0x8666('0x1b')](0xcc)[_0x8666('0x1a')]();});}};}function handleEntityNotFound(_0x1fb9d5,_0x345fa3){return function(_0x4e5ccc){if(!_0x4e5ccc){_0x1fb9d5['sendStatus'](0x194);}return _0x4e5ccc;};}function handleError(_0x17ffb1,_0x386c19){_0x386c19=_0x386c19||0x1f4;return function(_0x4c6306){logger[_0x8666('0x27')](_0x4c6306[_0x8666('0x28')]);if(_0x4c6306[_0x8666('0x29')]){delete _0x4c6306[_0x8666('0x29')];}_0x17ffb1[_0x8666('0x1b')](_0x386c19)[_0x8666('0x2a')](_0x4c6306);};}exports['index']=function(_0x488044,_0x195714){var _0x14875f={},_0x4a9ed8={},_0x1c76a5={'count':0x0,'rows':[]};var _0x427e78=_[_0x8666('0x2b')](db[_0x8666('0x2c')][_0x8666('0x2d')],function(_0x1ba300){return{'name':_0x1ba300[_0x8666('0x2e')],'type':_0x1ba300[_0x8666('0x2f')]['key']};});_0x4a9ed8[_0x8666('0x30')]=_[_0x8666('0x2b')](_0x427e78,_0x8666('0x29'));_0x4a9ed8[_0x8666('0x31')]=_[_0x8666('0x32')](_0x488044['query']);_0x4a9ed8[_0x8666('0x33')]=_['intersection'](_0x4a9ed8[_0x8666('0x30')],_0x4a9ed8[_0x8666('0x31')]);_0x14875f[_0x8666('0x34')]=_[_0x8666('0x35')](_0x4a9ed8[_0x8666('0x30')],qs['fields'](_0x488044['query']['fields']));_0x14875f[_0x8666('0x34')]=_0x14875f[_0x8666('0x34')]['length']?_0x14875f['attributes']:_0x4a9ed8[_0x8666('0x30')];if(!_0x488044['query'][_0x8666('0x36')](_0x8666('0x37'))){_0x14875f[_0x8666('0x38')]=qs['limit'](_0x488044[_0x8666('0x31')][_0x8666('0x38')]);_0x14875f['offset']=qs[_0x8666('0x1c')](_0x488044[_0x8666('0x31')][_0x8666('0x1c')]);}_0x14875f[_0x8666('0x39')]=qs['sort'](_0x488044[_0x8666('0x31')][_0x8666('0x3a')]);_0x14875f[_0x8666('0x3b')]=qs['filters'](_['pick'](_0x488044['query'],_0x4a9ed8[_0x8666('0x33')]),_0x427e78);if(_0x488044[_0x8666('0x31')][_0x8666('0x3c')]){_0x14875f[_0x8666('0x3b')]=_[_0x8666('0x3d')](_0x14875f['where'],{'$or':_[_0x8666('0x2b')](_0x427e78,function(_0x80e06e){if(_0x80e06e[_0x8666('0x2f')]!==_0x8666('0x3e')){var _0xba386={};_0xba386[_0x80e06e[_0x8666('0x29')]]={'$like':'%'+_0x488044[_0x8666('0x31')][_0x8666('0x3c')]+'%'};return _0xba386;}})});}_0x14875f=_[_0x8666('0x3d')]({},_0x14875f,_0x488044[_0x8666('0x3f')]);var _0x255992={'where':_0x14875f[_0x8666('0x3b')]};return db[_0x8666('0x2c')]['count'](_0x255992)[_0x8666('0x25')](function(_0x177057){_0x1c76a5[_0x8666('0x40')]=_0x177057;if(_0x488044[_0x8666('0x31')]['includeAll']){_0x14875f['include']=[{'all':!![]}];}return db[_0x8666('0x2c')][_0x8666('0x41')](_0x14875f);})[_0x8666('0x25')](function(_0x1a0934){_0x1c76a5[_0x8666('0x42')]=_0x1a0934;return _0x1c76a5;})[_0x8666('0x25')](respondWithFilteredResult(_0x195714,_0x14875f))[_0x8666('0x43')](handleError(_0x195714,null));};exports[_0x8666('0x44')]=function(_0x4be892,_0x46a4){var _0x240a15={'raw':![],'where':{'id':_0x4be892[_0x8666('0x45')]['id']}},_0x65ec45={};_0x65ec45[_0x8666('0x30')]=_[_0x8666('0x32')](db[_0x8666('0x2c')][_0x8666('0x2d')]);_0x65ec45['query']=_[_0x8666('0x32')](_0x4be892[_0x8666('0x31')]);_0x65ec45['filters']=_[_0x8666('0x35')](_0x65ec45[_0x8666('0x30')],_0x65ec45[_0x8666('0x31')]);_0x240a15[_0x8666('0x34')]=_[_0x8666('0x35')](_0x65ec45[_0x8666('0x30')],qs['fields'](_0x4be892[_0x8666('0x31')][_0x8666('0x46')]));_0x240a15['attributes']=_0x240a15[_0x8666('0x34')][_0x8666('0x47')]?_0x240a15['attributes']:_0x65ec45['model'];if(_0x4be892[_0x8666('0x31')]['includeAll']){_0x240a15[_0x8666('0x48')]=[{'all':!![]}];}_0x240a15=_[_0x8666('0x3d')]({},_0x240a15,_0x4be892[_0x8666('0x3f')]);return db['VtigerConfiguration'][_0x8666('0x49')](_0x240a15)['then'](handleEntityNotFound(_0x46a4,null))['then'](respondWithResult(_0x46a4,null))[_0x8666('0x43')](handleError(_0x46a4,null));};exports['create']=function(_0x3784d4,_0x3fb515){return db[_0x8666('0x2c')]['create'](_0x3784d4[_0x8666('0x4a')],{})[_0x8666('0x25')](respondWithResult(_0x3fb515,0xc9))[_0x8666('0x43')](handleError(_0x3fb515,null));};exports[_0x8666('0x24')]=function(_0x3a610d,_0x4f0e90){if(_0x3a610d[_0x8666('0x4a')]['id']){delete _0x3a610d[_0x8666('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x3a610d[_0x8666('0x45')]['id']}})[_0x8666('0x25')](handleEntityNotFound(_0x4f0e90,null))[_0x8666('0x25')](saveUpdates(_0x3a610d[_0x8666('0x4a')],null))['then'](respondWithResult(_0x4f0e90,null))[_0x8666('0x43')](handleError(_0x4f0e90,null));};exports[_0x8666('0x26')]=function(_0x56998d,_0x2ec706){return db[_0x8666('0x2c')][_0x8666('0x49')]({'where':{'id':_0x56998d[_0x8666('0x45')]['id']}})[_0x8666('0x25')](handleEntityNotFound(_0x2ec706,null))[_0x8666('0x25')](removeEntity(_0x2ec706,null))['catch'](handleError(_0x2ec706,null));};exports[_0x8666('0x4b')]=function(_0x557eab,_0x2ec313,_0x4a7de4){var _0x2f3115={};var _0x50e6a4={};var _0x2b4057;var _0xd84f3a;return db[_0x8666('0x2c')][_0x8666('0x4c')]({'where':{'id':_0x557eab['params']['id']}})['then'](handleEntityNotFound(_0x2ec313,null))[_0x8666('0x25')](function(_0x20c08b){if(_0x20c08b){_0x2b4057=_0x20c08b;_0x50e6a4['model']=_[_0x8666('0x32')](db['VtigerField'][_0x8666('0x2d')]);_0x50e6a4[_0x8666('0x31')]=_['keys'](_0x557eab['query']);_0x50e6a4[_0x8666('0x33')]=_[_0x8666('0x35')](_0x50e6a4[_0x8666('0x30')],_0x50e6a4[_0x8666('0x31')]);_0x2f3115[_0x8666('0x34')]=_[_0x8666('0x35')](_0x50e6a4[_0x8666('0x30')],qs['fields'](_0x557eab['query'][_0x8666('0x46')]));_0x2f3115['attributes']=_0x2f3115[_0x8666('0x34')][_0x8666('0x47')]?_0x2f3115[_0x8666('0x34')]:_0x50e6a4[_0x8666('0x30')];_0x2f3115[_0x8666('0x39')]=qs['sort'](_0x557eab[_0x8666('0x31')]['sort']);_0x2f3115[_0x8666('0x3b')]=qs[_0x8666('0x33')](_[_0x8666('0x4d')](_0x557eab[_0x8666('0x31')],_0x50e6a4[_0x8666('0x33')]));if(_0x557eab['query'][_0x8666('0x3c')]){_0x2f3115[_0x8666('0x3b')]=_[_0x8666('0x3d')](_0x2f3115['where'],{'$or':_[_0x8666('0x2b')](_0x2f3115[_0x8666('0x34')],function(_0x3b8200){var _0x4f8441={};_0x4f8441[_0x3b8200]={'$like':'%'+_0x557eab[_0x8666('0x31')][_0x8666('0x3c')]+'%'};return _0x4f8441;})});}_0x2f3115=_[_0x8666('0x3d')]({},_0x2f3115,_0x557eab[_0x8666('0x3f')]);return _0x2b4057[_0x8666('0x4b')](_0x2f3115);}})[_0x8666('0x25')](function(_0x493809){if(_0x493809){_0xd84f3a=_0x493809[_0x8666('0x47')];if(!_0x557eab[_0x8666('0x31')][_0x8666('0x36')](_0x8666('0x37'))){_0x2f3115[_0x8666('0x38')]=qs[_0x8666('0x38')](_0x557eab[_0x8666('0x31')][_0x8666('0x38')]);_0x2f3115['offset']=qs[_0x8666('0x1c')](_0x557eab[_0x8666('0x31')]['offset']);}return _0x2b4057['getFields'](_0x2f3115);}})['then'](function(_0x4e8ac9){if(_0x4e8ac9){return _0x4e8ac9?{'count':_0xd84f3a,'rows':_0x4e8ac9}:null;}})['then'](respondWithResult(_0x2ec313,null))[_0x8666('0x43')](handleError(_0x2ec313,null));};exports[_0x8666('0x4e')]=function(_0x2ff646,_0x306b41,_0x216b58){var _0x3db33d={};var _0x400f98={};var _0x256870;var _0x3bba57;return db[_0x8666('0x2c')][_0x8666('0x4c')]({'where':{'id':_0x2ff646[_0x8666('0x45')]['id']}})[_0x8666('0x25')](handleEntityNotFound(_0x306b41,null))['then'](function(_0x15e8cb){if(_0x15e8cb){_0x256870=_0x15e8cb;_0x400f98[_0x8666('0x30')]=_[_0x8666('0x32')](db['VtigerField'][_0x8666('0x2d')]);_0x400f98[_0x8666('0x31')]=_[_0x8666('0x32')](_0x2ff646['query']);_0x400f98[_0x8666('0x33')]=_[_0x8666('0x35')](_0x400f98[_0x8666('0x30')],_0x400f98[_0x8666('0x31')]);_0x3db33d['attributes']=_['intersection'](_0x400f98[_0x8666('0x30')],qs[_0x8666('0x46')](_0x2ff646[_0x8666('0x31')][_0x8666('0x46')]));_0x3db33d[_0x8666('0x34')]=_0x3db33d[_0x8666('0x34')][_0x8666('0x47')]?_0x3db33d[_0x8666('0x34')]:_0x400f98[_0x8666('0x30')];_0x3db33d[_0x8666('0x39')]=qs[_0x8666('0x3a')](_0x2ff646[_0x8666('0x31')][_0x8666('0x3a')]);_0x3db33d['where']=qs[_0x8666('0x33')](_[_0x8666('0x4d')](_0x2ff646[_0x8666('0x31')],_0x400f98[_0x8666('0x33')]));if(_0x2ff646[_0x8666('0x31')]['filter']){_0x3db33d['where']=_[_0x8666('0x3d')](_0x3db33d[_0x8666('0x3b')],{'$or':_[_0x8666('0x2b')](_0x3db33d[_0x8666('0x34')],function(_0xb36dac){var _0x582f0e={};_0x582f0e[_0xb36dac]={'$like':'%'+_0x2ff646[_0x8666('0x31')][_0x8666('0x3c')]+'%'};return _0x582f0e;})});}_0x3db33d=_[_0x8666('0x3d')]({},_0x3db33d,_0x2ff646[_0x8666('0x3f')]);return _0x256870['getSubjects'](_0x3db33d);}})[_0x8666('0x25')](function(_0x5e1f1f){if(_0x5e1f1f){_0x3bba57=_0x5e1f1f[_0x8666('0x47')];if(!_0x2ff646['query'][_0x8666('0x36')](_0x8666('0x37'))){_0x3db33d[_0x8666('0x38')]=qs[_0x8666('0x38')](_0x2ff646['query'][_0x8666('0x38')]);_0x3db33d[_0x8666('0x1c')]=qs['offset'](_0x2ff646['query'][_0x8666('0x1c')]);}return _0x256870[_0x8666('0x4e')](_0x3db33d);}})[_0x8666('0x25')](function(_0x230398){if(_0x230398){return _0x230398?{'count':_0x3bba57,'rows':_0x230398}:null;}})['then'](respondWithResult(_0x306b41,null))[_0x8666('0x43')](handleError(_0x306b41,null));};exports[_0x8666('0x4f')]=function(_0x4141a2,_0x58f962,_0x511a6d){var _0x3c0cb4={};var _0x3d6b4d={};var _0xdbde62;var _0x43e64d;return db[_0x8666('0x2c')][_0x8666('0x4c')]({'where':{'id':_0x4141a2[_0x8666('0x45')]['id']}})[_0x8666('0x25')](handleEntityNotFound(_0x58f962,null))[_0x8666('0x25')](function(_0x210922){if(_0x210922){_0xdbde62=_0x210922;_0x3d6b4d[_0x8666('0x30')]=_[_0x8666('0x32')](db[_0x8666('0x50')][_0x8666('0x2d')]);_0x3d6b4d[_0x8666('0x31')]=_['keys'](_0x4141a2[_0x8666('0x31')]);_0x3d6b4d[_0x8666('0x33')]=_[_0x8666('0x35')](_0x3d6b4d['model'],_0x3d6b4d[_0x8666('0x31')]);_0x3c0cb4['attributes']=_[_0x8666('0x35')](_0x3d6b4d[_0x8666('0x30')],qs[_0x8666('0x46')](_0x4141a2[_0x8666('0x31')]['fields']));_0x3c0cb4[_0x8666('0x34')]=_0x3c0cb4[_0x8666('0x34')][_0x8666('0x47')]?_0x3c0cb4['attributes']:_0x3d6b4d[_0x8666('0x30')];_0x3c0cb4['order']=qs[_0x8666('0x3a')](_0x4141a2[_0x8666('0x31')][_0x8666('0x3a')]);_0x3c0cb4[_0x8666('0x3b')]=qs['filters'](_[_0x8666('0x4d')](_0x4141a2[_0x8666('0x31')],_0x3d6b4d['filters']));if(_0x4141a2['query'][_0x8666('0x3c')]){_0x3c0cb4[_0x8666('0x3b')]=_[_0x8666('0x3d')](_0x3c0cb4['where'],{'$or':_[_0x8666('0x2b')](_0x3c0cb4[_0x8666('0x34')],function(_0x475554){var _0x3f7aab={};_0x3f7aab[_0x475554]={'$like':'%'+_0x4141a2[_0x8666('0x31')]['filter']+'%'};return _0x3f7aab;})});}_0x3c0cb4=_[_0x8666('0x3d')]({},_0x3c0cb4,_0x4141a2[_0x8666('0x3f')]);return _0xdbde62[_0x8666('0x4f')](_0x3c0cb4);}})[_0x8666('0x25')](function(_0x237d1d){if(_0x237d1d){_0x43e64d=_0x237d1d[_0x8666('0x47')];if(!_0x4141a2[_0x8666('0x31')]['hasOwnProperty']('nolimit')){_0x3c0cb4[_0x8666('0x38')]=qs['limit'](_0x4141a2[_0x8666('0x31')][_0x8666('0x38')]);_0x3c0cb4['offset']=qs['offset'](_0x4141a2[_0x8666('0x31')][_0x8666('0x1c')]);}return _0xdbde62[_0x8666('0x4f')](_0x3c0cb4);}})['then'](function(_0x137d0a){if(_0x137d0a){return _0x137d0a?{'count':_0x43e64d,'rows':_0x137d0a}:null;}})[_0x8666('0x25')](respondWithResult(_0x58f962,null))[_0x8666('0x43')](handleError(_0x58f962,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index faee856..9c838b9 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 _0x4e02=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5dff79,_0x203a31){var _0x23e687=function(_0x53e811){while(--_0x53e811){_0x5dff79['push'](_0x5dff79['shift']());}};_0x23e687(++_0x203a31);}(_0x4e02,0xb0));var _0x24e0=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x4e02[_0x57d370];return _0x550fd2;};'use strict';var _=require(_0x24e0('0x0'));var util=require('util');var logger=require(_0x24e0('0x1'))('api');var moment=require(_0x24e0('0x2'));var BPromise=require(_0x24e0('0x3'));var rp=require(_0x24e0('0x4'));var fs=require('fs');var path=require(_0x24e0('0x5'));var rimraf=require(_0x24e0('0x6'));var config=require(_0x24e0('0x7'));var attributes=require(_0x24e0('0x8'));module[_0x24e0('0x9')]=function(_0x16dd05,_0x533246){return _0x16dd05[_0x24e0('0xa')](_0x24e0('0xb'),attributes,{'tableName':_0x24e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e65=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0xcede24,_0x1a2b5b){var _0x8dfae7=function(_0x1c1e84){while(--_0x1c1e84){_0xcede24['push'](_0xcede24['shift']());}};_0x8dfae7(++_0x1a2b5b);}(_0x0e65,0x71));var _0x50e6=function(_0x8a6977,_0x23dba0){_0x8a6977=_0x8a6977-0x0;var _0x593c07=_0x0e65[_0x8a6977];return _0x593c07;};'use strict';var _=require(_0x50e6('0x0'));var util=require(_0x50e6('0x1'));var logger=require(_0x50e6('0x2'))(_0x50e6('0x3'));var moment=require('moment');var BPromise=require(_0x50e6('0x4'));var rp=require(_0x50e6('0x5'));var fs=require('fs');var path=require(_0x50e6('0x6'));var rimraf=require(_0x50e6('0x7'));var config=require(_0x50e6('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x50e6('0x9')]=function(_0x3918cf,_0x38830b){return _0x3918cf[_0x50e6('0xa')](_0x50e6('0xb'),attributes,{'tableName':_0x50e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c438ea0..b5f2a99 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 _0x7e5f=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x7e5f,0x1bc));var _0xf7e5=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x7e5f[_0x1c0f41];return _0x369a9f;};'use strict';var _=require(_0xf7e5('0x0'));var util=require(_0xf7e5('0x1'));var moment=require(_0xf7e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xf7e5('0x3'));var fs=require('fs');var Redis=require(_0xf7e5('0x4'));var db=require(_0xf7e5('0x5'))['db'];var utils=require(_0xf7e5('0x6'));var logger=require(_0xf7e5('0x7'))(_0xf7e5('0x8'));var config=require(_0xf7e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf7e5('0xa')][_0xf7e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc951,_0x3a166e,_0x1d402e){return new BPromise(function(_0x501f23,_0x4c785a){return client[_0xf7e5('0xc')](_0x3bc951,_0x1d402e)['then'](function(_0x3aad9c){logger[_0xf7e5('0xd')](_0xf7e5('0xe'),_0x3a166e,_0xf7e5('0xf'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3a166e,_0xf7e5('0xf'),JSON[_0xf7e5('0x10')](_0x3aad9c));if(_0x3aad9c[_0xf7e5('0x11')]){if(_0x3aad9c[_0xf7e5('0x11')][_0xf7e5('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3a166e,_0x3aad9c[_0xf7e5('0x11')]['message']);return _0x4c785a(_0x3aad9c['error']['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3a166e,_0x3aad9c['error'][_0xf7e5('0x13')]);return _0x501f23(_0x3aad9c[_0xf7e5('0x11')]['message']);}else{logger[_0xf7e5('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x3a166e,_0xf7e5('0xf'));_0x501f23(_0x3aad9c['result']['message']);}})[_0xf7e5('0x14')](function(_0x1c19c6){logger[_0xf7e5('0x11')](_0xf7e5('0xe'),_0x3a166e,_0x1c19c6);_0x4c785a(_0x1c19c6);});});} \ No newline at end of file +var _0x96d0=['http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x96d0,0x145));var _0x096d=function(_0x53ad89,_0xcb95d){_0x53ad89=_0x53ad89-0x0;var _0x4cc21d=_0x96d0[_0x53ad89];return _0x4cc21d;};'use strict';var _=require(_0x096d('0x0'));var util=require(_0x096d('0x1'));var moment=require(_0x096d('0x2'));var BPromise=require(_0x096d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x096d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x096d('0x5'));var logger=require(_0x096d('0x6'))(_0x096d('0x7'));var config=require(_0x096d('0x8'));var jayson=require(_0x096d('0x9'));var client=jayson[_0x096d('0xa')][_0x096d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c3caf,_0x472332,_0x15ce2b){return new BPromise(function(_0x1224a3,_0x55408d){return client[_0x096d('0xc')](_0x4c3caf,_0x15ce2b)[_0x096d('0xd')](function(_0x3119ac){logger[_0x096d('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x472332,_0x096d('0xf'));logger[_0x096d('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x472332,_0x096d('0xf'),JSON[_0x096d('0x11')](_0x3119ac));if(_0x3119ac[_0x096d('0x12')]){if(_0x3119ac[_0x096d('0x12')][_0x096d('0x13')]===0x1f4){logger['error'](_0x096d('0x14'),_0x472332,_0x3119ac['error'][_0x096d('0x15')]);return _0x55408d(_0x3119ac[_0x096d('0x12')][_0x096d('0x15')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x472332,_0x3119ac['error']['message']);return _0x1224a3(_0x3119ac[_0x096d('0x12')][_0x096d('0x15')]);}else{logger[_0x096d('0xe')](_0x096d('0x14'),_0x472332,'request\x20sent');_0x1224a3(_0x3119ac[_0x096d('0x16')][_0x096d('0x15')]);}})[_0x096d('0x17')](function(_0x2e9e33){logger[_0x096d('0x12')](_0x096d('0x14'),_0x472332,_0x2e9e33);_0x55408d(_0x2e9e33);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 08fb5b7..8d2d590 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 _0x3508=['get','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb579f7,_0xdcfbee){var _0x2f552b=function(_0xf190b7){while(--_0xf190b7){_0xb579f7['push'](_0xb579f7['shift']());}};_0x2f552b(++_0xdcfbee);}(_0x3508,0x105));var _0x8350=function(_0x10e30a,_0x5481f0){_0x10e30a=_0x10e30a-0x0;var _0x3bc997=_0x3508[_0x10e30a];return _0x3bc997;};'use strict';var multer=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var path=require(_0x8350('0x2'));var timeout=require(_0x8350('0x3'));var express=require(_0x8350('0x4'));var router=express[_0x8350('0x5')]();var fs_extra=require(_0x8350('0x6'));var auth=require(_0x8350('0x7'));var interaction=require(_0x8350('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x8350('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8350('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8350('0xb')]('/',auth[_0x8350('0xc')](),controller[_0x8350('0xd')]);router[_0x8350('0xe')](_0x8350('0xa'),auth['isAuthenticated'](),controller[_0x8350('0xf')]);router[_0x8350('0x10')](_0x8350('0xa'),auth[_0x8350('0xc')](),controller[_0x8350('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4cd7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x4cd7,0xda));var _0x74cd=function(_0x42cc34,_0x57fe17){_0x42cc34=_0x42cc34-0x0;var _0x14af18=_0x4cd7[_0x42cc34];return _0x14af18;};'use strict';var multer=require(_0x74cd('0x0'));var util=require(_0x74cd('0x1'));var path=require(_0x74cd('0x2'));var timeout=require(_0x74cd('0x3'));var express=require(_0x74cd('0x4'));var router=express[_0x74cd('0x5')]();var fs_extra=require(_0x74cd('0x6'));var auth=require(_0x74cd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x74cd('0x8'));var controller=require('./intVtigerField.controller');router[_0x74cd('0x9')]('/',auth[_0x74cd('0xa')](),controller[_0x74cd('0xb')]);router[_0x74cd('0x9')](_0x74cd('0xc'),auth['isAuthenticated'](),controller[_0x74cd('0xd')]);router[_0x74cd('0xe')]('/',auth[_0x74cd('0xa')](),controller[_0x74cd('0xf')]);router['put'](_0x74cd('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x74cd('0xc'),auth[_0x74cd('0xa')](),controller[_0x74cd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c361562..713d0f4 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 _0xcd3d=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2589b5,_0x5c46ee){var _0x288b61=function(_0x4714b4){while(--_0x4714b4){_0x2589b5['push'](_0x2589b5['shift']());}};_0x288b61(++_0x5c46ee);}(_0xcd3d,0xf4));var _0xdcd3=function(_0x3130fb,_0x43c819){_0x3130fb=_0x3130fb-0x0;var _0x4b2c7f=_0xcd3d[_0x3130fb];return _0x4b2c7f;};'use strict';var Sequelize=require(_0xdcd3('0x0'));module[_0xdcd3('0x1')]={'type':{'type':Sequelize[_0xdcd3('0x2')](_0xdcd3('0x3'),_0xdcd3('0x4'),_0xdcd3('0x5'),_0xdcd3('0x6'),_0xdcd3('0x7')),'defaultValue':_0xdcd3('0x3')},'content':{'type':Sequelize[_0xdcd3('0x8')]},'key':{'type':Sequelize[_0xdcd3('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xdcd3('0x4'),_0xdcd3('0x5'))},'keyContent':{'type':Sequelize[_0xdcd3('0x8')]},'idField':{'type':Sequelize[_0xdcd3('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x14ae=['ENUM','string','variable','customVariable','picklist','STRING','sequelize','exports'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x14ae,0xc6));var _0xe14a=function(_0x329a05,_0x5d5adb){_0x329a05=_0x329a05-0x0;var _0x15753a=_0x14ae[_0x329a05];return _0x15753a;};'use strict';var Sequelize=require(_0xe14a('0x0'));module[_0xe14a('0x1')]={'type':{'type':Sequelize[_0xe14a('0x2')](_0xe14a('0x3'),_0xe14a('0x4'),_0xe14a('0x5'),'keyValue',_0xe14a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe14a('0x7')]},'keyType':{'type':Sequelize[_0xe14a('0x2')]('string','variable',_0xe14a('0x5'))},'keyContent':{'type':Sequelize[_0xe14a('0x7')]},'idField':{'type':Sequelize[_0xe14a('0x7')]},'nameField':{'type':Sequelize[_0xe14a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe14a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index db9bb0f..65a394e 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 _0x0c5c=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit'];(function(_0x3fbb4d,_0x34ea9b){var _0x70c3f8=function(_0x1bfe54){while(--_0x1bfe54){_0x3fbb4d['push'](_0x3fbb4d['shift']());}};_0x70c3f8(++_0x34ea9b);}(_0x0c5c,0x13d));var _0xc0c5=function(_0x1546f0,_0x1d2b57){_0x1546f0=_0x1546f0-0x0;var _0x1c2887=_0x0c5c[_0x1546f0];return _0x1c2887;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0c5('0x0'));var zipdir=require(_0xc0c5('0x1'));var jsonpatch=require(_0xc0c5('0x2'));var rp=require('request-promise');var moment=require(_0xc0c5('0x3'));var BPromise=require(_0xc0c5('0x4'));var Mustache=require(_0xc0c5('0x5'));var util=require(_0xc0c5('0x6'));var path=require(_0xc0c5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0c5('0x8'));var fs=require('fs');var fs_extra=require(_0xc0c5('0x9'));var _=require(_0xc0c5('0xa'));var squel=require(_0xc0c5('0xb'));var crypto=require(_0xc0c5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc0c5('0xd'));var toCsv=require(_0xc0c5('0xe'));var querystring=require(_0xc0c5('0xf'));var Papa=require(_0xc0c5('0x10'));var Redis=require(_0xc0c5('0x11'));var authService=require(_0xc0c5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0c5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc0c5('0x14'));var config=require(_0xc0c5('0x15'));var licenseUtil=require(_0xc0c5('0x16'));var db=require(_0xc0c5('0x17'))['db'];function respondWithStatusCode(_0x76f164,_0x4d409f){_0x4d409f=_0x4d409f||0xcc;return function(_0x4127ff){if(_0x4127ff){return _0x76f164['sendStatus'](_0x4d409f);}return _0x76f164[_0xc0c5('0x18')](_0x4d409f)[_0xc0c5('0x19')]();};}function respondWithResult(_0x2a021e,_0xc3f36b){_0xc3f36b=_0xc3f36b||0xc8;return function(_0x3b34ba){if(_0x3b34ba){return _0x2a021e[_0xc0c5('0x18')](_0xc3f36b)[_0xc0c5('0x1a')](_0x3b34ba);}};}function respondWithFilteredResult(_0x190414,_0x53b9a3){return function(_0x1f7f11){if(_0x1f7f11){var _0x23f8f5=typeof _0x53b9a3[_0xc0c5('0x1b')]===_0xc0c5('0x1c')&&typeof _0x53b9a3[_0xc0c5('0x1d')]===_0xc0c5('0x1c');var _0x3dc11e=_0x1f7f11[_0xc0c5('0x1e')];var _0x395062=_0x23f8f5?0x0:_0x53b9a3['offset'];var _0xc2df78=_0x23f8f5?_0x1f7f11[_0xc0c5('0x1e')]:_0x53b9a3[_0xc0c5('0x1b')]+_0x53b9a3[_0xc0c5('0x1d')];var _0xa24b6d;if(_0xc2df78>=_0x3dc11e){_0xc2df78=_0x3dc11e;_0xa24b6d=0xc8;}else{_0xa24b6d=0xce;}_0x190414[_0xc0c5('0x18')](_0xa24b6d);return _0x190414[_0xc0c5('0x1f')]('Content-Range',_0x395062+'-'+_0xc2df78+'/'+_0x3dc11e)['json'](_0x1f7f11);}return null;};}function patchUpdates(_0x3571dd){return function(_0xf79cda){try{jsonpatch[_0xc0c5('0x20')](_0xf79cda,_0x3571dd,!![]);}catch(_0x1627c5){return BPromise[_0xc0c5('0x21')](_0x1627c5);}return _0xf79cda[_0xc0c5('0x22')]();};}function saveUpdates(_0x1d9790,_0x31daf8){return function(_0x3c806b){if(_0x3c806b){return _0x3c806b[_0xc0c5('0x23')](_0x1d9790)[_0xc0c5('0x24')](function(_0x29ff29){return _0x29ff29;});}return null;};}function removeEntity(_0x113bb3,_0x1484f7){return function(_0x441ac6){if(_0x441ac6){return _0x441ac6[_0xc0c5('0x25')]()['then'](function(){_0x113bb3[_0xc0c5('0x18')](0xcc)[_0xc0c5('0x19')]();});}};}function handleEntityNotFound(_0xac747b,_0x5826ad){return function(_0x252acf){if(!_0x252acf){_0xac747b[_0xc0c5('0x26')](0x194);}return _0x252acf;};}function handleError(_0x16bcb0,_0x520308){_0x520308=_0x520308||0x1f4;return function(_0x28e7eb){logger[_0xc0c5('0x27')](_0x28e7eb[_0xc0c5('0x28')]);if(_0x28e7eb[_0xc0c5('0x29')]){delete _0x28e7eb[_0xc0c5('0x29')];}_0x16bcb0[_0xc0c5('0x18')](_0x520308)[_0xc0c5('0x2a')](_0x28e7eb);};}exports['index']=function(_0x556e03,_0x1d100d){var _0x270883={},_0x3195b0={},_0x1d926b={'count':0x0,'rows':[]};var _0x13cc94=_[_0xc0c5('0x2b')](db[_0xc0c5('0x2c')][_0xc0c5('0x2d')],function(_0x5a7500){return{'name':_0x5a7500[_0xc0c5('0x2e')],'type':_0x5a7500[_0xc0c5('0x2f')][_0xc0c5('0x30')]};});_0x3195b0[_0xc0c5('0x31')]=_[_0xc0c5('0x2b')](_0x13cc94,_0xc0c5('0x29'));_0x3195b0[_0xc0c5('0x32')]=_[_0xc0c5('0x33')](_0x556e03[_0xc0c5('0x32')]);_0x3195b0[_0xc0c5('0x34')]=_['intersection'](_0x3195b0['model'],_0x3195b0[_0xc0c5('0x32')]);_0x270883[_0xc0c5('0x35')]=_[_0xc0c5('0x36')](_0x3195b0['model'],qs['fields'](_0x556e03[_0xc0c5('0x32')][_0xc0c5('0x37')]));_0x270883[_0xc0c5('0x35')]=_0x270883[_0xc0c5('0x35')][_0xc0c5('0x38')]?_0x270883['attributes']:_0x3195b0[_0xc0c5('0x31')];if(!_0x556e03['query']['hasOwnProperty'](_0xc0c5('0x39'))){_0x270883[_0xc0c5('0x1d')]=qs[_0xc0c5('0x1d')](_0x556e03[_0xc0c5('0x32')]['limit']);_0x270883[_0xc0c5('0x1b')]=qs[_0xc0c5('0x1b')](_0x556e03[_0xc0c5('0x32')]['offset']);}_0x270883[_0xc0c5('0x3a')]=qs[_0xc0c5('0x3b')](_0x556e03[_0xc0c5('0x32')]['sort']);_0x270883[_0xc0c5('0x3c')]=qs[_0xc0c5('0x34')](_['pick'](_0x556e03['query'],_0x3195b0[_0xc0c5('0x34')]),_0x13cc94);if(_0x556e03[_0xc0c5('0x32')][_0xc0c5('0x3d')]){_0x270883[_0xc0c5('0x3c')]=_[_0xc0c5('0x3e')](_0x270883[_0xc0c5('0x3c')],{'$or':_[_0xc0c5('0x2b')](_0x13cc94,function(_0x59eff2){if(_0x59eff2['type']!==_0xc0c5('0x3f')){var _0x53372d={};_0x53372d[_0x59eff2[_0xc0c5('0x29')]]={'$like':'%'+_0x556e03['query'][_0xc0c5('0x3d')]+'%'};return _0x53372d;}})});}_0x270883=_[_0xc0c5('0x3e')]({},_0x270883,_0x556e03['options']);var _0x4ccb19={'where':_0x270883['where']};return db[_0xc0c5('0x2c')][_0xc0c5('0x1e')](_0x4ccb19)['then'](function(_0x831106){_0x1d926b['count']=_0x831106;if(_0x556e03['query'][_0xc0c5('0x40')]){_0x270883[_0xc0c5('0x41')]=[{'all':!![]}];}return db[_0xc0c5('0x2c')][_0xc0c5('0x42')](_0x270883);})['then'](function(_0x305375){_0x1d926b[_0xc0c5('0x43')]=_0x305375;return _0x1d926b;})['then'](respondWithFilteredResult(_0x1d100d,_0x270883))[_0xc0c5('0x44')](handleError(_0x1d100d,null));};exports[_0xc0c5('0x45')]=function(_0x4b4048,_0x15e2a3){var _0x4f498d={'raw':!![],'where':{'id':_0x4b4048['params']['id']}},_0x158d7c={};_0x158d7c['model']=_['keys'](db['VtigerField'][_0xc0c5('0x2d')]);_0x158d7c[_0xc0c5('0x32')]=_['keys'](_0x4b4048[_0xc0c5('0x32')]);_0x158d7c[_0xc0c5('0x34')]=_[_0xc0c5('0x36')](_0x158d7c[_0xc0c5('0x31')],_0x158d7c[_0xc0c5('0x32')]);_0x4f498d[_0xc0c5('0x35')]=_[_0xc0c5('0x36')](_0x158d7c['model'],qs[_0xc0c5('0x37')](_0x4b4048[_0xc0c5('0x32')][_0xc0c5('0x37')]));_0x4f498d['attributes']=_0x4f498d[_0xc0c5('0x35')][_0xc0c5('0x38')]?_0x4f498d[_0xc0c5('0x35')]:_0x158d7c[_0xc0c5('0x31')];if(_0x4b4048[_0xc0c5('0x32')][_0xc0c5('0x40')]){_0x4f498d['include']=[{'all':!![]}];}_0x4f498d=_[_0xc0c5('0x3e')]({},_0x4f498d,_0x4b4048[_0xc0c5('0x46')]);return db[_0xc0c5('0x2c')][_0xc0c5('0x47')](_0x4f498d)[_0xc0c5('0x24')](handleEntityNotFound(_0x15e2a3,null))[_0xc0c5('0x24')](respondWithResult(_0x15e2a3,null))['catch'](handleError(_0x15e2a3,null));};exports[_0xc0c5('0x48')]=function(_0x2d275c,_0x2ff373){return db[_0xc0c5('0x2c')][_0xc0c5('0x48')](_0x2d275c[_0xc0c5('0x49')],{})[_0xc0c5('0x24')](respondWithResult(_0x2ff373,0xc9))[_0xc0c5('0x44')](handleError(_0x2ff373,null));};exports[_0xc0c5('0x23')]=function(_0x548e95,_0x2170c1){if(_0x548e95[_0xc0c5('0x49')]['id']){delete _0x548e95['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x548e95[_0xc0c5('0x4a')]['id']}})[_0xc0c5('0x24')](handleEntityNotFound(_0x2170c1,null))[_0xc0c5('0x24')](saveUpdates(_0x548e95['body'],null))['then'](respondWithResult(_0x2170c1,null))[_0xc0c5('0x44')](handleError(_0x2170c1,null));};exports['destroy']=function(_0x24a0c8,_0x45c3a3){return db['VtigerField'][_0xc0c5('0x47')]({'where':{'id':_0x24a0c8[_0xc0c5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45c3a3,null))[_0xc0c5('0x24')](removeEntity(_0x45c3a3,null))[_0xc0c5('0x44')](handleError(_0x45c3a3,null));}; \ No newline at end of file +var _0x993a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','then','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','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','status','json','limit','undefined','count','offset','set','apply','save','update','destroy','error','name','send','index','VtigerField','rawAttributes','fieldName','type','model','map'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x993a,0xfe));var _0xa993=function(_0x235e75,_0x21aee7){_0x235e75=_0x235e75-0x0;var _0x32f9c8=_0x993a[_0x235e75];return _0x32f9c8;};'use strict';var emlformat=require(_0xa993('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa993('0x1'));var jsonpatch=require(_0xa993('0x2'));var rp=require(_0xa993('0x3'));var moment=require(_0xa993('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa993('0x5'));var util=require(_0xa993('0x6'));var path=require(_0xa993('0x7'));var sox=require(_0xa993('0x8'));var csv=require('to-csv');var ejs=require(_0xa993('0x9'));var fs=require('fs');var fs_extra=require(_0xa993('0xa'));var _=require('lodash');var squel=require(_0xa993('0xb'));var crypto=require(_0xa993('0xc'));var jsforce=require(_0xa993('0xd'));var deskjs=require(_0xa993('0xe'));var toCsv=require(_0xa993('0xf'));var querystring=require(_0xa993('0x10'));var Papa=require(_0xa993('0x11'));var Redis=require(_0xa993('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa993('0x13'));var as=require(_0xa993('0x14'));var hardwareService=require(_0xa993('0x15'));var logger=require(_0xa993('0x16'))(_0xa993('0x17'));var utils=require(_0xa993('0x18'));var config=require(_0xa993('0x19'));var licenseUtil=require(_0xa993('0x1a'));var db=require(_0xa993('0x1b'))['db'];function respondWithStatusCode(_0x19a7a8,_0x5a5fe2){_0x5a5fe2=_0x5a5fe2||0xcc;return function(_0x5df15f){if(_0x5df15f){return _0x19a7a8[_0xa993('0x1c')](_0x5a5fe2);}return _0x19a7a8[_0xa993('0x1d')](_0x5a5fe2)['end']();};}function respondWithResult(_0x135e3e,_0x2c2b28){_0x2c2b28=_0x2c2b28||0xc8;return function(_0x199f97){if(_0x199f97){return _0x135e3e[_0xa993('0x1d')](_0x2c2b28)[_0xa993('0x1e')](_0x199f97);}};}function respondWithFilteredResult(_0x1524a6,_0x55a261){return function(_0x3d469f){if(_0x3d469f){var _0x3ff5a2=typeof _0x55a261['offset']==='undefined'&&typeof _0x55a261[_0xa993('0x1f')]===_0xa993('0x20');var _0x1408e5=_0x3d469f[_0xa993('0x21')];var _0x5ece70=_0x3ff5a2?0x0:_0x55a261[_0xa993('0x22')];var _0x578e0e=_0x3ff5a2?_0x3d469f[_0xa993('0x21')]:_0x55a261[_0xa993('0x22')]+_0x55a261['limit'];var _0x42ab1d;if(_0x578e0e>=_0x1408e5){_0x578e0e=_0x1408e5;_0x42ab1d=0xc8;}else{_0x42ab1d=0xce;}_0x1524a6[_0xa993('0x1d')](_0x42ab1d);return _0x1524a6[_0xa993('0x23')]('Content-Range',_0x5ece70+'-'+_0x578e0e+'/'+_0x1408e5)[_0xa993('0x1e')](_0x3d469f);}return null;};}function patchUpdates(_0x49ac69){return function(_0x2bb258){try{jsonpatch[_0xa993('0x24')](_0x2bb258,_0x49ac69,!![]);}catch(_0x2d8d25){return BPromise['reject'](_0x2d8d25);}return _0x2bb258[_0xa993('0x25')]();};}function saveUpdates(_0x3a1bfa,_0x9104de){return function(_0x206e57){if(_0x206e57){return _0x206e57[_0xa993('0x26')](_0x3a1bfa)['then'](function(_0x4db4b2){return _0x4db4b2;});}return null;};}function removeEntity(_0x1f006a,_0x5609e8){return function(_0x39f057){if(_0x39f057){return _0x39f057[_0xa993('0x27')]()['then'](function(){_0x1f006a[_0xa993('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c3,_0x5242cb){return function(_0x48345e){if(!_0x48345e){_0x41c3['sendStatus'](0x194);}return _0x48345e;};}function handleError(_0x2b44f3,_0x4a925c){_0x4a925c=_0x4a925c||0x1f4;return function(_0x479d9d){logger[_0xa993('0x28')](_0x479d9d['stack']);if(_0x479d9d[_0xa993('0x29')]){delete _0x479d9d[_0xa993('0x29')];}_0x2b44f3['status'](_0x4a925c)[_0xa993('0x2a')](_0x479d9d);};}exports[_0xa993('0x2b')]=function(_0x419331,_0x3f9450){var _0x34c6d4={},_0x5d4936={},_0x1de27e={'count':0x0,'rows':[]};var _0x4daae2=_['map'](db[_0xa993('0x2c')][_0xa993('0x2d')],function(_0x5c7c98){return{'name':_0x5c7c98[_0xa993('0x2e')],'type':_0x5c7c98[_0xa993('0x2f')]['key']};});_0x5d4936[_0xa993('0x30')]=_[_0xa993('0x31')](_0x4daae2,'name');_0x5d4936[_0xa993('0x32')]=_[_0xa993('0x33')](_0x419331['query']);_0x5d4936[_0xa993('0x34')]=_[_0xa993('0x35')](_0x5d4936['model'],_0x5d4936['query']);_0x34c6d4[_0xa993('0x36')]=_[_0xa993('0x35')](_0x5d4936[_0xa993('0x30')],qs[_0xa993('0x37')](_0x419331[_0xa993('0x32')][_0xa993('0x37')]));_0x34c6d4[_0xa993('0x36')]=_0x34c6d4[_0xa993('0x36')][_0xa993('0x38')]?_0x34c6d4['attributes']:_0x5d4936[_0xa993('0x30')];if(!_0x419331[_0xa993('0x32')][_0xa993('0x39')](_0xa993('0x3a'))){_0x34c6d4[_0xa993('0x1f')]=qs[_0xa993('0x1f')](_0x419331[_0xa993('0x32')]['limit']);_0x34c6d4['offset']=qs[_0xa993('0x22')](_0x419331['query']['offset']);}_0x34c6d4['order']=qs[_0xa993('0x3b')](_0x419331[_0xa993('0x32')][_0xa993('0x3b')]);_0x34c6d4['where']=qs['filters'](_[_0xa993('0x3c')](_0x419331[_0xa993('0x32')],_0x5d4936[_0xa993('0x34')]),_0x4daae2);if(_0x419331[_0xa993('0x32')][_0xa993('0x3d')]){_0x34c6d4[_0xa993('0x3e')]=_[_0xa993('0x3f')](_0x34c6d4[_0xa993('0x3e')],{'$or':_[_0xa993('0x31')](_0x4daae2,function(_0x389ea8){if(_0x389ea8[_0xa993('0x2f')]!=='VIRTUAL'){var _0x30f0f5={};_0x30f0f5[_0x389ea8[_0xa993('0x29')]]={'$like':'%'+_0x419331['query'][_0xa993('0x3d')]+'%'};return _0x30f0f5;}})});}_0x34c6d4=_[_0xa993('0x3f')]({},_0x34c6d4,_0x419331['options']);var _0x21632b={'where':_0x34c6d4[_0xa993('0x3e')]};return db[_0xa993('0x2c')][_0xa993('0x21')](_0x21632b)[_0xa993('0x40')](function(_0x56024f){_0x1de27e['count']=_0x56024f;if(_0x419331['query'][_0xa993('0x41')]){_0x34c6d4['include']=[{'all':!![]}];}return db[_0xa993('0x2c')][_0xa993('0x42')](_0x34c6d4);})[_0xa993('0x40')](function(_0x215137){_0x1de27e[_0xa993('0x43')]=_0x215137;return _0x1de27e;})[_0xa993('0x40')](respondWithFilteredResult(_0x3f9450,_0x34c6d4))[_0xa993('0x44')](handleError(_0x3f9450,null));};exports[_0xa993('0x45')]=function(_0x261556,_0x37f7f9){var _0x535784={'raw':!![],'where':{'id':_0x261556[_0xa993('0x46')]['id']}},_0x501fce={};_0x501fce[_0xa993('0x30')]=_['keys'](db[_0xa993('0x2c')][_0xa993('0x2d')]);_0x501fce[_0xa993('0x32')]=_['keys'](_0x261556[_0xa993('0x32')]);_0x501fce[_0xa993('0x34')]=_[_0xa993('0x35')](_0x501fce[_0xa993('0x30')],_0x501fce[_0xa993('0x32')]);_0x535784[_0xa993('0x36')]=_[_0xa993('0x35')](_0x501fce['model'],qs['fields'](_0x261556[_0xa993('0x32')][_0xa993('0x37')]));_0x535784[_0xa993('0x36')]=_0x535784[_0xa993('0x36')][_0xa993('0x38')]?_0x535784[_0xa993('0x36')]:_0x501fce[_0xa993('0x30')];if(_0x261556[_0xa993('0x32')][_0xa993('0x41')]){_0x535784[_0xa993('0x47')]=[{'all':!![]}];}_0x535784=_[_0xa993('0x3f')]({},_0x535784,_0x261556[_0xa993('0x48')]);return db[_0xa993('0x2c')][_0xa993('0x49')](_0x535784)['then'](handleEntityNotFound(_0x37f7f9,null))[_0xa993('0x40')](respondWithResult(_0x37f7f9,null))['catch'](handleError(_0x37f7f9,null));};exports[_0xa993('0x4a')]=function(_0x489415,_0x5a823b){return db[_0xa993('0x2c')]['create'](_0x489415[_0xa993('0x4b')],{})['then'](respondWithResult(_0x5a823b,0xc9))[_0xa993('0x44')](handleError(_0x5a823b,null));};exports[_0xa993('0x26')]=function(_0x544261,_0xba8ab){if(_0x544261['body']['id']){delete _0x544261['body']['id'];}return db['VtigerField'][_0xa993('0x49')]({'where':{'id':_0x544261[_0xa993('0x46')]['id']}})[_0xa993('0x40')](handleEntityNotFound(_0xba8ab,null))[_0xa993('0x40')](saveUpdates(_0x544261[_0xa993('0x4b')],null))['then'](respondWithResult(_0xba8ab,null))['catch'](handleError(_0xba8ab,null));};exports[_0xa993('0x27')]=function(_0xa8f7a5,_0x14873d){return db['VtigerField']['find']({'where':{'id':_0xa8f7a5[_0xa993('0x46')]['id']}})[_0xa993('0x40')](handleEntityNotFound(_0x14873d,null))['then'](removeEntity(_0x14873d,null))[_0xa993('0x44')](handleError(_0x14873d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 560bbf6..f002604 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 _0x9073=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x38b0a0,_0x35053b){var _0x424020=function(_0x226583){while(--_0x226583){_0x38b0a0['push'](_0x38b0a0['shift']());}};_0x424020(++_0x35053b);}(_0x9073,0x77));var _0x3907=function(_0x389aff,_0x16144e){_0x389aff=_0x389aff-0x0;var _0x33d2fc=_0x9073[_0x389aff];return _0x33d2fc;};'use strict';var _=require('lodash');var util=require(_0x3907('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3907('0x1'));var BPromise=require(_0x3907('0x2'));var rp=require(_0x3907('0x3'));var fs=require('fs');var path=require(_0x3907('0x4'));var rimraf=require(_0x3907('0x5'));var config=require(_0x3907('0x6'));var attributes=require(_0x3907('0x7'));module[_0x3907('0x8')]=function(_0x2c83ea,_0x561b2b){return _0x2c83ea[_0x3907('0x9')](_0x3907('0xa'),attributes,{'tableName':_0x3907('0xb'),'paranoid':![],'indexes':[{'name':_0x3907('0xc'),'fields':[_0x3907('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b79=['request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','moment','bluebird'];(function(_0x7f21e6,_0x56988e){var _0x34022e=function(_0x1b7b2d){while(--_0x1b7b2d){_0x7f21e6['push'](_0x7f21e6['shift']());}};_0x34022e(++_0x56988e);}(_0x1b79,0xda));var _0x91b7=function(_0x226754,_0xcccb3b){_0x226754=_0x226754-0x0;var _0x893275=_0x1b79[_0x226754];return _0x893275;};'use strict';var _=require(_0x91b7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x91b7('0x1'));var BPromise=require(_0x91b7('0x2'));var rp=require(_0x91b7('0x3'));var fs=require('fs');var path=require(_0x91b7('0x4'));var rimraf=require('rimraf');var config=require(_0x91b7('0x5'));var attributes=require(_0x91b7('0x6'));module[_0x91b7('0x7')]=function(_0xd9cf84,_0x2fc23a){return _0xd9cf84[_0x91b7('0x8')](_0x91b7('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x91b7('0xa'),'fields':[_0x91b7('0xb'),_0x91b7('0xc')],'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 76c0ca4..4e1d151 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 _0x8b10=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8b10,0x1df));var _0x08b1=function(_0x40b438,_0x778ef1){_0x40b438=_0x40b438-0x0;var _0x593440=_0x8b10[_0x40b438];return _0x593440;};'use strict';var _=require(_0x08b1('0x0'));var util=require('util');var moment=require(_0x08b1('0x1'));var BPromise=require(_0x08b1('0x2'));var rs=require(_0x08b1('0x3'));var fs=require('fs');var Redis=require(_0x08b1('0x4'));var db=require(_0x08b1('0x5'))['db'];var utils=require(_0x08b1('0x6'));var logger=require('../../config/logger')(_0x08b1('0x7'));var config=require('../../config/environment');var jayson=require(_0x08b1('0x8'));var client=jayson[_0x08b1('0x9')][_0x08b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6389,_0x487981,_0x5e18a5){return new BPromise(function(_0x4a65a2,_0x5acffe){return client[_0x08b1('0xb')](_0x1a6389,_0x5e18a5)['then'](function(_0x42d05f){logger[_0x08b1('0xc')]('VtigerField,\x20%s,\x20%s',_0x487981,_0x08b1('0xd'));logger['debug'](_0x08b1('0xe'),_0x487981,_0x08b1('0xd'),JSON[_0x08b1('0xf')](_0x42d05f));if(_0x42d05f[_0x08b1('0x10')]){if(_0x42d05f[_0x08b1('0x10')][_0x08b1('0x11')]===0x1f4){logger[_0x08b1('0x10')](_0x08b1('0x12'),_0x487981,_0x42d05f[_0x08b1('0x10')]['message']);return _0x5acffe(_0x42d05f[_0x08b1('0x10')][_0x08b1('0x13')]);}logger['error'](_0x08b1('0x12'),_0x487981,_0x42d05f[_0x08b1('0x10')][_0x08b1('0x13')]);return _0x4a65a2(_0x42d05f[_0x08b1('0x10')][_0x08b1('0x13')]);}else{logger[_0x08b1('0xc')](_0x08b1('0x12'),_0x487981,_0x08b1('0xd'));_0x4a65a2(_0x42d05f[_0x08b1('0x14')][_0x08b1('0x13')]);}})[_0x08b1('0x15')](function(_0x212e17){logger[_0x08b1('0x10')](_0x08b1('0x12'),_0x487981,_0x212e17);_0x5acffe(_0x212e17);});});} \ No newline at end of file +var _0xa5b4=['VtigerField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4ae3a4,_0x3ca76d){var _0xf6ff2d=function(_0x394f06){while(--_0x394f06){_0x4ae3a4['push'](_0x4ae3a4['shift']());}};_0xf6ff2d(++_0x3ca76d);}(_0xa5b4,0xf4));var _0x4a5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4a5b('0x0'));var moment=require(_0x4a5b('0x1'));var BPromise=require(_0x4a5b('0x2'));var rs=require(_0x4a5b('0x3'));var fs=require('fs');var Redis=require(_0x4a5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a5b('0x5'));var logger=require(_0x4a5b('0x6'))(_0x4a5b('0x7'));var config=require(_0x4a5b('0x8'));var jayson=require(_0x4a5b('0x9'));var client=jayson[_0x4a5b('0xa')][_0x4a5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e59d,_0xfbae5a,_0x3724e4){return new BPromise(function(_0x5c014d,_0x2482d1){return client[_0x4a5b('0xc')](_0x13e59d,_0x3724e4)[_0x4a5b('0xd')](function(_0x4e8314){logger[_0x4a5b('0xe')]('VtigerField,\x20%s,\x20%s',_0xfbae5a,_0x4a5b('0xf'));logger[_0x4a5b('0x10')](_0x4a5b('0x11'),_0xfbae5a,_0x4a5b('0xf'),JSON[_0x4a5b('0x12')](_0x4e8314));if(_0x4e8314['error']){if(_0x4e8314['error']['code']===0x1f4){logger[_0x4a5b('0x13')](_0x4a5b('0x14'),_0xfbae5a,_0x4e8314[_0x4a5b('0x13')][_0x4a5b('0x15')]);return _0x2482d1(_0x4e8314[_0x4a5b('0x13')][_0x4a5b('0x15')]);}logger['error'](_0x4a5b('0x14'),_0xfbae5a,_0x4e8314[_0x4a5b('0x13')][_0x4a5b('0x15')]);return _0x5c014d(_0x4e8314[_0x4a5b('0x13')]['message']);}else{logger['info'](_0x4a5b('0x14'),_0xfbae5a,'request\x20sent');_0x5c014d(_0x4e8314[_0x4a5b('0x16')][_0x4a5b('0x15')]);}})[_0x4a5b('0x17')](function(_0x5a6ac3){logger[_0x4a5b('0x13')]('VtigerField,\x20%s,\x20%s',_0xfbae5a,_0x5a6ac3);_0x2482d1(_0x5a6ac3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 613d132..990b1cc 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 _0xf7ee=['addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','create','/:id/configurations'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xf7ee,0x83));var _0xef7e=function(_0x45e94d,_0x1fb9d0){_0x45e94d=_0x45e94d-0x0;var _0x31209d=_0xf7ee[_0x45e94d];return _0x31209d;};'use strict';var multer=require(_0xef7e('0x0'));var util=require('util');var path=require(_0xef7e('0x1'));var timeout=require(_0xef7e('0x2'));var express=require(_0xef7e('0x3'));var router=express[_0xef7e('0x4')]();var fs_extra=require(_0xef7e('0x5'));var auth=require(_0xef7e('0x6'));var interaction=require(_0xef7e('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xef7e('0x8')]('/',auth[_0xef7e('0x9')](),controller[_0xef7e('0xa')]);router['get'](_0xef7e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xef7e('0x8')]('/:id/configurations',auth[_0xef7e('0x9')](),controller[_0xef7e('0xc')]);router['get'](_0xef7e('0xd'),auth[_0xef7e('0x9')](),controller['getFields']);router['post']('/',auth[_0xef7e('0x9')](),controller[_0xef7e('0xe')]);router['post'](_0xef7e('0xf'),auth[_0xef7e('0x9')](),controller[_0xef7e('0x10')]);router[_0xef7e('0x11')](_0xef7e('0xb'),auth[_0xef7e('0x9')](),controller['update']);router[_0xef7e('0x12')](_0xef7e('0xb'),auth['isAuthenticated'](),controller[_0xef7e('0x13')]);module[_0xef7e('0x14')]=router; \ No newline at end of file +var _0xc1e1=['/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index'];(function(_0x3d817a,_0x57b891){var _0x11ddb7=function(_0x582e98){while(--_0x582e98){_0x3d817a['push'](_0x3d817a['shift']());}};_0x11ddb7(++_0x57b891);}(_0xc1e1,0x11e));var _0x1c1e=function(_0x48c0d8,_0x3279a4){_0x48c0d8=_0x48c0d8-0x0;var _0x16a2ed=_0xc1e1[_0x48c0d8];return _0x16a2ed;};'use strict';var multer=require(_0x1c1e('0x0'));var util=require(_0x1c1e('0x1'));var path=require(_0x1c1e('0x2'));var timeout=require(_0x1c1e('0x3'));var express=require(_0x1c1e('0x4'));var router=express['Router']();var fs_extra=require(_0x1c1e('0x5'));var auth=require(_0x1c1e('0x6'));var interaction=require(_0x1c1e('0x7'));var config=require(_0x1c1e('0x8'));var controller=require(_0x1c1e('0x9'));router[_0x1c1e('0xa')]('/',auth[_0x1c1e('0xb')](),controller[_0x1c1e('0xc')]);router[_0x1c1e('0xa')](_0x1c1e('0xd'),auth['isAuthenticated'](),controller[_0x1c1e('0xe')]);router['get'](_0x1c1e('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1c1e('0xa')](_0x1c1e('0x10'),auth[_0x1c1e('0xb')](),controller['getFields']);router[_0x1c1e('0x11')]('/',auth['isAuthenticated'](),controller[_0x1c1e('0x12')]);router['post'](_0x1c1e('0xf'),auth[_0x1c1e('0xb')](),controller[_0x1c1e('0x13')]);router[_0x1c1e('0x14')](_0x1c1e('0xd'),auth[_0x1c1e('0xb')](),controller['update']);router[_0x1c1e('0x15')]('/:id',auth[_0x1c1e('0xb')](),controller['destroy']);module[_0x1c1e('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 61ab64b..f2bbb20 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 _0x3d49=['integrationTab','exports','STRING','remoteUri','ENUM','password'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3d49,0x151));var _0x93d4=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x3d49[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')]},'description':{'type':Sequelize[_0x93d4('0x1')]},'username':{'type':Sequelize[_0x93d4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x93d4('0x1')]},'token':{'type':Sequelize[_0x93d4('0x1')]},'remoteUri':{'type':Sequelize[_0x93d4('0x1')],'unique':_0x93d4('0x2')},'authType':{'type':Sequelize[_0x93d4('0x3')](_0x93d4('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x93d4('0x5')}}; \ No newline at end of file +var _0xaf11=['exports','STRING','username','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x42946c,_0x577d97){var _0x5d7687=function(_0x4f7428){while(--_0x4f7428){_0x42946c['push'](_0x42946c['shift']());}};_0x5d7687(++_0x577d97);}(_0xaf11,0x12f));var _0x1af1=function(_0x245d1f,_0x9da24f){_0x245d1f=_0x245d1f-0x0;var _0x1e6450=_0xaf11[_0x245d1f];return _0x1e6450;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'name':{'type':Sequelize[_0x1af1('0x2')]},'description':{'type':Sequelize[_0x1af1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1af1('0x3')},'password':{'type':Sequelize[_0x1af1('0x2')]},'token':{'type':Sequelize[_0x1af1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1af1('0x4')},'authType':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x6'),'token'),'defaultValue':_0x1af1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x7'),'newTab'),'defaultValue':_0x1af1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 613be35..eebd404 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 _0xb574=['slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','toString','base64','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','position','title','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','ZendeskConfiguration','options','length','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','remoteUri'];(function(_0x20ec6b,_0x5df25c){var _0x5e3b4c=function(_0x34f83b){while(--_0x34f83b){_0x20ec6b['push'](_0x20ec6b['shift']());}};_0x5e3b4c(++_0x5df25c);}(_0xb574,0x106));var _0x4b57=function(_0x4886f5,_0x167acb){_0x4886f5=_0x4886f5-0x0;var _0x15562d=_0xb574[_0x4886f5];return _0x15562d;};'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'];var integrations=require(_0x4b57('0x16'));function respondWithStatusCode(_0x43d066,_0xf8a6fc){_0xf8a6fc=_0xf8a6fc||0xcc;return function(_0x607276){if(_0x607276){return _0x43d066[_0x4b57('0x17')](_0xf8a6fc);}return _0x43d066[_0x4b57('0x18')](_0xf8a6fc)[_0x4b57('0x19')]();};}function respondWithResult(_0x31cced,_0x4e15be){_0x4e15be=_0x4e15be||0xc8;return function(_0x4a58dc){if(_0x4a58dc){return _0x31cced[_0x4b57('0x18')](_0x4e15be)[_0x4b57('0x1a')](_0x4a58dc);}};}function respondWithFilteredResult(_0x10b9ff,_0x58d6bd){return function(_0x284640){if(_0x284640){var _0x48bd13=typeof _0x58d6bd[_0x4b57('0x1b')]===_0x4b57('0x1c')&&typeof _0x58d6bd[_0x4b57('0x1d')]===_0x4b57('0x1c');var _0x20cf5e=_0x284640[_0x4b57('0x1e')];var _0x4ede42=_0x48bd13?0x0:_0x58d6bd[_0x4b57('0x1b')];var _0x1a0b72=_0x48bd13?_0x284640[_0x4b57('0x1e')]:_0x58d6bd[_0x4b57('0x1b')]+_0x58d6bd['limit'];var _0xb62450;if(_0x1a0b72>=_0x20cf5e){_0x1a0b72=_0x20cf5e;_0xb62450=0xc8;}else{_0xb62450=0xce;}_0x10b9ff[_0x4b57('0x18')](_0xb62450);return _0x10b9ff[_0x4b57('0x1f')](_0x4b57('0x20'),_0x4ede42+'-'+_0x1a0b72+'/'+_0x20cf5e)[_0x4b57('0x1a')](_0x284640);}return null;};}function patchUpdates(_0x4454c8){return function(_0x4f407d){try{jsonpatch[_0x4b57('0x21')](_0x4f407d,_0x4454c8,!![]);}catch(_0x131fed){return BPromise[_0x4b57('0x22')](_0x131fed);}return _0x4f407d['save']();};}function saveUpdates(_0x380554,_0x4a34b2){return function(_0x286c7d){if(_0x286c7d){return _0x286c7d[_0x4b57('0x23')](_0x380554)['then'](function(_0x271361){return _0x271361;});}return null;};}function removeEntity(_0x368c5f,_0x4d07c9){return function(_0x3e7b96){if(_0x3e7b96){return _0x3e7b96[_0x4b57('0x24')]()[_0x4b57('0x25')](function(){_0x368c5f[_0x4b57('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156962,_0x51d0c3){return function(_0x131dab){if(!_0x131dab){_0x156962['sendStatus'](0x194);}return _0x131dab;};}function handleError(_0x36ceb1,_0x2dc9d8){_0x2dc9d8=_0x2dc9d8||0x1f4;return function(_0x4af2c8){logger[_0x4b57('0x26')](_0x4af2c8[_0x4b57('0x27')]);if(_0x4af2c8[_0x4b57('0x28')]){delete _0x4af2c8['name'];}_0x36ceb1['status'](_0x2dc9d8)[_0x4b57('0x29')](_0x4af2c8);};}exports['index']=function(_0x1ea0cb,_0x458f70){var _0x874cf7={},_0x3af22f={},_0x249461={'count':0x0,'rows':[]};var _0x2c20d2=_['map'](db[_0x4b57('0x2a')][_0x4b57('0x2b')],function(_0x68be27){return{'name':_0x68be27[_0x4b57('0x2c')],'type':_0x68be27['type'][_0x4b57('0x2d')]};});_0x3af22f[_0x4b57('0x2e')]=_['map'](_0x2c20d2,_0x4b57('0x28'));_0x3af22f[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x1ea0cb[_0x4b57('0x2f')]);_0x3af22f['filters']=_['intersection'](_0x3af22f['model'],_0x3af22f[_0x4b57('0x2f')]);_0x874cf7[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x3af22f[_0x4b57('0x2e')],qs[_0x4b57('0x33')](_0x1ea0cb['query'][_0x4b57('0x33')]));_0x874cf7[_0x4b57('0x31')]=_0x874cf7[_0x4b57('0x31')]['length']?_0x874cf7[_0x4b57('0x31')]:_0x3af22f[_0x4b57('0x2e')];if(!_0x1ea0cb[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x34'))){_0x874cf7[_0x4b57('0x1d')]=qs['limit'](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1d')]);_0x874cf7[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1b')]);}_0x874cf7['order']=qs[_0x4b57('0x35')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x35')]);_0x874cf7[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x1ea0cb[_0x4b57('0x2f')],_0x3af22f['filters']),_0x2c20d2);if(_0x1ea0cb['query'][_0x4b57('0x39')]){_0x874cf7[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x874cf7['where'],{'$or':_[_0x4b57('0x3b')](_0x2c20d2,function(_0x1a3c3a){if(_0x1a3c3a[_0x4b57('0x3c')]!==_0x4b57('0x3d')){var _0x5487cc={};_0x5487cc[_0x1a3c3a[_0x4b57('0x28')]]={'$like':'%'+_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x39')]+'%'};return _0x5487cc;}})});}_0x874cf7=_[_0x4b57('0x3a')]({},_0x874cf7,_0x1ea0cb['options']);var _0x5766a6={'where':_0x874cf7['where']};return db[_0x4b57('0x2a')][_0x4b57('0x1e')](_0x5766a6)[_0x4b57('0x25')](function(_0x2e23d3){_0x249461['count']=_0x2e23d3;if(_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x3e')]){_0x874cf7[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x2a')][_0x4b57('0x40')](_0x874cf7);})[_0x4b57('0x25')](function(_0x2d5a0c){_0x249461[_0x4b57('0x41')]=_0x2d5a0c;return _0x249461;})[_0x4b57('0x25')](respondWithFilteredResult(_0x458f70,_0x874cf7))['catch'](handleError(_0x458f70,null));};exports[_0x4b57('0x42')]=function(_0x3685fd,_0x3c5095){var _0x5b2f50={'raw':![],'where':{'id':_0x3685fd['params']['id']}},_0x44f988={};_0x44f988[_0x4b57('0x2e')]=_[_0x4b57('0x30')](db[_0x4b57('0x2a')][_0x4b57('0x2b')]);_0x44f988[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x3685fd[_0x4b57('0x2f')]);_0x44f988[_0x4b57('0x37')]=_[_0x4b57('0x32')](_0x44f988[_0x4b57('0x2e')],_0x44f988[_0x4b57('0x2f')]);_0x5b2f50[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x44f988['model'],qs['fields'](_0x3685fd[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x5b2f50[_0x4b57('0x31')]=_0x5b2f50[_0x4b57('0x31')]['length']?_0x5b2f50[_0x4b57('0x31')]:_0x44f988[_0x4b57('0x2e')];if(_0x3685fd['query'][_0x4b57('0x3e')]){_0x5b2f50['include']=[{'all':!![]}];}_0x5b2f50=_[_0x4b57('0x3a')]({},_0x5b2f50,_0x3685fd['options']);return db['ZendeskAccount'][_0x4b57('0x43')](_0x5b2f50)[_0x4b57('0x25')](handleEntityNotFound(_0x3c5095,null))['then'](respondWithResult(_0x3c5095,null))[_0x4b57('0x44')](handleError(_0x3c5095,null));};exports[_0x4b57('0x45')]=function(_0x2732ff,_0x1cf1f3){return db[_0x4b57('0x2a')][_0x4b57('0x45')](_0x2732ff['body'],{})[_0x4b57('0x25')](respondWithResult(_0x1cf1f3,0xc9))[_0x4b57('0x44')](handleError(_0x1cf1f3,null));};exports['update']=function(_0xd529fb,_0x23e852){if(_0xd529fb[_0x4b57('0x46')]['id']){delete _0xd529fb['body']['id'];}return db[_0x4b57('0x2a')]['find']({'where':{'id':_0xd529fb[_0x4b57('0x47')]['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x23e852,null))[_0x4b57('0x25')](saveUpdates(_0xd529fb[_0x4b57('0x46')],null))[_0x4b57('0x25')](respondWithResult(_0x23e852,null))[_0x4b57('0x44')](handleError(_0x23e852,null));};exports[_0x4b57('0x24')]=function(_0x3ec6ba,_0x5ab120){return db[_0x4b57('0x2a')][_0x4b57('0x43')]({'where':{'id':_0x3ec6ba[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ab120,null))[_0x4b57('0x25')](removeEntity(_0x5ab120,null))[_0x4b57('0x44')](handleError(_0x5ab120,null));};exports[_0x4b57('0x48')]=function(_0x488bea,_0x1579d1,_0x3d2336){var _0x343cec={};var _0xb56bf0={};var _0x44494f;var _0xb7c37c;return db[_0x4b57('0x2a')]['findOne']({'where':{'id':_0x488bea['params']['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x1579d1,null))[_0x4b57('0x25')](function(_0x3b4cbf){if(_0x3b4cbf){_0x44494f=_0x3b4cbf;_0xb56bf0[_0x4b57('0x2e')]=_['keys'](db[_0x4b57('0x49')][_0x4b57('0x2b')]);_0xb56bf0[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x488bea['query']);_0xb56bf0['filters']=_[_0x4b57('0x32')](_0xb56bf0[_0x4b57('0x2e')],_0xb56bf0['query']);_0x343cec['attributes']=_[_0x4b57('0x32')](_0xb56bf0['model'],qs[_0x4b57('0x33')](_0x488bea[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x343cec[_0x4b57('0x31')]=_0x343cec[_0x4b57('0x31')]['length']?_0x343cec['attributes']:_0xb56bf0['model'];_0x343cec['order']=qs[_0x4b57('0x35')](_0x488bea[_0x4b57('0x2f')]['sort']);_0x343cec[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x488bea[_0x4b57('0x2f')],_0xb56bf0[_0x4b57('0x37')]));if(_0x488bea[_0x4b57('0x2f')][_0x4b57('0x39')]){_0x343cec[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x343cec['where'],{'$or':_[_0x4b57('0x3b')](_0x343cec['attributes'],function(_0x10bd32){var _0x2f684b={};_0x2f684b[_0x10bd32]={'$like':'%'+_0x488bea['query'][_0x4b57('0x39')]+'%'};return _0x2f684b;})});}_0x343cec=_[_0x4b57('0x3a')]({},_0x343cec,_0x488bea[_0x4b57('0x4a')]);return _0x44494f[_0x4b57('0x48')](_0x343cec);}})[_0x4b57('0x25')](function(_0xc24706){if(_0xc24706){_0xb7c37c=_0xc24706[_0x4b57('0x4b')];if(!_0x488bea[_0x4b57('0x2f')][_0x4b57('0x4c')](_0x4b57('0x34'))){_0x343cec[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x488bea['query'][_0x4b57('0x1d')]);_0x343cec[_0x4b57('0x1b')]=qs['offset'](_0x488bea[_0x4b57('0x2f')]['offset']);}return _0x44494f['getConfigurations'](_0x343cec);}})['then'](function(_0x1004ac){if(_0x1004ac){return _0x1004ac?{'count':_0xb7c37c,'rows':_0x1004ac}:null;}})['then'](respondWithResult(_0x1579d1,null))[_0x4b57('0x44')](handleError(_0x1579d1,null));};exports[_0x4b57('0x4d')]=function(_0x5e093a,_0x4cc278,_0x264c9f){if(_0x5e093a[_0x4b57('0x46')]['id']){delete _0x5e093a[_0x4b57('0x46')]['id'];}return db['ZendeskAccount'][_0x4b57('0x4e')]({'where':{'id':_0x5e093a[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cc278,null))[_0x4b57('0x25')](function(_0x119933){if(_0x119933){_0x5e093a['body'][_0x4b57('0x4f')]=_0x119933['id'];_0x5e093a[_0x4b57('0x46')][_0x4b57('0x50')]=integrations[_0x4b57('0x51')](_0x5e093a[_0x4b57('0x46')][_0x4b57('0x52')],_0x5e093a[_0x4b57('0x46')]['type']);_0x5e093a['body'][_0x4b57('0x53')]=integrations[_0x4b57('0x54')](_0x5e093a['body']['channel'],_0x5e093a[_0x4b57('0x46')][_0x4b57('0x3c')]);return db['ZendeskConfiguration']['create'](_0x5e093a['body'],{'include':[{'model':db[_0x4b57('0x55')],'as':_0x4b57('0x50')},{'model':db[_0x4b57('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4cc278,null))['catch'](handleError(_0x4cc278,null));};exports[_0x4b57('0x56')]=function(_0x59cd7c,_0x40cabe,_0x502313){var _0x13c680='';return db[_0x4b57('0x2a')][_0x4b57('0x4e')]({'where':{'id':_0x59cd7c[_0x4b57('0x47')]['id']},'attributes':['id','username',_0x4b57('0x57'),'token','authType',_0x4b57('0x58')]})[_0x4b57('0x25')](handleEntityNotFound(_0x40cabe,null))['then'](function(_0xf54f38){if(_0xf54f38){_0x13c680=_0xf54f38[_0x4b57('0x58')];var _0x355b5b=_0x13c680[_0x4b57('0x59')](-0x1);if(_0x355b5b==='/'){_0x13c680=_0x13c680[_0x4b57('0x5a')](0x0,_0x13c680[_0x4b57('0x5b')](_0x355b5b));}var _0x57e9eb={'method':_0x4b57('0x5c'),'uri':util[_0x4b57('0x5d')](_0x4b57('0x5e'),_0x13c680,_0x4b57('0x5f')),'json':!![]};switch(_0xf54f38[_0x4b57('0x60')]){case'password':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util[_0x4b57('0x5d')](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x57')]))[_0x4b57('0x63')](_0x4b57('0x64')))};break;case'token':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util['format'](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s/token:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x65')]))['toString'](_0x4b57('0x64')))};break;default:throw new db[(_0x4b57('0x66'))][(_0x4b57('0x67'))](_0x4b57('0x68'));}return rp(_0x57e9eb);}})[_0x4b57('0x25')](function(_0x489f3c){if(_0x489f3c){var _0x137532=[_0x4b57('0x69'),_0x4b57('0x6a'),'group','assignee'];_[_0x4b57('0x6b')](_0x489f3c[_0x4b57('0x5f')],function(_0x540a0a){return _0x137532[_0x4b57('0x6c')](_0x540a0a[_0x4b57('0x3c')]);});return{'count':_0x489f3c['ticket_fields'][_0x4b57('0x4b')],'rows':_[_0x4b57('0x3b')](_0x489f3c['ticket_fields'],function(_0xdef470){return{'id':_0xdef470['id'],'name':_0xdef470[_0x4b57('0x6d')]>0x7?_0xdef470[_0x4b57('0x6e')]:_0xdef470['type'],'custom':_0xdef470[_0x4b57('0x6d')]>0x7?!![]:![],'options':_0xdef470[_0x4b57('0x6f')]?_0xdef470[_0x4b57('0x6f')]:_0xdef470[_0x4b57('0x70')]?_0xdef470[_0x4b57('0x70')]:[]};})};}})[_0x4b57('0x25')](respondWithResult(_0x40cabe,null))[_0x4b57('0x44')](function(_0x4e4bbd){var _0x183b8c=_0x59cd7c[_0x4b57('0x2f')]['test']?0x1f4:_0x4e4bbd[_0x4b57('0x71')]||0x1f4;logger[_0x4b57('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4b57('0x56'),_0x183b8c,JSON[_0x4b57('0x72')](_0x4e4bbd));delete _0x4e4bbd[_0x4b57('0x28')];if(_0x183b8c===0x191){_0x183b8c=0x190;}_0x40cabe[_0x4b57('0x18')](_0x183b8c)[_0x4b57('0x29')](_0x59cd7c[_0x4b57('0x2f')][_0x4b57('0x73')]?{'message':_0x4b57('0x74'),'statusCode':_0x4e4bbd[_0x4b57('0x71')]}:_0x4e4bbd);});}; \ No newline at end of file +var _0x087b=['nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x087b,0x11a));var _0xb087=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x087b[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];var integrations=require(_0xb087('0x1b'));function respondWithStatusCode(_0x323656,_0x51ceaa){_0x51ceaa=_0x51ceaa||0xcc;return function(_0x3001e3){if(_0x3001e3){return _0x323656[_0xb087('0x1c')](_0x51ceaa);}return _0x323656[_0xb087('0x1d')](_0x51ceaa)[_0xb087('0x1e')]();};}function respondWithResult(_0x11784c,_0x12d0db){_0x12d0db=_0x12d0db||0xc8;return function(_0x5e9757){if(_0x5e9757){return _0x11784c[_0xb087('0x1d')](_0x12d0db)[_0xb087('0x1f')](_0x5e9757);}};}function respondWithFilteredResult(_0x16d0b7,_0x5193a4){return function(_0x43e576){if(_0x43e576){var _0x412b48=typeof _0x5193a4['offset']===_0xb087('0x20')&&typeof _0x5193a4[_0xb087('0x21')]===_0xb087('0x20');var _0x5bb80b=_0x43e576[_0xb087('0x22')];var _0x3c680f=_0x412b48?0x0:_0x5193a4[_0xb087('0x23')];var _0x45d074=_0x412b48?_0x43e576['count']:_0x5193a4[_0xb087('0x23')]+_0x5193a4[_0xb087('0x21')];var _0x10bb5b;if(_0x45d074>=_0x5bb80b){_0x45d074=_0x5bb80b;_0x10bb5b=0xc8;}else{_0x10bb5b=0xce;}_0x16d0b7[_0xb087('0x1d')](_0x10bb5b);return _0x16d0b7['set']('Content-Range',_0x3c680f+'-'+_0x45d074+'/'+_0x5bb80b)['json'](_0x43e576);}return null;};}function patchUpdates(_0x49450a){return function(_0x45a6cf){try{jsonpatch[_0xb087('0x24')](_0x45a6cf,_0x49450a,!![]);}catch(_0x3d0f57){return BPromise[_0xb087('0x25')](_0x3d0f57);}return _0x45a6cf[_0xb087('0x26')]();};}function saveUpdates(_0x258b4c,_0x31ae01){return function(_0x5587f7){if(_0x5587f7){return _0x5587f7[_0xb087('0x27')](_0x258b4c)[_0xb087('0x28')](function(_0x1de654){return _0x1de654;});}return null;};}function removeEntity(_0x1cfb3e,_0x3ad74e){return function(_0x4d9028){if(_0x4d9028){return _0x4d9028[_0xb087('0x29')]()[_0xb087('0x28')](function(){_0x1cfb3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(!_0x5a4ee0){_0x50745a[_0xb087('0x1c')](0x194);}return _0x5a4ee0;};}function handleError(_0x45685d,_0x1d124f){_0x1d124f=_0x1d124f||0x1f4;return function(_0x3ca2df){logger[_0xb087('0x2a')](_0x3ca2df[_0xb087('0x2b')]);if(_0x3ca2df[_0xb087('0x2c')]){delete _0x3ca2df[_0xb087('0x2c')];}_0x45685d[_0xb087('0x1d')](_0x1d124f)[_0xb087('0x2d')](_0x3ca2df);};}exports[_0xb087('0x2e')]=function(_0x31e3e6,_0xb0baf6){var _0x263259={},_0x593b78={},_0x37393a={'count':0x0,'rows':[]};var _0x1335d9=_[_0xb087('0x2f')](db[_0xb087('0x30')][_0xb087('0x31')],function(_0xa6d90c){return{'name':_0xa6d90c[_0xb087('0x32')],'type':_0xa6d90c[_0xb087('0x33')]['key']};});_0x593b78['model']=_[_0xb087('0x2f')](_0x1335d9,_0xb087('0x2c'));_0x593b78['query']=_[_0xb087('0x34')](_0x31e3e6[_0xb087('0x35')]);_0x593b78[_0xb087('0x36')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],_0x593b78[_0xb087('0x35')]);_0x263259[_0xb087('0x39')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],qs[_0xb087('0x3a')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3a')]));_0x263259['attributes']=_0x263259[_0xb087('0x39')]['length']?_0x263259[_0xb087('0x39')]:_0x593b78[_0xb087('0x38')];if(!_0x31e3e6[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x263259[_0xb087('0x21')]=qs[_0xb087('0x21')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x21')]);_0x263259['offset']=qs['offset'](_0x31e3e6[_0xb087('0x35')][_0xb087('0x23')]);}_0x263259[_0xb087('0x3d')]=qs[_0xb087('0x3e')](_0x31e3e6[_0xb087('0x35')]['sort']);_0x263259[_0xb087('0x3f')]=qs[_0xb087('0x36')](_['pick'](_0x31e3e6['query'],_0x593b78[_0xb087('0x36')]),_0x1335d9);if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x40')]){_0x263259['where']=_[_0xb087('0x41')](_0x263259[_0xb087('0x3f')],{'$or':_[_0xb087('0x2f')](_0x1335d9,function(_0x1ed2c9){if(_0x1ed2c9[_0xb087('0x33')]!=='VIRTUAL'){var _0x7e1315={};_0x7e1315[_0x1ed2c9['name']]={'$like':'%'+_0x31e3e6[_0xb087('0x35')]['filter']+'%'};return _0x7e1315;}})});}_0x263259=_[_0xb087('0x41')]({},_0x263259,_0x31e3e6[_0xb087('0x42')]);var _0x513332={'where':_0x263259[_0xb087('0x3f')]};return db['ZendeskAccount'][_0xb087('0x22')](_0x513332)['then'](function(_0x2d2c74){_0x37393a[_0xb087('0x22')]=_0x2d2c74;if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x43')]){_0x263259[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x30')][_0xb087('0x45')](_0x263259);})['then'](function(_0x1625f6){_0x37393a['rows']=_0x1625f6;return _0x37393a;})[_0xb087('0x28')](respondWithFilteredResult(_0xb0baf6,_0x263259))[_0xb087('0x46')](handleError(_0xb0baf6,null));};exports['show']=function(_0xb662bf,_0x45dc6f){var _0x7650c5={'raw':![],'where':{'id':_0xb662bf[_0xb087('0x47')]['id']}},_0x4c33cc={};_0x4c33cc['model']=_[_0xb087('0x34')](db[_0xb087('0x30')]['rawAttributes']);_0x4c33cc[_0xb087('0x35')]=_[_0xb087('0x34')](_0xb662bf['query']);_0x4c33cc[_0xb087('0x36')]=_[_0xb087('0x37')](_0x4c33cc['model'],_0x4c33cc[_0xb087('0x35')]);_0x7650c5[_0xb087('0x39')]=_[_0xb087('0x37')](_0x4c33cc[_0xb087('0x38')],qs['fields'](_0xb662bf['query'][_0xb087('0x3a')]));_0x7650c5[_0xb087('0x39')]=_0x7650c5[_0xb087('0x39')][_0xb087('0x48')]?_0x7650c5[_0xb087('0x39')]:_0x4c33cc[_0xb087('0x38')];if(_0xb662bf['query']['includeAll']){_0x7650c5[_0xb087('0x44')]=[{'all':!![]}];}_0x7650c5=_['merge']({},_0x7650c5,_0xb662bf[_0xb087('0x42')]);return db[_0xb087('0x30')][_0xb087('0x49')](_0x7650c5)[_0xb087('0x28')](handleEntityNotFound(_0x45dc6f,null))['then'](respondWithResult(_0x45dc6f,null))[_0xb087('0x46')](handleError(_0x45dc6f,null));};exports['create']=function(_0x2fe8a0,_0x73413b){return db[_0xb087('0x30')][_0xb087('0x4a')](_0x2fe8a0[_0xb087('0x4b')],{})['then'](respondWithResult(_0x73413b,0xc9))[_0xb087('0x46')](handleError(_0x73413b,null));};exports[_0xb087('0x27')]=function(_0x588d96,_0x4fba31){if(_0x588d96[_0xb087('0x4b')]['id']){delete _0x588d96['body']['id'];}return db['ZendeskAccount'][_0xb087('0x49')]({'where':{'id':_0x588d96[_0xb087('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fba31,null))[_0xb087('0x28')](saveUpdates(_0x588d96[_0xb087('0x4b')],null))[_0xb087('0x28')](respondWithResult(_0x4fba31,null))['catch'](handleError(_0x4fba31,null));};exports['destroy']=function(_0x30cc83,_0x54862a){return db['ZendeskAccount'][_0xb087('0x49')]({'where':{'id':_0x30cc83[_0xb087('0x47')]['id']}})[_0xb087('0x28')](handleEntityNotFound(_0x54862a,null))[_0xb087('0x28')](removeEntity(_0x54862a,null))[_0xb087('0x46')](handleError(_0x54862a,null));};exports[_0xb087('0x4c')]=function(_0xbd849d,_0xfb8827,_0x1fe178){var _0x18d93b={};var _0x47d47c={};var _0x2cfc44;var _0x55e653;return db[_0xb087('0x30')][_0xb087('0x4d')]({'where':{'id':_0xbd849d['params']['id']}})[_0xb087('0x28')](handleEntityNotFound(_0xfb8827,null))[_0xb087('0x28')](function(_0x343830){if(_0x343830){_0x2cfc44=_0x343830;_0x47d47c[_0xb087('0x38')]=_[_0xb087('0x34')](db[_0xb087('0x4e')][_0xb087('0x31')]);_0x47d47c[_0xb087('0x35')]=_[_0xb087('0x34')](_0xbd849d[_0xb087('0x35')]);_0x47d47c[_0xb087('0x36')]=_['intersection'](_0x47d47c[_0xb087('0x38')],_0x47d47c['query']);_0x18d93b[_0xb087('0x39')]=_['intersection'](_0x47d47c[_0xb087('0x38')],qs[_0xb087('0x3a')](_0xbd849d[_0xb087('0x35')][_0xb087('0x3a')]));_0x18d93b[_0xb087('0x39')]=_0x18d93b[_0xb087('0x39')][_0xb087('0x48')]?_0x18d93b[_0xb087('0x39')]:_0x47d47c[_0xb087('0x38')];_0x18d93b[_0xb087('0x3d')]=qs[_0xb087('0x3e')](_0xbd849d[_0xb087('0x35')][_0xb087('0x3e')]);_0x18d93b[_0xb087('0x3f')]=qs[_0xb087('0x36')](_[_0xb087('0x4f')](_0xbd849d[_0xb087('0x35')],_0x47d47c[_0xb087('0x36')]));if(_0xbd849d[_0xb087('0x35')][_0xb087('0x40')]){_0x18d93b[_0xb087('0x3f')]=_[_0xb087('0x41')](_0x18d93b['where'],{'$or':_[_0xb087('0x2f')](_0x18d93b[_0xb087('0x39')],function(_0xe81087){var _0x561c40={};_0x561c40[_0xe81087]={'$like':'%'+_0xbd849d[_0xb087('0x35')][_0xb087('0x40')]+'%'};return _0x561c40;})});}_0x18d93b=_['merge']({},_0x18d93b,_0xbd849d[_0xb087('0x42')]);return _0x2cfc44[_0xb087('0x4c')](_0x18d93b);}})[_0xb087('0x28')](function(_0x596264){if(_0x596264){_0x55e653=_0x596264[_0xb087('0x48')];if(!_0xbd849d[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x18d93b[_0xb087('0x21')]=qs[_0xb087('0x21')](_0xbd849d[_0xb087('0x35')][_0xb087('0x21')]);_0x18d93b['offset']=qs[_0xb087('0x23')](_0xbd849d[_0xb087('0x35')][_0xb087('0x23')]);}return _0x2cfc44['getConfigurations'](_0x18d93b);}})[_0xb087('0x28')](function(_0x4a26d0){if(_0x4a26d0){return _0x4a26d0?{'count':_0x55e653,'rows':_0x4a26d0}:null;}})['then'](respondWithResult(_0xfb8827,null))[_0xb087('0x46')](handleError(_0xfb8827,null));};exports[_0xb087('0x50')]=function(_0x48c00c,_0x298fdb,_0x524d18){if(_0x48c00c[_0xb087('0x4b')]['id']){delete _0x48c00c[_0xb087('0x4b')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x48c00c[_0xb087('0x47')]['id']}})['then'](handleEntityNotFound(_0x298fdb,null))['then'](function(_0x3c97ab){if(_0x3c97ab){_0x48c00c['body'][_0xb087('0x51')]=_0x3c97ab['id'];_0x48c00c['body'][_0xb087('0x52')]=integrations[_0xb087('0x53')](_0x48c00c[_0xb087('0x4b')][_0xb087('0x54')],_0x48c00c[_0xb087('0x4b')][_0xb087('0x33')]);_0x48c00c['body'][_0xb087('0x55')]=integrations['getDescriptions'](_0x48c00c[_0xb087('0x4b')][_0xb087('0x54')],_0x48c00c[_0xb087('0x4b')]['type']);return db[_0xb087('0x4e')]['create'](_0x48c00c[_0xb087('0x4b')],{'include':[{'model':db[_0xb087('0x56')],'as':_0xb087('0x52')},{'model':db[_0xb087('0x56')],'as':_0xb087('0x55')}]});}return null;})[_0xb087('0x28')](respondWithResult(_0x298fdb,null))['catch'](handleError(_0x298fdb,null));};exports[_0xb087('0x57')]=function(_0xd01a6b,_0x4bedbd,_0x25a45f){var _0x58de88='';return db[_0xb087('0x30')][_0xb087('0x4d')]({'where':{'id':_0xd01a6b[_0xb087('0x47')]['id']},'attributes':['id',_0xb087('0x58'),_0xb087('0x59'),_0xb087('0x5a'),_0xb087('0x5b'),_0xb087('0x5c')]})['then'](handleEntityNotFound(_0x4bedbd,null))['then'](function(_0x5c727f){if(_0x5c727f){_0x58de88=_0x5c727f[_0xb087('0x5c')];var _0x5190a4=_0x58de88[_0xb087('0x5d')](-0x1);if(_0x5190a4==='/'){_0x58de88=_0x58de88['substring'](0x0,_0x58de88[_0xb087('0x5e')](_0x5190a4));}var _0x43bf47={'method':_0xb087('0x5f'),'uri':util[_0xb087('0x60')]('%s/%s',_0x58de88,_0xb087('0x61')),'json':!![]};switch(_0x5c727f['authType']){case _0xb087('0x59'):_0x43bf47[_0xb087('0x62')]={'Authorization':util[_0xb087('0x60')](_0xb087('0x63'),new Buffer(util['format']('%s:%s',_0x5c727f[_0xb087('0x58')],_0x5c727f['password']))[_0xb087('0x64')](_0xb087('0x65')))};break;case _0xb087('0x5a'):_0x43bf47[_0xb087('0x62')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xb087('0x60')]('%s/token:%s',_0x5c727f[_0xb087('0x58')],_0x5c727f[_0xb087('0x5a')]))[_0xb087('0x64')](_0xb087('0x65')))};break;default:throw new db[(_0xb087('0x66'))]['ValidationError'](_0xb087('0x67'));}return rp(_0x43bf47);}})[_0xb087('0x28')](function(_0x5b9c5f){if(_0x5b9c5f){var _0x544ee0=['subject',_0xb087('0x68'),_0xb087('0x69'),_0xb087('0x6a')];_[_0xb087('0x6b')](_0x5b9c5f[_0xb087('0x61')],function(_0x19d7ae){return _0x544ee0['includes'](_0x19d7ae[_0xb087('0x33')]);});return{'count':_0x5b9c5f[_0xb087('0x61')][_0xb087('0x48')],'rows':_[_0xb087('0x2f')](_0x5b9c5f[_0xb087('0x61')],function(_0x3330b2){return{'id':_0x3330b2['id'],'name':_0x3330b2[_0xb087('0x6c')]>0x7?_0x3330b2['title']:_0x3330b2[_0xb087('0x33')],'custom':_0x3330b2[_0xb087('0x6c')]>0x7?!![]:![],'options':_0x3330b2[_0xb087('0x6d')]?_0x3330b2['system_field_options']:_0x3330b2[_0xb087('0x6e')]?_0x3330b2['custom_field_options']:[]};})};}})[_0xb087('0x28')](respondWithResult(_0x4bedbd,null))[_0xb087('0x46')](function(_0x45da69){var _0x267dea=_0xd01a6b[_0xb087('0x35')][_0xb087('0x6f')]?0x1f4:_0x45da69['statusCode']||0x1f4;logger['error'](_0xb087('0x70'),_0xb087('0x57'),_0x267dea,JSON['stringify'](_0x45da69));delete _0x45da69[_0xb087('0x2c')];if(_0x267dea===0x191){_0x267dea=0x190;}_0x4bedbd[_0xb087('0x1d')](_0x267dea)[_0xb087('0x2d')](_0xd01a6b[_0xb087('0x35')][_0xb087('0x6f')]?{'message':_0xb087('0x71'),'statusCode':_0x45da69['statusCode']}:_0x45da69);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 918def2..39a34df 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 _0xe1f5=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1f5,0x1ec));var _0x5e1f=function(_0x1915df,_0x29d17e){_0x1915df=_0x1915df-0x0;var _0x52df2d=_0xe1f5[_0x1915df];return _0x52df2d;};'use strict';var _=require(_0x5e1f('0x0'));var util=require(_0x5e1f('0x1'));var logger=require('../../config/logger')(_0x5e1f('0x2'));var moment=require('moment');var BPromise=require(_0x5e1f('0x3'));var rp=require(_0x5e1f('0x4'));var fs=require('fs');var path=require(_0x5e1f('0x5'));var rimraf=require(_0x5e1f('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e1f('0x7'));var integrations=require(_0x5e1f('0x8'));module[_0x5e1f('0x9')]=function(_0x22b521,_0x2e87a5){return _0x22b521[_0x5e1f('0xa')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53a7=['../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x53a7,0x11d));var _0x753a=function(_0x162849,_0x1fce3a){_0x162849=_0x162849-0x0;var _0x28c4c0=_0x53a7[_0x162849];return _0x28c4c0;};'use strict';var _=require(_0x753a('0x0'));var util=require(_0x753a('0x1'));var logger=require(_0x753a('0x2'))(_0x753a('0x3'));var moment=require('moment');var BPromise=require(_0x753a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x753a('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x753a('0x6'));module[_0x753a('0x7')]=function(_0x48f034,_0x1fe1cb){return _0x48f034['define'](_0x753a('0x8'),attributes,{'tableName':_0x753a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 14343f4..f6fcf75 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 _0x1b31=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0x1b31,0x7e));var _0x11b3=function(_0x49259d,_0x19c3a2){_0x49259d=_0x49259d-0x0;var _0x45d0bf=_0x1b31[_0x49259d];return _0x45d0bf;};'use strict';var _=require(_0x11b3('0x0'));var util=require(_0x11b3('0x1'));var moment=require(_0x11b3('0x2'));var BPromise=require(_0x11b3('0x3'));var rs=require(_0x11b3('0x4'));var fs=require('fs');var Redis=require(_0x11b3('0x5'));var db=require(_0x11b3('0x6'))['db'];var utils=require(_0x11b3('0x7'));var logger=require(_0x11b3('0x8'))('rpc');var config=require(_0x11b3('0x9'));var jayson=require(_0x11b3('0xa'));var client=jayson[_0x11b3('0xb')][_0x11b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25a144,_0x447bdf,_0x4eae9a){return new BPromise(function(_0x197e87,_0x4d8ccc){return client[_0x11b3('0xd')](_0x25a144,_0x4eae9a)[_0x11b3('0xe')](function(_0x566a38){logger[_0x11b3('0xf')](_0x11b3('0x10'),_0x447bdf,_0x11b3('0x11'));logger[_0x11b3('0x12')](_0x11b3('0x13'),_0x447bdf,_0x11b3('0x11'),JSON[_0x11b3('0x14')](_0x566a38));if(_0x566a38[_0x11b3('0x15')]){if(_0x566a38[_0x11b3('0x15')]['code']===0x1f4){logger[_0x11b3('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x447bdf,_0x566a38[_0x11b3('0x15')][_0x11b3('0x16')]);return _0x4d8ccc(_0x566a38[_0x11b3('0x15')][_0x11b3('0x16')]);}logger[_0x11b3('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x447bdf,_0x566a38[_0x11b3('0x15')]['message']);return _0x197e87(_0x566a38[_0x11b3('0x15')]['message']);}else{logger[_0x11b3('0xf')](_0x11b3('0x10'),_0x447bdf,_0x11b3('0x11'));_0x197e87(_0x566a38['result'][_0x11b3('0x16')]);}})[_0x11b3('0x17')](function(_0x4cd619){logger['error'](_0x11b3('0x10'),_0x447bdf,_0x4cd619);_0x4d8ccc(_0x4cd619);});});}exports[_0x11b3('0x18')]=function(_0x51ecd8){var _0x29ac14=this;return new Promise(function(_0x28b16d,_0x3a5f5b){return db[_0x11b3('0x19')][_0x11b3('0x1a')]({'raw':_0x51ecd8['options']?_0x51ecd8['options'][_0x11b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x51ecd8[_0x11b3('0x1c')]?_0x51ecd8['options'][_0x11b3('0x1d')]||null:null,'attributes':_0x51ecd8[_0x11b3('0x1c')]?_0x51ecd8[_0x11b3('0x1c')][_0x11b3('0x1e')]||null:null,'limit':_0x51ecd8[_0x11b3('0x1c')]?_0x51ecd8[_0x11b3('0x1c')][_0x11b3('0x1f')]||null:null,'include':_0x51ecd8[_0x11b3('0x1c')]?_0x51ecd8['options'][_0x11b3('0x20')]?_['map'](_0x51ecd8['options'][_0x11b3('0x20')],function(_0x5e6271){return{'model':db[_0x5e6271['model']],'as':_0x5e6271['as'],'attributes':_0x5e6271[_0x11b3('0x1e')],'include':_0x5e6271[_0x11b3('0x20')]?_[_0x11b3('0x21')](_0x5e6271['include'],function(_0x37a68c){return{'model':db[_0x37a68c['model']],'as':_0x37a68c['as'],'attributes':_0x37a68c[_0x11b3('0x1e')],'include':_0x37a68c[_0x11b3('0x20')]?_[_0x11b3('0x21')](_0x37a68c[_0x11b3('0x20')],function(_0x5e3b71){return{'model':db[_0x5e3b71['model']],'as':_0x5e3b71['as'],'attributes':_0x5e3b71['attributes']};}):[]};}):[]};}):[]:[]})[_0x11b3('0xe')](function(_0x5de012){logger[_0x11b3('0xf')]('GetZendeskAccount',_0x51ecd8);logger[_0x11b3('0x12')](_0x11b3('0x18'),_0x51ecd8,JSON[_0x11b3('0x14')](_0x5de012));_0x28b16d(_0x5de012);})[_0x11b3('0x17')](function(_0x2f1ac6){logger[_0x11b3('0x15')](_0x11b3('0x18'),_0x2f1ac6[_0x11b3('0x16')],_0x51ecd8);_0x3a5f5b(_0x29ac14[_0x11b3('0x15')](0x1f4,_0x2f1ac6['message']));});});};exports[_0x11b3('0x22')]=function(_0x41a8e9){var _0x1766dc=this;return new Promise(function(_0x23e098,_0x172e61){return db[_0x11b3('0x19')][_0x11b3('0x23')]({'raw':_0x41a8e9[_0x11b3('0x1c')]?_0x41a8e9[_0x11b3('0x1c')][_0x11b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x41a8e9[_0x11b3('0x1c')]?_0x41a8e9[_0x11b3('0x1c')][_0x11b3('0x1d')]||null:null,'attributes':_0x41a8e9[_0x11b3('0x1c')]?_0x41a8e9[_0x11b3('0x1c')][_0x11b3('0x1e')]||null:null,'include':_0x41a8e9[_0x11b3('0x1c')]?_0x41a8e9['options'][_0x11b3('0x20')]?_[_0x11b3('0x21')](_0x41a8e9['options'][_0x11b3('0x20')],function(_0x1a979a){return{'model':db[_0x1a979a['model']],'as':_0x1a979a['as'],'attributes':_0x1a979a[_0x11b3('0x1e')],'include':_0x1a979a[_0x11b3('0x20')]?_[_0x11b3('0x21')](_0x1a979a['include'],function(_0x38df74){return{'model':db[_0x38df74['model']],'as':_0x38df74['as'],'attributes':_0x38df74[_0x11b3('0x1e')],'include':_0x38df74[_0x11b3('0x20')]?_['map'](_0x38df74['include'],function(_0x52aba9){return{'model':db[_0x52aba9['model']],'as':_0x52aba9['as'],'attributes':_0x52aba9[_0x11b3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11b3('0xe')](function(_0x2bb3e4){logger[_0x11b3('0xf')](_0x11b3('0x22'),_0x41a8e9);logger[_0x11b3('0x12')](_0x11b3('0x22'),_0x41a8e9,JSON[_0x11b3('0x14')](_0x2bb3e4));_0x23e098(_0x2bb3e4);})['catch'](function(_0x1215e7){logger['error']('ShowZendeskAccount',_0x1215e7['message'],_0x41a8e9);_0x172e61(_0x1766dc[_0x11b3('0x15')](0x1f4,_0x1215e7[_0x11b3('0x16')]));});});}; \ No newline at end of file +var _0x1618=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','request','then','info'];(function(_0x3ac230,_0x5ca9db){var _0x2b22a3=function(_0x4bd51){while(--_0x4bd51){_0x3ac230['push'](_0x3ac230['shift']());}};_0x2b22a3(++_0x5ca9db);}(_0x1618,0x148));var _0x8161=function(_0x358ede,_0x63d22){_0x358ede=_0x358ede-0x0;var _0x59cec9=_0x1618[_0x358ede];return _0x59cec9;};'use strict';var _=require(_0x8161('0x0'));var util=require(_0x8161('0x1'));var moment=require(_0x8161('0x2'));var BPromise=require(_0x8161('0x3'));var rs=require(_0x8161('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8161('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8161('0x6'));var config=require(_0x8161('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8161('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55747d,_0x40e624,_0x45a39a){return new BPromise(function(_0x24aea0,_0x578b8a){return client[_0x8161('0x9')](_0x55747d,_0x45a39a)[_0x8161('0xa')](function(_0x1beeaf){logger[_0x8161('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x40e624,'request\x20sent');logger[_0x8161('0xc')](_0x8161('0xd'),_0x40e624,_0x8161('0xe'),JSON['stringify'](_0x1beeaf));if(_0x1beeaf['error']){if(_0x1beeaf[_0x8161('0xf')][_0x8161('0x10')]===0x1f4){logger[_0x8161('0xf')](_0x8161('0x11'),_0x40e624,_0x1beeaf[_0x8161('0xf')][_0x8161('0x12')]);return _0x578b8a(_0x1beeaf[_0x8161('0xf')][_0x8161('0x12')]);}logger[_0x8161('0xf')](_0x8161('0x11'),_0x40e624,_0x1beeaf['error'][_0x8161('0x12')]);return _0x24aea0(_0x1beeaf[_0x8161('0xf')]['message']);}else{logger[_0x8161('0xb')](_0x8161('0x11'),_0x40e624,_0x8161('0xe'));_0x24aea0(_0x1beeaf[_0x8161('0x13')][_0x8161('0x12')]);}})[_0x8161('0x14')](function(_0x1ec390){logger[_0x8161('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x40e624,_0x1ec390);_0x578b8a(_0x1ec390);});});}exports[_0x8161('0x15')]=function(_0x4cf2cb){var _0x56ad96=this;return new Promise(function(_0x10a4f7,_0x5826cc){return db['ZendeskAccount'][_0x8161('0x16')]({'raw':_0x4cf2cb[_0x8161('0x17')]?_0x4cf2cb[_0x8161('0x17')][_0x8161('0x18')]===undefined?!![]:![]:!![],'where':_0x4cf2cb[_0x8161('0x17')]?_0x4cf2cb[_0x8161('0x17')][_0x8161('0x19')]||null:null,'attributes':_0x4cf2cb[_0x8161('0x17')]?_0x4cf2cb[_0x8161('0x17')][_0x8161('0x1a')]||null:null,'limit':_0x4cf2cb[_0x8161('0x17')]?_0x4cf2cb[_0x8161('0x17')][_0x8161('0x1b')]||null:null,'include':_0x4cf2cb[_0x8161('0x17')]?_0x4cf2cb['options'][_0x8161('0x1c')]?_[_0x8161('0x1d')](_0x4cf2cb[_0x8161('0x17')]['include'],function(_0x5c3910){return{'model':db[_0x5c3910[_0x8161('0x1e')]],'as':_0x5c3910['as'],'attributes':_0x5c3910[_0x8161('0x1a')],'include':_0x5c3910['include']?_[_0x8161('0x1d')](_0x5c3910['include'],function(_0x3366f2){return{'model':db[_0x3366f2[_0x8161('0x1e')]],'as':_0x3366f2['as'],'attributes':_0x3366f2[_0x8161('0x1a')],'include':_0x3366f2['include']?_['map'](_0x3366f2['include'],function(_0x4582ff){return{'model':db[_0x4582ff[_0x8161('0x1e')]],'as':_0x4582ff['as'],'attributes':_0x4582ff[_0x8161('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aafe6){logger['info'](_0x8161('0x15'),_0x4cf2cb);logger[_0x8161('0xc')]('GetZendeskAccount',_0x4cf2cb,JSON['stringify'](_0x3aafe6));_0x10a4f7(_0x3aafe6);})[_0x8161('0x14')](function(_0x713520){logger[_0x8161('0xf')](_0x8161('0x15'),_0x713520['message'],_0x4cf2cb);_0x5826cc(_0x56ad96[_0x8161('0xf')](0x1f4,_0x713520[_0x8161('0x12')]));});});};exports[_0x8161('0x1f')]=function(_0x3a4a08){var _0x3758ca=this;return new Promise(function(_0x44d836,_0xb1e583){return db[_0x8161('0x20')]['find']({'raw':_0x3a4a08[_0x8161('0x17')]?_0x3a4a08[_0x8161('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3a4a08['options']?_0x3a4a08[_0x8161('0x17')][_0x8161('0x19')]||null:null,'attributes':_0x3a4a08[_0x8161('0x17')]?_0x3a4a08['options'][_0x8161('0x1a')]||null:null,'include':_0x3a4a08[_0x8161('0x17')]?_0x3a4a08[_0x8161('0x17')][_0x8161('0x1c')]?_['map'](_0x3a4a08[_0x8161('0x17')][_0x8161('0x1c')],function(_0x5d71b3){return{'model':db[_0x5d71b3[_0x8161('0x1e')]],'as':_0x5d71b3['as'],'attributes':_0x5d71b3[_0x8161('0x1a')],'include':_0x5d71b3[_0x8161('0x1c')]?_[_0x8161('0x1d')](_0x5d71b3[_0x8161('0x1c')],function(_0x390502){return{'model':db[_0x390502['model']],'as':_0x390502['as'],'attributes':_0x390502['attributes'],'include':_0x390502['include']?_['map'](_0x390502[_0x8161('0x1c')],function(_0x4e1101){return{'model':db[_0x4e1101[_0x8161('0x1e')]],'as':_0x4e1101['as'],'attributes':_0x4e1101[_0x8161('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8161('0xa')](function(_0x55e7ac){logger[_0x8161('0xb')](_0x8161('0x1f'),_0x3a4a08);logger[_0x8161('0xc')](_0x8161('0x1f'),_0x3a4a08,JSON[_0x8161('0x21')](_0x55e7ac));_0x44d836(_0x55e7ac);})['catch'](function(_0x60111){logger['error'](_0x8161('0x1f'),_0x60111[_0x8161('0x12')],_0x3a4a08);_0xb1e583(_0x3758ca[_0x8161('0xf')](0x1f4,_0x60111[_0x8161('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 36e27f9..2caacbf 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0xbdb7[_0x2baca1];return _0x9aa62a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +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(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x36ee,0xe8));var _0xe36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ee[_0x3dd15e];return _0x231fd0;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 645a9e9..95eaf4f 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 _0xfd12=['exports','STRING','sequelize'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0xfd12,0x176));var _0x2fd1=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xfd12[_0x48999d];return _0x1ad0d1;};'use strict';var Sequelize=require(_0x2fd1('0x0'));module[_0x2fd1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2fd1('0x2')]}}; \ No newline at end of file +var _0x8a49=['STRING','sequelize','exports'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x8a49,0x7c));var _0x98a4=function(_0x88da9,_0x52cd6a){_0x88da9=_0x88da9-0x0;var _0x42df80=_0x8a49[_0x88da9];return _0x42df80;};'use strict';var Sequelize=require(_0x98a4('0x0'));module[_0x98a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d47af84..e0df003 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 _0x3c45=['status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','index','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ZendeskConfiguration','findAll','catch','show','keys','rawAttributes','create','body','update','destroy','find','findOne','ZendeskField','map','getFields','getSubjects','params','getDescriptions','getTags','setTags','ids','eml-format','request-promise','moment','util','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x1d42a3,_0xd49411){var _0x534b00=function(_0xd9f03a){while(--_0xd9f03a){_0x1d42a3['push'](_0x1d42a3['shift']());}};_0x534b00(++_0xd49411);}(_0x3c45,0x87));var _0x53c4=function(_0x1327f7,_0x574202){_0x1327f7=_0x1327f7-0x0;var _0xa7a00c=_0x3c45[_0x1327f7];return _0xa7a00c;};'use strict';var emlformat=require(_0x53c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x53c4('0x1'));var moment=require(_0x53c4('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53c4('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x53c4('0x4'));var fs=require('fs');var fs_extra=require(_0x53c4('0x5'));var _=require('lodash');var squel=require(_0x53c4('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x53c4('0x7'));var toCsv=require(_0x53c4('0x8'));var querystring=require(_0x53c4('0x9'));var Papa=require(_0x53c4('0xa'));var Redis=require(_0x53c4('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x53c4('0xc'));var as=require(_0x53c4('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x53c4('0xe'));var config=require(_0x53c4('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x53c4('0x10'))['db'];function respondWithStatusCode(_0x12843f,_0x13135a){_0x13135a=_0x13135a||0xcc;return function(_0x272ebd){if(_0x272ebd){return _0x12843f[_0x53c4('0x11')](_0x13135a);}return _0x12843f['status'](_0x13135a)[_0x53c4('0x12')]();};}function respondWithResult(_0xa73bab,_0x3bfd84){_0x3bfd84=_0x3bfd84||0xc8;return function(_0x5e5a1e){if(_0x5e5a1e){return _0xa73bab[_0x53c4('0x13')](_0x3bfd84)[_0x53c4('0x14')](_0x5e5a1e);}};}function respondWithFilteredResult(_0x4db7a1,_0x1ddfbd){return function(_0x49d46a){if(_0x49d46a){var _0x35cd2e=typeof _0x1ddfbd['offset']===_0x53c4('0x15')&&typeof _0x1ddfbd['limit']==='undefined';var _0x47f329=_0x49d46a['count'];var _0x5682fd=_0x35cd2e?0x0:_0x1ddfbd[_0x53c4('0x16')];var _0xe9a767=_0x35cd2e?_0x49d46a[_0x53c4('0x17')]:_0x1ddfbd[_0x53c4('0x16')]+_0x1ddfbd[_0x53c4('0x18')];var _0x4d26e8;if(_0xe9a767>=_0x47f329){_0xe9a767=_0x47f329;_0x4d26e8=0xc8;}else{_0x4d26e8=0xce;}_0x4db7a1[_0x53c4('0x13')](_0x4d26e8);return _0x4db7a1[_0x53c4('0x19')](_0x53c4('0x1a'),_0x5682fd+'-'+_0xe9a767+'/'+_0x47f329)[_0x53c4('0x14')](_0x49d46a);}return null;};}function patchUpdates(_0x4da0e2){return function(_0x90c75c){try{jsonpatch[_0x53c4('0x1b')](_0x90c75c,_0x4da0e2,!![]);}catch(_0x185b6d){return BPromise[_0x53c4('0x1c')](_0x185b6d);}return _0x90c75c[_0x53c4('0x1d')]();};}function saveUpdates(_0x7f0898,_0x5e7fb5){return function(_0x3128e6){if(_0x3128e6){return _0x3128e6['update'](_0x7f0898)[_0x53c4('0x1e')](function(_0x13464d){return _0x13464d;});}return null;};}function removeEntity(_0x36cf6c,_0x1974ba){return function(_0x194ffe){if(_0x194ffe){return _0x194ffe['destroy']()['then'](function(){_0x36cf6c[_0x53c4('0x13')](0xcc)[_0x53c4('0x12')]();});}};}function handleEntityNotFound(_0x968119,_0x1e65ae){return function(_0x54bcc5){if(!_0x54bcc5){_0x968119['sendStatus'](0x194);}return _0x54bcc5;};}function handleError(_0x33fef8,_0x40e677){_0x40e677=_0x40e677||0x1f4;return function(_0x3ef9b4){logger[_0x53c4('0x1f')](_0x3ef9b4[_0x53c4('0x20')]);if(_0x3ef9b4['name']){delete _0x3ef9b4[_0x53c4('0x21')];}_0x33fef8[_0x53c4('0x13')](_0x40e677)['send'](_0x3ef9b4);};}exports[_0x53c4('0x22')]=function(_0x3a6aba,_0x54b6c8){var _0x11677e={},_0x57c890={},_0x187ef3={'count':0x0,'rows':[]};var _0x3ffdb5=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x2787ce){return{'name':_0x2787ce['fieldName'],'type':_0x2787ce['type'][_0x53c4('0x23')]};});_0x57c890[_0x53c4('0x24')]=_['map'](_0x3ffdb5,_0x53c4('0x21'));_0x57c890[_0x53c4('0x25')]=_['keys'](_0x3a6aba[_0x53c4('0x25')]);_0x57c890[_0x53c4('0x26')]=_[_0x53c4('0x27')](_0x57c890[_0x53c4('0x24')],_0x57c890['query']);_0x11677e[_0x53c4('0x28')]=_[_0x53c4('0x27')](_0x57c890['model'],qs[_0x53c4('0x29')](_0x3a6aba[_0x53c4('0x25')][_0x53c4('0x29')]));_0x11677e[_0x53c4('0x28')]=_0x11677e[_0x53c4('0x28')][_0x53c4('0x2a')]?_0x11677e[_0x53c4('0x28')]:_0x57c890['model'];if(!_0x3a6aba['query'][_0x53c4('0x2b')](_0x53c4('0x2c'))){_0x11677e[_0x53c4('0x18')]=qs[_0x53c4('0x18')](_0x3a6aba['query'][_0x53c4('0x18')]);_0x11677e[_0x53c4('0x16')]=qs[_0x53c4('0x16')](_0x3a6aba[_0x53c4('0x25')][_0x53c4('0x16')]);}_0x11677e[_0x53c4('0x2d')]=qs[_0x53c4('0x2e')](_0x3a6aba[_0x53c4('0x25')][_0x53c4('0x2e')]);_0x11677e[_0x53c4('0x2f')]=qs['filters'](_[_0x53c4('0x30')](_0x3a6aba['query'],_0x57c890[_0x53c4('0x26')]),_0x3ffdb5);if(_0x3a6aba[_0x53c4('0x25')][_0x53c4('0x31')]){_0x11677e[_0x53c4('0x2f')]=_[_0x53c4('0x32')](_0x11677e[_0x53c4('0x2f')],{'$or':_['map'](_0x3ffdb5,function(_0x140144){if(_0x140144[_0x53c4('0x33')]!==_0x53c4('0x34')){var _0x5124ea={};_0x5124ea[_0x140144[_0x53c4('0x21')]]={'$like':'%'+_0x3a6aba[_0x53c4('0x25')]['filter']+'%'};return _0x5124ea;}})});}_0x11677e=_['merge']({},_0x11677e,_0x3a6aba[_0x53c4('0x35')]);var _0x149f15={'where':_0x11677e[_0x53c4('0x2f')]};return db['ZendeskConfiguration']['count'](_0x149f15)[_0x53c4('0x1e')](function(_0x507b24){_0x187ef3[_0x53c4('0x17')]=_0x507b24;if(_0x3a6aba['query'][_0x53c4('0x36')]){_0x11677e[_0x53c4('0x37')]=[{'all':!![]}];}return db[_0x53c4('0x38')][_0x53c4('0x39')](_0x11677e);})['then'](function(_0x38824c){_0x187ef3['rows']=_0x38824c;return _0x187ef3;})[_0x53c4('0x1e')](respondWithFilteredResult(_0x54b6c8,_0x11677e))[_0x53c4('0x3a')](handleError(_0x54b6c8,null));};exports[_0x53c4('0x3b')]=function(_0x303dee,_0x2451e4){var _0x4be649={'raw':![],'where':{'id':_0x303dee['params']['id']}},_0x2da159={};_0x2da159['model']=_[_0x53c4('0x3c')](db['ZendeskConfiguration'][_0x53c4('0x3d')]);_0x2da159[_0x53c4('0x25')]=_[_0x53c4('0x3c')](_0x303dee[_0x53c4('0x25')]);_0x2da159['filters']=_[_0x53c4('0x27')](_0x2da159[_0x53c4('0x24')],_0x2da159[_0x53c4('0x25')]);_0x4be649[_0x53c4('0x28')]=_[_0x53c4('0x27')](_0x2da159['model'],qs[_0x53c4('0x29')](_0x303dee['query'][_0x53c4('0x29')]));_0x4be649['attributes']=_0x4be649[_0x53c4('0x28')][_0x53c4('0x2a')]?_0x4be649[_0x53c4('0x28')]:_0x2da159['model'];if(_0x303dee[_0x53c4('0x25')][_0x53c4('0x36')]){_0x4be649['include']=[{'all':!![]}];}_0x4be649=_[_0x53c4('0x32')]({},_0x4be649,_0x303dee[_0x53c4('0x35')]);return db[_0x53c4('0x38')]['find'](_0x4be649)[_0x53c4('0x1e')](handleEntityNotFound(_0x2451e4,null))[_0x53c4('0x1e')](respondWithResult(_0x2451e4,null))[_0x53c4('0x3a')](handleError(_0x2451e4,null));};exports['create']=function(_0x129378,_0x59ae4a){return db[_0x53c4('0x38')][_0x53c4('0x3e')](_0x129378[_0x53c4('0x3f')],{})['then'](respondWithResult(_0x59ae4a,0xc9))[_0x53c4('0x3a')](handleError(_0x59ae4a,null));};exports[_0x53c4('0x40')]=function(_0x120125,_0x47c3cd){if(_0x120125[_0x53c4('0x3f')]['id']){delete _0x120125['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x120125['params']['id']}})[_0x53c4('0x1e')](handleEntityNotFound(_0x47c3cd,null))['then'](saveUpdates(_0x120125[_0x53c4('0x3f')],null))[_0x53c4('0x1e')](respondWithResult(_0x47c3cd,null))[_0x53c4('0x3a')](handleError(_0x47c3cd,null));};exports[_0x53c4('0x41')]=function(_0x8c7b0f,_0x3e057d){return db[_0x53c4('0x38')][_0x53c4('0x42')]({'where':{'id':_0x8c7b0f['params']['id']}})[_0x53c4('0x1e')](handleEntityNotFound(_0x3e057d,null))[_0x53c4('0x1e')](removeEntity(_0x3e057d,null))[_0x53c4('0x3a')](handleError(_0x3e057d,null));};exports['getFields']=function(_0x5710e8,_0x17c79f,_0x3c4925){var _0x1dd68a={};var _0x5872e0={};var _0x4da207;var _0x5ac39e;return db[_0x53c4('0x38')][_0x53c4('0x43')]({'where':{'id':_0x5710e8['params']['id']}})[_0x53c4('0x1e')](handleEntityNotFound(_0x17c79f,null))[_0x53c4('0x1e')](function(_0xd22ede){if(_0xd22ede){_0x4da207=_0xd22ede;_0x5872e0['model']=_['keys'](db[_0x53c4('0x44')][_0x53c4('0x3d')]);_0x5872e0[_0x53c4('0x25')]=_[_0x53c4('0x3c')](_0x5710e8['query']);_0x5872e0['filters']=_[_0x53c4('0x27')](_0x5872e0[_0x53c4('0x24')],_0x5872e0['query']);_0x1dd68a[_0x53c4('0x28')]=_[_0x53c4('0x27')](_0x5872e0[_0x53c4('0x24')],qs[_0x53c4('0x29')](_0x5710e8[_0x53c4('0x25')][_0x53c4('0x29')]));_0x1dd68a['attributes']=_0x1dd68a[_0x53c4('0x28')]['length']?_0x1dd68a[_0x53c4('0x28')]:_0x5872e0['model'];_0x1dd68a[_0x53c4('0x2d')]=qs[_0x53c4('0x2e')](_0x5710e8['query'][_0x53c4('0x2e')]);_0x1dd68a[_0x53c4('0x2f')]=qs[_0x53c4('0x26')](_[_0x53c4('0x30')](_0x5710e8[_0x53c4('0x25')],_0x5872e0[_0x53c4('0x26')]));if(_0x5710e8[_0x53c4('0x25')][_0x53c4('0x31')]){_0x1dd68a[_0x53c4('0x2f')]=_[_0x53c4('0x32')](_0x1dd68a[_0x53c4('0x2f')],{'$or':_[_0x53c4('0x45')](_0x1dd68a[_0x53c4('0x28')],function(_0xe01354){var _0x2f4d6e={};_0x2f4d6e[_0xe01354]={'$like':'%'+_0x5710e8[_0x53c4('0x25')]['filter']+'%'};return _0x2f4d6e;})});}_0x1dd68a=_['merge']({},_0x1dd68a,_0x5710e8[_0x53c4('0x35')]);return _0x4da207[_0x53c4('0x46')](_0x1dd68a);}})[_0x53c4('0x1e')](function(_0x50d739){if(_0x50d739){_0x5ac39e=_0x50d739['length'];if(!_0x5710e8['query']['hasOwnProperty'](_0x53c4('0x2c'))){_0x1dd68a[_0x53c4('0x18')]=qs['limit'](_0x5710e8[_0x53c4('0x25')]['limit']);_0x1dd68a[_0x53c4('0x16')]=qs[_0x53c4('0x16')](_0x5710e8['query'][_0x53c4('0x16')]);}return _0x4da207['getFields'](_0x1dd68a);}})[_0x53c4('0x1e')](function(_0x594dde){if(_0x594dde){return _0x594dde?{'count':_0x5ac39e,'rows':_0x594dde}:null;}})[_0x53c4('0x1e')](respondWithResult(_0x17c79f,null))[_0x53c4('0x3a')](handleError(_0x17c79f,null));};exports[_0x53c4('0x47')]=function(_0x69a1ff,_0x1627a8,_0x1bfc75){var _0x32a98b={};var _0x3fe796={};var _0x4d0346;var _0x42b692;return db[_0x53c4('0x38')]['findOne']({'where':{'id':_0x69a1ff[_0x53c4('0x48')]['id']}})['then'](handleEntityNotFound(_0x1627a8,null))[_0x53c4('0x1e')](function(_0x189fef){if(_0x189fef){_0x4d0346=_0x189fef;_0x3fe796['model']=_[_0x53c4('0x3c')](db[_0x53c4('0x44')]['rawAttributes']);_0x3fe796[_0x53c4('0x25')]=_[_0x53c4('0x3c')](_0x69a1ff['query']);_0x3fe796[_0x53c4('0x26')]=_['intersection'](_0x3fe796[_0x53c4('0x24')],_0x3fe796['query']);_0x32a98b[_0x53c4('0x28')]=_[_0x53c4('0x27')](_0x3fe796[_0x53c4('0x24')],qs[_0x53c4('0x29')](_0x69a1ff[_0x53c4('0x25')][_0x53c4('0x29')]));_0x32a98b[_0x53c4('0x28')]=_0x32a98b[_0x53c4('0x28')][_0x53c4('0x2a')]?_0x32a98b[_0x53c4('0x28')]:_0x3fe796[_0x53c4('0x24')];_0x32a98b['order']=qs[_0x53c4('0x2e')](_0x69a1ff['query'][_0x53c4('0x2e')]);_0x32a98b[_0x53c4('0x2f')]=qs[_0x53c4('0x26')](_[_0x53c4('0x30')](_0x69a1ff[_0x53c4('0x25')],_0x3fe796[_0x53c4('0x26')]));if(_0x69a1ff['query'][_0x53c4('0x31')]){_0x32a98b['where']=_[_0x53c4('0x32')](_0x32a98b[_0x53c4('0x2f')],{'$or':_[_0x53c4('0x45')](_0x32a98b[_0x53c4('0x28')],function(_0x47781c){var _0x528528={};_0x528528[_0x47781c]={'$like':'%'+_0x69a1ff['query'][_0x53c4('0x31')]+'%'};return _0x528528;})});}_0x32a98b=_[_0x53c4('0x32')]({},_0x32a98b,_0x69a1ff[_0x53c4('0x35')]);return _0x4d0346['getSubjects'](_0x32a98b);}})['then'](function(_0x17d198){if(_0x17d198){_0x42b692=_0x17d198[_0x53c4('0x2a')];if(!_0x69a1ff[_0x53c4('0x25')][_0x53c4('0x2b')]('nolimit')){_0x32a98b[_0x53c4('0x18')]=qs['limit'](_0x69a1ff[_0x53c4('0x25')][_0x53c4('0x18')]);_0x32a98b['offset']=qs[_0x53c4('0x16')](_0x69a1ff[_0x53c4('0x25')][_0x53c4('0x16')]);}return _0x4d0346[_0x53c4('0x47')](_0x32a98b);}})['then'](function(_0x17fee3){if(_0x17fee3){return _0x17fee3?{'count':_0x42b692,'rows':_0x17fee3}:null;}})[_0x53c4('0x1e')](respondWithResult(_0x1627a8,null))[_0x53c4('0x3a')](handleError(_0x1627a8,null));};exports[_0x53c4('0x49')]=function(_0x277228,_0xea6d3c,_0x1787b4){var _0x377009={};var _0xba374f={};var _0x38576e;var _0x5e62ec;return db[_0x53c4('0x38')][_0x53c4('0x43')]({'where':{'id':_0x277228[_0x53c4('0x48')]['id']}})['then'](handleEntityNotFound(_0xea6d3c,null))[_0x53c4('0x1e')](function(_0x319673){if(_0x319673){_0x38576e=_0x319673;_0xba374f[_0x53c4('0x24')]=_[_0x53c4('0x3c')](db[_0x53c4('0x44')][_0x53c4('0x3d')]);_0xba374f[_0x53c4('0x25')]=_[_0x53c4('0x3c')](_0x277228[_0x53c4('0x25')]);_0xba374f[_0x53c4('0x26')]=_[_0x53c4('0x27')](_0xba374f[_0x53c4('0x24')],_0xba374f[_0x53c4('0x25')]);_0x377009['attributes']=_['intersection'](_0xba374f[_0x53c4('0x24')],qs['fields'](_0x277228[_0x53c4('0x25')]['fields']));_0x377009[_0x53c4('0x28')]=_0x377009[_0x53c4('0x28')][_0x53c4('0x2a')]?_0x377009['attributes']:_0xba374f['model'];_0x377009[_0x53c4('0x2d')]=qs[_0x53c4('0x2e')](_0x277228['query'][_0x53c4('0x2e')]);_0x377009['where']=qs[_0x53c4('0x26')](_[_0x53c4('0x30')](_0x277228[_0x53c4('0x25')],_0xba374f['filters']));if(_0x277228[_0x53c4('0x25')][_0x53c4('0x31')]){_0x377009[_0x53c4('0x2f')]=_[_0x53c4('0x32')](_0x377009['where'],{'$or':_['map'](_0x377009[_0x53c4('0x28')],function(_0x51728f){var _0x5dab55={};_0x5dab55[_0x51728f]={'$like':'%'+_0x277228[_0x53c4('0x25')]['filter']+'%'};return _0x5dab55;})});}_0x377009=_[_0x53c4('0x32')]({},_0x377009,_0x277228[_0x53c4('0x35')]);return _0x38576e[_0x53c4('0x49')](_0x377009);}})[_0x53c4('0x1e')](function(_0x1b62df){if(_0x1b62df){_0x5e62ec=_0x1b62df[_0x53c4('0x2a')];if(!_0x277228[_0x53c4('0x25')][_0x53c4('0x2b')]('nolimit')){_0x377009[_0x53c4('0x18')]=qs[_0x53c4('0x18')](_0x277228['query'][_0x53c4('0x18')]);_0x377009['offset']=qs[_0x53c4('0x16')](_0x277228['query'][_0x53c4('0x16')]);}return _0x38576e['getDescriptions'](_0x377009);}})[_0x53c4('0x1e')](function(_0xa5bc65){if(_0xa5bc65){return _0xa5bc65?{'count':_0x5e62ec,'rows':_0xa5bc65}:null;}})[_0x53c4('0x1e')](respondWithResult(_0xea6d3c,null))['catch'](handleError(_0xea6d3c,null));};exports['getTags']=function(_0x516181,_0x1863fa,_0x5e77d2){var _0x15f84d={};var _0x3b03e1={};var _0x4d6ddb;var _0x24b73b;return db['ZendeskConfiguration'][_0x53c4('0x43')]({'where':{'id':_0x516181[_0x53c4('0x48')]['id']}})['then'](handleEntityNotFound(_0x1863fa,null))[_0x53c4('0x1e')](function(_0x204f5e){if(_0x204f5e){_0x4d6ddb=_0x204f5e;_0x3b03e1[_0x53c4('0x24')]=_[_0x53c4('0x3c')](db['Tag']['rawAttributes']);_0x3b03e1['query']=_[_0x53c4('0x3c')](_0x516181[_0x53c4('0x25')]);_0x3b03e1['filters']=_[_0x53c4('0x27')](_0x3b03e1['model'],_0x3b03e1[_0x53c4('0x25')]);_0x15f84d[_0x53c4('0x28')]=_['intersection'](_0x3b03e1[_0x53c4('0x24')],qs['fields'](_0x516181[_0x53c4('0x25')]['fields']));_0x15f84d[_0x53c4('0x28')]=_0x15f84d[_0x53c4('0x28')][_0x53c4('0x2a')]?_0x15f84d['attributes']:_0x3b03e1['model'];_0x15f84d[_0x53c4('0x2d')]=qs[_0x53c4('0x2e')](_0x516181[_0x53c4('0x25')][_0x53c4('0x2e')]);_0x15f84d[_0x53c4('0x2f')]=qs[_0x53c4('0x26')](_[_0x53c4('0x30')](_0x516181[_0x53c4('0x25')],_0x3b03e1['filters']));if(_0x516181['query'][_0x53c4('0x31')]){_0x15f84d[_0x53c4('0x2f')]=_[_0x53c4('0x32')](_0x15f84d['where'],{'$or':_[_0x53c4('0x45')](_0x15f84d['attributes'],function(_0xdcde23){var _0x3ddb30={};_0x3ddb30[_0xdcde23]={'$like':'%'+_0x516181[_0x53c4('0x25')]['filter']+'%'};return _0x3ddb30;})});}_0x15f84d=_[_0x53c4('0x32')]({},_0x15f84d,_0x516181[_0x53c4('0x35')]);return _0x4d6ddb[_0x53c4('0x4a')](_0x15f84d);}})[_0x53c4('0x1e')](function(_0x3cfb1f){if(_0x3cfb1f){_0x24b73b=_0x3cfb1f[_0x53c4('0x2a')];if(!_0x516181[_0x53c4('0x25')][_0x53c4('0x2b')](_0x53c4('0x2c'))){_0x15f84d[_0x53c4('0x18')]=qs['limit'](_0x516181[_0x53c4('0x25')][_0x53c4('0x18')]);_0x15f84d[_0x53c4('0x16')]=qs['offset'](_0x516181[_0x53c4('0x25')]['offset']);}return _0x4d6ddb[_0x53c4('0x4a')](_0x15f84d);}})[_0x53c4('0x1e')](function(_0x13bc42){if(_0x13bc42){return _0x13bc42?{'count':_0x24b73b,'rows':_0x13bc42}:null;}})[_0x53c4('0x1e')](respondWithResult(_0x1863fa,null))[_0x53c4('0x3a')](handleError(_0x1863fa,null));};exports[_0x53c4('0x4b')]=function(_0x13647f,_0x3b4144,_0x459e04){if(_0x13647f[_0x53c4('0x3f')]['id']){delete _0x13647f['body']['id'];}return db[_0x53c4('0x38')][_0x53c4('0x43')]({'where':{'id':_0x13647f[_0x53c4('0x48')]['id']}})[_0x53c4('0x1e')](handleEntityNotFound(_0x3b4144,null))['then'](function(_0xc1f980){if(_0xc1f980){return _0xc1f980[_0x53c4('0x4b')](_0x13647f['body'][_0x53c4('0x4c')]||[]);}return null;})[_0x53c4('0x1e')](respondWithResult(_0x3b4144,null))[_0x53c4('0x3a')](handleError(_0x3b4144,null));}; \ No newline at end of file +var _0x451a=['../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','getFields','findOne','ZendeskField','order','pick','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1aa70a,_0x5dc427){var _0x372fb6=function(_0x1e6d10){while(--_0x1e6d10){_0x1aa70a['push'](_0x1aa70a['shift']());}};_0x372fb6(++_0x5dc427);}(_0x451a,0xf4));var _0xa451=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x451a[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0xa451('0x0'));var rimraf=require(_0xa451('0x1'));var zipdir=require(_0xa451('0x2'));var jsonpatch=require(_0xa451('0x3'));var rp=require('request-promise');var moment=require(_0xa451('0x4'));var BPromise=require(_0xa451('0x5'));var Mustache=require(_0xa451('0x6'));var util=require(_0xa451('0x7'));var path=require(_0xa451('0x8'));var sox=require(_0xa451('0x9'));var csv=require(_0xa451('0xa'));var ejs=require(_0xa451('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa451('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa451('0xd'));var deskjs=require(_0xa451('0xe'));var toCsv=require(_0xa451('0xa'));var querystring=require(_0xa451('0xf'));var Papa=require('papaparse');var Redis=require(_0xa451('0x10'));var authService=require(_0xa451('0x11'));var qs=require(_0xa451('0x12'));var as=require(_0xa451('0x13'));var hardwareService=require(_0xa451('0x14'));var logger=require(_0xa451('0x15'))(_0xa451('0x16'));var utils=require(_0xa451('0x17'));var config=require(_0xa451('0x18'));var licenseUtil=require(_0xa451('0x19'));var db=require(_0xa451('0x1a'))['db'];function respondWithStatusCode(_0x435daa,_0x19643f){_0x19643f=_0x19643f||0xcc;return function(_0x1c2844){if(_0x1c2844){return _0x435daa[_0xa451('0x1b')](_0x19643f);}return _0x435daa['status'](_0x19643f)[_0xa451('0x1c')]();};}function respondWithResult(_0x43205d,_0x2a1e7b){_0x2a1e7b=_0x2a1e7b||0xc8;return function(_0x2f89a9){if(_0x2f89a9){return _0x43205d['status'](_0x2a1e7b)[_0xa451('0x1d')](_0x2f89a9);}};}function respondWithFilteredResult(_0x19e6fb,_0x4050ce){return function(_0x3c16a0){if(_0x3c16a0){var _0x9caea4=typeof _0x4050ce['offset']===_0xa451('0x1e')&&typeof _0x4050ce[_0xa451('0x1f')]===_0xa451('0x1e');var _0x3f6df8=_0x3c16a0['count'];var _0x3ff84d=_0x9caea4?0x0:_0x4050ce[_0xa451('0x20')];var _0x307401=_0x9caea4?_0x3c16a0[_0xa451('0x21')]:_0x4050ce['offset']+_0x4050ce[_0xa451('0x1f')];var _0xa7b990;if(_0x307401>=_0x3f6df8){_0x307401=_0x3f6df8;_0xa7b990=0xc8;}else{_0xa7b990=0xce;}_0x19e6fb[_0xa451('0x22')](_0xa7b990);return _0x19e6fb[_0xa451('0x23')]('Content-Range',_0x3ff84d+'-'+_0x307401+'/'+_0x3f6df8)[_0xa451('0x1d')](_0x3c16a0);}return null;};}function patchUpdates(_0x3b13d3){return function(_0x30015a){try{jsonpatch[_0xa451('0x24')](_0x30015a,_0x3b13d3,!![]);}catch(_0x465972){return BPromise[_0xa451('0x25')](_0x465972);}return _0x30015a[_0xa451('0x26')]();};}function saveUpdates(_0x4e25f2,_0x2f0018){return function(_0x388766){if(_0x388766){return _0x388766[_0xa451('0x27')](_0x4e25f2)[_0xa451('0x28')](function(_0x106667){return _0x106667;});}return null;};}function removeEntity(_0x1dd4a8,_0x34fd41){return function(_0x2813e9){if(_0x2813e9){return _0x2813e9[_0xa451('0x29')]()[_0xa451('0x28')](function(){_0x1dd4a8[_0xa451('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d790,_0x2a862f){return function(_0x7e0038){if(!_0x7e0038){_0x44d790['sendStatus'](0x194);}return _0x7e0038;};}function handleError(_0x299dd5,_0x32018f){_0x32018f=_0x32018f||0x1f4;return function(_0x561bd5){logger[_0xa451('0x2a')](_0x561bd5[_0xa451('0x2b')]);if(_0x561bd5[_0xa451('0x2c')]){delete _0x561bd5['name'];}_0x299dd5[_0xa451('0x22')](_0x32018f)[_0xa451('0x2d')](_0x561bd5);};}exports[_0xa451('0x2e')]=function(_0x29915b,_0x4617d3){var _0x321e94={},_0x51cfbf={},_0x5d2409={'count':0x0,'rows':[]};var _0x13215d=_[_0xa451('0x2f')](db['ZendeskConfiguration'][_0xa451('0x30')],function(_0x211de1){return{'name':_0x211de1[_0xa451('0x31')],'type':_0x211de1[_0xa451('0x32')][_0xa451('0x33')]};});_0x51cfbf[_0xa451('0x34')]=_['map'](_0x13215d,'name');_0x51cfbf['query']=_[_0xa451('0x35')](_0x29915b[_0xa451('0x36')]);_0x51cfbf['filters']=_[_0xa451('0x37')](_0x51cfbf[_0xa451('0x34')],_0x51cfbf[_0xa451('0x36')]);_0x321e94['attributes']=_[_0xa451('0x37')](_0x51cfbf['model'],qs['fields'](_0x29915b['query']['fields']));_0x321e94[_0xa451('0x38')]=_0x321e94[_0xa451('0x38')]['length']?_0x321e94['attributes']:_0x51cfbf[_0xa451('0x34')];if(!_0x29915b[_0xa451('0x36')][_0xa451('0x39')](_0xa451('0x3a'))){_0x321e94[_0xa451('0x1f')]=qs[_0xa451('0x1f')](_0x29915b['query'][_0xa451('0x1f')]);_0x321e94[_0xa451('0x20')]=qs[_0xa451('0x20')](_0x29915b['query'][_0xa451('0x20')]);}_0x321e94['order']=qs[_0xa451('0x3b')](_0x29915b[_0xa451('0x36')][_0xa451('0x3b')]);_0x321e94[_0xa451('0x3c')]=qs[_0xa451('0x3d')](_['pick'](_0x29915b[_0xa451('0x36')],_0x51cfbf[_0xa451('0x3d')]),_0x13215d);if(_0x29915b[_0xa451('0x36')]['filter']){_0x321e94[_0xa451('0x3c')]=_[_0xa451('0x3e')](_0x321e94[_0xa451('0x3c')],{'$or':_[_0xa451('0x2f')](_0x13215d,function(_0x5df837){if(_0x5df837[_0xa451('0x32')]!==_0xa451('0x3f')){var _0x25c4ca={};_0x25c4ca[_0x5df837[_0xa451('0x2c')]]={'$like':'%'+_0x29915b['query']['filter']+'%'};return _0x25c4ca;}})});}_0x321e94=_[_0xa451('0x3e')]({},_0x321e94,_0x29915b[_0xa451('0x40')]);var _0x4623c8={'where':_0x321e94[_0xa451('0x3c')]};return db[_0xa451('0x41')][_0xa451('0x21')](_0x4623c8)[_0xa451('0x28')](function(_0x1d4968){_0x5d2409[_0xa451('0x21')]=_0x1d4968;if(_0x29915b[_0xa451('0x36')][_0xa451('0x42')]){_0x321e94[_0xa451('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xa451('0x44')](_0x321e94);})['then'](function(_0x29d874){_0x5d2409[_0xa451('0x45')]=_0x29d874;return _0x5d2409;})[_0xa451('0x28')](respondWithFilteredResult(_0x4617d3,_0x321e94))[_0xa451('0x46')](handleError(_0x4617d3,null));};exports[_0xa451('0x47')]=function(_0x815674,_0x362778){var _0x22d7ec={'raw':![],'where':{'id':_0x815674[_0xa451('0x48')]['id']}},_0x45ce0c={};_0x45ce0c[_0xa451('0x34')]=_['keys'](db[_0xa451('0x41')][_0xa451('0x30')]);_0x45ce0c[_0xa451('0x36')]=_['keys'](_0x815674[_0xa451('0x36')]);_0x45ce0c[_0xa451('0x3d')]=_[_0xa451('0x37')](_0x45ce0c[_0xa451('0x34')],_0x45ce0c[_0xa451('0x36')]);_0x22d7ec[_0xa451('0x38')]=_[_0xa451('0x37')](_0x45ce0c['model'],qs['fields'](_0x815674[_0xa451('0x36')][_0xa451('0x49')]));_0x22d7ec[_0xa451('0x38')]=_0x22d7ec['attributes'][_0xa451('0x4a')]?_0x22d7ec[_0xa451('0x38')]:_0x45ce0c[_0xa451('0x34')];if(_0x815674[_0xa451('0x36')][_0xa451('0x42')]){_0x22d7ec['include']=[{'all':!![]}];}_0x22d7ec=_[_0xa451('0x3e')]({},_0x22d7ec,_0x815674[_0xa451('0x40')]);return db[_0xa451('0x41')][_0xa451('0x4b')](_0x22d7ec)[_0xa451('0x28')](handleEntityNotFound(_0x362778,null))[_0xa451('0x28')](respondWithResult(_0x362778,null))[_0xa451('0x46')](handleError(_0x362778,null));};exports[_0xa451('0x4c')]=function(_0x18c538,_0x5c6150){return db[_0xa451('0x41')][_0xa451('0x4c')](_0x18c538[_0xa451('0x4d')],{})[_0xa451('0x28')](respondWithResult(_0x5c6150,0xc9))['catch'](handleError(_0x5c6150,null));};exports[_0xa451('0x27')]=function(_0x3e96f1,_0x451d8c){if(_0x3e96f1[_0xa451('0x4d')]['id']){delete _0x3e96f1[_0xa451('0x4d')]['id'];}return db['ZendeskConfiguration'][_0xa451('0x4b')]({'where':{'id':_0x3e96f1[_0xa451('0x48')]['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x451d8c,null))[_0xa451('0x28')](saveUpdates(_0x3e96f1[_0xa451('0x4d')],null))[_0xa451('0x28')](respondWithResult(_0x451d8c,null))[_0xa451('0x46')](handleError(_0x451d8c,null));};exports[_0xa451('0x29')]=function(_0x29df4b,_0x3ca4de){return db[_0xa451('0x41')][_0xa451('0x4b')]({'where':{'id':_0x29df4b[_0xa451('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ca4de,null))['then'](removeEntity(_0x3ca4de,null))['catch'](handleError(_0x3ca4de,null));};exports[_0xa451('0x4e')]=function(_0x52b1e4,_0x1f94c6,_0x335823){var _0x1af28e={};var _0x4c9aa5={};var _0x1e3c90;var _0x731a41;return db['ZendeskConfiguration'][_0xa451('0x4f')]({'where':{'id':_0x52b1e4[_0xa451('0x48')]['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x1f94c6,null))[_0xa451('0x28')](function(_0x129504){if(_0x129504){_0x1e3c90=_0x129504;_0x4c9aa5['model']=_[_0xa451('0x35')](db[_0xa451('0x50')][_0xa451('0x30')]);_0x4c9aa5[_0xa451('0x36')]=_[_0xa451('0x35')](_0x52b1e4[_0xa451('0x36')]);_0x4c9aa5[_0xa451('0x3d')]=_[_0xa451('0x37')](_0x4c9aa5[_0xa451('0x34')],_0x4c9aa5[_0xa451('0x36')]);_0x1af28e[_0xa451('0x38')]=_[_0xa451('0x37')](_0x4c9aa5[_0xa451('0x34')],qs['fields'](_0x52b1e4[_0xa451('0x36')]['fields']));_0x1af28e[_0xa451('0x38')]=_0x1af28e[_0xa451('0x38')][_0xa451('0x4a')]?_0x1af28e[_0xa451('0x38')]:_0x4c9aa5[_0xa451('0x34')];_0x1af28e[_0xa451('0x51')]=qs[_0xa451('0x3b')](_0x52b1e4[_0xa451('0x36')][_0xa451('0x3b')]);_0x1af28e[_0xa451('0x3c')]=qs[_0xa451('0x3d')](_[_0xa451('0x52')](_0x52b1e4[_0xa451('0x36')],_0x4c9aa5[_0xa451('0x3d')]));if(_0x52b1e4['query'][_0xa451('0x53')]){_0x1af28e[_0xa451('0x3c')]=_[_0xa451('0x3e')](_0x1af28e['where'],{'$or':_['map'](_0x1af28e['attributes'],function(_0x2f3fa5){var _0x87970f={};_0x87970f[_0x2f3fa5]={'$like':'%'+_0x52b1e4['query'][_0xa451('0x53')]+'%'};return _0x87970f;})});}_0x1af28e=_['merge']({},_0x1af28e,_0x52b1e4[_0xa451('0x40')]);return _0x1e3c90[_0xa451('0x4e')](_0x1af28e);}})[_0xa451('0x28')](function(_0x35dfac){if(_0x35dfac){_0x731a41=_0x35dfac['length'];if(!_0x52b1e4[_0xa451('0x36')][_0xa451('0x39')](_0xa451('0x3a'))){_0x1af28e[_0xa451('0x1f')]=qs[_0xa451('0x1f')](_0x52b1e4[_0xa451('0x36')][_0xa451('0x1f')]);_0x1af28e[_0xa451('0x20')]=qs['offset'](_0x52b1e4[_0xa451('0x36')][_0xa451('0x20')]);}return _0x1e3c90[_0xa451('0x4e')](_0x1af28e);}})[_0xa451('0x28')](function(_0x43cfef){if(_0x43cfef){return _0x43cfef?{'count':_0x731a41,'rows':_0x43cfef}:null;}})['then'](respondWithResult(_0x1f94c6,null))['catch'](handleError(_0x1f94c6,null));};exports[_0xa451('0x54')]=function(_0x209ad7,_0x14f5af,_0x96d35){var _0x558400={};var _0x1dc064={};var _0x34a7a5;var _0x44f2ac;return db[_0xa451('0x41')][_0xa451('0x4f')]({'where':{'id':_0x209ad7[_0xa451('0x48')]['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x14f5af,null))['then'](function(_0x3124c6){if(_0x3124c6){_0x34a7a5=_0x3124c6;_0x1dc064[_0xa451('0x34')]=_[_0xa451('0x35')](db[_0xa451('0x50')]['rawAttributes']);_0x1dc064[_0xa451('0x36')]=_[_0xa451('0x35')](_0x209ad7[_0xa451('0x36')]);_0x1dc064[_0xa451('0x3d')]=_[_0xa451('0x37')](_0x1dc064[_0xa451('0x34')],_0x1dc064[_0xa451('0x36')]);_0x558400[_0xa451('0x38')]=_['intersection'](_0x1dc064[_0xa451('0x34')],qs[_0xa451('0x49')](_0x209ad7['query'][_0xa451('0x49')]));_0x558400['attributes']=_0x558400[_0xa451('0x38')][_0xa451('0x4a')]?_0x558400['attributes']:_0x1dc064['model'];_0x558400['order']=qs['sort'](_0x209ad7[_0xa451('0x36')][_0xa451('0x3b')]);_0x558400[_0xa451('0x3c')]=qs['filters'](_[_0xa451('0x52')](_0x209ad7[_0xa451('0x36')],_0x1dc064[_0xa451('0x3d')]));if(_0x209ad7[_0xa451('0x36')][_0xa451('0x53')]){_0x558400[_0xa451('0x3c')]=_[_0xa451('0x3e')](_0x558400[_0xa451('0x3c')],{'$or':_[_0xa451('0x2f')](_0x558400[_0xa451('0x38')],function(_0x5c52d2){var _0x297401={};_0x297401[_0x5c52d2]={'$like':'%'+_0x209ad7[_0xa451('0x36')][_0xa451('0x53')]+'%'};return _0x297401;})});}_0x558400=_[_0xa451('0x3e')]({},_0x558400,_0x209ad7['options']);return _0x34a7a5['getSubjects'](_0x558400);}})[_0xa451('0x28')](function(_0xd6753b){if(_0xd6753b){_0x44f2ac=_0xd6753b[_0xa451('0x4a')];if(!_0x209ad7[_0xa451('0x36')][_0xa451('0x39')]('nolimit')){_0x558400['limit']=qs[_0xa451('0x1f')](_0x209ad7[_0xa451('0x36')]['limit']);_0x558400[_0xa451('0x20')]=qs['offset'](_0x209ad7[_0xa451('0x36')][_0xa451('0x20')]);}return _0x34a7a5[_0xa451('0x54')](_0x558400);}})[_0xa451('0x28')](function(_0x3bb74a){if(_0x3bb74a){return _0x3bb74a?{'count':_0x44f2ac,'rows':_0x3bb74a}:null;}})[_0xa451('0x28')](respondWithResult(_0x14f5af,null))['catch'](handleError(_0x14f5af,null));};exports[_0xa451('0x55')]=function(_0x5e0f1c,_0x1d937b,_0x2b4478){var _0x555300={};var _0x1d6695={};var _0xeec2a1;var _0x1a860e;return db[_0xa451('0x41')][_0xa451('0x4f')]({'where':{'id':_0x5e0f1c[_0xa451('0x48')]['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x1d937b,null))['then'](function(_0x312c37){if(_0x312c37){_0xeec2a1=_0x312c37;_0x1d6695[_0xa451('0x34')]=_[_0xa451('0x35')](db[_0xa451('0x50')][_0xa451('0x30')]);_0x1d6695[_0xa451('0x36')]=_[_0xa451('0x35')](_0x5e0f1c[_0xa451('0x36')]);_0x1d6695[_0xa451('0x3d')]=_[_0xa451('0x37')](_0x1d6695[_0xa451('0x34')],_0x1d6695[_0xa451('0x36')]);_0x555300[_0xa451('0x38')]=_[_0xa451('0x37')](_0x1d6695[_0xa451('0x34')],qs[_0xa451('0x49')](_0x5e0f1c[_0xa451('0x36')][_0xa451('0x49')]));_0x555300[_0xa451('0x38')]=_0x555300[_0xa451('0x38')][_0xa451('0x4a')]?_0x555300[_0xa451('0x38')]:_0x1d6695[_0xa451('0x34')];_0x555300[_0xa451('0x51')]=qs[_0xa451('0x3b')](_0x5e0f1c[_0xa451('0x36')][_0xa451('0x3b')]);_0x555300['where']=qs[_0xa451('0x3d')](_[_0xa451('0x52')](_0x5e0f1c['query'],_0x1d6695['filters']));if(_0x5e0f1c[_0xa451('0x36')][_0xa451('0x53')]){_0x555300['where']=_[_0xa451('0x3e')](_0x555300[_0xa451('0x3c')],{'$or':_[_0xa451('0x2f')](_0x555300[_0xa451('0x38')],function(_0x1133cd){var _0x410cfe={};_0x410cfe[_0x1133cd]={'$like':'%'+_0x5e0f1c[_0xa451('0x36')]['filter']+'%'};return _0x410cfe;})});}_0x555300=_[_0xa451('0x3e')]({},_0x555300,_0x5e0f1c[_0xa451('0x40')]);return _0xeec2a1[_0xa451('0x55')](_0x555300);}})[_0xa451('0x28')](function(_0x26ae2c){if(_0x26ae2c){_0x1a860e=_0x26ae2c['length'];if(!_0x5e0f1c['query'][_0xa451('0x39')]('nolimit')){_0x555300[_0xa451('0x1f')]=qs[_0xa451('0x1f')](_0x5e0f1c[_0xa451('0x36')][_0xa451('0x1f')]);_0x555300[_0xa451('0x20')]=qs[_0xa451('0x20')](_0x5e0f1c[_0xa451('0x36')][_0xa451('0x20')]);}return _0xeec2a1['getDescriptions'](_0x555300);}})[_0xa451('0x28')](function(_0x2a5f33){if(_0x2a5f33){return _0x2a5f33?{'count':_0x1a860e,'rows':_0x2a5f33}:null;}})[_0xa451('0x28')](respondWithResult(_0x1d937b,null))[_0xa451('0x46')](handleError(_0x1d937b,null));};exports[_0xa451('0x56')]=function(_0x29ee0f,_0x1f6f47,_0x458566){var _0x3d2e14={};var _0x50f02c={};var _0x3198c3;var _0x636557;return db[_0xa451('0x41')][_0xa451('0x4f')]({'where':{'id':_0x29ee0f['params']['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x1f6f47,null))['then'](function(_0xc0c952){if(_0xc0c952){_0x3198c3=_0xc0c952;_0x50f02c['model']=_[_0xa451('0x35')](db[_0xa451('0x57')]['rawAttributes']);_0x50f02c[_0xa451('0x36')]=_[_0xa451('0x35')](_0x29ee0f[_0xa451('0x36')]);_0x50f02c['filters']=_[_0xa451('0x37')](_0x50f02c[_0xa451('0x34')],_0x50f02c[_0xa451('0x36')]);_0x3d2e14[_0xa451('0x38')]=_[_0xa451('0x37')](_0x50f02c[_0xa451('0x34')],qs[_0xa451('0x49')](_0x29ee0f[_0xa451('0x36')][_0xa451('0x49')]));_0x3d2e14[_0xa451('0x38')]=_0x3d2e14['attributes'][_0xa451('0x4a')]?_0x3d2e14[_0xa451('0x38')]:_0x50f02c[_0xa451('0x34')];_0x3d2e14[_0xa451('0x51')]=qs[_0xa451('0x3b')](_0x29ee0f[_0xa451('0x36')][_0xa451('0x3b')]);_0x3d2e14[_0xa451('0x3c')]=qs[_0xa451('0x3d')](_[_0xa451('0x52')](_0x29ee0f[_0xa451('0x36')],_0x50f02c[_0xa451('0x3d')]));if(_0x29ee0f[_0xa451('0x36')][_0xa451('0x53')]){_0x3d2e14[_0xa451('0x3c')]=_[_0xa451('0x3e')](_0x3d2e14[_0xa451('0x3c')],{'$or':_[_0xa451('0x2f')](_0x3d2e14[_0xa451('0x38')],function(_0x357827){var _0x1e2cf3={};_0x1e2cf3[_0x357827]={'$like':'%'+_0x29ee0f[_0xa451('0x36')][_0xa451('0x53')]+'%'};return _0x1e2cf3;})});}_0x3d2e14=_['merge']({},_0x3d2e14,_0x29ee0f[_0xa451('0x40')]);return _0x3198c3[_0xa451('0x56')](_0x3d2e14);}})[_0xa451('0x28')](function(_0x3108bf){if(_0x3108bf){_0x636557=_0x3108bf[_0xa451('0x4a')];if(!_0x29ee0f[_0xa451('0x36')]['hasOwnProperty'](_0xa451('0x3a'))){_0x3d2e14['limit']=qs['limit'](_0x29ee0f[_0xa451('0x36')][_0xa451('0x1f')]);_0x3d2e14[_0xa451('0x20')]=qs[_0xa451('0x20')](_0x29ee0f[_0xa451('0x36')]['offset']);}return _0x3198c3[_0xa451('0x56')](_0x3d2e14);}})[_0xa451('0x28')](function(_0x5a374b){if(_0x5a374b){return _0x5a374b?{'count':_0x636557,'rows':_0x5a374b}:null;}})['then'](respondWithResult(_0x1f6f47,null))[_0xa451('0x46')](handleError(_0x1f6f47,null));};exports['setTags']=function(_0x442a6c,_0x473c7e,_0x1ce737){if(_0x442a6c['body']['id']){delete _0x442a6c[_0xa451('0x4d')]['id'];}return db[_0xa451('0x41')]['findOne']({'where':{'id':_0x442a6c[_0xa451('0x48')]['id']}})[_0xa451('0x28')](handleEntityNotFound(_0x473c7e,null))[_0xa451('0x28')](function(_0x23b580){if(_0x23b580){return _0x23b580[_0xa451('0x58')](_0x442a6c['body'][_0xa451('0x59')]||[]);}return null;})[_0xa451('0x28')](respondWithResult(_0x473c7e,null))[_0xa451('0x46')](handleError(_0x473c7e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f4332fa..32bd096 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 _0x1eba=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x326db1,_0x125e34){var _0x1bebe5=function(_0x11a115){while(--_0x11a115){_0x326db1['push'](_0x326db1['shift']());}};_0x1bebe5(++_0x125e34);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x1eba[_0x4a6cf8];return _0x22205e;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0xf3d96a,_0x157302){var _0x4a2a30=function(_0xe8a989){while(--_0xe8a989){_0xf3d96a['push'](_0xf3d96a['shift']());}};_0x4a2a30(++_0x157302);}(_0x3266,0x6a));var _0x6326=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x3266[_0x648163];return _0x199d4d;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4394cd9..2478977 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 _0x80e6=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x35a3da,_0x286c6a){var _0x568a40=function(_0x4afc63){while(--_0x4afc63){_0x35a3da['push'](_0x35a3da['shift']());}};_0x568a40(++_0x286c6a);}(_0x80e6,0x87));var _0x680e=function(_0xc1da01,_0x1cf39d){_0xc1da01=_0xc1da01-0x0;var _0x48e3e7=_0x80e6[_0xc1da01];return _0x48e3e7;};'use strict';var _=require(_0x680e('0x0'));var util=require('util');var moment=require(_0x680e('0x1'));var BPromise=require(_0x680e('0x2'));var rs=require(_0x680e('0x3'));var fs=require('fs');var Redis=require(_0x680e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x680e('0x5'));var logger=require(_0x680e('0x6'))(_0x680e('0x7'));var config=require(_0x680e('0x8'));var jayson=require(_0x680e('0x9'));var client=jayson['client'][_0x680e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7fb1,_0x2bf7e3,_0x4f5274){return new BPromise(function(_0x5758a7,_0x3f968e){return client['request'](_0x2b7fb1,_0x4f5274)[_0x680e('0xb')](function(_0x1b9ce3){logger[_0x680e('0xc')](_0x680e('0xd'),_0x2bf7e3,_0x680e('0xe'));logger[_0x680e('0xf')](_0x680e('0x10'),_0x2bf7e3,_0x680e('0xe'),JSON[_0x680e('0x11')](_0x1b9ce3));if(_0x1b9ce3[_0x680e('0x12')]){if(_0x1b9ce3[_0x680e('0x12')]['code']===0x1f4){logger[_0x680e('0x12')](_0x680e('0xd'),_0x2bf7e3,_0x1b9ce3['error'][_0x680e('0x13')]);return _0x3f968e(_0x1b9ce3[_0x680e('0x12')][_0x680e('0x13')]);}logger[_0x680e('0x12')](_0x680e('0xd'),_0x2bf7e3,_0x1b9ce3[_0x680e('0x12')][_0x680e('0x13')]);return _0x5758a7(_0x1b9ce3[_0x680e('0x12')][_0x680e('0x13')]);}else{logger[_0x680e('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2bf7e3,_0x680e('0xe'));_0x5758a7(_0x1b9ce3['result'][_0x680e('0x13')]);}})[_0x680e('0x14')](function(_0x1d6147){logger['error'](_0x680e('0xd'),_0x2bf7e3,_0x1d6147);_0x3f968e(_0x1d6147);});});} \ No newline at end of file +var _0x25c1=['then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3daa17,_0x5a704e){var _0x3487d2=function(_0x3a4d21){while(--_0x3a4d21){_0x3daa17['push'](_0x3daa17['shift']());}};_0x3487d2(++_0x5a704e);}(_0x25c1,0x95));var _0x125c=function(_0x24f052,_0x2d48e6){_0x24f052=_0x24f052-0x0;var _0x26d48f=_0x25c1[_0x24f052];return _0x26d48f;};'use strict';var _=require('lodash');var util=require(_0x125c('0x0'));var moment=require(_0x125c('0x1'));var BPromise=require(_0x125c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x125c('0x3'));var db=require(_0x125c('0x4'))['db'];var utils=require(_0x125c('0x5'));var logger=require(_0x125c('0x6'))(_0x125c('0x7'));var config=require('../../config/environment');var jayson=require(_0x125c('0x8'));var client=jayson[_0x125c('0x9')][_0x125c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4a95,_0x4c268c,_0x573374){return new BPromise(function(_0x520dc7,_0x495696){return client[_0x125c('0xb')](_0x2e4a95,_0x573374)[_0x125c('0xc')](function(_0x393871){logger[_0x125c('0xd')](_0x125c('0xe'),_0x4c268c,'request\x20sent');logger['debug'](_0x125c('0xf'),_0x4c268c,_0x125c('0x10'),JSON[_0x125c('0x11')](_0x393871));if(_0x393871['error']){if(_0x393871[_0x125c('0x12')][_0x125c('0x13')]===0x1f4){logger[_0x125c('0x12')](_0x125c('0xe'),_0x4c268c,_0x393871[_0x125c('0x12')][_0x125c('0x14')]);return _0x495696(_0x393871[_0x125c('0x12')]['message']);}logger[_0x125c('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c268c,_0x393871[_0x125c('0x12')][_0x125c('0x14')]);return _0x520dc7(_0x393871[_0x125c('0x12')]['message']);}else{logger[_0x125c('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c268c,_0x125c('0x10'));_0x520dc7(_0x393871[_0x125c('0x15')]['message']);}})[_0x125c('0x16')](function(_0x422c7f){logger[_0x125c('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c268c,_0x422c7f);_0x495696(_0x422c7f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1b9904b..c2209fd 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 _0x73eb=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id'];(function(_0x207e0f,_0x13b5dd){var _0x1fcac2=function(_0x4e2929){while(--_0x4e2929){_0x207e0f['push'](_0x207e0f['shift']());}};_0x1fcac2(++_0x13b5dd);}(_0x73eb,0x170));var _0xb73e=function(_0x3e6d26,_0x2d169a){_0x3e6d26=_0x3e6d26-0x0;var _0x5369b4=_0x73eb[_0x3e6d26];return _0x5369b4;};'use strict';var multer=require(_0xb73e('0x0'));var util=require(_0xb73e('0x1'));var path=require('path');var timeout=require(_0xb73e('0x2'));var express=require(_0xb73e('0x3'));var router=express['Router']();var fs_extra=require(_0xb73e('0x4'));var auth=require(_0xb73e('0x5'));var interaction=require(_0xb73e('0x6'));var config=require(_0xb73e('0x7'));var controller=require(_0xb73e('0x8'));router[_0xb73e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb73e('0xa')]);router[_0xb73e('0x9')](_0xb73e('0xb'),auth[_0xb73e('0xc')](),controller[_0xb73e('0xd')]);router[_0xb73e('0xe')]('/',auth['isAuthenticated'](),controller[_0xb73e('0xf')]);router['put']('/:id',auth[_0xb73e('0xc')](),controller[_0xb73e('0x10')]);router[_0xb73e('0x11')](_0xb73e('0xb'),auth[_0xb73e('0xc')](),controller[_0xb73e('0x12')]);module[_0xb73e('0x13')]=router; \ No newline at end of file +var _0x8ae1=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x411f6b,_0x402629){var _0x272fcc=function(_0x412353){while(--_0x412353){_0x411f6b['push'](_0x411f6b['shift']());}};_0x272fcc(++_0x402629);}(_0x8ae1,0x182));var _0x18ae=function(_0x1cd29e,_0x1eb3b8){_0x1cd29e=_0x1cd29e-0x0;var _0x17da63=_0x8ae1[_0x1cd29e];return _0x17da63;};'use strict';var multer=require(_0x18ae('0x0'));var util=require(_0x18ae('0x1'));var path=require(_0x18ae('0x2'));var timeout=require(_0x18ae('0x3'));var express=require(_0x18ae('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x18ae('0x5'));var interaction=require(_0x18ae('0x6'));var config=require(_0x18ae('0x7'));var controller=require(_0x18ae('0x8'));router[_0x18ae('0x9')]('/',auth[_0x18ae('0xa')](),controller[_0x18ae('0xb')]);router[_0x18ae('0x9')](_0x18ae('0xc'),auth[_0x18ae('0xa')](),controller[_0x18ae('0xd')]);router['post']('/',auth[_0x18ae('0xa')](),controller[_0x18ae('0xe')]);router[_0x18ae('0xf')](_0x18ae('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x18ae('0x10')](_0x18ae('0xc'),auth[_0x18ae('0xa')](),controller[_0x18ae('0x11')]);module[_0x18ae('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index b177b24..a1ea03f 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 _0x8050=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0xf35659,_0x44dc97){var _0x218598=function(_0x47196b){while(--_0x47196b){_0xf35659['push'](_0xf35659['shift']());}};_0x218598(++_0x44dc97);}(_0x8050,0x99));var _0x0805=function(_0x41526f,_0x559a68){_0x41526f=_0x41526f-0x0;var _0x2a17d4=_0x8050[_0x41526f];return _0x2a17d4;};'use strict';var Sequelize=require(_0x0805('0x0'));module[_0x0805('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0805('0x2'),'variable',_0x0805('0x3'),_0x0805('0x4'),'picklist'),'defaultValue':_0x0805('0x2')},'content':{'type':Sequelize[_0x0805('0x5')]},'key':{'type':Sequelize[_0x0805('0x5')]},'keyType':{'type':Sequelize[_0x0805('0x6')](_0x0805('0x2'),_0x0805('0x7'),_0x0805('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0805('0x5')]},'nameField':{'type':Sequelize[_0x0805('0x5')]},'customField':{'type':Sequelize[_0x0805('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x46fd=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x46fd,0x133));var _0xd46f=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46fd[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xd46f('0x0'));module[_0xd46f('0x1')]={'type':{'type':Sequelize[_0xd46f('0x2')](_0xd46f('0x3'),_0xd46f('0x4'),_0xd46f('0x5'),_0xd46f('0x6'),'picklist'),'defaultValue':_0xd46f('0x3')},'content':{'type':Sequelize[_0xd46f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd46f('0x2')](_0xd46f('0x3'),_0xd46f('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd46f('0x7')]},'nameField':{'type':Sequelize[_0xd46f('0x7')]},'customField':{'type':Sequelize[_0xd46f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd46f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f4c30f6..0cf8f03 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 _0xe27c=['sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x4116c7,_0xbf72f7){var _0x17aab8=function(_0x5b836f){while(--_0x5b836f){_0x4116c7['push'](_0x4116c7['shift']());}};_0x17aab8(++_0xbf72f7);}(_0xe27c,0xec));var _0xce27=function(_0x22fcf6,_0x7b268a){_0x22fcf6=_0x22fcf6-0x0;var _0x296e98=_0xe27c[_0x22fcf6];return _0x296e98;};'use strict';var emlformat=require(_0xce27('0x0'));var rimraf=require(_0xce27('0x1'));var zipdir=require(_0xce27('0x2'));var jsonpatch=require(_0xce27('0x3'));var rp=require('request-promise');var moment=require(_0xce27('0x4'));var BPromise=require(_0xce27('0x5'));var Mustache=require('mustache');var util=require(_0xce27('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce27('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce27('0x8'));var crypto=require(_0xce27('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xce27('0xa'));var toCsv=require('to-csv');var querystring=require(_0xce27('0xb'));var Papa=require('papaparse');var Redis=require(_0xce27('0xc'));var authService=require(_0xce27('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xce27('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce27('0xf'))(_0xce27('0x10'));var utils=require(_0xce27('0x11'));var config=require(_0xce27('0x12'));var licenseUtil=require(_0xce27('0x13'));var db=require(_0xce27('0x14'))['db'];function respondWithStatusCode(_0x15a50b,_0x528e24){_0x528e24=_0x528e24||0xcc;return function(_0x55d1f6){if(_0x55d1f6){return _0x15a50b[_0xce27('0x15')](_0x528e24);}return _0x15a50b[_0xce27('0x16')](_0x528e24)[_0xce27('0x17')]();};}function respondWithResult(_0xac7f78,_0x1e7d99){_0x1e7d99=_0x1e7d99||0xc8;return function(_0x295bd3){if(_0x295bd3){return _0xac7f78[_0xce27('0x16')](_0x1e7d99)[_0xce27('0x18')](_0x295bd3);}};}function respondWithFilteredResult(_0x470451,_0x1bc4b8){return function(_0x5d183a){if(_0x5d183a){var _0x569828=typeof _0x1bc4b8['offset']===_0xce27('0x19')&&typeof _0x1bc4b8[_0xce27('0x1a')]===_0xce27('0x19');var _0x4385f5=_0x5d183a[_0xce27('0x1b')];var _0x221141=_0x569828?0x0:_0x1bc4b8[_0xce27('0x1c')];var _0x3145fb=_0x569828?_0x5d183a[_0xce27('0x1b')]:_0x1bc4b8[_0xce27('0x1c')]+_0x1bc4b8[_0xce27('0x1a')];var _0x384afc;if(_0x3145fb>=_0x4385f5){_0x3145fb=_0x4385f5;_0x384afc=0xc8;}else{_0x384afc=0xce;}_0x470451[_0xce27('0x16')](_0x384afc);return _0x470451[_0xce27('0x1d')](_0xce27('0x1e'),_0x221141+'-'+_0x3145fb+'/'+_0x4385f5)[_0xce27('0x18')](_0x5d183a);}return null;};}function patchUpdates(_0x32f0bb){return function(_0x2ba2d0){try{jsonpatch[_0xce27('0x1f')](_0x2ba2d0,_0x32f0bb,!![]);}catch(_0x2a9a0d){return BPromise[_0xce27('0x20')](_0x2a9a0d);}return _0x2ba2d0[_0xce27('0x21')]();};}function saveUpdates(_0x1a0c8d,_0x8f7def){return function(_0xe4e3b0){if(_0xe4e3b0){return _0xe4e3b0[_0xce27('0x22')](_0x1a0c8d)[_0xce27('0x23')](function(_0x533a1d){return _0x533a1d;});}return null;};}function removeEntity(_0x1cbde5,_0x3a6f80){return function(_0x10e90b){if(_0x10e90b){return _0x10e90b[_0xce27('0x24')]()[_0xce27('0x23')](function(){_0x1cbde5[_0xce27('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eeed9,_0x53af31){return function(_0x5a542a){if(!_0x5a542a){_0x4eeed9[_0xce27('0x15')](0x194);}return _0x5a542a;};}function handleError(_0x309eda,_0x1d14d8){_0x1d14d8=_0x1d14d8||0x1f4;return function(_0x23dd84){logger[_0xce27('0x25')](_0x23dd84[_0xce27('0x26')]);if(_0x23dd84[_0xce27('0x27')]){delete _0x23dd84[_0xce27('0x27')];}_0x309eda['status'](_0x1d14d8)[_0xce27('0x28')](_0x23dd84);};}exports[_0xce27('0x29')]=function(_0x467e40,_0x5485eb){var _0x1e8833={},_0x56325d={},_0x4e1203={'count':0x0,'rows':[]};var _0x2d2974=_[_0xce27('0x2a')](db[_0xce27('0x2b')][_0xce27('0x2c')],function(_0x67136a){return{'name':_0x67136a[_0xce27('0x2d')],'type':_0x67136a[_0xce27('0x2e')]['key']};});_0x56325d[_0xce27('0x2f')]=_['map'](_0x2d2974,_0xce27('0x27'));_0x56325d[_0xce27('0x30')]=_[_0xce27('0x31')](_0x467e40[_0xce27('0x30')]);_0x56325d['filters']=_[_0xce27('0x32')](_0x56325d[_0xce27('0x2f')],_0x56325d[_0xce27('0x30')]);_0x1e8833[_0xce27('0x33')]=_[_0xce27('0x32')](_0x56325d[_0xce27('0x2f')],qs[_0xce27('0x34')](_0x467e40['query'][_0xce27('0x34')]));_0x1e8833[_0xce27('0x33')]=_0x1e8833['attributes'][_0xce27('0x35')]?_0x1e8833[_0xce27('0x33')]:_0x56325d[_0xce27('0x2f')];if(!_0x467e40[_0xce27('0x30')][_0xce27('0x36')]('nolimit')){_0x1e8833[_0xce27('0x1a')]=qs[_0xce27('0x1a')](_0x467e40['query'][_0xce27('0x1a')]);_0x1e8833[_0xce27('0x1c')]=qs[_0xce27('0x1c')](_0x467e40['query']['offset']);}_0x1e8833[_0xce27('0x37')]=qs['sort'](_0x467e40[_0xce27('0x30')][_0xce27('0x38')]);_0x1e8833[_0xce27('0x39')]=qs[_0xce27('0x3a')](_['pick'](_0x467e40[_0xce27('0x30')],_0x56325d[_0xce27('0x3a')]),_0x2d2974);if(_0x467e40[_0xce27('0x30')][_0xce27('0x3b')]){_0x1e8833[_0xce27('0x39')]=_[_0xce27('0x3c')](_0x1e8833[_0xce27('0x39')],{'$or':_['map'](_0x2d2974,function(_0x4a8859){if(_0x4a8859[_0xce27('0x2e')]!==_0xce27('0x3d')){var _0x356a61={};_0x356a61[_0x4a8859[_0xce27('0x27')]]={'$like':'%'+_0x467e40['query'][_0xce27('0x3b')]+'%'};return _0x356a61;}})});}_0x1e8833=_['merge']({},_0x1e8833,_0x467e40[_0xce27('0x3e')]);var _0x3c9220={'where':_0x1e8833[_0xce27('0x39')]};return db['ZendeskField']['count'](_0x3c9220)[_0xce27('0x23')](function(_0x438cdc){_0x4e1203[_0xce27('0x1b')]=_0x438cdc;if(_0x467e40[_0xce27('0x30')]['includeAll']){_0x1e8833[_0xce27('0x3f')]=[{'all':!![]}];}return db[_0xce27('0x2b')][_0xce27('0x40')](_0x1e8833);})[_0xce27('0x23')](function(_0x561c8d){_0x4e1203[_0xce27('0x41')]=_0x561c8d;return _0x4e1203;})['then'](respondWithFilteredResult(_0x5485eb,_0x1e8833))[_0xce27('0x42')](handleError(_0x5485eb,null));};exports[_0xce27('0x43')]=function(_0x44cef2,_0xab9fce){var _0x1ee8cf={'raw':!![],'where':{'id':_0x44cef2[_0xce27('0x44')]['id']}},_0x34a60e={};_0x34a60e[_0xce27('0x2f')]=_[_0xce27('0x31')](db[_0xce27('0x2b')]['rawAttributes']);_0x34a60e[_0xce27('0x30')]=_[_0xce27('0x31')](_0x44cef2['query']);_0x34a60e[_0xce27('0x3a')]=_[_0xce27('0x32')](_0x34a60e[_0xce27('0x2f')],_0x34a60e[_0xce27('0x30')]);_0x1ee8cf[_0xce27('0x33')]=_[_0xce27('0x32')](_0x34a60e[_0xce27('0x2f')],qs[_0xce27('0x34')](_0x44cef2['query'][_0xce27('0x34')]));_0x1ee8cf[_0xce27('0x33')]=_0x1ee8cf[_0xce27('0x33')][_0xce27('0x35')]?_0x1ee8cf[_0xce27('0x33')]:_0x34a60e[_0xce27('0x2f')];if(_0x44cef2[_0xce27('0x30')][_0xce27('0x45')]){_0x1ee8cf[_0xce27('0x3f')]=[{'all':!![]}];}_0x1ee8cf=_[_0xce27('0x3c')]({},_0x1ee8cf,_0x44cef2[_0xce27('0x3e')]);return db[_0xce27('0x2b')][_0xce27('0x46')](_0x1ee8cf)[_0xce27('0x23')](handleEntityNotFound(_0xab9fce,null))[_0xce27('0x23')](respondWithResult(_0xab9fce,null))[_0xce27('0x42')](handleError(_0xab9fce,null));};exports[_0xce27('0x47')]=function(_0x4a4bc1,_0x293f79){return db[_0xce27('0x2b')][_0xce27('0x47')](_0x4a4bc1[_0xce27('0x48')],{})[_0xce27('0x23')](respondWithResult(_0x293f79,0xc9))[_0xce27('0x42')](handleError(_0x293f79,null));};exports['update']=function(_0x1f512b,_0x1c2840){if(_0x1f512b[_0xce27('0x48')]['id']){delete _0x1f512b[_0xce27('0x48')]['id'];}return db[_0xce27('0x2b')]['find']({'where':{'id':_0x1f512b['params']['id']}})['then'](handleEntityNotFound(_0x1c2840,null))[_0xce27('0x23')](saveUpdates(_0x1f512b['body'],null))[_0xce27('0x23')](respondWithResult(_0x1c2840,null))[_0xce27('0x42')](handleError(_0x1c2840,null));};exports['destroy']=function(_0x447384,_0x43edde){return db['ZendeskField'][_0xce27('0x46')]({'where':{'id':_0x447384['params']['id']}})[_0xce27('0x23')](handleEntityNotFound(_0x43edde,null))[_0xce27('0x23')](removeEntity(_0x43edde,null))[_0xce27('0x42')](handleError(_0x43edde,null));}; \ No newline at end of file +var _0x628a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','attributes','intersection','includeAll','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto'];(function(_0x2872b0,_0x4b0855){var _0x58b379=function(_0x18954b){while(--_0x18954b){_0x2872b0['push'](_0x2872b0['shift']());}};_0x58b379(++_0x4b0855);}(_0x628a,0x1bb));var _0xa628=function(_0x44b97c,_0x4f683d){_0x44b97c=_0x44b97c-0x0;var _0x3a41db=_0x628a[_0x44b97c];return _0x3a41db;};'use strict';var emlformat=require(_0xa628('0x0'));var rimraf=require(_0xa628('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa628('0x2'));var rp=require(_0xa628('0x3'));var moment=require(_0xa628('0x4'));var BPromise=require(_0xa628('0x5'));var Mustache=require(_0xa628('0x6'));var util=require(_0xa628('0x7'));var path=require('path');var sox=require(_0xa628('0x8'));var csv=require(_0xa628('0x9'));var ejs=require(_0xa628('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa628('0xb'));var crypto=require(_0xa628('0xc'));var jsforce=require(_0xa628('0xd'));var deskjs=require(_0xa628('0xe'));var toCsv=require(_0xa628('0x9'));var querystring=require(_0xa628('0xf'));var Papa=require(_0xa628('0x10'));var Redis=require('ioredis');var authService=require(_0xa628('0x11'));var qs=require(_0xa628('0x12'));var as=require(_0xa628('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa628('0x14'))(_0xa628('0x15'));var utils=require(_0xa628('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa628('0x17'))['db'];function respondWithStatusCode(_0xe78f38,_0x20ecf2){_0x20ecf2=_0x20ecf2||0xcc;return function(_0x4ecc6b){if(_0x4ecc6b){return _0xe78f38[_0xa628('0x18')](_0x20ecf2);}return _0xe78f38['status'](_0x20ecf2)[_0xa628('0x19')]();};}function respondWithResult(_0x4b7a86,_0xa55921){_0xa55921=_0xa55921||0xc8;return function(_0xf0260c){if(_0xf0260c){return _0x4b7a86['status'](_0xa55921)[_0xa628('0x1a')](_0xf0260c);}};}function respondWithFilteredResult(_0x34ef6c,_0x34048c){return function(_0x46e541){if(_0x46e541){var _0x97d0f=typeof _0x34048c[_0xa628('0x1b')]===_0xa628('0x1c')&&typeof _0x34048c['limit']===_0xa628('0x1c');var _0x449552=_0x46e541[_0xa628('0x1d')];var _0x49a654=_0x97d0f?0x0:_0x34048c[_0xa628('0x1b')];var _0x6817bb=_0x97d0f?_0x46e541[_0xa628('0x1d')]:_0x34048c[_0xa628('0x1b')]+_0x34048c[_0xa628('0x1e')];var _0x213065;if(_0x6817bb>=_0x449552){_0x6817bb=_0x449552;_0x213065=0xc8;}else{_0x213065=0xce;}_0x34ef6c[_0xa628('0x1f')](_0x213065);return _0x34ef6c['set'](_0xa628('0x20'),_0x49a654+'-'+_0x6817bb+'/'+_0x449552)[_0xa628('0x1a')](_0x46e541);}return null;};}function patchUpdates(_0x540a22){return function(_0x5c4e94){try{jsonpatch[_0xa628('0x21')](_0x5c4e94,_0x540a22,!![]);}catch(_0x91c87d){return BPromise[_0xa628('0x22')](_0x91c87d);}return _0x5c4e94[_0xa628('0x23')]();};}function saveUpdates(_0x25390e,_0x489aba){return function(_0x138172){if(_0x138172){return _0x138172[_0xa628('0x24')](_0x25390e)[_0xa628('0x25')](function(_0xa70b6){return _0xa70b6;});}return null;};}function removeEntity(_0x25f680,_0x5d09b8){return function(_0xda925){if(_0xda925){return _0xda925[_0xa628('0x26')]()[_0xa628('0x25')](function(){_0x25f680[_0xa628('0x1f')](0xcc)[_0xa628('0x19')]();});}};}function handleEntityNotFound(_0x4bd4f6,_0x6f86bd){return function(_0x989e3a){if(!_0x989e3a){_0x4bd4f6[_0xa628('0x18')](0x194);}return _0x989e3a;};}function handleError(_0x380174,_0x41b4c3){_0x41b4c3=_0x41b4c3||0x1f4;return function(_0x5364f6){logger[_0xa628('0x27')](_0x5364f6[_0xa628('0x28')]);if(_0x5364f6[_0xa628('0x29')]){delete _0x5364f6['name'];}_0x380174['status'](_0x41b4c3)[_0xa628('0x2a')](_0x5364f6);};}exports[_0xa628('0x2b')]=function(_0x379951,_0x4e3272){var _0x352e81={},_0x158fef={},_0x1eb962={'count':0x0,'rows':[]};var _0x309ba0=_[_0xa628('0x2c')](db[_0xa628('0x2d')][_0xa628('0x2e')],function(_0x3857c0){return{'name':_0x3857c0[_0xa628('0x2f')],'type':_0x3857c0[_0xa628('0x30')][_0xa628('0x31')]};});_0x158fef[_0xa628('0x32')]=_[_0xa628('0x2c')](_0x309ba0,'name');_0x158fef[_0xa628('0x33')]=_[_0xa628('0x34')](_0x379951['query']);_0x158fef[_0xa628('0x35')]=_['intersection'](_0x158fef[_0xa628('0x32')],_0x158fef['query']);_0x352e81['attributes']=_['intersection'](_0x158fef[_0xa628('0x32')],qs[_0xa628('0x36')](_0x379951[_0xa628('0x33')][_0xa628('0x36')]));_0x352e81['attributes']=_0x352e81['attributes'][_0xa628('0x37')]?_0x352e81['attributes']:_0x158fef['model'];if(!_0x379951['query']['hasOwnProperty'](_0xa628('0x38'))){_0x352e81['limit']=qs['limit'](_0x379951[_0xa628('0x33')][_0xa628('0x1e')]);_0x352e81[_0xa628('0x1b')]=qs[_0xa628('0x1b')](_0x379951[_0xa628('0x33')][_0xa628('0x1b')]);}_0x352e81[_0xa628('0x39')]=qs[_0xa628('0x3a')](_0x379951[_0xa628('0x33')][_0xa628('0x3a')]);_0x352e81['where']=qs[_0xa628('0x35')](_[_0xa628('0x3b')](_0x379951[_0xa628('0x33')],_0x158fef[_0xa628('0x35')]),_0x309ba0);if(_0x379951[_0xa628('0x33')][_0xa628('0x3c')]){_0x352e81[_0xa628('0x3d')]=_[_0xa628('0x3e')](_0x352e81[_0xa628('0x3d')],{'$or':_[_0xa628('0x2c')](_0x309ba0,function(_0x3d7e72){if(_0x3d7e72[_0xa628('0x30')]!==_0xa628('0x3f')){var _0x105bac={};_0x105bac[_0x3d7e72[_0xa628('0x29')]]={'$like':'%'+_0x379951[_0xa628('0x33')][_0xa628('0x3c')]+'%'};return _0x105bac;}})});}_0x352e81=_['merge']({},_0x352e81,_0x379951[_0xa628('0x40')]);var _0x5b05ec={'where':_0x352e81['where']};return db[_0xa628('0x2d')][_0xa628('0x1d')](_0x5b05ec)['then'](function(_0x4def2b){_0x1eb962['count']=_0x4def2b;if(_0x379951[_0xa628('0x33')]['includeAll']){_0x352e81[_0xa628('0x41')]=[{'all':!![]}];}return db[_0xa628('0x2d')][_0xa628('0x42')](_0x352e81);})['then'](function(_0x402624){_0x1eb962[_0xa628('0x43')]=_0x402624;return _0x1eb962;})[_0xa628('0x25')](respondWithFilteredResult(_0x4e3272,_0x352e81))[_0xa628('0x44')](handleError(_0x4e3272,null));};exports[_0xa628('0x45')]=function(_0x5e6cd9,_0x23d2ae){var _0x48ecc8={'raw':!![],'where':{'id':_0x5e6cd9[_0xa628('0x46')]['id']}},_0x379969={};_0x379969['model']=_[_0xa628('0x34')](db[_0xa628('0x2d')][_0xa628('0x2e')]);_0x379969[_0xa628('0x33')]=_[_0xa628('0x34')](_0x5e6cd9[_0xa628('0x33')]);_0x379969[_0xa628('0x35')]=_['intersection'](_0x379969[_0xa628('0x32')],_0x379969[_0xa628('0x33')]);_0x48ecc8[_0xa628('0x47')]=_[_0xa628('0x48')](_0x379969[_0xa628('0x32')],qs[_0xa628('0x36')](_0x5e6cd9['query'][_0xa628('0x36')]));_0x48ecc8[_0xa628('0x47')]=_0x48ecc8[_0xa628('0x47')][_0xa628('0x37')]?_0x48ecc8[_0xa628('0x47')]:_0x379969['model'];if(_0x5e6cd9['query'][_0xa628('0x49')]){_0x48ecc8[_0xa628('0x41')]=[{'all':!![]}];}_0x48ecc8=_['merge']({},_0x48ecc8,_0x5e6cd9[_0xa628('0x40')]);return db['ZendeskField'][_0xa628('0x4a')](_0x48ecc8)[_0xa628('0x25')](handleEntityNotFound(_0x23d2ae,null))[_0xa628('0x25')](respondWithResult(_0x23d2ae,null))['catch'](handleError(_0x23d2ae,null));};exports['create']=function(_0x3aeb81,_0x4ced29){return db[_0xa628('0x2d')]['create'](_0x3aeb81[_0xa628('0x4b')],{})[_0xa628('0x25')](respondWithResult(_0x4ced29,0xc9))[_0xa628('0x44')](handleError(_0x4ced29,null));};exports[_0xa628('0x24')]=function(_0x4753ea,_0x4fdd7f){if(_0x4753ea[_0xa628('0x4b')]['id']){delete _0x4753ea[_0xa628('0x4b')]['id'];}return db[_0xa628('0x2d')][_0xa628('0x4a')]({'where':{'id':_0x4753ea['params']['id']}})['then'](handleEntityNotFound(_0x4fdd7f,null))['then'](saveUpdates(_0x4753ea['body'],null))['then'](respondWithResult(_0x4fdd7f,null))[_0xa628('0x44')](handleError(_0x4fdd7f,null));};exports['destroy']=function(_0x17e538,_0x444782){return db['ZendeskField'][_0xa628('0x4a')]({'where':{'id':_0x17e538[_0xa628('0x46')]['id']}})['then'](handleEntityNotFound(_0x444782,null))[_0xa628('0x25')](removeEntity(_0x444782,null))[_0xa628('0x44')](handleError(_0x444782,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c8ba648..bdb91a3 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 _0x8f70=['path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x8f70,0x159));var _0x08f7=function(_0x5a13a4,_0x5fdeda){_0x5a13a4=_0x5a13a4-0x0;var _0x32f4bb=_0x8f70[_0x5a13a4];return _0x32f4bb;};'use strict';var _=require(_0x08f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x08f7('0x1'));var moment=require(_0x08f7('0x2'));var BPromise=require(_0x08f7('0x3'));var rp=require(_0x08f7('0x4'));var fs=require('fs');var path=require(_0x08f7('0x5'));var rimraf=require(_0x08f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x08f7('0x7'));module[_0x08f7('0x8')]=function(_0x28d42f,_0x12f010){return _0x28d42f[_0x08f7('0x9')](_0x08f7('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x08f7('0xb'),'fields':[_0x08f7('0xc'),_0x08f7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe32c=['FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xe32c,0x13c));var _0xce32=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xe32c[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0xce32('0x0'));var util=require(_0xce32('0x1'));var logger=require(_0xce32('0x2'))(_0xce32('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce32('0x4'));var fs=require('fs');var path=require(_0xce32('0x5'));var rimraf=require(_0xce32('0x6'));var config=require(_0xce32('0x7'));var attributes=require(_0xce32('0x8'));module[_0xce32('0x9')]=function(_0x196a66,_0x55a9ec){return _0x196a66['define'](_0xce32('0xa'),attributes,{'tableName':_0xce32('0xb'),'paranoid':![],'indexes':[{'name':_0xce32('0xc'),'fields':[_0xce32('0xd'),_0xce32('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 f138e6b..79efb72 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 _0xa218=['util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','lodash'];(function(_0x57ddce,_0x3cefd3){var _0x253594=function(_0x4ca5fd){while(--_0x4ca5fd){_0x57ddce['push'](_0x57ddce['shift']());}};_0x253594(++_0x3cefd3);}(_0xa218,0xf1));var _0x8a21=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa218[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x8a21('0x0'));var util=require(_0x8a21('0x1'));var moment=require(_0x8a21('0x2'));var BPromise=require(_0x8a21('0x3'));var rs=require(_0x8a21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a21('0x5'));var logger=require('../../config/logger')(_0x8a21('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a21('0x7'));var client=jayson[_0x8a21('0x8')][_0x8a21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c2e26,_0x1aa5e0,_0x30b0c0){return new BPromise(function(_0x52d366,_0x4caae5){return client[_0x8a21('0xa')](_0x3c2e26,_0x30b0c0)[_0x8a21('0xb')](function(_0x1ccbef){logger[_0x8a21('0xc')](_0x8a21('0xd'),_0x1aa5e0,_0x8a21('0xe'));logger[_0x8a21('0xf')](_0x8a21('0x10'),_0x1aa5e0,_0x8a21('0xe'),JSON[_0x8a21('0x11')](_0x1ccbef));if(_0x1ccbef['error']){if(_0x1ccbef['error'][_0x8a21('0x12')]===0x1f4){logger['error'](_0x8a21('0xd'),_0x1aa5e0,_0x1ccbef['error'][_0x8a21('0x13')]);return _0x4caae5(_0x1ccbef[_0x8a21('0x14')][_0x8a21('0x13')]);}logger[_0x8a21('0x14')](_0x8a21('0xd'),_0x1aa5e0,_0x1ccbef['error']['message']);return _0x52d366(_0x1ccbef[_0x8a21('0x14')][_0x8a21('0x13')]);}else{logger[_0x8a21('0xc')](_0x8a21('0xd'),_0x1aa5e0,_0x8a21('0xe'));_0x52d366(_0x1ccbef[_0x8a21('0x15')]['message']);}})['catch'](function(_0x180c1c){logger[_0x8a21('0x14')](_0x8a21('0xd'),_0x1aa5e0,_0x180c1c);_0x4caae5(_0x180c1c);});});} \ No newline at end of file +var _0xb0ab=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x58de4a,_0x564dbc){var _0x178820=function(_0x3576ef){while(--_0x3576ef){_0x58de4a['push'](_0x58de4a['shift']());}};_0x178820(++_0x564dbc);}(_0xb0ab,0x1be));var _0xbb0a=function(_0x1eae03,_0x54f591){_0x1eae03=_0x1eae03-0x0;var _0x1465d2=_0xb0ab[_0x1eae03];return _0x1465d2;};'use strict';var _=require(_0xbb0a('0x0'));var util=require(_0xbb0a('0x1'));var moment=require('moment');var BPromise=require(_0xbb0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb0a('0x3'));var db=require(_0xbb0a('0x4'))['db'];var utils=require(_0xbb0a('0x5'));var logger=require('../../config/logger')(_0xbb0a('0x6'));var config=require(_0xbb0a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe0d19e,_0xfe66ea,_0x12395c){return new BPromise(function(_0x23a6cb,_0x42537a){return client[_0xbb0a('0x9')](_0xe0d19e,_0x12395c)[_0xbb0a('0xa')](function(_0x4c6b46){logger[_0xbb0a('0xb')](_0xbb0a('0xc'),_0xfe66ea,_0xbb0a('0xd'));logger[_0xbb0a('0xe')](_0xbb0a('0xf'),_0xfe66ea,_0xbb0a('0xd'),JSON['stringify'](_0x4c6b46));if(_0x4c6b46[_0xbb0a('0x10')]){if(_0x4c6b46['error'][_0xbb0a('0x11')]===0x1f4){logger[_0xbb0a('0x10')](_0xbb0a('0xc'),_0xfe66ea,_0x4c6b46['error'][_0xbb0a('0x12')]);return _0x42537a(_0x4c6b46['error'][_0xbb0a('0x12')]);}logger[_0xbb0a('0x10')](_0xbb0a('0xc'),_0xfe66ea,_0x4c6b46[_0xbb0a('0x10')][_0xbb0a('0x12')]);return _0x23a6cb(_0x4c6b46[_0xbb0a('0x10')][_0xbb0a('0x12')]);}else{logger[_0xbb0a('0xb')](_0xbb0a('0xc'),_0xfe66ea,_0xbb0a('0xd'));_0x23a6cb(_0x4c6b46[_0xbb0a('0x13')][_0xbb0a('0x12')]);}})[_0xbb0a('0x14')](function(_0x352e89){logger[_0xbb0a('0x10')](_0xbb0a('0xc'),_0xfe66ea,_0x352e89);_0x42537a(_0x352e89);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 02f787e..4c59165 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 _0x2a0d=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x20d970,_0x454832){var _0x5e9c45=function(_0x114d52){while(--_0x114d52){_0x20d970['push'](_0x20d970['shift']());}};_0x5e9c45(++_0x454832);}(_0x2a0d,0x1c4));var _0xd2a0=function(_0x170d3e,_0x370eac){_0x170d3e=_0x170d3e-0x0;var _0x40f85a=_0x2a0d[_0x170d3e];return _0x40f85a;};'use strict';var multer=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var path=require(_0xd2a0('0x2'));var timeout=require(_0xd2a0('0x3'));var express=require('express');var router=express[_0xd2a0('0x4')]();var fs_extra=require(_0xd2a0('0x5'));var auth=require(_0xd2a0('0x6'));var interaction=require(_0xd2a0('0x7'));var config=require('../../config/environment');var controller=require(_0xd2a0('0x8'));router[_0xd2a0('0x9')]('/',auth[_0xd2a0('0xa')](),controller[_0xd2a0('0xb')]);router[_0xd2a0('0x9')](_0xd2a0('0xc'),auth[_0xd2a0('0xa')](),controller[_0xd2a0('0xd')]);router[_0xd2a0('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd2a0('0x9')](_0xd2a0('0xe'),auth['isAuthenticated'](),controller[_0xd2a0('0xf')]);router[_0xd2a0('0x10')]('/',auth[_0xd2a0('0xa')](),controller[_0xd2a0('0x11')]);router['post'](_0xd2a0('0x12'),auth[_0xd2a0('0xa')](),controller[_0xd2a0('0x13')]);router[_0xd2a0('0x14')]('/:id',auth[_0xd2a0('0xa')](),controller[_0xd2a0('0x15')]);router[_0xd2a0('0x16')](_0xd2a0('0xc'),auth[_0xd2a0('0xa')](),controller[_0xd2a0('0x17')]);module[_0xd2a0('0x18')]=router; \ No newline at end of file +var _0xffbb=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','put','delete','destroy','exports'];(function(_0x44d53a,_0x380fce){var _0x426da3=function(_0x5598dd){while(--_0x5598dd){_0x44d53a['push'](_0x44d53a['shift']());}};_0x426da3(++_0x380fce);}(_0xffbb,0x1e0));var _0xbffb=function(_0x1fd68a,_0x374699){_0x1fd68a=_0x1fd68a-0x0;var _0x41863f=_0xffbb[_0x1fd68a];return _0x41863f;};'use strict';var multer=require(_0xbffb('0x0'));var util=require(_0xbffb('0x1'));var path=require(_0xbffb('0x2'));var timeout=require(_0xbffb('0x3'));var express=require('express');var router=express[_0xbffb('0x4')]();var fs_extra=require(_0xbffb('0x5'));var auth=require(_0xbffb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbffb('0x7'));var controller=require(_0xbffb('0x8'));router[_0xbffb('0x9')]('/',auth[_0xbffb('0xa')](),controller[_0xbffb('0xb')]);router[_0xbffb('0x9')](_0xbffb('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xbffb('0xd'),auth[_0xbffb('0xa')](),controller['getConfigurations']);router[_0xbffb('0x9')](_0xbffb('0xe'),auth[_0xbffb('0xa')](),controller['getFields']);router[_0xbffb('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbffb('0xf')](_0xbffb('0xd'),auth[_0xbffb('0xa')](),controller['addConfiguration']);router[_0xbffb('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbffb('0x11')](_0xbffb('0xc'),auth[_0xbffb('0xa')](),controller[_0xbffb('0x12')]);module[_0xbffb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1c6eecf..f3ba94f 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 _0xdace=['STRING','sequelize'];(function(_0x3f0640,_0xabfa53){var _0x55d1b9=function(_0x2ea6ae){while(--_0x2ea6ae){_0x3f0640['push'](_0x3f0640['shift']());}};_0x55d1b9(++_0xabfa53);}(_0xdace,0xc5));var _0xedac=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xdace[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd2ea=['sequelize','exports','STRING'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3960e5,_0x1b5e72){_0x3960e5=_0x3960e5-0x0;var _0x3e0dbf=_0xd2ea[_0x3960e5];return _0x3e0dbf;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 07deab1..f2d50a3 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 _0xe35c=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','com','serverUrl','slice','substring','refreshToken','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys'];(function(_0x3a492f,_0x21d491){var _0x33bd0f=function(_0x3d5c12){while(--_0x3d5c12){_0x3a492f['push'](_0x3a492f['shift']());}};_0x33bd0f(++_0x21d491);}(_0xe35c,0xd5));var _0xce35=function(_0x398b3d,_0x2f497e){_0x398b3d=_0x398b3d-0x0;var _0x20b1cf=_0xe35c[_0x398b3d];return _0x20b1cf;};'use strict';var emlformat=require(_0xce35('0x0'));var rimraf=require(_0xce35('0x1'));var zipdir=require(_0xce35('0x2'));var jsonpatch=require(_0xce35('0x3'));var rp=require(_0xce35('0x4'));var moment=require(_0xce35('0x5'));var BPromise=require(_0xce35('0x6'));var Mustache=require('mustache');var util=require(_0xce35('0x7'));var path=require(_0xce35('0x8'));var sox=require(_0xce35('0x9'));var csv=require(_0xce35('0xa'));var ejs=require(_0xce35('0xb'));var fs=require('fs');var fs_extra=require(_0xce35('0xc'));var _=require(_0xce35('0xd'));var squel=require(_0xce35('0xe'));var crypto=require(_0xce35('0xf'));var jsforce=require(_0xce35('0x10'));var deskjs=require(_0xce35('0x11'));var toCsv=require(_0xce35('0xa'));var querystring=require(_0xce35('0x12'));var Papa=require(_0xce35('0x13'));var Redis=require(_0xce35('0x14'));var authService=require(_0xce35('0x15'));var qs=require(_0xce35('0x16'));var as=require(_0xce35('0x17'));var hardwareService=require(_0xce35('0x18'));var logger=require(_0xce35('0x19'))('api');var utils=require(_0xce35('0x1a'));var config=require(_0xce35('0x1b'));var licenseUtil=require(_0xce35('0x1c'));var db=require(_0xce35('0x1d'))['db'];var integrations=require(_0xce35('0x1e'));function respondWithStatusCode(_0x12d871,_0x3fd0cf){_0x3fd0cf=_0x3fd0cf||0xcc;return function(_0x4d330c){if(_0x4d330c){return _0x12d871['sendStatus'](_0x3fd0cf);}return _0x12d871[_0xce35('0x1f')](_0x3fd0cf)[_0xce35('0x20')]();};}function respondWithResult(_0x245a7e,_0x1fd7ce){_0x1fd7ce=_0x1fd7ce||0xc8;return function(_0x31503d){if(_0x31503d){return _0x245a7e['status'](_0x1fd7ce)[_0xce35('0x21')](_0x31503d);}};}function respondWithFilteredResult(_0x37e143,_0x594c67){return function(_0x2e4057){if(_0x2e4057){var _0x57523b=typeof _0x594c67[_0xce35('0x22')]===_0xce35('0x23')&&typeof _0x594c67[_0xce35('0x24')]===_0xce35('0x23');var _0x588327=_0x2e4057[_0xce35('0x25')];var _0xba2fe8=_0x57523b?0x0:_0x594c67[_0xce35('0x22')];var _0xee75d=_0x57523b?_0x2e4057[_0xce35('0x25')]:_0x594c67[_0xce35('0x22')]+_0x594c67[_0xce35('0x24')];var _0x46daa3;if(_0xee75d>=_0x588327){_0xee75d=_0x588327;_0x46daa3=0xc8;}else{_0x46daa3=0xce;}_0x37e143['status'](_0x46daa3);return _0x37e143[_0xce35('0x26')]('Content-Range',_0xba2fe8+'-'+_0xee75d+'/'+_0x588327)['json'](_0x2e4057);}return null;};}function patchUpdates(_0x5b537d){return function(_0x35dc1a){try{jsonpatch['apply'](_0x35dc1a,_0x5b537d,!![]);}catch(_0x1ef81f){return BPromise[_0xce35('0x27')](_0x1ef81f);}return _0x35dc1a[_0xce35('0x28')]();};}function saveUpdates(_0x326176,_0x5af2e5){return function(_0x26f903){if(_0x26f903){return _0x26f903[_0xce35('0x29')](_0x326176)['then'](function(_0x1d6f0a){return _0x1d6f0a;});}return null;};}function removeEntity(_0x57ca2f,_0x5367a0){return function(_0x138c24){if(_0x138c24){return _0x138c24[_0xce35('0x2a')]()[_0xce35('0x2b')](function(){_0x57ca2f[_0xce35('0x1f')](0xcc)[_0xce35('0x20')]();});}};}function handleEntityNotFound(_0x5e0a1b,_0x26caab){return function(_0x54fccd){if(!_0x54fccd){_0x5e0a1b[_0xce35('0x2c')](0x194);}return _0x54fccd;};}function handleError(_0x27e617,_0x44fa94){_0x44fa94=_0x44fa94||0x1f4;return function(_0x2ac50c){logger[_0xce35('0x2d')](_0x2ac50c[_0xce35('0x2e')]);if(_0x2ac50c[_0xce35('0x2f')]){delete _0x2ac50c[_0xce35('0x2f')];}_0x27e617[_0xce35('0x1f')](_0x44fa94)[_0xce35('0x30')](_0x2ac50c);};}exports['index']=function(_0x2bfb24,_0x43dda7){var _0x47ceee={},_0x5f2111={},_0x129aa5={'count':0x0,'rows':[]};var _0x4aa760=_[_0xce35('0x31')](db[_0xce35('0x32')]['rawAttributes'],function(_0x16b371){return{'name':_0x16b371[_0xce35('0x33')],'type':_0x16b371[_0xce35('0x34')][_0xce35('0x35')]};});_0x5f2111[_0xce35('0x36')]=_[_0xce35('0x31')](_0x4aa760,_0xce35('0x2f'));_0x5f2111[_0xce35('0x37')]=_[_0xce35('0x38')](_0x2bfb24[_0xce35('0x37')]);_0x5f2111[_0xce35('0x39')]=_[_0xce35('0x3a')](_0x5f2111[_0xce35('0x36')],_0x5f2111[_0xce35('0x37')]);_0x47ceee[_0xce35('0x3b')]=_[_0xce35('0x3a')](_0x5f2111[_0xce35('0x36')],qs[_0xce35('0x3c')](_0x2bfb24[_0xce35('0x37')]['fields']));_0x47ceee[_0xce35('0x3b')]=_0x47ceee[_0xce35('0x3b')][_0xce35('0x3d')]?_0x47ceee[_0xce35('0x3b')]:_0x5f2111[_0xce35('0x36')];if(!_0x2bfb24['query']['hasOwnProperty']('nolimit')){_0x47ceee[_0xce35('0x24')]=qs['limit'](_0x2bfb24[_0xce35('0x37')][_0xce35('0x24')]);_0x47ceee['offset']=qs[_0xce35('0x22')](_0x2bfb24['query'][_0xce35('0x22')]);}_0x47ceee[_0xce35('0x3e')]=qs[_0xce35('0x3f')](_0x2bfb24[_0xce35('0x37')][_0xce35('0x3f')]);_0x47ceee['where']=qs['filters'](_[_0xce35('0x40')](_0x2bfb24[_0xce35('0x37')],_0x5f2111[_0xce35('0x39')]),_0x4aa760);if(_0x2bfb24['query'][_0xce35('0x41')]){_0x47ceee[_0xce35('0x42')]=_[_0xce35('0x43')](_0x47ceee[_0xce35('0x42')],{'$or':_['map'](_0x4aa760,function(_0x12cb31){if(_0x12cb31['type']!=='VIRTUAL'){var _0x5e2476={};_0x5e2476[_0x12cb31[_0xce35('0x2f')]]={'$like':'%'+_0x2bfb24[_0xce35('0x37')][_0xce35('0x41')]+'%'};return _0x5e2476;}})});}_0x47ceee=_['merge']({},_0x47ceee,_0x2bfb24[_0xce35('0x44')]);var _0x45fce6={'where':_0x47ceee[_0xce35('0x42')]};return db['ZohoAccount'][_0xce35('0x25')](_0x45fce6)[_0xce35('0x2b')](function(_0xa3dcd){_0x129aa5[_0xce35('0x25')]=_0xa3dcd;if(_0x2bfb24['query'][_0xce35('0x45')]){_0x47ceee[_0xce35('0x46')]=[{'all':!![]}];}return db[_0xce35('0x32')][_0xce35('0x47')](_0x47ceee);})[_0xce35('0x2b')](function(_0x57bdea){_0x129aa5[_0xce35('0x48')]=_0x57bdea;return _0x129aa5;})['then'](respondWithFilteredResult(_0x43dda7,_0x47ceee))[_0xce35('0x49')](handleError(_0x43dda7,null));};exports[_0xce35('0x4a')]=function(_0x46a3f6,_0x3ec65d){var _0x4e40c2={'raw':![],'where':{'id':_0x46a3f6['params']['id']}},_0x3c3850={};_0x3c3850[_0xce35('0x36')]=_[_0xce35('0x38')](db[_0xce35('0x32')][_0xce35('0x4b')]);_0x3c3850['query']=_[_0xce35('0x38')](_0x46a3f6[_0xce35('0x37')]);_0x3c3850[_0xce35('0x39')]=_[_0xce35('0x3a')](_0x3c3850[_0xce35('0x36')],_0x3c3850['query']);_0x4e40c2[_0xce35('0x3b')]=_[_0xce35('0x3a')](_0x3c3850['model'],qs[_0xce35('0x3c')](_0x46a3f6[_0xce35('0x37')][_0xce35('0x3c')]));_0x4e40c2[_0xce35('0x3b')]=_0x4e40c2['attributes']['length']?_0x4e40c2[_0xce35('0x3b')]:_0x3c3850[_0xce35('0x36')];if(_0x46a3f6[_0xce35('0x37')][_0xce35('0x45')]){_0x4e40c2[_0xce35('0x46')]=[{'all':!![]}];}_0x4e40c2=_[_0xce35('0x43')]({},_0x4e40c2,_0x46a3f6['options']);return db[_0xce35('0x32')][_0xce35('0x4c')](_0x4e40c2)[_0xce35('0x2b')](handleEntityNotFound(_0x3ec65d,null))[_0xce35('0x2b')](respondWithResult(_0x3ec65d,null))[_0xce35('0x49')](handleError(_0x3ec65d,null));};exports[_0xce35('0x4d')]=function(_0x53e85d,_0x3494bc){return db[_0xce35('0x32')][_0xce35('0x4d')](_0x53e85d[_0xce35('0x4e')],{})[_0xce35('0x2b')](respondWithResult(_0x3494bc,0xc9))['catch'](handleError(_0x3494bc,null));};exports[_0xce35('0x29')]=function(_0x56bbcc,_0x23ff5b){if(_0x56bbcc[_0xce35('0x4e')]['id']){delete _0x56bbcc[_0xce35('0x4e')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x56bbcc[_0xce35('0x4f')]['id']}})[_0xce35('0x2b')](handleEntityNotFound(_0x23ff5b,null))['then'](saveUpdates(_0x56bbcc[_0xce35('0x4e')],null))[_0xce35('0x2b')](respondWithResult(_0x23ff5b,null))[_0xce35('0x49')](handleError(_0x23ff5b,null));};exports[_0xce35('0x2a')]=function(_0x356812,_0x1c2b7e){return db[_0xce35('0x32')][_0xce35('0x4c')]({'where':{'id':_0x356812[_0xce35('0x4f')]['id']}})[_0xce35('0x2b')](handleEntityNotFound(_0x1c2b7e,null))['then'](removeEntity(_0x1c2b7e,null))[_0xce35('0x49')](handleError(_0x1c2b7e,null));};exports[_0xce35('0x50')]=function(_0x5b9f68,_0xe17f25,_0x36cb89){var _0xc8bb04={};var _0x1780be={};var _0xa371ef;var _0x2ca00c;return db[_0xce35('0x32')][_0xce35('0x51')]({'where':{'id':_0x5b9f68[_0xce35('0x4f')]['id']}})[_0xce35('0x2b')](handleEntityNotFound(_0xe17f25,null))[_0xce35('0x2b')](function(_0x3adb3c){if(_0x3adb3c){_0xa371ef=_0x3adb3c;_0x1780be[_0xce35('0x36')]=_[_0xce35('0x38')](db['ZohoConfiguration']['rawAttributes']);_0x1780be[_0xce35('0x37')]=_[_0xce35('0x38')](_0x5b9f68[_0xce35('0x37')]);_0x1780be[_0xce35('0x39')]=_[_0xce35('0x3a')](_0x1780be[_0xce35('0x36')],_0x1780be['query']);_0xc8bb04[_0xce35('0x3b')]=_['intersection'](_0x1780be[_0xce35('0x36')],qs[_0xce35('0x3c')](_0x5b9f68[_0xce35('0x37')][_0xce35('0x3c')]));_0xc8bb04[_0xce35('0x3b')]=_0xc8bb04[_0xce35('0x3b')][_0xce35('0x3d')]?_0xc8bb04[_0xce35('0x3b')]:_0x1780be[_0xce35('0x36')];_0xc8bb04[_0xce35('0x3e')]=qs['sort'](_0x5b9f68['query']['sort']);_0xc8bb04[_0xce35('0x42')]=qs['filters'](_[_0xce35('0x40')](_0x5b9f68[_0xce35('0x37')],_0x1780be['filters']));if(_0x5b9f68[_0xce35('0x37')][_0xce35('0x41')]){_0xc8bb04['where']=_[_0xce35('0x43')](_0xc8bb04[_0xce35('0x42')],{'$or':_['map'](_0xc8bb04[_0xce35('0x3b')],function(_0x318377){var _0x4a74ec={};_0x4a74ec[_0x318377]={'$like':'%'+_0x5b9f68[_0xce35('0x37')]['filter']+'%'};return _0x4a74ec;})});}_0xc8bb04=_[_0xce35('0x43')]({},_0xc8bb04,_0x5b9f68['options']);return _0xa371ef[_0xce35('0x50')](_0xc8bb04);}})[_0xce35('0x2b')](function(_0x26f9d3){if(_0x26f9d3){_0x2ca00c=_0x26f9d3[_0xce35('0x3d')];if(!_0x5b9f68[_0xce35('0x37')]['hasOwnProperty'](_0xce35('0x52'))){_0xc8bb04['limit']=qs[_0xce35('0x24')](_0x5b9f68[_0xce35('0x37')][_0xce35('0x24')]);_0xc8bb04['offset']=qs[_0xce35('0x22')](_0x5b9f68[_0xce35('0x37')][_0xce35('0x22')]);}return _0xa371ef[_0xce35('0x50')](_0xc8bb04);}})[_0xce35('0x2b')](function(_0x2b6c3b){if(_0x2b6c3b){return _0x2b6c3b?{'count':_0x2ca00c,'rows':_0x2b6c3b}:null;}})[_0xce35('0x2b')](respondWithResult(_0xe17f25,null))[_0xce35('0x49')](handleError(_0xe17f25,null));};exports[_0xce35('0x53')]=function(_0x4a69fe,_0x3d67b3,_0xe29cb2){if(_0x4a69fe[_0xce35('0x4e')]['id']){delete _0x4a69fe[_0xce35('0x4e')]['id'];}return db[_0xce35('0x32')][_0xce35('0x51')]({'where':{'id':_0x4a69fe['params']['id']}})[_0xce35('0x2b')](handleEntityNotFound(_0x3d67b3,null))[_0xce35('0x2b')](function(_0x3c4223){if(_0x3c4223){_0x4a69fe['body'][_0xce35('0x54')]=_0x3c4223['id'];_0x4a69fe['body'][_0xce35('0x55')]=integrations[_0xce35('0x56')](_0x4a69fe[_0xce35('0x4e')][_0xce35('0x57')],_0x4a69fe[_0xce35('0x4e')][_0xce35('0x34')]);_0x4a69fe[_0xce35('0x4e')][_0xce35('0x58')]=integrations[_0xce35('0x59')](_0x4a69fe[_0xce35('0x4e')][_0xce35('0x57')],_0x4a69fe['body'][_0xce35('0x34')]);return db[_0xce35('0x5a')]['create'](_0x4a69fe['body'],{'include':[{'model':db[_0xce35('0x5b')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xce35('0x58')}]});}return null;})[_0xce35('0x2b')](respondWithResult(_0x3d67b3,null))['catch'](handleError(_0x3d67b3,null));};function getAccessToken(_0x59b83b){return new Promise(function(_0x24f0ed,_0x4aac50){var _0x311cca;switch(_0x59b83b[_0xce35('0x5c')]){case'US':_0x311cca=_0xce35('0x5d');break;case'AU':_0x311cca=_0xce35('0x5e');break;case'EU':_0x311cca=_0xce35('0x5f');break;case'IN':_0x311cca=_0xce35('0x60');break;case'CN':_0x311cca=_0xce35('0x61');break;default:_0x311cca=_0xce35('0x5f');break;}var _0x3ed0c9={'method':'POST','uri':_0x311cca+_0xce35('0x62'),'qs':{'refresh_token':_0x59b83b['refreshToken'],'client_id':_0x59b83b['clientId'],'client_secret':_0x59b83b[_0xce35('0x63')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3ed0c9)[_0xce35('0x2b')](function(_0xaacb09){if(_0xaacb09[_0xce35('0x64')]){_0x24f0ed(_0xaacb09[_0xce35('0x64')]);}else{_0x4aac50(_0xce35('0x65'));}})[_0xce35('0x49')](function(_0x20fcc8){_0x4aac50(_0x20fcc8);});});}exports[_0xce35('0x66')]=function(_0x284c12,_0x8661f0,_0x57f526){var _0x27641b,_0x44f5b6,_0x9f2175,_0x20d7a1,_0x2c2317;return db[_0xce35('0x32')][_0xce35('0x51')]({'where':{'id':_0x284c12[_0xce35('0x4f')]['id']},'attributes':['id',_0xce35('0x67'),'zone',_0xce35('0x68'),_0xce35('0x63'),'serverUrl',_0xce35('0x69'),'refreshToken']})[_0xce35('0x2b')](handleEntityNotFound(_0x8661f0,null))[_0xce35('0x2b')](function(_0x35141a){_0x2c2317=_0x35141a;_0x27641b=_0x2c2317['host'];_0x44f5b6=_0x27641b==='zoho.eu'?'eu':_0xce35('0x6a');_0x9f2175=_0x2c2317[_0xce35('0x6b')];var _0x206998=_0x9f2175[_0xce35('0x6c')](-0x1);if(_0x206998==='/'||_0x206998==='\x5c'||_0x206998===':'){_0x9f2175=_0x9f2175[_0xce35('0x6d')](0x0,_0x9f2175['lastIndexOf'](_0x206998));}if(!_0x2c2317[_0xce35('0x6e')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2c2317);})[_0xce35('0x2b')](function(_0x832c35){if(_0x832c35){return rp({'method':_0xce35('0x6f'),'uri':util[_0xce35('0x70')](_0xce35('0x71'),_0x44f5b6),'qs':{'module':_0xce35('0x72')},'headers':{'Authorization':_0xce35('0x73')+_0x832c35},'json':!![]});}})['then'](function(_0x102661){if(_0x102661){if(_0x102661[_0xce35('0x74')]&&_0x102661['response'][_0xce35('0x2d')]){throw new Error(_0x102661['response']['error'][_0xce35('0x75')]);}var _0x4349c6=[];var _0x5a7a13=[];var _0x2bc78b=['Owner','Subject',_0xce35('0x76'),_0xce35('0x77'),_0xce35('0x78'),_0xce35('0x79'),_0xce35('0x7a'),_0xce35('0x7b')];_0x5a7a13=_[_0xce35('0x7c')](_0x102661[_0xce35('0x3c')],function(_0x4ff80f){return _0x2bc78b[_0xce35('0x7d')](_0x4ff80f['api_name']);});for(var _0x3ece6a=0x0;_0x3ece6a<_0x5a7a13[_0xce35('0x3d')];_0x3ece6a++){if(_0x5a7a13[_0x3ece6a][_0xce35('0x7e')]===![]){_0x4349c6['push']({'id':_0x5a7a13[_0x3ece6a]['id'],'name':_0x5a7a13[_0x3ece6a][_0xce35('0x7f')],'custom':_0x5a7a13[_0x3ece6a]['custom_field'],'options':_0x5a7a13[_0x3ece6a][_0xce35('0x80')]===_0xce35('0x81')&&_0x5a7a13[_0x3ece6a][_0xce35('0x82')][_0xce35('0x3d')]>-0x1?_[_0xce35('0x31')](_0x5a7a13[_0x3ece6a][_0xce35('0x82')],function(_0x354fd1){return{'name':_0x354fd1,'value':_0x354fd1};}):[]});}}return{'count':_0x4349c6[_0xce35('0x3d')],'rows':_0x4349c6};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x8661f0,null))['catch'](function(_0x5b255b){var _0x4f2a64=_0x284c12[_0xce35('0x37')][_0xce35('0x83')]?0x1f4:_0x5b255b[_0xce35('0x84')]||0x1f4;logger['error'](_0xce35('0x85'),_0xce35('0x66'),_0x4f2a64,JSON[_0xce35('0x86')](_0x5b255b));delete _0x5b255b[_0xce35('0x2f')];if(_0x4f2a64===0x191){_0x4f2a64=0x190;}_0x8661f0[_0xce35('0x1f')](_0x4f2a64)[_0xce35('0x30')](_0x284c12[_0xce35('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5b255b[_0xce35('0x84')]}:_0x5b255b);});}; \ No newline at end of file +var _0x5e90=['fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','ZohoAccount','include','rows','show','keys','includeAll','options','find','create','body','update','params','catch','findOne','length','order','sort','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','serverUrl','substring','lastIndexOf','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','pick_list_values','test','statusCode','stringify','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','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes'];(function(_0x5cb094,_0x8661b7){var _0x19c8e3=function(_0x120713){while(--_0x120713){_0x5cb094['push'](_0x5cb094['shift']());}};_0x19c8e3(++_0x8661b7);}(_0x5e90,0x1e6));var _0x05e9=function(_0x186d93,_0x28a114){_0x186d93=_0x186d93-0x0;var _0x5e5a7=_0x5e90[_0x186d93];return _0x5e5a7;};'use strict';var emlformat=require(_0x05e9('0x0'));var rimraf=require(_0x05e9('0x1'));var zipdir=require(_0x05e9('0x2'));var jsonpatch=require(_0x05e9('0x3'));var rp=require(_0x05e9('0x4'));var moment=require(_0x05e9('0x5'));var BPromise=require(_0x05e9('0x6'));var Mustache=require(_0x05e9('0x7'));var util=require(_0x05e9('0x8'));var path=require(_0x05e9('0x9'));var sox=require(_0x05e9('0xa'));var csv=require(_0x05e9('0xb'));var ejs=require(_0x05e9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05e9('0xd'));var squel=require(_0x05e9('0xe'));var crypto=require(_0x05e9('0xf'));var jsforce=require(_0x05e9('0x10'));var deskjs=require(_0x05e9('0x11'));var toCsv=require(_0x05e9('0xb'));var querystring=require('querystring');var Papa=require(_0x05e9('0x12'));var Redis=require(_0x05e9('0x13'));var authService=require(_0x05e9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x05e9('0x15'));var hardwareService=require(_0x05e9('0x16'));var logger=require(_0x05e9('0x17'))('api');var utils=require(_0x05e9('0x18'));var config=require(_0x05e9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x05e9('0x1a'))['db'];var integrations=require(_0x05e9('0x1b'));function respondWithStatusCode(_0x4efcc2,_0x2c41ac){_0x2c41ac=_0x2c41ac||0xcc;return function(_0x40cdb9){if(_0x40cdb9){return _0x4efcc2['sendStatus'](_0x2c41ac);}return _0x4efcc2[_0x05e9('0x1c')](_0x2c41ac)[_0x05e9('0x1d')]();};}function respondWithResult(_0x11ab70,_0xc6e8af){_0xc6e8af=_0xc6e8af||0xc8;return function(_0x285a5d){if(_0x285a5d){return _0x11ab70['status'](_0xc6e8af)[_0x05e9('0x1e')](_0x285a5d);}};}function respondWithFilteredResult(_0x3c24fc,_0x49194c){return function(_0x54f0d1){if(_0x54f0d1){var _0x468d07=typeof _0x49194c[_0x05e9('0x1f')]==='undefined'&&typeof _0x49194c[_0x05e9('0x20')]===_0x05e9('0x21');var _0x36187b=_0x54f0d1[_0x05e9('0x22')];var _0x38b921=_0x468d07?0x0:_0x49194c[_0x05e9('0x1f')];var _0x3b2425=_0x468d07?_0x54f0d1[_0x05e9('0x22')]:_0x49194c[_0x05e9('0x1f')]+_0x49194c['limit'];var _0x4522dd;if(_0x3b2425>=_0x36187b){_0x3b2425=_0x36187b;_0x4522dd=0xc8;}else{_0x4522dd=0xce;}_0x3c24fc['status'](_0x4522dd);return _0x3c24fc[_0x05e9('0x23')](_0x05e9('0x24'),_0x38b921+'-'+_0x3b2425+'/'+_0x36187b)[_0x05e9('0x1e')](_0x54f0d1);}return null;};}function patchUpdates(_0x4d7c4e){return function(_0x22d90e){try{jsonpatch[_0x05e9('0x25')](_0x22d90e,_0x4d7c4e,!![]);}catch(_0x91a4f9){return BPromise[_0x05e9('0x26')](_0x91a4f9);}return _0x22d90e[_0x05e9('0x27')]();};}function saveUpdates(_0x21f756,_0x4410b7){return function(_0x150966){if(_0x150966){return _0x150966['update'](_0x21f756)[_0x05e9('0x28')](function(_0x5d717d){return _0x5d717d;});}return null;};}function removeEntity(_0x577f97,_0x585905){return function(_0x4f6a5b){if(_0x4f6a5b){return _0x4f6a5b[_0x05e9('0x29')]()[_0x05e9('0x28')](function(){_0x577f97[_0x05e9('0x1c')](0xcc)[_0x05e9('0x1d')]();});}};}function handleEntityNotFound(_0xdd83f8,_0x581a3c){return function(_0x4fb756){if(!_0x4fb756){_0xdd83f8[_0x05e9('0x2a')](0x194);}return _0x4fb756;};}function handleError(_0x1a9e11,_0x4cc569){_0x4cc569=_0x4cc569||0x1f4;return function(_0x9b7252){logger[_0x05e9('0x2b')](_0x9b7252[_0x05e9('0x2c')]);if(_0x9b7252[_0x05e9('0x2d')]){delete _0x9b7252[_0x05e9('0x2d')];}_0x1a9e11[_0x05e9('0x1c')](_0x4cc569)[_0x05e9('0x2e')](_0x9b7252);};}exports[_0x05e9('0x2f')]=function(_0x2d068e,_0x2fa70f){var _0x3d5d5d={},_0x2781d4={},_0x38c69b={'count':0x0,'rows':[]};var _0x3f2a73=_[_0x05e9('0x30')](db['ZohoAccount'][_0x05e9('0x31')],function(_0xd9df84){return{'name':_0xd9df84[_0x05e9('0x32')],'type':_0xd9df84[_0x05e9('0x33')][_0x05e9('0x34')]};});_0x2781d4[_0x05e9('0x35')]=_[_0x05e9('0x30')](_0x3f2a73,'name');_0x2781d4['query']=_['keys'](_0x2d068e[_0x05e9('0x36')]);_0x2781d4[_0x05e9('0x37')]=_[_0x05e9('0x38')](_0x2781d4[_0x05e9('0x35')],_0x2781d4[_0x05e9('0x36')]);_0x3d5d5d[_0x05e9('0x39')]=_[_0x05e9('0x38')](_0x2781d4[_0x05e9('0x35')],qs[_0x05e9('0x3a')](_0x2d068e[_0x05e9('0x36')][_0x05e9('0x3a')]));_0x3d5d5d[_0x05e9('0x39')]=_0x3d5d5d['attributes']['length']?_0x3d5d5d[_0x05e9('0x39')]:_0x2781d4['model'];if(!_0x2d068e[_0x05e9('0x36')][_0x05e9('0x3b')](_0x05e9('0x3c'))){_0x3d5d5d['limit']=qs[_0x05e9('0x20')](_0x2d068e[_0x05e9('0x36')]['limit']);_0x3d5d5d['offset']=qs[_0x05e9('0x1f')](_0x2d068e['query'][_0x05e9('0x1f')]);}_0x3d5d5d['order']=qs['sort'](_0x2d068e[_0x05e9('0x36')]['sort']);_0x3d5d5d[_0x05e9('0x3d')]=qs[_0x05e9('0x37')](_['pick'](_0x2d068e['query'],_0x2781d4['filters']),_0x3f2a73);if(_0x2d068e[_0x05e9('0x36')][_0x05e9('0x3e')]){_0x3d5d5d[_0x05e9('0x3d')]=_[_0x05e9('0x3f')](_0x3d5d5d[_0x05e9('0x3d')],{'$or':_['map'](_0x3f2a73,function(_0x2b35ac){if(_0x2b35ac[_0x05e9('0x33')]!==_0x05e9('0x40')){var _0x49508f={};_0x49508f[_0x2b35ac['name']]={'$like':'%'+_0x2d068e[_0x05e9('0x36')][_0x05e9('0x3e')]+'%'};return _0x49508f;}})});}_0x3d5d5d=_[_0x05e9('0x3f')]({},_0x3d5d5d,_0x2d068e['options']);var _0x2e6055={'where':_0x3d5d5d[_0x05e9('0x3d')]};return db[_0x05e9('0x41')][_0x05e9('0x22')](_0x2e6055)[_0x05e9('0x28')](function(_0x4b8864){_0x38c69b[_0x05e9('0x22')]=_0x4b8864;if(_0x2d068e['query']['includeAll']){_0x3d5d5d[_0x05e9('0x42')]=[{'all':!![]}];}return db[_0x05e9('0x41')]['findAll'](_0x3d5d5d);})['then'](function(_0x1285f8){_0x38c69b[_0x05e9('0x43')]=_0x1285f8;return _0x38c69b;})[_0x05e9('0x28')](respondWithFilteredResult(_0x2fa70f,_0x3d5d5d))['catch'](handleError(_0x2fa70f,null));};exports[_0x05e9('0x44')]=function(_0x469470,_0x3e8502){var _0x59c499={'raw':![],'where':{'id':_0x469470['params']['id']}},_0x3704d2={};_0x3704d2[_0x05e9('0x35')]=_[_0x05e9('0x45')](db[_0x05e9('0x41')][_0x05e9('0x31')]);_0x3704d2['query']=_[_0x05e9('0x45')](_0x469470[_0x05e9('0x36')]);_0x3704d2[_0x05e9('0x37')]=_[_0x05e9('0x38')](_0x3704d2[_0x05e9('0x35')],_0x3704d2[_0x05e9('0x36')]);_0x59c499['attributes']=_[_0x05e9('0x38')](_0x3704d2[_0x05e9('0x35')],qs[_0x05e9('0x3a')](_0x469470[_0x05e9('0x36')][_0x05e9('0x3a')]));_0x59c499[_0x05e9('0x39')]=_0x59c499[_0x05e9('0x39')]['length']?_0x59c499[_0x05e9('0x39')]:_0x3704d2['model'];if(_0x469470[_0x05e9('0x36')][_0x05e9('0x46')]){_0x59c499[_0x05e9('0x42')]=[{'all':!![]}];}_0x59c499=_[_0x05e9('0x3f')]({},_0x59c499,_0x469470[_0x05e9('0x47')]);return db[_0x05e9('0x41')][_0x05e9('0x48')](_0x59c499)[_0x05e9('0x28')](handleEntityNotFound(_0x3e8502,null))['then'](respondWithResult(_0x3e8502,null))['catch'](handleError(_0x3e8502,null));};exports[_0x05e9('0x49')]=function(_0x1f22c3,_0x201b5b){return db[_0x05e9('0x41')][_0x05e9('0x49')](_0x1f22c3[_0x05e9('0x4a')],{})[_0x05e9('0x28')](respondWithResult(_0x201b5b,0xc9))['catch'](handleError(_0x201b5b,null));};exports[_0x05e9('0x4b')]=function(_0x40ba14,_0x997c13){if(_0x40ba14[_0x05e9('0x4a')]['id']){delete _0x40ba14['body']['id'];}return db[_0x05e9('0x41')][_0x05e9('0x48')]({'where':{'id':_0x40ba14[_0x05e9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x997c13,null))[_0x05e9('0x28')](saveUpdates(_0x40ba14[_0x05e9('0x4a')],null))['then'](respondWithResult(_0x997c13,null))[_0x05e9('0x4d')](handleError(_0x997c13,null));};exports[_0x05e9('0x29')]=function(_0x13a3a8,_0x31a8fb){return db[_0x05e9('0x41')][_0x05e9('0x48')]({'where':{'id':_0x13a3a8[_0x05e9('0x4c')]['id']}})[_0x05e9('0x28')](handleEntityNotFound(_0x31a8fb,null))['then'](removeEntity(_0x31a8fb,null))[_0x05e9('0x4d')](handleError(_0x31a8fb,null));};exports['getConfigurations']=function(_0x5c093e,_0x2101aa,_0x16d89a){var _0x5eb650={};var _0x6c3096={};var _0x26846b;var _0x140139;return db[_0x05e9('0x41')][_0x05e9('0x4e')]({'where':{'id':_0x5c093e[_0x05e9('0x4c')]['id']}})[_0x05e9('0x28')](handleEntityNotFound(_0x2101aa,null))[_0x05e9('0x28')](function(_0x46f123){if(_0x46f123){_0x26846b=_0x46f123;_0x6c3096[_0x05e9('0x35')]=_[_0x05e9('0x45')](db['ZohoConfiguration']['rawAttributes']);_0x6c3096['query']=_[_0x05e9('0x45')](_0x5c093e['query']);_0x6c3096[_0x05e9('0x37')]=_['intersection'](_0x6c3096[_0x05e9('0x35')],_0x6c3096[_0x05e9('0x36')]);_0x5eb650[_0x05e9('0x39')]=_[_0x05e9('0x38')](_0x6c3096[_0x05e9('0x35')],qs[_0x05e9('0x3a')](_0x5c093e['query']['fields']));_0x5eb650[_0x05e9('0x39')]=_0x5eb650[_0x05e9('0x39')][_0x05e9('0x4f')]?_0x5eb650[_0x05e9('0x39')]:_0x6c3096[_0x05e9('0x35')];_0x5eb650[_0x05e9('0x50')]=qs[_0x05e9('0x51')](_0x5c093e[_0x05e9('0x36')][_0x05e9('0x51')]);_0x5eb650[_0x05e9('0x3d')]=qs[_0x05e9('0x37')](_['pick'](_0x5c093e['query'],_0x6c3096[_0x05e9('0x37')]));if(_0x5c093e[_0x05e9('0x36')][_0x05e9('0x3e')]){_0x5eb650[_0x05e9('0x3d')]=_[_0x05e9('0x3f')](_0x5eb650[_0x05e9('0x3d')],{'$or':_[_0x05e9('0x30')](_0x5eb650['attributes'],function(_0x336e64){var _0x81429c={};_0x81429c[_0x336e64]={'$like':'%'+_0x5c093e[_0x05e9('0x36')][_0x05e9('0x3e')]+'%'};return _0x81429c;})});}_0x5eb650=_[_0x05e9('0x3f')]({},_0x5eb650,_0x5c093e[_0x05e9('0x47')]);return _0x26846b[_0x05e9('0x52')](_0x5eb650);}})[_0x05e9('0x28')](function(_0x3f2d53){if(_0x3f2d53){_0x140139=_0x3f2d53['length'];if(!_0x5c093e[_0x05e9('0x36')][_0x05e9('0x3b')](_0x05e9('0x3c'))){_0x5eb650[_0x05e9('0x20')]=qs[_0x05e9('0x20')](_0x5c093e[_0x05e9('0x36')][_0x05e9('0x20')]);_0x5eb650[_0x05e9('0x1f')]=qs[_0x05e9('0x1f')](_0x5c093e[_0x05e9('0x36')][_0x05e9('0x1f')]);}return _0x26846b[_0x05e9('0x52')](_0x5eb650);}})[_0x05e9('0x28')](function(_0x4898a7){if(_0x4898a7){return _0x4898a7?{'count':_0x140139,'rows':_0x4898a7}:null;}})['then'](respondWithResult(_0x2101aa,null))[_0x05e9('0x4d')](handleError(_0x2101aa,null));};exports[_0x05e9('0x53')]=function(_0x29ee9d,_0x89f769,_0x472db6){if(_0x29ee9d['body']['id']){delete _0x29ee9d['body']['id'];}return db[_0x05e9('0x41')]['findOne']({'where':{'id':_0x29ee9d['params']['id']}})[_0x05e9('0x28')](handleEntityNotFound(_0x89f769,null))['then'](function(_0x3f9b4e){if(_0x3f9b4e){_0x29ee9d[_0x05e9('0x4a')][_0x05e9('0x54')]=_0x3f9b4e['id'];_0x29ee9d[_0x05e9('0x4a')][_0x05e9('0x55')]=integrations['getSubjects'](_0x29ee9d[_0x05e9('0x4a')][_0x05e9('0x56')],_0x29ee9d['body'][_0x05e9('0x33')]);_0x29ee9d['body']['Descriptions']=integrations[_0x05e9('0x57')](_0x29ee9d[_0x05e9('0x4a')][_0x05e9('0x56')],_0x29ee9d[_0x05e9('0x4a')]['type']);return db[_0x05e9('0x58')][_0x05e9('0x49')](_0x29ee9d[_0x05e9('0x4a')],{'include':[{'model':db[_0x05e9('0x59')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x05e9('0x5a')}]});}return null;})[_0x05e9('0x28')](respondWithResult(_0x89f769,null))[_0x05e9('0x4d')](handleError(_0x89f769,null));};function getAccessToken(_0x1c851a){return new Promise(function(_0x4079e2,_0x4f07f1){var _0x1b8435;switch(_0x1c851a[_0x05e9('0x5b')]){case'US':_0x1b8435=_0x05e9('0x5c');break;case'AU':_0x1b8435=_0x05e9('0x5d');break;case'EU':_0x1b8435=_0x05e9('0x5e');break;case'IN':_0x1b8435=_0x05e9('0x5f');break;case'CN':_0x1b8435=_0x05e9('0x60');break;default:_0x1b8435='https://accounts.zoho.eu';break;}var _0x1bfc50={'method':_0x05e9('0x61'),'uri':_0x1b8435+_0x05e9('0x62'),'qs':{'refresh_token':_0x1c851a[_0x05e9('0x63')],'client_id':_0x1c851a[_0x05e9('0x64')],'client_secret':_0x1c851a[_0x05e9('0x65')],'grant_type':_0x05e9('0x66')},'json':!![]};return rp(_0x1bfc50)[_0x05e9('0x28')](function(_0x4161ef){if(_0x4161ef[_0x05e9('0x67')]){_0x4079e2(_0x4161ef[_0x05e9('0x67')]);}else{_0x4f07f1(_0x05e9('0x68'));}})[_0x05e9('0x4d')](function(_0x251a4d){_0x4f07f1(_0x251a4d);});});}exports[_0x05e9('0x69')]=function(_0x439f0d,_0x2d28c5,_0x28c14e){var _0xfc6f67,_0x1fd95c,_0x8d4fea,_0x20350c,_0xf29f3f;return db[_0x05e9('0x41')]['findOne']({'where':{'id':_0x439f0d['params']['id']},'attributes':['id',_0x05e9('0x6a'),_0x05e9('0x5b'),_0x05e9('0x64'),_0x05e9('0x65'),'serverUrl',_0x05e9('0x6b'),'refreshToken']})[_0x05e9('0x28')](handleEntityNotFound(_0x2d28c5,null))[_0x05e9('0x28')](function(_0x6fe8f6){_0xf29f3f=_0x6fe8f6;_0xfc6f67=_0xf29f3f['host'];_0x1fd95c=_0xfc6f67===_0x05e9('0x6c')?'eu':_0x05e9('0x6d');_0x8d4fea=_0xf29f3f[_0x05e9('0x6e')];var _0x1fd9c5=_0x8d4fea['slice'](-0x1);if(_0x1fd9c5==='/'||_0x1fd9c5==='\x5c'||_0x1fd9c5===':'){_0x8d4fea=_0x8d4fea[_0x05e9('0x6f')](0x0,_0x8d4fea[_0x05e9('0x70')](_0x1fd9c5));}if(!_0xf29f3f['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xf29f3f);})[_0x05e9('0x28')](function(_0x9335f5){if(_0x9335f5){return rp({'method':'GET','uri':util['format'](_0x05e9('0x71'),_0x1fd95c),'qs':{'module':_0x05e9('0x72')},'headers':{'Authorization':_0x05e9('0x73')+_0x9335f5},'json':!![]});}})[_0x05e9('0x28')](function(_0x4804c1){if(_0x4804c1){if(_0x4804c1[_0x05e9('0x74')]&&_0x4804c1[_0x05e9('0x74')][_0x05e9('0x2b')]){throw new Error(_0x4804c1['response']['error'][_0x05e9('0x75')]);}var _0x5bfc62=[];var _0x4bb5e2=[];var _0x37978d=['Owner','Subject',_0x05e9('0x76'),_0x05e9('0x77'),_0x05e9('0x78'),'Call_Result',_0x05e9('0x79'),_0x05e9('0x7a')];_0x4bb5e2=_[_0x05e9('0x7b')](_0x4804c1[_0x05e9('0x3a')],function(_0x15684f){return _0x37978d[_0x05e9('0x7c')](_0x15684f[_0x05e9('0x7d')]);});for(var _0x2e5eb4=0x0;_0x2e5eb4<_0x4bb5e2[_0x05e9('0x4f')];_0x2e5eb4++){if(_0x4bb5e2[_0x2e5eb4][_0x05e9('0x7e')]===![]){_0x5bfc62['push']({'id':_0x4bb5e2[_0x2e5eb4]['id'],'name':_0x4bb5e2[_0x2e5eb4][_0x05e9('0x7f')],'custom':_0x4bb5e2[_0x2e5eb4][_0x05e9('0x80')],'options':_0x4bb5e2[_0x2e5eb4]['data_type']==='picklist'&&_0x4bb5e2[_0x2e5eb4]['pick_list_values']['length']>-0x1?_[_0x05e9('0x30')](_0x4bb5e2[_0x2e5eb4][_0x05e9('0x81')],function(_0x1a47e9){return{'name':_0x1a47e9,'value':_0x1a47e9};}):[]});}}return{'count':_0x5bfc62[_0x05e9('0x4f')],'rows':_0x5bfc62};}else{return{'count':0x0,'rows':[]};}})[_0x05e9('0x28')](respondWithResult(_0x2d28c5,null))[_0x05e9('0x4d')](function(_0x1672c3){var _0x22f44d=_0x439f0d[_0x05e9('0x36')][_0x05e9('0x82')]?0x1f4:_0x1672c3[_0x05e9('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x22f44d,JSON[_0x05e9('0x84')](_0x1672c3));delete _0x1672c3[_0x05e9('0x2d')];if(_0x22f44d===0x191){_0x22f44d=0x190;}_0x2d28c5[_0x05e9('0x1c')](_0x22f44d)[_0x05e9('0x2e')](_0x439f0d[_0x05e9('0x36')][_0x05e9('0x82')]?{'message':_0x05e9('0x85'),'statusCode':_0x1672c3[_0x05e9('0x83')]}:_0x1672c3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1ee32eb..ca5bd3c 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 _0x4137=['code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.eu','authorization_code','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4137,0xfb));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require('../../config/logger')(_0x7413('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7413('0x3'));var config=require(_0x7413('0x4'));var attributes=require(_0x7413('0x5'));var integrations=require(_0x7413('0x6'));module['exports']=function(_0x426ac5,_0xfe8c22){return _0x426ac5[_0x7413('0x7')](_0x7413('0x8'),attributes,{'tableName':_0x7413('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1baaa5,_0x47856d,_0x6412b0){if(_0x1baaa5[_0x7413('0xa')](_0x7413('0xb'))||_0x1baaa5[_0x7413('0xa')](_0x7413('0xc'))||_0x1baaa5[_0x7413('0xa')](_0x7413('0xd'))||_0x1baaa5[_0x7413('0xa')](_0x7413('0xe'))||_0x1baaa5[_0x7413('0xa')](_0x7413('0xf'))||_0x1baaa5['changed'](_0x7413('0x10'))){var _0x6bf102,_0x514e01;_0x6bf102=_0x1baaa5[_0x7413('0xc')];var _0x2ce1b7=_0x6bf102[_0x7413('0x11')](-0x1);if(_0x2ce1b7==='/'||_0x2ce1b7==='\x5c'||_0x2ce1b7===':'){_0x6bf102=_0x6bf102[_0x7413('0x12')](0x0,_0x6bf102[_0x7413('0x13')](_0x2ce1b7));}switch(_0x1baaa5[_0x7413('0xb')]){case'US':_0x514e01=_0x7413('0x14');break;case'AU':_0x514e01='https://accounts.zoho.com.au';break;case'IN':_0x514e01=_0x7413('0x15');break;case'CN':_0x514e01=_0x7413('0x16');break;default:_0x514e01='https://accounts.zoho.eu';break;}var _0x210ae1={'method':_0x7413('0x17'),'uri':_0x514e01+_0x7413('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x1baaa5['clientId'],'client_secret':_0x1baaa5[_0x7413('0xe')],'redirect_uri':_0x1baaa5[_0x7413('0xc')],'code':_0x1baaa5[_0x7413('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x210ae1)['then'](function(_0x90fc43){var _0x4eaa84=JSON[_0x7413('0x19')](_0x90fc43);if(_0x4eaa84[_0x7413('0x1a')]){_0x1baaa5[_0x7413('0x1b')]=_0x4eaa84['refresh_token'];logger[_0x7413('0x1c')](util[_0x7413('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1baaa5[_0x7413('0x1e')],_0x1baaa5['id']));}else{logger[_0x7413('0x1f')](util[_0x7413('0x1d')](_0x7413('0x20'),_0x1baaa5[_0x7413('0x1e')],_0x1baaa5['id']),util['inspect'](_0x4eaa84,{'showHidden':![],'depth':null}));}return _0x6412b0(null,_0x47856d);})['catch'](function(_0x1edf05){logger['error'](util['format'](_0x7413('0x20'),_0x1baaa5[_0x7413('0x1e')],_0x1baaa5['id']),util[_0x7413('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x6412b0(_0x1edf05);});}else{return _0x6412b0(null,_0x47856d);}},'beforeUpdate':function(_0x10a95d,_0x2c83f9,_0x9a8268){if(_0x10a95d[_0x7413('0xa')](_0x7413('0xb'))||_0x10a95d['changed'](_0x7413('0xc'))||_0x10a95d[_0x7413('0xa')](_0x7413('0xd'))||_0x10a95d['changed'](_0x7413('0xe'))||_0x10a95d['changed'](_0x7413('0xf'))||_0x10a95d[_0x7413('0xa')](_0x7413('0x10'))){var _0x5019be,_0x42651;_0x5019be=_0x10a95d[_0x7413('0xc')];var _0x545b95=_0x5019be[_0x7413('0x11')](-0x1);if(_0x545b95==='/'||_0x545b95==='\x5c'||_0x545b95===':'){_0x5019be=_0x5019be[_0x7413('0x12')](0x0,_0x5019be[_0x7413('0x13')](_0x545b95));}switch(_0x10a95d[_0x7413('0xb')]){case'US':_0x42651=_0x7413('0x14');break;case'AU':_0x42651='https://accounts.zoho.com.au';break;case'IN':_0x42651=_0x7413('0x15');break;case'CN':_0x42651=_0x7413('0x16');break;default:_0x42651=_0x7413('0x22');break;}var _0x3225ae={'method':'POST','uri':_0x42651+_0x7413('0x18'),'form':{'grant_type':_0x7413('0x23'),'client_id':_0x10a95d[_0x7413('0xd')],'client_secret':_0x10a95d[_0x7413('0xe')],'redirect_uri':_0x10a95d[_0x7413('0xc')],'code':_0x10a95d[_0x7413('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3225ae)[_0x7413('0x24')](function(_0x51364b){var _0x4baee5=JSON['parse'](_0x51364b);if(_0x4baee5[_0x7413('0x1a')]){_0x10a95d['refreshToken']=_0x4baee5[_0x7413('0x1a')];logger[_0x7413('0x1c')](util[_0x7413('0x1d')](_0x7413('0x25'),_0x10a95d['name'],_0x10a95d['id']));}else{logger['error'](util['format'](_0x7413('0x20'),_0x10a95d['name'],_0x10a95d['id']),util[_0x7413('0x21')](_0x4baee5,{'showHidden':![],'depth':null}));}return _0x9a8268(null,_0x2c83f9);})['catch'](function(_0x5a8262){logger[_0x7413('0x1f')](util[_0x7413('0x1d')](_0x7413('0x20'),_0x10a95d[_0x7413('0x1e')],_0x10a95d['id']),util[_0x7413('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x9a8268(_0x5a8262);});}else{return _0x9a8268(null,_0x2c83f9);}}}});}; \ No newline at end of file +var _0x70bb=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone','serverUrl','clientId','clientSecret','code','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','then','parse','refreshToken','refresh_token','info','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','slice','substring','application/x-www-form-urlencoded'];(function(_0x28f610,_0x165087){var _0x12be09=function(_0x740573){while(--_0x740573){_0x28f610['push'](_0x28f610['shift']());}};_0x12be09(++_0x165087);}(_0x70bb,0x14d));var _0xb70b=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0x70bb[_0x49c68e];return _0x33032b;};'use strict';var _=require(_0xb70b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb70b('0x1'));var moment=require(_0xb70b('0x2'));var BPromise=require(_0xb70b('0x3'));var rp=require(_0xb70b('0x4'));var fs=require('fs');var path=require(_0xb70b('0x5'));var rimraf=require(_0xb70b('0x6'));var config=require(_0xb70b('0x7'));var attributes=require(_0xb70b('0x8'));var integrations=require(_0xb70b('0x9'));module[_0xb70b('0xa')]=function(_0x116425,_0x1d5dcf){return _0x116425[_0xb70b('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x417ad2,_0x3b7a85,_0x931522){if(_0x417ad2[_0xb70b('0xc')](_0xb70b('0xd'))||_0x417ad2[_0xb70b('0xc')](_0xb70b('0xe'))||_0x417ad2[_0xb70b('0xc')](_0xb70b('0xf'))||_0x417ad2[_0xb70b('0xc')](_0xb70b('0x10'))||_0x417ad2['changed'](_0xb70b('0x11'))||_0x417ad2[_0xb70b('0xc')]('host')){var _0x1195e7,_0x1b1118;_0x1195e7=_0x417ad2[_0xb70b('0xe')];var _0x13db63=_0x1195e7['slice'](-0x1);if(_0x13db63==='/'||_0x13db63==='\x5c'||_0x13db63===':'){_0x1195e7=_0x1195e7['substring'](0x0,_0x1195e7[_0xb70b('0x12')](_0x13db63));}switch(_0x417ad2[_0xb70b('0xd')]){case'US':_0x1b1118='https://accounts.zoho.com';break;case'AU':_0x1b1118=_0xb70b('0x13');break;case'IN':_0x1b1118=_0xb70b('0x14');break;case'CN':_0x1b1118=_0xb70b('0x15');break;default:_0x1b1118='https://accounts.zoho.eu';break;}var _0x329a3a={'method':'POST','uri':_0x1b1118+'/oauth/v2/token','form':{'grant_type':_0xb70b('0x16'),'client_id':_0x417ad2[_0xb70b('0xf')],'client_secret':_0x417ad2[_0xb70b('0x10')],'redirect_uri':_0x417ad2[_0xb70b('0xe')],'code':_0x417ad2['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x329a3a)[_0xb70b('0x17')](function(_0x3bda42){var _0x58aebf=JSON[_0xb70b('0x18')](_0x3bda42);if(_0x58aebf['refresh_token']){_0x417ad2[_0xb70b('0x19')]=_0x58aebf[_0xb70b('0x1a')];logger[_0xb70b('0x1b')](util[_0xb70b('0x1c')](_0xb70b('0x1d'),_0x417ad2[_0xb70b('0x1e')],_0x417ad2['id']));}else{logger[_0xb70b('0x1f')](util[_0xb70b('0x1c')](_0xb70b('0x20'),_0x417ad2[_0xb70b('0x1e')],_0x417ad2['id']),util[_0xb70b('0x21')](_0x58aebf,{'showHidden':![],'depth':null}));}return _0x931522(null,_0x3b7a85);})['catch'](function(_0x3ae5f6){logger[_0xb70b('0x1f')](util['format'](_0xb70b('0x20'),_0x417ad2[_0xb70b('0x1e')],_0x417ad2['id']),util[_0xb70b('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x931522(_0x3ae5f6);});}else{return _0x931522(null,_0x3b7a85);}},'beforeUpdate':function(_0x4fbdbf,_0x4552ff,_0x128ed3){if(_0x4fbdbf[_0xb70b('0xc')](_0xb70b('0xd'))||_0x4fbdbf[_0xb70b('0xc')](_0xb70b('0xe'))||_0x4fbdbf['changed']('clientId')||_0x4fbdbf['changed']('clientSecret')||_0x4fbdbf[_0xb70b('0xc')](_0xb70b('0x11'))||_0x4fbdbf['changed']('host')){var _0xfe1ec7,_0x3641e4;_0xfe1ec7=_0x4fbdbf[_0xb70b('0xe')];var _0x15492e=_0xfe1ec7[_0xb70b('0x22')](-0x1);if(_0x15492e==='/'||_0x15492e==='\x5c'||_0x15492e===':'){_0xfe1ec7=_0xfe1ec7[_0xb70b('0x23')](0x0,_0xfe1ec7[_0xb70b('0x12')](_0x15492e));}switch(_0x4fbdbf['zone']){case'US':_0x3641e4='https://accounts.zoho.com';break;case'AU':_0x3641e4=_0xb70b('0x13');break;case'IN':_0x3641e4=_0xb70b('0x14');break;case'CN':_0x3641e4='https://accounts.zoho.com.cn';break;default:_0x3641e4='https://accounts.zoho.eu';break;}var _0x46cc50={'method':'POST','uri':_0x3641e4+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4fbdbf[_0xb70b('0xf')],'client_secret':_0x4fbdbf[_0xb70b('0x10')],'redirect_uri':_0x4fbdbf['serverUrl'],'code':_0x4fbdbf[_0xb70b('0x11')]},'headers':{'Content-Type':_0xb70b('0x24')}};return rp(_0x46cc50)['then'](function(_0x242940){var _0x3785ec=JSON[_0xb70b('0x18')](_0x242940);if(_0x3785ec['refresh_token']){_0x4fbdbf['refreshToken']=_0x3785ec[_0xb70b('0x1a')];logger[_0xb70b('0x1b')](util[_0xb70b('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4fbdbf['name'],_0x4fbdbf['id']));}else{logger['error'](util[_0xb70b('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4fbdbf[_0xb70b('0x1e')],_0x4fbdbf['id']),util[_0xb70b('0x21')](_0x3785ec,{'showHidden':![],'depth':null}));}return _0x128ed3(null,_0x4552ff);})['catch'](function(_0x2956fb){logger[_0xb70b('0x1f')](util[_0xb70b('0x1c')](_0xb70b('0x20'),_0x4fbdbf[_0xb70b('0x1e')],_0x4fbdbf['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x128ed3(_0x2956fb);});}else{return _0x128ed3(null,_0x4552ff);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 92b0066..0eb0997 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 _0x751c=['debug','GetZohoAccount','find','raw','where','ShowZohoAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ZohoAccount','findAll','options','attributes','limit','include','map','model'];(function(_0x34c06f,_0x96c6fe){var _0x548244=function(_0x2cbca5){while(--_0x2cbca5){_0x34c06f['push'](_0x34c06f['shift']());}};_0x548244(++_0x96c6fe);}(_0x751c,0x69));var _0xc751=function(_0x1f902a,_0x196916){_0x1f902a=_0x1f902a-0x0;var _0xd58990=_0x751c[_0x1f902a];return _0xd58990;};'use strict';var _=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var moment=require(_0xc751('0x2'));var BPromise=require('bluebird');var rs=require(_0xc751('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc751('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc751('0x5'))(_0xc751('0x6'));var config=require(_0xc751('0x7'));var jayson=require(_0xc751('0x8'));var client=jayson[_0xc751('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d079,_0x2df8c6,_0x527cf9){return new BPromise(function(_0x363b18,_0x1c6e7d){return client['request'](_0x12d079,_0x527cf9)[_0xc751('0xa')](function(_0xec967e){logger[_0xc751('0xb')](_0xc751('0xc'),_0x2df8c6,_0xc751('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2df8c6,'request\x20sent',JSON[_0xc751('0xe')](_0xec967e));if(_0xec967e['error']){if(_0xec967e[_0xc751('0xf')]['code']===0x1f4){logger[_0xc751('0xf')](_0xc751('0xc'),_0x2df8c6,_0xec967e[_0xc751('0xf')]['message']);return _0x1c6e7d(_0xec967e[_0xc751('0xf')]['message']);}logger[_0xc751('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2df8c6,_0xec967e[_0xc751('0xf')][_0xc751('0x10')]);return _0x363b18(_0xec967e[_0xc751('0xf')][_0xc751('0x10')]);}else{logger[_0xc751('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2df8c6,_0xc751('0xd'));_0x363b18(_0xec967e[_0xc751('0x11')][_0xc751('0x10')]);}})[_0xc751('0x12')](function(_0x246d4a){logger[_0xc751('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2df8c6,_0x246d4a);_0x1c6e7d(_0x246d4a);});});}exports['GetZohoAccount']=function(_0x6884e0){var _0x3c71fc=this;return new Promise(function(_0x1e98f1,_0x5ccb7e){return db[_0xc751('0x13')][_0xc751('0x14')]({'raw':_0x6884e0['options']?_0x6884e0[_0xc751('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x6884e0['options']?_0x6884e0[_0xc751('0x15')]['where']||null:null,'attributes':_0x6884e0[_0xc751('0x15')]?_0x6884e0['options'][_0xc751('0x16')]||null:null,'limit':_0x6884e0[_0xc751('0x15')]?_0x6884e0[_0xc751('0x15')][_0xc751('0x17')]||null:null,'include':_0x6884e0[_0xc751('0x15')]?_0x6884e0[_0xc751('0x15')][_0xc751('0x18')]?_[_0xc751('0x19')](_0x6884e0[_0xc751('0x15')][_0xc751('0x18')],function(_0x4df4a4){return{'model':db[_0x4df4a4['model']],'as':_0x4df4a4['as'],'attributes':_0x4df4a4[_0xc751('0x16')],'include':_0x4df4a4['include']?_['map'](_0x4df4a4['include'],function(_0x3210a4){return{'model':db[_0x3210a4[_0xc751('0x1a')]],'as':_0x3210a4['as'],'attributes':_0x3210a4[_0xc751('0x16')],'include':_0x3210a4['include']?_[_0xc751('0x19')](_0x3210a4[_0xc751('0x18')],function(_0x2f64b9){return{'model':db[_0x2f64b9[_0xc751('0x1a')]],'as':_0x2f64b9['as'],'attributes':_0x2f64b9['attributes']};}):[]};}):[]};}):[]:[]})[_0xc751('0xa')](function(_0x2fe70c){logger['info']('GetZohoAccount',_0x6884e0);logger[_0xc751('0x1b')](_0xc751('0x1c'),_0x6884e0,JSON[_0xc751('0xe')](_0x2fe70c));_0x1e98f1(_0x2fe70c);})[_0xc751('0x12')](function(_0xbf05e){logger[_0xc751('0xf')](_0xc751('0x1c'),_0xbf05e[_0xc751('0x10')],_0x6884e0);_0x5ccb7e(_0x3c71fc[_0xc751('0xf')](0x1f4,_0xbf05e[_0xc751('0x10')]));});});};exports['ShowZohoAccount']=function(_0x1c5bee){var _0x45146d=this;return new Promise(function(_0x14a807,_0xeefcb6){return db[_0xc751('0x13')][_0xc751('0x1d')]({'raw':_0x1c5bee['options']?_0x1c5bee[_0xc751('0x15')][_0xc751('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c5bee['options']?_0x1c5bee[_0xc751('0x15')][_0xc751('0x1f')]||null:null,'attributes':_0x1c5bee[_0xc751('0x15')]?_0x1c5bee[_0xc751('0x15')]['attributes']||null:null,'include':_0x1c5bee['options']?_0x1c5bee[_0xc751('0x15')][_0xc751('0x18')]?_['map'](_0x1c5bee[_0xc751('0x15')][_0xc751('0x18')],function(_0x3dd41e){return{'model':db[_0x3dd41e[_0xc751('0x1a')]],'as':_0x3dd41e['as'],'attributes':_0x3dd41e[_0xc751('0x16')],'include':_0x3dd41e[_0xc751('0x18')]?_[_0xc751('0x19')](_0x3dd41e[_0xc751('0x18')],function(_0x8ac8b5){return{'model':db[_0x8ac8b5[_0xc751('0x1a')]],'as':_0x8ac8b5['as'],'attributes':_0x8ac8b5['attributes'],'include':_0x8ac8b5[_0xc751('0x18')]?_['map'](_0x8ac8b5[_0xc751('0x18')],function(_0x24577c){return{'model':db[_0x24577c[_0xc751('0x1a')]],'as':_0x24577c['as'],'attributes':_0x24577c[_0xc751('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x552078){logger[_0xc751('0xb')]('ShowZohoAccount',_0x1c5bee);logger[_0xc751('0x1b')]('ShowZohoAccount',_0x1c5bee,JSON[_0xc751('0xe')](_0x552078));_0x14a807(_0x552078);})[_0xc751('0x12')](function(_0x284d55){logger[_0xc751('0xf')](_0xc751('0x20'),_0x284d55['message'],_0x1c5bee);_0xeefcb6(_0x45146d[_0xc751('0xf')](0x1f4,_0x284d55['message']));});});}; \ No newline at end of file +var _0xf34f=['message','result','catch','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','code','ZohoAccount,\x20%s,\x20%s'];(function(_0x3bf15a,_0x1c4baa){var _0x104f16=function(_0xfb2fc7){while(--_0xfb2fc7){_0x3bf15a['push'](_0x3bf15a['shift']());}};_0x104f16(++_0x1c4baa);}(_0xf34f,0x64));var _0xff34=function(_0x491871,_0x359f23){_0x491871=_0x491871-0x0;var _0x2c4db0=_0xf34f[_0x491871];return _0x2c4db0;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var moment=require(_0xff34('0x1'));var BPromise=require('bluebird');var rs=require(_0xff34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff34('0x3'))['db'];var utils=require(_0xff34('0x4'));var logger=require(_0xff34('0x5'))('rpc');var config=require(_0xff34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444e6a,_0x5e6f92,_0x45036f){return new BPromise(function(_0x46d761,_0x5c1668){return client['request'](_0x444e6a,_0x45036f)[_0xff34('0x8')](function(_0xe76c05){logger[_0xff34('0x9')]('ZohoAccount,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'));logger[_0xff34('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'),JSON[_0xff34('0xc')](_0xe76c05));if(_0xe76c05[_0xff34('0xd')]){if(_0xe76c05['error'][_0xff34('0xe')]===0x1f4){logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x5c1668(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x46d761(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}else{logger[_0xff34('0x9')](_0xff34('0xf'),_0x5e6f92,_0xff34('0xa'));_0x46d761(_0xe76c05[_0xff34('0x11')][_0xff34('0x10')]);}})[_0xff34('0x12')](function(_0xf5e0ec){logger['error'](_0xff34('0xf'),_0x5e6f92,_0xf5e0ec);_0x5c1668(_0xf5e0ec);});});}exports['GetZohoAccount']=function(_0x2fe34c){var _0x50bfa5=this;return new Promise(function(_0x44260f,_0x736675){return db['ZohoAccount']['findAll']({'raw':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x14')]===undefined?!![]:![]:!![],'where':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x15')]||null:null,'attributes':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x16')]||null:null,'limit':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x17')]||null:null,'include':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x18')]?_[_0xff34('0x19')](_0x2fe34c[_0xff34('0x13')][_0xff34('0x18')],function(_0x40f14e){return{'model':db[_0x40f14e[_0xff34('0x1a')]],'as':_0x40f14e['as'],'attributes':_0x40f14e[_0xff34('0x16')],'include':_0x40f14e['include']?_[_0xff34('0x19')](_0x40f14e[_0xff34('0x18')],function(_0x66df01){return{'model':db[_0x66df01[_0xff34('0x1a')]],'as':_0x66df01['as'],'attributes':_0x66df01[_0xff34('0x16')],'include':_0x66df01['include']?_['map'](_0x66df01[_0xff34('0x18')],function(_0x24a72f){return{'model':db[_0x24a72f['model']],'as':_0x24a72f['as'],'attributes':_0x24a72f[_0xff34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xff34('0x8')](function(_0x206dc3){logger['info'](_0xff34('0x1b'),_0x2fe34c);logger[_0xff34('0xb')](_0xff34('0x1b'),_0x2fe34c,JSON[_0xff34('0xc')](_0x206dc3));_0x44260f(_0x206dc3);})[_0xff34('0x12')](function(_0x5c1e72){logger[_0xff34('0xd')](_0xff34('0x1b'),_0x5c1e72[_0xff34('0x10')],_0x2fe34c);_0x736675(_0x50bfa5['error'](0x1f4,_0x5c1e72[_0xff34('0x10')]));});});};exports[_0xff34('0x1c')]=function(_0x2294f1){var _0x22613a=this;return new Promise(function(_0x1050de,_0x212097){return db['ZohoAccount']['find']({'raw':_0x2294f1[_0xff34('0x13')]?_0x2294f1['options'][_0xff34('0x14')]===undefined?!![]:![]:!![],'where':_0x2294f1[_0xff34('0x13')]?_0x2294f1['options'][_0xff34('0x15')]||null:null,'attributes':_0x2294f1[_0xff34('0x13')]?_0x2294f1[_0xff34('0x13')][_0xff34('0x16')]||null:null,'include':_0x2294f1[_0xff34('0x13')]?_0x2294f1[_0xff34('0x13')][_0xff34('0x18')]?_[_0xff34('0x19')](_0x2294f1[_0xff34('0x13')]['include'],function(_0x21fa9a){return{'model':db[_0x21fa9a['model']],'as':_0x21fa9a['as'],'attributes':_0x21fa9a[_0xff34('0x16')],'include':_0x21fa9a[_0xff34('0x18')]?_['map'](_0x21fa9a['include'],function(_0x3c97f4){return{'model':db[_0x3c97f4[_0xff34('0x1a')]],'as':_0x3c97f4['as'],'attributes':_0x3c97f4[_0xff34('0x16')],'include':_0x3c97f4[_0xff34('0x18')]?_[_0xff34('0x19')](_0x3c97f4['include'],function(_0xe12a5f){return{'model':db[_0xe12a5f[_0xff34('0x1a')]],'as':_0xe12a5f['as'],'attributes':_0xe12a5f['attributes']};}):[]};}):[]};}):[]:[]})[_0xff34('0x8')](function(_0xf4df3f){logger['info'](_0xff34('0x1c'),_0x2294f1);logger['debug'](_0xff34('0x1c'),_0x2294f1,JSON[_0xff34('0xc')](_0xf4df3f));_0x1050de(_0xf4df3f);})['catch'](function(_0x1021ac){logger[_0xff34('0xd')](_0xff34('0x1c'),_0x1021ac[_0xff34('0x10')],_0x2294f1);_0x212097(_0x22613a[_0xff34('0xd')](0x1f4,_0x1021ac[_0xff34('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f0b710a..a13efea 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 _0x19d0=['getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x34ac62,_0x40b444){var _0x250ef2=function(_0x126070){while(--_0x126070){_0x34ac62['push'](_0x34ac62['shift']());}};_0x250ef2(++_0x40b444);}(_0x19d0,0x111));var _0x019d=function(_0x178243,_0x32c0de){_0x178243=_0x178243-0x0;var _0x4cd611=_0x19d0[_0x178243];return _0x4cd611;};'use strict';var multer=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var path=require(_0x019d('0x2'));var timeout=require('connect-timeout');var express=require(_0x019d('0x3'));var router=express[_0x019d('0x4')]();var fs_extra=require(_0x019d('0x5'));var auth=require(_0x019d('0x6'));var interaction=require(_0x019d('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x019d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x019d('0x8')](_0x019d('0x9'),auth[_0x019d('0xa')](),controller[_0x019d('0xb')]);router['get'](_0x019d('0xc'),auth[_0x019d('0xa')](),controller[_0x019d('0xd')]);router[_0x019d('0x8')](_0x019d('0xe'),auth[_0x019d('0xa')](),controller[_0x019d('0xf')]);router[_0x019d('0x8')](_0x019d('0x10'),auth[_0x019d('0xa')](),controller[_0x019d('0x11')]);router['post']('/',auth[_0x019d('0xa')](),controller[_0x019d('0x12')]);router[_0x019d('0x13')](_0x019d('0x9'),auth[_0x019d('0xa')](),controller[_0x019d('0x14')]);router[_0x019d('0x15')]('/:id',auth[_0x019d('0xa')](),controller[_0x019d('0x16')]);module[_0x019d('0x17')]=router; \ No newline at end of file +var _0xabdf=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xabdf,0x19a));var _0xfabd=function(_0x300d13,_0x412659){_0x300d13=_0x300d13-0x0;var _0x39541d=_0xabdf[_0x300d13];return _0x39541d;};'use strict';var multer=require('multer');var util=require(_0xfabd('0x0'));var path=require(_0xfabd('0x1'));var timeout=require(_0xfabd('0x2'));var express=require(_0xfabd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfabd('0x4'));var config=require(_0xfabd('0x5'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0xfabd('0x6')](),controller[_0xfabd('0x7')]);router['get'](_0xfabd('0x8'),auth[_0xfabd('0x6')](),controller[_0xfabd('0x9')]);router['get'](_0xfabd('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xfabd('0xb'),auth[_0xfabd('0x6')](),controller[_0xfabd('0xc')]);router['get'](_0xfabd('0xd'),auth[_0xfabd('0x6')](),controller['getDescriptions']);router[_0xfabd('0xe')]('/',auth[_0xfabd('0x6')](),controller[_0xfabd('0xf')]);router[_0xfabd('0x10')](_0xfabd('0x8'),auth[_0xfabd('0x6')](),controller[_0xfabd('0x11')]);router[_0xfabd('0x12')](_0xfabd('0x8'),auth['isAuthenticated'](),controller[_0xfabd('0x13')]);module[_0xfabd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ec1685e..2d4b0a3 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 _0x5d66=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5d66,0x126));var _0x65d6=function(_0x5bdfcd,_0x1ed0e3){_0x5bdfcd=_0x5bdfcd-0x0;var _0x3e627a=_0x5d66[_0x5bdfcd];return _0x3e627a;};'use strict';var Sequelize=require(_0x65d6('0x0'));module[_0x65d6('0x1')]={'name':{'type':Sequelize[_0x65d6('0x2')]},'moduleCreate':{'type':Sequelize[_0x65d6('0x3')](_0x65d6('0x4'),_0x65d6('0x5'),_0x65d6('0x6')),'defaultValue':_0x65d6('0x4')},'moduleSearch':{'type':Sequelize[_0x65d6('0x3')](_0x65d6('0x7'),_0x65d6('0x5'),_0x65d6('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x65d6('0x2')]}}; \ No newline at end of file +var _0x4ba7=['lead','contact','nothing','contact_lead','exports','STRING','ENUM'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x4ba7,0x14d));var _0x74ba=function(_0x644c9,_0xff57f3){_0x644c9=_0x644c9-0x0;var _0x31c187=_0x4ba7[_0x644c9];return _0x31c187;};'use strict';var Sequelize=require('sequelize');module[_0x74ba('0x0')]={'name':{'type':Sequelize[_0x74ba('0x1')]},'moduleCreate':{'type':Sequelize[_0x74ba('0x2')](_0x74ba('0x3'),_0x74ba('0x4'),_0x74ba('0x5')),'defaultValue':_0x74ba('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x74ba('0x4'),_0x74ba('0x3')),'defaultValue':_0x74ba('0x6')},'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 b0cbb51..4da775d 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 _0xefc5=['rows','catch','show','params','ZohoConfiguration','options','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x45953b,_0x4b3e6f){var _0x18524d=function(_0x42f41d){while(--_0x42f41d){_0x45953b['push'](_0x45953b['shift']());}};_0x18524d(++_0x4b3e6f);}(_0xefc5,0x1e8));var _0x5efc=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0xefc5[_0x1e1020];return _0x464719;};'use strict';var emlformat=require(_0x5efc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5efc('0x1'));var jsonpatch=require(_0x5efc('0x2'));var rp=require(_0x5efc('0x3'));var moment=require(_0x5efc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5efc('0x5'));var path=require(_0x5efc('0x6'));var sox=require(_0x5efc('0x7'));var csv=require(_0x5efc('0x8'));var ejs=require(_0x5efc('0x9'));var fs=require('fs');var fs_extra=require(_0x5efc('0xa'));var _=require('lodash');var squel=require(_0x5efc('0xb'));var crypto=require(_0x5efc('0xc'));var jsforce=require(_0x5efc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5efc('0x8'));var querystring=require(_0x5efc('0xe'));var Papa=require(_0x5efc('0xf'));var Redis=require(_0x5efc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5efc('0x11'));var as=require(_0x5efc('0x12'));var hardwareService=require(_0x5efc('0x13'));var logger=require(_0x5efc('0x14'))(_0x5efc('0x15'));var utils=require('../../config/utils');var config=require(_0x5efc('0x16'));var licenseUtil=require(_0x5efc('0x17'));var db=require(_0x5efc('0x18'))['db'];function respondWithStatusCode(_0xd4c796,_0x27e53c){_0x27e53c=_0x27e53c||0xcc;return function(_0x54062c){if(_0x54062c){return _0xd4c796[_0x5efc('0x19')](_0x27e53c);}return _0xd4c796[_0x5efc('0x1a')](_0x27e53c)['end']();};}function respondWithResult(_0xafb14a,_0x26bf3a){_0x26bf3a=_0x26bf3a||0xc8;return function(_0x3b2f59){if(_0x3b2f59){return _0xafb14a['status'](_0x26bf3a)[_0x5efc('0x1b')](_0x3b2f59);}};}function respondWithFilteredResult(_0x7fb3a2,_0x183ce3){return function(_0x34e8ea){if(_0x34e8ea){var _0x5eaa7a=typeof _0x183ce3[_0x5efc('0x1c')]===_0x5efc('0x1d')&&typeof _0x183ce3[_0x5efc('0x1e')]===_0x5efc('0x1d');var _0x1a2b4f=_0x34e8ea[_0x5efc('0x1f')];var _0x794c80=_0x5eaa7a?0x0:_0x183ce3[_0x5efc('0x1c')];var _0x5f56d2=_0x5eaa7a?_0x34e8ea[_0x5efc('0x1f')]:_0x183ce3[_0x5efc('0x1c')]+_0x183ce3['limit'];var _0xc9b9b2;if(_0x5f56d2>=_0x1a2b4f){_0x5f56d2=_0x1a2b4f;_0xc9b9b2=0xc8;}else{_0xc9b9b2=0xce;}_0x7fb3a2['status'](_0xc9b9b2);return _0x7fb3a2[_0x5efc('0x20')](_0x5efc('0x21'),_0x794c80+'-'+_0x5f56d2+'/'+_0x1a2b4f)['json'](_0x34e8ea);}return null;};}function patchUpdates(_0x599ae0){return function(_0x835058){try{jsonpatch[_0x5efc('0x22')](_0x835058,_0x599ae0,!![]);}catch(_0x52a45a){return BPromise[_0x5efc('0x23')](_0x52a45a);}return _0x835058[_0x5efc('0x24')]();};}function saveUpdates(_0x4d66fc,_0xa36c54){return function(_0x38a062){if(_0x38a062){return _0x38a062[_0x5efc('0x25')](_0x4d66fc)[_0x5efc('0x26')](function(_0x4b189e){return _0x4b189e;});}return null;};}function removeEntity(_0xd38f13,_0x3b90b8){return function(_0x52addc){if(_0x52addc){return _0x52addc['destroy']()[_0x5efc('0x26')](function(){_0xd38f13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x444915,_0x1fbb98){return function(_0x4e21a1){if(!_0x4e21a1){_0x444915[_0x5efc('0x19')](0x194);}return _0x4e21a1;};}function handleError(_0x309ea0,_0x1f2f08){_0x1f2f08=_0x1f2f08||0x1f4;return function(_0x315b23){logger['error'](_0x315b23[_0x5efc('0x27')]);if(_0x315b23[_0x5efc('0x28')]){delete _0x315b23['name'];}_0x309ea0[_0x5efc('0x1a')](_0x1f2f08)['send'](_0x315b23);};}exports[_0x5efc('0x29')]=function(_0x5ad1f8,_0x24fdbc){var _0x3b4976={},_0x244688={},_0x263dbb={'count':0x0,'rows':[]};var _0x249662=_[_0x5efc('0x2a')](db['ZohoConfiguration'][_0x5efc('0x2b')],function(_0x5ab329){return{'name':_0x5ab329[_0x5efc('0x2c')],'type':_0x5ab329[_0x5efc('0x2d')]['key']};});_0x244688[_0x5efc('0x2e')]=_['map'](_0x249662,_0x5efc('0x28'));_0x244688[_0x5efc('0x2f')]=_[_0x5efc('0x30')](_0x5ad1f8['query']);_0x244688['filters']=_[_0x5efc('0x31')](_0x244688[_0x5efc('0x2e')],_0x244688[_0x5efc('0x2f')]);_0x3b4976[_0x5efc('0x32')]=_['intersection'](_0x244688['model'],qs[_0x5efc('0x33')](_0x5ad1f8[_0x5efc('0x2f')]['fields']));_0x3b4976[_0x5efc('0x32')]=_0x3b4976[_0x5efc('0x32')][_0x5efc('0x34')]?_0x3b4976[_0x5efc('0x32')]:_0x244688[_0x5efc('0x2e')];if(!_0x5ad1f8[_0x5efc('0x2f')][_0x5efc('0x35')](_0x5efc('0x36'))){_0x3b4976['limit']=qs[_0x5efc('0x1e')](_0x5ad1f8[_0x5efc('0x2f')][_0x5efc('0x1e')]);_0x3b4976[_0x5efc('0x1c')]=qs['offset'](_0x5ad1f8[_0x5efc('0x2f')]['offset']);}_0x3b4976[_0x5efc('0x37')]=qs[_0x5efc('0x38')](_0x5ad1f8[_0x5efc('0x2f')][_0x5efc('0x38')]);_0x3b4976[_0x5efc('0x39')]=qs[_0x5efc('0x3a')](_[_0x5efc('0x3b')](_0x5ad1f8[_0x5efc('0x2f')],_0x244688[_0x5efc('0x3a')]),_0x249662);if(_0x5ad1f8[_0x5efc('0x2f')][_0x5efc('0x3c')]){_0x3b4976[_0x5efc('0x39')]=_[_0x5efc('0x3d')](_0x3b4976[_0x5efc('0x39')],{'$or':_[_0x5efc('0x2a')](_0x249662,function(_0x407a24){if(_0x407a24[_0x5efc('0x2d')]!==_0x5efc('0x3e')){var _0xb553b6={};_0xb553b6[_0x407a24['name']]={'$like':'%'+_0x5ad1f8[_0x5efc('0x2f')][_0x5efc('0x3c')]+'%'};return _0xb553b6;}})});}_0x3b4976=_['merge']({},_0x3b4976,_0x5ad1f8['options']);var _0x3a50a2={'where':_0x3b4976[_0x5efc('0x39')]};return db['ZohoConfiguration'][_0x5efc('0x1f')](_0x3a50a2)['then'](function(_0x3507cf){_0x263dbb[_0x5efc('0x1f')]=_0x3507cf;if(_0x5ad1f8['query'][_0x5efc('0x3f')]){_0x3b4976[_0x5efc('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x3b4976);})[_0x5efc('0x26')](function(_0x4bff37){_0x263dbb[_0x5efc('0x41')]=_0x4bff37;return _0x263dbb;})[_0x5efc('0x26')](respondWithFilteredResult(_0x24fdbc,_0x3b4976))[_0x5efc('0x42')](handleError(_0x24fdbc,null));};exports[_0x5efc('0x43')]=function(_0x2141af,_0x50b897){var _0x2e8259={'raw':![],'where':{'id':_0x2141af[_0x5efc('0x44')]['id']}},_0x1ede95={};_0x1ede95[_0x5efc('0x2e')]=_['keys'](db[_0x5efc('0x45')]['rawAttributes']);_0x1ede95['query']=_[_0x5efc('0x30')](_0x2141af[_0x5efc('0x2f')]);_0x1ede95[_0x5efc('0x3a')]=_[_0x5efc('0x31')](_0x1ede95[_0x5efc('0x2e')],_0x1ede95[_0x5efc('0x2f')]);_0x2e8259[_0x5efc('0x32')]=_[_0x5efc('0x31')](_0x1ede95[_0x5efc('0x2e')],qs[_0x5efc('0x33')](_0x2141af[_0x5efc('0x2f')]['fields']));_0x2e8259[_0x5efc('0x32')]=_0x2e8259['attributes']['length']?_0x2e8259[_0x5efc('0x32')]:_0x1ede95[_0x5efc('0x2e')];if(_0x2141af['query'][_0x5efc('0x3f')]){_0x2e8259[_0x5efc('0x40')]=[{'all':!![]}];}_0x2e8259=_[_0x5efc('0x3d')]({},_0x2e8259,_0x2141af[_0x5efc('0x46')]);return db['ZohoConfiguration'][_0x5efc('0x47')](_0x2e8259)['then'](handleEntityNotFound(_0x50b897,null))[_0x5efc('0x26')](respondWithResult(_0x50b897,null))[_0x5efc('0x42')](handleError(_0x50b897,null));};exports[_0x5efc('0x48')]=function(_0xac0e5a,_0x590c11){return db[_0x5efc('0x45')][_0x5efc('0x48')](_0xac0e5a[_0x5efc('0x49')],{})[_0x5efc('0x26')](respondWithResult(_0x590c11,0xc9))['catch'](handleError(_0x590c11,null));};exports[_0x5efc('0x25')]=function(_0x4c37df,_0x11d620){if(_0x4c37df[_0x5efc('0x49')]['id']){delete _0x4c37df[_0x5efc('0x49')]['id'];}return db[_0x5efc('0x45')][_0x5efc('0x47')]({'where':{'id':_0x4c37df[_0x5efc('0x44')]['id']}})[_0x5efc('0x26')](handleEntityNotFound(_0x11d620,null))[_0x5efc('0x26')](saveUpdates(_0x4c37df['body'],null))[_0x5efc('0x26')](respondWithResult(_0x11d620,null))[_0x5efc('0x42')](handleError(_0x11d620,null));};exports['destroy']=function(_0x5ea0ab,_0x9b6150){return db[_0x5efc('0x45')][_0x5efc('0x47')]({'where':{'id':_0x5ea0ab[_0x5efc('0x44')]['id']}})['then'](handleEntityNotFound(_0x9b6150,null))['then'](removeEntity(_0x9b6150,null))[_0x5efc('0x42')](handleError(_0x9b6150,null));};exports[_0x5efc('0x4a')]=function(_0x525f5b,_0x8839e8,_0x856ecf){var _0x4776bb={};var _0x54c742={};var _0x4269e6;var _0x4f3f0c;return db[_0x5efc('0x45')][_0x5efc('0x4b')]({'where':{'id':_0x525f5b[_0x5efc('0x44')]['id']}})[_0x5efc('0x26')](handleEntityNotFound(_0x8839e8,null))[_0x5efc('0x26')](function(_0x3899f0){if(_0x3899f0){_0x4269e6=_0x3899f0;_0x54c742['model']=_[_0x5efc('0x30')](db[_0x5efc('0x4c')][_0x5efc('0x2b')]);_0x54c742[_0x5efc('0x2f')]=_[_0x5efc('0x30')](_0x525f5b[_0x5efc('0x2f')]);_0x54c742[_0x5efc('0x3a')]=_[_0x5efc('0x31')](_0x54c742['model'],_0x54c742[_0x5efc('0x2f')]);_0x4776bb[_0x5efc('0x32')]=_['intersection'](_0x54c742[_0x5efc('0x2e')],qs['fields'](_0x525f5b[_0x5efc('0x2f')][_0x5efc('0x33')]));_0x4776bb[_0x5efc('0x32')]=_0x4776bb[_0x5efc('0x32')]['length']?_0x4776bb[_0x5efc('0x32')]:_0x54c742[_0x5efc('0x2e')];_0x4776bb['order']=qs[_0x5efc('0x38')](_0x525f5b[_0x5efc('0x2f')][_0x5efc('0x38')]);_0x4776bb[_0x5efc('0x39')]=qs[_0x5efc('0x3a')](_['pick'](_0x525f5b[_0x5efc('0x2f')],_0x54c742['filters']));if(_0x525f5b['query']['filter']){_0x4776bb[_0x5efc('0x39')]=_[_0x5efc('0x3d')](_0x4776bb[_0x5efc('0x39')],{'$or':_['map'](_0x4776bb[_0x5efc('0x32')],function(_0x28ef83){var _0x94658f={};_0x94658f[_0x28ef83]={'$like':'%'+_0x525f5b[_0x5efc('0x2f')][_0x5efc('0x3c')]+'%'};return _0x94658f;})});}_0x4776bb=_[_0x5efc('0x3d')]({},_0x4776bb,_0x525f5b['options']);return _0x4269e6['getFields'](_0x4776bb);}})[_0x5efc('0x26')](function(_0x32a2d0){if(_0x32a2d0){_0x4f3f0c=_0x32a2d0['length'];if(!_0x525f5b[_0x5efc('0x2f')][_0x5efc('0x35')](_0x5efc('0x36'))){_0x4776bb[_0x5efc('0x1e')]=qs[_0x5efc('0x1e')](_0x525f5b[_0x5efc('0x2f')][_0x5efc('0x1e')]);_0x4776bb[_0x5efc('0x1c')]=qs['offset'](_0x525f5b['query']['offset']);}return _0x4269e6[_0x5efc('0x4a')](_0x4776bb);}})[_0x5efc('0x26')](function(_0x1a20ec){if(_0x1a20ec){return _0x1a20ec?{'count':_0x4f3f0c,'rows':_0x1a20ec}:null;}})[_0x5efc('0x26')](respondWithResult(_0x8839e8,null))['catch'](handleError(_0x8839e8,null));};exports[_0x5efc('0x4d')]=function(_0x2b5211,_0x1ff861,_0x234a20){var _0x591f60={};var _0x2bfbd8={};var _0x538ae7;var _0x9be2b9;return db[_0x5efc('0x45')][_0x5efc('0x4b')]({'where':{'id':_0x2b5211[_0x5efc('0x44')]['id']}})[_0x5efc('0x26')](handleEntityNotFound(_0x1ff861,null))['then'](function(_0x3bf1cd){if(_0x3bf1cd){_0x538ae7=_0x3bf1cd;_0x2bfbd8[_0x5efc('0x2e')]=_['keys'](db[_0x5efc('0x4c')][_0x5efc('0x2b')]);_0x2bfbd8[_0x5efc('0x2f')]=_[_0x5efc('0x30')](_0x2b5211[_0x5efc('0x2f')]);_0x2bfbd8['filters']=_[_0x5efc('0x31')](_0x2bfbd8[_0x5efc('0x2e')],_0x2bfbd8['query']);_0x591f60['attributes']=_[_0x5efc('0x31')](_0x2bfbd8[_0x5efc('0x2e')],qs['fields'](_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x33')]));_0x591f60['attributes']=_0x591f60[_0x5efc('0x32')][_0x5efc('0x34')]?_0x591f60[_0x5efc('0x32')]:_0x2bfbd8[_0x5efc('0x2e')];_0x591f60[_0x5efc('0x37')]=qs[_0x5efc('0x38')](_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x38')]);_0x591f60[_0x5efc('0x39')]=qs['filters'](_[_0x5efc('0x3b')](_0x2b5211[_0x5efc('0x2f')],_0x2bfbd8[_0x5efc('0x3a')]));if(_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x3c')]){_0x591f60[_0x5efc('0x39')]=_[_0x5efc('0x3d')](_0x591f60[_0x5efc('0x39')],{'$or':_['map'](_0x591f60[_0x5efc('0x32')],function(_0x57d0f8){var _0x783cc9={};_0x783cc9[_0x57d0f8]={'$like':'%'+_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x3c')]+'%'};return _0x783cc9;})});}_0x591f60=_['merge']({},_0x591f60,_0x2b5211[_0x5efc('0x46')]);return _0x538ae7[_0x5efc('0x4d')](_0x591f60);}})['then'](function(_0x5f1dff){if(_0x5f1dff){_0x9be2b9=_0x5f1dff[_0x5efc('0x34')];if(!_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x35')]('nolimit')){_0x591f60[_0x5efc('0x1e')]=qs[_0x5efc('0x1e')](_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x1e')]);_0x591f60[_0x5efc('0x1c')]=qs[_0x5efc('0x1c')](_0x2b5211[_0x5efc('0x2f')][_0x5efc('0x1c')]);}return _0x538ae7[_0x5efc('0x4d')](_0x591f60);}})[_0x5efc('0x26')](function(_0x5ced36){if(_0x5ced36){return _0x5ced36?{'count':_0x9be2b9,'rows':_0x5ced36}:null;}})['then'](respondWithResult(_0x1ff861,null))[_0x5efc('0x42')](handleError(_0x1ff861,null));};exports[_0x5efc('0x4e')]=function(_0x103bfd,_0x35e80e,_0x50c1fc){var _0x2ede17={};var _0x40c5ba={};var _0x2db16d;var _0x2e32c6;return db['ZohoConfiguration'][_0x5efc('0x4b')]({'where':{'id':_0x103bfd[_0x5efc('0x44')]['id']}})[_0x5efc('0x26')](handleEntityNotFound(_0x35e80e,null))[_0x5efc('0x26')](function(_0x2a9d56){if(_0x2a9d56){_0x2db16d=_0x2a9d56;_0x40c5ba[_0x5efc('0x2e')]=_[_0x5efc('0x30')](db['ZohoField'][_0x5efc('0x2b')]);_0x40c5ba['query']=_[_0x5efc('0x30')](_0x103bfd[_0x5efc('0x2f')]);_0x40c5ba[_0x5efc('0x3a')]=_[_0x5efc('0x31')](_0x40c5ba[_0x5efc('0x2e')],_0x40c5ba[_0x5efc('0x2f')]);_0x2ede17['attributes']=_[_0x5efc('0x31')](_0x40c5ba['model'],qs[_0x5efc('0x33')](_0x103bfd['query'][_0x5efc('0x33')]));_0x2ede17['attributes']=_0x2ede17['attributes'][_0x5efc('0x34')]?_0x2ede17[_0x5efc('0x32')]:_0x40c5ba['model'];_0x2ede17[_0x5efc('0x37')]=qs[_0x5efc('0x38')](_0x103bfd[_0x5efc('0x2f')]['sort']);_0x2ede17[_0x5efc('0x39')]=qs['filters'](_[_0x5efc('0x3b')](_0x103bfd[_0x5efc('0x2f')],_0x40c5ba[_0x5efc('0x3a')]));if(_0x103bfd[_0x5efc('0x2f')][_0x5efc('0x3c')]){_0x2ede17[_0x5efc('0x39')]=_['merge'](_0x2ede17[_0x5efc('0x39')],{'$or':_[_0x5efc('0x2a')](_0x2ede17[_0x5efc('0x32')],function(_0x6b54bd){var _0x315b09={};_0x315b09[_0x6b54bd]={'$like':'%'+_0x103bfd[_0x5efc('0x2f')][_0x5efc('0x3c')]+'%'};return _0x315b09;})});}_0x2ede17=_[_0x5efc('0x3d')]({},_0x2ede17,_0x103bfd[_0x5efc('0x46')]);return _0x2db16d[_0x5efc('0x4e')](_0x2ede17);}})[_0x5efc('0x26')](function(_0x39f767){if(_0x39f767){_0x2e32c6=_0x39f767[_0x5efc('0x34')];if(!_0x103bfd[_0x5efc('0x2f')]['hasOwnProperty'](_0x5efc('0x36'))){_0x2ede17[_0x5efc('0x1e')]=qs[_0x5efc('0x1e')](_0x103bfd[_0x5efc('0x2f')]['limit']);_0x2ede17['offset']=qs[_0x5efc('0x1c')](_0x103bfd[_0x5efc('0x2f')][_0x5efc('0x1c')]);}return _0x2db16d[_0x5efc('0x4e')](_0x2ede17);}})[_0x5efc('0x26')](function(_0xe7f030){if(_0xe7f030){return _0xe7f030?{'count':_0x2e32c6,'rows':_0xe7f030}:null;}})[_0x5efc('0x26')](respondWithResult(_0x35e80e,null))[_0x5efc('0x42')](handleError(_0x35e80e,null));}; \ No newline at end of file +var _0xc014=['moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','ZohoConfiguration','include','findAll','rows','catch','show','options','find','create','body','findOne','params','ZohoField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','request-promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc014,0xe7));var _0x4c01=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xc014[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x4c01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c01('0x2'));var moment=require(_0x4c01('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c01('0x4'));var util=require(_0x4c01('0x5'));var path=require('path');var sox=require(_0x4c01('0x6'));var csv=require(_0x4c01('0x7'));var ejs=require(_0x4c01('0x8'));var fs=require('fs');var fs_extra=require(_0x4c01('0x9'));var _=require(_0x4c01('0xa'));var squel=require(_0x4c01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c01('0xc'));var toCsv=require(_0x4c01('0x7'));var querystring=require(_0x4c01('0xd'));var Papa=require(_0x4c01('0xe'));var Redis=require(_0x4c01('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c01('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c01('0x11'))('api');var utils=require(_0x4c01('0x12'));var config=require(_0x4c01('0x13'));var licenseUtil=require(_0x4c01('0x14'));var db=require(_0x4c01('0x15'))['db'];function respondWithStatusCode(_0x376a27,_0x1f854b){_0x1f854b=_0x1f854b||0xcc;return function(_0x235949){if(_0x235949){return _0x376a27[_0x4c01('0x16')](_0x1f854b);}return _0x376a27[_0x4c01('0x17')](_0x1f854b)[_0x4c01('0x18')]();};}function respondWithResult(_0x276ff6,_0x2d49d2){_0x2d49d2=_0x2d49d2||0xc8;return function(_0x36812a){if(_0x36812a){return _0x276ff6[_0x4c01('0x17')](_0x2d49d2)[_0x4c01('0x19')](_0x36812a);}};}function respondWithFilteredResult(_0x1c5d54,_0x5cb0cd){return function(_0x585197){if(_0x585197){var _0x18cc49=typeof _0x5cb0cd['offset']===_0x4c01('0x1a')&&typeof _0x5cb0cd['limit']==='undefined';var _0x55e54b=_0x585197[_0x4c01('0x1b')];var _0x215f2d=_0x18cc49?0x0:_0x5cb0cd[_0x4c01('0x1c')];var _0x271e94=_0x18cc49?_0x585197[_0x4c01('0x1b')]:_0x5cb0cd['offset']+_0x5cb0cd['limit'];var _0xd9884f;if(_0x271e94>=_0x55e54b){_0x271e94=_0x55e54b;_0xd9884f=0xc8;}else{_0xd9884f=0xce;}_0x1c5d54[_0x4c01('0x17')](_0xd9884f);return _0x1c5d54[_0x4c01('0x1d')]('Content-Range',_0x215f2d+'-'+_0x271e94+'/'+_0x55e54b)[_0x4c01('0x19')](_0x585197);}return null;};}function patchUpdates(_0x85693){return function(_0xe3d2b2){try{jsonpatch[_0x4c01('0x1e')](_0xe3d2b2,_0x85693,!![]);}catch(_0x550fb9){return BPromise['reject'](_0x550fb9);}return _0xe3d2b2[_0x4c01('0x1f')]();};}function saveUpdates(_0x125f67,_0x349d3d){return function(_0x432922){if(_0x432922){return _0x432922[_0x4c01('0x20')](_0x125f67)[_0x4c01('0x21')](function(_0x1d2dea){return _0x1d2dea;});}return null;};}function removeEntity(_0x125436,_0x3846fa){return function(_0x1c6833){if(_0x1c6833){return _0x1c6833[_0x4c01('0x22')]()['then'](function(){_0x125436[_0x4c01('0x17')](0xcc)[_0x4c01('0x18')]();});}};}function handleEntityNotFound(_0x55accb,_0x1af23b){return function(_0xc8b290){if(!_0xc8b290){_0x55accb['sendStatus'](0x194);}return _0xc8b290;};}function handleError(_0x45da38,_0x56f937){_0x56f937=_0x56f937||0x1f4;return function(_0x1655f3){logger['error'](_0x1655f3[_0x4c01('0x23')]);if(_0x1655f3['name']){delete _0x1655f3[_0x4c01('0x24')];}_0x45da38[_0x4c01('0x17')](_0x56f937)[_0x4c01('0x25')](_0x1655f3);};}exports[_0x4c01('0x26')]=function(_0x6470d7,_0x1909ea){var _0x340634={},_0x3dd6ab={},_0x44c496={'count':0x0,'rows':[]};var _0x2b68b6=_['map'](db['ZohoConfiguration'][_0x4c01('0x27')],function(_0x46712b){return{'name':_0x46712b[_0x4c01('0x28')],'type':_0x46712b['type'][_0x4c01('0x29')]};});_0x3dd6ab[_0x4c01('0x2a')]=_[_0x4c01('0x2b')](_0x2b68b6,'name');_0x3dd6ab[_0x4c01('0x2c')]=_[_0x4c01('0x2d')](_0x6470d7['query']);_0x3dd6ab[_0x4c01('0x2e')]=_[_0x4c01('0x2f')](_0x3dd6ab[_0x4c01('0x2a')],_0x3dd6ab['query']);_0x340634['attributes']=_[_0x4c01('0x2f')](_0x3dd6ab[_0x4c01('0x2a')],qs[_0x4c01('0x30')](_0x6470d7['query'][_0x4c01('0x30')]));_0x340634[_0x4c01('0x31')]=_0x340634[_0x4c01('0x31')][_0x4c01('0x32')]?_0x340634['attributes']:_0x3dd6ab['model'];if(!_0x6470d7[_0x4c01('0x2c')][_0x4c01('0x33')](_0x4c01('0x34'))){_0x340634[_0x4c01('0x35')]=qs[_0x4c01('0x35')](_0x6470d7[_0x4c01('0x2c')][_0x4c01('0x35')]);_0x340634['offset']=qs[_0x4c01('0x1c')](_0x6470d7[_0x4c01('0x2c')][_0x4c01('0x1c')]);}_0x340634[_0x4c01('0x36')]=qs[_0x4c01('0x37')](_0x6470d7['query']['sort']);_0x340634[_0x4c01('0x38')]=qs[_0x4c01('0x2e')](_[_0x4c01('0x39')](_0x6470d7[_0x4c01('0x2c')],_0x3dd6ab[_0x4c01('0x2e')]),_0x2b68b6);if(_0x6470d7[_0x4c01('0x2c')][_0x4c01('0x3a')]){_0x340634['where']=_[_0x4c01('0x3b')](_0x340634['where'],{'$or':_[_0x4c01('0x2b')](_0x2b68b6,function(_0x529006){if(_0x529006[_0x4c01('0x3c')]!==_0x4c01('0x3d')){var _0x390f13={};_0x390f13[_0x529006[_0x4c01('0x24')]]={'$like':'%'+_0x6470d7[_0x4c01('0x2c')][_0x4c01('0x3a')]+'%'};return _0x390f13;}})});}_0x340634=_[_0x4c01('0x3b')]({},_0x340634,_0x6470d7['options']);var _0x2ab607={'where':_0x340634[_0x4c01('0x38')]};return db[_0x4c01('0x3e')][_0x4c01('0x1b')](_0x2ab607)['then'](function(_0x40df64){_0x44c496[_0x4c01('0x1b')]=_0x40df64;if(_0x6470d7['query']['includeAll']){_0x340634[_0x4c01('0x3f')]=[{'all':!![]}];}return db[_0x4c01('0x3e')][_0x4c01('0x40')](_0x340634);})[_0x4c01('0x21')](function(_0xfefcc0){_0x44c496[_0x4c01('0x41')]=_0xfefcc0;return _0x44c496;})[_0x4c01('0x21')](respondWithFilteredResult(_0x1909ea,_0x340634))[_0x4c01('0x42')](handleError(_0x1909ea,null));};exports[_0x4c01('0x43')]=function(_0x2daae0,_0x59903e){var _0x3f017c={'raw':![],'where':{'id':_0x2daae0['params']['id']}},_0x4536cf={};_0x4536cf[_0x4c01('0x2a')]=_[_0x4c01('0x2d')](db[_0x4c01('0x3e')]['rawAttributes']);_0x4536cf[_0x4c01('0x2c')]=_[_0x4c01('0x2d')](_0x2daae0[_0x4c01('0x2c')]);_0x4536cf[_0x4c01('0x2e')]=_[_0x4c01('0x2f')](_0x4536cf['model'],_0x4536cf[_0x4c01('0x2c')]);_0x3f017c[_0x4c01('0x31')]=_[_0x4c01('0x2f')](_0x4536cf['model'],qs[_0x4c01('0x30')](_0x2daae0[_0x4c01('0x2c')][_0x4c01('0x30')]));_0x3f017c[_0x4c01('0x31')]=_0x3f017c['attributes'][_0x4c01('0x32')]?_0x3f017c[_0x4c01('0x31')]:_0x4536cf[_0x4c01('0x2a')];if(_0x2daae0[_0x4c01('0x2c')]['includeAll']){_0x3f017c[_0x4c01('0x3f')]=[{'all':!![]}];}_0x3f017c=_[_0x4c01('0x3b')]({},_0x3f017c,_0x2daae0[_0x4c01('0x44')]);return db[_0x4c01('0x3e')][_0x4c01('0x45')](_0x3f017c)[_0x4c01('0x21')](handleEntityNotFound(_0x59903e,null))[_0x4c01('0x21')](respondWithResult(_0x59903e,null))[_0x4c01('0x42')](handleError(_0x59903e,null));};exports[_0x4c01('0x46')]=function(_0xcde27a,_0x2d1e70){return db[_0x4c01('0x3e')][_0x4c01('0x46')](_0xcde27a[_0x4c01('0x47')],{})['then'](respondWithResult(_0x2d1e70,0xc9))[_0x4c01('0x42')](handleError(_0x2d1e70,null));};exports[_0x4c01('0x20')]=function(_0x183cae,_0x2cb50c){if(_0x183cae['body']['id']){delete _0x183cae[_0x4c01('0x47')]['id'];}return db['ZohoConfiguration'][_0x4c01('0x45')]({'where':{'id':_0x183cae['params']['id']}})[_0x4c01('0x21')](handleEntityNotFound(_0x2cb50c,null))[_0x4c01('0x21')](saveUpdates(_0x183cae[_0x4c01('0x47')],null))[_0x4c01('0x21')](respondWithResult(_0x2cb50c,null))[_0x4c01('0x42')](handleError(_0x2cb50c,null));};exports[_0x4c01('0x22')]=function(_0x1110bd,_0x203cb2){return db[_0x4c01('0x3e')][_0x4c01('0x45')]({'where':{'id':_0x1110bd['params']['id']}})[_0x4c01('0x21')](handleEntityNotFound(_0x203cb2,null))['then'](removeEntity(_0x203cb2,null))[_0x4c01('0x42')](handleError(_0x203cb2,null));};exports['getFields']=function(_0x57a66b,_0x370463,_0x55c00d){var _0x429ec5={};var _0x5caa49={};var _0xdba90b;var _0x60f8d0;return db[_0x4c01('0x3e')][_0x4c01('0x48')]({'where':{'id':_0x57a66b[_0x4c01('0x49')]['id']}})[_0x4c01('0x21')](handleEntityNotFound(_0x370463,null))[_0x4c01('0x21')](function(_0x3f8413){if(_0x3f8413){_0xdba90b=_0x3f8413;_0x5caa49[_0x4c01('0x2a')]=_['keys'](db[_0x4c01('0x4a')][_0x4c01('0x27')]);_0x5caa49[_0x4c01('0x2c')]=_['keys'](_0x57a66b['query']);_0x5caa49[_0x4c01('0x2e')]=_[_0x4c01('0x2f')](_0x5caa49['model'],_0x5caa49[_0x4c01('0x2c')]);_0x429ec5[_0x4c01('0x31')]=_[_0x4c01('0x2f')](_0x5caa49['model'],qs[_0x4c01('0x30')](_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x30')]));_0x429ec5[_0x4c01('0x31')]=_0x429ec5['attributes'][_0x4c01('0x32')]?_0x429ec5[_0x4c01('0x31')]:_0x5caa49[_0x4c01('0x2a')];_0x429ec5['order']=qs[_0x4c01('0x37')](_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x37')]);_0x429ec5[_0x4c01('0x38')]=qs[_0x4c01('0x2e')](_[_0x4c01('0x39')](_0x57a66b[_0x4c01('0x2c')],_0x5caa49[_0x4c01('0x2e')]));if(_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x3a')]){_0x429ec5[_0x4c01('0x38')]=_[_0x4c01('0x3b')](_0x429ec5[_0x4c01('0x38')],{'$or':_['map'](_0x429ec5[_0x4c01('0x31')],function(_0x5c60b9){var _0x40b3fc={};_0x40b3fc[_0x5c60b9]={'$like':'%'+_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x3a')]+'%'};return _0x40b3fc;})});}_0x429ec5=_[_0x4c01('0x3b')]({},_0x429ec5,_0x57a66b[_0x4c01('0x44')]);return _0xdba90b['getFields'](_0x429ec5);}})[_0x4c01('0x21')](function(_0x1c4492){if(_0x1c4492){_0x60f8d0=_0x1c4492['length'];if(!_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x33')](_0x4c01('0x34'))){_0x429ec5[_0x4c01('0x35')]=qs['limit'](_0x57a66b[_0x4c01('0x2c')][_0x4c01('0x35')]);_0x429ec5[_0x4c01('0x1c')]=qs[_0x4c01('0x1c')](_0x57a66b['query'][_0x4c01('0x1c')]);}return _0xdba90b[_0x4c01('0x4b')](_0x429ec5);}})[_0x4c01('0x21')](function(_0x139c45){if(_0x139c45){return _0x139c45?{'count':_0x60f8d0,'rows':_0x139c45}:null;}})[_0x4c01('0x21')](respondWithResult(_0x370463,null))[_0x4c01('0x42')](handleError(_0x370463,null));};exports[_0x4c01('0x4c')]=function(_0x911328,_0x3f2078,_0x32d3a4){var _0x4f0d9a={};var _0x21cd93={};var _0x126439;var _0xb7030c;return db[_0x4c01('0x3e')]['findOne']({'where':{'id':_0x911328[_0x4c01('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f2078,null))['then'](function(_0x13eb64){if(_0x13eb64){_0x126439=_0x13eb64;_0x21cd93[_0x4c01('0x2a')]=_[_0x4c01('0x2d')](db['ZohoField']['rawAttributes']);_0x21cd93[_0x4c01('0x2c')]=_[_0x4c01('0x2d')](_0x911328[_0x4c01('0x2c')]);_0x21cd93[_0x4c01('0x2e')]=_['intersection'](_0x21cd93[_0x4c01('0x2a')],_0x21cd93[_0x4c01('0x2c')]);_0x4f0d9a[_0x4c01('0x31')]=_[_0x4c01('0x2f')](_0x21cd93[_0x4c01('0x2a')],qs['fields'](_0x911328[_0x4c01('0x2c')]['fields']));_0x4f0d9a['attributes']=_0x4f0d9a[_0x4c01('0x31')][_0x4c01('0x32')]?_0x4f0d9a[_0x4c01('0x31')]:_0x21cd93[_0x4c01('0x2a')];_0x4f0d9a[_0x4c01('0x36')]=qs[_0x4c01('0x37')](_0x911328[_0x4c01('0x2c')][_0x4c01('0x37')]);_0x4f0d9a[_0x4c01('0x38')]=qs[_0x4c01('0x2e')](_[_0x4c01('0x39')](_0x911328[_0x4c01('0x2c')],_0x21cd93['filters']));if(_0x911328[_0x4c01('0x2c')][_0x4c01('0x3a')]){_0x4f0d9a[_0x4c01('0x38')]=_[_0x4c01('0x3b')](_0x4f0d9a['where'],{'$or':_['map'](_0x4f0d9a[_0x4c01('0x31')],function(_0x4dec2f){var _0x3e45a3={};_0x3e45a3[_0x4dec2f]={'$like':'%'+_0x911328[_0x4c01('0x2c')][_0x4c01('0x3a')]+'%'};return _0x3e45a3;})});}_0x4f0d9a=_[_0x4c01('0x3b')]({},_0x4f0d9a,_0x911328[_0x4c01('0x44')]);return _0x126439['getSubjects'](_0x4f0d9a);}})[_0x4c01('0x21')](function(_0x162cad){if(_0x162cad){_0xb7030c=_0x162cad[_0x4c01('0x32')];if(!_0x911328[_0x4c01('0x2c')][_0x4c01('0x33')](_0x4c01('0x34'))){_0x4f0d9a[_0x4c01('0x35')]=qs[_0x4c01('0x35')](_0x911328[_0x4c01('0x2c')][_0x4c01('0x35')]);_0x4f0d9a[_0x4c01('0x1c')]=qs[_0x4c01('0x1c')](_0x911328[_0x4c01('0x2c')][_0x4c01('0x1c')]);}return _0x126439[_0x4c01('0x4c')](_0x4f0d9a);}})[_0x4c01('0x21')](function(_0x4728e5){if(_0x4728e5){return _0x4728e5?{'count':_0xb7030c,'rows':_0x4728e5}:null;}})[_0x4c01('0x21')](respondWithResult(_0x3f2078,null))['catch'](handleError(_0x3f2078,null));};exports[_0x4c01('0x4d')]=function(_0x17f66c,_0x170691,_0x386d25){var _0x484e2f={};var _0x1e1404={};var _0x3e14ad;var _0x405e93;return db[_0x4c01('0x3e')][_0x4c01('0x48')]({'where':{'id':_0x17f66c[_0x4c01('0x49')]['id']}})[_0x4c01('0x21')](handleEntityNotFound(_0x170691,null))['then'](function(_0x121c68){if(_0x121c68){_0x3e14ad=_0x121c68;_0x1e1404[_0x4c01('0x2a')]=_[_0x4c01('0x2d')](db[_0x4c01('0x4a')][_0x4c01('0x27')]);_0x1e1404[_0x4c01('0x2c')]=_[_0x4c01('0x2d')](_0x17f66c[_0x4c01('0x2c')]);_0x1e1404['filters']=_[_0x4c01('0x2f')](_0x1e1404[_0x4c01('0x2a')],_0x1e1404[_0x4c01('0x2c')]);_0x484e2f[_0x4c01('0x31')]=_[_0x4c01('0x2f')](_0x1e1404[_0x4c01('0x2a')],qs['fields'](_0x17f66c['query'][_0x4c01('0x30')]));_0x484e2f['attributes']=_0x484e2f['attributes'][_0x4c01('0x32')]?_0x484e2f[_0x4c01('0x31')]:_0x1e1404[_0x4c01('0x2a')];_0x484e2f[_0x4c01('0x36')]=qs['sort'](_0x17f66c[_0x4c01('0x2c')]['sort']);_0x484e2f[_0x4c01('0x38')]=qs[_0x4c01('0x2e')](_[_0x4c01('0x39')](_0x17f66c['query'],_0x1e1404[_0x4c01('0x2e')]));if(_0x17f66c[_0x4c01('0x2c')][_0x4c01('0x3a')]){_0x484e2f[_0x4c01('0x38')]=_['merge'](_0x484e2f[_0x4c01('0x38')],{'$or':_['map'](_0x484e2f[_0x4c01('0x31')],function(_0x34ef78){var _0x21f34a={};_0x21f34a[_0x34ef78]={'$like':'%'+_0x17f66c['query']['filter']+'%'};return _0x21f34a;})});}_0x484e2f=_['merge']({},_0x484e2f,_0x17f66c['options']);return _0x3e14ad[_0x4c01('0x4d')](_0x484e2f);}})[_0x4c01('0x21')](function(_0x1d4653){if(_0x1d4653){_0x405e93=_0x1d4653[_0x4c01('0x32')];if(!_0x17f66c[_0x4c01('0x2c')][_0x4c01('0x33')](_0x4c01('0x34'))){_0x484e2f[_0x4c01('0x35')]=qs['limit'](_0x17f66c[_0x4c01('0x2c')]['limit']);_0x484e2f['offset']=qs[_0x4c01('0x1c')](_0x17f66c['query'][_0x4c01('0x1c')]);}return _0x3e14ad[_0x4c01('0x4d')](_0x484e2f);}})[_0x4c01('0x21')](function(_0x1ba367){if(_0x1ba367){return _0x1ba367?{'count':_0x405e93,'rows':_0x1ba367}:null;}})[_0x4c01('0x21')](respondWithResult(_0x170691,null))[_0x4c01('0x42')](handleError(_0x170691,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index df12516..73b1a41 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 _0x68c5=['../../config/environment','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x68c5,0x12f));var _0x568c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x68c5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x568c('0x0'));var util=require(_0x568c('0x1'));var logger=require(_0x568c('0x2'))(_0x568c('0x3'));var moment=require(_0x568c('0x4'));var BPromise=require(_0x568c('0x5'));var rp=require(_0x568c('0x6'));var fs=require('fs');var path=require(_0x568c('0x7'));var rimraf=require(_0x568c('0x8'));var config=require(_0x568c('0x9'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x445371,_0x11fc14){return _0x445371['define'](_0x568c('0xa'),attributes,{'tableName':_0x568c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd28f=['define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0xd28f,0x155));var _0xfd28=function(_0x12fb9d,_0x5e8ba6){_0x12fb9d=_0x12fb9d-0x0;var _0x558d50=_0xd28f[_0x12fb9d];return _0x558d50;};'use strict';var _=require('lodash');var util=require(_0xfd28('0x0'));var logger=require(_0xfd28('0x1'))(_0xfd28('0x2'));var moment=require(_0xfd28('0x3'));var BPromise=require(_0xfd28('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd28('0x5'));var rimraf=require(_0xfd28('0x6'));var config=require(_0xfd28('0x7'));var attributes=require(_0xfd28('0x8'));module[_0xfd28('0x9')]=function(_0x24995d,_0x29d6d5){return _0x24995d[_0xfd28('0xa')](_0xfd28('0xb'),attributes,{'tableName':_0xfd28('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index d01b959..f368059 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 _0xccab=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x536fa5,_0x27e839){var _0x582b8d=function(_0x24f256){while(--_0x24f256){_0x536fa5['push'](_0x536fa5['shift']());}};_0x582b8d(++_0x27e839);}(_0xccab,0x13d));var _0xbcca=function(_0x1f36d3,_0x584a30){_0x1f36d3=_0x1f36d3-0x0;var _0x8030a8=_0xccab[_0x1f36d3];return _0x8030a8;};'use strict';var _=require(_0xbcca('0x0'));var util=require(_0xbcca('0x1'));var moment=require('moment');var BPromise=require(_0xbcca('0x2'));var rs=require(_0xbcca('0x3'));var fs=require('fs');var Redis=require(_0xbcca('0x4'));var db=require(_0xbcca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcca('0x6'))(_0xbcca('0x7'));var config=require('../../config/environment');var jayson=require(_0xbcca('0x8'));var client=jayson[_0xbcca('0x9')][_0xbcca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x482401,_0x1eaf2f,_0x1c862d){return new BPromise(function(_0x5f304e,_0x28c76c){return client[_0xbcca('0xb')](_0x482401,_0x1c862d)[_0xbcca('0xc')](function(_0x153efa){logger['info'](_0xbcca('0xd'),_0x1eaf2f,_0xbcca('0xe'));logger[_0xbcca('0xf')](_0xbcca('0x10'),_0x1eaf2f,'request\x20sent',JSON[_0xbcca('0x11')](_0x153efa));if(_0x153efa[_0xbcca('0x12')]){if(_0x153efa[_0xbcca('0x12')]['code']===0x1f4){logger[_0xbcca('0x12')](_0xbcca('0xd'),_0x1eaf2f,_0x153efa[_0xbcca('0x12')]['message']);return _0x28c76c(_0x153efa[_0xbcca('0x12')][_0xbcca('0x13')]);}logger[_0xbcca('0x12')](_0xbcca('0xd'),_0x1eaf2f,_0x153efa[_0xbcca('0x12')][_0xbcca('0x13')]);return _0x5f304e(_0x153efa[_0xbcca('0x12')][_0xbcca('0x13')]);}else{logger[_0xbcca('0x14')](_0xbcca('0xd'),_0x1eaf2f,_0xbcca('0xe'));_0x5f304e(_0x153efa[_0xbcca('0x15')]['message']);}})['catch'](function(_0x514797){logger[_0xbcca('0x12')](_0xbcca('0xd'),_0x1eaf2f,_0x514797);_0x28c76c(_0x514797);});});} \ No newline at end of file +var _0x5c95=['ioredis','../../config/logger','../../config/environment','http','then','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1c2378,_0x43b4b2){var _0xf94db9=function(_0x4e8c5e){while(--_0x4e8c5e){_0x1c2378['push'](_0x1c2378['shift']());}};_0xf94db9(++_0x43b4b2);}(_0x5c95,0x177));var _0x55c9=function(_0x300291,_0x447d63){_0x300291=_0x300291-0x0;var _0x5df13e=_0x5c95[_0x300291];return _0x5df13e;};'use strict';var _=require(_0x55c9('0x0'));var util=require(_0x55c9('0x1'));var moment=require(_0x55c9('0x2'));var BPromise=require(_0x55c9('0x3'));var rs=require(_0x55c9('0x4'));var fs=require('fs');var Redis=require(_0x55c9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55c9('0x6'))('rpc');var config=require(_0x55c9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22befd,_0x3aae43,_0x58f1fb){return new BPromise(function(_0xbce686,_0x5703de){return client['request'](_0x22befd,_0x58f1fb)[_0x55c9('0x9')](function(_0x5e06b9){logger[_0x55c9('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x3aae43,'request\x20sent');logger['debug'](_0x55c9('0xb'),_0x3aae43,_0x55c9('0xc'),JSON[_0x55c9('0xd')](_0x5e06b9));if(_0x5e06b9[_0x55c9('0xe')]){if(_0x5e06b9[_0x55c9('0xe')][_0x55c9('0xf')]===0x1f4){logger[_0x55c9('0xe')](_0x55c9('0x10'),_0x3aae43,_0x5e06b9[_0x55c9('0xe')]['message']);return _0x5703de(_0x5e06b9[_0x55c9('0xe')][_0x55c9('0x11')]);}logger[_0x55c9('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3aae43,_0x5e06b9['error'][_0x55c9('0x11')]);return _0xbce686(_0x5e06b9[_0x55c9('0xe')][_0x55c9('0x11')]);}else{logger['info'](_0x55c9('0x10'),_0x3aae43,'request\x20sent');_0xbce686(_0x5e06b9[_0x55c9('0x12')][_0x55c9('0x11')]);}})['catch'](function(_0x4aa6f5){logger[_0x55c9('0xe')](_0x55c9('0x10'),_0x3aae43,_0x4aa6f5);_0x5703de(_0x4aa6f5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index be31631..6c5d9c0 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 _0xfc36=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','show','isAuthenticated','create','put','delete','destroy','util','path'];(function(_0x320272,_0x28d387){var _0xb204e9=function(_0x169e74){while(--_0x169e74){_0x320272['push'](_0x320272['shift']());}};_0xb204e9(++_0x28d387);}(_0xfc36,0x130));var _0x6fc3=function(_0x117a07,_0x4ff9d7){_0x117a07=_0x117a07-0x0;var _0x161d7c=_0xfc36[_0x117a07];return _0x161d7c;};'use strict';var multer=require('multer');var util=require(_0x6fc3('0x0'));var path=require(_0x6fc3('0x1'));var timeout=require('connect-timeout');var express=require(_0x6fc3('0x2'));var router=express[_0x6fc3('0x3')]();var fs_extra=require(_0x6fc3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6fc3('0x5'));var config=require(_0x6fc3('0x6'));var controller=require(_0x6fc3('0x7'));router[_0x6fc3('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fc3('0x9')]);router[_0x6fc3('0x8')](_0x6fc3('0xa'),auth['isAuthenticated'](),controller[_0x6fc3('0xb')]);router['post']('/',auth[_0x6fc3('0xc')](),controller[_0x6fc3('0xd')]);router[_0x6fc3('0xe')](_0x6fc3('0xa'),auth[_0x6fc3('0xc')](),controller['update']);router[_0x6fc3('0xf')]('/:id',auth[_0x6fc3('0xc')](),controller[_0x6fc3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9e63=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x9e63,0x1e7));var _0x39e6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x9e63[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var path=require(_0x39e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x39e6('0x3'));var router=express[_0x39e6('0x4')]();var fs_extra=require(_0x39e6('0x5'));var auth=require(_0x39e6('0x6'));var interaction=require(_0x39e6('0x7'));var config=require(_0x39e6('0x8'));var controller=require(_0x39e6('0x9'));router[_0x39e6('0xa')]('/',auth['isAuthenticated'](),controller[_0x39e6('0xb')]);router['get'](_0x39e6('0xc'),auth[_0x39e6('0xd')](),controller[_0x39e6('0xe')]);router['post']('/',auth[_0x39e6('0xd')](),controller['create']);router[_0x39e6('0xf')]('/:id',auth[_0x39e6('0xd')](),controller[_0x39e6('0x10')]);router[_0x39e6('0x11')](_0x39e6('0xc'),auth['isAuthenticated'](),controller[_0x39e6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a70033e..30184e2 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 _0x29c0=['picklist','string','STRING','ENUM','sequelize','variable','customVariable'];(function(_0x5632bf,_0x4f5c8d){var _0x41e9dd=function(_0x52344b){while(--_0x52344b){_0x5632bf['push'](_0x5632bf['shift']());}};_0x41e9dd(++_0x4f5c8d);}(_0x29c0,0x1e0));var _0x029c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x29c0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x029c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x029c('0x1'),_0x029c('0x2'),'keyValue',_0x029c('0x3')),'defaultValue':_0x029c('0x4')},'content':{'type':Sequelize[_0x029c('0x5')]},'key':{'type':Sequelize[_0x029c('0x5')]},'keyType':{'type':Sequelize[_0x029c('0x6')](_0x029c('0x4'),_0x029c('0x1'),_0x029c('0x2'))},'keyContent':{'type':Sequelize[_0x029c('0x5')]},'idField':{'type':Sequelize[_0x029c('0x5')]},'nameField':{'type':Sequelize[_0x029c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x029c('0x5')]}}; \ No newline at end of file +var _0x38c0=['variable','keyValue','picklist','STRING','customVariable','sequelize','ENUM','string'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x38c0,0x1dd));var _0x038c=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x38c0[_0x45ae0d];return _0x371826;};'use strict';var Sequelize=require(_0x038c('0x0'));module['exports']={'type':{'type':Sequelize[_0x038c('0x1')](_0x038c('0x2'),_0x038c('0x3'),'customVariable',_0x038c('0x4'),_0x038c('0x5')),'defaultValue':_0x038c('0x2')},'content':{'type':Sequelize[_0x038c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x038c('0x1')]('string','variable',_0x038c('0x7'))},'keyContent':{'type':Sequelize[_0x038c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7e43de5..a6b6e42 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 _0x20cc=['pick','filter','merge','map','VIRTUAL','ZohoField','includeAll','findAll','catch','show','params','fields','include','options','find','create','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x5c9317,_0x38bba4){var _0x50ccb4=function(_0x467423){while(--_0x467423){_0x5c9317['push'](_0x5c9317['shift']());}};_0x50ccb4(++_0x38bba4);}(_0x20cc,0x196));var _0xc20c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x20cc[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0xc20c('0x0'));var rimraf=require(_0xc20c('0x1'));var zipdir=require(_0xc20c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc20c('0x3'));var moment=require(_0xc20c('0x4'));var BPromise=require(_0xc20c('0x5'));var Mustache=require(_0xc20c('0x6'));var util=require(_0xc20c('0x7'));var path=require(_0xc20c('0x8'));var sox=require(_0xc20c('0x9'));var csv=require(_0xc20c('0xa'));var ejs=require(_0xc20c('0xb'));var fs=require('fs');var fs_extra=require(_0xc20c('0xc'));var _=require(_0xc20c('0xd'));var squel=require(_0xc20c('0xe'));var crypto=require('crypto');var jsforce=require(_0xc20c('0xf'));var deskjs=require(_0xc20c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc20c('0x11'));var Papa=require(_0xc20c('0x12'));var Redis=require('ioredis');var authService=require(_0xc20c('0x13'));var qs=require(_0xc20c('0x14'));var as=require(_0xc20c('0x15'));var hardwareService=require(_0xc20c('0x16'));var logger=require(_0xc20c('0x17'))('api');var utils=require(_0xc20c('0x18'));var config=require(_0xc20c('0x19'));var licenseUtil=require(_0xc20c('0x1a'));var db=require(_0xc20c('0x1b'))['db'];function respondWithStatusCode(_0xde552,_0x474fe5){_0x474fe5=_0x474fe5||0xcc;return function(_0xb7b6d6){if(_0xb7b6d6){return _0xde552[_0xc20c('0x1c')](_0x474fe5);}return _0xde552[_0xc20c('0x1d')](_0x474fe5)['end']();};}function respondWithResult(_0x155c0b,_0x57b37c){_0x57b37c=_0x57b37c||0xc8;return function(_0x25c8c5){if(_0x25c8c5){return _0x155c0b[_0xc20c('0x1d')](_0x57b37c)[_0xc20c('0x1e')](_0x25c8c5);}};}function respondWithFilteredResult(_0x74ceee,_0xc41e74){return function(_0x1649c2){if(_0x1649c2){var _0x325dd0=typeof _0xc41e74[_0xc20c('0x1f')]===_0xc20c('0x20')&&typeof _0xc41e74[_0xc20c('0x21')]==='undefined';var _0x3d7a41=_0x1649c2[_0xc20c('0x22')];var _0x4893a9=_0x325dd0?0x0:_0xc41e74[_0xc20c('0x1f')];var _0x31e740=_0x325dd0?_0x1649c2['count']:_0xc41e74['offset']+_0xc41e74[_0xc20c('0x21')];var _0x4aa423;if(_0x31e740>=_0x3d7a41){_0x31e740=_0x3d7a41;_0x4aa423=0xc8;}else{_0x4aa423=0xce;}_0x74ceee['status'](_0x4aa423);return _0x74ceee[_0xc20c('0x23')]('Content-Range',_0x4893a9+'-'+_0x31e740+'/'+_0x3d7a41)[_0xc20c('0x1e')](_0x1649c2);}return null;};}function patchUpdates(_0x450394){return function(_0x243a59){try{jsonpatch['apply'](_0x243a59,_0x450394,!![]);}catch(_0x277718){return BPromise[_0xc20c('0x24')](_0x277718);}return _0x243a59[_0xc20c('0x25')]();};}function saveUpdates(_0x4021fc,_0x19f685){return function(_0x4ec035){if(_0x4ec035){return _0x4ec035[_0xc20c('0x26')](_0x4021fc)[_0xc20c('0x27')](function(_0x2e0506){return _0x2e0506;});}return null;};}function removeEntity(_0x140adf,_0x4f46bb){return function(_0x6a9e5b){if(_0x6a9e5b){return _0x6a9e5b[_0xc20c('0x28')]()[_0xc20c('0x27')](function(){_0x140adf['status'](0xcc)[_0xc20c('0x29')]();});}};}function handleEntityNotFound(_0x145b68,_0x55c66a){return function(_0x39386e){if(!_0x39386e){_0x145b68['sendStatus'](0x194);}return _0x39386e;};}function handleError(_0x29bd16,_0xa55d11){_0xa55d11=_0xa55d11||0x1f4;return function(_0x22f124){logger[_0xc20c('0x2a')](_0x22f124[_0xc20c('0x2b')]);if(_0x22f124[_0xc20c('0x2c')]){delete _0x22f124['name'];}_0x29bd16[_0xc20c('0x1d')](_0xa55d11)['send'](_0x22f124);};}exports[_0xc20c('0x2d')]=function(_0x4b3943,_0x2b35ca){var _0x30a50b={},_0xac2aea={},_0x2c7a01={'count':0x0,'rows':[]};var _0x14951e=_['map'](db['ZohoField'][_0xc20c('0x2e')],function(_0x4e3045){return{'name':_0x4e3045[_0xc20c('0x2f')],'type':_0x4e3045[_0xc20c('0x30')][_0xc20c('0x31')]};});_0xac2aea[_0xc20c('0x32')]=_['map'](_0x14951e,'name');_0xac2aea['query']=_[_0xc20c('0x33')](_0x4b3943[_0xc20c('0x34')]);_0xac2aea['filters']=_[_0xc20c('0x35')](_0xac2aea[_0xc20c('0x32')],_0xac2aea['query']);_0x30a50b[_0xc20c('0x36')]=_[_0xc20c('0x35')](_0xac2aea['model'],qs['fields'](_0x4b3943['query']['fields']));_0x30a50b[_0xc20c('0x36')]=_0x30a50b[_0xc20c('0x36')][_0xc20c('0x37')]?_0x30a50b[_0xc20c('0x36')]:_0xac2aea[_0xc20c('0x32')];if(!_0x4b3943['query'][_0xc20c('0x38')](_0xc20c('0x39'))){_0x30a50b['limit']=qs[_0xc20c('0x21')](_0x4b3943['query']['limit']);_0x30a50b[_0xc20c('0x1f')]=qs[_0xc20c('0x1f')](_0x4b3943[_0xc20c('0x34')][_0xc20c('0x1f')]);}_0x30a50b[_0xc20c('0x3a')]=qs['sort'](_0x4b3943[_0xc20c('0x34')][_0xc20c('0x3b')]);_0x30a50b[_0xc20c('0x3c')]=qs[_0xc20c('0x3d')](_[_0xc20c('0x3e')](_0x4b3943[_0xc20c('0x34')],_0xac2aea[_0xc20c('0x3d')]),_0x14951e);if(_0x4b3943[_0xc20c('0x34')][_0xc20c('0x3f')]){_0x30a50b[_0xc20c('0x3c')]=_[_0xc20c('0x40')](_0x30a50b['where'],{'$or':_[_0xc20c('0x41')](_0x14951e,function(_0x140e89){if(_0x140e89[_0xc20c('0x30')]!==_0xc20c('0x42')){var _0x9225cb={};_0x9225cb[_0x140e89[_0xc20c('0x2c')]]={'$like':'%'+_0x4b3943['query'][_0xc20c('0x3f')]+'%'};return _0x9225cb;}})});}_0x30a50b=_[_0xc20c('0x40')]({},_0x30a50b,_0x4b3943['options']);var _0x1c2612={'where':_0x30a50b[_0xc20c('0x3c')]};return db[_0xc20c('0x43')][_0xc20c('0x22')](_0x1c2612)[_0xc20c('0x27')](function(_0x410d74){_0x2c7a01[_0xc20c('0x22')]=_0x410d74;if(_0x4b3943[_0xc20c('0x34')][_0xc20c('0x44')]){_0x30a50b['include']=[{'all':!![]}];}return db[_0xc20c('0x43')][_0xc20c('0x45')](_0x30a50b);})['then'](function(_0x498ece){_0x2c7a01['rows']=_0x498ece;return _0x2c7a01;})[_0xc20c('0x27')](respondWithFilteredResult(_0x2b35ca,_0x30a50b))[_0xc20c('0x46')](handleError(_0x2b35ca,null));};exports[_0xc20c('0x47')]=function(_0x29cf08,_0x5dac84){var _0x139d72={'raw':!![],'where':{'id':_0x29cf08[_0xc20c('0x48')]['id']}},_0xff3839={};_0xff3839[_0xc20c('0x32')]=_[_0xc20c('0x33')](db[_0xc20c('0x43')]['rawAttributes']);_0xff3839[_0xc20c('0x34')]=_['keys'](_0x29cf08[_0xc20c('0x34')]);_0xff3839['filters']=_[_0xc20c('0x35')](_0xff3839['model'],_0xff3839[_0xc20c('0x34')]);_0x139d72['attributes']=_[_0xc20c('0x35')](_0xff3839['model'],qs[_0xc20c('0x49')](_0x29cf08[_0xc20c('0x34')][_0xc20c('0x49')]));_0x139d72[_0xc20c('0x36')]=_0x139d72[_0xc20c('0x36')][_0xc20c('0x37')]?_0x139d72[_0xc20c('0x36')]:_0xff3839['model'];if(_0x29cf08['query'][_0xc20c('0x44')]){_0x139d72[_0xc20c('0x4a')]=[{'all':!![]}];}_0x139d72=_[_0xc20c('0x40')]({},_0x139d72,_0x29cf08[_0xc20c('0x4b')]);return db[_0xc20c('0x43')][_0xc20c('0x4c')](_0x139d72)['then'](handleEntityNotFound(_0x5dac84,null))[_0xc20c('0x27')](respondWithResult(_0x5dac84,null))[_0xc20c('0x46')](handleError(_0x5dac84,null));};exports[_0xc20c('0x4d')]=function(_0x468381,_0x5ee635){return db[_0xc20c('0x43')][_0xc20c('0x4d')](_0x468381['body'],{})[_0xc20c('0x27')](respondWithResult(_0x5ee635,0xc9))[_0xc20c('0x46')](handleError(_0x5ee635,null));};exports[_0xc20c('0x26')]=function(_0x35df8f,_0x24ece1){if(_0x35df8f['body']['id']){delete _0x35df8f['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x35df8f[_0xc20c('0x48')]['id']}})[_0xc20c('0x27')](handleEntityNotFound(_0x24ece1,null))[_0xc20c('0x27')](saveUpdates(_0x35df8f['body'],null))[_0xc20c('0x27')](respondWithResult(_0x24ece1,null))[_0xc20c('0x46')](handleError(_0x24ece1,null));};exports[_0xc20c('0x28')]=function(_0x157380,_0x511ffa){return db[_0xc20c('0x43')]['find']({'where':{'id':_0x157380['params']['id']}})[_0xc20c('0x27')](handleEntityNotFound(_0x511ffa,null))[_0xc20c('0x27')](removeEntity(_0x511ffa,null))['catch'](handleError(_0x511ffa,null));}; \ No newline at end of file +var _0x595d=['include','findAll','catch','show','params','model','create','body','find','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x595d,0x1ef));var _0xd595=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x595d[_0x5401ae];return _0x286068;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd595('0x0'));var zipdir=require(_0xd595('0x1'));var jsonpatch=require(_0xd595('0x2'));var rp=require(_0xd595('0x3'));var moment=require('moment');var BPromise=require(_0xd595('0x4'));var Mustache=require(_0xd595('0x5'));var util=require(_0xd595('0x6'));var path=require(_0xd595('0x7'));var sox=require(_0xd595('0x8'));var csv=require(_0xd595('0x9'));var ejs=require(_0xd595('0xa'));var fs=require('fs');var fs_extra=require(_0xd595('0xb'));var _=require(_0xd595('0xc'));var squel=require(_0xd595('0xd'));var crypto=require(_0xd595('0xe'));var jsforce=require(_0xd595('0xf'));var deskjs=require(_0xd595('0x10'));var toCsv=require(_0xd595('0x9'));var querystring=require(_0xd595('0x11'));var Papa=require('papaparse');var Redis=require(_0xd595('0x12'));var authService=require(_0xd595('0x13'));var qs=require(_0xd595('0x14'));var as=require(_0xd595('0x15'));var hardwareService=require(_0xd595('0x16'));var logger=require(_0xd595('0x17'))(_0xd595('0x18'));var utils=require(_0xd595('0x19'));var config=require(_0xd595('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd595('0x1b'))['db'];function respondWithStatusCode(_0x23588b,_0x2b6967){_0x2b6967=_0x2b6967||0xcc;return function(_0xf1414d){if(_0xf1414d){return _0x23588b['sendStatus'](_0x2b6967);}return _0x23588b[_0xd595('0x1c')](_0x2b6967)['end']();};}function respondWithResult(_0x5c82fa,_0x3122a2){_0x3122a2=_0x3122a2||0xc8;return function(_0x417712){if(_0x417712){return _0x5c82fa[_0xd595('0x1c')](_0x3122a2)[_0xd595('0x1d')](_0x417712);}};}function respondWithFilteredResult(_0x12d55f,_0x1921e3){return function(_0x57cacd){if(_0x57cacd){var _0x2a6054=typeof _0x1921e3[_0xd595('0x1e')]===_0xd595('0x1f')&&typeof _0x1921e3[_0xd595('0x20')]===_0xd595('0x1f');var _0x3fc887=_0x57cacd[_0xd595('0x21')];var _0x5f372d=_0x2a6054?0x0:_0x1921e3[_0xd595('0x1e')];var _0x586bd4=_0x2a6054?_0x57cacd[_0xd595('0x21')]:_0x1921e3[_0xd595('0x1e')]+_0x1921e3['limit'];var _0xef55c4;if(_0x586bd4>=_0x3fc887){_0x586bd4=_0x3fc887;_0xef55c4=0xc8;}else{_0xef55c4=0xce;}_0x12d55f[_0xd595('0x1c')](_0xef55c4);return _0x12d55f[_0xd595('0x22')](_0xd595('0x23'),_0x5f372d+'-'+_0x586bd4+'/'+_0x3fc887)[_0xd595('0x1d')](_0x57cacd);}return null;};}function patchUpdates(_0x2de289){return function(_0x3e6771){try{jsonpatch['apply'](_0x3e6771,_0x2de289,!![]);}catch(_0x985c72){return BPromise[_0xd595('0x24')](_0x985c72);}return _0x3e6771[_0xd595('0x25')]();};}function saveUpdates(_0x464fcc,_0x1a8bc0){return function(_0x1e291c){if(_0x1e291c){return _0x1e291c[_0xd595('0x26')](_0x464fcc)[_0xd595('0x27')](function(_0x39fddb){return _0x39fddb;});}return null;};}function removeEntity(_0x2fc4d1,_0x38386d){return function(_0x31b938){if(_0x31b938){return _0x31b938[_0xd595('0x28')]()[_0xd595('0x27')](function(){_0x2fc4d1[_0xd595('0x1c')](0xcc)[_0xd595('0x29')]();});}};}function handleEntityNotFound(_0x1c77d0,_0x24a18c){return function(_0x5341ba){if(!_0x5341ba){_0x1c77d0[_0xd595('0x2a')](0x194);}return _0x5341ba;};}function handleError(_0x843fc7,_0x5bc486){_0x5bc486=_0x5bc486||0x1f4;return function(_0x3d81dd){logger[_0xd595('0x2b')](_0x3d81dd[_0xd595('0x2c')]);if(_0x3d81dd['name']){delete _0x3d81dd[_0xd595('0x2d')];}_0x843fc7[_0xd595('0x1c')](_0x5bc486)[_0xd595('0x2e')](_0x3d81dd);};}exports[_0xd595('0x2f')]=function(_0x21c808,_0x12848e){var _0x57a938={},_0x3c8373={},_0x2259a8={'count':0x0,'rows':[]};var _0x4eb23f=_['map'](db[_0xd595('0x30')][_0xd595('0x31')],function(_0x587904){return{'name':_0x587904[_0xd595('0x32')],'type':_0x587904[_0xd595('0x33')][_0xd595('0x34')]};});_0x3c8373['model']=_[_0xd595('0x35')](_0x4eb23f,_0xd595('0x2d'));_0x3c8373[_0xd595('0x36')]=_[_0xd595('0x37')](_0x21c808[_0xd595('0x36')]);_0x3c8373['filters']=_[_0xd595('0x38')](_0x3c8373['model'],_0x3c8373['query']);_0x57a938[_0xd595('0x39')]=_[_0xd595('0x38')](_0x3c8373['model'],qs['fields'](_0x21c808[_0xd595('0x36')][_0xd595('0x3a')]));_0x57a938[_0xd595('0x39')]=_0x57a938[_0xd595('0x39')][_0xd595('0x3b')]?_0x57a938['attributes']:_0x3c8373['model'];if(!_0x21c808['query'][_0xd595('0x3c')](_0xd595('0x3d'))){_0x57a938[_0xd595('0x20')]=qs[_0xd595('0x20')](_0x21c808[_0xd595('0x36')][_0xd595('0x20')]);_0x57a938[_0xd595('0x1e')]=qs['offset'](_0x21c808['query'][_0xd595('0x1e')]);}_0x57a938[_0xd595('0x3e')]=qs['sort'](_0x21c808[_0xd595('0x36')][_0xd595('0x3f')]);_0x57a938[_0xd595('0x40')]=qs[_0xd595('0x41')](_[_0xd595('0x42')](_0x21c808[_0xd595('0x36')],_0x3c8373[_0xd595('0x41')]),_0x4eb23f);if(_0x21c808[_0xd595('0x36')][_0xd595('0x43')]){_0x57a938[_0xd595('0x40')]=_[_0xd595('0x44')](_0x57a938['where'],{'$or':_[_0xd595('0x35')](_0x4eb23f,function(_0x245744){if(_0x245744[_0xd595('0x33')]!==_0xd595('0x45')){var _0x39e97a={};_0x39e97a[_0x245744[_0xd595('0x2d')]]={'$like':'%'+_0x21c808[_0xd595('0x36')][_0xd595('0x43')]+'%'};return _0x39e97a;}})});}_0x57a938=_[_0xd595('0x44')]({},_0x57a938,_0x21c808[_0xd595('0x46')]);var _0x4e2722={'where':_0x57a938['where']};return db[_0xd595('0x30')][_0xd595('0x21')](_0x4e2722)[_0xd595('0x27')](function(_0x59bbfd){_0x2259a8[_0xd595('0x21')]=_0x59bbfd;if(_0x21c808['query'][_0xd595('0x47')]){_0x57a938[_0xd595('0x48')]=[{'all':!![]}];}return db['ZohoField'][_0xd595('0x49')](_0x57a938);})['then'](function(_0x3a27ef){_0x2259a8['rows']=_0x3a27ef;return _0x2259a8;})['then'](respondWithFilteredResult(_0x12848e,_0x57a938))[_0xd595('0x4a')](handleError(_0x12848e,null));};exports[_0xd595('0x4b')]=function(_0xb783cc,_0x5c71c2){var _0x4e9a5e={'raw':!![],'where':{'id':_0xb783cc[_0xd595('0x4c')]['id']}},_0x73b8e0={};_0x73b8e0[_0xd595('0x4d')]=_[_0xd595('0x37')](db[_0xd595('0x30')]['rawAttributes']);_0x73b8e0[_0xd595('0x36')]=_[_0xd595('0x37')](_0xb783cc[_0xd595('0x36')]);_0x73b8e0[_0xd595('0x41')]=_[_0xd595('0x38')](_0x73b8e0['model'],_0x73b8e0['query']);_0x4e9a5e[_0xd595('0x39')]=_[_0xd595('0x38')](_0x73b8e0[_0xd595('0x4d')],qs['fields'](_0xb783cc['query'][_0xd595('0x3a')]));_0x4e9a5e['attributes']=_0x4e9a5e[_0xd595('0x39')][_0xd595('0x3b')]?_0x4e9a5e[_0xd595('0x39')]:_0x73b8e0['model'];if(_0xb783cc[_0xd595('0x36')][_0xd595('0x47')]){_0x4e9a5e['include']=[{'all':!![]}];}_0x4e9a5e=_['merge']({},_0x4e9a5e,_0xb783cc[_0xd595('0x46')]);return db[_0xd595('0x30')]['find'](_0x4e9a5e)[_0xd595('0x27')](handleEntityNotFound(_0x5c71c2,null))[_0xd595('0x27')](respondWithResult(_0x5c71c2,null))['catch'](handleError(_0x5c71c2,null));};exports[_0xd595('0x4e')]=function(_0x24f260,_0x7fe03d){return db[_0xd595('0x30')][_0xd595('0x4e')](_0x24f260[_0xd595('0x4f')],{})[_0xd595('0x27')](respondWithResult(_0x7fe03d,0xc9))['catch'](handleError(_0x7fe03d,null));};exports['update']=function(_0x5c152d,_0x1d78e4){if(_0x5c152d[_0xd595('0x4f')]['id']){delete _0x5c152d[_0xd595('0x4f')]['id'];}return db[_0xd595('0x30')][_0xd595('0x50')]({'where':{'id':_0x5c152d['params']['id']}})[_0xd595('0x27')](handleEntityNotFound(_0x1d78e4,null))[_0xd595('0x27')](saveUpdates(_0x5c152d[_0xd595('0x4f')],null))['then'](respondWithResult(_0x1d78e4,null))['catch'](handleError(_0x1d78e4,null));};exports[_0xd595('0x28')]=function(_0x319460,_0x521484){return db[_0xd595('0x30')][_0xd595('0x50')]({'where':{'id':_0x319460[_0xd595('0x4c')]['id']}})['then'](handleEntityNotFound(_0x521484,null))[_0xd595('0x27')](removeEntity(_0x521484,null))['catch'](handleError(_0x521484,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 8aad836..3fd4080 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 _0x5496=['moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x5496,0x175));var _0x6549=function(_0x38f03d,_0x45acf7){_0x38f03d=_0x38f03d-0x0;var _0x33e2e6=_0x5496[_0x38f03d];return _0x33e2e6;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('ZohoField',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['bluebird','rimraf','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1970d5,_0x1df569){var _0x26f657=function(_0x380a38){while(--_0x380a38){_0x1970d5['push'](_0x1970d5['shift']());}};_0x26f657(++_0x1df569);}(_0x5430,0x10c));var _0x0543=function(_0x4dc594,_0x5532e0){_0x4dc594=_0x4dc594-0x0;var _0x2412ba=_0x5430[_0x4dc594];return _0x2412ba;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x0543('0x7')]=function(_0x45b909,_0x9754ba){return _0x45b909[_0x0543('0x8')](_0x0543('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0543('0xa'),'fields':[_0x0543('0xb'),_0x0543('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 59afb51..e07d069 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 _0x8027=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x24ebd0,_0x5a83f8){var _0x333eea=function(_0x4c2398){while(--_0x4c2398){_0x24ebd0['push'](_0x24ebd0['shift']());}};_0x333eea(++_0x5a83f8);}(_0x8027,0x1e5));var _0x7802=function(_0x3b0598,_0x15100f){_0x3b0598=_0x3b0598-0x0;var _0x5e2198=_0x8027[_0x3b0598];return _0x5e2198;};'use strict';var _=require(_0x7802('0x0'));var util=require('util');var moment=require(_0x7802('0x1'));var BPromise=require('bluebird');var rs=require(_0x7802('0x2'));var fs=require('fs');var Redis=require(_0x7802('0x3'));var db=require(_0x7802('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7802('0x5'))(_0x7802('0x6'));var config=require(_0x7802('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7802('0x8')][_0x7802('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2459de,_0x9c6d69,_0x43a411){return new BPromise(function(_0x415d1a,_0x62c603){return client['request'](_0x2459de,_0x43a411)[_0x7802('0xa')](function(_0x1b7592){logger[_0x7802('0xb')](_0x7802('0xc'),_0x9c6d69,_0x7802('0xd'));logger[_0x7802('0xe')](_0x7802('0xf'),_0x9c6d69,_0x7802('0xd'),JSON['stringify'](_0x1b7592));if(_0x1b7592[_0x7802('0x10')]){if(_0x1b7592[_0x7802('0x10')][_0x7802('0x11')]===0x1f4){logger[_0x7802('0x10')](_0x7802('0xc'),_0x9c6d69,_0x1b7592[_0x7802('0x10')]['message']);return _0x62c603(_0x1b7592[_0x7802('0x10')]['message']);}logger['error'](_0x7802('0xc'),_0x9c6d69,_0x1b7592[_0x7802('0x10')][_0x7802('0x12')]);return _0x415d1a(_0x1b7592[_0x7802('0x10')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x9c6d69,_0x7802('0xd'));_0x415d1a(_0x1b7592[_0x7802('0x13')][_0x7802('0x12')]);}})[_0x7802('0x14')](function(_0x3903a6){logger[_0x7802('0x10')](_0x7802('0xc'),_0x9c6d69,_0x3903a6);_0x62c603(_0x3903a6);});});} \ No newline at end of file +var _0x4626=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xcb57c6,_0xdce12d){var _0x586644=function(_0x31bcb4){while(--_0x31bcb4){_0xcb57c6['push'](_0xcb57c6['shift']());}};_0x586644(++_0xdce12d);}(_0x4626,0x162));var _0x6462=function(_0x4fe583,_0x51731a){_0x4fe583=_0x4fe583-0x0;var _0x2e8f78=_0x4626[_0x4fe583];return _0x2e8f78;};'use strict';var _=require('lodash');var util=require(_0x6462('0x0'));var moment=require(_0x6462('0x1'));var BPromise=require(_0x6462('0x2'));var rs=require(_0x6462('0x3'));var fs=require('fs');var Redis=require(_0x6462('0x4'));var db=require(_0x6462('0x5'))['db'];var utils=require(_0x6462('0x6'));var logger=require(_0x6462('0x7'))(_0x6462('0x8'));var config=require(_0x6462('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5311f8,_0x31f21f,_0x40382a){return new BPromise(function(_0x92b737,_0x32b178){return client[_0x6462('0xb')](_0x5311f8,_0x40382a)[_0x6462('0xc')](function(_0x499e02){logger[_0x6462('0xd')](_0x6462('0xe'),_0x31f21f,_0x6462('0xf'));logger[_0x6462('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x31f21f,_0x6462('0xf'),JSON['stringify'](_0x499e02));if(_0x499e02[_0x6462('0x11')]){if(_0x499e02[_0x6462('0x11')][_0x6462('0x12')]===0x1f4){logger[_0x6462('0x11')](_0x6462('0xe'),_0x31f21f,_0x499e02[_0x6462('0x11')]['message']);return _0x32b178(_0x499e02['error'][_0x6462('0x13')]);}logger[_0x6462('0x11')]('ZohoField,\x20%s,\x20%s',_0x31f21f,_0x499e02[_0x6462('0x11')]['message']);return _0x92b737(_0x499e02[_0x6462('0x11')][_0x6462('0x13')]);}else{logger[_0x6462('0xd')]('ZohoField,\x20%s,\x20%s',_0x31f21f,_0x6462('0xf'));_0x92b737(_0x499e02[_0x6462('0x14')][_0x6462('0x13')]);}})[_0x6462('0x15')](function(_0x3c5042){logger['error'](_0x6462('0xe'),_0x31f21f,_0x3c5042);_0x32b178(_0x3c5042);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 545a10e..96aa684 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x583826,_0x1d353d){var _0x5b3c41=function(_0x24ff05){while(--_0x24ff05){_0x583826['push'](_0x583826['shift']());}};_0x5b3c41(++_0x1d353d);}(_0xedd9,0xfc));var _0x9edd=function(_0x457a50,_0x241546){_0x457a50=_0x457a50-0x0;var _0x399553=_0xedd9[_0x457a50];return _0x399553;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xcf9676,_0x57b32f){var _0x81ec5b=function(_0x2b72af){while(--_0x2b72af){_0xcf9676['push'](_0xcf9676['shift']());}};_0x81ec5b(++_0x57b32f);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index dab17b8..4a0b9f8 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 _0xd909=['state','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x546c92,_0x165c9f){var _0x55ca41=function(_0x23f5b5){while(--_0x23f5b5){_0x546c92['push'](_0x546c92['shift']());}};_0x55ca41(++_0x165c9f);}(_0xd909,0x1c1));var _0x9d90=function(_0x1e39e7,_0x2021d7){_0x1e39e7=_0x1e39e7-0x0;var _0x53153d=_0xd909[_0x1e39e7];return _0x53153d;};'use strict';var Sequelize=require('sequelize');module[_0x9d90('0x0')]={'name':{'type':Sequelize[_0x9d90('0x1')],'allowNull':![],'unique':_0x9d90('0x2')},'version':{'type':Sequelize[_0x9d90('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9d90('0x1')],'defaultValue':_0x9d90('0x3')},'filename':{'type':Sequelize[_0x9d90('0x1')]},'path':{'type':Sequelize[_0x9d90('0x1')]},'type':{'type':Sequelize[_0x9d90('0x1')]},'size':{'type':Sequelize[_0x9d90('0x4')]},'active':{'type':Sequelize[_0x9d90('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9d90('0x1')]},'state':{'type':Sequelize[_0x9d90('0x1')],'unique':_0x9d90('0x6')},'description':{'type':Sequelize[_0x9d90('0x1')]},'title':{'type':Sequelize[_0x9d90('0x1')]},'remoteUri':{'type':Sequelize[_0x9d90('0x1')]},'link':{'type':Sequelize[_0x9d90('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc720=['STRING','unique_name_and_version','app.js','BOOLEAN','sequelize','exports'];(function(_0x25738b,_0x4c5218){var _0x4a8d51=function(_0x248081){while(--_0x248081){_0x25738b['push'](_0x25738b['shift']());}};_0x4a8d51(++_0x4c5218);}(_0xc720,0x118));var _0x0c72=function(_0x27fc46,_0x2b85a4){_0x27fc46=_0x27fc46-0x0;var _0x3627f6=_0xc720[_0x27fc46];return _0x3627f6;};'use strict';var Sequelize=require(_0x0c72('0x0'));module[_0x0c72('0x1')]={'name':{'type':Sequelize[_0x0c72('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x0c72('0x2')],'allowNull':![],'unique':_0x0c72('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x0c72('0x4')},'filename':{'type':Sequelize[_0x0c72('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0c72('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0c72('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0c72('0x2')]},'state':{'type':Sequelize[_0x0c72('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x0c72('0x2')]},'title':{'type':Sequelize[_0x0c72('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0c72('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 3240039..05b102b 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 _0x524e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x524e,0x15e));var _0xe524=function(_0x1f7008,_0xe9e1b4){_0x1f7008=_0x1f7008-0x0;var _0x4299e3=_0x524e[_0x1f7008];return _0x4299e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['Integration'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['Integration'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));}; \ No newline at end of file +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(_0xf218a,_0x161195){var _0x557729=function(_0x4b39e7){while(--_0x4b39e7){_0xf218a['push'](_0xf218a['shift']());}};_0x557729(++_0x161195);}(_0x1883,0xab));var _0x3188=function(_0xf389d4,_0x1209ba){_0xf389d4=_0xf389d4-0x0;var _0x434d75=_0x1883[_0xf389d4];return _0x434d75;};'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 diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1ff2cb1..9206370 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 _0x8b43=['request-promise','path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b43,0x10f));var _0x38b4=function(_0x7c9f67,_0x58f50b){_0x7c9f67=_0x7c9f67-0x0;var _0x30f9cd=_0x8b43[_0x7c9f67];return _0x30f9cd;};'use strict';var _=require(_0x38b4('0x0'));var util=require(_0x38b4('0x1'));var logger=require(_0x38b4('0x2'))(_0x38b4('0x3'));var moment=require(_0x38b4('0x4'));var BPromise=require('bluebird');var rp=require(_0x38b4('0x5'));var fs=require('fs');var path=require(_0x38b4('0x6'));var rimraf=require('rimraf');var config=require(_0x38b4('0x7'));var attributes=require(_0x38b4('0x8'));module[_0x38b4('0x9')]=function(_0x537d8b,_0x25b816){return _0x537d8b['define'](_0x38b4('0xa'),attributes,{'tableName':_0x38b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cc7=['request-promise','rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2894d5,_0x159d6b){var _0x343dd7=function(_0x3ee396){while(--_0x3ee396){_0x2894d5['push'](_0x2894d5['shift']());}};_0x343dd7(++_0x159d6b);}(_0x6cc7,0xe2));var _0x76cc=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x6cc7[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x76cc('0x0'));var util=require(_0x76cc('0x1'));var logger=require(_0x76cc('0x2'))('api');var moment=require(_0x76cc('0x3'));var BPromise=require(_0x76cc('0x4'));var rp=require(_0x76cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76cc('0x6'));var config=require(_0x76cc('0x7'));var attributes=require(_0x76cc('0x8'));module[_0x76cc('0x9')]=function(_0x10aecb,_0x463830){return _0x10aecb['define'](_0x76cc('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 24308bd..d83a533 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(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xadb5,0xad));var _0x5adb=function(_0x142434,_0x4f6777){_0x142434=_0x142434-0x0;var _0x5d9efa=_0xadb5[_0x142434];return _0x5d9efa;};'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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x524e,0x15e));var _0xe524=function(_0x22b7e5,_0x29616a){_0x22b7e5=_0x22b7e5-0x0;var _0xc2327b=_0x524e[_0x22b7e5];return _0xc2327b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 938de9f..fd374a1 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x221808,_0x4e6ee5){var _0x26c697=function(_0x18e6df){while(--_0x18e6df){_0x221808['push'](_0x221808['shift']());}};_0x26c697(++_0x4e6ee5);}(_0x187d,0x93));var _0xd187=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x187d[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1f90c4,_0x5cd317){var _0x1ec983=function(_0x4a58a4){while(--_0x4a58a4){_0x1f90c4['push'](_0x1f90c4['shift']());}};_0x1ec983(++_0x5cd317);}(_0x955f,0x1eb));var _0xf955=function(_0x22626d,_0x26ef5){_0x22626d=_0x22626d-0x0;var _0x336bfb=_0x955f[_0x22626d];return _0x336bfb;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4eeac5d..22c0d66 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 _0x677c=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x677c,0x105));var _0xc677=function(_0x1b7edd,_0x4d074f){_0x1b7edd=_0x1b7edd-0x0;var _0x44679d=_0x677c[_0x1b7edd];return _0x44679d;};'use strict';var Sequelize=require(_0xc677('0x0'));module[_0xc677('0x1')]={'integration':{'type':Sequelize[_0xc677('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xc677('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xc677('0x3')]},'contacts':{'type':Sequelize[_0xc677('0x2')]},'uniqueid':{'type':Sequelize[_0xc677('0x2')]},'calleridnum':{'type':Sequelize[_0xc677('0x2')]},'calleridname':{'type':Sequelize[_0xc677('0x2')]},'queue':{'type':Sequelize[_0xc677('0x2')]},'interface':{'type':Sequelize[_0xc677('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc677('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc677('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc677('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc677('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc677('0x3')]},'reason':{'type':Sequelize[_0xc677('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc677('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc677('0x4')]},'agentdump':{'type':Sequelize[_0xc677('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc677('0x4')]},'lastevent':{'type':Sequelize[_0xc677('0x2')]},'channel':{'type':Sequelize[_0xc677('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc677('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc677('0x2')]},'connectedlinename':{'type':Sequelize[_0xc677('0x2')]},'language':{'type':Sequelize[_0xc677('0x2')]},'accountcode':{'type':Sequelize[_0xc677('0x2')]},'context':{'type':Sequelize[_0xc677('0x2')]},'exten':{'type':Sequelize[_0xc677('0x2')]},'priority':{'type':Sequelize[_0xc677('0x2')]},'destchannel':{'type':Sequelize[_0xc677('0x2')]},'destchannelstate':{'type':Sequelize[_0xc677('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc677('0x2')]},'destcalleridname':{'type':Sequelize[_0xc677('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc677('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc677('0x2')]},'destlanguage':{'type':Sequelize[_0xc677('0x2')]},'destaccountcode':{'type':Sequelize[_0xc677('0x2')]},'destcontext':{'type':Sequelize[_0xc677('0x2')]},'destexten':{'type':Sequelize[_0xc677('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc677('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc677('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xc677('0x6')]},'html':{'type':Sequelize[_0xc677('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xc677('0x7'),_0xc677('0x8'),'RECEIVED',_0xc677('0x9'))},'url':{'type':Sequelize[_0xc677('0x2')]},'app':{'type':Sequelize[_0xc677('0x2')]},'appdata':{'type':Sequelize[_0xc677('0x2')]},'projectId':{'type':Sequelize[_0xc677('0x3')]}}; \ No newline at end of file +var _0xffb9=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x1ae4a7,_0xf838d1){var _0x414bea=function(_0x5bb6a8){while(--_0x5bb6a8){_0x1ae4a7['push'](_0x1ae4a7['shift']());}};_0x414bea(++_0xf838d1);}(_0xffb9,0x9a));var _0x9ffb=function(_0x337ab0,_0x55e040){_0x337ab0=_0x337ab0-0x0;var _0x59153c=_0xffb9[_0x337ab0];return _0x59153c;};'use strict';var Sequelize=require(_0x9ffb('0x0'));module[_0x9ffb('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x9ffb('0x2')]},'exitStatus':{'type':Sequelize[_0x9ffb('0x2')]},'ticketId':{'type':Sequelize[_0x9ffb('0x2')]},'integrationId':{'type':Sequelize[_0x9ffb('0x3')]},'contacts':{'type':Sequelize[_0x9ffb('0x2')]},'uniqueid':{'type':Sequelize[_0x9ffb('0x2')]},'calleridnum':{'type':Sequelize[_0x9ffb('0x2')]},'calleridname':{'type':Sequelize[_0x9ffb('0x2')]},'queue':{'type':Sequelize[_0x9ffb('0x2')]},'interface':{'type':Sequelize[_0x9ffb('0x2')]},'membername':{'type':Sequelize[_0x9ffb('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9ffb('0x4')]},'agentconnectAt':{'type':Sequelize[_0x9ffb('0x4')]},'holdtime':{'type':Sequelize[_0x9ffb('0x3')]},'agentcomplete':{'type':Sequelize[_0x9ffb('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9ffb('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x9ffb('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9ffb('0x3')]},'reason':{'type':Sequelize[_0x9ffb('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x9ffb('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9ffb('0x4')]},'agentdump':{'type':Sequelize[_0x9ffb('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9ffb('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9ffb('0x2')]},'channelstate':{'type':Sequelize[_0x9ffb('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9ffb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9ffb('0x2')]},'connectedlinename':{'type':Sequelize[_0x9ffb('0x2')]},'language':{'type':Sequelize[_0x9ffb('0x2')]},'accountcode':{'type':Sequelize[_0x9ffb('0x2')]},'context':{'type':Sequelize[_0x9ffb('0x2')]},'exten':{'type':Sequelize[_0x9ffb('0x2')]},'priority':{'type':Sequelize[_0x9ffb('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9ffb('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9ffb('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9ffb('0x2')]},'destaccountcode':{'type':Sequelize[_0x9ffb('0x2')]},'destcontext':{'type':Sequelize[_0x9ffb('0x2')]},'destexten':{'type':Sequelize[_0x9ffb('0x2')]},'destpriority':{'type':Sequelize[_0x9ffb('0x2')]},'destuniqueid':{'type':Sequelize[_0x9ffb('0x2')]},'messageId':{'type':Sequelize[_0x9ffb('0x2')]},'inReplyTo':{'type':Sequelize[_0x9ffb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x9ffb('0x2')]},'to':{'type':Sequelize[_0x9ffb('0x2')]},'cc':{'type':Sequelize[_0x9ffb('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x9ffb('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x9ffb('0x7')](_0x9ffb('0x8'),_0x9ffb('0x9'),_0x9ffb('0xa'),'FAILED')},'url':{'type':Sequelize[_0x9ffb('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9ffb('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 663bcb0..8d9b10e 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 _0x9cdf=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','IntegrationReport','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','moment','mustache','path'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9cdf,0x1b1));var _0xf9cd=function(_0x3018a7,_0x387464){_0x3018a7=_0x3018a7-0x0;var _0x5696fa=_0x9cdf[_0x3018a7];return _0x5696fa;};'use strict';var emlformat=require(_0xf9cd('0x0'));var rimraf=require(_0xf9cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf9cd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf9cd('0x3'));var util=require('util');var path=require(_0xf9cd('0x4'));var sox=require(_0xf9cd('0x5'));var csv=require(_0xf9cd('0x6'));var ejs=require(_0xf9cd('0x7'));var fs=require('fs');var fs_extra=require(_0xf9cd('0x8'));var _=require(_0xf9cd('0x9'));var squel=require(_0xf9cd('0xa'));var crypto=require(_0xf9cd('0xb'));var jsforce=require(_0xf9cd('0xc'));var deskjs=require(_0xf9cd('0xd'));var toCsv=require(_0xf9cd('0x6'));var querystring=require(_0xf9cd('0xe'));var Papa=require('papaparse');var Redis=require(_0xf9cd('0xf'));var authService=require(_0xf9cd('0x10'));var qs=require(_0xf9cd('0x11'));var as=require(_0xf9cd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9cd('0x13'))(_0xf9cd('0x14'));var utils=require(_0xf9cd('0x15'));var config=require(_0xf9cd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9cd('0x17'))['db'];function respondWithStatusCode(_0x10596c,_0x52db24){_0x52db24=_0x52db24||0xcc;return function(_0x51baae){if(_0x51baae){return _0x10596c[_0xf9cd('0x18')](_0x52db24);}return _0x10596c[_0xf9cd('0x19')](_0x52db24)[_0xf9cd('0x1a')]();};}function respondWithResult(_0x27f71f,_0x1e764a){_0x1e764a=_0x1e764a||0xc8;return function(_0x14e90e){if(_0x14e90e){return _0x27f71f[_0xf9cd('0x19')](_0x1e764a)[_0xf9cd('0x1b')](_0x14e90e);}};}function respondWithFilteredResult(_0x3363c1,_0x5295b6){return function(_0x4d7dc1){if(_0x4d7dc1){var _0x55ed1b=typeof _0x5295b6[_0xf9cd('0x1c')]===_0xf9cd('0x1d')&&typeof _0x5295b6[_0xf9cd('0x1e')]===_0xf9cd('0x1d');var _0xe2108a=_0x4d7dc1[_0xf9cd('0x1f')];var _0x59cef1=_0x55ed1b?0x0:_0x5295b6['offset'];var _0x4beb6a=_0x55ed1b?_0x4d7dc1[_0xf9cd('0x1f')]:_0x5295b6['offset']+_0x5295b6['limit'];var _0x4b5adb;if(_0x4beb6a>=_0xe2108a){_0x4beb6a=_0xe2108a;_0x4b5adb=0xc8;}else{_0x4b5adb=0xce;}_0x3363c1[_0xf9cd('0x19')](_0x4b5adb);return _0x3363c1[_0xf9cd('0x20')](_0xf9cd('0x21'),_0x59cef1+'-'+_0x4beb6a+'/'+_0xe2108a)[_0xf9cd('0x1b')](_0x4d7dc1);}return null;};}function patchUpdates(_0x212eb6){return function(_0x4e8838){try{jsonpatch['apply'](_0x4e8838,_0x212eb6,!![]);}catch(_0x2e0136){return BPromise[_0xf9cd('0x22')](_0x2e0136);}return _0x4e8838[_0xf9cd('0x23')]();};}function saveUpdates(_0x3ffa12,_0x4b1983){return function(_0x37e8af){if(_0x37e8af){return _0x37e8af['update'](_0x3ffa12)[_0xf9cd('0x24')](function(_0x934251){return _0x934251;});}return null;};}function removeEntity(_0x580631,_0x499d2d){return function(_0x5c4ec7){if(_0x5c4ec7){return _0x5c4ec7[_0xf9cd('0x25')]()[_0xf9cd('0x24')](function(){_0x580631[_0xf9cd('0x19')](0xcc)[_0xf9cd('0x1a')]();});}};}function handleEntityNotFound(_0x368537,_0x468dd5){return function(_0x405b4e){if(!_0x405b4e){_0x368537['sendStatus'](0x194);}return _0x405b4e;};}function handleError(_0x14894e,_0x546575){_0x546575=_0x546575||0x1f4;return function(_0x2db5b5){logger[_0xf9cd('0x26')](_0x2db5b5['stack']);if(_0x2db5b5[_0xf9cd('0x27')]){delete _0x2db5b5[_0xf9cd('0x27')];}_0x14894e['status'](_0x546575)[_0xf9cd('0x28')](_0x2db5b5);};}exports['index']=function(_0x30cee3,_0x237fd4){var _0x51d01c={},_0x4bb0a5={},_0x31e001={'count':0x0,'rows':[]};var _0x25914a=_['map'](db[_0xf9cd('0x29')]['rawAttributes'],function(_0x2a459c){return{'name':_0x2a459c[_0xf9cd('0x2a')],'type':_0x2a459c[_0xf9cd('0x2b')]['key']};});_0x4bb0a5['model']=_[_0xf9cd('0x2c')](_0x25914a,_0xf9cd('0x27'));_0x4bb0a5['query']=_[_0xf9cd('0x2d')](_0x30cee3[_0xf9cd('0x2e')]);_0x4bb0a5[_0xf9cd('0x2f')]=_[_0xf9cd('0x30')](_0x4bb0a5[_0xf9cd('0x31')],_0x4bb0a5[_0xf9cd('0x2e')]);_0x51d01c[_0xf9cd('0x32')]=_[_0xf9cd('0x30')](_0x4bb0a5[_0xf9cd('0x31')],qs[_0xf9cd('0x33')](_0x30cee3[_0xf9cd('0x2e')]['fields']));_0x51d01c[_0xf9cd('0x32')]=_0x51d01c[_0xf9cd('0x32')]['length']?_0x51d01c[_0xf9cd('0x32')]:_0x4bb0a5[_0xf9cd('0x31')];if(!_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x34')]('nolimit')){_0x51d01c['limit']=qs[_0xf9cd('0x1e')](_0x30cee3[_0xf9cd('0x2e')]['limit']);_0x51d01c[_0xf9cd('0x1c')]=qs[_0xf9cd('0x1c')](_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x1c')]);}_0x51d01c[_0xf9cd('0x35')]=qs[_0xf9cd('0x36')](_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x36')]);_0x51d01c['where']=qs[_0xf9cd('0x2f')](_[_0xf9cd('0x37')](_0x30cee3['query'],_0x4bb0a5[_0xf9cd('0x2f')]),_0x25914a);if(_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x38')]){_0x51d01c[_0xf9cd('0x39')]=_['merge'](_0x51d01c[_0xf9cd('0x39')],{'$or':_[_0xf9cd('0x2c')](_0x25914a,function(_0x40fdf9){if(_0x40fdf9['type']!==_0xf9cd('0x3a')){var _0x413f1e={};_0x413f1e[_0x40fdf9[_0xf9cd('0x27')]]={'$like':'%'+_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x38')]+'%'};return _0x413f1e;}})});}_0x51d01c=_[_0xf9cd('0x3b')]({},_0x51d01c,_0x30cee3[_0xf9cd('0x3c')]);var _0x45fbe9={'where':_0x51d01c['where']};return db[_0xf9cd('0x29')][_0xf9cd('0x1f')](_0x45fbe9)[_0xf9cd('0x24')](function(_0x100740){_0x31e001['count']=_0x100740;if(_0x30cee3[_0xf9cd('0x2e')][_0xf9cd('0x3d')]){_0x51d01c['include']=[{'all':!![]}];}return db[_0xf9cd('0x29')][_0xf9cd('0x3e')](_0x51d01c);})[_0xf9cd('0x24')](function(_0x333736){_0x31e001[_0xf9cd('0x3f')]=_0x333736;return _0x31e001;})[_0xf9cd('0x24')](respondWithFilteredResult(_0x237fd4,_0x51d01c))[_0xf9cd('0x40')](handleError(_0x237fd4,null));};exports[_0xf9cd('0x41')]=function(_0x4272b6,_0xeed9f5){var _0x573dae={'raw':![],'where':{'id':_0x4272b6[_0xf9cd('0x42')]['id']}},_0x4655dd={};_0x4655dd[_0xf9cd('0x31')]=_['keys'](db[_0xf9cd('0x29')]['rawAttributes']);_0x4655dd['query']=_[_0xf9cd('0x2d')](_0x4272b6['query']);_0x4655dd[_0xf9cd('0x2f')]=_[_0xf9cd('0x30')](_0x4655dd['model'],_0x4655dd[_0xf9cd('0x2e')]);_0x573dae[_0xf9cd('0x32')]=_[_0xf9cd('0x30')](_0x4655dd['model'],qs[_0xf9cd('0x33')](_0x4272b6['query'][_0xf9cd('0x33')]));_0x573dae[_0xf9cd('0x32')]=_0x573dae['attributes']['length']?_0x573dae[_0xf9cd('0x32')]:_0x4655dd['model'];if(_0x4272b6[_0xf9cd('0x2e')][_0xf9cd('0x3d')]){_0x573dae[_0xf9cd('0x43')]=[{'all':!![]}];}_0x573dae=_['merge']({},_0x573dae,_0x4272b6[_0xf9cd('0x3c')]);return db[_0xf9cd('0x29')][_0xf9cd('0x44')](_0x573dae)[_0xf9cd('0x24')](handleEntityNotFound(_0xeed9f5,null))[_0xf9cd('0x24')](respondWithResult(_0xeed9f5,null))[_0xf9cd('0x40')](handleError(_0xeed9f5,null));};exports[_0xf9cd('0x45')]=function(_0x4c869a,_0x81d511){return db[_0xf9cd('0x29')][_0xf9cd('0x45')](_0x4c869a[_0xf9cd('0x46')],{})['then'](respondWithResult(_0x81d511,0xc9))[_0xf9cd('0x40')](handleError(_0x81d511,null));};exports[_0xf9cd('0x47')]=function(_0x59ac83,_0x459eff){if(_0x59ac83['body']['id']){delete _0x59ac83[_0xf9cd('0x46')]['id'];}return db[_0xf9cd('0x29')][_0xf9cd('0x44')]({'where':{'id':_0x59ac83[_0xf9cd('0x42')]['id']}})[_0xf9cd('0x24')](handleEntityNotFound(_0x459eff,null))[_0xf9cd('0x24')](saveUpdates(_0x59ac83[_0xf9cd('0x46')],null))['then'](respondWithResult(_0x459eff,null))[_0xf9cd('0x40')](handleError(_0x459eff,null));};exports['destroy']=function(_0x13e43d,_0x52714e){return db[_0xf9cd('0x29')][_0xf9cd('0x44')]({'where':{'id':_0x13e43d[_0xf9cd('0x42')]['id']}})[_0xf9cd('0x24')](handleEntityNotFound(_0x52714e,null))['then'](removeEntity(_0x52714e,null))[_0xf9cd('0x40')](handleError(_0x52714e,null));};exports[_0xf9cd('0x48')]=function(_0xd2c06d,_0x504d22){return db[_0xf9cd('0x29')][_0xf9cd('0x48')]()[_0xf9cd('0x24')](respondWithResult(_0x504d22,null))[_0xf9cd('0x40')](handleError(_0x504d22,null));}; \ No newline at end of file +var _0xf782=['intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf782,0x65));var _0x2f78=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0xf782[_0x1c30bf];return _0x255b5e;};'use strict';var emlformat=require(_0x2f78('0x0'));var rimraf=require(_0x2f78('0x1'));var zipdir=require(_0x2f78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f78('0x3'));var moment=require('moment');var BPromise=require(_0x2f78('0x4'));var Mustache=require('mustache');var util=require(_0x2f78('0x5'));var path=require(_0x2f78('0x6'));var sox=require(_0x2f78('0x7'));var csv=require(_0x2f78('0x8'));var ejs=require(_0x2f78('0x9'));var fs=require('fs');var fs_extra=require(_0x2f78('0xa'));var _=require(_0x2f78('0xb'));var squel=require(_0x2f78('0xc'));var crypto=require('crypto');var jsforce=require(_0x2f78('0xd'));var deskjs=require(_0x2f78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2f78('0xf'));var Papa=require('papaparse');var Redis=require(_0x2f78('0x10'));var authService=require(_0x2f78('0x11'));var qs=require(_0x2f78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f78('0x13'));var logger=require(_0x2f78('0x14'))(_0x2f78('0x15'));var utils=require(_0x2f78('0x16'));var config=require(_0x2f78('0x17'));var licenseUtil=require(_0x2f78('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d6cf,_0x25fdc1){_0x25fdc1=_0x25fdc1||0xcc;return function(_0x1c7531){if(_0x1c7531){return _0x44d6cf['sendStatus'](_0x25fdc1);}return _0x44d6cf[_0x2f78('0x19')](_0x25fdc1)[_0x2f78('0x1a')]();};}function respondWithResult(_0x4aa938,_0x4c1e32){_0x4c1e32=_0x4c1e32||0xc8;return function(_0x8c8278){if(_0x8c8278){return _0x4aa938[_0x2f78('0x19')](_0x4c1e32)[_0x2f78('0x1b')](_0x8c8278);}};}function respondWithFilteredResult(_0xbbae46,_0x5c5854){return function(_0x4005ff){if(_0x4005ff){var _0x1729b0=typeof _0x5c5854[_0x2f78('0x1c')]===_0x2f78('0x1d')&&typeof _0x5c5854[_0x2f78('0x1e')]===_0x2f78('0x1d');var _0xdf969b=_0x4005ff[_0x2f78('0x1f')];var _0x2aea63=_0x1729b0?0x0:_0x5c5854[_0x2f78('0x1c')];var _0xdd9a69=_0x1729b0?_0x4005ff[_0x2f78('0x1f')]:_0x5c5854[_0x2f78('0x1c')]+_0x5c5854[_0x2f78('0x1e')];var _0x2ef448;if(_0xdd9a69>=_0xdf969b){_0xdd9a69=_0xdf969b;_0x2ef448=0xc8;}else{_0x2ef448=0xce;}_0xbbae46['status'](_0x2ef448);return _0xbbae46['set'](_0x2f78('0x20'),_0x2aea63+'-'+_0xdd9a69+'/'+_0xdf969b)['json'](_0x4005ff);}return null;};}function patchUpdates(_0xc33910){return function(_0x35c76e){try{jsonpatch[_0x2f78('0x21')](_0x35c76e,_0xc33910,!![]);}catch(_0x2236ee){return BPromise[_0x2f78('0x22')](_0x2236ee);}return _0x35c76e['save']();};}function saveUpdates(_0xae3681,_0x275eba){return function(_0x5c353a){if(_0x5c353a){return _0x5c353a[_0x2f78('0x23')](_0xae3681)[_0x2f78('0x24')](function(_0x10bcc0){return _0x10bcc0;});}return null;};}function removeEntity(_0x2b8776,_0x1dbe0d){return function(_0x3d6680){if(_0x3d6680){return _0x3d6680[_0x2f78('0x25')]()['then'](function(){_0x2b8776[_0x2f78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33003e,_0x4feea3){return function(_0x24b1f4){if(!_0x24b1f4){_0x33003e[_0x2f78('0x26')](0x194);}return _0x24b1f4;};}function handleError(_0x82475,_0x3be409){_0x3be409=_0x3be409||0x1f4;return function(_0x564f0f){logger[_0x2f78('0x27')](_0x564f0f[_0x2f78('0x28')]);if(_0x564f0f['name']){delete _0x564f0f[_0x2f78('0x29')];}_0x82475[_0x2f78('0x19')](_0x3be409)['send'](_0x564f0f);};}exports[_0x2f78('0x2a')]=function(_0xe04eae,_0x45d0d5){var _0x2e5657={},_0x5e4972={},_0x3fc20f={'count':0x0,'rows':[]};var _0x17a2b5=_[_0x2f78('0x2b')](db[_0x2f78('0x2c')][_0x2f78('0x2d')],function(_0x3faea9){return{'name':_0x3faea9[_0x2f78('0x2e')],'type':_0x3faea9[_0x2f78('0x2f')][_0x2f78('0x30')]};});_0x5e4972['model']=_[_0x2f78('0x2b')](_0x17a2b5,'name');_0x5e4972[_0x2f78('0x31')]=_[_0x2f78('0x32')](_0xe04eae[_0x2f78('0x31')]);_0x5e4972['filters']=_[_0x2f78('0x33')](_0x5e4972['model'],_0x5e4972['query']);_0x2e5657[_0x2f78('0x34')]=_[_0x2f78('0x33')](_0x5e4972['model'],qs[_0x2f78('0x35')](_0xe04eae[_0x2f78('0x31')]['fields']));_0x2e5657[_0x2f78('0x34')]=_0x2e5657[_0x2f78('0x34')][_0x2f78('0x36')]?_0x2e5657[_0x2f78('0x34')]:_0x5e4972[_0x2f78('0x37')];if(!_0xe04eae[_0x2f78('0x31')][_0x2f78('0x38')](_0x2f78('0x39'))){_0x2e5657[_0x2f78('0x1e')]=qs[_0x2f78('0x1e')](_0xe04eae[_0x2f78('0x31')][_0x2f78('0x1e')]);_0x2e5657['offset']=qs[_0x2f78('0x1c')](_0xe04eae[_0x2f78('0x31')][_0x2f78('0x1c')]);}_0x2e5657[_0x2f78('0x3a')]=qs[_0x2f78('0x3b')](_0xe04eae[_0x2f78('0x31')][_0x2f78('0x3b')]);_0x2e5657[_0x2f78('0x3c')]=qs[_0x2f78('0x3d')](_[_0x2f78('0x3e')](_0xe04eae['query'],_0x5e4972['filters']),_0x17a2b5);if(_0xe04eae[_0x2f78('0x31')][_0x2f78('0x3f')]){_0x2e5657['where']=_[_0x2f78('0x40')](_0x2e5657[_0x2f78('0x3c')],{'$or':_[_0x2f78('0x2b')](_0x17a2b5,function(_0x2996a2){if(_0x2996a2[_0x2f78('0x2f')]!==_0x2f78('0x41')){var _0x433295={};_0x433295[_0x2996a2[_0x2f78('0x29')]]={'$like':'%'+_0xe04eae[_0x2f78('0x31')][_0x2f78('0x3f')]+'%'};return _0x433295;}})});}_0x2e5657=_['merge']({},_0x2e5657,_0xe04eae[_0x2f78('0x42')]);var _0x504321={'where':_0x2e5657[_0x2f78('0x3c')]};return db[_0x2f78('0x2c')]['count'](_0x504321)[_0x2f78('0x24')](function(_0xcbc707){_0x3fc20f[_0x2f78('0x1f')]=_0xcbc707;if(_0xe04eae[_0x2f78('0x31')]['includeAll']){_0x2e5657[_0x2f78('0x43')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2e5657);})[_0x2f78('0x24')](function(_0x1638ed){_0x3fc20f['rows']=_0x1638ed;return _0x3fc20f;})[_0x2f78('0x24')](respondWithFilteredResult(_0x45d0d5,_0x2e5657))[_0x2f78('0x44')](handleError(_0x45d0d5,null));};exports[_0x2f78('0x45')]=function(_0x50cf2e,_0x41c791){var _0x32cc7e={'raw':![],'where':{'id':_0x50cf2e[_0x2f78('0x46')]['id']}},_0x2c392f={};_0x2c392f['model']=_[_0x2f78('0x32')](db[_0x2f78('0x2c')][_0x2f78('0x2d')]);_0x2c392f[_0x2f78('0x31')]=_[_0x2f78('0x32')](_0x50cf2e[_0x2f78('0x31')]);_0x2c392f[_0x2f78('0x3d')]=_['intersection'](_0x2c392f[_0x2f78('0x37')],_0x2c392f['query']);_0x32cc7e[_0x2f78('0x34')]=_[_0x2f78('0x33')](_0x2c392f[_0x2f78('0x37')],qs[_0x2f78('0x35')](_0x50cf2e[_0x2f78('0x31')][_0x2f78('0x35')]));_0x32cc7e['attributes']=_0x32cc7e[_0x2f78('0x34')][_0x2f78('0x36')]?_0x32cc7e[_0x2f78('0x34')]:_0x2c392f['model'];if(_0x50cf2e[_0x2f78('0x31')][_0x2f78('0x47')]){_0x32cc7e['include']=[{'all':!![]}];}_0x32cc7e=_['merge']({},_0x32cc7e,_0x50cf2e['options']);return db['IntegrationReport']['find'](_0x32cc7e)[_0x2f78('0x24')](handleEntityNotFound(_0x41c791,null))[_0x2f78('0x24')](respondWithResult(_0x41c791,null))['catch'](handleError(_0x41c791,null));};exports[_0x2f78('0x48')]=function(_0x3ba6ab,_0x1900b6){return db[_0x2f78('0x2c')][_0x2f78('0x48')](_0x3ba6ab['body'],{})[_0x2f78('0x24')](respondWithResult(_0x1900b6,0xc9))[_0x2f78('0x44')](handleError(_0x1900b6,null));};exports['update']=function(_0x3ee195,_0x2c0006){if(_0x3ee195['body']['id']){delete _0x3ee195[_0x2f78('0x49')]['id'];}return db[_0x2f78('0x2c')]['find']({'where':{'id':_0x3ee195[_0x2f78('0x46')]['id']}})[_0x2f78('0x24')](handleEntityNotFound(_0x2c0006,null))[_0x2f78('0x24')](saveUpdates(_0x3ee195[_0x2f78('0x49')],null))[_0x2f78('0x24')](respondWithResult(_0x2c0006,null))[_0x2f78('0x44')](handleError(_0x2c0006,null));};exports['destroy']=function(_0x277161,_0xd0394){return db['IntegrationReport'][_0x2f78('0x4a')]({'where':{'id':_0x277161[_0x2f78('0x46')]['id']}})[_0x2f78('0x24')](handleEntityNotFound(_0xd0394,null))[_0x2f78('0x24')](removeEntity(_0xd0394,null))[_0x2f78('0x44')](handleError(_0xd0394,null));};exports['describe']=function(_0x4d5f9e,_0x17ad23){return db[_0x2f78('0x2c')][_0x2f78('0x4b')]()[_0x2f78('0x24')](respondWithResult(_0x17ad23,null))['catch'](handleError(_0x17ad23,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6cf10e4..fab8a50 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 _0xff42=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','request-promise'];(function(_0x10dbab,_0x2e8174){var _0x408bfe=function(_0x4bca15){while(--_0x4bca15){_0x10dbab['push'](_0x10dbab['shift']());}};_0x408bfe(++_0x2e8174);}(_0xff42,0x11b));var _0x2ff4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xff42[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ff4('0x0'));var util=require(_0x2ff4('0x1'));var logger=require(_0x2ff4('0x2'))(_0x2ff4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ff4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ff4('0x5'));var config=require(_0x2ff4('0x6'));var attributes=require(_0x2ff4('0x7'));module[_0x2ff4('0x8')]=function(_0x993595,_0x2dc4c4){return _0x993595[_0x2ff4('0x9')](_0x2ff4('0xa'),attributes,{'tableName':_0x2ff4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccd=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','../../config/logger','moment','bluebird'];(function(_0x2f60f5,_0xcbf7cb){var _0x28ec03=function(_0x54928a){while(--_0x54928a){_0x2f60f5['push'](_0x2f60f5['shift']());}};_0x28ec03(++_0xcbf7cb);}(_0x9ccd,0x140));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var logger=require(_0xd9cc('0x1'))('api');var moment=require(_0xd9cc('0x2'));var BPromise=require(_0xd9cc('0x3'));var rp=require(_0xd9cc('0x4'));var fs=require('fs');var path=require(_0xd9cc('0x5'));var rimraf=require(_0xd9cc('0x6'));var config=require(_0xd9cc('0x7'));var attributes=require(_0xd9cc('0x8'));module[_0xd9cc('0x9')]=function(_0x2484b0,_0x39d48a){return _0x2484b0['define'](_0xd9cc('0xa'),attributes,{'tableName':_0xd9cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3c23258..99dad90 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0xb9ea17,_0x337c5e){var _0x2749a8=function(_0x2a69bf){while(--_0x2a69bf){_0xb9ea17['push'](_0xb9ea17['shift']());}};_0x2749a8(++_0x337c5e);}(_0x2675,0x75));var _0x5267=function(_0x31593b,_0xfe387a){_0x31593b=_0x31593b-0x0;var _0x43887d=_0x2675[_0x31593b];return _0x43887d;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x2d01e6,_0x253226){var _0x407dc2=function(_0x20bdd1){while(--_0x20bdd1){_0x2d01e6['push'](_0x2d01e6['shift']());}};_0x407dc2(++_0x253226);}(_0x4819,0xcd));var _0x9481=function(_0x2fe7b0,_0x39c02b){_0x2fe7b0=_0x2fe7b0-0x0;var _0x456c3d=_0x4819[_0x2fe7b0];return _0x456c3d;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a72e4d8..6b1f128 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 _0x6a83=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2f2cb8,_0x417d38){var _0x5a7add=function(_0xc1da1d){while(--_0xc1da1d){_0x2f2cb8['push'](_0x2f2cb8['shift']());}};_0x5a7add(++_0x417d38);}(_0x6a83,0xd2));var _0x36a8=function(_0x59f44d,_0x4d23ea){_0x59f44d=_0x59f44d-0x0;var _0x48bc8e=_0x6a83[_0x59f44d];return _0x48bc8e;};'use strict';var multer=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var path=require(_0x36a8('0x2'));var timeout=require(_0x36a8('0x3'));var express=require(_0x36a8('0x4'));var router=express[_0x36a8('0x5')]();var fs_extra=require(_0x36a8('0x6'));var auth=require(_0x36a8('0x7'));var interaction=require(_0x36a8('0x8'));var config=require(_0x36a8('0x9'));var controller=require(_0x36a8('0xa'));router[_0x36a8('0xb')]('/',auth[_0x36a8('0xc')](),controller[_0x36a8('0xd')]);router[_0x36a8('0xb')](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller[_0x36a8('0xf')]);router[_0x36a8('0xb')]('/:id/sub_intervals',auth[_0x36a8('0xc')](),controller['getIntervals']);router[_0x36a8('0x10')]('/',auth[_0x36a8('0xc')](),controller['create']);router[_0x36a8('0x10')](_0x36a8('0x11'),auth['isAuthenticated'](),controller[_0x36a8('0x12')]);router[_0x36a8('0x10')](_0x36a8('0x13'),auth[_0x36a8('0xc')](),controller[_0x36a8('0x14')]);router[_0x36a8('0x15')](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller['update']);router[_0x36a8('0x16')](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller[_0x36a8('0x17')]);module['exports']=router; \ No newline at end of file +var _0x908e=['getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals'];(function(_0x4a6183,_0x3954e4){var _0x5caf6b=function(_0x1707e6){while(--_0x1707e6){_0x4a6183['push'](_0x4a6183['shift']());}};_0x5caf6b(++_0x3954e4);}(_0x908e,0x182));var _0xe908=function(_0x1f6d4a,_0xc7036f){_0x1f6d4a=_0x1f6d4a-0x0;var _0x342511=_0x908e[_0x1f6d4a];return _0x342511;};'use strict';var multer=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe908('0x2'));var router=express[_0xe908('0x3')]();var fs_extra=require(_0xe908('0x4'));var auth=require(_0xe908('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe908('0x6'));var controller=require('./interval.controller');router['get']('/',auth[_0xe908('0x7')](),controller[_0xe908('0x8')]);router[_0xe908('0x9')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0xb')]);router['get'](_0xe908('0xc'),auth['isAuthenticated'](),controller[_0xe908('0xd')]);router[_0xe908('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe908('0xe')](_0xe908('0xc'),auth[_0xe908('0x7')](),controller[_0xe908('0xf')]);router[_0xe908('0xe')](_0xe908('0x10'),auth[_0xe908('0x7')](),controller[_0xe908('0x11')]);router['put']('/:id',auth[_0xe908('0x7')](),controller['update']);router[_0xe908('0x12')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0x13')]);module[_0xe908('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 26253c7..77e72f8 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 _0xad88=['STRING','sequelize'];(function(_0x22d394,_0x4ee5b3){var _0x49fb53=function(_0x23de9b){while(--_0x23de9b){_0x22d394['push'](_0x22d394['shift']());}};_0x49fb53(++_0x4ee5b3);}(_0xad88,0x1bb));var _0x8ad8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xad88[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x8ad8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8ad8('0x1')]},'interval':{'type':Sequelize[_0x8ad8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc475=['STRING','sequelize','exports'];(function(_0x3b3017,_0x531959){var _0xd8fd8d=function(_0x537d8f){while(--_0x537d8f){_0x3b3017['push'](_0x3b3017['shift']());}};_0xd8fd8d(++_0x531959);}(_0xc475,0x14e));var _0x5c47=function(_0x3feb95,_0x4fb666){_0x3feb95=_0x3feb95-0x0;var _0x3f603e=_0xc475[_0x3feb95];return _0x3f603e;};'use strict';var Sequelize=require(_0x5c47('0x0'));module[_0x5c47('0x1')]={'name':{'type':Sequelize[_0x5c47('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e28f289..1faa13a 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 _0x4a00=['model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','body','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x5a98ac,_0x5b783c){var _0x59c9cf=function(_0x4e5656){while(--_0x4e5656){_0x5a98ac['push'](_0x5a98ac['shift']());}};_0x59c9cf(++_0x5b783c);}(_0x4a00,0x129));var _0x04a0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4a00[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x04a0('0x0'));var rimraf=require(_0x04a0('0x1'));var zipdir=require(_0x04a0('0x2'));var jsonpatch=require(_0x04a0('0x3'));var rp=require(_0x04a0('0x4'));var moment=require(_0x04a0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04a0('0x6'));var sox=require(_0x04a0('0x7'));var csv=require(_0x04a0('0x8'));var ejs=require(_0x04a0('0x9'));var fs=require('fs');var fs_extra=require(_0x04a0('0xa'));var _=require(_0x04a0('0xb'));var squel=require(_0x04a0('0xc'));var crypto=require('crypto');var jsforce=require(_0x04a0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x04a0('0x8'));var querystring=require(_0x04a0('0xe'));var Papa=require('papaparse');var Redis=require(_0x04a0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x04a0('0x10'));var as=require(_0x04a0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x04a0('0x12'));var utils=require(_0x04a0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x04a0('0x14'));var db=require(_0x04a0('0x15'))['db'];var extensions=require(_0x04a0('0x16'));function respondWithStatusCode(_0x2bd8d3,_0x40c626){_0x40c626=_0x40c626||0xcc;return function(_0x4b38cb){if(_0x4b38cb){return _0x2bd8d3[_0x04a0('0x17')](_0x40c626);}return _0x2bd8d3[_0x04a0('0x18')](_0x40c626)[_0x04a0('0x19')]();};}function respondWithResult(_0x4e8845,_0x1f7c4b){_0x1f7c4b=_0x1f7c4b||0xc8;return function(_0x4f7f9e){if(_0x4f7f9e){return _0x4e8845[_0x04a0('0x18')](_0x1f7c4b)['json'](_0x4f7f9e);}};}function respondWithFilteredResult(_0x12fece,_0x1f8705){return function(_0x53f9d0){if(_0x53f9d0){var _0x3a9eb7=typeof _0x1f8705['offset']==='undefined'&&typeof _0x1f8705[_0x04a0('0x1a')]==='undefined';var _0x2f200c=_0x53f9d0[_0x04a0('0x1b')];var _0x3d3b18=_0x3a9eb7?0x0:_0x1f8705[_0x04a0('0x1c')];var _0x2a2493=_0x3a9eb7?_0x53f9d0[_0x04a0('0x1b')]:_0x1f8705['offset']+_0x1f8705['limit'];var _0x2febfb;if(_0x2a2493>=_0x2f200c){_0x2a2493=_0x2f200c;_0x2febfb=0xc8;}else{_0x2febfb=0xce;}_0x12fece[_0x04a0('0x18')](_0x2febfb);return _0x12fece[_0x04a0('0x1d')](_0x04a0('0x1e'),_0x3d3b18+'-'+_0x2a2493+'/'+_0x2f200c)[_0x04a0('0x1f')](_0x53f9d0);}return null;};}function patchUpdates(_0x387026){return function(_0x4e30b3){try{jsonpatch[_0x04a0('0x20')](_0x4e30b3,_0x387026,!![]);}catch(_0x55cee1){return BPromise[_0x04a0('0x21')](_0x55cee1);}return _0x4e30b3['save']();};}function saveUpdates(_0x30f42f,_0x3fbac2){return function(_0x193f98){if(_0x193f98){return _0x193f98[_0x04a0('0x22')](_0x30f42f)[_0x04a0('0x23')](function(_0x1c5966){return _0x1c5966;});}return null;};}function removeEntity(_0x42fde6,_0x5a01ce){return function(_0x2e2f9b){if(_0x2e2f9b){return _0x2e2f9b['destroy']()[_0x04a0('0x23')](function(){var _0x533ade=_0x2e2f9b['get']({'plain':!![]});var _0x2427bd=_0x04a0('0x24');return db[_0x04a0('0x25')][_0x04a0('0x26')]({'where':{'type':_0x2427bd,'resourceId':_0x533ade['id']}})[_0x04a0('0x23')](function(){return _0x2e2f9b;});})[_0x04a0('0x23')](function(){_0x42fde6[_0x04a0('0x18')](0xcc)[_0x04a0('0x19')]();});}};}function handleEntityNotFound(_0x462960,_0x1c1a6e){return function(_0x936eaf){if(!_0x936eaf){_0x462960[_0x04a0('0x17')](0x194);}return _0x936eaf;};}function handleError(_0x1fb78d,_0x51e9fb){_0x51e9fb=_0x51e9fb||0x1f4;return function(_0x5df185){logger[_0x04a0('0x27')](_0x5df185[_0x04a0('0x28')]);if(_0x5df185['name']){delete _0x5df185[_0x04a0('0x29')];}_0x1fb78d['status'](_0x51e9fb)[_0x04a0('0x2a')](_0x5df185);};}exports['index']=function(_0x4ff0e8,_0x2fe92a){var _0x25f6ab={},_0x25652b={},_0xcfe11e={'count':0x0,'rows':[]};var _0x2e35d7=_[_0x04a0('0x2b')](db['Interval'][_0x04a0('0x2c')],function(_0x345b16){return{'name':_0x345b16[_0x04a0('0x2d')],'type':_0x345b16[_0x04a0('0x2e')]['key']};});_0x25652b[_0x04a0('0x2f')]=_[_0x04a0('0x2b')](_0x2e35d7,_0x04a0('0x29'));_0x25652b[_0x04a0('0x30')]=_[_0x04a0('0x31')](_0x4ff0e8[_0x04a0('0x30')]);_0x25652b[_0x04a0('0x32')]=_[_0x04a0('0x33')](_0x25652b['model'],_0x25652b[_0x04a0('0x30')]);_0x25f6ab['attributes']=_['intersection'](_0x25652b[_0x04a0('0x2f')],qs[_0x04a0('0x34')](_0x4ff0e8[_0x04a0('0x30')][_0x04a0('0x34')]));_0x25f6ab[_0x04a0('0x35')]=_0x25f6ab[_0x04a0('0x35')][_0x04a0('0x36')]?_0x25f6ab['attributes']:_0x25652b['model'];if(!_0x4ff0e8[_0x04a0('0x30')]['hasOwnProperty'](_0x04a0('0x37'))){_0x25f6ab[_0x04a0('0x1a')]=qs[_0x04a0('0x1a')](_0x4ff0e8[_0x04a0('0x30')][_0x04a0('0x1a')]);_0x25f6ab['offset']=qs['offset'](_0x4ff0e8['query'][_0x04a0('0x1c')]);}_0x25f6ab[_0x04a0('0x38')]=qs[_0x04a0('0x39')](_0x4ff0e8[_0x04a0('0x30')][_0x04a0('0x39')]);_0x25f6ab[_0x04a0('0x3a')]=qs['filters'](_[_0x04a0('0x3b')](_0x4ff0e8['query'],_0x25652b['filters']),_0x2e35d7);if(_0x4ff0e8[_0x04a0('0x30')][_0x04a0('0x3c')]){_0x25f6ab[_0x04a0('0x3a')]=_[_0x04a0('0x3d')](_0x25f6ab[_0x04a0('0x3a')],{'$or':_[_0x04a0('0x2b')](_0x2e35d7,function(_0x487fe3){if(_0x487fe3[_0x04a0('0x2e')]!=='VIRTUAL'){var _0x128e4f={};_0x128e4f[_0x487fe3['name']]={'$like':'%'+_0x4ff0e8[_0x04a0('0x30')][_0x04a0('0x3c')]+'%'};return _0x128e4f;}})});}_0x25f6ab=_[_0x04a0('0x3d')]({},_0x25f6ab,_0x4ff0e8[_0x04a0('0x3e')]);var _0x2de8a4={'where':_0x25f6ab['where']};return db[_0x04a0('0x3f')]['count'](_0x2de8a4)['then'](function(_0x1e2a8f){_0xcfe11e['count']=_0x1e2a8f;if(_0x4ff0e8['query'][_0x04a0('0x40')]){_0x25f6ab[_0x04a0('0x41')]=[{'all':!![]}];}return db['Interval'][_0x04a0('0x42')](_0x25f6ab);})[_0x04a0('0x23')](function(_0x1884a0){_0xcfe11e[_0x04a0('0x43')]=_0x1884a0;return _0xcfe11e;})['then'](respondWithFilteredResult(_0x2fe92a,_0x25f6ab))['catch'](handleError(_0x2fe92a,null));};exports[_0x04a0('0x44')]=function(_0x17c416,_0x4270fc){var _0x31e9a8={'raw':!![],'where':{'id':_0x17c416[_0x04a0('0x45')]['id']}},_0x32e4ab={};_0x32e4ab[_0x04a0('0x2f')]=_['keys'](db[_0x04a0('0x3f')][_0x04a0('0x2c')]);_0x32e4ab['query']=_['keys'](_0x17c416[_0x04a0('0x30')]);_0x32e4ab[_0x04a0('0x32')]=_[_0x04a0('0x33')](_0x32e4ab[_0x04a0('0x2f')],_0x32e4ab[_0x04a0('0x30')]);_0x31e9a8['attributes']=_[_0x04a0('0x33')](_0x32e4ab[_0x04a0('0x2f')],qs[_0x04a0('0x34')](_0x17c416[_0x04a0('0x30')][_0x04a0('0x34')]));_0x31e9a8[_0x04a0('0x35')]=_0x31e9a8[_0x04a0('0x35')]['length']?_0x31e9a8[_0x04a0('0x35')]:_0x32e4ab[_0x04a0('0x2f')];if(_0x17c416[_0x04a0('0x30')][_0x04a0('0x40')]){_0x31e9a8['include']=[{'all':!![]}];}_0x31e9a8=_[_0x04a0('0x3d')]({},_0x31e9a8,_0x17c416[_0x04a0('0x3e')]);return db['Interval'][_0x04a0('0x46')](_0x31e9a8)[_0x04a0('0x23')](handleEntityNotFound(_0x4270fc,null))[_0x04a0('0x23')](respondWithResult(_0x4270fc,null))[_0x04a0('0x47')](handleError(_0x4270fc,null));};exports[_0x04a0('0x48')]=function(_0x407d3c,_0x454090){return db['Interval'][_0x04a0('0x48')](_0x407d3c['body'],{})[_0x04a0('0x23')](function(_0x39f088){var _0x403f80=_0x407d3c[_0x04a0('0x49')]['get']({'plain':!![]});if(!_0x403f80)throw new Error(_0x04a0('0x4a'));if(_0x403f80['role']===_0x04a0('0x49')){var _0x2439eb=_0x39f088[_0x04a0('0x4b')]({'plain':!![]});var _0x8d9909='Intervals';return db[_0x04a0('0x4c')]['find']({'where':{'name':_0x8d9909,'userProfileId':_0x403f80['userProfileId']},'raw':!![]})[_0x04a0('0x23')](function(_0x402346){if(_0x402346&&_0x402346['autoAssociation']===0x0){return db[_0x04a0('0x25')][_0x04a0('0x48')]({'name':_0x2439eb[_0x04a0('0x29')],'resourceId':_0x2439eb['id'],'type':_0x402346['name'],'sectionId':_0x402346['id']},{})[_0x04a0('0x23')](function(){return _0x39f088;});}else{return _0x39f088;}})[_0x04a0('0x47')](function(_0x566c0b){logger[_0x04a0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x566c0b);throw _0x566c0b;});}return _0x39f088;})[_0x04a0('0x23')](respondWithResult(_0x454090,0xc9))[_0x04a0('0x47')](handleError(_0x454090,null));};exports[_0x04a0('0x22')]=function(_0x101363,_0xad1ce5){if(_0x101363[_0x04a0('0x4d')]['id']){delete _0x101363['body']['id'];}return db[_0x04a0('0x3f')][_0x04a0('0x46')]({'where':{'id':_0x101363[_0x04a0('0x45')]['id']}})[_0x04a0('0x23')](handleEntityNotFound(_0xad1ce5,null))[_0x04a0('0x23')](saveUpdates(_0x101363[_0x04a0('0x4d')],null))[_0x04a0('0x23')](respondWithResult(_0xad1ce5,null))[_0x04a0('0x47')](handleError(_0xad1ce5,null));};exports[_0x04a0('0x26')]=function(_0x38d55a,_0x328482){return db[_0x04a0('0x3f')]['find']({'where':{'id':_0x38d55a[_0x04a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x328482,null))[_0x04a0('0x23')](removeEntity(_0x328482,null))['catch'](handleError(_0x328482,null));};exports[_0x04a0('0x4e')]=function(_0x8469bc,_0x434309,_0x5f1a6b){if(_0x8469bc[_0x04a0('0x4d')]['id']){delete _0x8469bc[_0x04a0('0x4d')]['id'];}return db[_0x04a0('0x3f')][_0x04a0('0x46')]({'where':{'id':_0x8469bc['params']['id']}})[_0x04a0('0x23')](handleEntityNotFound(_0x434309,null))[_0x04a0('0x23')](function(_0x8b9e2f){if(_0x8b9e2f){_0x8469bc[_0x04a0('0x4d')][_0x04a0('0x4f')]=_0x8b9e2f['id'];return db['Interval']['create'](_0x8469bc['body']);}})[_0x04a0('0x23')](respondWithResult(_0x434309,null))[_0x04a0('0x47')](handleError(_0x434309,null));};exports[_0x04a0('0x50')]=function(_0x13038d,_0x4344c9,_0x1e7cba){var _0x4e9850={};var _0x445ebd={};var _0x12e647;var _0x1f3392;return db[_0x04a0('0x3f')]['findOne']({'where':{'id':_0x13038d['params']['id']}})[_0x04a0('0x23')](handleEntityNotFound(_0x4344c9,null))[_0x04a0('0x23')](function(_0x1954e5){if(_0x1954e5){_0x12e647=_0x1954e5;_0x445ebd[_0x04a0('0x2f')]=_[_0x04a0('0x31')](db[_0x04a0('0x3f')][_0x04a0('0x2c')]);_0x445ebd[_0x04a0('0x30')]=_[_0x04a0('0x31')](_0x13038d[_0x04a0('0x30')]);_0x445ebd['filters']=_[_0x04a0('0x33')](_0x445ebd[_0x04a0('0x2f')],_0x445ebd['query']);_0x4e9850[_0x04a0('0x35')]=_['intersection'](_0x445ebd[_0x04a0('0x2f')],qs['fields'](_0x13038d[_0x04a0('0x30')][_0x04a0('0x34')]));_0x4e9850[_0x04a0('0x35')]=_0x4e9850['attributes'][_0x04a0('0x36')]?_0x4e9850[_0x04a0('0x35')]:_0x445ebd[_0x04a0('0x2f')];_0x4e9850[_0x04a0('0x38')]=qs['sort'](_0x13038d[_0x04a0('0x30')][_0x04a0('0x39')]);_0x4e9850[_0x04a0('0x3a')]=qs[_0x04a0('0x32')](_[_0x04a0('0x3b')](_0x13038d[_0x04a0('0x30')],_0x445ebd[_0x04a0('0x32')]));if(_0x13038d[_0x04a0('0x30')]['filter']){_0x4e9850['where']=_['merge'](_0x4e9850[_0x04a0('0x3a')],{'$or':_[_0x04a0('0x2b')](_0x4e9850['attributes'],function(_0x5ed349){var _0x43244c={};_0x43244c[_0x5ed349]={'$like':'%'+_0x13038d[_0x04a0('0x30')]['filter']+'%'};return _0x43244c;})});}_0x4e9850=_[_0x04a0('0x3d')]({},_0x4e9850,_0x13038d[_0x04a0('0x3e')]);return _0x12e647[_0x04a0('0x50')](_0x4e9850);}})['then'](function(_0x3aa0b5){if(_0x3aa0b5){_0x1f3392=_0x3aa0b5['length'];if(!_0x13038d['query'][_0x04a0('0x51')](_0x04a0('0x37'))){_0x4e9850[_0x04a0('0x1a')]=qs['limit'](_0x13038d[_0x04a0('0x30')][_0x04a0('0x1a')]);_0x4e9850['offset']=qs[_0x04a0('0x1c')](_0x13038d['query'][_0x04a0('0x1c')]);}return _0x12e647[_0x04a0('0x50')](_0x4e9850);}})[_0x04a0('0x23')](function(_0x2ef599){if(_0x2ef599){return _0x2ef599?{'count':_0x1f3392,'rows':_0x2ef599}:null;}})[_0x04a0('0x23')](respondWithResult(_0x4344c9,null))[_0x04a0('0x47')](handleError(_0x4344c9,null));};exports[_0x04a0('0x52')]=function(_0x45fcee,_0x178b22,_0x546c03){return db['Interval'][_0x04a0('0x53')]({'where':{'id':_0x45fcee[_0x04a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x178b22,null))['then'](function(_0x465292){if(_0x465292){return db[_0x04a0('0x54')][_0x04a0('0x55')](function(_0x307685){return db[_0x04a0('0x3f')][_0x04a0('0x26')]({'where':{'IntervalId':_0x45fcee['params']['id']},'transaction':_0x307685})[_0x04a0('0x23')](function(_0xb3b48b){var _0x24f682=_[_0x04a0('0x2b')](_0x45fcee[_0x04a0('0x4d')],function(_0x41d8d4){delete _0x41d8d4['id'];_0x41d8d4[_0x04a0('0x4f')]=_0x45fcee[_0x04a0('0x45')]['id'];return _0x41d8d4;});return db[_0x04a0('0x3f')]['bulkCreate'](_0x24f682,{'transaction':_0x307685});});})['then'](function(){return db[_0x04a0('0x3f')]['findAll']({'where':{'IntervalId':_0x45fcee[_0x04a0('0x45')]['id']}});});}})['then'](respondWithResult(_0x178b22,null))[_0x04a0('0x47')](handleError(_0x178b22,null));}; \ No newline at end of file +var _0xc91a=['offset','limit','status','Content-Range','apply','reject','save','destroy','then','UserProfileResource','sendStatus','error','stack','name','index','map','Interval','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','order','hasOwnProperty','findOne','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','undefined','count'];(function(_0x2f0a45,_0x1b214c){var _0x498b43=function(_0x3fa42b){while(--_0x3fa42b){_0x2f0a45['push'](_0x2f0a45['shift']());}};_0x498b43(++_0x1b214c);}(_0xc91a,0xee));var _0xac91=function(_0xd32f93,_0x4b5e55){_0xd32f93=_0xd32f93-0x0;var _0x17f7d0=_0xc91a[_0xd32f93];return _0x17f7d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac91('0x0'));var zipdir=require(_0xac91('0x1'));var jsonpatch=require(_0xac91('0x2'));var rp=require(_0xac91('0x3'));var moment=require(_0xac91('0x4'));var BPromise=require(_0xac91('0x5'));var Mustache=require(_0xac91('0x6'));var util=require('util');var path=require(_0xac91('0x7'));var sox=require(_0xac91('0x8'));var csv=require('to-csv');var ejs=require(_0xac91('0x9'));var fs=require('fs');var fs_extra=require(_0xac91('0xa'));var _=require(_0xac91('0xb'));var squel=require('squel');var crypto=require(_0xac91('0xc'));var jsforce=require(_0xac91('0xd'));var deskjs=require(_0xac91('0xe'));var toCsv=require(_0xac91('0xf'));var querystring=require('querystring');var Papa=require(_0xac91('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac91('0x12'));var logger=require('../../config/logger')(_0xac91('0x13'));var utils=require('../../config/utils');var config=require(_0xac91('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xac91('0x15'))['db'];var extensions=require(_0xac91('0x16'));function respondWithStatusCode(_0x759dd5,_0x3f0a61){_0x3f0a61=_0x3f0a61||0xcc;return function(_0x1a4620){if(_0x1a4620){return _0x759dd5['sendStatus'](_0x3f0a61);}return _0x759dd5['status'](_0x3f0a61)[_0xac91('0x17')]();};}function respondWithResult(_0x147aa2,_0x197376){_0x197376=_0x197376||0xc8;return function(_0x4ef258){if(_0x4ef258){return _0x147aa2['status'](_0x197376)['json'](_0x4ef258);}};}function respondWithFilteredResult(_0x6f25f1,_0x584d47){return function(_0x5ed8a8){if(_0x5ed8a8){var _0x1ca76c=typeof _0x584d47['offset']===_0xac91('0x18')&&typeof _0x584d47['limit']===_0xac91('0x18');var _0x220e24=_0x5ed8a8[_0xac91('0x19')];var _0x1b3bf5=_0x1ca76c?0x0:_0x584d47[_0xac91('0x1a')];var _0x4ecc76=_0x1ca76c?_0x5ed8a8[_0xac91('0x19')]:_0x584d47[_0xac91('0x1a')]+_0x584d47[_0xac91('0x1b')];var _0x37a6ca;if(_0x4ecc76>=_0x220e24){_0x4ecc76=_0x220e24;_0x37a6ca=0xc8;}else{_0x37a6ca=0xce;}_0x6f25f1[_0xac91('0x1c')](_0x37a6ca);return _0x6f25f1['set'](_0xac91('0x1d'),_0x1b3bf5+'-'+_0x4ecc76+'/'+_0x220e24)['json'](_0x5ed8a8);}return null;};}function patchUpdates(_0x579831){return function(_0x480aa9){try{jsonpatch[_0xac91('0x1e')](_0x480aa9,_0x579831,!![]);}catch(_0x49a36c){return BPromise[_0xac91('0x1f')](_0x49a36c);}return _0x480aa9[_0xac91('0x20')]();};}function saveUpdates(_0x1ecf35,_0x229cce){return function(_0x2d21a2){if(_0x2d21a2){return _0x2d21a2['update'](_0x1ecf35)['then'](function(_0x4e7ccd){return _0x4e7ccd;});}return null;};}function removeEntity(_0x3068a3,_0x38acb5){return function(_0x2f3086){if(_0x2f3086){return _0x2f3086[_0xac91('0x21')]()[_0xac91('0x22')](function(){var _0x13f22e=_0x2f3086['get']({'plain':!![]});var _0x26cd4c='Intervals';return db[_0xac91('0x23')]['destroy']({'where':{'type':_0x26cd4c,'resourceId':_0x13f22e['id']}})[_0xac91('0x22')](function(){return _0x2f3086;});})[_0xac91('0x22')](function(){_0x3068a3[_0xac91('0x1c')](0xcc)[_0xac91('0x17')]();});}};}function handleEntityNotFound(_0x1b906b,_0x1aac24){return function(_0x1a20a9){if(!_0x1a20a9){_0x1b906b[_0xac91('0x24')](0x194);}return _0x1a20a9;};}function handleError(_0x2f9126,_0x3f811d){_0x3f811d=_0x3f811d||0x1f4;return function(_0x20b049){logger[_0xac91('0x25')](_0x20b049[_0xac91('0x26')]);if(_0x20b049[_0xac91('0x27')]){delete _0x20b049['name'];}_0x2f9126[_0xac91('0x1c')](_0x3f811d)['send'](_0x20b049);};}exports[_0xac91('0x28')]=function(_0x4e7cd9,_0x43171a){var _0x429289={},_0x501c34={},_0x327f9a={'count':0x0,'rows':[]};var _0x4397b6=_[_0xac91('0x29')](db[_0xac91('0x2a')]['rawAttributes'],function(_0x541f85){return{'name':_0x541f85[_0xac91('0x2b')],'type':_0x541f85['type'][_0xac91('0x2c')]};});_0x501c34['model']=_[_0xac91('0x29')](_0x4397b6,_0xac91('0x27'));_0x501c34[_0xac91('0x2d')]=_[_0xac91('0x2e')](_0x4e7cd9['query']);_0x501c34[_0xac91('0x2f')]=_[_0xac91('0x30')](_0x501c34['model'],_0x501c34['query']);_0x429289[_0xac91('0x31')]=_[_0xac91('0x30')](_0x501c34[_0xac91('0x32')],qs[_0xac91('0x33')](_0x4e7cd9[_0xac91('0x2d')][_0xac91('0x33')]));_0x429289[_0xac91('0x31')]=_0x429289[_0xac91('0x31')][_0xac91('0x34')]?_0x429289['attributes']:_0x501c34[_0xac91('0x32')];if(!_0x4e7cd9[_0xac91('0x2d')]['hasOwnProperty'](_0xac91('0x35'))){_0x429289[_0xac91('0x1b')]=qs[_0xac91('0x1b')](_0x4e7cd9[_0xac91('0x2d')][_0xac91('0x1b')]);_0x429289[_0xac91('0x1a')]=qs[_0xac91('0x1a')](_0x4e7cd9[_0xac91('0x2d')][_0xac91('0x1a')]);}_0x429289['order']=qs['sort'](_0x4e7cd9[_0xac91('0x2d')][_0xac91('0x36')]);_0x429289[_0xac91('0x37')]=qs[_0xac91('0x2f')](_[_0xac91('0x38')](_0x4e7cd9['query'],_0x501c34[_0xac91('0x2f')]),_0x4397b6);if(_0x4e7cd9['query'][_0xac91('0x39')]){_0x429289['where']=_[_0xac91('0x3a')](_0x429289[_0xac91('0x37')],{'$or':_[_0xac91('0x29')](_0x4397b6,function(_0x8d5555){if(_0x8d5555['type']!==_0xac91('0x3b')){var _0x4a2a75={};_0x4a2a75[_0x8d5555[_0xac91('0x27')]]={'$like':'%'+_0x4e7cd9[_0xac91('0x2d')][_0xac91('0x39')]+'%'};return _0x4a2a75;}})});}_0x429289=_[_0xac91('0x3a')]({},_0x429289,_0x4e7cd9[_0xac91('0x3c')]);var _0x175bc9={'where':_0x429289[_0xac91('0x37')]};return db[_0xac91('0x2a')][_0xac91('0x19')](_0x175bc9)[_0xac91('0x22')](function(_0x2091d9){_0x327f9a[_0xac91('0x19')]=_0x2091d9;if(_0x4e7cd9['query'][_0xac91('0x3d')]){_0x429289[_0xac91('0x3e')]=[{'all':!![]}];}return db['Interval'][_0xac91('0x3f')](_0x429289);})[_0xac91('0x22')](function(_0x14c6fe){_0x327f9a[_0xac91('0x40')]=_0x14c6fe;return _0x327f9a;})[_0xac91('0x22')](respondWithFilteredResult(_0x43171a,_0x429289))[_0xac91('0x41')](handleError(_0x43171a,null));};exports[_0xac91('0x42')]=function(_0x51da15,_0x3936a0){var _0x147a43={'raw':!![],'where':{'id':_0x51da15[_0xac91('0x43')]['id']}},_0x5e6476={};_0x5e6476['model']=_[_0xac91('0x2e')](db[_0xac91('0x2a')][_0xac91('0x44')]);_0x5e6476['query']=_['keys'](_0x51da15['query']);_0x5e6476[_0xac91('0x2f')]=_[_0xac91('0x30')](_0x5e6476[_0xac91('0x32')],_0x5e6476[_0xac91('0x2d')]);_0x147a43['attributes']=_['intersection'](_0x5e6476[_0xac91('0x32')],qs[_0xac91('0x33')](_0x51da15[_0xac91('0x2d')][_0xac91('0x33')]));_0x147a43['attributes']=_0x147a43[_0xac91('0x31')][_0xac91('0x34')]?_0x147a43['attributes']:_0x5e6476['model'];if(_0x51da15[_0xac91('0x2d')][_0xac91('0x3d')]){_0x147a43['include']=[{'all':!![]}];}_0x147a43=_['merge']({},_0x147a43,_0x51da15['options']);return db['Interval'][_0xac91('0x45')](_0x147a43)['then'](handleEntityNotFound(_0x3936a0,null))[_0xac91('0x22')](respondWithResult(_0x3936a0,null))[_0xac91('0x41')](handleError(_0x3936a0,null));};exports[_0xac91('0x46')]=function(_0x2a5fb5,_0x436c38){return db[_0xac91('0x2a')][_0xac91('0x46')](_0x2a5fb5[_0xac91('0x47')],{})[_0xac91('0x22')](function(_0x1362ac){var _0x4fde76=_0x2a5fb5[_0xac91('0x48')][_0xac91('0x49')]({'plain':!![]});if(!_0x4fde76)throw new Error(_0xac91('0x4a'));if(_0x4fde76[_0xac91('0x4b')]===_0xac91('0x48')){var _0x1b60d7=_0x1362ac[_0xac91('0x49')]({'plain':!![]});var _0x80c5ce=_0xac91('0x4c');return db[_0xac91('0x4d')][_0xac91('0x45')]({'where':{'name':_0x80c5ce,'userProfileId':_0x4fde76['userProfileId']},'raw':!![]})[_0xac91('0x22')](function(_0x5c3695){if(_0x5c3695&&_0x5c3695[_0xac91('0x4e')]===0x0){return db[_0xac91('0x23')][_0xac91('0x46')]({'name':_0x1b60d7[_0xac91('0x27')],'resourceId':_0x1b60d7['id'],'type':_0x5c3695[_0xac91('0x27')],'sectionId':_0x5c3695['id']},{})[_0xac91('0x22')](function(){return _0x1362ac;});}else{return _0x1362ac;}})['catch'](function(_0x52f228){logger[_0xac91('0x25')](_0xac91('0x4f'),_0x52f228);throw _0x52f228;});}return _0x1362ac;})['then'](respondWithResult(_0x436c38,0xc9))['catch'](handleError(_0x436c38,null));};exports[_0xac91('0x50')]=function(_0x1a7cdb,_0x5b4815){if(_0x1a7cdb['body']['id']){delete _0x1a7cdb[_0xac91('0x47')]['id'];}return db[_0xac91('0x2a')][_0xac91('0x45')]({'where':{'id':_0x1a7cdb[_0xac91('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b4815,null))[_0xac91('0x22')](saveUpdates(_0x1a7cdb[_0xac91('0x47')],null))[_0xac91('0x22')](respondWithResult(_0x5b4815,null))[_0xac91('0x41')](handleError(_0x5b4815,null));};exports['destroy']=function(_0x5cd305,_0x31613b){return db[_0xac91('0x2a')][_0xac91('0x45')]({'where':{'id':_0x5cd305[_0xac91('0x43')]['id']}})[_0xac91('0x22')](handleEntityNotFound(_0x31613b,null))[_0xac91('0x22')](removeEntity(_0x31613b,null))[_0xac91('0x41')](handleError(_0x31613b,null));};exports[_0xac91('0x51')]=function(_0x2cc7df,_0x555699,_0x46fabb){if(_0x2cc7df[_0xac91('0x47')]['id']){delete _0x2cc7df['body']['id'];}return db[_0xac91('0x2a')]['find']({'where':{'id':_0x2cc7df[_0xac91('0x43')]['id']}})['then'](handleEntityNotFound(_0x555699,null))[_0xac91('0x22')](function(_0x23db82){if(_0x23db82){_0x2cc7df['body'][_0xac91('0x52')]=_0x23db82['id'];return db['Interval'][_0xac91('0x46')](_0x2cc7df[_0xac91('0x47')]);}})[_0xac91('0x22')](respondWithResult(_0x555699,null))[_0xac91('0x41')](handleError(_0x555699,null));};exports[_0xac91('0x53')]=function(_0x44d9d2,_0x556c42,_0x160c75){var _0x11bb46={};var _0x579f95={};var _0x56f8bc;var _0x2e9f01;return db[_0xac91('0x2a')]['findOne']({'where':{'id':_0x44d9d2[_0xac91('0x43')]['id']}})[_0xac91('0x22')](handleEntityNotFound(_0x556c42,null))[_0xac91('0x22')](function(_0x4eed75){if(_0x4eed75){_0x56f8bc=_0x4eed75;_0x579f95[_0xac91('0x32')]=_[_0xac91('0x2e')](db[_0xac91('0x2a')][_0xac91('0x44')]);_0x579f95[_0xac91('0x2d')]=_[_0xac91('0x2e')](_0x44d9d2[_0xac91('0x2d')]);_0x579f95[_0xac91('0x2f')]=_[_0xac91('0x30')](_0x579f95[_0xac91('0x32')],_0x579f95[_0xac91('0x2d')]);_0x11bb46[_0xac91('0x31')]=_[_0xac91('0x30')](_0x579f95[_0xac91('0x32')],qs['fields'](_0x44d9d2[_0xac91('0x2d')]['fields']));_0x11bb46[_0xac91('0x31')]=_0x11bb46[_0xac91('0x31')][_0xac91('0x34')]?_0x11bb46[_0xac91('0x31')]:_0x579f95[_0xac91('0x32')];_0x11bb46[_0xac91('0x54')]=qs[_0xac91('0x36')](_0x44d9d2[_0xac91('0x2d')][_0xac91('0x36')]);_0x11bb46[_0xac91('0x37')]=qs['filters'](_[_0xac91('0x38')](_0x44d9d2[_0xac91('0x2d')],_0x579f95[_0xac91('0x2f')]));if(_0x44d9d2['query'][_0xac91('0x39')]){_0x11bb46[_0xac91('0x37')]=_[_0xac91('0x3a')](_0x11bb46[_0xac91('0x37')],{'$or':_['map'](_0x11bb46[_0xac91('0x31')],function(_0x401ff8){var _0x597751={};_0x597751[_0x401ff8]={'$like':'%'+_0x44d9d2[_0xac91('0x2d')][_0xac91('0x39')]+'%'};return _0x597751;})});}_0x11bb46=_[_0xac91('0x3a')]({},_0x11bb46,_0x44d9d2[_0xac91('0x3c')]);return _0x56f8bc[_0xac91('0x53')](_0x11bb46);}})[_0xac91('0x22')](function(_0x25d960){if(_0x25d960){_0x2e9f01=_0x25d960[_0xac91('0x34')];if(!_0x44d9d2[_0xac91('0x2d')][_0xac91('0x55')](_0xac91('0x35'))){_0x11bb46['limit']=qs[_0xac91('0x1b')](_0x44d9d2[_0xac91('0x2d')]['limit']);_0x11bb46[_0xac91('0x1a')]=qs[_0xac91('0x1a')](_0x44d9d2[_0xac91('0x2d')][_0xac91('0x1a')]);}return _0x56f8bc[_0xac91('0x53')](_0x11bb46);}})['then'](function(_0x2415a5){if(_0x2415a5){return _0x2415a5?{'count':_0x2e9f01,'rows':_0x2415a5}:null;}})['then'](respondWithResult(_0x556c42,null))[_0xac91('0x41')](handleError(_0x556c42,null));};exports['addIntervals']=function(_0x950d53,_0x2d578a,_0x1b967c){return db[_0xac91('0x2a')][_0xac91('0x56')]({'where':{'id':_0x950d53[_0xac91('0x43')]['id']}})[_0xac91('0x22')](handleEntityNotFound(_0x2d578a,null))['then'](function(_0x3ba853){if(_0x3ba853){return db['sequelize']['transaction'](function(_0x3f3827){return db[_0xac91('0x2a')][_0xac91('0x21')]({'where':{'IntervalId':_0x950d53[_0xac91('0x43')]['id']},'transaction':_0x3f3827})[_0xac91('0x22')](function(_0x404dd0){var _0x4b9d0d=_[_0xac91('0x29')](_0x950d53[_0xac91('0x47')],function(_0x1891bf){delete _0x1891bf['id'];_0x1891bf[_0xac91('0x52')]=_0x950d53[_0xac91('0x43')]['id'];return _0x1891bf;});return db['Interval'][_0xac91('0x57')](_0x4b9d0d,{'transaction':_0x3f3827});});})[_0xac91('0x22')](function(){return db[_0xac91('0x2a')][_0xac91('0x3f')]({'where':{'IntervalId':_0x950d53['params']['id']}});});}})['then'](respondWithResult(_0x2d578a,null))[_0xac91('0x41')](handleError(_0x2d578a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1fcd109..97413e9 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 _0x172c=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x172c,0x95));var _0xc172=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x172c[_0x15b380];return _0x232c5c;};'use strict';var _=require(_0xc172('0x0'));var util=require('util');var logger=require(_0xc172('0x1'))('api');var moment=require(_0xc172('0x2'));var BPromise=require(_0xc172('0x3'));var rp=require(_0xc172('0x4'));var fs=require('fs');var path=require(_0xc172('0x5'));var rimraf=require(_0xc172('0x6'));var config=require(_0xc172('0x7'));var attributes=require(_0xc172('0x8'));var extensions=require(_0xc172('0x9'));module['exports']=function(_0x4d5c1b,_0x1634f6){return _0x4d5c1b['define'](_0xc172('0xa'),attributes,{'tableName':_0xc172('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b67c5,_0x50c1cf){extensions['rewrite'](_0x4d5c1b,_0x4b67c5);},'afterBulkCreate':function(_0x5de4f2,_0xa8ff73,_0x1e7678){_0x1e7678();extensions['rewrite'](_0x4d5c1b,_0x5de4f2[0x0]);},'afterUpdate':function(_0x245302,_0x16c585){extensions[_0xc172('0xc')](_0x4d5c1b,_0x245302);},'afterDestroy':function(_0x242337,_0x7cc741){extensions['rewrite'](_0x4d5c1b,_0x242337);}}});}; \ No newline at end of file +var _0x5232=['path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x50b435,_0x5a6efb){var _0x51a88d=function(_0x37667e){while(--_0x37667e){_0x50b435['push'](_0x50b435['shift']());}};_0x51a88d(++_0x5a6efb);}(_0x5232,0x1c9));var _0x2523=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x5232[_0xf34b0a];return _0x5021e1;};'use strict';var _=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var logger=require(_0x2523('0x2'))(_0x2523('0x3'));var moment=require(_0x2523('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2523('0x5'));var rimraf=require(_0x2523('0x6'));var config=require('../../config/environment');var attributes=require(_0x2523('0x7'));var extensions=require(_0x2523('0x8'));module[_0x2523('0x9')]=function(_0x45ae69,_0x3ab139){return _0x45ae69[_0x2523('0xa')](_0x2523('0xb'),attributes,{'tableName':_0x2523('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x251973,_0x39dca8){extensions[_0x2523('0xd')](_0x45ae69,_0x251973);},'afterBulkCreate':function(_0x30f2cd,_0x55e5bb,_0x1e6087){_0x1e6087();extensions[_0x2523('0xd')](_0x45ae69,_0x30f2cd[0x0]);},'afterUpdate':function(_0xb076a8,_0x2f6bf5){extensions[_0x2523('0xd')](_0x45ae69,_0xb076a8);},'afterDestroy':function(_0x3ea8fa,_0x5856d2){extensions[_0x2523('0xd')](_0x45ae69,_0x3ea8fa);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a6dd9af..2a784c8 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(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_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 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 54036e7..6138ad7 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x3a4434,_0x4f3ad3){var _0x36108d=function(_0x36cdfc){while(--_0x36cdfc){_0x3a4434['push'](_0x3a4434['shift']());}};_0x36108d(++_0x4f3ad3);}(_0xadb5,0xad));var _0x5adb=function(_0x40796f,_0xd3af5c){_0x40796f=_0x40796f-0x0;var _0x507535=_0xadb5[_0x40796f];return _0x507535;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x51f84a,_0x445f17){_0x51f84a=_0x51f84a-0x0;var _0x4ba63d=_0x0b0e[_0x51f84a];return _0x4ba63d;};'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 1a5e4ad..860d048 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 _0x86fb=['socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','status','statusCode','json','parse','error','api.jira','write','end','openIssue','body','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x86fb,0x1e1));var _0xb86f=function(_0x51a6c2,_0x4ee8a3){_0x51a6c2=_0x51a6c2-0x0;var _0xa73f3=_0x86fb[_0x51a6c2];return _0xa73f3;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xb86f('0x0'))(_0xb86f('0x1'));var USERNAME=_0xb86f('0x2');var PASSWORD=_0xb86f('0x3');function openIssue(_0xa5124d,_0x4c8089){var _0xf42064={'fields':{'project':{'key':_0xa5124d[_0xb86f('0x4')]||_0xb86f('0x5')},'summary':(_0xa5124d[_0xb86f('0x6')]||_0xb86f('0x7'))+_0xb86f('0x8')+_0xa5124d['ip'],'description':_0xa5124d['description']||JSON['stringify'](_0xa5124d),'issuetype':{'name':_0xa5124d[_0xb86f('0x9')]||_0xb86f('0xa')}}};_0xf42064[_0xb86f('0xb')][_0xb86f('0xc')]=_0xa5124d[_0xb86f('0xd')];_0xf42064[_0xb86f('0xb')][_0xb86f('0xe')]=_0xa5124d[_0xb86f('0xf')];_0xf42064[_0xb86f('0xb')][_0xb86f('0x10')]=_0xa5124d[_0xb86f('0x11')];_0xf42064[_0xb86f('0xb')][_0xb86f('0x12')]=_0xa5124d[_0xb86f('0x13')];_0xf42064[_0xb86f('0xb')][_0xb86f('0x14')]=_0xa5124d[_0xb86f('0x15')];_0xf42064['fields'][_0xb86f('0x16')]=_0xa5124d['ip'];var _0xe85408={'host':_0xb86f('0x17'),'port':0x1bb,'path':_0xb86f('0x18'),'method':_0xb86f('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xb86f('0x1a'),'Authorization':_0xb86f('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xb86f('0x1c')](_0xb86f('0x1d'))}};var _0xcc686d=JSON[_0xb86f('0x1e')](_0xf42064);var _0x5b7fbb=https[_0xb86f('0x1f')](_0xe85408,function(_0x4e3cde){_0x4e3cde[_0xb86f('0x20')]('utf8');var _0x3770b6='';_0x4e3cde['on']('data',function(_0x4e0c14){_0x3770b6+=_0x4e0c14;});_0x4e3cde['on']('end',function(){if(_0x4c8089){return _0x4c8089[_0xb86f('0x21')](_0x4e3cde[_0xb86f('0x22')])[_0xb86f('0x23')](JSON[_0xb86f('0x24')](_0x3770b6));}});});_0x5b7fbb['on'](_0xb86f('0x25'),function(_0x360e67){if(_0x4c8089){return _0x4c8089[_0xb86f('0x21')](0x1f4)[_0xb86f('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xb86f('0x26')}]});}});_0x5b7fbb[_0xb86f('0x27')](_0xcc686d);_0x5b7fbb[_0xb86f('0x28')]();}exports[_0xb86f('0x29')]=openIssue;exports['send']=function(_0x353456,_0x1d1a95){_0x353456[_0xb86f('0x2a')]['ip']=_0x353456[_0xb86f('0x2b')][_0xb86f('0x2c')]||_0x353456[_0xb86f('0x2d')][_0xb86f('0x2e')]||_0x353456[_0xb86f('0x2f')][_0xb86f('0x2e')]||_0x353456[_0xb86f('0x2d')][_0xb86f('0x2f')][_0xb86f('0x2e')];return openIssue(_0x353456[_0xb86f('0x2a')],_0x1d1a95);}; \ No newline at end of file +var _0x9599=['stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','newToken','name','customfield_10102','POST','application/json','Basic\x20','toString','base64','request','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description'];(function(_0x145ab6,_0x1350ba){var _0x1e80e9=function(_0x2171a4){while(--_0x2171a4){_0x145ab6['push'](_0x145ab6['shift']());}};_0x1e80e9(++_0x1350ba);}(_0x9599,0x1c3));var _0x9959=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0x9599[_0x47a491];return _0x3b176b;};'use strict';var BPromise=require(_0x9959('0x0'));var https=require(_0x9959('0x1'));var logger=require(_0x9959('0x2'))(_0x9959('0x3'));var USERNAME=_0x9959('0x4');var PASSWORD=_0x9959('0x5');function openIssue(_0x4b82d3,_0x44c1dd){var _0x518769={'fields':{'project':{'key':_0x4b82d3['key']||_0x9959('0x6')},'summary':(_0x4b82d3[_0x9959('0x7')]||_0x9959('0x8'))+_0x9959('0x9')+_0x4b82d3['ip'],'description':_0x4b82d3[_0x9959('0xa')]||JSON[_0x9959('0xb')](_0x4b82d3),'issuetype':{'name':_0x4b82d3[_0x9959('0xc')]||_0x9959('0xd')}}};_0x518769['fields'][_0x9959('0xe')]=_0x4b82d3[_0x9959('0xf')];_0x518769[_0x9959('0x10')][_0x9959('0x11')]=_0x4b82d3['oldToken'];_0x518769[_0x9959('0x10')]['customfield_11502']=_0x4b82d3[_0x9959('0x12')];_0x518769[_0x9959('0x10')]['customfield_11503']=_0x4b82d3[_0x9959('0x13')];_0x518769[_0x9959('0x10')]['customfield_11504']=_0x4b82d3['reason'];_0x518769[_0x9959('0x10')][_0x9959('0x14')]=_0x4b82d3['ip'];var _0x35d41a={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x9959('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x9959('0x16'),'Authorization':_0x9959('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x9959('0x18')](_0x9959('0x19'))}};var _0x1e5db9=JSON['stringify'](_0x518769);var _0x150662=https[_0x9959('0x1a')](_0x35d41a,function(_0x4343a4){_0x4343a4['setEncoding'](_0x9959('0x1b'));var _0x3d4b9c='';_0x4343a4['on']('data',function(_0x5307c0){_0x3d4b9c+=_0x5307c0;});_0x4343a4['on']('end',function(){if(_0x44c1dd){return _0x44c1dd[_0x9959('0x1c')](_0x4343a4[_0x9959('0x1d')])[_0x9959('0x1e')](JSON[_0x9959('0x1f')](_0x3d4b9c));}});});_0x150662['on'](_0x9959('0x20'),function(_0x559e22){if(_0x44c1dd){return _0x44c1dd[_0x9959('0x1c')](0x1f4)[_0x9959('0x1e')]({'errors':[{'message':_0x9959('0x21'),'type':'api.jira'}]});}});_0x150662[_0x9959('0x22')](_0x1e5db9);_0x150662['end']();}exports[_0x9959('0x23')]=openIssue;exports[_0x9959('0x24')]=function(_0x2ac406,_0x3960fa){_0x2ac406[_0x9959('0x25')]['ip']=_0x2ac406['headers'][_0x9959('0x26')]||_0x2ac406[_0x9959('0x27')][_0x9959('0x28')]||_0x2ac406[_0x9959('0x29')][_0x9959('0x28')]||_0x2ac406[_0x9959('0x27')][_0x9959('0x29')]['remoteAddress'];return openIssue(_0x2ac406[_0x9959('0x25')],_0x3960fa);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d2629a0..0bd2760 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x3e01c9,_0x47d2f2){var _0x5304bb=function(_0x35ec62){while(--_0x35ec62){_0x3e01c9['push'](_0x3e01c9['shift']());}};_0x5304bb(++_0x47d2f2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xcb91[_0x374ada];return _0x449ed8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf109=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xf109,0xce));var _0x9f10=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf109[_0x12f688];return _0x59c3de;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f10('0x11')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller['destroy']);module[_0x9f10('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 2488368..4406661 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x403a90,_0x4c92db){_0x403a90=_0x403a90-0x0;var _0x2d84a8=_0x7a54[_0x403a90];return _0x2d84a8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0xaea1ae,_0x53a6fb){_0xaea1ae=_0xaea1ae-0x0;var _0xd8c5bd=_0x7a54[_0xaea1ae];return _0xd8c5bd;};'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 fa59055..679268a 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 _0xc03e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x5e53a9,_0xda41a7){var _0x365362=function(_0x3e81e7){while(--_0x3e81e7){_0x5e53a9['push'](_0x5e53a9['shift']());}};_0x365362(++_0xda41a7);}(_0xc03e,0x15a));var _0xec03=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xc03e[_0x168127];return _0x4c99ad;};'use strict';var emlformat=require(_0xec03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec03('0x1'));var rp=require('request-promise');var moment=require(_0xec03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xec03('0x3'));var util=require(_0xec03('0x4'));var path=require(_0xec03('0x5'));var sox=require(_0xec03('0x6'));var csv=require(_0xec03('0x7'));var ejs=require(_0xec03('0x8'));var fs=require('fs');var fs_extra=require(_0xec03('0x9'));var _=require(_0xec03('0xa'));var squel=require(_0xec03('0xb'));var crypto=require('crypto');var jsforce=require(_0xec03('0xc'));var deskjs=require(_0xec03('0xd'));var toCsv=require(_0xec03('0x7'));var querystring=require(_0xec03('0xe'));var Papa=require('papaparse');var Redis=require(_0xec03('0xf'));var authService=require(_0xec03('0x10'));var qs=require(_0xec03('0x11'));var as=require(_0xec03('0x12'));var hardwareService=require(_0xec03('0x13'));var logger=require(_0xec03('0x14'))(_0xec03('0x15'));var utils=require(_0xec03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec03('0x17'));var db=require(_0xec03('0x18'))['db'];function respondWithStatusCode(_0x398720,_0x2f65a1){_0x2f65a1=_0x2f65a1||0xcc;return function(_0x9908ef){if(_0x9908ef){return _0x398720[_0xec03('0x19')](_0x2f65a1);}return _0x398720[_0xec03('0x1a')](_0x2f65a1)[_0xec03('0x1b')]();};}function respondWithResult(_0x4ba43a,_0x555447){_0x555447=_0x555447||0xc8;return function(_0x5ca0e2){if(_0x5ca0e2){return _0x4ba43a[_0xec03('0x1a')](_0x555447)[_0xec03('0x1c')](_0x5ca0e2);}};}function respondWithFilteredResult(_0x3501ab,_0x515680){return function(_0x28bb4f){if(_0x28bb4f){var _0xbe85e6=typeof _0x515680[_0xec03('0x1d')]===_0xec03('0x1e')&&typeof _0x515680['limit']===_0xec03('0x1e');var _0x52f6ae=_0x28bb4f[_0xec03('0x1f')];var _0x5e8ae2=_0xbe85e6?0x0:_0x515680[_0xec03('0x1d')];var _0x5b3e04=_0xbe85e6?_0x28bb4f['count']:_0x515680[_0xec03('0x1d')]+_0x515680[_0xec03('0x20')];var _0xefa268;if(_0x5b3e04>=_0x52f6ae){_0x5b3e04=_0x52f6ae;_0xefa268=0xc8;}else{_0xefa268=0xce;}_0x3501ab[_0xec03('0x1a')](_0xefa268);return _0x3501ab['set'](_0xec03('0x21'),_0x5e8ae2+'-'+_0x5b3e04+'/'+_0x52f6ae)['json'](_0x28bb4f);}return null;};}function patchUpdates(_0x16ade3){return function(_0x253910){try{jsonpatch[_0xec03('0x22')](_0x253910,_0x16ade3,!![]);}catch(_0x33a167){return BPromise[_0xec03('0x23')](_0x33a167);}return _0x253910[_0xec03('0x24')]();};}function saveUpdates(_0x3a44df,_0x3b6ddf){return function(_0x5df6cc){if(_0x5df6cc){return _0x5df6cc[_0xec03('0x25')](_0x3a44df)[_0xec03('0x26')](function(_0xa16d53){return _0xa16d53;});}return null;};}function removeEntity(_0x76b813,_0x33de1e){return function(_0x15ef87){if(_0x15ef87){return _0x15ef87['destroy']()[_0xec03('0x26')](function(){_0x76b813[_0xec03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfcf6,_0xa5b580){return function(_0x26875e){if(!_0x26875e){_0x2bfcf6[_0xec03('0x19')](0x194);}return _0x26875e;};}function handleError(_0x1c6870,_0x581322){_0x581322=_0x581322||0x1f4;return function(_0x73cc4f){logger[_0xec03('0x27')](_0x73cc4f[_0xec03('0x28')]);if(_0x73cc4f[_0xec03('0x29')]){delete _0x73cc4f[_0xec03('0x29')];}_0x1c6870['status'](_0x581322)[_0xec03('0x2a')](_0x73cc4f);};}exports[_0xec03('0x2b')]=function(_0x49f9ab,_0x530251){var _0x2063ba={},_0x12b5c9={},_0x35a9eb={'count':0x0,'rows':[]};var _0x872f98=_[_0xec03('0x2c')](db[_0xec03('0x2d')][_0xec03('0x2e')],function(_0x28753c){return{'name':_0x28753c['fieldName'],'type':_0x28753c[_0xec03('0x2f')][_0xec03('0x30')]};});_0x12b5c9[_0xec03('0x31')]=_[_0xec03('0x2c')](_0x872f98,_0xec03('0x29'));_0x12b5c9[_0xec03('0x32')]=_[_0xec03('0x33')](_0x49f9ab[_0xec03('0x32')]);_0x12b5c9[_0xec03('0x34')]=_['intersection'](_0x12b5c9['model'],_0x12b5c9['query']);_0x2063ba[_0xec03('0x35')]=_[_0xec03('0x36')](_0x12b5c9[_0xec03('0x31')],qs[_0xec03('0x37')](_0x49f9ab['query']['fields']));_0x2063ba['attributes']=_0x2063ba['attributes'][_0xec03('0x38')]?_0x2063ba[_0xec03('0x35')]:_0x12b5c9[_0xec03('0x31')];if(!_0x49f9ab[_0xec03('0x32')][_0xec03('0x39')](_0xec03('0x3a'))){_0x2063ba[_0xec03('0x20')]=qs[_0xec03('0x20')](_0x49f9ab[_0xec03('0x32')][_0xec03('0x20')]);_0x2063ba[_0xec03('0x1d')]=qs[_0xec03('0x1d')](_0x49f9ab['query'][_0xec03('0x1d')]);}_0x2063ba[_0xec03('0x3b')]=qs[_0xec03('0x3c')](_0x49f9ab['query'][_0xec03('0x3c')]);_0x2063ba[_0xec03('0x3d')]=qs[_0xec03('0x34')](_[_0xec03('0x3e')](_0x49f9ab[_0xec03('0x32')],_0x12b5c9[_0xec03('0x34')]),_0x872f98);if(_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]){_0x2063ba[_0xec03('0x3d')]=_[_0xec03('0x40')](_0x2063ba[_0xec03('0x3d')],{'$or':_['map'](_0x872f98,function(_0x25286a){if(_0x25286a[_0xec03('0x2f')]!==_0xec03('0x41')){var _0x3d6d70={};_0x3d6d70[_0x25286a[_0xec03('0x29')]]={'$like':'%'+_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]+'%'};return _0x3d6d70;}})});}_0x2063ba=_[_0xec03('0x40')]({},_0x2063ba,_0x49f9ab['options']);var _0x454e91={'where':_0x2063ba['where']};return db['JscriptyAnswerReport'][_0xec03('0x1f')](_0x454e91)['then'](function(_0x548b81){_0x35a9eb[_0xec03('0x1f')]=_0x548b81;if(_0x49f9ab[_0xec03('0x32')]['includeAll']){_0x2063ba[_0xec03('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x2063ba);})['then'](function(_0x494fec){_0x35a9eb[_0xec03('0x43')]=_0x494fec;return _0x35a9eb;})[_0xec03('0x26')](respondWithFilteredResult(_0x530251,_0x2063ba))[_0xec03('0x44')](handleError(_0x530251,null));};exports['show']=function(_0x1b1aea,_0x3f2522){var _0xe03df3={'raw':!![],'where':{'id':_0x1b1aea[_0xec03('0x45')]['id']}},_0x14a429={};_0x14a429[_0xec03('0x31')]=_[_0xec03('0x33')](db[_0xec03('0x2d')][_0xec03('0x2e')]);_0x14a429['query']=_[_0xec03('0x33')](_0x1b1aea[_0xec03('0x32')]);_0x14a429[_0xec03('0x34')]=_[_0xec03('0x36')](_0x14a429['model'],_0x14a429[_0xec03('0x32')]);_0xe03df3[_0xec03('0x35')]=_[_0xec03('0x36')](_0x14a429[_0xec03('0x31')],qs[_0xec03('0x37')](_0x1b1aea[_0xec03('0x32')]['fields']));_0xe03df3['attributes']=_0xe03df3[_0xec03('0x35')][_0xec03('0x38')]?_0xe03df3[_0xec03('0x35')]:_0x14a429[_0xec03('0x31')];if(_0x1b1aea[_0xec03('0x32')]['includeAll']){_0xe03df3['include']=[{'all':!![]}];}_0xe03df3=_[_0xec03('0x40')]({},_0xe03df3,_0x1b1aea['options']);return db[_0xec03('0x2d')][_0xec03('0x46')](_0xe03df3)[_0xec03('0x26')](handleEntityNotFound(_0x3f2522,null))[_0xec03('0x26')](respondWithResult(_0x3f2522,null))['catch'](handleError(_0x3f2522,null));};exports[_0xec03('0x47')]=function(_0x14a61c,_0x3c7e18){return db[_0xec03('0x2d')]['create'](_0x14a61c[_0xec03('0x48')],{})['then'](respondWithResult(_0x3c7e18,0xc9))[_0xec03('0x44')](handleError(_0x3c7e18,null));};exports[_0xec03('0x25')]=function(_0xdb9a99,_0x1c6b87){if(_0xdb9a99[_0xec03('0x48')]['id']){delete _0xdb9a99[_0xec03('0x48')]['id'];}return db[_0xec03('0x2d')]['find']({'where':{'id':_0xdb9a99[_0xec03('0x45')]['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x1c6b87,null))[_0xec03('0x26')](saveUpdates(_0xdb9a99[_0xec03('0x48')],null))['then'](respondWithResult(_0x1c6b87,null))[_0xec03('0x44')](handleError(_0x1c6b87,null));};exports['destroy']=function(_0xe0e874,_0x3825f9){return db[_0xec03('0x2d')][_0xec03('0x46')]({'where':{'id':_0xe0e874['params']['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x3825f9,null))[_0xec03('0x26')](removeEntity(_0x3825f9,null))[_0xec03('0x44')](handleError(_0x3825f9,null));};exports[_0xec03('0x49')]=function(_0x32a5af,_0x5b1339){return db[_0xec03('0x2d')][_0xec03('0x49')]()[_0xec03('0x26')](respondWithResult(_0x5b1339,null))['catch'](handleError(_0x5b1339,null));}; \ No newline at end of file +var _0x50d0=['fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes'];(function(_0x23153a,_0xa2e784){var _0x25b6ef=function(_0x4a3e98){while(--_0x4a3e98){_0x23153a['push'](_0x23153a['shift']());}};_0x25b6ef(++_0xa2e784);}(_0x50d0,0x101));var _0x050d=function(_0x524a4a,_0x2dff07){_0x524a4a=_0x524a4a-0x0;var _0x19a308=_0x50d0[_0x524a4a];return _0x19a308;};'use strict';var emlformat=require(_0x050d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x050d('0x1'));var jsonpatch=require(_0x050d('0x2'));var rp=require(_0x050d('0x3'));var moment=require(_0x050d('0x4'));var BPromise=require(_0x050d('0x5'));var Mustache=require('mustache');var util=require(_0x050d('0x6'));var path=require(_0x050d('0x7'));var sox=require(_0x050d('0x8'));var csv=require(_0x050d('0x9'));var ejs=require(_0x050d('0xa'));var fs=require('fs');var fs_extra=require(_0x050d('0xb'));var _=require(_0x050d('0xc'));var squel=require(_0x050d('0xd'));var crypto=require(_0x050d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x050d('0xf'));var toCsv=require(_0x050d('0x9'));var querystring=require(_0x050d('0x10'));var Papa=require('papaparse');var Redis=require(_0x050d('0x11'));var authService=require(_0x050d('0x12'));var qs=require(_0x050d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x050d('0x14'))(_0x050d('0x15'));var utils=require(_0x050d('0x16'));var config=require(_0x050d('0x17'));var licenseUtil=require(_0x050d('0x18'));var db=require(_0x050d('0x19'))['db'];function respondWithStatusCode(_0x55a57d,_0x5656b4){_0x5656b4=_0x5656b4||0xcc;return function(_0x27d825){if(_0x27d825){return _0x55a57d[_0x050d('0x1a')](_0x5656b4);}return _0x55a57d[_0x050d('0x1b')](_0x5656b4)[_0x050d('0x1c')]();};}function respondWithResult(_0x4f5d24,_0x5c982f){_0x5c982f=_0x5c982f||0xc8;return function(_0x5e0c23){if(_0x5e0c23){return _0x4f5d24['status'](_0x5c982f)['json'](_0x5e0c23);}};}function respondWithFilteredResult(_0x4a65e5,_0x50c2f9){return function(_0x53c110){if(_0x53c110){var _0x340c55=typeof _0x50c2f9[_0x050d('0x1d')]===_0x050d('0x1e')&&typeof _0x50c2f9[_0x050d('0x1f')]===_0x050d('0x1e');var _0x3dddb1=_0x53c110[_0x050d('0x20')];var _0xe6bdad=_0x340c55?0x0:_0x50c2f9[_0x050d('0x1d')];var _0x9b240f=_0x340c55?_0x53c110[_0x050d('0x20')]:_0x50c2f9[_0x050d('0x1d')]+_0x50c2f9['limit'];var _0x54b9f6;if(_0x9b240f>=_0x3dddb1){_0x9b240f=_0x3dddb1;_0x54b9f6=0xc8;}else{_0x54b9f6=0xce;}_0x4a65e5['status'](_0x54b9f6);return _0x4a65e5[_0x050d('0x21')](_0x050d('0x22'),_0xe6bdad+'-'+_0x9b240f+'/'+_0x3dddb1)[_0x050d('0x23')](_0x53c110);}return null;};}function patchUpdates(_0x125a00){return function(_0x181bb8){try{jsonpatch['apply'](_0x181bb8,_0x125a00,!![]);}catch(_0x584439){return BPromise['reject'](_0x584439);}return _0x181bb8['save']();};}function saveUpdates(_0x365512,_0xdebdb8){return function(_0x185e2f){if(_0x185e2f){return _0x185e2f[_0x050d('0x24')](_0x365512)[_0x050d('0x25')](function(_0xfd26b8){return _0xfd26b8;});}return null;};}function removeEntity(_0x20e887,_0x102766){return function(_0x17f82b){if(_0x17f82b){return _0x17f82b[_0x050d('0x26')]()[_0x050d('0x25')](function(){_0x20e887[_0x050d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a70c3,_0x2ba0c3){return function(_0x369311){if(!_0x369311){_0x5a70c3['sendStatus'](0x194);}return _0x369311;};}function handleError(_0x1562fe,_0x3cafc1){_0x3cafc1=_0x3cafc1||0x1f4;return function(_0x1ea9a8){logger[_0x050d('0x27')](_0x1ea9a8[_0x050d('0x28')]);if(_0x1ea9a8[_0x050d('0x29')]){delete _0x1ea9a8[_0x050d('0x29')];}_0x1562fe[_0x050d('0x1b')](_0x3cafc1)[_0x050d('0x2a')](_0x1ea9a8);};}exports[_0x050d('0x2b')]=function(_0x1ce601,_0x392efa){var _0x422367={},_0x6da660={},_0x3f290c={'count':0x0,'rows':[]};var _0x5f5111=_[_0x050d('0x2c')](db[_0x050d('0x2d')][_0x050d('0x2e')],function(_0x519c6f){return{'name':_0x519c6f[_0x050d('0x2f')],'type':_0x519c6f['type'][_0x050d('0x30')]};});_0x6da660[_0x050d('0x31')]=_[_0x050d('0x2c')](_0x5f5111,_0x050d('0x29'));_0x6da660['query']=_[_0x050d('0x32')](_0x1ce601['query']);_0x6da660[_0x050d('0x33')]=_[_0x050d('0x34')](_0x6da660[_0x050d('0x31')],_0x6da660[_0x050d('0x35')]);_0x422367[_0x050d('0x36')]=_[_0x050d('0x34')](_0x6da660['model'],qs[_0x050d('0x37')](_0x1ce601[_0x050d('0x35')]['fields']));_0x422367[_0x050d('0x36')]=_0x422367['attributes'][_0x050d('0x38')]?_0x422367['attributes']:_0x6da660[_0x050d('0x31')];if(!_0x1ce601[_0x050d('0x35')]['hasOwnProperty'](_0x050d('0x39'))){_0x422367[_0x050d('0x1f')]=qs[_0x050d('0x1f')](_0x1ce601['query'][_0x050d('0x1f')]);_0x422367[_0x050d('0x1d')]=qs[_0x050d('0x1d')](_0x1ce601[_0x050d('0x35')][_0x050d('0x1d')]);}_0x422367['order']=qs[_0x050d('0x3a')](_0x1ce601['query'][_0x050d('0x3a')]);_0x422367[_0x050d('0x3b')]=qs[_0x050d('0x33')](_[_0x050d('0x3c')](_0x1ce601[_0x050d('0x35')],_0x6da660[_0x050d('0x33')]),_0x5f5111);if(_0x1ce601[_0x050d('0x35')][_0x050d('0x3d')]){_0x422367[_0x050d('0x3b')]=_[_0x050d('0x3e')](_0x422367['where'],{'$or':_['map'](_0x5f5111,function(_0xfc5f9b){if(_0xfc5f9b[_0x050d('0x3f')]!==_0x050d('0x40')){var _0x5e04b8={};_0x5e04b8[_0xfc5f9b[_0x050d('0x29')]]={'$like':'%'+_0x1ce601[_0x050d('0x35')]['filter']+'%'};return _0x5e04b8;}})});}_0x422367=_[_0x050d('0x3e')]({},_0x422367,_0x1ce601[_0x050d('0x41')]);var _0x2fe939={'where':_0x422367['where']};return db[_0x050d('0x2d')][_0x050d('0x20')](_0x2fe939)[_0x050d('0x25')](function(_0x37635d){_0x3f290c[_0x050d('0x20')]=_0x37635d;if(_0x1ce601[_0x050d('0x35')][_0x050d('0x42')]){_0x422367[_0x050d('0x43')]=[{'all':!![]}];}return db[_0x050d('0x2d')]['findAll'](_0x422367);})[_0x050d('0x25')](function(_0x2646e0){_0x3f290c[_0x050d('0x44')]=_0x2646e0;return _0x3f290c;})[_0x050d('0x25')](respondWithFilteredResult(_0x392efa,_0x422367))[_0x050d('0x45')](handleError(_0x392efa,null));};exports[_0x050d('0x46')]=function(_0x23c453,_0x45019d){var _0x1edde2={'raw':!![],'where':{'id':_0x23c453[_0x050d('0x47')]['id']}},_0x10e320={};_0x10e320[_0x050d('0x31')]=_['keys'](db['JscriptyAnswerReport'][_0x050d('0x2e')]);_0x10e320[_0x050d('0x35')]=_[_0x050d('0x32')](_0x23c453[_0x050d('0x35')]);_0x10e320[_0x050d('0x33')]=_['intersection'](_0x10e320[_0x050d('0x31')],_0x10e320[_0x050d('0x35')]);_0x1edde2[_0x050d('0x36')]=_[_0x050d('0x34')](_0x10e320[_0x050d('0x31')],qs[_0x050d('0x37')](_0x23c453['query'][_0x050d('0x37')]));_0x1edde2[_0x050d('0x36')]=_0x1edde2[_0x050d('0x36')][_0x050d('0x38')]?_0x1edde2[_0x050d('0x36')]:_0x10e320[_0x050d('0x31')];if(_0x23c453[_0x050d('0x35')][_0x050d('0x42')]){_0x1edde2[_0x050d('0x43')]=[{'all':!![]}];}_0x1edde2=_[_0x050d('0x3e')]({},_0x1edde2,_0x23c453[_0x050d('0x41')]);return db[_0x050d('0x2d')][_0x050d('0x48')](_0x1edde2)['then'](handleEntityNotFound(_0x45019d,null))['then'](respondWithResult(_0x45019d,null))[_0x050d('0x45')](handleError(_0x45019d,null));};exports['create']=function(_0x27bc53,_0x48d7f6){return db[_0x050d('0x2d')][_0x050d('0x49')](_0x27bc53['body'],{})['then'](respondWithResult(_0x48d7f6,0xc9))[_0x050d('0x45')](handleError(_0x48d7f6,null));};exports['update']=function(_0x4b2253,_0x242ccb){if(_0x4b2253['body']['id']){delete _0x4b2253[_0x050d('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0x050d('0x48')]({'where':{'id':_0x4b2253[_0x050d('0x47')]['id']}})['then'](handleEntityNotFound(_0x242ccb,null))[_0x050d('0x25')](saveUpdates(_0x4b2253[_0x050d('0x4a')],null))[_0x050d('0x25')](respondWithResult(_0x242ccb,null))[_0x050d('0x45')](handleError(_0x242ccb,null));};exports['destroy']=function(_0x20f076,_0x2e7d7f){return db[_0x050d('0x2d')]['find']({'where':{'id':_0x20f076[_0x050d('0x47')]['id']}})[_0x050d('0x25')](handleEntityNotFound(_0x2e7d7f,null))['then'](removeEntity(_0x2e7d7f,null))[_0x050d('0x45')](handleError(_0x2e7d7f,null));};exports[_0x050d('0x4b')]=function(_0x27a06a,_0x1d5b58){return db[_0x050d('0x2d')][_0x050d('0x4b')]()[_0x050d('0x25')](respondWithResult(_0x1d5b58,null))['catch'](handleError(_0x1d5b58,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0938404..dd1d288 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 _0xd4ae=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','api'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xd4ae,0xf5));var _0xed4a=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xd4ae[_0x5a4b16];return _0x5236dc;};'use strict';var _=require('lodash');var util=require(_0xed4a('0x0'));var logger=require('../../config/logger')(_0xed4a('0x1'));var moment=require(_0xed4a('0x2'));var BPromise=require(_0xed4a('0x3'));var rp=require(_0xed4a('0x4'));var fs=require('fs');var path=require(_0xed4a('0x5'));var rimraf=require(_0xed4a('0x6'));var config=require(_0xed4a('0x7'));var attributes=require(_0xed4a('0x8'));module[_0xed4a('0x9')]=function(_0x544205,_0x4c87df){return _0x544205[_0xed4a('0xa')](_0xed4a('0xb'),attributes,{'tableName':_0xed4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6244=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','lodash'];(function(_0x7f66dd,_0x1e5370){var _0x23a548=function(_0x3cea90){while(--_0x3cea90){_0x7f66dd['push'](_0x7f66dd['shift']());}};_0x23a548(++_0x1e5370);}(_0x6244,0x1e9));var _0x4624=function(_0x1d0ac9,_0x5f195f){_0x1d0ac9=_0x1d0ac9-0x0;var _0xaf85ee=_0x6244[_0x1d0ac9];return _0xaf85ee;};'use strict';var _=require(_0x4624('0x0'));var util=require(_0x4624('0x1'));var logger=require(_0x4624('0x2'))(_0x4624('0x3'));var moment=require(_0x4624('0x4'));var BPromise=require(_0x4624('0x5'));var rp=require(_0x4624('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4624('0x7'));var attributes=require(_0x4624('0x8'));module['exports']=function(_0x12a0b3,_0x1f2a37){return _0x12a0b3['define'](_0x4624('0x9'),attributes,{'tableName':'report_jscripty_answers','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 f6ee7f1..7272554 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 _0x642d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x642d,0x185));var _0xd642=function(_0x3e18cd,_0x4740b7){_0x3e18cd=_0x3e18cd-0x0;var _0x528b57=_0x642d[_0x3e18cd];return _0x528b57;};'use strict';var _=require(_0xd642('0x0'));var util=require(_0xd642('0x1'));var moment=require(_0xd642('0x2'));var BPromise=require(_0xd642('0x3'));var rs=require(_0xd642('0x4'));var fs=require('fs');var Redis=require(_0xd642('0x5'));var db=require(_0xd642('0x6'))['db'];var utils=require(_0xd642('0x7'));var logger=require(_0xd642('0x8'))(_0xd642('0x9'));var config=require(_0xd642('0xa'));var jayson=require(_0xd642('0xb'));var client=jayson[_0xd642('0xc')][_0xd642('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x270c40,_0xedfb06,_0x4bfe43){return new BPromise(function(_0x40be6e,_0x2949f2){return client['request'](_0x270c40,_0x4bfe43)[_0xd642('0xe')](function(_0x27f697){logger[_0xd642('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xedfb06,_0xd642('0x10'));logger[_0xd642('0x11')](_0xd642('0x12'),_0xedfb06,_0xd642('0x10'),JSON[_0xd642('0x13')](_0x27f697));if(_0x27f697[_0xd642('0x14')]){if(_0x27f697[_0xd642('0x14')][_0xd642('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xedfb06,_0x27f697['error'][_0xd642('0x16')]);return _0x2949f2(_0x27f697[_0xd642('0x14')][_0xd642('0x16')]);}logger[_0xd642('0x14')](_0xd642('0x17'),_0xedfb06,_0x27f697['error']['message']);return _0x40be6e(_0x27f697[_0xd642('0x14')][_0xd642('0x16')]);}else{logger[_0xd642('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xedfb06,_0xd642('0x10'));_0x40be6e(_0x27f697[_0xd642('0x18')][_0xd642('0x16')]);}})[_0xd642('0x19')](function(_0x13867f){logger[_0xd642('0x14')](_0xd642('0x17'),_0xedfb06,_0x13867f);_0x2949f2(_0x13867f);});});} \ No newline at end of file +var _0x9cbb=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cbb,0xf0));var _0xb9cb=function(_0x2ffbfe,_0x1a7fe2){_0x2ffbfe=_0x2ffbfe-0x0;var _0x13606e=_0x9cbb[_0x2ffbfe];return _0x13606e;};'use strict';var _=require(_0xb9cb('0x0'));var util=require(_0xb9cb('0x1'));var moment=require(_0xb9cb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9cb('0x3'));var db=require(_0xb9cb('0x4'))['db'];var utils=require(_0xb9cb('0x5'));var logger=require(_0xb9cb('0x6'))('rpc');var config=require(_0xb9cb('0x7'));var jayson=require(_0xb9cb('0x8'));var client=jayson[_0xb9cb('0x9')][_0xb9cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d58c8,_0x2a9174,_0x9981f2){return new BPromise(function(_0x2c08a5,_0x35ccbf){return client[_0xb9cb('0xb')](_0x1d58c8,_0x9981f2)[_0xb9cb('0xc')](function(_0x1700d7){logger[_0xb9cb('0xd')](_0xb9cb('0xe'),_0x2a9174,_0xb9cb('0xf'));logger[_0xb9cb('0x10')](_0xb9cb('0x11'),_0x2a9174,'request\x20sent',JSON[_0xb9cb('0x12')](_0x1700d7));if(_0x1700d7['error']){if(_0x1700d7[_0xb9cb('0x13')][_0xb9cb('0x14')]===0x1f4){logger[_0xb9cb('0x13')](_0xb9cb('0xe'),_0x2a9174,_0x1700d7[_0xb9cb('0x13')][_0xb9cb('0x15')]);return _0x35ccbf(_0x1700d7[_0xb9cb('0x13')][_0xb9cb('0x15')]);}logger[_0xb9cb('0x13')](_0xb9cb('0xe'),_0x2a9174,_0x1700d7[_0xb9cb('0x13')][_0xb9cb('0x15')]);return _0x2c08a5(_0x1700d7[_0xb9cb('0x13')][_0xb9cb('0x15')]);}else{logger[_0xb9cb('0xd')](_0xb9cb('0xe'),_0x2a9174,_0xb9cb('0xf'));_0x2c08a5(_0x1700d7[_0xb9cb('0x16')][_0xb9cb('0x15')]);}})[_0xb9cb('0x17')](function(_0x230e3b){logger[_0xb9cb('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2a9174,_0x230e3b);_0x35ccbf(_0x230e3b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 70d8780..3273ed7 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 _0xd733=['show','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x2bfd5f,_0x2e742d){var _0x301b5a=function(_0x8db987){while(--_0x8db987){_0x2bfd5f['push'](_0x2bfd5f['shift']());}};_0x301b5a(++_0x2e742d);}(_0xd733,0xdf));var _0x3d73=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xd733[_0x1d39f6];return _0x3dbd7a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d73('0x0'));var timeout=require(_0x3d73('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d73('0x2'));var auth=require(_0x3d73('0x3'));var interaction=require(_0x3d73('0x4'));var config=require(_0x3d73('0x5'));var controller=require(_0x3d73('0x6'));router[_0x3d73('0x7')]('/',auth[_0x3d73('0x8')](),controller[_0x3d73('0x9')]);router['get'](_0x3d73('0xa'),auth['isAuthenticated'](),controller[_0x3d73('0xb')]);router[_0x3d73('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x3d73('0xc')]);router[_0x3d73('0x7')](_0x3d73('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x3d73('0xe'),auth[_0x3d73('0x8')](),timeout(_0x3d73('0xf')),controller[_0x3d73('0x10')]);router[_0x3d73('0x11')]('/',auth[_0x3d73('0x8')](),controller[_0x3d73('0x12')]);router[_0x3d73('0x11')](_0x3d73('0x13'),auth['isAuthenticated'](),controller[_0x3d73('0x14')]);router[_0x3d73('0x15')](_0x3d73('0xa'),auth[_0x3d73('0x8')](),controller[_0x3d73('0x16')]);router[_0x3d73('0x17')](_0x3d73('0xa'),auth[_0x3d73('0x8')](),controller[_0x3d73('0x18')]);module[_0x3d73('0x19')]=router; \ No newline at end of file +var _0x978f=['get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x415819,_0x442ce0){var _0x4e48f1=function(_0x15fcda){while(--_0x15fcda){_0x415819['push'](_0x415819['shift']());}};_0x4e48f1(++_0x442ce0);}(_0x978f,0x8b));var _0xf978=function(_0x1f88d4,_0x3f2a9c){_0x1f88d4=_0x1f88d4-0x0;var _0x31970d=_0x978f[_0x1f88d4];return _0x31970d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf978('0x0'));var timeout=require('connect-timeout');var express=require(_0xf978('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf978('0x2'));var interaction=require(_0xf978('0x3'));var config=require(_0xf978('0x4'));var controller=require('./jscriptyProject.controller');router[_0xf978('0x5')]('/',auth[_0xf978('0x6')](),controller[_0xf978('0x7')]);router[_0xf978('0x5')](_0xf978('0x8'),auth['isAuthenticated'](),controller[_0xf978('0x9')]);router[_0xf978('0x5')](_0xf978('0xa'),auth[_0xf978('0x6')](),controller['getSessions']);router[_0xf978('0x5')](_0xf978('0xb'),auth['isAuthenticated'](),controller[_0xf978('0xc')]);router['get'](_0xf978('0xd'),auth[_0xf978('0x6')](),timeout(_0xf978('0xe')),controller[_0xf978('0xf')]);router[_0xf978('0x10')]('/',auth[_0xf978('0x6')](),controller[_0xf978('0x11')]);router[_0xf978('0x10')](_0xf978('0x12'),auth[_0xf978('0x6')](),controller[_0xf978('0x13')]);router[_0xf978('0x14')](_0xf978('0x8'),auth[_0xf978('0x6')](),controller[_0xf978('0x15')]);router[_0xf978('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf978('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a92c49d..98733e5 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 _0x9e43=['lodash','util','exports','STRING','name','long','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x219ed8,_0x6218dd){var _0x221f90=function(_0x1a63c7){while(--_0x1a63c7){_0x219ed8['push'](_0x219ed8['shift']());}};_0x221f90(++_0x6218dd);}(_0x9e43,0x1ef));var _0x39e4=function(_0x2e7c96,_0x27804d){_0x2e7c96=_0x2e7c96-0x0;var _0x36008e=_0x9e43[_0x2e7c96];return _0x36008e;};'use strict';var Sequelize=require(_0x39e4('0x0'));var _=require(_0x39e4('0x1'));var util=require(_0x39e4('0x2'));module[_0x39e4('0x3')]={'name':{'type':Sequelize[_0x39e4('0x4')],'unique':_0x39e4('0x5')},'description':{'type':Sequelize[_0x39e4('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x39e4('0x6')),'set':function(_0x2f077b){if(_['isObjectLike'](_0x2f077b)){this['setDataValue'](_0x39e4('0x7'),JSON[_0x39e4('0x8')](_0x2f077b));}else if(_[_0x39e4('0x9')](_0x2f077b)){this[_0x39e4('0xa')](_0x39e4('0x7'),_0x2f077b);}else{this['setDataValue'](_0x39e4('0x7'),util[_0x39e4('0xb')](_0x39e4('0xc'),this[_0x39e4('0xd')](_0x39e4('0x5'))||'',this[_0x39e4('0xd')](_0x39e4('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x39e4('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x39e4('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xf1bc=['sequelize','lodash','util','exports','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN'];(function(_0x250a2c,_0x461aac){var _0x259db7=function(_0x58d2e6){while(--_0x58d2e6){_0x250a2c['push'](_0x250a2c['shift']());}};_0x259db7(++_0x461aac);}(_0xf1bc,0x1a4));var _0xcf1b=function(_0x18bf85,_0x256390){_0x18bf85=_0x18bf85-0x0;var _0x46c78c=_0xf1bc[_0x18bf85];return _0x46c78c;};'use strict';var Sequelize=require(_0xcf1b('0x0'));var _=require(_0xcf1b('0x1'));var util=require(_0xcf1b('0x2'));module[_0xcf1b('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xcf1b('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xcf1b('0x5')),'set':function(_0x56968d){if(_[_0xcf1b('0x6')](_0x56968d)){this[_0xcf1b('0x7')](_0xcf1b('0x8'),JSON[_0xcf1b('0x9')](_0x56968d));}else if(_[_0xcf1b('0xa')](_0x56968d)){this['setDataValue']('formData',_0x56968d);}else{this[_0xcf1b('0x7')]('formData',util['format'](_0xcf1b('0xb'),this[_0xcf1b('0xc')](_0xcf1b('0xd'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcf1b('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcf1b('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index fd28bbf..8e1bcea 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 _0x3d45=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','Projects','UserProfileResource','name','send','index','map','JscriptyProject','rawAttributes','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','userProfileId','getSessions','JscriptySessionReport','order','pick','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','lodash','squel'];(function(_0x48f454,_0x55c38d){var _0x52f127=function(_0x2b5ad0){while(--_0x2b5ad0){_0x48f454['push'](_0x48f454['shift']());}};_0x52f127(++_0x55c38d);}(_0x3d45,0x1d2));var _0x53d4=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x3d45[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0x53d4('0x0'));var rimraf=require(_0x53d4('0x1'));var zipdir=require(_0x53d4('0x2'));var jsonpatch=require(_0x53d4('0x3'));var rp=require(_0x53d4('0x4'));var moment=require('moment');var BPromise=require(_0x53d4('0x5'));var Mustache=require(_0x53d4('0x6'));var util=require('util');var path=require(_0x53d4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53d4('0x8'));var squel=require(_0x53d4('0x9'));var crypto=require(_0x53d4('0xa'));var jsforce=require(_0x53d4('0xb'));var deskjs=require(_0x53d4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x53d4('0xd'));var Papa=require(_0x53d4('0xe'));var Redis=require(_0x53d4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x53d4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53d4('0x11'));var logger=require(_0x53d4('0x12'))(_0x53d4('0x13'));var utils=require(_0x53d4('0x14'));var config=require(_0x53d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x53d4('0x16'))['db'];function respondWithStatusCode(_0x11afa8,_0x445c6e){_0x445c6e=_0x445c6e||0xcc;return function(_0x4cd884){if(_0x4cd884){return _0x11afa8[_0x53d4('0x17')](_0x445c6e);}return _0x11afa8[_0x53d4('0x18')](_0x445c6e)['end']();};}function respondWithResult(_0x256409,_0x4999ac){_0x4999ac=_0x4999ac||0xc8;return function(_0x39e990){if(_0x39e990){return _0x256409[_0x53d4('0x18')](_0x4999ac)[_0x53d4('0x19')](_0x39e990);}};}function respondWithFilteredResult(_0x500d03,_0x136478){return function(_0x121bcb){if(_0x121bcb){var _0x1b2e0b=typeof _0x136478[_0x53d4('0x1a')]===_0x53d4('0x1b')&&typeof _0x136478['limit']===_0x53d4('0x1b');var _0x11a0fc=_0x121bcb['count'];var _0x5e5cbf=_0x1b2e0b?0x0:_0x136478[_0x53d4('0x1a')];var _0xfdde54=_0x1b2e0b?_0x121bcb[_0x53d4('0x1c')]:_0x136478['offset']+_0x136478[_0x53d4('0x1d')];var _0x463d8f;if(_0xfdde54>=_0x11a0fc){_0xfdde54=_0x11a0fc;_0x463d8f=0xc8;}else{_0x463d8f=0xce;}_0x500d03[_0x53d4('0x18')](_0x463d8f);return _0x500d03[_0x53d4('0x1e')](_0x53d4('0x1f'),_0x5e5cbf+'-'+_0xfdde54+'/'+_0x11a0fc)[_0x53d4('0x19')](_0x121bcb);}return null;};}function patchUpdates(_0x25ed73){return function(_0x3c3005){try{jsonpatch['apply'](_0x3c3005,_0x25ed73,!![]);}catch(_0x57dfd0){return BPromise['reject'](_0x57dfd0);}return _0x3c3005[_0x53d4('0x20')]();};}function saveUpdates(_0x557c63,_0x87fabf){return function(_0x3c8618){if(_0x3c8618){return _0x3c8618[_0x53d4('0x21')](_0x557c63)[_0x53d4('0x22')](function(_0x1de622){return _0x1de622;});}return null;};}function removeEntity(_0x1fb85f,_0x1c281d){return function(_0x3a2ff4){if(_0x3a2ff4){return _0x3a2ff4[_0x53d4('0x23')]()[_0x53d4('0x22')](function(){var _0x3b2b2e=_0x3a2ff4[_0x53d4('0x24')]({'plain':!![]});var _0x100d71=_0x53d4('0x25');return db[_0x53d4('0x26')][_0x53d4('0x23')]({'where':{'type':_0x100d71,'resourceId':_0x3b2b2e['id']}})[_0x53d4('0x22')](function(){return _0x3a2ff4;});})[_0x53d4('0x22')](function(){_0x1fb85f[_0x53d4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7946,_0x11540f){return function(_0x2a7259){if(!_0x2a7259){_0x4f7946[_0x53d4('0x17')](0x194);}return _0x2a7259;};}function handleError(_0x48536d,_0x3e466c){_0x3e466c=_0x3e466c||0x1f4;return function(_0x445cc3){logger['error'](_0x445cc3['stack']);if(_0x445cc3['name']){delete _0x445cc3[_0x53d4('0x27')];}_0x48536d[_0x53d4('0x18')](_0x3e466c)[_0x53d4('0x28')](_0x445cc3);};}exports[_0x53d4('0x29')]=function(_0x26e9f9,_0x547eb9){var _0x19d00c={},_0x5a3d55={},_0xd46306={'count':0x0,'rows':[]};var _0x2801e7=_[_0x53d4('0x2a')](db[_0x53d4('0x2b')][_0x53d4('0x2c')],function(_0x1c7621){return{'name':_0x1c7621['fieldName'],'type':_0x1c7621['type'][_0x53d4('0x2d')]};});_0x5a3d55['model']=_['map'](_0x2801e7,_0x53d4('0x27'));_0x5a3d55[_0x53d4('0x2e')]=_[_0x53d4('0x2f')](_0x26e9f9[_0x53d4('0x2e')]);_0x5a3d55['filters']=_['intersection'](_0x5a3d55[_0x53d4('0x30')],_0x5a3d55[_0x53d4('0x2e')]);_0x19d00c[_0x53d4('0x31')]=_[_0x53d4('0x32')](_0x5a3d55[_0x53d4('0x30')],qs[_0x53d4('0x33')](_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x33')]));_0x19d00c[_0x53d4('0x31')]=_0x19d00c[_0x53d4('0x31')][_0x53d4('0x34')]?_0x19d00c[_0x53d4('0x31')]:_0x5a3d55[_0x53d4('0x30')];if(!_0x26e9f9['query'][_0x53d4('0x35')](_0x53d4('0x36'))){_0x19d00c[_0x53d4('0x1d')]=qs[_0x53d4('0x1d')](_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x1d')]);_0x19d00c[_0x53d4('0x1a')]=qs[_0x53d4('0x1a')](_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x1a')]);}_0x19d00c['order']=qs['sort'](_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x37')]);_0x19d00c['where']=qs[_0x53d4('0x38')](_['pick'](_0x26e9f9[_0x53d4('0x2e')],_0x5a3d55['filters']),_0x2801e7);if(_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x39')]){_0x19d00c[_0x53d4('0x3a')]=_[_0x53d4('0x3b')](_0x19d00c[_0x53d4('0x3a')],{'$or':_['map'](_0x2801e7,function(_0x1e24a2){if(_0x1e24a2[_0x53d4('0x3c')]!==_0x53d4('0x3d')){var _0x5d14a3={};_0x5d14a3[_0x1e24a2[_0x53d4('0x27')]]={'$like':'%'+_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x39')]+'%'};return _0x5d14a3;}})});}_0x19d00c=_['merge']({},_0x19d00c,_0x26e9f9[_0x53d4('0x3e')]);var _0x7aacb2={'where':_0x19d00c[_0x53d4('0x3a')]};return db['JscriptyProject']['count'](_0x7aacb2)[_0x53d4('0x22')](function(_0x34c46e){_0xd46306[_0x53d4('0x1c')]=_0x34c46e;if(_0x26e9f9[_0x53d4('0x2e')][_0x53d4('0x3f')]){_0x19d00c['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x53d4('0x40')](_0x19d00c);})[_0x53d4('0x22')](function(_0x407fc2){_0xd46306[_0x53d4('0x41')]=_0x407fc2;return _0xd46306;})[_0x53d4('0x22')](respondWithFilteredResult(_0x547eb9,_0x19d00c))['catch'](handleError(_0x547eb9,null));};exports[_0x53d4('0x42')]=function(_0x26ada0,_0x25c915){var _0x260b84={'raw':![],'where':{'id':_0x26ada0[_0x53d4('0x43')]['id']}},_0x52bd62={};_0x52bd62[_0x53d4('0x30')]=_[_0x53d4('0x2f')](db['JscriptyProject'][_0x53d4('0x2c')]);_0x52bd62[_0x53d4('0x2e')]=_[_0x53d4('0x2f')](_0x26ada0[_0x53d4('0x2e')]);_0x52bd62[_0x53d4('0x38')]=_[_0x53d4('0x32')](_0x52bd62[_0x53d4('0x30')],_0x52bd62[_0x53d4('0x2e')]);_0x260b84[_0x53d4('0x31')]=_[_0x53d4('0x32')](_0x52bd62[_0x53d4('0x30')],qs[_0x53d4('0x33')](_0x26ada0['query'][_0x53d4('0x33')]));_0x260b84[_0x53d4('0x31')]=_0x260b84['attributes'][_0x53d4('0x34')]?_0x260b84[_0x53d4('0x31')]:_0x52bd62[_0x53d4('0x30')];if(_0x26ada0['query'][_0x53d4('0x3f')]){_0x260b84[_0x53d4('0x44')]=[{'all':!![]}];}_0x260b84=_[_0x53d4('0x3b')]({},_0x260b84,_0x26ada0[_0x53d4('0x3e')]);return db[_0x53d4('0x2b')][_0x53d4('0x45')](_0x260b84)['then'](handleEntityNotFound(_0x25c915,null))[_0x53d4('0x22')](respondWithResult(_0x25c915,null))[_0x53d4('0x46')](handleError(_0x25c915,null));};exports['create']=function(_0x42395f,_0x5d379a){return db[_0x53d4('0x2b')][_0x53d4('0x47')](_0x42395f['body'],{})[_0x53d4('0x22')](function(_0x207603){var _0x34924d=_0x42395f[_0x53d4('0x48')][_0x53d4('0x24')]({'plain':!![]});if(!_0x34924d)throw new Error(_0x53d4('0x49'));if(_0x34924d[_0x53d4('0x4a')]===_0x53d4('0x48')){var _0x1457ce=_0x207603[_0x53d4('0x24')]({'plain':!![]});var _0x2c7f8d=_0x53d4('0x25');return db[_0x53d4('0x4b')][_0x53d4('0x45')]({'where':{'name':_0x2c7f8d,'userProfileId':_0x34924d['userProfileId']},'raw':!![]})[_0x53d4('0x22')](function(_0x23f3d2){if(_0x23f3d2&&_0x23f3d2[_0x53d4('0x4c')]===0x0){return db[_0x53d4('0x26')]['create']({'name':_0x1457ce[_0x53d4('0x27')],'resourceId':_0x1457ce['id'],'type':_0x23f3d2[_0x53d4('0x27')],'sectionId':_0x23f3d2['id']},{})[_0x53d4('0x22')](function(){return _0x207603;});}else{return _0x207603;}})[_0x53d4('0x46')](function(_0x5f5533){logger[_0x53d4('0x4d')](_0x53d4('0x4e'),_0x5f5533);throw _0x5f5533;});}return _0x207603;})[_0x53d4('0x22')](respondWithResult(_0x5d379a,0xc9))[_0x53d4('0x46')](handleError(_0x5d379a,null));};exports[_0x53d4('0x4f')]=function(_0x44c07e,_0x508eba){var _0x111db5={'where':{'id':_0x44c07e[_0x53d4('0x43')]['id']}},_0x19b147={};_0x19b147['model']=_['keys'](db['JscriptyProject'][_0x53d4('0x2c')]);_0x111db5[_0x53d4('0x31')]=_[_0x53d4('0x32')](_0x19b147[_0x53d4('0x30')],qs[_0x53d4('0x33')](_0x44c07e[_0x53d4('0x2e')]['fields']));_0x111db5['attributes']=_0x111db5[_0x53d4('0x31')][_0x53d4('0x34')]?_0x111db5[_0x53d4('0x31')]:_0x19b147[_0x53d4('0x30')];if(_0x44c07e['query'][_0x53d4('0x3f')]){_0x111db5[_0x53d4('0x44')]=[{'all':!![]}];}_0x111db5=_['merge']({},_0x111db5,_0x44c07e[_0x53d4('0x3e')]);return db[_0x53d4('0x2b')]['find'](_0x111db5)[_0x53d4('0x22')](handleEntityNotFound(_0x508eba,null))[_0x53d4('0x22')](function(_0x39aaae){if(_0x39aaae){var _0x21a169=_0x39aaae[_0x53d4('0x24')]({'plain':!![]});_0x21a169=qs[_0x53d4('0x50')](_0x21a169,['id','createdAt',_0x53d4('0x51')]);_0x44c07e['body']=_[_0x53d4('0x50')](_0x44c07e[_0x53d4('0x52')],['id',_0x53d4('0x53'),_0x53d4('0x51')]);return db[_0x53d4('0x2b')][_0x53d4('0x47')](_[_0x53d4('0x3b')](_0x21a169,_0x44c07e['body']),{'include':_0x44c07e[_0x53d4('0x2e')][_0x53d4('0x3f')]?[{'all':!![]}]:undefined})[_0x53d4('0x22')](function(_0x568585){var _0x15c627=_0x44c07e['user'][_0x53d4('0x24')]({'plain':!![]});if(!_0x15c627)throw new Error(_0x53d4('0x49'));if(_0x15c627[_0x53d4('0x4a')]===_0x53d4('0x48')){var _0x179cca=_0x568585[_0x53d4('0x24')]({'plain':!![]});var _0x4b62e2='Projects';return db[_0x53d4('0x4b')]['find']({'where':{'name':_0x4b62e2,'userProfileId':_0x15c627[_0x53d4('0x54')]},'raw':!![]})[_0x53d4('0x22')](function(_0xee1573){if(_0xee1573&&_0xee1573[_0x53d4('0x4c')]===0x0){return db[_0x53d4('0x26')][_0x53d4('0x47')]({'name':_0x179cca['name'],'resourceId':_0x179cca['id'],'type':_0xee1573[_0x53d4('0x27')],'sectionId':_0xee1573['id']},{})[_0x53d4('0x22')](function(){return _0x568585;});}else{return _0x568585;}})[_0x53d4('0x46')](function(_0x4efcaa){logger[_0x53d4('0x4d')](_0x53d4('0x4e'),_0x4efcaa);throw _0x4efcaa;});}return _0x568585;});}})['then'](respondWithResult(_0x508eba,0xc9))[_0x53d4('0x46')](handleError(_0x508eba,null));};exports['update']=function(_0x1c626e,_0x58ec9d){if(_0x1c626e[_0x53d4('0x52')]['id']){delete _0x1c626e['body']['id'];}return db[_0x53d4('0x2b')][_0x53d4('0x45')]({'where':{'id':_0x1c626e['params']['id']}})[_0x53d4('0x22')](handleEntityNotFound(_0x58ec9d,null))[_0x53d4('0x22')](saveUpdates(_0x1c626e[_0x53d4('0x52')],null))[_0x53d4('0x22')](respondWithResult(_0x58ec9d,null))[_0x53d4('0x46')](handleError(_0x58ec9d,null));};exports[_0x53d4('0x23')]=function(_0x12a06c,_0x331c5e){return db[_0x53d4('0x2b')][_0x53d4('0x45')]({'where':{'id':_0x12a06c[_0x53d4('0x43')]['id']}})[_0x53d4('0x22')](handleEntityNotFound(_0x331c5e,null))['then'](removeEntity(_0x331c5e,null))['catch'](handleError(_0x331c5e,null));};exports[_0x53d4('0x55')]=function(_0x428f74,_0x312001,_0x3e58ec){var _0x2f6f62={'raw':!![],'where':{}};var _0x5c7dfa={};var _0x44cdf6={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x428f74[_0x53d4('0x43')]['id']}})[_0x53d4('0x22')](handleEntityNotFound(_0x312001,null))[_0x53d4('0x22')](function(_0x4f8550){if(_0x4f8550){_0x5c7dfa[_0x53d4('0x30')]=_['keys'](db[_0x53d4('0x56')][_0x53d4('0x2c')]);_0x5c7dfa[_0x53d4('0x2e')]=_[_0x53d4('0x2f')](_0x428f74[_0x53d4('0x2e')]);_0x5c7dfa['filters']=_['intersection'](_0x5c7dfa['model'],_0x5c7dfa[_0x53d4('0x2e')]);_0x2f6f62[_0x53d4('0x31')]=_['intersection'](_0x5c7dfa[_0x53d4('0x30')],qs['fields'](_0x428f74[_0x53d4('0x2e')][_0x53d4('0x33')]));_0x2f6f62['attributes']=_0x2f6f62[_0x53d4('0x31')][_0x53d4('0x34')]?_0x2f6f62[_0x53d4('0x31')]:_0x5c7dfa[_0x53d4('0x30')];if(!_0x428f74[_0x53d4('0x2e')][_0x53d4('0x35')]('nolimit')){_0x2f6f62[_0x53d4('0x1d')]=qs[_0x53d4('0x1d')](_0x428f74[_0x53d4('0x2e')][_0x53d4('0x1d')]);_0x2f6f62[_0x53d4('0x1a')]=qs[_0x53d4('0x1a')](_0x428f74[_0x53d4('0x2e')][_0x53d4('0x1a')]);}_0x2f6f62[_0x53d4('0x57')]=qs['sort'](_0x428f74[_0x53d4('0x2e')][_0x53d4('0x37')]);_0x2f6f62[_0x53d4('0x3a')]=qs[_0x53d4('0x38')](_[_0x53d4('0x58')](_0x428f74['query'],_0x5c7dfa[_0x53d4('0x38')]));_0x2f6f62[_0x53d4('0x3a')][_0x53d4('0x59')]=_0x4f8550['id'];if(_0x428f74[_0x53d4('0x2e')][_0x53d4('0x39')]){_0x2f6f62['where']=_[_0x53d4('0x3b')](_0x2f6f62[_0x53d4('0x3a')],{'$or':_[_0x53d4('0x2a')](_0x2f6f62[_0x53d4('0x31')],function(_0x1b2566){var _0x41d07a={};_0x41d07a[_0x1b2566]={'$like':'%'+_0x428f74[_0x53d4('0x2e')][_0x53d4('0x39')]+'%'};return _0x41d07a;})});}_0x2f6f62=_[_0x53d4('0x3b')]({},_0x2f6f62,_0x428f74['options']);return db[_0x53d4('0x56')][_0x53d4('0x1c')]({'where':_0x2f6f62[_0x53d4('0x3a')]})[_0x53d4('0x22')](function(_0x3a548c){_0x44cdf6[_0x53d4('0x1c')]=_0x3a548c;if(_0x428f74[_0x53d4('0x2e')][_0x53d4('0x3f')]){_0x2f6f62[_0x53d4('0x44')]=[{'all':!![]}];}return db[_0x53d4('0x56')][_0x53d4('0x40')](_0x2f6f62);})[_0x53d4('0x22')](function(_0x47f64a){_0x44cdf6['rows']=_0x47f64a;return _0x44cdf6;});}})[_0x53d4('0x22')](respondWithFilteredResult(_0x312001,_0x2f6f62))[_0x53d4('0x46')](handleError(_0x312001,null));};exports[_0x53d4('0x5a')]=function(_0x5605f5,_0xd8ab1d,_0x81d7b6){var _0xa94ecd={'raw':!![],'where':{}};var _0x1807ab={};var _0x59bf7a={'count':0x0,'rows':[]};return db[_0x53d4('0x2b')][_0x53d4('0x5b')]({'where':{'id':_0x5605f5[_0x53d4('0x43')]['id']}})['then'](handleEntityNotFound(_0xd8ab1d,null))[_0x53d4('0x22')](function(_0x4a8e53){if(_0x4a8e53){_0x1807ab[_0x53d4('0x30')]=_['keys'](db[_0x53d4('0x5c')][_0x53d4('0x2c')]);_0x1807ab[_0x53d4('0x2e')]=_[_0x53d4('0x2f')](_0x5605f5['query']);_0x1807ab[_0x53d4('0x38')]=_['intersection'](_0x1807ab[_0x53d4('0x30')],_0x1807ab['query']);_0xa94ecd[_0x53d4('0x31')]=_['intersection'](_0x1807ab['model'],qs[_0x53d4('0x33')](_0x5605f5[_0x53d4('0x2e')][_0x53d4('0x33')]));_0xa94ecd[_0x53d4('0x31')]=_0xa94ecd[_0x53d4('0x31')][_0x53d4('0x34')]?_0xa94ecd[_0x53d4('0x31')]:_0x1807ab[_0x53d4('0x30')];if(!_0x5605f5['query'][_0x53d4('0x35')](_0x53d4('0x36'))){_0xa94ecd[_0x53d4('0x1d')]=qs[_0x53d4('0x1d')](_0x5605f5[_0x53d4('0x2e')]['limit']);_0xa94ecd[_0x53d4('0x1a')]=qs['offset'](_0x5605f5[_0x53d4('0x2e')][_0x53d4('0x1a')]);}_0xa94ecd['order']=qs[_0x53d4('0x37')](_0x5605f5[_0x53d4('0x2e')][_0x53d4('0x37')]);_0xa94ecd['where']=qs[_0x53d4('0x38')](_[_0x53d4('0x58')](_0x5605f5[_0x53d4('0x2e')],_0x1807ab['filters']));_0xa94ecd['where'][_0x53d4('0x59')]=_0x4a8e53['id'];if(_0x5605f5['query'][_0x53d4('0x39')]){_0xa94ecd['where']=_['merge'](_0xa94ecd['where'],{'$or':_['map'](_0xa94ecd[_0x53d4('0x31')],function(_0x1e19af){var _0x327539={};_0x327539[_0x1e19af]={'$like':'%'+_0x5605f5[_0x53d4('0x2e')][_0x53d4('0x39')]+'%'};return _0x327539;})});}_0xa94ecd=_[_0x53d4('0x3b')]({},_0xa94ecd,_0x5605f5[_0x53d4('0x3e')]);return db[_0x53d4('0x5c')][_0x53d4('0x1c')]({'where':_0xa94ecd[_0x53d4('0x3a')]})['then'](function(_0x1db3c6){_0x59bf7a[_0x53d4('0x1c')]=_0x1db3c6;if(_0x5605f5[_0x53d4('0x2e')][_0x53d4('0x3f')]){_0xa94ecd['include']=[{'all':!![]}];}return db[_0x53d4('0x5c')][_0x53d4('0x40')](_0xa94ecd);})[_0x53d4('0x22')](function(_0x583a4d){_0x59bf7a['rows']=_0x583a4d;return _0x59bf7a;});}})[_0x53d4('0x22')](respondWithFilteredResult(_0xd8ab1d,_0xa94ecd))[_0x53d4('0x46')](handleError(_0xd8ab1d,null));};function char(_0x5350a4){return _0x53d4('0x5d')===typeof _0x5350a4?String[_0x53d4('0x5e')][_0x53d4('0x5f')](null,arguments):_0x5350a4;}function needsEncapsulation(_0x1db2f5){return!!_0x1db2f5&&(_0x1db2f5[_0x53d4('0x60')]()[_0x53d4('0x61')](char(0xd))>=0x0||_0x1db2f5['toString']()['indexOf'](char(0xa))>=0x0||_0x1db2f5[_0x53d4('0x60')]()[_0x53d4('0x61')](char(0x2c))>=0x0||_0x1db2f5[_0x53d4('0x60')]()[_0x53d4('0x61')](char(0x22))>=0x0);}function encapsulate(_0x168e3c){var _0x4da253=char(0x22),_0x5049d1='\x5c'+char(0x22),_0x4f9d00=_0x168e3c[_0x53d4('0x60')]()['replace'](new RegExp(_0x4da253,'g'),_0x5049d1);return _0x4da253+_0x4f9d00+_0x4da253;}exports[_0x53d4('0x62')]=function(_0xc34f1f,_0x50dacb,_0x3b7d6f){var _0x14d14c,_0x3f8dd7;var _0x429389={'where':{'ProjectId':_0xc34f1f[_0x53d4('0x43')]['id']}};if(_0xc34f1f[_0x53d4('0x2e')][_0x53d4('0x63')]){_0x429389[_0x53d4('0x3a')][_0x53d4('0x64')]=JSON[_0x53d4('0x65')](_0xc34f1f[_0x53d4('0x2e')][_0x53d4('0x63')]);}return db[_0x53d4('0x56')][_0x53d4('0x40')](_0x429389)[_0x53d4('0x22')](handleEntityNotFound(_0x50dacb,null))[_0x53d4('0x22')](function(_0x156f4f){if(_0x156f4f){_0x14d14c=_0x156f4f;return db[_0x53d4('0x66')][_0x53d4('0x40')]({'where':{'SessionId':{'$in':_[_0x53d4('0x2a')](_0x14d14c,'id')},'ProjectId':_0xc34f1f[_0x53d4('0x43')]['id']},'order':_0x53d4('0x67')});}})[_0x53d4('0x22')](handleEntityNotFound(_0x50dacb,null))[_0x53d4('0x22')](function(_0x349e8e){if(_0x349e8e){_0x3f8dd7=_0x349e8e;var _0x304bbd={};for(var _0x5b689c=0x0,_0x49a9b4=_0x3f8dd7['length'];_0x5b689c<_0x49a9b4;_0x5b689c++){if(!_0x304bbd[_0x53d4('0x35')](_0x3f8dd7[_0x5b689c][_0x53d4('0x68')])){_0x304bbd[_0x3f8dd7[_0x5b689c][_0x53d4('0x68')]]=needsEncapsulation(_0x3f8dd7[_0x5b689c][_0x53d4('0x69')])?encapsulate(_0x3f8dd7[_0x5b689c][_0x53d4('0x69')]):_0x3f8dd7[_0x5b689c]['question'];}}var _0x719b52=[],_0x1ae506={};for(var _0x4bcc92=0x0,_0x4e46ff=_0x14d14c[_0x53d4('0x34')];_0x4bcc92<_0x4e46ff;_0x4bcc92++){_0x1ae506={'ProjectId':_0xc34f1f[_0x53d4('0x43')]['id'],'SessionId':_0x14d14c[_0x4bcc92]['id'],'StartTime':moment(_0x14d14c[_0x4bcc92][_0x53d4('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5f66ff=0x0,_0x53984b=_0x3f8dd7[_0x53d4('0x34')];_0x5f66ff<_0x53984b;_0x5f66ff++){if(_0x3f8dd7[_0x5f66ff][_0x53d4('0x6a')]==_0x14d14c[_0x4bcc92]['id']&&_0x304bbd[_0x53d4('0x35')](_0x3f8dd7[_0x5f66ff][_0x53d4('0x68')])){_0x1ae506[_0x304bbd[_0x3f8dd7[_0x5f66ff][_0x53d4('0x68')]]]=_0x3f8dd7[_0x5f66ff]['answer'];}}for(var _0x233fca in _0x304bbd){if(!_0x1ae506[_0x53d4('0x35')](_0x304bbd[_0x233fca])){_0x1ae506[_0x304bbd[_0x233fca]]=null;}}_0x719b52[_0x53d4('0x6b')](_0x1ae506);}return _0x719b52;}})[_0x53d4('0x22')](function(_0x5b33a0){if(!_[_0x53d4('0x6c')](_0x5b33a0)){var _0xee12cc=toCsv(_0x5b33a0);var _0x2f09b3=Date[_0x53d4('0x6d')]();fs[_0x53d4('0x6e')](util['format'](_0x53d4('0x6f'),_0xc34f1f[_0x53d4('0x43')]['id'],_0x2f09b3),_0xee12cc);_0x50dacb['setHeader'](_0x53d4('0x70'),_0x53d4('0x71')+util[_0x53d4('0x72')](_0x53d4('0x73'),_0xc34f1f[_0x53d4('0x43')]['id'],_0x2f09b3));_0x50dacb[_0x53d4('0x74')](_0x53d4('0x75'),_0x53d4('0x76'));return _0x50dacb['download'](util[_0x53d4('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xc34f1f[_0x53d4('0x43')]['id'],_0x2f09b3));}else{return _0x50dacb[_0x53d4('0x17')](0xcc);}})['catch'](handleError(_0x50dacb,null));}; \ No newline at end of file +var _0x1a83=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','end','sendStatus','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','keys','include','options','create','body','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','length','createdAt','updatedAt','omit','user','UserProfileSection','userProfileId','error','getSessions','findOne','JscriptySessionReport','sort','ProjectId','getAnswers','JscriptyAnswerReport','toString','indexOf','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','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','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1a83,0x1c0));var _0x31a8=function(_0x962edb,_0x5dd356){_0x962edb=_0x962edb-0x0;var _0x359dcf=_0x1a83[_0x962edb];return _0x359dcf;};'use strict';var emlformat=require(_0x31a8('0x0'));var rimraf=require(_0x31a8('0x1'));var zipdir=require(_0x31a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31a8('0x3'));var moment=require('moment');var BPromise=require(_0x31a8('0x4'));var Mustache=require(_0x31a8('0x5'));var util=require(_0x31a8('0x6'));var path=require(_0x31a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x31a8('0x8'));var fs=require('fs');var fs_extra=require(_0x31a8('0x9'));var _=require(_0x31a8('0xa'));var squel=require(_0x31a8('0xb'));var crypto=require(_0x31a8('0xc'));var jsforce=require(_0x31a8('0xd'));var deskjs=require(_0x31a8('0xe'));var toCsv=require(_0x31a8('0xf'));var querystring=require(_0x31a8('0x10'));var Papa=require(_0x31a8('0x11'));var Redis=require('ioredis');var authService=require(_0x31a8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31a8('0x13'));var logger=require(_0x31a8('0x14'))('api');var utils=require(_0x31a8('0x15'));var config=require(_0x31a8('0x16'));var licenseUtil=require(_0x31a8('0x17'));var db=require(_0x31a8('0x18'))['db'];function respondWithStatusCode(_0x5483c9,_0x4d43a0){_0x4d43a0=_0x4d43a0||0xcc;return function(_0x115b64){if(_0x115b64){return _0x5483c9['sendStatus'](_0x4d43a0);}return _0x5483c9[_0x31a8('0x19')](_0x4d43a0)['end']();};}function respondWithResult(_0x3eef21,_0x38e4cf){_0x38e4cf=_0x38e4cf||0xc8;return function(_0x18c03){if(_0x18c03){return _0x3eef21['status'](_0x38e4cf)[_0x31a8('0x1a')](_0x18c03);}};}function respondWithFilteredResult(_0x50992d,_0x55fd31){return function(_0x97f9a2){if(_0x97f9a2){var _0x5c7c31=typeof _0x55fd31[_0x31a8('0x1b')]===_0x31a8('0x1c')&&typeof _0x55fd31['limit']===_0x31a8('0x1c');var _0x3bbbfa=_0x97f9a2[_0x31a8('0x1d')];var _0xf7da4b=_0x5c7c31?0x0:_0x55fd31[_0x31a8('0x1b')];var _0x39105b=_0x5c7c31?_0x97f9a2['count']:_0x55fd31[_0x31a8('0x1b')]+_0x55fd31[_0x31a8('0x1e')];var _0x524a24;if(_0x39105b>=_0x3bbbfa){_0x39105b=_0x3bbbfa;_0x524a24=0xc8;}else{_0x524a24=0xce;}_0x50992d[_0x31a8('0x19')](_0x524a24);return _0x50992d[_0x31a8('0x1f')](_0x31a8('0x20'),_0xf7da4b+'-'+_0x39105b+'/'+_0x3bbbfa)[_0x31a8('0x1a')](_0x97f9a2);}return null;};}function patchUpdates(_0x552af8){return function(_0x3a446e){try{jsonpatch[_0x31a8('0x21')](_0x3a446e,_0x552af8,!![]);}catch(_0x35da7b){return BPromise[_0x31a8('0x22')](_0x35da7b);}return _0x3a446e[_0x31a8('0x23')]();};}function saveUpdates(_0x27735b,_0x245e01){return function(_0x2ea40b){if(_0x2ea40b){return _0x2ea40b[_0x31a8('0x24')](_0x27735b)['then'](function(_0x48a0d2){return _0x48a0d2;});}return null;};}function removeEntity(_0x13105b,_0x4cee68){return function(_0x20ef8c){if(_0x20ef8c){return _0x20ef8c[_0x31a8('0x25')]()[_0x31a8('0x26')](function(){var _0x4eaafd=_0x20ef8c[_0x31a8('0x27')]({'plain':!![]});var _0x79ceeb=_0x31a8('0x28');return db[_0x31a8('0x29')][_0x31a8('0x25')]({'where':{'type':_0x79ceeb,'resourceId':_0x4eaafd['id']}})[_0x31a8('0x26')](function(){return _0x20ef8c;});})[_0x31a8('0x26')](function(){_0x13105b['status'](0xcc)[_0x31a8('0x2a')]();});}};}function handleEntityNotFound(_0x4a1e58,_0x419a03){return function(_0xa9e04f){if(!_0xa9e04f){_0x4a1e58[_0x31a8('0x2b')](0x194);}return _0xa9e04f;};}function handleError(_0x719cd2,_0x5e2d6a){_0x5e2d6a=_0x5e2d6a||0x1f4;return function(_0x510641){logger['error'](_0x510641['stack']);if(_0x510641[_0x31a8('0x2c')]){delete _0x510641[_0x31a8('0x2c')];}_0x719cd2[_0x31a8('0x19')](_0x5e2d6a)[_0x31a8('0x2d')](_0x510641);};}exports[_0x31a8('0x2e')]=function(_0x47f9f9,_0x13383c){var _0x52679e={},_0x5aa4a4={},_0x371120={'count':0x0,'rows':[]};var _0x1292d4=_[_0x31a8('0x2f')](db[_0x31a8('0x30')][_0x31a8('0x31')],function(_0x8a2de0){return{'name':_0x8a2de0[_0x31a8('0x32')],'type':_0x8a2de0[_0x31a8('0x33')]['key']};});_0x5aa4a4[_0x31a8('0x34')]=_['map'](_0x1292d4,_0x31a8('0x2c'));_0x5aa4a4[_0x31a8('0x35')]=_['keys'](_0x47f9f9['query']);_0x5aa4a4[_0x31a8('0x36')]=_[_0x31a8('0x37')](_0x5aa4a4[_0x31a8('0x34')],_0x5aa4a4[_0x31a8('0x35')]);_0x52679e['attributes']=_[_0x31a8('0x37')](_0x5aa4a4[_0x31a8('0x34')],qs['fields'](_0x47f9f9['query'][_0x31a8('0x38')]));_0x52679e[_0x31a8('0x39')]=_0x52679e['attributes']['length']?_0x52679e[_0x31a8('0x39')]:_0x5aa4a4[_0x31a8('0x34')];if(!_0x47f9f9['query'][_0x31a8('0x3a')](_0x31a8('0x3b'))){_0x52679e[_0x31a8('0x1e')]=qs['limit'](_0x47f9f9['query'][_0x31a8('0x1e')]);_0x52679e[_0x31a8('0x1b')]=qs[_0x31a8('0x1b')](_0x47f9f9['query']['offset']);}_0x52679e[_0x31a8('0x3c')]=qs['sort'](_0x47f9f9[_0x31a8('0x35')]['sort']);_0x52679e['where']=qs[_0x31a8('0x36')](_[_0x31a8('0x3d')](_0x47f9f9[_0x31a8('0x35')],_0x5aa4a4[_0x31a8('0x36')]),_0x1292d4);if(_0x47f9f9['query']['filter']){_0x52679e[_0x31a8('0x3e')]=_['merge'](_0x52679e[_0x31a8('0x3e')],{'$or':_['map'](_0x1292d4,function(_0xad89c8){if(_0xad89c8[_0x31a8('0x33')]!==_0x31a8('0x3f')){var _0x3272d6={};_0x3272d6[_0xad89c8[_0x31a8('0x2c')]]={'$like':'%'+_0x47f9f9[_0x31a8('0x35')][_0x31a8('0x40')]+'%'};return _0x3272d6;}})});}_0x52679e=_[_0x31a8('0x41')]({},_0x52679e,_0x47f9f9['options']);var _0x19c005={'where':_0x52679e['where']};return db[_0x31a8('0x30')][_0x31a8('0x1d')](_0x19c005)['then'](function(_0x3267e0){_0x371120['count']=_0x3267e0;if(_0x47f9f9['query'][_0x31a8('0x42')]){_0x52679e['include']=[{'all':!![]}];}return db[_0x31a8('0x30')][_0x31a8('0x43')](_0x52679e);})[_0x31a8('0x26')](function(_0xbe59d6){_0x371120[_0x31a8('0x44')]=_0xbe59d6;return _0x371120;})['then'](respondWithFilteredResult(_0x13383c,_0x52679e))[_0x31a8('0x45')](handleError(_0x13383c,null));};exports['show']=function(_0x428a2a,_0x2a030a){var _0x3e56cc={'raw':![],'where':{'id':_0x428a2a['params']['id']}},_0x5abec1={};_0x5abec1[_0x31a8('0x34')]=_[_0x31a8('0x46')](db[_0x31a8('0x30')][_0x31a8('0x31')]);_0x5abec1['query']=_[_0x31a8('0x46')](_0x428a2a['query']);_0x5abec1[_0x31a8('0x36')]=_['intersection'](_0x5abec1[_0x31a8('0x34')],_0x5abec1[_0x31a8('0x35')]);_0x3e56cc[_0x31a8('0x39')]=_['intersection'](_0x5abec1[_0x31a8('0x34')],qs[_0x31a8('0x38')](_0x428a2a[_0x31a8('0x35')][_0x31a8('0x38')]));_0x3e56cc[_0x31a8('0x39')]=_0x3e56cc[_0x31a8('0x39')]['length']?_0x3e56cc[_0x31a8('0x39')]:_0x5abec1[_0x31a8('0x34')];if(_0x428a2a[_0x31a8('0x35')]['includeAll']){_0x3e56cc[_0x31a8('0x47')]=[{'all':!![]}];}_0x3e56cc=_['merge']({},_0x3e56cc,_0x428a2a[_0x31a8('0x48')]);return db[_0x31a8('0x30')]['find'](_0x3e56cc)[_0x31a8('0x26')](handleEntityNotFound(_0x2a030a,null))[_0x31a8('0x26')](respondWithResult(_0x2a030a,null))[_0x31a8('0x45')](handleError(_0x2a030a,null));};exports['create']=function(_0xc93536,_0x312704){return db[_0x31a8('0x30')][_0x31a8('0x49')](_0xc93536[_0x31a8('0x4a')],{})[_0x31a8('0x26')](function(_0x48184f){var _0x296493=_0xc93536['user'][_0x31a8('0x27')]({'plain':!![]});if(!_0x296493)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x296493[_0x31a8('0x4b')]==='user'){var _0xeba488=_0x48184f[_0x31a8('0x27')]({'plain':!![]});var _0xe0cb63=_0x31a8('0x28');return db['UserProfileSection'][_0x31a8('0x4c')]({'where':{'name':_0xe0cb63,'userProfileId':_0x296493['userProfileId']},'raw':!![]})[_0x31a8('0x26')](function(_0x41e0a1){if(_0x41e0a1&&_0x41e0a1['autoAssociation']===0x0){return db[_0x31a8('0x29')][_0x31a8('0x49')]({'name':_0xeba488[_0x31a8('0x2c')],'resourceId':_0xeba488['id'],'type':_0x41e0a1[_0x31a8('0x2c')],'sectionId':_0x41e0a1['id']},{})['then'](function(){return _0x48184f;});}else{return _0x48184f;}})[_0x31a8('0x45')](function(_0x37693b){logger['error'](_0x31a8('0x4d'),_0x37693b);throw _0x37693b;});}return _0x48184f;})[_0x31a8('0x26')](respondWithResult(_0x312704,0xc9))[_0x31a8('0x45')](handleError(_0x312704,null));};exports[_0x31a8('0x4e')]=function(_0x8d9f0e,_0xb59b85){var _0x12425f={'where':{'id':_0x8d9f0e[_0x31a8('0x4f')]['id']}},_0x87dd88={};_0x87dd88[_0x31a8('0x34')]=_['keys'](db[_0x31a8('0x30')]['rawAttributes']);_0x12425f[_0x31a8('0x39')]=_[_0x31a8('0x37')](_0x87dd88[_0x31a8('0x34')],qs[_0x31a8('0x38')](_0x8d9f0e[_0x31a8('0x35')]['fields']));_0x12425f[_0x31a8('0x39')]=_0x12425f[_0x31a8('0x39')][_0x31a8('0x50')]?_0x12425f[_0x31a8('0x39')]:_0x87dd88[_0x31a8('0x34')];if(_0x8d9f0e[_0x31a8('0x35')][_0x31a8('0x42')]){_0x12425f[_0x31a8('0x47')]=[{'all':!![]}];}_0x12425f=_[_0x31a8('0x41')]({},_0x12425f,_0x8d9f0e[_0x31a8('0x48')]);return db[_0x31a8('0x30')][_0x31a8('0x4c')](_0x12425f)[_0x31a8('0x26')](handleEntityNotFound(_0xb59b85,null))[_0x31a8('0x26')](function(_0x201421){if(_0x201421){var _0x4eaf70=_0x201421[_0x31a8('0x27')]({'plain':!![]});_0x4eaf70=qs['omit'](_0x4eaf70,['id',_0x31a8('0x51'),_0x31a8('0x52')]);_0x8d9f0e['body']=_[_0x31a8('0x53')](_0x8d9f0e[_0x31a8('0x4a')],['id',_0x31a8('0x51'),_0x31a8('0x52')]);return db[_0x31a8('0x30')][_0x31a8('0x49')](_[_0x31a8('0x41')](_0x4eaf70,_0x8d9f0e[_0x31a8('0x4a')]),{'include':_0x8d9f0e[_0x31a8('0x35')][_0x31a8('0x42')]?[{'all':!![]}]:undefined})[_0x31a8('0x26')](function(_0x14e096){var _0xb7baa7=_0x8d9f0e[_0x31a8('0x54')][_0x31a8('0x27')]({'plain':!![]});if(!_0xb7baa7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb7baa7[_0x31a8('0x4b')]===_0x31a8('0x54')){var _0xbe8c88=_0x14e096[_0x31a8('0x27')]({'plain':!![]});var _0x3fd63b=_0x31a8('0x28');return db[_0x31a8('0x55')][_0x31a8('0x4c')]({'where':{'name':_0x3fd63b,'userProfileId':_0xb7baa7[_0x31a8('0x56')]},'raw':!![]})['then'](function(_0x143911){if(_0x143911&&_0x143911['autoAssociation']===0x0){return db[_0x31a8('0x29')]['create']({'name':_0xbe8c88[_0x31a8('0x2c')],'resourceId':_0xbe8c88['id'],'type':_0x143911[_0x31a8('0x2c')],'sectionId':_0x143911['id']},{})[_0x31a8('0x26')](function(){return _0x14e096;});}else{return _0x14e096;}})[_0x31a8('0x45')](function(_0x499f5d){logger[_0x31a8('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499f5d);throw _0x499f5d;});}return _0x14e096;});}})[_0x31a8('0x26')](respondWithResult(_0xb59b85,0xc9))['catch'](handleError(_0xb59b85,null));};exports[_0x31a8('0x24')]=function(_0x371b7a,_0x34afc5){if(_0x371b7a[_0x31a8('0x4a')]['id']){delete _0x371b7a['body']['id'];}return db[_0x31a8('0x30')][_0x31a8('0x4c')]({'where':{'id':_0x371b7a['params']['id']}})[_0x31a8('0x26')](handleEntityNotFound(_0x34afc5,null))[_0x31a8('0x26')](saveUpdates(_0x371b7a[_0x31a8('0x4a')],null))[_0x31a8('0x26')](respondWithResult(_0x34afc5,null))[_0x31a8('0x45')](handleError(_0x34afc5,null));};exports[_0x31a8('0x25')]=function(_0x11e374,_0x361fe2){return db[_0x31a8('0x30')][_0x31a8('0x4c')]({'where':{'id':_0x11e374[_0x31a8('0x4f')]['id']}})[_0x31a8('0x26')](handleEntityNotFound(_0x361fe2,null))[_0x31a8('0x26')](removeEntity(_0x361fe2,null))['catch'](handleError(_0x361fe2,null));};exports[_0x31a8('0x58')]=function(_0x1418d7,_0x5f3a81,_0x14ba58){var _0x1e7f91={'raw':!![],'where':{}};var _0xbdab53={};var _0x136a00={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x31a8('0x59')]({'where':{'id':_0x1418d7[_0x31a8('0x4f')]['id']}})[_0x31a8('0x26')](handleEntityNotFound(_0x5f3a81,null))[_0x31a8('0x26')](function(_0x5788e8){if(_0x5788e8){_0xbdab53[_0x31a8('0x34')]=_['keys'](db[_0x31a8('0x5a')][_0x31a8('0x31')]);_0xbdab53[_0x31a8('0x35')]=_[_0x31a8('0x46')](_0x1418d7[_0x31a8('0x35')]);_0xbdab53[_0x31a8('0x36')]=_[_0x31a8('0x37')](_0xbdab53[_0x31a8('0x34')],_0xbdab53[_0x31a8('0x35')]);_0x1e7f91['attributes']=_[_0x31a8('0x37')](_0xbdab53[_0x31a8('0x34')],qs[_0x31a8('0x38')](_0x1418d7[_0x31a8('0x35')][_0x31a8('0x38')]));_0x1e7f91[_0x31a8('0x39')]=_0x1e7f91['attributes'][_0x31a8('0x50')]?_0x1e7f91['attributes']:_0xbdab53['model'];if(!_0x1418d7[_0x31a8('0x35')][_0x31a8('0x3a')](_0x31a8('0x3b'))){_0x1e7f91[_0x31a8('0x1e')]=qs[_0x31a8('0x1e')](_0x1418d7[_0x31a8('0x35')][_0x31a8('0x1e')]);_0x1e7f91[_0x31a8('0x1b')]=qs[_0x31a8('0x1b')](_0x1418d7[_0x31a8('0x35')][_0x31a8('0x1b')]);}_0x1e7f91[_0x31a8('0x3c')]=qs[_0x31a8('0x5b')](_0x1418d7[_0x31a8('0x35')][_0x31a8('0x5b')]);_0x1e7f91[_0x31a8('0x3e')]=qs[_0x31a8('0x36')](_[_0x31a8('0x3d')](_0x1418d7[_0x31a8('0x35')],_0xbdab53[_0x31a8('0x36')]));_0x1e7f91['where'][_0x31a8('0x5c')]=_0x5788e8['id'];if(_0x1418d7['query']['filter']){_0x1e7f91[_0x31a8('0x3e')]=_[_0x31a8('0x41')](_0x1e7f91[_0x31a8('0x3e')],{'$or':_[_0x31a8('0x2f')](_0x1e7f91[_0x31a8('0x39')],function(_0x442492){var _0xb966c7={};_0xb966c7[_0x442492]={'$like':'%'+_0x1418d7[_0x31a8('0x35')][_0x31a8('0x40')]+'%'};return _0xb966c7;})});}_0x1e7f91=_[_0x31a8('0x41')]({},_0x1e7f91,_0x1418d7[_0x31a8('0x48')]);return db[_0x31a8('0x5a')][_0x31a8('0x1d')]({'where':_0x1e7f91[_0x31a8('0x3e')]})['then'](function(_0x3aca95){_0x136a00[_0x31a8('0x1d')]=_0x3aca95;if(_0x1418d7[_0x31a8('0x35')]['includeAll']){_0x1e7f91[_0x31a8('0x47')]=[{'all':!![]}];}return db[_0x31a8('0x5a')][_0x31a8('0x43')](_0x1e7f91);})[_0x31a8('0x26')](function(_0x2d895c){_0x136a00[_0x31a8('0x44')]=_0x2d895c;return _0x136a00;});}})['then'](respondWithFilteredResult(_0x5f3a81,_0x1e7f91))['catch'](handleError(_0x5f3a81,null));};exports[_0x31a8('0x5d')]=function(_0x145ec7,_0xcdb1e,_0x3d830b){var _0x1da660={'raw':!![],'where':{}};var _0x56019d={};var _0x4b2def={'count':0x0,'rows':[]};return db[_0x31a8('0x30')][_0x31a8('0x59')]({'where':{'id':_0x145ec7[_0x31a8('0x4f')]['id']}})[_0x31a8('0x26')](handleEntityNotFound(_0xcdb1e,null))[_0x31a8('0x26')](function(_0x2061b3){if(_0x2061b3){_0x56019d[_0x31a8('0x34')]=_[_0x31a8('0x46')](db[_0x31a8('0x5e')][_0x31a8('0x31')]);_0x56019d[_0x31a8('0x35')]=_[_0x31a8('0x46')](_0x145ec7[_0x31a8('0x35')]);_0x56019d[_0x31a8('0x36')]=_[_0x31a8('0x37')](_0x56019d[_0x31a8('0x34')],_0x56019d['query']);_0x1da660[_0x31a8('0x39')]=_[_0x31a8('0x37')](_0x56019d[_0x31a8('0x34')],qs[_0x31a8('0x38')](_0x145ec7[_0x31a8('0x35')]['fields']));_0x1da660[_0x31a8('0x39')]=_0x1da660[_0x31a8('0x39')][_0x31a8('0x50')]?_0x1da660[_0x31a8('0x39')]:_0x56019d['model'];if(!_0x145ec7['query'][_0x31a8('0x3a')](_0x31a8('0x3b'))){_0x1da660['limit']=qs[_0x31a8('0x1e')](_0x145ec7['query'][_0x31a8('0x1e')]);_0x1da660[_0x31a8('0x1b')]=qs[_0x31a8('0x1b')](_0x145ec7['query'][_0x31a8('0x1b')]);}_0x1da660[_0x31a8('0x3c')]=qs['sort'](_0x145ec7[_0x31a8('0x35')][_0x31a8('0x5b')]);_0x1da660[_0x31a8('0x3e')]=qs[_0x31a8('0x36')](_[_0x31a8('0x3d')](_0x145ec7[_0x31a8('0x35')],_0x56019d[_0x31a8('0x36')]));_0x1da660['where']['ProjectId']=_0x2061b3['id'];if(_0x145ec7[_0x31a8('0x35')][_0x31a8('0x40')]){_0x1da660[_0x31a8('0x3e')]=_[_0x31a8('0x41')](_0x1da660['where'],{'$or':_['map'](_0x1da660[_0x31a8('0x39')],function(_0x4a4e56){var _0x54758a={};_0x54758a[_0x4a4e56]={'$like':'%'+_0x145ec7['query']['filter']+'%'};return _0x54758a;})});}_0x1da660=_[_0x31a8('0x41')]({},_0x1da660,_0x145ec7['options']);return db['JscriptyAnswerReport'][_0x31a8('0x1d')]({'where':_0x1da660['where']})[_0x31a8('0x26')](function(_0x396457){_0x4b2def[_0x31a8('0x1d')]=_0x396457;if(_0x145ec7[_0x31a8('0x35')][_0x31a8('0x42')]){_0x1da660[_0x31a8('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x1da660);})['then'](function(_0x55c7b8){_0x4b2def[_0x31a8('0x44')]=_0x55c7b8;return _0x4b2def;});}})[_0x31a8('0x26')](respondWithFilteredResult(_0xcdb1e,_0x1da660))['catch'](handleError(_0xcdb1e,null));};function char(_0xa3f6d8){return'number'===typeof _0xa3f6d8?String['fromCharCode'][_0x31a8('0x21')](null,arguments):_0xa3f6d8;}function needsEncapsulation(_0x5c5e22){return!!_0x5c5e22&&(_0x5c5e22[_0x31a8('0x5f')]()[_0x31a8('0x60')](char(0xd))>=0x0||_0x5c5e22[_0x31a8('0x5f')]()[_0x31a8('0x60')](char(0xa))>=0x0||_0x5c5e22['toString']()['indexOf'](char(0x2c))>=0x0||_0x5c5e22[_0x31a8('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4ba649){var _0x5b9d7c=char(0x22),_0x59e5fb='\x5c'+char(0x22),_0x4a67cd=_0x4ba649[_0x31a8('0x5f')]()['replace'](new RegExp(_0x5b9d7c,'g'),_0x59e5fb);return _0x5b9d7c+_0x4a67cd+_0x5b9d7c;}exports['getSummary']=function(_0xc32ec1,_0x2996e6,_0x2c2f6a){var _0x2a5197,_0x3c3d0f;var _0x3f8c73={'where':{'ProjectId':_0xc32ec1[_0x31a8('0x4f')]['id']}};if(_0xc32ec1[_0x31a8('0x35')][_0x31a8('0x61')]){_0x3f8c73[_0x31a8('0x3e')][_0x31a8('0x62')]=JSON['parse'](_0xc32ec1['query']['startTime']);}return db[_0x31a8('0x5a')]['findAll'](_0x3f8c73)[_0x31a8('0x26')](handleEntityNotFound(_0x2996e6,null))[_0x31a8('0x26')](function(_0x5a8f67){if(_0x5a8f67){_0x2a5197=_0x5a8f67;return db[_0x31a8('0x63')][_0x31a8('0x43')]({'where':{'SessionId':{'$in':_[_0x31a8('0x2f')](_0x2a5197,'id')},'ProjectId':_0xc32ec1[_0x31a8('0x4f')]['id']},'order':_0x31a8('0x64')});}})['then'](handleEntityNotFound(_0x2996e6,null))[_0x31a8('0x26')](function(_0x23396b){if(_0x23396b){_0x3c3d0f=_0x23396b;var _0x1f3fcb={};for(var _0x37189f=0x0,_0x149243=_0x3c3d0f[_0x31a8('0x50')];_0x37189f<_0x149243;_0x37189f++){if(!_0x1f3fcb['hasOwnProperty'](_0x3c3d0f[_0x37189f]['questionId'])){_0x1f3fcb[_0x3c3d0f[_0x37189f][_0x31a8('0x65')]]=needsEncapsulation(_0x3c3d0f[_0x37189f][_0x31a8('0x66')])?encapsulate(_0x3c3d0f[_0x37189f][_0x31a8('0x66')]):_0x3c3d0f[_0x37189f]['question'];}}var _0x1a2ac8=[],_0x52700c={};for(var _0x569d5d=0x0,_0x240648=_0x2a5197[_0x31a8('0x50')];_0x569d5d<_0x240648;_0x569d5d++){_0x52700c={'ProjectId':_0xc32ec1[_0x31a8('0x4f')]['id'],'SessionId':_0x2a5197[_0x569d5d]['id'],'StartTime':moment(_0x2a5197[_0x569d5d][_0x31a8('0x62')])[_0x31a8('0x67')](_0x31a8('0x68'))};for(var _0x5ce58b=0x0,_0x11a373=_0x3c3d0f[_0x31a8('0x50')];_0x5ce58b<_0x11a373;_0x5ce58b++){if(_0x3c3d0f[_0x5ce58b]['SessionId']==_0x2a5197[_0x569d5d]['id']&&_0x1f3fcb[_0x31a8('0x3a')](_0x3c3d0f[_0x5ce58b][_0x31a8('0x65')])){_0x52700c[_0x1f3fcb[_0x3c3d0f[_0x5ce58b][_0x31a8('0x65')]]]=_0x3c3d0f[_0x5ce58b]['answer'];}}for(var _0x19d060 in _0x1f3fcb){if(!_0x52700c[_0x31a8('0x3a')](_0x1f3fcb[_0x19d060])){_0x52700c[_0x1f3fcb[_0x19d060]]=null;}}_0x1a2ac8[_0x31a8('0x69')](_0x52700c);}return _0x1a2ac8;}})[_0x31a8('0x26')](function(_0x2b8f3f){if(!_[_0x31a8('0x6a')](_0x2b8f3f)){var _0x4da5e6=toCsv(_0x2b8f3f);var _0x505767=Date[_0x31a8('0x6b')]();fs[_0x31a8('0x6c')](util[_0x31a8('0x67')](_0x31a8('0x6d'),_0xc32ec1['params']['id'],_0x505767),_0x4da5e6);_0x2996e6[_0x31a8('0x6e')](_0x31a8('0x6f'),_0x31a8('0x70')+util[_0x31a8('0x67')](_0x31a8('0x71'),_0xc32ec1[_0x31a8('0x4f')]['id'],_0x505767));_0x2996e6[_0x31a8('0x6e')](_0x31a8('0x72'),_0x31a8('0x73'));return _0x2996e6['download'](util[_0x31a8('0x67')](_0x31a8('0x6d'),_0xc32ec1[_0x31a8('0x4f')]['id'],_0x505767));}else{return _0x2996e6[_0x31a8('0x2b')](0xcc);}})[_0x31a8('0x45')](handleError(_0x2996e6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0ae2e3e..bca91f6 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 _0x46fc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x46fc,0x103));var _0xc46f=function(_0x10fa4b,_0x15d598){_0x10fa4b=_0x10fa4b-0x0;var _0x29f8cd=_0x46fc[_0x10fa4b];return _0x29f8cd;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var logger=require(_0xc46f('0x2'))(_0xc46f('0x3'));var moment=require(_0xc46f('0x4'));var BPromise=require(_0xc46f('0x5'));var rp=require(_0xc46f('0x6'));var fs=require('fs');var path=require(_0xc46f('0x7'));var rimraf=require(_0xc46f('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xc46f('0x9')]=function(_0x176c6f,_0x30ca8d){return _0x176c6f[_0xc46f('0xa')](_0xc46f('0xb'),attributes,{'tableName':_0xc46f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf987=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','../../config/logger','api'];(function(_0x1945f4,_0x472fb1){var _0x343e46=function(_0x455189){while(--_0x455189){_0x1945f4['push'](_0x1945f4['shift']());}};_0x343e46(++_0x472fb1);}(_0xf987,0x18a));var _0x7f98=function(_0x1a1654,_0x4d9226){_0x1a1654=_0x1a1654-0x0;var _0xe291b4=_0xf987[_0x1a1654];return _0xe291b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f98('0x0'))(_0x7f98('0x1'));var moment=require('moment');var BPromise=require(_0x7f98('0x2'));var rp=require(_0x7f98('0x3'));var fs=require('fs');var path=require(_0x7f98('0x4'));var rimraf=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var attributes=require(_0x7f98('0x7'));module[_0x7f98('0x8')]=function(_0x3b5abb,_0x3fb8e2){return _0x3b5abb[_0x7f98('0x9')](_0x7f98('0xa'),attributes,{'tableName':_0x7f98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index e00462b..3b21787 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xda3f,0xec));var _0xfda3=function(_0x1227b6,_0x57b21a){_0x1227b6=_0x1227b6-0x0;var _0x5b7950=_0xda3f[_0x1227b6];return _0x5b7950;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x52ed8d,_0x4cd970){var _0x4d6324=function(_0x48cff7){while(--_0x48cff7){_0x52ed8d['push'](_0x52ed8d['shift']());}};_0x4d6324(++_0x4cd970);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcb91[_0x46efd7];return _0x5637e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1c2e450..983b24a 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 _0xbaaf=['../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x527fba,_0x51af72){var _0x546244=function(_0xef4ef1){while(--_0xef4ef1){_0x527fba['push'](_0x527fba['shift']());}};_0x546244(++_0x51af72);}(_0xbaaf,0x1c2));var _0xfbaa=function(_0x33f43f,_0x47a9c8){_0x33f43f=_0x33f43f-0x0;var _0x5cc8ff=_0xbaaf[_0x33f43f];return _0x5cc8ff;};'use strict';var multer=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var path=require('path');var timeout=require(_0xfbaa('0x2'));var express=require(_0xfbaa('0x3'));var router=express[_0xfbaa('0x4')]();var fs_extra=require(_0xfbaa('0x5'));var auth=require(_0xfbaa('0x6'));var interaction=require(_0xfbaa('0x7'));var config=require('../../config/environment');var controller=require(_0xfbaa('0x8'));router[_0xfbaa('0x9')]('/',auth['isAuthenticated'](),controller[_0xfbaa('0xa')]);router['get'](_0xfbaa('0xb'),auth[_0xfbaa('0xc')](),controller['describe']);router[_0xfbaa('0x9')](_0xfbaa('0xd'),auth[_0xfbaa('0xc')](),controller['show']);router['post']('/',auth[_0xfbaa('0xc')](),controller['create']);router[_0xfbaa('0xe')](_0xfbaa('0xd'),auth[_0xfbaa('0xc')](),controller[_0xfbaa('0xf')]);router[_0xfbaa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfbaa('0x11')]);module[_0xfbaa('0x12')]=router; \ No newline at end of file +var _0xaafb=['util','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x23516c,_0x16ea34){var _0x591310=function(_0x428292){while(--_0x428292){_0x23516c['push'](_0x23516c['shift']());}};_0x591310(++_0x16ea34);}(_0xaafb,0xfb));var _0xbaaf=function(_0x48f7c4,_0x2da038){_0x48f7c4=_0x48f7c4-0x0;var _0x1b1b70=_0xaafb[_0x48f7c4];return _0x1b1b70;};'use strict';var multer=require(_0xbaaf('0x0'));var util=require(_0xbaaf('0x1'));var path=require(_0xbaaf('0x2'));var timeout=require(_0xbaaf('0x3'));var express=require(_0xbaaf('0x4'));var router=express['Router']();var fs_extra=require(_0xbaaf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbaaf('0x6'));var controller=require(_0xbaaf('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbaaf('0x8')]);router[_0xbaaf('0x9')](_0xbaaf('0xa'),auth[_0xbaaf('0xb')](),controller[_0xbaaf('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbaaf('0xd')]);router[_0xbaaf('0xe')]('/',auth[_0xbaaf('0xb')](),controller[_0xbaaf('0xf')]);router['put'](_0xbaaf('0x10'),auth[_0xbaaf('0xb')](),controller[_0xbaaf('0x11')]);router[_0xbaaf('0x12')](_0xbaaf('0x10'),auth['isAuthenticated'](),controller[_0xbaaf('0x13')]);module[_0xbaaf('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 013c6a3..95cf0d8 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x2df8c1,_0x420d37){_0x2df8c1=_0x2df8c1-0x0;var _0x3ca702=_0x7a54[_0x2df8c1];return _0x3ca702;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x412a89,_0xab4207){_0x412a89=_0x412a89-0x0;var _0x19699b=_0x7a54[_0x412a89];return _0x19699b;};'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 3ddffa5..56ad771 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 _0x3f76=['include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','end','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x3f76,0xa1));var _0x63f7=function(_0x267286,_0x465441){_0x267286=_0x267286-0x0;var _0x3e2542=_0x3f76[_0x267286];return _0x3e2542;};'use strict';var emlformat=require(_0x63f7('0x0'));var rimraf=require(_0x63f7('0x1'));var zipdir=require(_0x63f7('0x2'));var jsonpatch=require(_0x63f7('0x3'));var rp=require(_0x63f7('0x4'));var moment=require(_0x63f7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x63f7('0x6'));var sox=require(_0x63f7('0x7'));var csv=require(_0x63f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63f7('0x9'));var _=require(_0x63f7('0xa'));var squel=require(_0x63f7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x63f7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x63f7('0xd'));var Papa=require(_0x63f7('0xe'));var Redis=require('ioredis');var authService=require(_0x63f7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x63f7('0x10'));var hardwareService=require(_0x63f7('0x11'));var logger=require(_0x63f7('0x12'))(_0x63f7('0x13'));var utils=require(_0x63f7('0x14'));var config=require(_0x63f7('0x15'));var licenseUtil=require(_0x63f7('0x16'));var db=require(_0x63f7('0x17'))['db'];function respondWithStatusCode(_0x137f21,_0x4c7197){_0x4c7197=_0x4c7197||0xcc;return function(_0xda4146){if(_0xda4146){return _0x137f21[_0x63f7('0x18')](_0x4c7197);}return _0x137f21[_0x63f7('0x19')](_0x4c7197)['end']();};}function respondWithResult(_0x3a311d,_0x58babf){_0x58babf=_0x58babf||0xc8;return function(_0x345519){if(_0x345519){return _0x3a311d[_0x63f7('0x19')](_0x58babf)['json'](_0x345519);}};}function respondWithFilteredResult(_0x24a57c,_0x993b8d){return function(_0x646f6e){if(_0x646f6e){var _0x32833c=typeof _0x993b8d[_0x63f7('0x1a')]===_0x63f7('0x1b')&&typeof _0x993b8d[_0x63f7('0x1c')]==='undefined';var _0x41a69e=_0x646f6e['count'];var _0x4e852b=_0x32833c?0x0:_0x993b8d['offset'];var _0x9bbc31=_0x32833c?_0x646f6e['count']:_0x993b8d[_0x63f7('0x1a')]+_0x993b8d[_0x63f7('0x1c')];var _0x32adc;if(_0x9bbc31>=_0x41a69e){_0x9bbc31=_0x41a69e;_0x32adc=0xc8;}else{_0x32adc=0xce;}_0x24a57c[_0x63f7('0x19')](_0x32adc);return _0x24a57c[_0x63f7('0x1d')](_0x63f7('0x1e'),_0x4e852b+'-'+_0x9bbc31+'/'+_0x41a69e)[_0x63f7('0x1f')](_0x646f6e);}return null;};}function patchUpdates(_0x2d432e){return function(_0x2f0292){try{jsonpatch[_0x63f7('0x20')](_0x2f0292,_0x2d432e,!![]);}catch(_0x34e28a){return BPromise[_0x63f7('0x21')](_0x34e28a);}return _0x2f0292['save']();};}function saveUpdates(_0x6e77b5,_0x5490f5){return function(_0x55fdf0){if(_0x55fdf0){return _0x55fdf0[_0x63f7('0x22')](_0x6e77b5)['then'](function(_0x4e880c){return _0x4e880c;});}return null;};}function removeEntity(_0x108f96,_0x1f8a91){return function(_0x3494f2){if(_0x3494f2){return _0x3494f2['destroy']()[_0x63f7('0x23')](function(){_0x108f96[_0x63f7('0x19')](0xcc)[_0x63f7('0x24')]();});}};}function handleEntityNotFound(_0x2b947a,_0x338565){return function(_0x140ec3){if(!_0x140ec3){_0x2b947a[_0x63f7('0x18')](0x194);}return _0x140ec3;};}function handleError(_0x56a6ce,_0x1da9fe){_0x1da9fe=_0x1da9fe||0x1f4;return function(_0x465f24){logger['error'](_0x465f24[_0x63f7('0x25')]);if(_0x465f24[_0x63f7('0x26')]){delete _0x465f24[_0x63f7('0x26')];}_0x56a6ce['status'](_0x1da9fe)['send'](_0x465f24);};}exports[_0x63f7('0x27')]=function(_0x21ed5e,_0x175237){var _0x289427={},_0x5c2bf4={},_0x4b5447={'count':0x0,'rows':[]};var _0x403791=_['map'](db[_0x63f7('0x28')][_0x63f7('0x29')],function(_0x38aeb3){return{'name':_0x38aeb3[_0x63f7('0x2a')],'type':_0x38aeb3[_0x63f7('0x2b')][_0x63f7('0x2c')]};});_0x5c2bf4[_0x63f7('0x2d')]=_[_0x63f7('0x2e')](_0x403791,_0x63f7('0x26'));_0x5c2bf4[_0x63f7('0x2f')]=_[_0x63f7('0x30')](_0x21ed5e['query']);_0x5c2bf4[_0x63f7('0x31')]=_['intersection'](_0x5c2bf4[_0x63f7('0x2d')],_0x5c2bf4[_0x63f7('0x2f')]);_0x289427[_0x63f7('0x32')]=_['intersection'](_0x5c2bf4[_0x63f7('0x2d')],qs[_0x63f7('0x33')](_0x21ed5e[_0x63f7('0x2f')]['fields']));_0x289427[_0x63f7('0x32')]=_0x289427[_0x63f7('0x32')][_0x63f7('0x34')]?_0x289427['attributes']:_0x5c2bf4[_0x63f7('0x2d')];if(!_0x21ed5e[_0x63f7('0x2f')][_0x63f7('0x35')](_0x63f7('0x36'))){_0x289427['limit']=qs[_0x63f7('0x1c')](_0x21ed5e['query'][_0x63f7('0x1c')]);_0x289427[_0x63f7('0x1a')]=qs['offset'](_0x21ed5e[_0x63f7('0x2f')]['offset']);}_0x289427[_0x63f7('0x37')]=qs[_0x63f7('0x38')](_0x21ed5e['query'][_0x63f7('0x38')]);_0x289427[_0x63f7('0x39')]=qs['filters'](_[_0x63f7('0x3a')](_0x21ed5e[_0x63f7('0x2f')],_0x5c2bf4[_0x63f7('0x31')]),_0x403791);if(_0x21ed5e[_0x63f7('0x2f')]['filter']){_0x289427[_0x63f7('0x39')]=_[_0x63f7('0x3b')](_0x289427[_0x63f7('0x39')],{'$or':_[_0x63f7('0x2e')](_0x403791,function(_0x51b668){if(_0x51b668['type']!==_0x63f7('0x3c')){var _0x1aad5f={};_0x1aad5f[_0x51b668[_0x63f7('0x26')]]={'$like':'%'+_0x21ed5e[_0x63f7('0x2f')][_0x63f7('0x3d')]+'%'};return _0x1aad5f;}})});}_0x289427=_[_0x63f7('0x3b')]({},_0x289427,_0x21ed5e['options']);var _0x3df944={'where':_0x289427[_0x63f7('0x39')]};return db[_0x63f7('0x28')]['count'](_0x3df944)[_0x63f7('0x23')](function(_0x45423f){_0x4b5447[_0x63f7('0x3e')]=_0x45423f;if(_0x21ed5e[_0x63f7('0x2f')][_0x63f7('0x3f')]){_0x289427[_0x63f7('0x40')]=[{'all':!![]}];}return db[_0x63f7('0x28')][_0x63f7('0x41')](_0x289427);})[_0x63f7('0x23')](function(_0x4ef016){_0x4b5447[_0x63f7('0x42')]=_0x4ef016;return _0x4b5447;})['then'](respondWithFilteredResult(_0x175237,_0x289427))[_0x63f7('0x43')](handleError(_0x175237,null));};exports[_0x63f7('0x44')]=function(_0x1fa779,_0x2b6a90){var _0x43a021={'raw':!![],'where':{'id':_0x1fa779[_0x63f7('0x45')]['id']}},_0x22890c={};_0x22890c[_0x63f7('0x2d')]=_[_0x63f7('0x30')](db[_0x63f7('0x28')][_0x63f7('0x29')]);_0x22890c[_0x63f7('0x2f')]=_['keys'](_0x1fa779['query']);_0x22890c[_0x63f7('0x31')]=_[_0x63f7('0x46')](_0x22890c[_0x63f7('0x2d')],_0x22890c[_0x63f7('0x2f')]);_0x43a021[_0x63f7('0x32')]=_[_0x63f7('0x46')](_0x22890c[_0x63f7('0x2d')],qs[_0x63f7('0x33')](_0x1fa779['query'][_0x63f7('0x33')]));_0x43a021['attributes']=_0x43a021['attributes'][_0x63f7('0x34')]?_0x43a021[_0x63f7('0x32')]:_0x22890c[_0x63f7('0x2d')];if(_0x1fa779[_0x63f7('0x2f')][_0x63f7('0x3f')]){_0x43a021[_0x63f7('0x40')]=[{'all':!![]}];}_0x43a021=_[_0x63f7('0x3b')]({},_0x43a021,_0x1fa779['options']);return db['JscriptyQuestionReport'][_0x63f7('0x47')](_0x43a021)[_0x63f7('0x23')](handleEntityNotFound(_0x2b6a90,null))['then'](respondWithResult(_0x2b6a90,null))[_0x63f7('0x43')](handleError(_0x2b6a90,null));};exports[_0x63f7('0x48')]=function(_0x2ed47d,_0x289e50){return db[_0x63f7('0x28')][_0x63f7('0x48')](_0x2ed47d[_0x63f7('0x49')],{})[_0x63f7('0x23')](respondWithResult(_0x289e50,0xc9))[_0x63f7('0x43')](handleError(_0x289e50,null));};exports[_0x63f7('0x22')]=function(_0x239e0e,_0x4da1d0){if(_0x239e0e['body']['id']){delete _0x239e0e[_0x63f7('0x49')]['id'];}return db[_0x63f7('0x28')][_0x63f7('0x47')]({'where':{'id':_0x239e0e[_0x63f7('0x45')]['id']}})[_0x63f7('0x23')](handleEntityNotFound(_0x4da1d0,null))[_0x63f7('0x23')](saveUpdates(_0x239e0e[_0x63f7('0x49')],null))['then'](respondWithResult(_0x4da1d0,null))[_0x63f7('0x43')](handleError(_0x4da1d0,null));};exports[_0x63f7('0x4a')]=function(_0x3920d5,_0x246ada){return db[_0x63f7('0x28')][_0x63f7('0x47')]({'where':{'id':_0x3920d5[_0x63f7('0x45')]['id']}})[_0x63f7('0x23')](handleEntityNotFound(_0x246ada,null))[_0x63f7('0x23')](removeEntity(_0x246ada,null))[_0x63f7('0x43')](handleError(_0x246ada,null));};exports['describe']=function(_0x3b253c,_0x359fa2){return db[_0x63f7('0x28')]['describe']()[_0x63f7('0x23')](respondWithResult(_0x359fa2,null))['catch'](handleError(_0x359fa2,null));}; \ No newline at end of file +var _0x0c73=['path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','keys','query','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','name','includeAll','findAll','rows','show','params','intersection','fields','options','find','create','body','describe','catch','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3d7401,_0x3c0ac6){var _0x8ac5b3=function(_0xcb60b6){while(--_0xcb60b6){_0x3d7401['push'](_0x3d7401['shift']());}};_0x8ac5b3(++_0x3c0ac6);}(_0x0c73,0x1f3));var _0x30c7=function(_0x432b65,_0x7e5e45){_0x432b65=_0x432b65-0x0;var _0x3cf875=_0x0c73[_0x432b65];return _0x3cf875;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x30c7('0x0'));var jsonpatch=require(_0x30c7('0x1'));var rp=require('request-promise');var moment=require(_0x30c7('0x2'));var BPromise=require(_0x30c7('0x3'));var Mustache=require(_0x30c7('0x4'));var util=require('util');var path=require(_0x30c7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30c7('0x6'));var _=require('lodash');var squel=require(_0x30c7('0x7'));var crypto=require(_0x30c7('0x8'));var jsforce=require(_0x30c7('0x9'));var deskjs=require(_0x30c7('0xa'));var toCsv=require(_0x30c7('0xb'));var querystring=require('querystring');var Papa=require(_0x30c7('0xc'));var Redis=require(_0x30c7('0xd'));var authService=require(_0x30c7('0xe'));var qs=require(_0x30c7('0xf'));var as=require(_0x30c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30c7('0x11'))(_0x30c7('0x12'));var utils=require('../../config/utils');var config=require(_0x30c7('0x13'));var licenseUtil=require(_0x30c7('0x14'));var db=require(_0x30c7('0x15'))['db'];function respondWithStatusCode(_0x3aa019,_0x2861e5){_0x2861e5=_0x2861e5||0xcc;return function(_0x5b76f5){if(_0x5b76f5){return _0x3aa019['sendStatus'](_0x2861e5);}return _0x3aa019[_0x30c7('0x16')](_0x2861e5)['end']();};}function respondWithResult(_0x2477ce,_0x5b52a4){_0x5b52a4=_0x5b52a4||0xc8;return function(_0x418aaa){if(_0x418aaa){return _0x2477ce['status'](_0x5b52a4)[_0x30c7('0x17')](_0x418aaa);}};}function respondWithFilteredResult(_0x191435,_0x2f7836){return function(_0x509f11){if(_0x509f11){var _0x72fe36=typeof _0x2f7836[_0x30c7('0x18')]===_0x30c7('0x19')&&typeof _0x2f7836[_0x30c7('0x1a')]==='undefined';var _0xacf48f=_0x509f11[_0x30c7('0x1b')];var _0x2eb368=_0x72fe36?0x0:_0x2f7836[_0x30c7('0x18')];var _0x53f62c=_0x72fe36?_0x509f11[_0x30c7('0x1b')]:_0x2f7836['offset']+_0x2f7836['limit'];var _0x2e62a8;if(_0x53f62c>=_0xacf48f){_0x53f62c=_0xacf48f;_0x2e62a8=0xc8;}else{_0x2e62a8=0xce;}_0x191435[_0x30c7('0x16')](_0x2e62a8);return _0x191435['set'](_0x30c7('0x1c'),_0x2eb368+'-'+_0x53f62c+'/'+_0xacf48f)[_0x30c7('0x17')](_0x509f11);}return null;};}function patchUpdates(_0x128756){return function(_0x13c0ea){try{jsonpatch[_0x30c7('0x1d')](_0x13c0ea,_0x128756,!![]);}catch(_0x4475dc){return BPromise['reject'](_0x4475dc);}return _0x13c0ea[_0x30c7('0x1e')]();};}function saveUpdates(_0x384897,_0x26809d){return function(_0x3411e2){if(_0x3411e2){return _0x3411e2[_0x30c7('0x1f')](_0x384897)[_0x30c7('0x20')](function(_0x5ecb67){return _0x5ecb67;});}return null;};}function removeEntity(_0x45ef57,_0x460c0e){return function(_0x432235){if(_0x432235){return _0x432235[_0x30c7('0x21')]()['then'](function(){_0x45ef57[_0x30c7('0x16')](0xcc)[_0x30c7('0x22')]();});}};}function handleEntityNotFound(_0x446591,_0x99b845){return function(_0x104787){if(!_0x104787){_0x446591[_0x30c7('0x23')](0x194);}return _0x104787;};}function handleError(_0x5717e8,_0x5c5570){_0x5c5570=_0x5c5570||0x1f4;return function(_0x25d564){logger[_0x30c7('0x24')](_0x25d564[_0x30c7('0x25')]);if(_0x25d564['name']){delete _0x25d564['name'];}_0x5717e8[_0x30c7('0x16')](_0x5c5570)['send'](_0x25d564);};}exports[_0x30c7('0x26')]=function(_0x181e93,_0x35b138){var _0x58d998={},_0x3a4c71={},_0x1a1573={'count':0x0,'rows':[]};var _0x4b9a44=_['map'](db[_0x30c7('0x27')][_0x30c7('0x28')],function(_0x45ba9f){return{'name':_0x45ba9f[_0x30c7('0x29')],'type':_0x45ba9f[_0x30c7('0x2a')][_0x30c7('0x2b')]};});_0x3a4c71['model']=_[_0x30c7('0x2c')](_0x4b9a44,'name');_0x3a4c71['query']=_[_0x30c7('0x2d')](_0x181e93[_0x30c7('0x2e')]);_0x3a4c71['filters']=_['intersection'](_0x3a4c71[_0x30c7('0x2f')],_0x3a4c71['query']);_0x58d998['attributes']=_['intersection'](_0x3a4c71['model'],qs['fields'](_0x181e93['query']['fields']));_0x58d998[_0x30c7('0x30')]=_0x58d998['attributes']['length']?_0x58d998[_0x30c7('0x30')]:_0x3a4c71[_0x30c7('0x2f')];if(!_0x181e93[_0x30c7('0x2e')][_0x30c7('0x31')](_0x30c7('0x32'))){_0x58d998[_0x30c7('0x1a')]=qs['limit'](_0x181e93[_0x30c7('0x2e')]['limit']);_0x58d998[_0x30c7('0x18')]=qs[_0x30c7('0x18')](_0x181e93[_0x30c7('0x2e')][_0x30c7('0x18')]);}_0x58d998[_0x30c7('0x33')]=qs[_0x30c7('0x34')](_0x181e93[_0x30c7('0x2e')][_0x30c7('0x34')]);_0x58d998[_0x30c7('0x35')]=qs[_0x30c7('0x36')](_['pick'](_0x181e93[_0x30c7('0x2e')],_0x3a4c71['filters']),_0x4b9a44);if(_0x181e93[_0x30c7('0x2e')][_0x30c7('0x37')]){_0x58d998[_0x30c7('0x35')]=_[_0x30c7('0x38')](_0x58d998[_0x30c7('0x35')],{'$or':_[_0x30c7('0x2c')](_0x4b9a44,function(_0x5e1b39){if(_0x5e1b39[_0x30c7('0x2a')]!==_0x30c7('0x39')){var _0x56e9c8={};_0x56e9c8[_0x5e1b39[_0x30c7('0x3a')]]={'$like':'%'+_0x181e93[_0x30c7('0x2e')][_0x30c7('0x37')]+'%'};return _0x56e9c8;}})});}_0x58d998=_[_0x30c7('0x38')]({},_0x58d998,_0x181e93['options']);var _0x42af6d={'where':_0x58d998[_0x30c7('0x35')]};return db['JscriptyQuestionReport'][_0x30c7('0x1b')](_0x42af6d)[_0x30c7('0x20')](function(_0x4cbe2b){_0x1a1573[_0x30c7('0x1b')]=_0x4cbe2b;if(_0x181e93[_0x30c7('0x2e')][_0x30c7('0x3b')]){_0x58d998['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x30c7('0x3c')](_0x58d998);})[_0x30c7('0x20')](function(_0x12e8e9){_0x1a1573[_0x30c7('0x3d')]=_0x12e8e9;return _0x1a1573;})[_0x30c7('0x20')](respondWithFilteredResult(_0x35b138,_0x58d998))['catch'](handleError(_0x35b138,null));};exports[_0x30c7('0x3e')]=function(_0x2f29ed,_0x295014){var _0x29d30b={'raw':!![],'where':{'id':_0x2f29ed[_0x30c7('0x3f')]['id']}},_0x431134={};_0x431134[_0x30c7('0x2f')]=_[_0x30c7('0x2d')](db['JscriptyQuestionReport'][_0x30c7('0x28')]);_0x431134[_0x30c7('0x2e')]=_[_0x30c7('0x2d')](_0x2f29ed[_0x30c7('0x2e')]);_0x431134[_0x30c7('0x36')]=_[_0x30c7('0x40')](_0x431134[_0x30c7('0x2f')],_0x431134[_0x30c7('0x2e')]);_0x29d30b[_0x30c7('0x30')]=_[_0x30c7('0x40')](_0x431134['model'],qs[_0x30c7('0x41')](_0x2f29ed[_0x30c7('0x2e')][_0x30c7('0x41')]));_0x29d30b[_0x30c7('0x30')]=_0x29d30b[_0x30c7('0x30')]['length']?_0x29d30b[_0x30c7('0x30')]:_0x431134[_0x30c7('0x2f')];if(_0x2f29ed[_0x30c7('0x2e')][_0x30c7('0x3b')]){_0x29d30b['include']=[{'all':!![]}];}_0x29d30b=_[_0x30c7('0x38')]({},_0x29d30b,_0x2f29ed[_0x30c7('0x42')]);return db[_0x30c7('0x27')][_0x30c7('0x43')](_0x29d30b)[_0x30c7('0x20')](handleEntityNotFound(_0x295014,null))[_0x30c7('0x20')](respondWithResult(_0x295014,null))['catch'](handleError(_0x295014,null));};exports[_0x30c7('0x44')]=function(_0x1747a0,_0x5ef62b){return db[_0x30c7('0x27')][_0x30c7('0x44')](_0x1747a0[_0x30c7('0x45')],{})[_0x30c7('0x20')](respondWithResult(_0x5ef62b,0xc9))['catch'](handleError(_0x5ef62b,null));};exports['update']=function(_0x3ee39c,_0x78fcdd){if(_0x3ee39c[_0x30c7('0x45')]['id']){delete _0x3ee39c[_0x30c7('0x45')]['id'];}return db[_0x30c7('0x27')]['find']({'where':{'id':_0x3ee39c[_0x30c7('0x3f')]['id']}})[_0x30c7('0x20')](handleEntityNotFound(_0x78fcdd,null))[_0x30c7('0x20')](saveUpdates(_0x3ee39c[_0x30c7('0x45')],null))[_0x30c7('0x20')](respondWithResult(_0x78fcdd,null))['catch'](handleError(_0x78fcdd,null));};exports[_0x30c7('0x21')]=function(_0xc8a2ef,_0x4bbc48){return db[_0x30c7('0x27')][_0x30c7('0x43')]({'where':{'id':_0xc8a2ef[_0x30c7('0x3f')]['id']}})[_0x30c7('0x20')](handleEntityNotFound(_0x4bbc48,null))[_0x30c7('0x20')](removeEntity(_0x4bbc48,null))['catch'](handleError(_0x4bbc48,null));};exports[_0x30c7('0x46')]=function(_0x7688d2,_0x1e5360){return db['JscriptyQuestionReport']['describe']()[_0x30c7('0x20')](respondWithResult(_0x1e5360,null))[_0x30c7('0x47')](handleError(_0x1e5360,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 01b495c..3e6ca6a 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 _0x339d=['./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x339d,0x1d7));var _0xd339=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x339d[_0x7791d5];return _0x5ce288;};'use strict';var _=require(_0xd339('0x0'));var util=require('util');var logger=require(_0xd339('0x1'))(_0xd339('0x2'));var moment=require(_0xd339('0x3'));var BPromise=require(_0xd339('0x4'));var rp=require(_0xd339('0x5'));var fs=require('fs');var path=require(_0xd339('0x6'));var rimraf=require(_0xd339('0x7'));var config=require(_0xd339('0x8'));var attributes=require(_0xd339('0x9'));module[_0xd339('0xa')]=function(_0x2a845f,_0x52544d){return _0x2a845f['define'](_0xd339('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd578=['report_jscripty_questions','lodash','util','api','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xd578,0x11f));var _0x8d57=function(_0x1e2e76,_0x199363){_0x1e2e76=_0x1e2e76-0x0;var _0x4ee39e=_0xd578[_0x1e2e76];return _0x4ee39e;};'use strict';var _=require(_0x8d57('0x0'));var util=require(_0x8d57('0x1'));var logger=require('../../config/logger')(_0x8d57('0x2'));var moment=require('moment');var BPromise=require(_0x8d57('0x3'));var rp=require(_0x8d57('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d57('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d57('0x6'));module[_0x8d57('0x7')]=function(_0x108c89,_0x16ba27){return _0x108c89[_0x8d57('0x8')](_0x8d57('0x9'),attributes,{'tableName':_0x8d57('0xa'),'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 f315688..0d4b08b 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 _0x04c4=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ad7fc,_0x444145){var _0x3bb433=function(_0x1e27ef){while(--_0x1e27ef){_0x1ad7fc['push'](_0x1ad7fc['shift']());}};_0x3bb433(++_0x444145);}(_0x04c4,0x68));var _0x404c=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x04c4[_0x454165];return _0x56db53;};'use strict';var _=require(_0x404c('0x0'));var util=require('util');var moment=require(_0x404c('0x1'));var BPromise=require('bluebird');var rs=require(_0x404c('0x2'));var fs=require('fs');var Redis=require(_0x404c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x404c('0x4'));var logger=require(_0x404c('0x5'))(_0x404c('0x6'));var config=require(_0x404c('0x7'));var jayson=require(_0x404c('0x8'));var client=jayson[_0x404c('0x9')][_0x404c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x75d2da,_0x10b14c,_0x61fbea){return new BPromise(function(_0x152931,_0x4aa7f8){return client[_0x404c('0xb')](_0x75d2da,_0x61fbea)[_0x404c('0xc')](function(_0x2058e8){logger[_0x404c('0xd')](_0x404c('0xe'),_0x10b14c,_0x404c('0xf'));logger[_0x404c('0x10')](_0x404c('0x11'),_0x10b14c,_0x404c('0xf'),JSON['stringify'](_0x2058e8));if(_0x2058e8['error']){if(_0x2058e8[_0x404c('0x12')][_0x404c('0x13')]===0x1f4){logger['error'](_0x404c('0xe'),_0x10b14c,_0x2058e8['error'][_0x404c('0x14')]);return _0x4aa7f8(_0x2058e8[_0x404c('0x12')][_0x404c('0x14')]);}logger['error'](_0x404c('0xe'),_0x10b14c,_0x2058e8[_0x404c('0x12')][_0x404c('0x14')]);return _0x152931(_0x2058e8[_0x404c('0x12')][_0x404c('0x14')]);}else{logger['info'](_0x404c('0xe'),_0x10b14c,_0x404c('0xf'));_0x152931(_0x2058e8[_0x404c('0x15')]['message']);}})[_0x404c('0x16')](function(_0x17b363){logger[_0x404c('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10b14c,_0x17b363);_0x4aa7f8(_0x17b363);});});} \ No newline at end of file +var _0x71bc=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1a879f,_0x59d802){var _0x1e50f9=function(_0x54df21){while(--_0x54df21){_0x1a879f['push'](_0x1a879f['shift']());}};_0x1e50f9(++_0x59d802);}(_0x71bc,0x1e4));var _0xc71b=function(_0x367079,_0x3c5ce5){_0x367079=_0x367079-0x0;var _0x29348d=_0x71bc[_0x367079];return _0x29348d;};'use strict';var _=require(_0xc71b('0x0'));var util=require(_0xc71b('0x1'));var moment=require(_0xc71b('0x2'));var BPromise=require(_0xc71b('0x3'));var rs=require(_0xc71b('0x4'));var fs=require('fs');var Redis=require(_0xc71b('0x5'));var db=require(_0xc71b('0x6'))['db'];var utils=require(_0xc71b('0x7'));var logger=require(_0xc71b('0x8'))(_0xc71b('0x9'));var config=require(_0xc71b('0xa'));var jayson=require(_0xc71b('0xb'));var client=jayson[_0xc71b('0xc')][_0xc71b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x11f501,_0x3db2ad,_0x1186f2){return new BPromise(function(_0x33c9b6,_0x3a70ca){return client[_0xc71b('0xe')](_0x11f501,_0x1186f2)[_0xc71b('0xf')](function(_0x24059c){logger[_0xc71b('0x10')](_0xc71b('0x11'),_0x3db2ad,_0xc71b('0x12'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3db2ad,'request\x20sent',JSON[_0xc71b('0x13')](_0x24059c));if(_0x24059c[_0xc71b('0x14')]){if(_0x24059c[_0xc71b('0x14')][_0xc71b('0x15')]===0x1f4){logger[_0xc71b('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3db2ad,_0x24059c[_0xc71b('0x14')][_0xc71b('0x16')]);return _0x3a70ca(_0x24059c[_0xc71b('0x14')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3db2ad,_0x24059c['error'][_0xc71b('0x16')]);return _0x33c9b6(_0x24059c[_0xc71b('0x14')][_0xc71b('0x16')]);}else{logger[_0xc71b('0x10')](_0xc71b('0x11'),_0x3db2ad,'request\x20sent');_0x33c9b6(_0x24059c[_0xc71b('0x17')]['message']);}})['catch'](function(_0x4dc2e1){logger[_0xc71b('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3db2ad,_0x4dc2e1);_0x3a70ca(_0x4dc2e1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index af739b7..302ef1f 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 _0x41b1=['show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x3fee90,_0x106177){var _0x3f014c=function(_0x191e90){while(--_0x191e90){_0x3fee90['push'](_0x3fee90['shift']());}};_0x3f014c(++_0x106177);}(_0x41b1,0x16f));var _0x141b=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x41b1[_0x404eed];return _0xd45887;};'use strict';var multer=require(_0x141b('0x0'));var util=require(_0x141b('0x1'));var path=require('path');var timeout=require(_0x141b('0x2'));var express=require(_0x141b('0x3'));var router=express[_0x141b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x141b('0x5'));var controller=require(_0x141b('0x6'));router[_0x141b('0x7')]('/',auth[_0x141b('0x8')](),controller['index']);router[_0x141b('0x7')](_0x141b('0x9'),auth[_0x141b('0x8')](),controller['describe']);router[_0x141b('0x7')](_0x141b('0xa'),auth[_0x141b('0x8')](),controller[_0x141b('0xb')]);router[_0x141b('0x7')](_0x141b('0xc'),auth['isAuthenticated'](),controller[_0x141b('0xd')]);router[_0x141b('0xe')]('/',auth[_0x141b('0x8')](),controller[_0x141b('0xf')]);router[_0x141b('0x10')](_0x141b('0xa'),auth[_0x141b('0x8')](),controller[_0x141b('0x11')]);router[_0x141b('0x12')](_0x141b('0xa'),auth[_0x141b('0x8')](),controller[_0x141b('0x13')]);module[_0x141b('0x14')]=router; \ No newline at end of file +var _0x83ea=['multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/questions','getQuestions','post','create','update','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83ea,0xa0));var _0xa83e=function(_0x3b0785,_0x4476e0){_0x3b0785=_0x3b0785-0x0;var _0x39481e=_0x83ea[_0x3b0785];return _0x39481e;};'use strict';var multer=require(_0xa83e('0x0'));var util=require('util');var path=require(_0xa83e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa83e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa83e('0x3'));var interaction=require(_0xa83e('0x4'));var config=require(_0xa83e('0x5'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xa83e('0x6')](),controller[_0xa83e('0x7')]);router['get'](_0xa83e('0x8'),auth[_0xa83e('0x6')](),controller[_0xa83e('0x9')]);router['get'](_0xa83e('0xa'),auth[_0xa83e('0x6')](),controller[_0xa83e('0xb')]);router[_0xa83e('0xc')](_0xa83e('0xd'),auth[_0xa83e('0x6')](),controller[_0xa83e('0xe')]);router[_0xa83e('0xf')]('/',auth[_0xa83e('0x6')](),controller[_0xa83e('0x10')]);router['put'](_0xa83e('0xa'),auth[_0xa83e('0x6')](),controller[_0xa83e('0x11')]);router['delete'](_0xa83e('0xa'),auth['isAuthenticated'](),controller[_0xa83e('0x12')]);module[_0xa83e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f33c726..980b123 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 _0x9d9c=['BOOLEAN','moment','DATE','setDataValue','endtime','format','STRING'];(function(_0x5b30d8,_0xc6a96f){var _0x13786c=function(_0x269615){while(--_0x269615){_0x5b30d8['push'](_0x5b30d8['shift']());}};_0x13786c(++_0xc6a96f);}(_0x9d9c,0x189));var _0xc9d9=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x9d9c[_0x710815];return _0x5b3b89;};'use strict';var moment=require(_0xc9d9('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xc9d9('0x1')],'set':function(_0x38a8b5){this[_0xc9d9('0x2')]('starttime',_0x38a8b5);this['setDataValue'](_0xc9d9('0x3'),moment()[_0xc9d9('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xc9d9('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc9d9('0x5')]},'queue':{'type':Sequelize[_0xc9d9('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc9d9('0x5')]},'calleridnum':{'type':Sequelize[_0xc9d9('0x5')]},'completed':{'type':Sequelize[_0xc9d9('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b30=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','endtime'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x8b30,0xc1));var _0x08b3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8b30[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x08b3('0x0'));var Sequelize=require(_0x08b3('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x08b3('0x2')],'set':function(_0x4c8538){this['setDataValue']('starttime',_0x4c8538);this[_0x08b3('0x3')](_0x08b3('0x4'),moment()[_0x08b3('0x5')](_0x08b3('0x6')));}},'endtime':{'type':Sequelize[_0x08b3('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x08b3('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x08b3('0x7')]},'calleridname':{'type':Sequelize[_0x08b3('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x08b3('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4dd2f20..ced1bdb 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 _0x5450=['then','destroy','error','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','catch','params','intersection','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','end','offset','undefined','limit','count','set','json','save','update'];(function(_0x7697b9,_0x4468b4){var _0x8dec85=function(_0x5c4a3f){while(--_0x5c4a3f){_0x7697b9['push'](_0x7697b9['shift']());}};_0x8dec85(++_0x4468b4);}(_0x5450,0x166));var _0x0545=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x5450[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0x0545('0x0'));var rimraf=require(_0x0545('0x1'));var zipdir=require(_0x0545('0x2'));var jsonpatch=require(_0x0545('0x3'));var rp=require('request-promise');var moment=require(_0x0545('0x4'));var BPromise=require(_0x0545('0x5'));var Mustache=require(_0x0545('0x6'));var util=require(_0x0545('0x7'));var path=require(_0x0545('0x8'));var sox=require(_0x0545('0x9'));var csv=require(_0x0545('0xa'));var ejs=require(_0x0545('0xb'));var fs=require('fs');var fs_extra=require(_0x0545('0xc'));var _=require('lodash');var squel=require(_0x0545('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0545('0xe'));var toCsv=require(_0x0545('0xa'));var querystring=require('querystring');var Papa=require(_0x0545('0xf'));var Redis=require(_0x0545('0x10'));var authService=require(_0x0545('0x11'));var qs=require(_0x0545('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0545('0x13'));var logger=require(_0x0545('0x14'))(_0x0545('0x15'));var utils=require(_0x0545('0x16'));var config=require(_0x0545('0x17'));var licenseUtil=require(_0x0545('0x18'));var db=require(_0x0545('0x19'))['db'];function respondWithStatusCode(_0x371af6,_0x1d94bc){_0x1d94bc=_0x1d94bc||0xcc;return function(_0x1cbaeb){if(_0x1cbaeb){return _0x371af6[_0x0545('0x1a')](_0x1d94bc);}return _0x371af6[_0x0545('0x1b')](_0x1d94bc)[_0x0545('0x1c')]();};}function respondWithResult(_0x9720b6,_0x4fcdfd){_0x4fcdfd=_0x4fcdfd||0xc8;return function(_0x2f1fe1){if(_0x2f1fe1){return _0x9720b6[_0x0545('0x1b')](_0x4fcdfd)['json'](_0x2f1fe1);}};}function respondWithFilteredResult(_0x1a87df,_0x50b9de){return function(_0x13f990){if(_0x13f990){var _0x11e794=typeof _0x50b9de[_0x0545('0x1d')]===_0x0545('0x1e')&&typeof _0x50b9de[_0x0545('0x1f')]===_0x0545('0x1e');var _0x14eefc=_0x13f990[_0x0545('0x20')];var _0x4b3bf8=_0x11e794?0x0:_0x50b9de['offset'];var _0xd06f57=_0x11e794?_0x13f990['count']:_0x50b9de[_0x0545('0x1d')]+_0x50b9de[_0x0545('0x1f')];var _0x58b681;if(_0xd06f57>=_0x14eefc){_0xd06f57=_0x14eefc;_0x58b681=0xc8;}else{_0x58b681=0xce;}_0x1a87df['status'](_0x58b681);return _0x1a87df[_0x0545('0x21')]('Content-Range',_0x4b3bf8+'-'+_0xd06f57+'/'+_0x14eefc)[_0x0545('0x22')](_0x13f990);}return null;};}function patchUpdates(_0x599b11){return function(_0x5d00a2){try{jsonpatch['apply'](_0x5d00a2,_0x599b11,!![]);}catch(_0xd160e9){return BPromise['reject'](_0xd160e9);}return _0x5d00a2[_0x0545('0x23')]();};}function saveUpdates(_0x2672fb,_0x545aa7){return function(_0x37a18f){if(_0x37a18f){return _0x37a18f[_0x0545('0x24')](_0x2672fb)[_0x0545('0x25')](function(_0x49e43a){return _0x49e43a;});}return null;};}function removeEntity(_0x531384,_0x479f16){return function(_0x219d9e){if(_0x219d9e){return _0x219d9e[_0x0545('0x26')]()[_0x0545('0x25')](function(){_0x531384[_0x0545('0x1b')](0xcc)[_0x0545('0x1c')]();});}};}function handleEntityNotFound(_0x34f12a,_0x4f08ea){return function(_0x4338b4){if(!_0x4338b4){_0x34f12a['sendStatus'](0x194);}return _0x4338b4;};}function handleError(_0x4f3acf,_0xecd2c8){_0xecd2c8=_0xecd2c8||0x1f4;return function(_0x541ad2){logger[_0x0545('0x27')](_0x541ad2[_0x0545('0x28')]);if(_0x541ad2['name']){delete _0x541ad2[_0x0545('0x29')];}_0x4f3acf['status'](_0xecd2c8)['send'](_0x541ad2);};}exports['index']=function(_0x1bb8e0,_0x2d3e49){var _0x3115ae={},_0x1d6134={},_0x16157c={'count':0x0,'rows':[]};var _0x58dfe7=_['map'](db[_0x0545('0x2a')][_0x0545('0x2b')],function(_0x2fc144){return{'name':_0x2fc144[_0x0545('0x2c')],'type':_0x2fc144[_0x0545('0x2d')][_0x0545('0x2e')]};});_0x1d6134[_0x0545('0x2f')]=_[_0x0545('0x30')](_0x58dfe7,_0x0545('0x29'));_0x1d6134[_0x0545('0x31')]=_[_0x0545('0x32')](_0x1bb8e0['query']);_0x1d6134['filters']=_['intersection'](_0x1d6134[_0x0545('0x2f')],_0x1d6134['query']);_0x3115ae['attributes']=_['intersection'](_0x1d6134['model'],qs[_0x0545('0x33')](_0x1bb8e0[_0x0545('0x31')][_0x0545('0x33')]));_0x3115ae[_0x0545('0x34')]=_0x3115ae[_0x0545('0x34')][_0x0545('0x35')]?_0x3115ae[_0x0545('0x34')]:_0x1d6134[_0x0545('0x2f')];if(!_0x1bb8e0[_0x0545('0x31')][_0x0545('0x36')]('nolimit')){_0x3115ae[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x1bb8e0[_0x0545('0x31')]['limit']);_0x3115ae[_0x0545('0x1d')]=qs[_0x0545('0x1d')](_0x1bb8e0[_0x0545('0x31')]['offset']);}_0x3115ae[_0x0545('0x37')]=qs[_0x0545('0x38')](_0x1bb8e0['query'][_0x0545('0x38')]);_0x3115ae[_0x0545('0x39')]=qs[_0x0545('0x3a')](_[_0x0545('0x3b')](_0x1bb8e0[_0x0545('0x31')],_0x1d6134['filters']),_0x58dfe7);if(_0x1bb8e0[_0x0545('0x31')][_0x0545('0x3c')]){_0x3115ae['where']=_[_0x0545('0x3d')](_0x3115ae[_0x0545('0x39')],{'$or':_[_0x0545('0x30')](_0x58dfe7,function(_0x1603a3){if(_0x1603a3[_0x0545('0x2d')]!=='VIRTUAL'){var _0x4ebbbf={};_0x4ebbbf[_0x1603a3['name']]={'$like':'%'+_0x1bb8e0['query']['filter']+'%'};return _0x4ebbbf;}})});}_0x3115ae=_[_0x0545('0x3d')]({},_0x3115ae,_0x1bb8e0['options']);var _0x39d0b5={'where':_0x3115ae[_0x0545('0x39')]};return db[_0x0545('0x2a')][_0x0545('0x20')](_0x39d0b5)[_0x0545('0x25')](function(_0xfd4f47){_0x16157c[_0x0545('0x20')]=_0xfd4f47;if(_0x1bb8e0[_0x0545('0x31')][_0x0545('0x3e')]){_0x3115ae[_0x0545('0x3f')]=[{'all':!![]}];}return db[_0x0545('0x2a')][_0x0545('0x40')](_0x3115ae);})['then'](function(_0x96aad0){_0x16157c['rows']=_0x96aad0;return _0x16157c;})[_0x0545('0x25')](respondWithFilteredResult(_0x2d3e49,_0x3115ae))[_0x0545('0x41')](handleError(_0x2d3e49,null));};exports['show']=function(_0x478454,_0x45e35f){var _0x64a5dd={'raw':!![],'where':{'id':_0x478454[_0x0545('0x42')]['id']}},_0x14b810={};_0x14b810['model']=_[_0x0545('0x32')](db[_0x0545('0x2a')][_0x0545('0x2b')]);_0x14b810[_0x0545('0x31')]=_[_0x0545('0x32')](_0x478454['query']);_0x14b810[_0x0545('0x3a')]=_[_0x0545('0x43')](_0x14b810[_0x0545('0x2f')],_0x14b810[_0x0545('0x31')]);_0x64a5dd[_0x0545('0x34')]=_['intersection'](_0x14b810[_0x0545('0x2f')],qs[_0x0545('0x33')](_0x478454['query'][_0x0545('0x33')]));_0x64a5dd['attributes']=_0x64a5dd[_0x0545('0x34')]['length']?_0x64a5dd[_0x0545('0x34')]:_0x14b810[_0x0545('0x2f')];if(_0x478454['query'][_0x0545('0x3e')]){_0x64a5dd['include']=[{'all':!![]}];}_0x64a5dd=_[_0x0545('0x3d')]({},_0x64a5dd,_0x478454[_0x0545('0x44')]);return db[_0x0545('0x2a')][_0x0545('0x45')](_0x64a5dd)[_0x0545('0x25')](handleEntityNotFound(_0x45e35f,null))[_0x0545('0x25')](respondWithResult(_0x45e35f,null))[_0x0545('0x41')](handleError(_0x45e35f,null));};exports['create']=function(_0x14f546,_0x4e1940){return db['JscriptySessionReport'][_0x0545('0x46')](_0x14f546[_0x0545('0x47')],{})['then'](respondWithResult(_0x4e1940,0xc9))[_0x0545('0x41')](handleError(_0x4e1940,null));};exports['update']=function(_0x22ee30,_0x248b5d){if(_0x22ee30[_0x0545('0x47')]['id']){delete _0x22ee30[_0x0545('0x47')]['id'];}return db[_0x0545('0x2a')][_0x0545('0x45')]({'where':{'id':_0x22ee30['params']['id']}})[_0x0545('0x25')](handleEntityNotFound(_0x248b5d,null))[_0x0545('0x25')](saveUpdates(_0x22ee30['body'],null))[_0x0545('0x25')](respondWithResult(_0x248b5d,null))[_0x0545('0x41')](handleError(_0x248b5d,null));};exports[_0x0545('0x26')]=function(_0x2f449a,_0x5b7d02){return db[_0x0545('0x2a')][_0x0545('0x45')]({'where':{'id':_0x2f449a[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b7d02,null))[_0x0545('0x25')](removeEntity(_0x5b7d02,null))[_0x0545('0x41')](handleError(_0x5b7d02,null));};exports[_0x0545('0x48')]=function(_0x13dfe0,_0x5632a2){return db['JscriptySessionReport']['describe']()[_0x0545('0x25')](respondWithResult(_0x5632a2,null))[_0x0545('0x41')](handleError(_0x5632a2,null));};exports[_0x0545('0x49')]=function(_0x4b9f75,_0x1175ed,_0x5d9e87){var _0x11962c={'raw':!![],'where':{}};var _0x5a0897={};var _0x12cc35={'count':0x0,'rows':[]};return db[_0x0545('0x2a')][_0x0545('0x4a')]({'where':{'id':_0x4b9f75[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x1175ed,null))['then'](function(_0x47f31f){if(_0x47f31f){_0x5a0897[_0x0545('0x2f')]=_['keys'](db[_0x0545('0x4b')][_0x0545('0x2b')]);_0x5a0897[_0x0545('0x31')]=_[_0x0545('0x32')](_0x4b9f75['query']);_0x5a0897[_0x0545('0x3a')]=_[_0x0545('0x43')](_0x5a0897[_0x0545('0x2f')],_0x5a0897[_0x0545('0x31')]);_0x11962c['attributes']=_[_0x0545('0x43')](_0x5a0897[_0x0545('0x2f')],qs['fields'](_0x4b9f75[_0x0545('0x31')]['fields']));_0x11962c[_0x0545('0x34')]=_0x11962c[_0x0545('0x34')]['length']?_0x11962c['attributes']:_0x5a0897['model'];if(!_0x4b9f75[_0x0545('0x31')][_0x0545('0x36')](_0x0545('0x4c'))){_0x11962c[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x4b9f75[_0x0545('0x31')][_0x0545('0x1f')]);_0x11962c['offset']=qs[_0x0545('0x1d')](_0x4b9f75['query'][_0x0545('0x1d')]);}_0x11962c['order']=qs[_0x0545('0x38')](_0x4b9f75['query'][_0x0545('0x38')]);_0x11962c['where']=qs['filters'](_[_0x0545('0x3b')](_0x4b9f75['query'],_0x5a0897[_0x0545('0x3a')]));_0x11962c[_0x0545('0x39')][_0x0545('0x4d')]=_0x47f31f['id'];if(_0x4b9f75['query'][_0x0545('0x3c')]){_0x11962c[_0x0545('0x39')]=_[_0x0545('0x3d')](_0x11962c[_0x0545('0x39')],{'$or':_['map'](_0x11962c['attributes'],function(_0x3f97fd){var _0x468396={};_0x468396[_0x3f97fd]={'$like':'%'+_0x4b9f75[_0x0545('0x31')][_0x0545('0x3c')]+'%'};return _0x468396;})});}_0x11962c=_[_0x0545('0x3d')]({},_0x11962c,_0x4b9f75[_0x0545('0x44')]);return db[_0x0545('0x4b')][_0x0545('0x20')]({'where':_0x11962c[_0x0545('0x39')]})['then'](function(_0xbc645a){_0x12cc35[_0x0545('0x20')]=_0xbc645a;if(_0x4b9f75['query'][_0x0545('0x3e')]){_0x11962c['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0545('0x40')](_0x11962c);})['then'](function(_0x69c4e1){_0x12cc35[_0x0545('0x4e')]=_0x69c4e1;return _0x12cc35;});}})[_0x0545('0x25')](respondWithFilteredResult(_0x1175ed,_0x11962c))[_0x0545('0x41')](handleError(_0x1175ed,null));}; \ No newline at end of file +var _0x1d14=['intersection','attributes','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','then','rows','params','fields','length','find','catch','create','body','describe','getQuestions','keys','JscriptyQuestionReport','order','pick','include','findAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','error','stack','name','send','map','JscriptySessionReport','rawAttributes','key','model','query','filters'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x1d14,0x149));var _0x41d1=function(_0x6ac4d8,_0x4c2bf1){_0x6ac4d8=_0x6ac4d8-0x0;var _0x4ed19d=_0x1d14[_0x6ac4d8];return _0x4ed19d;};'use strict';var emlformat=require(_0x41d1('0x0'));var rimraf=require(_0x41d1('0x1'));var zipdir=require(_0x41d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x41d1('0x3'));var BPromise=require(_0x41d1('0x4'));var Mustache=require(_0x41d1('0x5'));var util=require(_0x41d1('0x6'));var path=require(_0x41d1('0x7'));var sox=require('sox');var csv=require(_0x41d1('0x8'));var ejs=require(_0x41d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41d1('0xa'));var squel=require(_0x41d1('0xb'));var crypto=require('crypto');var jsforce=require(_0x41d1('0xc'));var deskjs=require(_0x41d1('0xd'));var toCsv=require(_0x41d1('0x8'));var querystring=require('querystring');var Papa=require(_0x41d1('0xe'));var Redis=require(_0x41d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x41d1('0x10'));var as=require(_0x41d1('0x11'));var hardwareService=require(_0x41d1('0x12'));var logger=require('../../config/logger')(_0x41d1('0x13'));var utils=require(_0x41d1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x41d1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c894,_0x45978f){_0x45978f=_0x45978f||0xcc;return function(_0x4b721a){if(_0x4b721a){return _0x28c894[_0x41d1('0x16')](_0x45978f);}return _0x28c894[_0x41d1('0x17')](_0x45978f)[_0x41d1('0x18')]();};}function respondWithResult(_0x40bb0e,_0x373de0){_0x373de0=_0x373de0||0xc8;return function(_0x5843f4){if(_0x5843f4){return _0x40bb0e[_0x41d1('0x17')](_0x373de0)[_0x41d1('0x19')](_0x5843f4);}};}function respondWithFilteredResult(_0x2ab30d,_0x3ee234){return function(_0x161f8c){if(_0x161f8c){var _0x42006f=typeof _0x3ee234[_0x41d1('0x1a')]===_0x41d1('0x1b')&&typeof _0x3ee234['limit']===_0x41d1('0x1b');var _0xd01614=_0x161f8c[_0x41d1('0x1c')];var _0x313e6f=_0x42006f?0x0:_0x3ee234[_0x41d1('0x1a')];var _0x3eb0bc=_0x42006f?_0x161f8c['count']:_0x3ee234[_0x41d1('0x1a')]+_0x3ee234[_0x41d1('0x1d')];var _0x5e3b84;if(_0x3eb0bc>=_0xd01614){_0x3eb0bc=_0xd01614;_0x5e3b84=0xc8;}else{_0x5e3b84=0xce;}_0x2ab30d[_0x41d1('0x17')](_0x5e3b84);return _0x2ab30d['set'](_0x41d1('0x1e'),_0x313e6f+'-'+_0x3eb0bc+'/'+_0xd01614)[_0x41d1('0x19')](_0x161f8c);}return null;};}function patchUpdates(_0x3ba666){return function(_0x501ad5){try{jsonpatch[_0x41d1('0x1f')](_0x501ad5,_0x3ba666,!![]);}catch(_0x199c26){return BPromise['reject'](_0x199c26);}return _0x501ad5[_0x41d1('0x20')]();};}function saveUpdates(_0x5d84c0,_0x30a08d){return function(_0xb77b00){if(_0xb77b00){return _0xb77b00[_0x41d1('0x21')](_0x5d84c0)['then'](function(_0x34a8ba){return _0x34a8ba;});}return null;};}function removeEntity(_0x29df02,_0x24dcbb){return function(_0x3ae721){if(_0x3ae721){return _0x3ae721[_0x41d1('0x22')]()['then'](function(){_0x29df02[_0x41d1('0x17')](0xcc)[_0x41d1('0x18')]();});}};}function handleEntityNotFound(_0x27fdd5,_0x9cc102){return function(_0x5e41a4){if(!_0x5e41a4){_0x27fdd5[_0x41d1('0x16')](0x194);}return _0x5e41a4;};}function handleError(_0x5c7a28,_0x5e8241){_0x5e8241=_0x5e8241||0x1f4;return function(_0x478e1a){logger[_0x41d1('0x23')](_0x478e1a[_0x41d1('0x24')]);if(_0x478e1a[_0x41d1('0x25')]){delete _0x478e1a[_0x41d1('0x25')];}_0x5c7a28['status'](_0x5e8241)[_0x41d1('0x26')](_0x478e1a);};}exports['index']=function(_0x11adbb,_0x4897cf){var _0x3f6f50={},_0x50bac5={},_0x4d2969={'count':0x0,'rows':[]};var _0x3a130b=_[_0x41d1('0x27')](db[_0x41d1('0x28')][_0x41d1('0x29')],function(_0x276adb){return{'name':_0x276adb['fieldName'],'type':_0x276adb['type'][_0x41d1('0x2a')]};});_0x50bac5[_0x41d1('0x2b')]=_['map'](_0x3a130b,_0x41d1('0x25'));_0x50bac5[_0x41d1('0x2c')]=_['keys'](_0x11adbb['query']);_0x50bac5[_0x41d1('0x2d')]=_[_0x41d1('0x2e')](_0x50bac5[_0x41d1('0x2b')],_0x50bac5['query']);_0x3f6f50['attributes']=_['intersection'](_0x50bac5['model'],qs['fields'](_0x11adbb['query']['fields']));_0x3f6f50[_0x41d1('0x2f')]=_0x3f6f50[_0x41d1('0x2f')]['length']?_0x3f6f50['attributes']:_0x50bac5[_0x41d1('0x2b')];if(!_0x11adbb[_0x41d1('0x2c')][_0x41d1('0x30')](_0x41d1('0x31'))){_0x3f6f50['limit']=qs[_0x41d1('0x1d')](_0x11adbb[_0x41d1('0x2c')][_0x41d1('0x1d')]);_0x3f6f50[_0x41d1('0x1a')]=qs['offset'](_0x11adbb[_0x41d1('0x2c')][_0x41d1('0x1a')]);}_0x3f6f50['order']=qs[_0x41d1('0x32')](_0x11adbb[_0x41d1('0x2c')]['sort']);_0x3f6f50[_0x41d1('0x33')]=qs[_0x41d1('0x2d')](_['pick'](_0x11adbb[_0x41d1('0x2c')],_0x50bac5[_0x41d1('0x2d')]),_0x3a130b);if(_0x11adbb[_0x41d1('0x2c')]['filter']){_0x3f6f50['where']=_[_0x41d1('0x34')](_0x3f6f50[_0x41d1('0x33')],{'$or':_['map'](_0x3a130b,function(_0x2130db){if(_0x2130db[_0x41d1('0x35')]!==_0x41d1('0x36')){var _0x5ade46={};_0x5ade46[_0x2130db[_0x41d1('0x25')]]={'$like':'%'+_0x11adbb[_0x41d1('0x2c')][_0x41d1('0x37')]+'%'};return _0x5ade46;}})});}_0x3f6f50=_[_0x41d1('0x34')]({},_0x3f6f50,_0x11adbb[_0x41d1('0x38')]);var _0x3a4e1d={'where':_0x3f6f50[_0x41d1('0x33')]};return db[_0x41d1('0x28')]['count'](_0x3a4e1d)['then'](function(_0x356a4b){_0x4d2969[_0x41d1('0x1c')]=_0x356a4b;if(_0x11adbb[_0x41d1('0x2c')][_0x41d1('0x39')]){_0x3f6f50['include']=[{'all':!![]}];}return db[_0x41d1('0x28')]['findAll'](_0x3f6f50);})[_0x41d1('0x3a')](function(_0x56548c){_0x4d2969[_0x41d1('0x3b')]=_0x56548c;return _0x4d2969;})[_0x41d1('0x3a')](respondWithFilteredResult(_0x4897cf,_0x3f6f50))['catch'](handleError(_0x4897cf,null));};exports['show']=function(_0x42c81f,_0x146805){var _0x4fe35b={'raw':!![],'where':{'id':_0x42c81f[_0x41d1('0x3c')]['id']}},_0x12a778={};_0x12a778[_0x41d1('0x2b')]=_['keys'](db[_0x41d1('0x28')][_0x41d1('0x29')]);_0x12a778[_0x41d1('0x2c')]=_['keys'](_0x42c81f[_0x41d1('0x2c')]);_0x12a778[_0x41d1('0x2d')]=_[_0x41d1('0x2e')](_0x12a778[_0x41d1('0x2b')],_0x12a778['query']);_0x4fe35b[_0x41d1('0x2f')]=_['intersection'](_0x12a778[_0x41d1('0x2b')],qs[_0x41d1('0x3d')](_0x42c81f[_0x41d1('0x2c')]['fields']));_0x4fe35b[_0x41d1('0x2f')]=_0x4fe35b[_0x41d1('0x2f')][_0x41d1('0x3e')]?_0x4fe35b[_0x41d1('0x2f')]:_0x12a778[_0x41d1('0x2b')];if(_0x42c81f[_0x41d1('0x2c')][_0x41d1('0x39')]){_0x4fe35b['include']=[{'all':!![]}];}_0x4fe35b=_[_0x41d1('0x34')]({},_0x4fe35b,_0x42c81f[_0x41d1('0x38')]);return db[_0x41d1('0x28')][_0x41d1('0x3f')](_0x4fe35b)['then'](handleEntityNotFound(_0x146805,null))['then'](respondWithResult(_0x146805,null))[_0x41d1('0x40')](handleError(_0x146805,null));};exports[_0x41d1('0x41')]=function(_0x3178d6,_0x437904){return db[_0x41d1('0x28')][_0x41d1('0x41')](_0x3178d6[_0x41d1('0x42')],{})[_0x41d1('0x3a')](respondWithResult(_0x437904,0xc9))[_0x41d1('0x40')](handleError(_0x437904,null));};exports[_0x41d1('0x21')]=function(_0x43cc6c,_0x5618c1){if(_0x43cc6c[_0x41d1('0x42')]['id']){delete _0x43cc6c[_0x41d1('0x42')]['id'];}return db[_0x41d1('0x28')][_0x41d1('0x3f')]({'where':{'id':_0x43cc6c['params']['id']}})[_0x41d1('0x3a')](handleEntityNotFound(_0x5618c1,null))[_0x41d1('0x3a')](saveUpdates(_0x43cc6c[_0x41d1('0x42')],null))[_0x41d1('0x3a')](respondWithResult(_0x5618c1,null))[_0x41d1('0x40')](handleError(_0x5618c1,null));};exports[_0x41d1('0x22')]=function(_0x4120dd,_0x333b72){return db['JscriptySessionReport']['find']({'where':{'id':_0x4120dd[_0x41d1('0x3c')]['id']}})[_0x41d1('0x3a')](handleEntityNotFound(_0x333b72,null))[_0x41d1('0x3a')](removeEntity(_0x333b72,null))[_0x41d1('0x40')](handleError(_0x333b72,null));};exports[_0x41d1('0x43')]=function(_0x359d2c,_0x7eedc1){return db[_0x41d1('0x28')]['describe']()[_0x41d1('0x3a')](respondWithResult(_0x7eedc1,null))[_0x41d1('0x40')](handleError(_0x7eedc1,null));};exports[_0x41d1('0x44')]=function(_0x510a54,_0x4228ec,_0x5a1821){var _0x56786a={'raw':!![],'where':{}};var _0x26a8e4={};var _0x582fcb={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x510a54[_0x41d1('0x3c')]['id']}})[_0x41d1('0x3a')](handleEntityNotFound(_0x4228ec,null))[_0x41d1('0x3a')](function(_0xd364e4){if(_0xd364e4){_0x26a8e4[_0x41d1('0x2b')]=_[_0x41d1('0x45')](db[_0x41d1('0x46')][_0x41d1('0x29')]);_0x26a8e4[_0x41d1('0x2c')]=_[_0x41d1('0x45')](_0x510a54['query']);_0x26a8e4[_0x41d1('0x2d')]=_[_0x41d1('0x2e')](_0x26a8e4[_0x41d1('0x2b')],_0x26a8e4[_0x41d1('0x2c')]);_0x56786a[_0x41d1('0x2f')]=_['intersection'](_0x26a8e4[_0x41d1('0x2b')],qs[_0x41d1('0x3d')](_0x510a54[_0x41d1('0x2c')][_0x41d1('0x3d')]));_0x56786a[_0x41d1('0x2f')]=_0x56786a['attributes'][_0x41d1('0x3e')]?_0x56786a['attributes']:_0x26a8e4[_0x41d1('0x2b')];if(!_0x510a54[_0x41d1('0x2c')][_0x41d1('0x30')](_0x41d1('0x31'))){_0x56786a[_0x41d1('0x1d')]=qs[_0x41d1('0x1d')](_0x510a54[_0x41d1('0x2c')][_0x41d1('0x1d')]);_0x56786a[_0x41d1('0x1a')]=qs[_0x41d1('0x1a')](_0x510a54[_0x41d1('0x2c')][_0x41d1('0x1a')]);}_0x56786a[_0x41d1('0x47')]=qs[_0x41d1('0x32')](_0x510a54[_0x41d1('0x2c')][_0x41d1('0x32')]);_0x56786a[_0x41d1('0x33')]=qs[_0x41d1('0x2d')](_[_0x41d1('0x48')](_0x510a54[_0x41d1('0x2c')],_0x26a8e4[_0x41d1('0x2d')]));_0x56786a[_0x41d1('0x33')]['SessionId']=_0xd364e4['id'];if(_0x510a54[_0x41d1('0x2c')][_0x41d1('0x37')]){_0x56786a[_0x41d1('0x33')]=_['merge'](_0x56786a[_0x41d1('0x33')],{'$or':_[_0x41d1('0x27')](_0x56786a['attributes'],function(_0x343f23){var _0x5056d2={};_0x5056d2[_0x343f23]={'$like':'%'+_0x510a54[_0x41d1('0x2c')]['filter']+'%'};return _0x5056d2;})});}_0x56786a=_['merge']({},_0x56786a,_0x510a54[_0x41d1('0x38')]);return db['JscriptyQuestionReport'][_0x41d1('0x1c')]({'where':_0x56786a[_0x41d1('0x33')]})[_0x41d1('0x3a')](function(_0x1d9294){_0x582fcb[_0x41d1('0x1c')]=_0x1d9294;if(_0x510a54[_0x41d1('0x2c')][_0x41d1('0x39')]){_0x56786a[_0x41d1('0x49')]=[{'all':!![]}];}return db[_0x41d1('0x46')][_0x41d1('0x4a')](_0x56786a);})[_0x41d1('0x3a')](function(_0x178daa){_0x582fcb[_0x41d1('0x3b')]=_0x178daa;return _0x582fcb;});}})[_0x41d1('0x3a')](respondWithFilteredResult(_0x4228ec,_0x56786a))[_0x41d1('0x40')](handleError(_0x4228ec,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a060fd1..7898b94 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 _0xeda8=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeda8,0x104));var _0x8eda=function(_0x5a2cc4,_0x46eee2){_0x5a2cc4=_0x5a2cc4-0x0;var _0x5eab90=_0xeda8[_0x5a2cc4];return _0x5eab90;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('JscriptySessionReport',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['request-promise','path','rimraf','exports','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1646dd,_0x246347){var _0x2696c6=function(_0x55c618){while(--_0x55c618){_0x1646dd['push'](_0x1646dd['shift']());}};_0x2696c6(++_0x246347);}(_0xafb9,0x68));var _0x9afb=function(_0x5148e9,_0x505ff4){_0x5148e9=_0x5148e9-0x0;var _0x2edb12=_0xafb9[_0x5148e9];return _0x2edb12;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x9afb('0x9')]=function(_0x56a139,_0x1ccf93){return _0x56a139['define']('JscriptySessionReport',attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e2b40f7..34d3b8c 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 _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x47c5,0x165));var _0x547c=function(_0x35e289,_0x5cca85){_0x35e289=_0x35e289-0x0;var _0x22eb84=_0x47c5[_0x35e289];return _0x22eb84;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file +var _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3d7e95,_0x4846f4){var _0x193d95=function(_0x6842b4){while(--_0x6842b4){_0x3d7e95['push'](_0x3d7e95['shift']());}};_0x193d95(++_0x4846f4);}(_0x2542,0x169));var _0x2254=function(_0x79bb7d,_0x4509d4){_0x79bb7d=_0x79bb7d-0x0;var _0x216266=_0x2542[_0x79bb7d];return _0x216266;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c2e5fb4..7520cb7 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 _0xd941=['get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x49f2fa,_0x165c6a){var _0x3f7308=function(_0x44c3d6){while(--_0x44c3d6){_0x49f2fa['push'](_0x49f2fa['shift']());}};_0x3f7308(++_0x165c6a);}(_0xd941,0x125));var _0x1d94=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xd941[_0x2f62aa];return _0x1a341f;};'use strict';var multer=require(_0x1d94('0x0'));var util=require(_0x1d94('0x1'));var path=require(_0x1d94('0x2'));var timeout=require(_0x1d94('0x3'));var express=require(_0x1d94('0x4'));var router=express[_0x1d94('0x5')]();var fs_extra=require(_0x1d94('0x6'));var auth=require(_0x1d94('0x7'));var interaction=require(_0x1d94('0x8'));var config=require(_0x1d94('0x9'));var controller=require(_0x1d94('0xa'));router[_0x1d94('0xb')]('/',controller[_0x1d94('0xc')]);router[_0x1d94('0xd')](_0x1d94('0xe'),auth[_0x1d94('0xf')](),controller[_0x1d94('0x10')]);router[_0x1d94('0xb')](_0x1d94('0x11'),auth[_0x1d94('0xf')](),controller[_0x1d94('0x12')]);module['exports']=router; \ No newline at end of file +var _0x89d8=['util','connect-timeout','../../components/auth/service','../../config/environment','./license.controller','get','/:id','isAuthenticated','/download_log_file','downloadLogFile'];(function(_0x17100d,_0x33fc18){var _0x3fb5aa=function(_0x206147){while(--_0x206147){_0x17100d['push'](_0x17100d['shift']());}};_0x3fb5aa(++_0x33fc18);}(_0x89d8,0xa0));var _0x889d=function(_0x17ded0,_0x3d9bb3){_0x17ded0=_0x17ded0-0x0;var _0x15c279=_0x89d8[_0x17ded0];return _0x15c279;};'use strict';var multer=require('multer');var util=require(_0x889d('0x0'));var path=require('path');var timeout=require(_0x889d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x889d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x889d('0x3'));var controller=require(_0x889d('0x4'));router[_0x889d('0x5')]('/',controller['index']);router['put'](_0x889d('0x6'),auth[_0x889d('0x7')](),controller['update']);router[_0x889d('0x5')](_0x889d('0x8'),auth[_0x889d('0x7')](),controller[_0x889d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8886fb6..1ce6ea2 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 _0x0247=['INTEGER','sequelize','exports','STRING'];(function(_0x18593c,_0x448b00){var _0x4f7799=function(_0x16515a){while(--_0x16515a){_0x18593c['push'](_0x18593c['shift']());}};_0x4f7799(++_0x448b00);}(_0x0247,0xc1));var _0x7024=function(_0x304ebc,_0x5733ed){_0x304ebc=_0x304ebc-0x0;var _0x456934=_0x0247[_0x304ebc];return _0x456934;};'use strict';var Sequelize=require(_0x7024('0x0'));module[_0x7024('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7024('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7024('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x249a=['sequelize','TEXT','STRING','INTEGER'];(function(_0x3c725e,_0x515d74){var _0x4e92b6=function(_0x1015a1){while(--_0x1015a1){_0x3c725e['push'](_0x3c725e['shift']());}};_0x4e92b6(++_0x515d74);}(_0x249a,0x64));var _0xa249=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x249a[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0xa249('0x0'));module['exports']={'license':{'type':Sequelize[_0xa249('0x1')]},'data1':{'type':Sequelize[_0xa249('0x2')]},'data2':{'type':Sequelize[_0xa249('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xa249('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 19ee4ff..213dcb1 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 _0x46b6=['body','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','merge','options','getLicense','catch'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x46b6,0x1eb));var _0x646b=function(_0x21eff4,_0x55316b){_0x21eff4=_0x21eff4-0x0;var _0x11749c=_0x46b6[_0x21eff4];return _0x11749c;};'use strict';var emlformat=require(_0x646b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x646b('0x1'));var jsonpatch=require(_0x646b('0x2'));var rp=require(_0x646b('0x3'));var moment=require(_0x646b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x646b('0x5'));var util=require('util');var path=require(_0x646b('0x6'));var sox=require(_0x646b('0x7'));var csv=require(_0x646b('0x8'));var ejs=require(_0x646b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x646b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x646b('0xb'));var deskjs=require(_0x646b('0xc'));var toCsv=require(_0x646b('0x8'));var querystring=require(_0x646b('0xd'));var Papa=require(_0x646b('0xe'));var Redis=require(_0x646b('0xf'));var authService=require(_0x646b('0x10'));var qs=require(_0x646b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x646b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x646b('0x13'));var licenseUtil=require(_0x646b('0x14'));var db=require(_0x646b('0x15'))['db'];function respondWithStatusCode(_0x5ec340,_0x529a60){_0x529a60=_0x529a60||0xcc;return function(_0x1d6f41){if(_0x1d6f41){return _0x5ec340['sendStatus'](_0x529a60);}return _0x5ec340[_0x646b('0x16')](_0x529a60)['end']();};}function respondWithResult(_0x5a2d8a,_0x4d89b1){_0x4d89b1=_0x4d89b1||0xc8;return function(_0x392ffd){if(_0x392ffd){return _0x5a2d8a['status'](_0x4d89b1)[_0x646b('0x17')](_0x392ffd);}};}function respondWithFilteredResult(_0x2f5d3f,_0x2bba03){return function(_0x1a7239){if(_0x1a7239){var _0x5458e5=typeof _0x2bba03['offset']===_0x646b('0x18')&&typeof _0x2bba03[_0x646b('0x19')]==='undefined';var _0x5c1561=_0x1a7239[_0x646b('0x1a')];var _0x2ec678=_0x5458e5?0x0:_0x2bba03[_0x646b('0x1b')];var _0x4ad889=_0x5458e5?_0x1a7239[_0x646b('0x1a')]:_0x2bba03[_0x646b('0x1b')]+_0x2bba03[_0x646b('0x19')];var _0x3a01d2;if(_0x4ad889>=_0x5c1561){_0x4ad889=_0x5c1561;_0x3a01d2=0xc8;}else{_0x3a01d2=0xce;}_0x2f5d3f[_0x646b('0x16')](_0x3a01d2);return _0x2f5d3f['set'](_0x646b('0x1c'),_0x2ec678+'-'+_0x4ad889+'/'+_0x5c1561)[_0x646b('0x17')](_0x1a7239);}return null;};}function patchUpdates(_0x29ce17){return function(_0x42e998){try{jsonpatch[_0x646b('0x1d')](_0x42e998,_0x29ce17,!![]);}catch(_0x2d0d7f){return BPromise[_0x646b('0x1e')](_0x2d0d7f);}return _0x42e998[_0x646b('0x1f')]();};}function saveUpdates(_0x4c9932,_0x485399){return function(_0x3c4db3){if(_0x3c4db3){return _0x3c4db3[_0x646b('0x20')](_0x4c9932)['then'](function(_0x15dddb){return _0x15dddb;});}return null;};}function removeEntity(_0x305bba,_0xaa2618){return function(_0x528177){if(_0x528177){return _0x528177['destroy']()[_0x646b('0x21')](function(){_0x305bba[_0x646b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504726,_0x506876){return function(_0x4dd81b){if(!_0x4dd81b){_0x504726[_0x646b('0x22')](0x194);}return _0x4dd81b;};}function handleError(_0x234776,_0x349888){_0x349888=_0x349888||0x1f4;return function(_0x6c60fb){logger[_0x646b('0x23')](_0x6c60fb[_0x646b('0x24')]);if(_0x6c60fb['name']){delete _0x6c60fb[_0x646b('0x25')];}_0x234776['status'](_0x349888)[_0x646b('0x26')](_0x6c60fb);};}var utilLicense=require('../../config/license/util');exports[_0x646b('0x27')]=function(_0x104da4,_0x2e104d){var _0x4de315={'raw':!![],'where':{'id':0x1}},_0x3b14b8={};_0x3b14b8[_0x646b('0x28')]=_[_0x646b('0x29')](db[_0x646b('0x2a')][_0x646b('0x2b')]);_0x3b14b8[_0x646b('0x2c')]=_[_0x646b('0x29')](_0x104da4[_0x646b('0x2c')]);_0x3b14b8[_0x646b('0x2d')]=_[_0x646b('0x2e')](_0x3b14b8[_0x646b('0x28')],_0x3b14b8[_0x646b('0x2c')]);_0x4de315['attributes']=_[_0x646b('0x2e')](_0x3b14b8['model'],qs['fields'](_0x104da4[_0x646b('0x2c')][_0x646b('0x2f')]));_0x4de315[_0x646b('0x30')]=_0x4de315[_0x646b('0x30')]['length']?_0x4de315[_0x646b('0x30')]:_0x3b14b8[_0x646b('0x28')];_0x4de315=_[_0x646b('0x31')]({},_0x4de315,_0x104da4[_0x646b('0x32')]);return utilLicense[_0x646b('0x33')](_0x4de315)[_0x646b('0x21')](respondWithResult(_0x2e104d,null))[_0x646b('0x34')](handleError(_0x2e104d,null));};exports[_0x646b('0x20')]=function(_0x2d6b9f,_0x3f14e5){if(_0x2d6b9f['body']['id']){delete _0x2d6b9f[_0x646b('0x35')]['id'];}return db[_0x646b('0x2a')]['find']({'where':{'id':_0x2d6b9f[_0x646b('0x36')]['id']}})['then'](handleEntityNotFound(_0x3f14e5,null))[_0x646b('0x21')](function(_0x3277e8){var _0x352133=_0x3277e8[_0x646b('0x37')]({'plain':!![]});return utilLicense[_0x646b('0x38')](_0x352133,_0x2d6b9f[_0x646b('0x35')][_0x646b('0x39')]);})[_0x646b('0x21')](function(_0x48d296){if(!_0x48d296['demo']){return saveUpdates(_0x2d6b9f[_0x646b('0x35')],null);}return _0x48d296;})[_0x646b('0x21')](respondWithResult(_0x3f14e5,null))[_0x646b('0x34')](handleError(_0x3f14e5,null));};exports[_0x646b('0x3a')]=function(_0xd518a0,_0x5b0609){var _0x2e669=_0x646b('0x3b');var _0x2d5eb6=path[_0x646b('0x3c')](_0x646b('0x3d'),_0x646b('0x3e'),'xcally',_0x2e669);_0x5b0609[_0x646b('0x3f')](_0x646b('0x40'),_0x646b('0x41')+_0x2e669);_0x5b0609['set']('Content-Type',_0x646b('0x42'));_0x5b0609[_0x646b('0x43')](_0x2d5eb6);}; \ No newline at end of file +var _0xd0b9=['/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','end','error','stack','name','send','index','model','keys','rawAttributes','filters','query','attributes','intersection','fields','length','options','getLicense','catch','update','body','License','find','params','checkLicense','key','downloadLogFile','join'];(function(_0xb3eb73,_0x49d849){var _0xca1a5a=function(_0x5050ed){while(--_0x5050ed){_0xb3eb73['push'](_0xb3eb73['shift']());}};_0xca1a5a(++_0x49d849);}(_0xd0b9,0x121));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9d0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d0b('0x1'));var jsonpatch=require(_0x9d0b('0x2'));var rp=require(_0x9d0b('0x3'));var moment=require(_0x9d0b('0x4'));var BPromise=require(_0x9d0b('0x5'));var Mustache=require(_0x9d0b('0x6'));var util=require('util');var path=require(_0x9d0b('0x7'));var sox=require('sox');var csv=require(_0x9d0b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0b('0x9'));var squel=require(_0x9d0b('0xa'));var crypto=require('crypto');var jsforce=require(_0x9d0b('0xb'));var deskjs=require(_0x9d0b('0xc'));var toCsv=require(_0x9d0b('0x8'));var querystring=require('querystring');var Papa=require(_0x9d0b('0xd'));var Redis=require('ioredis');var authService=require(_0x9d0b('0xe'));var qs=require(_0x9d0b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d0b('0x10'));var logger=require(_0x9d0b('0x11'))(_0x9d0b('0x12'));var utils=require(_0x9d0b('0x13'));var config=require(_0x9d0b('0x14'));var licenseUtil=require(_0x9d0b('0x15'));var db=require(_0x9d0b('0x16'))['db'];function respondWithStatusCode(_0x2674b7,_0x50b0a0){_0x50b0a0=_0x50b0a0||0xcc;return function(_0x528a76){if(_0x528a76){return _0x2674b7[_0x9d0b('0x17')](_0x50b0a0);}return _0x2674b7['status'](_0x50b0a0)['end']();};}function respondWithResult(_0x623dbd,_0x2dcfa9){_0x2dcfa9=_0x2dcfa9||0xc8;return function(_0x230d8b){if(_0x230d8b){return _0x623dbd[_0x9d0b('0x18')](_0x2dcfa9)[_0x9d0b('0x19')](_0x230d8b);}};}function respondWithFilteredResult(_0xfc09f9,_0x505ee6){return function(_0x4c6123){if(_0x4c6123){var _0x12d6d0=typeof _0x505ee6['offset']===_0x9d0b('0x1a')&&typeof _0x505ee6[_0x9d0b('0x1b')]===_0x9d0b('0x1a');var _0x209c79=_0x4c6123[_0x9d0b('0x1c')];var _0x328bc9=_0x12d6d0?0x0:_0x505ee6['offset'];var _0x47dd0e=_0x12d6d0?_0x4c6123[_0x9d0b('0x1c')]:_0x505ee6[_0x9d0b('0x1d')]+_0x505ee6[_0x9d0b('0x1b')];var _0x38523c;if(_0x47dd0e>=_0x209c79){_0x47dd0e=_0x209c79;_0x38523c=0xc8;}else{_0x38523c=0xce;}_0xfc09f9[_0x9d0b('0x18')](_0x38523c);return _0xfc09f9['set'](_0x9d0b('0x1e'),_0x328bc9+'-'+_0x47dd0e+'/'+_0x209c79)['json'](_0x4c6123);}return null;};}function patchUpdates(_0x1fc39a){return function(_0x150c7a){try{jsonpatch[_0x9d0b('0x1f')](_0x150c7a,_0x1fc39a,!![]);}catch(_0x5485d3){return BPromise[_0x9d0b('0x20')](_0x5485d3);}return _0x150c7a['save']();};}function saveUpdates(_0x2a4e6f,_0x4a6e9a){return function(_0x28d7ec){if(_0x28d7ec){return _0x28d7ec['update'](_0x2a4e6f)[_0x9d0b('0x21')](function(_0x477cbc){return _0x477cbc;});}return null;};}function removeEntity(_0x7992fd,_0x2ce22e){return function(_0x411afd){if(_0x411afd){return _0x411afd['destroy']()['then'](function(){_0x7992fd[_0x9d0b('0x18')](0xcc)[_0x9d0b('0x22')]();});}};}function handleEntityNotFound(_0x5a6ce3,_0x215b21){return function(_0x12d529){if(!_0x12d529){_0x5a6ce3['sendStatus'](0x194);}return _0x12d529;};}function handleError(_0x637d6f,_0x4b09b7){_0x4b09b7=_0x4b09b7||0x1f4;return function(_0x1b94a8){logger[_0x9d0b('0x23')](_0x1b94a8[_0x9d0b('0x24')]);if(_0x1b94a8[_0x9d0b('0x25')]){delete _0x1b94a8[_0x9d0b('0x25')];}_0x637d6f[_0x9d0b('0x18')](_0x4b09b7)[_0x9d0b('0x26')](_0x1b94a8);};}var utilLicense=require(_0x9d0b('0x15'));exports[_0x9d0b('0x27')]=function(_0x300f7f,_0x22f168){var _0x17e277={'raw':!![],'where':{'id':0x1}},_0x545569={};_0x545569[_0x9d0b('0x28')]=_[_0x9d0b('0x29')](db['License'][_0x9d0b('0x2a')]);_0x545569['query']=_[_0x9d0b('0x29')](_0x300f7f['query']);_0x545569[_0x9d0b('0x2b')]=_['intersection'](_0x545569[_0x9d0b('0x28')],_0x545569[_0x9d0b('0x2c')]);_0x17e277[_0x9d0b('0x2d')]=_[_0x9d0b('0x2e')](_0x545569[_0x9d0b('0x28')],qs[_0x9d0b('0x2f')](_0x300f7f['query'][_0x9d0b('0x2f')]));_0x17e277[_0x9d0b('0x2d')]=_0x17e277[_0x9d0b('0x2d')][_0x9d0b('0x30')]?_0x17e277[_0x9d0b('0x2d')]:_0x545569['model'];_0x17e277=_['merge']({},_0x17e277,_0x300f7f[_0x9d0b('0x31')]);return utilLicense[_0x9d0b('0x32')](_0x17e277)[_0x9d0b('0x21')](respondWithResult(_0x22f168,null))[_0x9d0b('0x33')](handleError(_0x22f168,null));};exports[_0x9d0b('0x34')]=function(_0x5b61af,_0x3fdaae){if(_0x5b61af[_0x9d0b('0x35')]['id']){delete _0x5b61af[_0x9d0b('0x35')]['id'];}return db[_0x9d0b('0x36')][_0x9d0b('0x37')]({'where':{'id':_0x5b61af[_0x9d0b('0x38')]['id']}})[_0x9d0b('0x21')](handleEntityNotFound(_0x3fdaae,null))[_0x9d0b('0x21')](function(_0x4bce75){var _0x41a3ca=_0x4bce75['get']({'plain':!![]});return utilLicense[_0x9d0b('0x39')](_0x41a3ca,_0x5b61af['body'][_0x9d0b('0x3a')]);})[_0x9d0b('0x21')](function(_0x1e3cfe){if(!_0x1e3cfe['demo']){return saveUpdates(_0x5b61af[_0x9d0b('0x35')],null);}return _0x1e3cfe;})[_0x9d0b('0x21')](respondWithResult(_0x3fdaae,null))['catch'](handleError(_0x3fdaae,null));};exports[_0x9d0b('0x3b')]=function(_0x1a32f3,_0xaa3e1e){var _0x28f6c8='license-info.log';var _0x43016a=path[_0x9d0b('0x3c')](_0x9d0b('0x3d'),'log',_0x9d0b('0x3e'),_0x28f6c8);_0xaa3e1e[_0x9d0b('0x3f')](_0x9d0b('0x40'),_0x9d0b('0x41')+_0x28f6c8);_0xaa3e1e[_0x9d0b('0x42')](_0x9d0b('0x43'),_0x9d0b('0x44'));_0xaa3e1e[_0x9d0b('0x45')](_0x43016a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d933baa..ed46e13 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 _0xc4f2=['rimraf','../../config/environment','./license.attributes','exports','license','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xbdfc22,_0x4b57cb){var _0x582683=function(_0x5e6dca){while(--_0x5e6dca){_0xbdfc22['push'](_0xbdfc22['shift']());}};_0x582683(++_0x4b57cb);}(_0xc4f2,0x131));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c4f('0x0'));var util=require(_0x2c4f('0x1'));var logger=require(_0x2c4f('0x2'))(_0x2c4f('0x3'));var moment=require('moment');var BPromise=require(_0x2c4f('0x4'));var rp=require(_0x2c4f('0x5'));var fs=require('fs');var path=require(_0x2c4f('0x6'));var rimraf=require(_0x2c4f('0x7'));var config=require(_0x2c4f('0x8'));var attributes=require(_0x2c4f('0x9'));module[_0x2c4f('0xa')]=function(_0x46e826,_0x1e1143){return _0x46e826['define']('License',attributes,{'tableName':_0x2c4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb82=['path','rimraf','../../config/environment','./license.attributes','lodash','../../config/logger','api','request-promise'];(function(_0x96821,_0x562bc9){var _0x1311ef=function(_0xba6f25){while(--_0xba6f25){_0x96821['push'](_0x96821['shift']());}};_0x1311ef(++_0x562bc9);}(_0xdb82,0x1dc));var _0x2db8=function(_0x411203,_0x43a372){_0x411203=_0x411203-0x0;var _0x59db21=_0xdb82[_0x411203];return _0x59db21;};'use strict';var _=require(_0x2db8('0x0'));var util=require('util');var logger=require(_0x2db8('0x1'))(_0x2db8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2db8('0x3'));var fs=require('fs');var path=require(_0x2db8('0x4'));var rimraf=require(_0x2db8('0x5'));var config=require(_0x2db8('0x6'));var attributes=require(_0x2db8('0x7'));module['exports']=function(_0x483ba3,_0x1d61e9){return _0x483ba3['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a11f991..d210cda 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 _0x67c1=['request\x20sent','error','code','License,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x40ceb7,_0x3d2f08){var _0x5afd5c=function(_0x401058){while(--_0x401058){_0x40ceb7['push'](_0x40ceb7['shift']());}};_0x5afd5c(++_0x3d2f08);}(_0x67c1,0x1e2));var _0x167c=function(_0x15d203,_0x5b93ba){_0x15d203=_0x15d203-0x0;var _0x350cf6=_0x67c1[_0x15d203];return _0x350cf6;};'use strict';var _=require(_0x167c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x167c('0x1'));var rs=require(_0x167c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x167c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x167c('0x4'))(_0x167c('0x5'));var config=require(_0x167c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x167c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1226cf,_0x56c385,_0x249b7b){return new BPromise(function(_0x1eec23,_0x31248d){return client['request'](_0x1226cf,_0x249b7b)['then'](function(_0x27505b){logger[_0x167c('0x8')]('License,\x20%s,\x20%s',_0x56c385,'request\x20sent');logger[_0x167c('0x9')](_0x167c('0xa'),_0x56c385,_0x167c('0xb'),JSON['stringify'](_0x27505b));if(_0x27505b[_0x167c('0xc')]){if(_0x27505b[_0x167c('0xc')][_0x167c('0xd')]===0x1f4){logger[_0x167c('0xc')](_0x167c('0xe'),_0x56c385,_0x27505b[_0x167c('0xc')][_0x167c('0xf')]);return _0x31248d(_0x27505b[_0x167c('0xc')]['message']);}logger[_0x167c('0xc')](_0x167c('0xe'),_0x56c385,_0x27505b[_0x167c('0xc')][_0x167c('0xf')]);return _0x1eec23(_0x27505b[_0x167c('0xc')]['message']);}else{logger['info'](_0x167c('0xe'),_0x56c385,'request\x20sent');_0x1eec23(_0x27505b[_0x167c('0x10')][_0x167c('0xf')]);}})['catch'](function(_0x5c6bc8){logger[_0x167c('0xc')](_0x167c('0xe'),_0x56c385,_0x5c6bc8);_0x31248d(_0x5c6bc8);});});} \ No newline at end of file +var _0xd004=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xd3a35,_0x6299d9){var _0x418901=function(_0x55135b){while(--_0x55135b){_0xd3a35['push'](_0xd3a35['shift']());}};_0x418901(++_0x6299d9);}(_0xd004,0xc2));var _0x4d00=function(_0x451ef3,_0x4331d7){_0x451ef3=_0x451ef3-0x0;var _0x257295=_0xd004[_0x451ef3];return _0x257295;};'use strict';var _=require(_0x4d00('0x0'));var util=require(_0x4d00('0x1'));var moment=require(_0x4d00('0x2'));var BPromise=require(_0x4d00('0x3'));var rs=require(_0x4d00('0x4'));var fs=require('fs');var Redis=require(_0x4d00('0x5'));var db=require(_0x4d00('0x6'))['db'];var utils=require(_0x4d00('0x7'));var logger=require(_0x4d00('0x8'))(_0x4d00('0x9'));var config=require(_0x4d00('0xa'));var jayson=require(_0x4d00('0xb'));var client=jayson[_0x4d00('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41180c,_0x268be9,_0x1ef09a){return new BPromise(function(_0x2a82e3,_0xcadd2e){return client[_0x4d00('0xd')](_0x41180c,_0x1ef09a)['then'](function(_0x3cf331){logger[_0x4d00('0xe')](_0x4d00('0xf'),_0x268be9,_0x4d00('0x10'));logger[_0x4d00('0x11')](_0x4d00('0x12'),_0x268be9,'request\x20sent',JSON[_0x4d00('0x13')](_0x3cf331));if(_0x3cf331[_0x4d00('0x14')]){if(_0x3cf331[_0x4d00('0x14')][_0x4d00('0x15')]===0x1f4){logger[_0x4d00('0x14')]('License,\x20%s,\x20%s',_0x268be9,_0x3cf331[_0x4d00('0x14')][_0x4d00('0x16')]);return _0xcadd2e(_0x3cf331[_0x4d00('0x14')][_0x4d00('0x16')]);}logger[_0x4d00('0x14')](_0x4d00('0xf'),_0x268be9,_0x3cf331[_0x4d00('0x14')][_0x4d00('0x16')]);return _0x2a82e3(_0x3cf331['error'][_0x4d00('0x16')]);}else{logger['info'](_0x4d00('0xf'),_0x268be9,_0x4d00('0x10'));_0x2a82e3(_0x3cf331[_0x4d00('0x17')]['message']);}})[_0x4d00('0x18')](function(_0x3e93ab){logger[_0x4d00('0x14')](_0x4d00('0xf'),_0x268be9,_0x3e93ab);_0xcadd2e(_0x3e93ab);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index fcdb4f0..6cdacac 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 _0x0cc4=['isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index'];(function(_0x2709b0,_0x11120a){var _0x417bb8=function(_0x174f1a){while(--_0x174f1a){_0x2709b0['push'](_0x2709b0['shift']());}};_0x417bb8(++_0x11120a);}(_0x0cc4,0x123));var _0x40cc=function(_0x4934aa,_0x55d2a3){_0x4934aa=_0x4934aa-0x0;var _0x59dd38=_0x0cc4[_0x4934aa];return _0x59dd38;};'use strict';var multer=require('multer');var util=require(_0x40cc('0x0'));var path=require(_0x40cc('0x1'));var timeout=require(_0x40cc('0x2'));var express=require('express');var router=express[_0x40cc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40cc('0x4'));var interaction=require(_0x40cc('0x5'));var config=require(_0x40cc('0x6'));var controller=require(_0x40cc('0x7'));router[_0x40cc('0x8')]('/',auth['isAuthenticated'](),controller[_0x40cc('0x9')]);router[_0x40cc('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x40cc('0x8')]('/:id',auth[_0x40cc('0xa')](),controller[_0x40cc('0xb')]);router[_0x40cc('0x8')](_0x40cc('0xc'),auth['isAuthenticated'](),controller[_0x40cc('0xd')]);router[_0x40cc('0x8')]('/:id/canned_answers',auth[_0x40cc('0xa')](),controller[_0x40cc('0xe')]);router[_0x40cc('0x8')](_0x40cc('0xf'),auth['isAuthenticated'](),controller[_0x40cc('0x10')]);router['get'](_0x40cc('0x11'),auth[_0x40cc('0xa')](),controller['getSmtp']);router[_0x40cc('0x8')](_0x40cc('0x12'),auth[_0x40cc('0xa')](),controller['getInteractions']);router[_0x40cc('0x8')](_0x40cc('0x13'),auth[_0x40cc('0xa')](),controller['getApplications']);router[_0x40cc('0x8')](_0x40cc('0x14'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x15')]);router[_0x40cc('0x8')]('/:id/verify',auth[_0x40cc('0xa')](),controller[_0x40cc('0x16')]);router['get'](_0x40cc('0x17'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x18')]);router[_0x40cc('0x19')](_0x40cc('0xc'),auth[_0x40cc('0xa')](),controller['addDisposition']);router['post'](_0x40cc('0x1a'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x1b')]);router[_0x40cc('0x19')]('/',auth[_0x40cc('0xa')](),controller[_0x40cc('0x1c')]);router[_0x40cc('0x19')](_0x40cc('0xf'),auth['isAuthenticated'](),controller[_0x40cc('0x1d')]);router[_0x40cc('0x19')](_0x40cc('0x11'),auth['isAuthenticated'](),controller[_0x40cc('0x1e')]);router[_0x40cc('0x19')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x40cc('0x1f')]);router[_0x40cc('0x19')]('/:id/applications',auth[_0x40cc('0xa')](),controller['addApplications']);router[_0x40cc('0x19')](_0x40cc('0x20'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x21')]);router[_0x40cc('0x19')](_0x40cc('0x17'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x40cc('0x23')]);router[_0x40cc('0x24')](_0x40cc('0xc'),auth[_0x40cc('0xa')](),controller['removeDispositions']);router['delete'](_0x40cc('0x1a'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x25')]);router[_0x40cc('0x24')](_0x40cc('0xf'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x26')]);router[_0x40cc('0x24')](_0x40cc('0x11'),auth[_0x40cc('0xa')](),controller[_0x40cc('0x27')]);router[_0x40cc('0x24')]('/:id',auth[_0x40cc('0xa')](),controller[_0x40cc('0x28')]);router[_0x40cc('0x24')](_0x40cc('0x17'),auth['isAuthenticated'](),controller[_0x40cc('0x29')]);module[_0x40cc('0x2a')]=router; \ No newline at end of file +var _0xfa32=['describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/interactions','addInteraction','/:id/send','send','addAgents','put','update','delete','/:id/dispositions','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe'];(function(_0x16ed6f,_0x2b4878){var _0x325519=function(_0x3b8613){while(--_0x3b8613){_0x16ed6f['push'](_0x16ed6f['shift']());}};_0x325519(++_0x2b4878);}(_0xfa32,0xde));var _0x2fa3=function(_0x23b5ca,_0x8e6546){_0x23b5ca=_0x23b5ca-0x0;var _0x13313b=_0xfa32[_0x23b5ca];return _0x13313b;};'use strict';var multer=require(_0x2fa3('0x0'));var util=require(_0x2fa3('0x1'));var path=require(_0x2fa3('0x2'));var timeout=require(_0x2fa3('0x3'));var express=require(_0x2fa3('0x4'));var router=express[_0x2fa3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2fa3('0x6'));var interaction=require(_0x2fa3('0x7'));var config=require(_0x2fa3('0x8'));var controller=require(_0x2fa3('0x9'));router[_0x2fa3('0xa')]('/',auth[_0x2fa3('0xb')](),controller['index']);router[_0x2fa3('0xa')](_0x2fa3('0xc'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0xd')]);router[_0x2fa3('0xa')](_0x2fa3('0xe'),auth['isAuthenticated'](),controller[_0x2fa3('0xf')]);router[_0x2fa3('0xa')]('/:id/dispositions',auth[_0x2fa3('0xb')](),controller['getDispositions']);router[_0x2fa3('0xa')](_0x2fa3('0x10'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x11')]);router['get'](_0x2fa3('0x12'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x13')]);router[_0x2fa3('0xa')](_0x2fa3('0x14'),auth['isAuthenticated'](),controller[_0x2fa3('0x15')]);router['get']('/:id/interactions',auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x16')]);router['get'](_0x2fa3('0x17'),auth[_0x2fa3('0xb')](),controller['getApplications']);router[_0x2fa3('0xa')](_0x2fa3('0x18'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x19')]);router[_0x2fa3('0xa')](_0x2fa3('0x1a'),auth['isAuthenticated'](),controller[_0x2fa3('0x1b')]);router[_0x2fa3('0xa')](_0x2fa3('0x1c'),auth['isAuthenticated'](),controller[_0x2fa3('0x1d')]);router[_0x2fa3('0x1e')]('/:id/dispositions',auth[_0x2fa3('0xb')](),controller['addDisposition']);router[_0x2fa3('0x1e')](_0x2fa3('0x10'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x1f')]);router[_0x2fa3('0x1e')]('/',auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x20')]);router[_0x2fa3('0x1e')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x2fa3('0x21')]);router['post'](_0x2fa3('0x14'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x2fa3('0x1e')](_0x2fa3('0x22'),auth['isAuthenticated'](),controller[_0x2fa3('0x23')]);router[_0x2fa3('0x1e')]('/:id/applications',auth[_0x2fa3('0xb')](),controller['addApplications']);router[_0x2fa3('0x1e')](_0x2fa3('0x24'),auth['isAuthenticated'](),controller[_0x2fa3('0x25')]);router[_0x2fa3('0x1e')]('/:id/users',auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x26')]);router[_0x2fa3('0x27')](_0x2fa3('0xe'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x28')]);router[_0x2fa3('0x29')](_0x2fa3('0x2a'),auth[_0x2fa3('0xb')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x2fa3('0xb')](),controller['removeAnswers']);router[_0x2fa3('0x29')](_0x2fa3('0x12'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x2b')]);router['delete'](_0x2fa3('0x14'),auth[_0x2fa3('0xb')](),controller[_0x2fa3('0x2c')]);router[_0x2fa3('0x29')](_0x2fa3('0xe'),auth[_0x2fa3('0xb')](),controller['destroy']);router[_0x2fa3('0x29')](_0x2fa3('0x1c'),auth['isAuthenticated'](),controller[_0x2fa3('0x2d')]);module[_0x2fa3('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 52cce72..e5c442c 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 _0x4009=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','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(_0x3e87f6,_0x4f9368){var _0x5b6ea4=function(_0x4d1d16){while(--_0x4d1d16){_0x3e87f6['push'](_0x3e87f6['shift']());}};_0x5b6ea4(++_0x4f9368);}(_0x4009,0x139));var _0x9400=function(_0x367252,_0x4e1f72){_0x367252=_0x367252-0x0;var _0xad36d1=_0x4009[_0x367252];return _0xad36d1;};'use strict';var Sequelize=require(_0x9400('0x0'));module[_0x9400('0x1')]={'description':{'type':Sequelize[_0x9400('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x9400('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9400('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x9400('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9400('0x4')]},'markAsUnread':{'type':Sequelize[_0x9400('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9400('0x2')],'allowNull':![],'defaultValue':_0x9400('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9400('0x4')],'defaultValue':function(){return _0x9400('0x6');}},'notificationSound':{'type':Sequelize[_0x9400('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9400('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9400('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9400('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9400('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9400('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9400('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9400('0x3')],'defaultValue':![],'comment':_0x9400('0x9'),'set':function(_0x464e19){if(!_0x464e19)this[_0x9400('0xa')](_0x9400('0xb'),null);this[_0x9400('0xa')](_0x9400('0xc'),_0x464e19);}},'provider':{'type':Sequelize[_0x9400('0xd')](_0x9400('0xe'),_0x9400('0xf'),'yahoo',_0x9400('0x10')),'defaultValue':null,'get':function(){if(!this[_0x9400('0x11')](_0x9400('0x12')))return _0x9400('0x13');return this[_0x9400('0x11')]('provider');},'set':function(_0x36bbdf){if(_0x36bbdf===_0x9400('0x13'))_0x36bbdf=null;return this[_0x9400('0xa')](_0x9400('0x12'),_0x36bbdf);}}}; \ No newline at end of file +var _0x1ffa=['TEXT','Arial,Helvetica,sans-serif','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0xfceeb8,_0x1c112c){var _0x34ff47=function(_0x154ae6){while(--_0x154ae6){_0xfceeb8['push'](_0xfceeb8['shift']());}};_0x34ff47(++_0x1c112c);}(_0x1ffa,0x1c4));var _0xa1ff=function(_0x408eb5,_0x4e05bd){_0x408eb5=_0x408eb5-0x0;var _0x2a8b7c=_0x1ffa[_0x408eb5];return _0x2a8b7c;};'use strict';var Sequelize=require(_0xa1ff('0x0'));module[_0xa1ff('0x1')]={'description':{'type':Sequelize[_0xa1ff('0x2')]},'name':{'type':Sequelize[_0xa1ff('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa1ff('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa1ff('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa1ff('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa1ff('0x2')],'allowNull':![],'defaultValue':_0xa1ff('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa1ff('0x6');}},'notificationSound':{'type':Sequelize[_0xa1ff('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa1ff('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa1ff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa1ff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa1ff('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa1ff('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xa1ff('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa1ff('0x9'),'set':function(_0x3a7c53){if(!_0x3a7c53)this[_0xa1ff('0xa')](_0xa1ff('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x3a7c53);}},'provider':{'type':Sequelize[_0xa1ff('0xc')](_0xa1ff('0xd'),_0xa1ff('0xe'),_0xa1ff('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xa1ff('0x10')](_0xa1ff('0x11')))return _0xa1ff('0x12');return this[_0xa1ff('0x10')](_0xa1ff('0x11'));},'set':function(_0x41e67e){if(_0x41e67e===_0xa1ff('0x12'))_0x41e67e=null;return this[_0xa1ff('0xa')]('provider',_0x41e67e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 940ae3c..a2fd476 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 _0xa9d6=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','include','show','MailServerIn','includeAll','provider','custom','body','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','findOne','Disposition','order','filter','rows','removeDispositions','addAnswer','CannedAnswer','findAll','removeAnswers','ids','create','email','ListId','isNil','active','description','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','CmContact','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','moment','bluebird','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key'];(function(_0x3e6432,_0x38edf1){var _0x33956e=function(_0x3a65ba){while(--_0x3a65ba){_0x3e6432['push'](_0x3e6432['shift']());}};_0x33956e(++_0x38edf1);}(_0xa9d6,0x72));var _0x6a9d=function(_0xa85d7c,_0x8958ab){_0xa85d7c=_0xa85d7c-0x0;var _0x5429ae=_0xa9d6[_0xa85d7c];return _0x5429ae;};'use strict';var moment=require(_0x6a9d('0x0'));var BPromise=require(_0x6a9d('0x1'));var util=require('util');var path=require('path');var _=require(_0x6a9d('0x2'));var juice=require(_0x6a9d('0x3'));var Redis=require(_0x6a9d('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6a9d('0x5'))(_0x6a9d('0x6'));var config=require(_0x6a9d('0x7'));var db=require(_0x6a9d('0x8'))['db'];config[_0x6a9d('0x9')]=_[_0x6a9d('0xa')](config[_0x6a9d('0x9')],{'host':_0x6a9d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a9d('0x9')]));require(_0x6a9d('0xc'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x45dfb5,_0xd29f63,_0x39d803,_0x3944e6){return new BPromise(function(_0xeb7f69,_0xf3c244){var _0x385453=_0x3944e6||client;return _0x385453[_0x6a9d('0xd')](_0x45dfb5,_0x39d803)[_0x6a9d('0xe')](function(_0x4d5004){logger[_0x6a9d('0xf')]('MailAccount,\x20%s,\x20%s',_0xd29f63,_0x6a9d('0x10'));logger['debug'](_0x6a9d('0x11'),_0xd29f63,_0x6a9d('0x10'),JSON['stringify'](_0x4d5004));if(_0x4d5004['error']){if(_0x4d5004[_0x6a9d('0x12')][_0x6a9d('0x13')]===0x1f4){logger['error'](_0x6a9d('0x14'),_0xd29f63,_0x4d5004[_0x6a9d('0x12')]['message']);return _0xf3c244(_0x4d5004[_0x6a9d('0x12')][_0x6a9d('0x15')]);}logger[_0x6a9d('0x12')](_0x6a9d('0x14'),_0xd29f63,_0x4d5004[_0x6a9d('0x12')]['message']);return _0xeb7f69(_0x4d5004[_0x6a9d('0x12')]['message']);}else{logger['info'](_0x6a9d('0x14'),_0xd29f63,_0x6a9d('0x10'));_0xeb7f69(_0x4d5004[_0x6a9d('0x16')]['message']);}})[_0x6a9d('0x17')](function(_0x410b02){logger[_0x6a9d('0x12')](_0x6a9d('0x14'),_0xd29f63,_0x410b02);_0xf3c244(_0x410b02);});});}function respondWithStatusCode(_0x4c451f,_0x122313){_0x122313=_0x122313||0xcc;return function(_0x4038cc){if(_0x4038cc){return _0x4c451f[_0x6a9d('0x18')](_0x122313);}return _0x4c451f['status'](_0x122313)[_0x6a9d('0x19')]();};}function respondWithResult(_0x4a16db,_0x51d184){_0x51d184=_0x51d184||0xc8;return function(_0x3cfcf3){if(_0x3cfcf3){return _0x4a16db[_0x6a9d('0x1a')](_0x51d184)[_0x6a9d('0x1b')](_0x3cfcf3);}};}function respondWithFilteredResult(_0x2ecfc5,_0x3615b3){return function(_0x5caf55){if(_0x5caf55){var _0x2c36e5=typeof _0x3615b3[_0x6a9d('0x1c')]===_0x6a9d('0x1d')&&typeof _0x3615b3[_0x6a9d('0x1e')]===_0x6a9d('0x1d');var _0x5d1808=_0x5caf55['count'];var _0x4cf32a=_0x2c36e5?0x0:_0x3615b3['offset'];var _0x125576=_0x2c36e5?_0x5caf55[_0x6a9d('0x1f')]:_0x3615b3[_0x6a9d('0x1c')]+_0x3615b3[_0x6a9d('0x1e')];var _0x2bdca8;if(_0x125576>=_0x5d1808){_0x125576=_0x5d1808;_0x2bdca8=0xc8;}else{_0x2bdca8=0xce;}_0x2ecfc5[_0x6a9d('0x1a')](_0x2bdca8);return _0x2ecfc5[_0x6a9d('0x20')]('Content-Range',_0x4cf32a+'-'+_0x125576+'/'+_0x5d1808)[_0x6a9d('0x1b')](_0x5caf55);}return null;};}function saveUpdates(_0x44d5e3){return function(_0x2ba7d5){if(_0x2ba7d5){return _0x2ba7d5[_0x6a9d('0x21')](_0x44d5e3)[_0x6a9d('0xe')](function(_0x33473e){return _0x33473e;});}return null;};}function removeEntity(_0x2e8d6f){return function(_0x31413d){if(_0x31413d){return _0x31413d[_0x6a9d('0x22')]()[_0x6a9d('0xe')](function(){var _0x4056cb=_0x31413d[_0x6a9d('0x23')]({'plain':!![]});var _0x27877c=_0x6a9d('0x24');return db[_0x6a9d('0x25')][_0x6a9d('0x22')]({'where':{'type':_0x27877c,'resourceId':_0x4056cb['id']}})['then'](function(){return _0x31413d;});})[_0x6a9d('0xe')](function(){_0x2e8d6f['status'](0xcc)[_0x6a9d('0x19')]();});}};}function handleEntityNotFound(_0x3b5eb4){return function(_0xe45d73){if(!_0xe45d73){_0x3b5eb4['sendStatus'](0x194);}return _0xe45d73;};}function handleError(_0x3b4a13,_0x47814d){_0x47814d=_0x47814d||0x1f4;return function(_0x5d3948){logger['error'](_0x5d3948[_0x6a9d('0x26')]);if(_0x5d3948[_0x6a9d('0x27')]){delete _0x5d3948[_0x6a9d('0x27')];}_0x3b4a13['status'](_0x47814d)[_0x6a9d('0x28')](_0x5d3948);};}function getImapHost(_0x32f908){switch(_0x32f908){case _0x6a9d('0x29'):return _0x6a9d('0x2a');case _0x6a9d('0x2b'):return _0x6a9d('0x2c');case _0x6a9d('0x2d'):return _0x6a9d('0x2e');case _0x6a9d('0x2f'):return _0x6a9d('0x30');}throw new Error(_0x6a9d('0x31'),_0x32f908);}function getSmtpHost(_0x183702){switch(_0x183702){case _0x6a9d('0x29'):return _0x6a9d('0x32');case _0x6a9d('0x2b'):return _0x6a9d('0x33');case _0x6a9d('0x2d'):return _0x6a9d('0x34');case _0x6a9d('0x2f'):return _0x6a9d('0x35');}throw new Error(_0x6a9d('0x31'),_0x183702);}function getAuthenticationOptions(_0x1e3c01,_0x26acf7){var _0x46077e={};var _0x2d706b={};if(_0x1e3c01){_0x46077e[_0x6a9d('0x36')]=_0x2d706b['user']=_0x26acf7[_0x6a9d('0x37')];_0x46077e[_0x6a9d('0x38')]=_0x2d706b[_0x6a9d('0x39')]=_0x26acf7[_0x6a9d('0x38')];if(_0x26acf7['modernAuthentication']){_0x46077e[_0x6a9d('0x3a')]=_0x2d706b['modernAuthentication']=!![];_0x46077e['CloudProviderId']=_0x2d706b['CloudProviderId']=_0x26acf7[_0x6a9d('0x3b')];_0x46077e[_0x6a9d('0x38')]=_0x2d706b[_0x6a9d('0x39')]=null;}else{_0x46077e[_0x6a9d('0x3b')]=_0x2d706b[_0x6a9d('0x3b')]=null;}_0x46077e['host']=getImapHost(_0x1e3c01);_0x46077e[_0x6a9d('0x3c')]=0x3e1;_0x2d706b[_0x6a9d('0x3d')]=getSmtpHost(_0x1e3c01);_0x2d706b['port']=0x24b;_0x2d706b[_0x6a9d('0x3e')]=![];_0x46077e[_0x6a9d('0x3f')]=_0x2d706b[_0x6a9d('0x3f')]=null;}else{if(_0x26acf7['authentication']){_0x46077e[_0x6a9d('0x36')]=_0x2d706b['user']=_0x26acf7[_0x6a9d('0x37')];_0x46077e[_0x6a9d('0x38')]=_0x2d706b[_0x6a9d('0x39')]=_0x26acf7[_0x6a9d('0x38')];}else{_0x46077e['authentication']=_0x2d706b['authentication']=![];_0x46077e[_0x6a9d('0x36')]=_0x2d706b['user']=null;_0x46077e[_0x6a9d('0x38')]=_0x2d706b[_0x6a9d('0x39')]=null;}_0x46077e['host']=_0x26acf7[_0x6a9d('0x40')][_0x6a9d('0x3d')];_0x46077e[_0x6a9d('0x3c')]=_0x26acf7['Imap'][_0x6a9d('0x3c')];_0x2d706b[_0x6a9d('0x3d')]=_0x26acf7[_0x6a9d('0x41')][_0x6a9d('0x3d')];_0x2d706b[_0x6a9d('0x3c')]=_0x26acf7[_0x6a9d('0x41')]['port'];}return{'Imap':_0x46077e,'Smtp':_0x2d706b};}exports[_0x6a9d('0x42')]=function(_0x135bc3,_0xfd9eb6){var _0x5c2f71={'include':[{'model':db['MailServerIn'],'as':_0x6a9d('0x40')},{'model':db[_0x6a9d('0x43')],'as':_0x6a9d('0x41')},{'model':db[_0x6a9d('0x44')],'as':_0x6a9d('0x45')}]},_0x2d7e21={},_0x5d6a5c={'count':0x0,'rows':[]};var _0x336d34=_[_0x6a9d('0x46')](db[_0x6a9d('0x47')][_0x6a9d('0x48')],function(_0x1fea8b){return{'name':_0x1fea8b[_0x6a9d('0x49')],'type':_0x1fea8b['type'][_0x6a9d('0x4a')]};});_0x2d7e21['model']=_[_0x6a9d('0x46')](_0x336d34,_0x6a9d('0x27'));_0x2d7e21[_0x6a9d('0x4b')]=_[_0x6a9d('0x4c')](_0x135bc3[_0x6a9d('0x4b')]);_0x2d7e21[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0x2d7e21[_0x6a9d('0x4f')],_0x2d7e21[_0x6a9d('0x4b')]);_0x5c2f71[_0x6a9d('0x50')]=_[_0x6a9d('0x4e')](_0x2d7e21[_0x6a9d('0x4f')],qs['fields'](_0x135bc3['query'][_0x6a9d('0x51')]));_0x5c2f71[_0x6a9d('0x50')]=_0x5c2f71['attributes'][_0x6a9d('0x52')]?_0x5c2f71[_0x6a9d('0x50')]:_0x2d7e21['model'];if(!_0x135bc3[_0x6a9d('0x4b')][_0x6a9d('0x53')](_0x6a9d('0x54'))){_0x5c2f71[_0x6a9d('0x1e')]=qs[_0x6a9d('0x1e')](_0x135bc3[_0x6a9d('0x4b')][_0x6a9d('0x1e')]);_0x5c2f71[_0x6a9d('0x1c')]=qs[_0x6a9d('0x1c')](_0x135bc3[_0x6a9d('0x4b')]['offset']);}_0x5c2f71['order']=qs['sort'](_0x135bc3[_0x6a9d('0x4b')][_0x6a9d('0x55')]);_0x5c2f71[_0x6a9d('0x56')]=qs[_0x6a9d('0x4d')](_[_0x6a9d('0x57')](_0x135bc3[_0x6a9d('0x4b')],_0x2d7e21[_0x6a9d('0x4d')]),_0x336d34);if(_0x135bc3[_0x6a9d('0x4b')]['filter']){_0x5c2f71[_0x6a9d('0x56')]=_[_0x6a9d('0x58')](_0x5c2f71[_0x6a9d('0x56')],{'$or':_[_0x6a9d('0x46')](_0x336d34,function(_0x1ab1ce){if(_0x1ab1ce[_0x6a9d('0x59')]!==_0x6a9d('0x5a')){var _0x2de54b={};_0x2de54b[_0x1ab1ce['name']]={'$like':'%'+_0x135bc3[_0x6a9d('0x4b')]['filter']+'%'};return _0x2de54b;}})});}_0x5c2f71=_[_0x6a9d('0x58')]({},_0x5c2f71,_0x135bc3[_0x6a9d('0x5b')]);var _0x557a84={'where':_0x5c2f71[_0x6a9d('0x56')]};return db['MailAccount'][_0x6a9d('0x1f')](_0x557a84)[_0x6a9d('0xe')](function(_0x28200a){_0x5d6a5c[_0x6a9d('0x1f')]=_0x28200a;if(_0x135bc3[_0x6a9d('0x4b')]['includeAll']){_0x5c2f71[_0x6a9d('0x5c')]=[{'all':!![]}];}return db[_0x6a9d('0x47')]['findAll'](_0x5c2f71);})[_0x6a9d('0xe')](function(_0x179d3a){_0x5d6a5c['rows']=_0x179d3a;return _0x5d6a5c;})[_0x6a9d('0xe')](respondWithFilteredResult(_0xfd9eb6,_0x5c2f71))[_0x6a9d('0x17')](handleError(_0xfd9eb6,null));};exports[_0x6a9d('0x5d')]=function(_0x3f502e,_0x42a798){var _0x46073a={'raw':![],'where':{'id':_0x3f502e['params']['id']},'include':[{'model':db[_0x6a9d('0x5e')],'as':_0x6a9d('0x40')},{'model':db[_0x6a9d('0x43')],'as':_0x6a9d('0x41')},{'model':db[_0x6a9d('0x44')],'as':_0x6a9d('0x45')}]},_0x237317={};_0x237317['model']=_[_0x6a9d('0x4c')](db[_0x6a9d('0x47')][_0x6a9d('0x48')]);_0x237317['query']=_[_0x6a9d('0x4c')](_0x3f502e['query']);_0x237317[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0x237317[_0x6a9d('0x4f')],_0x237317[_0x6a9d('0x4b')]);_0x46073a[_0x6a9d('0x50')]=_[_0x6a9d('0x4e')](_0x237317['model'],qs[_0x6a9d('0x51')](_0x3f502e[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x46073a[_0x6a9d('0x50')]=_0x46073a[_0x6a9d('0x50')][_0x6a9d('0x52')]?_0x46073a[_0x6a9d('0x50')]:_0x237317['model'];if(_0x3f502e[_0x6a9d('0x4b')][_0x6a9d('0x5f')]){_0x46073a[_0x6a9d('0x5c')]=[{'all':!![]}];}_0x46073a=_[_0x6a9d('0x58')]({},_0x46073a,_0x3f502e[_0x6a9d('0x5b')]);return db[_0x6a9d('0x47')]['find'](_0x46073a)['then'](handleEntityNotFound(_0x42a798,null))[_0x6a9d('0xe')](respondWithResult(_0x42a798,null))['catch'](handleError(_0x42a798,null));};exports[_0x6a9d('0x21')]=function(_0x328b26,_0x597db9){if(_0x328b26['body']['id']){delete _0x328b26['body']['id'];}var _0x2928d3=_0x328b26['body'][_0x6a9d('0x60')]===_0x6a9d('0x61')?null:_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x60')];var _0x5e233d=_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x40')]||{};var _0xf74570=_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x41')]||{};if(_0x2928d3){_0x5e233d[_0x6a9d('0x3d')]=getImapHost(_0x2928d3);_0x5e233d[_0x6a9d('0x3c')]=0x3e1;_0xf74570[_0x6a9d('0x3d')]=getSmtpHost(_0x2928d3);_0xf74570[_0x6a9d('0x3c')]=0x24b;_0xf74570[_0x6a9d('0x3e')]=![];}if(_0xf74570[_0x6a9d('0x3a')]){_0xf74570['secure']=![];}else{_0xf74570['CloudProviderId']=null;}if(!_0x5e233d[_0x6a9d('0x3a')])_0x5e233d['CloudProviderId']=null;_0x328b26['body'][_0x6a9d('0x40')]=_0x5e233d;_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x41')]=_0xf74570;return db['MailAccount'][_0x6a9d('0x63')]({'where':{'id':_0x328b26[_0x6a9d('0x64')]['id']},'include':[{'model':db[_0x6a9d('0x5e')],'as':_0x6a9d('0x40')},{'model':db[_0x6a9d('0x43')],'as':_0x6a9d('0x41')},{'model':db[_0x6a9d('0x44')],'as':_0x6a9d('0x45')}]})[_0x6a9d('0xe')](handleEntityNotFound(_0x597db9,null))['then'](function(_0x7a172c){if(!_0x7a172c)throw new Error(_0x6a9d('0x65'));if(_0x7a172c[_0x6a9d('0x3f')])delete _0x328b26[_0x6a9d('0x62')]['Imap'];return _0x7a172c;})[_0x6a9d('0xe')](saveUpdates(_0x328b26['body'],null))['then'](function(_0x300034){if(!_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x40')])return _0x300034;return db[_0x6a9d('0x5e')]['update'](_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x40')],{'where':{'MailAccountId':_0x300034['id']}})['then'](function(){return _0x300034;});})[_0x6a9d('0xe')](function(_0x1f987d){if(!_0x328b26[_0x6a9d('0x62')]['Smtp'])return _0x1f987d;return db[_0x6a9d('0x43')][_0x6a9d('0x21')](_0x328b26[_0x6a9d('0x62')][_0x6a9d('0x41')],{'where':{'MailAccountId':_0x1f987d['id']}})[_0x6a9d('0xe')](function(){return _0x1f987d;});})[_0x6a9d('0xe')](respondWithResult(_0x597db9,null))[_0x6a9d('0x17')](handleError(_0x597db9,null));};exports['describe']=function(_0x112d80,_0x441b02){return db[_0x6a9d('0x47')][_0x6a9d('0x66')]()['then'](respondWithResult(_0x441b02,null))[_0x6a9d('0x17')](handleError(_0x441b02,null));};exports[_0x6a9d('0x67')]=function(_0x5dcac0,_0x15c59f){if(_0x5dcac0[_0x6a9d('0x62')]['id']){delete _0x5dcac0[_0x6a9d('0x62')]['id'];}return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x5dcac0[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x15c59f,null))[_0x6a9d('0xe')](function(_0x24a24b){if(_0x24a24b){_0x5dcac0[_0x6a9d('0x62')][_0x6a9d('0x68')]=_0x24a24b['id'];return db['Disposition']['create'](_0x5dcac0[_0x6a9d('0x62')]);}})[_0x6a9d('0xe')](respondWithResult(_0x15c59f,null))['catch'](handleError(_0x15c59f,null));};exports['getDispositions']=function(_0x59e0c5,_0x9af8b5){var _0x20a8c6={'raw':![],'where':{}};var _0x2f7ed0={};var _0x4f8a55={'count':0x0,'rows':[]};return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x59e0c5[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x9af8b5,null))['then'](function(_0x156f28){if(_0x156f28){_0x2f7ed0[_0x6a9d('0x4f')]=_[_0x6a9d('0x4c')](db[_0x6a9d('0x6a')][_0x6a9d('0x48')]);_0x2f7ed0['query']=_[_0x6a9d('0x4c')](_0x59e0c5[_0x6a9d('0x4b')]);_0x2f7ed0[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0x2f7ed0['model'],_0x2f7ed0[_0x6a9d('0x4b')]);_0x20a8c6[_0x6a9d('0x50')]=_[_0x6a9d('0x4e')](_0x2f7ed0[_0x6a9d('0x4f')],qs[_0x6a9d('0x51')](_0x59e0c5[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x20a8c6[_0x6a9d('0x50')]=_0x20a8c6['attributes']['length']?_0x20a8c6[_0x6a9d('0x50')]:_0x2f7ed0[_0x6a9d('0x4f')];if(!_0x59e0c5[_0x6a9d('0x4b')][_0x6a9d('0x53')](_0x6a9d('0x54'))){_0x20a8c6[_0x6a9d('0x1e')]=qs[_0x6a9d('0x1e')](_0x59e0c5[_0x6a9d('0x4b')]['limit']);_0x20a8c6[_0x6a9d('0x1c')]=qs[_0x6a9d('0x1c')](_0x59e0c5[_0x6a9d('0x4b')]['offset']);}_0x20a8c6[_0x6a9d('0x6b')]=qs[_0x6a9d('0x55')](_0x59e0c5[_0x6a9d('0x4b')][_0x6a9d('0x55')]);_0x20a8c6[_0x6a9d('0x56')]=qs['filters'](_[_0x6a9d('0x57')](_0x59e0c5[_0x6a9d('0x4b')],_0x2f7ed0[_0x6a9d('0x4d')]));_0x20a8c6[_0x6a9d('0x56')][_0x6a9d('0x68')]=_0x156f28['id'];if(_0x59e0c5[_0x6a9d('0x4b')][_0x6a9d('0x6c')]){_0x20a8c6[_0x6a9d('0x56')]=_[_0x6a9d('0x58')](_0x20a8c6['where'],{'$or':_[_0x6a9d('0x46')](_0x20a8c6[_0x6a9d('0x50')],function(_0xa76a10){var _0xaba52b={};_0xaba52b[_0xa76a10]={'$like':'%'+_0x59e0c5[_0x6a9d('0x4b')][_0x6a9d('0x6c')]+'%'};return _0xaba52b;})});}_0x20a8c6=_[_0x6a9d('0x58')]({},_0x20a8c6,_0x59e0c5[_0x6a9d('0x5b')]);return db[_0x6a9d('0x6a')][_0x6a9d('0x1f')]({'where':_0x20a8c6[_0x6a9d('0x56')]})[_0x6a9d('0xe')](function(_0x41a03a){_0x4f8a55[_0x6a9d('0x1f')]=_0x41a03a;if(_0x59e0c5['query'][_0x6a9d('0x5f')]){_0x20a8c6[_0x6a9d('0x5c')]=[{'all':!![]}];}return db[_0x6a9d('0x6a')]['findAll'](_0x20a8c6);})['then'](function(_0x134c64){_0x4f8a55[_0x6a9d('0x6d')]=_0x134c64;return _0x4f8a55;});}})[_0x6a9d('0xe')](respondWithFilteredResult(_0x9af8b5,_0x20a8c6))['catch'](handleError(_0x9af8b5,null));};exports[_0x6a9d('0x6e')]=function(_0x41fa05,_0x1b56b6){return db[_0x6a9d('0x47')]['find']({'where':{'id':_0x41fa05[_0x6a9d('0x64')]['id']}})['then'](handleEntityNotFound(_0x1b56b6,null))[_0x6a9d('0xe')](function(_0x5531e2){if(_0x5531e2){return _0x5531e2['removeDispositions'](_0x41fa05['query']['ids']);}})['then'](respondWithStatusCode(_0x1b56b6,null))[_0x6a9d('0x17')](handleError(_0x1b56b6,null));};exports[_0x6a9d('0x6f')]=function(_0x4a5c0a,_0x2186b7){if(_0x4a5c0a[_0x6a9d('0x62')]['id']){delete _0x4a5c0a['body']['id'];}return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x4a5c0a[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x2186b7,null))[_0x6a9d('0xe')](function(_0x29df61){if(_0x29df61){_0x4a5c0a[_0x6a9d('0x62')]['MailAccountId']=_0x29df61['id'];return db[_0x6a9d('0x70')]['create'](_0x4a5c0a[_0x6a9d('0x62')]);}})[_0x6a9d('0xe')](respondWithResult(_0x2186b7,null))[_0x6a9d('0x17')](handleError(_0x2186b7,null));};exports['getAnswers']=function(_0x5d2ac3,_0x152615){var _0x3ef6ce={'raw':![],'where':{}};var _0x49f836={};var _0x473724={'count':0x0,'rows':[]};return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x5d2ac3[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x152615,null))[_0x6a9d('0xe')](function(_0x35a9c2){if(_0x35a9c2){_0x49f836[_0x6a9d('0x4f')]=_[_0x6a9d('0x4c')](db[_0x6a9d('0x70')][_0x6a9d('0x48')]);_0x49f836['query']=_[_0x6a9d('0x4c')](_0x5d2ac3[_0x6a9d('0x4b')]);_0x49f836['filters']=_[_0x6a9d('0x4e')](_0x49f836['model'],_0x49f836[_0x6a9d('0x4b')]);_0x3ef6ce[_0x6a9d('0x50')]=_[_0x6a9d('0x4e')](_0x49f836[_0x6a9d('0x4f')],qs[_0x6a9d('0x51')](_0x5d2ac3[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x3ef6ce['attributes']=_0x3ef6ce[_0x6a9d('0x50')][_0x6a9d('0x52')]?_0x3ef6ce[_0x6a9d('0x50')]:_0x49f836[_0x6a9d('0x4f')];if(!_0x5d2ac3[_0x6a9d('0x4b')][_0x6a9d('0x53')](_0x6a9d('0x54'))){_0x3ef6ce[_0x6a9d('0x1e')]=qs[_0x6a9d('0x1e')](_0x5d2ac3[_0x6a9d('0x4b')]['limit']);_0x3ef6ce[_0x6a9d('0x1c')]=qs[_0x6a9d('0x1c')](_0x5d2ac3[_0x6a9d('0x4b')][_0x6a9d('0x1c')]);}_0x3ef6ce[_0x6a9d('0x6b')]=qs[_0x6a9d('0x55')](_0x5d2ac3[_0x6a9d('0x4b')][_0x6a9d('0x55')]);_0x3ef6ce[_0x6a9d('0x56')]=qs[_0x6a9d('0x4d')](_[_0x6a9d('0x57')](_0x5d2ac3[_0x6a9d('0x4b')],_0x49f836[_0x6a9d('0x4d')]));_0x3ef6ce[_0x6a9d('0x56')][_0x6a9d('0x68')]=_0x35a9c2['id'];if(_0x5d2ac3[_0x6a9d('0x4b')][_0x6a9d('0x6c')]){_0x3ef6ce[_0x6a9d('0x56')]=_['merge'](_0x3ef6ce[_0x6a9d('0x56')],{'$or':_['map'](_0x3ef6ce[_0x6a9d('0x50')],function(_0x30a0f7){var _0x36c569={};_0x36c569[_0x30a0f7]={'$like':'%'+_0x5d2ac3['query'][_0x6a9d('0x6c')]+'%'};return _0x36c569;})});}_0x3ef6ce=_[_0x6a9d('0x58')]({},_0x3ef6ce,_0x5d2ac3['options']);return db['CannedAnswer'][_0x6a9d('0x1f')]({'where':_0x3ef6ce['where']})[_0x6a9d('0xe')](function(_0x295e2d){_0x473724['count']=_0x295e2d;if(_0x5d2ac3[_0x6a9d('0x4b')]['includeAll']){_0x3ef6ce[_0x6a9d('0x5c')]=[{'all':!![]}];}return db[_0x6a9d('0x70')][_0x6a9d('0x71')](_0x3ef6ce);})[_0x6a9d('0xe')](function(_0x31dc16){_0x473724[_0x6a9d('0x6d')]=_0x31dc16;return _0x473724;});}})[_0x6a9d('0xe')](respondWithFilteredResult(_0x152615,_0x3ef6ce))[_0x6a9d('0x17')](handleError(_0x152615,null));};exports[_0x6a9d('0x72')]=function(_0x5bc442,_0x5a1fb7){return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x5bc442[_0x6a9d('0x64')]['id']}})['then'](handleEntityNotFound(_0x5a1fb7,null))[_0x6a9d('0xe')](function(_0x78736f){if(_0x78736f){return _0x78736f[_0x6a9d('0x72')](_0x5bc442[_0x6a9d('0x4b')][_0x6a9d('0x73')]);}})[_0x6a9d('0xe')](respondWithStatusCode(_0x5a1fb7,null))[_0x6a9d('0x17')](handleError(_0x5a1fb7,null));};exports[_0x6a9d('0x74')]=function(_0x559b8f,_0x5d828a){var _0x2a5e93={'name':_0x559b8f[_0x6a9d('0x62')]['name'],'key':_0x559b8f[_0x6a9d('0x62')][_0x6a9d('0x4a')],'provider':_0x559b8f['body'][_0x6a9d('0x60')]==='custom'?null:_0x559b8f[_0x6a9d('0x62')][_0x6a9d('0x60')],'email':_0x559b8f['body'][_0x6a9d('0x75')],'ListId':_0x559b8f[_0x6a9d('0x62')][_0x6a9d('0x76')],'active':!_[_0x6a9d('0x77')](_0x559b8f['body'][_0x6a9d('0x78')])?_0x559b8f['body'][_0x6a9d('0x78')]:!![],'description':_0x559b8f[_0x6a9d('0x62')][_0x6a9d('0x79')]||null};var _0x27b650=getAuthenticationOptions(_0x2a5e93['provider'],_0x559b8f[_0x6a9d('0x62')]);_0x2a5e93[_0x6a9d('0x40')]=_0x27b650[_0x6a9d('0x40')];_0x2a5e93[_0x6a9d('0x41')]=_0x27b650[_0x6a9d('0x41')];return db[_0x6a9d('0x47')]['create'](_0x2a5e93,{'include':[{'model':db[_0x6a9d('0x43')],'as':_0x6a9d('0x41')},{'model':db['MailServerIn'],'as':_0x6a9d('0x40')}]})[_0x6a9d('0xe')](function(_0x705c9d){var _0x29343a=_0x559b8f[_0x6a9d('0x36')][_0x6a9d('0x23')]({'plain':!![]});if(!_0x29343a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29343a['role']==='user'){var _0x4d6b75=_0x705c9d[_0x6a9d('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x6a9d('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x29343a[_0x6a9d('0x7a')]},'raw':!![]})[_0x6a9d('0xe')](function(_0xbf62eb){if(_0xbf62eb&&_0xbf62eb['autoAssociation']===0x0){return db[_0x6a9d('0x25')][_0x6a9d('0x74')]({'name':_0x4d6b75['name'],'resourceId':_0x4d6b75['id'],'type':_0xbf62eb[_0x6a9d('0x27')],'sectionId':_0xbf62eb['id']},{})[_0x6a9d('0xe')](function(){return _0x705c9d;});}else{return _0x705c9d;}})[_0x6a9d('0x17')](function(_0x5cc95a){logger['error'](_0x6a9d('0x7b'),_0x5cc95a);throw _0x5cc95a;});}return _0x705c9d;})['then'](respondWithResult(_0x5d828a,0xc9))[_0x6a9d('0x17')](handleError(_0x5d828a,null));};exports[_0x6a9d('0x7c')]=function(_0x14a79a,_0x10323e){return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x14a79a[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x10323e,null))[_0x6a9d('0xe')](function(_0x1162f9){if(_0x1162f9){return _0x1162f9[_0x6a9d('0x7c')]();}return null;})[_0x6a9d('0xe')](respondWithResult(_0x10323e,null))[_0x6a9d('0x17')](handleError(_0x10323e,null));};exports[_0x6a9d('0x7d')]=function(_0x333edb,_0x2abcaf){if(_0x333edb[_0x6a9d('0x62')]['id']){delete _0x333edb[_0x6a9d('0x62')]['id'];}return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x333edb[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x2abcaf,null))[_0x6a9d('0xe')](function(_0x474425){if(_0x474425){_0x333edb[_0x6a9d('0x62')][_0x6a9d('0x68')]=_0x474425['id'];return db['MailServerIn']['create'](_0x333edb[_0x6a9d('0x62')]);}})[_0x6a9d('0xe')](respondWithResult(_0x2abcaf,null))[_0x6a9d('0x17')](handleError(_0x2abcaf,null));};exports[_0x6a9d('0x7e')]=function(_0x5e9bde,_0xd0d97c){return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x5e9bde['params']['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0xd0d97c,null))['then'](function(_0x3e9146){if(_0x3e9146){return _0x3e9146[_0x6a9d('0x7f')](null);}return null;})[_0x6a9d('0xe')](respondWithStatusCode(_0xd0d97c,null))[_0x6a9d('0x17')](handleError(_0xd0d97c,null));};exports[_0x6a9d('0x80')]=function(_0x259da7,_0x26b334){return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x259da7[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x26b334,null))['then'](function(_0x365639){if(_0x365639){return _0x365639[_0x6a9d('0x80')]();}return null;})['then'](respondWithResult(_0x26b334,null))[_0x6a9d('0x17')](handleError(_0x26b334,null));};exports[_0x6a9d('0x81')]=function(_0x3afd37,_0x2812a0){if(_0x3afd37['body']['id']){delete _0x3afd37[_0x6a9d('0x62')]['id'];}return db[_0x6a9d('0x47')]['find']({'where':{'id':_0x3afd37[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x2812a0,null))[_0x6a9d('0xe')](function(_0x236fc9){if(_0x236fc9){_0x3afd37[_0x6a9d('0x62')]['MailAccountId']=_0x236fc9['id'];return db[_0x6a9d('0x43')][_0x6a9d('0x74')](_0x3afd37[_0x6a9d('0x62')]);}})[_0x6a9d('0xe')](respondWithResult(_0x2812a0,null))[_0x6a9d('0x17')](handleError(_0x2812a0,null));};exports[_0x6a9d('0x82')]=function(_0x5d3ca2,_0x399566){return db[_0x6a9d('0x47')]['findOne']({'where':{'id':_0x5d3ca2['params']['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x399566,null))[_0x6a9d('0xe')](function(_0x536095){if(_0x536095){return _0x536095[_0x6a9d('0x83')](null);}return null;})[_0x6a9d('0xe')](respondWithStatusCode(_0x399566,null))[_0x6a9d('0x17')](handleError(_0x399566,null));};exports[_0x6a9d('0x84')]=function(_0x422fdb,_0x42d003){return db[_0x6a9d('0x85')][_0x6a9d('0x63')]({'where':{'id':_0x422fdb['params']['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x42d003,null))['then'](function(_0x5dd1c8){if(_0x5dd1c8){return _0x5dd1c8[_0x6a9d('0x84')](_0x422fdb[_0x6a9d('0x62')][_0x6a9d('0x73')],_[_0x6a9d('0x86')](_0x422fdb[_0x6a9d('0x62')],[_0x6a9d('0x73'),'id'])||{});}})['then'](respondWithResult(_0x42d003,null))[_0x6a9d('0x17')](handleError(_0x42d003,null));};exports['getInteractions']=function(_0x4be3d3,_0x3f2102){var _0x3cc829={'raw':![],'where':{}};var _0xccf9da={};var _0x1b4d0f={'count':0x0,'rows':[]};return db[_0x6a9d('0x47')]['findOne']({'where':{'id':_0x4be3d3[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x3f2102,null))[_0x6a9d('0xe')](function(_0x10817c){if(_0x10817c){_0xccf9da[_0x6a9d('0x4f')]=_[_0x6a9d('0x4c')](db[_0x6a9d('0x85')][_0x6a9d('0x48')]);_0xccf9da[_0x6a9d('0x4b')]=_[_0x6a9d('0x4c')](_0x4be3d3[_0x6a9d('0x4b')]);_0xccf9da[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0xccf9da[_0x6a9d('0x4f')],_0xccf9da[_0x6a9d('0x4b')]);_0x3cc829[_0x6a9d('0x50')]=_['intersection'](_0xccf9da[_0x6a9d('0x4f')],qs[_0x6a9d('0x51')](_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x3cc829[_0x6a9d('0x50')]=_0x3cc829[_0x6a9d('0x50')][_0x6a9d('0x52')]?_0x3cc829[_0x6a9d('0x50')]:_0xccf9da['model'];if(!_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x53')](_0x6a9d('0x54'))){_0x3cc829[_0x6a9d('0x1e')]=qs[_0x6a9d('0x1e')](_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x1e')]);_0x3cc829['offset']=qs[_0x6a9d('0x1c')](_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x1c')]);}_0x3cc829[_0x6a9d('0x6b')]=qs['sort'](_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x55')]);_0x3cc829[_0x6a9d('0x56')]=qs[_0x6a9d('0x4d')](_['pick'](_0x4be3d3[_0x6a9d('0x4b')],_0xccf9da[_0x6a9d('0x4d')]));_0x3cc829[_0x6a9d('0x56')]['MailAccountId']=_0x10817c['id'];if(_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x6c')]){_0x3cc829[_0x6a9d('0x56')]=_[_0x6a9d('0x58')](_0x3cc829[_0x6a9d('0x56')],{'$or':_[_0x6a9d('0x46')](_0x3cc829[_0x6a9d('0x50')],function(_0x4b0925){var _0x4f9961={};_0x4f9961[_0x4b0925]={'$like':'%'+_0x4be3d3['query'][_0x6a9d('0x6c')]+'%'};return _0x4f9961;})});}_0x3cc829=_[_0x6a9d('0x58')]({},_0x3cc829,_0x4be3d3[_0x6a9d('0x5b')]);return db['MailInteraction'][_0x6a9d('0x1f')]({'where':_0x3cc829[_0x6a9d('0x56')]})[_0x6a9d('0xe')](function(_0xda9697){_0x1b4d0f[_0x6a9d('0x1f')]=_0xda9697;if(_0x4be3d3[_0x6a9d('0x4b')]['includeAll']){_0x3cc829[_0x6a9d('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6a9d('0x87')],'as':_0x6a9d('0x88'),'attributes':[_0x6a9d('0x27'),_0x6a9d('0x89'),_0x6a9d('0x8a')],'required':![]},{'model':db['Tag'],'as':_0x6a9d('0x8b'),'attributes':['id',_0x6a9d('0x27'),_0x6a9d('0x8c')],'where':_0x4be3d3[_0x6a9d('0x4b')][_0x6a9d('0x8d')]?{'id':_0x4be3d3['query'][_0x6a9d('0x8d')]}:undefined,'required':_0x4be3d3['query'][_0x6a9d('0x8d')]?!![]:![]}];}return db[_0x6a9d('0x85')][_0x6a9d('0x71')](_0x3cc829);})[_0x6a9d('0xe')](function(_0x425596){_0x1b4d0f[_0x6a9d('0x6d')]=_0x425596;return _0x1b4d0f;});}})[_0x6a9d('0xe')](respondWithFilteredResult(_0x3f2102,_0x3cc829))['catch'](handleError(_0x3f2102,null));};exports[_0x6a9d('0x8e')]=function addApplications(_0x446cb8,_0x2d9aaa){var _0x2e5198=_0x446cb8[_0x6a9d('0x64')]['id'];var _0x516f89=_0x446cb8[_0x6a9d('0x62')];var _0x1e078b=0xc8;var _0x21c1d6=null;return db[_0x6a9d('0x8f')]['transaction']({'isolationLevel':db[_0x6a9d('0x8f')][_0x6a9d('0x90')]['ISOLATION_LEVELS'][_0x6a9d('0x91')]},function(_0x49e2a6){return db[_0x6a9d('0x47')]['findOne']({'where':{'id':_0x2e5198},'transaction':_0x49e2a6})[_0x6a9d('0xe')](function(_0x238142){if(_0x238142){return db[_0x6a9d('0x92')]['destroy']({'where':{'MailAccountId':_0x2e5198},'transaction':_0x49e2a6})[_0x6a9d('0xe')](function(){var _0x3a6edd=_[_0x6a9d('0x46')](_0x516f89,function(_0x352093){_0x352093[_0x6a9d('0x68')]=_0x2e5198;return _0x352093;});return db[_0x6a9d('0x92')][_0x6a9d('0x93')](_0x3a6edd,{'transaction':_0x49e2a6});});}else{_0x1e078b=0x194;_0x21c1d6=[];}});})['then'](function(){if(_0x1e078b!==0x194){return db['MailApplication'][_0x6a9d('0x94')]({'where':{'MailAccountId':_0x2e5198},'order':_0x6a9d('0x95')})[_0x6a9d('0xe')](function(_0x32e3bb){_0x21c1d6=_0x32e3bb;});}})[_0x6a9d('0x17')](function(_0x44612e){_0x1e078b=0x1f4;logger['error'](_0x44612e[_0x6a9d('0x26')]);if(_0x44612e['name']){delete _0x44612e['name'];}_0x21c1d6=_0x44612e;})[_0x6a9d('0x96')](function(){if(_0x21c1d6===null){_0x2d9aaa['sendStatus'](_0x1e078b);}else{if(_0x1e078b===0x1f4){_0x2d9aaa[_0x6a9d('0x1a')](_0x1e078b)['send'](_0x21c1d6);}else{_0x2d9aaa['status'](_0x1e078b)[_0x6a9d('0x1b')](_0x21c1d6);}}});};exports[_0x6a9d('0x97')]=function(_0x48a923,_0x195e83){var _0x5e2529={};var _0x5dfaee={};var _0xc0efee;var _0x2a0a45;return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x48a923[_0x6a9d('0x64')]['id']}})['then'](handleEntityNotFound(_0x195e83,null))['then'](function(_0x5acbd3){if(_0x5acbd3){_0xc0efee=_0x5acbd3;_0x5dfaee[_0x6a9d('0x4f')]=_[_0x6a9d('0x4c')](db[_0x6a9d('0x92')][_0x6a9d('0x48')]);_0x5dfaee[_0x6a9d('0x4b')]=_[_0x6a9d('0x4c')](_0x48a923[_0x6a9d('0x4b')]);_0x5dfaee[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0x5dfaee[_0x6a9d('0x4f')],_0x5dfaee[_0x6a9d('0x4b')]);_0x5e2529['attributes']=_[_0x6a9d('0x4e')](_0x5dfaee['model'],qs[_0x6a9d('0x51')](_0x48a923[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x5e2529[_0x6a9d('0x50')]=_0x5e2529[_0x6a9d('0x50')][_0x6a9d('0x52')]?_0x5e2529[_0x6a9d('0x50')]:_0x5dfaee['model'];_0x5e2529[_0x6a9d('0x6b')]=qs[_0x6a9d('0x55')](_0x48a923[_0x6a9d('0x4b')]['sort']);_0x5e2529['where']=qs[_0x6a9d('0x4d')](_[_0x6a9d('0x57')](_0x48a923[_0x6a9d('0x4b')],_0x5dfaee[_0x6a9d('0x4d')]));if(_0x48a923[_0x6a9d('0x4b')][_0x6a9d('0x6c')]){_0x5e2529['where']=_[_0x6a9d('0x58')](_0x5e2529[_0x6a9d('0x56')],{'$or':_[_0x6a9d('0x46')](_0x5e2529[_0x6a9d('0x50')],function(_0xaddd31){var _0x47de9f={};_0x47de9f[_0xaddd31]={'$like':'%'+_0x48a923[_0x6a9d('0x4b')]['filter']+'%'};return _0x47de9f;})});}_0x5e2529=_[_0x6a9d('0x58')]({},_0x5e2529,_0x48a923[_0x6a9d('0x5b')]);return _0xc0efee[_0x6a9d('0x97')](_0x5e2529);}})[_0x6a9d('0xe')](function(_0xd77b56){if(_0xd77b56){_0x2a0a45=_0xd77b56[_0x6a9d('0x52')];if(!_0x48a923[_0x6a9d('0x4b')][_0x6a9d('0x53')](_0x6a9d('0x54'))){_0x5e2529[_0x6a9d('0x1e')]=qs['limit'](_0x48a923[_0x6a9d('0x4b')][_0x6a9d('0x1e')]);_0x5e2529[_0x6a9d('0x1c')]=qs[_0x6a9d('0x1c')](_0x48a923[_0x6a9d('0x4b')]['offset']);}return _0xc0efee[_0x6a9d('0x97')](_0x5e2529);}})[_0x6a9d('0xe')](function(_0x539acf){if(_0x539acf){return _0x539acf?{'count':_0x2a0a45,'rows':_0x539acf}:null;}})[_0x6a9d('0xe')](respondWithResult(_0x195e83,null))[_0x6a9d('0x17')](handleError(_0x195e83,null));};exports[_0x6a9d('0x98')]=function(_0x1a8f50,_0x4219d5){var _0x3b379a={'raw':!![],'where':{}};var _0xd1432d={};var _0x1713f7={'count':0x0,'rows':[]};return db[_0x6a9d('0x47')][_0x6a9d('0x69')]({'where':{'id':_0x1a8f50[_0x6a9d('0x64')]['id']}})['then'](handleEntityNotFound(_0x4219d5,null))[_0x6a9d('0xe')](function(_0xa7c92f){if(_0xa7c92f){_0xd1432d['model']=_['keys'](db[_0x6a9d('0x99')][_0x6a9d('0x48')]);_0xd1432d['query']=_['keys'](_0x1a8f50[_0x6a9d('0x4b')]);_0xd1432d[_0x6a9d('0x4d')]=_[_0x6a9d('0x4e')](_0xd1432d[_0x6a9d('0x4f')],_0xd1432d['query']);_0x3b379a['attributes']=_['intersection'](_0xd1432d[_0x6a9d('0x4f')],qs['fields'](_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x3b379a[_0x6a9d('0x50')]=_0x3b379a[_0x6a9d('0x50')][_0x6a9d('0x52')]?_0x3b379a[_0x6a9d('0x50')]:_0xd1432d[_0x6a9d('0x4f')];if(!_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x53')]('nolimit')){_0x3b379a['limit']=qs['limit'](_0x1a8f50['query'][_0x6a9d('0x1e')]);_0x3b379a['offset']=qs[_0x6a9d('0x1c')](_0x1a8f50['query'][_0x6a9d('0x1c')]);}_0x3b379a['order']=qs[_0x6a9d('0x55')](_0x1a8f50[_0x6a9d('0x4b')]['sort']);_0x3b379a[_0x6a9d('0x56')]=qs[_0x6a9d('0x4d')](_[_0x6a9d('0x57')](_0x1a8f50[_0x6a9d('0x4b')],_0xd1432d[_0x6a9d('0x4d')]));_0x3b379a[_0x6a9d('0x56')][_0x6a9d('0x68')]=_0xa7c92f['id'];if(_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x6c')]){_0x3b379a[_0x6a9d('0x56')]=_[_0x6a9d('0x58')](_0x3b379a['where'],{'$or':_[_0x6a9d('0x46')](_0x3b379a[_0x6a9d('0x50')],function(_0x1684a1){var _0x3d50a7={};_0x3d50a7[_0x1684a1]={'$like':'%'+_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x6c')]+'%'};return _0x3d50a7;})});}if(_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x9a')]){var _0x283dfe=_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x9a')][_0x6a9d('0x9b')](',');var _0x208e85={};_0x208e85[_0x283dfe[0x0]]={'$gte':moment(_0x283dfe[0x1])[_0x6a9d('0x9c')](_0x6a9d('0x9d'))};_0x3b379a[_0x6a9d('0x56')]=_[_0x6a9d('0x58')](_0x3b379a['where'],_0x208e85);}_0x3b379a=_[_0x6a9d('0x58')]({},_0x3b379a,_0x1a8f50[_0x6a9d('0x5b')]);return db[_0x6a9d('0x99')][_0x6a9d('0x1f')]({'where':_0x3b379a['where']})['then'](function(_0x2901f6){_0x1713f7[_0x6a9d('0x1f')]=_0x2901f6;if(_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x5f')]){_0x3b379a[_0x6a9d('0x5c')]=[{'all':!![]}];}return db[_0x6a9d('0x99')][_0x6a9d('0x71')](_0x3b379a);})[_0x6a9d('0xe')](function(_0x3fb0a2){if(_0x1a8f50[_0x6a9d('0x4b')][_0x6a9d('0x9e')]==='true'){for(var _0x5c6097=0x0;_0x5c6097<_0x3fb0a2[_0x6a9d('0x52')];_0x5c6097++){_0x3fb0a2[_0x5c6097]['body']=juice(_0x3fb0a2[_0x5c6097][_0x6a9d('0x62')]);}}_0x1713f7[_0x6a9d('0x6d')]=_0x3fb0a2;return _0x1713f7;});}})[_0x6a9d('0xe')](respondWithFilteredResult(_0x4219d5,_0x3b379a))[_0x6a9d('0x17')](handleError(_0x4219d5,null));};exports[_0x6a9d('0x28')]=function(_0x57d829,_0x163b86){var _0x3fa8f4,_0x561dae={},_0x44c15f;if(_0x57d829['body']['to']){_0x44c15f=_0x57d829[_0x6a9d('0x62')]['to'][_0x6a9d('0x9b')](',')[0x0];}return db['MailAccount'][_0x6a9d('0x63')]({'where':{'id':_0x57d829[_0x6a9d('0x64')]['id']},'include':[{'model':db[_0x6a9d('0x9f')],'as':_0x6a9d('0xa0'),'include':[{'model':db[_0x6a9d('0xa1')],'as':'Contacts','where':{'email':_0x44c15f},'limit':0x1,'order':[[_0x6a9d('0xa2'),_0x6a9d('0xa3')]]}]},{'model':db[_0x6a9d('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6a9d('0xa4')],'as':_0x6a9d('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x163b86,null))[_0x6a9d('0xe')](function(_0x110861){if(!_0x110861)return;_0x3fa8f4=_0x110861;if(!_0x110861[_0x6a9d('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xa5')])){_0x57d829['body'][_0x6a9d('0xa5')]=util[_0x6a9d('0x9c')](_0x6a9d('0xa6'),_0x110861[_0x6a9d('0x27')],_0x110861['email']||_0x110861[_0x6a9d('0x41')][_0x6a9d('0x36')]);}if(_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xa7')]&&_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xa7')]['length']){for(var _0x44c846=0x0;_0x44c846<_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xa7')][_0x6a9d('0x52')];_0x44c846+=0x1){_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xa7')][_0x44c846]={'filename':_0x57d829['body'][_0x6a9d('0xa7')][_0x44c846][_0x6a9d('0x27')],'path':path[_0x6a9d('0xa8')](config['root'],'server/files/attachments',_0x57d829['body'][_0x6a9d('0xa7')][_0x44c846][_0x6a9d('0xa9')])};}}var _0x85c02b=_0x110861[_0x6a9d('0xaa')]();return respondWithRpcPromise(_0x6a9d('0xab'),_0x6a9d('0xac'),{'account':_0x85c02b,'message':_0x57d829[_0x6a9d('0x62')]});})['then'](function(_0x1aba60){if(!_0x1aba60)return;_0x561dae=_0x1aba60;if(!_0x3fa8f4['List'])throw new Error(_0x6a9d('0xad'));if(_0x3fa8f4[_0x6a9d('0xa0')]['Contacts'][_0x6a9d('0x52')])return _0x3fa8f4[_0x6a9d('0xa0')][_0x6a9d('0xae')][0x0];return db[_0x6a9d('0xa1')]['create'](_['defaults'](_0x57d829[_0x6a9d('0x62')],{'firstName':_0x57d829[_0x6a9d('0x62')]['to'],'email':_0x57d829[_0x6a9d('0x62')]['to'],'phone':_0x57d829[_0x6a9d('0x62')]['to'],'ListId':_0x3fa8f4[_0x6a9d('0x76')]}));})[_0x6a9d('0xe')](function(_0x3c4acc){if(!_0x3c4acc)return;var _0x1a55d7={'UserId':_0x57d829[_0x6a9d('0x36')]['id'],'ContactId':_0x3c4acc['id'],'MailAccountId':_0x3fa8f4['id'],'inReplyTo':_0x561dae[_0x6a9d('0xaf')],'to':_0x57d829[_0x6a9d('0x62')]['from'],'cc':_0x57d829[_0x6a9d('0x62')]['cc'],'subject':_0x57d829['body'][_0x6a9d('0xb0')],'attach':_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xb1')],'firstMsgDirection':_0x6a9d('0xb2'),'lastMsgAt':moment()[_0x6a9d('0x9c')](_0x6a9d('0x9d')),'lastMsgDirection':_0x6a9d('0xb2'),'Messages':[_[_0x6a9d('0x58')](_0x57d829['body'],{'messageId':_0x561dae[_0x6a9d('0xaf')],'sentAt':moment()[_0x6a9d('0x9c')](_0x6a9d('0x9d')),'read':!![],'MailAccountId':_0x3fa8f4['id'],'UserId':_0x57d829[_0x6a9d('0x36')]['id'],'ContactId':_0x3c4acc['id']})]};if(_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xb3')]){_0x1a55d7=_[_0x6a9d('0x58')](_0x1a55d7,_0x57d829[_0x6a9d('0x62')][_0x6a9d('0xb3')]);}return db['MailInteraction'][_0x6a9d('0x74')](_0x1a55d7,{'include':[{'model':db[_0x6a9d('0x99')],'as':_0x6a9d('0xb4')}]});})[_0x6a9d('0xe')](respondWithResult(_0x163b86,null))[_0x6a9d('0x17')](handleError(_0x163b86,null));};exports[_0x6a9d('0xb5')]=function(_0x1524a1,_0x440cc9){return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x1524a1[_0x6a9d('0x64')]['id']},'include':[{'model':db[_0x6a9d('0x43')],'as':_0x6a9d('0x41'),'raw':!![],'include':[{'model':db[_0x6a9d('0xa4')],'as':_0x6a9d('0xa4'),'raw':!![]}]}]})[_0x6a9d('0xe')](handleEntityNotFound(_0x440cc9,null))['then'](function(_0x238aa2){if(!_0x238aa2['Smtp'])return;var _0xd20b5c=_0x238aa2['getSmtpOptions']();return respondWithRpcPromise(_0x6a9d('0xb6'),'verifySmtp',{'account':_0xd20b5c});})[_0x6a9d('0xe')](respondWithResult(_0x440cc9,null))['catch'](handleError(_0x440cc9,null));};exports[_0x6a9d('0x22')]=function(_0x1d37c8,_0x444c4f){return db['MailAccount']['find']({'where':{'id':_0x1d37c8[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x444c4f,null))['then'](function(_0x2e18d2){if(_0x2e18d2&&_0x2e18d2[_0x6a9d('0x3f')]){throw new db['Sequelize']['ValidationError'](_0x6a9d('0xb7'));}return _0x2e18d2;})[_0x6a9d('0xe')](removeEntity(_0x444c4f,null))['catch'](handleError(_0x444c4f,null));};exports[_0x6a9d('0xb8')]=function(_0x315330,_0x32add9){return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x315330[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x32add9,null))['then'](function(_0x5910f4){if(_0x5910f4){return _0x5910f4[_0x6a9d('0xb8')](_0x315330[_0x6a9d('0x62')][_0x6a9d('0x73')],_[_0x6a9d('0x86')](_0x315330['body'],['ids','id'])||{})[_0x6a9d('0xb9')](function(_0xc36dec){for(var _0x45c6d2=0x0;_0x45c6d2<_0x315330[_0x6a9d('0x62')]['ids'][_0x6a9d('0x52')];_0x45c6d2+=0x1){socket[_0x6a9d('0xba')]('userMailAccount:save',{'UserId':Number(_0x315330[_0x6a9d('0x62')]['ids'][_0x45c6d2]),'MailAccountId':Number(_0x315330[_0x6a9d('0x64')]['id'])});}return _0xc36dec;});}})[_0x6a9d('0xe')](respondWithResult(_0x32add9,null))[_0x6a9d('0x17')](handleError(_0x32add9,null));};exports['removeAgents']=function(_0x285a23,_0x232b5a){return db[_0x6a9d('0x47')][_0x6a9d('0x63')]({'where':{'id':_0x285a23['params']['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x232b5a,null))[_0x6a9d('0xe')](function(_0x94078c){if(_0x94078c){return _0x94078c[_0x6a9d('0xbb')](_0x285a23[_0x6a9d('0x4b')][_0x6a9d('0x73')])[_0x6a9d('0xe')](function(){if(_['isArray'](_0x285a23[_0x6a9d('0x4b')][_0x6a9d('0x73')])){for(var _0x2422a5=0x0;_0x2422a5<_0x285a23['query'][_0x6a9d('0x73')][_0x6a9d('0x52')];_0x2422a5+=0x1){socket[_0x6a9d('0xba')](_0x6a9d('0xbc'),{'UserId':Number(_0x285a23['query'][_0x6a9d('0x73')][_0x2422a5]),'MailAccountId':Number(_0x285a23['params']['id'])});}}else{socket[_0x6a9d('0xba')]('userMailAccount:remove',{'UserId':Number(_0x285a23[_0x6a9d('0x4b')]['ids']),'MailAccountId':Number(_0x285a23[_0x6a9d('0x64')]['id'])});}});}})[_0x6a9d('0xe')](respondWithStatusCode(_0x232b5a,null))[_0x6a9d('0x17')](handleError(_0x232b5a,null));};exports['getAgents']=function(_0x58f84d,_0x5c5a62){var _0x353d70={};var _0x521093={};var _0x340ca8;var _0x5c6d2c;return db[_0x6a9d('0x47')]['findOne']({'where':{'id':_0x58f84d[_0x6a9d('0x64')]['id']}})[_0x6a9d('0xe')](handleEntityNotFound(_0x5c5a62,null))[_0x6a9d('0xe')](function(_0x10caf5){if(_0x10caf5){_0x340ca8=_0x10caf5;_0x521093['model']=_[_0x6a9d('0x4c')](db[_0x6a9d('0x87')][_0x6a9d('0x48')]);_0x521093[_0x6a9d('0x4b')]=_[_0x6a9d('0x4c')](_0x58f84d[_0x6a9d('0x4b')]);_0x521093['filters']=_[_0x6a9d('0x4e')](_0x521093[_0x6a9d('0x4f')],_0x521093['query']);_0x353d70['attributes']=_[_0x6a9d('0x4e')](_0x521093['model'],qs['fields'](_0x58f84d[_0x6a9d('0x4b')][_0x6a9d('0x51')]));_0x353d70[_0x6a9d('0x50')]=_0x353d70[_0x6a9d('0x50')]['length']?_0x353d70[_0x6a9d('0x50')]:_0x521093['model'];_0x353d70['order']=qs[_0x6a9d('0x55')](_0x58f84d[_0x6a9d('0x4b')][_0x6a9d('0x55')]);_0x353d70[_0x6a9d('0x56')]=qs[_0x6a9d('0x4d')](_['pick'](_0x58f84d[_0x6a9d('0x4b')],_0x521093[_0x6a9d('0x4d')]));if(_0x58f84d['query'][_0x6a9d('0x6c')]){_0x353d70['where']=_[_0x6a9d('0x58')](_0x353d70['where'],{'$or':_[_0x6a9d('0x46')](_0x353d70['attributes'],function(_0x54d18f){var _0x5a3454={};_0x5a3454[_0x54d18f]={'$like':'%'+_0x58f84d[_0x6a9d('0x4b')][_0x6a9d('0x6c')]+'%'};return _0x5a3454;})});}_0x353d70=_['merge']({},_0x353d70,_0x58f84d[_0x6a9d('0x5b')]);return _0x340ca8['getAgents'](_0x353d70);}})[_0x6a9d('0xe')](function(_0x497ea2){if(_0x497ea2){_0x5c6d2c=_0x497ea2[_0x6a9d('0x52')];if(!_0x58f84d[_0x6a9d('0x4b')]['hasOwnProperty'](_0x6a9d('0x54'))){_0x353d70['limit']=qs[_0x6a9d('0x1e')](_0x58f84d['query']['limit']);_0x353d70[_0x6a9d('0x1c')]=qs[_0x6a9d('0x1c')](_0x58f84d['query']['offset']);}return _0x340ca8['getAgents'](_0x353d70);}})[_0x6a9d('0xe')](function(_0x38bc5d){if(_0x38bc5d){return _0x38bc5d?{'count':_0x5c6d2c,'rows':_0x38bc5d}:null;}})[_0x6a9d('0xe')](respondWithResult(_0x5c5a62,null))[_0x6a9d('0x17')](handleError(_0x5c5a62,null));}; \ No newline at end of file +var _0xf6e4=['updatedAt','DESC','from','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','attach','out','Messages','verifySmtp','CloudProvider','VerifySmtp','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','MailServerIn','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','mandatoryDispositionPause','include','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List'];(function(_0x162d92,_0x18e959){var _0x15385f=function(_0x4f080f){while(--_0x4f080f){_0x162d92['push'](_0x162d92['shift']());}};_0x15385f(++_0x18e959);}(_0xf6e4,0x1a1));var _0x4f6e=function(_0x252040,_0x393b34){_0x252040=_0x252040-0x0;var _0x34ac05=_0xf6e4[_0x252040];return _0x34ac05;};'use strict';var moment=require(_0x4f6e('0x0'));var BPromise=require(_0x4f6e('0x1'));var util=require(_0x4f6e('0x2'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require(_0x4f6e('0x3'));var qs=require(_0x4f6e('0x4'));var logger=require(_0x4f6e('0x5'))(_0x4f6e('0x6'));var config=require(_0x4f6e('0x7'));var db=require(_0x4f6e('0x8'))['db'];config[_0x4f6e('0x9')]=_[_0x4f6e('0xa')](config[_0x4f6e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f6e('0xb'))(new Redis(config['redis']));require(_0x4f6e('0xc'))['register'](socket);var jayson=require(_0x4f6e('0xd'));var client=jayson[_0x4f6e('0xe')][_0x4f6e('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x5bc801,_0xdf4759,_0x3df038,_0x4bdb8b){return new BPromise(function(_0x268c9a,_0x3cdc6f){var _0x476ed0=_0x4bdb8b||client;return _0x476ed0[_0x4f6e('0x10')](_0x5bc801,_0x3df038)['then'](function(_0x228f7c){logger['info'](_0x4f6e('0x11'),_0xdf4759,_0x4f6e('0x12'));logger[_0x4f6e('0x13')](_0x4f6e('0x14'),_0xdf4759,_0x4f6e('0x12'),JSON[_0x4f6e('0x15')](_0x228f7c));if(_0x228f7c['error']){if(_0x228f7c[_0x4f6e('0x16')][_0x4f6e('0x17')]===0x1f4){logger['error'](_0x4f6e('0x11'),_0xdf4759,_0x228f7c['error'][_0x4f6e('0x18')]);return _0x3cdc6f(_0x228f7c['error'][_0x4f6e('0x18')]);}logger[_0x4f6e('0x16')](_0x4f6e('0x11'),_0xdf4759,_0x228f7c[_0x4f6e('0x16')][_0x4f6e('0x18')]);return _0x268c9a(_0x228f7c[_0x4f6e('0x16')]['message']);}else{logger[_0x4f6e('0x19')]('MailAccount,\x20%s,\x20%s',_0xdf4759,_0x4f6e('0x12'));_0x268c9a(_0x228f7c[_0x4f6e('0x1a')][_0x4f6e('0x18')]);}})['catch'](function(_0x3a37ae){logger[_0x4f6e('0x16')](_0x4f6e('0x11'),_0xdf4759,_0x3a37ae);_0x3cdc6f(_0x3a37ae);});});}function respondWithStatusCode(_0x35571c,_0xbf6ad1){_0xbf6ad1=_0xbf6ad1||0xcc;return function(_0x4ff58a){if(_0x4ff58a){return _0x35571c[_0x4f6e('0x1b')](_0xbf6ad1);}return _0x35571c[_0x4f6e('0x1c')](_0xbf6ad1)[_0x4f6e('0x1d')]();};}function respondWithResult(_0x278a73,_0x3caae9){_0x3caae9=_0x3caae9||0xc8;return function(_0x367bf2){if(_0x367bf2){return _0x278a73[_0x4f6e('0x1c')](_0x3caae9)[_0x4f6e('0x1e')](_0x367bf2);}};}function respondWithFilteredResult(_0x5b0cb5,_0x424f22){return function(_0x3b9db7){if(_0x3b9db7){var _0x59bf36=typeof _0x424f22[_0x4f6e('0x1f')]===_0x4f6e('0x20')&&typeof _0x424f22[_0x4f6e('0x21')]===_0x4f6e('0x20');var _0x364687=_0x3b9db7[_0x4f6e('0x22')];var _0x3323f9=_0x59bf36?0x0:_0x424f22['offset'];var _0x161eff=_0x59bf36?_0x3b9db7[_0x4f6e('0x22')]:_0x424f22['offset']+_0x424f22['limit'];var _0x1a4476;if(_0x161eff>=_0x364687){_0x161eff=_0x364687;_0x1a4476=0xc8;}else{_0x1a4476=0xce;}_0x5b0cb5[_0x4f6e('0x1c')](_0x1a4476);return _0x5b0cb5[_0x4f6e('0x23')](_0x4f6e('0x24'),_0x3323f9+'-'+_0x161eff+'/'+_0x364687)['json'](_0x3b9db7);}return null;};}function saveUpdates(_0x29e1e6){return function(_0x1663f1){if(_0x1663f1){return _0x1663f1[_0x4f6e('0x25')](_0x29e1e6)[_0x4f6e('0x26')](function(_0x2696e2){return _0x2696e2;});}return null;};}function removeEntity(_0x2e7086){return function(_0x2dfe16){if(_0x2dfe16){return _0x2dfe16['destroy']()[_0x4f6e('0x26')](function(){var _0x4619d1=_0x2dfe16[_0x4f6e('0x27')]({'plain':!![]});var _0x266c3c='MailAccounts';return db[_0x4f6e('0x28')][_0x4f6e('0x29')]({'where':{'type':_0x266c3c,'resourceId':_0x4619d1['id']}})[_0x4f6e('0x26')](function(){return _0x2dfe16;});})[_0x4f6e('0x26')](function(){_0x2e7086[_0x4f6e('0x1c')](0xcc)[_0x4f6e('0x1d')]();});}};}function handleEntityNotFound(_0x5a2d24){return function(_0x1341c3){if(!_0x1341c3){_0x5a2d24['sendStatus'](0x194);}return _0x1341c3;};}function handleError(_0xfbcf6b,_0x118558){_0x118558=_0x118558||0x1f4;return function(_0x1e0c72){logger['error'](_0x1e0c72[_0x4f6e('0x2a')]);if(_0x1e0c72[_0x4f6e('0x2b')]){delete _0x1e0c72[_0x4f6e('0x2b')];}_0xfbcf6b[_0x4f6e('0x1c')](_0x118558)[_0x4f6e('0x2c')](_0x1e0c72);};}function getImapHost(_0x2f824c){switch(_0x2f824c){case _0x4f6e('0x2d'):return _0x4f6e('0x2e');case _0x4f6e('0x2f'):return _0x4f6e('0x30');case'hotmail':return'imap-mail.outlook.com';case _0x4f6e('0x31'):return'outlook.office365.com';}throw new Error(_0x4f6e('0x32'),_0x2f824c);}function getSmtpHost(_0x1ba3fe){switch(_0x1ba3fe){case _0x4f6e('0x2d'):return _0x4f6e('0x33');case _0x4f6e('0x2f'):return _0x4f6e('0x34');case _0x4f6e('0x35'):return _0x4f6e('0x36');case _0x4f6e('0x31'):return _0x4f6e('0x37');}throw new Error(_0x4f6e('0x32'),_0x1ba3fe);}function getAuthenticationOptions(_0x4fe5b2,_0x1aa9eb){var _0x5cf4fb={};var _0x5c23a7={};if(_0x4fe5b2){_0x5cf4fb[_0x4f6e('0x38')]=_0x5c23a7[_0x4f6e('0x38')]=_0x1aa9eb[_0x4f6e('0x39')];_0x5cf4fb[_0x4f6e('0x3a')]=_0x5c23a7[_0x4f6e('0x3b')]=_0x1aa9eb[_0x4f6e('0x3a')];if(_0x1aa9eb['modernAuthentication']){_0x5cf4fb[_0x4f6e('0x3c')]=_0x5c23a7[_0x4f6e('0x3c')]=!![];_0x5cf4fb[_0x4f6e('0x3d')]=_0x5c23a7[_0x4f6e('0x3d')]=_0x1aa9eb[_0x4f6e('0x3d')];_0x5cf4fb[_0x4f6e('0x3a')]=_0x5c23a7[_0x4f6e('0x3b')]=null;}else{_0x5cf4fb[_0x4f6e('0x3d')]=_0x5c23a7['CloudProviderId']=null;}_0x5cf4fb[_0x4f6e('0x3e')]=getImapHost(_0x4fe5b2);_0x5cf4fb[_0x4f6e('0x3f')]=0x3e1;_0x5c23a7[_0x4f6e('0x3e')]=getSmtpHost(_0x4fe5b2);_0x5c23a7[_0x4f6e('0x3f')]=0x24b;_0x5c23a7['secure']=![];_0x5cf4fb[_0x4f6e('0x40')]=_0x5c23a7[_0x4f6e('0x40')]=null;}else{if(_0x1aa9eb['authentication']){_0x5cf4fb[_0x4f6e('0x38')]=_0x5c23a7[_0x4f6e('0x38')]=_0x1aa9eb[_0x4f6e('0x39')];_0x5cf4fb[_0x4f6e('0x3a')]=_0x5c23a7[_0x4f6e('0x3b')]=_0x1aa9eb[_0x4f6e('0x3a')];}else{_0x5cf4fb[_0x4f6e('0x41')]=_0x5c23a7[_0x4f6e('0x41')]=![];_0x5cf4fb[_0x4f6e('0x38')]=_0x5c23a7[_0x4f6e('0x38')]=null;_0x5cf4fb[_0x4f6e('0x3a')]=_0x5c23a7[_0x4f6e('0x3b')]=null;}_0x5cf4fb['host']=_0x1aa9eb[_0x4f6e('0x42')]['host'];_0x5cf4fb[_0x4f6e('0x3f')]=_0x1aa9eb[_0x4f6e('0x42')][_0x4f6e('0x3f')];_0x5c23a7['host']=_0x1aa9eb['Smtp'][_0x4f6e('0x3e')];_0x5c23a7['port']=_0x1aa9eb['Smtp'][_0x4f6e('0x3f')];}return{'Imap':_0x5cf4fb,'Smtp':_0x5c23a7};}exports['index']=function(_0x1f2d7b,_0x34d1ad){var _0x449b10={'include':[{'model':db[_0x4f6e('0x43')],'as':_0x4f6e('0x42')},{'model':db[_0x4f6e('0x44')],'as':_0x4f6e('0x45')},{'model':db[_0x4f6e('0x46')],'as':'mandatoryDispositionPause'}]},_0x3d8bfa={},_0x12246b={'count':0x0,'rows':[]};var _0x469e39=_[_0x4f6e('0x47')](db[_0x4f6e('0x48')][_0x4f6e('0x49')],function(_0xfcddfe){return{'name':_0xfcddfe[_0x4f6e('0x4a')],'type':_0xfcddfe['type'][_0x4f6e('0x4b')]};});_0x3d8bfa[_0x4f6e('0x4c')]=_[_0x4f6e('0x47')](_0x469e39,_0x4f6e('0x2b'));_0x3d8bfa[_0x4f6e('0x4d')]=_[_0x4f6e('0x4e')](_0x1f2d7b[_0x4f6e('0x4d')]);_0x3d8bfa[_0x4f6e('0x4f')]=_[_0x4f6e('0x50')](_0x3d8bfa[_0x4f6e('0x4c')],_0x3d8bfa['query']);_0x449b10[_0x4f6e('0x51')]=_['intersection'](_0x3d8bfa[_0x4f6e('0x4c')],qs[_0x4f6e('0x52')](_0x1f2d7b[_0x4f6e('0x4d')]['fields']));_0x449b10['attributes']=_0x449b10['attributes'][_0x4f6e('0x53')]?_0x449b10['attributes']:_0x3d8bfa[_0x4f6e('0x4c')];if(!_0x1f2d7b['query'][_0x4f6e('0x54')](_0x4f6e('0x55'))){_0x449b10[_0x4f6e('0x21')]=qs[_0x4f6e('0x21')](_0x1f2d7b[_0x4f6e('0x4d')][_0x4f6e('0x21')]);_0x449b10[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x1f2d7b[_0x4f6e('0x4d')][_0x4f6e('0x1f')]);}_0x449b10[_0x4f6e('0x56')]=qs[_0x4f6e('0x57')](_0x1f2d7b[_0x4f6e('0x4d')]['sort']);_0x449b10[_0x4f6e('0x58')]=qs[_0x4f6e('0x4f')](_['pick'](_0x1f2d7b[_0x4f6e('0x4d')],_0x3d8bfa[_0x4f6e('0x4f')]),_0x469e39);if(_0x1f2d7b[_0x4f6e('0x4d')][_0x4f6e('0x59')]){_0x449b10[_0x4f6e('0x58')]=_[_0x4f6e('0x5a')](_0x449b10['where'],{'$or':_[_0x4f6e('0x47')](_0x469e39,function(_0x33c85d){if(_0x33c85d[_0x4f6e('0x5b')]!==_0x4f6e('0x5c')){var _0x1afda6={};_0x1afda6[_0x33c85d['name']]={'$like':'%'+_0x1f2d7b[_0x4f6e('0x4d')][_0x4f6e('0x59')]+'%'};return _0x1afda6;}})});}_0x449b10=_[_0x4f6e('0x5a')]({},_0x449b10,_0x1f2d7b[_0x4f6e('0x5d')]);var _0x2c7097={'where':_0x449b10[_0x4f6e('0x58')]};return db[_0x4f6e('0x48')][_0x4f6e('0x22')](_0x2c7097)[_0x4f6e('0x26')](function(_0x51b3e1){_0x12246b[_0x4f6e('0x22')]=_0x51b3e1;if(_0x1f2d7b[_0x4f6e('0x4d')][_0x4f6e('0x5e')]){_0x449b10['include']=[{'all':!![]}];}return db[_0x4f6e('0x48')][_0x4f6e('0x5f')](_0x449b10);})[_0x4f6e('0x26')](function(_0x4ceebb){_0x12246b[_0x4f6e('0x60')]=_0x4ceebb;return _0x12246b;})[_0x4f6e('0x26')](respondWithFilteredResult(_0x34d1ad,_0x449b10))[_0x4f6e('0x61')](handleError(_0x34d1ad,null));};exports[_0x4f6e('0x62')]=function(_0x2046a9,_0x3a14a5){var _0x49af78={'raw':![],'where':{'id':_0x2046a9[_0x4f6e('0x63')]['id']},'include':[{'model':db[_0x4f6e('0x43')],'as':_0x4f6e('0x42')},{'model':db[_0x4f6e('0x44')],'as':_0x4f6e('0x45')},{'model':db[_0x4f6e('0x46')],'as':_0x4f6e('0x64')}]},_0x1dca46={};_0x1dca46[_0x4f6e('0x4c')]=_['keys'](db[_0x4f6e('0x48')]['rawAttributes']);_0x1dca46[_0x4f6e('0x4d')]=_['keys'](_0x2046a9[_0x4f6e('0x4d')]);_0x1dca46[_0x4f6e('0x4f')]=_['intersection'](_0x1dca46['model'],_0x1dca46[_0x4f6e('0x4d')]);_0x49af78['attributes']=_[_0x4f6e('0x50')](_0x1dca46[_0x4f6e('0x4c')],qs[_0x4f6e('0x52')](_0x2046a9[_0x4f6e('0x4d')][_0x4f6e('0x52')]));_0x49af78[_0x4f6e('0x51')]=_0x49af78[_0x4f6e('0x51')]['length']?_0x49af78['attributes']:_0x1dca46[_0x4f6e('0x4c')];if(_0x2046a9[_0x4f6e('0x4d')][_0x4f6e('0x5e')]){_0x49af78[_0x4f6e('0x65')]=[{'all':!![]}];}_0x49af78=_[_0x4f6e('0x5a')]({},_0x49af78,_0x2046a9[_0x4f6e('0x5d')]);return db[_0x4f6e('0x48')][_0x4f6e('0x66')](_0x49af78)[_0x4f6e('0x26')](handleEntityNotFound(_0x3a14a5,null))[_0x4f6e('0x26')](respondWithResult(_0x3a14a5,null))[_0x4f6e('0x61')](handleError(_0x3a14a5,null));};exports[_0x4f6e('0x25')]=function(_0x2a880c,_0x54a575){if(_0x2a880c['body']['id']){delete _0x2a880c[_0x4f6e('0x67')]['id'];}var _0x28e5cd=_0x2a880c['body'][_0x4f6e('0x68')]===_0x4f6e('0x69')?null:_0x2a880c[_0x4f6e('0x67')]['provider'];var _0x4016e0=_0x2a880c[_0x4f6e('0x67')][_0x4f6e('0x42')]||{};var _0x511c19=_0x2a880c[_0x4f6e('0x67')][_0x4f6e('0x45')]||{};if(_0x28e5cd){_0x4016e0[_0x4f6e('0x3e')]=getImapHost(_0x28e5cd);_0x4016e0['port']=0x3e1;_0x511c19[_0x4f6e('0x3e')]=getSmtpHost(_0x28e5cd);_0x511c19[_0x4f6e('0x3f')]=0x24b;_0x511c19[_0x4f6e('0x6a')]=![];}if(_0x511c19[_0x4f6e('0x3c')]){_0x511c19[_0x4f6e('0x6a')]=![];}else{_0x511c19[_0x4f6e('0x3d')]=null;}if(!_0x4016e0['modernAuthentication'])_0x4016e0[_0x4f6e('0x3d')]=null;_0x2a880c[_0x4f6e('0x67')]['Imap']=_0x4016e0;_0x2a880c['body'][_0x4f6e('0x45')]=_0x511c19;return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x2a880c[_0x4f6e('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x4f6e('0x42')},{'model':db[_0x4f6e('0x44')],'as':'Smtp'},{'model':db[_0x4f6e('0x46')],'as':'mandatoryDispositionPause'}]})[_0x4f6e('0x26')](handleEntityNotFound(_0x54a575,null))[_0x4f6e('0x26')](function(_0x45ed31){if(!_0x45ed31)throw new Error(_0x4f6e('0x6b'));if(_0x45ed31[_0x4f6e('0x40')])delete _0x2a880c[_0x4f6e('0x67')]['Imap'];return _0x45ed31;})['then'](saveUpdates(_0x2a880c[_0x4f6e('0x67')],null))[_0x4f6e('0x26')](function(_0xbe50ef){if(!_0x2a880c[_0x4f6e('0x67')][_0x4f6e('0x42')])return _0xbe50ef;return db['MailServerIn'][_0x4f6e('0x25')](_0x2a880c[_0x4f6e('0x67')][_0x4f6e('0x42')],{'where':{'MailAccountId':_0xbe50ef['id']}})[_0x4f6e('0x26')](function(){return _0xbe50ef;});})['then'](function(_0x2364f9){if(!_0x2a880c['body'][_0x4f6e('0x45')])return _0x2364f9;return db[_0x4f6e('0x44')][_0x4f6e('0x25')](_0x2a880c['body']['Smtp'],{'where':{'MailAccountId':_0x2364f9['id']}})[_0x4f6e('0x26')](function(){return _0x2364f9;});})[_0x4f6e('0x26')](respondWithResult(_0x54a575,null))[_0x4f6e('0x61')](handleError(_0x54a575,null));};exports[_0x4f6e('0x6c')]=function(_0x4682d7,_0x328cfc){return db[_0x4f6e('0x48')][_0x4f6e('0x6c')]()[_0x4f6e('0x26')](respondWithResult(_0x328cfc,null))['catch'](handleError(_0x328cfc,null));};exports[_0x4f6e('0x6d')]=function(_0x1f73a8,_0x5846ce){if(_0x1f73a8['body']['id']){delete _0x1f73a8['body']['id'];}return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x1f73a8[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x5846ce,null))[_0x4f6e('0x26')](function(_0x142c25){if(_0x142c25){_0x1f73a8[_0x4f6e('0x67')][_0x4f6e('0x6e')]=_0x142c25['id'];return db[_0x4f6e('0x6f')][_0x4f6e('0x70')](_0x1f73a8[_0x4f6e('0x67')]);}})['then'](respondWithResult(_0x5846ce,null))[_0x4f6e('0x61')](handleError(_0x5846ce,null));};exports[_0x4f6e('0x71')]=function(_0x577b14,_0x84c0e4){var _0xc6b63={'raw':![],'where':{}};var _0x32e876={};var _0xfca00c={'count':0x0,'rows':[]};return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x577b14['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x84c0e4,null))['then'](function(_0x8ec94a){if(_0x8ec94a){_0x32e876[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0x6f')]['rawAttributes']);_0x32e876[_0x4f6e('0x4d')]=_[_0x4f6e('0x4e')](_0x577b14['query']);_0x32e876['filters']=_[_0x4f6e('0x50')](_0x32e876[_0x4f6e('0x4c')],_0x32e876[_0x4f6e('0x4d')]);_0xc6b63[_0x4f6e('0x51')]=_[_0x4f6e('0x50')](_0x32e876[_0x4f6e('0x4c')],qs[_0x4f6e('0x52')](_0x577b14['query'][_0x4f6e('0x52')]));_0xc6b63[_0x4f6e('0x51')]=_0xc6b63[_0x4f6e('0x51')][_0x4f6e('0x53')]?_0xc6b63[_0x4f6e('0x51')]:_0x32e876[_0x4f6e('0x4c')];if(!_0x577b14[_0x4f6e('0x4d')][_0x4f6e('0x54')](_0x4f6e('0x55'))){_0xc6b63[_0x4f6e('0x21')]=qs['limit'](_0x577b14['query'][_0x4f6e('0x21')]);_0xc6b63[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x577b14[_0x4f6e('0x4d')][_0x4f6e('0x1f')]);}_0xc6b63['order']=qs[_0x4f6e('0x57')](_0x577b14[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0xc6b63[_0x4f6e('0x58')]=qs[_0x4f6e('0x4f')](_[_0x4f6e('0x73')](_0x577b14[_0x4f6e('0x4d')],_0x32e876[_0x4f6e('0x4f')]));_0xc6b63[_0x4f6e('0x58')][_0x4f6e('0x6e')]=_0x8ec94a['id'];if(_0x577b14['query'][_0x4f6e('0x59')]){_0xc6b63['where']=_[_0x4f6e('0x5a')](_0xc6b63[_0x4f6e('0x58')],{'$or':_[_0x4f6e('0x47')](_0xc6b63[_0x4f6e('0x51')],function(_0x15f6e7){var _0x2d4f0a={};_0x2d4f0a[_0x15f6e7]={'$like':'%'+_0x577b14[_0x4f6e('0x4d')]['filter']+'%'};return _0x2d4f0a;})});}_0xc6b63=_[_0x4f6e('0x5a')]({},_0xc6b63,_0x577b14[_0x4f6e('0x5d')]);return db['Disposition'][_0x4f6e('0x22')]({'where':_0xc6b63[_0x4f6e('0x58')]})[_0x4f6e('0x26')](function(_0x5d5278){_0xfca00c[_0x4f6e('0x22')]=_0x5d5278;if(_0x577b14[_0x4f6e('0x4d')][_0x4f6e('0x5e')]){_0xc6b63[_0x4f6e('0x65')]=[{'all':!![]}];}return db['Disposition'][_0x4f6e('0x5f')](_0xc6b63);})[_0x4f6e('0x26')](function(_0x8f69a1){_0xfca00c[_0x4f6e('0x60')]=_0x8f69a1;return _0xfca00c;});}})[_0x4f6e('0x26')](respondWithFilteredResult(_0x84c0e4,_0xc6b63))[_0x4f6e('0x61')](handleError(_0x84c0e4,null));};exports[_0x4f6e('0x74')]=function(_0x318a66,_0x5612ec){return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x318a66[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x5612ec,null))[_0x4f6e('0x26')](function(_0x1ace8d){if(_0x1ace8d){return _0x1ace8d[_0x4f6e('0x74')](_0x318a66[_0x4f6e('0x4d')][_0x4f6e('0x75')]);}})[_0x4f6e('0x26')](respondWithStatusCode(_0x5612ec,null))[_0x4f6e('0x61')](handleError(_0x5612ec,null));};exports[_0x4f6e('0x76')]=function(_0xd5436a,_0xbbf57f){if(_0xd5436a[_0x4f6e('0x67')]['id']){delete _0xd5436a[_0x4f6e('0x67')]['id'];}return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0xd5436a[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0xbbf57f,null))['then'](function(_0x2c6e0d){if(_0x2c6e0d){_0xd5436a[_0x4f6e('0x67')][_0x4f6e('0x6e')]=_0x2c6e0d['id'];return db[_0x4f6e('0x77')][_0x4f6e('0x70')](_0xd5436a['body']);}})['then'](respondWithResult(_0xbbf57f,null))[_0x4f6e('0x61')](handleError(_0xbbf57f,null));};exports[_0x4f6e('0x78')]=function(_0x4f0ca3,_0x528e24){var _0x3e47ce={'raw':![],'where':{}};var _0x331bff={};var _0x1483a9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4f0ca3[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x528e24,null))['then'](function(_0x118b7f){if(_0x118b7f){_0x331bff[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0x77')][_0x4f6e('0x49')]);_0x331bff[_0x4f6e('0x4d')]=_['keys'](_0x4f0ca3['query']);_0x331bff[_0x4f6e('0x4f')]=_[_0x4f6e('0x50')](_0x331bff[_0x4f6e('0x4c')],_0x331bff[_0x4f6e('0x4d')]);_0x3e47ce[_0x4f6e('0x51')]=_[_0x4f6e('0x50')](_0x331bff[_0x4f6e('0x4c')],qs['fields'](_0x4f0ca3[_0x4f6e('0x4d')][_0x4f6e('0x52')]));_0x3e47ce[_0x4f6e('0x51')]=_0x3e47ce[_0x4f6e('0x51')][_0x4f6e('0x53')]?_0x3e47ce[_0x4f6e('0x51')]:_0x331bff['model'];if(!_0x4f0ca3['query'][_0x4f6e('0x54')]('nolimit')){_0x3e47ce[_0x4f6e('0x21')]=qs[_0x4f6e('0x21')](_0x4f0ca3['query'][_0x4f6e('0x21')]);_0x3e47ce[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x4f0ca3['query'][_0x4f6e('0x1f')]);}_0x3e47ce[_0x4f6e('0x56')]=qs['sort'](_0x4f0ca3[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0x3e47ce[_0x4f6e('0x58')]=qs[_0x4f6e('0x4f')](_[_0x4f6e('0x73')](_0x4f0ca3[_0x4f6e('0x4d')],_0x331bff[_0x4f6e('0x4f')]));_0x3e47ce[_0x4f6e('0x58')][_0x4f6e('0x6e')]=_0x118b7f['id'];if(_0x4f0ca3['query'][_0x4f6e('0x59')]){_0x3e47ce[_0x4f6e('0x58')]=_['merge'](_0x3e47ce[_0x4f6e('0x58')],{'$or':_[_0x4f6e('0x47')](_0x3e47ce[_0x4f6e('0x51')],function(_0x290b36){var _0x1dcc10={};_0x1dcc10[_0x290b36]={'$like':'%'+_0x4f0ca3[_0x4f6e('0x4d')][_0x4f6e('0x59')]+'%'};return _0x1dcc10;})});}_0x3e47ce=_[_0x4f6e('0x5a')]({},_0x3e47ce,_0x4f0ca3[_0x4f6e('0x5d')]);return db['CannedAnswer'][_0x4f6e('0x22')]({'where':_0x3e47ce[_0x4f6e('0x58')]})[_0x4f6e('0x26')](function(_0x576744){_0x1483a9[_0x4f6e('0x22')]=_0x576744;if(_0x4f0ca3[_0x4f6e('0x4d')][_0x4f6e('0x5e')]){_0x3e47ce[_0x4f6e('0x65')]=[{'all':!![]}];}return db[_0x4f6e('0x77')]['findAll'](_0x3e47ce);})[_0x4f6e('0x26')](function(_0xc74916){_0x1483a9[_0x4f6e('0x60')]=_0xc74916;return _0x1483a9;});}})[_0x4f6e('0x26')](respondWithFilteredResult(_0x528e24,_0x3e47ce))[_0x4f6e('0x61')](handleError(_0x528e24,null));};exports['removeAnswers']=function(_0x4f8911,_0x7c30cc){return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x4f8911[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x7c30cc,null))[_0x4f6e('0x26')](function(_0xcab559){if(_0xcab559){return _0xcab559['removeAnswers'](_0x4f8911[_0x4f6e('0x4d')][_0x4f6e('0x75')]);}})[_0x4f6e('0x26')](respondWithStatusCode(_0x7c30cc,null))[_0x4f6e('0x61')](handleError(_0x7c30cc,null));};exports[_0x4f6e('0x70')]=function(_0x3c31bb,_0x1f955b){var _0x3ea80a={'name':_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x2b')],'key':_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x4b')],'provider':_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x68')]==='custom'?null:_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x68')],'email':_0x3c31bb['body'][_0x4f6e('0x79')],'ListId':_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x7a')],'active':!_[_0x4f6e('0x7b')](_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x7c')])?_0x3c31bb[_0x4f6e('0x67')][_0x4f6e('0x7c')]:!![],'description':_0x3c31bb['body'][_0x4f6e('0x7d')]||null};var _0x220b67=getAuthenticationOptions(_0x3ea80a[_0x4f6e('0x68')],_0x3c31bb[_0x4f6e('0x67')]);_0x3ea80a[_0x4f6e('0x42')]=_0x220b67[_0x4f6e('0x42')];_0x3ea80a['Smtp']=_0x220b67['Smtp'];return db['MailAccount'][_0x4f6e('0x70')](_0x3ea80a,{'include':[{'model':db[_0x4f6e('0x44')],'as':_0x4f6e('0x45')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x4f6e('0x26')](function(_0x5400c3){var _0x20bdc3=_0x3c31bb['user'][_0x4f6e('0x27')]({'plain':!![]});if(!_0x20bdc3)throw new Error(_0x4f6e('0x7e'));if(_0x20bdc3['role']==='user'){var _0x145c09=_0x5400c3[_0x4f6e('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x4f6e('0x66')]({'where':{'name':'MailAccounts','userProfileId':_0x20bdc3[_0x4f6e('0x7f')]},'raw':!![]})[_0x4f6e('0x26')](function(_0x2dc064){if(_0x2dc064&&_0x2dc064[_0x4f6e('0x80')]===0x0){return db[_0x4f6e('0x28')][_0x4f6e('0x70')]({'name':_0x145c09[_0x4f6e('0x2b')],'resourceId':_0x145c09['id'],'type':_0x2dc064[_0x4f6e('0x2b')],'sectionId':_0x2dc064['id']},{})[_0x4f6e('0x26')](function(){return _0x5400c3;});}else{return _0x5400c3;}})[_0x4f6e('0x61')](function(_0x1fbb2f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fbb2f);throw _0x1fbb2f;});}return _0x5400c3;})['then'](respondWithResult(_0x1f955b,0xc9))[_0x4f6e('0x61')](handleError(_0x1f955b,null));};exports[_0x4f6e('0x81')]=function(_0x4d8724,_0x562669){return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x4d8724[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x562669,null))[_0x4f6e('0x26')](function(_0x563769){if(_0x563769){return _0x563769['getImap']();}return null;})['then'](respondWithResult(_0x562669,null))[_0x4f6e('0x61')](handleError(_0x562669,null));};exports[_0x4f6e('0x82')]=function(_0x109ba6,_0x3aa3ee){if(_0x109ba6[_0x4f6e('0x67')]['id']){delete _0x109ba6[_0x4f6e('0x67')]['id'];}return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x109ba6['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x3aa3ee,null))[_0x4f6e('0x26')](function(_0x427ddb){if(_0x427ddb){_0x109ba6[_0x4f6e('0x67')][_0x4f6e('0x6e')]=_0x427ddb['id'];return db[_0x4f6e('0x43')][_0x4f6e('0x70')](_0x109ba6[_0x4f6e('0x67')]);}})[_0x4f6e('0x26')](respondWithResult(_0x3aa3ee,null))['catch'](handleError(_0x3aa3ee,null));};exports[_0x4f6e('0x83')]=function(_0x3827ee,_0x3a1245){return db['MailAccount'][_0x4f6e('0x72')]({'where':{'id':_0x3827ee[_0x4f6e('0x63')]['id']}})['then'](handleEntityNotFound(_0x3a1245,null))[_0x4f6e('0x26')](function(_0x1689f4){if(_0x1689f4){return _0x1689f4[_0x4f6e('0x84')](null);}return null;})[_0x4f6e('0x26')](respondWithStatusCode(_0x3a1245,null))[_0x4f6e('0x61')](handleError(_0x3a1245,null));};exports['getSmtp']=function(_0x4e06ee,_0x3cfc16){return db['MailAccount'][_0x4f6e('0x72')]({'where':{'id':_0x4e06ee['params']['id']}})['then'](handleEntityNotFound(_0x3cfc16,null))['then'](function(_0x1dd211){if(_0x1dd211){return _0x1dd211[_0x4f6e('0x85')]();}return null;})['then'](respondWithResult(_0x3cfc16,null))['catch'](handleError(_0x3cfc16,null));};exports[_0x4f6e('0x86')]=function(_0x3c936b,_0x5802a1){if(_0x3c936b[_0x4f6e('0x67')]['id']){delete _0x3c936b[_0x4f6e('0x67')]['id'];}return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x3c936b['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x5802a1,null))[_0x4f6e('0x26')](function(_0x58deeb){if(_0x58deeb){_0x3c936b[_0x4f6e('0x67')][_0x4f6e('0x6e')]=_0x58deeb['id'];return db['MailServerOut'][_0x4f6e('0x70')](_0x3c936b[_0x4f6e('0x67')]);}})[_0x4f6e('0x26')](respondWithResult(_0x5802a1,null))[_0x4f6e('0x61')](handleError(_0x5802a1,null));};exports[_0x4f6e('0x87')]=function(_0x2f3aab,_0x548f8c){return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x2f3aab[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x548f8c,null))[_0x4f6e('0x26')](function(_0x3c12e9){if(_0x3c12e9){return _0x3c12e9[_0x4f6e('0x88')](null);}return null;})[_0x4f6e('0x26')](respondWithStatusCode(_0x548f8c,null))[_0x4f6e('0x61')](handleError(_0x548f8c,null));};exports[_0x4f6e('0x89')]=function(_0xb25436,_0x21b0d2){return db[_0x4f6e('0x8a')][_0x4f6e('0x66')]({'where':{'id':_0xb25436[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x21b0d2,null))[_0x4f6e('0x26')](function(_0x16cea5){if(_0x16cea5){return _0x16cea5[_0x4f6e('0x89')](_0xb25436[_0x4f6e('0x67')][_0x4f6e('0x75')],_[_0x4f6e('0x8b')](_0xb25436[_0x4f6e('0x67')],[_0x4f6e('0x75'),'id'])||{});}})[_0x4f6e('0x26')](respondWithResult(_0x21b0d2,null))[_0x4f6e('0x61')](handleError(_0x21b0d2,null));};exports[_0x4f6e('0x8c')]=function(_0x182351,_0x18f020){var _0x1bb496={'raw':![],'where':{}};var _0x26411f={};var _0x231a1c={'count':0x0,'rows':[]};return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x182351[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x18f020,null))['then'](function(_0x1017b5){if(_0x1017b5){_0x26411f[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0x8a')]['rawAttributes']);_0x26411f[_0x4f6e('0x4d')]=_[_0x4f6e('0x4e')](_0x182351[_0x4f6e('0x4d')]);_0x26411f[_0x4f6e('0x4f')]=_['intersection'](_0x26411f['model'],_0x26411f[_0x4f6e('0x4d')]);_0x1bb496[_0x4f6e('0x51')]=_[_0x4f6e('0x50')](_0x26411f[_0x4f6e('0x4c')],qs['fields'](_0x182351[_0x4f6e('0x4d')]['fields']));_0x1bb496[_0x4f6e('0x51')]=_0x1bb496[_0x4f6e('0x51')][_0x4f6e('0x53')]?_0x1bb496[_0x4f6e('0x51')]:_0x26411f['model'];if(!_0x182351[_0x4f6e('0x4d')][_0x4f6e('0x54')](_0x4f6e('0x55'))){_0x1bb496['limit']=qs[_0x4f6e('0x21')](_0x182351['query'][_0x4f6e('0x21')]);_0x1bb496[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x182351[_0x4f6e('0x4d')]['offset']);}_0x1bb496[_0x4f6e('0x56')]=qs['sort'](_0x182351[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0x1bb496[_0x4f6e('0x58')]=qs[_0x4f6e('0x4f')](_[_0x4f6e('0x73')](_0x182351[_0x4f6e('0x4d')],_0x26411f['filters']));_0x1bb496[_0x4f6e('0x58')]['MailAccountId']=_0x1017b5['id'];if(_0x182351['query']['filter']){_0x1bb496[_0x4f6e('0x58')]=_[_0x4f6e('0x5a')](_0x1bb496[_0x4f6e('0x58')],{'$or':_[_0x4f6e('0x47')](_0x1bb496['attributes'],function(_0x272d41){var _0x6a82f7={};_0x6a82f7[_0x272d41]={'$like':'%'+_0x182351[_0x4f6e('0x4d')][_0x4f6e('0x59')]+'%'};return _0x6a82f7;})});}_0x1bb496=_[_0x4f6e('0x5a')]({},_0x1bb496,_0x182351[_0x4f6e('0x5d')]);return db[_0x4f6e('0x8a')][_0x4f6e('0x22')]({'where':_0x1bb496[_0x4f6e('0x58')]})['then'](function(_0x342884){_0x231a1c[_0x4f6e('0x22')]=_0x342884;if(_0x182351[_0x4f6e('0x4d')]['includeAll']){_0x1bb496[_0x4f6e('0x65')]=[{'model':db[_0x4f6e('0x8d')],'as':_0x4f6e('0x8e'),'required':![]},{'model':db['User'],'as':_0x4f6e('0x8f'),'attributes':[_0x4f6e('0x2b'),_0x4f6e('0x90'),_0x4f6e('0x91')],'required':![]},{'model':db['Tag'],'as':_0x4f6e('0x92'),'attributes':['id',_0x4f6e('0x2b'),_0x4f6e('0x93')],'where':_0x182351[_0x4f6e('0x4d')][_0x4f6e('0x94')]?{'id':_0x182351['query'][_0x4f6e('0x94')]}:undefined,'required':_0x182351[_0x4f6e('0x4d')][_0x4f6e('0x94')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x1bb496);})[_0x4f6e('0x26')](function(_0x451fb7){_0x231a1c[_0x4f6e('0x60')]=_0x451fb7;return _0x231a1c;});}})['then'](respondWithFilteredResult(_0x18f020,_0x1bb496))[_0x4f6e('0x61')](handleError(_0x18f020,null));};exports[_0x4f6e('0x95')]=function addApplications(_0x53e672,_0x434903){var _0x44eac7=_0x53e672[_0x4f6e('0x63')]['id'];var _0x1f81bb=_0x53e672['body'];var _0xcb85a9=0xc8;var _0x5e943b=null;return db[_0x4f6e('0x96')][_0x4f6e('0x97')]({'isolationLevel':db[_0x4f6e('0x96')]['Transaction'][_0x4f6e('0x98')][_0x4f6e('0x99')]},function(_0xedac6a){return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x44eac7},'transaction':_0xedac6a})[_0x4f6e('0x26')](function(_0x45bf52){if(_0x45bf52){return db[_0x4f6e('0x9a')][_0x4f6e('0x29')]({'where':{'MailAccountId':_0x44eac7},'transaction':_0xedac6a})[_0x4f6e('0x26')](function(){var _0x5435f7=_['map'](_0x1f81bb,function(_0x163f25){_0x163f25['MailAccountId']=_0x44eac7;return _0x163f25;});return db[_0x4f6e('0x9a')][_0x4f6e('0x9b')](_0x5435f7,{'transaction':_0xedac6a});});}else{_0xcb85a9=0x194;_0x5e943b=[];}});})[_0x4f6e('0x26')](function(){if(_0xcb85a9!==0x194){return db[_0x4f6e('0x9a')][_0x4f6e('0x9c')]({'where':{'MailAccountId':_0x44eac7},'order':_0x4f6e('0x9d')})[_0x4f6e('0x26')](function(_0x2b6155){_0x5e943b=_0x2b6155;});}})[_0x4f6e('0x61')](function(_0x5f38c5){_0xcb85a9=0x1f4;logger[_0x4f6e('0x16')](_0x5f38c5[_0x4f6e('0x2a')]);if(_0x5f38c5['name']){delete _0x5f38c5[_0x4f6e('0x2b')];}_0x5e943b=_0x5f38c5;})[_0x4f6e('0x9e')](function(){if(_0x5e943b===null){_0x434903[_0x4f6e('0x1b')](_0xcb85a9);}else{if(_0xcb85a9===0x1f4){_0x434903[_0x4f6e('0x1c')](_0xcb85a9)[_0x4f6e('0x2c')](_0x5e943b);}else{_0x434903[_0x4f6e('0x1c')](_0xcb85a9)[_0x4f6e('0x1e')](_0x5e943b);}}});};exports[_0x4f6e('0x9f')]=function(_0x5b2737,_0x31a55d){var _0x223773={};var _0x583d47={};var _0x150e03;var _0x1a6a36;return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x5b2737['params']['id']}})['then'](handleEntityNotFound(_0x31a55d,null))['then'](function(_0x524bc7){if(_0x524bc7){_0x150e03=_0x524bc7;_0x583d47[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0x9a')][_0x4f6e('0x49')]);_0x583d47['query']=_[_0x4f6e('0x4e')](_0x5b2737[_0x4f6e('0x4d')]);_0x583d47[_0x4f6e('0x4f')]=_[_0x4f6e('0x50')](_0x583d47[_0x4f6e('0x4c')],_0x583d47[_0x4f6e('0x4d')]);_0x223773['attributes']=_[_0x4f6e('0x50')](_0x583d47['model'],qs[_0x4f6e('0x52')](_0x5b2737[_0x4f6e('0x4d')]['fields']));_0x223773[_0x4f6e('0x51')]=_0x223773[_0x4f6e('0x51')][_0x4f6e('0x53')]?_0x223773['attributes']:_0x583d47['model'];_0x223773[_0x4f6e('0x56')]=qs[_0x4f6e('0x57')](_0x5b2737[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0x223773[_0x4f6e('0x58')]=qs['filters'](_['pick'](_0x5b2737[_0x4f6e('0x4d')],_0x583d47['filters']));if(_0x5b2737['query']['filter']){_0x223773['where']=_[_0x4f6e('0x5a')](_0x223773['where'],{'$or':_[_0x4f6e('0x47')](_0x223773['attributes'],function(_0x5e0f9c){var _0x4ce769={};_0x4ce769[_0x5e0f9c]={'$like':'%'+_0x5b2737[_0x4f6e('0x4d')][_0x4f6e('0x59')]+'%'};return _0x4ce769;})});}_0x223773=_[_0x4f6e('0x5a')]({},_0x223773,_0x5b2737[_0x4f6e('0x5d')]);return _0x150e03[_0x4f6e('0x9f')](_0x223773);}})[_0x4f6e('0x26')](function(_0x3fb295){if(_0x3fb295){_0x1a6a36=_0x3fb295['length'];if(!_0x5b2737['query'][_0x4f6e('0x54')](_0x4f6e('0x55'))){_0x223773[_0x4f6e('0x21')]=qs[_0x4f6e('0x21')](_0x5b2737[_0x4f6e('0x4d')][_0x4f6e('0x21')]);_0x223773[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x5b2737[_0x4f6e('0x4d')]['offset']);}return _0x150e03['getApplications'](_0x223773);}})[_0x4f6e('0x26')](function(_0x4bf8af){if(_0x4bf8af){return _0x4bf8af?{'count':_0x1a6a36,'rows':_0x4bf8af}:null;}})['then'](respondWithResult(_0x31a55d,null))[_0x4f6e('0x61')](handleError(_0x31a55d,null));};exports['getMessages']=function(_0x32ee81,_0x3071f7){var _0x47707f={'raw':!![],'where':{}};var _0x5f526b={};var _0x37ffa6={'count':0x0,'rows':[]};return db[_0x4f6e('0x48')][_0x4f6e('0x72')]({'where':{'id':_0x32ee81['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x3071f7,null))['then'](function(_0x4bf7be){if(_0x4bf7be){_0x5f526b[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0xa0')][_0x4f6e('0x49')]);_0x5f526b[_0x4f6e('0x4d')]=_[_0x4f6e('0x4e')](_0x32ee81[_0x4f6e('0x4d')]);_0x5f526b[_0x4f6e('0x4f')]=_[_0x4f6e('0x50')](_0x5f526b['model'],_0x5f526b[_0x4f6e('0x4d')]);_0x47707f[_0x4f6e('0x51')]=_[_0x4f6e('0x50')](_0x5f526b[_0x4f6e('0x4c')],qs['fields'](_0x32ee81['query'][_0x4f6e('0x52')]));_0x47707f[_0x4f6e('0x51')]=_0x47707f[_0x4f6e('0x51')][_0x4f6e('0x53')]?_0x47707f[_0x4f6e('0x51')]:_0x5f526b[_0x4f6e('0x4c')];if(!_0x32ee81['query']['hasOwnProperty'](_0x4f6e('0x55'))){_0x47707f[_0x4f6e('0x21')]=qs[_0x4f6e('0x21')](_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0x21')]);_0x47707f[_0x4f6e('0x1f')]=qs[_0x4f6e('0x1f')](_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0x1f')]);}_0x47707f[_0x4f6e('0x56')]=qs[_0x4f6e('0x57')](_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0x47707f[_0x4f6e('0x58')]=qs[_0x4f6e('0x4f')](_[_0x4f6e('0x73')](_0x32ee81['query'],_0x5f526b[_0x4f6e('0x4f')]));_0x47707f[_0x4f6e('0x58')][_0x4f6e('0x6e')]=_0x4bf7be['id'];if(_0x32ee81['query']['filter']){_0x47707f[_0x4f6e('0x58')]=_[_0x4f6e('0x5a')](_0x47707f['where'],{'$or':_['map'](_0x47707f[_0x4f6e('0x51')],function(_0x21985c){var _0x34c9f2={};_0x34c9f2[_0x21985c]={'$like':'%'+_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0x59')]+'%'};return _0x34c9f2;})});}if(_0x32ee81['query'][_0x4f6e('0xa1')]){var _0x509a83=_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0xa1')][_0x4f6e('0xa2')](',');var _0x2b4762={};_0x2b4762[_0x509a83[0x0]]={'$gte':moment(_0x509a83[0x1])[_0x4f6e('0xa3')](_0x4f6e('0xa4'))};_0x47707f[_0x4f6e('0x58')]=_[_0x4f6e('0x5a')](_0x47707f['where'],_0x2b4762);}_0x47707f=_[_0x4f6e('0x5a')]({},_0x47707f,_0x32ee81[_0x4f6e('0x5d')]);return db[_0x4f6e('0xa0')][_0x4f6e('0x22')]({'where':_0x47707f[_0x4f6e('0x58')]})[_0x4f6e('0x26')](function(_0xb96aac){_0x37ffa6['count']=_0xb96aac;if(_0x32ee81[_0x4f6e('0x4d')]['includeAll']){_0x47707f[_0x4f6e('0x65')]=[{'all':!![]}];}return db[_0x4f6e('0xa0')]['findAll'](_0x47707f);})[_0x4f6e('0x26')](function(_0x93cb7e){if(_0x32ee81[_0x4f6e('0x4d')][_0x4f6e('0xa5')]==='true'){for(var _0x2b615a=0x0;_0x2b615a<_0x93cb7e[_0x4f6e('0x53')];_0x2b615a++){_0x93cb7e[_0x2b615a]['body']=juice(_0x93cb7e[_0x2b615a][_0x4f6e('0x67')]);}}_0x37ffa6['rows']=_0x93cb7e;return _0x37ffa6;});}})[_0x4f6e('0x26')](respondWithFilteredResult(_0x3071f7,_0x47707f))[_0x4f6e('0x61')](handleError(_0x3071f7,null));};exports[_0x4f6e('0x2c')]=function(_0x20f23a,_0x5f2b12){var _0x1eaa31,_0x156984={},_0x59153a;if(_0x20f23a[_0x4f6e('0x67')]['to']){_0x59153a=_0x20f23a[_0x4f6e('0x67')]['to']['split'](',')[0x0];}return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x20f23a[_0x4f6e('0x63')]['id']},'include':[{'model':db[_0x4f6e('0xa6')],'as':_0x4f6e('0xa7'),'include':[{'model':db[_0x4f6e('0x8d')],'as':'Contacts','where':{'email':_0x59153a},'limit':0x1,'order':[[_0x4f6e('0xa8'),_0x4f6e('0xa9')]]}]},{'model':db[_0x4f6e('0x44')],'as':_0x4f6e('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x4f6e('0x26')](handleEntityNotFound(_0x5f2b12,null))[_0x4f6e('0x26')](function(_0x3cab68){if(!_0x3cab68)return;_0x1eaa31=_0x3cab68;if(!_0x3cab68[_0x4f6e('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x4f6e('0x7b')](_0x20f23a[_0x4f6e('0x67')][_0x4f6e('0xaa')])){_0x20f23a[_0x4f6e('0x67')][_0x4f6e('0xaa')]=util[_0x4f6e('0xa3')]('%s\x20<%s>',_0x3cab68['name'],_0x3cab68[_0x4f6e('0x79')]||_0x3cab68['Smtp'][_0x4f6e('0x38')]);}if(_0x20f23a['body'][_0x4f6e('0xab')]&&_0x20f23a['body'][_0x4f6e('0xab')][_0x4f6e('0x53')]){for(var _0x1264e6=0x0;_0x1264e6<_0x20f23a['body'][_0x4f6e('0xab')][_0x4f6e('0x53')];_0x1264e6+=0x1){_0x20f23a[_0x4f6e('0x67')]['attachments'][_0x1264e6]={'filename':_0x20f23a[_0x4f6e('0x67')][_0x4f6e('0xab')][_0x1264e6][_0x4f6e('0x2b')],'path':path['join'](config[_0x4f6e('0xac')],_0x4f6e('0xad'),_0x20f23a[_0x4f6e('0x67')][_0x4f6e('0xab')][_0x1264e6][_0x4f6e('0xae')])};}}var _0x5eef75=_0x3cab68[_0x4f6e('0xaf')]();return respondWithRpcPromise(_0x4f6e('0xb0'),'sendMail',{'account':_0x5eef75,'message':_0x20f23a[_0x4f6e('0x67')]});})[_0x4f6e('0x26')](function(_0x575d5e){if(!_0x575d5e)return;_0x156984=_0x575d5e;if(!_0x1eaa31['List'])throw new Error(_0x4f6e('0xb1'));if(_0x1eaa31[_0x4f6e('0xa7')]['Contacts']['length'])return _0x1eaa31['List']['Contacts'][0x0];return db['CmContact'][_0x4f6e('0x70')](_[_0x4f6e('0xa')](_0x20f23a[_0x4f6e('0x67')],{'firstName':_0x20f23a[_0x4f6e('0x67')]['to'],'email':_0x20f23a['body']['to'],'phone':_0x20f23a[_0x4f6e('0x67')]['to'],'ListId':_0x1eaa31[_0x4f6e('0x7a')]}));})[_0x4f6e('0x26')](function(_0x2fe755){if(!_0x2fe755)return;var _0x1bd628={'UserId':_0x20f23a['user']['id'],'ContactId':_0x2fe755['id'],'MailAccountId':_0x1eaa31['id'],'inReplyTo':_0x156984[_0x4f6e('0xb2')],'to':_0x20f23a['body'][_0x4f6e('0xaa')],'cc':_0x20f23a['body']['cc'],'subject':_0x20f23a[_0x4f6e('0x67')]['subject'],'attach':_0x20f23a[_0x4f6e('0x67')][_0x4f6e('0xb3')],'firstMsgDirection':_0x4f6e('0xb4'),'lastMsgAt':moment()[_0x4f6e('0xa3')](_0x4f6e('0xa4')),'lastMsgDirection':'out','Messages':[_[_0x4f6e('0x5a')](_0x20f23a['body'],{'messageId':_0x156984['messageId'],'sentAt':moment()[_0x4f6e('0xa3')](_0x4f6e('0xa4')),'read':!![],'MailAccountId':_0x1eaa31['id'],'UserId':_0x20f23a['user']['id'],'ContactId':_0x2fe755['id']})]};if(_0x20f23a[_0x4f6e('0x67')]['Interaction']){_0x1bd628=_[_0x4f6e('0x5a')](_0x1bd628,_0x20f23a['body']['Interaction']);}return db[_0x4f6e('0x8a')][_0x4f6e('0x70')](_0x1bd628,{'include':[{'model':db[_0x4f6e('0xa0')],'as':_0x4f6e('0xb5')}]});})[_0x4f6e('0x26')](respondWithResult(_0x5f2b12,null))[_0x4f6e('0x61')](handleError(_0x5f2b12,null));};exports[_0x4f6e('0xb6')]=function(_0x1c02e3,_0x292d17){return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x1c02e3[_0x4f6e('0x63')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x4f6e('0x45'),'raw':!![],'include':[{'model':db[_0x4f6e('0xb7')],'as':_0x4f6e('0xb7'),'raw':!![]}]}]})[_0x4f6e('0x26')](handleEntityNotFound(_0x292d17,null))['then'](function(_0x256506){if(!_0x256506[_0x4f6e('0x45')])return;var _0x42c176=_0x256506['getSmtpOptions']();return respondWithRpcPromise(_0x4f6e('0xb8'),_0x4f6e('0xb6'),{'account':_0x42c176});})['then'](respondWithResult(_0x292d17,null))[_0x4f6e('0x61')](handleError(_0x292d17,null));};exports[_0x4f6e('0x29')]=function(_0x529340,_0x4862e1){return db[_0x4f6e('0x48')][_0x4f6e('0x66')]({'where':{'id':_0x529340['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x4862e1,null))[_0x4f6e('0x26')](function(_0x285234){if(_0x285234&&_0x285234[_0x4f6e('0x40')]){throw new db['Sequelize'][(_0x4f6e('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x285234;})[_0x4f6e('0x26')](removeEntity(_0x4862e1,null))[_0x4f6e('0x61')](handleError(_0x4862e1,null));};exports[_0x4f6e('0xba')]=function(_0x2738ce,_0x2413b9){return db[_0x4f6e('0x48')]['find']({'where':{'id':_0x2738ce[_0x4f6e('0x63')]['id']}})['then'](handleEntityNotFound(_0x2413b9,null))[_0x4f6e('0x26')](function(_0x4e6e62){if(_0x4e6e62){return _0x4e6e62[_0x4f6e('0xba')](_0x2738ce[_0x4f6e('0x67')]['ids'],_[_0x4f6e('0x8b')](_0x2738ce[_0x4f6e('0x67')],[_0x4f6e('0x75'),'id'])||{})[_0x4f6e('0xbb')](function(_0x16913d){for(var _0x2cd034=0x0;_0x2cd034<_0x2738ce[_0x4f6e('0x67')]['ids'][_0x4f6e('0x53')];_0x2cd034+=0x1){socket[_0x4f6e('0xbc')](_0x4f6e('0xbd'),{'UserId':Number(_0x2738ce[_0x4f6e('0x67')][_0x4f6e('0x75')][_0x2cd034]),'MailAccountId':Number(_0x2738ce['params']['id'])});}return _0x16913d;});}})['then'](respondWithResult(_0x2413b9,null))[_0x4f6e('0x61')](handleError(_0x2413b9,null));};exports[_0x4f6e('0xbe')]=function(_0x349459,_0xc7340f){return db['MailAccount'][_0x4f6e('0x66')]({'where':{'id':_0x349459[_0x4f6e('0x63')]['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0xc7340f,null))['then'](function(_0x328abc){if(_0x328abc){return _0x328abc[_0x4f6e('0xbe')](_0x349459['query'][_0x4f6e('0x75')])['then'](function(){if(_[_0x4f6e('0xbf')](_0x349459['query'][_0x4f6e('0x75')])){for(var _0x513d0c=0x0;_0x513d0c<_0x349459[_0x4f6e('0x4d')]['ids'][_0x4f6e('0x53')];_0x513d0c+=0x1){socket[_0x4f6e('0xbc')](_0x4f6e('0xc0'),{'UserId':Number(_0x349459[_0x4f6e('0x4d')][_0x4f6e('0x75')][_0x513d0c]),'MailAccountId':Number(_0x349459[_0x4f6e('0x63')]['id'])});}}else{socket[_0x4f6e('0xbc')](_0x4f6e('0xc0'),{'UserId':Number(_0x349459[_0x4f6e('0x4d')][_0x4f6e('0x75')]),'MailAccountId':Number(_0x349459['params']['id'])});}});}})[_0x4f6e('0x26')](respondWithStatusCode(_0xc7340f,null))['catch'](handleError(_0xc7340f,null));};exports[_0x4f6e('0xc1')]=function(_0x3b6efc,_0x37f864){var _0x5b5802={};var _0x25ff00={};var _0x513874;var _0x3814d0;return db['MailAccount'][_0x4f6e('0x72')]({'where':{'id':_0x3b6efc['params']['id']}})[_0x4f6e('0x26')](handleEntityNotFound(_0x37f864,null))[_0x4f6e('0x26')](function(_0x2ac6c0){if(_0x2ac6c0){_0x513874=_0x2ac6c0;_0x25ff00[_0x4f6e('0x4c')]=_[_0x4f6e('0x4e')](db[_0x4f6e('0xc2')]['rawAttributes']);_0x25ff00[_0x4f6e('0x4d')]=_[_0x4f6e('0x4e')](_0x3b6efc[_0x4f6e('0x4d')]);_0x25ff00[_0x4f6e('0x4f')]=_[_0x4f6e('0x50')](_0x25ff00[_0x4f6e('0x4c')],_0x25ff00[_0x4f6e('0x4d')]);_0x5b5802['attributes']=_[_0x4f6e('0x50')](_0x25ff00[_0x4f6e('0x4c')],qs[_0x4f6e('0x52')](_0x3b6efc[_0x4f6e('0x4d')][_0x4f6e('0x52')]));_0x5b5802[_0x4f6e('0x51')]=_0x5b5802[_0x4f6e('0x51')]['length']?_0x5b5802[_0x4f6e('0x51')]:_0x25ff00['model'];_0x5b5802[_0x4f6e('0x56')]=qs[_0x4f6e('0x57')](_0x3b6efc[_0x4f6e('0x4d')][_0x4f6e('0x57')]);_0x5b5802[_0x4f6e('0x58')]=qs['filters'](_['pick'](_0x3b6efc[_0x4f6e('0x4d')],_0x25ff00[_0x4f6e('0x4f')]));if(_0x3b6efc[_0x4f6e('0x4d')][_0x4f6e('0x59')]){_0x5b5802['where']=_['merge'](_0x5b5802[_0x4f6e('0x58')],{'$or':_[_0x4f6e('0x47')](_0x5b5802[_0x4f6e('0x51')],function(_0x59671c){var _0x297484={};_0x297484[_0x59671c]={'$like':'%'+_0x3b6efc['query']['filter']+'%'};return _0x297484;})});}_0x5b5802=_['merge']({},_0x5b5802,_0x3b6efc[_0x4f6e('0x5d')]);return _0x513874[_0x4f6e('0xc1')](_0x5b5802);}})[_0x4f6e('0x26')](function(_0x11d1a1){if(_0x11d1a1){_0x3814d0=_0x11d1a1[_0x4f6e('0x53')];if(!_0x3b6efc[_0x4f6e('0x4d')]['hasOwnProperty']('nolimit')){_0x5b5802[_0x4f6e('0x21')]=qs[_0x4f6e('0x21')](_0x3b6efc[_0x4f6e('0x4d')][_0x4f6e('0x21')]);_0x5b5802['offset']=qs[_0x4f6e('0x1f')](_0x3b6efc[_0x4f6e('0x4d')][_0x4f6e('0x1f')]);}return _0x513874[_0x4f6e('0xc1')](_0x5b5802);}})[_0x4f6e('0x26')](function(_0xb66785){if(_0xb66785){return _0xb66785?{'count':_0x3814d0,'rows':_0xb66785}:null;}})[_0x4f6e('0x26')](respondWithResult(_0x37f864,null))[_0x4f6e('0x61')](handleError(_0x37f864,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 221d332..a4eb8fe 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 _0x3157=['events','../../mysqldb','MailAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x3df600,_0x5d1ff9){var _0x57ea05=function(_0x614115){while(--_0x614115){_0x3df600['push'](_0x3df600['shift']());}};_0x57ea05(++_0x5d1ff9);}(_0x3157,0x198));var _0x7315=function(_0x1dc670,_0x3e48bf){_0x1dc670=_0x1dc670-0x0;var _0x269320=_0x3157[_0x1dc670];return _0x269320;};'use strict';var EventEmitter=require(_0x7315('0x0'));var MailAccount=require(_0x7315('0x1'))['db'][_0x7315('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7315('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7315('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ba02f){return function(_0x413249,_0x5c3bca,_0x58d458){MailAccountEvents[_0x7315('0x5')](_0x1ba02f+':'+_0x413249['id'],_0x413249);MailAccountEvents[_0x7315('0x5')](_0x1ba02f,_0x413249);_0x58d458(null);};}for(var e in events){if(events[_0x7315('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7315('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x23c7=['hasOwnProperty','events','../../mysqldb','MailAccount','save','update','emit'];(function(_0x109c40,_0x3463fa){var _0x3d5aed=function(_0x236b3f){while(--_0x236b3f){_0x109c40['push'](_0x109c40['shift']());}};_0x3d5aed(++_0x3463fa);}(_0x23c7,0x86));var _0x723c=function(_0x26af84,_0x5328c9){_0x26af84=_0x26af84-0x0;var _0x1dcbb5=_0x23c7[_0x26af84];return _0x1dcbb5;};'use strict';var EventEmitter=require(_0x723c('0x0'));var MailAccount=require(_0x723c('0x1'))['db'][_0x723c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x723c('0x3'),'afterUpdate':_0x723c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x12a351){return function(_0x2bd749,_0x30f3c9,_0x48b7f4){MailAccountEvents[_0x723c('0x5')](_0x12a351+':'+_0x2bd749['id'],_0x2bd749);MailAccountEvents[_0x723c('0x5')](_0x12a351,_0x2bd749);_0x48b7f4(null);};}for(var e in events){if(events[_0x723c('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a5b8a04..3e7c1e5 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 _0xf500=['user','CloudProvider','data5','auth','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service','host','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2'];(function(_0x5ae176,_0x5bd0f9){var _0x1ecd16=function(_0x7f308f){while(--_0x7f308f){_0x5ae176['push'](_0x5ae176['shift']());}};_0x1ecd16(++_0x5bd0f9);}(_0xf500,0x112));var _0x0f50=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf500[_0xfa634c];return _0x73e478;};'use strict';var attributes=require(_0x0f50('0x0'));module[_0x0f50('0x1')]=function(_0x1f6402){return _0x1f6402[_0x0f50('0x2')](_0x0f50('0x3'),attributes,{'tableName':_0x0f50('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x14a174=this;var _0x2a14a6={'id':_0x14a174['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14a174[_0x0f50('0x5')]!=='custom'){_0x2a14a6[_0x0f50('0x6')]=_0x14a174[_0x0f50('0x5')];}else{_0x2a14a6[_0x0f50('0x7')]=_0x14a174[_0x0f50('0x8')][_0x0f50('0x7')];_0x2a14a6['port']=_0x14a174[_0x0f50('0x8')]['port'];_0x2a14a6[_0x0f50('0x9')]=_0x14a174[_0x0f50('0x8')][_0x0f50('0x9')];}if(_0x14a174[_0x0f50('0x8')][_0x0f50('0xa')]){if(_0x14a174[_0x0f50('0x8')][_0x0f50('0xb')]){if(!_0x14a174['Smtp']['CloudProvider'])throw new Error(_0x0f50('0xc'));_0x2a14a6['auth']={'type':_0x0f50('0xd'),'user':_0x14a174['Smtp'][_0x0f50('0xe')],'accessToken':_0x14a174[_0x0f50('0x8')][_0x0f50('0xf')][_0x0f50('0x10')]};}else{_0x2a14a6[_0x0f50('0x11')]={'user':_0x14a174[_0x0f50('0x8')][_0x0f50('0xe')],'pass':_0x14a174[_0x0f50('0x8')]['pass']};}}return _0x2a14a6;}}});}; \ No newline at end of file +var _0xbab6=['custom','service','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass','./mailAccount.attributes','define','mail_accounts','provider'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbab6,0x150));var _0x6bab=function(_0xdda432,_0x5be813){_0xdda432=_0xdda432-0x0;var _0x480d45=_0xbab6[_0xdda432];return _0x480d45;};'use strict';var attributes=require(_0x6bab('0x0'));module['exports']=function(_0x542450){return _0x542450[_0x6bab('0x1')]('MailAccount',attributes,{'tableName':_0x6bab('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8e7c8f=this;var _0x3b1ef3={'id':_0x8e7c8f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8e7c8f[_0x6bab('0x3')]!==_0x6bab('0x4')){_0x3b1ef3[_0x6bab('0x5')]=_0x8e7c8f[_0x6bab('0x3')];}else{_0x3b1ef3[_0x6bab('0x6')]=_0x8e7c8f['Smtp'][_0x6bab('0x6')];_0x3b1ef3[_0x6bab('0x7')]=_0x8e7c8f[_0x6bab('0x8')][_0x6bab('0x7')];_0x3b1ef3[_0x6bab('0x9')]=_0x8e7c8f[_0x6bab('0x8')][_0x6bab('0x9')];}if(_0x8e7c8f[_0x6bab('0x8')]['authentication']){if(_0x8e7c8f['Smtp'][_0x6bab('0xa')]){if(!_0x8e7c8f[_0x6bab('0x8')][_0x6bab('0xb')])throw new Error(_0x6bab('0xc'));_0x3b1ef3[_0x6bab('0xd')]={'type':_0x6bab('0xe'),'user':_0x8e7c8f[_0x6bab('0x8')][_0x6bab('0xf')],'accessToken':_0x8e7c8f[_0x6bab('0x8')]['CloudProvider']['data5']};}else{_0x3b1ef3[_0x6bab('0xd')]={'user':_0x8e7c8f['Smtp'][_0x6bab('0xf')],'pass':_0x8e7c8f[_0x6bab('0x8')][_0x6bab('0x10')]};}}return _0x3b1ef3;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 54f2540..208cbb8 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 _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x197daf,_0x401ca8){var _0x5f2659=function(_0x2dcfee){while(--_0x2dcfee){_0x197daf['push'](_0x197daf['shift']());}};_0x5f2659(++_0x401ca8);}(_0xba34,0x119));var _0x4ba3=function(_0x5e520a,_0x5ef9cb){_0x5e520a=_0x5e520a-0x0;var _0x10d7c6=_0xba34[_0x5e520a];return _0x10d7c6;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file +var _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x2e71ba,_0x4e04f4){var _0x4715d4=function(_0x33c8be){while(--_0x33c8be){_0x2e71ba['push'](_0x2e71ba['shift']());}};_0x4715d4(++_0x4e04f4);}(_0x187d,0x93));var _0xd187=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x187d[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f73e772..fd46842 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 _0x6826=['update','emit','removeListener','register','length','./mailAccount.events','remove'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6826,0x75));var _0x6682=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0x6826[_0x59dccc];return _0xc97bcb;};'use strict';var MailAccountEvents=require(_0x6682('0x0'));var events=['save',_0x6682('0x1'),_0x6682('0x2')];function createListener(_0x1cc116,_0x2158c2){return function(_0x21b39c){_0x2158c2[_0x6682('0x3')](_0x1cc116,_0x21b39c);};}function removeListener(_0x55c3b5,_0x5adb0b){return function(){MailAccountEvents[_0x6682('0x4')](_0x55c3b5,_0x5adb0b);};}exports[_0x6682('0x5')]=function(_0x45d511){for(var _0x4c20b5=0x0,_0x47bbf=events[_0x6682('0x6')];_0x4c20b5<_0x47bbf;_0x4c20b5++){var _0x8decb4=events[_0x4c20b5];var _0x1498b5=createListener('mailAccount:'+_0x8decb4,_0x45d511);MailAccountEvents['on'](_0x8decb4,_0x1498b5);}}; \ No newline at end of file +var _0xa099=['update','emit','register','length','mailAccount:'];(function(_0x5bd5fe,_0x2bdf6b){var _0x336b22=function(_0x4466f3){while(--_0x4466f3){_0x5bd5fe['push'](_0x5bd5fe['shift']());}};_0x336b22(++_0x2bdf6b);}(_0xa099,0x69));var _0x9a09=function(_0x4ab432,_0x5a441f){_0x4ab432=_0x4ab432-0x0;var _0x576831=_0xa099[_0x4ab432];return _0x576831;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove',_0x9a09('0x0')];function createListener(_0x2801d5,_0x193d09){return function(_0x23b3dd){_0x193d09[_0x9a09('0x1')](_0x2801d5,_0x23b3dd);};}function removeListener(_0x31f6e2,_0x36aed9){return function(){MailAccountEvents['removeListener'](_0x31f6e2,_0x36aed9);};}exports[_0x9a09('0x2')]=function(_0x3324cd){for(var _0x2ed2d3=0x0,_0x39533e=events[_0x9a09('0x3')];_0x2ed2d3<_0x39533e;_0x2ed2d3++){var _0x2f4fec=events[_0x2ed2d3];var _0x1e8701=createListener(_0x9a09('0x4')+_0x2f4fec,_0x3324cd);MailAccountEvents['on'](_0x2f4fec,_0x1e8701);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index bbdad48..1f4679d 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 _0xcebd=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xcebd,0x19f));var _0xdceb=function(_0x146f8d,_0x3277c1){_0x146f8d=_0x146f8d-0x0;var _0x5ad2df=_0xcebd[_0x146f8d];return _0x5ad2df;};'use strict';var multer=require(_0xdceb('0x0'));var util=require(_0xdceb('0x1'));var path=require('path');var timeout=require(_0xdceb('0x2'));var express=require(_0xdceb('0x3'));var router=express[_0xdceb('0x4')]();var fs_extra=require(_0xdceb('0x5'));var auth=require(_0xdceb('0x6'));var interaction=require(_0xdceb('0x7'));var config=require(_0xdceb('0x8'));var controller=require(_0xdceb('0x9'));router[_0xdceb('0xa')](_0xdceb('0xb'),auth[_0xdceb('0xc')](),controller[_0xdceb('0xd')]);router[_0xdceb('0xe')](_0xdceb('0xb'),auth[_0xdceb('0xc')](),controller['update']);router[_0xdceb('0xf')](_0xdceb('0xb'),auth['isAuthenticated'](),controller[_0xdceb('0x10')]);module[_0xdceb('0x11')]=router; \ No newline at end of file +var _0x5e70=['fs-extra','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x5c0d53,_0x29fde6){var _0xef00dd=function(_0x3dc223){while(--_0x3dc223){_0x5c0d53['push'](_0x5c0d53['shift']());}};_0xef00dd(++_0x29fde6);}(_0x5e70,0xdc));var _0x05e7=function(_0x3c68e4,_0x20e968){_0x3c68e4=_0x3c68e4-0x0;var _0x2b35e7=_0x5e70[_0x3c68e4];return _0x2b35e7;};'use strict';var multer=require('multer');var util=require(_0x05e7('0x0'));var path=require(_0x05e7('0x1'));var timeout=require(_0x05e7('0x2'));var express=require('express');var router=express[_0x05e7('0x3')]();var fs_extra=require(_0x05e7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x05e7('0x5'));var controller=require(_0x05e7('0x6'));router[_0x05e7('0x7')]('/:id',auth[_0x05e7('0x8')](),controller[_0x05e7('0x9')]);router[_0x05e7('0xa')](_0x05e7('0xb'),auth[_0x05e7('0x8')](),controller[_0x05e7('0xc')]);router[_0x05e7('0xd')]('/:id',auth[_0x05e7('0x8')](),controller[_0x05e7('0xe')]);module[_0x05e7('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 91af043..3c0854f 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 _0xf2e3=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x41abfa,_0x54b89a){var _0x17aaf7=function(_0x445bd0){while(--_0x445bd0){_0x41abfa['push'](_0x41abfa['shift']());}};_0x17aaf7(++_0x54b89a);}(_0xf2e3,0x173));var _0x3f2e=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf2e3[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module[_0x3f2e('0x1')]={'priority':{'type':Sequelize[_0x3f2e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3f2e('0x3')],'allowNull':![],'defaultValue':_0x3f2e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3f2e('0x3')]},'interval':{'type':Sequelize[_0x3f2e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa831=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x2cdcdd,_0xaa2400){var _0x4c0771=function(_0x3b0d0e){while(--_0x3b0d0e){_0x2cdcdd['push'](_0x2cdcdd['shift']());}};_0x4c0771(++_0xaa2400);}(_0xa831,0x177));var _0x1a83=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xa831[_0x276468];return _0x36dc3a;};'use strict';var Sequelize=require('sequelize');module[_0x1a83('0x0')]={'priority':{'type':Sequelize[_0x1a83('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1a83('0x2')],'allowNull':![],'defaultValue':_0x1a83('0x3')},'appdata':{'type':Sequelize[_0x1a83('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1a83('0x2')],'defaultValue':_0x1a83('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2b7d112..2a640e4 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(_0x5bb7e6,_0x1a7bb6){var _0x545a3c=function(_0x375109){while(--_0x375109){_0x5bb7e6['push'](_0x5bb7e6['shift']());}};_0x545a3c(++_0x1a7bb6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4cc593,_0x82927){var _0x1ac9e7=function(_0x50892a){while(--_0x50892a){_0x4cc593['push'](_0x4cc593['shift']());}};_0x1ac9e7(++_0x82927);}(_0x9bde,0xe1));var _0xe9bd=function(_0x74b79c,_0x174ed0){_0x74b79c=_0x74b79c-0x0;var _0x554aab=_0x9bde[_0x74b79c];return _0x554aab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e8d3bf5..2c7b187 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 _0x0d85=['mail_applications','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','./mailApplication.attributes','exports','define'];(function(_0x103c41,_0x36c0b5){var _0x207214=function(_0x1cd206){while(--_0x1cd206){_0x103c41['push'](_0x103c41['shift']());}};_0x207214(++_0x36c0b5);}(_0x0d85,0x174));var _0x50d8=function(_0xd57a1d,_0x42c4cb){_0xd57a1d=_0xd57a1d-0x0;var _0x17163d=_0x0d85[_0xd57a1d];return _0x17163d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x50d8('0x0'));var moment=require(_0x50d8('0x1'));var BPromise=require(_0x50d8('0x2'));var rp=require(_0x50d8('0x3'));var fs=require('fs');var path=require(_0x50d8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x50d8('0x5'));module[_0x50d8('0x6')]=function(_0x4c7288,_0x8f4035){return _0x4c7288[_0x50d8('0x7')]('MailApplication',attributes,{'tableName':_0x50d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x50d8('0x9')});}; \ No newline at end of file +var _0xbb79=['api','moment','bluebird','path','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xbb79,0x1bd));var _0x9bb7=function(_0x508bfc,_0x38e908){_0x508bfc=_0x508bfc-0x0;var _0x13279b=_0xbb79[_0x508bfc];return _0x13279b;};'use strict';var _=require(_0x9bb7('0x0'));var util=require(_0x9bb7('0x1'));var logger=require(_0x9bb7('0x2'))(_0x9bb7('0x3'));var moment=require(_0x9bb7('0x4'));var BPromise=require(_0x9bb7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bb7('0x6'));var rimraf=require('rimraf');var config=require(_0x9bb7('0x7'));var attributes=require(_0x9bb7('0x8'));module[_0x9bb7('0x9')]=function(_0x438cb3,_0x7a59f6){return _0x438cb3['define'](_0x9bb7('0xa'),attributes,{'tableName':_0x9bb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bb7('0xc'),'collate':_0x9bb7('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ad21c95..263d8b7 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 _0x5117=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','where','attributes','limit','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_0x5117,0x188));var _0x7511=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x5117[_0x2d89ce];return _0x3fad10;};'use strict';var _=require('lodash');var util=require(_0x7511('0x0'));var moment=require('moment');var BPromise=require(_0x7511('0x1'));var rs=require(_0x7511('0x2'));var fs=require('fs');var Redis=require(_0x7511('0x3'));var db=require(_0x7511('0x4'))['db'];var utils=require(_0x7511('0x5'));var logger=require('../../config/logger')(_0x7511('0x6'));var config=require(_0x7511('0x7'));var jayson=require(_0x7511('0x8'));var client=jayson[_0x7511('0x9')][_0x7511('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385465,_0x36a07a,_0x922d81){return new BPromise(function(_0x5ddf6e,_0x26d79e){return client[_0x7511('0xb')](_0x385465,_0x922d81)[_0x7511('0xc')](function(_0x35324d){logger[_0x7511('0xd')](_0x7511('0xe'),_0x36a07a,_0x7511('0xf'));logger['debug'](_0x7511('0x10'),_0x36a07a,_0x7511('0xf'),JSON[_0x7511('0x11')](_0x35324d));if(_0x35324d['error']){if(_0x35324d[_0x7511('0x12')][_0x7511('0x13')]===0x1f4){logger[_0x7511('0x12')](_0x7511('0xe'),_0x36a07a,_0x35324d[_0x7511('0x12')][_0x7511('0x14')]);return _0x26d79e(_0x35324d[_0x7511('0x12')][_0x7511('0x14')]);}logger[_0x7511('0x12')](_0x7511('0xe'),_0x36a07a,_0x35324d['error'][_0x7511('0x14')]);return _0x5ddf6e(_0x35324d['error'][_0x7511('0x14')]);}else{logger[_0x7511('0xd')](_0x7511('0xe'),_0x36a07a,_0x7511('0xf'));_0x5ddf6e(_0x35324d[_0x7511('0x15')][_0x7511('0x14')]);}})[_0x7511('0x16')](function(_0x5b566d){logger[_0x7511('0x12')]('MailApplication,\x20%s,\x20%s',_0x36a07a,_0x5b566d);_0x26d79e(_0x5b566d);});});}exports[_0x7511('0x17')]=function(_0x6a7538){var _0x5001a6=this;return new Promise(function(_0x39e8c8,_0x5c3562){return db[_0x7511('0x18')][_0x7511('0x19')](_0x6a7538['body'],{'raw':_0x6a7538[_0x7511('0x1a')]?_0x6a7538[_0x7511('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a7538['options']?_0x6a7538[_0x7511('0x1a')][_0x7511('0x1b')]||null:null,'attributes':_0x6a7538['options']?_0x6a7538[_0x7511('0x1a')][_0x7511('0x1c')]||null:null,'limit':_0x6a7538['options']?_0x6a7538['options'][_0x7511('0x1d')]||null:null})[_0x7511('0xc')](function(_0x51133b){logger['info'](_0x7511('0x17'),_0x6a7538);logger[_0x7511('0x1e')](_0x7511('0x17'),_0x6a7538,JSON[_0x7511('0x11')](_0x51133b));_0x39e8c8(_0x51133b);})[_0x7511('0x16')](function(_0x2f5eb6){logger['error'](_0x7511('0x17'),_0x2f5eb6[_0x7511('0x14')],_0x6a7538);_0x5c3562(_0x5001a6[_0x7511('0x12')](0x1f4,_0x2f5eb6[_0x7511('0x14')]));});});}; \ No newline at end of file +var _0xa7a0=['message','result','catch','UpdateMailApplication','body','options','raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xa7a0,0x181));var _0x0a7a=function(_0x5684ec,_0x1cbdb6){_0x5684ec=_0x5684ec-0x0;var _0x1124d7=_0xa7a0[_0x5684ec];return _0x1124d7;};'use strict';var _=require('lodash');var util=require(_0x0a7a('0x0'));var moment=require(_0x0a7a('0x1'));var BPromise=require(_0x0a7a('0x2'));var rs=require(_0x0a7a('0x3'));var fs=require('fs');var Redis=require(_0x0a7a('0x4'));var db=require(_0x0a7a('0x5'))['db'];var utils=require(_0x0a7a('0x6'));var logger=require(_0x0a7a('0x7'))(_0x0a7a('0x8'));var config=require(_0x0a7a('0x9'));var jayson=require(_0x0a7a('0xa'));var client=jayson[_0x0a7a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e532d,_0x588f4a,_0x524eac){return new BPromise(function(_0x416bdc,_0x5343a9){return client[_0x0a7a('0xc')](_0x4e532d,_0x524eac)[_0x0a7a('0xd')](function(_0x376bb0){logger['info']('MailApplication,\x20%s,\x20%s',_0x588f4a,'request\x20sent');logger[_0x0a7a('0xe')](_0x0a7a('0xf'),_0x588f4a,_0x0a7a('0x10'),JSON[_0x0a7a('0x11')](_0x376bb0));if(_0x376bb0[_0x0a7a('0x12')]){if(_0x376bb0['error'][_0x0a7a('0x13')]===0x1f4){logger['error'](_0x0a7a('0x14'),_0x588f4a,_0x376bb0['error'][_0x0a7a('0x15')]);return _0x5343a9(_0x376bb0[_0x0a7a('0x12')][_0x0a7a('0x15')]);}logger['error'](_0x0a7a('0x14'),_0x588f4a,_0x376bb0[_0x0a7a('0x12')][_0x0a7a('0x15')]);return _0x416bdc(_0x376bb0['error'][_0x0a7a('0x15')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x588f4a,_0x0a7a('0x10'));_0x416bdc(_0x376bb0[_0x0a7a('0x16')][_0x0a7a('0x15')]);}})[_0x0a7a('0x17')](function(_0x4b5cba){logger[_0x0a7a('0x12')]('MailApplication,\x20%s,\x20%s',_0x588f4a,_0x4b5cba);_0x5343a9(_0x4b5cba);});});}exports[_0x0a7a('0x18')]=function(_0xd91b33){var _0x5a631b=this;return new Promise(function(_0x4edc93,_0x294aa0){return db['MailApplication']['update'](_0xd91b33[_0x0a7a('0x19')],{'raw':_0xd91b33[_0x0a7a('0x1a')]?_0xd91b33[_0x0a7a('0x1a')][_0x0a7a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd91b33['options']?_0xd91b33[_0x0a7a('0x1a')][_0x0a7a('0x1c')]||null:null,'attributes':_0xd91b33[_0x0a7a('0x1a')]?_0xd91b33[_0x0a7a('0x1a')]['attributes']||null:null,'limit':_0xd91b33[_0x0a7a('0x1a')]?_0xd91b33[_0x0a7a('0x1a')]['limit']||null:null})['then'](function(_0x303797){logger['info'](_0x0a7a('0x18'),_0xd91b33);logger[_0x0a7a('0xe')](_0x0a7a('0x18'),_0xd91b33,JSON['stringify'](_0x303797));_0x4edc93(_0x303797);})[_0x0a7a('0x17')](function(_0x125e80){logger[_0x0a7a('0x12')]('UpdateMailApplication',_0x125e80[_0x0a7a('0x15')],_0xd91b33);_0x294aa0(_0x5a631b['error'](0x1f4,_0x125e80['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bdcbda2..a44cb98 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 _0x7381=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x7381,0xc5));var _0x1738=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x7381[_0x4521e3];return _0x46a272;};'use strict';var express=require('express');var router=express[_0x1738('0x0')]();var auth=require(_0x1738('0x1'));var interaction=require(_0x1738('0x2'));var controller=require(_0x1738('0x3'));router[_0x1738('0x4')]('/',auth[_0x1738('0x5')](),controller[_0x1738('0x6')]);router[_0x1738('0x4')](_0x1738('0x7'),auth[_0x1738('0x5')](),controller[_0x1738('0x8')]);router['get'](_0x1738('0x9'),auth[_0x1738('0x5')](),controller[_0x1738('0xa')]);router[_0x1738('0x4')](_0x1738('0xb'),auth[_0x1738('0x5')](),controller['getMessages']);router[_0x1738('0x4')](_0x1738('0xc'),auth[_0x1738('0x5')](),controller[_0x1738('0xd')]);router[_0x1738('0xe')]('/',auth[_0x1738('0x5')](),controller[_0x1738('0xf')]);router['post'](_0x1738('0xb'),auth['isAuthenticated'](),controller[_0x1738('0x10')]);router[_0x1738('0xe')](_0x1738('0x11'),auth[_0x1738('0x5')](),interaction[_0x1738('0x12')](_0x1738('0x13'),_0x1738('0x14')),controller[_0x1738('0x15')]);router[_0x1738('0x16')](_0x1738('0x9'),auth[_0x1738('0x5')](),interaction[_0x1738('0x12')]('mail',_0x1738('0x17')),controller[_0x1738('0x18')]);router[_0x1738('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x1738('0x13'),_0x1738('0x1a')),controller[_0x1738('0x1b')]);router[_0x1738('0x19')](_0x1738('0x11'),auth[_0x1738('0x5')](),controller[_0x1738('0x1c')]);module[_0x1738('0x1d')]=router; \ No newline at end of file +var _0xbdac=['mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xbdac,0xe7));var _0xcbda=function(_0x36fa8b,_0x49d40c){_0x36fa8b=_0x36fa8b-0x0;var _0xb47ad6=_0xbdac[_0x36fa8b];return _0xb47ad6;};'use strict';var express=require(_0xcbda('0x0'));var router=express[_0xcbda('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xcbda('0x2'));var controller=require(_0xcbda('0x3'));router[_0xcbda('0x4')]('/',auth[_0xcbda('0x5')](),controller[_0xcbda('0x6')]);router['get'](_0xcbda('0x7'),auth[_0xcbda('0x5')](),controller[_0xcbda('0x8')]);router[_0xcbda('0x4')](_0xcbda('0x9'),auth['isAuthenticated'](),controller[_0xcbda('0xa')]);router['get']('/:id/messages',auth[_0xcbda('0x5')](),controller[_0xcbda('0xb')]);router[_0xcbda('0x4')]('/:id/download',auth[_0xcbda('0x5')](),controller[_0xcbda('0xc')]);router[_0xcbda('0xd')]('/',auth[_0xcbda('0x5')](),controller['create']);router[_0xcbda('0xd')](_0xcbda('0xe'),auth[_0xcbda('0x5')](),controller[_0xcbda('0xf')]);router[_0xcbda('0xd')](_0xcbda('0x10'),auth['isAuthenticated'](),interaction[_0xcbda('0x11')](_0xcbda('0x12'),_0xcbda('0x13')),controller['addTags']);router[_0xcbda('0x14')](_0xcbda('0x9'),auth[_0xcbda('0x5')](),interaction['tracked'](_0xcbda('0x12'),_0xcbda('0x15')),controller[_0xcbda('0x16')]);router[_0xcbda('0x17')](_0xcbda('0x9'),auth[_0xcbda('0x5')](),interaction[_0xcbda('0x11')](_0xcbda('0x12'),_0xcbda('0x18')),controller[_0xcbda('0x19')]);router['delete'](_0xcbda('0x10'),auth['isAuthenticated'](),controller[_0xcbda('0x1a')]);module[_0xcbda('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9554134..d42e820 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 _0xa5c0=['iconv','exports','DATE','STRING','TEXT','ENUM','out','sequelize'];(function(_0x3f3bff,_0x2cbf1f){var _0x472f29=function(_0x2d8ae4){while(--_0x2d8ae4){_0x3f3bff['push'](_0x3f3bff['shift']());}};_0x472f29(++_0x2cbf1f);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a5c('0x0'));var iconv=require(_0x0a5c('0x1'));module[_0x0a5c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0a5c('0x3')]},'disposition':{'type':Sequelize[_0x0a5c('0x4')]},'secondDisposition':{'type':Sequelize[_0x0a5c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0a5c('0x4')]},'note':{'type':Sequelize[_0x0a5c('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x0a5c('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x0a5c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0a5c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0a5c('0x6')]('in',_0x0a5c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0a5c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0a5c('0x6')]('in',_0x0a5c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xad1a=['STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x23733d,_0x56f0a1){var _0x4a9cc4=function(_0x26f9ab){while(--_0x26f9ab){_0x23733d['push'](_0x23733d['shift']());}};_0x4a9cc4(++_0x56f0a1);}(_0xad1a,0xff));var _0xaad1=function(_0x2e33f8,_0x224db5){_0x2e33f8=_0x2e33f8-0x0;var _0x131152=_0xad1a[_0x2e33f8];return _0x131152;};'use strict';var Sequelize=require(_0xaad1('0x0'));var iconv=require(_0xaad1('0x1'));module[_0xaad1('0x2')]={'closed':{'type':Sequelize[_0xaad1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaad1('0x4')]},'disposition':{'type':Sequelize[_0xaad1('0x5')]},'secondDisposition':{'type':Sequelize[_0xaad1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xaad1('0x5')]},'note':{'type':Sequelize[_0xaad1('0x5')]},'inReplyTo':{'type':Sequelize[_0xaad1('0x5')](0x1fe)},'to':{'type':Sequelize[_0xaad1('0x5')]},'cc':{'type':Sequelize[_0xaad1('0x6')](_0xaad1('0x7'))},'subject':{'type':Sequelize[_0xaad1('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xaad1('0x4')]},'substatus':{'type':Sequelize[_0xaad1('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xaad1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xaad1('0x8')]('in',_0xaad1('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaad1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaad1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3b677f9..3673bf3 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 _0xb85a=['include','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','length','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','push','Attachment','Attachments','Messages','bcc','createdAt','mkdirSync','each','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','attachments','readFileSync','build','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','getOptions','findAll','query','user','catch','params','MailInteraction','keys','filters','intersection','attributes','model','fields','includeAll'];(function(_0x18b518,_0x22e1ff){var _0x1356c5=function(_0x511d60){while(--_0x511d60){_0x18b518['push'](_0x18b518['shift']());}};_0x1356c5(++_0x22e1ff);}(_0xb85a,0xb0));var _0xab85=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0xb85a[_0x673ea4];return _0x3e5938;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab85('0x0'));var zipdir=require(_0xab85('0x1'));var moment=require(_0xab85('0x2'));var BPromise=require(_0xab85('0x3'));var util=require(_0xab85('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0xab85('0x5'));var Redis=require(_0xab85('0x6'));var interaction=require(_0xab85('0x7'));var qs=require(_0xab85('0x8'));var logger=require(_0xab85('0x9'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xab85('0xa'));config[_0xab85('0xb')]=_[_0xab85('0xc')](config[_0xab85('0xb')],{'host':_0xab85('0xd'),'port':0x18eb});var socket=require(_0xab85('0xe'))(new Redis(config[_0xab85('0xb')]));require(_0xab85('0xf'))['register'](socket);function respondWithStatusCode(_0x1a6019,_0x40bd96){_0x40bd96=_0x40bd96||0xcc;return function(_0x55ec9e){if(_0x55ec9e){return _0x1a6019[_0xab85('0x10')](_0x40bd96);}return _0x1a6019[_0xab85('0x11')](_0x40bd96)[_0xab85('0x12')]();};}function respondWithResult(_0x15e1a8,_0x20cf86){_0x20cf86=_0x20cf86||0xc8;return function(_0x4133d2){if(_0x4133d2){return _0x15e1a8['status'](_0x20cf86)[_0xab85('0x13')](_0x4133d2);}};}function respondWithFilteredResult(_0xe47ee0,_0x32271f){return function(_0x537a3e){if(_0x537a3e){var _0x349d44=typeof _0x32271f['offset']==='undefined'&&typeof _0x32271f[_0xab85('0x14')]===_0xab85('0x15');var _0x3e9719=_0x537a3e[_0xab85('0x16')];var _0x5b2018=_0x349d44?0x0:_0x32271f[_0xab85('0x17')];var _0x19cb09=_0x349d44?_0x537a3e[_0xab85('0x16')]:_0x32271f[_0xab85('0x17')]+_0x32271f['limit'];var _0x25ef05;if(_0x19cb09>=_0x3e9719){_0x19cb09=_0x3e9719;_0x25ef05=0xc8;}else{_0x25ef05=0xce;}_0xe47ee0[_0xab85('0x11')](_0x25ef05);return _0xe47ee0[_0xab85('0x18')](_0xab85('0x19'),_0x5b2018+'-'+_0x19cb09+'/'+_0x3e9719)['json'](_0x537a3e);}return null;};}function saveUpdates(_0x821be4){return function(_0x41192f){if(_0x41192f){return _0x41192f[_0xab85('0x1a')](_0x821be4)[_0xab85('0x1b')](function(_0x3d529a){return _0x3d529a;});}return null;};}function removeEntity(_0x4f2fa1){return function(_0x367862){if(_0x367862){return _0x367862[_0xab85('0x1c')]()['then'](function(){_0x4f2fa1[_0xab85('0x11')](0xcc)[_0xab85('0x12')]();});}};}function handleEntityNotFound(_0x1ad9f1){return function(_0x1e392d){if(!_0x1e392d){_0x1ad9f1[_0xab85('0x10')](0x194);}return _0x1e392d;};}function handleError(_0x442730,_0x163f76){_0x163f76=_0x163f76||0x1f4;return function(_0x3c2bc2){logger[_0xab85('0x1d')](_0x3c2bc2[_0xab85('0x1e')]);if(_0x3c2bc2[_0xab85('0x1f')]){delete _0x3c2bc2[_0xab85('0x1f')];}_0x442730[_0xab85('0x11')](_0x163f76)[_0xab85('0x20')](_0x3c2bc2);};}exports[_0xab85('0x21')]=function(_0x47bdcb,_0xbbd169){var _0xd6637c={};var _0x3e6d79=_[_0xab85('0x22')](db['MailInteraction'][_0xab85('0x23')],function(_0x40dfde){return{'name':_0x40dfde['fieldName'],'type':_0x40dfde[_0xab85('0x24')][_0xab85('0x25')]};});_0xd6637c=qs[_0xab85('0x26')](_0x3e6d79,_0x47bdcb);return interaction[_0xab85('0x27')]('mail',_0x47bdcb[_0xab85('0x28')],_0x47bdcb[_0xab85('0x29')],_0xd6637c,_0x3e6d79)[_0xab85('0x1b')](respondWithFilteredResult(_0xbbd169,_0xd6637c))[_0xab85('0x2a')](handleError(_0xbbd169,null));};exports['show']=function(_0x2c2582,_0x364cb7){var _0x317558={'raw':![],'where':{'id':_0x2c2582[_0xab85('0x2b')]['id']}},_0x5581de={};_0x5581de['model']=_['keys'](db[_0xab85('0x2c')][_0xab85('0x23')]);_0x5581de['query']=_[_0xab85('0x2d')](_0x2c2582[_0xab85('0x28')]);_0x5581de[_0xab85('0x2e')]=_[_0xab85('0x2f')](_0x5581de['model'],_0x5581de[_0xab85('0x28')]);_0x317558[_0xab85('0x30')]=_[_0xab85('0x2f')](_0x5581de[_0xab85('0x31')],qs[_0xab85('0x32')](_0x2c2582['query'][_0xab85('0x32')]));_0x317558['attributes']=_0x317558[_0xab85('0x30')]['length']?_0x317558[_0xab85('0x30')]:_0x5581de[_0xab85('0x31')];if(_0x2c2582[_0xab85('0x28')][_0xab85('0x33')]){_0x317558[_0xab85('0x34')]=[{'all':!![]}];}_0x317558=_['merge']({},_0x317558,_0x2c2582['options']);return db[_0xab85('0x2c')][_0xab85('0x35')](_0x317558)['then'](handleEntityNotFound(_0x364cb7,null))[_0xab85('0x1b')](respondWithResult(_0x364cb7,null))[_0xab85('0x2a')](handleError(_0x364cb7,null));};exports[_0xab85('0x36')]=function(_0x3f04c2,_0x5d3b1a){return db[_0xab85('0x2c')][_0xab85('0x36')](_0x3f04c2[_0xab85('0x37')],{})[_0xab85('0x1b')](respondWithResult(_0x5d3b1a,0xc9))[_0xab85('0x2a')](handleError(_0x5d3b1a,null));};exports['update']=function(_0x190ec9,_0x2aa391){if(_0x190ec9[_0xab85('0x37')]['id']){delete _0x190ec9[_0xab85('0x37')]['id'];}return db[_0xab85('0x2c')]['find']({'where':{'id':_0x190ec9[_0xab85('0x2b')]['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x2aa391,null))[_0xab85('0x1b')](saveUpdates(_0x190ec9['body'],null))[_0xab85('0x1b')](respondWithResult(_0x2aa391,null))[_0xab85('0x2a')](handleError(_0x2aa391,null));};exports[_0xab85('0x1c')]=function(_0x1917e5,_0x4f1257){return db[_0xab85('0x2c')][_0xab85('0x35')]({'where':{'id':_0x1917e5[_0xab85('0x2b')]['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x4f1257,null))[_0xab85('0x1b')](removeEntity(_0x4f1257,null))[_0xab85('0x2a')](handleError(_0x4f1257,null));};exports[_0xab85('0x38')]=function(_0x2ab2e9,_0x2efb0d){return db[_0xab85('0x2c')][_0xab85('0x38')]()[_0xab85('0x1b')](respondWithResult(_0x2efb0d,null))[_0xab85('0x2a')](handleError(_0x2efb0d,null));};exports[_0xab85('0x39')]=function(_0x47751f,_0x1bf271){return db['MailMessage']['find']({'where':{'id':_0x47751f[_0xab85('0x2b')]['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x1bf271,null))[_0xab85('0x1b')](function(_0x25682f){if(_0x25682f){return _0x25682f[_0xab85('0x39')](_0x47751f[_0xab85('0x37')]['ids'],_[_0xab85('0x3a')](_0x47751f[_0xab85('0x37')],[_0xab85('0x3b'),'id'])||{});}})[_0xab85('0x1b')](respondWithResult(_0x1bf271,null))['catch'](handleError(_0x1bf271,null));};exports[_0xab85('0x3c')]=function(_0x4bfb7c,_0x39a97d){var _0x47aef={'raw':![],'where':{}};var _0x14c5b4={};var _0x2a902e={'count':0x0,'rows':[]};return db['MailInteraction'][_0xab85('0x3d')]({'where':{'id':_0x4bfb7c['params']['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x39a97d,null))[_0xab85('0x1b')](function(_0x485a41){if(_0x485a41){_0x14c5b4[_0xab85('0x31')]=_[_0xab85('0x2d')](db[_0xab85('0x3e')][_0xab85('0x23')]);_0x14c5b4[_0xab85('0x28')]=_[_0xab85('0x2d')](_0x4bfb7c[_0xab85('0x28')]);_0x14c5b4[_0xab85('0x2e')]=_['intersection'](_0x14c5b4[_0xab85('0x31')],_0x14c5b4[_0xab85('0x28')]);_0x47aef[_0xab85('0x30')]=_[_0xab85('0x2f')](_0x14c5b4[_0xab85('0x31')],qs[_0xab85('0x32')](_0x4bfb7c[_0xab85('0x28')][_0xab85('0x32')]));_0x47aef[_0xab85('0x30')]=_0x47aef[_0xab85('0x30')]['length']?_0x47aef[_0xab85('0x30')]:_0x14c5b4[_0xab85('0x31')];if(!_0x4bfb7c[_0xab85('0x28')][_0xab85('0x3f')](_0xab85('0x40'))){_0x47aef['limit']=qs[_0xab85('0x14')](_0x4bfb7c[_0xab85('0x28')][_0xab85('0x14')]);_0x47aef[_0xab85('0x17')]=qs[_0xab85('0x17')](_0x4bfb7c[_0xab85('0x28')][_0xab85('0x17')]);}_0x47aef[_0xab85('0x41')]=qs['sort'](_0x4bfb7c['query'][_0xab85('0x42')]);_0x47aef[_0xab85('0x43')]=qs['filters'](_[_0xab85('0x44')](_0x4bfb7c['query'],_0x14c5b4[_0xab85('0x2e')]));_0x47aef[_0xab85('0x43')][_0xab85('0x45')]=_0x485a41['id'];if(_0x4bfb7c['query'][_0xab85('0x46')]){_0x47aef[_0xab85('0x43')]=_[_0xab85('0x47')](_0x47aef[_0xab85('0x43')],{'$or':_[_0xab85('0x22')](_0x47aef['attributes'],function(_0x334ce8){var _0x591bd4={};_0x591bd4[_0x334ce8]={'$like':'%'+_0x4bfb7c[_0xab85('0x28')][_0xab85('0x46')]+'%'};return _0x591bd4;})});}if(_0x4bfb7c['query'][_0xab85('0x48')]){var _0x5411cb=_0x4bfb7c[_0xab85('0x28')][_0xab85('0x48')][_0xab85('0x49')](',');var _0x5417b8={};_0x5417b8[_0x5411cb[0x0]]={'$gte':moment(_0x5411cb[0x1])[_0xab85('0x4a')](_0xab85('0x4b'))};_0x47aef[_0xab85('0x43')]=_[_0xab85('0x47')](_0x47aef[_0xab85('0x43')],_0x5417b8);}_0x47aef=_[_0xab85('0x47')]({},_0x47aef,_0x4bfb7c[_0xab85('0x4c')]);return db['MailMessage'][_0xab85('0x16')]({'where':_0x47aef[_0xab85('0x43')]})[_0xab85('0x1b')](function(_0x5e5a76){_0x2a902e[_0xab85('0x16')]=_0x5e5a76;if(_0x4bfb7c[_0xab85('0x28')][_0xab85('0x33')]){_0x47aef[_0xab85('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0xab85('0x27')](_0x47aef);})['then'](function(_0x3dd365){if(_0x4bfb7c[_0xab85('0x28')][_0xab85('0x4d')]===_0xab85('0x4e')){for(var _0x135974=0x0;_0x135974<_0x3dd365[_0xab85('0x4f')];_0x135974++){_0x3dd365[_0x135974]['body']=juice(_0x3dd365[_0x135974]['body']);}}_0x2a902e['rows']=_0x3dd365;return _0x2a902e;});}})[_0xab85('0x1b')](respondWithFilteredResult(_0x39a97d,_0x47aef))[_0xab85('0x2a')](handleError(_0x39a97d,null));};exports[_0xab85('0x50')]=function(_0x2f961d,_0x4264d1){return db[_0xab85('0x2c')][_0xab85('0x35')]({'where':{'id':_0x2f961d[_0xab85('0x2b')]['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x4264d1,null))[_0xab85('0x1b')](function(_0x39b6f0){if(_0x39b6f0){return _0x39b6f0[_0xab85('0x51')](_0x2f961d[_0xab85('0x37')][_0xab85('0x3b')],_['omit'](_0x2f961d[_0xab85('0x37')],['ids','id'])||{})[_0xab85('0x52')](function(){return db[_0xab85('0x53')][_0xab85('0x27')]({'attributes':['id',_0xab85('0x1f'),_0xab85('0x54')],'where':{'id':_0x2f961d[_0xab85('0x37')][_0xab85('0x3b')]}});})['then'](function(_0x409192){socket['emit'](_0xab85('0x55'),{'id':Number(_0x2f961d[_0xab85('0x2b')]['id']),'tags':_0x409192||[]});return{'id':Number(_0x2f961d['params']['id']),'tags':_0x409192||[]};});}})['then'](respondWithResult(_0x4264d1,null))[_0xab85('0x2a')](handleError(_0x4264d1,null));};exports[_0xab85('0x56')]=function(_0x662972,_0x398ffa){return db[_0xab85('0x2c')][_0xab85('0x35')]({'where':{'id':_0x662972[_0xab85('0x2b')]['id']}})[_0xab85('0x1b')](handleEntityNotFound(_0x398ffa,null))[_0xab85('0x1b')](function(_0x3ac8ea){if(_0x3ac8ea){return _0x3ac8ea[_0xab85('0x56')](_0x662972[_0xab85('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x398ffa,null))['catch'](handleError(_0x398ffa,null));};exports[_0xab85('0x57')]=function(_0x1fb21d,_0xb29d57){var _0x5ea0e8=moment()[_0xab85('0x58')]()[_0xab85('0x59')]();var _0x10a141=path[_0xab85('0x5a')](config[_0xab85('0x5b')],_0xab85('0x5c'),_0xab85('0x5d'),'tmp');var _0x5202a4=path[_0xab85('0x5a')](config[_0xab85('0x5b')],_0xab85('0x5c'),_0xab85('0x5d'),'attachments');var _0x157e2f=path[_0xab85('0x5a')](_0x10a141,_0x5ea0e8);var _0x3adb54=util[_0xab85('0x4a')]('transcript-%d-%s.zip',_0x1fb21d[_0xab85('0x2b')]['id'],_0x5ea0e8);var _0x11d139=path[_0xab85('0x5a')](_0x10a141,_0x3adb54);var _0x2329e6=[];if(_0x1fb21d['query']['attachments']){_0x2329e6[_0xab85('0x5e')]({'model':db[_0xab85('0x5f')],'as':_0xab85('0x60'),'raw':!![]});}var _0x4363cf=[{'model':db[_0xab85('0x3e')],'as':_0xab85('0x61'),'attributes':['id','body','from','to','cc',_0xab85('0x62'),'subject',_0xab85('0x63')],'where':{'secret':![]},'order':qs[_0xab85('0x42')]('id'),'include':_0x2329e6}];return db[_0xab85('0x2c')][_0xab85('0x35')]({'where':{'id':_0x1fb21d['params']['id']},'include':_0x4363cf})[_0xab85('0x1b')](handleEntityNotFound(_0xb29d57,null))[_0xab85('0x1b')](function(_0x11e47f){if(_0x11e47f&&_0x11e47f[_0xab85('0x61')]){var _0x11ca1e=_0x11e47f['get']({'plain':!![]});fs[_0xab85('0x64')](_0x157e2f);return BPromise[_0xab85('0x65')](_0x11ca1e[_0xab85('0x61')],function(_0x3ffa1b,_0x1aed0c){var _0x60fd={'from':_0x3ffa1b[_0xab85('0x66')],'to':_0x3ffa1b['to'],'subject':_0x3ffa1b[_0xab85('0x67')],'html':htmlEntities[_0xab85('0x68')](_0x3ffa1b[_0xab85('0x37')]),'headers':{'Date':moment(_0x3ffa1b['createdAt'])[_0xab85('0x4a')](_0xab85('0x69'))},'attachments':[]};if(_0x3ffa1b['cc']){_0x60fd[_0xab85('0x6a')]['Cc']=_0x3ffa1b['cc'];}if(_0x3ffa1b['bcc']){_0x60fd[_0xab85('0x6a')]['Bcc']=_0x3ffa1b[_0xab85('0x62')];}return new BPromise(function(_0x39cb56,_0x48a14b){if(_0x3ffa1b[_0xab85('0x60')]){for(var _0x1680b3=0x0;_0x1680b3<_0x3ffa1b[_0xab85('0x60')][_0xab85('0x4f')];_0x1680b3++){var _0x4e9f08=_0x3ffa1b['Attachments'][_0x1680b3];var _0x5baa8b=path['join'](_0x5202a4,_0x4e9f08[_0xab85('0x6b')]);if(fs[_0xab85('0x6c')](_0x5baa8b)){_0x60fd[_0xab85('0x6d')][_0xab85('0x5e')]({'name':_0x4e9f08['name'],'contentType':_0x4e9f08['type'],'data':fs[_0xab85('0x6e')](_0x5baa8b)});}}}emlformat[_0xab85('0x6f')](_0x60fd,function(_0xc943a9,_0x3e3c6e){if(_0xc943a9)return _0x48a14b(_0xc943a9);fs['writeFileSync'](path['join'](_0x157e2f,util['format'](_0xab85('0x70'),_0x1aed0c)),_0x3e3c6e);return _0x39cb56(_0x3e3c6e);});});})[_0xab85('0x1b')](function(){return new BPromise(function(_0x3b4441,_0x5be296){zipdir(_0x157e2f,{'saveTo':_0x11d139},function(_0x4baa86,_0x31659d){if(_0x4baa86)return _0x5be296(_0x4baa86);return _0x3b4441(_0x31659d);});})[_0xab85('0x1b')](function(){return new BPromise(function(_0xecdece,_0x1ff819){rimraf(_0x157e2f,function(_0x1c0d5a){if(_0x1c0d5a)_0x1ff819(_0x1c0d5a);return _0xecdece();});});})['then'](function(){return _0xb29d57[_0xab85('0x57')](_0x11d139,_0x3adb54,function(_0x352cb1){if(!_0x352cb1)fs[_0xab85('0x71')](_0x11d139);});});});}else{return _0xb29d57[_0xab85('0x10')](0xc8);}})[_0xab85('0x2a')](handleError(_0xb29d57,null));}; \ No newline at end of file +var _0xba0b=['sort','pick','where','MailInteractionId','filter','$gte','split','format','inlineCss','true','rows','addTags','setTags','ids','Tag','color','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','unlinkSync','sendStatus','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','MailInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','MailMessage','omit','getMessages','findOne','order'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xba0b,0x110));var _0xbba0=function(_0x92b5d4,_0x4f4be7){_0x92b5d4=_0x92b5d4-0x0;var _0x387f95=_0xba0b[_0x92b5d4];return _0x387f95;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xbba0('0x0'));var BPromise=require(_0xbba0('0x1'));var util=require(_0xbba0('0x2'));var path=require(_0xbba0('0x3'));var fs=require('fs');var _=require('lodash');var juice=require(_0xbba0('0x4'));var Redis=require(_0xbba0('0x5'));var interaction=require(_0xbba0('0x6'));var qs=require(_0xbba0('0x7'));var logger=require(_0xbba0('0x8'))('api');var config=require(_0xbba0('0x9'));var db=require(_0xbba0('0xa'))['db'];var htmlEntities=require(_0xbba0('0xb'));config['redis']=_[_0xbba0('0xc')](config[_0xbba0('0xd')],{'host':_0xbba0('0xe'),'port':0x18eb});var socket=require(_0xbba0('0xf'))(new Redis(config[_0xbba0('0xd')]));require(_0xbba0('0x10'))[_0xbba0('0x11')](socket);function respondWithStatusCode(_0x326ed3,_0x51cc80){_0x51cc80=_0x51cc80||0xcc;return function(_0x1f2f97){if(_0x1f2f97){return _0x326ed3['sendStatus'](_0x51cc80);}return _0x326ed3[_0xbba0('0x12')](_0x51cc80)[_0xbba0('0x13')]();};}function respondWithResult(_0x336772,_0x7c3583){_0x7c3583=_0x7c3583||0xc8;return function(_0x355c05){if(_0x355c05){return _0x336772[_0xbba0('0x12')](_0x7c3583)[_0xbba0('0x14')](_0x355c05);}};}function respondWithFilteredResult(_0x4ead37,_0x211e23){return function(_0x471c96){if(_0x471c96){var _0x35b772=typeof _0x211e23[_0xbba0('0x15')]===_0xbba0('0x16')&&typeof _0x211e23['limit']==='undefined';var _0x3c7706=_0x471c96['count'];var _0x54a09d=_0x35b772?0x0:_0x211e23['offset'];var _0x3503c8=_0x35b772?_0x471c96[_0xbba0('0x17')]:_0x211e23[_0xbba0('0x15')]+_0x211e23[_0xbba0('0x18')];var _0x226b40;if(_0x3503c8>=_0x3c7706){_0x3503c8=_0x3c7706;_0x226b40=0xc8;}else{_0x226b40=0xce;}_0x4ead37[_0xbba0('0x12')](_0x226b40);return _0x4ead37[_0xbba0('0x19')](_0xbba0('0x1a'),_0x54a09d+'-'+_0x3503c8+'/'+_0x3c7706)[_0xbba0('0x14')](_0x471c96);}return null;};}function saveUpdates(_0x14b967){return function(_0x4f9369){if(_0x4f9369){return _0x4f9369[_0xbba0('0x1b')](_0x14b967)[_0xbba0('0x1c')](function(_0x70d3eb){return _0x70d3eb;});}return null;};}function removeEntity(_0x4ffe14){return function(_0x28b8f5){if(_0x28b8f5){return _0x28b8f5[_0xbba0('0x1d')]()[_0xbba0('0x1c')](function(){_0x4ffe14[_0xbba0('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aeaa1){return function(_0x4166b5){if(!_0x4166b5){_0x3aeaa1['sendStatus'](0x194);}return _0x4166b5;};}function handleError(_0x293efb,_0x2b2eb5){_0x2b2eb5=_0x2b2eb5||0x1f4;return function(_0xa3f528){logger[_0xbba0('0x1e')](_0xa3f528[_0xbba0('0x1f')]);if(_0xa3f528[_0xbba0('0x20')]){delete _0xa3f528['name'];}_0x293efb['status'](_0x2b2eb5)[_0xbba0('0x21')](_0xa3f528);};}exports[_0xbba0('0x22')]=function(_0x20b1d1,_0x4178ee){var _0x55a4d8={};var _0x5033cb=_[_0xbba0('0x23')](db['MailInteraction'][_0xbba0('0x24')],function(_0x381a9f){return{'name':_0x381a9f['fieldName'],'type':_0x381a9f['type'][_0xbba0('0x25')]};});_0x55a4d8=qs[_0xbba0('0x26')](_0x5033cb,_0x20b1d1);return interaction[_0xbba0('0x27')](_0xbba0('0x28'),_0x20b1d1[_0xbba0('0x29')],_0x20b1d1[_0xbba0('0x2a')],_0x55a4d8,_0x5033cb)[_0xbba0('0x1c')](respondWithFilteredResult(_0x4178ee,_0x55a4d8))[_0xbba0('0x2b')](handleError(_0x4178ee,null));};exports[_0xbba0('0x2c')]=function(_0x5c0b82,_0x33f445){var _0x4552dd={'raw':![],'where':{'id':_0x5c0b82[_0xbba0('0x2d')]['id']}},_0x2e4af9={};_0x2e4af9[_0xbba0('0x2e')]=_[_0xbba0('0x2f')](db[_0xbba0('0x30')]['rawAttributes']);_0x2e4af9[_0xbba0('0x29')]=_[_0xbba0('0x2f')](_0x5c0b82[_0xbba0('0x29')]);_0x2e4af9[_0xbba0('0x31')]=_[_0xbba0('0x32')](_0x2e4af9[_0xbba0('0x2e')],_0x2e4af9['query']);_0x4552dd[_0xbba0('0x33')]=_[_0xbba0('0x32')](_0x2e4af9[_0xbba0('0x2e')],qs[_0xbba0('0x34')](_0x5c0b82[_0xbba0('0x29')][_0xbba0('0x34')]));_0x4552dd[_0xbba0('0x33')]=_0x4552dd[_0xbba0('0x33')][_0xbba0('0x35')]?_0x4552dd['attributes']:_0x2e4af9['model'];if(_0x5c0b82[_0xbba0('0x29')][_0xbba0('0x36')]){_0x4552dd[_0xbba0('0x37')]=[{'all':!![]}];}_0x4552dd=_[_0xbba0('0x38')]({},_0x4552dd,_0x5c0b82[_0xbba0('0x39')]);return db[_0xbba0('0x30')][_0xbba0('0x3a')](_0x4552dd)[_0xbba0('0x1c')](handleEntityNotFound(_0x33f445,null))[_0xbba0('0x1c')](respondWithResult(_0x33f445,null))['catch'](handleError(_0x33f445,null));};exports['create']=function(_0x3b638d,_0x2517af){return db[_0xbba0('0x30')]['create'](_0x3b638d['body'],{})[_0xbba0('0x1c')](respondWithResult(_0x2517af,0xc9))[_0xbba0('0x2b')](handleError(_0x2517af,null));};exports[_0xbba0('0x1b')]=function(_0xc881cb,_0xf61ef){if(_0xc881cb[_0xbba0('0x3b')]['id']){delete _0xc881cb['body']['id'];}return db[_0xbba0('0x30')][_0xbba0('0x3a')]({'where':{'id':_0xc881cb[_0xbba0('0x2d')]['id']}})[_0xbba0('0x1c')](handleEntityNotFound(_0xf61ef,null))[_0xbba0('0x1c')](saveUpdates(_0xc881cb['body'],null))[_0xbba0('0x1c')](respondWithResult(_0xf61ef,null))[_0xbba0('0x2b')](handleError(_0xf61ef,null));};exports['destroy']=function(_0x336aba,_0x528ddf){return db[_0xbba0('0x30')]['find']({'where':{'id':_0x336aba[_0xbba0('0x2d')]['id']}})[_0xbba0('0x1c')](handleEntityNotFound(_0x528ddf,null))['then'](removeEntity(_0x528ddf,null))['catch'](handleError(_0x528ddf,null));};exports[_0xbba0('0x3c')]=function(_0x180231,_0x19cfe7){return db[_0xbba0('0x30')]['describe']()[_0xbba0('0x1c')](respondWithResult(_0x19cfe7,null))[_0xbba0('0x2b')](handleError(_0x19cfe7,null));};exports[_0xbba0('0x3d')]=function(_0x4873c3,_0x48f39c){return db[_0xbba0('0x3e')]['find']({'where':{'id':_0x4873c3[_0xbba0('0x2d')]['id']}})[_0xbba0('0x1c')](handleEntityNotFound(_0x48f39c,null))['then'](function(_0x496077){if(_0x496077){return _0x496077[_0xbba0('0x3d')](_0x4873c3[_0xbba0('0x3b')]['ids'],_[_0xbba0('0x3f')](_0x4873c3['body'],['ids','id'])||{});}})[_0xbba0('0x1c')](respondWithResult(_0x48f39c,null))[_0xbba0('0x2b')](handleError(_0x48f39c,null));};exports[_0xbba0('0x40')]=function(_0xa1a9cd,_0x298cdf){var _0x3b3266={'raw':![],'where':{}};var _0x2f2378={};var _0x643f6f={'count':0x0,'rows':[]};return db[_0xbba0('0x30')][_0xbba0('0x41')]({'where':{'id':_0xa1a9cd[_0xbba0('0x2d')]['id']}})[_0xbba0('0x1c')](handleEntityNotFound(_0x298cdf,null))[_0xbba0('0x1c')](function(_0x38e4a4){if(_0x38e4a4){_0x2f2378[_0xbba0('0x2e')]=_[_0xbba0('0x2f')](db['MailMessage']['rawAttributes']);_0x2f2378[_0xbba0('0x29')]=_[_0xbba0('0x2f')](_0xa1a9cd[_0xbba0('0x29')]);_0x2f2378[_0xbba0('0x31')]=_['intersection'](_0x2f2378['model'],_0x2f2378['query']);_0x3b3266[_0xbba0('0x33')]=_[_0xbba0('0x32')](_0x2f2378[_0xbba0('0x2e')],qs[_0xbba0('0x34')](_0xa1a9cd[_0xbba0('0x29')]['fields']));_0x3b3266[_0xbba0('0x33')]=_0x3b3266[_0xbba0('0x33')]['length']?_0x3b3266[_0xbba0('0x33')]:_0x2f2378[_0xbba0('0x2e')];if(!_0xa1a9cd['query']['hasOwnProperty']('nolimit')){_0x3b3266[_0xbba0('0x18')]=qs['limit'](_0xa1a9cd['query'][_0xbba0('0x18')]);_0x3b3266[_0xbba0('0x15')]=qs[_0xbba0('0x15')](_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x15')]);}_0x3b3266[_0xbba0('0x42')]=qs[_0xbba0('0x43')](_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x43')]);_0x3b3266['where']=qs[_0xbba0('0x31')](_[_0xbba0('0x44')](_0xa1a9cd[_0xbba0('0x29')],_0x2f2378[_0xbba0('0x31')]));_0x3b3266[_0xbba0('0x45')][_0xbba0('0x46')]=_0x38e4a4['id'];if(_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x47')]){_0x3b3266[_0xbba0('0x45')]=_['merge'](_0x3b3266[_0xbba0('0x45')],{'$or':_['map'](_0x3b3266['attributes'],function(_0x1192c4){var _0x17da9f={};_0x17da9f[_0x1192c4]={'$like':'%'+_0xa1a9cd['query'][_0xbba0('0x47')]+'%'};return _0x17da9f;})});}if(_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x48')]){var _0x1f5aa6=_0xa1a9cd['query'][_0xbba0('0x48')][_0xbba0('0x49')](',');var _0x38db26={};_0x38db26[_0x1f5aa6[0x0]]={'$gte':moment(_0x1f5aa6[0x1])[_0xbba0('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3b3266[_0xbba0('0x45')]=_[_0xbba0('0x38')](_0x3b3266['where'],_0x38db26);}_0x3b3266=_[_0xbba0('0x38')]({},_0x3b3266,_0xa1a9cd['options']);return db[_0xbba0('0x3e')][_0xbba0('0x17')]({'where':_0x3b3266[_0xbba0('0x45')]})[_0xbba0('0x1c')](function(_0x183f7a){_0x643f6f[_0xbba0('0x17')]=_0x183f7a;if(_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x36')]){_0x3b3266[_0xbba0('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0xbba0('0x27')](_0x3b3266);})[_0xbba0('0x1c')](function(_0x5c36de){if(_0xa1a9cd[_0xbba0('0x29')][_0xbba0('0x4b')]===_0xbba0('0x4c')){for(var _0x3e564c=0x0;_0x3e564c<_0x5c36de[_0xbba0('0x35')];_0x3e564c++){_0x5c36de[_0x3e564c][_0xbba0('0x3b')]=juice(_0x5c36de[_0x3e564c]['body']);}}_0x643f6f[_0xbba0('0x4d')]=_0x5c36de;return _0x643f6f;});}})[_0xbba0('0x1c')](respondWithFilteredResult(_0x298cdf,_0x3b3266))[_0xbba0('0x2b')](handleError(_0x298cdf,null));};exports[_0xbba0('0x4e')]=function(_0x236bfd,_0x3a23cd){return db[_0xbba0('0x30')]['find']({'where':{'id':_0x236bfd[_0xbba0('0x2d')]['id']}})[_0xbba0('0x1c')](handleEntityNotFound(_0x3a23cd,null))[_0xbba0('0x1c')](function(_0x37756a){if(_0x37756a){return _0x37756a[_0xbba0('0x4f')](_0x236bfd[_0xbba0('0x3b')][_0xbba0('0x50')],_[_0xbba0('0x3f')](_0x236bfd['body'],[_0xbba0('0x50'),'id'])||{})['spread'](function(){return db[_0xbba0('0x51')][_0xbba0('0x27')]({'attributes':['id',_0xbba0('0x20'),_0xbba0('0x52')],'where':{'id':_0x236bfd[_0xbba0('0x3b')][_0xbba0('0x50')]}});})[_0xbba0('0x1c')](function(_0x580f71){socket['emit']('mailInteractionTags:save',{'id':Number(_0x236bfd[_0xbba0('0x2d')]['id']),'tags':_0x580f71||[]});return{'id':Number(_0x236bfd['params']['id']),'tags':_0x580f71||[]};});}})['then'](respondWithResult(_0x3a23cd,null))[_0xbba0('0x2b')](handleError(_0x3a23cd,null));};exports[_0xbba0('0x53')]=function(_0x3f3aa7,_0x390b96){return db[_0xbba0('0x30')]['find']({'where':{'id':_0x3f3aa7[_0xbba0('0x2d')]['id']}})['then'](handleEntityNotFound(_0x390b96,null))['then'](function(_0x2043a7){if(_0x2043a7){return _0x2043a7[_0xbba0('0x53')](_0x3f3aa7[_0xbba0('0x29')][_0xbba0('0x50')]);}})[_0xbba0('0x1c')](respondWithStatusCode(_0x390b96,null))[_0xbba0('0x2b')](handleError(_0x390b96,null));};exports[_0xbba0('0x54')]=function(_0x12ea2f,_0x5cc766){var _0x536f86=moment()[_0xbba0('0x55')]()[_0xbba0('0x56')]();var _0x3140c0=path[_0xbba0('0x57')](config[_0xbba0('0x58')],_0xbba0('0x59'),_0xbba0('0x5a'),_0xbba0('0x5b'));var _0x2a39a3=path[_0xbba0('0x57')](config[_0xbba0('0x58')],_0xbba0('0x59'),_0xbba0('0x5a'),_0xbba0('0x5c'));var _0x1a69e5=path[_0xbba0('0x57')](_0x3140c0,_0x536f86);var _0x44b95b=util[_0xbba0('0x4a')]('transcript-%d-%s.zip',_0x12ea2f['params']['id'],_0x536f86);var _0x83b0ef=path[_0xbba0('0x57')](_0x3140c0,_0x44b95b);var _0x3a4775=[];if(_0x12ea2f[_0xbba0('0x29')][_0xbba0('0x5c')]){_0x3a4775[_0xbba0('0x5d')]({'model':db[_0xbba0('0x5e')],'as':_0xbba0('0x5f'),'raw':!![]});}var _0x5c28fe=[{'model':db['MailMessage'],'as':_0xbba0('0x60'),'attributes':['id',_0xbba0('0x3b'),_0xbba0('0x61'),'to','cc',_0xbba0('0x62'),_0xbba0('0x63'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbba0('0x43')]('id'),'include':_0x3a4775}];return db[_0xbba0('0x30')][_0xbba0('0x3a')]({'where':{'id':_0x12ea2f[_0xbba0('0x2d')]['id']},'include':_0x5c28fe})['then'](handleEntityNotFound(_0x5cc766,null))[_0xbba0('0x1c')](function(_0x3702dc){if(_0x3702dc&&_0x3702dc[_0xbba0('0x60')]){var _0x1f3e8a=_0x3702dc[_0xbba0('0x64')]({'plain':!![]});fs[_0xbba0('0x65')](_0x1a69e5);return BPromise[_0xbba0('0x66')](_0x1f3e8a[_0xbba0('0x60')],function(_0x1f67b7,_0x838905){var _0x12c535={'from':_0x1f67b7[_0xbba0('0x61')],'to':_0x1f67b7['to'],'subject':_0x1f67b7['subject'],'html':htmlEntities[_0xbba0('0x67')](_0x1f67b7[_0xbba0('0x3b')]),'headers':{'Date':moment(_0x1f67b7[_0xbba0('0x68')])[_0xbba0('0x4a')](_0xbba0('0x69'))},'attachments':[]};if(_0x1f67b7['cc']){_0x12c535[_0xbba0('0x6a')]['Cc']=_0x1f67b7['cc'];}if(_0x1f67b7[_0xbba0('0x62')]){_0x12c535['headers'][_0xbba0('0x6b')]=_0x1f67b7[_0xbba0('0x62')];}return new BPromise(function(_0x2b0cdb,_0x3044f2){if(_0x1f67b7[_0xbba0('0x5f')]){for(var _0x41c74d=0x0;_0x41c74d<_0x1f67b7[_0xbba0('0x5f')]['length'];_0x41c74d++){var _0x401279=_0x1f67b7['Attachments'][_0x41c74d];var _0x551514=path[_0xbba0('0x57')](_0x2a39a3,_0x401279['basename']);if(fs['existsSync'](_0x551514)){_0x12c535[_0xbba0('0x5c')][_0xbba0('0x5d')]({'name':_0x401279[_0xbba0('0x20')],'contentType':_0x401279['type'],'data':fs[_0xbba0('0x6c')](_0x551514)});}}}emlformat[_0xbba0('0x6d')](_0x12c535,function(_0x2409a9,_0x391989){if(_0x2409a9)return _0x3044f2(_0x2409a9);fs[_0xbba0('0x6e')](path[_0xbba0('0x57')](_0x1a69e5,util[_0xbba0('0x4a')]('message%d.eml',_0x838905)),_0x391989);return _0x2b0cdb(_0x391989);});});})[_0xbba0('0x1c')](function(){return new BPromise(function(_0xfe140c,_0xc1207a){zipdir(_0x1a69e5,{'saveTo':_0x83b0ef},function(_0x2ae560,_0x28f0bb){if(_0x2ae560)return _0xc1207a(_0x2ae560);return _0xfe140c(_0x28f0bb);});})[_0xbba0('0x1c')](function(){return new BPromise(function(_0x26e4c7,_0x106874){rimraf(_0x1a69e5,function(_0x2feca0){if(_0x2feca0)_0x106874(_0x2feca0);return _0x26e4c7();});});})[_0xbba0('0x1c')](function(){return _0x5cc766[_0xbba0('0x54')](_0x83b0ef,_0x44b95b,function(_0x443c8c){if(!_0x443c8c)fs[_0xbba0('0x6f')](_0x83b0ef);});});});}else{return _0x5cc766[_0xbba0('0x70')](0xc8);}})['catch'](handleError(_0x5cc766,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c1d2159..7437cb6 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 _0x13a7=['remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x347e60,_0x20e496){var _0xe306c5=function(_0x4f8240){while(--_0x4f8240){_0x347e60['push'](_0x347e60['shift']());}};_0xe306c5(++_0x20e496);}(_0x13a7,0x13e));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x713a('0x0'));var MailInteraction=require(_0x713a('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x713a('0x1'))['db'][_0x713a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x713a('0x3')](0x0);var events={'afterCreate':_0x713a('0x4'),'afterUpdate':'update','afterDestroy':_0x713a('0x5')};function emitEvent(_0xe919c5){return function(_0x15cf28,_0x1e22f2,_0x3cc9ab){_0x15cf28[_0x713a('0x6')]({'attributes':['id'],'raw':!![]})[_0x713a('0x7')](function(_0x4ad1a0){_0x15cf28[_0x713a('0x8')](_0x713a('0x9'),_0x4ad1a0[_0x713a('0xa')](function(_0x4ccf50){return{'id':_0x4ccf50['id']};}));return MailMessage[_0x713a('0xb')]({'where':{'MailInteractionId':_0x15cf28['id'],'direction':'in','read':![]},'raw':!![]});})[_0x713a('0x7')](function(_0x2b1a00){_0x15cf28[_0x713a('0x8')]('unreadMessages',_0x2b1a00[_0x713a('0xc')]);MailInteractionEvents[_0x713a('0xd')](_0xe919c5+':'+_0x15cf28['id'],_0x15cf28);MailInteractionEvents[_0x713a('0xd')](_0xe919c5,_0x15cf28);_0x3cc9ab(null);})[_0x713a('0xe')](_0x3cc9ab(null));};}for(var e in events){if(events[_0x713a('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x713a('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x37b1=['hook','exports','events','MailInteraction','save','update','remove','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1b6350,_0x2e929b){var _0xda0572=function(_0x2c99e1){while(--_0x2c99e1){_0x1b6350['push'](_0x1b6350['shift']());}};_0xda0572(++_0x2e929b);}(_0x37b1,0x92));var _0x137b=function(_0x4edc35,_0x5449d8){_0x4edc35=_0x4edc35-0x0;var _0x227f48=_0x37b1[_0x4edc35];return _0x227f48;};'use strict';var EventEmitter=require(_0x137b('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x137b('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x137b('0x2'),'afterUpdate':_0x137b('0x3'),'afterDestroy':_0x137b('0x4')};function emitEvent(_0x3566fe){return function(_0x252cfa,_0x4ac9ef,_0x2d35d0){_0x252cfa['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x467fb6){_0x252cfa[_0x137b('0x5')](_0x137b('0x6'),_0x467fb6['map'](function(_0x1fbae6){return{'id':_0x1fbae6['id']};}));return MailMessage[_0x137b('0x7')]({'where':{'MailInteractionId':_0x252cfa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x137b('0x8')](function(_0xab2d5a){_0x252cfa[_0x137b('0x5')](_0x137b('0x9'),_0xab2d5a[_0x137b('0xa')]);MailInteractionEvents[_0x137b('0xb')](_0x3566fe+':'+_0x252cfa['id'],_0x252cfa);MailInteractionEvents['emit'](_0x3566fe,_0x252cfa);_0x2d35d0(null);})[_0x137b('0xc')](_0x2d35d0(null));};}for(var e in events){if(events[_0x137b('0xd')](e)){var event=events[e];MailInteraction[_0x137b('0xe')](e,emitEvent(event));}}module[_0x137b('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 09af342..bab0a3f 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 _0xfd37=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','update','then','catch'];(function(_0x273fda,_0xf1d89f){var _0x4b72e2=function(_0x3c503e){while(--_0x3c503e){_0x273fda['push'](_0x273fda['shift']());}};_0x4b72e2(++_0xf1d89f);}(_0xfd37,0xb0));var _0x7fd3=function(_0x44e8c2,_0x3ca96d){_0x44e8c2=_0x44e8c2-0x0;var _0xafdf56=_0xfd37[_0x44e8c2];return _0xafdf56;};'use strict';var _=require('lodash');var util=require(_0x7fd3('0x0'));var logger=require(_0x7fd3('0x1'))(_0x7fd3('0x2'));var moment=require('moment');var BPromise=require(_0x7fd3('0x3'));var rp=require(_0x7fd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fd3('0x5'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x7fd3('0x6')]=function(_0xf87458,_0x7a0e55){return _0xf87458[_0x7fd3('0x7')](_0x7fd3('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x7fd3('0x9'),'to'],'type':_0x7fd3('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5063a2,_0x17d468,_0x3df043){if(_0x5063a2[_0x7fd3('0xb')]){_0x5063a2[_0x7fd3('0xc')]=moment()['format'](_0x7fd3('0xd'));}if(_0x5063a2[_0x7fd3('0xe')]){_0x5063a2[_0x7fd3('0xf')]=moment()[_0x7fd3('0x10')](_0x7fd3('0xd'));}_0x3df043(null,_0x17d468);},'beforeUpdate':function(_0x3d68c2,_0x44c671,_0x5d75e2){if(_0x3d68c2[_0x7fd3('0x11')]('substatus')){_0x3d68c2[_0x7fd3('0xc')]=_0x3d68c2[_0x7fd3('0xb')]?moment()[_0x7fd3('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3d68c2[_0x7fd3('0x11')]('closed')){_0x3d68c2['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d68c2[_0x7fd3('0xb')]=null;_0x3d68c2[_0x7fd3('0xc')]=null;}_0x5d75e2(null,_0x3d68c2);},'afterUpdate':function(_0x37df82,_0xef9166,_0x474599){var _0x5e6044=_0xf87458[_0x7fd3('0x12')];var _0x1489b1=_0x37df82[_0x7fd3('0x13')]({'plain':!![]});if(_0x1489b1[_0x7fd3('0xe')]){return _0x5e6044[_0x7fd3('0x14')][_0x7fd3('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x1489b1['id']}})[_0x7fd3('0x16')](function(){_0x474599();})[_0x7fd3('0x17')](function(_0x2766f0){_0x474599(_0x2766f0);});}else{_0x474599();}}},'charset':'utf8mb4','collate':_0x7fd3('0x18')});}; \ No newline at end of file +var _0xa26f=['closed','changed','closedAt','models','get','then','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x201f90,_0x495f22){var _0x2f3642=function(_0x4da3d2){while(--_0x4da3d2){_0x201f90['push'](_0x201f90['shift']());}};_0x2f3642(++_0x495f22);}(_0xa26f,0x7f));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfa26('0x0'));var logger=require('../../config/logger')(_0xfa26('0x1'));var moment=require(_0xfa26('0x2'));var BPromise=require(_0xfa26('0x3'));var rp=require(_0xfa26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa26('0x5'));var config=require(_0xfa26('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xfa26('0x7')]=function(_0x4873e1,_0x479ba7){return _0x4873e1[_0xfa26('0x8')](_0xfa26('0x9'),attributes,{'tableName':_0xfa26('0xa'),'paranoid':![],'indexes':[{'name':_0xfa26('0xb'),'fields':[_0xfa26('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e05b4,_0x45f0ab,_0x2ee5f8){if(_0x1e05b4[_0xfa26('0xd')]){_0x1e05b4[_0xfa26('0xe')]=moment()[_0xfa26('0xf')](_0xfa26('0x10'));}if(_0x1e05b4[_0xfa26('0x11')]){_0x1e05b4['closedAt']=moment()[_0xfa26('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ee5f8(null,_0x45f0ab);},'beforeUpdate':function(_0x38b661,_0x29b224,_0xd6f902){if(_0x38b661[_0xfa26('0x12')](_0xfa26('0xd'))){_0x38b661[_0xfa26('0xe')]=_0x38b661[_0xfa26('0xd')]?moment()[_0xfa26('0xf')](_0xfa26('0x10')):null;}if(_0x38b661[_0xfa26('0x12')](_0xfa26('0x11'))){_0x38b661[_0xfa26('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x38b661[_0xfa26('0xd')]=null;_0x38b661['substatusAt']=null;}_0xd6f902(null,_0x38b661);},'afterUpdate':function(_0x23d9ff,_0x13f7ca,_0x5a05e2){var _0x20f3f1=_0x4873e1[_0xfa26('0x14')];var _0x5a20a2=_0x23d9ff[_0xfa26('0x15')]({'plain':!![]});if(_0x5a20a2[_0xfa26('0x11')]){return _0x20f3f1['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x5a20a2['id']}})[_0xfa26('0x16')](function(){_0x5a05e2();})['catch'](function(_0x4acf48){_0x5a05e2(_0x4acf48);});}else{_0x5a05e2();}}},'charset':'utf8mb4','collate':_0xfa26('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 273f816..3b97f4f 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 _0xbeb1=['MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xbeb1,0x9b));var _0x1beb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbeb1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var moment=require(_0x1beb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1beb('0x3'));var db=require(_0x1beb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1beb('0x5'))(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var jayson=require(_0x1beb('0x8'));var client=jayson[_0x1beb('0x9')][_0x1beb('0xa')]({'port':0x232a});config[_0x1beb('0xb')]=_[_0x1beb('0xc')](config[_0x1beb('0xb')],{'host':_0x1beb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1beb('0xb')]));require(_0x1beb('0xe'))[_0x1beb('0xf')](socket);function respondWithRpcPromise(_0x2e4509,_0x14f540,_0x3eff24){return new BPromise(function(_0x1c3690,_0x476c13){return client[_0x1beb('0x10')](_0x2e4509,_0x3eff24)[_0x1beb('0x11')](function(_0x368c01){logger[_0x1beb('0x12')](_0x1beb('0x13'),_0x14f540,_0x1beb('0x14'));logger['debug'](_0x1beb('0x15'),_0x14f540,'request\x20sent',JSON['stringify'](_0x368c01));if(_0x368c01[_0x1beb('0x16')]){if(_0x368c01[_0x1beb('0x16')][_0x1beb('0x17')]===0x1f4){logger[_0x1beb('0x16')]('MailInteraction,\x20%s,\x20%s',_0x14f540,_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);return _0x476c13(_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);}logger[_0x1beb('0x16')](_0x1beb('0x13'),_0x14f540,_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);return _0x1c3690(_0x368c01['error'][_0x1beb('0x18')]);}else{logger[_0x1beb('0x12')](_0x1beb('0x13'),_0x14f540,'request\x20sent');_0x1c3690(_0x368c01[_0x1beb('0x19')][_0x1beb('0x18')]);}})[_0x1beb('0x1a')](function(_0x5c0b09){logger[_0x1beb('0x16')](_0x1beb('0x13'),_0x14f540,_0x5c0b09);_0x476c13(_0x5c0b09);});});}exports[_0x1beb('0x1b')]=function(_0xae2063){var _0x5f05e2=this;return new Promise(function(_0x2a24a8,_0x129f93){return db[_0x1beb('0x1c')][_0x1beb('0x1d')](_0xae2063[_0x1beb('0x1e')],{'raw':_0xae2063[_0x1beb('0x1f')]?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xae2063[_0x1beb('0x1f')]?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x21')]||null:null,'attributes':_0xae2063['options']?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x22')]||null:null,'limit':_0xae2063[_0x1beb('0x1f')]?_0xae2063['options'][_0x1beb('0x23')]||null:null})[_0x1beb('0x11')](function(_0x57dacb){logger[_0x1beb('0x12')](_0x1beb('0x1b'),_0xae2063);logger[_0x1beb('0x24')]('UpdateMailInteraction',_0xae2063,JSON[_0x1beb('0x25')](_0x57dacb));_0x2a24a8(_0x57dacb);})['catch'](function(_0x2fabd7){logger['error'](_0x1beb('0x1b'),_0x2fabd7[_0x1beb('0x18')],_0xae2063);_0x129f93(_0x5f05e2[_0x1beb('0x16')](0x1f4,_0x2fabd7[_0x1beb('0x18')]));});});};exports[_0x1beb('0x26')]=function(_0xc13c42){return new Promise(function(_0x9cf4c9,_0x415ec3){return db[_0x1beb('0x1c')][_0x1beb('0x27')]({'where':_0xc13c42[_0x1beb('0x1f')]?_0xc13c42[_0x1beb('0x1f')][_0x1beb('0x21')]||null:null})[_0x1beb('0x11')](function(_0x3c9be9){if(_0x3c9be9){return _0x3c9be9[_0x1beb('0x28')](_0xc13c42[_0x1beb('0x1e')][_0x1beb('0x29')],_['omit'](_0xc13c42['body'],[_0x1beb('0x29'),'id'])||{});}})[_0x1beb('0x2a')](function(_0x119825){logger[_0x1beb('0x12')]('AddTags',_0xc13c42);logger[_0x1beb('0x24')](_0x1beb('0x2b'),_0xc13c42,JSON['stringify'](_0x119825));_0x9cf4c9(_0x119825);})[_0x1beb('0x1a')](function(_0x4ea90f){logger[_0x1beb('0x16')](_0x1beb('0x2b'),_0x4ea90f[_0x1beb('0x18')],_0xc13c42);_0x415ec3(_this[_0x1beb('0x16')](0x1f4,_0x4ea90f[_0x1beb('0x18')]));});});}; \ No newline at end of file +var _0x8277=['spread','AddTags','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','options','raw','where','limit','debug','AddTagsToMailInteraction','MailInteraction','find','then','addTags','body'];(function(_0x1cdc8d,_0x1e5b71){var _0x267c57=function(_0x9fab80){while(--_0x9fab80){_0x1cdc8d['push'](_0x1cdc8d['shift']());}};_0x267c57(++_0x1e5b71);}(_0x8277,0xcf));var _0x7827=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x8277[_0x4afac5];return _0x2404b3;};'use strict';var _=require('lodash');var util=require(_0x7827('0x0'));var moment=require(_0x7827('0x1'));var BPromise=require('bluebird');var rs=require(_0x7827('0x2'));var fs=require('fs');var Redis=require(_0x7827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7827('0x4'));var logger=require(_0x7827('0x5'))('rpc');var config=require(_0x7827('0x6'));var jayson=require(_0x7827('0x7'));var client=jayson[_0x7827('0x8')]['http']({'port':0x232a});config[_0x7827('0x9')]=_[_0x7827('0xa')](config[_0x7827('0x9')],{'host':_0x7827('0xb'),'port':0x18eb});var socket=require(_0x7827('0xc'))(new Redis(config[_0x7827('0x9')]));require(_0x7827('0xd'))[_0x7827('0xe')](socket);function respondWithRpcPromise(_0xfd2a88,_0x2392d8,_0x2abc26){return new BPromise(function(_0x4472b2,_0x21f5d5){return client[_0x7827('0xf')](_0xfd2a88,_0x2abc26)['then'](function(_0x457717){logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));logger['debug'](_0x7827('0x13'),_0x2392d8,_0x7827('0x12'),JSON[_0x7827('0x14')](_0x457717));if(_0x457717[_0x7827('0x15')]){if(_0x457717[_0x7827('0x15')][_0x7827('0x16')]===0x1f4){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')][_0x7827('0x17')]);return _0x21f5d5(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')]['message']);return _0x4472b2(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}else{logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));_0x4472b2(_0x457717[_0x7827('0x18')][_0x7827('0x17')]);}})[_0x7827('0x19')](function(_0x4f6500){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x4f6500);_0x21f5d5(_0x4f6500);});});}exports[_0x7827('0x1a')]=function(_0x1eaf99){var _0x1f19c6=this;return new Promise(function(_0x6a4589,_0x216bf6){return db['MailInteraction'][_0x7827('0x1b')](_0x1eaf99['body'],{'raw':_0x1eaf99[_0x7827('0x1c')]?_0x1eaf99[_0x7827('0x1c')][_0x7827('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eaf99[_0x7827('0x1c')]?_0x1eaf99['options'][_0x7827('0x1e')]||null:null,'attributes':_0x1eaf99[_0x7827('0x1c')]?_0x1eaf99[_0x7827('0x1c')]['attributes']||null:null,'limit':_0x1eaf99[_0x7827('0x1c')]?_0x1eaf99['options'][_0x7827('0x1f')]||null:null})['then'](function(_0x3b764f){logger[_0x7827('0x10')](_0x7827('0x1a'),_0x1eaf99);logger[_0x7827('0x20')]('UpdateMailInteraction',_0x1eaf99,JSON[_0x7827('0x14')](_0x3b764f));_0x6a4589(_0x3b764f);})['catch'](function(_0x3ec12e){logger[_0x7827('0x15')](_0x7827('0x1a'),_0x3ec12e[_0x7827('0x17')],_0x1eaf99);_0x216bf6(_0x1f19c6[_0x7827('0x15')](0x1f4,_0x3ec12e[_0x7827('0x17')]));});});};exports[_0x7827('0x21')]=function(_0x3e90ef){return new Promise(function(_0x276da2,_0x4b25ba){return db[_0x7827('0x22')][_0x7827('0x23')]({'where':_0x3e90ef[_0x7827('0x1c')]?_0x3e90ef[_0x7827('0x1c')][_0x7827('0x1e')]||null:null})[_0x7827('0x24')](function(_0x42d529){if(_0x42d529){return _0x42d529[_0x7827('0x25')](_0x3e90ef[_0x7827('0x26')]['ids'],_['omit'](_0x3e90ef[_0x7827('0x26')],['ids','id'])||{});}})[_0x7827('0x27')](function(_0xc5768d){logger['info'](_0x7827('0x28'),_0x3e90ef);logger[_0x7827('0x20')](_0x7827('0x28'),_0x3e90ef,JSON['stringify'](_0xc5768d));_0x276da2(_0xc5768d);})[_0x7827('0x19')](function(_0x5257b0){logger[_0x7827('0x15')](_0x7827('0x28'),_0x5257b0['message'],_0x3e90ef);_0x4b25ba(_this[_0x7827('0x15')](0x1f4,_0x5257b0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 57fc6cf..66cb2f3 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 _0xff0e=['save','update','emit','removeListener','register','length','./mailInteraction.events'];(function(_0x5730a1,_0x33226e){var _0x37b7ec=function(_0x1846ab){while(--_0x1846ab){_0x5730a1['push'](_0x5730a1['shift']());}};_0x37b7ec(++_0x33226e);}(_0xff0e,0x1db));var _0xeff0=function(_0x22fcad,_0x404cf0){_0x22fcad=_0x22fcad-0x0;var _0x3d30f0=_0xff0e[_0x22fcad];return _0x3d30f0;};'use strict';var MailInteractionEvents=require(_0xeff0('0x0'));var events=[_0xeff0('0x1'),'remove',_0xeff0('0x2')];function createListener(_0x5283be,_0x17d03d){return function(_0x1f1b2f){_0x17d03d[_0xeff0('0x3')](_0x5283be,_0x1f1b2f);};}function removeListener(_0x4009a3,_0xc70907){return function(){MailInteractionEvents[_0xeff0('0x4')](_0x4009a3,_0xc70907);};}exports[_0xeff0('0x5')]=function(_0x23a3cd){for(var _0x2ceb34=0x0,_0x29b52f=events[_0xeff0('0x6')];_0x2ceb34<_0x29b52f;_0x2ceb34++){var _0x46cc90=events[_0x2ceb34];var _0x2c7552=createListener('mailInteraction:'+_0x46cc90,_0x23a3cd);MailInteractionEvents['on'](_0x46cc90,_0x2c7552);}}; \ No newline at end of file +var _0xdaf4=['length','./mailInteraction.events','save','remove','emit','register'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xdaf4,0x103));var _0x4daf=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xdaf4[_0x48999d];return _0x1ad0d1;};'use strict';var MailInteractionEvents=require(_0x4daf('0x0'));var events=[_0x4daf('0x1'),_0x4daf('0x2'),'update'];function createListener(_0x6ebf43,_0x17153d){return function(_0x68b21e){_0x17153d[_0x4daf('0x3')](_0x6ebf43,_0x68b21e);};}function removeListener(_0x335ffc,_0x4ad88b){return function(){MailInteractionEvents['removeListener'](_0x335ffc,_0x4ad88b);};}exports[_0x4daf('0x4')]=function(_0x7f06c7){for(var _0x4d895f=0x0,_0x562887=events[_0x4daf('0x5')];_0x4d895f<_0x562887;_0x4d895f++){var _0x5351ab=events[_0x4d895f];var _0x4b9632=createListener('mailInteraction:'+_0x5351ab,_0x7f06c7);MailInteractionEvents['on'](_0x5351ab,_0x4b9632);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 61b9c24..a5b62c0 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 _0xfc61=['../../components/interaction/service','../../config/environment','./mailMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','download','tracked','mail','mailmessage:create','update','put','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x1a82bc,_0x2edc75){var _0x32f1d9=function(_0x19fea5){while(--_0x19fea5){_0x1a82bc['push'](_0x1a82bc['shift']());}};_0x32f1d9(++_0x2edc75);}(_0xfc61,0x78));var _0x1fc6=function(_0x1dc65a,_0x53feb7){_0x1dc65a=_0x1dc65a-0x0;var _0x1da8ef=_0xfc61[_0x1dc65a];return _0x1da8ef;};'use strict';var multer=require(_0x1fc6('0x0'));var util=require(_0x1fc6('0x1'));var path=require(_0x1fc6('0x2'));var timeout=require(_0x1fc6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1fc6('0x4'));var interaction=require(_0x1fc6('0x5'));var config=require(_0x1fc6('0x6'));var controller=require(_0x1fc6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1fc6('0x8')]);router[_0x1fc6('0x9')](_0x1fc6('0xa'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xc')]);router['get'](_0x1fc6('0xd'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xe')]);router[_0x1fc6('0x9')]('/:id/download',auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xf')]);router['post']('/',auth[_0x1fc6('0xb')](),interaction[_0x1fc6('0x10')](_0x1fc6('0x11'),_0x1fc6('0x12')),controller['create']);router['put'](_0x1fc6('0xd'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0x13')]);router['put']('/:id/accept',auth[_0x1fc6('0xb')](),controller['accept']);router[_0x1fc6('0x14')](_0x1fc6('0x15'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0x16')]);router[_0x1fc6('0x17')](_0x1fc6('0xd'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9354=['describe','/:id','show','/:id/download','download','post','mail','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe'];(function(_0xd1be9f,_0x5c742e){var _0x5d496f=function(_0x47e4b5){while(--_0x47e4b5){_0xd1be9f['push'](_0xd1be9f['shift']());}};_0x5d496f(++_0x5c742e);}(_0x9354,0x96));var _0x4935=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0x9354[_0x2f02d4];return _0x4b707d;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4935('0x12'),'mailmessage:create'),controller['create']);router[_0x4935('0x13')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);router[_0x4935('0x13')](_0x4935('0x17'),auth[_0x4935('0x9')](),controller[_0x4935('0x18')]);router[_0x4935('0x19')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('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 aa39e06..0f5ed86 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 _0x8c75=['ENUM','Chat','Email','sequelize','lodash','long','medium','out','STRING','TEXT','DATE','INTEGER','BOOLEAN'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8c75,0x1b0));var _0x58c7=function(_0x228aa4,_0x5d1e3c){_0x228aa4=_0x228aa4-0x0;var _0x3e5448=_0x8c75[_0x228aa4];return _0x3e5448;};'use strict';var Sequelize=require(_0x58c7('0x0'));var _=require(_0x58c7('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x58c7('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x58c7('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x58c7('0x4')),'defaultValue':_0x58c7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x58c7('0x5')](0x1fe)},'from':{'type':Sequelize[_0x58c7('0x5')]},'to':{'type':Sequelize[_0x58c7('0x6')](_0x58c7('0x2'))},'cc':{'type':Sequelize[_0x58c7('0x6')](_0x58c7('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x58c7('0x2'))},'subject':{'type':Sequelize[_0x58c7('0x6')]},'sentAt':{'type':Sequelize[_0x58c7('0x7')]},'attach':{'type':Sequelize[_0x58c7('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x58c7('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x58c7('0x6')](_0x58c7('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0x58c7('0x2'))},'originChannel':{'type':Sequelize[_0x58c7('0xa')]('Email',_0x58c7('0xb')),'defaultValue':_0x58c7('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xeaa2=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports'];(function(_0x2687cb,_0x21f20d){var _0x57baac=function(_0x4f7d89){while(--_0x4f7d89){_0x2687cb['push'](_0x2687cb['shift']());}};_0x57baac(++_0x21f20d);}(_0xeaa2,0x115));var _0x2eaa=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0xeaa2[_0x3c4dad];return _0x1a4f49;};'use strict';var Sequelize=require(_0x2eaa('0x0'));var _=require(_0x2eaa('0x1'));module[_0x2eaa('0x2')]={'body':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x5'))},'read':{'type':Sequelize[_0x2eaa('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2eaa('0x7')]('in',_0x2eaa('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2eaa('0x9')]},'to':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x4'))},'cc':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x4'))},'bcc':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x4'))},'subject':{'type':Sequelize[_0x2eaa('0x3')]},'sentAt':{'type':Sequelize[_0x2eaa('0xa')]},'attach':{'type':Sequelize[_0x2eaa('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2eaa('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x2eaa('0x3')](_0x2eaa('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x2eaa('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x2eaa('0xc'),_0x2eaa('0xd')),'defaultValue':_0x2eaa('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 37dc75d..93c5464 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 _0x705d=['null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','QueryTypes','SELECT','fullname','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','body','describe','create','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x4356c8,_0x5a863f){var _0x3bb35b=function(_0x1c9cf6){while(--_0x1c9cf6){_0x4356c8['push'](_0x4356c8['shift']());}};_0x3bb35b(++_0x5a863f);}(_0x705d,0x16d));var _0xd705=function(_0x587d35,_0x2ede6b){_0x587d35=_0x587d35-0x0;var _0x1af8f0=_0x705d[_0x587d35];return _0x1af8f0;};'use strict';var emlformat=require(_0xd705('0x0'));var moment=require(_0xd705('0x1'));var BPromise=require(_0xd705('0x2'));var util=require('util');var path=require(_0xd705('0x3'));var fs=require('fs');var _=require(_0xd705('0x4'));var Redis=require(_0xd705('0x5'));var htmlToText=require('html-to-text');var qs=require(_0xd705('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require(_0xd705('0x7'))(_0xd705('0x8'));var config=require('../../config/environment');var db=require(_0xd705('0x9'))['db'];config['redis']=_[_0xd705('0xa')](config[_0xd705('0xb')],{'host':_0xd705('0xc'),'port':0x18eb});var socket=require(_0xd705('0xd'))(new Redis(config[_0xd705('0xb')]));var htmlEntities=require('html-entities');require(_0xd705('0xe'))[_0xd705('0xf')](socket);var jayson=require(_0xd705('0x10'));var client=jayson['client'][_0xd705('0x11')]({'port':0x232c});var client9003=jayson[_0xd705('0x12')][_0xd705('0x11')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x415775,_0x13b84f,_0x12a24b,_0x593308){return new BPromise(function(_0x785f19,_0x34a83c){var _0x1e0bcb=_0x593308||client;return _0x1e0bcb['request'](_0x415775,_0x12a24b)[_0xd705('0x13')](function(_0x54e01a){logger[_0xd705('0x14')](_0xd705('0x15'),_0x13b84f,'request\x20sent');logger[_0xd705('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x13b84f,_0xd705('0x17'),JSON[_0xd705('0x18')](_0x54e01a));if(_0x54e01a[_0xd705('0x19')]){if(_0x54e01a['error'][_0xd705('0x1a')]===0x1f4){logger[_0xd705('0x19')](_0xd705('0x15'),_0x13b84f,_0x54e01a[_0xd705('0x19')][_0xd705('0x1b')]);return _0x34a83c(_0x54e01a[_0xd705('0x19')][_0xd705('0x1b')]);}logger[_0xd705('0x19')](_0xd705('0x15'),_0x13b84f,_0x54e01a[_0xd705('0x19')][_0xd705('0x1b')]);return _0x785f19(_0x54e01a[_0xd705('0x19')][_0xd705('0x1b')]);}else{logger[_0xd705('0x14')](_0xd705('0x15'),_0x13b84f,_0xd705('0x17'));_0x785f19(_0x54e01a[_0xd705('0x1c')]['message']);}})[_0xd705('0x1d')](function(_0xe2abe9){logger[_0xd705('0x19')]('MailMessage,\x20%s,\x20%s',_0x13b84f,_0xe2abe9);_0x34a83c(_0xe2abe9);});});}function respondWithResult(_0x2e7d44,_0x68a43a){_0x68a43a=_0x68a43a||0xc8;return function(_0x2d96a6){if(_0x2d96a6){return _0x2e7d44[_0xd705('0x1e')](_0x68a43a)[_0xd705('0x1f')](_0x2d96a6);}};}function respondWithFilteredResult(_0x1dd337,_0x437212){return function(_0x423770){if(_0x423770){var _0x2d6271=typeof _0x437212[_0xd705('0x20')]===_0xd705('0x21')&&typeof _0x437212['limit']==='undefined';var _0x28a8c6=_0x423770['count'];var _0x64eac3=_0x2d6271?0x0:_0x437212[_0xd705('0x20')];var _0x4d93cf=_0x2d6271?_0x423770[_0xd705('0x22')]:_0x437212[_0xd705('0x20')]+_0x437212[_0xd705('0x23')];var _0x5e3041;if(_0x4d93cf>=_0x28a8c6){_0x4d93cf=_0x28a8c6;_0x5e3041=0xc8;}else{_0x5e3041=0xce;}_0x1dd337['status'](_0x5e3041);return _0x1dd337[_0xd705('0x24')](_0xd705('0x25'),_0x64eac3+'-'+_0x4d93cf+'/'+_0x28a8c6)[_0xd705('0x1f')](_0x423770);}return null;};}function saveUpdates(_0x11de04){return function(_0x1c3b96){if(_0x1c3b96){return _0x1c3b96[_0xd705('0x26')](_0x11de04)['then'](function(_0x246413){return _0x246413;});}return null;};}function removeEntity(_0x5c3fe6){return function(_0x2b7417){if(_0x2b7417){return _0x2b7417[_0xd705('0x27')]()[_0xd705('0x13')](function(){_0x5c3fe6[_0xd705('0x1e')](0xcc)[_0xd705('0x28')]();});}};}function handleEntityNotFound(_0xccfdec){return function(_0x4fac9a){if(!_0x4fac9a){_0xccfdec[_0xd705('0x29')](0x194);}return _0x4fac9a;};}function handleError(_0x2a172f,_0x5cde9f){_0x5cde9f=_0x5cde9f||0x1f4;return function(_0x408005){logger['error'](_0x408005[_0xd705('0x2a')]);if(_0x408005['name']){delete _0x408005[_0xd705('0x2b')];}_0x2a172f[_0xd705('0x1e')](_0x5cde9f)[_0xd705('0x2c')](_0x408005);};}exports['index']=function(_0x4b7191,_0xd8478f){var _0x16cb6b={},_0x501652={},_0x27c77e={'count':0x0,'rows':[]};var _0x102f6d=_[_0xd705('0x2d')](db[_0xd705('0x2e')][_0xd705('0x2f')],function(_0x3d52d3){return{'name':_0x3d52d3['fieldName'],'type':_0x3d52d3[_0xd705('0x30')][_0xd705('0x31')]};});_0x501652[_0xd705('0x32')]=_['map'](_0x102f6d,_0xd705('0x2b'));_0x501652[_0xd705('0x33')]=_[_0xd705('0x34')](_0x4b7191[_0xd705('0x33')]);_0x501652[_0xd705('0x35')]=_['intersection'](_0x501652[_0xd705('0x32')],_0x501652[_0xd705('0x33')]);_0x16cb6b[_0xd705('0x36')]=_[_0xd705('0x37')](_0x501652[_0xd705('0x32')],qs['fields'](_0x4b7191[_0xd705('0x33')][_0xd705('0x38')]));_0x16cb6b[_0xd705('0x36')]=_0x16cb6b[_0xd705('0x36')][_0xd705('0x39')]?_0x16cb6b[_0xd705('0x36')]:_0x501652[_0xd705('0x32')];if(!_0x4b7191[_0xd705('0x33')][_0xd705('0x3a')](_0xd705('0x3b'))){_0x16cb6b[_0xd705('0x23')]=qs['limit'](_0x4b7191[_0xd705('0x33')][_0xd705('0x23')]);_0x16cb6b[_0xd705('0x20')]=qs[_0xd705('0x20')](_0x4b7191['query'][_0xd705('0x20')]);}_0x16cb6b[_0xd705('0x3c')]=qs[_0xd705('0x3d')](_0x4b7191[_0xd705('0x33')][_0xd705('0x3d')]);_0x16cb6b[_0xd705('0x3e')]=qs[_0xd705('0x35')](_[_0xd705('0x3f')](_0x4b7191[_0xd705('0x33')],_0x501652[_0xd705('0x35')]),_0x102f6d);if(_0x4b7191[_0xd705('0x33')]['filter']){_0x16cb6b[_0xd705('0x3e')]=_['merge'](_0x16cb6b[_0xd705('0x3e')],{'$or':_['map'](_0x102f6d,function(_0x5d07c1){if(_0x5d07c1[_0xd705('0x30')]!==_0xd705('0x40')){var _0x237333={};_0x237333[_0x5d07c1[_0xd705('0x2b')]]={'$like':'%'+_0x4b7191['query'][_0xd705('0x41')]+'%'};return _0x237333;}})});}_0x16cb6b=_['merge']({},_0x16cb6b,_0x4b7191[_0xd705('0x42')]);var _0x5e8ad9={'where':_0x16cb6b[_0xd705('0x3e')]};return db[_0xd705('0x2e')]['count'](_0x5e8ad9)['then'](function(_0x210ab9){_0x27c77e[_0xd705('0x22')]=_0x210ab9;if(_0x4b7191[_0xd705('0x33')][_0xd705('0x43')]){_0x16cb6b[_0xd705('0x44')]=[{'all':!![]}];}return db[_0xd705('0x2e')][_0xd705('0x45')](_0x16cb6b);})['then'](function(_0x5904e6){_0x27c77e[_0xd705('0x46')]=_0x5904e6;return _0x27c77e;})[_0xd705('0x13')](respondWithFilteredResult(_0xd8478f,_0x16cb6b))[_0xd705('0x1d')](handleError(_0xd8478f,null));};exports[_0xd705('0x47')]=function(_0x1c6db3,_0x3f75ea){var _0x11cb42={'raw':!![],'where':{'id':_0x1c6db3[_0xd705('0x48')]['id']}},_0x553525={};_0x553525[_0xd705('0x32')]=_[_0xd705('0x34')](db[_0xd705('0x2e')]['rawAttributes']);_0x553525[_0xd705('0x33')]=_[_0xd705('0x34')](_0x1c6db3[_0xd705('0x33')]);_0x553525[_0xd705('0x35')]=_['intersection'](_0x553525[_0xd705('0x32')],_0x553525[_0xd705('0x33')]);_0x11cb42[_0xd705('0x36')]=_[_0xd705('0x37')](_0x553525[_0xd705('0x32')],qs['fields'](_0x1c6db3[_0xd705('0x33')][_0xd705('0x38')]));_0x11cb42['attributes']=_0x11cb42[_0xd705('0x36')][_0xd705('0x39')]?_0x11cb42[_0xd705('0x36')]:_0x553525[_0xd705('0x32')];if(_0x1c6db3[_0xd705('0x33')][_0xd705('0x43')]){_0x11cb42[_0xd705('0x44')]=[{'all':!![]}];}_0x11cb42=_[_0xd705('0x49')]({},_0x11cb42,_0x1c6db3[_0xd705('0x42')]);return db[_0xd705('0x2e')][_0xd705('0x4a')](_0x11cb42)[_0xd705('0x13')](handleEntityNotFound(_0x3f75ea,null))[_0xd705('0x13')](respondWithResult(_0x3f75ea,null))[_0xd705('0x1d')](handleError(_0x3f75ea,null));};exports[_0xd705('0x26')]=function(_0x4e9d87,_0x1aceed){if(_0x4e9d87[_0xd705('0x4b')]['id']){delete _0x4e9d87[_0xd705('0x4b')]['id'];}return db['MailMessage'][_0xd705('0x4a')]({'where':{'id':_0x4e9d87[_0xd705('0x48')]['id']}})[_0xd705('0x13')](handleEntityNotFound(_0x1aceed,null))[_0xd705('0x13')](saveUpdates(_0x4e9d87['body'],null))['then'](respondWithResult(_0x1aceed,null))[_0xd705('0x1d')](handleError(_0x1aceed,null));};exports[_0xd705('0x27')]=function(_0x314202,_0x1d4b39){return db[_0xd705('0x2e')]['find']({'where':{'id':_0x314202[_0xd705('0x48')]['id']}})[_0xd705('0x13')](handleEntityNotFound(_0x1d4b39,null))[_0xd705('0x13')](removeEntity(_0x1d4b39,null))[_0xd705('0x1d')](handleError(_0x1d4b39,null));};exports[_0xd705('0x4c')]=function(_0x373a0b,_0x20acde){return db[_0xd705('0x2e')]['describe']()[_0xd705('0x13')](respondWithResult(_0x20acde,null))[_0xd705('0x1d')](handleError(_0x20acde,null));};exports['create']=function(_0x313bce,_0x528a9a){return db[_0xd705('0x2e')][_0xd705('0x4d')](_0x313bce[_0xd705('0x4b')])[_0xd705('0x13')](function(_0x58e8ca){if(_0x58e8ca){if(_0x58e8ca['direction']===_0xd705('0x4e')&&!_0x58e8ca[_0xd705('0x4f')]){var _0x1b4fc0,_0x252168,_0x49a1da;if(_0x313bce[_0xd705('0x4b')]['to']){_0x252168=_0x313bce['body']['to'][_0xd705('0x50')](',')[0x0];}return db['MailAccount'][_0xd705('0x51')]({'where':{'id':_0x58e8ca[_0xd705('0x52')]},'include':[{'model':db[_0xd705('0x53')],'as':_0xd705('0x54'),'include':[{'model':db['CmContact'],'as':_0xd705('0x55'),'where':{'email':_0x252168},'limit':0x1,'order':[[_0xd705('0x56'),_0xd705('0x57')]]}]},{'model':db[_0xd705('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd705('0x59')],'as':_0xd705('0x59'),'raw':!![]}]}]})['then'](function(_0x48da7b){_0x1b4fc0=_0x48da7b;if(!_0x1b4fc0||!_0x1b4fc0[_0xd705('0x5a')])return;var _0x2f9c7c=_0x1b4fc0[_0xd705('0x5b')]();if(_0x313bce[_0xd705('0x4b')][_0xd705('0x5c')]&&_0x313bce[_0xd705('0x4b')][_0xd705('0x5c')][_0xd705('0x39')]){for(var _0x3bbb97=0x0;_0x3bbb97<_0x313bce[_0xd705('0x4b')]['attachments'][_0xd705('0x39')];_0x3bbb97+=0x1){_0x313bce['body'][_0xd705('0x5c')][_0x3bbb97]={'filename':_0x313bce[_0xd705('0x4b')][_0xd705('0x5c')][_0x3bbb97]['name'],'path':path[_0xd705('0x5d')](config[_0xd705('0x5e')],_0xd705('0x5f'),_0x313bce[_0xd705('0x4b')][_0xd705('0x5c')][_0x3bbb97][_0xd705('0x60')])};}}_0x49a1da={'account':_0x2f9c7c,'message':_0x313bce[_0xd705('0x4b')]};return;})[_0xd705('0x13')](function(){if(_0x1b4fc0[_0xd705('0x54')]){if(_0x1b4fc0[_0xd705('0x54')][_0xd705('0x55')][_0xd705('0x39')]){return _0x1b4fc0[_0xd705('0x54')]['Contacts'][0x0];}else{return db[_0xd705('0x61')][_0xd705('0x4d')](_[_0xd705('0xa')](_0x313bce[_0xd705('0x4b')],{'firstName':_0x313bce[_0xd705('0x4b')]['to'],'email':_0x313bce['body']['to'],'phone':_0x313bce[_0xd705('0x4b')]['to'],'ListId':_0x1b4fc0[_0xd705('0x62')]}));}}else{throw new Error(_0xd705('0x63'));}})['then'](function(){if(_0x49a1da){return respondWithRpcPromise(_0xd705('0x64'),'sendMail',_0x49a1da,client9003)['then'](function(_0x583447){return _0x58e8ca[_0xd705('0x26')]({'read':!![],'messageId':_0x583447[_0xd705('0x65')],'sentAt':moment()['format'](_0xd705('0x66'))});})[_0xd705('0x1d')](function(_0x5defda){logger[_0xd705('0x19')]('%s',JSON[_0xd705('0x18')](_0x5defda));return _0x58e8ca;});}return _0x58e8ca;});}return _0x58e8ca;}})[_0xd705('0x13')](respondWithResult(_0x528a9a,0xc9))['catch'](handleError(_0x528a9a,null));};exports[_0xd705('0x67')]=function(_0x38e766,_0x624a90){var _0x1a6f6c={'agent':{},'channel':'mail'};if(_0x38e766['body']['id']){delete _0x38e766[_0xd705('0x4b')]['id'];}_0x38e766[_0xd705('0x4b')]['read']=!![];_0x38e766[_0xd705('0x4b')][_0xd705('0x68')]=moment()['format'](_0xd705('0x66'));_0x38e766[_0xd705('0x4b')]['UserId']=_0x38e766[_0xd705('0x4b')][_0xd705('0x69')]||_0x38e766[_0xd705('0x6a')]['id'];_0x1a6f6c[_0xd705('0x6b')]['id']=_0x38e766['body'][_0xd705('0x69')];return db[_0xd705('0x2e')][_0xd705('0x4a')]({'where':{'id':_0x38e766[_0xd705('0x48')]['id'],'UserId':null}})[_0xd705('0x13')](handleEntityNotFound(_0x624a90,null))['then'](saveUpdates(_0x38e766[_0xd705('0x4b')],null))[_0xd705('0x13')](function(_0x37d58d){if(_0x37d58d){_0x1a6f6c['message']=_0x37d58d[_0xd705('0x6c')]({'plain':!![]});return db[_0xd705('0x6d')][_0xd705('0x4a')]({'where':{'id':_0x37d58d[_0xd705('0x6e')]}});}return null;})[_0xd705('0x13')](handleEntityNotFound(_0x624a90,null))[_0xd705('0x13')](function(_0x8ec3bf){if(_0x8ec3bf){return _0x8ec3bf[_0xd705('0x26')]({'UserId':_0x38e766[_0xd705('0x4b')][_0xd705('0x69')],'read1stAt':_['isNil'](_0x8ec3bf[_0xd705('0x6f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xdaae0){if(_0xdaae0){_0x1a6f6c[_0xd705('0x70')]=_0xdaae0[_0xd705('0x6c')]({'plain':!![]});interaction_log[_0xd705('0x14')](_0xd705('0x71'),_0x38e766[_0xd705('0x6a')]['id'],_0x38e766[_0xd705('0x6a')][_0xd705('0x2b')],_0x38e766[_0xd705('0x6a')][_0xd705('0x72')],_0x1a6f6c[_0xd705('0x70')]['id'],_0x38e766[_0xd705('0x4b')]?JSON[_0xd705('0x18')](_0x38e766['body']):_0xd705('0x73'));return respondWithRpcPromise(_0xd705('0x74'),_0xd705('0x75'),_0x1a6f6c);}return null;})[_0xd705('0x13')](function(_0x4d0351){var _0x272cd1=_0xd705('0x76')+_0x4d0351[_0xd705('0x1b')]['ContactId'];return db[_0xd705('0x77')][_0xd705('0x33')](_0x272cd1,{'type':db[_0xd705('0x78')]['QueryTypes']['SELECT'],'raw':!![]})[_0xd705('0x13')](function(_0x40c3c9){return _0x40c3c9;});})[_0xd705('0x13')](function(_0x134552){if(_0x134552){_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x79')]=_0x134552[0x0];if(!_0x38e766['body']['UserId'])return;return db[_0xd705('0x7a')][_0xd705('0x4a')]({'where':{'id':_0x38e766[_0xd705('0x4b')][_0xd705('0x69')],'role':_0xd705('0x6b')},'attributes':['id','name','fullname',_0xd705('0x7b'),_0xd705('0x7c')],'raw':!![]});}return null;})[_0xd705('0x13')](function(_0x5bfdce){if(!_0x5bfdce)return null;_0x1a6f6c['message'][_0xd705('0x6b')]=_0x5bfdce;return _0x1a6f6c;})[_0xd705('0x13')](function(_0x6586d1){if(_0x6586d1){if(_0x38e766['body']['manual']){_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x7d')]=util[_0xd705('0x7e')](_0xd705('0x7f'),_0x38e766[_0xd705('0x6a')][_0xd705('0x2b')]);_0x1a6f6c['message'][_0xd705('0x80')]=_0x1a6f6c[_0xd705('0x80')];_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x81')]=_0x1a6f6c[_0xd705('0x80')];_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x82')]=_0xd705('0x67');_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x4b')]=htmlToText[_0xd705('0x83')](_0x1a6f6c[_0xd705('0x1b')][_0xd705('0x4b')]);return respondWithRpcPromise(_0xd705('0x84'),_0xd705('0x84'),{'event':_0xd705('0x85'),'message':_0x1a6f6c['message']},client9002)[_0xd705('0x13')](function(){return _0x1a6f6c;});}return _0x1a6f6c;}return null;})[_0xd705('0x13')](respondWithResult(_0x624a90,null))['catch'](handleError(_0x624a90,null));};exports[_0xd705('0x86')]=function(_0x48d876,_0x29c946){var _0x2a2043={'agent':{},'channel':'mail'};if(_0x48d876[_0xd705('0x4b')]['id']){delete _0x48d876[_0xd705('0x4b')]['id'];}_0x48d876[_0xd705('0x4b')]['UserId']=_0x48d876['body'][_0xd705('0x69')]||_0x48d876[_0xd705('0x6a')]['id'];_0x2a2043[_0xd705('0x6b')]['id']=_0x48d876[_0xd705('0x4b')][_0xd705('0x69')];return db['MailMessage'][_0xd705('0x4a')]({'where':{'id':_0x48d876[_0xd705('0x48')]['id'],'UserId':null}})[_0xd705('0x13')](handleEntityNotFound(_0x29c946,null))[_0xd705('0x13')](function(_0x5d13bf){if(_0x5d13bf){_0x2a2043['message']=_0x5d13bf[_0xd705('0x6c')]({'plain':!![]});return db[_0xd705('0x6d')][_0xd705('0x4a')]({'where':{'id':_0x5d13bf['MailInteractionId']}});}return null;})[_0xd705('0x13')](handleEntityNotFound(_0x29c946,null))[_0xd705('0x13')](function(_0x564a66){if(_0x564a66){_0x2a2043[_0xd705('0x70')]=_0x564a66[_0xd705('0x6c')]({'plain':!![]});interaction_log[_0xd705('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48d876[_0xd705('0x6a')]['id'],_0x48d876['user'][_0xd705('0x2b')],_0x48d876[_0xd705('0x6a')][_0xd705('0x72')],_0x2a2043['interaction']['id'],_0x48d876[_0xd705('0x4b')]?JSON[_0xd705('0x18')](_0x48d876[_0xd705('0x4b')]):'null');return respondWithRpcPromise(_0xd705('0x87'),'rejectMessage',_0x2a2043);}return null;})['then'](function(_0x25b59c){var _0x7ad8b1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25b59c[_0xd705('0x1b')]['ContactId'];return db['sequelize'][_0xd705('0x33')](_0x7ad8b1,{'type':db[_0xd705('0x78')][_0xd705('0x88')][_0xd705('0x89')],'raw':!![]})[_0xd705('0x13')](function(_0xc99e69){return _0xc99e69;});})[_0xd705('0x13')](function(_0x442b9a){if(_0x442b9a){_0x2a2043[_0xd705('0x1b')]['contact']=_0x442b9a[0x0];if(!_0x48d876['body'][_0xd705('0x69')])return;return db['User']['find']({'where':{'id':_0x48d876[_0xd705('0x4b')][_0xd705('0x69')],'role':_0xd705('0x6b')},'attributes':['id',_0xd705('0x2b'),_0xd705('0x8a'),_0xd705('0x7b'),_0xd705('0x7c')],'raw':!![]});}return null;})[_0xd705('0x13')](function(_0x230926){if(!_0x230926)return null;_0x2a2043['message'][_0xd705('0x6b')]=_0x230926;return _0x2a2043;})[_0xd705('0x13')](function(_0x170abd){if(_0x170abd){_0x170abd[_0xd705('0x1b')][_0xd705('0x7d')]=util[_0xd705('0x7e')](_0xd705('0x7f'),_0x48d876[_0xd705('0x6a')]['name']);_0x170abd[_0xd705('0x1b')][_0xd705('0x80')]=_0x2a2043[_0xd705('0x80')];_0x170abd[_0xd705('0x1b')][_0xd705('0x81')]=_0x2a2043['channel'];_0x170abd[_0xd705('0x1b')]['event']=_0xd705('0x86');_0x170abd['message']['body']=htmlToText[_0xd705('0x83')](_0x2a2043[_0xd705('0x1b')][_0xd705('0x4b')]);respondWithRpcPromise(_0xd705('0x84'),'EventManager',{'event':_0xd705('0x8b'),'message':_0x170abd[_0xd705('0x1b')]},client9002);return _0x2a2043;}return null;})[_0xd705('0x13')](respondWithResult(_0x29c946,null))[_0xd705('0x1d')](handleError(_0x29c946,null));};exports[_0xd705('0x8c')]=function(_0x4cf142,_0x34dc25){var _0x1182ae=moment()[_0xd705('0x8d')]()[_0xd705('0x8e')]();var _0x61ada2=path[_0xd705('0x5d')](config['root'],_0xd705('0x8f'),'files','tmp');var _0x211b06=path[_0xd705('0x5d')](config[_0xd705('0x5e')],'server',_0xd705('0x90'),'attachments');var _0x523b7e=util[_0xd705('0x7e')](_0xd705('0x91'),_0x1182ae);return db[_0xd705('0x2e')][_0xd705('0x4a')]({'where':{'id':_0x4cf142[_0xd705('0x48')]['id']},'attributes':['id',_0xd705('0x4b'),_0xd705('0x92'),'to','cc',_0xd705('0x93'),_0xd705('0x94'),_0xd705('0x95')],'include':_0x4cf142[_0xd705('0x33')][_0xd705('0x5c')]?[{'model':db[_0xd705('0x96')],'as':_0xd705('0x97')}]:undefined})['then'](handleEntityNotFound(_0x34dc25,null))[_0xd705('0x13')](function(_0x3cda86){if(_0x3cda86){var _0x490654=_0x3cda86;var _0x3cddd7={'from':_0x490654[_0xd705('0x92')],'to':_0x490654['to'],'subject':_0x490654[_0xd705('0x94')],'html':htmlEntities[_0xd705('0x98')](_0x490654[_0xd705('0x4b')]),'headers':{'Date':moment(_0x490654[_0xd705('0x95')])[_0xd705('0x7e')](_0xd705('0x99'))},'attachments':[]};if(_0x3cda86['cc']){_0x3cddd7[_0xd705('0x9a')]['Cc']=_0x3cda86['cc'];}if(_0x3cda86[_0xd705('0x93')]){_0x3cddd7[_0xd705('0x9a')][_0xd705('0x9b')]=_0x3cda86[_0xd705('0x93')];}return new BPromise(function(_0x9d412b,_0x5452df){if(_0x3cda86[_0xd705('0x97')]){for(var _0x2528f9=0x0;_0x2528f9<_0x3cda86[_0xd705('0x97')][_0xd705('0x39')];_0x2528f9++){var _0x1dd5f8=_0x3cda86[_0xd705('0x97')][_0x2528f9];var _0x4e931f=path[_0xd705('0x5d')](_0x211b06,_0x1dd5f8[_0xd705('0x60')]);if(fs[_0xd705('0x9c')](_0x4e931f)){_0x3cddd7[_0xd705('0x5c')][_0xd705('0x9d')]({'name':_0x1dd5f8[_0xd705('0x2b')],'contentType':_0x1dd5f8['type'],'data':fs['readFileSync'](_0x4e931f)});}}}emlformat['build'](_0x3cddd7,function(_0x9f62da,_0x135874){if(_0x9f62da)return _0x5452df(_0x9f62da);fs[_0xd705('0x9e')](path[_0xd705('0x5d')](_0x61ada2,_0x523b7e),_0x135874);return _0x9d412b(_0x135874);});});}})['then'](function(_0x3f64b6){if(_0x3f64b6){return _0x34dc25['download'](path[_0xd705('0x5d')](_0x61ada2,_0x523b7e),_0x523b7e,function(_0x4201d0){if(!_0x4201d0)fs[_0xd705('0x9f')](path[_0xd705('0x5d')](_0x61ada2,_0x523b7e));});}})[_0xd705('0x1d')](handleError(_0x34dc25,null));}; \ No newline at end of file +var _0xbc1d=['Attachments','headers','Bcc','bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','offset','undefined','limit','count','set','destroy','end','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','include','find','update','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','download','join','server','files','tmp','message-%s.eml','from','subject','Attachment'];(function(_0x2c6717,_0x240ba5){var _0x5395f6=function(_0x4184c5){while(--_0x4184c5){_0x2c6717['push'](_0x2c6717['shift']());}};_0x5395f6(++_0x240ba5);}(_0xbc1d,0x1dd));var _0xdbc1=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xbc1d[_0x365be9];return _0x185c12;};'use strict';var emlformat=require(_0xdbc1('0x0'));var moment=require('moment');var BPromise=require(_0xdbc1('0x1'));var util=require(_0xdbc1('0x2'));var path=require(_0xdbc1('0x3'));var fs=require('fs');var _=require(_0xdbc1('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xdbc1('0x5'));var qs=require(_0xdbc1('0x6'));var logger=require('../../config/logger')(_0xdbc1('0x7'));var interaction_log=require(_0xdbc1('0x8'))('mail-interactions');var config=require(_0xdbc1('0x9'));var db=require(_0xdbc1('0xa'))['db'];config[_0xdbc1('0xb')]=_[_0xdbc1('0xc')](config[_0xdbc1('0xb')],{'host':_0xdbc1('0xd'),'port':0x18eb});var socket=require(_0xdbc1('0xe'))(new Redis(config[_0xdbc1('0xb')]));var htmlEntities=require(_0xdbc1('0xf'));require('./mailMessage.socket')[_0xdbc1('0x10')](socket);var jayson=require(_0xdbc1('0x11'));var client=jayson[_0xdbc1('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xdbc1('0x12')][_0xdbc1('0x13')]({'port':0x232b});var client9002=jayson[_0xdbc1('0x12')][_0xdbc1('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x296442,_0xabea69,_0x223c0c,_0x301013){return new BPromise(function(_0x328fd5,_0x359944){var _0x28bd0a=_0x301013||client;return _0x28bd0a[_0xdbc1('0x14')](_0x296442,_0x223c0c)[_0xdbc1('0x15')](function(_0x6329da){logger['info'](_0xdbc1('0x16'),_0xabea69,_0xdbc1('0x17'));logger['debug'](_0xdbc1('0x18'),_0xabea69,_0xdbc1('0x17'),JSON[_0xdbc1('0x19')](_0x6329da));if(_0x6329da[_0xdbc1('0x1a')]){if(_0x6329da[_0xdbc1('0x1a')][_0xdbc1('0x1b')]===0x1f4){logger[_0xdbc1('0x1a')](_0xdbc1('0x16'),_0xabea69,_0x6329da[_0xdbc1('0x1a')][_0xdbc1('0x1c')]);return _0x359944(_0x6329da[_0xdbc1('0x1a')][_0xdbc1('0x1c')]);}logger[_0xdbc1('0x1a')](_0xdbc1('0x16'),_0xabea69,_0x6329da[_0xdbc1('0x1a')][_0xdbc1('0x1c')]);return _0x328fd5(_0x6329da['error'][_0xdbc1('0x1c')]);}else{logger[_0xdbc1('0x1d')](_0xdbc1('0x16'),_0xabea69,_0xdbc1('0x17'));_0x328fd5(_0x6329da['result'][_0xdbc1('0x1c')]);}})[_0xdbc1('0x1e')](function(_0x48952d){logger[_0xdbc1('0x1a')](_0xdbc1('0x16'),_0xabea69,_0x48952d);_0x359944(_0x48952d);});});}function respondWithResult(_0x375bce,_0x67941a){_0x67941a=_0x67941a||0xc8;return function(_0x509331){if(_0x509331){return _0x375bce[_0xdbc1('0x1f')](_0x67941a)['json'](_0x509331);}};}function respondWithFilteredResult(_0x4a1508,_0x25a317){return function(_0x569aa8){if(_0x569aa8){var _0x275b6d=typeof _0x25a317[_0xdbc1('0x20')]===_0xdbc1('0x21')&&typeof _0x25a317[_0xdbc1('0x22')]===_0xdbc1('0x21');var _0x373007=_0x569aa8[_0xdbc1('0x23')];var _0x2b6112=_0x275b6d?0x0:_0x25a317[_0xdbc1('0x20')];var _0x37e0e6=_0x275b6d?_0x569aa8['count']:_0x25a317[_0xdbc1('0x20')]+_0x25a317[_0xdbc1('0x22')];var _0x4d9d8e;if(_0x37e0e6>=_0x373007){_0x37e0e6=_0x373007;_0x4d9d8e=0xc8;}else{_0x4d9d8e=0xce;}_0x4a1508[_0xdbc1('0x1f')](_0x4d9d8e);return _0x4a1508[_0xdbc1('0x24')]('Content-Range',_0x2b6112+'-'+_0x37e0e6+'/'+_0x373007)['json'](_0x569aa8);}return null;};}function saveUpdates(_0x442812){return function(_0x2f5342){if(_0x2f5342){return _0x2f5342['update'](_0x442812)[_0xdbc1('0x15')](function(_0x386c7c){return _0x386c7c;});}return null;};}function removeEntity(_0x2a339b){return function(_0x13c1a7){if(_0x13c1a7){return _0x13c1a7[_0xdbc1('0x25')]()[_0xdbc1('0x15')](function(){_0x2a339b[_0xdbc1('0x1f')](0xcc)[_0xdbc1('0x26')]();});}};}function handleEntityNotFound(_0x3a27ff){return function(_0x2cf6ba){if(!_0x2cf6ba){_0x3a27ff['sendStatus'](0x194);}return _0x2cf6ba;};}function handleError(_0x4718d5,_0x273140){_0x273140=_0x273140||0x1f4;return function(_0x5711a6){logger[_0xdbc1('0x1a')](_0x5711a6['stack']);if(_0x5711a6[_0xdbc1('0x27')]){delete _0x5711a6[_0xdbc1('0x27')];}_0x4718d5[_0xdbc1('0x1f')](_0x273140)[_0xdbc1('0x28')](_0x5711a6);};}exports[_0xdbc1('0x29')]=function(_0x391aaf,_0x1c1bf2){var _0x25a431={},_0x15cb1b={},_0x2efb78={'count':0x0,'rows':[]};var _0x4077ed=_[_0xdbc1('0x2a')](db[_0xdbc1('0x2b')][_0xdbc1('0x2c')],function(_0x119d98){return{'name':_0x119d98['fieldName'],'type':_0x119d98[_0xdbc1('0x2d')][_0xdbc1('0x2e')]};});_0x15cb1b['model']=_[_0xdbc1('0x2a')](_0x4077ed,_0xdbc1('0x27'));_0x15cb1b[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x391aaf['query']);_0x15cb1b[_0xdbc1('0x31')]=_[_0xdbc1('0x32')](_0x15cb1b[_0xdbc1('0x33')],_0x15cb1b[_0xdbc1('0x2f')]);_0x25a431['attributes']=_[_0xdbc1('0x32')](_0x15cb1b[_0xdbc1('0x33')],qs[_0xdbc1('0x34')](_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x34')]));_0x25a431['attributes']=_0x25a431[_0xdbc1('0x35')]['length']?_0x25a431[_0xdbc1('0x35')]:_0x15cb1b['model'];if(!_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x36')](_0xdbc1('0x37'))){_0x25a431[_0xdbc1('0x22')]=qs[_0xdbc1('0x22')](_0x391aaf[_0xdbc1('0x2f')]['limit']);_0x25a431[_0xdbc1('0x20')]=qs[_0xdbc1('0x20')](_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x20')]);}_0x25a431['order']=qs[_0xdbc1('0x38')](_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x38')]);_0x25a431[_0xdbc1('0x39')]=qs['filters'](_[_0xdbc1('0x3a')](_0x391aaf[_0xdbc1('0x2f')],_0x15cb1b[_0xdbc1('0x31')]),_0x4077ed);if(_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x3b')]){_0x25a431[_0xdbc1('0x39')]=_[_0xdbc1('0x3c')](_0x25a431[_0xdbc1('0x39')],{'$or':_[_0xdbc1('0x2a')](_0x4077ed,function(_0x36ee0f){if(_0x36ee0f['type']!==_0xdbc1('0x3d')){var _0x3fd6c1={};_0x3fd6c1[_0x36ee0f[_0xdbc1('0x27')]]={'$like':'%'+_0x391aaf[_0xdbc1('0x2f')][_0xdbc1('0x3b')]+'%'};return _0x3fd6c1;}})});}_0x25a431=_[_0xdbc1('0x3c')]({},_0x25a431,_0x391aaf[_0xdbc1('0x3e')]);var _0x4162bc={'where':_0x25a431['where']};return db['MailMessage'][_0xdbc1('0x23')](_0x4162bc)[_0xdbc1('0x15')](function(_0x28656d){_0x2efb78[_0xdbc1('0x23')]=_0x28656d;if(_0x391aaf['query'][_0xdbc1('0x3f')]){_0x25a431['include']=[{'all':!![]}];}return db[_0xdbc1('0x2b')]['findAll'](_0x25a431);})[_0xdbc1('0x15')](function(_0x32def6){_0x2efb78[_0xdbc1('0x40')]=_0x32def6;return _0x2efb78;})[_0xdbc1('0x15')](respondWithFilteredResult(_0x1c1bf2,_0x25a431))['catch'](handleError(_0x1c1bf2,null));};exports[_0xdbc1('0x41')]=function(_0x5936dd,_0x302f3a){var _0x10aa9e={'raw':!![],'where':{'id':_0x5936dd[_0xdbc1('0x42')]['id']}},_0xa79bd8={};_0xa79bd8[_0xdbc1('0x33')]=_[_0xdbc1('0x30')](db[_0xdbc1('0x2b')][_0xdbc1('0x2c')]);_0xa79bd8[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x5936dd['query']);_0xa79bd8[_0xdbc1('0x31')]=_[_0xdbc1('0x32')](_0xa79bd8['model'],_0xa79bd8[_0xdbc1('0x2f')]);_0x10aa9e['attributes']=_['intersection'](_0xa79bd8[_0xdbc1('0x33')],qs['fields'](_0x5936dd[_0xdbc1('0x2f')][_0xdbc1('0x34')]));_0x10aa9e[_0xdbc1('0x35')]=_0x10aa9e['attributes'][_0xdbc1('0x43')]?_0x10aa9e['attributes']:_0xa79bd8[_0xdbc1('0x33')];if(_0x5936dd[_0xdbc1('0x2f')][_0xdbc1('0x3f')]){_0x10aa9e[_0xdbc1('0x44')]=[{'all':!![]}];}_0x10aa9e=_['merge']({},_0x10aa9e,_0x5936dd[_0xdbc1('0x3e')]);return db[_0xdbc1('0x2b')][_0xdbc1('0x45')](_0x10aa9e)['then'](handleEntityNotFound(_0x302f3a,null))[_0xdbc1('0x15')](respondWithResult(_0x302f3a,null))[_0xdbc1('0x1e')](handleError(_0x302f3a,null));};exports[_0xdbc1('0x46')]=function(_0x4b8766,_0x4fe533){if(_0x4b8766['body']['id']){delete _0x4b8766[_0xdbc1('0x47')]['id'];}return db[_0xdbc1('0x2b')][_0xdbc1('0x45')]({'where':{'id':_0x4b8766['params']['id']}})[_0xdbc1('0x15')](handleEntityNotFound(_0x4fe533,null))['then'](saveUpdates(_0x4b8766[_0xdbc1('0x47')],null))[_0xdbc1('0x15')](respondWithResult(_0x4fe533,null))[_0xdbc1('0x1e')](handleError(_0x4fe533,null));};exports[_0xdbc1('0x25')]=function(_0x39905b,_0x579ff3){return db[_0xdbc1('0x2b')]['find']({'where':{'id':_0x39905b[_0xdbc1('0x42')]['id']}})[_0xdbc1('0x15')](handleEntityNotFound(_0x579ff3,null))['then'](removeEntity(_0x579ff3,null))['catch'](handleError(_0x579ff3,null));};exports[_0xdbc1('0x48')]=function(_0x7a22c4,_0x58c261){return db[_0xdbc1('0x2b')]['describe']()[_0xdbc1('0x15')](respondWithResult(_0x58c261,null))[_0xdbc1('0x1e')](handleError(_0x58c261,null));};exports['create']=function(_0x15f52e,_0x3a6309){return db[_0xdbc1('0x2b')][_0xdbc1('0x49')](_0x15f52e[_0xdbc1('0x47')])[_0xdbc1('0x15')](function(_0x42d137){if(_0x42d137){if(_0x42d137[_0xdbc1('0x4a')]===_0xdbc1('0x4b')&&!_0x42d137[_0xdbc1('0x4c')]){var _0x295dd4,_0x1faa0a,_0x34ed8b;if(_0x15f52e[_0xdbc1('0x47')]['to']){_0x1faa0a=_0x15f52e[_0xdbc1('0x47')]['to'][_0xdbc1('0x4d')](',')[0x0];}return db['MailAccount'][_0xdbc1('0x4e')]({'where':{'id':_0x42d137[_0xdbc1('0x4f')]},'include':[{'model':db[_0xdbc1('0x50')],'as':_0xdbc1('0x51'),'include':[{'model':db[_0xdbc1('0x52')],'as':_0xdbc1('0x53'),'where':{'email':_0x1faa0a},'limit':0x1,'order':[[_0xdbc1('0x54'),_0xdbc1('0x55')]]}]},{'model':db[_0xdbc1('0x56')],'as':_0xdbc1('0x57'),'raw':!![],'include':[{'model':db[_0xdbc1('0x58')],'as':_0xdbc1('0x58'),'raw':!![]}]}]})[_0xdbc1('0x15')](function(_0x369642){_0x295dd4=_0x369642;if(!_0x295dd4||!_0x295dd4[_0xdbc1('0x57')])return;var _0xbd6a65=_0x295dd4['getSmtpOptions']();if(_0x15f52e[_0xdbc1('0x47')][_0xdbc1('0x59')]&&_0x15f52e['body'][_0xdbc1('0x59')][_0xdbc1('0x43')]){for(var _0x2a94d8=0x0;_0x2a94d8<_0x15f52e['body'][_0xdbc1('0x59')][_0xdbc1('0x43')];_0x2a94d8+=0x1){_0x15f52e[_0xdbc1('0x47')][_0xdbc1('0x59')][_0x2a94d8]={'filename':_0x15f52e[_0xdbc1('0x47')]['attachments'][_0x2a94d8][_0xdbc1('0x27')],'path':path['join'](config[_0xdbc1('0x5a')],_0xdbc1('0x5b'),_0x15f52e[_0xdbc1('0x47')][_0xdbc1('0x59')][_0x2a94d8][_0xdbc1('0x5c')])};}}_0x34ed8b={'account':_0xbd6a65,'message':_0x15f52e['body']};return;})[_0xdbc1('0x15')](function(){if(_0x295dd4['List']){if(_0x295dd4['List'][_0xdbc1('0x53')][_0xdbc1('0x43')]){return _0x295dd4['List'][_0xdbc1('0x53')][0x0];}else{return db['CmContact'][_0xdbc1('0x49')](_[_0xdbc1('0xc')](_0x15f52e[_0xdbc1('0x47')],{'firstName':_0x15f52e['body']['to'],'email':_0x15f52e[_0xdbc1('0x47')]['to'],'phone':_0x15f52e['body']['to'],'ListId':_0x295dd4[_0xdbc1('0x5d')]}));}}else{throw new Error(_0xdbc1('0x5e'));}})['then'](function(){if(_0x34ed8b){return respondWithRpcPromise(_0xdbc1('0x5f'),_0xdbc1('0x60'),_0x34ed8b,client9003)[_0xdbc1('0x15')](function(_0xe13520){return _0x42d137[_0xdbc1('0x46')]({'read':!![],'messageId':_0xe13520[_0xdbc1('0x61')],'sentAt':moment()[_0xdbc1('0x62')](_0xdbc1('0x63'))});})[_0xdbc1('0x1e')](function(_0xcfebd5){logger[_0xdbc1('0x1a')]('%s',JSON[_0xdbc1('0x19')](_0xcfebd5));return _0x42d137;});}return _0x42d137;});}return _0x42d137;}})['then'](respondWithResult(_0x3a6309,0xc9))[_0xdbc1('0x1e')](handleError(_0x3a6309,null));};exports['accept']=function(_0x18f860,_0x4e1dec){var _0xd6d0c2={'agent':{},'channel':_0xdbc1('0x64')};if(_0x18f860[_0xdbc1('0x47')]['id']){delete _0x18f860[_0xdbc1('0x47')]['id'];}_0x18f860['body'][_0xdbc1('0x65')]=!![];_0x18f860['body'][_0xdbc1('0x66')]=moment()[_0xdbc1('0x62')](_0xdbc1('0x63'));_0x18f860['body']['UserId']=_0x18f860[_0xdbc1('0x47')][_0xdbc1('0x67')]||_0x18f860[_0xdbc1('0x68')]['id'];_0xd6d0c2[_0xdbc1('0x69')]['id']=_0x18f860[_0xdbc1('0x47')][_0xdbc1('0x67')];return db['MailMessage'][_0xdbc1('0x45')]({'where':{'id':_0x18f860[_0xdbc1('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e1dec,null))[_0xdbc1('0x15')](saveUpdates(_0x18f860[_0xdbc1('0x47')],null))['then'](function(_0x2e1d4d){if(_0x2e1d4d){_0xd6d0c2[_0xdbc1('0x1c')]=_0x2e1d4d[_0xdbc1('0x6a')]({'plain':!![]});return db[_0xdbc1('0x6b')]['find']({'where':{'id':_0x2e1d4d[_0xdbc1('0x6c')]}});}return null;})[_0xdbc1('0x15')](handleEntityNotFound(_0x4e1dec,null))[_0xdbc1('0x15')](function(_0x342eb0){if(_0x342eb0){return _0x342eb0[_0xdbc1('0x46')]({'UserId':_0x18f860['body']['UserId'],'read1stAt':_[_0xdbc1('0x6d')](_0x342eb0[_0xdbc1('0x6e')])?moment()[_0xdbc1('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdbc1('0x15')](function(_0x414d0e){if(_0x414d0e){_0xd6d0c2[_0xdbc1('0x6f')]=_0x414d0e[_0xdbc1('0x6a')]({'plain':!![]});interaction_log[_0xdbc1('0x1d')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18f860[_0xdbc1('0x68')]['id'],_0x18f860[_0xdbc1('0x68')][_0xdbc1('0x27')],_0x18f860[_0xdbc1('0x68')][_0xdbc1('0x70')],_0xd6d0c2['interaction']['id'],_0x18f860[_0xdbc1('0x47')]?JSON[_0xdbc1('0x19')](_0x18f860[_0xdbc1('0x47')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdbc1('0x71'),_0xd6d0c2);}return null;})[_0xdbc1('0x15')](function(_0x17b684){var _0xdf1514='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17b684[_0xdbc1('0x1c')][_0xdbc1('0x72')];return db[_0xdbc1('0x73')][_0xdbc1('0x2f')](_0xdf1514,{'type':db[_0xdbc1('0x74')][_0xdbc1('0x75')][_0xdbc1('0x76')],'raw':!![]})[_0xdbc1('0x15')](function(_0x5f0423){return _0x5f0423;});})[_0xdbc1('0x15')](function(_0x1b0022){if(_0x1b0022){_0xd6d0c2[_0xdbc1('0x1c')][_0xdbc1('0x77')]=_0x1b0022[0x0];if(!_0x18f860[_0xdbc1('0x47')][_0xdbc1('0x67')])return;return db[_0xdbc1('0x78')][_0xdbc1('0x45')]({'where':{'id':_0x18f860[_0xdbc1('0x47')][_0xdbc1('0x67')],'role':_0xdbc1('0x69')},'attributes':['id',_0xdbc1('0x27'),_0xdbc1('0x79'),_0xdbc1('0x7a'),_0xdbc1('0x7b')],'raw':!![]});}return null;})[_0xdbc1('0x15')](function(_0x3d2668){if(!_0x3d2668)return null;_0xd6d0c2[_0xdbc1('0x1c')]['agent']=_0x3d2668;return _0xd6d0c2;})[_0xdbc1('0x15')](function(_0x162b13){if(_0x162b13){if(_0x18f860[_0xdbc1('0x47')][_0xdbc1('0x7c')]){_0xd6d0c2['message']['interface']=util[_0xdbc1('0x62')](_0xdbc1('0x7d'),_0x18f860[_0xdbc1('0x68')][_0xdbc1('0x27')]);_0xd6d0c2[_0xdbc1('0x1c')]['channel']=_0xd6d0c2[_0xdbc1('0x7e')];_0xd6d0c2['message'][_0xdbc1('0x7f')]=_0xd6d0c2[_0xdbc1('0x7e')];_0xd6d0c2[_0xdbc1('0x1c')][_0xdbc1('0x80')]=_0xdbc1('0x81');_0xd6d0c2[_0xdbc1('0x1c')]['body']=htmlToText[_0xdbc1('0x82')](_0xd6d0c2[_0xdbc1('0x1c')][_0xdbc1('0x47')]);return respondWithRpcPromise(_0xdbc1('0x83'),_0xdbc1('0x83'),{'event':_0xdbc1('0x84'),'message':_0xd6d0c2['message']},client9002)[_0xdbc1('0x15')](function(){return _0xd6d0c2;});}return _0xd6d0c2;}return null;})['then'](respondWithResult(_0x4e1dec,null))[_0xdbc1('0x1e')](handleError(_0x4e1dec,null));};exports[_0xdbc1('0x85')]=function(_0x40417a,_0x270683){var _0x1de0d2={'agent':{},'channel':_0xdbc1('0x64')};if(_0x40417a[_0xdbc1('0x47')]['id']){delete _0x40417a[_0xdbc1('0x47')]['id'];}_0x40417a[_0xdbc1('0x47')][_0xdbc1('0x67')]=_0x40417a[_0xdbc1('0x47')][_0xdbc1('0x67')]||_0x40417a[_0xdbc1('0x68')]['id'];_0x1de0d2[_0xdbc1('0x69')]['id']=_0x40417a[_0xdbc1('0x47')][_0xdbc1('0x67')];return db[_0xdbc1('0x2b')][_0xdbc1('0x45')]({'where':{'id':_0x40417a[_0xdbc1('0x42')]['id'],'UserId':null}})[_0xdbc1('0x15')](handleEntityNotFound(_0x270683,null))[_0xdbc1('0x15')](function(_0x463a36){if(_0x463a36){_0x1de0d2['message']=_0x463a36[_0xdbc1('0x6a')]({'plain':!![]});return db[_0xdbc1('0x6b')][_0xdbc1('0x45')]({'where':{'id':_0x463a36['MailInteractionId']}});}return null;})[_0xdbc1('0x15')](handleEntityNotFound(_0x270683,null))[_0xdbc1('0x15')](function(_0x2fcfb4){if(_0x2fcfb4){_0x1de0d2[_0xdbc1('0x6f')]=_0x2fcfb4[_0xdbc1('0x6a')]({'plain':!![]});interaction_log[_0xdbc1('0x1d')](_0xdbc1('0x86'),_0x40417a[_0xdbc1('0x68')]['id'],_0x40417a[_0xdbc1('0x68')]['name'],_0x40417a[_0xdbc1('0x68')]['role'],_0x1de0d2['interaction']['id'],_0x40417a[_0xdbc1('0x47')]?JSON[_0xdbc1('0x19')](_0x40417a[_0xdbc1('0x47')]):_0xdbc1('0x87'));return respondWithRpcPromise(_0xdbc1('0x88'),'rejectMessage',_0x1de0d2);}return null;})[_0xdbc1('0x15')](function(_0x3178a8){var _0x4db1b0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3178a8['message'][_0xdbc1('0x72')];return db[_0xdbc1('0x73')][_0xdbc1('0x2f')](_0x4db1b0,{'type':db[_0xdbc1('0x74')]['QueryTypes'][_0xdbc1('0x76')],'raw':!![]})[_0xdbc1('0x15')](function(_0x47f13c){return _0x47f13c;});})[_0xdbc1('0x15')](function(_0x436035){if(_0x436035){_0x1de0d2[_0xdbc1('0x1c')]['contact']=_0x436035[0x0];if(!_0x40417a['body'][_0xdbc1('0x67')])return;return db[_0xdbc1('0x78')][_0xdbc1('0x45')]({'where':{'id':_0x40417a[_0xdbc1('0x47')][_0xdbc1('0x67')],'role':'agent'},'attributes':['id',_0xdbc1('0x27'),_0xdbc1('0x79'),'email',_0xdbc1('0x7b')],'raw':!![]});}return null;})[_0xdbc1('0x15')](function(_0x2aa36a){if(!_0x2aa36a)return null;_0x1de0d2[_0xdbc1('0x1c')][_0xdbc1('0x69')]=_0x2aa36a;return _0x1de0d2;})['then'](function(_0x36f50a){if(_0x36f50a){_0x36f50a['message'][_0xdbc1('0x89')]=util[_0xdbc1('0x62')](_0xdbc1('0x7d'),_0x40417a[_0xdbc1('0x68')]['name']);_0x36f50a[_0xdbc1('0x1c')]['channel']=_0x1de0d2[_0xdbc1('0x7e')];_0x36f50a['message']['motionChannel']=_0x1de0d2[_0xdbc1('0x7e')];_0x36f50a[_0xdbc1('0x1c')][_0xdbc1('0x80')]=_0xdbc1('0x85');_0x36f50a[_0xdbc1('0x1c')][_0xdbc1('0x47')]=htmlToText['fromString'](_0x1de0d2['message']['body']);respondWithRpcPromise(_0xdbc1('0x83'),_0xdbc1('0x83'),{'event':'rejectmessage','message':_0x36f50a[_0xdbc1('0x1c')]},client9002);return _0x1de0d2;}return null;})['then'](respondWithResult(_0x270683,null))[_0xdbc1('0x1e')](handleError(_0x270683,null));};exports[_0xdbc1('0x8a')]=function(_0x528486,_0x53c0fa){var _0x467a76=moment()['unix']()['toString']();var _0x16170d=path[_0xdbc1('0x8b')](config[_0xdbc1('0x5a')],_0xdbc1('0x8c'),_0xdbc1('0x8d'),_0xdbc1('0x8e'));var _0x4c8246=path['join'](config[_0xdbc1('0x5a')],_0xdbc1('0x8c'),'files','attachments');var _0x381d14=util[_0xdbc1('0x62')](_0xdbc1('0x8f'),_0x467a76);return db[_0xdbc1('0x2b')][_0xdbc1('0x45')]({'where':{'id':_0x528486[_0xdbc1('0x42')]['id']},'attributes':['id',_0xdbc1('0x47'),_0xdbc1('0x90'),'to','cc','bcc',_0xdbc1('0x91'),'createdAt'],'include':_0x528486[_0xdbc1('0x2f')][_0xdbc1('0x59')]?[{'model':db[_0xdbc1('0x92')],'as':_0xdbc1('0x93')}]:undefined})[_0xdbc1('0x15')](handleEntityNotFound(_0x53c0fa,null))[_0xdbc1('0x15')](function(_0x23ede3){if(_0x23ede3){var _0x103be1=_0x23ede3;var _0x8a43a7={'from':_0x103be1[_0xdbc1('0x90')],'to':_0x103be1['to'],'subject':_0x103be1['subject'],'html':htmlEntities['decode'](_0x103be1[_0xdbc1('0x47')]),'headers':{'Date':moment(_0x103be1['createdAt'])[_0xdbc1('0x62')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x23ede3['cc']){_0x8a43a7[_0xdbc1('0x94')]['Cc']=_0x23ede3['cc'];}if(_0x23ede3['bcc']){_0x8a43a7['headers'][_0xdbc1('0x95')]=_0x23ede3[_0xdbc1('0x96')];}return new BPromise(function(_0x3709cd,_0x222688){if(_0x23ede3[_0xdbc1('0x93')]){for(var _0xf91097=0x0;_0xf91097<_0x23ede3[_0xdbc1('0x93')][_0xdbc1('0x43')];_0xf91097++){var _0x35b31f=_0x23ede3[_0xdbc1('0x93')][_0xf91097];var _0xd56d45=path['join'](_0x4c8246,_0x35b31f['basename']);if(fs[_0xdbc1('0x97')](_0xd56d45)){_0x8a43a7[_0xdbc1('0x59')][_0xdbc1('0x98')]({'name':_0x35b31f['name'],'contentType':_0x35b31f['type'],'data':fs[_0xdbc1('0x99')](_0xd56d45)});}}}emlformat[_0xdbc1('0x9a')](_0x8a43a7,function(_0x3302b9,_0x1ca190){if(_0x3302b9)return _0x222688(_0x3302b9);fs[_0xdbc1('0x9b')](path['join'](_0x16170d,_0x381d14),_0x1ca190);return _0x3709cd(_0x1ca190);});});}})[_0xdbc1('0x15')](function(_0x3e0624){if(_0x3e0624){return _0x53c0fa[_0xdbc1('0x8a')](path[_0xdbc1('0x8b')](_0x16170d,_0x381d14),_0x381d14,function(_0x2710bd){if(!_0x2710bd)fs['unlinkSync'](path['join'](_0x16170d,_0x381d14));});}})['catch'](handleError(_0x53c0fa,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 2aee4ba..054ee09 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 _0x4d05=['hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x4d05,0x119));var _0x54d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d05[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x54d0('0x0'))['db'][_0x54d0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x54d0('0x2')](0x0);var events={'afterCreate':_0x54d0('0x3'),'afterUpdate':'update','afterDestroy':_0x54d0('0x4')};function emitEvent(_0x3fb25e){return function(_0x1d4275,_0x31d98e,_0xab443a){MailMessageEvents['emit'](_0x3fb25e+':'+_0x1d4275['id'],_0x1d4275);MailMessageEvents[_0x54d0('0x5')](_0x3fb25e,_0x1d4275);_0xab443a(null);};}for(var e in events){if(events[_0x54d0('0x6')](e)){var event=events[e];MailMessage[_0x54d0('0x7')](e,emitEvent(event));}}module[_0x54d0('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x0e7b=['hasOwnProperty','exports','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4c66e4,_0x5ccd98){var _0x30ed08=function(_0xf880d3){while(--_0xf880d3){_0x4c66e4['push'](_0x4c66e4['shift']());}};_0x30ed08(++_0x5ccd98);}(_0x0e7b,0x142));var _0xb0e7=function(_0x173ae9,_0x4ad05c){_0x173ae9=_0x173ae9-0x0;var _0x87ec6b=_0x0e7b[_0x173ae9];return _0x87ec6b;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xb0e7('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb0e7('0x1')](0x0);var events={'afterCreate':_0xb0e7('0x2'),'afterUpdate':_0xb0e7('0x3'),'afterDestroy':_0xb0e7('0x4')};function emitEvent(_0x323ec3){return function(_0x121e7b,_0x39f435,_0x56248a){MailMessageEvents[_0xb0e7('0x5')](_0x323ec3+':'+_0x121e7b['id'],_0x121e7b);MailMessageEvents[_0xb0e7('0x5')](_0x323ec3,_0x121e7b);_0x56248a(null);};}for(var e in events){if(events[_0xb0e7('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xb0e7('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9a65191..97af15f 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 _0x5126=['request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1f18d8,_0x2fec4c){var _0x1eb7f3=function(_0x59adf1){while(--_0x59adf1){_0x1f18d8['push'](_0x1f18d8['shift']());}};_0x1eb7f3(++_0x2fec4c);}(_0x5126,0x67));var _0x6512=function(_0x1e9719,_0x440125){_0x1e9719=_0x1e9719-0x0;var _0x5a1fbc=_0x5126[_0x1e9719];return _0x5a1fbc;};'use strict';var _=require(_0x6512('0x0'));var util=require(_0x6512('0x1'));var logger=require(_0x6512('0x2'))(_0x6512('0x3'));var moment=require('moment');var BPromise=require(_0x6512('0x4'));var rp=require(_0x6512('0x5'));var htmlToText=require(_0x6512('0x6'));var fs=require('fs');var path=require(_0x6512('0x7'));var rimraf=require(_0x6512('0x8'));var config=require(_0x6512('0x9'));var attributes=require('./mailMessage.attributes');module[_0x6512('0xa')]=function(_0xb122f2,_0x35d3f9){return _0xb122f2[_0x6512('0xb')](_0x6512('0xc'),attributes,{'tableName':_0x6512('0xd'),'paranoid':![],'indexes':[{'name':_0x6512('0xe'),'fields':[_0x6512('0xe')]},{'name':_0x6512('0xf'),'fields':[_0x6512('0x10'),_0x6512('0x11')],'type':_0x6512('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x286efe,_0x18eafd,_0x206b39){if(_0x286efe[_0x6512('0x13')]){_0x286efe['plainBody']=htmlToText[_0x6512('0x14')](_0x286efe[_0x6512('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x206b39(null,_0x18eafd);},'afterCreate':function(_0x560e53,_0x144fc7,_0x4ee749){var _0x3a1559=_0xb122f2[_0x6512('0x15')];var _0x2498a1=_0x560e53[_0x6512('0x16')]({'plain':!![]});if(_0x2498a1[_0x6512('0x17')][_0x6512('0x18')]()==='in'||_0x2498a1[_0x6512('0x17')][_0x6512('0x18')]()===_0x6512('0x19')&&!_0x2498a1[_0x6512('0x1a')]&&!_[_0x6512('0x1b')](_0x2498a1[_0x6512('0x1c')])){_0x3a1559[_0x6512('0x1d')][_0x6512('0x1e')]({'where':{'id':_0x2498a1['MailInteractionId']}})['then'](function(_0x5b8ba8){if(_0x5b8ba8){_0x5b8ba8[_0x6512('0x1f')]({'lastMsgAt':_0x2498a1[_0x6512('0x20')],'lastMsgDirection':_0x2498a1[_0x6512('0x17')][_0x6512('0x18')]()});}})[_0x6512('0x21')](function(_0x17886b){console[_0x6512('0x22')](_0x17886b);});}_0x4ee749();}},'charset':'utf8mb4','collate':_0x6512('0x23')});}; \ No newline at end of file +var _0xa1a1=['models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString'];(function(_0x1ff645,_0x3d461a){var _0x569648=function(_0x41a5d3){while(--_0x41a5d3){_0x1ff645['push'](_0x1ff645['shift']());}};_0x569648(++_0x3d461a);}(_0xa1a1,0x143));var _0x1a1a=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0xa1a1[_0x5400b];return _0x36a39b;};'use strict';var _=require('lodash');var util=require(_0x1a1a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1a1a('0x1'));var BPromise=require(_0x1a1a('0x2'));var rp=require(_0x1a1a('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1a1a('0x4'));var rimraf=require(_0x1a1a('0x5'));var config=require(_0x1a1a('0x6'));var attributes=require(_0x1a1a('0x7'));module['exports']=function(_0xf37212,_0x4cfa74){return _0xf37212[_0x1a1a('0x8')](_0x1a1a('0x9'),attributes,{'tableName':_0x1a1a('0xa'),'paranoid':![],'indexes':[{'name':_0x1a1a('0xb'),'fields':[_0x1a1a('0xb')]},{'name':_0x1a1a('0xc'),'fields':[_0x1a1a('0xd'),'subject'],'type':_0x1a1a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17448a,_0x51d63c,_0xcccc47){if(_0x17448a[_0x1a1a('0xf')]){_0x17448a[_0x1a1a('0xd')]=htmlToText[_0x1a1a('0x10')](_0x17448a[_0x1a1a('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xcccc47(null,_0x51d63c);},'afterCreate':function(_0x1ac1d0,_0xc93278,_0x39e1f7){var _0x3d27fc=_0xf37212[_0x1a1a('0x11')];var _0x53e644=_0x1ac1d0[_0x1a1a('0x12')]({'plain':!![]});if(_0x53e644['direction'][_0x1a1a('0x13')]()==='in'||_0x53e644[_0x1a1a('0x14')]['toLowerCase']()===_0x1a1a('0x15')&&!_0x53e644[_0x1a1a('0x16')]&&!_[_0x1a1a('0x17')](_0x53e644[_0x1a1a('0x18')])){_0x3d27fc[_0x1a1a('0x19')][_0x1a1a('0x1a')]({'where':{'id':_0x53e644[_0x1a1a('0x1b')]}})[_0x1a1a('0x1c')](function(_0x34d5a2){if(_0x34d5a2){_0x34d5a2[_0x1a1a('0x1d')]({'lastMsgAt':_0x53e644[_0x1a1a('0x1e')],'lastMsgDirection':_0x53e644['direction'][_0x1a1a('0x13')]()});}})[_0x1a1a('0x1f')](function(_0x1e591f){console[_0x1a1a('0x20')](_0x1e591f);});}_0x39e1f7();}},'charset':'utf8mb4','collate':_0x1a1a('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7d6c6ba..e2f3c7f 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 _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c3f69,_0x479606){var _0x4e9d3a=function(_0x592b83){while(--_0x592b83){_0x2c3f69['push'](_0x2c3f69['shift']());}};_0x4e9d3a(++_0x479606);}(_0x7d25,0x8a));var _0x57d2=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7d25[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file +var _0x430c=['ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','body','raw','CreateMailMessage','lodash','bluebird','randomstring'];(function(_0x21a6f0,_0x34f377){var _0x394ada=function(_0x523061){while(--_0x523061){_0x21a6f0['push'](_0x21a6f0['shift']());}};_0x394ada(++_0x34f377);}(_0x430c,0x1a1));var _0xc430=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x430c[_0x265aa2];return _0x447a3a;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});config['redis']=_[_0xc430('0x7')](config[_0xc430('0x8')],{'host':_0xc430('0x9'),'port':0x18eb});var socket=require(_0xc430('0xa'))(new Redis(config[_0xc430('0x8')]));require(_0xc430('0xb'))[_0xc430('0xc')](socket);function respondWithRpcPromise(_0x115814,_0x24737a,_0x5bbdf9){return new BPromise(function(_0x97fa5b,_0x2b47d6){return client['request'](_0x115814,_0x5bbdf9)[_0xc430('0xd')](function(_0x5aeed9){logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,_0xc430('0xf'));logger[_0xc430('0x10')](_0xc430('0x11'),_0x24737a,_0xc430('0xf'),JSON[_0xc430('0x12')](_0x5aeed9));if(_0x5aeed9[_0xc430('0x13')]){if(_0x5aeed9[_0xc430('0x13')]['code']===0x1f4){logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);return _0x2b47d6(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9['error']['message']);return _0x97fa5b(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}else{logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,'request\x20sent');_0x97fa5b(_0x5aeed9[_0xc430('0x16')]['message']);}})[_0xc430('0x17')](function(_0x4f7094){logger['error'](_0xc430('0x14'),_0x24737a,_0x4f7094);_0x2b47d6(_0x4f7094);});});}exports['CreateMailMessage']=function(_0x302926){var _0x1eae3b=this;return new Promise(function(_0x3eb888,_0x1f90bb){return db[_0xc430('0x18')]['create'](_0x302926[_0xc430('0x19')],{'raw':_0x302926['options']?_0x302926['options'][_0xc430('0x1a')]===undefined?!![]:![]:!![]})[_0xc430('0xd')](function(_0x3c7afa){logger['info'](_0xc430('0x1b'),_0x302926);logger['debug'](_0xc430('0x1b'),_0x302926,JSON[_0xc430('0x12')](_0x3c7afa));_0x3eb888(_0x3c7afa);})['catch'](function(_0x31b4f1){logger[_0xc430('0x13')]('CreateMailMessage',_0x31b4f1[_0xc430('0x15')],_0x302926);_0x1f90bb(_0x1eae3b['error'](0x1f4,_0x31b4f1[_0xc430('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dc0bac0..c41aa0f 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 _0x3eec=['mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x410cf8,_0x32616f){var _0x2846da=function(_0x20ea0e){while(--_0x20ea0e){_0x410cf8['push'](_0x410cf8['shift']());}};_0x2846da(++_0x32616f);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3af9dd,_0x9da8fe){_0x3af9dd=_0x3af9dd-0x0;var _0x409f95=_0x3eec[_0x3af9dd];return _0x409f95;};'use strict';var MailMessageEvents=require(_0xc3ee('0x0'));var events=[_0xc3ee('0x1'),_0xc3ee('0x2'),_0xc3ee('0x3')];function createListener(_0x484ade,_0x223d08){return function(_0x280209){_0x223d08[_0xc3ee('0x4')](_0x484ade,_0x280209);};}function removeListener(_0x35b2fb,_0x25074b){return function(){MailMessageEvents[_0xc3ee('0x5')](_0x35b2fb,_0x25074b);};}exports['register']=function(_0x471de7){for(var _0xbd5b6=0x0,_0xea4318=events[_0xc3ee('0x6')];_0xbd5b6<_0xea4318;_0xbd5b6++){var _0x356374=events[_0xbd5b6];var _0x3d74c0=createListener(_0xc3ee('0x7')+_0x356374,_0x471de7);MailMessageEvents['on'](_0x356374,_0x3d74c0);}}; \ No newline at end of file +var _0x08b8=['./mailMessage.events','save','update','emit','removeListener','length'];(function(_0x33305e,_0x731361){var _0x1bacc5=function(_0x11de0e){while(--_0x11de0e){_0x33305e['push'](_0x33305e['shift']());}};_0x1bacc5(++_0x731361);}(_0x08b8,0xf0));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x808b('0x0'));var events=[_0x808b('0x1'),'remove',_0x808b('0x2')];function createListener(_0x32c07c,_0x43bddc){return function(_0x37d729){_0x43bddc[_0x808b('0x3')](_0x32c07c,_0x37d729);};}function removeListener(_0x967ada,_0x3b5024){return function(){MailMessageEvents[_0x808b('0x4')](_0x967ada,_0x3b5024);};}exports['register']=function(_0x436cdd){for(var _0x526ebd=0x0,_0x572e17=events[_0x808b('0x5')];_0x526ebd<_0x572e17;_0x526ebd++){var _0x50d2ca=events[_0x526ebd];var _0x569296=createListener('mailMessage:'+_0x50d2ca,_0x436cdd);MailMessageEvents['on'](_0x50d2ca,_0x569296);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3b76288..58dc5cf 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 _0xea98=['delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','update','destroy'];(function(_0x3ac45c,_0x234181){var _0x5e9638=function(_0x3ddee0){while(--_0x3ddee0){_0x3ac45c['push'](_0x3ac45c['shift']());}};_0x5e9638(++_0x234181);}(_0xea98,0xed));var _0x8ea9=function(_0x2350dd,_0x53e293){_0x2350dd=_0x2350dd-0x0;var _0x5ca2db=_0xea98[_0x2350dd];return _0x5ca2db;};'use strict';var multer=require(_0x8ea9('0x0'));var util=require(_0x8ea9('0x1'));var path=require(_0x8ea9('0x2'));var timeout=require(_0x8ea9('0x3'));var express=require(_0x8ea9('0x4'));var router=express[_0x8ea9('0x5')]();var fs_extra=require(_0x8ea9('0x6'));var auth=require(_0x8ea9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea9('0x8'));var controller=require(_0x8ea9('0x9'));router[_0x8ea9('0xa')]('/',auth[_0x8ea9('0xb')](),controller['index']);router[_0x8ea9('0xa')](_0x8ea9('0xc'),auth[_0x8ea9('0xb')](),controller['describe']);router['get']('/:id',auth[_0x8ea9('0xb')](),controller[_0x8ea9('0xd')]);router['get'](_0x8ea9('0xe'),auth['isAuthenticated'](),controller[_0x8ea9('0xf')]);router['get'](_0x8ea9('0x10'),auth[_0x8ea9('0xb')](),controller['getTeams']);router[_0x8ea9('0xa')](_0x8ea9('0x11'),auth['isAuthenticated'](),controller[_0x8ea9('0x12')]);router[_0x8ea9('0x13')]('/',auth[_0x8ea9('0xb')](),controller[_0x8ea9('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x8ea9('0x13')](_0x8ea9('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x8ea9('0xb')](),controller[_0x8ea9('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8ea9('0x16')]);router[_0x8ea9('0x17')]('/:id/teams',auth[_0x8ea9('0xb')](),controller[_0x8ea9('0x18')]);router[_0x8ea9('0x17')](_0x8ea9('0x11'),auth['isAuthenticated'](),controller[_0x8ea9('0x19')]);module['exports']=router; \ No newline at end of file +var _0xac0e=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x54dfe2,_0x53befb){var _0x1064ae=function(_0x56544f){while(--_0x56544f){_0x54dfe2['push'](_0x54dfe2['shift']());}};_0x1064ae(++_0x53befb);}(_0xac0e,0x1da));var _0xeac0=function(_0x10e769,_0x542936){_0x10e769=_0x10e769-0x0;var _0x567667=_0xac0e[_0x10e769];return _0x567667;};'use strict';var multer=require(_0xeac0('0x0'));var util=require(_0xeac0('0x1'));var path=require('path');var timeout=require(_0xeac0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeac0('0x3'));var auth=require(_0xeac0('0x4'));var interaction=require(_0xeac0('0x5'));var config=require('../../config/environment');var controller=require(_0xeac0('0x6'));router['get']('/',auth[_0xeac0('0x7')](),controller[_0xeac0('0x8')]);router[_0xeac0('0x9')](_0xeac0('0xa'),auth[_0xeac0('0x7')](),controller[_0xeac0('0xb')]);router[_0xeac0('0x9')](_0xeac0('0xc'),auth[_0xeac0('0x7')](),controller[_0xeac0('0xd')]);router[_0xeac0('0x9')](_0xeac0('0xe'),auth[_0xeac0('0x7')](),controller[_0xeac0('0xf')]);router[_0xeac0('0x9')](_0xeac0('0x10'),auth[_0xeac0('0x7')](),controller[_0xeac0('0x11')]);router[_0xeac0('0x9')](_0xeac0('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xeac0('0x13')]('/',auth['isAuthenticated'](),controller[_0xeac0('0x14')]);router[_0xeac0('0x13')](_0xeac0('0x10'),auth[_0xeac0('0x7')](),controller['addTeams']);router[_0xeac0('0x13')](_0xeac0('0x12'),auth[_0xeac0('0x7')](),controller[_0xeac0('0x15')]);router[_0xeac0('0x16')](_0xeac0('0xc'),auth[_0xeac0('0x7')](),controller['update']);router[_0xeac0('0x17')](_0xeac0('0xc'),auth[_0xeac0('0x7')](),controller[_0xeac0('0x18')]);router['delete'](_0xeac0('0x10'),auth[_0xeac0('0x7')](),controller[_0xeac0('0x19')]);router['delete'](_0xeac0('0x12'),auth[_0xeac0('0x7')](),controller[_0xeac0('0x1a')]);module[_0xeac0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 78eec3f..fa53813 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 _0x7432=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x389f1b,_0x331a57){var _0x212167=function(_0x33cf46){while(--_0x33cf46){_0x389f1b['push'](_0x389f1b['shift']());}};_0x212167(++_0x331a57);}(_0x7432,0xe5));var _0x2743=function(_0x8ee598,_0x3d2099){_0x8ee598=_0x8ee598-0x0;var _0x4eb269=_0x7432[_0x8ee598];return _0x4eb269;};'use strict';var Sequelize=require(_0x2743('0x0'));module[_0x2743('0x1')]={'name':{'type':Sequelize[_0x2743('0x2')],'unique':_0x2743('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2743('0x4')](_0x2743('0x5'),'beepall',_0x2743('0x6'))}}; \ No newline at end of file +var _0x01da=['STRING','name','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2fba0c,_0x2cf2c0){var _0x263a96=function(_0x895beb){while(--_0x895beb){_0x2fba0c['push'](_0x2fba0c['shift']());}};_0x263a96(++_0x2cf2c0);}(_0x01da,0x178));var _0xa01d=function(_0x109bcf,_0x5c881f){_0x109bcf=_0x109bcf-0x0;var _0x2be921=_0x01da[_0x109bcf];return _0x2be921;};'use strict';var Sequelize=require(_0xa01d('0x0'));module[_0xa01d('0x1')]={'name':{'type':Sequelize[_0xa01d('0x2')],'unique':_0xa01d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa01d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa01d('0x4'),_0xa01d('0x5'),_0xa01d('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9170f07..e88593b 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 _0x5eec=['every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','send','map','MailQueue','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','create','body','user','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','describe','getMembers','findOne','UserMailQueue','User','UserId','agent','updatedAt','rows','format','%s/%s','mailPause','getTeams','ids','Team','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT'];(function(_0x51fa70,_0x50f589){var _0x422305=function(_0x9c6994){while(--_0x9c6994){_0x51fa70['push'](_0x51fa70['shift']());}};_0x422305(++_0x50f589);}(_0x5eec,0x11b));var _0xc5ee=function(_0xad3dd1,_0x1f09f3){_0xad3dd1=_0xad3dd1-0x0;var _0x30f74d=_0x5eec[_0xad3dd1];return _0x30f74d;};'use strict';var emlformat=require(_0xc5ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5ee('0x2'));var moment=require('moment');var BPromise=require(_0xc5ee('0x3'));var Mustache=require(_0xc5ee('0x4'));var util=require(_0xc5ee('0x5'));var path=require('path');var sox=require(_0xc5ee('0x6'));var csv=require('to-csv');var ejs=require(_0xc5ee('0x7'));var fs=require('fs');var fs_extra=require(_0xc5ee('0x8'));var _=require(_0xc5ee('0x9'));var squel=require('squel');var crypto=require(_0xc5ee('0xa'));var jsforce=require(_0xc5ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc5ee('0xc'));var querystring=require(_0xc5ee('0xd'));var Papa=require(_0xc5ee('0xe'));var Redis=require(_0xc5ee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc5ee('0x10'));var as=require(_0xc5ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5ee('0x12'))('api');var utils=require(_0xc5ee('0x13'));var config=require(_0xc5ee('0x14'));var licenseUtil=require(_0xc5ee('0x15'));var db=require(_0xc5ee('0x16'))['db'];config[_0xc5ee('0x17')]=_[_0xc5ee('0x18')](config[_0xc5ee('0x17')],{'host':_0xc5ee('0x19'),'port':0x18eb});var socket=require(_0xc5ee('0x1a'))(new Redis(config[_0xc5ee('0x17')]));require(_0xc5ee('0x1b'))[_0xc5ee('0x1c')](socket);function respondWithStatusCode(_0x40651a,_0x5125c0){_0x5125c0=_0x5125c0||0xcc;return function(_0xc34b9c){if(_0xc34b9c){return _0x40651a['sendStatus'](_0x5125c0);}return _0x40651a[_0xc5ee('0x1d')](_0x5125c0)[_0xc5ee('0x1e')]();};}function respondWithResult(_0x2e3c99,_0x2e97fa){_0x2e97fa=_0x2e97fa||0xc8;return function(_0x4d2de8){if(_0x4d2de8){return _0x2e3c99[_0xc5ee('0x1d')](_0x2e97fa)[_0xc5ee('0x1f')](_0x4d2de8);}};}function respondWithFilteredResult(_0x21d519,_0x4d2ae1){return function(_0x466387){if(_0x466387){var _0x363c16=typeof _0x4d2ae1[_0xc5ee('0x20')]===_0xc5ee('0x21')&&typeof _0x4d2ae1[_0xc5ee('0x22')]===_0xc5ee('0x21');var _0x511541=_0x466387['count'];var _0x251206=_0x363c16?0x0:_0x4d2ae1[_0xc5ee('0x20')];var _0x39f9a4=_0x363c16?_0x466387[_0xc5ee('0x23')]:_0x4d2ae1[_0xc5ee('0x20')]+_0x4d2ae1[_0xc5ee('0x22')];var _0x281aa8;if(_0x39f9a4>=_0x511541){_0x39f9a4=_0x511541;_0x281aa8=0xc8;}else{_0x281aa8=0xce;}_0x21d519[_0xc5ee('0x1d')](_0x281aa8);return _0x21d519[_0xc5ee('0x24')](_0xc5ee('0x25'),_0x251206+'-'+_0x39f9a4+'/'+_0x511541)[_0xc5ee('0x1f')](_0x466387);}return null;};}function patchUpdates(_0x4653ac){return function(_0x508fe3){try{jsonpatch[_0xc5ee('0x26')](_0x508fe3,_0x4653ac,!![]);}catch(_0xffc3e7){return BPromise[_0xc5ee('0x27')](_0xffc3e7);}return _0x508fe3[_0xc5ee('0x28')]();};}function saveUpdates(_0x4ca88e,_0x2bcdf7){return function(_0x525ca0){if(_0x525ca0){return _0x525ca0[_0xc5ee('0x29')](_0x4ca88e)[_0xc5ee('0x2a')](function(_0x59ae89){return _0x59ae89;});}return null;};}function removeEntity(_0x3d84ab,_0x259ecb){return function(_0x44c4c7){if(_0x44c4c7){return _0x44c4c7[_0xc5ee('0x2b')]()[_0xc5ee('0x2a')](function(){var _0x1a34a4=_0x44c4c7[_0xc5ee('0x2c')]({'plain':!![]});var _0x2823b2='MailQueues';return db['UserProfileResource'][_0xc5ee('0x2b')]({'where':{'type':_0x2823b2,'resourceId':_0x1a34a4['id']}})[_0xc5ee('0x2a')](function(){return _0x44c4c7;});})[_0xc5ee('0x2a')](function(){_0x3d84ab['status'](0xcc)[_0xc5ee('0x1e')]();});}};}function handleEntityNotFound(_0x8796af,_0x48c33e){return function(_0x5b4b94){if(!_0x5b4b94){_0x8796af[_0xc5ee('0x2d')](0x194);}return _0x5b4b94;};}function handleError(_0x2cc757,_0xfaf3da){_0xfaf3da=_0xfaf3da||0x1f4;return function(_0x5cdd07){logger[_0xc5ee('0x2e')](_0x5cdd07[_0xc5ee('0x2f')]);if(_0x5cdd07['name']){delete _0x5cdd07['name'];}_0x2cc757[_0xc5ee('0x1d')](_0xfaf3da)[_0xc5ee('0x30')](_0x5cdd07);};}exports['index']=function(_0x3575c2,_0x4f0d22){var _0x1cd188={},_0x123af4={},_0x2b5ba5={'count':0x0,'rows':[]};var _0xaa7901=_[_0xc5ee('0x31')](db[_0xc5ee('0x32')][_0xc5ee('0x33')],function(_0x1a21f){return{'name':_0x1a21f[_0xc5ee('0x34')],'type':_0x1a21f[_0xc5ee('0x35')]['key']};});_0x123af4[_0xc5ee('0x36')]=_[_0xc5ee('0x31')](_0xaa7901,_0xc5ee('0x37'));_0x123af4[_0xc5ee('0x38')]=_[_0xc5ee('0x39')](_0x3575c2[_0xc5ee('0x38')]);_0x123af4[_0xc5ee('0x3a')]=_['intersection'](_0x123af4[_0xc5ee('0x36')],_0x123af4[_0xc5ee('0x38')]);_0x1cd188[_0xc5ee('0x3b')]=_[_0xc5ee('0x3c')](_0x123af4['model'],qs[_0xc5ee('0x3d')](_0x3575c2[_0xc5ee('0x38')][_0xc5ee('0x3d')]));_0x1cd188['attributes']=_0x1cd188[_0xc5ee('0x3b')]['length']?_0x1cd188['attributes']:_0x123af4[_0xc5ee('0x36')];if(!_0x3575c2[_0xc5ee('0x38')][_0xc5ee('0x3e')](_0xc5ee('0x3f'))){_0x1cd188[_0xc5ee('0x22')]=qs[_0xc5ee('0x22')](_0x3575c2[_0xc5ee('0x38')][_0xc5ee('0x22')]);_0x1cd188['offset']=qs[_0xc5ee('0x20')](_0x3575c2[_0xc5ee('0x38')][_0xc5ee('0x20')]);}_0x1cd188[_0xc5ee('0x40')]=qs[_0xc5ee('0x41')](_0x3575c2[_0xc5ee('0x38')]['sort']);_0x1cd188[_0xc5ee('0x42')]=qs[_0xc5ee('0x3a')](_[_0xc5ee('0x43')](_0x3575c2[_0xc5ee('0x38')],_0x123af4[_0xc5ee('0x3a')]),_0xaa7901);if(_0x3575c2['query'][_0xc5ee('0x44')]){_0x1cd188[_0xc5ee('0x42')]=_[_0xc5ee('0x45')](_0x1cd188[_0xc5ee('0x42')],{'$or':_[_0xc5ee('0x31')](_0xaa7901,function(_0x1d47cd){if(_0x1d47cd[_0xc5ee('0x35')]!==_0xc5ee('0x46')){var _0x36e4d8={};_0x36e4d8[_0x1d47cd['name']]={'$like':'%'+_0x3575c2['query'][_0xc5ee('0x44')]+'%'};return _0x36e4d8;}})});}_0x1cd188=_[_0xc5ee('0x45')]({},_0x1cd188,_0x3575c2[_0xc5ee('0x47')]);var _0x5cd3b2={'where':_0x1cd188[_0xc5ee('0x42')]};return db[_0xc5ee('0x32')][_0xc5ee('0x23')](_0x5cd3b2)[_0xc5ee('0x2a')](function(_0x18d3a9){_0x2b5ba5[_0xc5ee('0x23')]=_0x18d3a9;if(_0x3575c2[_0xc5ee('0x38')][_0xc5ee('0x48')]){_0x1cd188[_0xc5ee('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0xc5ee('0x4a')](_0x1cd188);})[_0xc5ee('0x2a')](function(_0x11f342){_0x2b5ba5['rows']=_0x11f342;return _0x2b5ba5;})[_0xc5ee('0x2a')](respondWithFilteredResult(_0x4f0d22,_0x1cd188))['catch'](handleError(_0x4f0d22,null));};exports[_0xc5ee('0x4b')]=function(_0x2ec547,_0x38b561){var _0x4a9fad={'raw':!![],'where':{'id':_0x2ec547[_0xc5ee('0x4c')]['id']}},_0x29365a={};_0x29365a[_0xc5ee('0x36')]=_[_0xc5ee('0x39')](db[_0xc5ee('0x32')][_0xc5ee('0x33')]);_0x29365a[_0xc5ee('0x38')]=_[_0xc5ee('0x39')](_0x2ec547['query']);_0x29365a[_0xc5ee('0x3a')]=_[_0xc5ee('0x3c')](_0x29365a['model'],_0x29365a[_0xc5ee('0x38')]);_0x4a9fad[_0xc5ee('0x3b')]=_[_0xc5ee('0x3c')](_0x29365a['model'],qs[_0xc5ee('0x3d')](_0x2ec547[_0xc5ee('0x38')][_0xc5ee('0x3d')]));_0x4a9fad['attributes']=_0x4a9fad[_0xc5ee('0x3b')][_0xc5ee('0x4d')]?_0x4a9fad['attributes']:_0x29365a[_0xc5ee('0x36')];if(_0x2ec547[_0xc5ee('0x38')][_0xc5ee('0x48')]){_0x4a9fad[_0xc5ee('0x49')]=[{'all':!![]}];}_0x4a9fad=_['merge']({},_0x4a9fad,_0x2ec547[_0xc5ee('0x47')]);return db[_0xc5ee('0x32')]['find'](_0x4a9fad)['then'](handleEntityNotFound(_0x38b561,null))[_0xc5ee('0x2a')](respondWithResult(_0x38b561,null))['catch'](handleError(_0x38b561,null));};exports[_0xc5ee('0x4e')]=function(_0x300bed,_0x45d980){return db[_0xc5ee('0x32')][_0xc5ee('0x4e')](_0x300bed[_0xc5ee('0x4f')],{})[_0xc5ee('0x2a')](function(_0x54736d){var _0xdbbf4a=_0x300bed[_0xc5ee('0x50')][_0xc5ee('0x2c')]({'plain':!![]});if(!_0xdbbf4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdbbf4a['role']===_0xc5ee('0x50')){var _0x5b1fd5=_0x54736d[_0xc5ee('0x2c')]({'plain':!![]});var _0x29369b=_0xc5ee('0x51');return db[_0xc5ee('0x52')][_0xc5ee('0x53')]({'where':{'name':_0x29369b,'userProfileId':_0xdbbf4a[_0xc5ee('0x54')]},'raw':!![]})[_0xc5ee('0x2a')](function(_0x4b9a8a){if(_0x4b9a8a&&_0x4b9a8a[_0xc5ee('0x55')]===0x0){return db[_0xc5ee('0x56')][_0xc5ee('0x4e')]({'name':_0x5b1fd5[_0xc5ee('0x37')],'resourceId':_0x5b1fd5['id'],'type':_0x4b9a8a[_0xc5ee('0x37')],'sectionId':_0x4b9a8a['id']},{})[_0xc5ee('0x2a')](function(){return _0x54736d;});}else{return _0x54736d;}})[_0xc5ee('0x57')](function(_0x4faa04){logger[_0xc5ee('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4faa04);throw _0x4faa04;});}return _0x54736d;})[_0xc5ee('0x2a')](respondWithResult(_0x45d980,0xc9))[_0xc5ee('0x57')](handleError(_0x45d980,null));};exports[_0xc5ee('0x29')]=function(_0x4f492d,_0x56c6c7){if(_0x4f492d[_0xc5ee('0x4f')]['id']){delete _0x4f492d[_0xc5ee('0x4f')]['id'];}return db[_0xc5ee('0x32')][_0xc5ee('0x53')]({'where':{'id':_0x4f492d[_0xc5ee('0x4c')]['id']}})[_0xc5ee('0x2a')](handleEntityNotFound(_0x56c6c7,null))['then'](saveUpdates(_0x4f492d[_0xc5ee('0x4f')],null))[_0xc5ee('0x2a')](respondWithResult(_0x56c6c7,null))['catch'](handleError(_0x56c6c7,null));};exports['destroy']=function(_0xc65c2d,_0x59e77a){return db['MailQueue']['find']({'where':{'id':_0xc65c2d[_0xc5ee('0x4c')]['id']}})[_0xc5ee('0x2a')](handleEntityNotFound(_0x59e77a,null))[_0xc5ee('0x2a')](removeEntity(_0x59e77a,null))[_0xc5ee('0x57')](handleError(_0x59e77a,null));};exports[_0xc5ee('0x58')]=function(_0x5abcce,_0x47070f){return db[_0xc5ee('0x32')]['describe']()[_0xc5ee('0x2a')](respondWithResult(_0x47070f,null))['catch'](handleError(_0x47070f,null));};exports[_0xc5ee('0x59')]=function(_0x1729bc,_0x4ab4c2,_0x12ed6d){var _0x3ddf3b={'raw':!![],'where':{}},_0x4cee2a={},_0x3bd1af;return db['MailQueue'][_0xc5ee('0x5a')]({'where':{'id':_0x1729bc[_0xc5ee('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ab4c2,null))[_0xc5ee('0x2a')](function(_0x40218e){if(_0x40218e){_0x3bd1af=_0x40218e[_0xc5ee('0x2c')]({'plain':!![]});_0x4cee2a[_0xc5ee('0x36')]=_[_0xc5ee('0x39')](db[_0xc5ee('0x5b')]['rawAttributes']);_0x4cee2a[_0xc5ee('0x38')]=_[_0xc5ee('0x39')](_0x1729bc['query']);_0x4cee2a[_0xc5ee('0x3a')]=_['intersection'](_0x4cee2a[_0xc5ee('0x36')],_0x4cee2a[_0xc5ee('0x38')]);_0x3ddf3b['attributes']=_['intersection'](_0x4cee2a[_0xc5ee('0x36')],qs[_0xc5ee('0x3d')](_0x1729bc[_0xc5ee('0x38')][_0xc5ee('0x3d')]));_0x3ddf3b[_0xc5ee('0x3b')]=_0x3ddf3b[_0xc5ee('0x3b')][_0xc5ee('0x4d')]?_0x3ddf3b[_0xc5ee('0x3b')]:_0x4cee2a['model'];if(!_0x1729bc[_0xc5ee('0x38')][_0xc5ee('0x3e')]('nolimit')){_0x3ddf3b['limit']=qs['limit'](_0x1729bc[_0xc5ee('0x38')][_0xc5ee('0x22')]);_0x3ddf3b[_0xc5ee('0x20')]=qs[_0xc5ee('0x20')](_0x1729bc[_0xc5ee('0x38')][_0xc5ee('0x20')]);}_0x3ddf3b['order']=qs[_0xc5ee('0x41')](_0x1729bc['query'][_0xc5ee('0x41')]);_0x3ddf3b[_0xc5ee('0x42')]=qs[_0xc5ee('0x3a')](_['pick'](_0x1729bc[_0xc5ee('0x38')],_0x4cee2a[_0xc5ee('0x3a')]));_0x3ddf3b[_0xc5ee('0x42')]['MailQueueId']=_0x40218e['id'];if(_0x1729bc['query']['filter']){_0x3ddf3b[_0xc5ee('0x42')]=_[_0xc5ee('0x45')](_0x3ddf3b['where'],{'$or':_[_0xc5ee('0x31')](_0x3ddf3b[_0xc5ee('0x3b')],function(_0x3fb025){var _0x479065={};_0x479065[_0x3fb025]={'$like':'%'+_0x1729bc['query'][_0xc5ee('0x44')]+'%'};return _0x479065;})});}_0x3ddf3b=_[_0xc5ee('0x45')]({},_0x3ddf3b,_0x1729bc[_0xc5ee('0x47')]);return db[_0xc5ee('0x5b')][_0xc5ee('0x4a')](_0x3ddf3b);}})['then'](function(_0xbbfd55){if(_0xbbfd55){return db[_0xc5ee('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0xbbfd55,_0xc5ee('0x5d')),'role':_0xc5ee('0x5e')},'attributes':['id',_0xc5ee('0x37'),'mailPause',_0xc5ee('0x5f'),'createdAt']});}})['then'](function(_0x5436e0){if(_0x5436e0){return{'count':_0x5436e0['count'],'rows':_['map'](_0x5436e0[_0xc5ee('0x60')],function(_0x4b1ce9){return{'membername':_0x4b1ce9['name'],'UserId':_0x4b1ce9['id'],'queue_name':_0x3bd1af[_0xc5ee('0x37')],'MailQueueId':_0x3bd1af['id'],'interface':util[_0xc5ee('0x61')](_0xc5ee('0x62'),'SIP',_0x4b1ce9['name']),'penalty':0x0,'paused':_0x4b1ce9[_0xc5ee('0x63')],'createdAt':_0x4b1ce9['createdAt'],'updatedAt':_0x4b1ce9[_0xc5ee('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5ee('0x2a')](respondWithFilteredResult(_0x4ab4c2,_0x3ddf3b))[_0xc5ee('0x57')](handleError(_0x4ab4c2,null));};exports['getTeams']=function(_0x1353b4,_0xa0f522,_0x582e28){var _0x431819={};var _0xb4340a={};var _0x539724;var _0x1a1666;return db['MailQueue'][_0xc5ee('0x5a')]({'where':{'id':_0x1353b4['params']['id']}})[_0xc5ee('0x2a')](handleEntityNotFound(_0xa0f522,null))[_0xc5ee('0x2a')](function(_0x130877){if(_0x130877){_0x539724=_0x130877;_0xb4340a['model']=_[_0xc5ee('0x39')](db['Team'][_0xc5ee('0x33')]);_0xb4340a[_0xc5ee('0x38')]=_[_0xc5ee('0x39')](_0x1353b4[_0xc5ee('0x38')]);_0xb4340a[_0xc5ee('0x3a')]=_[_0xc5ee('0x3c')](_0xb4340a[_0xc5ee('0x36')],_0xb4340a[_0xc5ee('0x38')]);_0x431819['attributes']=_[_0xc5ee('0x3c')](_0xb4340a[_0xc5ee('0x36')],qs['fields'](_0x1353b4[_0xc5ee('0x38')][_0xc5ee('0x3d')]));_0x431819[_0xc5ee('0x3b')]=_0x431819[_0xc5ee('0x3b')]['length']?_0x431819[_0xc5ee('0x3b')]:_0xb4340a[_0xc5ee('0x36')];_0x431819[_0xc5ee('0x40')]=qs['sort'](_0x1353b4[_0xc5ee('0x38')][_0xc5ee('0x41')]);_0x431819[_0xc5ee('0x42')]=qs[_0xc5ee('0x3a')](_[_0xc5ee('0x43')](_0x1353b4[_0xc5ee('0x38')],_0xb4340a[_0xc5ee('0x3a')]));if(_0x1353b4[_0xc5ee('0x38')]['filter']){_0x431819['where']=_[_0xc5ee('0x45')](_0x431819[_0xc5ee('0x42')],{'$or':_[_0xc5ee('0x31')](_0x431819[_0xc5ee('0x3b')],function(_0x49151c){var _0x110ef7={};_0x110ef7[_0x49151c]={'$like':'%'+_0x1353b4[_0xc5ee('0x38')][_0xc5ee('0x44')]+'%'};return _0x110ef7;})});}_0x431819=_[_0xc5ee('0x45')]({},_0x431819,_0x1353b4['options']);return _0x539724[_0xc5ee('0x64')](_0x431819);}})[_0xc5ee('0x2a')](function(_0x31a5d7){if(_0x31a5d7){_0x1a1666=_0x31a5d7[_0xc5ee('0x4d')];if(!_0x1353b4[_0xc5ee('0x38')][_0xc5ee('0x3e')](_0xc5ee('0x3f'))){_0x431819['limit']=qs[_0xc5ee('0x22')](_0x1353b4[_0xc5ee('0x38')]['limit']);_0x431819['offset']=qs['offset'](_0x1353b4['query'][_0xc5ee('0x20')]);}return _0x539724[_0xc5ee('0x64')](_0x431819);}})[_0xc5ee('0x2a')](function(_0x525acd){if(_0x525acd){return _0x525acd?{'count':_0x1a1666,'rows':_0x525acd}:null;}})['then'](respondWithResult(_0xa0f522,null))[_0xc5ee('0x57')](handleError(_0xa0f522,null));};exports['addTeams']=function(_0x2c5001,_0x258343,_0x438135){var _0x196f6b=_0x2c5001[_0xc5ee('0x4f')][_0xc5ee('0x65')];return db[_0xc5ee('0x66')][_0xc5ee('0x4a')]({'where':{'id':_0x196f6b},'attributes':['id'],'include':[{'model':db[_0xc5ee('0x5c')],'as':_0xc5ee('0x67'),'attributes':['id',_0xc5ee('0x37'),'online','voicePause','interface'],'raw':!![]}]})[_0xc5ee('0x2a')](function(_0x2121f1){if(_0x2121f1){var _0x45f36b=_['flatMap'](_0x2121f1,function(_0x41d136){var _0x14a641=_0x41d136['get']({'plain':!![]});return _0x14a641[_0xc5ee('0x67')];});return db[_0xc5ee('0x32')][_0xc5ee('0x53')]({'where':{'id':_0x2c5001['params']['id']}})[_0xc5ee('0x2a')](function(_0x490321){return db[_0xc5ee('0x68')][_0xc5ee('0x69')](function(_0x2d3a23){return _0x490321['addTeams'](_0x196f6b,{'transaction':_0x2d3a23})[_0xc5ee('0x2a')](function(){return BPromise[_0xc5ee('0x6a')](_0x45f36b,function(_0xf60dd1){return db[_0xc5ee('0x5b')][_0xc5ee('0x6b')]({'where':{'UserId':_0xf60dd1['id'],'MailQueueId':_0x2c5001[_0xc5ee('0x4c')]['id']},'transaction':_0x2d3a23});});})[_0xc5ee('0x2a')](function(){_0x45f36b[_0xc5ee('0x6c')](function(_0x5e9690){socket[_0xc5ee('0x6d')](_0xc5ee('0x6e'),{'UserId':_0x5e9690['id'],'MailQueueId':_0x490321['id']});});});});});}})[_0xc5ee('0x2a')](respondWithStatusCode(_0x258343,null))['catch'](handleError(_0x258343,null));};exports[_0xc5ee('0x6f')]=function(_0x401002,_0x94162d,_0x3d4631){return db['Team'][_0xc5ee('0x4a')]({'where':{'id':_0x401002[_0xc5ee('0x38')][_0xc5ee('0x65')]},'attributes':['id'],'include':[{'model':db[_0xc5ee('0x5c')],'as':_0xc5ee('0x67'),'attributes':['id'],'raw':!![]}]})[_0xc5ee('0x2a')](handleEntityNotFound(_0x94162d,null))[_0xc5ee('0x2a')](function(_0x41d58f){var _0x44a328=_['map'](_0x41d58f,'id');var _0x3ad855=[];var _0x30dd70=[];var _0x1353a1=squel[_0xc5ee('0x70')]();_0x1353a1['field'](_0xc5ee('0x71'))['from'](_0xc5ee('0x72'),'tq')[_0xc5ee('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc5ee('0x42')](_0xc5ee('0x74'),_0x401002[_0xc5ee('0x4c')]['id']);for(var _0x100da3=0x0;_0x100da3<_0x41d58f['length'];_0x100da3+=0x1){let _0xd2e31a=_0x41d58f[_0x100da3];for(var _0x38865f=0x0;_0x38865f<_0xd2e31a[_0xc5ee('0x67')][_0xc5ee('0x4d')];_0x38865f+=0x1){let _0x3020c0=_0xd2e31a[_0xc5ee('0x67')][_0x38865f];var _0x273136=_0x1353a1[_0xc5ee('0x75')]();_0x273136[_0xc5ee('0x42')](_0xc5ee('0x76'),_0x3020c0['id']);_0x30dd70[_0xc5ee('0x77')](db[_0xc5ee('0x68')][_0xc5ee('0x38')](_0x273136[_0xc5ee('0x78')](),{'type':db[_0xc5ee('0x68')]['QueryTypes'][_0xc5ee('0x79')]})[_0xc5ee('0x2a')](function(_0x444c54){if(_0x444c54[_0xc5ee('0x4d')]===0x1){return _0x3020c0['id'];}else{var _0xb68af6=_[_0xc5ee('0x7a')](_[_0xc5ee('0x31')](_0x444c54,'TeamId'),function(_0x514a33){return _[_0xc5ee('0x7b')](_0x44a328,_0x514a33);});if(_0xb68af6){return _0x3020c0['id'];}}}));}}return BPromise[_0xc5ee('0x7c')](_0x30dd70)[_0xc5ee('0x2a')](function(_0x4843a3){_0x3ad855=_(_0x3ad855)[_0xc5ee('0x7d')](_0x4843a3)[_0xc5ee('0x7e')]()[_0xc5ee('0x7f')]();return db[_0xc5ee('0x32')][_0xc5ee('0x53')]({'where':{'id':_0x401002[_0xc5ee('0x4c')]['id']}})[_0xc5ee('0x2a')](function(_0x53333d){return db[_0xc5ee('0x68')][_0xc5ee('0x69')](function(_0x1034ef){return _0x53333d['removeTeams'](_0x401002[_0xc5ee('0x38')][_0xc5ee('0x65')],{'transaction':_0x1034ef})['then'](function(){if(!_[_0xc5ee('0x80')](_0x3ad855)){return _0x53333d[_0xc5ee('0x81')](_0x3ad855,{'transaction':_0x1034ef});}})['then'](function(){_0x3ad855[_0xc5ee('0x6c')](function(_0x348205){socket[_0xc5ee('0x6d')](_0xc5ee('0x82'),{'UserId':_0x348205,'MailQueueId':_0x53333d['id']});});});});});});})['then'](respondWithStatusCode(_0x94162d,null))['catch'](handleError(_0x94162d,null));};exports[_0xc5ee('0x83')]=function(_0x1a5e86,_0x5bcb49,_0x25bbfe){return db['MailQueue'][_0xc5ee('0x53')]({'where':{'id':_0x1a5e86[_0xc5ee('0x4c')]['id']}})[_0xc5ee('0x2a')](handleEntityNotFound(_0x5bcb49,null))['then'](function(_0x34826a){if(_0x34826a){return _0x34826a['addAgents'](_0x1a5e86[_0xc5ee('0x4f')]['ids'],_[_0xc5ee('0x84')](_0x1a5e86[_0xc5ee('0x4f')],['ids','id'])||{})['spread'](function(_0x16e965){for(var _0x2d9c41=0x0;_0x2d9c41<_0x1a5e86[_0xc5ee('0x4f')]['ids']['length'];_0x2d9c41+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x1a5e86[_0xc5ee('0x4f')][_0xc5ee('0x65')][_0x2d9c41]),'MailQueueId':Number(_0x1a5e86['params']['id'])});}return _0x16e965;});}})[_0xc5ee('0x2a')](respondWithResult(_0x5bcb49,null))[_0xc5ee('0x57')](handleError(_0x5bcb49,null));};exports[_0xc5ee('0x81')]=function(_0xf77e5d,_0x220743,_0x7f5ea7){return db['MailQueue'][_0xc5ee('0x53')]({'where':{'id':_0xf77e5d[_0xc5ee('0x4c')]['id']}})['then'](handleEntityNotFound(_0x220743,null))[_0xc5ee('0x2a')](function(_0x5bcd36){if(_0x5bcd36){return _0x5bcd36['removeAgents'](_0xf77e5d[_0xc5ee('0x38')][_0xc5ee('0x65')])[_0xc5ee('0x2a')](function(){if(_[_0xc5ee('0x85')](_0xf77e5d['query'][_0xc5ee('0x65')])){for(var _0x440465=0x0;_0x440465<_0xf77e5d[_0xc5ee('0x38')][_0xc5ee('0x65')]['length'];_0x440465+=0x1){socket[_0xc5ee('0x6d')](_0xc5ee('0x82'),{'UserId':Number(_0xf77e5d[_0xc5ee('0x38')]['ids'][_0x440465]),'MailQueueId':Number(_0xf77e5d[_0xc5ee('0x4c')]['id'])});}}else{socket[_0xc5ee('0x6d')](_0xc5ee('0x82'),{'UserId':Number(_0xf77e5d['query'][_0xc5ee('0x65')]),'MailQueueId':Number(_0xf77e5d[_0xc5ee('0x4c')]['id'])});}});}})[_0xc5ee('0x2a')](respondWithStatusCode(_0x220743,null))['catch'](handleError(_0x220743,null));};exports[_0xc5ee('0x86')]=function(_0x3570a3,_0x308a92,_0x4eddda){var _0x559278={};var _0x245eb7={};var _0x48aa27;var _0x5adb85;return db[_0xc5ee('0x32')][_0xc5ee('0x5a')]({'where':{'id':_0x3570a3[_0xc5ee('0x4c')]['id']}})[_0xc5ee('0x2a')](handleEntityNotFound(_0x308a92,null))[_0xc5ee('0x2a')](function(_0x49b097){if(_0x49b097){_0x48aa27=_0x49b097;_0x245eb7[_0xc5ee('0x36')]=_['keys'](db[_0xc5ee('0x5c')][_0xc5ee('0x33')]);_0x245eb7['query']=_[_0xc5ee('0x39')](_0x3570a3[_0xc5ee('0x38')]);_0x245eb7['filters']=_[_0xc5ee('0x3c')](_0x245eb7[_0xc5ee('0x36')],_0x245eb7[_0xc5ee('0x38')]);_0x559278[_0xc5ee('0x3b')]=_['intersection'](_0x245eb7[_0xc5ee('0x36')],qs[_0xc5ee('0x3d')](_0x3570a3[_0xc5ee('0x38')][_0xc5ee('0x3d')]));_0x559278['attributes']=_0x559278['attributes'][_0xc5ee('0x4d')]?_0x559278[_0xc5ee('0x3b')]:_0x245eb7['model'];_0x559278[_0xc5ee('0x40')]=qs[_0xc5ee('0x41')](_0x3570a3[_0xc5ee('0x38')]['sort']);_0x559278[_0xc5ee('0x42')]=qs[_0xc5ee('0x3a')](_[_0xc5ee('0x43')](_0x3570a3[_0xc5ee('0x38')],_0x245eb7[_0xc5ee('0x3a')]));if(_0x3570a3[_0xc5ee('0x38')][_0xc5ee('0x44')]){_0x559278[_0xc5ee('0x42')]=_[_0xc5ee('0x45')](_0x559278[_0xc5ee('0x42')],{'$or':_[_0xc5ee('0x31')](_0x559278[_0xc5ee('0x3b')],function(_0x3f9067){var _0x49d382={};_0x49d382[_0x3f9067]={'$like':'%'+_0x3570a3['query']['filter']+'%'};return _0x49d382;})});}_0x559278=_[_0xc5ee('0x45')]({},_0x559278,_0x3570a3['options']);return _0x48aa27['getAgents'](_0x559278);}})['then'](function(_0x251929){if(_0x251929){_0x5adb85=_0x251929[_0xc5ee('0x4d')];if(!_0x3570a3[_0xc5ee('0x38')][_0xc5ee('0x3e')](_0xc5ee('0x3f'))){_0x559278[_0xc5ee('0x22')]=qs['limit'](_0x3570a3[_0xc5ee('0x38')][_0xc5ee('0x22')]);_0x559278['offset']=qs[_0xc5ee('0x20')](_0x3570a3['query'][_0xc5ee('0x20')]);}return _0x48aa27[_0xc5ee('0x86')](_0x559278);}})[_0xc5ee('0x2a')](function(_0x48a5f2){if(_0x48a5f2){return _0x48a5f2?{'count':_0x5adb85,'rows':_0x48a5f2}:null;}})[_0xc5ee('0x2a')](respondWithResult(_0x308a92,null))[_0xc5ee('0x57')](handleError(_0x308a92,null));}; \ No newline at end of file +var _0x066a=['transaction','isEmpty','userMailQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','UserProfileResource','destroy','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','length','findAll','User','findAndCountAll','UserId','agent','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','forEach','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x066a,0x9b));var _0xa066=function(_0x376f22,_0x304f46){_0x376f22=_0x376f22-0x0;var _0x3ef2d8=_0x066a[_0x376f22];return _0x3ef2d8;};'use strict';var emlformat=require(_0xa066('0x0'));var rimraf=require(_0xa066('0x1'));var zipdir=require(_0xa066('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa066('0x3'));var moment=require(_0xa066('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa066('0x5'));var util=require('util');var path=require(_0xa066('0x6'));var sox=require(_0xa066('0x7'));var csv=require(_0xa066('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa066('0x9'));var _=require(_0xa066('0xa'));var squel=require(_0xa066('0xb'));var crypto=require(_0xa066('0xc'));var jsforce=require(_0xa066('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa066('0xe'));var Papa=require('papaparse');var Redis=require(_0xa066('0xf'));var authService=require(_0xa066('0x10'));var qs=require(_0xa066('0x11'));var as=require(_0xa066('0x12'));var hardwareService=require(_0xa066('0x13'));var logger=require(_0xa066('0x14'))(_0xa066('0x15'));var utils=require('../../config/utils');var config=require(_0xa066('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa066('0x17')]=_[_0xa066('0x18')](config[_0xa066('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa066('0x19'))(new Redis(config['redis']));require(_0xa066('0x1a'))[_0xa066('0x1b')](socket);function respondWithStatusCode(_0x52023b,_0x213da5){_0x213da5=_0x213da5||0xcc;return function(_0x267ac4){if(_0x267ac4){return _0x52023b[_0xa066('0x1c')](_0x213da5);}return _0x52023b[_0xa066('0x1d')](_0x213da5)[_0xa066('0x1e')]();};}function respondWithResult(_0x1294db,_0x1c7cd9){_0x1c7cd9=_0x1c7cd9||0xc8;return function(_0x362a0b){if(_0x362a0b){return _0x1294db[_0xa066('0x1d')](_0x1c7cd9)[_0xa066('0x1f')](_0x362a0b);}};}function respondWithFilteredResult(_0x101b11,_0x5c6b1f){return function(_0x4593bf){if(_0x4593bf){var _0x580ec6=typeof _0x5c6b1f[_0xa066('0x20')]===_0xa066('0x21')&&typeof _0x5c6b1f[_0xa066('0x22')]===_0xa066('0x21');var _0x5069cb=_0x4593bf[_0xa066('0x23')];var _0x5294b2=_0x580ec6?0x0:_0x5c6b1f[_0xa066('0x20')];var _0x393b80=_0x580ec6?_0x4593bf[_0xa066('0x23')]:_0x5c6b1f[_0xa066('0x20')]+_0x5c6b1f[_0xa066('0x22')];var _0x2f4c97;if(_0x393b80>=_0x5069cb){_0x393b80=_0x5069cb;_0x2f4c97=0xc8;}else{_0x2f4c97=0xce;}_0x101b11['status'](_0x2f4c97);return _0x101b11[_0xa066('0x24')](_0xa066('0x25'),_0x5294b2+'-'+_0x393b80+'/'+_0x5069cb)[_0xa066('0x1f')](_0x4593bf);}return null;};}function patchUpdates(_0x3b464c){return function(_0x43220b){try{jsonpatch[_0xa066('0x26')](_0x43220b,_0x3b464c,!![]);}catch(_0x49e684){return BPromise[_0xa066('0x27')](_0x49e684);}return _0x43220b[_0xa066('0x28')]();};}function saveUpdates(_0x4ce4d1,_0x45a92a){return function(_0x208471){if(_0x208471){return _0x208471['update'](_0x4ce4d1)[_0xa066('0x29')](function(_0x5db3d3){return _0x5db3d3;});}return null;};}function removeEntity(_0x3b8113,_0x1fb142){return function(_0x599f2a){if(_0x599f2a){return _0x599f2a['destroy']()[_0xa066('0x29')](function(){var _0x1c7a5=_0x599f2a['get']({'plain':!![]});var _0x2d5750='MailQueues';return db[_0xa066('0x2a')][_0xa066('0x2b')]({'where':{'type':_0x2d5750,'resourceId':_0x1c7a5['id']}})[_0xa066('0x29')](function(){return _0x599f2a;});})[_0xa066('0x29')](function(){_0x3b8113[_0xa066('0x1d')](0xcc)[_0xa066('0x1e')]();});}};}function handleEntityNotFound(_0x321dd5,_0x1b9130){return function(_0xb98118){if(!_0xb98118){_0x321dd5[_0xa066('0x1c')](0x194);}return _0xb98118;};}function handleError(_0x3e3d95,_0x4024b1){_0x4024b1=_0x4024b1||0x1f4;return function(_0x39cf47){logger['error'](_0x39cf47['stack']);if(_0x39cf47[_0xa066('0x2c')]){delete _0x39cf47[_0xa066('0x2c')];}_0x3e3d95[_0xa066('0x1d')](_0x4024b1)[_0xa066('0x2d')](_0x39cf47);};}exports[_0xa066('0x2e')]=function(_0x1cfc40,_0x17a5af){var _0x4d657f={},_0x1e040a={},_0x54043f={'count':0x0,'rows':[]};var _0x9f02f2=_[_0xa066('0x2f')](db[_0xa066('0x30')][_0xa066('0x31')],function(_0x57fad1){return{'name':_0x57fad1[_0xa066('0x32')],'type':_0x57fad1[_0xa066('0x33')][_0xa066('0x34')]};});_0x1e040a['model']=_[_0xa066('0x2f')](_0x9f02f2,_0xa066('0x2c'));_0x1e040a[_0xa066('0x35')]=_[_0xa066('0x36')](_0x1cfc40[_0xa066('0x35')]);_0x1e040a[_0xa066('0x37')]=_[_0xa066('0x38')](_0x1e040a[_0xa066('0x39')],_0x1e040a['query']);_0x4d657f[_0xa066('0x3a')]=_[_0xa066('0x38')](_0x1e040a[_0xa066('0x39')],qs[_0xa066('0x3b')](_0x1cfc40[_0xa066('0x35')][_0xa066('0x3b')]));_0x4d657f[_0xa066('0x3a')]=_0x4d657f[_0xa066('0x3a')]['length']?_0x4d657f[_0xa066('0x3a')]:_0x1e040a['model'];if(!_0x1cfc40['query']['hasOwnProperty'](_0xa066('0x3c'))){_0x4d657f['limit']=qs[_0xa066('0x22')](_0x1cfc40[_0xa066('0x35')][_0xa066('0x22')]);_0x4d657f[_0xa066('0x20')]=qs[_0xa066('0x20')](_0x1cfc40[_0xa066('0x35')]['offset']);}_0x4d657f[_0xa066('0x3d')]=qs[_0xa066('0x3e')](_0x1cfc40['query'][_0xa066('0x3e')]);_0x4d657f[_0xa066('0x3f')]=qs[_0xa066('0x37')](_[_0xa066('0x40')](_0x1cfc40[_0xa066('0x35')],_0x1e040a['filters']),_0x9f02f2);if(_0x1cfc40['query'][_0xa066('0x41')]){_0x4d657f['where']=_[_0xa066('0x42')](_0x4d657f[_0xa066('0x3f')],{'$or':_[_0xa066('0x2f')](_0x9f02f2,function(_0x1d8fba){if(_0x1d8fba[_0xa066('0x33')]!==_0xa066('0x43')){var _0x2d2d52={};_0x2d2d52[_0x1d8fba[_0xa066('0x2c')]]={'$like':'%'+_0x1cfc40[_0xa066('0x35')]['filter']+'%'};return _0x2d2d52;}})});}_0x4d657f=_[_0xa066('0x42')]({},_0x4d657f,_0x1cfc40[_0xa066('0x44')]);var _0x3c8e97={'where':_0x4d657f[_0xa066('0x3f')]};return db['MailQueue']['count'](_0x3c8e97)[_0xa066('0x29')](function(_0x3d36c2){_0x54043f[_0xa066('0x23')]=_0x3d36c2;if(_0x1cfc40[_0xa066('0x35')]['includeAll']){_0x4d657f['include']=[{'all':!![]}];}return db[_0xa066('0x30')]['findAll'](_0x4d657f);})['then'](function(_0x1c33aa){_0x54043f['rows']=_0x1c33aa;return _0x54043f;})[_0xa066('0x29')](respondWithFilteredResult(_0x17a5af,_0x4d657f))[_0xa066('0x45')](handleError(_0x17a5af,null));};exports[_0xa066('0x46')]=function(_0x2170a6,_0x22c4e3){var _0x5057c3={'raw':!![],'where':{'id':_0x2170a6[_0xa066('0x47')]['id']}},_0x155790={};_0x155790[_0xa066('0x39')]=_[_0xa066('0x36')](db['MailQueue'][_0xa066('0x31')]);_0x155790[_0xa066('0x35')]=_['keys'](_0x2170a6[_0xa066('0x35')]);_0x155790['filters']=_[_0xa066('0x38')](_0x155790[_0xa066('0x39')],_0x155790[_0xa066('0x35')]);_0x5057c3[_0xa066('0x3a')]=_[_0xa066('0x38')](_0x155790[_0xa066('0x39')],qs[_0xa066('0x3b')](_0x2170a6[_0xa066('0x35')][_0xa066('0x3b')]));_0x5057c3[_0xa066('0x3a')]=_0x5057c3[_0xa066('0x3a')]['length']?_0x5057c3[_0xa066('0x3a')]:_0x155790[_0xa066('0x39')];if(_0x2170a6[_0xa066('0x35')][_0xa066('0x48')]){_0x5057c3[_0xa066('0x49')]=[{'all':!![]}];}_0x5057c3=_['merge']({},_0x5057c3,_0x2170a6[_0xa066('0x44')]);return db[_0xa066('0x30')][_0xa066('0x4a')](_0x5057c3)[_0xa066('0x29')](handleEntityNotFound(_0x22c4e3,null))[_0xa066('0x29')](respondWithResult(_0x22c4e3,null))[_0xa066('0x45')](handleError(_0x22c4e3,null));};exports[_0xa066('0x4b')]=function(_0x4065fd,_0x512661){return db['MailQueue']['create'](_0x4065fd[_0xa066('0x4c')],{})[_0xa066('0x29')](function(_0x1b8ea2){var _0x39bb72=_0x4065fd['user']['get']({'plain':!![]});if(!_0x39bb72)throw new Error(_0xa066('0x4d'));if(_0x39bb72[_0xa066('0x4e')]===_0xa066('0x4f')){var _0x53a9fd=_0x1b8ea2[_0xa066('0x50')]({'plain':!![]});var _0x1eec05='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x1eec05,'userProfileId':_0x39bb72[_0xa066('0x51')]},'raw':!![]})[_0xa066('0x29')](function(_0x1f54eb){if(_0x1f54eb&&_0x1f54eb[_0xa066('0x52')]===0x0){return db[_0xa066('0x2a')][_0xa066('0x4b')]({'name':_0x53a9fd['name'],'resourceId':_0x53a9fd['id'],'type':_0x1f54eb[_0xa066('0x2c')],'sectionId':_0x1f54eb['id']},{})[_0xa066('0x29')](function(){return _0x1b8ea2;});}else{return _0x1b8ea2;}})['catch'](function(_0x2c9020){logger[_0xa066('0x53')](_0xa066('0x54'),_0x2c9020);throw _0x2c9020;});}return _0x1b8ea2;})['then'](respondWithResult(_0x512661,0xc9))['catch'](handleError(_0x512661,null));};exports['update']=function(_0x3cf47a,_0x27a352){if(_0x3cf47a[_0xa066('0x4c')]['id']){delete _0x3cf47a['body']['id'];}return db[_0xa066('0x30')][_0xa066('0x4a')]({'where':{'id':_0x3cf47a[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x27a352,null))[_0xa066('0x29')](saveUpdates(_0x3cf47a['body'],null))[_0xa066('0x29')](respondWithResult(_0x27a352,null))['catch'](handleError(_0x27a352,null));};exports[_0xa066('0x2b')]=function(_0x263681,_0x258503){return db[_0xa066('0x30')]['find']({'where':{'id':_0x263681[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x258503,null))[_0xa066('0x29')](removeEntity(_0x258503,null))[_0xa066('0x45')](handleError(_0x258503,null));};exports['describe']=function(_0x358459,_0x27d497){return db[_0xa066('0x30')][_0xa066('0x55')]()[_0xa066('0x29')](respondWithResult(_0x27d497,null))[_0xa066('0x45')](handleError(_0x27d497,null));};exports[_0xa066('0x56')]=function(_0x47fdd4,_0x2b1f19,_0x1debaf){var _0x22594b={'raw':!![],'where':{}},_0x50b97e={},_0x359682;return db[_0xa066('0x30')]['findOne']({'where':{'id':_0x47fdd4['params']['id']}})['then'](handleEntityNotFound(_0x2b1f19,null))['then'](function(_0x5b5713){if(_0x5b5713){_0x359682=_0x5b5713[_0xa066('0x50')]({'plain':!![]});_0x50b97e[_0xa066('0x39')]=_[_0xa066('0x36')](db[_0xa066('0x57')]['rawAttributes']);_0x50b97e[_0xa066('0x35')]=_[_0xa066('0x36')](_0x47fdd4['query']);_0x50b97e['filters']=_[_0xa066('0x38')](_0x50b97e[_0xa066('0x39')],_0x50b97e['query']);_0x22594b[_0xa066('0x3a')]=_['intersection'](_0x50b97e[_0xa066('0x39')],qs[_0xa066('0x3b')](_0x47fdd4[_0xa066('0x35')][_0xa066('0x3b')]));_0x22594b[_0xa066('0x3a')]=_0x22594b[_0xa066('0x3a')][_0xa066('0x58')]?_0x22594b[_0xa066('0x3a')]:_0x50b97e['model'];if(!_0x47fdd4['query']['hasOwnProperty'](_0xa066('0x3c'))){_0x22594b['limit']=qs[_0xa066('0x22')](_0x47fdd4[_0xa066('0x35')]['limit']);_0x22594b[_0xa066('0x20')]=qs[_0xa066('0x20')](_0x47fdd4['query']['offset']);}_0x22594b[_0xa066('0x3d')]=qs[_0xa066('0x3e')](_0x47fdd4[_0xa066('0x35')][_0xa066('0x3e')]);_0x22594b['where']=qs[_0xa066('0x37')](_['pick'](_0x47fdd4[_0xa066('0x35')],_0x50b97e[_0xa066('0x37')]));_0x22594b[_0xa066('0x3f')]['MailQueueId']=_0x5b5713['id'];if(_0x47fdd4[_0xa066('0x35')]['filter']){_0x22594b[_0xa066('0x3f')]=_[_0xa066('0x42')](_0x22594b[_0xa066('0x3f')],{'$or':_['map'](_0x22594b['attributes'],function(_0x5bb91c){var _0x2e4f9e={};_0x2e4f9e[_0x5bb91c]={'$like':'%'+_0x47fdd4[_0xa066('0x35')][_0xa066('0x41')]+'%'};return _0x2e4f9e;})});}_0x22594b=_['merge']({},_0x22594b,_0x47fdd4[_0xa066('0x44')]);return db[_0xa066('0x57')][_0xa066('0x59')](_0x22594b);}})['then'](function(_0x238a5f){if(_0x238a5f){return db[_0xa066('0x5a')][_0xa066('0x5b')]({'where':{'id':_[_0xa066('0x2f')](_0x238a5f,_0xa066('0x5c')),'role':_0xa066('0x5d')},'attributes':['id','name',_0xa066('0x5e'),'updatedAt',_0xa066('0x5f')]});}})[_0xa066('0x29')](function(_0x27b7b1){if(_0x27b7b1){return{'count':_0x27b7b1[_0xa066('0x23')],'rows':_[_0xa066('0x2f')](_0x27b7b1[_0xa066('0x60')],function(_0x6d9ea6){return{'membername':_0x6d9ea6[_0xa066('0x2c')],'UserId':_0x6d9ea6['id'],'queue_name':_0x359682[_0xa066('0x2c')],'MailQueueId':_0x359682['id'],'interface':util[_0xa066('0x61')](_0xa066('0x62'),_0xa066('0x63'),_0x6d9ea6[_0xa066('0x2c')]),'penalty':0x0,'paused':_0x6d9ea6[_0xa066('0x5e')],'createdAt':_0x6d9ea6[_0xa066('0x5f')],'updatedAt':_0x6d9ea6[_0xa066('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa066('0x29')](respondWithFilteredResult(_0x2b1f19,_0x22594b))[_0xa066('0x45')](handleError(_0x2b1f19,null));};exports[_0xa066('0x65')]=function(_0x38c547,_0x17e0b1,_0xa16716){var _0x1e89d2={};var _0x4c22fb={};var _0x5317f8;var _0x2c4fe;return db[_0xa066('0x30')]['findOne']({'where':{'id':_0x38c547[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x17e0b1,null))[_0xa066('0x29')](function(_0x375c2c){if(_0x375c2c){_0x5317f8=_0x375c2c;_0x4c22fb[_0xa066('0x39')]=_[_0xa066('0x36')](db['Team'][_0xa066('0x31')]);_0x4c22fb[_0xa066('0x35')]=_[_0xa066('0x36')](_0x38c547[_0xa066('0x35')]);_0x4c22fb['filters']=_[_0xa066('0x38')](_0x4c22fb['model'],_0x4c22fb['query']);_0x1e89d2[_0xa066('0x3a')]=_[_0xa066('0x38')](_0x4c22fb[_0xa066('0x39')],qs[_0xa066('0x3b')](_0x38c547[_0xa066('0x35')][_0xa066('0x3b')]));_0x1e89d2['attributes']=_0x1e89d2['attributes']['length']?_0x1e89d2[_0xa066('0x3a')]:_0x4c22fb['model'];_0x1e89d2[_0xa066('0x3d')]=qs['sort'](_0x38c547[_0xa066('0x35')][_0xa066('0x3e')]);_0x1e89d2['where']=qs[_0xa066('0x37')](_[_0xa066('0x40')](_0x38c547[_0xa066('0x35')],_0x4c22fb[_0xa066('0x37')]));if(_0x38c547[_0xa066('0x35')][_0xa066('0x41')]){_0x1e89d2[_0xa066('0x3f')]=_[_0xa066('0x42')](_0x1e89d2['where'],{'$or':_[_0xa066('0x2f')](_0x1e89d2[_0xa066('0x3a')],function(_0x3b506f){var _0x1154c7={};_0x1154c7[_0x3b506f]={'$like':'%'+_0x38c547[_0xa066('0x35')]['filter']+'%'};return _0x1154c7;})});}_0x1e89d2=_[_0xa066('0x42')]({},_0x1e89d2,_0x38c547['options']);return _0x5317f8[_0xa066('0x65')](_0x1e89d2);}})['then'](function(_0x4a9cd1){if(_0x4a9cd1){_0x2c4fe=_0x4a9cd1[_0xa066('0x58')];if(!_0x38c547[_0xa066('0x35')]['hasOwnProperty']('nolimit')){_0x1e89d2[_0xa066('0x22')]=qs[_0xa066('0x22')](_0x38c547[_0xa066('0x35')]['limit']);_0x1e89d2[_0xa066('0x20')]=qs['offset'](_0x38c547['query'][_0xa066('0x20')]);}return _0x5317f8[_0xa066('0x65')](_0x1e89d2);}})[_0xa066('0x29')](function(_0x5ec1e2){if(_0x5ec1e2){return _0x5ec1e2?{'count':_0x2c4fe,'rows':_0x5ec1e2}:null;}})['then'](respondWithResult(_0x17e0b1,null))[_0xa066('0x45')](handleError(_0x17e0b1,null));};exports[_0xa066('0x66')]=function(_0x415417,_0x316727,_0x26cd2a){var _0x3c8716=_0x415417['body'][_0xa066('0x67')];return db['Team']['findAll']({'where':{'id':_0x3c8716},'attributes':['id'],'include':[{'model':db[_0xa066('0x5a')],'as':_0xa066('0x68'),'attributes':['id','name','online',_0xa066('0x69'),_0xa066('0x6a')],'raw':!![]}]})['then'](function(_0x1bf435){if(_0x1bf435){var _0x354193=_[_0xa066('0x6b')](_0x1bf435,function(_0x35090f){var _0x3713f9=_0x35090f[_0xa066('0x50')]({'plain':!![]});return _0x3713f9['Agents'];});return db[_0xa066('0x30')][_0xa066('0x4a')]({'where':{'id':_0x415417[_0xa066('0x47')]['id']}})['then'](function(_0x5011c0){return db[_0xa066('0x6c')]['transaction'](function(_0x4e5703){return _0x5011c0[_0xa066('0x66')](_0x3c8716,{'transaction':_0x4e5703})[_0xa066('0x29')](function(){return BPromise[_0xa066('0x6d')](_0x354193,function(_0x52d72e){return db[_0xa066('0x57')]['findOrCreate']({'where':{'UserId':_0x52d72e['id'],'MailQueueId':_0x415417[_0xa066('0x47')]['id']},'transaction':_0x4e5703});});})[_0xa066('0x29')](function(){_0x354193[_0xa066('0x6e')](function(_0x16261e){socket['emit'](_0xa066('0x6f'),{'UserId':_0x16261e['id'],'MailQueueId':_0x5011c0['id']});});});});});}})[_0xa066('0x29')](respondWithStatusCode(_0x316727,null))[_0xa066('0x45')](handleError(_0x316727,null));};exports[_0xa066('0x70')]=function(_0x44bdce,_0x5a2ab5,_0xda024f){return db[_0xa066('0x71')][_0xa066('0x59')]({'where':{'id':_0x44bdce[_0xa066('0x35')][_0xa066('0x67')]},'attributes':['id'],'include':[{'model':db[_0xa066('0x5a')],'as':_0xa066('0x68'),'attributes':['id'],'raw':!![]}]})[_0xa066('0x29')](handleEntityNotFound(_0x5a2ab5,null))['then'](function(_0x42196f){var _0xb8a28f=_[_0xa066('0x2f')](_0x42196f,'id');var _0x197523=[];var _0x1c9daa=[];var _0x2f5218=squel[_0xa066('0x72')]();_0x2f5218[_0xa066('0x73')](_0xa066('0x74'))['from'](_0xa066('0x75'),'tq')[_0xa066('0x76')](_0xa066('0x77'),'ut',_0xa066('0x78'))[_0xa066('0x3f')](_0xa066('0x79'),_0x44bdce['params']['id']);for(var _0x356fe3=0x0;_0x356fe3<_0x42196f[_0xa066('0x58')];_0x356fe3+=0x1){let _0x5f2bc9=_0x42196f[_0x356fe3];for(var _0x221e6c=0x0;_0x221e6c<_0x5f2bc9[_0xa066('0x68')][_0xa066('0x58')];_0x221e6c+=0x1){let _0x461bd8=_0x5f2bc9['Agents'][_0x221e6c];var _0x567957=_0x2f5218[_0xa066('0x7a')]();_0x567957[_0xa066('0x3f')]('ut.UserId\x20=\x20?',_0x461bd8['id']);_0x1c9daa['push'](db[_0xa066('0x6c')][_0xa066('0x35')](_0x567957[_0xa066('0x7b')](),{'type':db['sequelize'][_0xa066('0x7c')][_0xa066('0x7d')]})['then'](function(_0x82888c){if(_0x82888c['length']===0x1){return _0x461bd8['id'];}else{var _0x1517b8=_[_0xa066('0x7e')](_[_0xa066('0x2f')](_0x82888c,_0xa066('0x7f')),function(_0x294206){return _[_0xa066('0x80')](_0xb8a28f,_0x294206);});if(_0x1517b8){return _0x461bd8['id'];}}}));}}return BPromise[_0xa066('0x81')](_0x1c9daa)[_0xa066('0x29')](function(_0x4ff83c){_0x197523=_(_0x197523)[_0xa066('0x82')](_0x4ff83c)['compact']()['value']();return db[_0xa066('0x30')]['find']({'where':{'id':_0x44bdce[_0xa066('0x47')]['id']}})[_0xa066('0x29')](function(_0x1b5e8f){return db['sequelize'][_0xa066('0x83')](function(_0x83e6d8){return _0x1b5e8f['removeTeams'](_0x44bdce[_0xa066('0x35')][_0xa066('0x67')],{'transaction':_0x83e6d8})[_0xa066('0x29')](function(){if(!_[_0xa066('0x84')](_0x197523)){return _0x1b5e8f['removeAgents'](_0x197523,{'transaction':_0x83e6d8});}})['then'](function(){_0x197523[_0xa066('0x6e')](function(_0x471f6b){socket['emit'](_0xa066('0x85'),{'UserId':_0x471f6b,'MailQueueId':_0x1b5e8f['id']});});});});});});})[_0xa066('0x29')](respondWithStatusCode(_0x5a2ab5,null))[_0xa066('0x45')](handleError(_0x5a2ab5,null));};exports[_0xa066('0x86')]=function(_0x254485,_0x59a77c,_0x5794b5){return db[_0xa066('0x30')]['find']({'where':{'id':_0x254485[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x59a77c,null))[_0xa066('0x29')](function(_0xcbe48a){if(_0xcbe48a){return _0xcbe48a[_0xa066('0x86')](_0x254485[_0xa066('0x4c')][_0xa066('0x67')],_[_0xa066('0x87')](_0x254485['body'],[_0xa066('0x67'),'id'])||{})[_0xa066('0x88')](function(_0x2ff65d){for(var _0x4fd56d=0x0;_0x4fd56d<_0x254485[_0xa066('0x4c')]['ids'][_0xa066('0x58')];_0x4fd56d+=0x1){socket[_0xa066('0x89')](_0xa066('0x6f'),{'UserId':Number(_0x254485[_0xa066('0x4c')][_0xa066('0x67')][_0x4fd56d]),'MailQueueId':Number(_0x254485[_0xa066('0x47')]['id'])});}return _0x2ff65d;});}})[_0xa066('0x29')](respondWithResult(_0x59a77c,null))[_0xa066('0x45')](handleError(_0x59a77c,null));};exports[_0xa066('0x8a')]=function(_0xdd0c89,_0x4bc0b9,_0x146a16){return db[_0xa066('0x30')][_0xa066('0x4a')]({'where':{'id':_0xdd0c89[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x4bc0b9,null))[_0xa066('0x29')](function(_0x22c2f6){if(_0x22c2f6){return _0x22c2f6['removeAgents'](_0xdd0c89['query'][_0xa066('0x67')])[_0xa066('0x29')](function(){if(_[_0xa066('0x8b')](_0xdd0c89[_0xa066('0x35')][_0xa066('0x67')])){for(var _0x3ee92b=0x0;_0x3ee92b<_0xdd0c89['query'][_0xa066('0x67')]['length'];_0x3ee92b+=0x1){socket[_0xa066('0x89')](_0xa066('0x85'),{'UserId':Number(_0xdd0c89[_0xa066('0x35')][_0xa066('0x67')][_0x3ee92b]),'MailQueueId':Number(_0xdd0c89[_0xa066('0x47')]['id'])});}}else{socket[_0xa066('0x89')](_0xa066('0x85'),{'UserId':Number(_0xdd0c89[_0xa066('0x35')][_0xa066('0x67')]),'MailQueueId':Number(_0xdd0c89['params']['id'])});}});}})[_0xa066('0x29')](respondWithStatusCode(_0x4bc0b9,null))[_0xa066('0x45')](handleError(_0x4bc0b9,null));};exports[_0xa066('0x8c')]=function(_0x6ff28f,_0x3558ca,_0x546039){var _0x1839ba={};var _0x53f5fc={};var _0x1defd2;var _0x109265;return db[_0xa066('0x30')][_0xa066('0x8d')]({'where':{'id':_0x6ff28f[_0xa066('0x47')]['id']}})[_0xa066('0x29')](handleEntityNotFound(_0x3558ca,null))[_0xa066('0x29')](function(_0xcf3954){if(_0xcf3954){_0x1defd2=_0xcf3954;_0x53f5fc['model']=_[_0xa066('0x36')](db['User'][_0xa066('0x31')]);_0x53f5fc[_0xa066('0x35')]=_[_0xa066('0x36')](_0x6ff28f[_0xa066('0x35')]);_0x53f5fc[_0xa066('0x37')]=_['intersection'](_0x53f5fc[_0xa066('0x39')],_0x53f5fc[_0xa066('0x35')]);_0x1839ba[_0xa066('0x3a')]=_['intersection'](_0x53f5fc[_0xa066('0x39')],qs[_0xa066('0x3b')](_0x6ff28f['query'][_0xa066('0x3b')]));_0x1839ba['attributes']=_0x1839ba['attributes']['length']?_0x1839ba['attributes']:_0x53f5fc[_0xa066('0x39')];_0x1839ba[_0xa066('0x3d')]=qs[_0xa066('0x3e')](_0x6ff28f[_0xa066('0x35')][_0xa066('0x3e')]);_0x1839ba[_0xa066('0x3f')]=qs['filters'](_['pick'](_0x6ff28f['query'],_0x53f5fc['filters']));if(_0x6ff28f['query'][_0xa066('0x41')]){_0x1839ba['where']=_[_0xa066('0x42')](_0x1839ba['where'],{'$or':_[_0xa066('0x2f')](_0x1839ba[_0xa066('0x3a')],function(_0x5e82b7){var _0x80121f={};_0x80121f[_0x5e82b7]={'$like':'%'+_0x6ff28f[_0xa066('0x35')][_0xa066('0x41')]+'%'};return _0x80121f;})});}_0x1839ba=_['merge']({},_0x1839ba,_0x6ff28f['options']);return _0x1defd2[_0xa066('0x8c')](_0x1839ba);}})[_0xa066('0x29')](function(_0x21e361){if(_0x21e361){_0x109265=_0x21e361['length'];if(!_0x6ff28f['query'][_0xa066('0x8e')](_0xa066('0x3c'))){_0x1839ba[_0xa066('0x22')]=qs[_0xa066('0x22')](_0x6ff28f['query']['limit']);_0x1839ba[_0xa066('0x20')]=qs[_0xa066('0x20')](_0x6ff28f[_0xa066('0x35')][_0xa066('0x20')]);}return _0x1defd2['getAgents'](_0x1839ba);}})[_0xa066('0x29')](function(_0x3048ed){if(_0x3048ed){return _0x3048ed?{'count':_0x109265,'rows':_0x3048ed}:null;}})['then'](respondWithResult(_0x3558ca,null))[_0xa066('0x45')](handleError(_0x3558ca,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 965256d..6873818 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 _0x10d7=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x237267,_0x46f3fc){var _0x43be1c=function(_0x584a85){while(--_0x584a85){_0x237267['push'](_0x237267['shift']());}};_0x43be1c(++_0x46f3fc);}(_0x10d7,0x1bd));var _0x710d=function(_0x4b176b,_0x13949d){_0x4b176b=_0x4b176b-0x0;var _0x48ded9=_0x10d7[_0x4b176b];return _0x48ded9;};'use strict';var EventEmitter=require(_0x710d('0x0'));var MailQueue=require(_0x710d('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x710d('0x2')](0x0);var events={'afterCreate':_0x710d('0x3'),'afterUpdate':_0x710d('0x4'),'afterDestroy':_0x710d('0x5')};function emitEvent(_0x3f25c3){return function(_0x50c907,_0x571469,_0x3e8a25){MailQueueEvents[_0x710d('0x6')](_0x3f25c3+':'+_0x50c907['id'],_0x50c907);MailQueueEvents[_0x710d('0x6')](_0x3f25c3,_0x50c907);_0x3e8a25(null);};}for(var e in events){if(events[_0x710d('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x98a6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue'];(function(_0x4c8c87,_0x53b955){var _0x34b970=function(_0x1f9ec4){while(--_0x1f9ec4){_0x4c8c87['push'](_0x4c8c87['shift']());}};_0x34b970(++_0x53b955);}(_0x98a6,0xbb));var _0x698a=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x98a6[_0x2576d7];return _0x16a08c;};'use strict';var EventEmitter=require(_0x698a('0x0'));var MailQueue=require(_0x698a('0x1'))['db'][_0x698a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x698a('0x3')](0x0);var events={'afterCreate':_0x698a('0x4'),'afterUpdate':_0x698a('0x5'),'afterDestroy':_0x698a('0x6')};function emitEvent(_0x185514){return function(_0x805294,_0xdea28f,_0x3bc4d2){MailQueueEvents[_0x698a('0x7')](_0x185514+':'+_0x805294['id'],_0x805294);MailQueueEvents[_0x698a('0x7')](_0x185514,_0x805294);_0x3bc4d2(null);};}for(var e in events){if(events[_0x698a('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x698a('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 037222c..fdf91a9 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 _0x624c=['bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1dd44b,_0x121f72){var _0x42902d=function(_0x37cc46){while(--_0x37cc46){_0x1dd44b['push'](_0x1dd44b['shift']());}};_0x42902d(++_0x121f72);}(_0x624c,0x193));var _0xc624=function(_0xebaba9,_0x15a246){_0xebaba9=_0xebaba9-0x0;var _0xca52ea=_0x624c[_0xebaba9];return _0xca52ea;};'use strict';var _=require(_0xc624('0x0'));var util=require(_0xc624('0x1'));var logger=require(_0xc624('0x2'))(_0xc624('0x3'));var moment=require(_0xc624('0x4'));var BPromise=require(_0xc624('0x5'));var rp=require(_0xc624('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc624('0x7'));var config=require(_0xc624('0x8'));var attributes=require(_0xc624('0x9'));module['exports']=function(_0xf7b8e1,_0x7e99ef){return _0xf7b8e1['define'](_0xc624('0xa'),attributes,{'tableName':_0xc624('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5e=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','api'];(function(_0x18e8f1,_0x5049d4){var _0x9a26d8=function(_0x48aee2){while(--_0x48aee2){_0x18e8f1['push'](_0x18e8f1['shift']());}};_0x9a26d8(++_0x5049d4);}(_0xea5e,0xa9));var _0xeea5=function(_0x57353d,_0x1cad73){_0x57353d=_0x57353d-0x0;var _0x430114=_0xea5e[_0x57353d];return _0x430114;};'use strict';var _=require(_0xeea5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeea5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeea5('0x2'));var fs=require('fs');var path=require(_0xeea5('0x3'));var rimraf=require(_0xeea5('0x4'));var config=require(_0xeea5('0x5'));var attributes=require(_0xeea5('0x6'));module['exports']=function(_0xc647c4,_0x4fbc4a){return _0xc647c4[_0xeea5('0x7')]('MailQueue',attributes,{'tableName':_0xeea5('0x8'),'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 2e3e7a6..9d21d23 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 _0x62ca=['attributes','limit','map','include','model','ShowMailQueue','find','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x62ca,0x179));var _0xa62c=function(_0x2321de,_0x35a1b8){_0x2321de=_0x2321de-0x0;var _0x5979ee=_0x62ca[_0x2321de];return _0x5979ee;};'use strict';var _=require(_0xa62c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa62c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa62c('0x2'))['db'];var utils=require(_0xa62c('0x3'));var logger=require(_0xa62c('0x4'))('rpc');var config=require(_0xa62c('0x5'));var jayson=require(_0xa62c('0x6'));var client=jayson['client'][_0xa62c('0x7')]({'port':0x232a});config['redis']=_[_0xa62c('0x8')](config[_0xa62c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa62c('0xa'))(new Redis(config[_0xa62c('0x9')]));require(_0xa62c('0xb'))['register'](socket);function respondWithRpcPromise(_0x5a01af,_0x2434a8,_0x387b29){return new BPromise(function(_0x271449,_0x270d88){return client[_0xa62c('0xc')](_0x5a01af,_0x387b29)[_0xa62c('0xd')](function(_0x39a0fe){logger[_0xa62c('0xe')](_0xa62c('0xf'),_0x2434a8,_0xa62c('0x10'));logger[_0xa62c('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2434a8,_0xa62c('0x10'),JSON[_0xa62c('0x12')](_0x39a0fe));if(_0x39a0fe[_0xa62c('0x13')]){if(_0x39a0fe[_0xa62c('0x13')][_0xa62c('0x14')]===0x1f4){logger['error'](_0xa62c('0xf'),_0x2434a8,_0x39a0fe[_0xa62c('0x13')]['message']);return _0x270d88(_0x39a0fe['error'][_0xa62c('0x15')]);}logger[_0xa62c('0x13')]('MailQueue,\x20%s,\x20%s',_0x2434a8,_0x39a0fe['error'][_0xa62c('0x15')]);return _0x271449(_0x39a0fe[_0xa62c('0x13')][_0xa62c('0x15')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2434a8,_0xa62c('0x10'));_0x271449(_0x39a0fe[_0xa62c('0x16')][_0xa62c('0x15')]);}})[_0xa62c('0x17')](function(_0x327e03){logger[_0xa62c('0x13')]('MailQueue,\x20%s,\x20%s',_0x2434a8,_0x327e03);_0x270d88(_0x327e03);});});}exports[_0xa62c('0x18')]=function(_0x45d27a){var _0x351fe6=this;return new Promise(function(_0x3cc799,_0x43e3c5){return db[_0xa62c('0x19')][_0xa62c('0x1a')]({'raw':_0x45d27a[_0xa62c('0x1b')]?_0x45d27a[_0xa62c('0x1b')][_0xa62c('0x1c')]===undefined?!![]:![]:!![],'where':_0x45d27a[_0xa62c('0x1b')]?_0x45d27a[_0xa62c('0x1b')][_0xa62c('0x1d')]||null:null,'attributes':_0x45d27a[_0xa62c('0x1b')]?_0x45d27a['options'][_0xa62c('0x1e')]||null:null,'limit':_0x45d27a[_0xa62c('0x1b')]?_0x45d27a['options'][_0xa62c('0x1f')]||null:null,'include':_0x45d27a[_0xa62c('0x1b')]?_0x45d27a['options']['include']?_[_0xa62c('0x20')](_0x45d27a[_0xa62c('0x1b')][_0xa62c('0x21')],function(_0x4cd920){return{'model':db[_0x4cd920['model']],'as':_0x4cd920['as'],'attributes':_0x4cd920[_0xa62c('0x1e')],'include':_0x4cd920[_0xa62c('0x21')]?_[_0xa62c('0x20')](_0x4cd920['include'],function(_0x862215){return{'model':db[_0x862215[_0xa62c('0x22')]],'as':_0x862215['as'],'attributes':_0x862215['attributes'],'include':_0x862215[_0xa62c('0x21')]?_['map'](_0x862215['include'],function(_0x5aea67){return{'model':db[_0x5aea67[_0xa62c('0x22')]],'as':_0x5aea67['as'],'attributes':_0x5aea67[_0xa62c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa62c('0xd')](function(_0xd760b7){logger['info']('GetMailQueue',_0x45d27a);logger['debug'](_0xa62c('0x18'),_0x45d27a,JSON[_0xa62c('0x12')](_0xd760b7));_0x3cc799(_0xd760b7);})[_0xa62c('0x17')](function(_0x480b5a){logger[_0xa62c('0x13')]('GetMailQueue',_0x480b5a['message'],_0x45d27a);_0x43e3c5(_0x351fe6[_0xa62c('0x13')](0x1f4,_0x480b5a['message']));});});};exports[_0xa62c('0x23')]=function(_0x3acf29){var _0x73da97=this;return new Promise(function(_0x56dfbd,_0x5c9eef){return db['MailQueue'][_0xa62c('0x24')]({'raw':_0x3acf29[_0xa62c('0x1b')]?_0x3acf29[_0xa62c('0x1b')][_0xa62c('0x1c')]===undefined?!![]:![]:!![],'where':_0x3acf29[_0xa62c('0x1b')]?_0x3acf29[_0xa62c('0x1b')][_0xa62c('0x1d')]||null:null,'attributes':_0x3acf29[_0xa62c('0x1b')]?_0x3acf29[_0xa62c('0x1b')][_0xa62c('0x1e')]||null:null,'include':_0x3acf29[_0xa62c('0x1b')]?_0x3acf29[_0xa62c('0x1b')][_0xa62c('0x21')]?_['map'](_0x3acf29[_0xa62c('0x1b')][_0xa62c('0x21')],function(_0x1a2e85){return{'model':db[_0x1a2e85[_0xa62c('0x22')]],'as':_0x1a2e85['as'],'attributes':_0x1a2e85['attributes'],'include':_0x1a2e85[_0xa62c('0x21')]?_['map'](_0x1a2e85[_0xa62c('0x21')],function(_0x380cc1){return{'model':db[_0x380cc1['model']],'as':_0x380cc1['as'],'attributes':_0x380cc1['attributes'],'include':_0x380cc1['include']?_[_0xa62c('0x20')](_0x380cc1[_0xa62c('0x21')],function(_0x5877c7){return{'model':db[_0x5877c7[_0xa62c('0x22')]],'as':_0x5877c7['as'],'attributes':_0x5877c7[_0xa62c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa62c('0xd')](function(_0x206a11){logger[_0xa62c('0xe')](_0xa62c('0x23'),_0x3acf29);logger[_0xa62c('0x11')](_0xa62c('0x23'),_0x3acf29,JSON['stringify'](_0x206a11));_0x56dfbd(_0x206a11);})[_0xa62c('0x17')](function(_0x444aa3){logger[_0xa62c('0x13')](_0xa62c('0x23'),_0x444aa3[_0xa62c('0x15')],_0x3acf29);_0x5c9eef(_0x73da97['error'](0x1f4,_0x444aa3[_0xa62c('0x15')]));});});}; \ No newline at end of file +var _0x9d2a=['http','redis','defaults','localhost','socket.io-emitter','request','then','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailQueue,\x20%s,\x20%s','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','debug','ShowMailQueue','MailQueue','stringify','lodash','util','moment','../../config/logger','rpc','jayson/promise'];(function(_0x59a5e4,_0x137779){var _0x5659b7=function(_0xf86f59){while(--_0xf86f59){_0x59a5e4['push'](_0x59a5e4['shift']());}};_0x5659b7(++_0x137779);}(_0x9d2a,0x1e4));var _0xa9d2=function(_0x937b69,_0x1d3ebf){_0x937b69=_0x937b69-0x0;var _0x21706b=_0x9d2a[_0x937b69];return _0x21706b;};'use strict';var _=require(_0xa9d2('0x0'));var util=require(_0xa9d2('0x1'));var moment=require(_0xa9d2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa9d2('0x3'))(_0xa9d2('0x4'));var config=require('../../config/environment');var jayson=require(_0xa9d2('0x5'));var client=jayson['client'][_0xa9d2('0x6')]({'port':0x232a});config[_0xa9d2('0x7')]=_[_0xa9d2('0x8')](config[_0xa9d2('0x7')],{'host':_0xa9d2('0x9'),'port':0x18eb});var socket=require(_0xa9d2('0xa'))(new Redis(config[_0xa9d2('0x7')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4a551c,_0x4eb3e1,_0x59c222){return new BPromise(function(_0x14f0cd,_0x9801da){return client[_0xa9d2('0xb')](_0x4a551c,_0x59c222)[_0xa9d2('0xc')](function(_0x2ca3d0){logger['info']('MailQueue,\x20%s,\x20%s',_0x4eb3e1,'request\x20sent');logger['debug'](_0xa9d2('0xd'),_0x4eb3e1,_0xa9d2('0xe'),JSON['stringify'](_0x2ca3d0));if(_0x2ca3d0[_0xa9d2('0xf')]){if(_0x2ca3d0['error'][_0xa9d2('0x10')]===0x1f4){logger[_0xa9d2('0xf')]('MailQueue,\x20%s,\x20%s',_0x4eb3e1,_0x2ca3d0[_0xa9d2('0xf')][_0xa9d2('0x11')]);return _0x9801da(_0x2ca3d0['error'][_0xa9d2('0x11')]);}logger[_0xa9d2('0xf')](_0xa9d2('0x12'),_0x4eb3e1,_0x2ca3d0[_0xa9d2('0xf')][_0xa9d2('0x11')]);return _0x14f0cd(_0x2ca3d0[_0xa9d2('0xf')][_0xa9d2('0x11')]);}else{logger[_0xa9d2('0x13')](_0xa9d2('0x12'),_0x4eb3e1,_0xa9d2('0xe'));_0x14f0cd(_0x2ca3d0['result']['message']);}})[_0xa9d2('0x14')](function(_0x5c7407){logger[_0xa9d2('0xf')](_0xa9d2('0x12'),_0x4eb3e1,_0x5c7407);_0x9801da(_0x5c7407);});});}exports['GetMailQueue']=function(_0x5ca155){var _0x21f1e4=this;return new Promise(function(_0x43bd7b,_0x43fb38){return db['MailQueue'][_0xa9d2('0x15')]({'raw':_0x5ca155[_0xa9d2('0x16')]?_0x5ca155['options'][_0xa9d2('0x17')]===undefined?!![]:![]:!![],'where':_0x5ca155['options']?_0x5ca155['options'][_0xa9d2('0x18')]||null:null,'attributes':_0x5ca155[_0xa9d2('0x16')]?_0x5ca155[_0xa9d2('0x16')][_0xa9d2('0x19')]||null:null,'limit':_0x5ca155[_0xa9d2('0x16')]?_0x5ca155[_0xa9d2('0x16')][_0xa9d2('0x1a')]||null:null,'include':_0x5ca155[_0xa9d2('0x16')]?_0x5ca155[_0xa9d2('0x16')][_0xa9d2('0x1b')]?_[_0xa9d2('0x1c')](_0x5ca155[_0xa9d2('0x16')][_0xa9d2('0x1b')],function(_0x3617d6){return{'model':db[_0x3617d6['model']],'as':_0x3617d6['as'],'attributes':_0x3617d6[_0xa9d2('0x19')],'include':_0x3617d6['include']?_['map'](_0x3617d6[_0xa9d2('0x1b')],function(_0x584669){return{'model':db[_0x584669[_0xa9d2('0x1d')]],'as':_0x584669['as'],'attributes':_0x584669[_0xa9d2('0x19')],'include':_0x584669[_0xa9d2('0x1b')]?_[_0xa9d2('0x1c')](_0x584669[_0xa9d2('0x1b')],function(_0x4e1caa){return{'model':db[_0x4e1caa[_0xa9d2('0x1d')]],'as':_0x4e1caa['as'],'attributes':_0x4e1caa[_0xa9d2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xae1f6d){logger['info'](_0xa9d2('0x1e'),_0x5ca155);logger[_0xa9d2('0x1f')](_0xa9d2('0x1e'),_0x5ca155,JSON['stringify'](_0xae1f6d));_0x43bd7b(_0xae1f6d);})[_0xa9d2('0x14')](function(_0x8dea32){logger[_0xa9d2('0xf')](_0xa9d2('0x1e'),_0x8dea32[_0xa9d2('0x11')],_0x5ca155);_0x43fb38(_0x21f1e4[_0xa9d2('0xf')](0x1f4,_0x8dea32['message']));});});};exports[_0xa9d2('0x20')]=function(_0x18fe21){var _0x26df50=this;return new Promise(function(_0x369ed6,_0x1c5306){return db[_0xa9d2('0x21')]['find']({'raw':_0x18fe21[_0xa9d2('0x16')]?_0x18fe21[_0xa9d2('0x16')][_0xa9d2('0x17')]===undefined?!![]:![]:!![],'where':_0x18fe21[_0xa9d2('0x16')]?_0x18fe21[_0xa9d2('0x16')]['where']||null:null,'attributes':_0x18fe21[_0xa9d2('0x16')]?_0x18fe21[_0xa9d2('0x16')]['attributes']||null:null,'include':_0x18fe21[_0xa9d2('0x16')]?_0x18fe21[_0xa9d2('0x16')][_0xa9d2('0x1b')]?_[_0xa9d2('0x1c')](_0x18fe21['options'][_0xa9d2('0x1b')],function(_0x29f799){return{'model':db[_0x29f799['model']],'as':_0x29f799['as'],'attributes':_0x29f799['attributes'],'include':_0x29f799[_0xa9d2('0x1b')]?_[_0xa9d2('0x1c')](_0x29f799[_0xa9d2('0x1b')],function(_0x30ea8a){return{'model':db[_0x30ea8a[_0xa9d2('0x1d')]],'as':_0x30ea8a['as'],'attributes':_0x30ea8a[_0xa9d2('0x19')],'include':_0x30ea8a['include']?_['map'](_0x30ea8a[_0xa9d2('0x1b')],function(_0x551497){return{'model':db[_0x551497[_0xa9d2('0x1d')]],'as':_0x551497['as'],'attributes':_0x551497[_0xa9d2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46bd02){logger[_0xa9d2('0x13')](_0xa9d2('0x20'),_0x18fe21);logger[_0xa9d2('0x1f')](_0xa9d2('0x20'),_0x18fe21,JSON[_0xa9d2('0x22')](_0x46bd02));_0x369ed6(_0x46bd02);})[_0xa9d2('0x14')](function(_0x477ca5){logger[_0xa9d2('0xf')](_0xa9d2('0x20'),_0x477ca5[_0xa9d2('0x11')],_0x18fe21);_0x1c5306(_0x26df50[_0xa9d2('0xf')](0x1f4,_0x477ca5[_0xa9d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3e56a55..3a0d696 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 _0x2724=['save','update','emit','removeListener','register','length','mailQueue:'];(function(_0xedcab0,_0xf1d5af){var _0x63ee4=function(_0x131383){while(--_0x131383){_0xedcab0['push'](_0xedcab0['shift']());}};_0x63ee4(++_0xf1d5af);}(_0x2724,0xa8));var _0x4272=function(_0x243f0b,_0x283d3a){_0x243f0b=_0x243f0b-0x0;var _0x8bd140=_0x2724[_0x243f0b];return _0x8bd140;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x4272('0x0'),'remove',_0x4272('0x1')];function createListener(_0x5a4989,_0x35dcb3){return function(_0x534b3f){_0x35dcb3[_0x4272('0x2')](_0x5a4989,_0x534b3f);};}function removeListener(_0x39de3d,_0x33ea6e){return function(){MailQueueEvents[_0x4272('0x3')](_0x39de3d,_0x33ea6e);};}exports[_0x4272('0x4')]=function(_0xe34655){for(var _0x2590cf=0x0,_0x2ec740=events[_0x4272('0x5')];_0x2590cf<_0x2ec740;_0x2590cf++){var _0x504258=events[_0x2590cf];var _0x52e736=createListener(_0x4272('0x6')+_0x504258,_0xe34655);MailQueueEvents['on'](_0x504258,_0x52e736);}}; \ No newline at end of file +var _0x8333=['register','mailQueue:','./mailQueue.events','save','remove','update','removeListener'];(function(_0x19a990,_0x106f16){var _0x434ffc=function(_0x536e82){while(--_0x536e82){_0x19a990['push'](_0x19a990['shift']());}};_0x434ffc(++_0x106f16);}(_0x8333,0x160));var _0x3833=function(_0x2d2307,_0x261d3e){_0x2d2307=_0x2d2307-0x0;var _0x363d99=_0x8333[_0x2d2307];return _0x363d99;};'use strict';var MailQueueEvents=require(_0x3833('0x0'));var events=[_0x3833('0x1'),_0x3833('0x2'),_0x3833('0x3')];function createListener(_0x5b8063,_0x22b2a1){return function(_0x2e2101){_0x22b2a1['emit'](_0x5b8063,_0x2e2101);};}function removeListener(_0x569b08,_0x2cdcad){return function(){MailQueueEvents[_0x3833('0x4')](_0x569b08,_0x2cdcad);};}exports[_0x3833('0x5')]=function(_0x35d6b1){for(var _0x548d10=0x0,_0x9694ff=events['length'];_0x548d10<_0x9694ff;_0x548d10++){var _0x215be7=events[_0x548d10];var _0x233b4a=createListener(_0x3833('0x6')+_0x215be7,_0x35d6b1);MailQueueEvents['on'](_0x215be7,_0x233b4a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d610beb..635c178 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 _0x81d8=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','post','create'];(function(_0x185f18,_0x175f09){var _0x33e5bc=function(_0xdb5406){while(--_0xdb5406){_0x185f18['push'](_0x185f18['shift']());}};_0x33e5bc(++_0x175f09);}(_0x81d8,0xe1));var _0x881d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x81d8[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x881d('0x0'));var util=require(_0x881d('0x1'));var path=require(_0x881d('0x2'));var timeout=require(_0x881d('0x3'));var express=require(_0x881d('0x4'));var router=express[_0x881d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x881d('0x6'));var interaction=require(_0x881d('0x7'));var config=require(_0x881d('0x8'));var controller=require(_0x881d('0x9'));router[_0x881d('0xa')]('/',auth['isAuthenticated'](),controller[_0x881d('0xb')]);router['get'](_0x881d('0xc'),auth[_0x881d('0xd')](),controller[_0x881d('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x881d('0xf')]('/',auth['isAuthenticated'](),controller[_0x881d('0x10')]);router['put'](_0x881d('0x11'),auth['isAuthenticated'](),controller[_0x881d('0x12')]);router[_0x881d('0x13')](_0x881d('0x11'),auth['isAuthenticated'](),controller[_0x881d('0x14')]);module[_0x881d('0x15')]=router; \ No newline at end of file +var _0x3772=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3772,0x88));var _0x2377=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x3772[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require(_0x2377('0x0'));var util=require(_0x2377('0x1'));var path=require(_0x2377('0x2'));var timeout=require(_0x2377('0x3'));var express=require(_0x2377('0x4'));var router=express[_0x2377('0x5')]();var fs_extra=require(_0x2377('0x6'));var auth=require(_0x2377('0x7'));var interaction=require(_0x2377('0x8'));var config=require('../../config/environment');var controller=require(_0x2377('0x9'));router[_0x2377('0xa')]('/',auth[_0x2377('0xb')](),controller[_0x2377('0xc')]);router[_0x2377('0xa')](_0x2377('0xd'),auth[_0x2377('0xb')](),controller[_0x2377('0xe')]);router[_0x2377('0xa')](_0x2377('0xf'),auth[_0x2377('0xb')](),controller[_0x2377('0x10')]);router['post']('/',auth[_0x2377('0xb')](),controller['create']);router[_0x2377('0x11')](_0x2377('0xf'),auth[_0x2377('0xb')](),controller[_0x2377('0x12')]);router[_0x2377('0x13')](_0x2377('0xf'),auth[_0x2377('0xb')](),controller[_0x2377('0x14')]);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 a96c594..1c4d17b 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 _0x65e0=['moment','sequelize','exports','STRING','DATE'];(function(_0x2e8fdc,_0x30524d){var _0x346353=function(_0x49d123){while(--_0x49d123){_0x2e8fdc['push'](_0x2e8fdc['shift']());}};_0x346353(++_0x30524d);}(_0x65e0,0x96));var _0x065e=function(_0x204836,_0x34d172){_0x204836=_0x204836-0x0;var _0x335884=_0x65e0[_0x204836];return _0x335884;};'use strict';var moment=require(_0x065e('0x0'));var Sequelize=require(_0x065e('0x1'));module[_0x065e('0x2')]={'uniqueid':{'type':Sequelize[_0x065e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x065e('0x4')]},'leaveAt':{'type':Sequelize[_0x065e('0x4')]},'acceptAt':{'type':Sequelize[_0x065e('0x4')]},'exitAt':{'type':Sequelize[_0x065e('0x4')]},'reason':{'type':Sequelize[_0x065e('0x3')]}}; \ No newline at end of file +var _0x0c3a=['DATE','sequelize','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x0c3a,0x154));var _0xa0c3=function(_0x3a13d9,_0xec4c8e){_0x3a13d9=_0x3a13d9-0x0;var _0x3bd599=_0x0c3a[_0x3a13d9];return _0x3bd599;};'use strict';var moment=require('moment');var Sequelize=require(_0xa0c3('0x0'));module[_0xa0c3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa0c3('0x2')]},'leaveAt':{'type':Sequelize[_0xa0c3('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa0c3('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e46bd36..e8958ed 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueueReport','includeAll','rows','catch','show'];(function(_0x11d570,_0x59fa8f){var _0x14f446=function(_0x5c0de5){while(--_0x5c0de5){_0x11d570['push'](_0x11d570['shift']());}};_0x14f446(++_0x59fa8f);}(_0x0295,0x1f0));var _0x5029=function(_0xd16df9,_0x18db96){_0xd16df9=_0xd16df9-0x0;var _0x141b04=_0x0295[_0xd16df9];return _0x141b04;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['MailQueueReport'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['MailQueueReport'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x4bd3=['reject','save','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','show','params','include','catch','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x47609a,_0x90210e){var _0x1cd637=function(_0x2e8343){while(--_0x2e8343){_0x47609a['push'](_0x47609a['shift']());}};_0x1cd637(++_0x90210e);}(_0x4bd3,0x174));var _0x34bd=function(_0x27fd16,_0x21b2d3){_0x27fd16=_0x27fd16-0x0;var _0x504448=_0x4bd3[_0x27fd16];return _0x504448;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=typeof _0x4e3886[_0x34bd('0x18')]===_0x34bd('0x19')&&typeof _0x4e3886[_0x34bd('0x1a')]===_0x34bd('0x19');var _0xd39d72=_0x6638ed[_0x34bd('0x1b')];var _0x3b4bf8=_0x30b3f2?0x0:_0x4e3886[_0x34bd('0x18')];var _0x4b5ebb=_0x30b3f2?_0x6638ed['count']:_0x4e3886[_0x34bd('0x18')]+_0x4e3886[_0x34bd('0x1a')];var _0x265e70;if(_0x4b5ebb>=_0xd39d72){_0x4b5ebb=_0xd39d72;_0x265e70=0xc8;}else{_0x265e70=0xce;}_0x4d4955[_0x34bd('0x15')](_0x265e70);return _0x4d4955[_0x34bd('0x1c')](_0x34bd('0x1d'),_0x3b4bf8+'-'+_0x4b5ebb+'/'+_0xd39d72)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x3d5f76){return function(_0x130bd0){try{jsonpatch['apply'](_0x130bd0,_0x3d5f76,!![]);}catch(_0x15c0d1){return BPromise[_0x34bd('0x1e')](_0x15c0d1);}return _0x130bd0[_0x34bd('0x1f')]();};}function saveUpdates(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['update'](_0x14254b)['then'](function(_0x4edf84){return _0x4edf84;});}return null;};}function removeEntity(_0x3dafe8,_0x503a60){return function(_0x10fc4b){if(_0x10fc4b){return _0x10fc4b[_0x34bd('0x20')]()[_0x34bd('0x21')](function(){_0x3dafe8['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x14479a,_0x4f0dff){return function(_0x457006){if(!_0x457006){_0x14479a['sendStatus'](0x194);}return _0x457006;};}function handleError(_0x29bda8,_0xb256e8){_0xb256e8=_0xb256e8||0x1f4;return function(_0x264c94){logger[_0x34bd('0x22')](_0x264c94['stack']);if(_0x264c94[_0x34bd('0x23')]){delete _0x264c94[_0x34bd('0x23')];}_0x29bda8['status'](_0xb256e8)[_0x34bd('0x24')](_0x264c94);};}exports[_0x34bd('0x25')]=function(_0x16581f,_0x3f675c){var _0x26b8e7={},_0x4500c8={},_0x177d43={'count':0x0,'rows':[]};var _0x58b431=_[_0x34bd('0x26')](db[_0x34bd('0x27')]['rawAttributes'],function(_0x5d1662){return{'name':_0x5d1662[_0x34bd('0x28')],'type':_0x5d1662[_0x34bd('0x29')][_0x34bd('0x2a')]};});_0x4500c8['model']=_['map'](_0x58b431,_0x34bd('0x23'));_0x4500c8[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x16581f[_0x34bd('0x2b')]);_0x4500c8['filters']=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],_0x4500c8[_0x34bd('0x2b')]);_0x26b8e7[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],qs['fields'](_0x16581f[_0x34bd('0x2b')]['fields']));_0x26b8e7[_0x34bd('0x2f')]=_0x26b8e7[_0x34bd('0x2f')][_0x34bd('0x30')]?_0x26b8e7['attributes']:_0x4500c8[_0x34bd('0x2e')];if(!_0x16581f[_0x34bd('0x2b')]['hasOwnProperty'](_0x34bd('0x31'))){_0x26b8e7[_0x34bd('0x1a')]=qs[_0x34bd('0x1a')](_0x16581f['query'][_0x34bd('0x1a')]);_0x26b8e7[_0x34bd('0x18')]=qs['offset'](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x18')]);}_0x26b8e7[_0x34bd('0x32')]=qs[_0x34bd('0x33')](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x33')]);_0x26b8e7['where']=qs['filters'](_['pick'](_0x16581f[_0x34bd('0x2b')],_0x4500c8[_0x34bd('0x34')]),_0x58b431);if(_0x16581f['query']['filter']){_0x26b8e7[_0x34bd('0x35')]=_['merge'](_0x26b8e7['where'],{'$or':_[_0x34bd('0x26')](_0x58b431,function(_0xb5a456){if(_0xb5a456[_0x34bd('0x29')]!==_0x34bd('0x36')){var _0x2af1af={};_0x2af1af[_0xb5a456['name']]={'$like':'%'+_0x16581f['query'][_0x34bd('0x37')]+'%'};return _0x2af1af;}})});}_0x26b8e7=_['merge']({},_0x26b8e7,_0x16581f[_0x34bd('0x38')]);var _0x2c9b7a={'where':_0x26b8e7[_0x34bd('0x35')]};return db[_0x34bd('0x27')][_0x34bd('0x1b')](_0x2c9b7a)['then'](function(_0x282297){_0x177d43[_0x34bd('0x1b')]=_0x282297;if(_0x16581f[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x26b8e7['include']=[{'all':!![]}];}return db[_0x34bd('0x27')]['findAll'](_0x26b8e7);})[_0x34bd('0x21')](function(_0x560282){_0x177d43['rows']=_0x560282;return _0x177d43;})[_0x34bd('0x21')](respondWithFilteredResult(_0x3f675c,_0x26b8e7))['catch'](handleError(_0x3f675c,null));};exports[_0x34bd('0x3a')]=function(_0x3d3b96,_0x18e9f6){var _0x42a424={'raw':!![],'where':{'id':_0x3d3b96[_0x34bd('0x3b')]['id']}},_0x26d73e={};_0x26d73e[_0x34bd('0x2e')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x26d73e[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x3d3b96[_0x34bd('0x2b')]);_0x26d73e[_0x34bd('0x34')]=_['intersection'](_0x26d73e[_0x34bd('0x2e')],_0x26d73e[_0x34bd('0x2b')]);_0x42a424[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x26d73e[_0x34bd('0x2e')],qs['fields'](_0x3d3b96[_0x34bd('0x2b')]['fields']));_0x42a424['attributes']=_0x42a424[_0x34bd('0x2f')]['length']?_0x42a424[_0x34bd('0x2f')]:_0x26d73e[_0x34bd('0x2e')];if(_0x3d3b96[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x42a424[_0x34bd('0x3c')]=[{'all':!![]}];}_0x42a424=_['merge']({},_0x42a424,_0x3d3b96['options']);return db[_0x34bd('0x27')]['find'](_0x42a424)[_0x34bd('0x21')](handleEntityNotFound(_0x18e9f6,null))[_0x34bd('0x21')](respondWithResult(_0x18e9f6,null))[_0x34bd('0x3d')](handleError(_0x18e9f6,null));};exports['create']=function(_0x4ad00c,_0x4f96dd){return db['MailQueueReport'][_0x34bd('0x3e')](_0x4ad00c['body'],{})[_0x34bd('0x21')](respondWithResult(_0x4f96dd,0xc9))['catch'](handleError(_0x4f96dd,null));};exports[_0x34bd('0x3f')]=function(_0x1d01d7,_0x1fa341){if(_0x1d01d7[_0x34bd('0x40')]['id']){delete _0x1d01d7[_0x34bd('0x40')]['id'];}return db['MailQueueReport'][_0x34bd('0x41')]({'where':{'id':_0x1d01d7[_0x34bd('0x3b')]['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fa341,null))[_0x34bd('0x21')](saveUpdates(_0x1d01d7[_0x34bd('0x40')],null))['then'](respondWithResult(_0x1fa341,null))[_0x34bd('0x3d')](handleError(_0x1fa341,null));};exports[_0x34bd('0x20')]=function(_0x5bcce5,_0x1fc735){return db[_0x34bd('0x27')]['find']({'where':{'id':_0x5bcce5['params']['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fc735,null))['then'](removeEntity(_0x1fc735,null))['catch'](handleError(_0x1fc735,null));};exports[_0x34bd('0x42')]=function(_0x5df6a5,_0x556ce8){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x556ce8,null))[_0x34bd('0x3d')](handleError(_0x556ce8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3e37764..d01da65 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 _0x9206=['report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','MailQueueReport'];(function(_0x204950,_0x22c2ca){var _0x2c1386=function(_0x6ec005){while(--_0x6ec005){_0x204950['push'](_0x204950['shift']());}};_0x2c1386(++_0x22c2ca);}(_0x9206,0x176));var _0x6920=function(_0x5827a3,_0x5049f3){_0x5827a3=_0x5827a3-0x0;var _0x1a763b=_0x9206[_0x5827a3];return _0x1a763b;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var logger=require(_0x6920('0x2'))(_0x6920('0x3'));var moment=require(_0x6920('0x4'));var BPromise=require(_0x6920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x41c8c4,_0x4d67d7){return _0x41c8c4[_0x6920('0x8')](_0x6920('0x9'),attributes,{'tableName':_0x6920('0xa'),'paranoid':![],'indexes':[{'name':_0x6920('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x376c=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x376c,0xce));var _0xc376=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x376c[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xc376('0x0'));var util=require(_0xc376('0x1'));var logger=require('../../config/logger')(_0xc376('0x2'));var moment=require(_0xc376('0x3'));var BPromise=require(_0xc376('0x4'));var rp=require(_0xc376('0x5'));var fs=require('fs');var path=require(_0xc376('0x6'));var rimraf=require(_0xc376('0x7'));var config=require(_0xc376('0x8'));var attributes=require(_0xc376('0x9'));module[_0xc376('0xa')]=function(_0x5c8fd2,_0x2be64a){return _0x5c8fd2['define'](_0xc376('0xb'),attributes,{'tableName':_0xc376('0xc'),'paranoid':![],'indexes':[{'name':_0xc376('0xd'),'fields':[_0xc376('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 f8e57fe..52b9f7a 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x31b74c,_0x30f8cd){var _0x2b4f1c=function(_0x4d587d){while(--_0x4d587d){_0x31b74c['push'](_0x31b74c['shift']());}};_0x2b4f1c(++_0x30f8cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x35c4a3,_0x2c8921){_0x35c4a3=_0x35c4a3-0x0;var _0x17936f=_0x2ef3[_0x35c4a3];return _0x17936f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3b45e8,_0x628af6){var _0x370099=function(_0x80765f){while(--_0x80765f){_0x3b45e8['push'](_0x3b45e8['shift']());}};_0x370099(++_0x628af6);}(_0x2ef3,0xba));var _0x32ef=function(_0x471e70,_0x3c8a2a){_0x471e70=_0x471e70-0x0;var _0x5d156c=_0x2ef3[_0x471e70];return _0x5d156c;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dcfc675..b94980a 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(_0x1ae09e,_0xd9e291){var _0x532849=function(_0x142db9){while(--_0x142db9){_0x1ae09e['push'](_0x1ae09e['shift']());}};_0x532849(++_0xd9e291);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xcb91[_0x386525];return _0x14d015;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e40de,_0x56f0d7){var _0x366e0c=function(_0x4d70c3){while(--_0x4d70c3){_0x1e40de['push'](_0x1e40de['shift']());}};_0x366e0c(++_0x56f0d7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 832b7f9..4ef207a 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 _0x5a99=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x35ca86,_0x5bc843){var _0x152305=function(_0x5395b8){while(--_0x5395b8){_0x35ca86['push'](_0x35ca86['shift']());}};_0x152305(++_0x5bc843);}(_0x5a99,0xc9));var _0x95a9=function(_0x716847,_0x18b829){_0x716847=_0x716847-0x0;var _0x1b59ee=_0x5a99[_0x716847];return _0x1b59ee;};'use strict';var Sequelize=require(_0x95a9('0x0'));module[_0x95a9('0x1')]={'description':{'type':Sequelize[_0x95a9('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x95a9('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x95a9('0x2')]},'password':{'type':Sequelize[_0x95a9('0x2')]},'port':{'type':Sequelize[_0x95a9('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x95a9('0x2')],'defaultValue':_0x95a9('0x5')},'connTimeout':{'type':Sequelize[_0x95a9('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x95a9('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x95a9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbcbd=['INBOX','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3a247c,_0x10b38e){var _0x34b164=function(_0x55a9b6){while(--_0x55a9b6){_0x3a247c['push'](_0x3a247c['shift']());}};_0x34b164(++_0x10b38e);}(_0xbcbd,0x128));var _0xdbcb=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0xbcbd[_0x529587];return _0x4ea039;};'use strict';var Sequelize=require('sequelize');module[_0xdbcb('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xdbcb('0x1')]},'authentication':{'type':Sequelize[_0xdbcb('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xdbcb('0x1')]},'password':{'type':Sequelize[_0xdbcb('0x1')]},'port':{'type':Sequelize[_0xdbcb('0x3')]},'tls':{'type':Sequelize[_0xdbcb('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xdbcb('0x1')],'defaultValue':_0xdbcb('0x4')},'connTimeout':{'type':Sequelize[_0xdbcb('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xdbcb('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xdbcb('0x1')]},'modernAuthentication':{'type':Sequelize[_0xdbcb('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c48945d..e00c2e6 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 _0x18be=['api','moment','request-promise','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18be,0x168));var _0xe18b=function(_0x7c9f1d,_0x4b7628){_0x7c9f1d=_0x7c9f1d-0x0;var _0x1b24bd=_0x18be[_0x7c9f1d];return _0x1b24bd;};'use strict';var _=require(_0xe18b('0x0'));var util=require(_0xe18b('0x1'));var logger=require(_0xe18b('0x2'))(_0xe18b('0x3'));var moment=require(_0xe18b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe18b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe18b('0x6'));var attributes=require(_0xe18b('0x7'));module[_0xe18b('0x8')]=function(_0x1ffce9,_0xcceeec){return _0x1ffce9['define'](_0xe18b('0x9'),attributes,{'tableName':_0xe18b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc528=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x5abd75,_0x240b60){var _0x3aabb2=function(_0x5b576d){while(--_0x5b576d){_0x5abd75['push'](_0x5abd75['shift']());}};_0x3aabb2(++_0x240b60);}(_0xc528,0x127));var _0x8c52=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc528[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c52('0x0'));var util=require(_0x8c52('0x1'));var logger=require(_0x8c52('0x2'))(_0x8c52('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c52('0x4'));var fs=require('fs');var path=require(_0x8c52('0x5'));var rimraf=require(_0x8c52('0x6'));var config=require(_0x8c52('0x7'));var attributes=require(_0x8c52('0x8'));module[_0x8c52('0x9')]=function(_0x325fed,_0x4195c1){return _0x325fed[_0x8c52('0xa')](_0x8c52('0xb'),attributes,{'tableName':_0x8c52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 80dd056..8c7b683 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 _0x08fb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','limit','map','model','include','attributes'];(function(_0x3ad5fe,_0x4b57bc){var _0x186865=function(_0x1faddc){while(--_0x1faddc){_0x3ad5fe['push'](_0x3ad5fe['shift']());}};_0x186865(++_0x4b57bc);}(_0x08fb,0x193));var _0xb08f=function(_0x26fb67,_0x57eb43){_0x26fb67=_0x26fb67-0x0;var _0x3981dc=_0x08fb[_0x26fb67];return _0x3981dc;};'use strict';var _=require(_0xb08f('0x0'));var util=require(_0xb08f('0x1'));var moment=require(_0xb08f('0x2'));var BPromise=require(_0xb08f('0x3'));var rs=require(_0xb08f('0x4'));var fs=require('fs');var Redis=require(_0xb08f('0x5'));var db=require(_0xb08f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb08f('0x7'));var client=jayson['client'][_0xb08f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34ac16,_0xe7c94c,_0x8d4497){return new BPromise(function(_0x3af748,_0x4135db){return client[_0xb08f('0x9')](_0x34ac16,_0x8d4497)[_0xb08f('0xa')](function(_0x5527b9){logger[_0xb08f('0xb')](_0xb08f('0xc'),_0xe7c94c,_0xb08f('0xd'));logger[_0xb08f('0xe')](_0xb08f('0xf'),_0xe7c94c,'request\x20sent',JSON[_0xb08f('0x10')](_0x5527b9));if(_0x5527b9[_0xb08f('0x11')]){if(_0x5527b9[_0xb08f('0x11')][_0xb08f('0x12')]===0x1f4){logger[_0xb08f('0x11')]('MailServerIn,\x20%s,\x20%s',_0xe7c94c,_0x5527b9[_0xb08f('0x11')]['message']);return _0x4135db(_0x5527b9[_0xb08f('0x11')][_0xb08f('0x13')]);}logger['error'](_0xb08f('0xc'),_0xe7c94c,_0x5527b9[_0xb08f('0x11')]['message']);return _0x3af748(_0x5527b9[_0xb08f('0x11')]['message']);}else{logger[_0xb08f('0xb')](_0xb08f('0xc'),_0xe7c94c,_0xb08f('0xd'));_0x3af748(_0x5527b9['result']['message']);}})[_0xb08f('0x14')](function(_0x4303ab){logger[_0xb08f('0x11')](_0xb08f('0xc'),_0xe7c94c,_0x4303ab);_0x4135db(_0x4303ab);});});}exports[_0xb08f('0x15')]=function(_0x2a09a1){var _0x889be5=this;return new Promise(function(_0x431779,_0x439e17){return db[_0xb08f('0x16')][_0xb08f('0x17')]({'raw':_0x2a09a1['options']?_0x2a09a1[_0xb08f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2a09a1[_0xb08f('0x18')]?_0x2a09a1['options'][_0xb08f('0x19')]||null:null,'attributes':_0x2a09a1[_0xb08f('0x18')]?_0x2a09a1[_0xb08f('0x18')]['attributes']||null:null,'limit':_0x2a09a1[_0xb08f('0x18')]?_0x2a09a1['options'][_0xb08f('0x1a')]||null:null,'include':_0x2a09a1['options']?_0x2a09a1['options']['include']?_[_0xb08f('0x1b')](_0x2a09a1['options']['include'],function(_0x574043){return{'model':db[_0x574043[_0xb08f('0x1c')]],'as':_0x574043['as'],'attributes':_0x574043['attributes'],'include':_0x574043[_0xb08f('0x1d')]?_['map'](_0x574043[_0xb08f('0x1d')],function(_0x5269e0){return{'model':db[_0x5269e0['model']],'as':_0x5269e0['as'],'attributes':_0x5269e0[_0xb08f('0x1e')],'include':_0x5269e0[_0xb08f('0x1d')]?_[_0xb08f('0x1b')](_0x5269e0[_0xb08f('0x1d')],function(_0x712fa0){return{'model':db[_0x712fa0[_0xb08f('0x1c')]],'as':_0x712fa0['as'],'attributes':_0x712fa0['attributes']};}):[]};}):[]};}):[]:[]})[_0xb08f('0xa')](function(_0x10e5ff){logger['info']('GetMailServerIn',_0x2a09a1);logger[_0xb08f('0xe')]('GetMailServerIn',_0x2a09a1,JSON[_0xb08f('0x10')](_0x10e5ff));_0x431779(_0x10e5ff);})[_0xb08f('0x14')](function(_0x32ab9a){logger[_0xb08f('0x11')](_0xb08f('0x15'),_0x32ab9a[_0xb08f('0x13')],_0x2a09a1);_0x439e17(_0x889be5['error'](0x1f4,_0x32ab9a[_0xb08f('0x13')]));});});}; \ No newline at end of file +var _0x5127=['client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','GetMailServerIn','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5127,0x18f));var _0x7512=function(_0x1268f4,_0x147117){_0x1268f4=_0x1268f4-0x0;var _0x2f1b05=_0x5127[_0x1268f4];return _0x2f1b05;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7512('0x5'))(_0x7512('0x6'));var config=require(_0x7512('0x7'));var jayson=require(_0x7512('0x8'));var client=jayson[_0x7512('0x9')][_0x7512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6779,_0x4d0765,_0x2d2e88){return new BPromise(function(_0x543586,_0x43ce62){return client['request'](_0x4e6779,_0x2d2e88)[_0x7512('0xb')](function(_0x1e41b5){logger[_0x7512('0xc')](_0x7512('0xd'),_0x4d0765,_0x7512('0xe'));logger[_0x7512('0xf')](_0x7512('0x10'),_0x4d0765,_0x7512('0xe'),JSON[_0x7512('0x11')](_0x1e41b5));if(_0x1e41b5[_0x7512('0x12')]){if(_0x1e41b5[_0x7512('0x12')][_0x7512('0x13')]===0x1f4){logger[_0x7512('0x12')](_0x7512('0xd'),_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x43ce62(_0x1e41b5[_0x7512('0x12')]['message']);}logger[_0x7512('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x543586(_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);}else{logger[_0x7512('0xc')]('MailServerIn,\x20%s,\x20%s',_0x4d0765,'request\x20sent');_0x543586(_0x1e41b5[_0x7512('0x15')][_0x7512('0x14')]);}})[_0x7512('0x16')](function(_0x3f8f8f){logger['error'](_0x7512('0xd'),_0x4d0765,_0x3f8f8f);_0x43ce62(_0x3f8f8f);});});}exports['GetMailServerIn']=function(_0x10858d){var _0x26bdd2=this;return new Promise(function(_0x1d357b,_0x3db810){return db[_0x7512('0x17')][_0x7512('0x18')]({'raw':_0x10858d[_0x7512('0x19')]?_0x10858d[_0x7512('0x19')][_0x7512('0x1a')]===undefined?!![]:![]:!![],'where':_0x10858d[_0x7512('0x19')]?_0x10858d['options'][_0x7512('0x1b')]||null:null,'attributes':_0x10858d[_0x7512('0x19')]?_0x10858d['options'][_0x7512('0x1c')]||null:null,'limit':_0x10858d[_0x7512('0x19')]?_0x10858d[_0x7512('0x19')][_0x7512('0x1d')]||null:null,'include':_0x10858d[_0x7512('0x19')]?_0x10858d[_0x7512('0x19')]['include']?_[_0x7512('0x1e')](_0x10858d[_0x7512('0x19')][_0x7512('0x1f')],function(_0x21cb99){return{'model':db[_0x21cb99[_0x7512('0x20')]],'as':_0x21cb99['as'],'attributes':_0x21cb99['attributes'],'include':_0x21cb99[_0x7512('0x1f')]?_[_0x7512('0x1e')](_0x21cb99['include'],function(_0x2c88dd){return{'model':db[_0x2c88dd['model']],'as':_0x2c88dd['as'],'attributes':_0x2c88dd['attributes'],'include':_0x2c88dd[_0x7512('0x1f')]?_[_0x7512('0x1e')](_0x2c88dd[_0x7512('0x1f')],function(_0x5784ba){return{'model':db[_0x5784ba['model']],'as':_0x5784ba['as'],'attributes':_0x5784ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x7512('0xb')](function(_0x551a1a){logger['info'](_0x7512('0x21'),_0x10858d);logger['debug'](_0x7512('0x21'),_0x10858d,JSON[_0x7512('0x11')](_0x551a1a));_0x1d357b(_0x551a1a);})[_0x7512('0x16')](function(_0x4c676c){logger['error'](_0x7512('0x21'),_0x4c676c[_0x7512('0x14')],_0x10858d);_0x3db810(_0x26bdd2[_0x7512('0x12')](0x1f4,_0x4c676c[_0x7512('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 5b3c37f..d57d0f0 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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0x4b6426,_0x25aad1){_0x4b6426=_0x4b6426-0x0;var _0x4e44e9=_0x7a54[_0x4b6426];return _0x4e44e9;};'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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x52a801,_0x52abfd){_0x52a801=_0x52a801-0x0;var _0x309348=_0x7a54[_0x52a801];return _0x309348;};'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 15ef71b..ac67e6c 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 _0xefda=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x35e4a2,_0x49f61e){var _0x3f2f7c=function(_0x8abdfd){while(--_0x8abdfd){_0x35e4a2['push'](_0x35e4a2['shift']());}};_0x3f2f7c(++_0x49f61e);}(_0xefda,0x96));var _0xaefd=function(_0x21ffd4,_0x3cc9b5){_0x21ffd4=_0x21ffd4-0x0;var _0x180390=_0xefda[_0x21ffd4];return _0x180390;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaefd('0x1')]},'user':{'type':Sequelize[_0xaefd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaefd('0x2')]},'secure':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xaefd('0x1')]},'authentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0102=['exports','STRING','BOOLEAN'];(function(_0x5a01f5,_0x21803a){var _0x5ecf7c=function(_0x41c8c7){while(--_0x41c8c7){_0x5a01f5['push'](_0x5a01f5['shift']());}};_0x5ecf7c(++_0x21803a);}(_0x0102,0x186));var _0x2010=function(_0x20e5d1,_0x1f8af4){_0x20e5d1=_0x20e5d1-0x0;var _0xcc7b20=_0x0102[_0x20e5d1];return _0xcc7b20;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'description':{'type':Sequelize[_0x2010('0x1')]},'host':{'type':Sequelize[_0x2010('0x1')]},'user':{'type':Sequelize[_0x2010('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2010('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5d056e0..20aad74 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 _0x60dd=['index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','MailServerOut','rows','show','params','find','create','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x60dd,0xb2));var _0xd60d=function(_0x4c7d19,_0x62fc3){_0x4c7d19=_0x4c7d19-0x0;var _0x419805=_0x60dd[_0x4c7d19];return _0x419805;};'use strict';var emlformat=require(_0xd60d('0x0'));var rimraf=require(_0xd60d('0x1'));var zipdir=require(_0xd60d('0x2'));var jsonpatch=require(_0xd60d('0x3'));var rp=require('request-promise');var moment=require(_0xd60d('0x4'));var BPromise=require(_0xd60d('0x5'));var Mustache=require('mustache');var util=require(_0xd60d('0x6'));var path=require(_0xd60d('0x7'));var sox=require(_0xd60d('0x8'));var csv=require(_0xd60d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd60d('0xa'));var _=require(_0xd60d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd60d('0xc'));var deskjs=require(_0xd60d('0xd'));var toCsv=require(_0xd60d('0x9'));var querystring=require(_0xd60d('0xe'));var Papa=require(_0xd60d('0xf'));var Redis=require(_0xd60d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd60d('0x11'));var as=require(_0xd60d('0x12'));var hardwareService=require(_0xd60d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd60d('0x14'));var config=require(_0xd60d('0x15'));var licenseUtil=require(_0xd60d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca4b2,_0x441800){_0x441800=_0x441800||0xcc;return function(_0x5ea453){if(_0x5ea453){return _0x5ca4b2['sendStatus'](_0x441800);}return _0x5ca4b2['status'](_0x441800)['end']();};}function respondWithResult(_0x225dd1,_0x266cdf){_0x266cdf=_0x266cdf||0xc8;return function(_0x2fe8e6){if(_0x2fe8e6){return _0x225dd1[_0xd60d('0x17')](_0x266cdf)[_0xd60d('0x18')](_0x2fe8e6);}};}function respondWithFilteredResult(_0x4141d2,_0x33edc0){return function(_0x5f3697){if(_0x5f3697){var _0x297f25=typeof _0x33edc0[_0xd60d('0x19')]===_0xd60d('0x1a')&&typeof _0x33edc0[_0xd60d('0x1b')]==='undefined';var _0x510eb5=_0x5f3697[_0xd60d('0x1c')];var _0x3ef1fd=_0x297f25?0x0:_0x33edc0['offset'];var _0x39f835=_0x297f25?_0x5f3697[_0xd60d('0x1c')]:_0x33edc0[_0xd60d('0x19')]+_0x33edc0['limit'];var _0x1e745d;if(_0x39f835>=_0x510eb5){_0x39f835=_0x510eb5;_0x1e745d=0xc8;}else{_0x1e745d=0xce;}_0x4141d2[_0xd60d('0x17')](_0x1e745d);return _0x4141d2['set'](_0xd60d('0x1d'),_0x3ef1fd+'-'+_0x39f835+'/'+_0x510eb5)[_0xd60d('0x18')](_0x5f3697);}return null;};}function patchUpdates(_0x18eab7){return function(_0x5696ae){try{jsonpatch[_0xd60d('0x1e')](_0x5696ae,_0x18eab7,!![]);}catch(_0x12f438){return BPromise[_0xd60d('0x1f')](_0x12f438);}return _0x5696ae[_0xd60d('0x20')]();};}function saveUpdates(_0x1b7639,_0x54160e){return function(_0xc514e8){if(_0xc514e8){return _0xc514e8[_0xd60d('0x21')](_0x1b7639)[_0xd60d('0x22')](function(_0x21692f){return _0x21692f;});}return null;};}function removeEntity(_0xa746b2,_0x6b5955){return function(_0x3271f4){if(_0x3271f4){return _0x3271f4['destroy']()[_0xd60d('0x22')](function(){_0xa746b2[_0xd60d('0x17')](0xcc)[_0xd60d('0x23')]();});}};}function handleEntityNotFound(_0x2d8af8,_0x5065c2){return function(_0x16d71a){if(!_0x16d71a){_0x2d8af8[_0xd60d('0x24')](0x194);}return _0x16d71a;};}function handleError(_0x50ffea,_0x307cb0){_0x307cb0=_0x307cb0||0x1f4;return function(_0x303c16){logger[_0xd60d('0x25')](_0x303c16[_0xd60d('0x26')]);if(_0x303c16[_0xd60d('0x27')]){delete _0x303c16['name'];}_0x50ffea[_0xd60d('0x17')](_0x307cb0)[_0xd60d('0x28')](_0x303c16);};}exports[_0xd60d('0x29')]=function(_0x1dc773,_0x549da8){var _0x36b289={},_0x468387={},_0x2b857b={'count':0x0,'rows':[]};var _0x49fa24=_[_0xd60d('0x2a')](db['MailServerOut'][_0xd60d('0x2b')],function(_0x2419c5){return{'name':_0x2419c5['fieldName'],'type':_0x2419c5[_0xd60d('0x2c')]['key']};});_0x468387[_0xd60d('0x2d')]=_[_0xd60d('0x2a')](_0x49fa24,_0xd60d('0x27'));_0x468387[_0xd60d('0x2e')]=_[_0xd60d('0x2f')](_0x1dc773[_0xd60d('0x2e')]);_0x468387[_0xd60d('0x30')]=_[_0xd60d('0x31')](_0x468387[_0xd60d('0x2d')],_0x468387[_0xd60d('0x2e')]);_0x36b289[_0xd60d('0x32')]=_[_0xd60d('0x31')](_0x468387[_0xd60d('0x2d')],qs[_0xd60d('0x33')](_0x1dc773['query'][_0xd60d('0x33')]));_0x36b289[_0xd60d('0x32')]=_0x36b289['attributes'][_0xd60d('0x34')]?_0x36b289[_0xd60d('0x32')]:_0x468387['model'];if(!_0x1dc773[_0xd60d('0x2e')][_0xd60d('0x35')](_0xd60d('0x36'))){_0x36b289['limit']=qs[_0xd60d('0x1b')](_0x1dc773[_0xd60d('0x2e')][_0xd60d('0x1b')]);_0x36b289[_0xd60d('0x19')]=qs['offset'](_0x1dc773[_0xd60d('0x2e')][_0xd60d('0x19')]);}_0x36b289[_0xd60d('0x37')]=qs['sort'](_0x1dc773[_0xd60d('0x2e')]['sort']);_0x36b289['where']=qs[_0xd60d('0x30')](_[_0xd60d('0x38')](_0x1dc773['query'],_0x468387[_0xd60d('0x30')]),_0x49fa24);if(_0x1dc773[_0xd60d('0x2e')]['filter']){_0x36b289[_0xd60d('0x39')]=_[_0xd60d('0x3a')](_0x36b289[_0xd60d('0x39')],{'$or':_[_0xd60d('0x2a')](_0x49fa24,function(_0x385fcc){if(_0x385fcc[_0xd60d('0x2c')]!==_0xd60d('0x3b')){var _0x2b14a4={};_0x2b14a4[_0x385fcc[_0xd60d('0x27')]]={'$like':'%'+_0x1dc773[_0xd60d('0x2e')][_0xd60d('0x3c')]+'%'};return _0x2b14a4;}})});}_0x36b289=_[_0xd60d('0x3a')]({},_0x36b289,_0x1dc773[_0xd60d('0x3d')]);var _0x4ffb44={'where':_0x36b289[_0xd60d('0x39')]};return db['MailServerOut'][_0xd60d('0x1c')](_0x4ffb44)[_0xd60d('0x22')](function(_0x4d74d6){_0x2b857b[_0xd60d('0x1c')]=_0x4d74d6;if(_0x1dc773['query'][_0xd60d('0x3e')]){_0x36b289[_0xd60d('0x3f')]=[{'all':!![]}];}return db[_0xd60d('0x40')]['findAll'](_0x36b289);})[_0xd60d('0x22')](function(_0x4a2dfe){_0x2b857b[_0xd60d('0x41')]=_0x4a2dfe;return _0x2b857b;})[_0xd60d('0x22')](respondWithFilteredResult(_0x549da8,_0x36b289))['catch'](handleError(_0x549da8,null));};exports[_0xd60d('0x42')]=function(_0x3fcc5b,_0x217223){var _0x60a624={'raw':!![],'where':{'id':_0x3fcc5b[_0xd60d('0x43')]['id']}},_0x59f08a={};_0x59f08a[_0xd60d('0x2d')]=_[_0xd60d('0x2f')](db[_0xd60d('0x40')][_0xd60d('0x2b')]);_0x59f08a[_0xd60d('0x2e')]=_[_0xd60d('0x2f')](_0x3fcc5b[_0xd60d('0x2e')]);_0x59f08a[_0xd60d('0x30')]=_['intersection'](_0x59f08a[_0xd60d('0x2d')],_0x59f08a['query']);_0x60a624[_0xd60d('0x32')]=_['intersection'](_0x59f08a['model'],qs[_0xd60d('0x33')](_0x3fcc5b[_0xd60d('0x2e')]['fields']));_0x60a624[_0xd60d('0x32')]=_0x60a624[_0xd60d('0x32')][_0xd60d('0x34')]?_0x60a624[_0xd60d('0x32')]:_0x59f08a[_0xd60d('0x2d')];if(_0x3fcc5b[_0xd60d('0x2e')]['includeAll']){_0x60a624['include']=[{'all':!![]}];}_0x60a624=_[_0xd60d('0x3a')]({},_0x60a624,_0x3fcc5b['options']);return db[_0xd60d('0x40')][_0xd60d('0x44')](_0x60a624)[_0xd60d('0x22')](handleEntityNotFound(_0x217223,null))[_0xd60d('0x22')](respondWithResult(_0x217223,null))['catch'](handleError(_0x217223,null));};exports[_0xd60d('0x45')]=function(_0x1ab2d2,_0x559d9f){return db[_0xd60d('0x40')][_0xd60d('0x45')](_0x1ab2d2['body'],{})[_0xd60d('0x22')](respondWithResult(_0x559d9f,0xc9))[_0xd60d('0x46')](handleError(_0x559d9f,null));};exports[_0xd60d('0x21')]=function(_0x3e69cc,_0x9a5b8){if(_0x3e69cc[_0xd60d('0x47')]['id']){delete _0x3e69cc[_0xd60d('0x47')]['id'];}return db[_0xd60d('0x40')][_0xd60d('0x44')]({'where':{'id':_0x3e69cc[_0xd60d('0x43')]['id']}})[_0xd60d('0x22')](handleEntityNotFound(_0x9a5b8,null))[_0xd60d('0x22')](saveUpdates(_0x3e69cc[_0xd60d('0x47')],null))[_0xd60d('0x22')](respondWithResult(_0x9a5b8,null))[_0xd60d('0x46')](handleError(_0x9a5b8,null));};exports[_0xd60d('0x48')]=function(_0x58ce09,_0x176cae){return db[_0xd60d('0x40')][_0xd60d('0x44')]({'where':{'id':_0x58ce09[_0xd60d('0x43')]['id']}})[_0xd60d('0x22')](handleEntityNotFound(_0x176cae,null))[_0xd60d('0x22')](removeEntity(_0x176cae,null))['catch'](handleError(_0x176cae,null));}; \ No newline at end of file +var _0xd3b6=['set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','rimraf','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x1c1931,_0x3536af){var _0x2ddbd1=function(_0x44dabe){while(--_0x44dabe){_0x1c1931['push'](_0x1c1931['shift']());}};_0x2ddbd1(++_0x3536af);}(_0xd3b6,0x141));var _0x6d3b=function(_0xe75ce4,_0x106f05){_0xe75ce4=_0xe75ce4-0x0;var _0x1391ed=_0xd3b6[_0xe75ce4];return _0x1391ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d3b('0x1'));var rp=require('request-promise');var moment=require(_0x6d3b('0x2'));var BPromise=require(_0x6d3b('0x3'));var Mustache=require('mustache');var util=require(_0x6d3b('0x4'));var path=require(_0x6d3b('0x5'));var sox=require(_0x6d3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d3b('0x7'));var _=require(_0x6d3b('0x8'));var squel=require(_0x6d3b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d3b('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d3b('0xb'));var as=require(_0x6d3b('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d3b('0xd'));var utils=require(_0x6d3b('0xe'));var config=require(_0x6d3b('0xf'));var licenseUtil=require(_0x6d3b('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x242495,_0x4b579d){_0x4b579d=_0x4b579d||0xcc;return function(_0xdd0f61){if(_0xdd0f61){return _0x242495[_0x6d3b('0x11')](_0x4b579d);}return _0x242495['status'](_0x4b579d)[_0x6d3b('0x12')]();};}function respondWithResult(_0x28a60a,_0x374eb3){_0x374eb3=_0x374eb3||0xc8;return function(_0x124dbd){if(_0x124dbd){return _0x28a60a[_0x6d3b('0x13')](_0x374eb3)['json'](_0x124dbd);}};}function respondWithFilteredResult(_0x42b5b6,_0x242436){return function(_0x3014ce){if(_0x3014ce){var _0x2cef4d=typeof _0x242436[_0x6d3b('0x14')]===_0x6d3b('0x15')&&typeof _0x242436[_0x6d3b('0x16')]==='undefined';var _0xd48e62=_0x3014ce[_0x6d3b('0x17')];var _0x129edf=_0x2cef4d?0x0:_0x242436[_0x6d3b('0x14')];var _0x20d9b4=_0x2cef4d?_0x3014ce['count']:_0x242436[_0x6d3b('0x14')]+_0x242436['limit'];var _0x323d7d;if(_0x20d9b4>=_0xd48e62){_0x20d9b4=_0xd48e62;_0x323d7d=0xc8;}else{_0x323d7d=0xce;}_0x42b5b6[_0x6d3b('0x13')](_0x323d7d);return _0x42b5b6[_0x6d3b('0x18')](_0x6d3b('0x19'),_0x129edf+'-'+_0x20d9b4+'/'+_0xd48e62)[_0x6d3b('0x1a')](_0x3014ce);}return null;};}function patchUpdates(_0x49bcd1){return function(_0x41fe39){try{jsonpatch[_0x6d3b('0x1b')](_0x41fe39,_0x49bcd1,!![]);}catch(_0x392c01){return BPromise[_0x6d3b('0x1c')](_0x392c01);}return _0x41fe39[_0x6d3b('0x1d')]();};}function saveUpdates(_0x329e3e,_0x180e6b){return function(_0x14ec90){if(_0x14ec90){return _0x14ec90[_0x6d3b('0x1e')](_0x329e3e)['then'](function(_0x440868){return _0x440868;});}return null;};}function removeEntity(_0x1ade83,_0x2dd45c){return function(_0x55d53c){if(_0x55d53c){return _0x55d53c[_0x6d3b('0x1f')]()[_0x6d3b('0x20')](function(){_0x1ade83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0262,_0x200443){return function(_0x350121){if(!_0x350121){_0x5d0262['sendStatus'](0x194);}return _0x350121;};}function handleError(_0x4b00f4,_0xdb4966){_0xdb4966=_0xdb4966||0x1f4;return function(_0x4978ed){logger[_0x6d3b('0x21')](_0x4978ed[_0x6d3b('0x22')]);if(_0x4978ed[_0x6d3b('0x23')]){delete _0x4978ed[_0x6d3b('0x23')];}_0x4b00f4[_0x6d3b('0x13')](_0xdb4966)[_0x6d3b('0x24')](_0x4978ed);};}exports['index']=function(_0x2a0df0,_0x5f1e40){var _0xc9ef91={},_0x1508c1={},_0xa23b7c={'count':0x0,'rows':[]};var _0x2148ae=_[_0x6d3b('0x25')](db[_0x6d3b('0x26')][_0x6d3b('0x27')],function(_0x522e68){return{'name':_0x522e68[_0x6d3b('0x28')],'type':_0x522e68[_0x6d3b('0x29')][_0x6d3b('0x2a')]};});_0x1508c1['model']=_[_0x6d3b('0x25')](_0x2148ae,'name');_0x1508c1[_0x6d3b('0x2b')]=_[_0x6d3b('0x2c')](_0x2a0df0[_0x6d3b('0x2b')]);_0x1508c1[_0x6d3b('0x2d')]=_['intersection'](_0x1508c1[_0x6d3b('0x2e')],_0x1508c1['query']);_0xc9ef91[_0x6d3b('0x2f')]=_[_0x6d3b('0x30')](_0x1508c1[_0x6d3b('0x2e')],qs[_0x6d3b('0x31')](_0x2a0df0['query'][_0x6d3b('0x31')]));_0xc9ef91[_0x6d3b('0x2f')]=_0xc9ef91[_0x6d3b('0x2f')][_0x6d3b('0x32')]?_0xc9ef91['attributes']:_0x1508c1[_0x6d3b('0x2e')];if(!_0x2a0df0['query'][_0x6d3b('0x33')](_0x6d3b('0x34'))){_0xc9ef91[_0x6d3b('0x16')]=qs[_0x6d3b('0x16')](_0x2a0df0[_0x6d3b('0x2b')]['limit']);_0xc9ef91[_0x6d3b('0x14')]=qs['offset'](_0x2a0df0[_0x6d3b('0x2b')][_0x6d3b('0x14')]);}_0xc9ef91[_0x6d3b('0x35')]=qs['sort'](_0x2a0df0[_0x6d3b('0x2b')][_0x6d3b('0x36')]);_0xc9ef91[_0x6d3b('0x37')]=qs[_0x6d3b('0x2d')](_['pick'](_0x2a0df0[_0x6d3b('0x2b')],_0x1508c1[_0x6d3b('0x2d')]),_0x2148ae);if(_0x2a0df0[_0x6d3b('0x2b')]['filter']){_0xc9ef91[_0x6d3b('0x37')]=_[_0x6d3b('0x38')](_0xc9ef91[_0x6d3b('0x37')],{'$or':_[_0x6d3b('0x25')](_0x2148ae,function(_0x15c702){if(_0x15c702[_0x6d3b('0x29')]!==_0x6d3b('0x39')){var _0x107ff3={};_0x107ff3[_0x15c702[_0x6d3b('0x23')]]={'$like':'%'+_0x2a0df0['query'][_0x6d3b('0x3a')]+'%'};return _0x107ff3;}})});}_0xc9ef91=_[_0x6d3b('0x38')]({},_0xc9ef91,_0x2a0df0[_0x6d3b('0x3b')]);var _0x59a919={'where':_0xc9ef91['where']};return db[_0x6d3b('0x26')][_0x6d3b('0x17')](_0x59a919)[_0x6d3b('0x20')](function(_0x2c7a80){_0xa23b7c['count']=_0x2c7a80;if(_0x2a0df0[_0x6d3b('0x2b')]['includeAll']){_0xc9ef91[_0x6d3b('0x3c')]=[{'all':!![]}];}return db[_0x6d3b('0x26')]['findAll'](_0xc9ef91);})[_0x6d3b('0x20')](function(_0x17a319){_0xa23b7c[_0x6d3b('0x3d')]=_0x17a319;return _0xa23b7c;})['then'](respondWithFilteredResult(_0x5f1e40,_0xc9ef91))[_0x6d3b('0x3e')](handleError(_0x5f1e40,null));};exports[_0x6d3b('0x3f')]=function(_0x914e8e,_0x4fde16){var _0x4b2deb={'raw':!![],'where':{'id':_0x914e8e[_0x6d3b('0x40')]['id']}},_0x53177a={};_0x53177a['model']=_[_0x6d3b('0x2c')](db[_0x6d3b('0x26')][_0x6d3b('0x27')]);_0x53177a[_0x6d3b('0x2b')]=_[_0x6d3b('0x2c')](_0x914e8e['query']);_0x53177a['filters']=_[_0x6d3b('0x30')](_0x53177a[_0x6d3b('0x2e')],_0x53177a[_0x6d3b('0x2b')]);_0x4b2deb[_0x6d3b('0x2f')]=_[_0x6d3b('0x30')](_0x53177a[_0x6d3b('0x2e')],qs['fields'](_0x914e8e['query'][_0x6d3b('0x31')]));_0x4b2deb[_0x6d3b('0x2f')]=_0x4b2deb['attributes'][_0x6d3b('0x32')]?_0x4b2deb[_0x6d3b('0x2f')]:_0x53177a['model'];if(_0x914e8e[_0x6d3b('0x2b')][_0x6d3b('0x41')]){_0x4b2deb[_0x6d3b('0x3c')]=[{'all':!![]}];}_0x4b2deb=_[_0x6d3b('0x38')]({},_0x4b2deb,_0x914e8e[_0x6d3b('0x3b')]);return db[_0x6d3b('0x26')][_0x6d3b('0x42')](_0x4b2deb)[_0x6d3b('0x20')](handleEntityNotFound(_0x4fde16,null))['then'](respondWithResult(_0x4fde16,null))['catch'](handleError(_0x4fde16,null));};exports[_0x6d3b('0x43')]=function(_0x58c264,_0x5833d6){return db[_0x6d3b('0x26')][_0x6d3b('0x43')](_0x58c264[_0x6d3b('0x44')],{})['then'](respondWithResult(_0x5833d6,0xc9))['catch'](handleError(_0x5833d6,null));};exports['update']=function(_0x5b5850,_0x3cd9ca){if(_0x5b5850[_0x6d3b('0x44')]['id']){delete _0x5b5850[_0x6d3b('0x44')]['id'];}return db[_0x6d3b('0x26')][_0x6d3b('0x42')]({'where':{'id':_0x5b5850['params']['id']}})['then'](handleEntityNotFound(_0x3cd9ca,null))[_0x6d3b('0x20')](saveUpdates(_0x5b5850[_0x6d3b('0x44')],null))[_0x6d3b('0x20')](respondWithResult(_0x3cd9ca,null))[_0x6d3b('0x3e')](handleError(_0x3cd9ca,null));};exports[_0x6d3b('0x1f')]=function(_0x926027,_0x392db8){return db[_0x6d3b('0x26')]['find']({'where':{'id':_0x926027[_0x6d3b('0x40')]['id']}})['then'](handleEntityNotFound(_0x392db8,null))[_0x6d3b('0x20')](removeEntity(_0x392db8,null))[_0x6d3b('0x3e')](handleError(_0x392db8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f2e4ec6..3ca8454 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 _0x3d02=['bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','api','moment'];(function(_0x296737,_0x19c7dd){var _0x3726d2=function(_0x7d75b7){while(--_0x7d75b7){_0x296737['push'](_0x296737['shift']());}};_0x3726d2(++_0x19c7dd);}(_0x3d02,0x1b5));var _0x23d0=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3d02[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0x23d0('0x0'));var logger=require('../../config/logger')(_0x23d0('0x1'));var moment=require(_0x23d0('0x2'));var BPromise=require(_0x23d0('0x3'));var rp=require(_0x23d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23d0('0x5'));var attributes=require(_0x23d0('0x6'));module[_0x23d0('0x7')]=function(_0x40f247,_0x364807){return _0x40f247[_0x23d0('0x8')](_0x23d0('0x9'),attributes,{'tableName':_0x23d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x300e=['MailServerOut','lodash','moment','bluebird','request-promise','path','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x300e,0x1c1));var _0xe300=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x300e[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0xe300('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe300('0x1'));var BPromise=require(_0xe300('0x2'));var rp=require(_0xe300('0x3'));var fs=require('fs');var path=require(_0xe300('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x3567c7,_0x154de0){return _0x3567c7[_0xe300('0x5')](_0xe300('0x6'),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 30dfa1e..c11ff02 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(_0x7bfeef,_0xbfc5c7){var _0x224408=function(_0x54b35c){while(--_0x54b35c){_0x7bfeef['push'](_0x7bfeef['shift']());}};_0x224408(++_0xbfc5c7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28a744,_0x13f9fe){_0x28a744=_0x28a744-0x0;var _0x303542=_0x5f2f[_0x28a744];return _0x303542;};'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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2e422f,_0x154540){var _0x2d02ee=function(_0x1ad42b){while(--_0x1ad42b){_0x2e422f['push'](_0x2e422f['shift']());}};_0x2d02ee(++_0x154540);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 480d088..8ae40e7 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 _0xed0a=['show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','/describe','/:id'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xed0a,0xf7));var _0xaed0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xed0a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xaed0('0x0'));var util=require('util');var path=require(_0xaed0('0x1'));var timeout=require(_0xaed0('0x2'));var express=require(_0xaed0('0x3'));var router=express[_0xaed0('0x4')]();var fs_extra=require(_0xaed0('0x5'));var auth=require(_0xaed0('0x6'));var interaction=require(_0xaed0('0x7'));var config=require('../../config/environment');var controller=require(_0xaed0('0x8'));router['get']('/',auth[_0xaed0('0x9')](),controller[_0xaed0('0xa')]);router['get'](_0xaed0('0xb'),auth[_0xaed0('0x9')](),controller['describe']);router['get'](_0xaed0('0xc'),auth[_0xaed0('0x9')](),controller[_0xaed0('0xd')]);router[_0xaed0('0xe')]('/',auth[_0xaed0('0x9')](),controller[_0xaed0('0xf')]);router[_0xaed0('0x10')](_0xaed0('0xc'),auth[_0xaed0('0x9')](),controller[_0xaed0('0x11')]);router[_0xaed0('0x12')]('/:id',auth[_0xaed0('0x9')](),controller[_0xaed0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf83c=['../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router','fs-extra'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0xf83c,0xa6));var _0xcf83=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0xf83c[_0x127a60];return _0xc1f6a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf83('0x0'));var timeout=require(_0xcf83('0x1'));var express=require(_0xcf83('0x2'));var router=express[_0xcf83('0x3')]();var fs_extra=require(_0xcf83('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf83('0x5'));var config=require('../../config/environment');var controller=require(_0xcf83('0x6'));router[_0xcf83('0x7')]('/',auth[_0xcf83('0x8')](),controller[_0xcf83('0x9')]);router[_0xcf83('0x7')](_0xcf83('0xa'),auth[_0xcf83('0x8')](),controller[_0xcf83('0xb')]);router['get'](_0xcf83('0xc'),auth[_0xcf83('0x8')](),controller[_0xcf83('0xd')]);router[_0xcf83('0xe')]('/',auth[_0xcf83('0x8')](),controller[_0xcf83('0xf')]);router[_0xcf83('0x10')](_0xcf83('0xc'),auth[_0xcf83('0x8')](),controller[_0xcf83('0x11')]);router['delete']('/:id',auth[_0xcf83('0x8')](),controller[_0xcf83('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 80c6b0f..49f0f9a 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 _0x6b8f=['exports','name'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x42dbaa,_0x453e21){_0x42dbaa=_0x42dbaa-0x0;var _0x5c3a06=_0x6b8f[_0x42dbaa];return _0x5c3a06;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf6b8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf1b=['STRING','name','sequelize','exports'];(function(_0x881159,_0x564b21){var _0x222b87=function(_0x128ff7){while(--_0x128ff7){_0x881159['push'](_0x881159['shift']());}};_0x222b87(++_0x564b21);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x2c0ffe,_0x1c0050){_0x2c0ffe=_0x2c0ffe-0x0;var _0x39873c=_0xaf1b[_0x2c0ffe];return _0x39873c;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbaf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 47b11f4..e9c37c5 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 _0x8b1b=['Content-Range','reject','save','update','destroy','then','end','error','stack','send','index','map','rawAttributes','fieldName','type','name','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','MailSubstatus','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit'];(function(_0x3f9adb,_0x4ac876){var _0x4f0604=function(_0x3dbf33){while(--_0x3dbf33){_0x3f9adb['push'](_0x3f9adb['shift']());}};_0x4f0604(++_0x4ac876);}(_0x8b1b,0x19c));var _0xb8b1=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8b1b[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0xb8b1('0x0'));var rimraf=require(_0xb8b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8b1('0x2'));var rp=require(_0xb8b1('0x3'));var moment=require(_0xb8b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb8b1('0x5'));var util=require(_0xb8b1('0x6'));var path=require(_0xb8b1('0x7'));var sox=require('sox');var csv=require(_0xb8b1('0x8'));var ejs=require(_0xb8b1('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b1('0xa'));var _=require(_0xb8b1('0xb'));var squel=require(_0xb8b1('0xc'));var crypto=require('crypto');var jsforce=require(_0xb8b1('0xd'));var deskjs=require(_0xb8b1('0xe'));var toCsv=require(_0xb8b1('0x8'));var querystring=require(_0xb8b1('0xf'));var Papa=require(_0xb8b1('0x10'));var Redis=require(_0xb8b1('0x11'));var authService=require(_0xb8b1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb8b1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b1('0x14'))(_0xb8b1('0x15'));var utils=require(_0xb8b1('0x16'));var config=require(_0xb8b1('0x17'));var licenseUtil=require(_0xb8b1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f9856,_0x938065){_0x938065=_0x938065||0xcc;return function(_0x3b0e0d){if(_0x3b0e0d){return _0x1f9856[_0xb8b1('0x19')](_0x938065);}return _0x1f9856[_0xb8b1('0x1a')](_0x938065)['end']();};}function respondWithResult(_0x33e4be,_0x387e42){_0x387e42=_0x387e42||0xc8;return function(_0x2ab124){if(_0x2ab124){return _0x33e4be[_0xb8b1('0x1a')](_0x387e42)[_0xb8b1('0x1b')](_0x2ab124);}};}function respondWithFilteredResult(_0x3ecc52,_0x5deb22){return function(_0x3986b4){if(_0x3986b4){var _0x5039e5=typeof _0x5deb22['offset']===_0xb8b1('0x1c')&&typeof _0x5deb22['limit']===_0xb8b1('0x1c');var _0x20ec7f=_0x3986b4[_0xb8b1('0x1d')];var _0x48e877=_0x5039e5?0x0:_0x5deb22['offset'];var _0x2d4e1c=_0x5039e5?_0x3986b4['count']:_0x5deb22[_0xb8b1('0x1e')]+_0x5deb22[_0xb8b1('0x1f')];var _0x1f81d0;if(_0x2d4e1c>=_0x20ec7f){_0x2d4e1c=_0x20ec7f;_0x1f81d0=0xc8;}else{_0x1f81d0=0xce;}_0x3ecc52[_0xb8b1('0x1a')](_0x1f81d0);return _0x3ecc52['set'](_0xb8b1('0x20'),_0x48e877+'-'+_0x2d4e1c+'/'+_0x20ec7f)[_0xb8b1('0x1b')](_0x3986b4);}return null;};}function patchUpdates(_0x2ebd65){return function(_0x35b038){try{jsonpatch['apply'](_0x35b038,_0x2ebd65,!![]);}catch(_0x58fba2){return BPromise[_0xb8b1('0x21')](_0x58fba2);}return _0x35b038[_0xb8b1('0x22')]();};}function saveUpdates(_0x4e8bbd,_0x4093b2){return function(_0x29258c){if(_0x29258c){return _0x29258c[_0xb8b1('0x23')](_0x4e8bbd)['then'](function(_0x30b33f){return _0x30b33f;});}return null;};}function removeEntity(_0x5b1541,_0x945c89){return function(_0x29df37){if(_0x29df37){return _0x29df37[_0xb8b1('0x24')]()[_0xb8b1('0x25')](function(){_0x5b1541[_0xb8b1('0x1a')](0xcc)[_0xb8b1('0x26')]();});}};}function handleEntityNotFound(_0x3f7983,_0x1c1e5f){return function(_0x499410){if(!_0x499410){_0x3f7983[_0xb8b1('0x19')](0x194);}return _0x499410;};}function handleError(_0x3d58c9,_0x56c75e){_0x56c75e=_0x56c75e||0x1f4;return function(_0x5a9708){logger[_0xb8b1('0x27')](_0x5a9708[_0xb8b1('0x28')]);if(_0x5a9708['name']){delete _0x5a9708['name'];}_0x3d58c9[_0xb8b1('0x1a')](_0x56c75e)[_0xb8b1('0x29')](_0x5a9708);};}exports[_0xb8b1('0x2a')]=function(_0x507652,_0x2238c6){var _0x1635e4={},_0x55f5d1={},_0x3cfb8b={'count':0x0,'rows':[]};var _0xfc4f26=_[_0xb8b1('0x2b')](db['MailSubstatus'][_0xb8b1('0x2c')],function(_0x22579e){return{'name':_0x22579e[_0xb8b1('0x2d')],'type':_0x22579e[_0xb8b1('0x2e')]['key']};});_0x55f5d1['model']=_[_0xb8b1('0x2b')](_0xfc4f26,_0xb8b1('0x2f'));_0x55f5d1['query']=_[_0xb8b1('0x30')](_0x507652['query']);_0x55f5d1['filters']=_['intersection'](_0x55f5d1[_0xb8b1('0x31')],_0x55f5d1[_0xb8b1('0x32')]);_0x1635e4['attributes']=_[_0xb8b1('0x33')](_0x55f5d1['model'],qs[_0xb8b1('0x34')](_0x507652[_0xb8b1('0x32')][_0xb8b1('0x34')]));_0x1635e4[_0xb8b1('0x35')]=_0x1635e4[_0xb8b1('0x35')][_0xb8b1('0x36')]?_0x1635e4[_0xb8b1('0x35')]:_0x55f5d1['model'];if(!_0x507652[_0xb8b1('0x32')][_0xb8b1('0x37')]('nolimit')){_0x1635e4[_0xb8b1('0x1f')]=qs[_0xb8b1('0x1f')](_0x507652[_0xb8b1('0x32')]['limit']);_0x1635e4[_0xb8b1('0x1e')]=qs[_0xb8b1('0x1e')](_0x507652[_0xb8b1('0x32')]['offset']);}_0x1635e4[_0xb8b1('0x38')]=qs['sort'](_0x507652[_0xb8b1('0x32')][_0xb8b1('0x39')]);_0x1635e4[_0xb8b1('0x3a')]=qs[_0xb8b1('0x3b')](_['pick'](_0x507652[_0xb8b1('0x32')],_0x55f5d1[_0xb8b1('0x3b')]),_0xfc4f26);if(_0x507652[_0xb8b1('0x32')][_0xb8b1('0x3c')]){_0x1635e4[_0xb8b1('0x3a')]=_[_0xb8b1('0x3d')](_0x1635e4['where'],{'$or':_[_0xb8b1('0x2b')](_0xfc4f26,function(_0x58ec5e){if(_0x58ec5e['type']!=='VIRTUAL'){var _0x1cce2e={};_0x1cce2e[_0x58ec5e['name']]={'$like':'%'+_0x507652[_0xb8b1('0x32')][_0xb8b1('0x3c')]+'%'};return _0x1cce2e;}})});}_0x1635e4=_[_0xb8b1('0x3d')]({},_0x1635e4,_0x507652[_0xb8b1('0x3e')]);var _0x52c0ad={'where':_0x1635e4[_0xb8b1('0x3a')]};return db[_0xb8b1('0x3f')][_0xb8b1('0x1d')](_0x52c0ad)[_0xb8b1('0x25')](function(_0x5d2ca1){_0x3cfb8b['count']=_0x5d2ca1;if(_0x507652['query'][_0xb8b1('0x40')]){_0x1635e4[_0xb8b1('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xb8b1('0x42')](_0x1635e4);})[_0xb8b1('0x25')](function(_0x2c0df6){_0x3cfb8b[_0xb8b1('0x43')]=_0x2c0df6;return _0x3cfb8b;})['then'](respondWithFilteredResult(_0x2238c6,_0x1635e4))[_0xb8b1('0x44')](handleError(_0x2238c6,null));};exports['show']=function(_0x2b63e2,_0x36d27a){var _0x1971ee={'raw':!![],'where':{'id':_0x2b63e2[_0xb8b1('0x45')]['id']}},_0x11f887={};_0x11f887['model']=_[_0xb8b1('0x30')](db['MailSubstatus']['rawAttributes']);_0x11f887[_0xb8b1('0x32')]=_[_0xb8b1('0x30')](_0x2b63e2[_0xb8b1('0x32')]);_0x11f887[_0xb8b1('0x3b')]=_[_0xb8b1('0x33')](_0x11f887['model'],_0x11f887['query']);_0x1971ee['attributes']=_[_0xb8b1('0x33')](_0x11f887[_0xb8b1('0x31')],qs[_0xb8b1('0x34')](_0x2b63e2[_0xb8b1('0x32')][_0xb8b1('0x34')]));_0x1971ee[_0xb8b1('0x35')]=_0x1971ee[_0xb8b1('0x35')][_0xb8b1('0x36')]?_0x1971ee[_0xb8b1('0x35')]:_0x11f887[_0xb8b1('0x31')];if(_0x2b63e2[_0xb8b1('0x32')][_0xb8b1('0x40')]){_0x1971ee['include']=[{'all':!![]}];}_0x1971ee=_[_0xb8b1('0x3d')]({},_0x1971ee,_0x2b63e2[_0xb8b1('0x3e')]);return db['MailSubstatus'][_0xb8b1('0x46')](_0x1971ee)[_0xb8b1('0x25')](handleEntityNotFound(_0x36d27a,null))[_0xb8b1('0x25')](respondWithResult(_0x36d27a,null))[_0xb8b1('0x44')](handleError(_0x36d27a,null));};exports[_0xb8b1('0x47')]=function(_0x484a99,_0x50b698){return db['MailSubstatus']['create'](_0x484a99['body'],{})[_0xb8b1('0x25')](respondWithResult(_0x50b698,0xc9))['catch'](handleError(_0x50b698,null));};exports[_0xb8b1('0x23')]=function(_0x42219b,_0x56d5ba){if(_0x42219b[_0xb8b1('0x48')]['id']){delete _0x42219b[_0xb8b1('0x48')]['id'];}return db['MailSubstatus'][_0xb8b1('0x46')]({'where':{'id':_0x42219b[_0xb8b1('0x45')]['id']}})[_0xb8b1('0x25')](handleEntityNotFound(_0x56d5ba,null))[_0xb8b1('0x25')](saveUpdates(_0x42219b['body'],null))[_0xb8b1('0x25')](respondWithResult(_0x56d5ba,null))[_0xb8b1('0x44')](handleError(_0x56d5ba,null));};exports[_0xb8b1('0x24')]=function(_0x27abe5,_0x59f64b){return db[_0xb8b1('0x3f')][_0xb8b1('0x46')]({'where':{'id':_0x27abe5[_0xb8b1('0x45')]['id']}})[_0xb8b1('0x25')](handleEntityNotFound(_0x59f64b,null))['then'](removeEntity(_0x59f64b,null))['catch'](handleError(_0x59f64b,null));};exports[_0xb8b1('0x49')]=function(_0x59c1ad,_0x367d3c){return db[_0xb8b1('0x3f')][_0xb8b1('0x49')]()[_0xb8b1('0x25')](respondWithResult(_0x367d3c,null))[_0xb8b1('0x44')](handleError(_0x367d3c,null));}; \ No newline at end of file +var _0x7be9=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','catch','keys','includeAll','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7be9,0x117));var _0x97be=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7be9[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97be('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97be('0x1'));var moment=require(_0x97be('0x2'));var BPromise=require(_0x97be('0x3'));var Mustache=require(_0x97be('0x4'));var util=require('util');var path=require('path');var sox=require(_0x97be('0x5'));var csv=require(_0x97be('0x6'));var ejs=require(_0x97be('0x7'));var fs=require('fs');var fs_extra=require(_0x97be('0x8'));var _=require(_0x97be('0x9'));var squel=require(_0x97be('0xa'));var crypto=require(_0x97be('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97be('0xc'));var toCsv=require(_0x97be('0x6'));var querystring=require(_0x97be('0xd'));var Papa=require('papaparse');var Redis=require(_0x97be('0xe'));var authService=require(_0x97be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97be('0x10'));var hardwareService=require(_0x97be('0x11'));var logger=require('../../config/logger')(_0x97be('0x12'));var utils=require(_0x97be('0x13'));var config=require(_0x97be('0x14'));var licenseUtil=require(_0x97be('0x15'));var db=require(_0x97be('0x16'))['db'];function respondWithStatusCode(_0x397c98,_0x2bfb7d){_0x2bfb7d=_0x2bfb7d||0xcc;return function(_0x3dddec){if(_0x3dddec){return _0x397c98[_0x97be('0x17')](_0x2bfb7d);}return _0x397c98['status'](_0x2bfb7d)['end']();};}function respondWithResult(_0x2a042b,_0x3a6475){_0x3a6475=_0x3a6475||0xc8;return function(_0x3831fc){if(_0x3831fc){return _0x2a042b['status'](_0x3a6475)['json'](_0x3831fc);}};}function respondWithFilteredResult(_0x4faa98,_0x509995){return function(_0x25e377){if(_0x25e377){var _0x154abb=typeof _0x509995[_0x97be('0x18')]===_0x97be('0x19')&&typeof _0x509995['limit']==='undefined';var _0x549fcf=_0x25e377[_0x97be('0x1a')];var _0x455b81=_0x154abb?0x0:_0x509995[_0x97be('0x18')];var _0x1bcc35=_0x154abb?_0x25e377[_0x97be('0x1a')]:_0x509995[_0x97be('0x18')]+_0x509995[_0x97be('0x1b')];var _0x8ff25a;if(_0x1bcc35>=_0x549fcf){_0x1bcc35=_0x549fcf;_0x8ff25a=0xc8;}else{_0x8ff25a=0xce;}_0x4faa98[_0x97be('0x1c')](_0x8ff25a);return _0x4faa98[_0x97be('0x1d')](_0x97be('0x1e'),_0x455b81+'-'+_0x1bcc35+'/'+_0x549fcf)[_0x97be('0x1f')](_0x25e377);}return null;};}function patchUpdates(_0x2383a3){return function(_0x533ec1){try{jsonpatch[_0x97be('0x20')](_0x533ec1,_0x2383a3,!![]);}catch(_0x5c7f36){return BPromise[_0x97be('0x21')](_0x5c7f36);}return _0x533ec1[_0x97be('0x22')]();};}function saveUpdates(_0x5b899f,_0x151df5){return function(_0x5cd590){if(_0x5cd590){return _0x5cd590[_0x97be('0x23')](_0x5b899f)[_0x97be('0x24')](function(_0x3c04ae){return _0x3c04ae;});}return null;};}function removeEntity(_0x3e995f,_0x141ccc){return function(_0x4bc6f3){if(_0x4bc6f3){return _0x4bc6f3[_0x97be('0x25')]()[_0x97be('0x24')](function(){_0x3e995f[_0x97be('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x147dd3,_0x251f69){return function(_0x32466b){if(!_0x32466b){_0x147dd3[_0x97be('0x17')](0x194);}return _0x32466b;};}function handleError(_0x1a9d21,_0x1c93e8){_0x1c93e8=_0x1c93e8||0x1f4;return function(_0x3e7c14){logger[_0x97be('0x26')](_0x3e7c14[_0x97be('0x27')]);if(_0x3e7c14[_0x97be('0x28')]){delete _0x3e7c14[_0x97be('0x28')];}_0x1a9d21[_0x97be('0x1c')](_0x1c93e8)[_0x97be('0x29')](_0x3e7c14);};}exports[_0x97be('0x2a')]=function(_0xbe92ad,_0x1169b0){var _0x2798f1={},_0x372d3a={},_0x2b38c5={'count':0x0,'rows':[]};var _0x5ebc16=_[_0x97be('0x2b')](db[_0x97be('0x2c')]['rawAttributes'],function(_0x24acd0){return{'name':_0x24acd0[_0x97be('0x2d')],'type':_0x24acd0['type'][_0x97be('0x2e')]};});_0x372d3a[_0x97be('0x2f')]=_[_0x97be('0x2b')](_0x5ebc16,_0x97be('0x28'));_0x372d3a[_0x97be('0x30')]=_['keys'](_0xbe92ad[_0x97be('0x30')]);_0x372d3a[_0x97be('0x31')]=_['intersection'](_0x372d3a[_0x97be('0x2f')],_0x372d3a[_0x97be('0x30')]);_0x2798f1[_0x97be('0x32')]=_[_0x97be('0x33')](_0x372d3a['model'],qs[_0x97be('0x34')](_0xbe92ad['query'][_0x97be('0x34')]));_0x2798f1[_0x97be('0x32')]=_0x2798f1[_0x97be('0x32')][_0x97be('0x35')]?_0x2798f1['attributes']:_0x372d3a[_0x97be('0x2f')];if(!_0xbe92ad[_0x97be('0x30')][_0x97be('0x36')](_0x97be('0x37'))){_0x2798f1[_0x97be('0x1b')]=qs[_0x97be('0x1b')](_0xbe92ad[_0x97be('0x30')][_0x97be('0x1b')]);_0x2798f1[_0x97be('0x18')]=qs[_0x97be('0x18')](_0xbe92ad[_0x97be('0x30')][_0x97be('0x18')]);}_0x2798f1[_0x97be('0x38')]=qs[_0x97be('0x39')](_0xbe92ad[_0x97be('0x30')][_0x97be('0x39')]);_0x2798f1['where']=qs[_0x97be('0x31')](_[_0x97be('0x3a')](_0xbe92ad[_0x97be('0x30')],_0x372d3a[_0x97be('0x31')]),_0x5ebc16);if(_0xbe92ad[_0x97be('0x30')]['filter']){_0x2798f1['where']=_[_0x97be('0x3b')](_0x2798f1['where'],{'$or':_[_0x97be('0x2b')](_0x5ebc16,function(_0xc94d06){if(_0xc94d06['type']!==_0x97be('0x3c')){var _0x5b62b0={};_0x5b62b0[_0xc94d06[_0x97be('0x28')]]={'$like':'%'+_0xbe92ad['query'][_0x97be('0x3d')]+'%'};return _0x5b62b0;}})});}_0x2798f1=_[_0x97be('0x3b')]({},_0x2798f1,_0xbe92ad[_0x97be('0x3e')]);var _0x4ac878={'where':_0x2798f1[_0x97be('0x3f')]};return db[_0x97be('0x2c')][_0x97be('0x1a')](_0x4ac878)[_0x97be('0x24')](function(_0x1e203c){_0x2b38c5[_0x97be('0x1a')]=_0x1e203c;if(_0xbe92ad[_0x97be('0x30')]['includeAll']){_0x2798f1[_0x97be('0x40')]=[{'all':!![]}];}return db[_0x97be('0x2c')][_0x97be('0x41')](_0x2798f1);})[_0x97be('0x24')](function(_0x28219f){_0x2b38c5['rows']=_0x28219f;return _0x2b38c5;})[_0x97be('0x24')](respondWithFilteredResult(_0x1169b0,_0x2798f1))[_0x97be('0x42')](handleError(_0x1169b0,null));};exports['show']=function(_0x567d24,_0x2705d2){var _0x11f14={'raw':!![],'where':{'id':_0x567d24['params']['id']}},_0x4aac35={};_0x4aac35[_0x97be('0x2f')]=_[_0x97be('0x43')](db[_0x97be('0x2c')]['rawAttributes']);_0x4aac35[_0x97be('0x30')]=_['keys'](_0x567d24[_0x97be('0x30')]);_0x4aac35[_0x97be('0x31')]=_[_0x97be('0x33')](_0x4aac35[_0x97be('0x2f')],_0x4aac35[_0x97be('0x30')]);_0x11f14['attributes']=_['intersection'](_0x4aac35['model'],qs[_0x97be('0x34')](_0x567d24[_0x97be('0x30')][_0x97be('0x34')]));_0x11f14[_0x97be('0x32')]=_0x11f14[_0x97be('0x32')][_0x97be('0x35')]?_0x11f14[_0x97be('0x32')]:_0x4aac35[_0x97be('0x2f')];if(_0x567d24[_0x97be('0x30')][_0x97be('0x44')]){_0x11f14[_0x97be('0x40')]=[{'all':!![]}];}_0x11f14=_[_0x97be('0x3b')]({},_0x11f14,_0x567d24[_0x97be('0x3e')]);return db[_0x97be('0x2c')][_0x97be('0x45')](_0x11f14)['then'](handleEntityNotFound(_0x2705d2,null))[_0x97be('0x24')](respondWithResult(_0x2705d2,null))[_0x97be('0x42')](handleError(_0x2705d2,null));};exports['create']=function(_0x160460,_0x3ce9a8){return db[_0x97be('0x2c')][_0x97be('0x46')](_0x160460['body'],{})[_0x97be('0x24')](respondWithResult(_0x3ce9a8,0xc9))[_0x97be('0x42')](handleError(_0x3ce9a8,null));};exports[_0x97be('0x23')]=function(_0x45ca91,_0x326a5b){if(_0x45ca91[_0x97be('0x47')]['id']){delete _0x45ca91[_0x97be('0x47')]['id'];}return db[_0x97be('0x2c')][_0x97be('0x45')]({'where':{'id':_0x45ca91[_0x97be('0x48')]['id']}})[_0x97be('0x24')](handleEntityNotFound(_0x326a5b,null))[_0x97be('0x24')](saveUpdates(_0x45ca91[_0x97be('0x47')],null))[_0x97be('0x24')](respondWithResult(_0x326a5b,null))['catch'](handleError(_0x326a5b,null));};exports[_0x97be('0x25')]=function(_0x1e96a9,_0xb868e7){return db[_0x97be('0x2c')][_0x97be('0x45')]({'where':{'id':_0x1e96a9['params']['id']}})['then'](handleEntityNotFound(_0xb868e7,null))[_0x97be('0x24')](removeEntity(_0xb868e7,null))[_0x97be('0x42')](handleError(_0xb868e7,null));};exports[_0x97be('0x49')]=function(_0x4a331c,_0x1a9831){return db[_0x97be('0x2c')][_0x97be('0x49')]()['then'](respondWithResult(_0x1a9831,null))[_0x97be('0x42')](handleError(_0x1a9831,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e6e6d7a..22d456d 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 _0x67cb=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x53b3ed,_0xaac33e){var _0x24e1f7=function(_0x560591){while(--_0x560591){_0x53b3ed['push'](_0x53b3ed['shift']());}};_0x24e1f7(++_0xaac33e);}(_0x67cb,0x15c));var _0xb67c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x67cb[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require(_0xb67c('0x0'));var MailSubstatus=require(_0xb67c('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb67c('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1f11c9){return function(_0x20748e,_0x3decfd,_0xc4c47f){MailSubstatusEvents[_0xb67c('0x3')](_0x1f11c9+':'+_0x20748e['id'],_0x20748e);MailSubstatusEvents[_0xb67c('0x3')](_0x1f11c9,_0x20748e);_0xc4c47f(null);};}for(var e in events){if(events[_0xb67c('0x4')](e)){var event=events[e];MailSubstatus[_0xb67c('0x5')](e,emitEvent(event));}}module[_0xb67c('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x2b04=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b04,0x150));var _0x42b0=function(_0x4224b0,_0x13cd41){_0x4224b0=_0x4224b0-0x0;var _0x2d70ac=_0x2b04[_0x4224b0];return _0x2d70ac;};'use strict';var EventEmitter=require(_0x42b0('0x0'));var MailSubstatus=require(_0x42b0('0x1'))['db'][_0x42b0('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x42b0('0x3')](0x0);var events={'afterUpdate':_0x42b0('0x4')};function emitEvent(_0x14e695){return function(_0x3ab693,_0x13c20e,_0xce8777){MailSubstatusEvents[_0x42b0('0x5')](_0x14e695+':'+_0x3ab693['id'],_0x3ab693);MailSubstatusEvents[_0x42b0('0x5')](_0x14e695,_0x3ab693);_0xce8777(null);};}for(var e in events){if(events[_0x42b0('0x6')](e)){var event=events[e];MailSubstatus[_0x42b0('0x7')](e,emitEvent(event));}}module[_0x42b0('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2ecf30a..bab51eb 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 _0xaf67=['update','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x4dab14,_0x4bdfb5){var _0x371600=function(_0x25dd9e){while(--_0x25dd9e){_0x4dab14['push'](_0x4dab14['shift']());}};_0x371600(++_0x4bdfb5);}(_0xaf67,0x16f));var _0x7af6=function(_0x4cd3ef,_0xb6a3df){_0x4cd3ef=_0x4cd3ef-0x0;var _0x19411d=_0xaf67[_0x4cd3ef];return _0x19411d;};'use strict';var attributes=require(_0x7af6('0x0'));module[_0x7af6('0x1')]=function(_0x49b006){var _0x19b5f2=_0x49b006[_0x7af6('0x2')];return _0x49b006[_0x7af6('0x3')](_0x7af6('0x4'),attributes,{'tableName':_0x7af6('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x59df01,_0x282088,_0xc8aa19){return _0x19b5f2[_0x7af6('0x6')][_0x7af6('0x7')]({'value':_0x59df01['name']},{'where':{'field':_0x7af6('0x8'),'value':_0x59df01[_0x7af6('0x9')]['name']}})[_0x7af6('0xa')](function(){_0xc8aa19();})['catch'](function(_0xd362aa){_0xc8aa19(_0xd362aa);});}}});}; \ No newline at end of file +var _0x15c8=['then','catch','./mailSubstatus.attributes','models','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x15c8,0x7b));var _0x815c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15c8[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x815c('0x0'));module['exports']=function(_0x464f94){var _0xd3977d=_0x464f94[_0x815c('0x1')];return _0x464f94['define'](_0x815c('0x2'),attributes,{'tableName':_0x815c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x16bb4c,_0x4ba856,_0x515ed8){return _0xd3977d[_0x815c('0x4')][_0x815c('0x5')]({'value':_0x16bb4c[_0x815c('0x6')]},{'where':{'field':_0x815c('0x7'),'value':_0x16bb4c[_0x815c('0x8')][_0x815c('0x6')]}})[_0x815c('0x9')](function(){_0x515ed8();})[_0x815c('0xa')](function(_0x51e39a){_0x515ed8(_0x51e39a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 649e33c..0c12cfc 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 _0x0b81=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x580d7a,_0x1bf653){var _0x2e1a90=function(_0xd4fa5f){while(--_0xd4fa5f){_0x580d7a['push'](_0x580d7a['shift']());}};_0x2e1a90(++_0x1bf653);}(_0x0b81,0xbf));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x10b8('0x0'));var moment=require('moment');var BPromise=require(_0x10b8('0x1'));var rs=require(_0x10b8('0x2'));var fs=require('fs');var Redis=require(_0x10b8('0x3'));var db=require(_0x10b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x10b8('0x5'))(_0x10b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x10b8('0x7'));var client=jayson[_0x10b8('0x8')][_0x10b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af58c,_0x1cbe96,_0x43087b){return new BPromise(function(_0x4344f2,_0xe2f3b8){return client['request'](_0x1af58c,_0x43087b)[_0x10b8('0xa')](function(_0x42fd19){logger[_0x10b8('0xb')](_0x10b8('0xc'),_0x1cbe96,_0x10b8('0xd'));logger[_0x10b8('0xe')](_0x10b8('0xf'),_0x1cbe96,_0x10b8('0xd'),JSON[_0x10b8('0x10')](_0x42fd19));if(_0x42fd19[_0x10b8('0x11')]){if(_0x42fd19[_0x10b8('0x11')][_0x10b8('0x12')]===0x1f4){logger[_0x10b8('0x11')](_0x10b8('0xc'),_0x1cbe96,_0x42fd19[_0x10b8('0x11')]['message']);return _0xe2f3b8(_0x42fd19[_0x10b8('0x11')][_0x10b8('0x13')]);}logger[_0x10b8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1cbe96,_0x42fd19[_0x10b8('0x11')][_0x10b8('0x13')]);return _0x4344f2(_0x42fd19['error'][_0x10b8('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x1cbe96,'request\x20sent');_0x4344f2(_0x42fd19[_0x10b8('0x14')]['message']);}})[_0x10b8('0x15')](function(_0x5a4e3d){logger[_0x10b8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1cbe96,_0x5a4e3d);_0xe2f3b8(_0x5a4e3d);});});} \ No newline at end of file +var _0xbf54=['MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','request','then','info','MailSubstatus,\x20%s,\x20%s','debug'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbf54,0x8c));var _0x4bf5=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xbf54[_0x238671];return _0x474844;};'use strict';var _=require(_0x4bf5('0x0'));var util=require(_0x4bf5('0x1'));var moment=require('moment');var BPromise=require(_0x4bf5('0x2'));var rs=require(_0x4bf5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4bf5('0x4'));var logger=require(_0x4bf5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4bf5('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17856a,_0x7cafbb,_0x3614e2){return new BPromise(function(_0x506947,_0x17b457){return client[_0x4bf5('0x7')](_0x17856a,_0x3614e2)[_0x4bf5('0x8')](function(_0x24f0e8){logger[_0x4bf5('0x9')](_0x4bf5('0xa'),_0x7cafbb,'request\x20sent');logger[_0x4bf5('0xb')](_0x4bf5('0xc'),_0x7cafbb,_0x4bf5('0xd'),JSON[_0x4bf5('0xe')](_0x24f0e8));if(_0x24f0e8[_0x4bf5('0xf')]){if(_0x24f0e8[_0x4bf5('0xf')]['code']===0x1f4){logger[_0x4bf5('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x7cafbb,_0x24f0e8[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0x17b457(_0x24f0e8[_0x4bf5('0xf')][_0x4bf5('0x10')]);}logger[_0x4bf5('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x7cafbb,_0x24f0e8[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0x506947(_0x24f0e8[_0x4bf5('0xf')]['message']);}else{logger['info'](_0x4bf5('0xa'),_0x7cafbb,_0x4bf5('0xd'));_0x506947(_0x24f0e8[_0x4bf5('0x11')][_0x4bf5('0x10')]);}})[_0x4bf5('0x12')](function(_0x89395c){logger[_0x4bf5('0xf')](_0x4bf5('0xa'),_0x7cafbb,_0x89395c);_0x17b457(_0x89395c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 66a5d9b..c307fa3 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 _0x23b3=['index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x505439,_0x5a4a50){var _0x54267a=function(_0x5e635f){while(--_0x5e635f){_0x505439['push'](_0x505439['shift']());}};_0x54267a(++_0x5a4a50);}(_0x23b3,0x130));var _0x323b=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x23b3[_0x3ce937];return _0x41d2fa;};'use strict';var multer=require(_0x323b('0x0'));var util=require(_0x323b('0x1'));var path=require(_0x323b('0x2'));var timeout=require(_0x323b('0x3'));var express=require(_0x323b('0x4'));var router=express['Router']();var fs_extra=require(_0x323b('0x5'));var auth=require(_0x323b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x323b('0x7'));var controller=require(_0x323b('0x8'));router[_0x323b('0x9')]('/',auth[_0x323b('0xa')](),controller[_0x323b('0xb')]);router[_0x323b('0x9')](_0x323b('0xc'),auth[_0x323b('0xa')](),controller['describe']);router['get'](_0x323b('0xd'),auth['isAuthenticated'](),controller[_0x323b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x323b('0xf')]);router[_0x323b('0x10')](_0x323b('0xd'),auth[_0x323b('0xa')](),controller[_0x323b('0x11')]);router[_0x323b('0x12')](_0x323b('0xd'),auth['isAuthenticated'](),controller[_0x323b('0x13')]);module[_0x323b('0x14')]=router; \ No newline at end of file +var _0x32ec=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','create','update','destroy','exports','multer','util','path'];(function(_0x243986,_0x3b12b8){var _0x5a5891=function(_0x151db9){while(--_0x151db9){_0x243986['push'](_0x243986['shift']());}};_0x5a5891(++_0x3b12b8);}(_0x32ec,0x195));var _0xc32e=function(_0x129add,_0x33ccec){_0x129add=_0x129add-0x0;var _0x5f5bbb=_0x32ec[_0x129add];return _0x5f5bbb;};'use strict';var multer=require(_0xc32e('0x0'));var util=require(_0xc32e('0x1'));var path=require(_0xc32e('0x2'));var timeout=require(_0xc32e('0x3'));var express=require(_0xc32e('0x4'));var router=express[_0xc32e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc32e('0x6'));var interaction=require(_0xc32e('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xc32e('0x8')]('/',auth[_0xc32e('0x9')](),controller['index']);router['get'](_0xc32e('0xa'),auth[_0xc32e('0x9')](),controller[_0xc32e('0xb')]);router[_0xc32e('0x8')](_0xc32e('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc32e('0x9')](),controller[_0xc32e('0xd')]);router['put'](_0xc32e('0xc'),auth[_0xc32e('0x9')](),controller[_0xc32e('0xe')]);router['delete'](_0xc32e('0xc'),auth['isAuthenticated'](),controller[_0xc32e('0xf')]);module[_0xc32e('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5c5580f..a482b39 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3bbce6,_0x5e0837){_0x3bbce6=_0x3bbce6-0x0;var _0x3d51c3=_0xb43b[_0x3bbce6];return _0x3d51c3;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5c8b3b,_0x3e4bca){var _0xe9aed5=function(_0xadb6b1){while(--_0xadb6b1){_0x5c8b3b['push'](_0x5c8b3b['shift']());}};_0xe9aed5(++_0x3e4bca);}(_0xaa88,0x137));var _0x8aa8=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0xaa88[_0x3825a8];return _0xabc9bc;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 780a2e5..7e29359 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 _0x7b78=['catch','show','params','keys','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x7b78,0xa1));var _0x87b7=function(_0x11ba2c,_0x170a18){_0x11ba2c=_0x11ba2c-0x0;var _0x4872a2=_0x7b78[_0x11ba2c];return _0x4872a2;};'use strict';var emlformat=require(_0x87b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87b7('0x1'));var jsonpatch=require(_0x87b7('0x2'));var rp=require(_0x87b7('0x3'));var moment=require(_0x87b7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87b7('0x5'));var path=require(_0x87b7('0x6'));var sox=require(_0x87b7('0x7'));var csv=require(_0x87b7('0x8'));var ejs=require(_0x87b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87b7('0xa'));var squel=require(_0x87b7('0xb'));var crypto=require(_0x87b7('0xc'));var jsforce=require(_0x87b7('0xd'));var deskjs=require(_0x87b7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x87b7('0xf'));var Papa=require(_0x87b7('0x10'));var Redis=require('ioredis');var authService=require(_0x87b7('0x11'));var qs=require(_0x87b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x87b7('0x13'));var utils=require(_0x87b7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87b7('0x15'))['db'];function respondWithStatusCode(_0x3e0602,_0x4077df){_0x4077df=_0x4077df||0xcc;return function(_0x2fbee5){if(_0x2fbee5){return _0x3e0602[_0x87b7('0x16')](_0x4077df);}return _0x3e0602['status'](_0x4077df)[_0x87b7('0x17')]();};}function respondWithResult(_0x2323ee,_0x5e988a){_0x5e988a=_0x5e988a||0xc8;return function(_0x1731c2){if(_0x1731c2){return _0x2323ee['status'](_0x5e988a)['json'](_0x1731c2);}};}function respondWithFilteredResult(_0x45d856,_0xc507fe){return function(_0x38ac97){if(_0x38ac97){var _0x131716=typeof _0xc507fe[_0x87b7('0x18')]==='undefined'&&typeof _0xc507fe[_0x87b7('0x19')]===_0x87b7('0x1a');var _0x450aac=_0x38ac97['count'];var _0x16c382=_0x131716?0x0:_0xc507fe[_0x87b7('0x18')];var _0x4398b2=_0x131716?_0x38ac97[_0x87b7('0x1b')]:_0xc507fe['offset']+_0xc507fe['limit'];var _0x54aff3;if(_0x4398b2>=_0x450aac){_0x4398b2=_0x450aac;_0x54aff3=0xc8;}else{_0x54aff3=0xce;}_0x45d856[_0x87b7('0x1c')](_0x54aff3);return _0x45d856[_0x87b7('0x1d')](_0x87b7('0x1e'),_0x16c382+'-'+_0x4398b2+'/'+_0x450aac)[_0x87b7('0x1f')](_0x38ac97);}return null;};}function patchUpdates(_0x163be5){return function(_0x13dbf1){try{jsonpatch[_0x87b7('0x20')](_0x13dbf1,_0x163be5,!![]);}catch(_0x5df017){return BPromise[_0x87b7('0x21')](_0x5df017);}return _0x13dbf1['save']();};}function saveUpdates(_0x4646c5,_0x5ebe4a){return function(_0x1cf5e2){if(_0x1cf5e2){return _0x1cf5e2[_0x87b7('0x22')](_0x4646c5)[_0x87b7('0x23')](function(_0x4964b3){return _0x4964b3;});}return null;};}function removeEntity(_0x43bef1,_0x228ffb){return function(_0x535268){if(_0x535268){return _0x535268[_0x87b7('0x24')]()[_0x87b7('0x23')](function(){_0x43bef1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e7775,_0x1c4423){return function(_0x2f2815){if(!_0x2f2815){_0x7e7775[_0x87b7('0x16')](0x194);}return _0x2f2815;};}function handleError(_0x48d26d,_0x23e692){_0x23e692=_0x23e692||0x1f4;return function(_0x26d590){logger[_0x87b7('0x25')](_0x26d590[_0x87b7('0x26')]);if(_0x26d590[_0x87b7('0x27')]){delete _0x26d590[_0x87b7('0x27')];}_0x48d26d['status'](_0x23e692)[_0x87b7('0x28')](_0x26d590);};}exports['index']=function(_0x2e5318,_0x455b2d){var _0x2a84f0={},_0xef671b={},_0x765b8={'count':0x0,'rows':[]};var _0x39a8c2=_[_0x87b7('0x29')](db[_0x87b7('0x2a')][_0x87b7('0x2b')],function(_0xae4824){return{'name':_0xae4824[_0x87b7('0x2c')],'type':_0xae4824[_0x87b7('0x2d')][_0x87b7('0x2e')]};});_0xef671b['model']=_['map'](_0x39a8c2,_0x87b7('0x27'));_0xef671b[_0x87b7('0x2f')]=_['keys'](_0x2e5318[_0x87b7('0x2f')]);_0xef671b[_0x87b7('0x30')]=_[_0x87b7('0x31')](_0xef671b['model'],_0xef671b['query']);_0x2a84f0['attributes']=_['intersection'](_0xef671b[_0x87b7('0x32')],qs['fields'](_0x2e5318[_0x87b7('0x2f')][_0x87b7('0x33')]));_0x2a84f0[_0x87b7('0x34')]=_0x2a84f0[_0x87b7('0x34')][_0x87b7('0x35')]?_0x2a84f0[_0x87b7('0x34')]:_0xef671b[_0x87b7('0x32')];if(!_0x2e5318[_0x87b7('0x2f')][_0x87b7('0x36')](_0x87b7('0x37'))){_0x2a84f0[_0x87b7('0x19')]=qs[_0x87b7('0x19')](_0x2e5318[_0x87b7('0x2f')]['limit']);_0x2a84f0[_0x87b7('0x18')]=qs['offset'](_0x2e5318['query'][_0x87b7('0x18')]);}_0x2a84f0[_0x87b7('0x38')]=qs['sort'](_0x2e5318[_0x87b7('0x2f')][_0x87b7('0x39')]);_0x2a84f0[_0x87b7('0x3a')]=qs[_0x87b7('0x30')](_[_0x87b7('0x3b')](_0x2e5318[_0x87b7('0x2f')],_0xef671b[_0x87b7('0x30')]),_0x39a8c2);if(_0x2e5318['query'][_0x87b7('0x3c')]){_0x2a84f0[_0x87b7('0x3a')]=_['merge'](_0x2a84f0[_0x87b7('0x3a')],{'$or':_[_0x87b7('0x29')](_0x39a8c2,function(_0x314b8a){if(_0x314b8a[_0x87b7('0x2d')]!==_0x87b7('0x3d')){var _0x5dc3e0={};_0x5dc3e0[_0x314b8a[_0x87b7('0x27')]]={'$like':'%'+_0x2e5318[_0x87b7('0x2f')][_0x87b7('0x3c')]+'%'};return _0x5dc3e0;}})});}_0x2a84f0=_[_0x87b7('0x3e')]({},_0x2a84f0,_0x2e5318[_0x87b7('0x3f')]);var _0x57571f={'where':_0x2a84f0['where']};return db[_0x87b7('0x2a')][_0x87b7('0x1b')](_0x57571f)[_0x87b7('0x23')](function(_0x582fc4){_0x765b8[_0x87b7('0x1b')]=_0x582fc4;if(_0x2e5318[_0x87b7('0x2f')][_0x87b7('0x40')]){_0x2a84f0['include']=[{'all':!![]}];}return db[_0x87b7('0x2a')][_0x87b7('0x41')](_0x2a84f0);})[_0x87b7('0x23')](function(_0x304e24){_0x765b8[_0x87b7('0x42')]=_0x304e24;return _0x765b8;})[_0x87b7('0x23')](respondWithFilteredResult(_0x455b2d,_0x2a84f0))[_0x87b7('0x43')](handleError(_0x455b2d,null));};exports[_0x87b7('0x44')]=function(_0x1dae7a,_0x3cfdb5){var _0x1eb2e1={'raw':!![],'where':{'id':_0x1dae7a[_0x87b7('0x45')]['id']}},_0xeaef68={};_0xeaef68['model']=_[_0x87b7('0x46')](db[_0x87b7('0x2a')]['rawAttributes']);_0xeaef68[_0x87b7('0x2f')]=_[_0x87b7('0x46')](_0x1dae7a[_0x87b7('0x2f')]);_0xeaef68[_0x87b7('0x30')]=_[_0x87b7('0x31')](_0xeaef68[_0x87b7('0x32')],_0xeaef68[_0x87b7('0x2f')]);_0x1eb2e1['attributes']=_[_0x87b7('0x31')](_0xeaef68[_0x87b7('0x32')],qs[_0x87b7('0x33')](_0x1dae7a['query']['fields']));_0x1eb2e1['attributes']=_0x1eb2e1[_0x87b7('0x34')][_0x87b7('0x35')]?_0x1eb2e1['attributes']:_0xeaef68[_0x87b7('0x32')];if(_0x1dae7a[_0x87b7('0x2f')][_0x87b7('0x40')]){_0x1eb2e1[_0x87b7('0x47')]=[{'all':!![]}];}_0x1eb2e1=_[_0x87b7('0x3e')]({},_0x1eb2e1,_0x1dae7a['options']);return db['MailTransferReport']['find'](_0x1eb2e1)[_0x87b7('0x23')](handleEntityNotFound(_0x3cfdb5,null))[_0x87b7('0x23')](respondWithResult(_0x3cfdb5,null))[_0x87b7('0x43')](handleError(_0x3cfdb5,null));};exports[_0x87b7('0x48')]=function(_0x158fc5,_0x481be7){return db[_0x87b7('0x2a')][_0x87b7('0x48')](_0x158fc5[_0x87b7('0x49')],{})['then'](respondWithResult(_0x481be7,0xc9))['catch'](handleError(_0x481be7,null));};exports[_0x87b7('0x22')]=function(_0x40407f,_0xe4337c){if(_0x40407f[_0x87b7('0x49')]['id']){delete _0x40407f[_0x87b7('0x49')]['id'];}return db[_0x87b7('0x2a')][_0x87b7('0x4a')]({'where':{'id':_0x40407f[_0x87b7('0x45')]['id']}})[_0x87b7('0x23')](handleEntityNotFound(_0xe4337c,null))[_0x87b7('0x23')](saveUpdates(_0x40407f[_0x87b7('0x49')],null))[_0x87b7('0x23')](respondWithResult(_0xe4337c,null))[_0x87b7('0x43')](handleError(_0xe4337c,null));};exports['destroy']=function(_0x1f8d28,_0x585a1f){return db[_0x87b7('0x2a')]['find']({'where':{'id':_0x1f8d28[_0x87b7('0x45')]['id']}})[_0x87b7('0x23')](handleEntityNotFound(_0x585a1f,null))[_0x87b7('0x23')](removeEntity(_0x585a1f,null))[_0x87b7('0x43')](handleError(_0x585a1f,null));};exports[_0x87b7('0x4b')]=function(_0x41545f,_0x399945){return db[_0x87b7('0x2a')][_0x87b7('0x4b')]()[_0x87b7('0x23')](respondWithResult(_0x399945,null))['catch'](handleError(_0x399945,null));}; \ No newline at end of file +var _0x2f30=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','MailTransferReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','map','VIRTUAL','filter','merge','options','includeAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse'];(function(_0x106531,_0x71cc95){var _0x50a8bb=function(_0xab4dff){while(--_0xab4dff){_0x106531['push'](_0x106531['shift']());}};_0x50a8bb(++_0x71cc95);}(_0x2f30,0x1d4));var _0x02f3=function(_0x542bc6,_0x5ec0a3){_0x542bc6=_0x542bc6-0x0;var _0x1a8130=_0x2f30[_0x542bc6];return _0x1a8130;};'use strict';var emlformat=require(_0x02f3('0x0'));var rimraf=require(_0x02f3('0x1'));var zipdir=require(_0x02f3('0x2'));var jsonpatch=require(_0x02f3('0x3'));var rp=require(_0x02f3('0x4'));var moment=require('moment');var BPromise=require(_0x02f3('0x5'));var Mustache=require('mustache');var util=require(_0x02f3('0x6'));var path=require(_0x02f3('0x7'));var sox=require(_0x02f3('0x8'));var csv=require(_0x02f3('0x9'));var ejs=require(_0x02f3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x02f3('0xb'));var deskjs=require(_0x02f3('0xc'));var toCsv=require(_0x02f3('0x9'));var querystring=require(_0x02f3('0xd'));var Papa=require(_0x02f3('0xe'));var Redis=require('ioredis');var authService=require(_0x02f3('0xf'));var qs=require(_0x02f3('0x10'));var as=require(_0x02f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02f3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x02f3('0x13'));var licenseUtil=require(_0x02f3('0x14'));var db=require(_0x02f3('0x15'))['db'];function respondWithStatusCode(_0x10ad84,_0x409d25){_0x409d25=_0x409d25||0xcc;return function(_0x58572d){if(_0x58572d){return _0x10ad84[_0x02f3('0x16')](_0x409d25);}return _0x10ad84[_0x02f3('0x17')](_0x409d25)[_0x02f3('0x18')]();};}function respondWithResult(_0x41a415,_0x28f348){_0x28f348=_0x28f348||0xc8;return function(_0x172024){if(_0x172024){return _0x41a415['status'](_0x28f348)[_0x02f3('0x19')](_0x172024);}};}function respondWithFilteredResult(_0x5ce4a4,_0x4c62b3){return function(_0x1f3d2e){if(_0x1f3d2e){var _0x244d5e=typeof _0x4c62b3[_0x02f3('0x1a')]==='undefined'&&typeof _0x4c62b3['limit']==='undefined';var _0x5bb885=_0x1f3d2e[_0x02f3('0x1b')];var _0x14028=_0x244d5e?0x0:_0x4c62b3[_0x02f3('0x1a')];var _0x429dd4=_0x244d5e?_0x1f3d2e[_0x02f3('0x1b')]:_0x4c62b3[_0x02f3('0x1a')]+_0x4c62b3[_0x02f3('0x1c')];var _0x4d1f52;if(_0x429dd4>=_0x5bb885){_0x429dd4=_0x5bb885;_0x4d1f52=0xc8;}else{_0x4d1f52=0xce;}_0x5ce4a4['status'](_0x4d1f52);return _0x5ce4a4['set'](_0x02f3('0x1d'),_0x14028+'-'+_0x429dd4+'/'+_0x5bb885)[_0x02f3('0x19')](_0x1f3d2e);}return null;};}function patchUpdates(_0x221a0e){return function(_0x5791f4){try{jsonpatch['apply'](_0x5791f4,_0x221a0e,!![]);}catch(_0x2b5925){return BPromise[_0x02f3('0x1e')](_0x2b5925);}return _0x5791f4[_0x02f3('0x1f')]();};}function saveUpdates(_0x155301,_0x3a8d37){return function(_0x37aa70){if(_0x37aa70){return _0x37aa70[_0x02f3('0x20')](_0x155301)[_0x02f3('0x21')](function(_0x1c43dd){return _0x1c43dd;});}return null;};}function removeEntity(_0x2a3335,_0x31ff34){return function(_0x454e5f){if(_0x454e5f){return _0x454e5f[_0x02f3('0x22')]()[_0x02f3('0x21')](function(){_0x2a3335[_0x02f3('0x17')](0xcc)[_0x02f3('0x18')]();});}};}function handleEntityNotFound(_0x59679f,_0x1c6150){return function(_0x549e3e){if(!_0x549e3e){_0x59679f[_0x02f3('0x16')](0x194);}return _0x549e3e;};}function handleError(_0x1c5728,_0xbbc615){_0xbbc615=_0xbbc615||0x1f4;return function(_0x24a2dc){logger[_0x02f3('0x23')](_0x24a2dc['stack']);if(_0x24a2dc[_0x02f3('0x24')]){delete _0x24a2dc['name'];}_0x1c5728[_0x02f3('0x17')](_0xbbc615)[_0x02f3('0x25')](_0x24a2dc);};}exports[_0x02f3('0x26')]=function(_0x1804f0,_0x324b12){var _0x51248e={},_0x2a6c45={},_0x31c090={'count':0x0,'rows':[]};var _0x26db16=_['map'](db[_0x02f3('0x27')][_0x02f3('0x28')],function(_0x47e5ce){return{'name':_0x47e5ce['fieldName'],'type':_0x47e5ce[_0x02f3('0x29')][_0x02f3('0x2a')]};});_0x2a6c45['model']=_['map'](_0x26db16,_0x02f3('0x24'));_0x2a6c45[_0x02f3('0x2b')]=_[_0x02f3('0x2c')](_0x1804f0[_0x02f3('0x2b')]);_0x2a6c45[_0x02f3('0x2d')]=_['intersection'](_0x2a6c45[_0x02f3('0x2e')],_0x2a6c45['query']);_0x51248e[_0x02f3('0x2f')]=_[_0x02f3('0x30')](_0x2a6c45[_0x02f3('0x2e')],qs[_0x02f3('0x31')](_0x1804f0[_0x02f3('0x2b')][_0x02f3('0x31')]));_0x51248e['attributes']=_0x51248e[_0x02f3('0x2f')][_0x02f3('0x32')]?_0x51248e[_0x02f3('0x2f')]:_0x2a6c45[_0x02f3('0x2e')];if(!_0x1804f0['query'][_0x02f3('0x33')]('nolimit')){_0x51248e[_0x02f3('0x1c')]=qs[_0x02f3('0x1c')](_0x1804f0['query']['limit']);_0x51248e[_0x02f3('0x1a')]=qs[_0x02f3('0x1a')](_0x1804f0[_0x02f3('0x2b')]['offset']);}_0x51248e[_0x02f3('0x34')]=qs[_0x02f3('0x35')](_0x1804f0['query']['sort']);_0x51248e[_0x02f3('0x36')]=qs['filters'](_['pick'](_0x1804f0[_0x02f3('0x2b')],_0x2a6c45[_0x02f3('0x2d')]),_0x26db16);if(_0x1804f0[_0x02f3('0x2b')]['filter']){_0x51248e[_0x02f3('0x36')]=_['merge'](_0x51248e[_0x02f3('0x36')],{'$or':_[_0x02f3('0x37')](_0x26db16,function(_0x33adc2){if(_0x33adc2['type']!==_0x02f3('0x38')){var _0x138590={};_0x138590[_0x33adc2[_0x02f3('0x24')]]={'$like':'%'+_0x1804f0[_0x02f3('0x2b')][_0x02f3('0x39')]+'%'};return _0x138590;}})});}_0x51248e=_[_0x02f3('0x3a')]({},_0x51248e,_0x1804f0[_0x02f3('0x3b')]);var _0x2d5007={'where':_0x51248e['where']};return db['MailTransferReport'][_0x02f3('0x1b')](_0x2d5007)[_0x02f3('0x21')](function(_0x46cedb){_0x31c090[_0x02f3('0x1b')]=_0x46cedb;if(_0x1804f0[_0x02f3('0x2b')][_0x02f3('0x3c')]){_0x51248e['include']=[{'all':!![]}];}return db[_0x02f3('0x27')]['findAll'](_0x51248e);})[_0x02f3('0x21')](function(_0x365f01){_0x31c090[_0x02f3('0x3d')]=_0x365f01;return _0x31c090;})[_0x02f3('0x21')](respondWithFilteredResult(_0x324b12,_0x51248e))[_0x02f3('0x3e')](handleError(_0x324b12,null));};exports['show']=function(_0x530b54,_0x168c18){var _0x2be237={'raw':!![],'where':{'id':_0x530b54[_0x02f3('0x3f')]['id']}},_0x69d00d={};_0x69d00d[_0x02f3('0x2e')]=_[_0x02f3('0x2c')](db['MailTransferReport'][_0x02f3('0x28')]);_0x69d00d[_0x02f3('0x2b')]=_[_0x02f3('0x2c')](_0x530b54[_0x02f3('0x2b')]);_0x69d00d[_0x02f3('0x2d')]=_[_0x02f3('0x30')](_0x69d00d[_0x02f3('0x2e')],_0x69d00d[_0x02f3('0x2b')]);_0x2be237['attributes']=_[_0x02f3('0x30')](_0x69d00d[_0x02f3('0x2e')],qs[_0x02f3('0x31')](_0x530b54['query'][_0x02f3('0x31')]));_0x2be237['attributes']=_0x2be237[_0x02f3('0x2f')][_0x02f3('0x32')]?_0x2be237[_0x02f3('0x2f')]:_0x69d00d[_0x02f3('0x2e')];if(_0x530b54['query']['includeAll']){_0x2be237[_0x02f3('0x40')]=[{'all':!![]}];}_0x2be237=_['merge']({},_0x2be237,_0x530b54['options']);return db[_0x02f3('0x27')][_0x02f3('0x41')](_0x2be237)[_0x02f3('0x21')](handleEntityNotFound(_0x168c18,null))[_0x02f3('0x21')](respondWithResult(_0x168c18,null))['catch'](handleError(_0x168c18,null));};exports[_0x02f3('0x42')]=function(_0xc0329c,_0x1c51d2){return db[_0x02f3('0x27')]['create'](_0xc0329c['body'],{})['then'](respondWithResult(_0x1c51d2,0xc9))[_0x02f3('0x3e')](handleError(_0x1c51d2,null));};exports[_0x02f3('0x20')]=function(_0x335cf1,_0x3287ab){if(_0x335cf1[_0x02f3('0x43')]['id']){delete _0x335cf1[_0x02f3('0x43')]['id'];}return db[_0x02f3('0x27')][_0x02f3('0x41')]({'where':{'id':_0x335cf1['params']['id']}})['then'](handleEntityNotFound(_0x3287ab,null))['then'](saveUpdates(_0x335cf1[_0x02f3('0x43')],null))[_0x02f3('0x21')](respondWithResult(_0x3287ab,null))[_0x02f3('0x3e')](handleError(_0x3287ab,null));};exports[_0x02f3('0x22')]=function(_0x2aa609,_0xbbf750){return db[_0x02f3('0x27')][_0x02f3('0x41')]({'where':{'id':_0x2aa609['params']['id']}})[_0x02f3('0x21')](handleEntityNotFound(_0xbbf750,null))[_0x02f3('0x21')](removeEntity(_0xbbf750,null))[_0x02f3('0x3e')](handleError(_0xbbf750,null));};exports[_0x02f3('0x44')]=function(_0x53cd3c,_0x2e720c){return db[_0x02f3('0x27')][_0x02f3('0x44')]()[_0x02f3('0x21')](respondWithResult(_0x2e720c,null))[_0x02f3('0x3e')](handleError(_0x2e720c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c865b92..c7b0a6e 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 _0x177e=['../../config/environment','define','report_mail_transfer','uniqueid','path','rimraf'];(function(_0xad0aaa,_0x4943c8){var _0x168b18=function(_0x6e6e35){while(--_0x6e6e35){_0xad0aaa['push'](_0xad0aaa['shift']());}};_0x168b18(++_0x4943c8);}(_0x177e,0xd0));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe177('0x0'));var rimraf=require(_0xe177('0x1'));var config=require(_0xe177('0x2'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x5b84fc,_0x1e2af3){return _0x5b84fc[_0xe177('0x3')]('MailTransferReport',attributes,{'tableName':_0xe177('0x4'),'paranoid':![],'indexes':[{'name':_0xe177('0x5'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4534=['bluebird','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2b1fd6,_0x1c1aaa){var _0x2bc96e=function(_0x5c7ad1){while(--_0x5c7ad1){_0x2b1fd6['push'](_0x2b1fd6['shift']());}};_0x2bc96e(++_0x1c1aaa);}(_0x4534,0x141));var _0x4453=function(_0x3be9cc,_0x3b913b){_0x3be9cc=_0x3be9cc-0x0;var _0x545bc3=_0x4534[_0x3be9cc];return _0x545bc3;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x4453('0x8')]=function(_0x456815,_0x25bf80){return _0x456815[_0x4453('0x9')](_0x4453('0xa'),attributes,{'tableName':_0x4453('0xb'),'paranoid':![],'indexes':[{'name':_0x4453('0xc'),'fields':[_0x4453('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 91e7c9f..5f2bdbf 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 _0x9ee1=['request\x20sent','debug','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x672125,_0x38ba36){var _0x21074e=function(_0x15f426){while(--_0x15f426){_0x672125['push'](_0x672125['shift']());}};_0x21074e(++_0x38ba36);}(_0x9ee1,0x69));var _0x19ee=function(_0xc9c4a9,_0x349a6e){_0xc9c4a9=_0xc9c4a9-0x0;var _0x578179=_0x9ee1[_0xc9c4a9];return _0x578179;};'use strict';var _=require(_0x19ee('0x0'));var util=require(_0x19ee('0x1'));var moment=require(_0x19ee('0x2'));var BPromise=require(_0x19ee('0x3'));var rs=require(_0x19ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x19ee('0x5'));var logger=require(_0x19ee('0x6'))(_0x19ee('0x7'));var config=require(_0x19ee('0x8'));var jayson=require(_0x19ee('0x9'));var client=jayson[_0x19ee('0xa')][_0x19ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x179bc9,_0x561e68,_0x3cd7a6){return new BPromise(function(_0x100b56,_0x2d26ff){return client[_0x19ee('0xc')](_0x179bc9,_0x3cd7a6)[_0x19ee('0xd')](function(_0x424aab){logger[_0x19ee('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x561e68,_0x19ee('0xf'));logger[_0x19ee('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x561e68,'request\x20sent',JSON[_0x19ee('0x11')](_0x424aab));if(_0x424aab[_0x19ee('0x12')]){if(_0x424aab[_0x19ee('0x12')][_0x19ee('0x13')]===0x1f4){logger[_0x19ee('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x561e68,_0x424aab['error'][_0x19ee('0x14')]);return _0x2d26ff(_0x424aab[_0x19ee('0x12')]['message']);}logger[_0x19ee('0x12')](_0x19ee('0x15'),_0x561e68,_0x424aab[_0x19ee('0x12')][_0x19ee('0x14')]);return _0x100b56(_0x424aab[_0x19ee('0x12')][_0x19ee('0x14')]);}else{logger[_0x19ee('0xe')](_0x19ee('0x15'),_0x561e68,_0x19ee('0xf'));_0x100b56(_0x424aab[_0x19ee('0x16')][_0x19ee('0x14')]);}})[_0x19ee('0x17')](function(_0x1713e9){logger[_0x19ee('0x12')](_0x19ee('0x15'),_0x561e68,_0x1713e9);_0x2d26ff(_0x1713e9);});});} \ No newline at end of file +var _0xf50e=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x184c6d,_0x2d6af0){var _0x26f221=function(_0x2c2a07){while(--_0x2c2a07){_0x184c6d['push'](_0x184c6d['shift']());}};_0x26f221(++_0x2d6af0);}(_0xf50e,0x71));var _0xef50=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0xf50e[_0x36d703];return _0x12c909;};'use strict';var _=require(_0xef50('0x0'));var util=require(_0xef50('0x1'));var moment=require(_0xef50('0x2'));var BPromise=require(_0xef50('0x3'));var rs=require(_0xef50('0x4'));var fs=require('fs');var Redis=require(_0xef50('0x5'));var db=require(_0xef50('0x6'))['db'];var utils=require(_0xef50('0x7'));var logger=require(_0xef50('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef50('0x9'));var client=jayson[_0xef50('0xa')][_0xef50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27b7e2,_0x4a8fd8,_0x316350){return new BPromise(function(_0x2a6a60,_0x31055e){return client['request'](_0x27b7e2,_0x316350)[_0xef50('0xc')](function(_0x2ae284){logger[_0xef50('0xd')](_0xef50('0xe'),_0x4a8fd8,_0xef50('0xf'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4a8fd8,_0xef50('0xf'),JSON[_0xef50('0x10')](_0x2ae284));if(_0x2ae284[_0xef50('0x11')]){if(_0x2ae284[_0xef50('0x11')][_0xef50('0x12')]===0x1f4){logger[_0xef50('0x11')](_0xef50('0xe'),_0x4a8fd8,_0x2ae284['error'][_0xef50('0x13')]);return _0x31055e(_0x2ae284[_0xef50('0x11')][_0xef50('0x13')]);}logger[_0xef50('0x11')](_0xef50('0xe'),_0x4a8fd8,_0x2ae284[_0xef50('0x11')][_0xef50('0x13')]);return _0x2a6a60(_0x2ae284[_0xef50('0x11')][_0xef50('0x13')]);}else{logger[_0xef50('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4a8fd8,_0xef50('0xf'));_0x2a6a60(_0x2ae284[_0xef50('0x14')][_0xef50('0x13')]);}})[_0xef50('0x15')](function(_0x26be53){logger['error'](_0xef50('0xe'),_0x4a8fd8,_0x26be53);_0x31055e(_0x26be53);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f0688f4..754ad4c 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 _0xdb84=['describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0xdb84,0x196));var _0x4db8=function(_0x5def29,_0x2aad51){_0x5def29=_0x5def29-0x0;var _0x17241a=_0xdb84[_0x5def29];return _0x17241a;};'use strict';var multer=require(_0x4db8('0x0'));var util=require(_0x4db8('0x1'));var path=require(_0x4db8('0x2'));var timeout=require(_0x4db8('0x3'));var express=require(_0x4db8('0x4'));var router=express[_0x4db8('0x5')]();var fs_extra=require(_0x4db8('0x6'));var auth=require(_0x4db8('0x7'));var interaction=require(_0x4db8('0x8'));var config=require(_0x4db8('0x9'));var controller=require('./memberReport.controller');router[_0x4db8('0xa')]('/',auth[_0x4db8('0xb')](),controller[_0x4db8('0xc')]);router['get'](_0x4db8('0xd'),auth[_0x4db8('0xb')](),controller[_0x4db8('0xe')]);router['get'](_0x4db8('0xf'),auth[_0x4db8('0xb')](),controller[_0x4db8('0x10')]);router[_0x4db8('0x11')]('/',auth[_0x4db8('0xb')](),controller['create']);router[_0x4db8('0x12')](_0x4db8('0xf'),auth[_0x4db8('0xb')](),controller[_0x4db8('0x13')]);router[_0x4db8('0x14')]('/:id',auth[_0x4db8('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1ce5=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/:id','show','post'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x1ce5,0x1c7));var _0x51ce=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1ce5[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x51ce('0x0'));var util=require('util');var path=require(_0x51ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x51ce('0x2'));var router=express[_0x51ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x51ce('0x4'));var interaction=require(_0x51ce('0x5'));var config=require(_0x51ce('0x6'));var controller=require(_0x51ce('0x7'));router[_0x51ce('0x8')]('/',auth[_0x51ce('0x9')](),controller['index']);router[_0x51ce('0x8')]('/describe',auth[_0x51ce('0x9')](),controller['describe']);router['get'](_0x51ce('0xa'),auth['isAuthenticated'](),controller[_0x51ce('0xb')]);router[_0x51ce('0xc')]('/',auth[_0x51ce('0x9')](),controller['create']);router[_0x51ce('0xd')](_0x51ce('0xa'),auth[_0x51ce('0x9')](),controller[_0x51ce('0xe')]);router[_0x51ce('0xf')]('/:id',auth[_0x51ce('0x9')](),controller[_0x51ce('0x10')]);module[_0x51ce('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e768573..ccf163d 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 _0x586c=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x30c7a4,_0x40e9c1){var _0x37d1d7=function(_0x2bac2b){while(--_0x2bac2b){_0x30c7a4['push'](_0x30c7a4['shift']());}};_0x37d1d7(++_0x40e9c1);}(_0x586c,0x82));var _0xc586=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0x586c[_0x5a2299];return _0xedff0f;};'use strict';var Sequelize=require(_0xc586('0x0'));var moment=require(_0xc586('0x1'));module[_0xc586('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc586('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xc586('0x4'),'comment':_0xc586('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xc586('0x6')]},'exitAt':{'type':Sequelize[_0xc586('0x6')],'set':function(_0xa07c48){var _0x481f36=moment(_0xa07c48);var _0x22d4e4=moment(this[_0xc586('0x7')]('enterAt'));var _0x5976d5=_0x481f36['diff'](_0x22d4e4,_0xc586('0x8'));this[_0xc586('0x9')]('exitAt',_0xa07c48);this[_0xc586('0x9')]('duration',_0x5976d5>=0x0?_0x5976d5:null);}},'data1':{'type':Sequelize[_0xc586('0x3')],'comment':_0xc586('0xa')},'data2':{'type':Sequelize[_0xc586('0x3')],'comment':_0xc586('0xb')},'data3':{'type':Sequelize[_0xc586('0x3')],'comment':_0xc586('0xc')},'data4':{'type':Sequelize[_0xc586('0x3')],'comment':_0xc586('0xd')},'data5':{'type':Sequelize[_0xc586('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xc586('0x3')]},'internal':{'type':Sequelize[_0xc586('0xe')]},'uniqueid':{'type':Sequelize[_0xc586('0x3')]}}; \ No newline at end of file +var _0x71d1=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','diff','setDataValue','exitAt'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x71d1,0x110));var _0x171d=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x71d1[_0xd7b0a4];return _0x184e9e;};'use strict';var Sequelize=require(_0x171d('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x171d('0x1')]},'membername':{'type':Sequelize[_0x171d('0x1')]},'interface':{'type':Sequelize[_0x171d('0x1')]},'type':{'type':Sequelize[_0x171d('0x1')],'defaultValue':_0x171d('0x2'),'comment':_0x171d('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x171d('0x4')]},'exitAt':{'type':Sequelize[_0x171d('0x4')],'set':function(_0x454c09){var _0x162bf0=moment(_0x454c09);var _0x1fe642=moment(this['getDataValue']('enterAt'));var _0x1adef9=_0x162bf0[_0x171d('0x5')](_0x1fe642,'seconds');this[_0x171d('0x6')](_0x171d('0x7'),_0x454c09);this[_0x171d('0x6')](_0x171d('0x8'),_0x1adef9>=0x0?_0x1adef9:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x171d('0x9')},'data2':{'type':Sequelize[_0x171d('0x1')],'comment':_0x171d('0xa')},'data3':{'type':Sequelize[_0x171d('0x1')],'comment':_0x171d('0xb')},'data4':{'type':Sequelize[_0x171d('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x171d('0xc')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x171d('0xd')]},'uniqueid':{'type':Sequelize[_0x171d('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 57826ea..e56fdab 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x5f15df,_0x960bb7){var _0x388f8d=function(_0x38657b){while(--_0x38657b){_0x5f15df['push'](_0x5f15df['shift']());}};_0x388f8d(++_0x960bb7);}(_0x3e74,0x175));var _0x43e7=function(_0x2d2e30,_0x432ca8){_0x2d2e30=_0x2d2e30-0x0;var _0x3fd07a=_0x3e74[_0x2d2e30];return _0x3fd07a;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +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(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x34e8,0x12c));var _0x834e=function(_0x4dcebc,_0x3d9710){_0x4dcebc=_0x4dcebc-0x0;var _0x985a49=_0x34e8[_0x4dcebc];return _0x985a49;};'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 bdc2385..1aabecc 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 _0x7d53=['bluebird','request-promise','path','../../config/environment','exports','define','MemberReport','membername_interface','interface','lodash','util','../../config/logger'];(function(_0x31e08b,_0x4006f5){var _0x4a2a9b=function(_0xb62094){while(--_0xb62094){_0x31e08b['push'](_0x31e08b['shift']());}};_0x4a2a9b(++_0x4006f5);}(_0x7d53,0x1b9));var _0x37d5=function(_0x4655b8,_0x3a83d3){_0x4655b8=_0x4655b8-0x0;var _0x1d2b49=_0x7d53[_0x4655b8];return _0x1d2b49;};'use strict';var _=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var logger=require(_0x37d5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x37d5('0x3'));var rp=require(_0x37d5('0x4'));var fs=require('fs');var path=require(_0x37d5('0x5'));var rimraf=require('rimraf');var config=require(_0x37d5('0x6'));var attributes=require('./memberReport.attributes');module[_0x37d5('0x7')]=function(_0x52d44c,_0x54ed8f){return _0x52d44c[_0x37d5('0x8')](_0x37d5('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x37d5('0xa'),'fields':['membername',_0x37d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51f4=['MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x4c4d9c,_0x5bd0eb){var _0x5063fb=function(_0x46cb30){while(--_0x46cb30){_0x4c4d9c['push'](_0x4c4d9c['shift']());}};_0x5063fb(++_0x5bd0eb);}(_0x51f4,0x169));var _0x451f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x51f4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var logger=require(_0x451f('0x2'))(_0x451f('0x3'));var moment=require(_0x451f('0x4'));var BPromise=require(_0x451f('0x5'));var rp=require(_0x451f('0x6'));var fs=require('fs');var path=require(_0x451f('0x7'));var rimraf=require(_0x451f('0x8'));var config=require(_0x451f('0x9'));var attributes=require(_0x451f('0xa'));module[_0x451f('0xb')]=function(_0x5c0663,_0x3c1c1a){return _0x5c0663[_0x451f('0xc')](_0x451f('0xd'),attributes,{'tableName':_0x451f('0xe'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x451f('0xf'),_0x451f('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d602606..25195c2 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 _0x1298=['raw','options','where','attributes','limit','map','include','model','info','GetMemberReport','catch','CreateMemberReport','create','then','stringify','update','body','UpdateMemberReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','error','MemberReport,\x20%s,\x20%s','message','MemberReport','findAll'];(function(_0x2b0b72,_0x3b088c){var _0x1267b5=function(_0x38d105){while(--_0x38d105){_0x2b0b72['push'](_0x2b0b72['shift']());}};_0x1267b5(++_0x3b088c);}(_0x1298,0x19e));var _0x8129=function(_0x56a37f,_0x5c0340){_0x56a37f=_0x56a37f-0x0;var _0x15b6bb=_0x1298[_0x56a37f];return _0x15b6bb;};'use strict';var _=require('lodash');var util=require(_0x8129('0x0'));var moment=require('moment');var BPromise=require(_0x8129('0x1'));var rs=require(_0x8129('0x2'));var fs=require('fs');var Redis=require(_0x8129('0x3'));var db=require(_0x8129('0x4'))['db'];var utils=require(_0x8129('0x5'));var logger=require(_0x8129('0x6'))(_0x8129('0x7'));var config=require('../../config/environment');var jayson=require(_0x8129('0x8'));var client=jayson[_0x8129('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0a40,_0x1cd6a6,_0x2d07d5){return new BPromise(function(_0x3ff6e0,_0x3d94f8){return client[_0x8129('0xa')](_0x4f0a40,_0x2d07d5)['then'](function(_0x5a0545){logger['info']('MemberReport,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'));logger[_0x8129('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'),JSON['stringify'](_0x5a0545));if(_0x5a0545['error']){if(_0x5a0545[_0x8129('0xd')]['code']===0x1f4){logger['error'](_0x8129('0xe'),_0x1cd6a6,_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);return _0x3d94f8(_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);}logger[_0x8129('0xd')]('MemberReport,\x20%s,\x20%s',_0x1cd6a6,_0x5a0545['error'][_0x8129('0xf')]);return _0x3ff6e0(_0x5a0545['error'][_0x8129('0xf')]);}else{logger['info'](_0x8129('0xe'),_0x1cd6a6,_0x8129('0xb'));_0x3ff6e0(_0x5a0545['result'][_0x8129('0xf')]);}})['catch'](function(_0x3b15ac){logger[_0x8129('0xd')](_0x8129('0xe'),_0x1cd6a6,_0x3b15ac);_0x3d94f8(_0x3b15ac);});});}exports['GetMemberReport']=function(_0x17e742){var _0x1ec668=this;return new Promise(function(_0x21c6c2,_0x1a5940){return db[_0x8129('0x10')][_0x8129('0x11')]({'raw':_0x17e742['options']?_0x17e742['options'][_0x8129('0x12')]===undefined?!![]:![]:!![],'where':_0x17e742['options']?_0x17e742[_0x8129('0x13')][_0x8129('0x14')]||null:null,'attributes':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')][_0x8129('0x15')]||null:null,'limit':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')][_0x8129('0x16')]||null:null,'include':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')]['include']?_[_0x8129('0x17')](_0x17e742[_0x8129('0x13')][_0x8129('0x18')],function(_0x322f63){return{'model':db[_0x322f63['model']],'as':_0x322f63['as'],'attributes':_0x322f63[_0x8129('0x15')],'include':_0x322f63[_0x8129('0x18')]?_['map'](_0x322f63[_0x8129('0x18')],function(_0x58a641){return{'model':db[_0x58a641[_0x8129('0x19')]],'as':_0x58a641['as'],'attributes':_0x58a641[_0x8129('0x15')],'include':_0x58a641[_0x8129('0x18')]?_['map'](_0x58a641[_0x8129('0x18')],function(_0x3a37c0){return{'model':db[_0x3a37c0[_0x8129('0x19')]],'as':_0x3a37c0['as'],'attributes':_0x3a37c0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e4512){logger[_0x8129('0x1a')]('GetMemberReport',_0x17e742);logger[_0x8129('0xc')](_0x8129('0x1b'),_0x17e742,JSON['stringify'](_0x2e4512));_0x21c6c2(_0x2e4512);})[_0x8129('0x1c')](function(_0x1956ae){logger['error'](_0x8129('0x1b'),_0x1956ae[_0x8129('0xf')],_0x17e742);_0x1a5940(_0x1ec668[_0x8129('0xd')](0x1f4,_0x1956ae[_0x8129('0xf')]));});});};exports[_0x8129('0x1d')]=function(_0x1e48b8){var _0x3708e3=this;return new Promise(function(_0x403d04,_0x2a6f89){return db[_0x8129('0x10')][_0x8129('0x1e')](_0x1e48b8['body'],{'raw':_0x1e48b8['options']?_0x1e48b8[_0x8129('0x13')][_0x8129('0x12')]===undefined?!![]:![]:!![]})[_0x8129('0x1f')](function(_0x3d55d3){logger['info'](_0x8129('0x1d'),_0x1e48b8);logger[_0x8129('0xc')](_0x8129('0x1d'),_0x1e48b8,JSON[_0x8129('0x20')](_0x3d55d3));_0x403d04(_0x3d55d3);})[_0x8129('0x1c')](function(_0x4cbd50){logger['error'](_0x8129('0x1d'),_0x4cbd50[_0x8129('0xf')],_0x1e48b8);_0x2a6f89(_0x3708e3[_0x8129('0xd')](0x1f4,_0x4cbd50[_0x8129('0xf')]));});});};exports['UpdateMemberReport']=function(_0x54fd3c){var _0x1d0632=this;return new Promise(function(_0x4fadbc,_0x23d0d8){return db[_0x8129('0x10')][_0x8129('0x21')](_0x54fd3c[_0x8129('0x22')],{'raw':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c[_0x8129('0x13')][_0x8129('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c['options'][_0x8129('0x14')]||null:null,'attributes':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c['options']['attributes']||null:null,'limit':_0x54fd3c['options']?_0x54fd3c[_0x8129('0x13')][_0x8129('0x16')]||null:null})[_0x8129('0x1f')](function(_0x55d7af){logger[_0x8129('0x1a')]('UpdateMemberReport',_0x54fd3c);logger[_0x8129('0xc')](_0x8129('0x23'),_0x54fd3c,JSON[_0x8129('0x20')](_0x55d7af));_0x4fadbc(_0x55d7af);})[_0x8129('0x1c')](function(_0x8ecd42){logger['error'](_0x8129('0x23'),_0x8ecd42[_0x8129('0xf')],_0x54fd3c);_0x23d0d8(_0x1d0632[_0x8129('0xd')](0x1f4,_0x8ecd42[_0x8129('0xf')]));});});}; \ No newline at end of file +var _0x66c7=['then','create','body','CreateMemberReport','UpdateMemberReport','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model'];(function(_0x4331e3,_0x5aca92){var _0x51b2b0=function(_0x129457){while(--_0x129457){_0x4331e3['push'](_0x4331e3['shift']());}};_0x51b2b0(++_0x5aca92);}(_0x66c7,0x15c));var _0x766c=function(_0x40976b,_0x174b7a){_0x40976b=_0x40976b-0x0;var _0x980f5b=_0x66c7[_0x40976b];return _0x980f5b;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rs=require(_0x766c('0x3'));var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require(_0x766c('0x5'))['db'];var utils=require(_0x766c('0x6'));var logger=require(_0x766c('0x7'))(_0x766c('0x8'));var config=require('../../config/environment');var jayson=require(_0x766c('0x9'));var client=jayson[_0x766c('0xa')][_0x766c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0b5f7,_0x46d290,_0x3c4683){return new BPromise(function(_0x22a524,_0x4488b8){return client['request'](_0xb0b5f7,_0x3c4683)['then'](function(_0x141744){logger[_0x766c('0xc')](_0x766c('0xd'),_0x46d290,'request\x20sent');logger[_0x766c('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x46d290,_0x766c('0xf'),JSON[_0x766c('0x10')](_0x141744));if(_0x141744[_0x766c('0x11')]){if(_0x141744[_0x766c('0x11')][_0x766c('0x12')]===0x1f4){logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x4488b8(_0x141744[_0x766c('0x11')][_0x766c('0x13')]);}logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x22a524(_0x141744['error']['message']);}else{logger['info'](_0x766c('0xd'),_0x46d290,_0x766c('0xf'));_0x22a524(_0x141744[_0x766c('0x14')][_0x766c('0x13')]);}})[_0x766c('0x15')](function(_0x357602){logger['error']('MemberReport,\x20%s,\x20%s',_0x46d290,_0x357602);_0x4488b8(_0x357602);});});}exports[_0x766c('0x16')]=function(_0x23c566){var _0x105f60=this;return new Promise(function(_0x47c887,_0x2cd2e7){return db[_0x766c('0x17')][_0x766c('0x18')]({'raw':_0x23c566['options']?_0x23c566['options']['raw']===undefined?!![]:![]:!![],'where':_0x23c566[_0x766c('0x19')]?_0x23c566['options'][_0x766c('0x1a')]||null:null,'attributes':_0x23c566[_0x766c('0x19')]?_0x23c566['options']['attributes']||null:null,'limit':_0x23c566[_0x766c('0x19')]?_0x23c566[_0x766c('0x19')][_0x766c('0x1b')]||null:null,'include':_0x23c566['options']?_0x23c566[_0x766c('0x19')][_0x766c('0x1c')]?_['map'](_0x23c566['options']['include'],function(_0x43d91f){return{'model':db[_0x43d91f['model']],'as':_0x43d91f['as'],'attributes':_0x43d91f[_0x766c('0x1d')],'include':_0x43d91f[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x43d91f['include'],function(_0x44659e){return{'model':db[_0x44659e[_0x766c('0x1f')]],'as':_0x44659e['as'],'attributes':_0x44659e[_0x766c('0x1d')],'include':_0x44659e[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x44659e[_0x766c('0x1c')],function(_0x5ad1d6){return{'model':db[_0x5ad1d6[_0x766c('0x1f')]],'as':_0x5ad1d6['as'],'attributes':_0x5ad1d6[_0x766c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x766c('0x20')](function(_0x3a6757){logger[_0x766c('0xc')]('GetMemberReport',_0x23c566);logger['debug'](_0x766c('0x16'),_0x23c566,JSON[_0x766c('0x10')](_0x3a6757));_0x47c887(_0x3a6757);})[_0x766c('0x15')](function(_0x549dde){logger[_0x766c('0x11')](_0x766c('0x16'),_0x549dde['message'],_0x23c566);_0x2cd2e7(_0x105f60[_0x766c('0x11')](0x1f4,_0x549dde['message']));});});};exports['CreateMemberReport']=function(_0x3a4561){var _0x10421d=this;return new Promise(function(_0x1eac49,_0x5b94cf){return db[_0x766c('0x17')][_0x766c('0x21')](_0x3a4561[_0x766c('0x22')],{'raw':_0x3a4561[_0x766c('0x19')]?_0x3a4561[_0x766c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4659cc){logger[_0x766c('0xc')](_0x766c('0x23'),_0x3a4561);logger[_0x766c('0xe')](_0x766c('0x23'),_0x3a4561,JSON['stringify'](_0x4659cc));_0x1eac49(_0x4659cc);})[_0x766c('0x15')](function(_0x40c43a){logger[_0x766c('0x11')]('CreateMemberReport',_0x40c43a[_0x766c('0x13')],_0x3a4561);_0x5b94cf(_0x10421d['error'](0x1f4,_0x40c43a['message']));});});};exports[_0x766c('0x24')]=function(_0x4e5eec){var _0x26bd0b=this;return new Promise(function(_0x182a81,_0x2f96e3){return db[_0x766c('0x17')]['update'](_0x4e5eec['body'],{'raw':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1a')]||null:null,'attributes':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1d')]||null:null,'limit':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1b')]||null:null})[_0x766c('0x20')](function(_0x4b2b06){logger[_0x766c('0xc')]('UpdateMemberReport',_0x4e5eec);logger[_0x766c('0xe')]('UpdateMemberReport',_0x4e5eec,JSON[_0x766c('0x10')](_0x4b2b06));_0x182a81(_0x4b2b06);})[_0x766c('0x15')](function(_0x4832da){logger[_0x766c('0x11')](_0x766c('0x24'),_0x4832da['message'],_0x4e5eec);_0x2f96e3(_0x26bd0b[_0x766c('0x11')](0x1f4,_0x4832da['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8f46b70..f506498 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 _0x8bbf=['./migration.controller','index','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b3c9d,_0x1c8c0c){var _0x4b8037=function(_0x225327){while(--_0x225327){_0x2b3c9d['push'](_0x2b3c9d['shift']());}};_0x4b8037(++_0x1c8c0c);}(_0x8bbf,0x184));var _0xf8bb=function(_0x45f4a3,_0x509283){_0x45f4a3=_0x45f4a3-0x0;var _0x2d2bc1=_0x8bbf[_0x45f4a3];return _0x2d2bc1;};'use strict';var multer=require(_0xf8bb('0x0'));var util=require(_0xf8bb('0x1'));var path=require(_0xf8bb('0x2'));var timeout=require(_0xf8bb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf8bb('0x4'));var auth=require(_0xf8bb('0x5'));var interaction=require(_0xf8bb('0x6'));var config=require(_0xf8bb('0x7'));var controller=require(_0xf8bb('0x8'));router['get']('/',controller[_0xf8bb('0x9')]);module[_0xf8bb('0xa')]=router; \ No newline at end of file +var _0xef4b=['exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','index'];(function(_0x3b8505,_0x1bc079){var _0x13da74=function(_0xe35d66){while(--_0xe35d66){_0x3b8505['push'](_0x3b8505['shift']());}};_0x13da74(++_0x1bc079);}(_0xef4b,0x86));var _0xbef4=function(_0x3e5ba5,_0x28e9cd){_0x3e5ba5=_0x3e5ba5-0x0;var _0x4ab4d8=_0xef4b[_0x3e5ba5];return _0x4ab4d8;};'use strict';var multer=require('multer');var util=require(_0xbef4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbef4('0x1'));var auth=require(_0xbef4('0x2'));var interaction=require(_0xbef4('0x3'));var config=require('../../config/environment');var controller=require(_0xbef4('0x4'));router['get']('/',controller[_0xbef4('0x5')]);module[_0xbef4('0x6')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d5f720a..d8cba74 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 _0x8e09=['version','sequelize','exports','STRING'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x8e09,0x145));var _0x98e0=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x8e09[_0x15b399];return _0x199f2d;};'use strict';var Sequelize=require(_0x98e0('0x0'));module[_0x98e0('0x1')]={'version':{'type':Sequelize[_0x98e0('0x2')],'unique':_0x98e0('0x3')}}; \ No newline at end of file +var _0x9562=['version','sequelize','exports'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x9562,0xf4));var _0x2956=function(_0x57b20e,_0x4bab8c){_0x57b20e=_0x57b20e-0x0;var _0x3bef56=_0x9562[_0x57b20e];return _0x3bef56;};'use strict';var Sequelize=require(_0x2956('0x0'));module[_0x2956('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x2956('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 902b508..ded6b61 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 _0x2944=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','eml-format','zip-dir'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x2944,0x88));var _0x4294=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2944[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0x4294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4294('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4294('0x2'));var BPromise=require(_0x4294('0x3'));var Mustache=require(_0x4294('0x4'));var util=require(_0x4294('0x5'));var path=require(_0x4294('0x6'));var sox=require(_0x4294('0x7'));var csv=require('to-csv');var ejs=require(_0x4294('0x8'));var fs=require('fs');var fs_extra=require(_0x4294('0x9'));var _=require('lodash');var squel=require(_0x4294('0xa'));var crypto=require(_0x4294('0xb'));var jsforce=require(_0x4294('0xc'));var deskjs=require(_0x4294('0xd'));var toCsv=require(_0x4294('0xe'));var querystring=require(_0x4294('0xf'));var Papa=require(_0x4294('0x10'));var Redis=require(_0x4294('0x11'));var authService=require(_0x4294('0x12'));var qs=require(_0x4294('0x13'));var as=require(_0x4294('0x14'));var hardwareService=require(_0x4294('0x15'));var logger=require('../../config/logger')(_0x4294('0x16'));var utils=require(_0x4294('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4294('0x18'));var db=require(_0x4294('0x19'))['db'];function respondWithStatusCode(_0x1b14b8,_0x32318a){_0x32318a=_0x32318a||0xcc;return function(_0x1ce829){if(_0x1ce829){return _0x1b14b8[_0x4294('0x1a')](_0x32318a);}return _0x1b14b8[_0x4294('0x1b')](_0x32318a)[_0x4294('0x1c')]();};}function respondWithResult(_0xf8207c,_0x30b1db){_0x30b1db=_0x30b1db||0xc8;return function(_0x11b767){if(_0x11b767){return _0xf8207c[_0x4294('0x1b')](_0x30b1db)[_0x4294('0x1d')](_0x11b767);}};}function respondWithFilteredResult(_0x133800,_0x1957ea){return function(_0x4f6d49){if(_0x4f6d49){var _0x39f4e9=typeof _0x1957ea['offset']==='undefined'&&typeof _0x1957ea[_0x4294('0x1e')]===_0x4294('0x1f');var _0xe19804=_0x4f6d49[_0x4294('0x20')];var _0x362d5e=_0x39f4e9?0x0:_0x1957ea[_0x4294('0x21')];var _0xa814ad=_0x39f4e9?_0x4f6d49[_0x4294('0x20')]:_0x1957ea[_0x4294('0x21')]+_0x1957ea[_0x4294('0x1e')];var _0x82a63d;if(_0xa814ad>=_0xe19804){_0xa814ad=_0xe19804;_0x82a63d=0xc8;}else{_0x82a63d=0xce;}_0x133800['status'](_0x82a63d);return _0x133800[_0x4294('0x22')](_0x4294('0x23'),_0x362d5e+'-'+_0xa814ad+'/'+_0xe19804)['json'](_0x4f6d49);}return null;};}function patchUpdates(_0x40df99){return function(_0x48a49c){try{jsonpatch[_0x4294('0x24')](_0x48a49c,_0x40df99,!![]);}catch(_0x3e9d43){return BPromise['reject'](_0x3e9d43);}return _0x48a49c[_0x4294('0x25')]();};}function saveUpdates(_0x45b4d2,_0x3e28ce){return function(_0x527e0d){if(_0x527e0d){return _0x527e0d[_0x4294('0x26')](_0x45b4d2)[_0x4294('0x27')](function(_0x24ce29){return _0x24ce29;});}return null;};}function removeEntity(_0x595457,_0x3968eb){return function(_0x5a862e){if(_0x5a862e){return _0x5a862e[_0x4294('0x28')]()[_0x4294('0x27')](function(){_0x595457[_0x4294('0x1b')](0xcc)[_0x4294('0x1c')]();});}};}function handleEntityNotFound(_0x35be8d,_0x3fe561){return function(_0xc1e24f){if(!_0xc1e24f){_0x35be8d[_0x4294('0x1a')](0x194);}return _0xc1e24f;};}function handleError(_0x160980,_0x4f9c0e){_0x4f9c0e=_0x4f9c0e||0x1f4;return function(_0x1dc23c){logger[_0x4294('0x29')](_0x1dc23c['stack']);if(_0x1dc23c[_0x4294('0x2a')]){delete _0x1dc23c[_0x4294('0x2a')];}_0x160980[_0x4294('0x1b')](_0x4f9c0e)[_0x4294('0x2b')](_0x1dc23c);};}exports[_0x4294('0x2c')]=function(_0x39ee01,_0x11fc44){var _0x4ee3c3={},_0x35290e={},_0x5ef520={'count':0x0,'rows':[]};var _0x223238=_[_0x4294('0x2d')](db['Migration'][_0x4294('0x2e')],function(_0x3a9afb){return{'name':_0x3a9afb[_0x4294('0x2f')],'type':_0x3a9afb[_0x4294('0x30')][_0x4294('0x31')]};});_0x35290e[_0x4294('0x32')]=_['map'](_0x223238,_0x4294('0x2a'));_0x35290e[_0x4294('0x33')]=_[_0x4294('0x34')](_0x39ee01[_0x4294('0x33')]);_0x35290e[_0x4294('0x35')]=_[_0x4294('0x36')](_0x35290e[_0x4294('0x32')],_0x35290e['query']);_0x4ee3c3['attributes']=_[_0x4294('0x36')](_0x35290e[_0x4294('0x32')],qs[_0x4294('0x37')](_0x39ee01['query'][_0x4294('0x37')]));_0x4ee3c3['attributes']=_0x4ee3c3[_0x4294('0x38')][_0x4294('0x39')]?_0x4ee3c3[_0x4294('0x38')]:_0x35290e['model'];if(!_0x39ee01['query'][_0x4294('0x3a')](_0x4294('0x3b'))){_0x4ee3c3[_0x4294('0x1e')]=qs[_0x4294('0x1e')](_0x39ee01[_0x4294('0x33')][_0x4294('0x1e')]);_0x4ee3c3[_0x4294('0x21')]=qs[_0x4294('0x21')](_0x39ee01[_0x4294('0x33')][_0x4294('0x21')]);}_0x4ee3c3['order']=qs['sort'](_0x39ee01[_0x4294('0x33')]['sort']);_0x4ee3c3['where']=qs[_0x4294('0x35')](_[_0x4294('0x3c')](_0x39ee01['query'],_0x35290e[_0x4294('0x35')]),_0x223238);if(_0x39ee01[_0x4294('0x33')][_0x4294('0x3d')]){_0x4ee3c3[_0x4294('0x3e')]=_['merge'](_0x4ee3c3['where'],{'$or':_[_0x4294('0x2d')](_0x223238,function(_0x421b1b){if(_0x421b1b[_0x4294('0x30')]!==_0x4294('0x3f')){var _0x212b76={};_0x212b76[_0x421b1b['name']]={'$like':'%'+_0x39ee01['query'][_0x4294('0x3d')]+'%'};return _0x212b76;}})});}_0x4ee3c3=_[_0x4294('0x40')]({},_0x4ee3c3,_0x39ee01[_0x4294('0x41')]);var _0x161c0f={'where':_0x4ee3c3['where']};return db['Migration']['count'](_0x161c0f)[_0x4294('0x27')](function(_0x33493f){_0x5ef520['count']=_0x33493f;if(_0x39ee01['query']['includeAll']){_0x4ee3c3['include']=[{'all':!![]}];}return db['Migration'][_0x4294('0x42')](_0x4ee3c3);})[_0x4294('0x27')](function(_0x20539b){_0x5ef520[_0x4294('0x43')]=_0x20539b;return _0x5ef520;})[_0x4294('0x27')](respondWithFilteredResult(_0x11fc44,_0x4ee3c3))[_0x4294('0x44')](handleError(_0x11fc44,null));}; \ No newline at end of file +var _0xf8bd=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','eml-format'];(function(_0xb8a961,_0x1468b6){var _0xc085f5=function(_0xfd6f27){while(--_0xfd6f27){_0xb8a961['push'](_0xb8a961['shift']());}};_0xc085f5(++_0x1468b6);}(_0xf8bd,0x197));var _0xdf8b=function(_0x46dedf,_0xa59cac){_0x46dedf=_0x46dedf-0x0;var _0x3851dc=_0xf8bd[_0x46dedf];return _0x3851dc;};'use strict';var emlformat=require(_0xdf8b('0x0'));var rimraf=require(_0xdf8b('0x1'));var zipdir=require(_0xdf8b('0x2'));var jsonpatch=require(_0xdf8b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf8b('0x4'));var Mustache=require(_0xdf8b('0x5'));var util=require('util');var path=require(_0xdf8b('0x6'));var sox=require(_0xdf8b('0x7'));var csv=require('to-csv');var ejs=require(_0xdf8b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf8b('0x9'));var crypto=require(_0xdf8b('0xa'));var jsforce=require(_0xdf8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdf8b('0xc'));var querystring=require(_0xdf8b('0xd'));var Papa=require(_0xdf8b('0xe'));var Redis=require(_0xdf8b('0xf'));var authService=require(_0xdf8b('0x10'));var qs=require(_0xdf8b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf8b('0x12'));var logger=require(_0xdf8b('0x13'))(_0xdf8b('0x14'));var utils=require(_0xdf8b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdf8b('0x16'));var db=require(_0xdf8b('0x17'))['db'];function respondWithStatusCode(_0x6d72be,_0x4f28ac){_0x4f28ac=_0x4f28ac||0xcc;return function(_0x582820){if(_0x582820){return _0x6d72be[_0xdf8b('0x18')](_0x4f28ac);}return _0x6d72be[_0xdf8b('0x19')](_0x4f28ac)[_0xdf8b('0x1a')]();};}function respondWithResult(_0x47d1d5,_0xa2f81d){_0xa2f81d=_0xa2f81d||0xc8;return function(_0xbb7b8f){if(_0xbb7b8f){return _0x47d1d5[_0xdf8b('0x19')](_0xa2f81d)[_0xdf8b('0x1b')](_0xbb7b8f);}};}function respondWithFilteredResult(_0x2b31a6,_0x51752a){return function(_0x380d3e){if(_0x380d3e){var _0x21fb93=typeof _0x51752a[_0xdf8b('0x1c')]===_0xdf8b('0x1d')&&typeof _0x51752a[_0xdf8b('0x1e')]===_0xdf8b('0x1d');var _0x30f1d8=_0x380d3e[_0xdf8b('0x1f')];var _0x1048bc=_0x21fb93?0x0:_0x51752a[_0xdf8b('0x1c')];var _0x45a230=_0x21fb93?_0x380d3e[_0xdf8b('0x1f')]:_0x51752a[_0xdf8b('0x1c')]+_0x51752a[_0xdf8b('0x1e')];var _0x52bd49;if(_0x45a230>=_0x30f1d8){_0x45a230=_0x30f1d8;_0x52bd49=0xc8;}else{_0x52bd49=0xce;}_0x2b31a6[_0xdf8b('0x19')](_0x52bd49);return _0x2b31a6[_0xdf8b('0x20')](_0xdf8b('0x21'),_0x1048bc+'-'+_0x45a230+'/'+_0x30f1d8)[_0xdf8b('0x1b')](_0x380d3e);}return null;};}function patchUpdates(_0x3ccb23){return function(_0x45a9df){try{jsonpatch[_0xdf8b('0x22')](_0x45a9df,_0x3ccb23,!![]);}catch(_0x79c2db){return BPromise[_0xdf8b('0x23')](_0x79c2db);}return _0x45a9df[_0xdf8b('0x24')]();};}function saveUpdates(_0x3a131e,_0x125b1e){return function(_0x1221d1){if(_0x1221d1){return _0x1221d1[_0xdf8b('0x25')](_0x3a131e)['then'](function(_0x488736){return _0x488736;});}return null;};}function removeEntity(_0x2cdb9c,_0x50eda8){return function(_0x8024da){if(_0x8024da){return _0x8024da['destroy']()[_0xdf8b('0x26')](function(){_0x2cdb9c['status'](0xcc)[_0xdf8b('0x1a')]();});}};}function handleEntityNotFound(_0xec89c0,_0xd338ae){return function(_0x4163af){if(!_0x4163af){_0xec89c0[_0xdf8b('0x18')](0x194);}return _0x4163af;};}function handleError(_0x35740d,_0x246059){_0x246059=_0x246059||0x1f4;return function(_0x3dca73){logger['error'](_0x3dca73[_0xdf8b('0x27')]);if(_0x3dca73[_0xdf8b('0x28')]){delete _0x3dca73['name'];}_0x35740d['status'](_0x246059)['send'](_0x3dca73);};}exports[_0xdf8b('0x29')]=function(_0x43919d,_0x4ee81d){var _0x1270a0={},_0x3f6a40={},_0xcb645d={'count':0x0,'rows':[]};var _0x31f919=_['map'](db[_0xdf8b('0x2a')][_0xdf8b('0x2b')],function(_0x60a92a){return{'name':_0x60a92a[_0xdf8b('0x2c')],'type':_0x60a92a[_0xdf8b('0x2d')][_0xdf8b('0x2e')]};});_0x3f6a40[_0xdf8b('0x2f')]=_[_0xdf8b('0x30')](_0x31f919,'name');_0x3f6a40[_0xdf8b('0x31')]=_['keys'](_0x43919d['query']);_0x3f6a40[_0xdf8b('0x32')]=_['intersection'](_0x3f6a40[_0xdf8b('0x2f')],_0x3f6a40[_0xdf8b('0x31')]);_0x1270a0[_0xdf8b('0x33')]=_[_0xdf8b('0x34')](_0x3f6a40['model'],qs[_0xdf8b('0x35')](_0x43919d['query'][_0xdf8b('0x35')]));_0x1270a0['attributes']=_0x1270a0[_0xdf8b('0x33')][_0xdf8b('0x36')]?_0x1270a0[_0xdf8b('0x33')]:_0x3f6a40[_0xdf8b('0x2f')];if(!_0x43919d[_0xdf8b('0x31')][_0xdf8b('0x37')](_0xdf8b('0x38'))){_0x1270a0['limit']=qs[_0xdf8b('0x1e')](_0x43919d[_0xdf8b('0x31')][_0xdf8b('0x1e')]);_0x1270a0[_0xdf8b('0x1c')]=qs['offset'](_0x43919d[_0xdf8b('0x31')][_0xdf8b('0x1c')]);}_0x1270a0['order']=qs['sort'](_0x43919d['query'][_0xdf8b('0x39')]);_0x1270a0[_0xdf8b('0x3a')]=qs[_0xdf8b('0x32')](_[_0xdf8b('0x3b')](_0x43919d[_0xdf8b('0x31')],_0x3f6a40[_0xdf8b('0x32')]),_0x31f919);if(_0x43919d['query']['filter']){_0x1270a0[_0xdf8b('0x3a')]=_[_0xdf8b('0x3c')](_0x1270a0[_0xdf8b('0x3a')],{'$or':_[_0xdf8b('0x30')](_0x31f919,function(_0x534f54){if(_0x534f54['type']!==_0xdf8b('0x3d')){var _0x2e2e48={};_0x2e2e48[_0x534f54[_0xdf8b('0x28')]]={'$like':'%'+_0x43919d[_0xdf8b('0x31')][_0xdf8b('0x3e')]+'%'};return _0x2e2e48;}})});}_0x1270a0=_['merge']({},_0x1270a0,_0x43919d[_0xdf8b('0x3f')]);var _0x4621ee={'where':_0x1270a0[_0xdf8b('0x3a')]};return db[_0xdf8b('0x2a')][_0xdf8b('0x1f')](_0x4621ee)['then'](function(_0x5b2cd){_0xcb645d['count']=_0x5b2cd;if(_0x43919d['query']['includeAll']){_0x1270a0[_0xdf8b('0x40')]=[{'all':!![]}];}return db['Migration'][_0xdf8b('0x41')](_0x1270a0);})[_0xdf8b('0x26')](function(_0x567edd){_0xcb645d[_0xdf8b('0x42')]=_0x567edd;return _0xcb645d;})['then'](respondWithFilteredResult(_0x4ee81d,_0x1270a0))[_0xdf8b('0x43')](handleError(_0x4ee81d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 529cea9..a13a097 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 _0x0d3d=['Migration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1eb6c6,_0x1b562b){var _0x2d863d=function(_0x45024b){while(--_0x45024b){_0x1eb6c6['push'](_0x1eb6c6['shift']());}};_0x2d863d(++_0x1b562b);}(_0x0d3d,0x1b9));var _0xd0d3=function(_0x4e3491,_0x2b5c93){_0x4e3491=_0x4e3491-0x0;var _0x1ab44e=_0x0d3d[_0x4e3491];return _0x1ab44e;};'use strict';var _=require(_0xd0d3('0x0'));var util=require('util');var logger=require(_0xd0d3('0x1'))(_0xd0d3('0x2'));var moment=require(_0xd0d3('0x3'));var BPromise=require(_0xd0d3('0x4'));var rp=require(_0xd0d3('0x5'));var fs=require('fs');var path=require(_0xd0d3('0x6'));var rimraf=require(_0xd0d3('0x7'));var config=require(_0xd0d3('0x8'));var attributes=require('./migration.attributes');module['exports']=function(_0x5d2950,_0x5df4da){return _0x5d2950[_0xd0d3('0x9')](_0xd0d3('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2ef=['../../config/environment','./migration.attributes','exports','migrations','lodash','util','api','bluebird','request-promise','path'];(function(_0x232646,_0x1b7e9c){var _0x1af36c=function(_0x282f2d){while(--_0x282f2d){_0x232646['push'](_0x232646['shift']());}};_0x1af36c(++_0x1b7e9c);}(_0xa2ef,0x9a));var _0xfa2e=function(_0x366493,_0xdb3a3f){_0x366493=_0x366493-0x0;var _0x5082ff=_0xa2ef[_0x366493];return _0x5082ff;};'use strict';var _=require(_0xfa2e('0x0'));var util=require(_0xfa2e('0x1'));var logger=require('../../config/logger')(_0xfa2e('0x2'));var moment=require('moment');var BPromise=require(_0xfa2e('0x3'));var rp=require(_0xfa2e('0x4'));var fs=require('fs');var path=require(_0xfa2e('0x5'));var rimraf=require('rimraf');var config=require(_0xfa2e('0x6'));var attributes=require(_0xfa2e('0x7'));module[_0xfa2e('0x8')]=function(_0x2f130d,_0x2ea23a){return _0x2f130d['define']('Migration',attributes,{'tableName':_0xfa2e('0x9'),'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 0e969d0..47d0f75 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 _0xe13e=['../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2985a2,_0x1e28fe){var _0x3b0032=function(_0x5cbdda){while(--_0x5cbdda){_0x2985a2['push'](_0x2985a2['shift']());}};_0x3b0032(++_0x1e28fe);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee13('0x0'));var BPromise=require(_0xee13('0x1'));var rs=require(_0xee13('0x2'));var fs=require('fs');var Redis=require(_0xee13('0x3'));var db=require(_0xee13('0x4'))['db'];var utils=require(_0xee13('0x5'));var logger=require(_0xee13('0x6'))(_0xee13('0x7'));var config=require(_0xee13('0x8'));var jayson=require(_0xee13('0x9'));var client=jayson[_0xee13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f606d,_0x3ae6e2,_0xfdb836){return new BPromise(function(_0x64ee02,_0x4810bd){return client[_0xee13('0xb')](_0x8f606d,_0xfdb836)[_0xee13('0xc')](function(_0x1cc55b){logger[_0xee13('0xd')](_0xee13('0xe'),_0x3ae6e2,'request\x20sent');logger[_0xee13('0xf')](_0xee13('0x10'),_0x3ae6e2,'request\x20sent',JSON[_0xee13('0x11')](_0x1cc55b));if(_0x1cc55b['error']){if(_0x1cc55b['error']['code']===0x1f4){logger[_0xee13('0x12')]('Migration,\x20%s,\x20%s',_0x3ae6e2,_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);return _0x4810bd(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0x1cc55b[_0xee13('0x12')]['message']);return _0x64ee02(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}else{logger[_0xee13('0xd')]('Migration,\x20%s,\x20%s',_0x3ae6e2,_0xee13('0x14'));_0x64ee02(_0x1cc55b[_0xee13('0x15')]['message']);}})[_0xee13('0x16')](function(_0xcd1482){logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0xcd1482);_0x4810bd(_0xcd1482);});});} \ No newline at end of file +var _0x4e83=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1b82fa,_0x50f57e){var _0x362232=function(_0x20a6cb){while(--_0x20a6cb){_0x1b82fa['push'](_0x1b82fa['shift']());}};_0x362232(++_0x50f57e);}(_0x4e83,0x88));var _0x34e8=function(_0x3d13d7,_0x295266){_0x3d13d7=_0x3d13d7-0x0;var _0x34fdde=_0x4e83[_0x3d13d7];return _0x34fdde;};'use strict';var _=require('lodash');var util=require(_0x34e8('0x0'));var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34e8('0x4'))['db'];var utils=require(_0x34e8('0x5'));var logger=require(_0x34e8('0x6'))(_0x34e8('0x7'));var config=require(_0x34e8('0x8'));var jayson=require(_0x34e8('0x9'));var client=jayson[_0x34e8('0xa')][_0x34e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x320b00,_0x146a1f,_0x188f11){return new BPromise(function(_0x18e178,_0x3ace57){return client['request'](_0x320b00,_0x188f11)[_0x34e8('0xc')](function(_0x200425){logger[_0x34e8('0xd')]('Migration,\x20%s,\x20%s',_0x146a1f,_0x34e8('0xe'));logger[_0x34e8('0xf')](_0x34e8('0x10'),_0x146a1f,_0x34e8('0xe'),JSON[_0x34e8('0x11')](_0x200425));if(_0x200425['error']){if(_0x200425[_0x34e8('0x12')]['code']===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x13'),_0x146a1f,_0x200425[_0x34e8('0x12')][_0x34e8('0x14')]);return _0x3ace57(_0x200425[_0x34e8('0x12')][_0x34e8('0x14')]);}logger['error'](_0x34e8('0x13'),_0x146a1f,_0x200425['error'][_0x34e8('0x14')]);return _0x18e178(_0x200425['error'][_0x34e8('0x14')]);}else{logger[_0x34e8('0xd')](_0x34e8('0x13'),_0x146a1f,'request\x20sent');_0x18e178(_0x200425[_0x34e8('0x15')]['message']);}})[_0x34e8('0x16')](function(_0xed8219){logger[_0x34e8('0x12')]('Migration,\x20%s,\x20%s',_0x146a1f,_0xed8219);_0x3ace57(_0xed8219);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8e422cc..2dc0e3f 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 _0xcefd=['/:id','show','post','create','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0xcefd,0x126));var _0xdcef=function(_0x7bfe1b,_0x3eb3c3){_0x7bfe1b=_0x7bfe1b-0x0;var _0x24e555=_0xcefd[_0x7bfe1b];return _0x24e555;};'use strict';var multer=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var path=require(_0xdcef('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcef('0x3'));var router=express[_0xdcef('0x4')]();var fs_extra=require(_0xdcef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var controller=require(_0xdcef('0x8'));router['get']('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0xa')]);router[_0xdcef('0xb')](_0xdcef('0xc'),auth['isAuthenticated'](),controller[_0xdcef('0xd')]);router[_0xdcef('0xe')]('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0xf')]);router['put'](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller[_0xdcef('0x10')]);router[_0xdcef('0x11')](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8561=['destroy','exports','util','path','express','fs-extra','../../components/interaction/service','./network.controller','get','show','/:id','isAuthenticated'];(function(_0x452cc4,_0x31c15a){var _0x3db917=function(_0x3e1b57){while(--_0x3e1b57){_0x452cc4['push'](_0x452cc4['shift']());}};_0x3db917(++_0x31c15a);}(_0x8561,0x1b2));var _0x1856=function(_0x4b7a20,_0x470a22){_0x4b7a20=_0x4b7a20-0x0;var _0x302aa4=_0x8561[_0x4b7a20];return _0x302aa4;};'use strict';var multer=require('multer');var util=require(_0x1856('0x0'));var path=require(_0x1856('0x1'));var timeout=require('connect-timeout');var express=require(_0x1856('0x2'));var router=express['Router']();var fs_extra=require(_0x1856('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1856('0x4'));var config=require('../../config/environment');var controller=require(_0x1856('0x5'));router[_0x1856('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1856('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x1856('0x7')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1856('0x8'),auth[_0x1856('0x9')](),controller['update']);router['delete'](_0x1856('0x8'),auth['isAuthenticated'](),controller[_0x1856('0xa')]);module[_0x1856('0xb')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7e4b668..198174d 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 _0x683f=['sequelize','exports','localnet','externip','stun','turn','STRING'];(function(_0x51cc5c,_0x5282e5){var _0x537e57=function(_0x4ad332){while(--_0x4ad332){_0x51cc5c['push'](_0x51cc5c['shift']());}};_0x537e57(++_0x5282e5);}(_0x683f,0x188));var _0xf683=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x683f[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0xf683('0x0'));module[_0xf683('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf683('0x2'),_0xf683('0x3'),_0xf683('0x4'),_0xf683('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf683('0x6')]},'password':{'type':Sequelize[_0xf683('0x6')]}}; \ No newline at end of file +var _0x35d9=['turn','STRING','sequelize','ENUM','externip','stun'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x35d9,0x116));var _0x935d=function(_0x319e61,_0x5cac0e){_0x319e61=_0x319e61-0x0;var _0x52d84b=_0x35d9[_0x319e61];return _0x52d84b;};'use strict';var Sequelize=require(_0x935d('0x0'));module['exports']={'type':{'type':Sequelize[_0x935d('0x1')]('localnet',_0x935d('0x2'),_0x935d('0x3'),_0x935d('0x4'))},'value':{'type':Sequelize[_0x935d('0x5')]},'username':{'type':Sequelize[_0x935d('0x5')]},'password':{'type':Sequelize[_0x935d('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5f3b88a..f71d39c 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 _0x4c1a=['client','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','update','name','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','fields','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','res_stun_monitor.so','toUpperCase','readFileSync','render','Reload','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','params','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','destroy','server/files/templates/network.ejs','chan_sip.so','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x278cb8,_0xe0d7f1){var _0x3bfbea=function(_0x317b46){while(--_0x317b46){_0x278cb8['push'](_0x278cb8['shift']());}};_0x3bfbea(++_0xe0d7f1);}(_0x4c1a,0x19d));var _0xa4c1=function(_0x5818b4,_0xf00eaa){_0x5818b4=_0x5818b4-0x0;var _0x1f5296=_0x4c1a[_0x5818b4];return _0x1f5296;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0xa4c1('0x0'));var fs=require('fs');var _=require(_0xa4c1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa4c1('0x2'))(_0xa4c1('0x3'));var config=require(_0xa4c1('0x4'));var db=require(_0xa4c1('0x5'))['db'];var jayson=require(_0xa4c1('0x6'));var client=jayson[_0xa4c1('0x7')][_0xa4c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea02a6,_0x2cf1aa,_0x4fb3f9,_0x223c2d){return new Promise(function(_0x454d58,_0x182b1c){var _0x3777de=_0x223c2d||client;return _0x3777de[_0xa4c1('0x9')](_0xea02a6,_0x4fb3f9)[_0xa4c1('0xa')](function(_0x326b7f){logger['info'](_0xa4c1('0xb'),_0x2cf1aa,'request\x20sent');logger[_0xa4c1('0xc')](_0xa4c1('0xd'),_0x2cf1aa,'request\x20sent',JSON[_0xa4c1('0xe')](_0x326b7f));if(_0x326b7f[_0xa4c1('0xf')]){if(_0x326b7f['error'][_0xa4c1('0x10')]===0x1f4){logger[_0xa4c1('0xf')](_0xa4c1('0xb'),_0x2cf1aa,_0x326b7f[_0xa4c1('0xf')]['message']);return _0x182b1c(_0x326b7f['error'][_0xa4c1('0x11')]);}logger[_0xa4c1('0xf')](_0xa4c1('0xb'),_0x2cf1aa,_0x326b7f['error']['message']);return _0x454d58(_0x326b7f[_0xa4c1('0xf')][_0xa4c1('0x11')]);}else{logger[_0xa4c1('0x12')](_0xa4c1('0xb'),_0x2cf1aa,_0xa4c1('0x13'));_0x454d58(_0x326b7f[_0xa4c1('0x14')][_0xa4c1('0x11')]);}})[_0xa4c1('0x15')](function(_0x96d7f9){logger[_0xa4c1('0xf')](_0xa4c1('0xb'),_0x2cf1aa,_0x96d7f9);_0x182b1c(_0x96d7f9);});});}function respondWithResult(_0x4a1658,_0x2a9bce){_0x2a9bce=_0x2a9bce||0xc8;return function(_0x36cb71){if(_0x36cb71){return _0x4a1658[_0xa4c1('0x16')](_0x2a9bce)[_0xa4c1('0x17')](_0x36cb71);}};}function respondWithFilteredResult(_0x203e30,_0x3ce5fe){return function(_0x2c756e){if(_0x2c756e){var _0x127623=typeof _0x3ce5fe[_0xa4c1('0x18')]===_0xa4c1('0x19')&&typeof _0x3ce5fe[_0xa4c1('0x1a')]==='undefined';var _0x2e6bb4=_0x2c756e[_0xa4c1('0x1b')];var _0x6a5582=_0x127623?0x0:_0x3ce5fe['offset'];var _0xfc7eca=_0x127623?_0x2c756e['count']:_0x3ce5fe[_0xa4c1('0x18')]+_0x3ce5fe[_0xa4c1('0x1a')];var _0x372eed;if(_0xfc7eca>=_0x2e6bb4){_0xfc7eca=_0x2e6bb4;_0x372eed=0xc8;}else{_0x372eed=0xce;}_0x203e30[_0xa4c1('0x16')](_0x372eed);return _0x203e30[_0xa4c1('0x1c')]('Content-Range',_0x6a5582+'-'+_0xfc7eca+'/'+_0x2e6bb4)[_0xa4c1('0x17')](_0x2c756e);}return null;};}function saveUpdates(_0x52b0ef){return function(_0x591713){if(_0x591713){return _0x591713[_0xa4c1('0x1d')](_0x52b0ef)[_0xa4c1('0xa')](function(_0x2ec7b7){return _0x2ec7b7;});}return null;};}function removeEntity(_0xe6aa25){return function(_0x400327){if(_0x400327){return _0x400327['destroy']()[_0xa4c1('0xa')](function(){_0xe6aa25[_0xa4c1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7ae5){return function(_0x1c2ac6){if(!_0x1c2ac6){_0x5b7ae5['sendStatus'](0x194);}return _0x1c2ac6;};}function handleError(_0x38b374,_0x6cf98a){_0x6cf98a=_0x6cf98a||0x1f4;return function(_0x451274){logger[_0xa4c1('0xf')](_0x451274['stack']);if(_0x451274[_0xa4c1('0x1e')]){delete _0x451274[_0xa4c1('0x1e')];}_0x38b374[_0xa4c1('0x16')](_0x6cf98a)['send'](_0x451274);};}exports['index']=function(_0x3a88c6,_0x3d5f5f){var _0x5ea6c7={},_0x5bec1b={},_0x22a38b={'count':0x0,'rows':[]};var _0x381c3a=_[_0xa4c1('0x1f')](db[_0xa4c1('0x20')][_0xa4c1('0x21')],function(_0x26a252){return{'name':_0x26a252[_0xa4c1('0x22')],'type':_0x26a252[_0xa4c1('0x23')][_0xa4c1('0x24')]};});_0x5bec1b[_0xa4c1('0x25')]=_[_0xa4c1('0x1f')](_0x381c3a,_0xa4c1('0x1e'));_0x5bec1b[_0xa4c1('0x26')]=_[_0xa4c1('0x27')](_0x3a88c6[_0xa4c1('0x26')]);_0x5bec1b[_0xa4c1('0x28')]=_[_0xa4c1('0x29')](_0x5bec1b[_0xa4c1('0x25')],_0x5bec1b[_0xa4c1('0x26')]);_0x5ea6c7['attributes']=_[_0xa4c1('0x29')](_0x5bec1b[_0xa4c1('0x25')],qs['fields'](_0x3a88c6[_0xa4c1('0x26')]['fields']));_0x5ea6c7[_0xa4c1('0x2a')]=_0x5ea6c7['attributes'][_0xa4c1('0x2b')]?_0x5ea6c7[_0xa4c1('0x2a')]:_0x5bec1b['model'];if(!_0x3a88c6[_0xa4c1('0x26')][_0xa4c1('0x2c')](_0xa4c1('0x2d'))){_0x5ea6c7[_0xa4c1('0x1a')]=qs[_0xa4c1('0x1a')](_0x3a88c6[_0xa4c1('0x26')][_0xa4c1('0x1a')]);_0x5ea6c7[_0xa4c1('0x18')]=qs['offset'](_0x3a88c6['query'][_0xa4c1('0x18')]);}_0x5ea6c7[_0xa4c1('0x2e')]=qs[_0xa4c1('0x2f')](_0x3a88c6[_0xa4c1('0x26')][_0xa4c1('0x2f')]);_0x5ea6c7['where']=qs[_0xa4c1('0x28')](_[_0xa4c1('0x30')](_0x3a88c6['query'],_0x5bec1b['filters']),_0x381c3a);if(_0x3a88c6['query'][_0xa4c1('0x31')]){_0x5ea6c7[_0xa4c1('0x32')]=_['merge'](_0x5ea6c7['where'],{'$or':_[_0xa4c1('0x1f')](_0x381c3a,function(_0x2da954){if(_0x2da954['type']!==_0xa4c1('0x33')){var _0x35bf20={};_0x35bf20[_0x2da954[_0xa4c1('0x1e')]]={'$like':'%'+_0x3a88c6['query'][_0xa4c1('0x31')]+'%'};return _0x35bf20;}})});}_0x5ea6c7=_[_0xa4c1('0x34')]({},_0x5ea6c7,_0x3a88c6[_0xa4c1('0x35')]);var _0x21b2f8={'where':_0x5ea6c7[_0xa4c1('0x32')]};return db[_0xa4c1('0x20')][_0xa4c1('0x1b')](_0x21b2f8)[_0xa4c1('0xa')](function(_0x325be5){_0x22a38b['count']=_0x325be5;if(_0x3a88c6[_0xa4c1('0x26')][_0xa4c1('0x36')]){_0x5ea6c7[_0xa4c1('0x37')]=[{'all':!![]}];}return db[_0xa4c1('0x20')][_0xa4c1('0x38')](_0x5ea6c7);})[_0xa4c1('0xa')](function(_0x36f6c2){_0x22a38b['rows']=_0x36f6c2;return _0x22a38b;})[_0xa4c1('0xa')](respondWithFilteredResult(_0x3d5f5f,_0x5ea6c7))['catch'](handleError(_0x3d5f5f,null));};exports[_0xa4c1('0x39')]=function(_0x3da1e3,_0x4ce80d){var _0x486048={'raw':!![],'where':{'id':_0x3da1e3['params']['id']}},_0x52a145={};_0x52a145[_0xa4c1('0x25')]=_[_0xa4c1('0x27')](db[_0xa4c1('0x20')][_0xa4c1('0x21')]);_0x52a145[_0xa4c1('0x26')]=_[_0xa4c1('0x27')](_0x3da1e3[_0xa4c1('0x26')]);_0x52a145[_0xa4c1('0x28')]=_[_0xa4c1('0x29')](_0x52a145['model'],_0x52a145[_0xa4c1('0x26')]);_0x486048[_0xa4c1('0x2a')]=_['intersection'](_0x52a145[_0xa4c1('0x25')],qs[_0xa4c1('0x3a')](_0x3da1e3['query'][_0xa4c1('0x3a')]));_0x486048[_0xa4c1('0x2a')]=_0x486048[_0xa4c1('0x2a')][_0xa4c1('0x2b')]?_0x486048[_0xa4c1('0x2a')]:_0x52a145['model'];if(_0x3da1e3['query'][_0xa4c1('0x36')]){_0x486048[_0xa4c1('0x37')]=[{'all':!![]}];}_0x486048=_[_0xa4c1('0x34')]({},_0x486048,_0x3da1e3[_0xa4c1('0x35')]);return db[_0xa4c1('0x20')]['find'](_0x486048)[_0xa4c1('0xa')](handleEntityNotFound(_0x4ce80d,null))[_0xa4c1('0xa')](respondWithResult(_0x4ce80d,null))['catch'](handleError(_0x4ce80d,null));};exports[_0xa4c1('0x3b')]=function(_0x18eea1,_0x276b98){var _0x13488f;return db[_0xa4c1('0x20')][_0xa4c1('0x3b')](_0x18eea1[_0xa4c1('0x3c')],{'raw':!![]})['then'](function(_0x314385){_0x13488f=_0x314385;return db[_0xa4c1('0x20')][_0xa4c1('0x38')]({'where':{'type':_0x18eea1[_0xa4c1('0x3c')][_0xa4c1('0x23')]},'raw':!![]});})[_0xa4c1('0xa')](function(_0x5b3886){if(_0x13488f[_0xa4c1('0x23')]['toUpperCase']()==_0xa4c1('0x3d')){var _0x5cfb6f=fs['readFileSync'](path[_0xa4c1('0x3e')](config[_0xa4c1('0x3f')],_0xa4c1('0x40')),_0xa4c1('0x41'));var _0x457cba=ejs['render'](_0x5cfb6f,{'networks':_0x5b3886||[]});fs[_0xa4c1('0x42')]('/etc/asterisk/stun_xcally.conf',_0x457cba);return respondWithRpcPromise('Reload',_0xa4c1('0x3b'),{'module':_0xa4c1('0x43')});}else if(_0x13488f[_0xa4c1('0x23')][_0xa4c1('0x44')]()=='TURN'){var _0xfa6d82=fs[_0xa4c1('0x45')](path[_0xa4c1('0x3e')](config[_0xa4c1('0x3f')],'server/files/templates/turn_multiple.ejs'),_0xa4c1('0x41'));var _0x477bf3=ejs[_0xa4c1('0x46')](_0xfa6d82,{'networks':_0x5b3886||[]});fs[_0xa4c1('0x42')]('/etc/asterisk/turn_xcally.conf',_0x477bf3);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x3b'),{'module':_0xa4c1('0x43')});}else{var _0x465e85=fs[_0xa4c1('0x45')](path[_0xa4c1('0x3e')](config[_0xa4c1('0x3f')],'server/files/templates/network.ejs'),_0xa4c1('0x41'));var _0x1e1930=ejs[_0xa4c1('0x46')](_0x465e85,{'networks':_0x5b3886||[]});fs[_0xa4c1('0x42')](util['format'](_0xa4c1('0x48'),_0x18eea1[_0xa4c1('0x3c')][_0xa4c1('0x23')][_0xa4c1('0x49')]()),_0x1e1930);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x3b'),{'module':'chan_sip.so'});}})['then'](function(){return _0x13488f;})[_0xa4c1('0xa')](respondWithResult(_0x276b98,0xc9))['catch'](handleError(_0x276b98,null));};exports['update']=function(_0x17d159,_0xf0ffee){var _0x360fd7;return db[_0xa4c1('0x20')][_0xa4c1('0x4a')]({'where':{'id':_0x17d159[_0xa4c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf0ffee,null))[_0xa4c1('0xa')](saveUpdates(_0x17d159['body'],null))[_0xa4c1('0xa')](function(_0x30217f){if(_0x30217f){_0x360fd7=_0x30217f;return db[_0xa4c1('0x20')][_0xa4c1('0x38')]({'where':{'type':_0x360fd7[_0xa4c1('0x23')]},'raw':!![]});}return null;})[_0xa4c1('0xa')](function(_0x5838e1){if(_0x360fd7[_0xa4c1('0x23')][_0xa4c1('0x44')]()==_0xa4c1('0x3d')){var _0x1c4343=fs['readFileSync'](path[_0xa4c1('0x3e')](config['root'],_0xa4c1('0x40')),'utf8');var _0x415011=ejs[_0xa4c1('0x46')](_0x1c4343,{'networks':_0x5838e1||[]});fs['writeFileSync'](_0xa4c1('0x4c'),_0x415011);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x360fd7[_0xa4c1('0x23')][_0xa4c1('0x44')]()==_0xa4c1('0x4d')){var _0x369df0=fs[_0xa4c1('0x45')](path[_0xa4c1('0x3e')](config[_0xa4c1('0x3f')],_0xa4c1('0x4e')),_0xa4c1('0x41'));var _0x2028da=ejs[_0xa4c1('0x46')](_0x369df0,{'networks':_0x5838e1||[]});fs[_0xa4c1('0x42')](_0xa4c1('0x4f'),_0x2028da);return respondWithRpcPromise('Reload',_0xa4c1('0x1d'),{'module':_0xa4c1('0x43')});}else{var _0x3c39ad=fs[_0xa4c1('0x45')](path[_0xa4c1('0x3e')](config['root'],'server/files/templates/network.ejs'),_0xa4c1('0x41'));var _0x144491=ejs[_0xa4c1('0x46')](_0x3c39ad,{'networks':_0x5838e1||[]});fs[_0xa4c1('0x42')](util[_0xa4c1('0x50')](_0xa4c1('0x48'),_0x17d159[_0xa4c1('0x3c')][_0xa4c1('0x23')]['toLowerCase']()),_0x144491);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x1d'),{'module':'chan_sip.so'});}})[_0xa4c1('0xa')](function(_0x5763b8){if(_0x5763b8){return _0x360fd7;}return null;})[_0xa4c1('0xa')](respondWithResult(_0xf0ffee,null))['catch'](handleError(_0xf0ffee,null));};exports[_0xa4c1('0x51')]=function(_0x3fca6d,_0x25a7d8){var _0x35517d;return db[_0xa4c1('0x20')][_0xa4c1('0x4a')]({'where':{'id':_0x3fca6d[_0xa4c1('0x4b')]['id']}})[_0xa4c1('0xa')](function(_0x1935bd){_0x35517d=_0x1935bd;return _0x1935bd;})['then'](handleEntityNotFound(_0x25a7d8,null))['then'](removeEntity(_0x25a7d8,null))[_0xa4c1('0xa')](function(){if(_0x35517d){return db[_0xa4c1('0x20')][_0xa4c1('0x38')]({'where':{'type':_0x35517d[_0xa4c1('0x23')]},'raw':!![]});}})[_0xa4c1('0xa')](function(_0x38ce65){if(_0x35517d['type'][_0xa4c1('0x44')]()==_0xa4c1('0x3d')){var _0x3c6b2b=fs['readFileSync'](path['join'](config[_0xa4c1('0x3f')],_0xa4c1('0x40')),_0xa4c1('0x41'));var _0x4992fd=ejs[_0xa4c1('0x46')](_0x3c6b2b,{'networks':_0x38ce65||[]});fs[_0xa4c1('0x42')](_0xa4c1('0x4c'),_0x4992fd);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x51'),{'module':_0xa4c1('0x43')});}else if(_0x35517d['type']['toUpperCase']()==_0xa4c1('0x4d')){var _0x4608d2=fs['readFileSync'](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xa4c1('0x41'));var _0x33a852=ejs[_0xa4c1('0x46')](_0x4608d2,{'networks':_0x38ce65||[]});fs['writeFileSync'](_0xa4c1('0x4f'),_0x33a852);return respondWithRpcPromise(_0xa4c1('0x47'),_0xa4c1('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x24cb49=fs[_0xa4c1('0x45')](path[_0xa4c1('0x3e')](config[_0xa4c1('0x3f')],_0xa4c1('0x52')),'utf8');var _0x9e06d3=ejs['render'](_0x24cb49,{'networks':_0x38ce65||[]});fs[_0xa4c1('0x42')](util[_0xa4c1('0x50')](_0xa4c1('0x48'),_0x35517d[_0xa4c1('0x23')][_0xa4c1('0x49')]()),_0x9e06d3);return respondWithRpcPromise(_0xa4c1('0x47'),'destroy',{'module':_0xa4c1('0x53')});}})[_0xa4c1('0x15')](handleError(_0x25a7d8,null));}; \ No newline at end of file +var _0x77f5=['stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','Reload','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','/etc/asterisk/stun_xcally.conf','chan_sip.so','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x77f5,0x137));var _0x577f=function(_0xc0e848,_0x1490cb){_0xc0e848=_0xc0e848-0x0;var _0x16f62d=_0x77f5[_0xc0e848];return _0x16f62d;};'use strict';var util=require(_0x577f('0x0'));var path=require(_0x577f('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x577f('0x2'));var qs=require(_0x577f('0x3'));var logger=require(_0x577f('0x4'))(_0x577f('0x5'));var config=require('../../config/environment');var db=require(_0x577f('0x6'))['db'];var jayson=require(_0x577f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2748,_0x4c484d,_0x532f2a,_0x14c6e1){return new Promise(function(_0x4f52c3,_0x3f5a53){var _0xad2fd3=_0x14c6e1||client;return _0xad2fd3['request'](_0x1c2748,_0x532f2a)[_0x577f('0x8')](function(_0x5545a6){logger[_0x577f('0x9')](_0x577f('0xa'),_0x4c484d,_0x577f('0xb'));logger['debug'](_0x577f('0xc'),_0x4c484d,'request\x20sent',JSON[_0x577f('0xd')](_0x5545a6));if(_0x5545a6['error']){if(_0x5545a6[_0x577f('0xe')][_0x577f('0xf')]===0x1f4){logger[_0x577f('0xe')](_0x577f('0xa'),_0x4c484d,_0x5545a6['error'][_0x577f('0x10')]);return _0x3f5a53(_0x5545a6[_0x577f('0xe')][_0x577f('0x10')]);}logger[_0x577f('0xe')](_0x577f('0xa'),_0x4c484d,_0x5545a6[_0x577f('0xe')][_0x577f('0x10')]);return _0x4f52c3(_0x5545a6[_0x577f('0xe')]['message']);}else{logger[_0x577f('0x9')](_0x577f('0xa'),_0x4c484d,_0x577f('0xb'));_0x4f52c3(_0x5545a6[_0x577f('0x11')][_0x577f('0x10')]);}})[_0x577f('0x12')](function(_0x541f2e){logger['error'](_0x577f('0xa'),_0x4c484d,_0x541f2e);_0x3f5a53(_0x541f2e);});});}function respondWithResult(_0x224c70,_0x1f7ef8){_0x1f7ef8=_0x1f7ef8||0xc8;return function(_0x11e8a0){if(_0x11e8a0){return _0x224c70[_0x577f('0x13')](_0x1f7ef8)['json'](_0x11e8a0);}};}function respondWithFilteredResult(_0x3a1807,_0x311d63){return function(_0x3ce3e3){if(_0x3ce3e3){var _0x2c2314=typeof _0x311d63[_0x577f('0x14')]===_0x577f('0x15')&&typeof _0x311d63[_0x577f('0x16')]===_0x577f('0x15');var _0x516910=_0x3ce3e3[_0x577f('0x17')];var _0x6fd020=_0x2c2314?0x0:_0x311d63[_0x577f('0x14')];var _0x33a194=_0x2c2314?_0x3ce3e3[_0x577f('0x17')]:_0x311d63['offset']+_0x311d63['limit'];var _0x506c7b;if(_0x33a194>=_0x516910){_0x33a194=_0x516910;_0x506c7b=0xc8;}else{_0x506c7b=0xce;}_0x3a1807['status'](_0x506c7b);return _0x3a1807[_0x577f('0x18')](_0x577f('0x19'),_0x6fd020+'-'+_0x33a194+'/'+_0x516910)[_0x577f('0x1a')](_0x3ce3e3);}return null;};}function saveUpdates(_0x396ce7){return function(_0x354734){if(_0x354734){return _0x354734[_0x577f('0x1b')](_0x396ce7)[_0x577f('0x8')](function(_0x294b0f){return _0x294b0f;});}return null;};}function removeEntity(_0x45162b){return function(_0x5c2016){if(_0x5c2016){return _0x5c2016[_0x577f('0x1c')]()['then'](function(){_0x45162b[_0x577f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dee4b){return function(_0x723198){if(!_0x723198){_0x2dee4b['sendStatus'](0x194);}return _0x723198;};}function handleError(_0x4554ff,_0x1a5f0a){_0x1a5f0a=_0x1a5f0a||0x1f4;return function(_0x556b1c){logger[_0x577f('0xe')](_0x556b1c[_0x577f('0x1d')]);if(_0x556b1c[_0x577f('0x1e')]){delete _0x556b1c[_0x577f('0x1e')];}_0x4554ff[_0x577f('0x13')](_0x1a5f0a)['send'](_0x556b1c);};}exports[_0x577f('0x1f')]=function(_0x4eb66f,_0x12210d){var _0xc39fcf={},_0x42f9db={},_0x43dd34={'count':0x0,'rows':[]};var _0x104420=_[_0x577f('0x20')](db[_0x577f('0x21')][_0x577f('0x22')],function(_0x5d25a7){return{'name':_0x5d25a7[_0x577f('0x23')],'type':_0x5d25a7[_0x577f('0x24')][_0x577f('0x25')]};});_0x42f9db[_0x577f('0x26')]=_[_0x577f('0x20')](_0x104420,_0x577f('0x1e'));_0x42f9db[_0x577f('0x27')]=_[_0x577f('0x28')](_0x4eb66f[_0x577f('0x27')]);_0x42f9db[_0x577f('0x29')]=_[_0x577f('0x2a')](_0x42f9db[_0x577f('0x26')],_0x42f9db[_0x577f('0x27')]);_0xc39fcf['attributes']=_['intersection'](_0x42f9db[_0x577f('0x26')],qs[_0x577f('0x2b')](_0x4eb66f[_0x577f('0x27')][_0x577f('0x2b')]));_0xc39fcf['attributes']=_0xc39fcf[_0x577f('0x2c')][_0x577f('0x2d')]?_0xc39fcf[_0x577f('0x2c')]:_0x42f9db[_0x577f('0x26')];if(!_0x4eb66f['query'][_0x577f('0x2e')](_0x577f('0x2f'))){_0xc39fcf[_0x577f('0x16')]=qs['limit'](_0x4eb66f[_0x577f('0x27')][_0x577f('0x16')]);_0xc39fcf[_0x577f('0x14')]=qs[_0x577f('0x14')](_0x4eb66f['query'][_0x577f('0x14')]);}_0xc39fcf[_0x577f('0x30')]=qs[_0x577f('0x31')](_0x4eb66f[_0x577f('0x27')]['sort']);_0xc39fcf['where']=qs['filters'](_[_0x577f('0x32')](_0x4eb66f[_0x577f('0x27')],_0x42f9db[_0x577f('0x29')]),_0x104420);if(_0x4eb66f[_0x577f('0x27')][_0x577f('0x33')]){_0xc39fcf[_0x577f('0x34')]=_[_0x577f('0x35')](_0xc39fcf[_0x577f('0x34')],{'$or':_[_0x577f('0x20')](_0x104420,function(_0x1ab957){if(_0x1ab957['type']!==_0x577f('0x36')){var _0x429400={};_0x429400[_0x1ab957[_0x577f('0x1e')]]={'$like':'%'+_0x4eb66f[_0x577f('0x27')][_0x577f('0x33')]+'%'};return _0x429400;}})});}_0xc39fcf=_[_0x577f('0x35')]({},_0xc39fcf,_0x4eb66f[_0x577f('0x37')]);var _0x36ff81={'where':_0xc39fcf['where']};return db[_0x577f('0x21')]['count'](_0x36ff81)['then'](function(_0x22852e){_0x43dd34[_0x577f('0x17')]=_0x22852e;if(_0x4eb66f[_0x577f('0x27')][_0x577f('0x38')]){_0xc39fcf[_0x577f('0x39')]=[{'all':!![]}];}return db[_0x577f('0x21')][_0x577f('0x3a')](_0xc39fcf);})[_0x577f('0x8')](function(_0x731d12){_0x43dd34[_0x577f('0x3b')]=_0x731d12;return _0x43dd34;})['then'](respondWithFilteredResult(_0x12210d,_0xc39fcf))['catch'](handleError(_0x12210d,null));};exports[_0x577f('0x3c')]=function(_0x25b39d,_0x30d6a){var _0x53dbd8={'raw':!![],'where':{'id':_0x25b39d[_0x577f('0x3d')]['id']}},_0x170e1f={};_0x170e1f['model']=_[_0x577f('0x28')](db[_0x577f('0x21')]['rawAttributes']);_0x170e1f[_0x577f('0x27')]=_[_0x577f('0x28')](_0x25b39d['query']);_0x170e1f[_0x577f('0x29')]=_[_0x577f('0x2a')](_0x170e1f[_0x577f('0x26')],_0x170e1f[_0x577f('0x27')]);_0x53dbd8[_0x577f('0x2c')]=_[_0x577f('0x2a')](_0x170e1f[_0x577f('0x26')],qs['fields'](_0x25b39d[_0x577f('0x27')][_0x577f('0x2b')]));_0x53dbd8['attributes']=_0x53dbd8[_0x577f('0x2c')][_0x577f('0x2d')]?_0x53dbd8[_0x577f('0x2c')]:_0x170e1f[_0x577f('0x26')];if(_0x25b39d[_0x577f('0x27')][_0x577f('0x38')]){_0x53dbd8['include']=[{'all':!![]}];}_0x53dbd8=_[_0x577f('0x35')]({},_0x53dbd8,_0x25b39d[_0x577f('0x37')]);return db[_0x577f('0x21')]['find'](_0x53dbd8)[_0x577f('0x8')](handleEntityNotFound(_0x30d6a,null))[_0x577f('0x8')](respondWithResult(_0x30d6a,null))[_0x577f('0x12')](handleError(_0x30d6a,null));};exports['create']=function(_0x352695,_0x3b68f5){var _0x27b158;return db[_0x577f('0x21')][_0x577f('0x3e')](_0x352695[_0x577f('0x3f')],{'raw':!![]})[_0x577f('0x8')](function(_0x4d8a6f){_0x27b158=_0x4d8a6f;return db[_0x577f('0x21')]['findAll']({'where':{'type':_0x352695[_0x577f('0x3f')]['type']},'raw':!![]});})[_0x577f('0x8')](function(_0x219aeb){if(_0x27b158[_0x577f('0x24')][_0x577f('0x40')]()==_0x577f('0x41')){var _0x36af52=fs[_0x577f('0x42')](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x45')),'utf8');var _0x2cc4ef=ejs[_0x577f('0x46')](_0x36af52,{'networks':_0x219aeb||[]});fs[_0x577f('0x47')]('/etc/asterisk/stun_xcally.conf',_0x2cc4ef);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x27b158[_0x577f('0x24')][_0x577f('0x40')]()==_0x577f('0x49')){var _0x73e8aa=fs[_0x577f('0x42')](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x4a')),_0x577f('0x4b'));var _0x307f51=ejs['render'](_0x73e8aa,{'networks':_0x219aeb||[]});fs[_0x577f('0x47')](_0x577f('0x4c'),_0x307f51);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x3e'),{'module':_0x577f('0x4d')});}else{var _0x39a874=fs[_0x577f('0x42')](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x4e')),_0x577f('0x4b'));var _0xd64575=ejs[_0x577f('0x46')](_0x39a874,{'networks':_0x219aeb||[]});fs[_0x577f('0x47')](util[_0x577f('0x4f')](_0x577f('0x50'),_0x352695['body'][_0x577f('0x24')][_0x577f('0x51')]()),_0xd64575);return respondWithRpcPromise(_0x577f('0x48'),'create',{'module':'chan_sip.so'});}})['then'](function(){return _0x27b158;})[_0x577f('0x8')](respondWithResult(_0x3b68f5,0xc9))[_0x577f('0x12')](handleError(_0x3b68f5,null));};exports[_0x577f('0x1b')]=function(_0x6018e7,_0x739a4d){var _0x882d4a;return db[_0x577f('0x21')][_0x577f('0x52')]({'where':{'id':_0x6018e7['params']['id']}})[_0x577f('0x8')](handleEntityNotFound(_0x739a4d,null))[_0x577f('0x8')](saveUpdates(_0x6018e7[_0x577f('0x3f')],null))[_0x577f('0x8')](function(_0x389fb1){if(_0x389fb1){_0x882d4a=_0x389fb1;return db[_0x577f('0x21')][_0x577f('0x3a')]({'where':{'type':_0x882d4a[_0x577f('0x24')]},'raw':!![]});}return null;})[_0x577f('0x8')](function(_0x355500){if(_0x882d4a[_0x577f('0x24')][_0x577f('0x40')]()==_0x577f('0x41')){var _0x2339c0=fs['readFileSync'](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x45')),_0x577f('0x4b'));var _0x1082e1=ejs['render'](_0x2339c0,{'networks':_0x355500||[]});fs[_0x577f('0x47')](_0x577f('0x53'),_0x1082e1);return respondWithRpcPromise(_0x577f('0x48'),'update',{'module':'res_stun_monitor.so'});}else if(_0x882d4a[_0x577f('0x24')][_0x577f('0x40')]()==_0x577f('0x49')){var _0x23c42d=fs[_0x577f('0x42')](path[_0x577f('0x43')](config['root'],_0x577f('0x4a')),_0x577f('0x4b'));var _0x312364=ejs[_0x577f('0x46')](_0x23c42d,{'networks':_0x355500||[]});fs[_0x577f('0x47')]('/etc/asterisk/turn_xcally.conf',_0x312364);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x1b'),{'module':_0x577f('0x4d')});}else{var _0x31144d=fs[_0x577f('0x42')](path['join'](config[_0x577f('0x44')],_0x577f('0x4e')),'utf8');var _0x2ae8f8=ejs['render'](_0x31144d,{'networks':_0x355500||[]});fs['writeFileSync'](util[_0x577f('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x6018e7[_0x577f('0x3f')][_0x577f('0x24')][_0x577f('0x51')]()),_0x2ae8f8);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x1b'),{'module':_0x577f('0x54')});}})['then'](function(_0x45b88e){if(_0x45b88e){return _0x882d4a;}return null;})[_0x577f('0x8')](respondWithResult(_0x739a4d,null))['catch'](handleError(_0x739a4d,null));};exports[_0x577f('0x1c')]=function(_0x5e2821,_0x39cba0){var _0x22fd5c;return db[_0x577f('0x21')]['find']({'where':{'id':_0x5e2821['params']['id']}})[_0x577f('0x8')](function(_0x330fc1){_0x22fd5c=_0x330fc1;return _0x330fc1;})[_0x577f('0x8')](handleEntityNotFound(_0x39cba0,null))[_0x577f('0x8')](removeEntity(_0x39cba0,null))[_0x577f('0x8')](function(){if(_0x22fd5c){return db[_0x577f('0x21')][_0x577f('0x3a')]({'where':{'type':_0x22fd5c[_0x577f('0x24')]},'raw':!![]});}})[_0x577f('0x8')](function(_0x1ec7a0){if(_0x22fd5c[_0x577f('0x24')][_0x577f('0x40')]()==_0x577f('0x41')){var _0x31654e=fs[_0x577f('0x42')](path[_0x577f('0x43')](config['root'],_0x577f('0x45')),'utf8');var _0x22236c=ejs[_0x577f('0x46')](_0x31654e,{'networks':_0x1ec7a0||[]});fs[_0x577f('0x47')](_0x577f('0x53'),_0x22236c);return respondWithRpcPromise(_0x577f('0x48'),'destroy',{'module':_0x577f('0x4d')});}else if(_0x22fd5c['type']['toUpperCase']()=='TURN'){var _0x2d9c6c=fs[_0x577f('0x42')](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x4a')),_0x577f('0x4b'));var _0x37bae0=ejs['render'](_0x2d9c6c,{'networks':_0x1ec7a0||[]});fs['writeFileSync'](_0x577f('0x4c'),_0x37bae0);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x331367=fs['readFileSync'](path[_0x577f('0x43')](config[_0x577f('0x44')],_0x577f('0x4e')),_0x577f('0x4b'));var _0x4c647b=ejs[_0x577f('0x46')](_0x331367,{'networks':_0x1ec7a0||[]});fs['writeFileSync'](util[_0x577f('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x22fd5c[_0x577f('0x24')][_0x577f('0x51')]()),_0x4c647b);return respondWithRpcPromise(_0x577f('0x48'),_0x577f('0x1c'),{'module':_0x577f('0x54')});}})[_0x577f('0x12')](handleError(_0x39cba0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7bea196..dbf1801 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 _0x9b87=['define','Network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x9b87,0x8e));var _0x79b8=function(_0xc34af7,_0x270554){_0xc34af7=_0xc34af7-0x0;var _0xb37edc=_0x9b87[_0xc34af7];return _0xb37edc;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var logger=require(_0x79b8('0x2'))(_0x79b8('0x3'));var moment=require(_0x79b8('0x4'));var BPromise=require(_0x79b8('0x5'));var rp=require(_0x79b8('0x6'));var fs=require('fs');var path=require(_0x79b8('0x7'));var rimraf=require(_0x79b8('0x8'));var config=require(_0x79b8('0x9'));var attributes=require(_0x79b8('0xa'));module[_0x79b8('0xb')]=function(_0x3ccc53,_0x2e21b9){return _0x3ccc53[_0x79b8('0xc')](_0x79b8('0xd'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5db8,0xbb));var _0x85db=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x5db8[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'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 920b319..92b66bb 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x57e932,_0x352738){_0x57e932=_0x57e932-0x0;var _0x5e2bdf=_0x7a54[_0x57e932];return _0x5e2bdf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1308f2,_0x2f8fe3){var _0x2edfe4=function(_0x4de5c0){while(--_0x4de5c0){_0x1308f2['push'](_0x1308f2['shift']());}};_0x2edfe4(++_0x2f8fe3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 6f8e4b6..ee578ec 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 _0x8afe=['addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','describe','/:id','show','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications'];(function(_0x5d49d7,_0x19eb9a){var _0x58881c=function(_0x22cf79){while(--_0x22cf79){_0x5d49d7['push'](_0x5d49d7['shift']());}};_0x58881c(++_0x19eb9a);}(_0x8afe,0x11a));var _0xe8af=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8afe[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xe8af('0x0'));var util=require(_0xe8af('0x1'));var path=require(_0xe8af('0x2'));var timeout=require(_0xe8af('0x3'));var express=require('express');var router=express[_0xe8af('0x4')]();var fs_extra=require(_0xe8af('0x5'));var auth=require(_0xe8af('0x6'));var interaction=require(_0xe8af('0x7'));var config=require(_0xe8af('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe8af('0x9')]);router[_0xe8af('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe8af('0xb')]);router[_0xe8af('0xa')](_0xe8af('0xc'),auth['isAuthenticated'](),controller[_0xe8af('0xd')]);router[_0xe8af('0xa')]('/:id/dispositions',auth[_0xe8af('0xe')](),controller[_0xe8af('0xf')]);router['get'](_0xe8af('0x10'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x11')]);router['get'](_0xe8af('0x12'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x13')]);router[_0xe8af('0xa')](_0xe8af('0x14'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x15')]);router[_0xe8af('0xa')](_0xe8af('0x16'),auth[_0xe8af('0xe')](),controller['getAgents']);router[_0xe8af('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe8af('0x17')](_0xe8af('0x18'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x19')]);router['post']('/:id/canned_answers',auth[_0xe8af('0xe')](),controller[_0xe8af('0x1a')]);router[_0xe8af('0x17')](_0xe8af('0x1b'),controller[_0xe8af('0x1c')]);router[_0xe8af('0x17')](_0xe8af('0x12'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x1d')]);router[_0xe8af('0x17')](_0xe8af('0x16'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x1e')]);router['post'](_0xe8af('0x1f'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x20')]);router[_0xe8af('0x21')]('/:id',auth[_0xe8af('0xe')](),controller['update']);router[_0xe8af('0x22')](_0xe8af('0xc'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x23')]);router['delete'](_0xe8af('0x18'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x24')]);router[_0xe8af('0x22')](_0xe8af('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe8af('0x22')](_0xe8af('0x16'),auth[_0xe8af('0xe')](),controller[_0xe8af('0x25')]);module[_0xe8af('0x26')]=router; \ No newline at end of file +var _0x62e8=['update','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','/:id/dispositions','/:id/canned_answers','notify','/:id/applications','addApplications','addAgents','send'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x62e8,0x140));var _0x862e=function(_0x331454,_0x1eb140){_0x331454=_0x331454-0x0;var _0x210ec1=_0x62e8[_0x331454];return _0x210ec1;};'use strict';var multer=require('multer');var util=require(_0x862e('0x0'));var path=require(_0x862e('0x1'));var timeout=require(_0x862e('0x2'));var express=require(_0x862e('0x3'));var router=express['Router']();var fs_extra=require(_0x862e('0x4'));var auth=require(_0x862e('0x5'));var interaction=require(_0x862e('0x6'));var config=require(_0x862e('0x7'));var controller=require(_0x862e('0x8'));router[_0x862e('0x9')]('/',auth['isAuthenticated'](),controller[_0x862e('0xa')]);router[_0x862e('0x9')](_0x862e('0xb'),auth[_0x862e('0xc')](),controller[_0x862e('0xd')]);router[_0x862e('0x9')](_0x862e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x862e('0x9')]('/:id/dispositions',auth[_0x862e('0xc')](),controller[_0x862e('0xf')]);router[_0x862e('0x9')]('/:id/canned_answers',auth[_0x862e('0xc')](),controller[_0x862e('0x10')]);router[_0x862e('0x9')]('/:id/applications',auth[_0x862e('0xc')](),controller[_0x862e('0x11')]);router[_0x862e('0x9')](_0x862e('0x12'),auth[_0x862e('0xc')](),controller['getInteractions']);router[_0x862e('0x9')](_0x862e('0x13'),auth['isAuthenticated'](),controller[_0x862e('0x14')]);router[_0x862e('0x15')]('/',auth['isAuthenticated'](),controller[_0x862e('0x16')]);router[_0x862e('0x15')](_0x862e('0x17'),auth[_0x862e('0xc')](),controller['addDisposition']);router[_0x862e('0x15')](_0x862e('0x18'),auth[_0x862e('0xc')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x862e('0x19')]);router[_0x862e('0x15')](_0x862e('0x1a'),auth[_0x862e('0xc')](),controller[_0x862e('0x1b')]);router[_0x862e('0x15')](_0x862e('0x13'),auth[_0x862e('0xc')](),controller[_0x862e('0x1c')]);router[_0x862e('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0x862e('0x1d')]);router['put'](_0x862e('0xe'),auth['isAuthenticated'](),controller[_0x862e('0x1e')]);router['delete']('/:id',auth[_0x862e('0xc')](),controller[_0x862e('0x1f')]);router[_0x862e('0x20')]('/:id/dispositions',auth[_0x862e('0xc')](),controller['removeDispositions']);router[_0x862e('0x20')](_0x862e('0x18'),auth[_0x862e('0xc')](),controller['removeAnswers']);router[_0x862e('0x20')](_0x862e('0x13'),auth[_0x862e('0xc')](),controller[_0x862e('0x21')]);module[_0x862e('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6402b89..a1354bc 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 _0xbb37=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x490403,_0xd2381){var _0x37974b=function(_0x4e8697){while(--_0x4e8697){_0x490403['push'](_0x490403['shift']());}};_0x37974b(++_0xd2381);}(_0xbb37,0x1bd));var _0x7bb3=function(_0x21c32e,_0x245019){_0x21c32e=_0x21c32e-0x0;var _0x365884=_0xbb37[_0x21c32e];return _0x365884;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x7bb3('0x0')]={'name':{'type':Sequelize[_0x7bb3('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x7bb3('0x1')]},'token':{'type':Sequelize[_0x7bb3('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x7bb3('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7bb3('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7bb3('0x2')],'defaultValue':function(){return _0x7bb3('0x3');}},'notificationSound':{'type':Sequelize[_0x7bb3('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7bb3('0x1')]},'queueTransfer':{'type':Sequelize[_0x7bb3('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bb3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7bb3('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7bb3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bb3('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7bb3('0x4')],'defaultValue':![],'comment':_0x7bb3('0x6'),'set':function(_0x148ed3){if(!_0x148ed3)this[_0x7bb3('0x7')](_0x7bb3('0x8'),null);this[_0x7bb3('0x7')](_0x7bb3('0x9'),_0x148ed3);}}}; \ No newline at end of file +var _0x1fbf=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x922d4,_0x993641){var _0x209f6a=function(_0x108986){while(--_0x108986){_0x922d4['push'](_0x922d4['shift']());}};_0x209f6a(++_0x993641);}(_0x1fbf,0x1b0));var _0xf1fb=function(_0x1598b9,_0x34e25d){_0x1598b9=_0x1598b9-0x0;var _0x33b4ce=_0x1fbf[_0x1598b9];return _0x33b4ce;};'use strict';var Sequelize=require(_0xf1fb('0x0'));var rs=require('randomstring');module[_0xf1fb('0x1')]={'name':{'type':Sequelize[_0xf1fb('0x2')],'unique':_0xf1fb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf1fb('0x2')]},'token':{'type':Sequelize[_0xf1fb('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xf1fb('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'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[_0xf1fb('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf1fb('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xf1fb('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf1fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf1fb('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf1fb('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf1fb('0x4')],'defaultValue':![],'comment':_0xf1fb('0x6'),'set':function(_0x3a9efd){if(!_0x3a9efd)this[_0xf1fb('0x7')](_0xf1fb('0x8'),null);this[_0xf1fb('0x7')](_0xf1fb('0x9'),_0x3a9efd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fb6118f..15739ef 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 _0x6666=['filter','options','include','findAll','rows','show','Pause','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','params','OpenchannelAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','ListId','isNil','from','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','Contacts','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','defaults','out','Messages','spread','dataValues','eml-format','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','json','offset','limit','undefined','count','status','set','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','then','end','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','query','sort','pick','merge','where','type','VIRTUAL'];(function(_0x4f85df,_0xe123ae){var _0xf067e4=function(_0x5cdb5b){while(--_0x5cdb5b){_0x4f85df['push'](_0x4f85df['shift']());}};_0xf067e4(++_0xe123ae);}(_0x6666,0x6e));var _0x6666=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x6666[_0x445c98];return _0x2fe913;};'use strict';var emlformat=require(_0x6666('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6666('0x1'));var BPromise=require(_0x6666('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6666('0x3'));var sox=require(_0x6666('0x4'));var csv=require(_0x6666('0x5'));var ejs=require(_0x6666('0x6'));var fs=require('fs');var fs_extra=require(_0x6666('0x7'));var _=require(_0x6666('0x8'));var squel=require(_0x6666('0x9'));var crypto=require(_0x6666('0xa'));var jsforce=require(_0x6666('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6666('0x5'));var querystring=require(_0x6666('0xc'));var Papa=require(_0x6666('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6666('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6666('0xf'));var logger=require('../../config/logger')(_0x6666('0x10'));var utils=require('../../config/utils');var config=require(_0x6666('0x11'));var licenseUtil=require(_0x6666('0x12'));var db=require(_0x6666('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6666('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6666('0x15')]));require(_0x6666('0x16'))['register'](socket);var jayson=require(_0x6666('0x17'));var client=jayson[_0x6666('0x18')][_0x6666('0x19')]({'port':0x232c});var client9002=jayson[_0x6666('0x18')][_0x6666('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x403ef1,_0x5ccfe0,_0x52762c,_0xf731ec){return new BPromise(function(_0x2fb265,_0x46a7ce){var _0x4c7f2d=_0xf731ec||client;return _0x4c7f2d[_0x6666('0x1a')](_0x403ef1,_0x52762c)['then'](function(_0x38331d){logger[_0x6666('0x1b')](_0x6666('0x1c'),_0x5ccfe0,_0x6666('0x1d'));logger[_0x6666('0x1e')](_0x6666('0x1f'),_0x5ccfe0,'request\x20sent',JSON['stringify'](_0x38331d));if(_0x38331d[_0x6666('0x20')]){if(_0x38331d['error'][_0x6666('0x21')]===0x1f4){logger[_0x6666('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ccfe0,_0x38331d[_0x6666('0x20')][_0x6666('0x22')]);return _0x46a7ce(_0x38331d['error']['message']);}logger[_0x6666('0x20')](_0x6666('0x1c'),_0x5ccfe0,_0x38331d['error'][_0x6666('0x22')]);return _0x2fb265(_0x38331d[_0x6666('0x20')][_0x6666('0x22')]);}else{logger[_0x6666('0x1b')](_0x6666('0x1c'),_0x5ccfe0,_0x6666('0x1d'));_0x2fb265(_0x38331d[_0x6666('0x23')][_0x6666('0x22')]);}})[_0x6666('0x24')](function(_0x3d53b3){logger[_0x6666('0x20')](_0x6666('0x1c'),_0x5ccfe0,_0x3d53b3);_0x46a7ce(_0x3d53b3);});});}function respondWithStatusCode(_0xdc7770,_0x20ffb3){_0x20ffb3=_0x20ffb3||0xcc;return function(_0x1c20d6){if(_0x1c20d6){return _0xdc7770[_0x6666('0x25')](_0x20ffb3);}return _0xdc7770['status'](_0x20ffb3)['end']();};}function respondWithResult(_0x41fb17,_0xfd74d8){_0xfd74d8=_0xfd74d8||0xc8;return function(_0x415a51){if(_0x415a51){return _0x41fb17['status'](_0xfd74d8)[_0x6666('0x26')](_0x415a51);}};}function respondWithFilteredResult(_0x509dab,_0xe911f2){return function(_0x321b1f){if(_0x321b1f){var _0x3c7522=typeof _0xe911f2[_0x6666('0x27')]==='undefined'&&typeof _0xe911f2[_0x6666('0x28')]===_0x6666('0x29');var _0x2e928e=_0x321b1f['count'];var _0x41d53d=_0x3c7522?0x0:_0xe911f2['offset'];var _0x8aef6b=_0x3c7522?_0x321b1f[_0x6666('0x2a')]:_0xe911f2['offset']+_0xe911f2['limit'];var _0x1560fe;if(_0x8aef6b>=_0x2e928e){_0x8aef6b=_0x2e928e;_0x1560fe=0xc8;}else{_0x1560fe=0xce;}_0x509dab[_0x6666('0x2b')](_0x1560fe);return _0x509dab[_0x6666('0x2c')]('Content-Range',_0x41d53d+'-'+_0x8aef6b+'/'+_0x2e928e)[_0x6666('0x26')](_0x321b1f);}return null;};}function patchUpdates(_0xa9217f){return function(_0x58c079){try{jsonpatch['apply'](_0x58c079,_0xa9217f,!![]);}catch(_0x297ce3){return BPromise[_0x6666('0x2d')](_0x297ce3);}return _0x58c079[_0x6666('0x2e')]();};}function saveUpdates(_0x1bb72a,_0x295a7e){return function(_0x4535f2){if(_0x4535f2){return _0x4535f2[_0x6666('0x2f')](_0x1bb72a)['then'](function(_0x583cb2){return _0x583cb2;});}return null;};}function removeEntity(_0x33237a,_0x227be1){return function(_0x551568){if(_0x551568){return _0x551568['destroy']()['then'](function(){var _0x14532b=_0x551568[_0x6666('0x30')]({'plain':!![]});var _0x1309aa=_0x6666('0x31');return db[_0x6666('0x32')][_0x6666('0x33')]({'where':{'type':_0x1309aa,'resourceId':_0x14532b['id']}})[_0x6666('0x34')](function(){return _0x551568;});})[_0x6666('0x34')](function(){_0x33237a[_0x6666('0x2b')](0xcc)[_0x6666('0x35')]();});}};}function handleEntityNotFound(_0x2e4ed4,_0x3ea400){return function(_0x34f908){if(!_0x34f908){_0x2e4ed4['sendStatus'](0x194);}return _0x34f908;};}function handleError(_0x43bddd,_0x448631){_0x448631=_0x448631||0x1f4;return function(_0x1f99c4){logger['error'](_0x1f99c4[_0x6666('0x36')]);if(_0x1f99c4['name']){delete _0x1f99c4[_0x6666('0x37')];}_0x43bddd[_0x6666('0x2b')](_0x448631)[_0x6666('0x38')](_0x1f99c4);};}exports[_0x6666('0x39')]=function(_0xb16932,_0x3d8ca9){var _0x4d68f2={'include':[{'model':db['Pause'],'as':_0x6666('0x3a')}]},_0x39eda5={},_0x47f9b5={'count':0x0,'rows':[]};var _0x278399=_[_0x6666('0x3b')](db[_0x6666('0x3c')][_0x6666('0x3d')],function(_0x349884){return{'name':_0x349884['fieldName'],'type':_0x349884['type']['key']};});_0x39eda5['model']=_[_0x6666('0x3b')](_0x278399,_0x6666('0x37'));_0x39eda5['query']=_[_0x6666('0x3e')](_0xb16932['query']);_0x39eda5[_0x6666('0x3f')]=_['intersection'](_0x39eda5['model'],_0x39eda5['query']);_0x4d68f2[_0x6666('0x40')]=_[_0x6666('0x41')](_0x39eda5[_0x6666('0x42')],qs[_0x6666('0x43')](_0xb16932['query'][_0x6666('0x43')]));_0x4d68f2[_0x6666('0x40')]=_0x4d68f2[_0x6666('0x40')][_0x6666('0x44')]?_0x4d68f2['attributes']:_0x39eda5[_0x6666('0x42')];if(!_0xb16932['query'][_0x6666('0x45')](_0x6666('0x46'))){_0x4d68f2[_0x6666('0x28')]=qs[_0x6666('0x28')](_0xb16932[_0x6666('0x47')][_0x6666('0x28')]);_0x4d68f2[_0x6666('0x27')]=qs[_0x6666('0x27')](_0xb16932['query']['offset']);}_0x4d68f2['order']=qs[_0x6666('0x48')](_0xb16932[_0x6666('0x47')]['sort']);_0x4d68f2['where']=qs['filters'](_[_0x6666('0x49')](_0xb16932[_0x6666('0x47')],_0x39eda5[_0x6666('0x3f')]),_0x278399);if(_0xb16932[_0x6666('0x47')]['filter']){_0x4d68f2['where']=_[_0x6666('0x4a')](_0x4d68f2[_0x6666('0x4b')],{'$or':_[_0x6666('0x3b')](_0x278399,function(_0x2b057e){if(_0x2b057e[_0x6666('0x4c')]!==_0x6666('0x4d')){var _0x1e3b04={};_0x1e3b04[_0x2b057e[_0x6666('0x37')]]={'$like':'%'+_0xb16932[_0x6666('0x47')][_0x6666('0x4e')]+'%'};return _0x1e3b04;}})});}_0x4d68f2=_[_0x6666('0x4a')]({},_0x4d68f2,_0xb16932[_0x6666('0x4f')]);var _0x5988c1={'where':_0x4d68f2[_0x6666('0x4b')]};return db[_0x6666('0x3c')][_0x6666('0x2a')](_0x5988c1)[_0x6666('0x34')](function(_0xf066f3){_0x47f9b5['count']=_0xf066f3;if(_0xb16932[_0x6666('0x47')]['includeAll']){_0x4d68f2[_0x6666('0x50')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6666('0x51')](_0x4d68f2);})[_0x6666('0x34')](function(_0x3de365){_0x47f9b5[_0x6666('0x52')]=_0x3de365;return _0x47f9b5;})[_0x6666('0x34')](respondWithFilteredResult(_0x3d8ca9,_0x4d68f2))['catch'](handleError(_0x3d8ca9,null));};exports[_0x6666('0x53')]=function(_0x1df08b,_0x241f3d){var _0x2907c3={'raw':![],'where':{'id':_0x1df08b['params']['id']},'include':[{'model':db[_0x6666('0x54')],'as':_0x6666('0x3a')}]},_0x4af047={};_0x4af047[_0x6666('0x42')]=_[_0x6666('0x3e')](db[_0x6666('0x3c')][_0x6666('0x3d')]);_0x4af047[_0x6666('0x47')]=_[_0x6666('0x3e')](_0x1df08b[_0x6666('0x47')]);_0x4af047[_0x6666('0x3f')]=_[_0x6666('0x41')](_0x4af047['model'],_0x4af047[_0x6666('0x47')]);_0x2907c3[_0x6666('0x40')]=_['intersection'](_0x4af047[_0x6666('0x42')],qs['fields'](_0x1df08b['query']['fields']));_0x2907c3[_0x6666('0x40')]=_0x2907c3[_0x6666('0x40')][_0x6666('0x44')]?_0x2907c3[_0x6666('0x40')]:_0x4af047['model'];if(_0x1df08b[_0x6666('0x47')][_0x6666('0x55')]){_0x2907c3[_0x6666('0x50')]=[{'all':!![]}];}_0x2907c3=_[_0x6666('0x4a')]({},_0x2907c3,_0x1df08b['options']);return db['OpenchannelAccount'][_0x6666('0x56')](_0x2907c3)[_0x6666('0x34')](handleEntityNotFound(_0x241f3d,null))[_0x6666('0x34')](respondWithResult(_0x241f3d,null))[_0x6666('0x24')](handleError(_0x241f3d,null));};exports[_0x6666('0x57')]=function(_0x3b0431,_0x2b03f9){return db['OpenchannelAccount']['create'](_0x3b0431['body'],{})[_0x6666('0x34')](function(_0x129dd0){var _0x2b0bde=_0x3b0431['user'][_0x6666('0x30')]({'plain':!![]});if(!_0x2b0bde)throw new Error(_0x6666('0x58'));if(_0x2b0bde[_0x6666('0x59')]===_0x6666('0x5a')){var _0x4b20c2=_0x129dd0[_0x6666('0x30')]({'plain':!![]});var _0x2fee26=_0x6666('0x31');return db[_0x6666('0x5b')][_0x6666('0x56')]({'where':{'name':_0x2fee26,'userProfileId':_0x2b0bde[_0x6666('0x5c')]},'raw':!![]})[_0x6666('0x34')](function(_0x2fc6e6){if(_0x2fc6e6&&_0x2fc6e6[_0x6666('0x5d')]===0x0){return db[_0x6666('0x32')][_0x6666('0x57')]({'name':_0x4b20c2[_0x6666('0x37')],'resourceId':_0x4b20c2['id'],'type':_0x2fc6e6[_0x6666('0x37')],'sectionId':_0x2fc6e6['id']},{})[_0x6666('0x34')](function(){return _0x129dd0;});}else{return _0x129dd0;}})[_0x6666('0x24')](function(_0x3a1cf3){logger[_0x6666('0x20')](_0x6666('0x5e'),_0x3a1cf3);throw _0x3a1cf3;});}return _0x129dd0;})[_0x6666('0x34')](respondWithResult(_0x2b03f9,0xc9))[_0x6666('0x24')](handleError(_0x2b03f9,null));};exports[_0x6666('0x2f')]=function(_0x564eae,_0x1d553c){if(_0x564eae[_0x6666('0x5f')]['id']){delete _0x564eae['body']['id'];}return db[_0x6666('0x3c')]['find']({'where':{'id':_0x564eae['params']['id']},'include':[{'model':db['Pause'],'as':_0x6666('0x3a')}]})[_0x6666('0x34')](handleEntityNotFound(_0x1d553c,null))[_0x6666('0x34')](saveUpdates(_0x564eae[_0x6666('0x5f')],null))[_0x6666('0x34')](respondWithResult(_0x1d553c,null))[_0x6666('0x24')](handleError(_0x1d553c,null));};exports[_0x6666('0x33')]=function(_0x197127,_0x28738f){return db[_0x6666('0x3c')]['find']({'where':{'id':_0x197127['params']['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x28738f,null))['then'](removeEntity(_0x28738f,null))[_0x6666('0x24')](handleError(_0x28738f,null));};exports['describe']=function(_0x433fc7,_0x154171){return db[_0x6666('0x3c')][_0x6666('0x60')]()[_0x6666('0x34')](respondWithResult(_0x154171,null))['catch'](handleError(_0x154171,null));};exports[_0x6666('0x61')]=function(_0x1e42d1,_0x24a59b,_0x297ceb){if(_0x1e42d1[_0x6666('0x5f')]['id']){delete _0x1e42d1[_0x6666('0x5f')]['id'];}return db[_0x6666('0x3c')][_0x6666('0x56')]({'where':{'id':_0x1e42d1[_0x6666('0x62')]['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x24a59b,null))[_0x6666('0x34')](function(_0x42c670){if(_0x42c670){_0x1e42d1['body'][_0x6666('0x63')]=_0x42c670['id'];return db[_0x6666('0x64')][_0x6666('0x57')](_0x1e42d1[_0x6666('0x5f')]);}})[_0x6666('0x34')](respondWithResult(_0x24a59b,null))['catch'](handleError(_0x24a59b,null));};exports['getDispositions']=function(_0x293fa3,_0x3c2563,_0x27a804){var _0x1dfee6={'raw':![],'where':{}};var _0x308948={};var _0xbc692e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6666('0x65')]({'where':{'id':_0x293fa3['params']['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x3c2563,null))[_0x6666('0x34')](function(_0x371909){if(_0x371909){_0x308948[_0x6666('0x42')]=_[_0x6666('0x3e')](db[_0x6666('0x64')][_0x6666('0x3d')]);_0x308948[_0x6666('0x47')]=_['keys'](_0x293fa3[_0x6666('0x47')]);_0x308948[_0x6666('0x3f')]=_['intersection'](_0x308948[_0x6666('0x42')],_0x308948['query']);_0x1dfee6[_0x6666('0x40')]=_[_0x6666('0x41')](_0x308948[_0x6666('0x42')],qs[_0x6666('0x43')](_0x293fa3['query'][_0x6666('0x43')]));_0x1dfee6['attributes']=_0x1dfee6['attributes']['length']?_0x1dfee6[_0x6666('0x40')]:_0x308948['model'];if(!_0x293fa3[_0x6666('0x47')][_0x6666('0x45')](_0x6666('0x46'))){_0x1dfee6[_0x6666('0x28')]=qs[_0x6666('0x28')](_0x293fa3[_0x6666('0x47')][_0x6666('0x28')]);_0x1dfee6[_0x6666('0x27')]=qs[_0x6666('0x27')](_0x293fa3[_0x6666('0x47')]['offset']);}_0x1dfee6[_0x6666('0x66')]=qs['sort'](_0x293fa3[_0x6666('0x47')][_0x6666('0x48')]);_0x1dfee6[_0x6666('0x4b')]=qs[_0x6666('0x3f')](_[_0x6666('0x49')](_0x293fa3[_0x6666('0x47')],_0x308948[_0x6666('0x3f')]));_0x1dfee6[_0x6666('0x4b')][_0x6666('0x63')]=_0x371909['id'];if(_0x293fa3[_0x6666('0x47')][_0x6666('0x4e')]){_0x1dfee6[_0x6666('0x4b')]=_[_0x6666('0x4a')](_0x1dfee6[_0x6666('0x4b')],{'$or':_[_0x6666('0x3b')](_0x1dfee6[_0x6666('0x40')],function(_0x3f9f22){var _0x367f17={};_0x367f17[_0x3f9f22]={'$like':'%'+_0x293fa3[_0x6666('0x47')][_0x6666('0x4e')]+'%'};return _0x367f17;})});}_0x1dfee6=_['merge']({},_0x1dfee6,_0x293fa3[_0x6666('0x4f')]);return db[_0x6666('0x64')][_0x6666('0x2a')]({'where':_0x1dfee6[_0x6666('0x4b')]})[_0x6666('0x34')](function(_0x3b8e01){_0xbc692e[_0x6666('0x2a')]=_0x3b8e01;if(_0x293fa3[_0x6666('0x47')][_0x6666('0x55')]){_0x1dfee6[_0x6666('0x50')]=[{'all':!![]}];}return db[_0x6666('0x64')][_0x6666('0x51')](_0x1dfee6);})['then'](function(_0x2a5de0){_0xbc692e['rows']=_0x2a5de0;return _0xbc692e;});}})[_0x6666('0x34')](respondWithFilteredResult(_0x3c2563,_0x1dfee6))[_0x6666('0x24')](handleError(_0x3c2563,null));};exports[_0x6666('0x67')]=function(_0x5d0258,_0x41982e,_0x532527){return db['OpenchannelAccount']['find']({'where':{'id':_0x5d0258[_0x6666('0x62')]['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x41982e,null))[_0x6666('0x34')](function(_0x4e8de0){if(_0x4e8de0){return _0x4e8de0[_0x6666('0x67')](_0x5d0258[_0x6666('0x47')][_0x6666('0x68')]);}})[_0x6666('0x34')](respondWithStatusCode(_0x41982e,null))[_0x6666('0x24')](handleError(_0x41982e,null));};exports[_0x6666('0x69')]=function(_0x429132,_0x19d89b,_0x586a6a){if(_0x429132[_0x6666('0x5f')]['id']){delete _0x429132['body']['id'];}return db[_0x6666('0x3c')][_0x6666('0x56')]({'where':{'id':_0x429132['params']['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x19d89b,null))[_0x6666('0x34')](function(_0x16dfe9){if(_0x16dfe9){_0x429132[_0x6666('0x5f')][_0x6666('0x63')]=_0x16dfe9['id'];return db[_0x6666('0x6a')][_0x6666('0x57')](_0x429132[_0x6666('0x5f')]);}})['then'](respondWithResult(_0x19d89b,null))[_0x6666('0x24')](handleError(_0x19d89b,null));};exports['getAnswers']=function(_0x4b8afe,_0x538345,_0x8aadc6){var _0x54b540={'raw':![],'where':{}};var _0x4ab3af={};var _0x4ccfa1={'count':0x0,'rows':[]};return db[_0x6666('0x3c')][_0x6666('0x65')]({'where':{'id':_0x4b8afe[_0x6666('0x62')]['id']}})['then'](handleEntityNotFound(_0x538345,null))[_0x6666('0x34')](function(_0x16a5ba){if(_0x16a5ba){_0x4ab3af[_0x6666('0x42')]=_['keys'](db[_0x6666('0x6a')][_0x6666('0x3d')]);_0x4ab3af[_0x6666('0x47')]=_[_0x6666('0x3e')](_0x4b8afe[_0x6666('0x47')]);_0x4ab3af[_0x6666('0x3f')]=_[_0x6666('0x41')](_0x4ab3af[_0x6666('0x42')],_0x4ab3af[_0x6666('0x47')]);_0x54b540['attributes']=_[_0x6666('0x41')](_0x4ab3af[_0x6666('0x42')],qs[_0x6666('0x43')](_0x4b8afe[_0x6666('0x47')][_0x6666('0x43')]));_0x54b540[_0x6666('0x40')]=_0x54b540['attributes'][_0x6666('0x44')]?_0x54b540['attributes']:_0x4ab3af[_0x6666('0x42')];if(!_0x4b8afe[_0x6666('0x47')][_0x6666('0x45')](_0x6666('0x46'))){_0x54b540[_0x6666('0x28')]=qs[_0x6666('0x28')](_0x4b8afe[_0x6666('0x47')][_0x6666('0x28')]);_0x54b540['offset']=qs[_0x6666('0x27')](_0x4b8afe[_0x6666('0x47')]['offset']);}_0x54b540['order']=qs[_0x6666('0x48')](_0x4b8afe[_0x6666('0x47')][_0x6666('0x48')]);_0x54b540[_0x6666('0x4b')]=qs['filters'](_[_0x6666('0x49')](_0x4b8afe[_0x6666('0x47')],_0x4ab3af[_0x6666('0x3f')]));_0x54b540[_0x6666('0x4b')][_0x6666('0x63')]=_0x16a5ba['id'];if(_0x4b8afe[_0x6666('0x47')][_0x6666('0x4e')]){_0x54b540[_0x6666('0x4b')]=_[_0x6666('0x4a')](_0x54b540[_0x6666('0x4b')],{'$or':_[_0x6666('0x3b')](_0x54b540['attributes'],function(_0x463092){var _0x590359={};_0x590359[_0x463092]={'$like':'%'+_0x4b8afe[_0x6666('0x47')][_0x6666('0x4e')]+'%'};return _0x590359;})});}_0x54b540=_[_0x6666('0x4a')]({},_0x54b540,_0x4b8afe[_0x6666('0x4f')]);return db[_0x6666('0x6a')][_0x6666('0x2a')]({'where':_0x54b540[_0x6666('0x4b')]})[_0x6666('0x34')](function(_0x5929c8){_0x4ccfa1['count']=_0x5929c8;if(_0x4b8afe[_0x6666('0x47')][_0x6666('0x55')]){_0x54b540[_0x6666('0x50')]=[{'all':!![]}];}return db[_0x6666('0x6a')][_0x6666('0x51')](_0x54b540);})[_0x6666('0x34')](function(_0x5ec285){_0x4ccfa1[_0x6666('0x52')]=_0x5ec285;return _0x4ccfa1;});}})[_0x6666('0x34')](respondWithFilteredResult(_0x538345,_0x54b540))[_0x6666('0x24')](handleError(_0x538345,null));};exports[_0x6666('0x6b')]=function(_0x4abf7c,_0x352187,_0x484c3d){return db[_0x6666('0x3c')]['find']({'where':{'id':_0x4abf7c['params']['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x352187,null))[_0x6666('0x34')](function(_0x189a57){if(_0x189a57){return _0x189a57[_0x6666('0x6b')](_0x4abf7c[_0x6666('0x47')]['ids']);}})[_0x6666('0x34')](respondWithStatusCode(_0x352187,null))[_0x6666('0x24')](handleError(_0x352187,null));};exports[_0x6666('0x6c')]=function(_0x5b4508,_0x5e0d23,_0x2d0d2e){var _0x3c5a9f={'body':_0x5b4508['body'],'channel':'openchannel'};var _0x34f4cd=[];var _0x2dc02a=[];var _0x14ce11={};var _0x52c8be=![];return db[_0x6666('0x6d')][_0x6666('0x60')]()[_0x6666('0x34')](function(_0x503a9c){if(!_0x503a9c){throw new db[(_0x6666('0x6e'))]['ValidationError'](_0x6666('0x6f'));}_0x34f4cd=_[_0x6666('0x70')](_[_0x6666('0x3e')](_0x503a9c),[_0x6666('0x71'),'updatedAt']);_0x2dc02a=_['difference'](_[_0x6666('0x3e')](_0x503a9c),[_0x6666('0x71'),'updatedAt','CompanyId',_0x6666('0x72')]);if(_0x5b4508[_0x6666('0x5f')]['id']){delete _0x5b4508[_0x6666('0x5f')]['id'];}if(_[_0x6666('0x73')](_0x5b4508[_0x6666('0x5f')][_0x6666('0x74')])){throw new db[(_0x6666('0x6e'))][(_0x6666('0x75'))]('from\x20is\x20mandatory');}if(_[_0x6666('0x73')](_0x5b4508[_0x6666('0x5f')][_0x6666('0x5f')])||_0x5b4508[_0x6666('0x5f')][_0x6666('0x5f')]===''){throw new db[(_0x6666('0x6e'))][(_0x6666('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6666('0x73')](_0x5b4508[_0x6666('0x5f')][_0x6666('0x76')])){throw new db['Sequelize']['ValidationError'](_0x6666('0x77')+_0x2dc02a);}if(!_[_0x6666('0x78')](_0x2dc02a,_0x5b4508[_0x6666('0x5f')][_0x6666('0x76')])){throw new db[(_0x6666('0x6e'))][(_0x6666('0x75'))](_0x6666('0x79')+_0x2dc02a);}_0x14ce11[_0x5b4508[_0x6666('0x5f')]['mapKey']]=_0x5b4508[_0x6666('0x5f')][_0x6666('0x74')];})[_0x6666('0x34')](function(){return db[_0x6666('0x3c')][_0x6666('0x56')]({'where':{'id':_0x5b4508[_0x6666('0x62')]['id']},'include':[{'model':db[_0x6666('0x7a')],'as':_0x6666('0x7b'),'include':[{'model':db[_0x6666('0x6d')],'as':'Contacts','where':_0x14ce11,'limit':0x1,'order':[[_0x6666('0x7c'),_0x6666('0x7d')]]}]},{'model':db[_0x6666('0x7e')],'as':_0x6666('0x7f')}]});})['then'](handleEntityNotFound(_0x5e0d23,null))[_0x6666('0x34')](function(_0x529240){if(_0x529240&&_0x529240[_0x6666('0x7b')]){_0x3c5a9f[_0x6666('0x80')]=_0x529240;_0x3c5a9f[_0x6666('0x81')]=_0x529240['Applications'];_0x3c5a9f[_0x6666('0x82')]=_0x529240[_0x6666('0x7b')];_0x3c5a9f[_0x6666('0x81')]=_[_0x6666('0x83')](_0x3c5a9f['applications'],[_0x6666('0x84')],['asc']);if(_0x3c5a9f['account'][_0x6666('0x7f')]){delete _0x3c5a9f['account'][_0x6666('0x7f')];}if(_0x3c5a9f['account'][_0x6666('0x7b')]&&_0x3c5a9f[_0x6666('0x80')][_0x6666('0x7b')]['Contacts']['length']){return _0x3c5a9f[_0x6666('0x80')][_0x6666('0x7b')][_0x6666('0x85')][0x0];}var _0x146d2b=_['defaults'](_0x5b4508[_0x6666('0x5f')],{'firstName':_0x5b4508[_0x6666('0x5f')]['from'],'ListId':_0x529240['ListId']});_0x146d2b[_0x5b4508['body'][_0x6666('0x76')]]=_0x5b4508[_0x6666('0x5f')][_0x6666('0x74')];return db['CmContact'][_0x6666('0x57')](_0x146d2b,{'fields':_0x34f4cd,'raw':!![]});}})[_0x6666('0x34')](handleEntityNotFound(_0x5e0d23,null))[_0x6666('0x34')](function(_0x423360){_0x3c5a9f[_0x6666('0x86')]=_0x423360;if(_0x423360){var _0x439feb={'ContactId':_0x423360['id'],'OpenchannelAccountId':_0x5b4508[_0x6666('0x62')]['id'],'from':(_0x423360[_0x6666('0x87')]||'')+'\x20'+(_0x423360['lastName']||'')};var _0x1e8b94={'OpenchannelAccountId':_0x5b4508[_0x6666('0x62')]['id'],'closed':![]};if(_0x5b4508[_0x6666('0x5f')][_0x6666('0x88')]){_0x1e8b94[_0x6666('0x88')]=_0x5b4508['body'][_0x6666('0x88')];return db['OpenchannelInteraction']['find']({'where':_0x1e8b94})[_0x6666('0x34')](function(_0xc77f3e){if(_0xc77f3e){return[_0xc77f3e,![]];}_0x439feb[_0x6666('0x88')]=_0x5b4508['body'][_0x6666('0x88')];_0x439feb[_0x6666('0x89')]=_0x5b4508[_0x6666('0x5f')]['externalUrl'];return db[_0x6666('0x8a')][_0x6666('0x57')](_0x439feb)[_0x6666('0x34')](function(_0x3b5909){return[_0x3b5909,!![]];});});}else{_0x1e8b94['threadId']=null;}_0x1e8b94[_0x6666('0x8b')]=_0x423360['id'];return db[_0x6666('0x8a')][_0x6666('0x56')]({'where':_0x1e8b94})['then'](function(_0xc740b6){if(_0xc740b6){return[_0xc740b6,![]];}return db['OpenchannelInteraction'][_0x6666('0x57')](_0x439feb)[_0x6666('0x34')](function(_0x50e4af){return[_0x50e4af,!![]];});});}})['spread'](function(_0x254650,_0x4aba6a){if(_0x254650){_0x52c8be=_0x4aba6a;if(!_0x4aba6a){var _0x25465a={'from':(_0x3c5a9f[_0x6666('0x86')][_0x6666('0x87')]||'')+'\x20'+(_0x3c5a9f[_0x6666('0x86')]['lastName']||'')};if(_0x5b4508[_0x6666('0x5f')][_0x6666('0x88')]&&_0x5b4508[_0x6666('0x5f')][_0x6666('0x8c')]&&_0x5b4508[_0x6666('0x5f')][_0x6666('0x88')]!=_0x5b4508['body']['messageId']){_0x25465a[_0x6666('0x88')]=_0x5b4508[_0x6666('0x5f')][_0x6666('0x8c')];}return _0x254650[_0x6666('0x2f')](_0x25465a);}else{return _0x254650;}}})[_0x6666('0x34')](function(_0x66634f){_0x3c5a9f['interaction']=_0x66634f[_0x6666('0x30')]({'plain':!![]});_0x3c5a9f[_0x6666('0x8d')]['created']=_0x52c8be;if(_0x3c5a9f['interaction']['created']){if(_0x3c5a9f['account'][_0x6666('0x8e')]){_0x3c5a9f[_0x6666('0x81')][_0x6666('0x8f')]({'id':0x0,'priority':_0x3c5a9f[_0x6666('0x81')][_0x6666('0x44')]+0x1,'app':_0x6666('0x90'),'appdata':_0x6666('0x91'),'interval':_0x6666('0x92')});}}return db[_0x6666('0x93')][_0x6666('0x57')]({'body':_0x5b4508[_0x6666('0x5f')][_0x6666('0x5f')],'OpenchannelAccountId':_0x5b4508[_0x6666('0x62')]['id'],'OpenchannelInteractionId':_0x66634f['id'],'direction':'in','ContactId':_0x3c5a9f['contact']['id'],'AttachmentId':_0x5b4508['body'][_0x6666('0x94')]});})[_0x6666('0x34')](function(_0x20b346){_0x3c5a9f[_0x6666('0x22')]=_0x20b346;if(_0x3c5a9f[_0x6666('0x8d')][_0x6666('0x95')]){return db[_0x6666('0x96')][_0x6666('0x56')]({'attributes':['id',_0x6666('0x37')],'where':{'id':_0x3c5a9f[_0x6666('0x8d')][_0x6666('0x95')]}})[_0x6666('0x34')](function(_0x5b9c73){if(_0x5b9c73){_0x3c5a9f[_0x6666('0x81')][_0x6666('0x97')]({'id':0x0,'priority':0x0,'app':_0x6666('0x98'),'appdata':_0x5b9c73['name']+','+(_0x3c5a9f[_0x6666('0x80')][_0x6666('0x99')]||0xa),'interval':_0x6666('0x92')});_0x3c5a9f['forcedOwnership']=![];}return respondWithRpcPromise(_0x6666('0x9a'),_0x6666('0x9b'),_0x3c5a9f);});}return respondWithRpcPromise(_0x6666('0x9a'),'startRouting',_0x3c5a9f);})[_0x6666('0x34')](function(_0x8d53e){respondWithRpcPromise(_0x6666('0x9c'),_0x6666('0x9c'),{'event':_0x6666('0x6c'),'message':_0x8d53e},client9002);return _0x8d53e;})[_0x6666('0x34')](respondWithResult(_0x5e0d23,null))[_0x6666('0x24')](handleError(_0x5e0d23,null));};exports[_0x6666('0x9d')]=function(_0x196a55,_0x4e70b8){var _0x5be2d3=_0x196a55[_0x6666('0x62')]['id'];var _0x5bc461=_0x196a55[_0x6666('0x5f')];var _0x553d21=0xc8;var _0x1725bb=null;return db[_0x6666('0x9e')][_0x6666('0x9f')]({'isolationLevel':db[_0x6666('0x9e')][_0x6666('0xa0')]['ISOLATION_LEVELS'][_0x6666('0xa1')]},function(_0x3d36fe){return db[_0x6666('0x3c')][_0x6666('0x65')]({'where':{'id':_0x5be2d3},'transaction':_0x3d36fe})['then'](function(_0x34c503){if(_0x34c503){return db[_0x6666('0x7e')][_0x6666('0x33')]({'where':{'OpenchannelAccountId':_0x5be2d3},'transaction':_0x3d36fe})[_0x6666('0x34')](function(){var _0x3dd924=_['map'](_0x5bc461,function(_0x449222){_0x449222[_0x6666('0x63')]=_0x5be2d3;return _0x449222;});return db[_0x6666('0x7e')][_0x6666('0xa2')](_0x3dd924,{'transaction':_0x3d36fe});});}else{_0x553d21=0x194;_0x1725bb=[];}});})[_0x6666('0x34')](function(){if(_0x553d21!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5be2d3},'order':_0x6666('0x84')})['then'](function(_0x1ac5c8){_0x1725bb=_0x1ac5c8;});}})[_0x6666('0x24')](function(_0x451b56){_0x553d21=0x1f4;logger[_0x6666('0x20')](_0x451b56[_0x6666('0x36')]);if(_0x451b56[_0x6666('0x37')]){delete _0x451b56[_0x6666('0x37')];}_0x1725bb=_0x451b56;})[_0x6666('0xa3')](function(){if(_0x1725bb===null){_0x4e70b8[_0x6666('0x25')](_0x553d21);}else{if(_0x553d21===0x1f4){_0x4e70b8[_0x6666('0x2b')](_0x553d21)[_0x6666('0x38')](_0x1725bb);}else{_0x4e70b8[_0x6666('0x2b')](_0x553d21)[_0x6666('0x26')](_0x1725bb);}}});};exports[_0x6666('0xa4')]=function(_0x3ee702,_0x15cfdd,_0x5052e8){var _0x3e5eda={};var _0x16cd70={};var _0x5e26f2;var _0x788845;return db[_0x6666('0x3c')][_0x6666('0x65')]({'where':{'id':_0x3ee702[_0x6666('0x62')]['id']}})['then'](handleEntityNotFound(_0x15cfdd,null))['then'](function(_0x43d9b3){if(_0x43d9b3){_0x5e26f2=_0x43d9b3;_0x16cd70[_0x6666('0x42')]=_[_0x6666('0x3e')](db[_0x6666('0x7e')][_0x6666('0x3d')]);_0x16cd70[_0x6666('0x47')]=_['keys'](_0x3ee702[_0x6666('0x47')]);_0x16cd70[_0x6666('0x3f')]=_['intersection'](_0x16cd70[_0x6666('0x42')],_0x16cd70[_0x6666('0x47')]);_0x3e5eda[_0x6666('0x40')]=_[_0x6666('0x41')](_0x16cd70[_0x6666('0x42')],qs[_0x6666('0x43')](_0x3ee702['query'][_0x6666('0x43')]));_0x3e5eda['attributes']=_0x3e5eda[_0x6666('0x40')][_0x6666('0x44')]?_0x3e5eda['attributes']:_0x16cd70[_0x6666('0x42')];_0x3e5eda[_0x6666('0x66')]=qs[_0x6666('0x48')](_0x3ee702[_0x6666('0x47')][_0x6666('0x48')]);_0x3e5eda['where']=qs[_0x6666('0x3f')](_[_0x6666('0x49')](_0x3ee702[_0x6666('0x47')],_0x16cd70[_0x6666('0x3f')]));if(_0x3ee702[_0x6666('0x47')][_0x6666('0x4e')]){_0x3e5eda[_0x6666('0x4b')]=_[_0x6666('0x4a')](_0x3e5eda['where'],{'$or':_[_0x6666('0x3b')](_0x3e5eda['attributes'],function(_0x1dcf2d){var _0x1f6d39={};_0x1f6d39[_0x1dcf2d]={'$like':'%'+_0x3ee702['query'][_0x6666('0x4e')]+'%'};return _0x1f6d39;})});}_0x3e5eda=_[_0x6666('0x4a')]({},_0x3e5eda,_0x3ee702['options']);return _0x5e26f2[_0x6666('0xa4')](_0x3e5eda);}})[_0x6666('0x34')](function(_0x1ae0bf){if(_0x1ae0bf){_0x788845=_0x1ae0bf[_0x6666('0x44')];if(!_0x3ee702[_0x6666('0x47')][_0x6666('0x45')](_0x6666('0x46'))){_0x3e5eda['limit']=qs[_0x6666('0x28')](_0x3ee702['query'][_0x6666('0x28')]);_0x3e5eda[_0x6666('0x27')]=qs['offset'](_0x3ee702['query'][_0x6666('0x27')]);}return _0x5e26f2[_0x6666('0xa4')](_0x3e5eda);}})[_0x6666('0x34')](function(_0x5d0a0f){if(_0x5d0a0f){return _0x5d0a0f?{'count':_0x788845,'rows':_0x5d0a0f}:null;}})[_0x6666('0x34')](respondWithResult(_0x15cfdd,null))[_0x6666('0x24')](handleError(_0x15cfdd,null));};exports[_0x6666('0xa5')]=function(_0x3f4358,_0x52e21a,_0x133aa6){var _0x554c68={'raw':![],'where':{}};var _0x389879={};var _0x5679e4={'count':0x0,'rows':[]};return db[_0x6666('0x3c')][_0x6666('0x65')]({'where':{'id':_0x3f4358[_0x6666('0x62')]['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x52e21a,null))[_0x6666('0x34')](function(_0x22da03){if(_0x22da03){_0x389879[_0x6666('0x42')]=_['keys'](db[_0x6666('0x8a')][_0x6666('0x3d')]);_0x389879[_0x6666('0x47')]=_['keys'](_0x3f4358['query']);_0x389879[_0x6666('0x3f')]=_[_0x6666('0x41')](_0x389879[_0x6666('0x42')],_0x389879[_0x6666('0x47')]);_0x554c68['attributes']=_[_0x6666('0x41')](_0x389879['model'],qs[_0x6666('0x43')](_0x3f4358[_0x6666('0x47')][_0x6666('0x43')]));_0x554c68['attributes']=_0x554c68[_0x6666('0x40')]['length']?_0x554c68[_0x6666('0x40')]:_0x389879[_0x6666('0x42')];if(!_0x3f4358[_0x6666('0x47')]['hasOwnProperty'](_0x6666('0x46'))){_0x554c68[_0x6666('0x28')]=qs[_0x6666('0x28')](_0x3f4358[_0x6666('0x47')][_0x6666('0x28')]);_0x554c68[_0x6666('0x27')]=qs[_0x6666('0x27')](_0x3f4358[_0x6666('0x47')][_0x6666('0x27')]);}_0x554c68['order']=qs[_0x6666('0x48')](_0x3f4358[_0x6666('0x47')][_0x6666('0x48')]);_0x554c68[_0x6666('0x4b')]=qs[_0x6666('0x3f')](_[_0x6666('0x49')](_0x3f4358[_0x6666('0x47')],_0x389879[_0x6666('0x3f')]));_0x554c68[_0x6666('0x4b')][_0x6666('0x63')]=_0x22da03['id'];if(_0x3f4358[_0x6666('0x47')][_0x6666('0x4e')]){_0x554c68[_0x6666('0x4b')]=_[_0x6666('0x4a')](_0x554c68[_0x6666('0x4b')],{'$or':_[_0x6666('0x3b')](_0x554c68[_0x6666('0x40')],function(_0x39e694){var _0x4d11c3={};_0x4d11c3[_0x39e694]={'$like':'%'+_0x3f4358[_0x6666('0x47')][_0x6666('0x4e')]+'%'};return _0x4d11c3;})});}_0x554c68=_[_0x6666('0x4a')]({},_0x554c68,_0x3f4358[_0x6666('0x4f')]);return db['OpenchannelInteraction'][_0x6666('0x2a')]({'where':_0x554c68['where']})[_0x6666('0x34')](function(_0xf5306d){_0x5679e4['count']=_0xf5306d;if(_0x3f4358[_0x6666('0x47')][_0x6666('0x55')]){_0x554c68[_0x6666('0x50')]=[{'model':db['CmContact'],'as':_0x6666('0xa6'),'required':![]},{'model':db[_0x6666('0x96')],'as':_0x6666('0xa7'),'attributes':['name',_0x6666('0xa8'),_0x6666('0xa9')],'required':![]},{'model':db[_0x6666('0xaa')],'as':_0x6666('0xab'),'attributes':['id',_0x6666('0x37'),_0x6666('0xac')],'where':_0x3f4358[_0x6666('0x47')][_0x6666('0xad')]?{'id':_0x3f4358['query']['tag']}:undefined,'required':_0x3f4358[_0x6666('0x47')]['tag']?!![]:![]}];}return db[_0x6666('0x8a')]['findAll'](_0x554c68);})[_0x6666('0x34')](function(_0x38161a){_0x5679e4[_0x6666('0x52')]=_0x38161a;return _0x5679e4;});}})[_0x6666('0x34')](respondWithFilteredResult(_0x52e21a,_0x554c68))[_0x6666('0x24')](handleError(_0x52e21a,null));};exports['addAgents']=function(_0x11e31e,_0x3e56ea,_0x37d824){return db['OpenchannelAccount']['find']({'where':{'id':_0x11e31e[_0x6666('0x62')]['id']}})['then'](handleEntityNotFound(_0x3e56ea,null))[_0x6666('0x34')](function(_0x34bcae){if(_0x34bcae){return _0x34bcae[_0x6666('0xae')](_0x11e31e[_0x6666('0x5f')][_0x6666('0x68')],_[_0x6666('0xaf')](_0x11e31e[_0x6666('0x5f')],[_0x6666('0x68'),'id'])||{})['spread'](function(_0x4f0c11){for(var _0x2dc7c1=0x0;_0x2dc7c1<_0x11e31e[_0x6666('0x5f')][_0x6666('0x68')]['length'];_0x2dc7c1+=0x1){socket[_0x6666('0xb0')](_0x6666('0xb1'),{'UserId':Number(_0x11e31e[_0x6666('0x5f')]['ids'][_0x2dc7c1]),'OpenchannelAccountId':Number(_0x11e31e['params']['id'])});}return _0x4f0c11;});}})[_0x6666('0x34')](respondWithResult(_0x3e56ea,null))['catch'](handleError(_0x3e56ea,null));};exports[_0x6666('0xb2')]=function(_0x47ce40,_0x496334,_0x557e55){return db['OpenchannelAccount'][_0x6666('0x56')]({'where':{'id':_0x47ce40[_0x6666('0x62')]['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x496334,null))[_0x6666('0x34')](function(_0xcbb84f){if(_0xcbb84f){return _0xcbb84f['removeAgents'](_0x47ce40[_0x6666('0x47')][_0x6666('0x68')])[_0x6666('0x34')](function(){if(_[_0x6666('0xb3')](_0x47ce40['query'][_0x6666('0x68')])){for(var _0x15be86=0x0;_0x15be86<_0x47ce40[_0x6666('0x47')][_0x6666('0x68')][_0x6666('0x44')];_0x15be86+=0x1){socket[_0x6666('0xb0')](_0x6666('0xb4'),{'UserId':Number(_0x47ce40[_0x6666('0x47')][_0x6666('0x68')][_0x15be86]),'OpenchannelAccountId':Number(_0x47ce40[_0x6666('0x62')]['id'])});}}else{socket[_0x6666('0xb0')](_0x6666('0xb4'),{'UserId':Number(_0x47ce40[_0x6666('0x47')]['ids']),'OpenchannelAccountId':Number(_0x47ce40['params']['id'])});}});}})[_0x6666('0x34')](respondWithStatusCode(_0x496334,null))['catch'](handleError(_0x496334,null));};exports[_0x6666('0xb5')]=function(_0x327558,_0x3babfc,_0x32471a){var _0x4b2bfe={};var _0x480cc2={};var _0xf83b04;var _0x436a5c;return db[_0x6666('0x3c')]['findOne']({'where':{'id':_0x327558[_0x6666('0x62')]['id']}})['then'](handleEntityNotFound(_0x3babfc,null))['then'](function(_0x30230d){if(_0x30230d){_0xf83b04=_0x30230d;_0x480cc2[_0x6666('0x42')]=_['keys'](db['User'][_0x6666('0x3d')]);_0x480cc2[_0x6666('0x47')]=_[_0x6666('0x3e')](_0x327558[_0x6666('0x47')]);_0x480cc2[_0x6666('0x3f')]=_[_0x6666('0x41')](_0x480cc2[_0x6666('0x42')],_0x480cc2[_0x6666('0x47')]);_0x4b2bfe['attributes']=_[_0x6666('0x41')](_0x480cc2[_0x6666('0x42')],qs['fields'](_0x327558[_0x6666('0x47')][_0x6666('0x43')]));_0x4b2bfe[_0x6666('0x40')]=_0x4b2bfe[_0x6666('0x40')][_0x6666('0x44')]?_0x4b2bfe[_0x6666('0x40')]:_0x480cc2['model'];_0x4b2bfe[_0x6666('0x66')]=qs[_0x6666('0x48')](_0x327558[_0x6666('0x47')][_0x6666('0x48')]);_0x4b2bfe[_0x6666('0x4b')]=qs[_0x6666('0x3f')](_['pick'](_0x327558[_0x6666('0x47')],_0x480cc2[_0x6666('0x3f')]));if(_0x327558[_0x6666('0x47')]['filter']){_0x4b2bfe[_0x6666('0x4b')]=_[_0x6666('0x4a')](_0x4b2bfe[_0x6666('0x4b')],{'$or':_[_0x6666('0x3b')](_0x4b2bfe['attributes'],function(_0x3aaba4){var _0x404922={};_0x404922[_0x3aaba4]={'$like':'%'+_0x327558[_0x6666('0x47')][_0x6666('0x4e')]+'%'};return _0x404922;})});}_0x4b2bfe=_[_0x6666('0x4a')]({},_0x4b2bfe,_0x327558[_0x6666('0x4f')]);return _0xf83b04['getAgents'](_0x4b2bfe);}})['then'](function(_0x11c0c0){if(_0x11c0c0){_0x436a5c=_0x11c0c0[_0x6666('0x44')];if(!_0x327558[_0x6666('0x47')][_0x6666('0x45')](_0x6666('0x46'))){_0x4b2bfe['limit']=qs['limit'](_0x327558[_0x6666('0x47')][_0x6666('0x28')]);_0x4b2bfe[_0x6666('0x27')]=qs[_0x6666('0x27')](_0x327558[_0x6666('0x47')][_0x6666('0x27')]);}return _0xf83b04[_0x6666('0xb5')](_0x4b2bfe);}})[_0x6666('0x34')](function(_0x4d21fe){if(_0x4d21fe){return _0x4d21fe?{'count':_0x436a5c,'rows':_0x4d21fe}:null;}})[_0x6666('0x34')](respondWithResult(_0x3babfc,null))[_0x6666('0x24')](handleError(_0x3babfc,null));};exports['send']=function(_0x1db2ee,_0x1f5553,_0x51682b){var _0x177fbe,_0x1f6db5,_0x2c1088;if(_[_0x6666('0x73')](_0x1db2ee[_0x6666('0x5f')][_0x6666('0x5f')])||_0x1db2ee[_0x6666('0x5f')]['body']===''){throw new db['Sequelize'][(_0x6666('0x75'))](_0x6666('0xb6'));}if(_[_0x6666('0x73')](_0x1db2ee['body']['to'])){}_0x177fbe=_0x1db2ee['body']['to'];return db[_0x6666('0x3c')][_0x6666('0x65')]({'where':{'id':_0x1db2ee[_0x6666('0x62')]['id']}})[_0x6666('0x34')](handleEntityNotFound(_0x1f5553,null))[_0x6666('0x34')](function(_0x1caf75){if(_0x1caf75){return db['OpenchannelAccount'][_0x6666('0x56')]({'where':{'id':_0x1caf75['id']},'include':[{'model':db['CmList'],'as':_0x6666('0x7b'),'include':[{'model':db[_0x6666('0x6d')],'as':_0x6666('0x85'),'where':{[_0x1caf75[_0x6666('0x76')]]:_0x177fbe},'limit':0x1,'order':[['updatedAt',_0x6666('0x7d')]]}]}]})[_0x6666('0x34')](handleEntityNotFound(_0x1f5553,null))['then'](function(_0x547c0a){if(_0x547c0a&&_0x547c0a[_0x6666('0x7b')]){_0x1f6db5=_0x547c0a[_0x6666('0x30')]({'plain':!![]});if(_0x1f6db5[_0x6666('0x7b')]&&_0x1f6db5[_0x6666('0x7b')]['Contacts'][_0x6666('0x44')]){return _0x1f6db5['List'][_0x6666('0x85')][0x0];}return db[_0x6666('0x6d')][_0x6666('0x57')](_[_0x6666('0xb7')](_0x1db2ee['body'],{'firstName':_0x177fbe,[_0x547c0a[_0x6666('0x76')]]:_0x177fbe,'phone':_0x177fbe,'ListId':_0x1f6db5['ListId']}));}})[_0x6666('0x34')](handleEntityNotFound(_0x1f5553,null))['then'](function(_0x2f5681){if(_0x2f5681){_0x2c1088=_0x2f5681;return db[_0x6666('0x8a')]['find']({'where':{'ContactId':_0x2c1088['id'],'closed':![],'OpenchannelAccountId':_0x1f6db5['id']}})['then'](function(_0x5c7d28){if(_0x5c7d28){return[_0x5c7d28,![]];}return db['OpenchannelInteraction'][_0x6666('0x57')]({'UserId':_0x1db2ee[_0x6666('0x5a')]['id'],'ContactId':_0x2c1088['id'],'OpenchannelAccountId':_0x1f6db5['id'],'lastMsgDirection':_0x6666('0xb8'),'firstMsgDirection':_0x6666('0xb8'),'Messages':[_['merge'](_0x1db2ee[_0x6666('0x5f')],{'read':![],'body':_0x1db2ee[_0x6666('0x5f')][_0x6666('0x5f')],'OpenchannelAccountId':_0x1f6db5['id'],'UserId':_0x1db2ee[_0x6666('0x5a')]['id'],'ContactId':_0x2c1088['id']})]},{'include':[{'model':db[_0x6666('0x93')],'as':_0x6666('0xb9')}]})['then'](function(_0x4cc40d){return[_0x4cc40d,!![]];});});}})[_0x6666('0xba')](function(_0x270f6e,_0x3e5e16){if(_0x3e5e16){return _0x270f6e;}return db[_0x6666('0x93')]['create'](_[_0x6666('0x4a')](_0x1db2ee[_0x6666('0x5f')],{'read':![],'body':_0x1db2ee[_0x6666('0x5f')][_0x6666('0x5f')],'OpenchannelAccountId':_0x1f6db5['id'],'OpenchannelInteractionId':_0x270f6e['id'],'UserId':_0x1db2ee[_0x6666('0x5a')]['id'],'ContactId':_0x2c1088['id']}))['then'](function(_0x228270){_0x270f6e['dataValues'][_0x6666('0xb9')]=[];_0x270f6e[_0x6666('0xbb')][_0x6666('0xb9')][_0x6666('0x8f')](_0x228270['dataValues']);return _0x270f6e;});});}})[_0x6666('0x34')](respondWithResult(_0x1f5553,null))['catch'](handleError(_0x1f5553,null));}; \ No newline at end of file +var _0xe14f=['spread','firstName','contact','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','send','getApplications','getInteractions','Owner','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','OpenchannelAccounts','end','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','model','keys','query','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','rawAttributes','fields','include','create','body','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','findOne','length','order','rows','removeAnswers','notify','openchannel','CmContact','difference','updatedAt','CompanyId','from\x20is\x20mandatory','isNil','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','ListId','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe14f,0xea));var _0xfe14=function(_0x3d4515,_0x1e306f){_0x3d4515=_0x3d4515-0x0;var _0x1777b8=_0xe14f[_0x3d4515];return _0x1777b8;};'use strict';var emlformat=require(_0xfe14('0x0'));var rimraf=require(_0xfe14('0x1'));var zipdir=require(_0xfe14('0x2'));var jsonpatch=require(_0xfe14('0x3'));var rp=require(_0xfe14('0x4'));var moment=require(_0xfe14('0x5'));var BPromise=require(_0xfe14('0x6'));var Mustache=require(_0xfe14('0x7'));var util=require(_0xfe14('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfe14('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe14('0xa'));var _=require(_0xfe14('0xb'));var squel=require(_0xfe14('0xc'));var crypto=require(_0xfe14('0xd'));var jsforce=require(_0xfe14('0xe'));var deskjs=require(_0xfe14('0xf'));var toCsv=require(_0xfe14('0x9'));var querystring=require(_0xfe14('0x10'));var Papa=require(_0xfe14('0x11'));var Redis=require('ioredis');var authService=require(_0xfe14('0x12'));var qs=require(_0xfe14('0x13'));var as=require(_0xfe14('0x14'));var hardwareService=require(_0xfe14('0x15'));var logger=require(_0xfe14('0x16'))(_0xfe14('0x17'));var utils=require('../../config/utils');var config=require(_0xfe14('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe14('0x19'))['db'];config[_0xfe14('0x1a')]=_[_0xfe14('0x1b')](config[_0xfe14('0x1a')],{'host':_0xfe14('0x1c'),'port':0x18eb});var socket=require(_0xfe14('0x1d'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xfe14('0x1e')](socket);var jayson=require(_0xfe14('0x1f'));var client=jayson[_0xfe14('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xfe14('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f3114,_0x1cdd4b,_0x9e74b,_0x3ce60b){return new BPromise(function(_0xd65aed,_0x1dbd36){var _0x2ac71b=_0x3ce60b||client;return _0x2ac71b[_0xfe14('0x21')](_0x3f3114,_0x9e74b)[_0xfe14('0x22')](function(_0x492f88){logger['info'](_0xfe14('0x23'),_0x1cdd4b,_0xfe14('0x24'));logger[_0xfe14('0x25')](_0xfe14('0x26'),_0x1cdd4b,_0xfe14('0x24'),JSON[_0xfe14('0x27')](_0x492f88));if(_0x492f88[_0xfe14('0x28')]){if(_0x492f88[_0xfe14('0x28')]['code']===0x1f4){logger[_0xfe14('0x28')](_0xfe14('0x23'),_0x1cdd4b,_0x492f88[_0xfe14('0x28')][_0xfe14('0x29')]);return _0x1dbd36(_0x492f88[_0xfe14('0x28')]['message']);}logger[_0xfe14('0x28')](_0xfe14('0x23'),_0x1cdd4b,_0x492f88[_0xfe14('0x28')][_0xfe14('0x29')]);return _0xd65aed(_0x492f88[_0xfe14('0x28')]['message']);}else{logger[_0xfe14('0x2a')](_0xfe14('0x23'),_0x1cdd4b,_0xfe14('0x24'));_0xd65aed(_0x492f88[_0xfe14('0x2b')]['message']);}})['catch'](function(_0x12ab29){logger[_0xfe14('0x28')](_0xfe14('0x23'),_0x1cdd4b,_0x12ab29);_0x1dbd36(_0x12ab29);});});}function respondWithStatusCode(_0x335ef9,_0xbd2789){_0xbd2789=_0xbd2789||0xcc;return function(_0x422e9e){if(_0x422e9e){return _0x335ef9[_0xfe14('0x2c')](_0xbd2789);}return _0x335ef9[_0xfe14('0x2d')](_0xbd2789)['end']();};}function respondWithResult(_0x3760f2,_0x733bb9){_0x733bb9=_0x733bb9||0xc8;return function(_0x3895fe){if(_0x3895fe){return _0x3760f2[_0xfe14('0x2d')](_0x733bb9)[_0xfe14('0x2e')](_0x3895fe);}};}function respondWithFilteredResult(_0xce2ec6,_0x6da72a){return function(_0xfa695a){if(_0xfa695a){var _0x1340a3=typeof _0x6da72a['offset']===_0xfe14('0x2f')&&typeof _0x6da72a[_0xfe14('0x30')]==='undefined';var _0x24cd85=_0xfa695a[_0xfe14('0x31')];var _0x368cd6=_0x1340a3?0x0:_0x6da72a[_0xfe14('0x32')];var _0x353f9d=_0x1340a3?_0xfa695a[_0xfe14('0x31')]:_0x6da72a[_0xfe14('0x32')]+_0x6da72a['limit'];var _0x3dfa1b;if(_0x353f9d>=_0x24cd85){_0x353f9d=_0x24cd85;_0x3dfa1b=0xc8;}else{_0x3dfa1b=0xce;}_0xce2ec6[_0xfe14('0x2d')](_0x3dfa1b);return _0xce2ec6[_0xfe14('0x33')](_0xfe14('0x34'),_0x368cd6+'-'+_0x353f9d+'/'+_0x24cd85)[_0xfe14('0x2e')](_0xfa695a);}return null;};}function patchUpdates(_0x32a09a){return function(_0x4d32e3){try{jsonpatch['apply'](_0x4d32e3,_0x32a09a,!![]);}catch(_0x142747){return BPromise['reject'](_0x142747);}return _0x4d32e3['save']();};}function saveUpdates(_0x2d6480,_0x36c0f8){return function(_0x295acf){if(_0x295acf){return _0x295acf[_0xfe14('0x35')](_0x2d6480)[_0xfe14('0x22')](function(_0x1d4336){return _0x1d4336;});}return null;};}function removeEntity(_0x41c1ee,_0x5359c4){return function(_0x4f81d2){if(_0x4f81d2){return _0x4f81d2[_0xfe14('0x36')]()[_0xfe14('0x22')](function(){var _0x110c45=_0x4f81d2[_0xfe14('0x37')]({'plain':!![]});var _0x200793=_0xfe14('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x200793,'resourceId':_0x110c45['id']}})[_0xfe14('0x22')](function(){return _0x4f81d2;});})['then'](function(){_0x41c1ee['status'](0xcc)[_0xfe14('0x39')]();});}};}function handleEntityNotFound(_0x26a534,_0x42a90e){return function(_0x147edf){if(!_0x147edf){_0x26a534[_0xfe14('0x2c')](0x194);}return _0x147edf;};}function handleError(_0x4f44dc,_0x13538b){_0x13538b=_0x13538b||0x1f4;return function(_0x24ffa9){logger['error'](_0x24ffa9[_0xfe14('0x3a')]);if(_0x24ffa9[_0xfe14('0x3b')]){delete _0x24ffa9[_0xfe14('0x3b')];}_0x4f44dc['status'](_0x13538b)['send'](_0x24ffa9);};}exports[_0xfe14('0x3c')]=function(_0xf8150e,_0x31493d){var _0x11f299={'include':[{'model':db[_0xfe14('0x3d')],'as':_0xfe14('0x3e')}]},_0x347cc8={},_0x28e8a7={'count':0x0,'rows':[]};var _0x31f74e=_[_0xfe14('0x3f')](db[_0xfe14('0x40')]['rawAttributes'],function(_0x50ab6c){return{'name':_0x50ab6c['fieldName'],'type':_0x50ab6c[_0xfe14('0x41')]['key']};});_0x347cc8[_0xfe14('0x42')]=_[_0xfe14('0x3f')](_0x31f74e,_0xfe14('0x3b'));_0x347cc8['query']=_[_0xfe14('0x43')](_0xf8150e[_0xfe14('0x44')]);_0x347cc8[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x347cc8[_0xfe14('0x42')],_0x347cc8['query']);_0x11f299[_0xfe14('0x47')]=_[_0xfe14('0x46')](_0x347cc8[_0xfe14('0x42')],qs['fields'](_0xf8150e['query']['fields']));_0x11f299[_0xfe14('0x47')]=_0x11f299[_0xfe14('0x47')]['length']?_0x11f299[_0xfe14('0x47')]:_0x347cc8['model'];if(!_0xf8150e[_0xfe14('0x44')]['hasOwnProperty'](_0xfe14('0x48'))){_0x11f299['limit']=qs[_0xfe14('0x30')](_0xf8150e[_0xfe14('0x44')][_0xfe14('0x30')]);_0x11f299[_0xfe14('0x32')]=qs[_0xfe14('0x32')](_0xf8150e[_0xfe14('0x44')][_0xfe14('0x32')]);}_0x11f299['order']=qs[_0xfe14('0x49')](_0xf8150e[_0xfe14('0x44')]['sort']);_0x11f299[_0xfe14('0x4a')]=qs[_0xfe14('0x45')](_[_0xfe14('0x4b')](_0xf8150e[_0xfe14('0x44')],_0x347cc8['filters']),_0x31f74e);if(_0xf8150e['query'][_0xfe14('0x4c')]){_0x11f299[_0xfe14('0x4a')]=_[_0xfe14('0x4d')](_0x11f299['where'],{'$or':_[_0xfe14('0x3f')](_0x31f74e,function(_0x4e3b47){if(_0x4e3b47[_0xfe14('0x41')]!==_0xfe14('0x4e')){var _0x38a964={};_0x38a964[_0x4e3b47[_0xfe14('0x3b')]]={'$like':'%'+_0xf8150e[_0xfe14('0x44')]['filter']+'%'};return _0x38a964;}})});}_0x11f299=_[_0xfe14('0x4d')]({},_0x11f299,_0xf8150e[_0xfe14('0x4f')]);var _0x5e4ae6={'where':_0x11f299[_0xfe14('0x4a')]};return db[_0xfe14('0x40')]['count'](_0x5e4ae6)[_0xfe14('0x22')](function(_0x51a155){_0x28e8a7[_0xfe14('0x31')]=_0x51a155;if(_0xf8150e['query'][_0xfe14('0x50')]){_0x11f299['include']=[{'all':!![]}];}return db[_0xfe14('0x40')]['findAll'](_0x11f299);})['then'](function(_0xfd6398){_0x28e8a7['rows']=_0xfd6398;return _0x28e8a7;})[_0xfe14('0x22')](respondWithFilteredResult(_0x31493d,_0x11f299))[_0xfe14('0x51')](handleError(_0x31493d,null));};exports[_0xfe14('0x52')]=function(_0x5737f6,_0x98b6ae){var _0x4f23b8={'raw':![],'where':{'id':_0x5737f6['params']['id']},'include':[{'model':db[_0xfe14('0x3d')],'as':_0xfe14('0x3e')}]},_0x5e6fa9={};_0x5e6fa9['model']=_[_0xfe14('0x43')](db['OpenchannelAccount'][_0xfe14('0x53')]);_0x5e6fa9[_0xfe14('0x44')]=_['keys'](_0x5737f6[_0xfe14('0x44')]);_0x5e6fa9[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x5e6fa9[_0xfe14('0x42')],_0x5e6fa9[_0xfe14('0x44')]);_0x4f23b8['attributes']=_[_0xfe14('0x46')](_0x5e6fa9[_0xfe14('0x42')],qs[_0xfe14('0x54')](_0x5737f6[_0xfe14('0x44')]['fields']));_0x4f23b8[_0xfe14('0x47')]=_0x4f23b8[_0xfe14('0x47')]['length']?_0x4f23b8[_0xfe14('0x47')]:_0x5e6fa9[_0xfe14('0x42')];if(_0x5737f6[_0xfe14('0x44')][_0xfe14('0x50')]){_0x4f23b8[_0xfe14('0x55')]=[{'all':!![]}];}_0x4f23b8=_[_0xfe14('0x4d')]({},_0x4f23b8,_0x5737f6['options']);return db[_0xfe14('0x40')]['find'](_0x4f23b8)[_0xfe14('0x22')](handleEntityNotFound(_0x98b6ae,null))[_0xfe14('0x22')](respondWithResult(_0x98b6ae,null))[_0xfe14('0x51')](handleError(_0x98b6ae,null));};exports[_0xfe14('0x56')]=function(_0x19faba,_0x5f3a0e){return db['OpenchannelAccount']['create'](_0x19faba[_0xfe14('0x57')],{})[_0xfe14('0x22')](function(_0x60ae04){var _0x500cbd=_0x19faba['user'][_0xfe14('0x37')]({'plain':!![]});if(!_0x500cbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x500cbd[_0xfe14('0x58')]===_0xfe14('0x59')){var _0x3a66d1=_0x60ae04['get']({'plain':!![]});var _0x41e70c=_0xfe14('0x38');return db[_0xfe14('0x5a')][_0xfe14('0x5b')]({'where':{'name':_0x41e70c,'userProfileId':_0x500cbd[_0xfe14('0x5c')]},'raw':!![]})[_0xfe14('0x22')](function(_0x1973a4){if(_0x1973a4&&_0x1973a4['autoAssociation']===0x0){return db[_0xfe14('0x5d')][_0xfe14('0x56')]({'name':_0x3a66d1['name'],'resourceId':_0x3a66d1['id'],'type':_0x1973a4[_0xfe14('0x3b')],'sectionId':_0x1973a4['id']},{})[_0xfe14('0x22')](function(){return _0x60ae04;});}else{return _0x60ae04;}})['catch'](function(_0x4de11b){logger[_0xfe14('0x28')](_0xfe14('0x5e'),_0x4de11b);throw _0x4de11b;});}return _0x60ae04;})['then'](respondWithResult(_0x5f3a0e,0xc9))[_0xfe14('0x51')](handleError(_0x5f3a0e,null));};exports['update']=function(_0xcd7ab1,_0x405538){if(_0xcd7ab1[_0xfe14('0x57')]['id']){delete _0xcd7ab1['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xcd7ab1[_0xfe14('0x5f')]['id']},'include':[{'model':db[_0xfe14('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xfe14('0x22')](handleEntityNotFound(_0x405538,null))['then'](saveUpdates(_0xcd7ab1[_0xfe14('0x57')],null))[_0xfe14('0x22')](respondWithResult(_0x405538,null))[_0xfe14('0x51')](handleError(_0x405538,null));};exports[_0xfe14('0x36')]=function(_0x3e2569,_0x1100e2){return db['OpenchannelAccount'][_0xfe14('0x5b')]({'where':{'id':_0x3e2569[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x1100e2,null))['then'](removeEntity(_0x1100e2,null))[_0xfe14('0x51')](handleError(_0x1100e2,null));};exports[_0xfe14('0x60')]=function(_0x523e66,_0x4613c1){return db[_0xfe14('0x40')][_0xfe14('0x60')]()['then'](respondWithResult(_0x4613c1,null))[_0xfe14('0x51')](handleError(_0x4613c1,null));};exports[_0xfe14('0x61')]=function(_0x1c7132,_0x5df233,_0x488d89){if(_0x1c7132[_0xfe14('0x57')]['id']){delete _0x1c7132[_0xfe14('0x57')]['id'];}return db['OpenchannelAccount'][_0xfe14('0x5b')]({'where':{'id':_0x1c7132[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x5df233,null))['then'](function(_0x46b603){if(_0x46b603){_0x1c7132[_0xfe14('0x57')][_0xfe14('0x62')]=_0x46b603['id'];return db[_0xfe14('0x63')][_0xfe14('0x56')](_0x1c7132[_0xfe14('0x57')]);}})['then'](respondWithResult(_0x5df233,null))[_0xfe14('0x51')](handleError(_0x5df233,null));};exports[_0xfe14('0x64')]=function(_0x2bd21b,_0x32efc7,_0x21a156){var _0x30211b={'raw':![],'where':{}};var _0x449b25={};var _0x5272bc={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2bd21b[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x32efc7,null))['then'](function(_0x2c6111){if(_0x2c6111){_0x449b25[_0xfe14('0x42')]=_[_0xfe14('0x43')](db['Disposition'][_0xfe14('0x53')]);_0x449b25[_0xfe14('0x44')]=_[_0xfe14('0x43')](_0x2bd21b[_0xfe14('0x44')]);_0x449b25[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x449b25[_0xfe14('0x42')],_0x449b25['query']);_0x30211b[_0xfe14('0x47')]=_['intersection'](_0x449b25[_0xfe14('0x42')],qs[_0xfe14('0x54')](_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x54')]));_0x30211b['attributes']=_0x30211b[_0xfe14('0x47')]['length']?_0x30211b[_0xfe14('0x47')]:_0x449b25['model'];if(!_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x65')](_0xfe14('0x48'))){_0x30211b[_0xfe14('0x30')]=qs['limit'](_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x30')]);_0x30211b['offset']=qs[_0xfe14('0x32')](_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x32')]);}_0x30211b['order']=qs[_0xfe14('0x49')](_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x49')]);_0x30211b[_0xfe14('0x4a')]=qs[_0xfe14('0x45')](_[_0xfe14('0x4b')](_0x2bd21b[_0xfe14('0x44')],_0x449b25['filters']));_0x30211b[_0xfe14('0x4a')]['OpenchannelAccountId']=_0x2c6111['id'];if(_0x2bd21b[_0xfe14('0x44')][_0xfe14('0x4c')]){_0x30211b[_0xfe14('0x4a')]=_['merge'](_0x30211b[_0xfe14('0x4a')],{'$or':_[_0xfe14('0x3f')](_0x30211b[_0xfe14('0x47')],function(_0x49792a){var _0x33a554={};_0x33a554[_0x49792a]={'$like':'%'+_0x2bd21b['query'][_0xfe14('0x4c')]+'%'};return _0x33a554;})});}_0x30211b=_[_0xfe14('0x4d')]({},_0x30211b,_0x2bd21b[_0xfe14('0x4f')]);return db[_0xfe14('0x63')][_0xfe14('0x31')]({'where':_0x30211b[_0xfe14('0x4a')]})[_0xfe14('0x22')](function(_0x4ff535){_0x5272bc['count']=_0x4ff535;if(_0x2bd21b[_0xfe14('0x44')]['includeAll']){_0x30211b[_0xfe14('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xfe14('0x66')](_0x30211b);})['then'](function(_0x39343e){_0x5272bc['rows']=_0x39343e;return _0x5272bc;});}})[_0xfe14('0x22')](respondWithFilteredResult(_0x32efc7,_0x30211b))[_0xfe14('0x51')](handleError(_0x32efc7,null));};exports[_0xfe14('0x67')]=function(_0x1a306e,_0x4ee094,_0x20ea66){return db[_0xfe14('0x40')][_0xfe14('0x5b')]({'where':{'id':_0x1a306e[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x4ee094,null))[_0xfe14('0x22')](function(_0x226de9){if(_0x226de9){return _0x226de9[_0xfe14('0x67')](_0x1a306e['query'][_0xfe14('0x68')]);}})['then'](respondWithStatusCode(_0x4ee094,null))[_0xfe14('0x51')](handleError(_0x4ee094,null));};exports['addAnswer']=function(_0x35dc4c,_0x1cb224,_0x1c9406){if(_0x35dc4c['body']['id']){delete _0x35dc4c[_0xfe14('0x57')]['id'];}return db[_0xfe14('0x40')][_0xfe14('0x5b')]({'where':{'id':_0x35dc4c[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x1cb224,null))['then'](function(_0x43049d){if(_0x43049d){_0x35dc4c['body'][_0xfe14('0x62')]=_0x43049d['id'];return db[_0xfe14('0x69')][_0xfe14('0x56')](_0x35dc4c['body']);}})[_0xfe14('0x22')](respondWithResult(_0x1cb224,null))[_0xfe14('0x51')](handleError(_0x1cb224,null));};exports['getAnswers']=function(_0x3c930e,_0x253fd5,_0x6b1a8a){var _0x18e38d={'raw':![],'where':{}};var _0x27e998={};var _0x873a8a={'count':0x0,'rows':[]};return db[_0xfe14('0x40')][_0xfe14('0x6a')]({'where':{'id':_0x3c930e[_0xfe14('0x5f')]['id']}})['then'](handleEntityNotFound(_0x253fd5,null))[_0xfe14('0x22')](function(_0x2298c8){if(_0x2298c8){_0x27e998['model']=_[_0xfe14('0x43')](db['CannedAnswer'][_0xfe14('0x53')]);_0x27e998['query']=_['keys'](_0x3c930e[_0xfe14('0x44')]);_0x27e998[_0xfe14('0x45')]=_['intersection'](_0x27e998[_0xfe14('0x42')],_0x27e998['query']);_0x18e38d['attributes']=_[_0xfe14('0x46')](_0x27e998['model'],qs[_0xfe14('0x54')](_0x3c930e[_0xfe14('0x44')][_0xfe14('0x54')]));_0x18e38d[_0xfe14('0x47')]=_0x18e38d[_0xfe14('0x47')][_0xfe14('0x6b')]?_0x18e38d['attributes']:_0x27e998[_0xfe14('0x42')];if(!_0x3c930e[_0xfe14('0x44')][_0xfe14('0x65')](_0xfe14('0x48'))){_0x18e38d[_0xfe14('0x30')]=qs[_0xfe14('0x30')](_0x3c930e[_0xfe14('0x44')]['limit']);_0x18e38d[_0xfe14('0x32')]=qs['offset'](_0x3c930e['query'][_0xfe14('0x32')]);}_0x18e38d[_0xfe14('0x6c')]=qs[_0xfe14('0x49')](_0x3c930e['query'][_0xfe14('0x49')]);_0x18e38d[_0xfe14('0x4a')]=qs[_0xfe14('0x45')](_['pick'](_0x3c930e[_0xfe14('0x44')],_0x27e998[_0xfe14('0x45')]));_0x18e38d[_0xfe14('0x4a')][_0xfe14('0x62')]=_0x2298c8['id'];if(_0x3c930e[_0xfe14('0x44')][_0xfe14('0x4c')]){_0x18e38d[_0xfe14('0x4a')]=_['merge'](_0x18e38d[_0xfe14('0x4a')],{'$or':_[_0xfe14('0x3f')](_0x18e38d[_0xfe14('0x47')],function(_0x293995){var _0x53bf0e={};_0x53bf0e[_0x293995]={'$like':'%'+_0x3c930e[_0xfe14('0x44')][_0xfe14('0x4c')]+'%'};return _0x53bf0e;})});}_0x18e38d=_['merge']({},_0x18e38d,_0x3c930e['options']);return db[_0xfe14('0x69')][_0xfe14('0x31')]({'where':_0x18e38d[_0xfe14('0x4a')]})['then'](function(_0x5f4280){_0x873a8a[_0xfe14('0x31')]=_0x5f4280;if(_0x3c930e[_0xfe14('0x44')][_0xfe14('0x50')]){_0x18e38d[_0xfe14('0x55')]=[{'all':!![]}];}return db[_0xfe14('0x69')][_0xfe14('0x66')](_0x18e38d);})[_0xfe14('0x22')](function(_0x308781){_0x873a8a[_0xfe14('0x6d')]=_0x308781;return _0x873a8a;});}})[_0xfe14('0x22')](respondWithFilteredResult(_0x253fd5,_0x18e38d))[_0xfe14('0x51')](handleError(_0x253fd5,null));};exports['removeAnswers']=function(_0x19299a,_0x39e9aa,_0x4d0eeb){return db[_0xfe14('0x40')][_0xfe14('0x5b')]({'where':{'id':_0x19299a[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x39e9aa,null))[_0xfe14('0x22')](function(_0x550824){if(_0x550824){return _0x550824[_0xfe14('0x6e')](_0x19299a['query']['ids']);}})[_0xfe14('0x22')](respondWithStatusCode(_0x39e9aa,null))[_0xfe14('0x51')](handleError(_0x39e9aa,null));};exports[_0xfe14('0x6f')]=function(_0x435008,_0x5247c3,_0x57d0aa){var _0x1e9889={'body':_0x435008[_0xfe14('0x57')],'channel':_0xfe14('0x70')};var _0x4d7511=[];var _0x266237=[];var _0x437307={};var _0x29e3c3=![];return db[_0xfe14('0x71')][_0xfe14('0x60')]()['then'](function(_0x385b72){if(!_0x385b72){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4d7511=_[_0xfe14('0x72')](_['keys'](_0x385b72),['createdAt',_0xfe14('0x73')]);_0x266237=_[_0xfe14('0x72')](_[_0xfe14('0x43')](_0x385b72),['createdAt',_0xfe14('0x73'),_0xfe14('0x74'),'ListId']);if(_0x435008[_0xfe14('0x57')]['id']){delete _0x435008[_0xfe14('0x57')]['id'];}if(_['isNil'](_0x435008[_0xfe14('0x57')]['from'])){throw new db['Sequelize']['ValidationError'](_0xfe14('0x75'));}if(_[_0xfe14('0x76')](_0x435008['body'][_0xfe14('0x57')])||_0x435008['body'][_0xfe14('0x57')]===''){throw new db[(_0xfe14('0x77'))][(_0xfe14('0x78'))](_0xfe14('0x79'));}if(_[_0xfe14('0x76')](_0x435008[_0xfe14('0x57')]['mapKey'])){throw new db[(_0xfe14('0x77'))]['ValidationError'](_0xfe14('0x7a')+_0x266237);}if(!_[_0xfe14('0x7b')](_0x266237,_0x435008['body']['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x266237);}_0x437307[_0x435008[_0xfe14('0x57')][_0xfe14('0x7c')]]=_0x435008[_0xfe14('0x57')][_0xfe14('0x7d')];})[_0xfe14('0x22')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x435008[_0xfe14('0x5f')]['id']},'include':[{'model':db[_0xfe14('0x7e')],'as':_0xfe14('0x7f'),'include':[{'model':db[_0xfe14('0x71')],'as':_0xfe14('0x80'),'where':_0x437307,'limit':0x1,'order':[[_0xfe14('0x73'),_0xfe14('0x81')]]}]},{'model':db[_0xfe14('0x82')],'as':_0xfe14('0x83')}]});})[_0xfe14('0x22')](handleEntityNotFound(_0x5247c3,null))[_0xfe14('0x22')](function(_0x120cd4){if(_0x120cd4&&_0x120cd4[_0xfe14('0x7f')]){_0x1e9889['account']=_0x120cd4;_0x1e9889[_0xfe14('0x84')]=_0x120cd4['Applications'];_0x1e9889[_0xfe14('0x85')]=_0x120cd4['List'];_0x1e9889[_0xfe14('0x84')]=_[_0xfe14('0x86')](_0x1e9889['applications'],[_0xfe14('0x87')],[_0xfe14('0x88')]);if(_0x1e9889[_0xfe14('0x89')][_0xfe14('0x83')]){delete _0x1e9889[_0xfe14('0x89')]['Applications'];}if(_0x1e9889[_0xfe14('0x89')][_0xfe14('0x7f')]&&_0x1e9889['account']['List']['Contacts'][_0xfe14('0x6b')]){return _0x1e9889[_0xfe14('0x89')][_0xfe14('0x7f')][_0xfe14('0x80')][0x0];}var _0x2318a7=_['defaults'](_0x435008[_0xfe14('0x57')],{'firstName':_0x435008['body'][_0xfe14('0x7d')],'ListId':_0x120cd4[_0xfe14('0x8a')]});_0x2318a7[_0x435008[_0xfe14('0x57')][_0xfe14('0x7c')]]=_0x435008[_0xfe14('0x57')]['from'];return db[_0xfe14('0x71')][_0xfe14('0x56')](_0x2318a7,{'fields':_0x4d7511,'raw':!![]});}})['then'](handleEntityNotFound(_0x5247c3,null))[_0xfe14('0x22')](function(_0x492427){_0x1e9889['contact']=_0x492427;if(_0x492427){var _0x2a82f5={'ContactId':_0x492427['id'],'OpenchannelAccountId':_0x435008[_0xfe14('0x5f')]['id'],'from':(_0x492427['firstName']||'')+'\x20'+(_0x492427[_0xfe14('0x8b')]||'')};var _0x24041b={'OpenchannelAccountId':_0x435008[_0xfe14('0x5f')]['id'],'closed':![]};if(_0x435008[_0xfe14('0x57')]['threadId']){_0x24041b['threadId']=_0x435008[_0xfe14('0x57')][_0xfe14('0x8c')];return db['OpenchannelInteraction'][_0xfe14('0x5b')]({'where':_0x24041b})[_0xfe14('0x22')](function(_0x33098c){if(_0x33098c){return[_0x33098c,![]];}_0x2a82f5[_0xfe14('0x8c')]=_0x435008[_0xfe14('0x57')][_0xfe14('0x8c')];_0x2a82f5[_0xfe14('0x8d')]=_0x435008['body']['externalUrl'];return db[_0xfe14('0x8e')]['create'](_0x2a82f5)[_0xfe14('0x22')](function(_0x5d98ac){return[_0x5d98ac,!![]];});});}else{_0x24041b['threadId']=null;}_0x24041b[_0xfe14('0x8f')]=_0x492427['id'];return db[_0xfe14('0x8e')][_0xfe14('0x5b')]({'where':_0x24041b})[_0xfe14('0x22')](function(_0x53bafa){if(_0x53bafa){return[_0x53bafa,![]];}return db[_0xfe14('0x8e')]['create'](_0x2a82f5)[_0xfe14('0x22')](function(_0x1276af){return[_0x1276af,!![]];});});}})[_0xfe14('0x90')](function(_0x1216bf,_0x5dfb04){if(_0x1216bf){_0x29e3c3=_0x5dfb04;if(!_0x5dfb04){var _0x2bfdab={'from':(_0x1e9889['contact'][_0xfe14('0x91')]||'')+'\x20'+(_0x1e9889[_0xfe14('0x92')][_0xfe14('0x8b')]||'')};if(_0x435008[_0xfe14('0x57')][_0xfe14('0x8c')]&&_0x435008[_0xfe14('0x57')][_0xfe14('0x93')]&&_0x435008[_0xfe14('0x57')]['threadId']!=_0x435008['body'][_0xfe14('0x93')]){_0x2bfdab['threadId']=_0x435008[_0xfe14('0x57')]['messageId'];}return _0x1216bf[_0xfe14('0x35')](_0x2bfdab);}else{return _0x1216bf;}}})[_0xfe14('0x22')](function(_0x4015d6){_0x1e9889[_0xfe14('0x94')]=_0x4015d6[_0xfe14('0x37')]({'plain':!![]});_0x1e9889['interaction'][_0xfe14('0x95')]=_0x29e3c3;if(_0x1e9889[_0xfe14('0x94')][_0xfe14('0x95')]){if(_0x1e9889[_0xfe14('0x89')][_0xfe14('0x96')]){_0x1e9889[_0xfe14('0x84')]['push']({'id':0x0,'priority':_0x1e9889[_0xfe14('0x84')][_0xfe14('0x6b')]+0x1,'app':_0xfe14('0x97'),'appdata':'unmanaged','interval':_0xfe14('0x98')});}}return db[_0xfe14('0x99')][_0xfe14('0x56')]({'body':_0x435008['body'][_0xfe14('0x57')],'OpenchannelAccountId':_0x435008[_0xfe14('0x5f')]['id'],'OpenchannelInteractionId':_0x4015d6['id'],'direction':'in','ContactId':_0x1e9889[_0xfe14('0x92')]['id'],'AttachmentId':_0x435008['body'][_0xfe14('0x9a')]});})[_0xfe14('0x22')](function(_0x2ab942){_0x1e9889['message']=_0x2ab942;if(_0x1e9889['interaction'][_0xfe14('0x9b')]){return db[_0xfe14('0x9c')][_0xfe14('0x5b')]({'attributes':['id',_0xfe14('0x3b')],'where':{'id':_0x1e9889[_0xfe14('0x94')]['UserId']}})[_0xfe14('0x22')](function(_0x39d1b3){if(_0x39d1b3){_0x1e9889[_0xfe14('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x39d1b3[_0xfe14('0x3b')]+','+(_0x1e9889[_0xfe14('0x89')][_0xfe14('0x9d')]||0xa),'interval':_0xfe14('0x98')});_0x1e9889[_0xfe14('0x9e')]=![];}return respondWithRpcPromise(_0xfe14('0x9f'),_0xfe14('0xa0'),_0x1e9889);});}return respondWithRpcPromise(_0xfe14('0x9f'),_0xfe14('0xa0'),_0x1e9889);})[_0xfe14('0x22')](function(_0x47a5f5){respondWithRpcPromise(_0xfe14('0xa1'),'EventManager',{'event':_0xfe14('0x6f'),'message':_0x47a5f5},client9002);return _0x47a5f5;})[_0xfe14('0x22')](respondWithResult(_0x5247c3,null))[_0xfe14('0x51')](handleError(_0x5247c3,null));};exports[_0xfe14('0xa2')]=function(_0x3437e6,_0x526aae){var _0x434ff8=_0x3437e6[_0xfe14('0x5f')]['id'];var _0x962873=_0x3437e6['body'];var _0x4853fe=0xc8;var _0x3e60b9=null;return db[_0xfe14('0xa3')][_0xfe14('0xa4')]({'isolationLevel':db[_0xfe14('0xa3')][_0xfe14('0xa5')]['ISOLATION_LEVELS'][_0xfe14('0xa6')]},function(_0x3ea0bd){return db[_0xfe14('0x40')][_0xfe14('0x6a')]({'where':{'id':_0x434ff8},'transaction':_0x3ea0bd})[_0xfe14('0x22')](function(_0x56ff59){if(_0x56ff59){return db[_0xfe14('0x82')]['destroy']({'where':{'OpenchannelAccountId':_0x434ff8},'transaction':_0x3ea0bd})[_0xfe14('0x22')](function(){var _0x356df2=_[_0xfe14('0x3f')](_0x962873,function(_0x3a1b0e){_0x3a1b0e[_0xfe14('0x62')]=_0x434ff8;return _0x3a1b0e;});return db[_0xfe14('0x82')]['bulkCreate'](_0x356df2,{'transaction':_0x3ea0bd});});}else{_0x4853fe=0x194;_0x3e60b9=[];}});})[_0xfe14('0x22')](function(){if(_0x4853fe!==0x194){return db[_0xfe14('0x82')][_0xfe14('0xa7')]({'where':{'OpenchannelAccountId':_0x434ff8},'order':'priority'})[_0xfe14('0x22')](function(_0x39f8f3){_0x3e60b9=_0x39f8f3;});}})[_0xfe14('0x51')](function(_0x1042b0){_0x4853fe=0x1f4;logger['error'](_0x1042b0[_0xfe14('0x3a')]);if(_0x1042b0[_0xfe14('0x3b')]){delete _0x1042b0[_0xfe14('0x3b')];}_0x3e60b9=_0x1042b0;})[_0xfe14('0xa8')](function(){if(_0x3e60b9===null){_0x526aae[_0xfe14('0x2c')](_0x4853fe);}else{if(_0x4853fe===0x1f4){_0x526aae[_0xfe14('0x2d')](_0x4853fe)[_0xfe14('0xa9')](_0x3e60b9);}else{_0x526aae[_0xfe14('0x2d')](_0x4853fe)['json'](_0x3e60b9);}}});};exports['getApplications']=function(_0x4a3980,_0x42d5a8,_0x249a3a){var _0x4449df={};var _0x48691f={};var _0x1137fc;var _0x23be7e;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4a3980[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x42d5a8,null))[_0xfe14('0x22')](function(_0x24ef84){if(_0x24ef84){_0x1137fc=_0x24ef84;_0x48691f['model']=_[_0xfe14('0x43')](db[_0xfe14('0x82')][_0xfe14('0x53')]);_0x48691f[_0xfe14('0x44')]=_[_0xfe14('0x43')](_0x4a3980[_0xfe14('0x44')]);_0x48691f[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x48691f[_0xfe14('0x42')],_0x48691f[_0xfe14('0x44')]);_0x4449df[_0xfe14('0x47')]=_[_0xfe14('0x46')](_0x48691f[_0xfe14('0x42')],qs[_0xfe14('0x54')](_0x4a3980[_0xfe14('0x44')][_0xfe14('0x54')]));_0x4449df['attributes']=_0x4449df['attributes'][_0xfe14('0x6b')]?_0x4449df[_0xfe14('0x47')]:_0x48691f[_0xfe14('0x42')];_0x4449df[_0xfe14('0x6c')]=qs[_0xfe14('0x49')](_0x4a3980[_0xfe14('0x44')][_0xfe14('0x49')]);_0x4449df[_0xfe14('0x4a')]=qs[_0xfe14('0x45')](_[_0xfe14('0x4b')](_0x4a3980[_0xfe14('0x44')],_0x48691f[_0xfe14('0x45')]));if(_0x4a3980[_0xfe14('0x44')][_0xfe14('0x4c')]){_0x4449df[_0xfe14('0x4a')]=_[_0xfe14('0x4d')](_0x4449df[_0xfe14('0x4a')],{'$or':_[_0xfe14('0x3f')](_0x4449df[_0xfe14('0x47')],function(_0x14a279){var _0x5ab111={};_0x5ab111[_0x14a279]={'$like':'%'+_0x4a3980[_0xfe14('0x44')][_0xfe14('0x4c')]+'%'};return _0x5ab111;})});}_0x4449df=_[_0xfe14('0x4d')]({},_0x4449df,_0x4a3980[_0xfe14('0x4f')]);return _0x1137fc[_0xfe14('0xaa')](_0x4449df);}})[_0xfe14('0x22')](function(_0x281b91){if(_0x281b91){_0x23be7e=_0x281b91[_0xfe14('0x6b')];if(!_0x4a3980['query'][_0xfe14('0x65')](_0xfe14('0x48'))){_0x4449df[_0xfe14('0x30')]=qs[_0xfe14('0x30')](_0x4a3980[_0xfe14('0x44')][_0xfe14('0x30')]);_0x4449df['offset']=qs[_0xfe14('0x32')](_0x4a3980[_0xfe14('0x44')][_0xfe14('0x32')]);}return _0x1137fc['getApplications'](_0x4449df);}})[_0xfe14('0x22')](function(_0x3e1615){if(_0x3e1615){return _0x3e1615?{'count':_0x23be7e,'rows':_0x3e1615}:null;}})[_0xfe14('0x22')](respondWithResult(_0x42d5a8,null))[_0xfe14('0x51')](handleError(_0x42d5a8,null));};exports[_0xfe14('0xab')]=function(_0x495e5c,_0x59104a,_0x597e1f){var _0x44544a={'raw':![],'where':{}};var _0x496add={};var _0x4a111b={'count':0x0,'rows':[]};return db[_0xfe14('0x40')][_0xfe14('0x6a')]({'where':{'id':_0x495e5c[_0xfe14('0x5f')]['id']}})['then'](handleEntityNotFound(_0x59104a,null))['then'](function(_0x461b47){if(_0x461b47){_0x496add[_0xfe14('0x42')]=_[_0xfe14('0x43')](db['OpenchannelInteraction']['rawAttributes']);_0x496add[_0xfe14('0x44')]=_[_0xfe14('0x43')](_0x495e5c[_0xfe14('0x44')]);_0x496add[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x496add[_0xfe14('0x42')],_0x496add['query']);_0x44544a[_0xfe14('0x47')]=_[_0xfe14('0x46')](_0x496add[_0xfe14('0x42')],qs['fields'](_0x495e5c['query'][_0xfe14('0x54')]));_0x44544a['attributes']=_0x44544a['attributes'][_0xfe14('0x6b')]?_0x44544a[_0xfe14('0x47')]:_0x496add[_0xfe14('0x42')];if(!_0x495e5c[_0xfe14('0x44')]['hasOwnProperty'](_0xfe14('0x48'))){_0x44544a[_0xfe14('0x30')]=qs['limit'](_0x495e5c[_0xfe14('0x44')][_0xfe14('0x30')]);_0x44544a[_0xfe14('0x32')]=qs[_0xfe14('0x32')](_0x495e5c[_0xfe14('0x44')][_0xfe14('0x32')]);}_0x44544a[_0xfe14('0x6c')]=qs[_0xfe14('0x49')](_0x495e5c[_0xfe14('0x44')][_0xfe14('0x49')]);_0x44544a[_0xfe14('0x4a')]=qs['filters'](_[_0xfe14('0x4b')](_0x495e5c[_0xfe14('0x44')],_0x496add['filters']));_0x44544a[_0xfe14('0x4a')][_0xfe14('0x62')]=_0x461b47['id'];if(_0x495e5c[_0xfe14('0x44')]['filter']){_0x44544a[_0xfe14('0x4a')]=_[_0xfe14('0x4d')](_0x44544a[_0xfe14('0x4a')],{'$or':_['map'](_0x44544a[_0xfe14('0x47')],function(_0x4888f4){var _0x3e40c1={};_0x3e40c1[_0x4888f4]={'$like':'%'+_0x495e5c[_0xfe14('0x44')]['filter']+'%'};return _0x3e40c1;})});}_0x44544a=_['merge']({},_0x44544a,_0x495e5c[_0xfe14('0x4f')]);return db[_0xfe14('0x8e')][_0xfe14('0x31')]({'where':_0x44544a[_0xfe14('0x4a')]})[_0xfe14('0x22')](function(_0x264127){_0x4a111b[_0xfe14('0x31')]=_0x264127;if(_0x495e5c[_0xfe14('0x44')]['includeAll']){_0x44544a[_0xfe14('0x55')]=[{'model':db[_0xfe14('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xfe14('0xac'),'attributes':[_0xfe14('0x3b'),'fullname',_0xfe14('0xad')],'required':![]},{'model':db['Tag'],'as':_0xfe14('0xae'),'attributes':['id','name',_0xfe14('0xaf')],'where':_0x495e5c[_0xfe14('0x44')][_0xfe14('0xb0')]?{'id':_0x495e5c[_0xfe14('0x44')][_0xfe14('0xb0')]}:undefined,'required':_0x495e5c[_0xfe14('0x44')]['tag']?!![]:![]}];}return db[_0xfe14('0x8e')][_0xfe14('0x66')](_0x44544a);})[_0xfe14('0x22')](function(_0x5726ea){_0x4a111b[_0xfe14('0x6d')]=_0x5726ea;return _0x4a111b;});}})[_0xfe14('0x22')](respondWithFilteredResult(_0x59104a,_0x44544a))[_0xfe14('0x51')](handleError(_0x59104a,null));};exports[_0xfe14('0xb1')]=function(_0x2b6f1f,_0x103954,_0x56e500){return db['OpenchannelAccount']['find']({'where':{'id':_0x2b6f1f[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x103954,null))['then'](function(_0x34eee8){if(_0x34eee8){return _0x34eee8[_0xfe14('0xb1')](_0x2b6f1f['body'][_0xfe14('0x68')],_[_0xfe14('0xb2')](_0x2b6f1f['body'],[_0xfe14('0x68'),'id'])||{})[_0xfe14('0x90')](function(_0x36bbbc){for(var _0x4bb735=0x0;_0x4bb735<_0x2b6f1f[_0xfe14('0x57')][_0xfe14('0x68')][_0xfe14('0x6b')];_0x4bb735+=0x1){socket['emit'](_0xfe14('0xb3'),{'UserId':Number(_0x2b6f1f[_0xfe14('0x57')][_0xfe14('0x68')][_0x4bb735]),'OpenchannelAccountId':Number(_0x2b6f1f[_0xfe14('0x5f')]['id'])});}return _0x36bbbc;});}})[_0xfe14('0x22')](respondWithResult(_0x103954,null))[_0xfe14('0x51')](handleError(_0x103954,null));};exports['removeAgents']=function(_0x4fbd0c,_0x25fe41,_0x5a019e){return db[_0xfe14('0x40')][_0xfe14('0x5b')]({'where':{'id':_0x4fbd0c[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x25fe41,null))[_0xfe14('0x22')](function(_0x458d0e){if(_0x458d0e){return _0x458d0e[_0xfe14('0xb4')](_0x4fbd0c[_0xfe14('0x44')][_0xfe14('0x68')])[_0xfe14('0x22')](function(){if(_[_0xfe14('0xb5')](_0x4fbd0c[_0xfe14('0x44')]['ids'])){for(var _0x572d37=0x0;_0x572d37<_0x4fbd0c[_0xfe14('0x44')][_0xfe14('0x68')]['length'];_0x572d37+=0x1){socket[_0xfe14('0xb6')](_0xfe14('0xb7'),{'UserId':Number(_0x4fbd0c[_0xfe14('0x44')][_0xfe14('0x68')][_0x572d37]),'OpenchannelAccountId':Number(_0x4fbd0c[_0xfe14('0x5f')]['id'])});}}else{socket[_0xfe14('0xb6')](_0xfe14('0xb7'),{'UserId':Number(_0x4fbd0c[_0xfe14('0x44')]['ids']),'OpenchannelAccountId':Number(_0x4fbd0c[_0xfe14('0x5f')]['id'])});}});}})[_0xfe14('0x22')](respondWithStatusCode(_0x25fe41,null))[_0xfe14('0x51')](handleError(_0x25fe41,null));};exports['getAgents']=function(_0x30031d,_0x32166f,_0x5cec93){var _0x2ed575={};var _0x535ac7={};var _0x3c4398;var _0x263da1;return db[_0xfe14('0x40')][_0xfe14('0x6a')]({'where':{'id':_0x30031d[_0xfe14('0x5f')]['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x32166f,null))[_0xfe14('0x22')](function(_0xe66060){if(_0xe66060){_0x3c4398=_0xe66060;_0x535ac7[_0xfe14('0x42')]=_[_0xfe14('0x43')](db['User'][_0xfe14('0x53')]);_0x535ac7['query']=_[_0xfe14('0x43')](_0x30031d[_0xfe14('0x44')]);_0x535ac7[_0xfe14('0x45')]=_[_0xfe14('0x46')](_0x535ac7[_0xfe14('0x42')],_0x535ac7[_0xfe14('0x44')]);_0x2ed575[_0xfe14('0x47')]=_[_0xfe14('0x46')](_0x535ac7['model'],qs[_0xfe14('0x54')](_0x30031d[_0xfe14('0x44')]['fields']));_0x2ed575[_0xfe14('0x47')]=_0x2ed575[_0xfe14('0x47')]['length']?_0x2ed575[_0xfe14('0x47')]:_0x535ac7[_0xfe14('0x42')];_0x2ed575[_0xfe14('0x6c')]=qs[_0xfe14('0x49')](_0x30031d[_0xfe14('0x44')][_0xfe14('0x49')]);_0x2ed575['where']=qs[_0xfe14('0x45')](_[_0xfe14('0x4b')](_0x30031d['query'],_0x535ac7[_0xfe14('0x45')]));if(_0x30031d[_0xfe14('0x44')]['filter']){_0x2ed575[_0xfe14('0x4a')]=_['merge'](_0x2ed575[_0xfe14('0x4a')],{'$or':_['map'](_0x2ed575[_0xfe14('0x47')],function(_0x1383f2){var _0xda03fb={};_0xda03fb[_0x1383f2]={'$like':'%'+_0x30031d[_0xfe14('0x44')][_0xfe14('0x4c')]+'%'};return _0xda03fb;})});}_0x2ed575=_[_0xfe14('0x4d')]({},_0x2ed575,_0x30031d[_0xfe14('0x4f')]);return _0x3c4398[_0xfe14('0xb8')](_0x2ed575);}})['then'](function(_0x5cb348){if(_0x5cb348){_0x263da1=_0x5cb348['length'];if(!_0x30031d[_0xfe14('0x44')][_0xfe14('0x65')](_0xfe14('0x48'))){_0x2ed575[_0xfe14('0x30')]=qs['limit'](_0x30031d[_0xfe14('0x44')]['limit']);_0x2ed575['offset']=qs[_0xfe14('0x32')](_0x30031d[_0xfe14('0x44')][_0xfe14('0x32')]);}return _0x3c4398[_0xfe14('0xb8')](_0x2ed575);}})[_0xfe14('0x22')](function(_0x514245){if(_0x514245){return _0x514245?{'count':_0x263da1,'rows':_0x514245}:null;}})[_0xfe14('0x22')](respondWithResult(_0x32166f,null))[_0xfe14('0x51')](handleError(_0x32166f,null));};exports[_0xfe14('0xa9')]=function(_0x3074d5,_0x264424,_0x5eea69){var _0x1091e7,_0x76b82b,_0x5e03a0;if(_[_0xfe14('0x76')](_0x3074d5[_0xfe14('0x57')]['body'])||_0x3074d5[_0xfe14('0x57')]['body']===''){throw new db[(_0xfe14('0x77'))][(_0xfe14('0x78'))](_0xfe14('0x79'));}if(_[_0xfe14('0x76')](_0x3074d5['body']['to'])){}_0x1091e7=_0x3074d5[_0xfe14('0x57')]['to'];return db[_0xfe14('0x40')]['findOne']({'where':{'id':_0x3074d5['params']['id']}})[_0xfe14('0x22')](handleEntityNotFound(_0x264424,null))[_0xfe14('0x22')](function(_0x2d055c){if(_0x2d055c){return db[_0xfe14('0x40')]['find']({'where':{'id':_0x2d055c['id']},'include':[{'model':db[_0xfe14('0x7e')],'as':_0xfe14('0x7f'),'include':[{'model':db[_0xfe14('0x71')],'as':_0xfe14('0x80'),'where':{[_0x2d055c[_0xfe14('0x7c')]]:_0x1091e7},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xfe14('0x22')](handleEntityNotFound(_0x264424,null))[_0xfe14('0x22')](function(_0x1043cd){if(_0x1043cd&&_0x1043cd[_0xfe14('0x7f')]){_0x76b82b=_0x1043cd[_0xfe14('0x37')]({'plain':!![]});if(_0x76b82b[_0xfe14('0x7f')]&&_0x76b82b[_0xfe14('0x7f')][_0xfe14('0x80')][_0xfe14('0x6b')]){return _0x76b82b[_0xfe14('0x7f')][_0xfe14('0x80')][0x0];}return db[_0xfe14('0x71')][_0xfe14('0x56')](_[_0xfe14('0x1b')](_0x3074d5['body'],{'firstName':_0x1091e7,[_0x1043cd[_0xfe14('0x7c')]]:_0x1091e7,'phone':_0x1091e7,'ListId':_0x76b82b[_0xfe14('0x8a')]}));}})[_0xfe14('0x22')](handleEntityNotFound(_0x264424,null))[_0xfe14('0x22')](function(_0x13f48a){if(_0x13f48a){_0x5e03a0=_0x13f48a;return db[_0xfe14('0x8e')][_0xfe14('0x5b')]({'where':{'ContactId':_0x5e03a0['id'],'closed':![],'OpenchannelAccountId':_0x76b82b['id']}})['then'](function(_0x16fae2){if(_0x16fae2){return[_0x16fae2,![]];}return db['OpenchannelInteraction'][_0xfe14('0x56')]({'UserId':_0x3074d5['user']['id'],'ContactId':_0x5e03a0['id'],'OpenchannelAccountId':_0x76b82b['id'],'lastMsgDirection':_0xfe14('0xb9'),'firstMsgDirection':_0xfe14('0xb9'),'Messages':[_[_0xfe14('0x4d')](_0x3074d5['body'],{'read':![],'body':_0x3074d5[_0xfe14('0x57')][_0xfe14('0x57')],'OpenchannelAccountId':_0x76b82b['id'],'UserId':_0x3074d5['user']['id'],'ContactId':_0x5e03a0['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xfe14('0xba')}]})[_0xfe14('0x22')](function(_0x3227cc){return[_0x3227cc,!![]];});});}})[_0xfe14('0x90')](function(_0x2e0f50,_0x44f990){if(_0x44f990){return _0x2e0f50;}return db[_0xfe14('0x99')][_0xfe14('0x56')](_['merge'](_0x3074d5[_0xfe14('0x57')],{'read':![],'body':_0x3074d5['body']['body'],'OpenchannelAccountId':_0x76b82b['id'],'OpenchannelInteractionId':_0x2e0f50['id'],'UserId':_0x3074d5[_0xfe14('0x59')]['id'],'ContactId':_0x5e03a0['id']}))['then'](function(_0x5133c3){_0x2e0f50['dataValues'][_0xfe14('0xba')]=[];_0x2e0f50[_0xfe14('0xbb')]['Messages'][_0xfe14('0xbc')](_0x5133c3[_0xfe14('0xbb')]);return _0x2e0f50;});});}})[_0xfe14('0x22')](respondWithResult(_0x264424,null))[_0xfe14('0x51')](handleError(_0x264424,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2f52a31..ae07a53 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 _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x24312e,_0x3b518e){var _0x308916=function(_0xfb3aa8){while(--_0xfb3aa8){_0x24312e['push'](_0x24312e['shift']());}};_0x308916(++_0x3b518e);}(_0x13f6,0x124));var _0x613f=function(_0x5ee57a,_0x18ef68){_0x5ee57a=_0x5ee57a-0x0;var _0x3c06ab=_0x13f6[_0x5ee57a];return _0x3c06ab;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x17f30e,_0x5e598e){var _0x3649cd=function(_0x2d57ad){while(--_0x2d57ad){_0x17f30e['push'](_0x17f30e['shift']());}};_0x3649cd(++_0x5e598e);}(_0x878f,0x173));var _0xf878=function(_0x1802b2,_0x10ac5b){_0x1802b2=_0x1802b2-0x0;var _0x5735c6=_0x878f[_0x1802b2];return _0x5735c6;};'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 4784ca4..09dab86 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(_0x3e6e4a,_0x16f13d){var _0x2806ac=function(_0x34d782){while(--_0x34d782){_0x3e6e4a['push'](_0x3e6e4a['shift']());}};_0x2806ac(++_0x16f13d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0xc6c0ad,_0x414853){var _0x979752=function(_0x947b6a){while(--_0x947b6a){_0xc6c0ad['push'](_0xc6c0ad['shift']());}};_0x979752(++_0x414853);}(_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 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 6b3c2ed..5cd7d9a 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 _0x087b=['then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request'];(function(_0x4ab080,_0x206c11){var _0x3e4b32=function(_0x3cdfb9){while(--_0x3cdfb9){_0x4ab080['push'](_0x4ab080['shift']());}};_0x3e4b32(++_0x206c11);}(_0x087b,0x11a));var _0xb087=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x087b[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});config[_0xb087('0xb')]=_[_0xb087('0xc')](config[_0xb087('0xb')],{'host':_0xb087('0xd'),'port':0x18eb});var socket=require(_0xb087('0xe'))(new Redis(config[_0xb087('0xb')]));require(_0xb087('0xf'))[_0xb087('0x10')](socket);function respondWithRpcPromise(_0x379041,_0x583d25,_0x244abc){return new BPromise(function(_0x108451,_0x903a16){return client[_0xb087('0x11')](_0x379041,_0x244abc)[_0xb087('0x12')](function(_0x2f43e9){logger[_0xb087('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));logger[_0xb087('0x15')](_0xb087('0x16'),_0x583d25,'request\x20sent',JSON[_0xb087('0x17')](_0x2f43e9));if(_0x2f43e9[_0xb087('0x18')]){if(_0x2f43e9[_0xb087('0x18')][_0xb087('0x19')]===0x1f4){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);return _0x903a16(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}logger['error'](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')]['message']);return _0x108451(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}else{logger[_0xb087('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));_0x108451(_0x2f43e9[_0xb087('0x1c')][_0xb087('0x1b')]);}})[_0xb087('0x1d')](function(_0x4e333b){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x4e333b);_0x903a16(_0x4e333b);});});} \ No newline at end of file +var _0xe605=['jayson/promise','client','http','redis','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x461432,_0x5b8cbb){var _0x5d79f4=function(_0x496df0){while(--_0x496df0){_0x461432['push'](_0x461432['shift']());}};_0x5d79f4(++_0x5b8cbb);}(_0xe605,0x92));var _0x5e60=function(_0x418e03,_0x59adbe){_0x418e03=_0x418e03-0x0;var _0x490087=_0xe605[_0x418e03];return _0x490087;};'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});config[_0x5e60('0xd')]=_['defaults'](config[_0x5e60('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5e60('0xe'))[_0x5e60('0xf')](socket);function respondWithRpcPromise(_0x150a51,_0x2c5425,_0x331b3e){return new BPromise(function(_0x2cbe4e,_0x56f05a){return client[_0x5e60('0x10')](_0x150a51,_0x331b3e)['then'](function(_0x1d2558){logger[_0x5e60('0x11')](_0x5e60('0x12'),_0x2c5425,'request\x20sent');logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x2c5425,_0x5e60('0x15'),JSON[_0x5e60('0x16')](_0x1d2558));if(_0x1d2558[_0x5e60('0x17')]){if(_0x1d2558[_0x5e60('0x17')]['code']===0x1f4){logger[_0x5e60('0x17')](_0x5e60('0x12'),_0x2c5425,_0x1d2558[_0x5e60('0x17')][_0x5e60('0x18')]);return _0x56f05a(_0x1d2558['error'][_0x5e60('0x18')]);}logger['error'](_0x5e60('0x12'),_0x2c5425,_0x1d2558[_0x5e60('0x17')]['message']);return _0x2cbe4e(_0x1d2558[_0x5e60('0x17')][_0x5e60('0x18')]);}else{logger[_0x5e60('0x11')](_0x5e60('0x12'),_0x2c5425,'request\x20sent');_0x2cbe4e(_0x1d2558[_0x5e60('0x19')][_0x5e60('0x18')]);}})['catch'](function(_0x1fa0f8){logger[_0x5e60('0x17')](_0x5e60('0x12'),_0x2c5425,_0x1fa0f8);_0x56f05a(_0x1fa0f8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index d989cfe..cbf462e 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 _0x4198=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x3b3c2f,_0x3dd331){var _0x434f87=function(_0x3f6169){while(--_0x3f6169){_0x3b3c2f['push'](_0x3b3c2f['shift']());}};_0x434f87(++_0x3dd331);}(_0x4198,0x69));var _0x8419=function(_0xd12fe1,_0x249571){_0xd12fe1=_0xd12fe1-0x0;var _0x52c142=_0x4198[_0xd12fe1];return _0x52c142;};'use strict';var OpenchannelAccountEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){OpenchannelAccountEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);OpenchannelAccountEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file +var _0x76dc=['./openchannelAccount.events','save','remove','update','register','openchannelAccount:'];(function(_0x353fad,_0x4e639b){var _0x185cbd=function(_0x514688){while(--_0x514688){_0x353fad['push'](_0x353fad['shift']());}};_0x185cbd(++_0x4e639b);}(_0x76dc,0x1f2));var _0xc76d=function(_0x675b51,_0x51277f){_0x675b51=_0x675b51-0x0;var _0x277678=_0x76dc[_0x675b51];return _0x277678;};'use strict';var OpenchannelAccountEvents=require(_0xc76d('0x0'));var events=[_0xc76d('0x1'),_0xc76d('0x2'),_0xc76d('0x3')];function createListener(_0x49c651,_0x2a8b7d){return function(_0x1ba6a1){_0x2a8b7d['emit'](_0x49c651,_0x1ba6a1);};}function removeListener(_0x300f11,_0x50ed3a){return function(){OpenchannelAccountEvents['removeListener'](_0x300f11,_0x50ed3a);};}exports[_0xc76d('0x4')]=function(_0x29ab70){for(var _0x1c86fc=0x0,_0x4832bd=events['length'];_0x1c86fc<_0x4832bd;_0x1c86fc++){var _0x119f38=events[_0x1c86fc];var _0x114572=createListener(_0xc76d('0x5')+_0x119f38,_0x29ab70);OpenchannelAccountEvents['on'](_0x119f38,_0x114572);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 04dba1f..df9b5c1 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 _0x4b00=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x50cc81,_0x383b63){var _0x59574f=function(_0x142b1e){while(--_0x142b1e){_0x50cc81['push'](_0x50cc81['shift']());}};_0x59574f(++_0x383b63);}(_0x4b00,0x16a));var _0x04b0=function(_0x126a6e,_0x22bfff){_0x126a6e=_0x126a6e-0x0;var _0x1652f6=_0x4b00[_0x126a6e];return _0x1652f6;};'use strict';var multer=require(_0x04b0('0x0'));var util=require(_0x04b0('0x1'));var path=require(_0x04b0('0x2'));var timeout=require(_0x04b0('0x3'));var express=require(_0x04b0('0x4'));var router=express[_0x04b0('0x5')]();var fs_extra=require(_0x04b0('0x6'));var auth=require(_0x04b0('0x7'));var interaction=require(_0x04b0('0x8'));var config=require(_0x04b0('0x9'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x04b0('0xa')]);router[_0x04b0('0xb')](_0x04b0('0xc'),auth[_0x04b0('0xd')](),controller[_0x04b0('0xe')]);router[_0x04b0('0xf')]('/',auth['isAuthenticated'](),controller[_0x04b0('0x10')]);router['put']('/:id',auth[_0x04b0('0xd')](),controller[_0x04b0('0x11')]);router[_0x04b0('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x04b0('0x13')]=router; \ No newline at end of file +var _0x5181=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2a0ee5,_0x2584d0){var _0xbebf64=function(_0x4a3e6e){while(--_0x4a3e6e){_0x2a0ee5['push'](_0x2a0ee5['shift']());}};_0xbebf64(++_0x2584d0);}(_0x5181,0x109));var _0x1518=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0x5181[_0x274d4b];return _0x1a1f03;};'use strict';var multer=require(_0x1518('0x0'));var util=require(_0x1518('0x1'));var path=require('path');var timeout=require(_0x1518('0x2'));var express=require(_0x1518('0x3'));var router=express[_0x1518('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1518('0x5'));var interaction=require(_0x1518('0x6'));var config=require(_0x1518('0x7'));var controller=require('./openchannelApplication.controller');router[_0x1518('0x8')]('/',auth[_0x1518('0x9')](),controller['index']);router[_0x1518('0x8')](_0x1518('0xa'),auth[_0x1518('0x9')](),controller[_0x1518('0xb')]);router[_0x1518('0xc')]('/',auth[_0x1518('0x9')](),controller[_0x1518('0xd')]);router[_0x1518('0xe')]('/:id',auth[_0x1518('0x9')](),controller[_0x1518('0xf')]);router[_0x1518('0x10')](_0x1518('0xa'),auth[_0x1518('0x9')](),controller[_0x1518('0x11')]);module[_0x1518('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5a9f161..ff62bd8 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 _0x1b3a=['INTEGER','STRING','noop','sequelize'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x1b3a,0x1ab));var _0xa1b3=function(_0x46aee2,_0x46b137){_0x46aee2=_0x46aee2-0x0;var _0x22ddf0=_0x1b3a[_0x46aee2];return _0x22ddf0;};'use strict';var Sequelize=require(_0xa1b3('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa1b3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa1b3('0x2')],'allowNull':![],'defaultValue':_0xa1b3('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa1b3('0x2')]},'interval':{'type':Sequelize[_0xa1b3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc557=['INTEGER','STRING','sequelize','exports'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xc557,0x7a));var _0x7c55=function(_0x22b2be,_0x4b164c){_0x22b2be=_0x22b2be-0x0;var _0x213c31=_0xc557[_0x22b2be];return _0x213c31;};'use strict';var Sequelize=require(_0x7c55('0x0'));module[_0x7c55('0x1')]={'priority':{'type':Sequelize[_0x7c55('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7c55('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7c55('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0499c77..78cf015 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 _0xdd09=['hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xdd09,0x1c3));var _0x9dd0=function(_0x4051f8,_0x2590ed){_0x4051f8=_0x4051f8-0x0;var _0x21d6dc=_0xdd09[_0x4051f8];return _0x21d6dc;};'use strict';var emlformat=require(_0x9dd0('0x0'));var rimraf=require(_0x9dd0('0x1'));var zipdir=require(_0x9dd0('0x2'));var jsonpatch=require(_0x9dd0('0x3'));var rp=require(_0x9dd0('0x4'));var moment=require('moment');var BPromise=require(_0x9dd0('0x5'));var Mustache=require(_0x9dd0('0x6'));var util=require(_0x9dd0('0x7'));var path=require(_0x9dd0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9dd0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dd0('0xa'));var crypto=require(_0x9dd0('0xb'));var jsforce=require(_0x9dd0('0xc'));var deskjs=require(_0x9dd0('0xd'));var toCsv=require(_0x9dd0('0xe'));var querystring=require(_0x9dd0('0xf'));var Papa=require('papaparse');var Redis=require(_0x9dd0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dd0('0x12'));var logger=require(_0x9dd0('0x13'))(_0x9dd0('0x14'));var utils=require(_0x9dd0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9dd0('0x16'));var db=require(_0x9dd0('0x17'))['db'];function respondWithStatusCode(_0x354368,_0x578d04){_0x578d04=_0x578d04||0xcc;return function(_0x449308){if(_0x449308){return _0x354368[_0x9dd0('0x18')](_0x578d04);}return _0x354368['status'](_0x578d04)[_0x9dd0('0x19')]();};}function respondWithResult(_0xf183fd,_0x2fa027){_0x2fa027=_0x2fa027||0xc8;return function(_0x513918){if(_0x513918){return _0xf183fd[_0x9dd0('0x1a')](_0x2fa027)[_0x9dd0('0x1b')](_0x513918);}};}function respondWithFilteredResult(_0x1fd148,_0x58a9aa){return function(_0x38cbdd){if(_0x38cbdd){var _0x54137d=typeof _0x58a9aa[_0x9dd0('0x1c')]===_0x9dd0('0x1d')&&typeof _0x58a9aa[_0x9dd0('0x1e')]===_0x9dd0('0x1d');var _0x509f00=_0x38cbdd[_0x9dd0('0x1f')];var _0x1c3059=_0x54137d?0x0:_0x58a9aa['offset'];var _0x375caa=_0x54137d?_0x38cbdd[_0x9dd0('0x1f')]:_0x58a9aa[_0x9dd0('0x1c')]+_0x58a9aa['limit'];var _0x3edfc6;if(_0x375caa>=_0x509f00){_0x375caa=_0x509f00;_0x3edfc6=0xc8;}else{_0x3edfc6=0xce;}_0x1fd148[_0x9dd0('0x1a')](_0x3edfc6);return _0x1fd148[_0x9dd0('0x20')](_0x9dd0('0x21'),_0x1c3059+'-'+_0x375caa+'/'+_0x509f00)[_0x9dd0('0x1b')](_0x38cbdd);}return null;};}function patchUpdates(_0x1e2fa2){return function(_0x513748){try{jsonpatch['apply'](_0x513748,_0x1e2fa2,!![]);}catch(_0x29c0b2){return BPromise['reject'](_0x29c0b2);}return _0x513748[_0x9dd0('0x22')]();};}function saveUpdates(_0x56a2b7,_0x86ed19){return function(_0x3641a4){if(_0x3641a4){return _0x3641a4[_0x9dd0('0x23')](_0x56a2b7)[_0x9dd0('0x24')](function(_0x49d467){return _0x49d467;});}return null;};}function removeEntity(_0x553853,_0x56c81e){return function(_0x3e3345){if(_0x3e3345){return _0x3e3345[_0x9dd0('0x25')]()[_0x9dd0('0x24')](function(){_0x553853[_0x9dd0('0x1a')](0xcc)[_0x9dd0('0x19')]();});}};}function handleEntityNotFound(_0x58d08d,_0x1f47bc){return function(_0x26254a){if(!_0x26254a){_0x58d08d[_0x9dd0('0x18')](0x194);}return _0x26254a;};}function handleError(_0x1a69ca,_0x24501a){_0x24501a=_0x24501a||0x1f4;return function(_0x294a15){logger['error'](_0x294a15[_0x9dd0('0x26')]);if(_0x294a15['name']){delete _0x294a15[_0x9dd0('0x27')];}_0x1a69ca['status'](_0x24501a)['send'](_0x294a15);};}exports[_0x9dd0('0x28')]=function(_0x429bcb,_0x4c4790){var _0x281519={},_0x125f9e={},_0x1dd591={'count':0x0,'rows':[]};var _0xb8d1e=_[_0x9dd0('0x29')](db[_0x9dd0('0x2a')][_0x9dd0('0x2b')],function(_0xfa134d){return{'name':_0xfa134d['fieldName'],'type':_0xfa134d[_0x9dd0('0x2c')][_0x9dd0('0x2d')]};});_0x125f9e[_0x9dd0('0x2e')]=_[_0x9dd0('0x29')](_0xb8d1e,_0x9dd0('0x27'));_0x125f9e['query']=_[_0x9dd0('0x2f')](_0x429bcb[_0x9dd0('0x30')]);_0x125f9e[_0x9dd0('0x31')]=_[_0x9dd0('0x32')](_0x125f9e['model'],_0x125f9e[_0x9dd0('0x30')]);_0x281519[_0x9dd0('0x33')]=_[_0x9dd0('0x32')](_0x125f9e[_0x9dd0('0x2e')],qs['fields'](_0x429bcb[_0x9dd0('0x30')]['fields']));_0x281519['attributes']=_0x281519[_0x9dd0('0x33')][_0x9dd0('0x34')]?_0x281519[_0x9dd0('0x33')]:_0x125f9e[_0x9dd0('0x2e')];if(!_0x429bcb[_0x9dd0('0x30')][_0x9dd0('0x35')]('nolimit')){_0x281519[_0x9dd0('0x1e')]=qs[_0x9dd0('0x1e')](_0x429bcb[_0x9dd0('0x30')][_0x9dd0('0x1e')]);_0x281519['offset']=qs[_0x9dd0('0x1c')](_0x429bcb['query'][_0x9dd0('0x1c')]);}_0x281519[_0x9dd0('0x36')]=qs['sort'](_0x429bcb['query'][_0x9dd0('0x37')]);_0x281519[_0x9dd0('0x38')]=qs[_0x9dd0('0x31')](_[_0x9dd0('0x39')](_0x429bcb[_0x9dd0('0x30')],_0x125f9e[_0x9dd0('0x31')]),_0xb8d1e);if(_0x429bcb[_0x9dd0('0x30')][_0x9dd0('0x3a')]){_0x281519[_0x9dd0('0x38')]=_['merge'](_0x281519['where'],{'$or':_['map'](_0xb8d1e,function(_0x1392f1){if(_0x1392f1[_0x9dd0('0x2c')]!=='VIRTUAL'){var _0x511438={};_0x511438[_0x1392f1['name']]={'$like':'%'+_0x429bcb['query']['filter']+'%'};return _0x511438;}})});}_0x281519=_[_0x9dd0('0x3b')]({},_0x281519,_0x429bcb[_0x9dd0('0x3c')]);var _0x4173f9={'where':_0x281519['where']};return db[_0x9dd0('0x2a')][_0x9dd0('0x1f')](_0x4173f9)['then'](function(_0x3db32a){_0x1dd591[_0x9dd0('0x1f')]=_0x3db32a;if(_0x429bcb[_0x9dd0('0x30')][_0x9dd0('0x3d')]){_0x281519[_0x9dd0('0x3e')]=[{'all':!![]}];}return db[_0x9dd0('0x2a')][_0x9dd0('0x3f')](_0x281519);})['then'](function(_0x4b6594){_0x1dd591[_0x9dd0('0x40')]=_0x4b6594;return _0x1dd591;})[_0x9dd0('0x24')](respondWithFilteredResult(_0x4c4790,_0x281519))[_0x9dd0('0x41')](handleError(_0x4c4790,null));};exports[_0x9dd0('0x42')]=function(_0x356892,_0x5d3054){var _0x57548d={'raw':!![],'where':{'id':_0x356892[_0x9dd0('0x43')]['id']}},_0x46c05f={};_0x46c05f['model']=_[_0x9dd0('0x2f')](db[_0x9dd0('0x2a')][_0x9dd0('0x2b')]);_0x46c05f[_0x9dd0('0x30')]=_[_0x9dd0('0x2f')](_0x356892[_0x9dd0('0x30')]);_0x46c05f[_0x9dd0('0x31')]=_[_0x9dd0('0x32')](_0x46c05f[_0x9dd0('0x2e')],_0x46c05f[_0x9dd0('0x30')]);_0x57548d[_0x9dd0('0x33')]=_[_0x9dd0('0x32')](_0x46c05f[_0x9dd0('0x2e')],qs['fields'](_0x356892['query'][_0x9dd0('0x44')]));_0x57548d[_0x9dd0('0x33')]=_0x57548d[_0x9dd0('0x33')][_0x9dd0('0x34')]?_0x57548d['attributes']:_0x46c05f[_0x9dd0('0x2e')];if(_0x356892[_0x9dd0('0x30')][_0x9dd0('0x3d')]){_0x57548d[_0x9dd0('0x3e')]=[{'all':!![]}];}_0x57548d=_[_0x9dd0('0x3b')]({},_0x57548d,_0x356892[_0x9dd0('0x3c')]);return db[_0x9dd0('0x2a')][_0x9dd0('0x45')](_0x57548d)['then'](handleEntityNotFound(_0x5d3054,null))[_0x9dd0('0x24')](respondWithResult(_0x5d3054,null))[_0x9dd0('0x41')](handleError(_0x5d3054,null));};exports['create']=function(_0x5bf28b,_0x47d52c){return db[_0x9dd0('0x2a')][_0x9dd0('0x46')](_0x5bf28b[_0x9dd0('0x47')],{})[_0x9dd0('0x24')](respondWithResult(_0x47d52c,0xc9))[_0x9dd0('0x41')](handleError(_0x47d52c,null));};exports[_0x9dd0('0x23')]=function(_0xe75918,_0x31eeac){if(_0xe75918[_0x9dd0('0x47')]['id']){delete _0xe75918['body']['id'];}return db[_0x9dd0('0x2a')]['find']({'where':{'id':_0xe75918[_0x9dd0('0x43')]['id']}})['then'](handleEntityNotFound(_0x31eeac,null))[_0x9dd0('0x24')](saveUpdates(_0xe75918[_0x9dd0('0x47')],null))[_0x9dd0('0x24')](respondWithResult(_0x31eeac,null))['catch'](handleError(_0x31eeac,null));};exports[_0x9dd0('0x25')]=function(_0x5bd9ac,_0x3991c1){return db[_0x9dd0('0x2a')]['find']({'where':{'id':_0x5bd9ac[_0x9dd0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3991c1,null))[_0x9dd0('0x24')](removeEntity(_0x3991c1,null))[_0x9dd0('0x41')](handleError(_0x3991c1,null));}; \ No newline at end of file +var _0xb8de=['Content-Range','json','reject','update','then','sendStatus','error','stack','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','fields','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set'];(function(_0x232f7a,_0x13b679){var _0x6e79e5=function(_0x39ae28){while(--_0x39ae28){_0x232f7a['push'](_0x232f7a['shift']());}};_0x6e79e5(++_0x13b679);}(_0xb8de,0x107));var _0xeb8d=function(_0x409ec7,_0xb5badc){_0x409ec7=_0x409ec7-0x0;var _0x2cc256=_0xb8de[_0x409ec7];return _0x2cc256;};'use strict';var emlformat=require(_0xeb8d('0x0'));var rimraf=require(_0xeb8d('0x1'));var zipdir=require(_0xeb8d('0x2'));var jsonpatch=require(_0xeb8d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb8d('0x4'));var util=require('util');var path=require(_0xeb8d('0x5'));var sox=require(_0xeb8d('0x6'));var csv=require(_0xeb8d('0x7'));var ejs=require(_0xeb8d('0x8'));var fs=require('fs');var fs_extra=require(_0xeb8d('0x9'));var _=require(_0xeb8d('0xa'));var squel=require(_0xeb8d('0xb'));var crypto=require(_0xeb8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb8d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeb8d('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb8d('0xf'));var authService=require(_0xeb8d('0x10'));var qs=require(_0xeb8d('0x11'));var as=require(_0xeb8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb8d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb8d('0x14'));var db=require(_0xeb8d('0x15'))['db'];function respondWithStatusCode(_0x3f6943,_0x34308a){_0x34308a=_0x34308a||0xcc;return function(_0x35196d){if(_0x35196d){return _0x3f6943['sendStatus'](_0x34308a);}return _0x3f6943[_0xeb8d('0x16')](_0x34308a)[_0xeb8d('0x17')]();};}function respondWithResult(_0x4547e7,_0x3d7a7e){_0x3d7a7e=_0x3d7a7e||0xc8;return function(_0x46edcd){if(_0x46edcd){return _0x4547e7[_0xeb8d('0x16')](_0x3d7a7e)['json'](_0x46edcd);}};}function respondWithFilteredResult(_0x1aae96,_0x50bffd){return function(_0x15c099){if(_0x15c099){var _0x257f8d=typeof _0x50bffd[_0xeb8d('0x18')]==='undefined'&&typeof _0x50bffd[_0xeb8d('0x19')]===_0xeb8d('0x1a');var _0x590bba=_0x15c099['count'];var _0x70ebb8=_0x257f8d?0x0:_0x50bffd[_0xeb8d('0x18')];var _0xbc1d17=_0x257f8d?_0x15c099[_0xeb8d('0x1b')]:_0x50bffd[_0xeb8d('0x18')]+_0x50bffd[_0xeb8d('0x19')];var _0x1986cc;if(_0xbc1d17>=_0x590bba){_0xbc1d17=_0x590bba;_0x1986cc=0xc8;}else{_0x1986cc=0xce;}_0x1aae96[_0xeb8d('0x16')](_0x1986cc);return _0x1aae96[_0xeb8d('0x1c')](_0xeb8d('0x1d'),_0x70ebb8+'-'+_0xbc1d17+'/'+_0x590bba)[_0xeb8d('0x1e')](_0x15c099);}return null;};}function patchUpdates(_0x18883d){return function(_0x1a8793){try{jsonpatch['apply'](_0x1a8793,_0x18883d,!![]);}catch(_0x42f03b){return BPromise[_0xeb8d('0x1f')](_0x42f03b);}return _0x1a8793['save']();};}function saveUpdates(_0x59d83a,_0x58041b){return function(_0x4a7510){if(_0x4a7510){return _0x4a7510[_0xeb8d('0x20')](_0x59d83a)['then'](function(_0x38a0f4){return _0x38a0f4;});}return null;};}function removeEntity(_0x45581d,_0x59ee5d){return function(_0x36daf3){if(_0x36daf3){return _0x36daf3['destroy']()[_0xeb8d('0x21')](function(){_0x45581d['status'](0xcc)[_0xeb8d('0x17')]();});}};}function handleEntityNotFound(_0x4c87b4,_0x40c31d){return function(_0x1ea0b5){if(!_0x1ea0b5){_0x4c87b4[_0xeb8d('0x22')](0x194);}return _0x1ea0b5;};}function handleError(_0x43594e,_0x4823fe){_0x4823fe=_0x4823fe||0x1f4;return function(_0x1d00ec){logger[_0xeb8d('0x23')](_0x1d00ec[_0xeb8d('0x24')]);if(_0x1d00ec['name']){delete _0x1d00ec['name'];}_0x43594e[_0xeb8d('0x16')](_0x4823fe)[_0xeb8d('0x25')](_0x1d00ec);};}exports[_0xeb8d('0x26')]=function(_0x403a33,_0x5ab6fa){var _0x4fb7a4={},_0x1b77f0={},_0x1961e1={'count':0x0,'rows':[]};var _0x5c1a92=_[_0xeb8d('0x27')](db[_0xeb8d('0x28')][_0xeb8d('0x29')],function(_0x3ebc16){return{'name':_0x3ebc16[_0xeb8d('0x2a')],'type':_0x3ebc16[_0xeb8d('0x2b')]['key']};});_0x1b77f0[_0xeb8d('0x2c')]=_[_0xeb8d('0x27')](_0x5c1a92,_0xeb8d('0x2d'));_0x1b77f0[_0xeb8d('0x2e')]=_['keys'](_0x403a33[_0xeb8d('0x2e')]);_0x1b77f0[_0xeb8d('0x2f')]=_[_0xeb8d('0x30')](_0x1b77f0['model'],_0x1b77f0[_0xeb8d('0x2e')]);_0x4fb7a4['attributes']=_[_0xeb8d('0x30')](_0x1b77f0[_0xeb8d('0x2c')],qs['fields'](_0x403a33['query']['fields']));_0x4fb7a4[_0xeb8d('0x31')]=_0x4fb7a4[_0xeb8d('0x31')][_0xeb8d('0x32')]?_0x4fb7a4[_0xeb8d('0x31')]:_0x1b77f0['model'];if(!_0x403a33[_0xeb8d('0x2e')][_0xeb8d('0x33')](_0xeb8d('0x34'))){_0x4fb7a4['limit']=qs[_0xeb8d('0x19')](_0x403a33[_0xeb8d('0x2e')][_0xeb8d('0x19')]);_0x4fb7a4[_0xeb8d('0x18')]=qs[_0xeb8d('0x18')](_0x403a33[_0xeb8d('0x2e')][_0xeb8d('0x18')]);}_0x4fb7a4[_0xeb8d('0x35')]=qs[_0xeb8d('0x36')](_0x403a33[_0xeb8d('0x2e')]['sort']);_0x4fb7a4[_0xeb8d('0x37')]=qs[_0xeb8d('0x2f')](_[_0xeb8d('0x38')](_0x403a33[_0xeb8d('0x2e')],_0x1b77f0[_0xeb8d('0x2f')]),_0x5c1a92);if(_0x403a33['query'][_0xeb8d('0x39')]){_0x4fb7a4[_0xeb8d('0x37')]=_[_0xeb8d('0x3a')](_0x4fb7a4[_0xeb8d('0x37')],{'$or':_[_0xeb8d('0x27')](_0x5c1a92,function(_0x1f94e2){if(_0x1f94e2[_0xeb8d('0x2b')]!==_0xeb8d('0x3b')){var _0x141ddb={};_0x141ddb[_0x1f94e2[_0xeb8d('0x2d')]]={'$like':'%'+_0x403a33['query'][_0xeb8d('0x39')]+'%'};return _0x141ddb;}})});}_0x4fb7a4=_[_0xeb8d('0x3a')]({},_0x4fb7a4,_0x403a33[_0xeb8d('0x3c')]);var _0x2a2bfc={'where':_0x4fb7a4[_0xeb8d('0x37')]};return db[_0xeb8d('0x28')]['count'](_0x2a2bfc)[_0xeb8d('0x21')](function(_0x4d91a4){_0x1961e1[_0xeb8d('0x1b')]=_0x4d91a4;if(_0x403a33[_0xeb8d('0x2e')][_0xeb8d('0x3d')]){_0x4fb7a4['include']=[{'all':!![]}];}return db[_0xeb8d('0x28')][_0xeb8d('0x3e')](_0x4fb7a4);})[_0xeb8d('0x21')](function(_0x5e65ae){_0x1961e1[_0xeb8d('0x3f')]=_0x5e65ae;return _0x1961e1;})[_0xeb8d('0x21')](respondWithFilteredResult(_0x5ab6fa,_0x4fb7a4))[_0xeb8d('0x40')](handleError(_0x5ab6fa,null));};exports[_0xeb8d('0x41')]=function(_0x425553,_0x1595f9){var _0x2dfac1={'raw':!![],'where':{'id':_0x425553['params']['id']}},_0x1589f2={};_0x1589f2[_0xeb8d('0x2c')]=_[_0xeb8d('0x42')](db['OpenchannelApplication'][_0xeb8d('0x29')]);_0x1589f2['query']=_['keys'](_0x425553[_0xeb8d('0x2e')]);_0x1589f2['filters']=_[_0xeb8d('0x30')](_0x1589f2['model'],_0x1589f2[_0xeb8d('0x2e')]);_0x2dfac1[_0xeb8d('0x31')]=_[_0xeb8d('0x30')](_0x1589f2[_0xeb8d('0x2c')],qs[_0xeb8d('0x43')](_0x425553[_0xeb8d('0x2e')][_0xeb8d('0x43')]));_0x2dfac1[_0xeb8d('0x31')]=_0x2dfac1[_0xeb8d('0x31')][_0xeb8d('0x32')]?_0x2dfac1['attributes']:_0x1589f2[_0xeb8d('0x2c')];if(_0x425553[_0xeb8d('0x2e')][_0xeb8d('0x3d')]){_0x2dfac1['include']=[{'all':!![]}];}_0x2dfac1=_[_0xeb8d('0x3a')]({},_0x2dfac1,_0x425553['options']);return db[_0xeb8d('0x28')][_0xeb8d('0x44')](_0x2dfac1)[_0xeb8d('0x21')](handleEntityNotFound(_0x1595f9,null))[_0xeb8d('0x21')](respondWithResult(_0x1595f9,null))[_0xeb8d('0x40')](handleError(_0x1595f9,null));};exports[_0xeb8d('0x45')]=function(_0xc8dc56,_0x2ec75a){return db[_0xeb8d('0x28')]['create'](_0xc8dc56[_0xeb8d('0x46')],{})['then'](respondWithResult(_0x2ec75a,0xc9))[_0xeb8d('0x40')](handleError(_0x2ec75a,null));};exports[_0xeb8d('0x20')]=function(_0x1bcf46,_0x58525b){if(_0x1bcf46[_0xeb8d('0x46')]['id']){delete _0x1bcf46['body']['id'];}return db[_0xeb8d('0x28')][_0xeb8d('0x44')]({'where':{'id':_0x1bcf46[_0xeb8d('0x47')]['id']}})[_0xeb8d('0x21')](handleEntityNotFound(_0x58525b,null))['then'](saveUpdates(_0x1bcf46[_0xeb8d('0x46')],null))[_0xeb8d('0x21')](respondWithResult(_0x58525b,null))['catch'](handleError(_0x58525b,null));};exports[_0xeb8d('0x48')]=function(_0x4f16e2,_0x9e2115){return db[_0xeb8d('0x28')][_0xeb8d('0x44')]({'where':{'id':_0x4f16e2['params']['id']}})['then'](handleEntityNotFound(_0x9e2115,null))[_0xeb8d('0x21')](removeEntity(_0x9e2115,null))[_0xeb8d('0x40')](handleError(_0x9e2115,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 35f5789..9a1fa08 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 _0xba77=['define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelApplication.attributes','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xba77,0x100));var _0x7ba7=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xba77[_0x6182ff];return _0x1cec22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ba7('0x0'))(_0x7ba7('0x1'));var moment=require(_0x7ba7('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ba7('0x3'));var fs=require('fs');var path=require(_0x7ba7('0x4'));var rimraf=require(_0x7ba7('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ba7('0x6'));module[_0x7ba7('0x7')]=function(_0x115286,_0x9d74dd){return _0x115286[_0x7ba7('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x7ba7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ba7('0xa'),'collate':_0x7ba7('0xb')});}; \ No newline at end of file +var _0xb9d7=['../../config/logger','api','moment','bluebird','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0xb9d7,0xdf));var _0x7b9d=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb9d7[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x7b9d('0x0'));var util=require(_0x7b9d('0x1'));var logger=require(_0x7b9d('0x2'))(_0x7b9d('0x3'));var moment=require(_0x7b9d('0x4'));var BPromise=require(_0x7b9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9d('0x6'));var rimraf=require(_0x7b9d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b9d('0x8'));module[_0x7b9d('0x9')]=function(_0x53d4b8,_0x84dd75){return _0x53d4b8[_0x7b9d('0xa')](_0x7b9d('0xb'),attributes,{'tableName':_0x7b9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b9d('0xd'),'collate':_0x7b9d('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index edaf778..fbcb01d 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 _0xf464=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x43bfee,_0x40678f){var _0x43c512=function(_0x10eded){while(--_0x10eded){_0x43bfee['push'](_0x43bfee['shift']());}};_0x43c512(++_0x40678f);}(_0xf464,0xeb));var _0x4f46=function(_0x37843f,_0x5c87e6){_0x37843f=_0x37843f-0x0;var _0x11b480=_0xf464[_0x37843f];return _0x11b480;};'use strict';var _=require(_0x4f46('0x0'));var util=require('util');var moment=require(_0x4f46('0x1'));var BPromise=require(_0x4f46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f46('0x3'));var db=require(_0x4f46('0x4'))['db'];var utils=require(_0x4f46('0x5'));var logger=require(_0x4f46('0x6'))(_0x4f46('0x7'));var config=require(_0x4f46('0x8'));var jayson=require(_0x4f46('0x9'));var client=jayson['client'][_0x4f46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1460a1,_0x5dadef,_0x1c9b9d){return new BPromise(function(_0xf0c6d0,_0x57f0c4){return client[_0x4f46('0xb')](_0x1460a1,_0x1c9b9d)[_0x4f46('0xc')](function(_0x2509b2){logger[_0x4f46('0xd')](_0x4f46('0xe'),_0x5dadef,_0x4f46('0xf'));logger['debug'](_0x4f46('0x10'),_0x5dadef,_0x4f46('0xf'),JSON[_0x4f46('0x11')](_0x2509b2));if(_0x2509b2[_0x4f46('0x12')]){if(_0x2509b2[_0x4f46('0x12')][_0x4f46('0x13')]===0x1f4){logger[_0x4f46('0x12')](_0x4f46('0xe'),_0x5dadef,_0x2509b2[_0x4f46('0x12')][_0x4f46('0x14')]);return _0x57f0c4(_0x2509b2[_0x4f46('0x12')]['message']);}logger[_0x4f46('0x12')](_0x4f46('0xe'),_0x5dadef,_0x2509b2['error'][_0x4f46('0x14')]);return _0xf0c6d0(_0x2509b2[_0x4f46('0x12')]['message']);}else{logger[_0x4f46('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x5dadef,'request\x20sent');_0xf0c6d0(_0x2509b2[_0x4f46('0x15')][_0x4f46('0x14')]);}})[_0x4f46('0x16')](function(_0x81432b){logger['error'](_0x4f46('0xe'),_0x5dadef,_0x81432b);_0x57f0c4(_0x81432b);});});}exports[_0x4f46('0x17')]=function(_0x19c9b8){var _0x234f27=this;return new Promise(function(_0x44aafb,_0x1bb12e){return db[_0x4f46('0x18')][_0x4f46('0x19')](_0x19c9b8['body'],{'raw':_0x19c9b8[_0x4f46('0x1a')]?_0x19c9b8['options'][_0x4f46('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19c9b8[_0x4f46('0x1a')]?_0x19c9b8[_0x4f46('0x1a')][_0x4f46('0x1c')]||null:null,'attributes':_0x19c9b8[_0x4f46('0x1a')]?_0x19c9b8[_0x4f46('0x1a')][_0x4f46('0x1d')]||null:null,'limit':_0x19c9b8[_0x4f46('0x1a')]?_0x19c9b8['options']['limit']||null:null})['then'](function(_0x5d57dd){logger[_0x4f46('0xd')](_0x4f46('0x17'),_0x19c9b8);logger['debug'](_0x4f46('0x17'),_0x19c9b8,JSON[_0x4f46('0x11')](_0x5d57dd));_0x44aafb(_0x5d57dd);})['catch'](function(_0x1dfe6e){logger[_0x4f46('0x12')](_0x4f46('0x17'),_0x1dfe6e[_0x4f46('0x14')],_0x19c9b8);_0x1bb12e(_0x234f27[_0x4f46('0x12')](0x1f4,_0x1dfe6e['message']));});});}; \ No newline at end of file +var _0xfd06=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info'];(function(_0x1c5bf7,_0x3e7fb0){var _0x307820=function(_0x4e19d1){while(--_0x4e19d1){_0x1c5bf7['push'](_0x1c5bf7['shift']());}};_0x307820(++_0x3e7fb0);}(_0xfd06,0x1a7));var _0x6fd0=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xfd06[_0x923ab6];return _0x484752;};'use strict';var _=require(_0x6fd0('0x0'));var util=require('util');var moment=require(_0x6fd0('0x1'));var BPromise=require(_0x6fd0('0x2'));var rs=require(_0x6fd0('0x3'));var fs=require('fs');var Redis=require(_0x6fd0('0x4'));var db=require(_0x6fd0('0x5'))['db'];var utils=require(_0x6fd0('0x6'));var logger=require(_0x6fd0('0x7'))('rpc');var config=require(_0x6fd0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x286a76,_0xd0f04c,_0xb10be9){return new BPromise(function(_0x1eab57,_0x5dbe32){return client[_0x6fd0('0x9')](_0x286a76,_0xb10be9)[_0x6fd0('0xa')](function(_0x4e80cd){logger[_0x6fd0('0xb')](_0x6fd0('0xc'),_0xd0f04c,_0x6fd0('0xd'));logger[_0x6fd0('0xe')](_0x6fd0('0xf'),_0xd0f04c,'request\x20sent',JSON[_0x6fd0('0x10')](_0x4e80cd));if(_0x4e80cd[_0x6fd0('0x11')]){if(_0x4e80cd[_0x6fd0('0x11')][_0x6fd0('0x12')]===0x1f4){logger[_0x6fd0('0x11')](_0x6fd0('0xc'),_0xd0f04c,_0x4e80cd[_0x6fd0('0x11')][_0x6fd0('0x13')]);return _0x5dbe32(_0x4e80cd[_0x6fd0('0x11')]['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xd0f04c,_0x4e80cd['error']['message']);return _0x1eab57(_0x4e80cd[_0x6fd0('0x11')][_0x6fd0('0x13')]);}else{logger[_0x6fd0('0xb')](_0x6fd0('0xc'),_0xd0f04c,'request\x20sent');_0x1eab57(_0x4e80cd[_0x6fd0('0x14')]['message']);}})[_0x6fd0('0x15')](function(_0xbc235f){logger[_0x6fd0('0x11')](_0x6fd0('0xc'),_0xd0f04c,_0xbc235f);_0x5dbe32(_0xbc235f);});});}exports[_0x6fd0('0x16')]=function(_0x384d17){var _0x22c9b4=this;return new Promise(function(_0x393e65,_0x3c710d){return db[_0x6fd0('0x17')][_0x6fd0('0x18')](_0x384d17[_0x6fd0('0x19')],{'raw':_0x384d17['options']?_0x384d17[_0x6fd0('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384d17[_0x6fd0('0x1a')]?_0x384d17['options']['where']||null:null,'attributes':_0x384d17['options']?_0x384d17['options'][_0x6fd0('0x1b')]||null:null,'limit':_0x384d17[_0x6fd0('0x1a')]?_0x384d17[_0x6fd0('0x1a')][_0x6fd0('0x1c')]||null:null})[_0x6fd0('0xa')](function(_0xafc1d){logger[_0x6fd0('0xb')](_0x6fd0('0x16'),_0x384d17);logger[_0x6fd0('0xe')](_0x6fd0('0x16'),_0x384d17,JSON[_0x6fd0('0x10')](_0xafc1d));_0x393e65(_0xafc1d);})[_0x6fd0('0x15')](function(_0x512004){logger[_0x6fd0('0x11')](_0x6fd0('0x16'),_0x512004[_0x6fd0('0x13')],_0x384d17);_0x3c710d(_0x22c9b4[_0x6fd0('0x11')](0x1f4,_0x512004[_0x6fd0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 260c46e..de3ca3a 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 _0x337b=['/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','../../config/environment','./openchannelInteraction.controller','index','/describe','isAuthenticated','describe','/:id','get'];(function(_0x1324f1,_0x23c1dd){var _0x1e4e9c=function(_0x22bd5c){while(--_0x22bd5c){_0x1324f1['push'](_0x1324f1['shift']());}};_0x1e4e9c(++_0x23c1dd);}(_0x337b,0x102));var _0xb337=function(_0x4f7683,_0x233e4c){_0x4f7683=_0x4f7683-0x0;var _0x4a25d6=_0x337b[_0x4f7683];return _0x4a25d6;};'use strict';var multer=require(_0xb337('0x0'));var util=require(_0xb337('0x1'));var path=require(_0xb337('0x2'));var timeout=require(_0xb337('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb337('0x4'));var controller=require(_0xb337('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb337('0x6')]);router['get'](_0xb337('0x7'),auth[_0xb337('0x8')](),controller[_0xb337('0x9')]);router['get'](_0xb337('0xa'),auth[_0xb337('0x8')](),controller['show']);router[_0xb337('0xb')](_0xb337('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb337('0xd'),auth[_0xb337('0x8')](),controller['download']);router[_0xb337('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb337('0xe')](_0xb337('0xc'),auth[_0xb337('0x8')](),controller[_0xb337('0xf')]);router[_0xb337('0xe')](_0xb337('0x10'),auth['isAuthenticated'](),interaction[_0xb337('0x11')](_0xb337('0x12'),_0xb337('0x13')),controller[_0xb337('0x14')]);router[_0xb337('0x15')](_0xb337('0xa'),auth[_0xb337('0x8')](),interaction[_0xb337('0x11')](_0xb337('0x12'),_0xb337('0x16')),controller[_0xb337('0x17')]);router[_0xb337('0x18')](_0xb337('0xa'),auth[_0xb337('0x8')](),interaction[_0xb337('0x11')](_0xb337('0x12'),'openchannelinteraction:destroy'),controller[_0xb337('0x19')]);router[_0xb337('0x18')](_0xb337('0x10'),auth['isAuthenticated'](),controller[_0xb337('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xefcd=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','put','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','/:id/messages'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xefcd,0x1a3));var _0xdefc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefcd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdefc('0x0'));var util=require(_0xdefc('0x1'));var path=require(_0xdefc('0x2'));var timeout=require(_0xdefc('0x3'));var express=require(_0xdefc('0x4'));var router=express[_0xdefc('0x5')]();var fs_extra=require(_0xdefc('0x6'));var auth=require(_0xdefc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xdefc('0x8')]('/',auth[_0xdefc('0x9')](),controller[_0xdefc('0xa')]);router['get']('/describe',auth[_0xdefc('0x9')](),controller[_0xdefc('0xb')]);router[_0xdefc('0x8')](_0xdefc('0xc'),auth[_0xdefc('0x9')](),controller[_0xdefc('0xd')]);router[_0xdefc('0x8')](_0xdefc('0xe'),auth[_0xdefc('0x9')](),controller[_0xdefc('0xf')]);router[_0xdefc('0x8')](_0xdefc('0x10'),auth['isAuthenticated'](),controller[_0xdefc('0x11')]);router[_0xdefc('0x12')]('/',auth['isAuthenticated'](),controller[_0xdefc('0x13')]);router[_0xdefc('0x12')](_0xdefc('0xe'),auth[_0xdefc('0x9')](),controller[_0xdefc('0x14')]);router[_0xdefc('0x12')](_0xdefc('0x15'),auth['isAuthenticated'](),interaction[_0xdefc('0x16')](_0xdefc('0x17'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xdefc('0x18')]('/:id',auth[_0xdefc('0x9')](),interaction[_0xdefc('0x16')](_0xdefc('0x17'),_0xdefc('0x19')),controller['update']);router['delete'](_0xdefc('0xc'),auth['isAuthenticated'](),interaction[_0xdefc('0x16')]('openchannel',_0xdefc('0x1a')),controller[_0xdefc('0x1b')]);router[_0xdefc('0x1c')](_0xdefc('0x15'),auth['isAuthenticated'](),controller[_0xdefc('0x1d')]);module[_0xdefc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 146b9c6..88615f6 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 _0xdb76=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x5ba232,_0x2d07cd){var _0x5f062d=function(_0x533cfc){while(--_0x533cfc){_0x5ba232['push'](_0x5ba232['shift']());}};_0x5f062d(++_0x2d07cd);}(_0xdb76,0x1be));var _0x6db7=function(_0x223531,_0x2c6052){_0x223531=_0x223531-0x0;var _0x1607a9=_0xdb76[_0x223531];return _0x1607a9;};'use strict';var Sequelize=require(_0x6db7('0x0'));module[_0x6db7('0x1')]={'closed':{'type':Sequelize[_0x6db7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6db7('0x3')]},'disposition':{'type':Sequelize[_0x6db7('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6db7('0x4')]},'note':{'type':Sequelize[_0x6db7('0x4')]},'read1stAt':{'type':Sequelize[_0x6db7('0x3')]},'threadId':{'type':Sequelize[_0x6db7('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6db7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6db7('0x5')]('in',_0x6db7('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6db7('0x5')]('in',_0x6db7('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x6db7('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x195e=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x195e,0xfb));var _0xe195=function(_0x397999,_0x481dee){_0x397999=_0x397999-0x0;var _0x21939e=_0x195e[_0x397999];return _0x21939e;};'use strict';var Sequelize=require(_0xe195('0x0'));module[_0xe195('0x1')]={'closed':{'type':Sequelize[_0xe195('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe195('0x3')]},'disposition':{'type':Sequelize[_0xe195('0x4')]},'secondDisposition':{'type':Sequelize[_0xe195('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe195('0x4')]},'note':{'type':Sequelize[_0xe195('0x4')]},'read1stAt':{'type':Sequelize[_0xe195('0x3')]},'threadId':{'type':Sequelize[_0xe195('0x4')]},'externalUrl':{'type':Sequelize[_0xe195('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe195('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe195('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe195('0x5')]('in',_0xe195('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe195('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe195('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a1fa601..6af1ccf 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 _0x3fab=['keys','OpenchannelInteraction','intersection','model','attributes','fields','length','merge','find','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','format','closedAt','Public','Private','existsSync','createReadStream','createWriteStream','basename','System','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','limit','undefined','count','offset','set','Content-Range','then','error','stack','name','index','map','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','catch','show','from','params'];(function(_0x23a9b0,_0x48f680){var _0x555f45=function(_0x12a58a){while(--_0x12a58a){_0x23a9b0['push'](_0x23a9b0['shift']());}};_0x555f45(++_0x48f680);}(_0x3fab,0x1ef));var _0xb3fa=function(_0x1710e4,_0x593dd6){_0x1710e4=_0x1710e4-0x0;var _0x9aa2ac=_0x3fab[_0x1710e4];return _0x9aa2ac;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb3fa('0x0'));var moment=require(_0xb3fa('0x1'));var util=require(_0xb3fa('0x2'));var path=require(_0xb3fa('0x3'));var ejs=require(_0xb3fa('0x4'));var fs=require('fs');var _=require(_0xb3fa('0x5'));var Redis=require(_0xb3fa('0x6'));var interaction=require(_0xb3fa('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xb3fa('0x8'))(_0xb3fa('0x9'));var config=require(_0xb3fa('0xa'));var db=require(_0xb3fa('0xb'))['db'];config[_0xb3fa('0xc')]=_[_0xb3fa('0xd')](config[_0xb3fa('0xc')],{'host':_0xb3fa('0xe'),'port':0x18eb});var socket=require(_0xb3fa('0xf'))(new Redis(config[_0xb3fa('0xc')]));require(_0xb3fa('0x10'))[_0xb3fa('0x11')](socket);function respondWithStatusCode(_0x68fd76,_0x2d7a64){_0x2d7a64=_0x2d7a64||0xcc;return function(_0xd01d0b){if(_0xd01d0b){return _0x68fd76['sendStatus'](_0x2d7a64);}return _0x68fd76[_0xb3fa('0x12')](_0x2d7a64)[_0xb3fa('0x13')]();};}function respondWithResult(_0x57e1f1,_0x109879){_0x109879=_0x109879||0xc8;return function(_0x3a13b2){if(_0x3a13b2){return _0x57e1f1[_0xb3fa('0x12')](_0x109879)[_0xb3fa('0x14')](_0x3a13b2);}};}function respondWithFilteredResult(_0x38508,_0x2cb049){return function(_0x211532){if(_0x211532){var _0x21fb2c=typeof _0x2cb049['offset']==='undefined'&&typeof _0x2cb049[_0xb3fa('0x15')]===_0xb3fa('0x16');var _0x16af0e=_0x211532[_0xb3fa('0x17')];var _0x3de3f7=_0x21fb2c?0x0:_0x2cb049[_0xb3fa('0x18')];var _0x915891=_0x21fb2c?_0x211532[_0xb3fa('0x17')]:_0x2cb049[_0xb3fa('0x18')]+_0x2cb049[_0xb3fa('0x15')];var _0x22f674;if(_0x915891>=_0x16af0e){_0x915891=_0x16af0e;_0x22f674=0xc8;}else{_0x22f674=0xce;}_0x38508['status'](_0x22f674);return _0x38508[_0xb3fa('0x19')](_0xb3fa('0x1a'),_0x3de3f7+'-'+_0x915891+'/'+_0x16af0e)[_0xb3fa('0x14')](_0x211532);}return null;};}function saveUpdates(_0x363e98){return function(_0x3392c4){if(_0x3392c4){return _0x3392c4['update'](_0x363e98)[_0xb3fa('0x1b')](function(_0x2628eb){return _0x2628eb;});}return null;};}function removeEntity(_0x6280f7){return function(_0x5703e8){if(_0x5703e8){return _0x5703e8['destroy']()[_0xb3fa('0x1b')](function(){_0x6280f7['status'](0xcc)[_0xb3fa('0x13')]();});}};}function handleEntityNotFound(_0x1a788d){return function(_0x2f48ef){if(!_0x2f48ef){_0x1a788d['sendStatus'](0x194);}return _0x2f48ef;};}function handleError(_0x142b85,_0x580f6e){_0x580f6e=_0x580f6e||0x1f4;return function(_0x1b5c17){logger[_0xb3fa('0x1c')](_0x1b5c17[_0xb3fa('0x1d')]);if(_0x1b5c17[_0xb3fa('0x1e')]){delete _0x1b5c17[_0xb3fa('0x1e')];}_0x142b85[_0xb3fa('0x12')](_0x580f6e)['send'](_0x1b5c17);};}exports[_0xb3fa('0x1f')]=function(_0x57730e,_0x2eb28e){var _0x42d88a={};var _0x5a85ac=_[_0xb3fa('0x20')](db['OpenchannelInteraction'][_0xb3fa('0x21')],function(_0x413e4b){return{'name':_0x413e4b[_0xb3fa('0x22')],'type':_0x413e4b[_0xb3fa('0x23')]['key']};});_0x42d88a=qs[_0xb3fa('0x24')](_0x5a85ac,_0x57730e);return interaction[_0xb3fa('0x25')](_0xb3fa('0x26'),_0x57730e[_0xb3fa('0x27')],_0x57730e[_0xb3fa('0x28')],_0x42d88a,_0x5a85ac)[_0xb3fa('0x1b')](respondWithFilteredResult(_0x2eb28e,_0x42d88a))[_0xb3fa('0x29')](handleError(_0x2eb28e,null));};exports[_0xb3fa('0x2a')]=function(_0x345b49,_0x1cda21){var _0x1c0051={};if(_0x345b49[_0xb3fa('0x27')][_0xb3fa('0x23')]&&_0x345b49[_0xb3fa('0x27')][_0xb3fa('0x23')]===_0xb3fa('0x2b')){_0x1c0051[_0xb3fa('0x2b')]=_0x345b49[_0xb3fa('0x2c')]['id'];}else{_0x1c0051['id']=_0x345b49[_0xb3fa('0x2c')]['id'];}var _0x379cfe={'raw':![],'where':_0x1c0051},_0x2c8060={};_0x2c8060['model']=_[_0xb3fa('0x2d')](db[_0xb3fa('0x2e')][_0xb3fa('0x21')]);_0x2c8060[_0xb3fa('0x27')]=_[_0xb3fa('0x2d')](_0x345b49[_0xb3fa('0x27')]);_0x2c8060['filters']=_[_0xb3fa('0x2f')](_0x2c8060[_0xb3fa('0x30')],_0x2c8060[_0xb3fa('0x27')]);_0x379cfe[_0xb3fa('0x31')]=_[_0xb3fa('0x2f')](_0x2c8060['model'],qs[_0xb3fa('0x32')](_0x345b49['query']['fields']));_0x379cfe[_0xb3fa('0x31')]=_0x379cfe[_0xb3fa('0x31')][_0xb3fa('0x33')]?_0x379cfe[_0xb3fa('0x31')]:_0x2c8060[_0xb3fa('0x30')];if(_0x345b49[_0xb3fa('0x27')]['includeAll']){_0x379cfe['include']=[{'all':!![]}];}_0x379cfe=_[_0xb3fa('0x34')]({},_0x379cfe,_0x345b49['options']);return db[_0xb3fa('0x2e')][_0xb3fa('0x35')](_0x379cfe)[_0xb3fa('0x1b')](handleEntityNotFound(_0x1cda21,null))[_0xb3fa('0x1b')](respondWithResult(_0x1cda21,null))[_0xb3fa('0x29')](handleError(_0x1cda21,null));};exports['create']=function(_0x1fde16,_0xcab93){return db[_0xb3fa('0x2e')][_0xb3fa('0x36')](_0x1fde16[_0xb3fa('0x37')],{})[_0xb3fa('0x1b')](respondWithResult(_0xcab93,0xc9))[_0xb3fa('0x29')](handleError(_0xcab93,null));};exports['update']=function(_0x3ed8cb,_0xdab2d9){if(_0x3ed8cb['body']['id']){delete _0x3ed8cb['body']['id'];}return db['OpenchannelInteraction'][_0xb3fa('0x35')]({'where':{'id':_0x3ed8cb[_0xb3fa('0x2c')]['id']}})[_0xb3fa('0x1b')](handleEntityNotFound(_0xdab2d9,null))[_0xb3fa('0x1b')](saveUpdates(_0x3ed8cb[_0xb3fa('0x37')],null))['then'](respondWithResult(_0xdab2d9,null))[_0xb3fa('0x29')](handleError(_0xdab2d9,null));};exports[_0xb3fa('0x38')]=function(_0x1e513d,_0x1cbc8a){return db[_0xb3fa('0x2e')][_0xb3fa('0x35')]({'where':{'id':_0x1e513d['params']['id']}})['then'](handleEntityNotFound(_0x1cbc8a,null))[_0xb3fa('0x1b')](removeEntity(_0x1cbc8a,null))['catch'](handleError(_0x1cbc8a,null));};exports[_0xb3fa('0x39')]=function(_0x3476f4,_0x5da8e5){return db[_0xb3fa('0x2e')][_0xb3fa('0x39')]()['then'](respondWithResult(_0x5da8e5,null))[_0xb3fa('0x29')](handleError(_0x5da8e5,null));};exports[_0xb3fa('0x3a')]=function(_0x9e13c8,_0x5dc345){return db[_0xb3fa('0x3b')][_0xb3fa('0x35')]({'where':{'id':_0x9e13c8[_0xb3fa('0x2c')]['id']}})[_0xb3fa('0x1b')](handleEntityNotFound(_0x5dc345,null))[_0xb3fa('0x1b')](function(_0x2ab313){if(_0x2ab313){return _0x2ab313[_0xb3fa('0x3a')](_0x9e13c8[_0xb3fa('0x37')][_0xb3fa('0x3c')],_[_0xb3fa('0x3d')](_0x9e13c8[_0xb3fa('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x5dc345,null))[_0xb3fa('0x29')](handleError(_0x5dc345,null));};exports[_0xb3fa('0x3e')]=function(_0x58e25d,_0x306dc3){var _0x2f35e1={'raw':![],'where':{}};var _0xfbad1a={};var _0x1b9551={'count':0x0,'rows':[]};return db[_0xb3fa('0x2e')][_0xb3fa('0x3f')]({'where':{'id':_0x58e25d[_0xb3fa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x306dc3,null))[_0xb3fa('0x1b')](function(_0xbe452b){if(_0xbe452b){_0xfbad1a[_0xb3fa('0x30')]=_[_0xb3fa('0x2d')](db[_0xb3fa('0x3b')][_0xb3fa('0x21')]);_0xfbad1a[_0xb3fa('0x27')]=_[_0xb3fa('0x2d')](_0x58e25d['query']);_0xfbad1a[_0xb3fa('0x40')]=_[_0xb3fa('0x2f')](_0xfbad1a[_0xb3fa('0x30')],_0xfbad1a[_0xb3fa('0x27')]);_0x2f35e1['attributes']=_[_0xb3fa('0x2f')](_0xfbad1a[_0xb3fa('0x30')],qs['fields'](_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x32')]));_0x2f35e1[_0xb3fa('0x31')]=_0x2f35e1[_0xb3fa('0x31')][_0xb3fa('0x33')]?_0x2f35e1[_0xb3fa('0x31')]:_0xfbad1a[_0xb3fa('0x30')];if(!_0x58e25d['query'][_0xb3fa('0x41')](_0xb3fa('0x42'))){_0x2f35e1['limit']=qs['limit'](_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x15')]);_0x2f35e1[_0xb3fa('0x18')]=qs[_0xb3fa('0x18')](_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x18')]);}_0x2f35e1[_0xb3fa('0x43')]=qs[_0xb3fa('0x44')](_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x44')]);_0x2f35e1[_0xb3fa('0x45')]=qs[_0xb3fa('0x40')](_[_0xb3fa('0x46')](_0x58e25d[_0xb3fa('0x27')],_0xfbad1a['filters']));_0x2f35e1['where'][_0xb3fa('0x47')]=_0xbe452b['id'];if(_0x58e25d[_0xb3fa('0x27')]['filter']){_0x2f35e1[_0xb3fa('0x45')]=_['merge'](_0x2f35e1[_0xb3fa('0x45')],{'$or':_[_0xb3fa('0x20')](_0x2f35e1[_0xb3fa('0x31')],function(_0x5d5116){var _0x3ce32a={};_0x3ce32a[_0x5d5116]={'$like':'%'+_0x58e25d['query'][_0xb3fa('0x48')]+'%'};return _0x3ce32a;})});}if(_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x49')]){var _0x51d70a=_0x58e25d['query'][_0xb3fa('0x49')][_0xb3fa('0x4a')](',');var _0x36971c={};_0x36971c[_0x51d70a[0x0]]={'$gte':moment(_0x51d70a[0x1])['format'](_0xb3fa('0x4b'))};_0x2f35e1[_0xb3fa('0x45')]=_['merge'](_0x2f35e1[_0xb3fa('0x45')],_0x36971c);}_0x2f35e1=_[_0xb3fa('0x34')]({},_0x2f35e1,_0x58e25d[_0xb3fa('0x4c')]);return db[_0xb3fa('0x3b')][_0xb3fa('0x17')]({'where':_0x2f35e1[_0xb3fa('0x45')]})[_0xb3fa('0x1b')](function(_0x1a513e){_0x1b9551[_0xb3fa('0x17')]=_0x1a513e;if(_0x58e25d[_0xb3fa('0x27')][_0xb3fa('0x4d')]){_0x2f35e1[_0xb3fa('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x2f35e1);})[_0xb3fa('0x1b')](function(_0x194fe0){_0x1b9551[_0xb3fa('0x4f')]=_0x194fe0;return _0x1b9551;});}})['then'](respondWithFilteredResult(_0x306dc3,_0x2f35e1))[_0xb3fa('0x29')](handleError(_0x306dc3,null));};exports[_0xb3fa('0x50')]=function(_0x2d1446,_0x37be7a){return db[_0xb3fa('0x2e')][_0xb3fa('0x35')]({'where':{'id':_0x2d1446['params']['id']}})[_0xb3fa('0x1b')](handleEntityNotFound(_0x37be7a,null))[_0xb3fa('0x1b')](function(_0x4cc8db){if(_0x4cc8db){return _0x4cc8db[_0xb3fa('0x51')](_0x2d1446[_0xb3fa('0x37')][_0xb3fa('0x3c')],_[_0xb3fa('0x3d')](_0x2d1446['body'],[_0xb3fa('0x3c'),'id'])||{})[_0xb3fa('0x52')](function(){return db['Tag']['findAll']({'attributes':['id',_0xb3fa('0x1e'),_0xb3fa('0x53')],'where':{'id':_0x2d1446['body'][_0xb3fa('0x3c')]}});})[_0xb3fa('0x1b')](function(_0x477af0){socket[_0xb3fa('0x54')](_0xb3fa('0x55'),{'id':Number(_0x2d1446[_0xb3fa('0x2c')]['id']),'tags':_0x477af0||[]});return{'id':Number(_0x2d1446[_0xb3fa('0x2c')]['id']),'tags':_0x477af0||[]};});}})[_0xb3fa('0x1b')](respondWithResult(_0x37be7a,null))[_0xb3fa('0x29')](handleError(_0x37be7a,null));};exports[_0xb3fa('0x56')]=function(_0x38ca34,_0x23d004){return db['OpenchannelInteraction'][_0xb3fa('0x35')]({'where':{'id':_0x38ca34[_0xb3fa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x23d004,null))[_0xb3fa('0x1b')](function(_0x481d98){if(_0x481d98){return _0x481d98[_0xb3fa('0x56')](_0x38ca34[_0xb3fa('0x27')][_0xb3fa('0x3c')]);}})[_0xb3fa('0x1b')](respondWithStatusCode(_0x23d004,null))[_0xb3fa('0x29')](handleError(_0x23d004,null));};exports[_0xb3fa('0x57')]=function(_0x251a6e,_0x2d4fc3){var _0x184d0c=moment()[_0xb3fa('0x58')]()[_0xb3fa('0x59')]();var _0x5d1f34=path[_0xb3fa('0x5a')](config[_0xb3fa('0x5b')],'server',_0xb3fa('0x5c'),_0xb3fa('0x5d'));var _0x29d2a2=path['join'](config['root'],_0xb3fa('0x5e'),_0xb3fa('0x5c'),_0xb3fa('0x5f'));var _0x477c1e=path[_0xb3fa('0x5a')](_0x5d1f34,_0x184d0c);var _0x3fc217=util['format'](_0xb3fa('0x60'),_0x251a6e[_0xb3fa('0x2c')]['id'],_0x184d0c);var _0x3b1946=path[_0xb3fa('0x5a')](_0x5d1f34,_0x3fc217);var _0x25b9a5=[];_0x25b9a5['push']({'model':db[_0xb3fa('0x61')],'as':'User','attributes':['id',_0xb3fa('0x62')],'raw':!![]});_0x25b9a5[_0xb3fa('0x63')]({'model':db[_0xb3fa('0x64')],'as':_0xb3fa('0x65'),'attributes':['id',_0xb3fa('0x66'),_0xb3fa('0x67')],'raw':!![]});if(_0x251a6e[_0xb3fa('0x27')]['attachments']){_0x25b9a5[_0xb3fa('0x63')]({'model':db[_0xb3fa('0x68')],'as':_0xb3fa('0x68'),'raw':!![]});}var _0x423a68=[{'model':db[_0xb3fa('0x3b')],'as':_0xb3fa('0x69'),'attributes':['id',_0xb3fa('0x37'),_0xb3fa('0x6a'),_0xb3fa('0x6b'),_0xb3fa('0x6c'),_0xb3fa('0x6d')],'include':_0x25b9a5}];_0x423a68[_0xb3fa('0x63')]({'model':db[_0xb3fa('0x6e')],'as':_0xb3fa('0x6f'),'attributes':['id',_0xb3fa('0x1e')]});_0x423a68[_0xb3fa('0x63')]({'model':db[_0xb3fa('0x61')],'as':_0xb3fa('0x70'),'attributes':['id',_0xb3fa('0x62')]});return db['OpenchannelInteraction'][_0xb3fa('0x35')]({'where':{'id':_0x251a6e[_0xb3fa('0x2c')]['id']},'include':_0x423a68})[_0xb3fa('0x1b')](handleEntityNotFound(_0x2d4fc3,null))[_0xb3fa('0x1b')](function(_0x410f0b){if(_0x410f0b){var _0x5a78ee=_0x410f0b[_0xb3fa('0x71')]({'plain':!![]});fs[_0xb3fa('0x72')](_0x477c1e);var _0x42f906={'channel':_0xb3fa('0x73'),'account':_0x5a78ee[_0xb3fa('0x6f')]['name'],'agent':_0x5a78ee[_0xb3fa('0x70')]?_0x5a78ee['Owner']['fullname']:_0xb3fa('0x74'),'createdAt':moment(_0x5a78ee['createdAt'])[_0xb3fa('0x75')](_0xb3fa('0x4b'))[_0xb3fa('0x59')](),'closedAt':_0x5a78ee['closed']?moment(_0x5a78ee[_0xb3fa('0x76')])[_0xb3fa('0x75')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb3fa('0x59')]():'','disposition':_0x5a78ee['disposition'],'visibility':_0x5a78ee['threadId']?_0xb3fa('0x77'):_0xb3fa('0x78'),'messages':_(_0x5a78ee[_0xb3fa('0x69')])[_0xb3fa('0x48')]({'secret':![]})['map'](function(_0x262fd3){if(_0x262fd3['Attachment']){var _0x40a89f=path[_0xb3fa('0x5a')](_0x29d2a2,_0x262fd3[_0xb3fa('0x68')]['basename']);if(fs[_0xb3fa('0x79')](_0x40a89f)){fs[_0xb3fa('0x7a')](_0x40a89f)['pipe'](fs[_0xb3fa('0x7b')](path[_0xb3fa('0x5a')](_0x477c1e,_0x262fd3[_0xb3fa('0x68')][_0xb3fa('0x7c')])));}}return{'date':moment(_0x262fd3[_0xb3fa('0x6a')])[_0xb3fa('0x75')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x262fd3['direction']==='out'?_0x262fd3[_0xb3fa('0x61')]?_0x262fd3['User']['fullname']:_0xb3fa('0x7d'):_0x262fd3[_0xb3fa('0x65')][_0xb3fa('0x66')]+(_0x262fd3[_0xb3fa('0x65')][_0xb3fa('0x67')]?'\x20'+_0x262fd3[_0xb3fa('0x65')][_0xb3fa('0x67')]:''),'body':_0x262fd3['Attachment']?_0x262fd3[_0xb3fa('0x68')][_0xb3fa('0x7c')]:_0x262fd3['body'],'direction':_0x262fd3[_0xb3fa('0x6b')]===_0xb3fa('0x7e')?'A':'C','secret':_0x262fd3[_0xb3fa('0x6c')],'read':_0x262fd3['read'],'attachment':_0x262fd3[_0xb3fa('0x68')]};})['value']()};return ejs[_0xb3fa('0x7f')](path[_0xb3fa('0x5a')](config['root'],'server',_0xb3fa('0x80'),_0xb3fa('0x81')),{'interaction':_0x42f906})[_0xb3fa('0x1b')](function(_0x5c5c0c){var _0x160317=path['join'](_0x477c1e,'transcript-'+_0x5a78ee['id']+'-'+_0x184d0c+_0xb3fa('0x82'));var _0x28bb60={'path':_0x160317,'channel':_0xb3fa('0x73'),'interactionId':_0x5a78ee['id']};return pdf[_0xb3fa('0x83')](_0x5c5c0c,_0x28bb60);})[_0xb3fa('0x1b')](function(){return new Promise(function(_0x2fab23,_0x1d8bf3){zipdir(_0x477c1e,{'saveTo':_0x3b1946},function(_0x3528d9,_0x482305){if(_0x3528d9)return _0x1d8bf3(_0x3528d9);return _0x2fab23(_0x482305);});})[_0xb3fa('0x1b')](function(){return new Promise(function(_0x4f4095,_0x43febe){rimraf(_0x477c1e,function(_0x3a61c6){if(_0x3a61c6)_0x43febe(_0x3a61c6);return _0x4f4095();});});})[_0xb3fa('0x1b')](function(){return _0x2d4fc3[_0xb3fa('0x57')](_0x3b1946,_0x3fc217,function(_0x25a34b){if(_0x25a34b){logger[_0xb3fa('0x1c')](_0xb3fa('0x84'),_0x25a34b);}else{fs[_0xb3fa('0x85')](_0x3b1946);}});});});}else{return _0x2d4fc3[_0xb3fa('0x86')](0xc8);}})['catch'](handleError(_0x2d4fc3,null));}; \ No newline at end of file +var _0x5257=['create','body','update','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','ids','spread','Tag','name','emit','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','createdAt','direction','read','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','firstName','lastName','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','index','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','show','from','params','keys','OpenchannelInteraction','filters','model','intersection','fields','attributes','length','includeAll','merge','options','find','catch'];(function(_0x1efe26,_0x4447bc){var _0x596899=function(_0xff22a0){while(--_0xff22a0){_0x1efe26['push'](_0x1efe26['shift']());}};_0x596899(++_0x4447bc);}(_0x5257,0x146));var _0x7525=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5257[_0x2e4e19];return _0x9ba20b;};'use strict';var rimraf=require(_0x7525('0x0'));var zipdir=require(_0x7525('0x1'));var moment=require(_0x7525('0x2'));var util=require('util');var path=require(_0x7525('0x3'));var ejs=require(_0x7525('0x4'));var fs=require('fs');var _=require(_0x7525('0x5'));var Redis=require(_0x7525('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x7525('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x7525('0x8'))(_0x7525('0x9'));var config=require(_0x7525('0xa'));var db=require('../../mysqldb')['db'];config[_0x7525('0xb')]=_['defaults'](config[_0x7525('0xb')],{'host':_0x7525('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7525('0xd'))[_0x7525('0xe')](socket);function respondWithStatusCode(_0x5c4fab,_0x233d82){_0x233d82=_0x233d82||0xcc;return function(_0x2819a8){if(_0x2819a8){return _0x5c4fab[_0x7525('0xf')](_0x233d82);}return _0x5c4fab[_0x7525('0x10')](_0x233d82)[_0x7525('0x11')]();};}function respondWithResult(_0x3badec,_0x2032da){_0x2032da=_0x2032da||0xc8;return function(_0x14f999){if(_0x14f999){return _0x3badec[_0x7525('0x10')](_0x2032da)[_0x7525('0x12')](_0x14f999);}};}function respondWithFilteredResult(_0x57b200,_0x5b9df9){return function(_0x23fa3d){if(_0x23fa3d){var _0xb6f058=typeof _0x5b9df9[_0x7525('0x13')]===_0x7525('0x14')&&typeof _0x5b9df9[_0x7525('0x15')]===_0x7525('0x14');var _0x141d25=_0x23fa3d[_0x7525('0x16')];var _0x183597=_0xb6f058?0x0:_0x5b9df9[_0x7525('0x13')];var _0x440f61=_0xb6f058?_0x23fa3d[_0x7525('0x16')]:_0x5b9df9[_0x7525('0x13')]+_0x5b9df9[_0x7525('0x15')];var _0x57b639;if(_0x440f61>=_0x141d25){_0x440f61=_0x141d25;_0x57b639=0xc8;}else{_0x57b639=0xce;}_0x57b200['status'](_0x57b639);return _0x57b200[_0x7525('0x17')](_0x7525('0x18'),_0x183597+'-'+_0x440f61+'/'+_0x141d25)['json'](_0x23fa3d);}return null;};}function saveUpdates(_0x88445a){return function(_0x43b3c4){if(_0x43b3c4){return _0x43b3c4['update'](_0x88445a)[_0x7525('0x19')](function(_0x1e00bc){return _0x1e00bc;});}return null;};}function removeEntity(_0xb34dec){return function(_0x4868d4){if(_0x4868d4){return _0x4868d4[_0x7525('0x1a')]()[_0x7525('0x19')](function(){_0xb34dec[_0x7525('0x10')](0xcc)[_0x7525('0x11')]();});}};}function handleEntityNotFound(_0xe5d061){return function(_0xeb64b9){if(!_0xeb64b9){_0xe5d061[_0x7525('0xf')](0x194);}return _0xeb64b9;};}function handleError(_0x2c090e,_0x597107){_0x597107=_0x597107||0x1f4;return function(_0x7e560b){logger[_0x7525('0x1b')](_0x7e560b[_0x7525('0x1c')]);if(_0x7e560b['name']){delete _0x7e560b['name'];}_0x2c090e['status'](_0x597107)['send'](_0x7e560b);};}exports[_0x7525('0x1d')]=function(_0xe4ea03,_0x2f1f6c){var _0x49914f={};var _0x13847a=_[_0x7525('0x1e')](db['OpenchannelInteraction'][_0x7525('0x1f')],function(_0x35ed34){return{'name':_0x35ed34[_0x7525('0x20')],'type':_0x35ed34[_0x7525('0x21')][_0x7525('0x22')]};});_0x49914f=qs[_0x7525('0x23')](_0x13847a,_0xe4ea03);return interaction['findAll'](_0x7525('0x24'),_0xe4ea03[_0x7525('0x25')],_0xe4ea03[_0x7525('0x26')],_0x49914f,_0x13847a)['then'](respondWithFilteredResult(_0x2f1f6c,_0x49914f))['catch'](handleError(_0x2f1f6c,null));};exports[_0x7525('0x27')]=function(_0x3cf763,_0xb675ab){var _0x3e42e9={};if(_0x3cf763[_0x7525('0x25')]['type']&&_0x3cf763[_0x7525('0x25')][_0x7525('0x21')]===_0x7525('0x28')){_0x3e42e9[_0x7525('0x28')]=_0x3cf763[_0x7525('0x29')]['id'];}else{_0x3e42e9['id']=_0x3cf763['params']['id'];}var _0x953a0={'raw':![],'where':_0x3e42e9},_0x1427d3={};_0x1427d3['model']=_[_0x7525('0x2a')](db[_0x7525('0x2b')]['rawAttributes']);_0x1427d3[_0x7525('0x25')]=_[_0x7525('0x2a')](_0x3cf763[_0x7525('0x25')]);_0x1427d3[_0x7525('0x2c')]=_['intersection'](_0x1427d3[_0x7525('0x2d')],_0x1427d3['query']);_0x953a0['attributes']=_[_0x7525('0x2e')](_0x1427d3[_0x7525('0x2d')],qs[_0x7525('0x2f')](_0x3cf763[_0x7525('0x25')]['fields']));_0x953a0[_0x7525('0x30')]=_0x953a0[_0x7525('0x30')][_0x7525('0x31')]?_0x953a0[_0x7525('0x30')]:_0x1427d3[_0x7525('0x2d')];if(_0x3cf763[_0x7525('0x25')][_0x7525('0x32')]){_0x953a0['include']=[{'all':!![]}];}_0x953a0=_[_0x7525('0x33')]({},_0x953a0,_0x3cf763[_0x7525('0x34')]);return db['OpenchannelInteraction'][_0x7525('0x35')](_0x953a0)['then'](handleEntityNotFound(_0xb675ab,null))[_0x7525('0x19')](respondWithResult(_0xb675ab,null))[_0x7525('0x36')](handleError(_0xb675ab,null));};exports[_0x7525('0x37')]=function(_0x4ee0b0,_0x5b0e5e){return db[_0x7525('0x2b')]['create'](_0x4ee0b0[_0x7525('0x38')],{})[_0x7525('0x19')](respondWithResult(_0x5b0e5e,0xc9))['catch'](handleError(_0x5b0e5e,null));};exports[_0x7525('0x39')]=function(_0x5ca944,_0x424f9d){if(_0x5ca944[_0x7525('0x38')]['id']){delete _0x5ca944[_0x7525('0x38')]['id'];}return db[_0x7525('0x2b')][_0x7525('0x35')]({'where':{'id':_0x5ca944['params']['id']}})[_0x7525('0x19')](handleEntityNotFound(_0x424f9d,null))[_0x7525('0x19')](saveUpdates(_0x5ca944[_0x7525('0x38')],null))['then'](respondWithResult(_0x424f9d,null))[_0x7525('0x36')](handleError(_0x424f9d,null));};exports['destroy']=function(_0x2085c7,_0x363fce){return db[_0x7525('0x2b')][_0x7525('0x35')]({'where':{'id':_0x2085c7[_0x7525('0x29')]['id']}})['then'](handleEntityNotFound(_0x363fce,null))[_0x7525('0x19')](removeEntity(_0x363fce,null))[_0x7525('0x36')](handleError(_0x363fce,null));};exports[_0x7525('0x3a')]=function(_0x27ae07,_0x5053fd){return db[_0x7525('0x2b')][_0x7525('0x3a')]()['then'](respondWithResult(_0x5053fd,null))['catch'](handleError(_0x5053fd,null));};exports[_0x7525('0x3b')]=function(_0x27ec18,_0x401482){return db[_0x7525('0x3c')][_0x7525('0x35')]({'where':{'id':_0x27ec18[_0x7525('0x29')]['id']}})[_0x7525('0x19')](handleEntityNotFound(_0x401482,null))[_0x7525('0x19')](function(_0x44320b){if(_0x44320b){return _0x44320b[_0x7525('0x3b')](_0x27ec18[_0x7525('0x38')]['ids'],_[_0x7525('0x3d')](_0x27ec18[_0x7525('0x38')],['ids','id'])||{});}})[_0x7525('0x19')](respondWithResult(_0x401482,null))['catch'](handleError(_0x401482,null));};exports[_0x7525('0x3e')]=function(_0x20dfe5,_0x7fc9ee){var _0x13fe68={'raw':![],'where':{}};var _0x3926eb={};var _0x6bdee={'count':0x0,'rows':[]};return db[_0x7525('0x2b')][_0x7525('0x3f')]({'where':{'id':_0x20dfe5[_0x7525('0x29')]['id']}})[_0x7525('0x19')](handleEntityNotFound(_0x7fc9ee,null))[_0x7525('0x19')](function(_0x20289c){if(_0x20289c){_0x3926eb[_0x7525('0x2d')]=_['keys'](db['OpenchannelMessage'][_0x7525('0x1f')]);_0x3926eb['query']=_[_0x7525('0x2a')](_0x20dfe5[_0x7525('0x25')]);_0x3926eb[_0x7525('0x2c')]=_[_0x7525('0x2e')](_0x3926eb['model'],_0x3926eb[_0x7525('0x25')]);_0x13fe68[_0x7525('0x30')]=_[_0x7525('0x2e')](_0x3926eb[_0x7525('0x2d')],qs['fields'](_0x20dfe5[_0x7525('0x25')][_0x7525('0x2f')]));_0x13fe68[_0x7525('0x30')]=_0x13fe68[_0x7525('0x30')]['length']?_0x13fe68[_0x7525('0x30')]:_0x3926eb[_0x7525('0x2d')];if(!_0x20dfe5[_0x7525('0x25')]['hasOwnProperty']('nolimit')){_0x13fe68['limit']=qs[_0x7525('0x15')](_0x20dfe5[_0x7525('0x25')][_0x7525('0x15')]);_0x13fe68[_0x7525('0x13')]=qs['offset'](_0x20dfe5[_0x7525('0x25')][_0x7525('0x13')]);}_0x13fe68[_0x7525('0x40')]=qs[_0x7525('0x41')](_0x20dfe5['query'][_0x7525('0x41')]);_0x13fe68[_0x7525('0x42')]=qs[_0x7525('0x2c')](_['pick'](_0x20dfe5[_0x7525('0x25')],_0x3926eb['filters']));_0x13fe68[_0x7525('0x42')][_0x7525('0x43')]=_0x20289c['id'];if(_0x20dfe5[_0x7525('0x25')]['filter']){_0x13fe68['where']=_[_0x7525('0x33')](_0x13fe68[_0x7525('0x42')],{'$or':_[_0x7525('0x1e')](_0x13fe68['attributes'],function(_0xd22481){var _0xf6d031={};_0xf6d031[_0xd22481]={'$like':'%'+_0x20dfe5[_0x7525('0x25')][_0x7525('0x44')]+'%'};return _0xf6d031;})});}if(_0x20dfe5[_0x7525('0x25')][_0x7525('0x45')]){var _0x3b094e=_0x20dfe5[_0x7525('0x25')][_0x7525('0x45')][_0x7525('0x46')](',');var _0x54d4b0={};_0x54d4b0[_0x3b094e[0x0]]={'$gte':moment(_0x3b094e[0x1])[_0x7525('0x47')](_0x7525('0x48'))};_0x13fe68[_0x7525('0x42')]=_[_0x7525('0x33')](_0x13fe68[_0x7525('0x42')],_0x54d4b0);}_0x13fe68=_['merge']({},_0x13fe68,_0x20dfe5[_0x7525('0x34')]);return db[_0x7525('0x3c')][_0x7525('0x16')]({'where':_0x13fe68[_0x7525('0x42')]})[_0x7525('0x19')](function(_0x686525){_0x6bdee[_0x7525('0x16')]=_0x686525;if(_0x20dfe5[_0x7525('0x25')][_0x7525('0x32')]){_0x13fe68[_0x7525('0x49')]=[{'all':!![]}];}return db[_0x7525('0x3c')][_0x7525('0x4a')](_0x13fe68);})[_0x7525('0x19')](function(_0x1ce2d3){_0x6bdee['rows']=_0x1ce2d3;return _0x6bdee;});}})['then'](respondWithFilteredResult(_0x7fc9ee,_0x13fe68))[_0x7525('0x36')](handleError(_0x7fc9ee,null));};exports[_0x7525('0x4b')]=function(_0x2629f0,_0x17db2f){return db['OpenchannelInteraction'][_0x7525('0x35')]({'where':{'id':_0x2629f0[_0x7525('0x29')]['id']}})[_0x7525('0x19')](handleEntityNotFound(_0x17db2f,null))['then'](function(_0x32f840){if(_0x32f840){return _0x32f840[_0x7525('0x4c')](_0x2629f0[_0x7525('0x38')][_0x7525('0x4d')],_[_0x7525('0x3d')](_0x2629f0['body'],[_0x7525('0x4d'),'id'])||{})[_0x7525('0x4e')](function(){return db[_0x7525('0x4f')][_0x7525('0x4a')]({'attributes':['id',_0x7525('0x50'),'color'],'where':{'id':_0x2629f0[_0x7525('0x38')][_0x7525('0x4d')]}});})[_0x7525('0x19')](function(_0x2d681b){socket[_0x7525('0x51')]('openchannelInteractionTags:save',{'id':Number(_0x2629f0['params']['id']),'tags':_0x2d681b||[]});return{'id':Number(_0x2629f0['params']['id']),'tags':_0x2d681b||[]};});}})[_0x7525('0x19')](respondWithResult(_0x17db2f,null))[_0x7525('0x36')](handleError(_0x17db2f,null));};exports[_0x7525('0x52')]=function(_0x328087,_0x2257bb){return db['OpenchannelInteraction'][_0x7525('0x35')]({'where':{'id':_0x328087[_0x7525('0x29')]['id']}})[_0x7525('0x19')](handleEntityNotFound(_0x2257bb,null))['then'](function(_0x5c687b){if(_0x5c687b){return _0x5c687b[_0x7525('0x52')](_0x328087[_0x7525('0x25')][_0x7525('0x4d')]);}})[_0x7525('0x19')](respondWithStatusCode(_0x2257bb,null))['catch'](handleError(_0x2257bb,null));};exports[_0x7525('0x53')]=function(_0x2d0506,_0x137cea){var _0x3eb65f=moment()['unix']()[_0x7525('0x54')]();var _0x4d2c54=path[_0x7525('0x55')](config['root'],_0x7525('0x56'),_0x7525('0x57'),_0x7525('0x58'));var _0x29f116=path[_0x7525('0x55')](config[_0x7525('0x59')],_0x7525('0x56'),_0x7525('0x57'),_0x7525('0x5a'));var _0x196a13=path[_0x7525('0x55')](_0x4d2c54,_0x3eb65f);var _0x15dc8=util[_0x7525('0x47')](_0x7525('0x5b'),_0x2d0506['params']['id'],_0x3eb65f);var _0x4af86d=path[_0x7525('0x55')](_0x4d2c54,_0x15dc8);var _0x13a8a0=[];_0x13a8a0[_0x7525('0x5c')]({'model':db[_0x7525('0x5d')],'as':_0x7525('0x5d'),'attributes':['id',_0x7525('0x5e')],'raw':!![]});_0x13a8a0[_0x7525('0x5c')]({'model':db[_0x7525('0x5f')],'as':_0x7525('0x60'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2d0506[_0x7525('0x25')]['attachments']){_0x13a8a0[_0x7525('0x5c')]({'model':db[_0x7525('0x61')],'as':_0x7525('0x61'),'raw':!![]});}var _0x79bcb3=[{'model':db['OpenchannelMessage'],'as':_0x7525('0x62'),'attributes':['id','body',_0x7525('0x63'),_0x7525('0x64'),'secret',_0x7525('0x65')],'include':_0x13a8a0}];_0x79bcb3[_0x7525('0x5c')]({'model':db['OpenchannelAccount'],'as':_0x7525('0x66'),'attributes':['id',_0x7525('0x50')]});_0x79bcb3[_0x7525('0x5c')]({'model':db['User'],'as':_0x7525('0x67'),'attributes':['id',_0x7525('0x5e')]});return db[_0x7525('0x2b')]['find']({'where':{'id':_0x2d0506[_0x7525('0x29')]['id']},'include':_0x79bcb3})[_0x7525('0x19')](handleEntityNotFound(_0x137cea,null))[_0x7525('0x19')](function(_0x2ee325){if(_0x2ee325){var _0x355eb5=_0x2ee325[_0x7525('0x68')]({'plain':!![]});fs[_0x7525('0x69')](_0x196a13);var _0x15ba16={'channel':_0x7525('0x6a'),'account':_0x355eb5[_0x7525('0x66')][_0x7525('0x50')],'agent':_0x355eb5[_0x7525('0x67')]?_0x355eb5['Owner'][_0x7525('0x5e')]:_0x7525('0x6b'),'createdAt':moment(_0x355eb5['createdAt'])['format'](_0x7525('0x48'))['toString'](),'closedAt':_0x355eb5[_0x7525('0x6c')]?moment(_0x355eb5[_0x7525('0x6d')])[_0x7525('0x47')](_0x7525('0x48'))[_0x7525('0x54')]():'','disposition':_0x355eb5['disposition'],'visibility':_0x355eb5[_0x7525('0x6e')]?_0x7525('0x6f'):_0x7525('0x70'),'messages':_(_0x355eb5[_0x7525('0x62')])['filter']({'secret':![]})[_0x7525('0x1e')](function(_0x4704e8){if(_0x4704e8[_0x7525('0x61')]){var _0x206fa2=path['join'](_0x29f116,_0x4704e8['Attachment'][_0x7525('0x71')]);if(fs[_0x7525('0x72')](_0x206fa2)){fs['createReadStream'](_0x206fa2)[_0x7525('0x73')](fs[_0x7525('0x74')](path['join'](_0x196a13,_0x4704e8['Attachment'][_0x7525('0x71')])));}}return{'date':moment(_0x4704e8[_0x7525('0x63')])[_0x7525('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4704e8['direction']===_0x7525('0x75')?_0x4704e8['User']?_0x4704e8['User'][_0x7525('0x5e')]:'System':_0x4704e8['Contact'][_0x7525('0x76')]+(_0x4704e8[_0x7525('0x60')][_0x7525('0x77')]?'\x20'+_0x4704e8[_0x7525('0x60')][_0x7525('0x77')]:''),'body':_0x4704e8[_0x7525('0x61')]?_0x4704e8['Attachment'][_0x7525('0x71')]:_0x4704e8[_0x7525('0x38')],'direction':_0x4704e8[_0x7525('0x64')]===_0x7525('0x75')?'A':'C','secret':_0x4704e8[_0x7525('0x78')],'read':_0x4704e8[_0x7525('0x65')],'attachment':_0x4704e8['Attachment']};})[_0x7525('0x79')]()};return ejs[_0x7525('0x7a')](path[_0x7525('0x55')](config['root'],_0x7525('0x56'),'views',_0x7525('0x7b')),{'interaction':_0x15ba16})['then'](function(_0x39efdc){var _0x57e659=path[_0x7525('0x55')](_0x196a13,_0x7525('0x7c')+_0x355eb5['id']+'-'+_0x3eb65f+_0x7525('0x7d'));var _0x1a8242={'path':_0x57e659,'channel':_0x7525('0x6a'),'interactionId':_0x355eb5['id']};return pdf[_0x7525('0x7e')](_0x39efdc,_0x1a8242);})[_0x7525('0x19')](function(){return new Promise(function(_0x120435,_0x24068f){zipdir(_0x196a13,{'saveTo':_0x4af86d},function(_0x2782ab,_0x45e529){if(_0x2782ab)return _0x24068f(_0x2782ab);return _0x120435(_0x45e529);});})[_0x7525('0x19')](function(){return new Promise(function(_0x517943,_0x1b2355){rimraf(_0x196a13,function(_0x4d3e54){if(_0x4d3e54)_0x1b2355(_0x4d3e54);return _0x517943();});});})[_0x7525('0x19')](function(){return _0x137cea[_0x7525('0x53')](_0x4af86d,_0x15dc8,function(_0x4f413f){if(_0x4f413f){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x4f413f);}else{fs['unlinkSync'](_0x4af86d);}});});});}else{return _0x137cea[_0x7525('0xf')](0xc8);}})[_0x7525('0x36')](handleError(_0x137cea,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 05e8dae..6eaf9ee 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 _0xa20c=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x20de73,_0x2cbf6e){var _0x4d315c=function(_0x3df077){while(--_0x3df077){_0x20de73['push'](_0x20de73['shift']());}};_0x4d315c(++_0x2cbf6e);}(_0xa20c,0x141));var _0xca20=function(_0xf389d4,_0x1209ba){_0xf389d4=_0xf389d4-0x0;var _0x434d75=_0xa20c[_0xf389d4];return _0x434d75;};'use strict';var EventEmitter=require(_0xca20('0x0'));var OpenchannelInteraction=require(_0xca20('0x1'))['db'][_0xca20('0x2')];var OpenchannelMessage=require(_0xca20('0x1'))['db'][_0xca20('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xca20('0x4')](0x0);var events={'afterCreate':_0xca20('0x5'),'afterUpdate':_0xca20('0x6'),'afterDestroy':_0xca20('0x7')};function emitEvent(_0x4b736d){return function(_0x306e97,_0x26d3d6,_0x4d6d37){_0x306e97[_0xca20('0x8')]({'attributes':['id'],'raw':!![]})[_0xca20('0x9')](function(_0x305e9a){_0x306e97[_0xca20('0xa')](_0xca20('0xb'),_0x305e9a[_0xca20('0xc')](function(_0x1997c1){return{'id':_0x1997c1['id']};}));return OpenchannelMessage[_0xca20('0xd')]({'where':{'OpenchannelInteractionId':_0x306e97['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x460d64){_0x306e97[_0xca20('0xa')](_0xca20('0xe'),_0x460d64[_0xca20('0xf')]);OpenchannelInteractionEvents[_0xca20('0x10')](_0x4b736d+':'+_0x306e97['id'],_0x306e97);OpenchannelInteractionEvents[_0xca20('0x10')](_0x4b736d,_0x306e97);_0x4d6d37(null);})[_0xca20('0x11')](_0x4d6d37(null));};}for(var e in events){if(events[_0xca20('0x12')](e)){var event=events[e];OpenchannelInteraction[_0xca20('0x13')](e,emitEvent(event));}}module[_0xca20('0x14')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc3bd=['remove','getUsers','then','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc3bd,0x185));var _0xdc3b=function(_0x5e6929,_0x3608fc){_0x5e6929=_0x5e6929-0x0;var _0x2b9012=_0xc3bd[_0x5e6929];return _0x2b9012;};'use strict';var EventEmitter=require(_0xdc3b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xdc3b('0x1')];var OpenchannelMessage=require(_0xdc3b('0x2'))['db'][_0xdc3b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdc3b('0x4')](0x0);var events={'afterCreate':_0xdc3b('0x5'),'afterUpdate':_0xdc3b('0x6'),'afterDestroy':_0xdc3b('0x7')};function emitEvent(_0x2c5c12){return function(_0x3c801d,_0x66cb1f,_0x26968f){_0x3c801d[_0xdc3b('0x8')]({'attributes':['id'],'raw':!![]})[_0xdc3b('0x9')](function(_0x21c248){_0x3c801d['setDataValue']('Users',_0x21c248[_0xdc3b('0xa')](function(_0x5d9a55){return{'id':_0x5d9a55['id']};}));return OpenchannelMessage[_0xdc3b('0xb')]({'where':{'OpenchannelInteractionId':_0x3c801d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc3b('0x9')](function(_0x5bf1aa){_0x3c801d['setDataValue'](_0xdc3b('0xc'),_0x5bf1aa[_0xdc3b('0xd')]);OpenchannelInteractionEvents[_0xdc3b('0xe')](_0x2c5c12+':'+_0x3c801d['id'],_0x3c801d);OpenchannelInteractionEvents[_0xdc3b('0xe')](_0x2c5c12,_0x3c801d);_0x26968f(null);})[_0xdc3b('0xf')](_0x26968f(null));};}for(var e in events){if(events[_0xdc3b('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xdc3b('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ed50222..88baefb 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 _0x3a41=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x29952f,_0x3977f4){var _0x3180be=function(_0x42620a){while(--_0x42620a){_0x29952f['push'](_0x29952f['shift']());}};_0x3180be(++_0x3977f4);}(_0x3a41,0x151));var _0x13a4=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0x3a41[_0x44714c];return _0x57d4d5;};'use strict';var _=require(_0x13a4('0x0'));var util=require('util');var logger=require(_0x13a4('0x1'))(_0x13a4('0x2'));var moment=require(_0x13a4('0x3'));var BPromise=require(_0x13a4('0x4'));var rp=require(_0x13a4('0x5'));var fs=require('fs');var path=require(_0x13a4('0x6'));var rimraf=require(_0x13a4('0x7'));var config=require(_0x13a4('0x8'));var attributes=require(_0x13a4('0x9'));module['exports']=function(_0x334def,_0x3d0c1f){return _0x334def[_0x13a4('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x13a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x13a4('0xc'),'hooks':{'beforeUpdate':function(_0x2fb050,_0x3cd715,_0x419cd1){if(_0x2fb050[_0x13a4('0xd')](_0x13a4('0xe'))){_0x2fb050[_0x13a4('0xf')]=moment()['format'](_0x13a4('0x10'));}_0x419cd1(null,_0x2fb050);}}});}; \ No newline at end of file +var _0xedf7=['api','bluebird','request-promise','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0xb17932,_0x5f2018){var _0x56ebbf=function(_0x4bab98){while(--_0x4bab98){_0xb17932['push'](_0xb17932['shift']());}};_0x56ebbf(++_0x5f2018);}(_0xedf7,0x7e));var _0x7edf=function(_0xfc0fef,_0x2d9b65){_0xfc0fef=_0xfc0fef-0x0;var _0x193453=_0xedf7[_0xfc0fef];return _0x193453;};'use strict';var _=require('lodash');var util=require(_0x7edf('0x0'));var logger=require(_0x7edf('0x1'))(_0x7edf('0x2'));var moment=require('moment');var BPromise=require(_0x7edf('0x3'));var rp=require(_0x7edf('0x4'));var fs=require('fs');var path=require(_0x7edf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7edf('0x6'));module[_0x7edf('0x7')]=function(_0x34584a,_0x5641a5){return _0x34584a[_0x7edf('0x8')](_0x7edf('0x9'),attributes,{'tableName':_0x7edf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7edf('0xb'),'collate':_0x7edf('0xc'),'hooks':{'beforeUpdate':function(_0x1dd07a,_0x445296,_0x30be03){if(_0x1dd07a['changed']('closed')){_0x1dd07a[_0x7edf('0xd')]=moment()[_0x7edf('0xe')](_0x7edf('0xf'));}_0x30be03(null,_0x1dd07a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3b006a6..b878bad 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 _0xc240=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info'];(function(_0x422f79,_0x72581b){var _0x1bd470=function(_0x45efca){while(--_0x45efca){_0x422f79['push'](_0x422f79['shift']());}};_0x1bd470(++_0x72581b);}(_0xc240,0x137));var _0x0c24=function(_0x2e8582,_0x322a4d){_0x2e8582=_0x2e8582-0x0;var _0x4e02c7=_0xc240[_0x2e8582];return _0x4e02c7;};'use strict';var _=require('lodash');var util=require(_0x0c24('0x0'));var moment=require(_0x0c24('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c24('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c24('0x3'))['db'];var utils=require(_0x0c24('0x4'));var logger=require('../../config/logger')(_0x0c24('0x5'));var config=require(_0x0c24('0x6'));var jayson=require(_0x0c24('0x7'));var client=jayson[_0x0c24('0x8')][_0x0c24('0x9')]({'port':0x232a});config[_0x0c24('0xa')]=_[_0x0c24('0xb')](config['redis'],{'host':_0x0c24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c24('0xa')]));require(_0x0c24('0xd'))['register'](socket);function respondWithRpcPromise(_0x20f717,_0x31fb91,_0x3352ac){return new BPromise(function(_0x5e3bfd,_0xa79e22){return client[_0x0c24('0xe')](_0x20f717,_0x3352ac)[_0x0c24('0xf')](function(_0x3b6c3b){logger[_0x0c24('0x10')](_0x0c24('0x11'),_0x31fb91,_0x0c24('0x12'));logger[_0x0c24('0x13')](_0x0c24('0x14'),_0x31fb91,'request\x20sent',JSON['stringify'](_0x3b6c3b));if(_0x3b6c3b[_0x0c24('0x15')]){if(_0x3b6c3b[_0x0c24('0x15')][_0x0c24('0x16')]===0x1f4){logger[_0x0c24('0x15')](_0x0c24('0x11'),_0x31fb91,_0x3b6c3b[_0x0c24('0x15')][_0x0c24('0x17')]);return _0xa79e22(_0x3b6c3b[_0x0c24('0x15')][_0x0c24('0x17')]);}logger[_0x0c24('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x31fb91,_0x3b6c3b[_0x0c24('0x15')]['message']);return _0x5e3bfd(_0x3b6c3b[_0x0c24('0x15')][_0x0c24('0x17')]);}else{logger[_0x0c24('0x10')](_0x0c24('0x11'),_0x31fb91,_0x0c24('0x12'));_0x5e3bfd(_0x3b6c3b[_0x0c24('0x18')][_0x0c24('0x17')]);}})[_0x0c24('0x19')](function(_0x4b279a){logger[_0x0c24('0x15')](_0x0c24('0x11'),_0x31fb91,_0x4b279a);_0xa79e22(_0x4b279a);});});}exports[_0x0c24('0x1a')]=function(_0x5a40cb){var _0x2b5cac=this;return new Promise(function(_0x5d455d,_0x41c658){return db[_0x0c24('0x1b')][_0x0c24('0x1c')](_0x5a40cb[_0x0c24('0x1d')],{'raw':_0x5a40cb['options']?_0x5a40cb[_0x0c24('0x1e')][_0x0c24('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a40cb['options']?_0x5a40cb['options']['where']||null:null,'attributes':_0x5a40cb[_0x0c24('0x1e')]?_0x5a40cb['options']['attributes']||null:null,'limit':_0x5a40cb[_0x0c24('0x1e')]?_0x5a40cb[_0x0c24('0x1e')][_0x0c24('0x20')]||null:null})['then'](function(_0x1565d4){logger[_0x0c24('0x10')](_0x0c24('0x1a'),_0x5a40cb);logger[_0x0c24('0x13')]('UpdateOpenchannelInteraction',_0x5a40cb,JSON[_0x0c24('0x21')](_0x1565d4));_0x5d455d(_0x1565d4);})['catch'](function(_0x1cecba){logger['error'](_0x0c24('0x1a'),_0x1cecba[_0x0c24('0x17')],_0x5a40cb);_0x41c658(_0x2b5cac[_0x0c24('0x15')](0x1f4,_0x1cecba['message']));});});};exports[_0x0c24('0x22')]=function(_0x2c599a){return new Promise(function(_0x4898c6,_0x54f108){return db['OpenchannelInteraction'][_0x0c24('0x23')]({'where':_0x2c599a[_0x0c24('0x1e')]?_0x2c599a[_0x0c24('0x1e')][_0x0c24('0x24')]||null:null})[_0x0c24('0xf')](function(_0x385da2){if(_0x385da2){return _0x385da2[_0x0c24('0x25')](_0x2c599a[_0x0c24('0x1d')]['ids'],_[_0x0c24('0x26')](_0x2c599a[_0x0c24('0x1d')],['ids','id'])||{});}})[_0x0c24('0x27')](function(_0x161468){logger[_0x0c24('0x10')](_0x0c24('0x28'),_0x2c599a);logger[_0x0c24('0x13')](_0x0c24('0x28'),_0x2c599a,JSON[_0x0c24('0x21')](_0x161468));_0x4898c6(_0x161468);})[_0x0c24('0x19')](function(_0x347fca){logger[_0x0c24('0x15')]('AddTags',_0x347fca['message'],_0x2c599a);_0x54f108(_this['error'](0x1f4,_0x347fca['message']));});});}; \ No newline at end of file +var _0x26b5=['localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','request\x20sent','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','info','stringify','addTags','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x24b0cd,_0x3e87b9){var _0x1f2da8=function(_0x4a9d64){while(--_0x4a9d64){_0x24b0cd['push'](_0x24b0cd['shift']());}};_0x1f2da8(++_0x3e87b9);}(_0x26b5,0x124));var _0x526b=function(_0x4e7ac9,_0x1bb0ef){_0x4e7ac9=_0x4e7ac9-0x0;var _0x1ced2a=_0x26b5[_0x4e7ac9];return _0x1ced2a;};'use strict';var _=require(_0x526b('0x0'));var util=require(_0x526b('0x1'));var moment=require('moment');var BPromise=require(_0x526b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x526b('0x3'));var db=require(_0x526b('0x4'))['db'];var utils=require(_0x526b('0x5'));var logger=require(_0x526b('0x6'))('rpc');var config=require(_0x526b('0x7'));var jayson=require(_0x526b('0x8'));var client=jayson[_0x526b('0x9')]['http']({'port':0x232a});config[_0x526b('0xa')]=_[_0x526b('0xb')](config['redis'],{'host':_0x526b('0xc'),'port':0x18eb});var socket=require(_0x526b('0xd'))(new Redis(config['redis']));require(_0x526b('0xe'))[_0x526b('0xf')](socket);function respondWithRpcPromise(_0xc071d3,_0x38387a,_0x22ecf7){return new BPromise(function(_0x4c6c6b,_0x1bd5b0){return client[_0x526b('0x10')](_0xc071d3,_0x22ecf7)[_0x526b('0x11')](function(_0x41f7b7){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x38387a,'request\x20sent');logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x38387a,_0x526b('0x12'),JSON['stringify'](_0x41f7b7));if(_0x41f7b7[_0x526b('0x13')]){if(_0x41f7b7['error'][_0x526b('0x14')]===0x1f4){logger[_0x526b('0x13')](_0x526b('0x15'),_0x38387a,_0x41f7b7[_0x526b('0x13')][_0x526b('0x16')]);return _0x1bd5b0(_0x41f7b7[_0x526b('0x13')]['message']);}logger[_0x526b('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x38387a,_0x41f7b7['error'][_0x526b('0x16')]);return _0x4c6c6b(_0x41f7b7['error'][_0x526b('0x16')]);}else{logger['info'](_0x526b('0x15'),_0x38387a,_0x526b('0x12'));_0x4c6c6b(_0x41f7b7['result'][_0x526b('0x16')]);}})[_0x526b('0x17')](function(_0x5de34b){logger['error'](_0x526b('0x15'),_0x38387a,_0x5de34b);_0x1bd5b0(_0x5de34b);});});}exports[_0x526b('0x18')]=function(_0x3143a0){var _0x373895=this;return new Promise(function(_0xbc592c,_0x973d5){return db[_0x526b('0x19')][_0x526b('0x1a')](_0x3143a0[_0x526b('0x1b')],{'raw':_0x3143a0['options']?_0x3143a0[_0x526b('0x1c')][_0x526b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3143a0[_0x526b('0x1c')]?_0x3143a0[_0x526b('0x1c')][_0x526b('0x1e')]||null:null,'attributes':_0x3143a0[_0x526b('0x1c')]?_0x3143a0[_0x526b('0x1c')][_0x526b('0x1f')]||null:null,'limit':_0x3143a0[_0x526b('0x1c')]?_0x3143a0[_0x526b('0x1c')]['limit']||null:null})[_0x526b('0x11')](function(_0x387b58){logger[_0x526b('0x20')](_0x526b('0x18'),_0x3143a0);logger['debug'](_0x526b('0x18'),_0x3143a0,JSON[_0x526b('0x21')](_0x387b58));_0xbc592c(_0x387b58);})[_0x526b('0x17')](function(_0x41e2cd){logger[_0x526b('0x13')](_0x526b('0x18'),_0x41e2cd[_0x526b('0x16')],_0x3143a0);_0x973d5(_0x373895[_0x526b('0x13')](0x1f4,_0x41e2cd['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x467837){return new Promise(function(_0x2756ba,_0xa82f27){return db[_0x526b('0x19')]['find']({'where':_0x467837[_0x526b('0x1c')]?_0x467837[_0x526b('0x1c')][_0x526b('0x1e')]||null:null})[_0x526b('0x11')](function(_0x37efc4){if(_0x37efc4){return _0x37efc4[_0x526b('0x22')](_0x467837['body'][_0x526b('0x23')],_['omit'](_0x467837[_0x526b('0x1b')],[_0x526b('0x23'),'id'])||{});}})[_0x526b('0x24')](function(_0x441e07){logger[_0x526b('0x20')]('AddTags',_0x467837);logger['debug'](_0x526b('0x25'),_0x467837,JSON[_0x526b('0x21')](_0x441e07));_0x2756ba(_0x441e07);})[_0x526b('0x17')](function(_0x323de3){logger['error'](_0x526b('0x25'),_0x323de3[_0x526b('0x16')],_0x467837);_0xa82f27(_this[_0x526b('0x13')](0x1f4,_0x323de3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 88da251..fac8719 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 _0x31eb=['save','remove','emit','removeListener','register','./openchannelInteraction.events'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x31eb,0xb9));var _0xb31e=function(_0x55e75b,_0x29c36f){_0x55e75b=_0x55e75b-0x0;var _0x40ef3c=_0x31eb[_0x55e75b];return _0x40ef3c;};'use strict';var OpenchannelInteractionEvents=require(_0xb31e('0x0'));var events=[_0xb31e('0x1'),_0xb31e('0x2'),'update'];function createListener(_0x4b318f,_0x6009b2){return function(_0x2d3797){_0x6009b2[_0xb31e('0x3')](_0x4b318f,_0x2d3797);};}function removeListener(_0x55c930,_0x33b217){return function(){OpenchannelInteractionEvents[_0xb31e('0x4')](_0x55c930,_0x33b217);};}exports[_0xb31e('0x5')]=function(_0x3de14d){for(var _0x52cb54=0x0,_0x21486a=events['length'];_0x52cb54<_0x21486a;_0x52cb54++){var _0x552aa6=events[_0x52cb54];var _0x49087e=createListener('openchannelInteraction:'+_0x552aa6,_0x3de14d);OpenchannelInteractionEvents['on'](_0x552aa6,_0x49087e);}}; \ No newline at end of file +var _0x77ee=['./openchannelInteraction.events','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0xc779a4,_0x26f65a){var _0x4cd37b=function(_0x847fc){while(--_0x847fc){_0xc779a4['push'](_0xc779a4['shift']());}};_0x4cd37b(++_0x26f65a);}(_0x77ee,0xe8));var _0xe77e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x77ee[_0x5b644e];return _0x49c6bf;};'use strict';var OpenchannelInteractionEvents=require(_0xe77e('0x0'));var events=['save',_0xe77e('0x1'),_0xe77e('0x2')];function createListener(_0x453296,_0x411cfb){return function(_0x1a314d){_0x411cfb[_0xe77e('0x3')](_0x453296,_0x1a314d);};}function removeListener(_0x5d6771,_0x518b4f){return function(){OpenchannelInteractionEvents[_0xe77e('0x4')](_0x5d6771,_0x518b4f);};}exports[_0xe77e('0x5')]=function(_0x76e32f){for(var _0x227c16=0x0,_0x5d8410=events[_0xe77e('0x6')];_0x227c16<_0x5d8410;_0x227c16++){var _0x3e4ae5=events[_0x227c16];var _0x591b9d=createListener(_0xe77e('0x7')+_0x3e4ae5,_0x76e32f);OpenchannelInteractionEvents['on'](_0x3e4ae5,_0x591b9d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index fab684d..3537d13 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(_0xf5c500,_0x139bc5){_0xf5c500=_0xf5c500-0x0;var _0x39733d=_0x70e0[_0xf5c500];return _0x39733d;};'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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2a573d,_0x284675){var _0x370c3f=function(_0x1ddb31){while(--_0x1ddb31){_0x2a573d['push'](_0x2a573d['shift']());}};_0x370c3f(++_0x284675);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 058fd7b..52e6ff3 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 _0x9ccd=['TEXT','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0x1034c4,_0x32aa2d){var _0x4fae5b=function(_0xef1637){while(--_0xef1637){_0x1034c4['push'](_0x1034c4['shift']());}};_0x4fae5b(++_0x32aa2d);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xd9cc('0x1')](_0xd9cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9cc('0x3')]('in','out'),'defaultValue':_0xd9cc('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9cc('0x5')]},'providerName':{'type':Sequelize[_0xd9cc('0x6')]},'providerResponse':{'type':Sequelize[_0xd9cc('0x1')]}}; \ No newline at end of file +var _0xadcc=['TEXT','medium','BOOLEAN','ENUM','DATE','STRING','sequelize'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xadcc,0x76));var _0xcadc=function(_0x114656,_0x31e60c){_0x114656=_0x114656-0x0;var _0x4dab7d=_0xadcc[_0x114656];return _0x4dab7d;};'use strict';var Sequelize=require(_0xcadc('0x0'));module['exports']={'body':{'type':Sequelize[_0xcadc('0x1')](_0xcadc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcadc('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcadc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcadc('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xcadc('0x5')]},'providerName':{'type':Sequelize[_0xcadc('0x6')]},'providerResponse':{'type':Sequelize[_0xcadc('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1e54686..3529e74 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 _0xb201=['fullname','internal','manual','format','SIP/%s','channel','motionChannel','event','EventManager','agent','OpenchannelInteraction','RejectMessage','rejectMessage','contact','email','interface','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows','show','length','options','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User'];(function(_0x1096ce,_0x1b750f){var _0x1446fb=function(_0x24aa3a){while(--_0x24aa3a){_0x1096ce['push'](_0x1096ce['shift']());}};_0x1446fb(++_0x1b750f);}(_0xb201,0x117));var _0x1b20=function(_0x12baa4,_0x3a303f){_0x12baa4=_0x12baa4-0x0;var _0x3f2ede=_0xb201[_0x12baa4];return _0x3f2ede;};'use strict';var emlformat=require(_0x1b20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b20('0x1'));var jsonpatch=require(_0x1b20('0x2'));var rp=require('request-promise');var moment=require(_0x1b20('0x3'));var BPromise=require(_0x1b20('0x4'));var Mustache=require(_0x1b20('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1b20('0x6'));var csv=require(_0x1b20('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b20('0x8'));var _=require('lodash');var squel=require(_0x1b20('0x9'));var crypto=require(_0x1b20('0xa'));var jsforce=require(_0x1b20('0xb'));var deskjs=require(_0x1b20('0xc'));var toCsv=require(_0x1b20('0x7'));var querystring=require('querystring');var Papa=require(_0x1b20('0xd'));var Redis=require(_0x1b20('0xe'));var authService=require(_0x1b20('0xf'));var qs=require(_0x1b20('0x10'));var as=require(_0x1b20('0x11'));var hardwareService=require(_0x1b20('0x12'));var logger=require(_0x1b20('0x13'))(_0x1b20('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1b20('0x15'));var db=require(_0x1b20('0x16'))['db'];config[_0x1b20('0x17')]=_['defaults'](config[_0x1b20('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b20('0x18'))(new Redis(config[_0x1b20('0x17')]));require(_0x1b20('0x19'))['register'](socket);var jayson=require(_0x1b20('0x1a'));var client=jayson[_0x1b20('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1b20('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x588dbe,_0x1a66e5,_0x57da22,_0x35aad0){return new BPromise(function(_0x2be1ed,_0x5c2f3a){var _0x527f42=_0x35aad0||client;return _0x527f42[_0x1b20('0x1d')](_0x588dbe,_0x57da22)['then'](function(_0x492615){logger[_0x1b20('0x1e')](_0x1b20('0x1f'),_0x1a66e5,_0x1b20('0x20'));logger[_0x1b20('0x21')](_0x1b20('0x22'),_0x1a66e5,_0x1b20('0x20'),JSON['stringify'](_0x492615));if(_0x492615[_0x1b20('0x23')]){if(_0x492615['error'][_0x1b20('0x24')]===0x1f4){logger['error'](_0x1b20('0x1f'),_0x1a66e5,_0x492615[_0x1b20('0x23')][_0x1b20('0x25')]);return _0x5c2f3a(_0x492615[_0x1b20('0x23')][_0x1b20('0x25')]);}logger[_0x1b20('0x23')](_0x1b20('0x1f'),_0x1a66e5,_0x492615['error'][_0x1b20('0x25')]);return _0x2be1ed(_0x492615[_0x1b20('0x23')][_0x1b20('0x25')]);}else{logger[_0x1b20('0x1e')](_0x1b20('0x1f'),_0x1a66e5,_0x1b20('0x20'));_0x2be1ed(_0x492615['result'][_0x1b20('0x25')]);}})[_0x1b20('0x26')](function(_0x5f51d2){logger[_0x1b20('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x1a66e5,_0x5f51d2);_0x5c2f3a(_0x5f51d2);});});}function respondWithStatusCode(_0x1f3a43,_0x1d6662){_0x1d6662=_0x1d6662||0xcc;return function(_0x36bfab){if(_0x36bfab){return _0x1f3a43[_0x1b20('0x27')](_0x1d6662);}return _0x1f3a43[_0x1b20('0x28')](_0x1d6662)[_0x1b20('0x29')]();};}function respondWithResult(_0x2092ed,_0x3d8a4e){_0x3d8a4e=_0x3d8a4e||0xc8;return function(_0x43de28){if(_0x43de28){return _0x2092ed['status'](_0x3d8a4e)[_0x1b20('0x2a')](_0x43de28);}};}function respondWithFilteredResult(_0xf2a587,_0x201698){return function(_0x5a48cc){if(_0x5a48cc){var _0x405bff=typeof _0x201698['offset']===_0x1b20('0x2b')&&typeof _0x201698[_0x1b20('0x2c')]===_0x1b20('0x2b');var _0x38edd3=_0x5a48cc[_0x1b20('0x2d')];var _0x2421be=_0x405bff?0x0:_0x201698[_0x1b20('0x2e')];var _0x3420cc=_0x405bff?_0x5a48cc[_0x1b20('0x2d')]:_0x201698[_0x1b20('0x2e')]+_0x201698[_0x1b20('0x2c')];var _0x1ebb19;if(_0x3420cc>=_0x38edd3){_0x3420cc=_0x38edd3;_0x1ebb19=0xc8;}else{_0x1ebb19=0xce;}_0xf2a587['status'](_0x1ebb19);return _0xf2a587[_0x1b20('0x2f')](_0x1b20('0x30'),_0x2421be+'-'+_0x3420cc+'/'+_0x38edd3)[_0x1b20('0x2a')](_0x5a48cc);}return null;};}function patchUpdates(_0x57b3e1){return function(_0x5c4be0){try{jsonpatch['apply'](_0x5c4be0,_0x57b3e1,!![]);}catch(_0x4971fa){return BPromise[_0x1b20('0x31')](_0x4971fa);}return _0x5c4be0[_0x1b20('0x32')]();};}function saveUpdates(_0x25b2b9,_0x52eb17){return function(_0x46c98e){if(_0x46c98e){return _0x46c98e['update'](_0x25b2b9)[_0x1b20('0x33')](function(_0x55bf8a){return _0x55bf8a;});}return null;};}function removeEntity(_0xd80c8,_0x1b1a9f){return function(_0x5cb267){if(_0x5cb267){return _0x5cb267['destroy']()[_0x1b20('0x33')](function(){_0xd80c8['status'](0xcc)[_0x1b20('0x29')]();});}};}function handleEntityNotFound(_0x37b4af,_0x46f258){return function(_0x2fe686){if(!_0x2fe686){_0x37b4af[_0x1b20('0x27')](0x194);}return _0x2fe686;};}function handleError(_0x4b54c7,_0x8a347c){_0x8a347c=_0x8a347c||0x1f4;return function(_0x1d175){logger['error'](_0x1d175[_0x1b20('0x34')]);if(_0x1d175[_0x1b20('0x35')]){delete _0x1d175[_0x1b20('0x35')];}_0x4b54c7['status'](_0x8a347c)['send'](_0x1d175);};}exports[_0x1b20('0x36')]=function(_0x6a7b6a,_0x448112){var _0x386f64={},_0x10c5d0={},_0x423df3={'count':0x0,'rows':[]};var _0x5755da=_[_0x1b20('0x37')](db['OpenchannelMessage'][_0x1b20('0x38')],function(_0x7be9b5){return{'name':_0x7be9b5['fieldName'],'type':_0x7be9b5[_0x1b20('0x39')][_0x1b20('0x3a')]};});_0x10c5d0[_0x1b20('0x3b')]=_[_0x1b20('0x37')](_0x5755da,'name');_0x10c5d0[_0x1b20('0x3c')]=_[_0x1b20('0x3d')](_0x6a7b6a[_0x1b20('0x3c')]);_0x10c5d0[_0x1b20('0x3e')]=_[_0x1b20('0x3f')](_0x10c5d0[_0x1b20('0x3b')],_0x10c5d0[_0x1b20('0x3c')]);_0x386f64['attributes']=_['intersection'](_0x10c5d0[_0x1b20('0x3b')],qs['fields'](_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x40')]));_0x386f64['attributes']=_0x386f64[_0x1b20('0x41')]['length']?_0x386f64[_0x1b20('0x41')]:_0x10c5d0['model'];if(!_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x42')](_0x1b20('0x43'))){_0x386f64['limit']=qs[_0x1b20('0x2c')](_0x6a7b6a['query'][_0x1b20('0x2c')]);_0x386f64[_0x1b20('0x2e')]=qs[_0x1b20('0x2e')](_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x2e')]);}_0x386f64[_0x1b20('0x44')]=qs[_0x1b20('0x45')](_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x45')]);_0x386f64[_0x1b20('0x46')]=qs['filters'](_[_0x1b20('0x47')](_0x6a7b6a[_0x1b20('0x3c')],_0x10c5d0[_0x1b20('0x3e')]),_0x5755da);if(_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x48')]){_0x386f64[_0x1b20('0x46')]=_[_0x1b20('0x49')](_0x386f64['where'],{'$or':_[_0x1b20('0x37')](_0x5755da,function(_0x68966c){if(_0x68966c['type']!==_0x1b20('0x4a')){var _0x1fb5ed={};_0x1fb5ed[_0x68966c[_0x1b20('0x35')]]={'$like':'%'+_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x48')]+'%'};return _0x1fb5ed;}})});}_0x386f64=_['merge']({},_0x386f64,_0x6a7b6a['options']);var _0x5b1d44={'where':_0x386f64['where']};return db[_0x1b20('0x4b')][_0x1b20('0x2d')](_0x5b1d44)['then'](function(_0x352793){_0x423df3[_0x1b20('0x2d')]=_0x352793;if(_0x6a7b6a[_0x1b20('0x3c')][_0x1b20('0x4c')]){_0x386f64[_0x1b20('0x4d')]=[{'all':!![]}];}return db[_0x1b20('0x4b')][_0x1b20('0x4e')](_0x386f64);})['then'](function(_0x2a36ac){_0x423df3[_0x1b20('0x4f')]=_0x2a36ac;return _0x423df3;})['then'](respondWithFilteredResult(_0x448112,_0x386f64))[_0x1b20('0x26')](handleError(_0x448112,null));};exports[_0x1b20('0x50')]=function(_0x416628,_0x882591){var _0x1ac4e9={'raw':!![],'where':{'id':_0x416628['params']['id']}},_0x2e7888={};_0x2e7888[_0x1b20('0x3b')]=_['keys'](db['OpenchannelMessage'][_0x1b20('0x38')]);_0x2e7888[_0x1b20('0x3c')]=_[_0x1b20('0x3d')](_0x416628[_0x1b20('0x3c')]);_0x2e7888[_0x1b20('0x3e')]=_[_0x1b20('0x3f')](_0x2e7888[_0x1b20('0x3b')],_0x2e7888['query']);_0x1ac4e9[_0x1b20('0x41')]=_[_0x1b20('0x3f')](_0x2e7888['model'],qs[_0x1b20('0x40')](_0x416628[_0x1b20('0x3c')][_0x1b20('0x40')]));_0x1ac4e9[_0x1b20('0x41')]=_0x1ac4e9[_0x1b20('0x41')][_0x1b20('0x51')]?_0x1ac4e9[_0x1b20('0x41')]:_0x2e7888['model'];if(_0x416628[_0x1b20('0x3c')]['includeAll']){_0x1ac4e9[_0x1b20('0x4d')]=[{'all':!![]}];}_0x1ac4e9=_[_0x1b20('0x49')]({},_0x1ac4e9,_0x416628[_0x1b20('0x52')]);return db[_0x1b20('0x4b')][_0x1b20('0x53')](_0x1ac4e9)['then'](handleEntityNotFound(_0x882591,null))['then'](respondWithResult(_0x882591,null))[_0x1b20('0x26')](handleError(_0x882591,null));};exports['create']=function(_0x6b45a0,_0x5af475){return db[_0x1b20('0x4b')][_0x1b20('0x54')](_0x6b45a0[_0x1b20('0x55')],{})[_0x1b20('0x33')](respondWithResult(_0x5af475,0xc9))[_0x1b20('0x26')](handleError(_0x5af475,null));};exports[_0x1b20('0x56')]=function(_0x231970,_0x36aece){if(_0x231970[_0x1b20('0x55')]['id']){delete _0x231970[_0x1b20('0x55')]['id'];}return db[_0x1b20('0x4b')]['find']({'where':{'id':_0x231970[_0x1b20('0x57')]['id']}})[_0x1b20('0x33')](handleEntityNotFound(_0x36aece,null))[_0x1b20('0x33')](saveUpdates(_0x231970[_0x1b20('0x55')],null))[_0x1b20('0x33')](respondWithResult(_0x36aece,null))[_0x1b20('0x26')](handleError(_0x36aece,null));};exports['destroy']=function(_0x5c66de,_0x18022f){return db[_0x1b20('0x4b')][_0x1b20('0x53')]({'where':{'id':_0x5c66de[_0x1b20('0x57')]['id']}})[_0x1b20('0x33')](handleEntityNotFound(_0x18022f,null))[_0x1b20('0x33')](removeEntity(_0x18022f,null))['catch'](handleError(_0x18022f,null));};exports[_0x1b20('0x58')]=function(_0x7e347a,_0x260df2){return db['OpenchannelMessage'][_0x1b20('0x58')]()['then'](respondWithResult(_0x260df2,null))[_0x1b20('0x26')](handleError(_0x260df2,null));};var interaction_log=require(_0x1b20('0x13'))(_0x1b20('0x59'));exports[_0x1b20('0x5a')]=function(_0x4251e6,_0x2bb594,_0x44f015){var _0x3df3bb={'agent':{},'channel':_0x1b20('0x5b')};if(_0x4251e6[_0x1b20('0x55')]['id']){delete _0x4251e6[_0x1b20('0x55')]['id'];}_0x4251e6['body'][_0x1b20('0x5c')]=!![];_0x4251e6['body'][_0x1b20('0x5d')]=moment()['format'](_0x1b20('0x5e'));_0x4251e6[_0x1b20('0x55')][_0x1b20('0x5f')]=_0x4251e6[_0x1b20('0x55')][_0x1b20('0x5f')]||_0x4251e6[_0x1b20('0x60')]['id'];_0x3df3bb['agent']['id']=_0x4251e6['body'][_0x1b20('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4251e6[_0x1b20('0x57')]['id'],'UserId':null}})[_0x1b20('0x33')](handleEntityNotFound(_0x2bb594,null))['then'](saveUpdates(_0x4251e6[_0x1b20('0x55')],null))[_0x1b20('0x33')](function(_0x40c732){if(_0x40c732){_0x3df3bb[_0x1b20('0x25')]=_0x40c732[_0x1b20('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1b20('0x53')]({'where':{'id':_0x40c732[_0x1b20('0x62')]}});}return null;})[_0x1b20('0x33')](handleEntityNotFound(_0x2bb594,null))[_0x1b20('0x33')](function(_0x4d6729){if(_0x4d6729){return _0x4d6729[_0x1b20('0x56')]({'UserId':_0x4251e6[_0x1b20('0x55')]['UserId'],'read1stAt':_[_0x1b20('0x63')](_0x4d6729[_0x1b20('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x51b89b){if(_0x51b89b){_0x3df3bb['interaction']=_0x51b89b[_0x1b20('0x61')]({'plain':!![]});interaction_log[_0x1b20('0x1e')](_0x1b20('0x65'),_0x4251e6[_0x1b20('0x60')]['id'],_0x4251e6['user'][_0x1b20('0x35')],_0x4251e6[_0x1b20('0x60')][_0x1b20('0x66')],_0x3df3bb[_0x1b20('0x67')]['id'],_0x4251e6['body']?JSON[_0x1b20('0x68')](_0x4251e6['body']):_0x1b20('0x69'));return respondWithRpcPromise(_0x1b20('0x6a'),_0x1b20('0x6b'),_0x3df3bb);}return null;})[_0x1b20('0x33')](function(_0x2c6a5d){var _0x259a04=_0x1b20('0x6c')+_0x2c6a5d[_0x1b20('0x25')][_0x1b20('0x6d')];return db[_0x1b20('0x6e')][_0x1b20('0x3c')](_0x259a04,{'type':db[_0x1b20('0x6f')][_0x1b20('0x70')]['SELECT'],'raw':!![]})[_0x1b20('0x33')](function(_0x35300d){return _0x35300d;});})[_0x1b20('0x33')](function(_0x141119){if(_0x141119){_0x3df3bb[_0x1b20('0x25')]['contact']=_0x141119[0x0];if(!_0x4251e6[_0x1b20('0x55')][_0x1b20('0x5f')])return;return db[_0x1b20('0x71')][_0x1b20('0x53')]({'where':{'id':_0x4251e6[_0x1b20('0x55')][_0x1b20('0x5f')],'role':'agent'},'attributes':['id','name',_0x1b20('0x72'),'email',_0x1b20('0x73')],'raw':!![]});}return null;})[_0x1b20('0x33')](function(_0x4f8f59){if(!_0x4f8f59)return null;_0x3df3bb[_0x1b20('0x25')]['agent']=_0x4f8f59;return _0x3df3bb;})[_0x1b20('0x33')](function(_0x5b11f0){if(_0x5b11f0){if(_0x4251e6[_0x1b20('0x55')][_0x1b20('0x74')]){_0x3df3bb[_0x1b20('0x25')]['interface']=util[_0x1b20('0x75')](_0x1b20('0x76'),_0x4251e6[_0x1b20('0x60')]['name']);_0x3df3bb[_0x1b20('0x25')][_0x1b20('0x77')]=_0x3df3bb[_0x1b20('0x77')];_0x3df3bb[_0x1b20('0x25')][_0x1b20('0x78')]=_0x3df3bb['channel'];_0x3df3bb[_0x1b20('0x25')][_0x1b20('0x79')]='accept';return respondWithRpcPromise(_0x1b20('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x3df3bb[_0x1b20('0x25')]},client9002)[_0x1b20('0x33')](function(){return _0x3df3bb;});}return _0x3df3bb;}return null;})[_0x1b20('0x33')](respondWithResult(_0x2bb594,null))[_0x1b20('0x26')](handleError(_0x2bb594,null));};var interaction_log=require(_0x1b20('0x13'))(_0x1b20('0x59'));exports[_0x1b20('0x31')]=function(_0x27b5ac,_0x282f68,_0x847f64){var _0x228d25={'agent':{},'channel':_0x1b20('0x5b')};if(_0x27b5ac[_0x1b20('0x55')]['id']){delete _0x27b5ac[_0x1b20('0x55')]['id'];}_0x27b5ac[_0x1b20('0x55')]['UserId']=_0x27b5ac[_0x1b20('0x55')][_0x1b20('0x5f')]||_0x27b5ac[_0x1b20('0x60')]['id'];_0x228d25[_0x1b20('0x7b')]['id']=_0x27b5ac[_0x1b20('0x55')][_0x1b20('0x5f')];return db[_0x1b20('0x4b')][_0x1b20('0x53')]({'where':{'id':_0x27b5ac['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x282f68,null))['then'](function(_0x3fc8d3){if(_0x3fc8d3){_0x228d25[_0x1b20('0x25')]=_0x3fc8d3['get']({'plain':!![]});return db[_0x1b20('0x7c')][_0x1b20('0x53')]({'where':{'id':_0x3fc8d3[_0x1b20('0x62')]}});}return null;})[_0x1b20('0x33')](handleEntityNotFound(_0x282f68,null))[_0x1b20('0x33')](function(_0x17a85c){if(_0x17a85c){_0x228d25[_0x1b20('0x67')]=_0x17a85c[_0x1b20('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27b5ac[_0x1b20('0x60')]['id'],_0x27b5ac[_0x1b20('0x60')]['name'],_0x27b5ac['user'][_0x1b20('0x66')],_0x228d25[_0x1b20('0x67')]['id'],_0x27b5ac[_0x1b20('0x55')]?JSON[_0x1b20('0x68')](_0x27b5ac['body']):_0x1b20('0x69'));return respondWithRpcPromise(_0x1b20('0x7d'),_0x1b20('0x7e'),_0x228d25);}return null;})[_0x1b20('0x33')](function(_0x1167de){var _0x3646d0=_0x1b20('0x6c')+_0x1167de['message'][_0x1b20('0x6d')];return db[_0x1b20('0x6e')]['query'](_0x3646d0,{'type':db[_0x1b20('0x6f')][_0x1b20('0x70')]['SELECT'],'raw':!![]})[_0x1b20('0x33')](function(_0x4339f1){return _0x4339f1;});})[_0x1b20('0x33')](function(_0x5da8a7){if(_0x5da8a7){_0x228d25[_0x1b20('0x25')][_0x1b20('0x7f')]=_0x5da8a7[0x0];if(!_0x27b5ac[_0x1b20('0x55')][_0x1b20('0x5f')])return;return db[_0x1b20('0x71')]['find']({'where':{'id':_0x27b5ac['body']['UserId'],'role':_0x1b20('0x7b')},'attributes':['id',_0x1b20('0x35'),'fullname',_0x1b20('0x80'),_0x1b20('0x73')],'raw':!![]});}return null;})['then'](function(_0xab91d){if(!_0xab91d)return null;_0x228d25['message'][_0x1b20('0x7b')]=_0xab91d;return _0x228d25;})[_0x1b20('0x33')](function(_0x1b48e0){if(_0x1b48e0){_0x1b48e0['message'][_0x1b20('0x81')]=util[_0x1b20('0x75')](_0x1b20('0x76'),_0x27b5ac['user'][_0x1b20('0x35')]);_0x1b48e0[_0x1b20('0x25')]['channel']=_0x228d25[_0x1b20('0x77')];_0x1b48e0['message'][_0x1b20('0x78')]=_0x228d25[_0x1b20('0x77')];_0x1b48e0['message']['event']=_0x1b20('0x31');respondWithRpcPromise(_0x1b20('0x7a'),_0x1b20('0x7a'),{'event':_0x1b20('0x82'),'message':_0x1b48e0[_0x1b20('0x25')]},client9002);return _0x228d25;}return null;})[_0x1b20('0x33')](respondWithResult(_0x282f68,null))[_0x1b20('0x26')](handleError(_0x282f68,null));}; \ No newline at end of file +var _0x836c=['OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','contact','fullname','rejectmessage','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','findAll','rows','show','params','includeAll','include','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE: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','QueryTypes','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage'];(function(_0x5e6425,_0x3ac58e){var _0xfd26e=function(_0x57b938){while(--_0x57b938){_0x5e6425['push'](_0x5e6425['shift']());}};_0xfd26e(++_0x3ac58e);}(_0x836c,0x11f));var _0xc836=function(_0xefae,_0x203e24){_0xefae=_0xefae-0x0;var _0x429c56=_0x836c[_0xefae];return _0x429c56;};'use strict';var emlformat=require(_0xc836('0x0'));var rimraf=require(_0xc836('0x1'));var zipdir=require(_0xc836('0x2'));var jsonpatch=require(_0xc836('0x3'));var rp=require(_0xc836('0x4'));var moment=require(_0xc836('0x5'));var BPromise=require(_0xc836('0x6'));var Mustache=require(_0xc836('0x7'));var util=require(_0xc836('0x8'));var path=require(_0xc836('0x9'));var sox=require(_0xc836('0xa'));var csv=require(_0xc836('0xb'));var ejs=require(_0xc836('0xc'));var fs=require('fs');var fs_extra=require(_0xc836('0xd'));var _=require(_0xc836('0xe'));var squel=require(_0xc836('0xf'));var crypto=require('crypto');var jsforce=require(_0xc836('0x10'));var deskjs=require(_0xc836('0x11'));var toCsv=require(_0xc836('0xb'));var querystring=require('querystring');var Papa=require(_0xc836('0x12'));var Redis=require(_0xc836('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc836('0x14'));var as=require(_0xc836('0x15'));var hardwareService=require(_0xc836('0x16'));var logger=require(_0xc836('0x17'))('api');var utils=require(_0xc836('0x18'));var config=require(_0xc836('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc836('0x1a'))['db'];config[_0xc836('0x1b')]=_[_0xc836('0x1c')](config[_0xc836('0x1b')],{'host':_0xc836('0x1d'),'port':0x18eb});var socket=require(_0xc836('0x1e'))(new Redis(config[_0xc836('0x1b')]));require(_0xc836('0x1f'))['register'](socket);var jayson=require(_0xc836('0x20'));var client=jayson[_0xc836('0x21')][_0xc836('0x22')]({'port':0x232c});var client9002=jayson[_0xc836('0x21')][_0xc836('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x223ebb,_0x38ec8c,_0xadbae3,_0xd07ee){return new BPromise(function(_0x1dbfe9,_0x1bd031){var _0x193843=_0xd07ee||client;return _0x193843[_0xc836('0x23')](_0x223ebb,_0xadbae3)[_0xc836('0x24')](function(_0x5208d4){logger[_0xc836('0x25')](_0xc836('0x26'),_0x38ec8c,_0xc836('0x27'));logger[_0xc836('0x28')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x38ec8c,_0xc836('0x27'),JSON['stringify'](_0x5208d4));if(_0x5208d4[_0xc836('0x29')]){if(_0x5208d4[_0xc836('0x29')][_0xc836('0x2a')]===0x1f4){logger[_0xc836('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x38ec8c,_0x5208d4[_0xc836('0x29')][_0xc836('0x2b')]);return _0x1bd031(_0x5208d4[_0xc836('0x29')][_0xc836('0x2b')]);}logger[_0xc836('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x38ec8c,_0x5208d4['error'][_0xc836('0x2b')]);return _0x1dbfe9(_0x5208d4[_0xc836('0x29')]['message']);}else{logger[_0xc836('0x25')](_0xc836('0x26'),_0x38ec8c,_0xc836('0x27'));_0x1dbfe9(_0x5208d4['result'][_0xc836('0x2b')]);}})[_0xc836('0x2c')](function(_0x41207b){logger[_0xc836('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x38ec8c,_0x41207b);_0x1bd031(_0x41207b);});});}function respondWithStatusCode(_0x348ada,_0x5c625e){_0x5c625e=_0x5c625e||0xcc;return function(_0x5635b6){if(_0x5635b6){return _0x348ada[_0xc836('0x2d')](_0x5c625e);}return _0x348ada[_0xc836('0x2e')](_0x5c625e)[_0xc836('0x2f')]();};}function respondWithResult(_0x5d88ee,_0x16655d){_0x16655d=_0x16655d||0xc8;return function(_0x2fd5ec){if(_0x2fd5ec){return _0x5d88ee[_0xc836('0x2e')](_0x16655d)['json'](_0x2fd5ec);}};}function respondWithFilteredResult(_0x732644,_0x2e59a5){return function(_0x38bbc4){if(_0x38bbc4){var _0x35a842=typeof _0x2e59a5['offset']==='undefined'&&typeof _0x2e59a5['limit']===_0xc836('0x30');var _0x444baf=_0x38bbc4[_0xc836('0x31')];var _0x5e32b7=_0x35a842?0x0:_0x2e59a5['offset'];var _0x98bfdb=_0x35a842?_0x38bbc4[_0xc836('0x31')]:_0x2e59a5[_0xc836('0x32')]+_0x2e59a5[_0xc836('0x33')];var _0x242b5d;if(_0x98bfdb>=_0x444baf){_0x98bfdb=_0x444baf;_0x242b5d=0xc8;}else{_0x242b5d=0xce;}_0x732644[_0xc836('0x2e')](_0x242b5d);return _0x732644[_0xc836('0x34')](_0xc836('0x35'),_0x5e32b7+'-'+_0x98bfdb+'/'+_0x444baf)[_0xc836('0x36')](_0x38bbc4);}return null;};}function patchUpdates(_0x5850e6){return function(_0x12d418){try{jsonpatch[_0xc836('0x37')](_0x12d418,_0x5850e6,!![]);}catch(_0x22537f){return BPromise[_0xc836('0x38')](_0x22537f);}return _0x12d418[_0xc836('0x39')]();};}function saveUpdates(_0x267f45,_0x2865de){return function(_0x4b228c){if(_0x4b228c){return _0x4b228c[_0xc836('0x3a')](_0x267f45)[_0xc836('0x24')](function(_0x305db6){return _0x305db6;});}return null;};}function removeEntity(_0x319a8b,_0x109520){return function(_0x54ca84){if(_0x54ca84){return _0x54ca84[_0xc836('0x3b')]()[_0xc836('0x24')](function(){_0x319a8b[_0xc836('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7a96,_0x5c7f13){return function(_0x46509b){if(!_0x46509b){_0x1d7a96[_0xc836('0x2d')](0x194);}return _0x46509b;};}function handleError(_0x19e3e0,_0x9f68fc){_0x9f68fc=_0x9f68fc||0x1f4;return function(_0x464407){logger[_0xc836('0x29')](_0x464407[_0xc836('0x3c')]);if(_0x464407[_0xc836('0x3d')]){delete _0x464407['name'];}_0x19e3e0[_0xc836('0x2e')](_0x9f68fc)[_0xc836('0x3e')](_0x464407);};}exports[_0xc836('0x3f')]=function(_0x4e2fcb,_0x2d9410){var _0x109008={},_0x24ae3b={},_0x36e2aa={'count':0x0,'rows':[]};var _0x2aa7d6=_[_0xc836('0x40')](db[_0xc836('0x41')][_0xc836('0x42')],function(_0x3b19ca){return{'name':_0x3b19ca[_0xc836('0x43')],'type':_0x3b19ca[_0xc836('0x44')][_0xc836('0x45')]};});_0x24ae3b[_0xc836('0x46')]=_[_0xc836('0x40')](_0x2aa7d6,_0xc836('0x3d'));_0x24ae3b['query']=_[_0xc836('0x47')](_0x4e2fcb['query']);_0x24ae3b['filters']=_[_0xc836('0x48')](_0x24ae3b[_0xc836('0x46')],_0x24ae3b[_0xc836('0x49')]);_0x109008[_0xc836('0x4a')]=_['intersection'](_0x24ae3b['model'],qs[_0xc836('0x4b')](_0x4e2fcb[_0xc836('0x49')][_0xc836('0x4b')]));_0x109008[_0xc836('0x4a')]=_0x109008['attributes'][_0xc836('0x4c')]?_0x109008[_0xc836('0x4a')]:_0x24ae3b[_0xc836('0x46')];if(!_0x4e2fcb['query']['hasOwnProperty'](_0xc836('0x4d'))){_0x109008[_0xc836('0x33')]=qs[_0xc836('0x33')](_0x4e2fcb[_0xc836('0x49')][_0xc836('0x33')]);_0x109008[_0xc836('0x32')]=qs[_0xc836('0x32')](_0x4e2fcb['query'][_0xc836('0x32')]);}_0x109008[_0xc836('0x4e')]=qs[_0xc836('0x4f')](_0x4e2fcb['query'][_0xc836('0x4f')]);_0x109008[_0xc836('0x50')]=qs[_0xc836('0x51')](_[_0xc836('0x52')](_0x4e2fcb['query'],_0x24ae3b[_0xc836('0x51')]),_0x2aa7d6);if(_0x4e2fcb['query']['filter']){_0x109008[_0xc836('0x50')]=_['merge'](_0x109008['where'],{'$or':_['map'](_0x2aa7d6,function(_0x10eac2){if(_0x10eac2[_0xc836('0x44')]!==_0xc836('0x53')){var _0x3b9025={};_0x3b9025[_0x10eac2[_0xc836('0x3d')]]={'$like':'%'+_0x4e2fcb['query'][_0xc836('0x54')]+'%'};return _0x3b9025;}})});}_0x109008=_[_0xc836('0x55')]({},_0x109008,_0x4e2fcb[_0xc836('0x56')]);var _0x148508={'where':_0x109008[_0xc836('0x50')]};return db[_0xc836('0x41')][_0xc836('0x31')](_0x148508)[_0xc836('0x24')](function(_0x1db187){_0x36e2aa[_0xc836('0x31')]=_0x1db187;if(_0x4e2fcb[_0xc836('0x49')]['includeAll']){_0x109008['include']=[{'all':!![]}];}return db[_0xc836('0x41')][_0xc836('0x57')](_0x109008);})['then'](function(_0xb21f2){_0x36e2aa[_0xc836('0x58')]=_0xb21f2;return _0x36e2aa;})['then'](respondWithFilteredResult(_0x2d9410,_0x109008))['catch'](handleError(_0x2d9410,null));};exports[_0xc836('0x59')]=function(_0x10b10d,_0x315f7e){var _0x59b4f1={'raw':!![],'where':{'id':_0x10b10d[_0xc836('0x5a')]['id']}},_0x3f804b={};_0x3f804b['model']=_[_0xc836('0x47')](db[_0xc836('0x41')]['rawAttributes']);_0x3f804b[_0xc836('0x49')]=_['keys'](_0x10b10d[_0xc836('0x49')]);_0x3f804b[_0xc836('0x51')]=_[_0xc836('0x48')](_0x3f804b[_0xc836('0x46')],_0x3f804b['query']);_0x59b4f1['attributes']=_[_0xc836('0x48')](_0x3f804b[_0xc836('0x46')],qs[_0xc836('0x4b')](_0x10b10d[_0xc836('0x49')]['fields']));_0x59b4f1[_0xc836('0x4a')]=_0x59b4f1[_0xc836('0x4a')][_0xc836('0x4c')]?_0x59b4f1[_0xc836('0x4a')]:_0x3f804b[_0xc836('0x46')];if(_0x10b10d[_0xc836('0x49')][_0xc836('0x5b')]){_0x59b4f1[_0xc836('0x5c')]=[{'all':!![]}];}_0x59b4f1=_[_0xc836('0x55')]({},_0x59b4f1,_0x10b10d[_0xc836('0x56')]);return db[_0xc836('0x41')]['find'](_0x59b4f1)[_0xc836('0x24')](handleEntityNotFound(_0x315f7e,null))[_0xc836('0x24')](respondWithResult(_0x315f7e,null))['catch'](handleError(_0x315f7e,null));};exports[_0xc836('0x5d')]=function(_0x41ce37,_0x980a22){return db[_0xc836('0x41')][_0xc836('0x5d')](_0x41ce37[_0xc836('0x5e')],{})[_0xc836('0x24')](respondWithResult(_0x980a22,0xc9))['catch'](handleError(_0x980a22,null));};exports[_0xc836('0x3a')]=function(_0x2fffec,_0x5a0cd5){if(_0x2fffec[_0xc836('0x5e')]['id']){delete _0x2fffec[_0xc836('0x5e')]['id'];}return db[_0xc836('0x41')][_0xc836('0x5f')]({'where':{'id':_0x2fffec[_0xc836('0x5a')]['id']}})[_0xc836('0x24')](handleEntityNotFound(_0x5a0cd5,null))[_0xc836('0x24')](saveUpdates(_0x2fffec[_0xc836('0x5e')],null))[_0xc836('0x24')](respondWithResult(_0x5a0cd5,null))[_0xc836('0x2c')](handleError(_0x5a0cd5,null));};exports['destroy']=function(_0x436955,_0x4f81c5){return db['OpenchannelMessage']['find']({'where':{'id':_0x436955['params']['id']}})[_0xc836('0x24')](handleEntityNotFound(_0x4f81c5,null))[_0xc836('0x24')](removeEntity(_0x4f81c5,null))[_0xc836('0x2c')](handleError(_0x4f81c5,null));};exports[_0xc836('0x60')]=function(_0x49bfa6,_0x6cd678){return db['OpenchannelMessage'][_0xc836('0x60')]()['then'](respondWithResult(_0x6cd678,null))[_0xc836('0x2c')](handleError(_0x6cd678,null));};var interaction_log=require(_0xc836('0x17'))(_0xc836('0x61'));exports[_0xc836('0x62')]=function(_0x18d635,_0xd84dcd,_0x74e48e){var _0x3bc8dc={'agent':{},'channel':_0xc836('0x63')};if(_0x18d635[_0xc836('0x5e')]['id']){delete _0x18d635[_0xc836('0x5e')]['id'];}_0x18d635[_0xc836('0x5e')][_0xc836('0x64')]=!![];_0x18d635[_0xc836('0x5e')][_0xc836('0x65')]=moment()[_0xc836('0x66')](_0xc836('0x67'));_0x18d635['body'][_0xc836('0x68')]=_0x18d635[_0xc836('0x5e')][_0xc836('0x68')]||_0x18d635[_0xc836('0x69')]['id'];_0x3bc8dc['agent']['id']=_0x18d635['body'][_0xc836('0x68')];return db[_0xc836('0x41')][_0xc836('0x5f')]({'where':{'id':_0x18d635['params']['id'],'UserId':null}})[_0xc836('0x24')](handleEntityNotFound(_0xd84dcd,null))[_0xc836('0x24')](saveUpdates(_0x18d635[_0xc836('0x5e')],null))[_0xc836('0x24')](function(_0x4297a9){if(_0x4297a9){_0x3bc8dc[_0xc836('0x2b')]=_0x4297a9['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4297a9['OpenchannelInteractionId']}});}return null;})[_0xc836('0x24')](handleEntityNotFound(_0xd84dcd,null))['then'](function(_0x2a810d){if(_0x2a810d){return _0x2a810d['update']({'UserId':_0x18d635[_0xc836('0x5e')][_0xc836('0x68')],'read1stAt':_[_0xc836('0x6a')](_0x2a810d[_0xc836('0x6b')])?moment()[_0xc836('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc836('0x24')](function(_0x351482){if(_0x351482){_0x3bc8dc[_0xc836('0x6c')]=_0x351482[_0xc836('0x6d')]({'plain':!![]});interaction_log[_0xc836('0x25')](_0xc836('0x6e'),_0x18d635[_0xc836('0x69')]['id'],_0x18d635[_0xc836('0x69')]['name'],_0x18d635['user'][_0xc836('0x6f')],_0x3bc8dc[_0xc836('0x6c')]['id'],_0x18d635[_0xc836('0x5e')]?JSON[_0xc836('0x70')](_0x18d635['body']):_0xc836('0x71'));return respondWithRpcPromise(_0xc836('0x72'),_0xc836('0x73'),_0x3bc8dc);}return null;})[_0xc836('0x24')](function(_0x1c6f9a){var _0x436d7c=_0xc836('0x74')+_0x1c6f9a[_0xc836('0x2b')][_0xc836('0x75')];return db['sequelize'][_0xc836('0x49')](_0x436d7c,{'type':db[_0xc836('0x76')][_0xc836('0x77')][_0xc836('0x78')],'raw':!![]})[_0xc836('0x24')](function(_0x36920f){return _0x36920f;});})[_0xc836('0x24')](function(_0xf9cc60){if(_0xf9cc60){_0x3bc8dc['message']['contact']=_0xf9cc60[0x0];if(!_0x18d635[_0xc836('0x5e')][_0xc836('0x68')])return;return db[_0xc836('0x79')][_0xc836('0x5f')]({'where':{'id':_0x18d635[_0xc836('0x5e')][_0xc836('0x68')],'role':_0xc836('0x7a')},'attributes':['id',_0xc836('0x3d'),'fullname',_0xc836('0x7b'),_0xc836('0x7c')],'raw':!![]});}return null;})['then'](function(_0x1d288c){if(!_0x1d288c)return null;_0x3bc8dc['message'][_0xc836('0x7a')]=_0x1d288c;return _0x3bc8dc;})[_0xc836('0x24')](function(_0x5cb7cf){if(_0x5cb7cf){if(_0x18d635[_0xc836('0x5e')][_0xc836('0x7d')]){_0x3bc8dc['message'][_0xc836('0x7e')]=util[_0xc836('0x66')](_0xc836('0x7f'),_0x18d635[_0xc836('0x69')][_0xc836('0x3d')]);_0x3bc8dc['message']['channel']=_0x3bc8dc[_0xc836('0x80')];_0x3bc8dc[_0xc836('0x2b')][_0xc836('0x81')]=_0x3bc8dc[_0xc836('0x80')];_0x3bc8dc[_0xc836('0x2b')][_0xc836('0x82')]=_0xc836('0x62');return respondWithRpcPromise(_0xc836('0x83'),_0xc836('0x83'),{'event':_0xc836('0x84'),'message':_0x3bc8dc[_0xc836('0x2b')]},client9002)[_0xc836('0x24')](function(){return _0x3bc8dc;});}return _0x3bc8dc;}return null;})[_0xc836('0x24')](respondWithResult(_0xd84dcd,null))[_0xc836('0x2c')](handleError(_0xd84dcd,null));};var interaction_log=require(_0xc836('0x17'))('openchannel-interactions');exports[_0xc836('0x38')]=function(_0x4dec2d,_0x4fd816,_0x3e4ae5){var _0x59c704={'agent':{},'channel':'openchannel'};if(_0x4dec2d['body']['id']){delete _0x4dec2d[_0xc836('0x5e')]['id'];}_0x4dec2d['body']['UserId']=_0x4dec2d[_0xc836('0x5e')][_0xc836('0x68')]||_0x4dec2d[_0xc836('0x69')]['id'];_0x59c704[_0xc836('0x7a')]['id']=_0x4dec2d[_0xc836('0x5e')]['UserId'];return db[_0xc836('0x41')]['find']({'where':{'id':_0x4dec2d[_0xc836('0x5a')]['id'],'UserId':null}})[_0xc836('0x24')](handleEntityNotFound(_0x4fd816,null))[_0xc836('0x24')](function(_0xfd6e17){if(_0xfd6e17){_0x59c704['message']=_0xfd6e17['get']({'plain':!![]});return db[_0xc836('0x85')][_0xc836('0x5f')]({'where':{'id':_0xfd6e17['OpenchannelInteractionId']}});}return null;})[_0xc836('0x24')](handleEntityNotFound(_0x4fd816,null))[_0xc836('0x24')](function(_0x2e246c){if(_0x2e246c){_0x59c704[_0xc836('0x6c')]=_0x2e246c[_0xc836('0x6d')]({'plain':!![]});interaction_log[_0xc836('0x25')](_0xc836('0x86'),_0x4dec2d['user']['id'],_0x4dec2d[_0xc836('0x69')][_0xc836('0x3d')],_0x4dec2d['user'][_0xc836('0x6f')],_0x59c704['interaction']['id'],_0x4dec2d[_0xc836('0x5e')]?JSON[_0xc836('0x70')](_0x4dec2d[_0xc836('0x5e')]):_0xc836('0x71'));return respondWithRpcPromise('RejectMessage',_0xc836('0x87'),_0x59c704);}return null;})['then'](function(_0x31f54a){var _0x16b0d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31f54a[_0xc836('0x2b')][_0xc836('0x75')];return db[_0xc836('0x88')][_0xc836('0x49')](_0x16b0d1,{'type':db[_0xc836('0x76')]['QueryTypes'][_0xc836('0x78')],'raw':!![]})['then'](function(_0xf15742){return _0xf15742;});})[_0xc836('0x24')](function(_0x2fcbe5){if(_0x2fcbe5){_0x59c704[_0xc836('0x2b')][_0xc836('0x89')]=_0x2fcbe5[0x0];if(!_0x4dec2d[_0xc836('0x5e')][_0xc836('0x68')])return;return db[_0xc836('0x79')][_0xc836('0x5f')]({'where':{'id':_0x4dec2d[_0xc836('0x5e')][_0xc836('0x68')],'role':_0xc836('0x7a')},'attributes':['id','name',_0xc836('0x8a'),_0xc836('0x7b'),_0xc836('0x7c')],'raw':!![]});}return null;})['then'](function(_0x1dd335){if(!_0x1dd335)return null;_0x59c704['message'][_0xc836('0x7a')]=_0x1dd335;return _0x59c704;})['then'](function(_0x5e384e){if(_0x5e384e){_0x5e384e[_0xc836('0x2b')][_0xc836('0x7e')]=util['format'](_0xc836('0x7f'),_0x4dec2d[_0xc836('0x69')][_0xc836('0x3d')]);_0x5e384e['message'][_0xc836('0x80')]=_0x59c704[_0xc836('0x80')];_0x5e384e[_0xc836('0x2b')]['motionChannel']=_0x59c704[_0xc836('0x80')];_0x5e384e[_0xc836('0x2b')][_0xc836('0x82')]=_0xc836('0x38');respondWithRpcPromise(_0xc836('0x83'),_0xc836('0x83'),{'event':_0xc836('0x8b'),'message':_0x5e384e['message']},client9002);return _0x59c704;}return null;})[_0xc836('0x24')](respondWithResult(_0x4fd816,null))[_0xc836('0x2c')](handleError(_0x4fd816,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 54a3319..32f9f5a 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 _0x4265=['setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage'];(function(_0x45757e,_0x44b6d6){var _0x197e15=function(_0x30f624){while(--_0x30f624){_0x45757e['push'](_0x45757e['shift']());}};_0x197e15(++_0x44b6d6);}(_0x4265,0x16d));var _0x5426=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4265[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x5426('0x0'));var OpenchannelMessage=require(_0x5426('0x1'))['db'][_0x5426('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5426('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5426('0x4')};function emitEvent(_0x1ce93d){return function(_0x2ca885,_0x27e571,_0x4697d5){OpenchannelMessageEvents[_0x5426('0x5')](_0x1ce93d+':'+_0x2ca885['id'],_0x2ca885);OpenchannelMessageEvents[_0x5426('0x5')](_0x1ce93d,_0x2ca885);_0x4697d5(null);};}for(var e in events){if(events[_0x5426('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5426('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x323e=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x6bf699,_0x4dfc4c){var _0xd2ace4=function(_0x20b824){while(--_0x20b824){_0x6bf699['push'](_0x6bf699['shift']());}};_0xd2ace4(++_0x4dfc4c);}(_0x323e,0x10d));var _0xe323=function(_0x1992cd,_0x57d364){_0x1992cd=_0x1992cd-0x0;var _0x33c636=_0x323e[_0x1992cd];return _0x33c636;};'use strict';var EventEmitter=require(_0xe323('0x0'));var OpenchannelMessage=require(_0xe323('0x1'))['db'][_0xe323('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe323('0x3')](0x0);var events={'afterCreate':_0xe323('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2df866){return function(_0x4ba3da,_0x5ecd70,_0x5e2104){OpenchannelMessageEvents[_0xe323('0x5')](_0x2df866+':'+_0x4ba3da['id'],_0x4ba3da);OpenchannelMessageEvents[_0xe323('0x5')](_0x2df866,_0x4ba3da);_0x5e2104(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe323('0x6')](e,emitEvent(event));}}module[_0xe323('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index aba57ee..085e1ea 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 _0x46dc=['FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','out','CmContact','find','OpenchannelAccountId','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','Contact','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body'];(function(_0x112c72,_0x5e32f1){var _0x1ef993=function(_0x295786){while(--_0x295786){_0x112c72['push'](_0x112c72['shift']());}};_0x1ef993(++_0x5e32f1);}(_0x46dc,0x18a));var _0xc46d=function(_0x1568ad,_0x5a041b){_0x1568ad=_0x1568ad-0x0;var _0x1cd0b6=_0x46dc[_0x1568ad];return _0x1cd0b6;};'use strict';var _=require(_0xc46d('0x0'));var util=require('util');var logger=require(_0xc46d('0x1'))(_0xc46d('0x2'));var moment=require(_0xc46d('0x3'));var BPromise=require(_0xc46d('0x4'));var rp=require(_0xc46d('0x5'));var fs=require('fs');var path=require(_0xc46d('0x6'));var rimraf=require(_0xc46d('0x7'));var config=require('../../config/environment');var attributes=require(_0xc46d('0x8'));module['exports']=function(_0x358a7a,_0x44c6ca){return _0x358a7a[_0xc46d('0x9')](_0xc46d('0xa'),attributes,{'tableName':_0xc46d('0xb'),'paranoid':![],'indexes':[{'name':_0xc46d('0xc'),'fields':[_0xc46d('0xd')],'type':_0xc46d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x225f52,_0x4ba462,_0x3c969f){var _0x137918=_0x358a7a['models'];var _0x585a3a=_0x225f52[_0xc46d('0xf')]({'plain':!![]});if(_0x585a3a[_0xc46d('0x10')]['toLowerCase']()==='in'||_0x585a3a[_0xc46d('0x10')][_0xc46d('0x11')]()==='out'&&!_0x585a3a[_0xc46d('0x12')]&&!_[_0xc46d('0x13')](_0x585a3a[_0xc46d('0x14')])){_0x137918[_0xc46d('0x15')]['findOne']({'where':{'id':_0x585a3a[_0xc46d('0x16')]}})[_0xc46d('0x17')](function(_0x3b2256){if(_0x3b2256){_0x3b2256[_0xc46d('0x18')]({'lastMsgAt':_0x585a3a[_0xc46d('0x19')],'lastMsgDirection':_0x585a3a[_0xc46d('0x10')][_0xc46d('0x11')]()});}})['catch'](function(_0x66b948){console[_0xc46d('0x1a')](_0x66b948);});}if(_0x585a3a['direction']===_0xc46d('0x1b')&&!_0x585a3a[_0xc46d('0x12')]){var _0x55b721;_0x137918[_0xc46d('0x1c')]['describe']()[_0xc46d('0x17')](function(_0x5da4f0){return _0x137918['OpenchannelAccount'][_0xc46d('0x1d')]({'where':{'id':_0x585a3a[_0xc46d('0x1e')]},'include':[{'model':_0x137918[_0xc46d('0x15')],'as':'Interactions','where':{'id':_0x585a3a['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x137918[_0xc46d('0x1c')],'as':'Contact','attributes':_[_0xc46d('0x1f')](_0x5da4f0)}]}]});})['then'](function(_0x309e9d){_0x55b721=_0x309e9d['get']({'plain':!![]});if(_0x55b721&&_0x55b721['replyUri']){logger[_0xc46d('0x20')](_0xc46d('0x21'),_0xc46d('0x22'),util[_0xc46d('0x23')](_0xc46d('0x24'),_0x585a3a['id'],_0x55b721[_0xc46d('0x25')]));if(_0x55b721['Interactions']&&_0x55b721[_0xc46d('0x26')][_0xc46d('0x27')]){_0x585a3a[_0xc46d('0x28')]=_[_0xc46d('0x29')](_0x55b721[_0xc46d('0x26')][0x0],_0xc46d('0x2a'));_0x585a3a['Contact']=_0x55b721[_0xc46d('0x26')][0x0][_0xc46d('0x2a')];}var _0x4ba462={'method':_0xc46d('0x2b'),'uri':encodeURI(_0x55b721['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4ba462['method']){case'GET':_0x4ba462['qs']=_0x585a3a;break;case _0xc46d('0x2b'):_0x4ba462[_0xc46d('0xd')]=_0x585a3a;break;}return rp(_0x4ba462)[_0xc46d('0x17')](function(_0xceb822){logger[_0xc46d('0x20')](_0xc46d('0x21'),_0xc46d('0x22'),util['format'](_0xc46d('0x2c'),_0x585a3a['id'],_0x55b721['replyUri']));if(_0xceb822[_0xc46d('0xd')]['threadId']&&_0xceb822[_0xc46d('0xd')]['threadId']!=_0x585a3a['Interaction'][_0xc46d('0x2d')]){return _0x137918[_0xc46d('0x15')][_0xc46d('0x18')]({'threadId':_0xceb822['body'][_0xc46d('0x2d')]},{'where':{'id':_0x585a3a['Interaction']['id']}});}else{return;}})['then'](function(){return _0x225f52[_0xc46d('0x18')]({'read':!![]});})[_0xc46d('0x2e')](function(_0x36e260){logger[_0xc46d('0x1a')](_0xc46d('0x21'),_0xc46d('0x22'),util[_0xc46d('0x2f')](_0x36e260,{'showHidden':![],'depth':null}));_0x3c969f();});}else{_0x3c969f();}})[_0xc46d('0x30')](function(){_0x3c969f();});}else{_0x3c969f();}}},'charset':_0xc46d('0x31'),'collate':_0xc46d('0x32')});}; \ No newline at end of file +var _0x604e=['UserId','findOne','then','createdAt','catch','error','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x1896c5,_0x5ce147){var _0x55d738=function(_0x4c1543){while(--_0x4c1543){_0x1896c5['push'](_0x1896c5['shift']());}};_0x55d738(++_0x5ce147);}(_0x604e,0x111));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe604('0x0'));var util=require(_0xe604('0x1'));var logger=require(_0xe604('0x2'))(_0xe604('0x3'));var moment=require(_0xe604('0x4'));var BPromise=require(_0xe604('0x5'));var rp=require(_0xe604('0x6'));var fs=require('fs');var path=require(_0xe604('0x7'));var rimraf=require(_0xe604('0x8'));var config=require('../../config/environment');var attributes=require(_0xe604('0x9'));module[_0xe604('0xa')]=function(_0x4cb473,_0x595047){return _0x4cb473[_0xe604('0xb')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe604('0xc'),'fields':[_0xe604('0xd')],'type':_0xe604('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b0835,_0x4fbea1,_0xd28d57){var _0x5e97a2=_0x4cb473[_0xe604('0xf')];var _0x22de3b=_0x2b0835[_0xe604('0x10')]({'plain':!![]});if(_0x22de3b[_0xe604('0x11')][_0xe604('0x12')]()==='in'||_0x22de3b[_0xe604('0x11')][_0xe604('0x12')]()===_0xe604('0x13')&&!_0x22de3b[_0xe604('0x14')]&&!_['isNil'](_0x22de3b[_0xe604('0x15')])){_0x5e97a2['OpenchannelInteraction'][_0xe604('0x16')]({'where':{'id':_0x22de3b['OpenchannelInteractionId']}})[_0xe604('0x17')](function(_0x458e77){if(_0x458e77){_0x458e77['update']({'lastMsgAt':_0x22de3b[_0xe604('0x18')],'lastMsgDirection':_0x22de3b[_0xe604('0x11')][_0xe604('0x12')]()});}})[_0xe604('0x19')](function(_0x126646){console[_0xe604('0x1a')](_0x126646);});}if(_0x22de3b[_0xe604('0x11')]===_0xe604('0x13')&&!_0x22de3b[_0xe604('0x14')]){var _0x20c470;_0x5e97a2['CmContact']['describe']()[_0xe604('0x17')](function(_0x3d10fd){return _0x5e97a2['OpenchannelAccount'][_0xe604('0x1b')]({'where':{'id':_0x22de3b[_0xe604('0x1c')]},'include':[{'model':_0x5e97a2[_0xe604('0x1d')],'as':_0xe604('0x1e'),'where':{'id':_0x22de3b[_0xe604('0x1f')]},'limit':0x1,'include':[{'model':_0x5e97a2[_0xe604('0x20')],'as':_0xe604('0x21'),'attributes':_[_0xe604('0x22')](_0x3d10fd)}]}]});})[_0xe604('0x17')](function(_0x34e96f){_0x20c470=_0x34e96f[_0xe604('0x10')]({'plain':!![]});if(_0x20c470&&_0x20c470[_0xe604('0x23')]){logger[_0xe604('0x24')](_0xe604('0x25'),'afterCreate',util[_0xe604('0x26')](_0xe604('0x27'),_0x22de3b['id'],_0x20c470[_0xe604('0x23')]));if(_0x20c470[_0xe604('0x1e')]&&_0x20c470[_0xe604('0x1e')]['length']){_0x22de3b['Interaction']=_[_0xe604('0x28')](_0x20c470[_0xe604('0x1e')][0x0],'Contact');_0x22de3b[_0xe604('0x21')]=_0x20c470['Interactions'][0x0][_0xe604('0x21')];}var _0x4fbea1={'method':'POST','uri':encodeURI(_0x20c470[_0xe604('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4fbea1[_0xe604('0x29')]){case _0xe604('0x2a'):_0x4fbea1['qs']=_0x22de3b;break;case'POST':_0x4fbea1[_0xe604('0xd')]=_0x22de3b;break;}return rp(_0x4fbea1)[_0xe604('0x17')](function(_0x1a6323){logger[_0xe604('0x24')](_0xe604('0x25'),_0xe604('0x2b'),util[_0xe604('0x26')](_0xe604('0x2c'),_0x22de3b['id'],_0x20c470[_0xe604('0x23')]));if(_0x1a6323[_0xe604('0xd')][_0xe604('0x2d')]&&_0x1a6323[_0xe604('0xd')][_0xe604('0x2d')]!=_0x22de3b[_0xe604('0x2e')][_0xe604('0x2d')]){return _0x5e97a2['OpenchannelInteraction'][_0xe604('0x2f')]({'threadId':_0x1a6323[_0xe604('0xd')][_0xe604('0x2d')]},{'where':{'id':_0x22de3b[_0xe604('0x2e')]['id']}});}else{return;}})[_0xe604('0x17')](function(){return _0x2b0835['update']({'read':!![]});})[_0xe604('0x19')](function(_0x186411){logger[_0xe604('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0xe604('0x2b'),util[_0xe604('0x30')](_0x186411,{'showHidden':![],'depth':null}));_0xd28d57();});}else{_0xd28d57();}})['finally'](function(){_0xd28d57();});}else{_0xd28d57();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 164b233..fc51563 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x27e9dc,_0x4c0f8f){var _0x24d46a=function(_0x49f3a6){while(--_0x49f3a6){_0x27e9dc['push'](_0x27e9dc['shift']());}};_0x24d46a(++_0x4c0f8f);}(_0xadb5,0xad));var _0x5adb=function(_0x14cb35,_0x44d795){_0x14cb35=_0x14cb35-0x0;var _0x2e943e=_0xadb5[_0x14cb35];return _0x2e943e;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4c58dc,_0x2bd1b8){var _0x86c251=function(_0x260d05){while(--_0x260d05){_0x4c58dc['push'](_0x4c58dc['shift']());}};_0x86c251(++_0x2bd1b8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 48f5f18..14f1251 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 _0xa759=['length','./openchannelMessage.events','save','remove','update','register'];(function(_0x43f92e,_0x26229c){var _0x329ded=function(_0x52dd7a){while(--_0x52dd7a){_0x43f92e['push'](_0x43f92e['shift']());}};_0x329ded(++_0x26229c);}(_0xa759,0xb5));var _0x9a75=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0xa759[_0x2467b8];return _0x5d3095;};'use strict';var OpenchannelMessageEvents=require(_0x9a75('0x0'));var events=[_0x9a75('0x1'),_0x9a75('0x2'),_0x9a75('0x3')];function createListener(_0x37802b,_0x5d7842){return function(_0x5de754){_0x5d7842['emit'](_0x37802b,_0x5de754);};}function removeListener(_0x4d92f7,_0x3424ad){return function(){OpenchannelMessageEvents['removeListener'](_0x4d92f7,_0x3424ad);};}exports[_0x9a75('0x4')]=function(_0x4a549b){for(var _0x112c02=0x0,_0x506377=events[_0x9a75('0x5')];_0x112c02<_0x506377;_0x112c02++){var _0x37c300=events[_0x112c02];var _0x40f003=createListener('openchannelMessage:'+_0x37c300,_0x4a549b);OpenchannelMessageEvents['on'](_0x37c300,_0x40f003);}}; \ No newline at end of file +var _0xf163=['register','length','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x406dfd,_0x3b48cb){var _0x5a9101=function(_0x11cd9e){while(--_0x11cd9e){_0x406dfd['push'](_0x406dfd['shift']());}};_0x5a9101(++_0x3b48cb);}(_0xf163,0x129));var _0x3f16=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xf163[_0x532112];return _0x23e5fb;};'use strict';var OpenchannelMessageEvents=require(_0x3f16('0x0'));var events=['save',_0x3f16('0x1'),_0x3f16('0x2')];function createListener(_0x3ccaa4,_0x335c2b){return function(_0x3b5045){_0x335c2b['emit'](_0x3ccaa4,_0x3b5045);};}function removeListener(_0xb7e352,_0x2accc4){return function(){OpenchannelMessageEvents['removeListener'](_0xb7e352,_0x2accc4);};}exports[_0x3f16('0x3')]=function(_0x1307b7){for(var _0x6d1be=0x0,_0x3b40df=events[_0x3f16('0x4')];_0x6d1be<_0x3b40df;_0x6d1be++){var _0x328f62=events[_0x6d1be];var _0x3b3a9c=createListener(_0x3f16('0x5')+_0x328f62,_0x1307b7);OpenchannelMessageEvents['on'](_0x328f62,_0x3b3a9c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 11aa3a7..959c1e2 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 _0x3dc1=['removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','destroy'];(function(_0x45cda1,_0x539de5){var _0x9ad750=function(_0xad0fdb){while(--_0xad0fdb){_0x45cda1['push'](_0x45cda1['shift']());}};_0x9ad750(++_0x539de5);}(_0x3dc1,0x137));var _0x13dc=function(_0x25c247,_0x4984be){_0x25c247=_0x25c247-0x0;var _0x37b223=_0x3dc1[_0x25c247];return _0x37b223;};'use strict';var multer=require('multer');var util=require(_0x13dc('0x0'));var path=require(_0x13dc('0x1'));var timeout=require(_0x13dc('0x2'));var express=require('express');var router=express[_0x13dc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x13dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x13dc('0x5'));var controller=require(_0x13dc('0x6'));router[_0x13dc('0x7')]('/',auth[_0x13dc('0x8')](),controller[_0x13dc('0x9')]);router[_0x13dc('0x7')](_0x13dc('0xa'),auth[_0x13dc('0x8')](),controller['describe']);router[_0x13dc('0x7')](_0x13dc('0xb'),auth['isAuthenticated'](),controller[_0x13dc('0xc')]);router['get'](_0x13dc('0xd'),auth[_0x13dc('0x8')](),controller[_0x13dc('0xe')]);router[_0x13dc('0x7')](_0x13dc('0xf'),auth[_0x13dc('0x8')](),controller[_0x13dc('0x10')]);router[_0x13dc('0x7')]('/:id/users',auth[_0x13dc('0x8')](),controller[_0x13dc('0x11')]);router[_0x13dc('0x12')]('/',auth['isAuthenticated'](),controller[_0x13dc('0x13')]);router[_0x13dc('0x12')](_0x13dc('0xf'),auth[_0x13dc('0x8')](),controller[_0x13dc('0x14')]);router[_0x13dc('0x12')](_0x13dc('0x15'),auth[_0x13dc('0x8')](),controller[_0x13dc('0x16')]);router[_0x13dc('0x17')](_0x13dc('0xb'),auth[_0x13dc('0x8')](),controller['update']);router['delete']('/:id',auth[_0x13dc('0x8')](),controller[_0x13dc('0x18')]);router['delete'](_0x13dc('0xf'),auth[_0x13dc('0x8')](),controller[_0x13dc('0x19')]);router['delete'](_0x13dc('0x15'),auth[_0x13dc('0x8')](),controller[_0x13dc('0x1a')]);module[_0x13dc('0x1b')]=router; \ No newline at end of file +var _0x6f22=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x6f22,0xf7));var _0x26f2=function(_0x268d75,_0x4ea6c2){_0x268d75=_0x268d75-0x0;var _0x2d302c=_0x6f22[_0x268d75];return _0x2d302c;};'use strict';var multer=require(_0x26f2('0x0'));var util=require(_0x26f2('0x1'));var path=require(_0x26f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x26f2('0x3'));var router=express[_0x26f2('0x4')]();var fs_extra=require(_0x26f2('0x5'));var auth=require(_0x26f2('0x6'));var interaction=require(_0x26f2('0x7'));var config=require(_0x26f2('0x8'));var controller=require(_0x26f2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x26f2('0xa')]);router['get'](_0x26f2('0xb'),auth[_0x26f2('0xc')](),controller[_0x26f2('0xd')]);router[_0x26f2('0xe')](_0x26f2('0xf'),auth[_0x26f2('0xc')](),controller[_0x26f2('0x10')]);router['get'](_0x26f2('0x11'),auth[_0x26f2('0xc')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x26f2('0xc')](),controller[_0x26f2('0x12')]);router[_0x26f2('0xe')](_0x26f2('0x13'),auth[_0x26f2('0xc')](),controller['getAgents']);router[_0x26f2('0x14')]('/',auth[_0x26f2('0xc')](),controller[_0x26f2('0x15')]);router[_0x26f2('0x14')](_0x26f2('0x16'),auth[_0x26f2('0xc')](),controller['addTeams']);router['post'](_0x26f2('0x13'),auth['isAuthenticated'](),controller[_0x26f2('0x17')]);router[_0x26f2('0x18')](_0x26f2('0xf'),auth['isAuthenticated'](),controller[_0x26f2('0x19')]);router[_0x26f2('0x1a')](_0x26f2('0xf'),auth[_0x26f2('0xc')](),controller[_0x26f2('0x1b')]);router[_0x26f2('0x1a')](_0x26f2('0x16'),auth['isAuthenticated'](),controller[_0x26f2('0x1c')]);router[_0x26f2('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x26f2('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4e4044d..56654f0 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 _0xc751=['INTEGER','ENUM','roundrobin'];(function(_0x16a9e2,_0x4ddcb3){var _0x2e4d0b=function(_0x8cd253){while(--_0x8cd253){_0x16a9e2['push'](_0x16a9e2['shift']());}};_0x2e4d0b(++_0x4ddcb3);}(_0xc751,0x1a7));var _0x1c75=function(_0x1faf34,_0x5a96e7){_0x1faf34=_0x1faf34-0x0;var _0x294624=_0xc751[_0x1faf34];return _0x294624;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1c75('0x0')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1c75('0x1')]('rrmemory','beepall',_0x1c75('0x2'))}}; \ No newline at end of file +var _0xa3cd=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x29379d,_0xa527c8){var _0x1e6823=function(_0x4c7441){while(--_0x4c7441){_0x29379d['push'](_0x29379d['shift']());}};_0x1e6823(++_0xa527c8);}(_0xa3cd,0x12a));var _0xda3c=function(_0x1c7613,_0x7cf00d){_0x1c7613=_0x1c7613-0x0;var _0x1122ac=_0xa3cd[_0x1c7613];return _0x1122ac;};'use strict';var Sequelize=require(_0xda3c('0x0'));module[_0xda3c('0x1')]={'name':{'type':Sequelize[_0xda3c('0x2')],'unique':_0xda3c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xda3c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda3c('0x5')](_0xda3c('0x6'),_0xda3c('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0ec77d9..08fa999 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 _0x667f=['role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','online','voicePause','interface','flatMap','Agents','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','map','OpenchannelQueue','fieldName','type','key','query','keys','attributes','intersection','model','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x58c09f,_0x1edbeb){var _0x14c9cb=function(_0x148489){while(--_0x148489){_0x58c09f['push'](_0x58c09f['shift']());}};_0x14c9cb(++_0x1edbeb);}(_0x667f,0xce));var _0xf667=function(_0x2dc8b5,_0x5b245b){_0x2dc8b5=_0x2dc8b5-0x0;var _0x148051=_0x667f[_0x2dc8b5];return _0x148051;};'use strict';var emlformat=require(_0xf667('0x0'));var rimraf=require(_0xf667('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf667('0x2'));var rp=require(_0xf667('0x3'));var moment=require(_0xf667('0x4'));var BPromise=require(_0xf667('0x5'));var Mustache=require('mustache');var util=require(_0xf667('0x6'));var path=require(_0xf667('0x7'));var sox=require(_0xf667('0x8'));var csv=require(_0xf667('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf667('0xa'));var _=require('lodash');var squel=require(_0xf667('0xb'));var crypto=require(_0xf667('0xc'));var jsforce=require(_0xf667('0xd'));var deskjs=require(_0xf667('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf667('0xf'));var Papa=require(_0xf667('0x10'));var Redis=require(_0xf667('0x11'));var authService=require(_0xf667('0x12'));var qs=require(_0xf667('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf667('0x14'));var logger=require('../../config/logger')(_0xf667('0x15'));var utils=require('../../config/utils');var config=require(_0xf667('0x16'));var licenseUtil=require(_0xf667('0x17'));var db=require(_0xf667('0x18'))['db'];config[_0xf667('0x19')]=_['defaults'](config[_0xf667('0x19')],{'host':_0xf667('0x1a'),'port':0x18eb});var socket=require(_0xf667('0x1b'))(new Redis(config[_0xf667('0x19')]));require(_0xf667('0x1c'))[_0xf667('0x1d')](socket);function respondWithStatusCode(_0x51156e,_0x35eaad){_0x35eaad=_0x35eaad||0xcc;return function(_0x41ba83){if(_0x41ba83){return _0x51156e[_0xf667('0x1e')](_0x35eaad);}return _0x51156e[_0xf667('0x1f')](_0x35eaad)[_0xf667('0x20')]();};}function respondWithResult(_0x2f4e47,_0x47452f){_0x47452f=_0x47452f||0xc8;return function(_0x20927a){if(_0x20927a){return _0x2f4e47['status'](_0x47452f)[_0xf667('0x21')](_0x20927a);}};}function respondWithFilteredResult(_0x5aa2c5,_0x873587){return function(_0x1de3a3){if(_0x1de3a3){var _0xe96380=typeof _0x873587['offset']===_0xf667('0x22')&&typeof _0x873587[_0xf667('0x23')]===_0xf667('0x22');var _0x18c9e7=_0x1de3a3['count'];var _0x212f0a=_0xe96380?0x0:_0x873587[_0xf667('0x24')];var _0x268d52=_0xe96380?_0x1de3a3[_0xf667('0x25')]:_0x873587[_0xf667('0x24')]+_0x873587[_0xf667('0x23')];var _0x25d6a8;if(_0x268d52>=_0x18c9e7){_0x268d52=_0x18c9e7;_0x25d6a8=0xc8;}else{_0x25d6a8=0xce;}_0x5aa2c5['status'](_0x25d6a8);return _0x5aa2c5[_0xf667('0x26')]('Content-Range',_0x212f0a+'-'+_0x268d52+'/'+_0x18c9e7)['json'](_0x1de3a3);}return null;};}function patchUpdates(_0x5e8137){return function(_0x5c02a9){try{jsonpatch[_0xf667('0x27')](_0x5c02a9,_0x5e8137,!![]);}catch(_0x2c3bef){return BPromise['reject'](_0x2c3bef);}return _0x5c02a9['save']();};}function saveUpdates(_0x1eb5bd,_0x2fb7d0){return function(_0x26237b){if(_0x26237b){return _0x26237b[_0xf667('0x28')](_0x1eb5bd)[_0xf667('0x29')](function(_0x354dc9){return _0x354dc9;});}return null;};}function removeEntity(_0x58784f,_0x5837b3){return function(_0x305e54){if(_0x305e54){return _0x305e54[_0xf667('0x2a')]()[_0xf667('0x29')](function(){var _0x217b96=_0x305e54[_0xf667('0x2b')]({'plain':!![]});var _0x430573=_0xf667('0x2c');return db[_0xf667('0x2d')][_0xf667('0x2a')]({'where':{'type':_0x430573,'resourceId':_0x217b96['id']}})[_0xf667('0x29')](function(){return _0x305e54;});})[_0xf667('0x29')](function(){_0x58784f[_0xf667('0x1f')](0xcc)[_0xf667('0x20')]();});}};}function handleEntityNotFound(_0x5046c9,_0x5c0263){return function(_0x1ff779){if(!_0x1ff779){_0x5046c9[_0xf667('0x1e')](0x194);}return _0x1ff779;};}function handleError(_0xebceed,_0x3ab585){_0x3ab585=_0x3ab585||0x1f4;return function(_0x5abccb){logger[_0xf667('0x2e')](_0x5abccb['stack']);if(_0x5abccb[_0xf667('0x2f')]){delete _0x5abccb[_0xf667('0x2f')];}_0xebceed[_0xf667('0x1f')](_0x3ab585)[_0xf667('0x30')](_0x5abccb);};}exports['index']=function(_0x5b7d69,_0x814d5a){var _0x52fade={},_0x29e118={},_0x3d7598={'count':0x0,'rows':[]};var _0xff51a8=_[_0xf667('0x31')](db[_0xf667('0x32')]['rawAttributes'],function(_0x501fa1){return{'name':_0x501fa1[_0xf667('0x33')],'type':_0x501fa1[_0xf667('0x34')][_0xf667('0x35')]};});_0x29e118['model']=_['map'](_0xff51a8,_0xf667('0x2f'));_0x29e118[_0xf667('0x36')]=_[_0xf667('0x37')](_0x5b7d69[_0xf667('0x36')]);_0x29e118['filters']=_['intersection'](_0x29e118['model'],_0x29e118[_0xf667('0x36')]);_0x52fade[_0xf667('0x38')]=_[_0xf667('0x39')](_0x29e118[_0xf667('0x3a')],qs[_0xf667('0x3b')](_0x5b7d69['query'][_0xf667('0x3b')]));_0x52fade[_0xf667('0x38')]=_0x52fade[_0xf667('0x38')]['length']?_0x52fade['attributes']:_0x29e118[_0xf667('0x3a')];if(!_0x5b7d69[_0xf667('0x36')]['hasOwnProperty'](_0xf667('0x3c'))){_0x52fade['limit']=qs[_0xf667('0x23')](_0x5b7d69['query'][_0xf667('0x23')]);_0x52fade[_0xf667('0x24')]=qs[_0xf667('0x24')](_0x5b7d69['query'][_0xf667('0x24')]);}_0x52fade['order']=qs[_0xf667('0x3d')](_0x5b7d69[_0xf667('0x36')]['sort']);_0x52fade[_0xf667('0x3e')]=qs[_0xf667('0x3f')](_[_0xf667('0x40')](_0x5b7d69[_0xf667('0x36')],_0x29e118['filters']),_0xff51a8);if(_0x5b7d69[_0xf667('0x36')][_0xf667('0x41')]){_0x52fade['where']=_['merge'](_0x52fade[_0xf667('0x3e')],{'$or':_['map'](_0xff51a8,function(_0x24a898){if(_0x24a898[_0xf667('0x34')]!==_0xf667('0x42')){var _0x192291={};_0x192291[_0x24a898[_0xf667('0x2f')]]={'$like':'%'+_0x5b7d69[_0xf667('0x36')][_0xf667('0x41')]+'%'};return _0x192291;}})});}_0x52fade=_[_0xf667('0x43')]({},_0x52fade,_0x5b7d69[_0xf667('0x44')]);var _0xabca77={'where':_0x52fade[_0xf667('0x3e')]};return db['OpenchannelQueue'][_0xf667('0x25')](_0xabca77)[_0xf667('0x29')](function(_0x17effa){_0x3d7598[_0xf667('0x25')]=_0x17effa;if(_0x5b7d69[_0xf667('0x36')][_0xf667('0x45')]){_0x52fade[_0xf667('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xf667('0x47')](_0x52fade);})[_0xf667('0x29')](function(_0x5d7bfc){_0x3d7598[_0xf667('0x48')]=_0x5d7bfc;return _0x3d7598;})[_0xf667('0x29')](respondWithFilteredResult(_0x814d5a,_0x52fade))[_0xf667('0x49')](handleError(_0x814d5a,null));};exports['show']=function(_0x26509e,_0xe1df92){var _0x1633d1={'raw':!![],'where':{'id':_0x26509e[_0xf667('0x4a')]['id']}},_0x4a650c={};_0x4a650c[_0xf667('0x3a')]=_[_0xf667('0x37')](db['OpenchannelQueue'][_0xf667('0x4b')]);_0x4a650c['query']=_[_0xf667('0x37')](_0x26509e[_0xf667('0x36')]);_0x4a650c[_0xf667('0x3f')]=_[_0xf667('0x39')](_0x4a650c[_0xf667('0x3a')],_0x4a650c[_0xf667('0x36')]);_0x1633d1[_0xf667('0x38')]=_[_0xf667('0x39')](_0x4a650c[_0xf667('0x3a')],qs[_0xf667('0x3b')](_0x26509e['query'][_0xf667('0x3b')]));_0x1633d1[_0xf667('0x38')]=_0x1633d1['attributes'][_0xf667('0x4c')]?_0x1633d1[_0xf667('0x38')]:_0x4a650c[_0xf667('0x3a')];if(_0x26509e[_0xf667('0x36')]['includeAll']){_0x1633d1[_0xf667('0x46')]=[{'all':!![]}];}_0x1633d1=_[_0xf667('0x43')]({},_0x1633d1,_0x26509e[_0xf667('0x44')]);return db['OpenchannelQueue'][_0xf667('0x4d')](_0x1633d1)['then'](handleEntityNotFound(_0xe1df92,null))[_0xf667('0x29')](respondWithResult(_0xe1df92,null))['catch'](handleError(_0xe1df92,null));};exports[_0xf667('0x4e')]=function(_0x40085a,_0x701c69){return db[_0xf667('0x32')]['create'](_0x40085a[_0xf667('0x4f')],{})[_0xf667('0x29')](function(_0x58751f){var _0x558161=_0x40085a[_0xf667('0x50')][_0xf667('0x2b')]({'plain':!![]});if(!_0x558161)throw new Error(_0xf667('0x51'));if(_0x558161[_0xf667('0x52')]==='user'){var _0xac7099=_0x58751f['get']({'plain':!![]});var _0x28ea53='OpenchannelQueues';return db[_0xf667('0x53')][_0xf667('0x4d')]({'where':{'name':_0x28ea53,'userProfileId':_0x558161['userProfileId']},'raw':!![]})[_0xf667('0x29')](function(_0x24c673){if(_0x24c673&&_0x24c673['autoAssociation']===0x0){return db['UserProfileResource'][_0xf667('0x4e')]({'name':_0xac7099['name'],'resourceId':_0xac7099['id'],'type':_0x24c673[_0xf667('0x2f')],'sectionId':_0x24c673['id']},{})[_0xf667('0x29')](function(){return _0x58751f;});}else{return _0x58751f;}})['catch'](function(_0x17da06){logger[_0xf667('0x2e')](_0xf667('0x54'),_0x17da06);throw _0x17da06;});}return _0x58751f;})[_0xf667('0x29')](respondWithResult(_0x701c69,0xc9))['catch'](handleError(_0x701c69,null));};exports[_0xf667('0x28')]=function(_0x36d82a,_0x35d1c3){if(_0x36d82a[_0xf667('0x4f')]['id']){delete _0x36d82a[_0xf667('0x4f')]['id'];}return db[_0xf667('0x32')][_0xf667('0x4d')]({'where':{'id':_0x36d82a[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x35d1c3,null))[_0xf667('0x29')](saveUpdates(_0x36d82a['body'],null))[_0xf667('0x29')](respondWithResult(_0x35d1c3,null))[_0xf667('0x49')](handleError(_0x35d1c3,null));};exports[_0xf667('0x2a')]=function(_0x4a4a74,_0x1f8f3b){return db[_0xf667('0x32')][_0xf667('0x4d')]({'where':{'id':_0x4a4a74[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x1f8f3b,null))['then'](removeEntity(_0x1f8f3b,null))[_0xf667('0x49')](handleError(_0x1f8f3b,null));};exports[_0xf667('0x55')]=function(_0x26e93e,_0x14feeb){return db[_0xf667('0x32')]['describe']()[_0xf667('0x29')](respondWithResult(_0x14feeb,null))[_0xf667('0x49')](handleError(_0x14feeb,null));};exports['getMembers']=function(_0x3c82d3,_0x3e5026,_0x161c6c){var _0x48cdc8={'raw':!![],'where':{}},_0x364b60={},_0x166946;return db[_0xf667('0x32')]['findOne']({'where':{'id':_0x3c82d3[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x3e5026,null))[_0xf667('0x29')](function(_0x3264ff){if(_0x3264ff){_0x166946=_0x3264ff['get']({'plain':!![]});_0x364b60['model']=_[_0xf667('0x37')](db[_0xf667('0x56')][_0xf667('0x4b')]);_0x364b60[_0xf667('0x36')]=_[_0xf667('0x37')](_0x3c82d3['query']);_0x364b60[_0xf667('0x3f')]=_['intersection'](_0x364b60[_0xf667('0x3a')],_0x364b60[_0xf667('0x36')]);_0x48cdc8[_0xf667('0x38')]=_[_0xf667('0x39')](_0x364b60[_0xf667('0x3a')],qs[_0xf667('0x3b')](_0x3c82d3[_0xf667('0x36')][_0xf667('0x3b')]));_0x48cdc8[_0xf667('0x38')]=_0x48cdc8['attributes'][_0xf667('0x4c')]?_0x48cdc8[_0xf667('0x38')]:_0x364b60['model'];if(!_0x3c82d3[_0xf667('0x36')][_0xf667('0x57')](_0xf667('0x3c'))){_0x48cdc8['limit']=qs[_0xf667('0x23')](_0x3c82d3[_0xf667('0x36')][_0xf667('0x23')]);_0x48cdc8['offset']=qs[_0xf667('0x24')](_0x3c82d3['query'][_0xf667('0x24')]);}_0x48cdc8[_0xf667('0x58')]=qs[_0xf667('0x3d')](_0x3c82d3[_0xf667('0x36')][_0xf667('0x3d')]);_0x48cdc8['where']=qs[_0xf667('0x3f')](_['pick'](_0x3c82d3['query'],_0x364b60[_0xf667('0x3f')]));_0x48cdc8[_0xf667('0x3e')][_0xf667('0x59')]=_0x3264ff['id'];if(_0x3c82d3['query'][_0xf667('0x41')]){_0x48cdc8['where']=_['merge'](_0x48cdc8[_0xf667('0x3e')],{'$or':_[_0xf667('0x31')](_0x48cdc8[_0xf667('0x38')],function(_0x5394d7){var _0x4c62f1={};_0x4c62f1[_0x5394d7]={'$like':'%'+_0x3c82d3[_0xf667('0x36')][_0xf667('0x41')]+'%'};return _0x4c62f1;})});}_0x48cdc8=_[_0xf667('0x43')]({},_0x48cdc8,_0x3c82d3[_0xf667('0x44')]);return db[_0xf667('0x56')]['findAll'](_0x48cdc8);}})[_0xf667('0x29')](function(_0x47c876){if(_0x47c876){return db['User'][_0xf667('0x5a')]({'where':{'id':_['map'](_0x47c876,_0xf667('0x5b')),'role':_0xf667('0x5c')},'attributes':['id',_0xf667('0x2f'),_0xf667('0x5d'),_0xf667('0x5e'),'createdAt']});}})[_0xf667('0x29')](function(_0x20bdcb){if(_0x20bdcb){return{'count':_0x20bdcb[_0xf667('0x25')],'rows':_[_0xf667('0x31')](_0x20bdcb[_0xf667('0x48')],function(_0x1b327f){return{'membername':_0x1b327f['name'],'UserId':_0x1b327f['id'],'queue_name':_0x166946[_0xf667('0x2f')],'OpenchannelQueueId':_0x166946['id'],'interface':util[_0xf667('0x5f')](_0xf667('0x60'),_0xf667('0x61'),_0x1b327f['name']),'penalty':0x0,'paused':_0x1b327f['openchannelPause'],'createdAt':_0x1b327f['createdAt'],'updatedAt':_0x1b327f[_0xf667('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3e5026,_0x48cdc8))['catch'](handleError(_0x3e5026,null));};exports[_0xf667('0x62')]=function(_0x8f97c9,_0x153182,_0xb35d79){var _0x27ed0d={};var _0x8f0143={};var _0x27802a;var _0x4e14e4;return db[_0xf667('0x32')][_0xf667('0x63')]({'where':{'id':_0x8f97c9[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x153182,null))[_0xf667('0x29')](function(_0x28d6da){if(_0x28d6da){_0x27802a=_0x28d6da;_0x8f0143[_0xf667('0x3a')]=_[_0xf667('0x37')](db[_0xf667('0x64')][_0xf667('0x4b')]);_0x8f0143[_0xf667('0x36')]=_['keys'](_0x8f97c9[_0xf667('0x36')]);_0x8f0143[_0xf667('0x3f')]=_['intersection'](_0x8f0143[_0xf667('0x3a')],_0x8f0143[_0xf667('0x36')]);_0x27ed0d[_0xf667('0x38')]=_[_0xf667('0x39')](_0x8f0143[_0xf667('0x3a')],qs['fields'](_0x8f97c9[_0xf667('0x36')]['fields']));_0x27ed0d[_0xf667('0x38')]=_0x27ed0d[_0xf667('0x38')]['length']?_0x27ed0d[_0xf667('0x38')]:_0x8f0143[_0xf667('0x3a')];_0x27ed0d[_0xf667('0x58')]=qs[_0xf667('0x3d')](_0x8f97c9[_0xf667('0x36')]['sort']);_0x27ed0d[_0xf667('0x3e')]=qs[_0xf667('0x3f')](_[_0xf667('0x40')](_0x8f97c9[_0xf667('0x36')],_0x8f0143[_0xf667('0x3f')]));if(_0x8f97c9[_0xf667('0x36')]['filter']){_0x27ed0d[_0xf667('0x3e')]=_[_0xf667('0x43')](_0x27ed0d[_0xf667('0x3e')],{'$or':_[_0xf667('0x31')](_0x27ed0d['attributes'],function(_0x465e5a){var _0x51867a={};_0x51867a[_0x465e5a]={'$like':'%'+_0x8f97c9[_0xf667('0x36')][_0xf667('0x41')]+'%'};return _0x51867a;})});}_0x27ed0d=_[_0xf667('0x43')]({},_0x27ed0d,_0x8f97c9[_0xf667('0x44')]);return _0x27802a[_0xf667('0x62')](_0x27ed0d);}})[_0xf667('0x29')](function(_0x202865){if(_0x202865){_0x4e14e4=_0x202865[_0xf667('0x4c')];if(!_0x8f97c9['query'][_0xf667('0x57')](_0xf667('0x3c'))){_0x27ed0d[_0xf667('0x23')]=qs['limit'](_0x8f97c9['query'][_0xf667('0x23')]);_0x27ed0d['offset']=qs['offset'](_0x8f97c9['query'][_0xf667('0x24')]);}return _0x27802a[_0xf667('0x62')](_0x27ed0d);}})['then'](function(_0x4a53e8){if(_0x4a53e8){return _0x4a53e8?{'count':_0x4e14e4,'rows':_0x4a53e8}:null;}})[_0xf667('0x29')](respondWithResult(_0x153182,null))[_0xf667('0x49')](handleError(_0x153182,null));};exports[_0xf667('0x65')]=function(_0x10801f,_0x52bb1c,_0x134eac){var _0x1bb7e3=_0x10801f[_0xf667('0x4f')]['ids'];return db['Team'][_0xf667('0x47')]({'where':{'id':_0x1bb7e3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf667('0x2f'),_0xf667('0x66'),_0xf667('0x67'),_0xf667('0x68')],'raw':!![]}]})[_0xf667('0x29')](function(_0x54d85a){if(_0x54d85a){var _0x4e19cc=_[_0xf667('0x69')](_0x54d85a,function(_0x2aa76c){var _0x4a9355=_0x2aa76c[_0xf667('0x2b')]({'plain':!![]});return _0x4a9355[_0xf667('0x6a')];});return db['OpenchannelQueue'][_0xf667('0x4d')]({'where':{'id':_0x10801f['params']['id']}})[_0xf667('0x29')](function(_0x3aaaff){return db['sequelize']['transaction'](function(_0x407a69){return _0x3aaaff[_0xf667('0x65')](_0x1bb7e3,{'transaction':_0x407a69})[_0xf667('0x29')](function(){return BPromise[_0xf667('0x6b')](_0x4e19cc,function(_0x40b318){return db[_0xf667('0x56')][_0xf667('0x6c')]({'where':{'UserId':_0x40b318['id'],'OpenchannelQueueId':_0x10801f[_0xf667('0x4a')]['id']},'transaction':_0x407a69});});})['then'](function(){_0x4e19cc[_0xf667('0x6d')](function(_0x1465ff){socket[_0xf667('0x6e')](_0xf667('0x6f'),{'UserId':_0x1465ff['id'],'OpenchannelQueueId':_0x3aaaff['id']});});});});});}})[_0xf667('0x29')](respondWithStatusCode(_0x52bb1c,null))[_0xf667('0x49')](handleError(_0x52bb1c,null));};exports[_0xf667('0x70')]=function(_0x496185,_0x296cc1,_0x5abf42){return db['Team'][_0xf667('0x47')]({'where':{'id':_0x496185[_0xf667('0x36')][_0xf667('0x71')]},'attributes':['id'],'include':[{'model':db[_0xf667('0x72')],'as':_0xf667('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x296cc1,null))['then'](function(_0x27c0a8){var _0x8e0e2e=_[_0xf667('0x31')](_0x27c0a8,'id');var _0x50ffda=[];var _0x12c0e2=[];var _0x506ed4=squel[_0xf667('0x73')]();_0x506ed4[_0xf667('0x74')](_0xf667('0x75'))[_0xf667('0x76')](_0xf667('0x77'),'tq')[_0xf667('0x78')](_0xf667('0x79'),'ut',_0xf667('0x7a'))[_0xf667('0x3e')](_0xf667('0x7b'),_0x496185[_0xf667('0x4a')]['id']);for(var _0x480c8f=0x0;_0x480c8f<_0x27c0a8[_0xf667('0x4c')];_0x480c8f+=0x1){let _0x366f89=_0x27c0a8[_0x480c8f];for(var _0x20027f=0x0;_0x20027f<_0x366f89['Agents'][_0xf667('0x4c')];_0x20027f+=0x1){let _0x45396f=_0x366f89['Agents'][_0x20027f];var _0x1e509f=_0x506ed4[_0xf667('0x7c')]();_0x1e509f[_0xf667('0x3e')]('ut.UserId\x20=\x20?',_0x45396f['id']);_0x12c0e2[_0xf667('0x7d')](db[_0xf667('0x7e')][_0xf667('0x36')](_0x1e509f[_0xf667('0x7f')](),{'type':db[_0xf667('0x7e')]['QueryTypes']['SELECT']})[_0xf667('0x29')](function(_0xffe7a){if(_0xffe7a[_0xf667('0x4c')]===0x1){return _0x45396f['id'];}else{var _0x5274ea=_[_0xf667('0x80')](_[_0xf667('0x31')](_0xffe7a,_0xf667('0x81')),function(_0x1c542f){return _[_0xf667('0x82')](_0x8e0e2e,_0x1c542f);});if(_0x5274ea){return _0x45396f['id'];}}}));}}return BPromise[_0xf667('0x83')](_0x12c0e2)[_0xf667('0x29')](function(_0xd371cb){_0x50ffda=_(_0x50ffda)[_0xf667('0x84')](_0xd371cb)[_0xf667('0x85')]()[_0xf667('0x86')]();return db[_0xf667('0x32')][_0xf667('0x4d')]({'where':{'id':_0x496185[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](function(_0xa62826){return db[_0xf667('0x7e')][_0xf667('0x87')](function(_0x4786f0){return _0xa62826[_0xf667('0x70')](_0x496185['query'][_0xf667('0x71')],{'transaction':_0x4786f0})[_0xf667('0x29')](function(){if(!_[_0xf667('0x88')](_0x50ffda)){return _0xa62826[_0xf667('0x89')](_0x50ffda,{'transaction':_0x4786f0});}})[_0xf667('0x29')](function(){_0x50ffda[_0xf667('0x6d')](function(_0x1e7f52){socket[_0xf667('0x6e')](_0xf667('0x8a'),{'UserId':_0x1e7f52,'OpenchannelQueueId':_0xa62826['id']});});});});});});})[_0xf667('0x29')](respondWithStatusCode(_0x296cc1,null))[_0xf667('0x49')](handleError(_0x296cc1,null));};exports[_0xf667('0x8b')]=function(_0x6434b1,_0x5874e7,_0x598a0e){return db[_0xf667('0x32')]['find']({'where':{'id':_0x6434b1[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x5874e7,null))[_0xf667('0x29')](function(_0xae0c0d){if(_0xae0c0d){return _0xae0c0d[_0xf667('0x8b')](_0x6434b1[_0xf667('0x4f')][_0xf667('0x71')],_[_0xf667('0x8c')](_0x6434b1[_0xf667('0x4f')],['ids','id'])||{})[_0xf667('0x8d')](function(_0x166ceb){for(var _0x478c2b=0x0;_0x478c2b<_0x6434b1[_0xf667('0x4f')]['ids']['length'];_0x478c2b+=0x1){socket['emit'](_0xf667('0x6f'),{'UserId':Number(_0x6434b1[_0xf667('0x4f')][_0xf667('0x71')][_0x478c2b]),'OpenchannelQueueId':Number(_0x6434b1[_0xf667('0x4a')]['id'])});}return _0x166ceb;});}})[_0xf667('0x29')](respondWithResult(_0x5874e7,null))['catch'](handleError(_0x5874e7,null));};exports[_0xf667('0x89')]=function(_0xb3a53,_0x50d1f3,_0x2c9b9b){return db[_0xf667('0x32')][_0xf667('0x4d')]({'where':{'id':_0xb3a53['params']['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x50d1f3,null))[_0xf667('0x29')](function(_0x14b960){if(_0x14b960){return _0x14b960['removeAgents'](_0xb3a53['query'][_0xf667('0x71')])[_0xf667('0x29')](function(){if(_[_0xf667('0x8e')](_0xb3a53[_0xf667('0x36')]['ids'])){for(var _0x5e50bf=0x0;_0x5e50bf<_0xb3a53['query'][_0xf667('0x71')][_0xf667('0x4c')];_0x5e50bf+=0x1){socket[_0xf667('0x6e')](_0xf667('0x8a'),{'UserId':Number(_0xb3a53[_0xf667('0x36')]['ids'][_0x5e50bf]),'OpenchannelQueueId':Number(_0xb3a53[_0xf667('0x4a')]['id'])});}}else{socket[_0xf667('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0xb3a53[_0xf667('0x36')][_0xf667('0x71')]),'OpenchannelQueueId':Number(_0xb3a53['params']['id'])});}});}})['then'](respondWithStatusCode(_0x50d1f3,null))[_0xf667('0x49')](handleError(_0x50d1f3,null));};exports[_0xf667('0x8f')]=function(_0x3294f8,_0x1584bc,_0x307a1a){var _0x312427={};var _0x6227ed={};var _0x583b7e;var _0x2bf0c8;return db[_0xf667('0x32')][_0xf667('0x63')]({'where':{'id':_0x3294f8[_0xf667('0x4a')]['id']}})[_0xf667('0x29')](handleEntityNotFound(_0x1584bc,null))['then'](function(_0x3667d9){if(_0x3667d9){_0x583b7e=_0x3667d9;_0x6227ed['model']=_[_0xf667('0x37')](db[_0xf667('0x72')][_0xf667('0x4b')]);_0x6227ed[_0xf667('0x36')]=_[_0xf667('0x37')](_0x3294f8[_0xf667('0x36')]);_0x6227ed[_0xf667('0x3f')]=_['intersection'](_0x6227ed[_0xf667('0x3a')],_0x6227ed[_0xf667('0x36')]);_0x312427[_0xf667('0x38')]=_[_0xf667('0x39')](_0x6227ed['model'],qs[_0xf667('0x3b')](_0x3294f8['query']['fields']));_0x312427[_0xf667('0x38')]=_0x312427['attributes']['length']?_0x312427['attributes']:_0x6227ed['model'];_0x312427[_0xf667('0x58')]=qs[_0xf667('0x3d')](_0x3294f8['query'][_0xf667('0x3d')]);_0x312427[_0xf667('0x3e')]=qs['filters'](_[_0xf667('0x40')](_0x3294f8[_0xf667('0x36')],_0x6227ed['filters']));if(_0x3294f8['query'][_0xf667('0x41')]){_0x312427[_0xf667('0x3e')]=_[_0xf667('0x43')](_0x312427[_0xf667('0x3e')],{'$or':_[_0xf667('0x31')](_0x312427['attributes'],function(_0x465501){var _0x9b98bd={};_0x9b98bd[_0x465501]={'$like':'%'+_0x3294f8['query'][_0xf667('0x41')]+'%'};return _0x9b98bd;})});}_0x312427=_[_0xf667('0x43')]({},_0x312427,_0x3294f8['options']);return _0x583b7e[_0xf667('0x8f')](_0x312427);}})[_0xf667('0x29')](function(_0x2a7d1c){if(_0x2a7d1c){_0x2bf0c8=_0x2a7d1c[_0xf667('0x4c')];if(!_0x3294f8[_0xf667('0x36')][_0xf667('0x57')](_0xf667('0x3c'))){_0x312427[_0xf667('0x23')]=qs[_0xf667('0x23')](_0x3294f8[_0xf667('0x36')]['limit']);_0x312427[_0xf667('0x24')]=qs['offset'](_0x3294f8[_0xf667('0x36')][_0xf667('0x24')]);}return _0x583b7e[_0xf667('0x8f')](_0x312427);}})[_0xf667('0x29')](function(_0x556757){if(_0x556757){return _0x556757?{'count':_0x2bf0c8,'rows':_0x556757}:null;}})[_0xf667('0x29')](respondWithResult(_0x1584bc,null))[_0xf667('0x49')](handleError(_0x1584bc,null));}; \ No newline at end of file +var _0xf765=['flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','value','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','findAndCountAll','openchannelPause','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','User','Agents','online','voicePause','interface'];(function(_0x41d0ea,_0x1ad8b0){var _0x3c839f=function(_0x4fea6b){while(--_0x4fea6b){_0x41d0ea['push'](_0x41d0ea['shift']());}};_0x3c839f(++_0x1ad8b0);}(_0xf765,0x1d4));var _0x5f76=function(_0xb0f50e,_0x140af1){_0xb0f50e=_0xb0f50e-0x0;var _0xbafc57=_0xf765[_0xb0f50e];return _0xbafc57;};'use strict';var emlformat=require(_0x5f76('0x0'));var rimraf=require(_0x5f76('0x1'));var zipdir=require(_0x5f76('0x2'));var jsonpatch=require(_0x5f76('0x3'));var rp=require(_0x5f76('0x4'));var moment=require('moment');var BPromise=require(_0x5f76('0x5'));var Mustache=require(_0x5f76('0x6'));var util=require(_0x5f76('0x7'));var path=require(_0x5f76('0x8'));var sox=require(_0x5f76('0x9'));var csv=require('to-csv');var ejs=require(_0x5f76('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f76('0xb'));var squel=require(_0x5f76('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f76('0xd'));var deskjs=require(_0x5f76('0xe'));var toCsv=require(_0x5f76('0xf'));var querystring=require(_0x5f76('0x10'));var Papa=require(_0x5f76('0x11'));var Redis=require(_0x5f76('0x12'));var authService=require(_0x5f76('0x13'));var qs=require(_0x5f76('0x14'));var as=require(_0x5f76('0x15'));var hardwareService=require(_0x5f76('0x16'));var logger=require('../../config/logger')(_0x5f76('0x17'));var utils=require(_0x5f76('0x18'));var config=require(_0x5f76('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5f76('0x1a')]=_[_0x5f76('0x1b')](config['redis'],{'host':_0x5f76('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x5f76('0x1d')](socket);function respondWithStatusCode(_0x2d9798,_0x5c9949){_0x5c9949=_0x5c9949||0xcc;return function(_0x4cba7d){if(_0x4cba7d){return _0x2d9798[_0x5f76('0x1e')](_0x5c9949);}return _0x2d9798[_0x5f76('0x1f')](_0x5c9949)[_0x5f76('0x20')]();};}function respondWithResult(_0x5f30a8,_0x78b088){_0x78b088=_0x78b088||0xc8;return function(_0x5db916){if(_0x5db916){return _0x5f30a8['status'](_0x78b088)['json'](_0x5db916);}};}function respondWithFilteredResult(_0x2edb06,_0x366bee){return function(_0x4b3fc9){if(_0x4b3fc9){var _0x2da85f=typeof _0x366bee[_0x5f76('0x21')]===_0x5f76('0x22')&&typeof _0x366bee[_0x5f76('0x23')]===_0x5f76('0x22');var _0x214126=_0x4b3fc9[_0x5f76('0x24')];var _0xe7a8a9=_0x2da85f?0x0:_0x366bee['offset'];var _0x3626d5=_0x2da85f?_0x4b3fc9['count']:_0x366bee[_0x5f76('0x21')]+_0x366bee['limit'];var _0x30ea1b;if(_0x3626d5>=_0x214126){_0x3626d5=_0x214126;_0x30ea1b=0xc8;}else{_0x30ea1b=0xce;}_0x2edb06[_0x5f76('0x1f')](_0x30ea1b);return _0x2edb06[_0x5f76('0x25')](_0x5f76('0x26'),_0xe7a8a9+'-'+_0x3626d5+'/'+_0x214126)[_0x5f76('0x27')](_0x4b3fc9);}return null;};}function patchUpdates(_0x4b3c60){return function(_0x1b84f5){try{jsonpatch[_0x5f76('0x28')](_0x1b84f5,_0x4b3c60,!![]);}catch(_0x214862){return BPromise[_0x5f76('0x29')](_0x214862);}return _0x1b84f5[_0x5f76('0x2a')]();};}function saveUpdates(_0x5d0fb2,_0x6f595){return function(_0xe19ee1){if(_0xe19ee1){return _0xe19ee1[_0x5f76('0x2b')](_0x5d0fb2)[_0x5f76('0x2c')](function(_0x2f97fb){return _0x2f97fb;});}return null;};}function removeEntity(_0x128d8c,_0x228edd){return function(_0x4e1014){if(_0x4e1014){return _0x4e1014['destroy']()['then'](function(){var _0x500b12=_0x4e1014[_0x5f76('0x2d')]({'plain':!![]});var _0x16844e=_0x5f76('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x16844e,'resourceId':_0x500b12['id']}})['then'](function(){return _0x4e1014;});})[_0x5f76('0x2c')](function(){_0x128d8c[_0x5f76('0x1f')](0xcc)[_0x5f76('0x20')]();});}};}function handleEntityNotFound(_0x2f4fb9,_0x7d96b5){return function(_0x577742){if(!_0x577742){_0x2f4fb9[_0x5f76('0x1e')](0x194);}return _0x577742;};}function handleError(_0x29471d,_0x40904a){_0x40904a=_0x40904a||0x1f4;return function(_0x429e24){logger[_0x5f76('0x2f')](_0x429e24[_0x5f76('0x30')]);if(_0x429e24[_0x5f76('0x31')]){delete _0x429e24[_0x5f76('0x31')];}_0x29471d['status'](_0x40904a)[_0x5f76('0x32')](_0x429e24);};}exports[_0x5f76('0x33')]=function(_0x1b6ddc,_0x55bead){var _0x489bb8={},_0x38f861={},_0x3a3aab={'count':0x0,'rows':[]};var _0x2617d1=_[_0x5f76('0x34')](db[_0x5f76('0x35')][_0x5f76('0x36')],function(_0x1b15dc){return{'name':_0x1b15dc[_0x5f76('0x37')],'type':_0x1b15dc[_0x5f76('0x38')][_0x5f76('0x39')]};});_0x38f861[_0x5f76('0x3a')]=_[_0x5f76('0x34')](_0x2617d1,_0x5f76('0x31'));_0x38f861['query']=_[_0x5f76('0x3b')](_0x1b6ddc[_0x5f76('0x3c')]);_0x38f861['filters']=_['intersection'](_0x38f861['model'],_0x38f861[_0x5f76('0x3c')]);_0x489bb8[_0x5f76('0x3d')]=_[_0x5f76('0x3e')](_0x38f861['model'],qs['fields'](_0x1b6ddc[_0x5f76('0x3c')][_0x5f76('0x3f')]));_0x489bb8[_0x5f76('0x3d')]=_0x489bb8[_0x5f76('0x3d')][_0x5f76('0x40')]?_0x489bb8[_0x5f76('0x3d')]:_0x38f861['model'];if(!_0x1b6ddc[_0x5f76('0x3c')][_0x5f76('0x41')](_0x5f76('0x42'))){_0x489bb8[_0x5f76('0x23')]=qs[_0x5f76('0x23')](_0x1b6ddc[_0x5f76('0x3c')]['limit']);_0x489bb8['offset']=qs[_0x5f76('0x21')](_0x1b6ddc[_0x5f76('0x3c')]['offset']);}_0x489bb8[_0x5f76('0x43')]=qs[_0x5f76('0x44')](_0x1b6ddc[_0x5f76('0x3c')][_0x5f76('0x44')]);_0x489bb8[_0x5f76('0x45')]=qs[_0x5f76('0x46')](_['pick'](_0x1b6ddc['query'],_0x38f861[_0x5f76('0x46')]),_0x2617d1);if(_0x1b6ddc['query']['filter']){_0x489bb8[_0x5f76('0x45')]=_[_0x5f76('0x47')](_0x489bb8[_0x5f76('0x45')],{'$or':_[_0x5f76('0x34')](_0x2617d1,function(_0x4d0455){if(_0x4d0455['type']!==_0x5f76('0x48')){var _0x103612={};_0x103612[_0x4d0455['name']]={'$like':'%'+_0x1b6ddc[_0x5f76('0x3c')][_0x5f76('0x49')]+'%'};return _0x103612;}})});}_0x489bb8=_[_0x5f76('0x47')]({},_0x489bb8,_0x1b6ddc[_0x5f76('0x4a')]);var _0x181691={'where':_0x489bb8[_0x5f76('0x45')]};return db['OpenchannelQueue'][_0x5f76('0x24')](_0x181691)[_0x5f76('0x2c')](function(_0x95e5e3){_0x3a3aab['count']=_0x95e5e3;if(_0x1b6ddc[_0x5f76('0x3c')][_0x5f76('0x4b')]){_0x489bb8[_0x5f76('0x4c')]=[{'all':!![]}];}return db[_0x5f76('0x35')][_0x5f76('0x4d')](_0x489bb8);})[_0x5f76('0x2c')](function(_0x3decd8){_0x3a3aab['rows']=_0x3decd8;return _0x3a3aab;})['then'](respondWithFilteredResult(_0x55bead,_0x489bb8))[_0x5f76('0x4e')](handleError(_0x55bead,null));};exports['show']=function(_0xc0c7af,_0x433399){var _0x5553e2={'raw':!![],'where':{'id':_0xc0c7af['params']['id']}},_0x45f36b={};_0x45f36b[_0x5f76('0x3a')]=_[_0x5f76('0x3b')](db['OpenchannelQueue'][_0x5f76('0x36')]);_0x45f36b[_0x5f76('0x3c')]=_[_0x5f76('0x3b')](_0xc0c7af[_0x5f76('0x3c')]);_0x45f36b[_0x5f76('0x46')]=_[_0x5f76('0x3e')](_0x45f36b[_0x5f76('0x3a')],_0x45f36b[_0x5f76('0x3c')]);_0x5553e2[_0x5f76('0x3d')]=_[_0x5f76('0x3e')](_0x45f36b[_0x5f76('0x3a')],qs['fields'](_0xc0c7af['query'][_0x5f76('0x3f')]));_0x5553e2[_0x5f76('0x3d')]=_0x5553e2[_0x5f76('0x3d')][_0x5f76('0x40')]?_0x5553e2[_0x5f76('0x3d')]:_0x45f36b['model'];if(_0xc0c7af[_0x5f76('0x3c')][_0x5f76('0x4b')]){_0x5553e2['include']=[{'all':!![]}];}_0x5553e2=_[_0x5f76('0x47')]({},_0x5553e2,_0xc0c7af['options']);return db[_0x5f76('0x35')][_0x5f76('0x4f')](_0x5553e2)[_0x5f76('0x2c')](handleEntityNotFound(_0x433399,null))[_0x5f76('0x2c')](respondWithResult(_0x433399,null))[_0x5f76('0x4e')](handleError(_0x433399,null));};exports['create']=function(_0x218f8d,_0x52eee0){return db[_0x5f76('0x35')]['create'](_0x218f8d[_0x5f76('0x50')],{})[_0x5f76('0x2c')](function(_0x680071){var _0x4c00a8=_0x218f8d[_0x5f76('0x51')]['get']({'plain':!![]});if(!_0x4c00a8)throw new Error(_0x5f76('0x52'));if(_0x4c00a8[_0x5f76('0x53')]===_0x5f76('0x51')){var _0x3586cc=_0x680071['get']({'plain':!![]});var _0x457445=_0x5f76('0x2e');return db[_0x5f76('0x54')]['find']({'where':{'name':_0x457445,'userProfileId':_0x4c00a8[_0x5f76('0x55')]},'raw':!![]})[_0x5f76('0x2c')](function(_0x16e058){if(_0x16e058&&_0x16e058[_0x5f76('0x56')]===0x0){return db[_0x5f76('0x57')][_0x5f76('0x58')]({'name':_0x3586cc[_0x5f76('0x31')],'resourceId':_0x3586cc['id'],'type':_0x16e058[_0x5f76('0x31')],'sectionId':_0x16e058['id']},{})[_0x5f76('0x2c')](function(){return _0x680071;});}else{return _0x680071;}})['catch'](function(_0x258e6e){logger[_0x5f76('0x2f')](_0x5f76('0x59'),_0x258e6e);throw _0x258e6e;});}return _0x680071;})[_0x5f76('0x2c')](respondWithResult(_0x52eee0,0xc9))[_0x5f76('0x4e')](handleError(_0x52eee0,null));};exports[_0x5f76('0x2b')]=function(_0x1557d6,_0x36f7cb){if(_0x1557d6[_0x5f76('0x50')]['id']){delete _0x1557d6[_0x5f76('0x50')]['id'];}return db['OpenchannelQueue'][_0x5f76('0x4f')]({'where':{'id':_0x1557d6['params']['id']}})['then'](handleEntityNotFound(_0x36f7cb,null))['then'](saveUpdates(_0x1557d6[_0x5f76('0x50')],null))['then'](respondWithResult(_0x36f7cb,null))[_0x5f76('0x4e')](handleError(_0x36f7cb,null));};exports[_0x5f76('0x5a')]=function(_0x3c07b1,_0x135754){return db['OpenchannelQueue'][_0x5f76('0x4f')]({'where':{'id':_0x3c07b1[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0x135754,null))[_0x5f76('0x2c')](removeEntity(_0x135754,null))[_0x5f76('0x4e')](handleError(_0x135754,null));};exports[_0x5f76('0x5c')]=function(_0x171705,_0x1be1fb){return db['OpenchannelQueue']['describe']()[_0x5f76('0x2c')](respondWithResult(_0x1be1fb,null))[_0x5f76('0x4e')](handleError(_0x1be1fb,null));};exports[_0x5f76('0x5d')]=function(_0x21f05d,_0x4e1600,_0x1fcc55){var _0x45a912={'raw':!![],'where':{}},_0x3b1b82={},_0x1a5f2b;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x21f05d[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0x4e1600,null))[_0x5f76('0x2c')](function(_0x496268){if(_0x496268){_0x1a5f2b=_0x496268[_0x5f76('0x2d')]({'plain':!![]});_0x3b1b82[_0x5f76('0x3a')]=_[_0x5f76('0x3b')](db[_0x5f76('0x5e')][_0x5f76('0x36')]);_0x3b1b82[_0x5f76('0x3c')]=_[_0x5f76('0x3b')](_0x21f05d[_0x5f76('0x3c')]);_0x3b1b82['filters']=_[_0x5f76('0x3e')](_0x3b1b82[_0x5f76('0x3a')],_0x3b1b82[_0x5f76('0x3c')]);_0x45a912[_0x5f76('0x3d')]=_[_0x5f76('0x3e')](_0x3b1b82['model'],qs[_0x5f76('0x3f')](_0x21f05d[_0x5f76('0x3c')][_0x5f76('0x3f')]));_0x45a912[_0x5f76('0x3d')]=_0x45a912[_0x5f76('0x3d')][_0x5f76('0x40')]?_0x45a912['attributes']:_0x3b1b82['model'];if(!_0x21f05d['query'][_0x5f76('0x41')](_0x5f76('0x42'))){_0x45a912[_0x5f76('0x23')]=qs['limit'](_0x21f05d[_0x5f76('0x3c')][_0x5f76('0x23')]);_0x45a912[_0x5f76('0x21')]=qs[_0x5f76('0x21')](_0x21f05d[_0x5f76('0x3c')]['offset']);}_0x45a912[_0x5f76('0x43')]=qs['sort'](_0x21f05d['query']['sort']);_0x45a912['where']=qs[_0x5f76('0x46')](_[_0x5f76('0x5f')](_0x21f05d[_0x5f76('0x3c')],_0x3b1b82[_0x5f76('0x46')]));_0x45a912['where'][_0x5f76('0x60')]=_0x496268['id'];if(_0x21f05d[_0x5f76('0x3c')]['filter']){_0x45a912[_0x5f76('0x45')]=_[_0x5f76('0x47')](_0x45a912[_0x5f76('0x45')],{'$or':_['map'](_0x45a912[_0x5f76('0x3d')],function(_0x4fa10c){var _0x27459d={};_0x27459d[_0x4fa10c]={'$like':'%'+_0x21f05d[_0x5f76('0x3c')]['filter']+'%'};return _0x27459d;})});}_0x45a912=_['merge']({},_0x45a912,_0x21f05d['options']);return db[_0x5f76('0x5e')][_0x5f76('0x4d')](_0x45a912);}})[_0x5f76('0x2c')](function(_0x107f9b){if(_0x107f9b){return db['User'][_0x5f76('0x61')]({'where':{'id':_[_0x5f76('0x34')](_0x107f9b,'UserId'),'role':'agent'},'attributes':['id',_0x5f76('0x31'),_0x5f76('0x62'),'updatedAt',_0x5f76('0x63')]});}})[_0x5f76('0x2c')](function(_0x2d957c){if(_0x2d957c){return{'count':_0x2d957c['count'],'rows':_['map'](_0x2d957c[_0x5f76('0x64')],function(_0x4cd3fd){return{'membername':_0x4cd3fd[_0x5f76('0x31')],'UserId':_0x4cd3fd['id'],'queue_name':_0x1a5f2b[_0x5f76('0x31')],'OpenchannelQueueId':_0x1a5f2b['id'],'interface':util[_0x5f76('0x65')](_0x5f76('0x66'),_0x5f76('0x67'),_0x4cd3fd[_0x5f76('0x31')]),'penalty':0x0,'paused':_0x4cd3fd[_0x5f76('0x62')],'createdAt':_0x4cd3fd[_0x5f76('0x63')],'updatedAt':_0x4cd3fd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f76('0x2c')](respondWithFilteredResult(_0x4e1600,_0x45a912))[_0x5f76('0x4e')](handleError(_0x4e1600,null));};exports[_0x5f76('0x68')]=function(_0x43d346,_0x5f1ba5,_0x17f09c){var _0x50ef6c={};var _0x1699d7={};var _0x45e0f9;var _0x49274c;return db[_0x5f76('0x35')]['findOne']({'where':{'id':_0x43d346[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0x5f1ba5,null))['then'](function(_0x4dcf83){if(_0x4dcf83){_0x45e0f9=_0x4dcf83;_0x1699d7[_0x5f76('0x3a')]=_[_0x5f76('0x3b')](db[_0x5f76('0x69')]['rawAttributes']);_0x1699d7[_0x5f76('0x3c')]=_['keys'](_0x43d346[_0x5f76('0x3c')]);_0x1699d7[_0x5f76('0x46')]=_[_0x5f76('0x3e')](_0x1699d7['model'],_0x1699d7[_0x5f76('0x3c')]);_0x50ef6c['attributes']=_[_0x5f76('0x3e')](_0x1699d7['model'],qs[_0x5f76('0x3f')](_0x43d346[_0x5f76('0x3c')]['fields']));_0x50ef6c[_0x5f76('0x3d')]=_0x50ef6c[_0x5f76('0x3d')][_0x5f76('0x40')]?_0x50ef6c[_0x5f76('0x3d')]:_0x1699d7[_0x5f76('0x3a')];_0x50ef6c['order']=qs['sort'](_0x43d346[_0x5f76('0x3c')][_0x5f76('0x44')]);_0x50ef6c['where']=qs[_0x5f76('0x46')](_[_0x5f76('0x5f')](_0x43d346[_0x5f76('0x3c')],_0x1699d7['filters']));if(_0x43d346[_0x5f76('0x3c')][_0x5f76('0x49')]){_0x50ef6c[_0x5f76('0x45')]=_[_0x5f76('0x47')](_0x50ef6c[_0x5f76('0x45')],{'$or':_[_0x5f76('0x34')](_0x50ef6c[_0x5f76('0x3d')],function(_0x19782b){var _0x7c2d05={};_0x7c2d05[_0x19782b]={'$like':'%'+_0x43d346[_0x5f76('0x3c')]['filter']+'%'};return _0x7c2d05;})});}_0x50ef6c=_['merge']({},_0x50ef6c,_0x43d346[_0x5f76('0x4a')]);return _0x45e0f9[_0x5f76('0x68')](_0x50ef6c);}})['then'](function(_0x391952){if(_0x391952){_0x49274c=_0x391952['length'];if(!_0x43d346[_0x5f76('0x3c')][_0x5f76('0x41')](_0x5f76('0x42'))){_0x50ef6c['limit']=qs[_0x5f76('0x23')](_0x43d346['query'][_0x5f76('0x23')]);_0x50ef6c['offset']=qs['offset'](_0x43d346[_0x5f76('0x3c')]['offset']);}return _0x45e0f9[_0x5f76('0x68')](_0x50ef6c);}})[_0x5f76('0x2c')](function(_0x362395){if(_0x362395){return _0x362395?{'count':_0x49274c,'rows':_0x362395}:null;}})[_0x5f76('0x2c')](respondWithResult(_0x5f1ba5,null))['catch'](handleError(_0x5f1ba5,null));};exports['addTeams']=function(_0x29ac9e,_0xf75481,_0xd57dce){var _0x4bc1cd=_0x29ac9e[_0x5f76('0x50')][_0x5f76('0x6a')];return db['Team'][_0x5f76('0x4d')]({'where':{'id':_0x4bc1cd},'attributes':['id'],'include':[{'model':db[_0x5f76('0x6b')],'as':_0x5f76('0x6c'),'attributes':['id','name',_0x5f76('0x6d'),_0x5f76('0x6e'),_0x5f76('0x6f')],'raw':!![]}]})[_0x5f76('0x2c')](function(_0x8608f){if(_0x8608f){var _0x56939e=_[_0x5f76('0x70')](_0x8608f,function(_0x5a4656){var _0x54f468=_0x5a4656['get']({'plain':!![]});return _0x54f468[_0x5f76('0x6c')];});return db[_0x5f76('0x35')][_0x5f76('0x4f')]({'where':{'id':_0x29ac9e[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](function(_0x1cf8f6){return db[_0x5f76('0x71')]['transaction'](function(_0x1feefa){return _0x1cf8f6['addTeams'](_0x4bc1cd,{'transaction':_0x1feefa})[_0x5f76('0x2c')](function(){return BPromise[_0x5f76('0x72')](_0x56939e,function(_0x2dc5ff){return db[_0x5f76('0x5e')][_0x5f76('0x73')]({'where':{'UserId':_0x2dc5ff['id'],'OpenchannelQueueId':_0x29ac9e['params']['id']},'transaction':_0x1feefa});});})[_0x5f76('0x2c')](function(){_0x56939e[_0x5f76('0x74')](function(_0x3c3cf2){socket[_0x5f76('0x75')](_0x5f76('0x76'),{'UserId':_0x3c3cf2['id'],'OpenchannelQueueId':_0x1cf8f6['id']});});});});});}})[_0x5f76('0x2c')](respondWithStatusCode(_0xf75481,null))[_0x5f76('0x4e')](handleError(_0xf75481,null));};exports['removeTeams']=function(_0x6441a5,_0x168bd3,_0x1246ae){return db[_0x5f76('0x69')][_0x5f76('0x4d')]({'where':{'id':_0x6441a5[_0x5f76('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5f76('0x6b')],'as':_0x5f76('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x5f76('0x2c')](handleEntityNotFound(_0x168bd3,null))['then'](function(_0x23eccc){var _0x48c0b6=_['map'](_0x23eccc,'id');var _0x502bf2=[];var _0x28047e=[];var _0x2b66fb=squel[_0x5f76('0x77')]();_0x2b66fb['field']('tq.TeamId')[_0x5f76('0x78')](_0x5f76('0x79'),'tq')[_0x5f76('0x7a')](_0x5f76('0x7b'),'ut',_0x5f76('0x7c'))[_0x5f76('0x45')](_0x5f76('0x7d'),_0x6441a5[_0x5f76('0x5b')]['id']);for(var _0x1340e6=0x0;_0x1340e6<_0x23eccc[_0x5f76('0x40')];_0x1340e6+=0x1){let _0x34b4e7=_0x23eccc[_0x1340e6];for(var _0x456b20=0x0;_0x456b20<_0x34b4e7[_0x5f76('0x6c')][_0x5f76('0x40')];_0x456b20+=0x1){let _0x3270d8=_0x34b4e7[_0x5f76('0x6c')][_0x456b20];var _0x203ed5=_0x2b66fb[_0x5f76('0x7e')]();_0x203ed5[_0x5f76('0x45')](_0x5f76('0x7f'),_0x3270d8['id']);_0x28047e[_0x5f76('0x80')](db[_0x5f76('0x71')][_0x5f76('0x3c')](_0x203ed5[_0x5f76('0x81')](),{'type':db[_0x5f76('0x71')][_0x5f76('0x82')][_0x5f76('0x83')]})['then'](function(_0x286027){if(_0x286027['length']===0x1){return _0x3270d8['id'];}else{var _0x21260e=_[_0x5f76('0x84')](_[_0x5f76('0x34')](_0x286027,_0x5f76('0x85')),function(_0x32f874){return _['includes'](_0x48c0b6,_0x32f874);});if(_0x21260e){return _0x3270d8['id'];}}}));}}return BPromise['all'](_0x28047e)['then'](function(_0x57cb5d){_0x502bf2=_(_0x502bf2)['union'](_0x57cb5d)[_0x5f76('0x86')]()[_0x5f76('0x87')]();return db[_0x5f76('0x35')]['find']({'where':{'id':_0x6441a5[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](function(_0x238a21){return db[_0x5f76('0x71')]['transaction'](function(_0x4b1995){return _0x238a21[_0x5f76('0x88')](_0x6441a5[_0x5f76('0x3c')][_0x5f76('0x6a')],{'transaction':_0x4b1995})[_0x5f76('0x2c')](function(){if(!_[_0x5f76('0x89')](_0x502bf2)){return _0x238a21['removeAgents'](_0x502bf2,{'transaction':_0x4b1995});}})[_0x5f76('0x2c')](function(){_0x502bf2['forEach'](function(_0x3ab5ad){socket[_0x5f76('0x75')](_0x5f76('0x8a'),{'UserId':_0x3ab5ad,'OpenchannelQueueId':_0x238a21['id']});});});});});});})[_0x5f76('0x2c')](respondWithStatusCode(_0x168bd3,null))[_0x5f76('0x4e')](handleError(_0x168bd3,null));};exports[_0x5f76('0x8b')]=function(_0xf67096,_0x3694d6,_0x31fc70){return db[_0x5f76('0x35')][_0x5f76('0x4f')]({'where':{'id':_0xf67096['params']['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0x3694d6,null))['then'](function(_0x2b0b09){if(_0x2b0b09){return _0x2b0b09[_0x5f76('0x8b')](_0xf67096['body'][_0x5f76('0x6a')],_[_0x5f76('0x8c')](_0xf67096[_0x5f76('0x50')],['ids','id'])||{})[_0x5f76('0x8d')](function(_0x5aec16){for(var _0x320532=0x0;_0x320532<_0xf67096[_0x5f76('0x50')][_0x5f76('0x6a')][_0x5f76('0x40')];_0x320532+=0x1){socket[_0x5f76('0x75')](_0x5f76('0x76'),{'UserId':Number(_0xf67096[_0x5f76('0x50')][_0x5f76('0x6a')][_0x320532]),'OpenchannelQueueId':Number(_0xf67096['params']['id'])});}return _0x5aec16;});}})[_0x5f76('0x2c')](respondWithResult(_0x3694d6,null))[_0x5f76('0x4e')](handleError(_0x3694d6,null));};exports[_0x5f76('0x8e')]=function(_0x2b903c,_0xbd73a2,_0x55e7b3){return db[_0x5f76('0x35')]['find']({'where':{'id':_0x2b903c['params']['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0xbd73a2,null))[_0x5f76('0x2c')](function(_0xb5b227){if(_0xb5b227){return _0xb5b227[_0x5f76('0x8e')](_0x2b903c['query'][_0x5f76('0x6a')])[_0x5f76('0x2c')](function(){if(_['isArray'](_0x2b903c[_0x5f76('0x3c')]['ids'])){for(var _0x2f1cf5=0x0;_0x2f1cf5<_0x2b903c[_0x5f76('0x3c')][_0x5f76('0x6a')][_0x5f76('0x40')];_0x2f1cf5+=0x1){socket[_0x5f76('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2b903c[_0x5f76('0x3c')][_0x5f76('0x6a')][_0x2f1cf5]),'OpenchannelQueueId':Number(_0x2b903c[_0x5f76('0x5b')]['id'])});}}else{socket[_0x5f76('0x75')](_0x5f76('0x8a'),{'UserId':Number(_0x2b903c['query'][_0x5f76('0x6a')]),'OpenchannelQueueId':Number(_0x2b903c[_0x5f76('0x5b')]['id'])});}});}})[_0x5f76('0x2c')](respondWithStatusCode(_0xbd73a2,null))['catch'](handleError(_0xbd73a2,null));};exports[_0x5f76('0x8f')]=function(_0x51f0a0,_0x5c95ce,_0x106984){var _0x26dd0d={};var _0x339856={};var _0xa9e2d2;var _0x541422;return db[_0x5f76('0x35')][_0x5f76('0x90')]({'where':{'id':_0x51f0a0[_0x5f76('0x5b')]['id']}})[_0x5f76('0x2c')](handleEntityNotFound(_0x5c95ce,null))[_0x5f76('0x2c')](function(_0x59d28f){if(_0x59d28f){_0xa9e2d2=_0x59d28f;_0x339856[_0x5f76('0x3a')]=_['keys'](db[_0x5f76('0x6b')]['rawAttributes']);_0x339856[_0x5f76('0x3c')]=_[_0x5f76('0x3b')](_0x51f0a0[_0x5f76('0x3c')]);_0x339856[_0x5f76('0x46')]=_[_0x5f76('0x3e')](_0x339856[_0x5f76('0x3a')],_0x339856[_0x5f76('0x3c')]);_0x26dd0d[_0x5f76('0x3d')]=_['intersection'](_0x339856[_0x5f76('0x3a')],qs[_0x5f76('0x3f')](_0x51f0a0['query']['fields']));_0x26dd0d['attributes']=_0x26dd0d[_0x5f76('0x3d')][_0x5f76('0x40')]?_0x26dd0d['attributes']:_0x339856[_0x5f76('0x3a')];_0x26dd0d['order']=qs['sort'](_0x51f0a0['query'][_0x5f76('0x44')]);_0x26dd0d[_0x5f76('0x45')]=qs[_0x5f76('0x46')](_[_0x5f76('0x5f')](_0x51f0a0[_0x5f76('0x3c')],_0x339856['filters']));if(_0x51f0a0['query']['filter']){_0x26dd0d[_0x5f76('0x45')]=_[_0x5f76('0x47')](_0x26dd0d[_0x5f76('0x45')],{'$or':_['map'](_0x26dd0d[_0x5f76('0x3d')],function(_0x28c5be){var _0x3e2396={};_0x3e2396[_0x28c5be]={'$like':'%'+_0x51f0a0['query'][_0x5f76('0x49')]+'%'};return _0x3e2396;})});}_0x26dd0d=_[_0x5f76('0x47')]({},_0x26dd0d,_0x51f0a0[_0x5f76('0x4a')]);return _0xa9e2d2[_0x5f76('0x8f')](_0x26dd0d);}})[_0x5f76('0x2c')](function(_0x35c732){if(_0x35c732){_0x541422=_0x35c732[_0x5f76('0x40')];if(!_0x51f0a0['query'][_0x5f76('0x41')]('nolimit')){_0x26dd0d[_0x5f76('0x23')]=qs['limit'](_0x51f0a0[_0x5f76('0x3c')]['limit']);_0x26dd0d[_0x5f76('0x21')]=qs[_0x5f76('0x21')](_0x51f0a0[_0x5f76('0x3c')][_0x5f76('0x21')]);}return _0xa9e2d2[_0x5f76('0x8f')](_0x26dd0d);}})['then'](function(_0x5e9628){if(_0x5e9628){return _0x5e9628?{'count':_0x541422,'rows':_0x5e9628}:null;}})[_0x5f76('0x2c')](respondWithResult(_0x5c95ce,null))['catch'](handleError(_0x5c95ce,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 81bb0fb..115275f 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 _0xbaa7=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xbaa7,0x133));var _0x7baa=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xbaa7[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require(_0x7baa('0x0'));var OpenchannelQueue=require(_0x7baa('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7baa('0x2'),'afterUpdate':_0x7baa('0x3'),'afterDestroy':_0x7baa('0x4')};function emitEvent(_0x4ceeec){return function(_0xec342d,_0x2e338a,_0x5a69d6){OpenchannelQueueEvents[_0x7baa('0x5')](_0x4ceeec+':'+_0xec342d['id'],_0xec342d);OpenchannelQueueEvents[_0x7baa('0x5')](_0x4ceeec,_0xec342d);_0x5a69d6(null);};}for(var e in events){if(events[_0x7baa('0x6')](e)){var event=events[e];OpenchannelQueue[_0x7baa('0x7')](e,emitEvent(event));}}module[_0x7baa('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2f04=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x59ac27,_0x202e0e){var _0x4ed9b3=function(_0x48364d){while(--_0x48364d){_0x59ac27['push'](_0x59ac27['shift']());}};_0x4ed9b3(++_0x202e0e);}(_0x2f04,0x1da));var _0x42f0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x2f04[_0x12fc8d];return _0x3f9d04;};'use strict';var EventEmitter=require(_0x42f0('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x42f0('0x1')](0x0);var events={'afterCreate':_0x42f0('0x2'),'afterUpdate':'update','afterDestroy':_0x42f0('0x3')};function emitEvent(_0x49644e){return function(_0x4587ca,_0x41c5c5,_0x5b1bf6){OpenchannelQueueEvents[_0x42f0('0x4')](_0x49644e+':'+_0x4587ca['id'],_0x4587ca);OpenchannelQueueEvents[_0x42f0('0x4')](_0x49644e,_0x4587ca);_0x5b1bf6(null);};}for(var e in events){if(events[_0x42f0('0x5')](e)){var event=events[e];OpenchannelQueue[_0x42f0('0x6')](e,emitEvent(event));}}module[_0x42f0('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8c3dcfe..1eb12e1 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 _0xca9c=['rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','util','../../config/logger','moment','bluebird','path'];(function(_0xa060e7,_0x15768f){var _0x15b6c5=function(_0x4420f4){while(--_0x4420f4){_0xa060e7['push'](_0xa060e7['shift']());}};_0x15b6c5(++_0x15768f);}(_0xca9c,0xcd));var _0xcca9=function(_0x29e619,_0x24044e){_0x29e619=_0x29e619-0x0;var _0x2ba225=_0xca9c[_0x29e619];return _0x2ba225;};'use strict';var _=require('lodash');var util=require(_0xcca9('0x0'));var logger=require(_0xcca9('0x1'))('api');var moment=require(_0xcca9('0x2'));var BPromise=require(_0xcca9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcca9('0x4'));var rimraf=require(_0xcca9('0x5'));var config=require(_0xcca9('0x6'));var attributes=require(_0xcca9('0x7'));module['exports']=function(_0x3b92ce,_0x595653){return _0x3b92ce['define'](_0xcca9('0x8'),attributes,{'tableName':_0xcca9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb4=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x4ad84e,_0x3f71af){var _0x5ae444=function(_0x2364ca){while(--_0x2364ca){_0x4ad84e['push'](_0x4ad84e['shift']());}};_0x5ae444(++_0x3f71af);}(_0x7bb4,0x120));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x47bb('0x0'));var util=require(_0x47bb('0x1'));var logger=require(_0x47bb('0x2'))(_0x47bb('0x3'));var moment=require('moment');var BPromise=require(_0x47bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47bb('0x5'));var rimraf=require(_0x47bb('0x6'));var config=require(_0x47bb('0x7'));var attributes=require(_0x47bb('0x8'));module[_0x47bb('0x9')]=function(_0x4ae554,_0x32844c){return _0x4ae554[_0x47bb('0xa')](_0x47bb('0xb'),attributes,{'tableName':'openchannel_queues','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 da0f0ab..2f1b48b 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 _0x6b79=['localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x6b79,0x8d));var _0x96b7=function(_0x258fa2,_0x4cbb97){_0x258fa2=_0x258fa2-0x0;var _0x314057=_0x6b79[_0x258fa2];return _0x314057;};'use strict';var _=require(_0x96b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x96b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b7('0x2'));var db=require(_0x96b7('0x3'))['db'];var utils=require(_0x96b7('0x4'));var logger=require('../../config/logger')(_0x96b7('0x5'));var config=require(_0x96b7('0x6'));var jayson=require(_0x96b7('0x7'));var client=jayson[_0x96b7('0x8')]['http']({'port':0x232a});config[_0x96b7('0x9')]=_[_0x96b7('0xa')](config['redis'],{'host':_0x96b7('0xb'),'port':0x18eb});var socket=require(_0x96b7('0xc'))(new Redis(config[_0x96b7('0x9')]));require(_0x96b7('0xd'))['register'](socket);function respondWithRpcPromise(_0x3fe03b,_0x3796a7,_0x330e7b){return new BPromise(function(_0x4df1be,_0x581f27){return client[_0x96b7('0xe')](_0x3fe03b,_0x330e7b)[_0x96b7('0xf')](function(_0x55f63e){logger[_0x96b7('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x3796a7,_0x96b7('0x11'));logger['debug'](_0x96b7('0x12'),_0x3796a7,_0x96b7('0x11'),JSON['stringify'](_0x55f63e));if(_0x55f63e[_0x96b7('0x13')]){if(_0x55f63e[_0x96b7('0x13')][_0x96b7('0x14')]===0x1f4){logger[_0x96b7('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x3796a7,_0x55f63e['error']['message']);return _0x581f27(_0x55f63e[_0x96b7('0x13')][_0x96b7('0x15')]);}logger[_0x96b7('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x3796a7,_0x55f63e['error'][_0x96b7('0x15')]);return _0x4df1be(_0x55f63e['error'][_0x96b7('0x15')]);}else{logger[_0x96b7('0x10')](_0x96b7('0x16'),_0x3796a7,'request\x20sent');_0x4df1be(_0x55f63e[_0x96b7('0x17')][_0x96b7('0x15')]);}})[_0x96b7('0x18')](function(_0x13f636){logger['error'](_0x96b7('0x16'),_0x3796a7,_0x13f636);_0x581f27(_0x13f636);});});}exports['GetOpenchannelQueue']=function(_0x5ca5a0){var _0x4f6b39=this;return new Promise(function(_0x74905e,_0x2d489c){return db[_0x96b7('0x19')][_0x96b7('0x1a')]({'raw':_0x5ca5a0[_0x96b7('0x1b')]?_0x5ca5a0['options'][_0x96b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ca5a0['options']?_0x5ca5a0[_0x96b7('0x1b')][_0x96b7('0x1d')]||null:null,'attributes':_0x5ca5a0['options']?_0x5ca5a0[_0x96b7('0x1b')][_0x96b7('0x1e')]||null:null,'limit':_0x5ca5a0[_0x96b7('0x1b')]?_0x5ca5a0[_0x96b7('0x1b')][_0x96b7('0x1f')]||null:null,'include':_0x5ca5a0[_0x96b7('0x1b')]?_0x5ca5a0['options'][_0x96b7('0x20')]?_[_0x96b7('0x21')](_0x5ca5a0['options']['include'],function(_0x1eda30){return{'model':db[_0x1eda30['model']],'as':_0x1eda30['as'],'attributes':_0x1eda30[_0x96b7('0x1e')],'include':_0x1eda30['include']?_[_0x96b7('0x21')](_0x1eda30['include'],function(_0x2f77ef){return{'model':db[_0x2f77ef[_0x96b7('0x22')]],'as':_0x2f77ef['as'],'attributes':_0x2f77ef[_0x96b7('0x1e')],'include':_0x2f77ef[_0x96b7('0x20')]?_[_0x96b7('0x21')](_0x2f77ef['include'],function(_0x227d56){return{'model':db[_0x227d56[_0x96b7('0x22')]],'as':_0x227d56['as'],'attributes':_0x227d56[_0x96b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x96b7('0xf')](function(_0x1b84c9){logger[_0x96b7('0x10')]('GetOpenchannelQueue',_0x5ca5a0);logger['debug'](_0x96b7('0x23'),_0x5ca5a0,JSON['stringify'](_0x1b84c9));_0x74905e(_0x1b84c9);})[_0x96b7('0x18')](function(_0x519ab3){logger[_0x96b7('0x13')]('GetOpenchannelQueue',_0x519ab3[_0x96b7('0x15')],_0x5ca5a0);_0x2d489c(_0x4f6b39['error'](0x1f4,_0x519ab3['message']));});});};exports['ShowOpenchannelQueue']=function(_0x43f069){var _0x5dc7af=this;return new Promise(function(_0x4daa19,_0x2a5036){return db[_0x96b7('0x19')]['find']({'raw':_0x43f069['options']?_0x43f069['options'][_0x96b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x43f069['options']?_0x43f069[_0x96b7('0x1b')]['where']||null:null,'attributes':_0x43f069[_0x96b7('0x1b')]?_0x43f069[_0x96b7('0x1b')][_0x96b7('0x1e')]||null:null,'include':_0x43f069[_0x96b7('0x1b')]?_0x43f069['options']['include']?_[_0x96b7('0x21')](_0x43f069[_0x96b7('0x1b')]['include'],function(_0x3b1584){return{'model':db[_0x3b1584[_0x96b7('0x22')]],'as':_0x3b1584['as'],'attributes':_0x3b1584[_0x96b7('0x1e')],'include':_0x3b1584['include']?_[_0x96b7('0x21')](_0x3b1584['include'],function(_0x483a87){return{'model':db[_0x483a87['model']],'as':_0x483a87['as'],'attributes':_0x483a87['attributes'],'include':_0x483a87['include']?_[_0x96b7('0x21')](_0x483a87[_0x96b7('0x20')],function(_0x1485e8){return{'model':db[_0x1485e8[_0x96b7('0x22')]],'as':_0x1485e8['as'],'attributes':_0x1485e8[_0x96b7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bf551){logger['info'](_0x96b7('0x24'),_0x43f069);logger[_0x96b7('0x25')](_0x96b7('0x24'),_0x43f069,JSON['stringify'](_0x2bf551));_0x4daa19(_0x2bf551);})[_0x96b7('0x18')](function(_0x475b1e){logger['error'](_0x96b7('0x24'),_0x475b1e[_0x96b7('0x15')],_0x43f069);_0x2a5036(_0x5dc7af[_0x96b7('0x13')](0x1f4,_0x475b1e[_0x96b7('0x15')]));});});}; \ No newline at end of file +var _0x08aa=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include','model','attributes','map','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x08aa,0x172));var _0xa08a=function(_0x34c4dc,_0x5a0d7e){_0x34c4dc=_0x34c4dc-0x0;var _0x383b18=_0x08aa[_0x34c4dc];return _0x383b18;};'use strict';var _=require(_0xa08a('0x0'));var util=require(_0xa08a('0x1'));var moment=require('moment');var BPromise=require(_0xa08a('0x2'));var rs=require(_0xa08a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa08a('0x4'))['db'];var utils=require(_0xa08a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa08a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xa08a('0x7')]=_[_0xa08a('0x8')](config[_0xa08a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xa08a('0x9'))(new Redis(config[_0xa08a('0x7')]));require(_0xa08a('0xa'))['register'](socket);function respondWithRpcPromise(_0x2a1682,_0x4577e9,_0x30f4dd){return new BPromise(function(_0x4745fc,_0x25da4e){return client[_0xa08a('0xb')](_0x2a1682,_0x30f4dd)[_0xa08a('0xc')](function(_0x3ee44d){logger[_0xa08a('0xd')](_0xa08a('0xe'),_0x4577e9,_0xa08a('0xf'));logger[_0xa08a('0x10')](_0xa08a('0x11'),_0x4577e9,_0xa08a('0xf'),JSON[_0xa08a('0x12')](_0x3ee44d));if(_0x3ee44d[_0xa08a('0x13')]){if(_0x3ee44d[_0xa08a('0x13')][_0xa08a('0x14')]===0x1f4){logger[_0xa08a('0x13')](_0xa08a('0xe'),_0x4577e9,_0x3ee44d['error'][_0xa08a('0x15')]);return _0x25da4e(_0x3ee44d[_0xa08a('0x13')][_0xa08a('0x15')]);}logger[_0xa08a('0x13')](_0xa08a('0xe'),_0x4577e9,_0x3ee44d['error'][_0xa08a('0x15')]);return _0x4745fc(_0x3ee44d[_0xa08a('0x13')][_0xa08a('0x15')]);}else{logger[_0xa08a('0xd')](_0xa08a('0xe'),_0x4577e9,'request\x20sent');_0x4745fc(_0x3ee44d['result'][_0xa08a('0x15')]);}})[_0xa08a('0x16')](function(_0x325def){logger[_0xa08a('0x13')](_0xa08a('0xe'),_0x4577e9,_0x325def);_0x25da4e(_0x325def);});});}exports[_0xa08a('0x17')]=function(_0x576bd5){var _0x1bc7d0=this;return new Promise(function(_0x26d682,_0x48f731){return db[_0xa08a('0x18')][_0xa08a('0x19')]({'raw':_0x576bd5['options']?_0x576bd5[_0xa08a('0x1a')][_0xa08a('0x1b')]===undefined?!![]:![]:!![],'where':_0x576bd5[_0xa08a('0x1a')]?_0x576bd5[_0xa08a('0x1a')][_0xa08a('0x1c')]||null:null,'attributes':_0x576bd5[_0xa08a('0x1a')]?_0x576bd5[_0xa08a('0x1a')]['attributes']||null:null,'limit':_0x576bd5[_0xa08a('0x1a')]?_0x576bd5['options']['limit']||null:null,'include':_0x576bd5[_0xa08a('0x1a')]?_0x576bd5[_0xa08a('0x1a')][_0xa08a('0x1d')]?_['map'](_0x576bd5[_0xa08a('0x1a')][_0xa08a('0x1d')],function(_0x74f28e){return{'model':db[_0x74f28e[_0xa08a('0x1e')]],'as':_0x74f28e['as'],'attributes':_0x74f28e[_0xa08a('0x1f')],'include':_0x74f28e['include']?_[_0xa08a('0x20')](_0x74f28e[_0xa08a('0x1d')],function(_0x1057dd){return{'model':db[_0x1057dd['model']],'as':_0x1057dd['as'],'attributes':_0x1057dd[_0xa08a('0x1f')],'include':_0x1057dd['include']?_[_0xa08a('0x20')](_0x1057dd[_0xa08a('0x1d')],function(_0x566712){return{'model':db[_0x566712[_0xa08a('0x1e')]],'as':_0x566712['as'],'attributes':_0x566712[_0xa08a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa08a('0xc')](function(_0x4baad1){logger[_0xa08a('0xd')](_0xa08a('0x17'),_0x576bd5);logger[_0xa08a('0x10')](_0xa08a('0x17'),_0x576bd5,JSON[_0xa08a('0x12')](_0x4baad1));_0x26d682(_0x4baad1);})[_0xa08a('0x16')](function(_0x577f50){logger[_0xa08a('0x13')](_0xa08a('0x17'),_0x577f50[_0xa08a('0x15')],_0x576bd5);_0x48f731(_0x1bc7d0['error'](0x1f4,_0x577f50['message']));});});};exports['ShowOpenchannelQueue']=function(_0x238c35){var _0x2f915f=this;return new Promise(function(_0x45f451,_0x532299){return db[_0xa08a('0x18')][_0xa08a('0x21')]({'raw':_0x238c35[_0xa08a('0x1a')]?_0x238c35['options'][_0xa08a('0x1b')]===undefined?!![]:![]:!![],'where':_0x238c35[_0xa08a('0x1a')]?_0x238c35[_0xa08a('0x1a')][_0xa08a('0x1c')]||null:null,'attributes':_0x238c35[_0xa08a('0x1a')]?_0x238c35[_0xa08a('0x1a')][_0xa08a('0x1f')]||null:null,'include':_0x238c35[_0xa08a('0x1a')]?_0x238c35[_0xa08a('0x1a')][_0xa08a('0x1d')]?_[_0xa08a('0x20')](_0x238c35[_0xa08a('0x1a')][_0xa08a('0x1d')],function(_0x3712c4){return{'model':db[_0x3712c4[_0xa08a('0x1e')]],'as':_0x3712c4['as'],'attributes':_0x3712c4['attributes'],'include':_0x3712c4[_0xa08a('0x1d')]?_['map'](_0x3712c4[_0xa08a('0x1d')],function(_0x312ec0){return{'model':db[_0x312ec0[_0xa08a('0x1e')]],'as':_0x312ec0['as'],'attributes':_0x312ec0[_0xa08a('0x1f')],'include':_0x312ec0['include']?_['map'](_0x312ec0[_0xa08a('0x1d')],function(_0x10beb6){return{'model':db[_0x10beb6[_0xa08a('0x1e')]],'as':_0x10beb6['as'],'attributes':_0x10beb6[_0xa08a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa08a('0xc')](function(_0x3c32a1){logger[_0xa08a('0xd')](_0xa08a('0x22'),_0x238c35);logger[_0xa08a('0x10')]('ShowOpenchannelQueue',_0x238c35,JSON[_0xa08a('0x12')](_0x3c32a1));_0x45f451(_0x3c32a1);})[_0xa08a('0x16')](function(_0x770d35){logger['error'](_0xa08a('0x22'),_0x770d35[_0xa08a('0x15')],_0x238c35);_0x532299(_0x2f915f[_0xa08a('0x13')](0x1f4,_0x770d35[_0xa08a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index dd39557..1d46b04 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 _0xeb1e=['save','remove','update','removeListener','register','./openchannelQueue.events'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xeb1e,0xe3));var _0xeeb1=function(_0x3b3f2a,_0x1c0992){_0x3b3f2a=_0x3b3f2a-0x0;var _0x5f07a6=_0xeb1e[_0x3b3f2a];return _0x5f07a6;};'use strict';var OpenchannelQueueEvents=require(_0xeeb1('0x0'));var events=[_0xeeb1('0x1'),_0xeeb1('0x2'),_0xeeb1('0x3')];function createListener(_0x509f54,_0x32e3e6){return function(_0x654d80){_0x32e3e6['emit'](_0x509f54,_0x654d80);};}function removeListener(_0x5dc693,_0x5793c7){return function(){OpenchannelQueueEvents[_0xeeb1('0x4')](_0x5dc693,_0x5793c7);};}exports[_0xeeb1('0x5')]=function(_0x48f977){for(var _0x230fae=0x0,_0x5b21ea=events['length'];_0x230fae<_0x5b21ea;_0x230fae++){var _0xbcde39=events[_0x230fae];var _0x1e8859=createListener('openchannelQueue:'+_0xbcde39,_0x48f977);OpenchannelQueueEvents['on'](_0xbcde39,_0x1e8859);}}; \ No newline at end of file +var _0xf746=['update','emit','removeListener','length','openchannelQueue:','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf746,0xf3));var _0x6f74=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xf746[_0x4ae625];return _0x31accf;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x6f74('0x0'),_0x6f74('0x1'),_0x6f74('0x2')];function createListener(_0x3f7940,_0x41fdab){return function(_0x20a5c6){_0x41fdab[_0x6f74('0x3')](_0x3f7940,_0x20a5c6);};}function removeListener(_0x4b347f,_0x2f744c){return function(){OpenchannelQueueEvents[_0x6f74('0x4')](_0x4b347f,_0x2f744c);};}exports['register']=function(_0x5c6770){for(var _0x3c6d30=0x0,_0x114247=events[_0x6f74('0x5')];_0x3c6d30<_0x114247;_0x3c6d30++){var _0x48946f=events[_0x3c6d30];var _0x12a711=createListener(_0x6f74('0x6')+_0x48946f,_0x5c6770);OpenchannelQueueEvents['on'](_0x48946f,_0x12a711);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 80f040d..c4996cd 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 _0x9fb9=['Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x385beb,_0x47e000){var _0x592caa=function(_0x2e6ce8){while(--_0x2e6ce8){_0x385beb['push'](_0x385beb['shift']());}};_0x592caa(++_0x47e000);}(_0x9fb9,0x9c));var _0x99fb=function(_0x1f6871,_0x130ce9){_0x1f6871=_0x1f6871-0x0;var _0x46b04f=_0x9fb9[_0x1f6871];return _0x46b04f;};'use strict';var multer=require(_0x99fb('0x0'));var util=require(_0x99fb('0x1'));var path=require(_0x99fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x99fb('0x3'));var router=express[_0x99fb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x99fb('0x5'));var config=require(_0x99fb('0x6'));var controller=require(_0x99fb('0x7'));router[_0x99fb('0x8')]('/',auth[_0x99fb('0x9')](),controller['index']);router[_0x99fb('0x8')](_0x99fb('0xa'),auth[_0x99fb('0x9')](),controller[_0x99fb('0xb')]);router['get'](_0x99fb('0xc'),auth[_0x99fb('0x9')](),controller[_0x99fb('0xd')]);router[_0x99fb('0xe')]('/',auth[_0x99fb('0x9')](),controller[_0x99fb('0xf')]);router[_0x99fb('0x10')](_0x99fb('0xc'),auth[_0x99fb('0x9')](),controller[_0x99fb('0x11')]);router[_0x99fb('0x12')](_0x99fb('0xc'),auth[_0x99fb('0x9')](),controller[_0x99fb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7f5f=['show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','describe','/:id','isAuthenticated'];(function(_0x30fe92,_0x31779c){var _0xb849c1=function(_0x14e004){while(--_0x14e004){_0x30fe92['push'](_0x30fe92['shift']());}};_0xb849c1(++_0x31779c);}(_0x7f5f,0x101));var _0xf7f5=function(_0x339da3,_0x6cf9a8){_0x339da3=_0x339da3-0x0;var _0x2ed7c4=_0x7f5f[_0x339da3];return _0x2ed7c4;};'use strict';var multer=require(_0xf7f5('0x0'));var util=require('util');var path=require(_0xf7f5('0x1'));var timeout=require(_0xf7f5('0x2'));var express=require(_0xf7f5('0x3'));var router=express[_0xf7f5('0x4')]();var fs_extra=require(_0xf7f5('0x5'));var auth=require(_0xf7f5('0x6'));var interaction=require(_0xf7f5('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xf7f5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf7f5('0x9'),auth['isAuthenticated'](),controller[_0xf7f5('0xa')]);router[_0xf7f5('0x8')](_0xf7f5('0xb'),auth[_0xf7f5('0xc')](),controller[_0xf7f5('0xd')]);router[_0xf7f5('0xe')]('/',auth[_0xf7f5('0xc')](),controller['create']);router['put'](_0xf7f5('0xb'),auth[_0xf7f5('0xc')](),controller[_0xf7f5('0xf')]);router[_0xf7f5('0x10')](_0xf7f5('0xb'),auth[_0xf7f5('0xc')](),controller['destroy']);module[_0xf7f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8ef4edf..58c1020 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 _0xb647=['sequelize','exports','STRING','DATE','moment'];(function(_0x2c78c7,_0x311aad){var _0x578601=function(_0x557cff){while(--_0x557cff){_0x2c78c7['push'](_0x2c78c7['shift']());}};_0x578601(++_0x311aad);}(_0xb647,0xdb));var _0x7b64=function(_0x595158,_0x54de31){_0x595158=_0x595158-0x0;var _0x45cff7=_0xb647[_0x595158];return _0x45cff7;};'use strict';var moment=require(_0x7b64('0x0'));var Sequelize=require(_0x7b64('0x1'));module[_0x7b64('0x2')]={'uniqueid':{'type':Sequelize[_0x7b64('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7b64('0x3')]},'joinAt':{'type':Sequelize[_0x7b64('0x4')]},'leaveAt':{'type':Sequelize[_0x7b64('0x4')]},'acceptAt':{'type':Sequelize[_0x7b64('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7b64('0x3')]}}; \ No newline at end of file +var _0x1617=['moment','STRING','DATE'];(function(_0xb0bfa0,_0x32c911){var _0xd817f=function(_0x482cce){while(--_0x482cce){_0xb0bfa0['push'](_0xb0bfa0['shift']());}};_0xd817f(++_0x32c911);}(_0x1617,0x15f));var _0x7161=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x1617[_0x9cfe28];return _0x54a1d0;};'use strict';var moment=require(_0x7161('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7161('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7161('0x2')]},'acceptAt':{'type':Sequelize[_0x7161('0x2')]},'exitAt':{'type':Sequelize[_0x7161('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 1df4d4f..fb01898 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 _0x05a8=['VIRTUAL','options','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge'];(function(_0x26e3b5,_0x3724ee){var _0x620ae4=function(_0x27f371){while(--_0x27f371){_0x26e3b5['push'](_0x26e3b5['shift']());}};_0x620ae4(++_0x3724ee);}(_0x05a8,0x12c));var _0x805a=function(_0x125d87,_0x29848b){_0x125d87=_0x125d87-0x0;var _0x57a9ba=_0x05a8[_0x125d87];return _0x57a9ba;};'use strict';var emlformat=require(_0x805a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x805a('0x1'));var jsonpatch=require(_0x805a('0x2'));var rp=require(_0x805a('0x3'));var moment=require(_0x805a('0x4'));var BPromise=require(_0x805a('0x5'));var Mustache=require(_0x805a('0x6'));var util=require('util');var path=require(_0x805a('0x7'));var sox=require(_0x805a('0x8'));var csv=require(_0x805a('0x9'));var ejs=require(_0x805a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x805a('0xb'));var crypto=require(_0x805a('0xc'));var jsforce=require(_0x805a('0xd'));var deskjs=require(_0x805a('0xe'));var toCsv=require(_0x805a('0x9'));var querystring=require(_0x805a('0xf'));var Papa=require('papaparse');var Redis=require(_0x805a('0x10'));var authService=require(_0x805a('0x11'));var qs=require(_0x805a('0x12'));var as=require(_0x805a('0x13'));var hardwareService=require(_0x805a('0x14'));var logger=require(_0x805a('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x805a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x447cde,_0x223518){_0x223518=_0x223518||0xcc;return function(_0x487253){if(_0x487253){return _0x447cde[_0x805a('0x17')](_0x223518);}return _0x447cde['status'](_0x223518)[_0x805a('0x18')]();};}function respondWithResult(_0x372f24,_0xccadfd){_0xccadfd=_0xccadfd||0xc8;return function(_0x528423){if(_0x528423){return _0x372f24['status'](_0xccadfd)[_0x805a('0x19')](_0x528423);}};}function respondWithFilteredResult(_0x565f37,_0x4dd63b){return function(_0x149290){if(_0x149290){var _0x3e5ced=typeof _0x4dd63b[_0x805a('0x1a')]==='undefined'&&typeof _0x4dd63b[_0x805a('0x1b')]==='undefined';var _0x125409=_0x149290[_0x805a('0x1c')];var _0x5d8fb0=_0x3e5ced?0x0:_0x4dd63b[_0x805a('0x1a')];var _0x43bb17=_0x3e5ced?_0x149290[_0x805a('0x1c')]:_0x4dd63b[_0x805a('0x1a')]+_0x4dd63b[_0x805a('0x1b')];var _0x3858eb;if(_0x43bb17>=_0x125409){_0x43bb17=_0x125409;_0x3858eb=0xc8;}else{_0x3858eb=0xce;}_0x565f37[_0x805a('0x1d')](_0x3858eb);return _0x565f37[_0x805a('0x1e')](_0x805a('0x1f'),_0x5d8fb0+'-'+_0x43bb17+'/'+_0x125409)[_0x805a('0x19')](_0x149290);}return null;};}function patchUpdates(_0x5e62f2){return function(_0x5a27b0){try{jsonpatch[_0x805a('0x20')](_0x5a27b0,_0x5e62f2,!![]);}catch(_0x11e301){return BPromise[_0x805a('0x21')](_0x11e301);}return _0x5a27b0['save']();};}function saveUpdates(_0x4ef013,_0x4567ef){return function(_0x1c9191){if(_0x1c9191){return _0x1c9191[_0x805a('0x22')](_0x4ef013)[_0x805a('0x23')](function(_0x5f62fe){return _0x5f62fe;});}return null;};}function removeEntity(_0x2a0920,_0x3545f5){return function(_0x50296c){if(_0x50296c){return _0x50296c[_0x805a('0x24')]()[_0x805a('0x23')](function(){_0x2a0920['status'](0xcc)[_0x805a('0x18')]();});}};}function handleEntityNotFound(_0x1a17ca,_0x41ba92){return function(_0x7a9474){if(!_0x7a9474){_0x1a17ca[_0x805a('0x17')](0x194);}return _0x7a9474;};}function handleError(_0x4106d6,_0xddd479){_0xddd479=_0xddd479||0x1f4;return function(_0x2ed11b){logger[_0x805a('0x25')](_0x2ed11b['stack']);if(_0x2ed11b[_0x805a('0x26')]){delete _0x2ed11b[_0x805a('0x26')];}_0x4106d6['status'](_0xddd479)[_0x805a('0x27')](_0x2ed11b);};}exports[_0x805a('0x28')]=function(_0x424698,_0x254020){var _0xe4b965={},_0x4140b3={},_0x93a06d={'count':0x0,'rows':[]};var _0x2ba641=_[_0x805a('0x29')](db[_0x805a('0x2a')][_0x805a('0x2b')],function(_0x19ea3f){return{'name':_0x19ea3f[_0x805a('0x2c')],'type':_0x19ea3f[_0x805a('0x2d')][_0x805a('0x2e')]};});_0x4140b3['model']=_[_0x805a('0x29')](_0x2ba641,_0x805a('0x26'));_0x4140b3['query']=_['keys'](_0x424698[_0x805a('0x2f')]);_0x4140b3[_0x805a('0x30')]=_[_0x805a('0x31')](_0x4140b3[_0x805a('0x32')],_0x4140b3[_0x805a('0x2f')]);_0xe4b965[_0x805a('0x33')]=_[_0x805a('0x31')](_0x4140b3[_0x805a('0x32')],qs[_0x805a('0x34')](_0x424698[_0x805a('0x2f')][_0x805a('0x34')]));_0xe4b965['attributes']=_0xe4b965['attributes'][_0x805a('0x35')]?_0xe4b965[_0x805a('0x33')]:_0x4140b3['model'];if(!_0x424698[_0x805a('0x2f')]['hasOwnProperty'](_0x805a('0x36'))){_0xe4b965[_0x805a('0x1b')]=qs['limit'](_0x424698['query'][_0x805a('0x1b')]);_0xe4b965[_0x805a('0x1a')]=qs[_0x805a('0x1a')](_0x424698[_0x805a('0x2f')][_0x805a('0x1a')]);}_0xe4b965[_0x805a('0x37')]=qs[_0x805a('0x38')](_0x424698[_0x805a('0x2f')][_0x805a('0x38')]);_0xe4b965[_0x805a('0x39')]=qs['filters'](_['pick'](_0x424698[_0x805a('0x2f')],_0x4140b3[_0x805a('0x30')]),_0x2ba641);if(_0x424698['query'][_0x805a('0x3a')]){_0xe4b965[_0x805a('0x39')]=_[_0x805a('0x3b')](_0xe4b965[_0x805a('0x39')],{'$or':_[_0x805a('0x29')](_0x2ba641,function(_0x2de600){if(_0x2de600[_0x805a('0x2d')]!==_0x805a('0x3c')){var _0x2b9292={};_0x2b9292[_0x2de600['name']]={'$like':'%'+_0x424698['query']['filter']+'%'};return _0x2b9292;}})});}_0xe4b965=_[_0x805a('0x3b')]({},_0xe4b965,_0x424698[_0x805a('0x3d')]);var _0x2c31a6={'where':_0xe4b965[_0x805a('0x39')]};return db[_0x805a('0x2a')]['count'](_0x2c31a6)[_0x805a('0x23')](function(_0x386b1e){_0x93a06d[_0x805a('0x1c')]=_0x386b1e;if(_0x424698[_0x805a('0x2f')]['includeAll']){_0xe4b965[_0x805a('0x3e')]=[{'all':!![]}];}return db[_0x805a('0x2a')][_0x805a('0x3f')](_0xe4b965);})[_0x805a('0x23')](function(_0x4b9367){_0x93a06d['rows']=_0x4b9367;return _0x93a06d;})[_0x805a('0x23')](respondWithFilteredResult(_0x254020,_0xe4b965))[_0x805a('0x40')](handleError(_0x254020,null));};exports[_0x805a('0x41')]=function(_0x1d166a,_0x45dff7){var _0x256882={'raw':!![],'where':{'id':_0x1d166a[_0x805a('0x42')]['id']}},_0x48e208={};_0x48e208[_0x805a('0x32')]=_[_0x805a('0x43')](db[_0x805a('0x2a')][_0x805a('0x2b')]);_0x48e208[_0x805a('0x2f')]=_[_0x805a('0x43')](_0x1d166a[_0x805a('0x2f')]);_0x48e208[_0x805a('0x30')]=_[_0x805a('0x31')](_0x48e208[_0x805a('0x32')],_0x48e208[_0x805a('0x2f')]);_0x256882[_0x805a('0x33')]=_[_0x805a('0x31')](_0x48e208[_0x805a('0x32')],qs[_0x805a('0x34')](_0x1d166a[_0x805a('0x2f')][_0x805a('0x34')]));_0x256882[_0x805a('0x33')]=_0x256882[_0x805a('0x33')][_0x805a('0x35')]?_0x256882[_0x805a('0x33')]:_0x48e208[_0x805a('0x32')];if(_0x1d166a[_0x805a('0x2f')]['includeAll']){_0x256882[_0x805a('0x3e')]=[{'all':!![]}];}_0x256882=_['merge']({},_0x256882,_0x1d166a[_0x805a('0x3d')]);return db[_0x805a('0x2a')]['find'](_0x256882)[_0x805a('0x23')](handleEntityNotFound(_0x45dff7,null))['then'](respondWithResult(_0x45dff7,null))['catch'](handleError(_0x45dff7,null));};exports[_0x805a('0x44')]=function(_0x139e17,_0x4c1b3f){return db[_0x805a('0x2a')][_0x805a('0x44')](_0x139e17[_0x805a('0x45')],{})['then'](respondWithResult(_0x4c1b3f,0xc9))[_0x805a('0x40')](handleError(_0x4c1b3f,null));};exports[_0x805a('0x22')]=function(_0x48c8b7,_0x31519a){if(_0x48c8b7[_0x805a('0x45')]['id']){delete _0x48c8b7[_0x805a('0x45')]['id'];}return db[_0x805a('0x2a')]['find']({'where':{'id':_0x48c8b7[_0x805a('0x42')]['id']}})[_0x805a('0x23')](handleEntityNotFound(_0x31519a,null))[_0x805a('0x23')](saveUpdates(_0x48c8b7[_0x805a('0x45')],null))[_0x805a('0x23')](respondWithResult(_0x31519a,null))['catch'](handleError(_0x31519a,null));};exports[_0x805a('0x24')]=function(_0x1566ba,_0x4db63b){return db[_0x805a('0x2a')][_0x805a('0x46')]({'where':{'id':_0x1566ba[_0x805a('0x42')]['id']}})[_0x805a('0x23')](handleEntityNotFound(_0x4db63b,null))[_0x805a('0x23')](removeEntity(_0x4db63b,null))['catch'](handleError(_0x4db63b,null));};exports[_0x805a('0x47')]=function(_0x1b178a,_0x5eb699){return db[_0x805a('0x2a')]['describe']()[_0x805a('0x23')](respondWithResult(_0x5eb699,null))[_0x805a('0x40')](handleError(_0x5eb699,null));}; \ No newline at end of file +var _0xfaa4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','count','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaa4,0x103));var _0x4faa=function(_0x35d2c8,_0x3ee005){_0x35d2c8=_0x35d2c8-0x0;var _0x29176f=_0xfaa4[_0x35d2c8];return _0x29176f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4faa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4faa('0x1'));var rp=require(_0x4faa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4faa('0x3'));var util=require(_0x4faa('0x4'));var path=require(_0x4faa('0x5'));var sox=require(_0x4faa('0x6'));var csv=require(_0x4faa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4faa('0x8'));var _=require(_0x4faa('0x9'));var squel=require('squel');var crypto=require(_0x4faa('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4faa('0x7'));var querystring=require(_0x4faa('0xb'));var Papa=require(_0x4faa('0xc'));var Redis=require(_0x4faa('0xd'));var authService=require(_0x4faa('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4faa('0xf'));var hardwareService=require(_0x4faa('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4faa('0x11'));var config=require(_0x4faa('0x12'));var licenseUtil=require(_0x4faa('0x13'));var db=require(_0x4faa('0x14'))['db'];function respondWithStatusCode(_0x534429,_0x587aa5){_0x587aa5=_0x587aa5||0xcc;return function(_0x25b59f){if(_0x25b59f){return _0x534429['sendStatus'](_0x587aa5);}return _0x534429['status'](_0x587aa5)[_0x4faa('0x15')]();};}function respondWithResult(_0x33c1be,_0x313979){_0x313979=_0x313979||0xc8;return function(_0x58b268){if(_0x58b268){return _0x33c1be[_0x4faa('0x16')](_0x313979)[_0x4faa('0x17')](_0x58b268);}};}function respondWithFilteredResult(_0x4e6eec,_0x2942a3){return function(_0x4bcefe){if(_0x4bcefe){var _0x3ce645=typeof _0x2942a3[_0x4faa('0x18')]==='undefined'&&typeof _0x2942a3[_0x4faa('0x19')]===_0x4faa('0x1a');var _0x461f1c=_0x4bcefe['count'];var _0x3bd859=_0x3ce645?0x0:_0x2942a3['offset'];var _0x28f3b0=_0x3ce645?_0x4bcefe['count']:_0x2942a3[_0x4faa('0x18')]+_0x2942a3[_0x4faa('0x19')];var _0x2ec9bb;if(_0x28f3b0>=_0x461f1c){_0x28f3b0=_0x461f1c;_0x2ec9bb=0xc8;}else{_0x2ec9bb=0xce;}_0x4e6eec['status'](_0x2ec9bb);return _0x4e6eec['set']('Content-Range',_0x3bd859+'-'+_0x28f3b0+'/'+_0x461f1c)[_0x4faa('0x17')](_0x4bcefe);}return null;};}function patchUpdates(_0x24f7e9){return function(_0xd5fab5){try{jsonpatch[_0x4faa('0x1b')](_0xd5fab5,_0x24f7e9,!![]);}catch(_0x243bf1){return BPromise[_0x4faa('0x1c')](_0x243bf1);}return _0xd5fab5[_0x4faa('0x1d')]();};}function saveUpdates(_0x533529,_0x51dc06){return function(_0x176ed2){if(_0x176ed2){return _0x176ed2[_0x4faa('0x1e')](_0x533529)[_0x4faa('0x1f')](function(_0x40dbe8){return _0x40dbe8;});}return null;};}function removeEntity(_0x484db3,_0x147eee){return function(_0x193609){if(_0x193609){return _0x193609[_0x4faa('0x20')]()[_0x4faa('0x1f')](function(){_0x484db3[_0x4faa('0x16')](0xcc)[_0x4faa('0x15')]();});}};}function handleEntityNotFound(_0x2408a7,_0x225087){return function(_0x54c096){if(!_0x54c096){_0x2408a7[_0x4faa('0x21')](0x194);}return _0x54c096;};}function handleError(_0x520e1d,_0x1679e1){_0x1679e1=_0x1679e1||0x1f4;return function(_0x4886f7){logger['error'](_0x4886f7[_0x4faa('0x22')]);if(_0x4886f7[_0x4faa('0x23')]){delete _0x4886f7[_0x4faa('0x23')];}_0x520e1d[_0x4faa('0x16')](_0x1679e1)[_0x4faa('0x24')](_0x4886f7);};}exports['index']=function(_0x3d122b,_0x21476b){var _0x21aad4={},_0x5eeb12={},_0x223890={'count':0x0,'rows':[]};var _0x1e83c9=_[_0x4faa('0x25')](db[_0x4faa('0x26')][_0x4faa('0x27')],function(_0x2396b8){return{'name':_0x2396b8[_0x4faa('0x28')],'type':_0x2396b8[_0x4faa('0x29')][_0x4faa('0x2a')]};});_0x5eeb12[_0x4faa('0x2b')]=_['map'](_0x1e83c9,_0x4faa('0x23'));_0x5eeb12[_0x4faa('0x2c')]=_[_0x4faa('0x2d')](_0x3d122b[_0x4faa('0x2c')]);_0x5eeb12[_0x4faa('0x2e')]=_['intersection'](_0x5eeb12[_0x4faa('0x2b')],_0x5eeb12[_0x4faa('0x2c')]);_0x21aad4[_0x4faa('0x2f')]=_[_0x4faa('0x30')](_0x5eeb12[_0x4faa('0x2b')],qs[_0x4faa('0x31')](_0x3d122b['query'][_0x4faa('0x31')]));_0x21aad4[_0x4faa('0x2f')]=_0x21aad4['attributes']['length']?_0x21aad4[_0x4faa('0x2f')]:_0x5eeb12[_0x4faa('0x2b')];if(!_0x3d122b[_0x4faa('0x2c')][_0x4faa('0x32')]('nolimit')){_0x21aad4['limit']=qs['limit'](_0x3d122b['query'][_0x4faa('0x19')]);_0x21aad4[_0x4faa('0x18')]=qs['offset'](_0x3d122b['query'][_0x4faa('0x18')]);}_0x21aad4[_0x4faa('0x33')]=qs['sort'](_0x3d122b[_0x4faa('0x2c')][_0x4faa('0x34')]);_0x21aad4['where']=qs[_0x4faa('0x2e')](_[_0x4faa('0x35')](_0x3d122b[_0x4faa('0x2c')],_0x5eeb12[_0x4faa('0x2e')]),_0x1e83c9);if(_0x3d122b[_0x4faa('0x2c')][_0x4faa('0x36')]){_0x21aad4['where']=_[_0x4faa('0x37')](_0x21aad4['where'],{'$or':_[_0x4faa('0x25')](_0x1e83c9,function(_0x5911f2){if(_0x5911f2[_0x4faa('0x29')]!==_0x4faa('0x38')){var _0x47eabb={};_0x47eabb[_0x5911f2[_0x4faa('0x23')]]={'$like':'%'+_0x3d122b['query'][_0x4faa('0x36')]+'%'};return _0x47eabb;}})});}_0x21aad4=_[_0x4faa('0x37')]({},_0x21aad4,_0x3d122b[_0x4faa('0x39')]);var _0xdb9a32={'where':_0x21aad4[_0x4faa('0x3a')]};return db[_0x4faa('0x26')]['count'](_0xdb9a32)[_0x4faa('0x1f')](function(_0x341b6c){_0x223890[_0x4faa('0x3b')]=_0x341b6c;if(_0x3d122b[_0x4faa('0x2c')][_0x4faa('0x3c')]){_0x21aad4[_0x4faa('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x21aad4);})[_0x4faa('0x1f')](function(_0x2c5641){_0x223890[_0x4faa('0x3e')]=_0x2c5641;return _0x223890;})[_0x4faa('0x1f')](respondWithFilteredResult(_0x21476b,_0x21aad4))[_0x4faa('0x3f')](handleError(_0x21476b,null));};exports['show']=function(_0x1a9749,_0x534339){var _0x1d9ceb={'raw':!![],'where':{'id':_0x1a9749[_0x4faa('0x40')]['id']}},_0x2bcb99={};_0x2bcb99[_0x4faa('0x2b')]=_[_0x4faa('0x2d')](db[_0x4faa('0x26')][_0x4faa('0x27')]);_0x2bcb99[_0x4faa('0x2c')]=_['keys'](_0x1a9749[_0x4faa('0x2c')]);_0x2bcb99['filters']=_[_0x4faa('0x30')](_0x2bcb99['model'],_0x2bcb99[_0x4faa('0x2c')]);_0x1d9ceb[_0x4faa('0x2f')]=_['intersection'](_0x2bcb99['model'],qs[_0x4faa('0x31')](_0x1a9749['query'][_0x4faa('0x31')]));_0x1d9ceb[_0x4faa('0x2f')]=_0x1d9ceb[_0x4faa('0x2f')]['length']?_0x1d9ceb['attributes']:_0x2bcb99[_0x4faa('0x2b')];if(_0x1a9749[_0x4faa('0x2c')][_0x4faa('0x3c')]){_0x1d9ceb[_0x4faa('0x3d')]=[{'all':!![]}];}_0x1d9ceb=_[_0x4faa('0x37')]({},_0x1d9ceb,_0x1a9749[_0x4faa('0x39')]);return db['OpenchannelQueueReport'][_0x4faa('0x41')](_0x1d9ceb)[_0x4faa('0x1f')](handleEntityNotFound(_0x534339,null))[_0x4faa('0x1f')](respondWithResult(_0x534339,null))[_0x4faa('0x3f')](handleError(_0x534339,null));};exports[_0x4faa('0x42')]=function(_0x4f9d7c,_0xddb943){return db[_0x4faa('0x26')][_0x4faa('0x42')](_0x4f9d7c['body'],{})[_0x4faa('0x1f')](respondWithResult(_0xddb943,0xc9))[_0x4faa('0x3f')](handleError(_0xddb943,null));};exports[_0x4faa('0x1e')]=function(_0x2d17f9,_0x455741){if(_0x2d17f9[_0x4faa('0x43')]['id']){delete _0x2d17f9[_0x4faa('0x43')]['id'];}return db[_0x4faa('0x26')][_0x4faa('0x41')]({'where':{'id':_0x2d17f9[_0x4faa('0x40')]['id']}})[_0x4faa('0x1f')](handleEntityNotFound(_0x455741,null))[_0x4faa('0x1f')](saveUpdates(_0x2d17f9[_0x4faa('0x43')],null))[_0x4faa('0x1f')](respondWithResult(_0x455741,null))['catch'](handleError(_0x455741,null));};exports[_0x4faa('0x20')]=function(_0x5e31fb,_0x5d6a61){return db['OpenchannelQueueReport'][_0x4faa('0x41')]({'where':{'id':_0x5e31fb[_0x4faa('0x40')]['id']}})[_0x4faa('0x1f')](handleEntityNotFound(_0x5d6a61,null))[_0x4faa('0x1f')](removeEntity(_0x5d6a61,null))[_0x4faa('0x3f')](handleError(_0x5d6a61,null));};exports[_0x4faa('0x44')]=function(_0x10d21d,_0x307de0){return db[_0x4faa('0x26')][_0x4faa('0x44')]()[_0x4faa('0x1f')](respondWithResult(_0x307de0,null))[_0x4faa('0x3f')](handleError(_0x307de0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7724b65..f30352d 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x49e489,_0x5dfd72){var _0x410430=function(_0x33e7a9){while(--_0x33e7a9){_0x49e489['push'](_0x49e489['shift']());}};_0x410430(++_0x5dfd72);}(_0x326f,0xd1));var _0xf326=function(_0x196791,_0x4763d6){_0x196791=_0x196791-0x0;var _0x4fb220=_0x326f[_0x196791];return _0x4fb220;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4c96ce,_0x2938b7){var _0x387b8c=function(_0x2df09e){while(--_0x2df09e){_0x4c96ce['push'](_0x4c96ce['shift']());}};_0x387b8c(++_0x2938b7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e34d30e..f854d3c 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 _0x82d8=['client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateOpenchannelQueueReport','stringify','OpenchannelQueueReport','attributes','UpdateOpenchannelQueueReport','lodash','moment','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x53b7ee,_0x4cdace){var _0x2ce0d7=function(_0x46d78b){while(--_0x46d78b){_0x53b7ee['push'](_0x53b7ee['shift']());}};_0x2ce0d7(++_0x4cdace);}(_0x82d8,0xff));var _0x882d=function(_0x1f6454,_0x2abf63){_0x1f6454=_0x1f6454-0x0;var _0x542441=_0x82d8[_0x1f6454];return _0x542441;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x882d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x882d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x882d('0x4'));var jayson=require(_0x882d('0x5'));var client=jayson[_0x882d('0x6')][_0x882d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb7539b,_0x3c8b67,_0x4067a9){return new BPromise(function(_0x4ea710,_0x4035ba){return client[_0x882d('0x8')](_0xb7539b,_0x4067a9)[_0x882d('0x9')](function(_0x4da4aa){logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,'request\x20sent');logger[_0x882d('0xc')](_0x882d('0xd'),_0x3c8b67,_0x882d('0xe'),JSON['stringify'](_0x4da4aa));if(_0x4da4aa[_0x882d('0xf')]){if(_0x4da4aa[_0x882d('0xf')][_0x882d('0x10')]===0x1f4){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4035ba(_0x4da4aa['error']['message']);}logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4ea710(_0x4da4aa[_0x882d('0xf')]['message']);}else{logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,_0x882d('0xe'));_0x4ea710(_0x4da4aa[_0x882d('0x12')][_0x882d('0x11')]);}})[_0x882d('0x13')](function(_0x46cfcc){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x46cfcc);_0x4035ba(_0x46cfcc);});});}exports['CreateOpenchannelQueueReport']=function(_0x556b9b){var _0x33556b=this;return new Promise(function(_0x59aaec,_0x3e4cf5){return db['OpenchannelQueueReport'][_0x882d('0x14')](_0x556b9b[_0x882d('0x15')],{'raw':_0x556b9b[_0x882d('0x16')]?_0x556b9b['options'][_0x882d('0x17')]===undefined?!![]:![]:!![]})[_0x882d('0x9')](function(_0x14d709){logger['info'](_0x882d('0x18'),_0x556b9b);logger[_0x882d('0xc')](_0x882d('0x18'),_0x556b9b,JSON[_0x882d('0x19')](_0x14d709));_0x59aaec(_0x14d709);})[_0x882d('0x13')](function(_0x1a4a84){logger[_0x882d('0xf')](_0x882d('0x18'),_0x1a4a84[_0x882d('0x11')],_0x556b9b);_0x3e4cf5(_0x33556b['error'](0x1f4,_0x1a4a84[_0x882d('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x17ce48){var _0xb58bce=this;return new Promise(function(_0x233294,_0x217742){return db[_0x882d('0x1a')]['update'](_0x17ce48[_0x882d('0x15')],{'raw':_0x17ce48['options']?_0x17ce48[_0x882d('0x16')][_0x882d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17ce48['options']?_0x17ce48['options']['where']||null:null,'attributes':_0x17ce48['options']?_0x17ce48[_0x882d('0x16')][_0x882d('0x1b')]||null:null,'limit':_0x17ce48[_0x882d('0x16')]?_0x17ce48[_0x882d('0x16')]['limit']||null:null})[_0x882d('0x9')](function(_0x18ece4){logger[_0x882d('0xa')](_0x882d('0x1c'),_0x17ce48);logger[_0x882d('0xc')]('UpdateOpenchannelQueueReport',_0x17ce48,JSON['stringify'](_0x18ece4));_0x233294(_0x18ece4);})['catch'](function(_0x40fea6){logger[_0x882d('0xf')](_0x882d('0x1c'),_0x40fea6['message'],_0x17ce48);_0x217742(_0xb58bce[_0x882d('0xf')](0x1f4,_0x40fea6[_0x882d('0x11')]));});});}; \ No newline at end of file +var _0x4e2e=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','debug','catch','update','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2e4c10,_0x4cd509){_0x2e4c10=_0x2e4c10-0x0;var _0x108c98=_0x4e2e[_0x2e4c10];return _0x108c98;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['CreateOpenchannelQueueReport']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![]})[_0xe4e2('0xc')](function(_0x362741){logger['info'](_0xe4e2('0x1a'),_0x196f16);logger[_0xe4e2('0x1b')](_0xe4e2('0x1a'),_0x196f16,JSON[_0xe4e2('0x11')](_0x362741));_0x1d5e9d(_0x362741);})[_0xe4e2('0x1c')](function(_0x23b466){logger[_0xe4e2('0x12')]('CreateOpenchannelQueueReport',_0x23b466[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x23b466[_0xe4e2('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x353030){var _0x12ad33=this;return new Promise(function(_0x598fa3,_0xcba85a){return db[_0xe4e2('0x15')][_0xe4e2('0x1d')](_0x353030[_0xe4e2('0x17')],{'raw':_0x353030[_0xe4e2('0x18')]?_0x353030['options'][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')][_0xe4e2('0x1e')]||null:null,'limit':_0x353030['options']?_0x353030[_0xe4e2('0x18')]['limit']||null:null})[_0xe4e2('0xc')](function(_0x1e21c0){logger['info'](_0xe4e2('0x1f'),_0x353030);logger[_0xe4e2('0x1b')](_0xe4e2('0x1f'),_0x353030,JSON[_0xe4e2('0x11')](_0x1e21c0));_0x598fa3(_0x1e21c0);})[_0xe4e2('0x1c')](function(_0x4d33de){logger['error'](_0xe4e2('0x1f'),_0x4d33de[_0xe4e2('0x13')],_0x353030);_0xcba85a(_0x12ad33[_0xe4e2('0x12')](0x1f4,_0x4d33de[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index abb04f1..dd3e1ec 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 _0x06be=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x233ea5,_0x3883a7){var _0x558f56=function(_0x1af7fe){while(--_0x1af7fe){_0x233ea5['push'](_0x233ea5['shift']());}};_0x558f56(++_0x3883a7);}(_0x06be,0x11e));var _0xe06b=function(_0x2abade,_0x513c2d){_0x2abade=_0x2abade-0x0;var _0x3e30e7=_0x06be[_0x2abade];return _0x3e30e7;};'use strict';var multer=require('multer');var util=require(_0xe06b('0x0'));var path=require(_0xe06b('0x1'));var timeout=require(_0xe06b('0x2'));var express=require(_0xe06b('0x3'));var router=express[_0xe06b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe06b('0x5'));var interaction=require(_0xe06b('0x6'));var config=require(_0xe06b('0x7'));var controller=require(_0xe06b('0x8'));router[_0xe06b('0x9')]('/',auth[_0xe06b('0xa')](),controller[_0xe06b('0xb')]);router[_0xe06b('0x9')](_0xe06b('0xc'),auth[_0xe06b('0xa')](),controller['describe']);router[_0xe06b('0x9')](_0xe06b('0xd'),auth['isAuthenticated'](),controller[_0xe06b('0xe')]);router[_0xe06b('0xf')]('/',auth['isAuthenticated'](),controller[_0xe06b('0x10')]);router[_0xe06b('0x11')](_0xe06b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe06b('0x12')]('/:id',auth[_0xe06b('0xa')](),controller[_0xe06b('0x13')]);module[_0xe06b('0x14')]=router; \ No newline at end of file +var _0x8f8e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x6873c1,_0x5dd0ad){var _0x3b6546=function(_0x27a2a1){while(--_0x27a2a1){_0x6873c1['push'](_0x6873c1['shift']());}};_0x3b6546(++_0x5dd0ad);}(_0x8f8e,0xf3));var _0xe8f8=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x8f8e[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0xe8f8('0x0'));var util=require(_0xe8f8('0x1'));var path=require(_0xe8f8('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8f8('0x3'));var router=express[_0xe8f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe8f8('0x5'));var interaction=require(_0xe8f8('0x6'));var config=require(_0xe8f8('0x7'));var controller=require(_0xe8f8('0x8'));router[_0xe8f8('0x9')]('/',auth[_0xe8f8('0xa')](),controller[_0xe8f8('0xb')]);router[_0xe8f8('0x9')](_0xe8f8('0xc'),auth[_0xe8f8('0xa')](),controller[_0xe8f8('0xd')]);router['get'](_0xe8f8('0xe'),auth[_0xe8f8('0xa')](),controller[_0xe8f8('0xf')]);router[_0xe8f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xe8f8('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe8f8('0x12')](_0xe8f8('0xe'),auth['isAuthenticated'](),controller[_0xe8f8('0x13')]);module[_0xe8f8('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 3c30181..91f5f23 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(_0x457bf8,_0x209a0a){var _0x919f94=function(_0x4fc50c){while(--_0x4fc50c){_0x457bf8['push'](_0x457bf8['shift']());}};_0x919f94(++_0x209a0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4ffd20,_0x1e83b6){var _0x49b5e2=function(_0xfdd1a6){while(--_0xfdd1a6){_0x4ffd20['push'](_0x4ffd20['shift']());}};_0x49b5e2(++_0x1e83b6);}(_0x34e8,0x12c));var _0x834e=function(_0x28ef9d,_0x2bf59d){_0x28ef9d=_0x28ef9d-0x0;var _0x542f34=_0x34e8[_0x28ef9d];return _0x542f34;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b4fc27c..09e2e83 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 _0x8037=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','destroy','then','error','name','send','index','map','OpenchannelTransferReport','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x20ab91,_0x35c94f){var _0x2f7163=function(_0xbf0540){while(--_0xbf0540){_0x20ab91['push'](_0x20ab91['shift']());}};_0x2f7163(++_0x35c94f);}(_0x8037,0x1b7));var _0x7803=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8037[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7803('0x0'));var zipdir=require(_0x7803('0x1'));var jsonpatch=require(_0x7803('0x2'));var rp=require('request-promise');var moment=require(_0x7803('0x3'));var BPromise=require(_0x7803('0x4'));var Mustache=require('mustache');var util=require(_0x7803('0x5'));var path=require(_0x7803('0x6'));var sox=require(_0x7803('0x7'));var csv=require('to-csv');var ejs=require(_0x7803('0x8'));var fs=require('fs');var fs_extra=require(_0x7803('0x9'));var _=require(_0x7803('0xa'));var squel=require(_0x7803('0xb'));var crypto=require(_0x7803('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7803('0xd'));var toCsv=require(_0x7803('0xe'));var querystring=require(_0x7803('0xf'));var Papa=require('papaparse');var Redis=require(_0x7803('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7803('0x11'));var as=require(_0x7803('0x12'));var hardwareService=require(_0x7803('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7803('0x14'));var config=require(_0x7803('0x15'));var licenseUtil=require(_0x7803('0x16'));var db=require(_0x7803('0x17'))['db'];function respondWithStatusCode(_0x53a09b,_0x549943){_0x549943=_0x549943||0xcc;return function(_0x31da50){if(_0x31da50){return _0x53a09b[_0x7803('0x18')](_0x549943);}return _0x53a09b[_0x7803('0x19')](_0x549943)[_0x7803('0x1a')]();};}function respondWithResult(_0xcf41a3,_0x12bf45){_0x12bf45=_0x12bf45||0xc8;return function(_0x3818c3){if(_0x3818c3){return _0xcf41a3[_0x7803('0x19')](_0x12bf45)[_0x7803('0x1b')](_0x3818c3);}};}function respondWithFilteredResult(_0x544878,_0x5515b6){return function(_0x42baee){if(_0x42baee){var _0xe34a51=typeof _0x5515b6['offset']===_0x7803('0x1c')&&typeof _0x5515b6['limit']==='undefined';var _0x25056b=_0x42baee[_0x7803('0x1d')];var _0x166b86=_0xe34a51?0x0:_0x5515b6[_0x7803('0x1e')];var _0x5d54b9=_0xe34a51?_0x42baee[_0x7803('0x1d')]:_0x5515b6[_0x7803('0x1e')]+_0x5515b6[_0x7803('0x1f')];var _0x99b0ee;if(_0x5d54b9>=_0x25056b){_0x5d54b9=_0x25056b;_0x99b0ee=0xc8;}else{_0x99b0ee=0xce;}_0x544878[_0x7803('0x19')](_0x99b0ee);return _0x544878[_0x7803('0x20')](_0x7803('0x21'),_0x166b86+'-'+_0x5d54b9+'/'+_0x25056b)['json'](_0x42baee);}return null;};}function patchUpdates(_0x3aca77){return function(_0xe10ab){try{jsonpatch['apply'](_0xe10ab,_0x3aca77,!![]);}catch(_0x5d371c){return BPromise[_0x7803('0x22')](_0x5d371c);}return _0xe10ab['save']();};}function saveUpdates(_0x13c101,_0x48513e){return function(_0x4efada){if(_0x4efada){return _0x4efada['update'](_0x13c101)['then'](function(_0x470e61){return _0x470e61;});}return null;};}function removeEntity(_0x49a58e,_0x2e6d0b){return function(_0x27532e){if(_0x27532e){return _0x27532e[_0x7803('0x23')]()[_0x7803('0x24')](function(){_0x49a58e[_0x7803('0x19')](0xcc)[_0x7803('0x1a')]();});}};}function handleEntityNotFound(_0x591e2e,_0x530c99){return function(_0x5e0f18){if(!_0x5e0f18){_0x591e2e[_0x7803('0x18')](0x194);}return _0x5e0f18;};}function handleError(_0x3740bf,_0x2f9bcb){_0x2f9bcb=_0x2f9bcb||0x1f4;return function(_0x3680fd){logger[_0x7803('0x25')](_0x3680fd['stack']);if(_0x3680fd['name']){delete _0x3680fd[_0x7803('0x26')];}_0x3740bf[_0x7803('0x19')](_0x2f9bcb)[_0x7803('0x27')](_0x3680fd);};}exports[_0x7803('0x28')]=function(_0x2cb773,_0x2cc204){var _0x2fc14c={},_0x18373a={},_0x4fc835={'count':0x0,'rows':[]};var _0x1d4044=_[_0x7803('0x29')](db[_0x7803('0x2a')]['rawAttributes'],function(_0x2c41ac){return{'name':_0x2c41ac['fieldName'],'type':_0x2c41ac[_0x7803('0x2b')]['key']};});_0x18373a[_0x7803('0x2c')]=_[_0x7803('0x29')](_0x1d4044,'name');_0x18373a['query']=_[_0x7803('0x2d')](_0x2cb773[_0x7803('0x2e')]);_0x18373a[_0x7803('0x2f')]=_[_0x7803('0x30')](_0x18373a[_0x7803('0x2c')],_0x18373a[_0x7803('0x2e')]);_0x2fc14c[_0x7803('0x31')]=_[_0x7803('0x30')](_0x18373a[_0x7803('0x2c')],qs['fields'](_0x2cb773[_0x7803('0x2e')]['fields']));_0x2fc14c['attributes']=_0x2fc14c[_0x7803('0x31')][_0x7803('0x32')]?_0x2fc14c['attributes']:_0x18373a[_0x7803('0x2c')];if(!_0x2cb773[_0x7803('0x2e')][_0x7803('0x33')](_0x7803('0x34'))){_0x2fc14c[_0x7803('0x1f')]=qs[_0x7803('0x1f')](_0x2cb773[_0x7803('0x2e')][_0x7803('0x1f')]);_0x2fc14c[_0x7803('0x1e')]=qs[_0x7803('0x1e')](_0x2cb773['query'][_0x7803('0x1e')]);}_0x2fc14c[_0x7803('0x35')]=qs['sort'](_0x2cb773[_0x7803('0x2e')][_0x7803('0x36')]);_0x2fc14c[_0x7803('0x37')]=qs[_0x7803('0x2f')](_[_0x7803('0x38')](_0x2cb773[_0x7803('0x2e')],_0x18373a[_0x7803('0x2f')]),_0x1d4044);if(_0x2cb773[_0x7803('0x2e')][_0x7803('0x39')]){_0x2fc14c['where']=_[_0x7803('0x3a')](_0x2fc14c[_0x7803('0x37')],{'$or':_[_0x7803('0x29')](_0x1d4044,function(_0x43b111){if(_0x43b111['type']!==_0x7803('0x3b')){var _0x636785={};_0x636785[_0x43b111['name']]={'$like':'%'+_0x2cb773['query'][_0x7803('0x39')]+'%'};return _0x636785;}})});}_0x2fc14c=_[_0x7803('0x3a')]({},_0x2fc14c,_0x2cb773[_0x7803('0x3c')]);var _0x3c36ea={'where':_0x2fc14c[_0x7803('0x37')]};return db['OpenchannelTransferReport']['count'](_0x3c36ea)[_0x7803('0x24')](function(_0x562995){_0x4fc835[_0x7803('0x1d')]=_0x562995;if(_0x2cb773[_0x7803('0x2e')][_0x7803('0x3d')]){_0x2fc14c['include']=[{'all':!![]}];}return db[_0x7803('0x2a')][_0x7803('0x3e')](_0x2fc14c);})[_0x7803('0x24')](function(_0x1f75e0){_0x4fc835[_0x7803('0x3f')]=_0x1f75e0;return _0x4fc835;})[_0x7803('0x24')](respondWithFilteredResult(_0x2cc204,_0x2fc14c))[_0x7803('0x40')](handleError(_0x2cc204,null));};exports[_0x7803('0x41')]=function(_0x2dd32f,_0x33a9e7){var _0x44ca9b={'raw':!![],'where':{'id':_0x2dd32f[_0x7803('0x42')]['id']}},_0x3c786b={};_0x3c786b[_0x7803('0x2c')]=_[_0x7803('0x2d')](db['OpenchannelTransferReport'][_0x7803('0x43')]);_0x3c786b[_0x7803('0x2e')]=_[_0x7803('0x2d')](_0x2dd32f[_0x7803('0x2e')]);_0x3c786b[_0x7803('0x2f')]=_[_0x7803('0x30')](_0x3c786b['model'],_0x3c786b[_0x7803('0x2e')]);_0x44ca9b[_0x7803('0x31')]=_['intersection'](_0x3c786b[_0x7803('0x2c')],qs[_0x7803('0x44')](_0x2dd32f[_0x7803('0x2e')][_0x7803('0x44')]));_0x44ca9b['attributes']=_0x44ca9b[_0x7803('0x31')][_0x7803('0x32')]?_0x44ca9b[_0x7803('0x31')]:_0x3c786b[_0x7803('0x2c')];if(_0x2dd32f['query']['includeAll']){_0x44ca9b[_0x7803('0x45')]=[{'all':!![]}];}_0x44ca9b=_[_0x7803('0x3a')]({},_0x44ca9b,_0x2dd32f[_0x7803('0x3c')]);return db['OpenchannelTransferReport']['find'](_0x44ca9b)[_0x7803('0x24')](handleEntityNotFound(_0x33a9e7,null))[_0x7803('0x24')](respondWithResult(_0x33a9e7,null))[_0x7803('0x40')](handleError(_0x33a9e7,null));};exports[_0x7803('0x46')]=function(_0x38e398,_0x5bbbe1){return db['OpenchannelTransferReport'][_0x7803('0x46')](_0x38e398[_0x7803('0x47')],{})[_0x7803('0x24')](respondWithResult(_0x5bbbe1,0xc9))['catch'](handleError(_0x5bbbe1,null));};exports[_0x7803('0x48')]=function(_0xfd8716,_0x5e79b0){if(_0xfd8716[_0x7803('0x47')]['id']){delete _0xfd8716[_0x7803('0x47')]['id'];}return db['OpenchannelTransferReport'][_0x7803('0x49')]({'where':{'id':_0xfd8716[_0x7803('0x42')]['id']}})[_0x7803('0x24')](handleEntityNotFound(_0x5e79b0,null))[_0x7803('0x24')](saveUpdates(_0xfd8716[_0x7803('0x47')],null))[_0x7803('0x24')](respondWithResult(_0x5e79b0,null))[_0x7803('0x40')](handleError(_0x5e79b0,null));};exports[_0x7803('0x23')]=function(_0xd545be,_0x5c8fbf){return db[_0x7803('0x2a')][_0x7803('0x49')]({'where':{'id':_0xd545be['params']['id']}})[_0x7803('0x24')](handleEntityNotFound(_0x5c8fbf,null))['then'](removeEntity(_0x5c8fbf,null))[_0x7803('0x40')](handleError(_0x5c8fbf,null));};exports[_0x7803('0x4a')]=function(_0x3bb126,_0x589e2){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x589e2,null))[_0x7803('0x40')](handleError(_0x589e2,null));}; \ No newline at end of file +var _0x1031=['body','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','OpenchannelTransferReport','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','create'];(function(_0x11fe33,_0x407355){var _0x5ea447=function(_0xec5857){while(--_0xec5857){_0x11fe33['push'](_0x11fe33['shift']());}};_0x5ea447(++_0x407355);}(_0x1031,0x16a));var _0x1103=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x1031[_0x514260];return _0x4ac81b;};'use strict';var emlformat=require(_0x1103('0x0'));var rimraf=require(_0x1103('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1103('0x2'));var moment=require(_0x1103('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1103('0x4'));var path=require(_0x1103('0x5'));var sox=require(_0x1103('0x6'));var csv=require(_0x1103('0x7'));var ejs=require(_0x1103('0x8'));var fs=require('fs');var fs_extra=require(_0x1103('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1103('0xa'));var deskjs=require(_0x1103('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1103('0xc'));var Papa=require('papaparse');var Redis=require(_0x1103('0xd'));var authService=require(_0x1103('0xe'));var qs=require(_0x1103('0xf'));var as=require(_0x1103('0x10'));var hardwareService=require(_0x1103('0x11'));var logger=require(_0x1103('0x12'))(_0x1103('0x13'));var utils=require(_0x1103('0x14'));var config=require(_0x1103('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1103('0x16'))['db'];function respondWithStatusCode(_0x3e4fe6,_0x3c1683){_0x3c1683=_0x3c1683||0xcc;return function(_0x1d1025){if(_0x1d1025){return _0x3e4fe6['sendStatus'](_0x3c1683);}return _0x3e4fe6[_0x1103('0x17')](_0x3c1683)[_0x1103('0x18')]();};}function respondWithResult(_0x48efba,_0xfc41d0){_0xfc41d0=_0xfc41d0||0xc8;return function(_0x45141e){if(_0x45141e){return _0x48efba[_0x1103('0x17')](_0xfc41d0)[_0x1103('0x19')](_0x45141e);}};}function respondWithFilteredResult(_0x2100d7,_0x13b89f){return function(_0x3ef170){if(_0x3ef170){var _0x233a01=typeof _0x13b89f['offset']===_0x1103('0x1a')&&typeof _0x13b89f[_0x1103('0x1b')]==='undefined';var _0x66a5c3=_0x3ef170[_0x1103('0x1c')];var _0x4f2b4f=_0x233a01?0x0:_0x13b89f[_0x1103('0x1d')];var _0x170b11=_0x233a01?_0x3ef170[_0x1103('0x1c')]:_0x13b89f[_0x1103('0x1d')]+_0x13b89f[_0x1103('0x1b')];var _0x3a38cb;if(_0x170b11>=_0x66a5c3){_0x170b11=_0x66a5c3;_0x3a38cb=0xc8;}else{_0x3a38cb=0xce;}_0x2100d7[_0x1103('0x17')](_0x3a38cb);return _0x2100d7[_0x1103('0x1e')](_0x1103('0x1f'),_0x4f2b4f+'-'+_0x170b11+'/'+_0x66a5c3)[_0x1103('0x19')](_0x3ef170);}return null;};}function patchUpdates(_0x313d3b){return function(_0x54b17b){try{jsonpatch[_0x1103('0x20')](_0x54b17b,_0x313d3b,!![]);}catch(_0x57f900){return BPromise['reject'](_0x57f900);}return _0x54b17b['save']();};}function saveUpdates(_0xd0208d,_0x3fb90e){return function(_0x3cc884){if(_0x3cc884){return _0x3cc884[_0x1103('0x21')](_0xd0208d)[_0x1103('0x22')](function(_0x74821f){return _0x74821f;});}return null;};}function removeEntity(_0x18e432,_0x3ab65d){return function(_0x5b3504){if(_0x5b3504){return _0x5b3504[_0x1103('0x23')]()[_0x1103('0x22')](function(){_0x18e432[_0x1103('0x17')](0xcc)[_0x1103('0x18')]();});}};}function handleEntityNotFound(_0x2800c2,_0x130c88){return function(_0x291fd7){if(!_0x291fd7){_0x2800c2['sendStatus'](0x194);}return _0x291fd7;};}function handleError(_0x1a1c46,_0x5b2248){_0x5b2248=_0x5b2248||0x1f4;return function(_0x1f1e0e){logger[_0x1103('0x24')](_0x1f1e0e[_0x1103('0x25')]);if(_0x1f1e0e[_0x1103('0x26')]){delete _0x1f1e0e[_0x1103('0x26')];}_0x1a1c46['status'](_0x5b2248)[_0x1103('0x27')](_0x1f1e0e);};}exports['index']=function(_0x32aa33,_0x43991a){var _0x4d60e2={},_0x2cb9d9={},_0x5513c2={'count':0x0,'rows':[]};var _0xc4b43a=_['map'](db[_0x1103('0x28')][_0x1103('0x29')],function(_0x15df42){return{'name':_0x15df42['fieldName'],'type':_0x15df42[_0x1103('0x2a')][_0x1103('0x2b')]};});_0x2cb9d9['model']=_[_0x1103('0x2c')](_0xc4b43a,_0x1103('0x26'));_0x2cb9d9[_0x1103('0x2d')]=_['keys'](_0x32aa33[_0x1103('0x2d')]);_0x2cb9d9[_0x1103('0x2e')]=_['intersection'](_0x2cb9d9[_0x1103('0x2f')],_0x2cb9d9[_0x1103('0x2d')]);_0x4d60e2[_0x1103('0x30')]=_[_0x1103('0x31')](_0x2cb9d9[_0x1103('0x2f')],qs['fields'](_0x32aa33[_0x1103('0x2d')][_0x1103('0x32')]));_0x4d60e2[_0x1103('0x30')]=_0x4d60e2[_0x1103('0x30')]['length']?_0x4d60e2[_0x1103('0x30')]:_0x2cb9d9[_0x1103('0x2f')];if(!_0x32aa33[_0x1103('0x2d')][_0x1103('0x33')](_0x1103('0x34'))){_0x4d60e2[_0x1103('0x1b')]=qs[_0x1103('0x1b')](_0x32aa33[_0x1103('0x2d')]['limit']);_0x4d60e2['offset']=qs[_0x1103('0x1d')](_0x32aa33[_0x1103('0x2d')][_0x1103('0x1d')]);}_0x4d60e2[_0x1103('0x35')]=qs[_0x1103('0x36')](_0x32aa33[_0x1103('0x2d')][_0x1103('0x36')]);_0x4d60e2['where']=qs[_0x1103('0x2e')](_[_0x1103('0x37')](_0x32aa33[_0x1103('0x2d')],_0x2cb9d9[_0x1103('0x2e')]),_0xc4b43a);if(_0x32aa33[_0x1103('0x2d')][_0x1103('0x38')]){_0x4d60e2['where']=_[_0x1103('0x39')](_0x4d60e2['where'],{'$or':_[_0x1103('0x2c')](_0xc4b43a,function(_0x58c1d5){if(_0x58c1d5[_0x1103('0x2a')]!==_0x1103('0x3a')){var _0x490b37={};_0x490b37[_0x58c1d5[_0x1103('0x26')]]={'$like':'%'+_0x32aa33[_0x1103('0x2d')]['filter']+'%'};return _0x490b37;}})});}_0x4d60e2=_[_0x1103('0x39')]({},_0x4d60e2,_0x32aa33[_0x1103('0x3b')]);var _0xc44635={'where':_0x4d60e2['where']};return db['OpenchannelTransferReport']['count'](_0xc44635)[_0x1103('0x22')](function(_0x42bf7e){_0x5513c2[_0x1103('0x1c')]=_0x42bf7e;if(_0x32aa33[_0x1103('0x2d')]['includeAll']){_0x4d60e2[_0x1103('0x3c')]=[{'all':!![]}];}return db[_0x1103('0x28')][_0x1103('0x3d')](_0x4d60e2);})[_0x1103('0x22')](function(_0x327170){_0x5513c2['rows']=_0x327170;return _0x5513c2;})['then'](respondWithFilteredResult(_0x43991a,_0x4d60e2))[_0x1103('0x3e')](handleError(_0x43991a,null));};exports[_0x1103('0x3f')]=function(_0x38c65c,_0x464c64){var _0x21d0b6={'raw':!![],'where':{'id':_0x38c65c[_0x1103('0x40')]['id']}},_0x28e9ad={};_0x28e9ad['model']=_[_0x1103('0x41')](db['OpenchannelTransferReport'][_0x1103('0x29')]);_0x28e9ad[_0x1103('0x2d')]=_['keys'](_0x38c65c[_0x1103('0x2d')]);_0x28e9ad[_0x1103('0x2e')]=_[_0x1103('0x31')](_0x28e9ad[_0x1103('0x2f')],_0x28e9ad['query']);_0x21d0b6[_0x1103('0x30')]=_[_0x1103('0x31')](_0x28e9ad[_0x1103('0x2f')],qs[_0x1103('0x32')](_0x38c65c[_0x1103('0x2d')][_0x1103('0x32')]));_0x21d0b6[_0x1103('0x30')]=_0x21d0b6[_0x1103('0x30')][_0x1103('0x42')]?_0x21d0b6[_0x1103('0x30')]:_0x28e9ad[_0x1103('0x2f')];if(_0x38c65c[_0x1103('0x2d')][_0x1103('0x43')]){_0x21d0b6[_0x1103('0x3c')]=[{'all':!![]}];}_0x21d0b6=_[_0x1103('0x39')]({},_0x21d0b6,_0x38c65c['options']);return db['OpenchannelTransferReport'][_0x1103('0x44')](_0x21d0b6)['then'](handleEntityNotFound(_0x464c64,null))[_0x1103('0x22')](respondWithResult(_0x464c64,null))[_0x1103('0x3e')](handleError(_0x464c64,null));};exports['create']=function(_0x55d961,_0x5034e4){return db[_0x1103('0x28')][_0x1103('0x45')](_0x55d961[_0x1103('0x46')],{})[_0x1103('0x22')](respondWithResult(_0x5034e4,0xc9))[_0x1103('0x3e')](handleError(_0x5034e4,null));};exports[_0x1103('0x21')]=function(_0x179e89,_0x2eb6a8){if(_0x179e89[_0x1103('0x46')]['id']){delete _0x179e89[_0x1103('0x46')]['id'];}return db[_0x1103('0x28')][_0x1103('0x44')]({'where':{'id':_0x179e89[_0x1103('0x40')]['id']}})[_0x1103('0x22')](handleEntityNotFound(_0x2eb6a8,null))[_0x1103('0x22')](saveUpdates(_0x179e89[_0x1103('0x46')],null))[_0x1103('0x22')](respondWithResult(_0x2eb6a8,null))[_0x1103('0x3e')](handleError(_0x2eb6a8,null));};exports[_0x1103('0x23')]=function(_0x392680,_0x434807){return db[_0x1103('0x28')][_0x1103('0x44')]({'where':{'id':_0x392680['params']['id']}})[_0x1103('0x22')](handleEntityNotFound(_0x434807,null))[_0x1103('0x22')](removeEntity(_0x434807,null))[_0x1103('0x3e')](handleError(_0x434807,null));};exports[_0x1103('0x47')]=function(_0x12243f,_0xabd907){return db['OpenchannelTransferReport']['describe']()[_0x1103('0x22')](respondWithResult(_0xabd907,null))[_0x1103('0x3e')](handleError(_0xabd907,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1de6b01..32a3de3 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 _0xadb2=['path','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xadb2,0x1c9));var _0x2adb=function(_0xe50dca,_0xed741e){_0xe50dca=_0xe50dca-0x0;var _0x3416f7=_0xadb2[_0xe50dca];return _0x3416f7;};'use strict';var _=require(_0x2adb('0x0'));var util=require('util');var logger=require(_0x2adb('0x1'))(_0x2adb('0x2'));var moment=require(_0x2adb('0x3'));var BPromise=require(_0x2adb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2adb('0x5'));var rimraf=require('rimraf');var config=require(_0x2adb('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x2adb('0x7')]=function(_0x41c635,_0xd0a9b4){return _0x41c635['define'](_0x2adb('0x8'),attributes,{'tableName':_0x2adb('0x9'),'paranoid':![],'indexes':[{'name':_0x2adb('0xa'),'fields':[_0x2adb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f8e=['request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3f9024,_0x48d0e5){var _0x3c931c=function(_0x336fdf){while(--_0x336fdf){_0x3f9024['push'](_0x3f9024['shift']());}};_0x3c931c(++_0x48d0e5);}(_0x4f8e,0xb2));var _0xe4f8=function(_0x3f5d1a,_0x33400b){_0x3f5d1a=_0x3f5d1a-0x0;var _0x2db38a=_0x4f8e[_0x3f5d1a];return _0x2db38a;};'use strict';var _=require(_0xe4f8('0x0'));var util=require(_0xe4f8('0x1'));var logger=require(_0xe4f8('0x2'))('api');var moment=require(_0xe4f8('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4f8('0x4'));var fs=require('fs');var path=require(_0xe4f8('0x5'));var rimraf=require('rimraf');var config=require(_0xe4f8('0x6'));var attributes=require(_0xe4f8('0x7'));module[_0xe4f8('0x8')]=function(_0x3ae40c,_0x2d1d5a){return _0x3ae40c[_0xe4f8('0x9')](_0xe4f8('0xa'),attributes,{'tableName':_0xe4f8('0xb'),'paranoid':![],'indexes':[{'name':_0xe4f8('0xc'),'fields':[_0xe4f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 225d21d..dbf1930 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 _0xecb2=['stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xecb2,0xf6));var _0x2ecb=function(_0x55e96e,_0x533767){_0x55e96e=_0x55e96e-0x0;var _0x5a5502=_0xecb2[_0x55e96e];return _0x5a5502;};'use strict';var _=require(_0x2ecb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ecb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ecb('0x2'))['db'];var utils=require(_0x2ecb('0x3'));var logger=require(_0x2ecb('0x4'))(_0x2ecb('0x5'));var config=require(_0x2ecb('0x6'));var jayson=require(_0x2ecb('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49de99,_0x8f9105,_0x3df4a0){return new BPromise(function(_0x15a959,_0x3bd683){return client[_0x2ecb('0x8')](_0x49de99,_0x3df4a0)['then'](function(_0x19652e){logger[_0x2ecb('0x9')](_0x2ecb('0xa'),_0x8f9105,'request\x20sent');logger[_0x2ecb('0xb')](_0x2ecb('0xc'),_0x8f9105,_0x2ecb('0xd'),JSON[_0x2ecb('0xe')](_0x19652e));if(_0x19652e[_0x2ecb('0xf')]){if(_0x19652e['error'][_0x2ecb('0x10')]===0x1f4){logger[_0x2ecb('0xf')](_0x2ecb('0xa'),_0x8f9105,_0x19652e[_0x2ecb('0xf')][_0x2ecb('0x11')]);return _0x3bd683(_0x19652e[_0x2ecb('0xf')][_0x2ecb('0x11')]);}logger['error'](_0x2ecb('0xa'),_0x8f9105,_0x19652e[_0x2ecb('0xf')]['message']);return _0x15a959(_0x19652e[_0x2ecb('0xf')][_0x2ecb('0x11')]);}else{logger[_0x2ecb('0x9')](_0x2ecb('0xa'),_0x8f9105,_0x2ecb('0xd'));_0x15a959(_0x19652e[_0x2ecb('0x12')][_0x2ecb('0x11')]);}})[_0x2ecb('0x13')](function(_0x662ef2){logger['error'](_0x2ecb('0xa'),_0x8f9105,_0x662ef2);_0x3bd683(_0x662ef2);});});} \ No newline at end of file +var _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 224b5a6..db67e2e 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 _0x7d3f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x7a55a7,_0x451e31){var _0x277972=function(_0x10b6e5){while(--_0x10b6e5){_0x7a55a7['push'](_0x7a55a7['shift']());}};_0x277972(++_0x451e31);}(_0x7d3f,0xd2));var _0xf7d3=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x7d3f[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0xf7d3('0x0'));var util=require(_0xf7d3('0x1'));var path=require(_0xf7d3('0x2'));var timeout=require(_0xf7d3('0x3'));var express=require(_0xf7d3('0x4'));var router=express[_0xf7d3('0x5')]();var fs_extra=require(_0xf7d3('0x6'));var auth=require(_0xf7d3('0x7'));var interaction=require(_0xf7d3('0x8'));var config=require(_0xf7d3('0x9'));var controller=require('./pause.controller');router[_0xf7d3('0xa')]('/',auth[_0xf7d3('0xb')](),controller[_0xf7d3('0xc')]);router[_0xf7d3('0xa')](_0xf7d3('0xd'),auth[_0xf7d3('0xb')](),controller[_0xf7d3('0xe')]);router[_0xf7d3('0xf')]('/',auth[_0xf7d3('0xb')](),controller['create']);router[_0xf7d3('0x10')](_0xf7d3('0xd'),auth['isAuthenticated'](),controller[_0xf7d3('0x11')]);router[_0xf7d3('0x12')]('/:id',auth[_0xf7d3('0xb')](),controller[_0xf7d3('0x13')]);module[_0xf7d3('0x14')]=router; \ No newline at end of file +var _0x9d16=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9d16,0x156));var _0x69d1=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x9d16[_0x406696];return _0x10e35c;};'use strict';var multer=require(_0x69d1('0x0'));var util=require(_0x69d1('0x1'));var path=require(_0x69d1('0x2'));var timeout=require(_0x69d1('0x3'));var express=require(_0x69d1('0x4'));var router=express[_0x69d1('0x5')]();var fs_extra=require(_0x69d1('0x6'));var auth=require(_0x69d1('0x7'));var interaction=require(_0x69d1('0x8'));var config=require('../../config/environment');var controller=require(_0x69d1('0x9'));router[_0x69d1('0xa')]('/',auth[_0x69d1('0xb')](),controller[_0x69d1('0xc')]);router[_0x69d1('0xa')](_0x69d1('0xd'),auth[_0x69d1('0xb')](),controller[_0x69d1('0xe')]);router[_0x69d1('0xf')]('/',auth[_0x69d1('0xb')](),controller[_0x69d1('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x69d1('0x11')]);router[_0x69d1('0x12')](_0x69d1('0xd'),auth[_0x69d1('0xb')](),controller['destroy']);module[_0x69d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index a04cd0b..7bbeab6 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 _0xae3f=['STRING','name','exports'];(function(_0x25d571,_0x1ed9f5){var _0x5c1455=function(_0x14a467){while(--_0x14a467){_0x25d571['push'](_0x25d571['shift']());}};_0x5c1455(++_0x1ed9f5);}(_0xae3f,0xa1));var _0xfae3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xae3f[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require('sequelize');module[_0xfae3('0x0')]={'name':{'type':Sequelize[_0xfae3('0x1')],'unique':_0xfae3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xfae3('0x1')]}}; \ No newline at end of file +var _0x6792=['sequelize','exports','STRING'];(function(_0xf39d59,_0x40b191){var _0x3a1ab6=function(_0x465f54){while(--_0x465f54){_0xf39d59['push'](_0xf39d59['shift']());}};_0x3a1ab6(++_0x40b191);}(_0x6792,0xe1));var _0x2679=function(_0x2bce6f,_0x110dad){_0x2bce6f=_0x2bce6f-0x0;var _0x5b7876=_0x6792[_0x2bce6f];return _0x5b7876;};'use strict';var Sequelize=require(_0x2679('0x0'));module[_0x2679('0x1')]={'name':{'type':Sequelize[_0x2679('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2679('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index aa466ce..bf5ff09 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 _0xbc5a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','rows','catch','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','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','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','index','Pause','rawAttributes','fieldName','type','model','map'];(function(_0x4e2852,_0x4e825a){var _0x21efa2=function(_0x5643eb){while(--_0x5643eb){_0x4e2852['push'](_0x4e2852['shift']());}};_0x21efa2(++_0x4e825a);}(_0xbc5a,0x1ae));var _0xabc5=function(_0x57bb3a,_0x237ede){_0x57bb3a=_0x57bb3a-0x0;var _0x5decaa=_0xbc5a[_0x57bb3a];return _0x5decaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabc5('0x0'));var zipdir=require(_0xabc5('0x1'));var jsonpatch=require(_0xabc5('0x2'));var rp=require('request-promise');var moment=require(_0xabc5('0x3'));var BPromise=require(_0xabc5('0x4'));var Mustache=require(_0xabc5('0x5'));var util=require(_0xabc5('0x6'));var path=require(_0xabc5('0x7'));var sox=require(_0xabc5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabc5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabc5('0xa'));var toCsv=require('to-csv');var querystring=require(_0xabc5('0xb'));var Papa=require(_0xabc5('0xc'));var Redis=require('ioredis');var authService=require(_0xabc5('0xd'));var qs=require(_0xabc5('0xe'));var as=require(_0xabc5('0xf'));var hardwareService=require(_0xabc5('0x10'));var logger=require(_0xabc5('0x11'))(_0xabc5('0x12'));var utils=require('../../config/utils');var config=require(_0xabc5('0x13'));var licenseUtil=require(_0xabc5('0x14'));var db=require(_0xabc5('0x15'))['db'];function respondWithStatusCode(_0x469dd4,_0x15a7df){_0x15a7df=_0x15a7df||0xcc;return function(_0x25de28){if(_0x25de28){return _0x469dd4[_0xabc5('0x16')](_0x15a7df);}return _0x469dd4[_0xabc5('0x17')](_0x15a7df)[_0xabc5('0x18')]();};}function respondWithResult(_0x1b54b6,_0x13bfbd){_0x13bfbd=_0x13bfbd||0xc8;return function(_0x418a55){if(_0x418a55){return _0x1b54b6[_0xabc5('0x17')](_0x13bfbd)[_0xabc5('0x19')](_0x418a55);}};}function respondWithFilteredResult(_0x986b20,_0x29f418){return function(_0x2e03a3){if(_0x2e03a3){var _0x5f3c7b=typeof _0x29f418[_0xabc5('0x1a')]==='undefined'&&typeof _0x29f418[_0xabc5('0x1b')]===_0xabc5('0x1c');var _0x334297=_0x2e03a3[_0xabc5('0x1d')];var _0x13f4e6=_0x5f3c7b?0x0:_0x29f418[_0xabc5('0x1a')];var _0x5ef4a0=_0x5f3c7b?_0x2e03a3[_0xabc5('0x1d')]:_0x29f418['offset']+_0x29f418[_0xabc5('0x1b')];var _0x524339;if(_0x5ef4a0>=_0x334297){_0x5ef4a0=_0x334297;_0x524339=0xc8;}else{_0x524339=0xce;}_0x986b20[_0xabc5('0x17')](_0x524339);return _0x986b20['set'](_0xabc5('0x1e'),_0x13f4e6+'-'+_0x5ef4a0+'/'+_0x334297)[_0xabc5('0x19')](_0x2e03a3);}return null;};}function patchUpdates(_0x32ad34){return function(_0x19b301){try{jsonpatch[_0xabc5('0x1f')](_0x19b301,_0x32ad34,!![]);}catch(_0x367305){return BPromise[_0xabc5('0x20')](_0x367305);}return _0x19b301[_0xabc5('0x21')]();};}function saveUpdates(_0x2da5ee,_0x40abe5){return function(_0x46e78c){if(_0x46e78c){return _0x46e78c[_0xabc5('0x22')](_0x2da5ee)[_0xabc5('0x23')](function(_0x513528){return _0x513528;});}return null;};}function removeEntity(_0x186a9a,_0x5524d3){return function(_0x3b1b69){if(_0x3b1b69){return _0x3b1b69['destroy']()[_0xabc5('0x23')](function(){var _0x196879=_0x3b1b69[_0xabc5('0x24')]({'plain':!![]});var _0x43f3d7=_0xabc5('0x25');return db[_0xabc5('0x26')][_0xabc5('0x27')]({'where':{'type':_0x43f3d7,'resourceId':_0x196879['id']}})[_0xabc5('0x23')](function(){return _0x3b1b69;});})[_0xabc5('0x23')](function(){_0x186a9a[_0xabc5('0x17')](0xcc)[_0xabc5('0x18')]();});}};}function handleEntityNotFound(_0x44a285,_0x230c5b){return function(_0x51edf8){if(!_0x51edf8){_0x44a285[_0xabc5('0x16')](0x194);}return _0x51edf8;};}function handleError(_0x2b2716,_0x322193){_0x322193=_0x322193||0x1f4;return function(_0x1f53be){logger[_0xabc5('0x28')](_0x1f53be[_0xabc5('0x29')]);if(_0x1f53be['name']){delete _0x1f53be[_0xabc5('0x2a')];}_0x2b2716[_0xabc5('0x17')](_0x322193)['send'](_0x1f53be);};}exports[_0xabc5('0x2b')]=function(_0x4785eb,_0x2b50fc){var _0x582cfe={},_0x3e398d={},_0x5b609b={'count':0x0,'rows':[]};var _0xfb86d9=_['map'](db[_0xabc5('0x2c')][_0xabc5('0x2d')],function(_0x5e8c3e){return{'name':_0x5e8c3e[_0xabc5('0x2e')],'type':_0x5e8c3e[_0xabc5('0x2f')]['key']};});_0x3e398d[_0xabc5('0x30')]=_[_0xabc5('0x31')](_0xfb86d9,_0xabc5('0x2a'));_0x3e398d[_0xabc5('0x32')]=_[_0xabc5('0x33')](_0x4785eb[_0xabc5('0x32')]);_0x3e398d[_0xabc5('0x34')]=_[_0xabc5('0x35')](_0x3e398d[_0xabc5('0x30')],_0x3e398d[_0xabc5('0x32')]);_0x582cfe[_0xabc5('0x36')]=_[_0xabc5('0x35')](_0x3e398d['model'],qs[_0xabc5('0x37')](_0x4785eb['query'][_0xabc5('0x37')]));_0x582cfe[_0xabc5('0x36')]=_0x582cfe[_0xabc5('0x36')][_0xabc5('0x38')]?_0x582cfe[_0xabc5('0x36')]:_0x3e398d[_0xabc5('0x30')];if(!_0x4785eb[_0xabc5('0x32')][_0xabc5('0x39')]('nolimit')){_0x582cfe[_0xabc5('0x1b')]=qs[_0xabc5('0x1b')](_0x4785eb[_0xabc5('0x32')][_0xabc5('0x1b')]);_0x582cfe[_0xabc5('0x1a')]=qs[_0xabc5('0x1a')](_0x4785eb[_0xabc5('0x32')][_0xabc5('0x1a')]);}_0x582cfe[_0xabc5('0x3a')]=qs[_0xabc5('0x3b')](_0x4785eb[_0xabc5('0x32')][_0xabc5('0x3b')]);_0x582cfe[_0xabc5('0x3c')]=qs['filters'](_[_0xabc5('0x3d')](_0x4785eb[_0xabc5('0x32')],_0x3e398d[_0xabc5('0x34')]),_0xfb86d9);if(_0x4785eb[_0xabc5('0x32')]['filter']){_0x582cfe[_0xabc5('0x3c')]=_['merge'](_0x582cfe[_0xabc5('0x3c')],{'$or':_[_0xabc5('0x31')](_0xfb86d9,function(_0x180f8c){if(_0x180f8c['type']!==_0xabc5('0x3e')){var _0x27de81={};_0x27de81[_0x180f8c['name']]={'$like':'%'+_0x4785eb[_0xabc5('0x32')][_0xabc5('0x3f')]+'%'};return _0x27de81;}})});}_0x582cfe=_[_0xabc5('0x40')]({},_0x582cfe,_0x4785eb[_0xabc5('0x41')]);var _0x5e5600={'where':_0x582cfe[_0xabc5('0x3c')]};return db[_0xabc5('0x2c')]['count'](_0x5e5600)[_0xabc5('0x23')](function(_0x31c656){_0x5b609b[_0xabc5('0x1d')]=_0x31c656;if(_0x4785eb[_0xabc5('0x32')]['includeAll']){_0x582cfe['include']=[{'all':!![]}];}return db[_0xabc5('0x2c')]['findAll'](_0x582cfe);})[_0xabc5('0x23')](function(_0x292058){_0x5b609b[_0xabc5('0x42')]=_0x292058;return _0x5b609b;})['then'](respondWithFilteredResult(_0x2b50fc,_0x582cfe))[_0xabc5('0x43')](handleError(_0x2b50fc,null));};exports['show']=function(_0xc3edb3,_0x4eeede){var _0x1c3f54={'raw':!![],'where':{'id':_0xc3edb3[_0xabc5('0x44')]['id']}},_0x42a589={};_0x42a589['model']=_[_0xabc5('0x33')](db['Pause'][_0xabc5('0x2d')]);_0x42a589[_0xabc5('0x32')]=_['keys'](_0xc3edb3[_0xabc5('0x32')]);_0x42a589[_0xabc5('0x34')]=_[_0xabc5('0x35')](_0x42a589['model'],_0x42a589[_0xabc5('0x32')]);_0x1c3f54['attributes']=_[_0xabc5('0x35')](_0x42a589[_0xabc5('0x30')],qs[_0xabc5('0x37')](_0xc3edb3[_0xabc5('0x32')]['fields']));_0x1c3f54[_0xabc5('0x36')]=_0x1c3f54[_0xabc5('0x36')][_0xabc5('0x38')]?_0x1c3f54['attributes']:_0x42a589[_0xabc5('0x30')];if(_0xc3edb3['query'][_0xabc5('0x45')]){_0x1c3f54[_0xabc5('0x46')]=[{'all':!![]}];}_0x1c3f54=_['merge']({},_0x1c3f54,_0xc3edb3[_0xabc5('0x41')]);return db[_0xabc5('0x2c')][_0xabc5('0x47')](_0x1c3f54)['then'](handleEntityNotFound(_0x4eeede,null))['then'](respondWithResult(_0x4eeede,null))[_0xabc5('0x43')](handleError(_0x4eeede,null));};exports[_0xabc5('0x48')]=function(_0x1623bf,_0x4ccf1d){return db[_0xabc5('0x2c')][_0xabc5('0x48')](_0x1623bf[_0xabc5('0x49')],{})[_0xabc5('0x23')](function(_0x12ae27){var _0x36a4f0=_0x1623bf[_0xabc5('0x4a')]['get']({'plain':!![]});if(!_0x36a4f0)throw new Error(_0xabc5('0x4b'));if(_0x36a4f0['role']==='user'){var _0x30a3c4=_0x12ae27[_0xabc5('0x24')]({'plain':!![]});var _0x47ef5a=_0xabc5('0x25');return db[_0xabc5('0x4c')][_0xabc5('0x47')]({'where':{'name':_0x47ef5a,'userProfileId':_0x36a4f0[_0xabc5('0x4d')]},'raw':!![]})[_0xabc5('0x23')](function(_0x31ff53){if(_0x31ff53&&_0x31ff53[_0xabc5('0x4e')]===0x0){return db[_0xabc5('0x26')][_0xabc5('0x48')]({'name':_0x30a3c4[_0xabc5('0x2a')],'resourceId':_0x30a3c4['id'],'type':_0x31ff53['name'],'sectionId':_0x31ff53['id']},{})[_0xabc5('0x23')](function(){return _0x12ae27;});}else{return _0x12ae27;}})[_0xabc5('0x43')](function(_0x132799){logger['error'](_0xabc5('0x4f'),_0x132799);throw _0x132799;});}return _0x12ae27;})['then'](respondWithResult(_0x4ccf1d,0xc9))['catch'](handleError(_0x4ccf1d,null));};exports[_0xabc5('0x22')]=function(_0x55b1d9,_0x3425bb){if(_0x55b1d9[_0xabc5('0x49')]['id']){delete _0x55b1d9[_0xabc5('0x49')]['id'];}return db[_0xabc5('0x2c')][_0xabc5('0x47')]({'where':{'id':_0x55b1d9[_0xabc5('0x44')]['id']}})[_0xabc5('0x23')](handleEntityNotFound(_0x3425bb,null))[_0xabc5('0x23')](saveUpdates(_0x55b1d9['body'],null))['then'](respondWithResult(_0x3425bb,null))[_0xabc5('0x43')](handleError(_0x3425bb,null));};exports[_0xabc5('0x27')]=function(_0x36dcdd,_0x13d3d8){return db['Pause']['find']({'where':{'id':_0x36dcdd[_0xabc5('0x44')]['id']}})[_0xabc5('0x23')](handleEntityNotFound(_0x13d3d8,null))[_0xabc5('0x23')](removeEntity(_0x13d3d8,null))['catch'](handleError(_0x13d3d8,null));}; \ No newline at end of file +var _0x1f9f=['eml-format','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5e7a0f,_0x287b2f){var _0x193cae=function(_0x4ef73d){while(--_0x4ef73d){_0x5e7a0f['push'](_0x5e7a0f['shift']());}};_0x193cae(++_0x287b2f);}(_0x1f9f,0xfc));var _0xf1f9=function(_0x497687,_0x3c1de1){_0x497687=_0x497687-0x0;var _0x396ccb=_0x1f9f[_0x497687];return _0x396ccb;};'use strict';var emlformat=require(_0xf1f9('0x0'));var rimraf=require(_0xf1f9('0x1'));var zipdir=require(_0xf1f9('0x2'));var jsonpatch=require(_0xf1f9('0x3'));var rp=require(_0xf1f9('0x4'));var moment=require(_0xf1f9('0x5'));var BPromise=require(_0xf1f9('0x6'));var Mustache=require(_0xf1f9('0x7'));var util=require(_0xf1f9('0x8'));var path=require(_0xf1f9('0x9'));var sox=require('sox');var csv=require(_0xf1f9('0xa'));var ejs=require(_0xf1f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf1f9('0xc'));var _=require(_0xf1f9('0xd'));var squel=require(_0xf1f9('0xe'));var crypto=require(_0xf1f9('0xf'));var jsforce=require(_0xf1f9('0x10'));var deskjs=require(_0xf1f9('0x11'));var toCsv=require(_0xf1f9('0xa'));var querystring=require(_0xf1f9('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf1f9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf1f9('0x14'));var hardwareService=require(_0xf1f9('0x15'));var logger=require(_0xf1f9('0x16'))(_0xf1f9('0x17'));var utils=require(_0xf1f9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf1f9('0x19'))['db'];function respondWithStatusCode(_0x3193d8,_0x4cba58){_0x4cba58=_0x4cba58||0xcc;return function(_0x1e3d84){if(_0x1e3d84){return _0x3193d8[_0xf1f9('0x1a')](_0x4cba58);}return _0x3193d8[_0xf1f9('0x1b')](_0x4cba58)['end']();};}function respondWithResult(_0x581723,_0x2e47f7){_0x2e47f7=_0x2e47f7||0xc8;return function(_0x49d727){if(_0x49d727){return _0x581723[_0xf1f9('0x1b')](_0x2e47f7)[_0xf1f9('0x1c')](_0x49d727);}};}function respondWithFilteredResult(_0x56b143,_0x136f4c){return function(_0x26608b){if(_0x26608b){var _0x325721=typeof _0x136f4c['offset']===_0xf1f9('0x1d')&&typeof _0x136f4c[_0xf1f9('0x1e')]==='undefined';var _0x260b7f=_0x26608b[_0xf1f9('0x1f')];var _0x4a413d=_0x325721?0x0:_0x136f4c[_0xf1f9('0x20')];var _0x458032=_0x325721?_0x26608b[_0xf1f9('0x1f')]:_0x136f4c[_0xf1f9('0x20')]+_0x136f4c[_0xf1f9('0x1e')];var _0x5c2e8d;if(_0x458032>=_0x260b7f){_0x458032=_0x260b7f;_0x5c2e8d=0xc8;}else{_0x5c2e8d=0xce;}_0x56b143[_0xf1f9('0x1b')](_0x5c2e8d);return _0x56b143[_0xf1f9('0x21')](_0xf1f9('0x22'),_0x4a413d+'-'+_0x458032+'/'+_0x260b7f)['json'](_0x26608b);}return null;};}function patchUpdates(_0x4ac692){return function(_0x7c1a25){try{jsonpatch['apply'](_0x7c1a25,_0x4ac692,!![]);}catch(_0x2c49ff){return BPromise[_0xf1f9('0x23')](_0x2c49ff);}return _0x7c1a25[_0xf1f9('0x24')]();};}function saveUpdates(_0x2aabb1,_0xd284b3){return function(_0x5aa3c3){if(_0x5aa3c3){return _0x5aa3c3[_0xf1f9('0x25')](_0x2aabb1)[_0xf1f9('0x26')](function(_0x4bf0bd){return _0x4bf0bd;});}return null;};}function removeEntity(_0x3e838d,_0x16f505){return function(_0x1018c6){if(_0x1018c6){return _0x1018c6[_0xf1f9('0x27')]()['then'](function(){var _0x4e2609=_0x1018c6[_0xf1f9('0x28')]({'plain':!![]});var _0x4aac23='Pauses';return db[_0xf1f9('0x29')][_0xf1f9('0x27')]({'where':{'type':_0x4aac23,'resourceId':_0x4e2609['id']}})['then'](function(){return _0x1018c6;});})['then'](function(){_0x3e838d[_0xf1f9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478495,_0x4f7e41){return function(_0x4bcd10){if(!_0x4bcd10){_0x478495[_0xf1f9('0x1a')](0x194);}return _0x4bcd10;};}function handleError(_0x52a96b,_0x24fcdf){_0x24fcdf=_0x24fcdf||0x1f4;return function(_0x582f60){logger[_0xf1f9('0x2a')](_0x582f60[_0xf1f9('0x2b')]);if(_0x582f60[_0xf1f9('0x2c')]){delete _0x582f60[_0xf1f9('0x2c')];}_0x52a96b[_0xf1f9('0x1b')](_0x24fcdf)[_0xf1f9('0x2d')](_0x582f60);};}exports[_0xf1f9('0x2e')]=function(_0x1c69ea,_0x3978c2){var _0x30bc01={},_0x303d39={},_0x45db16={'count':0x0,'rows':[]};var _0x2fba21=_[_0xf1f9('0x2f')](db[_0xf1f9('0x30')][_0xf1f9('0x31')],function(_0x55545c){return{'name':_0x55545c[_0xf1f9('0x32')],'type':_0x55545c[_0xf1f9('0x33')][_0xf1f9('0x34')]};});_0x303d39['model']=_[_0xf1f9('0x2f')](_0x2fba21,_0xf1f9('0x2c'));_0x303d39[_0xf1f9('0x35')]=_[_0xf1f9('0x36')](_0x1c69ea[_0xf1f9('0x35')]);_0x303d39[_0xf1f9('0x37')]=_['intersection'](_0x303d39[_0xf1f9('0x38')],_0x303d39[_0xf1f9('0x35')]);_0x30bc01[_0xf1f9('0x39')]=_[_0xf1f9('0x3a')](_0x303d39[_0xf1f9('0x38')],qs[_0xf1f9('0x3b')](_0x1c69ea[_0xf1f9('0x35')]['fields']));_0x30bc01['attributes']=_0x30bc01[_0xf1f9('0x39')]['length']?_0x30bc01[_0xf1f9('0x39')]:_0x303d39[_0xf1f9('0x38')];if(!_0x1c69ea[_0xf1f9('0x35')][_0xf1f9('0x3c')](_0xf1f9('0x3d'))){_0x30bc01[_0xf1f9('0x1e')]=qs[_0xf1f9('0x1e')](_0x1c69ea['query'][_0xf1f9('0x1e')]);_0x30bc01[_0xf1f9('0x20')]=qs[_0xf1f9('0x20')](_0x1c69ea[_0xf1f9('0x35')]['offset']);}_0x30bc01['order']=qs['sort'](_0x1c69ea[_0xf1f9('0x35')][_0xf1f9('0x3e')]);_0x30bc01[_0xf1f9('0x3f')]=qs['filters'](_['pick'](_0x1c69ea[_0xf1f9('0x35')],_0x303d39[_0xf1f9('0x37')]),_0x2fba21);if(_0x1c69ea[_0xf1f9('0x35')][_0xf1f9('0x40')]){_0x30bc01[_0xf1f9('0x3f')]=_[_0xf1f9('0x41')](_0x30bc01[_0xf1f9('0x3f')],{'$or':_['map'](_0x2fba21,function(_0x1bdb39){if(_0x1bdb39['type']!==_0xf1f9('0x42')){var _0x4a992a={};_0x4a992a[_0x1bdb39[_0xf1f9('0x2c')]]={'$like':'%'+_0x1c69ea['query'][_0xf1f9('0x40')]+'%'};return _0x4a992a;}})});}_0x30bc01=_[_0xf1f9('0x41')]({},_0x30bc01,_0x1c69ea[_0xf1f9('0x43')]);var _0x5ae60d={'where':_0x30bc01[_0xf1f9('0x3f')]};return db[_0xf1f9('0x30')][_0xf1f9('0x1f')](_0x5ae60d)[_0xf1f9('0x26')](function(_0x214b9e){_0x45db16[_0xf1f9('0x1f')]=_0x214b9e;if(_0x1c69ea['query'][_0xf1f9('0x44')]){_0x30bc01[_0xf1f9('0x45')]=[{'all':!![]}];}return db[_0xf1f9('0x30')][_0xf1f9('0x46')](_0x30bc01);})[_0xf1f9('0x26')](function(_0x1147c4){_0x45db16['rows']=_0x1147c4;return _0x45db16;})[_0xf1f9('0x26')](respondWithFilteredResult(_0x3978c2,_0x30bc01))[_0xf1f9('0x47')](handleError(_0x3978c2,null));};exports[_0xf1f9('0x48')]=function(_0x1aeb53,_0x1f00b6){var _0x57bb57={'raw':!![],'where':{'id':_0x1aeb53[_0xf1f9('0x49')]['id']}},_0x141397={};_0x141397['model']=_[_0xf1f9('0x36')](db[_0xf1f9('0x30')][_0xf1f9('0x31')]);_0x141397[_0xf1f9('0x35')]=_[_0xf1f9('0x36')](_0x1aeb53['query']);_0x141397['filters']=_['intersection'](_0x141397[_0xf1f9('0x38')],_0x141397[_0xf1f9('0x35')]);_0x57bb57[_0xf1f9('0x39')]=_[_0xf1f9('0x3a')](_0x141397['model'],qs['fields'](_0x1aeb53['query'][_0xf1f9('0x3b')]));_0x57bb57[_0xf1f9('0x39')]=_0x57bb57[_0xf1f9('0x39')][_0xf1f9('0x4a')]?_0x57bb57[_0xf1f9('0x39')]:_0x141397['model'];if(_0x1aeb53[_0xf1f9('0x35')][_0xf1f9('0x44')]){_0x57bb57[_0xf1f9('0x45')]=[{'all':!![]}];}_0x57bb57=_[_0xf1f9('0x41')]({},_0x57bb57,_0x1aeb53[_0xf1f9('0x43')]);return db[_0xf1f9('0x30')][_0xf1f9('0x4b')](_0x57bb57)[_0xf1f9('0x26')](handleEntityNotFound(_0x1f00b6,null))[_0xf1f9('0x26')](respondWithResult(_0x1f00b6,null))[_0xf1f9('0x47')](handleError(_0x1f00b6,null));};exports[_0xf1f9('0x4c')]=function(_0x5cd238,_0x366f6d){return db[_0xf1f9('0x30')][_0xf1f9('0x4c')](_0x5cd238[_0xf1f9('0x4d')],{})[_0xf1f9('0x26')](function(_0x3d040b){var _0x5b3de1=_0x5cd238[_0xf1f9('0x4e')][_0xf1f9('0x28')]({'plain':!![]});if(!_0x5b3de1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b3de1['role']===_0xf1f9('0x4e')){var _0x382140=_0x3d040b['get']({'plain':!![]});var _0x324673=_0xf1f9('0x4f');return db[_0xf1f9('0x50')]['find']({'where':{'name':_0x324673,'userProfileId':_0x5b3de1[_0xf1f9('0x51')]},'raw':!![]})[_0xf1f9('0x26')](function(_0x2ad8bf){if(_0x2ad8bf&&_0x2ad8bf[_0xf1f9('0x52')]===0x0){return db[_0xf1f9('0x29')][_0xf1f9('0x4c')]({'name':_0x382140[_0xf1f9('0x2c')],'resourceId':_0x382140['id'],'type':_0x2ad8bf[_0xf1f9('0x2c')],'sectionId':_0x2ad8bf['id']},{})[_0xf1f9('0x26')](function(){return _0x3d040b;});}else{return _0x3d040b;}})['catch'](function(_0x4512e6){logger['error'](_0xf1f9('0x53'),_0x4512e6);throw _0x4512e6;});}return _0x3d040b;})[_0xf1f9('0x26')](respondWithResult(_0x366f6d,0xc9))['catch'](handleError(_0x366f6d,null));};exports[_0xf1f9('0x25')]=function(_0x24352d,_0x3d378c){if(_0x24352d['body']['id']){delete _0x24352d[_0xf1f9('0x4d')]['id'];}return db[_0xf1f9('0x30')][_0xf1f9('0x4b')]({'where':{'id':_0x24352d[_0xf1f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d378c,null))[_0xf1f9('0x26')](saveUpdates(_0x24352d['body'],null))['then'](respondWithResult(_0x3d378c,null))[_0xf1f9('0x47')](handleError(_0x3d378c,null));};exports['destroy']=function(_0x5bfd06,_0x39fb54){return db[_0xf1f9('0x30')][_0xf1f9('0x4b')]({'where':{'id':_0x5bfd06[_0xf1f9('0x49')]['id']}})[_0xf1f9('0x26')](handleEntityNotFound(_0x39fb54,null))['then'](removeEntity(_0x39fb54,null))['catch'](handleError(_0x39fb54,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c85d225..7028e05 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x599d5b,_0x5a8fb3){var _0x37d6d3=function(_0x4178f2){while(--_0x4178f2){_0x599d5b['push'](_0x599d5b['shift']());}};_0x37d6d3(++_0x5a8fb3);}(_0x326f,0xd1));var _0xf326=function(_0x1edf32,_0x1246c7){_0x1edf32=_0x1edf32-0x0;var _0x291779=_0x326f[_0x1edf32];return _0x291779;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 515198c..6880c61 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x24ac93,_0x5351d4){var _0xd0a4aa=function(_0x3652f7){while(--_0x3652f7){_0x24ac93['push'](_0x24ac93['shift']());}};_0xd0a4aa(++_0x5351d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b857f,_0x286e31){_0x1b857f=_0x1b857f-0x0;var _0x5582e9=_0xb10b[_0x1b857f];return _0x5582e9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1bdda0,_0x29dedf){var _0x269a8f=function(_0x13e87e){while(--_0x13e87e){_0x1bdda0['push'](_0x1bdda0['shift']());}};_0x269a8f(++_0x29dedf);}(_0x7a54,0x106));var _0x47a5=function(_0x35e869,_0xc355ec){_0x35e869=_0x35e869-0x0;var _0x58a0d1=_0x7a54[_0x35e869];return _0x58a0d1;};'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 0e00d41..d7dc5dc 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x24f978,_0x2bf699){var _0x7a7347=function(_0x1a5e21){while(--_0x1a5e21){_0x24f978['push'](_0x24f978['shift']());}};_0x7a7347(++_0x2bf699);}(_0x3140,0xaf));var _0x0314=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x3140[_0xf9a6cf];return _0x59e2bc;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x2826ec,_0x2d6f03){var _0x5e0d29=function(_0x36d02e){while(--_0x36d02e){_0x2826ec['push'](_0x2826ec['shift']());}};_0x5e0d29(++_0x2d6f03);}(_0xb458,0x103));var _0x8b45=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0xb458[_0x89bddd];return _0x3a10e6;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 42a0d70..94b13f2 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 _0x30bb=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly','never','sequelize','exports','STRING','html','script'];(function(_0x3eff34,_0x2fa66e){var _0x4bc1be=function(_0x30b8b){while(--_0x30b8b){_0x3eff34['push'](_0x3eff34['shift']());}};_0x4bc1be(++_0x2fa66e);}(_0x30bb,0x175));var _0xb30b=function(_0x3da582,_0x27c58a){_0x3da582=_0x3da582-0x0;var _0x5d6ee1=_0x30bb[_0x3da582];return _0x5d6ee1;};'use strict';var Sequelize=require(_0xb30b('0x0'));module[_0xb30b('0x1')]={'name':{'type':Sequelize[_0xb30b('0x2')]},'type':{'type':Sequelize['ENUM'](_0xb30b('0x3'),_0xb30b('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0x5')},'active':{'type':Sequelize[_0xb30b('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xb30b('0x7'),'always',_0xb30b('0x8')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xb30b('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xb30b('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xb30b('0x2')]}}; \ No newline at end of file +var _0x77b7=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x77b7,0xc7));var _0x777b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x77b7[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x777b('0x0'));module[_0x777b('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x777b('0x2')]('html',_0x777b('0x3'))},'description':{'type':Sequelize[_0x777b('0x4')]},'version':{'type':Sequelize[_0x777b('0x4')]},'path':{'type':Sequelize[_0x777b('0x5')],'comment':_0x777b('0x6')},'active':{'type':Sequelize[_0x777b('0x7')],'defaultValue':0x0,'comment':_0x777b('0x8')},'sidebar':{'type':Sequelize[_0x777b('0x2')](_0x777b('0x9'),_0x777b('0xa'),_0x777b('0xb'),_0x777b('0xc')),'defaultValue':_0x777b('0xb'),'comment':_0x777b('0xd')},'icon':{'type':Sequelize[_0x777b('0x5')]},'adminUrl':{'type':Sequelize[_0x777b('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x777b('0x5')]},'scriptPath':{'type':Sequelize[_0x777b('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 07cb31c..0c8c8ac 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 _0x5307=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','json','undefined','offset','count','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','status','end','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','download','join','server/files/plugins','format','%s.zip','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','file','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-type','set','endsWith','statusCode','webhookPost','method','content-length','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x320d18,_0x7a06d9){var _0x18166f=function(_0x15c016){while(--_0x15c016){_0x320d18['push'](_0x320d18['shift']());}};_0x18166f(++_0x7a06d9);}(_0x5307,0x142));var _0x7530=function(_0x4b0bdd,_0x198b08){_0x4b0bdd=_0x4b0bdd-0x0;var _0x2293c9=_0x5307[_0x4b0bdd];return _0x2293c9;};'use strict';var emlformat=require(_0x7530('0x0'));var rimraf=require(_0x7530('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7530('0x2'));var rp=require(_0x7530('0x3'));var moment=require('moment');var BPromise=require(_0x7530('0x4'));var Mustache=require(_0x7530('0x5'));var util=require(_0x7530('0x6'));var path=require(_0x7530('0x7'));var sox=require(_0x7530('0x8'));var csv=require('to-csv');var ejs=require(_0x7530('0x9'));var fs=require('fs');var fs_extra=require(_0x7530('0xa'));var _=require(_0x7530('0xb'));var squel=require(_0x7530('0xc'));var crypto=require(_0x7530('0xd'));var jsforce=require(_0x7530('0xe'));var deskjs=require(_0x7530('0xf'));var toCsv=require(_0x7530('0x10'));var querystring=require(_0x7530('0x11'));var Papa=require(_0x7530('0x12'));var extract=require(_0x7530('0x13'));var rimraf=require(_0x7530('0x1'));var archiver=require(_0x7530('0x14'));var Redis=require(_0x7530('0x15'));var authService=require(_0x7530('0x16'));var qs=require(_0x7530('0x17'));var as=require(_0x7530('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7530('0x19'));var utils=require(_0x7530('0x1a'));var config=require(_0x7530('0x1b'));var licenseUtil=require(_0x7530('0x1c'));var db=require(_0x7530('0x1d'))['db'];config[_0x7530('0x1e')]=_['defaults'](config[_0x7530('0x1e')],{'host':_0x7530('0x1f'),'port':0x18eb});var socket=require(_0x7530('0x20'))(new Redis(config[_0x7530('0x1e')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x4ccdad,_0x513d15){_0x513d15=_0x513d15||0xcc;return function(_0x8c31f0){if(_0x8c31f0){return _0x4ccdad['sendStatus'](_0x513d15);}return _0x4ccdad['status'](_0x513d15)['end']();};}function respondWithResult(_0xfe8f7a,_0x399328){_0x399328=_0x399328||0xc8;return function(_0x478ad8){if(_0x478ad8){return _0xfe8f7a['status'](_0x399328)[_0x7530('0x21')](_0x478ad8);}};}function respondWithFilteredResult(_0x404eb4,_0x307235){return function(_0xedb9b5){if(_0xedb9b5){var _0x45b125=typeof _0x307235['offset']===_0x7530('0x22')&&typeof _0x307235['limit']==='undefined';var _0x4c00b6=_0xedb9b5['count'];var _0x5a4878=_0x45b125?0x0:_0x307235[_0x7530('0x23')];var _0x252aaf=_0x45b125?_0xedb9b5[_0x7530('0x24')]:_0x307235['offset']+_0x307235['limit'];var _0x4a2af2;if(_0x252aaf>=_0x4c00b6){_0x252aaf=_0x4c00b6;_0x4a2af2=0xc8;}else{_0x4a2af2=0xce;}_0x404eb4['status'](_0x4a2af2);return _0x404eb4['set'](_0x7530('0x25'),_0x5a4878+'-'+_0x252aaf+'/'+_0x4c00b6)[_0x7530('0x21')](_0xedb9b5);}return null;};}function patchUpdates(_0x30bc60){return function(_0x4d5cf9){try{jsonpatch[_0x7530('0x26')](_0x4d5cf9,_0x30bc60,!![]);}catch(_0x204887){return BPromise['reject'](_0x204887);}return _0x4d5cf9['save']();};}function saveUpdates(_0x2f40a5,_0x1d406a){return function(_0x3ce32c){if(_0x3ce32c){return _0x3ce32c[_0x7530('0x27')](_0x2f40a5)[_0x7530('0x28')](function(_0x1509dd){return _0x1509dd;});}return null;};}function removeEntity(_0xcfee59,_0x86321a){return function(_0x112665){if(_0x112665){return _0x112665[_0x7530('0x29')]()[_0x7530('0x28')](function(){var _0x4fae68=_0x112665[_0x7530('0x2a')]({'plain':!![]});var _0x5eda16=_0x7530('0x2b');return db[_0x7530('0x2c')][_0x7530('0x29')]({'where':{'type':_0x5eda16,'resourceId':_0x4fae68['id']}})[_0x7530('0x28')](function(){return _0x112665;});})[_0x7530('0x28')](function(){_0xcfee59[_0x7530('0x2d')](0xcc)[_0x7530('0x2e')]();});}};}function handleEntityNotFound(_0x2b797a,_0x7214e3){return function(_0x74c4da){if(!_0x74c4da){_0x2b797a[_0x7530('0x2f')](0x194);}return _0x74c4da;};}function handleError(_0x22824f,_0x3c46cc){_0x3c46cc=_0x3c46cc||0x1f4;return function(_0x1348d5){logger[_0x7530('0x30')](_0x1348d5[_0x7530('0x31')]);if(_0x1348d5[_0x7530('0x32')]){delete _0x1348d5['name'];}_0x22824f[_0x7530('0x2d')](_0x3c46cc)[_0x7530('0x33')](_0x1348d5);};}exports[_0x7530('0x34')]=function(_0x358cdc,_0x18e3e1){var _0x9189d3={},_0x50767a={},_0x12feec={'count':0x0,'rows':[]};var _0x24f61f=_['map'](db[_0x7530('0x35')][_0x7530('0x36')],function(_0x1e4037){return{'name':_0x1e4037[_0x7530('0x37')],'type':_0x1e4037[_0x7530('0x38')][_0x7530('0x39')]};});_0x50767a[_0x7530('0x3a')]=_['map'](_0x24f61f,_0x7530('0x32'));_0x50767a[_0x7530('0x3b')]=_[_0x7530('0x3c')](_0x358cdc[_0x7530('0x3b')]);_0x50767a['filters']=_[_0x7530('0x3d')](_0x50767a['model'],_0x50767a['query']);_0x9189d3['attributes']=_['intersection'](_0x50767a['model'],qs[_0x7530('0x3e')](_0x358cdc[_0x7530('0x3b')][_0x7530('0x3e')]));_0x9189d3[_0x7530('0x3f')]=_0x9189d3[_0x7530('0x3f')]['length']?_0x9189d3['attributes']:_0x50767a['model'];if(!_0x358cdc[_0x7530('0x3b')][_0x7530('0x40')]('nolimit')){_0x9189d3[_0x7530('0x41')]=qs[_0x7530('0x41')](_0x358cdc[_0x7530('0x3b')][_0x7530('0x41')]);_0x9189d3[_0x7530('0x23')]=qs[_0x7530('0x23')](_0x358cdc[_0x7530('0x3b')]['offset']);}_0x9189d3[_0x7530('0x42')]=qs[_0x7530('0x43')](_0x358cdc['query']['sort']);_0x9189d3[_0x7530('0x44')]=qs['filters'](_[_0x7530('0x45')](_0x358cdc[_0x7530('0x3b')],_0x50767a[_0x7530('0x46')]),_0x24f61f);if(_0x358cdc['query'][_0x7530('0x47')]){_0x9189d3[_0x7530('0x44')]=_[_0x7530('0x48')](_0x9189d3[_0x7530('0x44')],{'$or':_['map'](_0x24f61f,function(_0x145f76){if(_0x145f76[_0x7530('0x38')]!==_0x7530('0x49')){var _0x5d5548={};_0x5d5548[_0x145f76[_0x7530('0x32')]]={'$like':'%'+_0x358cdc['query'][_0x7530('0x47')]+'%'};return _0x5d5548;}})});}_0x9189d3=_['merge']({},_0x9189d3,_0x358cdc['options']);var _0x43cd13={'where':_0x9189d3['where']};return db[_0x7530('0x35')]['count'](_0x43cd13)[_0x7530('0x28')](function(_0x151760){_0x12feec[_0x7530('0x24')]=_0x151760;if(_0x358cdc['query'][_0x7530('0x4a')]){_0x9189d3[_0x7530('0x4b')]=[{'all':!![]}];}return db[_0x7530('0x35')][_0x7530('0x4c')](_0x9189d3);})['then'](function(_0xc16ad3){_0x12feec[_0x7530('0x4d')]=_0xc16ad3;return _0x12feec;})['then'](respondWithFilteredResult(_0x18e3e1,_0x9189d3))[_0x7530('0x4e')](handleError(_0x18e3e1,null));};exports[_0x7530('0x4f')]=function(_0x17d2d4,_0x41ec7b){var _0x5af210={'raw':!![],'where':{'id':_0x17d2d4[_0x7530('0x50')]['id']}},_0x3270fe={};_0x3270fe[_0x7530('0x3a')]=_['keys'](db['Plugin']['rawAttributes']);_0x3270fe[_0x7530('0x3b')]=_[_0x7530('0x3c')](_0x17d2d4[_0x7530('0x3b')]);_0x3270fe[_0x7530('0x46')]=_[_0x7530('0x3d')](_0x3270fe[_0x7530('0x3a')],_0x3270fe[_0x7530('0x3b')]);_0x5af210[_0x7530('0x3f')]=_['intersection'](_0x3270fe[_0x7530('0x3a')],qs[_0x7530('0x3e')](_0x17d2d4['query'][_0x7530('0x3e')]));_0x5af210['attributes']=_0x5af210['attributes'][_0x7530('0x51')]?_0x5af210[_0x7530('0x3f')]:_0x3270fe[_0x7530('0x3a')];if(_0x17d2d4[_0x7530('0x3b')][_0x7530('0x4a')]){_0x5af210[_0x7530('0x4b')]=[{'all':!![]}];}_0x5af210=_[_0x7530('0x48')]({},_0x5af210,_0x17d2d4[_0x7530('0x52')]);return db[_0x7530('0x35')][_0x7530('0x53')](_0x5af210)[_0x7530('0x28')](handleEntityNotFound(_0x41ec7b,null))['then'](respondWithResult(_0x41ec7b,null))['catch'](handleError(_0x41ec7b,null));};exports[_0x7530('0x54')]=function(_0x53e230,_0xff3a07,_0x19741f){return db[_0x7530('0x35')]['find']({'where':{'id':_0x53e230['params']['id']},'attributes':[_0x7530('0x32'),_0x7530('0x7')],'raw':!![]})[_0x7530('0x28')](handleEntityNotFound(_0xff3a07,null))['then'](function(_0x28e6ac){if(_0x28e6ac){var _0x1cce1f=path[_0x7530('0x55')](config['root'],_0x7530('0x56'),util[_0x7530('0x57')](_0x7530('0x58'),path['basename'](_0x28e6ac[_0x7530('0x7')])));var _0x178d23=fs['createWriteStream'](_0x1cce1f);var _0x4d994d=archiver(_0x7530('0x59'),{'zlib':{'level':0x9}});_0x4d994d['on'](_0x7530('0x5a'),function(_0x171a03){if(_0x171a03['code']===_0x7530('0x5b')){logger[_0x7530('0x30')](_0x171a03);}else{throw new db[(_0x7530('0x5c'))][(_0x7530('0x5d'))](_0x7530('0x5e'));}});_0x4d994d['on'](_0x7530('0x30'),function(_0xddabdf){throw new db[(_0x7530('0x5c'))][(_0x7530('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4d994d[_0x7530('0x5f')](_0x178d23);_0x4d994d[_0x7530('0x60')]('**/*',{'cwd':path[_0x7530('0x55')](config[_0x7530('0x61')],_0x7530('0x56'),path['dirname'](_0x28e6ac[_0x7530('0x7')])),'ignore':[path[_0x7530('0x55')](path['basename'](_0x28e6ac[_0x7530('0x7')]),_0x7530('0x62')),path[_0x7530('0x55')](path[_0x7530('0x63')](_0x28e6ac[_0x7530('0x7')]),_0x7530('0x64'))],'nodir':!![]})[_0x7530('0x65')]();_0x178d23['on'](_0x7530('0x66'),function(){if(!fs[_0x7530('0x67')](_0x1cce1f)){throw new db[(_0x7530('0x5c'))][(_0x7530('0x5d'))](_0x7530('0x68'));}return _0xff3a07[_0x7530('0x54')](_0x1cce1f,util['format'](_0x7530('0x58'),path['basename'](_0x28e6ac[_0x7530('0x7')])),function(_0x261eff){if(_0x261eff){throw new db[(_0x7530('0x5c'))][(_0x7530('0x5d'))](_0x7530('0x69'));}fs['unlinkSync'](_0x1cce1f);logger[_0x7530('0x6a')](_0x7530('0x6b'));logger[_0x7530('0x6a')]('Temporary\x20file\x20removed');});});}return null;})[_0x7530('0x4e')](handleError(_0xff3a07,null));};exports['upload']=function(_0x4acf7a,_0x2dba8c,_0x10345b){var _0x5d2aff=path[_0x7530('0x63')](_0x4acf7a[_0x7530('0x6c')]['filename'],path[_0x7530('0x6d')](_0x4acf7a[_0x7530('0x6c')]['filename']));var _0x40b23c=path[_0x7530('0x55')](config[_0x7530('0x61')],'server/files/plugins',_0x4acf7a['file']['filename']);var _0x374fe3=path[_0x7530('0x55')](config[_0x7530('0x61')],_0x7530('0x56'),_0x5d2aff);logger[_0x7530('0x6a')](_0x7530('0x6e'),_0x40b23c);logger[_0x7530('0x6a')](_0x7530('0x6f'),_0x374fe3);try{fs[_0x7530('0x70')](_0x40b23c,parseInt(_0x7530('0x71'),0x8));extract(_0x40b23c,{'dir':_0x374fe3},function(_0x3865d7){if(_0x3865d7){logger[_0x7530('0x30')](_0x3865d7);handleError(_0x3865d7,!![]);};var _0x1a1147=fs[_0x7530('0x72')](_0x374fe3);if(_0x1a1147['length']>0x1){removeReferences(_0x40b23c,_0x374fe3);logger[_0x7530('0x30')](_0x7530('0x73'));return _0x10345b(new Error('Invalid\x20plugin\x20structure'));}var _0x2c03e3=fs[_0x7530('0x74')](path[_0x7530('0x55')](_0x374fe3,_0x1a1147[0x0]));if(_0x2c03e3[_0x7530('0x75')]()){removeReferences(_0x40b23c,_0x374fe3);logger['error'](_0x7530('0x73'));return _0x10345b(new Error(_0x7530('0x73')));}if(_0x2c03e3['isDirectory']()){var _0x71d0bc=fs[_0x7530('0x72')](path[_0x7530('0x55')](_0x374fe3,_0x1a1147[0x0]));if(_0x71d0bc['length']===0x0){removeReferences(_0x40b23c,_0x374fe3);logger[_0x7530('0x30')](_0x7530('0x73'));return _0x10345b(new Error(_0x7530('0x73')));}var _0x4a3acd=_0x71d0bc[_0x7530('0x76')](function(_0x521f3f){return _0x521f3f==='manifest.json';});if(!_0x4a3acd){return _0x10345b(new Error(_0x7530('0x77')));}var _0x33ecae=fs['readFileSync'](path[_0x7530('0x55')](_0x374fe3,_0x1a1147[0x0],_0x7530('0x78')));var _0x4fe413=JSON[_0x7530('0x79')](_0x33ecae);if(_0x7530('0x22')==typeof _0x4fe413[_0x7530('0x32')]){return _0x10345b(new Error(_0x7530('0x7a')));}if(_0x7530('0x22')==typeof _0x4fe413[_0x7530('0x38')]){return _0x10345b(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4fe413[_0x7530('0x7b')]){return _0x10345b(new Error(_0x7530('0x7c')));}if(_0x7530('0x22')==typeof _0x4fe413['parameters']){return _0x10345b(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4fe413[_0x7530('0x38')]===_0x7530('0x7d')){if(_0x7530('0x22')==typeof _0x4fe413['parameters'][_0x7530('0x7e')]){return _0x10345b(new Error(_0x7530('0x7f')));}if(_0x7530('0x22')==typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x7e')]['admin']&&_0x7530('0x22')==typeof _0x4fe413['parameters'][_0x7530('0x7e')][_0x7530('0x81')]){return _0x10345b(new Error(_0x7530('0x82')));}}else if(_0x4fe413[_0x7530('0x38')]===_0x7530('0x83')){if(_0x7530('0x22')==typeof _0x4fe413[_0x7530('0x80')]['scriptName']){return _0x10345b(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x7530('0x22')==typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x84')]){return _0x10345b(new Error(_0x7530('0x85')));}}else{return _0x10345b(new Error(_0x7530('0x86')));}var _0x349889=_0x4fe413[_0x7530('0x32')];var _0x120080=_0x4fe413[_0x7530('0x87')];var _0x5ee016=_0x4fe413['type'];var _0x766415=_0x4fe413[_0x7530('0x88')]?_0x4fe413['sidebar']:_0x7530('0x89');var _0x543d54=_0x4fe413[_0x7530('0x8a')]?_0x4fe413[_0x7530('0x8a')]:_0x7530('0x8b');var _0x4841c7='';var _0xc5255a='';var _0x28a0b0='';var _0x36bd8c='';var _0x52ba45=_0x4fe413['version'];if(_0x5ee016==='html'){if(_0x7530('0x22')!=typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x8c')]){var _0x43629e=_0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x43629e)){_0x4841c7=path[_0x7530('0x55')](_0x7530('0x8d'),_0x5d2aff,_0x1a1147[0x0],_0x43629e);}else{_0x4841c7=_0x43629e;}}else{logger[_0x7530('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7530('0x22')!=typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x81')]){var _0xe3dc4a=_0x4fe413[_0x7530('0x80')]['views'][_0x7530('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x7530('0x8e')](_0xe3dc4a)){_0xc5255a=path[_0x7530('0x55')]('plugins',_0x5d2aff,_0x1a1147[0x0],_0xe3dc4a);}else{_0xc5255a=_0xe3dc4a;}}else{logger['info'](_0x7530('0x8f'));}}else if(_0x5ee016==='script'){_0x28a0b0=_0x4fe413[_0x7530('0x80')][_0x7530('0x90')];_0x36bd8c=_0x4fe413['parameters'][_0x7530('0x84')];if(_0x7530('0x22')!=typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x7e')]){if(_0x7530('0x22')!=typeof _0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x8c')]){var _0x43629e=_0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x7530('0x8e')](_0x43629e)){_0x4841c7=path['join']('plugins',_0x5d2aff,_0x1a1147[0x0],_0x43629e);}else{_0x4841c7=_0x43629e;}}if(_0x7530('0x22')!=typeof _0x4fe413[_0x7530('0x80')]['views'][_0x7530('0x81')]){var _0xe3dc4a=_0x4fe413[_0x7530('0x80')][_0x7530('0x7e')][_0x7530('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0xe3dc4a)){_0xc5255a=path[_0x7530('0x55')](_0x7530('0x8d'),_0x5d2aff,_0x1a1147[0x0],_0xe3dc4a);}else{_0xc5255a=_0xe3dc4a;}}}}var _0x156aed={'name':_0x349889,'description':_0x120080,'path':path[_0x7530('0x55')](_0x5d2aff,_0x1a1147[0x0]),'type':_0x5ee016,'sidebar':_0x766415,'icon':_0x543d54,'adminUrl':_0x4841c7,'agentUrl':_0xc5255a,'scriptName':_0x28a0b0,'scriptPath':_0x36bd8c,'version':_0x52ba45};removeReferences(_0x40b23c,null);return db[_0x7530('0x35')][_0x7530('0x91')](_0x156aed)[_0x7530('0x28')](function(_0xdee7eb){var _0x42bc19={'role':_0x4acf7a[_0x7530('0x92')][_0x7530('0x93')],'userProfileId':_0x4acf7a[_0x7530('0x92')][_0x7530('0x94')]};if(!_0x42bc19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42bc19[_0x7530('0x93')]===_0x7530('0x95')){var _0x2aef5b=_0xdee7eb[_0x7530('0x2a')]({'plain':!![]});return db[_0x7530('0x96')]['find']({'where':{'name':_0x7530('0x2b'),'userProfileId':_0x42bc19[_0x7530('0x94')]},'raw':!![]})[_0x7530('0x28')](function(_0x1fa779){if(_0x1fa779&&_0x1fa779['autoAssociation']===0x0){return db[_0x7530('0x2c')][_0x7530('0x91')]({'name':_0x2aef5b[_0x7530('0x32')],'resourceId':_0x2aef5b['id'],'type':_0x1fa779[_0x7530('0x32')],'sectionId':_0x1fa779['id']},{})[_0x7530('0x28')](function(){return _0xdee7eb;});}else{return _0xdee7eb;}})['catch'](function(_0x33f163){logger[_0x7530('0x30')](_0x7530('0x97'),_0x33f163);throw _0x33f163;});}return _0xdee7eb;})['then'](respondWithResult(_0x2dba8c,null))[_0x7530('0x4e')](handleError(_0x2dba8c,null));}});}catch(_0x1edca0){_0x2dba8c[_0x7530('0x2d')](0x1f4)[_0x7530('0x33')](_0x1edca0);}};function removeReferences(_0x5c33f7,_0x287158){try{if(_0x5c33f7){fs[_0x7530('0x98')](_0x5c33f7);logger['info'](_0x7530('0x99'));}if(_0x287158){rimraf(_0x287158,function(){});logger['info'](_0x7530('0x9a'));}}catch(_0x22d5e4){logger[_0x7530('0x30')](_0x22d5e4);}}exports['update']=function(_0x487c74,_0xfea78e,_0x5e4a91){return db[_0x7530('0x35')][_0x7530('0x53')]({'where':{'id':_0x487c74['params']['id']}})['then'](handleEntityNotFound(_0xfea78e,null))['then'](saveUpdates(_0x487c74[_0x7530('0x92')],null))[_0x7530('0x28')](respondWithResult(_0xfea78e,null))['catch'](handleError(_0xfea78e,null));};exports[_0x7530('0x9b')]=function(_0x149709,_0x5bf83b,_0x56ac61){return db[_0x7530('0x35')][_0x7530('0x53')]({'where':{'id':_0x149709[_0x7530('0x50')]['id']}})[_0x7530('0x28')](function(_0x141957){if(_0x141957){return _0x141957['destroy']();}})['then'](function(_0x473d84){rimraf(path[_0x7530('0x55')](config[_0x7530('0x61')],_0x7530('0x56'),path[_0x7530('0x9c')](_0x473d84['path'])),function(){});return _0x473d84;})[_0x7530('0x28')](handleEntityNotFound(_0x5bf83b,null))[_0x7530('0x28')](respondWithStatusCode(_0x5bf83b,null))[_0x7530('0x4e')](handleError(_0x5bf83b,null));};exports[_0x7530('0x9d')]=function(_0x2ab9ce,_0x2d792e,_0x234557){return BPromise[_0x7530('0x9e')]()[_0x7530('0x28')](function(){if(!_0x2ab9ce[_0x7530('0x3b')][_0x7530('0x7')]){throw new Error(_0x7530('0x9f'));}if(!_0x2ab9ce['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x24a2ad=_0x2ab9ce[_0x7530('0x3b')][_0x7530('0xa0')]?_0x2ab9ce['query'][_0x7530('0xa0')]+':'+_0x2ab9ce[_0x7530('0x3b')][_0x7530('0xa1')]:_0x7530('0xa2')+_0x2ab9ce[_0x7530('0x3b')][_0x7530('0xa1')];var _0x599117=_0x2ab9ce[_0x7530('0x3b')]['json']?_0x2ab9ce[_0x7530('0x3b')][_0x7530('0x21')]:!![];var _0x549a23=_0x2ab9ce['query'][_0x7530('0xa3')]?_0x2ab9ce[_0x7530('0x3b')][_0x7530('0xa3')]:null;var _0xc6e7ac={'method':_0x2ab9ce['method'],'uri':util[_0x7530('0x57')](_0x7530('0xa4'),_0x24a2ad,_0x2ab9ce[_0x7530('0x3b')][_0x7530('0x7')]),'json':_0x599117,'resolveWithFullResponse':!![],'encoding':_0x549a23,'qs':_0x2ab9ce[_0x7530('0x3b')]};if(_0x2ab9ce[_0x7530('0xa5')]){_0xc6e7ac[_0x7530('0xa5')]=_0x2ab9ce[_0x7530('0xa5')];if(_0xc6e7ac[_0x7530('0xa5')]['content-length']){delete _0xc6e7ac[_0x7530('0xa5')]['content-length'];}}if(_0xc6e7ac[_0x7530('0xa5')][_0x7530('0xa6')]){delete _0xc6e7ac[_0x7530('0xa5')][_0x7530('0xa6')];}return rp(_0xc6e7ac);})[_0x7530('0x28')](function(_0x357a79){if(_0x357a79){_0x2d792e[_0x7530('0xa7')](_0x357a79[_0x7530('0xa5')]);logger['info'](_0x357a79['body']);if(_[_0x7530('0xa8')](_0x2ab9ce[_0x7530('0x3b')][_0x7530('0x7')],'download')&&_0x357a79[_0x7530('0xa9')]==0x1f4){return _0x2d792e[_0x7530('0x2f')](_0x357a79['statusCode']);}else{return _0x2d792e[_0x7530('0x2d')](_0x357a79[_0x7530('0xa9')])[_0x7530('0x33')](_0x357a79['body']);}}else{return _0x2d792e[_0x7530('0x2f')](0xc8);}})[_0x7530('0x4e')](handleError(_0x2d792e,null));};exports[_0x7530('0xaa')]=function(_0x333741,_0x493946,_0x3a36ac){return BPromise[_0x7530('0x9e')]()[_0x7530('0x28')](function(){if(!_0x333741['query'][_0x7530('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x333741[_0x7530('0x3b')][_0x7530('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1a0138=_0x333741[_0x7530('0x3b')][_0x7530('0xa0')]?_0x333741[_0x7530('0x3b')]['hostname']+':'+_0x333741[_0x7530('0x3b')]['port']:_0x7530('0xa2')+_0x333741[_0x7530('0x3b')]['port'];var _0x3b43d6=_0x333741[_0x7530('0x3b')][_0x7530('0x21')]?_0x333741[_0x7530('0x3b')][_0x7530('0x21')]:!![];var _0x519437=_0x333741['query'][_0x7530('0xa3')]?_0x333741['query'][_0x7530('0xa3')]:null;var _0x47a945={'method':_0x333741[_0x7530('0xab')],'uri':util[_0x7530('0x57')]('%s%s',_0x1a0138,_0x333741['query'][_0x7530('0x7')]),'json':_0x3b43d6,'resolveWithFullResponse':!![],'encoding':_0x519437,'body':_0x333741[_0x7530('0x92')]};if(_0x333741[_0x7530('0xa5')]){_0x47a945[_0x7530('0xa5')]=_0x333741[_0x7530('0xa5')];if(_0x47a945[_0x7530('0xa5')]['content-length']){delete _0x47a945[_0x7530('0xa5')][_0x7530('0xac')];}}if(_0x47a945[_0x7530('0xa5')][_0x7530('0xa6')]){delete _0x47a945[_0x7530('0xa5')][_0x7530('0xa6')];}return rp(_0x47a945);})[_0x7530('0x28')](function(_0x2c9dec){if(_0x2c9dec){_0x493946[_0x7530('0xa7')](_0x2c9dec['headers']);logger[_0x7530('0x6a')](_0x2c9dec[_0x7530('0x92')]);return _0x493946[_0x7530('0x2d')](_0x2c9dec['statusCode'])['send'](_0x2c9dec[_0x7530('0x92')]);}else{return _0x493946[_0x7530('0x2f')](0xc8);}})[_0x7530('0x4e')](handleError(_0x493946,null));}; \ No newline at end of file +var _0x33d4=['user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','send','index','map','Plugin','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','rawAttributes','include','options','download','find','name','path','join','root','format','%s.zip','createWriteStream','zip','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','basename','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3e946a,_0x4abd2){var _0xad35f8=function(_0x5e2fda){while(--_0x5e2fda){_0x3e946a['push'](_0x3e946a['shift']());}};_0xad35f8(++_0x4abd2);}(_0x33d4,0xc3));var _0x433d=function(_0x478b35,_0x49dced){_0x478b35=_0x478b35-0x0;var _0x542c50=_0x33d4[_0x478b35];return _0x542c50;};'use strict';var emlformat=require(_0x433d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x433d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x433d('0x2'));var Mustache=require(_0x433d('0x3'));var util=require(_0x433d('0x4'));var path=require('path');var sox=require(_0x433d('0x5'));var csv=require(_0x433d('0x6'));var ejs=require(_0x433d('0x7'));var fs=require('fs');var fs_extra=require(_0x433d('0x8'));var _=require(_0x433d('0x9'));var squel=require('squel');var crypto=require(_0x433d('0xa'));var jsforce=require(_0x433d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x433d('0xc'));var Papa=require(_0x433d('0xd'));var extract=require(_0x433d('0xe'));var rimraf=require(_0x433d('0xf'));var archiver=require(_0x433d('0x10'));var Redis=require(_0x433d('0x11'));var authService=require(_0x433d('0x12'));var qs=require(_0x433d('0x13'));var as=require(_0x433d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x433d('0x15'));var config=require(_0x433d('0x16'));var licenseUtil=require(_0x433d('0x17'));var db=require('../../mysqldb')['db'];config[_0x433d('0x18')]=_[_0x433d('0x19')](config[_0x433d('0x18')],{'host':_0x433d('0x1a'),'port':0x18eb});var socket=require(_0x433d('0x1b'))(new Redis(config['redis']));require(_0x433d('0x1c'))[_0x433d('0x1d')](socket);function respondWithStatusCode(_0x179077,_0x83a1){_0x83a1=_0x83a1||0xcc;return function(_0x48af05){if(_0x48af05){return _0x179077[_0x433d('0x1e')](_0x83a1);}return _0x179077['status'](_0x83a1)[_0x433d('0x1f')]();};}function respondWithResult(_0x4119ca,_0x880729){_0x880729=_0x880729||0xc8;return function(_0x2fdee2){if(_0x2fdee2){return _0x4119ca[_0x433d('0x20')](_0x880729)[_0x433d('0x21')](_0x2fdee2);}};}function respondWithFilteredResult(_0x7c4f18,_0x5eba8c){return function(_0x2905d5){if(_0x2905d5){var _0x2f1c83=typeof _0x5eba8c[_0x433d('0x22')]===_0x433d('0x23')&&typeof _0x5eba8c[_0x433d('0x24')]===_0x433d('0x23');var _0xeea75f=_0x2905d5[_0x433d('0x25')];var _0x5f391d=_0x2f1c83?0x0:_0x5eba8c[_0x433d('0x22')];var _0x916e48=_0x2f1c83?_0x2905d5[_0x433d('0x25')]:_0x5eba8c[_0x433d('0x22')]+_0x5eba8c[_0x433d('0x24')];var _0x20cee8;if(_0x916e48>=_0xeea75f){_0x916e48=_0xeea75f;_0x20cee8=0xc8;}else{_0x20cee8=0xce;}_0x7c4f18[_0x433d('0x20')](_0x20cee8);return _0x7c4f18[_0x433d('0x26')]('Content-Range',_0x5f391d+'-'+_0x916e48+'/'+_0xeea75f)['json'](_0x2905d5);}return null;};}function patchUpdates(_0x57b472){return function(_0x3e63bc){try{jsonpatch['apply'](_0x3e63bc,_0x57b472,!![]);}catch(_0x3dbd0b){return BPromise[_0x433d('0x27')](_0x3dbd0b);}return _0x3e63bc[_0x433d('0x28')]();};}function saveUpdates(_0x3774b2,_0x5587f7){return function(_0x1a800d){if(_0x1a800d){return _0x1a800d[_0x433d('0x29')](_0x3774b2)['then'](function(_0x379b4b){return _0x379b4b;});}return null;};}function removeEntity(_0x59bff1,_0x57d38b){return function(_0x53f7e9){if(_0x53f7e9){return _0x53f7e9[_0x433d('0x2a')]()[_0x433d('0x2b')](function(){var _0x255712=_0x53f7e9[_0x433d('0x2c')]({'plain':!![]});var _0x170309=_0x433d('0x2d');return db[_0x433d('0x2e')][_0x433d('0x2a')]({'where':{'type':_0x170309,'resourceId':_0x255712['id']}})[_0x433d('0x2b')](function(){return _0x53f7e9;});})[_0x433d('0x2b')](function(){_0x59bff1[_0x433d('0x20')](0xcc)[_0x433d('0x1f')]();});}};}function handleEntityNotFound(_0x2ea89e,_0x369869){return function(_0x233578){if(!_0x233578){_0x2ea89e['sendStatus'](0x194);}return _0x233578;};}function handleError(_0x19b8c6,_0x3b50c7){_0x3b50c7=_0x3b50c7||0x1f4;return function(_0x2dc628){logger[_0x433d('0x2f')](_0x2dc628[_0x433d('0x30')]);if(_0x2dc628['name']){delete _0x2dc628['name'];}_0x19b8c6[_0x433d('0x20')](_0x3b50c7)[_0x433d('0x31')](_0x2dc628);};}exports[_0x433d('0x32')]=function(_0x35d698,_0x345efa){var _0x36df24={},_0x20a2b0={},_0x20c41b={'count':0x0,'rows':[]};var _0x397ebb=_[_0x433d('0x33')](db[_0x433d('0x34')]['rawAttributes'],function(_0x55bf5f){return{'name':_0x55bf5f[_0x433d('0x35')],'type':_0x55bf5f[_0x433d('0x36')][_0x433d('0x37')]};});_0x20a2b0[_0x433d('0x38')]=_['map'](_0x397ebb,'name');_0x20a2b0['query']=_[_0x433d('0x39')](_0x35d698[_0x433d('0x3a')]);_0x20a2b0[_0x433d('0x3b')]=_[_0x433d('0x3c')](_0x20a2b0[_0x433d('0x38')],_0x20a2b0[_0x433d('0x3a')]);_0x36df24[_0x433d('0x3d')]=_['intersection'](_0x20a2b0[_0x433d('0x38')],qs[_0x433d('0x3e')](_0x35d698[_0x433d('0x3a')][_0x433d('0x3e')]));_0x36df24[_0x433d('0x3d')]=_0x36df24[_0x433d('0x3d')][_0x433d('0x3f')]?_0x36df24[_0x433d('0x3d')]:_0x20a2b0['model'];if(!_0x35d698[_0x433d('0x3a')][_0x433d('0x40')](_0x433d('0x41'))){_0x36df24[_0x433d('0x24')]=qs[_0x433d('0x24')](_0x35d698['query'][_0x433d('0x24')]);_0x36df24[_0x433d('0x22')]=qs[_0x433d('0x22')](_0x35d698['query'][_0x433d('0x22')]);}_0x36df24['order']=qs['sort'](_0x35d698[_0x433d('0x3a')][_0x433d('0x42')]);_0x36df24[_0x433d('0x43')]=qs['filters'](_['pick'](_0x35d698[_0x433d('0x3a')],_0x20a2b0[_0x433d('0x3b')]),_0x397ebb);if(_0x35d698[_0x433d('0x3a')]['filter']){_0x36df24[_0x433d('0x43')]=_[_0x433d('0x44')](_0x36df24[_0x433d('0x43')],{'$or':_[_0x433d('0x33')](_0x397ebb,function(_0x1895c6){if(_0x1895c6['type']!==_0x433d('0x45')){var _0x459e33={};_0x459e33[_0x1895c6['name']]={'$like':'%'+_0x35d698[_0x433d('0x3a')][_0x433d('0x46')]+'%'};return _0x459e33;}})});}_0x36df24=_['merge']({},_0x36df24,_0x35d698['options']);var _0x41b208={'where':_0x36df24[_0x433d('0x43')]};return db[_0x433d('0x34')]['count'](_0x41b208)[_0x433d('0x2b')](function(_0x231422){_0x20c41b[_0x433d('0x25')]=_0x231422;if(_0x35d698[_0x433d('0x3a')][_0x433d('0x47')]){_0x36df24['include']=[{'all':!![]}];}return db[_0x433d('0x34')]['findAll'](_0x36df24);})[_0x433d('0x2b')](function(_0x4bcf9d){_0x20c41b[_0x433d('0x48')]=_0x4bcf9d;return _0x20c41b;})[_0x433d('0x2b')](respondWithFilteredResult(_0x345efa,_0x36df24))[_0x433d('0x49')](handleError(_0x345efa,null));};exports[_0x433d('0x4a')]=function(_0x41d55e,_0x3851a0){var _0x2bb5ab={'raw':!![],'where':{'id':_0x41d55e[_0x433d('0x4b')]['id']}},_0x35e04f={};_0x35e04f[_0x433d('0x38')]=_[_0x433d('0x39')](db[_0x433d('0x34')][_0x433d('0x4c')]);_0x35e04f[_0x433d('0x3a')]=_[_0x433d('0x39')](_0x41d55e[_0x433d('0x3a')]);_0x35e04f[_0x433d('0x3b')]=_[_0x433d('0x3c')](_0x35e04f[_0x433d('0x38')],_0x35e04f[_0x433d('0x3a')]);_0x2bb5ab[_0x433d('0x3d')]=_[_0x433d('0x3c')](_0x35e04f[_0x433d('0x38')],qs[_0x433d('0x3e')](_0x41d55e[_0x433d('0x3a')]['fields']));_0x2bb5ab[_0x433d('0x3d')]=_0x2bb5ab[_0x433d('0x3d')][_0x433d('0x3f')]?_0x2bb5ab[_0x433d('0x3d')]:_0x35e04f[_0x433d('0x38')];if(_0x41d55e['query'][_0x433d('0x47')]){_0x2bb5ab[_0x433d('0x4d')]=[{'all':!![]}];}_0x2bb5ab=_[_0x433d('0x44')]({},_0x2bb5ab,_0x41d55e[_0x433d('0x4e')]);return db['Plugin']['find'](_0x2bb5ab)['then'](handleEntityNotFound(_0x3851a0,null))[_0x433d('0x2b')](respondWithResult(_0x3851a0,null))[_0x433d('0x49')](handleError(_0x3851a0,null));};exports[_0x433d('0x4f')]=function(_0x1e0e40,_0x368c6b,_0x563215){return db[_0x433d('0x34')][_0x433d('0x50')]({'where':{'id':_0x1e0e40[_0x433d('0x4b')]['id']},'attributes':[_0x433d('0x51'),_0x433d('0x52')],'raw':!![]})[_0x433d('0x2b')](handleEntityNotFound(_0x368c6b,null))[_0x433d('0x2b')](function(_0x1b9509){if(_0x1b9509){var _0x10ccc4=path[_0x433d('0x53')](config[_0x433d('0x54')],'server/files/plugins',util[_0x433d('0x55')](_0x433d('0x56'),path['basename'](_0x1b9509[_0x433d('0x52')])));var _0x426cd9=fs[_0x433d('0x57')](_0x10ccc4);var _0x2dbfe5=archiver(_0x433d('0x58'),{'zlib':{'level':0x9}});_0x2dbfe5['on']('warning',function(_0x141bf8){if(_0x141bf8['code']===_0x433d('0x59')){logger[_0x433d('0x2f')](_0x141bf8);}else{throw new db[(_0x433d('0x5a'))][(_0x433d('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x2dbfe5['on']('error',function(_0x4f9b17){throw new db[(_0x433d('0x5a'))]['Error'](_0x433d('0x5c'));});_0x2dbfe5[_0x433d('0x5d')](_0x426cd9);_0x2dbfe5[_0x433d('0x5e')](_0x433d('0x5f'),{'cwd':path['join'](config[_0x433d('0x54')],_0x433d('0x60'),path[_0x433d('0x61')](_0x1b9509[_0x433d('0x52')])),'ignore':[path[_0x433d('0x53')](path[_0x433d('0x62')](_0x1b9509[_0x433d('0x52')]),'node_modules/**/*'),path[_0x433d('0x53')](path[_0x433d('0x62')](_0x1b9509['path']),_0x433d('0x63'))],'nodir':!![]})[_0x433d('0x64')]();_0x426cd9['on'](_0x433d('0x65'),function(){if(!fs['existsSync'](_0x10ccc4)){throw new db['Sequelize'][(_0x433d('0x5b'))](_0x433d('0x66'));}return _0x368c6b['download'](_0x10ccc4,util[_0x433d('0x55')](_0x433d('0x56'),path[_0x433d('0x62')](_0x1b9509[_0x433d('0x52')])),function(_0x40add6){if(_0x40add6){throw new db[(_0x433d('0x5a'))][(_0x433d('0x5b'))](_0x433d('0x67'));}fs[_0x433d('0x68')](_0x10ccc4);logger[_0x433d('0x69')](_0x433d('0x6a'));logger['info'](_0x433d('0x6b'));});});}return null;})[_0x433d('0x49')](handleError(_0x368c6b,null));};exports[_0x433d('0x6c')]=function(_0x5d1e7e,_0x3505a1,_0x514d41){var _0x833a76=path[_0x433d('0x62')](_0x5d1e7e['file'][_0x433d('0x6d')],path[_0x433d('0x6e')](_0x5d1e7e[_0x433d('0x6f')][_0x433d('0x6d')]));var _0x44d096=path[_0x433d('0x53')](config[_0x433d('0x54')],_0x433d('0x60'),_0x5d1e7e[_0x433d('0x6f')][_0x433d('0x6d')]);var _0x48f31a=path['join'](config[_0x433d('0x54')],_0x433d('0x60'),_0x833a76);logger[_0x433d('0x69')](_0x433d('0x70'),_0x44d096);logger[_0x433d('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x48f31a);try{fs[_0x433d('0x71')](_0x44d096,parseInt('0777',0x8));extract(_0x44d096,{'dir':_0x48f31a},function(_0x9e9a18){if(_0x9e9a18){logger[_0x433d('0x2f')](_0x9e9a18);handleError(_0x9e9a18,!![]);};var _0x5d5fd1=fs[_0x433d('0x72')](_0x48f31a);if(_0x5d5fd1['length']>0x1){removeReferences(_0x44d096,_0x48f31a);logger[_0x433d('0x2f')](_0x433d('0x73'));return _0x514d41(new Error(_0x433d('0x73')));}var _0x536bdc=fs[_0x433d('0x74')](path[_0x433d('0x53')](_0x48f31a,_0x5d5fd1[0x0]));if(_0x536bdc[_0x433d('0x75')]()){removeReferences(_0x44d096,_0x48f31a);logger[_0x433d('0x2f')](_0x433d('0x73'));return _0x514d41(new Error(_0x433d('0x73')));}if(_0x536bdc[_0x433d('0x76')]()){var _0x2d3c0f=fs[_0x433d('0x72')](path[_0x433d('0x53')](_0x48f31a,_0x5d5fd1[0x0]));if(_0x2d3c0f[_0x433d('0x3f')]===0x0){removeReferences(_0x44d096,_0x48f31a);logger[_0x433d('0x2f')](_0x433d('0x73'));return _0x514d41(new Error(_0x433d('0x73')));}var _0x3264c1=_0x2d3c0f[_0x433d('0x77')](function(_0x461ff2){return _0x461ff2===_0x433d('0x78');});if(!_0x3264c1){return _0x514d41(new Error(_0x433d('0x79')));}var _0x52883b=fs['readFileSync'](path[_0x433d('0x53')](_0x48f31a,_0x5d5fd1[0x0],_0x433d('0x78')));var _0x3f720e=JSON[_0x433d('0x7a')](_0x52883b);if(_0x433d('0x23')==typeof _0x3f720e[_0x433d('0x51')]){return _0x514d41(new Error(_0x433d('0x7b')));}if(_0x433d('0x23')==typeof _0x3f720e['type']){return _0x514d41(new Error(_0x433d('0x7c')));}if('undefined'==typeof _0x3f720e[_0x433d('0x7d')]){return _0x514d41(new Error(_0x433d('0x7e')));}if(_0x433d('0x23')==typeof _0x3f720e[_0x433d('0x7f')]){return _0x514d41(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3f720e[_0x433d('0x36')]===_0x433d('0x80')){if('undefined'==typeof _0x3f720e['parameters'][_0x433d('0x81')]){return _0x514d41(new Error(_0x433d('0x82')));}if(_0x433d('0x23')==typeof _0x3f720e[_0x433d('0x7f')][_0x433d('0x81')][_0x433d('0x83')]&&'undefined'==typeof _0x3f720e[_0x433d('0x7f')][_0x433d('0x81')][_0x433d('0x84')]){return _0x514d41(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3f720e['type']===_0x433d('0x85')){if('undefined'==typeof _0x3f720e[_0x433d('0x7f')][_0x433d('0x86')]){return _0x514d41(new Error(_0x433d('0x87')));}if(_0x433d('0x23')==typeof _0x3f720e[_0x433d('0x7f')][_0x433d('0x88')]){return _0x514d41(new Error(_0x433d('0x89')));}}else{return _0x514d41(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4e0813=_0x3f720e[_0x433d('0x51')];var _0x583996=_0x3f720e[_0x433d('0x8a')];var _0x18fa5e=_0x3f720e[_0x433d('0x36')];var _0x5f1277=_0x3f720e[_0x433d('0x8b')]?_0x3f720e[_0x433d('0x8b')]:_0x433d('0x8c');var _0x522587=_0x3f720e[_0x433d('0x8d')]?_0x3f720e[_0x433d('0x8d')]:_0x433d('0x8e');var _0x274e82='';var _0x207358='';var _0x4f93f2='';var _0x25d5e8='';var _0x198f31=_0x3f720e[_0x433d('0x7d')];if(_0x18fa5e===_0x433d('0x80')){if(_0x433d('0x23')!=typeof _0x3f720e['parameters']['views'][_0x433d('0x83')]){var _0x13cb2c=_0x3f720e[_0x433d('0x7f')][_0x433d('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x433d('0x8f')](_0x13cb2c)){_0x274e82=path[_0x433d('0x53')](_0x433d('0x90'),_0x833a76,_0x5d5fd1[0x0],_0x13cb2c);}else{_0x274e82=_0x13cb2c;}}else{logger[_0x433d('0x69')](_0x433d('0x91'));}if(_0x433d('0x23')!=typeof _0x3f720e[_0x433d('0x7f')][_0x433d('0x81')][_0x433d('0x84')]){var _0x349fcd=_0x3f720e['parameters']['views'][_0x433d('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x433d('0x8f')](_0x349fcd)){_0x207358=path[_0x433d('0x53')](_0x433d('0x90'),_0x833a76,_0x5d5fd1[0x0],_0x349fcd);}else{_0x207358=_0x349fcd;}}else{logger[_0x433d('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x18fa5e===_0x433d('0x85')){_0x4f93f2=_0x3f720e['parameters']['scriptName'];_0x25d5e8=_0x3f720e[_0x433d('0x7f')]['scriptPath'];if(_0x433d('0x23')!=typeof _0x3f720e[_0x433d('0x7f')]['views']){if(_0x433d('0x23')!=typeof _0x3f720e['parameters']['views'][_0x433d('0x83')]){var _0x13cb2c=_0x3f720e[_0x433d('0x7f')][_0x433d('0x81')][_0x433d('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x433d('0x8f')](_0x13cb2c)){_0x274e82=path[_0x433d('0x53')](_0x433d('0x90'),_0x833a76,_0x5d5fd1[0x0],_0x13cb2c);}else{_0x274e82=_0x13cb2c;}}if(_0x433d('0x23')!=typeof _0x3f720e['parameters']['views'][_0x433d('0x84')]){var _0x349fcd=_0x3f720e[_0x433d('0x7f')][_0x433d('0x81')][_0x433d('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x433d('0x8f')](_0x349fcd)){_0x207358=path[_0x433d('0x53')](_0x433d('0x90'),_0x833a76,_0x5d5fd1[0x0],_0x349fcd);}else{_0x207358=_0x349fcd;}}}}var _0x44d7d2={'name':_0x4e0813,'description':_0x583996,'path':path[_0x433d('0x53')](_0x833a76,_0x5d5fd1[0x0]),'type':_0x18fa5e,'sidebar':_0x5f1277,'icon':_0x522587,'adminUrl':_0x274e82,'agentUrl':_0x207358,'scriptName':_0x4f93f2,'scriptPath':_0x25d5e8,'version':_0x198f31};removeReferences(_0x44d096,null);return db[_0x433d('0x34')][_0x433d('0x92')](_0x44d7d2)[_0x433d('0x2b')](function(_0x38eec9){var _0x112bd6={'role':_0x5d1e7e[_0x433d('0x93')][_0x433d('0x94')],'userProfileId':_0x5d1e7e[_0x433d('0x93')][_0x433d('0x95')]};if(!_0x112bd6)throw new Error(_0x433d('0x96'));if(_0x112bd6[_0x433d('0x94')]===_0x433d('0x97')){var _0x2d45cb=_0x38eec9[_0x433d('0x2c')]({'plain':!![]});return db[_0x433d('0x98')]['find']({'where':{'name':_0x433d('0x2d'),'userProfileId':_0x112bd6[_0x433d('0x95')]},'raw':!![]})['then'](function(_0x1d5d57){if(_0x1d5d57&&_0x1d5d57['autoAssociation']===0x0){return db[_0x433d('0x2e')][_0x433d('0x92')]({'name':_0x2d45cb['name'],'resourceId':_0x2d45cb['id'],'type':_0x1d5d57['name'],'sectionId':_0x1d5d57['id']},{})[_0x433d('0x2b')](function(){return _0x38eec9;});}else{return _0x38eec9;}})['catch'](function(_0x5dc26f){logger[_0x433d('0x2f')](_0x433d('0x99'),_0x5dc26f);throw _0x5dc26f;});}return _0x38eec9;})['then'](respondWithResult(_0x3505a1,null))[_0x433d('0x49')](handleError(_0x3505a1,null));}});}catch(_0x4220b0){_0x3505a1[_0x433d('0x20')](0x1f4)[_0x433d('0x31')](_0x4220b0);}};function removeReferences(_0x372d58,_0x2e021a){try{if(_0x372d58){fs['unlinkSync'](_0x372d58);logger[_0x433d('0x69')](_0x433d('0x9a'));}if(_0x2e021a){rimraf(_0x2e021a,function(){});logger[_0x433d('0x69')](_0x433d('0x9b'));}}catch(_0x5328b5){logger[_0x433d('0x2f')](_0x5328b5);}}exports['update']=function(_0x2c1c87,_0x42de5a,_0x3eb64d){return db[_0x433d('0x34')][_0x433d('0x50')]({'where':{'id':_0x2c1c87['params']['id']}})[_0x433d('0x2b')](handleEntityNotFound(_0x42de5a,null))['then'](saveUpdates(_0x2c1c87[_0x433d('0x93')],null))['then'](respondWithResult(_0x42de5a,null))[_0x433d('0x49')](handleError(_0x42de5a,null));};exports[_0x433d('0x9c')]=function(_0x35d292,_0x284bb0,_0x5489d6){return db[_0x433d('0x34')][_0x433d('0x50')]({'where':{'id':_0x35d292[_0x433d('0x4b')]['id']}})['then'](function(_0x380eb9){if(_0x380eb9){return _0x380eb9['destroy']();}})[_0x433d('0x2b')](function(_0x24f35c){rimraf(path[_0x433d('0x53')](config[_0x433d('0x54')],_0x433d('0x60'),path[_0x433d('0x61')](_0x24f35c[_0x433d('0x52')])),function(){});return _0x24f35c;})['then'](handleEntityNotFound(_0x284bb0,null))[_0x433d('0x2b')](respondWithStatusCode(_0x284bb0,null))[_0x433d('0x49')](handleError(_0x284bb0,null));};exports[_0x433d('0x9d')]=function(_0x808674,_0x15dde8,_0x554dd5){return BPromise[_0x433d('0x9e')]()[_0x433d('0x2b')](function(){if(!_0x808674[_0x433d('0x3a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x808674[_0x433d('0x3a')][_0x433d('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x21c09c=_0x808674['query']['hostname']?_0x808674[_0x433d('0x3a')][_0x433d('0xa0')]+':'+_0x808674[_0x433d('0x3a')][_0x433d('0x9f')]:_0x433d('0xa1')+_0x808674[_0x433d('0x3a')][_0x433d('0x9f')];var _0x536f52=_0x808674[_0x433d('0x3a')][_0x433d('0x21')]?_0x808674[_0x433d('0x3a')][_0x433d('0x21')]:!![];var _0x39f17a=_0x808674[_0x433d('0x3a')][_0x433d('0xa2')]?_0x808674['query']['encoding']:null;var _0x2efe43={'method':_0x808674['method'],'uri':util[_0x433d('0x55')](_0x433d('0xa3'),_0x21c09c,_0x808674[_0x433d('0x3a')][_0x433d('0x52')]),'json':_0x536f52,'resolveWithFullResponse':!![],'encoding':_0x39f17a,'qs':_0x808674['query']};if(_0x808674[_0x433d('0xa4')]){_0x2efe43['headers']=_0x808674[_0x433d('0xa4')];if(_0x2efe43[_0x433d('0xa4')]['content-length']){delete _0x2efe43[_0x433d('0xa4')][_0x433d('0xa5')];}}if(_0x2efe43[_0x433d('0xa4')][_0x433d('0xa6')]){delete _0x2efe43['headers'][_0x433d('0xa6')];}return rp(_0x2efe43);})[_0x433d('0x2b')](function(_0x792cb6){if(_0x792cb6){_0x15dde8[_0x433d('0x26')](_0x792cb6['headers']);logger[_0x433d('0x69')](_0x792cb6[_0x433d('0x93')]);if(_[_0x433d('0xa7')](_0x808674['query']['path'],'download')&&_0x792cb6[_0x433d('0xa8')]==0x1f4){return _0x15dde8['sendStatus'](_0x792cb6['statusCode']);}else{return _0x15dde8['status'](_0x792cb6[_0x433d('0xa8')])[_0x433d('0x31')](_0x792cb6[_0x433d('0x93')]);}}else{return _0x15dde8[_0x433d('0x1e')](0xc8);}})[_0x433d('0x49')](handleError(_0x15dde8,null));};exports[_0x433d('0xa9')]=function(_0x417552,_0x215a82,_0x52d066){return BPromise['resolve']()[_0x433d('0x2b')](function(){if(!_0x417552[_0x433d('0x3a')]['path']){throw new Error(_0x433d('0xaa'));}if(!_0x417552[_0x433d('0x3a')][_0x433d('0x9f')]){throw new Error(_0x433d('0xab'));}var _0x1bd185=_0x417552['query']['hostname']?_0x417552['query']['hostname']+':'+_0x417552[_0x433d('0x3a')][_0x433d('0x9f')]:_0x433d('0xa1')+_0x417552['query']['port'];var _0xbd72c0=_0x417552[_0x433d('0x3a')][_0x433d('0x21')]?_0x417552['query'][_0x433d('0x21')]:!![];var _0x24dd32=_0x417552[_0x433d('0x3a')][_0x433d('0xa2')]?_0x417552[_0x433d('0x3a')][_0x433d('0xa2')]:null;var _0x200ed9={'method':_0x417552[_0x433d('0xac')],'uri':util[_0x433d('0x55')](_0x433d('0xa3'),_0x1bd185,_0x417552[_0x433d('0x3a')][_0x433d('0x52')]),'json':_0xbd72c0,'resolveWithFullResponse':!![],'encoding':_0x24dd32,'body':_0x417552[_0x433d('0x93')]};if(_0x417552['headers']){_0x200ed9[_0x433d('0xa4')]=_0x417552[_0x433d('0xa4')];if(_0x200ed9[_0x433d('0xa4')][_0x433d('0xa5')]){delete _0x200ed9[_0x433d('0xa4')][_0x433d('0xa5')];}}if(_0x200ed9['headers'][_0x433d('0xa6')]){delete _0x200ed9[_0x433d('0xa4')][_0x433d('0xa6')];}return rp(_0x200ed9);})[_0x433d('0x2b')](function(_0x2e0bf8){if(_0x2e0bf8){_0x215a82[_0x433d('0x26')](_0x2e0bf8[_0x433d('0xa4')]);logger[_0x433d('0x69')](_0x2e0bf8[_0x433d('0x93')]);return _0x215a82['status'](_0x2e0bf8[_0x433d('0xa8')])['send'](_0x2e0bf8[_0x433d('0x93')]);}else{return _0x215a82['sendStatus'](0xc8);}})[_0x433d('0x49')](handleError(_0x215a82,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6b9710d..d8acf42 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 _0x0fcd=['hasOwnProperty','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x1ebb58,_0x528d96){var _0x952d5a=function(_0x10f80f){while(--_0x10f80f){_0x1ebb58['push'](_0x1ebb58['shift']());}};_0x952d5a(++_0x528d96);}(_0x0fcd,0x129));var _0xd0fc=function(_0x1aed5f,_0x53b700){_0x1aed5f=_0x1aed5f-0x0;var _0x58c7f4=_0x0fcd[_0x1aed5f];return _0x58c7f4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xd0fc('0x0'))['db'][_0xd0fc('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xd0fc('0x2')](0x0);var events={'afterCreate':_0xd0fc('0x3'),'afterUpdate':_0xd0fc('0x4'),'afterDestroy':_0xd0fc('0x5')};function emitEvent(_0x48a182){return function(_0x46c92d,_0x3552fc,_0x156c95){PluginEvents[_0xd0fc('0x6')](_0x48a182+':'+_0x46c92d['id'],_0x46c92d);PluginEvents['emit'](_0x48a182,_0x46c92d);_0x156c95(null);};}for(var e in events){if(events[_0xd0fc('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x9bb8=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x871557,_0x21ae05){var _0x24345c=function(_0x364d8f){while(--_0x364d8f){_0x871557['push'](_0x871557['shift']());}};_0x24345c(++_0x21ae05);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x89bb('0x0'));var Plugin=require(_0x89bb('0x1'))['db'][_0x89bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x89bb('0x3')](0x0);var events={'afterCreate':_0x89bb('0x4'),'afterUpdate':_0x89bb('0x5'),'afterDestroy':_0x89bb('0x6')};function emitEvent(_0x1af2d3){return function(_0xaa37b7,_0x26ecc2,_0x436902){PluginEvents[_0x89bb('0x7')](_0x1af2d3+':'+_0xaa37b7['id'],_0xaa37b7);PluginEvents['emit'](_0x1af2d3,_0xaa37b7);_0x436902(null);};}for(var e in events){if(events[_0x89bb('0x8')](e)){var event=events[e];Plugin[_0x89bb('0x9')](e,emitEvent(event));}}module[_0x89bb('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9bc4f93..7c38f6c 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 _0xe389=['moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','api'];(function(_0x908eeb,_0x3f6f7e){var _0x3d81a2=function(_0x255fde){while(--_0x255fde){_0x908eeb['push'](_0x908eeb['shift']());}};_0x3d81a2(++_0x3f6f7e);}(_0xe389,0x1b9));var _0x9e38=function(_0x17c584,_0x8cbc27){_0x17c584=_0x17c584-0x0;var _0x252b93=_0xe389[_0x17c584];return _0x252b93;};'use strict';var _=require(_0x9e38('0x0'));var util=require(_0x9e38('0x1'));var logger=require('../../config/logger')(_0x9e38('0x2'));var moment=require(_0x9e38('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e38('0x4'));var fs=require('fs');var path=require(_0x9e38('0x5'));var rimraf=require(_0x9e38('0x6'));var config=require(_0x9e38('0x7'));var attributes=require(_0x9e38('0x8'));module['exports']=function(_0x2d9744,_0x3c2a7f){return _0x2d9744[_0x9e38('0x9')](_0x9e38('0xa'),attributes,{'tableName':_0x9e38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03c=['Plugin','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x481064,_0x55554d){var _0x7ad1a6=function(_0x23152b){while(--_0x23152b){_0x481064['push'](_0x481064['shift']());}};_0x7ad1a6(++_0x55554d);}(_0xf03c,0x199));var _0xcf03=function(_0x25fda3,_0x3e6be0){_0x25fda3=_0x25fda3-0x0;var _0x4eb9ae=_0xf03c[_0x25fda3];return _0x4eb9ae;};'use strict';var _=require(_0xcf03('0x0'));var util=require(_0xcf03('0x1'));var logger=require(_0xcf03('0x2'))('api');var moment=require(_0xcf03('0x3'));var BPromise=require(_0xcf03('0x4'));var rp=require(_0xcf03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf03('0x6'));var config=require(_0xcf03('0x7'));var attributes=require(_0xcf03('0x8'));module[_0xcf03('0x9')]=function(_0x367a9a,_0x46348d){return _0x367a9a[_0xcf03('0xa')](_0xcf03('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index d453cc8..b3e1b03 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 _0xf5b9=['defaults','localhost','socket.io-emitter','./plugin.socket','info','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','debug','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','redis'];(function(_0x1bfc06,_0x21dbb5){var _0x193d62=function(_0x182445){while(--_0x182445){_0x1bfc06['push'](_0x1bfc06['shift']());}};_0x193d62(++_0x21dbb5);}(_0xf5b9,0xf4));var _0x9f5b=function(_0x3c7b2c,_0x10f46a){_0x3c7b2c=_0x3c7b2c-0x0;var _0x405105=_0xf5b9[_0x3c7b2c];return _0x405105;};'use strict';var _=require(_0x9f5b('0x0'));var util=require('util');var moment=require(_0x9f5b('0x1'));var BPromise=require(_0x9f5b('0x2'));var rs=require(_0x9f5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f5b('0x4'))(_0x9f5b('0x5'));var config=require('../../config/environment');var jayson=require(_0x9f5b('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x9f5b('0x7')]=_[_0x9f5b('0x8')](config[_0x9f5b('0x7')],{'host':_0x9f5b('0x9'),'port':0x18eb});var socket=require(_0x9f5b('0xa'))(new Redis(config[_0x9f5b('0x7')]));require(_0x9f5b('0xb'))['register'](socket);function respondWithRpcPromise(_0x3022b2,_0x1b57f9,_0x33d7e8){return new BPromise(function(_0x5427c5,_0x325539){return client['request'](_0x3022b2,_0x33d7e8)['then'](function(_0x52afac){logger[_0x9f5b('0xc')]('Plugin,\x20%s,\x20%s',_0x1b57f9,'request\x20sent');logger['debug'](_0x9f5b('0xd'),_0x1b57f9,'request\x20sent',JSON[_0x9f5b('0xe')](_0x52afac));if(_0x52afac[_0x9f5b('0xf')]){if(_0x52afac[_0x9f5b('0xf')]['code']===0x1f4){logger[_0x9f5b('0xf')](_0x9f5b('0x10'),_0x1b57f9,_0x52afac[_0x9f5b('0xf')][_0x9f5b('0x11')]);return _0x325539(_0x52afac[_0x9f5b('0xf')][_0x9f5b('0x11')]);}logger['error'](_0x9f5b('0x10'),_0x1b57f9,_0x52afac[_0x9f5b('0xf')][_0x9f5b('0x11')]);return _0x5427c5(_0x52afac[_0x9f5b('0xf')][_0x9f5b('0x11')]);}else{logger[_0x9f5b('0xc')](_0x9f5b('0x10'),_0x1b57f9,'request\x20sent');_0x5427c5(_0x52afac[_0x9f5b('0x12')][_0x9f5b('0x11')]);}})[_0x9f5b('0x13')](function(_0x9d74c0){logger[_0x9f5b('0xf')](_0x9f5b('0x10'),_0x1b57f9,_0x9d74c0);_0x325539(_0x9d74c0);});});}exports[_0x9f5b('0x14')]=function(_0x45959e){var _0x3e3a08=this;return new Promise(function(_0x13365e,_0x14814b){return db[_0x9f5b('0x15')][_0x9f5b('0x16')](_0x45959e[_0x9f5b('0x17')],{'raw':_0x45959e[_0x9f5b('0x18')]?_0x45959e[_0x9f5b('0x18')][_0x9f5b('0x19')]===undefined?!![]:![]:!![]})[_0x9f5b('0x1a')](function(_0x47a8dd){logger[_0x9f5b('0xc')](_0x9f5b('0x14'),_0x45959e);logger[_0x9f5b('0x1b')](_0x9f5b('0x14'),_0x45959e,JSON[_0x9f5b('0xe')](_0x47a8dd));_0x13365e(_0x47a8dd);})['catch'](function(_0x5ce919){logger[_0x9f5b('0xf')](_0x9f5b('0x14'),_0x5ce919['message'],_0x45959e);_0x14814b(_0x3e3a08['error'](0x1f4,_0x5ce919[_0x9f5b('0x11')]));});});}; \ No newline at end of file +var _0xc175=['message','info','result','CreatePlugin','Plugin','create','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s'];(function(_0x4c0791,_0x431068){var _0x3f2af1=function(_0x6a5769){while(--_0x6a5769){_0x4c0791['push'](_0x4c0791['shift']());}};_0x3f2af1(++_0x431068);}(_0xc175,0x196));var _0x5c17=function(_0x240efe,_0x57e522){_0x240efe=_0x240efe-0x0;var _0x47e91a=_0xc175[_0x240efe];return _0x47e91a;};'use strict';var _=require(_0x5c17('0x0'));var util=require(_0x5c17('0x1'));var moment=require(_0x5c17('0x2'));var BPromise=require(_0x5c17('0x3'));var rs=require(_0x5c17('0x4'));var fs=require('fs');var Redis=require(_0x5c17('0x5'));var db=require(_0x5c17('0x6'))['db'];var utils=require(_0x5c17('0x7'));var logger=require(_0x5c17('0x8'))(_0x5c17('0x9'));var config=require(_0x5c17('0xa'));var jayson=require(_0x5c17('0xb'));var client=jayson[_0x5c17('0xc')]['http']({'port':0x232a});config[_0x5c17('0xd')]=_[_0x5c17('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5c17('0xf'))(new Redis(config[_0x5c17('0xd')]));require(_0x5c17('0x10'))[_0x5c17('0x11')](socket);function respondWithRpcPromise(_0x3b7468,_0xefec9c,_0x192aa8){return new BPromise(function(_0x23fd0a,_0xba80){return client[_0x5c17('0x12')](_0x3b7468,_0x192aa8)[_0x5c17('0x13')](function(_0x22cd63){logger['info']('Plugin,\x20%s,\x20%s',_0xefec9c,_0x5c17('0x14'));logger[_0x5c17('0x15')](_0x5c17('0x16'),_0xefec9c,_0x5c17('0x14'),JSON['stringify'](_0x22cd63));if(_0x22cd63[_0x5c17('0x17')]){if(_0x22cd63[_0x5c17('0x17')][_0x5c17('0x18')]===0x1f4){logger[_0x5c17('0x17')](_0x5c17('0x19'),_0xefec9c,_0x22cd63[_0x5c17('0x17')]['message']);return _0xba80(_0x22cd63['error'][_0x5c17('0x1a')]);}logger[_0x5c17('0x17')]('Plugin,\x20%s,\x20%s',_0xefec9c,_0x22cd63['error'][_0x5c17('0x1a')]);return _0x23fd0a(_0x22cd63['error'][_0x5c17('0x1a')]);}else{logger[_0x5c17('0x1b')](_0x5c17('0x19'),_0xefec9c,_0x5c17('0x14'));_0x23fd0a(_0x22cd63[_0x5c17('0x1c')]['message']);}})['catch'](function(_0x3e1552){logger[_0x5c17('0x17')](_0x5c17('0x19'),_0xefec9c,_0x3e1552);_0xba80(_0x3e1552);});});}exports[_0x5c17('0x1d')]=function(_0x590f9b){var _0x1c61c7=this;return new Promise(function(_0x3f244f,_0x38db52){return db[_0x5c17('0x1e')][_0x5c17('0x1f')](_0x590f9b['body'],{'raw':_0x590f9b[_0x5c17('0x20')]?_0x590f9b['options'][_0x5c17('0x21')]===undefined?!![]:![]:!![]})[_0x5c17('0x13')](function(_0x81819d){logger[_0x5c17('0x1b')]('CreatePlugin',_0x590f9b);logger[_0x5c17('0x15')]('CreatePlugin',_0x590f9b,JSON[_0x5c17('0x22')](_0x81819d));_0x3f244f(_0x81819d);})[_0x5c17('0x23')](function(_0x36f7ac){logger[_0x5c17('0x17')](_0x5c17('0x1d'),_0x36f7ac[_0x5c17('0x1a')],_0x590f9b);_0x38db52(_0x1c61c7[_0x5c17('0x17')](0x1f4,_0x36f7ac[_0x5c17('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f25ec46..eeea732 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 _0x856c=['length','plugin:','./plugin.events','remove','update','removeListener','register'];(function(_0xf1d26c,_0x1463d0){var _0x11c159=function(_0x3f71e8){while(--_0x3f71e8){_0xf1d26c['push'](_0xf1d26c['shift']());}};_0x11c159(++_0x1463d0);}(_0x856c,0x13d));var _0xc856=function(_0x162f64,_0x512c22){_0x162f64=_0x162f64-0x0;var _0x4788d3=_0x856c[_0x162f64];return _0x4788d3;};'use strict';var PluginEvents=require(_0xc856('0x0'));var events=['save',_0xc856('0x1'),_0xc856('0x2')];function createListener(_0x556fe3,_0x47e85d){return function(_0x4b2acc){_0x47e85d['emit'](_0x556fe3,_0x4b2acc);};}function removeListener(_0x2f361e,_0x587ac7){return function(){PluginEvents[_0xc856('0x3')](_0x2f361e,_0x587ac7);};}exports[_0xc856('0x4')]=function(_0xdd3935){for(var _0x35f9b4=0x0,_0x5e79ea=events[_0xc856('0x5')];_0x35f9b4<_0x5e79ea;_0x35f9b4++){var _0x3716f8=events[_0x35f9b4];var _0x4379ea=createListener(_0xc856('0x6')+_0x3716f8,_0xdd3935);PluginEvents['on'](_0x3716f8,_0x4379ea);}}; \ No newline at end of file +var _0x1310=['length','plugin:','./plugin.events','save','update','removeListener','register'];(function(_0x1ba4c1,_0x3f409f){var _0x42304c=function(_0x2a2c47){while(--_0x2a2c47){_0x1ba4c1['push'](_0x1ba4c1['shift']());}};_0x42304c(++_0x3f409f);}(_0x1310,0xcd));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var PluginEvents=require(_0x0131('0x0'));var events=[_0x0131('0x1'),'remove',_0x0131('0x2')];function createListener(_0x39b2d0,_0x5d0b2e){return function(_0x30a8a7){_0x5d0b2e['emit'](_0x39b2d0,_0x30a8a7);};}function removeListener(_0x2afbbf,_0x4bfe2c){return function(){PluginEvents[_0x0131('0x3')](_0x2afbbf,_0x4bfe2c);};}exports[_0x0131('0x4')]=function(_0x44f5e3){for(var _0x4fc014=0x0,_0x53c238=events[_0x0131('0x5')];_0x4fc014<_0x53c238;_0x4fc014++){var _0x40b7bd=events[_0x4fc014];var _0x3c1356=createListener(_0x0131('0x6')+_0x40b7bd,_0x44f5e3);PluginEvents['on'](_0x40b7bd,_0x3c1356);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9becb68..9ee419c 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(_0x52c6ac,_0x2e3acd){var _0x3c3eda=function(_0x6006ea){while(--_0x6006ea){_0x52c6ac['push'](_0x52c6ac['shift']());}};_0x3c3eda(++_0x2e3acd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x2a1a76,_0x41a9e2){var _0x18fc22=function(_0x4ff8d9){while(--_0x4ff8d9){_0x2a1a76['push'](_0x2a1a76['shift']());}};_0x18fc22(++_0x41a9e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 e23d464..ef5c9de 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 _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0x3c0498,_0xba8aca){var _0x414d8b=function(_0xf4e2e){while(--_0xf4e2e){_0x3c0498['push'](_0x3c0498['shift']());}};_0x414d8b(++_0xba8aca);}(_0xb469,0x13b));var _0x9b46=function(_0x34ba98,_0x5c8238){_0x34ba98=_0x34ba98-0x0;var _0x18e542=_0xb469[_0x34ba98];return _0x18e542;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file +var _0x57f8=['error','name','npm\x20install','info','index','list','express','length','then','catch','show','describe','params','body','script','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x5e4f42,_0x296563){var _0x24a54e=function(_0x3e2b49){while(--_0x3e2b49){_0x5e4f42['push'](_0x5e4f42['shift']());}};_0x24a54e(++_0x296563);}(_0x57f8,0x198));var _0x857f=function(_0x19ab90,_0x23773c){_0x19ab90=_0x19ab90-0x0;var _0x45b682=_0x57f8[_0x19ab90];return _0x45b682;};'use strict';var _=require('lodash');var pm2=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var path=require(_0x857f('0x3'));var exec=require(_0x857f('0x4'))[_0x857f('0x5')];var BPromise=require(_0x857f('0x6'));function handleEntityNotFound(_0x6f054b,_0x318050){return function(_0xced48e){if(!_0xced48e){_0x6f054b[_0x857f('0x7')](0x194);;}return _0xced48e;};}function respondWithResult(_0x369c40,_0x5d22e4){_0x5d22e4=_0x5d22e4||0xc8;return function(_0x8380e8){if(_0x8380e8){return _0x369c40[_0x857f('0x8')](_0x5d22e4)[_0x857f('0x9')](_0x8380e8);}return null;};}function handleError(_0x577fc3,_0x5f6a66){_0x5f6a66=_0x5f6a66||0x1f4;return function(_0x135855){logger[_0x857f('0xa')](_0x135855['stack']);if(_0x135855[_0x857f('0xb')]){delete _0x135855[_0x857f('0xb')];}_0x577fc3[_0x857f('0x8')](_0x5f6a66)['send'](_0x135855);};}function execChildProcess(){return new BPromise(function(_0xefee53,_0x360827){exec(_0x857f('0xc'),function(_0x11adfd,_0x268f9d,_0x3eb530){logger[_0x857f('0xd')](_0x268f9d);logger['info'](_0x3eb530);if(_0x11adfd){logger[_0x857f('0xa')](_0x11adfd);return _0x360827(_0x11adfd);}return _0xefee53(_0x268f9d);});});}exports[_0x857f('0xe')]=function(_0x373333,_0x2caf29){return pm2[_0x857f('0xf')]()['then'](function(_0x4bc590){if(_0x4bc590){var _0x3b09d9=_['reject'](_0x4bc590,function(_0x1fafbe){return _0x1fafbe['name']===_0x857f('0x10')||_0x1fafbe[_0x857f('0xb')]==='motion2';});return{'rows':_0x3b09d9,'count':_0x3b09d9[_0x857f('0x11')]};}return null;})[_0x857f('0x12')](respondWithResult(_0x2caf29,null))[_0x857f('0x13')](handleError(_0x2caf29,null));};exports[_0x857f('0x14')]=function(_0x279e74,_0x38a3c2){return pm2[_0x857f('0x15')](_0x279e74[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x38a3c2,null))[_0x857f('0x12')](handleEntityNotFound(_0x38a3c2,null))[_0x857f('0x13')](handleError(_0x38a3c2,null));};exports['create']=function(_0x1729d8,_0x1e8fd4){if(_0x1729d8['body'][_0x857f('0xb')]&&_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]){var _0x484035=path['join'](__dirname,_0x857f('0x19'),_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]);var _0x4fa031=process[_0x857f('0x1a')]();process[_0x857f('0x1b')](path[_0x857f('0x1c')](_0x484035));return execChildProcess()['then'](function(_0x1961ea){process[_0x857f('0x1b')](_0x4fa031);return pm2['start']({'name':_0x1729d8[_0x857f('0x17')][_0x857f('0xb')],'script':_0x484035});})[_0x857f('0x12')](function(_0x44ff23){pm2[_0x857f('0x1d')]();return _0x44ff23[0x0];})[_0x857f('0x12')](respondWithResult(_0x1e8fd4,0xc9))[_0x857f('0x13')](handleError(_0x1e8fd4,null));}else{return _0x1e8fd4[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x1f')});}};exports[_0x857f('0x20')]=function(_0x4782ab,_0x250731){if(_0x4782ab[_0x857f('0x17')]['id']){delete _0x4782ab['body']['id'];}var _0x17e415={'online':_0x857f('0x21'),'stopped':_0x857f('0x22')};if(_0x17e415[_0x857f('0x23')](_0x4782ab['body'][_0x857f('0x8')])){return pm2[_0x17e415[_0x4782ab['body'][_0x857f('0x8')]]](_0x4782ab[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x250731,0xc8))[_0x857f('0x13')](handleError(_0x250731,null));}else{return _0x250731[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x24')});}};exports[_0x857f('0x25')]=function(_0x17e7b6,_0x41f832){if(_0x17e7b6[_0x857f('0x17')]['id']){delete _0x17e7b6[_0x857f('0x17')]['id'];}if(_0x17e7b6[_0x857f('0x16')]['id']){return pm2['delete'](_0x17e7b6[_0x857f('0x16')]['id'])[_0x857f('0x12')](function(_0x55e69f){pm2[_0x857f('0x1d')]();return _0x55e69f[0x0];})[_0x857f('0x12')](respondWithResult(_0x41f832,null))['catch'](handleError(_0x41f832,null));}else{return _0x41f832[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 5a6574c..74bcc87 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 _0xa4b8=['../../components/auth/service','./realtime.controller','isAuthenticated','getAgents','get','/queues','exports','express'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa4b8,0x6f));var _0x8a4b=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0xa4b8[_0x1b6c96];return _0x80e240;};'use strict';var express=require(_0x8a4b('0x0'));var router=express['Router']();var auth=require(_0x8a4b('0x1'));var controller=require(_0x8a4b('0x2'));router['get']('/agents',auth[_0x8a4b('0x3')](),controller[_0x8a4b('0x4')]);router[_0x8a4b('0x5')](_0x8a4b('0x6'),auth[_0x8a4b('0x3')](),controller['getQueues']);module[_0x8a4b('0x7')]=router; \ No newline at end of file +var _0x32e3=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','exports','express','Router'];(function(_0xe7ba73,_0x1a1dd3){var _0x9bfee0=function(_0x9871f4){while(--_0x9871f4){_0xe7ba73['push'](_0xe7ba73['shift']());}};_0x9bfee0(++_0x1a1dd3);}(_0x32e3,0xee));var _0x332e=function(_0x4bf3b1,_0x3e47aa){_0x4bf3b1=_0x4bf3b1-0x0;var _0x35040a=_0x32e3[_0x4bf3b1];return _0x35040a;};'use strict';var express=require(_0x332e('0x0'));var router=express[_0x332e('0x1')]();var auth=require(_0x332e('0x2'));var controller=require(_0x332e('0x3'));router[_0x332e('0x4')](_0x332e('0x5'),auth[_0x332e('0x6')](),controller[_0x332e('0x7')]);router[_0x332e('0x4')]('/queues',auth[_0x332e('0x6')](),controller[_0x332e('0x8')]);module[_0x332e('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 67707e3..6fea1e6 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 _0x5c71=['count','status','set','json','error','stack','name','voice','request','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','result','loggedIn','available','waiting','talking','paused','outbound','push','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','pTalking','originated','merge','pick','filter','length','busy','some','connectedlinenum','internal','toString','find','UserId','accountcode','voiceStatus','User','Pause','findAll','QueueId','online','getChannels','includes','Invalid\x20channel','query','pauseTypeFilter','*pause','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','rows','getAgentIdsByStatus','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','order','forEach','where','user','userProfileId','Agents','UserProfile','getResources','filterAgentAttributes','getAgentStatus','pause','sortAgentsByStatus','getQueues','Queue','findAndCountAll','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/utils','api','client','http','offset','undefined','limit'];(function(_0x10b77c,_0x3a3438){var _0x31e9fb=function(_0x4c351b){while(--_0x4c351b){_0x10b77c['push'](_0x10b77c['shift']());}};_0x31e9fb(++_0x3a3438);}(_0x5c71,0xe1));var _0x15c7=function(_0x1daff0,_0x27acfa){_0x1daff0=_0x1daff0-0x0;var _0xc3e54f=_0x5c71[_0x1daff0];return _0xc3e54f;};'use strict';var util=require(_0x15c7('0x0'));var _=require(_0x15c7('0x1'));var jayson=require(_0x15c7('0x2'));var rta=require('../../components/realtime/agents');var qs=require(_0x15c7('0x3'));var utils=require(_0x15c7('0x4'));var logger=require('../../config/logger')(_0x15c7('0x5'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x15c7('0x6')][_0x15c7('0x7')]({'port':0x232a});var routingClient=jayson[_0x15c7('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0xf42424,_0x1aab4c){return function(_0x4f4478){if(_0x4f4478){var _0x2dba27=typeof _0x1aab4c[_0x15c7('0x8')]===_0x15c7('0x9')&&typeof _0x1aab4c[_0x15c7('0xa')]==='undefined';var _0x257762=_0x4f4478[_0x15c7('0xb')];var _0x50a7df=_0x2dba27?0x0:_0x1aab4c[_0x15c7('0x8')];var _0x58dad5=_0x2dba27?_0x4f4478['count']:_0x1aab4c['offset']+_0x1aab4c[_0x15c7('0xa')];var _0x4d343a;if(_0x58dad5>=_0x257762){_0x58dad5=_0x257762;_0x4d343a=0xc8;}else{_0x4d343a=0xce;}_0xf42424[_0x15c7('0xc')](_0x4d343a);return _0xf42424[_0x15c7('0xd')]('Content-Range',_0x50a7df+'-'+_0x58dad5+'/'+_0x257762)[_0x15c7('0xe')](_0x4f4478);}return null;};}function handleError(_0x11d588,_0x1b0edf){_0x1b0edf=_0x1b0edf||0x1f4;return function(_0x2769f6){logger[_0x15c7('0xf')](_0x2769f6[_0x15c7('0x10')]);if(_0x2769f6['name']){delete _0x2769f6[_0x15c7('0x11')];}_0x11d588[_0x15c7('0xc')](_0x1b0edf)['send'](_0x2769f6);};}function getRealtimeQueues(_0x56de3b,_0x399b32){return new Promise(function(_0x3f2665,_0x49fd91){var _0x138d66=_0x399b32===_0x15c7('0x12')?amiClient:routingClient;return _0x138d66[_0x15c7('0x13')](_[_0x15c7('0x14')](_0x399b32)+_0x15c7('0x15'),_0x56de3b)[_0x15c7('0x16')](function(_0x375dcc){if(_0x375dcc[_0x15c7('0xf')])throw new Error(util['format'](_0x15c7('0x17'),_0x399b32));return _0x3f2665(_0x375dcc['result']);})[_0x15c7('0x18')](function(_0x591ec1){_0x49fd91(_0x591ec1);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x393007,_0x197c21){return amiClient[_0x15c7('0x13')](_0x15c7('0x19'),{})[_0x15c7('0x16')](function(_0x5345eb){if(_0x5345eb[_0x15c7('0xf')])throw new Error(_0x15c7('0x1a'));return _0x393007(_0x5345eb[_0x15c7('0x1b')]);})[_0x15c7('0x18')](function(_0x139426){_0x197c21(_0x139426);});});}function initializeQueues(_0x480634,_0x584eee,_0x4ba6f8,_0x322b5f){var _0x26c4bb=[_0x15c7('0x1c'),_0x15c7('0x1d'),_0x15c7('0x1e'),_0x15c7('0x1f'),_0x15c7('0x20')];if(_0x4ba6f8===_0x15c7('0x12')&&_0x322b5f===_0x15c7('0x21')){_0x26c4bb[_0x15c7('0x22')]('pTalking','originated',_0x15c7('0x23'),_0x15c7('0x24'),'dialMethod',_0x15c7('0x25'),_0x15c7('0x26'),_0x15c7('0x27'),_0x15c7('0x28'),_0x15c7('0x29'),'erlangAbandonmentRate',_0x15c7('0x2a'),_0x15c7('0x2b'),_0x15c7('0x2c'),_0x15c7('0x2d'),_0x15c7('0x2e'),_0x15c7('0x2f'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x15c7('0x30'),_0x15c7('0x31'),_0x15c7('0x32'));}return _0x480634[_0x15c7('0x33')](function(_0x171040){var _0x1b8f9b=_0x171040[_0x15c7('0x34')]({'plain':!![]});_0x1b8f9b[_0x15c7('0x35')]=[];_0x1b8f9b[_0x15c7('0x20')]=0x0;_0x1b8f9b[_0x15c7('0x36')]=0x0;_0x1b8f9b[_0x15c7('0x1c')]=0x0;_0x1b8f9b[_0x15c7('0x1d')]=0x0;_0x1b8f9b[_0x15c7('0x1e')]=0x0;if(_0x4ba6f8===_0x15c7('0x12')){_0x1b8f9b[_0x15c7('0x1f')]=0x0;_0x1b8f9b['busy']=0x0;if(_0x322b5f==='outbound'){_0x1b8f9b[_0x15c7('0x37')]=0x0;_0x1b8f9b[_0x15c7('0x38')]=0x0;}}var _0x5efa51=_['find'](_0x584eee,['id',_0x1b8f9b['id']]);if(_0x5efa51)_[_0x15c7('0x39')](_0x1b8f9b,_[_0x15c7('0x3a')](_0x5efa51,_0x26c4bb));return _0x1b8f9b;});}function updateAgentVoiceStatus(_0x229647,_0x53a5e8,_0x2f52ae){var _0x5c2696=_[_0x15c7('0x3b')](_0x2f52ae,['queue',_0x53a5e8['name']]);if(_0x5c2696[_0x15c7('0x3c')]===0x0)return _0x229647[_0x15c7('0x3d')]=!![];if(_[_0x15c7('0x3e')](_0x5c2696,[_0x15c7('0x3f'),_0x229647[_0x15c7('0x40')][_0x15c7('0x41')]()]))return _0x229647[_0x15c7('0x1f')]=!![];if(!_0x229647['talking'])return _0x229647[_0x15c7('0x3d')]=!![];}function getVoiceQueueAgents(_0x376191,_0x20a11b,_0x339286,_0x51a811){var _0x261583=_[_0x15c7('0x42')](_0x20a11b,['id',_0x376191['id']]);if(!_0x261583)return _0x376191;return _0x261583['getMembers']({'raw':!![]})['then'](function(_0x125ae5){for(var _0x568c34=0x0;_0x568c34<_0x125ae5[_0x15c7('0x3c')];_0x568c34++){var _0x3a9a89=_['find'](_0x339286,['id',_0x125ae5[_0x568c34]['UserId']]);if(!_0x3a9a89){_0x3a9a89={'id':_0x125ae5[_0x568c34][_0x15c7('0x43')],'name':_0x125ae5[_0x568c34][_0x15c7('0x43')],'accountcode':'','online':![]};}var _0x4407e8={'id':_0x3a9a89['id'],'name':_0x3a9a89[_0x15c7('0x11')],'internal':_0x3a9a89[_0x15c7('0x44')],'online':Boolean(_0x3a9a89['online']),'paused':Boolean(_0x125ae5[_0x568c34][_0x15c7('0x20')])};if(_0x3a9a89[_0x15c7('0x45')]===_0x15c7('0x1f'))updateAgentVoiceStatus(_0x4407e8,_0x376191,_0x51a811);if(_0x4407e8['online'])_0x376191[_0x15c7('0x36')]++;if(_0x4407e8['busy'])_0x376191[_0x15c7('0x3d')]++;if(_0x4407e8[_0x15c7('0x20')]&&!_0x4407e8[_0x15c7('0x3d')]&&!_0x4407e8[_0x15c7('0x1f')])_0x376191['paused']++;_0x376191[_0x15c7('0x35')]['push'](_0x4407e8);}return _0x376191;});}function getQueueAgents(_0x265006,_0x5fc8e8,_0x572abc){var _0x40b260=_0x15c7('0x46')+_['startCase'](_0x572abc)+'Queue';var _0x4b2d76=_0x572abc+_0x15c7('0x47');return db[_0x40b260][_0x15c7('0x48')]({'where':{[_['startCase'](_0x572abc)+_0x15c7('0x49')]:_0x265006['id']},'raw':!![]})['then'](function(_0x134b6c){for(var _0x395657=0x0;_0x395657<_0x134b6c[_0x15c7('0x3c')];_0x395657++){var _0x9fb0c4=_[_0x15c7('0x42')](_0x5fc8e8,['id',_0x134b6c[_0x395657][_0x15c7('0x43')]]);if(!_0x9fb0c4){_0x9fb0c4={'id':_0x134b6c[_0x395657][_0x15c7('0x43')],'name':_0x134b6c[_0x395657]['UserId'],'online':![],['pauseField']:![]};}var _0x2831aa={'id':_0x9fb0c4['id'],'name':_0x9fb0c4[_0x15c7('0x11')],'online':Boolean(_0x9fb0c4[_0x15c7('0x4a')]),'paused':Boolean(_0x9fb0c4[_0x4b2d76])};if(_0x2831aa[_0x15c7('0x4a')])_0x265006[_0x15c7('0x36')]++;_0x265006['agents'][_0x15c7('0x22')](_0x2831aa);}return _0x265006;});}function validateChannel(_0x1325d9){var _0x42778=utils[_0x15c7('0x4b')]();if(!_[_0x15c7('0x4c')](_0x42778,_0x1325d9['toLowerCase']()))throw new Error(_0x15c7('0x4d'));return _0x1325d9['toLowerCase']();}exports['getAgents']=function(_0x52209a,_0x325162){var _0x457dc3={'count':0x0,'rows':[]};var _0x463e57={};var _0x9b81ff;var _0x9f938;var _0x4f6f1f;var _0x222903;var _0x19483f=utils[_0x15c7('0x4b')]();var _0x249bc1=_0x52209a['query']['globalQueueFilter'];var _0x3e5e15=_0x52209a[_0x15c7('0x4e')]['globalStatusFilter'];var _0x5d50f5=_0x52209a[_0x15c7('0x4e')][_0x15c7('0x4f')];var _0x58d70d=_0x3e5e15==='pause'||_0x3e5e15===_0x15c7('0x50')?!![]:![];var _0x2f51cd=[];var _0x17d58a;Promise['resolve']()[_0x15c7('0x16')](function(){if(_0x52209a['query'][_0x15c7('0x51')]){_0x9b81ff=validateChannel(_0x52209a[_0x15c7('0x4e')][_0x15c7('0x51')]);}if(!_0x52209a['query'][_0x15c7('0x52')]||!_0x52209a[_0x15c7('0x4e')][_0x15c7('0x52')][_0x15c7('0x4c')](_0x15c7('0x53'))){_0x52209a['query'][_0x15c7('0x52')]=rta[_0x15c7('0x54')](_0x52209a[_0x15c7('0x4e')][_0x15c7('0x52')]);return;}var _0x2c5a23=rta[_0x15c7('0x55')](_0x52209a['query'][_0x15c7('0x52')]);_0x52209a[_0x15c7('0x4e')][_0x15c7('0x52')]=_0x2c5a23[_0x15c7('0x56')][_0x15c7('0x57')](',');_0x9f938=_0x2c5a23['order'];})[_0x15c7('0x16')](function(){if(!_0x249bc1){return[];}return rta[_0x15c7('0x58')](_0x249bc1,_0x9b81ff);})[_0x15c7('0x16')](function(_0xb84846){_0x2f51cd=_0xb84846;return rta['getRealtimeAgents']();})[_0x15c7('0x16')](function(_0x50bbfc){_0x222903=_0x50bbfc[_0x15c7('0x59')];if((!_0x3e5e15||_0x58d70d)&&!_0x9f938){return _0x2f51cd;}if(_0x9f938&&!_0x3e5e15){return rta['getSortedAgentsIdsByStatus'](_0x222903,_0x2f51cd,_0x9f938);}else{return rta[_0x15c7('0x5a')](_0x222903,_0x2f51cd,_0x3e5e15);}})[_0x15c7('0x16')](function(_0x574349){_0x2f51cd=_0x574349;var _0x5cde91=![];if(_0x2f51cd[_0x15c7('0x3c')]===0x0){if(_0x249bc1||_0x3e5e15){_0x5cde91=!![];}if(_0x58d70d){_0x5cde91=![];}}if(_0x5cde91){return _0x457dc3;}var _0x19ff95=_[_0x15c7('0x33')](db[_0x15c7('0x46')][_0x15c7('0x5b')],function(_0xd6d3f3){return{'name':_0xd6d3f3[_0x15c7('0x5c')],'type':_0xd6d3f3[_0x15c7('0x5d')][_0x15c7('0x5e')]};});_0x52209a[_0x15c7('0x4e')][_0x15c7('0x5f')]=_0x15c7('0x60');_0x52209a[_0x15c7('0x4e')]['online']=!![];_0x463e57=qs[_0x15c7('0x61')](_0x19ff95,_0x52209a);_0x463e57[_0x15c7('0x62')]=!![];var _0x4f31d=[];if(_0x2f51cd['length']>0x0){_0x4f31d['push']({'id':{'$in':_0x2f51cd}});if(_0x9f938&&!_0x3e5e15){_0x17d58a=[db[_0x15c7('0x63')][_0x15c7('0x64')](_0x15c7('0x65')+_0x2f51cd+')')];_0x463e57[_0x15c7('0x66')]=_0x17d58a;}}if(_0x58d70d){_0x19483f[_0x15c7('0x67')](function(_0x38ad05){var _0x72d349=!![];if(_0x3e5e15===_0x15c7('0x50')&&_0x9b81ff!==_0x38ad05){_0x72d349=![];}_0x4f31d[_0x15c7('0x22')]({[_0x38ad05+_0x15c7('0x47')]:_0x72d349});});if(_0x5d50f5){_0x4f31d[_0x15c7('0x22')]({'pauseType':_0x5d50f5});}}else if(_0x3e5e15){_0x19483f[_0x15c7('0x67')](function(_0x4fb116){_0x4f31d[_0x15c7('0x22')]({[_0x4fb116+_0x15c7('0x47')]:![]});});}_0x463e57[_0x15c7('0x68')]=_['merge'](_0x463e57['where'],{'$and':_0x4f31d});if(_0x52209a[_0x15c7('0x69')]['role']===_0x15c7('0x69')){var _0x4976a7={'params':{'id':_0x52209a[_0x15c7('0x69')][_0x15c7('0x6a')]},'query':{'section':_0x15c7('0x6b'),'role':'agent','online':!![],'raw':!![],'ids':_0x2f51cd,'customSorting':_0x17d58a}};if(_0x58d70d){_0x4976a7[_0x15c7('0x4e')]['extraQueryConditions']=_0x4f31d;}_0x4976a7[_0x15c7('0x4e')]=Object['assign'](_0x4976a7[_0x15c7('0x4e')],_0x52209a[_0x15c7('0x4e')]);delete _0x4976a7['query']['id'];return db[_0x15c7('0x6c')][_0x15c7('0x6d')](_0x4976a7);}return db[_0x15c7('0x46')]['findAndCountAll'](_0x463e57);})['then'](function(_0x444402){_0x457dc3[_0x15c7('0xb')]=_0x444402[_0x15c7('0xb')];_0x4f6f1f=_0x444402[_0x15c7('0x59')];return _0x4f6f1f[_0x15c7('0x33')](function(_0x2ec3d7){var _0x36e64f=_[_0x15c7('0x42')](_0x222903,['id',_0x2ec3d7['id']]);if(_0x36e64f){var _0x36f6c3=rta[_0x15c7('0x6e')](_0x36e64f);_['merge'](_0x2ec3d7,_0x36f6c3);}_0x2ec3d7[_0x15c7('0x53')]=rta[_0x15c7('0x6f')](_0x2ec3d7);if(_0x2ec3d7[_0x15c7('0x53')]['includes'](_0x15c7('0x70'))){_0x19483f[_0x15c7('0x67')](function(_0x1c6ae4){if(_0x2ec3d7[_0x1c6ae4+_0x15c7('0x47')]){_0x2ec3d7[_0x1c6ae4+'Status']=_0x15c7('0x70');}});}return _0x2ec3d7;});})[_0x15c7('0x16')](function(_0x5cce11){if(!_0x9f938||_0x17d58a){return _0x5cce11;}return rta[_0x15c7('0x71')](_0x5cce11,_0x9f938);})[_0x15c7('0x16')](function(_0x18053c){_0x457dc3[_0x15c7('0x59')]=_0x18053c;return _0x457dc3;})[_0x15c7('0x16')](respondWithFilteredResult(_0x325162,_0x463e57))['catch'](handleError(_0x325162,null));};exports[_0x15c7('0x72')]=function(_0x216be2,_0x4ab688){var _0x4fb545={'count':0x0,'rows':[]},_0x51f80d={},_0x2c8028,_0x3f611f,_0x196e27,_0x595688,_0x33d85b;Promise['resolve']()[_0x15c7('0x16')](function(){if(_0x216be2[_0x15c7('0x4e')][_0x15c7('0x51')])_0x2c8028=validateChannel(_0x216be2['query'][_0x15c7('0x51')]);var _0x2a61cd=_['startCase'](_0x2c8028)+_0x15c7('0x73');var _0x510b64=_[_0x15c7('0x33')](db[_0x2a61cd][_0x15c7('0x5b')],function(_0x1c1073){return{'name':_0x1c1073[_0x15c7('0x5c')],'type':_0x1c1073['type'][_0x15c7('0x5e')]};});_0x51f80d=qs['getOptions'](_0x510b64,_0x216be2);if(_0x216be2['user'][_0x15c7('0x5f')]===_0x15c7('0x69')){var _0x21d09e={'params':{'id':_0x216be2['user'][_0x15c7('0x6a')]},'query':{'section':_0x2c8028===_0x15c7('0x12')&&_0x216be2[_0x15c7('0x4e')][_0x15c7('0x5d')]===_0x15c7('0x21')?'QueueCampaigns':_[_0x15c7('0x14')](_0x2c8028)+_0x15c7('0x15'),'type':_0x216be2[_0x15c7('0x4e')][_0x15c7('0x5d')],'nolimit':!![],'sort':_0x15c7('0x11'),'filter':_0x216be2[_0x15c7('0x4e')][_0x15c7('0x3b')]}};return db[_0x15c7('0x6c')][_0x15c7('0x6d')](_0x21d09e);}return db[_0x2a61cd][_0x15c7('0x74')](_0x51f80d);})[_0x15c7('0x16')](function(_0x53129b){_0x4fb545[_0x15c7('0xb')]=_0x53129b[_0x15c7('0xb')];_0x3f611f=_0x53129b[_0x15c7('0x59')];return getRealtimeQueues(_0x216be2,_0x2c8028);})[_0x15c7('0x16')](function(_0x14cf44){_0x595688=_0x14cf44[_0x15c7('0x59')];return rta['getRealtimeAgents']();})[_0x15c7('0x16')](function(_0x47fd5a){_0x196e27=_0x47fd5a[_0x15c7('0x59')];if(_0x2c8028!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x15c7('0x16')](function(_0x355d06){_0x33d85b=_0x355d06?_0x355d06[_0x15c7('0x59')]:[];return initializeQueues(_0x3f611f,_0x595688,_0x2c8028,_0x216be2[_0x15c7('0x4e')]['type']);})[_0x15c7('0x16')](function(_0x515022){var _0xbdfa9e=_0x515022[_0x15c7('0x33')](function(_0x49e338){if(_0x2c8028==='voice')return getVoiceQueueAgents(_0x49e338,_0x3f611f,_0x196e27,_0x33d85b);else return getQueueAgents(_0x49e338,_0x196e27,_0x2c8028);});return Promise[_0x15c7('0x75')](_0xbdfa9e);})[_0x15c7('0x16')](function(_0x59c92a){_0x4fb545[_0x15c7('0x59')]=_0x59c92a;return _0x4fb545;})[_0x15c7('0x16')](respondWithFilteredResult(_0x4ab688,_0x51f80d))[_0x15c7('0x18')](handleError(_0x4ab688,null));}; \ No newline at end of file +var _0x976c=['getQueues','rawAttributes','userProfileId','QueueCampaigns','UserProfile','all','util','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','name','send','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','then','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','message','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','map','get','agents','loggedInDb','originated','find','merge','filter','queue','some','connectedlinenum','internal','toString','busy','length','UserId','online','User','startCase','findAll','QueueId','includes','toLowerCase','Invalid\x20channel','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','channel','sort','globalStatus','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','fieldName','type','key','role','agent','getOptions','sequelize','FIELD(id,','forEach','*pause','Pause','where','user','Agents','assign','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','Status'];(function(_0x381a7c,_0x5bf02d){var _0x547884=function(_0x47fea2){while(--_0x47fea2){_0x381a7c['push'](_0x381a7c['shift']());}};_0x547884(++_0x5bf02d);}(_0x976c,0x7f));var _0xc976=function(_0x563b62,_0x26b321){_0x563b62=_0x563b62-0x0;var _0x5e5062=_0x976c[_0x563b62];return _0x5e5062;};'use strict';var util=require(_0xc976('0x0'));var _=require(_0xc976('0x1'));var jayson=require(_0xc976('0x2'));var rta=require(_0xc976('0x3'));var qs=require(_0xc976('0x4'));var utils=require(_0xc976('0x5'));var logger=require(_0xc976('0x6'))(_0xc976('0x7'));var db=require(_0xc976('0x8'))['db'];var amiClient=jayson[_0xc976('0x9')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xc976('0xa')]({'port':0x232c});function respondWithFilteredResult(_0x2a8ca2,_0x47c5c8){return function(_0x4b590c){if(_0x4b590c){var _0x1823b4=typeof _0x47c5c8[_0xc976('0xb')]===_0xc976('0xc')&&typeof _0x47c5c8[_0xc976('0xd')]===_0xc976('0xc');var _0x688ceb=_0x4b590c[_0xc976('0xe')];var _0x39302e=_0x1823b4?0x0:_0x47c5c8[_0xc976('0xb')];var _0x5210ed=_0x1823b4?_0x4b590c[_0xc976('0xe')]:_0x47c5c8[_0xc976('0xb')]+_0x47c5c8[_0xc976('0xd')];var _0x14830a;if(_0x5210ed>=_0x688ceb){_0x5210ed=_0x688ceb;_0x14830a=0xc8;}else{_0x14830a=0xce;}_0x2a8ca2[_0xc976('0xf')](_0x14830a);return _0x2a8ca2[_0xc976('0x10')](_0xc976('0x11'),_0x39302e+'-'+_0x5210ed+'/'+_0x688ceb)[_0xc976('0x12')](_0x4b590c);}return null;};}function handleError(_0x144dd7,_0x5bc8ee){_0x5bc8ee=_0x5bc8ee||0x1f4;return function(_0x1a4097){logger['error'](_0x1a4097['stack']);if(_0x1a4097[_0xc976('0x13')]){delete _0x1a4097[_0xc976('0x13')];}_0x144dd7[_0xc976('0xf')](_0x5bc8ee)[_0xc976('0x14')](_0x1a4097);};}function getRealtimeQueues(_0x4efb31,_0x52a651){return new Promise(function(_0x506b21,_0x1a088f){var _0x1644de=_0x52a651==='voice'?amiClient:routingClient;return _0x1644de['request'](_['startCase'](_0x52a651)+_0xc976('0x15'),_0x4efb31)['then'](function(_0x3c41ba){if(_0x3c41ba[_0xc976('0x16')])throw new Error(util[_0xc976('0x17')](_0xc976('0x18'),_0x52a651));return _0x506b21(_0x3c41ba[_0xc976('0x19')]);})[_0xc976('0x1a')](function(_0x2c9dac){_0x1a088f(_0x2c9dac);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x12f520,_0x34ed9e){return amiClient['request']('VoiceQueuesChannels',{})[_0xc976('0x1b')](function(_0x5852c4){if(_0x5852c4['error'])throw new Error(_0xc976('0x1c'));return _0x12f520(_0x5852c4['result']);})['catch'](function(_0xfc95da){_0x34ed9e(_0xfc95da);});});}function initializeQueues(_0x201842,_0x1f17c8,_0x51fd12,_0x4dc7a2){var _0x18a047=[_0xc976('0x1d'),_0xc976('0x1e'),_0xc976('0x1f'),_0xc976('0x20'),_0xc976('0x21')];if(_0x51fd12===_0xc976('0x22')&&_0x4dc7a2===_0xc976('0x23')){_0x18a047[_0xc976('0x24')](_0xc976('0x25'),'originated',_0xc976('0x26'),'dialActive',_0xc976('0x27'),'Trunk','startPredictive',_0xc976('0x28'),_0xc976('0x29'),_0xc976('0x2a'),_0xc976('0x2b'),_0xc976('0x2c'),_0xc976('0x2d'),_0xc976('0x2e'),_0xc976('0x2f'),_0xc976('0x30'),_0xc976('0x31'),_0xc976('0x32'),_0xc976('0x33'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x201842[_0xc976('0x34')](function(_0x5ec847){var _0x1d200a=_0x5ec847[_0xc976('0x35')]({'plain':!![]});_0x1d200a[_0xc976('0x36')]=[];_0x1d200a[_0xc976('0x21')]=0x0;_0x1d200a[_0xc976('0x37')]=0x0;_0x1d200a[_0xc976('0x1d')]=0x0;_0x1d200a[_0xc976('0x1e')]=0x0;_0x1d200a[_0xc976('0x1f')]=0x0;if(_0x51fd12==='voice'){_0x1d200a[_0xc976('0x20')]=0x0;_0x1d200a['busy']=0x0;if(_0x4dc7a2===_0xc976('0x23')){_0x1d200a['pTalking']=0x0;_0x1d200a[_0xc976('0x38')]=0x0;}}var _0x6e570c=_[_0xc976('0x39')](_0x1f17c8,['id',_0x1d200a['id']]);if(_0x6e570c)_[_0xc976('0x3a')](_0x1d200a,_['pick'](_0x6e570c,_0x18a047));return _0x1d200a;});}function updateAgentVoiceStatus(_0x26d4f3,_0x246dc4,_0x127b5c){var _0xf76c05=_[_0xc976('0x3b')](_0x127b5c,[_0xc976('0x3c'),_0x246dc4[_0xc976('0x13')]]);if(_0xf76c05['length']===0x0)return _0x26d4f3['busy']=!![];if(_[_0xc976('0x3d')](_0xf76c05,[_0xc976('0x3e'),_0x26d4f3[_0xc976('0x3f')][_0xc976('0x40')]()]))return _0x26d4f3['talking']=!![];if(!_0x26d4f3[_0xc976('0x20')])return _0x26d4f3[_0xc976('0x41')]=!![];}function getVoiceQueueAgents(_0x3884a0,_0x19c416,_0xa335af,_0x481621){var _0x365cb4=_[_0xc976('0x39')](_0x19c416,['id',_0x3884a0['id']]);if(!_0x365cb4)return _0x3884a0;return _0x365cb4['getMembers']({'raw':!![]})[_0xc976('0x1b')](function(_0x339545){for(var _0x2c4a07=0x0;_0x2c4a07<_0x339545[_0xc976('0x42')];_0x2c4a07++){var _0x3166a2=_[_0xc976('0x39')](_0xa335af,['id',_0x339545[_0x2c4a07]['UserId']]);if(!_0x3166a2){_0x3166a2={'id':_0x339545[_0x2c4a07][_0xc976('0x43')],'name':_0x339545[_0x2c4a07][_0xc976('0x43')],'accountcode':'','online':![]};}var _0x26d04c={'id':_0x3166a2['id'],'name':_0x3166a2[_0xc976('0x13')],'internal':_0x3166a2['accountcode'],'online':Boolean(_0x3166a2[_0xc976('0x44')]),'paused':Boolean(_0x339545[_0x2c4a07][_0xc976('0x21')])};if(_0x3166a2['voiceStatus']===_0xc976('0x20'))updateAgentVoiceStatus(_0x26d04c,_0x3884a0,_0x481621);if(_0x26d04c['online'])_0x3884a0['loggedInDb']++;if(_0x26d04c[_0xc976('0x41')])_0x3884a0[_0xc976('0x41')]++;if(_0x26d04c[_0xc976('0x21')]&&!_0x26d04c['busy']&&!_0x26d04c['talking'])_0x3884a0[_0xc976('0x21')]++;_0x3884a0['agents']['push'](_0x26d04c);}return _0x3884a0;});}function getQueueAgents(_0xc30bbe,_0x111e87,_0x5459df){var _0x1e1c9e=_0xc976('0x45')+_[_0xc976('0x46')](_0x5459df)+'Queue';var _0x2919f=_0x5459df+'Pause';return db[_0x1e1c9e][_0xc976('0x47')]({'where':{[_[_0xc976('0x46')](_0x5459df)+_0xc976('0x48')]:_0xc30bbe['id']},'raw':!![]})[_0xc976('0x1b')](function(_0x965954){for(var _0x167dbe=0x0;_0x167dbe<_0x965954[_0xc976('0x42')];_0x167dbe++){var _0x97e2a6=_['find'](_0x111e87,['id',_0x965954[_0x167dbe][_0xc976('0x43')]]);if(!_0x97e2a6){_0x97e2a6={'id':_0x965954[_0x167dbe]['UserId'],'name':_0x965954[_0x167dbe][_0xc976('0x43')],'online':![],['pauseField']:![]};}var _0x4cdf9d={'id':_0x97e2a6['id'],'name':_0x97e2a6['name'],'online':Boolean(_0x97e2a6[_0xc976('0x44')]),'paused':Boolean(_0x97e2a6[_0x2919f])};if(_0x4cdf9d[_0xc976('0x44')])_0xc30bbe[_0xc976('0x37')]++;_0xc30bbe[_0xc976('0x36')]['push'](_0x4cdf9d);}return _0xc30bbe;});}function validateChannel(_0x5b70bf){var _0x5e1f84=utils['getChannels']();if(!_[_0xc976('0x49')](_0x5e1f84,_0x5b70bf[_0xc976('0x4a')]()))throw new Error(_0xc976('0x4b'));return _0x5b70bf['toLowerCase']();}exports[_0xc976('0x4c')]=function(_0x4cf86c,_0x3def97){var _0x405671={'count':0x0,'rows':[]};var _0xf89384={};var _0x19e71a;var _0x3c2a4e;var _0x14ec74;var _0x4e5faf;var _0x34ae5c=utils[_0xc976('0x4d')]();var _0x2dc0f5=_0x4cf86c[_0xc976('0x4e')][_0xc976('0x4f')];var _0x5144c3=_0x4cf86c[_0xc976('0x4e')][_0xc976('0x50')];var _0x5c7213=_0x4cf86c[_0xc976('0x4e')][_0xc976('0x51')];var _0x4f2e78=_0x5144c3===_0xc976('0x52')||_0x5144c3==='*pause'?!![]:![];var _0x44ab74=[];var _0x5b8b5c;Promise[_0xc976('0x53')]()[_0xc976('0x1b')](function(){if(_0x4cf86c['query']['channel']){_0x19e71a=validateChannel(_0x4cf86c[_0xc976('0x4e')][_0xc976('0x54')]);}if(!_0x4cf86c[_0xc976('0x4e')][_0xc976('0x55')]||!_0x4cf86c[_0xc976('0x4e')][_0xc976('0x55')][_0xc976('0x49')](_0xc976('0x56'))){_0x4cf86c[_0xc976('0x4e')][_0xc976('0x55')]=rta['validateSortParameter'](_0x4cf86c[_0xc976('0x4e')]['sort']);return;}var _0x2a4b71=rta[_0xc976('0x57')](_0x4cf86c['query'][_0xc976('0x55')]);_0x4cf86c[_0xc976('0x4e')][_0xc976('0x55')]=_0x2a4b71[_0xc976('0x58')]['join'](',');_0x3c2a4e=_0x2a4b71[_0xc976('0x59')];})[_0xc976('0x1b')](function(){if(!_0x2dc0f5){return[];}return rta[_0xc976('0x5a')](_0x2dc0f5,_0x19e71a);})['then'](function(_0x510eb7){_0x44ab74=_0x510eb7;return rta[_0xc976('0x5b')]();})[_0xc976('0x1b')](function(_0x1d3e5a){_0x4e5faf=_0x1d3e5a[_0xc976('0x5c')];if((!_0x5144c3||_0x4f2e78)&&!_0x3c2a4e){return _0x44ab74;}if(_0x3c2a4e&&!_0x5144c3){return rta[_0xc976('0x5d')](_0x4e5faf,_0x44ab74,_0x3c2a4e);}else{return rta[_0xc976('0x5e')](_0x4e5faf,_0x44ab74,_0x5144c3);}})[_0xc976('0x1b')](function(_0x5713b8){_0x44ab74=_0x5713b8;var _0x2b37e0=![];if(_0x44ab74[_0xc976('0x42')]===0x0){if(_0x2dc0f5||_0x5144c3){_0x2b37e0=!![];}if(_0x4f2e78){_0x2b37e0=![];}}if(_0x2b37e0){return _0x405671;}var _0xc7175f=_[_0xc976('0x34')](db['User']['rawAttributes'],function(_0xca780c){return{'name':_0xca780c[_0xc976('0x5f')],'type':_0xca780c[_0xc976('0x60')][_0xc976('0x61')]};});_0x4cf86c['query'][_0xc976('0x62')]=_0xc976('0x63');_0x4cf86c['query'][_0xc976('0x44')]=!![];_0xf89384=qs[_0xc976('0x64')](_0xc7175f,_0x4cf86c);_0xf89384['raw']=!![];var _0x244a8c=[];if(_0x44ab74[_0xc976('0x42')]>0x0){_0x244a8c[_0xc976('0x24')]({'id':{'$in':_0x44ab74}});if(_0x3c2a4e&&!_0x5144c3){_0x5b8b5c=[db[_0xc976('0x65')]['literal'](_0xc976('0x66')+_0x44ab74+')')];_0xf89384[_0xc976('0x59')]=_0x5b8b5c;}}if(_0x4f2e78){_0x34ae5c[_0xc976('0x67')](function(_0x164f9d){var _0x578774=!![];if(_0x5144c3===_0xc976('0x68')&&_0x19e71a!==_0x164f9d){_0x578774=![];}_0x244a8c[_0xc976('0x24')]({[_0x164f9d+'Pause']:_0x578774});});if(_0x5c7213){_0x244a8c['push']({'pauseType':_0x5c7213});}}else if(_0x5144c3){_0x34ae5c[_0xc976('0x67')](function(_0x540118){_0x244a8c[_0xc976('0x24')]({[_0x540118+_0xc976('0x69')]:![]});});}_0xf89384[_0xc976('0x6a')]=_[_0xc976('0x3a')](_0xf89384['where'],{'$and':_0x244a8c});if(_0x4cf86c[_0xc976('0x6b')][_0xc976('0x62')]==='user'){var _0x41f452={'params':{'id':_0x4cf86c[_0xc976('0x6b')]['userProfileId']},'query':{'section':_0xc976('0x6c'),'role':_0xc976('0x63'),'online':!![],'raw':!![],'ids':_0x44ab74,'customSorting':_0x5b8b5c}};if(_0x4f2e78){_0x41f452['query']['extraQueryConditions']=_0x244a8c;}_0x41f452[_0xc976('0x4e')]=Object[_0xc976('0x6d')](_0x41f452['query'],_0x4cf86c[_0xc976('0x4e')]);delete _0x41f452[_0xc976('0x4e')]['id'];return db['UserProfile'][_0xc976('0x6e')](_0x41f452);}return db['User'][_0xc976('0x6f')](_0xf89384);})[_0xc976('0x1b')](function(_0x4a87d4){_0x405671['count']=_0x4a87d4[_0xc976('0xe')];_0x14ec74=_0x4a87d4[_0xc976('0x5c')];return _0x14ec74['map'](function(_0x4a57b9){var _0x3013be=_[_0xc976('0x39')](_0x4e5faf,['id',_0x4a57b9['id']]);if(_0x3013be){var _0x18cb40=rta[_0xc976('0x70')](_0x3013be);_['merge'](_0x4a57b9,_0x18cb40);}_0x4a57b9[_0xc976('0x56')]=rta[_0xc976('0x71')](_0x4a57b9);if(_0x4a57b9['globalStatus'][_0xc976('0x49')]('pause')){_0x34ae5c[_0xc976('0x67')](function(_0x5256eb){if(_0x4a57b9[_0x5256eb+_0xc976('0x69')]){_0x4a57b9[_0x5256eb+_0xc976('0x72')]=_0xc976('0x52');}});}return _0x4a57b9;});})[_0xc976('0x1b')](function(_0x404ea5){if(!_0x3c2a4e||_0x5b8b5c){return _0x404ea5;}return rta['sortAgentsByStatus'](_0x404ea5,_0x3c2a4e);})[_0xc976('0x1b')](function(_0x37c4a3){_0x405671['rows']=_0x37c4a3;return _0x405671;})['then'](respondWithFilteredResult(_0x3def97,_0xf89384))[_0xc976('0x1a')](handleError(_0x3def97,null));};exports[_0xc976('0x73')]=function(_0x1d67ab,_0x2c05bb){var _0x5017dd={'count':0x0,'rows':[]},_0x5d9699={},_0x177292,_0x521d78,_0x48e242,_0x43c25d,_0x2fe075;Promise[_0xc976('0x53')]()['then'](function(){if(_0x1d67ab[_0xc976('0x4e')]['channel'])_0x177292=validateChannel(_0x1d67ab[_0xc976('0x4e')]['channel']);var _0x19d435=_['startCase'](_0x177292)+'Queue';var _0x5ca535=_[_0xc976('0x34')](db[_0x19d435][_0xc976('0x74')],function(_0xe7d0e7){return{'name':_0xe7d0e7['fieldName'],'type':_0xe7d0e7[_0xc976('0x60')][_0xc976('0x61')]};});_0x5d9699=qs['getOptions'](_0x5ca535,_0x1d67ab);if(_0x1d67ab[_0xc976('0x6b')]['role']===_0xc976('0x6b')){var _0x171a59={'params':{'id':_0x1d67ab[_0xc976('0x6b')][_0xc976('0x75')]},'query':{'section':_0x177292==='voice'&&_0x1d67ab[_0xc976('0x4e')][_0xc976('0x60')]===_0xc976('0x23')?_0xc976('0x76'):_[_0xc976('0x46')](_0x177292)+_0xc976('0x15'),'type':_0x1d67ab['query'][_0xc976('0x60')],'nolimit':!![],'sort':'name','filter':_0x1d67ab['query'][_0xc976('0x3b')]}};return db[_0xc976('0x77')]['getResources'](_0x171a59);}return db[_0x19d435][_0xc976('0x6f')](_0x5d9699);})[_0xc976('0x1b')](function(_0x3c634e){_0x5017dd[_0xc976('0xe')]=_0x3c634e[_0xc976('0xe')];_0x521d78=_0x3c634e[_0xc976('0x5c')];return getRealtimeQueues(_0x1d67ab,_0x177292);})[_0xc976('0x1b')](function(_0x40f650){_0x43c25d=_0x40f650[_0xc976('0x5c')];return rta[_0xc976('0x5b')]();})[_0xc976('0x1b')](function(_0x16ef13){_0x48e242=_0x16ef13['rows'];if(_0x177292!=_0xc976('0x22'))return;return getRealtimeVoiceQueueChannels();})[_0xc976('0x1b')](function(_0x2cb31f){_0x2fe075=_0x2cb31f?_0x2cb31f[_0xc976('0x5c')]:[];return initializeQueues(_0x521d78,_0x43c25d,_0x177292,_0x1d67ab[_0xc976('0x4e')][_0xc976('0x60')]);})[_0xc976('0x1b')](function(_0x22a618){var _0x274b42=_0x22a618[_0xc976('0x34')](function(_0x5291c6){if(_0x177292===_0xc976('0x22'))return getVoiceQueueAgents(_0x5291c6,_0x521d78,_0x48e242,_0x2fe075);else return getQueueAgents(_0x5291c6,_0x48e242,_0x177292);});return Promise[_0xc976('0x78')](_0x274b42);})[_0xc976('0x1b')](function(_0x21aaee){_0x5017dd[_0xc976('0x5c')]=_0x21aaee;return _0x5017dd;})[_0xc976('0x1b')](respondWithFilteredResult(_0x2c05bb,_0x5d9699))[_0xc976('0x1a')](handleError(_0x2c05bb,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a762427..6d98289 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3e0e11,_0x2b8f9a){var _0x3f1cb1=function(_0x29d899){while(--_0x29d899){_0x3e0e11['push'](_0x3e0e11['shift']());}};_0x3f1cb1(++_0x2b8f9a);}(_0xedd9,0xfc));var _0x9edd=function(_0x3cdda5,_0x5bc6cb){_0x3cdda5=_0x3cdda5-0x0;var _0x3e2576=_0xedd9[_0x3cdda5];return _0x3e2576;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3c4885,_0x5ec7fe){var _0xf71c22=function(_0x5ae1af){while(--_0x5ae1af){_0x3c4885['push'](_0x3c4885['shift']());}};_0xf71c22(++_0x5ec7fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c8e72ad..99ab3ff 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 _0xdf70=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x31b53d,_0x24f792){var _0x1f6728=function(_0xcc8ba8){while(--_0xcc8ba8){_0x31b53d['push'](_0x31b53d['shift']());}};_0x1f6728(++_0x24f792);}(_0xdf70,0x86));var _0x0df7=function(_0x610a81,_0x34f514){_0x610a81=_0x610a81-0x0;var _0x53b967=_0xdf70[_0x610a81];return _0x53b967;};'use strict';var Sequelize=require(_0x0df7('0x0'));module[_0x0df7('0x1')]={'state':{'type':Sequelize[_0x0df7('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0df7('0x3')]},'uniqueid':{'type':Sequelize[_0x0df7('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0df7('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0df7('0x4')]},'campaigntype':{'type':Sequelize[_0x0df7('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d76=['STRING','DATE','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d76,0x76));var _0x69d7=function(_0x4e73ef,_0x417258){_0x4e73ef=_0x4e73ef-0x0;var _0x3acbd6=_0x9d76[_0x4e73ef];return _0x3acbd6;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'state':{'type':Sequelize[_0x69d7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x69d7('0x2')]},'scheduledat':{'type':Sequelize[_0x69d7('0x3')]},'uniqueid':{'type':Sequelize[_0x69d7('0x2')]},'starttime':{'type':Sequelize[_0x69d7('0x3')]},'responsetime':{'type':Sequelize[_0x69d7('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x69d7('0x2')]},'membername':{'type':Sequelize[_0x69d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fa08778..c4464f5 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 _0xd2d6=['path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0xd2d6,0x96));var _0x6d2d=function(_0x3e0ad0,_0x503c0e){_0x3e0ad0=_0x3e0ad0-0x0;var _0x2556ce=_0xd2d6[_0x3e0ad0];return _0x2556ce;};'use strict';var _=require(_0x6d2d('0x0'));var util=require(_0x6d2d('0x1'));var logger=require(_0x6d2d('0x2'))(_0x6d2d('0x3'));var moment=require(_0x6d2d('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d2d('0x5'));var fs=require('fs');var path=require(_0x6d2d('0x6'));var rimraf=require(_0x6d2d('0x7'));var config=require(_0x6d2d('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x6d2d('0x9')]=function(_0x1de82c,_0x337cf7){return _0x1de82c[_0x6d2d('0xa')](_0x6d2d('0xb'),attributes,{'tableName':_0x6d2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b9=['report_agent_preview','lodash','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0xc4213c,_0xcd5864){var _0x4fd490=function(_0x5c1ac6){while(--_0x5c1ac6){_0xc4213c['push'](_0xc4213c['shift']());}};_0x4fd490(++_0xcd5864);}(_0xd9b9,0x106));var _0x9d9b=function(_0x50261e,_0x2c859b){_0x50261e=_0x50261e-0x0;var _0x36925a=_0xd9b9[_0x50261e];return _0x36925a;};'use strict';var _=require(_0x9d9b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d9b('0x1'));var fs=require('fs');var path=require(_0x9d9b('0x2'));var rimraf=require(_0x9d9b('0x3'));var config=require(_0x9d9b('0x4'));var attributes=require(_0x9d9b('0x5'));module['exports']=function(_0x1492c5,_0x5c7492){return _0x1492c5[_0x9d9b('0x6')](_0x9d9b('0x7'),attributes,{'tableName':_0x9d9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index d6ea669..4cb6f17 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 _0x562f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x46aa6f,_0xf7b072){var _0x44759c=function(_0x97a501){while(--_0x97a501){_0x46aa6f['push'](_0x46aa6f['shift']());}};_0x44759c(++_0xf7b072);}(_0x562f,0x1d6));var _0xf562=function(_0x53d17e,_0xf979c9){_0x53d17e=_0x53d17e-0x0;var _0x35b0cc=_0x562f[_0x53d17e];return _0x35b0cc;};'use strict';var _=require(_0xf562('0x0'));var util=require(_0xf562('0x1'));var moment=require(_0xf562('0x2'));var BPromise=require(_0xf562('0x3'));var rs=require(_0xf562('0x4'));var fs=require('fs');var Redis=require(_0xf562('0x5'));var db=require(_0xf562('0x6'))['db'];var utils=require(_0xf562('0x7'));var logger=require(_0xf562('0x8'))('rpc');var config=require(_0xf562('0x9'));var jayson=require(_0xf562('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e9bc3,_0x4fb1e6,_0x1e556a){return new BPromise(function(_0x289ddd,_0x23601f){return client[_0xf562('0xb')](_0x3e9bc3,_0x1e556a)[_0xf562('0xc')](function(_0x23929f){logger[_0xf562('0xd')](_0xf562('0xe'),_0x4fb1e6,_0xf562('0xf'));logger[_0xf562('0x10')](_0xf562('0x11'),_0x4fb1e6,'request\x20sent',JSON[_0xf562('0x12')](_0x23929f));if(_0x23929f[_0xf562('0x13')]){if(_0x23929f[_0xf562('0x13')][_0xf562('0x14')]===0x1f4){logger[_0xf562('0x13')](_0xf562('0xe'),_0x4fb1e6,_0x23929f[_0xf562('0x13')]['message']);return _0x23601f(_0x23929f[_0xf562('0x13')]['message']);}logger[_0xf562('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x4fb1e6,_0x23929f[_0xf562('0x13')][_0xf562('0x15')]);return _0x289ddd(_0x23929f['error'][_0xf562('0x15')]);}else{logger[_0xf562('0xd')](_0xf562('0xe'),_0x4fb1e6,_0xf562('0xf'));_0x289ddd(_0x23929f[_0xf562('0x16')][_0xf562('0x15')]);}})['catch'](function(_0x589d03){logger[_0xf562('0x13')](_0xf562('0xe'),_0x4fb1e6,_0x589d03);_0x23601f(_0x589d03);});});}exports[_0xf562('0x17')]=function(_0x507804){var _0x574670=this;return new Promise(function(_0x4e8b3b,_0x293891){return db[_0xf562('0x18')][_0xf562('0x19')](_0x507804['body'],{'raw':_0x507804[_0xf562('0x1a')]?_0x507804[_0xf562('0x1a')][_0xf562('0x1b')]===undefined?!![]:![]:!![]})[_0xf562('0xc')](function(_0x4cc152){logger[_0xf562('0xd')](_0xf562('0x17'),_0x507804);logger[_0xf562('0x10')](_0xf562('0x17'),_0x507804,JSON[_0xf562('0x12')](_0x4cc152));_0x4e8b3b(_0x4cc152);})['catch'](function(_0x5a46d7){logger[_0xf562('0x13')](_0xf562('0x17'),_0x5a46d7[_0xf562('0x15')],_0x507804);_0x293891(_0x574670[_0xf562('0x13')](0x1f4,_0x5a46d7['message']));});});}; \ No newline at end of file +var _0x002c=['stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','then','info','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x3aeabb,_0x269c71){var _0x20669b=function(_0x2fd780){while(--_0x2fd780){_0x3aeabb['push'](_0x3aeabb['shift']());}};_0x20669b(++_0x269c71);}(_0x002c,0xd4));var _0xc002=function(_0x4cb280,_0x2b649d){_0x4cb280=_0x4cb280-0x0;var _0x3a05ae=_0x002c[_0x4cb280];return _0x3a05ae;};'use strict';var _=require(_0xc002('0x0'));var util=require(_0xc002('0x1'));var moment=require(_0xc002('0x2'));var BPromise=require(_0xc002('0x3'));var rs=require(_0xc002('0x4'));var fs=require('fs');var Redis=require(_0xc002('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc002('0x6'));var client=jayson[_0xc002('0x7')][_0xc002('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfa32,_0x197c57,_0x34f6c9){return new BPromise(function(_0x1abef1,_0x2f1e1d){return client['request'](_0xfa32,_0x34f6c9)['then'](function(_0x1a5d44){logger['info'](_0xc002('0x9'),_0x197c57,_0xc002('0xa'));logger[_0xc002('0xb')](_0xc002('0xc'),_0x197c57,_0xc002('0xa'),JSON[_0xc002('0xd')](_0x1a5d44));if(_0x1a5d44['error']){if(_0x1a5d44[_0xc002('0xe')][_0xc002('0xf')]===0x1f4){logger['error'](_0xc002('0x9'),_0x197c57,_0x1a5d44[_0xc002('0xe')][_0xc002('0x10')]);return _0x2f1e1d(_0x1a5d44['error'][_0xc002('0x10')]);}logger[_0xc002('0xe')](_0xc002('0x9'),_0x197c57,_0x1a5d44[_0xc002('0xe')][_0xc002('0x10')]);return _0x1abef1(_0x1a5d44['error']['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x197c57,'request\x20sent');_0x1abef1(_0x1a5d44[_0xc002('0x11')][_0xc002('0x10')]);}})['catch'](function(_0x593f7b){logger[_0xc002('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x197c57,_0x593f7b);_0x2f1e1d(_0x593f7b);});});}exports[_0xc002('0x12')]=function(_0x54f372){var _0x2a451f=this;return new Promise(function(_0x425355,_0x1d7724){return db[_0xc002('0x13')][_0xc002('0x14')](_0x54f372[_0xc002('0x15')],{'raw':_0x54f372[_0xc002('0x16')]?_0x54f372[_0xc002('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc002('0x17')](function(_0x36c5ea){logger[_0xc002('0x18')](_0xc002('0x12'),_0x54f372);logger['debug']('CreateReportAgentPreview',_0x54f372,JSON['stringify'](_0x36c5ea));_0x425355(_0x36c5ea);})['catch'](function(_0x11cdd8){logger[_0xc002('0xe')](_0xc002('0x12'),_0x11cdd8[_0xc002('0x10')],_0x54f372);_0x1d7724(_0x2a451f[_0xc002('0xe')](0x1f4,_0x11cdd8['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b36eb26..7d29ee7 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 _0xb676=['/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','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','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x29e7eb,_0x31eafb){var _0x3815f1=function(_0x1b39a1){while(--_0x1b39a1){_0x29e7eb['push'](_0x29e7eb['shift']());}};_0x3815f1(++_0x31eafb);}(_0xb676,0x1f2));var _0x6b67=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xb676[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require(_0x6b67('0x0'));var util=require(_0x6b67('0x1'));var path=require(_0x6b67('0x2'));var express=require('express');var router=express[_0x6b67('0x3')]();var auth=require(_0x6b67('0x4'));var controller=require(_0x6b67('0x5'));router['get']('/voice/channels',auth[_0x6b67('0x6')](),controller[_0x6b67('0x7')]);router[_0x6b67('0x8')](_0x6b67('0x9'),auth[_0x6b67('0x6')](),controller[_0x6b67('0xa')]);router[_0x6b67('0x8')](_0x6b67('0xb'),auth[_0x6b67('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x6b67('0x8')](_0x6b67('0xc'),auth['isAuthenticated'](),controller[_0x6b67('0xd')]);router[_0x6b67('0x8')](_0x6b67('0xe'),auth['isAuthenticated'](),controller[_0x6b67('0xf')]);router[_0x6b67('0x8')]('/mail/queues',auth[_0x6b67('0x6')](),controller[_0x6b67('0x10')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x6b67('0x11')]);router[_0x6b67('0x8')](_0x6b67('0x12'),auth[_0x6b67('0x6')](),controller['openchannelQueues']);router[_0x6b67('0x8')](_0x6b67('0x13'),auth[_0x6b67('0x6')](),controller['smsQueues']);router[_0x6b67('0x8')](_0x6b67('0x14'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x15')]);router[_0x6b67('0x8')](_0x6b67('0x16'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x17')]);router['get'](_0x6b67('0x18'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x19')]);router[_0x6b67('0x8')](_0x6b67('0x1a'),auth[_0x6b67('0x6')](),controller['voiceQueuesChannels']);router['get'](_0x6b67('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x6b67('0x1c'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x1d')]);router[_0x6b67('0x8')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6b67('0x6')](),controller[_0x6b67('0x1e')]);router[_0x6b67('0x8')](_0x6b67('0x1f'),auth['isAuthenticated'](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x6b67('0x6')](),controller[_0x6b67('0x20')]);router[_0x6b67('0x8')](_0x6b67('0x21'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x22')]);router[_0x6b67('0x8')](_0x6b67('0x23'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x24')]);router[_0x6b67('0x8')]('/agents',auth[_0x6b67('0x6')](),controller[_0x6b67('0x25')]);router[_0x6b67('0x26')](_0x6b67('0x27'),auth['isAuthenticated'](),controller[_0x6b67('0x28')]);router[_0x6b67('0x8')](_0x6b67('0x29'),auth['isAuthenticated'](),controller[_0x6b67('0x2a')]);router[_0x6b67('0x8')](_0x6b67('0x2b'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x2c')]);router[_0x6b67('0x8')](_0x6b67('0x2d'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x2e')]);router[_0x6b67('0x8')](_0x6b67('0x2f'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x30')]);router[_0x6b67('0x8')](_0x6b67('0x31'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x32')]);router[_0x6b67('0x8')](_0x6b67('0x33'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x34')]);router[_0x6b67('0x8')](_0x6b67('0x35'),auth[_0x6b67('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x6b67('0x8')](_0x6b67('0x36'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x37')]);router[_0x6b67('0x8')](_0x6b67('0x38'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x6b67('0x39'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x3a')]);router[_0x6b67('0x8')](_0x6b67('0x3b'),auth[_0x6b67('0x6')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x6b67('0x3c'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x3d')](_0x6b67('0x3e')));router[_0x6b67('0x8')](_0x6b67('0x3f'),auth['isAuthenticated'](),controller[_0x6b67('0x40')]);router[_0x6b67('0x41')]('/chat/queues/:id/notify',auth[_0x6b67('0x6')](),controller[_0x6b67('0x3d')](_0x6b67('0x42')));router[_0x6b67('0x8')](_0x6b67('0x43'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x44')]);router[_0x6b67('0x41')](_0x6b67('0x45'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x3d')](_0x6b67('0x46')));router['get'](_0x6b67('0x47'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x6b67('0x41')](_0x6b67('0x48'),auth[_0x6b67('0x6')](),controller['queueNotify']('openchannel'));router['get'](_0x6b67('0x49'),auth['isAuthenticated'](),controller[_0x6b67('0x4a')]);router['post'](_0x6b67('0x4b'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x3d')]('sms'));router[_0x6b67('0x41')](_0x6b67('0x4c'),auth[_0x6b67('0x6')](),controller['queueNotify'](_0x6b67('0x4d')));router[_0x6b67('0x8')](_0x6b67('0x4e'),auth[_0x6b67('0x6')](),controller[_0x6b67('0x4f')]);router['get']('/whatsapp/queues/:id',auth[_0x6b67('0x6')](),controller[_0x6b67('0x50')]);router['post']('/agents/:id/notify',auth[_0x6b67('0x6')](),controller['agentNotify']);module[_0x6b67('0x51')]=router; \ No newline at end of file +var _0x17bb=['express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path'];(function(_0x3bf6ac,_0x5a3f8c){var _0x4d8981=function(_0x3f0533){while(--_0x3f0533){_0x3bf6ac['push'](_0x3bf6ac['shift']());}};_0x4d8981(++_0x5a3f8c);}(_0x17bb,0x17a));var _0xb17b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x17bb[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xb17b('0x0'));var util=require('util');var path=require(_0xb17b('0x1'));var express=require(_0xb17b('0x2'));var router=express[_0xb17b('0x3')]();var auth=require(_0xb17b('0x4'));var controller=require(_0xb17b('0x5'));router[_0xb17b('0x6')](_0xb17b('0x7'),auth[_0xb17b('0x8')](),controller['voiceChannels']);router[_0xb17b('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xb17b('0x8')](),controller[_0xb17b('0x9')]);router[_0xb17b('0x6')](_0xb17b('0xa'),auth[_0xb17b('0x8')](),controller[_0xb17b('0xb')]);router['get'](_0xb17b('0xc'),auth[_0xb17b('0x8')](),controller[_0xb17b('0xd')]);router[_0xb17b('0x6')](_0xb17b('0xe'),auth[_0xb17b('0x8')](),controller[_0xb17b('0xf')]);router[_0xb17b('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0xb17b('0x10')]);router[_0xb17b('0x6')](_0xb17b('0x11'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x12')]);router['get']('/openchannel/queues',auth[_0xb17b('0x8')](),controller[_0xb17b('0x13')]);router[_0xb17b('0x6')]('/sms/queues',auth[_0xb17b('0x8')](),controller[_0xb17b('0x14')]);router['get'](_0xb17b('0x15'),auth[_0xb17b('0x8')](),controller['whatsappQueues']);router[_0xb17b('0x6')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0xb17b('0x6')](_0xb17b('0x16'),auth['isAuthenticated'](),controller[_0xb17b('0x17')]);router[_0xb17b('0x6')](_0xb17b('0x18'),auth['isAuthenticated'](),controller[_0xb17b('0x19')]);router[_0xb17b('0x6')](_0xb17b('0x1a'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x1b')]);router['get'](_0xb17b('0x1c'),auth['isAuthenticated'](),controller[_0xb17b('0x1d')]);router[_0xb17b('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xb17b('0x8')](),controller[_0xb17b('0x1e')]);router['get'](_0xb17b('0x1f'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x20')]);router[_0xb17b('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xb17b('0x22')]);router[_0xb17b('0x6')]('/outbound',auth[_0xb17b('0x8')](),controller[_0xb17b('0x23')]);router[_0xb17b('0x6')](_0xb17b('0x24'),auth[_0xb17b('0x8')](),controller['outboundChannels']);router[_0xb17b('0x6')]('/agents',auth[_0xb17b('0x8')](),controller[_0xb17b('0x25')]);router[_0xb17b('0x21')](_0xb17b('0x26'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x27')]);router['get'](_0xb17b('0x28'),auth['isAuthenticated'](),controller['telephones']);router[_0xb17b('0x6')](_0xb17b('0x29'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x2a')]);router['get'](_0xb17b('0x2b'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x2c')]);router[_0xb17b('0x6')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xb17b('0x2d')]);router[_0xb17b('0x6')]('/chat/queues/waitinginteractions',auth[_0xb17b('0x8')](),controller[_0xb17b('0x2e')]);router[_0xb17b('0x6')](_0xb17b('0x2f'),auth[_0xb17b('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xb17b('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xb17b('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xb17b('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xb17b('0x6')](_0xb17b('0x30'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x31')]);router[_0xb17b('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xb17b('0x8')](),controller[_0xb17b('0x32')]);router[_0xb17b('0x6')](_0xb17b('0x33'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x34')]);router[_0xb17b('0x35')](_0xb17b('0x36'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x37')]('mail'));router['get'](_0xb17b('0x38'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x39')]);router[_0xb17b('0x35')](_0xb17b('0x3a'),auth['isAuthenticated'](),controller[_0xb17b('0x37')]('chat'));router[_0xb17b('0x6')](_0xb17b('0x3b'),auth[_0xb17b('0x8')](),controller['showChatQueues']);router['post'](_0xb17b('0x3c'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x37')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xb17b('0x3d')]);router[_0xb17b('0x35')](_0xb17b('0x3e'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x37')](_0xb17b('0x3f')));router[_0xb17b('0x6')](_0xb17b('0x40'),auth['isAuthenticated'](),controller[_0xb17b('0x41')]);router[_0xb17b('0x35')](_0xb17b('0x42'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0xb17b('0x35')](_0xb17b('0x43'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x37')](_0xb17b('0x44')));router[_0xb17b('0x6')](_0xb17b('0x45'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x46')]);router['get'](_0xb17b('0x47'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x48')]);router['post'](_0xb17b('0x49'),auth['isAuthenticated'](),controller[_0xb17b('0x4a')]);module[_0xb17b('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0ba97e8..76e725f 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 _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x3f9d0a,_0x2d079c){var _0x2e5b31=function(_0x1b052d){while(--_0x1b052d){_0x3f9d0a['push'](_0x3f9d0a['shift']());}};_0x2e5b31(++_0x2d079c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x5fc3[_0x2eb3db];return _0x358f33;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file +var _0x2675=['request','error','result','catch','status','json','sendStatus','name','send','isNil','rows','find','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','then','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','merge','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','MemberReport','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','Message','findOne','agentTransferTimeout','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0x2675,0x75));var _0x5267=function(_0x28d315,_0x5150e5){_0x28d315=_0x28d315-0x0;var _0x8b4b7a=_0x2675[_0x28d315];return _0x8b4b7a;};'use strict';var BPromise=require(_0x5267('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x5267('0x1'))['db'];var logger=require(_0x5267('0x2'))('api');var jayson=require(_0x5267('0x3'));var amiClient=jayson[_0x5267('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232b});var routingClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){var _0x506fd7=_0x527c16?_0x527c16:amiClient;return _0x506fd7[_0x5267('0x6')](_0x20f065,_0xc56cd5)['then'](function(_0x3ff4e9){if(_0x3ff4e9[_0x5267('0x7')]){if(_0x3ff4e9[_0x5267('0x7')]['code']===0x1f4){return _0x46bfdf(_0x3ff4e9[_0x5267('0x7')]['message']);}return _0x9e0a27(_0x3ff4e9[_0x5267('0x7')]['message']);}else{_0x9e0a27(_0x3ff4e9[_0x5267('0x8')]);}})[_0x5267('0x9')](function(_0x268a8a){_0x46bfdf(_0x268a8a);});});}function respondWithResult(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xc8;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0xa')](_0x1d7090)[_0x5267('0xb')](_0x1171b9);}return _0x1f9be3[_0x5267('0xc')](0x194);};}function handleError(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0x1f4;return function(_0x29349a){logger[_0x5267('0x7')](_0x29349a['stack']);if(_0x29349a['name']){delete _0x29349a[_0x5267('0xd')];}_0x1e2d3b[_0x5267('0xa')](_0x16e5a7)[_0x5267('0xe')](_0x29349a);};}function findById(_0x3f5344){return function(_0x46b2c2){if(!_[_0x5267('0xf')](_0x3f5344)&&!_[_0x5267('0xf')](_0x46b2c2)&&!_[_0x5267('0xf')](_0x46b2c2[_0x5267('0x10')])){return _[_0x5267('0x11')](_0x46b2c2[_0x5267('0x10')],function(_0x1ab03){return _0x1ab03['id']==_0x3f5344;});}return null;};}exports['voiceChannels']=function(_0x18f32e,_0x2afd38){return respondWithRpcPromise('VoiceChannels',_0x18f32e[_0x5267('0x12')])['then'](respondWithResult(_0x2afd38,null))[_0x5267('0x9')](handleError(_0x2afd38,null));};exports[_0x5267('0x13')]=function(_0x39c0c3,_0x2a9f99){return respondWithRpcPromise(_0x5267('0x14'),_['merge'](_0x39c0c3[_0x5267('0x12')],_0x39c0c3['params']))[_0x5267('0x15')](respondWithResult(_0x2a9f99,null))[_0x5267('0x9')](handleError(_0x2a9f99,null));};exports[_0x5267('0x16')]=function(_0x56dd95,_0x499f19){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x56dd95['query'],_0x56dd95[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x499f19,null))[_0x5267('0x9')](handleError(_0x499f19,null));};exports[_0x5267('0x18')]=function(_0x11c8ea,_0x40d1be){return respondWithRpcPromise(_0x5267('0x19'),_0x11c8ea[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x40d1be,null))['catch'](handleError(_0x40d1be,null));};exports['showVoiceQueues']=function(_0x354111,_0x472938){return respondWithRpcPromise('VoiceQueues',_0x354111[_0x5267('0x12')])['then'](findById(_0x354111['params']['id']))[_0x5267('0x15')](respondWithResult(_0x472938,null))[_0x5267('0x9')](handleError(_0x472938,null));};exports[_0x5267('0x1a')]=function(_0x2d2ace,_0x33c431){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x2d2ace[_0x5267('0x1b')],_0x2d2ace[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x33c431,null))['catch'](handleError(_0x33c431,null));};exports['voiceQueuesPreview']=function(_0xbe7922,_0x3ef2a8){return respondWithRpcPromise(_0x5267('0x1c'),_['merge'](_0xbe7922['query'],_0xbe7922[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x3ef2a8,null))[_0x5267('0x9')](handleError(_0x3ef2a8,null));};exports[_0x5267('0x1d')]=function(_0x5bbb83,_0x33e456){return respondWithRpcPromise(_0x5267('0x1e'),_0x5bbb83[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x33e456,null))[_0x5267('0x9')](handleError(_0x33e456,null));};exports[_0x5267('0x1f')]=function(_0x341bae,_0x1dda95){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x341bae[_0x5267('0x12')],_0x341bae['params']))[_0x5267('0x15')](respondWithResult(_0x1dda95,null))[_0x5267('0x9')](handleError(_0x1dda95,null));};exports[_0x5267('0x20')]=function(_0x3a729c,_0x4ac4a0){return respondWithRpcPromise(_0x5267('0x21'),_[_0x5267('0x22')](_0x3a729c[_0x5267('0x12')],_0x3a729c[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x4ac4a0,null))[_0x5267('0x9')](handleError(_0x4ac4a0,null));};exports[_0x5267('0x23')]=function(_0xa0ea89,_0x484b77){return respondWithRpcPromise(_0x5267('0x24'),_['merge'](_0xa0ea89[_0x5267('0x12')],_0xa0ea89[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x484b77,null))[_0x5267('0x9')](handleError(_0x484b77,null));};exports[_0x5267('0x25')]=function(_0x33ecd7,_0x465ad9){return respondWithRpcPromise('Outbound',_0x33ecd7[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x465ad9,null))[_0x5267('0x9')](handleError(_0x465ad9,null));};exports[_0x5267('0x26')]=function(_0x82cea7,_0x21eabf){return respondWithRpcPromise(_0x5267('0x27'),_0x82cea7['query'])[_0x5267('0x15')](respondWithResult(_0x21eabf,null))['catch'](handleError(_0x21eabf,null));};exports[_0x5267('0x28')]=function(_0x5c0cdf,_0x4dee66){var _0x51bddd;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf['query'])[_0x5267('0x15')](function(_0x146476){_0x51bddd=_0x146476;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf[_0x5267('0x12')],routingClient);})['then'](function(_0x456b33){return _[_0x5267('0x22')]({},_0x456b33,_0x51bddd);})['then'](respondWithResult(_0x4dee66,null))['catch'](handleError(_0x4dee66,null));};exports[_0x5267('0x2a')]=function(_0x560cdf,_0x12df83){if(_0x560cdf[_0x5267('0x1b')]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')]&&_0x560cdf[_0x5267('0x2c')]&&_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]){for(var _0x5697b3 in _0x560cdf['body'][_0x5267('0x2b')]){if(_0x560cdf['body'][_0x5267('0x2b')][_0x5267('0x2d')](_0x5697b3)){db['MemberReport'][_0x5267('0x2e')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'type':_0x5267('0x2f'),'exitAt':null,'uniqueid':_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3][_0x5267('0x30')]?{'$notIn':_0x560cdf['body'][_0x5267('0x2b')][_0x5697b3]}:{'$ne':null}}})[_0x5267('0x15')](function(_0x19b015){var _0x45241a=moment()[_0x5267('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d15ac=0x0,_0x4e0132=_0x19b015[_0x5267('0x30')];_0x3d15ac<_0x4e0132;_0x3d15ac+=0x1){_0x19b015[_0x3d15ac]['updateAttributes']({'exitAt':_0x45241a});}});for(var _0x4ae9f9=0x0;_0x4ae9f9<_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x5267('0x30')];_0x4ae9f9+=0x1){db[_0x5267('0x32')][_0x5267('0x33')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')]['name'],'type':_0x5267('0x2f'),'uniqueid':_0x560cdf['body']['interaction'][_0x5697b3][_0x4ae9f9],'exitAt':null},'defaults':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'interface':_['isNil'](_0x560cdf['user'][_0x5267('0x34')])?util[_0x5267('0x31')](_0x5267('0x35'),_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]):_0x560cdf[_0x5267('0x2c')][_0x5267('0x34')],'type':_0x5267('0x2f'),'enterAt':moment()[_0x5267('0x31')](_0x5267('0x36')),'role':_0x5267('0x37'),'internal':_0x560cdf[_0x5267('0x2c')][_0x5267('0x38')],'uniqueid':_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x4ae9f9]}});}}}}return respondWithRpcPromise(_0x5267('0x39'),{'id':_0x560cdf[_0x5267('0x17')]['id'],'capacity':_0x560cdf[_0x5267('0x1b')]['capacity']},routingClient)[_0x5267('0x15')](respondWithResult(_0x12df83,null))[_0x5267('0x9')](handleError(_0x12df83,null));};exports[_0x5267('0x3a')]=function(_0x2a97f1,_0x119546){return respondWithRpcPromise(_0x5267('0x3b'),_0x2a97f1['query'])[_0x5267('0x15')](respondWithResult(_0x119546,null))['catch'](handleError(_0x119546,null));};exports[_0x5267('0x3c')]=function(_0x30fcd2,_0xa49fd7){return respondWithRpcPromise(_0x5267('0x3d'),_0x30fcd2[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0xa49fd7,null))[_0x5267('0x9')](handleError(_0xa49fd7,null));};exports['campaigns']=function(_0x57ca8f,_0x200855){return respondWithRpcPromise(_0x5267('0x3e'),_0x57ca8f['query'])[_0x5267('0x15')](respondWithResult(_0x200855,null))['catch'](handleError(_0x200855,null));};exports['chatQueues']=function(_0x1eeb21,_0x79cee1){return respondWithRpcPromise(_0x5267('0x3f'),_0x1eeb21[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x79cee1,null))[_0x5267('0x9')](handleError(_0x79cee1,null));};exports[_0x5267('0x40')]=function(_0x3fd8f9,_0xf0b5a9){return respondWithRpcPromise(_0x5267('0x3f'),_0x3fd8f9['query'],routingClient)[_0x5267('0x15')](findById(_0x3fd8f9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0xf0b5a9,null))[_0x5267('0x9')](handleError(_0xf0b5a9,null));};exports[_0x5267('0x41')]=function(_0x34c205,_0x552211){return respondWithRpcPromise(_0x5267('0x42'),_0x34c205['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x552211,null))[_0x5267('0x9')](handleError(_0x552211,null));};exports[_0x5267('0x43')]=function(_0x4a72c3,_0x1593ce){return respondWithRpcPromise(_0x5267('0x42'),_0x4a72c3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x4a72c3[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1593ce,null))['catch'](handleError(_0x1593ce,null));};exports[_0x5267('0x44')]=function(_0x190d02,_0x186667){return respondWithRpcPromise(_0x5267('0x45'),_0x190d02['query'],mailClient)['then'](respondWithResult(_0x186667,null))[_0x5267('0x9')](handleError(_0x186667,null));};exports['openchannelQueues']=function(_0x3f5cda,_0x47059c){return respondWithRpcPromise('OpenchannelQueues',_0x3f5cda['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x47059c,null))[_0x5267('0x9')](handleError(_0x47059c,null));};exports[_0x5267('0x46')]=function(_0x537f75,_0x457dca){return respondWithRpcPromise(_0x5267('0x47'),_0x537f75[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x537f75['params']['id']))['then'](respondWithResult(_0x457dca,null))['catch'](handleError(_0x457dca,null));};exports[_0x5267('0x48')]=function(_0x2457a3,_0x45ee25){return respondWithRpcPromise(_0x5267('0x49'),_0x2457a3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x45ee25,null))[_0x5267('0x9')](handleError(_0x45ee25,null));};exports[_0x5267('0x4a')]=function(_0x486b02,_0x1ddfad){return respondWithRpcPromise(_0x5267('0x49'),_0x486b02['query'],routingClient)[_0x5267('0x15')](findById(_0x486b02[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1ddfad,null))[_0x5267('0x9')](handleError(_0x1ddfad,null));};exports[_0x5267('0x4b')]=function(_0xde1ecd,_0x4915f4){return respondWithRpcPromise(_0x5267('0x4c'),_0xde1ecd[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x4915f4,null))[_0x5267('0x9')](handleError(_0x4915f4,null));};exports[_0x5267('0x4d')]=function(_0xd9bcf9,_0x4aac32){return respondWithRpcPromise(_0x5267('0x4c'),_0xd9bcf9[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0xd9bcf9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x4aac32,null))[_0x5267('0x9')](handleError(_0x4aac32,null));};exports['faxQueues']=function(_0x283423,_0x41299c){return respondWithRpcPromise(_0x5267('0x4e'),_0x283423[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x41299c,null))['catch'](handleError(_0x41299c,null));};exports['showFaxQueues']=function(_0x910f97,_0x5cca85){return respondWithRpcPromise(_0x5267('0x4e'),_0x910f97['query'],routingClient)[_0x5267('0x15')](findById(_0x910f97[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x5cca85,null))[_0x5267('0x9')](handleError(_0x5cca85,null));};exports[_0x5267('0x4f')]=function(_0xa92aa5,_0x21338f){return respondWithRpcPromise(_0x5267('0x50'),_0xa92aa5['query'])['then'](respondWithResult(_0x21338f,null))['catch'](handleError(_0x21338f,null));};exports[_0x5267('0x51')]=function(_0x28a101,_0x2ab2be){return respondWithRpcPromise(_0x5267('0x52'),_0x28a101['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x2ab2be,null))[_0x5267('0x9')](handleError(_0x2ab2be,null));};exports[_0x5267('0x53')]=function(_0xc3ac3f,_0x5a0e73){return respondWithRpcPromise(_0x5267('0x54'),_0xc3ac3f[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x5a0e73,null))[_0x5267('0x9')](handleError(_0x5a0e73,null));};exports[_0x5267('0x55')]=function(_0x4a9995,_0x47e235){return respondWithRpcPromise(_0x5267('0x56'),_0x4a9995[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x47e235,null))['catch'](handleError(_0x47e235,null));};exports[_0x5267('0x57')]=function(_0x2e7f8a,_0x35b302){return respondWithRpcPromise(_0x5267('0x56'),_0x2e7f8a[_0x5267('0x12')],routingClient)['then'](function(_0x4643ae){if(_0x2e7f8a[_0x5267('0x12')]['type']!==undefined){var _0x26c628=_(_0x4643ae[_0x5267('0x10')])[_0x5267('0x58')]([_0x2e7f8a[_0x5267('0x12')][_0x5267('0x59')],_0x2e7f8a[_0x5267('0x17')]['id']])[_0x5267('0x5a')](_0x5267('0x5b'))['uniq']()['value']();return _0x4643ae[_0x5267('0x10')][_0x5267('0x58')](function(_0x3f729f){return _0x26c628[_0x5267('0x5c')](_0x3f729f['queue_id'])>-0x1;});}else{return _0x4643ae[_0x5267('0x10')]['filter'](function(_0x2988a1){return _0x2988a1[_0x5267('0x5b')]===parseInt(_0x2e7f8a[_0x5267('0x17')]['id']);});}})[_0x5267('0x15')](respondWithResult(_0x35b302,null))['catch'](handleError(_0x35b302,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a67a0,_0x3e2cf5){return respondWithRpcPromise(_0x5267('0x5d'),_0x3a67a0[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x3e2cf5,null))[_0x5267('0x9')](handleError(_0x3e2cf5,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1b8d72,_0x4a05c9){return respondWithRpcPromise(_0x5267('0x5e'),_0x1b8d72['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x4a05c9,null))[_0x5267('0x9')](handleError(_0x4a05c9,null));};exports[_0x5267('0x5f')]=function(_0x87aa90,_0x164cc1){return respondWithRpcPromise(_0x5267('0x60'),_0x87aa90[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x164cc1,null))[_0x5267('0x9')](handleError(_0x164cc1,null));};exports[_0x5267('0x61')]=function(_0x555c8){return function(_0x531bb9,_0x40c7b5){var _0x14baf4,_0x4d9ec9;var _0xde179f=_[_0x5267('0x62')](_0x555c8);var _0x3ebda6=_0x555c8===_0x5267('0x63')?_0x5267('0x64'):_0x5267('0x65');return db[_0xde179f+_0x5267('0x66')]['findOne']({'raw':!![],'where':{'id':_0x531bb9[_0x5267('0x17')]['id']}})[_0x5267('0x15')](function(_0x2543a4){if(_[_0x5267('0xf')](_0x2543a4)){throw new Error(_0xde179f+_0x5267('0x67'));}_0x14baf4=_0x2543a4;return db[_0xde179f+'Message']['findOne']({'where':{'id':_0x531bb9[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0xde179f+_0x5267('0x69')],'as':_0x5267('0x69')},{'model':db[_0xde179f+_0x3ebda6],'as':'Account'}]});})[_0x5267('0x15')](function(_0x3cc775){if(_[_0x5267('0xf')](_0x3cc775)){throw new Error(_0xde179f+_0x5267('0x6a'));}_0x4d9ec9=_0x3cc775;return _0x3cc775[_0x5267('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x2b38f2={'uniqueid':_0x555c8+'.'+_0x4d9ec9['id']+'.'+_0x4d9ec9[_0x5267('0x69')]['id'],'FromUserId':_0x531bb9[_0x5267('0x2c')]['id'],'type':_0x5267('0x6c')};_0x2b38f2[_0xde179f+_0x5267('0x6d')]=_0x4d9ec9['id'];_0x2b38f2[_0xde179f+_0x5267('0x6e')]=_0x4d9ec9[_0x5267('0x69')]['id'];_0x2b38f2['From'+_0xde179f+_0x3ebda6+'Id']=_0x4d9ec9[_0x5267('0x65')]['id'];_0x2b38f2['To'+_0xde179f+_0x5267('0x6f')]=_0x14baf4['id'];return db[_0xde179f+_0x5267('0x70')][_0x5267('0x71')](_0x2b38f2);})[_0x5267('0x15')](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x555c8,'interaction':_0x4d9ec9[_0x5267('0x69')],'message':_0x4d9ec9,'account':_0x4d9ec9[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x6c'),'appdata':_0x14baf4[_0x5267('0xd')]+','+(_0x4d9ec9[_0x5267('0x65')][_0x5267('0x73')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x40c7b5,null))[_0x5267('0x9')](handleError(_0x40c7b5,null));};};exports[_0x5267('0x75')]=function(_0x28884b,_0x35a4a3){var _0x7ecf0e,_0x676556;if(_[_0x5267('0xf')](_0x28884b[_0x5267('0x1b')][_0x5267('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x339f3f=_0x28884b[_0x5267('0x1b')][_0x5267('0x76')];var _0x405eb4=_[_0x5267('0x62')](_0x339f3f);var _0x557749=_0x339f3f===_0x5267('0x63')?_0x5267('0x64'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x28884b[_0x5267('0x17')]['id'],'role':'agent'}})[_0x5267('0x15')](function(_0x54422c){if(_['isNil'](_0x54422c)){throw new Error(_0x5267('0x77'));}_0x7ecf0e=_0x54422c;return db[_0x405eb4+_0x5267('0x78')][_0x5267('0x79')]({'where':{'id':_0x28884b[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0x405eb4+'Interaction'],'as':'Interaction'},{'model':db[_0x405eb4+_0x557749],'as':_0x5267('0x65')}]});})[_0x5267('0x15')](function(_0x1a6245){if(_[_0x5267('0xf')](_0x1a6245)){throw new Error(_0x405eb4+_0x5267('0x6a'));}_0x676556=_0x1a6245;return _0x1a6245['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x5bece1={'uniqueid':_0x339f3f+'.'+_0x676556['id']+'.'+_0x676556['Interaction']['id'],'FromUserId':_0x28884b[_0x5267('0x2c')]['id'],'type':'queue','ToUserId':_0x7ecf0e['id']};_0x5bece1[_0x405eb4+'MessageId']=_0x676556['id'];_0x5bece1[_0x405eb4+_0x5267('0x6e')]=_0x676556[_0x5267('0x69')]['id'];_0x5bece1['From'+_0x405eb4+_0x557749+'Id']=_0x676556['Account']['id'];return db[_0x405eb4+'TransferReport'][_0x5267('0x71')](_0x5bece1);})['then'](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x339f3f,'interaction':_0x676556['Interaction'],'message':_0x676556,'account':_0x676556[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x37'),'appdata':_0x7ecf0e['name']+','+(_0x676556[_0x5267('0x65')][_0x5267('0x7a')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x35a4a3,null))[_0x5267('0x9')](handleError(_0x35a4a3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 126e286..982e721 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 _0xc8e2=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x2d7ed7,_0x27d3e1){var _0x13f48f=function(_0x1b07b1){while(--_0x1b07b1){_0x2d7ed7['push'](_0x2d7ed7['shift']());}};_0x13f48f(++_0x27d3e1);}(_0xc8e2,0x71));var _0x2c8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8e2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2c8e('0x0'));var util=require('util');var path=require(_0x2c8e('0x1'));var timeout=require(_0x2c8e('0x2'));var express=require('express');var router=express[_0x2c8e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c8e('0x4'));var interaction=require(_0x2c8e('0x5'));var config=require(_0x2c8e('0x6'));var controller=require(_0x2c8e('0x7'));router[_0x2c8e('0x8')]('/',auth[_0x2c8e('0x9')](),controller[_0x2c8e('0xa')]);router[_0x2c8e('0x8')](_0x2c8e('0xb'),auth['isAuthenticated'](),controller[_0x2c8e('0xc')]);router[_0x2c8e('0x8')]('/:id/run',auth[_0x2c8e('0x9')](),controller['run']);router[_0x2c8e('0xd')]('/',auth[_0x2c8e('0x9')](),controller[_0x2c8e('0xe')]);router[_0x2c8e('0xf')](_0x2c8e('0xb'),auth[_0x2c8e('0x9')](),controller[_0x2c8e('0x10')]);router[_0x2c8e('0x11')](_0x2c8e('0xb'),auth[_0x2c8e('0x9')](),controller['destroy']);module[_0x2c8e('0x12')]=router; \ No newline at end of file +var _0x92f4=['isAuthenticated','show','/:id/run','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2e497e,_0x533e65){var _0x2b6b91=function(_0x1ca4bc){while(--_0x1ca4bc){_0x2e497e['push'](_0x2e497e['shift']());}};_0x2b6b91(++_0x533e65);}(_0x92f4,0x172));var _0x492f=function(_0xf433fa,_0x32e751){_0xf433fa=_0xf433fa-0x0;var _0x46c91a=_0x92f4[_0xf433fa];return _0x46c91a;};'use strict';var multer=require(_0x492f('0x0'));var util=require(_0x492f('0x1'));var path=require(_0x492f('0x2'));var timeout=require(_0x492f('0x3'));var express=require(_0x492f('0x4'));var router=express['Router']();var fs_extra=require(_0x492f('0x5'));var auth=require(_0x492f('0x6'));var interaction=require(_0x492f('0x7'));var config=require(_0x492f('0x8'));var controller=require('./schedule.controller');router[_0x492f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x492f('0xa')](),controller[_0x492f('0xb')]);router[_0x492f('0x9')](_0x492f('0xc'),auth[_0x492f('0xa')](),controller['run']);router[_0x492f('0xd')]('/',auth[_0x492f('0xa')](),controller[_0x492f('0xe')]);router[_0x492f('0xf')]('/:id',auth[_0x492f('0xa')](),controller[_0x492f('0x10')]);router[_0x492f('0x11')](_0x492f('0x12'),auth[_0x492f('0xa')](),controller['destroy']);module[_0x492f('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f796bff..dc3e649 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 _0xdb7c=['STRING','BOOLEAN','DATE','ENUM','years','months','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports'];(function(_0x36ed46,_0x3a764c){var _0x1d06c9=function(_0x318ee4){while(--_0x318ee4){_0x36ed46['push'](_0x36ed46['shift']());}};_0x1d06c9(++_0x3a764c);}(_0xdb7c,0x163));var _0xcdb7=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xdb7c[_0x32f9ca];return _0x52e083;};'use strict';var Sequelize=require(_0xcdb7('0x0'));module[_0xcdb7('0x1')]={'name':{'type':Sequelize[_0xcdb7('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcdb7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xcdb7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcdb7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcdb7('0x5')](_0xcdb7('0x6'),'quarters',_0xcdb7('0x7'),'weeks','days',_0xcdb7('0x8'),_0xcdb7('0x9')),'allowNull':![],'defaultValue':_0xcdb7('0xa')},'output':{'type':Sequelize[_0xcdb7('0x5')](_0xcdb7('0xb'),_0xcdb7('0xc'),_0xcdb7('0xd')),'allowNull':![],'defaultValue':_0xcdb7('0xb')},'type':{'type':Sequelize[_0xcdb7('0x5')](_0xcdb7('0xe'),_0xcdb7('0xf')),'allowNull':![],'defaultValue':_0xcdb7('0xe')},'sendMail':{'type':Sequelize[_0xcdb7('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xcdb7('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4285=['weeks','days','hours','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years'];(function(_0x45db48,_0x270097){var _0x416824=function(_0x5ba2ac){while(--_0x5ba2ac){_0x45db48['push'](_0x45db48['shift']());}};_0x416824(++_0x270097);}(_0x4285,0x84));var _0x5428=function(_0x238eb5,_0x513c96){_0x238eb5=_0x238eb5-0x0;var _0x182014=_0x4285[_0x238eb5];return _0x182014;};'use strict';var Sequelize=require(_0x5428('0x0'));module[_0x5428('0x1')]={'name':{'type':Sequelize[_0x5428('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5428('0x2')]},'active':{'type':Sequelize[_0x5428('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5428('0x4')},'startAt':{'type':Sequelize[_0x5428('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5428('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5428('0x6')](_0x5428('0x7'),'quarters','months',_0x5428('0x8'),_0x5428('0x9'),_0x5428('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x5428('0x9')},'output':{'type':Sequelize[_0x5428('0x6')](_0x5428('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x5428('0x6')](_0x5428('0xc'),'default'),'allowNull':![],'defaultValue':_0x5428('0xc')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5428('0x2')]},'cc':{'type':Sequelize[_0x5428('0xd')]},'bcc':{'type':Sequelize[_0x5428('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x5428('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 182d54c..d3bd2be 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 _0x6413=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','includeAll','include','findAll','rows','params','length','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule'];(function(_0x45d003,_0x40f78a){var _0x331760=function(_0x47466f){while(--_0x47466f){_0x45d003['push'](_0x45d003['shift']());}};_0x331760(++_0x40f78a);}(_0x6413,0x164));var _0x3641=function(_0x5e5393,_0x5e83e6){_0x5e5393=_0x5e5393-0x0;var _0x56cc23=_0x6413[_0x5e5393];return _0x56cc23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3641('0x0'));var zipdir=require(_0x3641('0x1'));var jsonpatch=require(_0x3641('0x2'));var rp=require(_0x3641('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3641('0x4'));var path=require('path');var sox=require(_0x3641('0x5'));var csv=require(_0x3641('0x6'));var ejs=require(_0x3641('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3641('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3641('0x9'));var deskjs=require(_0x3641('0xa'));var toCsv=require(_0x3641('0x6'));var querystring=require(_0x3641('0xb'));var Papa=require(_0x3641('0xc'));var Redis=require('ioredis');var authService=require(_0x3641('0xd'));var qs=require(_0x3641('0xe'));var as=require(_0x3641('0xf'));var hardwareService=require(_0x3641('0x10'));var logger=require(_0x3641('0x11'))('api');var utils=require(_0x3641('0x12'));var config=require(_0x3641('0x13'));var licenseUtil=require(_0x3641('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1156ad,_0x5a10e1){_0x5a10e1=_0x5a10e1||0xcc;return function(_0x1cbbc1){if(_0x1cbbc1){return _0x1156ad[_0x3641('0x15')](_0x5a10e1);}return _0x1156ad[_0x3641('0x16')](_0x5a10e1)[_0x3641('0x17')]();};}function respondWithResult(_0x3d2459,_0x4bded5){_0x4bded5=_0x4bded5||0xc8;return function(_0x1eb1a5){if(_0x1eb1a5){return _0x3d2459[_0x3641('0x16')](_0x4bded5)[_0x3641('0x18')](_0x1eb1a5);}};}function respondWithFilteredResult(_0x2070b6,_0x313178){return function(_0x286978){if(_0x286978){var _0x255f4e=typeof _0x313178[_0x3641('0x19')]===_0x3641('0x1a')&&typeof _0x313178[_0x3641('0x1b')]==='undefined';var _0x3791e9=_0x286978[_0x3641('0x1c')];var _0x57ae41=_0x255f4e?0x0:_0x313178['offset'];var _0x49d663=_0x255f4e?_0x286978[_0x3641('0x1c')]:_0x313178[_0x3641('0x19')]+_0x313178[_0x3641('0x1b')];var _0x2efec4;if(_0x49d663>=_0x3791e9){_0x49d663=_0x3791e9;_0x2efec4=0xc8;}else{_0x2efec4=0xce;}_0x2070b6['status'](_0x2efec4);return _0x2070b6[_0x3641('0x1d')](_0x3641('0x1e'),_0x57ae41+'-'+_0x49d663+'/'+_0x3791e9)[_0x3641('0x18')](_0x286978);}return null;};}function patchUpdates(_0x41822b){return function(_0x528abe){try{jsonpatch['apply'](_0x528abe,_0x41822b,!![]);}catch(_0xbdf08){return BPromise[_0x3641('0x1f')](_0xbdf08);}return _0x528abe['save']();};}function saveUpdates(_0x6fa5d9,_0x3316b3){return function(_0x5452d0){if(_0x5452d0){return _0x5452d0['update'](_0x6fa5d9)[_0x3641('0x20')](function(_0x4ae7a5){return _0x4ae7a5;});}return null;};}function removeEntity(_0x3e54a6,_0x430472){return function(_0x4db696){if(_0x4db696){return _0x4db696[_0x3641('0x21')]()[_0x3641('0x20')](function(){var _0x25c875=_0x4db696[_0x3641('0x22')]({'plain':!![]});var _0x200d4a=_0x3641('0x23');return db[_0x3641('0x24')][_0x3641('0x21')]({'where':{'type':_0x200d4a,'resourceId':_0x25c875['id']}})[_0x3641('0x20')](function(){return _0x4db696;});})[_0x3641('0x20')](function(){_0x3e54a6[_0x3641('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a842a,_0x4a5143){return function(_0x259f7f){if(!_0x259f7f){_0x1a842a[_0x3641('0x15')](0x194);}return _0x259f7f;};}function handleError(_0x1c2bf4,_0x5d56b9){_0x5d56b9=_0x5d56b9||0x1f4;return function(_0x49eefa){logger[_0x3641('0x25')](_0x49eefa[_0x3641('0x26')]);if(_0x49eefa[_0x3641('0x27')]){delete _0x49eefa[_0x3641('0x27')];}_0x1c2bf4[_0x3641('0x16')](_0x5d56b9)[_0x3641('0x28')](_0x49eefa);};}exports[_0x3641('0x29')]=function(_0x238c24,_0x28acbb){var _0x3b1406={},_0x53a7fe={},_0x2d76c0={'count':0x0,'rows':[]};var _0x2dd1d0=_[_0x3641('0x2a')](db[_0x3641('0x2b')][_0x3641('0x2c')],function(_0x10e92c){return{'name':_0x10e92c['fieldName'],'type':_0x10e92c[_0x3641('0x2d')][_0x3641('0x2e')]};});_0x53a7fe[_0x3641('0x2f')]=_[_0x3641('0x2a')](_0x2dd1d0,_0x3641('0x27'));_0x53a7fe['query']=_[_0x3641('0x30')](_0x238c24[_0x3641('0x31')]);_0x53a7fe[_0x3641('0x32')]=_[_0x3641('0x33')](_0x53a7fe[_0x3641('0x2f')],_0x53a7fe[_0x3641('0x31')]);_0x3b1406[_0x3641('0x34')]=_[_0x3641('0x33')](_0x53a7fe[_0x3641('0x2f')],qs[_0x3641('0x35')](_0x238c24[_0x3641('0x31')][_0x3641('0x35')]));_0x3b1406['attributes']=_0x3b1406[_0x3641('0x34')]['length']?_0x3b1406[_0x3641('0x34')]:_0x53a7fe[_0x3641('0x2f')];if(!_0x238c24['query'][_0x3641('0x36')](_0x3641('0x37'))){_0x3b1406[_0x3641('0x1b')]=qs[_0x3641('0x1b')](_0x238c24[_0x3641('0x31')]['limit']);_0x3b1406['offset']=qs[_0x3641('0x19')](_0x238c24[_0x3641('0x31')][_0x3641('0x19')]);}_0x3b1406['order']=qs[_0x3641('0x38')](_0x238c24[_0x3641('0x31')][_0x3641('0x38')]);_0x3b1406['where']=qs[_0x3641('0x32')](_['pick'](_0x238c24[_0x3641('0x31')],_0x53a7fe[_0x3641('0x32')]),_0x2dd1d0);if(_0x238c24[_0x3641('0x31')][_0x3641('0x39')]){_0x3b1406[_0x3641('0x3a')]=_[_0x3641('0x3b')](_0x3b1406[_0x3641('0x3a')],{'$or':_['map'](_0x2dd1d0,function(_0x1f379d){if(_0x1f379d[_0x3641('0x2d')]!=='VIRTUAL'){var _0xf4d9a6={};_0xf4d9a6[_0x1f379d[_0x3641('0x27')]]={'$like':'%'+_0x238c24[_0x3641('0x31')][_0x3641('0x39')]+'%'};return _0xf4d9a6;}})});}_0x3b1406=_[_0x3641('0x3b')]({},_0x3b1406,_0x238c24['options']);var _0x43f4dc={'where':_0x3b1406[_0x3641('0x3a')]};return db[_0x3641('0x2b')][_0x3641('0x1c')](_0x43f4dc)[_0x3641('0x20')](function(_0x41f790){_0x2d76c0[_0x3641('0x1c')]=_0x41f790;if(_0x238c24[_0x3641('0x31')][_0x3641('0x3c')]){_0x3b1406[_0x3641('0x3d')]=[{'all':!![]}];}return db[_0x3641('0x2b')][_0x3641('0x3e')](_0x3b1406);})['then'](function(_0x55da84){_0x2d76c0[_0x3641('0x3f')]=_0x55da84;return _0x2d76c0;})['then'](respondWithFilteredResult(_0x28acbb,_0x3b1406))['catch'](handleError(_0x28acbb,null));};exports['show']=function(_0x38be6c,_0x594080){var _0x52fcf3={'raw':![],'where':{'id':_0x38be6c[_0x3641('0x40')]['id']}},_0x12a760={};_0x12a760['model']=_[_0x3641('0x30')](db['Schedule'][_0x3641('0x2c')]);_0x12a760[_0x3641('0x31')]=_[_0x3641('0x30')](_0x38be6c[_0x3641('0x31')]);_0x12a760['filters']=_[_0x3641('0x33')](_0x12a760[_0x3641('0x2f')],_0x12a760[_0x3641('0x31')]);_0x52fcf3[_0x3641('0x34')]=_[_0x3641('0x33')](_0x12a760[_0x3641('0x2f')],qs[_0x3641('0x35')](_0x38be6c[_0x3641('0x31')][_0x3641('0x35')]));_0x52fcf3[_0x3641('0x34')]=_0x52fcf3[_0x3641('0x34')][_0x3641('0x41')]?_0x52fcf3[_0x3641('0x34')]:_0x12a760[_0x3641('0x2f')];if(_0x38be6c['query'][_0x3641('0x3c')]){_0x52fcf3['include']=[{'all':!![]}];}_0x52fcf3=_[_0x3641('0x3b')]({},_0x52fcf3,_0x38be6c[_0x3641('0x42')]);return db['Schedule'][_0x3641('0x43')](_0x52fcf3)['then'](handleEntityNotFound(_0x594080,null))[_0x3641('0x20')](respondWithResult(_0x594080,null))['catch'](handleError(_0x594080,null));};exports['create']=function(_0x5f477a,_0x4f0b89){return db[_0x3641('0x2b')][_0x3641('0x44')](_0x5f477a[_0x3641('0x45')],{})[_0x3641('0x20')](function(_0x3f6fef){var _0x539892=_0x5f477a[_0x3641('0x46')][_0x3641('0x22')]({'plain':!![]});if(!_0x539892)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x539892[_0x3641('0x47')]===_0x3641('0x46')){var _0x664100=_0x3f6fef[_0x3641('0x22')]({'plain':!![]});var _0x218106=_0x3641('0x23');return db[_0x3641('0x48')][_0x3641('0x43')]({'where':{'name':_0x218106,'userProfileId':_0x539892[_0x3641('0x49')]},'raw':!![]})[_0x3641('0x20')](function(_0x51964e){if(_0x51964e&&_0x51964e[_0x3641('0x4a')]===0x0){return db[_0x3641('0x24')]['create']({'name':_0x664100[_0x3641('0x27')],'resourceId':_0x664100['id'],'type':_0x51964e['name'],'sectionId':_0x51964e['id']},{})[_0x3641('0x20')](function(){return _0x3f6fef;});}else{return _0x3f6fef;}})[_0x3641('0x4b')](function(_0x39b2a1){logger[_0x3641('0x25')](_0x3641('0x4c'),_0x39b2a1);throw _0x39b2a1;});}return _0x3f6fef;})[_0x3641('0x20')](respondWithResult(_0x4f0b89,0xc9))['catch'](handleError(_0x4f0b89,null));};exports[_0x3641('0x4d')]=function(_0x106aca,_0x2871e5){if(_0x106aca['body']['id']){delete _0x106aca[_0x3641('0x45')]['id'];}return db[_0x3641('0x2b')][_0x3641('0x43')]({'where':{'id':_0x106aca['params']['id']}})[_0x3641('0x20')](handleEntityNotFound(_0x2871e5,null))[_0x3641('0x20')](saveUpdates(_0x106aca[_0x3641('0x45')],null))[_0x3641('0x20')](respondWithResult(_0x2871e5,null))['catch'](handleError(_0x2871e5,null));};exports[_0x3641('0x21')]=function(_0x2023f5,_0x4884ed){return db[_0x3641('0x2b')][_0x3641('0x43')]({'where':{'id':_0x2023f5[_0x3641('0x40')]['id']}})[_0x3641('0x20')](handleEntityNotFound(_0x4884ed,null))[_0x3641('0x20')](removeEntity(_0x4884ed,null))[_0x3641('0x4b')](handleError(_0x4884ed,null));};exports[_0x3641('0x4e')]=function(_0x1afdad,_0x21c089,_0x289b8a){var _0x34914f=require(_0x3641('0x4f'));return db[_0x3641('0x2b')][_0x3641('0x43')]({'where':{'id':_0x1afdad[_0x3641('0x40')]['id']},'raw':!![]})[_0x3641('0x20')](handleEntityNotFound(_0x21c089,null))['then'](function(){_0x34914f[_0x3641('0x4e')](_0x1afdad[_0x3641('0x40')]['id']);})['then'](respondWithStatusCode(_0x21c089,null))[_0x3641('0x4b')](handleError(_0x21c089,null));}; \ No newline at end of file +var _0xaf04=['../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','apply','reject','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','stack','name','map','Schedule','rawAttributes','fieldName','type','keys','model','query','attributes','fields','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','params','intersection','include','find','catch','create','body','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x289a6b,_0x26619f){var _0x50c151=function(_0x10c9d4){while(--_0x10c9d4){_0x289a6b['push'](_0x289a6b['shift']());}};_0x50c151(++_0x26619f);}(_0xaf04,0x84));var _0x4af0=function(_0x359204,_0x5cbc87){_0x359204=_0x359204-0x0;var _0x1aacc2=_0xaf04[_0x359204];return _0x1aacc2;};'use strict';var emlformat=require(_0x4af0('0x0'));var rimraf=require(_0x4af0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4af0('0x2'));var BPromise=require(_0x4af0('0x3'));var Mustache=require(_0x4af0('0x4'));var util=require(_0x4af0('0x5'));var path=require(_0x4af0('0x6'));var sox=require('sox');var csv=require(_0x4af0('0x7'));var ejs=require(_0x4af0('0x8'));var fs=require('fs');var fs_extra=require(_0x4af0('0x9'));var _=require(_0x4af0('0xa'));var squel=require(_0x4af0('0xb'));var crypto=require(_0x4af0('0xc'));var jsforce=require(_0x4af0('0xd'));var deskjs=require(_0x4af0('0xe'));var toCsv=require(_0x4af0('0x7'));var querystring=require(_0x4af0('0xf'));var Papa=require(_0x4af0('0x10'));var Redis=require(_0x4af0('0x11'));var authService=require(_0x4af0('0x12'));var qs=require(_0x4af0('0x13'));var as=require(_0x4af0('0x14'));var hardwareService=require(_0x4af0('0x15'));var logger=require('../../config/logger')(_0x4af0('0x16'));var utils=require(_0x4af0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4af0('0x18'));var db=require(_0x4af0('0x19'))['db'];function respondWithStatusCode(_0x1c2351,_0x4da6dd){_0x4da6dd=_0x4da6dd||0xcc;return function(_0x1cdb09){if(_0x1cdb09){return _0x1c2351['sendStatus'](_0x4da6dd);}return _0x1c2351[_0x4af0('0x1a')](_0x4da6dd)[_0x4af0('0x1b')]();};}function respondWithResult(_0x5d788f,_0x4c8dfd){_0x4c8dfd=_0x4c8dfd||0xc8;return function(_0x2d6f3b){if(_0x2d6f3b){return _0x5d788f[_0x4af0('0x1a')](_0x4c8dfd)[_0x4af0('0x1c')](_0x2d6f3b);}};}function respondWithFilteredResult(_0x28dcc8,_0x2ffa5f){return function(_0x4e0d62){if(_0x4e0d62){var _0x398368=typeof _0x2ffa5f['offset']===_0x4af0('0x1d')&&typeof _0x2ffa5f[_0x4af0('0x1e')]===_0x4af0('0x1d');var _0x4af0a0=_0x4e0d62['count'];var _0x23cc75=_0x398368?0x0:_0x2ffa5f[_0x4af0('0x1f')];var _0x206869=_0x398368?_0x4e0d62[_0x4af0('0x20')]:_0x2ffa5f['offset']+_0x2ffa5f[_0x4af0('0x1e')];var _0x535c35;if(_0x206869>=_0x4af0a0){_0x206869=_0x4af0a0;_0x535c35=0xc8;}else{_0x535c35=0xce;}_0x28dcc8[_0x4af0('0x1a')](_0x535c35);return _0x28dcc8[_0x4af0('0x21')]('Content-Range',_0x23cc75+'-'+_0x206869+'/'+_0x4af0a0)['json'](_0x4e0d62);}return null;};}function patchUpdates(_0x5dc5ae){return function(_0x4523c0){try{jsonpatch[_0x4af0('0x22')](_0x4523c0,_0x5dc5ae,!![]);}catch(_0x3014ac){return BPromise[_0x4af0('0x23')](_0x3014ac);}return _0x4523c0['save']();};}function saveUpdates(_0x141416,_0x212971){return function(_0x1d12f9){if(_0x1d12f9){return _0x1d12f9[_0x4af0('0x24')](_0x141416)[_0x4af0('0x25')](function(_0x515eea){return _0x515eea;});}return null;};}function removeEntity(_0x5b19c7,_0x407204){return function(_0x581e91){if(_0x581e91){return _0x581e91['destroy']()['then'](function(){var _0x19fd63=_0x581e91[_0x4af0('0x26')]({'plain':!![]});var _0x14bf74=_0x4af0('0x27');return db[_0x4af0('0x28')][_0x4af0('0x29')]({'where':{'type':_0x14bf74,'resourceId':_0x19fd63['id']}})[_0x4af0('0x25')](function(){return _0x581e91;});})[_0x4af0('0x25')](function(){_0x5b19c7['status'](0xcc)[_0x4af0('0x1b')]();});}};}function handleEntityNotFound(_0x3e935b,_0x49af24){return function(_0x350044){if(!_0x350044){_0x3e935b[_0x4af0('0x2a')](0x194);}return _0x350044;};}function handleError(_0x3d5f6d,_0xa80433){_0xa80433=_0xa80433||0x1f4;return function(_0x3c0a7f){logger['error'](_0x3c0a7f[_0x4af0('0x2b')]);if(_0x3c0a7f[_0x4af0('0x2c')]){delete _0x3c0a7f['name'];}_0x3d5f6d[_0x4af0('0x1a')](_0xa80433)['send'](_0x3c0a7f);};}exports['index']=function(_0x5c56fa,_0x2499af){var _0x4b35f8={},_0x2547ea={},_0x543415={'count':0x0,'rows':[]};var _0x56dde3=_[_0x4af0('0x2d')](db[_0x4af0('0x2e')][_0x4af0('0x2f')],function(_0x4a7e86){return{'name':_0x4a7e86[_0x4af0('0x30')],'type':_0x4a7e86[_0x4af0('0x31')]['key']};});_0x2547ea['model']=_[_0x4af0('0x2d')](_0x56dde3,_0x4af0('0x2c'));_0x2547ea['query']=_[_0x4af0('0x32')](_0x5c56fa['query']);_0x2547ea['filters']=_['intersection'](_0x2547ea[_0x4af0('0x33')],_0x2547ea[_0x4af0('0x34')]);_0x4b35f8[_0x4af0('0x35')]=_['intersection'](_0x2547ea[_0x4af0('0x33')],qs[_0x4af0('0x36')](_0x5c56fa[_0x4af0('0x34')]['fields']));_0x4b35f8[_0x4af0('0x35')]=_0x4b35f8[_0x4af0('0x35')]['length']?_0x4b35f8[_0x4af0('0x35')]:_0x2547ea[_0x4af0('0x33')];if(!_0x5c56fa[_0x4af0('0x34')][_0x4af0('0x37')]('nolimit')){_0x4b35f8[_0x4af0('0x1e')]=qs[_0x4af0('0x1e')](_0x5c56fa[_0x4af0('0x34')][_0x4af0('0x1e')]);_0x4b35f8['offset']=qs[_0x4af0('0x1f')](_0x5c56fa['query']['offset']);}_0x4b35f8['order']=qs[_0x4af0('0x38')](_0x5c56fa[_0x4af0('0x34')][_0x4af0('0x38')]);_0x4b35f8[_0x4af0('0x39')]=qs['filters'](_['pick'](_0x5c56fa[_0x4af0('0x34')],_0x2547ea[_0x4af0('0x3a')]),_0x56dde3);if(_0x5c56fa[_0x4af0('0x34')]['filter']){_0x4b35f8[_0x4af0('0x39')]=_[_0x4af0('0x3b')](_0x4b35f8[_0x4af0('0x39')],{'$or':_[_0x4af0('0x2d')](_0x56dde3,function(_0x598f13){if(_0x598f13[_0x4af0('0x31')]!==_0x4af0('0x3c')){var _0x25c087={};_0x25c087[_0x598f13['name']]={'$like':'%'+_0x5c56fa['query'][_0x4af0('0x3d')]+'%'};return _0x25c087;}})});}_0x4b35f8=_['merge']({},_0x4b35f8,_0x5c56fa[_0x4af0('0x3e')]);var _0x44a610={'where':_0x4b35f8[_0x4af0('0x39')]};return db[_0x4af0('0x2e')][_0x4af0('0x20')](_0x44a610)[_0x4af0('0x25')](function(_0x410f58){_0x543415[_0x4af0('0x20')]=_0x410f58;if(_0x5c56fa[_0x4af0('0x34')][_0x4af0('0x3f')]){_0x4b35f8['include']=[{'all':!![]}];}return db['Schedule'][_0x4af0('0x40')](_0x4b35f8);})['then'](function(_0x4735c0){_0x543415['rows']=_0x4735c0;return _0x543415;})[_0x4af0('0x25')](respondWithFilteredResult(_0x2499af,_0x4b35f8))['catch'](handleError(_0x2499af,null));};exports['show']=function(_0x505320,_0x1401ca){var _0x168fd6={'raw':![],'where':{'id':_0x505320[_0x4af0('0x41')]['id']}},_0x12c02b={};_0x12c02b['model']=_[_0x4af0('0x32')](db[_0x4af0('0x2e')][_0x4af0('0x2f')]);_0x12c02b[_0x4af0('0x34')]=_[_0x4af0('0x32')](_0x505320[_0x4af0('0x34')]);_0x12c02b['filters']=_[_0x4af0('0x42')](_0x12c02b[_0x4af0('0x33')],_0x12c02b[_0x4af0('0x34')]);_0x168fd6[_0x4af0('0x35')]=_[_0x4af0('0x42')](_0x12c02b['model'],qs['fields'](_0x505320[_0x4af0('0x34')][_0x4af0('0x36')]));_0x168fd6[_0x4af0('0x35')]=_0x168fd6[_0x4af0('0x35')]['length']?_0x168fd6[_0x4af0('0x35')]:_0x12c02b[_0x4af0('0x33')];if(_0x505320[_0x4af0('0x34')][_0x4af0('0x3f')]){_0x168fd6[_0x4af0('0x43')]=[{'all':!![]}];}_0x168fd6=_[_0x4af0('0x3b')]({},_0x168fd6,_0x505320[_0x4af0('0x3e')]);return db[_0x4af0('0x2e')][_0x4af0('0x44')](_0x168fd6)['then'](handleEntityNotFound(_0x1401ca,null))[_0x4af0('0x25')](respondWithResult(_0x1401ca,null))[_0x4af0('0x45')](handleError(_0x1401ca,null));};exports[_0x4af0('0x46')]=function(_0x369e06,_0x44f6d0){return db[_0x4af0('0x2e')][_0x4af0('0x46')](_0x369e06[_0x4af0('0x47')],{})['then'](function(_0x4ea6a6){var _0x6eb648=_0x369e06['user'][_0x4af0('0x26')]({'plain':!![]});if(!_0x6eb648)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6eb648['role']===_0x4af0('0x48')){var _0x3378ff=_0x4ea6a6[_0x4af0('0x26')]({'plain':!![]});var _0x9712de=_0x4af0('0x27');return db[_0x4af0('0x49')][_0x4af0('0x44')]({'where':{'name':_0x9712de,'userProfileId':_0x6eb648['userProfileId']},'raw':!![]})[_0x4af0('0x25')](function(_0xf577c1){if(_0xf577c1&&_0xf577c1[_0x4af0('0x4a')]===0x0){return db[_0x4af0('0x28')]['create']({'name':_0x3378ff['name'],'resourceId':_0x3378ff['id'],'type':_0xf577c1[_0x4af0('0x2c')],'sectionId':_0xf577c1['id']},{})[_0x4af0('0x25')](function(){return _0x4ea6a6;});}else{return _0x4ea6a6;}})['catch'](function(_0x421512){logger[_0x4af0('0x4b')](_0x4af0('0x4c'),_0x421512);throw _0x421512;});}return _0x4ea6a6;})[_0x4af0('0x25')](respondWithResult(_0x44f6d0,0xc9))[_0x4af0('0x45')](handleError(_0x44f6d0,null));};exports[_0x4af0('0x24')]=function(_0x5c23dd,_0x10c512){if(_0x5c23dd[_0x4af0('0x47')]['id']){delete _0x5c23dd[_0x4af0('0x47')]['id'];}return db[_0x4af0('0x2e')][_0x4af0('0x44')]({'where':{'id':_0x5c23dd[_0x4af0('0x41')]['id']}})['then'](handleEntityNotFound(_0x10c512,null))['then'](saveUpdates(_0x5c23dd[_0x4af0('0x47')],null))[_0x4af0('0x25')](respondWithResult(_0x10c512,null))['catch'](handleError(_0x10c512,null));};exports[_0x4af0('0x29')]=function(_0x599a3b,_0x1c73fa){return db[_0x4af0('0x2e')][_0x4af0('0x44')]({'where':{'id':_0x599a3b[_0x4af0('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c73fa,null))[_0x4af0('0x25')](removeEntity(_0x1c73fa,null))[_0x4af0('0x45')](handleError(_0x1c73fa,null));};exports[_0x4af0('0x4d')]=function(_0x2a1ae3,_0x36c059,_0x6af1a7){var _0x47de83=require('../../config/schedule');return db[_0x4af0('0x2e')]['find']({'where':{'id':_0x2a1ae3['params']['id']},'raw':!![]})[_0x4af0('0x25')](handleEntityNotFound(_0x36c059,null))[_0x4af0('0x25')](function(){_0x47de83[_0x4af0('0x4d')](_0x2a1ae3[_0x4af0('0x41')]['id']);})[_0x4af0('0x25')](respondWithStatusCode(_0x36c059,null))[_0x4af0('0x45')](handleError(_0x36c059,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4bf616f..0a9d824 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 _0xd66f=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define'];(function(_0x561143,_0x445a7e){var _0x33a062=function(_0x497ac2){while(--_0x497ac2){_0x561143['push'](_0x561143['shift']());}};_0x33a062(++_0x445a7e);}(_0xd66f,0x9c));var _0xfd66=function(_0x32b54b,_0x3a2566){_0x32b54b=_0x32b54b-0x0;var _0x199f12=_0xd66f[_0x32b54b];return _0x199f12;};'use strict';var _=require(_0xfd66('0x0'));var util=require(_0xfd66('0x1'));var logger=require(_0xfd66('0x2'))(_0xfd66('0x3'));var moment=require(_0xfd66('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd66('0x5'));var rimraf=require(_0xfd66('0x6'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xfd66('0x7')]=function(_0x485f6d,_0x1d4b7a){return _0x485f6d[_0xfd66('0x8')](_0xfd66('0x9'),attributes,{'tableName':_0xfd66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22ea=['../../config/environment','Schedule','lodash','util','api','moment','request-promise','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x22ea,0x132));var _0xa22e=function(_0x17e47f,_0x10fa43){_0x17e47f=_0x17e47f-0x0;var _0x256593=_0x22ea[_0x17e47f];return _0x256593;};'use strict';var _=require(_0xa22e('0x0'));var util=require(_0xa22e('0x1'));var logger=require('../../config/logger')(_0xa22e('0x2'));var moment=require(_0xa22e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa22e('0x4'));var fs=require('fs');var path=require(_0xa22e('0x5'));var rimraf=require('rimraf');var config=require(_0xa22e('0x6'));var attributes=require('./schedule.attributes');module['exports']=function(_0x382bb1,_0x1a6a83){return _0x382bb1['define'](_0xa22e('0x7'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 9feabc4..20833c0 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 _0xa868=['message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20b73f,_0x59bc48){var _0x4664a7=function(_0x5e1a93){while(--_0x5e1a93){_0x20b73f['push'](_0x20b73f['shift']());}};_0x4664a7(++_0x59bc48);}(_0xa868,0x13d));var _0x8a86=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0xa868[_0x45fb76];return _0x338556;};'use strict';var _=require(_0x8a86('0x0'));var util=require(_0x8a86('0x1'));var moment=require(_0x8a86('0x2'));var BPromise=require(_0x8a86('0x3'));var rs=require(_0x8a86('0x4'));var fs=require('fs');var Redis=require(_0x8a86('0x5'));var db=require(_0x8a86('0x6'))['db'];var utils=require(_0x8a86('0x7'));var logger=require(_0x8a86('0x8'))('rpc');var config=require(_0x8a86('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a86('0xa')][_0x8a86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51357b,_0xfc219b,_0x43b162){return new BPromise(function(_0x5d995d,_0x5a27b0){return client[_0x8a86('0xc')](_0x51357b,_0x43b162)['then'](function(_0x19358c){logger['info'](_0x8a86('0xd'),_0xfc219b,'request\x20sent');logger[_0x8a86('0xe')](_0x8a86('0xf'),_0xfc219b,'request\x20sent',JSON[_0x8a86('0x10')](_0x19358c));if(_0x19358c[_0x8a86('0x11')]){if(_0x19358c[_0x8a86('0x11')][_0x8a86('0x12')]===0x1f4){logger['error'](_0x8a86('0xd'),_0xfc219b,_0x19358c[_0x8a86('0x11')][_0x8a86('0x13')]);return _0x5a27b0(_0x19358c['error'][_0x8a86('0x13')]);}logger[_0x8a86('0x11')]('Schedule,\x20%s,\x20%s',_0xfc219b,_0x19358c['error'][_0x8a86('0x13')]);return _0x5d995d(_0x19358c[_0x8a86('0x11')][_0x8a86('0x13')]);}else{logger[_0x8a86('0x14')](_0x8a86('0xd'),_0xfc219b,_0x8a86('0x15'));_0x5d995d(_0x19358c[_0x8a86('0x16')][_0x8a86('0x13')]);}})[_0x8a86('0x17')](function(_0x34b98a){logger[_0x8a86('0x11')]('Schedule,\x20%s,\x20%s',_0xfc219b,_0x34b98a);_0x5a27b0(_0x34b98a);});});} \ No newline at end of file +var _0xd24f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x5ad67c,_0x144860){var _0xccce2e=function(_0x2dd95c){while(--_0x2dd95c){_0x5ad67c['push'](_0x5ad67c['shift']());}};_0xccce2e(++_0x144860);}(_0xd24f,0x1e2));var _0xfd24=function(_0x22d045,_0x13fd64){_0x22d045=_0x22d045-0x0;var _0x2460b1=_0xd24f[_0x22d045];return _0x2460b1;};'use strict';var _=require(_0xfd24('0x0'));var util=require(_0xfd24('0x1'));var moment=require(_0xfd24('0x2'));var BPromise=require(_0xfd24('0x3'));var rs=require(_0xfd24('0x4'));var fs=require('fs');var Redis=require(_0xfd24('0x5'));var db=require(_0xfd24('0x6'))['db'];var utils=require(_0xfd24('0x7'));var logger=require(_0xfd24('0x8'))(_0xfd24('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd24('0xa')][_0xfd24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x186298,_0x59a272,_0x133a26){return new BPromise(function(_0x21c0d9,_0x24929d){return client[_0xfd24('0xc')](_0x186298,_0x133a26)['then'](function(_0x37ac10){logger[_0xfd24('0xd')](_0xfd24('0xe'),_0x59a272,_0xfd24('0xf'));logger[_0xfd24('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x59a272,_0xfd24('0xf'),JSON[_0xfd24('0x11')](_0x37ac10));if(_0x37ac10[_0xfd24('0x12')]){if(_0x37ac10[_0xfd24('0x12')]['code']===0x1f4){logger[_0xfd24('0x12')]('Schedule,\x20%s,\x20%s',_0x59a272,_0x37ac10[_0xfd24('0x12')][_0xfd24('0x13')]);return _0x24929d(_0x37ac10[_0xfd24('0x12')][_0xfd24('0x13')]);}logger[_0xfd24('0x12')](_0xfd24('0xe'),_0x59a272,_0x37ac10[_0xfd24('0x12')][_0xfd24('0x13')]);return _0x21c0d9(_0x37ac10[_0xfd24('0x12')][_0xfd24('0x13')]);}else{logger['info'](_0xfd24('0xe'),_0x59a272,'request\x20sent');_0x21c0d9(_0x37ac10[_0xfd24('0x14')][_0xfd24('0x13')]);}})[_0xfd24('0x15')](function(_0x8a3f93){logger[_0xfd24('0x12')](_0xfd24('0xe'),_0x59a272,_0x8a3f93);_0x24929d(_0x8a3f93);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f700b22..94fd981 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 _0x184e=['../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x389c43,_0x3abfb2){var _0x57cd7d=function(_0x3315a6){while(--_0x3315a6){_0x389c43['push'](_0x389c43['shift']());}};_0x57cd7d(++_0x3abfb2);}(_0x184e,0xc1));var _0xe184=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x184e[_0x28fe94];return _0x3560da;};'use strict';var multer=require(_0xe184('0x0'));var util=require('util');var path=require(_0xe184('0x1'));var timeout=require(_0xe184('0x2'));var express=require('express');var router=express[_0xe184('0x3')]();var fs_extra=require(_0xe184('0x4'));var auth=require(_0xe184('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe184('0x6'));var controller=require(_0xe184('0x7'));router[_0xe184('0x8')]('/',auth[_0xe184('0x9')](),controller[_0xe184('0xa')]);router[_0xe184('0x8')](_0xe184('0xb'),auth[_0xe184('0x9')](),controller[_0xe184('0xc')]);router[_0xe184('0x8')](_0xe184('0xd'),auth[_0xe184('0x9')](),controller['show']);router[_0xe184('0x8')](_0xe184('0xe'),auth[_0xe184('0x9')](),controller[_0xe184('0xf')]);router['post']('/',auth[_0xe184('0x9')](),controller[_0xe184('0x10')]);router[_0xe184('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe184('0x12')]);router[_0xe184('0x13')]('/:id',auth[_0xe184('0x9')](),controller[_0xe184('0x14')]);module[_0xe184('0x15')]=router; \ No newline at end of file +var _0x72dd=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','delete','exports'];(function(_0x3f2946,_0x3fb86f){var _0x1986db=function(_0x13e4e0){while(--_0x13e4e0){_0x3f2946['push'](_0x3f2946['shift']());}};_0x1986db(++_0x3fb86f);}(_0x72dd,0x144));var _0xd72d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x72dd[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xd72d('0x0'));var util=require('util');var path=require(_0xd72d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd72d('0x2'));var router=express[_0xd72d('0x3')]();var fs_extra=require(_0xd72d('0x4'));var auth=require(_0xd72d('0x5'));var interaction=require(_0xd72d('0x6'));var config=require(_0xd72d('0x7'));var controller=require(_0xd72d('0x8'));router[_0xd72d('0x9')]('/',auth[_0xd72d('0xa')](),controller['index']);router[_0xd72d('0x9')](_0xd72d('0xb'),auth[_0xd72d('0xa')](),controller[_0xd72d('0xc')]);router['get'](_0xd72d('0xd'),auth[_0xd72d('0xa')](),controller[_0xd72d('0xe')]);router[_0xd72d('0x9')]('/:id/download',auth[_0xd72d('0xa')](),controller[_0xd72d('0xf')]);router['post']('/',auth[_0xd72d('0xa')](),controller['create']);router['put'](_0xd72d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd72d('0x10')](_0xd72d('0xd'),auth[_0xd72d('0xa')](),controller['destroy']);module[_0xd72d('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 427b27c..2e247ee 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 _0x23bb=['updatedAt','sequelize','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','INTEGER','subtract','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt'];(function(_0x23d0a1,_0x5011a){var _0x1ef866=function(_0x5103d4){while(--_0x5103d4){_0x23d0a1['push'](_0x23d0a1['shift']());}};_0x1ef866(++_0x5011a);}(_0x23bb,0x79));var _0xb23b=function(_0x3cca7a,_0x109a23){_0x3cca7a=_0x3cca7a-0x0;var _0x34e717=_0x23bb[_0x3cca7a];return _0x34e717;};'use strict';var Sequelize=require(_0xb23b('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xb23b('0x1'));module[_0xb23b('0x2')]={'format':{'type':Sequelize[_0xb23b('0x3')],'get':function(){return this['getDataValue'](_0xb23b('0x4'))?path[_0xb23b('0x5')](this[_0xb23b('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb23b('0x7')],'set':function(_0x4c5626){var _0x4a2873=_0x4c5626['replace'](/\\/g,'/');this[_0xb23b('0x8')]('value',_0x4a2873);}},'rating':{'type':Sequelize[_0xb23b('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x23270c){this[_0xb23b('0x8')]('startedAt',moment()[_0xb23b('0xa')](_0x23270c,'ms'));this[_0xb23b('0x8')]('closedAt',moment());this[_0xb23b('0x8')](_0xb23b('0xb'),_0x23270c);}},'startedAt':{'type':Sequelize[_0xb23b('0xc')],'get':function(){return moment(this['getDataValue'](_0xb23b('0xd')))[_0xb23b('0xe')](_0xb23b('0xf'))[_0xb23b('0x10')]();}},'closedAt':{'type':Sequelize[_0xb23b('0xc')],'get':function(){return moment(this[_0xb23b('0x6')](_0xb23b('0x11')))[_0xb23b('0xe')](_0xb23b('0xf'))[_0xb23b('0x10')]();}},'createdAt':{'type':Sequelize[_0xb23b('0xc')],'get':function(){return moment(this[_0xb23b('0x6')](_0xb23b('0x12')))[_0xb23b('0xe')](_0xb23b('0xf'))[_0xb23b('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb23b('0xc')],'get':function(){return moment(this['getDataValue'](_0xb23b('0x13')))[_0xb23b('0xe')](_0xb23b('0xf'))[_0xb23b('0x10')]();}}}; \ No newline at end of file +var _0x8ba6=['value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','toString','format','MM-DD-YYYY\x20HH:mm','DATE','sequelize','path','exports','VIRTUAL','getDataValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8ba6,0x11b));var _0x68ba=function(_0x5476fa,_0x7a6c70){_0x5476fa=_0x5476fa-0x0;var _0xabc6ce=_0x8ba6[_0x5476fa];return _0xabc6ce;};'use strict';var Sequelize=require(_0x68ba('0x0'));var moment=require('moment');var path=require(_0x68ba('0x1'));var config=require('../../config/environment');module[_0x68ba('0x2')]={'format':{'type':Sequelize[_0x68ba('0x3')],'get':function(){return this[_0x68ba('0x4')](_0x68ba('0x5'))?path['extname'](this['getDataValue'](_0x68ba('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x68ba('0x6')]},'channel':{'type':Sequelize[_0x68ba('0x6')]},'value':{'type':Sequelize[_0x68ba('0x6')],'set':function(_0x2ad848){var _0x1ba7fa=_0x2ad848[_0x68ba('0x7')](/\\/g,'/');this[_0x68ba('0x8')]('value',_0x1ba7fa);}},'rating':{'type':Sequelize[_0x68ba('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x68ba('0x9')],'set':function(_0x1ec922){this[_0x68ba('0x8')](_0x68ba('0xa'),moment()[_0x68ba('0xb')](_0x1ec922,'ms'));this[_0x68ba('0x8')](_0x68ba('0xc'),moment());this[_0x68ba('0x8')](_0x68ba('0xd'),_0x1ec922);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68ba('0x4')](_0x68ba('0xa')))['format']('MM-DD-YYYY\x20HH:mm')[_0x68ba('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68ba('0x4')](_0x68ba('0xc')))[_0x68ba('0xf')](_0x68ba('0x10'))[_0x68ba('0xe')]();}},'createdAt':{'type':Sequelize[_0x68ba('0x11')],'get':function(){return moment(this[_0x68ba('0x4')]('createdAt'))[_0x68ba('0xf')](_0x68ba('0x10'))[_0x68ba('0xe')]();}},'updatedAt':{'type':Sequelize[_0x68ba('0x11')],'get':function(){return moment(this[_0x68ba('0x4')]('updatedAt'))[_0x68ba('0xf')](_0x68ba('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c22170d..678fbbe 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 _0x7da7=['stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','findAll','rows','show','params','rawAttributes','options','find','create','body','duration','createdAt','value','catch','describe','download','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','join','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','end','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7da7,0x10d));var _0x77da=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x7da7[_0x3f6e26];return _0x474345;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={},_0x2258e9={},_0x30456a={'count':0x0,'rows':[]};var _0x410d09=_[_0x77da('0x29')](db[_0x77da('0x2a')]['rawAttributes'],function(_0x350b4e){return{'name':_0x350b4e[_0x77da('0x2b')],'type':_0x350b4e[_0x77da('0x2c')][_0x77da('0x2d')]};});_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x2f')](_['map'](_0x410d09,_0x77da('0x26')),[_0x77da('0x30')]);_0x2258e9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x496ecd[_0x77da('0x31')]);_0x2258e9[_0x77da('0x33')]=_[_0x77da('0x34')](_0x2258e9[_0x77da('0x2e')],_0x2258e9['query']);_0x4d395a['attributes']=_[_0x77da('0x34')](_0x2258e9[_0x77da('0x2e')],qs['fields'](_0x496ecd[_0x77da('0x31')][_0x77da('0x35')]));_0x4d395a[_0x77da('0x36')]=_0x4d395a[_0x77da('0x36')][_0x77da('0x37')]?_0x4d395a[_0x77da('0x36')]:_0x2258e9[_0x77da('0x2e')];if(!_0x496ecd['query'][_0x77da('0x38')]('nolimit')){_0x4d395a['limit']=qs['limit'](_0x496ecd[_0x77da('0x31')]['limit']);_0x4d395a[_0x77da('0x19')]=qs[_0x77da('0x19')](_0x496ecd[_0x77da('0x31')][_0x77da('0x19')]);}_0x4d395a[_0x77da('0x39')]=qs[_0x77da('0x3a')](_0x496ecd[_0x77da('0x31')]['sort']);_0x4d395a[_0x77da('0x3b')]=qs[_0x77da('0x33')](_[_0x77da('0x3c')](_0x496ecd[_0x77da('0x31')],_0x2258e9[_0x77da('0x33')]),_0x410d09);if(_0x496ecd[_0x77da('0x31')]['filter']){_0x4d395a[_0x77da('0x3b')]=_[_0x77da('0x3d')](_0x4d395a[_0x77da('0x3b')],{'$or':_['map'](_0x410d09,function(_0xc5f0b8){if(_0xc5f0b8['type']!=='VIRTUAL'){var _0x599e21={};_0x599e21[_0xc5f0b8['name']]={'$like':'%'+_0x496ecd[_0x77da('0x31')][_0x77da('0x3e')]+'%'};return _0x599e21;}})});}_0x4d395a=_[_0x77da('0x3d')]({},_0x4d395a,_0x496ecd['options']);var _0x21d337={'where':_0x4d395a['where']};return db[_0x77da('0x2a')]['count'](_0x21d337)[_0x77da('0x21')](function(_0xa19b50){_0x30456a[_0x77da('0x1b')]=_0xa19b50;if(_0x496ecd[_0x77da('0x31')][_0x77da('0x3f')]){_0x4d395a['include']=[{'all':!![]}];}return db[_0x77da('0x2a')][_0x77da('0x40')](_0x4d395a);})[_0x77da('0x21')](function(_0x2f14f4){_0x30456a[_0x77da('0x41')]=_0x2f14f4;return _0x30456a;})[_0x77da('0x21')](respondWithFilteredResult(_0x5b4638,_0x4d395a))['catch'](handleError(_0x5b4638,null));};exports[_0x77da('0x42')]=function(_0x2f0495,_0x21de41){var _0x2dfeca={'raw':![],'where':{'id':_0x2f0495[_0x77da('0x43')]['id']}},_0x7d11f9={};_0x7d11f9['model']=_[_0x77da('0x32')](db['ScreenRecording'][_0x77da('0x44')]);_0x7d11f9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x2f0495['query']);_0x7d11f9[_0x77da('0x33')]=_[_0x77da('0x34')](_0x7d11f9[_0x77da('0x2e')],_0x7d11f9[_0x77da('0x31')]);_0x2dfeca[_0x77da('0x36')]=_[_0x77da('0x34')](_0x7d11f9[_0x77da('0x2e')],qs[_0x77da('0x35')](_0x2f0495[_0x77da('0x31')]['fields']));_0x2dfeca[_0x77da('0x36')]=_0x2dfeca[_0x77da('0x36')][_0x77da('0x37')]?_0x2dfeca[_0x77da('0x36')]:_0x7d11f9[_0x77da('0x2e')];if(_0x2f0495[_0x77da('0x31')]['includeAll']){_0x2dfeca['include']=[{'all':!![]}];}_0x2dfeca=_[_0x77da('0x3d')]({},_0x2dfeca,_0x2f0495[_0x77da('0x45')]);return db[_0x77da('0x2a')][_0x77da('0x46')](_0x2dfeca)[_0x77da('0x21')](handleEntityNotFound(_0x21de41,null))[_0x77da('0x21')](respondWithResult(_0x21de41,null))['catch'](handleError(_0x21de41,null));};exports[_0x77da('0x47')]=function(_0x357ee4,_0x332f80){return db[_0x77da('0x2a')]['create'](_0x357ee4[_0x77da('0x48')],{})['then'](respondWithResult(_0x332f80,0xc9))['catch'](handleError(_0x332f80,null));};exports[_0x77da('0x20')]=function(_0x176f01,_0x143a68){if(_0x176f01[_0x77da('0x48')]['id']){delete _0x176f01['body']['id'];}delete _0x176f01[_0x77da('0x48')][_0x77da('0x49')];delete _0x176f01['body'][_0x77da('0x4a')];delete _0x176f01[_0x77da('0x48')]['closedAt'];delete _0x176f01[_0x77da('0x48')][_0x77da('0x4b')];return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':{'id':_0x176f01[_0x77da('0x43')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x143a68,null))[_0x77da('0x21')](saveUpdates(_0x176f01[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x143a68,null))[_0x77da('0x4c')](handleError(_0x143a68,null));};exports['describe']=function(_0x3d04a3,_0x513017){return db[_0x77da('0x2a')][_0x77da('0x4d')]()[_0x77da('0x21')](respondWithResult(_0x513017,null))[_0x77da('0x4c')](handleError(_0x513017,null));};exports[_0x77da('0x4e')]=function(_0x8b377d,_0x3a78d2,_0x4c271d){var _0x17ed71=require(_0x77da('0x4f'));var _0x1a7115=![];var _0x353be9={};if(_0x8b377d['query'][_0x77da('0x2c')]&&_0x8b377d[_0x77da('0x31')][_0x77da('0x2c')]==='uniqueid'){_0x353be9['uniqueid']=_0x8b377d[_0x77da('0x43')]['id'];}else{_0x353be9['id']=_0x8b377d[_0x77da('0x43')]['id'];}return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':_0x353be9,'attributes':['id',_0x77da('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3a78d2,null))['then'](function(_0x365e91){if(_0x365e91){var _0x36f161=path['join'](config[_0x77da('0x50')],_0x77da('0x51'),_0x365e91[_0x77da('0x4b')]);var _0x4b1515=util[_0x77da('0x30')](_0x77da('0x52'),_0x36f161);if(fs['existsSync'](_0x4b1515)){_0x1a7115=!![];return _0x17ed71[_0x77da('0x53')](_0x4b1515,_0x36f161,config[_0x77da('0x54')][_0x77da('0x55')])[_0x77da('0x21')](function(){return _0x365e91;});}return _0x365e91;}})[_0x77da('0x21')](function(_0x99ac27){if(_0x99ac27){var _0x1dc4ab=path[_0x77da('0x56')](config[_0x77da('0x50')],'server/files/screen_recordings',_0x99ac27[_0x77da('0x4b')]);if(!fs[_0x77da('0x57')](_0x1dc4ab)){throw new db[(_0x77da('0x58'))][(_0x77da('0x59'))](_0x77da('0x5a'));}if(_0x99ac27[_0x77da('0x5b')]){return _0x3a78d2['download'](_0x1dc4ab,_0x99ac27[_0x77da('0x5b')]+path[_0x77da('0x5c')](_0x1dc4ab),function(){if(_0x1a7115){fs[_0x77da('0x5d')](_0x1dc4ab);}});}else{return _0x3a78d2['download'](_0x1dc4ab,function(_0x3e5dd9){if(_0x1a7115){fs[_0x77da('0x5d')](_0x1dc4ab);}});}}})[_0x77da('0x4c')](function(_0x8592c7){if(_0x8592c7[_0x77da('0x5e')]===_0x77da('0x5a')){_0x3a78d2[_0x77da('0x18')](0x194)['send'](_0x77da('0x5f'));}else{return handleError(_0x3a78d2,null);}});};exports['destroy']=function(_0x211310,_0x1922ab){return db[_0x77da('0x2a')]['find']({'where':{'id':_0x211310[_0x77da('0x43')]['id']}})[_0x77da('0x21')](function(_0x282481){if(_[_0x77da('0x60')](_0x282481)){throw new ReferenceError('Entity\x20not\x20found');}return _0x282481;})['then'](function(_0x571b1b){var _0x6b74fd=path[_0x77da('0x56')](config[_0x77da('0x50')],_0x77da('0x51'),_0x571b1b[_0x77da('0x4b')]);logger[_0x77da('0x61')](_0x77da('0x62'),_0x6b74fd);if(!_[_0x77da('0x60')](_0x571b1b[_0x77da('0x4b')])&&fs[_0x77da('0x57')](_0x6b74fd)){logger['info'](_0x77da('0x63')+_0x6b74fd+_0x77da('0x64'));fs['unlinkSync'](_0x6b74fd);}_0x6b74fd=_0x6b74fd+'.cypher';if(!_[_0x77da('0x60')](_0x571b1b['value'])&&fs[_0x77da('0x57')](_0x6b74fd)){logger[_0x77da('0x61')](_0x77da('0x63')+_0x6b74fd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x77da('0x65')](_0x6b74fd);}return _0x571b1b;})[_0x77da('0x21')](function(_0x27fc45){if(!_0x27fc45)throw new InternalError();return _0x27fc45[_0x77da('0x22')]();})[_0x77da('0x21')](function(){_0x1922ab['status'](0xcc)[_0x77da('0x23')]();})[_0x77da('0x4c')](handleError(_0x1922ab,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x490f81,_0x2a7dee){_0x490f81=_0x490f81-0x0;var _0x1cc4a9=_0x4c4e[_0x490f81];return _0x1cc4a9;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ff5f13a..1e6fd9f 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 _0x8490=['moment','bluebird','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api'];(function(_0x35d111,_0x3a6e61){var _0x47e7d2=function(_0x4ea6a9){while(--_0x4ea6a9){_0x35d111['push'](_0x35d111['shift']());}};_0x47e7d2(++_0x3a6e61);}(_0x8490,0xf9));var _0x0849=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x8490[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x0849('0x0'));var util=require('util');var logger=require(_0x0849('0x1'))(_0x0849('0x2'));var moment=require(_0x0849('0x3'));var BPromise=require(_0x0849('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0849('0x5'));var rimraf=require(_0x0849('0x6'));var config=require('../../config/environment');var attributes=require(_0x0849('0x7'));module[_0x0849('0x8')]=function(_0x2f485a,_0x5b5764){return _0x2f485a['define'](_0x0849('0x9'),attributes,{'tableName':_0x0849('0xa'),'paranoid':![],'indexes':[{'name':_0x0849('0xb'),'fields':[_0x0849('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1088=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','./screenRecording.attributes','ScreenRecording'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1088,0x110));var _0x8108=function(_0x3dbf08,_0x1bbc94){_0x3dbf08=_0x3dbf08-0x0;var _0x258697=_0x1088[_0x3dbf08];return _0x258697;};'use strict';var _=require(_0x8108('0x0'));var util=require(_0x8108('0x1'));var logger=require(_0x8108('0x2'))(_0x8108('0x3'));var moment=require(_0x8108('0x4'));var BPromise=require(_0x8108('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8108('0x6'));module['exports']=function(_0x66c487,_0x21f53e){return _0x66c487['define'](_0x8108('0x7'),attributes,{'tableName':_0x8108('0x8'),'paranoid':![],'indexes':[{'name':_0x8108('0x9'),'fields':[_0x8108('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 52b2b16..321564b 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 _0x59f1=['../../config/environment','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1c2d28,_0x1e4edb){var _0x534e34=function(_0x41f7eb){while(--_0x41f7eb){_0x1c2d28['push'](_0x1c2d28['shift']());}};_0x534e34(++_0x1e4edb);}(_0x59f1,0x101));var _0x159f=function(_0x270ea4,_0x27a6ff){_0x270ea4=_0x270ea4-0x0;var _0x1f850c=_0x59f1[_0x270ea4];return _0x1f850c;};'use strict';var _=require(_0x159f('0x0'));var util=require(_0x159f('0x1'));var moment=require(_0x159f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x159f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x159f('0x4'));var logger=require(_0x159f('0x5'))(_0x159f('0x6'));var config=require(_0x159f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x159f('0x8')][_0x159f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454063,_0x3665eb,_0x2b8c35){return new BPromise(function(_0x58df1e,_0x5a8bdc){return client[_0x159f('0xa')](_0x454063,_0x2b8c35)['then'](function(_0x49ca5d){logger[_0x159f('0xb')](_0x159f('0xc'),_0x3665eb,_0x159f('0xd'));logger[_0x159f('0xe')](_0x159f('0xf'),_0x3665eb,_0x159f('0xd'),JSON[_0x159f('0x10')](_0x49ca5d));if(_0x49ca5d[_0x159f('0x11')]){if(_0x49ca5d[_0x159f('0x11')][_0x159f('0x12')]===0x1f4){logger['error'](_0x159f('0xc'),_0x3665eb,_0x49ca5d[_0x159f('0x11')][_0x159f('0x13')]);return _0x5a8bdc(_0x49ca5d['error'][_0x159f('0x13')]);}logger[_0x159f('0x11')](_0x159f('0xc'),_0x3665eb,_0x49ca5d[_0x159f('0x11')]['message']);return _0x58df1e(_0x49ca5d[_0x159f('0x11')][_0x159f('0x13')]);}else{logger[_0x159f('0xb')](_0x159f('0xc'),_0x3665eb,_0x159f('0xd'));_0x58df1e(_0x49ca5d[_0x159f('0x14')]['message']);}})[_0x159f('0x15')](function(_0x48835b){logger['error'](_0x159f('0xc'),_0x3665eb,_0x48835b);_0x5a8bdc(_0x48835b);});});} \ No newline at end of file +var _0x9f6b=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x4519f0,_0x2cc353){var _0x336876=function(_0x4e2328){while(--_0x4e2328){_0x4519f0['push'](_0x4519f0['shift']());}};_0x336876(++_0x2cc353);}(_0x9f6b,0x1a9));var _0xb9f6=function(_0x566147,_0x4f500f){_0x566147=_0x566147-0x0;var _0x213c3b=_0x9f6b[_0x566147];return _0x213c3b;};'use strict';var _=require(_0xb9f6('0x0'));var util=require(_0xb9f6('0x1'));var moment=require(_0xb9f6('0x2'));var BPromise=require(_0xb9f6('0x3'));var rs=require(_0xb9f6('0x4'));var fs=require('fs');var Redis=require(_0xb9f6('0x5'));var db=require(_0xb9f6('0x6'))['db'];var utils=require(_0xb9f6('0x7'));var logger=require('../../config/logger')(_0xb9f6('0x8'));var config=require('../../config/environment');var jayson=require(_0xb9f6('0x9'));var client=jayson[_0xb9f6('0xa')][_0xb9f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df095,_0x3b5bf9,_0x2bc42d){return new BPromise(function(_0x22f3fd,_0x277535){return client[_0xb9f6('0xc')](_0x5df095,_0x2bc42d)['then'](function(_0x3b114b){logger['info'](_0xb9f6('0xd'),_0x3b5bf9,_0xb9f6('0xe'));logger[_0xb9f6('0xf')](_0xb9f6('0x10'),_0x3b5bf9,_0xb9f6('0xe'),JSON[_0xb9f6('0x11')](_0x3b114b));if(_0x3b114b[_0xb9f6('0x12')]){if(_0x3b114b['error'][_0xb9f6('0x13')]===0x1f4){logger[_0xb9f6('0x12')](_0xb9f6('0xd'),_0x3b5bf9,_0x3b114b[_0xb9f6('0x12')][_0xb9f6('0x14')]);return _0x277535(_0x3b114b[_0xb9f6('0x12')][_0xb9f6('0x14')]);}logger[_0xb9f6('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x3b5bf9,_0x3b114b[_0xb9f6('0x12')][_0xb9f6('0x14')]);return _0x22f3fd(_0x3b114b[_0xb9f6('0x12')][_0xb9f6('0x14')]);}else{logger[_0xb9f6('0x15')](_0xb9f6('0xd'),_0x3b5bf9,_0xb9f6('0xe'));_0x22f3fd(_0x3b114b['result'][_0xb9f6('0x14')]);}})['catch'](function(_0x27a247){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x3b5bf9,_0x27a247);_0x277535(_0x27a247);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0cbda03..6372bf2 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 _0xebb9=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','originalname','post','single','addLogo','logologin','extname','root','preferred','file','addPreferred','favicon','addFavicon','put','update','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo'];(function(_0x3c0ddb,_0x558df3){var _0x2e38d7=function(_0x1ca705){while(--_0x1ca705){_0x3c0ddb['push'](_0x3c0ddb['shift']());}};_0x2e38d7(++_0x558df3);}(_0xebb9,0x9d));var _0x9ebb=function(_0x2c1a27,_0x4cd2d9){_0x2c1a27=_0x2c1a27-0x0;var _0x58a7f7=_0xebb9[_0x2c1a27];return _0x58a7f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ebb('0x0'));var timeout=require('connect-timeout');var express=require(_0x9ebb('0x1'));var router=express[_0x9ebb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9ebb('0x3'));var interaction=require(_0x9ebb('0x4'));var config=require(_0x9ebb('0x5'));var controller=require(_0x9ebb('0x6'));router[_0x9ebb('0x7')]('/',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x9')]);router['get'](_0x9ebb('0xa'),controller[_0x9ebb('0xb')]);router[_0x9ebb('0x7')](_0x9ebb('0xc'),controller[_0x9ebb('0xd')]);router[_0x9ebb('0x7')](_0x9ebb('0xe'),controller[_0x9ebb('0xf')]);router[_0x9ebb('0x7')](_0x9ebb('0x10'),controller[_0x9ebb('0x11')]);router[_0x9ebb('0x7')](_0x9ebb('0x12'),controller['gdpr']);router[_0x9ebb('0x7')](_0x9ebb('0x13'),controller[_0x9ebb('0x14')]);router[_0x9ebb('0x7')](_0x9ebb('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x9ebb('0x16')]({'destination':function(_0x2e4190,_0x124c30,_0x4a170a){_0x4a170a(null,path[_0x9ebb('0x17')](config['root'],_0x9ebb('0x18')));},'filename':function(_0x561597,_0xa5ac84,_0x5e9ab8){_0x5e9ab8(null,util[_0x9ebb('0x19')](_0x9ebb('0x1a'),_0x9ebb('0x1b'),path['extname'](_0xa5ac84[_0x9ebb('0x1c')])));}})});router[_0x9ebb('0x1d')]('/:id/logo',upload[_0x9ebb('0x1e')]('file'),controller[_0x9ebb('0x1f')]);var upload=multer({'storage':multer[_0x9ebb('0x16')]({'destination':function(_0x5d46b8,_0x4163e0,_0x54acd3){_0x54acd3(null,path[_0x9ebb('0x17')](config['root'],_0x9ebb('0x18')));},'filename':function(_0x37c2b8,_0x518e31,_0x642eff){_0x642eff(null,util[_0x9ebb('0x19')](_0x9ebb('0x1a'),_0x9ebb('0x20'),path[_0x9ebb('0x21')](_0x518e31[_0x9ebb('0x1c')])));}})});router[_0x9ebb('0x1d')]('/:id/logo_login',upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x9ebb('0x16')]({'destination':function(_0xa27229,_0x49a61f,_0x8ac163){_0x8ac163(null,path[_0x9ebb('0x17')](config[_0x9ebb('0x22')],_0x9ebb('0x18')));},'filename':function(_0x4d4fe9,_0x3d8c07,_0x51f283){_0x51f283(null,util[_0x9ebb('0x19')]('%s%s',_0x9ebb('0x23'),path[_0x9ebb('0x21')](_0x3d8c07[_0x9ebb('0x1c')])));}})});router[_0x9ebb('0x1d')]('/:id/preferred',upload['single'](_0x9ebb('0x24')),controller[_0x9ebb('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1521c7,_0x4c2a3d,_0x361945){_0x361945(null,path[_0x9ebb('0x17')](config[_0x9ebb('0x22')],_0x9ebb('0x18')));},'filename':function(_0x3b61b7,_0x5910b9,_0x958c6b){_0x958c6b(null,util[_0x9ebb('0x19')]('%s%s',_0x9ebb('0x26'),path[_0x9ebb('0x21')](_0x5910b9['originalname'])));}})});router['post'](_0x9ebb('0x15'),upload[_0x9ebb('0x1e')](_0x9ebb('0x24')),controller[_0x9ebb('0x27')]);router[_0x9ebb('0x28')](_0x9ebb('0xc'),auth['isAuthenticated'](),controller[_0x9ebb('0x29')]);module[_0x9ebb('0x2a')]=router; \ No newline at end of file +var _0x2ecd=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','getDate','/:id','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','server/files/images/logos/','format','logo','originalname','post','/:id/logo','single','file','addLogo','diskStorage','%s%s','/:id/logo_login','addLogoLogin','join','preferred','extname','favicon','addFavicon','put','isAuthenticated','update','exports'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x2ecd,0x78));var _0xd2ec=function(_0x14b57b,_0x550b13){_0x14b57b=_0x14b57b-0x0;var _0x248f0f=_0x2ecd[_0x14b57b];return _0x248f0f;};'use strict';var multer=require(_0xd2ec('0x0'));var util=require('util');var path=require(_0xd2ec('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2ec('0x2'));var router=express['Router']();var fs_extra=require(_0xd2ec('0x3'));var auth=require(_0xd2ec('0x4'));var interaction=require(_0xd2ec('0x5'));var config=require(_0xd2ec('0x6'));var controller=require('./setting.controller');router[_0xd2ec('0x7')]('/',auth['isAuthenticated'](),controller[_0xd2ec('0x8')]);router[_0xd2ec('0x7')]('/now',controller[_0xd2ec('0x9')]);router[_0xd2ec('0x7')](_0xd2ec('0xa'),controller['show']);router[_0xd2ec('0x7')]('/:id/logo',controller['getLogo']);router[_0xd2ec('0x7')]('/:id/logo_login',controller[_0xd2ec('0xb')]);router[_0xd2ec('0x7')]('/:id/gdpr',controller[_0xd2ec('0xc')]);router[_0xd2ec('0x7')](_0xd2ec('0xd'),controller[_0xd2ec('0xe')]);router[_0xd2ec('0x7')](_0xd2ec('0xf'),controller[_0xd2ec('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56af2b,_0x147833,_0xef448f){_0xef448f(null,path['join'](config[_0xd2ec('0x11')],_0xd2ec('0x12')));},'filename':function(_0x4420c3,_0x527aca,_0x568d70){_0x568d70(null,util[_0xd2ec('0x13')]('%s%s',_0xd2ec('0x14'),path['extname'](_0x527aca[_0xd2ec('0x15')])));}})});router[_0xd2ec('0x16')](_0xd2ec('0x17'),upload[_0xd2ec('0x18')](_0xd2ec('0x19')),controller[_0xd2ec('0x1a')]);var upload=multer({'storage':multer[_0xd2ec('0x1b')]({'destination':function(_0x4e8a6a,_0x2597ed,_0x532986){_0x532986(null,path['join'](config[_0xd2ec('0x11')],'server/files/images/logos/'));},'filename':function(_0xf10325,_0x52bc3f,_0x5b9a13){_0x5b9a13(null,util[_0xd2ec('0x13')](_0xd2ec('0x1c'),'logologin',path['extname'](_0x52bc3f[_0xd2ec('0x15')])));}})});router[_0xd2ec('0x16')](_0xd2ec('0x1d'),upload[_0xd2ec('0x18')]('file'),controller[_0xd2ec('0x1e')]);var upload=multer({'storage':multer[_0xd2ec('0x1b')]({'destination':function(_0x4e516f,_0x48327f,_0x4f92da){_0x4f92da(null,path[_0xd2ec('0x1f')](config[_0xd2ec('0x11')],_0xd2ec('0x12')));},'filename':function(_0xa9a763,_0x1813c8,_0x22d424){_0x22d424(null,util[_0xd2ec('0x13')](_0xd2ec('0x1c'),_0xd2ec('0x20'),path[_0xd2ec('0x21')](_0x1813c8[_0xd2ec('0x15')])));}})});router[_0xd2ec('0x16')](_0xd2ec('0xd'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xd2ec('0x1b')]({'destination':function(_0x157b0f,_0x437416,_0x1be808){_0x1be808(null,path[_0xd2ec('0x1f')](config[_0xd2ec('0x11')],'server/files/images/logos/'));},'filename':function(_0xc85fe,_0x166bf1,_0x44a29c){_0x44a29c(null,util[_0xd2ec('0x13')](_0xd2ec('0x1c'),_0xd2ec('0x22'),path[_0xd2ec('0x21')](_0x166bf1['originalname'])));}})});router[_0xd2ec('0x16')](_0xd2ec('0xf'),upload[_0xd2ec('0x18')]('file'),controller[_0xd2ec('0x23')]);router[_0xd2ec('0x24')]('/:id',auth[_0xd2ec('0x25')](),controller[_0xd2ec('0x26')]);module[_0xd2ec('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e2f04b1..d71a4e1 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x7fc629,_0x2b1b7c){var _0x5e395d=function(_0x18bc8d){while(--_0x18bc8d){_0x7fc629['push'](_0x7fc629['shift']());}};_0x5e395d(++_0x2b1b7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3a1447,_0x274fbc){var _0x52c62f=function(_0x4d1610){while(--_0x4d1610){_0x3a1447['push'](_0x3a1447['shift']());}};_0x52c62f(++_0x274fbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'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 f26093e..b3136d4 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 _0x3f11=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','keys','options','find','body','addLogo','file','filename','logo','params','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','loginLogo','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','Sequelize','getFavicon','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x484671,_0x35bc7e){var _0xdf3c2a=function(_0x40bab8){while(--_0x40bab8){_0x484671['push'](_0x484671['shift']());}};_0xdf3c2a(++_0x35bc7e);}(_0x3f11,0x6c));var _0x13f1=function(_0x26bb21,_0x4d8161){_0x26bb21=_0x26bb21-0x0;var _0x3b86d8=_0x3f11[_0x26bb21];return _0x3b86d8;};'use strict';var emlformat=require(_0x13f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13f1('0x1'));var moment=require(_0x13f1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x13f1('0x3'));var util=require('util');var path=require(_0x13f1('0x4'));var sox=require(_0x13f1('0x5'));var csv=require(_0x13f1('0x6'));var ejs=require(_0x13f1('0x7'));var fs=require('fs');var fs_extra=require(_0x13f1('0x8'));var _=require(_0x13f1('0x9'));var squel=require(_0x13f1('0xa'));var crypto=require(_0x13f1('0xb'));var jsforce=require(_0x13f1('0xc'));var deskjs=require(_0x13f1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x13f1('0xe'));var Papa=require(_0x13f1('0xf'));var Redis=require(_0x13f1('0x10'));var authService=require(_0x13f1('0x11'));var qs=require(_0x13f1('0x12'));var as=require(_0x13f1('0x13'));var hardwareService=require(_0x13f1('0x14'));var logger=require(_0x13f1('0x15'))(_0x13f1('0x16'));var utils=require(_0x13f1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x13f1('0x18'));var db=require(_0x13f1('0x19'))['db'];var jayson=require(_0x13f1('0x1a'));var client=jayson[_0x13f1('0x1b')][_0x13f1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x423ab0,_0x119fbf,_0x5a0c77,_0xf993f){return new BPromise(function(_0x41dd04,_0x116294){var _0x3f0d8a=_0xf993f||client;return _0x3f0d8a[_0x13f1('0x1d')](_0x423ab0,_0x5a0c77)['then'](function(_0x42d1c1){logger[_0x13f1('0x1e')](_0x13f1('0x1f'),_0x119fbf,'request\x20sent');logger[_0x13f1('0x20')](_0x13f1('0x21'),_0x119fbf,_0x13f1('0x22'),JSON[_0x13f1('0x23')](_0x42d1c1));if(_0x42d1c1[_0x13f1('0x24')]){if(_0x42d1c1['error'][_0x13f1('0x25')]===0x1f4){logger[_0x13f1('0x24')](_0x13f1('0x1f'),_0x119fbf,_0x42d1c1['error'][_0x13f1('0x26')]);return _0x116294(_0x42d1c1[_0x13f1('0x24')][_0x13f1('0x26')]);}logger[_0x13f1('0x24')](_0x13f1('0x1f'),_0x119fbf,_0x42d1c1['error'][_0x13f1('0x26')]);return _0x41dd04(_0x42d1c1[_0x13f1('0x24')][_0x13f1('0x26')]);}else{logger['info'](_0x13f1('0x1f'),_0x119fbf,'request\x20sent');_0x41dd04(_0x42d1c1[_0x13f1('0x27')]['message']);}})[_0x13f1('0x28')](function(_0x52d05b){logger[_0x13f1('0x24')](_0x13f1('0x1f'),_0x119fbf,_0x52d05b);_0x116294(_0x52d05b);});});}function respondWithStatusCode(_0x39a03e,_0xc00d40){_0xc00d40=_0xc00d40||0xcc;return function(_0x487b5c){if(_0x487b5c){return _0x39a03e[_0x13f1('0x29')](_0xc00d40);}return _0x39a03e[_0x13f1('0x2a')](_0xc00d40)[_0x13f1('0x2b')]();};}function respondWithResult(_0x39feb3,_0x54afeb){_0x54afeb=_0x54afeb||0xc8;return function(_0x1ba85e){if(_0x1ba85e){return _0x39feb3[_0x13f1('0x2a')](_0x54afeb)['json'](_0x1ba85e);}};}function respondWithFilteredResult(_0x4b7bdf,_0x5e7ffa){return function(_0x45bc10){if(_0x45bc10){var _0x395f99=typeof _0x5e7ffa['offset']===_0x13f1('0x2c')&&typeof _0x5e7ffa[_0x13f1('0x2d')]==='undefined';var _0x296772=_0x45bc10[_0x13f1('0x2e')];var _0x23891a=_0x395f99?0x0:_0x5e7ffa[_0x13f1('0x2f')];var _0x3cb005=_0x395f99?_0x45bc10[_0x13f1('0x2e')]:_0x5e7ffa[_0x13f1('0x2f')]+_0x5e7ffa[_0x13f1('0x2d')];var _0x576773;if(_0x3cb005>=_0x296772){_0x3cb005=_0x296772;_0x576773=0xc8;}else{_0x576773=0xce;}_0x4b7bdf[_0x13f1('0x2a')](_0x576773);return _0x4b7bdf[_0x13f1('0x30')](_0x13f1('0x31'),_0x23891a+'-'+_0x3cb005+'/'+_0x296772)[_0x13f1('0x32')](_0x45bc10);}return null;};}function patchUpdates(_0xcfd607){return function(_0x2a4da6){try{jsonpatch[_0x13f1('0x33')](_0x2a4da6,_0xcfd607,!![]);}catch(_0x52a000){return BPromise['reject'](_0x52a000);}return _0x2a4da6[_0x13f1('0x34')]();};}function saveUpdates(_0x56a1b9,_0x47d644){return function(_0x3f247f){if(_0x3f247f){return _0x3f247f[_0x13f1('0x35')](_0x56a1b9)[_0x13f1('0x36')](function(_0x1a1707){return _0x1a1707;});}return null;};}function removeEntity(_0x3255d3,_0x4312ca){return function(_0x1fde07){if(_0x1fde07){return _0x1fde07['destroy']()[_0x13f1('0x36')](function(){_0x3255d3[_0x13f1('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29229a,_0x35e601){return function(_0x551ebd){if(!_0x551ebd){_0x29229a[_0x13f1('0x29')](0x194);}return _0x551ebd;};}function handleError(_0x34aa08,_0x4ab199){_0x4ab199=_0x4ab199||0x1f4;return function(_0x19a970){logger[_0x13f1('0x24')](_0x19a970[_0x13f1('0x37')]);if(_0x19a970[_0x13f1('0x38')]){delete _0x19a970['name'];}_0x34aa08[_0x13f1('0x2a')](_0x4ab199)[_0x13f1('0x39')](_0x19a970);};}exports[_0x13f1('0x3a')]=function(_0x3baa61,_0x4548b4){var _0x3d51b2={},_0x112ccf={},_0x30cf36={'count':0x0,'rows':[]};var _0x1a9f12=_[_0x13f1('0x3b')](db[_0x13f1('0x3c')][_0x13f1('0x3d')],function(_0x1c883a){return{'name':_0x1c883a[_0x13f1('0x3e')],'type':_0x1c883a[_0x13f1('0x3f')][_0x13f1('0x40')]};});_0x112ccf[_0x13f1('0x41')]=_[_0x13f1('0x3b')](_0x1a9f12,'name');_0x112ccf[_0x13f1('0x42')]=_['keys'](_0x3baa61[_0x13f1('0x42')]);_0x112ccf[_0x13f1('0x43')]=_[_0x13f1('0x44')](_0x112ccf[_0x13f1('0x41')],_0x112ccf[_0x13f1('0x42')]);_0x3d51b2[_0x13f1('0x45')]=_['intersection'](_0x112ccf[_0x13f1('0x41')],qs[_0x13f1('0x46')](_0x3baa61[_0x13f1('0x42')][_0x13f1('0x46')]));_0x3d51b2['attributes']=_0x3d51b2[_0x13f1('0x45')][_0x13f1('0x47')]?_0x3d51b2[_0x13f1('0x45')]:_0x112ccf[_0x13f1('0x41')];if(!_0x3baa61[_0x13f1('0x42')][_0x13f1('0x48')](_0x13f1('0x49'))){_0x3d51b2[_0x13f1('0x2d')]=qs[_0x13f1('0x2d')](_0x3baa61['query']['limit']);_0x3d51b2[_0x13f1('0x2f')]=qs[_0x13f1('0x2f')](_0x3baa61[_0x13f1('0x42')][_0x13f1('0x2f')]);}_0x3d51b2[_0x13f1('0x4a')]=qs[_0x13f1('0x4b')](_0x3baa61['query']['sort']);_0x3d51b2[_0x13f1('0x4c')]=qs['filters'](_[_0x13f1('0x4d')](_0x3baa61[_0x13f1('0x42')],_0x112ccf[_0x13f1('0x43')]),_0x1a9f12);if(_0x3baa61[_0x13f1('0x42')][_0x13f1('0x4e')]){_0x3d51b2['where']=_['merge'](_0x3d51b2[_0x13f1('0x4c')],{'$or':_[_0x13f1('0x3b')](_0x1a9f12,function(_0x1a7696){if(_0x1a7696[_0x13f1('0x3f')]!==_0x13f1('0x4f')){var _0x1d35cb={};_0x1d35cb[_0x1a7696[_0x13f1('0x38')]]={'$like':'%'+_0x3baa61['query']['filter']+'%'};return _0x1d35cb;}})});}_0x3d51b2=_[_0x13f1('0x50')]({},_0x3d51b2,_0x3baa61['options']);var _0x363575={'where':_0x3d51b2['where']};return db[_0x13f1('0x3c')][_0x13f1('0x2e')](_0x363575)[_0x13f1('0x36')](function(_0x438eb4){_0x30cf36['count']=_0x438eb4;if(_0x3baa61[_0x13f1('0x42')]['includeAll']){_0x3d51b2[_0x13f1('0x51')]=[{'all':!![]}];}return db['Setting'][_0x13f1('0x52')](_0x3d51b2);})[_0x13f1('0x36')](function(_0x5d991e){_0x30cf36[_0x13f1('0x53')]=_0x5d991e;return _0x30cf36;})['then'](respondWithFilteredResult(_0x4548b4,_0x3d51b2))[_0x13f1('0x28')](handleError(_0x4548b4,null));};exports[_0x13f1('0x54')]=function(_0x35e97e,_0x5987f8){var _0x2c4c3e={'raw':![],'where':{'id':_0x35e97e['params']['id']}},_0x2d42ce={};_0x2d42ce[_0x13f1('0x41')]=_[_0x13f1('0x55')](db[_0x13f1('0x3c')][_0x13f1('0x3d')]);_0x2d42ce[_0x13f1('0x42')]=_['keys'](_0x35e97e['query']);_0x2d42ce[_0x13f1('0x43')]=_[_0x13f1('0x44')](_0x2d42ce[_0x13f1('0x41')],_0x2d42ce[_0x13f1('0x42')]);_0x2c4c3e[_0x13f1('0x45')]=_[_0x13f1('0x44')](_0x2d42ce[_0x13f1('0x41')],qs[_0x13f1('0x46')](_0x35e97e['query'][_0x13f1('0x46')]));_0x2c4c3e[_0x13f1('0x45')]=_0x2c4c3e[_0x13f1('0x45')][_0x13f1('0x47')]?_0x2c4c3e[_0x13f1('0x45')]:_0x2d42ce[_0x13f1('0x41')];if(_0x35e97e[_0x13f1('0x42')]['includeAll']){_0x2c4c3e[_0x13f1('0x51')]=[{'all':!![]}];}_0x2c4c3e=_[_0x13f1('0x50')]({},_0x2c4c3e,_0x35e97e[_0x13f1('0x56')]);return db[_0x13f1('0x3c')][_0x13f1('0x57')](_0x2c4c3e)[_0x13f1('0x36')](handleEntityNotFound(_0x5987f8,null))[_0x13f1('0x36')](respondWithResult(_0x5987f8,null))[_0x13f1('0x28')](handleError(_0x5987f8,null));};exports[_0x13f1('0x35')]=function(_0x2ae431,_0x155ce2){if(_0x2ae431['body']['id']){delete _0x2ae431[_0x13f1('0x58')]['id'];}return db['Setting'][_0x13f1('0x57')]({'where':{'id':_0x2ae431['params']['id']}})[_0x13f1('0x36')](handleEntityNotFound(_0x155ce2,null))[_0x13f1('0x36')](saveUpdates(_0x2ae431['body'],null))[_0x13f1('0x36')](respondWithResult(_0x155ce2,null))[_0x13f1('0x28')](handleError(_0x155ce2,null));};exports[_0x13f1('0x59')]=function(_0x1aa872,_0x241a2a,_0x52026e){if(_0x1aa872[_0x13f1('0x5a')]&&_0x1aa872[_0x13f1('0x5a')][_0x13f1('0x5b')]){_0x1aa872[_0x13f1('0x58')][_0x13f1('0x5c')]=_0x1aa872[_0x13f1('0x5a')][_0x13f1('0x5b')];}return db[_0x13f1('0x3c')][_0x13f1('0x57')]({'where':{'id':_0x1aa872[_0x13f1('0x5d')]['id']}})[_0x13f1('0x36')](handleEntityNotFound(_0x241a2a,null))[_0x13f1('0x36')](saveUpdates(_0x1aa872[_0x13f1('0x58')],null))[_0x13f1('0x36')](respondWithResult(_0x241a2a,null))[_0x13f1('0x28')](handleError(_0x241a2a,null));};exports['addLogoLogin']=function(_0x38223f,_0x9d7811,_0x549017){if(_0x38223f[_0x13f1('0x5a')]&&_0x38223f['file'][_0x13f1('0x5b')]){_0x38223f['body']['loginLogo']=_0x38223f[_0x13f1('0x5a')][_0x13f1('0x5b')];}return db[_0x13f1('0x3c')][_0x13f1('0x57')]({'where':{'id':_0x38223f[_0x13f1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x9d7811,null))[_0x13f1('0x36')](saveUpdates(_0x38223f[_0x13f1('0x58')],null))[_0x13f1('0x36')](respondWithResult(_0x9d7811,null))[_0x13f1('0x28')](handleError(_0x9d7811,null));};var utilLicense=require('../../config/license/util');exports[_0x13f1('0x5e')]=function(_0x2813e9,_0x4656f4,_0x42cb00){var _0x227356=_0x13f1('0x5f');var _0xc184b5={'custom':![]};return utilLicense[_0x13f1('0x60')]()[_0x13f1('0x36')](function(_0x9aed8a){if(_0x9aed8a){_0xc184b5=_0x9aed8a;}return db[_0x13f1('0x3c')][_0x13f1('0x57')]({'where':{'id':_0x2813e9['params']['id']},'attributes':[_0x13f1('0x5c'),'loginLogo',_0x13f1('0x61'),'favicon',_0x13f1('0x62'),_0x13f1('0x63'),_0x13f1('0x64'),_0x13f1('0x65')],'raw':!![]});})[_0x13f1('0x36')](handleEntityNotFound(_0x4656f4,null))[_0x13f1('0x36')](function(_0x5e7de6){if(_0x5e7de6){var _0x2ba916=_0x5e7de6['logo']&&fs[_0x13f1('0x66')](path['join'](config[_0x13f1('0x67')],_0x227356,_[_0x13f1('0x68')](_0x5e7de6[_0x13f1('0x5c')])))?path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x227356,_[_0x13f1('0x68')](_0x5e7de6[_0x13f1('0x5c')])):path[_0x13f1('0x69')](config['root'],_0x227356,_[_0x13f1('0x68')](_0x13f1('0x6a')));var _0x35ccf4=_0x13f1('0x6b')+_[_0x13f1('0x6c')](_0x13f1('0x5c'));if(_0x5e7de6[_0x35ccf4]||!_0xc184b5[_0x13f1('0x6d')]){_0x2ba916=path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x227356,_[_0x13f1('0x68')]('default_logo.svg'));}if(!fs[_0x13f1('0x66')](_0x2ba916)){throw new db['Sequelize'][(_0x13f1('0x6e'))](_[_0x13f1('0x6c')]('logo')+_0x13f1('0x6f'));}return _0x4656f4[_0x13f1('0x70')](_0x2ba916);}})[_0x13f1('0x28')](handleError(_0x4656f4,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x38c179,_0x39a3be,_0x1579d6){var _0x4b02af='server/files/images/logos';var _0x252f68={'custom':![]};return utilLicense[_0x13f1('0x60')]()['then'](function(_0x35ac39){if(_0x35ac39){_0x252f68=_0x35ac39;}return db['Setting'][_0x13f1('0x57')]({'where':{'id':_0x38c179[_0x13f1('0x5d')]['id']},'attributes':[_0x13f1('0x5c'),_0x13f1('0x71'),_0x13f1('0x61'),_0x13f1('0x72'),_0x13f1('0x62'),_0x13f1('0x63'),_0x13f1('0x64'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x39a3be,null))[_0x13f1('0x36')](function(_0x24bc4f){if(_0x24bc4f){var _0x503260=_0x24bc4f[_0x13f1('0x71')]&&fs[_0x13f1('0x66')](path[_0x13f1('0x69')](config['root'],_0x4b02af,_[_0x13f1('0x68')](_0x24bc4f['loginLogo'])))?path[_0x13f1('0x69')](config['root'],_0x4b02af,_[_0x13f1('0x68')](_0x24bc4f[_0x13f1('0x71')])):path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x4b02af,_[_0x13f1('0x68')](_0x13f1('0x73')));var _0x2788ea=_0x13f1('0x6b')+_['upperFirst'](_0x13f1('0x71'));if(_0x24bc4f[_0x2788ea]||!_0x252f68[_0x13f1('0x6d')]){_0x503260=path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x4b02af,_[_0x13f1('0x68')]('default_loginLogo.svg'));}if(!fs[_0x13f1('0x66')](_0x503260)){throw new db['Sequelize'][(_0x13f1('0x6e'))](_[_0x13f1('0x6c')]('loginLogo')+_0x13f1('0x6f'));}return _0x39a3be[_0x13f1('0x70')](_0x503260);}})[_0x13f1('0x28')](handleError(_0x39a3be,null));};exports[_0x13f1('0x74')]=function(_0xe10c81,_0xe003dc){return db['Setting'][_0x13f1('0x57')]({'where':{'id':_0xe10c81[_0x13f1('0x5d')]['id']},'attributes':[_0x13f1('0x75')]})[_0x13f1('0x36')](respondWithResult(_0xe003dc,null))['catch'](handleError(_0xe003dc,null));};exports[_0x13f1('0x76')]=function(_0x18b787,_0x2d0740,_0x1076a1){if(_0x18b787[_0x13f1('0x5a')]&&_0x18b787['file'][_0x13f1('0x5b')]){_0x18b787[_0x13f1('0x58')][_0x13f1('0x61')]=_0x18b787[_0x13f1('0x5a')][_0x13f1('0x5b')];}return db[_0x13f1('0x3c')][_0x13f1('0x57')]({'where':{'id':_0x18b787[_0x13f1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2d0740,null))[_0x13f1('0x36')](saveUpdates(_0x18b787[_0x13f1('0x58')],null))[_0x13f1('0x36')](respondWithResult(_0x2d0740,null))['catch'](handleError(_0x2d0740,null));};var utilLicense=require(_0x13f1('0x18'));exports[_0x13f1('0x77')]=function(_0x3bcc28,_0x37d378,_0xa3421b){var _0x271c06=_0x13f1('0x5f');var _0x1d1cf0={'custom':![]};return utilLicense[_0x13f1('0x60')]()[_0x13f1('0x36')](function(_0x269e97){if(_0x269e97){_0x1d1cf0=_0x269e97;}return db[_0x13f1('0x3c')]['find']({'where':{'id':_0x3bcc28['params']['id']},'attributes':['logo',_0x13f1('0x71'),_0x13f1('0x61'),_0x13f1('0x72'),'defaultLogo',_0x13f1('0x63'),'defaultPreferred',_0x13f1('0x65')],'raw':!![]});})[_0x13f1('0x36')](handleEntityNotFound(_0x37d378,null))[_0x13f1('0x36')](function(_0xdd635e){if(_0xdd635e){var _0x413eb6=_0xdd635e[_0x13f1('0x61')]&&fs[_0x13f1('0x66')](path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x271c06,_[_0x13f1('0x68')](_0xdd635e[_0x13f1('0x61')])))?path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x271c06,_['toLower'](_0xdd635e[_0x13f1('0x61')])):path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x271c06,_[_0x13f1('0x68')](_0x13f1('0x78')));var _0x34f58a='default'+_[_0x13f1('0x6c')](_0x13f1('0x61'));if(_0xdd635e[_0x34f58a]||!_0x1d1cf0[_0x13f1('0x6d')]||!_0x1d1cf0['preferred']){_0x413eb6=path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x271c06,_[_0x13f1('0x68')](_0x13f1('0x78')));}if(!fs[_0x13f1('0x66')](_0x413eb6)){throw new db[(_0x13f1('0x79'))][(_0x13f1('0x6e'))](_[_0x13f1('0x6c')](_0x13f1('0x61'))+_0x13f1('0x6f'));}return _0x37d378[_0x13f1('0x70')](_0x413eb6);}})['catch'](handleError(_0x37d378,null));};exports['addFavicon']=function(_0x10d838,_0x37c6fe,_0x585f87){if(_0x10d838['file']&&_0x10d838['file']['filename']){_0x10d838[_0x13f1('0x58')][_0x13f1('0x72')]=_0x10d838[_0x13f1('0x5a')][_0x13f1('0x5b')];}return db[_0x13f1('0x3c')]['find']({'where':{'id':_0x10d838[_0x13f1('0x5d')]['id']}})[_0x13f1('0x36')](handleEntityNotFound(_0x37c6fe,null))[_0x13f1('0x36')](saveUpdates(_0x10d838[_0x13f1('0x58')],null))[_0x13f1('0x36')](respondWithResult(_0x37c6fe,null))[_0x13f1('0x28')](handleError(_0x37c6fe,null));};var utilLicense=require(_0x13f1('0x18'));exports[_0x13f1('0x7a')]=function(_0x135cca,_0x3f6212,_0x3ead46){var _0x37bb25=_0x13f1('0x5f');var _0x1690d2={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x591e8e){if(_0x591e8e){_0x1690d2=_0x591e8e;}return db[_0x13f1('0x3c')][_0x13f1('0x57')]({'where':{'id':_0x135cca[_0x13f1('0x5d')]['id']},'attributes':['logo','loginLogo',_0x13f1('0x61'),'favicon',_0x13f1('0x62'),_0x13f1('0x63'),_0x13f1('0x64'),'defaultFavicon'],'raw':!![]});})[_0x13f1('0x36')](handleEntityNotFound(_0x3f6212,null))[_0x13f1('0x36')](function(_0xec8f73){if(_0xec8f73){var _0x30dfc7=_0xec8f73[_0x13f1('0x72')]&&fs[_0x13f1('0x66')](path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x37bb25,_[_0x13f1('0x68')](_0xec8f73['favicon'])))?path[_0x13f1('0x69')](config['root'],_0x37bb25,_[_0x13f1('0x68')](_0xec8f73[_0x13f1('0x72')])):path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x37bb25,_[_0x13f1('0x68')]('default_favicon.ico'));var _0x5dec68=_0x13f1('0x6b')+_[_0x13f1('0x6c')](_0x13f1('0x72'));if(_0xec8f73[_0x5dec68]||!_0x1690d2[_0x13f1('0x6d')]){_0x30dfc7=path[_0x13f1('0x69')](config[_0x13f1('0x67')],_0x37bb25,_[_0x13f1('0x68')]('default_favicon.ico'));}if(!fs[_0x13f1('0x66')](_0x30dfc7)){throw new db[(_0x13f1('0x79'))][(_0x13f1('0x6e'))](_['upperFirst'](_0x13f1('0x72'))+_0x13f1('0x6f'));}return _0x3f6212[_0x13f1('0x70')](_0x30dfc7);}})[_0x13f1('0x28')](handleError(_0x3f6212,null));};exports[_0x13f1('0x7b')]=function(_0x49880c,_0x4f1d20){var _0xc31eb={'offset':moment()[_0x13f1('0x7c')]()};_0xc31eb['now']=moment()[_0x13f1('0x7c')](_0xc31eb[_0x13f1('0x2f')])[_0x13f1('0x7d')](_0x13f1('0x7e'));return _0x4f1d20['status'](0xc8)['send'](_0xc31eb);}; \ No newline at end of file +var _0x51f8=['path','sox','to-csv','ejs','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','update','stack','name','index','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','Setting','findAll','rows','show','params','fields','include','find','body','filename','logo','file','addLogoLogin','loginLogo','getLogo','server/files/images/logos','favicon','defaultLogo','defaultFavicon','existsSync','root','join','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','preferred','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x2b853f,_0x12b144){var _0x4e867f=function(_0x3a0db7){while(--_0x3a0db7){_0x2b853f['push'](_0x2b853f['shift']());}};_0x4e867f(++_0x12b144);}(_0x51f8,0x15f));var _0x851f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x51f8[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x851f('0x0'));var rimraf=require(_0x851f('0x1'));var zipdir=require(_0x851f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x851f('0x3'));var moment=require('moment');var BPromise=require(_0x851f('0x4'));var Mustache=require(_0x851f('0x5'));var util=require('util');var path=require(_0x851f('0x6'));var sox=require(_0x851f('0x7'));var csv=require(_0x851f('0x8'));var ejs=require(_0x851f('0x9'));var fs=require('fs');var fs_extra=require(_0x851f('0xa'));var _=require(_0x851f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x851f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x851f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x851f('0xd'));var authService=require(_0x851f('0xe'));var qs=require(_0x851f('0xf'));var as=require(_0x851f('0x10'));var hardwareService=require(_0x851f('0x11'));var logger=require(_0x851f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x851f('0x13'));var licenseUtil=require(_0x851f('0x14'));var db=require(_0x851f('0x15'))['db'];var jayson=require(_0x851f('0x16'));var client=jayson['client'][_0x851f('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x520418,_0xd38073,_0x1a1dc2,_0x5421f0){return new BPromise(function(_0x3ba103,_0x4f8c33){var _0x1cc719=_0x5421f0||client;return _0x1cc719[_0x851f('0x18')](_0x520418,_0x1a1dc2)[_0x851f('0x19')](function(_0x10a175){logger[_0x851f('0x1a')](_0x851f('0x1b'),_0xd38073,'request\x20sent');logger[_0x851f('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0xd38073,_0x851f('0x1d'),JSON[_0x851f('0x1e')](_0x10a175));if(_0x10a175[_0x851f('0x1f')]){if(_0x10a175[_0x851f('0x1f')][_0x851f('0x20')]===0x1f4){logger[_0x851f('0x1f')]('Setting,\x20%s,\x20%s',_0xd38073,_0x10a175[_0x851f('0x1f')][_0x851f('0x21')]);return _0x4f8c33(_0x10a175[_0x851f('0x1f')][_0x851f('0x21')]);}logger[_0x851f('0x1f')]('Setting,\x20%s,\x20%s',_0xd38073,_0x10a175[_0x851f('0x1f')][_0x851f('0x21')]);return _0x3ba103(_0x10a175['error'][_0x851f('0x21')]);}else{logger[_0x851f('0x1a')](_0x851f('0x1b'),_0xd38073,_0x851f('0x1d'));_0x3ba103(_0x10a175[_0x851f('0x22')][_0x851f('0x21')]);}})[_0x851f('0x23')](function(_0x305cb6){logger['error'](_0x851f('0x1b'),_0xd38073,_0x305cb6);_0x4f8c33(_0x305cb6);});});}function respondWithStatusCode(_0x53773a,_0x304919){_0x304919=_0x304919||0xcc;return function(_0x3a3b29){if(_0x3a3b29){return _0x53773a[_0x851f('0x24')](_0x304919);}return _0x53773a['status'](_0x304919)[_0x851f('0x25')]();};}function respondWithResult(_0x2f4839,_0x24f507){_0x24f507=_0x24f507||0xc8;return function(_0x1843b0){if(_0x1843b0){return _0x2f4839[_0x851f('0x26')](_0x24f507)[_0x851f('0x27')](_0x1843b0);}};}function respondWithFilteredResult(_0x4ca106,_0x3726cf){return function(_0x1ad890){if(_0x1ad890){var _0x20de24=typeof _0x3726cf[_0x851f('0x28')]===_0x851f('0x29')&&typeof _0x3726cf[_0x851f('0x2a')]===_0x851f('0x29');var _0x18fd32=_0x1ad890[_0x851f('0x2b')];var _0x4b292c=_0x20de24?0x0:_0x3726cf[_0x851f('0x28')];var _0x480c97=_0x20de24?_0x1ad890['count']:_0x3726cf['offset']+_0x3726cf[_0x851f('0x2a')];var _0x3332e3;if(_0x480c97>=_0x18fd32){_0x480c97=_0x18fd32;_0x3332e3=0xc8;}else{_0x3332e3=0xce;}_0x4ca106[_0x851f('0x26')](_0x3332e3);return _0x4ca106[_0x851f('0x2c')]('Content-Range',_0x4b292c+'-'+_0x480c97+'/'+_0x18fd32)[_0x851f('0x27')](_0x1ad890);}return null;};}function patchUpdates(_0x2d8b9a){return function(_0x27e12c){try{jsonpatch['apply'](_0x27e12c,_0x2d8b9a,!![]);}catch(_0x125328){return BPromise['reject'](_0x125328);}return _0x27e12c['save']();};}function saveUpdates(_0x56cfba,_0x137f1c){return function(_0x4422c2){if(_0x4422c2){return _0x4422c2[_0x851f('0x2d')](_0x56cfba)[_0x851f('0x19')](function(_0x279bda){return _0x279bda;});}return null;};}function removeEntity(_0x3a9cb5,_0x9e4cd7){return function(_0xd230fb){if(_0xd230fb){return _0xd230fb['destroy']()['then'](function(){_0x3a9cb5[_0x851f('0x26')](0xcc)[_0x851f('0x25')]();});}};}function handleEntityNotFound(_0x249ab0,_0x1af036){return function(_0xcd9d8f){if(!_0xcd9d8f){_0x249ab0[_0x851f('0x24')](0x194);}return _0xcd9d8f;};}function handleError(_0x24b07a,_0x1c82e4){_0x1c82e4=_0x1c82e4||0x1f4;return function(_0x3fe480){logger['error'](_0x3fe480[_0x851f('0x2e')]);if(_0x3fe480[_0x851f('0x2f')]){delete _0x3fe480[_0x851f('0x2f')];}_0x24b07a[_0x851f('0x26')](_0x1c82e4)['send'](_0x3fe480);};}exports[_0x851f('0x30')]=function(_0x4fa7ec,_0x4220f7){var _0x237f84={},_0x5ac07b={},_0x243891={'count':0x0,'rows':[]};var _0x13b78d=_['map'](db['Setting'][_0x851f('0x31')],function(_0x3582a0){return{'name':_0x3582a0[_0x851f('0x32')],'type':_0x3582a0['type'][_0x851f('0x33')]};});_0x5ac07b['model']=_[_0x851f('0x34')](_0x13b78d,_0x851f('0x2f'));_0x5ac07b['query']=_[_0x851f('0x35')](_0x4fa7ec[_0x851f('0x36')]);_0x5ac07b[_0x851f('0x37')]=_[_0x851f('0x38')](_0x5ac07b[_0x851f('0x39')],_0x5ac07b[_0x851f('0x36')]);_0x237f84[_0x851f('0x3a')]=_['intersection'](_0x5ac07b[_0x851f('0x39')],qs['fields'](_0x4fa7ec[_0x851f('0x36')]['fields']));_0x237f84['attributes']=_0x237f84['attributes'][_0x851f('0x3b')]?_0x237f84['attributes']:_0x5ac07b[_0x851f('0x39')];if(!_0x4fa7ec[_0x851f('0x36')][_0x851f('0x3c')]('nolimit')){_0x237f84[_0x851f('0x2a')]=qs['limit'](_0x4fa7ec[_0x851f('0x36')][_0x851f('0x2a')]);_0x237f84[_0x851f('0x28')]=qs[_0x851f('0x28')](_0x4fa7ec[_0x851f('0x36')][_0x851f('0x28')]);}_0x237f84[_0x851f('0x3d')]=qs[_0x851f('0x3e')](_0x4fa7ec[_0x851f('0x36')][_0x851f('0x3e')]);_0x237f84[_0x851f('0x3f')]=qs[_0x851f('0x37')](_['pick'](_0x4fa7ec[_0x851f('0x36')],_0x5ac07b[_0x851f('0x37')]),_0x13b78d);if(_0x4fa7ec[_0x851f('0x36')][_0x851f('0x40')]){_0x237f84[_0x851f('0x3f')]=_[_0x851f('0x41')](_0x237f84[_0x851f('0x3f')],{'$or':_[_0x851f('0x34')](_0x13b78d,function(_0x6549d2){if(_0x6549d2[_0x851f('0x42')]!==_0x851f('0x43')){var _0x523f35={};_0x523f35[_0x6549d2[_0x851f('0x2f')]]={'$like':'%'+_0x4fa7ec['query'][_0x851f('0x40')]+'%'};return _0x523f35;}})});}_0x237f84=_['merge']({},_0x237f84,_0x4fa7ec[_0x851f('0x44')]);var _0x34169d={'where':_0x237f84[_0x851f('0x3f')]};return db['Setting']['count'](_0x34169d)[_0x851f('0x19')](function(_0x229a90){_0x243891[_0x851f('0x2b')]=_0x229a90;if(_0x4fa7ec[_0x851f('0x36')][_0x851f('0x45')]){_0x237f84['include']=[{'all':!![]}];}return db[_0x851f('0x46')][_0x851f('0x47')](_0x237f84);})[_0x851f('0x19')](function(_0x38f4a7){_0x243891[_0x851f('0x48')]=_0x38f4a7;return _0x243891;})[_0x851f('0x19')](respondWithFilteredResult(_0x4220f7,_0x237f84))['catch'](handleError(_0x4220f7,null));};exports[_0x851f('0x49')]=function(_0x49215b,_0xa0c2ba){var _0x42052e={'raw':![],'where':{'id':_0x49215b[_0x851f('0x4a')]['id']}},_0x241c5a={};_0x241c5a[_0x851f('0x39')]=_[_0x851f('0x35')](db[_0x851f('0x46')][_0x851f('0x31')]);_0x241c5a[_0x851f('0x36')]=_[_0x851f('0x35')](_0x49215b['query']);_0x241c5a[_0x851f('0x37')]=_['intersection'](_0x241c5a[_0x851f('0x39')],_0x241c5a['query']);_0x42052e[_0x851f('0x3a')]=_['intersection'](_0x241c5a['model'],qs[_0x851f('0x4b')](_0x49215b['query'][_0x851f('0x4b')]));_0x42052e[_0x851f('0x3a')]=_0x42052e[_0x851f('0x3a')]['length']?_0x42052e[_0x851f('0x3a')]:_0x241c5a['model'];if(_0x49215b['query'][_0x851f('0x45')]){_0x42052e[_0x851f('0x4c')]=[{'all':!![]}];}_0x42052e=_[_0x851f('0x41')]({},_0x42052e,_0x49215b['options']);return db[_0x851f('0x46')][_0x851f('0x4d')](_0x42052e)[_0x851f('0x19')](handleEntityNotFound(_0xa0c2ba,null))[_0x851f('0x19')](respondWithResult(_0xa0c2ba,null))[_0x851f('0x23')](handleError(_0xa0c2ba,null));};exports[_0x851f('0x2d')]=function(_0x4a4dd8,_0x279d6c){if(_0x4a4dd8[_0x851f('0x4e')]['id']){delete _0x4a4dd8[_0x851f('0x4e')]['id'];}return db[_0x851f('0x46')]['find']({'where':{'id':_0x4a4dd8[_0x851f('0x4a')]['id']}})[_0x851f('0x19')](handleEntityNotFound(_0x279d6c,null))[_0x851f('0x19')](saveUpdates(_0x4a4dd8[_0x851f('0x4e')],null))[_0x851f('0x19')](respondWithResult(_0x279d6c,null))[_0x851f('0x23')](handleError(_0x279d6c,null));};exports['addLogo']=function(_0x1159d0,_0x43fa79,_0x546ec0){if(_0x1159d0['file']&&_0x1159d0['file'][_0x851f('0x4f')]){_0x1159d0[_0x851f('0x4e')][_0x851f('0x50')]=_0x1159d0[_0x851f('0x51')][_0x851f('0x4f')];}return db[_0x851f('0x46')]['find']({'where':{'id':_0x1159d0['params']['id']}})[_0x851f('0x19')](handleEntityNotFound(_0x43fa79,null))[_0x851f('0x19')](saveUpdates(_0x1159d0['body'],null))['then'](respondWithResult(_0x43fa79,null))[_0x851f('0x23')](handleError(_0x43fa79,null));};exports[_0x851f('0x52')]=function(_0x2535f7,_0x40acdc,_0x4ae58d){if(_0x2535f7[_0x851f('0x51')]&&_0x2535f7[_0x851f('0x51')][_0x851f('0x4f')]){_0x2535f7['body'][_0x851f('0x53')]=_0x2535f7[_0x851f('0x51')][_0x851f('0x4f')];}return db[_0x851f('0x46')][_0x851f('0x4d')]({'where':{'id':_0x2535f7[_0x851f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x40acdc,null))[_0x851f('0x19')](saveUpdates(_0x2535f7[_0x851f('0x4e')],null))['then'](respondWithResult(_0x40acdc,null))['catch'](handleError(_0x40acdc,null));};var utilLicense=require(_0x851f('0x14'));exports[_0x851f('0x54')]=function(_0x596bc7,_0x3a7c0f,_0x2ae4f4){var _0x44aa27=_0x851f('0x55');var _0x406e34={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x838e0){if(_0x838e0){_0x406e34=_0x838e0;}return db[_0x851f('0x46')][_0x851f('0x4d')]({'where':{'id':_0x596bc7['params']['id']},'attributes':[_0x851f('0x50'),_0x851f('0x53'),'preferred',_0x851f('0x56'),_0x851f('0x57'),'defaultLoginLogo','defaultPreferred',_0x851f('0x58')],'raw':!![]});})[_0x851f('0x19')](handleEntityNotFound(_0x3a7c0f,null))[_0x851f('0x19')](function(_0x3fde3a){if(_0x3fde3a){var _0x1ec113=_0x3fde3a['logo']&&fs[_0x851f('0x59')](path['join'](config[_0x851f('0x5a')],_0x44aa27,_['toLower'](_0x3fde3a['logo'])))?path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x44aa27,_[_0x851f('0x5c')](_0x3fde3a['logo'])):path['join'](config[_0x851f('0x5a')],_0x44aa27,_[_0x851f('0x5c')](_0x851f('0x5d')));var _0x20bdc5=_0x851f('0x5e')+_[_0x851f('0x5f')]('logo');if(_0x3fde3a[_0x20bdc5]||!_0x406e34[_0x851f('0x60')]){_0x1ec113=path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x44aa27,_[_0x851f('0x5c')]('default_logo.svg'));}if(!fs['existsSync'](_0x1ec113)){throw new db[(_0x851f('0x61'))][(_0x851f('0x62'))](_['upperFirst']('logo')+_0x851f('0x63'));}return _0x3a7c0f[_0x851f('0x64')](_0x1ec113);}})[_0x851f('0x23')](handleError(_0x3a7c0f,null));};var utilLicense=require(_0x851f('0x14'));exports[_0x851f('0x65')]=function(_0x12975d,_0x500b82,_0x854075){var _0x256d8a=_0x851f('0x55');var _0x17b8a3={'custom':![]};return utilLicense[_0x851f('0x66')]()[_0x851f('0x19')](function(_0x11cea3){if(_0x11cea3){_0x17b8a3=_0x11cea3;}return db['Setting']['find']({'where':{'id':_0x12975d['params']['id']},'attributes':[_0x851f('0x50'),_0x851f('0x53'),_0x851f('0x67'),'favicon','defaultLogo',_0x851f('0x68'),_0x851f('0x69'),_0x851f('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x500b82,null))['then'](function(_0x4407a0){if(_0x4407a0){var _0x71f644=_0x4407a0[_0x851f('0x53')]&&fs[_0x851f('0x59')](path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x256d8a,_['toLower'](_0x4407a0[_0x851f('0x53')])))?path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x256d8a,_[_0x851f('0x5c')](_0x4407a0[_0x851f('0x53')])):path['join'](config[_0x851f('0x5a')],_0x256d8a,_[_0x851f('0x5c')](_0x851f('0x6a')));var _0x14aff8='default'+_[_0x851f('0x5f')](_0x851f('0x53'));if(_0x4407a0[_0x14aff8]||!_0x17b8a3[_0x851f('0x60')]){_0x71f644=path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x256d8a,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x71f644)){throw new db[(_0x851f('0x61'))]['ValidationError'](_[_0x851f('0x5f')](_0x851f('0x53'))+_0x851f('0x63'));}return _0x500b82[_0x851f('0x64')](_0x71f644);}})[_0x851f('0x23')](handleError(_0x500b82,null));};exports['gdpr']=function(_0x5a086c,_0x1d221d){return db[_0x851f('0x46')][_0x851f('0x4d')]({'where':{'id':_0x5a086c[_0x851f('0x4a')]['id']},'attributes':[_0x851f('0x6b')]})[_0x851f('0x19')](respondWithResult(_0x1d221d,null))['catch'](handleError(_0x1d221d,null));};exports['addPreferred']=function(_0x375328,_0x31a96b,_0x497b24){if(_0x375328[_0x851f('0x51')]&&_0x375328[_0x851f('0x51')][_0x851f('0x4f')]){_0x375328[_0x851f('0x4e')][_0x851f('0x67')]=_0x375328[_0x851f('0x51')][_0x851f('0x4f')];}return db[_0x851f('0x46')][_0x851f('0x4d')]({'where':{'id':_0x375328[_0x851f('0x4a')]['id']}})[_0x851f('0x19')](handleEntityNotFound(_0x31a96b,null))[_0x851f('0x19')](saveUpdates(_0x375328['body'],null))[_0x851f('0x19')](respondWithResult(_0x31a96b,null))[_0x851f('0x23')](handleError(_0x31a96b,null));};var utilLicense=require(_0x851f('0x14'));exports[_0x851f('0x6c')]=function(_0x26c1c1,_0x3defe4,_0x4dbe67){var _0x1deec4='server/files/images/logos';var _0x242ac6={'custom':![]};return utilLicense[_0x851f('0x66')]()[_0x851f('0x19')](function(_0x1fd63f){if(_0x1fd63f){_0x242ac6=_0x1fd63f;}return db['Setting'][_0x851f('0x4d')]({'where':{'id':_0x26c1c1['params']['id']},'attributes':[_0x851f('0x50'),'loginLogo',_0x851f('0x67'),_0x851f('0x56'),_0x851f('0x57'),'defaultLoginLogo',_0x851f('0x69'),_0x851f('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x3defe4,null))[_0x851f('0x19')](function(_0x1ade21){if(_0x1ade21){var _0x335c77=_0x1ade21['preferred']&&fs[_0x851f('0x59')](path['join'](config['root'],_0x1deec4,_['toLower'](_0x1ade21['preferred'])))?path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x1deec4,_['toLower'](_0x1ade21[_0x851f('0x67')])):path[_0x851f('0x5b')](config['root'],_0x1deec4,_[_0x851f('0x5c')](_0x851f('0x6d')));var _0x471df9=_0x851f('0x5e')+_[_0x851f('0x5f')]('preferred');if(_0x1ade21[_0x471df9]||!_0x242ac6[_0x851f('0x60')]||!_0x242ac6[_0x851f('0x67')]){_0x335c77=path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x1deec4,_[_0x851f('0x5c')]('default_preferred.png'));}if(!fs[_0x851f('0x59')](_0x335c77)){throw new db[(_0x851f('0x61'))]['ValidationError'](_[_0x851f('0x5f')](_0x851f('0x67'))+_0x851f('0x63'));}return _0x3defe4[_0x851f('0x64')](_0x335c77);}})[_0x851f('0x23')](handleError(_0x3defe4,null));};exports[_0x851f('0x6e')]=function(_0x1ebb5d,_0x2daaf0,_0x2ac750){if(_0x1ebb5d[_0x851f('0x51')]&&_0x1ebb5d[_0x851f('0x51')][_0x851f('0x4f')]){_0x1ebb5d[_0x851f('0x4e')]['favicon']=_0x1ebb5d[_0x851f('0x51')]['filename'];}return db['Setting'][_0x851f('0x4d')]({'where':{'id':_0x1ebb5d[_0x851f('0x4a')]['id']}})[_0x851f('0x19')](handleEntityNotFound(_0x2daaf0,null))[_0x851f('0x19')](saveUpdates(_0x1ebb5d[_0x851f('0x4e')],null))[_0x851f('0x19')](respondWithResult(_0x2daaf0,null))[_0x851f('0x23')](handleError(_0x2daaf0,null));};var utilLicense=require('../../config/license/util');exports[_0x851f('0x6f')]=function(_0x31e6fc,_0x29ca88,_0x5561a1){var _0x1331c4=_0x851f('0x55');var _0x10021c={'custom':![]};return utilLicense[_0x851f('0x66')]()[_0x851f('0x19')](function(_0x20e6d6){if(_0x20e6d6){_0x10021c=_0x20e6d6;}return db[_0x851f('0x46')]['find']({'where':{'id':_0x31e6fc[_0x851f('0x4a')]['id']},'attributes':[_0x851f('0x50'),_0x851f('0x53'),_0x851f('0x67'),_0x851f('0x56'),'defaultLogo',_0x851f('0x68'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x851f('0x19')](handleEntityNotFound(_0x29ca88,null))[_0x851f('0x19')](function(_0x14756b){if(_0x14756b){var _0x35d533=_0x14756b['favicon']&&fs[_0x851f('0x59')](path['join'](config[_0x851f('0x5a')],_0x1331c4,_[_0x851f('0x5c')](_0x14756b[_0x851f('0x56')])))?path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x1331c4,_['toLower'](_0x14756b['favicon'])):path[_0x851f('0x5b')](config[_0x851f('0x5a')],_0x1331c4,_['toLower'](_0x851f('0x70')));var _0x4d85dd='default'+_['upperFirst'](_0x851f('0x56'));if(_0x14756b[_0x4d85dd]||!_0x10021c['custom']){_0x35d533=path['join'](config['root'],_0x1331c4,_[_0x851f('0x5c')](_0x851f('0x70')));}if(!fs[_0x851f('0x59')](_0x35d533)){throw new db[(_0x851f('0x61'))]['ValidationError'](_[_0x851f('0x5f')](_0x851f('0x56'))+'\x20not\x20found');}return _0x29ca88['download'](_0x35d533);}})[_0x851f('0x23')](handleError(_0x29ca88,null));};exports[_0x851f('0x71')]=function(_0x265f4a,_0x3d7983){var _0x1a8076={'offset':moment()[_0x851f('0x72')]()};_0x1a8076[_0x851f('0x73')]=moment()[_0x851f('0x72')](_0x1a8076[_0x851f('0x28')])[_0x851f('0x74')](_0x851f('0x75'));return _0x3d7983[_0x851f('0x26')](0xc8)[_0x851f('0x76')](_0x1a8076);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 186b354..c48be77 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x11be43,_0x59f937){var _0x534c5d=function(_0x554bcf){while(--_0x554bcf){_0x11be43['push'](_0x11be43['shift']());}};_0x534c5d(++_0x59f937);}(_0xedd9,0xfc));var _0x9edd=function(_0xf4f635,_0x3cb042){_0xf4f635=_0xf4f635-0x0;var _0x19df53=_0xedd9[_0xf4f635];return _0x19df53;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index b390ceb..892e6d6 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 _0x4a2d=['include','map','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSetting','Setting','options','raw','attributes'];(function(_0x59cda9,_0x47d4c4){var _0x26c18f=function(_0x4cff5f){while(--_0x4cff5f){_0x59cda9['push'](_0x59cda9['shift']());}};_0x26c18f(++_0x47d4c4);}(_0x4a2d,0xab));var _0xd4a2=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x4a2d[_0x28611e];return _0x530f69;};'use strict';var _=require(_0xd4a2('0x0'));var util=require('util');var moment=require(_0xd4a2('0x1'));var BPromise=require(_0xd4a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a2('0x3'))['db'];var utils=require(_0xd4a2('0x4'));var logger=require(_0xd4a2('0x5'))('rpc');var config=require(_0xd4a2('0x6'));var jayson=require(_0xd4a2('0x7'));var client=jayson['client'][_0xd4a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27fa56,_0x18412f,_0x1dfe5e){return new BPromise(function(_0x3d025a,_0x44d329){return client['request'](_0x27fa56,_0x1dfe5e)[_0xd4a2('0x9')](function(_0x4350ad){logger['info'](_0xd4a2('0xa'),_0x18412f,_0xd4a2('0xb'));logger[_0xd4a2('0xc')](_0xd4a2('0xd'),_0x18412f,'request\x20sent',JSON[_0xd4a2('0xe')](_0x4350ad));if(_0x4350ad[_0xd4a2('0xf')]){if(_0x4350ad['error']['code']===0x1f4){logger['error'](_0xd4a2('0xa'),_0x18412f,_0x4350ad['error'][_0xd4a2('0x10')]);return _0x44d329(_0x4350ad['error'][_0xd4a2('0x10')]);}logger[_0xd4a2('0xf')](_0xd4a2('0xa'),_0x18412f,_0x4350ad[_0xd4a2('0xf')][_0xd4a2('0x10')]);return _0x3d025a(_0x4350ad[_0xd4a2('0xf')][_0xd4a2('0x10')]);}else{logger[_0xd4a2('0x11')](_0xd4a2('0xa'),_0x18412f,_0xd4a2('0xb'));_0x3d025a(_0x4350ad[_0xd4a2('0x12')][_0xd4a2('0x10')]);}})[_0xd4a2('0x13')](function(_0x515359){logger['error']('Setting,\x20%s,\x20%s',_0x18412f,_0x515359);_0x44d329(_0x515359);});});}exports[_0xd4a2('0x14')]=function(_0x273032){var _0x18482a=this;return new Promise(function(_0xbe6d35,_0x1f7db1){return db[_0xd4a2('0x15')]['find']({'raw':_0x273032[_0xd4a2('0x16')]?_0x273032[_0xd4a2('0x16')][_0xd4a2('0x17')]===undefined?!![]:![]:!![],'where':_0x273032['options']?_0x273032[_0xd4a2('0x16')]['where']||null:null,'attributes':_0x273032[_0xd4a2('0x16')]?_0x273032[_0xd4a2('0x16')][_0xd4a2('0x18')]||null:null,'include':_0x273032[_0xd4a2('0x16')]?_0x273032[_0xd4a2('0x16')][_0xd4a2('0x19')]?_[_0xd4a2('0x1a')](_0x273032['options']['include'],function(_0x4d90b9){return{'model':db[_0x4d90b9[_0xd4a2('0x1b')]],'as':_0x4d90b9['as'],'attributes':_0x4d90b9['attributes'],'include':_0x4d90b9[_0xd4a2('0x19')]?_[_0xd4a2('0x1a')](_0x4d90b9['include'],function(_0x574523){return{'model':db[_0x574523['model']],'as':_0x574523['as'],'attributes':_0x574523['attributes'],'include':_0x574523['include']?_[_0xd4a2('0x1a')](_0x574523['include'],function(_0x3cbadf){return{'model':db[_0x3cbadf[_0xd4a2('0x1b')]],'as':_0x3cbadf['as'],'attributes':_0x3cbadf[_0xd4a2('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd4a2('0x9')](function(_0x1af937){logger[_0xd4a2('0x11')](_0xd4a2('0x14'),_0x273032);logger[_0xd4a2('0xc')](_0xd4a2('0x14'),_0x273032,JSON[_0xd4a2('0xe')](_0x1af937));_0xbe6d35(_0x1af937);})[_0xd4a2('0x13')](function(_0x131e5d){logger[_0xd4a2('0xf')](_0xd4a2('0x14'),_0x131e5d['message'],_0x273032);_0x1f7db1(_0x18482a[_0xd4a2('0xf')](0x1f4,_0x131e5d[_0xd4a2('0x10')]));});});}; \ No newline at end of file +var _0x90ca=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','Setting','find','options','raw','where','attributes','include','map','model','ShowSetting','debug','lodash','util','bluebird','randomstring'];(function(_0x456d41,_0x53f1a2){var _0x1c808a=function(_0x250558){while(--_0x250558){_0x456d41['push'](_0x456d41['shift']());}};_0x1c808a(++_0x53f1a2);}(_0x90ca,0x80));var _0xa90c=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x90ca[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xa90c('0x0'));var util=require(_0xa90c('0x1'));var moment=require('moment');var BPromise=require(_0xa90c('0x2'));var rs=require(_0xa90c('0x3'));var fs=require('fs');var Redis=require(_0xa90c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa90c('0x5'))(_0xa90c('0x6'));var config=require(_0xa90c('0x7'));var jayson=require(_0xa90c('0x8'));var client=jayson[_0xa90c('0x9')][_0xa90c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440915,_0x985db5,_0x5f599d){return new BPromise(function(_0x1727e7,_0x2d9bf6){return client[_0xa90c('0xb')](_0x440915,_0x5f599d)[_0xa90c('0xc')](function(_0x1eed45){logger[_0xa90c('0xd')]('Setting,\x20%s,\x20%s',_0x985db5,_0xa90c('0xe'));logger['debug'](_0xa90c('0xf'),_0x985db5,_0xa90c('0xe'),JSON[_0xa90c('0x10')](_0x1eed45));if(_0x1eed45[_0xa90c('0x11')]){if(_0x1eed45[_0xa90c('0x11')]['code']===0x1f4){logger[_0xa90c('0x11')](_0xa90c('0x12'),_0x985db5,_0x1eed45[_0xa90c('0x11')][_0xa90c('0x13')]);return _0x2d9bf6(_0x1eed45[_0xa90c('0x11')][_0xa90c('0x13')]);}logger[_0xa90c('0x11')](_0xa90c('0x12'),_0x985db5,_0x1eed45['error'][_0xa90c('0x13')]);return _0x1727e7(_0x1eed45[_0xa90c('0x11')][_0xa90c('0x13')]);}else{logger['info'](_0xa90c('0x12'),_0x985db5,_0xa90c('0xe'));_0x1727e7(_0x1eed45[_0xa90c('0x14')]['message']);}})[_0xa90c('0x15')](function(_0x2f95d3){logger[_0xa90c('0x11')](_0xa90c('0x12'),_0x985db5,_0x2f95d3);_0x2d9bf6(_0x2f95d3);});});}exports['ShowSetting']=function(_0x437961){var _0x46cdb1=this;return new Promise(function(_0x12182c,_0x5365dd){return db[_0xa90c('0x16')][_0xa90c('0x17')]({'raw':_0x437961[_0xa90c('0x18')]?_0x437961['options'][_0xa90c('0x19')]===undefined?!![]:![]:!![],'where':_0x437961[_0xa90c('0x18')]?_0x437961['options'][_0xa90c('0x1a')]||null:null,'attributes':_0x437961[_0xa90c('0x18')]?_0x437961[_0xa90c('0x18')][_0xa90c('0x1b')]||null:null,'include':_0x437961[_0xa90c('0x18')]?_0x437961[_0xa90c('0x18')][_0xa90c('0x1c')]?_[_0xa90c('0x1d')](_0x437961['options'][_0xa90c('0x1c')],function(_0x550eaa){return{'model':db[_0x550eaa[_0xa90c('0x1e')]],'as':_0x550eaa['as'],'attributes':_0x550eaa[_0xa90c('0x1b')],'include':_0x550eaa[_0xa90c('0x1c')]?_[_0xa90c('0x1d')](_0x550eaa[_0xa90c('0x1c')],function(_0x14ddd9){return{'model':db[_0x14ddd9[_0xa90c('0x1e')]],'as':_0x14ddd9['as'],'attributes':_0x14ddd9[_0xa90c('0x1b')],'include':_0x14ddd9[_0xa90c('0x1c')]?_[_0xa90c('0x1d')](_0x14ddd9[_0xa90c('0x1c')],function(_0x545c04){return{'model':db[_0x545c04[_0xa90c('0x1e')]],'as':_0x545c04['as'],'attributes':_0x545c04[_0xa90c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa90c('0xc')](function(_0x1dbe27){logger[_0xa90c('0xd')](_0xa90c('0x1f'),_0x437961);logger[_0xa90c('0x20')](_0xa90c('0x1f'),_0x437961,JSON[_0xa90c('0x10')](_0x1dbe27));_0x12182c(_0x1dbe27);})[_0xa90c('0x15')](function(_0x6e5de3){logger[_0xa90c('0x11')](_0xa90c('0x1f'),_0x6e5de3['message'],_0x437961);_0x5365dd(_0x46cdb1[_0xa90c('0x11')](0x1f4,_0x6e5de3[_0xa90c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index aee9cb6..6f3e008 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 _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x35e023,_0x334d8e){var _0x4fc0a7=function(_0xc515d5){while(--_0xc515d5){_0x35e023['push'](_0x35e023['shift']());}};_0x4fc0a7(++_0x334d8e);}(_0x8ef6,0xf2));var _0x68ef=function(_0xa812cb,_0x572e83){_0xa812cb=_0xa812cb-0x0;var _0xf758b8=_0x8ef6[_0xa812cb];return _0xf758b8;};'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')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x4c1e65,_0x98ebc8){var _0x1bf2f4=function(_0x4688cd){while(--_0x4688cd){_0x4c1e65['push'](_0x4c1e65['shift']());}};_0x1bf2f4(++_0x98ebc8);}(_0x53ec,0x192));var _0xc53e=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x53ec[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3be90be..902a6aa 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 _0xcb79=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x2c5567,_0x5d5f30){var _0x313e98=function(_0x3c2a14){while(--_0x3c2a14){_0x2c5567['push'](_0x2c5567['shift']());}};_0x313e98(++_0x5d5f30);}(_0xcb79,0xf3));var _0x9cb7=function(_0x3b8aef,_0x2dd77c){_0x3b8aef=_0x3b8aef-0x0;var _0x13109f=_0xcb79[_0x3b8aef];return _0x13109f;};'use strict';var Sequelize=require(_0x9cb7('0x0'));var rs=require('randomstring');module[_0x9cb7('0x1')]={'name':{'type':Sequelize[_0x9cb7('0x2')],'unique':_0x9cb7('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9cb7('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9cb7('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9cb7('0x2')],'defaultValue':function(){return rs[_0x9cb7('0x4')]();}},'phone':{'type':Sequelize[_0x9cb7('0x2')]},'type':{'type':Sequelize[_0x9cb7('0x5')](_0x9cb7('0x6'),_0x9cb7('0x7'),_0x9cb7('0x8'),'clicksend',_0x9cb7('0x9'),_0x9cb7('0xa'),_0x9cb7('0xb'),_0x9cb7('0xc'),_0x9cb7('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0x9cb7('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9cb7('0x2')]},'smsMethod':{'type':Sequelize[_0x9cb7('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9cb7('0x2')]},'password':{'type':Sequelize[_0x9cb7('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9cb7('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x9cb7('0x2')]},'deliveryReport':{'type':Sequelize[_0x9cb7('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x9cb7('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9cb7('0xf');}},'notificationSound':{'type':Sequelize[_0x9cb7('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cb7('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cb7('0x10')],'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[_0x9cb7('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9cb7('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9cb7('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x9cb7('0xe')],'defaultValue':![],'comment':_0x9cb7('0x12'),'set':function(_0x1b467e){if(!_0x1b467e)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9cb7('0x13')]('mandatoryDisposition',_0x1b467e);}}}; \ No newline at end of file +var _0xe166=['clickatell','bandwidth','csc','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','connectel'];(function(_0x58b05c,_0x446cb9){var _0x411863=function(_0x11ea72){while(--_0x11ea72){_0x58b05c['push'](_0x58b05c['shift']());}};_0x411863(++_0x446cb9);}(_0xe166,0x14f));var _0x6e16=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe166[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6e16('0x0'));module[_0x6e16('0x1')]={'name':{'type':Sequelize[_0x6e16('0x2')],'unique':_0x6e16('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6e16('0x2')]},'type':{'type':Sequelize[_0x6e16('0x4')](_0x6e16('0x5'),'skebby',_0x6e16('0x6'),'clicksend','plivo',_0x6e16('0x7'),_0x6e16('0x8'),_0x6e16('0x9'),_0x6e16('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x6e16('0x2')]},'authId':{'type':Sequelize[_0x6e16('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6e16('0x2')]},'apiKey':{'type':Sequelize[_0x6e16('0x2')]},'applicationId':{'type':Sequelize[_0x6e16('0x2')]},'accountId':{'type':Sequelize[_0x6e16('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x6e16('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6e16('0xc');}},'notificationSound':{'type':Sequelize[_0x6e16('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e16('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e16('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e16('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e16('0xd')],'comment':_0x6e16('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x6e16('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1bc9c4){if(!_0x1bc9c4)this[_0x6e16('0xf')](_0x6e16('0x10'),null);this[_0x6e16('0xf')](_0x6e16('0x11'),_0x1bc9c4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5f9c0a4..70237ae 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 _0xf7da=['segmentedMessage','clickatell','text','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','omit','contact','SmsInteraction','interaction','autoclose','unmanaged','created','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','send','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','order','Contact','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','defaults','out','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','redif','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','SmsAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','SmsAccount','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','create','getDispositions','Disposition','SmsAccountId','removeDispositions','ids','CannedAnswer','findOne','options','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Body','messageId','MessageSid','skebby','sender','clicksend','message_id','plivo','infobip','results','csc'];(function(_0x4d8b5a,_0x538927){var _0x3d54e7=function(_0x217fcf){while(--_0x217fcf){_0x4d8b5a['push'](_0x4d8b5a['shift']());}};_0x3d54e7(++_0x538927);}(_0xf7da,0x135));var _0xaf7d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf7da[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf7d('0x0'));var zipdir=require(_0xaf7d('0x1'));var jsonpatch=require(_0xaf7d('0x2'));var rp=require(_0xaf7d('0x3'));var moment=require(_0xaf7d('0x4'));var BPromise=require(_0xaf7d('0x5'));var Mustache=require(_0xaf7d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaf7d('0x7'));var csv=require(_0xaf7d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf7d('0x9'));var _=require(_0xaf7d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf7d('0xb'));var deskjs=require(_0xaf7d('0xc'));var toCsv=require(_0xaf7d('0x8'));var querystring=require(_0xaf7d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf7d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaf7d('0xf'));var hardwareService=require(_0xaf7d('0x10'));var logger=require(_0xaf7d('0x11'))(_0xaf7d('0x12'));var utils=require(_0xaf7d('0x13'));var config=require(_0xaf7d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf7d('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaf7d('0x16'))(new Redis(config['redis']));require(_0xaf7d('0x17'))['register'](socket);var jayson=require(_0xaf7d('0x18'));var client=jayson[_0xaf7d('0x19')][_0xaf7d('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x3e7723,_0x2f9b87,_0xe9ac9b,_0x883361){return new BPromise(function(_0x2e8079,_0x34b7b2){var _0xeeaba8=_0x883361||client;return _0xeeaba8['request'](_0x3e7723,_0xe9ac9b)['then'](function(_0x42daec){logger[_0xaf7d('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x2f9b87,_0xaf7d('0x1c'));logger[_0xaf7d('0x1d')](_0xaf7d('0x1e'),_0x2f9b87,'request\x20sent',JSON['stringify'](_0x42daec));if(_0x42daec[_0xaf7d('0x1f')]){if(_0x42daec['error'][_0xaf7d('0x20')]===0x1f4){logger[_0xaf7d('0x1f')](_0xaf7d('0x21'),_0x2f9b87,_0x42daec['error'][_0xaf7d('0x22')]);return _0x34b7b2(_0x42daec[_0xaf7d('0x1f')][_0xaf7d('0x22')]);}logger['error'](_0xaf7d('0x21'),_0x2f9b87,_0x42daec['error'][_0xaf7d('0x22')]);return _0x2e8079(_0x42daec[_0xaf7d('0x1f')]['message']);}else{logger[_0xaf7d('0x1b')](_0xaf7d('0x21'),_0x2f9b87,_0xaf7d('0x1c'));_0x2e8079(_0x42daec[_0xaf7d('0x23')][_0xaf7d('0x22')]);}})[_0xaf7d('0x24')](function(_0x6f04c4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2f9b87,_0x6f04c4);_0x34b7b2(_0x6f04c4);});});}function respondWithStatusCode(_0x4f629d,_0x251628){_0x251628=_0x251628||0xcc;return function(_0x77ddee){if(_0x77ddee){return _0x4f629d[_0xaf7d('0x25')](_0x251628);}return _0x4f629d[_0xaf7d('0x26')](_0x251628)[_0xaf7d('0x27')]();};}function respondWithResult(_0xc2f457,_0x195326){_0x195326=_0x195326||0xc8;return function(_0x4790aa){if(_0x4790aa){return _0xc2f457[_0xaf7d('0x26')](_0x195326)[_0xaf7d('0x28')](_0x4790aa);}};}function respondWithFilteredResult(_0x4dcb62,_0x34e695){return function(_0x22ee9e){if(_0x22ee9e){var _0x107323=typeof _0x34e695['offset']===_0xaf7d('0x29')&&typeof _0x34e695[_0xaf7d('0x2a')]===_0xaf7d('0x29');var _0x54fcd8=_0x22ee9e[_0xaf7d('0x2b')];var _0x2697a4=_0x107323?0x0:_0x34e695['offset'];var _0x23d339=_0x107323?_0x22ee9e[_0xaf7d('0x2b')]:_0x34e695[_0xaf7d('0x2c')]+_0x34e695[_0xaf7d('0x2a')];var _0x331a25;if(_0x23d339>=_0x54fcd8){_0x23d339=_0x54fcd8;_0x331a25=0xc8;}else{_0x331a25=0xce;}_0x4dcb62[_0xaf7d('0x26')](_0x331a25);return _0x4dcb62['set'](_0xaf7d('0x2d'),_0x2697a4+'-'+_0x23d339+'/'+_0x54fcd8)[_0xaf7d('0x28')](_0x22ee9e);}return null;};}function patchUpdates(_0x6d4010){return function(_0x1748a5){try{jsonpatch[_0xaf7d('0x2e')](_0x1748a5,_0x6d4010,!![]);}catch(_0x3b23b1){return BPromise[_0xaf7d('0x2f')](_0x3b23b1);}return _0x1748a5[_0xaf7d('0x30')]();};}function saveUpdates(_0x20006b,_0xf71842){return function(_0xf0d35e){if(_0xf0d35e){return _0xf0d35e['update'](_0x20006b)[_0xaf7d('0x31')](function(_0x5159b3){return _0x5159b3;});}return null;};}function removeEntity(_0x23fe8b,_0x4bea37){return function(_0x3916d7){if(_0x3916d7){return _0x3916d7[_0xaf7d('0x32')]()['then'](function(){var _0x59a1a4=_0x3916d7['get']({'plain':!![]});var _0x2d5e25=_0xaf7d('0x33');return db[_0xaf7d('0x34')]['destroy']({'where':{'type':_0x2d5e25,'resourceId':_0x59a1a4['id']}})['then'](function(){return _0x3916d7;});})[_0xaf7d('0x31')](function(){_0x23fe8b[_0xaf7d('0x26')](0xcc)[_0xaf7d('0x27')]();});}};}function handleEntityNotFound(_0xb10af6,_0x30cc65){return function(_0x184630){if(!_0x184630){_0xb10af6[_0xaf7d('0x25')](0x194);}return _0x184630;};}function handleError(_0x54e71e,_0x1845ff){_0x1845ff=_0x1845ff||0x1f4;return function(_0x1dc082){logger[_0xaf7d('0x1f')](_0x1dc082[_0xaf7d('0x35')]);if(_0x1dc082[_0xaf7d('0x36')]){delete _0x1dc082['name'];}_0x54e71e[_0xaf7d('0x26')](_0x1845ff)['send'](_0x1dc082);};}exports['index']=function(_0x5e16d2,_0x101707){var _0x16bcf4={'include':[{'model':db[_0xaf7d('0x37')],'as':_0xaf7d('0x38')}]},_0x51c774={},_0x103987={'count':0x0,'rows':[]};var _0x4e36b2=_['map'](db['SmsAccount'][_0xaf7d('0x39')],function(_0x301de8){return{'name':_0x301de8[_0xaf7d('0x3a')],'type':_0x301de8[_0xaf7d('0x3b')][_0xaf7d('0x3c')]};});_0x51c774['model']=_[_0xaf7d('0x3d')](_0x4e36b2,_0xaf7d('0x36'));_0x51c774[_0xaf7d('0x3e')]=_[_0xaf7d('0x3f')](_0x5e16d2[_0xaf7d('0x3e')]);_0x51c774[_0xaf7d('0x40')]=_[_0xaf7d('0x41')](_0x51c774[_0xaf7d('0x42')],_0x51c774[_0xaf7d('0x3e')]);_0x16bcf4[_0xaf7d('0x43')]=_[_0xaf7d('0x41')](_0x51c774[_0xaf7d('0x42')],qs[_0xaf7d('0x44')](_0x5e16d2['query'][_0xaf7d('0x44')]));_0x16bcf4['attributes']=_0x16bcf4[_0xaf7d('0x43')][_0xaf7d('0x45')]?_0x16bcf4[_0xaf7d('0x43')]:_0x51c774[_0xaf7d('0x42')];if(!_0x5e16d2[_0xaf7d('0x3e')][_0xaf7d('0x46')](_0xaf7d('0x47'))){_0x16bcf4[_0xaf7d('0x2a')]=qs[_0xaf7d('0x2a')](_0x5e16d2[_0xaf7d('0x3e')][_0xaf7d('0x2a')]);_0x16bcf4['offset']=qs[_0xaf7d('0x2c')](_0x5e16d2[_0xaf7d('0x3e')][_0xaf7d('0x2c')]);}_0x16bcf4['order']=qs[_0xaf7d('0x48')](_0x5e16d2[_0xaf7d('0x3e')]['sort']);_0x16bcf4['where']=qs[_0xaf7d('0x40')](_[_0xaf7d('0x49')](_0x5e16d2[_0xaf7d('0x3e')],_0x51c774['filters']),_0x4e36b2);if(_0x5e16d2[_0xaf7d('0x3e')]['filter']){_0x16bcf4[_0xaf7d('0x4a')]=_[_0xaf7d('0x4b')](_0x16bcf4[_0xaf7d('0x4a')],{'$or':_[_0xaf7d('0x3d')](_0x4e36b2,function(_0x22792a){if(_0x22792a[_0xaf7d('0x3b')]!==_0xaf7d('0x4c')){var _0x25d1f5={};_0x25d1f5[_0x22792a[_0xaf7d('0x36')]]={'$like':'%'+_0x5e16d2['query'][_0xaf7d('0x4d')]+'%'};return _0x25d1f5;}})});}_0x16bcf4=_[_0xaf7d('0x4b')]({},_0x16bcf4,_0x5e16d2['options']);var _0x457235={'where':_0x16bcf4[_0xaf7d('0x4a')]};return db['SmsAccount'][_0xaf7d('0x2b')](_0x457235)[_0xaf7d('0x31')](function(_0xe24c0f){_0x103987[_0xaf7d('0x2b')]=_0xe24c0f;if(_0x5e16d2[_0xaf7d('0x3e')][_0xaf7d('0x4e')]){_0x16bcf4[_0xaf7d('0x4f')]=[{'all':!![]}];}return db['SmsAccount'][_0xaf7d('0x50')](_0x16bcf4);})[_0xaf7d('0x31')](function(_0x4e4353){_0x103987[_0xaf7d('0x51')]=_0x4e4353;return _0x103987;})[_0xaf7d('0x31')](respondWithFilteredResult(_0x101707,_0x16bcf4))[_0xaf7d('0x24')](handleError(_0x101707,null));};exports[_0xaf7d('0x52')]=function(_0x4ac9c5,_0x31a1d4){var _0x2d57a7={'raw':![],'where':{'id':_0x4ac9c5[_0xaf7d('0x53')]['id']},'include':[{'model':db[_0xaf7d('0x37')],'as':_0xaf7d('0x38')}]},_0x59f6c5={};_0x59f6c5[_0xaf7d('0x42')]=_['keys'](db['SmsAccount'][_0xaf7d('0x39')]);_0x59f6c5[_0xaf7d('0x3e')]=_['keys'](_0x4ac9c5[_0xaf7d('0x3e')]);_0x59f6c5[_0xaf7d('0x40')]=_[_0xaf7d('0x41')](_0x59f6c5[_0xaf7d('0x42')],_0x59f6c5[_0xaf7d('0x3e')]);_0x2d57a7['attributes']=_[_0xaf7d('0x41')](_0x59f6c5[_0xaf7d('0x42')],qs['fields'](_0x4ac9c5[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x2d57a7['attributes']=_0x2d57a7['attributes'][_0xaf7d('0x45')]?_0x2d57a7[_0xaf7d('0x43')]:_0x59f6c5['model'];if(_0x4ac9c5[_0xaf7d('0x3e')][_0xaf7d('0x4e')]){_0x2d57a7['include']=[{'all':!![]}];}_0x2d57a7=_[_0xaf7d('0x4b')]({},_0x2d57a7,_0x4ac9c5['options']);return db[_0xaf7d('0x54')]['find'](_0x2d57a7)[_0xaf7d('0x31')](handleEntityNotFound(_0x31a1d4,null))[_0xaf7d('0x31')](respondWithResult(_0x31a1d4,null))[_0xaf7d('0x24')](handleError(_0x31a1d4,null));};exports['create']=function(_0x2946b5,_0x3cae7a){return db[_0xaf7d('0x54')]['create'](_0x2946b5[_0xaf7d('0x55')],{})[_0xaf7d('0x31')](function(_0x11db6a){var _0x16e9cd=_0x2946b5[_0xaf7d('0x56')][_0xaf7d('0x57')]({'plain':!![]});if(!_0x16e9cd)throw new Error(_0xaf7d('0x58'));if(_0x16e9cd['role']===_0xaf7d('0x56')){var _0x4c3614=_0x11db6a['get']({'plain':!![]});var _0x574238='SmsAccounts';return db['UserProfileSection'][_0xaf7d('0x59')]({'where':{'name':_0x574238,'userProfileId':_0x16e9cd[_0xaf7d('0x5a')]},'raw':!![]})['then'](function(_0x42b9e5){if(_0x42b9e5&&_0x42b9e5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4c3614[_0xaf7d('0x36')],'resourceId':_0x4c3614['id'],'type':_0x42b9e5[_0xaf7d('0x36')],'sectionId':_0x42b9e5['id']},{})['then'](function(){return _0x11db6a;});}else{return _0x11db6a;}})['catch'](function(_0x2ea9d1){logger['error'](_0xaf7d('0x5b'),_0x2ea9d1);throw _0x2ea9d1;});}return _0x11db6a;})['then'](respondWithResult(_0x3cae7a,0xc9))[_0xaf7d('0x24')](handleError(_0x3cae7a,null));};exports[_0xaf7d('0x5c')]=function(_0x55c803,_0x364970){if(_0x55c803[_0xaf7d('0x55')]['id']){delete _0x55c803[_0xaf7d('0x55')]['id'];}return db['SmsAccount'][_0xaf7d('0x59')]({'where':{'id':_0x55c803[_0xaf7d('0x53')]['id']},'include':[{'model':db[_0xaf7d('0x37')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x364970,null))[_0xaf7d('0x31')](saveUpdates(_0x55c803['body'],null))[_0xaf7d('0x31')](respondWithResult(_0x364970,null))[_0xaf7d('0x24')](handleError(_0x364970,null));};exports[_0xaf7d('0x32')]=function(_0x9f7e7a,_0x36160a){return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x9f7e7a[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x36160a,null))[_0xaf7d('0x31')](removeEntity(_0x36160a,null))['catch'](handleError(_0x36160a,null));};exports[_0xaf7d('0x5d')]=function(_0x2d7f6d,_0x10aaf3){return db[_0xaf7d('0x54')][_0xaf7d('0x5d')]()[_0xaf7d('0x31')](respondWithResult(_0x10aaf3,null))[_0xaf7d('0x24')](handleError(_0x10aaf3,null));};exports[_0xaf7d('0x5e')]=function(_0x2aee61,_0x2311d6,_0x315485){if(_0x2aee61['body']['id']){delete _0x2aee61['body']['id'];}return db[_0xaf7d('0x54')]['find']({'where':{'id':_0x2aee61['params']['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x2311d6,null))[_0xaf7d('0x31')](function(_0x93b13d){if(_0x93b13d){_0x2aee61[_0xaf7d('0x55')]['SmsAccountId']=_0x93b13d['id'];return db['Disposition'][_0xaf7d('0x5f')](_0x2aee61[_0xaf7d('0x55')]);}})[_0xaf7d('0x31')](respondWithResult(_0x2311d6,null))[_0xaf7d('0x24')](handleError(_0x2311d6,null));};exports[_0xaf7d('0x60')]=function(_0x2cd57f,_0x548f1b,_0x617488){var _0x594a89={'raw':![],'where':{}};var _0x219c7d={};var _0x52946a={'count':0x0,'rows':[]};return db[_0xaf7d('0x54')]['findOne']({'where':{'id':_0x2cd57f[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x548f1b,null))[_0xaf7d('0x31')](function(_0x307186){if(_0x307186){_0x219c7d[_0xaf7d('0x42')]=_[_0xaf7d('0x3f')](db[_0xaf7d('0x61')]['rawAttributes']);_0x219c7d[_0xaf7d('0x3e')]=_['keys'](_0x2cd57f['query']);_0x219c7d[_0xaf7d('0x40')]=_['intersection'](_0x219c7d[_0xaf7d('0x42')],_0x219c7d[_0xaf7d('0x3e')]);_0x594a89[_0xaf7d('0x43')]=_['intersection'](_0x219c7d['model'],qs[_0xaf7d('0x44')](_0x2cd57f[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x594a89[_0xaf7d('0x43')]=_0x594a89[_0xaf7d('0x43')][_0xaf7d('0x45')]?_0x594a89['attributes']:_0x219c7d['model'];if(!_0x2cd57f[_0xaf7d('0x3e')]['hasOwnProperty'](_0xaf7d('0x47'))){_0x594a89[_0xaf7d('0x2a')]=qs[_0xaf7d('0x2a')](_0x2cd57f[_0xaf7d('0x3e')]['limit']);_0x594a89['offset']=qs[_0xaf7d('0x2c')](_0x2cd57f[_0xaf7d('0x3e')][_0xaf7d('0x2c')]);}_0x594a89['order']=qs[_0xaf7d('0x48')](_0x2cd57f['query'][_0xaf7d('0x48')]);_0x594a89[_0xaf7d('0x4a')]=qs['filters'](_[_0xaf7d('0x49')](_0x2cd57f[_0xaf7d('0x3e')],_0x219c7d[_0xaf7d('0x40')]));_0x594a89[_0xaf7d('0x4a')][_0xaf7d('0x62')]=_0x307186['id'];if(_0x2cd57f[_0xaf7d('0x3e')][_0xaf7d('0x4d')]){_0x594a89['where']=_['merge'](_0x594a89[_0xaf7d('0x4a')],{'$or':_[_0xaf7d('0x3d')](_0x594a89[_0xaf7d('0x43')],function(_0x265903){var _0x1811e6={};_0x1811e6[_0x265903]={'$like':'%'+_0x2cd57f[_0xaf7d('0x3e')][_0xaf7d('0x4d')]+'%'};return _0x1811e6;})});}_0x594a89=_[_0xaf7d('0x4b')]({},_0x594a89,_0x2cd57f['options']);return db[_0xaf7d('0x61')][_0xaf7d('0x2b')]({'where':_0x594a89[_0xaf7d('0x4a')]})['then'](function(_0x5349b3){_0x52946a['count']=_0x5349b3;if(_0x2cd57f[_0xaf7d('0x3e')][_0xaf7d('0x4e')]){_0x594a89['include']=[{'all':!![]}];}return db['Disposition'][_0xaf7d('0x50')](_0x594a89);})[_0xaf7d('0x31')](function(_0x5cf025){_0x52946a[_0xaf7d('0x51')]=_0x5cf025;return _0x52946a;});}})['then'](respondWithFilteredResult(_0x548f1b,_0x594a89))[_0xaf7d('0x24')](handleError(_0x548f1b,null));};exports[_0xaf7d('0x63')]=function(_0x5660ca,_0x236c5a,_0x476a19){return db['SmsAccount'][_0xaf7d('0x59')]({'where':{'id':_0x5660ca[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x236c5a,null))[_0xaf7d('0x31')](function(_0x9d347c){if(_0x9d347c){return _0x9d347c[_0xaf7d('0x63')](_0x5660ca[_0xaf7d('0x3e')][_0xaf7d('0x64')]);}})[_0xaf7d('0x31')](respondWithStatusCode(_0x236c5a,null))[_0xaf7d('0x24')](handleError(_0x236c5a,null));};exports['addAnswer']=function(_0x335bed,_0x19bb68,_0x36c194){if(_0x335bed[_0xaf7d('0x55')]['id']){delete _0x335bed[_0xaf7d('0x55')]['id'];}return db['SmsAccount'][_0xaf7d('0x59')]({'where':{'id':_0x335bed[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x19bb68,null))['then'](function(_0x342b82){if(_0x342b82){_0x335bed[_0xaf7d('0x55')][_0xaf7d('0x62')]=_0x342b82['id'];return db[_0xaf7d('0x65')][_0xaf7d('0x5f')](_0x335bed[_0xaf7d('0x55')]);}})[_0xaf7d('0x31')](respondWithResult(_0x19bb68,null))[_0xaf7d('0x24')](handleError(_0x19bb68,null));};exports['getAnswers']=function(_0x5a6efa,_0x15b111,_0x4397d7){var _0x1a84c6={'raw':![],'where':{}};var _0x5861ab={};var _0x4f0c46={'count':0x0,'rows':[]};return db[_0xaf7d('0x54')][_0xaf7d('0x66')]({'where':{'id':_0x5a6efa[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x15b111,null))[_0xaf7d('0x31')](function(_0x280cc0){if(_0x280cc0){_0x5861ab[_0xaf7d('0x42')]=_[_0xaf7d('0x3f')](db[_0xaf7d('0x65')][_0xaf7d('0x39')]);_0x5861ab[_0xaf7d('0x3e')]=_[_0xaf7d('0x3f')](_0x5a6efa['query']);_0x5861ab[_0xaf7d('0x40')]=_[_0xaf7d('0x41')](_0x5861ab[_0xaf7d('0x42')],_0x5861ab[_0xaf7d('0x3e')]);_0x1a84c6[_0xaf7d('0x43')]=_[_0xaf7d('0x41')](_0x5861ab[_0xaf7d('0x42')],qs[_0xaf7d('0x44')](_0x5a6efa[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x1a84c6[_0xaf7d('0x43')]=_0x1a84c6[_0xaf7d('0x43')]['length']?_0x1a84c6[_0xaf7d('0x43')]:_0x5861ab[_0xaf7d('0x42')];if(!_0x5a6efa[_0xaf7d('0x3e')][_0xaf7d('0x46')](_0xaf7d('0x47'))){_0x1a84c6['limit']=qs[_0xaf7d('0x2a')](_0x5a6efa['query'][_0xaf7d('0x2a')]);_0x1a84c6[_0xaf7d('0x2c')]=qs[_0xaf7d('0x2c')](_0x5a6efa[_0xaf7d('0x3e')][_0xaf7d('0x2c')]);}_0x1a84c6['order']=qs[_0xaf7d('0x48')](_0x5a6efa['query']['sort']);_0x1a84c6[_0xaf7d('0x4a')]=qs['filters'](_[_0xaf7d('0x49')](_0x5a6efa[_0xaf7d('0x3e')],_0x5861ab[_0xaf7d('0x40')]));_0x1a84c6[_0xaf7d('0x4a')][_0xaf7d('0x62')]=_0x280cc0['id'];if(_0x5a6efa[_0xaf7d('0x3e')][_0xaf7d('0x4d')]){_0x1a84c6['where']=_[_0xaf7d('0x4b')](_0x1a84c6[_0xaf7d('0x4a')],{'$or':_[_0xaf7d('0x3d')](_0x1a84c6[_0xaf7d('0x43')],function(_0x4fc869){var _0x337a14={};_0x337a14[_0x4fc869]={'$like':'%'+_0x5a6efa[_0xaf7d('0x3e')]['filter']+'%'};return _0x337a14;})});}_0x1a84c6=_['merge']({},_0x1a84c6,_0x5a6efa[_0xaf7d('0x67')]);return db[_0xaf7d('0x65')][_0xaf7d('0x2b')]({'where':_0x1a84c6[_0xaf7d('0x4a')]})[_0xaf7d('0x31')](function(_0x2cf7cc){_0x4f0c46['count']=_0x2cf7cc;if(_0x5a6efa['query'][_0xaf7d('0x4e')]){_0x1a84c6[_0xaf7d('0x4f')]=[{'all':!![]}];}return db[_0xaf7d('0x65')][_0xaf7d('0x50')](_0x1a84c6);})[_0xaf7d('0x31')](function(_0x1c2b5c){_0x4f0c46[_0xaf7d('0x51')]=_0x1c2b5c;return _0x4f0c46;});}})[_0xaf7d('0x31')](respondWithFilteredResult(_0x15b111,_0x1a84c6))['catch'](handleError(_0x15b111,null));};exports['removeAnswers']=function(_0x18cf93,_0x5edb9d,_0x5886b3){return db['SmsAccount']['find']({'where':{'id':_0x18cf93[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x5edb9d,null))[_0xaf7d('0x31')](function(_0x5a1d1){if(_0x5a1d1){return _0x5a1d1['removeAnswers'](_0x18cf93[_0xaf7d('0x3e')]['ids']);}})[_0xaf7d('0x31')](respondWithStatusCode(_0x5edb9d,null))[_0xaf7d('0x24')](handleError(_0x5edb9d,null));};exports['notify']=function(_0x4c32ed,_0x254889,_0x58139f){var _0x2af438={'channel':_0xaf7d('0x68')};var _0x337aa4=[];var _0x411aaf=[];var _0x1188d9={};return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x4c32ed['params']['id']},'include':[{'model':db[_0xaf7d('0x69')],'as':_0xaf7d('0x6a')}]})[_0xaf7d('0x31')](handleEntityNotFound(_0x254889,null))['then'](function(_0x537e7d){_0x2af438['account']=_0x537e7d;_0x2af438[_0xaf7d('0x6b')]=_[_0xaf7d('0x6c')](_0x537e7d[_0xaf7d('0x6a')],[_0xaf7d('0x6d')],['asc']);if(_0x2af438[_0xaf7d('0x6e')][_0xaf7d('0x6a')]){delete _0x2af438['account'][_0xaf7d('0x6a')];}return db[_0xaf7d('0x6f')][_0xaf7d('0x5d')]();})['then'](function(_0x1a2d53){if(!_0x1a2d53){throw new db[(_0xaf7d('0x70'))][(_0xaf7d('0x71'))](_0xaf7d('0x72'));}_0x337aa4=_[_0xaf7d('0x73')](_['keys'](_0x1a2d53),[_0xaf7d('0x74'),_0xaf7d('0x75')]);_0x411aaf=_[_0xaf7d('0x73')](_['keys'](_0x1a2d53),[_0xaf7d('0x74'),_0xaf7d('0x75'),_0xaf7d('0x76'),'ListId']);_0x2af438[_0xaf7d('0x55')]={'mapKey':'mobile'};if(_0x2af438[_0xaf7d('0x6e')]['type']){switch(_0x2af438['account'][_0xaf7d('0x3b')]){case'twilio':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed[_0xaf7d('0x55')]['From'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x78')];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x79')]=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x7a')];break;case _0xaf7d('0x7b'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]='+'+_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x7c')];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')]['text'];break;case'connectel':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed['body']['from'];_0x2af438['body'][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')]['message'];break;case _0xaf7d('0x7d'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed['body'][_0xaf7d('0x77')];_0x2af438['body']['body']=_0x4c32ed[_0xaf7d('0x55')]['body'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x79')]=_0x4c32ed['body'][_0xaf7d('0x7e')];break;case _0xaf7d('0x7f'):_0x2af438[_0xaf7d('0x55')]['from']=_0x4c32ed['body']['From'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')]['Text'];_0x2af438[_0xaf7d('0x55')]['messageId']=_0x4c32ed[_0xaf7d('0x55')]['MessageUUID'];break;case _0xaf7d('0x80'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]='+'+_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x81')][0x0][_0xaf7d('0x77')];_0x2af438['body']['body']=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x81')][0x0]['text'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x79')]=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x81')][0x0][_0xaf7d('0x79')];break;case _0xaf7d('0x82'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed[_0xaf7d('0x55')]['originatingAddress'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed['body'][_0xaf7d('0x83')]['message'];break;case _0xaf7d('0x84'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed[_0xaf7d('0x55')]['fromNumber'];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x85')];_0x2af438[_0xaf7d('0x55')]['messageId']=_0x4c32ed['body']['replyMessageId'];break;case _0xaf7d('0x86'):_0x2af438[_0xaf7d('0x55')]['messageId']=_0x4c32ed[_0xaf7d('0x55')][0x0][_0xaf7d('0x22')]['id'];_0x2af438['body'][_0xaf7d('0x77')]=_0x4c32ed[_0xaf7d('0x55')][0x0][_0xaf7d('0x22')][_0xaf7d('0x77')];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')][0x0][_0xaf7d('0x22')]['text'];break;case _0xaf7d('0x87'):_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')]=_0x4c32ed['body'][_0xaf7d('0x77')];_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')]=_0x4c32ed[_0xaf7d('0x55')][_0xaf7d('0x22')];_0x2af438[_0xaf7d('0x55')]['messageId']=_0x4c32ed[_0xaf7d('0x55')]['refid'];break;}}if(_0x2af438[_0xaf7d('0x55')]['id']){delete _0x2af438[_0xaf7d('0x55')]['id'];}if(_[_0xaf7d('0x88')](_0x2af438['body'][_0xaf7d('0x77')])){throw new db['Sequelize']['ValidationError'](_0xaf7d('0x89'));}if(_[_0xaf7d('0x88')](_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')])||_0x2af438[_0xaf7d('0x55')]['body']===''){throw new db[(_0xaf7d('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaf7d('0x88')](_0x2af438['body'][_0xaf7d('0x8a')])){throw new db[(_0xaf7d('0x70'))][(_0xaf7d('0x71'))](_0xaf7d('0x8b')+_0x411aaf);}if(!_[_0xaf7d('0x8c')](_0x411aaf,_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x8a')])){throw new db[(_0xaf7d('0x70'))][(_0xaf7d('0x71'))](_0xaf7d('0x8d')+_0x411aaf);}_0x1188d9[_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x8a')]]=_0x2af438['body'][_0xaf7d('0x77')];return db['CmList'][_0xaf7d('0x59')]({'where':{'id':_0x2af438[_0xaf7d('0x6e')][_0xaf7d('0x8e')]},'include':[{'model':db[_0xaf7d('0x6f')],'as':_0xaf7d('0x8f'),'where':_0x1188d9,'limit':0x1,'order':[[_0xaf7d('0x75'),_0xaf7d('0x90')]]}]});})[_0xaf7d('0x31')](handleEntityNotFound(_0x254889,null))[_0xaf7d('0x31')](function(_0x2dfabe){if(_0x2dfabe){_0x2af438['list']=_[_0xaf7d('0x91')](_0x2dfabe,[_0xaf7d('0x8f')]);if(_0x2dfabe[_0xaf7d('0x8f')][_0xaf7d('0x45')]){return _0x2dfabe['Contacts'][0x0];}var _0x377038=_['defaults'](_0x2af438[_0xaf7d('0x55')],{'firstName':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')],'ListId':_0x2dfabe['id']});_0x377038[_0x2af438[_0xaf7d('0x55')]['mapKey']]=_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')];return db['CmContact'][_0xaf7d('0x5f')](_0x377038,{'fields':_0x337aa4,'raw':!![]});}})[_0xaf7d('0x31')](handleEntityNotFound(_0x254889,null))['then'](function(_0x39b744){if(_0x39b744){_0x2af438[_0xaf7d('0x92')]=_0x39b744;var _0x4a339f={'ContactId':_0x39b744['id'],'phone':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')],'SmsAccountId':_0x4c32ed[_0xaf7d('0x53')]['id']};var _0x39dcbe={'ContactId':_0x39b744['id'],'SmsAccountId':_0x4c32ed[_0xaf7d('0x53')]['id'],'closed':![]};return db[_0xaf7d('0x93')][_0xaf7d('0x59')]({'where':_0x39dcbe})[_0xaf7d('0x31')](function(_0x364c04){if(_0x364c04){return[_0x364c04,![]];}return db[_0xaf7d('0x93')]['create'](_0x4a339f)[_0xaf7d('0x31')](function(_0x3ed4ac){return[_0x3ed4ac,!![]];});});}})['spread'](function(_0x4b0e69,_0x239b1a){_0x2af438[_0xaf7d('0x94')]=_0x4b0e69['get']({'plain':!![]});_0x2af438['interaction']['created']=![];if(_0x239b1a){if(_0x2af438['account'][_0xaf7d('0x95')]){_0x2af438['applications']['push']({'id':0x0,'priority':_0x2af438['applications']['length']+0x1,'app':'close','appdata':_0xaf7d('0x96'),'interval':'*,*,*,*'});}_0x2af438['interaction'][_0xaf7d('0x97')]=!![];}return db[_0xaf7d('0x98')][_0xaf7d('0x5f')]({'phone':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x77')],'messageId':_0x2af438['body'][_0xaf7d('0x79')],'body':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x55')],'SmsAccountId':_0x4c32ed[_0xaf7d('0x53')]['id'],'SmsInteractionId':_0x4b0e69['id'],'direction':'in','ContactId':_0x4b0e69['ContactId'],'AttachmentId':_0x2af438[_0xaf7d('0x55')][_0xaf7d('0x99')]});})[_0xaf7d('0x31')](function(_0xc4d90){_0x2af438[_0xaf7d('0x22')]=_0xc4d90;if(_0x2af438[_0xaf7d('0x94')][_0xaf7d('0x9a')]){return db[_0xaf7d('0x9b')][_0xaf7d('0x59')]({'attributes':['id',_0xaf7d('0x36')],'where':{'id':_0x2af438['interaction'][_0xaf7d('0x9a')]}})['then'](function(_0x1daa04){if(_0x1daa04){_0x2af438[_0xaf7d('0x6b')][_0xaf7d('0x9c')]({'id':0x0,'priority':0x0,'app':_0xaf7d('0x9d'),'appdata':_0x1daa04[_0xaf7d('0x36')]+','+(_0x2af438[_0xaf7d('0x6e')][_0xaf7d('0x9e')]||0xa),'interval':_0xaf7d('0x9f')});}return respondWithRpcPromise(_0xaf7d('0xa0'),_0xaf7d('0xa1'),_0x2af438);});}return respondWithRpcPromise(_0xaf7d('0xa0'),_0xaf7d('0xa1'),_0x2af438);})[_0xaf7d('0x31')](function(_0x545029){if(_0x545029){var _0x51a4d0=0xc8;var _0x48eda0=_0xaf7d('0xa2');logger[_0xaf7d('0x1b')](_0xaf7d('0x1e'),_0x48eda0,_0x51a4d0,_0xaf7d('0xa3'));logger['debug'](_0xaf7d('0xa4'),_0x48eda0,_0x51a4d0,_0xaf7d('0xa3'),JSON[_0xaf7d('0xa5')](_0x545029));if(_0x2af438[_0xaf7d('0x6e')][_0xaf7d('0x3b')]===_0xaf7d('0xa6')){return _0x254889[_0xaf7d('0x26')](_0x51a4d0)['set'](_0xaf7d('0xa7'),'text/xml')[_0xaf7d('0xa8')](_0xaf7d('0xa9'));}else{return _0x254889[_0xaf7d('0x26')](_0x51a4d0)[_0xaf7d('0x28')](_0x545029);}}})[_0xaf7d('0x24')](handleError(_0x254889,null));};exports[_0xaf7d('0xaa')]=function(_0x2f84ba,_0x17da4c){var _0x43a126=_0x2f84ba[_0xaf7d('0x53')]['id'];var _0x5bbbc0=_0x2f84ba[_0xaf7d('0x55')];var _0x2397b6=0xc8;var _0x3c84fd=null;return db[_0xaf7d('0xab')]['transaction']({'isolationLevel':db['sequelize'][_0xaf7d('0xac')]['ISOLATION_LEVELS'][_0xaf7d('0xad')]},function(_0x53982f){return db[_0xaf7d('0x54')][_0xaf7d('0x66')]({'where':{'id':_0x43a126},'transaction':_0x53982f})[_0xaf7d('0x31')](function(_0x2435be){if(_0x2435be){return db['SmsApplication'][_0xaf7d('0x32')]({'where':{'SmsAccountId':_0x43a126},'transaction':_0x53982f})[_0xaf7d('0x31')](function(){var _0x40c2f4=_['map'](_0x5bbbc0,function(_0x1454fd){_0x1454fd[_0xaf7d('0x62')]=_0x43a126;return _0x1454fd;});return db[_0xaf7d('0x69')][_0xaf7d('0xae')](_0x40c2f4,{'transaction':_0x53982f});});}else{_0x2397b6=0x194;_0x3c84fd=[];}});})[_0xaf7d('0x31')](function(){if(_0x2397b6!==0x194){return db[_0xaf7d('0x69')][_0xaf7d('0xaf')]({'where':{'SmsAccountId':_0x43a126},'order':_0xaf7d('0x6d')})[_0xaf7d('0x31')](function(_0x1ff740){_0x3c84fd=_0x1ff740;});}})['catch'](function(_0x2d2c19){_0x2397b6=0x1f4;logger[_0xaf7d('0x1f')](_0x2d2c19[_0xaf7d('0x35')]);if(_0x2d2c19[_0xaf7d('0x36')]){delete _0x2d2c19[_0xaf7d('0x36')];}_0x3c84fd=_0x2d2c19;})[_0xaf7d('0xb0')](function(){if(_0x3c84fd===null){_0x17da4c[_0xaf7d('0x25')](_0x2397b6);}else{if(_0x2397b6===0x1f4){_0x17da4c[_0xaf7d('0x26')](_0x2397b6)[_0xaf7d('0xa8')](_0x3c84fd);}else{_0x17da4c[_0xaf7d('0x26')](_0x2397b6)['json'](_0x3c84fd);}}});};exports[_0xaf7d('0xb1')]=function(_0x27dba5,_0x567a4d,_0x483576){var _0x32f2d7={};var _0x345260={};var _0x36f5f6;var _0x5d055e;return db[_0xaf7d('0x54')]['findOne']({'where':{'id':_0x27dba5[_0xaf7d('0x53')]['id']}})['then'](handleEntityNotFound(_0x567a4d,null))[_0xaf7d('0x31')](function(_0x3d2aaa){if(_0x3d2aaa){_0x36f5f6=_0x3d2aaa;_0x345260[_0xaf7d('0x42')]=_[_0xaf7d('0x3f')](db[_0xaf7d('0x69')][_0xaf7d('0x39')]);_0x345260[_0xaf7d('0x3e')]=_[_0xaf7d('0x3f')](_0x27dba5[_0xaf7d('0x3e')]);_0x345260[_0xaf7d('0x40')]=_[_0xaf7d('0x41')](_0x345260[_0xaf7d('0x42')],_0x345260[_0xaf7d('0x3e')]);_0x32f2d7[_0xaf7d('0x43')]=_[_0xaf7d('0x41')](_0x345260[_0xaf7d('0x42')],qs[_0xaf7d('0x44')](_0x27dba5[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x32f2d7[_0xaf7d('0x43')]=_0x32f2d7[_0xaf7d('0x43')][_0xaf7d('0x45')]?_0x32f2d7[_0xaf7d('0x43')]:_0x345260[_0xaf7d('0x42')];_0x32f2d7[_0xaf7d('0xb2')]=qs[_0xaf7d('0x48')](_0x27dba5[_0xaf7d('0x3e')][_0xaf7d('0x48')]);_0x32f2d7[_0xaf7d('0x4a')]=qs[_0xaf7d('0x40')](_[_0xaf7d('0x49')](_0x27dba5['query'],_0x345260[_0xaf7d('0x40')]));if(_0x27dba5[_0xaf7d('0x3e')]['filter']){_0x32f2d7[_0xaf7d('0x4a')]=_['merge'](_0x32f2d7[_0xaf7d('0x4a')],{'$or':_['map'](_0x32f2d7[_0xaf7d('0x43')],function(_0x376871){var _0x42bcb6={};_0x42bcb6[_0x376871]={'$like':'%'+_0x27dba5[_0xaf7d('0x3e')][_0xaf7d('0x4d')]+'%'};return _0x42bcb6;})});}_0x32f2d7=_[_0xaf7d('0x4b')]({},_0x32f2d7,_0x27dba5[_0xaf7d('0x67')]);return _0x36f5f6['getApplications'](_0x32f2d7);}})[_0xaf7d('0x31')](function(_0x382744){if(_0x382744){_0x5d055e=_0x382744[_0xaf7d('0x45')];if(!_0x27dba5[_0xaf7d('0x3e')][_0xaf7d('0x46')](_0xaf7d('0x47'))){_0x32f2d7[_0xaf7d('0x2a')]=qs[_0xaf7d('0x2a')](_0x27dba5[_0xaf7d('0x3e')]['limit']);_0x32f2d7[_0xaf7d('0x2c')]=qs[_0xaf7d('0x2c')](_0x27dba5['query'][_0xaf7d('0x2c')]);}return _0x36f5f6[_0xaf7d('0xb1')](_0x32f2d7);}})[_0xaf7d('0x31')](function(_0x9f89a3){if(_0x9f89a3){return _0x9f89a3?{'count':_0x5d055e,'rows':_0x9f89a3}:null;}})[_0xaf7d('0x31')](respondWithResult(_0x567a4d,null))[_0xaf7d('0x24')](handleError(_0x567a4d,null));};exports['getInteractions']=function(_0x294c77,_0x101c7e,_0x2cffdd){var _0x410fea={'raw':![],'where':{}};var _0x2b7de7={};var _0x3acdcd={'count':0x0,'rows':[]};return db[_0xaf7d('0x54')][_0xaf7d('0x66')]({'where':{'id':_0x294c77[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x101c7e,null))['then'](function(_0x597a5a){if(_0x597a5a){_0x2b7de7[_0xaf7d('0x42')]=_[_0xaf7d('0x3f')](db['SmsInteraction'][_0xaf7d('0x39')]);_0x2b7de7[_0xaf7d('0x3e')]=_['keys'](_0x294c77[_0xaf7d('0x3e')]);_0x2b7de7['filters']=_[_0xaf7d('0x41')](_0x2b7de7[_0xaf7d('0x42')],_0x2b7de7['query']);_0x410fea['attributes']=_[_0xaf7d('0x41')](_0x2b7de7[_0xaf7d('0x42')],qs['fields'](_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x410fea[_0xaf7d('0x43')]=_0x410fea['attributes'][_0xaf7d('0x45')]?_0x410fea[_0xaf7d('0x43')]:_0x2b7de7[_0xaf7d('0x42')];if(!_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x46')]('nolimit')){_0x410fea[_0xaf7d('0x2a')]=qs[_0xaf7d('0x2a')](_0x294c77[_0xaf7d('0x3e')]['limit']);_0x410fea[_0xaf7d('0x2c')]=qs[_0xaf7d('0x2c')](_0x294c77[_0xaf7d('0x3e')]['offset']);}_0x410fea['order']=qs['sort'](_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x48')]);_0x410fea['where']=qs[_0xaf7d('0x40')](_[_0xaf7d('0x49')](_0x294c77[_0xaf7d('0x3e')],_0x2b7de7[_0xaf7d('0x40')]));_0x410fea[_0xaf7d('0x4a')]['SmsAccountId']=_0x597a5a['id'];if(_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x4d')]){_0x410fea['where']=_['merge'](_0x410fea[_0xaf7d('0x4a')],{'$or':_[_0xaf7d('0x3d')](_0x410fea[_0xaf7d('0x43')],function(_0x4ea945){var _0x225232={};_0x225232[_0x4ea945]={'$like':'%'+_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x4d')]+'%'};return _0x225232;})});}_0x410fea=_[_0xaf7d('0x4b')]({},_0x410fea,_0x294c77['options']);return db[_0xaf7d('0x93')]['count']({'where':_0x410fea[_0xaf7d('0x4a')]})['then'](function(_0x57dcb5){_0x3acdcd[_0xaf7d('0x2b')]=_0x57dcb5;if(_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0x4e')]){_0x410fea[_0xaf7d('0x4f')]=[{'model':db[_0xaf7d('0x6f')],'as':_0xaf7d('0xb3'),'required':![]},{'model':db[_0xaf7d('0x9b')],'as':_0xaf7d('0xb4'),'attributes':['name',_0xaf7d('0xb5'),_0xaf7d('0xb6')],'required':![]},{'model':db['Tag'],'as':_0xaf7d('0xb7'),'attributes':['id',_0xaf7d('0x36'),_0xaf7d('0xb8')],'where':_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0xb9')]?{'id':_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0xb9')]}:undefined,'required':_0x294c77[_0xaf7d('0x3e')][_0xaf7d('0xb9')]?!![]:![]}];}return db[_0xaf7d('0x93')][_0xaf7d('0x50')](_0x410fea);})['then'](function(_0x560192){_0x3acdcd[_0xaf7d('0x51')]=_0x560192;return _0x3acdcd;});}})['then'](respondWithFilteredResult(_0x101c7e,_0x410fea))[_0xaf7d('0x24')](handleError(_0x101c7e,null));};exports[_0xaf7d('0xa8')]=function(_0x1e5f24,_0x24a26d,_0xae530c){var _0x1492f6,_0x5040b8,_0x2fcb27;if(_['isNil'](_0x1e5f24[_0xaf7d('0x55')][_0xaf7d('0x55')])||_0x1e5f24[_0xaf7d('0x55')]['body']===''){throw new db[(_0xaf7d('0x70'))]['ValidationError'](_0xaf7d('0xba'));}if(_[_0xaf7d('0x88')](_0x1e5f24[_0xaf7d('0x55')]['to'])){throw new db[(_0xaf7d('0x70'))][(_0xaf7d('0x71'))](_0xaf7d('0xbb'));}_0x1492f6=_0x1e5f24['body']['to'];return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x1e5f24[_0xaf7d('0x53')]['id']},'include':[{'model':db[_0xaf7d('0xbc')],'as':_0xaf7d('0xbd'),'include':[{'model':db['CmContact'],'as':_0xaf7d('0x8f'),'where':{'mobile':_0x1492f6},'limit':0x1,'order':[[_0xaf7d('0x75'),_0xaf7d('0x90')]]}]}]})['then'](handleEntityNotFound(_0x24a26d,null))['then'](function(_0x426c93){if(_0x426c93&&_0x426c93[_0xaf7d('0xbd')]){_0x5040b8=_0x426c93[_0xaf7d('0x57')]({'plain':!![]});if(_0x5040b8['List']&&_0x5040b8[_0xaf7d('0xbd')][_0xaf7d('0x8f')][_0xaf7d('0x45')]){return _0x5040b8['List'][_0xaf7d('0x8f')][0x0];}return db[_0xaf7d('0x6f')][_0xaf7d('0x5f')](_[_0xaf7d('0xbe')](_0x1e5f24['body'],{'firstName':_0x1492f6,'mobile':_0x1492f6,'phone':_0x1492f6,'ListId':_0x5040b8['ListId']}));}})['then'](handleEntityNotFound(_0x24a26d,null))[_0xaf7d('0x31')](function(_0x302739){if(_0x302739){_0x2fcb27=_0x302739;return db[_0xaf7d('0x93')][_0xaf7d('0x59')]({'where':{'ContactId':_0x2fcb27['id'],'closed':![],'SmsAccountId':_0x5040b8['id']}})[_0xaf7d('0x31')](function(_0x26a263){if(_0x26a263){return[_0x26a263,![]];}return db[_0xaf7d('0x93')][_0xaf7d('0x5f')]({'UserId':_0x1e5f24[_0xaf7d('0x56')]['id'],'ContactId':_0x2fcb27['id'],'SmsAccountId':_0x5040b8['id'],'phone':_0x1492f6,'firstMsgDirection':_0xaf7d('0xbf'),'Messages':[_[_0xaf7d('0x4b')](_0x1e5f24[_0xaf7d('0x55')],{'read':![],'body':_0x1e5f24[_0xaf7d('0x55')][_0xaf7d('0x55')],'phone':_0x1492f6,'SmsAccountId':_0x5040b8['id'],'UserId':_0x1e5f24[_0xaf7d('0x56')]['id'],'ContactId':_0x2fcb27['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xaf7d('0xc0')}]})[_0xaf7d('0x31')](function(_0x47891b){return[_0x47891b,!![]];});});}})[_0xaf7d('0xc1')](function(_0x269ac7,_0x5101fc){if(_0x5101fc){return _0x269ac7;}return db[_0xaf7d('0x98')][_0xaf7d('0x5f')](_[_0xaf7d('0x4b')](_0x1e5f24['body'],{'read':![],'body':_0x1e5f24[_0xaf7d('0x55')][_0xaf7d('0x55')],'phone':_0x1492f6,'SmsAccountId':_0x5040b8['id'],'SmsInteractionId':_0x269ac7['id'],'UserId':_0x1e5f24[_0xaf7d('0x56')]['id'],'ContactId':_0x2fcb27['id']}))[_0xaf7d('0x31')](function(_0x493197){_0x269ac7[_0xaf7d('0xc2')]['Messages']=[];_0x269ac7[_0xaf7d('0xc2')]['Messages'][_0xaf7d('0xc3')](_0x493197[_0xaf7d('0xc2')]);return _0x269ac7;});})[_0xaf7d('0x31')](respondWithResult(_0x24a26d,null))[_0xaf7d('0x24')](handleError(_0x24a26d,null));};exports[_0xaf7d('0x26')]=function(_0xb15959,_0x4b34ad,_0x2f6073){if(_0xb15959[_0xaf7d('0x55')]['id']){delete _0xb15959[_0xaf7d('0x55')]['id'];}var _0x11c33d,_0x573612,_0x35a85e;return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0xb15959['params']['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x4b34ad,null))[_0xaf7d('0x31')](function(_0x1d1b57){if(_0x1d1b57){_0x35a85e=_0x1d1b57;logger['debug'](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0xc4'),_0x1d1b57[_0xaf7d('0x3b')],util[_0xaf7d('0xc5')](_0xb15959['body'],{'showHidden':![],'depth':null}));switch(_0x1d1b57[_0xaf7d('0x3b')]){case _0xaf7d('0x7b'):if(_0xb15959[_0xaf7d('0x55')]['skebby_dispatch_id']&&_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x26')]){_0x573612=_0xb15959['body'][_0xaf7d('0x26')];return db[_0xaf7d('0x98')]['find']({'where':{'messageId':_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xc6')]}});}break;case _0xaf7d('0xc7'):if(_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xc8')]&&_0xb15959[_0xaf7d('0x55')]['statusInt']){_0x573612=_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xc9')];return db[_0xaf7d('0x98')][_0xaf7d('0x59')]({'where':{'messageId':_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xc8')]}});}break;case _0xaf7d('0x7d'):if(_0xb15959['body'][_0xaf7d('0x7e')]&&_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xca')]){_0x573612=_0xb15959[_0xaf7d('0x55')]['status_code'];return db[_0xaf7d('0x98')][_0xaf7d('0x59')]({'where':{'messageId':_0xb15959['body'][_0xaf7d('0x7e')]}});}break;case _0xaf7d('0x80'):var _0x2c5e98=_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x81')][0x0];if(_0x2c5e98['messageId']&&_0x2c5e98['status']['groupName']===_0xaf7d('0xcb')){_0x573612=_0x2c5e98[_0xaf7d('0x26')][_0xaf7d('0xcc')];return db[_0xaf7d('0x98')]['find']({'where':{'messageId':_0x2c5e98[_0xaf7d('0x79')]}});}break;case'clickatell':if(_0xb15959['body'][_0xaf7d('0x79')]&&_0xb15959['body'][_0xaf7d('0x26')]){_0x573612=_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x26')];return db['SmsMessage'][_0xaf7d('0x59')]({'where':{'messageId':_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x79')]}});}break;case _0xaf7d('0x86'):if(_0xb15959[_0xaf7d('0x55')][0x0][_0xaf7d('0x22')]['id']){_0x573612=_0xb15959[_0xaf7d('0x55')][0x0]['type'];return db[_0xaf7d('0x98')][_0xaf7d('0x59')]({'where':{'messageId':_0xb15959[_0xaf7d('0x55')][0x0]['message']['id']}});}break;case _0xaf7d('0x87'):if(_0xb15959['body'][_0xaf7d('0xcd')]&&_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x26')]){_0x573612=_0xb15959[_0xaf7d('0x55')][_0xaf7d('0x26')];return db[_0xaf7d('0x98')][_0xaf7d('0x59')]({'where':{'messageId':_0xb15959['body'][_0xaf7d('0xcd')]}});}break;}}})[_0xaf7d('0x31')](handleEntityNotFound(_0x4b34ad,null))[_0xaf7d('0x31')](function(_0x1d2d1b){if(_0x1d2d1b){_0x11c33d=_0x1d2d1b;switch(_0x35a85e['type']){case'skebby':if(_0x573612===_0xaf7d('0xcb')){return _0x11c33d[_0xaf7d('0x5c')]({'read':!![]});}else{logger[_0xaf7d('0x1f')](_0xaf7d('0x1e'),_0xaf7d('0x26'),'skebby',util[_0xaf7d('0xc5')](_0xb15959['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x573612==='1'){return _0x11c33d[_0xaf7d('0x5c')]({'read':!![]});}else{logger[_0xaf7d('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf7d('0x26'),_0xaf7d('0x7b'),util[_0xaf7d('0xc5')](_0xb15959[_0xaf7d('0x55')],{'showHidden':![],'depth':null}));}break;case _0xaf7d('0x7d'):if(!_0xb15959[_0xaf7d('0x55')][_0xaf7d('0xce')]&&_0x573612>=0xc8&&_0x573612<=0xce){return _0x11c33d[_0xaf7d('0x5c')]({'read':!![]});}else{logger[_0xaf7d('0x1f')](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0x7d'),util[_0xaf7d('0xc5')](_0xb15959[_0xaf7d('0x55')],{'showHidden':![],'depth':null}));}break;case _0xaf7d('0x80'):var _0x266245=_0xb15959['body'][_0xaf7d('0x81')][0x0];if(_0x266245[_0xaf7d('0x26')][_0xaf7d('0xcc')]==='DELIVERED'){return _0x11c33d[_0xaf7d('0x5c')]({'read':!![]});}else{logger[_0xaf7d('0x1f')](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0x80'),util[_0xaf7d('0xc5')](_0xb15959[_0xaf7d('0x55')],{'showHidden':![],'depth':null}));}break;case _0xaf7d('0x84'):if(_0x573612=='DELIVERED_TO_GATEWAY'||_0x573612==_0xaf7d('0xcf')){return _0x11c33d[_0xaf7d('0x5c')]({'read':!![]});}else{logger['error'](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0x84'),util[_0xaf7d('0xc5')](_0xb15959['body'],{'showHidden':![],'depth':null}));}break;case _0xaf7d('0x86'):if(_0x573612=='message-delivered'){return _0x11c33d['update']({'read':!![]});}else{logger[_0xaf7d('0x1f')](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0x86'),util['inspect'](_0xb15959[_0xaf7d('0x55')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x573612===_0xaf7d('0xd0')||_0x573612===_0xaf7d('0xd1')){return _0x11c33d['update']({'read':!![]});}else{logger[_0xaf7d('0x1f')](_0xaf7d('0x1e'),_0xaf7d('0x26'),'intelepeer',util[_0xaf7d('0xc5')](_0xb15959['body'],{'showHidden':![],'depth':null}));}break;}return _0x11c33d;}})['then'](respondWithResult(_0x4b34ad,null))['catch'](handleError(_0x4b34ad,null));};exports[_0xaf7d('0xd2')]=function(_0x28e87c,_0x2b2d3c,_0x56bece){var _0x62e8ed,_0x442a8f,_0x427a72;return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x28e87c[_0xaf7d('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b2d3c,null))['then'](function(_0x20c965){if(_0x20c965){_0x427a72=_0x20c965;logger[_0xaf7d('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf7d('0x26'),_0xaf7d('0xc4'),_0x20c965['type'],util['inspect'](_0x28e87c[_0xaf7d('0x3e')],{'showHidden':![],'depth':null}));switch(_0x20c965['type']){case _0xaf7d('0x82'):if(_0x28e87c[_0xaf7d('0x3e')][_0xaf7d('0xd3')]&&_0x28e87c['query']['state']){_0x442a8f=_0x28e87c[_0xaf7d('0x3e')][_0xaf7d('0xd4')];return db[_0xaf7d('0x98')][_0xaf7d('0x59')]({'where':{'messageId':_0x28e87c[_0xaf7d('0x3e')][_0xaf7d('0xd3')]}});}break;}}})[_0xaf7d('0x31')](handleEntityNotFound(_0x2b2d3c,null))[_0xaf7d('0x31')](function(_0x3bcd57){if(_0x3bcd57){_0x62e8ed=_0x3bcd57;switch(_0x427a72[_0xaf7d('0x3b')]){case _0xaf7d('0x82'):if(_0x442a8f==='2'||_0x442a8f==='6'){return _0x62e8ed[_0xaf7d('0x5c')]({'read':!![]});}else{logger['error'](_0xaf7d('0x1e'),_0xaf7d('0x26'),_0xaf7d('0x82'),util['inspect'](_0x28e87c[_0xaf7d('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x62e8ed;}})['then'](respondWithResult(_0x2b2d3c,null))['catch'](handleError(_0x2b2d3c,null));};exports[_0xaf7d('0xd5')]=function(_0x43a0a6,_0x391262,_0x5a83b1){return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x43a0a6[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x391262,null))[_0xaf7d('0x31')](function(_0x4007cf){if(_0x4007cf){return _0x4007cf[_0xaf7d('0xd5')](_0x43a0a6[_0xaf7d('0x55')][_0xaf7d('0x64')],_[_0xaf7d('0x91')](_0x43a0a6[_0xaf7d('0x55')],[_0xaf7d('0x64'),'id'])||{})[_0xaf7d('0xc1')](function(_0x5de760){for(var _0x282513=0x0;_0x282513<_0x43a0a6[_0xaf7d('0x55')][_0xaf7d('0x64')]['length'];_0x282513+=0x1){socket[_0xaf7d('0xd6')](_0xaf7d('0xd7'),{'UserId':Number(_0x43a0a6[_0xaf7d('0x55')]['ids'][_0x282513]),'SmsAccountId':Number(_0x43a0a6[_0xaf7d('0x53')]['id'])});}return _0x5de760;});}})[_0xaf7d('0x31')](respondWithResult(_0x391262,null))[_0xaf7d('0x24')](handleError(_0x391262,null));};exports['removeAgents']=function(_0x2c80d1,_0x4015c8,_0x1271e6){return db[_0xaf7d('0x54')][_0xaf7d('0x59')]({'where':{'id':_0x2c80d1[_0xaf7d('0x53')]['id']}})['then'](handleEntityNotFound(_0x4015c8,null))[_0xaf7d('0x31')](function(_0x3f8a92){if(_0x3f8a92){return _0x3f8a92[_0xaf7d('0xd8')](_0x2c80d1[_0xaf7d('0x3e')]['ids'])[_0xaf7d('0x31')](function(){if(_[_0xaf7d('0xd9')](_0x2c80d1[_0xaf7d('0x3e')][_0xaf7d('0x64')])){for(var _0x14b86d=0x0;_0x14b86d<_0x2c80d1[_0xaf7d('0x3e')][_0xaf7d('0x64')][_0xaf7d('0x45')];_0x14b86d+=0x1){socket[_0xaf7d('0xd6')](_0xaf7d('0xda'),{'UserId':Number(_0x2c80d1[_0xaf7d('0x3e')]['ids'][_0x14b86d]),'SmsAccountId':Number(_0x2c80d1[_0xaf7d('0x53')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2c80d1['query'][_0xaf7d('0x64')]),'SmsAccountId':Number(_0x2c80d1[_0xaf7d('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x4015c8,null))[_0xaf7d('0x24')](handleError(_0x4015c8,null));};exports[_0xaf7d('0xdb')]=function(_0x5e6f64,_0x330ba3,_0x247622){var _0x1cefbf={};var _0x1a8356={};var _0x389e35;var _0x3713c7;return db[_0xaf7d('0x54')][_0xaf7d('0x66')]({'where':{'id':_0x5e6f64[_0xaf7d('0x53')]['id']}})[_0xaf7d('0x31')](handleEntityNotFound(_0x330ba3,null))[_0xaf7d('0x31')](function(_0x5950df){if(_0x5950df){_0x389e35=_0x5950df;_0x1a8356[_0xaf7d('0x42')]=_['keys'](db['User']['rawAttributes']);_0x1a8356[_0xaf7d('0x3e')]=_['keys'](_0x5e6f64['query']);_0x1a8356[_0xaf7d('0x40')]=_[_0xaf7d('0x41')](_0x1a8356['model'],_0x1a8356[_0xaf7d('0x3e')]);_0x1cefbf[_0xaf7d('0x43')]=_[_0xaf7d('0x41')](_0x1a8356[_0xaf7d('0x42')],qs[_0xaf7d('0x44')](_0x5e6f64[_0xaf7d('0x3e')][_0xaf7d('0x44')]));_0x1cefbf[_0xaf7d('0x43')]=_0x1cefbf[_0xaf7d('0x43')][_0xaf7d('0x45')]?_0x1cefbf[_0xaf7d('0x43')]:_0x1a8356[_0xaf7d('0x42')];_0x1cefbf[_0xaf7d('0xb2')]=qs['sort'](_0x5e6f64[_0xaf7d('0x3e')]['sort']);_0x1cefbf[_0xaf7d('0x4a')]=qs[_0xaf7d('0x40')](_[_0xaf7d('0x49')](_0x5e6f64[_0xaf7d('0x3e')],_0x1a8356['filters']));if(_0x5e6f64[_0xaf7d('0x3e')]['filter']){_0x1cefbf['where']=_[_0xaf7d('0x4b')](_0x1cefbf[_0xaf7d('0x4a')],{'$or':_[_0xaf7d('0x3d')](_0x1cefbf['attributes'],function(_0x43ac20){var _0x3dcb27={};_0x3dcb27[_0x43ac20]={'$like':'%'+_0x5e6f64[_0xaf7d('0x3e')][_0xaf7d('0x4d')]+'%'};return _0x3dcb27;})});}_0x1cefbf=_[_0xaf7d('0x4b')]({},_0x1cefbf,_0x5e6f64[_0xaf7d('0x67')]);return _0x389e35['getAgents'](_0x1cefbf);}})[_0xaf7d('0x31')](function(_0x5418e2){if(_0x5418e2){_0x3713c7=_0x5418e2[_0xaf7d('0x45')];if(!_0x5e6f64[_0xaf7d('0x3e')][_0xaf7d('0x46')]('nolimit')){_0x1cefbf['limit']=qs['limit'](_0x5e6f64[_0xaf7d('0x3e')]['limit']);_0x1cefbf['offset']=qs[_0xaf7d('0x2c')](_0x5e6f64[_0xaf7d('0x3e')][_0xaf7d('0x2c')]);}return _0x389e35[_0xaf7d('0xdb')](_0x1cefbf);}})[_0xaf7d('0x31')](function(_0x805d85){if(_0x805d85){return _0x805d85?{'count':_0x3713c7,'rows':_0x805d85}:null;}})[_0xaf7d('0x31')](respondWithResult(_0x330ba3,null))[_0xaf7d('0x24')](handleError(_0x330ba3,null));}; \ No newline at end of file +var _0xba14=['show','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','applications','priority','asc','account','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','from','sender','text','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','list','defaults','contact','SmsInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','skebby','DELIVERED','inspect','connectel','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','state','message-id','addAgents','omit','removeAgents','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./smsAccount.socket','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','end','stack','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','name','filter','options','includeAll','include','findAll','rows'];(function(_0x2314ec,_0x1a69fa){var _0x23a918=function(_0x3f456f){while(--_0x3f456f){_0x2314ec['push'](_0x2314ec['shift']());}};_0x23a918(++_0x1a69fa);}(_0xba14,0x16f));var _0x4ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ba1('0x0'));var zipdir=require(_0x4ba1('0x1'));var jsonpatch=require(_0x4ba1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ba1('0x3'));var Mustache=require(_0x4ba1('0x4'));var util=require(_0x4ba1('0x5'));var path=require(_0x4ba1('0x6'));var sox=require(_0x4ba1('0x7'));var csv=require(_0x4ba1('0x8'));var ejs=require(_0x4ba1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ba1('0xa'));var squel=require(_0x4ba1('0xb'));var crypto=require(_0x4ba1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ba1('0xd'));var toCsv=require(_0x4ba1('0x8'));var querystring=require(_0x4ba1('0xe'));var Papa=require(_0x4ba1('0xf'));var Redis=require('ioredis');var authService=require(_0x4ba1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4ba1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ba1('0x12'))(_0x4ba1('0x13'));var utils=require(_0x4ba1('0x14'));var config=require(_0x4ba1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ba1('0x16'))['db'];config[_0x4ba1('0x17')]=_['defaults'](config[_0x4ba1('0x17')],{'host':_0x4ba1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ba1('0x17')]));require(_0x4ba1('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4ba1('0x1a')][_0x4ba1('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x52f554,_0x334cdd,_0x5cd874,_0x411bf1){return new BPromise(function(_0x46c4c1,_0x4ef66d){var _0x34c17a=_0x411bf1||client;return _0x34c17a[_0x4ba1('0x1c')](_0x52f554,_0x5cd874)[_0x4ba1('0x1d')](function(_0x2a5e24){logger[_0x4ba1('0x1e')](_0x4ba1('0x1f'),_0x334cdd,_0x4ba1('0x20'));logger[_0x4ba1('0x21')](_0x4ba1('0x22'),_0x334cdd,_0x4ba1('0x20'),JSON[_0x4ba1('0x23')](_0x2a5e24));if(_0x2a5e24['error']){if(_0x2a5e24[_0x4ba1('0x24')]['code']===0x1f4){logger['error'](_0x4ba1('0x1f'),_0x334cdd,_0x2a5e24['error'][_0x4ba1('0x25')]);return _0x4ef66d(_0x2a5e24[_0x4ba1('0x24')][_0x4ba1('0x25')]);}logger[_0x4ba1('0x24')]('SmsAccount,\x20%s,\x20%s',_0x334cdd,_0x2a5e24[_0x4ba1('0x24')][_0x4ba1('0x25')]);return _0x46c4c1(_0x2a5e24[_0x4ba1('0x24')][_0x4ba1('0x25')]);}else{logger[_0x4ba1('0x1e')](_0x4ba1('0x1f'),_0x334cdd,'request\x20sent');_0x46c4c1(_0x2a5e24[_0x4ba1('0x26')][_0x4ba1('0x25')]);}})[_0x4ba1('0x27')](function(_0x206b29){logger[_0x4ba1('0x24')](_0x4ba1('0x1f'),_0x334cdd,_0x206b29);_0x4ef66d(_0x206b29);});});}function respondWithStatusCode(_0x13cf0f,_0x2ab525){_0x2ab525=_0x2ab525||0xcc;return function(_0x41b1a8){if(_0x41b1a8){return _0x13cf0f[_0x4ba1('0x28')](_0x2ab525);}return _0x13cf0f[_0x4ba1('0x29')](_0x2ab525)['end']();};}function respondWithResult(_0x10a1c0,_0x1ca214){_0x1ca214=_0x1ca214||0xc8;return function(_0x2f7f26){if(_0x2f7f26){return _0x10a1c0[_0x4ba1('0x29')](_0x1ca214)[_0x4ba1('0x2a')](_0x2f7f26);}};}function respondWithFilteredResult(_0x240e2c,_0x326565){return function(_0x2f8a5a){if(_0x2f8a5a){var _0x59281=typeof _0x326565['offset']==='undefined'&&typeof _0x326565['limit']===_0x4ba1('0x2b');var _0xa4269a=_0x2f8a5a[_0x4ba1('0x2c')];var _0x490818=_0x59281?0x0:_0x326565[_0x4ba1('0x2d')];var _0x9c5f3f=_0x59281?_0x2f8a5a[_0x4ba1('0x2c')]:_0x326565[_0x4ba1('0x2d')]+_0x326565['limit'];var _0x289f3a;if(_0x9c5f3f>=_0xa4269a){_0x9c5f3f=_0xa4269a;_0x289f3a=0xc8;}else{_0x289f3a=0xce;}_0x240e2c[_0x4ba1('0x29')](_0x289f3a);return _0x240e2c[_0x4ba1('0x2e')]('Content-Range',_0x490818+'-'+_0x9c5f3f+'/'+_0xa4269a)[_0x4ba1('0x2a')](_0x2f8a5a);}return null;};}function patchUpdates(_0x317c1e){return function(_0x4a0643){try{jsonpatch[_0x4ba1('0x2f')](_0x4a0643,_0x317c1e,!![]);}catch(_0x27ca1d){return BPromise[_0x4ba1('0x30')](_0x27ca1d);}return _0x4a0643[_0x4ba1('0x31')]();};}function saveUpdates(_0x46e439,_0x4df80d){return function(_0x583feb){if(_0x583feb){return _0x583feb['update'](_0x46e439)[_0x4ba1('0x1d')](function(_0x578d47){return _0x578d47;});}return null;};}function removeEntity(_0xb6e7f2,_0x1c9aa8){return function(_0x1445de){if(_0x1445de){return _0x1445de[_0x4ba1('0x32')]()['then'](function(){var _0x475311=_0x1445de[_0x4ba1('0x33')]({'plain':!![]});var _0x1282b6=_0x4ba1('0x34');return db[_0x4ba1('0x35')][_0x4ba1('0x32')]({'where':{'type':_0x1282b6,'resourceId':_0x475311['id']}})[_0x4ba1('0x1d')](function(){return _0x1445de;});})[_0x4ba1('0x1d')](function(){_0xb6e7f2[_0x4ba1('0x29')](0xcc)[_0x4ba1('0x36')]();});}};}function handleEntityNotFound(_0x19cfa1,_0x5337a4){return function(_0x40e819){if(!_0x40e819){_0x19cfa1[_0x4ba1('0x28')](0x194);}return _0x40e819;};}function handleError(_0x21300b,_0x535512){_0x535512=_0x535512||0x1f4;return function(_0x5e2f2c){logger[_0x4ba1('0x24')](_0x5e2f2c[_0x4ba1('0x37')]);if(_0x5e2f2c['name']){delete _0x5e2f2c['name'];}_0x21300b[_0x4ba1('0x29')](_0x535512)[_0x4ba1('0x38')](_0x5e2f2c);};}exports[_0x4ba1('0x39')]=function(_0x2d0b58,_0x5baa90){var _0x5689b9={'include':[{'model':db[_0x4ba1('0x3a')],'as':_0x4ba1('0x3b')}]},_0x42713e={},_0x225583={'count':0x0,'rows':[]};var _0x5cc552=_[_0x4ba1('0x3c')](db[_0x4ba1('0x3d')]['rawAttributes'],function(_0x20a898){return{'name':_0x20a898[_0x4ba1('0x3e')],'type':_0x20a898[_0x4ba1('0x3f')][_0x4ba1('0x40')]};});_0x42713e[_0x4ba1('0x41')]=_[_0x4ba1('0x3c')](_0x5cc552,'name');_0x42713e['query']=_[_0x4ba1('0x42')](_0x2d0b58[_0x4ba1('0x43')]);_0x42713e[_0x4ba1('0x44')]=_[_0x4ba1('0x45')](_0x42713e[_0x4ba1('0x41')],_0x42713e['query']);_0x5689b9['attributes']=_[_0x4ba1('0x45')](_0x42713e[_0x4ba1('0x41')],qs[_0x4ba1('0x46')](_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x46')]));_0x5689b9[_0x4ba1('0x47')]=_0x5689b9[_0x4ba1('0x47')]['length']?_0x5689b9[_0x4ba1('0x47')]:_0x42713e['model'];if(!_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x48')](_0x4ba1('0x49'))){_0x5689b9[_0x4ba1('0x4a')]=qs[_0x4ba1('0x4a')](_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x4a')]);_0x5689b9[_0x4ba1('0x2d')]=qs[_0x4ba1('0x2d')](_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x2d')]);}_0x5689b9[_0x4ba1('0x4b')]=qs[_0x4ba1('0x4c')](_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x4c')]);_0x5689b9['where']=qs[_0x4ba1('0x44')](_[_0x4ba1('0x4d')](_0x2d0b58[_0x4ba1('0x43')],_0x42713e[_0x4ba1('0x44')]),_0x5cc552);if(_0x2d0b58[_0x4ba1('0x43')]['filter']){_0x5689b9[_0x4ba1('0x4e')]=_[_0x4ba1('0x4f')](_0x5689b9[_0x4ba1('0x4e')],{'$or':_[_0x4ba1('0x3c')](_0x5cc552,function(_0x449825){if(_0x449825[_0x4ba1('0x3f')]!=='VIRTUAL'){var _0x2963ff={};_0x2963ff[_0x449825[_0x4ba1('0x50')]]={'$like':'%'+_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x51')]+'%'};return _0x2963ff;}})});}_0x5689b9=_['merge']({},_0x5689b9,_0x2d0b58[_0x4ba1('0x52')]);var _0x31d373={'where':_0x5689b9['where']};return db[_0x4ba1('0x3d')][_0x4ba1('0x2c')](_0x31d373)['then'](function(_0x1c4e2f){_0x225583['count']=_0x1c4e2f;if(_0x2d0b58[_0x4ba1('0x43')][_0x4ba1('0x53')]){_0x5689b9[_0x4ba1('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0x4ba1('0x55')](_0x5689b9);})[_0x4ba1('0x1d')](function(_0xb1e4a8){_0x225583[_0x4ba1('0x56')]=_0xb1e4a8;return _0x225583;})[_0x4ba1('0x1d')](respondWithFilteredResult(_0x5baa90,_0x5689b9))[_0x4ba1('0x27')](handleError(_0x5baa90,null));};exports[_0x4ba1('0x57')]=function(_0x45529b,_0x5a669b){var _0x37d143={'raw':![],'where':{'id':_0x45529b['params']['id']},'include':[{'model':db['Pause'],'as':_0x4ba1('0x3b')}]},_0x4b66b0={};_0x4b66b0[_0x4ba1('0x41')]=_[_0x4ba1('0x42')](db[_0x4ba1('0x3d')][_0x4ba1('0x58')]);_0x4b66b0['query']=_[_0x4ba1('0x42')](_0x45529b[_0x4ba1('0x43')]);_0x4b66b0['filters']=_['intersection'](_0x4b66b0[_0x4ba1('0x41')],_0x4b66b0[_0x4ba1('0x43')]);_0x37d143['attributes']=_['intersection'](_0x4b66b0[_0x4ba1('0x41')],qs[_0x4ba1('0x46')](_0x45529b['query'][_0x4ba1('0x46')]));_0x37d143[_0x4ba1('0x47')]=_0x37d143[_0x4ba1('0x47')][_0x4ba1('0x59')]?_0x37d143[_0x4ba1('0x47')]:_0x4b66b0[_0x4ba1('0x41')];if(_0x45529b[_0x4ba1('0x43')]['includeAll']){_0x37d143[_0x4ba1('0x54')]=[{'all':!![]}];}_0x37d143=_[_0x4ba1('0x4f')]({},_0x37d143,_0x45529b[_0x4ba1('0x52')]);return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')](_0x37d143)['then'](handleEntityNotFound(_0x5a669b,null))[_0x4ba1('0x1d')](respondWithResult(_0x5a669b,null))[_0x4ba1('0x27')](handleError(_0x5a669b,null));};exports[_0x4ba1('0x5b')]=function(_0x46d5c7,_0x14f300){return db[_0x4ba1('0x3d')][_0x4ba1('0x5b')](_0x46d5c7[_0x4ba1('0x5c')],{})[_0x4ba1('0x1d')](function(_0x4456f6){var _0x3d22bb=_0x46d5c7[_0x4ba1('0x5d')][_0x4ba1('0x33')]({'plain':!![]});if(!_0x3d22bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d22bb['role']===_0x4ba1('0x5d')){var _0xf492fa=_0x4456f6['get']({'plain':!![]});var _0x31b7c1='SmsAccounts';return db[_0x4ba1('0x5e')]['find']({'where':{'name':_0x31b7c1,'userProfileId':_0x3d22bb[_0x4ba1('0x5f')]},'raw':!![]})[_0x4ba1('0x1d')](function(_0x3ed69f){if(_0x3ed69f&&_0x3ed69f[_0x4ba1('0x60')]===0x0){return db['UserProfileResource'][_0x4ba1('0x5b')]({'name':_0xf492fa['name'],'resourceId':_0xf492fa['id'],'type':_0x3ed69f[_0x4ba1('0x50')],'sectionId':_0x3ed69f['id']},{})[_0x4ba1('0x1d')](function(){return _0x4456f6;});}else{return _0x4456f6;}})[_0x4ba1('0x27')](function(_0x2147a5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2147a5);throw _0x2147a5;});}return _0x4456f6;})[_0x4ba1('0x1d')](respondWithResult(_0x14f300,0xc9))['catch'](handleError(_0x14f300,null));};exports[_0x4ba1('0x61')]=function(_0x3c0991,_0x27cea4){if(_0x3c0991['body']['id']){delete _0x3c0991[_0x4ba1('0x5c')]['id'];}return db['SmsAccount'][_0x4ba1('0x5a')]({'where':{'id':_0x3c0991[_0x4ba1('0x62')]['id']},'include':[{'model':db[_0x4ba1('0x3a')],'as':_0x4ba1('0x3b')}]})[_0x4ba1('0x1d')](handleEntityNotFound(_0x27cea4,null))[_0x4ba1('0x1d')](saveUpdates(_0x3c0991['body'],null))['then'](respondWithResult(_0x27cea4,null))[_0x4ba1('0x27')](handleError(_0x27cea4,null));};exports[_0x4ba1('0x32')]=function(_0x71ac8f,_0x2f2093){return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x71ac8f[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x2f2093,null))[_0x4ba1('0x1d')](removeEntity(_0x2f2093,null))['catch'](handleError(_0x2f2093,null));};exports['describe']=function(_0x5aee21,_0x52baae){return db['SmsAccount'][_0x4ba1('0x63')]()[_0x4ba1('0x1d')](respondWithResult(_0x52baae,null))[_0x4ba1('0x27')](handleError(_0x52baae,null));};exports[_0x4ba1('0x64')]=function(_0x3a2fbf,_0x4ed93e,_0x32514e){if(_0x3a2fbf[_0x4ba1('0x5c')]['id']){delete _0x3a2fbf[_0x4ba1('0x5c')]['id'];}return db['SmsAccount'][_0x4ba1('0x5a')]({'where':{'id':_0x3a2fbf[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x4ed93e,null))[_0x4ba1('0x1d')](function(_0x56721a){if(_0x56721a){_0x3a2fbf[_0x4ba1('0x5c')][_0x4ba1('0x65')]=_0x56721a['id'];return db['Disposition'][_0x4ba1('0x5b')](_0x3a2fbf[_0x4ba1('0x5c')]);}})[_0x4ba1('0x1d')](respondWithResult(_0x4ed93e,null))['catch'](handleError(_0x4ed93e,null));};exports[_0x4ba1('0x66')]=function(_0x168cd9,_0x38cb9d,_0x1960b5){var _0xb0b248={'raw':![],'where':{}};var _0x5def4f={};var _0x5e874b={'count':0x0,'rows':[]};return db[_0x4ba1('0x3d')][_0x4ba1('0x67')]({'where':{'id':_0x168cd9[_0x4ba1('0x62')]['id']}})['then'](handleEntityNotFound(_0x38cb9d,null))['then'](function(_0x4bf1a3){if(_0x4bf1a3){_0x5def4f['model']=_['keys'](db[_0x4ba1('0x68')][_0x4ba1('0x58')]);_0x5def4f[_0x4ba1('0x43')]=_['keys'](_0x168cd9[_0x4ba1('0x43')]);_0x5def4f[_0x4ba1('0x44')]=_['intersection'](_0x5def4f[_0x4ba1('0x41')],_0x5def4f[_0x4ba1('0x43')]);_0xb0b248[_0x4ba1('0x47')]=_[_0x4ba1('0x45')](_0x5def4f['model'],qs[_0x4ba1('0x46')](_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x46')]));_0xb0b248['attributes']=_0xb0b248[_0x4ba1('0x47')][_0x4ba1('0x59')]?_0xb0b248[_0x4ba1('0x47')]:_0x5def4f[_0x4ba1('0x41')];if(!_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x48')](_0x4ba1('0x49'))){_0xb0b248[_0x4ba1('0x4a')]=qs['limit'](_0x168cd9['query'][_0x4ba1('0x4a')]);_0xb0b248[_0x4ba1('0x2d')]=qs[_0x4ba1('0x2d')](_0x168cd9[_0x4ba1('0x43')]['offset']);}_0xb0b248['order']=qs[_0x4ba1('0x4c')](_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x4c')]);_0xb0b248[_0x4ba1('0x4e')]=qs[_0x4ba1('0x44')](_[_0x4ba1('0x4d')](_0x168cd9['query'],_0x5def4f[_0x4ba1('0x44')]));_0xb0b248['where'][_0x4ba1('0x65')]=_0x4bf1a3['id'];if(_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x51')]){_0xb0b248[_0x4ba1('0x4e')]=_[_0x4ba1('0x4f')](_0xb0b248[_0x4ba1('0x4e')],{'$or':_[_0x4ba1('0x3c')](_0xb0b248['attributes'],function(_0x1cc45d){var _0x12cbc5={};_0x12cbc5[_0x1cc45d]={'$like':'%'+_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x51')]+'%'};return _0x12cbc5;})});}_0xb0b248=_[_0x4ba1('0x4f')]({},_0xb0b248,_0x168cd9[_0x4ba1('0x52')]);return db['Disposition'][_0x4ba1('0x2c')]({'where':_0xb0b248[_0x4ba1('0x4e')]})['then'](function(_0x7455a4){_0x5e874b[_0x4ba1('0x2c')]=_0x7455a4;if(_0x168cd9[_0x4ba1('0x43')][_0x4ba1('0x53')]){_0xb0b248['include']=[{'all':!![]}];}return db['Disposition'][_0x4ba1('0x55')](_0xb0b248);})[_0x4ba1('0x1d')](function(_0x2eb373){_0x5e874b[_0x4ba1('0x56')]=_0x2eb373;return _0x5e874b;});}})[_0x4ba1('0x1d')](respondWithFilteredResult(_0x38cb9d,_0xb0b248))[_0x4ba1('0x27')](handleError(_0x38cb9d,null));};exports[_0x4ba1('0x69')]=function(_0x518750,_0x281034,_0x1b04c6){return db['SmsAccount'][_0x4ba1('0x5a')]({'where':{'id':_0x518750[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x281034,null))[_0x4ba1('0x1d')](function(_0x42cbdf){if(_0x42cbdf){return _0x42cbdf[_0x4ba1('0x69')](_0x518750[_0x4ba1('0x43')][_0x4ba1('0x6a')]);}})[_0x4ba1('0x1d')](respondWithStatusCode(_0x281034,null))[_0x4ba1('0x27')](handleError(_0x281034,null));};exports[_0x4ba1('0x6b')]=function(_0x592ce2,_0x228a89,_0x4f8ac1){if(_0x592ce2[_0x4ba1('0x5c')]['id']){delete _0x592ce2[_0x4ba1('0x5c')]['id'];}return db[_0x4ba1('0x3d')]['find']({'where':{'id':_0x592ce2[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x228a89,null))[_0x4ba1('0x1d')](function(_0x552190){if(_0x552190){_0x592ce2['body'][_0x4ba1('0x65')]=_0x552190['id'];return db[_0x4ba1('0x6c')][_0x4ba1('0x5b')](_0x592ce2[_0x4ba1('0x5c')]);}})['then'](respondWithResult(_0x228a89,null))[_0x4ba1('0x27')](handleError(_0x228a89,null));};exports[_0x4ba1('0x6d')]=function(_0x138b24,_0x1a6c25,_0x935445){var _0xe9903b={'raw':![],'where':{}};var _0x2a8596={};var _0x3e2c36={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4ba1('0x67')]({'where':{'id':_0x138b24[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x1a6c25,null))[_0x4ba1('0x1d')](function(_0x3d8cc7){if(_0x3d8cc7){_0x2a8596[_0x4ba1('0x41')]=_[_0x4ba1('0x42')](db['CannedAnswer'][_0x4ba1('0x58')]);_0x2a8596[_0x4ba1('0x43')]=_[_0x4ba1('0x42')](_0x138b24[_0x4ba1('0x43')]);_0x2a8596['filters']=_['intersection'](_0x2a8596[_0x4ba1('0x41')],_0x2a8596[_0x4ba1('0x43')]);_0xe9903b[_0x4ba1('0x47')]=_[_0x4ba1('0x45')](_0x2a8596[_0x4ba1('0x41')],qs[_0x4ba1('0x46')](_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x46')]));_0xe9903b[_0x4ba1('0x47')]=_0xe9903b[_0x4ba1('0x47')]['length']?_0xe9903b[_0x4ba1('0x47')]:_0x2a8596[_0x4ba1('0x41')];if(!_0x138b24[_0x4ba1('0x43')]['hasOwnProperty'](_0x4ba1('0x49'))){_0xe9903b[_0x4ba1('0x4a')]=qs[_0x4ba1('0x4a')](_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x4a')]);_0xe9903b[_0x4ba1('0x2d')]=qs[_0x4ba1('0x2d')](_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x2d')]);}_0xe9903b[_0x4ba1('0x4b')]=qs[_0x4ba1('0x4c')](_0x138b24[_0x4ba1('0x43')]['sort']);_0xe9903b[_0x4ba1('0x4e')]=qs[_0x4ba1('0x44')](_['pick'](_0x138b24['query'],_0x2a8596['filters']));_0xe9903b[_0x4ba1('0x4e')]['SmsAccountId']=_0x3d8cc7['id'];if(_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x51')]){_0xe9903b['where']=_['merge'](_0xe9903b[_0x4ba1('0x4e')],{'$or':_[_0x4ba1('0x3c')](_0xe9903b[_0x4ba1('0x47')],function(_0x3cb3ed){var _0x229084={};_0x229084[_0x3cb3ed]={'$like':'%'+_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x51')]+'%'};return _0x229084;})});}_0xe9903b=_[_0x4ba1('0x4f')]({},_0xe9903b,_0x138b24['options']);return db[_0x4ba1('0x6c')][_0x4ba1('0x2c')]({'where':_0xe9903b['where']})[_0x4ba1('0x1d')](function(_0x118cd6){_0x3e2c36[_0x4ba1('0x2c')]=_0x118cd6;if(_0x138b24[_0x4ba1('0x43')][_0x4ba1('0x53')]){_0xe9903b[_0x4ba1('0x54')]=[{'all':!![]}];}return db[_0x4ba1('0x6c')][_0x4ba1('0x55')](_0xe9903b);})['then'](function(_0xf492ee){_0x3e2c36[_0x4ba1('0x56')]=_0xf492ee;return _0x3e2c36;});}})['then'](respondWithFilteredResult(_0x1a6c25,_0xe9903b))['catch'](handleError(_0x1a6c25,null));};exports[_0x4ba1('0x6e')]=function(_0x19203f,_0x4af857,_0x4196e6){return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x19203f[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x4af857,null))[_0x4ba1('0x1d')](function(_0xb59ef3){if(_0xb59ef3){return _0xb59ef3[_0x4ba1('0x6e')](_0x19203f[_0x4ba1('0x43')][_0x4ba1('0x6a')]);}})[_0x4ba1('0x1d')](respondWithStatusCode(_0x4af857,null))[_0x4ba1('0x27')](handleError(_0x4af857,null));};exports[_0x4ba1('0x6f')]=function(_0x3070db,_0x574d26,_0x32bddb){var _0x1d5e9b={'channel':_0x4ba1('0x70')};var _0x2bebfd=[];var _0x506b30=[];var _0x2a7765={};return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x3070db[_0x4ba1('0x62')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x4ba1('0x71')}]})[_0x4ba1('0x1d')](handleEntityNotFound(_0x574d26,null))['then'](function(_0xee453a){_0x1d5e9b['account']=_0xee453a;_0x1d5e9b[_0x4ba1('0x72')]=_['orderBy'](_0xee453a[_0x4ba1('0x71')],[_0x4ba1('0x73')],[_0x4ba1('0x74')]);if(_0x1d5e9b[_0x4ba1('0x75')][_0x4ba1('0x71')]){delete _0x1d5e9b[_0x4ba1('0x75')][_0x4ba1('0x71')];}return db['CmContact'][_0x4ba1('0x63')]();})['then'](function(_0x2d8d2b){if(!_0x2d8d2b){throw new db[(_0x4ba1('0x76'))][(_0x4ba1('0x77'))]('no\x20available\x20attributes');}_0x2bebfd=_[_0x4ba1('0x78')](_[_0x4ba1('0x42')](_0x2d8d2b),[_0x4ba1('0x79'),_0x4ba1('0x7a')]);_0x506b30=_[_0x4ba1('0x78')](_[_0x4ba1('0x42')](_0x2d8d2b),['createdAt','updatedAt',_0x4ba1('0x7b'),_0x4ba1('0x7c')]);_0x1d5e9b[_0x4ba1('0x5c')]={'mapKey':_0x4ba1('0x7d')};if(_0x1d5e9b[_0x4ba1('0x75')]['type']){switch(_0x1d5e9b[_0x4ba1('0x75')]['type']){case _0x4ba1('0x7e'):_0x1d5e9b['body']['from']=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x7f')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db['body'][_0x4ba1('0x80')];_0x1d5e9b['body'][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')]['MessageSid'];break;case'skebby':_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')]='+'+_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x83')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x84')];break;case'connectel':_0x1d5e9b['body']['from']=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x82')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')]['message'];break;case _0x4ba1('0x85'):_0x1d5e9b[_0x4ba1('0x5c')]['from']=_0x3070db['body'][_0x4ba1('0x82')];_0x1d5e9b['body']['body']=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x5c')];_0x1d5e9b[_0x4ba1('0x5c')]['messageId']=_0x3070db[_0x4ba1('0x5c')]['message_id'];break;case _0x4ba1('0x86'):_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x7f')];_0x1d5e9b['body'][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x87')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x88')];break;case _0x4ba1('0x89'):_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')]='+'+_0x3070db[_0x4ba1('0x5c')]['results'][0x0][_0x4ba1('0x82')];_0x1d5e9b[_0x4ba1('0x5c')]['body']=_0x3070db['body'][_0x4ba1('0x8a')][0x0][_0x4ba1('0x84')];_0x1d5e9b['body'][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')]['results'][0x0]['messageId'];break;case _0x4ba1('0x8b'):_0x1d5e9b['body'][_0x4ba1('0x82')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x8c')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db['body'][_0x4ba1('0x8d')][_0x4ba1('0x25')];break;case _0x4ba1('0x8e'):_0x1d5e9b['body'][_0x4ba1('0x82')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x8f')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x84')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x90')];break;case _0x4ba1('0x91'):_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')][0x0]['message']['id'];_0x1d5e9b['body'][_0x4ba1('0x82')]=_0x3070db[_0x4ba1('0x5c')][0x0][_0x4ba1('0x25')][_0x4ba1('0x82')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')][0x0][_0x4ba1('0x25')][_0x4ba1('0x84')];break;case _0x4ba1('0x92'):_0x1d5e9b[_0x4ba1('0x5c')]['from']=_0x3070db['body'][_0x4ba1('0x82')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x25')];_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x81')]=_0x3070db[_0x4ba1('0x5c')][_0x4ba1('0x93')];break;}}if(_0x1d5e9b[_0x4ba1('0x5c')]['id']){delete _0x1d5e9b[_0x4ba1('0x5c')]['id'];}if(_['isNil'](_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')])){throw new db['Sequelize'][(_0x4ba1('0x77'))](_0x4ba1('0x94'));}if(_[_0x4ba1('0x95')](_0x1d5e9b['body'][_0x4ba1('0x5c')])||_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x5c')]===''){throw new db[(_0x4ba1('0x76'))][(_0x4ba1('0x77'))](_0x4ba1('0x96'));}if(_[_0x4ba1('0x95')](_0x1d5e9b[_0x4ba1('0x5c')]['mapKey'])){throw new db[(_0x4ba1('0x76'))][(_0x4ba1('0x77'))](_0x4ba1('0x97')+_0x506b30);}if(!_['includes'](_0x506b30,_0x1d5e9b[_0x4ba1('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x4ba1('0x77'))](_0x4ba1('0x98')+_0x506b30);}_0x2a7765[_0x1d5e9b['body'][_0x4ba1('0x99')]]=_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')];return db[_0x4ba1('0x9a')][_0x4ba1('0x5a')]({'where':{'id':_0x1d5e9b['account'][_0x4ba1('0x7c')]},'include':[{'model':db[_0x4ba1('0x9b')],'as':_0x4ba1('0x9c'),'where':_0x2a7765,'limit':0x1,'order':[['updatedAt',_0x4ba1('0x9d')]]}]});})[_0x4ba1('0x1d')](handleEntityNotFound(_0x574d26,null))[_0x4ba1('0x1d')](function(_0x690b3e){if(_0x690b3e){_0x1d5e9b[_0x4ba1('0x9e')]=_['omit'](_0x690b3e,[_0x4ba1('0x9c')]);if(_0x690b3e[_0x4ba1('0x9c')][_0x4ba1('0x59')]){return _0x690b3e['Contacts'][0x0];}var _0x186429=_[_0x4ba1('0x9f')](_0x1d5e9b['body'],{'firstName':_0x1d5e9b['body'][_0x4ba1('0x82')],'ListId':_0x690b3e['id']});_0x186429[_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x99')]]=_0x1d5e9b['body'][_0x4ba1('0x82')];return db['CmContact']['create'](_0x186429,{'fields':_0x2bebfd,'raw':!![]});}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x574d26,null))[_0x4ba1('0x1d')](function(_0x5f20e2){if(_0x5f20e2){_0x1d5e9b[_0x4ba1('0xa0')]=_0x5f20e2;var _0x3994df={'ContactId':_0x5f20e2['id'],'phone':_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')],'SmsAccountId':_0x3070db[_0x4ba1('0x62')]['id']};var _0x468549={'ContactId':_0x5f20e2['id'],'SmsAccountId':_0x3070db[_0x4ba1('0x62')]['id'],'closed':![]};return db['SmsInteraction'][_0x4ba1('0x5a')]({'where':_0x468549})[_0x4ba1('0x1d')](function(_0x37bb9c){if(_0x37bb9c){return[_0x37bb9c,![]];}return db[_0x4ba1('0xa1')][_0x4ba1('0x5b')](_0x3994df)[_0x4ba1('0x1d')](function(_0x54ba9d){return[_0x54ba9d,!![]];});});}})['spread'](function(_0xe91057,_0x58def8){_0x1d5e9b[_0x4ba1('0xa2')]=_0xe91057['get']({'plain':!![]});_0x1d5e9b['interaction'][_0x4ba1('0xa3')]=![];if(_0x58def8){if(_0x1d5e9b[_0x4ba1('0x75')][_0x4ba1('0xa4')]){_0x1d5e9b[_0x4ba1('0x72')]['push']({'id':0x0,'priority':_0x1d5e9b[_0x4ba1('0x72')][_0x4ba1('0x59')]+0x1,'app':_0x4ba1('0xa5'),'appdata':_0x4ba1('0xa6'),'interval':_0x4ba1('0xa7')});}_0x1d5e9b[_0x4ba1('0xa2')]['created']=!![];}return db[_0x4ba1('0xa8')]['create']({'phone':_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x82')],'messageId':_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0x81')],'body':_0x1d5e9b['body'][_0x4ba1('0x5c')],'SmsAccountId':_0x3070db[_0x4ba1('0x62')]['id'],'SmsInteractionId':_0xe91057['id'],'direction':'in','ContactId':_0xe91057[_0x4ba1('0xa9')],'AttachmentId':_0x1d5e9b[_0x4ba1('0x5c')][_0x4ba1('0xaa')]});})['then'](function(_0x1f08fc){_0x1d5e9b[_0x4ba1('0x25')]=_0x1f08fc;if(_0x1d5e9b['interaction'][_0x4ba1('0xab')]){return db[_0x4ba1('0xac')][_0x4ba1('0x5a')]({'attributes':['id',_0x4ba1('0x50')],'where':{'id':_0x1d5e9b[_0x4ba1('0xa2')]['UserId']}})[_0x4ba1('0x1d')](function(_0x4e3ffb){if(_0x4e3ffb){_0x1d5e9b[_0x4ba1('0x72')][_0x4ba1('0xad')]({'id':0x0,'priority':0x0,'app':_0x4ba1('0xae'),'appdata':_0x4e3ffb[_0x4ba1('0x50')]+','+(_0x1d5e9b[_0x4ba1('0x75')][_0x4ba1('0xaf')]||0xa),'interval':_0x4ba1('0xa7')});}return respondWithRpcPromise(_0x4ba1('0xb0'),_0x4ba1('0xb1'),_0x1d5e9b);});}return respondWithRpcPromise('Start','startRouting',_0x1d5e9b);})[_0x4ba1('0x1d')](function(_0x418990){if(_0x418990){var _0x3ac59a=0xc8;var _0x16a7e7=_0x4ba1('0xb2');logger[_0x4ba1('0x1e')](_0x4ba1('0x22'),_0x16a7e7,_0x3ac59a,_0x4ba1('0xb3'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x16a7e7,_0x3ac59a,_0x4ba1('0xb3'),JSON['stringify'](_0x418990));if(_0x1d5e9b[_0x4ba1('0x75')][_0x4ba1('0x3f')]==='twilio'){return _0x574d26[_0x4ba1('0x29')](_0x3ac59a)['set']('Content-Type',_0x4ba1('0xb4'))['send'](_0x4ba1('0xb5'));}else{return _0x574d26[_0x4ba1('0x29')](_0x3ac59a)[_0x4ba1('0x2a')](_0x418990);}}})['catch'](handleError(_0x574d26,null));};exports[_0x4ba1('0xb6')]=function(_0x20e7c1,_0x8f084b){var _0x4e07d8=_0x20e7c1[_0x4ba1('0x62')]['id'];var _0x377cd6=_0x20e7c1[_0x4ba1('0x5c')];var _0x2f65e8=0xc8;var _0x17183b=null;return db[_0x4ba1('0xb7')][_0x4ba1('0xb8')]({'isolationLevel':db[_0x4ba1('0xb7')]['Transaction'][_0x4ba1('0xb9')]['READ_COMMITTED']},function(_0x823297){return db[_0x4ba1('0x3d')][_0x4ba1('0x67')]({'where':{'id':_0x4e07d8},'transaction':_0x823297})[_0x4ba1('0x1d')](function(_0x401a97){if(_0x401a97){return db['SmsApplication'][_0x4ba1('0x32')]({'where':{'SmsAccountId':_0x4e07d8},'transaction':_0x823297})[_0x4ba1('0x1d')](function(){var _0x3ee539=_[_0x4ba1('0x3c')](_0x377cd6,function(_0x297ec8){_0x297ec8['SmsAccountId']=_0x4e07d8;return _0x297ec8;});return db[_0x4ba1('0xba')][_0x4ba1('0xbb')](_0x3ee539,{'transaction':_0x823297});});}else{_0x2f65e8=0x194;_0x17183b=[];}});})[_0x4ba1('0x1d')](function(){if(_0x2f65e8!==0x194){return db[_0x4ba1('0xba')][_0x4ba1('0xbc')]({'where':{'SmsAccountId':_0x4e07d8},'order':'priority'})[_0x4ba1('0x1d')](function(_0x42fc48){_0x17183b=_0x42fc48;});}})[_0x4ba1('0x27')](function(_0x5b0dd4){_0x2f65e8=0x1f4;logger[_0x4ba1('0x24')](_0x5b0dd4[_0x4ba1('0x37')]);if(_0x5b0dd4[_0x4ba1('0x50')]){delete _0x5b0dd4['name'];}_0x17183b=_0x5b0dd4;})['finally'](function(){if(_0x17183b===null){_0x8f084b[_0x4ba1('0x28')](_0x2f65e8);}else{if(_0x2f65e8===0x1f4){_0x8f084b[_0x4ba1('0x29')](_0x2f65e8)[_0x4ba1('0x38')](_0x17183b);}else{_0x8f084b[_0x4ba1('0x29')](_0x2f65e8)['json'](_0x17183b);}}});};exports[_0x4ba1('0xbd')]=function(_0x2f3b3e,_0x2e932c,_0x4f5c0e){var _0x3d2bb0={};var _0x1a2d56={};var _0x823526;var _0x36b197;return db[_0x4ba1('0x3d')][_0x4ba1('0x67')]({'where':{'id':_0x2f3b3e[_0x4ba1('0x62')]['id']}})['then'](handleEntityNotFound(_0x2e932c,null))['then'](function(_0x136bf7){if(_0x136bf7){_0x823526=_0x136bf7;_0x1a2d56[_0x4ba1('0x41')]=_[_0x4ba1('0x42')](db[_0x4ba1('0xba')][_0x4ba1('0x58')]);_0x1a2d56[_0x4ba1('0x43')]=_['keys'](_0x2f3b3e[_0x4ba1('0x43')]);_0x1a2d56['filters']=_[_0x4ba1('0x45')](_0x1a2d56[_0x4ba1('0x41')],_0x1a2d56[_0x4ba1('0x43')]);_0x3d2bb0[_0x4ba1('0x47')]=_[_0x4ba1('0x45')](_0x1a2d56[_0x4ba1('0x41')],qs[_0x4ba1('0x46')](_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x46')]));_0x3d2bb0[_0x4ba1('0x47')]=_0x3d2bb0[_0x4ba1('0x47')]['length']?_0x3d2bb0[_0x4ba1('0x47')]:_0x1a2d56['model'];_0x3d2bb0[_0x4ba1('0x4b')]=qs[_0x4ba1('0x4c')](_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x4c')]);_0x3d2bb0['where']=qs['filters'](_['pick'](_0x2f3b3e[_0x4ba1('0x43')],_0x1a2d56['filters']));if(_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x51')]){_0x3d2bb0[_0x4ba1('0x4e')]=_['merge'](_0x3d2bb0['where'],{'$or':_[_0x4ba1('0x3c')](_0x3d2bb0[_0x4ba1('0x47')],function(_0x348fc2){var _0x40925b={};_0x40925b[_0x348fc2]={'$like':'%'+_0x2f3b3e[_0x4ba1('0x43')]['filter']+'%'};return _0x40925b;})});}_0x3d2bb0=_['merge']({},_0x3d2bb0,_0x2f3b3e[_0x4ba1('0x52')]);return _0x823526[_0x4ba1('0xbd')](_0x3d2bb0);}})[_0x4ba1('0x1d')](function(_0x546026){if(_0x546026){_0x36b197=_0x546026[_0x4ba1('0x59')];if(!_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x48')]('nolimit')){_0x3d2bb0[_0x4ba1('0x4a')]=qs[_0x4ba1('0x4a')](_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x4a')]);_0x3d2bb0[_0x4ba1('0x2d')]=qs[_0x4ba1('0x2d')](_0x2f3b3e[_0x4ba1('0x43')][_0x4ba1('0x2d')]);}return _0x823526[_0x4ba1('0xbd')](_0x3d2bb0);}})[_0x4ba1('0x1d')](function(_0x191a7c){if(_0x191a7c){return _0x191a7c?{'count':_0x36b197,'rows':_0x191a7c}:null;}})[_0x4ba1('0x1d')](respondWithResult(_0x2e932c,null))['catch'](handleError(_0x2e932c,null));};exports[_0x4ba1('0xbe')]=function(_0x7952df,_0x334f15,_0x20ccf3){var _0xd3d14c={'raw':![],'where':{}};var _0x2101e9={};var _0x2ff9={'count':0x0,'rows':[]};return db[_0x4ba1('0x3d')][_0x4ba1('0x67')]({'where':{'id':_0x7952df[_0x4ba1('0x62')]['id']}})['then'](handleEntityNotFound(_0x334f15,null))['then'](function(_0x474dc6){if(_0x474dc6){_0x2101e9[_0x4ba1('0x41')]=_[_0x4ba1('0x42')](db[_0x4ba1('0xa1')]['rawAttributes']);_0x2101e9['query']=_[_0x4ba1('0x42')](_0x7952df[_0x4ba1('0x43')]);_0x2101e9[_0x4ba1('0x44')]=_[_0x4ba1('0x45')](_0x2101e9[_0x4ba1('0x41')],_0x2101e9['query']);_0xd3d14c[_0x4ba1('0x47')]=_['intersection'](_0x2101e9[_0x4ba1('0x41')],qs[_0x4ba1('0x46')](_0x7952df['query'][_0x4ba1('0x46')]));_0xd3d14c[_0x4ba1('0x47')]=_0xd3d14c[_0x4ba1('0x47')][_0x4ba1('0x59')]?_0xd3d14c[_0x4ba1('0x47')]:_0x2101e9[_0x4ba1('0x41')];if(!_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x48')](_0x4ba1('0x49'))){_0xd3d14c[_0x4ba1('0x4a')]=qs[_0x4ba1('0x4a')](_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x4a')]);_0xd3d14c['offset']=qs[_0x4ba1('0x2d')](_0x7952df[_0x4ba1('0x43')]['offset']);}_0xd3d14c[_0x4ba1('0x4b')]=qs['sort'](_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x4c')]);_0xd3d14c['where']=qs['filters'](_[_0x4ba1('0x4d')](_0x7952df['query'],_0x2101e9[_0x4ba1('0x44')]));_0xd3d14c['where'][_0x4ba1('0x65')]=_0x474dc6['id'];if(_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x51')]){_0xd3d14c[_0x4ba1('0x4e')]=_[_0x4ba1('0x4f')](_0xd3d14c['where'],{'$or':_['map'](_0xd3d14c[_0x4ba1('0x47')],function(_0x3e746f){var _0x221ab7={};_0x221ab7[_0x3e746f]={'$like':'%'+_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x51')]+'%'};return _0x221ab7;})});}_0xd3d14c=_[_0x4ba1('0x4f')]({},_0xd3d14c,_0x7952df[_0x4ba1('0x52')]);return db[_0x4ba1('0xa1')]['count']({'where':_0xd3d14c['where']})[_0x4ba1('0x1d')](function(_0x1c6c07){_0x2ff9[_0x4ba1('0x2c')]=_0x1c6c07;if(_0x7952df[_0x4ba1('0x43')][_0x4ba1('0x53')]){_0xd3d14c['include']=[{'model':db[_0x4ba1('0x9b')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4ba1('0x50'),_0x4ba1('0xbf'),_0x4ba1('0xc0')],'required':![]},{'model':db[_0x4ba1('0xc1')],'as':_0x4ba1('0xc2'),'attributes':['id','name',_0x4ba1('0xc3')],'where':_0x7952df[_0x4ba1('0x43')][_0x4ba1('0xc4')]?{'id':_0x7952df[_0x4ba1('0x43')][_0x4ba1('0xc4')]}:undefined,'required':_0x7952df['query'][_0x4ba1('0xc4')]?!![]:![]}];}return db[_0x4ba1('0xa1')][_0x4ba1('0x55')](_0xd3d14c);})[_0x4ba1('0x1d')](function(_0x2ad45f){_0x2ff9['rows']=_0x2ad45f;return _0x2ff9;});}})['then'](respondWithFilteredResult(_0x334f15,_0xd3d14c))['catch'](handleError(_0x334f15,null));};exports[_0x4ba1('0x38')]=function(_0x242f41,_0x512b46,_0x1592ea){var _0x71066c,_0x520313,_0x14e684;if(_[_0x4ba1('0x95')](_0x242f41[_0x4ba1('0x5c')][_0x4ba1('0x5c')])||_0x242f41[_0x4ba1('0x5c')]['body']===''){throw new db[(_0x4ba1('0x76'))][(_0x4ba1('0x77'))](_0x4ba1('0x96'));}if(_[_0x4ba1('0x95')](_0x242f41['body']['to'])){throw new db[(_0x4ba1('0x76'))]['ValidationError'](_0x4ba1('0xc5'));}_0x71066c=_0x242f41[_0x4ba1('0x5c')]['to'];return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x242f41[_0x4ba1('0x62')]['id']},'include':[{'model':db[_0x4ba1('0x9a')],'as':'List','include':[{'model':db[_0x4ba1('0x9b')],'as':_0x4ba1('0x9c'),'where':{'mobile':_0x71066c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x4ba1('0x1d')](handleEntityNotFound(_0x512b46,null))[_0x4ba1('0x1d')](function(_0x54521b){if(_0x54521b&&_0x54521b[_0x4ba1('0xc6')]){_0x520313=_0x54521b[_0x4ba1('0x33')]({'plain':!![]});if(_0x520313['List']&&_0x520313['List'][_0x4ba1('0x9c')][_0x4ba1('0x59')]){return _0x520313['List'][_0x4ba1('0x9c')][0x0];}return db[_0x4ba1('0x9b')][_0x4ba1('0x5b')](_[_0x4ba1('0x9f')](_0x242f41['body'],{'firstName':_0x71066c,'mobile':_0x71066c,'phone':_0x71066c,'ListId':_0x520313[_0x4ba1('0x7c')]}));}})['then'](handleEntityNotFound(_0x512b46,null))[_0x4ba1('0x1d')](function(_0x26487a){if(_0x26487a){_0x14e684=_0x26487a;return db[_0x4ba1('0xa1')][_0x4ba1('0x5a')]({'where':{'ContactId':_0x14e684['id'],'closed':![],'SmsAccountId':_0x520313['id']}})[_0x4ba1('0x1d')](function(_0x15e818){if(_0x15e818){return[_0x15e818,![]];}return db['SmsInteraction'][_0x4ba1('0x5b')]({'UserId':_0x242f41[_0x4ba1('0x5d')]['id'],'ContactId':_0x14e684['id'],'SmsAccountId':_0x520313['id'],'phone':_0x71066c,'firstMsgDirection':_0x4ba1('0xc7'),'Messages':[_[_0x4ba1('0x4f')](_0x242f41[_0x4ba1('0x5c')],{'read':![],'body':_0x242f41[_0x4ba1('0x5c')][_0x4ba1('0x5c')],'phone':_0x71066c,'SmsAccountId':_0x520313['id'],'UserId':_0x242f41[_0x4ba1('0x5d')]['id'],'ContactId':_0x14e684['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x4ba1('0xc8')}]})[_0x4ba1('0x1d')](function(_0x8a9697){return[_0x8a9697,!![]];});});}})[_0x4ba1('0xc9')](function(_0x5052dc,_0x54a105){if(_0x54a105){return _0x5052dc;}return db['SmsMessage'][_0x4ba1('0x5b')](_[_0x4ba1('0x4f')](_0x242f41['body'],{'read':![],'body':_0x242f41[_0x4ba1('0x5c')][_0x4ba1('0x5c')],'phone':_0x71066c,'SmsAccountId':_0x520313['id'],'SmsInteractionId':_0x5052dc['id'],'UserId':_0x242f41['user']['id'],'ContactId':_0x14e684['id']}))[_0x4ba1('0x1d')](function(_0x374746){_0x5052dc[_0x4ba1('0xca')]['Messages']=[];_0x5052dc[_0x4ba1('0xca')][_0x4ba1('0xc8')][_0x4ba1('0xcb')](_0x374746[_0x4ba1('0xca')]);return _0x5052dc;});})['then'](respondWithResult(_0x512b46,null))[_0x4ba1('0x27')](handleError(_0x512b46,null));};exports[_0x4ba1('0x29')]=function(_0x10ff35,_0x3ebd86,_0x1f4e6b){if(_0x10ff35[_0x4ba1('0x5c')]['id']){delete _0x10ff35[_0x4ba1('0x5c')]['id'];}var _0x4e1b3c,_0x13e49d,_0x56dfcf;return db[_0x4ba1('0x3d')]['find']({'where':{'id':_0x10ff35[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x3ebd86,null))[_0x4ba1('0x1d')](function(_0x1087df){if(_0x1087df){_0x56dfcf=_0x1087df;logger[_0x4ba1('0x21')](_0x4ba1('0x22'),'status',_0x4ba1('0xcc'),_0x1087df['type'],util['inspect'](_0x10ff35['body'],{'showHidden':![],'depth':null}));switch(_0x1087df[_0x4ba1('0x3f')]){case'skebby':if(_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0xcd')]&&_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0x29')]){_0x13e49d=_0x10ff35['body'][_0x4ba1('0x29')];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0xcd')]}});}break;case'connectel':if(_0x10ff35['body'][_0x4ba1('0xce')]&&_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0xcf')]){_0x13e49d=_0x10ff35[_0x4ba1('0x5c')]['statusInt'];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x10ff35['body'][_0x4ba1('0xce')]}});}break;case _0x4ba1('0x85'):if(_0x10ff35[_0x4ba1('0x5c')]['message_id']&&_0x10ff35['body'][_0x4ba1('0xd0')]){_0x13e49d=_0x10ff35[_0x4ba1('0x5c')]['status_code'];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x10ff35[_0x4ba1('0x5c')]['message_id']}});}break;case _0x4ba1('0x89'):var _0x220174=_0x10ff35['body']['results'][0x0];if(_0x220174[_0x4ba1('0x81')]&&_0x220174[_0x4ba1('0x29')]['groupName']==='DELIVERED'){_0x13e49d=_0x220174['status'][_0x4ba1('0xd1')];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x220174[_0x4ba1('0x81')]}});}break;case _0x4ba1('0x8e'):if(_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0x81')]&&_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0x29')]){_0x13e49d=_0x10ff35[_0x4ba1('0x5c')]['status'];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x10ff35[_0x4ba1('0x5c')]['messageId']}});}break;case _0x4ba1('0x91'):if(_0x10ff35[_0x4ba1('0x5c')][0x0]['message']['id']){_0x13e49d=_0x10ff35[_0x4ba1('0x5c')][0x0]['type'];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x10ff35[_0x4ba1('0x5c')][0x0][_0x4ba1('0x25')]['id']}});}break;case _0x4ba1('0x92'):if(_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0xd2')]&&_0x10ff35['body'][_0x4ba1('0x29')]){_0x13e49d=_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0x29')];return db[_0x4ba1('0xa8')]['find']({'where':{'messageId':_0x10ff35[_0x4ba1('0x5c')][_0x4ba1('0xd2')]}});}break;}}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x3ebd86,null))[_0x4ba1('0x1d')](function(_0x3df68d){if(_0x3df68d){_0x4e1b3c=_0x3df68d;switch(_0x56dfcf['type']){case _0x4ba1('0xd3'):if(_0x13e49d===_0x4ba1('0xd4')){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger['error'](_0x4ba1('0x22'),_0x4ba1('0x29'),_0x4ba1('0xd3'),util[_0x4ba1('0xd5')](_0x10ff35[_0x4ba1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4ba1('0xd6'):if(_0x13e49d==='1'){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger[_0x4ba1('0x24')](_0x4ba1('0x22'),_0x4ba1('0x29'),_0x4ba1('0xd3'),util['inspect'](_0x10ff35['body'],{'showHidden':![],'depth':null}));}break;case _0x4ba1('0x85'):if(!_0x10ff35['body']['error_code']&&_0x13e49d>=0xc8&&_0x13e49d<=0xce){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger[_0x4ba1('0x24')](_0x4ba1('0x22'),'status',_0x4ba1('0x85'),util[_0x4ba1('0xd5')](_0x10ff35[_0x4ba1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4ba1('0x89'):var _0x3c0aa1=_0x10ff35['body']['results'][0x0];if(_0x3c0aa1[_0x4ba1('0x29')]['groupName']===_0x4ba1('0xd4')){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger['error'](_0x4ba1('0x22'),_0x4ba1('0x29'),'infobip',util[_0x4ba1('0xd5')](_0x10ff35['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x13e49d==_0x4ba1('0xd7')||_0x13e49d=='RECEIVED_BY_RECIPIENT'){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger[_0x4ba1('0x24')](_0x4ba1('0x22'),_0x4ba1('0x29'),'clickatell',util[_0x4ba1('0xd5')](_0x10ff35['body'],{'showHidden':![],'depth':null}));}break;case _0x4ba1('0x91'):if(_0x13e49d==_0x4ba1('0xd8')){return _0x4e1b3c['update']({'read':!![]});}else{logger[_0x4ba1('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4ba1('0x29'),_0x4ba1('0x91'),util[_0x4ba1('0xd5')](_0x10ff35[_0x4ba1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4ba1('0x92'):if(_0x13e49d===_0x4ba1('0xd9')||_0x13e49d===_0x4ba1('0xda')){return _0x4e1b3c[_0x4ba1('0x61')]({'read':!![]});}else{logger['error'](_0x4ba1('0x22'),_0x4ba1('0x29'),_0x4ba1('0x92'),util[_0x4ba1('0xd5')](_0x10ff35[_0x4ba1('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4e1b3c;}})[_0x4ba1('0x1d')](respondWithResult(_0x3ebd86,null))[_0x4ba1('0x27')](handleError(_0x3ebd86,null));};exports['statusGet']=function(_0x2c31bd,_0xbf2dbf,_0x5bb312){var _0x943131,_0x4b0c1b,_0x45fc84;return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x2c31bd[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0xbf2dbf,null))[_0x4ba1('0x1d')](function(_0x4d3b7d){if(_0x4d3b7d){_0x45fc84=_0x4d3b7d;logger[_0x4ba1('0x21')](_0x4ba1('0x22'),_0x4ba1('0x29'),'received\x20delivery\x20report\x20from',_0x4d3b7d[_0x4ba1('0x3f')],util[_0x4ba1('0xd5')](_0x2c31bd[_0x4ba1('0x43')],{'showHidden':![],'depth':null}));switch(_0x4d3b7d[_0x4ba1('0x3f')]){case'csc':if(_0x2c31bd[_0x4ba1('0x43')]['message-id']&&_0x2c31bd['query'][_0x4ba1('0xdb')]){_0x4b0c1b=_0x2c31bd[_0x4ba1('0x43')][_0x4ba1('0xdb')];return db[_0x4ba1('0xa8')][_0x4ba1('0x5a')]({'where':{'messageId':_0x2c31bd['query'][_0x4ba1('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0xbf2dbf,null))[_0x4ba1('0x1d')](function(_0x4f3307){if(_0x4f3307){_0x943131=_0x4f3307;switch(_0x45fc84['type']){case _0x4ba1('0x8b'):if(_0x4b0c1b==='2'||_0x4b0c1b==='6'){return _0x943131['update']({'read':!![]});}else{logger[_0x4ba1('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4ba1('0x8b'),util[_0x4ba1('0xd5')](_0x2c31bd[_0x4ba1('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x943131;}})['then'](respondWithResult(_0xbf2dbf,null))[_0x4ba1('0x27')](handleError(_0xbf2dbf,null));};exports['addAgents']=function(_0x584ce6,_0x1de700,_0x2deb25){return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x584ce6[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x1de700,null))['then'](function(_0x1f672c){if(_0x1f672c){return _0x1f672c[_0x4ba1('0xdd')](_0x584ce6[_0x4ba1('0x5c')][_0x4ba1('0x6a')],_[_0x4ba1('0xde')](_0x584ce6[_0x4ba1('0x5c')],[_0x4ba1('0x6a'),'id'])||{})['spread'](function(_0x4aafc5){for(var _0x3bd8b2=0x0;_0x3bd8b2<_0x584ce6[_0x4ba1('0x5c')][_0x4ba1('0x6a')]['length'];_0x3bd8b2+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x584ce6[_0x4ba1('0x5c')][_0x4ba1('0x6a')][_0x3bd8b2]),'SmsAccountId':Number(_0x584ce6[_0x4ba1('0x62')]['id'])});}return _0x4aafc5;});}})[_0x4ba1('0x1d')](respondWithResult(_0x1de700,null))[_0x4ba1('0x27')](handleError(_0x1de700,null));};exports['removeAgents']=function(_0x915314,_0x1ca99e,_0x48b28c){return db[_0x4ba1('0x3d')][_0x4ba1('0x5a')]({'where':{'id':_0x915314[_0x4ba1('0x62')]['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x1ca99e,null))[_0x4ba1('0x1d')](function(_0x42ac51){if(_0x42ac51){return _0x42ac51[_0x4ba1('0xdf')](_0x915314['query'][_0x4ba1('0x6a')])['then'](function(){if(_['isArray'](_0x915314[_0x4ba1('0x43')][_0x4ba1('0x6a')])){for(var _0x11be11=0x0;_0x11be11<_0x915314['query'][_0x4ba1('0x6a')][_0x4ba1('0x59')];_0x11be11+=0x1){socket[_0x4ba1('0xe0')](_0x4ba1('0xe1'),{'UserId':Number(_0x915314[_0x4ba1('0x43')][_0x4ba1('0x6a')][_0x11be11]),'SmsAccountId':Number(_0x915314[_0x4ba1('0x62')]['id'])});}}else{socket[_0x4ba1('0xe0')](_0x4ba1('0xe1'),{'UserId':Number(_0x915314[_0x4ba1('0x43')][_0x4ba1('0x6a')]),'SmsAccountId':Number(_0x915314['params']['id'])});}});}})[_0x4ba1('0x1d')](respondWithStatusCode(_0x1ca99e,null))[_0x4ba1('0x27')](handleError(_0x1ca99e,null));};exports[_0x4ba1('0xe2')]=function(_0x43868f,_0x49e8f8,_0x2ff08e){var _0x47a788={};var _0x231982={};var _0x2a2e13;var _0x652e2d;return db['SmsAccount'][_0x4ba1('0x67')]({'where':{'id':_0x43868f['params']['id']}})[_0x4ba1('0x1d')](handleEntityNotFound(_0x49e8f8,null))[_0x4ba1('0x1d')](function(_0x5c5e58){if(_0x5c5e58){_0x2a2e13=_0x5c5e58;_0x231982[_0x4ba1('0x41')]=_[_0x4ba1('0x42')](db[_0x4ba1('0xac')]['rawAttributes']);_0x231982[_0x4ba1('0x43')]=_['keys'](_0x43868f[_0x4ba1('0x43')]);_0x231982[_0x4ba1('0x44')]=_['intersection'](_0x231982[_0x4ba1('0x41')],_0x231982[_0x4ba1('0x43')]);_0x47a788[_0x4ba1('0x47')]=_['intersection'](_0x231982[_0x4ba1('0x41')],qs['fields'](_0x43868f[_0x4ba1('0x43')][_0x4ba1('0x46')]));_0x47a788[_0x4ba1('0x47')]=_0x47a788['attributes'][_0x4ba1('0x59')]?_0x47a788[_0x4ba1('0x47')]:_0x231982[_0x4ba1('0x41')];_0x47a788[_0x4ba1('0x4b')]=qs[_0x4ba1('0x4c')](_0x43868f[_0x4ba1('0x43')][_0x4ba1('0x4c')]);_0x47a788[_0x4ba1('0x4e')]=qs[_0x4ba1('0x44')](_[_0x4ba1('0x4d')](_0x43868f['query'],_0x231982[_0x4ba1('0x44')]));if(_0x43868f[_0x4ba1('0x43')][_0x4ba1('0x51')]){_0x47a788[_0x4ba1('0x4e')]=_[_0x4ba1('0x4f')](_0x47a788[_0x4ba1('0x4e')],{'$or':_[_0x4ba1('0x3c')](_0x47a788[_0x4ba1('0x47')],function(_0xf9a5a6){var _0x2f2381={};_0x2f2381[_0xf9a5a6]={'$like':'%'+_0x43868f['query'][_0x4ba1('0x51')]+'%'};return _0x2f2381;})});}_0x47a788=_['merge']({},_0x47a788,_0x43868f[_0x4ba1('0x52')]);return _0x2a2e13['getAgents'](_0x47a788);}})[_0x4ba1('0x1d')](function(_0xd94368){if(_0xd94368){_0x652e2d=_0xd94368[_0x4ba1('0x59')];if(!_0x43868f[_0x4ba1('0x43')]['hasOwnProperty']('nolimit')){_0x47a788[_0x4ba1('0x4a')]=qs[_0x4ba1('0x4a')](_0x43868f['query'][_0x4ba1('0x4a')]);_0x47a788[_0x4ba1('0x2d')]=qs[_0x4ba1('0x2d')](_0x43868f[_0x4ba1('0x43')][_0x4ba1('0x2d')]);}return _0x2a2e13[_0x4ba1('0xe2')](_0x47a788);}})['then'](function(_0x53ebfd){if(_0x53ebfd){return _0x53ebfd?{'count':_0x652e2d,'rows':_0x53ebfd}:null;}})[_0x4ba1('0x1d')](respondWithResult(_0x49e8f8,null))[_0x4ba1('0x27')](handleError(_0x49e8f8,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ee8c042..b414f24 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 _0xec0e=['exports','events','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0xe47c8,_0x8fa644){var _0x55eec8=function(_0x47c875){while(--_0x47c875){_0xe47c8['push'](_0xe47c8['shift']());}};_0x55eec8(++_0x8fa644);}(_0xec0e,0x10b));var _0xeec0=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0xec0e[_0x4ded50];return _0xa92135;};'use strict';var EventEmitter=require(_0xeec0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xeec0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xeec0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeec0('0x3'),'afterDestroy':_0xeec0('0x4')};function emitEvent(_0x146683){return function(_0xb9d40,_0x3130b5,_0x144319){SmsAccountEvents[_0xeec0('0x5')](_0x146683+':'+_0xb9d40['id'],_0xb9d40);SmsAccountEvents[_0xeec0('0x5')](_0x146683,_0xb9d40);_0x144319(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xeec0('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x5e73=['events','SmsAccount','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x22c427,_0x2c3c15){var _0x448aec=function(_0x16dfd3){while(--_0x16dfd3){_0x22c427['push'](_0x22c427['shift']());}};_0x448aec(++_0x2c3c15);}(_0x5e73,0x1b8));var _0x35e7=function(_0x5c0d82,_0x19f536){_0x5c0d82=_0x5c0d82-0x0;var _0x2d3f53=_0x5e73[_0x5c0d82];return _0x2d3f53;};'use strict';var EventEmitter=require(_0x35e7('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x35e7('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x35e7('0x2')](0x0);var events={'afterCreate':_0x35e7('0x3'),'afterUpdate':'update','afterDestroy':_0x35e7('0x4')};function emitEvent(_0x46a245){return function(_0x51dbf0,_0x1437b6,_0x2fa44a){SmsAccountEvents['emit'](_0x46a245+':'+_0x51dbf0['id'],_0x51dbf0);SmsAccountEvents[_0x35e7('0x5')](_0x46a245,_0x51dbf0);_0x2fa44a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x35e7('0x6')](e,emitEvent(event));}}module[_0x35e7('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 298a790..010850a 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 _0xe372=['lodash','util','../../config/logger','bluebird','path','../../config/environment','./smsAccount.attributes','exports','sms_accounts'];(function(_0x59ace3,_0x336e0c){var _0x523aca=function(_0x3233c5){while(--_0x3233c5){_0x59ace3['push'](_0x59ace3['shift']());}};_0x523aca(++_0x336e0c);}(_0xe372,0x10e));var _0x2e37=function(_0x480409,_0x13b0a5){_0x480409=_0x480409-0x0;var _0x4201bf=_0xe372[_0x480409];return _0x4201bf;};'use strict';var _=require(_0x2e37('0x0'));var util=require(_0x2e37('0x1'));var logger=require(_0x2e37('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2e37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e37('0x4'));var rimraf=require('rimraf');var config=require(_0x2e37('0x5'));var attributes=require(_0x2e37('0x6'));module[_0x2e37('0x7')]=function(_0x377766,_0x7a50ad){return _0x377766['define']('SmsAccount',attributes,{'tableName':_0x2e37('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde5a=['SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x55df30,_0x173142){var _0x52d0a0=function(_0x1f9300){while(--_0x1f9300){_0x55df30['push'](_0x55df30['shift']());}};_0x52d0a0(++_0x173142);}(_0xde5a,0x64));var _0xade5=function(_0x412997,_0x1a2b3e){_0x412997=_0x412997-0x0;var _0x36516f=_0xde5a[_0x412997];return _0x36516f;};'use strict';var _=require(_0xade5('0x0'));var util=require(_0xade5('0x1'));var logger=require(_0xade5('0x2'))(_0xade5('0x3'));var moment=require('moment');var BPromise=require(_0xade5('0x4'));var rp=require(_0xade5('0x5'));var fs=require('fs');var path=require(_0xade5('0x6'));var rimraf=require(_0xade5('0x7'));var config=require(_0xade5('0x8'));var attributes=require(_0xade5('0x9'));module[_0xade5('0xa')]=function(_0x43538d,_0x5f584){return _0x43538d[_0xade5('0xb')](_0xade5('0xc'),attributes,{'tableName':_0xade5('0xd'),'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 57ca638..41561e3 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 _0xd5fb=['ShowSmsAccount','find','options','raw','map','include','attributes','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0xd5fb,0x94));var _0xbd5f=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0xd5fb[_0x3eceb2];return _0x818bc4;};'use strict';var _=require(_0xbd5f('0x0'));var util=require(_0xbd5f('0x1'));var moment=require(_0xbd5f('0x2'));var BPromise=require(_0xbd5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd5f('0x4'));var db=require(_0xbd5f('0x5'))['db'];var utils=require(_0xbd5f('0x6'));var logger=require(_0xbd5f('0x7'))(_0xbd5f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd5f('0x9')][_0xbd5f('0xa')]({'port':0x232a});config[_0xbd5f('0xb')]=_[_0xbd5f('0xc')](config[_0xbd5f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xbd5f('0xd')](socket);function respondWithRpcPromise(_0x29b8d6,_0x159ad0,_0x68eff){return new BPromise(function(_0x547478,_0x4b6ba6){return client[_0xbd5f('0xe')](_0x29b8d6,_0x68eff)[_0xbd5f('0xf')](function(_0x42caf2){logger[_0xbd5f('0x10')](_0xbd5f('0x11'),_0x159ad0,_0xbd5f('0x12'));logger[_0xbd5f('0x13')](_0xbd5f('0x14'),_0x159ad0,_0xbd5f('0x12'),JSON[_0xbd5f('0x15')](_0x42caf2));if(_0x42caf2['error']){if(_0x42caf2[_0xbd5f('0x16')][_0xbd5f('0x17')]===0x1f4){logger[_0xbd5f('0x16')](_0xbd5f('0x11'),_0x159ad0,_0x42caf2[_0xbd5f('0x16')][_0xbd5f('0x18')]);return _0x4b6ba6(_0x42caf2[_0xbd5f('0x16')][_0xbd5f('0x18')]);}logger[_0xbd5f('0x16')](_0xbd5f('0x11'),_0x159ad0,_0x42caf2[_0xbd5f('0x16')][_0xbd5f('0x18')]);return _0x547478(_0x42caf2[_0xbd5f('0x16')]['message']);}else{logger[_0xbd5f('0x10')](_0xbd5f('0x11'),_0x159ad0,'request\x20sent');_0x547478(_0x42caf2[_0xbd5f('0x19')][_0xbd5f('0x18')]);}})[_0xbd5f('0x1a')](function(_0x3077f6){logger[_0xbd5f('0x16')](_0xbd5f('0x11'),_0x159ad0,_0x3077f6);_0x4b6ba6(_0x3077f6);});});}exports[_0xbd5f('0x1b')]=function(_0x417496){var _0x481578=this;return new Promise(function(_0x16682f,_0x3fbd55){return db['SmsAccount'][_0xbd5f('0x1c')]({'raw':_0x417496[_0xbd5f('0x1d')]?_0x417496[_0xbd5f('0x1d')][_0xbd5f('0x1e')]===undefined?!![]:![]:!![],'where':_0x417496[_0xbd5f('0x1d')]?_0x417496[_0xbd5f('0x1d')]['where']||null:null,'attributes':_0x417496['options']?_0x417496[_0xbd5f('0x1d')]['attributes']||null:null,'include':_0x417496[_0xbd5f('0x1d')]?_0x417496[_0xbd5f('0x1d')]['include']?_[_0xbd5f('0x1f')](_0x417496[_0xbd5f('0x1d')][_0xbd5f('0x20')],function(_0x501e0e){return{'model':db[_0x501e0e['model']],'as':_0x501e0e['as'],'attributes':_0x501e0e[_0xbd5f('0x21')],'include':_0x501e0e[_0xbd5f('0x20')]?_[_0xbd5f('0x1f')](_0x501e0e['include'],function(_0x3cf35b){return{'model':db[_0x3cf35b[_0xbd5f('0x22')]],'as':_0x3cf35b['as'],'attributes':_0x3cf35b[_0xbd5f('0x21')],'include':_0x3cf35b['include']?_[_0xbd5f('0x1f')](_0x3cf35b[_0xbd5f('0x20')],function(_0x59973a){return{'model':db[_0x59973a[_0xbd5f('0x22')]],'as':_0x59973a['as'],'attributes':_0x59973a[_0xbd5f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbd5f('0xf')](function(_0x21c172){logger['info']('ShowSmsAccount',_0x417496);logger[_0xbd5f('0x13')](_0xbd5f('0x1b'),_0x417496,JSON['stringify'](_0x21c172));_0x16682f(_0x21c172);})['catch'](function(_0x3b27c9){logger[_0xbd5f('0x16')]('ShowSmsAccount',_0x3b27c9[_0xbd5f('0x18')],_0x417496);_0x3fbd55(_0x481578[_0xbd5f('0x16')](0x1f4,_0x3b27c9[_0xbd5f('0x18')]));});});}; \ No newline at end of file +var _0xcb7e=['./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','options','raw','where','map','include','attributes','model','debug','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x2d6f16,_0x3d2c7f){var _0x43b7a2=function(_0x3ef53b){while(--_0x3ef53b){_0x2d6f16['push'](_0x2d6f16['shift']());}};_0x43b7a2(++_0x3d2c7f);}(_0xcb7e,0x152));var _0xecb7=function(_0x29d6ca,_0x2be9d5){_0x29d6ca=_0x29d6ca-0x0;var _0x3800e3=_0xcb7e[_0x29d6ca];return _0x3800e3;};'use strict';var _=require(_0xecb7('0x0'));var util=require(_0xecb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecb7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xecb7('0x3'));var logger=require('../../config/logger')(_0xecb7('0x4'));var config=require(_0xecb7('0x5'));var jayson=require(_0xecb7('0x6'));var client=jayson[_0xecb7('0x7')][_0xecb7('0x8')]({'port':0x232a});config[_0xecb7('0x9')]=_['defaults'](config[_0xecb7('0x9')],{'host':_0xecb7('0xa'),'port':0x18eb});var socket=require(_0xecb7('0xb'))(new Redis(config[_0xecb7('0x9')]));require(_0xecb7('0xc'))[_0xecb7('0xd')](socket);function respondWithRpcPromise(_0x208b1f,_0x2edaf2,_0x1c9856){return new BPromise(function(_0x2f24b7,_0x53116b){return client[_0xecb7('0xe')](_0x208b1f,_0x1c9856)[_0xecb7('0xf')](function(_0x359d85){logger[_0xecb7('0x10')]('SmsAccount,\x20%s,\x20%s',_0x2edaf2,_0xecb7('0x11'));logger['debug'](_0xecb7('0x12'),_0x2edaf2,'request\x20sent',JSON[_0xecb7('0x13')](_0x359d85));if(_0x359d85[_0xecb7('0x14')]){if(_0x359d85[_0xecb7('0x14')][_0xecb7('0x15')]===0x1f4){logger['error'](_0xecb7('0x16'),_0x2edaf2,_0x359d85[_0xecb7('0x14')]['message']);return _0x53116b(_0x359d85[_0xecb7('0x14')][_0xecb7('0x17')]);}logger[_0xecb7('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2edaf2,_0x359d85[_0xecb7('0x14')][_0xecb7('0x17')]);return _0x2f24b7(_0x359d85[_0xecb7('0x14')][_0xecb7('0x17')]);}else{logger[_0xecb7('0x10')](_0xecb7('0x16'),_0x2edaf2,_0xecb7('0x11'));_0x2f24b7(_0x359d85[_0xecb7('0x18')][_0xecb7('0x17')]);}})[_0xecb7('0x19')](function(_0x5e7182){logger[_0xecb7('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2edaf2,_0x5e7182);_0x53116b(_0x5e7182);});});}exports[_0xecb7('0x1a')]=function(_0x1290f1){var _0x5c52ad=this;return new Promise(function(_0x32b28c,_0x495630){return db['SmsAccount']['find']({'raw':_0x1290f1[_0xecb7('0x1b')]?_0x1290f1[_0xecb7('0x1b')][_0xecb7('0x1c')]===undefined?!![]:![]:!![],'where':_0x1290f1[_0xecb7('0x1b')]?_0x1290f1[_0xecb7('0x1b')][_0xecb7('0x1d')]||null:null,'attributes':_0x1290f1[_0xecb7('0x1b')]?_0x1290f1[_0xecb7('0x1b')]['attributes']||null:null,'include':_0x1290f1[_0xecb7('0x1b')]?_0x1290f1[_0xecb7('0x1b')]['include']?_[_0xecb7('0x1e')](_0x1290f1['options'][_0xecb7('0x1f')],function(_0x158132){return{'model':db[_0x158132['model']],'as':_0x158132['as'],'attributes':_0x158132[_0xecb7('0x20')],'include':_0x158132[_0xecb7('0x1f')]?_[_0xecb7('0x1e')](_0x158132[_0xecb7('0x1f')],function(_0x4bca77){return{'model':db[_0x4bca77['model']],'as':_0x4bca77['as'],'attributes':_0x4bca77[_0xecb7('0x20')],'include':_0x4bca77['include']?_[_0xecb7('0x1e')](_0x4bca77[_0xecb7('0x1f')],function(_0x5a9956){return{'model':db[_0x5a9956[_0xecb7('0x21')]],'as':_0x5a9956['as'],'attributes':_0x5a9956['attributes']};}):[]};}):[]};}):[]:[]})[_0xecb7('0xf')](function(_0x2b5565){logger[_0xecb7('0x10')]('ShowSmsAccount',_0x1290f1);logger[_0xecb7('0x22')](_0xecb7('0x1a'),_0x1290f1,JSON[_0xecb7('0x13')](_0x2b5565));_0x32b28c(_0x2b5565);})[_0xecb7('0x19')](function(_0x2588c2){logger[_0xecb7('0x14')](_0xecb7('0x1a'),_0x2588c2[_0xecb7('0x17')],_0x1290f1);_0x495630(_0x5c52ad[_0xecb7('0x14')](0x1f4,_0x2588c2[_0xecb7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b35f2d4..7ac23a3 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 8a562b3..271d7a2 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x353517,_0x1031aa){var _0x21a237=function(_0x28928e){while(--_0x28928e){_0x353517['push'](_0x353517['shift']());}};_0x21a237(++_0x1031aa);}(_0x008c,0x188));var _0xc008=function(_0x456066,_0x44930c){_0x456066=_0x456066-0x0;var _0x5a069a=_0x008c[_0x456066];return _0x5a069a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2acbf9,_0x44eba4){var _0x406fe1=function(_0x4ebc3f){while(--_0x4ebc3f){_0x2acbf9['push'](_0x2acbf9['shift']());}};_0x406fe1(++_0x44eba4);}(_0x34e8,0x12c));var _0x834e=function(_0xf266c3,_0x481847){_0xf266c3=_0xf266c3-0x0;var _0x45d986=_0x34e8[_0xf266c3];return _0x45d986;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6601ade..bc2f834 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 _0xb2ed=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x5ac610,_0x1f16c7){var _0x54519c=function(_0x38ea26){while(--_0x38ea26){_0x5ac610['push'](_0x5ac610['shift']());}};_0x54519c(++_0x1f16c7);}(_0xb2ed,0x86));var _0xdb2e=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xb2ed[_0x1fb4e1];return _0x22d1b0;};'use strict';var Sequelize=require(_0xdb2e('0x0'));module[_0xdb2e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdb2e('0x2')],'allowNull':![],'defaultValue':_0xdb2e('0x3')},'appdata':{'type':Sequelize[_0xdb2e('0x4')]()},'description':{'type':Sequelize[_0xdb2e('0x2')]},'interval':{'type':Sequelize[_0xdb2e('0x2')],'defaultValue':_0xdb2e('0x5')}}; \ No newline at end of file +var _0xc47a=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2579e2,_0xd0f577){var _0x76b52f=function(_0x2c6fb9){while(--_0x2c6fb9){_0x2579e2['push'](_0x2579e2['shift']());}};_0x76b52f(++_0xd0f577);}(_0xc47a,0x10b));var _0xac47=function(_0xd74084,_0x1a2c1b){_0xd74084=_0xd74084-0x0;var _0x98df71=_0xc47a[_0xd74084];return _0x98df71;};'use strict';var Sequelize=require(_0xac47('0x0'));module[_0xac47('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xac47('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xac47('0x3')]()},'description':{'type':Sequelize[_0xac47('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xac47('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 198367a..5581e94 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 _0x86d6=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','send','index','map','SmsApplication','rawAttributes','fieldName'];(function(_0x43425c,_0x3e4702){var _0x4c4ab0=function(_0x272995){while(--_0x272995){_0x43425c['push'](_0x43425c['shift']());}};_0x4c4ab0(++_0x3e4702);}(_0x86d6,0x1ea));var _0x686d=function(_0x2ae7f0,_0x42f40b){_0x2ae7f0=_0x2ae7f0-0x0;var _0x5d7bb2=_0x86d6[_0x2ae7f0];return _0x5d7bb2;};'use strict';var emlformat=require(_0x686d('0x0'));var rimraf=require(_0x686d('0x1'));var zipdir=require(_0x686d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x686d('0x3'));var moment=require('moment');var BPromise=require(_0x686d('0x4'));var Mustache=require(_0x686d('0x5'));var util=require(_0x686d('0x6'));var path=require(_0x686d('0x7'));var sox=require(_0x686d('0x8'));var csv=require(_0x686d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x686d('0xa'));var _=require(_0x686d('0xb'));var squel=require(_0x686d('0xc'));var crypto=require(_0x686d('0xd'));var jsforce=require(_0x686d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x686d('0xf'));var Papa=require(_0x686d('0x10'));var Redis=require(_0x686d('0x11'));var authService=require(_0x686d('0x12'));var qs=require(_0x686d('0x13'));var as=require(_0x686d('0x14'));var hardwareService=require(_0x686d('0x15'));var logger=require('../../config/logger')(_0x686d('0x16'));var utils=require(_0x686d('0x17'));var config=require(_0x686d('0x18'));var licenseUtil=require(_0x686d('0x19'));var db=require(_0x686d('0x1a'))['db'];function respondWithStatusCode(_0x178884,_0x4ef939){_0x4ef939=_0x4ef939||0xcc;return function(_0x490446){if(_0x490446){return _0x178884[_0x686d('0x1b')](_0x4ef939);}return _0x178884['status'](_0x4ef939)['end']();};}function respondWithResult(_0x2e3a79,_0x341fbe){_0x341fbe=_0x341fbe||0xc8;return function(_0x30ad3d){if(_0x30ad3d){return _0x2e3a79[_0x686d('0x1c')](_0x341fbe)[_0x686d('0x1d')](_0x30ad3d);}};}function respondWithFilteredResult(_0x3606b8,_0x2386e1){return function(_0x25d735){if(_0x25d735){var _0x210e58=typeof _0x2386e1[_0x686d('0x1e')]===_0x686d('0x1f')&&typeof _0x2386e1[_0x686d('0x20')]==='undefined';var _0x204608=_0x25d735[_0x686d('0x21')];var _0x4ade8e=_0x210e58?0x0:_0x2386e1[_0x686d('0x1e')];var _0x539687=_0x210e58?_0x25d735[_0x686d('0x21')]:_0x2386e1[_0x686d('0x1e')]+_0x2386e1[_0x686d('0x20')];var _0x2cd6b2;if(_0x539687>=_0x204608){_0x539687=_0x204608;_0x2cd6b2=0xc8;}else{_0x2cd6b2=0xce;}_0x3606b8['status'](_0x2cd6b2);return _0x3606b8[_0x686d('0x22')]('Content-Range',_0x4ade8e+'-'+_0x539687+'/'+_0x204608)[_0x686d('0x1d')](_0x25d735);}return null;};}function patchUpdates(_0x191125){return function(_0x37057c){try{jsonpatch[_0x686d('0x23')](_0x37057c,_0x191125,!![]);}catch(_0x3ded59){return BPromise[_0x686d('0x24')](_0x3ded59);}return _0x37057c[_0x686d('0x25')]();};}function saveUpdates(_0x4e0e3e,_0x1803a2){return function(_0x16a7fb){if(_0x16a7fb){return _0x16a7fb[_0x686d('0x26')](_0x4e0e3e)[_0x686d('0x27')](function(_0x43b392){return _0x43b392;});}return null;};}function removeEntity(_0x307d55,_0x201148){return function(_0x2dc848){if(_0x2dc848){return _0x2dc848['destroy']()['then'](function(){_0x307d55['status'](0xcc)[_0x686d('0x28')]();});}};}function handleEntityNotFound(_0x5abb52,_0x5183a8){return function(_0x1693b9){if(!_0x1693b9){_0x5abb52['sendStatus'](0x194);}return _0x1693b9;};}function handleError(_0xdc2750,_0x2ab843){_0x2ab843=_0x2ab843||0x1f4;return function(_0x3a1696){logger[_0x686d('0x29')](_0x3a1696[_0x686d('0x2a')]);if(_0x3a1696['name']){delete _0x3a1696['name'];}_0xdc2750['status'](_0x2ab843)[_0x686d('0x2b')](_0x3a1696);};}exports[_0x686d('0x2c')]=function(_0x236463,_0x563b7c){var _0x184e04={},_0x8a02d7={},_0x292db0={'count':0x0,'rows':[]};var _0x479293=_[_0x686d('0x2d')](db[_0x686d('0x2e')][_0x686d('0x2f')],function(_0x19050a){return{'name':_0x19050a[_0x686d('0x30')],'type':_0x19050a[_0x686d('0x31')][_0x686d('0x32')]};});_0x8a02d7['model']=_[_0x686d('0x2d')](_0x479293,'name');_0x8a02d7[_0x686d('0x33')]=_[_0x686d('0x34')](_0x236463[_0x686d('0x33')]);_0x8a02d7[_0x686d('0x35')]=_[_0x686d('0x36')](_0x8a02d7[_0x686d('0x37')],_0x8a02d7[_0x686d('0x33')]);_0x184e04[_0x686d('0x38')]=_[_0x686d('0x36')](_0x8a02d7[_0x686d('0x37')],qs[_0x686d('0x39')](_0x236463[_0x686d('0x33')][_0x686d('0x39')]));_0x184e04[_0x686d('0x38')]=_0x184e04[_0x686d('0x38')]['length']?_0x184e04[_0x686d('0x38')]:_0x8a02d7[_0x686d('0x37')];if(!_0x236463[_0x686d('0x33')][_0x686d('0x3a')](_0x686d('0x3b'))){_0x184e04[_0x686d('0x20')]=qs[_0x686d('0x20')](_0x236463[_0x686d('0x33')][_0x686d('0x20')]);_0x184e04[_0x686d('0x1e')]=qs[_0x686d('0x1e')](_0x236463[_0x686d('0x33')]['offset']);}_0x184e04[_0x686d('0x3c')]=qs[_0x686d('0x3d')](_0x236463[_0x686d('0x33')][_0x686d('0x3d')]);_0x184e04['where']=qs[_0x686d('0x35')](_['pick'](_0x236463['query'],_0x8a02d7[_0x686d('0x35')]),_0x479293);if(_0x236463['query'][_0x686d('0x3e')]){_0x184e04[_0x686d('0x3f')]=_[_0x686d('0x40')](_0x184e04[_0x686d('0x3f')],{'$or':_[_0x686d('0x2d')](_0x479293,function(_0x14cbf7){if(_0x14cbf7[_0x686d('0x31')]!==_0x686d('0x41')){var _0x81b194={};_0x81b194[_0x14cbf7['name']]={'$like':'%'+_0x236463[_0x686d('0x33')][_0x686d('0x3e')]+'%'};return _0x81b194;}})});}_0x184e04=_[_0x686d('0x40')]({},_0x184e04,_0x236463[_0x686d('0x42')]);var _0x3950cb={'where':_0x184e04[_0x686d('0x3f')]};return db[_0x686d('0x2e')][_0x686d('0x21')](_0x3950cb)['then'](function(_0x14eb7e){_0x292db0['count']=_0x14eb7e;if(_0x236463['query'][_0x686d('0x43')]){_0x184e04[_0x686d('0x44')]=[{'all':!![]}];}return db[_0x686d('0x2e')][_0x686d('0x45')](_0x184e04);})[_0x686d('0x27')](function(_0x2b89ec){_0x292db0['rows']=_0x2b89ec;return _0x292db0;})[_0x686d('0x27')](respondWithFilteredResult(_0x563b7c,_0x184e04))[_0x686d('0x46')](handleError(_0x563b7c,null));};exports['show']=function(_0x27a3a3,_0x21d24f){var _0x1df439={'raw':!![],'where':{'id':_0x27a3a3[_0x686d('0x47')]['id']}},_0x183bf7={};_0x183bf7['model']=_[_0x686d('0x34')](db['SmsApplication'][_0x686d('0x2f')]);_0x183bf7[_0x686d('0x33')]=_['keys'](_0x27a3a3[_0x686d('0x33')]);_0x183bf7['filters']=_[_0x686d('0x36')](_0x183bf7['model'],_0x183bf7[_0x686d('0x33')]);_0x1df439['attributes']=_['intersection'](_0x183bf7['model'],qs['fields'](_0x27a3a3[_0x686d('0x33')][_0x686d('0x39')]));_0x1df439[_0x686d('0x38')]=_0x1df439['attributes'][_0x686d('0x48')]?_0x1df439[_0x686d('0x38')]:_0x183bf7[_0x686d('0x37')];if(_0x27a3a3[_0x686d('0x33')][_0x686d('0x43')]){_0x1df439[_0x686d('0x44')]=[{'all':!![]}];}_0x1df439=_[_0x686d('0x40')]({},_0x1df439,_0x27a3a3[_0x686d('0x42')]);return db[_0x686d('0x2e')][_0x686d('0x49')](_0x1df439)[_0x686d('0x27')](handleEntityNotFound(_0x21d24f,null))[_0x686d('0x27')](respondWithResult(_0x21d24f,null))['catch'](handleError(_0x21d24f,null));};exports[_0x686d('0x4a')]=function(_0x3bc8b6,_0x126ab9){return db[_0x686d('0x2e')]['create'](_0x3bc8b6[_0x686d('0x4b')],{})[_0x686d('0x27')](respondWithResult(_0x126ab9,0xc9))[_0x686d('0x46')](handleError(_0x126ab9,null));};exports['update']=function(_0xd07145,_0x264717){if(_0xd07145[_0x686d('0x4b')]['id']){delete _0xd07145['body']['id'];}return db['SmsApplication'][_0x686d('0x49')]({'where':{'id':_0xd07145['params']['id']}})[_0x686d('0x27')](handleEntityNotFound(_0x264717,null))[_0x686d('0x27')](saveUpdates(_0xd07145[_0x686d('0x4b')],null))[_0x686d('0x27')](respondWithResult(_0x264717,null))[_0x686d('0x46')](handleError(_0x264717,null));};exports[_0x686d('0x4c')]=function(_0x4f38b6,_0x504c04){return db[_0x686d('0x2e')][_0x686d('0x49')]({'where':{'id':_0x4f38b6[_0x686d('0x47')]['id']}})[_0x686d('0x27')](handleEntityNotFound(_0x504c04,null))[_0x686d('0x27')](removeEntity(_0x504c04,null))[_0x686d('0x46')](handleError(_0x504c04,null));}; \ No newline at end of file +var _0x2097=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','then','rows','catch','show','includeAll','find','create','body','destroy','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','error','stack','name','index','SmsApplication','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x24b33c,_0x33cb97){var _0x33becf=function(_0x4d8a9c){while(--_0x4d8a9c){_0x24b33c['push'](_0x24b33c['shift']());}};_0x33becf(++_0x33cb97);}(_0x2097,0xfd));var _0x7209=function(_0x4928ea,_0x120492){_0x4928ea=_0x4928ea-0x0;var _0x5a3c47=_0x2097[_0x4928ea];return _0x5a3c47;};'use strict';var emlformat=require(_0x7209('0x0'));var rimraf=require(_0x7209('0x1'));var zipdir=require(_0x7209('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7209('0x3'));var moment=require(_0x7209('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7209('0x5'));var util=require(_0x7209('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7209('0x7'));var ejs=require(_0x7209('0x8'));var fs=require('fs');var fs_extra=require(_0x7209('0x9'));var _=require(_0x7209('0xa'));var squel=require(_0x7209('0xb'));var crypto=require(_0x7209('0xc'));var jsforce=require(_0x7209('0xd'));var deskjs=require(_0x7209('0xe'));var toCsv=require(_0x7209('0x7'));var querystring=require(_0x7209('0xf'));var Papa=require('papaparse');var Redis=require(_0x7209('0x10'));var authService=require(_0x7209('0x11'));var qs=require(_0x7209('0x12'));var as=require(_0x7209('0x13'));var hardwareService=require(_0x7209('0x14'));var logger=require(_0x7209('0x15'))(_0x7209('0x16'));var utils=require('../../config/utils');var config=require(_0x7209('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7209('0x18'))['db'];function respondWithStatusCode(_0x25b2b5,_0x4aa20b){_0x4aa20b=_0x4aa20b||0xcc;return function(_0x378380){if(_0x378380){return _0x25b2b5[_0x7209('0x19')](_0x4aa20b);}return _0x25b2b5[_0x7209('0x1a')](_0x4aa20b)[_0x7209('0x1b')]();};}function respondWithResult(_0x5e67cf,_0x2aac07){_0x2aac07=_0x2aac07||0xc8;return function(_0x5cf4ad){if(_0x5cf4ad){return _0x5e67cf[_0x7209('0x1a')](_0x2aac07)[_0x7209('0x1c')](_0x5cf4ad);}};}function respondWithFilteredResult(_0x590067,_0x515388){return function(_0x4ab041){if(_0x4ab041){var _0xae7114=typeof _0x515388[_0x7209('0x1d')]===_0x7209('0x1e')&&typeof _0x515388[_0x7209('0x1f')]===_0x7209('0x1e');var _0x13e155=_0x4ab041[_0x7209('0x20')];var _0xd73306=_0xae7114?0x0:_0x515388[_0x7209('0x1d')];var _0x2ac2d4=_0xae7114?_0x4ab041[_0x7209('0x20')]:_0x515388[_0x7209('0x1d')]+_0x515388[_0x7209('0x1f')];var _0xe0e950;if(_0x2ac2d4>=_0x13e155){_0x2ac2d4=_0x13e155;_0xe0e950=0xc8;}else{_0xe0e950=0xce;}_0x590067[_0x7209('0x1a')](_0xe0e950);return _0x590067[_0x7209('0x21')](_0x7209('0x22'),_0xd73306+'-'+_0x2ac2d4+'/'+_0x13e155)[_0x7209('0x1c')](_0x4ab041);}return null;};}function patchUpdates(_0x4da205){return function(_0x10dfa5){try{jsonpatch[_0x7209('0x23')](_0x10dfa5,_0x4da205,!![]);}catch(_0x40f36b){return BPromise['reject'](_0x40f36b);}return _0x10dfa5[_0x7209('0x24')]();};}function saveUpdates(_0x23b08d,_0x53d68d){return function(_0x2eb9c2){if(_0x2eb9c2){return _0x2eb9c2[_0x7209('0x25')](_0x23b08d)['then'](function(_0x4dd89b){return _0x4dd89b;});}return null;};}function removeEntity(_0x23de10,_0x386ffa){return function(_0x5fa602){if(_0x5fa602){return _0x5fa602['destroy']()['then'](function(){_0x23de10[_0x7209('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2bd2,_0x5cb01c){return function(_0x3cc39a){if(!_0x3cc39a){_0x3d2bd2[_0x7209('0x19')](0x194);}return _0x3cc39a;};}function handleError(_0x143eeb,_0xf9f95f){_0xf9f95f=_0xf9f95f||0x1f4;return function(_0x6fc291){logger[_0x7209('0x26')](_0x6fc291[_0x7209('0x27')]);if(_0x6fc291[_0x7209('0x28')]){delete _0x6fc291[_0x7209('0x28')];}_0x143eeb[_0x7209('0x1a')](_0xf9f95f)['send'](_0x6fc291);};}exports[_0x7209('0x29')]=function(_0x2e0e55,_0x4ccd4a){var _0x542b2e={},_0xf7290e={},_0x343f1a={'count':0x0,'rows':[]};var _0xfc10ab=_['map'](db[_0x7209('0x2a')][_0x7209('0x2b')],function(_0x4e18cf){return{'name':_0x4e18cf[_0x7209('0x2c')],'type':_0x4e18cf['type'][_0x7209('0x2d')]};});_0xf7290e[_0x7209('0x2e')]=_[_0x7209('0x2f')](_0xfc10ab,_0x7209('0x28'));_0xf7290e[_0x7209('0x30')]=_[_0x7209('0x31')](_0x2e0e55[_0x7209('0x30')]);_0xf7290e[_0x7209('0x32')]=_[_0x7209('0x33')](_0xf7290e[_0x7209('0x2e')],_0xf7290e[_0x7209('0x30')]);_0x542b2e[_0x7209('0x34')]=_['intersection'](_0xf7290e[_0x7209('0x2e')],qs[_0x7209('0x35')](_0x2e0e55[_0x7209('0x30')][_0x7209('0x35')]));_0x542b2e[_0x7209('0x34')]=_0x542b2e[_0x7209('0x34')][_0x7209('0x36')]?_0x542b2e['attributes']:_0xf7290e[_0x7209('0x2e')];if(!_0x2e0e55['query'][_0x7209('0x37')](_0x7209('0x38'))){_0x542b2e[_0x7209('0x1f')]=qs[_0x7209('0x1f')](_0x2e0e55[_0x7209('0x30')][_0x7209('0x1f')]);_0x542b2e[_0x7209('0x1d')]=qs[_0x7209('0x1d')](_0x2e0e55[_0x7209('0x30')][_0x7209('0x1d')]);}_0x542b2e[_0x7209('0x39')]=qs[_0x7209('0x3a')](_0x2e0e55[_0x7209('0x30')][_0x7209('0x3a')]);_0x542b2e[_0x7209('0x3b')]=qs[_0x7209('0x32')](_[_0x7209('0x3c')](_0x2e0e55['query'],_0xf7290e[_0x7209('0x32')]),_0xfc10ab);if(_0x2e0e55[_0x7209('0x30')][_0x7209('0x3d')]){_0x542b2e['where']=_[_0x7209('0x3e')](_0x542b2e['where'],{'$or':_['map'](_0xfc10ab,function(_0x5be0ce){if(_0x5be0ce[_0x7209('0x3f')]!==_0x7209('0x40')){var _0x35b75e={};_0x35b75e[_0x5be0ce[_0x7209('0x28')]]={'$like':'%'+_0x2e0e55[_0x7209('0x30')][_0x7209('0x3d')]+'%'};return _0x35b75e;}})});}_0x542b2e=_['merge']({},_0x542b2e,_0x2e0e55['options']);var _0x25fa27={'where':_0x542b2e['where']};return db[_0x7209('0x2a')][_0x7209('0x20')](_0x25fa27)['then'](function(_0x364b79){_0x343f1a[_0x7209('0x20')]=_0x364b79;if(_0x2e0e55[_0x7209('0x30')]['includeAll']){_0x542b2e[_0x7209('0x41')]=[{'all':!![]}];}return db[_0x7209('0x2a')][_0x7209('0x42')](_0x542b2e);})[_0x7209('0x43')](function(_0x213b35){_0x343f1a[_0x7209('0x44')]=_0x213b35;return _0x343f1a;})[_0x7209('0x43')](respondWithFilteredResult(_0x4ccd4a,_0x542b2e))[_0x7209('0x45')](handleError(_0x4ccd4a,null));};exports[_0x7209('0x46')]=function(_0xeb1fa7,_0x52d5a5){var _0x628d0a={'raw':!![],'where':{'id':_0xeb1fa7['params']['id']}},_0x4cfbe9={};_0x4cfbe9['model']=_[_0x7209('0x31')](db['SmsApplication'][_0x7209('0x2b')]);_0x4cfbe9[_0x7209('0x30')]=_[_0x7209('0x31')](_0xeb1fa7['query']);_0x4cfbe9[_0x7209('0x32')]=_[_0x7209('0x33')](_0x4cfbe9[_0x7209('0x2e')],_0x4cfbe9[_0x7209('0x30')]);_0x628d0a[_0x7209('0x34')]=_[_0x7209('0x33')](_0x4cfbe9[_0x7209('0x2e')],qs[_0x7209('0x35')](_0xeb1fa7[_0x7209('0x30')]['fields']));_0x628d0a[_0x7209('0x34')]=_0x628d0a[_0x7209('0x34')][_0x7209('0x36')]?_0x628d0a['attributes']:_0x4cfbe9[_0x7209('0x2e')];if(_0xeb1fa7[_0x7209('0x30')][_0x7209('0x47')]){_0x628d0a[_0x7209('0x41')]=[{'all':!![]}];}_0x628d0a=_['merge']({},_0x628d0a,_0xeb1fa7['options']);return db['SmsApplication'][_0x7209('0x48')](_0x628d0a)[_0x7209('0x43')](handleEntityNotFound(_0x52d5a5,null))[_0x7209('0x43')](respondWithResult(_0x52d5a5,null))[_0x7209('0x45')](handleError(_0x52d5a5,null));};exports[_0x7209('0x49')]=function(_0x63006a,_0x2715a0){return db[_0x7209('0x2a')]['create'](_0x63006a[_0x7209('0x4a')],{})[_0x7209('0x43')](respondWithResult(_0x2715a0,0xc9))[_0x7209('0x45')](handleError(_0x2715a0,null));};exports[_0x7209('0x25')]=function(_0x28d5b4,_0x1a2acc){if(_0x28d5b4['body']['id']){delete _0x28d5b4['body']['id'];}return db[_0x7209('0x2a')][_0x7209('0x48')]({'where':{'id':_0x28d5b4['params']['id']}})['then'](handleEntityNotFound(_0x1a2acc,null))[_0x7209('0x43')](saveUpdates(_0x28d5b4[_0x7209('0x4a')],null))['then'](respondWithResult(_0x1a2acc,null))[_0x7209('0x45')](handleError(_0x1a2acc,null));};exports[_0x7209('0x4b')]=function(_0x3f26af,_0x14f022){return db[_0x7209('0x2a')][_0x7209('0x48')]({'where':{'id':_0x3f26af[_0x7209('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14f022,null))['then'](removeEntity(_0x14f022,null))['catch'](handleError(_0x14f022,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0bbff13..05dde8d 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 _0x201d=['moment','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4040a6,_0x49cbcd){var _0x55fd3f=function(_0x3cfcf3){while(--_0x3cfcf3){_0x4040a6['push'](_0x4040a6['shift']());}};_0x55fd3f(++_0x49cbcd);}(_0x201d,0x184));var _0xd201=function(_0x1c9048,_0x35f0a4){_0x1c9048=_0x1c9048-0x0;var _0x3eb4ee=_0x201d[_0x1c9048];return _0x3eb4ee;};'use strict';var _=require(_0xd201('0x0'));var util=require(_0xd201('0x1'));var logger=require(_0xd201('0x2'))(_0xd201('0x3'));var moment=require(_0xd201('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd201('0x5'));var rimraf=require(_0xd201('0x6'));var config=require(_0xd201('0x7'));var attributes=require('./smsApplication.attributes');module[_0xd201('0x8')]=function(_0x3d9f2d,_0x498ab8){return _0x3d9f2d[_0xd201('0x9')](_0xd201('0xa'),attributes,{'tableName':_0xd201('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd201('0xc'),'collate':_0xd201('0xd')});}; \ No newline at end of file +var _0x1d40=['path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x66a38f,_0x4474fb){var _0x206090=function(_0x52257d){while(--_0x52257d){_0x66a38f['push'](_0x66a38f['shift']());}};_0x206090(++_0x4474fb);}(_0x1d40,0xbc));var _0x01d4=function(_0x284321,_0x4e0767){_0x284321=_0x284321-0x0;var _0x4b184d=_0x1d40[_0x284321];return _0x4b184d;};'use strict';var _=require(_0x01d4('0x0'));var util=require(_0x01d4('0x1'));var logger=require(_0x01d4('0x2'))(_0x01d4('0x3'));var moment=require(_0x01d4('0x4'));var BPromise=require(_0x01d4('0x5'));var rp=require(_0x01d4('0x6'));var fs=require('fs');var path=require(_0x01d4('0x7'));var rimraf=require(_0x01d4('0x8'));var config=require(_0x01d4('0x9'));var attributes=require(_0x01d4('0xa'));module['exports']=function(_0x4d600f,_0x2746cb){return _0x4d600f[_0x01d4('0xb')](_0x01d4('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01d4('0xd'),'collate':_0x01d4('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8164296..df16604 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 _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x2b1fc6,_0x367ea6){var _0x4801cd=function(_0x178db6){while(--_0x178db6){_0x2b1fc6['push'](_0x2b1fc6['shift']());}};_0x4801cd(++_0x367ea6);}(_0x19e1,0x163));var _0x119e=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x19e1[_0x221ba2];return _0x47d08e;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('SmsApplication,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file +var _0xe34f=['result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0xe34f,0xbc));var _0xfe34=function(_0x5eba9e,_0x469127){_0x5eba9e=_0x5eba9e-0x0;var _0x37b955=_0xe34f[_0x5eba9e];return _0x37b955;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2ff8a27..00726d4 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 _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x80ed,0x11c));var _0xd80e=function(_0xf8699c,_0x3f8430){_0xf8699c=_0xf8699c-0x0;var _0x279010=_0x80ed[_0xf8699c];return _0x279010;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x5e6082,_0xb27279){var _0x2f115d=function(_0x183cb3){while(--_0x183cb3){_0x5e6082['push'](_0x5e6082['shift']());}};_0x2f115d(++_0xb27279);}(_0x3266,0x6a));var _0x6326=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x3266[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6f129d0..63be105 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 _0x448b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x448b,0x125));var _0xb448=function(_0x4d438a,_0x25c873){_0x4d438a=_0x4d438a-0x0;var _0x542148=_0x448b[_0x4d438a];return _0x542148;};'use strict';var Sequelize=require(_0xb448('0x0'));var moment=require(_0xb448('0x1'));module[_0xb448('0x2')]={'closed':{'type':Sequelize[_0xb448('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb448('0x4')]},'disposition':{'type':Sequelize[_0xb448('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb448('0x5')]},'note':{'type':Sequelize[_0xb448('0x5')]},'phone':{'type':Sequelize[_0xb448('0x5')]},'read1stAt':{'type':Sequelize[_0xb448('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb448('0x6')]('in',_0xb448('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb448('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb448('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb448('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x394e=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x574161,_0x9c74ff){var _0x38db42=function(_0x5d2266){while(--_0x5d2266){_0x574161['push'](_0x574161['shift']());}};_0x38db42(++_0x9c74ff);}(_0x394e,0x88));var _0xe394=function(_0x567adc,_0x2486d2){_0x567adc=_0x567adc-0x0;var _0xf3ed85=_0x394e[_0x567adc];return _0xf3ed85;};'use strict';var Sequelize=require(_0xe394('0x0'));var moment=require(_0xe394('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe394('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe394('0x3')]},'disposition':{'type':Sequelize[_0xe394('0x4')]},'secondDisposition':{'type':Sequelize[_0xe394('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe394('0x4')]},'phone':{'type':Sequelize[_0xe394('0x4')]},'read1stAt':{'type':Sequelize[_0xe394('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe394('0x5')]('in',_0xe394('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe394('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe394('0x5')]('in',_0xe394('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe394('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4b529be..62aa6f7 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 _0xc41a=['User','fullname','CmContact','lastName','createdAt','direction','read','SmsAccount','Account','get','Sms','Owner','toString','closed','closedAt','disposition','out','System','Contact','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','count','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','merge','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','limit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','push'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xc41a,0x104));var _0xac41=function(_0x13ffe5,_0x11f9db){_0x13ffe5=_0x13ffe5-0x0;var _0x4ec3fc=_0xc41a[_0x13ffe5];return _0x4ec3fc;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xac41('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xac41('0x1'));var path=require(_0xac41('0x2'));var ejs=require(_0xac41('0x3'));var fs=require('fs');var _=require(_0xac41('0x4'));var Redis=require(_0xac41('0x5'));var interaction=require(_0xac41('0x6'));var qs=require(_0xac41('0x7'));var pdf=require(_0xac41('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xac41('0x9'));var db=require('../../mysqldb')['db'];config[_0xac41('0xa')]=_['defaults'](config[_0xac41('0xa')],{'host':_0xac41('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac41('0xa')]));require(_0xac41('0xc'))[_0xac41('0xd')](socket);function respondWithStatusCode(_0x5ef664,_0x3507e6){_0x3507e6=_0x3507e6||0xcc;return function(_0x3a916b){if(_0x3a916b){return _0x5ef664['sendStatus'](_0x3507e6);}return _0x5ef664[_0xac41('0xe')](_0x3507e6)[_0xac41('0xf')]();};}function respondWithResult(_0x394960,_0xcec183){_0xcec183=_0xcec183||0xc8;return function(_0x3f5231){if(_0x3f5231){return _0x394960[_0xac41('0xe')](_0xcec183)[_0xac41('0x10')](_0x3f5231);}};}function respondWithFilteredResult(_0x51febf,_0x10d6d3){return function(_0x178e97){if(_0x178e97){var _0x33b376=typeof _0x10d6d3[_0xac41('0x11')]===_0xac41('0x12')&&typeof _0x10d6d3['limit']===_0xac41('0x12');var _0x3f237f=_0x178e97[_0xac41('0x13')];var _0x284c15=_0x33b376?0x0:_0x10d6d3[_0xac41('0x11')];var _0x552444=_0x33b376?_0x178e97['count']:_0x10d6d3[_0xac41('0x11')]+_0x10d6d3['limit'];var _0x436bb9;if(_0x552444>=_0x3f237f){_0x552444=_0x3f237f;_0x436bb9=0xc8;}else{_0x436bb9=0xce;}_0x51febf[_0xac41('0xe')](_0x436bb9);return _0x51febf[_0xac41('0x14')]('Content-Range',_0x284c15+'-'+_0x552444+'/'+_0x3f237f)[_0xac41('0x10')](_0x178e97);}return null;};}function saveUpdates(_0x36c4ad){return function(_0x1452c2){if(_0x1452c2){return _0x1452c2[_0xac41('0x15')](_0x36c4ad)[_0xac41('0x16')](function(_0x2da946){return _0x2da946;});}return null;};}function removeEntity(_0x4a41ce){return function(_0x10cd5c){if(_0x10cd5c){return _0x10cd5c[_0xac41('0x17')]()[_0xac41('0x16')](function(){_0x4a41ce[_0xac41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x638968){return function(_0x339a87){if(!_0x339a87){_0x638968[_0xac41('0x18')](0x194);}return _0x339a87;};}function handleError(_0x370048,_0x309238){_0x309238=_0x309238||0x1f4;return function(_0x13da57){logger[_0xac41('0x19')](_0x13da57[_0xac41('0x1a')]);if(_0x13da57[_0xac41('0x1b')]){delete _0x13da57[_0xac41('0x1b')];}_0x370048[_0xac41('0xe')](_0x309238)[_0xac41('0x1c')](_0x13da57);};}exports[_0xac41('0x1d')]=function(_0x4e9465,_0x373695){var _0x5214ab={};var _0x1f218a=_[_0xac41('0x1e')](db[_0xac41('0x1f')][_0xac41('0x20')],function(_0x175bef){return{'name':_0x175bef['fieldName'],'type':_0x175bef[_0xac41('0x21')]['key']};});_0x5214ab=qs[_0xac41('0x22')](_0x1f218a,_0x4e9465);return interaction[_0xac41('0x23')](_0xac41('0x24'),_0x4e9465[_0xac41('0x25')],_0x4e9465[_0xac41('0x26')],_0x5214ab,_0x1f218a)['then'](respondWithFilteredResult(_0x373695,_0x5214ab))[_0xac41('0x27')](handleError(_0x373695,null));};exports['show']=function(_0x493073,_0xd4881f){var _0x4436af={'raw':![],'where':{'id':_0x493073[_0xac41('0x28')]['id']}},_0xcea713={};_0xcea713[_0xac41('0x29')]=_['keys'](db['SmsInteraction'][_0xac41('0x20')]);_0xcea713[_0xac41('0x25')]=_[_0xac41('0x2a')](_0x493073[_0xac41('0x25')]);_0xcea713[_0xac41('0x2b')]=_[_0xac41('0x2c')](_0xcea713[_0xac41('0x29')],_0xcea713['query']);_0x4436af[_0xac41('0x2d')]=_[_0xac41('0x2c')](_0xcea713[_0xac41('0x29')],qs['fields'](_0x493073[_0xac41('0x25')][_0xac41('0x2e')]));_0x4436af[_0xac41('0x2d')]=_0x4436af[_0xac41('0x2d')][_0xac41('0x2f')]?_0x4436af[_0xac41('0x2d')]:_0xcea713[_0xac41('0x29')];if(_0x493073['query']['includeAll']){_0x4436af['include']=[{'all':!![]}];}_0x4436af=_[_0xac41('0x30')]({},_0x4436af,_0x493073['options']);return db['SmsInteraction'][_0xac41('0x31')](_0x4436af)[_0xac41('0x16')](handleEntityNotFound(_0xd4881f,null))[_0xac41('0x16')](respondWithResult(_0xd4881f,null))[_0xac41('0x27')](handleError(_0xd4881f,null));};exports['create']=function(_0x51ece2,_0x5ceaa4){return db[_0xac41('0x1f')][_0xac41('0x32')](_0x51ece2[_0xac41('0x33')],{})[_0xac41('0x16')](respondWithResult(_0x5ceaa4,0xc9))[_0xac41('0x27')](handleError(_0x5ceaa4,null));};exports[_0xac41('0x15')]=function(_0x4527ff,_0x689b74){if(_0x4527ff[_0xac41('0x33')]['id']){delete _0x4527ff[_0xac41('0x33')]['id'];}return db[_0xac41('0x1f')][_0xac41('0x31')]({'where':{'id':_0x4527ff['params']['id']}})['then'](handleEntityNotFound(_0x689b74,null))['then'](saveUpdates(_0x4527ff[_0xac41('0x33')],null))['then'](respondWithResult(_0x689b74,null))[_0xac41('0x27')](handleError(_0x689b74,null));};exports[_0xac41('0x17')]=function(_0x5f46aa,_0x2393f6){return db[_0xac41('0x1f')][_0xac41('0x31')]({'where':{'id':_0x5f46aa[_0xac41('0x28')]['id']}})['then'](handleEntityNotFound(_0x2393f6,null))[_0xac41('0x16')](removeEntity(_0x2393f6,null))['catch'](handleError(_0x2393f6,null));};exports[_0xac41('0x34')]=function(_0x38bf19,_0x2cbe9e){return db[_0xac41('0x1f')][_0xac41('0x34')]()[_0xac41('0x16')](respondWithResult(_0x2cbe9e,null))['catch'](handleError(_0x2cbe9e,null));};exports[_0xac41('0x35')]=function(_0x2a567b,_0x469a2b){return db[_0xac41('0x36')][_0xac41('0x31')]({'where':{'id':_0x2a567b[_0xac41('0x28')]['id']}})[_0xac41('0x16')](handleEntityNotFound(_0x469a2b,null))['then'](function(_0x4de587){if(_0x4de587){return _0x4de587[_0xac41('0x35')](_0x2a567b['body'][_0xac41('0x37')],_[_0xac41('0x38')](_0x2a567b[_0xac41('0x33')],[_0xac41('0x37'),'id'])||{});}})[_0xac41('0x16')](respondWithResult(_0x469a2b,null))[_0xac41('0x27')](handleError(_0x469a2b,null));};exports[_0xac41('0x39')]=function(_0x4ddc88,_0x502eac){var _0x132bbd={'raw':![],'where':{}};var _0x2da1cc={};var _0x2fb930={'count':0x0,'rows':[]};return db[_0xac41('0x1f')][_0xac41('0x3a')]({'where':{'id':_0x4ddc88[_0xac41('0x28')]['id']}})['then'](handleEntityNotFound(_0x502eac,null))['then'](function(_0x238bec){if(_0x238bec){_0x2da1cc['model']=_[_0xac41('0x2a')](db[_0xac41('0x36')]['rawAttributes']);_0x2da1cc[_0xac41('0x25')]=_[_0xac41('0x2a')](_0x4ddc88[_0xac41('0x25')]);_0x2da1cc[_0xac41('0x2b')]=_[_0xac41('0x2c')](_0x2da1cc['model'],_0x2da1cc['query']);_0x132bbd[_0xac41('0x2d')]=_[_0xac41('0x2c')](_0x2da1cc[_0xac41('0x29')],qs[_0xac41('0x2e')](_0x4ddc88[_0xac41('0x25')][_0xac41('0x2e')]));_0x132bbd['attributes']=_0x132bbd[_0xac41('0x2d')]['length']?_0x132bbd[_0xac41('0x2d')]:_0x2da1cc[_0xac41('0x29')];if(!_0x4ddc88[_0xac41('0x25')][_0xac41('0x3b')]('nolimit')){_0x132bbd[_0xac41('0x3c')]=qs[_0xac41('0x3c')](_0x4ddc88[_0xac41('0x25')][_0xac41('0x3c')]);_0x132bbd[_0xac41('0x11')]=qs['offset'](_0x4ddc88[_0xac41('0x25')][_0xac41('0x11')]);}_0x132bbd[_0xac41('0x3d')]=qs[_0xac41('0x3e')](_0x4ddc88[_0xac41('0x25')][_0xac41('0x3e')]);_0x132bbd[_0xac41('0x3f')]=qs[_0xac41('0x2b')](_['pick'](_0x4ddc88['query'],_0x2da1cc[_0xac41('0x2b')]));_0x132bbd['where']['SmsInteractionId']=_0x238bec['id'];if(_0x4ddc88[_0xac41('0x25')][_0xac41('0x40')]){_0x132bbd['where']=_[_0xac41('0x30')](_0x132bbd[_0xac41('0x3f')],{'$or':_['map'](_0x132bbd[_0xac41('0x2d')],function(_0x1b8b33){var _0x3fac4b={};_0x3fac4b[_0x1b8b33]={'$like':'%'+_0x4ddc88[_0xac41('0x25')][_0xac41('0x40')]+'%'};return _0x3fac4b;})});}if(_0x4ddc88['query']['$gte']){var _0x1f2999=_0x4ddc88[_0xac41('0x25')][_0xac41('0x41')]['split'](',');var _0x4fd249={};_0x4fd249[_0x1f2999[0x0]]={'$gte':moment(_0x1f2999[0x1])[_0xac41('0x42')](_0xac41('0x43'))};_0x132bbd[_0xac41('0x3f')]=_[_0xac41('0x30')](_0x132bbd[_0xac41('0x3f')],_0x4fd249);}_0x132bbd=_[_0xac41('0x30')]({},_0x132bbd,_0x4ddc88[_0xac41('0x44')]);return db['SmsMessage'][_0xac41('0x13')]({'where':_0x132bbd[_0xac41('0x3f')]})[_0xac41('0x16')](function(_0x1cc964){_0x2fb930['count']=_0x1cc964;if(_0x4ddc88[_0xac41('0x25')][_0xac41('0x45')]){_0x132bbd[_0xac41('0x46')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x132bbd);})[_0xac41('0x16')](function(_0x2b96e8){_0x2fb930[_0xac41('0x47')]=_0x2b96e8;return _0x2fb930;});}})[_0xac41('0x16')](respondWithFilteredResult(_0x502eac,_0x132bbd))[_0xac41('0x27')](handleError(_0x502eac,null));};exports[_0xac41('0x48')]=function(_0x217274,_0x500639){return db[_0xac41('0x1f')]['find']({'where':{'id':_0x217274[_0xac41('0x28')]['id']}})[_0xac41('0x16')](handleEntityNotFound(_0x500639,null))[_0xac41('0x16')](function(_0x4db326){if(_0x4db326){return _0x4db326[_0xac41('0x49')](_0x217274[_0xac41('0x33')][_0xac41('0x37')],_[_0xac41('0x38')](_0x217274[_0xac41('0x33')],[_0xac41('0x37'),'id'])||{})[_0xac41('0x4a')](function(){return db[_0xac41('0x4b')][_0xac41('0x23')]({'attributes':['id',_0xac41('0x1b'),_0xac41('0x4c')],'where':{'id':_0x217274[_0xac41('0x33')][_0xac41('0x37')]}});})[_0xac41('0x16')](function(_0x1599f0){socket[_0xac41('0x4d')](_0xac41('0x4e'),{'id':Number(_0x217274[_0xac41('0x28')]['id']),'tags':_0x1599f0||[]});return{'id':Number(_0x217274[_0xac41('0x28')]['id']),'tags':_0x1599f0||[]};});}})['then'](respondWithResult(_0x500639,null))[_0xac41('0x27')](handleError(_0x500639,null));};exports[_0xac41('0x4f')]=function(_0x411f0a,_0x27d93b){return db[_0xac41('0x1f')][_0xac41('0x31')]({'where':{'id':_0x411f0a[_0xac41('0x28')]['id']}})[_0xac41('0x16')](handleEntityNotFound(_0x27d93b,null))[_0xac41('0x16')](function(_0x22ab3e){if(_0x22ab3e){return _0x22ab3e['removeTags'](_0x411f0a[_0xac41('0x25')][_0xac41('0x37')]);}})['then'](respondWithStatusCode(_0x27d93b,null))[_0xac41('0x27')](handleError(_0x27d93b,null));};exports[_0xac41('0x50')]=function(_0x1b71f4,_0x534dee){var _0x5c1b0b=moment()[_0xac41('0x51')]()['toString']();var _0x216a9d=path['join'](config[_0xac41('0x52')],_0xac41('0x53'),_0xac41('0x54'),_0xac41('0x55'));var _0x235ebf=path[_0xac41('0x56')](_0x216a9d,_0x5c1b0b);var _0xd46f79=util[_0xac41('0x42')]('transcript-%d-%s.zip',_0x1b71f4[_0xac41('0x28')]['id'],_0x5c1b0b);var _0x44455a=path[_0xac41('0x56')](_0x216a9d,_0xd46f79);var _0x4ffef2=[];_0x4ffef2[_0xac41('0x57')]({'model':db[_0xac41('0x58')],'as':'User','attributes':['id',_0xac41('0x59')],'raw':!![]});_0x4ffef2[_0xac41('0x57')]({'model':db[_0xac41('0x5a')],'as':'Contact','attributes':['id','firstName',_0xac41('0x5b')],'raw':!![]});var _0x3bd08b=[{'model':db[_0xac41('0x36')],'as':'Messages','attributes':['id',_0xac41('0x33'),_0xac41('0x5c'),_0xac41('0x5d'),'secret',_0xac41('0x5e')],'include':_0x4ffef2}];_0x3bd08b[_0xac41('0x57')]({'model':db[_0xac41('0x5f')],'as':_0xac41('0x60'),'attributes':['id','name']});_0x3bd08b[_0xac41('0x57')]({'model':db[_0xac41('0x58')],'as':'Owner','attributes':['id',_0xac41('0x59')]});return db['SmsInteraction'][_0xac41('0x31')]({'where':{'id':_0x1b71f4['params']['id']},'include':_0x3bd08b})[_0xac41('0x16')](handleEntityNotFound(_0x534dee,null))['then'](function(_0x31cb17){if(_0x31cb17){var _0x143726=_0x31cb17[_0xac41('0x61')]({'plain':!![]});fs['mkdirSync'](_0x235ebf);var _0x55fb74={'channel':_0xac41('0x62'),'account':_0x143726[_0xac41('0x60')]['name'],'agent':_0x143726[_0xac41('0x63')]?_0x143726[_0xac41('0x63')][_0xac41('0x59')]:'N.A.','createdAt':moment(_0x143726['createdAt'])[_0xac41('0x42')]('YYYY-MM-DD\x20HH:mm:ss')[_0xac41('0x64')](),'closedAt':_0x143726[_0xac41('0x65')]?moment(_0x143726[_0xac41('0x66')])['format'](_0xac41('0x43'))[_0xac41('0x64')]():'','disposition':_0x143726[_0xac41('0x67')],'messages':_(_0x143726['Messages'])[_0xac41('0x40')]({'secret':![]})[_0xac41('0x1e')](function(_0x145f47){return{'date':moment(_0x145f47[_0xac41('0x5c')])[_0xac41('0x42')](_0xac41('0x43'))['toString'](),'sender':_0x145f47[_0xac41('0x5d')]===_0xac41('0x68')?_0x145f47[_0xac41('0x58')]?_0x145f47[_0xac41('0x58')][_0xac41('0x59')]:_0xac41('0x69'):_0x145f47[_0xac41('0x6a')][_0xac41('0x6b')]+(_0x145f47[_0xac41('0x6a')][_0xac41('0x5b')]?'\x20'+_0x145f47[_0xac41('0x6a')][_0xac41('0x5b')]:''),'body':_0x145f47[_0xac41('0x33')],'direction':_0x145f47['direction']===_0xac41('0x68')?'A':'C','secret':_0x145f47['secret'],'read':_0x145f47[_0xac41('0x5e')]};})[_0xac41('0x6c')]()};return ejs[_0xac41('0x6d')](path[_0xac41('0x56')](config[_0xac41('0x52')],_0xac41('0x53'),_0xac41('0x6e'),_0xac41('0x6f')),{'interaction':_0x55fb74})[_0xac41('0x16')](function(_0x26beb4){var _0x3d61aa=path[_0xac41('0x56')](_0x235ebf,'transcript-'+_0x143726['id']+'-'+_0x5c1b0b+_0xac41('0x70'));var _0x2bec90={'path':_0x3d61aa,'channel':_0xac41('0x62'),'interactionId':_0x143726['id']};return pdf['createPdfFromHTML'](_0x26beb4,_0x2bec90);})[_0xac41('0x16')](function(){return new BPromise(function(_0x15e279,_0xbfe906){zipdir(_0x235ebf,{'saveTo':_0x44455a},function(_0x26112f,_0x1f5597){if(_0x26112f)return _0xbfe906(_0x26112f);return _0x15e279(_0x1f5597);});})[_0xac41('0x16')](function(){return new BPromise(function(_0x2fece9,_0xc89a4b){rimraf(_0x235ebf,function(_0x33dc72){if(_0x33dc72)_0xc89a4b(_0x33dc72);return _0x2fece9();});});})[_0xac41('0x16')](function(){return _0x534dee[_0xac41('0x50')](_0x44455a,_0xd46f79,function(_0x10dc76){if(_0x10dc76){console[_0xac41('0x71')](_0xac41('0x72'),_0x10dc76);}else{fs[_0xac41('0x73')](_0x44455a);}});});});}else{return _0x534dee[_0xac41('0x18')](0xc8);}})[_0xac41('0x27')](handleError(_0x534dee,null));}; \ No newline at end of file +var _0x1075=['send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','sort','pick','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','transcript-%d-%s.zip','join','User','fullname','push','CmContact','Contact','firstName','lastName','createdAt','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','toString','closed','closedAt','disposition','Messages','out','System','read','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','end','json','undefined','count','offset','limit','set','then','destroy','status','error','name'];(function(_0x5d3cef,_0x4f4c6c){var _0x19ac6e=function(_0x2de9c4){while(--_0x2de9c4){_0x5d3cef['push'](_0x5d3cef['shift']());}};_0x19ac6e(++_0x4f4c6c);}(_0x1075,0xda));var _0x5107=function(_0x3e2e40,_0x5e42ed){_0x3e2e40=_0x3e2e40-0x0;var _0x3cdf0a=_0x1075[_0x3e2e40];return _0x3cdf0a;};'use strict';var rimraf=require(_0x5107('0x0'));var zipdir=require(_0x5107('0x1'));var moment=require('moment');var BPromise=require(_0x5107('0x2'));var util=require(_0x5107('0x3'));var path=require(_0x5107('0x4'));var ejs=require(_0x5107('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x5107('0x6'));var pdf=require(_0x5107('0x7'));var logger=require('../../config/logger')(_0x5107('0x8'));var config=require(_0x5107('0x9'));var db=require(_0x5107('0xa'))['db'];config[_0x5107('0xb')]=_['defaults'](config['redis'],{'host':_0x5107('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5107('0xd'))[_0x5107('0xe')](socket);function respondWithStatusCode(_0x4cef02,_0x1f9b0d){_0x1f9b0d=_0x1f9b0d||0xcc;return function(_0x3670ca){if(_0x3670ca){return _0x4cef02[_0x5107('0xf')](_0x1f9b0d);}return _0x4cef02['status'](_0x1f9b0d)[_0x5107('0x10')]();};}function respondWithResult(_0x169946,_0x15da65){_0x15da65=_0x15da65||0xc8;return function(_0x21828c){if(_0x21828c){return _0x169946['status'](_0x15da65)[_0x5107('0x11')](_0x21828c);}};}function respondWithFilteredResult(_0x3a0940,_0x5a2c89){return function(_0x592386){if(_0x592386){var _0x263e2e=typeof _0x5a2c89['offset']==='undefined'&&typeof _0x5a2c89['limit']===_0x5107('0x12');var _0x1d4a1e=_0x592386[_0x5107('0x13')];var _0x45dd87=_0x263e2e?0x0:_0x5a2c89[_0x5107('0x14')];var _0x3e478a=_0x263e2e?_0x592386[_0x5107('0x13')]:_0x5a2c89[_0x5107('0x14')]+_0x5a2c89[_0x5107('0x15')];var _0x20cf7c;if(_0x3e478a>=_0x1d4a1e){_0x3e478a=_0x1d4a1e;_0x20cf7c=0xc8;}else{_0x20cf7c=0xce;}_0x3a0940['status'](_0x20cf7c);return _0x3a0940[_0x5107('0x16')]('Content-Range',_0x45dd87+'-'+_0x3e478a+'/'+_0x1d4a1e)['json'](_0x592386);}return null;};}function saveUpdates(_0x370295){return function(_0x52eaad){if(_0x52eaad){return _0x52eaad['update'](_0x370295)[_0x5107('0x17')](function(_0x2b3c68){return _0x2b3c68;});}return null;};}function removeEntity(_0x227929){return function(_0x5cec07){if(_0x5cec07){return _0x5cec07[_0x5107('0x18')]()['then'](function(){_0x227929[_0x5107('0x19')](0xcc)[_0x5107('0x10')]();});}};}function handleEntityNotFound(_0x50abcf){return function(_0x55d57b){if(!_0x55d57b){_0x50abcf[_0x5107('0xf')](0x194);}return _0x55d57b;};}function handleError(_0x246e59,_0x2b5d14){_0x2b5d14=_0x2b5d14||0x1f4;return function(_0x41da3e){logger[_0x5107('0x1a')](_0x41da3e['stack']);if(_0x41da3e[_0x5107('0x1b')]){delete _0x41da3e[_0x5107('0x1b')];}_0x246e59[_0x5107('0x19')](_0x2b5d14)[_0x5107('0x1c')](_0x41da3e);};}exports[_0x5107('0x1d')]=function(_0x38c714,_0x7c122){var _0xbd434a={};var _0x4810bd=_[_0x5107('0x1e')](db[_0x5107('0x1f')][_0x5107('0x20')],function(_0x2a0515){return{'name':_0x2a0515[_0x5107('0x21')],'type':_0x2a0515[_0x5107('0x22')][_0x5107('0x23')]};});_0xbd434a=qs[_0x5107('0x24')](_0x4810bd,_0x38c714);return interaction['findAll']('sms',_0x38c714[_0x5107('0x25')],_0x38c714[_0x5107('0x26')],_0xbd434a,_0x4810bd)[_0x5107('0x17')](respondWithFilteredResult(_0x7c122,_0xbd434a))[_0x5107('0x27')](handleError(_0x7c122,null));};exports[_0x5107('0x28')]=function(_0x3d0c69,_0x189dd9){var _0x2918ab={'raw':![],'where':{'id':_0x3d0c69[_0x5107('0x29')]['id']}},_0x1ad175={};_0x1ad175[_0x5107('0x2a')]=_[_0x5107('0x2b')](db[_0x5107('0x1f')]['rawAttributes']);_0x1ad175[_0x5107('0x25')]=_['keys'](_0x3d0c69[_0x5107('0x25')]);_0x1ad175[_0x5107('0x2c')]=_['intersection'](_0x1ad175[_0x5107('0x2a')],_0x1ad175[_0x5107('0x25')]);_0x2918ab[_0x5107('0x2d')]=_[_0x5107('0x2e')](_0x1ad175[_0x5107('0x2a')],qs[_0x5107('0x2f')](_0x3d0c69[_0x5107('0x25')][_0x5107('0x2f')]));_0x2918ab[_0x5107('0x2d')]=_0x2918ab[_0x5107('0x2d')][_0x5107('0x30')]?_0x2918ab[_0x5107('0x2d')]:_0x1ad175['model'];if(_0x3d0c69[_0x5107('0x25')][_0x5107('0x31')]){_0x2918ab[_0x5107('0x32')]=[{'all':!![]}];}_0x2918ab=_[_0x5107('0x33')]({},_0x2918ab,_0x3d0c69[_0x5107('0x34')]);return db[_0x5107('0x1f')][_0x5107('0x35')](_0x2918ab)[_0x5107('0x17')](handleEntityNotFound(_0x189dd9,null))[_0x5107('0x17')](respondWithResult(_0x189dd9,null))[_0x5107('0x27')](handleError(_0x189dd9,null));};exports[_0x5107('0x36')]=function(_0x5164a8,_0x10c32f){return db[_0x5107('0x1f')][_0x5107('0x36')](_0x5164a8[_0x5107('0x37')],{})[_0x5107('0x17')](respondWithResult(_0x10c32f,0xc9))[_0x5107('0x27')](handleError(_0x10c32f,null));};exports['update']=function(_0x5155ce,_0x3fdba7){if(_0x5155ce[_0x5107('0x37')]['id']){delete _0x5155ce['body']['id'];}return db[_0x5107('0x1f')][_0x5107('0x35')]({'where':{'id':_0x5155ce[_0x5107('0x29')]['id']}})[_0x5107('0x17')](handleEntityNotFound(_0x3fdba7,null))[_0x5107('0x17')](saveUpdates(_0x5155ce['body'],null))['then'](respondWithResult(_0x3fdba7,null))[_0x5107('0x27')](handleError(_0x3fdba7,null));};exports[_0x5107('0x18')]=function(_0x270928,_0x2faae7){return db['SmsInteraction'][_0x5107('0x35')]({'where':{'id':_0x270928[_0x5107('0x29')]['id']}})[_0x5107('0x17')](handleEntityNotFound(_0x2faae7,null))[_0x5107('0x17')](removeEntity(_0x2faae7,null))[_0x5107('0x27')](handleError(_0x2faae7,null));};exports[_0x5107('0x38')]=function(_0x2c9a86,_0x3757c6){return db['SmsInteraction']['describe']()[_0x5107('0x17')](respondWithResult(_0x3757c6,null))[_0x5107('0x27')](handleError(_0x3757c6,null));};exports['addMessage']=function(_0x1b2f4c,_0x49f242){return db['SmsMessage']['find']({'where':{'id':_0x1b2f4c[_0x5107('0x29')]['id']}})[_0x5107('0x17')](handleEntityNotFound(_0x49f242,null))['then'](function(_0x2a82eb){if(_0x2a82eb){return _0x2a82eb[_0x5107('0x39')](_0x1b2f4c[_0x5107('0x37')][_0x5107('0x3a')],_[_0x5107('0x3b')](_0x1b2f4c[_0x5107('0x37')],['ids','id'])||{});}})[_0x5107('0x17')](respondWithResult(_0x49f242,null))['catch'](handleError(_0x49f242,null));};exports[_0x5107('0x3c')]=function(_0x4f8dc9,_0xe07e8b){var _0x3d1178={'raw':![],'where':{}};var _0x4c6ff4={};var _0x4ecf3b={'count':0x0,'rows':[]};return db[_0x5107('0x1f')][_0x5107('0x3d')]({'where':{'id':_0x4f8dc9['params']['id']}})[_0x5107('0x17')](handleEntityNotFound(_0xe07e8b,null))[_0x5107('0x17')](function(_0x3814ca){if(_0x3814ca){_0x4c6ff4[_0x5107('0x2a')]=_['keys'](db[_0x5107('0x3e')][_0x5107('0x20')]);_0x4c6ff4[_0x5107('0x25')]=_[_0x5107('0x2b')](_0x4f8dc9['query']);_0x4c6ff4[_0x5107('0x2c')]=_['intersection'](_0x4c6ff4[_0x5107('0x2a')],_0x4c6ff4[_0x5107('0x25')]);_0x3d1178[_0x5107('0x2d')]=_[_0x5107('0x2e')](_0x4c6ff4[_0x5107('0x2a')],qs['fields'](_0x4f8dc9[_0x5107('0x25')][_0x5107('0x2f')]));_0x3d1178[_0x5107('0x2d')]=_0x3d1178[_0x5107('0x2d')][_0x5107('0x30')]?_0x3d1178['attributes']:_0x4c6ff4[_0x5107('0x2a')];if(!_0x4f8dc9[_0x5107('0x25')][_0x5107('0x3f')](_0x5107('0x40'))){_0x3d1178['limit']=qs['limit'](_0x4f8dc9[_0x5107('0x25')][_0x5107('0x15')]);_0x3d1178['offset']=qs[_0x5107('0x14')](_0x4f8dc9[_0x5107('0x25')]['offset']);}_0x3d1178['order']=qs[_0x5107('0x41')](_0x4f8dc9[_0x5107('0x25')][_0x5107('0x41')]);_0x3d1178['where']=qs[_0x5107('0x2c')](_[_0x5107('0x42')](_0x4f8dc9['query'],_0x4c6ff4[_0x5107('0x2c')]));_0x3d1178[_0x5107('0x43')][_0x5107('0x44')]=_0x3814ca['id'];if(_0x4f8dc9['query']['filter']){_0x3d1178[_0x5107('0x43')]=_['merge'](_0x3d1178[_0x5107('0x43')],{'$or':_[_0x5107('0x1e')](_0x3d1178['attributes'],function(_0x47827a){var _0x16397b={};_0x16397b[_0x47827a]={'$like':'%'+_0x4f8dc9[_0x5107('0x25')][_0x5107('0x45')]+'%'};return _0x16397b;})});}if(_0x4f8dc9[_0x5107('0x25')][_0x5107('0x46')]){var _0x9890b3=_0x4f8dc9['query'][_0x5107('0x46')][_0x5107('0x47')](',');var _0x4e261d={};_0x4e261d[_0x9890b3[0x0]]={'$gte':moment(_0x9890b3[0x1])[_0x5107('0x48')](_0x5107('0x49'))};_0x3d1178[_0x5107('0x43')]=_[_0x5107('0x33')](_0x3d1178[_0x5107('0x43')],_0x4e261d);}_0x3d1178=_[_0x5107('0x33')]({},_0x3d1178,_0x4f8dc9[_0x5107('0x34')]);return db['SmsMessage'][_0x5107('0x13')]({'where':_0x3d1178['where']})[_0x5107('0x17')](function(_0x236f82){_0x4ecf3b[_0x5107('0x13')]=_0x236f82;if(_0x4f8dc9[_0x5107('0x25')][_0x5107('0x31')]){_0x3d1178[_0x5107('0x32')]=[{'all':!![]}];}return db[_0x5107('0x3e')][_0x5107('0x4a')](_0x3d1178);})[_0x5107('0x17')](function(_0x16780c){_0x4ecf3b[_0x5107('0x4b')]=_0x16780c;return _0x4ecf3b;});}})[_0x5107('0x17')](respondWithFilteredResult(_0xe07e8b,_0x3d1178))[_0x5107('0x27')](handleError(_0xe07e8b,null));};exports[_0x5107('0x4c')]=function(_0x5f46de,_0x35be1a){return db[_0x5107('0x1f')]['find']({'where':{'id':_0x5f46de['params']['id']}})['then'](handleEntityNotFound(_0x35be1a,null))[_0x5107('0x17')](function(_0x131876){if(_0x131876){return _0x131876[_0x5107('0x4d')](_0x5f46de[_0x5107('0x37')]['ids'],_[_0x5107('0x3b')](_0x5f46de[_0x5107('0x37')],[_0x5107('0x3a'),'id'])||{})[_0x5107('0x4e')](function(){return db[_0x5107('0x4f')][_0x5107('0x4a')]({'attributes':['id','name',_0x5107('0x50')],'where':{'id':_0x5f46de[_0x5107('0x37')][_0x5107('0x3a')]}});})[_0x5107('0x17')](function(_0x51c3d0){socket[_0x5107('0x51')](_0x5107('0x52'),{'id':Number(_0x5f46de[_0x5107('0x29')]['id']),'tags':_0x51c3d0||[]});return{'id':Number(_0x5f46de['params']['id']),'tags':_0x51c3d0||[]};});}})[_0x5107('0x17')](respondWithResult(_0x35be1a,null))[_0x5107('0x27')](handleError(_0x35be1a,null));};exports[_0x5107('0x53')]=function(_0x3f3953,_0x44473e){return db[_0x5107('0x1f')][_0x5107('0x35')]({'where':{'id':_0x3f3953['params']['id']}})['then'](handleEntityNotFound(_0x44473e,null))[_0x5107('0x17')](function(_0x139565){if(_0x139565){return _0x139565['removeTags'](_0x3f3953[_0x5107('0x25')][_0x5107('0x3a')]);}})['then'](respondWithStatusCode(_0x44473e,null))[_0x5107('0x27')](handleError(_0x44473e,null));};exports[_0x5107('0x54')]=function(_0x22c326,_0x5786bc){var _0x2ee1fb=moment()[_0x5107('0x55')]()['toString']();var _0x1c5c7e=path['join'](config[_0x5107('0x56')],_0x5107('0x57'),'files',_0x5107('0x58'));var _0x5a9747=path['join'](_0x1c5c7e,_0x2ee1fb);var _0x179bc6=util[_0x5107('0x48')](_0x5107('0x59'),_0x22c326['params']['id'],_0x2ee1fb);var _0x254312=path[_0x5107('0x5a')](_0x1c5c7e,_0x179bc6);var _0x195fb4=[];_0x195fb4['push']({'model':db['User'],'as':_0x5107('0x5b'),'attributes':['id',_0x5107('0x5c')],'raw':!![]});_0x195fb4[_0x5107('0x5d')]({'model':db[_0x5107('0x5e')],'as':_0x5107('0x5f'),'attributes':['id',_0x5107('0x60'),_0x5107('0x61')],'raw':!![]});var _0x1342d4=[{'model':db[_0x5107('0x3e')],'as':'Messages','attributes':['id',_0x5107('0x37'),_0x5107('0x62'),_0x5107('0x63'),_0x5107('0x64'),'read'],'include':_0x195fb4}];_0x1342d4[_0x5107('0x5d')]({'model':db[_0x5107('0x65')],'as':_0x5107('0x66'),'attributes':['id','name']});_0x1342d4[_0x5107('0x5d')]({'model':db[_0x5107('0x5b')],'as':_0x5107('0x67'),'attributes':['id','fullname']});return db[_0x5107('0x1f')][_0x5107('0x35')]({'where':{'id':_0x22c326[_0x5107('0x29')]['id']},'include':_0x1342d4})[_0x5107('0x17')](handleEntityNotFound(_0x5786bc,null))[_0x5107('0x17')](function(_0x25310e){if(_0x25310e){var _0x372919=_0x25310e[_0x5107('0x68')]({'plain':!![]});fs[_0x5107('0x69')](_0x5a9747);var _0x554663={'channel':_0x5107('0x6a'),'account':_0x372919[_0x5107('0x66')][_0x5107('0x1b')],'agent':_0x372919[_0x5107('0x67')]?_0x372919[_0x5107('0x67')][_0x5107('0x5c')]:'N.A.','createdAt':moment(_0x372919['createdAt'])[_0x5107('0x48')](_0x5107('0x49'))[_0x5107('0x6b')](),'closedAt':_0x372919[_0x5107('0x6c')]?moment(_0x372919[_0x5107('0x6d')])[_0x5107('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x372919[_0x5107('0x6e')],'messages':_(_0x372919[_0x5107('0x6f')])['filter']({'secret':![]})[_0x5107('0x1e')](function(_0xaebf0f){return{'date':moment(_0xaebf0f[_0x5107('0x62')])[_0x5107('0x48')](_0x5107('0x49'))['toString'](),'sender':_0xaebf0f[_0x5107('0x63')]===_0x5107('0x70')?_0xaebf0f[_0x5107('0x5b')]?_0xaebf0f['User'][_0x5107('0x5c')]:_0x5107('0x71'):_0xaebf0f[_0x5107('0x5f')][_0x5107('0x60')]+(_0xaebf0f[_0x5107('0x5f')][_0x5107('0x61')]?'\x20'+_0xaebf0f[_0x5107('0x5f')]['lastName']:''),'body':_0xaebf0f[_0x5107('0x37')],'direction':_0xaebf0f[_0x5107('0x63')]==='out'?'A':'C','secret':_0xaebf0f['secret'],'read':_0xaebf0f[_0x5107('0x72')]};})[_0x5107('0x73')]()};return ejs[_0x5107('0x74')](path[_0x5107('0x5a')](config['root'],'server',_0x5107('0x75'),'downloadInteraction.ejs'),{'interaction':_0x554663})[_0x5107('0x17')](function(_0x490d8e){var _0x4e385c=path['join'](_0x5a9747,_0x5107('0x76')+_0x372919['id']+'-'+_0x2ee1fb+_0x5107('0x77'));var _0x29a078={'path':_0x4e385c,'channel':_0x5107('0x6a'),'interactionId':_0x372919['id']};return pdf[_0x5107('0x78')](_0x490d8e,_0x29a078);})[_0x5107('0x17')](function(){return new BPromise(function(_0x49bb09,_0x3b07c0){zipdir(_0x5a9747,{'saveTo':_0x254312},function(_0x2e70b6,_0x1a0359){if(_0x2e70b6)return _0x3b07c0(_0x2e70b6);return _0x49bb09(_0x1a0359);});})['then'](function(){return new BPromise(function(_0x10e682,_0x707e46){rimraf(_0x5a9747,function(_0x6c2bd7){if(_0x6c2bd7)_0x707e46(_0x6c2bd7);return _0x10e682();});});})['then'](function(){return _0x5786bc[_0x5107('0x54')](_0x254312,_0x179bc6,function(_0x5c8307){if(_0x5c8307){console[_0x5107('0x79')]('err',_0x5c8307);}else{fs[_0x5107('0x7a')](_0x254312);}});});});}else{return _0x5786bc[_0x5107('0xf')](0xc8);}})[_0x5107('0x27')](handleError(_0x5786bc,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7f34fa6..efd53a0 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 _0x430c=['setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hook','events','../../mysqldb','SmsMessage'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x430c,0x1a1));var _0xc430=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x430c[_0x1fdb40];return _0x281f93;};'use strict';var EventEmitter=require(_0xc430('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xc430('0x1'))['db'][_0xc430('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc430('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d8b9){return function(_0x338a82,_0x2408f5,_0x50b256){_0x338a82[_0xc430('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x212354){_0x338a82[_0xc430('0x5')](_0xc430('0x6'),_0x212354[_0xc430('0x7')](function(_0x2e23f8){return{'id':_0x2e23f8['id']};}));return SmsMessage[_0xc430('0x8')]({'where':{'SmsInteractionId':_0x338a82['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc430('0x9')](function(_0x115814){_0x338a82[_0xc430('0x5')]('unreadMessages',_0x115814[_0xc430('0xa')]);SmsInteractionEvents[_0xc430('0xb')](_0x47d8b9+':'+_0x338a82['id'],_0x338a82);SmsInteractionEvents['emit'](_0x47d8b9,_0x338a82);_0x50b256(null);})[_0xc430('0xc')](_0x50b256(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc430('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x489166,_0x11d528){var _0x14b562=function(_0x44695b){while(--_0x44695b){_0x489166['push'](_0x489166['shift']());}};_0x14b562(++_0x11d528);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3acbfb4..1c65cff 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 _0x5b67=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions'];(function(_0x4d9ac1,_0x38af72){var _0x212b93=function(_0x193eb8){while(--_0x193eb8){_0x4d9ac1['push'](_0x4d9ac1['shift']());}};_0x212b93(++_0x38af72);}(_0x5b67,0xe4));var _0x75b6=function(_0x38d405,_0x285127){_0x38d405=_0x38d405-0x0;var _0xb357f7=_0x5b67[_0x38d405];return _0xb357f7;};'use strict';var _=require('lodash');var util=require(_0x75b6('0x0'));var logger=require(_0x75b6('0x1'))(_0x75b6('0x2'));var moment=require(_0x75b6('0x3'));var BPromise=require(_0x75b6('0x4'));var rp=require(_0x75b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75b6('0x6'));var config=require(_0x75b6('0x7'));var attributes=require(_0x75b6('0x8'));module[_0x75b6('0x9')]=function(_0x28f4ee,_0x4f7c4d){return _0x28f4ee['define'](_0x75b6('0xa'),attributes,{'tableName':_0x75b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f3c40,_0x4cc984,_0x7a5485){if(_0x3f3c40['changed']('closed')){_0x3f3c40[_0x75b6('0xc')]=moment()[_0x75b6('0xd')](_0x75b6('0xe'));}_0x7a5485(null,_0x3f3c40);}}});}; \ No newline at end of file +var _0x2a70=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2a70,0x1bc));var _0x02a7=function(_0x43ecb6,_0x333ff5){_0x43ecb6=_0x43ecb6-0x0;var _0x38f477=_0x2a70[_0x43ecb6];return _0x38f477;};'use strict';var _=require('lodash');var util=require(_0x02a7('0x0'));var logger=require(_0x02a7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x02a7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02a7('0x3'));var rimraf=require(_0x02a7('0x4'));var config=require(_0x02a7('0x5'));var attributes=require(_0x02a7('0x6'));module[_0x02a7('0x7')]=function(_0x6c47c1,_0xbc03be){return _0x6c47c1[_0x02a7('0x8')](_0x02a7('0x9'),attributes,{'tableName':_0x02a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x75d8c0,_0x5e0648,_0x325a11){if(_0x75d8c0[_0x02a7('0xb')](_0x02a7('0xc'))){_0x75d8c0[_0x02a7('0xd')]=moment()['format'](_0x02a7('0xe'));}_0x325a11(null,_0x75d8c0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d233479..3a31bc8 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 _0xc2b4=['options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateSmsInteraction','update','body'];(function(_0x522e32,_0x440e6d){var _0x216842=function(_0x467028){while(--_0x467028){_0x522e32['push'](_0x522e32['shift']());}};_0x216842(++_0x440e6d);}(_0xc2b4,0xec));var _0x4c2b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c2b('0x0'));var util=require(_0x4c2b('0x1'));var moment=require(_0x4c2b('0x2'));var BPromise=require(_0x4c2b('0x3'));var rs=require(_0x4c2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c2b('0x5'))['db'];var utils=require(_0x4c2b('0x6'));var logger=require(_0x4c2b('0x7'))('rpc');var config=require(_0x4c2b('0x8'));var jayson=require(_0x4c2b('0x9'));var client=jayson[_0x4c2b('0xa')][_0x4c2b('0xb')]({'port':0x232a});config[_0x4c2b('0xc')]=_[_0x4c2b('0xd')](config[_0x4c2b('0xc')],{'host':_0x4c2b('0xe'),'port':0x18eb});var socket=require(_0x4c2b('0xf'))(new Redis(config[_0x4c2b('0xc')]));require(_0x4c2b('0x10'))[_0x4c2b('0x11')](socket);function respondWithRpcPromise(_0x472fa9,_0x1d0dcc,_0x3ed1d9){return new BPromise(function(_0x2a8772,_0x301dab){return client[_0x4c2b('0x12')](_0x472fa9,_0x3ed1d9)[_0x4c2b('0x13')](function(_0x13edb7){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x1d0dcc,_0x4c2b('0x14'));logger[_0x4c2b('0x15')](_0x4c2b('0x16'),_0x1d0dcc,_0x4c2b('0x14'),JSON[_0x4c2b('0x17')](_0x13edb7));if(_0x13edb7[_0x4c2b('0x18')]){if(_0x13edb7[_0x4c2b('0x18')][_0x4c2b('0x19')]===0x1f4){logger[_0x4c2b('0x18')](_0x4c2b('0x1a'),_0x1d0dcc,_0x13edb7[_0x4c2b('0x18')]['message']);return _0x301dab(_0x13edb7[_0x4c2b('0x18')]['message']);}logger['error'](_0x4c2b('0x1a'),_0x1d0dcc,_0x13edb7[_0x4c2b('0x18')][_0x4c2b('0x1b')]);return _0x2a8772(_0x13edb7[_0x4c2b('0x18')][_0x4c2b('0x1b')]);}else{logger[_0x4c2b('0x1c')](_0x4c2b('0x1a'),_0x1d0dcc,'request\x20sent');_0x2a8772(_0x13edb7[_0x4c2b('0x1d')][_0x4c2b('0x1b')]);}})[_0x4c2b('0x1e')](function(_0x5bb626){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x1d0dcc,_0x5bb626);_0x301dab(_0x5bb626);});});}exports[_0x4c2b('0x1f')]=function(_0x347cb4){var _0x407bf8=this;return new Promise(function(_0x5fa935,_0x56b648){return db['SmsInteraction'][_0x4c2b('0x20')](_0x347cb4[_0x4c2b('0x21')],{'raw':_0x347cb4[_0x4c2b('0x22')]?_0x347cb4[_0x4c2b('0x22')][_0x4c2b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347cb4[_0x4c2b('0x22')]?_0x347cb4[_0x4c2b('0x22')][_0x4c2b('0x24')]||null:null,'attributes':_0x347cb4[_0x4c2b('0x22')]?_0x347cb4[_0x4c2b('0x22')][_0x4c2b('0x25')]||null:null,'limit':_0x347cb4['options']?_0x347cb4[_0x4c2b('0x22')][_0x4c2b('0x26')]||null:null})[_0x4c2b('0x13')](function(_0x281978){logger[_0x4c2b('0x1c')](_0x4c2b('0x1f'),_0x347cb4);logger['debug'](_0x4c2b('0x1f'),_0x347cb4,JSON[_0x4c2b('0x17')](_0x281978));_0x5fa935(_0x281978);})[_0x4c2b('0x1e')](function(_0x3a100f){logger[_0x4c2b('0x18')](_0x4c2b('0x1f'),_0x3a100f[_0x4c2b('0x1b')],_0x347cb4);_0x56b648(_0x407bf8[_0x4c2b('0x18')](0x1f4,_0x3a100f[_0x4c2b('0x1b')]));});});};exports[_0x4c2b('0x27')]=function(_0x46f1b2){return new Promise(function(_0x53f301,_0x56dc07){return db['SmsInteraction'][_0x4c2b('0x28')]({'where':_0x46f1b2[_0x4c2b('0x22')]?_0x46f1b2[_0x4c2b('0x22')]['where']||null:null})[_0x4c2b('0x13')](function(_0x2d4bcd){if(_0x2d4bcd){return _0x2d4bcd['addTags'](_0x46f1b2['body']['ids'],_[_0x4c2b('0x29')](_0x46f1b2[_0x4c2b('0x21')],[_0x4c2b('0x2a'),'id'])||{});}})[_0x4c2b('0x2b')](function(_0x5432cd){logger[_0x4c2b('0x1c')](_0x4c2b('0x2c'),_0x46f1b2);logger[_0x4c2b('0x15')](_0x4c2b('0x2c'),_0x46f1b2,JSON[_0x4c2b('0x17')](_0x5432cd));_0x53f301(_0x5432cd);})[_0x4c2b('0x1e')](function(_0x252c12){logger[_0x4c2b('0x18')]('AddTags',_0x252c12[_0x4c2b('0x1b')],_0x46f1b2);_0x56dc07(_this[_0x4c2b('0x18')](0x1f4,_0x252c12[_0x4c2b('0x1b')]));});});}; \ No newline at end of file +var _0xfdb0=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','update','options','raw','where','limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s'];(function(_0x6b3f9c,_0x433d66){var _0x4178e3=function(_0x13136f){while(--_0x13136f){_0x6b3f9c['push'](_0x6b3f9c['shift']());}};_0x4178e3(++_0x433d66);}(_0xfdb0,0x126));var _0x0fdb=function(_0x56247f,_0x570358){_0x56247f=_0x56247f-0x0;var _0x5dd6c0=_0xfdb0[_0x56247f];return _0x5dd6c0;};'use strict';var _=require(_0x0fdb('0x0'));var util=require('util');var moment=require(_0x0fdb('0x1'));var BPromise=require(_0x0fdb('0x2'));var rs=require(_0x0fdb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fdb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fdb('0x5'))(_0x0fdb('0x6'));var config=require(_0x0fdb('0x7'));var jayson=require(_0x0fdb('0x8'));var client=jayson[_0x0fdb('0x9')]['http']({'port':0x232a});config[_0x0fdb('0xa')]=_[_0x0fdb('0xb')](config[_0x0fdb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fdb('0xc'))(new Redis(config[_0x0fdb('0xa')]));require('./smsInteraction.socket')[_0x0fdb('0xd')](socket);function respondWithRpcPromise(_0x157720,_0x60207c,_0x1bd0ef){return new BPromise(function(_0x2f151e,_0x5d945e){return client[_0x0fdb('0xe')](_0x157720,_0x1bd0ef)[_0x0fdb('0xf')](function(_0x5637bf){logger[_0x0fdb('0x10')](_0x0fdb('0x11'),_0x60207c,_0x0fdb('0x12'));logger[_0x0fdb('0x13')](_0x0fdb('0x14'),_0x60207c,_0x0fdb('0x12'),JSON[_0x0fdb('0x15')](_0x5637bf));if(_0x5637bf[_0x0fdb('0x16')]){if(_0x5637bf[_0x0fdb('0x16')]['code']===0x1f4){logger[_0x0fdb('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x60207c,_0x5637bf[_0x0fdb('0x16')][_0x0fdb('0x17')]);return _0x5d945e(_0x5637bf[_0x0fdb('0x16')][_0x0fdb('0x17')]);}logger['error'](_0x0fdb('0x11'),_0x60207c,_0x5637bf['error'][_0x0fdb('0x17')]);return _0x2f151e(_0x5637bf['error'][_0x0fdb('0x17')]);}else{logger['info'](_0x0fdb('0x11'),_0x60207c,_0x0fdb('0x12'));_0x2f151e(_0x5637bf['result'][_0x0fdb('0x17')]);}})[_0x0fdb('0x18')](function(_0x83e669){logger[_0x0fdb('0x16')](_0x0fdb('0x11'),_0x60207c,_0x83e669);_0x5d945e(_0x83e669);});});}exports[_0x0fdb('0x19')]=function(_0x2f8bd1){var _0x4985a3=this;return new Promise(function(_0xe7b88a,_0x420cb5){return db['SmsInteraction'][_0x0fdb('0x1a')](_0x2f8bd1['body'],{'raw':_0x2f8bd1[_0x0fdb('0x1b')]?_0x2f8bd1[_0x0fdb('0x1b')][_0x0fdb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8bd1[_0x0fdb('0x1b')]?_0x2f8bd1[_0x0fdb('0x1b')][_0x0fdb('0x1d')]||null:null,'attributes':_0x2f8bd1[_0x0fdb('0x1b')]?_0x2f8bd1['options']['attributes']||null:null,'limit':_0x2f8bd1[_0x0fdb('0x1b')]?_0x2f8bd1['options'][_0x0fdb('0x1e')]||null:null})['then'](function(_0x28eaad){logger[_0x0fdb('0x10')]('UpdateSmsInteraction',_0x2f8bd1);logger['debug']('UpdateSmsInteraction',_0x2f8bd1,JSON[_0x0fdb('0x15')](_0x28eaad));_0xe7b88a(_0x28eaad);})['catch'](function(_0xfa3a16){logger[_0x0fdb('0x16')]('UpdateSmsInteraction',_0xfa3a16[_0x0fdb('0x17')],_0x2f8bd1);_0x420cb5(_0x4985a3[_0x0fdb('0x16')](0x1f4,_0xfa3a16['message']));});});};exports[_0x0fdb('0x1f')]=function(_0x174732){return new Promise(function(_0x3c923e,_0x1565d2){return db[_0x0fdb('0x20')][_0x0fdb('0x21')]({'where':_0x174732['options']?_0x174732[_0x0fdb('0x1b')][_0x0fdb('0x1d')]||null:null})['then'](function(_0x19651a){if(_0x19651a){return _0x19651a[_0x0fdb('0x22')](_0x174732[_0x0fdb('0x23')][_0x0fdb('0x24')],_[_0x0fdb('0x25')](_0x174732[_0x0fdb('0x23')],[_0x0fdb('0x24'),'id'])||{});}})['spread'](function(_0x5bceef){logger[_0x0fdb('0x10')](_0x0fdb('0x26'),_0x174732);logger[_0x0fdb('0x13')](_0x0fdb('0x26'),_0x174732,JSON[_0x0fdb('0x15')](_0x5bceef));_0x3c923e(_0x5bceef);})['catch'](function(_0x1c015b){logger[_0x0fdb('0x16')]('AddTags',_0x1c015b['message'],_0x174732);_0x1565d2(_this[_0x0fdb('0x16')](0x1f4,_0x1c015b[_0x0fdb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0d929d8..475c052 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 _0xe1f5=['remove','update','emit','removeListener','register','save'];(function(_0x2bf5fa,_0x58ec00){var _0x33b534=function(_0x5a4c86){while(--_0x5a4c86){_0x2bf5fa['push'](_0x2bf5fa['shift']());}};_0x33b534(++_0x58ec00);}(_0xe1f5,0x185));var _0x5e1f=function(_0x463c84,_0x28077c){_0x463c84=_0x463c84-0x0;var _0x3009ab=_0xe1f5[_0x463c84];return _0x3009ab;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x5e1f('0x0'),_0x5e1f('0x1'),_0x5e1f('0x2')];function createListener(_0x3067e7,_0x1629b5){return function(_0x62d09c){_0x1629b5[_0x5e1f('0x3')](_0x3067e7,_0x62d09c);};}function removeListener(_0x104de5,_0x3e84af){return function(){SmsInteractionEvents[_0x5e1f('0x4')](_0x104de5,_0x3e84af);};}exports[_0x5e1f('0x5')]=function(_0x4c7af6){for(var _0x33f639=0x0,_0x3649db=events['length'];_0x33f639<_0x3649db;_0x33f639++){var _0x57686e=events[_0x33f639];var _0x430f36=createListener('smsInteraction:'+_0x57686e,_0x4c7af6);SmsInteractionEvents['on'](_0x57686e,_0x430f36);}}; \ No newline at end of file +var _0x23e7=['save','remove','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x361066,_0x3213f9){var _0x320783=function(_0x1f14a0){while(--_0x1f14a0){_0x361066['push'](_0x361066['shift']());}};_0x320783(++_0x3213f9);}(_0x23e7,0x14f));var _0x723e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x23e7[_0x4c7fb5];return _0x2e10ac;};'use strict';var SmsInteractionEvents=require(_0x723e('0x0'));var events=[_0x723e('0x1'),_0x723e('0x2'),'update'];function createListener(_0x27b214,_0x49b010){return function(_0x2d63c7){_0x49b010[_0x723e('0x3')](_0x27b214,_0x2d63c7);};}function removeListener(_0x25252a,_0x2e2a53){return function(){SmsInteractionEvents['removeListener'](_0x25252a,_0x2e2a53);};}exports[_0x723e('0x4')]=function(_0x3f554b){for(var _0x1833a3=0x0,_0x283465=events[_0x723e('0x5')];_0x1833a3<_0x283465;_0x1833a3++){var _0x4deb83=events[_0x1833a3];var _0x72f6a3=createListener(_0x723e('0x6')+_0x4deb83,_0x3f554b);SmsInteractionEvents['on'](_0x4deb83,_0x72f6a3);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4d0dcc1..891e3d5 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 _0xe884=['post','smsmessage:create','create','status','put','update','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x1ae6ec,_0x12bced){var _0xd84edc=function(_0x3f00fe){while(--_0x3f00fe){_0x1ae6ec['push'](_0x1ae6ec['shift']());}};_0xd84edc(++_0x12bced);}(_0xe884,0x1d3));var _0x4e88=function(_0x49c796,_0x3b14b2){_0x49c796=_0x49c796-0x0;var _0x267ec2=_0xe884[_0x49c796];return _0x267ec2;};'use strict';var multer=require(_0x4e88('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e88('0x1'));var express=require(_0x4e88('0x2'));var router=express[_0x4e88('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e88('0x4'));var interaction=require(_0x4e88('0x5'));var config=require(_0x4e88('0x6'));var controller=require(_0x4e88('0x7'));router[_0x4e88('0x8')]('/',auth[_0x4e88('0x9')](),controller[_0x4e88('0xa')]);router['get'](_0x4e88('0xb'),auth[_0x4e88('0x9')](),controller['describe']);router[_0x4e88('0x8')](_0x4e88('0xc'),auth[_0x4e88('0x9')](),controller['show']);router[_0x4e88('0xd')]('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x4e88('0xe')),controller[_0x4e88('0xf')]);router['post']('/:id/status',controller[_0x4e88('0x10')]);router[_0x4e88('0x11')](_0x4e88('0xc'),auth[_0x4e88('0x9')](),controller[_0x4e88('0x12')]);router[_0x4e88('0x11')]('/:id/accept',auth[_0x4e88('0x9')](),controller['accept']);router[_0x4e88('0x11')](_0x4e88('0x13'),auth[_0x4e88('0x9')](),controller[_0x4e88('0x14')]);router[_0x4e88('0x15')](_0x4e88('0xc'),auth[_0x4e88('0x9')](),controller[_0x4e88('0x16')]);module[_0x4e88('0x17')]=router; \ No newline at end of file +var _0x658b=['update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','sms','smsmessage:create','create','status','put'];(function(_0x2eb48b,_0x462f31){var _0x44b4ed=function(_0x416320){while(--_0x416320){_0x2eb48b['push'](_0x2eb48b['shift']());}};_0x44b4ed(++_0x462f31);}(_0x658b,0x11f));var _0xb658=function(_0xb7ee31,_0x45059a){_0xb7ee31=_0xb7ee31-0x0;var _0x478c7e=_0x658b[_0xb7ee31];return _0x478c7e;};'use strict';var multer=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var path=require(_0xb658('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb658('0x3')]();var fs_extra=require(_0xb658('0x4'));var auth=require(_0xb658('0x5'));var interaction=require(_0xb658('0x6'));var config=require(_0xb658('0x7'));var controller=require('./smsMessage.controller');router[_0xb658('0x8')]('/',auth['isAuthenticated'](),controller[_0xb658('0x9')]);router[_0xb658('0x8')](_0xb658('0xa'),auth[_0xb658('0xb')](),controller[_0xb658('0xc')]);router['get'](_0xb658('0xd'),auth[_0xb658('0xb')](),controller[_0xb658('0xe')]);router[_0xb658('0xf')]('/',auth[_0xb658('0xb')](),interaction['tracked'](_0xb658('0x10'),_0xb658('0x11')),controller[_0xb658('0x12')]);router[_0xb658('0xf')]('/:id/status',controller[_0xb658('0x13')]);router[_0xb658('0x14')]('/:id',auth[_0xb658('0xb')](),controller[_0xb658('0x15')]);router[_0xb658('0x14')](_0xb658('0x16'),auth[_0xb658('0xb')](),controller[_0xb658('0x17')]);router[_0xb658('0x14')](_0xb658('0x18'),auth[_0xb658('0xb')](),controller[_0xb658('0x19')]);router[_0xb658('0x1a')]('/:id',auth[_0xb658('0xb')](),controller['destroy']);module[_0xb658('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 970340d..f569c68 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 _0x7e69=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7e69,0x1b8));var _0x97e6=function(_0x2c8374,_0x5814ab){_0x2c8374=_0x2c8374-0x0;var _0x6c87d9=_0x7e69[_0x2c8374];return _0x6c87d9;};'use strict';var Sequelize=require(_0x97e6('0x0'));module['exports']={'body':{'type':Sequelize[_0x97e6('0x1')](_0x97e6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x97e6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x97e6('0x4')]('in',_0x97e6('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x97e6('0x6')](0xbe)},'phone':{'type':Sequelize[_0x97e6('0x6')]},'readAt':{'type':Sequelize[_0x97e6('0x7')]},'secret':{'type':Sequelize[_0x97e6('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x97e6('0x1')]}}; \ No newline at end of file +var _0xd28c=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4d73cf,_0x39838a){var _0x166c14=function(_0x42c052){while(--_0x42c052){_0x4d73cf['push'](_0x4d73cf['shift']());}};_0x166c14(++_0x39838a);}(_0xd28c,0x72));var _0xcd28=function(_0x110663,_0x4aa335){_0x110663=_0x110663-0x0;var _0x5a1820=_0xd28c[_0x110663];return _0x5a1820;};'use strict';var Sequelize=require('sequelize');module[_0xcd28('0x0')]={'body':{'type':Sequelize[_0xcd28('0x1')](_0xcd28('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd28('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd28('0x4')]('in',_0xcd28('0x5')),'defaultValue':_0xcd28('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd28('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xcd28('0x7')]},'secret':{'type':Sequelize[_0xcd28('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xcd28('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f67cf9d..ab47867 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 _0xffb1=['util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','create','body','find','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','interface','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2b590d,_0x13e7f5){var _0x154a3c=function(_0x45f135){while(--_0x45f135){_0x2b590d['push'](_0x2b590d['shift']());}};_0x154a3c(++_0x13e7f5);}(_0xffb1,0x93));var _0x1ffb=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0xffb1[_0x132d12];return _0x1c3163;};'use strict';var emlformat=require(_0x1ffb('0x0'));var rimraf=require(_0x1ffb('0x1'));var zipdir=require(_0x1ffb('0x2'));var jsonpatch=require(_0x1ffb('0x3'));var rp=require(_0x1ffb('0x4'));var moment=require(_0x1ffb('0x5'));var BPromise=require(_0x1ffb('0x6'));var Mustache=require(_0x1ffb('0x7'));var util=require(_0x1ffb('0x8'));var path=require(_0x1ffb('0x9'));var sox=require('sox');var csv=require(_0x1ffb('0xa'));var ejs=require(_0x1ffb('0xb'));var fs=require('fs');var fs_extra=require(_0x1ffb('0xc'));var _=require(_0x1ffb('0xd'));var squel=require(_0x1ffb('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ffb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ffb('0x10'));var Papa=require(_0x1ffb('0x11'));var Redis=require(_0x1ffb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ffb('0x13'));var hardwareService=require(_0x1ffb('0x14'));var logger=require('../../config/logger')(_0x1ffb('0x15'));var utils=require('../../config/utils');var config=require(_0x1ffb('0x16'));var licenseUtil=require(_0x1ffb('0x17'));var db=require(_0x1ffb('0x18'))['db'];config[_0x1ffb('0x19')]=_[_0x1ffb('0x1a')](config[_0x1ffb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ffb('0x1b'))(new Redis(config[_0x1ffb('0x19')]));require(_0x1ffb('0x1c'))['register'](socket);var jayson=require(_0x1ffb('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x1ffb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1216b5,_0x4c11db,_0x3e0681,_0xf343b5){return new BPromise(function(_0x1a1f21,_0xc81c37){var _0x4de448=_0xf343b5||client;return _0x4de448[_0x1ffb('0x1f')](_0x1216b5,_0x3e0681)['then'](function(_0xd004f){logger[_0x1ffb('0x20')](_0x1ffb('0x21'),_0x4c11db,_0x1ffb('0x22'));logger[_0x1ffb('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4c11db,_0x1ffb('0x22'),JSON['stringify'](_0xd004f));if(_0xd004f[_0x1ffb('0x24')]){if(_0xd004f[_0x1ffb('0x24')][_0x1ffb('0x25')]===0x1f4){logger['error'](_0x1ffb('0x21'),_0x4c11db,_0xd004f['error'][_0x1ffb('0x26')]);return _0xc81c37(_0xd004f['error'][_0x1ffb('0x26')]);}logger['error'](_0x1ffb('0x21'),_0x4c11db,_0xd004f['error'][_0x1ffb('0x26')]);return _0x1a1f21(_0xd004f[_0x1ffb('0x24')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4c11db,_0x1ffb('0x22'));_0x1a1f21(_0xd004f['result']['message']);}})[_0x1ffb('0x27')](function(_0x391085){logger['error'](_0x1ffb('0x21'),_0x4c11db,_0x391085);_0xc81c37(_0x391085);});});}function respondWithStatusCode(_0x4298fd,_0x10b8ea){_0x10b8ea=_0x10b8ea||0xcc;return function(_0x458f6f){if(_0x458f6f){return _0x4298fd[_0x1ffb('0x28')](_0x10b8ea);}return _0x4298fd[_0x1ffb('0x29')](_0x10b8ea)[_0x1ffb('0x2a')]();};}function respondWithResult(_0x55d07b,_0x634d91){_0x634d91=_0x634d91||0xc8;return function(_0x15d636){if(_0x15d636){return _0x55d07b[_0x1ffb('0x29')](_0x634d91)['json'](_0x15d636);}};}function respondWithFilteredResult(_0x2c68fc,_0x471eaf){return function(_0x1c9771){if(_0x1c9771){var _0x5e7859=typeof _0x471eaf[_0x1ffb('0x2b')]===_0x1ffb('0x2c')&&typeof _0x471eaf[_0x1ffb('0x2d')]===_0x1ffb('0x2c');var _0x12e31f=_0x1c9771[_0x1ffb('0x2e')];var _0x3f2d64=_0x5e7859?0x0:_0x471eaf[_0x1ffb('0x2b')];var _0x5da00a=_0x5e7859?_0x1c9771[_0x1ffb('0x2e')]:_0x471eaf[_0x1ffb('0x2b')]+_0x471eaf['limit'];var _0x301b22;if(_0x5da00a>=_0x12e31f){_0x5da00a=_0x12e31f;_0x301b22=0xc8;}else{_0x301b22=0xce;}_0x2c68fc['status'](_0x301b22);return _0x2c68fc['set'](_0x1ffb('0x2f'),_0x3f2d64+'-'+_0x5da00a+'/'+_0x12e31f)[_0x1ffb('0x30')](_0x1c9771);}return null;};}function patchUpdates(_0x24b062){return function(_0x4afe67){try{jsonpatch[_0x1ffb('0x31')](_0x4afe67,_0x24b062,!![]);}catch(_0x38688a){return BPromise[_0x1ffb('0x32')](_0x38688a);}return _0x4afe67[_0x1ffb('0x33')]();};}function saveUpdates(_0x43e4b7,_0x159015){return function(_0xbfbdc8){if(_0xbfbdc8){return _0xbfbdc8[_0x1ffb('0x34')](_0x43e4b7)[_0x1ffb('0x35')](function(_0x58e887){return _0x58e887;});}return null;};}function removeEntity(_0x456554,_0x398c3c){return function(_0x1bcd96){if(_0x1bcd96){return _0x1bcd96[_0x1ffb('0x36')]()[_0x1ffb('0x35')](function(){_0x456554[_0x1ffb('0x29')](0xcc)[_0x1ffb('0x2a')]();});}};}function handleEntityNotFound(_0x247444,_0x187cbe){return function(_0x547a7a){if(!_0x547a7a){_0x247444[_0x1ffb('0x28')](0x194);}return _0x547a7a;};}function handleError(_0x493fff,_0x26f226){_0x26f226=_0x26f226||0x1f4;return function(_0x47c963){logger[_0x1ffb('0x24')](_0x47c963[_0x1ffb('0x37')]);if(_0x47c963[_0x1ffb('0x38')]){delete _0x47c963[_0x1ffb('0x38')];}_0x493fff[_0x1ffb('0x29')](_0x26f226)[_0x1ffb('0x39')](_0x47c963);};}exports['index']=function(_0x2419f0,_0x2b05fc){var _0x1bb59e={},_0x4f4335={},_0x4f9a94={'count':0x0,'rows':[]};var _0x4d27e7=_[_0x1ffb('0x3a')](db[_0x1ffb('0x3b')][_0x1ffb('0x3c')],function(_0x9bbe07){return{'name':_0x9bbe07[_0x1ffb('0x3d')],'type':_0x9bbe07['type'][_0x1ffb('0x3e')]};});_0x4f4335[_0x1ffb('0x3f')]=_[_0x1ffb('0x3a')](_0x4d27e7,_0x1ffb('0x38'));_0x4f4335[_0x1ffb('0x40')]=_[_0x1ffb('0x41')](_0x2419f0[_0x1ffb('0x40')]);_0x4f4335[_0x1ffb('0x42')]=_[_0x1ffb('0x43')](_0x4f4335[_0x1ffb('0x3f')],_0x4f4335['query']);_0x1bb59e[_0x1ffb('0x44')]=_[_0x1ffb('0x43')](_0x4f4335[_0x1ffb('0x3f')],qs[_0x1ffb('0x45')](_0x2419f0['query'][_0x1ffb('0x45')]));_0x1bb59e['attributes']=_0x1bb59e['attributes']['length']?_0x1bb59e[_0x1ffb('0x44')]:_0x4f4335[_0x1ffb('0x3f')];if(!_0x2419f0[_0x1ffb('0x40')][_0x1ffb('0x46')](_0x1ffb('0x47'))){_0x1bb59e['limit']=qs['limit'](_0x2419f0[_0x1ffb('0x40')][_0x1ffb('0x2d')]);_0x1bb59e[_0x1ffb('0x2b')]=qs[_0x1ffb('0x2b')](_0x2419f0[_0x1ffb('0x40')]['offset']);}_0x1bb59e[_0x1ffb('0x48')]=qs[_0x1ffb('0x49')](_0x2419f0['query'][_0x1ffb('0x49')]);_0x1bb59e['where']=qs[_0x1ffb('0x42')](_[_0x1ffb('0x4a')](_0x2419f0[_0x1ffb('0x40')],_0x4f4335[_0x1ffb('0x42')]),_0x4d27e7);if(_0x2419f0[_0x1ffb('0x40')]['filter']){_0x1bb59e[_0x1ffb('0x4b')]=_[_0x1ffb('0x4c')](_0x1bb59e[_0x1ffb('0x4b')],{'$or':_[_0x1ffb('0x3a')](_0x4d27e7,function(_0x57bbfb){if(_0x57bbfb['type']!==_0x1ffb('0x4d')){var _0x469336={};_0x469336[_0x57bbfb['name']]={'$like':'%'+_0x2419f0['query'][_0x1ffb('0x4e')]+'%'};return _0x469336;}})});}_0x1bb59e=_['merge']({},_0x1bb59e,_0x2419f0[_0x1ffb('0x4f')]);var _0x7eaa84={'where':_0x1bb59e[_0x1ffb('0x4b')]};return db[_0x1ffb('0x3b')][_0x1ffb('0x2e')](_0x7eaa84)[_0x1ffb('0x35')](function(_0x37eb63){_0x4f9a94['count']=_0x37eb63;if(_0x2419f0[_0x1ffb('0x40')][_0x1ffb('0x50')]){_0x1bb59e[_0x1ffb('0x51')]=[{'all':!![]}];}return db[_0x1ffb('0x3b')]['findAll'](_0x1bb59e);})[_0x1ffb('0x35')](function(_0x17ca4a){_0x4f9a94[_0x1ffb('0x52')]=_0x17ca4a;return _0x4f9a94;})[_0x1ffb('0x35')](respondWithFilteredResult(_0x2b05fc,_0x1bb59e))[_0x1ffb('0x27')](handleError(_0x2b05fc,null));};exports[_0x1ffb('0x53')]=function(_0x439466,_0x2d60ce){var _0x44229f={'raw':!![],'where':{'id':_0x439466[_0x1ffb('0x54')]['id']}},_0x11040b={};_0x11040b[_0x1ffb('0x3f')]=_[_0x1ffb('0x41')](db[_0x1ffb('0x3b')][_0x1ffb('0x3c')]);_0x11040b[_0x1ffb('0x40')]=_[_0x1ffb('0x41')](_0x439466[_0x1ffb('0x40')]);_0x11040b['filters']=_[_0x1ffb('0x43')](_0x11040b['model'],_0x11040b[_0x1ffb('0x40')]);_0x44229f['attributes']=_[_0x1ffb('0x43')](_0x11040b[_0x1ffb('0x3f')],qs[_0x1ffb('0x45')](_0x439466['query']['fields']));_0x44229f['attributes']=_0x44229f[_0x1ffb('0x44')][_0x1ffb('0x55')]?_0x44229f[_0x1ffb('0x44')]:_0x11040b[_0x1ffb('0x3f')];if(_0x439466[_0x1ffb('0x40')][_0x1ffb('0x50')]){_0x44229f[_0x1ffb('0x51')]=[{'all':!![]}];}_0x44229f=_[_0x1ffb('0x4c')]({},_0x44229f,_0x439466[_0x1ffb('0x4f')]);return db[_0x1ffb('0x3b')]['find'](_0x44229f)[_0x1ffb('0x35')](handleEntityNotFound(_0x2d60ce,null))[_0x1ffb('0x35')](respondWithResult(_0x2d60ce,null))[_0x1ffb('0x27')](handleError(_0x2d60ce,null));};exports['create']=function(_0x58db97,_0x42b572){return db[_0x1ffb('0x3b')][_0x1ffb('0x56')](_0x58db97['body'],{})[_0x1ffb('0x35')](respondWithResult(_0x42b572,0xc9))[_0x1ffb('0x27')](handleError(_0x42b572,null));};exports['update']=function(_0x4b724c,_0x51a60a){if(_0x4b724c[_0x1ffb('0x57')]['id']){delete _0x4b724c['body']['id'];}return db['SmsMessage'][_0x1ffb('0x58')]({'where':{'id':_0x4b724c[_0x1ffb('0x54')]['id']}})[_0x1ffb('0x35')](handleEntityNotFound(_0x51a60a,null))[_0x1ffb('0x35')](saveUpdates(_0x4b724c[_0x1ffb('0x57')],null))[_0x1ffb('0x35')](respondWithResult(_0x51a60a,null))['catch'](handleError(_0x51a60a,null));};exports['destroy']=function(_0x49cb0e,_0x36db51){return db[_0x1ffb('0x3b')][_0x1ffb('0x58')]({'where':{'id':_0x49cb0e['params']['id']}})[_0x1ffb('0x35')](handleEntityNotFound(_0x36db51,null))['then'](removeEntity(_0x36db51,null))['catch'](handleError(_0x36db51,null));};exports[_0x1ffb('0x59')]=function(_0x56d05a,_0x370c2b){return db[_0x1ffb('0x3b')][_0x1ffb('0x59')]()[_0x1ffb('0x35')](respondWithResult(_0x370c2b,null))[_0x1ffb('0x27')](handleError(_0x370c2b,null));};var interaction_log=require('../../config/logger')(_0x1ffb('0x5a'));exports[_0x1ffb('0x5b')]=function(_0x17ea1e,_0x5cea9d,_0x343939){var _0x476b15={'agent':{},'channel':_0x1ffb('0x5c')};if(_0x17ea1e[_0x1ffb('0x57')]['id']){delete _0x17ea1e['body']['id'];}_0x17ea1e[_0x1ffb('0x57')][_0x1ffb('0x5d')]=!![];_0x17ea1e[_0x1ffb('0x57')]['readAt']=moment()['format'](_0x1ffb('0x5e'));_0x17ea1e[_0x1ffb('0x57')][_0x1ffb('0x5f')]=_0x17ea1e[_0x1ffb('0x57')][_0x1ffb('0x5f')]||_0x17ea1e[_0x1ffb('0x60')]['id'];_0x476b15[_0x1ffb('0x61')]['id']=_0x17ea1e['body'][_0x1ffb('0x5f')];return db[_0x1ffb('0x3b')][_0x1ffb('0x58')]({'where':{'id':_0x17ea1e[_0x1ffb('0x54')]['id'],'UserId':null}})[_0x1ffb('0x35')](handleEntityNotFound(_0x5cea9d,null))[_0x1ffb('0x35')](saveUpdates(_0x17ea1e[_0x1ffb('0x57')],null))['then'](function(_0x12c7e9){if(_0x12c7e9){_0x476b15[_0x1ffb('0x26')]=_0x12c7e9[_0x1ffb('0x62')]({'plain':!![]});return db[_0x1ffb('0x63')][_0x1ffb('0x58')]({'where':{'id':_0x12c7e9[_0x1ffb('0x64')]}});}return null;})[_0x1ffb('0x35')](handleEntityNotFound(_0x5cea9d,null))['then'](function(_0x2473b9){if(_0x2473b9){return _0x2473b9[_0x1ffb('0x34')]({'UserId':_0x17ea1e[_0x1ffb('0x57')][_0x1ffb('0x5f')],'read1stAt':_[_0x1ffb('0x65')](_0x2473b9['read1stAt'])?moment()['format'](_0x1ffb('0x5e')):undefined});}return null;})[_0x1ffb('0x35')](function(_0x5e524a){if(_0x5e524a){_0x476b15[_0x1ffb('0x66')]=_0x5e524a[_0x1ffb('0x62')]({'plain':!![]});interaction_log[_0x1ffb('0x20')](_0x1ffb('0x67'),_0x17ea1e[_0x1ffb('0x60')]['id'],_0x17ea1e[_0x1ffb('0x60')][_0x1ffb('0x38')],_0x17ea1e['user'][_0x1ffb('0x68')],_0x476b15[_0x1ffb('0x66')]['id'],_0x17ea1e[_0x1ffb('0x57')]?JSON[_0x1ffb('0x69')](_0x17ea1e[_0x1ffb('0x57')]):_0x1ffb('0x6a'));return respondWithRpcPromise(_0x1ffb('0x6b'),_0x1ffb('0x6c'),_0x476b15);}return null;})[_0x1ffb('0x35')](function(_0x377d4b){var _0x1db54d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x377d4b['message'][_0x1ffb('0x6d')];return db[_0x1ffb('0x6e')]['query'](_0x1db54d,{'type':db[_0x1ffb('0x6f')][_0x1ffb('0x70')][_0x1ffb('0x71')],'raw':!![]})['then'](function(_0x782a6f){return _0x782a6f;});})[_0x1ffb('0x35')](function(_0x28eed0){if(_0x28eed0){_0x476b15[_0x1ffb('0x26')][_0x1ffb('0x72')]=_0x28eed0[0x0];if(!_0x17ea1e[_0x1ffb('0x57')]['UserId'])return;return db[_0x1ffb('0x73')][_0x1ffb('0x58')]({'where':{'id':_0x17ea1e['body']['UserId'],'role':'agent'},'attributes':['id',_0x1ffb('0x38'),'fullname',_0x1ffb('0x74'),_0x1ffb('0x75')],'raw':!![]});}return null;})[_0x1ffb('0x35')](function(_0x162d15){if(!_0x162d15)return null;_0x476b15[_0x1ffb('0x26')]['agent']=_0x162d15;return _0x476b15;})['then'](function(_0x59ed33){if(_0x59ed33){if(_0x17ea1e[_0x1ffb('0x57')][_0x1ffb('0x76')]){_0x476b15['message']['interface']=util[_0x1ffb('0x77')](_0x1ffb('0x78'),_0x17ea1e[_0x1ffb('0x60')]['name']);_0x476b15['message'][_0x1ffb('0x79')]=_0x476b15['channel'];_0x476b15[_0x1ffb('0x26')][_0x1ffb('0x7a')]=_0x476b15[_0x1ffb('0x79')];_0x476b15[_0x1ffb('0x26')][_0x1ffb('0x7b')]=_0x1ffb('0x5b');return respondWithRpcPromise(_0x1ffb('0x7c'),_0x1ffb('0x7c'),{'event':_0x1ffb('0x7d'),'message':_0x476b15['message']},client9002)[_0x1ffb('0x35')](function(){return _0x476b15;});}return _0x476b15;}return null;})['then'](respondWithResult(_0x5cea9d,null))['catch'](handleError(_0x5cea9d,null));};var interaction_log=require(_0x1ffb('0x7e'))(_0x1ffb('0x5a'));exports[_0x1ffb('0x32')]=function(_0x561629,_0x337ec9,_0x3b681f){var _0x418122={'agent':{},'channel':'sms'};if(_0x561629[_0x1ffb('0x57')]['id']){delete _0x561629[_0x1ffb('0x57')]['id'];}_0x561629[_0x1ffb('0x57')][_0x1ffb('0x5f')]=_0x561629[_0x1ffb('0x57')][_0x1ffb('0x5f')]||_0x561629[_0x1ffb('0x60')]['id'];_0x418122['agent']['id']=_0x561629[_0x1ffb('0x57')][_0x1ffb('0x5f')];return db[_0x1ffb('0x3b')]['find']({'where':{'id':_0x561629[_0x1ffb('0x54')]['id'],'UserId':null}})[_0x1ffb('0x35')](handleEntityNotFound(_0x337ec9,null))[_0x1ffb('0x35')](function(_0x5f490d){if(_0x5f490d){_0x418122['message']=_0x5f490d[_0x1ffb('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x1ffb('0x58')]({'where':{'id':_0x5f490d[_0x1ffb('0x64')]}});}return null;})[_0x1ffb('0x35')](handleEntityNotFound(_0x337ec9,null))[_0x1ffb('0x35')](function(_0x365bb0){if(_0x365bb0){_0x418122[_0x1ffb('0x66')]=_0x365bb0[_0x1ffb('0x62')]({'plain':!![]});interaction_log[_0x1ffb('0x20')](_0x1ffb('0x7f'),_0x561629[_0x1ffb('0x60')]['id'],_0x561629[_0x1ffb('0x60')][_0x1ffb('0x38')],_0x561629[_0x1ffb('0x60')][_0x1ffb('0x68')],_0x418122[_0x1ffb('0x66')]['id'],_0x561629['body']?JSON['stringify'](_0x561629[_0x1ffb('0x57')]):_0x1ffb('0x6a'));return respondWithRpcPromise(_0x1ffb('0x80'),_0x1ffb('0x81'),_0x418122);}return null;})[_0x1ffb('0x35')](function(_0x28d05e){var _0x18dde6=_0x1ffb('0x82')+_0x28d05e['message'][_0x1ffb('0x6d')];return db[_0x1ffb('0x6e')][_0x1ffb('0x40')](_0x18dde6,{'type':db[_0x1ffb('0x6f')][_0x1ffb('0x70')][_0x1ffb('0x71')],'raw':!![]})[_0x1ffb('0x35')](function(_0x431056){return _0x431056;});})['then'](function(_0x5b0122){if(_0x5b0122){_0x418122[_0x1ffb('0x26')]['contact']=_0x5b0122[0x0];if(!_0x561629[_0x1ffb('0x57')][_0x1ffb('0x5f')])return;return db['User'][_0x1ffb('0x58')]({'where':{'id':_0x561629[_0x1ffb('0x57')][_0x1ffb('0x5f')],'role':'agent'},'attributes':['id',_0x1ffb('0x38'),_0x1ffb('0x83'),'email',_0x1ffb('0x75')],'raw':!![]});}return null;})[_0x1ffb('0x35')](function(_0x3f76f4){if(!_0x3f76f4)return null;_0x418122[_0x1ffb('0x26')]['agent']=_0x3f76f4;return _0x418122;})[_0x1ffb('0x35')](function(_0x3d7e2a){if(_0x3d7e2a){_0x3d7e2a[_0x1ffb('0x26')][_0x1ffb('0x84')]=util[_0x1ffb('0x77')](_0x1ffb('0x78'),_0x561629[_0x1ffb('0x60')][_0x1ffb('0x38')]);_0x3d7e2a[_0x1ffb('0x26')]['channel']=_0x418122[_0x1ffb('0x79')];_0x3d7e2a[_0x1ffb('0x26')]['motionChannel']=_0x418122[_0x1ffb('0x79')];_0x3d7e2a['message'][_0x1ffb('0x7b')]=_0x1ffb('0x32');respondWithRpcPromise(_0x1ffb('0x7c'),_0x1ffb('0x7c'),{'event':_0x1ffb('0x85'),'message':_0x3d7e2a[_0x1ffb('0x26')]},client9002);return _0x418122;}return null;})[_0x1ffb('0x35')](respondWithResult(_0x337ec9,null))[_0x1ffb('0x27')](handleError(_0x337ec9,null));};exports[_0x1ffb('0x29')]=function(_0x39c119,_0x106ea5,_0x173e35){if(_0x39c119['body']['id']){delete _0x39c119[_0x1ffb('0x57')]['id'];}var _0x254cab;return db[_0x1ffb('0x3b')][_0x1ffb('0x58')]({'where':{'id':_0x39c119['params']['id']}})[_0x1ffb('0x35')](handleEntityNotFound(_0x106ea5,null))[_0x1ffb('0x35')](function(_0x2cc23c){if(_0x2cc23c){_0x254cab=_0x2cc23c;return db[_0x1ffb('0x86')][_0x1ffb('0x58')]({'where':{'id':_0x2cc23c[_0x1ffb('0x87')]}});}})[_0x1ffb('0x35')](handleEntityNotFound(_0x106ea5,null))[_0x1ffb('0x35')](function(_0x5dff04){if(_0x5dff04){logger[_0x1ffb('0x23')](_0x1ffb('0x88'),_0x1ffb('0x29'),_0x1ffb('0x89'),_0x5dff04[_0x1ffb('0x8a')],util[_0x1ffb('0x8b')](_0x39c119[_0x1ffb('0x57')],{'showHidden':![],'depth':null}));switch(_0x5dff04[_0x1ffb('0x8a')]){case _0x1ffb('0x8c'):if(_0x39c119['body'][_0x1ffb('0x8d')]&&_0x39c119[_0x1ffb('0x57')][_0x1ffb('0x8d')]===_0x254cab[_0x1ffb('0x8e')]){return _0x254cab['update']({'read':!![]});}else{logger[_0x1ffb('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ffb('0x29'),'twilio',util[_0x1ffb('0x8b')](_0x39c119[_0x1ffb('0x57')],{'showHidden':![],'depth':null}));}break;case _0x1ffb('0x8f'):if(_0x39c119[_0x1ffb('0x57')][_0x1ffb('0x90')]&&_0x39c119[_0x1ffb('0x57')]['MessageUUID']===_0x254cab[_0x1ffb('0x8e')]&&_[_0x1ffb('0x91')]([_0x1ffb('0x92'),_0x1ffb('0x93')],_0x39c119[_0x1ffb('0x57')][_0x1ffb('0x94')])>=0x0){return _0x254cab[_0x1ffb('0x34')]({'read':!![]});}else{logger[_0x1ffb('0x24')](_0x1ffb('0x95'),_0x1ffb('0x29'),_0x1ffb('0x96'),util['inspect'](_0x39c119[_0x1ffb('0x57')],{'showHidden':![],'depth':null}));}break;case _0x1ffb('0x97'):var _0x246198=_0x39c119[_0x1ffb('0x57')][_0x1ffb('0x98')][0x0];if(_0x246198[_0x1ffb('0x29')][_0x1ffb('0x99')]===_0x1ffb('0x9a')){return _0x254cab[_0x1ffb('0x34')]({'read':!![]});}else{logger[_0x1ffb('0x24')](_0x1ffb('0x95'),_0x1ffb('0x29'),_0x1ffb('0x97'),util[_0x1ffb('0x8b')](_0x39c119[_0x1ffb('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x254cab;}})[_0x1ffb('0x35')](respondWithResult(_0x106ea5,null))[_0x1ffb('0x27')](handleError(_0x106ea5,null));}; \ No newline at end of file +var _0xaf60=['papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','offset','count','reject','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','find','body','describe','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','sms','params','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','interface','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0xaf60,0x82));var _0x0af6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xaf60[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x0af6('0x0'));var rimraf=require(_0x0af6('0x1'));var zipdir=require(_0x0af6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0af6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0af6('0x4'));var path=require(_0x0af6('0x5'));var sox=require(_0x0af6('0x6'));var csv=require(_0x0af6('0x7'));var ejs=require(_0x0af6('0x8'));var fs=require('fs');var fs_extra=require(_0x0af6('0x9'));var _=require(_0x0af6('0xa'));var squel=require('squel');var crypto=require(_0x0af6('0xb'));var jsforce=require(_0x0af6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0af6('0x7'));var querystring=require(_0x0af6('0xd'));var Papa=require(_0x0af6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0af6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0af6('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x0af6('0x11'));var licenseUtil=require(_0x0af6('0x12'));var db=require(_0x0af6('0x13'))['db'];config['redis']=_[_0x0af6('0x14')](config[_0x0af6('0x15')],{'host':_0x0af6('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0af6('0x15')]));require('./smsMessage.socket')[_0x0af6('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0af6('0x18')][_0x0af6('0x19')]({'port':0x232c});var client9002=jayson[_0x0af6('0x18')][_0x0af6('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x53fb83,_0x57a725,_0x4bcb7a,_0x48051a){return new BPromise(function(_0x4d5936,_0x2326e6){var _0x2509e5=_0x48051a||client;return _0x2509e5[_0x0af6('0x1a')](_0x53fb83,_0x4bcb7a)[_0x0af6('0x1b')](function(_0x5bf0d3){logger['info'](_0x0af6('0x1c'),_0x57a725,_0x0af6('0x1d'));logger['debug'](_0x0af6('0x1e'),_0x57a725,_0x0af6('0x1d'),JSON['stringify'](_0x5bf0d3));if(_0x5bf0d3[_0x0af6('0x1f')]){if(_0x5bf0d3[_0x0af6('0x1f')][_0x0af6('0x20')]===0x1f4){logger['error'](_0x0af6('0x1c'),_0x57a725,_0x5bf0d3[_0x0af6('0x1f')][_0x0af6('0x21')]);return _0x2326e6(_0x5bf0d3['error']['message']);}logger['error'](_0x0af6('0x1c'),_0x57a725,_0x5bf0d3[_0x0af6('0x1f')][_0x0af6('0x21')]);return _0x4d5936(_0x5bf0d3[_0x0af6('0x1f')]['message']);}else{logger[_0x0af6('0x22')](_0x0af6('0x1c'),_0x57a725,_0x0af6('0x1d'));_0x4d5936(_0x5bf0d3[_0x0af6('0x23')]['message']);}})[_0x0af6('0x24')](function(_0x34508e){logger['error'](_0x0af6('0x1c'),_0x57a725,_0x34508e);_0x2326e6(_0x34508e);});});}function respondWithStatusCode(_0x49e4c8,_0x5fbff4){_0x5fbff4=_0x5fbff4||0xcc;return function(_0x43e44d){if(_0x43e44d){return _0x49e4c8[_0x0af6('0x25')](_0x5fbff4);}return _0x49e4c8[_0x0af6('0x26')](_0x5fbff4)[_0x0af6('0x27')]();};}function respondWithResult(_0x5cf28f,_0x4f16d5){_0x4f16d5=_0x4f16d5||0xc8;return function(_0x49a7be){if(_0x49a7be){return _0x5cf28f[_0x0af6('0x26')](_0x4f16d5)[_0x0af6('0x28')](_0x49a7be);}};}function respondWithFilteredResult(_0x197427,_0x4da5d0){return function(_0x1ca90b){if(_0x1ca90b){var _0x29e57b=typeof _0x4da5d0['offset']==='undefined'&&typeof _0x4da5d0['limit']===_0x0af6('0x29');var _0x41bb88=_0x1ca90b['count'];var _0x412388=_0x29e57b?0x0:_0x4da5d0[_0x0af6('0x2a')];var _0x4673b8=_0x29e57b?_0x1ca90b[_0x0af6('0x2b')]:_0x4da5d0['offset']+_0x4da5d0['limit'];var _0x3f0ef7;if(_0x4673b8>=_0x41bb88){_0x4673b8=_0x41bb88;_0x3f0ef7=0xc8;}else{_0x3f0ef7=0xce;}_0x197427[_0x0af6('0x26')](_0x3f0ef7);return _0x197427['set']('Content-Range',_0x412388+'-'+_0x4673b8+'/'+_0x41bb88)[_0x0af6('0x28')](_0x1ca90b);}return null;};}function patchUpdates(_0x156bbb){return function(_0x1afcf2){try{jsonpatch['apply'](_0x1afcf2,_0x156bbb,!![]);}catch(_0x50939e){return BPromise[_0x0af6('0x2c')](_0x50939e);}return _0x1afcf2[_0x0af6('0x2d')]();};}function saveUpdates(_0x1bbdc2,_0x53a199){return function(_0x188911){if(_0x188911){return _0x188911[_0x0af6('0x2e')](_0x1bbdc2)['then'](function(_0x502b64){return _0x502b64;});}return null;};}function removeEntity(_0x5b6d1c,_0x22264d){return function(_0x115e60){if(_0x115e60){return _0x115e60[_0x0af6('0x2f')]()[_0x0af6('0x1b')](function(){_0x5b6d1c[_0x0af6('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11055f,_0x1a1f70){return function(_0x195c09){if(!_0x195c09){_0x11055f[_0x0af6('0x25')](0x194);}return _0x195c09;};}function handleError(_0x5b194f,_0x396877){_0x396877=_0x396877||0x1f4;return function(_0x552282){logger[_0x0af6('0x1f')](_0x552282['stack']);if(_0x552282['name']){delete _0x552282[_0x0af6('0x30')];}_0x5b194f[_0x0af6('0x26')](_0x396877)[_0x0af6('0x31')](_0x552282);};}exports[_0x0af6('0x32')]=function(_0x194970,_0x1f53a6){var _0x1e586f={},_0x4e5a0b={},_0x2d17de={'count':0x0,'rows':[]};var _0x3be03f=_[_0x0af6('0x33')](db[_0x0af6('0x34')][_0x0af6('0x35')],function(_0x206739){return{'name':_0x206739[_0x0af6('0x36')],'type':_0x206739[_0x0af6('0x37')][_0x0af6('0x38')]};});_0x4e5a0b[_0x0af6('0x39')]=_[_0x0af6('0x33')](_0x3be03f,_0x0af6('0x30'));_0x4e5a0b[_0x0af6('0x3a')]=_[_0x0af6('0x3b')](_0x194970[_0x0af6('0x3a')]);_0x4e5a0b[_0x0af6('0x3c')]=_[_0x0af6('0x3d')](_0x4e5a0b[_0x0af6('0x39')],_0x4e5a0b['query']);_0x1e586f['attributes']=_[_0x0af6('0x3d')](_0x4e5a0b[_0x0af6('0x39')],qs[_0x0af6('0x3e')](_0x194970[_0x0af6('0x3a')][_0x0af6('0x3e')]));_0x1e586f[_0x0af6('0x3f')]=_0x1e586f['attributes'][_0x0af6('0x40')]?_0x1e586f[_0x0af6('0x3f')]:_0x4e5a0b[_0x0af6('0x39')];if(!_0x194970['query'][_0x0af6('0x41')](_0x0af6('0x42'))){_0x1e586f[_0x0af6('0x43')]=qs[_0x0af6('0x43')](_0x194970[_0x0af6('0x3a')]['limit']);_0x1e586f['offset']=qs['offset'](_0x194970['query']['offset']);}_0x1e586f[_0x0af6('0x44')]=qs[_0x0af6('0x45')](_0x194970[_0x0af6('0x3a')][_0x0af6('0x45')]);_0x1e586f[_0x0af6('0x46')]=qs[_0x0af6('0x3c')](_[_0x0af6('0x47')](_0x194970[_0x0af6('0x3a')],_0x4e5a0b['filters']),_0x3be03f);if(_0x194970[_0x0af6('0x3a')][_0x0af6('0x48')]){_0x1e586f[_0x0af6('0x46')]=_[_0x0af6('0x49')](_0x1e586f[_0x0af6('0x46')],{'$or':_[_0x0af6('0x33')](_0x3be03f,function(_0x5028f5){if(_0x5028f5[_0x0af6('0x37')]!==_0x0af6('0x4a')){var _0x2faf5b={};_0x2faf5b[_0x5028f5['name']]={'$like':'%'+_0x194970[_0x0af6('0x3a')][_0x0af6('0x48')]+'%'};return _0x2faf5b;}})});}_0x1e586f=_['merge']({},_0x1e586f,_0x194970[_0x0af6('0x4b')]);var _0x4acd94={'where':_0x1e586f[_0x0af6('0x46')]};return db['SmsMessage'][_0x0af6('0x2b')](_0x4acd94)[_0x0af6('0x1b')](function(_0x3ff525){_0x2d17de[_0x0af6('0x2b')]=_0x3ff525;if(_0x194970[_0x0af6('0x3a')]['includeAll']){_0x1e586f[_0x0af6('0x4c')]=[{'all':!![]}];}return db[_0x0af6('0x34')][_0x0af6('0x4d')](_0x1e586f);})['then'](function(_0xa92498){_0x2d17de['rows']=_0xa92498;return _0x2d17de;})[_0x0af6('0x1b')](respondWithFilteredResult(_0x1f53a6,_0x1e586f))[_0x0af6('0x24')](handleError(_0x1f53a6,null));};exports[_0x0af6('0x4e')]=function(_0x4ba337,_0x5a1b38){var _0x3ff5f4={'raw':!![],'where':{'id':_0x4ba337['params']['id']}},_0x54e87a={};_0x54e87a[_0x0af6('0x39')]=_[_0x0af6('0x3b')](db[_0x0af6('0x34')][_0x0af6('0x35')]);_0x54e87a['query']=_[_0x0af6('0x3b')](_0x4ba337[_0x0af6('0x3a')]);_0x54e87a[_0x0af6('0x3c')]=_[_0x0af6('0x3d')](_0x54e87a[_0x0af6('0x39')],_0x54e87a['query']);_0x3ff5f4[_0x0af6('0x3f')]=_[_0x0af6('0x3d')](_0x54e87a['model'],qs[_0x0af6('0x3e')](_0x4ba337[_0x0af6('0x3a')][_0x0af6('0x3e')]));_0x3ff5f4[_0x0af6('0x3f')]=_0x3ff5f4[_0x0af6('0x3f')][_0x0af6('0x40')]?_0x3ff5f4[_0x0af6('0x3f')]:_0x54e87a['model'];if(_0x4ba337[_0x0af6('0x3a')][_0x0af6('0x4f')]){_0x3ff5f4['include']=[{'all':!![]}];}_0x3ff5f4=_[_0x0af6('0x49')]({},_0x3ff5f4,_0x4ba337['options']);return db['SmsMessage'][_0x0af6('0x50')](_0x3ff5f4)[_0x0af6('0x1b')](handleEntityNotFound(_0x5a1b38,null))[_0x0af6('0x1b')](respondWithResult(_0x5a1b38,null))['catch'](handleError(_0x5a1b38,null));};exports['create']=function(_0x4c2bf9,_0x5bdd0a){return db['SmsMessage']['create'](_0x4c2bf9[_0x0af6('0x51')],{})[_0x0af6('0x1b')](respondWithResult(_0x5bdd0a,0xc9))[_0x0af6('0x24')](handleError(_0x5bdd0a,null));};exports[_0x0af6('0x2e')]=function(_0x31a6bd,_0x493103){if(_0x31a6bd['body']['id']){delete _0x31a6bd['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x31a6bd['params']['id']}})[_0x0af6('0x1b')](handleEntityNotFound(_0x493103,null))['then'](saveUpdates(_0x31a6bd['body'],null))[_0x0af6('0x1b')](respondWithResult(_0x493103,null))[_0x0af6('0x24')](handleError(_0x493103,null));};exports[_0x0af6('0x2f')]=function(_0x416fd3,_0x41a76a){return db[_0x0af6('0x34')][_0x0af6('0x50')]({'where':{'id':_0x416fd3['params']['id']}})['then'](handleEntityNotFound(_0x41a76a,null))['then'](removeEntity(_0x41a76a,null))[_0x0af6('0x24')](handleError(_0x41a76a,null));};exports['describe']=function(_0x2224ff,_0x25493f){return db[_0x0af6('0x34')][_0x0af6('0x52')]()['then'](respondWithResult(_0x25493f,null))[_0x0af6('0x24')](handleError(_0x25493f,null));};var interaction_log=require(_0x0af6('0x10'))('sms-interactions');exports['accept']=function(_0x3008d4,_0xe9b4c,_0x13ee98){var _0x152b44={'agent':{},'channel':'sms'};if(_0x3008d4[_0x0af6('0x51')]['id']){delete _0x3008d4['body']['id'];}_0x3008d4[_0x0af6('0x51')]['read']=!![];_0x3008d4[_0x0af6('0x51')][_0x0af6('0x53')]=moment()[_0x0af6('0x54')](_0x0af6('0x55'));_0x3008d4[_0x0af6('0x51')]['UserId']=_0x3008d4[_0x0af6('0x51')][_0x0af6('0x56')]||_0x3008d4[_0x0af6('0x57')]['id'];_0x152b44[_0x0af6('0x58')]['id']=_0x3008d4['body'][_0x0af6('0x56')];return db[_0x0af6('0x34')][_0x0af6('0x50')]({'where':{'id':_0x3008d4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe9b4c,null))[_0x0af6('0x1b')](saveUpdates(_0x3008d4[_0x0af6('0x51')],null))[_0x0af6('0x1b')](function(_0x5bcf7d){if(_0x5bcf7d){_0x152b44[_0x0af6('0x21')]=_0x5bcf7d[_0x0af6('0x59')]({'plain':!![]});return db[_0x0af6('0x5a')][_0x0af6('0x50')]({'where':{'id':_0x5bcf7d[_0x0af6('0x5b')]}});}return null;})[_0x0af6('0x1b')](handleEntityNotFound(_0xe9b4c,null))[_0x0af6('0x1b')](function(_0x2f937e){if(_0x2f937e){return _0x2f937e[_0x0af6('0x2e')]({'UserId':_0x3008d4[_0x0af6('0x51')][_0x0af6('0x56')],'read1stAt':_[_0x0af6('0x5c')](_0x2f937e[_0x0af6('0x5d')])?moment()[_0x0af6('0x54')](_0x0af6('0x55')):undefined});}return null;})[_0x0af6('0x1b')](function(_0x9001f7){if(_0x9001f7){_0x152b44[_0x0af6('0x5e')]=_0x9001f7['get']({'plain':!![]});interaction_log[_0x0af6('0x22')](_0x0af6('0x5f'),_0x3008d4[_0x0af6('0x57')]['id'],_0x3008d4[_0x0af6('0x57')][_0x0af6('0x30')],_0x3008d4[_0x0af6('0x57')][_0x0af6('0x60')],_0x152b44[_0x0af6('0x5e')]['id'],_0x3008d4[_0x0af6('0x51')]?JSON[_0x0af6('0x61')](_0x3008d4['body']):_0x0af6('0x62'));return respondWithRpcPromise(_0x0af6('0x63'),_0x0af6('0x64'),_0x152b44);}return null;})[_0x0af6('0x1b')](function(_0x4ae986){var _0x558e2a=_0x0af6('0x65')+_0x4ae986[_0x0af6('0x21')]['ContactId'];return db[_0x0af6('0x66')][_0x0af6('0x3a')](_0x558e2a,{'type':db[_0x0af6('0x67')][_0x0af6('0x68')][_0x0af6('0x69')],'raw':!![]})[_0x0af6('0x1b')](function(_0x193758){return _0x193758;});})['then'](function(_0x245df0){if(_0x245df0){_0x152b44[_0x0af6('0x21')][_0x0af6('0x6a')]=_0x245df0[0x0];if(!_0x3008d4[_0x0af6('0x51')][_0x0af6('0x56')])return;return db[_0x0af6('0x6b')][_0x0af6('0x50')]({'where':{'id':_0x3008d4[_0x0af6('0x51')][_0x0af6('0x56')],'role':_0x0af6('0x58')},'attributes':['id',_0x0af6('0x30'),_0x0af6('0x6c'),_0x0af6('0x6d'),_0x0af6('0x6e')],'raw':!![]});}return null;})['then'](function(_0x50ebe8){if(!_0x50ebe8)return null;_0x152b44[_0x0af6('0x21')][_0x0af6('0x58')]=_0x50ebe8;return _0x152b44;})[_0x0af6('0x1b')](function(_0x5055af){if(_0x5055af){if(_0x3008d4[_0x0af6('0x51')]['manual']){_0x152b44[_0x0af6('0x21')]['interface']=util[_0x0af6('0x54')](_0x0af6('0x6f'),_0x3008d4[_0x0af6('0x57')][_0x0af6('0x30')]);_0x152b44[_0x0af6('0x21')][_0x0af6('0x70')]=_0x152b44[_0x0af6('0x70')];_0x152b44['message'][_0x0af6('0x71')]=_0x152b44['channel'];_0x152b44['message'][_0x0af6('0x72')]=_0x0af6('0x73');return respondWithRpcPromise(_0x0af6('0x74'),_0x0af6('0x74'),{'event':_0x0af6('0x75'),'message':_0x152b44[_0x0af6('0x21')]},client9002)[_0x0af6('0x1b')](function(){return _0x152b44;});}return _0x152b44;}return null;})[_0x0af6('0x1b')](respondWithResult(_0xe9b4c,null))['catch'](handleError(_0xe9b4c,null));};var interaction_log=require(_0x0af6('0x10'))(_0x0af6('0x76'));exports[_0x0af6('0x2c')]=function(_0x51da51,_0x40fb18,_0x1ea27a){var _0x502899={'agent':{},'channel':_0x0af6('0x77')};if(_0x51da51['body']['id']){delete _0x51da51[_0x0af6('0x51')]['id'];}_0x51da51['body'][_0x0af6('0x56')]=_0x51da51[_0x0af6('0x51')][_0x0af6('0x56')]||_0x51da51[_0x0af6('0x57')]['id'];_0x502899[_0x0af6('0x58')]['id']=_0x51da51[_0x0af6('0x51')]['UserId'];return db['SmsMessage'][_0x0af6('0x50')]({'where':{'id':_0x51da51[_0x0af6('0x78')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40fb18,null))['then'](function(_0x13643d){if(_0x13643d){_0x502899['message']=_0x13643d[_0x0af6('0x59')]({'plain':!![]});return db['SmsInteraction'][_0x0af6('0x50')]({'where':{'id':_0x13643d['SmsInteractionId']}});}return null;})[_0x0af6('0x1b')](handleEntityNotFound(_0x40fb18,null))['then'](function(_0x5b978c){if(_0x5b978c){_0x502899[_0x0af6('0x5e')]=_0x5b978c[_0x0af6('0x59')]({'plain':!![]});interaction_log[_0x0af6('0x22')](_0x0af6('0x79'),_0x51da51[_0x0af6('0x57')]['id'],_0x51da51[_0x0af6('0x57')][_0x0af6('0x30')],_0x51da51['user'][_0x0af6('0x60')],_0x502899['interaction']['id'],_0x51da51[_0x0af6('0x51')]?JSON[_0x0af6('0x61')](_0x51da51[_0x0af6('0x51')]):_0x0af6('0x62'));return respondWithRpcPromise(_0x0af6('0x7a'),'rejectMessage',_0x502899);}return null;})['then'](function(_0x52ffc9){var _0x1cf2a6=_0x0af6('0x65')+_0x52ffc9[_0x0af6('0x21')][_0x0af6('0x7b')];return db[_0x0af6('0x66')]['query'](_0x1cf2a6,{'type':db[_0x0af6('0x67')][_0x0af6('0x68')][_0x0af6('0x69')],'raw':!![]})[_0x0af6('0x1b')](function(_0x3cea26){return _0x3cea26;});})[_0x0af6('0x1b')](function(_0x2e756e){if(_0x2e756e){_0x502899[_0x0af6('0x21')]['contact']=_0x2e756e[0x0];if(!_0x51da51[_0x0af6('0x51')][_0x0af6('0x56')])return;return db[_0x0af6('0x6b')][_0x0af6('0x50')]({'where':{'id':_0x51da51[_0x0af6('0x51')][_0x0af6('0x56')],'role':_0x0af6('0x58')},'attributes':['id',_0x0af6('0x30'),_0x0af6('0x6c'),'email',_0x0af6('0x6e')],'raw':!![]});}return null;})[_0x0af6('0x1b')](function(_0x1db21d){if(!_0x1db21d)return null;_0x502899['message'][_0x0af6('0x58')]=_0x1db21d;return _0x502899;})[_0x0af6('0x1b')](function(_0x287b86){if(_0x287b86){_0x287b86['message'][_0x0af6('0x7c')]=util[_0x0af6('0x54')]('SIP/%s',_0x51da51['user'][_0x0af6('0x30')]);_0x287b86[_0x0af6('0x21')][_0x0af6('0x70')]=_0x502899[_0x0af6('0x70')];_0x287b86[_0x0af6('0x21')][_0x0af6('0x71')]=_0x502899[_0x0af6('0x70')];_0x287b86[_0x0af6('0x21')][_0x0af6('0x72')]=_0x0af6('0x2c');respondWithRpcPromise('EventManager','EventManager',{'event':_0x0af6('0x7d'),'message':_0x287b86[_0x0af6('0x21')]},client9002);return _0x502899;}return null;})['then'](respondWithResult(_0x40fb18,null))['catch'](handleError(_0x40fb18,null));};exports[_0x0af6('0x26')]=function(_0x4641d0,_0x7d1577,_0x58062a){if(_0x4641d0[_0x0af6('0x51')]['id']){delete _0x4641d0['body']['id'];}var _0x2635ad;return db['SmsMessage']['find']({'where':{'id':_0x4641d0['params']['id']}})[_0x0af6('0x1b')](handleEntityNotFound(_0x7d1577,null))['then'](function(_0x21b5ec){if(_0x21b5ec){_0x2635ad=_0x21b5ec;return db[_0x0af6('0x7e')][_0x0af6('0x50')]({'where':{'id':_0x21b5ec[_0x0af6('0x7f')]}});}})[_0x0af6('0x1b')](handleEntityNotFound(_0x7d1577,null))[_0x0af6('0x1b')](function(_0x17ffba){if(_0x17ffba){logger[_0x0af6('0x80')](_0x0af6('0x1e'),'status',_0x0af6('0x81'),_0x17ffba[_0x0af6('0x37')],util[_0x0af6('0x82')](_0x4641d0[_0x0af6('0x51')],{'showHidden':![],'depth':null}));switch(_0x17ffba[_0x0af6('0x37')]){case _0x0af6('0x83'):if(_0x4641d0[_0x0af6('0x51')]['MessageSid']&&_0x4641d0[_0x0af6('0x51')][_0x0af6('0x84')]===_0x2635ad[_0x0af6('0x85')]){return _0x2635ad[_0x0af6('0x2e')]({'read':!![]});}else{logger[_0x0af6('0x1f')](_0x0af6('0x86'),'status',_0x0af6('0x83'),util[_0x0af6('0x82')](_0x4641d0[_0x0af6('0x51')],{'showHidden':![],'depth':null}));}break;case _0x0af6('0x87'):if(_0x4641d0[_0x0af6('0x51')][_0x0af6('0x88')]&&_0x4641d0[_0x0af6('0x51')][_0x0af6('0x88')]===_0x2635ad['messageId']&&_[_0x0af6('0x89')]([_0x0af6('0x8a'),_0x0af6('0x8b')],_0x4641d0[_0x0af6('0x51')]['Status'])>=0x0){return _0x2635ad[_0x0af6('0x2e')]({'read':!![]});}else{logger[_0x0af6('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0af6('0x26'),_0x0af6('0x8c'),util[_0x0af6('0x82')](_0x4641d0['body'],{'showHidden':![],'depth':null}));}break;case _0x0af6('0x8d'):var _0x53c451=_0x4641d0[_0x0af6('0x51')]['results'][0x0];if(_0x53c451[_0x0af6('0x26')][_0x0af6('0x8e')]===_0x0af6('0x8f')){return _0x2635ad['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0af6('0x26'),_0x0af6('0x8d'),util['inspect'](_0x4641d0['body'],{'showHidden':![],'depth':null}));}break;}return _0x2635ad;}})['then'](respondWithResult(_0x7d1577,null))[_0x0af6('0x24')](handleError(_0x7d1577,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ac6e6b2..576cd15 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 _0xff5a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x38e0de,_0x132d49){var _0x1a906a=function(_0x45d5a0){while(--_0x45d5a0){_0x38e0de['push'](_0x38e0de['shift']());}};_0x1a906a(++_0x132d49);}(_0xff5a,0xd4));var _0xaff5=function(_0x176a76,_0x2477fe){_0x176a76=_0x176a76-0x0;var _0x34ffbe=_0xff5a[_0x176a76];return _0x34ffbe;};'use strict';var EventEmitter=require(_0xaff5('0x0'));var SmsMessage=require(_0xaff5('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xaff5('0x2')](0x0);var events={'afterCreate':_0xaff5('0x3'),'afterUpdate':_0xaff5('0x4'),'afterDestroy':_0xaff5('0x5')};function emitEvent(_0x57b418){return function(_0x37d91c,_0x5316ff,_0x4cd832){SmsMessageEvents['emit'](_0x57b418+':'+_0x37d91c['id'],_0x37d91c);SmsMessageEvents[_0xaff5('0x6')](_0x57b418,_0x37d91c);_0x4cd832(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xaff5('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x3fd9=['exports','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3d6006,_0x66280a){var _0x581739=function(_0x2b69a6){while(--_0x2b69a6){_0x3d6006['push'](_0x3d6006['shift']());}};_0x581739(++_0x66280a);}(_0x3fd9,0x79));var _0x93fd=function(_0x1a3c0e,_0x37d98c){_0x1a3c0e=_0x1a3c0e-0x0;var _0x4a9ed3=_0x3fd9[_0x1a3c0e];return _0x4a9ed3;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x93fd('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x93fd('0x1'),'afterUpdate':_0x93fd('0x2'),'afterDestroy':_0x93fd('0x3')};function emitEvent(_0x1c3c7a){return function(_0x564077,_0x160192,_0x3d2fa4){SmsMessageEvents[_0x93fd('0x4')](_0x1c3c7a+':'+_0x564077['id'],_0x564077);SmsMessageEvents['emit'](_0x1c3c7a,_0x564077);_0x3d2fa4(null);};}for(var e in events){if(events[_0x93fd('0x5')](e)){var event=events[e];SmsMessage[_0x93fd('0x6')](e,emitEvent(event));}}module[_0x93fd('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 3819e1c..23dbe71 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 _0x61ef=['sort','createHash','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','catch','error','out','SmsAccountId','then','type','twilio','authToken','accountSid','create','phone','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','sms','POST','user_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','token','%s:%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x61ef,0x1e7));var _0xf61e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x61ef[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xf61e('0x0'));var util=require(_0xf61e('0x1'));var logger=require('../../config/logger')(_0xf61e('0x2'));var moment=require('moment');var BPromise=require(_0xf61e('0x3'));var rp=require(_0xf61e('0x4'));var fs=require('fs');var path=require(_0xf61e('0x5'));var rimraf=require(_0xf61e('0x6'));var config=require(_0xf61e('0x7'));var attributes=require('./smsMessage.attributes');module[_0xf61e('0x8')]=function(_0x3a4b7a,_0x3f51d5){return _0x3a4b7a['define']('SmsMessage',attributes,{'tableName':_0xf61e('0x9'),'paranoid':![],'indexes':[{'name':_0xf61e('0xa'),'fields':['messageId']},{'name':_0xf61e('0xb'),'fields':[_0xf61e('0xc')],'type':_0xf61e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28d185,_0x483ac8,_0x186c33){var _0x3dfb9d=_0x3a4b7a['models'];var _0x2e472c=_0x28d185[_0xf61e('0xe')]({'plain':!![]});if(_0x2e472c['direction']['toLowerCase']()==='in'||_0x2e472c[_0xf61e('0xf')][_0xf61e('0x10')]()==='out'&&!_0x2e472c[_0xf61e('0x11')]&&!_[_0xf61e('0x12')](_0x2e472c[_0xf61e('0x13')])&&!_[_0xf61e('0x12')](_0x2e472c[_0xf61e('0x14')])){_0x3dfb9d[_0xf61e('0x15')][_0xf61e('0x16')]({'where':{'id':_0x2e472c['SmsInteractionId']}})['then'](function(_0x142d86){if(_0x142d86){_0x142d86[_0xf61e('0x17')]({'lastMsgAt':_0x2e472c['createdAt'],'lastMsgDirection':_0x2e472c[_0xf61e('0xf')][_0xf61e('0x10')]()});}})[_0xf61e('0x18')](function(_0x22378e){console[_0xf61e('0x19')](_0x22378e);});}if(_0x2e472c[_0xf61e('0xf')]===_0xf61e('0x1a')&&!_0x2e472c[_0xf61e('0x11')]){var _0xc40a59;_0x3dfb9d['SmsAccount']['find']({'where':{'id':_0x2e472c[_0xf61e('0x1b')]},'raw':!![]})[_0xf61e('0x1c')](function(_0x1c5369){_0xc40a59=_0x1c5369;if(_0xc40a59&&_0xc40a59[_0xf61e('0x1d')]){switch(_0xc40a59[_0xf61e('0x1d')]){case _0xf61e('0x1e'):var _0x14686a=require(_0xf61e('0x1e'));if(_0xc40a59['accountSid']&&_0xc40a59[_0xf61e('0x1f')]&&_0xc40a59['phone']){var _0x27644f=new _0x14686a(_0xc40a59[_0xf61e('0x20')],_0xc40a59[_0xf61e('0x1f')]);_0x27644f['messages'][_0xf61e('0x21')]({'body':_0x2e472c[_0xf61e('0xc')],'to':_0x2e472c[_0xf61e('0x22')],'from':_0xc40a59[_0xf61e('0x22')],'statusCallback':_0xc40a59[_0xf61e('0x23')]+'/api/sms/messages/'+_0x2e472c['id']+_0xf61e('0x24')+_0xc40a59['token']})[_0xf61e('0x1c')](function(_0x5b0ec6){if(_0x5b0ec6[_0xf61e('0x25')]){return _0x28d185[_0xf61e('0x17')]({'messageId':_0x5b0ec6[_0xf61e('0x25')]});}})[_0xf61e('0x18')](function(_0x7dc47a){logger['error'](_0xf61e('0x26'),'afterCreate',_0xf61e('0x1e'),util[_0xf61e('0x27')](_0x7dc47a,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xf61e('0x29'):var _0x2a0125=_0xf61e('0x2a');if(_0xc40a59[_0xf61e('0x2b')]&&_0xc40a59[_0xf61e('0x2c')]){var _0x59eef4={'recipient':[_0x2e472c[_0xf61e('0x22')]],'message':_0x2e472c[_0xf61e('0xc')],'message_type':_0xc40a59[_0xf61e('0x2d')]};if(_0xc40a59['smsMethod']&&_0xc40a59[_0xf61e('0x2d')]!=='SI'){_0x59eef4[_0xf61e('0x2e')]=_0xc40a59[_0xf61e('0x22')];}var _0x5edf47={'url':_0x2a0125+_0xf61e('0x2f')+_0xc40a59[_0xf61e('0x2b')]+'&password='+_0xc40a59[_0xf61e('0x2c')],'method':_0xf61e('0x30')};rp(_0x5edf47)['then'](function(_0x6f63f2){var _0x593020=_0x6f63f2['split'](';');var _0x2d06ab={'user_key':_0x593020[0x0],'session_key':_0x593020[0x1]};_0x5edf47={'url':_0x2a0125+_0xf61e('0x31'),'method':_0xf61e('0x32'),'headers':{'user_key':_0x2d06ab[_0xf61e('0x33')],'Session_key':_0x2d06ab['session_key']},'json':!![],'body':_0x59eef4};return rp(_0x5edf47);})['then'](function(_0x53f57b){if(_0x53f57b[_0xf61e('0x34')]>=0x1){var _0x8e1a97={'messageId':_0x53f57b[_0xf61e('0x35')]};if(_0xc40a59[_0xf61e('0x2d')]!=='GP'||!_0xc40a59['deliveryReport']){_0x8e1a97[_0xf61e('0x36')]=!![];}return _0x28d185[_0xf61e('0x17')](_0x8e1a97);}else{return logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),'skebby',util[_0xf61e('0x27')](_0x53f57b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x722b77){return logger['error'](_0xf61e('0x26'),'afterCreate',_0xf61e('0x29'),util[_0xf61e('0x27')](_0x722b77,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'skebby',_0xf61e('0x37'));}break;case _0xf61e('0x38'):if(_0xc40a59[_0xf61e('0x1f')]){var _0x4e33e9={'recipient':_0x2e472c['phone'],'message':_0x2e472c[_0xf61e('0xc')],'sender':_0xc40a59[_0xf61e('0x39')]||_0xc40a59['phone'],'authorization':_0xc40a59['authToken']};var _0x483ac8={'method':_0xf61e('0x32'),'uri':_0xf61e('0x3a'),'body':_0x4e33e9,'json':!![]};rp(_0x483ac8)[_0xf61e('0x1c')](function(_0xbff8c5){var _0xb8a230={'messageId':_0xbff8c5[_0xf61e('0x3b')]};if(!_0xc40a59[_0xf61e('0x3c')]){_0xb8a230['read']=!![];}return _0x28d185[_0xf61e('0x17')](_0xb8a230);})[_0xf61e('0x18')](function(_0x13d3e7){logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'connectel',util[_0xf61e('0x27')](_0x13d3e7,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x38'),_0xf61e('0x3d'));}break;case _0xf61e('0x3e'):if(_0xc40a59[_0xf61e('0x2b')]&&_0xc40a59[_0xf61e('0x2c')]){var _0x4e33e9={'messages':[{'source':'xCALLY\x20Motion','to':_0x2e472c[_0xf61e('0x22')],'body':_0x2e472c[_0xf61e('0xc')],'from':_0xc40a59[_0xf61e('0x39')]||_0xc40a59[_0xf61e('0x22')]}]};var _0x51df54=util[_0xf61e('0x3f')]('%s:%s',_0xc40a59['username'],_0xc40a59['password']);var _0x483ac8={'method':_0xf61e('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4e33e9,'headers':{'Authorization':util[_0xf61e('0x3f')](_0xf61e('0x40'),new Buffer(_0x51df54)[_0xf61e('0x41')](_0xf61e('0x42')))},'json':!![]};rp(_0x483ac8)[_0xf61e('0x1c')](function(_0x541561){if(_0x541561[_0xf61e('0x43')]>=0xc8&&_0x541561[_0xf61e('0x43')]<=0xce){if(_0x541561[_0xf61e('0x44')]&&_0x541561[_0xf61e('0x44')][_0xf61e('0x45')]>0x0){var _0x443c7a=_[_0xf61e('0x46')](_0x541561['data']['messages']);var _0x4a4ea8={'messageId':_0x443c7a[_0xf61e('0x47')]};if(!_0xc40a59[_0xf61e('0x3c')]){_0x4a4ea8[_0xf61e('0x36')]=!![];}return _0x28d185['update'](_0x4a4ea8);}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'clickSend',util[_0xf61e('0x27')](_0x541561,{'showHidden':![],'depth':null}));}}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),_0xf61e('0x48'),util[_0xf61e('0x27')](_0x541561,{'showHidden':![],'depth':null}));}})[_0xf61e('0x18')](function(_0x2173b3){logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'clickSend',util[_0xf61e('0x27')](_0x2173b3,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf61e('0x49'):if(_0xc40a59[_0xf61e('0x4a')]&&_0xc40a59['authToken']){var _0x4e33e9={'dst':_0x2e472c[_0xf61e('0x22')],'text':_0x2e472c[_0xf61e('0xc')],'src':_0xc40a59['senderString']||_0xc40a59[_0xf61e('0x22')],'url':_0xc40a59['remote']+_0xf61e('0x4b')+_0x2e472c['id']+_0xf61e('0x24')+_0xc40a59[_0xf61e('0x4c')]};var _0x51df54=util[_0xf61e('0x3f')](_0xf61e('0x4d'),_0xc40a59[_0xf61e('0x4a')],_0xc40a59[_0xf61e('0x1f')]);var _0x483ac8={'method':_0xf61e('0x32'),'uri':util[_0xf61e('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0xc40a59['authId']),'body':_0x4e33e9,'headers':{'Authorization':util['format'](_0xf61e('0x40'),new Buffer(_0x51df54)[_0xf61e('0x41')](_0xf61e('0x42')))},'json':!![]};rp(_0x483ac8)['then'](function(_0x58d62f){var _0x20364c={'messageId':_0x58d62f[_0xf61e('0x4e')][0x0]};return _0x28d185[_0xf61e('0x17')](_0x20364c);})[_0xf61e('0x18')](function(_0x282c8f){logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x49'),util['inspect'](_0x282c8f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf61e('0x26'),'afterCreate','plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf61e('0x4f'):if(_0xc40a59[_0xf61e('0x2b')]&&_0xc40a59[_0xf61e('0x2c')]){if(_0xc40a59['baseUrl']){var _0x41e340={'method':_0xf61e('0x32'),'uri':_0xc40a59[_0xf61e('0x50')]+_0xf61e('0x51'),'body':{'username':_0xc40a59['username'],'password':_0xc40a59['password']},'json':!![]};return rp(_0x41e340)[_0xf61e('0x1c')](function(_0x366071){var _0x457327={'method':'POST','uri':_0xc40a59[_0xf61e('0x50')]+_0xf61e('0x52'),'body':{'messages':[{'from':_0xc40a59[_0xf61e('0x22')],'destinations':[{'to':_0x2e472c[_0xf61e('0x22')]}],'text':_0x2e472c[_0xf61e('0xc')],'notifyUrl':_0xc40a59['remote']+_0xf61e('0x4b')+_0x2e472c['id']+'/status?token='+_0xc40a59['token'],'notifyContentType':_0xf61e('0x53'),'callbackData':_0xc40a59[_0xf61e('0x22')]+';'+_0x2e472c[_0xf61e('0xc')]}]},'headers':{'Authorization':_0xf61e('0x54')+_0x366071[_0xf61e('0x4c')]},'json':!![]};return rp(_0x457327)[_0xf61e('0x1c')](function(_0x37ed85){if(_0x37ed85[_0xf61e('0x55')]){var _0x28d0f6={'messageId':_0x37ed85[_0xf61e('0x55')][0x0][_0xf61e('0xa')]};if(!_0xc40a59[_0xf61e('0x3c')]){_0x28d0f6[_0xf61e('0x36')]=!![];}return _0x28d185['update'](_0x28d0f6);}else{return logger['error'](_0xf61e('0x26'),'afterCreate',_0xf61e('0x4f'),util[_0xf61e('0x27')](_0x37ed85,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x54df54){return logger['error'](_0xf61e('0x26'),_0xf61e('0x28'),'infobip',util[_0xf61e('0x27')](_0x54df54,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),_0xf61e('0x4f'),_0xf61e('0x56'));}}else{logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x5c6d1e=require(_0xf61e('0x57'));if(_0xc40a59[_0xf61e('0x58')]){var _0x10a2bb={};_0x10a2bb[_0xf61e('0x59')]=_0xc40a59[_0xf61e('0x2b')];_0x10a2bb['phone']=_0x2e472c[_0xf61e('0x22')];_0x10a2bb[_0xf61e('0x2e')]=_0xc40a59['phone'];_0x10a2bb[_0xf61e('0x5a')]=_0x2e472c[_0xf61e('0xc')];_0x10a2bb[_0xf61e('0x5b')]=+new Date();var _0x397b6b='';var _0x28679f='';var _0x442259=Object[_0xf61e('0x5c')](_0x10a2bb);_0x442259[_0xf61e('0x5d')]();for(var _0x278946=0x0;_0x278946<_0x442259['length'];_0x278946++){if(_0x397b6b!=''){_0x397b6b+='&';}_0x397b6b+=_0x442259[_0x278946]+'='+encodeURIComponent(_0x10a2bb[_0x442259[_0x278946]]);_0x28679f+=_0x10a2bb[_0x442259[_0x278946]];}_0x28679f+=_0xc40a59[_0xf61e('0x58')];_0x28679f=_0x5c6d1e[_0xf61e('0x5e')]('md5')[_0xf61e('0x17')](_0x28679f)['digest']('hex');if(_0x397b6b!==''){_0x397b6b+='&';}_0x397b6b+=_0xf61e('0x5f')+_0x28679f;var _0x5edf47={'method':_0xf61e('0x30'),'uri':_0xc40a59['baseUrl']+'/external/get/send.php?'+_0x397b6b,'json':!![]};return rp(_0x5edf47)['then'](function(_0x6261b6){var _0x5f4d71=Object[_0xf61e('0x5c')](_0x6261b6);if(_0x6261b6[_0x5f4d71[0x0]][_0xf61e('0x19')]&&parseInt(_0x6261b6[_0x5f4d71[0x0]][_0xf61e('0x19')])===0x0){var _0x5bdb1f={'messageId':_0x6261b6[_0x5f4d71[0x0]][_0xf61e('0x60')]};if(!_0xc40a59[_0xf61e('0x3c')]){_0x5bdb1f[_0xf61e('0x36')]=!![];}return _0x28d185['update'](_0x5bdb1f);}else{return logger['error'](_0xf61e('0x26'),_0xf61e('0x28'),'csc',util[_0xf61e('0x27')](_0x6261b6[_0xf61e('0x19')],{'showHidden':![],'depth':null}));}})[_0xf61e('0x18')](function(_0x3b932c){return logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'csc',util[_0xf61e('0x27')](_0x3b932c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf61e('0x26'),_0xf61e('0x28'),'csc',_0xf61e('0x61'));}break;case _0xf61e('0x62'):if(_0xc40a59[_0xf61e('0x58')]){var _0x197f37={'method':_0xf61e('0x32'),'uri':_0xf61e('0x63'),'headers':{'Authorization':_0xc40a59[_0xf61e('0x58')]},'body':{'content':_0x2e472c[_0xf61e('0xc')],'to':[_0x2e472c[_0xf61e('0x22')]],'from':_0xc40a59[_0xf61e('0x22')],'binary':![],'clientMessageId':_0xf61e('0x64'),'charset':_0xf61e('0x65')},'json':!![]};rp(_0x197f37)[_0xf61e('0x1c')](function(_0x4b5ba0){if(!_0x4b5ba0['error']){var _0x260ba8={'messageId':_0x4b5ba0[_0xf61e('0x55')][0x0]['apiMessageId']};if(!_0xc40a59[_0xf61e('0x3c')]){_0x260ba8['read']=!![];}return _0x28d185[_0xf61e('0x17')](_0x260ba8);}else{return logger['error'](_0xf61e('0x26'),_0xf61e('0x28'),_0xf61e('0x62'),util[_0xf61e('0x27')](_0x4b5ba0[_0xf61e('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x29d8f6){return logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),'clickatell',util[_0xf61e('0x27')](_0x29d8f6,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),_0xf61e('0x62'),_0xf61e('0x61'));}break;case _0xf61e('0x66'):if(_0xc40a59[_0xf61e('0x2b')]&&_0xc40a59[_0xf61e('0x2c')]){var _0x51df54=util['format']('%s:%s',_0xc40a59[_0xf61e('0x2b')],_0xc40a59['password']);var _0x483ac8={'method':_0xf61e('0x32'),'uri':_0xf61e('0x67')+_0xc40a59['accountId']+_0xf61e('0x68'),'body':{'to':[_0x2e472c[_0xf61e('0x22')]],'text':_0x2e472c[_0xf61e('0xc')],'from':_0xc40a59['phone'],'applicationId':_0xc40a59[_0xf61e('0x69')]},'headers':{'Authorization':util[_0xf61e('0x3f')](_0xf61e('0x40'),new Buffer(_0x51df54)[_0xf61e('0x41')]('base64'))},'json':!![]};rp(_0x483ac8)['then'](function(_0x11519c){if(_0x11519c['id']){var _0x4d62be={'messageId':_0x11519c['id']};return _0x28d185[_0xf61e('0x17')](_0x4d62be);}else{logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf61e('0x66'),util['inspect'](_0x11519c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a7ea4){logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x66'),util[_0xf61e('0x27')](_0x2a7ea4,{'showHidden':![],'depth':null}));});}else{logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),_0xf61e('0x66'),_0xf61e('0x37'));}break;case'intelepeer':if(_0xc40a59[_0xf61e('0x58')]){var _0x251bad={};var _0x5edf47={'method':_0xf61e('0x32'),'uri':_0xf61e('0x6a'),'headers':{'Authorization':_0xf61e('0x6b')+_0xc40a59[_0xf61e('0x58')],'Content-Type':_0xf61e('0x53')},'body':{'from':_0xc40a59['phone'],'to':_0x2e472c[_0xf61e('0x22')],'text':_0x2e472c[_0xf61e('0xc')]},'json':!![]};return rp(_0x5edf47)[_0xf61e('0x1c')](function(_0x45f01e){if(_0x45f01e[_0xf61e('0x6c')]==0xca){_0x251bad[_0xf61e('0x6d')]=_0x45f01e;var _0x24d16c={'method':_0xf61e('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xf61e('0x6b')+_0xc40a59[_0xf61e('0x58')],'Content-Type':_0xf61e('0x53')},'body':{'refid':_0x251bad['message'][_0xf61e('0x6e')]},'json':!![]};return rp(_0x24d16c)[_0xf61e('0x1c')](function(_0x13c9ff){_0x251bad[_0xf61e('0x6f')]=_0x13c9ff;var _0xea8398={'messageId':_0x251bad['message'][_0xf61e('0x6e')],'read':!![]};return _0x28d185[_0xf61e('0x17')](_0xea8398);});}else{return logger[_0xf61e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x70'),util[_0xf61e('0x27')](_0x45f01e,{'showHidden':![],'depth':null}));}})[_0xf61e('0x18')](function(_0xe8edc3){return logger[_0xf61e('0x19')](_0xf61e('0x26'),_0xf61e('0x28'),'intelepeer',util[_0xf61e('0x27')](_0xe8edc3,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf61e('0x28'),_0xf61e('0x70'),_0xf61e('0x71'));}break;}}})[_0xf61e('0x72')](function(){_0x186c33();});}else{_0x186c33();}}},'charset':_0xf61e('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc09e=['sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/status?token=','token','then','sid','error','afterCreate','inspect','skebby','username','password','smsMethod','sender','&password=','sms','user_key','total_sent','read','SmsMessage,\x20%s,\x20%s,\x20%s','connectel','senderString','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','POST','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','createHash','md5','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage'];(function(_0x4266bd,_0x1a8fe7){var _0x2d2227=function(_0x1f2d0c){while(--_0x1f2d0c){_0x4266bd['push'](_0x4266bd['shift']());}};_0x2d2227(++_0x1a8fe7);}(_0xc09e,0x71));var _0xec09=function(_0xeaa9dc,_0x2deae1){_0xeaa9dc=_0xeaa9dc-0x0;var _0xc134bb=_0xc09e[_0xeaa9dc];return _0xc134bb;};'use strict';var _=require('lodash');var util=require(_0xec09('0x0'));var logger=require(_0xec09('0x1'))(_0xec09('0x2'));var moment=require(_0xec09('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec09('0x4'));var rimraf=require(_0xec09('0x5'));var config=require(_0xec09('0x6'));var attributes=require(_0xec09('0x7'));module[_0xec09('0x8')]=function(_0x181d5,_0x5856b8){return _0x181d5['define'](_0xec09('0x9'),attributes,{'tableName':_0xec09('0xa'),'paranoid':![],'indexes':[{'name':_0xec09('0xb'),'fields':['messageId']},{'name':_0xec09('0xc'),'fields':['body'],'type':_0xec09('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56b473,_0x50e66e,_0x24f383){var _0x51428d=_0x181d5[_0xec09('0xe')];var _0x31c0ad=_0x56b473[_0xec09('0xf')]({'plain':!![]});if(_0x31c0ad[_0xec09('0x10')][_0xec09('0x11')]()==='in'||_0x31c0ad[_0xec09('0x10')][_0xec09('0x11')]()===_0xec09('0x12')&&!_0x31c0ad[_0xec09('0x13')]&&!_[_0xec09('0x14')](_0x31c0ad[_0xec09('0x15')])&&!_[_0xec09('0x14')](_0x31c0ad[_0xec09('0x16')])){_0x51428d[_0xec09('0x17')][_0xec09('0x18')]({'where':{'id':_0x31c0ad[_0xec09('0x16')]}})['then'](function(_0x324988){if(_0x324988){_0x324988[_0xec09('0x19')]({'lastMsgAt':_0x31c0ad[_0xec09('0x1a')],'lastMsgDirection':_0x31c0ad['direction'][_0xec09('0x11')]()});}})[_0xec09('0x1b')](function(_0x16bcf1){console['error'](_0x16bcf1);});}if(_0x31c0ad[_0xec09('0x10')]==='out'&&!_0x31c0ad[_0xec09('0x13')]){var _0x3c2ceb;_0x51428d['SmsAccount'][_0xec09('0x1c')]({'where':{'id':_0x31c0ad[_0xec09('0x1d')]},'raw':!![]})['then'](function(_0x18a497){_0x3c2ceb=_0x18a497;if(_0x3c2ceb&&_0x3c2ceb['type']){switch(_0x3c2ceb[_0xec09('0x1e')]){case _0xec09('0x1f'):var _0x5b597f=require(_0xec09('0x1f'));if(_0x3c2ceb[_0xec09('0x20')]&&_0x3c2ceb[_0xec09('0x21')]&&_0x3c2ceb[_0xec09('0x22')]){var _0x2a5f0d=new _0x5b597f(_0x3c2ceb[_0xec09('0x20')],_0x3c2ceb[_0xec09('0x21')]);_0x2a5f0d[_0xec09('0x23')][_0xec09('0x24')]({'body':_0x31c0ad[_0xec09('0x25')],'to':_0x31c0ad[_0xec09('0x22')],'from':_0x3c2ceb[_0xec09('0x22')],'statusCallback':_0x3c2ceb[_0xec09('0x26')]+'/api/sms/messages/'+_0x31c0ad['id']+_0xec09('0x27')+_0x3c2ceb[_0xec09('0x28')]})[_0xec09('0x29')](function(_0x2d2cba){if(_0x2d2cba['sid']){return _0x56b473[_0xec09('0x19')]({'messageId':_0x2d2cba[_0xec09('0x2a')]});}})['catch'](function(_0x45b7d7){logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),_0xec09('0x1f'),util[_0xec09('0x2d')](_0x45b7d7,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xec09('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xec09('0x2e'):var _0x4fa198='https://api.skebby.it/API/v1.0/REST/';if(_0x3c2ceb[_0xec09('0x2f')]&&_0x3c2ceb[_0xec09('0x30')]){var _0x3251c9={'recipient':[_0x31c0ad[_0xec09('0x22')]],'message':_0x31c0ad['body'],'message_type':_0x3c2ceb[_0xec09('0x31')]};if(_0x3c2ceb['smsMethod']&&_0x3c2ceb[_0xec09('0x31')]!=='SI'){_0x3251c9[_0xec09('0x32')]=_0x3c2ceb[_0xec09('0x22')];}var _0x2bce56={'url':_0x4fa198+'login?username='+_0x3c2ceb['username']+_0xec09('0x33')+_0x3c2ceb[_0xec09('0x30')],'method':'GET'};rp(_0x2bce56)[_0xec09('0x29')](function(_0x51c8be){var _0x285166=_0x51c8be['split'](';');var _0x55d54a={'user_key':_0x285166[0x0],'session_key':_0x285166[0x1]};_0x2bce56={'url':_0x4fa198+_0xec09('0x34'),'method':'POST','headers':{'user_key':_0x55d54a[_0xec09('0x35')],'Session_key':_0x55d54a['session_key']},'json':!![],'body':_0x3251c9};return rp(_0x2bce56);})[_0xec09('0x29')](function(_0xe6b96d){if(_0xe6b96d[_0xec09('0x36')]>=0x1){var _0x29b885={'messageId':_0xe6b96d['internal_order_id']};if(_0x3c2ceb[_0xec09('0x31')]!=='GP'||!_0x3c2ceb['deliveryReport']){_0x29b885[_0xec09('0x37')]=!![];}return _0x56b473['update'](_0x29b885);}else{return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),'skebby',util['inspect'](_0xe6b96d,{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0x7a0b68){return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x2e'),util[_0xec09('0x2d')](_0x7a0b68,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')](_0xec09('0x38'),'afterCreate',_0xec09('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xec09('0x39'):if(_0x3c2ceb[_0xec09('0x21')]){var _0x3e6724={'recipient':_0x31c0ad[_0xec09('0x22')],'message':_0x31c0ad['body'],'sender':_0x3c2ceb[_0xec09('0x3a')]||_0x3c2ceb[_0xec09('0x22')],'authorization':_0x3c2ceb['authToken']};var _0x50e66e={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3e6724,'json':!![]};rp(_0x50e66e)[_0xec09('0x29')](function(_0x31de1e){var _0x58e9b6={'messageId':_0x31de1e[_0xec09('0x3b')]};if(!_0x3c2ceb[_0xec09('0x3c')]){_0x58e9b6['read']=!![];}return _0x56b473['update'](_0x58e9b6);})[_0xec09('0x1b')](function(_0x3dfbfd){logger['error'](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x39'),util[_0xec09('0x2d')](_0x3dfbfd,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),'connectel',_0xec09('0x3d'));}break;case _0xec09('0x3e'):if(_0x3c2ceb['username']&&_0x3c2ceb[_0xec09('0x30')]){var _0x3e6724={'messages':[{'source':_0xec09('0x3f'),'to':_0x31c0ad[_0xec09('0x22')],'body':_0x31c0ad[_0xec09('0x25')],'from':_0x3c2ceb[_0xec09('0x3a')]||_0x3c2ceb['phone']}]};var _0x25a5ef=util[_0xec09('0x40')](_0xec09('0x41'),_0x3c2ceb[_0xec09('0x2f')],_0x3c2ceb[_0xec09('0x30')]);var _0x50e66e={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3e6724,'headers':{'Authorization':util['format'](_0xec09('0x42'),new Buffer(_0x25a5ef)[_0xec09('0x43')](_0xec09('0x44')))},'json':!![]};rp(_0x50e66e)[_0xec09('0x29')](function(_0x27bac6){if(_0x27bac6[_0xec09('0x45')]>=0xc8&&_0x27bac6[_0xec09('0x45')]<=0xce){if(_0x27bac6[_0xec09('0x46')]&&_0x27bac6[_0xec09('0x46')][_0xec09('0x47')]>0x0){var _0x10ac0d=_[_0xec09('0x48')](_0x27bac6[_0xec09('0x46')][_0xec09('0x23')]);var _0x3aefdd={'messageId':_0x10ac0d[_0xec09('0x49')]};if(!_0x3c2ceb['deliveryReport']){_0x3aefdd['read']=!![];}return _0x56b473[_0xec09('0x19')](_0x3aefdd);}else{logger[_0xec09('0x2b')](_0xec09('0x38'),'afterCreate','clickSend',util['inspect'](_0x27bac6,{'showHidden':![],'depth':null}));}}else{logger[_0xec09('0x2b')](_0xec09('0x38'),'afterCreate','clickSend',util[_0xec09('0x2d')](_0x27bac6,{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0xa7ad6c){logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),_0xec09('0x4a'),util[_0xec09('0x2d')](_0xa7ad6c,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')](_0xec09('0x38'),'afterCreate',_0xec09('0x4a'),_0xec09('0x4b'));}break;case _0xec09('0x4c'):if(_0x3c2ceb[_0xec09('0x4d')]&&_0x3c2ceb[_0xec09('0x21')]){var _0x3e6724={'dst':_0x31c0ad[_0xec09('0x22')],'text':_0x31c0ad[_0xec09('0x25')],'src':_0x3c2ceb['senderString']||_0x3c2ceb[_0xec09('0x22')],'url':_0x3c2ceb[_0xec09('0x26')]+_0xec09('0x4e')+_0x31c0ad['id']+'/status?token='+_0x3c2ceb[_0xec09('0x28')]};var _0x25a5ef=util['format'](_0xec09('0x41'),_0x3c2ceb[_0xec09('0x4d')],_0x3c2ceb[_0xec09('0x21')]);var _0x50e66e={'method':_0xec09('0x4f'),'uri':util[_0xec09('0x40')](_0xec09('0x50'),_0x3c2ceb[_0xec09('0x4d')]),'body':_0x3e6724,'headers':{'Authorization':util['format'](_0xec09('0x42'),new Buffer(_0x25a5ef)[_0xec09('0x43')](_0xec09('0x44')))},'json':!![]};rp(_0x50e66e)['then'](function(_0x254a7b){var _0x4695ef={'messageId':_0x254a7b[_0xec09('0x51')][0x0]};return _0x56b473[_0xec09('0x19')](_0x4695ef);})[_0xec09('0x1b')](function(_0x137b2d){logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x4c'),util[_0xec09('0x2d')](_0x137b2d,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x4c'),_0xec09('0x52'));}break;case _0xec09('0x53'):if(_0x3c2ceb['username']&&_0x3c2ceb[_0xec09('0x30')]){if(_0x3c2ceb[_0xec09('0x54')]){var _0x88d536={'method':'POST','uri':_0x3c2ceb[_0xec09('0x54')]+'/auth/1/session','body':{'username':_0x3c2ceb['username'],'password':_0x3c2ceb[_0xec09('0x30')]},'json':!![]};return rp(_0x88d536)['then'](function(_0x263860){var _0x3ed317={'method':_0xec09('0x4f'),'uri':_0x3c2ceb[_0xec09('0x54')]+_0xec09('0x55'),'body':{'messages':[{'from':_0x3c2ceb[_0xec09('0x22')],'destinations':[{'to':_0x31c0ad[_0xec09('0x22')]}],'text':_0x31c0ad[_0xec09('0x25')],'notifyUrl':_0x3c2ceb['remote']+_0xec09('0x4e')+_0x31c0ad['id']+_0xec09('0x27')+_0x3c2ceb[_0xec09('0x28')],'notifyContentType':_0xec09('0x56'),'callbackData':_0x3c2ceb[_0xec09('0x22')]+';'+_0x31c0ad[_0xec09('0x25')]}]},'headers':{'Authorization':_0xec09('0x57')+_0x263860['token']},'json':!![]};return rp(_0x3ed317)[_0xec09('0x29')](function(_0x1fd073){if(_0x1fd073[_0xec09('0x23')]){var _0x25bdea={'messageId':_0x1fd073['messages'][0x0]['messageId']};if(!_0x3c2ceb[_0xec09('0x3c')]){_0x25bdea['read']=!![];}return _0x56b473['update'](_0x25bdea);}else{return logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),_0xec09('0x53'),util['inspect'](_0x1fd073,{'showHidden':![],'depth':null}));}});})[_0xec09('0x1b')](function(_0x1c8690){return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x53'),util[_0xec09('0x2d')](_0x1c8690,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x53'),_0xec09('0x58'));}}else{logger[_0xec09('0x2b')](_0xec09('0x38'),'afterCreate',_0xec09('0x53'),_0xec09('0x4b'));}break;case _0xec09('0x59'):var _0x511a41=require(_0xec09('0x5a'));if(_0x3c2ceb[_0xec09('0x5b')]){var _0xe731c4={};_0xe731c4[_0xec09('0x5c')]=_0x3c2ceb[_0xec09('0x2f')];_0xe731c4[_0xec09('0x22')]=_0x31c0ad['phone'];_0xe731c4[_0xec09('0x32')]=_0x3c2ceb[_0xec09('0x22')];_0xe731c4[_0xec09('0x5d')]=_0x31c0ad['body'];_0xe731c4['timestamp']=+new Date();var _0x476299='';var _0x38854f='';var _0x4e585b=Object[_0xec09('0x5e')](_0xe731c4);_0x4e585b[_0xec09('0x5f')]();for(var _0x1dc3e6=0x0;_0x1dc3e6<_0x4e585b['length'];_0x1dc3e6++){if(_0x476299!=''){_0x476299+='&';}_0x476299+=_0x4e585b[_0x1dc3e6]+'='+encodeURIComponent(_0xe731c4[_0x4e585b[_0x1dc3e6]]);_0x38854f+=_0xe731c4[_0x4e585b[_0x1dc3e6]];}_0x38854f+=_0x3c2ceb[_0xec09('0x5b')];_0x38854f=_0x511a41[_0xec09('0x60')](_0xec09('0x61'))[_0xec09('0x19')](_0x38854f)['digest']('hex');if(_0x476299!==''){_0x476299+='&';}_0x476299+=_0xec09('0x62')+_0x38854f;var _0x2bce56={'method':_0xec09('0x63'),'uri':_0x3c2ceb[_0xec09('0x54')]+'/external/get/send.php?'+_0x476299,'json':!![]};return rp(_0x2bce56)[_0xec09('0x29')](function(_0x4c543d){var _0x216dd3=Object[_0xec09('0x5e')](_0x4c543d);if(_0x4c543d[_0x216dd3[0x0]]['error']&&parseInt(_0x4c543d[_0x216dd3[0x0]][_0xec09('0x2b')])===0x0){var _0x14e74f={'messageId':_0x4c543d[_0x216dd3[0x0]][_0xec09('0x64')]};if(!_0x3c2ceb[_0xec09('0x3c')]){_0x14e74f[_0xec09('0x37')]=!![];}return _0x56b473[_0xec09('0x19')](_0x14e74f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),'csc',util[_0xec09('0x2d')](_0x4c543d[_0xec09('0x2b')],{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0x2ff551){return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x59'),util[_0xec09('0x2d')](_0x2ff551,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xec09('0x59'),_0xec09('0x65'));}break;case'clickatell':if(_0x3c2ceb[_0xec09('0x5b')]){var _0x1326e0={'method':_0xec09('0x4f'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3c2ceb[_0xec09('0x5b')]},'body':{'content':_0x31c0ad[_0xec09('0x25')],'to':[_0x31c0ad[_0xec09('0x22')]],'from':_0x3c2ceb[_0xec09('0x22')],'binary':![],'clientMessageId':_0xec09('0x66'),'charset':_0xec09('0x67')},'json':!![]};rp(_0x1326e0)[_0xec09('0x29')](function(_0xc1c146){if(!_0xc1c146[_0xec09('0x2b')]){var _0x396e59={'messageId':_0xc1c146[_0xec09('0x23')][0x0][_0xec09('0x68')]};if(!_0x3c2ceb[_0xec09('0x3c')]){_0x396e59[_0xec09('0x37')]=!![];}return _0x56b473[_0xec09('0x19')](_0x396e59);}else{return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x69'),util[_0xec09('0x2d')](_0xc1c146[_0xec09('0x2b')],{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0x530b38){return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x69'),util[_0xec09('0x2d')](_0x530b38,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x69'),_0xec09('0x65'));}break;case _0xec09('0x6a'):if(_0x3c2ceb[_0xec09('0x2f')]&&_0x3c2ceb['password']){var _0x25a5ef=util[_0xec09('0x40')](_0xec09('0x41'),_0x3c2ceb[_0xec09('0x2f')],_0x3c2ceb[_0xec09('0x30')]);var _0x50e66e={'method':_0xec09('0x4f'),'uri':_0xec09('0x6b')+_0x3c2ceb[_0xec09('0x6c')]+_0xec09('0x6d'),'body':{'to':[_0x31c0ad[_0xec09('0x22')]],'text':_0x31c0ad[_0xec09('0x25')],'from':_0x3c2ceb[_0xec09('0x22')],'applicationId':_0x3c2ceb[_0xec09('0x6e')]},'headers':{'Authorization':util[_0xec09('0x40')](_0xec09('0x42'),new Buffer(_0x25a5ef)[_0xec09('0x43')](_0xec09('0x44')))},'json':!![]};rp(_0x50e66e)[_0xec09('0x29')](function(_0x10d023){if(_0x10d023['id']){var _0x1624ea={'messageId':_0x10d023['id']};return _0x56b473['update'](_0x1624ea);}else{logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x6a'),util[_0xec09('0x2d')](_0x10d023,{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0x279a64){logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),'bandwidth',util['inspect'](_0x279a64,{'showHidden':![],'depth':null}));});}else{logger[_0xec09('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xec09('0x2c'),_0xec09('0x6a'),_0xec09('0x4b'));}break;case _0xec09('0x6f'):if(_0x3c2ceb[_0xec09('0x5b')]){var _0x128706={};var _0x2bce56={'method':_0xec09('0x4f'),'uri':_0xec09('0x70'),'headers':{'Authorization':_0xec09('0x71')+_0x3c2ceb[_0xec09('0x5b')],'Content-Type':_0xec09('0x56')},'body':{'from':_0x3c2ceb['phone'],'to':_0x31c0ad['phone'],'text':_0x31c0ad['body']},'json':!![]};return rp(_0x2bce56)[_0xec09('0x29')](function(_0xd661b0){if(_0xd661b0[_0xec09('0x72')]==0xca){_0x128706[_0xec09('0x73')]=_0xd661b0;var _0x782da0={'method':_0xec09('0x4f'),'uri':_0xec09('0x74'),'headers':{'Authorization':_0xec09('0x71')+_0x3c2ceb['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x128706[_0xec09('0x73')][_0xec09('0x75')]},'json':!![]};return rp(_0x782da0)['then'](function(_0x1bdb5a){_0x128706[_0xec09('0x76')]=_0x1bdb5a;var _0x2384dc={'messageId':_0x128706['message']['refid'],'read':!![]};return _0x56b473[_0xec09('0x19')](_0x2384dc);});}else{return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),'intelepeer',util['inspect'](_0xd661b0,{'showHidden':![],'depth':null}));}})[_0xec09('0x1b')](function(_0xba3567){return logger[_0xec09('0x2b')](_0xec09('0x38'),_0xec09('0x2c'),_0xec09('0x6f'),util[_0xec09('0x2d')](_0xba3567,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xec09('0x38'),_0xec09('0x2c'),'intelepeer',_0xec09('0x77'));}break;}}})[_0xec09('0x78')](function(){_0x24f383();});}else{_0x24f383();}}},'charset':_0xec09('0x79'),'collate':_0xec09('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 8a246b3..f202658 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 _0x34c3=['stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x361514,_0x4795be){var _0x22a9dc=function(_0x23f5a3){while(--_0x23f5a3){_0x361514['push'](_0x361514['shift']());}};_0x22a9dc(++_0x4795be);}(_0x34c3,0x1ab));var _0x334c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x34c3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x334c('0x0'));var BPromise=require('bluebird');var rs=require(_0x334c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x334c('0x2'));var logger=require(_0x334c('0x3'))(_0x334c('0x4'));var config=require(_0x334c('0x5'));var jayson=require(_0x334c('0x6'));var client=jayson[_0x334c('0x7')][_0x334c('0x8')]({'port':0x232a});config[_0x334c('0x9')]=_[_0x334c('0xa')](config['redis'],{'host':_0x334c('0xb'),'port':0x18eb});var socket=require(_0x334c('0xc'))(new Redis(config['redis']));require(_0x334c('0xd'))[_0x334c('0xe')](socket);function respondWithRpcPromise(_0x1bd93e,_0x85a02a,_0x8839d2){return new BPromise(function(_0x383f77,_0x5b3bc0){return client[_0x334c('0xf')](_0x1bd93e,_0x8839d2)[_0x334c('0x10')](function(_0x32b977){logger[_0x334c('0x11')]('SmsMessage,\x20%s,\x20%s',_0x85a02a,_0x334c('0x12'));logger[_0x334c('0x13')](_0x334c('0x14'),_0x85a02a,_0x334c('0x12'),JSON[_0x334c('0x15')](_0x32b977));if(_0x32b977[_0x334c('0x16')]){if(_0x32b977['error'][_0x334c('0x17')]===0x1f4){logger[_0x334c('0x16')](_0x334c('0x18'),_0x85a02a,_0x32b977[_0x334c('0x16')][_0x334c('0x19')]);return _0x5b3bc0(_0x32b977[_0x334c('0x16')][_0x334c('0x19')]);}logger['error'](_0x334c('0x18'),_0x85a02a,_0x32b977['error'][_0x334c('0x19')]);return _0x383f77(_0x32b977[_0x334c('0x16')]['message']);}else{logger['info'](_0x334c('0x18'),_0x85a02a,_0x334c('0x12'));_0x383f77(_0x32b977['result']['message']);}})[_0x334c('0x1a')](function(_0x4365f6){logger['error'](_0x334c('0x18'),_0x85a02a,_0x4365f6);_0x5b3bc0(_0x4365f6);});});}exports[_0x334c('0x1b')]=function(_0x3dcbd7){var _0x3a4702=this;return new Promise(function(_0x450cc5,_0x112b21){return db[_0x334c('0x1c')]['create'](_0x3dcbd7[_0x334c('0x1d')],{'raw':_0x3dcbd7[_0x334c('0x1e')]?_0x3dcbd7[_0x334c('0x1e')][_0x334c('0x1f')]===undefined?!![]:![]:!![]})[_0x334c('0x10')](function(_0x6a10f3){logger[_0x334c('0x11')]('CreateSmsMessage',_0x3dcbd7);logger[_0x334c('0x13')](_0x334c('0x1b'),_0x3dcbd7,JSON['stringify'](_0x6a10f3));_0x450cc5(_0x6a10f3);})[_0x334c('0x1a')](function(_0x183d7a){logger[_0x334c('0x16')](_0x334c('0x1b'),_0x183d7a[_0x334c('0x19')],_0x3dcbd7);_0x112b21(_0x3a4702[_0x334c('0x16')](0x1f4,_0x183d7a[_0x334c('0x19')]));});});}; \ No newline at end of file +var _0xf597=['body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','then','info','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xf597,0x99));var _0x7f59=function(_0x389b1f,_0x4d110e){_0x389b1f=_0x389b1f-0x0;var _0xa34fd0=_0xf597[_0x389b1f];return _0xa34fd0;};'use strict';var _=require(_0x7f59('0x0'));var util=require(_0x7f59('0x1'));var moment=require(_0x7f59('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f59('0x3'));var db=require(_0x7f59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f59('0x5'))(_0x7f59('0x6'));var config=require('../../config/environment');var jayson=require(_0x7f59('0x7'));var client=jayson['client'][_0x7f59('0x8')]({'port':0x232a});config['redis']=_[_0x7f59('0x9')](config['redis'],{'host':_0x7f59('0xa'),'port':0x18eb});var socket=require(_0x7f59('0xb'))(new Redis(config[_0x7f59('0xc')]));require(_0x7f59('0xd'))['register'](socket);function respondWithRpcPromise(_0x117660,_0x1ba03c,_0x2879c3){return new BPromise(function(_0x488e40,_0x14882c){return client['request'](_0x117660,_0x2879c3)[_0x7f59('0xe')](function(_0x45aa04){logger[_0x7f59('0xf')]('SmsMessage,\x20%s,\x20%s',_0x1ba03c,_0x7f59('0x10'));logger[_0x7f59('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ba03c,'request\x20sent',JSON['stringify'](_0x45aa04));if(_0x45aa04[_0x7f59('0x12')]){if(_0x45aa04[_0x7f59('0x12')][_0x7f59('0x13')]===0x1f4){logger[_0x7f59('0x12')](_0x7f59('0x14'),_0x1ba03c,_0x45aa04[_0x7f59('0x12')][_0x7f59('0x15')]);return _0x14882c(_0x45aa04[_0x7f59('0x12')][_0x7f59('0x15')]);}logger[_0x7f59('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1ba03c,_0x45aa04['error'][_0x7f59('0x15')]);return _0x488e40(_0x45aa04[_0x7f59('0x12')][_0x7f59('0x15')]);}else{logger[_0x7f59('0xf')](_0x7f59('0x14'),_0x1ba03c,_0x7f59('0x10'));_0x488e40(_0x45aa04[_0x7f59('0x16')]['message']);}})[_0x7f59('0x17')](function(_0x331801){logger['error'](_0x7f59('0x14'),_0x1ba03c,_0x331801);_0x14882c(_0x331801);});});}exports[_0x7f59('0x18')]=function(_0x6d56b4){var _0x567a07=this;return new Promise(function(_0x12d108,_0x58a39f){return db[_0x7f59('0x19')][_0x7f59('0x1a')](_0x6d56b4[_0x7f59('0x1b')],{'raw':_0x6d56b4[_0x7f59('0x1c')]?_0x6d56b4[_0x7f59('0x1c')][_0x7f59('0x1d')]===undefined?!![]:![]:!![]})[_0x7f59('0xe')](function(_0x20b00a){logger[_0x7f59('0xf')](_0x7f59('0x18'),_0x6d56b4);logger[_0x7f59('0x11')](_0x7f59('0x18'),_0x6d56b4,JSON['stringify'](_0x20b00a));_0x12d108(_0x20b00a);})[_0x7f59('0x17')](function(_0x1a4fa6){logger['error']('CreateSmsMessage',_0x1a4fa6['message'],_0x6d56b4);_0x58a39f(_0x567a07[_0x7f59('0x12')](0x1f4,_0x1a4fa6[_0x7f59('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3f503f8..48141ef 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 _0x94e6=['removeListener','register','length','save','remove'];(function(_0x4c7410,_0x43bf77){var _0x2cf87d=function(_0x5f3db0){while(--_0x5f3db0){_0x4c7410['push'](_0x4c7410['shift']());}};_0x2cf87d(++_0x43bf77);}(_0x94e6,0xd0));var _0x694e=function(_0x4ae3e5,_0x2c4d4d){_0x4ae3e5=_0x4ae3e5-0x0;var _0x23ecd0=_0x94e6[_0x4ae3e5];return _0x23ecd0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x694e('0x0'),_0x694e('0x1'),'update'];function createListener(_0x3c1e3c,_0x144a9a){return function(_0x228f04){_0x144a9a['emit'](_0x3c1e3c,_0x228f04);};}function removeListener(_0x236279,_0x3ce9f5){return function(){SmsMessageEvents[_0x694e('0x2')](_0x236279,_0x3ce9f5);};}exports[_0x694e('0x3')]=function(_0x3e5827){for(var _0x54ff96=0x0,_0x5a3b9f=events[_0x694e('0x4')];_0x54ff96<_0x5a3b9f;_0x54ff96++){var _0x53f774=events[_0x54ff96];var _0x5a7e42=createListener('smsMessage:'+_0x53f774,_0x3e5827);SmsMessageEvents['on'](_0x53f774,_0x5a7e42);}}; \ No newline at end of file +var _0x6044=['update','emit','removeListener','smsMessage:','./smsMessage.events','save','remove'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6044,0x107));var _0x4604=function(_0x400ef0,_0x5da0bd){_0x400ef0=_0x400ef0-0x0;var _0x38c132=_0x6044[_0x400ef0];return _0x38c132;};'use strict';var SmsMessageEvents=require(_0x4604('0x0'));var events=[_0x4604('0x1'),_0x4604('0x2'),_0x4604('0x3')];function createListener(_0x499c4d,_0xbb8cfd){return function(_0x56e1cc){_0xbb8cfd[_0x4604('0x4')](_0x499c4d,_0x56e1cc);};}function removeListener(_0x2081e1,_0x66dbf1){return function(){SmsMessageEvents[_0x4604('0x5')](_0x2081e1,_0x66dbf1);};}exports['register']=function(_0x1b7a7f){for(var _0x3300d4=0x0,_0x1abb8f=events['length'];_0x3300d4<_0x1abb8f;_0x3300d4++){var _0x1eb1d3=events[_0x3300d4];var _0x173c7e=createListener(_0x4604('0x6')+_0x1eb1d3,_0x1b7a7f);SmsMessageEvents['on'](_0x1eb1d3,_0x173c7e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 826653a..d82d6b1 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 _0x39bf=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout'];(function(_0x565051,_0x19ab8d){var _0x48cf46=function(_0x2c25aa){while(--_0x2c25aa){_0x565051['push'](_0x565051['shift']());}};_0x48cf46(++_0x19ab8d);}(_0x39bf,0xcf));var _0xf39b=function(_0x87764a,_0x30ac55){_0x87764a=_0x87764a-0x0;var _0x2ba847=_0x39bf[_0x87764a];return _0x2ba847;};'use strict';var multer=require(_0xf39b('0x0'));var util=require(_0xf39b('0x1'));var path=require('path');var timeout=require(_0xf39b('0x2'));var express=require(_0xf39b('0x3'));var router=express[_0xf39b('0x4')]();var fs_extra=require(_0xf39b('0x5'));var auth=require(_0xf39b('0x6'));var interaction=require(_0xf39b('0x7'));var config=require('../../config/environment');var controller=require(_0xf39b('0x8'));router['get']('/',auth[_0xf39b('0x9')](),controller[_0xf39b('0xa')]);router[_0xf39b('0xb')](_0xf39b('0xc'),auth['isAuthenticated'](),controller[_0xf39b('0xd')]);router[_0xf39b('0xb')]('/:id',auth[_0xf39b('0x9')](),controller[_0xf39b('0xe')]);router[_0xf39b('0xb')]('/:id/members',auth[_0xf39b('0x9')](),controller[_0xf39b('0xf')]);router[_0xf39b('0xb')](_0xf39b('0x10'),auth[_0xf39b('0x9')](),controller[_0xf39b('0x11')]);router[_0xf39b('0xb')](_0xf39b('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf39b('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf39b('0x13')]('/:id/teams',auth[_0xf39b('0x9')](),controller[_0xf39b('0x14')]);router[_0xf39b('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xf39b('0x15')]);router[_0xf39b('0x16')](_0xf39b('0x17'),auth['isAuthenticated'](),controller[_0xf39b('0x18')]);router[_0xf39b('0x19')](_0xf39b('0x17'),auth[_0xf39b('0x9')](),controller[_0xf39b('0x1a')]);router['delete']('/:id/teams',auth[_0xf39b('0x9')](),controller[_0xf39b('0x1b')]);router[_0xf39b('0x19')](_0xf39b('0x12'),auth[_0xf39b('0x9')](),controller[_0xf39b('0x1c')]);module[_0xf39b('0x1d')]=router; \ No newline at end of file +var _0x47a8=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','express','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x47a8,0x105));var _0x847a=function(_0x1596d0,_0x495d38){_0x1596d0=_0x1596d0-0x0;var _0x337ec0=_0x47a8[_0x1596d0];return _0x337ec0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x847a('0x0'));var timeout=require('connect-timeout');var express=require(_0x847a('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x847a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x847a('0x3'));var controller=require(_0x847a('0x4'));router[_0x847a('0x5')]('/',auth[_0x847a('0x6')](),controller[_0x847a('0x7')]);router[_0x847a('0x5')](_0x847a('0x8'),auth['isAuthenticated'](),controller[_0x847a('0x9')]);router['get'](_0x847a('0xa'),auth[_0x847a('0x6')](),controller['show']);router[_0x847a('0x5')](_0x847a('0xb'),auth['isAuthenticated'](),controller[_0x847a('0xc')]);router['get'](_0x847a('0xd'),auth[_0x847a('0x6')](),controller[_0x847a('0xe')]);router[_0x847a('0x5')](_0x847a('0xf'),auth[_0x847a('0x6')](),controller['getAgents']);router[_0x847a('0x10')]('/',auth[_0x847a('0x6')](),controller[_0x847a('0x11')]);router[_0x847a('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x847a('0x12')]);router['post'](_0x847a('0xf'),auth[_0x847a('0x6')](),controller[_0x847a('0x13')]);router[_0x847a('0x14')](_0x847a('0xa'),auth[_0x847a('0x6')](),controller[_0x847a('0x15')]);router[_0x847a('0x16')](_0x847a('0xa'),auth[_0x847a('0x6')](),controller[_0x847a('0x17')]);router['delete'](_0x847a('0xd'),auth[_0x847a('0x6')](),controller[_0x847a('0x18')]);router[_0x847a('0x16')](_0x847a('0xf'),auth[_0x847a('0x6')](),controller[_0x847a('0x19')]);module[_0x847a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b6a4fe4..b484c42 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 _0xb62b=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb62b,0x16f));var _0xbb62=function(_0x444cf1,_0x29c81e){_0x444cf1=_0x444cf1-0x0;var _0x3da734=_0xb62b[_0x444cf1];return _0x3da734;};'use strict';var Sequelize=require(_0xbb62('0x0'));module[_0xbb62('0x1')]={'name':{'type':Sequelize[_0xbb62('0x2')],'unique':_0xbb62('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb62('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xcf69=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name'];(function(_0x55ba87,_0x35e591){var _0x3fdedf=function(_0x3c7693){while(--_0x3c7693){_0x55ba87['push'](_0x55ba87['shift']());}};_0x3fdedf(++_0x35e591);}(_0xcf69,0x105));var _0x9cf6=function(_0xa18665,_0x5d6110){_0xa18665=_0xa18665-0x0;var _0x521a06=_0xcf69[_0xa18665];return _0x521a06;};'use strict';var Sequelize=require(_0x9cf6('0x0'));module[_0x9cf6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9cf6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9cf6('0x3')]},'timeout':{'type':Sequelize[_0x9cf6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9cf6('0x5')]('rrmemory',_0x9cf6('0x6'),_0x9cf6('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e5e96ce..6bfc924 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 _0x3826=['path','sox','lodash','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','error','stack','name','index','map','SmsQueue','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','catch','show','params','rawAttributes','keys','includeAll','create','body','role','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','findAndCountAll','UserId','smsPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','voicePause','interface','Agents','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','util'];(function(_0xb2d8da,_0x239a95){var _0x377456=function(_0x3735f7){while(--_0x3735f7){_0xb2d8da['push'](_0xb2d8da['shift']());}};_0x377456(++_0x239a95);}(_0x3826,0x83));var _0x6382=function(_0x345a17,_0x3b9d2a){_0x345a17=_0x345a17-0x0;var _0xd0f947=_0x3826[_0x345a17];return _0xd0f947;};'use strict';var emlformat=require(_0x6382('0x0'));var rimraf=require(_0x6382('0x1'));var zipdir=require(_0x6382('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6382('0x3'));var moment=require(_0x6382('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6382('0x5'));var path=require(_0x6382('0x6'));var sox=require(_0x6382('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6382('0x8'));var squel=require('squel');var crypto=require(_0x6382('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6382('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6382('0xb'));var authService=require(_0x6382('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6382('0xd'));var hardwareService=require(_0x6382('0xe'));var logger=require('../../config/logger')(_0x6382('0xf'));var utils=require('../../config/utils');var config=require(_0x6382('0x10'));var licenseUtil=require(_0x6382('0x11'));var db=require(_0x6382('0x12'))['db'];config[_0x6382('0x13')]=_[_0x6382('0x14')](config[_0x6382('0x13')],{'host':_0x6382('0x15'),'port':0x18eb});var socket=require(_0x6382('0x16'))(new Redis(config['redis']));require(_0x6382('0x17'))[_0x6382('0x18')](socket);function respondWithStatusCode(_0x19e48a,_0x180d43){_0x180d43=_0x180d43||0xcc;return function(_0x20780f){if(_0x20780f){return _0x19e48a[_0x6382('0x19')](_0x180d43);}return _0x19e48a[_0x6382('0x1a')](_0x180d43)[_0x6382('0x1b')]();};}function respondWithResult(_0x536ea7,_0x114dc7){_0x114dc7=_0x114dc7||0xc8;return function(_0x20c312){if(_0x20c312){return _0x536ea7['status'](_0x114dc7)[_0x6382('0x1c')](_0x20c312);}};}function respondWithFilteredResult(_0x3c4767,_0x520386){return function(_0x5c9008){if(_0x5c9008){var _0x1b14ba=typeof _0x520386['offset']==='undefined'&&typeof _0x520386['limit']===_0x6382('0x1d');var _0x431dd8=_0x5c9008[_0x6382('0x1e')];var _0x2a5fbe=_0x1b14ba?0x0:_0x520386['offset'];var _0x5eb34b=_0x1b14ba?_0x5c9008[_0x6382('0x1e')]:_0x520386[_0x6382('0x1f')]+_0x520386[_0x6382('0x20')];var _0x4f14eb;if(_0x5eb34b>=_0x431dd8){_0x5eb34b=_0x431dd8;_0x4f14eb=0xc8;}else{_0x4f14eb=0xce;}_0x3c4767[_0x6382('0x1a')](_0x4f14eb);return _0x3c4767[_0x6382('0x21')](_0x6382('0x22'),_0x2a5fbe+'-'+_0x5eb34b+'/'+_0x431dd8)[_0x6382('0x1c')](_0x5c9008);}return null;};}function patchUpdates(_0x4fcf57){return function(_0x2568af){try{jsonpatch[_0x6382('0x23')](_0x2568af,_0x4fcf57,!![]);}catch(_0x52f050){return BPromise['reject'](_0x52f050);}return _0x2568af[_0x6382('0x24')]();};}function saveUpdates(_0x7f1286,_0x4d35c4){return function(_0x3e979f){if(_0x3e979f){return _0x3e979f[_0x6382('0x25')](_0x7f1286)['then'](function(_0x493200){return _0x493200;});}return null;};}function removeEntity(_0x2ab3ed,_0x34d8ba){return function(_0x272e48){if(_0x272e48){return _0x272e48[_0x6382('0x26')]()[_0x6382('0x27')](function(){var _0x7215c6=_0x272e48[_0x6382('0x28')]({'plain':!![]});var _0x5c443c='SmsQueues';return db['UserProfileResource'][_0x6382('0x26')]({'where':{'type':_0x5c443c,'resourceId':_0x7215c6['id']}})[_0x6382('0x27')](function(){return _0x272e48;});})[_0x6382('0x27')](function(){_0x2ab3ed[_0x6382('0x1a')](0xcc)[_0x6382('0x1b')]();});}};}function handleEntityNotFound(_0xae000,_0x272ce6){return function(_0x22deb7){if(!_0x22deb7){_0xae000[_0x6382('0x19')](0x194);}return _0x22deb7;};}function handleError(_0x25b492,_0x11ccbd){_0x11ccbd=_0x11ccbd||0x1f4;return function(_0x3db307){logger[_0x6382('0x29')](_0x3db307[_0x6382('0x2a')]);if(_0x3db307[_0x6382('0x2b')]){delete _0x3db307['name'];}_0x25b492[_0x6382('0x1a')](_0x11ccbd)['send'](_0x3db307);};}exports[_0x6382('0x2c')]=function(_0x3708cd,_0x428bc8){var _0x428e52={},_0x67ac59={},_0x107eaf={'count':0x0,'rows':[]};var _0x5d1e05=_[_0x6382('0x2d')](db[_0x6382('0x2e')]['rawAttributes'],function(_0x26cbde){return{'name':_0x26cbde['fieldName'],'type':_0x26cbde['type'][_0x6382('0x2f')]};});_0x67ac59[_0x6382('0x30')]=_['map'](_0x5d1e05,_0x6382('0x2b'));_0x67ac59['query']=_['keys'](_0x3708cd[_0x6382('0x31')]);_0x67ac59[_0x6382('0x32')]=_[_0x6382('0x33')](_0x67ac59[_0x6382('0x30')],_0x67ac59[_0x6382('0x31')]);_0x428e52[_0x6382('0x34')]=_['intersection'](_0x67ac59[_0x6382('0x30')],qs[_0x6382('0x35')](_0x3708cd[_0x6382('0x31')]['fields']));_0x428e52[_0x6382('0x34')]=_0x428e52[_0x6382('0x34')][_0x6382('0x36')]?_0x428e52[_0x6382('0x34')]:_0x67ac59[_0x6382('0x30')];if(!_0x3708cd[_0x6382('0x31')][_0x6382('0x37')](_0x6382('0x38'))){_0x428e52[_0x6382('0x20')]=qs['limit'](_0x3708cd[_0x6382('0x31')]['limit']);_0x428e52['offset']=qs[_0x6382('0x1f')](_0x3708cd[_0x6382('0x31')]['offset']);}_0x428e52[_0x6382('0x39')]=qs[_0x6382('0x3a')](_0x3708cd[_0x6382('0x31')][_0x6382('0x3a')]);_0x428e52[_0x6382('0x3b')]=qs[_0x6382('0x32')](_[_0x6382('0x3c')](_0x3708cd['query'],_0x67ac59[_0x6382('0x32')]),_0x5d1e05);if(_0x3708cd['query'][_0x6382('0x3d')]){_0x428e52['where']=_['merge'](_0x428e52[_0x6382('0x3b')],{'$or':_['map'](_0x5d1e05,function(_0x13460b){if(_0x13460b[_0x6382('0x3e')]!==_0x6382('0x3f')){var _0x468310={};_0x468310[_0x13460b[_0x6382('0x2b')]]={'$like':'%'+_0x3708cd['query'][_0x6382('0x3d')]+'%'};return _0x468310;}})});}_0x428e52=_[_0x6382('0x40')]({},_0x428e52,_0x3708cd[_0x6382('0x41')]);var _0x20144f={'where':_0x428e52[_0x6382('0x3b')]};return db[_0x6382('0x2e')]['count'](_0x20144f)[_0x6382('0x27')](function(_0x568a53){_0x107eaf[_0x6382('0x1e')]=_0x568a53;if(_0x3708cd[_0x6382('0x31')]['includeAll']){_0x428e52[_0x6382('0x42')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x428e52);})[_0x6382('0x27')](function(_0x203df7){_0x107eaf['rows']=_0x203df7;return _0x107eaf;})[_0x6382('0x27')](respondWithFilteredResult(_0x428bc8,_0x428e52))[_0x6382('0x43')](handleError(_0x428bc8,null));};exports[_0x6382('0x44')]=function(_0x441bc9,_0x3eb775){var _0x1d9d22={'raw':!![],'where':{'id':_0x441bc9[_0x6382('0x45')]['id']}},_0x4f1a78={};_0x4f1a78[_0x6382('0x30')]=_['keys'](db[_0x6382('0x2e')][_0x6382('0x46')]);_0x4f1a78['query']=_[_0x6382('0x47')](_0x441bc9[_0x6382('0x31')]);_0x4f1a78['filters']=_[_0x6382('0x33')](_0x4f1a78['model'],_0x4f1a78[_0x6382('0x31')]);_0x1d9d22[_0x6382('0x34')]=_['intersection'](_0x4f1a78[_0x6382('0x30')],qs[_0x6382('0x35')](_0x441bc9[_0x6382('0x31')][_0x6382('0x35')]));_0x1d9d22[_0x6382('0x34')]=_0x1d9d22[_0x6382('0x34')]['length']?_0x1d9d22['attributes']:_0x4f1a78[_0x6382('0x30')];if(_0x441bc9[_0x6382('0x31')][_0x6382('0x48')]){_0x1d9d22['include']=[{'all':!![]}];}_0x1d9d22=_['merge']({},_0x1d9d22,_0x441bc9['options']);return db[_0x6382('0x2e')]['find'](_0x1d9d22)[_0x6382('0x27')](handleEntityNotFound(_0x3eb775,null))[_0x6382('0x27')](respondWithResult(_0x3eb775,null))[_0x6382('0x43')](handleError(_0x3eb775,null));};exports[_0x6382('0x49')]=function(_0xf72d76,_0x3a3cb6){return db[_0x6382('0x2e')][_0x6382('0x49')](_0xf72d76[_0x6382('0x4a')],{})[_0x6382('0x27')](function(_0xdee60a){var _0x14865b=_0xf72d76['user']['get']({'plain':!![]});if(!_0x14865b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14865b[_0x6382('0x4b')]==='user'){var _0x1cefac=_0xdee60a['get']({'plain':!![]});var _0x138070=_0x6382('0x4c');return db[_0x6382('0x4d')][_0x6382('0x4e')]({'where':{'name':_0x138070,'userProfileId':_0x14865b[_0x6382('0x4f')]},'raw':!![]})[_0x6382('0x27')](function(_0x2b9e46){if(_0x2b9e46&&_0x2b9e46[_0x6382('0x50')]===0x0){return db[_0x6382('0x51')][_0x6382('0x49')]({'name':_0x1cefac['name'],'resourceId':_0x1cefac['id'],'type':_0x2b9e46['name'],'sectionId':_0x2b9e46['id']},{})[_0x6382('0x27')](function(){return _0xdee60a;});}else{return _0xdee60a;}})[_0x6382('0x43')](function(_0x50a983){logger[_0x6382('0x29')](_0x6382('0x52'),_0x50a983);throw _0x50a983;});}return _0xdee60a;})['then'](respondWithResult(_0x3a3cb6,0xc9))[_0x6382('0x43')](handleError(_0x3a3cb6,null));};exports[_0x6382('0x25')]=function(_0x12a291,_0x4e42c5){if(_0x12a291[_0x6382('0x4a')]['id']){delete _0x12a291[_0x6382('0x4a')]['id'];}return db[_0x6382('0x2e')]['find']({'where':{'id':_0x12a291[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x4e42c5,null))[_0x6382('0x27')](saveUpdates(_0x12a291['body'],null))[_0x6382('0x27')](respondWithResult(_0x4e42c5,null))['catch'](handleError(_0x4e42c5,null));};exports[_0x6382('0x26')]=function(_0x20a727,_0x9aadb9){return db['SmsQueue'][_0x6382('0x4e')]({'where':{'id':_0x20a727[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x9aadb9,null))[_0x6382('0x27')](removeEntity(_0x9aadb9,null))[_0x6382('0x43')](handleError(_0x9aadb9,null));};exports['describe']=function(_0x4541d7,_0x2e6372){return db[_0x6382('0x2e')][_0x6382('0x53')]()[_0x6382('0x27')](respondWithResult(_0x2e6372,null))[_0x6382('0x43')](handleError(_0x2e6372,null));};exports[_0x6382('0x54')]=function(_0x2de62a,_0x1a4931,_0x29a782){var _0x162d7c={'raw':!![],'where':{}},_0x34b22c={},_0x180407;return db[_0x6382('0x2e')]['findOne']({'where':{'id':_0x2de62a[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x1a4931,null))[_0x6382('0x27')](function(_0x2d2db1){if(_0x2d2db1){_0x180407=_0x2d2db1[_0x6382('0x28')]({'plain':!![]});_0x34b22c[_0x6382('0x30')]=_[_0x6382('0x47')](db[_0x6382('0x55')][_0x6382('0x46')]);_0x34b22c['query']=_[_0x6382('0x47')](_0x2de62a['query']);_0x34b22c[_0x6382('0x32')]=_['intersection'](_0x34b22c['model'],_0x34b22c[_0x6382('0x31')]);_0x162d7c[_0x6382('0x34')]=_[_0x6382('0x33')](_0x34b22c[_0x6382('0x30')],qs[_0x6382('0x35')](_0x2de62a[_0x6382('0x31')][_0x6382('0x35')]));_0x162d7c[_0x6382('0x34')]=_0x162d7c[_0x6382('0x34')]['length']?_0x162d7c['attributes']:_0x34b22c[_0x6382('0x30')];if(!_0x2de62a[_0x6382('0x31')][_0x6382('0x37')](_0x6382('0x38'))){_0x162d7c['limit']=qs[_0x6382('0x20')](_0x2de62a[_0x6382('0x31')]['limit']);_0x162d7c[_0x6382('0x1f')]=qs[_0x6382('0x1f')](_0x2de62a[_0x6382('0x31')][_0x6382('0x1f')]);}_0x162d7c[_0x6382('0x39')]=qs['sort'](_0x2de62a[_0x6382('0x31')][_0x6382('0x3a')]);_0x162d7c[_0x6382('0x3b')]=qs[_0x6382('0x32')](_['pick'](_0x2de62a[_0x6382('0x31')],_0x34b22c[_0x6382('0x32')]));_0x162d7c[_0x6382('0x3b')][_0x6382('0x56')]=_0x2d2db1['id'];if(_0x2de62a[_0x6382('0x31')][_0x6382('0x3d')]){_0x162d7c[_0x6382('0x3b')]=_[_0x6382('0x40')](_0x162d7c['where'],{'$or':_[_0x6382('0x2d')](_0x162d7c[_0x6382('0x34')],function(_0x3f905a){var _0xd482aa={};_0xd482aa[_0x3f905a]={'$like':'%'+_0x2de62a[_0x6382('0x31')][_0x6382('0x3d')]+'%'};return _0xd482aa;})});}_0x162d7c=_[_0x6382('0x40')]({},_0x162d7c,_0x2de62a[_0x6382('0x41')]);return db[_0x6382('0x55')][_0x6382('0x57')](_0x162d7c);}})['then'](function(_0xfd62c1){if(_0xfd62c1){return db['User'][_0x6382('0x58')]({'where':{'id':_[_0x6382('0x2d')](_0xfd62c1,_0x6382('0x59')),'role':'agent'},'attributes':['id',_0x6382('0x2b'),_0x6382('0x5a'),_0x6382('0x5b'),'createdAt']});}})[_0x6382('0x27')](function(_0x71831c){if(_0x71831c){return{'count':_0x71831c[_0x6382('0x1e')],'rows':_['map'](_0x71831c[_0x6382('0x5c')],function(_0x2ddd5d){return{'membername':_0x2ddd5d[_0x6382('0x2b')],'UserId':_0x2ddd5d['id'],'queue_name':_0x180407[_0x6382('0x2b')],'SmsQueueId':_0x180407['id'],'interface':util[_0x6382('0x5d')](_0x6382('0x5e'),_0x6382('0x5f'),_0x2ddd5d['name']),'penalty':0x0,'paused':_0x2ddd5d[_0x6382('0x5a')],'createdAt':_0x2ddd5d[_0x6382('0x60')],'updatedAt':_0x2ddd5d[_0x6382('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6382('0x27')](respondWithFilteredResult(_0x1a4931,_0x162d7c))['catch'](handleError(_0x1a4931,null));};exports[_0x6382('0x61')]=function(_0x9e8eb0,_0x4159a4,_0x29b061){var _0x39a88e={};var _0x4d71f9={};var _0x2e3126;var _0x582421;return db[_0x6382('0x2e')][_0x6382('0x62')]({'where':{'id':_0x9e8eb0[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x4159a4,null))['then'](function(_0x4609d9){if(_0x4609d9){_0x2e3126=_0x4609d9;_0x4d71f9[_0x6382('0x30')]=_['keys'](db[_0x6382('0x63')]['rawAttributes']);_0x4d71f9[_0x6382('0x31')]=_[_0x6382('0x47')](_0x9e8eb0['query']);_0x4d71f9['filters']=_[_0x6382('0x33')](_0x4d71f9[_0x6382('0x30')],_0x4d71f9[_0x6382('0x31')]);_0x39a88e[_0x6382('0x34')]=_['intersection'](_0x4d71f9[_0x6382('0x30')],qs[_0x6382('0x35')](_0x9e8eb0[_0x6382('0x31')][_0x6382('0x35')]));_0x39a88e[_0x6382('0x34')]=_0x39a88e[_0x6382('0x34')]['length']?_0x39a88e[_0x6382('0x34')]:_0x4d71f9[_0x6382('0x30')];_0x39a88e[_0x6382('0x39')]=qs[_0x6382('0x3a')](_0x9e8eb0[_0x6382('0x31')][_0x6382('0x3a')]);_0x39a88e[_0x6382('0x3b')]=qs[_0x6382('0x32')](_[_0x6382('0x3c')](_0x9e8eb0[_0x6382('0x31')],_0x4d71f9[_0x6382('0x32')]));if(_0x9e8eb0[_0x6382('0x31')][_0x6382('0x3d')]){_0x39a88e[_0x6382('0x3b')]=_[_0x6382('0x40')](_0x39a88e['where'],{'$or':_['map'](_0x39a88e['attributes'],function(_0x36c422){var _0x503936={};_0x503936[_0x36c422]={'$like':'%'+_0x9e8eb0[_0x6382('0x31')]['filter']+'%'};return _0x503936;})});}_0x39a88e=_[_0x6382('0x40')]({},_0x39a88e,_0x9e8eb0['options']);return _0x2e3126['getTeams'](_0x39a88e);}})[_0x6382('0x27')](function(_0x3733b1){if(_0x3733b1){_0x582421=_0x3733b1[_0x6382('0x36')];if(!_0x9e8eb0['query'][_0x6382('0x37')](_0x6382('0x38'))){_0x39a88e[_0x6382('0x20')]=qs[_0x6382('0x20')](_0x9e8eb0['query']['limit']);_0x39a88e['offset']=qs[_0x6382('0x1f')](_0x9e8eb0['query'][_0x6382('0x1f')]);}return _0x2e3126[_0x6382('0x61')](_0x39a88e);}})[_0x6382('0x27')](function(_0x162bae){if(_0x162bae){return _0x162bae?{'count':_0x582421,'rows':_0x162bae}:null;}})['then'](respondWithResult(_0x4159a4,null))[_0x6382('0x43')](handleError(_0x4159a4,null));};exports[_0x6382('0x64')]=function(_0x152d3d,_0x5b9e08,_0x4cc822){var _0x4fd9f1=_0x152d3d[_0x6382('0x4a')][_0x6382('0x65')];return db['Team'][_0x6382('0x57')]({'where':{'id':_0x4fd9f1},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x6382('0x2b'),'online',_0x6382('0x66'),_0x6382('0x67')],'raw':!![]}]})[_0x6382('0x27')](function(_0x4ce2c9){if(_0x4ce2c9){var _0x304cf6=_['flatMap'](_0x4ce2c9,function(_0x5b4e9b){var _0x4da722=_0x5b4e9b[_0x6382('0x28')]({'plain':!![]});return _0x4da722[_0x6382('0x68')];});return db['SmsQueue'][_0x6382('0x4e')]({'where':{'id':_0x152d3d[_0x6382('0x45')]['id']}})[_0x6382('0x27')](function(_0x299fa1){return db[_0x6382('0x69')]['transaction'](function(_0x3f995f){return _0x299fa1['addTeams'](_0x4fd9f1,{'transaction':_0x3f995f})['then'](function(){return BPromise['each'](_0x304cf6,function(_0x1dfa6b){return db[_0x6382('0x55')][_0x6382('0x6a')]({'where':{'UserId':_0x1dfa6b['id'],'SmsQueueId':_0x152d3d['params']['id']},'transaction':_0x3f995f});});})['then'](function(){_0x304cf6[_0x6382('0x6b')](function(_0x47ed72){socket[_0x6382('0x6c')](_0x6382('0x6d'),{'UserId':_0x47ed72['id'],'SmsQueueId':_0x299fa1['id']});});});});});}})[_0x6382('0x27')](respondWithStatusCode(_0x5b9e08,null))[_0x6382('0x43')](handleError(_0x5b9e08,null));};exports[_0x6382('0x6e')]=function(_0x353a4e,_0x28a0cb,_0x5613e2){return db[_0x6382('0x63')][_0x6382('0x57')]({'where':{'id':_0x353a4e[_0x6382('0x31')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6382('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x28a0cb,null))[_0x6382('0x27')](function(_0x454f1a){var _0x567d45=_[_0x6382('0x2d')](_0x454f1a,'id');var _0x3f8a13=[];var _0x9efeb1=[];var _0x8c1be2=squel[_0x6382('0x6f')]();_0x8c1be2[_0x6382('0x70')]('tq.TeamId')[_0x6382('0x71')](_0x6382('0x72'),'tq')['join']('user_has_teams','ut',_0x6382('0x73'))[_0x6382('0x3b')](_0x6382('0x74'),_0x353a4e[_0x6382('0x45')]['id']);for(var _0x1fac39=0x0;_0x1fac39<_0x454f1a[_0x6382('0x36')];_0x1fac39+=0x1){let _0x3702f3=_0x454f1a[_0x1fac39];for(var _0x225fa1=0x0;_0x225fa1<_0x3702f3[_0x6382('0x68')][_0x6382('0x36')];_0x225fa1+=0x1){let _0x314514=_0x3702f3[_0x6382('0x68')][_0x225fa1];var _0x12d30a=_0x8c1be2[_0x6382('0x75')]();_0x12d30a[_0x6382('0x3b')]('ut.UserId\x20=\x20?',_0x314514['id']);_0x9efeb1['push'](db['sequelize'][_0x6382('0x31')](_0x12d30a[_0x6382('0x76')](),{'type':db[_0x6382('0x69')][_0x6382('0x77')][_0x6382('0x78')]})[_0x6382('0x27')](function(_0x1391d7){if(_0x1391d7[_0x6382('0x36')]===0x1){return _0x314514['id'];}else{var _0x1c3972=_[_0x6382('0x79')](_['map'](_0x1391d7,_0x6382('0x7a')),function(_0x3215ea){return _[_0x6382('0x7b')](_0x567d45,_0x3215ea);});if(_0x1c3972){return _0x314514['id'];}}}));}}return BPromise[_0x6382('0x7c')](_0x9efeb1)['then'](function(_0x5b95da){_0x3f8a13=_(_0x3f8a13)[_0x6382('0x7d')](_0x5b95da)['compact']()[_0x6382('0x7e')]();return db['SmsQueue'][_0x6382('0x4e')]({'where':{'id':_0x353a4e[_0x6382('0x45')]['id']}})[_0x6382('0x27')](function(_0x54a8c4){return db[_0x6382('0x69')][_0x6382('0x7f')](function(_0x5a3ffa){return _0x54a8c4[_0x6382('0x6e')](_0x353a4e[_0x6382('0x31')][_0x6382('0x65')],{'transaction':_0x5a3ffa})[_0x6382('0x27')](function(){if(!_[_0x6382('0x80')](_0x3f8a13)){return _0x54a8c4[_0x6382('0x81')](_0x3f8a13,{'transaction':_0x5a3ffa});}})[_0x6382('0x27')](function(){_0x3f8a13[_0x6382('0x6b')](function(_0x4daa30){socket[_0x6382('0x6c')](_0x6382('0x82'),{'UserId':_0x4daa30,'SmsQueueId':_0x54a8c4['id']});});});});});});})['then'](respondWithStatusCode(_0x28a0cb,null))['catch'](handleError(_0x28a0cb,null));};exports[_0x6382('0x83')]=function(_0x27fdd4,_0x52e238,_0x1d039f){return db[_0x6382('0x2e')][_0x6382('0x4e')]({'where':{'id':_0x27fdd4[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x52e238,null))[_0x6382('0x27')](function(_0x5e2ce3){if(_0x5e2ce3){return _0x5e2ce3[_0x6382('0x83')](_0x27fdd4[_0x6382('0x4a')][_0x6382('0x65')],_[_0x6382('0x84')](_0x27fdd4['body'],[_0x6382('0x65'),'id'])||{})[_0x6382('0x85')](function(_0x2585d9){for(var _0x469e24=0x0;_0x469e24<_0x27fdd4[_0x6382('0x4a')][_0x6382('0x65')][_0x6382('0x36')];_0x469e24+=0x1){socket[_0x6382('0x6c')](_0x6382('0x6d'),{'UserId':Number(_0x27fdd4[_0x6382('0x4a')][_0x6382('0x65')][_0x469e24]),'SmsQueueId':Number(_0x27fdd4[_0x6382('0x45')]['id'])});}return _0x2585d9;});}})['then'](respondWithResult(_0x52e238,null))[_0x6382('0x43')](handleError(_0x52e238,null));};exports[_0x6382('0x81')]=function(_0x33e76d,_0x29c5dd,_0x156ea1){return db[_0x6382('0x2e')][_0x6382('0x4e')]({'where':{'id':_0x33e76d[_0x6382('0x45')]['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x29c5dd,null))['then'](function(_0x33d763){if(_0x33d763){return _0x33d763[_0x6382('0x81')](_0x33e76d[_0x6382('0x31')][_0x6382('0x65')])[_0x6382('0x27')](function(){if(_[_0x6382('0x86')](_0x33e76d[_0x6382('0x31')]['ids'])){for(var _0x40dcc2=0x0;_0x40dcc2<_0x33e76d[_0x6382('0x31')][_0x6382('0x65')][_0x6382('0x36')];_0x40dcc2+=0x1){socket[_0x6382('0x6c')](_0x6382('0x82'),{'UserId':Number(_0x33e76d[_0x6382('0x31')][_0x6382('0x65')][_0x40dcc2]),'SmsQueueId':Number(_0x33e76d[_0x6382('0x45')]['id'])});}}else{socket[_0x6382('0x6c')](_0x6382('0x82'),{'UserId':Number(_0x33e76d[_0x6382('0x31')][_0x6382('0x65')]),'SmsQueueId':Number(_0x33e76d['params']['id'])});}});}})[_0x6382('0x27')](respondWithStatusCode(_0x29c5dd,null))[_0x6382('0x43')](handleError(_0x29c5dd,null));};exports[_0x6382('0x87')]=function(_0x2116a8,_0x5ec30e,_0x2598de){var _0x2c180f={};var _0x17fbe2={};var _0x32d466;var _0xe5aa92;return db[_0x6382('0x2e')]['findOne']({'where':{'id':_0x2116a8['params']['id']}})[_0x6382('0x27')](handleEntityNotFound(_0x5ec30e,null))[_0x6382('0x27')](function(_0x17fcf6){if(_0x17fcf6){_0x32d466=_0x17fcf6;_0x17fbe2[_0x6382('0x30')]=_[_0x6382('0x47')](db[_0x6382('0x88')][_0x6382('0x46')]);_0x17fbe2[_0x6382('0x31')]=_[_0x6382('0x47')](_0x2116a8[_0x6382('0x31')]);_0x17fbe2['filters']=_[_0x6382('0x33')](_0x17fbe2[_0x6382('0x30')],_0x17fbe2['query']);_0x2c180f['attributes']=_['intersection'](_0x17fbe2['model'],qs[_0x6382('0x35')](_0x2116a8[_0x6382('0x31')][_0x6382('0x35')]));_0x2c180f[_0x6382('0x34')]=_0x2c180f[_0x6382('0x34')][_0x6382('0x36')]?_0x2c180f[_0x6382('0x34')]:_0x17fbe2[_0x6382('0x30')];_0x2c180f[_0x6382('0x39')]=qs[_0x6382('0x3a')](_0x2116a8[_0x6382('0x31')][_0x6382('0x3a')]);_0x2c180f[_0x6382('0x3b')]=qs[_0x6382('0x32')](_[_0x6382('0x3c')](_0x2116a8[_0x6382('0x31')],_0x17fbe2[_0x6382('0x32')]));if(_0x2116a8[_0x6382('0x31')][_0x6382('0x3d')]){_0x2c180f[_0x6382('0x3b')]=_['merge'](_0x2c180f[_0x6382('0x3b')],{'$or':_[_0x6382('0x2d')](_0x2c180f['attributes'],function(_0xed0e3c){var _0x308160={};_0x308160[_0xed0e3c]={'$like':'%'+_0x2116a8[_0x6382('0x31')][_0x6382('0x3d')]+'%'};return _0x308160;})});}_0x2c180f=_['merge']({},_0x2c180f,_0x2116a8[_0x6382('0x41')]);return _0x32d466[_0x6382('0x87')](_0x2c180f);}})[_0x6382('0x27')](function(_0x4f0b4f){if(_0x4f0b4f){_0xe5aa92=_0x4f0b4f['length'];if(!_0x2116a8[_0x6382('0x31')][_0x6382('0x37')](_0x6382('0x38'))){_0x2c180f[_0x6382('0x20')]=qs[_0x6382('0x20')](_0x2116a8[_0x6382('0x31')][_0x6382('0x20')]);_0x2c180f[_0x6382('0x1f')]=qs[_0x6382('0x1f')](_0x2116a8[_0x6382('0x31')]['offset']);}return _0x32d466[_0x6382('0x87')](_0x2c180f);}})[_0x6382('0x27')](function(_0x4be263){if(_0x4be263){return _0x4be263?{'count':_0xe5aa92,'rows':_0x4be263}:null;}})['then'](respondWithResult(_0x5ec30e,null))['catch'](handleError(_0x5ec30e,null));}; \ No newline at end of file +var _0x2dd3=['userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','end','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserSmsQueue','hasOwnProperty','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeAgents','forEach','addAgents','spread','isArray'];(function(_0x5a1cf3,_0x161eca){var _0x24d3cc=function(_0x41a79e){while(--_0x41a79e){_0x5a1cf3['push'](_0x5a1cf3['shift']());}};_0x24d3cc(++_0x161eca);}(_0x2dd3,0x99));var _0x32dd=function(_0x4b4c4a,_0x121ed3){_0x4b4c4a=_0x4b4c4a-0x0;var _0x5d17be=_0x2dd3[_0x4b4c4a];return _0x5d17be;};'use strict';var emlformat=require(_0x32dd('0x0'));var rimraf=require(_0x32dd('0x1'));var zipdir=require(_0x32dd('0x2'));var jsonpatch=require(_0x32dd('0x3'));var rp=require(_0x32dd('0x4'));var moment=require(_0x32dd('0x5'));var BPromise=require(_0x32dd('0x6'));var Mustache=require(_0x32dd('0x7'));var util=require(_0x32dd('0x8'));var path=require(_0x32dd('0x9'));var sox=require(_0x32dd('0xa'));var csv=require(_0x32dd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32dd('0xc'));var _=require(_0x32dd('0xd'));var squel=require(_0x32dd('0xe'));var crypto=require(_0x32dd('0xf'));var jsforce=require(_0x32dd('0x10'));var deskjs=require(_0x32dd('0x11'));var toCsv=require(_0x32dd('0xb'));var querystring=require(_0x32dd('0x12'));var Papa=require(_0x32dd('0x13'));var Redis=require(_0x32dd('0x14'));var authService=require(_0x32dd('0x15'));var qs=require(_0x32dd('0x16'));var as=require(_0x32dd('0x17'));var hardwareService=require(_0x32dd('0x18'));var logger=require(_0x32dd('0x19'))(_0x32dd('0x1a'));var utils=require(_0x32dd('0x1b'));var config=require(_0x32dd('0x1c'));var licenseUtil=require(_0x32dd('0x1d'));var db=require(_0x32dd('0x1e'))['db'];config[_0x32dd('0x1f')]=_['defaults'](config['redis'],{'host':_0x32dd('0x20'),'port':0x18eb});var socket=require(_0x32dd('0x21'))(new Redis(config[_0x32dd('0x1f')]));require(_0x32dd('0x22'))[_0x32dd('0x23')](socket);function respondWithStatusCode(_0x26882e,_0x27cca1){_0x27cca1=_0x27cca1||0xcc;return function(_0x5c29a5){if(_0x5c29a5){return _0x26882e[_0x32dd('0x24')](_0x27cca1);}return _0x26882e[_0x32dd('0x25')](_0x27cca1)['end']();};}function respondWithResult(_0x372a1a,_0x2ec566){_0x2ec566=_0x2ec566||0xc8;return function(_0x2ba757){if(_0x2ba757){return _0x372a1a['status'](_0x2ec566)[_0x32dd('0x26')](_0x2ba757);}};}function respondWithFilteredResult(_0x503a36,_0x4769af){return function(_0x2173e3){if(_0x2173e3){var _0xe2ee38=typeof _0x4769af[_0x32dd('0x27')]==='undefined'&&typeof _0x4769af[_0x32dd('0x28')]===_0x32dd('0x29');var _0x37a350=_0x2173e3['count'];var _0x2f35dd=_0xe2ee38?0x0:_0x4769af['offset'];var _0x2bf251=_0xe2ee38?_0x2173e3['count']:_0x4769af[_0x32dd('0x27')]+_0x4769af['limit'];var _0x55d9a8;if(_0x2bf251>=_0x37a350){_0x2bf251=_0x37a350;_0x55d9a8=0xc8;}else{_0x55d9a8=0xce;}_0x503a36['status'](_0x55d9a8);return _0x503a36[_0x32dd('0x2a')](_0x32dd('0x2b'),_0x2f35dd+'-'+_0x2bf251+'/'+_0x37a350)[_0x32dd('0x26')](_0x2173e3);}return null;};}function patchUpdates(_0x59dd89){return function(_0x620f8b){try{jsonpatch[_0x32dd('0x2c')](_0x620f8b,_0x59dd89,!![]);}catch(_0x35344a){return BPromise[_0x32dd('0x2d')](_0x35344a);}return _0x620f8b[_0x32dd('0x2e')]();};}function saveUpdates(_0x3de522,_0x3b99b2){return function(_0x28aa62){if(_0x28aa62){return _0x28aa62[_0x32dd('0x2f')](_0x3de522)[_0x32dd('0x30')](function(_0x3897d3){return _0x3897d3;});}return null;};}function removeEntity(_0xcb8dcf,_0x3f5cdf){return function(_0x53ec30){if(_0x53ec30){return _0x53ec30[_0x32dd('0x31')]()[_0x32dd('0x30')](function(){var _0x53c32d=_0x53ec30[_0x32dd('0x32')]({'plain':!![]});var _0x4d3913=_0x32dd('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d3913,'resourceId':_0x53c32d['id']}})['then'](function(){return _0x53ec30;});})['then'](function(){_0xcb8dcf[_0x32dd('0x25')](0xcc)[_0x32dd('0x34')]();});}};}function handleEntityNotFound(_0x12541f,_0x6e423a){return function(_0x4b96a2){if(!_0x4b96a2){_0x12541f[_0x32dd('0x24')](0x194);}return _0x4b96a2;};}function handleError(_0x3ba36a,_0x15882f){_0x15882f=_0x15882f||0x1f4;return function(_0x465c2f){logger['error'](_0x465c2f['stack']);if(_0x465c2f[_0x32dd('0x35')]){delete _0x465c2f[_0x32dd('0x35')];}_0x3ba36a[_0x32dd('0x25')](_0x15882f)[_0x32dd('0x36')](_0x465c2f);};}exports['index']=function(_0x44825b,_0x4cd342){var _0x4cfff4={},_0x1cdc80={},_0x24f86b={'count':0x0,'rows':[]};var _0x5e8b9d=_[_0x32dd('0x37')](db[_0x32dd('0x38')][_0x32dd('0x39')],function(_0x1e4e30){return{'name':_0x1e4e30[_0x32dd('0x3a')],'type':_0x1e4e30[_0x32dd('0x3b')][_0x32dd('0x3c')]};});_0x1cdc80[_0x32dd('0x3d')]=_[_0x32dd('0x37')](_0x5e8b9d,_0x32dd('0x35'));_0x1cdc80[_0x32dd('0x3e')]=_[_0x32dd('0x3f')](_0x44825b[_0x32dd('0x3e')]);_0x1cdc80['filters']=_[_0x32dd('0x40')](_0x1cdc80[_0x32dd('0x3d')],_0x1cdc80[_0x32dd('0x3e')]);_0x4cfff4[_0x32dd('0x41')]=_[_0x32dd('0x40')](_0x1cdc80[_0x32dd('0x3d')],qs[_0x32dd('0x42')](_0x44825b[_0x32dd('0x3e')][_0x32dd('0x42')]));_0x4cfff4[_0x32dd('0x41')]=_0x4cfff4[_0x32dd('0x41')][_0x32dd('0x43')]?_0x4cfff4[_0x32dd('0x41')]:_0x1cdc80[_0x32dd('0x3d')];if(!_0x44825b[_0x32dd('0x3e')]['hasOwnProperty'](_0x32dd('0x44'))){_0x4cfff4[_0x32dd('0x28')]=qs[_0x32dd('0x28')](_0x44825b['query'][_0x32dd('0x28')]);_0x4cfff4['offset']=qs[_0x32dd('0x27')](_0x44825b['query'][_0x32dd('0x27')]);}_0x4cfff4[_0x32dd('0x45')]=qs[_0x32dd('0x46')](_0x44825b['query'][_0x32dd('0x46')]);_0x4cfff4[_0x32dd('0x47')]=qs[_0x32dd('0x48')](_[_0x32dd('0x49')](_0x44825b[_0x32dd('0x3e')],_0x1cdc80[_0x32dd('0x48')]),_0x5e8b9d);if(_0x44825b['query'][_0x32dd('0x4a')]){_0x4cfff4['where']=_[_0x32dd('0x4b')](_0x4cfff4[_0x32dd('0x47')],{'$or':_[_0x32dd('0x37')](_0x5e8b9d,function(_0x15a6be){if(_0x15a6be['type']!=='VIRTUAL'){var _0x235337={};_0x235337[_0x15a6be['name']]={'$like':'%'+_0x44825b[_0x32dd('0x3e')][_0x32dd('0x4a')]+'%'};return _0x235337;}})});}_0x4cfff4=_[_0x32dd('0x4b')]({},_0x4cfff4,_0x44825b['options']);var _0x6f91d7={'where':_0x4cfff4[_0x32dd('0x47')]};return db['SmsQueue'][_0x32dd('0x4c')](_0x6f91d7)[_0x32dd('0x30')](function(_0x4f9bfe){_0x24f86b['count']=_0x4f9bfe;if(_0x44825b[_0x32dd('0x3e')][_0x32dd('0x4d')]){_0x4cfff4[_0x32dd('0x4e')]=[{'all':!![]}];}return db['SmsQueue'][_0x32dd('0x4f')](_0x4cfff4);})[_0x32dd('0x30')](function(_0x28999e){_0x24f86b['rows']=_0x28999e;return _0x24f86b;})['then'](respondWithFilteredResult(_0x4cd342,_0x4cfff4))[_0x32dd('0x50')](handleError(_0x4cd342,null));};exports[_0x32dd('0x51')]=function(_0x504522,_0x51fab2){var _0x521cd8={'raw':!![],'where':{'id':_0x504522['params']['id']}},_0x5ebc3c={};_0x5ebc3c[_0x32dd('0x3d')]=_['keys'](db['SmsQueue'][_0x32dd('0x39')]);_0x5ebc3c[_0x32dd('0x3e')]=_[_0x32dd('0x3f')](_0x504522['query']);_0x5ebc3c['filters']=_[_0x32dd('0x40')](_0x5ebc3c['model'],_0x5ebc3c[_0x32dd('0x3e')]);_0x521cd8[_0x32dd('0x41')]=_[_0x32dd('0x40')](_0x5ebc3c[_0x32dd('0x3d')],qs['fields'](_0x504522['query']['fields']));_0x521cd8[_0x32dd('0x41')]=_0x521cd8[_0x32dd('0x41')][_0x32dd('0x43')]?_0x521cd8[_0x32dd('0x41')]:_0x5ebc3c[_0x32dd('0x3d')];if(_0x504522[_0x32dd('0x3e')][_0x32dd('0x4d')]){_0x521cd8[_0x32dd('0x4e')]=[{'all':!![]}];}_0x521cd8=_['merge']({},_0x521cd8,_0x504522[_0x32dd('0x52')]);return db['SmsQueue'][_0x32dd('0x53')](_0x521cd8)[_0x32dd('0x30')](handleEntityNotFound(_0x51fab2,null))['then'](respondWithResult(_0x51fab2,null))[_0x32dd('0x50')](handleError(_0x51fab2,null));};exports[_0x32dd('0x54')]=function(_0x20921f,_0x2e127b){return db['SmsQueue'][_0x32dd('0x54')](_0x20921f[_0x32dd('0x55')],{})[_0x32dd('0x30')](function(_0xc65d48){var _0x15556f=_0x20921f['user']['get']({'plain':!![]});if(!_0x15556f)throw new Error(_0x32dd('0x56'));if(_0x15556f[_0x32dd('0x57')]===_0x32dd('0x58')){var _0x3b2a06=_0xc65d48[_0x32dd('0x32')]({'plain':!![]});var _0x47e162='SmsQueues';return db[_0x32dd('0x59')][_0x32dd('0x53')]({'where':{'name':_0x47e162,'userProfileId':_0x15556f[_0x32dd('0x5a')]},'raw':!![]})[_0x32dd('0x30')](function(_0x5abd65){if(_0x5abd65&&_0x5abd65['autoAssociation']===0x0){return db[_0x32dd('0x5b')]['create']({'name':_0x3b2a06[_0x32dd('0x35')],'resourceId':_0x3b2a06['id'],'type':_0x5abd65[_0x32dd('0x35')],'sectionId':_0x5abd65['id']},{})['then'](function(){return _0xc65d48;});}else{return _0xc65d48;}})['catch'](function(_0x5dfe34){logger[_0x32dd('0x5c')](_0x32dd('0x5d'),_0x5dfe34);throw _0x5dfe34;});}return _0xc65d48;})['then'](respondWithResult(_0x2e127b,0xc9))['catch'](handleError(_0x2e127b,null));};exports['update']=function(_0x11a0bd,_0x32da11){if(_0x11a0bd['body']['id']){delete _0x11a0bd[_0x32dd('0x55')]['id'];}return db['SmsQueue'][_0x32dd('0x53')]({'where':{'id':_0x11a0bd['params']['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x32da11,null))[_0x32dd('0x30')](saveUpdates(_0x11a0bd[_0x32dd('0x55')],null))[_0x32dd('0x30')](respondWithResult(_0x32da11,null))['catch'](handleError(_0x32da11,null));};exports['destroy']=function(_0x53206b,_0x1ed5b0){return db[_0x32dd('0x38')][_0x32dd('0x53')]({'where':{'id':_0x53206b[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x1ed5b0,null))[_0x32dd('0x30')](removeEntity(_0x1ed5b0,null))[_0x32dd('0x50')](handleError(_0x1ed5b0,null));};exports['describe']=function(_0x5a17e6,_0x55b157){return db[_0x32dd('0x38')][_0x32dd('0x5f')]()[_0x32dd('0x30')](respondWithResult(_0x55b157,null))[_0x32dd('0x50')](handleError(_0x55b157,null));};exports['getMembers']=function(_0x893815,_0x43f5ca,_0x1925c8){var _0x21c9a0={'raw':!![],'where':{}},_0x30f2e1={},_0x26a6d2;return db[_0x32dd('0x38')]['findOne']({'where':{'id':_0x893815['params']['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x43f5ca,null))[_0x32dd('0x30')](function(_0x22ca7a){if(_0x22ca7a){_0x26a6d2=_0x22ca7a[_0x32dd('0x32')]({'plain':!![]});_0x30f2e1[_0x32dd('0x3d')]=_[_0x32dd('0x3f')](db[_0x32dd('0x60')]['rawAttributes']);_0x30f2e1[_0x32dd('0x3e')]=_[_0x32dd('0x3f')](_0x893815[_0x32dd('0x3e')]);_0x30f2e1[_0x32dd('0x48')]=_[_0x32dd('0x40')](_0x30f2e1['model'],_0x30f2e1[_0x32dd('0x3e')]);_0x21c9a0[_0x32dd('0x41')]=_[_0x32dd('0x40')](_0x30f2e1[_0x32dd('0x3d')],qs[_0x32dd('0x42')](_0x893815[_0x32dd('0x3e')][_0x32dd('0x42')]));_0x21c9a0[_0x32dd('0x41')]=_0x21c9a0[_0x32dd('0x41')][_0x32dd('0x43')]?_0x21c9a0[_0x32dd('0x41')]:_0x30f2e1[_0x32dd('0x3d')];if(!_0x893815['query'][_0x32dd('0x61')](_0x32dd('0x44'))){_0x21c9a0[_0x32dd('0x28')]=qs[_0x32dd('0x28')](_0x893815[_0x32dd('0x3e')][_0x32dd('0x28')]);_0x21c9a0[_0x32dd('0x27')]=qs[_0x32dd('0x27')](_0x893815['query'][_0x32dd('0x27')]);}_0x21c9a0[_0x32dd('0x45')]=qs[_0x32dd('0x46')](_0x893815['query'][_0x32dd('0x46')]);_0x21c9a0['where']=qs[_0x32dd('0x48')](_['pick'](_0x893815[_0x32dd('0x3e')],_0x30f2e1['filters']));_0x21c9a0[_0x32dd('0x47')][_0x32dd('0x62')]=_0x22ca7a['id'];if(_0x893815[_0x32dd('0x3e')][_0x32dd('0x4a')]){_0x21c9a0[_0x32dd('0x47')]=_[_0x32dd('0x4b')](_0x21c9a0['where'],{'$or':_[_0x32dd('0x37')](_0x21c9a0[_0x32dd('0x41')],function(_0x4b1479){var _0x58d44a={};_0x58d44a[_0x4b1479]={'$like':'%'+_0x893815[_0x32dd('0x3e')][_0x32dd('0x4a')]+'%'};return _0x58d44a;})});}_0x21c9a0=_[_0x32dd('0x4b')]({},_0x21c9a0,_0x893815[_0x32dd('0x52')]);return db[_0x32dd('0x60')][_0x32dd('0x4f')](_0x21c9a0);}})[_0x32dd('0x30')](function(_0x7bb460){if(_0x7bb460){return db[_0x32dd('0x63')]['findAndCountAll']({'where':{'id':_['map'](_0x7bb460,_0x32dd('0x64')),'role':_0x32dd('0x65')},'attributes':['id',_0x32dd('0x35'),_0x32dd('0x66'),_0x32dd('0x67'),_0x32dd('0x68')]});}})[_0x32dd('0x30')](function(_0x44590c){if(_0x44590c){return{'count':_0x44590c[_0x32dd('0x4c')],'rows':_['map'](_0x44590c[_0x32dd('0x69')],function(_0x12c2fa){return{'membername':_0x12c2fa[_0x32dd('0x35')],'UserId':_0x12c2fa['id'],'queue_name':_0x26a6d2[_0x32dd('0x35')],'SmsQueueId':_0x26a6d2['id'],'interface':util[_0x32dd('0x6a')](_0x32dd('0x6b'),_0x32dd('0x6c'),_0x12c2fa[_0x32dd('0x35')]),'penalty':0x0,'paused':_0x12c2fa['smsPause'],'createdAt':_0x12c2fa[_0x32dd('0x68')],'updatedAt':_0x12c2fa[_0x32dd('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32dd('0x30')](respondWithFilteredResult(_0x43f5ca,_0x21c9a0))[_0x32dd('0x50')](handleError(_0x43f5ca,null));};exports[_0x32dd('0x6d')]=function(_0x283a96,_0x4531c5,_0x1d55a6){var _0x2932f2={};var _0x21465f={};var _0x49455d;var _0x3b72a3;return db[_0x32dd('0x38')][_0x32dd('0x6e')]({'where':{'id':_0x283a96[_0x32dd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4531c5,null))['then'](function(_0x5a23e5){if(_0x5a23e5){_0x49455d=_0x5a23e5;_0x21465f[_0x32dd('0x3d')]=_[_0x32dd('0x3f')](db['Team'][_0x32dd('0x39')]);_0x21465f[_0x32dd('0x3e')]=_[_0x32dd('0x3f')](_0x283a96[_0x32dd('0x3e')]);_0x21465f[_0x32dd('0x48')]=_[_0x32dd('0x40')](_0x21465f[_0x32dd('0x3d')],_0x21465f['query']);_0x2932f2[_0x32dd('0x41')]=_[_0x32dd('0x40')](_0x21465f[_0x32dd('0x3d')],qs[_0x32dd('0x42')](_0x283a96[_0x32dd('0x3e')]['fields']));_0x2932f2[_0x32dd('0x41')]=_0x2932f2[_0x32dd('0x41')]['length']?_0x2932f2[_0x32dd('0x41')]:_0x21465f[_0x32dd('0x3d')];_0x2932f2['order']=qs[_0x32dd('0x46')](_0x283a96[_0x32dd('0x3e')][_0x32dd('0x46')]);_0x2932f2[_0x32dd('0x47')]=qs['filters'](_[_0x32dd('0x49')](_0x283a96[_0x32dd('0x3e')],_0x21465f['filters']));if(_0x283a96[_0x32dd('0x3e')]['filter']){_0x2932f2[_0x32dd('0x47')]=_['merge'](_0x2932f2[_0x32dd('0x47')],{'$or':_[_0x32dd('0x37')](_0x2932f2['attributes'],function(_0x11f2a5){var _0x7ac3={};_0x7ac3[_0x11f2a5]={'$like':'%'+_0x283a96['query'][_0x32dd('0x4a')]+'%'};return _0x7ac3;})});}_0x2932f2=_[_0x32dd('0x4b')]({},_0x2932f2,_0x283a96[_0x32dd('0x52')]);return _0x49455d[_0x32dd('0x6d')](_0x2932f2);}})['then'](function(_0x101ad7){if(_0x101ad7){_0x3b72a3=_0x101ad7[_0x32dd('0x43')];if(!_0x283a96[_0x32dd('0x3e')][_0x32dd('0x61')](_0x32dd('0x44'))){_0x2932f2[_0x32dd('0x28')]=qs[_0x32dd('0x28')](_0x283a96['query'][_0x32dd('0x28')]);_0x2932f2[_0x32dd('0x27')]=qs[_0x32dd('0x27')](_0x283a96['query']['offset']);}return _0x49455d[_0x32dd('0x6d')](_0x2932f2);}})['then'](function(_0x272dcd){if(_0x272dcd){return _0x272dcd?{'count':_0x3b72a3,'rows':_0x272dcd}:null;}})['then'](respondWithResult(_0x4531c5,null))['catch'](handleError(_0x4531c5,null));};exports[_0x32dd('0x6f')]=function(_0x102974,_0x4f46f2,_0x607b8f){var _0xadadec=_0x102974[_0x32dd('0x55')][_0x32dd('0x70')];return db[_0x32dd('0x71')][_0x32dd('0x4f')]({'where':{'id':_0xadadec},'attributes':['id'],'include':[{'model':db[_0x32dd('0x63')],'as':_0x32dd('0x72'),'attributes':['id',_0x32dd('0x35'),_0x32dd('0x73'),_0x32dd('0x74'),_0x32dd('0x75')],'raw':!![]}]})['then'](function(_0x46386e){if(_0x46386e){var _0x32febf=_[_0x32dd('0x76')](_0x46386e,function(_0x368aba){var _0x135599=_0x368aba[_0x32dd('0x32')]({'plain':!![]});return _0x135599[_0x32dd('0x72')];});return db[_0x32dd('0x38')][_0x32dd('0x53')]({'where':{'id':_0x102974[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](function(_0x50707d){return db[_0x32dd('0x77')][_0x32dd('0x78')](function(_0x555041){return _0x50707d['addTeams'](_0xadadec,{'transaction':_0x555041})[_0x32dd('0x30')](function(){return BPromise[_0x32dd('0x79')](_0x32febf,function(_0x18e39f){return db[_0x32dd('0x60')]['findOrCreate']({'where':{'UserId':_0x18e39f['id'],'SmsQueueId':_0x102974[_0x32dd('0x5e')]['id']},'transaction':_0x555041});});})[_0x32dd('0x30')](function(){_0x32febf['forEach'](function(_0x43aadc){socket[_0x32dd('0x7a')](_0x32dd('0x7b'),{'UserId':_0x43aadc['id'],'SmsQueueId':_0x50707d['id']});});});});});}})[_0x32dd('0x30')](respondWithStatusCode(_0x4f46f2,null))[_0x32dd('0x50')](handleError(_0x4f46f2,null));};exports[_0x32dd('0x7c')]=function(_0x469c68,_0x338a54,_0x49e2ac){return db[_0x32dd('0x71')][_0x32dd('0x4f')]({'where':{'id':_0x469c68[_0x32dd('0x3e')][_0x32dd('0x70')]},'attributes':['id'],'include':[{'model':db[_0x32dd('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x32dd('0x30')](handleEntityNotFound(_0x338a54,null))[_0x32dd('0x30')](function(_0x2ca12f){var _0x46370a=_[_0x32dd('0x37')](_0x2ca12f,'id');var _0x58615a=[];var _0xfdd1=[];var _0x197270=squel[_0x32dd('0x7d')]();_0x197270[_0x32dd('0x7e')](_0x32dd('0x7f'))[_0x32dd('0x80')](_0x32dd('0x81'),'tq')[_0x32dd('0x82')](_0x32dd('0x83'),'ut',_0x32dd('0x84'))[_0x32dd('0x47')](_0x32dd('0x85'),_0x469c68[_0x32dd('0x5e')]['id']);for(var _0x12940f=0x0;_0x12940f<_0x2ca12f['length'];_0x12940f+=0x1){let _0x267ebc=_0x2ca12f[_0x12940f];for(var _0x445b9f=0x0;_0x445b9f<_0x267ebc[_0x32dd('0x72')][_0x32dd('0x43')];_0x445b9f+=0x1){let _0x19719c=_0x267ebc[_0x32dd('0x72')][_0x445b9f];var _0x5be990=_0x197270[_0x32dd('0x86')]();_0x5be990[_0x32dd('0x47')](_0x32dd('0x87'),_0x19719c['id']);_0xfdd1['push'](db[_0x32dd('0x77')][_0x32dd('0x3e')](_0x5be990[_0x32dd('0x88')](),{'type':db[_0x32dd('0x77')][_0x32dd('0x89')][_0x32dd('0x8a')]})['then'](function(_0xfdc111){if(_0xfdc111[_0x32dd('0x43')]===0x1){return _0x19719c['id'];}else{var _0x5cb35e=_[_0x32dd('0x8b')](_['map'](_0xfdc111,_0x32dd('0x8c')),function(_0xaaec5c){return _['includes'](_0x46370a,_0xaaec5c);});if(_0x5cb35e){return _0x19719c['id'];}}}));}}return BPromise[_0x32dd('0x8d')](_0xfdd1)[_0x32dd('0x30')](function(_0x2e28ff){_0x58615a=_(_0x58615a)['union'](_0x2e28ff)[_0x32dd('0x8e')]()[_0x32dd('0x8f')]();return db['SmsQueue'][_0x32dd('0x53')]({'where':{'id':_0x469c68[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](function(_0x3a13dd){return db[_0x32dd('0x77')][_0x32dd('0x78')](function(_0x25eb92){return _0x3a13dd[_0x32dd('0x7c')](_0x469c68[_0x32dd('0x3e')]['ids'],{'transaction':_0x25eb92})[_0x32dd('0x30')](function(){if(!_['isEmpty'](_0x58615a)){return _0x3a13dd[_0x32dd('0x90')](_0x58615a,{'transaction':_0x25eb92});}})[_0x32dd('0x30')](function(){_0x58615a[_0x32dd('0x91')](function(_0x5f0e02){socket[_0x32dd('0x7a')]('userSmsQueue:remove',{'UserId':_0x5f0e02,'SmsQueueId':_0x3a13dd['id']});});});});});});})['then'](respondWithStatusCode(_0x338a54,null))['catch'](handleError(_0x338a54,null));};exports[_0x32dd('0x92')]=function(_0xb18209,_0x42927c,_0x3187fe){return db[_0x32dd('0x38')][_0x32dd('0x53')]({'where':{'id':_0xb18209[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x42927c,null))[_0x32dd('0x30')](function(_0x4c769f){if(_0x4c769f){return _0x4c769f['addAgents'](_0xb18209[_0x32dd('0x55')][_0x32dd('0x70')],_['omit'](_0xb18209[_0x32dd('0x55')],[_0x32dd('0x70'),'id'])||{})[_0x32dd('0x93')](function(_0x3cb248){for(var _0x391c2c=0x0;_0x391c2c<_0xb18209['body'][_0x32dd('0x70')][_0x32dd('0x43')];_0x391c2c+=0x1){socket[_0x32dd('0x7a')](_0x32dd('0x7b'),{'UserId':Number(_0xb18209[_0x32dd('0x55')][_0x32dd('0x70')][_0x391c2c]),'SmsQueueId':Number(_0xb18209[_0x32dd('0x5e')]['id'])});}return _0x3cb248;});}})[_0x32dd('0x30')](respondWithResult(_0x42927c,null))[_0x32dd('0x50')](handleError(_0x42927c,null));};exports[_0x32dd('0x90')]=function(_0x59f27,_0x2a2d2b,_0xcc518e){return db[_0x32dd('0x38')]['find']({'where':{'id':_0x59f27[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x2a2d2b,null))[_0x32dd('0x30')](function(_0x13fd2c){if(_0x13fd2c){return _0x13fd2c[_0x32dd('0x90')](_0x59f27[_0x32dd('0x3e')][_0x32dd('0x70')])[_0x32dd('0x30')](function(){if(_[_0x32dd('0x94')](_0x59f27[_0x32dd('0x3e')]['ids'])){for(var _0x1b7de1=0x0;_0x1b7de1<_0x59f27[_0x32dd('0x3e')]['ids']['length'];_0x1b7de1+=0x1){socket['emit'](_0x32dd('0x95'),{'UserId':Number(_0x59f27[_0x32dd('0x3e')][_0x32dd('0x70')][_0x1b7de1]),'SmsQueueId':Number(_0x59f27['params']['id'])});}}else{socket[_0x32dd('0x7a')](_0x32dd('0x95'),{'UserId':Number(_0x59f27['query'][_0x32dd('0x70')]),'SmsQueueId':Number(_0x59f27[_0x32dd('0x5e')]['id'])});}});}})[_0x32dd('0x30')](respondWithStatusCode(_0x2a2d2b,null))[_0x32dd('0x50')](handleError(_0x2a2d2b,null));};exports['getAgents']=function(_0x2ad6bc,_0x431da0,_0x2bf78c){var _0x7199dc={};var _0x53f6a7={};var _0x14f42b;var _0x1e366d;return db[_0x32dd('0x38')][_0x32dd('0x6e')]({'where':{'id':_0x2ad6bc[_0x32dd('0x5e')]['id']}})[_0x32dd('0x30')](handleEntityNotFound(_0x431da0,null))[_0x32dd('0x30')](function(_0x667def){if(_0x667def){_0x14f42b=_0x667def;_0x53f6a7[_0x32dd('0x3d')]=_[_0x32dd('0x3f')](db['User'][_0x32dd('0x39')]);_0x53f6a7[_0x32dd('0x3e')]=_[_0x32dd('0x3f')](_0x2ad6bc[_0x32dd('0x3e')]);_0x53f6a7['filters']=_[_0x32dd('0x40')](_0x53f6a7[_0x32dd('0x3d')],_0x53f6a7[_0x32dd('0x3e')]);_0x7199dc[_0x32dd('0x41')]=_[_0x32dd('0x40')](_0x53f6a7[_0x32dd('0x3d')],qs[_0x32dd('0x42')](_0x2ad6bc['query']['fields']));_0x7199dc[_0x32dd('0x41')]=_0x7199dc[_0x32dd('0x41')][_0x32dd('0x43')]?_0x7199dc['attributes']:_0x53f6a7[_0x32dd('0x3d')];_0x7199dc[_0x32dd('0x45')]=qs[_0x32dd('0x46')](_0x2ad6bc[_0x32dd('0x3e')][_0x32dd('0x46')]);_0x7199dc[_0x32dd('0x47')]=qs[_0x32dd('0x48')](_['pick'](_0x2ad6bc['query'],_0x53f6a7[_0x32dd('0x48')]));if(_0x2ad6bc['query']['filter']){_0x7199dc[_0x32dd('0x47')]=_['merge'](_0x7199dc[_0x32dd('0x47')],{'$or':_['map'](_0x7199dc[_0x32dd('0x41')],function(_0x1949c5){var _0x45e5bf={};_0x45e5bf[_0x1949c5]={'$like':'%'+_0x2ad6bc[_0x32dd('0x3e')]['filter']+'%'};return _0x45e5bf;})});}_0x7199dc=_['merge']({},_0x7199dc,_0x2ad6bc[_0x32dd('0x52')]);return _0x14f42b[_0x32dd('0x96')](_0x7199dc);}})[_0x32dd('0x30')](function(_0xb7b912){if(_0xb7b912){_0x1e366d=_0xb7b912[_0x32dd('0x43')];if(!_0x2ad6bc[_0x32dd('0x3e')][_0x32dd('0x61')](_0x32dd('0x44'))){_0x7199dc[_0x32dd('0x28')]=qs[_0x32dd('0x28')](_0x2ad6bc[_0x32dd('0x3e')][_0x32dd('0x28')]);_0x7199dc['offset']=qs[_0x32dd('0x27')](_0x2ad6bc[_0x32dd('0x3e')]['offset']);}return _0x14f42b[_0x32dd('0x96')](_0x7199dc);}})[_0x32dd('0x30')](function(_0x186d0f){if(_0x186d0f){return _0x186d0f?{'count':_0x1e366d,'rows':_0x186d0f}:null;}})[_0x32dd('0x30')](respondWithResult(_0x431da0,null))[_0x32dd('0x50')](handleError(_0x431da0,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index cfcd7d8..3e2542e 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 _0x4564=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x47c1f4,_0x4847a5){var _0x3e17b3=function(_0x437145){while(--_0x437145){_0x47c1f4['push'](_0x47c1f4['shift']());}};_0x3e17b3(++_0x4847a5);}(_0x4564,0x101));var _0x4456=function(_0xf51dc3,_0x37b81b){_0xf51dc3=_0xf51dc3-0x0;var _0x548b6a=_0x4564[_0xf51dc3];return _0x548b6a;};'use strict';var EventEmitter=require(_0x4456('0x0'));var SmsQueue=require(_0x4456('0x1'))['db'][_0x4456('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4456('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4456('0x4'),'afterDestroy':_0x4456('0x5')};function emitEvent(_0x4c09d2){return function(_0x5475ab,_0x29cd23,_0x817243){SmsQueueEvents[_0x4456('0x6')](_0x4c09d2+':'+_0x5475ab['id'],_0x5475ab);SmsQueueEvents[_0x4456('0x6')](_0x4c09d2,_0x5475ab);_0x817243(null);};}for(var e in events){if(events[_0x4456('0x7')](e)){var event=events[e];SmsQueue[_0x4456('0x8')](e,emitEvent(event));}}module[_0x4456('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x9511=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x9511,0x1c5));var _0x1951=function(_0x21fc0a,_0x1c3a72){_0x21fc0a=_0x21fc0a-0x0;var _0x485574=_0x9511[_0x21fc0a];return _0x485574;};'use strict';var EventEmitter=require(_0x1951('0x0'));var SmsQueue=require(_0x1951('0x1'))['db'][_0x1951('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1951('0x3')](0x0);var events={'afterCreate':_0x1951('0x4'),'afterUpdate':_0x1951('0x5'),'afterDestroy':_0x1951('0x6')};function emitEvent(_0x291aca){return function(_0x41fd99,_0x9f74d1,_0x54f41c){SmsQueueEvents[_0x1951('0x7')](_0x291aca+':'+_0x41fd99['id'],_0x41fd99);SmsQueueEvents[_0x1951('0x7')](_0x291aca,_0x41fd99);_0x54f41c(null);};}for(var e in events){if(events[_0x1951('0x8')](e)){var event=events[e];SmsQueue[_0x1951('0x9')](e,emitEvent(event));}}module[_0x1951('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c4fdf1f..c4bd58a 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 _0x0a04=['../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2fb2ff,_0x571b3e){var _0x3763ea=function(_0x2c7abc){while(--_0x2c7abc){_0x2fb2ff['push'](_0x2fb2ff['shift']());}};_0x3763ea(++_0x571b3e);}(_0x0a04,0x1b2));var _0x40a0=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0a04[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x40a0('0x0'));var logger=require(_0x40a0('0x1'))(_0x40a0('0x2'));var moment=require(_0x40a0('0x3'));var BPromise=require(_0x40a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40a0('0x5'));var config=require(_0x40a0('0x6'));var attributes=require(_0x40a0('0x7'));module['exports']=function(_0x3f61b8,_0x58ae04){return _0x3f61b8['define'](_0x40a0('0x8'),attributes,{'tableName':_0x40a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x558c=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x3d749d,_0x42128e){var _0x4a8288=function(_0x12c992){while(--_0x12c992){_0x3d749d['push'](_0x3d749d['shift']());}};_0x4a8288(++_0x42128e);}(_0x558c,0xd1));var _0xc558=function(_0x1bc1d8,_0x400e90){_0x1bc1d8=_0x1bc1d8-0x0;var _0x4f56ac=_0x558c[_0x1bc1d8];return _0x4f56ac;};'use strict';var _=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var logger=require(_0xc558('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc558('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc558('0x4'));var rimraf=require(_0xc558('0x5'));var config=require(_0xc558('0x6'));var attributes=require(_0xc558('0x7'));module[_0xc558('0x8')]=function(_0x167efd,_0x1046e6){return _0x167efd[_0xc558('0x9')](_0xc558('0xa'),attributes,{'tableName':_0xc558('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index a645276..d182468 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 _0xbde7=['result','GetSmsQueue','SmsQueue','options','raw','where','limit','map','include','model','attributes','then','ShowSmsQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1463f5,_0x4a1ef4){var _0x4cf248=function(_0x5392dd){while(--_0x5392dd){_0x1463f5['push'](_0x1463f5['shift']());}};_0x4cf248(++_0x4a1ef4);}(_0xbde7,0x11f));var _0x7bde=function(_0x5e78e7,_0x50be14){_0x5e78e7=_0x5e78e7-0x0;var _0xfa445f=_0xbde7[_0x5e78e7];return _0xfa445f;};'use strict';var _=require(_0x7bde('0x0'));var util=require(_0x7bde('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7bde('0x2'));var fs=require('fs');var Redis=require(_0x7bde('0x3'));var db=require(_0x7bde('0x4'))['db'];var utils=require(_0x7bde('0x5'));var logger=require('../../config/logger')(_0x7bde('0x6'));var config=require('../../config/environment');var jayson=require(_0x7bde('0x7'));var client=jayson[_0x7bde('0x8')][_0x7bde('0x9')]({'port':0x232a});config[_0x7bde('0xa')]=_[_0x7bde('0xb')](config[_0x7bde('0xa')],{'host':_0x7bde('0xc'),'port':0x18eb});var socket=require(_0x7bde('0xd'))(new Redis(config['redis']));require(_0x7bde('0xe'))[_0x7bde('0xf')](socket);function respondWithRpcPromise(_0x4a7f59,_0x8f9325,_0x1c1be1){return new BPromise(function(_0x5f1c78,_0x4fe712){return client[_0x7bde('0x10')](_0x4a7f59,_0x1c1be1)['then'](function(_0x4e1e23){logger[_0x7bde('0x11')](_0x7bde('0x12'),_0x8f9325,_0x7bde('0x13'));logger[_0x7bde('0x14')](_0x7bde('0x15'),_0x8f9325,_0x7bde('0x13'),JSON[_0x7bde('0x16')](_0x4e1e23));if(_0x4e1e23[_0x7bde('0x17')]){if(_0x4e1e23[_0x7bde('0x17')]['code']===0x1f4){logger['error'](_0x7bde('0x12'),_0x8f9325,_0x4e1e23[_0x7bde('0x17')][_0x7bde('0x18')]);return _0x4fe712(_0x4e1e23[_0x7bde('0x17')][_0x7bde('0x18')]);}logger[_0x7bde('0x17')]('SmsQueue,\x20%s,\x20%s',_0x8f9325,_0x4e1e23[_0x7bde('0x17')][_0x7bde('0x18')]);return _0x5f1c78(_0x4e1e23[_0x7bde('0x17')][_0x7bde('0x18')]);}else{logger['info'](_0x7bde('0x12'),_0x8f9325,_0x7bde('0x13'));_0x5f1c78(_0x4e1e23[_0x7bde('0x19')]['message']);}})['catch'](function(_0x2fdd60){logger[_0x7bde('0x17')](_0x7bde('0x12'),_0x8f9325,_0x2fdd60);_0x4fe712(_0x2fdd60);});});}exports[_0x7bde('0x1a')]=function(_0x168167){var _0x21a9b7=this;return new Promise(function(_0x4ff68a,_0x324d95){return db[_0x7bde('0x1b')]['findAll']({'raw':_0x168167[_0x7bde('0x1c')]?_0x168167[_0x7bde('0x1c')][_0x7bde('0x1d')]===undefined?!![]:![]:!![],'where':_0x168167[_0x7bde('0x1c')]?_0x168167['options'][_0x7bde('0x1e')]||null:null,'attributes':_0x168167[_0x7bde('0x1c')]?_0x168167[_0x7bde('0x1c')]['attributes']||null:null,'limit':_0x168167[_0x7bde('0x1c')]?_0x168167[_0x7bde('0x1c')][_0x7bde('0x1f')]||null:null,'include':_0x168167['options']?_0x168167[_0x7bde('0x1c')]['include']?_[_0x7bde('0x20')](_0x168167[_0x7bde('0x1c')][_0x7bde('0x21')],function(_0x1ec731){return{'model':db[_0x1ec731[_0x7bde('0x22')]],'as':_0x1ec731['as'],'attributes':_0x1ec731[_0x7bde('0x23')],'include':_0x1ec731[_0x7bde('0x21')]?_[_0x7bde('0x20')](_0x1ec731[_0x7bde('0x21')],function(_0x31d6dd){return{'model':db[_0x31d6dd[_0x7bde('0x22')]],'as':_0x31d6dd['as'],'attributes':_0x31d6dd[_0x7bde('0x23')],'include':_0x31d6dd['include']?_[_0x7bde('0x20')](_0x31d6dd[_0x7bde('0x21')],function(_0x3fdd40){return{'model':db[_0x3fdd40[_0x7bde('0x22')]],'as':_0x3fdd40['as'],'attributes':_0x3fdd40[_0x7bde('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7bde('0x24')](function(_0x312e43){logger[_0x7bde('0x11')](_0x7bde('0x1a'),_0x168167);logger['debug'](_0x7bde('0x1a'),_0x168167,JSON[_0x7bde('0x16')](_0x312e43));_0x4ff68a(_0x312e43);})['catch'](function(_0x2c1cee){logger['error'](_0x7bde('0x1a'),_0x2c1cee[_0x7bde('0x18')],_0x168167);_0x324d95(_0x21a9b7['error'](0x1f4,_0x2c1cee['message']));});});};exports[_0x7bde('0x25')]=function(_0x3eef98){var _0x3d4077=this;return new Promise(function(_0x1c63a8,_0x2d3aac){return db[_0x7bde('0x1b')][_0x7bde('0x26')]({'raw':_0x3eef98[_0x7bde('0x1c')]?_0x3eef98[_0x7bde('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3eef98['options']?_0x3eef98[_0x7bde('0x1c')]['where']||null:null,'attributes':_0x3eef98[_0x7bde('0x1c')]?_0x3eef98['options'][_0x7bde('0x23')]||null:null,'include':_0x3eef98[_0x7bde('0x1c')]?_0x3eef98[_0x7bde('0x1c')]['include']?_['map'](_0x3eef98[_0x7bde('0x1c')][_0x7bde('0x21')],function(_0x1db085){return{'model':db[_0x1db085[_0x7bde('0x22')]],'as':_0x1db085['as'],'attributes':_0x1db085[_0x7bde('0x23')],'include':_0x1db085[_0x7bde('0x21')]?_[_0x7bde('0x20')](_0x1db085['include'],function(_0x15941e){return{'model':db[_0x15941e['model']],'as':_0x15941e['as'],'attributes':_0x15941e[_0x7bde('0x23')],'include':_0x15941e[_0x7bde('0x21')]?_[_0x7bde('0x20')](_0x15941e[_0x7bde('0x21')],function(_0xa1ee6d){return{'model':db[_0xa1ee6d['model']],'as':_0xa1ee6d['as'],'attributes':_0xa1ee6d[_0x7bde('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7bde('0x24')](function(_0x33f4aa){logger[_0x7bde('0x11')](_0x7bde('0x25'),_0x3eef98);logger[_0x7bde('0x14')]('ShowSmsQueue',_0x3eef98,JSON['stringify'](_0x33f4aa));_0x1c63a8(_0x33f4aa);})['catch'](function(_0x14572a){logger[_0x7bde('0x17')]('ShowSmsQueue',_0x14572a['message'],_0x3eef98);_0x2d3aac(_0x3d4077[_0x7bde('0x17')](0x1f4,_0x14572a[_0x7bde('0x18')]));});});}; \ No newline at end of file +var _0xda41=['options','raw','attributes','include','map','model','GetSmsQueue','debug','ShowSmsQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SmsQueue','findAll'];(function(_0x4b70f8,_0x4916c6){var _0x28a908=function(_0x2ff9ea){while(--_0x2ff9ea){_0x4b70f8['push'](_0x4b70f8['shift']());}};_0x28a908(++_0x4916c6);}(_0xda41,0x1af));var _0x1da4=function(_0xe3717a,_0x1d5eca){_0xe3717a=_0xe3717a-0x0;var _0x17445e=_0xda41[_0xe3717a];return _0x17445e;};'use strict';var _=require(_0x1da4('0x0'));var util=require(_0x1da4('0x1'));var moment=require(_0x1da4('0x2'));var BPromise=require(_0x1da4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1da4('0x4'));var db=require(_0x1da4('0x5'))['db'];var utils=require(_0x1da4('0x6'));var logger=require(_0x1da4('0x7'))(_0x1da4('0x8'));var config=require('../../config/environment');var jayson=require(_0x1da4('0x9'));var client=jayson[_0x1da4('0xa')][_0x1da4('0xb')]({'port':0x232a});config['redis']=_[_0x1da4('0xc')](config[_0x1da4('0xd')],{'host':_0x1da4('0xe'),'port':0x18eb});var socket=require(_0x1da4('0xf'))(new Redis(config[_0x1da4('0xd')]));require(_0x1da4('0x10'))[_0x1da4('0x11')](socket);function respondWithRpcPromise(_0x1b929a,_0x455cb1,_0x15a228){return new BPromise(function(_0x2f0ba9,_0x3e1260){return client[_0x1da4('0x12')](_0x1b929a,_0x15a228)[_0x1da4('0x13')](function(_0x331450){logger['info'](_0x1da4('0x14'),_0x455cb1,_0x1da4('0x15'));logger['debug'](_0x1da4('0x16'),_0x455cb1,_0x1da4('0x15'),JSON[_0x1da4('0x17')](_0x331450));if(_0x331450['error']){if(_0x331450['error']['code']===0x1f4){logger[_0x1da4('0x18')](_0x1da4('0x14'),_0x455cb1,_0x331450[_0x1da4('0x18')][_0x1da4('0x19')]);return _0x3e1260(_0x331450['error'][_0x1da4('0x19')]);}logger[_0x1da4('0x18')](_0x1da4('0x14'),_0x455cb1,_0x331450[_0x1da4('0x18')][_0x1da4('0x19')]);return _0x2f0ba9(_0x331450[_0x1da4('0x18')][_0x1da4('0x19')]);}else{logger[_0x1da4('0x1a')](_0x1da4('0x14'),_0x455cb1,_0x1da4('0x15'));_0x2f0ba9(_0x331450[_0x1da4('0x1b')]['message']);}})[_0x1da4('0x1c')](function(_0x2d3202){logger[_0x1da4('0x18')](_0x1da4('0x14'),_0x455cb1,_0x2d3202);_0x3e1260(_0x2d3202);});});}exports['GetSmsQueue']=function(_0x4bd138){var _0x3149db=this;return new Promise(function(_0x15a3f9,_0x2bfe34){return db[_0x1da4('0x1d')][_0x1da4('0x1e')]({'raw':_0x4bd138[_0x1da4('0x1f')]?_0x4bd138['options'][_0x1da4('0x20')]===undefined?!![]:![]:!![],'where':_0x4bd138['options']?_0x4bd138[_0x1da4('0x1f')]['where']||null:null,'attributes':_0x4bd138['options']?_0x4bd138[_0x1da4('0x1f')][_0x1da4('0x21')]||null:null,'limit':_0x4bd138[_0x1da4('0x1f')]?_0x4bd138[_0x1da4('0x1f')]['limit']||null:null,'include':_0x4bd138[_0x1da4('0x1f')]?_0x4bd138[_0x1da4('0x1f')][_0x1da4('0x22')]?_[_0x1da4('0x23')](_0x4bd138[_0x1da4('0x1f')][_0x1da4('0x22')],function(_0xfd2f8d){return{'model':db[_0xfd2f8d['model']],'as':_0xfd2f8d['as'],'attributes':_0xfd2f8d[_0x1da4('0x21')],'include':_0xfd2f8d[_0x1da4('0x22')]?_[_0x1da4('0x23')](_0xfd2f8d[_0x1da4('0x22')],function(_0xa14fe2){return{'model':db[_0xa14fe2[_0x1da4('0x24')]],'as':_0xa14fe2['as'],'attributes':_0xa14fe2[_0x1da4('0x21')],'include':_0xa14fe2['include']?_[_0x1da4('0x23')](_0xa14fe2[_0x1da4('0x22')],function(_0x3a4814){return{'model':db[_0x3a4814[_0x1da4('0x24')]],'as':_0x3a4814['as'],'attributes':_0x3a4814[_0x1da4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1da4('0x13')](function(_0x1dc50b){logger[_0x1da4('0x1a')](_0x1da4('0x25'),_0x4bd138);logger[_0x1da4('0x26')](_0x1da4('0x25'),_0x4bd138,JSON[_0x1da4('0x17')](_0x1dc50b));_0x15a3f9(_0x1dc50b);})['catch'](function(_0x230427){logger[_0x1da4('0x18')](_0x1da4('0x25'),_0x230427['message'],_0x4bd138);_0x2bfe34(_0x3149db[_0x1da4('0x18')](0x1f4,_0x230427[_0x1da4('0x19')]));});});};exports[_0x1da4('0x27')]=function(_0x315ccf){var _0x40fb27=this;return new Promise(function(_0x31047f,_0x3ae050){return db['SmsQueue'][_0x1da4('0x28')]({'raw':_0x315ccf[_0x1da4('0x1f')]?_0x315ccf['options'][_0x1da4('0x20')]===undefined?!![]:![]:!![],'where':_0x315ccf[_0x1da4('0x1f')]?_0x315ccf[_0x1da4('0x1f')][_0x1da4('0x29')]||null:null,'attributes':_0x315ccf[_0x1da4('0x1f')]?_0x315ccf[_0x1da4('0x1f')][_0x1da4('0x21')]||null:null,'include':_0x315ccf['options']?_0x315ccf[_0x1da4('0x1f')][_0x1da4('0x22')]?_[_0x1da4('0x23')](_0x315ccf[_0x1da4('0x1f')][_0x1da4('0x22')],function(_0x46bcfd){return{'model':db[_0x46bcfd[_0x1da4('0x24')]],'as':_0x46bcfd['as'],'attributes':_0x46bcfd[_0x1da4('0x21')],'include':_0x46bcfd[_0x1da4('0x22')]?_[_0x1da4('0x23')](_0x46bcfd[_0x1da4('0x22')],function(_0x60bd7a){return{'model':db[_0x60bd7a[_0x1da4('0x24')]],'as':_0x60bd7a['as'],'attributes':_0x60bd7a[_0x1da4('0x21')],'include':_0x60bd7a[_0x1da4('0x22')]?_[_0x1da4('0x23')](_0x60bd7a[_0x1da4('0x22')],function(_0x55c399){return{'model':db[_0x55c399[_0x1da4('0x24')]],'as':_0x55c399['as'],'attributes':_0x55c399[_0x1da4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1da4('0x13')](function(_0x685c9f){logger[_0x1da4('0x1a')](_0x1da4('0x27'),_0x315ccf);logger[_0x1da4('0x26')](_0x1da4('0x27'),_0x315ccf,JSON[_0x1da4('0x17')](_0x685c9f));_0x31047f(_0x685c9f);})[_0x1da4('0x1c')](function(_0x5de447){logger[_0x1da4('0x18')](_0x1da4('0x27'),_0x5de447[_0x1da4('0x19')],_0x315ccf);_0x3ae050(_0x40fb27[_0x1da4('0x18')](0x1f4,_0x5de447[_0x1da4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5348aab..be1e615 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 _0xc1e1=['remove','update','emit','removeListener','length','./smsQueue.events','save'];(function(_0x51a47f,_0x3bdb73){var _0x3cc389=function(_0x5ad005){while(--_0x5ad005){_0x51a47f['push'](_0x51a47f['shift']());}};_0x3cc389(++_0x3bdb73);}(_0xc1e1,0x19b));var _0x1c1e=function(_0x41dc45,_0x5d55f7){_0x41dc45=_0x41dc45-0x0;var _0x50d165=_0xc1e1[_0x41dc45];return _0x50d165;};'use strict';var SmsQueueEvents=require(_0x1c1e('0x0'));var events=[_0x1c1e('0x1'),_0x1c1e('0x2'),_0x1c1e('0x3')];function createListener(_0xc9fc0a,_0x84ef40){return function(_0x22614f){_0x84ef40[_0x1c1e('0x4')](_0xc9fc0a,_0x22614f);};}function removeListener(_0x1903ea,_0x21aef5){return function(){SmsQueueEvents[_0x1c1e('0x5')](_0x1903ea,_0x21aef5);};}exports['register']=function(_0x19a55b){for(var _0x1cf612=0x0,_0x31e4c2=events[_0x1c1e('0x6')];_0x1cf612<_0x31e4c2;_0x1cf612++){var _0x289a62=events[_0x1cf612];var _0x25c146=createListener('smsQueue:'+_0x289a62,_0x19a55b);SmsQueueEvents['on'](_0x289a62,_0x25c146);}}; \ No newline at end of file +var _0xe53a=['length','smsQueue:','./smsQueue.events','emit','removeListener','register'];(function(_0x11c9a3,_0x3f0eca){var _0x33d27a=function(_0x455837){while(--_0x455837){_0x11c9a3['push'](_0x11c9a3['shift']());}};_0x33d27a(++_0x3f0eca);}(_0xe53a,0x116));var _0xae53=function(_0xb4d59d,_0x5c30d2){_0xb4d59d=_0xb4d59d-0x0;var _0x562ebb=_0xe53a[_0xb4d59d];return _0x562ebb;};'use strict';var SmsQueueEvents=require(_0xae53('0x0'));var events=['save','remove','update'];function createListener(_0x1dafe0,_0x269297){return function(_0x4f3478){_0x269297[_0xae53('0x1')](_0x1dafe0,_0x4f3478);};}function removeListener(_0x4dbe6c,_0x5bf800){return function(){SmsQueueEvents[_0xae53('0x2')](_0x4dbe6c,_0x5bf800);};}exports[_0xae53('0x3')]=function(_0xa391b8){for(var _0x2eb426=0x0,_0x10869e=events[_0xae53('0x4')];_0x2eb426<_0x10869e;_0x2eb426++){var _0x4e77ae=events[_0x2eb426];var _0x37ad56=createListener(_0xae53('0x5')+_0x4e77ae,_0xa391b8);SmsQueueEvents['on'](_0x4e77ae,_0x37ad56);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 0ae0347..d28558f 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 _0x30e9=['./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x30e9,0x158));var _0x930e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x30e9[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x930e('0x2'));var router=express[_0x930e('0x3')]();var fs_extra=require(_0x930e('0x4'));var auth=require(_0x930e('0x5'));var interaction=require(_0x930e('0x6'));var config=require(_0x930e('0x7'));var controller=require(_0x930e('0x8'));router[_0x930e('0x9')]('/',auth[_0x930e('0xa')](),controller[_0x930e('0xb')]);router[_0x930e('0x9')](_0x930e('0xc'),auth[_0x930e('0xa')](),controller[_0x930e('0xd')]);router[_0x930e('0x9')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x930e('0x10')]);router[_0x930e('0x11')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0x12')]);router[_0x930e('0x13')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0x14')]);module[_0x930e('0x15')]=router; \ No newline at end of file +var _0x65eb=['exports','multer','util','connect-timeout','express','Router','fs-extra','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy'];(function(_0xb09208,_0x375996){var _0x58f8e2=function(_0x156ac6){while(--_0x156ac6){_0xb09208['push'](_0xb09208['shift']());}};_0x58f8e2(++_0x375996);}(_0x65eb,0x1a3));var _0xb65e=function(_0x5311c7,_0x3eaae0){_0x5311c7=_0x5311c7-0x0;var _0x110e63=_0x65eb[_0x5311c7];return _0x110e63;};'use strict';var multer=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var path=require('path');var timeout=require(_0xb65e('0x2'));var express=require(_0xb65e('0x3'));var router=express[_0xb65e('0x4')]();var fs_extra=require(_0xb65e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb65e('0x6'));router[_0xb65e('0x7')]('/',auth[_0xb65e('0x8')](),controller[_0xb65e('0x9')]);router[_0xb65e('0x7')](_0xb65e('0xa'),auth['isAuthenticated'](),controller[_0xb65e('0xb')]);router[_0xb65e('0x7')](_0xb65e('0xc'),auth[_0xb65e('0x8')](),controller['show']);router[_0xb65e('0xd')]('/',auth[_0xb65e('0x8')](),controller[_0xb65e('0xe')]);router[_0xb65e('0xf')](_0xb65e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb65e('0x10')](_0xb65e('0xc'),auth[_0xb65e('0x8')](),controller[_0xb65e('0x11')]);module[_0xb65e('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 06e8a04..05110d1 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 _0x521e=['STRING','DATE'];(function(_0x5008c8,_0x342e4a){var _0x28d778=function(_0x2dd365){while(--_0x2dd365){_0x5008c8['push'](_0x5008c8['shift']());}};_0x28d778(++_0x342e4a);}(_0x521e,0x86));var _0xe521=function(_0xd2e465,_0x39e5e8){_0xd2e465=_0xd2e465-0x0;var _0x16eb40=_0x521e[_0xd2e465];return _0x16eb40;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe521('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe521('0x0')]},'joinAt':{'type':Sequelize[_0xe521('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe521('0x1')]},'exitAt':{'type':Sequelize[_0xe521('0x1')]},'reason':{'type':Sequelize[_0xe521('0x0')]}}; \ No newline at end of file +var _0xc960=['moment','exports','STRING','DATE'];(function(_0x42af03,_0x51d229){var _0xfcfac7=function(_0x27465f){while(--_0x27465f){_0x42af03['push'](_0x42af03['shift']());}};_0xfcfac7(++_0x51d229);}(_0xc960,0x10c));var _0x0c96=function(_0x46d877,_0x3d7741){_0x46d877=_0x46d877-0x0;var _0x35f37e=_0xc960[_0x46d877];return _0x35f37e;};'use strict';var moment=require(_0x0c96('0x0'));var Sequelize=require('sequelize');module[_0x0c96('0x1')]={'uniqueid':{'type':Sequelize[_0x0c96('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0c96('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0c96('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0c96('0x3')]},'reason':{'type':Sequelize[_0x0c96('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 750e1fe..334288e 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 _0xc5c3=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','name','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','then','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xc5c3,0x17c));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3c5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c5c('0x1'));var jsonpatch=require(_0x3c5c('0x2'));var rp=require(_0x3c5c('0x3'));var moment=require(_0x3c5c('0x4'));var BPromise=require(_0x3c5c('0x5'));var Mustache=require(_0x3c5c('0x6'));var util=require(_0x3c5c('0x7'));var path=require(_0x3c5c('0x8'));var sox=require(_0x3c5c('0x9'));var csv=require(_0x3c5c('0xa'));var ejs=require(_0x3c5c('0xb'));var fs=require('fs');var fs_extra=require(_0x3c5c('0xc'));var _=require(_0x3c5c('0xd'));var squel=require(_0x3c5c('0xe'));var crypto=require('crypto');var jsforce=require(_0x3c5c('0xf'));var deskjs=require(_0x3c5c('0x10'));var toCsv=require(_0x3c5c('0xa'));var querystring=require(_0x3c5c('0x11'));var Papa=require(_0x3c5c('0x12'));var Redis=require(_0x3c5c('0x13'));var authService=require(_0x3c5c('0x14'));var qs=require(_0x3c5c('0x15'));var as=require(_0x3c5c('0x16'));var hardwareService=require(_0x3c5c('0x17'));var logger=require(_0x3c5c('0x18'))(_0x3c5c('0x19'));var utils=require(_0x3c5c('0x1a'));var config=require(_0x3c5c('0x1b'));var licenseUtil=require(_0x3c5c('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32c801,_0x1965df){_0x1965df=_0x1965df||0xcc;return function(_0x158a11){if(_0x158a11){return _0x32c801[_0x3c5c('0x1d')](_0x1965df);}return _0x32c801[_0x3c5c('0x1e')](_0x1965df)[_0x3c5c('0x1f')]();};}function respondWithResult(_0x48f129,_0x301282){_0x301282=_0x301282||0xc8;return function(_0x58eb04){if(_0x58eb04){return _0x48f129[_0x3c5c('0x1e')](_0x301282)[_0x3c5c('0x20')](_0x58eb04);}};}function respondWithFilteredResult(_0x1e86d1,_0x4506b9){return function(_0x579d4e){if(_0x579d4e){var _0x3dfa90=typeof _0x4506b9[_0x3c5c('0x21')]==='undefined'&&typeof _0x4506b9[_0x3c5c('0x22')]===_0x3c5c('0x23');var _0x4bb6f5=_0x579d4e[_0x3c5c('0x24')];var _0x5afbb5=_0x3dfa90?0x0:_0x4506b9[_0x3c5c('0x21')];var _0x31e457=_0x3dfa90?_0x579d4e['count']:_0x4506b9['offset']+_0x4506b9[_0x3c5c('0x22')];var _0x36b770;if(_0x31e457>=_0x4bb6f5){_0x31e457=_0x4bb6f5;_0x36b770=0xc8;}else{_0x36b770=0xce;}_0x1e86d1[_0x3c5c('0x1e')](_0x36b770);return _0x1e86d1[_0x3c5c('0x25')](_0x3c5c('0x26'),_0x5afbb5+'-'+_0x31e457+'/'+_0x4bb6f5)[_0x3c5c('0x20')](_0x579d4e);}return null;};}function patchUpdates(_0x1f418a){return function(_0x2b2269){try{jsonpatch[_0x3c5c('0x27')](_0x2b2269,_0x1f418a,!![]);}catch(_0x585d98){return BPromise[_0x3c5c('0x28')](_0x585d98);}return _0x2b2269[_0x3c5c('0x29')]();};}function saveUpdates(_0x1fd4b7,_0x40018d){return function(_0x33fc87){if(_0x33fc87){return _0x33fc87[_0x3c5c('0x2a')](_0x1fd4b7)['then'](function(_0x47a82d){return _0x47a82d;});}return null;};}function removeEntity(_0x22454e,_0x5858c9){return function(_0x2dc502){if(_0x2dc502){return _0x2dc502[_0x3c5c('0x2b')]()['then'](function(){_0x22454e[_0x3c5c('0x1e')](0xcc)[_0x3c5c('0x1f')]();});}};}function handleEntityNotFound(_0x59b0f7,_0x1fb56a){return function(_0x7bd237){if(!_0x7bd237){_0x59b0f7['sendStatus'](0x194);}return _0x7bd237;};}function handleError(_0x1d23f5,_0x3859f1){_0x3859f1=_0x3859f1||0x1f4;return function(_0x194252){logger[_0x3c5c('0x2c')](_0x194252['stack']);if(_0x194252[_0x3c5c('0x2d')]){delete _0x194252['name'];}_0x1d23f5['status'](_0x3859f1)['send'](_0x194252);};}exports[_0x3c5c('0x2e')]=function(_0x391394,_0x59d4cb){var _0x11f6d7={},_0x5bd523={},_0x2d7176={'count':0x0,'rows':[]};var _0x24c310=_[_0x3c5c('0x2f')](db[_0x3c5c('0x30')][_0x3c5c('0x31')],function(_0x2dfff9){return{'name':_0x2dfff9[_0x3c5c('0x32')],'type':_0x2dfff9['type'][_0x3c5c('0x33')]};});_0x5bd523[_0x3c5c('0x34')]=_['map'](_0x24c310,_0x3c5c('0x2d'));_0x5bd523[_0x3c5c('0x35')]=_[_0x3c5c('0x36')](_0x391394[_0x3c5c('0x35')]);_0x5bd523[_0x3c5c('0x37')]=_[_0x3c5c('0x38')](_0x5bd523[_0x3c5c('0x34')],_0x5bd523[_0x3c5c('0x35')]);_0x11f6d7[_0x3c5c('0x39')]=_['intersection'](_0x5bd523['model'],qs[_0x3c5c('0x3a')](_0x391394['query'][_0x3c5c('0x3a')]));_0x11f6d7[_0x3c5c('0x39')]=_0x11f6d7['attributes'][_0x3c5c('0x3b')]?_0x11f6d7[_0x3c5c('0x39')]:_0x5bd523[_0x3c5c('0x34')];if(!_0x391394[_0x3c5c('0x35')][_0x3c5c('0x3c')](_0x3c5c('0x3d'))){_0x11f6d7['limit']=qs[_0x3c5c('0x22')](_0x391394[_0x3c5c('0x35')][_0x3c5c('0x22')]);_0x11f6d7['offset']=qs[_0x3c5c('0x21')](_0x391394[_0x3c5c('0x35')]['offset']);}_0x11f6d7[_0x3c5c('0x3e')]=qs[_0x3c5c('0x3f')](_0x391394[_0x3c5c('0x35')][_0x3c5c('0x3f')]);_0x11f6d7[_0x3c5c('0x40')]=qs['filters'](_['pick'](_0x391394[_0x3c5c('0x35')],_0x5bd523['filters']),_0x24c310);if(_0x391394[_0x3c5c('0x35')][_0x3c5c('0x41')]){_0x11f6d7['where']=_['merge'](_0x11f6d7['where'],{'$or':_[_0x3c5c('0x2f')](_0x24c310,function(_0x527ef3){if(_0x527ef3[_0x3c5c('0x42')]!==_0x3c5c('0x43')){var _0x2d5a36={};_0x2d5a36[_0x527ef3[_0x3c5c('0x2d')]]={'$like':'%'+_0x391394[_0x3c5c('0x35')]['filter']+'%'};return _0x2d5a36;}})});}_0x11f6d7=_[_0x3c5c('0x44')]({},_0x11f6d7,_0x391394[_0x3c5c('0x45')]);var _0x3a4b8a={'where':_0x11f6d7[_0x3c5c('0x40')]};return db[_0x3c5c('0x30')][_0x3c5c('0x24')](_0x3a4b8a)['then'](function(_0x4e187b){_0x2d7176[_0x3c5c('0x24')]=_0x4e187b;if(_0x391394['query'][_0x3c5c('0x46')]){_0x11f6d7[_0x3c5c('0x47')]=[{'all':!![]}];}return db[_0x3c5c('0x30')][_0x3c5c('0x48')](_0x11f6d7);})[_0x3c5c('0x49')](function(_0x5897b4){_0x2d7176['rows']=_0x5897b4;return _0x2d7176;})['then'](respondWithFilteredResult(_0x59d4cb,_0x11f6d7))[_0x3c5c('0x4a')](handleError(_0x59d4cb,null));};exports[_0x3c5c('0x4b')]=function(_0x14f3ed,_0x24779e){var _0x6f5a8d={'raw':!![],'where':{'id':_0x14f3ed[_0x3c5c('0x4c')]['id']}},_0x23ae6a={};_0x23ae6a[_0x3c5c('0x34')]=_[_0x3c5c('0x36')](db['SmsQueueReport'][_0x3c5c('0x31')]);_0x23ae6a['query']=_[_0x3c5c('0x36')](_0x14f3ed[_0x3c5c('0x35')]);_0x23ae6a[_0x3c5c('0x37')]=_['intersection'](_0x23ae6a['model'],_0x23ae6a[_0x3c5c('0x35')]);_0x6f5a8d[_0x3c5c('0x39')]=_['intersection'](_0x23ae6a[_0x3c5c('0x34')],qs['fields'](_0x14f3ed[_0x3c5c('0x35')][_0x3c5c('0x3a')]));_0x6f5a8d[_0x3c5c('0x39')]=_0x6f5a8d[_0x3c5c('0x39')]['length']?_0x6f5a8d[_0x3c5c('0x39')]:_0x23ae6a[_0x3c5c('0x34')];if(_0x14f3ed[_0x3c5c('0x35')][_0x3c5c('0x46')]){_0x6f5a8d[_0x3c5c('0x47')]=[{'all':!![]}];}_0x6f5a8d=_[_0x3c5c('0x44')]({},_0x6f5a8d,_0x14f3ed[_0x3c5c('0x45')]);return db[_0x3c5c('0x30')][_0x3c5c('0x4d')](_0x6f5a8d)[_0x3c5c('0x49')](handleEntityNotFound(_0x24779e,null))[_0x3c5c('0x49')](respondWithResult(_0x24779e,null))[_0x3c5c('0x4a')](handleError(_0x24779e,null));};exports[_0x3c5c('0x4e')]=function(_0x41606b,_0x580f75){return db['SmsQueueReport'][_0x3c5c('0x4e')](_0x41606b['body'],{})[_0x3c5c('0x49')](respondWithResult(_0x580f75,0xc9))[_0x3c5c('0x4a')](handleError(_0x580f75,null));};exports[_0x3c5c('0x2a')]=function(_0x9d731b,_0x235985){if(_0x9d731b[_0x3c5c('0x4f')]['id']){delete _0x9d731b[_0x3c5c('0x4f')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x9d731b[_0x3c5c('0x4c')]['id']}})[_0x3c5c('0x49')](handleEntityNotFound(_0x235985,null))[_0x3c5c('0x49')](saveUpdates(_0x9d731b[_0x3c5c('0x4f')],null))[_0x3c5c('0x49')](respondWithResult(_0x235985,null))[_0x3c5c('0x4a')](handleError(_0x235985,null));};exports[_0x3c5c('0x2b')]=function(_0x149b6d,_0x574964){return db['SmsQueueReport'][_0x3c5c('0x4d')]({'where':{'id':_0x149b6d[_0x3c5c('0x4c')]['id']}})[_0x3c5c('0x49')](handleEntityNotFound(_0x574964,null))[_0x3c5c('0x49')](removeEntity(_0x574964,null))[_0x3c5c('0x4a')](handleError(_0x574964,null));};exports[_0x3c5c('0x50')]=function(_0x266832,_0x4dc38b){return db[_0x3c5c('0x30')]['describe']()[_0x3c5c('0x49')](respondWithResult(_0x4dc38b,null))[_0x3c5c('0x4a')](handleError(_0x4dc38b,null));}; \ No newline at end of file +var _0xfcde=['merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x48ac00,_0xc45314){var _0x498fbf=function(_0x250826){while(--_0x250826){_0x48ac00['push'](_0x48ac00['shift']());}};_0x498fbf(++_0xc45314);}(_0xfcde,0x1c8));var _0xefcd=function(_0x12c5ce,_0x108db8){_0x12c5ce=_0x12c5ce-0x0;var _0x359220=_0xfcde[_0x12c5ce];return _0x359220;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefcd('0x0'));var zipdir=require(_0xefcd('0x1'));var jsonpatch=require(_0xefcd('0x2'));var rp=require(_0xefcd('0x3'));var moment=require(_0xefcd('0x4'));var BPromise=require(_0xefcd('0x5'));var Mustache=require(_0xefcd('0x6'));var util=require(_0xefcd('0x7'));var path=require(_0xefcd('0x8'));var sox=require(_0xefcd('0x9'));var csv=require('to-csv');var ejs=require(_0xefcd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefcd('0xb'));var squel=require('squel');var crypto=require(_0xefcd('0xc'));var jsforce=require(_0xefcd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefcd('0xe'));var Redis=require(_0xefcd('0xf'));var authService=require(_0xefcd('0x10'));var qs=require(_0xefcd('0x11'));var as=require(_0xefcd('0x12'));var hardwareService=require(_0xefcd('0x13'));var logger=require(_0xefcd('0x14'))(_0xefcd('0x15'));var utils=require(_0xefcd('0x16'));var config=require(_0xefcd('0x17'));var licenseUtil=require(_0xefcd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579710,_0x538d93){_0x538d93=_0x538d93||0xcc;return function(_0x1cfeac){if(_0x1cfeac){return _0x579710[_0xefcd('0x19')](_0x538d93);}return _0x579710['status'](_0x538d93)['end']();};}function respondWithResult(_0x4ca9c6,_0x339f56){_0x339f56=_0x339f56||0xc8;return function(_0x16b313){if(_0x16b313){return _0x4ca9c6[_0xefcd('0x1a')](_0x339f56)[_0xefcd('0x1b')](_0x16b313);}};}function respondWithFilteredResult(_0x363478,_0x207853){return function(_0x145f7e){if(_0x145f7e){var _0x4f4f14=typeof _0x207853[_0xefcd('0x1c')]===_0xefcd('0x1d')&&typeof _0x207853[_0xefcd('0x1e')]===_0xefcd('0x1d');var _0x5788b1=_0x145f7e[_0xefcd('0x1f')];var _0x2d195a=_0x4f4f14?0x0:_0x207853[_0xefcd('0x1c')];var _0x5b16cc=_0x4f4f14?_0x145f7e[_0xefcd('0x1f')]:_0x207853[_0xefcd('0x1c')]+_0x207853['limit'];var _0x584c1a;if(_0x5b16cc>=_0x5788b1){_0x5b16cc=_0x5788b1;_0x584c1a=0xc8;}else{_0x584c1a=0xce;}_0x363478['status'](_0x584c1a);return _0x363478[_0xefcd('0x20')](_0xefcd('0x21'),_0x2d195a+'-'+_0x5b16cc+'/'+_0x5788b1)[_0xefcd('0x1b')](_0x145f7e);}return null;};}function patchUpdates(_0x5ad469){return function(_0x1628b9){try{jsonpatch['apply'](_0x1628b9,_0x5ad469,!![]);}catch(_0x200479){return BPromise['reject'](_0x200479);}return _0x1628b9[_0xefcd('0x22')]();};}function saveUpdates(_0x4b6f51,_0x1cdb51){return function(_0x2e1dac){if(_0x2e1dac){return _0x2e1dac[_0xefcd('0x23')](_0x4b6f51)[_0xefcd('0x24')](function(_0x30cb8d){return _0x30cb8d;});}return null;};}function removeEntity(_0x1be437,_0xa3e9a7){return function(_0x8044f2){if(_0x8044f2){return _0x8044f2[_0xefcd('0x25')]()['then'](function(){_0x1be437[_0xefcd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e360f,_0x2ab532){return function(_0x4571bc){if(!_0x4571bc){_0x3e360f['sendStatus'](0x194);}return _0x4571bc;};}function handleError(_0x66302d,_0x5a9f93){_0x5a9f93=_0x5a9f93||0x1f4;return function(_0x29fb53){logger[_0xefcd('0x26')](_0x29fb53['stack']);if(_0x29fb53['name']){delete _0x29fb53[_0xefcd('0x27')];}_0x66302d[_0xefcd('0x1a')](_0x5a9f93)['send'](_0x29fb53);};}exports[_0xefcd('0x28')]=function(_0x3c2fb1,_0x46dc62){var _0x515062={},_0x5899f6={},_0xce3877={'count':0x0,'rows':[]};var _0x2c343a=_[_0xefcd('0x29')](db[_0xefcd('0x2a')][_0xefcd('0x2b')],function(_0x38b4c3){return{'name':_0x38b4c3[_0xefcd('0x2c')],'type':_0x38b4c3[_0xefcd('0x2d')]['key']};});_0x5899f6[_0xefcd('0x2e')]=_[_0xefcd('0x29')](_0x2c343a,_0xefcd('0x27'));_0x5899f6['query']=_[_0xefcd('0x2f')](_0x3c2fb1[_0xefcd('0x30')]);_0x5899f6[_0xefcd('0x31')]=_[_0xefcd('0x32')](_0x5899f6[_0xefcd('0x2e')],_0x5899f6[_0xefcd('0x30')]);_0x515062[_0xefcd('0x33')]=_[_0xefcd('0x32')](_0x5899f6[_0xefcd('0x2e')],qs[_0xefcd('0x34')](_0x3c2fb1[_0xefcd('0x30')]['fields']));_0x515062[_0xefcd('0x33')]=_0x515062[_0xefcd('0x33')][_0xefcd('0x35')]?_0x515062['attributes']:_0x5899f6[_0xefcd('0x2e')];if(!_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x36')](_0xefcd('0x37'))){_0x515062[_0xefcd('0x1e')]=qs[_0xefcd('0x1e')](_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x1e')]);_0x515062[_0xefcd('0x1c')]=qs[_0xefcd('0x1c')](_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x1c')]);}_0x515062[_0xefcd('0x38')]=qs[_0xefcd('0x39')](_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x39')]);_0x515062['where']=qs[_0xefcd('0x31')](_[_0xefcd('0x3a')](_0x3c2fb1[_0xefcd('0x30')],_0x5899f6['filters']),_0x2c343a);if(_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x3b')]){_0x515062[_0xefcd('0x3c')]=_['merge'](_0x515062[_0xefcd('0x3c')],{'$or':_['map'](_0x2c343a,function(_0x41ba51){if(_0x41ba51[_0xefcd('0x2d')]!==_0xefcd('0x3d')){var _0x4b90de={};_0x4b90de[_0x41ba51[_0xefcd('0x27')]]={'$like':'%'+_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x3b')]+'%'};return _0x4b90de;}})});}_0x515062=_[_0xefcd('0x3e')]({},_0x515062,_0x3c2fb1['options']);var _0x26a9ad={'where':_0x515062['where']};return db['SmsQueueReport'][_0xefcd('0x1f')](_0x26a9ad)[_0xefcd('0x24')](function(_0x3f38c2){_0xce3877[_0xefcd('0x1f')]=_0x3f38c2;if(_0x3c2fb1[_0xefcd('0x30')][_0xefcd('0x3f')]){_0x515062[_0xefcd('0x40')]=[{'all':!![]}];}return db[_0xefcd('0x2a')][_0xefcd('0x41')](_0x515062);})['then'](function(_0x30f70f){_0xce3877[_0xefcd('0x42')]=_0x30f70f;return _0xce3877;})[_0xefcd('0x24')](respondWithFilteredResult(_0x46dc62,_0x515062))[_0xefcd('0x43')](handleError(_0x46dc62,null));};exports['show']=function(_0x562ce0,_0x32e350){var _0xeab793={'raw':!![],'where':{'id':_0x562ce0[_0xefcd('0x44')]['id']}},_0x1c4edc={};_0x1c4edc[_0xefcd('0x2e')]=_[_0xefcd('0x2f')](db[_0xefcd('0x2a')]['rawAttributes']);_0x1c4edc[_0xefcd('0x30')]=_['keys'](_0x562ce0[_0xefcd('0x30')]);_0x1c4edc[_0xefcd('0x31')]=_[_0xefcd('0x32')](_0x1c4edc[_0xefcd('0x2e')],_0x1c4edc['query']);_0xeab793[_0xefcd('0x33')]=_[_0xefcd('0x32')](_0x1c4edc[_0xefcd('0x2e')],qs[_0xefcd('0x34')](_0x562ce0[_0xefcd('0x30')]['fields']));_0xeab793['attributes']=_0xeab793['attributes'][_0xefcd('0x35')]?_0xeab793['attributes']:_0x1c4edc[_0xefcd('0x2e')];if(_0x562ce0[_0xefcd('0x30')][_0xefcd('0x3f')]){_0xeab793[_0xefcd('0x40')]=[{'all':!![]}];}_0xeab793=_['merge']({},_0xeab793,_0x562ce0[_0xefcd('0x45')]);return db[_0xefcd('0x2a')][_0xefcd('0x46')](_0xeab793)[_0xefcd('0x24')](handleEntityNotFound(_0x32e350,null))['then'](respondWithResult(_0x32e350,null))[_0xefcd('0x43')](handleError(_0x32e350,null));};exports[_0xefcd('0x47')]=function(_0x5bf59b,_0x43e1fe){return db[_0xefcd('0x2a')][_0xefcd('0x47')](_0x5bf59b[_0xefcd('0x48')],{})[_0xefcd('0x24')](respondWithResult(_0x43e1fe,0xc9))[_0xefcd('0x43')](handleError(_0x43e1fe,null));};exports['update']=function(_0x3ec479,_0x7e8d8d){if(_0x3ec479['body']['id']){delete _0x3ec479[_0xefcd('0x48')]['id'];}return db[_0xefcd('0x2a')][_0xefcd('0x46')]({'where':{'id':_0x3ec479['params']['id']}})[_0xefcd('0x24')](handleEntityNotFound(_0x7e8d8d,null))[_0xefcd('0x24')](saveUpdates(_0x3ec479[_0xefcd('0x48')],null))[_0xefcd('0x24')](respondWithResult(_0x7e8d8d,null))[_0xefcd('0x43')](handleError(_0x7e8d8d,null));};exports[_0xefcd('0x25')]=function(_0x17d9e2,_0x388593){return db[_0xefcd('0x2a')][_0xefcd('0x46')]({'where':{'id':_0x17d9e2['params']['id']}})[_0xefcd('0x24')](handleEntityNotFound(_0x388593,null))[_0xefcd('0x24')](removeEntity(_0x388593,null))[_0xefcd('0x43')](handleError(_0x388593,null));};exports[_0xefcd('0x49')]=function(_0x354b54,_0x478532){return db[_0xefcd('0x2a')][_0xefcd('0x49')]()['then'](respondWithResult(_0x478532,null))[_0xefcd('0x43')](handleError(_0x478532,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 261e1ce..8d766e8 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x48566d,_0x341848){var _0x2675c2=function(_0x8fa552){while(--_0x8fa552){_0x48566d['push'](_0x48566d['shift']());}};_0x2675c2(++_0x341848);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x262eb4,_0x33542c){var _0xf3e236=function(_0x2364c0){while(--_0x2364c0){_0x262eb4['push'](_0x262eb4['shift']());}};_0xf3e236(++_0x33542c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xcb91[_0x1aed80];return _0x43961e;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f43c408..6d39bfc 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 _0x8424=['result','catch','CreateSmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','limit','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0xb8a863,_0x31638c){var _0x349510=function(_0x3e5b80){while(--_0x3e5b80){_0xb8a863['push'](_0xb8a863['shift']());}};_0x349510(++_0x31638c);}(_0x8424,0xbf));var _0x4842=function(_0x2a8237,_0x3ab8b6){_0x2a8237=_0x2a8237-0x0;var _0x1b88f6=_0x8424[_0x2a8237];return _0x1b88f6;};'use strict';var _=require('lodash');var util=require(_0x4842('0x0'));var moment=require(_0x4842('0x1'));var BPromise=require('bluebird');var rs=require(_0x4842('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4842('0x3'))['db'];var utils=require(_0x4842('0x4'));var logger=require(_0x4842('0x5'))(_0x4842('0x6'));var config=require(_0x4842('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4842('0x8')][_0x4842('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e58dd,_0x3943b3,_0x59a19b){return new BPromise(function(_0x151438,_0x16f0bc){return client[_0x4842('0xa')](_0x1e58dd,_0x59a19b)[_0x4842('0xb')](function(_0x25c80f){logger[_0x4842('0xc')](_0x4842('0xd'),_0x3943b3,_0x4842('0xe'));logger[_0x4842('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3943b3,'request\x20sent',JSON[_0x4842('0x10')](_0x25c80f));if(_0x25c80f[_0x4842('0x11')]){if(_0x25c80f[_0x4842('0x11')]['code']===0x1f4){logger[_0x4842('0x11')](_0x4842('0xd'),_0x3943b3,_0x25c80f[_0x4842('0x11')]['message']);return _0x16f0bc(_0x25c80f[_0x4842('0x11')]['message']);}logger[_0x4842('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3943b3,_0x25c80f[_0x4842('0x11')][_0x4842('0x12')]);return _0x151438(_0x25c80f[_0x4842('0x11')]['message']);}else{logger[_0x4842('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x3943b3,'request\x20sent');_0x151438(_0x25c80f[_0x4842('0x13')][_0x4842('0x12')]);}})[_0x4842('0x14')](function(_0x145cc4){logger[_0x4842('0x11')](_0x4842('0xd'),_0x3943b3,_0x145cc4);_0x16f0bc(_0x145cc4);});});}exports[_0x4842('0x15')]=function(_0x19d601){var _0x21ea0b=this;return new Promise(function(_0x2dcbf1,_0x42195f){return db['SmsQueueReport'][_0x4842('0x16')](_0x19d601['body'],{'raw':_0x19d601[_0x4842('0x17')]?_0x19d601[_0x4842('0x17')][_0x4842('0x18')]===undefined?!![]:![]:!![]})[_0x4842('0xb')](function(_0x279b32){logger[_0x4842('0xc')](_0x4842('0x15'),_0x19d601);logger[_0x4842('0xf')]('CreateSmsQueueReport',_0x19d601,JSON[_0x4842('0x10')](_0x279b32));_0x2dcbf1(_0x279b32);})['catch'](function(_0x35896f){logger[_0x4842('0x11')](_0x4842('0x15'),_0x35896f['message'],_0x19d601);_0x42195f(_0x21ea0b['error'](0x1f4,_0x35896f[_0x4842('0x12')]));});});};exports[_0x4842('0x19')]=function(_0x57f16d){var _0x2b3009=this;return new Promise(function(_0x12b72e,_0x5d3f41){return db['SmsQueueReport'][_0x4842('0x1a')](_0x57f16d[_0x4842('0x1b')],{'raw':_0x57f16d['options']?_0x57f16d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57f16d[_0x4842('0x17')]?_0x57f16d[_0x4842('0x17')][_0x4842('0x1c')]||null:null,'attributes':_0x57f16d['options']?_0x57f16d['options']['attributes']||null:null,'limit':_0x57f16d[_0x4842('0x17')]?_0x57f16d[_0x4842('0x17')][_0x4842('0x1d')]||null:null})[_0x4842('0xb')](function(_0x13adb9){logger[_0x4842('0xc')](_0x4842('0x19'),_0x57f16d);logger[_0x4842('0xf')](_0x4842('0x19'),_0x57f16d,JSON[_0x4842('0x10')](_0x13adb9));_0x12b72e(_0x13adb9);})[_0x4842('0x14')](function(_0x1da0b8){logger['error'](_0x4842('0x19'),_0x1da0b8[_0x4842('0x12')],_0x57f16d);_0x5d3f41(_0x2b3009[_0x4842('0x11')](0x1f4,_0x1da0b8[_0x4842('0x12')]));});});}; \ No newline at end of file +var _0x5141=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','update','attributes','limit','util'];(function(_0x29f860,_0xc330b3){var _0x1c865b=function(_0x440ade){while(--_0x440ade){_0x29f860['push'](_0x29f860['shift']());}};_0x1c865b(++_0xc330b3);}(_0x5141,0xa9));var _0x1514=function(_0x866422,_0x4f76cc){_0x866422=_0x866422-0x0;var _0x1d0ff5=_0x5141[_0x866422];return _0x1d0ff5;};'use strict';var _=require('lodash');var util=require(_0x1514('0x0'));var moment=require(_0x1514('0x1'));var BPromise=require(_0x1514('0x2'));var rs=require(_0x1514('0x3'));var fs=require('fs');var Redis=require(_0x1514('0x4'));var db=require(_0x1514('0x5'))['db'];var utils=require(_0x1514('0x6'));var logger=require(_0x1514('0x7'))(_0x1514('0x8'));var config=require(_0x1514('0x9'));var jayson=require(_0x1514('0xa'));var client=jayson['client'][_0x1514('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56cb2a,_0x5b7d1b,_0x3f2f43){return new BPromise(function(_0x331272,_0x2c793c){return client[_0x1514('0xc')](_0x56cb2a,_0x3f2f43)['then'](function(_0x56a5b3){logger['info'](_0x1514('0xd'),_0x5b7d1b,_0x1514('0xe'));logger[_0x1514('0xf')](_0x1514('0x10'),_0x5b7d1b,'request\x20sent',JSON[_0x1514('0x11')](_0x56a5b3));if(_0x56a5b3[_0x1514('0x12')]){if(_0x56a5b3[_0x1514('0x12')][_0x1514('0x13')]===0x1f4){logger[_0x1514('0x12')](_0x1514('0xd'),_0x5b7d1b,_0x56a5b3[_0x1514('0x12')][_0x1514('0x14')]);return _0x2c793c(_0x56a5b3[_0x1514('0x12')]['message']);}logger[_0x1514('0x12')](_0x1514('0xd'),_0x5b7d1b,_0x56a5b3[_0x1514('0x12')]['message']);return _0x331272(_0x56a5b3[_0x1514('0x12')][_0x1514('0x14')]);}else{logger[_0x1514('0x15')](_0x1514('0xd'),_0x5b7d1b,'request\x20sent');_0x331272(_0x56a5b3[_0x1514('0x16')][_0x1514('0x14')]);}})['catch'](function(_0x131c3e){logger[_0x1514('0x12')](_0x1514('0xd'),_0x5b7d1b,_0x131c3e);_0x2c793c(_0x131c3e);});});}exports[_0x1514('0x17')]=function(_0x2371e9){var _0x467e78=this;return new Promise(function(_0x4859f9,_0x2d563f){return db[_0x1514('0x18')][_0x1514('0x19')](_0x2371e9[_0x1514('0x1a')],{'raw':_0x2371e9[_0x1514('0x1b')]?_0x2371e9[_0x1514('0x1b')][_0x1514('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1c33b1){logger[_0x1514('0x15')](_0x1514('0x17'),_0x2371e9);logger[_0x1514('0xf')](_0x1514('0x17'),_0x2371e9,JSON['stringify'](_0x1c33b1));_0x4859f9(_0x1c33b1);})[_0x1514('0x1d')](function(_0x40558e){logger[_0x1514('0x12')](_0x1514('0x17'),_0x40558e[_0x1514('0x14')],_0x2371e9);_0x2d563f(_0x467e78[_0x1514('0x12')](0x1f4,_0x40558e['message']));});});};exports[_0x1514('0x1e')]=function(_0x20a0ff){var _0x5c2f78=this;return new Promise(function(_0x19c7cf,_0x5c140a){return db[_0x1514('0x18')][_0x1514('0x1f')](_0x20a0ff[_0x1514('0x1a')],{'raw':_0x20a0ff[_0x1514('0x1b')]?_0x20a0ff['options'][_0x1514('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20a0ff[_0x1514('0x1b')]?_0x20a0ff[_0x1514('0x1b')]['where']||null:null,'attributes':_0x20a0ff['options']?_0x20a0ff['options'][_0x1514('0x20')]||null:null,'limit':_0x20a0ff[_0x1514('0x1b')]?_0x20a0ff[_0x1514('0x1b')][_0x1514('0x21')]||null:null})['then'](function(_0x454069){logger[_0x1514('0x15')](_0x1514('0x1e'),_0x20a0ff);logger[_0x1514('0xf')](_0x1514('0x1e'),_0x20a0ff,JSON['stringify'](_0x454069));_0x19c7cf(_0x454069);})['catch'](function(_0x4675e4){logger[_0x1514('0x12')](_0x1514('0x1e'),_0x4675e4[_0x1514('0x14')],_0x20a0ff);_0x5c140a(_0x5c2f78[_0x1514('0x12')](0x1f4,_0x4675e4[_0x1514('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2eb6266..a0a88ea 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 _0x6c32=['get','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller'];(function(_0x165752,_0x1654a7){var _0x3a4711=function(_0x1ec088){while(--_0x1ec088){_0x165752['push'](_0x165752['shift']());}};_0x3a4711(++_0x1654a7);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var fs_extra=require(_0x26c3('0x6'));var auth=require(_0x26c3('0x7'));var interaction=require(_0x26c3('0x8'));var config=require('../../config/environment');var controller=require(_0x26c3('0x9'));router[_0x26c3('0xa')]('/',auth[_0x26c3('0xb')](),controller['index']);router[_0x26c3('0xa')]('/describe',auth[_0x26c3('0xb')](),controller[_0x26c3('0xc')]);router[_0x26c3('0xa')](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0xe')]);router[_0x26c3('0xf')]('/',auth[_0x26c3('0xb')](),controller[_0x26c3('0x10')]);router[_0x26c3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0x12')]);module[_0x26c3('0x13')]=router; \ No newline at end of file +var _0xf873=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x3b4dbf,_0x8c68a8){var _0x1857e1=function(_0x40d291){while(--_0x40d291){_0x3b4dbf['push'](_0x3b4dbf['shift']());}};_0x1857e1(++_0x8c68a8);}(_0xf873,0xb2));var _0x3f87=function(_0xd66f8c,_0x18c353){_0xd66f8c=_0xd66f8c-0x0;var _0x21448e=_0xf873[_0xd66f8c];return _0x21448e;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./smsTransferReport.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['show']);router[_0x3f87('0xf')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x11')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x14')]);module[_0x3f87('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c737420..bc7ec45 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4fab7a,_0x56e9bf){var _0x497b82=function(_0x382f4a){while(--_0x382f4a){_0x4fab7a['push'](_0x4fab7a['shift']());}};_0x497b82(++_0x56e9bf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xaa980,_0x2ac0d0){var _0x3ecd8e=function(_0x223d38){while(--_0x223d38){_0xaa980['push'](_0xaa980['shift']());}};_0x3ecd8e(++_0x2ac0d0);}(_0x70e0,0x17b));var _0x070e=function(_0x154c8e,_0x2c598d){_0x154c8e=_0x154c8e-0x0;var _0x2028b7=_0x70e0[_0x154c8e];return _0x2028b7;};'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 7848438..aacb356 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 _0x3370=['VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','merge'];(function(_0x1fc90a,_0x4f847e){var _0x30f4cb=function(_0x329a94){while(--_0x329a94){_0x1fc90a['push'](_0x1fc90a['shift']());}};_0x30f4cb(++_0x4f847e);}(_0x3370,0x190));var _0x0337=function(_0x9e30f9,_0x49f526){_0x9e30f9=_0x9e30f9-0x0;var _0x417ba2=_0x3370[_0x9e30f9];return _0x417ba2;};'use strict';var emlformat=require(_0x0337('0x0'));var rimraf=require(_0x0337('0x1'));var zipdir=require(_0x0337('0x2'));var jsonpatch=require(_0x0337('0x3'));var rp=require(_0x0337('0x4'));var moment=require('moment');var BPromise=require(_0x0337('0x5'));var Mustache=require(_0x0337('0x6'));var util=require('util');var path=require(_0x0337('0x7'));var sox=require(_0x0337('0x8'));var csv=require('to-csv');var ejs=require(_0x0337('0x9'));var fs=require('fs');var fs_extra=require(_0x0337('0xa'));var _=require('lodash');var squel=require(_0x0337('0xb'));var crypto=require(_0x0337('0xc'));var jsforce=require(_0x0337('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0337('0xe'));var querystring=require(_0x0337('0xf'));var Papa=require(_0x0337('0x10'));var Redis=require('ioredis');var authService=require(_0x0337('0x11'));var qs=require(_0x0337('0x12'));var as=require(_0x0337('0x13'));var hardwareService=require(_0x0337('0x14'));var logger=require(_0x0337('0x15'))('api');var utils=require(_0x0337('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0337('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333a4b,_0x4d8976){_0x4d8976=_0x4d8976||0xcc;return function(_0x2a125e){if(_0x2a125e){return _0x333a4b[_0x0337('0x18')](_0x4d8976);}return _0x333a4b[_0x0337('0x19')](_0x4d8976)[_0x0337('0x1a')]();};}function respondWithResult(_0x5e6bad,_0x4e8879){_0x4e8879=_0x4e8879||0xc8;return function(_0x2d8a22){if(_0x2d8a22){return _0x5e6bad[_0x0337('0x19')](_0x4e8879)[_0x0337('0x1b')](_0x2d8a22);}};}function respondWithFilteredResult(_0x1ebed5,_0x59e1f8){return function(_0x2f5f34){if(_0x2f5f34){var _0x187de3=typeof _0x59e1f8[_0x0337('0x1c')]===_0x0337('0x1d')&&typeof _0x59e1f8[_0x0337('0x1e')]===_0x0337('0x1d');var _0x9496=_0x2f5f34[_0x0337('0x1f')];var _0x5ed8c6=_0x187de3?0x0:_0x59e1f8['offset'];var _0x568ab7=_0x187de3?_0x2f5f34[_0x0337('0x1f')]:_0x59e1f8['offset']+_0x59e1f8['limit'];var _0x38bb79;if(_0x568ab7>=_0x9496){_0x568ab7=_0x9496;_0x38bb79=0xc8;}else{_0x38bb79=0xce;}_0x1ebed5[_0x0337('0x19')](_0x38bb79);return _0x1ebed5[_0x0337('0x20')](_0x0337('0x21'),_0x5ed8c6+'-'+_0x568ab7+'/'+_0x9496)[_0x0337('0x1b')](_0x2f5f34);}return null;};}function patchUpdates(_0x27c182){return function(_0x5b3eac){try{jsonpatch['apply'](_0x5b3eac,_0x27c182,!![]);}catch(_0x2fb250){return BPromise[_0x0337('0x22')](_0x2fb250);}return _0x5b3eac[_0x0337('0x23')]();};}function saveUpdates(_0x46d8eb,_0xaed223){return function(_0x593d55){if(_0x593d55){return _0x593d55[_0x0337('0x24')](_0x46d8eb)[_0x0337('0x25')](function(_0x5f11e4){return _0x5f11e4;});}return null;};}function removeEntity(_0x21dd97,_0x103a50){return function(_0x2a0079){if(_0x2a0079){return _0x2a0079['destroy']()[_0x0337('0x25')](function(){_0x21dd97[_0x0337('0x19')](0xcc)[_0x0337('0x1a')]();});}};}function handleEntityNotFound(_0x552fb3,_0x176f65){return function(_0xe6ea90){if(!_0xe6ea90){_0x552fb3[_0x0337('0x18')](0x194);}return _0xe6ea90;};}function handleError(_0x3b027c,_0x304ab0){_0x304ab0=_0x304ab0||0x1f4;return function(_0x3b19e7){logger[_0x0337('0x26')](_0x3b19e7['stack']);if(_0x3b19e7['name']){delete _0x3b19e7[_0x0337('0x27')];}_0x3b027c[_0x0337('0x19')](_0x304ab0)[_0x0337('0x28')](_0x3b19e7);};}exports[_0x0337('0x29')]=function(_0xa666f6,_0x280657){var _0x188d0e={},_0x295405={},_0x1f3ebc={'count':0x0,'rows':[]};var _0x424dc7=_[_0x0337('0x2a')](db[_0x0337('0x2b')][_0x0337('0x2c')],function(_0x7d4bae){return{'name':_0x7d4bae[_0x0337('0x2d')],'type':_0x7d4bae[_0x0337('0x2e')][_0x0337('0x2f')]};});_0x295405['model']=_['map'](_0x424dc7,_0x0337('0x27'));_0x295405[_0x0337('0x30')]=_[_0x0337('0x31')](_0xa666f6['query']);_0x295405[_0x0337('0x32')]=_[_0x0337('0x33')](_0x295405['model'],_0x295405[_0x0337('0x30')]);_0x188d0e['attributes']=_[_0x0337('0x33')](_0x295405['model'],qs[_0x0337('0x34')](_0xa666f6[_0x0337('0x30')][_0x0337('0x34')]));_0x188d0e[_0x0337('0x35')]=_0x188d0e[_0x0337('0x35')][_0x0337('0x36')]?_0x188d0e[_0x0337('0x35')]:_0x295405[_0x0337('0x37')];if(!_0xa666f6[_0x0337('0x30')][_0x0337('0x38')]('nolimit')){_0x188d0e[_0x0337('0x1e')]=qs[_0x0337('0x1e')](_0xa666f6[_0x0337('0x30')][_0x0337('0x1e')]);_0x188d0e[_0x0337('0x1c')]=qs['offset'](_0xa666f6[_0x0337('0x30')]['offset']);}_0x188d0e[_0x0337('0x39')]=qs[_0x0337('0x3a')](_0xa666f6[_0x0337('0x30')][_0x0337('0x3a')]);_0x188d0e[_0x0337('0x3b')]=qs[_0x0337('0x32')](_[_0x0337('0x3c')](_0xa666f6[_0x0337('0x30')],_0x295405['filters']),_0x424dc7);if(_0xa666f6[_0x0337('0x30')]['filter']){_0x188d0e[_0x0337('0x3b')]=_[_0x0337('0x3d')](_0x188d0e['where'],{'$or':_[_0x0337('0x2a')](_0x424dc7,function(_0x2fd204){if(_0x2fd204[_0x0337('0x2e')]!==_0x0337('0x3e')){var _0x5b686f={};_0x5b686f[_0x2fd204['name']]={'$like':'%'+_0xa666f6[_0x0337('0x30')][_0x0337('0x3f')]+'%'};return _0x5b686f;}})});}_0x188d0e=_[_0x0337('0x3d')]({},_0x188d0e,_0xa666f6[_0x0337('0x40')]);var _0x509836={'where':_0x188d0e[_0x0337('0x3b')]};return db[_0x0337('0x2b')][_0x0337('0x1f')](_0x509836)[_0x0337('0x25')](function(_0x2ac97d){_0x1f3ebc['count']=_0x2ac97d;if(_0xa666f6[_0x0337('0x30')]['includeAll']){_0x188d0e[_0x0337('0x41')]=[{'all':!![]}];}return db[_0x0337('0x2b')][_0x0337('0x42')](_0x188d0e);})['then'](function(_0xda4fca){_0x1f3ebc[_0x0337('0x43')]=_0xda4fca;return _0x1f3ebc;})[_0x0337('0x25')](respondWithFilteredResult(_0x280657,_0x188d0e))[_0x0337('0x44')](handleError(_0x280657,null));};exports[_0x0337('0x45')]=function(_0x29936c,_0x213a14){var _0x2aea36={'raw':!![],'where':{'id':_0x29936c['params']['id']}},_0x4487b8={};_0x4487b8['model']=_[_0x0337('0x31')](db[_0x0337('0x2b')]['rawAttributes']);_0x4487b8['query']=_[_0x0337('0x31')](_0x29936c['query']);_0x4487b8[_0x0337('0x32')]=_['intersection'](_0x4487b8['model'],_0x4487b8[_0x0337('0x30')]);_0x2aea36['attributes']=_[_0x0337('0x33')](_0x4487b8[_0x0337('0x37')],qs['fields'](_0x29936c['query'][_0x0337('0x34')]));_0x2aea36[_0x0337('0x35')]=_0x2aea36[_0x0337('0x35')][_0x0337('0x36')]?_0x2aea36[_0x0337('0x35')]:_0x4487b8[_0x0337('0x37')];if(_0x29936c['query'][_0x0337('0x46')]){_0x2aea36[_0x0337('0x41')]=[{'all':!![]}];}_0x2aea36=_[_0x0337('0x3d')]({},_0x2aea36,_0x29936c['options']);return db['SmsTransferReport']['find'](_0x2aea36)[_0x0337('0x25')](handleEntityNotFound(_0x213a14,null))[_0x0337('0x25')](respondWithResult(_0x213a14,null))['catch'](handleError(_0x213a14,null));};exports['create']=function(_0x44598b,_0x151bf9){return db[_0x0337('0x2b')][_0x0337('0x47')](_0x44598b[_0x0337('0x48')],{})[_0x0337('0x25')](respondWithResult(_0x151bf9,0xc9))[_0x0337('0x44')](handleError(_0x151bf9,null));};exports[_0x0337('0x24')]=function(_0x2118fc,_0x5a23d3){if(_0x2118fc[_0x0337('0x48')]['id']){delete _0x2118fc[_0x0337('0x48')]['id'];}return db[_0x0337('0x2b')]['find']({'where':{'id':_0x2118fc[_0x0337('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a23d3,null))[_0x0337('0x25')](saveUpdates(_0x2118fc[_0x0337('0x48')],null))[_0x0337('0x25')](respondWithResult(_0x5a23d3,null))['catch'](handleError(_0x5a23d3,null));};exports[_0x0337('0x4a')]=function(_0x4b906e,_0x112626){return db[_0x0337('0x2b')][_0x0337('0x4b')]({'where':{'id':_0x4b906e[_0x0337('0x49')]['id']}})[_0x0337('0x25')](handleEntityNotFound(_0x112626,null))['then'](removeEntity(_0x112626,null))['catch'](handleError(_0x112626,null));};exports[_0x0337('0x4c')]=function(_0x733e0c,_0x22fa06){return db[_0x0337('0x2b')][_0x0337('0x4c')]()[_0x0337('0x25')](respondWithResult(_0x22fa06,null))[_0x0337('0x44')](handleError(_0x22fa06,null));}; \ No newline at end of file +var _0x474f=['fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','rows','catch','show','params','includeAll','include','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x474f,0x11a));var _0xf474=function(_0x52eac3,_0x36e4d7){_0x52eac3=_0x52eac3-0x0;var _0x5030b2=_0x474f[_0x52eac3];return _0x5030b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf474('0x0'));var zipdir=require(_0xf474('0x1'));var jsonpatch=require(_0xf474('0x2'));var rp=require(_0xf474('0x3'));var moment=require(_0xf474('0x4'));var BPromise=require(_0xf474('0x5'));var Mustache=require(_0xf474('0x6'));var util=require('util');var path=require(_0xf474('0x7'));var sox=require(_0xf474('0x8'));var csv=require(_0xf474('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf474('0xa'));var _=require('lodash');var squel=require(_0xf474('0xb'));var crypto=require('crypto');var jsforce=require(_0xf474('0xc'));var deskjs=require(_0xf474('0xd'));var toCsv=require(_0xf474('0x9'));var querystring=require(_0xf474('0xe'));var Papa=require(_0xf474('0xf'));var Redis=require(_0xf474('0x10'));var authService=require(_0xf474('0x11'));var qs=require(_0xf474('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf474('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf474('0x14'));var licenseUtil=require(_0xf474('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4af10d,_0x55aab4){_0x55aab4=_0x55aab4||0xcc;return function(_0x24cc9a){if(_0x24cc9a){return _0x4af10d[_0xf474('0x16')](_0x55aab4);}return _0x4af10d['status'](_0x55aab4)[_0xf474('0x17')]();};}function respondWithResult(_0x246467,_0x41b873){_0x41b873=_0x41b873||0xc8;return function(_0x19a84f){if(_0x19a84f){return _0x246467[_0xf474('0x18')](_0x41b873)[_0xf474('0x19')](_0x19a84f);}};}function respondWithFilteredResult(_0x5ce445,_0x4c87ce){return function(_0x45152b){if(_0x45152b){var _0x399d90=typeof _0x4c87ce[_0xf474('0x1a')]===_0xf474('0x1b')&&typeof _0x4c87ce['limit']===_0xf474('0x1b');var _0x192345=_0x45152b[_0xf474('0x1c')];var _0x1f901a=_0x399d90?0x0:_0x4c87ce['offset'];var _0x4b31a4=_0x399d90?_0x45152b['count']:_0x4c87ce[_0xf474('0x1a')]+_0x4c87ce[_0xf474('0x1d')];var _0x113934;if(_0x4b31a4>=_0x192345){_0x4b31a4=_0x192345;_0x113934=0xc8;}else{_0x113934=0xce;}_0x5ce445[_0xf474('0x18')](_0x113934);return _0x5ce445[_0xf474('0x1e')](_0xf474('0x1f'),_0x1f901a+'-'+_0x4b31a4+'/'+_0x192345)[_0xf474('0x19')](_0x45152b);}return null;};}function patchUpdates(_0x31fe05){return function(_0x1c22e4){try{jsonpatch[_0xf474('0x20')](_0x1c22e4,_0x31fe05,!![]);}catch(_0x174e98){return BPromise['reject'](_0x174e98);}return _0x1c22e4[_0xf474('0x21')]();};}function saveUpdates(_0x258519,_0xb98234){return function(_0x237b9d){if(_0x237b9d){return _0x237b9d['update'](_0x258519)[_0xf474('0x22')](function(_0x11e4b5){return _0x11e4b5;});}return null;};}function removeEntity(_0x2799aa,_0x24f46e){return function(_0x4f1490){if(_0x4f1490){return _0x4f1490['destroy']()['then'](function(){_0x2799aa[_0xf474('0x18')](0xcc)[_0xf474('0x17')]();});}};}function handleEntityNotFound(_0x5df457,_0x48286f){return function(_0x3eac34){if(!_0x3eac34){_0x5df457[_0xf474('0x16')](0x194);}return _0x3eac34;};}function handleError(_0x1f474d,_0x509f73){_0x509f73=_0x509f73||0x1f4;return function(_0x3db316){logger[_0xf474('0x23')](_0x3db316[_0xf474('0x24')]);if(_0x3db316['name']){delete _0x3db316['name'];}_0x1f474d[_0xf474('0x18')](_0x509f73)['send'](_0x3db316);};}exports[_0xf474('0x25')]=function(_0x28f498,_0x14286b){var _0x300ad4={},_0x43ece0={},_0x6f38a3={'count':0x0,'rows':[]};var _0x3eb14c=_[_0xf474('0x26')](db['SmsTransferReport'][_0xf474('0x27')],function(_0x458f7f){return{'name':_0x458f7f[_0xf474('0x28')],'type':_0x458f7f[_0xf474('0x29')][_0xf474('0x2a')]};});_0x43ece0[_0xf474('0x2b')]=_[_0xf474('0x26')](_0x3eb14c,_0xf474('0x2c'));_0x43ece0[_0xf474('0x2d')]=_[_0xf474('0x2e')](_0x28f498[_0xf474('0x2d')]);_0x43ece0['filters']=_[_0xf474('0x2f')](_0x43ece0[_0xf474('0x2b')],_0x43ece0[_0xf474('0x2d')]);_0x300ad4[_0xf474('0x30')]=_[_0xf474('0x2f')](_0x43ece0[_0xf474('0x2b')],qs[_0xf474('0x31')](_0x28f498[_0xf474('0x2d')][_0xf474('0x31')]));_0x300ad4[_0xf474('0x30')]=_0x300ad4['attributes']['length']?_0x300ad4['attributes']:_0x43ece0[_0xf474('0x2b')];if(!_0x28f498[_0xf474('0x2d')][_0xf474('0x32')]('nolimit')){_0x300ad4[_0xf474('0x1d')]=qs[_0xf474('0x1d')](_0x28f498[_0xf474('0x2d')][_0xf474('0x1d')]);_0x300ad4[_0xf474('0x1a')]=qs[_0xf474('0x1a')](_0x28f498[_0xf474('0x2d')][_0xf474('0x1a')]);}_0x300ad4[_0xf474('0x33')]=qs[_0xf474('0x34')](_0x28f498['query'][_0xf474('0x34')]);_0x300ad4[_0xf474('0x35')]=qs[_0xf474('0x36')](_[_0xf474('0x37')](_0x28f498[_0xf474('0x2d')],_0x43ece0[_0xf474('0x36')]),_0x3eb14c);if(_0x28f498[_0xf474('0x2d')][_0xf474('0x38')]){_0x300ad4['where']=_[_0xf474('0x39')](_0x300ad4['where'],{'$or':_[_0xf474('0x26')](_0x3eb14c,function(_0x4917d6){if(_0x4917d6[_0xf474('0x29')]!==_0xf474('0x3a')){var _0x1cbda0={};_0x1cbda0[_0x4917d6['name']]={'$like':'%'+_0x28f498[_0xf474('0x2d')][_0xf474('0x38')]+'%'};return _0x1cbda0;}})});}_0x300ad4=_[_0xf474('0x39')]({},_0x300ad4,_0x28f498[_0xf474('0x3b')]);var _0x35e231={'where':_0x300ad4[_0xf474('0x35')]};return db[_0xf474('0x3c')][_0xf474('0x1c')](_0x35e231)[_0xf474('0x22')](function(_0x5e6010){_0x6f38a3[_0xf474('0x1c')]=_0x5e6010;if(_0x28f498[_0xf474('0x2d')]['includeAll']){_0x300ad4['include']=[{'all':!![]}];}return db[_0xf474('0x3c')]['findAll'](_0x300ad4);})[_0xf474('0x22')](function(_0x2b2e3f){_0x6f38a3[_0xf474('0x3d')]=_0x2b2e3f;return _0x6f38a3;})[_0xf474('0x22')](respondWithFilteredResult(_0x14286b,_0x300ad4))[_0xf474('0x3e')](handleError(_0x14286b,null));};exports[_0xf474('0x3f')]=function(_0x2541ee,_0xe747e1){var _0xcd590={'raw':!![],'where':{'id':_0x2541ee[_0xf474('0x40')]['id']}},_0x2ed765={};_0x2ed765[_0xf474('0x2b')]=_[_0xf474('0x2e')](db[_0xf474('0x3c')][_0xf474('0x27')]);_0x2ed765[_0xf474('0x2d')]=_[_0xf474('0x2e')](_0x2541ee[_0xf474('0x2d')]);_0x2ed765[_0xf474('0x36')]=_['intersection'](_0x2ed765[_0xf474('0x2b')],_0x2ed765[_0xf474('0x2d')]);_0xcd590[_0xf474('0x30')]=_[_0xf474('0x2f')](_0x2ed765[_0xf474('0x2b')],qs[_0xf474('0x31')](_0x2541ee[_0xf474('0x2d')][_0xf474('0x31')]));_0xcd590[_0xf474('0x30')]=_0xcd590[_0xf474('0x30')]['length']?_0xcd590[_0xf474('0x30')]:_0x2ed765[_0xf474('0x2b')];if(_0x2541ee[_0xf474('0x2d')][_0xf474('0x41')]){_0xcd590[_0xf474('0x42')]=[{'all':!![]}];}_0xcd590=_[_0xf474('0x39')]({},_0xcd590,_0x2541ee[_0xf474('0x3b')]);return db[_0xf474('0x3c')][_0xf474('0x43')](_0xcd590)[_0xf474('0x22')](handleEntityNotFound(_0xe747e1,null))[_0xf474('0x22')](respondWithResult(_0xe747e1,null))[_0xf474('0x3e')](handleError(_0xe747e1,null));};exports[_0xf474('0x44')]=function(_0x337346,_0x5ef534){return db[_0xf474('0x3c')][_0xf474('0x44')](_0x337346[_0xf474('0x45')],{})[_0xf474('0x22')](respondWithResult(_0x5ef534,0xc9))[_0xf474('0x3e')](handleError(_0x5ef534,null));};exports[_0xf474('0x46')]=function(_0x4821af,_0x430c87){if(_0x4821af['body']['id']){delete _0x4821af[_0xf474('0x45')]['id'];}return db['SmsTransferReport'][_0xf474('0x43')]({'where':{'id':_0x4821af[_0xf474('0x40')]['id']}})[_0xf474('0x22')](handleEntityNotFound(_0x430c87,null))['then'](saveUpdates(_0x4821af[_0xf474('0x45')],null))[_0xf474('0x22')](respondWithResult(_0x430c87,null))['catch'](handleError(_0x430c87,null));};exports[_0xf474('0x47')]=function(_0xbbdb9b,_0xf9cb8e){return db[_0xf474('0x3c')][_0xf474('0x43')]({'where':{'id':_0xbbdb9b['params']['id']}})[_0xf474('0x22')](handleEntityNotFound(_0xf9cb8e,null))[_0xf474('0x22')](removeEntity(_0xf9cb8e,null))['catch'](handleError(_0xf9cb8e,null));};exports[_0xf474('0x48')]=function(_0x27176e,_0xc6a64d){return db[_0xf474('0x3c')][_0xf474('0x48')]()[_0xf474('0x22')](respondWithResult(_0xc6a64d,null))[_0xf474('0x3e')](handleError(_0xc6a64d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d2e813c..c9d501e 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 _0x13c6=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x13c6,0x94));var _0x613c=function(_0x45d2ed,_0x36b864){_0x45d2ed=_0x45d2ed-0x0;var _0x126138=_0x13c6[_0x45d2ed];return _0x126138;};'use strict';var _=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var logger=require(_0x613c('0x2'))(_0x613c('0x3'));var moment=require(_0x613c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x613c('0x5'));var rimraf=require('rimraf');var config=require(_0x613c('0x6'));var attributes=require(_0x613c('0x7'));module['exports']=function(_0x1b1cc6,_0x56e0cb){return _0x1b1cc6[_0x613c('0x8')](_0x613c('0x9'),attributes,{'tableName':_0x613c('0xa'),'paranoid':![],'indexes':[{'name':_0x613c('0xb'),'fields':[_0x613c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba92=['path','../../config/environment','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xeb2fcd,_0x5aa4c1){var _0x1031cd=function(_0x23f104){while(--_0x23f104){_0xeb2fcd['push'](_0xeb2fcd['shift']());}};_0x1031cd(++_0x5aa4c1);}(_0xba92,0xe9));var _0x2ba9=function(_0x3e3988,_0x352afb){_0x3e3988=_0x3e3988-0x0;var _0xbb372=_0xba92[_0x3e3988];return _0xbb372;};'use strict';var _=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var logger=require(_0x2ba9('0x2'))(_0x2ba9('0x3'));var moment=require(_0x2ba9('0x4'));var BPromise=require(_0x2ba9('0x5'));var rp=require(_0x2ba9('0x6'));var fs=require('fs');var path=require(_0x2ba9('0x7'));var rimraf=require('rimraf');var config=require(_0x2ba9('0x8'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x5bc34,_0xd24a0b){return _0x5bc34[_0x2ba9('0x9')](_0x2ba9('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x2ba9('0xb'),'fields':[_0x2ba9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ada7f4f..1a77533 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 _0x0689=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x3e4bdd,_0x587f24){var _0x2f060b=function(_0x744d50){while(--_0x744d50){_0x3e4bdd['push'](_0x3e4bdd['shift']());}};_0x2f060b(++_0x587f24);}(_0x0689,0x161));var _0x9068=function(_0x1a50e5,_0x14accb){_0x1a50e5=_0x1a50e5-0x0;var _0x53b463=_0x0689[_0x1a50e5];return _0x53b463;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require('moment');var BPromise=require(_0x9068('0x1'));var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var jayson=require(_0x9068('0x9'));var client=jayson[_0x9068('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb67,_0x5c833f,_0x4bdd1b){return new BPromise(function(_0x17bc63,_0x184746){return client[_0x9068('0xb')](_0x34cb67,_0x4bdd1b)[_0x9068('0xc')](function(_0x1c63d2){logger[_0x9068('0xd')](_0x9068('0xe'),_0x5c833f,_0x9068('0xf'));logger[_0x9068('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'),JSON[_0x9068('0x11')](_0x1c63d2));if(_0x1c63d2[_0x9068('0x12')]){if(_0x1c63d2[_0x9068('0x12')]['code']===0x1f4){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x1c63d2[_0x9068('0x12')]['message']);return _0x184746(_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);}logger[_0x9068('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x5c833f,_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);return _0x17bc63(_0x1c63d2['error'][_0x9068('0x13')]);}else{logger[_0x9068('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'));_0x17bc63(_0x1c63d2[_0x9068('0x14')][_0x9068('0x13')]);}})[_0x9068('0x15')](function(_0x576b34){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x576b34);_0x184746(_0x576b34);});});} \ No newline at end of file +var _0xae53=['../../config/environment','client','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e6ba7,_0x258387){var _0x32086b=function(_0x58fa17){while(--_0x58fa17){_0x2e6ba7['push'](_0x2e6ba7['shift']());}};_0x32086b(++_0x258387);}(_0xae53,0x16e));var _0x3ae5=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xae53[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x3ae5('0x0'));var util=require('util');var moment=require(_0x3ae5('0x1'));var BPromise=require(_0x3ae5('0x2'));var rs=require(_0x3ae5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ae5('0x4'))['db'];var utils=require(_0x3ae5('0x5'));var logger=require(_0x3ae5('0x6'))(_0x3ae5('0x7'));var config=require(_0x3ae5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ae5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2664cd,_0x2205f7,_0x29174e){return new BPromise(function(_0x3fdf89,_0x246603){return client[_0x3ae5('0xa')](_0x2664cd,_0x29174e)[_0x3ae5('0xb')](function(_0x223594){logger['info'](_0x3ae5('0xc'),_0x2205f7,'request\x20sent');logger[_0x3ae5('0xd')](_0x3ae5('0xe'),_0x2205f7,_0x3ae5('0xf'),JSON[_0x3ae5('0x10')](_0x223594));if(_0x223594[_0x3ae5('0x11')]){if(_0x223594['error'][_0x3ae5('0x12')]===0x1f4){logger[_0x3ae5('0x11')](_0x3ae5('0xc'),_0x2205f7,_0x223594['error']['message']);return _0x246603(_0x223594[_0x3ae5('0x11')]['message']);}logger[_0x3ae5('0x11')](_0x3ae5('0xc'),_0x2205f7,_0x223594[_0x3ae5('0x11')][_0x3ae5('0x13')]);return _0x3fdf89(_0x223594[_0x3ae5('0x11')]['message']);}else{logger[_0x3ae5('0x14')](_0x3ae5('0xc'),_0x2205f7,_0x3ae5('0xf'));_0x3fdf89(_0x223594['result']['message']);}})[_0x3ae5('0x15')](function(_0x1e5e0b){logger[_0x3ae5('0x11')](_0x3ae5('0xc'),_0x2205f7,_0x1e5e0b);_0x246603(_0x1e5e0b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 239178e..69ce1dd 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 _0x5bbf=['extname','post','single','file','create','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','show','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','basename'];(function(_0x280587,_0x4e9971){var _0x3b7543=function(_0x1e94de){while(--_0x1e94de){_0x280587['push'](_0x280587['shift']());}};_0x3b7543(++_0x4e9971);}(_0x5bbf,0x10a));var _0xf5bb=function(_0xd0a0ae,_0x239a61){_0xd0a0ae=_0xd0a0ae-0x0;var _0x4da1a4=_0x5bbf[_0xd0a0ae];return _0x4da1a4;};'use strict';var multer=require(_0xf5bb('0x0'));var util=require(_0xf5bb('0x1'));var path=require(_0xf5bb('0x2'));var timeout=require(_0xf5bb('0x3'));var express=require(_0xf5bb('0x4'));var router=express[_0xf5bb('0x5')]();var fs_extra=require(_0xf5bb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf5bb('0x7'));var config=require(_0xf5bb('0x8'));var controller=require(_0xf5bb('0x9'));router[_0xf5bb('0xa')]('/',auth['isAuthenticated'](),controller[_0xf5bb('0xb')]);router[_0xf5bb('0xa')](_0xf5bb('0xc'),auth['isAuthenticated'](),controller[_0xf5bb('0xd')]);router[_0xf5bb('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xf5bb('0xe')]);var upload=multer({'storage':multer[_0xf5bb('0xf')]({'destination':function(_0x22ece1,_0xccc099,_0x47dad8){_0x47dad8(null,path['join'](config[_0xf5bb('0x10')],_0xf5bb('0x11')));},'filename':function(_0x2453f2,_0x1eb8d4,_0x255082){_0x1eb8d4[_0xf5bb('0x12')]=_0x1eb8d4['originalname'][_0xf5bb('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x255082(null,util[_0xf5bb('0x14')]('%s-%s%s',path[_0xf5bb('0x15')](_0x1eb8d4[_0xf5bb('0x12')],path[_0xf5bb('0x16')](_0x1eb8d4['originalname'])),Date['now'](),path[_0xf5bb('0x16')](_0x1eb8d4[_0xf5bb('0x12')])));}})});router[_0xf5bb('0x17')]('/',upload[_0xf5bb('0x18')](_0xf5bb('0x19')),controller[_0xf5bb('0x1a')]);router[_0xf5bb('0x1b')](_0xf5bb('0xc'),auth[_0xf5bb('0x1c')](),controller[_0xf5bb('0x1d')]);router[_0xf5bb('0x1e')](_0xf5bb('0xc'),auth[_0xf5bb('0x1c')](),controller['delete']);module[_0xf5bb('0x1f')]=router; \ No newline at end of file +var _0x53ae=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','diskStorage','root','format','%s-%s%s','originalname','extname','post','single','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x3a944a,_0x516e0c){var _0x22f682=function(_0x3c7136){while(--_0x3c7136){_0x3a944a['push'](_0x3a944a['shift']());}};_0x22f682(++_0x516e0c);}(_0x53ae,0xab));var _0xe53a=function(_0x4b8211,_0x49b6ce){_0x4b8211=_0x4b8211-0x0;var _0x3b5f80=_0x53ae[_0x4b8211];return _0x3b5f80;};'use strict';var multer=require(_0xe53a('0x0'));var util=require('util');var path=require(_0xe53a('0x1'));var timeout=require(_0xe53a('0x2'));var express=require(_0xe53a('0x3'));var router=express[_0xe53a('0x4')]();var fs_extra=require(_0xe53a('0x5'));var auth=require(_0xe53a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe53a('0x7'));var controller=require(_0xe53a('0x8'));router[_0xe53a('0x9')]('/',auth[_0xe53a('0xa')](),controller[_0xe53a('0xb')]);router[_0xe53a('0x9')]('/:id',auth[_0xe53a('0xa')](),controller[_0xe53a('0xc')]);router[_0xe53a('0x9')](_0xe53a('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe53a('0xe')]({'destination':function(_0x136bad,_0x5f2ee1,_0x599ff5){_0x599ff5(null,path['join'](config[_0xe53a('0xf')],'server/files/sounds/original/'));},'filename':function(_0x58773d,_0x403b13,_0x1a5748){_0x403b13['originalname']=_0x403b13['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a5748(null,util[_0xe53a('0x10')](_0xe53a('0x11'),path['basename'](_0x403b13[_0xe53a('0x12')],path[_0xe53a('0x13')](_0x403b13[_0xe53a('0x12')])),Date['now'](),path[_0xe53a('0x13')](_0x403b13[_0xe53a('0x12')])));}})});router[_0xe53a('0x14')]('/',upload[_0xe53a('0x15')](_0xe53a('0x16')),controller[_0xe53a('0x17')]);router[_0xe53a('0x18')](_0xe53a('0x19'),auth['isAuthenticated'](),controller[_0xe53a('0x1a')]);router['delete'](_0xe53a('0x19'),auth[_0xe53a('0xa')](),controller[_0xe53a('0x1b')]);module[_0xe53a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e5e9fda..a4a7d28 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 _0x9335=['FLOAT','BIGINT','INTEGER','sequelize','exports','name','STRING'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x9335,0xab));var _0x5933=function(_0x1f032e,_0x4daca7){_0x1f032e=_0x1f032e-0x0;var _0x32615d=_0x9335[_0x1f032e];return _0x32615d;};'use strict';var Sequelize=require(_0x5933('0x0'));module[_0x5933('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5933('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5933('0x3')]},'display_name':{'type':Sequelize[_0x5933('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x5933('0x3')]},'original_format':{'type':Sequelize[_0x5933('0x3')]},'original_duration':{'type':Sequelize[_0x5933('0x4')]},'original_sampleCount':{'type':Sequelize[_0x5933('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x5933('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x5933('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x5933('0x5')]},'converted_channelCount':{'type':Sequelize[_0x5933('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x5933('0x6')]}}; \ No newline at end of file +var _0x3d74=['FLOAT','INTEGER','sequelize','STRING','name','BIGINT'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x3d74,0x1e8));var _0x43d7=function(_0x2d849c,_0x4523bb){_0x2d849c=_0x2d849c-0x0;var _0x5287b2=_0x3d74[_0x2d849c];return _0x5287b2;};'use strict';var Sequelize=require(_0x43d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43d7('0x1')],'unique':_0x43d7('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x43d7('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x43d7('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x43d7('0x1')]},'converted_duration':{'type':Sequelize[_0x43d7('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x43d7('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x43d7('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x43d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9f7ca30..d785ce6 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 _0xfd4f=['start','update','description','delete','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','then','get','Sounds','destroy','error','stack','name','send','index','Sound','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','download','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','catch','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xfd4f,0xf4));var _0xffd4=function(_0x4599e0,_0x21fd43){_0x4599e0=_0x4599e0-0x0;var _0x50c171=_0xfd4f[_0x4599e0];return _0x50c171;};'use strict';var emlformat=require(_0xffd4('0x0'));var rimraf=require(_0xffd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xffd4('0x3'));var Mustache=require(_0xffd4('0x4'));var util=require(_0xffd4('0x5'));var path=require('path');var sox=require(_0xffd4('0x6'));var csv=require(_0xffd4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffd4('0x8'));var _=require('lodash');var squel=require(_0xffd4('0x9'));var crypto=require(_0xffd4('0xa'));var jsforce=require(_0xffd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xffd4('0x7'));var querystring=require(_0xffd4('0xc'));var Papa=require(_0xffd4('0xd'));var Redis=require(_0xffd4('0xe'));var authService=require(_0xffd4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xffd4('0x10'));var hardwareService=require(_0xffd4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xffd4('0x12'));var config=require(_0xffd4('0x13'));var licenseUtil=require(_0xffd4('0x14'));var db=require(_0xffd4('0x15'))['db'];function respondWithStatusCode(_0x48b870,_0x1e74ef){_0x1e74ef=_0x1e74ef||0xcc;return function(_0x4b3e25){if(_0x4b3e25){return _0x48b870[_0xffd4('0x16')](_0x1e74ef);}return _0x48b870[_0xffd4('0x17')](_0x1e74ef)[_0xffd4('0x18')]();};}function respondWithResult(_0x217535,_0x4dbca2){_0x4dbca2=_0x4dbca2||0xc8;return function(_0x4a3f52){if(_0x4a3f52){return _0x217535[_0xffd4('0x17')](_0x4dbca2)['json'](_0x4a3f52);}};}function respondWithFilteredResult(_0x1fbe0f,_0x19c143){return function(_0x379de6){if(_0x379de6){var _0x1b333f=typeof _0x19c143[_0xffd4('0x19')]===_0xffd4('0x1a')&&typeof _0x19c143[_0xffd4('0x1b')]===_0xffd4('0x1a');var _0x2b307f=_0x379de6[_0xffd4('0x1c')];var _0x5e1c6c=_0x1b333f?0x0:_0x19c143[_0xffd4('0x19')];var _0x3dcbe0=_0x1b333f?_0x379de6['count']:_0x19c143['offset']+_0x19c143[_0xffd4('0x1b')];var _0x110fab;if(_0x3dcbe0>=_0x2b307f){_0x3dcbe0=_0x2b307f;_0x110fab=0xc8;}else{_0x110fab=0xce;}_0x1fbe0f[_0xffd4('0x17')](_0x110fab);return _0x1fbe0f[_0xffd4('0x1d')]('Content-Range',_0x5e1c6c+'-'+_0x3dcbe0+'/'+_0x2b307f)['json'](_0x379de6);}return null;};}function patchUpdates(_0x253b5d){return function(_0x2f7caa){try{jsonpatch[_0xffd4('0x1e')](_0x2f7caa,_0x253b5d,!![]);}catch(_0x15a73b){return BPromise[_0xffd4('0x1f')](_0x15a73b);}return _0x2f7caa[_0xffd4('0x20')]();};}function saveUpdates(_0x395652,_0x1c6d87){return function(_0x5825e6){if(_0x5825e6){return _0x5825e6['update'](_0x395652)[_0xffd4('0x21')](function(_0x423c5b){return _0x423c5b;});}return null;};}function removeEntity(_0x5edc4f,_0x361910){return function(_0x35ea54){if(_0x35ea54){return _0x35ea54['destroy']()[_0xffd4('0x21')](function(){var _0x1d5ba5=_0x35ea54[_0xffd4('0x22')]({'plain':!![]});var _0x30fbfb=_0xffd4('0x23');return db['UserProfileResource'][_0xffd4('0x24')]({'where':{'type':_0x30fbfb,'resourceId':_0x1d5ba5['id']}})[_0xffd4('0x21')](function(){return _0x35ea54;});})[_0xffd4('0x21')](function(){_0x5edc4f[_0xffd4('0x17')](0xcc)[_0xffd4('0x18')]();});}};}function handleEntityNotFound(_0x64b455,_0x315961){return function(_0x27c69a){if(!_0x27c69a){_0x64b455[_0xffd4('0x16')](0x194);}return _0x27c69a;};}function handleError(_0x48aa84,_0x2447f4){_0x2447f4=_0x2447f4||0x1f4;return function(_0x4cb4bb){logger[_0xffd4('0x25')](_0x4cb4bb[_0xffd4('0x26')]);if(_0x4cb4bb[_0xffd4('0x27')]){delete _0x4cb4bb['name'];}_0x48aa84[_0xffd4('0x17')](_0x2447f4)[_0xffd4('0x28')](_0x4cb4bb);};}exports[_0xffd4('0x29')]=function(_0x315ab7,_0x410843){var _0x55f1d={},_0x2f8990={},_0x1f50a6={'count':0x0,'rows':[]};var _0xad50a=_['map'](db[_0xffd4('0x2a')][_0xffd4('0x2b')],function(_0x510244){return{'name':_0x510244['fieldName'],'type':_0x510244['type'][_0xffd4('0x2c')]};});_0x2f8990[_0xffd4('0x2d')]=_[_0xffd4('0x2e')](_0xad50a,_0xffd4('0x27'));_0x2f8990[_0xffd4('0x2f')]=_['keys'](_0x315ab7[_0xffd4('0x2f')]);_0x2f8990[_0xffd4('0x30')]=_[_0xffd4('0x31')](_0x2f8990[_0xffd4('0x2d')],_0x2f8990['query']);_0x55f1d['attributes']=_['intersection'](_0x2f8990['model'],qs['fields'](_0x315ab7['query'][_0xffd4('0x32')]));_0x55f1d[_0xffd4('0x33')]=_0x55f1d[_0xffd4('0x33')][_0xffd4('0x34')]?_0x55f1d[_0xffd4('0x33')]:_0x2f8990[_0xffd4('0x2d')];if(!_0x315ab7['query'][_0xffd4('0x35')]('nolimit')){_0x55f1d[_0xffd4('0x1b')]=qs[_0xffd4('0x1b')](_0x315ab7[_0xffd4('0x2f')]['limit']);_0x55f1d[_0xffd4('0x19')]=qs['offset'](_0x315ab7[_0xffd4('0x2f')][_0xffd4('0x19')]);}_0x55f1d[_0xffd4('0x36')]=qs[_0xffd4('0x37')](_0x315ab7[_0xffd4('0x2f')][_0xffd4('0x37')]);_0x55f1d['where']=qs[_0xffd4('0x30')](_[_0xffd4('0x38')](_0x315ab7[_0xffd4('0x2f')],_0x2f8990['filters']),_0xad50a);if(_0x315ab7[_0xffd4('0x2f')][_0xffd4('0x39')]){_0x55f1d[_0xffd4('0x3a')]=_[_0xffd4('0x3b')](_0x55f1d[_0xffd4('0x3a')],{'$or':_['map'](_0xad50a,function(_0x1df5fb){if(_0x1df5fb[_0xffd4('0x3c')]!==_0xffd4('0x3d')){var _0x2c4b58={};_0x2c4b58[_0x1df5fb[_0xffd4('0x27')]]={'$like':'%'+_0x315ab7['query'][_0xffd4('0x39')]+'%'};return _0x2c4b58;}})});}_0x55f1d=_['merge']({},_0x55f1d,_0x315ab7['options']);var _0x532653={'where':_0x55f1d[_0xffd4('0x3a')]};return db[_0xffd4('0x2a')][_0xffd4('0x1c')](_0x532653)[_0xffd4('0x21')](function(_0x5becc0){_0x1f50a6['count']=_0x5becc0;if(_0x315ab7['query'][_0xffd4('0x3e')]){_0x55f1d[_0xffd4('0x3f')]=[{'all':!![]}];}return db[_0xffd4('0x2a')][_0xffd4('0x40')](_0x55f1d);})['then'](function(_0x2e861b){_0x1f50a6[_0xffd4('0x41')]=_0x2e861b;return _0x1f50a6;})[_0xffd4('0x21')](respondWithFilteredResult(_0x410843,_0x55f1d))['catch'](handleError(_0x410843,null));};exports[_0xffd4('0x42')]=function(_0x2a8c7f,_0x537d11){var _0x504828={'raw':!![],'where':{'id':_0x2a8c7f[_0xffd4('0x43')]['id']}},_0x286b2f={};_0x286b2f[_0xffd4('0x2d')]=_[_0xffd4('0x44')](db[_0xffd4('0x2a')][_0xffd4('0x2b')]);_0x286b2f[_0xffd4('0x2f')]=_[_0xffd4('0x44')](_0x2a8c7f['query']);_0x286b2f['filters']=_[_0xffd4('0x31')](_0x286b2f[_0xffd4('0x2d')],_0x286b2f[_0xffd4('0x2f')]);_0x504828[_0xffd4('0x33')]=_['intersection'](_0x286b2f['model'],qs[_0xffd4('0x32')](_0x2a8c7f[_0xffd4('0x2f')][_0xffd4('0x32')]));_0x504828[_0xffd4('0x33')]=_0x504828[_0xffd4('0x33')][_0xffd4('0x34')]?_0x504828[_0xffd4('0x33')]:_0x286b2f[_0xffd4('0x2d')];if(_0x2a8c7f[_0xffd4('0x2f')]['includeAll']){_0x504828['include']=[{'all':!![]}];}_0x504828=_[_0xffd4('0x3b')]({},_0x504828,_0x2a8c7f[_0xffd4('0x45')]);return db['Sound']['find'](_0x504828)[_0xffd4('0x21')](handleEntityNotFound(_0x537d11,null))[_0xffd4('0x21')](respondWithResult(_0x537d11,null))['catch'](handleError(_0x537d11,null));};exports[_0xffd4('0x46')]=function(_0x2b18c7,_0x3b7035,_0x4f3688){return db[_0xffd4('0x2a')][_0xffd4('0x47')]({'where':{'id':_0x2b18c7[_0xffd4('0x43')]['id']},'attributes':[_0xffd4('0x27'),_0xffd4('0x48'),_0xffd4('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7035,null))[_0xffd4('0x21')](function(_0x270a04){if(_0x270a04){if(!fs['existsSync'](path[_0xffd4('0x4a')](config[_0xffd4('0x4b')],_0xffd4('0x4c'),_0x270a04[_0xffd4('0x48')]+'.'+_0x270a04[_0xffd4('0x49')]))){throw new db[(_0xffd4('0x4d'))][(_0xffd4('0x4e'))](_0xffd4('0x4f'));}return _0x3b7035[_0xffd4('0x46')](path[_0xffd4('0x4a')](config[_0xffd4('0x4b')],_0xffd4('0x4c'),util[_0xffd4('0x50')](_0xffd4('0x51'),_0x270a04[_0xffd4('0x48')],_0x270a04[_0xffd4('0x49')])),util['format'](_0xffd4('0x51'),_0x270a04['name'],_0x270a04[_0xffd4('0x49')]));}return null;})[_0xffd4('0x52')](handleError(_0x3b7035,null));};exports[_0xffd4('0x53')]=function(_0x2e45e1,_0x5b4603,_0x25fdf1){var _0x4db26c={'name':path[_0xffd4('0x54')](_0x2e45e1[_0xffd4('0x55')]['originalname'],path['extname'](_0x2e45e1[_0xffd4('0x55')][_0xffd4('0x56')])),'save_name':path['basename'](_0x2e45e1[_0xffd4('0x55')][_0xffd4('0x57')],path['extname'](_0x2e45e1[_0xffd4('0x55')]['filename'])),'original_format':path[_0xffd4('0x58')](_0x2e45e1[_0xffd4('0x55')][_0xffd4('0x56')])[_0xffd4('0x59')](0x1),'converted_format':'wav'};var _0x3ba849=path['join'](config[_0xffd4('0x4b')],_0xffd4('0x5a'),_0x2e45e1[_0xffd4('0x55')]['filename']);var _0x1088e1=path['join'](config['root'],_0xffd4('0x4c'),util[_0xffd4('0x50')](_0xffd4('0x51'),path[_0xffd4('0x54')](_0x2e45e1[_0xffd4('0x55')][_0xffd4('0x57')],path['extname'](_0x2e45e1[_0xffd4('0x55')]['filename'])),_0x4db26c[_0xffd4('0x49')]));logger['info'](_0xffd4('0x5b'),_0x3ba849);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1088e1);try{fs[_0xffd4('0x5c')](_0x3ba849,parseInt(_0xffd4('0x5d'),0x8));var _0x57ecac=sox['transcode'](_0x3ba849,_0x1088e1,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57ecac['on'](_0xffd4('0x25'),function(_0x141ce5){fs['unlinkSync'](_0x3ba849);_0x5b4603[_0xffd4('0x17')](0x1f4)[_0xffd4('0x28')](_0x141ce5);});_0x57ecac['on']('src',function(_0xb66fb6){_0x4db26c['original_duration']=isNaN(_0xb66fb6['duration'])?null:_0xb66fb6[_0xffd4('0x5e')]*0x3e8;_0x4db26c[_0xffd4('0x5f')]=isNaN(_0xb66fb6[_0xffd4('0x60')])?null:_0xb66fb6[_0xffd4('0x60')];_0x4db26c[_0xffd4('0x61')]=isNaN(_0xb66fb6[_0xffd4('0x62')])?null:_0xb66fb6[_0xffd4('0x62')];_0x4db26c[_0xffd4('0x63')]=isNaN(_0xb66fb6[_0xffd4('0x64')])?null:_0xb66fb6[_0xffd4('0x64')];_0x4db26c['original_sampleRate']=isNaN(_0xb66fb6['sampleRate'])?null:_0xb66fb6['sampleRate'];});_0x57ecac['on'](_0xffd4('0x65'),function(_0x3fb406){_0x4db26c['converted_duration']=isNaN(_0x3fb406[_0xffd4('0x5e')])?null:_0x3fb406[_0xffd4('0x5e')]*0x3e8;_0x4db26c['converted_sampleCount']=isNaN(_0x3fb406[_0xffd4('0x60')])?null:_0x3fb406['sampleCount'];_0x4db26c[_0xffd4('0x66')]=isNaN(_0x3fb406[_0xffd4('0x62')])?null:_0x3fb406['channelCount'];_0x4db26c[_0xffd4('0x67')]=isNaN(_0x3fb406[_0xffd4('0x64')])?null:_0x3fb406['bitRate'];_0x4db26c[_0xffd4('0x68')]=isNaN(_0x3fb406[_0xffd4('0x69')])?null:_0x3fb406[_0xffd4('0x69')];});_0x57ecac['on'](_0xffd4('0x18'),function(){fs[_0xffd4('0x5c')](_0x1088e1,parseInt(_0xffd4('0x5d'),0x8));return db[_0xffd4('0x2a')][_0xffd4('0x53')](_0x4db26c)[_0xffd4('0x21')](function(_0x8cf32f){var _0x520933={'role':_0x2e45e1[_0xffd4('0x6a')][_0xffd4('0x6b')],'userProfileId':_0x2e45e1[_0xffd4('0x6a')]['userProfileId']};if(!_0x520933)throw new Error(_0xffd4('0x6c'));if(_0x520933['role']===_0xffd4('0x6d')){var _0x4568b6=_0x8cf32f[_0xffd4('0x22')]({'plain':!![]});return db[_0xffd4('0x6e')][_0xffd4('0x47')]({'where':{'name':_0xffd4('0x23'),'userProfileId':_0x520933['userProfileId']},'raw':!![]})[_0xffd4('0x21')](function(_0x3fb14e){if(_0x3fb14e&&_0x3fb14e[_0xffd4('0x6f')]===0x0){return db['UserProfileResource'][_0xffd4('0x53')]({'name':_0x4568b6[_0xffd4('0x27')],'resourceId':_0x4568b6['id'],'type':_0x3fb14e['name'],'sectionId':_0x3fb14e['id']},{})[_0xffd4('0x21')](function(){return _0x8cf32f;});}else{return _0x8cf32f;}})[_0xffd4('0x52')](function(_0x2c1595){logger[_0xffd4('0x25')](_0xffd4('0x70'),_0x2c1595);throw _0x2c1595;});}return _0x8cf32f;})[_0xffd4('0x21')](respondWithResult(_0x5b4603,null))[_0xffd4('0x52')](handleError(_0x5b4603,null));});_0x57ecac[_0xffd4('0x71')]();}catch(_0x2ffb36){_0x5b4603['status'](0x1f4)['send'](_0x2ffb36);}};exports[_0xffd4('0x72')]=function(_0x102a91,_0x2b6e79,_0x156363){return db[_0xffd4('0x2a')]['find']({'where':{'id':_0x102a91[_0xffd4('0x43')]['id']}})[_0xffd4('0x21')](handleEntityNotFound(_0x2b6e79,null))[_0xffd4('0x21')](saveUpdates(_[_0xffd4('0x38')](_0x102a91[_0xffd4('0x6a')],[_0xffd4('0x27'),_0xffd4('0x73')]),null))[_0xffd4('0x21')](respondWithResult(_0x2b6e79,null))[_0xffd4('0x52')](handleError(_0x2b6e79,null));};exports[_0xffd4('0x74')]=function(_0x3fa871,_0x2c6245,_0x1fe2f5){return db[_0xffd4('0x2a')]['find']({'where':{'id':_0x3fa871[_0xffd4('0x43')]['id']}})[_0xffd4('0x21')](function(_0x56e3d3){if(_0x56e3d3){return _0x56e3d3[_0xffd4('0x24')]();}})[_0xffd4('0x21')](function(_0x15b2be){var _0x42a9e3=path[_0xffd4('0x4a')](config[_0xffd4('0x4b')],'server/files/sounds/original',util[_0xffd4('0x50')](_0xffd4('0x51'),_0x15b2be['save_name'],_0x15b2be[_0xffd4('0x75')]));var _0x52b7e0=path[_0xffd4('0x4a')](config[_0xffd4('0x4b')],_0xffd4('0x4c'),util[_0xffd4('0x50')](_0xffd4('0x51'),_0x15b2be[_0xffd4('0x48')],_0x15b2be['converted_format']));fs[_0xffd4('0x76')](_0x42a9e3);fs[_0xffd4('0x76')](_0x52b7e0);return _0x15b2be;})['then'](function(_0x3f689d){if(_0x3f689d){return _0x2c6245['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2c6245,null))[_0xffd4('0x52')](handleError(_0x2c6245,null));}; \ No newline at end of file +var _0x012e=['0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','start','destroy','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','map','Sound','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x012e,0x190));var _0xe012=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x012e[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xe012('0x0'));var rimraf=require(_0xe012('0x1'));var zipdir=require(_0xe012('0x2'));var jsonpatch=require(_0xe012('0x3'));var rp=require(_0xe012('0x4'));var moment=require(_0xe012('0x5'));var BPromise=require(_0xe012('0x6'));var Mustache=require('mustache');var util=require(_0xe012('0x7'));var path=require(_0xe012('0x8'));var sox=require(_0xe012('0x9'));var csv=require(_0xe012('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe012('0xb'));var _=require(_0xe012('0xc'));var squel=require(_0xe012('0xd'));var crypto=require(_0xe012('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe012('0xf'));var toCsv=require(_0xe012('0xa'));var querystring=require(_0xe012('0x10'));var Papa=require(_0xe012('0x11'));var Redis=require(_0xe012('0x12'));var authService=require(_0xe012('0x13'));var qs=require(_0xe012('0x14'));var as=require(_0xe012('0x15'));var hardwareService=require(_0xe012('0x16'));var logger=require(_0xe012('0x17'))(_0xe012('0x18'));var utils=require(_0xe012('0x19'));var config=require(_0xe012('0x1a'));var licenseUtil=require(_0xe012('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x400c56,_0x438dd2){_0x438dd2=_0x438dd2||0xcc;return function(_0x17684b){if(_0x17684b){return _0x400c56['sendStatus'](_0x438dd2);}return _0x400c56[_0xe012('0x1c')](_0x438dd2)[_0xe012('0x1d')]();};}function respondWithResult(_0x247c11,_0x311115){_0x311115=_0x311115||0xc8;return function(_0x5ee605){if(_0x5ee605){return _0x247c11[_0xe012('0x1c')](_0x311115)['json'](_0x5ee605);}};}function respondWithFilteredResult(_0x19d612,_0x182e18){return function(_0x4c135b){if(_0x4c135b){var _0xcfd41c=typeof _0x182e18[_0xe012('0x1e')]===_0xe012('0x1f')&&typeof _0x182e18[_0xe012('0x20')]===_0xe012('0x1f');var _0x5655a3=_0x4c135b[_0xe012('0x21')];var _0x3d51a7=_0xcfd41c?0x0:_0x182e18['offset'];var _0x3621ef=_0xcfd41c?_0x4c135b[_0xe012('0x21')]:_0x182e18[_0xe012('0x1e')]+_0x182e18[_0xe012('0x20')];var _0x41c6c6;if(_0x3621ef>=_0x5655a3){_0x3621ef=_0x5655a3;_0x41c6c6=0xc8;}else{_0x41c6c6=0xce;}_0x19d612[_0xe012('0x1c')](_0x41c6c6);return _0x19d612[_0xe012('0x22')]('Content-Range',_0x3d51a7+'-'+_0x3621ef+'/'+_0x5655a3)[_0xe012('0x23')](_0x4c135b);}return null;};}function patchUpdates(_0x95fd24){return function(_0x1d5fd8){try{jsonpatch[_0xe012('0x24')](_0x1d5fd8,_0x95fd24,!![]);}catch(_0x133a05){return BPromise[_0xe012('0x25')](_0x133a05);}return _0x1d5fd8[_0xe012('0x26')]();};}function saveUpdates(_0x265a02,_0x5a78be){return function(_0x5a35ea){if(_0x5a35ea){return _0x5a35ea[_0xe012('0x27')](_0x265a02)['then'](function(_0x171ead){return _0x171ead;});}return null;};}function removeEntity(_0x325b2a,_0x1440c5){return function(_0x1b1658){if(_0x1b1658){return _0x1b1658['destroy']()[_0xe012('0x28')](function(){var _0x4bb220=_0x1b1658[_0xe012('0x29')]({'plain':!![]});var _0x45c04b=_0xe012('0x2a');return db[_0xe012('0x2b')]['destroy']({'where':{'type':_0x45c04b,'resourceId':_0x4bb220['id']}})[_0xe012('0x28')](function(){return _0x1b1658;});})[_0xe012('0x28')](function(){_0x325b2a[_0xe012('0x1c')](0xcc)[_0xe012('0x1d')]();});}};}function handleEntityNotFound(_0x1a0e9a,_0x13069e){return function(_0x38d8be){if(!_0x38d8be){_0x1a0e9a[_0xe012('0x2c')](0x194);}return _0x38d8be;};}function handleError(_0x2eb444,_0x1ff32e){_0x1ff32e=_0x1ff32e||0x1f4;return function(_0x1e2bf1){logger[_0xe012('0x2d')](_0x1e2bf1[_0xe012('0x2e')]);if(_0x1e2bf1[_0xe012('0x2f')]){delete _0x1e2bf1[_0xe012('0x2f')];}_0x2eb444[_0xe012('0x1c')](_0x1ff32e)[_0xe012('0x30')](_0x1e2bf1);};}exports['index']=function(_0x56a331,_0x474897){var _0x4868d6={},_0x155ff8={},_0x3aeec7={'count':0x0,'rows':[]};var _0x51391e=_[_0xe012('0x31')](db[_0xe012('0x32')][_0xe012('0x33')],function(_0x1d4625){return{'name':_0x1d4625['fieldName'],'type':_0x1d4625[_0xe012('0x34')]['key']};});_0x155ff8[_0xe012('0x35')]=_[_0xe012('0x31')](_0x51391e,_0xe012('0x2f'));_0x155ff8[_0xe012('0x36')]=_[_0xe012('0x37')](_0x56a331[_0xe012('0x36')]);_0x155ff8[_0xe012('0x38')]=_[_0xe012('0x39')](_0x155ff8[_0xe012('0x35')],_0x155ff8['query']);_0x4868d6[_0xe012('0x3a')]=_[_0xe012('0x39')](_0x155ff8[_0xe012('0x35')],qs[_0xe012('0x3b')](_0x56a331[_0xe012('0x36')][_0xe012('0x3b')]));_0x4868d6[_0xe012('0x3a')]=_0x4868d6[_0xe012('0x3a')][_0xe012('0x3c')]?_0x4868d6[_0xe012('0x3a')]:_0x155ff8['model'];if(!_0x56a331['query'][_0xe012('0x3d')](_0xe012('0x3e'))){_0x4868d6['limit']=qs[_0xe012('0x20')](_0x56a331['query'][_0xe012('0x20')]);_0x4868d6['offset']=qs[_0xe012('0x1e')](_0x56a331['query']['offset']);}_0x4868d6[_0xe012('0x3f')]=qs[_0xe012('0x40')](_0x56a331[_0xe012('0x36')][_0xe012('0x40')]);_0x4868d6['where']=qs[_0xe012('0x38')](_[_0xe012('0x41')](_0x56a331['query'],_0x155ff8[_0xe012('0x38')]),_0x51391e);if(_0x56a331[_0xe012('0x36')][_0xe012('0x42')]){_0x4868d6[_0xe012('0x43')]=_[_0xe012('0x44')](_0x4868d6[_0xe012('0x43')],{'$or':_[_0xe012('0x31')](_0x51391e,function(_0x172d3b){if(_0x172d3b[_0xe012('0x34')]!==_0xe012('0x45')){var _0x58d4d1={};_0x58d4d1[_0x172d3b[_0xe012('0x2f')]]={'$like':'%'+_0x56a331[_0xe012('0x36')][_0xe012('0x42')]+'%'};return _0x58d4d1;}})});}_0x4868d6=_['merge']({},_0x4868d6,_0x56a331[_0xe012('0x46')]);var _0x302be3={'where':_0x4868d6[_0xe012('0x43')]};return db[_0xe012('0x32')][_0xe012('0x21')](_0x302be3)[_0xe012('0x28')](function(_0x47f28){_0x3aeec7[_0xe012('0x21')]=_0x47f28;if(_0x56a331[_0xe012('0x36')][_0xe012('0x47')]){_0x4868d6[_0xe012('0x48')]=[{'all':!![]}];}return db[_0xe012('0x32')][_0xe012('0x49')](_0x4868d6);})['then'](function(_0x229cbc){_0x3aeec7[_0xe012('0x4a')]=_0x229cbc;return _0x3aeec7;})[_0xe012('0x28')](respondWithFilteredResult(_0x474897,_0x4868d6))[_0xe012('0x4b')](handleError(_0x474897,null));};exports['show']=function(_0x207b9e,_0x5cee3c){var _0x232708={'raw':!![],'where':{'id':_0x207b9e[_0xe012('0x4c')]['id']}},_0x598c44={};_0x598c44[_0xe012('0x35')]=_[_0xe012('0x37')](db[_0xe012('0x32')]['rawAttributes']);_0x598c44[_0xe012('0x36')]=_[_0xe012('0x37')](_0x207b9e['query']);_0x598c44[_0xe012('0x38')]=_[_0xe012('0x39')](_0x598c44['model'],_0x598c44[_0xe012('0x36')]);_0x232708[_0xe012('0x3a')]=_[_0xe012('0x39')](_0x598c44['model'],qs[_0xe012('0x3b')](_0x207b9e[_0xe012('0x36')][_0xe012('0x3b')]));_0x232708[_0xe012('0x3a')]=_0x232708[_0xe012('0x3a')][_0xe012('0x3c')]?_0x232708['attributes']:_0x598c44['model'];if(_0x207b9e[_0xe012('0x36')][_0xe012('0x47')]){_0x232708['include']=[{'all':!![]}];}_0x232708=_[_0xe012('0x44')]({},_0x232708,_0x207b9e['options']);return db[_0xe012('0x32')][_0xe012('0x4d')](_0x232708)[_0xe012('0x28')](handleEntityNotFound(_0x5cee3c,null))[_0xe012('0x28')](respondWithResult(_0x5cee3c,null))[_0xe012('0x4b')](handleError(_0x5cee3c,null));};exports[_0xe012('0x4e')]=function(_0x5efc55,_0x33f68f,_0xe125d3){return db['Sound'][_0xe012('0x4d')]({'where':{'id':_0x5efc55[_0xe012('0x4c')]['id']},'attributes':[_0xe012('0x2f'),_0xe012('0x4f'),_0xe012('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x33f68f,null))['then'](function(_0x443625){if(_0x443625){if(!fs['existsSync'](path[_0xe012('0x51')](config[_0xe012('0x52')],_0xe012('0x53'),_0x443625[_0xe012('0x4f')]+'.'+_0x443625[_0xe012('0x50')]))){throw new db[(_0xe012('0x54'))][(_0xe012('0x55'))](_0xe012('0x56'));}return _0x33f68f[_0xe012('0x4e')](path['join'](config['root'],_0xe012('0x53'),util[_0xe012('0x57')]('%s.%s',_0x443625[_0xe012('0x4f')],_0x443625['converted_format'])),util[_0xe012('0x57')](_0xe012('0x58'),_0x443625['name'],_0x443625[_0xe012('0x50')]));}return null;})[_0xe012('0x4b')](handleError(_0x33f68f,null));};exports[_0xe012('0x59')]=function(_0x590193,_0x38fc67,_0x16016a){var _0x48bb4c={'name':path[_0xe012('0x5a')](_0x590193[_0xe012('0x5b')][_0xe012('0x5c')],path[_0xe012('0x5d')](_0x590193[_0xe012('0x5b')][_0xe012('0x5c')])),'save_name':path['basename'](_0x590193[_0xe012('0x5b')][_0xe012('0x5e')],path[_0xe012('0x5d')](_0x590193[_0xe012('0x5b')][_0xe012('0x5e')])),'original_format':path[_0xe012('0x5d')](_0x590193[_0xe012('0x5b')][_0xe012('0x5c')])[_0xe012('0x5f')](0x1),'converted_format':_0xe012('0x60')};var _0xd58a35=path[_0xe012('0x51')](config[_0xe012('0x52')],_0xe012('0x61'),_0x590193[_0xe012('0x5b')]['filename']);var _0x3f3e35=path[_0xe012('0x51')](config[_0xe012('0x52')],_0xe012('0x53'),util['format'](_0xe012('0x58'),path[_0xe012('0x5a')](_0x590193[_0xe012('0x5b')][_0xe012('0x5e')],path[_0xe012('0x5d')](_0x590193[_0xe012('0x5b')][_0xe012('0x5e')])),_0x48bb4c['converted_format']));logger[_0xe012('0x62')](_0xe012('0x63'),_0xd58a35);logger[_0xe012('0x62')]('Sound\x20upload\x20destination:\x20%s',_0x3f3e35);try{fs[_0xe012('0x64')](_0xd58a35,parseInt('0777',0x8));var _0x56bd66=sox[_0xe012('0x65')](_0xd58a35,_0x3f3e35,{'sampleRate':0x1f40,'format':_0xe012('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56bd66['on'](_0xe012('0x2d'),function(_0x3dbef2){fs[_0xe012('0x66')](_0xd58a35);_0x38fc67['status'](0x1f4)[_0xe012('0x30')](_0x3dbef2);});_0x56bd66['on'](_0xe012('0x67'),function(_0x5ae72a){_0x48bb4c[_0xe012('0x68')]=isNaN(_0x5ae72a[_0xe012('0x69')])?null:_0x5ae72a[_0xe012('0x69')]*0x3e8;_0x48bb4c[_0xe012('0x6a')]=isNaN(_0x5ae72a[_0xe012('0x6b')])?null:_0x5ae72a['sampleCount'];_0x48bb4c[_0xe012('0x6c')]=isNaN(_0x5ae72a['channelCount'])?null:_0x5ae72a[_0xe012('0x6d')];_0x48bb4c[_0xe012('0x6e')]=isNaN(_0x5ae72a[_0xe012('0x6f')])?null:_0x5ae72a['bitRate'];_0x48bb4c[_0xe012('0x70')]=isNaN(_0x5ae72a[_0xe012('0x71')])?null:_0x5ae72a[_0xe012('0x71')];});_0x56bd66['on'](_0xe012('0x72'),function(_0x131dc0){_0x48bb4c[_0xe012('0x73')]=isNaN(_0x131dc0['duration'])?null:_0x131dc0[_0xe012('0x69')]*0x3e8;_0x48bb4c[_0xe012('0x74')]=isNaN(_0x131dc0[_0xe012('0x6b')])?null:_0x131dc0[_0xe012('0x6b')];_0x48bb4c[_0xe012('0x75')]=isNaN(_0x131dc0['channelCount'])?null:_0x131dc0[_0xe012('0x6d')];_0x48bb4c[_0xe012('0x76')]=isNaN(_0x131dc0[_0xe012('0x6f')])?null:_0x131dc0['bitRate'];_0x48bb4c[_0xe012('0x77')]=isNaN(_0x131dc0[_0xe012('0x71')])?null:_0x131dc0[_0xe012('0x71')];});_0x56bd66['on'](_0xe012('0x1d'),function(){fs[_0xe012('0x64')](_0x3f3e35,parseInt(_0xe012('0x78'),0x8));return db[_0xe012('0x32')][_0xe012('0x59')](_0x48bb4c)[_0xe012('0x28')](function(_0x196dec){var _0x5bda46={'role':_0x590193[_0xe012('0x79')][_0xe012('0x7a')],'userProfileId':_0x590193[_0xe012('0x79')][_0xe012('0x7b')]};if(!_0x5bda46)throw new Error(_0xe012('0x7c'));if(_0x5bda46[_0xe012('0x7a')]===_0xe012('0x7d')){var _0x3c58e2=_0x196dec[_0xe012('0x29')]({'plain':!![]});return db[_0xe012('0x7e')][_0xe012('0x4d')]({'where':{'name':_0xe012('0x2a'),'userProfileId':_0x5bda46[_0xe012('0x7b')]},'raw':!![]})[_0xe012('0x28')](function(_0x11de90){if(_0x11de90&&_0x11de90['autoAssociation']===0x0){return db['UserProfileResource'][_0xe012('0x59')]({'name':_0x3c58e2[_0xe012('0x2f')],'resourceId':_0x3c58e2['id'],'type':_0x11de90[_0xe012('0x2f')],'sectionId':_0x11de90['id']},{})[_0xe012('0x28')](function(){return _0x196dec;});}else{return _0x196dec;}})[_0xe012('0x4b')](function(_0x3256df){logger[_0xe012('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3256df);throw _0x3256df;});}return _0x196dec;})[_0xe012('0x28')](respondWithResult(_0x38fc67,null))['catch'](handleError(_0x38fc67,null));});_0x56bd66[_0xe012('0x7f')]();}catch(_0x2807f9){_0x38fc67[_0xe012('0x1c')](0x1f4)[_0xe012('0x30')](_0x2807f9);}};exports[_0xe012('0x27')]=function(_0x263fce,_0xc1a800,_0x30c6c1){return db[_0xe012('0x32')][_0xe012('0x4d')]({'where':{'id':_0x263fce['params']['id']}})[_0xe012('0x28')](handleEntityNotFound(_0xc1a800,null))[_0xe012('0x28')](saveUpdates(_[_0xe012('0x41')](_0x263fce[_0xe012('0x79')],[_0xe012('0x2f'),'description']),null))[_0xe012('0x28')](respondWithResult(_0xc1a800,null))[_0xe012('0x4b')](handleError(_0xc1a800,null));};exports['delete']=function(_0x4670f6,_0x57e101,_0x22f9f8){return db[_0xe012('0x32')]['find']({'where':{'id':_0x4670f6[_0xe012('0x4c')]['id']}})[_0xe012('0x28')](function(_0x981dd){if(_0x981dd){return _0x981dd[_0xe012('0x80')]();}})[_0xe012('0x28')](function(_0xd05b1e){var _0x3ebfe9=path[_0xe012('0x51')](config[_0xe012('0x52')],'server/files/sounds/original',util[_0xe012('0x57')](_0xe012('0x58'),_0xd05b1e[_0xe012('0x4f')],_0xd05b1e[_0xe012('0x81')]));var _0x3e0af9=path['join'](config[_0xe012('0x52')],_0xe012('0x53'),util[_0xe012('0x57')]('%s.%s',_0xd05b1e[_0xe012('0x4f')],_0xd05b1e[_0xe012('0x50')]));fs[_0xe012('0x66')](_0x3ebfe9);fs[_0xe012('0x66')](_0x3e0af9);return _0xd05b1e;})['then'](function(_0x1794cc){if(_0x1794cc){return _0x57e101[_0xe012('0x1c')](0xcc)[_0xe012('0x1d')]();}})[_0xe012('0x28')](handleEntityNotFound(_0x57e101,null))[_0xe012('0x4b')](handleError(_0x57e101,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index db74920..076302c 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 _0x5d55=['define','Sound','tools_sounds','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x509b2c,_0xb88b68){var _0x7625f3=function(_0x511650){while(--_0x511650){_0x509b2c['push'](_0x509b2c['shift']());}};_0x7625f3(++_0xb88b68);}(_0x5d55,0x184));var _0x55d5=function(_0x383538,_0x319788){_0x383538=_0x383538-0x0;var _0x23beb5=_0x5d55[_0x383538];return _0x23beb5;};'use strict';var _=require(_0x55d5('0x0'));var util=require('util');var logger=require(_0x55d5('0x1'))(_0x55d5('0x2'));var moment=require('moment');var BPromise=require(_0x55d5('0x3'));var rp=require(_0x55d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55d5('0x5'));var config=require(_0x55d5('0x6'));var attributes=require('./sound.attributes');module[_0x55d5('0x7')]=function(_0x3da3bb,_0x155fb5){return _0x3da3bb[_0x55d5('0x8')](_0x55d5('0x9'),attributes,{'tableName':_0x55d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x021c=['rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x021c,0x88));var _0xc021=function(_0x4e1bc0,_0x2fd996){_0x4e1bc0=_0x4e1bc0-0x0;var _0x151f70=_0x021c[_0x4e1bc0];return _0x151f70;};'use strict';var _=require(_0xc021('0x0'));var util=require(_0xc021('0x1'));var logger=require(_0xc021('0x2'))('api');var moment=require(_0xc021('0x3'));var BPromise=require(_0xc021('0x4'));var rp=require(_0xc021('0x5'));var fs=require('fs');var path=require(_0xc021('0x6'));var rimraf=require(_0xc021('0x7'));var config=require(_0xc021('0x8'));var attributes=require(_0xc021('0x9'));module['exports']=function(_0x3c41e3,_0x554a5c){return _0x3c41e3[_0xc021('0xa')](_0xc021('0xb'),attributes,{'tableName':_0xc021('0xc'),'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 37ce4e0..7ec9e58 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 _0xb163=['info','result','find','options','raw','where','attributes','include','map','model','then','ShowSound','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','request','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a7e9f,_0x6ef385){var _0x44b3fa=function(_0x5af143){while(--_0x5af143){_0x1a7e9f['push'](_0x1a7e9f['shift']());}};_0x44b3fa(++_0x6ef385);}(_0xb163,0xd1));var _0x3b16=function(_0x1532c1,_0x53877a){_0x1532c1=_0x1532c1-0x0;var _0x1693ed=_0xb163[_0x1532c1];return _0x1693ed;};'use strict';var _=require(_0x3b16('0x0'));var util=require('util');var moment=require(_0x3b16('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b16('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b16('0x3'))['db'];var utils=require(_0x3b16('0x4'));var logger=require(_0x3b16('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc0c8,_0x1e084e,_0x3377d9){return new BPromise(function(_0x4d23f4,_0x25bf1c){return client[_0x3b16('0x6')](_0x3cc0c8,_0x3377d9)['then'](function(_0x37dd1c){logger['info'](_0x3b16('0x7'),_0x1e084e,_0x3b16('0x8'));logger[_0x3b16('0x9')](_0x3b16('0xa'),_0x1e084e,'request\x20sent',JSON[_0x3b16('0xb')](_0x37dd1c));if(_0x37dd1c[_0x3b16('0xc')]){if(_0x37dd1c[_0x3b16('0xc')][_0x3b16('0xd')]===0x1f4){logger['error'](_0x3b16('0x7'),_0x1e084e,_0x37dd1c[_0x3b16('0xc')][_0x3b16('0xe')]);return _0x25bf1c(_0x37dd1c[_0x3b16('0xc')][_0x3b16('0xe')]);}logger[_0x3b16('0xc')](_0x3b16('0x7'),_0x1e084e,_0x37dd1c[_0x3b16('0xc')][_0x3b16('0xe')]);return _0x4d23f4(_0x37dd1c[_0x3b16('0xc')][_0x3b16('0xe')]);}else{logger[_0x3b16('0xf')](_0x3b16('0x7'),_0x1e084e,_0x3b16('0x8'));_0x4d23f4(_0x37dd1c[_0x3b16('0x10')]['message']);}})['catch'](function(_0x4e665e){logger['error'](_0x3b16('0x7'),_0x1e084e,_0x4e665e);_0x25bf1c(_0x4e665e);});});}exports['ShowSound']=function(_0x2fb903){var _0x4c4629=this;return new Promise(function(_0x407657,_0x5d4e91){return db['Sound'][_0x3b16('0x11')]({'raw':_0x2fb903[_0x3b16('0x12')]?_0x2fb903[_0x3b16('0x12')][_0x3b16('0x13')]===undefined?!![]:![]:!![],'where':_0x2fb903[_0x3b16('0x12')]?_0x2fb903['options'][_0x3b16('0x14')]||null:null,'attributes':_0x2fb903[_0x3b16('0x12')]?_0x2fb903['options'][_0x3b16('0x15')]||null:null,'include':_0x2fb903[_0x3b16('0x12')]?_0x2fb903['options'][_0x3b16('0x16')]?_[_0x3b16('0x17')](_0x2fb903[_0x3b16('0x12')]['include'],function(_0x46943){return{'model':db[_0x46943[_0x3b16('0x18')]],'as':_0x46943['as'],'attributes':_0x46943[_0x3b16('0x15')],'include':_0x46943[_0x3b16('0x16')]?_[_0x3b16('0x17')](_0x46943['include'],function(_0x583c22){return{'model':db[_0x583c22[_0x3b16('0x18')]],'as':_0x583c22['as'],'attributes':_0x583c22[_0x3b16('0x15')],'include':_0x583c22['include']?_['map'](_0x583c22['include'],function(_0x3383c5){return{'model':db[_0x3383c5['model']],'as':_0x3383c5['as'],'attributes':_0x3383c5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b16('0x19')](function(_0x3ee7b3){logger['info'](_0x3b16('0x1a'),_0x2fb903);logger[_0x3b16('0x9')](_0x3b16('0x1a'),_0x2fb903,JSON[_0x3b16('0xb')](_0x3ee7b3));_0x407657(_0x3ee7b3);})[_0x3b16('0x1b')](function(_0x49318d){logger[_0x3b16('0xc')](_0x3b16('0x1a'),_0x49318d[_0x3b16('0xe')],_0x2fb903);_0x5d4e91(_0x4c4629[_0x3b16('0xc')](0x1f4,_0x49318d[_0x3b16('0xe')]));});});}; \ No newline at end of file +var _0xbcd8=['then','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x33a228,_0x2aac6c){var _0x1a0318=function(_0x31efc1){while(--_0x31efc1){_0x33a228['push'](_0x33a228['shift']());}};_0x1a0318(++_0x2aac6c);}(_0xbcd8,0xda));var _0x8bcd=function(_0x52b173,_0x2f03a9){_0x52b173=_0x52b173-0x0;var _0x1eace8=_0xbcd8[_0x52b173];return _0x1eace8;};'use strict';var _=require(_0x8bcd('0x0'));var util=require(_0x8bcd('0x1'));var moment=require(_0x8bcd('0x2'));var BPromise=require(_0x8bcd('0x3'));var rs=require(_0x8bcd('0x4'));var fs=require('fs');var Redis=require(_0x8bcd('0x5'));var db=require(_0x8bcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8bcd('0x7'));var config=require(_0x8bcd('0x8'));var jayson=require(_0x8bcd('0x9'));var client=jayson[_0x8bcd('0xa')][_0x8bcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6694,_0x4ddcfd,_0x5e0e0a){return new BPromise(function(_0x13c4a7,_0x42f4e8){return client[_0x8bcd('0xc')](_0x3a6694,_0x5e0e0a)[_0x8bcd('0xd')](function(_0x50ce02){logger['info']('Sound,\x20%s,\x20%s',_0x4ddcfd,'request\x20sent');logger['debug'](_0x8bcd('0xe'),_0x4ddcfd,'request\x20sent',JSON['stringify'](_0x50ce02));if(_0x50ce02[_0x8bcd('0xf')]){if(_0x50ce02['error'][_0x8bcd('0x10')]===0x1f4){logger[_0x8bcd('0xf')](_0x8bcd('0x11'),_0x4ddcfd,_0x50ce02[_0x8bcd('0xf')]['message']);return _0x42f4e8(_0x50ce02[_0x8bcd('0xf')][_0x8bcd('0x12')]);}logger[_0x8bcd('0xf')]('Sound,\x20%s,\x20%s',_0x4ddcfd,_0x50ce02[_0x8bcd('0xf')][_0x8bcd('0x12')]);return _0x13c4a7(_0x50ce02[_0x8bcd('0xf')]['message']);}else{logger[_0x8bcd('0x13')]('Sound,\x20%s,\x20%s',_0x4ddcfd,'request\x20sent');_0x13c4a7(_0x50ce02[_0x8bcd('0x14')][_0x8bcd('0x12')]);}})[_0x8bcd('0x15')](function(_0x3895ff){logger[_0x8bcd('0xf')](_0x8bcd('0x11'),_0x4ddcfd,_0x3895ff);_0x42f4e8(_0x3895ff);});});}exports[_0x8bcd('0x16')]=function(_0x583323){var _0x5ba0ac=this;return new Promise(function(_0x100017,_0x5589e0){return db[_0x8bcd('0x17')][_0x8bcd('0x18')]({'raw':_0x583323[_0x8bcd('0x19')]?_0x583323[_0x8bcd('0x19')][_0x8bcd('0x1a')]===undefined?!![]:![]:!![],'where':_0x583323[_0x8bcd('0x19')]?_0x583323['options'][_0x8bcd('0x1b')]||null:null,'attributes':_0x583323['options']?_0x583323[_0x8bcd('0x19')][_0x8bcd('0x1c')]||null:null,'include':_0x583323[_0x8bcd('0x19')]?_0x583323[_0x8bcd('0x19')][_0x8bcd('0x1d')]?_[_0x8bcd('0x1e')](_0x583323[_0x8bcd('0x19')][_0x8bcd('0x1d')],function(_0x12dbf0){return{'model':db[_0x12dbf0['model']],'as':_0x12dbf0['as'],'attributes':_0x12dbf0[_0x8bcd('0x1c')],'include':_0x12dbf0['include']?_[_0x8bcd('0x1e')](_0x12dbf0[_0x8bcd('0x1d')],function(_0x124b16){return{'model':db[_0x124b16[_0x8bcd('0x1f')]],'as':_0x124b16['as'],'attributes':_0x124b16[_0x8bcd('0x1c')],'include':_0x124b16[_0x8bcd('0x1d')]?_[_0x8bcd('0x1e')](_0x124b16[_0x8bcd('0x1d')],function(_0x288406){return{'model':db[_0x288406[_0x8bcd('0x1f')]],'as':_0x288406['as'],'attributes':_0x288406[_0x8bcd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bcd('0xd')](function(_0x54883b){logger['info']('ShowSound',_0x583323);logger['debug'](_0x8bcd('0x16'),_0x583323,JSON[_0x8bcd('0x20')](_0x54883b));_0x100017(_0x54883b);})['catch'](function(_0x47d14e){logger[_0x8bcd('0xf')](_0x8bcd('0x16'),_0x47d14e[_0x8bcd('0x12')],_0x583323);_0x5589e0(_0x5ba0ac[_0x8bcd('0xf')](0x1f4,_0x47d14e[_0x8bcd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9d4c433..6243353 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x87c91,_0x310645){var _0x106d30=function(_0x47d85d){while(--_0x47d85d){_0x87c91['push'](_0x87c91['shift']());}};_0x106d30(++_0x310645);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x4fc2,0x111));var _0x24fc=function(_0x254842,_0x159c1f){_0x254842=_0x254842-0x0;var _0x364fad=_0x4fc2[_0x254842];return _0x364fad;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 79e517a..52c4f06 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 _0xfe54=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x4ec42,_0x36177b){var _0x385e11=function(_0x44e535){while(--_0x44e535){_0x4ec42['push'](_0x4ec42['shift']());}};_0x385e11(++_0x36177b);}(_0xfe54,0xbe));var _0x4fe5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe54[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x4fe5('0x0'));module[_0x4fe5('0x1')]={'uniqueid':{'type':Sequelize[_0x4fe5('0x2')]},'body':{'type':Sequelize[_0x4fe5('0x3')](_0x4fe5('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x4fe5('0x5')]('in',_0x4fe5('0x6')),'defaultValue':_0x4fe5('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4fe5('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1580=['ENUM','out','STRING','TEXT','medium'];(function(_0x3fc8bc,_0x36a426){var _0x313746=function(_0x5d8f86){while(--_0x5d8f86){_0x3fc8bc['push'](_0x3fc8bc['shift']());}};_0x313746(++_0x36a426);}(_0x1580,0x7a));var _0x0158=function(_0xf63de,_0x30b00f){_0xf63de=_0xf63de-0x0;var _0x1a8a95=_0x1580[_0xf63de];return _0x1a8a95;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0158('0x0')]},'body':{'type':Sequelize[_0x0158('0x1')](_0x0158('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x0158('0x3')]('in',_0x0158('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x0158('0x0')]},'providerResponse':{'type':Sequelize[_0x0158('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1c8d5e0..9d48f85 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 _0x4bc7=['findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','find','destroy','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','SquareMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bc7,0x188));var _0x74bc=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0x4bc7[_0x4421a0];return _0x5626d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x74bc('0x0'));var jsonpatch=require(_0x74bc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74bc('0x2'));var Mustache=require(_0x74bc('0x3'));var util=require(_0x74bc('0x4'));var path=require(_0x74bc('0x5'));var sox=require(_0x74bc('0x6'));var csv=require('to-csv');var ejs=require(_0x74bc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74bc('0x8'));var squel=require(_0x74bc('0x9'));var crypto=require(_0x74bc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74bc('0xb'));var querystring=require(_0x74bc('0xc'));var Papa=require('papaparse');var Redis=require(_0x74bc('0xd'));var authService=require(_0x74bc('0xe'));var qs=require(_0x74bc('0xf'));var as=require(_0x74bc('0x10'));var hardwareService=require(_0x74bc('0x11'));var logger=require(_0x74bc('0x12'))(_0x74bc('0x13'));var utils=require(_0x74bc('0x14'));var config=require(_0x74bc('0x15'));var licenseUtil=require(_0x74bc('0x16'));var db=require(_0x74bc('0x17'))['db'];function respondWithStatusCode(_0x4ce245,_0x37d793){_0x37d793=_0x37d793||0xcc;return function(_0x316840){if(_0x316840){return _0x4ce245[_0x74bc('0x18')](_0x37d793);}return _0x4ce245['status'](_0x37d793)['end']();};}function respondWithResult(_0x19fdd2,_0x2b40d9){_0x2b40d9=_0x2b40d9||0xc8;return function(_0x570519){if(_0x570519){return _0x19fdd2[_0x74bc('0x19')](_0x2b40d9)[_0x74bc('0x1a')](_0x570519);}};}function respondWithFilteredResult(_0x529a57,_0x2dc5aa){return function(_0x22167d){if(_0x22167d){var _0x7fd952=typeof _0x2dc5aa[_0x74bc('0x1b')]===_0x74bc('0x1c')&&typeof _0x2dc5aa[_0x74bc('0x1d')]==='undefined';var _0x5a97d4=_0x22167d['count'];var _0x118564=_0x7fd952?0x0:_0x2dc5aa[_0x74bc('0x1b')];var _0x569d94=_0x7fd952?_0x22167d[_0x74bc('0x1e')]:_0x2dc5aa['offset']+_0x2dc5aa[_0x74bc('0x1d')];var _0x5592d2;if(_0x569d94>=_0x5a97d4){_0x569d94=_0x5a97d4;_0x5592d2=0xc8;}else{_0x5592d2=0xce;}_0x529a57[_0x74bc('0x19')](_0x5592d2);return _0x529a57[_0x74bc('0x1f')](_0x74bc('0x20'),_0x118564+'-'+_0x569d94+'/'+_0x5a97d4)[_0x74bc('0x1a')](_0x22167d);}return null;};}function patchUpdates(_0x5885c8){return function(_0x22b8e7){try{jsonpatch[_0x74bc('0x21')](_0x22b8e7,_0x5885c8,!![]);}catch(_0x29b4eb){return BPromise[_0x74bc('0x22')](_0x29b4eb);}return _0x22b8e7[_0x74bc('0x23')]();};}function saveUpdates(_0x46e021,_0x2e28b3){return function(_0x38fce3){if(_0x38fce3){return _0x38fce3[_0x74bc('0x24')](_0x46e021)[_0x74bc('0x25')](function(_0x4af99a){return _0x4af99a;});}return null;};}function removeEntity(_0x5cb165,_0x213fb5){return function(_0xdf8387){if(_0xdf8387){return _0xdf8387['destroy']()[_0x74bc('0x25')](function(){_0x5cb165[_0x74bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a6f7,_0x17e844){return function(_0x3405e7){if(!_0x3405e7){_0x55a6f7[_0x74bc('0x18')](0x194);}return _0x3405e7;};}function handleError(_0xa73b10,_0x527039){_0x527039=_0x527039||0x1f4;return function(_0x1be887){logger['error'](_0x1be887[_0x74bc('0x26')]);if(_0x1be887[_0x74bc('0x27')]){delete _0x1be887[_0x74bc('0x27')];}_0xa73b10[_0x74bc('0x19')](_0x527039)[_0x74bc('0x28')](_0x1be887);};}exports['index']=function(_0x35744a,_0x2ae085){var _0x2c2fc4={},_0x48761f={},_0xf3d021={'count':0x0,'rows':[]};var _0x83b250=_[_0x74bc('0x29')](db[_0x74bc('0x2a')]['rawAttributes'],function(_0x1b0e46){return{'name':_0x1b0e46[_0x74bc('0x2b')],'type':_0x1b0e46[_0x74bc('0x2c')][_0x74bc('0x2d')]};});_0x48761f['model']=_[_0x74bc('0x29')](_0x83b250,_0x74bc('0x27'));_0x48761f[_0x74bc('0x2e')]=_['keys'](_0x35744a[_0x74bc('0x2e')]);_0x48761f[_0x74bc('0x2f')]=_[_0x74bc('0x30')](_0x48761f[_0x74bc('0x31')],_0x48761f[_0x74bc('0x2e')]);_0x2c2fc4[_0x74bc('0x32')]=_[_0x74bc('0x30')](_0x48761f['model'],qs['fields'](_0x35744a[_0x74bc('0x2e')][_0x74bc('0x33')]));_0x2c2fc4[_0x74bc('0x32')]=_0x2c2fc4[_0x74bc('0x32')][_0x74bc('0x34')]?_0x2c2fc4[_0x74bc('0x32')]:_0x48761f[_0x74bc('0x31')];if(!_0x35744a[_0x74bc('0x2e')][_0x74bc('0x35')](_0x74bc('0x36'))){_0x2c2fc4[_0x74bc('0x1d')]=qs['limit'](_0x35744a['query']['limit']);_0x2c2fc4['offset']=qs['offset'](_0x35744a[_0x74bc('0x2e')][_0x74bc('0x1b')]);}_0x2c2fc4[_0x74bc('0x37')]=qs[_0x74bc('0x38')](_0x35744a['query']['sort']);_0x2c2fc4[_0x74bc('0x39')]=qs[_0x74bc('0x2f')](_[_0x74bc('0x3a')](_0x35744a[_0x74bc('0x2e')],_0x48761f[_0x74bc('0x2f')]),_0x83b250);if(_0x35744a[_0x74bc('0x2e')][_0x74bc('0x3b')]){_0x2c2fc4[_0x74bc('0x39')]=_[_0x74bc('0x3c')](_0x2c2fc4[_0x74bc('0x39')],{'$or':_[_0x74bc('0x29')](_0x83b250,function(_0x3b85da){if(_0x3b85da[_0x74bc('0x2c')]!==_0x74bc('0x3d')){var _0x2d2e9d={};_0x2d2e9d[_0x3b85da[_0x74bc('0x27')]]={'$like':'%'+_0x35744a['query'][_0x74bc('0x3b')]+'%'};return _0x2d2e9d;}})});}_0x2c2fc4=_['merge']({},_0x2c2fc4,_0x35744a['options']);var _0x1b979a={'where':_0x2c2fc4[_0x74bc('0x39')]};return db[_0x74bc('0x2a')][_0x74bc('0x1e')](_0x1b979a)[_0x74bc('0x25')](function(_0x484624){_0xf3d021[_0x74bc('0x1e')]=_0x484624;if(_0x35744a[_0x74bc('0x2e')][_0x74bc('0x3e')]){_0x2c2fc4[_0x74bc('0x3f')]=[{'all':!![]}];}return db[_0x74bc('0x2a')][_0x74bc('0x40')](_0x2c2fc4);})[_0x74bc('0x25')](function(_0x459ee4){_0xf3d021[_0x74bc('0x41')]=_0x459ee4;return _0xf3d021;})['then'](respondWithFilteredResult(_0x2ae085,_0x2c2fc4))[_0x74bc('0x42')](handleError(_0x2ae085,null));};exports[_0x74bc('0x43')]=function(_0x41dc6e,_0x154dad){var _0x37fe9c={'raw':!![],'where':{'id':_0x41dc6e[_0x74bc('0x44')]['id']}},_0x544d44={};_0x544d44['model']=_[_0x74bc('0x45')](db[_0x74bc('0x2a')][_0x74bc('0x46')]);_0x544d44[_0x74bc('0x2e')]=_[_0x74bc('0x45')](_0x41dc6e[_0x74bc('0x2e')]);_0x544d44['filters']=_['intersection'](_0x544d44['model'],_0x544d44[_0x74bc('0x2e')]);_0x37fe9c[_0x74bc('0x32')]=_[_0x74bc('0x30')](_0x544d44[_0x74bc('0x31')],qs[_0x74bc('0x33')](_0x41dc6e['query'][_0x74bc('0x33')]));_0x37fe9c[_0x74bc('0x32')]=_0x37fe9c[_0x74bc('0x32')][_0x74bc('0x34')]?_0x37fe9c[_0x74bc('0x32')]:_0x544d44[_0x74bc('0x31')];if(_0x41dc6e[_0x74bc('0x2e')][_0x74bc('0x3e')]){_0x37fe9c[_0x74bc('0x3f')]=[{'all':!![]}];}_0x37fe9c=_[_0x74bc('0x3c')]({},_0x37fe9c,_0x41dc6e[_0x74bc('0x47')]);return db[_0x74bc('0x2a')]['find'](_0x37fe9c)['then'](handleEntityNotFound(_0x154dad,null))[_0x74bc('0x25')](respondWithResult(_0x154dad,null))['catch'](handleError(_0x154dad,null));};exports[_0x74bc('0x48')]=function(_0x4ff047,_0x54b288){return db['SquareMessage'][_0x74bc('0x48')](_0x4ff047[_0x74bc('0x49')],{})[_0x74bc('0x25')](respondWithResult(_0x54b288,0xc9))[_0x74bc('0x42')](handleError(_0x54b288,null));};exports[_0x74bc('0x24')]=function(_0x3b2eaf,_0x53b391){if(_0x3b2eaf[_0x74bc('0x49')]['id']){delete _0x3b2eaf[_0x74bc('0x49')]['id'];}return db['SquareMessage'][_0x74bc('0x4a')]({'where':{'id':_0x3b2eaf[_0x74bc('0x44')]['id']}})[_0x74bc('0x25')](handleEntityNotFound(_0x53b391,null))[_0x74bc('0x25')](saveUpdates(_0x3b2eaf[_0x74bc('0x49')],null))[_0x74bc('0x25')](respondWithResult(_0x53b391,null))[_0x74bc('0x42')](handleError(_0x53b391,null));};exports[_0x74bc('0x4b')]=function(_0x4e97e3,_0x37734e){return db[_0x74bc('0x2a')][_0x74bc('0x4a')]({'where':{'id':_0x4e97e3[_0x74bc('0x44')]['id']}})[_0x74bc('0x25')](handleEntityNotFound(_0x37734e,null))[_0x74bc('0x25')](removeEntity(_0x37734e,null))['catch'](handleError(_0x37734e,null));}; \ No newline at end of file +var _0x5085=['model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','length','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','type','key','query','keys','filters','intersection','attributes'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0x5085,0xe3));var _0x5508=function(_0x285d5e,_0x5b3ae7){_0x285d5e=_0x285d5e-0x0;var _0x514a01=_0x5085[_0x285d5e];return _0x514a01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5508('0x0'));var zipdir=require(_0x5508('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var BPromise=require(_0x5508('0x4'));var Mustache=require(_0x5508('0x5'));var util=require(_0x5508('0x6'));var path=require('path');var sox=require(_0x5508('0x7'));var csv=require('to-csv');var ejs=require(_0x5508('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5508('0x9'));var squel=require('squel');var crypto=require(_0x5508('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5508('0xb'));var toCsv=require(_0x5508('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5508('0xd'));var authService=require(_0x5508('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5508('0xf'));var hardwareService=require(_0x5508('0x10'));var logger=require(_0x5508('0x11'))(_0x5508('0x12'));var utils=require('../../config/utils');var config=require(_0x5508('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124c55,_0x155521){_0x155521=_0x155521||0xcc;return function(_0x42f16d){if(_0x42f16d){return _0x124c55['sendStatus'](_0x155521);}return _0x124c55['status'](_0x155521)['end']();};}function respondWithResult(_0x3e4d0d,_0x4410ac){_0x4410ac=_0x4410ac||0xc8;return function(_0x1a92ac){if(_0x1a92ac){return _0x3e4d0d[_0x5508('0x14')](_0x4410ac)[_0x5508('0x15')](_0x1a92ac);}};}function respondWithFilteredResult(_0x28c7b5,_0x43b5b3){return function(_0x4ef95a){if(_0x4ef95a){var _0x428291=typeof _0x43b5b3[_0x5508('0x16')]===_0x5508('0x17')&&typeof _0x43b5b3[_0x5508('0x18')]===_0x5508('0x17');var _0x734f29=_0x4ef95a['count'];var _0xd80f9b=_0x428291?0x0:_0x43b5b3[_0x5508('0x16')];var _0x2558a7=_0x428291?_0x4ef95a[_0x5508('0x19')]:_0x43b5b3[_0x5508('0x16')]+_0x43b5b3[_0x5508('0x18')];var _0x181228;if(_0x2558a7>=_0x734f29){_0x2558a7=_0x734f29;_0x181228=0xc8;}else{_0x181228=0xce;}_0x28c7b5[_0x5508('0x14')](_0x181228);return _0x28c7b5[_0x5508('0x1a')](_0x5508('0x1b'),_0xd80f9b+'-'+_0x2558a7+'/'+_0x734f29)[_0x5508('0x15')](_0x4ef95a);}return null;};}function patchUpdates(_0x18333b){return function(_0x5dc78d){try{jsonpatch[_0x5508('0x1c')](_0x5dc78d,_0x18333b,!![]);}catch(_0x25d22e){return BPromise[_0x5508('0x1d')](_0x25d22e);}return _0x5dc78d['save']();};}function saveUpdates(_0x2f7811,_0x3f693f){return function(_0xe77339){if(_0xe77339){return _0xe77339[_0x5508('0x1e')](_0x2f7811)[_0x5508('0x1f')](function(_0x164ca2){return _0x164ca2;});}return null;};}function removeEntity(_0x4f1eb4,_0x54724b){return function(_0x220874){if(_0x220874){return _0x220874[_0x5508('0x20')]()[_0x5508('0x1f')](function(){_0x4f1eb4[_0x5508('0x14')](0xcc)[_0x5508('0x21')]();});}};}function handleEntityNotFound(_0x7696af,_0x265a47){return function(_0x437c69){if(!_0x437c69){_0x7696af[_0x5508('0x22')](0x194);}return _0x437c69;};}function handleError(_0x9d13ad,_0x1f553e){_0x1f553e=_0x1f553e||0x1f4;return function(_0x45f9a1){logger[_0x5508('0x23')](_0x45f9a1['stack']);if(_0x45f9a1[_0x5508('0x24')]){delete _0x45f9a1['name'];}_0x9d13ad[_0x5508('0x14')](_0x1f553e)[_0x5508('0x25')](_0x45f9a1);};}exports[_0x5508('0x26')]=function(_0xa0d1a6,_0x5019e6){var _0x10cccd={},_0x289e3c={},_0x47e878={'count':0x0,'rows':[]};var _0x2bef93=_[_0x5508('0x27')](db[_0x5508('0x28')][_0x5508('0x29')],function(_0x25fd9f){return{'name':_0x25fd9f['fieldName'],'type':_0x25fd9f[_0x5508('0x2a')][_0x5508('0x2b')]};});_0x289e3c['model']=_[_0x5508('0x27')](_0x2bef93,_0x5508('0x24'));_0x289e3c[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xa0d1a6[_0x5508('0x2c')]);_0x289e3c[_0x5508('0x2e')]=_[_0x5508('0x2f')](_0x289e3c['model'],_0x289e3c[_0x5508('0x2c')]);_0x10cccd[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x289e3c[_0x5508('0x31')],qs[_0x5508('0x32')](_0xa0d1a6[_0x5508('0x2c')]['fields']));_0x10cccd['attributes']=_0x10cccd[_0x5508('0x30')]['length']?_0x10cccd[_0x5508('0x30')]:_0x289e3c[_0x5508('0x31')];if(!_0xa0d1a6['query'][_0x5508('0x33')]('nolimit')){_0x10cccd[_0x5508('0x18')]=qs[_0x5508('0x18')](_0xa0d1a6[_0x5508('0x2c')][_0x5508('0x18')]);_0x10cccd[_0x5508('0x16')]=qs['offset'](_0xa0d1a6['query']['offset']);}_0x10cccd[_0x5508('0x34')]=qs[_0x5508('0x35')](_0xa0d1a6[_0x5508('0x2c')]['sort']);_0x10cccd[_0x5508('0x36')]=qs[_0x5508('0x2e')](_[_0x5508('0x37')](_0xa0d1a6[_0x5508('0x2c')],_0x289e3c['filters']),_0x2bef93);if(_0xa0d1a6['query'][_0x5508('0x38')]){_0x10cccd['where']=_['merge'](_0x10cccd[_0x5508('0x36')],{'$or':_['map'](_0x2bef93,function(_0x29dabc){if(_0x29dabc[_0x5508('0x2a')]!==_0x5508('0x39')){var _0x59d0aa={};_0x59d0aa[_0x29dabc[_0x5508('0x24')]]={'$like':'%'+_0xa0d1a6['query']['filter']+'%'};return _0x59d0aa;}})});}_0x10cccd=_[_0x5508('0x3a')]({},_0x10cccd,_0xa0d1a6[_0x5508('0x3b')]);var _0x125634={'where':_0x10cccd[_0x5508('0x36')]};return db[_0x5508('0x28')][_0x5508('0x19')](_0x125634)['then'](function(_0x517d47){_0x47e878[_0x5508('0x19')]=_0x517d47;if(_0xa0d1a6['query'][_0x5508('0x3c')]){_0x10cccd[_0x5508('0x3d')]=[{'all':!![]}];}return db[_0x5508('0x28')][_0x5508('0x3e')](_0x10cccd);})[_0x5508('0x1f')](function(_0x4beaa5){_0x47e878['rows']=_0x4beaa5;return _0x47e878;})[_0x5508('0x1f')](respondWithFilteredResult(_0x5019e6,_0x10cccd))[_0x5508('0x3f')](handleError(_0x5019e6,null));};exports['show']=function(_0xd26991,_0x15160f){var _0x3e233b={'raw':!![],'where':{'id':_0xd26991['params']['id']}},_0x4ecd92={};_0x4ecd92[_0x5508('0x31')]=_[_0x5508('0x2d')](db[_0x5508('0x28')][_0x5508('0x29')]);_0x4ecd92[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xd26991['query']);_0x4ecd92['filters']=_['intersection'](_0x4ecd92[_0x5508('0x31')],_0x4ecd92[_0x5508('0x2c')]);_0x3e233b[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x4ecd92[_0x5508('0x31')],qs[_0x5508('0x32')](_0xd26991[_0x5508('0x2c')][_0x5508('0x32')]));_0x3e233b['attributes']=_0x3e233b[_0x5508('0x30')][_0x5508('0x40')]?_0x3e233b['attributes']:_0x4ecd92['model'];if(_0xd26991[_0x5508('0x2c')]['includeAll']){_0x3e233b[_0x5508('0x3d')]=[{'all':!![]}];}_0x3e233b=_['merge']({},_0x3e233b,_0xd26991['options']);return db[_0x5508('0x28')]['find'](_0x3e233b)[_0x5508('0x1f')](handleEntityNotFound(_0x15160f,null))[_0x5508('0x1f')](respondWithResult(_0x15160f,null))['catch'](handleError(_0x15160f,null));};exports[_0x5508('0x41')]=function(_0x111a96,_0x5064cc){return db[_0x5508('0x28')][_0x5508('0x41')](_0x111a96[_0x5508('0x42')],{})['then'](respondWithResult(_0x5064cc,0xc9))[_0x5508('0x3f')](handleError(_0x5064cc,null));};exports[_0x5508('0x1e')]=function(_0x45b1b1,_0x2aac3f){if(_0x45b1b1[_0x5508('0x42')]['id']){delete _0x45b1b1[_0x5508('0x42')]['id'];}return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x45b1b1[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x2aac3f,null))[_0x5508('0x1f')](saveUpdates(_0x45b1b1[_0x5508('0x42')],null))['then'](respondWithResult(_0x2aac3f,null))[_0x5508('0x3f')](handleError(_0x2aac3f,null));};exports[_0x5508('0x20')]=function(_0x242219,_0x4fab07){return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x242219[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x4fab07,null))[_0x5508('0x1f')](removeEntity(_0x4fab07,null))[_0x5508('0x3f')](handleError(_0x4fab07,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 274d881..9ac1af5 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 _0xe7b5=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes'];(function(_0x321f6b,_0x2c105e){var _0x3e8a36=function(_0x1b466b){while(--_0x1b466b){_0x321f6b['push'](_0x321f6b['shift']());}};_0x3e8a36(++_0x2c105e);}(_0xe7b5,0xc8));var _0x5e7b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe7b5[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var logger=require(_0x5e7b('0x2'))(_0x5e7b('0x3'));var moment=require(_0x5e7b('0x4'));var BPromise=require(_0x5e7b('0x5'));var rp=require(_0x5e7b('0x6'));var fs=require('fs');var path=require(_0x5e7b('0x7'));var rimraf=require('rimraf');var config=require(_0x5e7b('0x8'));var attributes=require(_0x5e7b('0x9'));module[_0x5e7b('0xa')]=function(_0x13f900,_0x50dbec){return _0x13f900[_0x5e7b('0xb')](_0x5e7b('0xc'),attributes,{'tableName':_0x5e7b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd11e=['rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages','util','api','moment','request-promise','path'];(function(_0x1d2e88,_0x410d1d){var _0x42794b=function(_0x292a66){while(--_0x292a66){_0x1d2e88['push'](_0x1d2e88['shift']());}};_0x42794b(++_0x410d1d);}(_0xd11e,0x1ef));var _0xed11=function(_0x4835be,_0x37ee12){_0x4835be=_0x4835be-0x0;var _0x57534a=_0xd11e[_0x4835be];return _0x57534a;};'use strict';var _=require('lodash');var util=require(_0xed11('0x0'));var logger=require('../../config/logger')(_0xed11('0x1'));var moment=require(_0xed11('0x2'));var BPromise=require('bluebird');var rp=require(_0xed11('0x3'));var fs=require('fs');var path=require(_0xed11('0x4'));var rimraf=require(_0xed11('0x5'));var config=require(_0xed11('0x6'));var attributes=require(_0xed11('0x7'));module[_0xed11('0x8')]=function(_0x4d1bbe,_0x510bd7){return _0x4d1bbe['define']('SquareMessage',attributes,{'tableName':_0xed11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index c11a868..3a7e1e0 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 _0x3780=['http','request','then','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x52b408,_0x1811ba){var _0x23f8c8=function(_0x47f76b){while(--_0x47f76b){_0x52b408['push'](_0x52b408['shift']());}};_0x23f8c8(++_0x1811ba);}(_0x3780,0x13d));var _0x0378=function(_0x43b609,_0xcf0924){_0x43b609=_0x43b609-0x0;var _0x5d4cef=_0x3780[_0x43b609];return _0x5d4cef;};'use strict';var _=require(_0x0378('0x0'));var util=require('util');var moment=require(_0x0378('0x1'));var BPromise=require(_0x0378('0x2'));var rs=require(_0x0378('0x3'));var fs=require('fs');var Redis=require(_0x0378('0x4'));var db=require(_0x0378('0x5'))['db'];var utils=require(_0x0378('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0378('0x7')][_0x0378('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5953b0,_0x48a1bf,_0x2792a8){return new BPromise(function(_0xad9313,_0x34e493){return client[_0x0378('0x9')](_0x5953b0,_0x2792a8)[_0x0378('0xa')](function(_0x1ab640){logger[_0x0378('0xb')]('SquareMessage,\x20%s,\x20%s',_0x48a1bf,_0x0378('0xc'));logger[_0x0378('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x48a1bf,'request\x20sent',JSON[_0x0378('0xe')](_0x1ab640));if(_0x1ab640[_0x0378('0xf')]){if(_0x1ab640[_0x0378('0xf')][_0x0378('0x10')]===0x1f4){logger[_0x0378('0xf')](_0x0378('0x11'),_0x48a1bf,_0x1ab640[_0x0378('0xf')][_0x0378('0x12')]);return _0x34e493(_0x1ab640[_0x0378('0xf')][_0x0378('0x12')]);}logger[_0x0378('0xf')](_0x0378('0x11'),_0x48a1bf,_0x1ab640[_0x0378('0xf')][_0x0378('0x12')]);return _0xad9313(_0x1ab640['error'][_0x0378('0x12')]);}else{logger[_0x0378('0xb')](_0x0378('0x11'),_0x48a1bf,_0x0378('0xc'));_0xad9313(_0x1ab640[_0x0378('0x13')][_0x0378('0x12')]);}})[_0x0378('0x14')](function(_0x32f7be){logger['error'](_0x0378('0x11'),_0x48a1bf,_0x32f7be);_0x34e493(_0x32f7be);});});}exports[_0x0378('0x15')]=function(_0xf2c548){var _0x4ac9f0=this;return new Promise(function(_0x77bdbd,_0x2cf94a){return db[_0x0378('0x16')][_0x0378('0x17')](_0xf2c548['body'],{'raw':_0xf2c548[_0x0378('0x18')]?_0xf2c548[_0x0378('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0378('0xa')](function(_0x12d31f){logger[_0x0378('0xb')]('CreateSquareMessage',_0xf2c548);logger[_0x0378('0xd')](_0x0378('0x15'),_0xf2c548,JSON[_0x0378('0xe')](_0x12d31f));_0x77bdbd(_0x12d31f);})['catch'](function(_0x1d9f2b){logger[_0x0378('0xf')](_0x0378('0x15'),_0x1d9f2b['message'],_0xf2c548);_0x2cf94a(_0x4ac9f0['error'](0x1f4,_0x1d9f2b['message']));});});}; \ No newline at end of file +var _0xc559=['catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x480193,_0x3e1ce7){var _0x3eb05f=function(_0xf24102){while(--_0xf24102){_0x480193['push'](_0x480193['shift']());}};_0x3eb05f(++_0x3e1ce7);}(_0xc559,0x18e));var _0x9c55=function(_0x5274ca,_0x1a7745){_0x5274ca=_0x5274ca-0x0;var _0x3d274d=_0xc559[_0x5274ca];return _0x3d274d;};'use strict';var _=require(_0x9c55('0x0'));var util=require(_0x9c55('0x1'));var moment=require('moment');var BPromise=require(_0x9c55('0x2'));var rs=require(_0x9c55('0x3'));var fs=require('fs');var Redis=require(_0x9c55('0x4'));var db=require(_0x9c55('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c55('0x6'))(_0x9c55('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9c55('0x8')][_0x9c55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58b923,_0x4f03cc,_0x68384b){return new BPromise(function(_0x4478dd,_0x4013db){return client[_0x9c55('0xa')](_0x58b923,_0x68384b)[_0x9c55('0xb')](function(_0xbd3a86){logger[_0x9c55('0xc')](_0x9c55('0xd'),_0x4f03cc,'request\x20sent');logger[_0x9c55('0xe')](_0x9c55('0xf'),_0x4f03cc,'request\x20sent',JSON[_0x9c55('0x10')](_0xbd3a86));if(_0xbd3a86[_0x9c55('0x11')]){if(_0xbd3a86[_0x9c55('0x11')][_0x9c55('0x12')]===0x1f4){logger[_0x9c55('0x11')](_0x9c55('0xd'),_0x4f03cc,_0xbd3a86[_0x9c55('0x11')]['message']);return _0x4013db(_0xbd3a86[_0x9c55('0x11')][_0x9c55('0x13')]);}logger['error'](_0x9c55('0xd'),_0x4f03cc,_0xbd3a86[_0x9c55('0x11')][_0x9c55('0x13')]);return _0x4478dd(_0xbd3a86[_0x9c55('0x11')][_0x9c55('0x13')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x4f03cc,_0x9c55('0x14'));_0x4478dd(_0xbd3a86[_0x9c55('0x15')]['message']);}})[_0x9c55('0x16')](function(_0x16d1d6){logger[_0x9c55('0x11')](_0x9c55('0xd'),_0x4f03cc,_0x16d1d6);_0x4013db(_0x16d1d6);});});}exports[_0x9c55('0x17')]=function(_0x2b556c){var _0x58e56c=this;return new Promise(function(_0x1bbddb,_0x167141){return db[_0x9c55('0x18')][_0x9c55('0x19')](_0x2b556c[_0x9c55('0x1a')],{'raw':_0x2b556c[_0x9c55('0x1b')]?_0x2b556c[_0x9c55('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1d34bc){logger['info'](_0x9c55('0x17'),_0x2b556c);logger[_0x9c55('0xe')](_0x9c55('0x17'),_0x2b556c,JSON[_0x9c55('0x10')](_0x1d34bc));_0x1bbddb(_0x1d34bc);})[_0x9c55('0x16')](function(_0x419d8b){logger[_0x9c55('0x11')](_0x9c55('0x17'),_0x419d8b['message'],_0x2b556c);_0x167141(_0x58e56c[_0x9c55('0x11')](0x1f4,_0x419d8b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ab01c2f..20d7c7a 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 _0xf57d=['connect-timeout','express','Router','fs-extra','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','delete','destroy','multer','util','path'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0xf57d,0x11b));var _0xdf57=function(_0x337c33,_0x508d9a){_0x337c33=_0x337c33-0x0;var _0x23f2da=_0xf57d[_0x337c33];return _0x23f2da;};'use strict';var multer=require(_0xdf57('0x0'));var util=require(_0xdf57('0x1'));var path=require(_0xdf57('0x2'));var timeout=require(_0xdf57('0x3'));var express=require(_0xdf57('0x4'));var router=express[_0xdf57('0x5')]();var fs_extra=require(_0xdf57('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf57('0x7'));router[_0xdf57('0x8')]('/',auth[_0xdf57('0x9')](),controller[_0xdf57('0xa')]);router[_0xdf57('0x8')](_0xdf57('0xb'),auth[_0xdf57('0x9')](),controller[_0xdf57('0xc')]);router[_0xdf57('0x8')](_0xdf57('0xd'),auth[_0xdf57('0x9')](),timeout(_0xdf57('0xe')),controller[_0xdf57('0xf')]);router[_0xdf57('0x10')]('/',auth[_0xdf57('0x9')](),controller[_0xdf57('0x11')]);router[_0xdf57('0x12')](_0xdf57('0xb'),auth[_0xdf57('0x9')](),controller[_0xdf57('0x13')]);router[_0xdf57('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdf57('0x15')]);module['exports']=router; \ No newline at end of file +var _0x52cd=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','post','put','update','delete','exports'];(function(_0x4822bd,_0xbcc68c){var _0x4fbfa4=function(_0x13eef0){while(--_0x13eef0){_0x4822bd['push'](_0x4822bd['shift']());}};_0x4fbfa4(++_0xbcc68c);}(_0x52cd,0x1ee));var _0xd52c=function(_0x4987e4,_0x301041){_0x4987e4=_0x4987e4-0x0;var _0x1ef57e=_0x52cd[_0x4987e4];return _0x1ef57e;};'use strict';var multer=require(_0xd52c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd52c('0x1'));var express=require('express');var router=express[_0xd52c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd52c('0x3'));var interaction=require(_0xd52c('0x4'));var config=require(_0xd52c('0x5'));var controller=require(_0xd52c('0x6'));router[_0xd52c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd52c('0x7')](_0xd52c('0x8'),auth[_0xd52c('0x9')](),controller[_0xd52c('0xa')]);router[_0xd52c('0x7')](_0xd52c('0xb'),auth[_0xd52c('0x9')](),timeout(_0xd52c('0xc')),controller[_0xd52c('0xd')]);router[_0xd52c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd52c('0xf')](_0xd52c('0x8'),auth['isAuthenticated'](),controller[_0xd52c('0x10')]);router[_0xd52c('0x11')](_0xd52c('0x8'),auth[_0xd52c('0x9')](),controller['destroy']);module[_0xd52c('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bd020cd..cd51fe2 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 _0x37ed=['exports','STRING'];(function(_0x4e4d5c,_0x25dd3a){var _0x56854a=function(_0x221d35){while(--_0x221d35){_0x4e4d5c['push'](_0x4e4d5c['shift']());}};_0x56854a(++_0x25dd3a);}(_0x37ed,0x1c2));var _0xd37e=function(_0x3d4948,_0x7b5e60){_0x3d4948=_0x3d4948-0x0;var _0x1a875d=_0x37ed[_0x3d4948];return _0x1a875d;};'use strict';var Sequelize=require('sequelize');module[_0xd37e('0x0')]={'name':{'type':Sequelize[_0xd37e('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd37e('0x1')]}}; \ No newline at end of file +var _0xadae=['exports','name','STRING','sequelize'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0xadae,0x103));var _0xeada=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xadae[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xeada('0x0'));module[_0xeada('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeada('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xeada('0x3')]},'description':{'type':Sequelize[_0xeada('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0a020e1..dca8966 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 _0x06f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','catch','params','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x20eb5f,_0x413642){var _0x5882af=function(_0x1540ed){while(--_0x1540ed){_0x20eb5f['push'](_0x20eb5f['shift']());}};_0x5882af(++_0x413642);}(_0x06f4,0x143));var _0x406f=function(_0x8f1262,_0x20f05e){_0x8f1262=_0x8f1262-0x0;var _0x2b6a5c=_0x06f4[_0x8f1262];return _0x2b6a5c;};'use strict';var emlformat=require(_0x406f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x406f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x406f('0x2'));var moment=require('moment');var BPromise=require(_0x406f('0x3'));var Mustache=require('mustache');var util=require(_0x406f('0x4'));var path=require(_0x406f('0x5'));var sox=require(_0x406f('0x6'));var csv=require(_0x406f('0x7'));var ejs=require(_0x406f('0x8'));var fs=require('fs');var fs_extra=require(_0x406f('0x9'));var _=require(_0x406f('0xa'));var squel=require('squel');var crypto=require(_0x406f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x406f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x406f('0xd'));var Papa=require(_0x406f('0xe'));var Redis=require(_0x406f('0xf'));var authService=require(_0x406f('0x10'));var qs=require(_0x406f('0x11'));var as=require(_0x406f('0x12'));var hardwareService=require(_0x406f('0x13'));var logger=require(_0x406f('0x14'))(_0x406f('0x15'));var utils=require('../../config/utils');var config=require(_0x406f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x406f('0x17'))['db'];function respondWithStatusCode(_0x3be364,_0x5dec16){_0x5dec16=_0x5dec16||0xcc;return function(_0x35f95e){if(_0x35f95e){return _0x3be364[_0x406f('0x18')](_0x5dec16);}return _0x3be364[_0x406f('0x19')](_0x5dec16)[_0x406f('0x1a')]();};}function respondWithResult(_0x447353,_0x56e7f9){_0x56e7f9=_0x56e7f9||0xc8;return function(_0x45dd2d){if(_0x45dd2d){return _0x447353[_0x406f('0x19')](_0x56e7f9)['json'](_0x45dd2d);}};}function respondWithFilteredResult(_0xc3b83e,_0x561106){return function(_0x1c3c50){if(_0x1c3c50){var _0x3737cf=typeof _0x561106[_0x406f('0x1b')]===_0x406f('0x1c')&&typeof _0x561106['limit']==='undefined';var _0x35f808=_0x1c3c50[_0x406f('0x1d')];var _0x5ea6b4=_0x3737cf?0x0:_0x561106[_0x406f('0x1b')];var _0x25de84=_0x3737cf?_0x1c3c50[_0x406f('0x1d')]:_0x561106['offset']+_0x561106[_0x406f('0x1e')];var _0x32262d;if(_0x25de84>=_0x35f808){_0x25de84=_0x35f808;_0x32262d=0xc8;}else{_0x32262d=0xce;}_0xc3b83e[_0x406f('0x19')](_0x32262d);return _0xc3b83e[_0x406f('0x1f')](_0x406f('0x20'),_0x5ea6b4+'-'+_0x25de84+'/'+_0x35f808)[_0x406f('0x21')](_0x1c3c50);}return null;};}function patchUpdates(_0x28cd94){return function(_0x4240f4){try{jsonpatch[_0x406f('0x22')](_0x4240f4,_0x28cd94,!![]);}catch(_0x4137a8){return BPromise[_0x406f('0x23')](_0x4137a8);}return _0x4240f4[_0x406f('0x24')]();};}function saveUpdates(_0x2a7dd0,_0x3a9a91){return function(_0x98403c){if(_0x98403c){return _0x98403c['update'](_0x2a7dd0)[_0x406f('0x25')](function(_0x374321){return _0x374321;});}return null;};}function removeEntity(_0xef3c39,_0x2acb68){return function(_0x307df6){if(_0x307df6){return _0x307df6[_0x406f('0x26')]()[_0x406f('0x25')](function(){var _0x542c2c=_0x307df6[_0x406f('0x27')]({'plain':!![]});var _0x34a715=_0x406f('0x28');return db[_0x406f('0x29')][_0x406f('0x26')]({'where':{'type':_0x34a715,'resourceId':_0x542c2c['id']}})[_0x406f('0x25')](function(){return _0x307df6;});})[_0x406f('0x25')](function(){_0xef3c39[_0x406f('0x19')](0xcc)[_0x406f('0x1a')]();});}};}function handleEntityNotFound(_0xacdf42,_0x4d6a2d){return function(_0x38b2f6){if(!_0x38b2f6){_0xacdf42[_0x406f('0x18')](0x194);}return _0x38b2f6;};}function handleError(_0x41bdb9,_0x27f5d4){_0x27f5d4=_0x27f5d4||0x1f4;return function(_0x336702){logger[_0x406f('0x2a')](_0x336702[_0x406f('0x2b')]);if(_0x336702[_0x406f('0x2c')]){delete _0x336702[_0x406f('0x2c')];}_0x41bdb9[_0x406f('0x19')](_0x27f5d4)[_0x406f('0x2d')](_0x336702);};}exports[_0x406f('0x2e')]=function(_0xa862e7,_0x1c4833){var _0x495502={},_0x23d7cd={},_0x54cc94={'count':0x0,'rows':[]};var _0x10cb0d=_['map'](db[_0x406f('0x2f')][_0x406f('0x30')],function(_0x2e26ea){return{'name':_0x2e26ea[_0x406f('0x31')],'type':_0x2e26ea[_0x406f('0x32')]['key']};});_0x23d7cd['model']=_['map'](_0x10cb0d,_0x406f('0x2c'));_0x23d7cd[_0x406f('0x33')]=_[_0x406f('0x34')](_0xa862e7[_0x406f('0x33')]);_0x23d7cd[_0x406f('0x35')]=_[_0x406f('0x36')](_0x23d7cd['model'],_0x23d7cd[_0x406f('0x33')]);_0x495502[_0x406f('0x37')]=_[_0x406f('0x36')](_0x23d7cd[_0x406f('0x38')],qs[_0x406f('0x39')](_0xa862e7['query'][_0x406f('0x39')]));_0x495502[_0x406f('0x37')]=_0x495502[_0x406f('0x37')][_0x406f('0x3a')]?_0x495502[_0x406f('0x37')]:_0x23d7cd['model'];if(!_0xa862e7[_0x406f('0x33')][_0x406f('0x3b')](_0x406f('0x3c'))){_0x495502[_0x406f('0x1e')]=qs['limit'](_0xa862e7[_0x406f('0x33')][_0x406f('0x1e')]);_0x495502[_0x406f('0x1b')]=qs[_0x406f('0x1b')](_0xa862e7[_0x406f('0x33')][_0x406f('0x1b')]);}_0x495502[_0x406f('0x3d')]=qs[_0x406f('0x3e')](_0xa862e7[_0x406f('0x33')][_0x406f('0x3e')]);_0x495502[_0x406f('0x3f')]=qs[_0x406f('0x35')](_[_0x406f('0x40')](_0xa862e7[_0x406f('0x33')],_0x23d7cd[_0x406f('0x35')]),_0x10cb0d);if(_0xa862e7[_0x406f('0x33')][_0x406f('0x41')]){_0x495502[_0x406f('0x3f')]=_[_0x406f('0x42')](_0x495502[_0x406f('0x3f')],{'$or':_[_0x406f('0x43')](_0x10cb0d,function(_0x1f0626){if(_0x1f0626[_0x406f('0x32')]!==_0x406f('0x44')){var _0x3eedd7={};_0x3eedd7[_0x1f0626[_0x406f('0x2c')]]={'$like':'%'+_0xa862e7['query'][_0x406f('0x41')]+'%'};return _0x3eedd7;}})});}_0x495502=_[_0x406f('0x42')]({},_0x495502,_0xa862e7['options']);var _0x236bc2={'where':_0x495502[_0x406f('0x3f')]};return db[_0x406f('0x2f')][_0x406f('0x1d')](_0x236bc2)[_0x406f('0x25')](function(_0xb1c8fc){_0x54cc94[_0x406f('0x1d')]=_0xb1c8fc;if(_0xa862e7['query'][_0x406f('0x45')]){_0x495502[_0x406f('0x46')]=[{'all':!![]}];}return db[_0x406f('0x2f')]['findAll'](_0x495502);})[_0x406f('0x25')](function(_0x19932c){_0x54cc94['rows']=_0x19932c;return _0x54cc94;})[_0x406f('0x25')](respondWithFilteredResult(_0x1c4833,_0x495502))[_0x406f('0x47')](handleError(_0x1c4833,null));};exports['show']=function(_0x15161d,_0x1ff806){var _0x3944a9={'raw':!![],'where':{'id':_0x15161d[_0x406f('0x48')]['id']}},_0x1e0f26={};_0x1e0f26[_0x406f('0x38')]=_['keys'](db[_0x406f('0x2f')][_0x406f('0x30')]);_0x1e0f26['query']=_[_0x406f('0x34')](_0x15161d['query']);_0x1e0f26[_0x406f('0x35')]=_[_0x406f('0x36')](_0x1e0f26[_0x406f('0x38')],_0x1e0f26[_0x406f('0x33')]);_0x3944a9['attributes']=_[_0x406f('0x36')](_0x1e0f26[_0x406f('0x38')],qs[_0x406f('0x39')](_0x15161d['query'][_0x406f('0x39')]));_0x3944a9[_0x406f('0x37')]=_0x3944a9[_0x406f('0x37')][_0x406f('0x3a')]?_0x3944a9[_0x406f('0x37')]:_0x1e0f26['model'];if(_0x15161d[_0x406f('0x33')][_0x406f('0x45')]){_0x3944a9[_0x406f('0x46')]=[{'all':!![]}];}_0x3944a9=_['merge']({},_0x3944a9,_0x15161d[_0x406f('0x49')]);return db[_0x406f('0x2f')]['find'](_0x3944a9)[_0x406f('0x25')](handleEntityNotFound(_0x1ff806,null))['then'](respondWithResult(_0x1ff806,null))[_0x406f('0x47')](handleError(_0x1ff806,null));};exports['create']=function(_0x24f740,_0x2aa9bb){return db[_0x406f('0x2f')]['create'](_0x24f740[_0x406f('0x4a')],{})[_0x406f('0x25')](function(_0x59c7ec){var _0x3d160f=_0x24f740[_0x406f('0x4b')]['get']({'plain':!![]});if(!_0x3d160f)throw new Error(_0x406f('0x4c'));if(_0x3d160f['role']===_0x406f('0x4b')){var _0x648d54=_0x59c7ec[_0x406f('0x27')]({'plain':!![]});var _0x5e9427=_0x406f('0x28');return db[_0x406f('0x4d')][_0x406f('0x4e')]({'where':{'name':_0x5e9427,'userProfileId':_0x3d160f['userProfileId']},'raw':!![]})[_0x406f('0x25')](function(_0x38c705){if(_0x38c705&&_0x38c705[_0x406f('0x4f')]===0x0){return db[_0x406f('0x29')][_0x406f('0x50')]({'name':_0x648d54[_0x406f('0x2c')],'resourceId':_0x648d54['id'],'type':_0x38c705[_0x406f('0x2c')],'sectionId':_0x38c705['id']},{})[_0x406f('0x25')](function(){return _0x59c7ec;});}else{return _0x59c7ec;}})[_0x406f('0x47')](function(_0x502d03){logger[_0x406f('0x2a')](_0x406f('0x51'),_0x502d03);throw _0x502d03;});}return _0x59c7ec;})[_0x406f('0x25')](respondWithResult(_0x2aa9bb,0xc9))[_0x406f('0x47')](handleError(_0x2aa9bb,null));};exports[_0x406f('0x52')]=function(_0x2342c7,_0x3b2001){if(_0x2342c7['body']['id']){delete _0x2342c7[_0x406f('0x4a')]['id'];}return db[_0x406f('0x2f')]['find']({'where':{'id':_0x2342c7[_0x406f('0x48')]['id']}})[_0x406f('0x25')](handleEntityNotFound(_0x3b2001,null))[_0x406f('0x25')](saveUpdates(_0x2342c7[_0x406f('0x4a')],null))[_0x406f('0x25')](respondWithResult(_0x3b2001,null))[_0x406f('0x47')](handleError(_0x3b2001,null));};exports[_0x406f('0x26')]=function(_0x4807cc,_0x33e017){return db['SquareOdbc']['find']({'where':{'id':_0x4807cc[_0x406f('0x48')]['id']}})['then'](handleEntityNotFound(_0x33e017,null))[_0x406f('0x25')](removeEntity(_0x33e017,null))[_0x406f('0x47')](handleError(_0x33e017,null));};exports['test']=function(_0x1d503b,_0xfd6d31,_0x3d7401){var _0x50246e;return db[_0x406f('0x2f')][_0x406f('0x4e')]({'where':{'id':_0x1d503b[_0x406f('0x48')]['id']},'attributes':['id',_0x406f('0x53')]})['then'](handleEntityNotFound(_0xfd6d31,null))['then'](function(_0x4e8639){if(_0x4e8639){var _0x3c989b=require(_0x406f('0x54'))();_0x3c989b['openSync'](_0x4e8639['dsn']);_0x3c989b['closeSync']();return _0x4e8639;}})[_0x406f('0x25')](respondWithResult(_0xfd6d31,null))[_0x406f('0x47')](handleError(_0xfd6d31,null));}; \ No newline at end of file +var _0xc4f2=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','odbc','openSync','dsn','closeSync','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','include'];(function(_0x907235,_0x42c8c6){var _0x42dcb9=function(_0x2fd68f){while(--_0x2fd68f){_0x907235['push'](_0x907235['shift']());}};_0x42dcb9(++_0x42c8c6);}(_0xc4f2,0x161));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c4f('0x0'));var zipdir=require(_0x2c4f('0x1'));var jsonpatch=require(_0x2c4f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c4f('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2c4f('0x4'));var csv=require(_0x2c4f('0x5'));var ejs=require(_0x2c4f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c4f('0x7'));var squel=require(_0x2c4f('0x8'));var crypto=require(_0x2c4f('0x9'));var jsforce=require(_0x2c4f('0xa'));var deskjs=require(_0x2c4f('0xb'));var toCsv=require(_0x2c4f('0x5'));var querystring=require('querystring');var Papa=require(_0x2c4f('0xc'));var Redis=require(_0x2c4f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2c4f('0xe'));var as=require(_0x2c4f('0xf'));var hardwareService=require(_0x2c4f('0x10'));var logger=require(_0x2c4f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x2c4f('0x12'));var licenseUtil=require(_0x2c4f('0x13'));var db=require(_0x2c4f('0x14'))['db'];function respondWithStatusCode(_0x1c7fd1,_0x1f4811){_0x1f4811=_0x1f4811||0xcc;return function(_0x4b79d0){if(_0x4b79d0){return _0x1c7fd1[_0x2c4f('0x15')](_0x1f4811);}return _0x1c7fd1[_0x2c4f('0x16')](_0x1f4811)[_0x2c4f('0x17')]();};}function respondWithResult(_0x228920,_0x275ae7){_0x275ae7=_0x275ae7||0xc8;return function(_0x37a5b4){if(_0x37a5b4){return _0x228920[_0x2c4f('0x16')](_0x275ae7)[_0x2c4f('0x18')](_0x37a5b4);}};}function respondWithFilteredResult(_0x5f42cd,_0x232e36){return function(_0x57c3be){if(_0x57c3be){var _0x46ab9f=typeof _0x232e36[_0x2c4f('0x19')]===_0x2c4f('0x1a')&&typeof _0x232e36[_0x2c4f('0x1b')]===_0x2c4f('0x1a');var _0x329672=_0x57c3be[_0x2c4f('0x1c')];var _0x5ed0bb=_0x46ab9f?0x0:_0x232e36['offset'];var _0x114faa=_0x46ab9f?_0x57c3be[_0x2c4f('0x1c')]:_0x232e36['offset']+_0x232e36['limit'];var _0x2ee4ed;if(_0x114faa>=_0x329672){_0x114faa=_0x329672;_0x2ee4ed=0xc8;}else{_0x2ee4ed=0xce;}_0x5f42cd['status'](_0x2ee4ed);return _0x5f42cd[_0x2c4f('0x1d')]('Content-Range',_0x5ed0bb+'-'+_0x114faa+'/'+_0x329672)[_0x2c4f('0x18')](_0x57c3be);}return null;};}function patchUpdates(_0x245379){return function(_0x55b195){try{jsonpatch[_0x2c4f('0x1e')](_0x55b195,_0x245379,!![]);}catch(_0xf62196){return BPromise[_0x2c4f('0x1f')](_0xf62196);}return _0x55b195['save']();};}function saveUpdates(_0xb6d81d,_0x2659af){return function(_0x5a12e7){if(_0x5a12e7){return _0x5a12e7[_0x2c4f('0x20')](_0xb6d81d)[_0x2c4f('0x21')](function(_0x2dcc36){return _0x2dcc36;});}return null;};}function removeEntity(_0x204902,_0x4e04e5){return function(_0x4ea904){if(_0x4ea904){return _0x4ea904[_0x2c4f('0x22')]()['then'](function(){var _0x3681d9=_0x4ea904[_0x2c4f('0x23')]({'plain':!![]});var _0x2d60e1=_0x2c4f('0x24');return db[_0x2c4f('0x25')][_0x2c4f('0x22')]({'where':{'type':_0x2d60e1,'resourceId':_0x3681d9['id']}})['then'](function(){return _0x4ea904;});})['then'](function(){_0x204902[_0x2c4f('0x16')](0xcc)[_0x2c4f('0x17')]();});}};}function handleEntityNotFound(_0x379051,_0x588132){return function(_0x1856b5){if(!_0x1856b5){_0x379051[_0x2c4f('0x15')](0x194);}return _0x1856b5;};}function handleError(_0x1630f4,_0x464d88){_0x464d88=_0x464d88||0x1f4;return function(_0x26e6e6){logger[_0x2c4f('0x26')](_0x26e6e6[_0x2c4f('0x27')]);if(_0x26e6e6[_0x2c4f('0x28')]){delete _0x26e6e6[_0x2c4f('0x28')];}_0x1630f4[_0x2c4f('0x16')](_0x464d88)['send'](_0x26e6e6);};}exports[_0x2c4f('0x29')]=function(_0x3f73ec,_0x2d3c6e){var _0x4dc60b={},_0x38c92e={},_0x1de952={'count':0x0,'rows':[]};var _0x6263ac=_[_0x2c4f('0x2a')](db[_0x2c4f('0x2b')][_0x2c4f('0x2c')],function(_0xd1c411){return{'name':_0xd1c411[_0x2c4f('0x2d')],'type':_0xd1c411[_0x2c4f('0x2e')][_0x2c4f('0x2f')]};});_0x38c92e[_0x2c4f('0x30')]=_[_0x2c4f('0x2a')](_0x6263ac,'name');_0x38c92e['query']=_[_0x2c4f('0x31')](_0x3f73ec['query']);_0x38c92e[_0x2c4f('0x32')]=_['intersection'](_0x38c92e[_0x2c4f('0x30')],_0x38c92e['query']);_0x4dc60b[_0x2c4f('0x33')]=_['intersection'](_0x38c92e[_0x2c4f('0x30')],qs[_0x2c4f('0x34')](_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x34')]));_0x4dc60b[_0x2c4f('0x33')]=_0x4dc60b['attributes'][_0x2c4f('0x36')]?_0x4dc60b[_0x2c4f('0x33')]:_0x38c92e[_0x2c4f('0x30')];if(!_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x37')](_0x2c4f('0x38'))){_0x4dc60b[_0x2c4f('0x1b')]=qs[_0x2c4f('0x1b')](_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x1b')]);_0x4dc60b[_0x2c4f('0x19')]=qs[_0x2c4f('0x19')](_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x19')]);}_0x4dc60b[_0x2c4f('0x39')]=qs[_0x2c4f('0x3a')](_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x3a')]);_0x4dc60b[_0x2c4f('0x3b')]=qs[_0x2c4f('0x32')](_[_0x2c4f('0x3c')](_0x3f73ec[_0x2c4f('0x35')],_0x38c92e[_0x2c4f('0x32')]),_0x6263ac);if(_0x3f73ec[_0x2c4f('0x35')][_0x2c4f('0x3d')]){_0x4dc60b['where']=_[_0x2c4f('0x3e')](_0x4dc60b[_0x2c4f('0x3b')],{'$or':_['map'](_0x6263ac,function(_0xa2bc23){if(_0xa2bc23[_0x2c4f('0x2e')]!==_0x2c4f('0x3f')){var _0x39f28d={};_0x39f28d[_0xa2bc23['name']]={'$like':'%'+_0x3f73ec['query'][_0x2c4f('0x3d')]+'%'};return _0x39f28d;}})});}_0x4dc60b=_[_0x2c4f('0x3e')]({},_0x4dc60b,_0x3f73ec[_0x2c4f('0x40')]);var _0x3509e5={'where':_0x4dc60b[_0x2c4f('0x3b')]};return db[_0x2c4f('0x2b')][_0x2c4f('0x1c')](_0x3509e5)[_0x2c4f('0x21')](function(_0x4eaf36){_0x1de952['count']=_0x4eaf36;if(_0x3f73ec['query'][_0x2c4f('0x41')]){_0x4dc60b['include']=[{'all':!![]}];}return db[_0x2c4f('0x2b')][_0x2c4f('0x42')](_0x4dc60b);})['then'](function(_0x4f84a2){_0x1de952[_0x2c4f('0x43')]=_0x4f84a2;return _0x1de952;})[_0x2c4f('0x21')](respondWithFilteredResult(_0x2d3c6e,_0x4dc60b))['catch'](handleError(_0x2d3c6e,null));};exports[_0x2c4f('0x44')]=function(_0x228005,_0x4300f6){var _0x370674={'raw':!![],'where':{'id':_0x228005[_0x2c4f('0x45')]['id']}},_0x282267={};_0x282267[_0x2c4f('0x30')]=_[_0x2c4f('0x31')](db['SquareOdbc'][_0x2c4f('0x2c')]);_0x282267[_0x2c4f('0x35')]=_['keys'](_0x228005['query']);_0x282267[_0x2c4f('0x32')]=_[_0x2c4f('0x46')](_0x282267[_0x2c4f('0x30')],_0x282267[_0x2c4f('0x35')]);_0x370674['attributes']=_[_0x2c4f('0x46')](_0x282267[_0x2c4f('0x30')],qs['fields'](_0x228005['query'][_0x2c4f('0x34')]));_0x370674['attributes']=_0x370674[_0x2c4f('0x33')]['length']?_0x370674['attributes']:_0x282267[_0x2c4f('0x30')];if(_0x228005[_0x2c4f('0x35')][_0x2c4f('0x41')]){_0x370674[_0x2c4f('0x47')]=[{'all':!![]}];}_0x370674=_[_0x2c4f('0x3e')]({},_0x370674,_0x228005[_0x2c4f('0x40')]);return db[_0x2c4f('0x2b')][_0x2c4f('0x48')](_0x370674)[_0x2c4f('0x21')](handleEntityNotFound(_0x4300f6,null))[_0x2c4f('0x21')](respondWithResult(_0x4300f6,null))[_0x2c4f('0x49')](handleError(_0x4300f6,null));};exports['create']=function(_0x48226a,_0x13cc34){return db[_0x2c4f('0x2b')][_0x2c4f('0x4a')](_0x48226a[_0x2c4f('0x4b')],{})['then'](function(_0x38b26a){var _0x227368=_0x48226a[_0x2c4f('0x4c')][_0x2c4f('0x23')]({'plain':!![]});if(!_0x227368)throw new Error(_0x2c4f('0x4d'));if(_0x227368['role']==='user'){var _0x659bcc=_0x38b26a['get']({'plain':!![]});var _0x99c844=_0x2c4f('0x24');return db[_0x2c4f('0x4e')][_0x2c4f('0x48')]({'where':{'name':_0x99c844,'userProfileId':_0x227368[_0x2c4f('0x4f')]},'raw':!![]})[_0x2c4f('0x21')](function(_0x5c631e){if(_0x5c631e&&_0x5c631e[_0x2c4f('0x50')]===0x0){return db[_0x2c4f('0x25')][_0x2c4f('0x4a')]({'name':_0x659bcc[_0x2c4f('0x28')],'resourceId':_0x659bcc['id'],'type':_0x5c631e[_0x2c4f('0x28')],'sectionId':_0x5c631e['id']},{})[_0x2c4f('0x21')](function(){return _0x38b26a;});}else{return _0x38b26a;}})[_0x2c4f('0x49')](function(_0x475f34){logger[_0x2c4f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x475f34);throw _0x475f34;});}return _0x38b26a;})['then'](respondWithResult(_0x13cc34,0xc9))[_0x2c4f('0x49')](handleError(_0x13cc34,null));};exports[_0x2c4f('0x20')]=function(_0x9ef760,_0x1852c3){if(_0x9ef760[_0x2c4f('0x4b')]['id']){delete _0x9ef760[_0x2c4f('0x4b')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x9ef760['params']['id']}})[_0x2c4f('0x21')](handleEntityNotFound(_0x1852c3,null))['then'](saveUpdates(_0x9ef760[_0x2c4f('0x4b')],null))['then'](respondWithResult(_0x1852c3,null))[_0x2c4f('0x49')](handleError(_0x1852c3,null));};exports[_0x2c4f('0x22')]=function(_0x10a382,_0x23a4a8){return db[_0x2c4f('0x2b')]['find']({'where':{'id':_0x10a382[_0x2c4f('0x45')]['id']}})[_0x2c4f('0x21')](handleEntityNotFound(_0x23a4a8,null))[_0x2c4f('0x21')](removeEntity(_0x23a4a8,null))[_0x2c4f('0x49')](handleError(_0x23a4a8,null));};exports['test']=function(_0x3101a4,_0x51b0da,_0x2c6da4){var _0x74a637;return db[_0x2c4f('0x2b')]['find']({'where':{'id':_0x3101a4[_0x2c4f('0x45')]['id']},'attributes':['id','dsn']})[_0x2c4f('0x21')](handleEntityNotFound(_0x51b0da,null))['then'](function(_0x2df8ab){if(_0x2df8ab){var _0x118fb6=require(_0x2c4f('0x51'))();_0x118fb6[_0x2c4f('0x52')](_0x2df8ab[_0x2c4f('0x53')]);_0x118fb6[_0x2c4f('0x54')]();return _0x2df8ab;}})[_0x2c4f('0x21')](respondWithResult(_0x51b0da,null))[_0x2c4f('0x49')](handleError(_0x51b0da,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index cd09685..2e3acb7 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 _0xa32d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc'];(function(_0x33ddea,_0x222f65){var _0x5e2f59=function(_0x15bf02){while(--_0x15bf02){_0x33ddea['push'](_0x33ddea['shift']());}};_0x5e2f59(++_0x222f65);}(_0xa32d,0x68));var _0xda32=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa32d[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0xda32('0x0'));var util=require(_0xda32('0x1'));var logger=require(_0xda32('0x2'))(_0xda32('0x3'));var moment=require('moment');var BPromise=require(_0xda32('0x4'));var rp=require(_0xda32('0x5'));var fs=require('fs');var path=require(_0xda32('0x6'));var rimraf=require(_0xda32('0x7'));var config=require(_0xda32('0x8'));var attributes=require(_0xda32('0x9'));module[_0xda32('0xa')]=function(_0x50efff,_0x13f4b8){return _0x50efff['define'](_0xda32('0xb'),attributes,{'tableName':_0xda32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb4=['rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','path'];(function(_0x5c5e34,_0x2e3f93){var _0x16c7c9=function(_0x2050bf){while(--_0x2050bf){_0x5c5e34['push'](_0x5c5e34['shift']());}};_0x16c7c9(++_0x2e3f93);}(_0x8cb4,0xae));var _0x48cb=function(_0x21d66c,_0x1d9d57){_0x21d66c=_0x21d66c-0x0;var _0x3f1e06=_0x8cb4[_0x21d66c];return _0x3f1e06;};'use strict';var _=require(_0x48cb('0x0'));var util=require(_0x48cb('0x1'));var logger=require(_0x48cb('0x2'))(_0x48cb('0x3'));var moment=require(_0x48cb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48cb('0x5'));var rimraf=require(_0x48cb('0x6'));var config=require(_0x48cb('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x48cb('0x8')]=function(_0x10d833,_0x2c8209){return _0x10d833[_0x48cb('0x9')](_0x48cb('0xa'),attributes,{'tableName':_0x48cb('0xb'),'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 2d96100..5768232 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 _0x004b=['client','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x39c056,_0x2f3a95){var _0x429dc7=function(_0x41ebb7){while(--_0x41ebb7){_0x39c056['push'](_0x39c056['shift']());}};_0x429dc7(++_0x2f3a95);}(_0x004b,0xcb));var _0xb004=function(_0x513727,_0x50370e){_0x513727=_0x513727-0x0;var _0x5b982a=_0x004b[_0x513727];return _0x5b982a;};'use strict';var _=require(_0xb004('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb004('0x1'));var rs=require(_0xb004('0x2'));var fs=require('fs');var Redis=require(_0xb004('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb004('0x4'));var config=require(_0xb004('0x5'));var jayson=require(_0xb004('0x6'));var client=jayson[_0xb004('0x7')][_0xb004('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bd59d,_0x1e749e,_0x75f20d){return new BPromise(function(_0x3457b5,_0x24866a){return client[_0xb004('0x9')](_0x2bd59d,_0x75f20d)[_0xb004('0xa')](function(_0x1293a5){logger[_0xb004('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x1e749e,'request\x20sent');logger[_0xb004('0xc')](_0xb004('0xd'),_0x1e749e,_0xb004('0xe'),JSON[_0xb004('0xf')](_0x1293a5));if(_0x1293a5[_0xb004('0x10')]){if(_0x1293a5[_0xb004('0x10')]['code']===0x1f4){logger[_0xb004('0x10')](_0xb004('0x11'),_0x1e749e,_0x1293a5[_0xb004('0x10')][_0xb004('0x12')]);return _0x24866a(_0x1293a5[_0xb004('0x10')]['message']);}logger[_0xb004('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x1e749e,_0x1293a5[_0xb004('0x10')][_0xb004('0x12')]);return _0x3457b5(_0x1293a5['error'][_0xb004('0x12')]);}else{logger[_0xb004('0xb')](_0xb004('0x11'),_0x1e749e,_0xb004('0xe'));_0x3457b5(_0x1293a5[_0xb004('0x13')][_0xb004('0x12')]);}})[_0xb004('0x14')](function(_0x563dc9){logger[_0xb004('0x10')](_0xb004('0x11'),_0x1e749e,_0x563dc9);_0x24866a(_0x563dc9);});});}exports[_0xb004('0x15')]=function(_0x5396c2){var _0x3b4d37=this;return new Promise(function(_0x3a6b28,_0x1cc655){return db[_0xb004('0x16')][_0xb004('0x17')]({'raw':_0x5396c2[_0xb004('0x18')]?_0x5396c2[_0xb004('0x18')][_0xb004('0x19')]===undefined?!![]:![]:!![],'where':_0x5396c2[_0xb004('0x18')]?_0x5396c2[_0xb004('0x18')]['where']||null:null,'attributes':_0x5396c2['options']?_0x5396c2[_0xb004('0x18')][_0xb004('0x1a')]||null:null,'include':_0x5396c2['options']?_0x5396c2[_0xb004('0x18')]['include']?_['map'](_0x5396c2[_0xb004('0x18')][_0xb004('0x1b')],function(_0x5e8bc0){return{'model':db[_0x5e8bc0['model']],'as':_0x5e8bc0['as'],'attributes':_0x5e8bc0[_0xb004('0x1a')],'include':_0x5e8bc0['include']?_[_0xb004('0x1c')](_0x5e8bc0[_0xb004('0x1b')],function(_0x1827cb){return{'model':db[_0x1827cb[_0xb004('0x1d')]],'as':_0x1827cb['as'],'attributes':_0x1827cb[_0xb004('0x1a')],'include':_0x1827cb[_0xb004('0x1b')]?_[_0xb004('0x1c')](_0x1827cb[_0xb004('0x1b')],function(_0x1aab42){return{'model':db[_0x1aab42['model']],'as':_0x1aab42['as'],'attributes':_0x1aab42[_0xb004('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb004('0xa')](function(_0x25ecc4){logger[_0xb004('0xb')](_0xb004('0x15'),_0x5396c2);logger[_0xb004('0xc')](_0xb004('0x15'),_0x5396c2,JSON[_0xb004('0xf')](_0x25ecc4));_0x3a6b28(_0x25ecc4);})[_0xb004('0x14')](function(_0x4dd855){logger['error'](_0xb004('0x15'),_0x4dd855[_0xb004('0x12')],_0x5396c2);_0x1cc655(_0x3b4d37[_0xb004('0x10')](0x1f4,_0x4dd855[_0xb004('0x12')]));});});}; \ No newline at end of file +var _0x91a5=['debug','error','message','info','result','SquareOdbc','options','raw','attributes','include','map','model','ShowSquareOdbc','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x21f70b,_0x47501e){var _0x153b64=function(_0x30694d){while(--_0x30694d){_0x21f70b['push'](_0x21f70b['shift']());}};_0x153b64(++_0x47501e);}(_0x91a5,0x7f));var _0x591a=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x91a5[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var moment=require(_0x591a('0x2'));var BPromise=require('bluebird');var rs=require(_0x591a('0x3'));var fs=require('fs');var Redis=require(_0x591a('0x4'));var db=require(_0x591a('0x5'))['db'];var utils=require(_0x591a('0x6'));var logger=require(_0x591a('0x7'))(_0x591a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x591a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b5d3,_0x311fbb,_0x1f1d31){return new BPromise(function(_0x1c1a36,_0x3cb07e){return client['request'](_0x59b5d3,_0x1f1d31)[_0x591a('0xa')](function(_0x2d4e64){logger['info'](_0x591a('0xb'),_0x311fbb,_0x591a('0xc'));logger[_0x591a('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x311fbb,_0x591a('0xc'),JSON['stringify'](_0x2d4e64));if(_0x2d4e64[_0x591a('0xe')]){if(_0x2d4e64[_0x591a('0xe')]['code']===0x1f4){logger[_0x591a('0xe')](_0x591a('0xb'),_0x311fbb,_0x2d4e64['error'][_0x591a('0xf')]);return _0x3cb07e(_0x2d4e64[_0x591a('0xe')]['message']);}logger[_0x591a('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x311fbb,_0x2d4e64[_0x591a('0xe')][_0x591a('0xf')]);return _0x1c1a36(_0x2d4e64[_0x591a('0xe')][_0x591a('0xf')]);}else{logger[_0x591a('0x10')](_0x591a('0xb'),_0x311fbb,_0x591a('0xc'));_0x1c1a36(_0x2d4e64[_0x591a('0x11')][_0x591a('0xf')]);}})['catch'](function(_0x437c63){logger['error'](_0x591a('0xb'),_0x311fbb,_0x437c63);_0x3cb07e(_0x437c63);});});}exports['ShowSquareOdbc']=function(_0xa48397){var _0xf53e2b=this;return new Promise(function(_0x1217b0,_0x447489){return db[_0x591a('0x12')]['find']({'raw':_0xa48397[_0x591a('0x13')]?_0xa48397['options'][_0x591a('0x14')]===undefined?!![]:![]:!![],'where':_0xa48397[_0x591a('0x13')]?_0xa48397[_0x591a('0x13')]['where']||null:null,'attributes':_0xa48397[_0x591a('0x13')]?_0xa48397[_0x591a('0x13')][_0x591a('0x15')]||null:null,'include':_0xa48397[_0x591a('0x13')]?_0xa48397[_0x591a('0x13')][_0x591a('0x16')]?_[_0x591a('0x17')](_0xa48397[_0x591a('0x13')][_0x591a('0x16')],function(_0x1fe5be){return{'model':db[_0x1fe5be[_0x591a('0x18')]],'as':_0x1fe5be['as'],'attributes':_0x1fe5be[_0x591a('0x15')],'include':_0x1fe5be['include']?_[_0x591a('0x17')](_0x1fe5be[_0x591a('0x16')],function(_0x59dfb6){return{'model':db[_0x59dfb6[_0x591a('0x18')]],'as':_0x59dfb6['as'],'attributes':_0x59dfb6[_0x591a('0x15')],'include':_0x59dfb6['include']?_[_0x591a('0x17')](_0x59dfb6['include'],function(_0x585ab5){return{'model':db[_0x585ab5[_0x591a('0x18')]],'as':_0x585ab5['as'],'attributes':_0x585ab5[_0x591a('0x15')]};}):[]};}):[]};}):[]:[]})[_0x591a('0xa')](function(_0x363d99){logger[_0x591a('0x10')](_0x591a('0x19'),_0xa48397);logger[_0x591a('0xd')](_0x591a('0x19'),_0xa48397,JSON[_0x591a('0x1a')](_0x363d99));_0x1217b0(_0x363d99);})[_0x591a('0x1b')](function(_0x50484d){logger[_0x591a('0xe')](_0x591a('0x19'),_0x50484d[_0x591a('0xf')],_0xa48397);_0x447489(_0xf53e2b['error'](0x1f4,_0x50484d[_0x591a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c29e0fb..dbd95da 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 _0x843e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer','util','path'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x843e,0xcd));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe843('0x0'));var util=require(_0xe843('0x1'));var path=require(_0xe843('0x2'));var timeout=require(_0xe843('0x3'));var express=require('express');var router=express[_0xe843('0x4')]();var fs_extra=require(_0xe843('0x5'));var auth=require(_0xe843('0x6'));var interaction=require(_0xe843('0x7'));var config=require(_0xe843('0x8'));var controller=require(_0xe843('0x9'));router[_0xe843('0xa')]('/',auth['isAuthenticated'](),controller[_0xe843('0xb')]);router[_0xe843('0xa')]('/:id',auth[_0xe843('0xc')](),controller[_0xe843('0xd')]);router[_0xe843('0xa')](_0xe843('0xe'),auth[_0xe843('0xc')](),controller[_0xe843('0xf')]);router[_0xe843('0x10')]('/',auth[_0xe843('0xc')](),controller[_0xe843('0x11')]);router[_0xe843('0x10')](_0xe843('0xe'),auth[_0xe843('0xc')](),controller[_0xe843('0x12')]);router[_0xe843('0x13')](_0xe843('0x14'),auth[_0xe843('0xc')](),controller[_0xe843('0x15')]);router[_0xe843('0x16')]('/:id',auth[_0xe843('0xc')](),controller[_0xe843('0x17')]);router[_0xe843('0x16')](_0xe843('0xe'),auth['isAuthenticated'](),controller[_0xe843('0x18')]);module[_0xe843('0x19')]=router; \ No newline at end of file +var _0xcbe2=['put','update','delete','destroy','removeUsers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','create','addUsers'];(function(_0x862384,_0x2e92c7){var _0x4dfcb6=function(_0x18c56a){while(--_0x18c56a){_0x862384['push'](_0x862384['shift']());}};_0x4dfcb6(++_0x2e92c7);}(_0xcbe2,0x148));var _0x2cbe=function(_0x12ec8a,_0x174d5a){_0x12ec8a=_0x12ec8a-0x0;var _0x15e7d4=_0xcbe2[_0x12ec8a];return _0x15e7d4;};'use strict';var multer=require(_0x2cbe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2cbe('0x1'));var express=require(_0x2cbe('0x2'));var router=express[_0x2cbe('0x3')]();var fs_extra=require(_0x2cbe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cbe('0x5'));var config=require(_0x2cbe('0x6'));var controller=require(_0x2cbe('0x7'));router[_0x2cbe('0x8')]('/',auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xa')]);router['get'](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xc')]);router[_0x2cbe('0x8')](_0x2cbe('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0x2cbe('0xe')]('/',auth['isAuthenticated'](),controller[_0x2cbe('0xf')]);router[_0x2cbe('0xe')](_0x2cbe('0xd'),auth['isAuthenticated'](),controller[_0x2cbe('0x10')]);router[_0x2cbe('0x11')](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x12')]);router[_0x2cbe('0x13')]('/:id',auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x14')]);router[_0x2cbe('0x13')](_0x2cbe('0xd'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0x15')]);module[_0x2cbe('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index cb8b14e..63838ea 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 _0x551b=['preproduction','utf8','DATE','exports','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x39f097,_0x17116b){var _0x544f6a=function(_0x457caf){while(--_0x457caf){_0x39f097['push'](_0x39f097['shift']());}};_0x544f6a(++_0x17116b);}(_0x551b,0x66));var _0xb551=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0x551b[_0x40911a];return _0x27e8e3;};'use strict';var Sequelize=require('sequelize');module[_0xb551('0x0')]={'name':{'type':Sequelize[_0xb551('0x1')],'unique':_0xb551('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb551('0x1')]},'notes':{'type':Sequelize[_0xb551('0x3')]},'preproduction':{'type':Sequelize[_0xb551('0x4')]('long'),'get':function(){if(this[_0xb551('0x5')](_0xb551('0x6'))){return this[_0xb551('0x5')](_0xb551('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0xb551('0x4')]('long'),'get':function(){if(this['getDataValue']('production')){return this['getDataValue']('production')['toString'](_0xb551('0x7'));}}},'savedAt':{'type':Sequelize[_0xb551('0x8')]},'publishedAt':{'type':Sequelize[_0xb551('0x8')]}}; \ No newline at end of file +var _0x3b83=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3b83,0x10f));var _0x33b8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x3b83[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x33b8('0x0'));module[_0x33b8('0x1')]={'name':{'type':Sequelize[_0x33b8('0x2')],'unique':_0x33b8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x33b8('0x2')]},'notes':{'type':Sequelize[_0x33b8('0x4')]},'preproduction':{'type':Sequelize[_0x33b8('0x5')](_0x33b8('0x6')),'get':function(){if(this[_0x33b8('0x7')](_0x33b8('0x8'))){return this[_0x33b8('0x7')](_0x33b8('0x8'))['toString'](_0x33b8('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x33b8('0x6')),'get':function(){if(this[_0x33b8('0x7')](_0x33b8('0xa'))){return this[_0x33b8('0x7')]('production')[_0x33b8('0xb')](_0x33b8('0x9'));}}},'savedAt':{'type':Sequelize[_0x33b8('0xc')]},'publishedAt':{'type':Sequelize[_0x33b8('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f10874d..68b945c 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 _0xdb28=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','pick','nolimit','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','SquareProjects','UserProfileResource','publish','agi','stringify','error','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','fields','find'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xdb28,0x106));var _0x8db2=function(_0x124a94,_0x9d206c){_0x124a94=_0x124a94-0x0;var _0x1f8ea8=_0xdb28[_0x124a94];return _0x1f8ea8;};'use strict';var _=require(_0x8db2('0x0'));var Redis=require(_0x8db2('0x1'));var qs=require(_0x8db2('0x2'));var logger=require(_0x8db2('0x3'))('api');var config=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];config[_0x8db2('0x6')]=_[_0x8db2('0x7')](config[_0x8db2('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x8'))(new Redis(config[_0x8db2('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x477f50,_0x46932f){_0x46932f=_0x46932f||0xcc;return function(_0x131537){if(_0x131537){return _0x477f50[_0x8db2('0x9')](_0x46932f);}return _0x477f50[_0x8db2('0xa')](_0x46932f)[_0x8db2('0xb')]();};}function respondWithResult(_0x126c78,_0x4ba340){_0x4ba340=_0x4ba340||0xc8;return function(_0x30dc90){if(_0x30dc90){return _0x126c78[_0x8db2('0xa')](_0x4ba340)[_0x8db2('0xc')](_0x30dc90);}};}function respondWithFilteredResult(_0x57015f,_0x1d9371){return function(_0x150942){if(_0x150942){var _0x576475=typeof _0x1d9371[_0x8db2('0xd')]===_0x8db2('0xe')&&typeof _0x1d9371[_0x8db2('0xf')]===_0x8db2('0xe');var _0x37d017=_0x150942['count'];var _0x49fadc=_0x576475?0x0:_0x1d9371[_0x8db2('0xd')];var _0x15e87c=_0x576475?_0x150942[_0x8db2('0x10')]:_0x1d9371[_0x8db2('0xd')]+_0x1d9371[_0x8db2('0xf')];var _0xfa285b;if(_0x15e87c>=_0x37d017){_0x15e87c=_0x37d017;_0xfa285b=0xc8;}else{_0xfa285b=0xce;}_0x57015f[_0x8db2('0xa')](_0xfa285b);return _0x57015f[_0x8db2('0x11')](_0x8db2('0x12'),_0x49fadc+'-'+_0x15e87c+'/'+_0x37d017)[_0x8db2('0xc')](_0x150942);}return null;};}function saveUpdates(_0x5489a9){return function(_0x13b0f5){if(_0x13b0f5){return _0x13b0f5[_0x8db2('0x13')](_0x5489a9)['then'](function(_0x2b3f73){return _0x2b3f73;});}return null;};}function removeEntity(_0x44957d){return function(_0x21db8c){if(_0x21db8c){return _0x21db8c[_0x8db2('0x14')]()[_0x8db2('0x15')](function(){var _0x46ce14=_0x21db8c['get']({'plain':!![]});var _0x5df464=_0x8db2('0x16');return db[_0x8db2('0x17')][_0x8db2('0x14')]({'where':{'type':_0x5df464,'resourceId':_0x46ce14['id']}})[_0x8db2('0x15')](function(){return _0x21db8c;});})['then'](function(){var _0x431d60=new Redis(config[_0x8db2('0x6')]);_0x431d60[_0x8db2('0x18')](_0x8db2('0x19'),JSON[_0x8db2('0x1a')]({'id':_0x21db8c['id'],'deleted':!![]}));})['then'](function(){_0x44957d[_0x8db2('0xa')](0xcc)[_0x8db2('0xb')]();});}};}function handleEntityNotFound(_0x18f69c){return function(_0x125be2){if(!_0x125be2){_0x18f69c[_0x8db2('0x9')](0x194);}return _0x125be2;};}function handleError(_0x21704c,_0x796ec1){_0x796ec1=_0x796ec1||0x1f4;return function(_0x5c6614){logger[_0x8db2('0x1b')](_0x5c6614['stack']);if(_0x5c6614['name']){delete _0x5c6614['name'];}_0x21704c['status'](_0x796ec1)[_0x8db2('0x1c')](_0x5c6614);};}exports[_0x8db2('0x1d')]=function(_0x3be281,_0x2baed0){var _0x145328={},_0x8d4f54={},_0x58cd9d={'count':0x0,'rows':[]};var _0x3544ba=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')][_0x8db2('0x20')],function(_0x483aee){return{'name':_0x483aee[_0x8db2('0x21')],'type':_0x483aee[_0x8db2('0x22')][_0x8db2('0x23')]};});_0x8d4f54[_0x8db2('0x24')]=_[_0x8db2('0x1e')](_0x3544ba,_0x8db2('0x25'));_0x8d4f54[_0x8db2('0x26')]=_[_0x8db2('0x27')](_0x3be281[_0x8db2('0x26')]);_0x8d4f54['filters']=_[_0x8db2('0x28')](_0x8d4f54['model'],_0x8d4f54['query']);_0x145328[_0x8db2('0x29')]=_[_0x8db2('0x28')](_0x8d4f54[_0x8db2('0x24')],qs['fields'](_0x3be281[_0x8db2('0x26')]['fields']));_0x145328[_0x8db2('0x29')]=_0x145328[_0x8db2('0x29')][_0x8db2('0x2a')]?_0x145328['attributes']:_0x8d4f54['model'];if(!_0x3be281[_0x8db2('0x26')][_0x8db2('0x2b')]('nolimit')){_0x145328['limit']=qs[_0x8db2('0xf')](_0x3be281[_0x8db2('0x26')][_0x8db2('0xf')]);_0x145328[_0x8db2('0xd')]=qs[_0x8db2('0xd')](_0x3be281[_0x8db2('0x26')][_0x8db2('0xd')]);}_0x145328[_0x8db2('0x2c')]=qs[_0x8db2('0x2d')](_0x3be281[_0x8db2('0x26')]['sort']);_0x145328[_0x8db2('0x2e')]=qs[_0x8db2('0x2f')](_['pick'](_0x3be281[_0x8db2('0x26')],_0x8d4f54[_0x8db2('0x2f')]),_0x3544ba);if(_0x3be281['query']['filter']){_0x145328[_0x8db2('0x2e')]=_['merge'](_0x145328[_0x8db2('0x2e')],{'$or':_[_0x8db2('0x1e')](_0x3544ba,function(_0x26717d){if(_0x26717d[_0x8db2('0x22')]!=='VIRTUAL'){var _0x2d3e98={};_0x2d3e98[_0x26717d['name']]={'$like':'%'+_0x3be281[_0x8db2('0x26')][_0x8db2('0x30')]+'%'};return _0x2d3e98;}})});}_0x145328=_[_0x8db2('0x31')]({},_0x145328,_0x3be281[_0x8db2('0x32')]);var _0x50e88a={'where':_0x145328['where']};return db[_0x8db2('0x1f')][_0x8db2('0x10')](_0x50e88a)['then'](function(_0x2bac57){_0x58cd9d[_0x8db2('0x10')]=_0x2bac57;if(_0x3be281[_0x8db2('0x26')]['includeAll']){_0x145328[_0x8db2('0x33')]=[{'all':!![]}];}return db[_0x8db2('0x1f')][_0x8db2('0x34')](_0x145328);})[_0x8db2('0x15')](function(_0x2e6f0c){_0x58cd9d[_0x8db2('0x35')]=_0x2e6f0c;return _0x58cd9d;})[_0x8db2('0x15')](respondWithFilteredResult(_0x2baed0,_0x145328))[_0x8db2('0x36')](handleError(_0x2baed0,null));};exports[_0x8db2('0x37')]=function(_0x63c561,_0x21cf7c){var _0x20bf0b={'raw':![],'where':{'id':_0x63c561['params']['id']}},_0x1d9025={};_0x1d9025[_0x8db2('0x24')]=_[_0x8db2('0x27')](db['SquareProject']['rawAttributes']);_0x1d9025[_0x8db2('0x26')]=_['keys'](_0x63c561[_0x8db2('0x26')]);_0x1d9025[_0x8db2('0x2f')]=_[_0x8db2('0x28')](_0x1d9025[_0x8db2('0x24')],_0x1d9025[_0x8db2('0x26')]);_0x20bf0b[_0x8db2('0x29')]=_[_0x8db2('0x28')](_0x1d9025['model'],qs[_0x8db2('0x38')](_0x63c561[_0x8db2('0x26')][_0x8db2('0x38')]));_0x20bf0b[_0x8db2('0x29')]=_0x20bf0b['attributes'][_0x8db2('0x2a')]?_0x20bf0b[_0x8db2('0x29')]:_0x1d9025[_0x8db2('0x24')];if(_0x63c561[_0x8db2('0x26')]['includeAll']){_0x20bf0b[_0x8db2('0x33')]=[{'all':!![]}];}_0x20bf0b=_['merge']({},_0x20bf0b,_0x63c561[_0x8db2('0x32')]);return db[_0x8db2('0x1f')][_0x8db2('0x39')](_0x20bf0b)['then'](handleEntityNotFound(_0x21cf7c,null))['then'](respondWithResult(_0x21cf7c,null))[_0x8db2('0x36')](handleError(_0x21cf7c,null));};exports['create']=function(_0x173cc7,_0x467866){return db[_0x8db2('0x1f')][_0x8db2('0x3a')](_0x173cc7[_0x8db2('0x3b')],{})[_0x8db2('0x15')](function(_0x4355e2){var _0xab6bdd=_0x173cc7[_0x8db2('0x3c')][_0x8db2('0x3d')]({'plain':!![]});if(!_0xab6bdd)throw new Error(_0x8db2('0x3e'));if(_0xab6bdd[_0x8db2('0x3f')]==='user'){var _0x449109=_0x4355e2[_0x8db2('0x3d')]({'plain':!![]});var _0xdbba64=_0x8db2('0x16');return db['UserProfileSection']['find']({'where':{'name':_0xdbba64,'userProfileId':_0xab6bdd[_0x8db2('0x40')]},'raw':!![]})[_0x8db2('0x15')](function(_0x164020){if(_0x164020&&_0x164020['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x449109[_0x8db2('0x25')],'resourceId':_0x449109['id'],'type':_0x164020[_0x8db2('0x25')],'sectionId':_0x164020['id']},{})[_0x8db2('0x15')](function(){return _0x4355e2;});}else{return _0x4355e2;}})[_0x8db2('0x36')](function(_0xaab731){logger[_0x8db2('0x1b')](_0x8db2('0x41'),_0xaab731);throw _0xaab731;});}return _0x4355e2;})['then'](respondWithResult(_0x467866,0xc9))['catch'](handleError(_0x467866,null));};exports[_0x8db2('0x13')]=function(_0x18c6ef,_0x2908e4){if(_0x18c6ef[_0x8db2('0x3b')]['id']){delete _0x18c6ef[_0x8db2('0x3b')]['id'];}return db[_0x8db2('0x1f')][_0x8db2('0x39')]({'where':{'id':_0x18c6ef[_0x8db2('0x42')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x15')](saveUpdates(_0x18c6ef[_0x8db2('0x3b')],null))[_0x8db2('0x15')](function(_0x345c74){if(!_0x345c74)return;var _0x2d518a=_0x345c74[_0x8db2('0x3d')]({'plain':!![]});return _0x2d518a;})['then'](function(_0x2ded23){var _0xb4b0a=new Redis(config['redis']);_0xb4b0a[_0x8db2('0x18')](_0x8db2('0x19'),JSON[_0x8db2('0x1a')](_['pick'](_0x2ded23,['id',_0x8db2('0x25'),_0x8db2('0x43')])));return _0x2ded23;})[_0x8db2('0x15')](respondWithResult(_0x2908e4,null))[_0x8db2('0x36')](handleError(_0x2908e4,null));};exports[_0x8db2('0x14')]=function(_0x50fab4,_0x467505){return db[_0x8db2('0x1f')][_0x8db2('0x39')]({'where':{'id':_0x50fab4['params']['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x467505,null))[_0x8db2('0x15')](removeEntity(_0x467505,null))[_0x8db2('0x36')](handleError(_0x467505,null));};exports[_0x8db2('0x44')]=function(_0x2ac590,_0x16d897){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2ac590[_0x8db2('0x42')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x16d897,null))['then'](function(_0x1eeafe){if(_0x1eeafe){return _0x1eeafe[_0x8db2('0x44')](_0x2ac590['body'][_0x8db2('0x45')],_[_0x8db2('0x46')](_0x2ac590[_0x8db2('0x3b')],[_0x8db2('0x45'),'id'])||{});}})[_0x8db2('0x15')](respondWithResult(_0x16d897,null))[_0x8db2('0x36')](handleError(_0x16d897,null));};exports[_0x8db2('0x47')]=function(_0x33a600,_0x120ef2){return db[_0x8db2('0x1f')][_0x8db2('0x39')]({'where':{'id':_0x33a600[_0x8db2('0x42')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x120ef2,null))[_0x8db2('0x15')](function(_0x64ec90){if(_0x64ec90){return _0x64ec90[_0x8db2('0x47')](_0x33a600['query'][_0x8db2('0x45')])[_0x8db2('0x15')](function(){if(_[_0x8db2('0x48')](_0x33a600[_0x8db2('0x26')][_0x8db2('0x45')])){for(var _0x53b2dc=0x0;_0x53b2dc<_0x33a600[_0x8db2('0x26')][_0x8db2('0x45')][_0x8db2('0x2a')];_0x53b2dc+=0x1){socket[_0x8db2('0x49')](_0x8db2('0x4a'),{'UserId':Number(_0x33a600[_0x8db2('0x26')][_0x8db2('0x45')][_0x53b2dc]),'SquareProjectId':Number(_0x33a600[_0x8db2('0x42')]['id'])});}}else{socket[_0x8db2('0x49')](_0x8db2('0x4a'),{'UserId':Number(_0x33a600[_0x8db2('0x26')][_0x8db2('0x45')]),'SquareProjectId':Number(_0x33a600[_0x8db2('0x42')]['id'])});}});}})[_0x8db2('0x15')](respondWithStatusCode(_0x120ef2,null))[_0x8db2('0x36')](handleError(_0x120ef2,null));};exports[_0x8db2('0x4b')]=function(_0x1d7862,_0xefb12){var _0x5a719f={};var _0x3273dd={};var _0x536ac1;var _0x364176;return db['SquareProject'][_0x8db2('0x4c')]({'where':{'id':_0x1d7862[_0x8db2('0x42')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0xefb12,null))[_0x8db2('0x15')](function(_0x1e812e){if(_0x1e812e){_0x536ac1=_0x1e812e;_0x3273dd['model']=_['keys'](db[_0x8db2('0x4d')][_0x8db2('0x20')]);_0x3273dd[_0x8db2('0x26')]=_[_0x8db2('0x27')](_0x1d7862[_0x8db2('0x26')]);_0x3273dd[_0x8db2('0x2f')]=_[_0x8db2('0x28')](_0x3273dd[_0x8db2('0x24')],_0x3273dd['query']);_0x5a719f[_0x8db2('0x29')]=_[_0x8db2('0x28')](_0x3273dd[_0x8db2('0x24')],qs[_0x8db2('0x38')](_0x1d7862[_0x8db2('0x26')][_0x8db2('0x38')]));_0x5a719f[_0x8db2('0x29')]=_0x5a719f[_0x8db2('0x29')]['length']?_0x5a719f['attributes']:_0x3273dd[_0x8db2('0x24')];_0x5a719f[_0x8db2('0x2c')]=qs[_0x8db2('0x2d')](_0x1d7862[_0x8db2('0x26')][_0x8db2('0x2d')]);_0x5a719f['where']=qs['filters'](_[_0x8db2('0x4e')](_0x1d7862[_0x8db2('0x26')],_0x3273dd['filters']));if(_0x1d7862[_0x8db2('0x26')][_0x8db2('0x30')]){_0x5a719f[_0x8db2('0x2e')]=_['merge'](_0x5a719f[_0x8db2('0x2e')],{'$or':_[_0x8db2('0x1e')](_0x5a719f[_0x8db2('0x29')],function(_0x4f5458){var _0x3ff023={};_0x3ff023[_0x4f5458]={'$like':'%'+_0x1d7862[_0x8db2('0x26')][_0x8db2('0x30')]+'%'};return _0x3ff023;})});}_0x5a719f=_[_0x8db2('0x31')]({},_0x5a719f,_0x1d7862[_0x8db2('0x32')]);return _0x536ac1['getUsers'](_0x5a719f);}})[_0x8db2('0x15')](function(_0x3023fe){if(_0x3023fe){_0x364176=_0x3023fe[_0x8db2('0x2a')];if(!_0x1d7862['query']['hasOwnProperty'](_0x8db2('0x4f'))){_0x5a719f[_0x8db2('0xf')]=qs['limit'](_0x1d7862[_0x8db2('0x26')][_0x8db2('0xf')]);_0x5a719f[_0x8db2('0xd')]=qs[_0x8db2('0xd')](_0x1d7862[_0x8db2('0x26')][_0x8db2('0xd')]);}return _0x536ac1[_0x8db2('0x4b')](_0x5a719f);}})[_0x8db2('0x15')](function(_0x20b85f){if(_0x20b85f){return _0x20b85f?{'count':_0x364176,'rows':_0x20b85f}:null;}})[_0x8db2('0x15')](respondWithResult(_0xefb12,null))[_0x8db2('0x36')](handleError(_0xefb12,null));}; \ No newline at end of file +var _0xd943=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','pick','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','publish','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys'];(function(_0x14fe8d,_0x500c74){var _0x1d179a=function(_0x3c643b){while(--_0x3c643b){_0x14fe8d['push'](_0x14fe8d['shift']());}};_0x1d179a(++_0x500c74);}(_0xd943,0x15d));var _0x3d94=function(_0x2e7f97,_0x37e5e9){_0x2e7f97=_0x2e7f97-0x0;var _0x5de471=_0xd943[_0x2e7f97];return _0x5de471;};'use strict';var _=require(_0x3d94('0x0'));var Redis=require(_0x3d94('0x1'));var qs=require(_0x3d94('0x2'));var logger=require(_0x3d94('0x3'))('api');var config=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];config[_0x3d94('0x6')]=_[_0x3d94('0x7')](config[_0x3d94('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d94('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x4d29e7,_0x20f4d1){_0x20f4d1=_0x20f4d1||0xcc;return function(_0x35d36a){if(_0x35d36a){return _0x4d29e7['sendStatus'](_0x20f4d1);}return _0x4d29e7['status'](_0x20f4d1)[_0x3d94('0x8')]();};}function respondWithResult(_0x27e381,_0x1cc58c){_0x1cc58c=_0x1cc58c||0xc8;return function(_0x5908a7){if(_0x5908a7){return _0x27e381[_0x3d94('0x9')](_0x1cc58c)['json'](_0x5908a7);}};}function respondWithFilteredResult(_0x39e2fa,_0x301536){return function(_0x5f5041){if(_0x5f5041){var _0x1897de=typeof _0x301536[_0x3d94('0xa')]===_0x3d94('0xb')&&typeof _0x301536[_0x3d94('0xc')]===_0x3d94('0xb');var _0x548b89=_0x5f5041[_0x3d94('0xd')];var _0x2e9af0=_0x1897de?0x0:_0x301536[_0x3d94('0xa')];var _0x4c167c=_0x1897de?_0x5f5041[_0x3d94('0xd')]:_0x301536[_0x3d94('0xa')]+_0x301536[_0x3d94('0xc')];var _0x5d9366;if(_0x4c167c>=_0x548b89){_0x4c167c=_0x548b89;_0x5d9366=0xc8;}else{_0x5d9366=0xce;}_0x39e2fa[_0x3d94('0x9')](_0x5d9366);return _0x39e2fa[_0x3d94('0xe')](_0x3d94('0xf'),_0x2e9af0+'-'+_0x4c167c+'/'+_0x548b89)[_0x3d94('0x10')](_0x5f5041);}return null;};}function saveUpdates(_0xaf939a){return function(_0xd8efaa){if(_0xd8efaa){return _0xd8efaa[_0x3d94('0x11')](_0xaf939a)[_0x3d94('0x12')](function(_0x540658){return _0x540658;});}return null;};}function removeEntity(_0x22676a){return function(_0x1a9315){if(_0x1a9315){return _0x1a9315[_0x3d94('0x13')]()[_0x3d94('0x12')](function(){var _0x4afc92=_0x1a9315[_0x3d94('0x14')]({'plain':!![]});var _0xef8b3='SquareProjects';return db[_0x3d94('0x15')]['destroy']({'where':{'type':_0xef8b3,'resourceId':_0x4afc92['id']}})[_0x3d94('0x12')](function(){return _0x1a9315;});})[_0x3d94('0x12')](function(){var _0x16a6d0=new Redis(config[_0x3d94('0x6')]);_0x16a6d0[_0x3d94('0x16')]('agi',JSON['stringify']({'id':_0x1a9315['id'],'deleted':!![]}));})[_0x3d94('0x12')](function(){_0x22676a[_0x3d94('0x9')](0xcc)[_0x3d94('0x8')]();});}};}function handleEntityNotFound(_0x4edee4){return function(_0x30af25){if(!_0x30af25){_0x4edee4[_0x3d94('0x17')](0x194);}return _0x30af25;};}function handleError(_0x123adc,_0x384f76){_0x384f76=_0x384f76||0x1f4;return function(_0x395133){logger[_0x3d94('0x18')](_0x395133[_0x3d94('0x19')]);if(_0x395133[_0x3d94('0x1a')]){delete _0x395133[_0x3d94('0x1a')];}_0x123adc[_0x3d94('0x9')](_0x384f76)[_0x3d94('0x1b')](_0x395133);};}exports[_0x3d94('0x1c')]=function(_0x292976,_0x3496c3){var _0x2945d2={},_0x5b3b31={},_0x123183={'count':0x0,'rows':[]};var _0x558fd2=_[_0x3d94('0x1d')](db[_0x3d94('0x1e')][_0x3d94('0x1f')],function(_0x439173){return{'name':_0x439173[_0x3d94('0x20')],'type':_0x439173[_0x3d94('0x21')][_0x3d94('0x22')]};});_0x5b3b31['model']=_['map'](_0x558fd2,_0x3d94('0x1a'));_0x5b3b31['query']=_['keys'](_0x292976[_0x3d94('0x23')]);_0x5b3b31['filters']=_[_0x3d94('0x24')](_0x5b3b31[_0x3d94('0x25')],_0x5b3b31[_0x3d94('0x23')]);_0x2945d2['attributes']=_[_0x3d94('0x24')](_0x5b3b31['model'],qs[_0x3d94('0x26')](_0x292976['query'][_0x3d94('0x26')]));_0x2945d2[_0x3d94('0x27')]=_0x2945d2[_0x3d94('0x27')][_0x3d94('0x28')]?_0x2945d2['attributes']:_0x5b3b31[_0x3d94('0x25')];if(!_0x292976['query'][_0x3d94('0x29')](_0x3d94('0x2a'))){_0x2945d2['limit']=qs['limit'](_0x292976[_0x3d94('0x23')][_0x3d94('0xc')]);_0x2945d2[_0x3d94('0xa')]=qs['offset'](_0x292976[_0x3d94('0x23')][_0x3d94('0xa')]);}_0x2945d2['order']=qs[_0x3d94('0x2b')](_0x292976[_0x3d94('0x23')][_0x3d94('0x2b')]);_0x2945d2[_0x3d94('0x2c')]=qs[_0x3d94('0x2d')](_['pick'](_0x292976[_0x3d94('0x23')],_0x5b3b31[_0x3d94('0x2d')]),_0x558fd2);if(_0x292976[_0x3d94('0x23')][_0x3d94('0x2e')]){_0x2945d2[_0x3d94('0x2c')]=_[_0x3d94('0x2f')](_0x2945d2['where'],{'$or':_['map'](_0x558fd2,function(_0xfe58eb){if(_0xfe58eb[_0x3d94('0x21')]!==_0x3d94('0x30')){var _0x438ba3={};_0x438ba3[_0xfe58eb[_0x3d94('0x1a')]]={'$like':'%'+_0x292976[_0x3d94('0x23')][_0x3d94('0x2e')]+'%'};return _0x438ba3;}})});}_0x2945d2=_[_0x3d94('0x2f')]({},_0x2945d2,_0x292976[_0x3d94('0x31')]);var _0x2235f9={'where':_0x2945d2['where']};return db[_0x3d94('0x1e')][_0x3d94('0xd')](_0x2235f9)[_0x3d94('0x12')](function(_0xcc289a){_0x123183['count']=_0xcc289a;if(_0x292976[_0x3d94('0x23')][_0x3d94('0x32')]){_0x2945d2[_0x3d94('0x33')]=[{'all':!![]}];}return db[_0x3d94('0x1e')][_0x3d94('0x34')](_0x2945d2);})['then'](function(_0x217e5e){_0x123183[_0x3d94('0x35')]=_0x217e5e;return _0x123183;})[_0x3d94('0x12')](respondWithFilteredResult(_0x3496c3,_0x2945d2))['catch'](handleError(_0x3496c3,null));};exports['show']=function(_0x4d8a8f,_0x47905e){var _0x3b3550={'raw':![],'where':{'id':_0x4d8a8f[_0x3d94('0x36')]['id']}},_0x22f52c={};_0x22f52c[_0x3d94('0x25')]=_[_0x3d94('0x37')](db[_0x3d94('0x1e')][_0x3d94('0x1f')]);_0x22f52c['query']=_['keys'](_0x4d8a8f[_0x3d94('0x23')]);_0x22f52c[_0x3d94('0x2d')]=_['intersection'](_0x22f52c[_0x3d94('0x25')],_0x22f52c['query']);_0x3b3550[_0x3d94('0x27')]=_[_0x3d94('0x24')](_0x22f52c[_0x3d94('0x25')],qs[_0x3d94('0x26')](_0x4d8a8f[_0x3d94('0x23')]['fields']));_0x3b3550[_0x3d94('0x27')]=_0x3b3550[_0x3d94('0x27')][_0x3d94('0x28')]?_0x3b3550['attributes']:_0x22f52c[_0x3d94('0x25')];if(_0x4d8a8f['query']['includeAll']){_0x3b3550[_0x3d94('0x33')]=[{'all':!![]}];}_0x3b3550=_[_0x3d94('0x2f')]({},_0x3b3550,_0x4d8a8f[_0x3d94('0x31')]);return db[_0x3d94('0x1e')]['find'](_0x3b3550)[_0x3d94('0x12')](handleEntityNotFound(_0x47905e,null))['then'](respondWithResult(_0x47905e,null))[_0x3d94('0x38')](handleError(_0x47905e,null));};exports[_0x3d94('0x39')]=function(_0x35c911,_0x15c8e7){return db[_0x3d94('0x1e')][_0x3d94('0x39')](_0x35c911[_0x3d94('0x3a')],{})['then'](function(_0x10a377){var _0x19dabb=_0x35c911['user']['get']({'plain':!![]});if(!_0x19dabb)throw new Error(_0x3d94('0x3b'));if(_0x19dabb[_0x3d94('0x3c')]==='user'){var _0x3c8571=_0x10a377[_0x3d94('0x14')]({'plain':!![]});var _0x16d505=_0x3d94('0x3d');return db[_0x3d94('0x3e')][_0x3d94('0x3f')]({'where':{'name':_0x16d505,'userProfileId':_0x19dabb[_0x3d94('0x40')]},'raw':!![]})[_0x3d94('0x12')](function(_0x60279f){if(_0x60279f&&_0x60279f[_0x3d94('0x41')]===0x0){return db[_0x3d94('0x15')][_0x3d94('0x39')]({'name':_0x3c8571[_0x3d94('0x1a')],'resourceId':_0x3c8571['id'],'type':_0x60279f[_0x3d94('0x1a')],'sectionId':_0x60279f['id']},{})[_0x3d94('0x12')](function(){return _0x10a377;});}else{return _0x10a377;}})['catch'](function(_0x44df82){logger[_0x3d94('0x18')](_0x3d94('0x42'),_0x44df82);throw _0x44df82;});}return _0x10a377;})[_0x3d94('0x12')](respondWithResult(_0x15c8e7,0xc9))[_0x3d94('0x38')](handleError(_0x15c8e7,null));};exports[_0x3d94('0x11')]=function(_0x129783,_0x33db0a){if(_0x129783[_0x3d94('0x3a')]['id']){delete _0x129783['body']['id'];}return db[_0x3d94('0x1e')]['find']({'where':{'id':_0x129783[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x33db0a,null))['then'](saveUpdates(_0x129783[_0x3d94('0x3a')],null))['then'](function(_0x567751){if(!_0x567751)return;var _0x335247=_0x567751['get']({'plain':!![]});return _0x335247;})[_0x3d94('0x12')](function(_0x132e0b){var _0x5b6061=new Redis(config[_0x3d94('0x6')]);_0x5b6061['publish']('agi',JSON[_0x3d94('0x43')](_[_0x3d94('0x44')](_0x132e0b,['id',_0x3d94('0x1a'),_0x3d94('0x45')])));return _0x132e0b;})[_0x3d94('0x12')](respondWithResult(_0x33db0a,null))[_0x3d94('0x38')](handleError(_0x33db0a,null));};exports[_0x3d94('0x13')]=function(_0x2b1168,_0xae892){return db['SquareProject'][_0x3d94('0x3f')]({'where':{'id':_0x2b1168[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0xae892,null))[_0x3d94('0x12')](removeEntity(_0xae892,null))[_0x3d94('0x38')](handleError(_0xae892,null));};exports[_0x3d94('0x46')]=function(_0x39e9db,_0x126894){return db[_0x3d94('0x1e')][_0x3d94('0x3f')]({'where':{'id':_0x39e9db[_0x3d94('0x36')]['id']}})['then'](handleEntityNotFound(_0x126894,null))[_0x3d94('0x12')](function(_0x55580d){if(_0x55580d){return _0x55580d[_0x3d94('0x46')](_0x39e9db[_0x3d94('0x3a')][_0x3d94('0x47')],_[_0x3d94('0x48')](_0x39e9db[_0x3d94('0x3a')],[_0x3d94('0x47'),'id'])||{});}})[_0x3d94('0x12')](respondWithResult(_0x126894,null))[_0x3d94('0x38')](handleError(_0x126894,null));};exports[_0x3d94('0x49')]=function(_0x5da38c,_0x519ada){return db[_0x3d94('0x1e')]['find']({'where':{'id':_0x5da38c[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x519ada,null))['then'](function(_0x211f0e){if(_0x211f0e){return _0x211f0e[_0x3d94('0x49')](_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')])[_0x3d94('0x12')](function(){if(_[_0x3d94('0x4a')](_0x5da38c[_0x3d94('0x23')]['ids'])){for(var _0x22dbf9=0x0;_0x22dbf9<_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')]['length'];_0x22dbf9+=0x1){socket[_0x3d94('0x4b')](_0x3d94('0x4c'),{'UserId':Number(_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')][_0x22dbf9]),'SquareProjectId':Number(_0x5da38c['params']['id'])});}}else{socket['emit'](_0x3d94('0x4c'),{'UserId':Number(_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')]),'SquareProjectId':Number(_0x5da38c[_0x3d94('0x36')]['id'])});}});}})['then'](respondWithStatusCode(_0x519ada,null))[_0x3d94('0x38')](handleError(_0x519ada,null));};exports[_0x3d94('0x4d')]=function(_0x49bfb0,_0x5ba865){var _0x250c87={};var _0x336e36={};var _0x4eee2b;var _0x3135f3;return db[_0x3d94('0x1e')][_0x3d94('0x4e')]({'where':{'id':_0x49bfb0['params']['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x5ba865,null))[_0x3d94('0x12')](function(_0x5c7aac){if(_0x5c7aac){_0x4eee2b=_0x5c7aac;_0x336e36['model']=_['keys'](db[_0x3d94('0x4f')][_0x3d94('0x1f')]);_0x336e36[_0x3d94('0x23')]=_[_0x3d94('0x37')](_0x49bfb0[_0x3d94('0x23')]);_0x336e36['filters']=_[_0x3d94('0x24')](_0x336e36[_0x3d94('0x25')],_0x336e36[_0x3d94('0x23')]);_0x250c87[_0x3d94('0x27')]=_[_0x3d94('0x24')](_0x336e36[_0x3d94('0x25')],qs['fields'](_0x49bfb0[_0x3d94('0x23')]['fields']));_0x250c87[_0x3d94('0x27')]=_0x250c87[_0x3d94('0x27')][_0x3d94('0x28')]?_0x250c87[_0x3d94('0x27')]:_0x336e36[_0x3d94('0x25')];_0x250c87[_0x3d94('0x50')]=qs['sort'](_0x49bfb0['query'][_0x3d94('0x2b')]);_0x250c87['where']=qs['filters'](_['pick'](_0x49bfb0[_0x3d94('0x23')],_0x336e36[_0x3d94('0x2d')]));if(_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x2e')]){_0x250c87[_0x3d94('0x2c')]=_[_0x3d94('0x2f')](_0x250c87[_0x3d94('0x2c')],{'$or':_[_0x3d94('0x1d')](_0x250c87['attributes'],function(_0x22917e){var _0x5e55a4={};_0x5e55a4[_0x22917e]={'$like':'%'+_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x2e')]+'%'};return _0x5e55a4;})});}_0x250c87=_[_0x3d94('0x2f')]({},_0x250c87,_0x49bfb0['options']);return _0x4eee2b['getUsers'](_0x250c87);}})['then'](function(_0x426ef5){if(_0x426ef5){_0x3135f3=_0x426ef5[_0x3d94('0x28')];if(!_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x29')](_0x3d94('0x2a'))){_0x250c87['limit']=qs['limit'](_0x49bfb0[_0x3d94('0x23')][_0x3d94('0xc')]);_0x250c87[_0x3d94('0xa')]=qs['offset'](_0x49bfb0[_0x3d94('0x23')]['offset']);}return _0x4eee2b[_0x3d94('0x4d')](_0x250c87);}})[_0x3d94('0x12')](function(_0x15adf7){if(_0x15adf7){return _0x15adf7?{'count':_0x3135f3,'rows':_0x15adf7}:null;}})[_0x3d94('0x12')](respondWithResult(_0x5ba865,null))[_0x3d94('0x38')](handleError(_0x5ba865,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index feb2e09..5771106 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 _0x982e=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','remove'];(function(_0x16652c,_0x16d42b){var _0x123b8f=function(_0x3efb75){while(--_0x3efb75){_0x16652c['push'](_0x16652c['shift']());}};_0x123b8f(++_0x16d42b);}(_0x982e,0x6f));var _0xe982=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x982e[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xe982('0x0'));var SquareProject=require(_0xe982('0x1'))['db'][_0xe982('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe982('0x3')](0x0);var events={'afterCreate':_0xe982('0x4'),'afterUpdate':'update','afterDestroy':_0xe982('0x5')};function emitEvent(_0x37a9ca){return function(_0x68e212,_0x397daa,_0xccc2b8){SquareProjectEvents['emit'](_0x37a9ca+':'+_0x68e212['id'],_0x68e212);SquareProjectEvents['emit'](_0x37a9ca,_0x68e212);_0xccc2b8(null);};}for(var e in events){if(events[_0xe982('0x6')](e)){var event=events[e];SquareProject[_0xe982('0x7')](e,emitEvent(event));}}module[_0xe982('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x7160=['hasOwnProperty','hook','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x7160,0x192));var _0x0716=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7160[_0x13e741];return _0x3f8bb3;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x0716('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0716('0x1')](0x0);var events={'afterCreate':_0x0716('0x2'),'afterUpdate':_0x0716('0x3'),'afterDestroy':_0x0716('0x4')};function emitEvent(_0x474d36){return function(_0x3806af,_0x5edb7d,_0x222963){SquareProjectEvents[_0x0716('0x5')](_0x474d36+':'+_0x3806af['id'],_0x3806af);SquareProjectEvents[_0x0716('0x5')](_0x474d36,_0x3806af);_0x222963(null);};}for(var e in events){if(events[_0x0716('0x6')](e)){var event=events[e];SquareProject[_0x0716('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3106fb3..d3ba5d3 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 _0xe15f=['preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed'];(function(_0x4f9bc6,_0x55e292){var _0x36b4de=function(_0xdeb4ce){while(--_0xdeb4ce){_0x4f9bc6['push'](_0x4f9bc6['shift']());}};_0x36b4de(++_0x55e292);}(_0xe15f,0x1d1));var _0xfe15=function(_0x1e6ff0,_0x205627){_0x1e6ff0=_0x1e6ff0-0x0;var _0x293f64=_0xe15f[_0x1e6ff0];return _0x293f64;};'use strict';var _=require(_0xfe15('0x0'));var util=require(_0xfe15('0x1'));var logger=require(_0xfe15('0x2'))(_0xfe15('0x3'));var moment=require(_0xfe15('0x4'));var BPromise=require(_0xfe15('0x5'));var rp=require(_0xfe15('0x6'));var fs=require('fs');var path=require(_0xfe15('0x7'));var rimraf=require('rimraf');var config=require(_0xfe15('0x8'));var attributes=require(_0xfe15('0x9'));module[_0xfe15('0xa')]=function(_0x3e1cea,_0x4e1174){return _0x3e1cea[_0xfe15('0xb')](_0xfe15('0xc'),attributes,{'tableName':_0xfe15('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35ae34,_0x956bb9,_0x38e9dc){if(_0x35ae34[_0xfe15('0xe')](_0xfe15('0xf'))){_0x35ae34[_0xfe15('0x10')]=moment()[_0xfe15('0x11')](_0xfe15('0x12'));}if(_0x35ae34[_0xfe15('0xe')](_0xfe15('0x13'))){_0x35ae34['publishedAt']=moment()[_0xfe15('0x11')](_0xfe15('0x12'));}_0x38e9dc(null,_0x35ae34);}}});}; \ No newline at end of file +var _0x0d69=['preproduction','savedAt','format','production','publishedAt','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed'];(function(_0x3a5169,_0x2e6cb0){var _0x311216=function(_0x343383){while(--_0x343383){_0x3a5169['push'](_0x3a5169['shift']());}};_0x311216(++_0x2e6cb0);}(_0x0d69,0x17b));var _0x90d6=function(_0x19d0bb,_0x23714d){_0x19d0bb=_0x19d0bb-0x0;var _0x3a20d1=_0x0d69[_0x19d0bb];return _0x3a20d1;};'use strict';var _=require(_0x90d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x90d6('0x1'));var moment=require('moment');var BPromise=require(_0x90d6('0x2'));var rp=require(_0x90d6('0x3'));var fs=require('fs');var path=require(_0x90d6('0x4'));var rimraf=require(_0x90d6('0x5'));var config=require(_0x90d6('0x6'));var attributes=require(_0x90d6('0x7'));module['exports']=function(_0x210508,_0x59bf93){return _0x210508[_0x90d6('0x8')](_0x90d6('0x9'),attributes,{'tableName':_0x90d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x160261,_0x16e0df,_0xacefd){if(_0x160261[_0x90d6('0xb')](_0x90d6('0xc'))){_0x160261[_0x90d6('0xd')]=moment()[_0x90d6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x160261['changed'](_0x90d6('0xf'))){_0x160261[_0x90d6('0x10')]=moment()[_0x90d6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xacefd(null,_0x160261);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6ec193b..3fbdedb 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 _0x835b=['GetSquareProjects','findAll','raw','options','where','attributes','include','model','map','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','find','info','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register'];(function(_0x2e3e49,_0x12128a){var _0x19d151=function(_0x335766){while(--_0x335766){_0x2e3e49['push'](_0x2e3e49['shift']());}};_0x19d151(++_0x12128a);}(_0x835b,0xdd));var _0xb835=function(_0xfb0801,_0x1ae851){_0xfb0801=_0xfb0801-0x0;var _0x1699c3=_0x835b[_0xfb0801];return _0x1699c3;};'use strict';var _=require(_0xb835('0x0'));var Redis=require('ioredis');var db=require(_0xb835('0x1'))['db'];var logger=require(_0xb835('0x2'))(_0xb835('0x3'));var config=require(_0xb835('0x4'));config['redis']=_[_0xb835('0x5')](config['redis'],{'host':_0xb835('0x6'),'port':0x18eb});var socket=require(_0xb835('0x7'))(new Redis(config[_0xb835('0x8')]));require(_0xb835('0x9'))[_0xb835('0xa')](socket);exports[_0xb835('0xb')]=function(_0xb3ab){var _0x304184=this;return new Promise(function(_0x4f4d4f,_0x4985e2){return db['SquareProject'][_0xb835('0xc')]({'raw':_0xb3ab['options']?_0xb3ab['options'][_0xb835('0xd')]===undefined?!![]:![]:!![],'where':_0xb3ab[_0xb835('0xe')]?_0xb3ab[_0xb835('0xe')][_0xb835('0xf')]||null:null,'attributes':_0xb3ab[_0xb835('0xe')]?_0xb3ab['options'][_0xb835('0x10')]||null:null,'limit':_0xb3ab[_0xb835('0xe')]?_0xb3ab['options']['limit']||null:null,'include':_0xb3ab[_0xb835('0xe')]?_0xb3ab[_0xb835('0xe')][_0xb835('0x11')]?_['map'](_0xb3ab[_0xb835('0xe')]['include'],function(_0x97d610){return{'model':db[_0x97d610[_0xb835('0x12')]],'as':_0x97d610['as'],'attributes':_0x97d610[_0xb835('0x10')],'include':_0x97d610[_0xb835('0x11')]?_[_0xb835('0x13')](_0x97d610[_0xb835('0x11')],function(_0x29f933){return{'model':db[_0x29f933[_0xb835('0x12')]],'as':_0x29f933['as'],'attributes':_0x29f933['attributes'],'include':_0x29f933[_0xb835('0x11')]?_[_0xb835('0x13')](_0x29f933[_0xb835('0x11')],function(_0x1fc8dc){return{'model':db[_0x1fc8dc['model']],'as':_0x1fc8dc['as'],'attributes':_0x1fc8dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4fb3){logger['info'](_0xb835('0xb'),_0xb3ab);logger[_0xb835('0x14')](_0xb835('0xb'),_0xb3ab,JSON[_0xb835('0x15')](_0x1d4fb3));_0x4f4d4f(_0x1d4fb3);})[_0xb835('0x16')](function(_0x5b4fe5){logger[_0xb835('0x17')]('GetSquareProjects',_0x5b4fe5[_0xb835('0x18')],_0xb3ab);_0x4985e2(_0x304184[_0xb835('0x17')](0x1f4,_0x5b4fe5[_0xb835('0x18')]));});});};exports[_0xb835('0x19')]=function(_0x42109a){var _0x28fb9a=this;return new Promise(function(_0x4480f6,_0x5ec2b1){return db[_0xb835('0x1a')][_0xb835('0x1b')]({'raw':_0x42109a[_0xb835('0xe')]?_0x42109a[_0xb835('0xe')][_0xb835('0xd')]===undefined?!![]:![]:!![],'where':_0x42109a['options']?_0x42109a[_0xb835('0xe')]['where']||null:null,'attributes':_0x42109a[_0xb835('0xe')]?_0x42109a[_0xb835('0xe')][_0xb835('0x10')]||null:null,'include':_0x42109a['options']?_0x42109a[_0xb835('0xe')][_0xb835('0x11')]?_['map'](_0x42109a[_0xb835('0xe')][_0xb835('0x11')],function(_0x1e9314){return{'model':db[_0x1e9314['model']],'as':_0x1e9314['as'],'attributes':_0x1e9314[_0xb835('0x10')],'include':_0x1e9314[_0xb835('0x11')]?_[_0xb835('0x13')](_0x1e9314[_0xb835('0x11')],function(_0x581070){return{'model':db[_0x581070[_0xb835('0x12')]],'as':_0x581070['as'],'attributes':_0x581070[_0xb835('0x10')],'include':_0x581070[_0xb835('0x11')]?_['map'](_0x581070['include'],function(_0x2c2629){return{'model':db[_0x2c2629[_0xb835('0x12')]],'as':_0x2c2629['as'],'attributes':_0x2c2629['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59999c){logger[_0xb835('0x1c')](_0xb835('0x19'),_0x42109a);logger[_0xb835('0x14')](_0xb835('0x19'),_0x42109a,JSON['stringify'](_0x59999c));_0x4480f6(_0x59999c);})[_0xb835('0x16')](function(_0x23965d){logger['error']('ShowSquareProject',_0x23965d[_0xb835('0x18')],_0x42109a);_0x5ec2b1(_0x28fb9a[_0xb835('0x17')](0x1f4,_0x23965d[_0xb835('0x18')]));});});}; \ No newline at end of file +var _0x7d99=['../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','catch','error','message','find','then','ShowSquareProject','debug','lodash','ioredis','../../mysqldb'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x7d99,0xbd));var _0x97d9=function(_0x34da5f,_0x2cf6f3){_0x34da5f=_0x34da5f-0x0;var _0x1d3178=_0x7d99[_0x34da5f];return _0x1d3178;};'use strict';var _=require(_0x97d9('0x0'));var Redis=require(_0x97d9('0x1'));var db=require(_0x97d9('0x2'))['db'];var logger=require(_0x97d9('0x3'))(_0x97d9('0x4'));var config=require(_0x97d9('0x5'));config[_0x97d9('0x6')]=_[_0x97d9('0x7')](config[_0x97d9('0x6')],{'host':_0x97d9('0x8'),'port':0x18eb});var socket=require(_0x97d9('0x9'))(new Redis(config[_0x97d9('0x6')]));require(_0x97d9('0xa'))[_0x97d9('0xb')](socket);exports[_0x97d9('0xc')]=function(_0x259c01){var _0x2ea5cc=this;return new Promise(function(_0x41891d,_0x225da8){return db[_0x97d9('0xd')][_0x97d9('0xe')]({'raw':_0x259c01[_0x97d9('0xf')]?_0x259c01['options'][_0x97d9('0x10')]===undefined?!![]:![]:!![],'where':_0x259c01[_0x97d9('0xf')]?_0x259c01[_0x97d9('0xf')][_0x97d9('0x11')]||null:null,'attributes':_0x259c01[_0x97d9('0xf')]?_0x259c01[_0x97d9('0xf')][_0x97d9('0x12')]||null:null,'limit':_0x259c01[_0x97d9('0xf')]?_0x259c01[_0x97d9('0xf')][_0x97d9('0x13')]||null:null,'include':_0x259c01['options']?_0x259c01[_0x97d9('0xf')][_0x97d9('0x14')]?_[_0x97d9('0x15')](_0x259c01['options'][_0x97d9('0x14')],function(_0x5d0032){return{'model':db[_0x5d0032[_0x97d9('0x16')]],'as':_0x5d0032['as'],'attributes':_0x5d0032[_0x97d9('0x12')],'include':_0x5d0032[_0x97d9('0x14')]?_[_0x97d9('0x15')](_0x5d0032[_0x97d9('0x14')],function(_0x4ad65d){return{'model':db[_0x4ad65d[_0x97d9('0x16')]],'as':_0x4ad65d['as'],'attributes':_0x4ad65d[_0x97d9('0x12')],'include':_0x4ad65d['include']?_[_0x97d9('0x15')](_0x4ad65d['include'],function(_0x86ae33){return{'model':db[_0x86ae33[_0x97d9('0x16')]],'as':_0x86ae33['as'],'attributes':_0x86ae33[_0x97d9('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31066a){logger[_0x97d9('0x17')](_0x97d9('0xc'),_0x259c01);logger['debug'](_0x97d9('0xc'),_0x259c01,JSON[_0x97d9('0x18')](_0x31066a));_0x41891d(_0x31066a);})[_0x97d9('0x19')](function(_0xafdd8b){logger[_0x97d9('0x1a')]('GetSquareProjects',_0xafdd8b[_0x97d9('0x1b')],_0x259c01);_0x225da8(_0x2ea5cc[_0x97d9('0x1a')](0x1f4,_0xafdd8b[_0x97d9('0x1b')]));});});};exports['ShowSquareProject']=function(_0x4feb46){var _0x20fdf0=this;return new Promise(function(_0x460139,_0x8a796d){return db[_0x97d9('0xd')][_0x97d9('0x1c')]({'raw':_0x4feb46[_0x97d9('0xf')]?_0x4feb46[_0x97d9('0xf')][_0x97d9('0x10')]===undefined?!![]:![]:!![],'where':_0x4feb46[_0x97d9('0xf')]?_0x4feb46[_0x97d9('0xf')][_0x97d9('0x11')]||null:null,'attributes':_0x4feb46[_0x97d9('0xf')]?_0x4feb46['options']['attributes']||null:null,'include':_0x4feb46['options']?_0x4feb46['options'][_0x97d9('0x14')]?_[_0x97d9('0x15')](_0x4feb46['options'][_0x97d9('0x14')],function(_0x56d2d9){return{'model':db[_0x56d2d9[_0x97d9('0x16')]],'as':_0x56d2d9['as'],'attributes':_0x56d2d9['attributes'],'include':_0x56d2d9[_0x97d9('0x14')]?_[_0x97d9('0x15')](_0x56d2d9[_0x97d9('0x14')],function(_0x3fad30){return{'model':db[_0x3fad30['model']],'as':_0x3fad30['as'],'attributes':_0x3fad30[_0x97d9('0x12')],'include':_0x3fad30[_0x97d9('0x14')]?_[_0x97d9('0x15')](_0x3fad30[_0x97d9('0x14')],function(_0x58b7bf){return{'model':db[_0x58b7bf['model']],'as':_0x58b7bf['as'],'attributes':_0x58b7bf[_0x97d9('0x12')]};}):[]};}):[]};}):[]:[]})[_0x97d9('0x1d')](function(_0x4bcdf3){logger['info'](_0x97d9('0x1e'),_0x4feb46);logger[_0x97d9('0x1f')](_0x97d9('0x1e'),_0x4feb46,JSON[_0x97d9('0x18')](_0x4bcdf3));_0x460139(_0x4bcdf3);})[_0x97d9('0x19')](function(_0x214e35){logger['error'](_0x97d9('0x1e'),_0x214e35['message'],_0x4feb46);_0x8a796d(_0x20fdf0[_0x97d9('0x1a')](0x1f4,_0x214e35['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 453fa9a..63468dc 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 _0xccd1=['save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xccd1,0x88));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x1ccd('0x0'),_0x1ccd('0x1'),_0x1ccd('0x2')];function createListener(_0x1b1ae5,_0x71512e){return function(_0x4253ad){_0x71512e[_0x1ccd('0x3')](_0x1b1ae5,_0x4253ad);};}function removeListener(_0x5de36f,_0x53b31d){return function(){SquareProjectEvents[_0x1ccd('0x4')](_0x5de36f,_0x53b31d);};}exports[_0x1ccd('0x5')]=function(_0x106c6a){for(var _0x3cf957=0x0,_0x3f55ec=events[_0x1ccd('0x6')];_0x3cf957<_0x3f55ec;_0x3cf957++){var _0x134099=events[_0x3cf957];var _0x4d89e4=createListener(_0x1ccd('0x7')+_0x134099,_0x106c6a);SquareProjectEvents['on'](_0x134099,_0x4d89e4);}}; \ No newline at end of file +var _0xdb56=['register','squareProject:','save','remove','emit'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xdb56,0xa2));var _0x6db5=function(_0x170994,_0x5adc66){_0x170994=_0x170994-0x0;var _0x3c89a3=_0xdb56[_0x170994];return _0x3c89a3;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6db5('0x0'),_0x6db5('0x1'),'update'];function createListener(_0x47e100,_0x10b5ab){return function(_0x14b4d8){_0x10b5ab[_0x6db5('0x2')](_0x47e100,_0x14b4d8);};}function removeListener(_0x33132b,_0x1b3905){return function(){SquareProjectEvents['removeListener'](_0x33132b,_0x1b3905);};}exports[_0x6db5('0x3')]=function(_0x4cd784){for(var _0x322798=0x0,_0x53e8bb=events['length'];_0x322798<_0x53e8bb;_0x322798++){var _0x3cff22=events[_0x322798];var _0x27e36f=createListener(_0x6db5('0x4')+_0x3cff22,_0x4cd784);SquareProjectEvents['on'](_0x3cff22,_0x27e36f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e5e9c92..8a4f80a 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x2564cf,_0x213e3e){var _0x27d967=function(_0x1aca64){while(--_0x1aca64){_0x2564cf['push'](_0x2564cf['shift']());}};_0x27d967(++_0x213e3e);}(_0x814b,0x1a2));var _0xb814=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x814b[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1f5e0b,_0xab48f2){var _0x551280=function(_0x5c8319){while(--_0x5c8319){_0x1f5e0b['push'](_0x1f5e0b['shift']());}};_0x551280(++_0xab48f2);}(_0x7a54,0x106));var _0x47a5=function(_0x42f2e2,_0x4614cf){_0x42f2e2=_0x42f2e2-0x0;var _0x343102=_0x7a54[_0x42f2e2];return _0x343102;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d753c40..3669c21 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 _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x16ec06,_0x1513b5){var _0xee6d30=function(_0x1c056d){while(--_0x1c056d){_0x16ec06['push'](_0x16ec06['shift']());}};_0xee6d30(++_0x1513b5);}(_0x98a8,0x12c));var _0x898a=function(_0x5c2d93,_0x10dd36){_0x5c2d93=_0x5c2d93-0x0;var _0x639b0d=_0x98a8[_0x5c2d93];return _0x639b0d;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'extension':{'type':Sequelize[_0x898a('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'dnid':{'type':Sequelize[_0x898a('0x2')]},'projectName':{'type':Sequelize[_0x898a('0x2')]},'saveName':{'type':Sequelize[_0x898a('0x2')]},'filename':{'type':Sequelize[_0x898a('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x898a('0x3')],'get':function(){var _0x564583='';var _0xfa8c50=this['getDataValue'](_0x898a('0x4'));if(_0xfa8c50){_0x564583=_0xfa8c50[_0x898a('0x5')](_0xfa8c50[_0x898a('0x6')]('.'));}return _0x564583;}}}; \ No newline at end of file +var _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x2c674d,_0x57881c){var _0x3e88da=function(_0x4b5201){while(--_0x4b5201){_0x2c674d['push'](_0x2c674d['shift']());}};_0x3e88da(++_0x57881c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x50613f,_0x20ad55){_0x50613f=_0x50613f-0x0;var _0x2abf1e=_0xbd51[_0x50613f];return _0x2abf1e;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d121969..ee5273f 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 _0xd2d8=['limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','params','includeAll','create','body','find','../../components/encryptor','type','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x490f03,_0x427c97){var _0xdd7d93=function(_0x44d463){while(--_0x44d463){_0x490f03['push'](_0x490f03['shift']());}};_0xdd7d93(++_0x427c97);}(_0xd2d8,0x1c4));var _0x8d2d=function(_0x139b85,_0x5e0691){_0x139b85=_0x139b85-0x0;var _0x1e833f=_0xd2d8[_0x139b85];return _0x1e833f;};'use strict';var emlformat=require(_0x8d2d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d2d('0x1'));var rp=require('request-promise');var moment=require(_0x8d2d('0x2'));var BPromise=require(_0x8d2d('0x3'));var Mustache=require('mustache');var util=require(_0x8d2d('0x4'));var path=require(_0x8d2d('0x5'));var sox=require(_0x8d2d('0x6'));var csv=require(_0x8d2d('0x7'));var ejs=require(_0x8d2d('0x8'));var fs=require('fs');var fs_extra=require(_0x8d2d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d2d('0xa'));var jsforce=require(_0x8d2d('0xb'));var deskjs=require(_0x8d2d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8d2d('0xd'));var Papa=require(_0x8d2d('0xe'));var Redis=require('ioredis');var authService=require(_0x8d2d('0xf'));var qs=require(_0x8d2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d2d('0x11'))(_0x8d2d('0x12'));var utils=require(_0x8d2d('0x13'));var config=require(_0x8d2d('0x14'));var licenseUtil=require(_0x8d2d('0x15'));var db=require(_0x8d2d('0x16'))['db'];function respondWithStatusCode(_0x374a98,_0x1da087){_0x1da087=_0x1da087||0xcc;return function(_0x563a21){if(_0x563a21){return _0x374a98[_0x8d2d('0x17')](_0x1da087);}return _0x374a98[_0x8d2d('0x18')](_0x1da087)['end']();};}function respondWithResult(_0x3505dc,_0x307174){_0x307174=_0x307174||0xc8;return function(_0x59da8e){if(_0x59da8e){return _0x3505dc['status'](_0x307174)[_0x8d2d('0x19')](_0x59da8e);}};}function respondWithFilteredResult(_0x1892b7,_0x777a0e){return function(_0x337c6e){if(_0x337c6e){var _0x43d346=typeof _0x777a0e[_0x8d2d('0x1a')]===_0x8d2d('0x1b')&&typeof _0x777a0e[_0x8d2d('0x1c')]===_0x8d2d('0x1b');var _0x58344f=_0x337c6e[_0x8d2d('0x1d')];var _0x4d839b=_0x43d346?0x0:_0x777a0e[_0x8d2d('0x1a')];var _0x26382c=_0x43d346?_0x337c6e['count']:_0x777a0e['offset']+_0x777a0e[_0x8d2d('0x1c')];var _0x39eeaf;if(_0x26382c>=_0x58344f){_0x26382c=_0x58344f;_0x39eeaf=0xc8;}else{_0x39eeaf=0xce;}_0x1892b7['status'](_0x39eeaf);return _0x1892b7[_0x8d2d('0x1e')](_0x8d2d('0x1f'),_0x4d839b+'-'+_0x26382c+'/'+_0x58344f)[_0x8d2d('0x19')](_0x337c6e);}return null;};}function patchUpdates(_0x2eca6b){return function(_0x3d7d25){try{jsonpatch[_0x8d2d('0x20')](_0x3d7d25,_0x2eca6b,!![]);}catch(_0x49e45e){return BPromise[_0x8d2d('0x21')](_0x49e45e);}return _0x3d7d25[_0x8d2d('0x22')]();};}function saveUpdates(_0x5005fc,_0x4316e8){return function(_0x1a61d4){if(_0x1a61d4){return _0x1a61d4[_0x8d2d('0x23')](_0x5005fc)[_0x8d2d('0x24')](function(_0x4de432){return _0x4de432;});}return null;};}function removeEntity(_0x416273,_0x4af57d){return function(_0x32bfda){if(_0x32bfda){return _0x32bfda['destroy']()['then'](function(){_0x416273[_0x8d2d('0x18')](0xcc)[_0x8d2d('0x25')]();});}};}function handleEntityNotFound(_0x2f69bb,_0x31a8b7){return function(_0x277198){if(!_0x277198){_0x2f69bb[_0x8d2d('0x17')](0x194);}return _0x277198;};}function handleError(_0x2c1b2d,_0x3ccf2c){_0x3ccf2c=_0x3ccf2c||0x1f4;return function(_0x5ca3cb){logger[_0x8d2d('0x26')](_0x5ca3cb[_0x8d2d('0x27')]);if(_0x5ca3cb[_0x8d2d('0x28')]){delete _0x5ca3cb[_0x8d2d('0x28')];}_0x2c1b2d['status'](_0x3ccf2c)[_0x8d2d('0x29')](_0x5ca3cb);};}exports['index']=function(_0x2b51fc,_0x521c52){var _0x3d6634={},_0x101f1c={},_0x55c525={'count':0x0,'rows':[]};var _0x561f09=_[_0x8d2d('0x2a')](db[_0x8d2d('0x2b')][_0x8d2d('0x2c')],function(_0x202e52){return{'name':_0x202e52[_0x8d2d('0x2d')],'type':_0x202e52['type'][_0x8d2d('0x2e')]};});_0x101f1c[_0x8d2d('0x2f')]=_[_0x8d2d('0x2a')](_0x561f09,_0x8d2d('0x28'));_0x101f1c[_0x8d2d('0x30')]=_[_0x8d2d('0x31')](_0x2b51fc[_0x8d2d('0x30')]);_0x101f1c[_0x8d2d('0x32')]=_[_0x8d2d('0x33')](_0x101f1c[_0x8d2d('0x2f')],_0x101f1c['query']);_0x3d6634[_0x8d2d('0x34')]=_[_0x8d2d('0x33')](_0x101f1c['model'],qs[_0x8d2d('0x35')](_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x35')]));_0x3d6634['attributes']=_0x3d6634[_0x8d2d('0x34')][_0x8d2d('0x36')]?_0x3d6634[_0x8d2d('0x34')]:_0x101f1c['model'];if(!_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x37')]('nolimit')){_0x3d6634[_0x8d2d('0x1c')]=qs[_0x8d2d('0x1c')](_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x1c')]);_0x3d6634['offset']=qs[_0x8d2d('0x1a')](_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x1a')]);}_0x3d6634[_0x8d2d('0x38')]=qs[_0x8d2d('0x39')](_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x39')]);_0x3d6634['where']=qs['filters'](_[_0x8d2d('0x3a')](_0x2b51fc[_0x8d2d('0x30')],_0x101f1c[_0x8d2d('0x32')]),_0x561f09);if(_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x3b')]){_0x3d6634[_0x8d2d('0x3c')]=_['merge'](_0x3d6634['where'],{'$or':_[_0x8d2d('0x2a')](_0x561f09,function(_0xab4a78){if(_0xab4a78['type']!==_0x8d2d('0x3d')){var _0x48e867={};_0x48e867[_0xab4a78['name']]={'$like':'%'+_0x2b51fc[_0x8d2d('0x30')][_0x8d2d('0x3b')]+'%'};return _0x48e867;}})});}_0x3d6634=_[_0x8d2d('0x3e')]({},_0x3d6634,_0x2b51fc[_0x8d2d('0x3f')]);var _0x2fe85d={'where':_0x3d6634[_0x8d2d('0x3c')]};return db[_0x8d2d('0x2b')][_0x8d2d('0x1d')](_0x2fe85d)[_0x8d2d('0x24')](function(_0x27a41c){_0x55c525[_0x8d2d('0x1d')]=_0x27a41c;if(_0x2b51fc['query']['includeAll']){_0x3d6634[_0x8d2d('0x40')]=[{'all':!![]}];}return db[_0x8d2d('0x2b')]['findAll'](_0x3d6634);})[_0x8d2d('0x24')](function(_0x74bad3){_0x55c525[_0x8d2d('0x41')]=_0x74bad3;return _0x55c525;})[_0x8d2d('0x24')](respondWithFilteredResult(_0x521c52,_0x3d6634))[_0x8d2d('0x42')](handleError(_0x521c52,null));};exports['show']=function(_0x5f1fcf,_0x12af4e){var _0x441080={'raw':!![],'where':{'id':_0x5f1fcf[_0x8d2d('0x43')]['id']}},_0x761254={};_0x761254[_0x8d2d('0x2f')]=_[_0x8d2d('0x31')](db[_0x8d2d('0x2b')][_0x8d2d('0x2c')]);_0x761254[_0x8d2d('0x30')]=_['keys'](_0x5f1fcf['query']);_0x761254['filters']=_['intersection'](_0x761254[_0x8d2d('0x2f')],_0x761254[_0x8d2d('0x30')]);_0x441080[_0x8d2d('0x34')]=_[_0x8d2d('0x33')](_0x761254[_0x8d2d('0x2f')],qs[_0x8d2d('0x35')](_0x5f1fcf[_0x8d2d('0x30')]['fields']));_0x441080[_0x8d2d('0x34')]=_0x441080['attributes'][_0x8d2d('0x36')]?_0x441080['attributes']:_0x761254[_0x8d2d('0x2f')];if(_0x5f1fcf[_0x8d2d('0x30')][_0x8d2d('0x44')]){_0x441080[_0x8d2d('0x40')]=[{'all':!![]}];}_0x441080=_[_0x8d2d('0x3e')]({},_0x441080,_0x5f1fcf['options']);return db[_0x8d2d('0x2b')]['find'](_0x441080)[_0x8d2d('0x24')](handleEntityNotFound(_0x12af4e,null))[_0x8d2d('0x24')](respondWithResult(_0x12af4e,null))[_0x8d2d('0x42')](handleError(_0x12af4e,null));};exports[_0x8d2d('0x45')]=function(_0x5eeea8,_0x581801){return db[_0x8d2d('0x2b')][_0x8d2d('0x45')](_0x5eeea8[_0x8d2d('0x46')],{})['then'](respondWithResult(_0x581801,0xc9))[_0x8d2d('0x42')](handleError(_0x581801,null));};exports['update']=function(_0x503079,_0xf1222f){if(_0x503079[_0x8d2d('0x46')]['id']){delete _0x503079[_0x8d2d('0x46')]['id'];}return db[_0x8d2d('0x2b')][_0x8d2d('0x47')]({'where':{'id':_0x503079['params']['id']}})[_0x8d2d('0x24')](handleEntityNotFound(_0xf1222f,null))[_0x8d2d('0x24')](saveUpdates(_0x503079['body'],null))['then'](respondWithResult(_0xf1222f,null))[_0x8d2d('0x42')](handleError(_0xf1222f,null));};exports['download']=function(_0x2af163,_0x4a33cf,_0x5b0dbc){var _0x13ddf8=require(_0x8d2d('0x48'));var _0x344cf4=![];var _0x127c5e={};if(_0x2af163[_0x8d2d('0x30')][_0x8d2d('0x49')]&&_0x2af163[_0x8d2d('0x30')][_0x8d2d('0x49')]===_0x8d2d('0x4a')){_0x127c5e[_0x8d2d('0x4a')]=_0x2af163[_0x8d2d('0x43')]['id'];}else{_0x127c5e['id']=_0x2af163[_0x8d2d('0x43')]['id'];}return db['SquareRecording'][_0x8d2d('0x47')]({'where':_0x127c5e,'attributes':['id','savePath',_0x8d2d('0x4b')],'raw':!![]})[_0x8d2d('0x24')](handleEntityNotFound(_0x4a33cf,null))[_0x8d2d('0x24')](function(_0x11cf8c){if(_0x11cf8c){var _0x590d32=_0x11cf8c[_0x8d2d('0x4c')];var _0x34b3f8=util['format'](_0x8d2d('0x4d'),_0x590d32);if(fs[_0x8d2d('0x4e')](_0x34b3f8)){_0x344cf4=!![];return _0x13ddf8[_0x8d2d('0x4f')](_0x34b3f8,_0x590d32,config[_0x8d2d('0x50')][_0x8d2d('0x51')])[_0x8d2d('0x24')](function(){return _0x11cf8c;});}return _0x11cf8c;}})['then'](function(_0x3f6c1a){if(_0x3f6c1a){var _0x44c584=_0x3f6c1a[_0x8d2d('0x4c')];if(!fs[_0x8d2d('0x4e')](_0x44c584)){throw new db[(_0x8d2d('0x52'))]['ValidationError'](_0x8d2d('0x53'));}if(_0x3f6c1a[_0x8d2d('0x4b')]){return _0x4a33cf[_0x8d2d('0x54')](_0x44c584,_0x3f6c1a['filename']+path['extname'](_0x44c584),function(){if(_0x344cf4){fs[_0x8d2d('0x55')](_0x44c584);}});}else{return _0x4a33cf[_0x8d2d('0x54')](_0x44c584,function(_0x36bc1d){if(_0x344cf4){fs[_0x8d2d('0x55')](_0x44c584);}});}}})[_0x8d2d('0x42')](function(_0x2595e7){if(_0x2595e7[_0x8d2d('0x56')]===_0x8d2d('0x53')){_0x4a33cf['status'](0x194)[_0x8d2d('0x29')](_0x8d2d('0x57'));}else{return handleError(_0x4a33cf,null);}});};exports[_0x8d2d('0x58')]=function(_0x40cb5e,_0x11de64){return db[_0x8d2d('0x2b')][_0x8d2d('0x47')]({'where':{'id':_0x40cb5e['params']['id']}})[_0x8d2d('0x24')](function(_0x107d85){if(_[_0x8d2d('0x59')](_0x107d85)){throw new ReferenceError('Entity\x20not\x20found');}return _0x107d85;})['then'](function(_0x20ac9e){var _0xc2f2d3=_0x20ac9e[_0x8d2d('0x4c')];logger[_0x8d2d('0x5a')](_0x8d2d('0x5b'),_0xc2f2d3);if(!_['isNil'](_0x20ac9e[_0x8d2d('0x4c')])&&fs[_0x8d2d('0x4e')](_0xc2f2d3)){logger[_0x8d2d('0x5a')](_0x8d2d('0x5c')+_0xc2f2d3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8d2d('0x5d')](_0xc2f2d3);}_0xc2f2d3=_0xc2f2d3+_0x8d2d('0x5e');if(!_[_0x8d2d('0x59')](_0x20ac9e[_0x8d2d('0x4c')])&&fs[_0x8d2d('0x4e')](_0xc2f2d3)){logger[_0x8d2d('0x5a')]('File:\x20\x22'+_0xc2f2d3+_0x8d2d('0x5f'));fs[_0x8d2d('0x5d')](_0xc2f2d3);}return _0x20ac9e;})['then'](function(_0x5a8467){if(!_0x5a8467)throw new InternalError();return _0x5a8467[_0x8d2d('0x58')]();})[_0x8d2d('0x24')](function(){_0x11de64[_0x8d2d('0x18')](0xcc)[_0x8d2d('0x25')]();})[_0x8d2d('0x42')](handleError(_0x11de64,null));}; \ No newline at end of file +var _0xba68=['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','../../config/license/util','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','download','../../components/encryptor','uniqueid','find','filename','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x863fdb,_0x48b348){var _0x37aa61=function(_0x4dfaf2){while(--_0x4dfaf2){_0x863fdb['push'](_0x863fdb['shift']());}};_0x37aa61(++_0x48b348);}(_0xba68,0xc7));var _0x8ba6=function(_0x32921a,_0x24521c){_0x32921a=_0x32921a-0x0;var _0x1541be=_0xba68[_0x32921a];return _0x1541be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ba6('0x0'));var jsonpatch=require(_0x8ba6('0x1'));var rp=require(_0x8ba6('0x2'));var moment=require(_0x8ba6('0x3'));var BPromise=require(_0x8ba6('0x4'));var Mustache=require(_0x8ba6('0x5'));var util=require('util');var path=require(_0x8ba6('0x6'));var sox=require(_0x8ba6('0x7'));var csv=require(_0x8ba6('0x8'));var ejs=require(_0x8ba6('0x9'));var fs=require('fs');var fs_extra=require(_0x8ba6('0xa'));var _=require(_0x8ba6('0xb'));var squel=require(_0x8ba6('0xc'));var crypto=require(_0x8ba6('0xd'));var jsforce=require(_0x8ba6('0xe'));var deskjs=require(_0x8ba6('0xf'));var toCsv=require(_0x8ba6('0x8'));var querystring=require(_0x8ba6('0x10'));var Papa=require(_0x8ba6('0x11'));var Redis=require(_0x8ba6('0x12'));var authService=require(_0x8ba6('0x13'));var qs=require(_0x8ba6('0x14'));var as=require(_0x8ba6('0x15'));var hardwareService=require(_0x8ba6('0x16'));var logger=require(_0x8ba6('0x17'))(_0x8ba6('0x18'));var utils=require(_0x8ba6('0x19'));var config=require(_0x8ba6('0x1a'));var licenseUtil=require(_0x8ba6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x205858,_0xf15cb5){_0xf15cb5=_0xf15cb5||0xcc;return function(_0x15a348){if(_0x15a348){return _0x205858['sendStatus'](_0xf15cb5);}return _0x205858[_0x8ba6('0x1c')](_0xf15cb5)['end']();};}function respondWithResult(_0x4eda81,_0x5cd37d){_0x5cd37d=_0x5cd37d||0xc8;return function(_0x3008d8){if(_0x3008d8){return _0x4eda81[_0x8ba6('0x1c')](_0x5cd37d)['json'](_0x3008d8);}};}function respondWithFilteredResult(_0x423e51,_0x50c3f6){return function(_0x1326ca){if(_0x1326ca){var _0x463800=typeof _0x50c3f6['offset']===_0x8ba6('0x1d')&&typeof _0x50c3f6[_0x8ba6('0x1e')]==='undefined';var _0x18dfae=_0x1326ca[_0x8ba6('0x1f')];var _0x4b74c4=_0x463800?0x0:_0x50c3f6[_0x8ba6('0x20')];var _0x436495=_0x463800?_0x1326ca[_0x8ba6('0x1f')]:_0x50c3f6[_0x8ba6('0x20')]+_0x50c3f6[_0x8ba6('0x1e')];var _0xb5eafa;if(_0x436495>=_0x18dfae){_0x436495=_0x18dfae;_0xb5eafa=0xc8;}else{_0xb5eafa=0xce;}_0x423e51[_0x8ba6('0x1c')](_0xb5eafa);return _0x423e51[_0x8ba6('0x21')](_0x8ba6('0x22'),_0x4b74c4+'-'+_0x436495+'/'+_0x18dfae)[_0x8ba6('0x23')](_0x1326ca);}return null;};}function patchUpdates(_0x3d20cb){return function(_0x2933c2){try{jsonpatch[_0x8ba6('0x24')](_0x2933c2,_0x3d20cb,!![]);}catch(_0x3d4405){return BPromise[_0x8ba6('0x25')](_0x3d4405);}return _0x2933c2['save']();};}function saveUpdates(_0x484c4e,_0x2ee240){return function(_0x2bec08){if(_0x2bec08){return _0x2bec08[_0x8ba6('0x26')](_0x484c4e)[_0x8ba6('0x27')](function(_0x5718b1){return _0x5718b1;});}return null;};}function removeEntity(_0x962d50,_0x4727fc){return function(_0x4cb6ad){if(_0x4cb6ad){return _0x4cb6ad[_0x8ba6('0x28')]()[_0x8ba6('0x27')](function(){_0x962d50[_0x8ba6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2d00,_0x40994a){return function(_0x50c3f4){if(!_0x50c3f4){_0xe2d00['sendStatus'](0x194);}return _0x50c3f4;};}function handleError(_0x3a3311,_0x595a4e){_0x595a4e=_0x595a4e||0x1f4;return function(_0xc49921){logger[_0x8ba6('0x29')](_0xc49921[_0x8ba6('0x2a')]);if(_0xc49921[_0x8ba6('0x2b')]){delete _0xc49921[_0x8ba6('0x2b')];}_0x3a3311[_0x8ba6('0x1c')](_0x595a4e)[_0x8ba6('0x2c')](_0xc49921);};}exports[_0x8ba6('0x2d')]=function(_0x5d55aa,_0x4e3479){var _0x3b0f6a={},_0x4b6012={},_0x1e9c7f={'count':0x0,'rows':[]};var _0x57b30f=_[_0x8ba6('0x2e')](db[_0x8ba6('0x2f')][_0x8ba6('0x30')],function(_0x2b27ac){return{'name':_0x2b27ac[_0x8ba6('0x31')],'type':_0x2b27ac[_0x8ba6('0x32')][_0x8ba6('0x33')]};});_0x4b6012[_0x8ba6('0x34')]=_[_0x8ba6('0x2e')](_0x57b30f,'name');_0x4b6012[_0x8ba6('0x35')]=_[_0x8ba6('0x36')](_0x5d55aa[_0x8ba6('0x35')]);_0x4b6012['filters']=_['intersection'](_0x4b6012[_0x8ba6('0x34')],_0x4b6012['query']);_0x3b0f6a[_0x8ba6('0x37')]=_['intersection'](_0x4b6012[_0x8ba6('0x34')],qs[_0x8ba6('0x38')](_0x5d55aa['query'][_0x8ba6('0x38')]));_0x3b0f6a[_0x8ba6('0x37')]=_0x3b0f6a[_0x8ba6('0x37')][_0x8ba6('0x39')]?_0x3b0f6a[_0x8ba6('0x37')]:_0x4b6012[_0x8ba6('0x34')];if(!_0x5d55aa['query']['hasOwnProperty'](_0x8ba6('0x3a'))){_0x3b0f6a[_0x8ba6('0x1e')]=qs[_0x8ba6('0x1e')](_0x5d55aa['query'][_0x8ba6('0x1e')]);_0x3b0f6a[_0x8ba6('0x20')]=qs[_0x8ba6('0x20')](_0x5d55aa[_0x8ba6('0x35')][_0x8ba6('0x20')]);}_0x3b0f6a[_0x8ba6('0x3b')]=qs[_0x8ba6('0x3c')](_0x5d55aa['query'][_0x8ba6('0x3c')]);_0x3b0f6a[_0x8ba6('0x3d')]=qs[_0x8ba6('0x3e')](_[_0x8ba6('0x3f')](_0x5d55aa[_0x8ba6('0x35')],_0x4b6012[_0x8ba6('0x3e')]),_0x57b30f);if(_0x5d55aa[_0x8ba6('0x35')][_0x8ba6('0x40')]){_0x3b0f6a[_0x8ba6('0x3d')]=_[_0x8ba6('0x41')](_0x3b0f6a['where'],{'$or':_[_0x8ba6('0x2e')](_0x57b30f,function(_0x343b5d){if(_0x343b5d[_0x8ba6('0x32')]!=='VIRTUAL'){var _0x10f970={};_0x10f970[_0x343b5d[_0x8ba6('0x2b')]]={'$like':'%'+_0x5d55aa[_0x8ba6('0x35')][_0x8ba6('0x40')]+'%'};return _0x10f970;}})});}_0x3b0f6a=_[_0x8ba6('0x41')]({},_0x3b0f6a,_0x5d55aa[_0x8ba6('0x42')]);var _0xdd8d46={'where':_0x3b0f6a[_0x8ba6('0x3d')]};return db[_0x8ba6('0x2f')][_0x8ba6('0x1f')](_0xdd8d46)[_0x8ba6('0x27')](function(_0x597aa5){_0x1e9c7f[_0x8ba6('0x1f')]=_0x597aa5;if(_0x5d55aa[_0x8ba6('0x35')][_0x8ba6('0x43')]){_0x3b0f6a[_0x8ba6('0x44')]=[{'all':!![]}];}return db[_0x8ba6('0x2f')][_0x8ba6('0x45')](_0x3b0f6a);})[_0x8ba6('0x27')](function(_0x4f38e4){_0x1e9c7f[_0x8ba6('0x46')]=_0x4f38e4;return _0x1e9c7f;})[_0x8ba6('0x27')](respondWithFilteredResult(_0x4e3479,_0x3b0f6a))['catch'](handleError(_0x4e3479,null));};exports[_0x8ba6('0x47')]=function(_0x3e6ea7,_0x537801){var _0x56a899={'raw':!![],'where':{'id':_0x3e6ea7[_0x8ba6('0x48')]['id']}},_0x227710={};_0x227710[_0x8ba6('0x34')]=_[_0x8ba6('0x36')](db[_0x8ba6('0x2f')][_0x8ba6('0x30')]);_0x227710[_0x8ba6('0x35')]=_['keys'](_0x3e6ea7[_0x8ba6('0x35')]);_0x227710['filters']=_[_0x8ba6('0x49')](_0x227710['model'],_0x227710[_0x8ba6('0x35')]);_0x56a899[_0x8ba6('0x37')]=_[_0x8ba6('0x49')](_0x227710[_0x8ba6('0x34')],qs[_0x8ba6('0x38')](_0x3e6ea7[_0x8ba6('0x35')][_0x8ba6('0x38')]));_0x56a899['attributes']=_0x56a899['attributes'][_0x8ba6('0x39')]?_0x56a899[_0x8ba6('0x37')]:_0x227710[_0x8ba6('0x34')];if(_0x3e6ea7[_0x8ba6('0x35')][_0x8ba6('0x43')]){_0x56a899[_0x8ba6('0x44')]=[{'all':!![]}];}_0x56a899=_[_0x8ba6('0x41')]({},_0x56a899,_0x3e6ea7[_0x8ba6('0x42')]);return db[_0x8ba6('0x2f')]['find'](_0x56a899)[_0x8ba6('0x27')](handleEntityNotFound(_0x537801,null))['then'](respondWithResult(_0x537801,null))[_0x8ba6('0x4a')](handleError(_0x537801,null));};exports['create']=function(_0x2395c1,_0x49dedf){return db[_0x8ba6('0x2f')][_0x8ba6('0x4b')](_0x2395c1[_0x8ba6('0x4c')],{})[_0x8ba6('0x27')](respondWithResult(_0x49dedf,0xc9))[_0x8ba6('0x4a')](handleError(_0x49dedf,null));};exports[_0x8ba6('0x26')]=function(_0x2b5bf8,_0x24d2f6){if(_0x2b5bf8[_0x8ba6('0x4c')]['id']){delete _0x2b5bf8[_0x8ba6('0x4c')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x2b5bf8['params']['id']}})[_0x8ba6('0x27')](handleEntityNotFound(_0x24d2f6,null))[_0x8ba6('0x27')](saveUpdates(_0x2b5bf8[_0x8ba6('0x4c')],null))[_0x8ba6('0x27')](respondWithResult(_0x24d2f6,null))['catch'](handleError(_0x24d2f6,null));};exports[_0x8ba6('0x4d')]=function(_0x5e1927,_0x527a97,_0x56d854){var _0x326d8b=require(_0x8ba6('0x4e'));var _0x2b24bc=![];var _0x4eb196={};if(_0x5e1927['query']['type']&&_0x5e1927['query'][_0x8ba6('0x32')]===_0x8ba6('0x4f')){_0x4eb196[_0x8ba6('0x4f')]=_0x5e1927[_0x8ba6('0x48')]['id'];}else{_0x4eb196['id']=_0x5e1927['params']['id'];}return db[_0x8ba6('0x2f')][_0x8ba6('0x50')]({'where':_0x4eb196,'attributes':['id','savePath',_0x8ba6('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x527a97,null))[_0x8ba6('0x27')](function(_0x14921f){if(_0x14921f){var _0x39885f=_0x14921f[_0x8ba6('0x52')];var _0x458ad9=util[_0x8ba6('0x53')](_0x8ba6('0x54'),_0x39885f);if(fs[_0x8ba6('0x55')](_0x458ad9)){_0x2b24bc=!![];return _0x326d8b['decryptFile'](_0x458ad9,_0x39885f,config[_0x8ba6('0x56')][_0x8ba6('0x57')])[_0x8ba6('0x27')](function(){return _0x14921f;});}return _0x14921f;}})['then'](function(_0x15876b){if(_0x15876b){var _0x2dd8df=_0x15876b[_0x8ba6('0x52')];if(!fs[_0x8ba6('0x55')](_0x2dd8df)){throw new db[(_0x8ba6('0x58'))][(_0x8ba6('0x59'))](_0x8ba6('0x5a'));}if(_0x15876b[_0x8ba6('0x51')]){return _0x527a97['download'](_0x2dd8df,_0x15876b[_0x8ba6('0x51')]+path[_0x8ba6('0x5b')](_0x2dd8df),function(){if(_0x2b24bc){fs[_0x8ba6('0x5c')](_0x2dd8df);}});}else{return _0x527a97[_0x8ba6('0x4d')](_0x2dd8df,function(_0x1c7bf8){if(_0x2b24bc){fs[_0x8ba6('0x5c')](_0x2dd8df);}});}}})[_0x8ba6('0x4a')](function(_0x311936){if(_0x311936[_0x8ba6('0x5d')]===_0x8ba6('0x5a')){_0x527a97[_0x8ba6('0x1c')](0x194)[_0x8ba6('0x2c')](_0x8ba6('0x5e'));}else{return handleError(_0x527a97,null);}});};exports['destroy']=function(_0x5508c1,_0x33be40){return db[_0x8ba6('0x2f')]['find']({'where':{'id':_0x5508c1[_0x8ba6('0x48')]['id']}})[_0x8ba6('0x27')](function(_0x3cf4df){if(_[_0x8ba6('0x5f')](_0x3cf4df)){throw new ReferenceError(_0x8ba6('0x60'));}return _0x3cf4df;})['then'](function(_0x28dbb7){var _0x488835=_0x28dbb7[_0x8ba6('0x52')];logger[_0x8ba6('0x61')](_0x8ba6('0x62'),_0x488835);if(!_['isNil'](_0x28dbb7['savePath'])&&fs[_0x8ba6('0x55')](_0x488835)){logger[_0x8ba6('0x61')](_0x8ba6('0x63')+_0x488835+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8ba6('0x64')](_0x488835);}_0x488835=_0x488835+'.cypher';if(!_[_0x8ba6('0x5f')](_0x28dbb7['savePath'])&&fs[_0x8ba6('0x55')](_0x488835)){logger[_0x8ba6('0x61')](_0x8ba6('0x63')+_0x488835+_0x8ba6('0x65'));fs[_0x8ba6('0x64')](_0x488835);}return _0x28dbb7;})[_0x8ba6('0x27')](function(_0x39d3ab){if(!_0x39d3ab)throw new InternalError();return _0x39d3ab[_0x8ba6('0x28')]();})['then'](function(){_0x33be40[_0x8ba6('0x1c')](0xcc)[_0x8ba6('0x66')]();})['catch'](handleError(_0x33be40,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1ab4989..8e95de6 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 _0x8579=['exports','define','SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x8579,0x16c));var _0x9857=function(_0x11a4d7,_0x4b339f){_0x11a4d7=_0x11a4d7-0x0;var _0x40bb5d=_0x8579[_0x11a4d7];return _0x40bb5d;};'use strict';var _=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var logger=require('../../config/logger')(_0x9857('0x2'));var moment=require(_0x9857('0x3'));var BPromise=require(_0x9857('0x4'));var rp=require(_0x9857('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x9857('0x6')]=function(_0x1e72cd,_0x472eab){return _0x1e72cd[_0x9857('0x7')](_0x9857('0x8'),attributes,{'tableName':_0x9857('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['define','square_recordings','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x57eaa0,_0x32aae5){var _0x9d53d2=function(_0x3c6ccd){while(--_0x3c6ccd){_0x57eaa0['push'](_0x57eaa0['shift']());}};_0x9d53d2(++_0x32aae5);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x4e6712,_0x29b1e3){_0x4e6712=_0x4e6712-0x0;var _0x1b1277=_0xd2f5[_0x4e6712];return _0x1b1277;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var logger=require(_0x5d2f('0x2'))(_0x5d2f('0x3'));var moment=require('moment');var BPromise=require(_0x5d2f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module['exports']=function(_0x2f7121,_0x2157af){return _0x2f7121[_0x5d2f('0x8')]('SquareRecording',attributes,{'tableName':_0x5d2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 22f713e..3b6c5a4 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 _0x8836=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','body','raw','lodash','util'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x8836,0x6e));var _0x6883=function(_0x2cbccd,_0x28fd0d){_0x2cbccd=_0x2cbccd-0x0;var _0x50aa15=_0x8836[_0x2cbccd];return _0x50aa15;};'use strict';var _=require(_0x6883('0x0'));var util=require(_0x6883('0x1'));var moment=require(_0x6883('0x2'));var BPromise=require(_0x6883('0x3'));var rs=require(_0x6883('0x4'));var fs=require('fs');var Redis=require(_0x6883('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6883('0x6'));var logger=require(_0x6883('0x7'))(_0x6883('0x8'));var config=require(_0x6883('0x9'));var jayson=require(_0x6883('0xa'));var client=jayson[_0x6883('0xb')][_0x6883('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aae9a,_0x4c8e1e,_0xe6f9a4){return new BPromise(function(_0x52af70,_0x5f073e){return client[_0x6883('0xd')](_0x2aae9a,_0xe6f9a4)[_0x6883('0xe')](function(_0x3c60ab){logger[_0x6883('0xf')](_0x6883('0x10'),_0x4c8e1e,'request\x20sent');logger[_0x6883('0x11')](_0x6883('0x12'),_0x4c8e1e,_0x6883('0x13'),JSON[_0x6883('0x14')](_0x3c60ab));if(_0x3c60ab[_0x6883('0x15')]){if(_0x3c60ab['error']['code']===0x1f4){logger[_0x6883('0x15')]('SquareRecording,\x20%s,\x20%s',_0x4c8e1e,_0x3c60ab[_0x6883('0x15')][_0x6883('0x16')]);return _0x5f073e(_0x3c60ab[_0x6883('0x15')]['message']);}logger[_0x6883('0x15')](_0x6883('0x10'),_0x4c8e1e,_0x3c60ab[_0x6883('0x15')]['message']);return _0x52af70(_0x3c60ab[_0x6883('0x15')][_0x6883('0x16')]);}else{logger[_0x6883('0xf')](_0x6883('0x10'),_0x4c8e1e,'request\x20sent');_0x52af70(_0x3c60ab[_0x6883('0x17')][_0x6883('0x16')]);}})[_0x6883('0x18')](function(_0x3387a0){logger[_0x6883('0x15')](_0x6883('0x10'),_0x4c8e1e,_0x3387a0);_0x5f073e(_0x3387a0);});});}exports[_0x6883('0x19')]=function(_0x2469e7){var _0x7b73d4=this;return new Promise(function(_0x323adb,_0x40be84){return db['SquareRecording']['create'](_0x2469e7[_0x6883('0x1a')],{'raw':_0x2469e7['options']?_0x2469e7['options'][_0x6883('0x1b')]===undefined?!![]:![]:!![]})[_0x6883('0xe')](function(_0xfc62e3){logger['info'](_0x6883('0x19'),_0x2469e7);logger[_0x6883('0x11')](_0x6883('0x19'),_0x2469e7,JSON['stringify'](_0xfc62e3));_0x323adb(_0xfc62e3);})[_0x6883('0x18')](function(_0xce0b14){logger[_0x6883('0x15')]('CreateSquareRecording',_0xce0b14[_0x6883('0x16')],_0x2469e7);_0x40be84(_0x7b73d4[_0x6883('0x15')](0x1f4,_0xce0b14[_0x6883('0x16')]));});});}; \ No newline at end of file +var _0xa9b2=['../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','body','options','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xa9b2,0x18d));var _0x2a9b=function(_0x4c11f7,_0x5a0447){_0x4c11f7=_0x4c11f7-0x0;var _0x587d6b=_0xa9b2[_0x4c11f7];return _0x587d6b;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var moment=require(_0x2a9b('0x2'));var BPromise=require(_0x2a9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a9b('0x4'));var db=require(_0x2a9b('0x5'))['db'];var utils=require(_0x2a9b('0x6'));var logger=require(_0x2a9b('0x7'))('rpc');var config=require(_0x2a9b('0x8'));var jayson=require(_0x2a9b('0x9'));var client=jayson['client'][_0x2a9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33b3c7,_0x1992f4,_0x52a8fd){return new BPromise(function(_0x1f0d12,_0x1e5445){return client[_0x2a9b('0xb')](_0x33b3c7,_0x52a8fd)['then'](function(_0x22e490){logger[_0x2a9b('0xc')](_0x2a9b('0xd'),_0x1992f4,_0x2a9b('0xe'));logger[_0x2a9b('0xf')](_0x2a9b('0x10'),_0x1992f4,_0x2a9b('0xe'),JSON[_0x2a9b('0x11')](_0x22e490));if(_0x22e490[_0x2a9b('0x12')]){if(_0x22e490['error'][_0x2a9b('0x13')]===0x1f4){logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x1992f4,_0x22e490[_0x2a9b('0x12')][_0x2a9b('0x14')]);return _0x1e5445(_0x22e490[_0x2a9b('0x12')][_0x2a9b('0x14')]);}logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x1992f4,_0x22e490['error'][_0x2a9b('0x14')]);return _0x1f0d12(_0x22e490[_0x2a9b('0x12')][_0x2a9b('0x14')]);}else{logger[_0x2a9b('0xc')]('SquareRecording,\x20%s,\x20%s',_0x1992f4,'request\x20sent');_0x1f0d12(_0x22e490[_0x2a9b('0x15')][_0x2a9b('0x14')]);}})[_0x2a9b('0x16')](function(_0x4541e6){logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x1992f4,_0x4541e6);_0x1e5445(_0x4541e6);});});}exports[_0x2a9b('0x17')]=function(_0x1c2018){var _0x44d2b2=this;return new Promise(function(_0x1ad663,_0x36dd6d){return db['SquareRecording']['create'](_0x1c2018[_0x2a9b('0x18')],{'raw':_0x1c2018[_0x2a9b('0x19')]?_0x1c2018['options']['raw']===undefined?!![]:![]:!![]})[_0x2a9b('0x1a')](function(_0x48a1bc){logger[_0x2a9b('0xc')]('CreateSquareRecording',_0x1c2018);logger[_0x2a9b('0xf')](_0x2a9b('0x17'),_0x1c2018,JSON[_0x2a9b('0x11')](_0x48a1bc));_0x1ad663(_0x48a1bc);})[_0x2a9b('0x16')](function(_0xc34d3d){logger[_0x2a9b('0x12')](_0x2a9b('0x17'),_0xc34d3d[_0x2a9b('0x14')],_0x1c2018);_0x36dd6d(_0x44d2b2['error'](0x1f4,_0xc34d3d[_0x2a9b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 363bcc1..f9e0187 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(_0x358825,_0x50b369){var _0x3f003f=function(_0x557674){while(--_0x557674){_0x358825['push'](_0x358825['shift']());}};_0x3f003f(++_0x50b369);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 _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(_0x408fe0,_0x2b49c0){var _0x21b8b1=function(_0x57158a){while(--_0x57158a){_0x408fe0['push'](_0x408fe0['shift']());}};_0x21b8b1(++_0x2b49c0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e723488..3b07959 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 _0x2232=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1836ac,_0x55327a){var _0x3ad58c=function(_0x4427b4){while(--_0x4427b4){_0x1836ac['push'](_0x1836ac['shift']());}};_0x3ad58c(++_0x55327a);}(_0x2232,0xd2));var _0x2223=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2232[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x2223('0x0'));module[_0x2223('0x1')]={'network':{'type':Sequelize[_0x2223('0x2')]},'network_script':{'type':Sequelize[_0x2223('0x2')]},'request':{'type':Sequelize[_0x2223('0x2')]},'channel':{'type':Sequelize[_0x2223('0x2')]},'language':{'type':Sequelize[_0x2223('0x2')]},'type':{'type':Sequelize[_0x2223('0x2')]},'uniqueid':{'type':Sequelize[_0x2223('0x2')]},'version':{'type':Sequelize[_0x2223('0x2')]},'callerid':{'type':Sequelize[_0x2223('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x2223('0x2')]},'callingani2':{'type':Sequelize[_0x2223('0x2')]},'callington':{'type':Sequelize[_0x2223('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2223('0x2')]},'context':{'type':Sequelize[_0x2223('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2223('0x2')]},'enhanced':{'type':Sequelize[_0x2223('0x2')]},'accountcode':{'type':Sequelize[_0x2223('0x2')]},'threadid':{'type':Sequelize[_0x2223('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2223('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x2223('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe810=['exports','STRING','DATE'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xe810,0xf0));var _0x0e81=function(_0x5d724e,_0x195e4d){_0x5d724e=_0x5d724e-0x0;var _0x3f198b=_0xe810[_0x5d724e];return _0x3f198b;};'use strict';var Sequelize=require('sequelize');module[_0x0e81('0x0')]={'network':{'type':Sequelize[_0x0e81('0x1')]},'network_script':{'type':Sequelize[_0x0e81('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0e81('0x1')]},'language':{'type':Sequelize[_0x0e81('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0e81('0x1')]},'version':{'type':Sequelize[_0x0e81('0x1')]},'callerid':{'type':Sequelize[_0x0e81('0x1')]},'calleridname':{'type':Sequelize[_0x0e81('0x1')]},'callingpres':{'type':Sequelize[_0x0e81('0x1')]},'callingani2':{'type':Sequelize[_0x0e81('0x1')]},'callington':{'type':Sequelize[_0x0e81('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x0e81('0x1')]},'rdnis':{'type':Sequelize[_0x0e81('0x1')]},'context':{'type':Sequelize[_0x0e81('0x1')]},'extension':{'type':Sequelize[_0x0e81('0x1')]},'priority':{'type':Sequelize[_0x0e81('0x1')]},'enhanced':{'type':Sequelize[_0x0e81('0x1')]},'accountcode':{'type':Sequelize[_0x0e81('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x0e81('0x1')]},'joinAt':{'type':Sequelize[_0x0e81('0x2')]},'leaveAt':{'type':Sequelize[_0x0e81('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0a02f65..541fb5a 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 _0xf34e=['save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject'];(function(_0x46d30b,_0x51dad9){var _0x516778=function(_0x28dd25){while(--_0x28dd25){_0x46d30b['push'](_0x46d30b['shift']());}};_0x516778(++_0x51dad9);}(_0xf34e,0xbe));var _0xef34=function(_0x5198ce,_0x33236b){_0x5198ce=_0x5198ce-0x0;var _0xc56fa2=_0xf34e[_0x5198ce];return _0xc56fa2;};'use strict';var emlformat=require(_0xef34('0x0'));var rimraf=require(_0xef34('0x1'));var zipdir=require(_0xef34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xef34('0x3'));var Mustache=require(_0xef34('0x4'));var util=require('util');var path=require('path');var sox=require(_0xef34('0x5'));var csv=require('to-csv');var ejs=require(_0xef34('0x6'));var fs=require('fs');var fs_extra=require(_0xef34('0x7'));var _=require(_0xef34('0x8'));var squel=require('squel');var crypto=require(_0xef34('0x9'));var jsforce=require(_0xef34('0xa'));var deskjs=require(_0xef34('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef34('0xc'));var Redis=require(_0xef34('0xd'));var authService=require(_0xef34('0xe'));var qs=require(_0xef34('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef34('0x10'));var logger=require(_0xef34('0x11'))(_0xef34('0x12'));var utils=require('../../config/utils');var config=require(_0xef34('0x13'));var licenseUtil=require(_0xef34('0x14'));var db=require(_0xef34('0x15'))['db'];function respondWithStatusCode(_0xe24c30,_0x460c26){_0x460c26=_0x460c26||0xcc;return function(_0x4d9edc){if(_0x4d9edc){return _0xe24c30['sendStatus'](_0x460c26);}return _0xe24c30['status'](_0x460c26)[_0xef34('0x16')]();};}function respondWithResult(_0x440503,_0x389f9f){_0x389f9f=_0x389f9f||0xc8;return function(_0x2e467e){if(_0x2e467e){return _0x440503[_0xef34('0x17')](_0x389f9f)[_0xef34('0x18')](_0x2e467e);}};}function respondWithFilteredResult(_0x131229,_0x534c2f){return function(_0x56ad9c){if(_0x56ad9c){var _0x25e3dd=typeof _0x534c2f[_0xef34('0x19')]===_0xef34('0x1a')&&typeof _0x534c2f[_0xef34('0x1b')]===_0xef34('0x1a');var _0x12acb4=_0x56ad9c['count'];var _0x4b9e60=_0x25e3dd?0x0:_0x534c2f[_0xef34('0x19')];var _0x4fce9a=_0x25e3dd?_0x56ad9c['count']:_0x534c2f[_0xef34('0x19')]+_0x534c2f['limit'];var _0x442c38;if(_0x4fce9a>=_0x12acb4){_0x4fce9a=_0x12acb4;_0x442c38=0xc8;}else{_0x442c38=0xce;}_0x131229[_0xef34('0x17')](_0x442c38);return _0x131229[_0xef34('0x1c')](_0xef34('0x1d'),_0x4b9e60+'-'+_0x4fce9a+'/'+_0x12acb4)[_0xef34('0x18')](_0x56ad9c);}return null;};}function patchUpdates(_0x39347c){return function(_0x51763c){try{jsonpatch[_0xef34('0x1e')](_0x51763c,_0x39347c,!![]);}catch(_0x31ffa4){return BPromise[_0xef34('0x1f')](_0x31ffa4);}return _0x51763c[_0xef34('0x20')]();};}function saveUpdates(_0x1776a6,_0x2678e1){return function(_0x32c977){if(_0x32c977){return _0x32c977['update'](_0x1776a6)[_0xef34('0x21')](function(_0x2fbf7e){return _0x2fbf7e;});}return null;};}function removeEntity(_0x38bc22,_0x510ec4){return function(_0x381736){if(_0x381736){return _0x381736[_0xef34('0x22')]()[_0xef34('0x21')](function(){_0x38bc22['status'](0xcc)[_0xef34('0x16')]();});}};}function handleEntityNotFound(_0x2a270e,_0x43e044){return function(_0x3998f1){if(!_0x3998f1){_0x2a270e['sendStatus'](0x194);}return _0x3998f1;};}function handleError(_0xd116fb,_0x1babd9){_0x1babd9=_0x1babd9||0x1f4;return function(_0x14a1ec){logger[_0xef34('0x23')](_0x14a1ec[_0xef34('0x24')]);if(_0x14a1ec[_0xef34('0x25')]){delete _0x14a1ec['name'];}_0xd116fb['status'](_0x1babd9)[_0xef34('0x26')](_0x14a1ec);};}exports[_0xef34('0x27')]=function(_0x512c22,_0x550399){var _0x5022b8={},_0x14af0d={},_0x1fba83={'count':0x0,'rows':[]};var _0x228d06=_[_0xef34('0x28')](db[_0xef34('0x29')][_0xef34('0x2a')],function(_0x27d9fa){return{'name':_0x27d9fa[_0xef34('0x2b')],'type':_0x27d9fa[_0xef34('0x2c')]['key']};});_0x14af0d[_0xef34('0x2d')]=_[_0xef34('0x28')](_0x228d06,_0xef34('0x25'));_0x14af0d['query']=_['keys'](_0x512c22[_0xef34('0x2e')]);_0x14af0d[_0xef34('0x2f')]=_[_0xef34('0x30')](_0x14af0d[_0xef34('0x2d')],_0x14af0d[_0xef34('0x2e')]);_0x5022b8['attributes']=_[_0xef34('0x30')](_0x14af0d[_0xef34('0x2d')],qs[_0xef34('0x31')](_0x512c22[_0xef34('0x2e')]['fields']));_0x5022b8[_0xef34('0x32')]=_0x5022b8[_0xef34('0x32')]['length']?_0x5022b8[_0xef34('0x32')]:_0x14af0d['model'];if(!_0x512c22[_0xef34('0x2e')][_0xef34('0x33')](_0xef34('0x34'))){_0x5022b8['limit']=qs[_0xef34('0x1b')](_0x512c22[_0xef34('0x2e')][_0xef34('0x1b')]);_0x5022b8[_0xef34('0x19')]=qs['offset'](_0x512c22[_0xef34('0x2e')][_0xef34('0x19')]);}_0x5022b8[_0xef34('0x35')]=qs[_0xef34('0x36')](_0x512c22['query'][_0xef34('0x36')]);_0x5022b8['where']=qs[_0xef34('0x2f')](_[_0xef34('0x37')](_0x512c22[_0xef34('0x2e')],_0x14af0d[_0xef34('0x2f')]),_0x228d06);if(_0x512c22[_0xef34('0x2e')][_0xef34('0x38')]){_0x5022b8['where']=_['merge'](_0x5022b8[_0xef34('0x39')],{'$or':_[_0xef34('0x28')](_0x228d06,function(_0x432263){if(_0x432263[_0xef34('0x2c')]!==_0xef34('0x3a')){var _0x520aa1={};_0x520aa1[_0x432263[_0xef34('0x25')]]={'$like':'%'+_0x512c22[_0xef34('0x2e')][_0xef34('0x38')]+'%'};return _0x520aa1;}})});}_0x5022b8=_['merge']({},_0x5022b8,_0x512c22[_0xef34('0x3b')]);var _0x1da5ba={'where':_0x5022b8['where']};return db[_0xef34('0x29')][_0xef34('0x3c')](_0x1da5ba)[_0xef34('0x21')](function(_0x367e84){_0x1fba83[_0xef34('0x3c')]=_0x367e84;if(_0x512c22[_0xef34('0x2e')][_0xef34('0x3d')]){_0x5022b8[_0xef34('0x3e')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x5022b8);})[_0xef34('0x21')](function(_0x2eecbd){_0x1fba83[_0xef34('0x3f')]=_0x2eecbd;return _0x1fba83;})['then'](respondWithFilteredResult(_0x550399,_0x5022b8))[_0xef34('0x40')](handleError(_0x550399,null));};exports[_0xef34('0x41')]=function(_0x48ef8f,_0x5f00){var _0x6048fc={'raw':!![],'where':{'id':_0x48ef8f[_0xef34('0x42')]['id']}},_0x741958={};_0x741958[_0xef34('0x2d')]=_[_0xef34('0x43')](db[_0xef34('0x29')]['rawAttributes']);_0x741958[_0xef34('0x2e')]=_[_0xef34('0x43')](_0x48ef8f[_0xef34('0x2e')]);_0x741958[_0xef34('0x2f')]=_[_0xef34('0x30')](_0x741958[_0xef34('0x2d')],_0x741958[_0xef34('0x2e')]);_0x6048fc[_0xef34('0x32')]=_[_0xef34('0x30')](_0x741958['model'],qs['fields'](_0x48ef8f[_0xef34('0x2e')][_0xef34('0x31')]));_0x6048fc[_0xef34('0x32')]=_0x6048fc[_0xef34('0x32')]['length']?_0x6048fc[_0xef34('0x32')]:_0x741958['model'];if(_0x48ef8f[_0xef34('0x2e')]['includeAll']){_0x6048fc[_0xef34('0x3e')]=[{'all':!![]}];}_0x6048fc=_[_0xef34('0x44')]({},_0x6048fc,_0x48ef8f[_0xef34('0x3b')]);return db[_0xef34('0x29')][_0xef34('0x45')](_0x6048fc)[_0xef34('0x21')](handleEntityNotFound(_0x5f00,null))[_0xef34('0x21')](respondWithResult(_0x5f00,null))[_0xef34('0x40')](handleError(_0x5f00,null));};exports[_0xef34('0x46')]=function(_0x556c5f,_0x1b7643){return db[_0xef34('0x29')][_0xef34('0x46')](_0x556c5f[_0xef34('0x47')],{})['then'](respondWithResult(_0x1b7643,0xc9))[_0xef34('0x40')](handleError(_0x1b7643,null));};exports[_0xef34('0x48')]=function(_0x535290,_0x44735e){if(_0x535290[_0xef34('0x47')]['id']){delete _0x535290[_0xef34('0x47')]['id'];}return db[_0xef34('0x29')][_0xef34('0x45')]({'where':{'id':_0x535290[_0xef34('0x42')]['id']}})[_0xef34('0x21')](handleEntityNotFound(_0x44735e,null))[_0xef34('0x21')](saveUpdates(_0x535290[_0xef34('0x47')],null))[_0xef34('0x21')](respondWithResult(_0x44735e,null))[_0xef34('0x40')](handleError(_0x44735e,null));};exports[_0xef34('0x22')]=function(_0x58a7ef,_0xcf37c1){return db[_0xef34('0x29')][_0xef34('0x45')]({'where':{'id':_0x58a7ef['params']['id']}})['then'](handleEntityNotFound(_0xcf37c1,null))['then'](removeEntity(_0xcf37c1,null))[_0xef34('0x40')](handleError(_0xcf37c1,null));};exports[_0xef34('0x49')]=function(_0x466399,_0x5690c3){return db[_0xef34('0x29')]['describe']()[_0xef34('0x21')](respondWithResult(_0x5690c3,null))[_0xef34('0x40')](handleError(_0x5690c3,null));}; \ No newline at end of file +var _0x59b2=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','query'];(function(_0x1647fa,_0x102605){var _0x1ede9a=function(_0x4e7854){while(--_0x4e7854){_0x1647fa['push'](_0x1647fa['shift']());}};_0x1ede9a(++_0x102605);}(_0x59b2,0xb0));var _0x259b=function(_0xd46033,_0xa8f11f){_0xd46033=_0xd46033-0x0;var _0x2c64d9=_0x59b2[_0xd46033];return _0x2c64d9;};'use strict';var emlformat=require(_0x259b('0x0'));var rimraf=require(_0x259b('0x1'));var zipdir=require(_0x259b('0x2'));var jsonpatch=require(_0x259b('0x3'));var rp=require(_0x259b('0x4'));var moment=require(_0x259b('0x5'));var BPromise=require(_0x259b('0x6'));var Mustache=require('mustache');var util=require(_0x259b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x259b('0x8'));var ejs=require(_0x259b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x259b('0xa'));var crypto=require(_0x259b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x259b('0x8'));var querystring=require(_0x259b('0xc'));var Papa=require(_0x259b('0xd'));var Redis=require('ioredis');var authService=require(_0x259b('0xe'));var qs=require(_0x259b('0xf'));var as=require(_0x259b('0x10'));var hardwareService=require(_0x259b('0x11'));var logger=require(_0x259b('0x12'))('api');var utils=require(_0x259b('0x13'));var config=require(_0x259b('0x14'));var licenseUtil=require(_0x259b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7564,_0x4225b0){_0x4225b0=_0x4225b0||0xcc;return function(_0x121d9c){if(_0x121d9c){return _0x1b7564['sendStatus'](_0x4225b0);}return _0x1b7564[_0x259b('0x16')](_0x4225b0)['end']();};}function respondWithResult(_0x3522a9,_0x59c103){_0x59c103=_0x59c103||0xc8;return function(_0x3707a2){if(_0x3707a2){return _0x3522a9[_0x259b('0x16')](_0x59c103)['json'](_0x3707a2);}};}function respondWithFilteredResult(_0x33d086,_0x186857){return function(_0x15a365){if(_0x15a365){var _0x16b42b=typeof _0x186857[_0x259b('0x17')]==='undefined'&&typeof _0x186857[_0x259b('0x18')]===_0x259b('0x19');var _0x816f0a=_0x15a365[_0x259b('0x1a')];var _0x578182=_0x16b42b?0x0:_0x186857[_0x259b('0x17')];var _0x36e293=_0x16b42b?_0x15a365[_0x259b('0x1a')]:_0x186857[_0x259b('0x17')]+_0x186857[_0x259b('0x18')];var _0x3512d3;if(_0x36e293>=_0x816f0a){_0x36e293=_0x816f0a;_0x3512d3=0xc8;}else{_0x3512d3=0xce;}_0x33d086[_0x259b('0x16')](_0x3512d3);return _0x33d086[_0x259b('0x1b')](_0x259b('0x1c'),_0x578182+'-'+_0x36e293+'/'+_0x816f0a)[_0x259b('0x1d')](_0x15a365);}return null;};}function patchUpdates(_0x28d875){return function(_0x288ef8){try{jsonpatch[_0x259b('0x1e')](_0x288ef8,_0x28d875,!![]);}catch(_0x3eb8b2){return BPromise[_0x259b('0x1f')](_0x3eb8b2);}return _0x288ef8[_0x259b('0x20')]();};}function saveUpdates(_0x5c86c2,_0x24997e){return function(_0xcefaa7){if(_0xcefaa7){return _0xcefaa7[_0x259b('0x21')](_0x5c86c2)[_0x259b('0x22')](function(_0x20b4c4){return _0x20b4c4;});}return null;};}function removeEntity(_0xc61ac9,_0xc0bf99){return function(_0x5b7b77){if(_0x5b7b77){return _0x5b7b77[_0x259b('0x23')]()[_0x259b('0x22')](function(){_0xc61ac9[_0x259b('0x16')](0xcc)[_0x259b('0x24')]();});}};}function handleEntityNotFound(_0x27dc4b,_0xd03d81){return function(_0x521d52){if(!_0x521d52){_0x27dc4b[_0x259b('0x25')](0x194);}return _0x521d52;};}function handleError(_0x2d751d,_0x4ac872){_0x4ac872=_0x4ac872||0x1f4;return function(_0xeed3ea){logger[_0x259b('0x26')](_0xeed3ea[_0x259b('0x27')]);if(_0xeed3ea['name']){delete _0xeed3ea[_0x259b('0x28')];}_0x2d751d['status'](_0x4ac872)['send'](_0xeed3ea);};}exports[_0x259b('0x29')]=function(_0x2b974b,_0x1041f1){var _0x12d834={},_0x1cf645={},_0x2e49b5={'count':0x0,'rows':[]};var _0x5aad1f=_[_0x259b('0x2a')](db[_0x259b('0x2b')][_0x259b('0x2c')],function(_0x503a35){return{'name':_0x503a35[_0x259b('0x2d')],'type':_0x503a35[_0x259b('0x2e')][_0x259b('0x2f')]};});_0x1cf645['model']=_[_0x259b('0x2a')](_0x5aad1f,'name');_0x1cf645[_0x259b('0x30')]=_['keys'](_0x2b974b['query']);_0x1cf645[_0x259b('0x31')]=_[_0x259b('0x32')](_0x1cf645[_0x259b('0x33')],_0x1cf645[_0x259b('0x30')]);_0x12d834[_0x259b('0x34')]=_[_0x259b('0x32')](_0x1cf645[_0x259b('0x33')],qs[_0x259b('0x35')](_0x2b974b[_0x259b('0x30')][_0x259b('0x35')]));_0x12d834[_0x259b('0x34')]=_0x12d834['attributes'][_0x259b('0x36')]?_0x12d834[_0x259b('0x34')]:_0x1cf645[_0x259b('0x33')];if(!_0x2b974b[_0x259b('0x30')][_0x259b('0x37')](_0x259b('0x38'))){_0x12d834['limit']=qs['limit'](_0x2b974b[_0x259b('0x30')]['limit']);_0x12d834[_0x259b('0x17')]=qs[_0x259b('0x17')](_0x2b974b['query'][_0x259b('0x17')]);}_0x12d834['order']=qs[_0x259b('0x39')](_0x2b974b[_0x259b('0x30')][_0x259b('0x39')]);_0x12d834[_0x259b('0x3a')]=qs[_0x259b('0x31')](_[_0x259b('0x3b')](_0x2b974b['query'],_0x1cf645[_0x259b('0x31')]),_0x5aad1f);if(_0x2b974b[_0x259b('0x30')][_0x259b('0x3c')]){_0x12d834[_0x259b('0x3a')]=_[_0x259b('0x3d')](_0x12d834[_0x259b('0x3a')],{'$or':_[_0x259b('0x2a')](_0x5aad1f,function(_0x54bf29){if(_0x54bf29[_0x259b('0x2e')]!==_0x259b('0x3e')){var _0x56f3be={};_0x56f3be[_0x54bf29['name']]={'$like':'%'+_0x2b974b[_0x259b('0x30')][_0x259b('0x3c')]+'%'};return _0x56f3be;}})});}_0x12d834=_['merge']({},_0x12d834,_0x2b974b[_0x259b('0x3f')]);var _0x24f3c3={'where':_0x12d834[_0x259b('0x3a')]};return db[_0x259b('0x2b')]['count'](_0x24f3c3)[_0x259b('0x22')](function(_0x15c16f){_0x2e49b5['count']=_0x15c16f;if(_0x2b974b[_0x259b('0x30')][_0x259b('0x40')]){_0x12d834[_0x259b('0x41')]=[{'all':!![]}];}return db[_0x259b('0x2b')][_0x259b('0x42')](_0x12d834);})[_0x259b('0x22')](function(_0x4858e3){_0x2e49b5[_0x259b('0x43')]=_0x4858e3;return _0x2e49b5;})[_0x259b('0x22')](respondWithFilteredResult(_0x1041f1,_0x12d834))[_0x259b('0x44')](handleError(_0x1041f1,null));};exports['show']=function(_0x48a073,_0x4c4a9c){var _0xa7591a={'raw':!![],'where':{'id':_0x48a073[_0x259b('0x45')]['id']}},_0x5f3d73={};_0x5f3d73[_0x259b('0x33')]=_[_0x259b('0x46')](db[_0x259b('0x2b')][_0x259b('0x2c')]);_0x5f3d73[_0x259b('0x30')]=_[_0x259b('0x46')](_0x48a073['query']);_0x5f3d73[_0x259b('0x31')]=_['intersection'](_0x5f3d73['model'],_0x5f3d73[_0x259b('0x30')]);_0xa7591a['attributes']=_['intersection'](_0x5f3d73[_0x259b('0x33')],qs[_0x259b('0x35')](_0x48a073[_0x259b('0x30')][_0x259b('0x35')]));_0xa7591a['attributes']=_0xa7591a[_0x259b('0x34')]['length']?_0xa7591a[_0x259b('0x34')]:_0x5f3d73[_0x259b('0x33')];if(_0x48a073['query'][_0x259b('0x40')]){_0xa7591a[_0x259b('0x41')]=[{'all':!![]}];}_0xa7591a=_[_0x259b('0x3d')]({},_0xa7591a,_0x48a073['options']);return db[_0x259b('0x2b')][_0x259b('0x47')](_0xa7591a)[_0x259b('0x22')](handleEntityNotFound(_0x4c4a9c,null))['then'](respondWithResult(_0x4c4a9c,null))['catch'](handleError(_0x4c4a9c,null));};exports[_0x259b('0x48')]=function(_0x3209f3,_0x425f73){return db[_0x259b('0x2b')][_0x259b('0x48')](_0x3209f3[_0x259b('0x49')],{})[_0x259b('0x22')](respondWithResult(_0x425f73,0xc9))['catch'](handleError(_0x425f73,null));};exports['update']=function(_0x4375a0,_0x17fb57){if(_0x4375a0[_0x259b('0x49')]['id']){delete _0x4375a0[_0x259b('0x49')]['id'];}return db[_0x259b('0x2b')][_0x259b('0x47')]({'where':{'id':_0x4375a0['params']['id']}})[_0x259b('0x22')](handleEntityNotFound(_0x17fb57,null))['then'](saveUpdates(_0x4375a0[_0x259b('0x49')],null))['then'](respondWithResult(_0x17fb57,null))[_0x259b('0x44')](handleError(_0x17fb57,null));};exports[_0x259b('0x23')]=function(_0x4f384f,_0x4890db){return db['SquareReport'][_0x259b('0x47')]({'where':{'id':_0x4f384f['params']['id']}})[_0x259b('0x22')](handleEntityNotFound(_0x4890db,null))[_0x259b('0x22')](removeEntity(_0x4890db,null))[_0x259b('0x44')](handleError(_0x4890db,null));};exports[_0x259b('0x4a')]=function(_0x5bfeb6,_0xb972a9){return db['SquareReport'][_0x259b('0x4a')]()['then'](respondWithResult(_0xb972a9,null))['catch'](handleError(_0xb972a9,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4540806..08d41dd 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 _0x4b97=['project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','SquareReport','uid_pname','uniqueid'];(function(_0x2d5818,_0x2be6a5){var _0xea4040=function(_0x914a50){while(--_0x914a50){_0x2d5818['push'](_0x2d5818['shift']());}};_0xea4040(++_0x2be6a5);}(_0x4b97,0x110));var _0x74b9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4b97[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x74b9('0x0'));var util=require(_0x74b9('0x1'));var logger=require(_0x74b9('0x2'))(_0x74b9('0x3'));var moment=require('moment');var BPromise=require(_0x74b9('0x4'));var rp=require(_0x74b9('0x5'));var fs=require('fs');var path=require(_0x74b9('0x6'));var rimraf=require(_0x74b9('0x7'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x74b9('0x8')]=function(_0x5c138c,_0xfc7533){return _0x5c138c[_0x74b9('0x9')](_0x74b9('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x74b9('0xb'),'fields':[_0x74b9('0xc'),_0x74b9('0xd')]},{'name':'leaveAt','fields':[_0x74b9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd585=['SquareReport','report_square','uid_pname','uniqueid','project_name','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReport.attributes','define'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xd585,0xc8));var _0x5d58=function(_0x1c4e81,_0x2e4347){_0x1c4e81=_0x1c4e81-0x0;var _0x501caa=_0xd585[_0x1c4e81];return _0x501caa;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var logger=require(_0x5d58('0x2'))(_0x5d58('0x3'));var moment=require(_0x5d58('0x4'));var BPromise=require(_0x5d58('0x5'));var rp=require(_0x5d58('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d58('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d58('0x8'));module['exports']=function(_0x610fdc,_0x2562dd){return _0x610fdc[_0x5d58('0x9')](_0x5d58('0xa'),attributes,{'tableName':_0x5d58('0xb'),'paranoid':![],'indexes':[{'name':_0x5d58('0xc'),'fields':[_0x5d58('0xd'),_0x5d58('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 051c6c3..8182d99 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 _0xb4c8=['CreateSquareReport','SquareReport','create','body','options','raw','then','debug','UpdateSquareReport','update','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','stringify','error','SquareReport,\x20%s,\x20%s','message','result'];(function(_0x57056c,_0x12c8a1){var _0xb624a2=function(_0x3933fc){while(--_0x3933fc){_0x57056c['push'](_0x57056c['shift']());}};_0xb624a2(++_0x12c8a1);}(_0xb4c8,0xa2));var _0x8b4c=function(_0x3462fb,_0x41f84d){_0x3462fb=_0x3462fb-0x0;var _0x4fb07f=_0xb4c8[_0x3462fb];return _0x4fb07f;};'use strict';var _=require(_0x8b4c('0x0'));var util=require(_0x8b4c('0x1'));var moment=require(_0x8b4c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b4c('0x3'));var db=require(_0x8b4c('0x4'))['db'];var utils=require(_0x8b4c('0x5'));var logger=require(_0x8b4c('0x6'))(_0x8b4c('0x7'));var config=require(_0x8b4c('0x8'));var jayson=require(_0x8b4c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57b801,_0x4e2e6c,_0x434336){return new BPromise(function(_0x528025,_0x553005){return client[_0x8b4c('0xa')](_0x57b801,_0x434336)['then'](function(_0x500bdf){logger[_0x8b4c('0xb')]('SquareReport,\x20%s,\x20%s',_0x4e2e6c,_0x8b4c('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4e2e6c,_0x8b4c('0xc'),JSON[_0x8b4c('0xd')](_0x500bdf));if(_0x500bdf['error']){if(_0x500bdf[_0x8b4c('0xe')]['code']===0x1f4){logger[_0x8b4c('0xe')](_0x8b4c('0xf'),_0x4e2e6c,_0x500bdf[_0x8b4c('0xe')]['message']);return _0x553005(_0x500bdf['error'][_0x8b4c('0x10')]);}logger[_0x8b4c('0xe')]('SquareReport,\x20%s,\x20%s',_0x4e2e6c,_0x500bdf[_0x8b4c('0xe')][_0x8b4c('0x10')]);return _0x528025(_0x500bdf[_0x8b4c('0xe')][_0x8b4c('0x10')]);}else{logger[_0x8b4c('0xb')](_0x8b4c('0xf'),_0x4e2e6c,_0x8b4c('0xc'));_0x528025(_0x500bdf[_0x8b4c('0x11')]['message']);}})['catch'](function(_0x20d6f6){logger['error'](_0x8b4c('0xf'),_0x4e2e6c,_0x20d6f6);_0x553005(_0x20d6f6);});});}exports[_0x8b4c('0x12')]=function(_0x512945){var _0x5044de=this;return new Promise(function(_0x57c9d4,_0x3e850b){return db[_0x8b4c('0x13')][_0x8b4c('0x14')](_0x512945[_0x8b4c('0x15')],{'raw':_0x512945['options']?_0x512945[_0x8b4c('0x16')][_0x8b4c('0x17')]===undefined?!![]:![]:!![]})[_0x8b4c('0x18')](function(_0xbc5732){logger[_0x8b4c('0xb')](_0x8b4c('0x12'),_0x512945);logger[_0x8b4c('0x19')](_0x8b4c('0x12'),_0x512945,JSON[_0x8b4c('0xd')](_0xbc5732));_0x57c9d4(_0xbc5732);})['catch'](function(_0xfbdac4){logger[_0x8b4c('0xe')](_0x8b4c('0x12'),_0xfbdac4['message'],_0x512945);_0x3e850b(_0x5044de['error'](0x1f4,_0xfbdac4[_0x8b4c('0x10')]));});});};exports[_0x8b4c('0x1a')]=function(_0x5eb46d){var _0x30609a=this;return new Promise(function(_0x123655,_0x18e270){return db[_0x8b4c('0x13')][_0x8b4c('0x1b')](_0x5eb46d[_0x8b4c('0x15')],{'raw':_0x5eb46d[_0x8b4c('0x16')]?_0x5eb46d['options'][_0x8b4c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eb46d[_0x8b4c('0x16')]?_0x5eb46d['options']['where']||null:null,'attributes':_0x5eb46d['options']?_0x5eb46d['options'][_0x8b4c('0x1c')]||null:null,'limit':_0x5eb46d[_0x8b4c('0x16')]?_0x5eb46d[_0x8b4c('0x16')][_0x8b4c('0x1d')]||null:null})[_0x8b4c('0x18')](function(_0xbabcff){logger[_0x8b4c('0xb')](_0x8b4c('0x1a'),_0x5eb46d);logger[_0x8b4c('0x19')]('UpdateSquareReport',_0x5eb46d,JSON[_0x8b4c('0xd')](_0xbabcff));_0x123655(_0xbabcff);})['catch'](function(_0x398819){logger[_0x8b4c('0xe')](_0x8b4c('0x1a'),_0x398819[_0x8b4c('0x10')],_0x5eb46d);_0x18e270(_0x30609a[_0x8b4c('0xe')](0x1f4,_0x398819[_0x8b4c('0x10')]));});});}; \ No newline at end of file +var _0x064f=['http','request','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','SquareReport','create','body','options','raw','then','CreateSquareReport','UpdateSquareReport','where','limit','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x064f,0xb2));var _0xf064=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x064f[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0xf064('0x0'));var moment=require(_0xf064('0x1'));var BPromise=require(_0xf064('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf064('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf064('0x4'));var logger=require('../../config/logger')(_0xf064('0x5'));var config=require('../../config/environment');var jayson=require(_0xf064('0x6'));var client=jayson[_0xf064('0x7')][_0xf064('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57304e,_0x261cb0,_0x5b879b){return new BPromise(function(_0x22f336,_0x1eb71e){return client[_0xf064('0x9')](_0x57304e,_0x5b879b)['then'](function(_0x6d0613){logger['info']('SquareReport,\x20%s,\x20%s',_0x261cb0,_0xf064('0xa'));logger[_0xf064('0xb')](_0xf064('0xc'),_0x261cb0,'request\x20sent',JSON[_0xf064('0xd')](_0x6d0613));if(_0x6d0613[_0xf064('0xe')]){if(_0x6d0613[_0xf064('0xe')][_0xf064('0xf')]===0x1f4){logger[_0xf064('0xe')](_0xf064('0x10'),_0x261cb0,_0x6d0613[_0xf064('0xe')][_0xf064('0x11')]);return _0x1eb71e(_0x6d0613['error'][_0xf064('0x11')]);}logger[_0xf064('0xe')](_0xf064('0x10'),_0x261cb0,_0x6d0613[_0xf064('0xe')]['message']);return _0x22f336(_0x6d0613[_0xf064('0xe')][_0xf064('0x11')]);}else{logger[_0xf064('0x12')](_0xf064('0x10'),_0x261cb0,_0xf064('0xa'));_0x22f336(_0x6d0613[_0xf064('0x13')][_0xf064('0x11')]);}})[_0xf064('0x14')](function(_0x14af41){logger['error'](_0xf064('0x10'),_0x261cb0,_0x14af41);_0x1eb71e(_0x14af41);});});}exports['CreateSquareReport']=function(_0xa41243){var _0x286e47=this;return new Promise(function(_0x2c8b14,_0x2db34b){return db[_0xf064('0x15')][_0xf064('0x16')](_0xa41243[_0xf064('0x17')],{'raw':_0xa41243[_0xf064('0x18')]?_0xa41243[_0xf064('0x18')][_0xf064('0x19')]===undefined?!![]:![]:!![]})[_0xf064('0x1a')](function(_0x367c7f){logger[_0xf064('0x12')](_0xf064('0x1b'),_0xa41243);logger['debug'](_0xf064('0x1b'),_0xa41243,JSON[_0xf064('0xd')](_0x367c7f));_0x2c8b14(_0x367c7f);})[_0xf064('0x14')](function(_0x5c0b3f){logger[_0xf064('0xe')](_0xf064('0x1b'),_0x5c0b3f[_0xf064('0x11')],_0xa41243);_0x2db34b(_0x286e47['error'](0x1f4,_0x5c0b3f['message']));});});};exports[_0xf064('0x1c')]=function(_0x4b5e72){var _0x158e71=this;return new Promise(function(_0x328808,_0x34ae69){return db[_0xf064('0x15')]['update'](_0x4b5e72[_0xf064('0x17')],{'raw':_0x4b5e72[_0xf064('0x18')]?_0x4b5e72['options'][_0xf064('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b5e72[_0xf064('0x18')]?_0x4b5e72[_0xf064('0x18')][_0xf064('0x1d')]||null:null,'attributes':_0x4b5e72['options']?_0x4b5e72[_0xf064('0x18')]['attributes']||null:null,'limit':_0x4b5e72[_0xf064('0x18')]?_0x4b5e72['options'][_0xf064('0x1e')]||null:null})[_0xf064('0x1a')](function(_0x49d37f){logger['info'](_0xf064('0x1c'),_0x4b5e72);logger[_0xf064('0xb')](_0xf064('0x1c'),_0x4b5e72,JSON[_0xf064('0xd')](_0x49d37f));_0x328808(_0x49d37f);})['catch'](function(_0x5e724d){logger[_0xf064('0xe')](_0xf064('0x1c'),_0x5e724d[_0xf064('0x11')],_0x4b5e72);_0x34ae69(_0x158e71['error'](0x1f4,_0x5e724d[_0xf064('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c52646d..359b16f 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 _0x2de2=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe','show','/:id','update','delete'];(function(_0x259cc4,_0x32bde5){var _0xd3d44b=function(_0x586d2c){while(--_0x586d2c){_0x259cc4['push'](_0x259cc4['shift']());}};_0xd3d44b(++_0x32bde5);}(_0x2de2,0x1d6));var _0x22de=function(_0x154838,_0xe3f9c6){_0x154838=_0x154838-0x0;var _0x56f32a=_0x2de2[_0x154838];return _0x56f32a;};'use strict';var multer=require(_0x22de('0x0'));var util=require(_0x22de('0x1'));var path=require(_0x22de('0x2'));var timeout=require(_0x22de('0x3'));var express=require(_0x22de('0x4'));var router=express['Router']();var fs_extra=require(_0x22de('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22de('0x6'));var config=require(_0x22de('0x7'));var controller=require(_0x22de('0x8'));router['get']('/',auth[_0x22de('0x9')](),controller['index']);router[_0x22de('0xa')]('/describe',auth[_0x22de('0x9')](),controller[_0x22de('0xb')]);router['get']('/:id',auth[_0x22de('0x9')](),controller[_0x22de('0xc')]);router['post']('/',auth[_0x22de('0x9')](),controller['create']);router['put'](_0x22de('0xd'),auth['isAuthenticated'](),controller[_0x22de('0xe')]);router[_0x22de('0xf')](_0x22de('0xd'),auth[_0x22de('0x9')](),controller[_0x22de('0x10')]);module[_0x22de('0x11')]=router; \ No newline at end of file +var _0xd0ce=['describe','show','post','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x2ac279,_0xfe9a76){var _0x3016a3=function(_0x2323da){while(--_0x2323da){_0x2ac279['push'](_0x2ac279['shift']());}};_0x3016a3(++_0xfe9a76);}(_0xd0ce,0xd0));var _0xed0c=function(_0x4f5de4,_0x286cb4){_0x4f5de4=_0x4f5de4-0x0;var _0x57b780=_0xd0ce[_0x4f5de4];return _0x57b780;};'use strict';var multer=require('multer');var util=require(_0xed0c('0x0'));var path=require(_0xed0c('0x1'));var timeout=require(_0xed0c('0x2'));var express=require(_0xed0c('0x3'));var router=express[_0xed0c('0x4')]();var fs_extra=require(_0xed0c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed0c('0x6'));var config=require(_0xed0c('0x7'));var controller=require(_0xed0c('0x8'));router[_0xed0c('0x9')]('/',auth[_0xed0c('0xa')](),controller[_0xed0c('0xb')]);router['get']('/describe',auth[_0xed0c('0xa')](),controller[_0xed0c('0xc')]);router[_0xed0c('0x9')]('/:id',auth[_0xed0c('0xa')](),controller[_0xed0c('0xd')]);router[_0xed0c('0xe')]('/',auth[_0xed0c('0xa')](),controller['create']);router[_0xed0c('0xf')]('/:id',auth[_0xed0c('0xa')](),controller[_0xed0c('0x10')]);router[_0xed0c('0x11')](_0xed0c('0x12'),auth[_0xed0c('0xa')](),controller['destroy']);module[_0xed0c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 86f89e6..2fa6f30 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 _0xf16a=['TEXT','exports','STRING'];(function(_0x24fcc6,_0xcda1b0){var _0x18c52a=function(_0x4636bd){while(--_0x4636bd){_0x24fcc6['push'](_0x24fcc6['shift']());}};_0x18c52a(++_0xcda1b0);}(_0xf16a,0xcd));var _0xaf16=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf16a[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require('sequelize');module[_0xaf16('0x0')]={'uniqueid':{'type':Sequelize[_0xaf16('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xaf16('0x1')]},'data':{'type':Sequelize[_0xaf16('0x2')]},'project_name':{'type':Sequelize[_0xaf16('0x1')]},'callerid':{'type':Sequelize[_0xaf16('0x1')]}}; \ No newline at end of file +var _0x643b=['STRING','TEXT','sequelize'];(function(_0x1fb838,_0x967f4a){var _0x1da4a3=function(_0x40543f){while(--_0x40543f){_0x1fb838['push'](_0x1fb838['shift']());}};_0x1da4a3(++_0x967f4a);}(_0x643b,0x131));var _0xb643=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x643b[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xb643('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb643('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xb643('0x1')]},'data':{'type':Sequelize[_0xb643('0x2')]},'project_name':{'type':Sequelize[_0xb643('0x1')]},'callerid':{'type':Sequelize[_0xb643('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d6c00a4..24b046b 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 _0x8a0f=['moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','catch','show','params','keys','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x50cb4b,_0x140d9a){var _0x53b81a=function(_0x5a5d1a){while(--_0x5a5d1a){_0x50cb4b['push'](_0x50cb4b['shift']());}};_0x53b81a(++_0x140d9a);}(_0x8a0f,0x120));var _0xf8a0=function(_0x1a297c,_0x855d94){_0x1a297c=_0x1a297c-0x0;var _0x28caaf=_0x8a0f[_0x1a297c];return _0x28caaf;};'use strict';var emlformat=require(_0xf8a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8a0('0x1'));var jsonpatch=require(_0xf8a0('0x2'));var rp=require(_0xf8a0('0x3'));var moment=require(_0xf8a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8a0('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf8a0('0x6'));var csv=require(_0xf8a0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8a0('0x8'));var _=require(_0xf8a0('0x9'));var squel=require(_0xf8a0('0xa'));var crypto=require(_0xf8a0('0xb'));var jsforce=require(_0xf8a0('0xc'));var deskjs=require(_0xf8a0('0xd'));var toCsv=require(_0xf8a0('0x7'));var querystring=require(_0xf8a0('0xe'));var Papa=require(_0xf8a0('0xf'));var Redis=require(_0xf8a0('0x10'));var authService=require(_0xf8a0('0x11'));var qs=require(_0xf8a0('0x12'));var as=require(_0xf8a0('0x13'));var hardwareService=require(_0xf8a0('0x14'));var logger=require('../../config/logger')(_0xf8a0('0x15'));var utils=require(_0xf8a0('0x16'));var config=require(_0xf8a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x276bfd,_0x31ba25){_0x31ba25=_0x31ba25||0xcc;return function(_0x1c9d6d){if(_0x1c9d6d){return _0x276bfd[_0xf8a0('0x18')](_0x31ba25);}return _0x276bfd[_0xf8a0('0x19')](_0x31ba25)['end']();};}function respondWithResult(_0x22c634,_0x1ebf57){_0x1ebf57=_0x1ebf57||0xc8;return function(_0x408ad6){if(_0x408ad6){return _0x22c634[_0xf8a0('0x19')](_0x1ebf57)['json'](_0x408ad6);}};}function respondWithFilteredResult(_0x7745b,_0x38f29e){return function(_0x58ca82){if(_0x58ca82){var _0x4b82b6=typeof _0x38f29e[_0xf8a0('0x1a')]===_0xf8a0('0x1b')&&typeof _0x38f29e[_0xf8a0('0x1c')]==='undefined';var _0x5de1a4=_0x58ca82[_0xf8a0('0x1d')];var _0x4dd667=_0x4b82b6?0x0:_0x38f29e[_0xf8a0('0x1a')];var _0x13d138=_0x4b82b6?_0x58ca82['count']:_0x38f29e['offset']+_0x38f29e[_0xf8a0('0x1c')];var _0x4ac15f;if(_0x13d138>=_0x5de1a4){_0x13d138=_0x5de1a4;_0x4ac15f=0xc8;}else{_0x4ac15f=0xce;}_0x7745b[_0xf8a0('0x19')](_0x4ac15f);return _0x7745b[_0xf8a0('0x1e')](_0xf8a0('0x1f'),_0x4dd667+'-'+_0x13d138+'/'+_0x5de1a4)[_0xf8a0('0x20')](_0x58ca82);}return null;};}function patchUpdates(_0x2e602d){return function(_0x2fb76b){try{jsonpatch['apply'](_0x2fb76b,_0x2e602d,!![]);}catch(_0x3ec7a0){return BPromise[_0xf8a0('0x21')](_0x3ec7a0);}return _0x2fb76b['save']();};}function saveUpdates(_0x1e397c,_0x284a69){return function(_0x13c8fe){if(_0x13c8fe){return _0x13c8fe['update'](_0x1e397c)[_0xf8a0('0x22')](function(_0x4d0678){return _0x4d0678;});}return null;};}function removeEntity(_0x8b40fa,_0x408f30){return function(_0x3ce516){if(_0x3ce516){return _0x3ce516[_0xf8a0('0x23')]()[_0xf8a0('0x22')](function(){_0x8b40fa[_0xf8a0('0x19')](0xcc)[_0xf8a0('0x24')]();});}};}function handleEntityNotFound(_0x4dee9c,_0x1e016d){return function(_0x219c25){if(!_0x219c25){_0x4dee9c[_0xf8a0('0x18')](0x194);}return _0x219c25;};}function handleError(_0xb14af6,_0x5bd850){_0x5bd850=_0x5bd850||0x1f4;return function(_0x1d6c8f){logger[_0xf8a0('0x25')](_0x1d6c8f[_0xf8a0('0x26')]);if(_0x1d6c8f['name']){delete _0x1d6c8f[_0xf8a0('0x27')];}_0xb14af6['status'](_0x5bd850)[_0xf8a0('0x28')](_0x1d6c8f);};}exports[_0xf8a0('0x29')]=function(_0x5bcc5b,_0x128a9b){var _0x2983fd={},_0x5027cf={},_0x4e5795={'count':0x0,'rows':[]};var _0x39267d=_[_0xf8a0('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x100cdf){return{'name':_0x100cdf[_0xf8a0('0x2b')],'type':_0x100cdf['type'][_0xf8a0('0x2c')]};});_0x5027cf[_0xf8a0('0x2d')]=_['map'](_0x39267d,_0xf8a0('0x27'));_0x5027cf[_0xf8a0('0x2e')]=_['keys'](_0x5bcc5b[_0xf8a0('0x2e')]);_0x5027cf[_0xf8a0('0x2f')]=_['intersection'](_0x5027cf[_0xf8a0('0x2d')],_0x5027cf['query']);_0x2983fd[_0xf8a0('0x30')]=_[_0xf8a0('0x31')](_0x5027cf[_0xf8a0('0x2d')],qs[_0xf8a0('0x32')](_0x5bcc5b[_0xf8a0('0x2e')][_0xf8a0('0x32')]));_0x2983fd[_0xf8a0('0x30')]=_0x2983fd['attributes'][_0xf8a0('0x33')]?_0x2983fd[_0xf8a0('0x30')]:_0x5027cf[_0xf8a0('0x2d')];if(!_0x5bcc5b[_0xf8a0('0x2e')]['hasOwnProperty']('nolimit')){_0x2983fd['limit']=qs[_0xf8a0('0x1c')](_0x5bcc5b['query'][_0xf8a0('0x1c')]);_0x2983fd[_0xf8a0('0x1a')]=qs[_0xf8a0('0x1a')](_0x5bcc5b[_0xf8a0('0x2e')][_0xf8a0('0x1a')]);}_0x2983fd[_0xf8a0('0x34')]=qs[_0xf8a0('0x35')](_0x5bcc5b[_0xf8a0('0x2e')][_0xf8a0('0x35')]);_0x2983fd[_0xf8a0('0x36')]=qs[_0xf8a0('0x2f')](_[_0xf8a0('0x37')](_0x5bcc5b[_0xf8a0('0x2e')],_0x5027cf[_0xf8a0('0x2f')]),_0x39267d);if(_0x5bcc5b['query']['filter']){_0x2983fd[_0xf8a0('0x36')]=_[_0xf8a0('0x38')](_0x2983fd[_0xf8a0('0x36')],{'$or':_[_0xf8a0('0x2a')](_0x39267d,function(_0x4dffe6){if(_0x4dffe6[_0xf8a0('0x39')]!==_0xf8a0('0x3a')){var _0x2e71f7={};_0x2e71f7[_0x4dffe6[_0xf8a0('0x27')]]={'$like':'%'+_0x5bcc5b[_0xf8a0('0x2e')][_0xf8a0('0x3b')]+'%'};return _0x2e71f7;}})});}_0x2983fd=_[_0xf8a0('0x38')]({},_0x2983fd,_0x5bcc5b[_0xf8a0('0x3c')]);var _0x44e638={'where':_0x2983fd[_0xf8a0('0x36')]};return db[_0xf8a0('0x3d')][_0xf8a0('0x1d')](_0x44e638)[_0xf8a0('0x22')](function(_0x23ed05){_0x4e5795[_0xf8a0('0x1d')]=_0x23ed05;if(_0x5bcc5b[_0xf8a0('0x2e')][_0xf8a0('0x3e')]){_0x2983fd[_0xf8a0('0x3f')]=[{'all':!![]}];}return db[_0xf8a0('0x3d')]['findAll'](_0x2983fd);})[_0xf8a0('0x22')](function(_0x545f32){_0x4e5795['rows']=_0x545f32;return _0x4e5795;})[_0xf8a0('0x22')](respondWithFilteredResult(_0x128a9b,_0x2983fd))[_0xf8a0('0x40')](handleError(_0x128a9b,null));};exports[_0xf8a0('0x41')]=function(_0x1b2475,_0x11e9b7){var _0x3ec3a3={'raw':!![],'where':{'id':_0x1b2475[_0xf8a0('0x42')]['id']}},_0x487a8f={};_0x487a8f[_0xf8a0('0x2d')]=_['keys'](db['SquareDetailsReport']['rawAttributes']);_0x487a8f[_0xf8a0('0x2e')]=_[_0xf8a0('0x43')](_0x1b2475[_0xf8a0('0x2e')]);_0x487a8f['filters']=_[_0xf8a0('0x31')](_0x487a8f[_0xf8a0('0x2d')],_0x487a8f[_0xf8a0('0x2e')]);_0x3ec3a3[_0xf8a0('0x30')]=_[_0xf8a0('0x31')](_0x487a8f[_0xf8a0('0x2d')],qs[_0xf8a0('0x32')](_0x1b2475[_0xf8a0('0x2e')][_0xf8a0('0x32')]));_0x3ec3a3['attributes']=_0x3ec3a3[_0xf8a0('0x30')][_0xf8a0('0x33')]?_0x3ec3a3[_0xf8a0('0x30')]:_0x487a8f[_0xf8a0('0x2d')];if(_0x1b2475['query'][_0xf8a0('0x3e')]){_0x3ec3a3[_0xf8a0('0x3f')]=[{'all':!![]}];}_0x3ec3a3=_[_0xf8a0('0x38')]({},_0x3ec3a3,_0x1b2475[_0xf8a0('0x3c')]);return db[_0xf8a0('0x3d')][_0xf8a0('0x44')](_0x3ec3a3)[_0xf8a0('0x22')](handleEntityNotFound(_0x11e9b7,null))['then'](respondWithResult(_0x11e9b7,null))[_0xf8a0('0x40')](handleError(_0x11e9b7,null));};exports[_0xf8a0('0x45')]=function(_0x3de1ab,_0x147fec){return db[_0xf8a0('0x3d')]['create'](_0x3de1ab['body'],{})[_0xf8a0('0x22')](respondWithResult(_0x147fec,0xc9))[_0xf8a0('0x40')](handleError(_0x147fec,null));};exports[_0xf8a0('0x46')]=function(_0xf6fea2,_0x5c1eec){if(_0xf6fea2[_0xf8a0('0x47')]['id']){delete _0xf6fea2['body']['id'];}return db[_0xf8a0('0x3d')][_0xf8a0('0x44')]({'where':{'id':_0xf6fea2[_0xf8a0('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c1eec,null))['then'](saveUpdates(_0xf6fea2[_0xf8a0('0x47')],null))['then'](respondWithResult(_0x5c1eec,null))[_0xf8a0('0x40')](handleError(_0x5c1eec,null));};exports[_0xf8a0('0x23')]=function(_0x136713,_0x24742f){return db[_0xf8a0('0x3d')][_0xf8a0('0x44')]({'where':{'id':_0x136713['params']['id']}})[_0xf8a0('0x22')](handleEntityNotFound(_0x24742f,null))[_0xf8a0('0x22')](removeEntity(_0x24742f,null))[_0xf8a0('0x40')](handleError(_0x24742f,null));};exports['describe']=function(_0x261d9b,_0x546079){return db[_0xf8a0('0x3d')][_0xf8a0('0x48')]()[_0xf8a0('0x22')](respondWithResult(_0x546079,null))[_0xf8a0('0x40')](handleError(_0x546079,null));}; \ No newline at end of file +var _0x5668=['mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','SquareDetailsReport','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','rawAttributes','include','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x11bed1,_0x4b28c9){var _0x279e0b=function(_0x10161d){while(--_0x10161d){_0x11bed1['push'](_0x11bed1['shift']());}};_0x279e0b(++_0x4b28c9);}(_0x5668,0x8b));var _0x8566=function(_0x344414,_0x2026f3){_0x344414=_0x344414-0x0;var _0x34f94b=_0x5668[_0x344414];return _0x34f94b;};'use strict';var emlformat=require(_0x8566('0x0'));var rimraf=require(_0x8566('0x1'));var zipdir=require(_0x8566('0x2'));var jsonpatch=require(_0x8566('0x3'));var rp=require(_0x8566('0x4'));var moment=require(_0x8566('0x5'));var BPromise=require(_0x8566('0x6'));var Mustache=require(_0x8566('0x7'));var util=require(_0x8566('0x8'));var path=require(_0x8566('0x9'));var sox=require(_0x8566('0xa'));var csv=require(_0x8566('0xb'));var ejs=require(_0x8566('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8566('0xd'));var squel=require(_0x8566('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8566('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8566('0x10'));var Redis=require('ioredis');var authService=require(_0x8566('0x11'));var qs=require(_0x8566('0x12'));var as=require(_0x8566('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8566('0x14'))(_0x8566('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11e0a5,_0x3318a3){_0x3318a3=_0x3318a3||0xcc;return function(_0x2025a2){if(_0x2025a2){return _0x11e0a5[_0x8566('0x16')](_0x3318a3);}return _0x11e0a5[_0x8566('0x17')](_0x3318a3)['end']();};}function respondWithResult(_0x581e26,_0x47bef1){_0x47bef1=_0x47bef1||0xc8;return function(_0x489470){if(_0x489470){return _0x581e26['status'](_0x47bef1)[_0x8566('0x18')](_0x489470);}};}function respondWithFilteredResult(_0x229a5c,_0x3076df){return function(_0x396f1b){if(_0x396f1b){var _0x39faee=typeof _0x3076df['offset']===_0x8566('0x19')&&typeof _0x3076df[_0x8566('0x1a')]===_0x8566('0x19');var _0x4e20a2=_0x396f1b[_0x8566('0x1b')];var _0x1a8ae0=_0x39faee?0x0:_0x3076df[_0x8566('0x1c')];var _0x526f23=_0x39faee?_0x396f1b[_0x8566('0x1b')]:_0x3076df['offset']+_0x3076df['limit'];var _0x3c4629;if(_0x526f23>=_0x4e20a2){_0x526f23=_0x4e20a2;_0x3c4629=0xc8;}else{_0x3c4629=0xce;}_0x229a5c['status'](_0x3c4629);return _0x229a5c[_0x8566('0x1d')]('Content-Range',_0x1a8ae0+'-'+_0x526f23+'/'+_0x4e20a2)[_0x8566('0x18')](_0x396f1b);}return null;};}function patchUpdates(_0x581b58){return function(_0x43fc7c){try{jsonpatch[_0x8566('0x1e')](_0x43fc7c,_0x581b58,!![]);}catch(_0x2bd76c){return BPromise[_0x8566('0x1f')](_0x2bd76c);}return _0x43fc7c[_0x8566('0x20')]();};}function saveUpdates(_0x4ca8e2,_0x5b06e6){return function(_0x3d2cf8){if(_0x3d2cf8){return _0x3d2cf8[_0x8566('0x21')](_0x4ca8e2)[_0x8566('0x22')](function(_0xa3efc4){return _0xa3efc4;});}return null;};}function removeEntity(_0x4e19cf,_0x183435){return function(_0x64127b){if(_0x64127b){return _0x64127b['destroy']()[_0x8566('0x22')](function(){_0x4e19cf[_0x8566('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3191f5,_0xf4a090){return function(_0x18ee17){if(!_0x18ee17){_0x3191f5['sendStatus'](0x194);}return _0x18ee17;};}function handleError(_0x12f318,_0x451bbf){_0x451bbf=_0x451bbf||0x1f4;return function(_0x327f7d){logger[_0x8566('0x23')](_0x327f7d[_0x8566('0x24')]);if(_0x327f7d[_0x8566('0x25')]){delete _0x327f7d[_0x8566('0x25')];}_0x12f318['status'](_0x451bbf)[_0x8566('0x26')](_0x327f7d);};}exports[_0x8566('0x27')]=function(_0x40aed8,_0x8a1dff){var _0xea61c9={},_0x3a3106={},_0x1e4e05={'count':0x0,'rows':[]};var _0x8637b3=_['map'](db[_0x8566('0x28')]['rawAttributes'],function(_0x5f05e8){return{'name':_0x5f05e8[_0x8566('0x29')],'type':_0x5f05e8[_0x8566('0x2a')]['key']};});_0x3a3106[_0x8566('0x2b')]=_[_0x8566('0x2c')](_0x8637b3,_0x8566('0x25'));_0x3a3106[_0x8566('0x2d')]=_[_0x8566('0x2e')](_0x40aed8[_0x8566('0x2d')]);_0x3a3106['filters']=_['intersection'](_0x3a3106[_0x8566('0x2b')],_0x3a3106[_0x8566('0x2d')]);_0xea61c9['attributes']=_[_0x8566('0x2f')](_0x3a3106['model'],qs[_0x8566('0x30')](_0x40aed8['query'][_0x8566('0x30')]));_0xea61c9[_0x8566('0x31')]=_0xea61c9['attributes'][_0x8566('0x32')]?_0xea61c9[_0x8566('0x31')]:_0x3a3106[_0x8566('0x2b')];if(!_0x40aed8[_0x8566('0x2d')][_0x8566('0x33')](_0x8566('0x34'))){_0xea61c9[_0x8566('0x1a')]=qs[_0x8566('0x1a')](_0x40aed8['query'][_0x8566('0x1a')]);_0xea61c9[_0x8566('0x1c')]=qs[_0x8566('0x1c')](_0x40aed8['query'][_0x8566('0x1c')]);}_0xea61c9['order']=qs[_0x8566('0x35')](_0x40aed8[_0x8566('0x2d')][_0x8566('0x35')]);_0xea61c9[_0x8566('0x36')]=qs[_0x8566('0x37')](_[_0x8566('0x38')](_0x40aed8[_0x8566('0x2d')],_0x3a3106['filters']),_0x8637b3);if(_0x40aed8['query'][_0x8566('0x39')]){_0xea61c9['where']=_[_0x8566('0x3a')](_0xea61c9[_0x8566('0x36')],{'$or':_['map'](_0x8637b3,function(_0x3cc4af){if(_0x3cc4af['type']!==_0x8566('0x3b')){var _0x538cea={};_0x538cea[_0x3cc4af[_0x8566('0x25')]]={'$like':'%'+_0x40aed8[_0x8566('0x2d')]['filter']+'%'};return _0x538cea;}})});}_0xea61c9=_[_0x8566('0x3a')]({},_0xea61c9,_0x40aed8['options']);var _0x56ad5d={'where':_0xea61c9['where']};return db[_0x8566('0x28')]['count'](_0x56ad5d)[_0x8566('0x22')](function(_0x2e3a88){_0x1e4e05[_0x8566('0x1b')]=_0x2e3a88;if(_0x40aed8[_0x8566('0x2d')][_0x8566('0x3c')]){_0xea61c9['include']=[{'all':!![]}];}return db[_0x8566('0x28')][_0x8566('0x3d')](_0xea61c9);})[_0x8566('0x22')](function(_0x28d31a){_0x1e4e05[_0x8566('0x3e')]=_0x28d31a;return _0x1e4e05;})[_0x8566('0x22')](respondWithFilteredResult(_0x8a1dff,_0xea61c9))[_0x8566('0x3f')](handleError(_0x8a1dff,null));};exports['show']=function(_0x1d7982,_0x1eb745){var _0xd6e7fc={'raw':!![],'where':{'id':_0x1d7982['params']['id']}},_0x34336b={};_0x34336b[_0x8566('0x2b')]=_['keys'](db[_0x8566('0x28')][_0x8566('0x40')]);_0x34336b['query']=_[_0x8566('0x2e')](_0x1d7982['query']);_0x34336b[_0x8566('0x37')]=_['intersection'](_0x34336b[_0x8566('0x2b')],_0x34336b[_0x8566('0x2d')]);_0xd6e7fc[_0x8566('0x31')]=_[_0x8566('0x2f')](_0x34336b['model'],qs['fields'](_0x1d7982[_0x8566('0x2d')][_0x8566('0x30')]));_0xd6e7fc[_0x8566('0x31')]=_0xd6e7fc['attributes'][_0x8566('0x32')]?_0xd6e7fc[_0x8566('0x31')]:_0x34336b['model'];if(_0x1d7982[_0x8566('0x2d')][_0x8566('0x3c')]){_0xd6e7fc[_0x8566('0x41')]=[{'all':!![]}];}_0xd6e7fc=_[_0x8566('0x3a')]({},_0xd6e7fc,_0x1d7982[_0x8566('0x42')]);return db[_0x8566('0x28')][_0x8566('0x43')](_0xd6e7fc)['then'](handleEntityNotFound(_0x1eb745,null))[_0x8566('0x22')](respondWithResult(_0x1eb745,null))[_0x8566('0x3f')](handleError(_0x1eb745,null));};exports[_0x8566('0x44')]=function(_0x1709e9,_0x4a1ea1){return db[_0x8566('0x28')]['create'](_0x1709e9[_0x8566('0x45')],{})[_0x8566('0x22')](respondWithResult(_0x4a1ea1,0xc9))[_0x8566('0x3f')](handleError(_0x4a1ea1,null));};exports[_0x8566('0x21')]=function(_0x1b2cdf,_0x58e580){if(_0x1b2cdf[_0x8566('0x45')]['id']){delete _0x1b2cdf['body']['id'];}return db['SquareDetailsReport'][_0x8566('0x43')]({'where':{'id':_0x1b2cdf[_0x8566('0x46')]['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x58e580,null))[_0x8566('0x22')](saveUpdates(_0x1b2cdf[_0x8566('0x45')],null))[_0x8566('0x22')](respondWithResult(_0x58e580,null))['catch'](handleError(_0x58e580,null));};exports[_0x8566('0x47')]=function(_0x2cf936,_0x19b679){return db[_0x8566('0x28')][_0x8566('0x43')]({'where':{'id':_0x2cf936[_0x8566('0x46')]['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x19b679,null))[_0x8566('0x22')](removeEntity(_0x19b679,null))[_0x8566('0x3f')](handleError(_0x19b679,null));};exports[_0x8566('0x48')]=function(_0x34561c,_0x4eb953){return db[_0x8566('0x28')][_0x8566('0x48')]()[_0x8566('0x22')](respondWithResult(_0x4eb953,null))[_0x8566('0x3f')](handleError(_0x4eb953,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f4472b0..16147c6 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 _0xd091=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd091,0x1b1));var _0x1d09=function(_0x4f7a8a,_0x590072){_0x4f7a8a=_0x4f7a8a-0x0;var _0x356fdc=_0xd091[_0x4f7a8a];return _0x356fdc;};'use strict';var _=require(_0x1d09('0x0'));var util=require(_0x1d09('0x1'));var logger=require(_0x1d09('0x2'))(_0x1d09('0x3'));var moment=require(_0x1d09('0x4'));var BPromise=require(_0x1d09('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d09('0x6'));var rimraf=require(_0x1d09('0x7'));var config=require(_0x1d09('0x8'));var attributes=require(_0x1d09('0x9'));module['exports']=function(_0x193d02,_0x263d31){return _0x193d02[_0x1d09('0xa')](_0x1d09('0xb'),attributes,{'tableName':_0x1d09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa76=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb96692,_0x256430){var _0x1eb6fb=function(_0x8c7009){while(--_0x8c7009){_0xb96692['push'](_0xb96692['shift']());}};_0x1eb6fb(++_0x256430);}(_0xfa76,0x91));var _0x6fa7=function(_0x38fdd8,_0x4e9292){_0x38fdd8=_0x38fdd8-0x0;var _0xfb680d=_0xfa76[_0x38fdd8];return _0xfb680d;};'use strict';var _=require(_0x6fa7('0x0'));var util=require(_0x6fa7('0x1'));var logger=require(_0x6fa7('0x2'))('api');var moment=require(_0x6fa7('0x3'));var BPromise=require(_0x6fa7('0x4'));var rp=require(_0x6fa7('0x5'));var fs=require('fs');var path=require(_0x6fa7('0x6'));var rimraf=require(_0x6fa7('0x7'));var config=require(_0x6fa7('0x8'));var attributes=require(_0x6fa7('0x9'));module[_0x6fa7('0xa')]=function(_0x4da172,_0x374d33){return _0x4da172[_0x6fa7('0xb')](_0x6fa7('0xc'),attributes,{'tableName':_0x6fa7('0xd'),'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 a2f5374..080c6bb 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 _0x94df=['client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a428f,_0xa2f31d){var _0x40b163=function(_0x4d1f06){while(--_0x4d1f06){_0x2a428f['push'](_0x2a428f['shift']());}};_0x40b163(++_0xa2f31d);}(_0x94df,0xa3));var _0xf94d=function(_0x14b454,_0x325943){_0x14b454=_0x14b454-0x0;var _0x4b1b54=_0x94df[_0x14b454];return _0x4b1b54;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a11a,_0x1ebc19,_0xf285b5){return new BPromise(function(_0x1832e9,_0x504670){return client[_0xf94d('0xd')](_0x18a11a,_0xf285b5)[_0xf94d('0xe')](function(_0x145f5b){logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));logger['debug'](_0xf94d('0x12'),_0x1ebc19,_0xf94d('0x11'),JSON[_0xf94d('0x13')](_0x145f5b));if(_0x145f5b[_0xf94d('0x14')]){if(_0x145f5b[_0xf94d('0x14')]['code']===0x1f4){logger['error'](_0xf94d('0x10'),_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x504670(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x1832e9(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}else{logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));_0x1832e9(_0x145f5b[_0xf94d('0x16')]['message']);}})[_0xf94d('0x17')](function(_0x5cd967){logger[_0xf94d('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ebc19,_0x5cd967);_0x504670(_0x5cd967);});});}exports[_0xf94d('0x18')]=function(_0x559e0c){var _0x30d231=this;return new Promise(function(_0x3bf001,_0x510eef){return db[_0xf94d('0x19')]['create'](_0x559e0c[_0xf94d('0x1a')],{'raw':_0x559e0c['options']?_0x559e0c[_0xf94d('0x1b')][_0xf94d('0x1c')]===undefined?!![]:![]:!![]})[_0xf94d('0xe')](function(_0x2ede5b){logger['info'](_0xf94d('0x18'),_0x559e0c);logger['debug'](_0xf94d('0x18'),_0x559e0c,JSON[_0xf94d('0x13')](_0x2ede5b));_0x3bf001(_0x2ede5b);})[_0xf94d('0x17')](function(_0x56e5f5){logger[_0xf94d('0x14')](_0xf94d('0x18'),_0x56e5f5[_0xf94d('0x15')],_0x559e0c);_0x510eef(_0x30d231[_0xf94d('0x14')](0x1f4,_0x56e5f5[_0xf94d('0x15')]));});});}; \ No newline at end of file +var _0x06ef=['debug','stringify','error','code','message','result','catch','SquareDetailsReport,\x20%s,\x20%s','body','options','CreateSquareDetailsReport','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x1750da,_0x1c5e91){var _0x61d49f=function(_0x150675){while(--_0x150675){_0x1750da['push'](_0x1750da['shift']());}};_0x61d49f(++_0x1c5e91);}(_0x06ef,0x185));var _0xf06e=function(_0x1eb405,_0x37565b){_0x1eb405=_0x1eb405-0x0;var _0x4207a7=_0x06ef[_0x1eb405];return _0x4207a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf06e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var config=require('../../config/environment');var jayson=require(_0xf06e('0x4'));var client=jayson[_0xf06e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b74b,_0x4e05dc,_0x5cddf1){return new BPromise(function(_0x4ccbee,_0x25b56e){return client[_0xf06e('0x6')](_0x59b74b,_0x5cddf1)[_0xf06e('0x7')](function(_0x2bb08c){logger[_0xf06e('0x8')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));logger[_0xf06e('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'),JSON[_0xf06e('0xb')](_0x2bb08c));if(_0x2bb08c[_0xf06e('0xc')]){if(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xd')]===0x1f4){logger[_0xf06e('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);return _0x25b56e(_0x2bb08c['error'][_0xf06e('0xe')]);}logger[_0xf06e('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c['error']['message']);return _0x4ccbee(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);}else{logger[_0xf06e('0x8')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));_0x4ccbee(_0x2bb08c[_0xf06e('0xf')][_0xf06e('0xe')]);}})[_0xf06e('0x10')](function(_0x44157a){logger[_0xf06e('0xc')](_0xf06e('0x11'),_0x4e05dc,_0x44157a);_0x25b56e(_0x44157a);});});}exports['CreateSquareDetailsReport']=function(_0x380c07){var _0x55dabf=this;return new Promise(function(_0x251c9f,_0x7a9f4b){return db['SquareDetailsReport']['create'](_0x380c07[_0xf06e('0x12')],{'raw':_0x380c07[_0xf06e('0x13')]?_0x380c07['options']['raw']===undefined?!![]:![]:!![]})[_0xf06e('0x7')](function(_0x211590){logger[_0xf06e('0x8')]('CreateSquareDetailsReport',_0x380c07);logger[_0xf06e('0xa')](_0xf06e('0x14'),_0x380c07,JSON['stringify'](_0x211590));_0x251c9f(_0x211590);})[_0xf06e('0x10')](function(_0x1ba130){logger[_0xf06e('0xc')]('CreateSquareDetailsReport',_0x1ba130[_0xf06e('0xe')],_0x380c07);_0x7a9f4b(_0x55dabf[_0xf06e('0xc')](0x1f4,_0x1ba130[_0xf06e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b3c0cac..044af56 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 _0x38bc=['../../components/auth/service','./system.controller','get','index','killProcess','exports','express'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0x38bc,0x1e9));var _0xc38b=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x38bc[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0xc38b('0x0'));var router=express['Router']();var auth=require(_0xc38b('0x1'));var controller=require(_0xc38b('0x2'));router[_0xc38b('0x3')]('/',auth['isAuthenticated'](),controller[_0xc38b('0x4')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xc38b('0x5')]);module[_0xc38b('0x6')]=router; \ No newline at end of file +var _0xa5e9=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa5e9,0x12d));var _0x9a5e=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xa5e9[_0x3430aa];return _0x2ac5c;};'use strict';var express=require(_0x9a5e('0x0'));var router=express[_0x9a5e('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x9a5e('0x2')]('/',auth[_0x9a5e('0x3')](),controller[_0x9a5e('0x4')]);router[_0x9a5e('0x2')](_0x9a5e('0x5'),auth[_0x9a5e('0x3')](),controller[_0x9a5e('0x6')]);module[_0x9a5e('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 35541da..7e86c03 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 _0x1971=['name','status','getAllData','then','json','catch','killProcess','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x56efd0,_0x2a754c){var _0x5bdcf8=function(_0x4bbe94){while(--_0x4bbe94){_0x56efd0['push'](_0x56efd0['shift']());}};_0x5bdcf8(++_0x2a754c);}(_0x1971,0xac));var _0x1197=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x1971[_0x4ea69d];return _0x5318e0;};'use strict';var info=require('systeminformation');var exec=require(_0x1197('0x0'))[_0x1197('0x1')];var logger=require(_0x1197('0x2'))(_0x1197('0x3'));var util=require(_0x1197('0x4'));var BPromise=require(_0x1197('0x5'));var _=require(_0x1197('0x6'));function handleError(_0x2437f9,_0x40a16a,_0xe332d5){_0x40a16a=_0x40a16a||0x1f4;return function(_0x111854){logger[_0x1197('0x7')](_0x1197('0x8'),_0xe332d5,_0x40a16a,util[_0x1197('0x9')](_0x111854,{'showHidden':![],'depth':null}));delete _0x111854[_0x1197('0xa')];_0x2437f9[_0x1197('0xb')](_0x40a16a)['send'](_0x111854);};}exports['index']=function(_0x358ad8,_0xdd723d){return info[_0x1197('0xc')]()[_0x1197('0xd')](function(_0x4e51cc){return _0xdd723d['status'](0xc8)[_0x1197('0xe')](_0x4e51cc);})[_0x1197('0xf')](function(_0x21505e){return _0xdd723d[_0x1197('0xb')](0x1f4)[_0x1197('0xe')](_0x21505e);});};exports[_0x1197('0x10')]=function(_0x4903d1,_0x22d906){var _0x2cba6e=['components/import/cm'];return new BPromise(function(_0x50ef4a,_0x3a6b6c){return exec(util[_0x1197('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4903d1[_0x1197('0x12')]['pid']),function(_0x4e576c,_0x38a3cd,_0x34ee19){if(_0x4e576c){return _0x3a6b6c(_0x4e576c);}return _0x50ef4a(_0x38a3cd);});})[_0x1197('0xd')](function(_0xd61f4a){var _0xe1531=![];var _0x45e9bb=_0xd61f4a[_0x1197('0x13')](/\n/);for(var _0x352b1a=0x0,_0x143bb9=_0x2cba6e[_0x1197('0x14')];_0x352b1a<_0x143bb9,_0xe1531===![];_0x352b1a+=0x1){if(_0xd61f4a[_0x1197('0x15')](_0x2cba6e[_0x352b1a])>=0x0){_0xe1531=!![];}}if(!_0xe1531){throw new Error(util[_0x1197('0x11')](_0x1197('0x16'),_0x4903d1['params'][_0x1197('0x17')]));}process['kill'](_0x4903d1[_0x1197('0x12')][_0x1197('0x17')],_0x1197('0x18'));return _0x22d906[_0x1197('0xb')](0xc8)[_0x1197('0xe')]({'message':util[_0x1197('0x11')](_0x1197('0x19'),_0x4903d1[_0x1197('0x12')]['pid'])});})[_0x1197('0xf')](handleError(_0x22d906,null,_0x1197('0x10')));}; \ No newline at end of file +var _0x0869=['params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','catch','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x2cefd2,_0x3eed48){var _0x528537=function(_0x4a529b){while(--_0x4a529b){_0x2cefd2['push'](_0x2cefd2['shift']());}};_0x528537(++_0x3eed48);}(_0x0869,0x133));var _0x9086=function(_0xe55fe,_0x51e66b){_0xe55fe=_0xe55fe-0x0;var _0x3e78cd=_0x0869[_0xe55fe];return _0x3e78cd;};'use strict';var info=require('systeminformation');var exec=require(_0x9086('0x0'))[_0x9086('0x1')];var logger=require(_0x9086('0x2'))(_0x9086('0x3'));var util=require(_0x9086('0x4'));var BPromise=require('bluebird');var _=require(_0x9086('0x5'));function handleError(_0x455952,_0x317e88,_0x144a8c){_0x317e88=_0x317e88||0x1f4;return function(_0x5b0860){logger[_0x9086('0x6')](_0x9086('0x7'),_0x144a8c,_0x317e88,util[_0x9086('0x8')](_0x5b0860,{'showHidden':![],'depth':null}));delete _0x5b0860['name'];_0x455952[_0x9086('0x9')](_0x317e88)[_0x9086('0xa')](_0x5b0860);};}exports[_0x9086('0xb')]=function(_0x21d8ed,_0x3c26fd){return info[_0x9086('0xc')]()[_0x9086('0xd')](function(_0x40ea6d){return _0x3c26fd[_0x9086('0x9')](0xc8)['json'](_0x40ea6d);})[_0x9086('0xe')](function(_0x13e1ef){return _0x3c26fd['status'](0x1f4)[_0x9086('0xf')](_0x13e1ef);});};exports['killProcess']=function(_0x5d8cc6,_0x402981){var _0x2d187c=['components/import/cm'];return new BPromise(function(_0x5b7499,_0x6ee75b){return exec(util[_0x9086('0x10')](_0x9086('0x11'),_0x5d8cc6[_0x9086('0x12')][_0x9086('0x13')]),function(_0x249119,_0x385682,_0xe8ce3c){if(_0x249119){return _0x6ee75b(_0x249119);}return _0x5b7499(_0x385682);});})['then'](function(_0xb2d212){var _0xafe0a4=![];var _0x1124d7=_0xb2d212['split'](/\n/);for(var _0x2e709e=0x0,_0x42c0ad=_0x2d187c['length'];_0x2e709e<_0x42c0ad,_0xafe0a4===![];_0x2e709e+=0x1){if(_0xb2d212[_0x9086('0x14')](_0x2d187c[_0x2e709e])>=0x0){_0xafe0a4=!![];}}if(!_0xafe0a4){throw new Error(util['format'](_0x9086('0x15'),_0x5d8cc6['params']['pid']));}process['kill'](_0x5d8cc6[_0x9086('0x12')][_0x9086('0x13')],_0x9086('0x16'));return _0x402981[_0x9086('0x9')](0xc8)[_0x9086('0xf')]({'message':util[_0x9086('0x10')](_0x9086('0x17'),_0x5d8cc6[_0x9086('0x12')][_0x9086('0x13')])});})[_0x9086('0xe')](handleError(_0x402981,null,_0x9086('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 72e89aa..5b9bffc 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 _0x4110=['./tag.controller','get','index','isAuthenticated','show','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x559c5b,_0x1e8ff3){var _0x5514ce=function(_0x2def08){while(--_0x2def08){_0x559c5b['push'](_0x559c5b['shift']());}};_0x5514ce(++_0x1e8ff3);}(_0x4110,0xac));var _0x0411=function(_0xf1969b,_0x4fbceb){_0xf1969b=_0xf1969b-0x0;var _0x38f3f7=_0x4110[_0xf1969b];return _0x38f3f7;};'use strict';var multer=require(_0x0411('0x0'));var util=require(_0x0411('0x1'));var path=require(_0x0411('0x2'));var timeout=require(_0x0411('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0411('0x4'));var auth=require(_0x0411('0x5'));var interaction=require(_0x0411('0x6'));var config=require(_0x0411('0x7'));var controller=require(_0x0411('0x8'));router[_0x0411('0x9')]('/',auth['isAuthenticated'](),controller[_0x0411('0xa')]);router['get']('/:id',auth[_0x0411('0xb')](),controller[_0x0411('0xc')]);router['post']('/',auth[_0x0411('0xb')](),controller['create']);router[_0x0411('0xd')]('/:id',auth[_0x0411('0xb')](),controller[_0x0411('0xe')]);router[_0x0411('0xf')](_0x0411('0x10'),auth[_0x0411('0xb')](),controller[_0x0411('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1631=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x480c83,_0x1f8665){var _0x3368e0=function(_0xfb83fd){while(--_0xfb83fd){_0x480c83['push'](_0x480c83['shift']());}};_0x3368e0(++_0x1f8665);}(_0x1631,0x19d));var _0x1163=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1631[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0x1163('0x0'));var util=require(_0x1163('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1163('0x2'));var router=express[_0x1163('0x3')]();var fs_extra=require(_0x1163('0x4'));var auth=require(_0x1163('0x5'));var interaction=require(_0x1163('0x6'));var config=require(_0x1163('0x7'));var controller=require(_0x1163('0x8'));router[_0x1163('0x9')]('/',auth[_0x1163('0xa')](),controller[_0x1163('0xb')]);router['get'](_0x1163('0xc'),auth['isAuthenticated'](),controller[_0x1163('0xd')]);router[_0x1163('0xe')]('/',auth[_0x1163('0xa')](),controller['create']);router[_0x1163('0xf')]('/:id',auth[_0x1163('0xa')](),controller[_0x1163('0x10')]);router['delete']('/:id',auth[_0x1163('0xa')](),controller[_0x1163('0x11')]);module[_0x1163('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3b86b94..93e11eb 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 _0xc29b=['#0091EA','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc29b,0x12d));var _0xbc29=function(_0x191769,_0x2ffe19){_0x191769=_0x191769-0x0;var _0xc5f651=_0xc29b[_0x191769];return _0xc5f651;};'use strict';var Sequelize=require(_0xbc29('0x0'));module[_0xbc29('0x1')]={'name':{'type':Sequelize[_0xbc29('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbc29('0x2')],'defaultValue':_0xbc29('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4123=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x4123,0x87));var _0x3412=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x4123[_0x34e51c];return _0x31643c;};'use strict';var Sequelize=require(_0x3412('0x0'));module[_0x3412('0x1')]={'name':{'type':Sequelize[_0x3412('0x2')],'unique':_0x3412('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3412('0x2')],'defaultValue':_0x3412('0x4')},'description':{'type':Sequelize[_0x3412('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 50338cd..c612e88 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 _0x6f7a=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Tags','destroy','then','sendStatus','error','stack','name','send','index','Tag','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x92994a,_0xd78587){var _0x52cb25=function(_0x6e1e65){while(--_0x6e1e65){_0x92994a['push'](_0x92994a['shift']());}};_0x52cb25(++_0xd78587);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1977f3,_0x2469f5){_0x1977f3=_0x1977f3-0x0;var _0x5e30f7=_0x6f7a[_0x1977f3];return _0x5e30f7;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['Tag'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['Tag'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['Tag'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));}; \ No newline at end of file +var _0xb07f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','Tag','findAll','rows','catch','show','params','keys','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb07f,0x109));var _0xfb07=function(_0x11cc2b,_0x3df611){_0x11cc2b=_0x11cc2b-0x0;var _0x574ffb=_0xb07f[_0x11cc2b];return _0x574ffb;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x17'))(_0xfb07('0x18'));var utils=require('../../config/utils');var config=require(_0xfb07('0x19'));var licenseUtil=require(_0xfb07('0x1a'));var db=require(_0xfb07('0x1b'))['db'];function respondWithStatusCode(_0x13275d,_0x2ad2cf){_0x2ad2cf=_0x2ad2cf||0xcc;return function(_0x35fd11){if(_0x35fd11){return _0x13275d[_0xfb07('0x1c')](_0x2ad2cf);}return _0x13275d['status'](_0x2ad2cf)[_0xfb07('0x1d')]();};}function respondWithResult(_0x40bf71,_0x3c69db){_0x3c69db=_0x3c69db||0xc8;return function(_0x2c35e4){if(_0x2c35e4){return _0x40bf71[_0xfb07('0x1e')](_0x3c69db)[_0xfb07('0x1f')](_0x2c35e4);}};}function respondWithFilteredResult(_0x29cbae,_0x228e2a){return function(_0x2363d6){if(_0x2363d6){var _0x6a14e0=typeof _0x228e2a[_0xfb07('0x20')]===_0xfb07('0x21')&&typeof _0x228e2a[_0xfb07('0x22')]===_0xfb07('0x21');var _0x4ebcc3=_0x2363d6['count'];var _0x3e747e=_0x6a14e0?0x0:_0x228e2a[_0xfb07('0x20')];var _0x197f12=_0x6a14e0?_0x2363d6['count']:_0x228e2a[_0xfb07('0x20')]+_0x228e2a[_0xfb07('0x22')];var _0x527c4e;if(_0x197f12>=_0x4ebcc3){_0x197f12=_0x4ebcc3;_0x527c4e=0xc8;}else{_0x527c4e=0xce;}_0x29cbae['status'](_0x527c4e);return _0x29cbae[_0xfb07('0x23')](_0xfb07('0x24'),_0x3e747e+'-'+_0x197f12+'/'+_0x4ebcc3)[_0xfb07('0x1f')](_0x2363d6);}return null;};}function patchUpdates(_0x2c6c44){return function(_0x388995){try{jsonpatch[_0xfb07('0x25')](_0x388995,_0x2c6c44,!![]);}catch(_0x15e153){return BPromise[_0xfb07('0x26')](_0x15e153);}return _0x388995[_0xfb07('0x27')]();};}function saveUpdates(_0x578bb2,_0x45806a){return function(_0x56d0c4){if(_0x56d0c4){return _0x56d0c4[_0xfb07('0x28')](_0x578bb2)[_0xfb07('0x29')](function(_0x428c85){return _0x428c85;});}return null;};}function removeEntity(_0x301c1a,_0xb2063a){return function(_0x508d3b){if(_0x508d3b){return _0x508d3b[_0xfb07('0x2a')]()[_0xfb07('0x29')](function(){var _0x10835a=_0x508d3b[_0xfb07('0x2b')]({'plain':!![]});var _0x3b14fa=_0xfb07('0x2c');return db['UserProfileResource'][_0xfb07('0x2a')]({'where':{'type':_0x3b14fa,'resourceId':_0x10835a['id']}})[_0xfb07('0x29')](function(){return _0x508d3b;});})['then'](function(){_0x301c1a[_0xfb07('0x1e')](0xcc)[_0xfb07('0x1d')]();});}};}function handleEntityNotFound(_0xe813a7,_0x149ac0){return function(_0x46927a){if(!_0x46927a){_0xe813a7[_0xfb07('0x1c')](0x194);}return _0x46927a;};}function handleError(_0x20f01a,_0x24ff99){_0x24ff99=_0x24ff99||0x1f4;return function(_0x95f1d){logger[_0xfb07('0x2d')](_0x95f1d[_0xfb07('0x2e')]);if(_0x95f1d['name']){delete _0x95f1d[_0xfb07('0x2f')];}_0x20f01a[_0xfb07('0x1e')](_0x24ff99)[_0xfb07('0x30')](_0x95f1d);};}exports[_0xfb07('0x31')]=function(_0x5dd4c9,_0x46d57e){var _0xd5290c={},_0x4ce9a4={},_0x36da2a={'count':0x0,'rows':[]};var _0x5dc353=_[_0xfb07('0x32')](db['Tag'][_0xfb07('0x33')],function(_0x4a8d4c){return{'name':_0x4a8d4c[_0xfb07('0x34')],'type':_0x4a8d4c[_0xfb07('0x35')][_0xfb07('0x36')]};});_0x4ce9a4[_0xfb07('0x37')]=_[_0xfb07('0x32')](_0x5dc353,_0xfb07('0x2f'));_0x4ce9a4['query']=_['keys'](_0x5dd4c9[_0xfb07('0x38')]);_0x4ce9a4[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],_0x4ce9a4['query']);_0xd5290c['attributes']=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3b')]));_0xd5290c[_0xfb07('0x3c')]=_0xd5290c['attributes']['length']?_0xd5290c['attributes']:_0x4ce9a4[_0xfb07('0x37')];if(!_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3d')](_0xfb07('0x3e'))){_0xd5290c['limit']=qs['limit'](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x22')]);_0xd5290c['offset']=qs['offset'](_0x5dd4c9['query'][_0xfb07('0x20')]);}_0xd5290c[_0xfb07('0x3f')]=qs['sort'](_0x5dd4c9['query'][_0xfb07('0x40')]);_0xd5290c[_0xfb07('0x41')]=qs[_0xfb07('0x39')](_[_0xfb07('0x42')](_0x5dd4c9[_0xfb07('0x38')],_0x4ce9a4['filters']),_0x5dc353);if(_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]){_0xd5290c[_0xfb07('0x41')]=_[_0xfb07('0x44')](_0xd5290c['where'],{'$or':_['map'](_0x5dc353,function(_0x2d40cb){if(_0x2d40cb[_0xfb07('0x35')]!==_0xfb07('0x45')){var _0xc5df59={};_0xc5df59[_0x2d40cb[_0xfb07('0x2f')]]={'$like':'%'+_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]+'%'};return _0xc5df59;}})});}_0xd5290c=_['merge']({},_0xd5290c,_0x5dd4c9['options']);var _0x44dafb={'where':_0xd5290c[_0xfb07('0x41')]};return db['Tag']['count'](_0x44dafb)[_0xfb07('0x29')](function(_0x20d682){_0x36da2a[_0xfb07('0x46')]=_0x20d682;if(_0x5dd4c9['query']['includeAll']){_0xd5290c[_0xfb07('0x47')]=[{'all':!![]}];}return db[_0xfb07('0x48')][_0xfb07('0x49')](_0xd5290c);})[_0xfb07('0x29')](function(_0xb87b68){_0x36da2a[_0xfb07('0x4a')]=_0xb87b68;return _0x36da2a;})[_0xfb07('0x29')](respondWithFilteredResult(_0x46d57e,_0xd5290c))[_0xfb07('0x4b')](handleError(_0x46d57e,null));};exports[_0xfb07('0x4c')]=function(_0x492f1b,_0x41df3f){var _0x12c588={'raw':!![],'where':{'id':_0x492f1b[_0xfb07('0x4d')]['id']}},_0x3d6372={};_0x3d6372[_0xfb07('0x37')]=_[_0xfb07('0x4e')](db[_0xfb07('0x48')][_0xfb07('0x33')]);_0x3d6372[_0xfb07('0x38')]=_[_0xfb07('0x4e')](_0x492f1b['query']);_0x3d6372['filters']=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],_0x3d6372['query']);_0x12c588[_0xfb07('0x3c')]=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x492f1b[_0xfb07('0x38')]['fields']));_0x12c588['attributes']=_0x12c588[_0xfb07('0x3c')][_0xfb07('0x4f')]?_0x12c588[_0xfb07('0x3c')]:_0x3d6372[_0xfb07('0x37')];if(_0x492f1b[_0xfb07('0x38')][_0xfb07('0x50')]){_0x12c588[_0xfb07('0x47')]=[{'all':!![]}];}_0x12c588=_[_0xfb07('0x44')]({},_0x12c588,_0x492f1b[_0xfb07('0x51')]);return db[_0xfb07('0x48')]['find'](_0x12c588)['then'](handleEntityNotFound(_0x41df3f,null))['then'](respondWithResult(_0x41df3f,null))[_0xfb07('0x4b')](handleError(_0x41df3f,null));};exports['create']=function(_0x2397f8,_0x31cca8){return db[_0xfb07('0x48')][_0xfb07('0x52')](_0x2397f8[_0xfb07('0x53')],{})[_0xfb07('0x29')](function(_0x4d464e){var _0x3b2cce=_0x2397f8[_0xfb07('0x54')][_0xfb07('0x2b')]({'plain':!![]});if(!_0x3b2cce)throw new Error(_0xfb07('0x55'));if(_0x3b2cce[_0xfb07('0x56')]==='user'){var _0x3cfb89=_0x4d464e[_0xfb07('0x2b')]({'plain':!![]});var _0x40fa4a=_0xfb07('0x2c');return db[_0xfb07('0x57')]['find']({'where':{'name':_0x40fa4a,'userProfileId':_0x3b2cce[_0xfb07('0x58')]},'raw':!![]})[_0xfb07('0x29')](function(_0x38b30e){if(_0x38b30e&&_0x38b30e[_0xfb07('0x59')]===0x0){return db[_0xfb07('0x5a')]['create']({'name':_0x3cfb89[_0xfb07('0x2f')],'resourceId':_0x3cfb89['id'],'type':_0x38b30e[_0xfb07('0x2f')],'sectionId':_0x38b30e['id']},{})[_0xfb07('0x29')](function(){return _0x4d464e;});}else{return _0x4d464e;}})[_0xfb07('0x4b')](function(_0x4e597d){logger[_0xfb07('0x2d')](_0xfb07('0x5b'),_0x4e597d);throw _0x4e597d;});}return _0x4d464e;})[_0xfb07('0x29')](respondWithResult(_0x31cca8,0xc9))[_0xfb07('0x4b')](handleError(_0x31cca8,null));};exports[_0xfb07('0x28')]=function(_0x165628,_0x353b33){if(_0x165628[_0xfb07('0x53')]['id']){delete _0x165628[_0xfb07('0x53')]['id'];}return db[_0xfb07('0x48')]['find']({'where':{'id':_0x165628[_0xfb07('0x4d')]['id']}})['then'](handleEntityNotFound(_0x353b33,null))[_0xfb07('0x29')](saveUpdates(_0x165628[_0xfb07('0x53')],null))[_0xfb07('0x29')](respondWithResult(_0x353b33,null))[_0xfb07('0x4b')](handleError(_0x353b33,null));};exports[_0xfb07('0x2a')]=function(_0x7746bb,_0x1c76af){return db['Tag']['find']({'where':{'id':_0x7746bb['params']['id']}})[_0xfb07('0x29')](handleEntityNotFound(_0x1c76af,null))[_0xfb07('0x29')](removeEntity(_0x1c76af,null))[_0xfb07('0x4b')](handleError(_0x1c76af,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9887f88..bd44fcb 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 _0x8a56=['Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x51bc9b,_0x194e3a){var _0x48a0d4=function(_0x12ef9b){while(--_0x12ef9b){_0x51bc9b['push'](_0x51bc9b['shift']());}};_0x48a0d4(++_0x194e3a);}(_0x8a56,0xf0));var _0x68a5=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x8a56[_0x308213];return _0x2e1619;};'use strict';var _=require(_0x68a5('0x0'));var util=require(_0x68a5('0x1'));var logger=require(_0x68a5('0x2'))(_0x68a5('0x3'));var moment=require(_0x68a5('0x4'));var BPromise=require(_0x68a5('0x5'));var rp=require(_0x68a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68a5('0x7'));var config=require(_0x68a5('0x8'));var attributes=require(_0x68a5('0x9'));module[_0x68a5('0xa')]=function(_0x5da045,_0x3ac385){return _0x5da045[_0x68a5('0xb')](_0x68a5('0xc'),attributes,{'tableName':_0x68a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf074=['api','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util'];(function(_0x406767,_0x53f1ec){var _0x17472a=function(_0x5af63a){while(--_0x5af63a){_0x406767['push'](_0x406767['shift']());}};_0x17472a(++_0x53f1ec);}(_0xf074,0x134));var _0x4f07=function(_0x31aa84,_0x3bcc8b){_0x31aa84=_0x31aa84-0x0;var _0x2d9e3e=_0xf074[_0x31aa84];return _0x2d9e3e;};'use strict';var _=require(_0x4f07('0x0'));var util=require(_0x4f07('0x1'));var logger=require('../../config/logger')(_0x4f07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4f07('0x3'));var config=require(_0x4f07('0x4'));var attributes=require(_0x4f07('0x5'));module[_0x4f07('0x6')]=function(_0x236ef1,_0x58575b){return _0x236ef1[_0x4f07('0x7')](_0x4f07('0x8'),attributes,{'tableName':_0x4f07('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 9ba29ad..a01189b 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 _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3986ab,_0x1d2bbf){var _0x475d31=function(_0x219ba5){while(--_0x219ba5){_0x3986ab['push'](_0x3986ab['shift']());}};_0x475d31(++_0x1d2bbf);}(_0x0faf,0x132));var _0xf0fa=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x0faf[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file +var _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3c1ad3,_0x1f9e05){var _0x22d0c3=function(_0x312ffd){while(--_0x312ffd){_0x3c1ad3['push'](_0x3c1ad3['shift']());}};_0x22d0c3(++_0x1f9e05);}(_0x0e85,0x7c));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('Tag,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 672f324..8531578 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 366a617..6c3382e 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x246358,_0x3b7abf){var _0x313607=function(_0x96d391){while(--_0x96d391){_0x246358['push'](_0x246358['shift']());}};_0x313607(++_0x3b7abf);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4d068c,_0x5b173b){var _0x3dcf6f=function(_0x2e6be5){while(--_0x2e6be5){_0x4d068c['push'](_0x4d068c['shift']());}};_0x3dcf6f(++_0x5b173b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c6b5cd8..e1d0c04 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 _0x4c04=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./team.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','findAll','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','MailQueueId','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','findOne','isValidChannel','channel','ValidationError','toLowerCase','Queue','capitalize','Queues','Unknown\x20channel','add','removeQueues','remove','ids','isArray','Voice','Chat','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','interface','upsert','isNil','format','SIP/%s','all','addAgents','spread','Sms','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4c2241,_0x53e423){var _0x53ca72=function(_0x199817){while(--_0x199817){_0x4c2241['push'](_0x4c2241['shift']());}};_0x53ca72(++_0x53e423);}(_0x4c04,0x118));var _0x44c0=function(_0x19e112,_0x19c9a9){_0x19e112=_0x19e112-0x0;var _0x3ab604=_0x4c04[_0x19e112];return _0x3ab604;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44c0('0x0'));var zipdir=require(_0x44c0('0x1'));var jsonpatch=require(_0x44c0('0x2'));var rp=require(_0x44c0('0x3'));var moment=require(_0x44c0('0x4'));var BPromise=require(_0x44c0('0x5'));var Mustache=require(_0x44c0('0x6'));var util=require(_0x44c0('0x7'));var path=require(_0x44c0('0x8'));var sox=require(_0x44c0('0x9'));var csv=require('to-csv');var ejs=require(_0x44c0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44c0('0xb'));var squel=require(_0x44c0('0xc'));var crypto=require(_0x44c0('0xd'));var jsforce=require(_0x44c0('0xe'));var deskjs=require(_0x44c0('0xf'));var toCsv=require(_0x44c0('0x10'));var querystring=require('querystring');var Papa=require(_0x44c0('0x11'));var Redis=require(_0x44c0('0x12'));var authService=require(_0x44c0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x44c0('0x14'));var hardwareService=require(_0x44c0('0x15'));var logger=require(_0x44c0('0x16'))(_0x44c0('0x17'));var utils=require(_0x44c0('0x18'));var config=require(_0x44c0('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44c0('0x1a')],{'host':_0x44c0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44c0('0x1a')]));require(_0x44c0('0x1c'))[_0x44c0('0x1d')](socket);function respondWithStatusCode(_0x15552d,_0x4b47a1){_0x4b47a1=_0x4b47a1||0xcc;return function(_0x2e5cea){if(_0x2e5cea){return _0x15552d['sendStatus'](_0x4b47a1);}return _0x15552d[_0x44c0('0x1e')](_0x4b47a1)[_0x44c0('0x1f')]();};}function respondWithResult(_0x4244e9,_0x38dd00){_0x38dd00=_0x38dd00||0xc8;return function(_0x4c655c){if(_0x4c655c){return _0x4244e9['status'](_0x38dd00)['json'](_0x4c655c);}};}function respondWithFilteredResult(_0x30e33c,_0x17d9f6){return function(_0x49ab50){if(_0x49ab50){var _0x2f3116=typeof _0x17d9f6[_0x44c0('0x20')]===_0x44c0('0x21')&&typeof _0x17d9f6[_0x44c0('0x22')]==='undefined';var _0x1a37fe=_0x49ab50['count'];var _0x11d7f6=_0x2f3116?0x0:_0x17d9f6[_0x44c0('0x20')];var _0xcddd52=_0x2f3116?_0x49ab50[_0x44c0('0x23')]:_0x17d9f6[_0x44c0('0x20')]+_0x17d9f6[_0x44c0('0x22')];var _0x2d7bde;if(_0xcddd52>=_0x1a37fe){_0xcddd52=_0x1a37fe;_0x2d7bde=0xc8;}else{_0x2d7bde=0xce;}_0x30e33c['status'](_0x2d7bde);return _0x30e33c[_0x44c0('0x24')](_0x44c0('0x25'),_0x11d7f6+'-'+_0xcddd52+'/'+_0x1a37fe)['json'](_0x49ab50);}return null;};}function patchUpdates(_0x3e8b2b){return function(_0x3416cb){try{jsonpatch['apply'](_0x3416cb,_0x3e8b2b,!![]);}catch(_0x5ec9a7){return BPromise['reject'](_0x5ec9a7);}return _0x3416cb['save']();};}function saveUpdates(_0x4c7b8e,_0x595da4){return function(_0x329b74){if(_0x329b74){return _0x329b74[_0x44c0('0x26')](_0x4c7b8e)[_0x44c0('0x27')](function(_0x498f14){return _0x498f14;});}return null;};}function handleEntityNotFound(_0x549ef0,_0x408631){return function(_0x2e374c){if(!_0x2e374c){_0x549ef0[_0x44c0('0x28')](0x194);}return _0x2e374c;};}function handleError(_0x2421a6,_0x2ce255){_0x2ce255=_0x2ce255||0x1f4;return function(_0x2a9166){logger[_0x44c0('0x29')](_0x2a9166[_0x44c0('0x2a')]);if(_0x2a9166[_0x44c0('0x2b')]){delete _0x2a9166[_0x44c0('0x2b')];}_0x2421a6[_0x44c0('0x1e')](_0x2ce255)[_0x44c0('0x2c')](_0x2a9166);};}exports[_0x44c0('0x2d')]=function(_0x394df6,_0x129a26){var _0x3a3e26={},_0x47062b={},_0x44bdf2={'count':0x0,'rows':[]};var _0x202504=_[_0x44c0('0x2e')](db[_0x44c0('0x2f')][_0x44c0('0x30')],function(_0x25e05a){return{'name':_0x25e05a[_0x44c0('0x31')],'type':_0x25e05a[_0x44c0('0x32')][_0x44c0('0x33')]};});_0x47062b[_0x44c0('0x34')]=_[_0x44c0('0x2e')](_0x202504,_0x44c0('0x2b'));_0x47062b[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0x394df6[_0x44c0('0x35')]);_0x47062b[_0x44c0('0x37')]=_[_0x44c0('0x38')](_0x47062b[_0x44c0('0x34')],_0x47062b[_0x44c0('0x35')]);_0x3a3e26[_0x44c0('0x39')]=_[_0x44c0('0x38')](_0x47062b[_0x44c0('0x34')],qs[_0x44c0('0x3a')](_0x394df6[_0x44c0('0x35')][_0x44c0('0x3a')]));_0x3a3e26[_0x44c0('0x39')]=_0x3a3e26[_0x44c0('0x39')][_0x44c0('0x3b')]?_0x3a3e26[_0x44c0('0x39')]:_0x47062b[_0x44c0('0x34')];if(!_0x394df6['query'][_0x44c0('0x3c')](_0x44c0('0x3d'))){_0x3a3e26[_0x44c0('0x22')]=qs[_0x44c0('0x22')](_0x394df6[_0x44c0('0x35')][_0x44c0('0x22')]);_0x3a3e26[_0x44c0('0x20')]=qs[_0x44c0('0x20')](_0x394df6[_0x44c0('0x35')][_0x44c0('0x20')]);}_0x3a3e26[_0x44c0('0x3e')]=qs[_0x44c0('0x3f')](_0x394df6[_0x44c0('0x35')]['sort']);_0x3a3e26['where']=qs['filters'](_[_0x44c0('0x40')](_0x394df6[_0x44c0('0x35')],_0x47062b[_0x44c0('0x37')]),_0x202504);if(_0x394df6[_0x44c0('0x35')]['filter']){_0x3a3e26[_0x44c0('0x41')]=_[_0x44c0('0x42')](_0x3a3e26[_0x44c0('0x41')],{'$or':_[_0x44c0('0x2e')](_0x202504,function(_0x4acda7){if(_0x4acda7[_0x44c0('0x32')]!=='VIRTUAL'){var _0x5d3621={};_0x5d3621[_0x4acda7[_0x44c0('0x2b')]]={'$like':'%'+_0x394df6[_0x44c0('0x35')]['filter']+'%'};return _0x5d3621;}})});}_0x3a3e26=_[_0x44c0('0x42')]({},_0x3a3e26,_0x394df6[_0x44c0('0x43')]);var _0x2efc80={'where':_0x3a3e26[_0x44c0('0x41')]};return db[_0x44c0('0x2f')][_0x44c0('0x23')](_0x2efc80)['then'](function(_0x45208a){_0x44bdf2[_0x44c0('0x23')]=_0x45208a;if(_0x394df6[_0x44c0('0x35')][_0x44c0('0x44')]){_0x3a3e26[_0x44c0('0x45')]=[{'all':!![]}];}return db[_0x44c0('0x2f')][_0x44c0('0x46')](_0x3a3e26);})[_0x44c0('0x27')](function(_0x44caf5){_0x44bdf2['rows']=_0x44caf5;return _0x44bdf2;})[_0x44c0('0x27')](respondWithFilteredResult(_0x129a26,_0x3a3e26))[_0x44c0('0x47')](handleError(_0x129a26,null));};exports[_0x44c0('0x48')]=function(_0x1bf013,_0x3b1e35){var _0x3d2e0a={'raw':![],'where':{'id':_0x1bf013[_0x44c0('0x49')]['id']}},_0xa2264c={};_0xa2264c[_0x44c0('0x34')]=_['keys'](db[_0x44c0('0x2f')][_0x44c0('0x30')]);_0xa2264c[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0x1bf013[_0x44c0('0x35')]);_0xa2264c[_0x44c0('0x37')]=_[_0x44c0('0x38')](_0xa2264c[_0x44c0('0x34')],_0xa2264c[_0x44c0('0x35')]);_0x3d2e0a[_0x44c0('0x39')]=_[_0x44c0('0x38')](_0xa2264c['model'],qs[_0x44c0('0x3a')](_0x1bf013[_0x44c0('0x35')][_0x44c0('0x3a')]));_0x3d2e0a[_0x44c0('0x39')]=_0x3d2e0a[_0x44c0('0x39')][_0x44c0('0x3b')]?_0x3d2e0a[_0x44c0('0x39')]:_0xa2264c[_0x44c0('0x34')];if(_0x1bf013[_0x44c0('0x35')]['includeAll']){_0x3d2e0a['include']=[{'all':!![]}];}_0x3d2e0a=_[_0x44c0('0x42')]({},_0x3d2e0a,_0x1bf013[_0x44c0('0x43')]);return db['Team'][_0x44c0('0x4a')](_0x3d2e0a)[_0x44c0('0x27')](handleEntityNotFound(_0x3b1e35,null))[_0x44c0('0x27')](respondWithResult(_0x3b1e35,null))[_0x44c0('0x47')](handleError(_0x3b1e35,null));};exports[_0x44c0('0x4b')]=function(_0x15b459,_0xbdc98e){return db[_0x44c0('0x2f')]['create'](_0x15b459['body'],{})[_0x44c0('0x27')](function(_0x19f47e){var _0x48b077=_0x15b459[_0x44c0('0x4c')][_0x44c0('0x4d')]({'plain':!![]});if(!_0x48b077)throw new Error(_0x44c0('0x4e'));if(_0x48b077['role']==='user'){var _0x60f04b=_0x19f47e['get']({'plain':!![]});var _0x5574aa=_0x44c0('0x4f');return db['UserProfileSection'][_0x44c0('0x4a')]({'where':{'name':_0x5574aa,'userProfileId':_0x48b077['userProfileId']},'raw':!![]})[_0x44c0('0x27')](function(_0x2aebac){if(_0x2aebac&&_0x2aebac[_0x44c0('0x50')]===0x0){return db[_0x44c0('0x51')][_0x44c0('0x4b')]({'name':_0x60f04b[_0x44c0('0x2b')],'resourceId':_0x60f04b['id'],'type':_0x2aebac['name'],'sectionId':_0x2aebac['id']},{})[_0x44c0('0x27')](function(){return _0x19f47e;});}else{return _0x19f47e;}})[_0x44c0('0x47')](function(_0x4cbf71){logger['error'](_0x44c0('0x52'),_0x4cbf71);throw _0x4cbf71;});}return _0x19f47e;})['then'](respondWithResult(_0xbdc98e,0xc9))[_0x44c0('0x47')](handleError(_0xbdc98e,null));};exports[_0x44c0('0x26')]=function(_0x15632b,_0x35ef02){if(_0x15632b[_0x44c0('0x53')]['id']){delete _0x15632b['body']['id'];}return db[_0x44c0('0x2f')][_0x44c0('0x4a')]({'where':{'id':_0x15632b[_0x44c0('0x49')]['id']}})[_0x44c0('0x27')](handleEntityNotFound(_0x35ef02,null))[_0x44c0('0x27')](saveUpdates(_0x15632b[_0x44c0('0x53')],null))[_0x44c0('0x27')](respondWithResult(_0x35ef02,null))['catch'](handleError(_0x35ef02,null));};exports[_0x44c0('0x54')]=function(_0x360724,_0x3acb0c){var _0x30e424=_0x360724['params']['id'];var _0x5832c6=[];return db[_0x44c0('0x55')][_0x44c0('0x56')](function(_0x2090f4){var _0x29b9b7='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x30e424;return db[_0x44c0('0x55')]['query'](_0x29b9b7,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')]['SELECT'],'raw':!![],'transaction':_0x2090f4})[_0x44c0('0x27')](function(_0x3678ab){_0x5832c6=_[_0x44c0('0x2e')](_0x3678ab,function(_0x1d5cda){return Number(_0x1d5cda[_0x44c0('0x59')]);});})['then'](function(){var _0x15497f=_0x44c0('0x5a')+_0x30e424;return db[_0x44c0('0x55')][_0x44c0('0x35')](_0x15497f,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})['then'](function(_0x4516b1){var _0x51df18=_[_0x44c0('0x2e')](_0x4516b1,function(_0xa1973){return Number(_0xa1973[_0x44c0('0x5c')]);});return db['UserVoiceQueue'][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'VoiceQueueId':{'$in':_0x51df18}},'transaction':_0x2090f4});})['then'](function(){var _0x2f7e88='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x30e424;return db[_0x44c0('0x55')]['query'](_0x2f7e88,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')]['SELECT'],'raw':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x151715){var _0xebaa11=_[_0x44c0('0x2e')](_0x151715,function(_0xaad9e6){return Number(_0xaad9e6[_0x44c0('0x5d')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x5832c6},'MailQueueId':{'$in':_0xebaa11}},'transaction':_0x2090f4});})['then'](function(){var _0x1f2ae8='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x30e424;return db[_0x44c0('0x55')]['query'](_0x1f2ae8,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x25813f){var _0x317a9e=_['map'](_0x25813f,function(_0x39b4b0){return Number(_0x39b4b0[_0x44c0('0x5e')]);});return db[_0x44c0('0x5f')][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'SmsQueueId':{'$in':_0x317a9e}},'transaction':_0x2090f4});})[_0x44c0('0x27')](function(){var _0x5c285e='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x30e424;return db['sequelize'][_0x44c0('0x35')](_0x5c285e,{'type':db['Sequelize']['QueryTypes'][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x2c95c4){var _0x435ee8=_[_0x44c0('0x2e')](_0x2c95c4,function(_0x322553){return Number(_0x322553['ChatQueueId']);});return db[_0x44c0('0x60')][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'ChatQueueId':{'$in':_0x435ee8}},'transaction':_0x2090f4});})[_0x44c0('0x27')](function(){var _0x212a7b=_0x44c0('0x61')+_0x30e424;return db[_0x44c0('0x55')][_0x44c0('0x35')](_0x212a7b,{'type':db[_0x44c0('0x57')]['QueryTypes'][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x4caba1){var _0x4119ea=_[_0x44c0('0x2e')](_0x4caba1,function(_0x456091){return Number(_0x456091['FaxQueueId']);});return db[_0x44c0('0x62')]['destroy']({'where':{'UserId':{'$in':_0x5832c6},'FaxQueueId':{'$in':_0x4119ea}},'transaction':_0x2090f4});})[_0x44c0('0x27')](function(){var _0x346fef=_0x44c0('0x63')+_0x30e424;return db[_0x44c0('0x55')][_0x44c0('0x35')](_0x346fef,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})['then'](function(_0x3ef857){var _0x182824=_[_0x44c0('0x2e')](_0x3ef857,function(_0x592b05){return Number(_0x592b05[_0x44c0('0x64')]);});return db['UserOpenchannelQueue'][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'OpenchannelQueueId':{'$in':_0x182824}},'transaction':_0x2090f4});})['then'](function(){var _0x1e2df5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x30e424;return db[_0x44c0('0x55')][_0x44c0('0x35')](_0x1e2df5,{'type':db[_0x44c0('0x57')][_0x44c0('0x58')][_0x44c0('0x5b')],'raw':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x471077){var _0x1de65a=_[_0x44c0('0x2e')](_0x471077,function(_0x5b8d7c){return Number(_0x5b8d7c[_0x44c0('0x65')]);});return db[_0x44c0('0x66')][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'WhatsappQueueId':{'$in':_0x1de65a}},'transaction':_0x2090f4});})['then'](function(){return db[_0x44c0('0x67')][_0x44c0('0x4a')]({'where':{'TeamId':_0x30e424}});})[_0x44c0('0x27')](function(_0x46fee9){if(_0x46fee9===null){return;}return db[_0x44c0('0x68')][_0x44c0('0x54')]({'where':{'UserId':{'$in':_0x5832c6},'VoicePrefixId':_0x46fee9['VoicePrefixId']},'transaction':_0x2090f4});})[_0x44c0('0x27')](function(){return db[_0x44c0('0x2f')][_0x44c0('0x54')]({'where':{'id':_0x30e424},'cascade':!![],'transaction':_0x2090f4});})[_0x44c0('0x27')](function(_0x3a4117){if(_0x3a4117===0x0){_0x3acb0c['sendStatus'](0x194);}else{return db[_0x44c0('0x51')][_0x44c0('0x54')]({'where':{'type':'Teams','resourceId':_0x30e424},'cascade':!![],'transaction':_0x2090f4})[_0x44c0('0x27')](function(){_0x3acb0c[_0x44c0('0x1e')](0xcc)[_0x44c0('0x1f')]();});}})[_0x44c0('0x47')](function(_0x2c30d9){_0x3acb0c[_0x44c0('0x1e')](0x1f4)[_0x44c0('0x2c')](_0x2c30d9);});});};exports['getQueues']=function(_0x593d5b,_0xcccbf4,_0x1e5b3b){return db['Team'][_0x44c0('0x69')]({'where':{'id':_0x593d5b[_0x44c0('0x49')]['id']}})[_0x44c0('0x27')](handleEntityNotFound(_0xcccbf4,null))[_0x44c0('0x27')](function(_0x153c13){if(!_0x593d5b[_0x44c0('0x35')]['channel']||!utils[_0x44c0('0x6a')](_0x593d5b[_0x44c0('0x35')][_0x44c0('0x6b')])){throw new db[(_0x44c0('0x57'))][(_0x44c0('0x6c'))]('Unknown\x20channel');}var _0x351e4f={};var _0xe05e16={};_0xe05e16['model']=_['keys'](db[_['capitalize'](_0x593d5b[_0x44c0('0x35')][_0x44c0('0x6b')][_0x44c0('0x6d')]())+_0x44c0('0x6e')][_0x44c0('0x30')]);_0xe05e16[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0x593d5b[_0x44c0('0x35')]);_0xe05e16['filters']=_[_0x44c0('0x38')](_0xe05e16['model'],_0xe05e16[_0x44c0('0x35')]);_0x351e4f[_0x44c0('0x39')]=_[_0x44c0('0x38')](_0xe05e16[_0x44c0('0x34')],qs[_0x44c0('0x3a')](_0x593d5b[_0x44c0('0x35')][_0x44c0('0x3a')]));_0x351e4f[_0x44c0('0x39')]=_0x351e4f[_0x44c0('0x39')][_0x44c0('0x3b')]?_0x351e4f[_0x44c0('0x39')]:_0xe05e16[_0x44c0('0x34')];_0x351e4f[_0x44c0('0x22')]=qs[_0x44c0('0x22')](_0x593d5b[_0x44c0('0x35')]['limit']);_0x351e4f['offset']=qs['offset'](_0x593d5b[_0x44c0('0x35')]['offset']);_0x351e4f[_0x44c0('0x3e')]=qs[_0x44c0('0x3f')](_0x593d5b[_0x44c0('0x35')][_0x44c0('0x3f')]);_0x351e4f[_0x44c0('0x41')]=qs[_0x44c0('0x37')](_[_0x44c0('0x40')](_0x593d5b[_0x44c0('0x35')],_0xe05e16[_0x44c0('0x37')]));_0x351e4f=_[_0x44c0('0x42')]({},_0x351e4f,_0x593d5b[_0x44c0('0x43')]);return _0x153c13[_0x44c0('0x4d')+_[_0x44c0('0x6f')](_0x593d5b[_0x44c0('0x35')][_0x44c0('0x6b')][_0x44c0('0x6d')]())+_0x44c0('0x70')](_0x351e4f);})[_0x44c0('0x27')](respondWithResult(_0xcccbf4,null))[_0x44c0('0x47')](handleError(_0xcccbf4,null));};exports['addQueues']=function(_0x104759,_0xbeb4c3,_0x5e48aa){return db[_0x44c0('0x2f')]['findOne']({'where':{'id':_0x104759['params']['id']}})['then'](function(_0xabe43d){if(_0xabe43d){if(!_0x104759[_0x44c0('0x53')][_0x44c0('0x6b')]||!utils[_0x44c0('0x6a')](_0x104759['body'][_0x44c0('0x6b')])){throw new db[(_0x44c0('0x57'))][(_0x44c0('0x6c'))](_0x44c0('0x71'));}return _0xabe43d[_0x44c0('0x72')+_['capitalize'](_0x104759[_0x44c0('0x53')][_0x44c0('0x6b')]['toLowerCase']())+_0x44c0('0x70')](_0x104759[_0x44c0('0x53')]['ids']);}return null;})['then'](handleEntityNotFound(_0xbeb4c3,null))[_0x44c0('0x27')](respondWithStatusCode(_0xbeb4c3,null))[_0x44c0('0x47')](handleError(_0xbeb4c3,null));};exports[_0x44c0('0x73')]=function(_0x2a98df,_0x52d0ef,_0x10ff1d){return db['Team'][_0x44c0('0x69')]({'where':{'id':_0x2a98df[_0x44c0('0x49')]['id']}})['then'](function(_0x5841aa){if(_0x5841aa){if(!_0x2a98df[_0x44c0('0x35')][_0x44c0('0x6b')]||!utils[_0x44c0('0x6a')](_0x2a98df[_0x44c0('0x35')]['channel'])){throw new db['Sequelize'][(_0x44c0('0x6c'))](_0x44c0('0x71'));}return _0x5841aa[_0x44c0('0x74')+_[_0x44c0('0x6f')](_0x2a98df[_0x44c0('0x35')][_0x44c0('0x6b')][_0x44c0('0x6d')]())+_0x44c0('0x70')](_0x2a98df[_0x44c0('0x35')][_0x44c0('0x75')]);}return null;})[_0x44c0('0x27')](handleEntityNotFound(_0x52d0ef,null))[_0x44c0('0x27')](respondWithStatusCode(_0x52d0ef,null))['catch'](handleError(_0x52d0ef,null));};exports['addAgents']=function(_0x3b1aa0,_0x17e4b2){var _0x4b42bf=_[_0x44c0('0x76')](_0x3b1aa0['body'][_0x44c0('0x75')])?_0x3b1aa0[_0x44c0('0x53')][_0x44c0('0x75')]:[_0x3b1aa0[_0x44c0('0x53')][_0x44c0('0x75')]];var _0x4b5562=_0x3b1aa0['params']['id'];return db['Team']['find']({'where':{'id':_0x4b5562}})['then'](handleEntityNotFound(_0x17e4b2,null))[_0x44c0('0x27')](function(_0x423850){if(_0x423850){var _0x1361db=[_0x44c0('0x77'),_0x44c0('0x78'),'Mail','Sms',_0x44c0('0x79'),_0x44c0('0x7a'),_0x44c0('0x7b')];return db['sequelize'][_0x44c0('0x56')](function(_0x2c9ae1){var _0x221953=_[_0x44c0('0x2e')](_0x1361db,function(_0x37ba2d){var _0x1fa31d={'attributes':['id','name']};if(_0x37ba2d===_0x44c0('0x77')){_0x1fa31d[_0x44c0('0x7c')]={'attributes':[_0x44c0('0x7d')]};}return _0x423850['get'+_0x37ba2d+_0x44c0('0x70')](_0x1fa31d)['then'](function(_0x3b231b){var _0x40746f=_[_0x44c0('0x2e')](_0x3b231b,function(_0x2d09ee){var _0x4d7991=_[_0x44c0('0x2e')](_0x4b42bf,function(_0x1d54b7){var _0x45cddb={'where':{'UserId':_0x1d54b7,[_0x37ba2d+_0x44c0('0x7e')]:_0x2d09ee['id']},'transaction':_0x2c9ae1};if(_0x37ba2d==='Voice'){_0x45cddb[_0x44c0('0x7f')]={'penalty':_0x2d09ee[_0x44c0('0x80')]['penalty']};}return db[_0x44c0('0x81')+_0x37ba2d+_0x44c0('0x6e')][_0x44c0('0x82')](_0x45cddb)[_0x44c0('0x27')](function(){socket[_0x44c0('0x83')]('user'+_0x37ba2d+_0x44c0('0x84'),{'UserId':_0x1d54b7,[_0x37ba2d+_0x44c0('0x7e')]:_0x2d09ee['id']});if(_0x37ba2d!==_0x44c0('0x77')){return;}return db[_0x44c0('0x81')][_0x44c0('0x46')]({'where':{'id':_0x4b42bf,'online':0x1},'attributes':['id','name','online',_0x44c0('0x85'),_0x44c0('0x86')],'raw':!![]})['then'](function(_0x578b50){var _0x2be888=_[_0x44c0('0x2e')](_0x578b50,function(_0x182864){return db['UserVoiceQueueRt'][_0x44c0('0x87')]({'membername':_0x182864[_0x44c0('0x2b')],'UserId':_0x182864['id'],'queue_name':_0x2d09ee[_0x44c0('0x2b')],'VoiceQueueId':_0x2d09ee['id'],'interface':_[_0x44c0('0x88')](_0x182864[_0x44c0('0x86')])?util[_0x44c0('0x89')](_0x44c0('0x8a'),_0x182864[_0x44c0('0x2b')]):_0x182864['interface'],'paused':_0x182864[_0x44c0('0x85')]||![],'penalty':_0x2d09ee[_0x44c0('0x80')]['penalty']},{'transaction':_0x2c9ae1});});return Promise['all'](_0x2be888);});});});return Promise[_0x44c0('0x8b')](_0x4d7991);});return Promise[_0x44c0('0x8b')](_0x40746f);})[_0x44c0('0x27')](function(){return db[_0x44c0('0x67')]['findOne']({'where':{'teamId':_0x4b5562}})['then'](function(_0x59e97c){if(_0x59e97c){var _0x21263b=_['map'](_0x4b42bf,function(_0x3fd8ef){db[_0x44c0('0x68')][_0x44c0('0x87')]({'UserId':_0x3fd8ef,'VoicePrefixId':_0x59e97c['VoicePrefixId']});});return Promise[_0x44c0('0x8b')](_0x21263b);}});});});return Promise[_0x44c0('0x8b')](_0x221953)[_0x44c0('0x27')](function(){return _0x423850[_0x44c0('0x8c')](_0x4b42bf,{'transaction':_0x2c9ae1})[_0x44c0('0x8d')](function(_0x432b90){return _0x432b90;});});});}})[_0x44c0('0x27')](respondWithResult(_0x17e4b2,null))[_0x44c0('0x47')](handleError(_0x17e4b2,null));};exports['removeAgents']=function(_0x51f262,_0x3fe97e){var _0x216b8f=_[_0x44c0('0x76')](_0x51f262[_0x44c0('0x35')][_0x44c0('0x75')])?_0x51f262[_0x44c0('0x35')][_0x44c0('0x75')]:[_0x51f262[_0x44c0('0x35')][_0x44c0('0x75')]];var _0x2688c9=_0x51f262[_0x44c0('0x49')]['id'];return db[_0x44c0('0x2f')][_0x44c0('0x4a')]({'where':{'id':_0x2688c9}})[_0x44c0('0x27')](handleEntityNotFound(_0x3fe97e,null))['then'](function(_0x192c66){if(_0x192c66){var _0x503bd0=['Voice','Chat','Mail',_0x44c0('0x8e'),_0x44c0('0x79'),_0x44c0('0x7a'),_0x44c0('0x7b')];return db[_0x44c0('0x55')][_0x44c0('0x56')](function(_0x1c64e2){var _0x243ce2=_[_0x44c0('0x2e')](_0x503bd0,function(_0x1a1f95){var _0x19b653={'attributes':['id','name']};return _0x192c66['get'+_0x1a1f95+_0x44c0('0x70')](_0x19b653)[_0x44c0('0x27')](function(_0x32ef67){var _0x18fda2=_[_0x44c0('0x2e')](_0x32ef67,function(_0x497297){return _0x497297['removeAgents'](_0x216b8f,{'transaction':_0x1c64e2})[_0x44c0('0x27')](function(){var _0x545e3f=_[_0x44c0('0x2e')](_0x216b8f,function(_0x8b1d2a){socket['emit'](_0x44c0('0x4c')+_0x1a1f95+_0x44c0('0x8f'),{'UserId':Number(_0x8b1d2a),[_0x1a1f95+_0x44c0('0x7e')]:_0x497297['id']});if(_0x1a1f95!==_0x44c0('0x77')){return;}return db[_0x44c0('0x90')][_0x44c0('0x54')]({'where':{'VoiceQueueId':_0x497297['id'],'UserId':_0x8b1d2a},'transaction':_0x1c64e2});});return Promise[_0x44c0('0x8b')](_0x545e3f);});});return Promise[_0x44c0('0x8b')](_0x18fda2);});});return Promise[_0x44c0('0x8b')](_0x243ce2)[_0x44c0('0x27')](function(){return _0x192c66['removeAgents'](_0x216b8f,{'transaction':_0x1c64e2});})[_0x44c0('0x27')](function(){return db['TeamVoicePrefix'][_0x44c0('0x69')]({'where':{'teamId':_0x2688c9}})['then'](function(_0x2b418e){if(_0x2b418e){var _0x9cf6a9=_['map'](_0x216b8f,function(_0x59909b){db[_0x44c0('0x68')][_0x44c0('0x54')]({'where':{'UserId':_0x59909b,'VoicePrefixId':_0x2b418e[_0x44c0('0x91')]}});});return Promise[_0x44c0('0x8b')](_0x9cf6a9);}});});});}})[_0x44c0('0x27')](respondWithStatusCode(_0x3fe97e,null))['catch'](handleError(_0x3fe97e,null));};exports[_0x44c0('0x92')]=function(_0x2da532,_0xd17d05,_0x5554b8){var _0xb81de3={};var _0x230d71={};var _0x446b03;var _0x4ff3d2;return db[_0x44c0('0x2f')][_0x44c0('0x69')]({'where':{'id':_0x2da532[_0x44c0('0x49')]['id']}})[_0x44c0('0x27')](handleEntityNotFound(_0xd17d05,null))[_0x44c0('0x27')](function(_0x19896f){if(_0x19896f){_0x446b03=_0x19896f;_0x230d71[_0x44c0('0x34')]=_[_0x44c0('0x36')](db[_0x44c0('0x81')][_0x44c0('0x30')]);_0x230d71[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0x2da532['query']);_0x230d71[_0x44c0('0x37')]=_[_0x44c0('0x38')](_0x230d71[_0x44c0('0x34')],_0x230d71[_0x44c0('0x35')]);_0xb81de3[_0x44c0('0x39')]=_[_0x44c0('0x38')](_0x230d71['model'],qs[_0x44c0('0x3a')](_0x2da532[_0x44c0('0x35')][_0x44c0('0x3a')]));_0xb81de3[_0x44c0('0x39')]=_0xb81de3[_0x44c0('0x39')][_0x44c0('0x3b')]?_0xb81de3[_0x44c0('0x39')]:_0x230d71['model'];_0xb81de3[_0x44c0('0x3e')]=qs['sort'](_0x2da532[_0x44c0('0x35')]['sort']);_0xb81de3[_0x44c0('0x41')]=qs[_0x44c0('0x37')](_['pick'](_0x2da532['query'],_0x230d71[_0x44c0('0x37')]));if(_0x2da532['query'][_0x44c0('0x93')]){_0xb81de3[_0x44c0('0x41')]=_[_0x44c0('0x42')](_0xb81de3['where'],{'$or':_[_0x44c0('0x2e')](_0xb81de3[_0x44c0('0x39')],function(_0x1007a7){var _0x1774cf={};_0x1774cf[_0x1007a7]={'$like':'%'+_0x2da532[_0x44c0('0x35')][_0x44c0('0x93')]+'%'};return _0x1774cf;})});}_0xb81de3=_[_0x44c0('0x42')]({},_0xb81de3,_0x2da532['options']);return _0x446b03['getAgents'](_0xb81de3);}})['then'](function(_0x29b599){if(_0x29b599){_0x4ff3d2=_0x29b599[_0x44c0('0x3b')];if(!_0x2da532[_0x44c0('0x35')][_0x44c0('0x3c')](_0x44c0('0x3d'))){_0xb81de3[_0x44c0('0x22')]=qs[_0x44c0('0x22')](_0x2da532[_0x44c0('0x35')]['limit']);_0xb81de3['offset']=qs[_0x44c0('0x20')](_0x2da532[_0x44c0('0x35')]['offset']);}return _0x446b03[_0x44c0('0x92')](_0xb81de3);}})['then'](function(_0x2f2481){if(_0x2f2481){return _0x2f2481?{'count':_0x4ff3d2,'rows':_0x2f2481}:null;}})['then'](respondWithResult(_0xd17d05,null))['catch'](handleError(_0xd17d05,null));}; \ No newline at end of file +var _0xa2ac=['FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','send','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','capitalize','Queues','addQueues','add','toLowerCase','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','transaction','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','removeAgents','Openchannel','Whatsapp','emit','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','fields','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x2a2ac1,_0x484843){var _0x4e094c=function(_0x29cdee){while(--_0x29cdee){_0x2a2ac1['push'](_0x2a2ac1['shift']());}};_0x4e094c(++_0x484843);}(_0xa2ac,0xcf));var _0xca2a=function(_0x2b63f8,_0x803b17){_0x2b63f8=_0x2b63f8-0x0;var _0x5e5b93=_0xa2ac[_0x2b63f8];return _0x5e5b93;};'use strict';var emlformat=require(_0xca2a('0x0'));var rimraf=require(_0xca2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca2a('0x2'));var moment=require(_0xca2a('0x3'));var BPromise=require(_0xca2a('0x4'));var Mustache=require(_0xca2a('0x5'));var util=require(_0xca2a('0x6'));var path=require(_0xca2a('0x7'));var sox=require(_0xca2a('0x8'));var csv=require(_0xca2a('0x9'));var ejs=require(_0xca2a('0xa'));var fs=require('fs');var fs_extra=require(_0xca2a('0xb'));var _=require(_0xca2a('0xc'));var squel=require(_0xca2a('0xd'));var crypto=require(_0xca2a('0xe'));var jsforce=require(_0xca2a('0xf'));var deskjs=require(_0xca2a('0x10'));var toCsv=require(_0xca2a('0x9'));var querystring=require(_0xca2a('0x11'));var Papa=require('papaparse');var Redis=require(_0xca2a('0x12'));var authService=require(_0xca2a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca2a('0x14'));var logger=require(_0xca2a('0x15'))(_0xca2a('0x16'));var utils=require(_0xca2a('0x17'));var config=require(_0xca2a('0x18'));var licenseUtil=require(_0xca2a('0x19'));var db=require(_0xca2a('0x1a'))['db'];config[_0xca2a('0x1b')]=_[_0xca2a('0x1c')](config[_0xca2a('0x1b')],{'host':_0xca2a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca2a('0x1b')]));require(_0xca2a('0x1e'))['register'](socket);function respondWithStatusCode(_0x454929,_0x413830){_0x413830=_0x413830||0xcc;return function(_0x5988ca){if(_0x5988ca){return _0x454929[_0xca2a('0x1f')](_0x413830);}return _0x454929['status'](_0x413830)[_0xca2a('0x20')]();};}function respondWithResult(_0x3eae7c,_0x22f8a9){_0x22f8a9=_0x22f8a9||0xc8;return function(_0x1304e0){if(_0x1304e0){return _0x3eae7c[_0xca2a('0x21')](_0x22f8a9)[_0xca2a('0x22')](_0x1304e0);}};}function respondWithFilteredResult(_0x5a4f16,_0x5eedd3){return function(_0x1a03fa){if(_0x1a03fa){var _0x24129e=typeof _0x5eedd3['offset']===_0xca2a('0x23')&&typeof _0x5eedd3[_0xca2a('0x24')]===_0xca2a('0x23');var _0x12e62c=_0x1a03fa[_0xca2a('0x25')];var _0x2776ab=_0x24129e?0x0:_0x5eedd3[_0xca2a('0x26')];var _0x17fb1a=_0x24129e?_0x1a03fa[_0xca2a('0x25')]:_0x5eedd3[_0xca2a('0x26')]+_0x5eedd3[_0xca2a('0x24')];var _0x2e0bd2;if(_0x17fb1a>=_0x12e62c){_0x17fb1a=_0x12e62c;_0x2e0bd2=0xc8;}else{_0x2e0bd2=0xce;}_0x5a4f16[_0xca2a('0x21')](_0x2e0bd2);return _0x5a4f16[_0xca2a('0x27')](_0xca2a('0x28'),_0x2776ab+'-'+_0x17fb1a+'/'+_0x12e62c)[_0xca2a('0x22')](_0x1a03fa);}return null;};}function patchUpdates(_0x312bda){return function(_0x2745ea){try{jsonpatch[_0xca2a('0x29')](_0x2745ea,_0x312bda,!![]);}catch(_0x14de04){return BPromise['reject'](_0x14de04);}return _0x2745ea[_0xca2a('0x2a')]();};}function saveUpdates(_0x4136f0,_0x18817d){return function(_0x5b322d){if(_0x5b322d){return _0x5b322d[_0xca2a('0x2b')](_0x4136f0)[_0xca2a('0x2c')](function(_0x499943){return _0x499943;});}return null;};}function handleEntityNotFound(_0x1bc9b0,_0x3a2f6b){return function(_0x14ccd9){if(!_0x14ccd9){_0x1bc9b0[_0xca2a('0x1f')](0x194);}return _0x14ccd9;};}function handleError(_0x505e24,_0x3ad2fd){_0x3ad2fd=_0x3ad2fd||0x1f4;return function(_0x245aee){logger[_0xca2a('0x2d')](_0x245aee[_0xca2a('0x2e')]);if(_0x245aee[_0xca2a('0x2f')]){delete _0x245aee['name'];}_0x505e24[_0xca2a('0x21')](_0x3ad2fd)['send'](_0x245aee);};}exports['index']=function(_0x40f3b4,_0x42f06c){var _0x5b80e1={},_0x220e1a={},_0x4d486b={'count':0x0,'rows':[]};var _0x30103c=_[_0xca2a('0x30')](db[_0xca2a('0x31')][_0xca2a('0x32')],function(_0x372777){return{'name':_0x372777[_0xca2a('0x33')],'type':_0x372777[_0xca2a('0x34')][_0xca2a('0x35')]};});_0x220e1a[_0xca2a('0x36')]=_[_0xca2a('0x30')](_0x30103c,'name');_0x220e1a['query']=_[_0xca2a('0x37')](_0x40f3b4[_0xca2a('0x38')]);_0x220e1a[_0xca2a('0x39')]=_[_0xca2a('0x3a')](_0x220e1a[_0xca2a('0x36')],_0x220e1a[_0xca2a('0x38')]);_0x5b80e1['attributes']=_[_0xca2a('0x3a')](_0x220e1a[_0xca2a('0x36')],qs['fields'](_0x40f3b4[_0xca2a('0x38')]['fields']));_0x5b80e1['attributes']=_0x5b80e1[_0xca2a('0x3b')][_0xca2a('0x3c')]?_0x5b80e1[_0xca2a('0x3b')]:_0x220e1a[_0xca2a('0x36')];if(!_0x40f3b4[_0xca2a('0x38')]['hasOwnProperty'](_0xca2a('0x3d'))){_0x5b80e1[_0xca2a('0x24')]=qs[_0xca2a('0x24')](_0x40f3b4[_0xca2a('0x38')][_0xca2a('0x24')]);_0x5b80e1[_0xca2a('0x26')]=qs[_0xca2a('0x26')](_0x40f3b4[_0xca2a('0x38')][_0xca2a('0x26')]);}_0x5b80e1[_0xca2a('0x3e')]=qs[_0xca2a('0x3f')](_0x40f3b4[_0xca2a('0x38')][_0xca2a('0x3f')]);_0x5b80e1[_0xca2a('0x40')]=qs[_0xca2a('0x39')](_[_0xca2a('0x41')](_0x40f3b4[_0xca2a('0x38')],_0x220e1a[_0xca2a('0x39')]),_0x30103c);if(_0x40f3b4['query'][_0xca2a('0x42')]){_0x5b80e1[_0xca2a('0x40')]=_[_0xca2a('0x43')](_0x5b80e1[_0xca2a('0x40')],{'$or':_[_0xca2a('0x30')](_0x30103c,function(_0x39a8aa){if(_0x39a8aa[_0xca2a('0x34')]!==_0xca2a('0x44')){var _0x5b6ca7={};_0x5b6ca7[_0x39a8aa[_0xca2a('0x2f')]]={'$like':'%'+_0x40f3b4[_0xca2a('0x38')]['filter']+'%'};return _0x5b6ca7;}})});}_0x5b80e1=_[_0xca2a('0x43')]({},_0x5b80e1,_0x40f3b4[_0xca2a('0x45')]);var _0x25cd8f={'where':_0x5b80e1[_0xca2a('0x40')]};return db[_0xca2a('0x31')][_0xca2a('0x25')](_0x25cd8f)['then'](function(_0x46bd93){_0x4d486b[_0xca2a('0x25')]=_0x46bd93;if(_0x40f3b4['query'][_0xca2a('0x46')]){_0x5b80e1['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x5b80e1);})[_0xca2a('0x2c')](function(_0x5ab976){_0x4d486b['rows']=_0x5ab976;return _0x4d486b;})[_0xca2a('0x2c')](respondWithFilteredResult(_0x42f06c,_0x5b80e1))[_0xca2a('0x47')](handleError(_0x42f06c,null));};exports['show']=function(_0x12bcf8,_0x1a86f5){var _0x456736={'raw':![],'where':{'id':_0x12bcf8[_0xca2a('0x48')]['id']}},_0x1be037={};_0x1be037[_0xca2a('0x36')]=_[_0xca2a('0x37')](db[_0xca2a('0x31')][_0xca2a('0x32')]);_0x1be037[_0xca2a('0x38')]=_[_0xca2a('0x37')](_0x12bcf8['query']);_0x1be037[_0xca2a('0x39')]=_[_0xca2a('0x3a')](_0x1be037[_0xca2a('0x36')],_0x1be037['query']);_0x456736[_0xca2a('0x3b')]=_[_0xca2a('0x3a')](_0x1be037[_0xca2a('0x36')],qs['fields'](_0x12bcf8[_0xca2a('0x38')][_0xca2a('0x49')]));_0x456736[_0xca2a('0x3b')]=_0x456736[_0xca2a('0x3b')][_0xca2a('0x3c')]?_0x456736[_0xca2a('0x3b')]:_0x1be037[_0xca2a('0x36')];if(_0x12bcf8[_0xca2a('0x38')][_0xca2a('0x46')]){_0x456736[_0xca2a('0x4a')]=[{'all':!![]}];}_0x456736=_[_0xca2a('0x43')]({},_0x456736,_0x12bcf8['options']);return db[_0xca2a('0x31')]['find'](_0x456736)[_0xca2a('0x2c')](handleEntityNotFound(_0x1a86f5,null))['then'](respondWithResult(_0x1a86f5,null))['catch'](handleError(_0x1a86f5,null));};exports[_0xca2a('0x4b')]=function(_0x2ab44e,_0x3a5288){return db['Team'][_0xca2a('0x4b')](_0x2ab44e[_0xca2a('0x4c')],{})['then'](function(_0x446f52){var _0x363b89=_0x2ab44e[_0xca2a('0x4d')][_0xca2a('0x4e')]({'plain':!![]});if(!_0x363b89)throw new Error(_0xca2a('0x4f'));if(_0x363b89['role']===_0xca2a('0x4d')){var _0x26e94e=_0x446f52[_0xca2a('0x4e')]({'plain':!![]});var _0x15c741=_0xca2a('0x50');return db[_0xca2a('0x51')][_0xca2a('0x52')]({'where':{'name':_0x15c741,'userProfileId':_0x363b89['userProfileId']},'raw':!![]})[_0xca2a('0x2c')](function(_0x420114){if(_0x420114&&_0x420114['autoAssociation']===0x0){return db['UserProfileResource'][_0xca2a('0x4b')]({'name':_0x26e94e['name'],'resourceId':_0x26e94e['id'],'type':_0x420114['name'],'sectionId':_0x420114['id']},{})[_0xca2a('0x2c')](function(){return _0x446f52;});}else{return _0x446f52;}})[_0xca2a('0x47')](function(_0x5dab20){logger[_0xca2a('0x2d')](_0xca2a('0x53'),_0x5dab20);throw _0x5dab20;});}return _0x446f52;})[_0xca2a('0x2c')](respondWithResult(_0x3a5288,0xc9))[_0xca2a('0x47')](handleError(_0x3a5288,null));};exports[_0xca2a('0x2b')]=function(_0x25f995,_0x3ba7c4){if(_0x25f995[_0xca2a('0x4c')]['id']){delete _0x25f995[_0xca2a('0x4c')]['id'];}return db[_0xca2a('0x31')]['find']({'where':{'id':_0x25f995[_0xca2a('0x48')]['id']}})[_0xca2a('0x2c')](handleEntityNotFound(_0x3ba7c4,null))[_0xca2a('0x2c')](saveUpdates(_0x25f995[_0xca2a('0x4c')],null))[_0xca2a('0x2c')](respondWithResult(_0x3ba7c4,null))['catch'](handleError(_0x3ba7c4,null));};exports[_0xca2a('0x54')]=function(_0x4508b0,_0x5e4d01){var _0x114a97=_0x4508b0[_0xca2a('0x48')]['id'];var _0x2fcd56=[];return db['sequelize']['transaction'](function(_0x745a62){var _0x7aaab2=_0xca2a('0x55')+_0x114a97;return db['sequelize'][_0xca2a('0x38')](_0x7aaab2,{'type':db[_0xca2a('0x56')]['QueryTypes'][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62})['then'](function(_0x11ff4e){_0x2fcd56=_[_0xca2a('0x30')](_0x11ff4e,function(_0x578d3f){return Number(_0x578d3f['UserId']);});})['then'](function(){var _0x3e899e=_0xca2a('0x58')+_0x114a97;return db[_0xca2a('0x59')]['query'](_0x3e899e,{'type':db[_0xca2a('0x56')][_0xca2a('0x5a')][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})[_0xca2a('0x2c')](function(_0x3e7f62){var _0x1f9f0e=_[_0xca2a('0x30')](_0x3e7f62,function(_0x1f0cda){return Number(_0x1f0cda[_0xca2a('0x5b')]);});return db[_0xca2a('0x5c')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'VoiceQueueId':{'$in':_0x1f9f0e}},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){var _0x5612e8=_0xca2a('0x5d')+_0x114a97;return db[_0xca2a('0x59')][_0xca2a('0x38')](_0x5612e8,{'type':db[_0xca2a('0x56')][_0xca2a('0x5a')]['SELECT'],'raw':!![],'transaction':_0x745a62});})[_0xca2a('0x2c')](function(_0x50a41e){var _0x212890=_['map'](_0x50a41e,function(_0x21f0f0){return Number(_0x21f0f0[_0xca2a('0x5e')]);});return db[_0xca2a('0x5f')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'MailQueueId':{'$in':_0x212890}},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){var _0x336188='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x114a97;return db['sequelize']['query'](_0x336188,{'type':db['Sequelize'][_0xca2a('0x5a')][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})[_0xca2a('0x2c')](function(_0x574d76){var _0x2732b1=_[_0xca2a('0x30')](_0x574d76,function(_0x5923c9){return Number(_0x5923c9[_0xca2a('0x60')]);});return db[_0xca2a('0x61')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'SmsQueueId':{'$in':_0x2732b1}},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){var _0x17c486='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x114a97;return db[_0xca2a('0x59')][_0xca2a('0x38')](_0x17c486,{'type':db[_0xca2a('0x56')][_0xca2a('0x5a')][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})[_0xca2a('0x2c')](function(_0x923c00){var _0x5b2e3b=_[_0xca2a('0x30')](_0x923c00,function(_0x155e11){return Number(_0x155e11[_0xca2a('0x62')]);});return db[_0xca2a('0x63')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'ChatQueueId':{'$in':_0x5b2e3b}},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){var _0x240672=_0xca2a('0x64')+_0x114a97;return db[_0xca2a('0x59')][_0xca2a('0x38')](_0x240672,{'type':db[_0xca2a('0x56')]['QueryTypes'][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})['then'](function(_0x24da66){var _0x2da8f1=_['map'](_0x24da66,function(_0x4e6dc5){return Number(_0x4e6dc5[_0xca2a('0x65')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x2fcd56},'FaxQueueId':{'$in':_0x2da8f1}},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){var _0x579f95=_0xca2a('0x66')+_0x114a97;return db[_0xca2a('0x59')][_0xca2a('0x38')](_0x579f95,{'type':db[_0xca2a('0x56')][_0xca2a('0x5a')][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})['then'](function(_0x4d4b70){var _0x4ab1c7=_[_0xca2a('0x30')](_0x4d4b70,function(_0x564594){return Number(_0x564594[_0xca2a('0x67')]);});return db[_0xca2a('0x68')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'OpenchannelQueueId':{'$in':_0x4ab1c7}},'transaction':_0x745a62});})['then'](function(){var _0x4b2d9b=_0xca2a('0x69')+_0x114a97;return db[_0xca2a('0x59')][_0xca2a('0x38')](_0x4b2d9b,{'type':db[_0xca2a('0x56')][_0xca2a('0x5a')][_0xca2a('0x57')],'raw':!![],'transaction':_0x745a62});})['then'](function(_0x28ce26){var _0x5743f3=_[_0xca2a('0x30')](_0x28ce26,function(_0x11f8a6){return Number(_0x11f8a6['WhatsappQueueId']);});return db[_0xca2a('0x6a')][_0xca2a('0x54')]({'where':{'UserId':{'$in':_0x2fcd56},'WhatsappQueueId':{'$in':_0x5743f3}},'transaction':_0x745a62});})['then'](function(){return db[_0xca2a('0x6b')][_0xca2a('0x52')]({'where':{'TeamId':_0x114a97}});})[_0xca2a('0x2c')](function(_0x1bd050){if(_0x1bd050===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x2fcd56},'VoicePrefixId':_0x1bd050[_0xca2a('0x6c')]},'transaction':_0x745a62});})[_0xca2a('0x2c')](function(){return db[_0xca2a('0x31')][_0xca2a('0x54')]({'where':{'id':_0x114a97},'cascade':!![],'transaction':_0x745a62});})['then'](function(_0x215aa0){if(_0x215aa0===0x0){_0x5e4d01['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xca2a('0x54')]({'where':{'type':_0xca2a('0x50'),'resourceId':_0x114a97},'cascade':!![],'transaction':_0x745a62})['then'](function(){_0x5e4d01['status'](0xcc)[_0xca2a('0x20')]();});}})[_0xca2a('0x47')](function(_0x221c29){_0x5e4d01[_0xca2a('0x21')](0x1f4)[_0xca2a('0x6d')](_0x221c29);});});};exports['getQueues']=function(_0x45dc00,_0xd9c5a0,_0x668bb1){return db[_0xca2a('0x31')][_0xca2a('0x6e')]({'where':{'id':_0x45dc00['params']['id']}})[_0xca2a('0x2c')](handleEntityNotFound(_0xd9c5a0,null))['then'](function(_0x287991){if(!_0x45dc00[_0xca2a('0x38')][_0xca2a('0x6f')]||!utils[_0xca2a('0x70')](_0x45dc00[_0xca2a('0x38')][_0xca2a('0x6f')])){throw new db[(_0xca2a('0x56'))][(_0xca2a('0x71'))](_0xca2a('0x72'));}var _0x1d8e71={};var _0x43788f={};_0x43788f['model']=_[_0xca2a('0x37')](db[_['capitalize'](_0x45dc00[_0xca2a('0x38')][_0xca2a('0x6f')]['toLowerCase']())+_0xca2a('0x73')][_0xca2a('0x32')]);_0x43788f['query']=_[_0xca2a('0x37')](_0x45dc00[_0xca2a('0x38')]);_0x43788f[_0xca2a('0x39')]=_[_0xca2a('0x3a')](_0x43788f[_0xca2a('0x36')],_0x43788f[_0xca2a('0x38')]);_0x1d8e71[_0xca2a('0x3b')]=_[_0xca2a('0x3a')](_0x43788f[_0xca2a('0x36')],qs[_0xca2a('0x49')](_0x45dc00[_0xca2a('0x38')][_0xca2a('0x49')]));_0x1d8e71[_0xca2a('0x3b')]=_0x1d8e71[_0xca2a('0x3b')][_0xca2a('0x3c')]?_0x1d8e71['attributes']:_0x43788f['model'];_0x1d8e71['limit']=qs[_0xca2a('0x24')](_0x45dc00['query'][_0xca2a('0x24')]);_0x1d8e71['offset']=qs[_0xca2a('0x26')](_0x45dc00['query'][_0xca2a('0x26')]);_0x1d8e71[_0xca2a('0x3e')]=qs[_0xca2a('0x3f')](_0x45dc00[_0xca2a('0x38')][_0xca2a('0x3f')]);_0x1d8e71[_0xca2a('0x40')]=qs[_0xca2a('0x39')](_[_0xca2a('0x41')](_0x45dc00[_0xca2a('0x38')],_0x43788f[_0xca2a('0x39')]));_0x1d8e71=_[_0xca2a('0x43')]({},_0x1d8e71,_0x45dc00['options']);return _0x287991[_0xca2a('0x4e')+_[_0xca2a('0x74')](_0x45dc00['query'][_0xca2a('0x6f')]['toLowerCase']())+_0xca2a('0x75')](_0x1d8e71);})['then'](respondWithResult(_0xd9c5a0,null))[_0xca2a('0x47')](handleError(_0xd9c5a0,null));};exports[_0xca2a('0x76')]=function(_0x4ef171,_0x2a7214,_0x476f30){return db['Team'][_0xca2a('0x6e')]({'where':{'id':_0x4ef171['params']['id']}})[_0xca2a('0x2c')](function(_0x209ab3){if(_0x209ab3){if(!_0x4ef171['body']['channel']||!utils[_0xca2a('0x70')](_0x4ef171['body'][_0xca2a('0x6f')])){throw new db[(_0xca2a('0x56'))][(_0xca2a('0x71'))](_0xca2a('0x72'));}return _0x209ab3[_0xca2a('0x77')+_[_0xca2a('0x74')](_0x4ef171[_0xca2a('0x4c')]['channel'][_0xca2a('0x78')]())+_0xca2a('0x75')](_0x4ef171[_0xca2a('0x4c')][_0xca2a('0x79')]);}return null;})[_0xca2a('0x2c')](handleEntityNotFound(_0x2a7214,null))[_0xca2a('0x2c')](respondWithStatusCode(_0x2a7214,null))[_0xca2a('0x47')](handleError(_0x2a7214,null));};exports[_0xca2a('0x7a')]=function(_0x23db5f,_0x97c709,_0x4b9202){return db[_0xca2a('0x31')][_0xca2a('0x6e')]({'where':{'id':_0x23db5f[_0xca2a('0x48')]['id']}})[_0xca2a('0x2c')](function(_0x29d896){if(_0x29d896){if(!_0x23db5f['query']['channel']||!utils[_0xca2a('0x70')](_0x23db5f['query'][_0xca2a('0x6f')])){throw new db[(_0xca2a('0x56'))][(_0xca2a('0x71'))](_0xca2a('0x72'));}return _0x29d896['remove'+_['capitalize'](_0x23db5f[_0xca2a('0x38')]['channel']['toLowerCase']())+_0xca2a('0x75')](_0x23db5f[_0xca2a('0x38')][_0xca2a('0x79')]);}return null;})[_0xca2a('0x2c')](handleEntityNotFound(_0x97c709,null))[_0xca2a('0x2c')](respondWithStatusCode(_0x97c709,null))[_0xca2a('0x47')](handleError(_0x97c709,null));};exports[_0xca2a('0x7b')]=function(_0x26ac45,_0x41e642){var _0x4d1457=_['isArray'](_0x26ac45[_0xca2a('0x4c')][_0xca2a('0x79')])?_0x26ac45['body'][_0xca2a('0x79')]:[_0x26ac45['body'][_0xca2a('0x79')]];var _0x2c2f7c=_0x26ac45[_0xca2a('0x48')]['id'];return db[_0xca2a('0x31')][_0xca2a('0x52')]({'where':{'id':_0x2c2f7c}})[_0xca2a('0x2c')](handleEntityNotFound(_0x41e642,null))[_0xca2a('0x2c')](function(_0xa18b2a){if(_0xa18b2a){var _0x407e19=[_0xca2a('0x7c'),_0xca2a('0x7d'),_0xca2a('0x7e'),_0xca2a('0x7f'),_0xca2a('0x80'),'Openchannel','Whatsapp'];return db['sequelize'][_0xca2a('0x81')](function(_0x50346d){var _0xf9d7c6=_[_0xca2a('0x30')](_0x407e19,function(_0x4d2100){var _0x120801={'attributes':['id',_0xca2a('0x2f')]};if(_0x4d2100===_0xca2a('0x7c')){_0x120801[_0xca2a('0x82')]={'attributes':[_0xca2a('0x83')]};}return _0xa18b2a[_0xca2a('0x4e')+_0x4d2100+_0xca2a('0x75')](_0x120801)[_0xca2a('0x2c')](function(_0x20e797){var _0x1d39d4=_[_0xca2a('0x30')](_0x20e797,function(_0x5c60d0){var _0x3249ec=_['map'](_0x4d1457,function(_0x44f75a){var _0x2db72e={'where':{'UserId':_0x44f75a,[_0x4d2100+_0xca2a('0x84')]:_0x5c60d0['id']},'transaction':_0x50346d};if(_0x4d2100===_0xca2a('0x7c')){_0x2db72e[_0xca2a('0x1c')]={'penalty':_0x5c60d0[_0xca2a('0x85')][_0xca2a('0x83')]};}return db['User'+_0x4d2100+_0xca2a('0x73')][_0xca2a('0x86')](_0x2db72e)['then'](function(){socket['emit'](_0xca2a('0x4d')+_0x4d2100+_0xca2a('0x87'),{'UserId':_0x44f75a,[_0x4d2100+_0xca2a('0x84')]:_0x5c60d0['id']});if(_0x4d2100!==_0xca2a('0x7c')){return;}return db['User'][_0xca2a('0x88')]({'where':{'id':_0x4d1457,'online':0x1},'attributes':['id',_0xca2a('0x2f'),_0xca2a('0x89'),_0xca2a('0x8a'),_0xca2a('0x8b')],'raw':!![]})[_0xca2a('0x2c')](function(_0x39cf1a){var _0x18fd4e=_['map'](_0x39cf1a,function(_0xfec01c){return db[_0xca2a('0x8c')][_0xca2a('0x8d')]({'membername':_0xfec01c[_0xca2a('0x2f')],'UserId':_0xfec01c['id'],'queue_name':_0x5c60d0[_0xca2a('0x2f')],'VoiceQueueId':_0x5c60d0['id'],'interface':_[_0xca2a('0x8e')](_0xfec01c[_0xca2a('0x8b')])?util[_0xca2a('0x8f')](_0xca2a('0x90'),_0xfec01c[_0xca2a('0x2f')]):_0xfec01c['interface'],'paused':_0xfec01c['voicePause']||![],'penalty':_0x5c60d0[_0xca2a('0x85')][_0xca2a('0x83')]},{'transaction':_0x50346d});});return Promise['all'](_0x18fd4e);});});});return Promise[_0xca2a('0x91')](_0x3249ec);});return Promise[_0xca2a('0x91')](_0x1d39d4);})[_0xca2a('0x2c')](function(){return db['TeamVoicePrefix'][_0xca2a('0x6e')]({'where':{'teamId':_0x2c2f7c}})['then'](function(_0x818d11){if(_0x818d11){var _0x18ad5a=_[_0xca2a('0x30')](_0x4d1457,function(_0x3da443){db[_0xca2a('0x92')]['upsert']({'UserId':_0x3da443,'VoicePrefixId':_0x818d11[_0xca2a('0x6c')]});});return Promise[_0xca2a('0x91')](_0x18ad5a);}});});});return Promise[_0xca2a('0x91')](_0xf9d7c6)[_0xca2a('0x2c')](function(){return _0xa18b2a[_0xca2a('0x7b')](_0x4d1457,{'transaction':_0x50346d})['spread'](function(_0x942a93){return _0x942a93;});});});}})[_0xca2a('0x2c')](respondWithResult(_0x41e642,null))[_0xca2a('0x47')](handleError(_0x41e642,null));};exports[_0xca2a('0x93')]=function(_0x558f6a,_0x17cf9b){var _0x43397c=_['isArray'](_0x558f6a[_0xca2a('0x38')][_0xca2a('0x79')])?_0x558f6a[_0xca2a('0x38')]['ids']:[_0x558f6a[_0xca2a('0x38')][_0xca2a('0x79')]];var _0x413d8b=_0x558f6a['params']['id'];return db[_0xca2a('0x31')][_0xca2a('0x52')]({'where':{'id':_0x413d8b}})[_0xca2a('0x2c')](handleEntityNotFound(_0x17cf9b,null))[_0xca2a('0x2c')](function(_0x500914){if(_0x500914){var _0x9e2a75=[_0xca2a('0x7c'),_0xca2a('0x7d'),_0xca2a('0x7e'),_0xca2a('0x7f'),_0xca2a('0x80'),_0xca2a('0x94'),_0xca2a('0x95')];return db['sequelize'][_0xca2a('0x81')](function(_0x3a26e3){var _0x3a7299=_[_0xca2a('0x30')](_0x9e2a75,function(_0x400c61){var _0x1d78fa={'attributes':['id',_0xca2a('0x2f')]};return _0x500914[_0xca2a('0x4e')+_0x400c61+_0xca2a('0x75')](_0x1d78fa)[_0xca2a('0x2c')](function(_0x287c75){var _0x57e1b5=_['map'](_0x287c75,function(_0x2c3478){return _0x2c3478['removeAgents'](_0x43397c,{'transaction':_0x3a26e3})['then'](function(){var _0x27ca6e=_[_0xca2a('0x30')](_0x43397c,function(_0x4e1644){socket[_0xca2a('0x96')](_0xca2a('0x4d')+_0x400c61+_0xca2a('0x97'),{'UserId':Number(_0x4e1644),[_0x400c61+_0xca2a('0x84')]:_0x2c3478['id']});if(_0x400c61!==_0xca2a('0x7c')){return;}return db[_0xca2a('0x8c')][_0xca2a('0x54')]({'where':{'VoiceQueueId':_0x2c3478['id'],'UserId':_0x4e1644},'transaction':_0x3a26e3});});return Promise[_0xca2a('0x91')](_0x27ca6e);});});return Promise['all'](_0x57e1b5);});});return Promise['all'](_0x3a7299)[_0xca2a('0x2c')](function(){return _0x500914[_0xca2a('0x93')](_0x43397c,{'transaction':_0x3a26e3});})[_0xca2a('0x2c')](function(){return db[_0xca2a('0x6b')][_0xca2a('0x6e')]({'where':{'teamId':_0x413d8b}})[_0xca2a('0x2c')](function(_0x2595e2){if(_0x2595e2){var _0x27c396=_[_0xca2a('0x30')](_0x43397c,function(_0x49612d){db[_0xca2a('0x92')]['destroy']({'where':{'UserId':_0x49612d,'VoicePrefixId':_0x2595e2[_0xca2a('0x6c')]}});});return Promise[_0xca2a('0x91')](_0x27c396);}});});});}})[_0xca2a('0x2c')](respondWithStatusCode(_0x17cf9b,null))[_0xca2a('0x47')](handleError(_0x17cf9b,null));};exports[_0xca2a('0x98')]=function(_0xfbe67e,_0x28eb3b,_0xdf0368){var _0x117e85={};var _0x4e7aca={};var _0x5f2e28;var _0x2cda28;return db['Team'][_0xca2a('0x6e')]({'where':{'id':_0xfbe67e['params']['id']}})[_0xca2a('0x2c')](handleEntityNotFound(_0x28eb3b,null))[_0xca2a('0x2c')](function(_0x1b417a){if(_0x1b417a){_0x5f2e28=_0x1b417a;_0x4e7aca[_0xca2a('0x36')]=_[_0xca2a('0x37')](db['User'][_0xca2a('0x32')]);_0x4e7aca[_0xca2a('0x38')]=_['keys'](_0xfbe67e[_0xca2a('0x38')]);_0x4e7aca['filters']=_['intersection'](_0x4e7aca[_0xca2a('0x36')],_0x4e7aca[_0xca2a('0x38')]);_0x117e85[_0xca2a('0x3b')]=_[_0xca2a('0x3a')](_0x4e7aca[_0xca2a('0x36')],qs[_0xca2a('0x49')](_0xfbe67e[_0xca2a('0x38')][_0xca2a('0x49')]));_0x117e85[_0xca2a('0x3b')]=_0x117e85['attributes'][_0xca2a('0x3c')]?_0x117e85[_0xca2a('0x3b')]:_0x4e7aca[_0xca2a('0x36')];_0x117e85[_0xca2a('0x3e')]=qs[_0xca2a('0x3f')](_0xfbe67e[_0xca2a('0x38')][_0xca2a('0x3f')]);_0x117e85['where']=qs[_0xca2a('0x39')](_['pick'](_0xfbe67e['query'],_0x4e7aca[_0xca2a('0x39')]));if(_0xfbe67e[_0xca2a('0x38')]['filter']){_0x117e85['where']=_[_0xca2a('0x43')](_0x117e85['where'],{'$or':_[_0xca2a('0x30')](_0x117e85[_0xca2a('0x3b')],function(_0x279772){var _0x498269={};_0x498269[_0x279772]={'$like':'%'+_0xfbe67e['query'][_0xca2a('0x42')]+'%'};return _0x498269;})});}_0x117e85=_[_0xca2a('0x43')]({},_0x117e85,_0xfbe67e[_0xca2a('0x45')]);return _0x5f2e28['getAgents'](_0x117e85);}})[_0xca2a('0x2c')](function(_0x4ea25f){if(_0x4ea25f){_0x2cda28=_0x4ea25f['length'];if(!_0xfbe67e[_0xca2a('0x38')][_0xca2a('0x99')]('nolimit')){_0x117e85['limit']=qs['limit'](_0xfbe67e[_0xca2a('0x38')][_0xca2a('0x24')]);_0x117e85['offset']=qs['offset'](_0xfbe67e[_0xca2a('0x38')][_0xca2a('0x26')]);}return _0x5f2e28[_0xca2a('0x98')](_0x117e85);}})['then'](function(_0x2fae57){if(_0x2fae57){return _0x2fae57?{'count':_0x2cda28,'rows':_0x2fae57}:null;}})[_0xca2a('0x2c')](respondWithResult(_0x28eb3b,null))[_0xca2a('0x47')](handleError(_0x28eb3b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1f5c9ac..bf58f8c 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 _0xd617=['Team','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd617,0x14f));var _0x7d61=function(_0x43d472,_0x4f1c15){_0x43d472=_0x43d472-0x0;var _0x204319=_0xd617[_0x43d472];return _0x204319;};'use strict';var EventEmitter=require(_0x7d61('0x0'));var Team=require('../../mysqldb')['db'][_0x7d61('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x7d61('0x2')](0x0);var events={'afterCreate':_0x7d61('0x3'),'afterUpdate':_0x7d61('0x4'),'afterDestroy':'remove'};function emitEvent(_0x108458){return function(_0x28d296,_0x15069e,_0x452ac3){TeamEvents['emit'](_0x108458+':'+_0x28d296['id'],_0x28d296);TeamEvents['emit'](_0x108458,_0x28d296);_0x452ac3(null);};}for(var e in events){if(events[_0x7d61('0x5')](e)){var event=events[e];Team[_0x7d61('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x0cb4=['save','update','emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x9f28b,_0x6c9690){var _0xc07ec4=function(_0x531e92){while(--_0x531e92){_0x9f28b['push'](_0x9f28b['shift']());}};_0xc07ec4(++_0x6c9690);}(_0x0cb4,0x11f));var _0x40cb=function(_0x35f32d,_0xd7c28c){_0x35f32d=_0x35f32d-0x0;var _0x5b37ad=_0x0cb4[_0x35f32d];return _0x5b37ad;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x40cb('0x0')](0x0);var events={'afterCreate':_0x40cb('0x1'),'afterUpdate':_0x40cb('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1d2fe8){return function(_0x4f3170,_0x105d8c,_0x5241c4){TeamEvents[_0x40cb('0x3')](_0x1d2fe8+':'+_0x4f3170['id'],_0x4f3170);TeamEvents['emit'](_0x1d2fe8,_0x4f3170);_0x5241c4(null);};}for(var e in events){if(events[_0x40cb('0x4')](e)){var event=events[e];Team[_0x40cb('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 02781f0..a0ec545 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 _0x64d1=['all','catch','lodash','Queues','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Openchannel','Voice','Whatsapp','resolve','then'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x64d1,0xda));var _0x164d=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x64d1[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x164d('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x405885,_0x52fd4d){var _0x33221d='get'+_0x52fd4d+_0x164d('0x1');return _0x405885[_0x33221d]()['then'](function(_0x37d63c){return _[_0x164d('0x2')](_0x37d63c,function(_0x5d4b7f){_0x5d4b7f[_0x164d('0x3')](_0x164d('0x4'),_0x52fd4d);return _0x5d4b7f;});})['catch'](function(_0x559b69){throw _0x559b69;});}module[_0x164d('0x5')]=function(_0x36ca68){return _0x36ca68[_0x164d('0x6')](_0x164d('0x7'),attributes,{'tableName':_0x164d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x14cf2c=this;var _0x2fa7a5=[_0x164d('0x9'),_0x164d('0xa'),'Mail',_0x164d('0xb'),'Sms',_0x164d('0xc'),_0x164d('0xd')];return Promise[_0x164d('0xe')]()[_0x164d('0xf')](function(){var _0x1d0010=_[_0x164d('0x2')](_0x2fa7a5,function(_0x476f09){return getQueuesByChannel(_0x14cf2c,_0x476f09);});return Promise[_0x164d('0x10')](_0x1d0010);})[_0x164d('0x11')](function(_0x51f0b7){throw _0x51f0b7;});}}});}; \ No newline at end of file +var _0xba32=['channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','resolve','then','all','catch','lodash','get','map','setDataValue'];(function(_0x2fdd5b,_0xc899ae){var _0x433322=function(_0x219452){while(--_0x219452){_0x2fdd5b['push'](_0x2fdd5b['shift']());}};_0x433322(++_0xc899ae);}(_0xba32,0xba));var _0x2ba3=function(_0x52fa1e,_0x39a40f){_0x52fa1e=_0x52fa1e-0x0;var _0x26849d=_0xba32[_0x52fa1e];return _0x26849d;};'use strict';var _=require(_0x2ba3('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x233cb4,_0xf833fc){var _0x248ac4=_0x2ba3('0x1')+_0xf833fc+'Queues';return _0x233cb4[_0x248ac4]()['then'](function(_0x4a3c77){return _[_0x2ba3('0x2')](_0x4a3c77,function(_0x19870a){_0x19870a[_0x2ba3('0x3')](_0x2ba3('0x4'),_0xf833fc);return _0x19870a;});})['catch'](function(_0x105230){throw _0x105230;});}module[_0x2ba3('0x5')]=function(_0x372776){return _0x372776[_0x2ba3('0x6')](_0x2ba3('0x7'),attributes,{'tableName':_0x2ba3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4cfa80=this;var _0x5587cd=[_0x2ba3('0x9'),_0x2ba3('0xa'),_0x2ba3('0xb'),_0x2ba3('0xc'),_0x2ba3('0xd'),'Voice',_0x2ba3('0xe')];return Promise[_0x2ba3('0xf')]()[_0x2ba3('0x10')](function(){var _0x1fd4d9=_[_0x2ba3('0x2')](_0x5587cd,function(_0x45a022){return getQueuesByChannel(_0x4cfa80,_0x45a022);});return Promise[_0x2ba3('0x11')](_0x1fd4d9);})[_0x2ba3('0x12')](function(_0x1326fe){throw _0x1326fe;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index fc5ae9e..6360c5b 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 _0xb20f=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x30464a,_0x454a6f){var _0x25817f=function(_0xa78bc3){while(--_0xa78bc3){_0x30464a['push'](_0x30464a['shift']());}};_0x25817f(++_0x454a6f);}(_0xb20f,0x1ef));var _0xfb20=function(_0x14507a,_0x1d4265){_0x14507a=_0x14507a-0x0;var _0xf29027=_0xb20f[_0x14507a];return _0xf29027;};'use strict';var _=require(_0xfb20('0x0'));var util=require(_0xfb20('0x1'));var moment=require(_0xfb20('0x2'));var BPromise=require(_0xfb20('0x3'));var rs=require(_0xfb20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb20('0x5'))['db'];var utils=require(_0xfb20('0x6'));var logger=require(_0xfb20('0x7'))(_0xfb20('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb20('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfb20('0xa')]=_[_0xfb20('0xb')](config['redis'],{'host':_0xfb20('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb20('0xa')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0xa6eb40,_0x232a19,_0x4ca1c0){return new BPromise(function(_0x262f5f,_0x3b0c08){return client[_0xfb20('0xd')](_0xa6eb40,_0x4ca1c0)[_0xfb20('0xe')](function(_0x264a12){logger[_0xfb20('0xf')](_0xfb20('0x10'),_0x232a19,_0xfb20('0x11'));logger[_0xfb20('0x12')](_0xfb20('0x13'),_0x232a19,_0xfb20('0x11'),JSON['stringify'](_0x264a12));if(_0x264a12[_0xfb20('0x14')]){if(_0x264a12[_0xfb20('0x14')][_0xfb20('0x15')]===0x1f4){logger[_0xfb20('0x14')](_0xfb20('0x10'),_0x232a19,_0x264a12['error'][_0xfb20('0x16')]);return _0x3b0c08(_0x264a12['error']['message']);}logger['error']('Team,\x20%s,\x20%s',_0x232a19,_0x264a12[_0xfb20('0x14')][_0xfb20('0x16')]);return _0x262f5f(_0x264a12[_0xfb20('0x14')][_0xfb20('0x16')]);}else{logger[_0xfb20('0xf')](_0xfb20('0x10'),_0x232a19,_0xfb20('0x11'));_0x262f5f(_0x264a12[_0xfb20('0x17')][_0xfb20('0x16')]);}})[_0xfb20('0x18')](function(_0x5119c4){logger[_0xfb20('0x14')](_0xfb20('0x10'),_0x232a19,_0x5119c4);_0x3b0c08(_0x5119c4);});});} \ No newline at end of file +var _0x07d1=['socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x47ede4,_0x388780){var _0x1416e5=function(_0x474ad5){while(--_0x474ad5){_0x47ede4['push'](_0x47ede4['shift']());}};_0x1416e5(++_0x388780);}(_0x07d1,0xf0));var _0x107d=function(_0x466805,_0x3e5529){_0x466805=_0x466805-0x0;var _0x4e57f1=_0x07d1[_0x466805];return _0x4e57f1;};'use strict';var _=require(_0x107d('0x0'));var util=require(_0x107d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x107d('0x2'));var fs=require('fs');var Redis=require(_0x107d('0x3'));var db=require(_0x107d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x107d('0x5'))(_0x107d('0x6'));var config=require(_0x107d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x107d('0x8')][_0x107d('0x9')]({'port':0x232a});config[_0x107d('0xa')]=_[_0x107d('0xb')](config[_0x107d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x107d('0xc'))(new Redis(config[_0x107d('0xa')]));require(_0x107d('0xd'))[_0x107d('0xe')](socket);function respondWithRpcPromise(_0x3d3789,_0x270cb6,_0x1dd0ab){return new BPromise(function(_0x22dd08,_0x3694bb){return client[_0x107d('0xf')](_0x3d3789,_0x1dd0ab)[_0x107d('0x10')](function(_0x2ed1ce){logger[_0x107d('0x11')]('Team,\x20%s,\x20%s',_0x270cb6,_0x107d('0x12'));logger[_0x107d('0x13')](_0x107d('0x14'),_0x270cb6,'request\x20sent',JSON[_0x107d('0x15')](_0x2ed1ce));if(_0x2ed1ce[_0x107d('0x16')]){if(_0x2ed1ce[_0x107d('0x16')][_0x107d('0x17')]===0x1f4){logger['error'](_0x107d('0x18'),_0x270cb6,_0x2ed1ce[_0x107d('0x16')][_0x107d('0x19')]);return _0x3694bb(_0x2ed1ce[_0x107d('0x16')]['message']);}logger[_0x107d('0x16')](_0x107d('0x18'),_0x270cb6,_0x2ed1ce['error']['message']);return _0x22dd08(_0x2ed1ce[_0x107d('0x16')]['message']);}else{logger['info'](_0x107d('0x18'),_0x270cb6,_0x107d('0x12'));_0x22dd08(_0x2ed1ce[_0x107d('0x1a')][_0x107d('0x19')]);}})[_0x107d('0x1b')](function(_0x56569c){logger[_0x107d('0x16')](_0x107d('0x18'),_0x270cb6,_0x56569c);_0x3694bb(_0x56569c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 77535e0..e950cbf 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 _0xb7aa=['./team.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x4e9aab,_0x5b9288){_0x4e9aab=_0x4e9aab-0x0;var _0x249b5c=_0xb7aa[_0x4e9aab];return _0x249b5c;};'use strict';var TeamEvents=require(_0xab7a('0x0'));var events=[_0xab7a('0x1'),_0xab7a('0x2'),_0xab7a('0x3')];function createListener(_0x1d2507,_0x3eab6c){return function(_0x20b86d){_0x3eab6c[_0xab7a('0x4')](_0x1d2507,_0x20b86d);};}function removeListener(_0x34adc3,_0x3b0621){return function(){TeamEvents['removeListener'](_0x34adc3,_0x3b0621);};}exports[_0xab7a('0x5')]=function(_0x1c761b){for(var _0x2ee412=0x0,_0x29ef15=events['length'];_0x2ee412<_0x29ef15;_0x2ee412++){var _0x99ac82=events[_0x2ee412];var _0x1e3b23=createListener('team:'+_0x99ac82,_0x1c761b);TeamEvents['on'](_0x99ac82,_0x1e3b23);}}; \ No newline at end of file +var _0x4e34=['update','removeListener','length','team:','remove'];(function(_0x513a0b,_0x232ae0){var _0x208530=function(_0x1c3a56){while(--_0x1c3a56){_0x513a0b['push'](_0x513a0b['shift']());}};_0x208530(++_0x232ae0);}(_0x4e34,0x19e));var _0x44e3=function(_0x391a5c,_0x3b74f9){_0x391a5c=_0x391a5c-0x0;var _0x50448e=_0x4e34[_0x391a5c];return _0x50448e;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x44e3('0x0'),_0x44e3('0x1')];function createListener(_0x4d3831,_0x511088){return function(_0xdaba22){_0x511088['emit'](_0x4d3831,_0xdaba22);};}function removeListener(_0x45571,_0x36cbe3){return function(){TeamEvents[_0x44e3('0x2')](_0x45571,_0x36cbe3);};}exports['register']=function(_0x50805a){for(var _0x162bd9=0x0,_0x19e7de=events[_0x44e3('0x3')];_0x162bd9<_0x19e7de;_0x162bd9++){var _0x1ca56e=events[_0x162bd9];var _0x37b7d4=createListener(_0x44e3('0x4')+_0x1ca56e,_0x50805a);TeamEvents['on'](_0x1ca56e,_0x37b7d4);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c6e8d21..88c6caa 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 _0x81a4=['exports','INTEGER','sequelize'];(function(_0x383577,_0x29899f){var _0x1d930f=function(_0x173a49){while(--_0x173a49){_0x383577['push'](_0x383577['shift']());}};_0x1d930f(++_0x29899f);}(_0x81a4,0x1a6));var _0x481a=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x81a4[_0x18d5d7];return _0x30a9ea;};'use strict';var Sequelize=require(_0x481a('0x0'));module[_0x481a('0x1')]={'TeamId':{'type':Sequelize[_0x481a('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x481a('0x2')]}}; \ No newline at end of file +var _0x6343=['INTEGER','exports'];(function(_0x594742,_0x285b57){var _0x3624f8=function(_0xfb5156){while(--_0xfb5156){_0x594742['push'](_0x594742['shift']());}};_0x3624f8(++_0x285b57);}(_0x6343,0x1e9));var _0x3634=function(_0x51a59b,_0x470942){_0x51a59b=_0x51a59b-0x0;var _0x5c7ff8=_0x6343[_0x51a59b];return _0x5c7ff8;};'use strict';var Sequelize=require('sequelize');module[_0x3634('0x0')]={'TeamId':{'type':Sequelize[_0x3634('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3634('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e11019f..37e641f 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 _0xd48a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','team_has_voice_prefixes'];(function(_0x4aee7e,_0x4f74ec){var _0x112546=function(_0x6dcdf5){while(--_0x6dcdf5){_0x4aee7e['push'](_0x4aee7e['shift']());}};_0x112546(++_0x4f74ec);}(_0xd48a,0x96));var _0xad48=function(_0x1b3299,_0x38c939){_0x1b3299=_0x1b3299-0x0;var _0x5df97a=_0xd48a[_0x1b3299];return _0x5df97a;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var logger=require(_0xad48('0x1'))(_0xad48('0x2'));var moment=require(_0xad48('0x3'));var BPromise=require(_0xad48('0x4'));var rp=require(_0xad48('0x5'));var fs=require('fs');var path=require(_0xad48('0x6'));var rimraf=require('rimraf');var config=require(_0xad48('0x7'));var attributes=require(_0xad48('0x8'));module['exports']=function(_0x143780,_0x584cf0){return _0x143780['define']('TeamVoicePrefix',attributes,{'tableName':_0xad48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2083=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x18731c,_0x1a6a0b){var _0x5d9921=function(_0x430627){while(--_0x430627){_0x18731c['push'](_0x18731c['shift']());}};_0x5d9921(++_0x1a6a0b);}(_0x2083,0x137));var _0x3208=function(_0xcbb140,_0x4665c3){_0xcbb140=_0xcbb140-0x0;var _0x26873d=_0x2083[_0xcbb140];return _0x26873d;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var logger=require('../../config/logger')(_0x3208('0x2'));var moment=require(_0x3208('0x3'));var BPromise=require(_0x3208('0x4'));var rp=require(_0x3208('0x5'));var fs=require('fs');var path=require(_0x3208('0x6'));var rimraf=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x5c8d7f,_0x152b81){return _0x5c8d7f[_0x3208('0x9')](_0x3208('0xa'),attributes,{'tableName':_0x3208('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 08f1782..a2fe17d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x11dee9,_0x500fad){var _0x4fdcad=function(_0x247a78){while(--_0x247a78){_0x11dee9['push'](_0x11dee9['shift']());}};_0x4fdcad(++_0x500fad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x8065e0,_0x530006){var _0x5b0f55=function(_0x241f58){while(--_0x241f58){_0x8065e0['push'](_0x8065e0['shift']());}};_0x5b0f55(++_0x530006);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index ffcb42b..fa4f4bf 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 _0xd54c=['INTEGER','sequelize'];(function(_0x25fd5e,_0x8a37f5){var _0x154f94=function(_0x31cc2e){while(--_0x31cc2e){_0x25fd5e['push'](_0x25fd5e['shift']());}};_0x154f94(++_0x8a37f5);}(_0xd54c,0x171));var _0xcd54=function(_0x24b926,_0x5766c1){_0x24b926=_0x24b926-0x0;var _0x2809a3=_0xd54c[_0x24b926];return _0x2809a3;};'use strict';var Sequelize=require(_0xcd54('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcd54('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e27=['INTEGER','sequelize','exports'];(function(_0x113056,_0x17a3cf){var _0x463d78=function(_0x4996ba){while(--_0x4996ba){_0x113056['push'](_0x113056['shift']());}};_0x463d78(++_0x17a3cf);}(_0x2e27,0x82));var _0x72e2=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x2e27[_0x596f6e];return _0x1e0803;};'use strict';var Sequelize=require(_0x72e2('0x0'));module[_0x72e2('0x1')]={'penalty':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 761f798..52584a6 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 _0x008c=['define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x008c,0x188));var _0xc008=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x008c[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86dd=['define','team_has_voice_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x3e0296,_0x140d2c){var _0x2f4bb3=function(_0x5eb4ce){while(--_0x5eb4ce){_0x3e0296['push'](_0x3e0296['shift']());}};_0x2f4bb3(++_0x140d2c);}(_0x86dd,0x1ee));var _0xd86d=function(_0x19f757,_0x2229d5){_0x19f757=_0x19f757-0x0;var _0x4550aa=_0x86dd[_0x19f757];return _0x4550aa;};'use strict';var _=require('lodash');var util=require(_0xd86d('0x0'));var logger=require('../../config/logger')(_0xd86d('0x1'));var moment=require(_0xd86d('0x2'));var BPromise=require(_0xd86d('0x3'));var rp=require(_0xd86d('0x4'));var fs=require('fs');var path=require(_0xd86d('0x5'));var rimraf=require(_0xd86d('0x6'));var config=require(_0xd86d('0x7'));var attributes=require(_0xd86d('0x8'));module[_0xd86d('0x9')]=function(_0x1d5ffc,_0x3b13f9){return _0x1d5ffc[_0xd86d('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0xd86d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 8fec509..a402da1 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 _0x1af8=['rpc','jayson/promise','client','http','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c2d57,_0x3e4a59){var _0x473ad1=function(_0x285beb){while(--_0x285beb){_0x4c2d57['push'](_0x4c2d57['shift']());}};_0x473ad1(++_0x3e4a59);}(_0x1af8,0x99));var _0x81af=function(_0x5e54f0,_0x1f7057){_0x5e54f0=_0x5e54f0-0x0;var _0x9b112a=_0x1af8[_0x5e54f0];return _0x9b112a;};'use strict';var _=require(_0x81af('0x0'));var util=require('util');var moment=require(_0x81af('0x1'));var BPromise=require(_0x81af('0x2'));var rs=require(_0x81af('0x3'));var fs=require('fs');var Redis=require(_0x81af('0x4'));var db=require(_0x81af('0x5'))['db'];var utils=require(_0x81af('0x6'));var logger=require(_0x81af('0x7'))(_0x81af('0x8'));var config=require('../../config/environment');var jayson=require(_0x81af('0x9'));var client=jayson[_0x81af('0xa')][_0x81af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aa5c4,_0x4dcfd9,_0x3a759f){return new BPromise(function(_0x51423f,_0x24faef){return client['request'](_0x2aa5c4,_0x3a759f)[_0x81af('0xc')](function(_0x148d2c){logger[_0x81af('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4dcfd9,_0x81af('0xe'));logger[_0x81af('0xf')](_0x81af('0x10'),_0x4dcfd9,_0x81af('0xe'),JSON[_0x81af('0x11')](_0x148d2c));if(_0x148d2c[_0x81af('0x12')]){if(_0x148d2c[_0x81af('0x12')][_0x81af('0x13')]===0x1f4){logger[_0x81af('0x12')](_0x81af('0x14'),_0x4dcfd9,_0x148d2c['error'][_0x81af('0x15')]);return _0x24faef(_0x148d2c[_0x81af('0x12')]['message']);}logger[_0x81af('0x12')](_0x81af('0x14'),_0x4dcfd9,_0x148d2c[_0x81af('0x12')][_0x81af('0x15')]);return _0x51423f(_0x148d2c[_0x81af('0x12')][_0x81af('0x15')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4dcfd9,_0x81af('0xe'));_0x51423f(_0x148d2c['result'][_0x81af('0x15')]);}})[_0x81af('0x16')](function(_0x4f2a5f){logger[_0x81af('0x12')](_0x81af('0x14'),_0x4dcfd9,_0x4f2a5f);_0x24faef(_0x4f2a5f);});});} \ No newline at end of file +var _0xff15=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xff15,0x121));var _0x5ff1=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xff15[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0x5ff1('0x0'));var util=require(_0x5ff1('0x1'));var moment=require(_0x5ff1('0x2'));var BPromise=require(_0x5ff1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ff1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ff1('0x5'));var logger=require(_0x5ff1('0x6'))(_0x5ff1('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ff1('0x8'));var client=jayson['client'][_0x5ff1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ba0,_0x17e7f2,_0x1eb46e){return new BPromise(function(_0x2a23a3,_0x13b919){return client[_0x5ff1('0xa')](_0x4a6ba0,_0x1eb46e)['then'](function(_0x3e0c6b){logger[_0x5ff1('0xb')](_0x5ff1('0xc'),_0x17e7f2,_0x5ff1('0xd'));logger[_0x5ff1('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x17e7f2,_0x5ff1('0xd'),JSON[_0x5ff1('0xf')](_0x3e0c6b));if(_0x3e0c6b[_0x5ff1('0x10')]){if(_0x3e0c6b[_0x5ff1('0x10')]['code']===0x1f4){logger[_0x5ff1('0x10')](_0x5ff1('0xc'),_0x17e7f2,_0x3e0c6b[_0x5ff1('0x10')][_0x5ff1('0x11')]);return _0x13b919(_0x3e0c6b[_0x5ff1('0x10')][_0x5ff1('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x17e7f2,_0x3e0c6b['error']['message']);return _0x2a23a3(_0x3e0c6b[_0x5ff1('0x10')][_0x5ff1('0x11')]);}else{logger[_0x5ff1('0xb')](_0x5ff1('0xc'),_0x17e7f2,_0x5ff1('0xd'));_0x2a23a3(_0x3e0c6b[_0x5ff1('0x12')]['message']);}})[_0x5ff1('0x13')](function(_0x1b0bd1){logger['error'](_0x5ff1('0xc'),_0x17e7f2,_0x1b0bd1);_0x13b919(_0x1b0bd1);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b4fd56c..bfaac7a 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 _0xbb59=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbb59,0xec));var _0x9bb5=function(_0x1742a5,_0x146bd4){_0x1742a5=_0x1742a5-0x0;var _0x6c7395=_0xbb59[_0x1742a5];return _0x6c7395;};'use strict';var multer=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var path=require(_0x9bb5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bb5('0x3')]();var fs_extra=require(_0x9bb5('0x4'));var auth=require(_0x9bb5('0x5'));var interaction=require(_0x9bb5('0x6'));var config=require(_0x9bb5('0x7'));var controller=require('./template.controller');router[_0x9bb5('0x8')]('/',auth[_0x9bb5('0x9')](),controller[_0x9bb5('0xa')]);router[_0x9bb5('0x8')](_0x9bb5('0xb'),auth[_0x9bb5('0x9')](),controller[_0x9bb5('0xc')]);router[_0x9bb5('0xd')]('/',auth[_0x9bb5('0x9')](),controller[_0x9bb5('0xe')]);router[_0x9bb5('0xf')](_0x9bb5('0xb'),auth[_0x9bb5('0x9')](),controller['update']);router[_0x9bb5('0x10')](_0x9bb5('0xb'),auth[_0x9bb5('0x9')](),controller[_0x9bb5('0x11')]);module[_0x9bb5('0x12')]=router; \ No newline at end of file +var _0x2deb=['delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','update'];(function(_0x1e1b54,_0x4f8225){var _0x4b4ab2=function(_0x5bc8aa){while(--_0x5bc8aa){_0x1e1b54['push'](_0x1e1b54['shift']());}};_0x4b4ab2(++_0x4f8225);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var timeout=require(_0xb2de('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2de('0x4'));var auth=require(_0xb2de('0x5'));var interaction=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var controller=require('./template.controller');router['get']('/',auth[_0xb2de('0x8')](),controller[_0xb2de('0x9')]);router[_0xb2de('0xa')]('/:id',auth[_0xb2de('0x8')](),controller[_0xb2de('0xb')]);router['post']('/',auth[_0xb2de('0x8')](),controller[_0xb2de('0xc')]);router[_0xb2de('0xd')]('/:id',auth[_0xb2de('0x8')](),controller[_0xb2de('0xe')]);router[_0xb2de('0xf')](_0xb2de('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xb2de('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 afff188..590e0c5 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 _0xc7bc=['exports','STRING','TEXT','sequelize'];(function(_0x45d94b,_0x1c4c14){var _0x26b5f4=function(_0x336641){while(--_0x336641){_0x45d94b['push'](_0x45d94b['shift']());}};_0x26b5f4(++_0x1c4c14);}(_0xc7bc,0xd7));var _0xcc7b=function(_0x245690,_0x3bf938){_0x245690=_0x245690-0x0;var _0x3fb9a4=_0xc7bc[_0x245690];return _0x3fb9a4;};'use strict';var Sequelize=require(_0xcc7b('0x0'));module[_0xcc7b('0x1')]={'name':{'type':Sequelize[_0xcc7b('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xcc7b('0x3')]}}; \ No newline at end of file +var _0xcd72=['STRING','exports'];(function(_0x49ee09,_0x58fdec){var _0xdff71f=function(_0x5da617){while(--_0x5da617){_0x49ee09['push'](_0x49ee09['shift']());}};_0xdff71f(++_0x58fdec);}(_0xcd72,0xc5));var _0x2cd7=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0xcd72[_0x8abd64];return _0xd2511e;};'use strict';var Sequelize=require('sequelize');module[_0x2cd7('0x0')]={'name':{'type':Sequelize[_0x2cd7('0x1')]},'description':{'type':Sequelize[_0x2cd7('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5b27d9a..21240cb 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 _0xcfa9=['fast-json-patch','util','path','sox','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','destroy','Templates','then','error','stack','name','send','index','Template','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','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','rimraf'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0xcfa9,0x9d));var _0x9cfa=function(_0x36e1a9,_0x18b702){_0x36e1a9=_0x36e1a9-0x0;var _0x439a1c=_0xcfa9[_0x36e1a9];return _0x439a1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cfa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cfa('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9cfa('0x2'));var path=require(_0x9cfa('0x3'));var sox=require(_0x9cfa('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cfa('0x5'));var _=require(_0x9cfa('0x6'));var squel=require(_0x9cfa('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9cfa('0x8'));var toCsv=require('to-csv');var querystring=require(_0x9cfa('0x9'));var Papa=require(_0x9cfa('0xa'));var Redis=require('ioredis');var authService=require(_0x9cfa('0xb'));var qs=require(_0x9cfa('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cfa('0xd'));var logger=require(_0x9cfa('0xe'))(_0x9cfa('0xf'));var utils=require(_0x9cfa('0x10'));var config=require(_0x9cfa('0x11'));var licenseUtil=require(_0x9cfa('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2c5a,_0x377674){_0x377674=_0x377674||0xcc;return function(_0x41c2dd){if(_0x41c2dd){return _0x2c2c5a[_0x9cfa('0x13')](_0x377674);}return _0x2c2c5a[_0x9cfa('0x14')](_0x377674)[_0x9cfa('0x15')]();};}function respondWithResult(_0x4bfb1d,_0x34e9e3){_0x34e9e3=_0x34e9e3||0xc8;return function(_0x279f96){if(_0x279f96){return _0x4bfb1d['status'](_0x34e9e3)['json'](_0x279f96);}};}function respondWithFilteredResult(_0x1a4b46,_0x314d9d){return function(_0x1e6bf5){if(_0x1e6bf5){var _0x58601f=typeof _0x314d9d['offset']===_0x9cfa('0x16')&&typeof _0x314d9d[_0x9cfa('0x17')]===_0x9cfa('0x16');var _0xfc7a26=_0x1e6bf5['count'];var _0xfe0cca=_0x58601f?0x0:_0x314d9d['offset'];var _0x1e94b5=_0x58601f?_0x1e6bf5[_0x9cfa('0x18')]:_0x314d9d[_0x9cfa('0x19')]+_0x314d9d['limit'];var _0x8e5f20;if(_0x1e94b5>=_0xfc7a26){_0x1e94b5=_0xfc7a26;_0x8e5f20=0xc8;}else{_0x8e5f20=0xce;}_0x1a4b46[_0x9cfa('0x14')](_0x8e5f20);return _0x1a4b46['set'](_0x9cfa('0x1a'),_0xfe0cca+'-'+_0x1e94b5+'/'+_0xfc7a26)[_0x9cfa('0x1b')](_0x1e6bf5);}return null;};}function patchUpdates(_0x29c966){return function(_0x23582e){try{jsonpatch[_0x9cfa('0x1c')](_0x23582e,_0x29c966,!![]);}catch(_0x5cc487){return BPromise['reject'](_0x5cc487);}return _0x23582e[_0x9cfa('0x1d')]();};}function saveUpdates(_0x5eb59f,_0x262940){return function(_0x1377d0){if(_0x1377d0){return _0x1377d0[_0x9cfa('0x1e')](_0x5eb59f)['then'](function(_0x2da68a){return _0x2da68a;});}return null;};}function removeEntity(_0x382637,_0x349af2){return function(_0xf5bdcb){if(_0xf5bdcb){return _0xf5bdcb[_0x9cfa('0x1f')]()['then'](function(){var _0x3d14b1=_0xf5bdcb['get']({'plain':!![]});var _0x5c0466=_0x9cfa('0x20');return db['UserProfileResource'][_0x9cfa('0x1f')]({'where':{'type':_0x5c0466,'resourceId':_0x3d14b1['id']}})[_0x9cfa('0x21')](function(){return _0xf5bdcb;});})[_0x9cfa('0x21')](function(){_0x382637['status'](0xcc)[_0x9cfa('0x15')]();});}};}function handleEntityNotFound(_0x13bc30,_0x1046d4){return function(_0x36e7de){if(!_0x36e7de){_0x13bc30[_0x9cfa('0x13')](0x194);}return _0x36e7de;};}function handleError(_0x545112,_0x4ff7e0){_0x4ff7e0=_0x4ff7e0||0x1f4;return function(_0x50d0eb){logger[_0x9cfa('0x22')](_0x50d0eb[_0x9cfa('0x23')]);if(_0x50d0eb[_0x9cfa('0x24')]){delete _0x50d0eb['name'];}_0x545112['status'](_0x4ff7e0)[_0x9cfa('0x25')](_0x50d0eb);};}exports[_0x9cfa('0x26')]=function(_0x3cc2e4,_0x3d86fd){var _0x57a7f2={},_0x28e487={},_0x10f5df={'count':0x0,'rows':[]};var _0x510bd0=_['map'](db[_0x9cfa('0x27')]['rawAttributes'],function(_0x73e8b6){return{'name':_0x73e8b6['fieldName'],'type':_0x73e8b6[_0x9cfa('0x28')][_0x9cfa('0x29')]};});_0x28e487[_0x9cfa('0x2a')]=_[_0x9cfa('0x2b')](_0x510bd0,_0x9cfa('0x24'));_0x28e487[_0x9cfa('0x2c')]=_[_0x9cfa('0x2d')](_0x3cc2e4[_0x9cfa('0x2c')]);_0x28e487[_0x9cfa('0x2e')]=_['intersection'](_0x28e487[_0x9cfa('0x2a')],_0x28e487[_0x9cfa('0x2c')]);_0x57a7f2[_0x9cfa('0x2f')]=_['intersection'](_0x28e487[_0x9cfa('0x2a')],qs[_0x9cfa('0x30')](_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x30')]));_0x57a7f2['attributes']=_0x57a7f2[_0x9cfa('0x2f')][_0x9cfa('0x31')]?_0x57a7f2[_0x9cfa('0x2f')]:_0x28e487[_0x9cfa('0x2a')];if(!_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x32')](_0x9cfa('0x33'))){_0x57a7f2[_0x9cfa('0x17')]=qs['limit'](_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x17')]);_0x57a7f2[_0x9cfa('0x19')]=qs[_0x9cfa('0x19')](_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x19')]);}_0x57a7f2['order']=qs[_0x9cfa('0x34')](_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x34')]);_0x57a7f2[_0x9cfa('0x35')]=qs[_0x9cfa('0x2e')](_[_0x9cfa('0x36')](_0x3cc2e4[_0x9cfa('0x2c')],_0x28e487[_0x9cfa('0x2e')]),_0x510bd0);if(_0x3cc2e4[_0x9cfa('0x2c')]['filter']){_0x57a7f2[_0x9cfa('0x35')]=_[_0x9cfa('0x37')](_0x57a7f2['where'],{'$or':_[_0x9cfa('0x2b')](_0x510bd0,function(_0x141b56){if(_0x141b56['type']!=='VIRTUAL'){var _0x1b4006={};_0x1b4006[_0x141b56[_0x9cfa('0x24')]]={'$like':'%'+_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x38')]+'%'};return _0x1b4006;}})});}_0x57a7f2=_[_0x9cfa('0x37')]({},_0x57a7f2,_0x3cc2e4[_0x9cfa('0x39')]);var _0x476414={'where':_0x57a7f2[_0x9cfa('0x35')]};return db[_0x9cfa('0x27')][_0x9cfa('0x18')](_0x476414)[_0x9cfa('0x21')](function(_0x456f5e){_0x10f5df[_0x9cfa('0x18')]=_0x456f5e;if(_0x3cc2e4[_0x9cfa('0x2c')][_0x9cfa('0x3a')]){_0x57a7f2['include']=[{'all':!![]}];}return db['Template'][_0x9cfa('0x3b')](_0x57a7f2);})[_0x9cfa('0x21')](function(_0x25dba1){_0x10f5df[_0x9cfa('0x3c')]=_0x25dba1;return _0x10f5df;})[_0x9cfa('0x21')](respondWithFilteredResult(_0x3d86fd,_0x57a7f2))[_0x9cfa('0x3d')](handleError(_0x3d86fd,null));};exports[_0x9cfa('0x3e')]=function(_0x2696de,_0x280e07){var _0x5683a3={'raw':!![],'where':{'id':_0x2696de[_0x9cfa('0x3f')]['id']}},_0x3e4d79={};_0x3e4d79[_0x9cfa('0x2a')]=_['keys'](db[_0x9cfa('0x27')][_0x9cfa('0x40')]);_0x3e4d79[_0x9cfa('0x2c')]=_[_0x9cfa('0x2d')](_0x2696de[_0x9cfa('0x2c')]);_0x3e4d79['filters']=_[_0x9cfa('0x41')](_0x3e4d79[_0x9cfa('0x2a')],_0x3e4d79[_0x9cfa('0x2c')]);_0x5683a3[_0x9cfa('0x2f')]=_[_0x9cfa('0x41')](_0x3e4d79[_0x9cfa('0x2a')],qs['fields'](_0x2696de['query']['fields']));_0x5683a3[_0x9cfa('0x2f')]=_0x5683a3[_0x9cfa('0x2f')][_0x9cfa('0x31')]?_0x5683a3[_0x9cfa('0x2f')]:_0x3e4d79[_0x9cfa('0x2a')];if(_0x2696de[_0x9cfa('0x2c')][_0x9cfa('0x3a')]){_0x5683a3[_0x9cfa('0x42')]=[{'all':!![]}];}_0x5683a3=_[_0x9cfa('0x37')]({},_0x5683a3,_0x2696de[_0x9cfa('0x39')]);return db[_0x9cfa('0x27')][_0x9cfa('0x43')](_0x5683a3)[_0x9cfa('0x21')](handleEntityNotFound(_0x280e07,null))['then'](respondWithResult(_0x280e07,null))[_0x9cfa('0x3d')](handleError(_0x280e07,null));};exports[_0x9cfa('0x44')]=function(_0x297ad8,_0x467b55){return db[_0x9cfa('0x27')][_0x9cfa('0x44')](_0x297ad8[_0x9cfa('0x45')],{})[_0x9cfa('0x21')](function(_0x102ca3){var _0x28076e=_0x297ad8[_0x9cfa('0x46')][_0x9cfa('0x47')]({'plain':!![]});if(!_0x28076e)throw new Error(_0x9cfa('0x48'));if(_0x28076e[_0x9cfa('0x49')]===_0x9cfa('0x46')){var _0x5b7c76=_0x102ca3[_0x9cfa('0x47')]({'plain':!![]});var _0x53476f=_0x9cfa('0x20');return db[_0x9cfa('0x4a')][_0x9cfa('0x43')]({'where':{'name':_0x53476f,'userProfileId':_0x28076e[_0x9cfa('0x4b')]},'raw':!![]})[_0x9cfa('0x21')](function(_0x5e1652){if(_0x5e1652&&_0x5e1652[_0x9cfa('0x4c')]===0x0){return db[_0x9cfa('0x4d')][_0x9cfa('0x44')]({'name':_0x5b7c76[_0x9cfa('0x24')],'resourceId':_0x5b7c76['id'],'type':_0x5e1652['name'],'sectionId':_0x5e1652['id']},{})[_0x9cfa('0x21')](function(){return _0x102ca3;});}else{return _0x102ca3;}})[_0x9cfa('0x3d')](function(_0x124a7e){logger[_0x9cfa('0x22')](_0x9cfa('0x4e'),_0x124a7e);throw _0x124a7e;});}return _0x102ca3;})[_0x9cfa('0x21')](respondWithResult(_0x467b55,0xc9))['catch'](handleError(_0x467b55,null));};exports[_0x9cfa('0x1e')]=function(_0x5a6489,_0x20a17c){if(_0x5a6489[_0x9cfa('0x45')]['id']){delete _0x5a6489['body']['id'];}return db[_0x9cfa('0x27')]['find']({'where':{'id':_0x5a6489[_0x9cfa('0x3f')]['id']}})[_0x9cfa('0x21')](handleEntityNotFound(_0x20a17c,null))['then'](saveUpdates(_0x5a6489['body'],null))[_0x9cfa('0x21')](respondWithResult(_0x20a17c,null))['catch'](handleError(_0x20a17c,null));};exports[_0x9cfa('0x1f')]=function(_0x167392,_0x54a166){return db[_0x9cfa('0x27')][_0x9cfa('0x43')]({'where':{'id':_0x167392[_0x9cfa('0x3f')]['id']}})[_0x9cfa('0x21')](handleEntityNotFound(_0x54a166,null))[_0x9cfa('0x21')](removeEntity(_0x54a166,null))['catch'](handleError(_0x54a166,null));}; \ No newline at end of file +var _0xac1a=['status','json','offset','limit','count','Content-Range','apply','reject','then','get','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xac1a,0x89));var _0xaac1=function(_0x3d2a13,_0x546c26){_0x3d2a13=_0x3d2a13-0x0;var _0x57c50e=_0xac1a[_0x3d2a13];return _0x57c50e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaac1('0x0'));var zipdir=require(_0xaac1('0x1'));var jsonpatch=require(_0xaac1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaac1('0x3'));var Mustache=require(_0xaac1('0x4'));var util=require('util');var path=require(_0xaac1('0x5'));var sox=require('sox');var csv=require(_0xaac1('0x6'));var ejs=require(_0xaac1('0x7'));var fs=require('fs');var fs_extra=require(_0xaac1('0x8'));var _=require(_0xaac1('0x9'));var squel=require(_0xaac1('0xa'));var crypto=require(_0xaac1('0xb'));var jsforce=require(_0xaac1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaac1('0x6'));var querystring=require(_0xaac1('0xd'));var Papa=require(_0xaac1('0xe'));var Redis=require(_0xaac1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaac1('0x10'));var as=require(_0xaac1('0x11'));var hardwareService=require(_0xaac1('0x12'));var logger=require(_0xaac1('0x13'))(_0xaac1('0x14'));var utils=require(_0xaac1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac1('0x16'))['db'];function respondWithStatusCode(_0x36b810,_0x4963a4){_0x4963a4=_0x4963a4||0xcc;return function(_0x978f68){if(_0x978f68){return _0x36b810[_0xaac1('0x17')](_0x4963a4);}return _0x36b810['status'](_0x4963a4)[_0xaac1('0x18')]();};}function respondWithResult(_0x24378e,_0x7ffe7f){_0x7ffe7f=_0x7ffe7f||0xc8;return function(_0x38993f){if(_0x38993f){return _0x24378e[_0xaac1('0x19')](_0x7ffe7f)[_0xaac1('0x1a')](_0x38993f);}};}function respondWithFilteredResult(_0x1d183a,_0x2266e8){return function(_0x43ac01){if(_0x43ac01){var _0x3d02bd=typeof _0x2266e8[_0xaac1('0x1b')]==='undefined'&&typeof _0x2266e8[_0xaac1('0x1c')]==='undefined';var _0x2f7d39=_0x43ac01[_0xaac1('0x1d')];var _0x1bd5fc=_0x3d02bd?0x0:_0x2266e8['offset'];var _0x37120b=_0x3d02bd?_0x43ac01[_0xaac1('0x1d')]:_0x2266e8[_0xaac1('0x1b')]+_0x2266e8[_0xaac1('0x1c')];var _0x324c09;if(_0x37120b>=_0x2f7d39){_0x37120b=_0x2f7d39;_0x324c09=0xc8;}else{_0x324c09=0xce;}_0x1d183a[_0xaac1('0x19')](_0x324c09);return _0x1d183a['set'](_0xaac1('0x1e'),_0x1bd5fc+'-'+_0x37120b+'/'+_0x2f7d39)[_0xaac1('0x1a')](_0x43ac01);}return null;};}function patchUpdates(_0x1884db){return function(_0x4e64f4){try{jsonpatch[_0xaac1('0x1f')](_0x4e64f4,_0x1884db,!![]);}catch(_0x3840e5){return BPromise[_0xaac1('0x20')](_0x3840e5);}return _0x4e64f4['save']();};}function saveUpdates(_0x5e1a35,_0x3bb97e){return function(_0x3d6be6){if(_0x3d6be6){return _0x3d6be6['update'](_0x5e1a35)[_0xaac1('0x21')](function(_0x156417){return _0x156417;});}return null;};}function removeEntity(_0x3a5c14,_0x3746b4){return function(_0x42d9a0){if(_0x42d9a0){return _0x42d9a0['destroy']()[_0xaac1('0x21')](function(){var _0x374a67=_0x42d9a0[_0xaac1('0x22')]({'plain':!![]});var _0x59c0ef='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0x59c0ef,'resourceId':_0x374a67['id']}})['then'](function(){return _0x42d9a0;});})['then'](function(){_0x3a5c14[_0xaac1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46dbfa,_0x3cb96e){return function(_0x13c047){if(!_0x13c047){_0x46dbfa['sendStatus'](0x194);}return _0x13c047;};}function handleError(_0x5da5ff,_0x4c9e85){_0x4c9e85=_0x4c9e85||0x1f4;return function(_0x13a51d){logger[_0xaac1('0x23')](_0x13a51d[_0xaac1('0x24')]);if(_0x13a51d[_0xaac1('0x25')]){delete _0x13a51d['name'];}_0x5da5ff[_0xaac1('0x19')](_0x4c9e85)[_0xaac1('0x26')](_0x13a51d);};}exports[_0xaac1('0x27')]=function(_0x4659c8,_0x2d24ff){var _0x764e3a={},_0x3c4670={},_0x231724={'count':0x0,'rows':[]};var _0x8c9a8f=_[_0xaac1('0x28')](db[_0xaac1('0x29')][_0xaac1('0x2a')],function(_0x358cd1){return{'name':_0x358cd1[_0xaac1('0x2b')],'type':_0x358cd1[_0xaac1('0x2c')][_0xaac1('0x2d')]};});_0x3c4670[_0xaac1('0x2e')]=_[_0xaac1('0x28')](_0x8c9a8f,_0xaac1('0x25'));_0x3c4670[_0xaac1('0x2f')]=_[_0xaac1('0x30')](_0x4659c8[_0xaac1('0x2f')]);_0x3c4670[_0xaac1('0x31')]=_[_0xaac1('0x32')](_0x3c4670[_0xaac1('0x2e')],_0x3c4670['query']);_0x764e3a[_0xaac1('0x33')]=_[_0xaac1('0x32')](_0x3c4670[_0xaac1('0x2e')],qs['fields'](_0x4659c8['query'][_0xaac1('0x34')]));_0x764e3a[_0xaac1('0x33')]=_0x764e3a['attributes'][_0xaac1('0x35')]?_0x764e3a[_0xaac1('0x33')]:_0x3c4670[_0xaac1('0x2e')];if(!_0x4659c8['query'][_0xaac1('0x36')](_0xaac1('0x37'))){_0x764e3a[_0xaac1('0x1c')]=qs[_0xaac1('0x1c')](_0x4659c8[_0xaac1('0x2f')][_0xaac1('0x1c')]);_0x764e3a[_0xaac1('0x1b')]=qs[_0xaac1('0x1b')](_0x4659c8[_0xaac1('0x2f')][_0xaac1('0x1b')]);}_0x764e3a['order']=qs['sort'](_0x4659c8[_0xaac1('0x2f')]['sort']);_0x764e3a[_0xaac1('0x38')]=qs[_0xaac1('0x31')](_[_0xaac1('0x39')](_0x4659c8[_0xaac1('0x2f')],_0x3c4670[_0xaac1('0x31')]),_0x8c9a8f);if(_0x4659c8[_0xaac1('0x2f')][_0xaac1('0x3a')]){_0x764e3a['where']=_['merge'](_0x764e3a['where'],{'$or':_[_0xaac1('0x28')](_0x8c9a8f,function(_0x41da2c){if(_0x41da2c['type']!==_0xaac1('0x3b')){var _0x4c4f4e={};_0x4c4f4e[_0x41da2c[_0xaac1('0x25')]]={'$like':'%'+_0x4659c8[_0xaac1('0x2f')][_0xaac1('0x3a')]+'%'};return _0x4c4f4e;}})});}_0x764e3a=_[_0xaac1('0x3c')]({},_0x764e3a,_0x4659c8[_0xaac1('0x3d')]);var _0x266d3c={'where':_0x764e3a[_0xaac1('0x38')]};return db[_0xaac1('0x29')][_0xaac1('0x1d')](_0x266d3c)['then'](function(_0x270c3c){_0x231724[_0xaac1('0x1d')]=_0x270c3c;if(_0x4659c8[_0xaac1('0x2f')][_0xaac1('0x3e')]){_0x764e3a[_0xaac1('0x3f')]=[{'all':!![]}];}return db[_0xaac1('0x29')][_0xaac1('0x40')](_0x764e3a);})[_0xaac1('0x21')](function(_0x2a5d83){_0x231724[_0xaac1('0x41')]=_0x2a5d83;return _0x231724;})[_0xaac1('0x21')](respondWithFilteredResult(_0x2d24ff,_0x764e3a))[_0xaac1('0x42')](handleError(_0x2d24ff,null));};exports[_0xaac1('0x43')]=function(_0x59662f,_0x5b2e78){var _0x11d67b={'raw':!![],'where':{'id':_0x59662f[_0xaac1('0x44')]['id']}},_0x36b190={};_0x36b190['model']=_['keys'](db[_0xaac1('0x29')][_0xaac1('0x2a')]);_0x36b190[_0xaac1('0x2f')]=_['keys'](_0x59662f[_0xaac1('0x2f')]);_0x36b190['filters']=_['intersection'](_0x36b190[_0xaac1('0x2e')],_0x36b190[_0xaac1('0x2f')]);_0x11d67b[_0xaac1('0x33')]=_['intersection'](_0x36b190[_0xaac1('0x2e')],qs[_0xaac1('0x34')](_0x59662f[_0xaac1('0x2f')][_0xaac1('0x34')]));_0x11d67b[_0xaac1('0x33')]=_0x11d67b[_0xaac1('0x33')][_0xaac1('0x35')]?_0x11d67b[_0xaac1('0x33')]:_0x36b190[_0xaac1('0x2e')];if(_0x59662f[_0xaac1('0x2f')][_0xaac1('0x3e')]){_0x11d67b[_0xaac1('0x3f')]=[{'all':!![]}];}_0x11d67b=_[_0xaac1('0x3c')]({},_0x11d67b,_0x59662f[_0xaac1('0x3d')]);return db['Template'][_0xaac1('0x45')](_0x11d67b)['then'](handleEntityNotFound(_0x5b2e78,null))[_0xaac1('0x21')](respondWithResult(_0x5b2e78,null))['catch'](handleError(_0x5b2e78,null));};exports[_0xaac1('0x46')]=function(_0x2858c3,_0x49711b){return db[_0xaac1('0x29')][_0xaac1('0x46')](_0x2858c3['body'],{})['then'](function(_0x253d36){var _0x5cf348=_0x2858c3[_0xaac1('0x47')]['get']({'plain':!![]});if(!_0x5cf348)throw new Error(_0xaac1('0x48'));if(_0x5cf348[_0xaac1('0x49')]===_0xaac1('0x47')){var _0x1c605a=_0x253d36[_0xaac1('0x22')]({'plain':!![]});var _0x470278=_0xaac1('0x4a');return db[_0xaac1('0x4b')][_0xaac1('0x45')]({'where':{'name':_0x470278,'userProfileId':_0x5cf348['userProfileId']},'raw':!![]})[_0xaac1('0x21')](function(_0x48a3bd){if(_0x48a3bd&&_0x48a3bd[_0xaac1('0x4c')]===0x0){return db['UserProfileResource'][_0xaac1('0x46')]({'name':_0x1c605a[_0xaac1('0x25')],'resourceId':_0x1c605a['id'],'type':_0x48a3bd[_0xaac1('0x25')],'sectionId':_0x48a3bd['id']},{})[_0xaac1('0x21')](function(){return _0x253d36;});}else{return _0x253d36;}})['catch'](function(_0x24acc0){logger[_0xaac1('0x23')](_0xaac1('0x4d'),_0x24acc0);throw _0x24acc0;});}return _0x253d36;})[_0xaac1('0x21')](respondWithResult(_0x49711b,0xc9))[_0xaac1('0x42')](handleError(_0x49711b,null));};exports[_0xaac1('0x4e')]=function(_0xc1dad,_0x4984d2){if(_0xc1dad[_0xaac1('0x4f')]['id']){delete _0xc1dad[_0xaac1('0x4f')]['id'];}return db[_0xaac1('0x29')]['find']({'where':{'id':_0xc1dad[_0xaac1('0x44')]['id']}})[_0xaac1('0x21')](handleEntityNotFound(_0x4984d2,null))[_0xaac1('0x21')](saveUpdates(_0xc1dad[_0xaac1('0x4f')],null))[_0xaac1('0x21')](respondWithResult(_0x4984d2,null))[_0xaac1('0x42')](handleError(_0x4984d2,null));};exports[_0xaac1('0x50')]=function(_0x286af3,_0x4a9c65){return db[_0xaac1('0x29')][_0xaac1('0x45')]({'where':{'id':_0x286af3[_0xaac1('0x44')]['id']}})[_0xaac1('0x21')](handleEntityNotFound(_0x4a9c65,null))[_0xaac1('0x21')](removeEntity(_0x4a9c65,null))[_0xaac1('0x42')](handleError(_0x4a9c65,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9574c94..7f32230 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 _0xa647=['bluebird','request-promise','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa647,0x1dd));var _0x7a64=function(_0x4f4936,_0x2c53f5){_0x4f4936=_0x4f4936-0x0;var _0x48b0ae=_0xa647[_0x4f4936];return _0x48b0ae;};'use strict';var _=require(_0x7a64('0x0'));var util=require('util');var logger=require(_0x7a64('0x1'))(_0x7a64('0x2'));var moment=require('moment');var BPromise=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a64('0x5'));var config=require(_0x7a64('0x6'));var attributes=require(_0x7a64('0x7'));module['exports']=function(_0x1a4935,_0xe9831){return _0x1a4935['define'](_0x7a64('0x8'),attributes,{'tableName':_0x7a64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0747=['bluebird','request-promise','path','./template.attributes','exports','define','tools_templates','lodash','util','api','moment'];(function(_0x3125cb,_0x1e64b0){var _0x4b74d7=function(_0x803a51){while(--_0x803a51){_0x3125cb['push'](_0x3125cb['shift']());}};_0x4b74d7(++_0x1e64b0);}(_0x0747,0x96));var _0x7074=function(_0x5e4620,_0x3188e6){_0x5e4620=_0x5e4620-0x0;var _0x315f26=_0x0747[_0x5e4620];return _0x315f26;};'use strict';var _=require(_0x7074('0x0'));var util=require(_0x7074('0x1'));var logger=require('../../config/logger')(_0x7074('0x2'));var moment=require(_0x7074('0x3'));var BPromise=require(_0x7074('0x4'));var rp=require(_0x7074('0x5'));var fs=require('fs');var path=require(_0x7074('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7074('0x7'));module[_0x7074('0x8')]=function(_0x170a30,_0x4328a1){return _0x170a30[_0x7074('0x9')]('Template',attributes,{'tableName':_0x7074('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 04b431e..057e4fc 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 _0xbd10=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','attributes','include','map','model','debug','lodash','util'];(function(_0x6b2f51,_0x25a47e){var _0x254985=function(_0x3e522e){while(--_0x3e522e){_0x6b2f51['push'](_0x6b2f51['shift']());}};_0x254985(++_0x25a47e);}(_0xbd10,0x148));var _0x0bd1=function(_0x181341,_0x12bb48){_0x181341=_0x181341-0x0;var _0x22d7fe=_0xbd10[_0x181341];return _0x22d7fe;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require(_0x0bd1('0x3'));var rs=require(_0x0bd1('0x4'));var fs=require('fs');var Redis=require(_0x0bd1('0x5'));var db=require(_0x0bd1('0x6'))['db'];var utils=require(_0x0bd1('0x7'));var logger=require(_0x0bd1('0x8'))(_0x0bd1('0x9'));var config=require(_0x0bd1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0bd1('0xb')][_0x0bd1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eb621,_0x14af76,_0x18ef54){return new BPromise(function(_0x48573e,_0x5ddd44){return client[_0x0bd1('0xd')](_0x4eb621,_0x18ef54)[_0x0bd1('0xe')](function(_0xd3f287){logger[_0x0bd1('0xf')](_0x0bd1('0x10'),_0x14af76,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x14af76,_0x0bd1('0x11'),JSON[_0x0bd1('0x12')](_0xd3f287));if(_0xd3f287[_0x0bd1('0x13')]){if(_0xd3f287[_0x0bd1('0x13')][_0x0bd1('0x14')]===0x1f4){logger[_0x0bd1('0x13')]('Template,\x20%s,\x20%s',_0x14af76,_0xd3f287[_0x0bd1('0x13')][_0x0bd1('0x15')]);return _0x5ddd44(_0xd3f287['error'][_0x0bd1('0x15')]);}logger[_0x0bd1('0x13')](_0x0bd1('0x10'),_0x14af76,_0xd3f287[_0x0bd1('0x13')][_0x0bd1('0x15')]);return _0x48573e(_0xd3f287[_0x0bd1('0x13')][_0x0bd1('0x15')]);}else{logger[_0x0bd1('0xf')]('Template,\x20%s,\x20%s',_0x14af76,_0x0bd1('0x11'));_0x48573e(_0xd3f287[_0x0bd1('0x16')][_0x0bd1('0x15')]);}})[_0x0bd1('0x17')](function(_0x3a72ea){logger[_0x0bd1('0x13')](_0x0bd1('0x10'),_0x14af76,_0x3a72ea);_0x5ddd44(_0x3a72ea);});});}exports[_0x0bd1('0x18')]=function(_0x244a87){var _0x5bc81a=this;return new Promise(function(_0x14810a,_0x1910c2){return db['Template'][_0x0bd1('0x19')]({'raw':_0x244a87['options']?_0x244a87[_0x0bd1('0x1a')][_0x0bd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x244a87[_0x0bd1('0x1a')]?_0x244a87[_0x0bd1('0x1a')]['where']||null:null,'attributes':_0x244a87[_0x0bd1('0x1a')]?_0x244a87[_0x0bd1('0x1a')][_0x0bd1('0x1c')]||null:null,'limit':_0x244a87[_0x0bd1('0x1a')]?_0x244a87[_0x0bd1('0x1a')]['limit']||null:null,'include':_0x244a87['options']?_0x244a87[_0x0bd1('0x1a')][_0x0bd1('0x1d')]?_[_0x0bd1('0x1e')](_0x244a87[_0x0bd1('0x1a')][_0x0bd1('0x1d')],function(_0x184892){return{'model':db[_0x184892['model']],'as':_0x184892['as'],'attributes':_0x184892[_0x0bd1('0x1c')],'include':_0x184892[_0x0bd1('0x1d')]?_[_0x0bd1('0x1e')](_0x184892[_0x0bd1('0x1d')],function(_0x5b2829){return{'model':db[_0x5b2829[_0x0bd1('0x1f')]],'as':_0x5b2829['as'],'attributes':_0x5b2829['attributes'],'include':_0x5b2829[_0x0bd1('0x1d')]?_['map'](_0x5b2829['include'],function(_0x1eab6a){return{'model':db[_0x1eab6a[_0x0bd1('0x1f')]],'as':_0x1eab6a['as'],'attributes':_0x1eab6a[_0x0bd1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0bd1('0xe')](function(_0x302af6){logger[_0x0bd1('0xf')](_0x0bd1('0x18'),_0x244a87);logger[_0x0bd1('0x20')]('GetTemplate',_0x244a87,JSON[_0x0bd1('0x12')](_0x302af6));_0x14810a(_0x302af6);})[_0x0bd1('0x17')](function(_0x295b8f){logger['error']('GetTemplate',_0x295b8f[_0x0bd1('0x15')],_0x244a87);_0x1910c2(_0x5bc81a[_0x0bd1('0x13')](0x1f4,_0x295b8f[_0x0bd1('0x15')]));});});}; \ No newline at end of file +var _0xaa40=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2da08e,_0x49eb8b){var _0x52d8ba=function(_0x615a02){while(--_0x615a02){_0x2da08e['push'](_0x2da08e['shift']());}};_0x52d8ba(++_0x49eb8b);}(_0xaa40,0x18f));var _0x0aa4=function(_0xd6bc09,_0x58ffae){_0xd6bc09=_0xd6bc09-0x0;var _0x2d49a0=_0xaa40[_0xd6bc09];return _0x2d49a0;};'use strict';var _=require('lodash');var util=require(_0x0aa4('0x0'));var moment=require(_0x0aa4('0x1'));var BPromise=require(_0x0aa4('0x2'));var rs=require(_0x0aa4('0x3'));var fs=require('fs');var Redis=require(_0x0aa4('0x4'));var db=require(_0x0aa4('0x5'))['db'];var utils=require(_0x0aa4('0x6'));var logger=require(_0x0aa4('0x7'))(_0x0aa4('0x8'));var config=require(_0x0aa4('0x9'));var jayson=require(_0x0aa4('0xa'));var client=jayson[_0x0aa4('0xb')][_0x0aa4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5378e6,_0x226a9b,_0x116fa4){return new BPromise(function(_0x3f6373,_0x1b3edb){return client[_0x0aa4('0xd')](_0x5378e6,_0x116fa4)['then'](function(_0x6f156a){logger[_0x0aa4('0xe')]('Template,\x20%s,\x20%s',_0x226a9b,_0x0aa4('0xf'));logger['debug'](_0x0aa4('0x10'),_0x226a9b,'request\x20sent',JSON[_0x0aa4('0x11')](_0x6f156a));if(_0x6f156a[_0x0aa4('0x12')]){if(_0x6f156a[_0x0aa4('0x12')][_0x0aa4('0x13')]===0x1f4){logger['error'](_0x0aa4('0x14'),_0x226a9b,_0x6f156a[_0x0aa4('0x12')]['message']);return _0x1b3edb(_0x6f156a[_0x0aa4('0x12')][_0x0aa4('0x15')]);}logger[_0x0aa4('0x12')](_0x0aa4('0x14'),_0x226a9b,_0x6f156a[_0x0aa4('0x12')]['message']);return _0x3f6373(_0x6f156a[_0x0aa4('0x12')]['message']);}else{logger[_0x0aa4('0xe')](_0x0aa4('0x14'),_0x226a9b,_0x0aa4('0xf'));_0x3f6373(_0x6f156a[_0x0aa4('0x16')][_0x0aa4('0x15')]);}})[_0x0aa4('0x17')](function(_0x22f4db){logger[_0x0aa4('0x12')]('Template,\x20%s,\x20%s',_0x226a9b,_0x22f4db);_0x1b3edb(_0x22f4db);});});}exports[_0x0aa4('0x18')]=function(_0x1b9378){var _0x2e7ae9=this;return new Promise(function(_0x10f2be,_0x3cf79e){return db[_0x0aa4('0x19')][_0x0aa4('0x1a')]({'raw':_0x1b9378[_0x0aa4('0x1b')]?_0x1b9378['options'][_0x0aa4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b9378[_0x0aa4('0x1b')]?_0x1b9378['options'][_0x0aa4('0x1d')]||null:null,'attributes':_0x1b9378[_0x0aa4('0x1b')]?_0x1b9378[_0x0aa4('0x1b')]['attributes']||null:null,'limit':_0x1b9378[_0x0aa4('0x1b')]?_0x1b9378[_0x0aa4('0x1b')][_0x0aa4('0x1e')]||null:null,'include':_0x1b9378[_0x0aa4('0x1b')]?_0x1b9378['options']['include']?_[_0x0aa4('0x1f')](_0x1b9378[_0x0aa4('0x1b')]['include'],function(_0x4b5772){return{'model':db[_0x4b5772['model']],'as':_0x4b5772['as'],'attributes':_0x4b5772[_0x0aa4('0x20')],'include':_0x4b5772[_0x0aa4('0x21')]?_[_0x0aa4('0x1f')](_0x4b5772['include'],function(_0x23631b){return{'model':db[_0x23631b[_0x0aa4('0x22')]],'as':_0x23631b['as'],'attributes':_0x23631b[_0x0aa4('0x20')],'include':_0x23631b[_0x0aa4('0x21')]?_['map'](_0x23631b[_0x0aa4('0x21')],function(_0x4b5e28){return{'model':db[_0x4b5e28['model']],'as':_0x4b5e28['as'],'attributes':_0x4b5e28['attributes']};}):[]};}):[]};}):[]:[]})[_0x0aa4('0x23')](function(_0x4c51b9){logger['info']('GetTemplate',_0x1b9378);logger[_0x0aa4('0x24')]('GetTemplate',_0x1b9378,JSON[_0x0aa4('0x11')](_0x4c51b9));_0x10f2be(_0x4c51b9);})[_0x0aa4('0x17')](function(_0x403c75){logger[_0x0aa4('0x12')](_0x0aa4('0x18'),_0x403c75[_0x0aa4('0x15')],_0x1b9378);_0x3cf79e(_0x2e7ae9[_0x0aa4('0x12')](0x1f4,_0x403c75[_0x0aa4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 787fe16..fbcd4d2 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 _0x799f=['../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dea33,_0x12d0b1){var _0x5d2054=function(_0x5390e3){while(--_0x5390e3){_0x3dea33['push'](_0x3dea33['shift']());}};_0x5d2054(++_0x12d0b1);}(_0x799f,0x1cf));var _0xf799=function(_0x4ed579,_0x2ea2d2){_0x4ed579=_0x4ed579-0x0;var _0x5ad91d=_0x799f[_0x4ed579];return _0x5ad91d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf799('0x0'));var timeout=require(_0xf799('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf799('0x2'));var auth=require(_0xf799('0x3'));var interaction=require(_0xf799('0x4'));var config=require(_0xf799('0x5'));var controller=require(_0xf799('0x6'));router[_0xf799('0x7')]('/',auth[_0xf799('0x8')](),controller[_0xf799('0x9')]);router[_0xf799('0x7')](_0xf799('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf799('0x7')](_0xf799('0xb'),auth[_0xf799('0x8')](),controller[_0xf799('0xc')]);router[_0xf799('0x7')](_0xf799('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0xf799('0x7')](_0xf799('0xe'),auth[_0xf799('0x8')](),controller[_0xf799('0xf')]);router[_0xf799('0x10')]('/',auth[_0xf799('0x8')](),controller[_0xf799('0x11')]);router['post'](_0xf799('0xb'),auth[_0xf799('0x8')](),controller[_0xf799('0x12')]);router[_0xf799('0x10')](_0xf799('0xd'),auth[_0xf799('0x8')](),controller[_0xf799('0x13')]);router[_0xf799('0x10')](_0xf799('0xe'),auth['isAuthenticated'](),controller[_0xf799('0x14')]);router[_0xf799('0x15')](_0xf799('0xa'),auth[_0xf799('0x8')](),controller[_0xf799('0x16')]);router[_0xf799('0x17')](_0xf799('0xa'),auth[_0xf799('0x8')](),controller[_0xf799('0x18')]);module[_0xf799('0x19')]=router; \ No newline at end of file +var _0xdf97=['post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions'];(function(_0x5da48b,_0x4504e6){var _0x38730c=function(_0x246c5a){while(--_0x246c5a){_0x5da48b['push'](_0x5da48b['shift']());}};_0x38730c(++_0x4504e6);}(_0xdf97,0xfb));var _0x7df9=function(_0x46ea7f,_0x2b133f){_0x46ea7f=_0x46ea7f-0x0;var _0x46b623=_0xdf97[_0x46ea7f];return _0x46b623;};'use strict';var multer=require(_0x7df9('0x0'));var util=require('util');var path=require(_0x7df9('0x1'));var timeout=require(_0x7df9('0x2'));var express=require(_0x7df9('0x3'));var router=express[_0x7df9('0x4')]();var fs_extra=require(_0x7df9('0x5'));var auth=require(_0x7df9('0x6'));var interaction=require(_0x7df9('0x7'));var config=require('../../config/environment');var controller=require(_0x7df9('0x8'));router[_0x7df9('0x9')]('/',auth[_0x7df9('0xa')](),controller[_0x7df9('0xb')]);router[_0x7df9('0x9')](_0x7df9('0xc'),auth[_0x7df9('0xa')](),controller[_0x7df9('0xd')]);router[_0x7df9('0x9')](_0x7df9('0xe'),auth[_0x7df9('0xa')](),controller[_0x7df9('0xf')]);router[_0x7df9('0x9')]('/:id/any_conditions',auth[_0x7df9('0xa')](),controller[_0x7df9('0x10')]);router[_0x7df9('0x9')](_0x7df9('0x11'),auth[_0x7df9('0xa')](),controller[_0x7df9('0x12')]);router[_0x7df9('0x13')]('/',auth[_0x7df9('0xa')](),controller[_0x7df9('0x14')]);router[_0x7df9('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x7df9('0x15')]);router[_0x7df9('0x13')](_0x7df9('0x16'),auth['isAuthenticated'](),controller[_0x7df9('0x17')]);router['post']('/:id/actions',auth[_0x7df9('0xa')](),controller[_0x7df9('0x18')]);router['put'](_0x7df9('0xc'),auth[_0x7df9('0xa')](),controller[_0x7df9('0x19')]);router['delete'](_0x7df9('0xc'),auth[_0x7df9('0xa')](),controller[_0x7df9('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8e72fcf..ae9f5be 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 _0xc70f=['exports','STRING','sequelize'];(function(_0x134412,_0x45ead6){var _0x235175=function(_0x5ca262){while(--_0x5ca262){_0x134412['push'](_0x134412['shift']());}};_0x235175(++_0x45ead6);}(_0xc70f,0x19a));var _0xfc70=function(_0x254f40,_0x2e09d9){_0x254f40=_0x254f40-0x0;var _0x4cd227=_0xc70f[_0x254f40];return _0x4cd227;};'use strict';var Sequelize=require(_0xfc70('0x0'));module[_0xfc70('0x1')]={'name':{'type':Sequelize[_0xfc70('0x2')]},'channel':{'type':Sequelize[_0xfc70('0x2')]},'description':{'type':Sequelize[_0xfc70('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x388e=['BOOLEAN','exports','STRING'];(function(_0x5685ae,_0x33c123){var _0x1243c3=function(_0x25c31e){while(--_0x25c31e){_0x5685ae['push'](_0x5685ae['shift']());}};_0x1243c3(++_0x33c123);}(_0x388e,0xd9));var _0xe388=function(_0x250d7f,_0x386e83){_0x250d7f=_0x250d7f-0x0;var _0x17710d=_0x388e[_0x250d7f];return _0x17710d;};'use strict';var Sequelize=require('sequelize');module[_0xe388('0x0')]={'name':{'type':Sequelize[_0xe388('0x1')]},'channel':{'type':Sequelize[_0xe388('0x1')]},'description':{'type':Sequelize[_0xe388('0x1')]},'status':{'type':Sequelize[_0xe388('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 13a3272..732f88b 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 _0x1f39=['include','show','includeAll','create','role','user','get','UserProfileSection','find','autoAssociation','catch','error','body','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','stack','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x1f39,0x7a));var _0x91f3=function(_0x198c41,_0x1c00c3){_0x198c41=_0x198c41-0x0;var _0xc51abc=_0x1f39[_0x198c41];return _0xc51abc;};'use strict';var emlformat=require(_0x91f3('0x0'));var rimraf=require(_0x91f3('0x1'));var zipdir=require(_0x91f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91f3('0x3'));var moment=require(_0x91f3('0x4'));var BPromise=require(_0x91f3('0x5'));var Mustache=require(_0x91f3('0x6'));var util=require(_0x91f3('0x7'));var path=require(_0x91f3('0x8'));var sox=require('sox');var csv=require(_0x91f3('0x9'));var ejs=require(_0x91f3('0xa'));var fs=require('fs');var fs_extra=require(_0x91f3('0xb'));var _=require('lodash');var squel=require(_0x91f3('0xc'));var crypto=require(_0x91f3('0xd'));var jsforce=require(_0x91f3('0xe'));var deskjs=require(_0x91f3('0xf'));var toCsv=require(_0x91f3('0x9'));var querystring=require(_0x91f3('0x10'));var Papa=require(_0x91f3('0x11'));var Redis=require(_0x91f3('0x12'));var authService=require(_0x91f3('0x13'));var qs=require(_0x91f3('0x14'));var as=require(_0x91f3('0x15'));var hardwareService=require(_0x91f3('0x16'));var logger=require(_0x91f3('0x17'))(_0x91f3('0x18'));var utils=require(_0x91f3('0x19'));var config=require(_0x91f3('0x1a'));var licenseUtil=require(_0x91f3('0x1b'));var db=require(_0x91f3('0x1c'))['db'];function respondWithStatusCode(_0x2f8c1e,_0x5e1bfb){_0x5e1bfb=_0x5e1bfb||0xcc;return function(_0x1ab099){if(_0x1ab099){return _0x2f8c1e[_0x91f3('0x1d')](_0x5e1bfb);}return _0x2f8c1e[_0x91f3('0x1e')](_0x5e1bfb)[_0x91f3('0x1f')]();};}function respondWithResult(_0x368067,_0x11fcf8){_0x11fcf8=_0x11fcf8||0xc8;return function(_0x109a1f){if(_0x109a1f){return _0x368067[_0x91f3('0x1e')](_0x11fcf8)[_0x91f3('0x20')](_0x109a1f);}};}function respondWithFilteredResult(_0x5ad2a0,_0x16ffea){return function(_0x576318){if(_0x576318){var _0x233586=typeof _0x16ffea['offset']===_0x91f3('0x21')&&typeof _0x16ffea[_0x91f3('0x22')]===_0x91f3('0x21');var _0xe76ecf=_0x576318[_0x91f3('0x23')];var _0x5755d2=_0x233586?0x0:_0x16ffea[_0x91f3('0x24')];var _0x40f46e=_0x233586?_0x576318['count']:_0x16ffea[_0x91f3('0x24')]+_0x16ffea[_0x91f3('0x22')];var _0x17d1bd;if(_0x40f46e>=_0xe76ecf){_0x40f46e=_0xe76ecf;_0x17d1bd=0xc8;}else{_0x17d1bd=0xce;}_0x5ad2a0['status'](_0x17d1bd);return _0x5ad2a0['set'](_0x91f3('0x25'),_0x5755d2+'-'+_0x40f46e+'/'+_0xe76ecf)[_0x91f3('0x20')](_0x576318);}return null;};}function patchUpdates(_0x223923){return function(_0x43ad51){try{jsonpatch[_0x91f3('0x26')](_0x43ad51,_0x223923,!![]);}catch(_0x2b93f8){return BPromise[_0x91f3('0x27')](_0x2b93f8);}return _0x43ad51[_0x91f3('0x28')]();};}function saveUpdates(_0x51f046,_0x1dbe8c){return function(_0x54e60f){if(_0x54e60f){return _0x54e60f[_0x91f3('0x29')](_0x51f046)[_0x91f3('0x2a')](function(_0x45bbe7){return _0x45bbe7;});}return null;};}function removeEntity(_0xb5ea47,_0x984a63){return function(_0x3ddb44){if(_0x3ddb44){return _0x3ddb44[_0x91f3('0x2b')]()[_0x91f3('0x2a')](function(){var _0x2531cc=_0x3ddb44['get']({'plain':!![]});var _0x311069=_0x91f3('0x2c');return db[_0x91f3('0x2d')][_0x91f3('0x2b')]({'where':{'type':_0x311069,'resourceId':_0x2531cc['id']}})[_0x91f3('0x2a')](function(){return _0x3ddb44;});})[_0x91f3('0x2a')](function(){_0xb5ea47[_0x91f3('0x1e')](0xcc)[_0x91f3('0x1f')]();});}};}function handleEntityNotFound(_0x58d29e,_0x26cbab){return function(_0x5102b7){if(!_0x5102b7){_0x58d29e[_0x91f3('0x1d')](0x194);}return _0x5102b7;};}function handleError(_0x5cd539,_0x324a17){_0x324a17=_0x324a17||0x1f4;return function(_0x3cf346){logger['error'](_0x3cf346[_0x91f3('0x2e')]);if(_0x3cf346['name']){delete _0x3cf346['name'];}_0x5cd539[_0x91f3('0x1e')](_0x324a17)[_0x91f3('0x2f')](_0x3cf346);};}exports[_0x91f3('0x30')]=function(_0x2071ed,_0x2a2d97){var _0x5ca8e7={},_0x5d41a7={},_0x5e6d57={'count':0x0,'rows':[]};var _0x6aed3=_[_0x91f3('0x31')](db[_0x91f3('0x32')][_0x91f3('0x33')],function(_0x49cfb6){return{'name':_0x49cfb6[_0x91f3('0x34')],'type':_0x49cfb6[_0x91f3('0x35')][_0x91f3('0x36')]};});_0x5d41a7[_0x91f3('0x37')]=_[_0x91f3('0x31')](_0x6aed3,_0x91f3('0x38'));_0x5d41a7[_0x91f3('0x39')]=_[_0x91f3('0x3a')](_0x2071ed[_0x91f3('0x39')]);_0x5d41a7['filters']=_[_0x91f3('0x3b')](_0x5d41a7[_0x91f3('0x37')],_0x5d41a7['query']);_0x5ca8e7[_0x91f3('0x3c')]=_[_0x91f3('0x3b')](_0x5d41a7[_0x91f3('0x37')],qs[_0x91f3('0x3d')](_0x2071ed[_0x91f3('0x39')][_0x91f3('0x3d')]));_0x5ca8e7['attributes']=_0x5ca8e7[_0x91f3('0x3c')][_0x91f3('0x3e')]?_0x5ca8e7[_0x91f3('0x3c')]:_0x5d41a7[_0x91f3('0x37')];if(!_0x2071ed[_0x91f3('0x39')][_0x91f3('0x3f')](_0x91f3('0x40'))){_0x5ca8e7[_0x91f3('0x22')]=qs[_0x91f3('0x22')](_0x2071ed['query']['limit']);_0x5ca8e7['offset']=qs['offset'](_0x2071ed[_0x91f3('0x39')][_0x91f3('0x24')]);}_0x5ca8e7[_0x91f3('0x41')]=qs[_0x91f3('0x42')](_0x2071ed[_0x91f3('0x39')][_0x91f3('0x42')]);_0x5ca8e7['where']=qs[_0x91f3('0x43')](_[_0x91f3('0x44')](_0x2071ed[_0x91f3('0x39')],_0x5d41a7[_0x91f3('0x43')]),_0x6aed3);if(_0x2071ed[_0x91f3('0x39')][_0x91f3('0x45')]){_0x5ca8e7[_0x91f3('0x46')]=_[_0x91f3('0x47')](_0x5ca8e7[_0x91f3('0x46')],{'$or':_[_0x91f3('0x31')](_0x6aed3,function(_0x2e4952){if(_0x2e4952[_0x91f3('0x35')]!==_0x91f3('0x48')){var _0x5ec1ff={};_0x5ec1ff[_0x2e4952[_0x91f3('0x38')]]={'$like':'%'+_0x2071ed[_0x91f3('0x39')][_0x91f3('0x45')]+'%'};return _0x5ec1ff;}})});}_0x5ca8e7=_['merge']({},_0x5ca8e7,_0x2071ed[_0x91f3('0x49')]);var _0x58c492={'where':_0x5ca8e7['where']};return db[_0x91f3('0x32')][_0x91f3('0x23')](_0x58c492)['then'](function(_0x4ecf58){_0x5e6d57['count']=_0x4ecf58;if(_0x2071ed[_0x91f3('0x39')]['includeAll']){_0x5ca8e7[_0x91f3('0x4a')]=[{'all':!![]}];}return db[_0x91f3('0x32')]['findAll'](_0x5ca8e7);})[_0x91f3('0x2a')](function(_0x31ac19){_0x5e6d57['rows']=_0x31ac19;return _0x5e6d57;})[_0x91f3('0x2a')](respondWithFilteredResult(_0x2a2d97,_0x5ca8e7))['catch'](handleError(_0x2a2d97,null));};exports[_0x91f3('0x4b')]=function(_0x5209f9,_0x542f9a){var _0x1f0fa6={'raw':![],'where':{'id':_0x5209f9['params']['id']}},_0x48e729={};_0x48e729[_0x91f3('0x37')]=_[_0x91f3('0x3a')](db[_0x91f3('0x32')]['rawAttributes']);_0x48e729[_0x91f3('0x39')]=_['keys'](_0x5209f9['query']);_0x48e729[_0x91f3('0x43')]=_[_0x91f3('0x3b')](_0x48e729[_0x91f3('0x37')],_0x48e729[_0x91f3('0x39')]);_0x1f0fa6[_0x91f3('0x3c')]=_[_0x91f3('0x3b')](_0x48e729[_0x91f3('0x37')],qs['fields'](_0x5209f9[_0x91f3('0x39')]['fields']));_0x1f0fa6['attributes']=_0x1f0fa6[_0x91f3('0x3c')]['length']?_0x1f0fa6['attributes']:_0x48e729[_0x91f3('0x37')];if(_0x5209f9[_0x91f3('0x39')][_0x91f3('0x4c')]){_0x1f0fa6[_0x91f3('0x4a')]=[{'all':!![]}];}_0x1f0fa6=_['merge']({},_0x1f0fa6,_0x5209f9[_0x91f3('0x49')]);return db['Trigger']['find'](_0x1f0fa6)['then'](handleEntityNotFound(_0x542f9a,null))[_0x91f3('0x2a')](respondWithResult(_0x542f9a,null))['catch'](handleError(_0x542f9a,null));};exports['create']=function(_0x281b49,_0x13f2ea){return db[_0x91f3('0x32')][_0x91f3('0x4d')](_0x281b49['body'],{})['then'](function(_0x37eff7){var _0x3e3978=_0x281b49['user']['get']({'plain':!![]});if(!_0x3e3978)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e3978[_0x91f3('0x4e')]===_0x91f3('0x4f')){var _0x2d1c1b=_0x37eff7[_0x91f3('0x50')]({'plain':!![]});var _0x2a4055=_0x91f3('0x2c');return db[_0x91f3('0x51')][_0x91f3('0x52')]({'where':{'name':_0x2a4055,'userProfileId':_0x3e3978['userProfileId']},'raw':!![]})[_0x91f3('0x2a')](function(_0x1ae0d5){if(_0x1ae0d5&&_0x1ae0d5[_0x91f3('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d1c1b[_0x91f3('0x38')],'resourceId':_0x2d1c1b['id'],'type':_0x1ae0d5['name'],'sectionId':_0x1ae0d5['id']},{})[_0x91f3('0x2a')](function(){return _0x37eff7;});}else{return _0x37eff7;}})[_0x91f3('0x54')](function(_0xa67176){logger[_0x91f3('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa67176);throw _0xa67176;});}return _0x37eff7;})[_0x91f3('0x2a')](respondWithResult(_0x13f2ea,0xc9))[_0x91f3('0x54')](handleError(_0x13f2ea,null));};exports['update']=function(_0x5ebe6f,_0xe8e1b1){if(_0x5ebe6f[_0x91f3('0x56')]['id']){delete _0x5ebe6f['body']['id'];}return db[_0x91f3('0x32')][_0x91f3('0x52')]({'where':{'id':_0x5ebe6f[_0x91f3('0x57')]['id']}})['then'](handleEntityNotFound(_0xe8e1b1,null))[_0x91f3('0x2a')](saveUpdates(_0x5ebe6f[_0x91f3('0x56')],null))[_0x91f3('0x2a')](respondWithResult(_0xe8e1b1,null))[_0x91f3('0x54')](handleError(_0xe8e1b1,null));};exports[_0x91f3('0x2b')]=function(_0xa10a59,_0x4d3cee){return db[_0x91f3('0x32')]['find']({'where':{'id':_0xa10a59[_0x91f3('0x57')]['id']}})[_0x91f3('0x2a')](handleEntityNotFound(_0x4d3cee,null))[_0x91f3('0x2a')](removeEntity(_0x4d3cee,null))[_0x91f3('0x54')](handleError(_0x4d3cee,null));};exports[_0x91f3('0x58')]=function(_0xe6edcc,_0xb336b8,_0x276752){if(_0xe6edcc[_0x91f3('0x56')]['id']){delete _0xe6edcc[_0x91f3('0x56')]['id'];}return db[_0x91f3('0x32')]['find']({'where':{'id':_0xe6edcc[_0x91f3('0x57')]['id']}})['then'](handleEntityNotFound(_0xb336b8,null))[_0x91f3('0x2a')](function(_0x3c0243){if(_0x3c0243){_0xe6edcc[_0x91f3('0x56')]['TriggerAllId']=_0x3c0243['id'];return db[_0x91f3('0x59')]['create'](_0xe6edcc[_0x91f3('0x56')]);}})[_0x91f3('0x2a')](respondWithResult(_0xb336b8,null))[_0x91f3('0x54')](handleError(_0xb336b8,null));};exports[_0x91f3('0x5a')]=function(_0x1057ae,_0xfcda72,_0x51c440){if(_0x1057ae[_0x91f3('0x56')]['id']){delete _0x1057ae[_0x91f3('0x56')]['id'];}return db[_0x91f3('0x32')][_0x91f3('0x52')]({'where':{'id':_0x1057ae[_0x91f3('0x57')]['id']}})['then'](handleEntityNotFound(_0xfcda72,null))[_0x91f3('0x2a')](function(_0x5e3e23){if(_0x5e3e23){_0x1057ae[_0x91f3('0x56')][_0x91f3('0x5b')]=_0x5e3e23['id'];return db['Condition'][_0x91f3('0x4d')](_0x1057ae['body']);}})[_0x91f3('0x2a')](respondWithResult(_0xfcda72,null))[_0x91f3('0x54')](handleError(_0xfcda72,null));};exports['getAllConditions']=function(_0x5c08ad,_0x3f51c0,_0x53798f){var _0x245bf6={};var _0x3a3c97={};var _0x4c9b9b;var _0x455644;return db['Trigger'][_0x91f3('0x5c')]({'where':{'id':_0x5c08ad[_0x91f3('0x57')]['id']}})[_0x91f3('0x2a')](handleEntityNotFound(_0x3f51c0,null))['then'](function(_0x399851){if(_0x399851){_0x4c9b9b=_0x399851;_0x3a3c97['model']=_[_0x91f3('0x3a')](db['Condition'][_0x91f3('0x33')]);_0x3a3c97[_0x91f3('0x39')]=_[_0x91f3('0x3a')](_0x5c08ad[_0x91f3('0x39')]);_0x3a3c97[_0x91f3('0x43')]=_[_0x91f3('0x3b')](_0x3a3c97[_0x91f3('0x37')],_0x3a3c97[_0x91f3('0x39')]);_0x245bf6[_0x91f3('0x3c')]=_[_0x91f3('0x3b')](_0x3a3c97['model'],qs[_0x91f3('0x3d')](_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x3d')]));_0x245bf6[_0x91f3('0x3c')]=_0x245bf6[_0x91f3('0x3c')][_0x91f3('0x3e')]?_0x245bf6[_0x91f3('0x3c')]:_0x3a3c97[_0x91f3('0x37')];_0x245bf6['order']=qs[_0x91f3('0x42')](_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x42')]);_0x245bf6[_0x91f3('0x46')]=qs[_0x91f3('0x43')](_['pick'](_0x5c08ad['query'],_0x3a3c97['filters']));if(_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x45')]){_0x245bf6[_0x91f3('0x46')]=_[_0x91f3('0x47')](_0x245bf6[_0x91f3('0x46')],{'$or':_[_0x91f3('0x31')](_0x245bf6[_0x91f3('0x3c')],function(_0x4562ea){var _0x3d87ba={};_0x3d87ba[_0x4562ea]={'$like':'%'+_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x45')]+'%'};return _0x3d87ba;})});}_0x245bf6=_[_0x91f3('0x47')]({},_0x245bf6,_0x5c08ad[_0x91f3('0x49')]);return _0x4c9b9b['getAllConditions'](_0x245bf6);}})[_0x91f3('0x2a')](function(_0x3e8ffc){if(_0x3e8ffc){_0x455644=_0x3e8ffc[_0x91f3('0x3e')];if(!_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x3f')](_0x91f3('0x40'))){_0x245bf6['limit']=qs['limit'](_0x5c08ad['query']['limit']);_0x245bf6['offset']=qs[_0x91f3('0x24')](_0x5c08ad[_0x91f3('0x39')][_0x91f3('0x24')]);}return _0x4c9b9b[_0x91f3('0x5d')](_0x245bf6);}})[_0x91f3('0x2a')](function(_0x5d094b){if(_0x5d094b){return _0x5d094b?{'count':_0x455644,'rows':_0x5d094b}:null;}})[_0x91f3('0x2a')](respondWithResult(_0x3f51c0,null))['catch'](handleError(_0x3f51c0,null));};exports[_0x91f3('0x5e')]=function(_0x958097,_0x36751e,_0x2fc49c){var _0x805c4b={};var _0x5abf18={};var _0x3383c5;var _0x3673b3;return db[_0x91f3('0x32')]['findOne']({'where':{'id':_0x958097[_0x91f3('0x57')]['id']}})[_0x91f3('0x2a')](handleEntityNotFound(_0x36751e,null))['then'](function(_0x58c8c1){if(_0x58c8c1){_0x3383c5=_0x58c8c1;_0x5abf18[_0x91f3('0x37')]=_['keys'](db[_0x91f3('0x59')][_0x91f3('0x33')]);_0x5abf18[_0x91f3('0x39')]=_[_0x91f3('0x3a')](_0x958097['query']);_0x5abf18['filters']=_[_0x91f3('0x3b')](_0x5abf18[_0x91f3('0x37')],_0x5abf18[_0x91f3('0x39')]);_0x805c4b[_0x91f3('0x3c')]=_['intersection'](_0x5abf18[_0x91f3('0x37')],qs[_0x91f3('0x3d')](_0x958097[_0x91f3('0x39')]['fields']));_0x805c4b['attributes']=_0x805c4b[_0x91f3('0x3c')][_0x91f3('0x3e')]?_0x805c4b['attributes']:_0x5abf18[_0x91f3('0x37')];_0x805c4b['order']=qs['sort'](_0x958097[_0x91f3('0x39')]['sort']);_0x805c4b[_0x91f3('0x46')]=qs[_0x91f3('0x43')](_[_0x91f3('0x44')](_0x958097[_0x91f3('0x39')],_0x5abf18[_0x91f3('0x43')]));if(_0x958097[_0x91f3('0x39')][_0x91f3('0x45')]){_0x805c4b[_0x91f3('0x46')]=_[_0x91f3('0x47')](_0x805c4b[_0x91f3('0x46')],{'$or':_[_0x91f3('0x31')](_0x805c4b['attributes'],function(_0x51efcf){var _0x23b71e={};_0x23b71e[_0x51efcf]={'$like':'%'+_0x958097['query']['filter']+'%'};return _0x23b71e;})});}_0x805c4b=_[_0x91f3('0x47')]({},_0x805c4b,_0x958097['options']);return _0x3383c5[_0x91f3('0x5e')](_0x805c4b);}})[_0x91f3('0x2a')](function(_0x3eb359){if(_0x3eb359){_0x3673b3=_0x3eb359[_0x91f3('0x3e')];if(!_0x958097[_0x91f3('0x39')][_0x91f3('0x3f')]('nolimit')){_0x805c4b[_0x91f3('0x22')]=qs[_0x91f3('0x22')](_0x958097[_0x91f3('0x39')][_0x91f3('0x22')]);_0x805c4b[_0x91f3('0x24')]=qs[_0x91f3('0x24')](_0x958097[_0x91f3('0x39')]['offset']);}return _0x3383c5[_0x91f3('0x5e')](_0x805c4b);}})[_0x91f3('0x2a')](function(_0xfc4ed0){if(_0xfc4ed0){return _0xfc4ed0?{'count':_0x3673b3,'rows':_0xfc4ed0}:null;}})[_0x91f3('0x2a')](respondWithResult(_0x36751e,null))['catch'](handleError(_0x36751e,null));};exports['addAction']=function(_0x4e5704,_0x1593a4,_0x2b7b4f){if(_0x4e5704[_0x91f3('0x56')]['id']){delete _0x4e5704[_0x91f3('0x56')]['id'];}return db[_0x91f3('0x32')][_0x91f3('0x52')]({'where':{'id':_0x4e5704['params']['id']}})['then'](handleEntityNotFound(_0x1593a4,null))[_0x91f3('0x2a')](function(_0x253067){if(_0x253067){_0x4e5704[_0x91f3('0x56')][_0x91f3('0x5f')]=_0x253067['id'];return db['Action'][_0x91f3('0x4d')](_0x4e5704[_0x91f3('0x56')]);}})[_0x91f3('0x2a')](respondWithResult(_0x1593a4,null))['catch'](handleError(_0x1593a4,null));};exports[_0x91f3('0x60')]=function(_0x23805f,_0x1f3945,_0x5c158e){var _0x5264db={};var _0x557508={};var _0x40c22a;var _0x178600;return db[_0x91f3('0x32')][_0x91f3('0x5c')]({'where':{'id':_0x23805f[_0x91f3('0x57')]['id']}})[_0x91f3('0x2a')](handleEntityNotFound(_0x1f3945,null))[_0x91f3('0x2a')](function(_0x29da92){if(_0x29da92){_0x40c22a=_0x29da92;_0x557508[_0x91f3('0x37')]=_[_0x91f3('0x3a')](db[_0x91f3('0x61')]['rawAttributes']);_0x557508['query']=_['keys'](_0x23805f[_0x91f3('0x39')]);_0x557508[_0x91f3('0x43')]=_[_0x91f3('0x3b')](_0x557508[_0x91f3('0x37')],_0x557508[_0x91f3('0x39')]);_0x5264db[_0x91f3('0x3c')]=_['intersection'](_0x557508[_0x91f3('0x37')],qs['fields'](_0x23805f['query'][_0x91f3('0x3d')]));_0x5264db[_0x91f3('0x3c')]=_0x5264db[_0x91f3('0x3c')][_0x91f3('0x3e')]?_0x5264db[_0x91f3('0x3c')]:_0x557508[_0x91f3('0x37')];_0x5264db[_0x91f3('0x41')]=qs[_0x91f3('0x42')](_0x23805f[_0x91f3('0x39')]['sort']);_0x5264db[_0x91f3('0x46')]=qs['filters'](_[_0x91f3('0x44')](_0x23805f[_0x91f3('0x39')],_0x557508['filters']));if(_0x23805f[_0x91f3('0x39')][_0x91f3('0x45')]){_0x5264db[_0x91f3('0x46')]=_[_0x91f3('0x47')](_0x5264db[_0x91f3('0x46')],{'$or':_[_0x91f3('0x31')](_0x5264db[_0x91f3('0x3c')],function(_0x11fdc1){var _0x5dde03={};_0x5dde03[_0x11fdc1]={'$like':'%'+_0x23805f[_0x91f3('0x39')][_0x91f3('0x45')]+'%'};return _0x5dde03;})});}_0x5264db=_[_0x91f3('0x47')]({},_0x5264db,_0x23805f[_0x91f3('0x49')]);return _0x40c22a['getActions'](_0x5264db);}})[_0x91f3('0x2a')](function(_0x442996){if(_0x442996){_0x178600=_0x442996[_0x91f3('0x3e')];if(!_0x23805f[_0x91f3('0x39')][_0x91f3('0x3f')](_0x91f3('0x40'))){_0x5264db['limit']=qs[_0x91f3('0x22')](_0x23805f[_0x91f3('0x39')][_0x91f3('0x22')]);_0x5264db[_0x91f3('0x24')]=qs['offset'](_0x23805f[_0x91f3('0x39')][_0x91f3('0x24')]);}return _0x40c22a[_0x91f3('0x60')](_0x5264db);}})[_0x91f3('0x2a')](function(_0x2297a1){if(_0x2297a1){return _0x2297a1?{'count':_0x178600,'rows':_0x2297a1}:null;}})['then'](respondWithResult(_0x1f3945,null))[_0x91f3('0x54')](handleError(_0x1f3945,null));}; \ No newline at end of file +var _0xcf3c=['getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Triggers','UserProfileResource','then','stack','send','index','Trigger','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','filter','getAnyConditions','map','addAction','Action'];(function(_0x59f2e6,_0x2cdb2f){var _0x3d285d=function(_0x2b5add){while(--_0x2b5add){_0x59f2e6['push'](_0x59f2e6['shift']());}};_0x3d285d(++_0x2cdb2f);}(_0xcf3c,0x185));var _0xccf3=function(_0x499f65,_0x27509e){_0x499f65=_0x499f65-0x0;var _0x28e7bc=_0xcf3c[_0x499f65];return _0x28e7bc;};'use strict';var emlformat=require(_0xccf3('0x0'));var rimraf=require(_0xccf3('0x1'));var zipdir=require(_0xccf3('0x2'));var jsonpatch=require(_0xccf3('0x3'));var rp=require(_0xccf3('0x4'));var moment=require(_0xccf3('0x5'));var BPromise=require(_0xccf3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xccf3('0x7'));var csv=require(_0xccf3('0x8'));var ejs=require(_0xccf3('0x9'));var fs=require('fs');var fs_extra=require(_0xccf3('0xa'));var _=require('lodash');var squel=require(_0xccf3('0xb'));var crypto=require('crypto');var jsforce=require(_0xccf3('0xc'));var deskjs=require(_0xccf3('0xd'));var toCsv=require(_0xccf3('0x8'));var querystring=require(_0xccf3('0xe'));var Papa=require('papaparse');var Redis=require(_0xccf3('0xf'));var authService=require(_0xccf3('0x10'));var qs=require(_0xccf3('0x11'));var as=require(_0xccf3('0x12'));var hardwareService=require(_0xccf3('0x13'));var logger=require(_0xccf3('0x14'))(_0xccf3('0x15'));var utils=require(_0xccf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xccf3('0x17'));var db=require(_0xccf3('0x18'))['db'];function respondWithStatusCode(_0x8d0bd0,_0x5812e9){_0x5812e9=_0x5812e9||0xcc;return function(_0x89ca96){if(_0x89ca96){return _0x8d0bd0['sendStatus'](_0x5812e9);}return _0x8d0bd0[_0xccf3('0x19')](_0x5812e9)[_0xccf3('0x1a')]();};}function respondWithResult(_0x5a8d15,_0x50d8bb){_0x50d8bb=_0x50d8bb||0xc8;return function(_0x5c8582){if(_0x5c8582){return _0x5a8d15[_0xccf3('0x19')](_0x50d8bb)[_0xccf3('0x1b')](_0x5c8582);}};}function respondWithFilteredResult(_0x4e9813,_0x4c2ba4){return function(_0x4f9f3a){if(_0x4f9f3a){var _0x48a99c=typeof _0x4c2ba4[_0xccf3('0x1c')]===_0xccf3('0x1d')&&typeof _0x4c2ba4[_0xccf3('0x1e')]===_0xccf3('0x1d');var _0x559dca=_0x4f9f3a[_0xccf3('0x1f')];var _0xbfc832=_0x48a99c?0x0:_0x4c2ba4[_0xccf3('0x1c')];var _0x46d14d=_0x48a99c?_0x4f9f3a[_0xccf3('0x1f')]:_0x4c2ba4[_0xccf3('0x1c')]+_0x4c2ba4['limit'];var _0x4735d6;if(_0x46d14d>=_0x559dca){_0x46d14d=_0x559dca;_0x4735d6=0xc8;}else{_0x4735d6=0xce;}_0x4e9813[_0xccf3('0x19')](_0x4735d6);return _0x4e9813[_0xccf3('0x20')](_0xccf3('0x21'),_0xbfc832+'-'+_0x46d14d+'/'+_0x559dca)['json'](_0x4f9f3a);}return null;};}function patchUpdates(_0x437c9e){return function(_0x3e16a8){try{jsonpatch[_0xccf3('0x22')](_0x3e16a8,_0x437c9e,!![]);}catch(_0xdca91e){return BPromise[_0xccf3('0x23')](_0xdca91e);}return _0x3e16a8[_0xccf3('0x24')]();};}function saveUpdates(_0x333523,_0xedb3bd){return function(_0x49582f){if(_0x49582f){return _0x49582f[_0xccf3('0x25')](_0x333523)['then'](function(_0x573712){return _0x573712;});}return null;};}function removeEntity(_0x112fa9,_0x5d6f1b){return function(_0x5aed07){if(_0x5aed07){return _0x5aed07[_0xccf3('0x26')]()['then'](function(){var _0x25aca1=_0x5aed07[_0xccf3('0x27')]({'plain':!![]});var _0x2be258=_0xccf3('0x28');return db[_0xccf3('0x29')][_0xccf3('0x26')]({'where':{'type':_0x2be258,'resourceId':_0x25aca1['id']}})[_0xccf3('0x2a')](function(){return _0x5aed07;});})['then'](function(){_0x112fa9['status'](0xcc)[_0xccf3('0x1a')]();});}};}function handleEntityNotFound(_0x4cfdcb,_0x123bc5){return function(_0x3d2828){if(!_0x3d2828){_0x4cfdcb['sendStatus'](0x194);}return _0x3d2828;};}function handleError(_0x48c742,_0x7511be){_0x7511be=_0x7511be||0x1f4;return function(_0x266052){logger['error'](_0x266052[_0xccf3('0x2b')]);if(_0x266052['name']){delete _0x266052['name'];}_0x48c742[_0xccf3('0x19')](_0x7511be)[_0xccf3('0x2c')](_0x266052);};}exports[_0xccf3('0x2d')]=function(_0x5036be,_0x4d301a){var _0x37272a={},_0x178cd3={},_0x487acc={'count':0x0,'rows':[]};var _0xfc7cca=_['map'](db[_0xccf3('0x2e')][_0xccf3('0x2f')],function(_0x557640){return{'name':_0x557640[_0xccf3('0x30')],'type':_0x557640[_0xccf3('0x31')][_0xccf3('0x32')]};});_0x178cd3[_0xccf3('0x33')]=_['map'](_0xfc7cca,_0xccf3('0x34'));_0x178cd3[_0xccf3('0x35')]=_[_0xccf3('0x36')](_0x5036be[_0xccf3('0x35')]);_0x178cd3[_0xccf3('0x37')]=_[_0xccf3('0x38')](_0x178cd3[_0xccf3('0x33')],_0x178cd3['query']);_0x37272a['attributes']=_[_0xccf3('0x38')](_0x178cd3[_0xccf3('0x33')],qs[_0xccf3('0x39')](_0x5036be[_0xccf3('0x35')][_0xccf3('0x39')]));_0x37272a[_0xccf3('0x3a')]=_0x37272a['attributes'][_0xccf3('0x3b')]?_0x37272a[_0xccf3('0x3a')]:_0x178cd3[_0xccf3('0x33')];if(!_0x5036be[_0xccf3('0x35')][_0xccf3('0x3c')](_0xccf3('0x3d'))){_0x37272a[_0xccf3('0x1e')]=qs[_0xccf3('0x1e')](_0x5036be[_0xccf3('0x35')][_0xccf3('0x1e')]);_0x37272a[_0xccf3('0x1c')]=qs['offset'](_0x5036be['query'][_0xccf3('0x1c')]);}_0x37272a[_0xccf3('0x3e')]=qs[_0xccf3('0x3f')](_0x5036be[_0xccf3('0x35')][_0xccf3('0x3f')]);_0x37272a[_0xccf3('0x40')]=qs[_0xccf3('0x37')](_[_0xccf3('0x41')](_0x5036be[_0xccf3('0x35')],_0x178cd3['filters']),_0xfc7cca);if(_0x5036be[_0xccf3('0x35')]['filter']){_0x37272a[_0xccf3('0x40')]=_[_0xccf3('0x42')](_0x37272a[_0xccf3('0x40')],{'$or':_['map'](_0xfc7cca,function(_0x12055e){if(_0x12055e[_0xccf3('0x31')]!=='VIRTUAL'){var _0x25a857={};_0x25a857[_0x12055e['name']]={'$like':'%'+_0x5036be[_0xccf3('0x35')]['filter']+'%'};return _0x25a857;}})});}_0x37272a=_['merge']({},_0x37272a,_0x5036be[_0xccf3('0x43')]);var _0x20ebda={'where':_0x37272a[_0xccf3('0x40')]};return db[_0xccf3('0x2e')][_0xccf3('0x1f')](_0x20ebda)[_0xccf3('0x2a')](function(_0x38ac0a){_0x487acc[_0xccf3('0x1f')]=_0x38ac0a;if(_0x5036be[_0xccf3('0x35')][_0xccf3('0x44')]){_0x37272a['include']=[{'all':!![]}];}return db[_0xccf3('0x2e')][_0xccf3('0x45')](_0x37272a);})[_0xccf3('0x2a')](function(_0x546e85){_0x487acc[_0xccf3('0x46')]=_0x546e85;return _0x487acc;})[_0xccf3('0x2a')](respondWithFilteredResult(_0x4d301a,_0x37272a))[_0xccf3('0x47')](handleError(_0x4d301a,null));};exports[_0xccf3('0x48')]=function(_0x32a528,_0x5bf5e1){var _0x23bddc={'raw':![],'where':{'id':_0x32a528['params']['id']}},_0x55e11e={};_0x55e11e['model']=_['keys'](db[_0xccf3('0x2e')]['rawAttributes']);_0x55e11e['query']=_[_0xccf3('0x36')](_0x32a528['query']);_0x55e11e[_0xccf3('0x37')]=_[_0xccf3('0x38')](_0x55e11e[_0xccf3('0x33')],_0x55e11e[_0xccf3('0x35')]);_0x23bddc[_0xccf3('0x3a')]=_[_0xccf3('0x38')](_0x55e11e[_0xccf3('0x33')],qs[_0xccf3('0x39')](_0x32a528['query']['fields']));_0x23bddc[_0xccf3('0x3a')]=_0x23bddc[_0xccf3('0x3a')][_0xccf3('0x3b')]?_0x23bddc['attributes']:_0x55e11e[_0xccf3('0x33')];if(_0x32a528[_0xccf3('0x35')]['includeAll']){_0x23bddc[_0xccf3('0x49')]=[{'all':!![]}];}_0x23bddc=_['merge']({},_0x23bddc,_0x32a528[_0xccf3('0x43')]);return db['Trigger']['find'](_0x23bddc)[_0xccf3('0x2a')](handleEntityNotFound(_0x5bf5e1,null))[_0xccf3('0x2a')](respondWithResult(_0x5bf5e1,null))['catch'](handleError(_0x5bf5e1,null));};exports[_0xccf3('0x4a')]=function(_0x530575,_0x2ed218){return db[_0xccf3('0x2e')]['create'](_0x530575[_0xccf3('0x4b')],{})[_0xccf3('0x2a')](function(_0x435a96){var _0x3b1f3c=_0x530575['user']['get']({'plain':!![]});if(!_0x3b1f3c)throw new Error(_0xccf3('0x4c'));if(_0x3b1f3c[_0xccf3('0x4d')]===_0xccf3('0x4e')){var _0x80b3ff=_0x435a96[_0xccf3('0x27')]({'plain':!![]});var _0x39dea1=_0xccf3('0x28');return db[_0xccf3('0x4f')][_0xccf3('0x50')]({'where':{'name':_0x39dea1,'userProfileId':_0x3b1f3c['userProfileId']},'raw':!![]})['then'](function(_0x50f009){if(_0x50f009&&_0x50f009[_0xccf3('0x51')]===0x0){return db['UserProfileResource'][_0xccf3('0x4a')]({'name':_0x80b3ff[_0xccf3('0x34')],'resourceId':_0x80b3ff['id'],'type':_0x50f009[_0xccf3('0x34')],'sectionId':_0x50f009['id']},{})[_0xccf3('0x2a')](function(){return _0x435a96;});}else{return _0x435a96;}})[_0xccf3('0x47')](function(_0x36be23){logger[_0xccf3('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36be23);throw _0x36be23;});}return _0x435a96;})[_0xccf3('0x2a')](respondWithResult(_0x2ed218,0xc9))[_0xccf3('0x47')](handleError(_0x2ed218,null));};exports[_0xccf3('0x25')]=function(_0x55eefd,_0x28ab13){if(_0x55eefd[_0xccf3('0x4b')]['id']){delete _0x55eefd[_0xccf3('0x4b')]['id'];}return db[_0xccf3('0x2e')][_0xccf3('0x50')]({'where':{'id':_0x55eefd[_0xccf3('0x53')]['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0x28ab13,null))[_0xccf3('0x2a')](saveUpdates(_0x55eefd[_0xccf3('0x4b')],null))[_0xccf3('0x2a')](respondWithResult(_0x28ab13,null))[_0xccf3('0x47')](handleError(_0x28ab13,null));};exports['destroy']=function(_0x595c48,_0xaa6120){return db[_0xccf3('0x2e')][_0xccf3('0x50')]({'where':{'id':_0x595c48[_0xccf3('0x53')]['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0xaa6120,null))[_0xccf3('0x2a')](removeEntity(_0xaa6120,null))[_0xccf3('0x47')](handleError(_0xaa6120,null));};exports[_0xccf3('0x54')]=function(_0x2435fc,_0xca2ce2,_0x259d09){if(_0x2435fc[_0xccf3('0x4b')]['id']){delete _0x2435fc[_0xccf3('0x4b')]['id'];}return db['Trigger'][_0xccf3('0x50')]({'where':{'id':_0x2435fc['params']['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0xca2ce2,null))[_0xccf3('0x2a')](function(_0x1fda19){if(_0x1fda19){_0x2435fc[_0xccf3('0x4b')][_0xccf3('0x55')]=_0x1fda19['id'];return db[_0xccf3('0x56')][_0xccf3('0x4a')](_0x2435fc[_0xccf3('0x4b')]);}})['then'](respondWithResult(_0xca2ce2,null))[_0xccf3('0x47')](handleError(_0xca2ce2,null));};exports[_0xccf3('0x57')]=function(_0x4284af,_0x50082b,_0x62fd79){if(_0x4284af[_0xccf3('0x4b')]['id']){delete _0x4284af[_0xccf3('0x4b')]['id'];}return db[_0xccf3('0x2e')]['find']({'where':{'id':_0x4284af[_0xccf3('0x53')]['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0x50082b,null))[_0xccf3('0x2a')](function(_0x28a8a6){if(_0x28a8a6){_0x4284af[_0xccf3('0x4b')][_0xccf3('0x58')]=_0x28a8a6['id'];return db[_0xccf3('0x56')][_0xccf3('0x4a')](_0x4284af[_0xccf3('0x4b')]);}})[_0xccf3('0x2a')](respondWithResult(_0x50082b,null))['catch'](handleError(_0x50082b,null));};exports[_0xccf3('0x59')]=function(_0x557678,_0x263410,_0xc87c20){var _0x48e046={};var _0x44c3aa={};var _0x2b6482;var _0xdba6a3;return db[_0xccf3('0x2e')][_0xccf3('0x5a')]({'where':{'id':_0x557678['params']['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0x263410,null))[_0xccf3('0x2a')](function(_0x34b584){if(_0x34b584){_0x2b6482=_0x34b584;_0x44c3aa['model']=_[_0xccf3('0x36')](db[_0xccf3('0x56')]['rawAttributes']);_0x44c3aa['query']=_[_0xccf3('0x36')](_0x557678['query']);_0x44c3aa['filters']=_[_0xccf3('0x38')](_0x44c3aa[_0xccf3('0x33')],_0x44c3aa[_0xccf3('0x35')]);_0x48e046[_0xccf3('0x3a')]=_[_0xccf3('0x38')](_0x44c3aa[_0xccf3('0x33')],qs[_0xccf3('0x39')](_0x557678['query'][_0xccf3('0x39')]));_0x48e046[_0xccf3('0x3a')]=_0x48e046[_0xccf3('0x3a')][_0xccf3('0x3b')]?_0x48e046[_0xccf3('0x3a')]:_0x44c3aa[_0xccf3('0x33')];_0x48e046[_0xccf3('0x3e')]=qs['sort'](_0x557678['query']['sort']);_0x48e046[_0xccf3('0x40')]=qs['filters'](_['pick'](_0x557678[_0xccf3('0x35')],_0x44c3aa['filters']));if(_0x557678[_0xccf3('0x35')][_0xccf3('0x5b')]){_0x48e046[_0xccf3('0x40')]=_['merge'](_0x48e046[_0xccf3('0x40')],{'$or':_['map'](_0x48e046['attributes'],function(_0x4cdb43){var _0x510461={};_0x510461[_0x4cdb43]={'$like':'%'+_0x557678[_0xccf3('0x35')][_0xccf3('0x5b')]+'%'};return _0x510461;})});}_0x48e046=_['merge']({},_0x48e046,_0x557678[_0xccf3('0x43')]);return _0x2b6482['getAllConditions'](_0x48e046);}})[_0xccf3('0x2a')](function(_0x556380){if(_0x556380){_0xdba6a3=_0x556380[_0xccf3('0x3b')];if(!_0x557678[_0xccf3('0x35')][_0xccf3('0x3c')](_0xccf3('0x3d'))){_0x48e046[_0xccf3('0x1e')]=qs[_0xccf3('0x1e')](_0x557678[_0xccf3('0x35')][_0xccf3('0x1e')]);_0x48e046['offset']=qs['offset'](_0x557678[_0xccf3('0x35')][_0xccf3('0x1c')]);}return _0x2b6482['getAllConditions'](_0x48e046);}})[_0xccf3('0x2a')](function(_0x19c158){if(_0x19c158){return _0x19c158?{'count':_0xdba6a3,'rows':_0x19c158}:null;}})['then'](respondWithResult(_0x263410,null))[_0xccf3('0x47')](handleError(_0x263410,null));};exports[_0xccf3('0x5c')]=function(_0x1aa789,_0x3b39cc,_0x27f1d9){var _0x18000d={};var _0x1293d6={};var _0xb2d5f8;var _0x47d0a7;return db[_0xccf3('0x2e')][_0xccf3('0x5a')]({'where':{'id':_0x1aa789['params']['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0x3b39cc,null))[_0xccf3('0x2a')](function(_0x8788ef){if(_0x8788ef){_0xb2d5f8=_0x8788ef;_0x1293d6['model']=_[_0xccf3('0x36')](db[_0xccf3('0x56')][_0xccf3('0x2f')]);_0x1293d6[_0xccf3('0x35')]=_[_0xccf3('0x36')](_0x1aa789['query']);_0x1293d6[_0xccf3('0x37')]=_[_0xccf3('0x38')](_0x1293d6[_0xccf3('0x33')],_0x1293d6[_0xccf3('0x35')]);_0x18000d[_0xccf3('0x3a')]=_[_0xccf3('0x38')](_0x1293d6[_0xccf3('0x33')],qs[_0xccf3('0x39')](_0x1aa789['query']['fields']));_0x18000d[_0xccf3('0x3a')]=_0x18000d[_0xccf3('0x3a')]['length']?_0x18000d['attributes']:_0x1293d6[_0xccf3('0x33')];_0x18000d['order']=qs['sort'](_0x1aa789[_0xccf3('0x35')][_0xccf3('0x3f')]);_0x18000d[_0xccf3('0x40')]=qs['filters'](_[_0xccf3('0x41')](_0x1aa789[_0xccf3('0x35')],_0x1293d6['filters']));if(_0x1aa789['query'][_0xccf3('0x5b')]){_0x18000d['where']=_['merge'](_0x18000d['where'],{'$or':_[_0xccf3('0x5d')](_0x18000d[_0xccf3('0x3a')],function(_0x5258b3){var _0x4bcf55={};_0x4bcf55[_0x5258b3]={'$like':'%'+_0x1aa789[_0xccf3('0x35')][_0xccf3('0x5b')]+'%'};return _0x4bcf55;})});}_0x18000d=_[_0xccf3('0x42')]({},_0x18000d,_0x1aa789['options']);return _0xb2d5f8[_0xccf3('0x5c')](_0x18000d);}})[_0xccf3('0x2a')](function(_0x553641){if(_0x553641){_0x47d0a7=_0x553641[_0xccf3('0x3b')];if(!_0x1aa789[_0xccf3('0x35')][_0xccf3('0x3c')](_0xccf3('0x3d'))){_0x18000d[_0xccf3('0x1e')]=qs[_0xccf3('0x1e')](_0x1aa789[_0xccf3('0x35')][_0xccf3('0x1e')]);_0x18000d['offset']=qs[_0xccf3('0x1c')](_0x1aa789[_0xccf3('0x35')][_0xccf3('0x1c')]);}return _0xb2d5f8[_0xccf3('0x5c')](_0x18000d);}})[_0xccf3('0x2a')](function(_0x91edff){if(_0x91edff){return _0x91edff?{'count':_0x47d0a7,'rows':_0x91edff}:null;}})[_0xccf3('0x2a')](respondWithResult(_0x3b39cc,null))['catch'](handleError(_0x3b39cc,null));};exports[_0xccf3('0x5e')]=function(_0x2c6efd,_0x3708d3,_0x5101bd){if(_0x2c6efd[_0xccf3('0x4b')]['id']){delete _0x2c6efd[_0xccf3('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2c6efd['params']['id']}})[_0xccf3('0x2a')](handleEntityNotFound(_0x3708d3,null))[_0xccf3('0x2a')](function(_0x3966b2){if(_0x3966b2){_0x2c6efd[_0xccf3('0x4b')]['TriggerId']=_0x3966b2['id'];return db[_0xccf3('0x5f')][_0xccf3('0x4a')](_0x2c6efd['body']);}})[_0xccf3('0x2a')](respondWithResult(_0x3708d3,null))[_0xccf3('0x47')](handleError(_0x3708d3,null));};exports[_0xccf3('0x60')]=function(_0x24e7be,_0x448b85,_0x3074cc){var _0x3f66b8={};var _0x14731b={};var _0x4f1d23;var _0x233108;return db['Trigger'][_0xccf3('0x5a')]({'where':{'id':_0x24e7be[_0xccf3('0x53')]['id']}})['then'](handleEntityNotFound(_0x448b85,null))[_0xccf3('0x2a')](function(_0x575d2f){if(_0x575d2f){_0x4f1d23=_0x575d2f;_0x14731b[_0xccf3('0x33')]=_['keys'](db[_0xccf3('0x5f')]['rawAttributes']);_0x14731b[_0xccf3('0x35')]=_[_0xccf3('0x36')](_0x24e7be[_0xccf3('0x35')]);_0x14731b[_0xccf3('0x37')]=_[_0xccf3('0x38')](_0x14731b[_0xccf3('0x33')],_0x14731b[_0xccf3('0x35')]);_0x3f66b8[_0xccf3('0x3a')]=_[_0xccf3('0x38')](_0x14731b[_0xccf3('0x33')],qs[_0xccf3('0x39')](_0x24e7be[_0xccf3('0x35')][_0xccf3('0x39')]));_0x3f66b8[_0xccf3('0x3a')]=_0x3f66b8['attributes']['length']?_0x3f66b8[_0xccf3('0x3a')]:_0x14731b[_0xccf3('0x33')];_0x3f66b8[_0xccf3('0x3e')]=qs['sort'](_0x24e7be[_0xccf3('0x35')][_0xccf3('0x3f')]);_0x3f66b8[_0xccf3('0x40')]=qs['filters'](_[_0xccf3('0x41')](_0x24e7be['query'],_0x14731b[_0xccf3('0x37')]));if(_0x24e7be['query'][_0xccf3('0x5b')]){_0x3f66b8[_0xccf3('0x40')]=_[_0xccf3('0x42')](_0x3f66b8[_0xccf3('0x40')],{'$or':_['map'](_0x3f66b8['attributes'],function(_0x47b05f){var _0x3cb7c7={};_0x3cb7c7[_0x47b05f]={'$like':'%'+_0x24e7be[_0xccf3('0x35')]['filter']+'%'};return _0x3cb7c7;})});}_0x3f66b8=_['merge']({},_0x3f66b8,_0x24e7be[_0xccf3('0x43')]);return _0x4f1d23[_0xccf3('0x60')](_0x3f66b8);}})[_0xccf3('0x2a')](function(_0x4b405a){if(_0x4b405a){_0x233108=_0x4b405a[_0xccf3('0x3b')];if(!_0x24e7be[_0xccf3('0x35')]['hasOwnProperty']('nolimit')){_0x3f66b8[_0xccf3('0x1e')]=qs[_0xccf3('0x1e')](_0x24e7be['query']['limit']);_0x3f66b8[_0xccf3('0x1c')]=qs[_0xccf3('0x1c')](_0x24e7be[_0xccf3('0x35')]['offset']);}return _0x4f1d23[_0xccf3('0x60')](_0x3f66b8);}})[_0xccf3('0x2a')](function(_0x362c53){if(_0x362c53){return _0x362c53?{'count':_0x233108,'rows':_0x362c53}:null;}})[_0xccf3('0x2a')](respondWithResult(_0x448b85,null))[_0xccf3('0x47')](handleError(_0x448b85,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 143f707..40c4a47 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 _0xe181=['bluebird','request-promise','path','rimraf','./trigger.attributes','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment'];(function(_0x280820,_0xce9bc7){var _0x474787=function(_0x3d224e){while(--_0x3d224e){_0x280820['push'](_0x280820['shift']());}};_0x474787(++_0xce9bc7);}(_0xe181,0x68));var _0x1e18=function(_0x5a0bab,_0x168def){_0x5a0bab=_0x5a0bab-0x0;var _0x32b15a=_0xe181[_0x5a0bab];return _0x32b15a;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74a=['path','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52d691,_0x362ca8){var _0xeb6430=function(_0x14c27d){while(--_0x14c27d){_0x52d691['push'](_0x52d691['shift']());}};_0xeb6430(++_0x362ca8);}(_0xa74a,0x66));var _0xaa74=function(_0x582f3e,_0x56d145){_0x582f3e=_0x582f3e-0x0;var _0x371ab1=_0xa74a[_0x582f3e];return _0x371ab1;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var logger=require(_0xaa74('0x2'))(_0xaa74('0x3'));var moment=require(_0xaa74('0x4'));var BPromise=require(_0xaa74('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa74('0x6'));var rimraf=require(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x24eee1,_0x44250c){return _0x24eee1[_0xaa74('0x9')](_0xaa74('0xa'),attributes,{'tableName':_0xaa74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 1cbc71a..04c93d5 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 _0x270e=['ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','lodash','util','bluebird','randomstring'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x270e,0x194));var _0xe270=function(_0xa3d957,_0x5cefc3){_0xa3d957=_0xa3d957-0x0;var _0x1f2f67=_0x270e[_0xa3d957];return _0x1f2f67;};'use strict';var _=require(_0xe270('0x0'));var util=require(_0xe270('0x1'));var moment=require('moment');var BPromise=require(_0xe270('0x2'));var rs=require(_0xe270('0x3'));var fs=require('fs');var Redis=require(_0xe270('0x4'));var db=require(_0xe270('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe270('0x6'))('rpc');var config=require(_0xe270('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe270('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa1eac1,_0x6784df,_0x435889){return new BPromise(function(_0xbffed3,_0x1009c2){return client[_0xe270('0x9')](_0xa1eac1,_0x435889)[_0xe270('0xa')](function(_0x5cd235){logger[_0xe270('0xb')]('Trigger,\x20%s,\x20%s',_0x6784df,_0xe270('0xc'));logger[_0xe270('0xd')](_0xe270('0xe'),_0x6784df,_0xe270('0xc'),JSON[_0xe270('0xf')](_0x5cd235));if(_0x5cd235[_0xe270('0x10')]){if(_0x5cd235[_0xe270('0x10')]['code']===0x1f4){logger[_0xe270('0x10')]('Trigger,\x20%s,\x20%s',_0x6784df,_0x5cd235[_0xe270('0x10')][_0xe270('0x11')]);return _0x1009c2(_0x5cd235['error'][_0xe270('0x11')]);}logger[_0xe270('0x10')](_0xe270('0x12'),_0x6784df,_0x5cd235['error'][_0xe270('0x11')]);return _0xbffed3(_0x5cd235[_0xe270('0x10')][_0xe270('0x11')]);}else{logger[_0xe270('0xb')](_0xe270('0x12'),_0x6784df,_0xe270('0xc'));_0xbffed3(_0x5cd235[_0xe270('0x13')][_0xe270('0x11')]);}})[_0xe270('0x14')](function(_0x457846){logger[_0xe270('0x10')]('Trigger,\x20%s,\x20%s',_0x6784df,_0x457846);_0x1009c2(_0x457846);});});}exports[_0xe270('0x15')]=function(_0x17913e){var _0x3a2da0=this;return new Promise(function(_0x35977e,_0x4382f5){return db[_0xe270('0x16')][_0xe270('0x17')]({'raw':_0x17913e[_0xe270('0x18')]?_0x17913e['options'][_0xe270('0x19')]===undefined?!![]:![]:!![],'where':_0x17913e[_0xe270('0x18')]?_0x17913e[_0xe270('0x18')][_0xe270('0x1a')]||null:null,'attributes':_0x17913e[_0xe270('0x18')]?_0x17913e[_0xe270('0x18')][_0xe270('0x1b')]||null:null,'limit':_0x17913e['options']?_0x17913e[_0xe270('0x18')][_0xe270('0x1c')]||null:null,'include':_0x17913e['options']?_0x17913e['options'][_0xe270('0x1d')]?_[_0xe270('0x1e')](_0x17913e['options'][_0xe270('0x1d')],function(_0x18da02){return{'model':db[_0x18da02[_0xe270('0x1f')]],'as':_0x18da02['as'],'attributes':_0x18da02[_0xe270('0x1b')],'include':_0x18da02[_0xe270('0x1d')]?_['map'](_0x18da02[_0xe270('0x1d')],function(_0x3ecd95){return{'model':db[_0x3ecd95[_0xe270('0x1f')]],'as':_0x3ecd95['as'],'attributes':_0x3ecd95[_0xe270('0x1b')],'include':_0x3ecd95[_0xe270('0x1d')]?_[_0xe270('0x1e')](_0x3ecd95[_0xe270('0x1d')],function(_0x481573){return{'model':db[_0x481573[_0xe270('0x1f')]],'as':_0x481573['as'],'attributes':_0x481573[_0xe270('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bcdec){logger[_0xe270('0xb')]('GetTrigger',_0x17913e);logger[_0xe270('0xd')](_0xe270('0x15'),_0x17913e,JSON['stringify'](_0x1bcdec));_0x35977e(_0x1bcdec);})[_0xe270('0x14')](function(_0x13ec32){logger['error'](_0xe270('0x15'),_0x13ec32['message'],_0x17913e);_0x4382f5(_0x3a2da0[_0xe270('0x10')](0x1f4,_0x13ec32[_0xe270('0x11')]));});});};exports['ShowTrigger']=function(_0x455856){var _0x1c8333=this;return new Promise(function(_0x593c76,_0x34ac27){return db[_0xe270('0x16')][_0xe270('0x20')]({'raw':_0x455856['options']?_0x455856[_0xe270('0x18')][_0xe270('0x19')]===undefined?!![]:![]:!![],'where':_0x455856[_0xe270('0x18')]?_0x455856[_0xe270('0x18')][_0xe270('0x1a')]||null:null,'attributes':_0x455856['options']?_0x455856[_0xe270('0x18')][_0xe270('0x1b')]||null:null,'include':_0x455856[_0xe270('0x18')]?_0x455856[_0xe270('0x18')][_0xe270('0x1d')]?_[_0xe270('0x1e')](_0x455856[_0xe270('0x18')][_0xe270('0x1d')],function(_0x54d793){return{'model':db[_0x54d793[_0xe270('0x1f')]],'as':_0x54d793['as'],'attributes':_0x54d793['attributes'],'include':_0x54d793[_0xe270('0x1d')]?_[_0xe270('0x1e')](_0x54d793[_0xe270('0x1d')],function(_0x14a734){return{'model':db[_0x14a734[_0xe270('0x1f')]],'as':_0x14a734['as'],'attributes':_0x14a734['attributes'],'include':_0x14a734[_0xe270('0x1d')]?_[_0xe270('0x1e')](_0x14a734['include'],function(_0x2e3af2){return{'model':db[_0x2e3af2[_0xe270('0x1f')]],'as':_0x2e3af2['as'],'attributes':_0x2e3af2[_0xe270('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe270('0xa')](function(_0x4a21cd){logger['info'](_0xe270('0x21'),_0x455856);logger[_0xe270('0xd')]('ShowTrigger',_0x455856,JSON['stringify'](_0x4a21cd));_0x593c76(_0x4a21cd);})[_0xe270('0x14')](function(_0x405ff9){logger[_0xe270('0x10')]('ShowTrigger',_0x405ff9[_0xe270('0x11')],_0x455856);_0x34ac27(_0x1c8333[_0xe270('0x10')](0x1f4,_0x405ff9['message']));});});}; \ No newline at end of file +var _0x054e=['http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','GetTrigger','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x448ea0,_0x362ce0){var _0x48bd53=function(_0x549ca7){while(--_0x549ca7){_0x448ea0['push'](_0x448ea0['shift']());}};_0x48bd53(++_0x362ce0);}(_0x054e,0x7c));var _0xe054=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x054e[_0x295314];return _0x584b0c;};'use strict';var _=require(_0xe054('0x0'));var util=require(_0xe054('0x1'));var moment=require(_0xe054('0x2'));var BPromise=require(_0xe054('0x3'));var rs=require(_0xe054('0x4'));var fs=require('fs');var Redis=require(_0xe054('0x5'));var db=require(_0xe054('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe054('0x7'))(_0xe054('0x8'));var config=require(_0xe054('0x9'));var jayson=require(_0xe054('0xa'));var client=jayson[_0xe054('0xb')][_0xe054('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39caf2,_0x2c44bf,_0x2d6505){return new BPromise(function(_0x38e6bc,_0x1db413){return client['request'](_0x39caf2,_0x2d6505)[_0xe054('0xd')](function(_0x2fc5ac){logger[_0xe054('0xe')](_0xe054('0xf'),_0x2c44bf,_0xe054('0x10'));logger[_0xe054('0x11')](_0xe054('0x12'),_0x2c44bf,'request\x20sent',JSON[_0xe054('0x13')](_0x2fc5ac));if(_0x2fc5ac[_0xe054('0x14')]){if(_0x2fc5ac['error']['code']===0x1f4){logger['error'](_0xe054('0xf'),_0x2c44bf,_0x2fc5ac[_0xe054('0x14')][_0xe054('0x15')]);return _0x1db413(_0x2fc5ac[_0xe054('0x14')][_0xe054('0x15')]);}logger['error'](_0xe054('0xf'),_0x2c44bf,_0x2fc5ac[_0xe054('0x14')]['message']);return _0x38e6bc(_0x2fc5ac[_0xe054('0x14')][_0xe054('0x15')]);}else{logger['info'](_0xe054('0xf'),_0x2c44bf,_0xe054('0x10'));_0x38e6bc(_0x2fc5ac['result']['message']);}})[_0xe054('0x16')](function(_0x3fb2b9){logger['error'](_0xe054('0xf'),_0x2c44bf,_0x3fb2b9);_0x1db413(_0x3fb2b9);});});}exports['GetTrigger']=function(_0x384272){var _0x11b73c=this;return new Promise(function(_0x4819fd,_0x3410fe){return db[_0xe054('0x17')][_0xe054('0x18')]({'raw':_0x384272[_0xe054('0x19')]?_0x384272['options'][_0xe054('0x1a')]===undefined?!![]:![]:!![],'where':_0x384272[_0xe054('0x19')]?_0x384272['options'][_0xe054('0x1b')]||null:null,'attributes':_0x384272[_0xe054('0x19')]?_0x384272[_0xe054('0x19')][_0xe054('0x1c')]||null:null,'limit':_0x384272[_0xe054('0x19')]?_0x384272[_0xe054('0x19')]['limit']||null:null,'include':_0x384272[_0xe054('0x19')]?_0x384272[_0xe054('0x19')][_0xe054('0x1d')]?_[_0xe054('0x1e')](_0x384272[_0xe054('0x19')][_0xe054('0x1d')],function(_0x2f421c){return{'model':db[_0x2f421c['model']],'as':_0x2f421c['as'],'attributes':_0x2f421c['attributes'],'include':_0x2f421c['include']?_[_0xe054('0x1e')](_0x2f421c[_0xe054('0x1d')],function(_0x8de042){return{'model':db[_0x8de042['model']],'as':_0x8de042['as'],'attributes':_0x8de042[_0xe054('0x1c')],'include':_0x8de042[_0xe054('0x1d')]?_[_0xe054('0x1e')](_0x8de042[_0xe054('0x1d')],function(_0x44f957){return{'model':db[_0x44f957[_0xe054('0x1f')]],'as':_0x44f957['as'],'attributes':_0x44f957[_0xe054('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe054('0xd')](function(_0x359e6f){logger[_0xe054('0xe')](_0xe054('0x20'),_0x384272);logger['debug'](_0xe054('0x20'),_0x384272,JSON[_0xe054('0x13')](_0x359e6f));_0x4819fd(_0x359e6f);})['catch'](function(_0x257370){logger['error'](_0xe054('0x20'),_0x257370[_0xe054('0x15')],_0x384272);_0x3410fe(_0x11b73c[_0xe054('0x14')](0x1f4,_0x257370[_0xe054('0x15')]));});});};exports[_0xe054('0x21')]=function(_0x169143){var _0x6a17e2=this;return new Promise(function(_0x1f036b,_0x23919c){return db[_0xe054('0x17')]['find']({'raw':_0x169143[_0xe054('0x19')]?_0x169143[_0xe054('0x19')][_0xe054('0x1a')]===undefined?!![]:![]:!![],'where':_0x169143[_0xe054('0x19')]?_0x169143[_0xe054('0x19')][_0xe054('0x1b')]||null:null,'attributes':_0x169143[_0xe054('0x19')]?_0x169143[_0xe054('0x19')][_0xe054('0x1c')]||null:null,'include':_0x169143[_0xe054('0x19')]?_0x169143[_0xe054('0x19')][_0xe054('0x1d')]?_['map'](_0x169143['options'][_0xe054('0x1d')],function(_0xc3f474){return{'model':db[_0xc3f474['model']],'as':_0xc3f474['as'],'attributes':_0xc3f474[_0xe054('0x1c')],'include':_0xc3f474[_0xe054('0x1d')]?_[_0xe054('0x1e')](_0xc3f474[_0xe054('0x1d')],function(_0x5434ba){return{'model':db[_0x5434ba['model']],'as':_0x5434ba['as'],'attributes':_0x5434ba[_0xe054('0x1c')],'include':_0x5434ba[_0xe054('0x1d')]?_['map'](_0x5434ba[_0xe054('0x1d')],function(_0x290c24){return{'model':db[_0x290c24['model']],'as':_0x290c24['as'],'attributes':_0x290c24[_0xe054('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe054('0xd')](function(_0x5e95a1){logger['info']('ShowTrigger',_0x169143);logger[_0xe054('0x11')](_0xe054('0x21'),_0x169143,JSON['stringify'](_0x5e95a1));_0x1f036b(_0x5e95a1);})[_0xe054('0x16')](function(_0xc7c4bd){logger[_0xe054('0x14')](_0xe054('0x21'),_0xc7c4bd[_0xe054('0x15')],_0x169143);_0x23919c(_0x6a17e2[_0xe054('0x14')](0x1f4,_0xc7c4bd['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1214b58..bdfc151 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 _0x43aa=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trunk.controller','index','get','/:id','isAuthenticated','post','/:id/clone','clone','put','update','delete','destroy','exports','multer'];(function(_0x47c8f1,_0x3534cb){var _0x1deb50=function(_0x512cf7){while(--_0x512cf7){_0x47c8f1['push'](_0x47c8f1['shift']());}};_0x1deb50(++_0x3534cb);}(_0x43aa,0xfb));var _0xa43a=function(_0x13a591,_0xd6367c){_0x13a591=_0x13a591-0x0;var _0x1592f0=_0x43aa[_0x13a591];return _0x1592f0;};'use strict';var multer=require(_0xa43a('0x0'));var util=require(_0xa43a('0x1'));var path=require(_0xa43a('0x2'));var timeout=require(_0xa43a('0x3'));var express=require(_0xa43a('0x4'));var router=express[_0xa43a('0x5')]();var fs_extra=require(_0xa43a('0x6'));var auth=require(_0xa43a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa43a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa43a('0x9')]);router[_0xa43a('0xa')](_0xa43a('0xb'),auth[_0xa43a('0xc')](),controller['show']);router[_0xa43a('0xd')](_0xa43a('0xe'),auth[_0xa43a('0xc')](),controller[_0xa43a('0xf')]);router[_0xa43a('0xd')]('/',auth[_0xa43a('0xc')](),controller['create']);router[_0xa43a('0x10')]('/:id',auth[_0xa43a('0xc')](),controller[_0xa43a('0x11')]);router[_0xa43a('0x12')](_0xa43a('0xb'),auth[_0xa43a('0xc')](),controller[_0xa43a('0x13')]);module[_0xa43a('0x14')]=router; \ No newline at end of file +var _0x33ee=['./trunk.controller','isAuthenticated','get','/:id','show','/:id/clone','clone','post','put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c71aa,_0x537dd5){var _0x33ee6a=function(_0x5b2b15){while(--_0x5b2b15){_0x1c71aa['push'](_0x1c71aa['shift']());}};_0x33ee6a(++_0x537dd5);}(_0x33ee,0x13a));var _0xe33e=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x33ee[_0x22b8a3];return _0x199a0c;};'use strict';var multer=require(_0xe33e('0x0'));var util=require(_0xe33e('0x1'));var path=require('path');var timeout=require(_0xe33e('0x2'));var express=require(_0xe33e('0x3'));var router=express[_0xe33e('0x4')]();var fs_extra=require(_0xe33e('0x5'));var auth=require(_0xe33e('0x6'));var interaction=require(_0xe33e('0x7'));var config=require(_0xe33e('0x8'));var controller=require(_0xe33e('0x9'));router['get']('/',auth[_0xe33e('0xa')](),controller['index']);router[_0xe33e('0xb')](_0xe33e('0xc'),auth['isAuthenticated'](),controller[_0xe33e('0xd')]);router['post'](_0xe33e('0xe'),auth[_0xe33e('0xa')](),controller[_0xe33e('0xf')]);router[_0xe33e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe33e('0x11')](_0xe33e('0xc'),auth[_0xe33e('0xa')](),controller['update']);router['delete'](_0xe33e('0xc'),auth[_0xe33e('0xa')](),controller[_0xe33e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2f8dca8..7a2822b 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 _0xaeba=['never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','STRING','name','ENUM','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x1ac7f8,_0x17d8d8){var _0x11c7ac=function(_0x186bb9){while(--_0x186bb9){_0x1ac7f8['push'](_0x1ac7f8['shift']());}};_0x11c7ac(++_0x17d8d8);}(_0xaeba,0xdd));var _0xaaeb=function(_0x4ead9b,_0x5cffd0){_0x4ead9b=_0x4ead9b-0x0;var _0x36f7f6=_0xaeba[_0x4ead9b];return _0x36f7f6;};'use strict';var Sequelize=require(_0xaaeb('0x0'));module[_0xaaeb('0x1')]={'name':{'type':Sequelize[_0xaaeb('0x2')],'allowNull':![],'unique':_0xaaeb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaaeb('0x4')]('friend',_0xaaeb('0x5'),_0xaaeb('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xaaeb('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x7'),_0xaaeb('0x8'),_0xaaeb('0x9'),'ALLOWED',_0xaaeb('0xa'),'PROHIB_PASSED_SCREEN',_0xaaeb('0xb'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xaaeb('0x2')]},'md5secret':{'type':Sequelize[_0xaaeb('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':'udp','set':function(_0x2a7900){this[_0xaaeb('0xc')]('transport',_0x2a7900?_0x2a7900[_0xaaeb('0xd')](','):null);},'get':function(){return this[_0xaaeb('0xe')]('transport')?this[_0xaaeb('0xe')](_0xaaeb('0xf'))[_0xaaeb('0x10')](','):null;},'comment':_0xaaeb('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xaaeb('0x12'),_0xaaeb('0x13'),_0xaaeb('0x14'),'inband','auto'),'defaultValue':_0xaaeb('0x12')},'directmedia':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no',_0xaaeb('0x16'),'update',_0xaaeb('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaaeb('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaaeb('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':_0xaaeb('0x18'),'set':function(_0xb8707d){this[_0xaaeb('0xc')](_0xaaeb('0x19'),_0xb8707d?_0xb8707d[_0xaaeb('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xaaeb('0x19'))?this[_0xaaeb('0xe')](_0xaaeb('0x19'))[_0xaaeb('0x10')](','):null;},'comment':_0xaaeb('0x1a')},'callgroup':{'type':Sequelize[_0xaaeb('0x2')]},'namedcallgroup':{'type':Sequelize[_0xaaeb('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xaaeb('0x2')]},'language':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaaeb('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':_0xaaeb('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaaeb('0x1c'),'set':function(_0x59b31e){this[_0xaaeb('0xc')](_0xaaeb('0x1d'),_0x59b31e?_0x59b31e[_0xaaeb('0xd')](';'):_0xaaeb('0x1c'));},'get':function(){return this[_0xaaeb('0xe')](_0xaaeb('0x1d'))?this[_0xaaeb('0xe')](_0xaaeb('0x1d'))['split'](';'):null;},'comment':_0xaaeb('0x1e')},'autoframing':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'insecure':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':_0xaaeb('0x1f'),'set':function(_0xeeb40f){this['setDataValue'](_0xaaeb('0x20'),_0xeeb40f?_0xeeb40f[_0xaaeb('0xd')](','):null);},'get':function(){return this[_0xaaeb('0xe')](_0xaaeb('0x20'))?this[_0xaaeb('0xe')](_0xaaeb('0x20'))[_0xaaeb('0x10')](','):null;},'comment':_0xaaeb('0x21')},'trustrpid':{'type':Sequelize[_0xaaeb('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xaaeb('0x22'))},'promiscredir':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'accountcode':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'setvar':{'type':Sequelize[_0xaaeb('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xaaeb('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xaaeb('0x4')]('yes','no'),'defaultValue':_0xaaeb('0x15')},'busylevel':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xaaeb('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xaaeb('0x15'),'no',_0xaaeb('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'mailbox':{'type':Sequelize[_0xaaeb('0x2')]},'session_timers':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x26'),_0xaaeb('0x27'),_0xaaeb('0x28'))},'session_expires':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xaaeb('0x29'),'uas'),'defaultValue':_0xaaeb('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xaaeb('0x2')]},'regexten':{'type':Sequelize[_0xaaeb('0x2')]},'fromdomain':{'type':Sequelize[_0xaaeb('0x2')]},'fromuser':{'type':Sequelize[_0xaaeb('0x2')]},'port':{'type':Sequelize[_0xaaeb('0x23')](0x5)},'qualify':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no'),'defaultValue':_0xaaeb('0x15')},'keepalive':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xaaeb('0x2')]},'defaultuser':{'type':Sequelize[_0xaaeb('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xaaeb('0x15'),'no',_0xaaeb('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xaaeb('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xaaeb('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xaaeb('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xaaeb('0x2')]},'use_q850_reason':{'type':Sequelize[_0xaaeb('0x2')]},'maxforwards':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'encryption':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xaaeb('0x15'),'no')},'icesupport':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xaaeb('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no','fingerprint',_0xaaeb('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xaaeb('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xaaeb('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xaaeb('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xaaeb('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xaaeb('0x2d'),_0xaaeb('0x2e'),_0xaaeb('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xaaeb('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xaaeb('0x4')](_0xaaeb('0x15'),'no')},'vmexten':{'type':Sequelize[_0xaaeb('0x2')]},'mohinterpret':{'type':Sequelize[_0xaaeb('0x2')]},'mohsuggest':{'type':Sequelize[_0xaaeb('0x2')]},'parkinglot':{'type':Sequelize[_0xaaeb('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':_0xaaeb('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xaaeb('0x15'),'no',_0xaaeb('0x16'),_0xaaeb('0x31'),_0xaaeb('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xaaeb('0x2')]},'otherFields':{'type':Sequelize[_0xaaeb('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xaaeb('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x269d=['outgoing','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','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','pai','fingerprint','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat'];(function(_0x363e85,_0x4f7463){var _0x413c8f=function(_0x2ed7e9){while(--_0x2ed7e9){_0x363e85['push'](_0x363e85['shift']());}};_0x413c8f(++_0x4f7463);}(_0x269d,0x167));var _0xd269=function(_0x3db4d1,_0x15e8c8){_0x3db4d1=_0x3db4d1-0x0;var _0x9b239d=_0x269d[_0x3db4d1];return _0x9b239d;};'use strict';var Sequelize=require(_0xd269('0x0'));module[_0xd269('0x1')]={'name':{'type':Sequelize[_0xd269('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x4'),'user',_0xd269('0x5')),'allowNull':![],'defaultValue':_0xd269('0x4')},'context':{'type':Sequelize[_0xd269('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x6'),'ALLOWED_PASSED_SCREEN',_0xd269('0x7'),'ALLOWED',_0xd269('0x8'),_0xd269('0x9'),_0xd269('0xa'),_0xd269('0xb'))},'deny':{'type':Sequelize[_0xd269('0x2')]},'permit':{'type':Sequelize[_0xd269('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd269('0x2')]},'transport':{'type':Sequelize[_0xd269('0x2')],'defaultValue':_0xd269('0xc'),'set':function(_0x4c97dc){this[_0xd269('0xd')](_0xd269('0xe'),_0x4c97dc?_0x4c97dc['join'](','):null);},'get':function(){return this[_0xd269('0xf')](_0xd269('0xe'))?this[_0xd269('0xf')](_0xd269('0xe'))[_0xd269('0x10')](','):null;},'comment':_0xd269('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd269('0x12'),_0xd269('0x13'),_0xd269('0x14'),_0xd269('0x15'),_0xd269('0x16')),'defaultValue':_0xd269('0x12')},'directmedia':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no',_0xd269('0x18'),'update',_0xd269('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd269('0x2')]},'directmediadeny':{'type':Sequelize[_0xd269('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xd269('0x1a'),'set':function(_0x1422d1){this['setDataValue'](_0xd269('0x1b'),_0x1422d1?_0x1422d1[_0xd269('0x1c')](','):null);},'get':function(){return this[_0xd269('0xf')](_0xd269('0x1b'))?this['getDataValue'](_0xd269('0x1b'))['split'](','):null;},'comment':_0xd269('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd269('0x2')]},'pickupgroup':{'type':Sequelize[_0xd269('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd269('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd269('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd269('0x2')],'defaultValue':_0xd269('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd269('0x1f'),'set':function(_0x203fcf){this[_0xd269('0xd')](_0xd269('0x20'),_0x203fcf?_0x203fcf['join'](';'):_0xd269('0x1f'));},'get':function(){return this[_0xd269('0xf')](_0xd269('0x20'))?this[_0xd269('0xf')]('allow')[_0xd269('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'insecure':{'type':Sequelize[_0xd269('0x2')],'defaultValue':_0xd269('0x21'),'set':function(_0x2c1202){this[_0xd269('0xd')]('insecure',_0x2c1202?_0x2c1202[_0xd269('0x1c')](','):null);},'get':function(){return this[_0xd269('0xf')](_0xd269('0x22'))?this[_0xd269('0xf')](_0xd269('0x22'))[_0xd269('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd269('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd269('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never')},'promiscredir':{'type':Sequelize[_0xd269('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'accountcode':{'type':Sequelize[_0xd269('0x23')](0xb)},'setvar':{'type':Sequelize[_0xd269('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xd269('0x24')},'amaflags':{'type':Sequelize[_0xd269('0x2')]},'callcounter':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no'),'defaultValue':_0xd269('0x17')},'busylevel':{'type':Sequelize[_0xd269('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd269('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd269('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xd269('0x2')]},'template':{'type':Sequelize[_0xd269('0x2')]},'videosupport':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no',_0xd269('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd269('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'mailbox':{'type':Sequelize[_0xd269('0x2')]},'session_timers':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x26'),'refuse',_0xd269('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xd269('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd269('0x28'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xd269('0x2')]},'regexten':{'type':Sequelize[_0xd269('0x2')]},'fromdomain':{'type':Sequelize[_0xd269('0x2')]},'fromuser':{'type':Sequelize[_0xd269('0x2')]},'port':{'type':Sequelize[_0xd269('0x23')](0x5)},'qualify':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no'),'defaultValue':_0xd269('0x17')},'keepalive':{'type':Sequelize[_0xd269('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd269('0x2')]},'defaultuser':{'type':Sequelize[_0xd269('0x2')]},'rtptimeout':{'type':Sequelize[_0xd269('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd269('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd269('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no',_0xd269('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd269('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xd269('0x2')]},'contactdeny':{'type':Sequelize[_0xd269('0x2')]},'contactacl':{'type':Sequelize[_0xd269('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xd269('0x2')]},'maxforwards':{'type':Sequelize[_0xd269('0x23')](0xb)},'encryption':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'force_avp':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'icesupport':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no',_0xd269('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xd269('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd269('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xd269('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xd269('0x2')]},'dtlscapath':{'type':Sequelize[_0xd269('0x2')]},'dtlssetup':{'type':Sequelize[_0xd269('0x3')]('active',_0xd269('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd269('0x2')]},'usereqphone':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xd269('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xd269('0x3')](_0xd269('0x17'),'no')},'vmexten':{'type':Sequelize[_0xd269('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xd269('0x2')]},'parkinglot':{'type':Sequelize[_0xd269('0x2')]},'description':{'type':Sequelize[_0xd269('0x2')]},'host':{'type':Sequelize[_0xd269('0x2')],'defaultValue':_0xd269('0x2c')},'canreinvite':{'type':Sequelize[_0xd269('0x3')]('yes','no',_0xd269('0x18'),_0xd269('0x2d'),_0xd269('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd269('0x2')]},'active':{'type':Sequelize[_0xd269('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd269('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 3527f97..26bcf03 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 _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(_0x59a903,_0x281c6c){var _0x187c59=function(_0x415be1){while(--_0x415be1){_0x59a903['push'](_0x59a903['shift']());}};_0x187c59(++_0x281c6c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x56b9b5,_0x452847){_0x56b9b5=_0x56b9b5-0x0;var _0x142072=_0xd6d6[_0x56b9b5];return _0x142072;};'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 +var _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3de56d,_0x239509){var _0xb41f3d=function(_0x1273ea){while(--_0x1273ea){_0x3de56d['push'](_0x3de56d['shift']());}};_0xb41f3d(++_0x239509);}(_0xbec5,0xe5));var _0x5bec=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xbec5[_0x57d13b];return _0x467696;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4cac5ff..533518e 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 _0x02b8=['./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x317722,_0x58fba2){var _0xa152ad=function(_0x1a1b4e){while(--_0x1a1b4e){_0x317722['push'](_0x317722['shift']());}};_0xa152ad(++_0x58fba2);}(_0x02b8,0x86));var _0x802b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x02b8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x802b('0x0'));var util=require(_0x802b('0x1'));var logger=require(_0x802b('0x2'))(_0x802b('0x3'));var moment=require(_0x802b('0x4'));var BPromise=require(_0x802b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x802b('0x6'));var rimraf=require(_0x802b('0x7'));var config=require(_0x802b('0x8'));var attributes=require(_0x802b('0x9'));module['exports']=function(_0x4424da,_0x4beb1f){return _0x4424da[_0x802b('0xa')](_0x802b('0xb'),attributes,{'tableName':_0x802b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60a6=['../../config/logger','api','moment','request-promise','path','rimraf','./trunk.attributes','Trunk','tools_trunks','util'];(function(_0x35d958,_0x82c5ba){var _0x3813bb=function(_0x9448bb){while(--_0x9448bb){_0x35d958['push'](_0x35d958['shift']());}};_0x3813bb(++_0x82c5ba);}(_0x60a6,0x121));var _0x660a=function(_0x49dc30,_0x1f5981){_0x49dc30=_0x49dc30-0x0;var _0x407520=_0x60a6[_0x49dc30];return _0x407520;};'use strict';var _=require('lodash');var util=require(_0x660a('0x0'));var logger=require(_0x660a('0x1'))(_0x660a('0x2'));var moment=require(_0x660a('0x3'));var BPromise=require('bluebird');var rp=require(_0x660a('0x4'));var fs=require('fs');var path=require(_0x660a('0x5'));var rimraf=require(_0x660a('0x6'));var config=require('../../config/environment');var attributes=require(_0x660a('0x7'));module['exports']=function(_0x5b6ce3,_0xbb44d1){return _0x5b6ce3['define'](_0x660a('0x8'),attributes,{'tableName':_0x660a('0x9'),'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 6d7e52f..bc6a53e 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 _0x19aa=['findAll','options','where','attributes','limit','include','map','model','ShowTrunk','Trunk','find','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk'];(function(_0x2be240,_0x1e119d){var _0x123543=function(_0x580bf4){while(--_0x580bf4){_0x2be240['push'](_0x2be240['shift']());}};_0x123543(++_0x1e119d);}(_0x19aa,0x147));var _0xa19a=function(_0x44f139,_0x1814ab){_0x44f139=_0x44f139-0x0;var _0x5913b7=_0x19aa[_0x44f139];return _0x5913b7;};'use strict';var _=require(_0xa19a('0x0'));var util=require(_0xa19a('0x1'));var moment=require('moment');var BPromise=require(_0xa19a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa19a('0x4'));var logger=require(_0xa19a('0x5'))(_0xa19a('0x6'));var config=require(_0xa19a('0x7'));var jayson=require(_0xa19a('0x8'));var client=jayson[_0xa19a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x80b4d7,_0x25776a,_0x2af195){return new BPromise(function(_0x1878d8,_0x3cb206){return client['request'](_0x80b4d7,_0x2af195)[_0xa19a('0xa')](function(_0x111dd7){logger[_0xa19a('0xb')](_0xa19a('0xc'),_0x25776a,_0xa19a('0xd'));logger[_0xa19a('0xe')](_0xa19a('0xf'),_0x25776a,'request\x20sent',JSON[_0xa19a('0x10')](_0x111dd7));if(_0x111dd7['error']){if(_0x111dd7[_0xa19a('0x11')][_0xa19a('0x12')]===0x1f4){logger[_0xa19a('0x11')](_0xa19a('0xc'),_0x25776a,_0x111dd7[_0xa19a('0x11')][_0xa19a('0x13')]);return _0x3cb206(_0x111dd7[_0xa19a('0x11')]['message']);}logger[_0xa19a('0x11')](_0xa19a('0xc'),_0x25776a,_0x111dd7[_0xa19a('0x11')]['message']);return _0x1878d8(_0x111dd7[_0xa19a('0x11')][_0xa19a('0x13')]);}else{logger[_0xa19a('0xb')]('Trunk,\x20%s,\x20%s',_0x25776a,_0xa19a('0xd'));_0x1878d8(_0x111dd7[_0xa19a('0x14')][_0xa19a('0x13')]);}})[_0xa19a('0x15')](function(_0x3a4b69){logger['error'](_0xa19a('0xc'),_0x25776a,_0x3a4b69);_0x3cb206(_0x3a4b69);});});}exports[_0xa19a('0x16')]=function(_0x405551){var _0x5c0037=this;return new Promise(function(_0x138001,_0xc0feed){return db['Trunk'][_0xa19a('0x17')]({'raw':_0x405551[_0xa19a('0x18')]?_0x405551[_0xa19a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x405551[_0xa19a('0x18')]?_0x405551[_0xa19a('0x18')][_0xa19a('0x19')]||null:null,'attributes':_0x405551[_0xa19a('0x18')]?_0x405551['options'][_0xa19a('0x1a')]||null:null,'limit':_0x405551[_0xa19a('0x18')]?_0x405551[_0xa19a('0x18')][_0xa19a('0x1b')]||null:null,'include':_0x405551[_0xa19a('0x18')]?_0x405551['options'][_0xa19a('0x1c')]?_[_0xa19a('0x1d')](_0x405551[_0xa19a('0x18')][_0xa19a('0x1c')],function(_0x525cdc){return{'model':db[_0x525cdc[_0xa19a('0x1e')]],'as':_0x525cdc['as'],'attributes':_0x525cdc[_0xa19a('0x1a')],'include':_0x525cdc[_0xa19a('0x1c')]?_[_0xa19a('0x1d')](_0x525cdc['include'],function(_0x2d13c0){return{'model':db[_0x2d13c0[_0xa19a('0x1e')]],'as':_0x2d13c0['as'],'attributes':_0x2d13c0[_0xa19a('0x1a')],'include':_0x2d13c0[_0xa19a('0x1c')]?_['map'](_0x2d13c0[_0xa19a('0x1c')],function(_0x311c8a){return{'model':db[_0x311c8a[_0xa19a('0x1e')]],'as':_0x311c8a['as'],'attributes':_0x311c8a[_0xa19a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa19a('0xa')](function(_0x1ede1a){logger[_0xa19a('0xb')](_0xa19a('0x16'),_0x405551);logger['debug']('GetTrunk',_0x405551,JSON[_0xa19a('0x10')](_0x1ede1a));_0x138001(_0x1ede1a);})[_0xa19a('0x15')](function(_0xa7a683){logger[_0xa19a('0x11')](_0xa19a('0x16'),_0xa7a683['message'],_0x405551);_0xc0feed(_0x5c0037[_0xa19a('0x11')](0x1f4,_0xa7a683['message']));});});};exports[_0xa19a('0x1f')]=function(_0x307baa){var _0x5ba416=this;return new Promise(function(_0x2a87e4,_0x76615e){return db[_0xa19a('0x20')][_0xa19a('0x21')]({'raw':_0x307baa[_0xa19a('0x18')]?_0x307baa[_0xa19a('0x18')][_0xa19a('0x22')]===undefined?!![]:![]:!![],'where':_0x307baa[_0xa19a('0x18')]?_0x307baa[_0xa19a('0x18')][_0xa19a('0x19')]||null:null,'attributes':_0x307baa[_0xa19a('0x18')]?_0x307baa['options'][_0xa19a('0x1a')]||null:null,'include':_0x307baa['options']?_0x307baa[_0xa19a('0x18')]['include']?_[_0xa19a('0x1d')](_0x307baa[_0xa19a('0x18')][_0xa19a('0x1c')],function(_0x33d075){return{'model':db[_0x33d075[_0xa19a('0x1e')]],'as':_0x33d075['as'],'attributes':_0x33d075['attributes'],'include':_0x33d075[_0xa19a('0x1c')]?_[_0xa19a('0x1d')](_0x33d075['include'],function(_0x2e9e45){return{'model':db[_0x2e9e45['model']],'as':_0x2e9e45['as'],'attributes':_0x2e9e45[_0xa19a('0x1a')],'include':_0x2e9e45[_0xa19a('0x1c')]?_[_0xa19a('0x1d')](_0x2e9e45[_0xa19a('0x1c')],function(_0x949a5b){return{'model':db[_0x949a5b[_0xa19a('0x1e')]],'as':_0x949a5b['as'],'attributes':_0x949a5b[_0xa19a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa19a('0xa')](function(_0x5eb0db){logger['info'](_0xa19a('0x1f'),_0x307baa);logger[_0xa19a('0xe')](_0xa19a('0x1f'),_0x307baa,JSON[_0xa19a('0x10')](_0x5eb0db));_0x2a87e4(_0x5eb0db);})[_0xa19a('0x15')](function(_0x5a8bd6){logger['error'](_0xa19a('0x1f'),_0x5a8bd6[_0xa19a('0x13')],_0x307baa);_0x76615e(_0x5ba416['error'](0x1f4,_0x5a8bd6[_0xa19a('0x13')]));});});}; \ No newline at end of file +var _0xfd87=['message','info','result','catch','GetTrunk','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowTrunk','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x11f4dd,_0xa00377){var _0x31b64b=function(_0x539a18){while(--_0x539a18){_0x11f4dd['push'](_0x11f4dd['shift']());}};_0x31b64b(++_0xa00377);}(_0xfd87,0x1b5));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var moment=require(_0x7fd8('0x2'));var BPromise=require('bluebird');var rs=require(_0x7fd8('0x3'));var fs=require('fs');var Redis=require(_0x7fd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fd8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7fd8('0x6'));var jayson=require(_0x7fd8('0x7'));var client=jayson[_0x7fd8('0x8')][_0x7fd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x513af7,_0x3d4a76,_0x3829d8){return new BPromise(function(_0x20f28a,_0x159bda){return client[_0x7fd8('0xa')](_0x513af7,_0x3829d8)['then'](function(_0xca0b7b){logger['info'](_0x7fd8('0xb'),_0x3d4a76,'request\x20sent');logger[_0x7fd8('0xc')](_0x7fd8('0xd'),_0x3d4a76,_0x7fd8('0xe'),JSON[_0x7fd8('0xf')](_0xca0b7b));if(_0xca0b7b[_0x7fd8('0x10')]){if(_0xca0b7b[_0x7fd8('0x10')][_0x7fd8('0x11')]===0x1f4){logger[_0x7fd8('0x10')](_0x7fd8('0xb'),_0x3d4a76,_0xca0b7b[_0x7fd8('0x10')][_0x7fd8('0x12')]);return _0x159bda(_0xca0b7b['error']['message']);}logger['error'](_0x7fd8('0xb'),_0x3d4a76,_0xca0b7b['error']['message']);return _0x20f28a(_0xca0b7b[_0x7fd8('0x10')][_0x7fd8('0x12')]);}else{logger[_0x7fd8('0x13')](_0x7fd8('0xb'),_0x3d4a76,_0x7fd8('0xe'));_0x20f28a(_0xca0b7b[_0x7fd8('0x14')][_0x7fd8('0x12')]);}})[_0x7fd8('0x15')](function(_0x3e5d17){logger[_0x7fd8('0x10')](_0x7fd8('0xb'),_0x3d4a76,_0x3e5d17);_0x159bda(_0x3e5d17);});});}exports[_0x7fd8('0x16')]=function(_0x57f50f){var _0x363ced=this;return new Promise(function(_0x5d9fcb,_0x155ccb){return db['Trunk'][_0x7fd8('0x17')]({'raw':_0x57f50f[_0x7fd8('0x18')]?_0x57f50f[_0x7fd8('0x18')][_0x7fd8('0x19')]===undefined?!![]:![]:!![],'where':_0x57f50f[_0x7fd8('0x18')]?_0x57f50f[_0x7fd8('0x18')][_0x7fd8('0x1a')]||null:null,'attributes':_0x57f50f[_0x7fd8('0x18')]?_0x57f50f['options'][_0x7fd8('0x1b')]||null:null,'limit':_0x57f50f['options']?_0x57f50f[_0x7fd8('0x18')][_0x7fd8('0x1c')]||null:null,'include':_0x57f50f['options']?_0x57f50f[_0x7fd8('0x18')]['include']?_[_0x7fd8('0x1d')](_0x57f50f['options'][_0x7fd8('0x1e')],function(_0x57654f){return{'model':db[_0x57654f[_0x7fd8('0x1f')]],'as':_0x57654f['as'],'attributes':_0x57654f[_0x7fd8('0x1b')],'include':_0x57654f[_0x7fd8('0x1e')]?_[_0x7fd8('0x1d')](_0x57654f['include'],function(_0x175263){return{'model':db[_0x175263[_0x7fd8('0x1f')]],'as':_0x175263['as'],'attributes':_0x175263['attributes'],'include':_0x175263[_0x7fd8('0x1e')]?_[_0x7fd8('0x1d')](_0x175263[_0x7fd8('0x1e')],function(_0xf13d90){return{'model':db[_0xf13d90[_0x7fd8('0x1f')]],'as':_0xf13d90['as'],'attributes':_0xf13d90[_0x7fd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7fd8('0x20')](function(_0x4311a9){logger['info'](_0x7fd8('0x16'),_0x57f50f);logger[_0x7fd8('0xc')](_0x7fd8('0x16'),_0x57f50f,JSON[_0x7fd8('0xf')](_0x4311a9));_0x5d9fcb(_0x4311a9);})[_0x7fd8('0x15')](function(_0x996e72){logger['error']('GetTrunk',_0x996e72[_0x7fd8('0x12')],_0x57f50f);_0x155ccb(_0x363ced[_0x7fd8('0x10')](0x1f4,_0x996e72[_0x7fd8('0x12')]));});});};exports[_0x7fd8('0x21')]=function(_0x3b6638){var _0x209784=this;return new Promise(function(_0x2740f6,_0x21b9f6){return db['Trunk'][_0x7fd8('0x22')]({'raw':_0x3b6638[_0x7fd8('0x18')]?_0x3b6638[_0x7fd8('0x18')][_0x7fd8('0x19')]===undefined?!![]:![]:!![],'where':_0x3b6638[_0x7fd8('0x18')]?_0x3b6638[_0x7fd8('0x18')]['where']||null:null,'attributes':_0x3b6638[_0x7fd8('0x18')]?_0x3b6638[_0x7fd8('0x18')]['attributes']||null:null,'include':_0x3b6638['options']?_0x3b6638[_0x7fd8('0x18')]['include']?_[_0x7fd8('0x1d')](_0x3b6638[_0x7fd8('0x18')][_0x7fd8('0x1e')],function(_0x150096){return{'model':db[_0x150096['model']],'as':_0x150096['as'],'attributes':_0x150096[_0x7fd8('0x1b')],'include':_0x150096['include']?_[_0x7fd8('0x1d')](_0x150096['include'],function(_0x59e929){return{'model':db[_0x59e929[_0x7fd8('0x1f')]],'as':_0x59e929['as'],'attributes':_0x59e929[_0x7fd8('0x1b')],'include':_0x59e929['include']?_['map'](_0x59e929[_0x7fd8('0x1e')],function(_0x57144d){return{'model':db[_0x57144d[_0x7fd8('0x1f')]],'as':_0x57144d['as'],'attributes':_0x57144d[_0x7fd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7fd8('0x20')](function(_0x4ef6b2){logger[_0x7fd8('0x13')]('ShowTrunk',_0x3b6638);logger[_0x7fd8('0xc')](_0x7fd8('0x21'),_0x3b6638,JSON[_0x7fd8('0xf')](_0x4ef6b2));_0x2740f6(_0x4ef6b2);})['catch'](function(_0xf2afda){logger[_0x7fd8('0x10')](_0x7fd8('0x21'),_0xf2afda[_0x7fd8('0x12')],_0x3b6638);_0x21b9f6(_0x209784[_0x7fd8('0x10')](0x1f4,_0xf2afda[_0x7fd8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b03931c..86e690c 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa427=['./user-setting.controller','/:id','update','exports','express','Router'];(function(_0x32da24,_0x4a85e4){var _0x333b00=function(_0x31bf91){while(--_0x31bf91){_0x32da24['push'](_0x32da24['shift']());}};_0x333b00(++_0x4a85e4);}(_0xa427,0x154));var _0x7a42=function(_0x4387ab,_0x4ac0bd){_0x4387ab=_0x4387ab-0x0;var _0x11dde3=_0xa427[_0x4387ab];return _0x11dde3;};'use strict';var express=require(_0x7a42('0x0'));var router=express[_0x7a42('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7a42('0x2'));router['put'](_0x7a42('0x3'),auth['isAuthenticated'](),controller[_0x7a42('0x4')]);module[_0x7a42('0x5')]=router; \ No newline at end of file +var _0xf99d=['isAuthenticated','update','exports','./user-setting.controller','put','/:id'];(function(_0x1e0934,_0x4adc0d){var _0x287a11=function(_0x501451){while(--_0x501451){_0x1e0934['push'](_0x1e0934['shift']());}};_0x287a11(++_0x4adc0d);}(_0xf99d,0x165));var _0xdf99=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf99d[_0x2d7f0e];return _0x110b07;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xdf99('0x0'));router[_0xdf99('0x1')](_0xdf99('0x2'),auth[_0xdf99('0x3')](),controller[_0xdf99('0x4')]);module[_0xdf99('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 073b95c..06fdb19 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfd9=['error','BOOLEAN','INTEGER','UserId','sequelize','warning','info','debug','exports'];(function(_0x5539b3,_0x3dba3d){var _0x4c1327=function(_0x5036d6){while(--_0x5036d6){_0x5539b3['push'](_0x5539b3['shift']());}};_0x4c1327(++_0x3dba3d);}(_0xcfd9,0x13f));var _0x9cfd=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcfd9[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x9cfd('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x9cfd('0x1'),_0x9cfd('0x2'),_0x9cfd('0x3')];module[_0x9cfd('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x9cfd('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x9cfd('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x9cfd('0x7')],'unique':_0x9cfd('0x8')}}; \ No newline at end of file +var _0x140d=['sequelize','error','info','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x578529,_0x453e19){var _0x1943ba=function(_0x4d1d26){while(--_0x4d1d26){_0x578529['push'](_0x578529['shift']());}};_0x1943ba(++_0x453e19);}(_0x140d,0xc0));var _0xd140=function(_0x238a96,_0x5efd46){_0x238a96=_0x238a96-0x0;var _0x35713c=_0x140d[_0x238a96];return _0x35713c;};'use strict';var Sequelize=require(_0xd140('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd140('0x1'),'warning',_0xd140('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd140('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd140('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd140('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd140('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd140('0x6')],'unique':_0xd140('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 08d16cf..a69c0a6 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe148=['../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','then','error','stack','name','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','api'];(function(_0x74ab89,_0x4595bf){var _0x51d309=function(_0x1c3865){while(--_0x1c3865){_0x74ab89['push'](_0x74ab89['shift']());}};_0x51d309(++_0x4595bf);}(_0xe148,0x9e));var _0x8e14=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0xe148[_0x479650];return _0x26b288;};'use strict';var _=require(_0x8e14('0x0'));var Redis=require(_0x8e14('0x1'));var logger=require('../../config/logger')(_0x8e14('0x2'));var config=require(_0x8e14('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x8e14('0x4'))(new Redis(config[_0x8e14('0x5')]));require(_0x8e14('0x6'))[_0x8e14('0x7')](socket);config['redis']=_['defaults'](config[_0x8e14('0x5')],{'host':_0x8e14('0x8'),'port':0x18eb});function respondWithResult(_0x5d5232,_0x1a8608){_0x1a8608=_0x1a8608||0xc8;return function(_0x231d97){if(_0x231d97){return _0x5d5232[_0x8e14('0x9')](_0x1a8608)[_0x8e14('0xa')](_0x231d97);}};}function saveUpdates(_0x57b082){return function(_0x1aaba9){if(_0x1aaba9){return _0x1aaba9['update'](_0x57b082)[_0x8e14('0xb')](function(_0x2587a1){return _0x2587a1;});}return null;};}function handleEntityNotFound(_0x491a46){return function(_0x9a0381){if(!_0x9a0381){_0x491a46['sendStatus'](0x194);}return _0x9a0381;};}function handleError(_0x4792a0,_0x197f35){_0x197f35=_0x197f35||0x1f4;return function(_0x48554a){logger[_0x8e14('0xc')](_0x48554a[_0x8e14('0xd')]);if(_0x48554a['name']){delete _0x48554a[_0x8e14('0xe')];}_0x4792a0['status'](_0x197f35)['send'](_0x48554a);};}exports[_0x8e14('0xf')]=function(_0x5d85ce,_0x29a2b4){if(_0x5d85ce[_0x8e14('0x10')]['role']!=='admin')throw new Error(_0x8e14('0x11'));if(isNaN(Number(_0x5d85ce[_0x8e14('0x12')]['id'])))throw new Error(_0x8e14('0x13'));return db[_0x8e14('0x14')][_0x8e14('0x15')]({'where':{'id':_0x5d85ce['params']['id']}})[_0x8e14('0xb')](handleEntityNotFound(_0x29a2b4,null))[_0x8e14('0xb')](saveUpdates(_0x5d85ce['body'],null))[_0x8e14('0xb')](respondWithResult(_0x29a2b4,null))[_0x8e14('0x16')](handleError(_0x29a2b4,null));}; \ No newline at end of file +var _0xc560=['UserSetting','find','then','catch','lodash','../../config/logger','../../config/environment','redis','./user-setting.socket','register','localhost','status','update','error','stack','name','user','role','admin','params','Invalid\x20user\x20setting\x20id'];(function(_0x59109d,_0x50bf62){var _0x1cbf2d=function(_0x1a9a32){while(--_0x1a9a32){_0x59109d['push'](_0x59109d['shift']());}};_0x1cbf2d(++_0x50bf62);}(_0xc560,0x82));var _0x0c56=function(_0x81e38f,_0x241d6c){_0x81e38f=_0x81e38f-0x0;var _0xa3f85f=_0xc560[_0x81e38f];return _0xa3f85f;};'use strict';var _=require(_0x0c56('0x0'));var Redis=require('ioredis');var logger=require(_0x0c56('0x1'))('api');var config=require(_0x0c56('0x2'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0c56('0x3')]));require(_0x0c56('0x4'))[_0x0c56('0x5')](socket);config[_0x0c56('0x3')]=_['defaults'](config[_0x0c56('0x3')],{'host':_0x0c56('0x6'),'port':0x18eb});function respondWithResult(_0x35b4ee,_0x1245b3){_0x1245b3=_0x1245b3||0xc8;return function(_0x501a0b){if(_0x501a0b){return _0x35b4ee[_0x0c56('0x7')](_0x1245b3)['json'](_0x501a0b);}};}function saveUpdates(_0xd83c84){return function(_0x1642d8){if(_0x1642d8){return _0x1642d8[_0x0c56('0x8')](_0xd83c84)['then'](function(_0x15979a){return _0x15979a;});}return null;};}function handleEntityNotFound(_0x41fd41){return function(_0x3651c6){if(!_0x3651c6){_0x41fd41['sendStatus'](0x194);}return _0x3651c6;};}function handleError(_0x2dab08,_0x2ecc1d){_0x2ecc1d=_0x2ecc1d||0x1f4;return function(_0x2e2bec){logger[_0x0c56('0x9')](_0x2e2bec[_0x0c56('0xa')]);if(_0x2e2bec[_0x0c56('0xb')]){delete _0x2e2bec[_0x0c56('0xb')];}_0x2dab08['status'](_0x2ecc1d)['send'](_0x2e2bec);};}exports[_0x0c56('0x8')]=function(_0x3220b1,_0x367417){if(_0x3220b1[_0x0c56('0xc')][_0x0c56('0xd')]!==_0x0c56('0xe'))throw new Error('Unauthorized');if(isNaN(Number(_0x3220b1[_0x0c56('0xf')]['id'])))throw new Error(_0x0c56('0x10'));return db[_0x0c56('0x11')][_0x0c56('0x12')]({'where':{'id':_0x3220b1[_0x0c56('0xf')]['id']}})['then'](handleEntityNotFound(_0x367417,null))[_0x0c56('0x13')](saveUpdates(_0x3220b1['body'],null))['then'](respondWithResult(_0x367417,null))[_0x0c56('0x14')](handleError(_0x367417,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index fa705ff..2f6751c 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb61=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','UserSetting'];(function(_0x52f4d6,_0x2f4818){var _0xaa4059=function(_0x1ecfb3){while(--_0x1ecfb3){_0x52f4d6['push'](_0x52f4d6['shift']());}};_0xaa4059(++_0x2f4818);}(_0xeb61,0x8d));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1eb6('0x0'));var UserSetting=require(_0x1eb6('0x1'))['db'][_0x1eb6('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1eb6('0x3')](0x0);var events={'afterCreate':_0x1eb6('0x4'),'afterUpdate':_0x1eb6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x278838){return function(_0x9d1a54,_0x56c35f,_0x3051e6){UserSettingEvents[_0x1eb6('0x6')](_0x278838+':'+_0x9d1a54['id'],_0x9d1a54);UserSettingEvents[_0x1eb6('0x6')](_0x278838,_0x9d1a54);_0x3051e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1eb6('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xfd0c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xc36fe1,_0x4e8695){var _0x48ce2a=function(_0x59d307){while(--_0x59d307){_0xc36fe1['push'](_0xc36fe1['shift']());}};_0x48ce2a(++_0x4e8695);}(_0xfd0c,0xe4));var _0xcfd0=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0xfd0c[_0x3337b6];return _0x568270;};'use strict';var EventEmitter=require(_0xcfd0('0x0'));var UserSetting=require(_0xcfd0('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xcfd0('0x2')](0x0);var events={'afterCreate':_0xcfd0('0x3'),'afterUpdate':_0xcfd0('0x4'),'afterDestroy':_0xcfd0('0x5')};function emitEvent(_0x247db6){return function(_0x5d2e23,_0x5a5ecf,_0x147ed4){UserSettingEvents['emit'](_0x247db6+':'+_0x5d2e23['id'],_0x5d2e23);UserSettingEvents['emit'](_0x247db6,_0x5d2e23);_0x147ed4(null);};}for(var e in events){if(events[_0xcfd0('0x6')](e)){var event=events[e];UserSetting[_0xcfd0('0x7')](e,emitEvent(event));}}module[_0xcfd0('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 0ff6a2f..84acfe3 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7fa=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting'];(function(_0x4cbe50,_0x709c83){var _0x12c686=function(_0x343f12){while(--_0x343f12){_0x4cbe50['push'](_0x4cbe50['shift']());}};_0x12c686(++_0x709c83);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0xaa7f('0x0'));module['exports']=function(_0x5f4cc1){return _0x5f4cc1[_0xaa7f('0x1')](_0xaa7f('0x2'),attributes,{'tableName':_0xaa7f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x236e94){if(!_0x236e94['clientSideLoggingEnabled'])_0x236e94[_0xaa7f('0x4')]=null;else if(_0x236e94[_0xaa7f('0x4')]===null)_0x236e94[_0xaa7f('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xf996=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled'];(function(_0x5edfc5,_0x1563ab){var _0x35a64a=function(_0x18fefd){while(--_0x18fefd){_0x5edfc5['push'](_0x5edfc5['shift']());}};_0x35a64a(++_0x1563ab);}(_0xf996,0x74));var _0x6f99=function(_0x53b999,_0x18c7ad){_0x53b999=_0x53b999-0x0;var _0xd31ca9=_0xf996[_0x53b999];return _0xd31ca9;};'use strict';var attributes=require(_0x6f99('0x0'));module[_0x6f99('0x1')]=function(_0x31b31e){return _0x31b31e['define'](_0x6f99('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ceb57){if(!_0x5ceb57[_0x6f99('0x3')])_0x5ceb57[_0x6f99('0x4')]=null;else if(_0x5ceb57[_0x6f99('0x4')]===null)_0x5ceb57[_0x6f99('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index f10a789..1548a86 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe49d=['user-setting:update:user-','UserId','length','user-setting:','save','remove','update','emit','user-setting:update'];(function(_0x199c5e,_0x3aefcb){var _0xac1328=function(_0x1013de){while(--_0x1013de){_0x199c5e['push'](_0x199c5e['shift']());}};_0xac1328(++_0x3aefcb);}(_0xe49d,0x9d));var _0xde49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe49d[_0x321bb2];return _0x9c12ed;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xde49('0x0'),_0xde49('0x1'),_0xde49('0x2')];function createListener(_0x276ccf,_0x385c86){return function(_0x6d1825){_0x385c86[_0xde49('0x3')](_0x276ccf,_0x6d1825);if(_0x276ccf===_0xde49('0x4')){_0x385c86[_0xde49('0x3')](_0xde49('0x5')+_0x6d1825[_0xde49('0x6')],_0x6d1825);}};}exports['register']=function(_0x311f55){for(var _0x4031cf=0x0,_0x6f2650=events[_0xde49('0x7')];_0x4031cf<_0x6f2650;_0x4031cf++){var _0x5656eb=events[_0x4031cf];var _0x1fb83e=createListener(_0xde49('0x8')+_0x5656eb,_0x311f55);UserSettingEvents['on'](_0x5656eb,_0x1fb83e);}}; \ No newline at end of file +var _0xc8d5=['save','update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:'];(function(_0x5bd21e,_0x4988e1){var _0x31c586=function(_0x39b52c){while(--_0x39b52c){_0x5bd21e['push'](_0x5bd21e['shift']());}};_0x31c586(++_0x4988e1);}(_0xc8d5,0x1a8));var _0x5c8d=function(_0x1d3e56,_0x4c6131){_0x1d3e56=_0x1d3e56-0x0;var _0x46019=_0xc8d5[_0x1d3e56];return _0x46019;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5c8d('0x0'),'remove',_0x5c8d('0x1')];function createListener(_0x18b9f4,_0x483db2){return function(_0xcf5938){_0x483db2[_0x5c8d('0x2')](_0x18b9f4,_0xcf5938);if(_0x18b9f4===_0x5c8d('0x3')){_0x483db2[_0x5c8d('0x2')](_0x5c8d('0x4')+_0xcf5938['UserId'],_0xcf5938);}};}exports[_0x5c8d('0x5')]=function(_0xa36c6a){for(var _0xcf36ef=0x0,_0x158b16=events[_0x5c8d('0x6')];_0xcf36ef<_0x158b16;_0xcf36ef++){var _0x83f849=events[_0xcf36ef];var _0x477e6b=createListener(_0x5c8d('0x7')+_0x83f849,_0xa36c6a);UserSettingEvents['on'](_0x83f849,_0x477e6b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8483170..95b9777 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 _0xc396=['originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','/:id/sms_accounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','join','root','server/files/images/','now'];(function(_0x4aed69,_0x2719c9){var _0x360b9c=function(_0x221b52){while(--_0x221b52){_0x4aed69['push'](_0x4aed69['shift']());}};_0x360b9c(++_0x2719c9);}(_0xc396,0x18e));var _0x6c39=function(_0x14dc50,_0x21c3a0){_0x14dc50=_0x14dc50-0x0;var _0xdc374c=_0xc396[_0x14dc50];return _0xdc374c;};'use strict';var multer=require(_0x6c39('0x0'));var util=require(_0x6c39('0x1'));var path=require(_0x6c39('0x2'));var timeout=require(_0x6c39('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6c39('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6c39('0x5'));var config=require('../../config/environment');var controller=require(_0x6c39('0x6'));router['get']('/',auth[_0x6c39('0x7')](),controller[_0x6c39('0x8')]);router[_0x6c39('0x9')]('/describe',auth[_0x6c39('0x7')](),controller[_0x6c39('0xa')]);router[_0x6c39('0x9')](_0x6c39('0xb'),auth[_0x6c39('0x7')](),controller[_0x6c39('0xc')]);router[_0x6c39('0x9')](_0x6c39('0xd'),auth[_0x6c39('0x7')](),controller[_0x6c39('0xe')]);router[_0x6c39('0x9')](_0x6c39('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6c39('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x6c39('0x9')](_0x6c39('0x10'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x11')]);router['get']('/:id/contacts',auth[_0x6c39('0x7')](),controller['getContacts']);router[_0x6c39('0x9')](_0x6c39('0x12'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x13')]);router[_0x6c39('0x9')](_0x6c39('0x14'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x15')]);router[_0x6c39('0x9')](_0x6c39('0x16'),auth[_0x6c39('0x7')](),controller['getGroups']);router['get']('/:id/recordings',auth[_0x6c39('0x7')](),controller[_0x6c39('0x17')]);router['get']('/:id/screen_recordings',auth[_0x6c39('0x7')](),controller['getScreenRecordings']);router[_0x6c39('0x9')](_0x6c39('0x18'),auth[_0x6c39('0x7')](),controller['getChatInteractions']);router[_0x6c39('0x9')](_0x6c39('0x19'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x1a')]);router[_0x6c39('0x9')](_0x6c39('0x1b'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x1c')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x6c39('0x1d')]);router[_0x6c39('0x9')](_0x6c39('0x1e'),auth['isAuthenticated'](),controller[_0x6c39('0x1f')]);router['get'](_0x6c39('0x20'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x21')]);router['get']('/:id/teams',auth[_0x6c39('0x7')](),controller[_0x6c39('0x22')]);router[_0x6c39('0x9')](_0x6c39('0x23'),auth['isAuthenticated'](),controller[_0x6c39('0x24')]);router[_0x6c39('0x9')](_0x6c39('0x25'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6c39('0x9')]('/:id/prefixes',auth[_0x6c39('0x7')](),controller[_0x6c39('0x26')]);router[_0x6c39('0x9')]('/:id/fax_accounts',auth[_0x6c39('0x7')](),controller[_0x6c39('0x27')]);router[_0x6c39('0x9')](_0x6c39('0x28'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x29')]);router[_0x6c39('0x9')](_0x6c39('0x2a'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x2b')]);router['get']('/:id/sms_accounts',auth[_0x6c39('0x7')](),controller[_0x6c39('0x2c')]);router[_0x6c39('0x9')]('/:id/chat_websites',auth[_0x6c39('0x7')](),controller[_0x6c39('0x2d')]);router[_0x6c39('0x9')](_0x6c39('0x2e'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x2f')]);router[_0x6c39('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x6c39('0x30')]);router[_0x6c39('0x9')](_0x6c39('0x31'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x32')]);router[_0x6c39('0x9')]('/:id/api_key',auth[_0x6c39('0x7')](),controller[_0x6c39('0x33')]);router[_0x6c39('0x34')](_0x6c39('0x35'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x36')]);router[_0x6c39('0x34')]('/',auth['isAuthenticated'](),controller[_0x6c39('0x37')]);router['post']('/create_many',auth[_0x6c39('0x7')](),controller[_0x6c39('0x38')]);router[_0x6c39('0x34')](_0x6c39('0x12'),auth['isAuthenticated'](),controller[_0x6c39('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30b7d4,_0x17ae1f,_0x4a33ad){_0x4a33ad(null,path[_0x6c39('0x3a')](config[_0x6c39('0x3b')],_0x6c39('0x3c')));},'filename':function(_0x1256a2,_0x377f81,_0x3e5191){_0x3e5191(null,util['format']('%s-%s',Date[_0x6c39('0x3d')](),_0x377f81[_0x6c39('0x3e')]));}})});router[_0x6c39('0x34')]('/:id/avatar',upload[_0x6c39('0x3f')](_0x6c39('0x40')),controller[_0x6c39('0x41')]);router[_0x6c39('0x34')](_0x6c39('0x42'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x43')]);router[_0x6c39('0x34')](_0x6c39('0x44'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x45')]);router[_0x6c39('0x34')]('/:id/pause',auth['isAuthenticated'](),controller[_0x6c39('0x46')]);router['post'](_0x6c39('0x47'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x48')]);router[_0x6c39('0x34')](_0x6c39('0x49'),auth[_0x6c39('0x7')](),controller['addTeams']);router[_0x6c39('0x34')](_0x6c39('0x4a'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x4b')]);router[_0x6c39('0x34')](_0x6c39('0x4c'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x4d')]);router[_0x6c39('0x34')](_0x6c39('0x4e'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x4f')]);router[_0x6c39('0x34')](_0x6c39('0x50'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x51')]);router['post'](_0x6c39('0x52'),auth['isAuthenticated'](),controller[_0x6c39('0x53')]);router[_0x6c39('0x34')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x6c39('0x54')]);router[_0x6c39('0x34')]('/:id/fax_accounts',auth[_0x6c39('0x7')](),controller[_0x6c39('0x55')]);router['post'](_0x6c39('0x28'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x56')]);router['post'](_0x6c39('0x2a'),auth['isAuthenticated'](),controller[_0x6c39('0x57')]);router['post']('/:id/sms_accounts',auth[_0x6c39('0x7')](),controller[_0x6c39('0x58')]);router[_0x6c39('0x34')](_0x6c39('0x59'),auth['isAuthenticated'](),controller[_0x6c39('0x5a')]);router['post'](_0x6c39('0x2e'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x5b')]);router[_0x6c39('0x34')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x6c39('0x5c')]);router['post'](_0x6c39('0x5d'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x5e')]);router[_0x6c39('0x5f')]('/:id',auth[_0x6c39('0x7')](),controller['update']);router[_0x6c39('0x5f')]('/:id/password',auth['isAuthenticated'](),controller[_0x6c39('0x60')]);router[_0x6c39('0x61')](_0x6c39('0x12'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x62')]);router[_0x6c39('0x61')](_0x6c39('0x49'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x63')]);router[_0x6c39('0x61')]('/:id',auth[_0x6c39('0x7')](),controller['destroy']);router[_0x6c39('0x61')](_0x6c39('0x4a'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x64')]);router['delete'](_0x6c39('0x4c'),auth['isAuthenticated'](),controller[_0x6c39('0x65')]);router[_0x6c39('0x61')](_0x6c39('0x4e'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x66')]);router[_0x6c39('0x61')](_0x6c39('0x50'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x67')]);router[_0x6c39('0x61')](_0x6c39('0x52'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x68')]);router[_0x6c39('0x61')](_0x6c39('0x69'),auth[_0x6c39('0x7')](),controller['removeWhatsappInteractions']);router[_0x6c39('0x61')](_0x6c39('0x6a'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x6b')]);router[_0x6c39('0x61')](_0x6c39('0x28'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x6c')]);router[_0x6c39('0x61')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x6c39('0x61')](_0x6c39('0x6d'),auth[_0x6c39('0x7')](),controller['removeSmsAccounts']);router['delete'](_0x6c39('0x59'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x6e')]);router[_0x6c39('0x61')](_0x6c39('0x2e'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x6f')]);router[_0x6c39('0x61')](_0x6c39('0x70'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x71')]);router[_0x6c39('0x61')](_0x6c39('0x5d'),auth[_0x6c39('0x7')](),controller[_0x6c39('0x72')]);module['exports']=router; \ No newline at end of file +var _0x5e04=['/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getApiKey','addContacts','post','create','/create_many','diskStorage','join','root','format','%s-%s','now','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','update','put'];(function(_0x5909c1,_0x49a06f){var _0x4ac3f9=function(_0xb7e35b){while(--_0xb7e35b){_0x5909c1['push'](_0x5909c1['shift']());}};_0x4ac3f9(++_0x49a06f);}(_0x5e04,0xf8));var _0x45e0=function(_0x488fc6,_0x362d94){_0x488fc6=_0x488fc6-0x0;var _0x2dad83=_0x5e04[_0x488fc6];return _0x2dad83;};'use strict';var multer=require(_0x45e0('0x0'));var util=require(_0x45e0('0x1'));var path=require(_0x45e0('0x2'));var timeout=require(_0x45e0('0x3'));var express=require(_0x45e0('0x4'));var router=express[_0x45e0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x45e0('0x6'));var interaction=require(_0x45e0('0x7'));var config=require(_0x45e0('0x8'));var controller=require(_0x45e0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x45e0('0xa')]);router[_0x45e0('0xb')](_0x45e0('0xc'),auth[_0x45e0('0xd')](),controller['describe']);router[_0x45e0('0xb')](_0x45e0('0xe'),auth[_0x45e0('0xd')](),controller[_0x45e0('0xf')]);router['get'](_0x45e0('0x10'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x11')]);router[_0x45e0('0xb')](_0x45e0('0x12'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x13')]);router[_0x45e0('0xb')](_0x45e0('0x14'),controller[_0x45e0('0x15')]);router['get'](_0x45e0('0x16'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x17')]);router[_0x45e0('0xb')](_0x45e0('0x18'),auth[_0x45e0('0xd')](),controller['getContacts']);router[_0x45e0('0xb')](_0x45e0('0x19'),auth[_0x45e0('0xd')](),controller['getQueues']);router['get'](_0x45e0('0x1a'),auth[_0x45e0('0xd')](),controller['getVoiceQueuesRt']);router[_0x45e0('0xb')](_0x45e0('0x1b'),auth['isAuthenticated'](),controller[_0x45e0('0x1c')]);router[_0x45e0('0xb')]('/:id/recordings',auth[_0x45e0('0xd')](),controller[_0x45e0('0x1d')]);router['get']('/:id/screen_recordings',auth[_0x45e0('0xd')](),controller[_0x45e0('0x1e')]);router[_0x45e0('0xb')](_0x45e0('0x1f'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x20')]);router[_0x45e0('0xb')](_0x45e0('0x21'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x22')]);router[_0x45e0('0xb')](_0x45e0('0x23'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x24')]);router[_0x45e0('0xb')](_0x45e0('0x25'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x26')]);router[_0x45e0('0xb')](_0x45e0('0x27'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x28')]);router[_0x45e0('0xb')](_0x45e0('0x29'),auth['isAuthenticated'](),controller[_0x45e0('0x2a')]);router[_0x45e0('0xb')](_0x45e0('0x2b'),auth[_0x45e0('0xd')](),controller['getTeams']);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x45e0('0xb')](_0x45e0('0x2c'),auth[_0x45e0('0xd')](),controller['getAgents']);router[_0x45e0('0xb')](_0x45e0('0x2d'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x45e0('0xb')](_0x45e0('0x2e'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x2f')]);router['get'](_0x45e0('0x30'),auth['isAuthenticated'](),controller[_0x45e0('0x31')]);router['get'](_0x45e0('0x32'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x33')]);router[_0x45e0('0xb')](_0x45e0('0x34'),auth[_0x45e0('0xd')](),controller['getSmsAccounts']);router[_0x45e0('0xb')](_0x45e0('0x35'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x36')]);router[_0x45e0('0xb')](_0x45e0('0x37'),auth[_0x45e0('0xd')](),controller['getWhatsappAccounts']);router[_0x45e0('0xb')](_0x45e0('0x38'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x45e0('0xb')](_0x45e0('0x39'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x45e0('0xb')]('/:id/api_key',auth[_0x45e0('0xd')](),controller[_0x45e0('0x3a')]);router['post']('/:id/contacts',auth[_0x45e0('0xd')](),controller[_0x45e0('0x3b')]);router[_0x45e0('0x3c')]('/',auth[_0x45e0('0xd')](),controller[_0x45e0('0x3d')]);router[_0x45e0('0x3c')](_0x45e0('0x3e'),auth[_0x45e0('0xd')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0x45e0('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0x45e0('0x3f')]({'destination':function(_0x586877,_0xcf1e7b,_0x1cf7bf){_0x1cf7bf(null,path[_0x45e0('0x40')](config[_0x45e0('0x41')],'server/files/images/'));},'filename':function(_0x19abcf,_0x24a0cd,_0x5d32e0){_0x5d32e0(null,util[_0x45e0('0x42')](_0x45e0('0x43'),Date[_0x45e0('0x44')](),_0x24a0cd['originalname']));}})});router[_0x45e0('0x3c')](_0x45e0('0x14'),upload[_0x45e0('0x45')](_0x45e0('0x46')),controller['addAvatar']);router[_0x45e0('0x3c')](_0x45e0('0x47'),auth['isAuthenticated'](),controller[_0x45e0('0x48')]);router[_0x45e0('0x3c')](_0x45e0('0x49'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x4a')]);router[_0x45e0('0x3c')](_0x45e0('0x4b'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x4c')]);router[_0x45e0('0x3c')](_0x45e0('0x4d'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x4e')]);router['post']('/:id/teams',auth[_0x45e0('0xd')](),controller[_0x45e0('0x4f')]);router[_0x45e0('0x3c')](_0x45e0('0x50'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x51')]);router[_0x45e0('0x3c')](_0x45e0('0x52'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x45e0('0x3c')](_0x45e0('0x53'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x54')]);router[_0x45e0('0x3c')](_0x45e0('0x55'),auth['isAuthenticated'](),controller[_0x45e0('0x56')]);router['post'](_0x45e0('0x57'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x58')]);router[_0x45e0('0x3c')]('/:id/whatsapp_interactions',auth[_0x45e0('0xd')](),controller[_0x45e0('0x59')]);router[_0x45e0('0x3c')](_0x45e0('0x2e'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x5a')]);router[_0x45e0('0x3c')](_0x45e0('0x30'),auth['isAuthenticated'](),controller[_0x45e0('0x5b')]);router[_0x45e0('0x3c')](_0x45e0('0x32'),auth[_0x45e0('0xd')](),controller['addOpenchannelAccounts']);router[_0x45e0('0x3c')]('/:id/sms_accounts',auth[_0x45e0('0xd')](),controller[_0x45e0('0x5c')]);router[_0x45e0('0x3c')](_0x45e0('0x35'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x5d')]);router['post']('/:id/whatsapp_accounts',auth[_0x45e0('0xd')](),controller['addWhatsappAccounts']);router[_0x45e0('0x3c')](_0x45e0('0x38'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x5e')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x45e0('0x5f')]);router[_0x45e0('0x60')](_0x45e0('0x61'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x62')]);router[_0x45e0('0x63')](_0x45e0('0x19'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x64')]);router['delete'](_0x45e0('0x2b'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x65')]);router[_0x45e0('0x63')](_0x45e0('0x12'),auth['isAuthenticated'](),controller[_0x45e0('0x66')]);router[_0x45e0('0x63')](_0x45e0('0x50'),auth[_0x45e0('0xd')](),controller['removeChatInteractions']);router[_0x45e0('0x63')](_0x45e0('0x52'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x67')]);router[_0x45e0('0x63')](_0x45e0('0x53'),auth['isAuthenticated'](),controller[_0x45e0('0x68')]);router[_0x45e0('0x63')]('/:id/sms_interactions',auth[_0x45e0('0xd')](),controller[_0x45e0('0x69')]);router[_0x45e0('0x63')](_0x45e0('0x57'),auth['isAuthenticated'](),controller[_0x45e0('0x6a')]);router['delete'](_0x45e0('0x6b'),auth['isAuthenticated'](),controller[_0x45e0('0x6c')]);router[_0x45e0('0x63')](_0x45e0('0x2e'),auth[_0x45e0('0xd')](),controller['removeFaxAccounts']);router['delete'](_0x45e0('0x30'),auth[_0x45e0('0xd')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x45e0('0xd')](),controller[_0x45e0('0x6d')]);router['delete'](_0x45e0('0x34'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x6e')]);router['delete'](_0x45e0('0x35'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x6f')]);router[_0x45e0('0x63')](_0x45e0('0x37'),auth[_0x45e0('0xd')](),controller['removeWhatsappAccounts']);router[_0x45e0('0x63')](_0x45e0('0x38'),auth[_0x45e0('0xd')](),controller[_0x45e0('0x70')]);router['delete']('/:id/api_key',auth[_0x45e0('0xd')](),controller[_0x45e0('0x71')]);module[_0x45e0('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 2a33503..17f3af1 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x58304c,_0x3cd1cb){var _0x53944e=function(_0x47f632){while(--_0x47f632){_0x58304c['push'](_0x58304c['shift']());}};_0x53944e(++_0x3cd1cb);}(_0x70e0,0x17b));var _0x070e=function(_0x1d420b,_0x34528d){_0x1d420b=_0x1d420b-0x0;var _0x53bd4d=_0x70e0[_0x1d420b];return _0x53bd4d;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ec9e131..0619631 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 _0x70df=['capitalize','QueueId','toLowerCase','Queue:save','voice','format','SIP/%s','upsert','removeQueues','isValidChannel','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','CmContact','order','sort','pick','options','getContacts','hasOwnProperty','CmList','List','Tag','Tags','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','loginInPause','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','Team','getAssociatedQueues','flattenDeep','addAgent','Voice','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','sequelize','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$overlap','$contains','lastName','Contact','dialActive','VoiceQueue','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','flatten','lower','col','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','SELECT','select','field','ui.createdAt','_interactions','toString','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','emit','get','role','admin','Users','user','Agents','agent','Telephones','filter','map','value','includes','find','name','UserProfileResource','destroy','send','index','User','rawAttributes','type','key','salt','where','query','includeAll','include','userSetting','true','UserSetting','push','length','chat','dataValues','sms','rows','fax','mail','show','params','keys','password','filters','intersection','model','attributes','fields','merge','openTabs','openchannel','whatsapp','all','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','104','105','107','108','109','100','111','114','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','Unknown\x20channel','add','Queues','penalty'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x70df,0xe2));var _0xf70d=function(_0x172c22,_0x15b51c){_0x172c22=_0x172c22-0x0;var _0x234d81=_0x70df[_0x172c22];return _0x234d81;};'use strict';var moment=require(_0xf70d('0x0'));var util=require(_0xf70d('0x1'));var path=require(_0xf70d('0x2'));var fs=require('fs');var _=require(_0xf70d('0x3'));var squel=require(_0xf70d('0x4'));var jayson=require(_0xf70d('0x5'));var Redis=require(_0xf70d('0x6'));var authService=require(_0xf70d('0x7'));var qs=require(_0xf70d('0x8'));var logger=require(_0xf70d('0x9'))('api');var utils=require('../../config/utils');var config=require(_0xf70d('0xa'));var licenseUtil=require(_0xf70d('0xb'));var APIBadRequestError=require('../../errors/api')[_0xf70d('0xc')];var APINotFoundError=require(_0xf70d('0xd'))['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0xf70d('0xe')];var db=require(_0xf70d('0xf'))['db'];var socket=require(_0xf70d('0x10'))(new Redis(config[_0xf70d('0x11')]));require(_0xf70d('0x12'))[_0xf70d('0x13')](socket);config[_0xf70d('0x11')]=_['defaults'](config[_0xf70d('0x11')],{'host':_0xf70d('0x14'),'port':0x18eb});var amiClient=jayson[_0xf70d('0x15')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x4bcb60,_0x2f98f4,_0x5779bc,_0x3b336b){return new Promise(function(_0x3fc734,_0x1c5c15){var _0x3412ae=_0x3b336b||amiClient;return _0x3412ae[_0xf70d('0x16')](_0x4bcb60,_0x5779bc)[_0xf70d('0x17')](function(_0x4fc229){logger[_0xf70d('0x18')](_0xf70d('0x19'),_0x2f98f4,_0xf70d('0x1a'));logger[_0xf70d('0x1b')](_0xf70d('0x1c'),_0x2f98f4,_0xf70d('0x1a'),JSON['stringify'](_0x4fc229));if(_0x4fc229[_0xf70d('0x1d')]){if(_0x4fc229[_0xf70d('0x1d')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x2f98f4,_0x4fc229[_0xf70d('0x1d')][_0xf70d('0x1e')]);return _0x1c5c15(_0x4fc229[_0xf70d('0x1d')][_0xf70d('0x1e')]);}logger[_0xf70d('0x1d')](_0xf70d('0x19'),_0x2f98f4,_0x4fc229[_0xf70d('0x1d')][_0xf70d('0x1e')]);return _0x3fc734(_0x4fc229[_0xf70d('0x1d')][_0xf70d('0x1e')]);}else{logger['info'](_0xf70d('0x19'),_0x2f98f4,_0xf70d('0x1a'));_0x3fc734(_0x4fc229['result'][_0xf70d('0x1e')]);}})[_0xf70d('0x1f')](function(_0x3ea252){logger['error'](_0xf70d('0x19'),_0x2f98f4,_0x3ea252);_0x1c5c15(_0x3ea252);});});}function respondWithStatusCode(_0x1f52e4,_0x2c7ff1){_0x2c7ff1=_0x2c7ff1||0xcc;return function(_0x4aa052){if(_0x4aa052){return _0x1f52e4[_0xf70d('0x20')](_0x2c7ff1);}return _0x1f52e4[_0xf70d('0x21')](_0x2c7ff1)[_0xf70d('0x22')]();};}function respondWithResult(_0x1de7e8,_0x53e22b){_0x53e22b=_0x53e22b||0xc8;return function(_0x4a0fb2){if(_0x4a0fb2){return _0x1de7e8[_0xf70d('0x21')](_0x53e22b)[_0xf70d('0x23')](_0x4a0fb2);}};}function respondWithFilteredResult(_0x18582e,_0x4da86e){return function(_0x596fbe){if(_0x596fbe){var _0x5c9bed=typeof _0x4da86e[_0xf70d('0x24')]===_0xf70d('0x25')&&typeof _0x4da86e[_0xf70d('0x26')]===_0xf70d('0x25');var _0x5db1fb=_0x596fbe['count'];var _0x2c84fa=_0x5c9bed?0x0:_0x4da86e[_0xf70d('0x24')];var _0x53ead8=_0x5c9bed?_0x596fbe[_0xf70d('0x27')]:_0x4da86e[_0xf70d('0x24')]+_0x4da86e[_0xf70d('0x26')];var _0x23fa4c;if(_0x53ead8>=_0x5db1fb){_0x53ead8=_0x5db1fb;_0x23fa4c=0xc8;}else{_0x23fa4c=0xce;}_0x18582e[_0xf70d('0x21')](_0x23fa4c);return _0x18582e[_0xf70d('0x28')](_0xf70d('0x29'),_0x2c84fa+'-'+_0x53ead8+'/'+_0x5db1fb)['json'](_0x596fbe);}return null;};}function saveUpdates(_0x44ddfb){return function(_0x2cf494){if(_0x2cf494){return _0x2cf494[_0xf70d('0x2a')](_0x44ddfb)[_0xf70d('0x17')](function(_0x5b792e){socket[_0xf70d('0x2b')]('userNotification:recalc:'+_0x5b792e['id'],{});return _0x5b792e;});}return null;};}function removeEntity(_0x3d07ae){return function(_0x1b7fd8){if(_0x1b7fd8){return _0x1b7fd8['destroy']()[_0xf70d('0x17')](function(){var _0x5e9ddc=_0x1b7fd8[_0xf70d('0x2c')]({'plain':!![]});if(_0x5e9ddc[_0xf70d('0x2d')]===_0xf70d('0x2e'))return;var _0x284000=[{'name':_0xf70d('0x2f'),'value':_0xf70d('0x30'),'ignore':!![]},{'name':_0xf70d('0x31'),'value':_0xf70d('0x32'),'ignore':![]},{'name':_0xf70d('0x33'),'value':'telephone','ignore':![]}];var _0xac77b6=_(_0x284000)[_0xf70d('0x34')]('ignore')[_0xf70d('0x35')]('value')[_0xf70d('0x36')]();if(_[_0xf70d('0x37')](_0xac77b6,_0x5e9ddc[_0xf70d('0x2d')])){return;}var _0x32d44d=_[_0xf70d('0x38')](_0x284000,['value',_0x5e9ddc['role']])[_0xf70d('0x39')];return db[_0xf70d('0x3a')][_0xf70d('0x3b')]({'where':{'type':_0x32d44d,'resourceId':_0x5e9ddc['id']}})['then'](function(){return _0x1b7fd8;});})[_0xf70d('0x17')](function(){_0x3d07ae[_0xf70d('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d219){return function(_0x5972f7){if(!_0x5972f7){_0x56d219[_0xf70d('0x20')](0x194);}return _0x5972f7;};}function handleError(_0x2bbb49,_0x1fe3b7){_0x1fe3b7=_0x1fe3b7||0x1f4;return function(_0x33526d){logger[_0xf70d('0x1d')](_0x33526d['stack']);if(_0x33526d[_0xf70d('0x39')]){delete _0x33526d[_0xf70d('0x39')];}_0x2bbb49[_0xf70d('0x21')](_0x1fe3b7)[_0xf70d('0x3c')](_0x33526d);};}exports[_0xf70d('0x3d')]=function(_0x4edc38,_0x4e3ed7){var _0x63eb2b={},_0x36aeb4={'count':0x0,'rows':[]};var _0x139306=_(db[_0xf70d('0x3e')][_0xf70d('0x3f')])['map'](function(_0x4e9a85){return{'name':_0x4e9a85['fieldName'],'type':_0x4e9a85[_0xf70d('0x40')][_0xf70d('0x41')]};})['filter'](function(_0x21f3e7){return!_[_0xf70d('0x37')](['password',_0xf70d('0x42')],_0x21f3e7[_0xf70d('0x39')]);})[_0xf70d('0x36')]();_0x63eb2b=qs['getOptions'](_0x139306,_0x4edc38);var _0x3b8c25={'where':_0x63eb2b[_0xf70d('0x43')]};return db['User']['count'](_0x3b8c25)[_0xf70d('0x17')](function(_0x441a54){_0x36aeb4[_0xf70d('0x27')]=_0x441a54;if(_0x4edc38[_0xf70d('0x44')][_0xf70d('0x45')]){_0x63eb2b[_0xf70d('0x46')]=[{'all':!![]}];}if(_0x4edc38[_0xf70d('0x44')][_0xf70d('0x47')]===_0xf70d('0x48')){_0x63eb2b[_0xf70d('0x46')]=[{'model':db[_0xf70d('0x49')],'as':'userSetting'}];}if(!_[_0xf70d('0x37')](_0x63eb2b['attributes'],'id')){_0x63eb2b['attributes'][_0xf70d('0x4a')]('id');}return db[_0xf70d('0x3e')]['findAll'](_0x63eb2b);})[_0xf70d('0x17')](function(_0x2f6af3){_0x36aeb4['rows']=_0x2f6af3;if(_0x4edc38[_0xf70d('0x44')]['openTabs']===_0xf70d('0x48')){var _0x566043=[];for(var _0x4eaec5=0x0;_0x4eaec5<_0x36aeb4['rows'][_0xf70d('0x4b')];_0x4eaec5++){_0x566043[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x4c'),_0x36aeb4['rows'][_0x4eaec5][_0xf70d('0x4d')]));_0x566043[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x4e'),_0x36aeb4[_0xf70d('0x4f')][_0x4eaec5]['dataValues']));_0x566043['push'](get_open_tabs(_0xf70d('0x50'),_0x36aeb4[_0xf70d('0x4f')][_0x4eaec5][_0xf70d('0x4d')]));_0x566043[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x51'),_0x36aeb4[_0xf70d('0x4f')][_0x4eaec5][_0xf70d('0x4d')]));_0x566043[_0xf70d('0x4a')](get_open_tabs('openchannel',_0x36aeb4[_0xf70d('0x4f')][_0x4eaec5][_0xf70d('0x4d')]));_0x566043[_0xf70d('0x4a')](get_open_tabs('whatsapp',_0x36aeb4[_0xf70d('0x4f')][_0x4eaec5]['dataValues']));}return Promise['all'](_0x566043)[_0xf70d('0x17')](function(){return _0x36aeb4;});}else{return _0x36aeb4;}})[_0xf70d('0x17')](respondWithFilteredResult(_0x4e3ed7,_0x63eb2b))[_0xf70d('0x1f')](handleError(_0x4e3ed7,null));};exports[_0xf70d('0x52')]=function(_0x5e8f51,_0x68bc85){var _0x18d277={'raw':![],'where':{'id':_0x5e8f51[_0xf70d('0x53')]['id']}},_0x155f92={};_0x155f92['model']=_['differenceBy'](_[_0xf70d('0x54')](db[_0xf70d('0x3e')][_0xf70d('0x3f')]),[_0xf70d('0x55'),_0xf70d('0x42')]);_0x155f92[_0xf70d('0x44')]=_['keys'](_0x5e8f51[_0xf70d('0x44')]);_0x155f92[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x155f92[_0xf70d('0x58')],_0x155f92[_0xf70d('0x44')]);_0x18d277[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x155f92[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x5e8f51[_0xf70d('0x44')][_0xf70d('0x5a')]));_0x18d277[_0xf70d('0x59')]=_0x18d277[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x18d277['attributes']:_0x155f92[_0xf70d('0x58')];if(_0x5e8f51[_0xf70d('0x44')][_0xf70d('0x45')]){_0x18d277[_0xf70d('0x46')]=[{'all':!![]}];}if(_0x5e8f51[_0xf70d('0x44')]['userSetting']===_0xf70d('0x48')){_0x18d277[_0xf70d('0x46')]=[{'model':db[_0xf70d('0x49')],'as':_0xf70d('0x47')}];}_0x18d277=_[_0xf70d('0x5b')]({},_0x18d277,_0x5e8f51['options']);if(!_[_0xf70d('0x37')](_0x18d277[_0xf70d('0x59')],'id')){_0x18d277[_0xf70d('0x59')]['push']('id');}return db[_0xf70d('0x3e')][_0xf70d('0x38')](_0x18d277)[_0xf70d('0x17')](handleEntityNotFound(_0x68bc85,null))[_0xf70d('0x17')](function(_0x382574){var _0x5ee256=[];values=_0x382574;if(_0x5e8f51[_0xf70d('0x44')][_0xf70d('0x5c')]===_0xf70d('0x48')){_0x5ee256[_0xf70d('0x4a')](get_open_tabs('chat',_0x382574[_0xf70d('0x4d')]));_0x5ee256['push'](get_open_tabs('sms',_0x382574[_0xf70d('0x4d')]));_0x5ee256['push'](get_open_tabs(_0xf70d('0x5d'),_0x382574[_0xf70d('0x4d')]));_0x5ee256[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x5e'),_0x382574[_0xf70d('0x4d')]));_0x5ee256[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x50'),_0x382574[_0xf70d('0x4d')]));_0x5ee256[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x51'),_0x382574[_0xf70d('0x4d')]));return Promise[_0xf70d('0x5f')](_0x5ee256);}else{return values;}})[_0xf70d('0x17')](function(){return values;})[_0xf70d('0x17')](respondWithResult(_0x68bc85,null))[_0xf70d('0x1f')](handleError(_0x68bc85,null));};exports['update']=function(_0x2f8f42,_0xb6c838){if(_0x2f8f42['body']['id']){delete _0x2f8f42['body']['id'];}delete _0x2f8f42[_0xf70d('0x60')]['role'];return db['User'][_0xf70d('0x38')]({'where':{'id':_0x2f8f42[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0xb6c838,null))[_0xf70d('0x17')](saveUpdates(_0x2f8f42['body'],null))[_0xf70d('0x17')](respondWithResult(_0xb6c838,null))['catch'](handleError(_0xb6c838,null));};exports[_0xf70d('0x61')]=function(_0x54751f,_0x287548){return db[_0xf70d('0x3e')][_0xf70d('0x61')]()[_0xf70d('0x17')](respondWithResult(_0x287548,null))[_0xf70d('0x1f')](handleError(_0x287548,null));};exports[_0xf70d('0x62')]=function(_0x374aea,_0x142256){return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x374aea[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x142256,null))[_0xf70d('0x17')](function(_0x45eeb9){if(_0x45eeb9){return _0x45eeb9[_0xf70d('0x62')](_0x374aea[_0xf70d('0x60')][_0xf70d('0x63')],_[_0xf70d('0x64')](_0x374aea[_0xf70d('0x60')],[_0xf70d('0x63'),'id'])||{});}})[_0xf70d('0x17')](respondWithResult(_0x142256,null))['catch'](handleError(_0x142256,null));};function validateUser(_0x31a754){return new Promise(function(_0x332979,_0x384148){if(_0x31a754['internal'])return _0x332979(_0x31a754);return db[_0xf70d('0x65')][_0xf70d('0x66')](0x1)[_0xf70d('0x17')](function(_0x24494d){if(_0x24494d[_0xf70d('0x67')])authService[_0xf70d('0x68')](_0x31a754['password']);db[_0xf70d('0x3e')][_0xf70d('0x69')]('internal')['then'](function(_0x398cee){if(_['isNil'](_0x398cee)){_0x31a754['internal']=_0x24494d[_0xf70d('0x6a')]||0x1;return;}if(_[_0xf70d('0x6b')](_0x24494d[_0xf70d('0x6a')])||_0x24494d['min_internal']===_0x398cee){_0x31a754[_0xf70d('0x6c')]=_0x398cee+0x1;return;}if(_0x24494d['min_internal']>_0x398cee){_0x31a754[_0xf70d('0x6c')]=_0x24494d['min_internal'];return;}return db['sequelize'][_0xf70d('0x44')](_0xf70d('0x6d'),{'type':db['sequelize'][_0xf70d('0x6e')]['SELECT']})[_0xf70d('0x17')](function(_0x2537d1){if(_0x2537d1&&_0x2537d1[_0xf70d('0x4b')]){for(var _0x53c16b=0x0,_0x2c29d8=_0x2537d1[_0xf70d('0x4b')];_0x53c16b<_0x2c29d8&&_['isNil'](_0x31a754['internal']);_0x53c16b++){if(_0x24494d[_0xf70d('0x6a')]<=_0x2537d1[_0x53c16b][_0xf70d('0x6f')]){_0x31a754[_0xf70d('0x6c')]=_0x2537d1[_0x53c16b]['from'];}else if(_0x24494d[_0xf70d('0x6a')]>_0x2537d1[_0x53c16b][_0xf70d('0x6f')]&&_0x24494d[_0xf70d('0x6a')]<=_0x2537d1[_0x53c16b]['to']){_0x31a754[_0xf70d('0x6c')]=_0x24494d[_0xf70d('0x6a')];}}}if(_[_0xf70d('0x6b')](_0x31a754['internal'])){_0x31a754[_0xf70d('0x6c')]=_0x398cee+0x1;}return _0x332979(_0x31a754);});});})['catch'](function(_0x428275){_0x384148(_0x428275);});});}function updateUser(_0x307ab6){return new Promise(function(_0x267c60,_0xcf2ca4){try{if(_0x307ab6[_0xf70d('0x70')]){_0x307ab6[_0xf70d('0x71')]=_0x307ab6[_0xf70d('0x6c')];_0x307ab6[_0xf70d('0x72')]={'mailbox':_0x307ab6[_0xf70d('0x6c')],'password':_0x307ab6['password'],'fullname':_0x307ab6[_0xf70d('0x73')],'email':_0x307ab6['email']};}if(_0x307ab6['role']===_0xf70d('0x32')){if(!_0x307ab6[_0xf70d('0x74')])_0x307ab6['permissions']=[_0xf70d('0x75'),_0xf70d('0x76'),_0xf70d('0x77'),_0xf70d('0x78'),_0xf70d('0x79'),_0xf70d('0x7a'),_0xf70d('0x7b'),'106',_0xf70d('0x7c'),_0xf70d('0x7d'),_0xf70d('0x7e'),_0xf70d('0x7f'),_0xf70d('0x80'),_0xf70d('0x81'),'115'];}_0x267c60(_0x307ab6);}catch(_0x10cfb6){_0xcf2ca4(_0x10cfb6);}});}exports['create']=function(_0x5a87ed,_0x4d7572){if(_0x5a87ed[_0xf70d('0x30')][_0xf70d('0x2d')]===_0xf70d('0x32'))throw new Error(_0xf70d('0x82'));if(_0x5a87ed['body'][_0xf70d('0x2d')]===_0xf70d('0x30')&&_0x5a87ed[_0xf70d('0x30')][_0xf70d('0x2d')]!==_0xf70d('0x2e')){throw new Error(_0xf70d('0x83'));}if(_0x5a87ed[_0xf70d('0x60')][_0xf70d('0x2d')]===_0xf70d('0x2e')&&_0x5a87ed['user']['role']!==_0xf70d('0x2e')){throw new Error(_0xf70d('0x84'));}return licenseUtil[_0xf70d('0x85')]([_0x5a87ed[_0xf70d('0x60')]])[_0xf70d('0x17')](function(){return validateUser(_0x5a87ed[_0xf70d('0x60')]);})[_0xf70d('0x17')](function(_0x2d407b){return updateUser(_0x2d407b)[_0xf70d('0x17')](function(_0x253a85){if(_0x253a85[_0xf70d('0x2d')]===_0xf70d('0x2e')){_0x253a85['settingsEnabled']=_0x5a87ed[_0xf70d('0x30')][_0xf70d('0x86')];delete _0x253a85[_0xf70d('0x87')];}return _0x253a85;});})[_0xf70d('0x17')](function(_0x3013c1){return db[_0xf70d('0x3e')][_0xf70d('0x88')](_0x3013c1,{'include':[{'model':db['VoiceMail'],'as':_0xf70d('0x72')}]});})[_0xf70d('0x17')](function(_0x640593){if(_0x5a87ed['body'][_0xf70d('0x2d')]===_0xf70d('0x30'))return _0x640593;if(_0x5a87ed[_0xf70d('0x30')]['role']!=='user')return _0x640593;return db[_0xf70d('0x89')][_0xf70d('0x38')]({'where':{'name':_0x640593['role']==='agent'?'Agents':_0xf70d('0x33'),'userProfileId':_0x5a87ed[_0xf70d('0x30')]['userProfileId']},'raw':!![]})[_0xf70d('0x17')](function(_0x25b38e){if(!_0x25b38e||_0x25b38e[_0xf70d('0x8a')]!=0x0)return _0x640593;return db[_0xf70d('0x3a')][_0xf70d('0x88')]({'name':_0x640593[_0xf70d('0x39')],'resourceId':_0x640593['id'],'type':_0x25b38e[_0xf70d('0x39')],'sectionId':_0x25b38e['id']},{})[_0xf70d('0x17')](function(){return _0x640593;});})[_0xf70d('0x1f')](function(_0x10ccd4){logger[_0xf70d('0x1d')](_0xf70d('0x8b'),_0x10ccd4);throw _0x10ccd4;});})[_0xf70d('0x17')](respondWithResult(_0x4d7572,0xc9))[_0xf70d('0x1f')](handleError(_0x4d7572,null));};exports['bulkCreate']=function(_0x1c05a3,_0x110738){var _0x807893=_0x1c05a3[_0xf70d('0x60')];var _0x17e7c6=[];if(_0x1c05a3[_0xf70d('0x30')]['role']===_0xf70d('0x32'))throw new Error(_0xf70d('0x82'));if(_[_0xf70d('0x8c')](_0x807893,[_0xf70d('0x2d'),'user'])&&_0x1c05a3[_0xf70d('0x30')][_0xf70d('0x2d')]!==_0xf70d('0x2e')){throw new Error(_0xf70d('0x83'));}if(_[_0xf70d('0x8c')](_0x807893,[_0xf70d('0x2d'),_0xf70d('0x2e')])&&_0x1c05a3[_0xf70d('0x30')]['role']!=='admin'){throw new Error(_0xf70d('0x8d'));}return licenseUtil[_0xf70d('0x85')](_0x807893)[_0xf70d('0x17')](function(){return validateUser(_0x807893[0x0]);})[_0xf70d('0x17')](function(){for(var _0x435fda=0x1;_0x435fda<_0x807893[_0xf70d('0x4b')];_0x435fda++){var _0x3c25b3=_0x807893[_0x435fda-0x1][_0xf70d('0x6c')];if(!_0x807893[_0x435fda]['internal'])_0x807893[_0x435fda][_0xf70d('0x6c')]=_0x3c25b3+0x1;_0x17e7c6[_0xf70d('0x4a')](validateUser(_0x807893[_0x435fda]));}return Promise[_0xf70d('0x5f')](_0x17e7c6);})[_0xf70d('0x17')](function(){_0x17e7c6=[];for(var _0x20ca72=0x0;_0x20ca72<_0x807893[_0xf70d('0x4b')];_0x20ca72++){_0x17e7c6['push'](updateUser(_0x807893[_0x20ca72]));}return Promise[_0xf70d('0x5f')](_0x17e7c6);})[_0xf70d('0x17')](function(){_0x17e7c6=_0x807893['map'](function(_0x284a9){return db['User'][_0xf70d('0x88')](_0x284a9,{'include':[{'model':db[_0xf70d('0x72')],'as':'VoiceMail'}]})[_0xf70d('0x17')](function(_0x5637a4){_0x284a9['id']=_0x5637a4['id'];return _0x284a9;});});return Promise[_0xf70d('0x5f')](_0x17e7c6);})['then'](function(_0x86fef6){if(_0x1c05a3[_0xf70d('0x60')][_0xf70d('0x2d')]==='user')return _0x86fef6;if(_0x1c05a3[_0xf70d('0x30')][_0xf70d('0x2d')]!==_0xf70d('0x30'))return _0x86fef6;var _0x31383a=_['some'](_0x86fef6,function(_0x3246e6){return _0x3246e6[_0xf70d('0x2d')]===_0xf70d('0x32')||_0x3246e6[_0xf70d('0x2d')]===_0xf70d('0x8e');});if(!_0x31383a)return _0x86fef6;return db[_0xf70d('0x89')][_0xf70d('0x8f')]({'where':{'name':{'$or':['Agents',_0xf70d('0x33')]},'userProfileId':_0x1c05a3['user']['userProfileId']},'raw':!![]})[_0xf70d('0x17')](function(_0x2194a8){if(_[_0xf70d('0x90')](_0x2194a8)||!_[_0xf70d('0x8c')](_0x2194a8,['autoAssociation',0x0]))return _0x86fef6;_0x17e7c6=[];var _0x295ba5=_(_0x2194a8)[_0xf70d('0x35')](function(_0x63d203){if(_0x63d203['autoAssociation']===0x1)return;return _0x63d203['name']===_0xf70d('0x31')?_0xf70d('0x32'):_0xf70d('0x8e');})[_0xf70d('0x91')]()[_0xf70d('0x36')]();for(var _0x4a2ae9=0x0;_0x4a2ae9<_0x86fef6[_0xf70d('0x4b')];_0x4a2ae9++){if(!_[_0xf70d('0x37')](_0x295ba5,_0x86fef6[_0x4a2ae9][_0xf70d('0x2d')]))return;var _0x39e199=_0x86fef6[_0x4a2ae9][_0xf70d('0x2d')]===_0xf70d('0x32')?_0xf70d('0x31'):'Telephones';_0x17e7c6[_0xf70d('0x4a')](db[_0xf70d('0x3a')][_0xf70d('0x88')]({'name':_0x86fef6[_0x4a2ae9][_0xf70d('0x39')],'resourceId':_0x86fef6[_0x4a2ae9]['id'],'type':_0x39e199,'sectionId':_[_0xf70d('0x38')](_0x2194a8,[_0xf70d('0x39'),_0x39e199])['id']},{}));}return Promise[_0xf70d('0x5f')](_0x17e7c6);});})['then'](respondWithResult(_0x110738,0xc9))['catch'](handleError(_0x110738,null));};exports[_0xf70d('0x92')]=function(_0x329462,_0x22ee79){if(_0x329462['body']['id']){delete _0x329462[_0xf70d('0x60')]['id'];}return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x329462['params']['id']}})[_0xf70d('0x17')](function(_0x35f62b){if(!_0x35f62b)return null;if(_0x35f62b['id']===_0x329462['user']['id']){if(!_0x329462[_0xf70d('0x60')][_0xf70d('0x93')]||!_0x329462[_0xf70d('0x60')][_0xf70d('0x94')]){throw new db['Sequelize'][(_0xf70d('0x95'))](_0xf70d('0x96'));}if(!_0x35f62b[_0xf70d('0x97')](_0x329462[_0xf70d('0x60')]['oldPassword'])){throw new db[(_0xf70d('0x98'))]['ValidationError'](_0xf70d('0x99'));}if(_0x329462[_0xf70d('0x60')]['oldPassword']===_0x329462[_0xf70d('0x60')]['newPassword']){throw new db['Sequelize'][(_0xf70d('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x329462['user'][_0xf70d('0x2d')]===_0xf70d('0x2e')){if(!_0x329462[_0xf70d('0x60')][_0xf70d('0x94')]){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0x9a'));}}else if(_0x329462[_0xf70d('0x30')][_0xf70d('0x2d')]==='user'){if(!_0x329462[_0xf70d('0x60')]['newPassword']){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0x9a'));}if(_0x35f62b[_0xf70d('0x2d')]!==_0xf70d('0x32')){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0x82'));}}else{throw new db[(_0xf70d('0x98'))]['ValidationError'](_0xf70d('0x82'));}return _0x35f62b;})[_0xf70d('0x17')](handleEntityNotFound(_0x22ee79,null))[_0xf70d('0x17')](function(_0x1942e4){return db[_0xf70d('0x65')][_0xf70d('0x9b')]({'attributes':['id',_0xf70d('0x67'),_0xf70d('0x9c'),_0xf70d('0x9d')]})[_0xf70d('0x17')](function(_0xcd11f9){if(_0xcd11f9[_0xf70d('0x67')])authService[_0xf70d('0x68')](_0x329462[_0xf70d('0x60')]['newPassword']);if(!_0xcd11f9[_0xf70d('0x9c')]||!_0x1942e4[_0xf70d('0x9e')])return _0x1942e4;authService[_0xf70d('0x9f')](_0x329462[_0xf70d('0x60')][_0xf70d('0x94')],_0x1942e4[_0xf70d('0x9e')],_0xcd11f9[_0xf70d('0x9d')]);return _0x1942e4;})[_0xf70d('0x17')](saveUpdates({'password':_0x329462['body'][_0xf70d('0x94')],'passwordResetAt':_0x329462[_0xf70d('0x30')]['id']==_0x329462[_0xf70d('0x53')]['id']?moment():null,'previousPasswords':authService[_0xf70d('0xa0')](_0x329462[_0xf70d('0x60')][_0xf70d('0x94')],_0x1942e4[_0xf70d('0x9e')])},null));})[_0xf70d('0x17')](respondWithResult(_0x22ee79,null))['catch'](handleError(_0x22ee79,null));};exports[_0xf70d('0xa1')]=function(_0x324104,_0x384532){var _0x442f0c=_0x324104[_0xf70d('0x60')][_0xf70d('0xa2')];return db['User']['find']({'where':{'id':_0x324104[_0xf70d('0x53')]['id']},'attributes':['id',_0xf70d('0x39'),_0xf70d('0x2d'),_0xf70d('0xa3'),'loginInPause',_0xf70d('0xa4'),_0xf70d('0xa5')]})['then'](handleEntityNotFound(_0x384532,null))[_0xf70d('0x17')](function(_0x16a5a2){if(_0x16a5a2){if(!utils['isValidChannel'](_0x442f0c)){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0xa6'));}return _0x16a5a2[_0xf70d('0xa7')+_['capitalize'](_0x442f0c['toLowerCase']())+_0xf70d('0xa8')](_0x324104['body']['ids'],{'penalty':_0x324104[_0xf70d('0x60')][_0xf70d('0xa9')]||0x0})['spread'](function(_0x59401c){for(var _0x3c5ff5=0x0;_0x3c5ff5<_0x324104[_0xf70d('0x60')]['ids']['length'];_0x3c5ff5+=0x1){var _0x4d5be7={'UserId':Number(_0x324104[_0xf70d('0x53')]['id'])};_0x4d5be7[_[_0xf70d('0xaa')](_0x442f0c['toLowerCase']())+_0xf70d('0xab')]=Number(_0x324104[_0xf70d('0x60')][_0xf70d('0x63')][_0x3c5ff5]);socket[_0xf70d('0x2b')](_0xf70d('0x30')+_[_0xf70d('0xaa')](_0x442f0c[_0xf70d('0xac')]())+_0xf70d('0xad'),_0x4d5be7);}return _0x59401c;})['then'](function(){if(_0x442f0c===_0xf70d('0xae')){return db['VoiceQueue'][_0xf70d('0x8f')]({'where':{'id':_0x324104[_0xf70d('0x60')][_0xf70d('0x63')]||[]},'raw':!![],'attributes':['id',_0xf70d('0x39')]});}})['then'](function(_0x48beb8){var _0x45e24=_0x16a5a2[_0xf70d('0x2c')]({'plain':!![]});var _0x1ed5e0=[];if(_0x442f0c===_0xf70d('0xae')&&_0x45e24['role']===_0xf70d('0x32')&&_0x45e24[_0xf70d('0xa3')]){for(let _0x5ed926=0x0;_0x5ed926<_0x48beb8[_0xf70d('0x4b')];_0x5ed926+=0x1){_0x1ed5e0[_0xf70d('0x4a')]({'membername':_0x45e24[_0xf70d('0x39')],'UserId':_0x45e24['id'],'queue_name':_0x48beb8[_0x5ed926][_0xf70d('0x39')],'VoiceQueueId':_0x48beb8[_0x5ed926]['id'],'interface':_[_0xf70d('0x6b')](_0x45e24['interface'])?util[_0xf70d('0xaf')](_0xf70d('0xb0'),_0x45e24[_0xf70d('0x39')]):_0x45e24['interface'],'paused':_0x45e24[_0xf70d('0xa4')]||![],'penalty':_0x324104['body'][_0xf70d('0xa9')]||0x0});}return Promise[_0xf70d('0x5f')](_0x1ed5e0[_0xf70d('0x35')](function(_0x5f3c39){return db['UserVoiceQueueRt'][_0xf70d('0xb1')](_0x5f3c39);}));}return _0x16a5a2;});}})['then'](respondWithStatusCode(_0x384532,null))[_0xf70d('0x1f')](handleError(_0x384532,null));};exports[_0xf70d('0xb2')]=function(_0x1f2093,_0x2eb01f){var _0x2a5847,_0x1512f1;return db['User'][_0xf70d('0x38')]({'where':{'id':_0x1f2093['params']['id']},'attributes':['id','name',_0xf70d('0x2d')]})[_0xf70d('0x17')](handleEntityNotFound(_0x2eb01f,null))[_0xf70d('0x17')](function(_0x5f1e62){if(_0x5f1e62){_0x2a5847=_0x5f1e62;if(!_0x1f2093[_0xf70d('0x44')][_0xf70d('0xa2')]||!utils[_0xf70d('0xb3')](_0x1f2093['query'][_0xf70d('0xa2')])){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))]('Unknown\x20channel');}return _0x5f1e62['remove'+_[_0xf70d('0xaa')](_0x1f2093[_0xf70d('0x44')]['channel'][_0xf70d('0xac')]())+_0xf70d('0xa8')](_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')]);}})['then'](function(_0x3668ac){if(_[_0xf70d('0xb4')](_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')])){for(var _0x34b5a7=0x0;_0x34b5a7<_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')][_0xf70d('0x4b')];_0x34b5a7+=0x1){_0x1512f1={'UserId':Number(_0x1f2093[_0xf70d('0x53')]['id'])};_0x1512f1[_[_0xf70d('0xaa')](_0x1f2093[_0xf70d('0x44')]['channel'][_0xf70d('0xac')]())+'QueueId']=Number(_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')][_0x34b5a7]);socket[_0xf70d('0x2b')](_0xf70d('0x30')+_[_0xf70d('0xaa')](_0x1f2093[_0xf70d('0x44')]['channel'][_0xf70d('0xac')]())+_0xf70d('0xb5'),_0x1512f1);}}else{_0x1512f1={'UserId':Number(_0x1f2093[_0xf70d('0x53')]['id'])};_0x1512f1[_[_0xf70d('0xaa')](_0x1f2093['query'][_0xf70d('0xa2')][_0xf70d('0xac')]())+'QueueId']=Number(_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')]);socket[_0xf70d('0x2b')](_0xf70d('0x30')+_[_0xf70d('0xaa')](_0x1f2093[_0xf70d('0x44')][_0xf70d('0xa2')][_0xf70d('0xac')]())+_0xf70d('0xb5'),_0x1512f1);}return _0x3668ac;})['then'](function(){if(_0x1f2093[_0xf70d('0x44')]['channel']==='voice'){return db[_0xf70d('0xb6')][_0xf70d('0x3b')]({'where':{'UserId':_0x1f2093[_0xf70d('0x53')]['id'],'VoiceQueueId':_0x1f2093[_0xf70d('0x44')][_0xf70d('0x63')]},'individualHooks':!![]})[_0xf70d('0x17')](function(){return _0x2a5847;});}return _0x2a5847;})[_0xf70d('0x17')](respondWithStatusCode(_0x2eb01f,null))[_0xf70d('0x1f')](handleError(_0x2eb01f,null));};exports[_0xf70d('0xb7')]=function(_0x1f4fd0,_0x40c6d8){_0x1f4fd0[_0xf70d('0x60')][_0xf70d('0xb8')]=_0x1f4fd0[_0xf70d('0xb9')]['filename'];return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x1f4fd0[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x40c6d8,null))['then'](saveUpdates(_0x1f4fd0[_0xf70d('0x60')],null))[_0xf70d('0x17')](respondWithResult(_0x40c6d8,null))[_0xf70d('0x1f')](handleError(_0x40c6d8,null));};exports['getAvatar']=function(_0x1a1e92,_0x409031){var _0x2306a3=path[_0xf70d('0xba')](config['root'],_0xf70d('0xbb'));return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x1a1e92[_0xf70d('0x53')]['id']},'attributes':['id',_0xf70d('0xb8')],'raw':!![]})[_0xf70d('0x17')](handleEntityNotFound(_0x409031,null))[_0xf70d('0x17')](function(_0x26c1c8){if(_0x26c1c8){if(_['isNil'](_0x26c1c8[_0xf70d('0xb8')])){return _0x409031[_0xf70d('0xbc')](_0x2306a3);}else{if(!fs[_0xf70d('0xbd')](path[_0xf70d('0xba')](config[_0xf70d('0xbe')],'server/files/images/',_0x26c1c8[_0xf70d('0xb8')]))){return _0x409031[_0xf70d('0xbc')](_0x2306a3);}return _0x409031['download'](path['join'](config[_0xf70d('0xbe')],_0xf70d('0xbf'),_0x26c1c8[_0xf70d('0xb8')]));}}})[_0xf70d('0x1f')](handleError(_0x409031,null));};exports['getOpenTabs']=function(_0x17743e,_0x205fc7){return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x17743e['params']['id']},'attributes':['id']})[_0xf70d('0x17')](handleEntityNotFound(_0x205fc7,null))['then'](function(_0x4ca5a1){var _0xb96088=[];values=_0x4ca5a1['dataValues'];_0xb96088[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x4c'),_0x4ca5a1[_0xf70d('0x4d')]));_0xb96088[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x4e'),_0x4ca5a1['dataValues']));_0xb96088[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x5d'),_0x4ca5a1['dataValues']));_0xb96088[_0xf70d('0x4a')](get_open_tabs(_0xf70d('0x5e'),_0x4ca5a1[_0xf70d('0x4d')]));_0xb96088['push'](get_open_tabs(_0xf70d('0x50'),_0x4ca5a1[_0xf70d('0x4d')]));_0xb96088[_0xf70d('0x4a')](get_open_tabs('mail',_0x4ca5a1['dataValues']));return Promise[_0xf70d('0x5f')](_0xb96088);})[_0xf70d('0x17')](function(_0x3f3ebc){if(_0x3f3ebc){var _0x3d49e8=_[_0xf70d('0x35')](values[_0xf70d('0xc0')],function(_0x46818d){return{'channel':_0xf70d('0xc1'),'id':_0x46818d['id'],'createdAt':_0x46818d[_0xf70d('0xc2')]};});var _0x23c52e=_[_0xf70d('0x35')](values['FaxOpenTabs'],function(_0x68d14a){return{'channel':_0xf70d('0xc3'),'id':_0x68d14a['id'],'createdAt':_0x68d14a[_0xf70d('0xc2')]};});var _0x89bb39=_[_0xf70d('0x35')](values[_0xf70d('0xc4')],function(_0xaa48c2){return{'channel':'OPENCHANNEL','id':_0xaa48c2['id'],'createdAt':_0xaa48c2[_0xf70d('0xc2')]};});var _0x10be6e=_['map'](values[_0xf70d('0xc5')],function(_0x57d31e){return{'channel':_0xf70d('0xc6'),'id':_0x57d31e['id'],'createdAt':_0x57d31e[_0xf70d('0xc2')]};});var _0xf29ece=_['map'](values[_0xf70d('0xc7')],function(_0xff2480){return{'channel':_0xf70d('0xc8'),'id':_0xff2480['id'],'createdAt':_0xff2480[_0xf70d('0xc2')]};});var _0x352c0e=_[_0xf70d('0x35')](values[_0xf70d('0xc9')],function(_0xf588d4){return{'channel':_0xf70d('0xca'),'id':_0xf588d4['id'],'createdAt':_0xf588d4['createdAt']};});var _0x4b6631=_[_0xf70d('0xcb')](_0x3d49e8,_0x23c52e,_0x89bb39,_0x10be6e,_0xf29ece,_0x352c0e);var _0x1eb613={'count':_0x4b6631[_0xf70d('0x4b')],'rows':_0x4b6631};return _0x1eb613;}else return null;})['then'](respondWithResult(_0x205fc7,null))[_0xf70d('0x1f')](handleError(_0x205fc7,null));};exports['getContacts']=function(_0x4c0c64,_0x5e677d){var _0x179e91={};var _0x5c62de={};var _0x5bc7a8;var _0x3c8d75;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x4c0c64['params']['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x5e677d,null))['then'](function(_0x53af22){if(_0x53af22){_0x5bc7a8=_0x53af22;_0x5c62de[_0xf70d('0x58')]=_['keys'](db[_0xf70d('0xcc')]['rawAttributes']);_0x5c62de[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x4c0c64[_0xf70d('0x44')]);_0x5c62de[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x5c62de['model'],_0x5c62de[_0xf70d('0x44')]);_0x179e91[_0xf70d('0x59')]=_['intersection'](_0x5c62de[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x4c0c64['query']['fields']));_0x179e91[_0xf70d('0x59')]=_0x179e91['attributes'][_0xf70d('0x4b')]?_0x179e91['attributes']:_0x5c62de[_0xf70d('0x58')];_0x179e91[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x4c0c64[_0xf70d('0x44')]['sort']);_0x179e91[_0xf70d('0x43')]=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x4c0c64[_0xf70d('0x44')],_0x5c62de['filters']));if(_0x4c0c64['query'][_0xf70d('0x34')]){_0x179e91['where']=_['merge'](_0x179e91[_0xf70d('0x43')],{'$or':_['map'](_0x179e91[_0xf70d('0x59')],function(_0x97f623){var _0x2e5056={};_0x2e5056[_0x97f623]={'$like':'%'+_0x4c0c64[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x2e5056;})});}_0x179e91=_[_0xf70d('0x5b')]({},_0x179e91,_0x4c0c64[_0xf70d('0xd0')]);return _0x5bc7a8[_0xf70d('0xd1')](_0x179e91);}})['then'](function(_0x4f8b4e){if(_0x4f8b4e){_0x3c8d75=_0x4f8b4e[_0xf70d('0x4b')];if(_0x4c0c64[_0xf70d('0x44')][_0xf70d('0xd2')]('includeAll')){_0x179e91[_0xf70d('0x46')]=[{'model':db[_0xf70d('0xd3')],'as':_0xf70d('0xd4'),'required':![]},{'model':db[_0xf70d('0xd5')],'as':_0xf70d('0xd6'),'attributes':['id',_0xf70d('0x39'),'color'],'where':_0x4c0c64[_0xf70d('0x44')][_0xf70d('0xd7')]?{'id':_0x4c0c64[_0xf70d('0x44')][_0xf70d('0xd7')]}:undefined,'required':_0x4c0c64[_0xf70d('0x44')][_0xf70d('0xd7')]?!![]:![]}];}if(!_0x4c0c64[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x179e91[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x4c0c64[_0xf70d('0x44')][_0xf70d('0x26')]);_0x179e91['offset']=qs[_0xf70d('0x24')](_0x4c0c64[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x5bc7a8['getContacts'](_0x179e91);}})[_0xf70d('0x17')](function(_0xa8b052){if(_0xa8b052){return _0xa8b052?{'count':_0x3c8d75,'rows':_0xa8b052}:null;}})[_0xf70d('0x17')](respondWithResult(_0x5e677d,null))[_0xf70d('0x1f')](handleError(_0x5e677d,null));};exports[_0xf70d('0xd9')]=function(_0x20cb62,_0x439bc7){var _0x3b95c2;var _0x54a63a={};var _0x4264da;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x20cb62[_0xf70d('0x53')]['id']},'attributes':['id','name',_0xf70d('0x2d')]})[_0xf70d('0x17')](handleEntityNotFound(_0x439bc7,null))[_0xf70d('0x17')](function(_0x5c3976){if(!utils[_0xf70d('0xb3')](_0x20cb62[_0xf70d('0x44')][_0xf70d('0xa2')])){throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0xa6'));}_0x3b95c2=_0x5c3976;var _0x44e3b8={};_0x44e3b8[_0xf70d('0x58')]=_[_0xf70d('0x54')](db[_[_0xf70d('0xaa')](_0x20cb62[_0xf70d('0x44')]['channel'])+'Queue'][_0xf70d('0x3f')]);_0x44e3b8[_0xf70d('0x44')]=_['keys'](_0x20cb62['query']);_0x44e3b8[_0xf70d('0x56')]=_['intersection'](_0x44e3b8[_0xf70d('0x58')],_0x44e3b8[_0xf70d('0x44')]);_0x54a63a[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x44e3b8[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x20cb62['query']['fields']));_0x54a63a[_0xf70d('0x59')]=_0x54a63a['attributes']['length']?_0x54a63a[_0xf70d('0x59')]:_0x44e3b8[_0xf70d('0x58')];_0x54a63a[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x20cb62['query'][_0xf70d('0xce')]);_0x54a63a[_0xf70d('0x43')]=qs['filters'](_[_0xf70d('0xcf')](_0x20cb62[_0xf70d('0x44')],_0x44e3b8[_0xf70d('0x56')]));if(_0x20cb62[_0xf70d('0x44')][_0xf70d('0x34')]){_0x54a63a['where']=_[_0xf70d('0x5b')](_0x54a63a[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x54a63a[_0xf70d('0x59')],function(_0x15d392){var _0x323bda={};_0x323bda[_0x15d392]={'$like':'%'+_0x20cb62['query'][_0xf70d('0x34')]+'%'};return _0x323bda;})});}_0x54a63a=_[_0xf70d('0x5b')]({},_0x54a63a,_0x20cb62['options']);switch(_0x3b95c2['role']){case _0xf70d('0x2e'):return db[_[_0xf70d('0xaa')](_0x20cb62[_0xf70d('0x44')]['channel'])+_0xf70d('0xda')][_0xf70d('0x8f')](_0x54a63a);case _0xf70d('0x30'):case _0xf70d('0x32'):return _0x3b95c2[_0xf70d('0x2c')+_[_0xf70d('0xaa')](_0x20cb62[_0xf70d('0x44')]['channel'])+_0xf70d('0xa8')](_0x54a63a);default:throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))]('Unknown\x20role');}})[_0xf70d('0x17')](function(_0x3577b2){_0x4264da=_0x3577b2['length'];if(!_0x20cb62['query'][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x54a63a[_0xf70d('0x26')]=qs['limit'](_0x20cb62[_0xf70d('0x44')]['limit']);_0x54a63a[_0xf70d('0x24')]=qs['offset'](_0x20cb62[_0xf70d('0x44')][_0xf70d('0x24')]);}switch(_0x3b95c2[_0xf70d('0x2d')]){case _0xf70d('0x2e'):return db[_[_0xf70d('0xaa')](_0x20cb62[_0xf70d('0x44')][_0xf70d('0xa2')])+_0xf70d('0xda')]['findAll'](_0x54a63a);case _0xf70d('0x30'):case'agent':return _0x3b95c2['get'+_[_0xf70d('0xaa')](_0x20cb62['query'][_0xf70d('0xa2')])+_0xf70d('0xa8')](_0x54a63a);}})[_0xf70d('0x17')](function(_0x126abf){return{'count':_0x4264da,'rows':_0x126abf};})['then'](respondWithResult(_0x439bc7,null))[_0xf70d('0x1f')](handleError(_0x439bc7,null));};exports['getVoiceQueuesRt']=function(_0x10b1a0,_0x1af32a){var _0x30f766={};var _0x35cd09={};var _0x772704;var _0x5d9845;return db['User'][_0xf70d('0x9b')]({'where':{'id':_0x10b1a0[_0xf70d('0x53')]['id']}})['then'](handleEntityNotFound(_0x1af32a,null))[_0xf70d('0x17')](function(_0x4ffd74){if(_0x4ffd74){_0x772704=_0x4ffd74;_0x35cd09[_0xf70d('0x58')]=_['keys'](db['UserVoiceQueueRt'][_0xf70d('0x3f')]);_0x35cd09['query']=_['keys'](_0x10b1a0['query']);_0x35cd09[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x35cd09[_0xf70d('0x58')],_0x35cd09['query']);_0x30f766[_0xf70d('0x59')]=_['intersection'](_0x35cd09[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x10b1a0[_0xf70d('0x44')][_0xf70d('0x5a')]));_0x30f766['attributes']=_0x30f766[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x30f766[_0xf70d('0x59')]:_0x35cd09[_0xf70d('0x58')];_0x30f766[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x10b1a0[_0xf70d('0x44')][_0xf70d('0xce')]);_0x30f766['where']=qs['filters'](_[_0xf70d('0xcf')](_0x10b1a0[_0xf70d('0x44')],_0x35cd09[_0xf70d('0x56')]));if(_0x10b1a0[_0xf70d('0x44')][_0xf70d('0x34')]){_0x30f766[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x30f766[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x30f766[_0xf70d('0x59')],function(_0x451071){var _0xeb861b={};_0xeb861b[_0x451071]={'$like':'%'+_0x10b1a0[_0xf70d('0x44')]['filter']+'%'};return _0xeb861b;})});}_0x30f766=_[_0xf70d('0x5b')]({},_0x30f766,_0x10b1a0[_0xf70d('0xd0')]);return _0x772704[_0xf70d('0xdb')](_0x30f766);}})['then'](function(_0x4cc0f8){if(_0x4cc0f8){_0x5d9845=_0x4cc0f8[_0xf70d('0x4b')];if(!_0x10b1a0[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x30f766['limit']=qs['limit'](_0x10b1a0[_0xf70d('0x44')][_0xf70d('0x26')]);_0x30f766[_0xf70d('0x24')]=qs['offset'](_0x10b1a0['query'][_0xf70d('0x24')]);}return _0x772704[_0xf70d('0xdb')](_0x30f766);}})['then'](function(_0x330109){if(_0x330109){return _0x330109?{'count':_0x5d9845,'rows':_0x330109}:null;}})[_0xf70d('0x17')](respondWithResult(_0x1af32a,null))[_0xf70d('0x1f')](handleError(_0x1af32a,null));};exports['getGroups']=function(_0x58b46c,_0xd35e66){var _0x56d00c={};var _0x3a688c={};var _0x1e7751;var _0x587a27;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x58b46c['params']['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0xd35e66,null))[_0xf70d('0x17')](function(_0x1fb408){if(_0x1fb408){_0x1e7751=_0x1fb408;_0x3a688c[_0xf70d('0x58')]=_[_0xf70d('0x54')](db[_0xf70d('0xdc')][_0xf70d('0x3f')]);_0x3a688c['query']=_[_0xf70d('0x54')](_0x58b46c[_0xf70d('0x44')]);_0x3a688c['filters']=_[_0xf70d('0x57')](_0x3a688c[_0xf70d('0x58')],_0x3a688c[_0xf70d('0x44')]);_0x56d00c[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x3a688c[_0xf70d('0x58')],qs['fields'](_0x58b46c['query'][_0xf70d('0x5a')]));_0x56d00c[_0xf70d('0x59')]=_0x56d00c[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x56d00c[_0xf70d('0x59')]:_0x3a688c['model'];_0x56d00c[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x58b46c['query'][_0xf70d('0xce')]);_0x56d00c['where']=qs['filters'](_[_0xf70d('0xcf')](_0x58b46c['query'],_0x3a688c[_0xf70d('0x56')]));if(_0x58b46c['query'][_0xf70d('0x34')]){_0x56d00c[_0xf70d('0x43')]=_['merge'](_0x56d00c[_0xf70d('0x43')],{'$or':_['map'](_0x56d00c[_0xf70d('0x59')],function(_0x517304){var _0x4d93ea={};_0x4d93ea[_0x517304]={'$like':'%'+_0x58b46c[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x4d93ea;})});}_0x56d00c=_['merge']({},_0x56d00c,_0x58b46c[_0xf70d('0xd0')]);return _0x1e7751[_0xf70d('0xdd')](_0x56d00c);}})[_0xf70d('0x17')](function(_0xf16b03){if(_0xf16b03){_0x587a27=_0xf16b03[_0xf70d('0x4b')];if(!_0x58b46c[_0xf70d('0x44')][_0xf70d('0xd2')]('nolimit')){_0x56d00c[_0xf70d('0x26')]=qs['limit'](_0x58b46c[_0xf70d('0x44')]['limit']);_0x56d00c['offset']=qs[_0xf70d('0x24')](_0x58b46c['query'][_0xf70d('0x24')]);}return _0x1e7751[_0xf70d('0xdd')](_0x56d00c);}})[_0xf70d('0x17')](function(_0x4d12c0){if(_0x4d12c0){return _0x4d12c0?{'count':_0x587a27,'rows':_0x4d12c0}:null;}})[_0xf70d('0x17')](respondWithResult(_0xd35e66,null))[_0xf70d('0x1f')](handleError(_0xd35e66,null));};exports[_0xf70d('0xde')]=function(_0x2dd0e3,_0x2d238f){var _0x146bec={'raw':!![],'where':{}};var _0x410cb7={};var _0x1378fa={'count':0x0,'rows':[]};return db[_0xf70d('0x3e')]['findOne']({'where':{'id':_0x2dd0e3[_0xf70d('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d238f,null))['then'](function(_0x5a943c){if(_0x5a943c){_0x410cb7[_0xf70d('0x58')]=_[_0xf70d('0x54')](db['VoiceRecording'][_0xf70d('0x3f')]);_0x410cb7[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x2dd0e3['query']);_0x410cb7[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x410cb7[_0xf70d('0x58')],_0x410cb7['query']);_0x146bec[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x410cb7[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x2dd0e3[_0xf70d('0x44')][_0xf70d('0x5a')]));_0x146bec[_0xf70d('0x59')]=_0x146bec[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x146bec['attributes']:_0x410cb7[_0xf70d('0x58')];if(!_0x2dd0e3[_0xf70d('0x44')][_0xf70d('0xd2')]('nolimit')){_0x146bec[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x2dd0e3[_0xf70d('0x44')][_0xf70d('0x26')]);_0x146bec[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x2dd0e3['query'][_0xf70d('0x24')]);}_0x146bec[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x2dd0e3[_0xf70d('0x44')][_0xf70d('0xce')]);_0x146bec['where']=qs[_0xf70d('0x56')](_['pick'](_0x2dd0e3['query'],_0x410cb7['filters']));_0x146bec[_0xf70d('0x43')][_0xf70d('0xdf')]=_0x5a943c['id'];if(_0x2dd0e3['query']['filter']){_0x146bec[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x146bec[_0xf70d('0x43')],{'$or':_['map'](_0x146bec['attributes'],function(_0x4b31d7){var _0x3f76b8={};_0x3f76b8[_0x4b31d7]={'$like':'%'+_0x2dd0e3[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x3f76b8;})});}_0x146bec=_[_0xf70d('0x5b')]({},_0x146bec,_0x2dd0e3[_0xf70d('0xd0')]);return db[_0xf70d('0xe0')][_0xf70d('0x27')]({'where':_0x146bec[_0xf70d('0x43')]})['then'](function(_0x2a9a47){_0x1378fa[_0xf70d('0x27')]=_0x2a9a47;if(_0x2dd0e3['query'][_0xf70d('0x45')]){_0x146bec[_0xf70d('0x46')]=[{'all':!![]}];}return db[_0xf70d('0xe0')]['findAll'](_0x146bec);})[_0xf70d('0x17')](function(_0x567b4e){_0x1378fa[_0xf70d('0x4f')]=_0x567b4e;return _0x1378fa;});}})['then'](respondWithFilteredResult(_0x2d238f,_0x146bec))[_0xf70d('0x1f')](handleError(_0x2d238f,null));};exports['getScreenRecordings']=function(_0x2d03d3,_0xbc3c0d){var _0x12d078={'raw':!![],'where':{}};var _0x1836ad={};var _0x25b3c6={'count':0x0,'rows':[]};return db['User'][_0xf70d('0x9b')]({'where':{'id':_0x2d03d3[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0xbc3c0d,null))[_0xf70d('0x17')](function(_0x576f32){if(_0x576f32){_0x1836ad[_0xf70d('0x58')]=_['keys'](db[_0xf70d('0xe1')][_0xf70d('0x3f')]);_0x1836ad['query']=_[_0xf70d('0x54')](_0x2d03d3[_0xf70d('0x44')]);_0x1836ad[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x1836ad[_0xf70d('0x58')],_0x1836ad[_0xf70d('0x44')]);_0x12d078['attributes']=_['intersection'](_0x1836ad[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x2d03d3[_0xf70d('0x44')]['fields']));_0x12d078[_0xf70d('0x59')]=_0x12d078[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x12d078['attributes']:_0x1836ad[_0xf70d('0x58')];if(!_0x2d03d3[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x12d078[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x2d03d3[_0xf70d('0x44')][_0xf70d('0x26')]);_0x12d078['offset']=qs['offset'](_0x2d03d3['query'][_0xf70d('0x24')]);}_0x12d078[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x2d03d3[_0xf70d('0x44')][_0xf70d('0xce')]);_0x12d078['where']=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x2d03d3[_0xf70d('0x44')],_0x1836ad[_0xf70d('0x56')]));_0x12d078[_0xf70d('0x43')]['UserId']=_0x576f32['id'];if(_0x2d03d3[_0xf70d('0x44')][_0xf70d('0x34')]){_0x12d078[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x12d078['where'],{'$or':_[_0xf70d('0x35')](_0x12d078['attributes'],function(_0x2a6ec1){var _0x3e367d={};_0x3e367d[_0x2a6ec1]={'$like':'%'+_0x2d03d3[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x3e367d;})});}_0x12d078=_[_0xf70d('0x5b')]({},_0x12d078,_0x2d03d3[_0xf70d('0xd0')]);return db['ScreenRecording'][_0xf70d('0x27')]({'where':_0x12d078[_0xf70d('0x43')]})[_0xf70d('0x17')](function(_0x124886){_0x25b3c6[_0xf70d('0x27')]=_0x124886;if(_0x2d03d3['query'][_0xf70d('0x45')]){_0x12d078['include']=[{'all':!![]}];}return db[_0xf70d('0xe1')][_0xf70d('0x8f')](_0x12d078);})['then'](function(_0x3a3551){_0x25b3c6[_0xf70d('0x4f')]=_0x3a3551;return _0x25b3c6;});}})[_0xf70d('0x17')](respondWithFilteredResult(_0xbc3c0d,_0x12d078))[_0xf70d('0x1f')](handleError(_0xbc3c0d,null));};exports[_0xf70d('0xe2')]=function(_0x48688b,_0x52785a){var _0x3cdeba={};var _0x313215={};var _0x27b7e6;var _0x52dfd9;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x48688b[_0xf70d('0x53')]['id']}})['then'](handleEntityNotFound(_0x52785a,null))[_0xf70d('0x17')](function(_0x3dbdef){if(_0x3dbdef){_0x27b7e6=_0x3dbdef;_0x313215[_0xf70d('0x58')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x313215['query']=_[_0xf70d('0x54')](_0x48688b[_0xf70d('0x44')]);_0x313215[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x313215[_0xf70d('0x58')],_0x313215[_0xf70d('0x44')]);_0x3cdeba[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x313215[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x48688b[_0xf70d('0x44')]['fields']));_0x3cdeba[_0xf70d('0x59')]=_0x3cdeba[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x3cdeba[_0xf70d('0x59')]:_0x313215[_0xf70d('0x58')];_0x3cdeba[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x48688b['query']['sort']);_0x3cdeba[_0xf70d('0x43')]=qs['filters'](_['pick'](_0x48688b['query'],_0x313215[_0xf70d('0x56')]));if(_0x48688b['query'][_0xf70d('0x34')]){_0x3cdeba[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x3cdeba['where'],{'$or':_['map'](_0x3cdeba[_0xf70d('0x59')],function(_0x690012){var _0x525485={};_0x525485[_0x690012]={'$like':'%'+_0x48688b[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x525485;})});}_0x3cdeba=_[_0xf70d('0x5b')]({},_0x3cdeba,_0x48688b['options']);return _0x27b7e6[_0xf70d('0xe2')](_0x3cdeba);}})[_0xf70d('0x17')](function(_0x46a452){if(_0x46a452){_0x52dfd9=_0x46a452['length'];if(!_0x48688b[_0xf70d('0x44')]['hasOwnProperty']('nolimit')){_0x3cdeba[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x48688b['query']['limit']);_0x3cdeba[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x48688b[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x27b7e6[_0xf70d('0xe2')](_0x3cdeba);}})[_0xf70d('0x17')](function(_0x44258c){if(_0x44258c){return _0x44258c?{'count':_0x52dfd9,'rows':_0x44258c}:null;}})[_0xf70d('0x17')](respondWithResult(_0x52785a,null))['catch'](handleError(_0x52785a,null));};exports['getOpenchannelInteractions']=function(_0x4ed52a,_0x4bed05){var _0x497b57={};var _0x40ee7b={};var _0x5f495b;var _0x345e5f;return db['User']['findOne']({'where':{'id':_0x4ed52a[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x4bed05,null))[_0xf70d('0x17')](function(_0x5a8038){if(_0x5a8038){_0x5f495b=_0x5a8038;_0x40ee7b[_0xf70d('0x58')]=_[_0xf70d('0x54')](db[_0xf70d('0xe3')][_0xf70d('0x3f')]);_0x40ee7b[_0xf70d('0x44')]=_['keys'](_0x4ed52a['query']);_0x40ee7b[_0xf70d('0x56')]=_['intersection'](_0x40ee7b[_0xf70d('0x58')],_0x40ee7b[_0xf70d('0x44')]);_0x497b57[_0xf70d('0x59')]=_['intersection'](_0x40ee7b[_0xf70d('0x58')],qs['fields'](_0x4ed52a['query'][_0xf70d('0x5a')]));_0x497b57[_0xf70d('0x59')]=_0x497b57[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x497b57[_0xf70d('0x59')]:_0x40ee7b['model'];_0x497b57[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x4ed52a[_0xf70d('0x44')][_0xf70d('0xce')]);_0x497b57[_0xf70d('0x43')]=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x4ed52a[_0xf70d('0x44')],_0x40ee7b[_0xf70d('0x56')]));if(_0x4ed52a['query'][_0xf70d('0x34')]){_0x497b57[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x497b57['where'],{'$or':_[_0xf70d('0x35')](_0x497b57[_0xf70d('0x59')],function(_0x512365){var _0x52cb74={};_0x52cb74[_0x512365]={'$like':'%'+_0x4ed52a[_0xf70d('0x44')]['filter']+'%'};return _0x52cb74;})});}_0x497b57=_[_0xf70d('0x5b')]({},_0x497b57,_0x4ed52a[_0xf70d('0xd0')]);return _0x5f495b[_0xf70d('0xe4')](_0x497b57);}})[_0xf70d('0x17')](function(_0x1473eb){if(_0x1473eb){_0x345e5f=_0x1473eb[_0xf70d('0x4b')];if(!_0x4ed52a[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x497b57['limit']=qs[_0xf70d('0x26')](_0x4ed52a['query'][_0xf70d('0x26')]);_0x497b57[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x4ed52a[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x5f495b[_0xf70d('0xe4')](_0x497b57);}})[_0xf70d('0x17')](function(_0x5926a3){if(_0x5926a3){return _0x5926a3?{'count':_0x345e5f,'rows':_0x5926a3}:null;}})[_0xf70d('0x17')](respondWithResult(_0x4bed05,null))[_0xf70d('0x1f')](handleError(_0x4bed05,null));};exports[_0xf70d('0xe5')]=function(_0x13882b,_0x3ee9bb){var _0x4fc18={'raw':!![],'where':{}};var _0x21dfce={};var _0x2d4fa9={'count':0x0,'rows':[]};return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x13882b[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x3ee9bb,null))[_0xf70d('0x17')](function(_0x2dd7fb){if(_0x2dd7fb){_0x21dfce['model']=_[_0xf70d('0x54')](db[_0xf70d('0xe6')][_0xf70d('0x3f')]);_0x21dfce[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x13882b['query']);_0x21dfce[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x21dfce[_0xf70d('0x58')],_0x21dfce[_0xf70d('0x44')]);_0x4fc18[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x21dfce['model'],qs['fields'](_0x13882b[_0xf70d('0x44')][_0xf70d('0x5a')]));_0x4fc18['attributes']=_0x4fc18[_0xf70d('0x59')]['length']?_0x4fc18[_0xf70d('0x59')]:_0x21dfce['model'];if(!_0x13882b[_0xf70d('0x44')]['hasOwnProperty']('nolimit')){_0x4fc18['limit']=qs['limit'](_0x13882b['query'][_0xf70d('0x26')]);_0x4fc18[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x13882b['query'][_0xf70d('0x24')]);}_0x4fc18[_0xf70d('0xcd')]=qs['sort'](_0x13882b[_0xf70d('0x44')]['sort']);_0x4fc18[_0xf70d('0x43')]=qs['filters'](_[_0xf70d('0xcf')](_0x13882b[_0xf70d('0x44')],_0x21dfce[_0xf70d('0x56')]));_0x4fc18[_0xf70d('0x43')]['UserId']=_0x2dd7fb['id'];if(_0x13882b[_0xf70d('0x44')]['filter']){_0x4fc18['where']=_[_0xf70d('0x5b')](_0x4fc18[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x4fc18[_0xf70d('0x59')],function(_0x3f4c96){var _0x3a5a90={};_0x3a5a90[_0x3f4c96]={'$like':'%'+_0x13882b[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x3a5a90;})});}_0x4fc18=_[_0xf70d('0x5b')]({},_0x4fc18,_0x13882b[_0xf70d('0xd0')]);return db[_0xf70d('0xe6')]['count']({'where':_0x4fc18[_0xf70d('0x43')]})[_0xf70d('0x17')](function(_0x22d413){_0x2d4fa9[_0xf70d('0x27')]=_0x22d413;if(_0x13882b[_0xf70d('0x44')][_0xf70d('0x45')]){_0x4fc18[_0xf70d('0x46')]=[{'all':!![]}];}return db[_0xf70d('0xe6')]['findAll'](_0x4fc18);})[_0xf70d('0x17')](function(_0x2863b7){_0x2d4fa9[_0xf70d('0x4f')]=_0x2863b7;return _0x2d4fa9;});}})[_0xf70d('0x17')](respondWithFilteredResult(_0x3ee9bb,_0x4fc18))[_0xf70d('0x1f')](handleError(_0x3ee9bb,null));};exports[_0xf70d('0xe7')]=function(_0x426b28,_0x3b1008){var _0x5085d8={};var _0x5dedde={};var _0x15ef97;var _0x78947e;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x426b28[_0xf70d('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b1008,null))[_0xf70d('0x17')](function(_0x5d91e6){if(_0x5d91e6){_0x15ef97=_0x5d91e6;_0x5dedde[_0xf70d('0x58')]=_[_0xf70d('0x54')](db['SmsInteraction'][_0xf70d('0x3f')]);_0x5dedde[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x426b28[_0xf70d('0x44')]);_0x5dedde['filters']=_['intersection'](_0x5dedde[_0xf70d('0x58')],_0x5dedde[_0xf70d('0x44')]);_0x5085d8[_0xf70d('0x59')]=_['intersection'](_0x5dedde[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x426b28[_0xf70d('0x44')]['fields']));_0x5085d8[_0xf70d('0x59')]=_0x5085d8[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x5085d8[_0xf70d('0x59')]:_0x5dedde[_0xf70d('0x58')];_0x5085d8[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x426b28[_0xf70d('0x44')]['sort']);_0x5085d8['where']=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x426b28[_0xf70d('0x44')],_0x5dedde[_0xf70d('0x56')]));if(_0x426b28[_0xf70d('0x44')][_0xf70d('0x34')]){_0x5085d8[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x5085d8[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x5085d8[_0xf70d('0x59')],function(_0x2bb65a){var _0x114e53={};_0x114e53[_0x2bb65a]={'$like':'%'+_0x426b28[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x114e53;})});}_0x5085d8=_[_0xf70d('0x5b')]({},_0x5085d8,_0x426b28[_0xf70d('0xd0')]);return _0x15ef97[_0xf70d('0xe7')](_0x5085d8);}})['then'](function(_0x346c7e){if(_0x346c7e){_0x78947e=_0x346c7e[_0xf70d('0x4b')];if(!_0x426b28[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x5085d8[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x426b28['query'][_0xf70d('0x26')]);_0x5085d8['offset']=qs[_0xf70d('0x24')](_0x426b28[_0xf70d('0x44')]['offset']);}return _0x15ef97[_0xf70d('0xe7')](_0x5085d8);}})[_0xf70d('0x17')](function(_0xef736){if(_0xef736){return _0xef736?{'count':_0x78947e,'rows':_0xef736}:null;}})[_0xf70d('0x17')](respondWithResult(_0x3b1008,null))[_0xf70d('0x1f')](handleError(_0x3b1008,null));};exports[_0xf70d('0xe8')]=function(_0x41b8d7,_0x33e44d){var _0x5cd6f1={};var _0x58caa7={};var _0x4782cf;var _0x10de13;return db[_0xf70d('0x3e')]['findOne']({'where':{'id':_0x41b8d7[_0xf70d('0x53')]['id']}})['then'](handleEntityNotFound(_0x33e44d,null))['then'](function(_0x5ce837){if(_0x5ce837){_0x4782cf=_0x5ce837;_0x58caa7[_0xf70d('0x58')]=_[_0xf70d('0x54')](db[_0xf70d('0xe9')][_0xf70d('0x3f')]);_0x58caa7[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x41b8d7[_0xf70d('0x44')]);_0x58caa7[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x58caa7[_0xf70d('0x58')],_0x58caa7[_0xf70d('0x44')]);_0x5cd6f1[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x58caa7[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x41b8d7[_0xf70d('0x44')]['fields']));_0x5cd6f1[_0xf70d('0x59')]=_0x5cd6f1[_0xf70d('0x59')][_0xf70d('0x4b')]?_0x5cd6f1[_0xf70d('0x59')]:_0x58caa7['model'];_0x5cd6f1['order']=qs[_0xf70d('0xce')](_0x41b8d7['query'][_0xf70d('0xce')]);_0x5cd6f1[_0xf70d('0x43')]=qs['filters'](_[_0xf70d('0xcf')](_0x41b8d7[_0xf70d('0x44')],_0x58caa7[_0xf70d('0x56')]));if(_0x41b8d7[_0xf70d('0x44')][_0xf70d('0x34')]){_0x5cd6f1[_0xf70d('0x43')]=_['merge'](_0x5cd6f1[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x5cd6f1[_0xf70d('0x59')],function(_0x292d30){var _0x101036={};_0x101036[_0x292d30]={'$like':'%'+_0x41b8d7[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x101036;})});}_0x5cd6f1=_[_0xf70d('0x5b')]({},_0x5cd6f1,_0x41b8d7[_0xf70d('0xd0')]);return _0x4782cf[_0xf70d('0xe8')](_0x5cd6f1);}})[_0xf70d('0x17')](function(_0x5874c4){if(_0x5874c4){_0x10de13=_0x5874c4['length'];if(!_0x41b8d7[_0xf70d('0x44')][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x5cd6f1[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x41b8d7[_0xf70d('0x44')][_0xf70d('0x26')]);_0x5cd6f1[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x41b8d7[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x4782cf[_0xf70d('0xe8')](_0x5cd6f1);}})['then'](function(_0x4da273){if(_0x4da273){return _0x4da273?{'count':_0x10de13,'rows':_0x4da273}:null;}})['then'](respondWithResult(_0x33e44d,null))[_0xf70d('0x1f')](handleError(_0x33e44d,null));};exports[_0xf70d('0xea')]=function(_0x3fcc0f,_0x1b3506){var _0x5d3d2d={};var _0x1e8ca3={};var _0x539df9;var _0x116bcd;return db[_0xf70d('0x3e')]['findOne']({'where':{'id':_0x3fcc0f['params']['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x1b3506,null))[_0xf70d('0x17')](function(_0x4f315b){if(_0x4f315b){_0x539df9=_0x4f315b;_0x1e8ca3[_0xf70d('0x58')]=_[_0xf70d('0x54')](db[_0xf70d('0xeb')][_0xf70d('0x3f')]);_0x1e8ca3[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x3fcc0f['query']);_0x1e8ca3[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x1e8ca3[_0xf70d('0x58')],_0x1e8ca3['query']);_0x5d3d2d[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x1e8ca3[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x3fcc0f[_0xf70d('0x44')][_0xf70d('0x5a')]));_0x5d3d2d[_0xf70d('0x59')]=_0x5d3d2d['attributes'][_0xf70d('0x4b')]?_0x5d3d2d['attributes']:_0x1e8ca3[_0xf70d('0x58')];_0x5d3d2d[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x3fcc0f['query'][_0xf70d('0xce')]);_0x5d3d2d[_0xf70d('0x43')]=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x3fcc0f['query'],_0x1e8ca3[_0xf70d('0x56')]));if(_0x3fcc0f['query']['filter']){_0x5d3d2d[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x5d3d2d['where'],{'$or':_[_0xf70d('0x35')](_0x5d3d2d[_0xf70d('0x59')],function(_0x1188dc){var _0x22c116={};_0x22c116[_0x1188dc]={'$like':'%'+_0x3fcc0f['query'][_0xf70d('0x34')]+'%'};return _0x22c116;})});}_0x5d3d2d=_[_0xf70d('0x5b')]({},_0x5d3d2d,_0x3fcc0f[_0xf70d('0xd0')]);return _0x539df9[_0xf70d('0xea')](_0x5d3d2d);}})[_0xf70d('0x17')](function(_0x46fa74){if(_0x46fa74){_0x116bcd=_0x46fa74[_0xf70d('0x4b')];if(!_0x3fcc0f['query'][_0xf70d('0xd2')](_0xf70d('0xd8'))){_0x5d3d2d[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x3fcc0f[_0xf70d('0x44')][_0xf70d('0x26')]);_0x5d3d2d[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x3fcc0f[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x539df9['getWhatsappInteractions'](_0x5d3d2d);}})[_0xf70d('0x17')](function(_0x5a4a12){if(_0x5a4a12){return _0x5a4a12?{'count':_0x116bcd,'rows':_0x5a4a12}:null;}})[_0xf70d('0x17')](respondWithResult(_0x1b3506,null))[_0xf70d('0x1f')](handleError(_0x1b3506,null));};exports[_0xf70d('0xec')]=function(_0x20faba,_0x225e27,_0x3b1f07){var _0x230b1e;var _0x158060;var _0x1ac00d;var _0x598b80=!_[_0xf70d('0x6b')](_0x20faba[_0xf70d('0x53')]['id'])?_0x20faba[_0xf70d('0x53')]['id']:!_[_0xf70d('0x6b')](_0x20faba[_0xf70d('0x30')]['id'])?_0x20faba['user']['id']:null;return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x598b80,'role':{'$or':[_0xf70d('0x2e'),_0xf70d('0x30'),'agent']}},'attributes':['id',_0xf70d('0x39'),'phone',_0xf70d('0xed'),_0xf70d('0x2d'),_0xf70d('0x6c'),_0xf70d('0xee')]})[_0xf70d('0x17')](function(_0x5d8472){if(_0x5d8472){if(_0x5d8472[_0xf70d('0x2d')]==='agent'){_0x230b1e=_0x5d8472;if(_0x20faba[_0xf70d('0x60')][_0xf70d('0xa5')]){_0x1ac00d=util['format']('LOCAL/%s@from-sip/n',_0x230b1e[_0x20faba['body'][_0xf70d('0xa5')]]);}else if(_0x20faba['body'][_0xf70d('0xef')]){_0x1ac00d=util[_0xf70d('0xaf')](_0xf70d('0xb0'),_0x20faba[_0xf70d('0x60')][_0xf70d('0xef')]);}else{_0x1ac00d=util[_0xf70d('0xaf')]('SIP/%s',_0x230b1e[_0xf70d('0x39')]);}socket['to'](util['format'](_0xf70d('0xf0'),_0x230b1e[_0xf70d('0x39')]))[_0xf70d('0x2b')](_0xf70d('0xf1'),{'user':{'id':_0x230b1e['id'],'name':_0x230b1e[_0xf70d('0x39')]},'ip':_0x20faba[_0xf70d('0xf2')][_0xf70d('0xf3')]||_0x20faba[_0xf70d('0xf4')][_0xf70d('0xf5')]||_0x20faba[_0xf70d('0xf6')]['remoteAddress']||_0x20faba[_0xf70d('0xf4')]['socket'][_0xf70d('0xf5')]});return db[_0xf70d('0xb6')][_0xf70d('0x3b')]({'where':{'membername':_0x230b1e[_0xf70d('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0xf70d('0x98'))][(_0xf70d('0x95'))](_0xf70d('0xf7'));}})[_0xf70d('0x17')](function(){if(_0x230b1e){return _0x230b1e[_0xf70d('0xf8')]({'raw':!![]});}})[_0xf70d('0x17')](function(_0x32b460){if(_0x230b1e){if(_0x32b460){_0x158060=_0x32b460;if(_0x158060[_0xf70d('0x4b')]){var _0x557c3e=_0x158060['map'](function(_0xb413bd){var _0x6b5532={'membername':_0x230b1e['name'],'UserId':_0x230b1e['id'],'queue_name':_0xb413bd[_0xf70d('0x39')],'VoiceQueueId':_0xb413bd['id'],'interface':_0x1ac00d,'paused':_0x230b1e[_0xf70d('0xee')]||![],'penalty':_0xb413bd['UserVoiceQueue.penalty']||0x0};return db[_0xf70d('0xb6')]['upsert'](_0x6b5532);});return Promise[_0xf70d('0x5f')](_0x557c3e);}}}})[_0xf70d('0x17')](function(){if(_0x230b1e){return db['MemberReport'][_0xf70d('0x8f')]({'where':{'membername':_0x230b1e[_0xf70d('0x39')],'exitAt':null}});}})[_0xf70d('0x17')](function(_0xf24c58){if(_0x230b1e){var _0x1e4f5e=[];_0xf24c58[_0xf70d('0xf9')](function(_0x4c2f78){_0x1e4f5e['push'](_0x4c2f78[_0xf70d('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xf70d('0x5f')](_0x1e4f5e);}})[_0xf70d('0x17')](function(){if(_0x230b1e){var _0x4f2047=[];var _0x44fea6=[];var _0x43fa4d=utils[_0xf70d('0xfa')]();var _0x55bdc3={'membername':_0x230b1e[_0xf70d('0x39')],'interface':_0x1ac00d,'enterAt':moment()[_0xf70d('0xaf')](_0xf70d('0xfb')),'role':_0x230b1e[_0xf70d('0x2d')],'internal':_0x230b1e[_0xf70d('0x6c')]};_0x43fa4d['forEach'](function(_0x44b29d){_0x4f2047[_0xf70d('0x4a')](_[_0xf70d('0x5b')]({'channel':_0x44b29d,'type':_0xf70d('0xfc'),'data1':_0x20faba[_0xf70d('0x60')]['device'],'data2':_0x1ac00d},_0x55bdc3));if(_0x230b1e['loginInPause']){_0x44fea6['push'](_[_0xf70d('0x5b')]({'channel':_0x44b29d,'type':_0xf70d('0xfd'),'data1':_0xf70d('0xfe')},_0x55bdc3));}});return db[_0xf70d('0xff')][_0xf70d('0x100')](_0x4f2047[_0xf70d('0xcb')](_0x44fea6),{'individualHooks':!![]});}})[_0xf70d('0x17')](function(){if(_0x230b1e){return _0x230b1e[_0xf70d('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xf70d('0xaf')](_0xf70d('0xfb')),'voicePause':_0x230b1e[_0xf70d('0xee')]||![],'mailPause':_0x230b1e[_0xf70d('0xee')]||![],'chatPause':_0x230b1e['loginInPause']||![],'faxPause':_0x230b1e[_0xf70d('0xee')]||![],'smsPause':_0x230b1e[_0xf70d('0xee')]||![],'openchannelPause':_0x230b1e[_0xf70d('0xee')]||![],'whatsappPause':_0x230b1e[_0xf70d('0xee')]||![],'pauseType':_0x230b1e[_0xf70d('0xee')]?_0xf70d('0xfe'):null,'interface':_0x1ac00d,'lastPauseAt':moment()['format'](_0xf70d('0xfb'))});}})[_0xf70d('0x17')](function(_0x146661){if(_0x20faba[_0xf70d('0x101')]){return _0x3b1f07();}else{return Promise[_0xf70d('0x102')](_0x146661)[_0xf70d('0x17')](respondWithResult(_0x225e27,null));}})[_0xf70d('0x1f')](handleError(_0x225e27,null));};exports[_0xf70d('0x103')]=function(_0x1f1634,_0xdbcd6c){var _0x5ab122;return db['User'][_0xf70d('0x38')]({'where':{'id':_0x1f1634[_0xf70d('0x53')]['id'],'role':_0xf70d('0x32')},'attributes':['id','name',_0xf70d('0x2d')]})[_0xf70d('0x17')](handleEntityNotFound(_0xdbcd6c,null))['then'](function(_0x371a2d){if(_0x371a2d){_0x5ab122=_0x371a2d;return db[_0xf70d('0xb6')]['destroy']({'where':{'membername':_0x5ab122[_0xf70d('0x39')]},'individualHooks':!![]});}})[_0xf70d('0x17')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x5ab122['name'],'exitAt':null}});})[_0xf70d('0x17')](function(_0x289c87){var _0x27b500=[];_0x289c87[_0xf70d('0xf9')](function(_0x352b35){_0x27b500[_0xf70d('0x4a')](_0x352b35[_0xf70d('0x2a')]({'exitAt':moment()['format'](_0xf70d('0xfb'))}));});return Promise['all'](_0x27b500);})['then'](function(){return _0x5ab122['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xf70d('0x17')](respondWithResult(_0xdbcd6c,null))[_0xf70d('0x1f')](handleError(_0xdbcd6c,null));};exports[_0xf70d('0x104')]=function(_0x2b147a,_0x19fdb2){var _0x4e22eb;return db[_0xf70d('0xb6')][_0xf70d('0x2a')]({'paused':0x1},{'where':{'UserId':_0x2b147a['params']['id']},'individualHooks':!![]})[_0xf70d('0x17')](function(){return db[_0xf70d('0x3e')][_0xf70d('0x38')]({'where':{'id':_0x2b147a[_0xf70d('0x53')]['id'],'role':_0xf70d('0x32')},'attributes':['id',_0xf70d('0x39'),'role','internal',_0xf70d('0xa5'),_0xf70d('0xa3')]});})[_0xf70d('0x17')](handleEntityNotFound(_0x19fdb2,null))['then'](function(_0x90ec4){if(_0x90ec4){_0x4e22eb=_0x90ec4;return respondWithRpcPromise(_0xf70d('0x105'),_0xf70d('0x104'),{'id':_0x4e22eb['id'],'name':_0x4e22eb[_0xf70d('0x39')],'pause':!![]});}})[_0xf70d('0x17')](function(){if(_0x4e22eb){return db[_0xf70d('0xff')][_0xf70d('0x8f')]({'where':{'membername':_0x4e22eb['name'],'type':'PAUSE','exitAt':null}});}})[_0xf70d('0x17')](function(_0x37056f){if(_0x37056f[_0xf70d('0x4b')]){var _0x1f9c54=moment()[_0xf70d('0xaf')](_0xf70d('0xfb'));for(var _0x5a1ccc=0x0,_0x337aad=_0x37056f['length'];_0x5a1ccc<_0x337aad;_0x5a1ccc++){_0x37056f[_0x5a1ccc]['updateAttributes']({'exitAt':_0x1f9c54});}}})[_0xf70d('0x17')](function(){var _0x4c1a85=[];var _0x23286f=utils['getChannels']();_0x23286f[_0xf70d('0xf9')](function(_0x1c6cec){_0x4c1a85['push']({'channel':_0x1c6cec,'membername':_0x4e22eb[_0xf70d('0x39')],'interface':_['isNil'](_0x4e22eb[_0xf70d('0xa5')])?util[_0xf70d('0xaf')]('SIP/%s',_0x4e22eb[_0xf70d('0x39')]):_0x4e22eb[_0xf70d('0xa5')],'type':_0xf70d('0xfd'),'enterAt':moment()['format'](_0xf70d('0xfb')),'data1':_0x2b147a[_0xf70d('0x60')][_0xf70d('0x40')]||_0xf70d('0x106'),'role':_0x4e22eb['role'],'internal':_0x4e22eb[_0xf70d('0x6c')]});});return db['MemberReport'][_0xf70d('0x100')](_0x4c1a85,{'individualHooks':!![]});})[_0xf70d('0x17')](function(){return _0x4e22eb[_0xf70d('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b147a[_0xf70d('0x60')][_0xf70d('0x40')]||_0xf70d('0x106'),'lastPauseAt':moment()[_0xf70d('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x19fdb2,null))[_0xf70d('0x1f')](handleError(_0x19fdb2,null));};exports[_0xf70d('0x107')]=function(_0x12cc09,_0x4c533e){if(_0x12cc09['body'][_0xf70d('0xa2')]&&!utils[_0xf70d('0xb3')](_0x12cc09[_0xf70d('0x60')]['channel'])){throw new APIBadRequestError(util['format'](_0xf70d('0x108'),_0x12cc09[_0xf70d('0x60')][_0xf70d('0xa2')]));}return db['User'][_0xf70d('0x38')]({'where':{'id':_0x12cc09['params']['id']},'attributes':['id',_0xf70d('0x39'),_0xf70d('0x2d'),_0xf70d('0x6c'),_0xf70d('0xa5'),'online',_0xf70d('0xa4'),_0xf70d('0x109'),_0xf70d('0x10a'),_0xf70d('0x10b'),_0xf70d('0x10c'),'smsPause',_0xf70d('0x10d'),_0xf70d('0x10e'),_0xf70d('0x10f')]})[_0xf70d('0x17')](function(_0xc1fd83){if(!_0xc1fd83){throw new APINotFoundError(util['format'](_0xf70d('0x110'),_0x12cc09[_0xf70d('0x53')]['id']));}return _0xc1fd83[_0xf70d('0x107')](_0x12cc09['body'][_0xf70d('0xa2')]);})['then'](respondWithResult(_0x4c533e,null))['catch'](APIHandleError(_0x4c533e));};exports[_0xf70d('0x111')]=function(_0x3c4579,_0x1d5e89){var _0x1dd927={};var _0x34c52c={};var _0x48347d;var _0x2c894f;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x3c4579[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x1d5e89,null))[_0xf70d('0x17')](function(_0x4b9714){if(_0x4b9714){_0x48347d=_0x4b9714;_0x34c52c[_0xf70d('0x58')]=_['keys'](db['Team'][_0xf70d('0x3f')]);_0x34c52c[_0xf70d('0x44')]=_['keys'](_0x3c4579[_0xf70d('0x44')]);_0x34c52c[_0xf70d('0x56')]=_['intersection'](_0x34c52c[_0xf70d('0x58')],_0x34c52c['query']);_0x1dd927[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x34c52c[_0xf70d('0x58')],qs['fields'](_0x3c4579['query'][_0xf70d('0x5a')]));_0x1dd927[_0xf70d('0x59')]=_0x1dd927['attributes'][_0xf70d('0x4b')]?_0x1dd927['attributes']:_0x34c52c[_0xf70d('0x58')];_0x1dd927[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x3c4579[_0xf70d('0x44')][_0xf70d('0xce')]);_0x1dd927[_0xf70d('0x43')]=qs['filters'](_[_0xf70d('0xcf')](_0x3c4579[_0xf70d('0x44')],_0x34c52c[_0xf70d('0x56')]));if(_0x3c4579['query']['filter']){_0x1dd927['where']=_[_0xf70d('0x5b')](_0x1dd927[_0xf70d('0x43')],{'$or':_['map'](_0x1dd927[_0xf70d('0x59')],function(_0x44858e){var _0x2bd987={};_0x2bd987[_0x44858e]={'$like':'%'+_0x3c4579[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0x2bd987;})});}_0x1dd927=_[_0xf70d('0x5b')]({},_0x1dd927,_0x3c4579[_0xf70d('0xd0')]);return _0x48347d[_0xf70d('0x111')](_0x1dd927);}})[_0xf70d('0x17')](function(_0x2dd33b){if(_0x2dd33b){_0x2c894f=_0x2dd33b[_0xf70d('0x4b')];if(!_0x3c4579['query']['hasOwnProperty'](_0xf70d('0xd8'))){_0x1dd927[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x3c4579[_0xf70d('0x44')]['limit']);_0x1dd927['offset']=qs[_0xf70d('0x24')](_0x3c4579[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x48347d[_0xf70d('0x111')](_0x1dd927);}})[_0xf70d('0x17')](function(_0x188952){if(_0x188952){return _0x188952?{'count':_0x2c894f,'rows':_0x188952}:null;}})['then'](respondWithResult(_0x1d5e89,null))[_0xf70d('0x1f')](handleError(_0x1d5e89,null));};exports['addTeams']=function(_0x229644,_0x568bfb){var _0x325ce8=_0x229644[_0xf70d('0x53')]['id'];var _0x24b1d2=_0x229644[_0xf70d('0x60')]?_0x229644[_0xf70d('0x60')][_0xf70d('0x63')]:null;var _0x435a77=[];return Promise[_0xf70d('0x102')]()[_0xf70d('0x17')](function(){if(!_0x24b1d2)throw new APIBadRequestError(_0xf70d('0x112'));})[_0xf70d('0x17')](function(){return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x325ce8}});})['then'](function(_0x29c4ee){if(!_0x29c4ee)throw new APINotFoundError(util['format'](_0xf70d('0x110'),_0x229644[_0xf70d('0x53')]['id']));return db['sequelize'][_0xf70d('0x113')](function(_0x3b6339){return _0x29c4ee[_0xf70d('0x114')](_0x24b1d2,{'transaction':_0x3b6339})[_0xf70d('0x17')](function(){return db[_0xf70d('0x115')][_0xf70d('0x8f')]({'where':{'id':{'$in':_0x24b1d2}}});})[_0xf70d('0x17')](function(_0x1c08ce){var _0x433e18=_[_0xf70d('0x35')](_0x1c08ce,function(_0x8ca4f3){return _0x8ca4f3[_0xf70d('0x116')]();});return Promise[_0xf70d('0x5f')](_0x433e18);})[_0xf70d('0x17')](function(_0x145d80){_0x435a77=_[_0xf70d('0x117')](_0x145d80);var _0x522a25=_[_0xf70d('0x35')](_0x435a77,function(_0x51c081){return _0x51c081[_0xf70d('0x118')](_0x29c4ee['id'],{'transaction':_0x3b6339});});return Promise[_0xf70d('0x5f')](_0x522a25);})[_0xf70d('0x17')](function(){if(!_0x29c4ee[_0xf70d('0xa3')])return;var _0x123fc7=_[_0xf70d('0x34')](_0x435a77,function(_0x51887a){return _0x51887a['getDataValue'](_0xf70d('0xa2'))===_0xf70d('0x119');});var _0x96eaa5=_[_0xf70d('0x35')](_0x123fc7,function(_0x33da31){return db[_0xf70d('0xb6')][_0xf70d('0xb1')]({'membername':_0x29c4ee['name'],'UserId':_0x29c4ee['id'],'queue_name':_0x33da31[_0xf70d('0x39')],'VoiceQueueId':_0x33da31['id'],'interface':_['isNil'](_0x29c4ee[_0xf70d('0xa5')])?util[_0xf70d('0xaf')]('SIP/%s',_0x29c4ee[_0xf70d('0x39')]):_0x29c4ee['interface'],'paused':_0x29c4ee['voicePause']||![],'penalty':_0x29c4ee[_0xf70d('0xa9')]},{'transaction':_0x3b6339});});return Promise[_0xf70d('0x5f')](_0x96eaa5);})[_0xf70d('0x17')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x24b1d2}}});})['then'](function(_0x440b66){var _0x4f12e7=_[_0xf70d('0x35')](_0x440b66,function(_0x3936cf){return db[_0xf70d('0x11a')][_0xf70d('0x88')]({'UserId':_0x29c4ee['id'],'VoicePrefixId':_0x3936cf[_0xf70d('0x11b')]},{'transaction':_0x3b6339});});return Promise['all'](_0x4f12e7);});});})['then'](function(){for(var _0x6d19e2=0x0;_0x6d19e2<_0x435a77['length'];_0x6d19e2++){var _0x15d42e=_0x435a77[_0x6d19e2][_0xf70d('0x11c')]('channel');var _0x22e6fc=_0x15d42e+_0xf70d('0xab');socket[_0xf70d('0x2b')](_0xf70d('0x30')+_0x15d42e+_0xf70d('0xad'),{'UserId':_0x325ce8,['queueField']:_0x435a77[_0x6d19e2]['id']});}})[_0xf70d('0x17')](respondWithStatusCode(_0x568bfb,null))[_0xf70d('0x1f')](APIHandleError(_0x568bfb));};exports[_0xf70d('0x11d')]=function(_0x194c04,_0x9ffec1){var _0x34012f=_0x194c04[_0xf70d('0x53')]['id'];var _0x5c5b65=null;if(_0x194c04[_0xf70d('0x44')][_0xf70d('0x63')]){_0x5c5b65=_[_0xf70d('0xb4')](_0x194c04[_0xf70d('0x44')][_0xf70d('0x63')])?_0x194c04['query'][_0xf70d('0x63')]:[_0x194c04[_0xf70d('0x44')]['ids']];}var _0x113002=[];return Promise[_0xf70d('0x102')]()['then'](function(){if(!_0x5c5b65)throw new APIBadRequestError(_0xf70d('0x11e'));})[_0xf70d('0x17')](function(){return db['User'][_0xf70d('0x9b')]({'where':{'id':_0x34012f}});})[_0xf70d('0x17')](function(_0x1649aa){if(!_0x1649aa)throw new APINotFoundError(util[_0xf70d('0xaf')](_0xf70d('0x110'),_0x194c04[_0xf70d('0x53')]['id']));return db[_0xf70d('0x11f')][_0xf70d('0x113')](function(_0x5dabc5){return _0x1649aa[_0xf70d('0x11d')](_0x5c5b65,{'transaction':_0x5dabc5})[_0xf70d('0x17')](function(){return db['Team'][_0xf70d('0x8f')]({'where':{'id':{'$in':_0x5c5b65}}});})['then'](function(_0x1910d7){var _0x4df8de=_[_0xf70d('0x35')](_0x1910d7,function(_0x50423c){return _0x50423c[_0xf70d('0x116')]();});return Promise[_0xf70d('0x5f')](_0x4df8de);})['then'](function(_0x39e40b){_0x113002=_[_0xf70d('0x117')](_0x39e40b);var _0x3388f3=_[_0xf70d('0x35')](_0x113002,function(_0xa4bd3b){return _0xa4bd3b['removeAgent'](_0x1649aa['id'],{'transaction':_0x5dabc5});});return Promise[_0xf70d('0x5f')](_0x3388f3);})[_0xf70d('0x17')](function(){if(!_0x1649aa[_0xf70d('0xa3')])return;var _0x18537f=_[_0xf70d('0x34')](_0x113002,function(_0x3b7b37){return _0x3b7b37['getDataValue'](_0xf70d('0xa2'))===_0xf70d('0x119');});var _0x1dde2b=_[_0xf70d('0x35')](_0x18537f,function(_0x5b92ce){return db[_0xf70d('0xb6')][_0xf70d('0x3b')]({'where':{'VoiceQueueId':_0x5b92ce['id'],'UserId':_0x1649aa['id']},'transaction':_0x5dabc5});});return Promise[_0xf70d('0x5f')](_0x1dde2b);})[_0xf70d('0x17')](function(){return db[_0xf70d('0x120')][_0xf70d('0x8f')]({'where':{'teamId':{'$in':_0x5c5b65}}});})['then'](function(_0x46120d){var _0x2d8bff=_[_0xf70d('0x35')](_0x46120d,function(_0x160a96){return db[_0xf70d('0x11a')][_0xf70d('0x3b')]({'where':{'UserId':_0x1649aa['id'],'VoicePrefixId':_0x160a96['VoicePrefixId']}},{'transaction':_0x5dabc5});});return Promise['all'](_0x2d8bff);});});})['then'](function(){for(var _0x473f02=0x0;_0x473f02<_0x113002[_0xf70d('0x4b')];_0x473f02++){var _0x1eda0e=_0x113002[_0x473f02]['getDataValue']('channel');var _0x9a6d9d=_0x1eda0e+'QueueId';socket[_0xf70d('0x2b')]('user'+_0x1eda0e+_0xf70d('0xb5'),{'UserId':_0x34012f,['queueField']:_0x113002[_0x473f02]['id']});}})[_0xf70d('0x17')](respondWithStatusCode(_0x9ffec1,null))[_0xf70d('0x1f')](APIHandleError(_0x9ffec1));};exports[_0xf70d('0x121')]=function(_0x5dff9c,_0x4fbf93){var _0x4eea80={};var _0x13cbc8={};var _0x3f479f;var _0x37b33e;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x5dff9c[_0xf70d('0x53')]['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x4fbf93,null))['then'](function(_0x5d6014){if(_0x5d6014){_0x3f479f=_0x5d6014;_0x13cbc8['model']=_[_0xf70d('0x54')](db[_0xf70d('0xd3')][_0xf70d('0x3f')]);_0x13cbc8['query']=_[_0xf70d('0x54')](_0x5dff9c[_0xf70d('0x44')]);_0x13cbc8[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x13cbc8['model'],_0x13cbc8[_0xf70d('0x44')]);_0x4eea80[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x13cbc8[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x5dff9c[_0xf70d('0x44')]['fields']));_0x4eea80['attributes']=_0x4eea80[_0xf70d('0x59')]['length']?_0x4eea80[_0xf70d('0x59')]:_0x13cbc8[_0xf70d('0x58')];_0x4eea80['order']=qs['sort'](_0x5dff9c[_0xf70d('0x44')]['sort']);_0x4eea80[_0xf70d('0x43')]=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x5dff9c[_0xf70d('0x44')],_0x13cbc8[_0xf70d('0x56')]));if(_0x5dff9c['query']['filter']){_0x4eea80[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x4eea80[_0xf70d('0x43')],{'$or':_[_0xf70d('0x35')](_0x4eea80[_0xf70d('0x59')],function(_0x372864){var _0xf398c4={};_0xf398c4[_0x372864]={'$like':'%'+_0x5dff9c[_0xf70d('0x44')][_0xf70d('0x34')]+'%'};return _0xf398c4;})});}_0x4eea80=_[_0xf70d('0x5b')]({},_0x4eea80,_0x5dff9c[_0xf70d('0xd0')]);return _0x3f479f['getLists'](_0x4eea80);}})['then'](function(_0x4ed674){if(_0x4ed674){_0x37b33e=_0x4ed674[_0xf70d('0x4b')];if(!_0x5dff9c['query']['hasOwnProperty'](_0xf70d('0xd8'))){_0x4eea80[_0xf70d('0x26')]=qs[_0xf70d('0x26')](_0x5dff9c[_0xf70d('0x44')]['limit']);_0x4eea80[_0xf70d('0x24')]=qs[_0xf70d('0x24')](_0x5dff9c[_0xf70d('0x44')][_0xf70d('0x24')]);}return _0x3f479f[_0xf70d('0x121')](_0x4eea80);}})['then'](function(_0x16a12a){if(_0x16a12a){return _0x16a12a?{'count':_0x37b33e,'rows':_0x16a12a}:null;}})[_0xf70d('0x17')](respondWithResult(_0x4fbf93,null))[_0xf70d('0x1f')](handleError(_0x4fbf93,null));};exports[_0xf70d('0x122')]=function(_0x4426c6,_0x311002){var _0x51d207={};var _0x1e1d0a={};var _0x13c6d6;return db[_0xf70d('0x3e')][_0xf70d('0x9b')]({'where':{'id':_0x4426c6['params']['id']}})[_0xf70d('0x17')](handleEntityNotFound(_0x311002,null))['then'](function(_0x4a546c){if(_0x4a546c){_0x13c6d6=_0x4a546c;_0x1e1d0a[_0xf70d('0x58')]=_['keys'](db['User'][_0xf70d('0x3f')]);_0x1e1d0a[_0xf70d('0x44')]=_[_0xf70d('0x54')](_0x4426c6['query']);_0x1e1d0a[_0xf70d('0x56')]=_[_0xf70d('0x57')](_0x1e1d0a[_0xf70d('0x58')],_0x1e1d0a[_0xf70d('0x44')]);_0x51d207[_0xf70d('0x59')]=_[_0xf70d('0x57')](_0x1e1d0a[_0xf70d('0x58')],qs[_0xf70d('0x5a')](_0x4426c6['query'][_0xf70d('0x5a')]));_0x51d207[_0xf70d('0x59')]=_0x51d207[_0xf70d('0x59')]['length']?_0x51d207[_0xf70d('0x59')]:_0x1e1d0a['model'];_0x51d207[_0xf70d('0xcd')]=qs[_0xf70d('0xce')](_0x4426c6[_0xf70d('0x44')]['sort']);_0x51d207[_0xf70d('0x43')]=qs[_0xf70d('0x56')](_[_0xf70d('0xcf')](_0x4426c6[_0xf70d('0x44')],_0x1e1d0a[_0xf70d('0x56')]));if(_0x4426c6[_0xf70d('0x44')][_0xf70d('0x34')]){_0x51d207[_0xf70d('0x43')]=_[_0xf70d('0x5b')](_0x51d207['where'],{'$or':_[_0xf70d('0x35')](_0x51d207[_0xf70d('0x59')],function(_0x2bff11){var _0x5f2c4b={};_0x5f2c4b[_0x2bff11]={'$like':'%'+_0x4426c6['query'][_0xf70d('0x34')]+'%'};return _0x5f2c4b;})});}_0x51d207[_0xf70d('0x58')]=db[_0xf70d('0x3e')];_0x51d207['as']=_0xf70d('0x31');_0x51d207=_[_0xf70d('0x5b')]({},_0x51d207,_0x4426c6[_0xf70d('0xd0')]);return _0x13c6d6[_0xf70d('0xf8')]({'include':[_0x51d207]});}})[_0xf70d('0x17')](function(_0x47b3bf){if(_0x47b3bf){var _0x3afd92={},_0x3d4cc6=[];for(var _0x2229fd=0x0;_0x2229fd<_0x47b3bf[_0xf70d('0x4b')];_0x2229fd+=0x1){for(var _0x5076dd=0x0,_0x1d3899;_0x5076dd<_0x47b3bf[_0x2229fd][_0xf70d('0x31')][_0xf70d('0x4b')];_0x5076dd+=0x1){_0x1d3899=_0x47b3bf[_0x2229fd][_0xf70d('0x31')][_0x5076dd][_0xf70d('0x2c')]({'plain':!![]});_0x3afd92[_0x1d3899['id']]=_0x1d3899;}}_0x3afd92=_[_0xf70d('0x123')](_0x3afd92);for(var _0x14c74b=qs[_0xf70d('0x24')](_0x4426c6[_0xf70d('0x44')]['offset']);_0x14c74b<_0x3afd92[_0xf70d('0x4b')]&&_0x3d4cc6[_0xf70d('0x4b')]=_0xb6cc0c){_0x261f2d=_0xb6cc0c;_0x49ad34=0xc8;}else{_0x49ad34=0xce;}_0x134958[_0x511f('0x26')](_0x49ad34);return _0x134958[_0x511f('0x2d')](_0x511f('0x2e'),_0x413159+'-'+_0x261f2d+'/'+_0xb6cc0c)['json'](_0x4673f4);}return null;};}function saveUpdates(_0x2966af){return function(_0x1d30a1){if(_0x1d30a1){return _0x1d30a1[_0x511f('0x2f')](_0x2966af)[_0x511f('0x1a')](function(_0x40ce1a){socket[_0x511f('0x30')](_0x511f('0x31')+_0x40ce1a['id'],{});return _0x40ce1a;});}return null;};}function removeEntity(_0x45460b){return function(_0x5ed88d){if(_0x5ed88d){return _0x5ed88d[_0x511f('0x32')]()['then'](function(){var _0x15d636=_0x5ed88d['get']({'plain':!![]});if(_0x15d636['role']===_0x511f('0x33'))return;var _0x2b1ed2=[{'name':'Users','value':_0x511f('0x34'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x511f('0x35'),'value':_0x511f('0x36'),'ignore':![]}];var _0x205868=_(_0x2b1ed2)['filter'](_0x511f('0x37'))[_0x511f('0x38')]('value')[_0x511f('0x39')]();if(_[_0x511f('0x3a')](_0x205868,_0x15d636[_0x511f('0x3b')])){return;}var _0x476306=_['find'](_0x2b1ed2,['value',_0x15d636['role']])[_0x511f('0x3c')];return db[_0x511f('0x3d')]['destroy']({'where':{'type':_0x476306,'resourceId':_0x15d636['id']}})['then'](function(){return _0x5ed88d;});})[_0x511f('0x1a')](function(){_0x45460b[_0x511f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b035){return function(_0x5e2da6){if(!_0x5e2da6){_0x5b035[_0x511f('0x25')](0x194);}return _0x5e2da6;};}function handleError(_0x5a5c48,_0x47a1b8){_0x47a1b8=_0x47a1b8||0x1f4;return function(_0x38c323){logger[_0x511f('0x20')](_0x38c323[_0x511f('0x3e')]);if(_0x38c323['name']){delete _0x38c323[_0x511f('0x3c')];}_0x5a5c48['status'](_0x47a1b8)['send'](_0x38c323);};}exports[_0x511f('0x3f')]=function(_0x57852a,_0xefe030){var _0x378859={},_0x59bbdd={'count':0x0,'rows':[]};var _0x3a5532=_(db['User'][_0x511f('0x40')])[_0x511f('0x38')](function(_0x1d86af){return{'name':_0x1d86af[_0x511f('0x41')],'type':_0x1d86af[_0x511f('0x42')][_0x511f('0x43')]};})[_0x511f('0x44')](function(_0x2a1e77){return!_[_0x511f('0x3a')]([_0x511f('0x45'),_0x511f('0x46')],_0x2a1e77[_0x511f('0x3c')]);})[_0x511f('0x39')]();_0x378859=qs[_0x511f('0x47')](_0x3a5532,_0x57852a);var _0x150ce4={'where':_0x378859[_0x511f('0x48')]};return db[_0x511f('0x49')]['count'](_0x150ce4)[_0x511f('0x1a')](function(_0x186a38){_0x59bbdd[_0x511f('0x2c')]=_0x186a38;if(_0x57852a['query'][_0x511f('0x4a')]){_0x378859['include']=[{'all':!![]}];}if(_0x57852a[_0x511f('0x4b')][_0x511f('0x4c')]==='true'){_0x378859[_0x511f('0x4d')]=[{'model':db[_0x511f('0x4e')],'as':'userSetting'}];}if(!_[_0x511f('0x3a')](_0x378859[_0x511f('0x4f')],'id')){_0x378859[_0x511f('0x4f')]['push']('id');}return db[_0x511f('0x49')]['findAll'](_0x378859);})['then'](function(_0x2b9bfa){_0x59bbdd[_0x511f('0x50')]=_0x2b9bfa;if(_0x57852a[_0x511f('0x4b')][_0x511f('0x51')]===_0x511f('0x52')){var _0x265196=[];for(var _0x572aeb=0x0;_0x572aeb<_0x59bbdd[_0x511f('0x50')][_0x511f('0x53')];_0x572aeb++){_0x265196[_0x511f('0x54')](get_open_tabs(_0x511f('0x55'),_0x59bbdd[_0x511f('0x50')][_0x572aeb][_0x511f('0x56')]));_0x265196[_0x511f('0x54')](get_open_tabs('sms',_0x59bbdd[_0x511f('0x50')][_0x572aeb][_0x511f('0x56')]));_0x265196[_0x511f('0x54')](get_open_tabs(_0x511f('0x57'),_0x59bbdd[_0x511f('0x50')][_0x572aeb][_0x511f('0x56')]));_0x265196[_0x511f('0x54')](get_open_tabs('mail',_0x59bbdd[_0x511f('0x50')][_0x572aeb][_0x511f('0x56')]));_0x265196['push'](get_open_tabs(_0x511f('0x58'),_0x59bbdd['rows'][_0x572aeb][_0x511f('0x56')]));_0x265196[_0x511f('0x54')](get_open_tabs(_0x511f('0x59'),_0x59bbdd['rows'][_0x572aeb]['dataValues']));}return Promise['all'](_0x265196)[_0x511f('0x1a')](function(){return _0x59bbdd;});}else{return _0x59bbdd;}})['then'](respondWithFilteredResult(_0xefe030,_0x378859))[_0x511f('0x24')](handleError(_0xefe030,null));};exports['show']=function(_0x2e9bb6,_0x4a85c8){var _0x48280f={'raw':![],'where':{'id':_0x2e9bb6['params']['id']}},_0x9eaacc={};_0x9eaacc[_0x511f('0x5a')]=_[_0x511f('0x5b')](_[_0x511f('0x5c')](db[_0x511f('0x49')]['rawAttributes']),[_0x511f('0x45'),_0x511f('0x46')]);_0x9eaacc[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x2e9bb6['query']);_0x9eaacc[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x9eaacc[_0x511f('0x5a')],_0x9eaacc['query']);_0x48280f[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x9eaacc['model'],qs[_0x511f('0x5f')](_0x2e9bb6[_0x511f('0x4b')][_0x511f('0x5f')]));_0x48280f[_0x511f('0x4f')]=_0x48280f['attributes']['length']?_0x48280f[_0x511f('0x4f')]:_0x9eaacc[_0x511f('0x5a')];if(_0x2e9bb6[_0x511f('0x4b')]['includeAll']){_0x48280f[_0x511f('0x4d')]=[{'all':!![]}];}if(_0x2e9bb6[_0x511f('0x4b')]['userSetting']==='true'){_0x48280f['include']=[{'model':db[_0x511f('0x4e')],'as':_0x511f('0x4c')}];}_0x48280f=_['merge']({},_0x48280f,_0x2e9bb6[_0x511f('0x60')]);if(!_[_0x511f('0x3a')](_0x48280f[_0x511f('0x4f')],'id')){_0x48280f[_0x511f('0x4f')][_0x511f('0x54')]('id');}return db[_0x511f('0x49')][_0x511f('0x61')](_0x48280f)[_0x511f('0x1a')](handleEntityNotFound(_0x4a85c8,null))[_0x511f('0x1a')](function(_0x4565de){var _0x2860d8=[];values=_0x4565de;if(_0x2e9bb6[_0x511f('0x4b')]['openTabs']===_0x511f('0x52')){_0x2860d8['push'](get_open_tabs(_0x511f('0x55'),_0x4565de[_0x511f('0x56')]));_0x2860d8['push'](get_open_tabs(_0x511f('0x62'),_0x4565de[_0x511f('0x56')]));_0x2860d8['push'](get_open_tabs(_0x511f('0x58'),_0x4565de[_0x511f('0x56')]));_0x2860d8[_0x511f('0x54')](get_open_tabs('whatsapp',_0x4565de[_0x511f('0x56')]));_0x2860d8[_0x511f('0x54')](get_open_tabs('fax',_0x4565de['dataValues']));_0x2860d8['push'](get_open_tabs(_0x511f('0x63'),_0x4565de[_0x511f('0x56')]));return Promise['all'](_0x2860d8);}else{return values;}})[_0x511f('0x1a')](function(){return values;})['then'](respondWithResult(_0x4a85c8,null))[_0x511f('0x24')](handleError(_0x4a85c8,null));};exports[_0x511f('0x2f')]=function(_0x1bcc3d,_0x3f55b5){if(_0x1bcc3d[_0x511f('0x64')]['id']){delete _0x1bcc3d[_0x511f('0x64')]['id'];}delete _0x1bcc3d['body'][_0x511f('0x3b')];return db['User'][_0x511f('0x61')]({'where':{'id':_0x1bcc3d[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x3f55b5,null))['then'](saveUpdates(_0x1bcc3d[_0x511f('0x64')],null))[_0x511f('0x1a')](respondWithResult(_0x3f55b5,null))[_0x511f('0x24')](handleError(_0x3f55b5,null));};exports[_0x511f('0x66')]=function(_0x432e77,_0x418400){return db[_0x511f('0x49')][_0x511f('0x66')]()[_0x511f('0x1a')](respondWithResult(_0x418400,null))[_0x511f('0x24')](handleError(_0x418400,null));};exports[_0x511f('0x67')]=function(_0x2300d0,_0x4786ca){return db[_0x511f('0x49')][_0x511f('0x61')]({'where':{'id':_0x2300d0['params']['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x4786ca,null))[_0x511f('0x1a')](function(_0xc6356b){if(_0xc6356b){return _0xc6356b[_0x511f('0x67')](_0x2300d0[_0x511f('0x64')][_0x511f('0x68')],_[_0x511f('0x69')](_0x2300d0[_0x511f('0x64')],[_0x511f('0x68'),'id'])||{});}})[_0x511f('0x1a')](respondWithResult(_0x4786ca,null))['catch'](handleError(_0x4786ca,null));};function validateUser(_0x2d705e){return new Promise(function(_0x4e0d95,_0x4f4bbc){if(_0x2d705e['internal'])return _0x4e0d95(_0x2d705e);return db[_0x511f('0x6a')]['findById'](0x1)[_0x511f('0x1a')](function(_0x32da12){if(_0x32da12[_0x511f('0x6b')])authService[_0x511f('0x6c')](_0x2d705e[_0x511f('0x45')]);db['User'][_0x511f('0x6d')](_0x511f('0x6e'))['then'](function(_0x1fd7dd){if(_[_0x511f('0x6f')](_0x1fd7dd)){_0x2d705e[_0x511f('0x6e')]=_0x32da12[_0x511f('0x70')]||0x1;return;}if(_[_0x511f('0x6f')](_0x32da12[_0x511f('0x70')])||_0x32da12[_0x511f('0x70')]===_0x1fd7dd){_0x2d705e['internal']=_0x1fd7dd+0x1;return;}if(_0x32da12[_0x511f('0x70')]>_0x1fd7dd){_0x2d705e['internal']=_0x32da12[_0x511f('0x70')];return;}return db[_0x511f('0x71')][_0x511f('0x4b')](_0x511f('0x72'),{'type':db['sequelize'][_0x511f('0x73')][_0x511f('0x74')]})['then'](function(_0x2db651){if(_0x2db651&&_0x2db651['length']){for(var _0x4f1582=0x0,_0x350a03=_0x2db651[_0x511f('0x53')];_0x4f1582<_0x350a03&&_['isNil'](_0x2d705e[_0x511f('0x6e')]);_0x4f1582++){if(_0x32da12[_0x511f('0x70')]<=_0x2db651[_0x4f1582][_0x511f('0x75')]){_0x2d705e['internal']=_0x2db651[_0x4f1582][_0x511f('0x75')];}else if(_0x32da12[_0x511f('0x70')]>_0x2db651[_0x4f1582][_0x511f('0x75')]&&_0x32da12[_0x511f('0x70')]<=_0x2db651[_0x4f1582]['to']){_0x2d705e['internal']=_0x32da12[_0x511f('0x70')];}}}if(_[_0x511f('0x6f')](_0x2d705e[_0x511f('0x6e')])){_0x2d705e['internal']=_0x1fd7dd+0x1;}return _0x4e0d95(_0x2d705e);});});})[_0x511f('0x24')](function(_0x53a6ca){_0x4f4bbc(_0x53a6ca);});});}function updateUser(_0x592283){return new Promise(function(_0x24e33b,_0x56fe22){try{if(_0x592283[_0x511f('0x76')]){_0x592283[_0x511f('0x77')]=_0x592283[_0x511f('0x6e')];_0x592283[_0x511f('0x78')]={'mailbox':_0x592283[_0x511f('0x6e')],'password':_0x592283[_0x511f('0x45')],'fullname':_0x592283['fullname'],'email':_0x592283[_0x511f('0x79')]};}if(_0x592283[_0x511f('0x3b')]==='agent'){if(!_0x592283['permissions'])_0x592283[_0x511f('0x7a')]=[_0x511f('0x7b'),_0x511f('0x7c'),'103',_0x511f('0x7d'),_0x511f('0x7e'),_0x511f('0x7f'),'105','106','107',_0x511f('0x80'),_0x511f('0x81'),_0x511f('0x82'),_0x511f('0x83'),_0x511f('0x84'),_0x511f('0x85')];}_0x24e33b(_0x592283);}catch(_0x52b8cd){_0x56fe22(_0x52b8cd);}});}exports['create']=function(_0x1c55a6,_0x3eeafd){if(_0x1c55a6[_0x511f('0x34')]['role']===_0x511f('0x86'))throw new Error('Unauthorized');if(_0x1c55a6['body']['role']==='user'&&_0x1c55a6[_0x511f('0x34')][_0x511f('0x3b')]!==_0x511f('0x33')){throw new Error(_0x511f('0x87'));}if(_0x1c55a6['body']['role']==='admin'&&_0x1c55a6['user'][_0x511f('0x3b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x511f('0x88')]([_0x1c55a6[_0x511f('0x64')]])['then'](function(){return validateUser(_0x1c55a6[_0x511f('0x64')]);})[_0x511f('0x1a')](function(_0x51027b){return updateUser(_0x51027b)[_0x511f('0x1a')](function(_0x124b58){if(_0x124b58['role']===_0x511f('0x33')){_0x124b58[_0x511f('0x89')]=_0x1c55a6[_0x511f('0x34')][_0x511f('0x89')];delete _0x124b58[_0x511f('0x8a')];}return _0x124b58;});})[_0x511f('0x1a')](function(_0x2b8933){return db['User'][_0x511f('0x8b')](_0x2b8933,{'include':[{'model':db[_0x511f('0x78')],'as':_0x511f('0x78')}]});})[_0x511f('0x1a')](function(_0x4e5572){if(_0x1c55a6[_0x511f('0x64')][_0x511f('0x3b')]===_0x511f('0x34'))return _0x4e5572;if(_0x1c55a6[_0x511f('0x34')][_0x511f('0x3b')]!==_0x511f('0x34'))return _0x4e5572;return db['UserProfileSection'][_0x511f('0x61')]({'where':{'name':_0x4e5572[_0x511f('0x3b')]===_0x511f('0x86')?'Agents':'Telephones','userProfileId':_0x1c55a6['user'][_0x511f('0x8a')]},'raw':!![]})[_0x511f('0x1a')](function(_0x19e2bb){if(!_0x19e2bb||_0x19e2bb['autoAssociation']!=0x0)return _0x4e5572;return db['UserProfileResource'][_0x511f('0x8b')]({'name':_0x4e5572[_0x511f('0x3c')],'resourceId':_0x4e5572['id'],'type':_0x19e2bb[_0x511f('0x3c')],'sectionId':_0x19e2bb['id']},{})['then'](function(){return _0x4e5572;});})[_0x511f('0x24')](function(_0x3145dd){logger[_0x511f('0x20')](_0x511f('0x8c'),_0x3145dd);throw _0x3145dd;});})[_0x511f('0x1a')](respondWithResult(_0x3eeafd,0xc9))['catch'](handleError(_0x3eeafd,null));};exports[_0x511f('0x8d')]=function(_0x26b84a,_0x38ac2c){var _0xfb545=_0x26b84a[_0x511f('0x64')];var _0x3ca3ae=[];if(_0x26b84a[_0x511f('0x34')][_0x511f('0x3b')]==='agent')throw new Error('Unauthorized');if(_[_0x511f('0x8e')](_0xfb545,['role','user'])&&_0x26b84a[_0x511f('0x34')][_0x511f('0x3b')]!=='admin'){throw new Error(_0x511f('0x87'));}if(_[_0x511f('0x8e')](_0xfb545,['role','admin'])&&_0x26b84a[_0x511f('0x34')][_0x511f('0x3b')]!==_0x511f('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0xfb545)[_0x511f('0x1a')](function(){return validateUser(_0xfb545[0x0]);})[_0x511f('0x1a')](function(){for(var _0x36fc4a=0x1;_0x36fc4a<_0xfb545['length'];_0x36fc4a++){var _0x5beb8=_0xfb545[_0x36fc4a-0x1][_0x511f('0x6e')];if(!_0xfb545[_0x36fc4a][_0x511f('0x6e')])_0xfb545[_0x36fc4a][_0x511f('0x6e')]=_0x5beb8+0x1;_0x3ca3ae[_0x511f('0x54')](validateUser(_0xfb545[_0x36fc4a]));}return Promise[_0x511f('0x8f')](_0x3ca3ae);})[_0x511f('0x1a')](function(){_0x3ca3ae=[];for(var _0x1fbf35=0x0;_0x1fbf35<_0xfb545[_0x511f('0x53')];_0x1fbf35++){_0x3ca3ae[_0x511f('0x54')](updateUser(_0xfb545[_0x1fbf35]));}return Promise[_0x511f('0x8f')](_0x3ca3ae);})[_0x511f('0x1a')](function(){_0x3ca3ae=_0xfb545[_0x511f('0x38')](function(_0x77175e){return db[_0x511f('0x49')]['create'](_0x77175e,{'include':[{'model':db[_0x511f('0x78')],'as':_0x511f('0x78')}]})[_0x511f('0x1a')](function(_0x59c222){_0x77175e['id']=_0x59c222['id'];return _0x77175e;});});return Promise[_0x511f('0x8f')](_0x3ca3ae);})['then'](function(_0x392598){if(_0x26b84a['body'][_0x511f('0x3b')]===_0x511f('0x34'))return _0x392598;if(_0x26b84a[_0x511f('0x34')][_0x511f('0x3b')]!=='user')return _0x392598;var _0x5ba50a=_[_0x511f('0x8e')](_0x392598,function(_0x30d02b){return _0x30d02b[_0x511f('0x3b')]===_0x511f('0x86')||_0x30d02b[_0x511f('0x3b')]===_0x511f('0x36');});if(!_0x5ba50a)return _0x392598;return db['UserProfileSection'][_0x511f('0x90')]({'where':{'name':{'$or':['Agents',_0x511f('0x35')]},'userProfileId':_0x26b84a[_0x511f('0x34')][_0x511f('0x8a')]},'raw':!![]})[_0x511f('0x1a')](function(_0x4499ad){if(_[_0x511f('0x91')](_0x4499ad)||!_[_0x511f('0x8e')](_0x4499ad,[_0x511f('0x92'),0x0]))return _0x392598;_0x3ca3ae=[];var _0x1638de=_(_0x4499ad)[_0x511f('0x38')](function(_0x39c1a7){if(_0x39c1a7[_0x511f('0x92')]===0x1)return;return _0x39c1a7[_0x511f('0x3c')]===_0x511f('0x93')?_0x511f('0x86'):_0x511f('0x36');})['compact']()[_0x511f('0x39')]();for(var _0x36078b=0x0;_0x36078b<_0x392598[_0x511f('0x53')];_0x36078b++){if(!_[_0x511f('0x3a')](_0x1638de,_0x392598[_0x36078b]['role']))return;var _0x44105b=_0x392598[_0x36078b][_0x511f('0x3b')]==='agent'?_0x511f('0x93'):_0x511f('0x35');_0x3ca3ae[_0x511f('0x54')](db[_0x511f('0x3d')][_0x511f('0x8b')]({'name':_0x392598[_0x36078b][_0x511f('0x3c')],'resourceId':_0x392598[_0x36078b]['id'],'type':_0x44105b,'sectionId':_[_0x511f('0x61')](_0x4499ad,[_0x511f('0x3c'),_0x44105b])['id']},{}));}return Promise['all'](_0x3ca3ae);});})['then'](respondWithResult(_0x38ac2c,0xc9))[_0x511f('0x24')](handleError(_0x38ac2c,null));};exports[_0x511f('0x94')]=function(_0x2afba3,_0x528538){if(_0x2afba3['body']['id']){delete _0x2afba3[_0x511f('0x64')]['id'];}return db[_0x511f('0x49')][_0x511f('0x61')]({'where':{'id':_0x2afba3[_0x511f('0x65')]['id']}})['then'](function(_0x3402eb){if(!_0x3402eb)return null;if(_0x3402eb['id']===_0x2afba3['user']['id']){if(!_0x2afba3[_0x511f('0x64')][_0x511f('0x95')]||!_0x2afba3[_0x511f('0x64')][_0x511f('0x96')]){throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3402eb['authenticate'](_0x2afba3['body']['oldPassword'])){throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))](_0x511f('0x99'));}if(_0x2afba3[_0x511f('0x64')][_0x511f('0x95')]===_0x2afba3[_0x511f('0x64')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x511f('0x9a'));}}else if(_0x2afba3['user'][_0x511f('0x3b')]===_0x511f('0x33')){if(!_0x2afba3[_0x511f('0x64')][_0x511f('0x96')]){throw new db['Sequelize'][(_0x511f('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2afba3['user'][_0x511f('0x3b')]==='user'){if(!_0x2afba3[_0x511f('0x64')][_0x511f('0x96')]){throw new db['Sequelize'][(_0x511f('0x98'))](_0x511f('0x9b'));}if(_0x3402eb[_0x511f('0x3b')]!==_0x511f('0x86')){throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))](_0x511f('0x9c'));}}else{throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))]('Unauthorized');}return _0x3402eb;})['then'](handleEntityNotFound(_0x528538,null))[_0x511f('0x1a')](function(_0x2df41b){return db[_0x511f('0x6a')][_0x511f('0x9d')]({'attributes':['id',_0x511f('0x6b'),_0x511f('0x9e'),'passwordHistoryLimit']})['then'](function(_0x1296a1){if(_0x1296a1[_0x511f('0x6b')])authService['validatePasswordPattern'](_0x2afba3[_0x511f('0x64')]['newPassword']);if(!_0x1296a1[_0x511f('0x9e')]||!_0x2df41b[_0x511f('0x9f')])return _0x2df41b;authService[_0x511f('0xa0')](_0x2afba3[_0x511f('0x64')]['newPassword'],_0x2df41b[_0x511f('0x9f')],_0x1296a1[_0x511f('0xa1')]);return _0x2df41b;})['then'](saveUpdates({'password':_0x2afba3[_0x511f('0x64')][_0x511f('0x96')],'passwordResetAt':_0x2afba3['user']['id']==_0x2afba3[_0x511f('0x65')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2afba3[_0x511f('0x64')][_0x511f('0x96')],_0x2df41b[_0x511f('0x9f')])},null));})['then'](respondWithResult(_0x528538,null))['catch'](handleError(_0x528538,null));};exports[_0x511f('0xa2')]=function(_0x203bdf,_0x490854){var _0x3d0786=_0x203bdf[_0x511f('0x64')][_0x511f('0xa3')];return db[_0x511f('0x49')][_0x511f('0x61')]({'where':{'id':_0x203bdf['params']['id']},'attributes':['id',_0x511f('0x3c'),_0x511f('0x3b'),_0x511f('0xa4'),_0x511f('0xa5'),_0x511f('0xa6'),'interface']})[_0x511f('0x1a')](handleEntityNotFound(_0x490854,null))[_0x511f('0x1a')](function(_0x6cbc29){if(_0x6cbc29){if(!utils['isValidChannel'](_0x3d0786)){throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))](_0x511f('0xa7'));}return _0x6cbc29[_0x511f('0xa8')+_['capitalize'](_0x3d0786[_0x511f('0xa9')]())+'Queues'](_0x203bdf[_0x511f('0x64')][_0x511f('0x68')],{'penalty':_0x203bdf['body'][_0x511f('0xaa')]||0x0})['spread'](function(_0x4a959a){for(var _0x11f7b4=0x0;_0x11f7b4<_0x203bdf[_0x511f('0x64')][_0x511f('0x68')][_0x511f('0x53')];_0x11f7b4+=0x1){var _0x52ac29={'UserId':Number(_0x203bdf[_0x511f('0x65')]['id'])};_0x52ac29[_['capitalize'](_0x3d0786[_0x511f('0xa9')]())+'QueueId']=Number(_0x203bdf[_0x511f('0x64')]['ids'][_0x11f7b4]);socket['emit']('user'+_[_0x511f('0xab')](_0x3d0786[_0x511f('0xa9')]())+_0x511f('0xac'),_0x52ac29);}return _0x4a959a;})['then'](function(){if(_0x3d0786===_0x511f('0xad')){return db['VoiceQueue'][_0x511f('0x90')]({'where':{'id':_0x203bdf['body'][_0x511f('0x68')]||[]},'raw':!![],'attributes':['id',_0x511f('0x3c')]});}})[_0x511f('0x1a')](function(_0xcda62){var _0x4bc3ee=_0x6cbc29[_0x511f('0xae')]({'plain':!![]});var _0x3d03c6=[];if(_0x3d0786==='voice'&&_0x4bc3ee['role']===_0x511f('0x86')&&_0x4bc3ee[_0x511f('0xa4')]){for(let _0x521dcb=0x0;_0x521dcb<_0xcda62['length'];_0x521dcb+=0x1){_0x3d03c6[_0x511f('0x54')]({'membername':_0x4bc3ee[_0x511f('0x3c')],'UserId':_0x4bc3ee['id'],'queue_name':_0xcda62[_0x521dcb][_0x511f('0x3c')],'VoiceQueueId':_0xcda62[_0x521dcb]['id'],'interface':_[_0x511f('0x6f')](_0x4bc3ee[_0x511f('0xaf')])?util['format'](_0x511f('0xb0'),_0x4bc3ee['name']):_0x4bc3ee[_0x511f('0xaf')],'paused':_0x4bc3ee[_0x511f('0xa6')]||![],'penalty':_0x203bdf[_0x511f('0x64')][_0x511f('0xaa')]||0x0});}return Promise[_0x511f('0x8f')](_0x3d03c6[_0x511f('0x38')](function(_0x4b9333){return db[_0x511f('0xb1')][_0x511f('0xb2')](_0x4b9333);}));}return _0x6cbc29;});}})[_0x511f('0x1a')](respondWithStatusCode(_0x490854,null))[_0x511f('0x24')](handleError(_0x490854,null));};exports['removeQueues']=function(_0x2603b1,_0xe83414){var _0x36bf24,_0x2b05df;return db[_0x511f('0x49')][_0x511f('0x61')]({'where':{'id':_0x2603b1[_0x511f('0x65')]['id']},'attributes':['id','name',_0x511f('0x3b')]})[_0x511f('0x1a')](handleEntityNotFound(_0xe83414,null))[_0x511f('0x1a')](function(_0x483a82){if(_0x483a82){_0x36bf24=_0x483a82;if(!_0x2603b1[_0x511f('0x4b')]['channel']||!utils[_0x511f('0xb3')](_0x2603b1[_0x511f('0x4b')][_0x511f('0xa3')])){throw new db[(_0x511f('0x97'))]['ValidationError']('Unknown\x20channel');}return _0x483a82[_0x511f('0xb4')+_[_0x511f('0xab')](_0x2603b1[_0x511f('0x4b')][_0x511f('0xa3')][_0x511f('0xa9')]())+'Queues'](_0x2603b1[_0x511f('0x4b')][_0x511f('0x68')]);}})[_0x511f('0x1a')](function(_0x1d1625){if(_[_0x511f('0xb5')](_0x2603b1[_0x511f('0x4b')][_0x511f('0x68')])){for(var _0x1ed29d=0x0;_0x1ed29d<_0x2603b1[_0x511f('0x4b')][_0x511f('0x68')]['length'];_0x1ed29d+=0x1){_0x2b05df={'UserId':Number(_0x2603b1[_0x511f('0x65')]['id'])};_0x2b05df[_[_0x511f('0xab')](_0x2603b1['query'][_0x511f('0xa3')][_0x511f('0xa9')]())+_0x511f('0xb6')]=Number(_0x2603b1[_0x511f('0x4b')][_0x511f('0x68')][_0x1ed29d]);socket[_0x511f('0x30')]('user'+_[_0x511f('0xab')](_0x2603b1[_0x511f('0x4b')][_0x511f('0xa3')][_0x511f('0xa9')]())+_0x511f('0xb7'),_0x2b05df);}}else{_0x2b05df={'UserId':Number(_0x2603b1[_0x511f('0x65')]['id'])};_0x2b05df[_[_0x511f('0xab')](_0x2603b1[_0x511f('0x4b')][_0x511f('0xa3')]['toLowerCase']())+_0x511f('0xb6')]=Number(_0x2603b1[_0x511f('0x4b')][_0x511f('0x68')]);socket[_0x511f('0x30')](_0x511f('0x34')+_[_0x511f('0xab')](_0x2603b1[_0x511f('0x4b')]['channel']['toLowerCase']())+_0x511f('0xb7'),_0x2b05df);}return _0x1d1625;})[_0x511f('0x1a')](function(){if(_0x2603b1['query'][_0x511f('0xa3')]===_0x511f('0xad')){return db[_0x511f('0xb1')]['destroy']({'where':{'UserId':_0x2603b1[_0x511f('0x65')]['id'],'VoiceQueueId':_0x2603b1[_0x511f('0x4b')]['ids']},'individualHooks':!![]})[_0x511f('0x1a')](function(){return _0x36bf24;});}return _0x36bf24;})[_0x511f('0x1a')](respondWithStatusCode(_0xe83414,null))[_0x511f('0x24')](handleError(_0xe83414,null));};exports[_0x511f('0xb8')]=function(_0x8b1b7f,_0x1244d4){_0x8b1b7f[_0x511f('0x64')]['userpic']=_0x8b1b7f[_0x511f('0xb9')][_0x511f('0xba')];return db['User']['find']({'where':{'id':_0x8b1b7f[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x1244d4,null))[_0x511f('0x1a')](saveUpdates(_0x8b1b7f[_0x511f('0x64')],null))[_0x511f('0x1a')](respondWithResult(_0x1244d4,null))[_0x511f('0x24')](handleError(_0x1244d4,null));};exports['getAvatar']=function(_0x5f382b,_0x552255){var _0x35c4f3=path[_0x511f('0xbb')](config[_0x511f('0xbc')],_0x511f('0xbd'));return db['User'][_0x511f('0x61')]({'where':{'id':_0x5f382b[_0x511f('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x552255,null))['then'](function(_0xb84d){if(_0xb84d){if(_['isNil'](_0xb84d[_0x511f('0xbe')])){return _0x552255[_0x511f('0xbf')](_0x35c4f3);}else{if(!fs[_0x511f('0xc0')](path[_0x511f('0xbb')](config[_0x511f('0xbc')],_0x511f('0xc1'),_0xb84d[_0x511f('0xbe')]))){return _0x552255[_0x511f('0xbf')](_0x35c4f3);}return _0x552255['download'](path[_0x511f('0xbb')](config[_0x511f('0xbc')],'server/files/images/',_0xb84d[_0x511f('0xbe')]));}}})[_0x511f('0x24')](handleError(_0x552255,null));};exports[_0x511f('0xc2')]=function(_0x575e39,_0x1e5754){return db[_0x511f('0x49')]['find']({'where':{'id':_0x575e39[_0x511f('0x65')]['id']},'attributes':['id']})[_0x511f('0x1a')](handleEntityNotFound(_0x1e5754,null))[_0x511f('0x1a')](function(_0x1c18fd){var _0x52b007=[];values=_0x1c18fd[_0x511f('0x56')];_0x52b007[_0x511f('0x54')](get_open_tabs(_0x511f('0x55'),_0x1c18fd[_0x511f('0x56')]));_0x52b007[_0x511f('0x54')](get_open_tabs('sms',_0x1c18fd['dataValues']));_0x52b007[_0x511f('0x54')](get_open_tabs(_0x511f('0x58'),_0x1c18fd[_0x511f('0x56')]));_0x52b007['push'](get_open_tabs(_0x511f('0x59'),_0x1c18fd[_0x511f('0x56')]));_0x52b007['push'](get_open_tabs(_0x511f('0x57'),_0x1c18fd['dataValues']));_0x52b007[_0x511f('0x54')](get_open_tabs(_0x511f('0x63'),_0x1c18fd[_0x511f('0x56')]));return Promise[_0x511f('0x8f')](_0x52b007);})[_0x511f('0x1a')](function(_0x301dbd){if(_0x301dbd){var _0x1efc36=_[_0x511f('0x38')](values[_0x511f('0xc3')],function(_0x1d6f2e){return{'channel':_0x511f('0xc4'),'id':_0x1d6f2e['id'],'createdAt':_0x1d6f2e['createdAt']};});var _0x2d8db6=_[_0x511f('0x38')](values[_0x511f('0xc5')],function(_0x588afb){return{'channel':'FAX','id':_0x588afb['id'],'createdAt':_0x588afb[_0x511f('0xc6')]};});var _0x4355f0=_[_0x511f('0x38')](values['OpenchannelOpenTabs'],function(_0x4bbd11){return{'channel':_0x511f('0xc7'),'id':_0x4bbd11['id'],'createdAt':_0x4bbd11['createdAt']};});var _0x2f263c=_[_0x511f('0x38')](values[_0x511f('0xc8')],function(_0x35bbd3){return{'channel':_0x511f('0xc9'),'id':_0x35bbd3['id'],'createdAt':_0x35bbd3[_0x511f('0xc6')]};});var _0x5e90de=_['map'](values[_0x511f('0xca')],function(_0xf1cf7f){return{'channel':_0x511f('0xcb'),'id':_0xf1cf7f['id'],'createdAt':_0xf1cf7f['createdAt']};});var _0x1a7faa=_[_0x511f('0x38')](values[_0x511f('0xcc')],function(_0x2fe3ec){return{'channel':_0x511f('0xcd'),'id':_0x2fe3ec['id'],'createdAt':_0x2fe3ec[_0x511f('0xc6')]};});var _0x5a9239=_[_0x511f('0xce')](_0x1efc36,_0x2d8db6,_0x4355f0,_0x2f263c,_0x5e90de,_0x1a7faa);var _0x4a738b={'count':_0x5a9239['length'],'rows':_0x5a9239};return _0x4a738b;}else return null;})['then'](respondWithResult(_0x1e5754,null))['catch'](handleError(_0x1e5754,null));};exports[_0x511f('0xcf')]=function(_0x3d76db,_0x8ceb1c){var _0x61bd95={};var _0x4386a3={};var _0x78fac7;var _0x47c640;return db['User']['findOne']({'where':{'id':_0x3d76db[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x8ceb1c,null))[_0x511f('0x1a')](function(_0x442030){if(_0x442030){_0x78fac7=_0x442030;_0x4386a3[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_0x511f('0xd0')][_0x511f('0x40')]);_0x4386a3[_0x511f('0x4b')]=_['keys'](_0x3d76db[_0x511f('0x4b')]);_0x4386a3['filters']=_[_0x511f('0x5e')](_0x4386a3[_0x511f('0x5a')],_0x4386a3[_0x511f('0x4b')]);_0x61bd95[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x4386a3[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x3d76db[_0x511f('0x4b')][_0x511f('0x5f')]));_0x61bd95[_0x511f('0x4f')]=_0x61bd95[_0x511f('0x4f')][_0x511f('0x53')]?_0x61bd95[_0x511f('0x4f')]:_0x4386a3[_0x511f('0x5a')];_0x61bd95[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x3d76db[_0x511f('0x4b')][_0x511f('0xd2')]);_0x61bd95['where']=qs['filters'](_[_0x511f('0xd3')](_0x3d76db['query'],_0x4386a3[_0x511f('0x5d')]));if(_0x3d76db['query'][_0x511f('0x44')]){_0x61bd95[_0x511f('0x48')]=_['merge'](_0x61bd95['where'],{'$or':_[_0x511f('0x38')](_0x61bd95[_0x511f('0x4f')],function(_0x1d917d){var _0x4fb879={};_0x4fb879[_0x1d917d]={'$like':'%'+_0x3d76db[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x4fb879;})});}_0x61bd95=_[_0x511f('0xd4')]({},_0x61bd95,_0x3d76db['options']);return _0x78fac7[_0x511f('0xcf')](_0x61bd95);}})[_0x511f('0x1a')](function(_0x30f235){if(_0x30f235){_0x47c640=_0x30f235[_0x511f('0x53')];if(_0x3d76db[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0x4a'))){_0x61bd95[_0x511f('0x4d')]=[{'model':db[_0x511f('0xd6')],'as':_0x511f('0xd7'),'required':![]},{'model':db['Tag'],'as':_0x511f('0xd8'),'attributes':['id',_0x511f('0x3c'),_0x511f('0xd9')],'where':_0x3d76db['query'][_0x511f('0xda')]?{'id':_0x3d76db[_0x511f('0x4b')]['tag']}:undefined,'required':_0x3d76db[_0x511f('0x4b')][_0x511f('0xda')]?!![]:![]}];}if(!_0x3d76db[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0xdb'))){_0x61bd95[_0x511f('0x2b')]=qs[_0x511f('0x2b')](_0x3d76db[_0x511f('0x4b')][_0x511f('0x2b')]);_0x61bd95[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x3d76db[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x78fac7['getContacts'](_0x61bd95);}})[_0x511f('0x1a')](function(_0x407e51){if(_0x407e51){return _0x407e51?{'count':_0x47c640,'rows':_0x407e51}:null;}})['then'](respondWithResult(_0x8ceb1c,null))[_0x511f('0x24')](handleError(_0x8ceb1c,null));};exports[_0x511f('0xdc')]=function(_0x6f7c11,_0x227125){var _0x3d5b29;var _0x1a2953={};var _0x1e7c5a;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x6f7c11[_0x511f('0x65')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x227125,null))[_0x511f('0x1a')](function(_0x2b5394){if(!utils[_0x511f('0xb3')](_0x6f7c11[_0x511f('0x4b')][_0x511f('0xa3')])){throw new db['Sequelize'][(_0x511f('0x98'))]('Unknown\x20channel');}_0x3d5b29=_0x2b5394;var _0x318195={};_0x318195[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_[_0x511f('0xab')](_0x6f7c11[_0x511f('0x4b')][_0x511f('0xa3')])+_0x511f('0xdd')][_0x511f('0x40')]);_0x318195[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x6f7c11[_0x511f('0x4b')]);_0x318195[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x318195['model'],_0x318195[_0x511f('0x4b')]);_0x1a2953['attributes']=_[_0x511f('0x5e')](_0x318195['model'],qs[_0x511f('0x5f')](_0x6f7c11[_0x511f('0x4b')][_0x511f('0x5f')]));_0x1a2953['attributes']=_0x1a2953[_0x511f('0x4f')]['length']?_0x1a2953[_0x511f('0x4f')]:_0x318195[_0x511f('0x5a')];_0x1a2953[_0x511f('0xd1')]=qs['sort'](_0x6f7c11[_0x511f('0x4b')]['sort']);_0x1a2953[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0x6f7c11['query'],_0x318195['filters']));if(_0x6f7c11[_0x511f('0x4b')][_0x511f('0x44')]){_0x1a2953['where']=_[_0x511f('0xd4')](_0x1a2953['where'],{'$or':_[_0x511f('0x38')](_0x1a2953['attributes'],function(_0x3f05a5){var _0x26e84c={};_0x26e84c[_0x3f05a5]={'$like':'%'+_0x6f7c11[_0x511f('0x4b')]['filter']+'%'};return _0x26e84c;})});}_0x1a2953=_[_0x511f('0xd4')]({},_0x1a2953,_0x6f7c11[_0x511f('0x60')]);switch(_0x3d5b29[_0x511f('0x3b')]){case _0x511f('0x33'):return db[_[_0x511f('0xab')](_0x6f7c11[_0x511f('0x4b')][_0x511f('0xa3')])+_0x511f('0xdd')][_0x511f('0x90')](_0x1a2953);case _0x511f('0x34'):case _0x511f('0x86'):return _0x3d5b29['get'+_['capitalize'](_0x6f7c11['query']['channel'])+_0x511f('0xde')](_0x1a2953);default:throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))](_0x511f('0xdf'));}})['then'](function(_0x51bb34){_0x1e7c5a=_0x51bb34['length'];if(!_0x6f7c11[_0x511f('0x4b')]['hasOwnProperty'](_0x511f('0xdb'))){_0x1a2953['limit']=qs[_0x511f('0x2b')](_0x6f7c11[_0x511f('0x4b')][_0x511f('0x2b')]);_0x1a2953[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x6f7c11[_0x511f('0x4b')]['offset']);}switch(_0x3d5b29['role']){case _0x511f('0x33'):return db[_[_0x511f('0xab')](_0x6f7c11[_0x511f('0x4b')]['channel'])+'Queue'][_0x511f('0x90')](_0x1a2953);case _0x511f('0x34'):case _0x511f('0x86'):return _0x3d5b29[_0x511f('0xae')+_['capitalize'](_0x6f7c11['query'][_0x511f('0xa3')])+_0x511f('0xde')](_0x1a2953);}})[_0x511f('0x1a')](function(_0x35abde){return{'count':_0x1e7c5a,'rows':_0x35abde};})[_0x511f('0x1a')](respondWithResult(_0x227125,null))[_0x511f('0x24')](handleError(_0x227125,null));};exports['getVoiceQueuesRt']=function(_0x1eee3d,_0x858e8f){var _0xb1c90e={};var _0x329ea8={};var _0x59ea68;var _0x5c473e;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x1eee3d['params']['id']}})['then'](handleEntityNotFound(_0x858e8f,null))[_0x511f('0x1a')](function(_0x61687){if(_0x61687){_0x59ea68=_0x61687;_0x329ea8[_0x511f('0x5a')]=_[_0x511f('0x5c')](db['UserVoiceQueueRt'][_0x511f('0x40')]);_0x329ea8[_0x511f('0x4b')]=_['keys'](_0x1eee3d[_0x511f('0x4b')]);_0x329ea8['filters']=_[_0x511f('0x5e')](_0x329ea8['model'],_0x329ea8[_0x511f('0x4b')]);_0xb1c90e[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x329ea8[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x1eee3d[_0x511f('0x4b')]['fields']));_0xb1c90e[_0x511f('0x4f')]=_0xb1c90e[_0x511f('0x4f')][_0x511f('0x53')]?_0xb1c90e['attributes']:_0x329ea8['model'];_0xb1c90e[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x1eee3d[_0x511f('0x4b')][_0x511f('0xd2')]);_0xb1c90e['where']=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x1eee3d[_0x511f('0x4b')],_0x329ea8[_0x511f('0x5d')]));if(_0x1eee3d[_0x511f('0x4b')][_0x511f('0x44')]){_0xb1c90e[_0x511f('0x48')]=_[_0x511f('0xd4')](_0xb1c90e[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0xb1c90e[_0x511f('0x4f')],function(_0x1da935){var _0x1f94df={};_0x1f94df[_0x1da935]={'$like':'%'+_0x1eee3d[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x1f94df;})});}_0xb1c90e=_['merge']({},_0xb1c90e,_0x1eee3d[_0x511f('0x60')]);return _0x59ea68[_0x511f('0xe0')](_0xb1c90e);}})[_0x511f('0x1a')](function(_0x3e6b88){if(_0x3e6b88){_0x5c473e=_0x3e6b88[_0x511f('0x53')];if(!_0x1eee3d['query']['hasOwnProperty'](_0x511f('0xdb'))){_0xb1c90e['limit']=qs[_0x511f('0x2b')](_0x1eee3d[_0x511f('0x4b')][_0x511f('0x2b')]);_0xb1c90e[_0x511f('0x29')]=qs['offset'](_0x1eee3d[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x59ea68['getVoiceQueuesRt'](_0xb1c90e);}})[_0x511f('0x1a')](function(_0x2f5337){if(_0x2f5337){return _0x2f5337?{'count':_0x5c473e,'rows':_0x2f5337}:null;}})[_0x511f('0x1a')](respondWithResult(_0x858e8f,null))[_0x511f('0x24')](handleError(_0x858e8f,null));};exports['getGroups']=function(_0x4d1eb9,_0x58d6ed){var _0x212e97={};var _0x556753={};var _0x26d83d;var _0x1b812a;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x4d1eb9[_0x511f('0x65')]['id']}})['then'](handleEntityNotFound(_0x58d6ed,null))[_0x511f('0x1a')](function(_0x4c1246){if(_0x4c1246){_0x26d83d=_0x4c1246;_0x556753['model']=_[_0x511f('0x5c')](db[_0x511f('0xe1')][_0x511f('0x40')]);_0x556753[_0x511f('0x4b')]=_['keys'](_0x4d1eb9[_0x511f('0x4b')]);_0x556753[_0x511f('0x5d')]=_['intersection'](_0x556753[_0x511f('0x5a')],_0x556753[_0x511f('0x4b')]);_0x212e97['attributes']=_[_0x511f('0x5e')](_0x556753[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x4d1eb9[_0x511f('0x4b')]['fields']));_0x212e97[_0x511f('0x4f')]=_0x212e97['attributes'][_0x511f('0x53')]?_0x212e97[_0x511f('0x4f')]:_0x556753[_0x511f('0x5a')];_0x212e97['order']=qs[_0x511f('0xd2')](_0x4d1eb9['query']['sort']);_0x212e97[_0x511f('0x48')]=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x4d1eb9[_0x511f('0x4b')],_0x556753['filters']));if(_0x4d1eb9['query'][_0x511f('0x44')]){_0x212e97[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x212e97[_0x511f('0x48')],{'$or':_['map'](_0x212e97[_0x511f('0x4f')],function(_0x49f2e7){var _0x300b4c={};_0x300b4c[_0x49f2e7]={'$like':'%'+_0x4d1eb9[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x300b4c;})});}_0x212e97=_[_0x511f('0xd4')]({},_0x212e97,_0x4d1eb9['options']);return _0x26d83d[_0x511f('0xe2')](_0x212e97);}})[_0x511f('0x1a')](function(_0x255a4d){if(_0x255a4d){_0x1b812a=_0x255a4d[_0x511f('0x53')];if(!_0x4d1eb9[_0x511f('0x4b')]['hasOwnProperty']('nolimit')){_0x212e97[_0x511f('0x2b')]=qs['limit'](_0x4d1eb9[_0x511f('0x4b')][_0x511f('0x2b')]);_0x212e97['offset']=qs['offset'](_0x4d1eb9[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x26d83d['getGroups'](_0x212e97);}})['then'](function(_0x1d5778){if(_0x1d5778){return _0x1d5778?{'count':_0x1b812a,'rows':_0x1d5778}:null;}})[_0x511f('0x1a')](respondWithResult(_0x58d6ed,null))[_0x511f('0x24')](handleError(_0x58d6ed,null));};exports[_0x511f('0xe3')]=function(_0x30e957,_0x5dfeee){var _0x426ae1={'raw':!![],'where':{}};var _0x44a62b={};var _0x1fe34b={'count':0x0,'rows':[]};return db['User'][_0x511f('0x9d')]({'where':{'id':_0x30e957['params']['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x5dfeee,null))['then'](function(_0xdcf94){if(_0xdcf94){_0x44a62b[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_0x511f('0xe4')]['rawAttributes']);_0x44a62b['query']=_['keys'](_0x30e957['query']);_0x44a62b['filters']=_[_0x511f('0x5e')](_0x44a62b['model'],_0x44a62b[_0x511f('0x4b')]);_0x426ae1[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x44a62b[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x30e957[_0x511f('0x4b')][_0x511f('0x5f')]));_0x426ae1[_0x511f('0x4f')]=_0x426ae1[_0x511f('0x4f')][_0x511f('0x53')]?_0x426ae1[_0x511f('0x4f')]:_0x44a62b['model'];if(!_0x30e957[_0x511f('0x4b')]['hasOwnProperty'](_0x511f('0xdb'))){_0x426ae1[_0x511f('0x2b')]=qs[_0x511f('0x2b')](_0x30e957[_0x511f('0x4b')][_0x511f('0x2b')]);_0x426ae1[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x30e957['query'][_0x511f('0x29')]);}_0x426ae1[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x30e957['query'][_0x511f('0xd2')]);_0x426ae1[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0x30e957[_0x511f('0x4b')],_0x44a62b[_0x511f('0x5d')]));_0x426ae1[_0x511f('0x48')]['UserId']=_0xdcf94['id'];if(_0x30e957[_0x511f('0x4b')][_0x511f('0x44')]){_0x426ae1[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x426ae1[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0x426ae1[_0x511f('0x4f')],function(_0x33d5df){var _0x251f97={};_0x251f97[_0x33d5df]={'$like':'%'+_0x30e957['query'][_0x511f('0x44')]+'%'};return _0x251f97;})});}_0x426ae1=_[_0x511f('0xd4')]({},_0x426ae1,_0x30e957[_0x511f('0x60')]);return db[_0x511f('0xe4')][_0x511f('0x2c')]({'where':_0x426ae1[_0x511f('0x48')]})[_0x511f('0x1a')](function(_0xeebb63){_0x1fe34b['count']=_0xeebb63;if(_0x30e957['query']['includeAll']){_0x426ae1[_0x511f('0x4d')]=[{'all':!![]}];}return db[_0x511f('0xe4')][_0x511f('0x90')](_0x426ae1);})[_0x511f('0x1a')](function(_0x2e24ce){_0x1fe34b[_0x511f('0x50')]=_0x2e24ce;return _0x1fe34b;});}})[_0x511f('0x1a')](respondWithFilteredResult(_0x5dfeee,_0x426ae1))[_0x511f('0x24')](handleError(_0x5dfeee,null));};exports[_0x511f('0xe5')]=function(_0xeaeb0a,_0x278611){var _0x4d0e07={'raw':!![],'where':{}};var _0x163df9={};var _0x132dbe={'count':0x0,'rows':[]};return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0xeaeb0a['params']['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x278611,null))['then'](function(_0x5c9108){if(_0x5c9108){_0x163df9['model']=_[_0x511f('0x5c')](db[_0x511f('0xe6')][_0x511f('0x40')]);_0x163df9[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0xeaeb0a['query']);_0x163df9[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x163df9['model'],_0x163df9['query']);_0x4d0e07['attributes']=_[_0x511f('0x5e')](_0x163df9['model'],qs['fields'](_0xeaeb0a[_0x511f('0x4b')][_0x511f('0x5f')]));_0x4d0e07[_0x511f('0x4f')]=_0x4d0e07[_0x511f('0x4f')][_0x511f('0x53')]?_0x4d0e07[_0x511f('0x4f')]:_0x163df9[_0x511f('0x5a')];if(!_0xeaeb0a[_0x511f('0x4b')][_0x511f('0xd5')]('nolimit')){_0x4d0e07[_0x511f('0x2b')]=qs[_0x511f('0x2b')](_0xeaeb0a[_0x511f('0x4b')][_0x511f('0x2b')]);_0x4d0e07['offset']=qs[_0x511f('0x29')](_0xeaeb0a[_0x511f('0x4b')]['offset']);}_0x4d0e07[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0xeaeb0a['query'][_0x511f('0xd2')]);_0x4d0e07[_0x511f('0x48')]=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0xeaeb0a['query'],_0x163df9[_0x511f('0x5d')]));_0x4d0e07[_0x511f('0x48')][_0x511f('0xe7')]=_0x5c9108['id'];if(_0xeaeb0a[_0x511f('0x4b')][_0x511f('0x44')]){_0x4d0e07[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x4d0e07[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0x4d0e07['attributes'],function(_0x4c7c71){var _0x3a89cb={};_0x3a89cb[_0x4c7c71]={'$like':'%'+_0xeaeb0a[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x3a89cb;})});}_0x4d0e07=_['merge']({},_0x4d0e07,_0xeaeb0a[_0x511f('0x60')]);return db[_0x511f('0xe6')][_0x511f('0x2c')]({'where':_0x4d0e07[_0x511f('0x48')]})['then'](function(_0x13e0aa){_0x132dbe[_0x511f('0x2c')]=_0x13e0aa;if(_0xeaeb0a[_0x511f('0x4b')][_0x511f('0x4a')]){_0x4d0e07[_0x511f('0x4d')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4d0e07);})[_0x511f('0x1a')](function(_0x3a0937){_0x132dbe[_0x511f('0x50')]=_0x3a0937;return _0x132dbe;});}})[_0x511f('0x1a')](respondWithFilteredResult(_0x278611,_0x4d0e07))[_0x511f('0x24')](handleError(_0x278611,null));};exports['getChatInteractions']=function(_0x4317fb,_0x36578d){var _0x1af2d5={};var _0xac3bd1={};var _0x4f9cbc;var _0x11f7a7;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x4317fb['params']['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x36578d,null))['then'](function(_0x46174e){if(_0x46174e){_0x4f9cbc=_0x46174e;_0xac3bd1[_0x511f('0x5a')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0xac3bd1[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x4317fb[_0x511f('0x4b')]);_0xac3bd1[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0xac3bd1[_0x511f('0x5a')],_0xac3bd1['query']);_0x1af2d5[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0xac3bd1[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x4317fb[_0x511f('0x4b')][_0x511f('0x5f')]));_0x1af2d5['attributes']=_0x1af2d5[_0x511f('0x4f')][_0x511f('0x53')]?_0x1af2d5[_0x511f('0x4f')]:_0xac3bd1[_0x511f('0x5a')];_0x1af2d5[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x4317fb[_0x511f('0x4b')][_0x511f('0xd2')]);_0x1af2d5[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0x4317fb[_0x511f('0x4b')],_0xac3bd1[_0x511f('0x5d')]));if(_0x4317fb[_0x511f('0x4b')][_0x511f('0x44')]){_0x1af2d5[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x1af2d5['where'],{'$or':_[_0x511f('0x38')](_0x1af2d5[_0x511f('0x4f')],function(_0x2ea7ae){var _0x508be1={};_0x508be1[_0x2ea7ae]={'$like':'%'+_0x4317fb[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x508be1;})});}_0x1af2d5=_[_0x511f('0xd4')]({},_0x1af2d5,_0x4317fb[_0x511f('0x60')]);return _0x4f9cbc[_0x511f('0xe8')](_0x1af2d5);}})[_0x511f('0x1a')](function(_0x3bad15){if(_0x3bad15){_0x11f7a7=_0x3bad15['length'];if(!_0x4317fb[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0xdb'))){_0x1af2d5[_0x511f('0x2b')]=qs['limit'](_0x4317fb['query'][_0x511f('0x2b')]);_0x1af2d5['offset']=qs['offset'](_0x4317fb[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x4f9cbc['getChatInteractions'](_0x1af2d5);}})[_0x511f('0x1a')](function(_0x31e3fc){if(_0x31e3fc){return _0x31e3fc?{'count':_0x11f7a7,'rows':_0x31e3fc}:null;}})[_0x511f('0x1a')](respondWithResult(_0x36578d,null))['catch'](handleError(_0x36578d,null));};exports[_0x511f('0xe9')]=function(_0x5958b9,_0x48aacd){var _0x53cce1={};var _0x431618={};var _0x4c31f2;var _0x330ba2;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x5958b9['params']['id']}})['then'](handleEntityNotFound(_0x48aacd,null))[_0x511f('0x1a')](function(_0x413939){if(_0x413939){_0x4c31f2=_0x413939;_0x431618[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_0x511f('0xea')]['rawAttributes']);_0x431618[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x5958b9[_0x511f('0x4b')]);_0x431618[_0x511f('0x5d')]=_['intersection'](_0x431618[_0x511f('0x5a')],_0x431618['query']);_0x53cce1[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x431618[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x5958b9[_0x511f('0x4b')][_0x511f('0x5f')]));_0x53cce1[_0x511f('0x4f')]=_0x53cce1[_0x511f('0x4f')][_0x511f('0x53')]?_0x53cce1[_0x511f('0x4f')]:_0x431618[_0x511f('0x5a')];_0x53cce1[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x5958b9['query'][_0x511f('0xd2')]);_0x53cce1[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0x5958b9[_0x511f('0x4b')],_0x431618['filters']));if(_0x5958b9[_0x511f('0x4b')][_0x511f('0x44')]){_0x53cce1[_0x511f('0x48')]=_['merge'](_0x53cce1['where'],{'$or':_['map'](_0x53cce1[_0x511f('0x4f')],function(_0x21c9b5){var _0x103971={};_0x103971[_0x21c9b5]={'$like':'%'+_0x5958b9[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x103971;})});}_0x53cce1=_[_0x511f('0xd4')]({},_0x53cce1,_0x5958b9['options']);return _0x4c31f2[_0x511f('0xe9')](_0x53cce1);}})['then'](function(_0x5855f2){if(_0x5855f2){_0x330ba2=_0x5855f2[_0x511f('0x53')];if(!_0x5958b9[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0xdb'))){_0x53cce1[_0x511f('0x2b')]=qs[_0x511f('0x2b')](_0x5958b9[_0x511f('0x4b')][_0x511f('0x2b')]);_0x53cce1['offset']=qs['offset'](_0x5958b9[_0x511f('0x4b')]['offset']);}return _0x4c31f2[_0x511f('0xe9')](_0x53cce1);}})[_0x511f('0x1a')](function(_0x2dc929){if(_0x2dc929){return _0x2dc929?{'count':_0x330ba2,'rows':_0x2dc929}:null;}})[_0x511f('0x1a')](respondWithResult(_0x48aacd,null))['catch'](handleError(_0x48aacd,null));};exports[_0x511f('0xeb')]=function(_0xcb8f9c,_0x2eae9e){var _0x55a77e={'raw':!![],'where':{}};var _0x385f29={};var _0x32d769={'count':0x0,'rows':[]};return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0xcb8f9c[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x2eae9e,null))['then'](function(_0x104946){if(_0x104946){_0x385f29[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_0x511f('0xec')][_0x511f('0x40')]);_0x385f29['query']=_[_0x511f('0x5c')](_0xcb8f9c[_0x511f('0x4b')]);_0x385f29[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x385f29[_0x511f('0x5a')],_0x385f29[_0x511f('0x4b')]);_0x55a77e[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x385f29['model'],qs[_0x511f('0x5f')](_0xcb8f9c[_0x511f('0x4b')]['fields']));_0x55a77e[_0x511f('0x4f')]=_0x55a77e[_0x511f('0x4f')][_0x511f('0x53')]?_0x55a77e['attributes']:_0x385f29[_0x511f('0x5a')];if(!_0xcb8f9c[_0x511f('0x4b')][_0x511f('0xd5')]('nolimit')){_0x55a77e[_0x511f('0x2b')]=qs['limit'](_0xcb8f9c[_0x511f('0x4b')][_0x511f('0x2b')]);_0x55a77e[_0x511f('0x29')]=qs[_0x511f('0x29')](_0xcb8f9c[_0x511f('0x4b')]['offset']);}_0x55a77e[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0xcb8f9c[_0x511f('0x4b')][_0x511f('0xd2')]);_0x55a77e[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0xcb8f9c[_0x511f('0x4b')],_0x385f29[_0x511f('0x5d')]));_0x55a77e[_0x511f('0x48')]['UserId']=_0x104946['id'];if(_0xcb8f9c[_0x511f('0x4b')][_0x511f('0x44')]){_0x55a77e[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x55a77e['where'],{'$or':_[_0x511f('0x38')](_0x55a77e[_0x511f('0x4f')],function(_0x297baf){var _0x170a59={};_0x170a59[_0x297baf]={'$like':'%'+_0xcb8f9c[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x170a59;})});}_0x55a77e=_[_0x511f('0xd4')]({},_0x55a77e,_0xcb8f9c['options']);return db[_0x511f('0xec')][_0x511f('0x2c')]({'where':_0x55a77e[_0x511f('0x48')]})[_0x511f('0x1a')](function(_0xa7358b){_0x32d769['count']=_0xa7358b;if(_0xcb8f9c['query'][_0x511f('0x4a')]){_0x55a77e['include']=[{'all':!![]}];}return db[_0x511f('0xec')][_0x511f('0x90')](_0x55a77e);})[_0x511f('0x1a')](function(_0x277638){_0x32d769[_0x511f('0x50')]=_0x277638;return _0x32d769;});}})[_0x511f('0x1a')](respondWithFilteredResult(_0x2eae9e,_0x55a77e))[_0x511f('0x24')](handleError(_0x2eae9e,null));};exports[_0x511f('0xed')]=function(_0x244ca3,_0x15c167){var _0x5bf450={};var _0x5e4e85={};var _0x1b51b0;var _0x1f1c9f;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x244ca3[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x15c167,null))[_0x511f('0x1a')](function(_0x3baf69){if(_0x3baf69){_0x1b51b0=_0x3baf69;_0x5e4e85[_0x511f('0x5a')]=_[_0x511f('0x5c')](db[_0x511f('0xee')]['rawAttributes']);_0x5e4e85[_0x511f('0x4b')]=_['keys'](_0x244ca3['query']);_0x5e4e85[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x5e4e85[_0x511f('0x5a')],_0x5e4e85[_0x511f('0x4b')]);_0x5bf450[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x5e4e85[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x244ca3[_0x511f('0x4b')][_0x511f('0x5f')]));_0x5bf450['attributes']=_0x5bf450[_0x511f('0x4f')][_0x511f('0x53')]?_0x5bf450[_0x511f('0x4f')]:_0x5e4e85[_0x511f('0x5a')];_0x5bf450[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x244ca3[_0x511f('0x4b')][_0x511f('0xd2')]);_0x5bf450['where']=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x244ca3[_0x511f('0x4b')],_0x5e4e85[_0x511f('0x5d')]));if(_0x244ca3[_0x511f('0x4b')][_0x511f('0x44')]){_0x5bf450[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x5bf450[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0x5bf450[_0x511f('0x4f')],function(_0x28c62c){var _0x508335={};_0x508335[_0x28c62c]={'$like':'%'+_0x244ca3[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x508335;})});}_0x5bf450=_[_0x511f('0xd4')]({},_0x5bf450,_0x244ca3['options']);return _0x1b51b0[_0x511f('0xed')](_0x5bf450);}})[_0x511f('0x1a')](function(_0x1151ab){if(_0x1151ab){_0x1f1c9f=_0x1151ab[_0x511f('0x53')];if(!_0x244ca3[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0xdb'))){_0x5bf450[_0x511f('0x2b')]=qs['limit'](_0x244ca3[_0x511f('0x4b')][_0x511f('0x2b')]);_0x5bf450[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x244ca3[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x1b51b0['getSmsInteractions'](_0x5bf450);}})[_0x511f('0x1a')](function(_0x545370){if(_0x545370){return _0x545370?{'count':_0x1f1c9f,'rows':_0x545370}:null;}})['then'](respondWithResult(_0x15c167,null))[_0x511f('0x24')](handleError(_0x15c167,null));};exports[_0x511f('0xef')]=function(_0x3c9149,_0x2cd5cb){var _0x534fcb={};var _0x386a2f={};var _0x1d0b50;var _0x271449;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x3c9149['params']['id']}})['then'](handleEntityNotFound(_0x2cd5cb,null))[_0x511f('0x1a')](function(_0x34e36c){if(_0x34e36c){_0x1d0b50=_0x34e36c;_0x386a2f['model']=_['keys'](db[_0x511f('0xf0')][_0x511f('0x40')]);_0x386a2f[_0x511f('0x4b')]=_['keys'](_0x3c9149[_0x511f('0x4b')]);_0x386a2f['filters']=_[_0x511f('0x5e')](_0x386a2f[_0x511f('0x5a')],_0x386a2f['query']);_0x534fcb['attributes']=_[_0x511f('0x5e')](_0x386a2f['model'],qs['fields'](_0x3c9149[_0x511f('0x4b')][_0x511f('0x5f')]));_0x534fcb[_0x511f('0x4f')]=_0x534fcb[_0x511f('0x4f')]['length']?_0x534fcb['attributes']:_0x386a2f['model'];_0x534fcb[_0x511f('0xd1')]=qs['sort'](_0x3c9149[_0x511f('0x4b')][_0x511f('0xd2')]);_0x534fcb[_0x511f('0x48')]=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x3c9149[_0x511f('0x4b')],_0x386a2f['filters']));if(_0x3c9149[_0x511f('0x4b')][_0x511f('0x44')]){_0x534fcb[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x534fcb[_0x511f('0x48')],{'$or':_['map'](_0x534fcb[_0x511f('0x4f')],function(_0x2681a6){var _0x1e7e26={};_0x1e7e26[_0x2681a6]={'$like':'%'+_0x3c9149[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x1e7e26;})});}_0x534fcb=_[_0x511f('0xd4')]({},_0x534fcb,_0x3c9149[_0x511f('0x60')]);return _0x1d0b50[_0x511f('0xef')](_0x534fcb);}})[_0x511f('0x1a')](function(_0x3b2e4d){if(_0x3b2e4d){_0x271449=_0x3b2e4d[_0x511f('0x53')];if(!_0x3c9149[_0x511f('0x4b')]['hasOwnProperty'](_0x511f('0xdb'))){_0x534fcb[_0x511f('0x2b')]=qs[_0x511f('0x2b')](_0x3c9149[_0x511f('0x4b')][_0x511f('0x2b')]);_0x534fcb[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x3c9149['query'][_0x511f('0x29')]);}return _0x1d0b50[_0x511f('0xef')](_0x534fcb);}})[_0x511f('0x1a')](function(_0x1694ed){if(_0x1694ed){return _0x1694ed?{'count':_0x271449,'rows':_0x1694ed}:null;}})['then'](respondWithResult(_0x2cd5cb,null))['catch'](handleError(_0x2cd5cb,null));};exports['getWhatsappInteractions']=function(_0x660c71,_0x316e0f){var _0x3cf5d2={};var _0x52c2af={};var _0x377f50;var _0x277b28;return db[_0x511f('0x49')]['findOne']({'where':{'id':_0x660c71[_0x511f('0x65')]['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x316e0f,null))[_0x511f('0x1a')](function(_0x278f1e){if(_0x278f1e){_0x377f50=_0x278f1e;_0x52c2af[_0x511f('0x5a')]=_['keys'](db[_0x511f('0xf1')]['rawAttributes']);_0x52c2af[_0x511f('0x4b')]=_['keys'](_0x660c71[_0x511f('0x4b')]);_0x52c2af[_0x511f('0x5d')]=_['intersection'](_0x52c2af[_0x511f('0x5a')],_0x52c2af[_0x511f('0x4b')]);_0x3cf5d2[_0x511f('0x4f')]=_['intersection'](_0x52c2af['model'],qs[_0x511f('0x5f')](_0x660c71[_0x511f('0x4b')]['fields']));_0x3cf5d2[_0x511f('0x4f')]=_0x3cf5d2[_0x511f('0x4f')][_0x511f('0x53')]?_0x3cf5d2['attributes']:_0x52c2af[_0x511f('0x5a')];_0x3cf5d2[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x660c71[_0x511f('0x4b')][_0x511f('0xd2')]);_0x3cf5d2[_0x511f('0x48')]=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x660c71[_0x511f('0x4b')],_0x52c2af[_0x511f('0x5d')]));if(_0x660c71[_0x511f('0x4b')][_0x511f('0x44')]){_0x3cf5d2[_0x511f('0x48')]=_['merge'](_0x3cf5d2['where'],{'$or':_[_0x511f('0x38')](_0x3cf5d2[_0x511f('0x4f')],function(_0x282d45){var _0x2e3f1b={};_0x2e3f1b[_0x282d45]={'$like':'%'+_0x660c71[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x2e3f1b;})});}_0x3cf5d2=_[_0x511f('0xd4')]({},_0x3cf5d2,_0x660c71['options']);return _0x377f50[_0x511f('0xf2')](_0x3cf5d2);}})['then'](function(_0x60fd67){if(_0x60fd67){_0x277b28=_0x60fd67[_0x511f('0x53')];if(!_0x660c71[_0x511f('0x4b')]['hasOwnProperty'](_0x511f('0xdb'))){_0x3cf5d2[_0x511f('0x2b')]=qs['limit'](_0x660c71['query'][_0x511f('0x2b')]);_0x3cf5d2[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x660c71['query'][_0x511f('0x29')]);}return _0x377f50[_0x511f('0xf2')](_0x3cf5d2);}})[_0x511f('0x1a')](function(_0x157920){if(_0x157920){return _0x157920?{'count':_0x277b28,'rows':_0x157920}:null;}})[_0x511f('0x1a')](respondWithResult(_0x316e0f,null))[_0x511f('0x24')](handleError(_0x316e0f,null));};exports[_0x511f('0xf3')]=function(_0x13dcb9,_0x42c342,_0x4d0c34){var _0x2aab8e;var _0x1cb0e4;var _0x37cf5c;var _0x146766=!_[_0x511f('0x6f')](_0x13dcb9[_0x511f('0x65')]['id'])?_0x13dcb9[_0x511f('0x65')]['id']:!_[_0x511f('0x6f')](_0x13dcb9[_0x511f('0x34')]['id'])?_0x13dcb9['user']['id']:null;return db[_0x511f('0x49')][_0x511f('0x61')]({'where':{'id':_0x146766,'role':{'$or':[_0x511f('0x33'),'user','agent']}},'attributes':['id',_0x511f('0x3c'),_0x511f('0xf4'),'mobile',_0x511f('0x3b'),_0x511f('0x6e'),_0x511f('0xa5')]})[_0x511f('0x1a')](function(_0x5182b2){if(_0x5182b2){if(_0x5182b2['role']===_0x511f('0x86')){_0x2aab8e=_0x5182b2;if(_0x13dcb9[_0x511f('0x64')][_0x511f('0xaf')]){_0x37cf5c=util[_0x511f('0xf5')]('LOCAL/%s@from-sip/n',_0x2aab8e[_0x13dcb9['body']['interface']]);}else if(_0x13dcb9['body'][_0x511f('0xf6')]){_0x37cf5c=util[_0x511f('0xf5')](_0x511f('0xb0'),_0x13dcb9[_0x511f('0x64')][_0x511f('0xf6')]);}else{_0x37cf5c=util[_0x511f('0xf5')](_0x511f('0xb0'),_0x2aab8e[_0x511f('0x3c')]);}socket['to'](util[_0x511f('0xf5')](_0x511f('0xf7'),_0x2aab8e[_0x511f('0x3c')]))[_0x511f('0x30')](_0x511f('0xf8'),{'user':{'id':_0x2aab8e['id'],'name':_0x2aab8e[_0x511f('0x3c')]},'ip':_0x13dcb9['headers'][_0x511f('0xf9')]||_0x13dcb9[_0x511f('0xfa')][_0x511f('0xfb')]||_0x13dcb9['socket'][_0x511f('0xfb')]||_0x13dcb9[_0x511f('0xfa')][_0x511f('0xfc')][_0x511f('0xfb')]});return db[_0x511f('0xb1')]['destroy']({'where':{'membername':_0x2aab8e['name']},'individualHooks':!![]});}}else{throw new db[(_0x511f('0x97'))][(_0x511f('0x98'))](_0x511f('0xfd'));}})[_0x511f('0x1a')](function(){if(_0x2aab8e){return _0x2aab8e[_0x511f('0xfe')]({'raw':!![]});}})['then'](function(_0x153067){if(_0x2aab8e){if(_0x153067){_0x1cb0e4=_0x153067;if(_0x1cb0e4[_0x511f('0x53')]){var _0x1d4f76=_0x1cb0e4[_0x511f('0x38')](function(_0x49f9b8){var _0x4714c2={'membername':_0x2aab8e['name'],'UserId':_0x2aab8e['id'],'queue_name':_0x49f9b8[_0x511f('0x3c')],'VoiceQueueId':_0x49f9b8['id'],'interface':_0x37cf5c,'paused':_0x2aab8e[_0x511f('0xa5')]||![],'penalty':_0x49f9b8['UserVoiceQueue.penalty']||0x0};return db[_0x511f('0xb1')]['upsert'](_0x4714c2);});return Promise[_0x511f('0x8f')](_0x1d4f76);}}}})[_0x511f('0x1a')](function(){if(_0x2aab8e){return db[_0x511f('0xff')][_0x511f('0x90')]({'where':{'membername':_0x2aab8e[_0x511f('0x3c')],'exitAt':null}});}})[_0x511f('0x1a')](function(_0x459b99){if(_0x2aab8e){var _0x4bd65b=[];_0x459b99[_0x511f('0x100')](function(_0x2663eb){_0x4bd65b[_0x511f('0x54')](_0x2663eb[_0x511f('0x2f')]({'exitAt':moment()['format'](_0x511f('0x101'))}));});return Promise['all'](_0x4bd65b);}})['then'](function(){if(_0x2aab8e){var _0xf4d2a3=[];var _0x49207c=[];var _0x12d3a0=utils[_0x511f('0x102')]();var _0x135822={'membername':_0x2aab8e[_0x511f('0x3c')],'interface':_0x37cf5c,'enterAt':moment()[_0x511f('0xf5')](_0x511f('0x101')),'role':_0x2aab8e['role'],'internal':_0x2aab8e['internal']};_0x12d3a0[_0x511f('0x100')](function(_0x5a0cf1){_0xf4d2a3[_0x511f('0x54')](_[_0x511f('0xd4')]({'channel':_0x5a0cf1,'type':_0x511f('0x103'),'data1':_0x13dcb9[_0x511f('0x64')]['device'],'data2':_0x37cf5c},_0x135822));if(_0x2aab8e[_0x511f('0xa5')]){_0x49207c['push'](_[_0x511f('0xd4')]({'channel':_0x5a0cf1,'type':_0x511f('0x104'),'data1':_0x511f('0x105')},_0x135822));}});return db['MemberReport'][_0x511f('0x8d')](_0xf4d2a3[_0x511f('0xce')](_0x49207c),{'individualHooks':!![]});}})[_0x511f('0x1a')](function(){if(_0x2aab8e){return _0x2aab8e[_0x511f('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x511f('0xf5')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2aab8e[_0x511f('0xa5')]||![],'mailPause':_0x2aab8e[_0x511f('0xa5')]||![],'chatPause':_0x2aab8e[_0x511f('0xa5')]||![],'faxPause':_0x2aab8e['loginInPause']||![],'smsPause':_0x2aab8e[_0x511f('0xa5')]||![],'openchannelPause':_0x2aab8e[_0x511f('0xa5')]||![],'whatsappPause':_0x2aab8e[_0x511f('0xa5')]||![],'pauseType':_0x2aab8e[_0x511f('0xa5')]?_0x511f('0x105'):null,'interface':_0x37cf5c,'lastPauseAt':moment()[_0x511f('0xf5')](_0x511f('0x101'))});}})[_0x511f('0x1a')](function(_0x56bcb2){if(_0x13dcb9[_0x511f('0x106')]){return _0x4d0c34();}else{return Promise['resolve'](_0x56bcb2)['then'](respondWithResult(_0x42c342,null));}})[_0x511f('0x24')](handleError(_0x42c342,null));};exports['logout']=function(_0x2ae4a3,_0x42ae7b){var _0xf110b5;return db['User'][_0x511f('0x61')]({'where':{'id':_0x2ae4a3[_0x511f('0x65')]['id'],'role':_0x511f('0x86')},'attributes':['id','name','role']})[_0x511f('0x1a')](handleEntityNotFound(_0x42ae7b,null))['then'](function(_0x3c64c5){if(_0x3c64c5){_0xf110b5=_0x3c64c5;return db[_0x511f('0xb1')][_0x511f('0x32')]({'where':{'membername':_0xf110b5[_0x511f('0x3c')]},'individualHooks':!![]});}})[_0x511f('0x1a')](function(){return db['MemberReport'][_0x511f('0x90')]({'where':{'membername':_0xf110b5[_0x511f('0x3c')],'exitAt':null}});})[_0x511f('0x1a')](function(_0x4c918f){var _0x5f1634=[];_0x4c918f[_0x511f('0x100')](function(_0x45469c){_0x5f1634[_0x511f('0x54')](_0x45469c[_0x511f('0x2f')]({'exitAt':moment()[_0x511f('0xf5')](_0x511f('0x101'))}));});return Promise['all'](_0x5f1634);})[_0x511f('0x1a')](function(){return _0xf110b5[_0x511f('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x511f('0x1a')](respondWithResult(_0x42ae7b,null))['catch'](handleError(_0x42ae7b,null));};exports[_0x511f('0x107')]=function(_0x2f99ba,_0xc627d8){var _0x2d35de;return db[_0x511f('0xb1')][_0x511f('0x2f')]({'paused':0x1},{'where':{'UserId':_0x2f99ba[_0x511f('0x65')]['id']},'individualHooks':!![]})[_0x511f('0x1a')](function(){return db['User'][_0x511f('0x61')]({'where':{'id':_0x2f99ba[_0x511f('0x65')]['id'],'role':_0x511f('0x86')},'attributes':['id',_0x511f('0x3c'),'role',_0x511f('0x6e'),'interface',_0x511f('0xa4')]});})[_0x511f('0x1a')](handleEntityNotFound(_0xc627d8,null))[_0x511f('0x1a')](function(_0x58b444){if(_0x58b444){_0x2d35de=_0x58b444;return respondWithRpcPromise(_0x511f('0x108'),_0x511f('0x107'),{'id':_0x2d35de['id'],'name':_0x2d35de[_0x511f('0x3c')],'pause':!![]});}})[_0x511f('0x1a')](function(){if(_0x2d35de){return db[_0x511f('0xff')]['findAll']({'where':{'membername':_0x2d35de[_0x511f('0x3c')],'type':_0x511f('0x104'),'exitAt':null}});}})['then'](function(_0x575eb6){if(_0x575eb6['length']){var _0x280ca0=moment()[_0x511f('0xf5')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4ba6c5=0x0,_0x6b5866=_0x575eb6[_0x511f('0x53')];_0x4ba6c5<_0x6b5866;_0x4ba6c5++){_0x575eb6[_0x4ba6c5][_0x511f('0x109')]({'exitAt':_0x280ca0});}}})[_0x511f('0x1a')](function(){var _0x4538f0=[];var _0x4f3d0b=utils['getChannels']();_0x4f3d0b['forEach'](function(_0x4aa732){_0x4538f0['push']({'channel':_0x4aa732,'membername':_0x2d35de[_0x511f('0x3c')],'interface':_['isNil'](_0x2d35de[_0x511f('0xaf')])?util['format'](_0x511f('0xb0'),_0x2d35de[_0x511f('0x3c')]):_0x2d35de['interface'],'type':_0x511f('0x104'),'enterAt':moment()[_0x511f('0xf5')](_0x511f('0x101')),'data1':_0x2f99ba[_0x511f('0x64')]['type']||'DEFAULT\x20PAUSE','role':_0x2d35de[_0x511f('0x3b')],'internal':_0x2d35de[_0x511f('0x6e')]});});return db['MemberReport'][_0x511f('0x8d')](_0x4538f0,{'individualHooks':!![]});})[_0x511f('0x1a')](function(){return _0x2d35de[_0x511f('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2f99ba['body'][_0x511f('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x511f('0xf5')](_0x511f('0x101'))});})[_0x511f('0x1a')](respondWithResult(_0xc627d8,null))[_0x511f('0x24')](handleError(_0xc627d8,null));};exports[_0x511f('0x10a')]=function(_0x438d16,_0x23311c){if(_0x438d16['body']['channel']&&!utils[_0x511f('0xb3')](_0x438d16[_0x511f('0x64')][_0x511f('0xa3')])){throw new APIBadRequestError(util[_0x511f('0xf5')](_0x511f('0x10b'),_0x438d16[_0x511f('0x64')][_0x511f('0xa3')]));}return db['User']['find']({'where':{'id':_0x438d16[_0x511f('0x65')]['id']},'attributes':['id',_0x511f('0x3c'),_0x511f('0x3b'),_0x511f('0x6e'),_0x511f('0xaf'),_0x511f('0xa4'),_0x511f('0xa6'),_0x511f('0x10c'),_0x511f('0x10d'),_0x511f('0x10e'),_0x511f('0x10f'),_0x511f('0x110'),_0x511f('0x111'),_0x511f('0x112'),_0x511f('0x113')]})[_0x511f('0x1a')](function(_0x305fd4){if(!_0x305fd4){throw new APINotFoundError(util[_0x511f('0xf5')](_0x511f('0x114'),_0x438d16[_0x511f('0x65')]['id']));}return _0x305fd4[_0x511f('0x10a')](_0x438d16[_0x511f('0x64')][_0x511f('0xa3')]);})[_0x511f('0x1a')](respondWithResult(_0x23311c,null))[_0x511f('0x24')](APIHandleError(_0x23311c));};exports[_0x511f('0x115')]=function(_0x5c4862,_0x4543f7){var _0xd17e77={};var _0x153f83={};var _0x3cd8e6;var _0x55a25d;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x5c4862['params']['id']}})[_0x511f('0x1a')](handleEntityNotFound(_0x4543f7,null))[_0x511f('0x1a')](function(_0x2d172b){if(_0x2d172b){_0x3cd8e6=_0x2d172b;_0x153f83['model']=_[_0x511f('0x5c')](db[_0x511f('0x116')]['rawAttributes']);_0x153f83[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x5c4862['query']);_0x153f83[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x153f83[_0x511f('0x5a')],_0x153f83['query']);_0xd17e77['attributes']=_[_0x511f('0x5e')](_0x153f83[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x5c4862['query'][_0x511f('0x5f')]));_0xd17e77['attributes']=_0xd17e77['attributes'][_0x511f('0x53')]?_0xd17e77[_0x511f('0x4f')]:_0x153f83[_0x511f('0x5a')];_0xd17e77[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x5c4862[_0x511f('0x4b')][_0x511f('0xd2')]);_0xd17e77[_0x511f('0x48')]=qs['filters'](_[_0x511f('0xd3')](_0x5c4862[_0x511f('0x4b')],_0x153f83[_0x511f('0x5d')]));if(_0x5c4862[_0x511f('0x4b')][_0x511f('0x44')]){_0xd17e77['where']=_[_0x511f('0xd4')](_0xd17e77['where'],{'$or':_[_0x511f('0x38')](_0xd17e77[_0x511f('0x4f')],function(_0x1dca6a){var _0xbe565b={};_0xbe565b[_0x1dca6a]={'$like':'%'+_0x5c4862['query'][_0x511f('0x44')]+'%'};return _0xbe565b;})});}_0xd17e77=_[_0x511f('0xd4')]({},_0xd17e77,_0x5c4862[_0x511f('0x60')]);return _0x3cd8e6[_0x511f('0x115')](_0xd17e77);}})['then'](function(_0x7a137){if(_0x7a137){_0x55a25d=_0x7a137[_0x511f('0x53')];if(!_0x5c4862[_0x511f('0x4b')]['hasOwnProperty'](_0x511f('0xdb'))){_0xd17e77[_0x511f('0x2b')]=qs['limit'](_0x5c4862[_0x511f('0x4b')][_0x511f('0x2b')]);_0xd17e77[_0x511f('0x29')]=qs['offset'](_0x5c4862[_0x511f('0x4b')][_0x511f('0x29')]);}return _0x3cd8e6['getTeams'](_0xd17e77);}})[_0x511f('0x1a')](function(_0x54d481){if(_0x54d481){return _0x54d481?{'count':_0x55a25d,'rows':_0x54d481}:null;}})['then'](respondWithResult(_0x4543f7,null))['catch'](handleError(_0x4543f7,null));};exports['addTeams']=function(_0x43c905,_0x40008d){var _0x4b5efa=_0x43c905[_0x511f('0x65')]['id'];var _0x3100c8=_0x43c905[_0x511f('0x64')]?_0x43c905['body'][_0x511f('0x68')]:null;var _0xc35a72=[];return Promise[_0x511f('0x117')]()[_0x511f('0x1a')](function(){if(!_0x3100c8)throw new APIBadRequestError(_0x511f('0x118'));})['then'](function(){return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x4b5efa}});})[_0x511f('0x1a')](function(_0xd20341){if(!_0xd20341)throw new APINotFoundError(util[_0x511f('0xf5')](_0x511f('0x114'),_0x43c905[_0x511f('0x65')]['id']));return db[_0x511f('0x71')][_0x511f('0x119')](function(_0x467ec6){return _0xd20341[_0x511f('0x11a')](_0x3100c8,{'transaction':_0x467ec6})[_0x511f('0x1a')](function(){return db['Team'][_0x511f('0x90')]({'where':{'id':{'$in':_0x3100c8}}});})[_0x511f('0x1a')](function(_0x5b6faf){var _0x22dfa1=_[_0x511f('0x38')](_0x5b6faf,function(_0x5d16e8){return _0x5d16e8['getAssociatedQueues']();});return Promise[_0x511f('0x8f')](_0x22dfa1);})['then'](function(_0x5d8755){_0xc35a72=_['flattenDeep'](_0x5d8755);var _0x3573b6=_[_0x511f('0x38')](_0xc35a72,function(_0x59ae2d){return _0x59ae2d['addAgent'](_0xd20341['id'],{'transaction':_0x467ec6});});return Promise['all'](_0x3573b6);})[_0x511f('0x1a')](function(){if(!_0xd20341['online'])return;var _0x44b094=_[_0x511f('0x44')](_0xc35a72,function(_0x519dcb){return _0x519dcb[_0x511f('0x11b')](_0x511f('0xa3'))===_0x511f('0x11c');});var _0x8fb128=_[_0x511f('0x38')](_0x44b094,function(_0x52593e){return db[_0x511f('0xb1')][_0x511f('0xb2')]({'membername':_0xd20341[_0x511f('0x3c')],'UserId':_0xd20341['id'],'queue_name':_0x52593e[_0x511f('0x3c')],'VoiceQueueId':_0x52593e['id'],'interface':_['isNil'](_0xd20341['interface'])?util[_0x511f('0xf5')](_0x511f('0xb0'),_0xd20341[_0x511f('0x3c')]):_0xd20341['interface'],'paused':_0xd20341[_0x511f('0xa6')]||![],'penalty':_0xd20341[_0x511f('0xaa')]},{'transaction':_0x467ec6});});return Promise[_0x511f('0x8f')](_0x8fb128);})[_0x511f('0x1a')](function(){return db[_0x511f('0x11d')][_0x511f('0x90')]({'where':{'teamId':{'$in':_0x3100c8}}});})[_0x511f('0x1a')](function(_0x4ef922){var _0x480dae=_[_0x511f('0x38')](_0x4ef922,function(_0x454139){return db[_0x511f('0x11e')][_0x511f('0x8b')]({'UserId':_0xd20341['id'],'VoicePrefixId':_0x454139[_0x511f('0x11f')]},{'transaction':_0x467ec6});});return Promise[_0x511f('0x8f')](_0x480dae);});});})['then'](function(){for(var _0x486ea0=0x0;_0x486ea0<_0xc35a72['length'];_0x486ea0++){var _0x2b8be3=_0xc35a72[_0x486ea0]['getDataValue'](_0x511f('0xa3'));var _0x21d035=_0x2b8be3+_0x511f('0xb6');socket['emit']('user'+_0x2b8be3+_0x511f('0xac'),{'UserId':_0x4b5efa,['queueField']:_0xc35a72[_0x486ea0]['id']});}})[_0x511f('0x1a')](respondWithStatusCode(_0x40008d,null))[_0x511f('0x24')](APIHandleError(_0x40008d));};exports[_0x511f('0x120')]=function(_0x56f0ac,_0x56cf25){var _0x4f7ad6=_0x56f0ac[_0x511f('0x65')]['id'];var _0x2b26b9=null;if(_0x56f0ac[_0x511f('0x4b')][_0x511f('0x68')]){_0x2b26b9=_['isArray'](_0x56f0ac[_0x511f('0x4b')][_0x511f('0x68')])?_0x56f0ac['query'][_0x511f('0x68')]:[_0x56f0ac[_0x511f('0x4b')]['ids']];}var _0x1d192e=[];return Promise[_0x511f('0x117')]()[_0x511f('0x1a')](function(){if(!_0x2b26b9)throw new APIBadRequestError(_0x511f('0x121'));})[_0x511f('0x1a')](function(){return db['User'][_0x511f('0x9d')]({'where':{'id':_0x4f7ad6}});})['then'](function(_0x46abd6){if(!_0x46abd6)throw new APINotFoundError(util[_0x511f('0xf5')](_0x511f('0x114'),_0x56f0ac[_0x511f('0x65')]['id']));return db[_0x511f('0x71')][_0x511f('0x119')](function(_0x3830e6){return _0x46abd6[_0x511f('0x120')](_0x2b26b9,{'transaction':_0x3830e6})['then'](function(){return db[_0x511f('0x116')]['findAll']({'where':{'id':{'$in':_0x2b26b9}}});})[_0x511f('0x1a')](function(_0x3f169a){var _0x13ca09=_[_0x511f('0x38')](_0x3f169a,function(_0x321cdb){return _0x321cdb['getAssociatedQueues']();});return Promise['all'](_0x13ca09);})[_0x511f('0x1a')](function(_0x13fee5){_0x1d192e=_['flattenDeep'](_0x13fee5);var _0x8bb9b0=_[_0x511f('0x38')](_0x1d192e,function(_0x1b866d){return _0x1b866d[_0x511f('0x122')](_0x46abd6['id'],{'transaction':_0x3830e6});});return Promise[_0x511f('0x8f')](_0x8bb9b0);})[_0x511f('0x1a')](function(){if(!_0x46abd6[_0x511f('0xa4')])return;var _0x51aa4c=_[_0x511f('0x44')](_0x1d192e,function(_0x50cc4f){return _0x50cc4f['getDataValue'](_0x511f('0xa3'))==='Voice';});var _0x45557c=_[_0x511f('0x38')](_0x51aa4c,function(_0xc49dd){return db[_0x511f('0xb1')][_0x511f('0x32')]({'where':{'VoiceQueueId':_0xc49dd['id'],'UserId':_0x46abd6['id']},'transaction':_0x3830e6});});return Promise[_0x511f('0x8f')](_0x45557c);})[_0x511f('0x1a')](function(){return db[_0x511f('0x11d')][_0x511f('0x90')]({'where':{'teamId':{'$in':_0x2b26b9}}});})[_0x511f('0x1a')](function(_0x5d7f7f){var _0x16fb10=_[_0x511f('0x38')](_0x5d7f7f,function(_0x4fcef6){return db[_0x511f('0x11e')]['destroy']({'where':{'UserId':_0x46abd6['id'],'VoicePrefixId':_0x4fcef6[_0x511f('0x11f')]}},{'transaction':_0x3830e6});});return Promise['all'](_0x16fb10);});});})['then'](function(){for(var _0x5da2ac=0x0;_0x5da2ac<_0x1d192e[_0x511f('0x53')];_0x5da2ac++){var _0x478c08=_0x1d192e[_0x5da2ac]['getDataValue'](_0x511f('0xa3'));var _0xdd9539=_0x478c08+'QueueId';socket['emit'](_0x511f('0x34')+_0x478c08+_0x511f('0xb7'),{'UserId':_0x4f7ad6,['queueField']:_0x1d192e[_0x5da2ac]['id']});}})[_0x511f('0x1a')](respondWithStatusCode(_0x56cf25,null))[_0x511f('0x24')](APIHandleError(_0x56cf25));};exports[_0x511f('0x123')]=function(_0x51f2b5,_0x203614){var _0x642aee={};var _0x4353ae={};var _0x28552c;var _0xa1a67f;return db[_0x511f('0x49')]['findOne']({'where':{'id':_0x51f2b5[_0x511f('0x65')]['id']}})['then'](handleEntityNotFound(_0x203614,null))[_0x511f('0x1a')](function(_0x80a35f){if(_0x80a35f){_0x28552c=_0x80a35f;_0x4353ae['model']=_[_0x511f('0x5c')](db[_0x511f('0xd6')]['rawAttributes']);_0x4353ae[_0x511f('0x4b')]=_[_0x511f('0x5c')](_0x51f2b5['query']);_0x4353ae[_0x511f('0x5d')]=_[_0x511f('0x5e')](_0x4353ae[_0x511f('0x5a')],_0x4353ae[_0x511f('0x4b')]);_0x642aee[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x4353ae[_0x511f('0x5a')],qs['fields'](_0x51f2b5[_0x511f('0x4b')][_0x511f('0x5f')]));_0x642aee[_0x511f('0x4f')]=_0x642aee[_0x511f('0x4f')][_0x511f('0x53')]?_0x642aee['attributes']:_0x4353ae['model'];_0x642aee[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x51f2b5[_0x511f('0x4b')][_0x511f('0xd2')]);_0x642aee['where']=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x51f2b5['query'],_0x4353ae[_0x511f('0x5d')]));if(_0x51f2b5['query'][_0x511f('0x44')]){_0x642aee[_0x511f('0x48')]=_[_0x511f('0xd4')](_0x642aee[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0x642aee[_0x511f('0x4f')],function(_0x552ba3){var _0x2370ea={};_0x2370ea[_0x552ba3]={'$like':'%'+_0x51f2b5[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x2370ea;})});}_0x642aee=_[_0x511f('0xd4')]({},_0x642aee,_0x51f2b5[_0x511f('0x60')]);return _0x28552c[_0x511f('0x123')](_0x642aee);}})['then'](function(_0x3191a4){if(_0x3191a4){_0xa1a67f=_0x3191a4['length'];if(!_0x51f2b5[_0x511f('0x4b')][_0x511f('0xd5')](_0x511f('0xdb'))){_0x642aee['limit']=qs[_0x511f('0x2b')](_0x51f2b5[_0x511f('0x4b')][_0x511f('0x2b')]);_0x642aee[_0x511f('0x29')]=qs[_0x511f('0x29')](_0x51f2b5[_0x511f('0x4b')]['offset']);}return _0x28552c[_0x511f('0x123')](_0x642aee);}})[_0x511f('0x1a')](function(_0x711f0f){if(_0x711f0f){return _0x711f0f?{'count':_0xa1a67f,'rows':_0x711f0f}:null;}})[_0x511f('0x1a')](respondWithResult(_0x203614,null))['catch'](handleError(_0x203614,null));};exports['getAgents']=function(_0x5dc2e5,_0x43f224){var _0x337d59={};var _0x2d77c0={};var _0x967e9e;return db[_0x511f('0x49')][_0x511f('0x9d')]({'where':{'id':_0x5dc2e5[_0x511f('0x65')]['id']}})['then'](handleEntityNotFound(_0x43f224,null))['then'](function(_0x12a2f1){if(_0x12a2f1){_0x967e9e=_0x12a2f1;_0x2d77c0[_0x511f('0x5a')]=_['keys'](db[_0x511f('0x49')]['rawAttributes']);_0x2d77c0['query']=_['keys'](_0x5dc2e5['query']);_0x2d77c0[_0x511f('0x5d')]=_['intersection'](_0x2d77c0[_0x511f('0x5a')],_0x2d77c0[_0x511f('0x4b')]);_0x337d59[_0x511f('0x4f')]=_[_0x511f('0x5e')](_0x2d77c0[_0x511f('0x5a')],qs[_0x511f('0x5f')](_0x5dc2e5[_0x511f('0x4b')][_0x511f('0x5f')]));_0x337d59[_0x511f('0x4f')]=_0x337d59['attributes'][_0x511f('0x53')]?_0x337d59[_0x511f('0x4f')]:_0x2d77c0[_0x511f('0x5a')];_0x337d59[_0x511f('0xd1')]=qs[_0x511f('0xd2')](_0x5dc2e5['query']['sort']);_0x337d59[_0x511f('0x48')]=qs[_0x511f('0x5d')](_[_0x511f('0xd3')](_0x5dc2e5[_0x511f('0x4b')],_0x2d77c0[_0x511f('0x5d')]));if(_0x5dc2e5[_0x511f('0x4b')][_0x511f('0x44')]){_0x337d59['where']=_[_0x511f('0xd4')](_0x337d59[_0x511f('0x48')],{'$or':_[_0x511f('0x38')](_0x337d59[_0x511f('0x4f')],function(_0x55d2e1){var _0x1c1b48={};_0x1c1b48[_0x55d2e1]={'$like':'%'+_0x5dc2e5[_0x511f('0x4b')][_0x511f('0x44')]+'%'};return _0x1c1b48;})});}_0x337d59['model']=db[_0x511f('0x49')];_0x337d59['as']=_0x511f('0x93');_0x337d59=_[_0x511f('0xd4')]({},_0x337d59,_0x5dc2e5[_0x511f('0x60')]);return _0x967e9e[_0x511f('0xfe')]({'include':[_0x337d59]});}})[_0x511f('0x1a')](function(_0x1a24f1){if(_0x1a24f1){var _0x1edd0a={},_0x48765d=[];for(var _0x3a3067=0x0;_0x3a3067<_0x1a24f1[_0x511f('0x53')];_0x3a3067+=0x1){for(var _0x1fa2d1=0x0,_0x206bbf;_0x1fa2d1<_0x1a24f1[_0x3a3067][_0x511f('0x93')][_0x511f('0x53')];_0x1fa2d1+=0x1){_0x206bbf=_0x1a24f1[_0x3a3067][_0x511f('0x93')][_0x1fa2d1]['get']({'plain':!![]});_0x1edd0a[_0x206bbf['id']]=_0x206bbf;}}_0x1edd0a=_[_0x511f('0x124')](_0x1edd0a);for(var _0x1a053f=qs[_0x511f('0x29')](_0x5dc2e5[_0x511f('0x4b')][_0x511f('0x29')]);_0x1a053f<_0x1edd0a['length']&&_0x48765d[_0x511f('0x53')]=_0x4906c3[_0x5b2c('0x4c')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5b2c('0x1e')](function(){if(_0x5b6d18){return db[_0x5b2c('0x24')][_0x5b2c('0x43')]({'where':{'membername':_0x5b6d18[_0x5b2c('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x5b6d18){return _0x5b6d18[_0x5b2c('0x4d')]({'raw':!![]});}})[_0x5b2c('0x1e')](function(_0x4e809b){if(_0x5b6d18){if(_0x4e809b){var _0x477c0d=[];_0x1a42aa=_0x4e809b;if(_0x1a42aa[_0x5b2c('0x29')]){for(var _0x104718=0x0;_0x104718<_0x1a42aa[_0x5b2c('0x29')];_0x104718++){_0x477c0d[_0x5b2c('0x4e')](db[_0x5b2c('0x24')][_0x5b2c('0x4f')]({'membername':_0x5b6d18['name'],'UserId':_0x5b6d18['id'],'queue_name':_0x1a42aa[_0x104718][_0x5b2c('0x27')],'VoiceQueueId':_0x1a42aa[_0x104718]['id'],'interface':_0x132c36,'paused':_0x5b6d18[_0x5b2c('0x48')]||![],'penalty':_0x1a42aa[_0x104718]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x5b2c('0x44')](_0x477c0d);}}}})['then'](function(){if(_0x5b6d18){return db['MemberReport'][_0x5b2c('0xd')]({'where':{'membername':_0x5b6d18[_0x5b2c('0x27')],'exitAt':null}});}})[_0x5b2c('0x1e')](function(_0xeb487a){if(_0x5b6d18){if(_0xeb487a&&_0xeb487a[_0x5b2c('0x29')]){var _0x50b756=[];_0xeb487a['forEach'](function(_0x5e2544){_0x50b756[_0x5b2c('0x4e')](_0x5e2544[_0x5b2c('0x25')]({'exitAt':moment()[_0x5b2c('0x2a')](_0x5b2c('0x2b'))}));});return BPromise['all'](_0x50b756);}}})['then'](function(){if(_0x5b6d18){var _0x2e66ce=[];var _0x47ce6a=[];var _0x484c04=utils['getChannels']();var _0x4d7c5d={'membername':_0x5b6d18[_0x5b2c('0x27')],'interface':_0x132c36,'enterAt':moment()[_0x5b2c('0x2a')](_0x5b2c('0x2b')),'role':_0x5b6d18['role'],'internal':_0x5b6d18['internal']};_0x484c04[_0x5b2c('0x2c')](function(_0x2fcc5f){_0x2e66ce[_0x5b2c('0x4e')](_[_0x5b2c('0x50')]({'channel':_0x2fcc5f,'type':_0x5b2c('0x51'),'data1':'callysquare','data2':_0x132c36},_0x4d7c5d));if(_0x5b6d18[_0x5b2c('0x48')]){_0x47ce6a[_0x5b2c('0x4e')](_[_0x5b2c('0x50')]({'channel':_0x2fcc5f,'type':_0x5b2c('0x28'),'data1':_0x5b2c('0x52')},_0x4d7c5d));}});return db[_0x5b2c('0x26')]['bulkCreate'](_0x2e66ce[_0x5b2c('0x53')](_0x47ce6a),{'individualHooks':!![]});}})['then'](function(){if(_0x5b6d18){return _0x5b6d18[_0x5b2c('0x25')]({'online':!![],'lastLoginAt':moment()[_0x5b2c('0x2a')](_0x5b2c('0x2b')),'voicePause':_0x5b6d18[_0x5b2c('0x48')]||![],'mailPause':_0x5b6d18[_0x5b2c('0x48')]||![],'chatPause':_0x5b6d18[_0x5b2c('0x48')]||![],'faxPause':_0x5b6d18[_0x5b2c('0x48')]||![],'smsPause':_0x5b6d18[_0x5b2c('0x48')]||![],'openchannelPause':_0x5b6d18[_0x5b2c('0x48')]||![],'pauseType':_0x5b6d18[_0x5b2c('0x48')]?_0x5b2c('0x52'):null,'lastPauseAt':moment()[_0x5b2c('0x2a')](_0x5b2c('0x2b')),'interface':_0x132c36});}})[_0x5b2c('0x1e')](function(_0x117451){_0x485ee9(_0x117451);})[_0x5b2c('0x18')](function(_0x8725d8){_0x5c4605(_0x32a811[_0x5b2c('0x1a')](0x1f4,_0x8725d8['message']));});});}; \ No newline at end of file +var _0xbaa5=['debug','catch','error','message','ShowUser','find','where','stringify','PauseUser','name','role','internal','update','MemberReport','PAUSE','length','format','updateAttributes','getChannels','forEach','isNil','SIP/%s','interface','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','destroy','all','LoginUser','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt','getVoiceQueues','push','upsert','UserVoiceQueue.penalty','merge','LOGIN','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','include','map','attributes','model','then','info'];(function(_0x52799d,_0x238858){var _0x1f2d3c=function(_0x362dfd){while(--_0x362dfd){_0x52799d['push'](_0x52799d['shift']());}};_0x1f2d3c(++_0x238858);}(_0xbaa5,0x96));var _0x5baa=function(_0x37a07f,_0x16a2c8){_0x37a07f=_0x37a07f-0x0;var _0x139913=_0xbaa5[_0x37a07f];return _0x139913;};'use strict';var _=require(_0x5baa('0x0'));var util=require(_0x5baa('0x1'));var moment=require(_0x5baa('0x2'));var BPromise=require(_0x5baa('0x3'));var Redis=require(_0x5baa('0x4'));var db=require(_0x5baa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5baa('0x6'));config['redis']=_[_0x5baa('0x7')](config[_0x5baa('0x8')],{'host':_0x5baa('0x9'),'port':0x18eb});var socket=require(_0x5baa('0xa'))(new Redis(config[_0x5baa('0x8')]));require(_0x5baa('0xb'))[_0x5baa('0xc')](socket);exports[_0x5baa('0xd')]=function(_0x3b689b){var _0x12cc51=this;return new Promise(function(_0x1af254,_0xb8b33f){return db[_0x5baa('0xe')][_0x5baa('0xf')]({'raw':_0x3b689b[_0x5baa('0x10')]?_0x3b689b[_0x5baa('0x10')][_0x5baa('0x11')]===undefined?!![]:![]:!![],'where':_0x3b689b['options']?_0x3b689b[_0x5baa('0x10')]['where']||null:null,'attributes':_0x3b689b['options']?_0x3b689b['options']['attributes']||null:null,'limit':_0x3b689b['options']?_0x3b689b[_0x5baa('0x10')]['limit']||null:null,'include':_0x3b689b['options']?_0x3b689b['options'][_0x5baa('0x12')]?_[_0x5baa('0x13')](_0x3b689b[_0x5baa('0x10')][_0x5baa('0x12')],function(_0x4d935e){return{'model':db[_0x4d935e['model']],'as':_0x4d935e['as'],'attributes':_0x4d935e['attributes'],'include':_0x4d935e[_0x5baa('0x12')]?_[_0x5baa('0x13')](_0x4d935e[_0x5baa('0x12')],function(_0x15366f){return{'model':db[_0x15366f['model']],'as':_0x15366f['as'],'attributes':_0x15366f[_0x5baa('0x14')],'include':_0x15366f[_0x5baa('0x12')]?_[_0x5baa('0x13')](_0x15366f['include'],function(_0x28d61e){return{'model':db[_0x28d61e[_0x5baa('0x15')]],'as':_0x28d61e['as'],'attributes':_0x28d61e[_0x5baa('0x14')]};}):[]};}):[]};}):[]:[]})[_0x5baa('0x16')](function(_0xe76d5f){logger[_0x5baa('0x17')]('GetUser',_0x3b689b);logger[_0x5baa('0x18')](_0x5baa('0xd'),_0x3b689b,JSON['stringify'](_0xe76d5f));_0x1af254(_0xe76d5f);})[_0x5baa('0x19')](function(_0x30a741){logger[_0x5baa('0x1a')](_0x5baa('0xd'),_0x30a741[_0x5baa('0x1b')],_0x3b689b);_0xb8b33f(_0x12cc51[_0x5baa('0x1a')](0x1f4,_0x30a741[_0x5baa('0x1b')]));});});};exports[_0x5baa('0x1c')]=function(_0x11f106){var _0x28468c=this;return new Promise(function(_0x43e9ad,_0x206c39){return db[_0x5baa('0xe')][_0x5baa('0x1d')]({'raw':_0x11f106[_0x5baa('0x10')]?_0x11f106['options'][_0x5baa('0x11')]===undefined?!![]:![]:!![],'where':_0x11f106[_0x5baa('0x10')]?_0x11f106[_0x5baa('0x10')][_0x5baa('0x1e')]||null:null,'attributes':_0x11f106['options']?_0x11f106[_0x5baa('0x10')][_0x5baa('0x14')]||null:null,'include':_0x11f106[_0x5baa('0x10')]?_0x11f106[_0x5baa('0x10')]['include']?_[_0x5baa('0x13')](_0x11f106[_0x5baa('0x10')][_0x5baa('0x12')],function(_0x508c3a){return{'model':db[_0x508c3a[_0x5baa('0x15')]],'as':_0x508c3a['as'],'attributes':_0x508c3a[_0x5baa('0x14')],'include':_0x508c3a[_0x5baa('0x12')]?_[_0x5baa('0x13')](_0x508c3a[_0x5baa('0x12')],function(_0x29d076){return{'model':db[_0x29d076[_0x5baa('0x15')]],'as':_0x29d076['as'],'attributes':_0x29d076['attributes'],'include':_0x29d076['include']?_[_0x5baa('0x13')](_0x29d076['include'],function(_0x5aff97){return{'model':db[_0x5aff97[_0x5baa('0x15')]],'as':_0x5aff97['as'],'attributes':_0x5aff97['attributes']};}):[]};}):[]};}):[]:[]})[_0x5baa('0x16')](function(_0x56fe63){logger[_0x5baa('0x17')](_0x5baa('0x1c'),_0x11f106);logger[_0x5baa('0x18')](_0x5baa('0x1c'),_0x11f106,JSON[_0x5baa('0x1f')](_0x56fe63));_0x43e9ad(_0x56fe63);})[_0x5baa('0x19')](function(_0xb51e26){logger[_0x5baa('0x1a')](_0x5baa('0x1c'),_0xb51e26[_0x5baa('0x1b')],_0x11f106);_0x206c39(_0x28468c[_0x5baa('0x1a')](0x1f4,_0xb51e26[_0x5baa('0x1b')]));});});};exports[_0x5baa('0x20')]=function(_0x4e760a){var _0x271aae=this;return new Promise(function(_0x4f3b4e,_0x468c8a){var _0x4a709b;return db[_0x5baa('0xe')]['find']({'where':_0x4e760a[_0x5baa('0x10')][_0x5baa('0x1e')]||{},'attributes':['id',_0x5baa('0x21'),_0x5baa('0x22'),_0x5baa('0x23'),'interface']})[_0x5baa('0x16')](function(_0x5e55c4){if(_0x5e55c4){_0x4a709b=_0x5e55c4;return db['UserVoiceQueueRt'][_0x5baa('0x24')]({'paused':0x1},{'where':{'UserId':_0x4a709b['id']},'individualHooks':!![]});}})[_0x5baa('0x16')](function(){if(_0x4a709b){return db[_0x5baa('0x25')]['findAll']({'where':{'membername':_0x4a709b[_0x5baa('0x21')],'type':_0x5baa('0x26'),'exitAt':null}});}})[_0x5baa('0x16')](function(_0x33c3bf){if(_0x4a709b){if(_0x33c3bf&&_0x33c3bf[_0x5baa('0x27')]){var _0x5966ba=moment()[_0x5baa('0x28')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47dc6f=0x0,_0x26b58a=_0x33c3bf[_0x5baa('0x27')];_0x47dc6f<_0x26b58a;_0x47dc6f++){_0x33c3bf[_0x47dc6f][_0x5baa('0x29')]({'exitAt':_0x5966ba});}}}})[_0x5baa('0x16')](function(){if(_0x4a709b){var _0x128ec7=[];var _0x26c089=utils[_0x5baa('0x2a')]();_0x26c089[_0x5baa('0x2b')](function(_0x675756){_0x128ec7['push']({'channel':_0x675756,'membername':_0x4a709b[_0x5baa('0x21')],'interface':_[_0x5baa('0x2c')](_0x4a709b['interface'])?util[_0x5baa('0x28')](_0x5baa('0x2d'),_0x4a709b[_0x5baa('0x21')]):_0x4a709b[_0x5baa('0x2e')],'type':_0x5baa('0x26'),'enterAt':moment()[_0x5baa('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4e760a[_0x5baa('0x2f')][_0x5baa('0x30')]||'DEFAULT\x20PAUSE','role':_0x4a709b[_0x5baa('0x22')],'internal':_0x4a709b[_0x5baa('0x23')],'uniqueid':_0x4e760a['body'][_0x5baa('0x31')]||null});});return db['MemberReport'][_0x5baa('0x32')](_0x128ec7,{'individualHooks':!![]});}})[_0x5baa('0x16')](function(){if(_0x4a709b){return _0x4a709b[_0x5baa('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4e760a['body'][_0x5baa('0x30')]||_0x5baa('0x33'),'lastPauseAt':moment()[_0x5baa('0x28')](_0x5baa('0x34'))});}})[_0x5baa('0x16')](function(_0x5cf963){_0x4f3b4e(_0x5cf963);})['catch'](function(_0x28ab3b){_0x468c8a(_0x271aae[_0x5baa('0x1a')](0x1f4,_0x28ab3b[_0x5baa('0x1b')]));});});};exports[_0x5baa('0x35')]=function(_0x1f91a3){var _0x575dba=this;return new Promise(function(_0x3fa373,_0x12afd3){if(_0x1f91a3[_0x5baa('0x2f')][_0x5baa('0x36')]&&!utils['isValidChannel'](_0x1f91a3['body'][_0x5baa('0x36')])){throw new Error(util[_0x5baa('0x28')](_0x5baa('0x37'),_0x1f91a3['body'][_0x5baa('0x36')]));}return db[_0x5baa('0xe')][_0x5baa('0x38')]({'where':_0x1f91a3[_0x5baa('0x10')]['where']||{},'attributes':['id','name',_0x5baa('0x22'),_0x5baa('0x23'),_0x5baa('0x2e'),'online',_0x5baa('0x39'),'mailPause','chatPause',_0x5baa('0x3a'),_0x5baa('0x3b'),'smsPause',_0x5baa('0x3c'),_0x5baa('0x3d'),_0x5baa('0x3e')]})[_0x5baa('0x16')](function(_0x1d74de){if(!_0x1d74de){throw new Error(util[_0x5baa('0x28')](_0x5baa('0x3f'),_0x1f91a3['params']['id']));}return _0x1d74de[_0x5baa('0x40')](_0x1f91a3[_0x5baa('0x2f')][_0x5baa('0x36')],_0x5baa('0x41'));})['then'](function(_0xe4bd7d){_0x3fa373(_0xe4bd7d);})[_0x5baa('0x19')](function(_0x253c58){_0x12afd3(_0x575dba[_0x5baa('0x1a')](0x1f4,_0x253c58[_0x5baa('0x1b')]));});});};exports[_0x5baa('0x42')]=function(_0x3e9fcf){var _0x38e884=this;return new Promise(function(_0x454de3,_0x14de56){var _0x34d826;return db['User'][_0x5baa('0x38')]({'where':_0x3e9fcf[_0x5baa('0x10')][_0x5baa('0x1e')]||{},'attributes':['id',_0x5baa('0x21')]})[_0x5baa('0x16')](function(_0x1d2b63){if(_0x1d2b63){_0x34d826=_0x1d2b63;return db['UserVoiceQueueRt'][_0x5baa('0x43')]({'where':{'membername':_0x34d826[_0x5baa('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x34d826){return db[_0x5baa('0x25')][_0x5baa('0xf')]({'where':{'membername':_0x34d826['name'],'exitAt':null}});}})[_0x5baa('0x16')](function(_0xf5bb98){if(_0x34d826){if(_0xf5bb98&&_0xf5bb98['length']){var _0x1493c2=[];_0xf5bb98[_0x5baa('0x2b')](function(_0x4e3abc){_0x1493c2['push'](_0x4e3abc[_0x5baa('0x24')]({'exitAt':moment()['format'](_0x5baa('0x34'))}));});return BPromise[_0x5baa('0x44')](_0x1493c2);}}})[_0x5baa('0x16')](function(){if(_0x34d826){return _0x34d826[_0x5baa('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5baa('0x16')](function(_0x1f4d72){_0x454de3(_0x1f4d72);})[_0x5baa('0x19')](function(_0x10b98f){_0x14de56(_0x38e884[_0x5baa('0x1a')](0x1f4,_0x10b98f[_0x5baa('0x1b')]));});});};exports[_0x5baa('0x45')]=function(_0x5cb8fb){var _0x2388a7=this;return new Promise(function(_0x4841ca,_0x180380){var _0x337b47;var _0x8805ac;var _0x4a93bf;var _0x51e3b5;return db[_0x5baa('0xe')][_0x5baa('0x38')]({'where':_0x5cb8fb[_0x5baa('0x10')][_0x5baa('0x1e')]||{},'attributes':['id',_0x5baa('0x21'),_0x5baa('0x22'),'mobile',_0x5baa('0x46'),_0x5baa('0x23'),_0x5baa('0x47'),_0x5baa('0x2e')]})[_0x5baa('0x16')](function(_0x3dd605){if(_0x3dd605){_0x337b47=_0x3dd605;_0x51e3b5=_0x5cb8fb[_0x5baa('0x2f')][_0x5baa('0x2e')]?_0x5cb8fb[_0x5baa('0x2f')]['interface']:util[_0x5baa('0x28')](_0x5baa('0x2d'),_0x337b47[_0x5baa('0x21')]);return db[_0x5baa('0xe')][_0x5baa('0x48')]({'where':{'role':_0x5baa('0x49'),'online':!![],'id':{'$ne':_0x337b47['id']}}});}})[_0x5baa('0x16')](function(_0x1db2b2){if(_0x1db2b2){_0x4a93bf=_0x1db2b2;return require(_0x5baa('0x4a'))[_0x5baa('0x4b')]();}})[_0x5baa('0x16')](function(_0x36de08){if(_0x36de08&&_0x36de08[_0x5baa('0x4c')]&&_0x4a93bf>=_0x36de08['agents']){throw new Error(_0x5baa('0x4d'));}})[_0x5baa('0x16')](function(){if(_0x337b47){return db[_0x5baa('0x4e')][_0x5baa('0x43')]({'where':{'membername':_0x337b47[_0x5baa('0x21')]},'individualHooks':!![]});}})[_0x5baa('0x16')](function(){if(_0x337b47){return _0x337b47[_0x5baa('0x4f')]({'raw':!![]});}})[_0x5baa('0x16')](function(_0x27437a){if(_0x337b47){if(_0x27437a){var _0x3e994c=[];_0x8805ac=_0x27437a;if(_0x8805ac[_0x5baa('0x27')]){for(var _0x5c31c3=0x0;_0x5c31c3<_0x8805ac['length'];_0x5c31c3++){_0x3e994c[_0x5baa('0x50')](db['UserVoiceQueueRt'][_0x5baa('0x51')]({'membername':_0x337b47[_0x5baa('0x21')],'UserId':_0x337b47['id'],'queue_name':_0x8805ac[_0x5c31c3]['name'],'VoiceQueueId':_0x8805ac[_0x5c31c3]['id'],'interface':_0x51e3b5,'paused':_0x337b47[_0x5baa('0x47')]||![],'penalty':_0x8805ac[_0x5c31c3][_0x5baa('0x52')]||0x0}));}return BPromise[_0x5baa('0x44')](_0x3e994c);}}}})[_0x5baa('0x16')](function(){if(_0x337b47){return db[_0x5baa('0x25')]['findAll']({'where':{'membername':_0x337b47['name'],'exitAt':null}});}})[_0x5baa('0x16')](function(_0x5f1017){if(_0x337b47){if(_0x5f1017&&_0x5f1017[_0x5baa('0x27')]){var _0x39b9b4=[];_0x5f1017[_0x5baa('0x2b')](function(_0xbad171){_0x39b9b4[_0x5baa('0x50')](_0xbad171['update']({'exitAt':moment()['format'](_0x5baa('0x34'))}));});return BPromise[_0x5baa('0x44')](_0x39b9b4);}}})['then'](function(){if(_0x337b47){var _0x247552=[];var _0x359beb=[];var _0x548734=utils['getChannels']();var _0xe09d0f={'membername':_0x337b47[_0x5baa('0x21')],'interface':_0x51e3b5,'enterAt':moment()[_0x5baa('0x28')](_0x5baa('0x34')),'role':_0x337b47[_0x5baa('0x22')],'internal':_0x337b47[_0x5baa('0x23')]};_0x548734['forEach'](function(_0x54aa92){_0x247552[_0x5baa('0x50')](_[_0x5baa('0x53')]({'channel':_0x54aa92,'type':_0x5baa('0x54'),'data1':'callysquare','data2':_0x51e3b5},_0xe09d0f));if(_0x337b47[_0x5baa('0x47')]){_0x359beb[_0x5baa('0x50')](_[_0x5baa('0x53')]({'channel':_0x54aa92,'type':_0x5baa('0x26'),'data1':'LOGININPAUSE'},_0xe09d0f));}});return db[_0x5baa('0x25')][_0x5baa('0x32')](_0x247552[_0x5baa('0x55')](_0x359beb),{'individualHooks':!![]});}})[_0x5baa('0x16')](function(){if(_0x337b47){return _0x337b47[_0x5baa('0x24')]({'online':!![],'lastLoginAt':moment()[_0x5baa('0x28')](_0x5baa('0x34')),'voicePause':_0x337b47['loginInPause']||![],'mailPause':_0x337b47[_0x5baa('0x47')]||![],'chatPause':_0x337b47[_0x5baa('0x47')]||![],'faxPause':_0x337b47[_0x5baa('0x47')]||![],'smsPause':_0x337b47[_0x5baa('0x47')]||![],'openchannelPause':_0x337b47[_0x5baa('0x47')]||![],'pauseType':_0x337b47[_0x5baa('0x47')]?_0x5baa('0x56'):null,'lastPauseAt':moment()[_0x5baa('0x28')](_0x5baa('0x34')),'interface':_0x51e3b5});}})[_0x5baa('0x16')](function(_0x2a33c2){_0x4841ca(_0x2a33c2);})['catch'](function(_0x48bd36){_0x180380(_0x2388a7['error'](0x1f4,_0x48bd36[_0x5baa('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f9732ff..13835f4 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 _0x7ebd=['user:','./user.events','remove','update','length'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x7ebd,0xd8));var _0xd7eb=function(_0x952a2f,_0x50f186){_0x952a2f=_0x952a2f-0x0;var _0x4d1add=_0x7ebd[_0x952a2f];return _0x4d1add;};'use strict';var UserEvents=require(_0xd7eb('0x0'));var events=['save',_0xd7eb('0x1'),_0xd7eb('0x2')];function createListener(_0x1db6a7,_0x5b079d){return function(_0x27d03f){_0x5b079d['emit'](_0x1db6a7,_0x27d03f);};}function removeListener(_0x407b9d,_0x3a491d){return function(){UserEvents['removeListener'](_0x407b9d,_0x3a491d);};}exports['register']=function(_0x87faf6){for(var _0x5e4e1d=0x0,_0x178ade=events[_0xd7eb('0x3')];_0x5e4e1d<_0x178ade;_0x5e4e1d++){var _0x30e997=events[_0x5e4e1d];var _0x2efe69=createListener(_0xd7eb('0x4')+_0x30e997,_0x87faf6);UserEvents['on'](_0x30e997,_0x2efe69);}}; \ No newline at end of file +var _0x5deb=['update','emit','removeListener','register','user:','./user.events','remove'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0x5deb,0x9f));var _0xb5de=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x5deb[_0x25b4a4];return _0x707267;};'use strict';var UserEvents=require(_0xb5de('0x0'));var events=['save',_0xb5de('0x1'),_0xb5de('0x2')];function createListener(_0x1e9d05,_0x1fafaa){return function(_0x42744f){_0x1fafaa[_0xb5de('0x3')](_0x1e9d05,_0x42744f);};}function removeListener(_0x366a58,_0x78939b){return function(){UserEvents[_0xb5de('0x4')](_0x366a58,_0x78939b);};}exports[_0xb5de('0x5')]=function(_0x372a43){for(var _0x3038e0=0x0,_0x1f2f42=events['length'];_0x3038e0<_0x1f2f42;_0x3038e0++){var _0x37d9ba=events[_0x3038e0];var _0x3b769b=createListener(_0xb5de('0x6')+_0x37d9ba,_0x372a43);UserEvents['on'](_0x37d9ba,_0x3b769b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 852fb06..35d6ce9 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x371d2c,_0x52347e){var _0x109892=function(_0x36c169){while(--_0x36c169){_0x371d2c['push'](_0x371d2c['shift']());}};_0x109892(++_0x52347e);}(_0xe706,0xa3));var _0x6e70=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0xe706[_0x348fec];return _0x5914c7;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d9b78,_0x18f560){var _0x231294=function(_0x2de207){while(--_0x2de207){_0x1d9b78['push'](_0x1d9b78['shift']());}};_0x231294(++_0x18f560);}(_0xe706,0xa3));var _0x6e70=function(_0x530455,_0x41da2d){_0x530455=_0x530455-0x0;var _0x128a27=_0xe706[_0x530455];return _0x128a27;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 32687f5..9006424 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 _0xa6c8=['INTEGER','exports'];(function(_0x12c9d8,_0x9b4624){var _0x25e985=function(_0x1de1de){while(--_0x1de1de){_0x12c9d8['push'](_0x12c9d8['shift']());}};_0x25e985(++_0x9b4624);}(_0xa6c8,0x1d7));var _0x8a6c=function(_0x306c17,_0x4e333d){_0x306c17=_0x306c17-0x0;var _0x33913f=_0xa6c8[_0x306c17];return _0x33913f;};'use strict';var Sequelize=require('sequelize');module[_0x8a6c('0x0')]={'penalty':{'type':Sequelize[_0x8a6c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 c4dcef4..47df39e 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 _0xbf6a=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf6a,0x1a6));var _0xabf6=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xbf6a[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xabf6('0x0'));var util=require('util');var logger=require(_0xabf6('0x1'))(_0xabf6('0x2'));var moment=require(_0xabf6('0x3'));var BPromise=require(_0xabf6('0x4'));var rp=require(_0xabf6('0x5'));var fs=require('fs');var path=require(_0xabf6('0x6'));var rimraf=require('rimraf');var config=require(_0xabf6('0x7'));var attributes=require(_0xabf6('0x8'));module[_0xabf6('0x9')]=function(_0x1e5d53,_0x344e1c){return _0x1e5d53[_0xabf6('0xa')](_0xabf6('0xb'),attributes,{'tableName':_0xabf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0076=['user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x58170b,_0x1ae316){var _0x18d019=function(_0x20059e){while(--_0x20059e){_0x58170b['push'](_0x58170b['shift']());}};_0x18d019(++_0x1ae316);}(_0x0076,0x1e2));var _0x6007=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x0076[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x6007('0x0'));var logger=require(_0x6007('0x1'))(_0x6007('0x2'));var moment=require(_0x6007('0x3'));var BPromise=require(_0x6007('0x4'));var rp=require(_0x6007('0x5'));var fs=require('fs');var path=require(_0x6007('0x6'));var rimraf=require(_0x6007('0x7'));var config=require(_0x6007('0x8'));var attributes=require(_0x6007('0x9'));module[_0x6007('0xa')]=function(_0x241b10,_0x2ec6ce){return _0x241b10[_0x6007('0xb')]('UserChatQueue',attributes,{'tableName':_0x6007('0xc'),'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 013a019..5fba124 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 _0x2510=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x148634,_0xb2a21c){var _0x4bf6ae=function(_0x46bc48){while(--_0x46bc48){_0x148634['push'](_0x148634['shift']());}};_0x4bf6ae(++_0xb2a21c);}(_0x2510,0x129));var _0x0251=function(_0x2b6eb3,_0x37ff56){_0x2b6eb3=_0x2b6eb3-0x0;var _0x1c42c2=_0x2510[_0x2b6eb3];return _0x1c42c2;};'use strict';var _=require(_0x0251('0x0'));var util=require(_0x0251('0x1'));var moment=require(_0x0251('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0251('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0251('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0251('0x5'));var jayson=require(_0x0251('0x6'));var client=jayson[_0x0251('0x7')][_0x0251('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b6f9,_0x113af3,_0x20cae7){return new BPromise(function(_0x828cd9,_0x5d440a){return client[_0x0251('0x9')](_0x10b6f9,_0x20cae7)[_0x0251('0xa')](function(_0x185ae2){logger['info'](_0x0251('0xb'),_0x113af3,_0x0251('0xc'));logger[_0x0251('0xd')](_0x0251('0xe'),_0x113af3,_0x0251('0xc'),JSON[_0x0251('0xf')](_0x185ae2));if(_0x185ae2[_0x0251('0x10')]){if(_0x185ae2['error'][_0x0251('0x11')]===0x1f4){logger[_0x0251('0x10')](_0x0251('0xb'),_0x113af3,_0x185ae2[_0x0251('0x10')][_0x0251('0x12')]);return _0x5d440a(_0x185ae2[_0x0251('0x10')][_0x0251('0x12')]);}logger[_0x0251('0x10')](_0x0251('0xb'),_0x113af3,_0x185ae2['error'][_0x0251('0x12')]);return _0x828cd9(_0x185ae2[_0x0251('0x10')][_0x0251('0x12')]);}else{logger[_0x0251('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x113af3,_0x0251('0xc'));_0x828cd9(_0x185ae2[_0x0251('0x14')][_0x0251('0x12')]);}})[_0x0251('0x15')](function(_0x258604){logger[_0x0251('0x10')](_0x0251('0xb'),_0x113af3,_0x258604);_0x5d440a(_0x258604);});});} \ No newline at end of file +var _0xc322=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0x3df1ca,_0x49fb2a){var _0x5e7db8=function(_0x5aad74){while(--_0x5aad74){_0x3df1ca['push'](_0x3df1ca['shift']());}};_0x5e7db8(++_0x49fb2a);}(_0xc322,0xe2));var _0x2c32=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc322[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x2c32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c32('0x1'));var rs=require(_0x2c32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c32('0x3'))['db'];var utils=require(_0x2c32('0x4'));var logger=require(_0x2c32('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c32('0x6'));var client=jayson[_0x2c32('0x7')][_0x2c32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ac1e,_0x23fc17,_0x1baf05){return new BPromise(function(_0x496191,_0x46c0c1){return client['request'](_0x11ac1e,_0x1baf05)['then'](function(_0x86f5f){logger['info'](_0x2c32('0x9'),_0x23fc17,_0x2c32('0xa'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x23fc17,_0x2c32('0xa'),JSON['stringify'](_0x86f5f));if(_0x86f5f[_0x2c32('0xb')]){if(_0x86f5f['error']['code']===0x1f4){logger[_0x2c32('0xb')](_0x2c32('0x9'),_0x23fc17,_0x86f5f[_0x2c32('0xb')]['message']);return _0x46c0c1(_0x86f5f[_0x2c32('0xb')][_0x2c32('0xc')]);}logger['error'](_0x2c32('0x9'),_0x23fc17,_0x86f5f[_0x2c32('0xb')][_0x2c32('0xc')]);return _0x496191(_0x86f5f[_0x2c32('0xb')][_0x2c32('0xc')]);}else{logger[_0x2c32('0xd')](_0x2c32('0x9'),_0x23fc17,'request\x20sent');_0x496191(_0x86f5f[_0x2c32('0xe')][_0x2c32('0xc')]);}})[_0x2c32('0xf')](function(_0x517c91){logger[_0x2c32('0xb')](_0x2c32('0x9'),_0x23fc17,_0x517c91);_0x46c0c1(_0x517c91);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8a67d1c..44bf559 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x163442,_0x313f1a){var _0x4c8475=function(_0x5b4c73){while(--_0x5b4c73){_0x163442['push'](_0x163442['shift']());}};_0x4c8475(++_0x313f1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xcb91[_0x5280f4];return _0xba93e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2669a2,_0x3fec62){var _0xf41d4d=function(_0x24e5e2){while(--_0x24e5e2){_0x2669a2['push'](_0x2669a2['shift']());}};_0xf41d4d(++_0x3fec62);}(_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 11041b6..f07ddf8 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 _0x3607=['sequelize','exports','STRING'];(function(_0x159877,_0x8c66e7){var _0x16ae6e=function(_0x55bcae){while(--_0x55bcae){_0x159877['push'](_0x159877['shift']());}};_0x16ae6e(++_0x8c66e7);}(_0x3607,0x1ec));var _0x7360=function(_0x12ef70,_0x39c22e){_0x12ef70=_0x12ef70-0x0;var _0x5925be=_0x3607[_0x12ef70];return _0x5925be;};'use strict';var Sequelize=require(_0x7360('0x0'));module[_0x7360('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7360('0x2')]}}; \ No newline at end of file +var _0x3070=['exports','INTEGER','STRING','sequelize'];(function(_0x1f581c,_0x538be2){var _0x73f7cf=function(_0x497b25){while(--_0x497b25){_0x1f581c['push'](_0x1f581c['shift']());}};_0x73f7cf(++_0x538be2);}(_0x3070,0x1db));var _0x0307=function(_0x46257b,_0x1b3b8){_0x46257b=_0x46257b-0x0;var _0x148c75=_0x3070[_0x46257b];return _0x148c75;};'use strict';var Sequelize=require(_0x0307('0x0'));module[_0x0307('0x1')]={'penalty':{'type':Sequelize[_0x0307('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0307('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 075dfd9..4b1f3de 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 _0xdc72=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes'];(function(_0x3dab4d,_0x2a5813){var _0x2eec5e=function(_0x113428){while(--_0x113428){_0x3dab4d['push'](_0x3dab4d['shift']());}};_0x2eec5e(++_0x2a5813);}(_0xdc72,0x178));var _0x2dc7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdc72[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2dc7('0x0'));var util=require(_0x2dc7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2dc7('0x2'));var BPromise=require(_0x2dc7('0x3'));var rp=require(_0x2dc7('0x4'));var fs=require('fs');var path=require(_0x2dc7('0x5'));var rimraf=require(_0x2dc7('0x6'));var config=require('../../config/environment');var attributes=require(_0x2dc7('0x7'));module[_0x2dc7('0x8')]=function(_0xd555f7,_0x27957b){return _0xd555f7[_0x2dc7('0x9')](_0x2dc7('0xa'),attributes,{'tableName':_0x2dc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b3=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x47b3,0xac));var _0x347b=function(_0x45b986,_0x217c66){_0x45b986=_0x45b986-0x0;var _0x25f7c5=_0x47b3[_0x45b986];return _0x25f7c5;};'use strict';var _=require(_0x347b('0x0'));var util=require(_0x347b('0x1'));var logger=require(_0x347b('0x2'))(_0x347b('0x3'));var moment=require(_0x347b('0x4'));var BPromise=require(_0x347b('0x5'));var rp=require(_0x347b('0x6'));var fs=require('fs');var path=require(_0x347b('0x7'));var rimraf=require(_0x347b('0x8'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x347b('0x9')]=function(_0x52bd8f,_0x5acbbc){return _0x52bd8f[_0x347b('0xa')](_0x347b('0xb'),attributes,{'tableName':_0x347b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index e3b7bfc..015c471 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 _0xaa2f=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x299d36,_0x3ea05e){var _0x7701e1=function(_0x27d3b5){while(--_0x27d3b5){_0x299d36['push'](_0x299d36['shift']());}};_0x7701e1(++_0x3ea05e);}(_0xaa2f,0xdf));var _0xfaa2=function(_0x18a71e,_0x1887ec){_0x18a71e=_0x18a71e-0x0;var _0x6a2ef7=_0xaa2f[_0x18a71e];return _0x6a2ef7;};'use strict';var _=require(_0xfaa2('0x0'));var util=require(_0xfaa2('0x1'));var moment=require(_0xfaa2('0x2'));var BPromise=require(_0xfaa2('0x3'));var rs=require(_0xfaa2('0x4'));var fs=require('fs');var Redis=require(_0xfaa2('0x5'));var db=require(_0xfaa2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaa2('0x7'));var config=require(_0xfaa2('0x8'));var jayson=require(_0xfaa2('0x9'));var client=jayson['client'][_0xfaa2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28057b,_0x156622,_0x26a502){return new BPromise(function(_0x3eae27,_0x309ae6){return client[_0xfaa2('0xb')](_0x28057b,_0x26a502)[_0xfaa2('0xc')](function(_0x22ed7f){logger[_0xfaa2('0xd')](_0xfaa2('0xe'),_0x156622,'request\x20sent');logger[_0xfaa2('0xf')](_0xfaa2('0x10'),_0x156622,_0xfaa2('0x11'),JSON[_0xfaa2('0x12')](_0x22ed7f));if(_0x22ed7f[_0xfaa2('0x13')]){if(_0x22ed7f['error'][_0xfaa2('0x14')]===0x1f4){logger['error'](_0xfaa2('0xe'),_0x156622,_0x22ed7f[_0xfaa2('0x13')][_0xfaa2('0x15')]);return _0x309ae6(_0x22ed7f[_0xfaa2('0x13')][_0xfaa2('0x15')]);}logger[_0xfaa2('0x13')](_0xfaa2('0xe'),_0x156622,_0x22ed7f[_0xfaa2('0x13')][_0xfaa2('0x15')]);return _0x3eae27(_0x22ed7f[_0xfaa2('0x13')][_0xfaa2('0x15')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x156622,_0xfaa2('0x11'));_0x3eae27(_0x22ed7f[_0xfaa2('0x16')]['message']);}})[_0xfaa2('0x17')](function(_0x2c99ac){logger[_0xfaa2('0x13')](_0xfaa2('0xe'),_0x156622,_0x2c99ac);_0x309ae6(_0x2c99ac);});});} \ No newline at end of file +var _0x8057=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x8057,0x10d));var _0x7805=function(_0x346b69,_0x5370dd){_0x346b69=_0x346b69-0x0;var _0x122374=_0x8057[_0x346b69];return _0x122374;};'use strict';var _=require(_0x7805('0x0'));var util=require('util');var moment=require(_0x7805('0x1'));var BPromise=require(_0x7805('0x2'));var rs=require(_0x7805('0x3'));var fs=require('fs');var Redis=require(_0x7805('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7805('0x5'));var logger=require(_0x7805('0x6'))(_0x7805('0x7'));var config=require('../../config/environment');var jayson=require(_0x7805('0x8'));var client=jayson[_0x7805('0x9')][_0x7805('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29f157,_0xdb3d22,_0xdc1e9d){return new BPromise(function(_0x18ba60,_0x315788){return client[_0x7805('0xb')](_0x29f157,_0xdc1e9d)[_0x7805('0xc')](function(_0x5e5610){logger[_0x7805('0xd')](_0x7805('0xe'),_0xdb3d22,_0x7805('0xf'));logger[_0x7805('0x10')](_0x7805('0x11'),_0xdb3d22,'request\x20sent',JSON[_0x7805('0x12')](_0x5e5610));if(_0x5e5610[_0x7805('0x13')]){if(_0x5e5610['error'][_0x7805('0x14')]===0x1f4){logger[_0x7805('0x13')](_0x7805('0xe'),_0xdb3d22,_0x5e5610[_0x7805('0x13')]['message']);return _0x315788(_0x5e5610[_0x7805('0x13')][_0x7805('0x15')]);}logger[_0x7805('0x13')](_0x7805('0xe'),_0xdb3d22,_0x5e5610[_0x7805('0x13')][_0x7805('0x15')]);return _0x18ba60(_0x5e5610[_0x7805('0x13')][_0x7805('0x15')]);}else{logger['info'](_0x7805('0xe'),_0xdb3d22,_0x7805('0xf'));_0x18ba60(_0x5e5610[_0x7805('0x16')]['message']);}})[_0x7805('0x17')](function(_0x53fcf3){logger[_0x7805('0x13')](_0x7805('0xe'),_0xdb3d22,_0x53fcf3);_0x315788(_0x53fcf3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c35847b..78f92f7 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x8608e6,_0x236ccb){var _0xb2a9fb=function(_0x32e425){while(--_0x32e425){_0x8608e6['push'](_0x8608e6['shift']());}};_0xb2a9fb(++_0x236ccb);}(_0xe706,0xa3));var _0x6e70=function(_0x96a34a,_0x48b3c6){_0x96a34a=_0x96a34a-0x0;var _0x4e325e=_0xe706[_0x96a34a];return _0x4e325e;};'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(_0x3949bd,_0x21356c){var _0x5003b7=function(_0x12e459){while(--_0x12e459){_0x3949bd['push'](_0x3949bd['shift']());}};_0x5003b7(++_0x21356c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 f6ecbd9..014ed9f 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 _0x1375=['exports','INTEGER','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1375,0x170));var _0x5137=function(_0x4405c2,_0x22531d){_0x4405c2=_0x4405c2-0x0;var _0x28aef0=_0x1375[_0x4405c2];return _0x28aef0;};'use strict';var Sequelize=require(_0x5137('0x0'));module[_0x5137('0x1')]={'penalty':{'type':Sequelize[_0x5137('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0645=['exports'];(function(_0x34ab7b,_0x3de352){var _0x10b02d=function(_0x2e0550){while(--_0x2e0550){_0x34ab7b['push'](_0x34ab7b['shift']());}};_0x10b02d(++_0x3de352);}(_0x0645,0xc4));var _0x5064=function(_0x28649b,_0x46f217){_0x28649b=_0x28649b-0x0;var _0xe818d4=_0x0645[_0x28649b];return _0xe818d4;};'use strict';var Sequelize=require('sequelize');module[_0x5064('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3f67cf8..1a5ae0f 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 _0xdc24=['./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdc24,0x66));var _0x4dc2=function(_0x5e3f0a,_0x539b4d){_0x5e3f0a=_0x5e3f0a-0x0;var _0x2b5920=_0xdc24[_0x5e3f0a];return _0x2b5920;};'use strict';var _=require(_0x4dc2('0x0'));var util=require(_0x4dc2('0x1'));var logger=require(_0x4dc2('0x2'))(_0x4dc2('0x3'));var moment=require(_0x4dc2('0x4'));var BPromise=require(_0x4dc2('0x5'));var rp=require(_0x4dc2('0x6'));var fs=require('fs');var path=require(_0x4dc2('0x7'));var rimraf=require(_0x4dc2('0x8'));var config=require(_0x4dc2('0x9'));var attributes=require(_0x4dc2('0xa'));module[_0x4dc2('0xb')]=function(_0x5b837f,_0x1695b5){return _0x5b837f['define'](_0x4dc2('0xc'),attributes,{'tableName':_0x4dc2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf82c=['request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','bluebird'];(function(_0x1a6204,_0x6ba4b1){var _0x124bf0=function(_0x30a748){while(--_0x30a748){_0x1a6204['push'](_0x1a6204['shift']());}};_0x124bf0(++_0x6ba4b1);}(_0xf82c,0x168));var _0xcf82=function(_0x18deaa,_0x45dd93){_0x18deaa=_0x18deaa-0x0;var _0x3987c5=_0xf82c[_0x18deaa];return _0x3987c5;};'use strict';var _=require(_0xcf82('0x0'));var util=require(_0xcf82('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcf82('0x2'));var rp=require(_0xcf82('0x3'));var fs=require('fs');var path=require(_0xcf82('0x4'));var rimraf=require(_0xcf82('0x5'));var config=require('../../config/environment');var attributes=require(_0xcf82('0x6'));module[_0xcf82('0x7')]=function(_0x35a573,_0x5f4e0f){return _0x35a573[_0xcf82('0x8')](_0xcf82('0x9'),attributes,{'tableName':_0xcf82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index fb6182b..7e283db 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b02d5,_0x211431){var _0x2126e7=function(_0x42aae8){while(--_0x42aae8){_0x2b02d5['push'](_0x2b02d5['shift']());}};_0x2126e7(++_0x211431);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x6d070a,_0x47e825){_0x6d070a=_0x6d070a-0x0;var _0x2c065d=_0x7fbe[_0x6d070a];return _0x2c065d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0xbf5aa4,_0x500f5c){var _0x8c3ab7=function(_0x1b045c){while(--_0x1b045c){_0xbf5aa4['push'](_0xbf5aa4['shift']());}};_0x8c3ab7(++_0x500f5c);}(_0x55ca,0x126));var _0xa55c=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x55ca[_0x1b2255];return _0x33e57d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1ba992f..75b5a8e 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 _0x387d=['util','path','express','fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer'];(function(_0x3f4f4c,_0x152171){var _0x3d48b3=function(_0x18a8a4){while(--_0x18a8a4){_0x3f4f4c['push'](_0x3f4f4c['shift']());}};_0x3d48b3(++_0x152171);}(_0x387d,0x1cb));var _0xd387=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x387d[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xd387('0x0'));var util=require(_0xd387('0x1'));var path=require(_0xd387('0x2'));var timeout=require('connect-timeout');var express=require(_0xd387('0x3'));var router=express['Router']();var fs_extra=require(_0xd387('0x4'));var auth=require(_0xd387('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd387('0x6'));router[_0xd387('0x7')]('/',auth[_0xd387('0x8')](),controller[_0xd387('0x9')]);module['exports']=router; \ No newline at end of file +var _0x2815=['post','sendUserNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x47ad82,_0x2ec537){var _0xe8594e=function(_0x2fd81e){while(--_0x2fd81e){_0x47ad82['push'](_0x47ad82['shift']());}};_0xe8594e(++_0x2ec537);}(_0x2815,0x148));var _0x5281=function(_0x401154,_0x5d0daf){_0x401154=_0x401154-0x0;var _0x4d6ec2=_0x2815[_0x401154];return _0x4d6ec2;};'use strict';var multer=require(_0x5281('0x0'));var util=require('util');var path=require(_0x5281('0x1'));var timeout=require(_0x5281('0x2'));var express=require(_0x5281('0x3'));var router=express[_0x5281('0x4')]();var fs_extra=require(_0x5281('0x5'));var auth=require(_0x5281('0x6'));var interaction=require(_0x5281('0x7'));var config=require(_0x5281('0x8'));var controller=require(_0x5281('0x9'));router[_0x5281('0xa')]('/',auth['isAuthenticated'](),controller[_0x5281('0xb')]);module[_0x5281('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 138fa7a..6d80f77 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 _0x80aa=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x528442,_0x3f7aed){var _0x4c42cd=function(_0x304a36){while(--_0x304a36){_0x528442['push'](_0x528442['shift']());}};_0x4c42cd(++_0x3f7aed);}(_0x80aa,0xb1));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa80a('0x0'));module[_0xa80a('0x1')]={'body':{'type':Sequelize[_0xa80a('0x2')]},'senderName':{'type':Sequelize[_0xa80a('0x3')]},'recipientsId':{'type':Sequelize[_0xa80a('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa80a('0x3')]},'beep':{'type':Sequelize[_0xa80a('0x4')]}}; \ No newline at end of file +var _0xf3f8=['TEXT','BOOLEAN','sequelize'];(function(_0x13e17f,_0x89b33c){var _0x1eaa46=function(_0x22724b){while(--_0x22724b){_0x13e17f['push'](_0x13e17f['shift']());}};_0x1eaa46(++_0x89b33c);}(_0xf3f8,0x14f));var _0x8f3f=function(_0x5ec2f4,_0x2a48db){_0x5ec2f4=_0x5ec2f4-0x0;var _0x5763fb=_0xf3f8[_0x5ec2f4];return _0x5763fb;};'use strict';var Sequelize=require(_0x8f3f('0x0'));module['exports']={'body':{'type':Sequelize[_0x8f3f('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x8f3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9b9f113..6b01b1f 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 _0x610f=['forEach','startCase','User','ids','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','catch','findOne','html','render'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x610f,0x6e));var _0xf610=function(_0x12f451,_0x3b618f){_0x12f451=_0x12f451-0x0;var _0x5e9589=_0x610f[_0x12f451];return _0x5e9589;};'use strict';var emlformat=require(_0xf610('0x0'));var rimraf=require(_0xf610('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf610('0x2'));var rp=require(_0xf610('0x3'));var moment=require(_0xf610('0x4'));var BPromise=require(_0xf610('0x5'));var Mustache=require(_0xf610('0x6'));var util=require(_0xf610('0x7'));var path=require(_0xf610('0x8'));var sox=require(_0xf610('0x9'));var csv=require(_0xf610('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf610('0xb'));var squel=require(_0xf610('0xc'));var crypto=require(_0xf610('0xd'));var jsforce=require(_0xf610('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf610('0xa'));var querystring=require(_0xf610('0xf'));var Papa=require('papaparse');var Redis=require(_0xf610('0x10'));var authService=require(_0xf610('0x11'));var qs=require(_0xf610('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf610('0x13'));var logger=require(_0xf610('0x14'))(_0xf610('0x15'));var utils=require(_0xf610('0x16'));var config=require(_0xf610('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf610('0x18')]=_['defaults'](config[_0xf610('0x18')],{'host':_0xf610('0x19'),'port':0x18eb});var socket=require(_0xf610('0x1a'))(new Redis(config[_0xf610('0x18')]));require(_0xf610('0x1b'))[_0xf610('0x1c')](socket);function respondWithStatusCode(_0x5ef77b,_0x5eb559){_0x5eb559=_0x5eb559||0xcc;return function(_0x539e45){if(_0x539e45){return _0x5ef77b['sendStatus'](_0x5eb559);}return _0x5ef77b[_0xf610('0x1d')](_0x5eb559)[_0xf610('0x1e')]();};}function respondWithResult(_0xd748f3,_0x2bbba4){_0x2bbba4=_0x2bbba4||0xc8;return function(_0x4572fc){if(_0x4572fc){return _0xd748f3[_0xf610('0x1d')](_0x2bbba4)[_0xf610('0x1f')](_0x4572fc);}};}function respondWithFilteredResult(_0x2bd861,_0x56d7d7){return function(_0x196320){if(_0x196320){var _0x131c2c=typeof _0x56d7d7['offset']===_0xf610('0x20')&&typeof _0x56d7d7[_0xf610('0x21')]===_0xf610('0x20');var _0x33388f=_0x196320[_0xf610('0x22')];var _0x596c7c=_0x131c2c?0x0:_0x56d7d7[_0xf610('0x23')];var _0x4cc4a4=_0x131c2c?_0x196320[_0xf610('0x22')]:_0x56d7d7['offset']+_0x56d7d7['limit'];var _0x4dda39;if(_0x4cc4a4>=_0x33388f){_0x4cc4a4=_0x33388f;_0x4dda39=0xc8;}else{_0x4dda39=0xce;}_0x2bd861[_0xf610('0x1d')](_0x4dda39);return _0x2bd861['set'](_0xf610('0x24'),_0x596c7c+'-'+_0x4cc4a4+'/'+_0x33388f)[_0xf610('0x1f')](_0x196320);}return null;};}function patchUpdates(_0x357bc0){return function(_0x47f225){try{jsonpatch['apply'](_0x47f225,_0x357bc0,!![]);}catch(_0x43055e){return BPromise[_0xf610('0x25')](_0x43055e);}return _0x47f225[_0xf610('0x26')]();};}function saveUpdates(_0x235b1e,_0x459815){return function(_0x5f0a96){if(_0x5f0a96){return _0x5f0a96['update'](_0x235b1e)[_0xf610('0x27')](function(_0x4c7d0c){return _0x4c7d0c;});}return null;};}function removeEntity(_0x5d563c,_0x3eadbe){return function(_0x123733){if(_0x123733){return _0x123733[_0xf610('0x28')]()[_0xf610('0x27')](function(){_0x5d563c[_0xf610('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c67f9,_0x28f59b){return function(_0x2b0cf0){if(!_0x2b0cf0){_0x2c67f9[_0xf610('0x29')](0x194);}return _0x2b0cf0;};}function handleError(_0x37d291,_0x574d0e){_0x574d0e=_0x574d0e||0x1f4;return function(_0x5745d2){logger[_0xf610('0x2a')](_0x5745d2['stack']);if(_0x5745d2['name']){delete _0x5745d2[_0xf610('0x2b')];}_0x37d291[_0xf610('0x1d')](_0x574d0e)[_0xf610('0x2c')](_0x5745d2);};}exports['sendUserNotification']=function(_0x2c8036,_0x96a076,_0x338c26){if(!_0x2c8036[_0xf610('0x2d')][_0xf610('0x2e')](_0xf610('0x2f'))&&!_0x2c8036[_0xf610('0x2d')]['hasOwnProperty'](_0xf610('0x30'))){throw new db[(_0xf610('0x31'))][(_0xf610('0x32'))](_0xf610('0x33'));}else{if(_0x2c8036[_0xf610('0x2d')]['hasOwnProperty'](_0xf610('0x30'))&&!_0x2c8036['body'][_0xf610('0x2e')](_0xf610('0x34'))){throw new db[(_0xf610('0x31'))][(_0xf610('0x32'))](_0xf610('0x35'));}if(!_0x2c8036['body'][_0xf610('0x2e')]('recipients')){throw new db['Sequelize'][(_0xf610('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2898ca=JSON[_0xf610('0x36')](_0x2c8036[_0xf610('0x2d')][_0xf610('0x37')]);}catch(_0x100544){logger[_0xf610('0x2a')](_0x100544);throw new db[(_0xf610('0x31'))][(_0xf610('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x48ecd5=[_0xf610('0x38'),_0xf610('0x39'),_0xf610('0x3a'),_0xf610('0x3b'),'smsqueue',_0xf610('0x3c'),'whatsappqueue',_0xf610('0x3d'),_0xf610('0x3e')];if(_[_0xf610('0x3f')](_0x2898ca,function(_0x1d313d){return!_[_0xf610('0x40')](_0x48ecd5,_0x1d313d[_0xf610('0x41')][_0xf610('0x42')]());})){throw new db[(_0xf610('0x31'))]['ValidationError'](_0xf610('0x43'));}}}var _0x717a2={};_0x717a2['senderName']=_0x2c8036[_0xf610('0x2d')][_0xf610('0x2e')](_0xf610('0x44'))?_0x2c8036['body']['senderName']:_0x2c8036['user'][_0xf610('0x45')];_0x717a2[_0xf610('0x46')]=_[_0xf610('0x47')](_0x2c8036[_0xf610('0x2d')][_0xf610('0x46')])?null:_0x2c8036[_0xf610('0x2d')][_0xf610('0x46')];_0x717a2[_0xf610('0x48')]=_0x2c8036[_0xf610('0x2d')][_0xf610('0x48')]||![];_0x717a2[_0xf610('0x49')]=_0x2c8036[_0xf610('0x3e')]['id'];return getContent(_0x2c8036[_0xf610('0x2d')])[_0xf610('0x27')](function(_0x3ee70e){_0x717a2['body']=_0x3ee70e;return getRecipients(_0x2898ca);})[_0xf610('0x27')](function(_0x398ed2){_0x717a2[_0xf610('0x4a')]=_[_0xf610('0x4b')](_0x398ed2)[_0xf610('0x4c')](',');return db[_0xf610('0x4d')]['transaction'](function(_0x7cbefb){return db[_0xf610('0x4e')][_0xf610('0x4f')](_0x717a2,{'raw':!![],'transaction':_0x7cbefb})[_0xf610('0x27')](function(_0x3aab44){var _0x185f31={'sender':_0x717a2[_0xf610('0x44')],'description':_0x717a2[_0xf610('0x46')],'content':_0x717a2[_0xf610('0x2d')],'beep':_0x717a2[_0xf610('0x48')]};_0x398ed2['forEach'](function(_0x23de28){_0x185f31['recipient']=_0x23de28;socket['emit']('userNotification:send',_0x185f31);});return _0x3aab44;});});})['then'](respondWithResult(_0x96a076,0xc9))[_0xf610('0x50')](handleError(_0x96a076,null));};function getContent(_0xcaadeb){return new BPromise(function(_0x1c0142,_0x34f438){if(_0xcaadeb[_0xf610('0x2f')]){_0x1c0142(_0xcaadeb[_0xf610('0x2f')]);return;}return db['Template'][_0xf610('0x51')]({'attributes':[_0xf610('0x52')],'where':{'id':_0xcaadeb[_0xf610('0x30')]},'raw':!![]})[_0xf610('0x27')](function(_0xf78b31){if(!_0xf78b31)throw new db[(_0xf610('0x31'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x174e26=Mustache[_0xf610('0x53')](_0xf78b31[_0xf610('0x52')],_0xcaadeb[_0xf610('0x34')]);_0x1c0142(_0x174e26);})[_0xf610('0x50')](function(_0x5361f8){_0x34f438(_0x5361f8);});});}function getRecipients(_0xe0577a){return new BPromise(function(_0x3d52f2,_0x57cdb5){var _0x75891b=[];var _0x42a83a=[];_0xe0577a[_0xf610('0x54')](function(_0x1964e2){var _0x26473b=_[_0xf610('0x55')](_0x1964e2['model'][_0xf610('0x42')]());if(_0x26473b===_0xf610('0x56')){_0x75891b=_['union'](_0x75891b,_0x1964e2[_0xf610('0x57')]);}else{if(_[_0xf610('0x40')](_0x26473b,_0xf610('0x58')))_0x26473b=_0x26473b[_0xf610('0x59')](_0xf610('0x58'),_0xf610('0x5a'));_0x1964e2[_0xf610('0x57')][_0xf610('0x54')](function(_0x57360f){_0x42a83a[_0xf610('0x5b')](getAgents(_0x26473b,_0x57360f));});}});return BPromise[_0xf610('0x5c')](_0x42a83a)['then'](function(_0x446aa7){_0x75891b=_[_0xf610('0x5d')](_0x75891b,_[_0xf610('0x5e')](_0x446aa7));_0x3d52f2(_0x75891b);})[_0xf610('0x50')](function(_0x4a0862){_0x57cdb5(_0x4a0862);});});}function getAgents(_0x171810,_0x29f746){return new BPromise(function(_0x576a6b,_0x39d5e2){return db[_0x171810][_0xf610('0x51')]({'where':{'id':_0x29f746}})['then'](function(_0x3df784){return _0x3df784[_0xf610('0x5f')]({'attributes':['id'],'raw':!![]})[_0xf610('0x27')](function(_0x375c26){var _0x4f7251=_[_0xf610('0x60')](_0x375c26,'id');_0x576a6b(_0x4f7251);});})[_0xf610('0x50')](function(_0x275e36){_0x39d5e2(_0x275e36);});});} \ No newline at end of file +var _0xdeb8=['hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','Template','findOne','html','render','catch','ids','includes','queue','replace','Queue','push','map','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','text'];(function(_0x4c7c26,_0x144cd7){var _0xa28431=function(_0x4876c6){while(--_0x4876c6){_0x4c7c26['push'](_0x4c7c26['shift']());}};_0xa28431(++_0x144cd7);}(_0xdeb8,0xdc));var _0x8deb=function(_0x1bdffa,_0x367b45){_0x1bdffa=_0x1bdffa-0x0;var _0x22934e=_0xdeb8[_0x1bdffa];return _0x22934e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8deb('0x0'));var zipdir=require(_0x8deb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8deb('0x2'));var moment=require('moment');var BPromise=require(_0x8deb('0x3'));var Mustache=require(_0x8deb('0x4'));var util=require(_0x8deb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8deb('0x6'));var ejs=require(_0x8deb('0x7'));var fs=require('fs');var fs_extra=require(_0x8deb('0x8'));var _=require('lodash');var squel=require(_0x8deb('0x9'));var crypto=require(_0x8deb('0xa'));var jsforce=require(_0x8deb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8deb('0x6'));var querystring=require(_0x8deb('0xc'));var Papa=require(_0x8deb('0xd'));var Redis=require(_0x8deb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8deb('0xf'));var as=require(_0x8deb('0x10'));var hardwareService=require(_0x8deb('0x11'));var logger=require(_0x8deb('0x12'))(_0x8deb('0x13'));var utils=require('../../config/utils');var config=require(_0x8deb('0x14'));var licenseUtil=require(_0x8deb('0x15'));var db=require(_0x8deb('0x16'))['db'];config[_0x8deb('0x17')]=_['defaults'](config['redis'],{'host':_0x8deb('0x18'),'port':0x18eb});var socket=require(_0x8deb('0x19'))(new Redis(config[_0x8deb('0x17')]));require(_0x8deb('0x1a'))['register'](socket);function respondWithStatusCode(_0x3a9068,_0x1ed28d){_0x1ed28d=_0x1ed28d||0xcc;return function(_0x3fe364){if(_0x3fe364){return _0x3a9068[_0x8deb('0x1b')](_0x1ed28d);}return _0x3a9068[_0x8deb('0x1c')](_0x1ed28d)[_0x8deb('0x1d')]();};}function respondWithResult(_0x582432,_0x295598){_0x295598=_0x295598||0xc8;return function(_0x5be9b7){if(_0x5be9b7){return _0x582432[_0x8deb('0x1c')](_0x295598)[_0x8deb('0x1e')](_0x5be9b7);}};}function respondWithFilteredResult(_0x50f104,_0x987641){return function(_0x34ee32){if(_0x34ee32){var _0x3572e9=typeof _0x987641[_0x8deb('0x1f')]===_0x8deb('0x20')&&typeof _0x987641[_0x8deb('0x21')]===_0x8deb('0x20');var _0x4e3131=_0x34ee32[_0x8deb('0x22')];var _0x240e0f=_0x3572e9?0x0:_0x987641[_0x8deb('0x1f')];var _0x3ae767=_0x3572e9?_0x34ee32[_0x8deb('0x22')]:_0x987641[_0x8deb('0x1f')]+_0x987641[_0x8deb('0x21')];var _0x43724c;if(_0x3ae767>=_0x4e3131){_0x3ae767=_0x4e3131;_0x43724c=0xc8;}else{_0x43724c=0xce;}_0x50f104['status'](_0x43724c);return _0x50f104['set']('Content-Range',_0x240e0f+'-'+_0x3ae767+'/'+_0x4e3131)['json'](_0x34ee32);}return null;};}function patchUpdates(_0x26de48){return function(_0x356185){try{jsonpatch[_0x8deb('0x23')](_0x356185,_0x26de48,!![]);}catch(_0x240886){return BPromise[_0x8deb('0x24')](_0x240886);}return _0x356185[_0x8deb('0x25')]();};}function saveUpdates(_0x5d7b0a,_0x2f276b){return function(_0x55842e){if(_0x55842e){return _0x55842e[_0x8deb('0x26')](_0x5d7b0a)[_0x8deb('0x27')](function(_0x401d67){return _0x401d67;});}return null;};}function removeEntity(_0x21b9b3,_0x37307e){return function(_0x3754f3){if(_0x3754f3){return _0x3754f3['destroy']()[_0x8deb('0x27')](function(){_0x21b9b3['status'](0xcc)[_0x8deb('0x1d')]();});}};}function handleEntityNotFound(_0x279248,_0x243641){return function(_0x4eff8c){if(!_0x4eff8c){_0x279248['sendStatus'](0x194);}return _0x4eff8c;};}function handleError(_0x28d3e6,_0x25552b){_0x25552b=_0x25552b||0x1f4;return function(_0x3a582a){logger[_0x8deb('0x28')](_0x3a582a[_0x8deb('0x29')]);if(_0x3a582a['name']){delete _0x3a582a[_0x8deb('0x2a')];}_0x28d3e6['status'](_0x25552b)[_0x8deb('0x2b')](_0x3a582a);};}exports[_0x8deb('0x2c')]=function(_0x4d1645,_0x554b0e,_0x41115d){if(!_0x4d1645[_0x8deb('0x2d')]['hasOwnProperty'](_0x8deb('0x2e'))&&!_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x2f')](_0x8deb('0x30'))){throw new db[(_0x8deb('0x31'))]['ValidationError'](_0x8deb('0x32'));}else{if(_0x4d1645[_0x8deb('0x2d')]['hasOwnProperty'](_0x8deb('0x30'))&&!_0x4d1645[_0x8deb('0x2d')]['hasOwnProperty'](_0x8deb('0x33'))){throw new db[(_0x8deb('0x31'))][(_0x8deb('0x34'))](_0x8deb('0x35'));}if(!_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x2f')]('recipients')){throw new db[(_0x8deb('0x31'))]['ValidationError'](_0x8deb('0x36'));}else{try{var _0x4b862e=JSON[_0x8deb('0x37')](_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x38')]);}catch(_0x3dc372){logger[_0x8deb('0x28')](_0x3dc372);throw new db[(_0x8deb('0x31'))][(_0x8deb('0x34'))](_0x8deb('0x39'));}var _0x5834ae=['chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue',_0x8deb('0x3a'),_0x8deb('0x3b')];if(_[_0x8deb('0x3c')](_0x4b862e,function(_0x3480dc){return!_['includes'](_0x5834ae,_0x3480dc[_0x8deb('0x3d')][_0x8deb('0x3e')]());})){throw new db[(_0x8deb('0x31'))]['ValidationError'](_0x8deb('0x3f'));}}}var _0x2cc38c={};_0x2cc38c[_0x8deb('0x40')]=_0x4d1645['body'][_0x8deb('0x2f')](_0x8deb('0x40'))?_0x4d1645['body'][_0x8deb('0x40')]:_0x4d1645['user'][_0x8deb('0x41')];_0x2cc38c[_0x8deb('0x42')]=_['isEmpty'](_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x42')])?null:_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x42')];_0x2cc38c[_0x8deb('0x43')]=_0x4d1645[_0x8deb('0x2d')][_0x8deb('0x43')]||![];_0x2cc38c[_0x8deb('0x44')]=_0x4d1645[_0x8deb('0x3b')]['id'];return getContent(_0x4d1645[_0x8deb('0x2d')])[_0x8deb('0x27')](function(_0xba99e7){_0x2cc38c[_0x8deb('0x2d')]=_0xba99e7;return getRecipients(_0x4b862e);})['then'](function(_0x39ccf5){_0x2cc38c['recipientsId']=_[_0x8deb('0x45')](_0x39ccf5)[_0x8deb('0x46')](',');return db[_0x8deb('0x47')][_0x8deb('0x48')](function(_0x3a26e4){return db[_0x8deb('0x49')]['create'](_0x2cc38c,{'raw':!![],'transaction':_0x3a26e4})[_0x8deb('0x27')](function(_0x182a18){var _0x50c9cc={'sender':_0x2cc38c[_0x8deb('0x40')],'description':_0x2cc38c[_0x8deb('0x42')],'content':_0x2cc38c[_0x8deb('0x2d')],'beep':_0x2cc38c[_0x8deb('0x43')]};_0x39ccf5[_0x8deb('0x4a')](function(_0x5a7d0c){_0x50c9cc[_0x8deb('0x4b')]=_0x5a7d0c;socket[_0x8deb('0x4c')]('userNotification:send',_0x50c9cc);});return _0x182a18;});});})[_0x8deb('0x27')](respondWithResult(_0x554b0e,0xc9))['catch'](handleError(_0x554b0e,null));};function getContent(_0x284ce1){return new BPromise(function(_0x17e529,_0x457e33){if(_0x284ce1[_0x8deb('0x2e')]){_0x17e529(_0x284ce1[_0x8deb('0x2e')]);return;}return db[_0x8deb('0x4d')][_0x8deb('0x4e')]({'attributes':[_0x8deb('0x4f')],'where':{'id':_0x284ce1['TemplateId']},'raw':!![]})['then'](function(_0x517f73){if(!_0x517f73)throw new db['Sequelize'][(_0x8deb('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4c4901=Mustache[_0x8deb('0x50')](_0x517f73[_0x8deb('0x4f')],_0x284ce1[_0x8deb('0x33')]);_0x17e529(_0x4c4901);})[_0x8deb('0x51')](function(_0x31ea1d){_0x457e33(_0x31ea1d);});});}function getRecipients(_0x4bf28d){return new BPromise(function(_0x495f66,_0xcb14d1){var _0x103bdb=[];var _0x53335b=[];_0x4bf28d[_0x8deb('0x4a')](function(_0x37a662){var _0x2f9d6f=_['startCase'](_0x37a662[_0x8deb('0x3d')][_0x8deb('0x3e')]());if(_0x2f9d6f==='User'){_0x103bdb=_['union'](_0x103bdb,_0x37a662[_0x8deb('0x52')]);}else{if(_[_0x8deb('0x53')](_0x2f9d6f,_0x8deb('0x54')))_0x2f9d6f=_0x2f9d6f[_0x8deb('0x55')](_0x8deb('0x54'),_0x8deb('0x56'));_0x37a662[_0x8deb('0x52')]['forEach'](function(_0x34c84c){_0x53335b[_0x8deb('0x57')](getAgents(_0x2f9d6f,_0x34c84c));});}});return BPromise['all'](_0x53335b)['then'](function(_0x2ad3c2){_0x103bdb=_['union'](_0x103bdb,_['flatten'](_0x2ad3c2));_0x495f66(_0x103bdb);})[_0x8deb('0x51')](function(_0x2d0616){_0xcb14d1(_0x2d0616);});});}function getAgents(_0x2b0a15,_0x44cdc8){return new BPromise(function(_0x19a376,_0x452d41){return db[_0x2b0a15][_0x8deb('0x4e')]({'where':{'id':_0x44cdc8}})['then'](function(_0x58c21e){return _0x58c21e['getAgents']({'attributes':['id'],'raw':!![]})[_0x8deb('0x27')](function(_0x181adc){var _0x3127fd=_[_0x8deb('0x58')](_0x181adc,'id');_0x19a376(_0x3127fd);});})[_0x8deb('0x51')](function(_0x97b30d){_0x452d41(_0x97b30d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 1439d5c..8317590 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 _0xa5f5=['hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0xf2d6b2,_0x3bacc8){var _0x5f6e12=function(_0x1a86ca){while(--_0x1a86ca){_0xf2d6b2['push'](_0xf2d6b2['shift']());}};_0x5f6e12(++_0x3bacc8);}(_0xa5f5,0x16a));var _0x5a5f=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xa5f5[_0x556bb1];return _0x45455f;};'use strict';var EventEmitter=require(_0x5a5f('0x0'));var UserNotification=require(_0x5a5f('0x1'))['db'][_0x5a5f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5a5f('0x3')](0x0);var events={'afterCreate':_0x5a5f('0x4'),'afterUpdate':_0x5a5f('0x5'),'afterDestroy':_0x5a5f('0x6')};function emitEvent(_0x25be7c){return function(_0x7546a,_0x57b251,_0x317a80){UserNotificationEvents[_0x5a5f('0x7')](_0x25be7c+':'+_0x7546a['id'],_0x7546a);UserNotificationEvents['emit'](_0x25be7c,_0x7546a);_0x317a80(null);};}for(var e in events){if(events[_0x5a5f('0x8')](e)){var event=events[e];UserNotification[_0x5a5f('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x09fb=['UserNotification','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x11704f,_0x9d551a){var _0x3c8e2a=function(_0x41f24f){while(--_0x41f24f){_0x11704f['push'](_0x11704f['shift']());}};_0x3c8e2a(++_0x9d551a);}(_0x09fb,0x116));var _0xb09f=function(_0x4e09a6,_0x5d823e){_0x4e09a6=_0x4e09a6-0x0;var _0x43f7c3=_0x09fb[_0x4e09a6];return _0x43f7c3;};'use strict';var EventEmitter=require(_0xb09f('0x0'));var UserNotification=require(_0xb09f('0x1'))['db'][_0xb09f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb09f('0x3'),'afterUpdate':_0xb09f('0x4'),'afterDestroy':_0xb09f('0x5')};function emitEvent(_0x2a02fb){return function(_0x5a83ef,_0x1084c5,_0x2b6012){UserNotificationEvents[_0xb09f('0x6')](_0x2a02fb+':'+_0x5a83ef['id'],_0x5a83ef);UserNotificationEvents[_0xb09f('0x6')](_0x2a02fb,_0x5a83ef);_0x2b6012(null);};}for(var e in events){if(events[_0xb09f('0x7')](e)){var event=events[e];UserNotification[_0xb09f('0x8')](e,emitEvent(event));}}module[_0xb09f('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 981fbcc..635d5ec 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 _0x0da7=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4573ff,_0x459a66){var _0x280a7b=function(_0x5a0ead){while(--_0x5a0ead){_0x4573ff['push'](_0x4573ff['shift']());}};_0x280a7b(++_0x459a66);}(_0x0da7,0x17a));var _0x70da=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0x0da7[_0x515ae8];return _0x4cf66a;};'use strict';var _=require(_0x70da('0x0'));var util=require('util');var logger=require(_0x70da('0x1'))('api');var moment=require(_0x70da('0x2'));var BPromise=require(_0x70da('0x3'));var rp=require(_0x70da('0x4'));var fs=require('fs');var path=require(_0x70da('0x5'));var rimraf=require(_0x70da('0x6'));var config=require(_0x70da('0x7'));var attributes=require(_0x70da('0x8'));module[_0x70da('0x9')]=function(_0x53fbf4,_0x49a911){return _0x53fbf4[_0x70da('0xa')](_0x70da('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70da('0xc'),'collate':_0x70da('0xd')});}; \ No newline at end of file +var _0xcca2=['./userNotification.attributes','define','userNotifications','utf8mb4','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d76e1,_0x38d9df){var _0x16b87e=function(_0x4fdde9){while(--_0x4fdde9){_0x4d76e1['push'](_0x4d76e1['shift']());}};_0x16b87e(++_0x38d9df);}(_0xcca2,0x1bc));var _0x2cca=function(_0x4b57e8,_0x1f5ef1){_0x4b57e8=_0x4b57e8-0x0;var _0x20130d=_0xcca2[_0x4b57e8];return _0x20130d;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2cca('0x1'));var BPromise=require(_0x2cca('0x2'));var rp=require(_0x2cca('0x3'));var fs=require('fs');var path=require(_0x2cca('0x4'));var rimraf=require(_0x2cca('0x5'));var config=require('../../config/environment');var attributes=require(_0x2cca('0x6'));module['exports']=function(_0x235c3a,_0x459a16){return _0x235c3a[_0x2cca('0x7')]('UserNotification',attributes,{'tableName':_0x2cca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cca('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 2bab9aa..4235963 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 _0x248c=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','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','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2cce35,_0x412c00){var _0x3fa633=function(_0x41cf41){while(--_0x41cf41){_0x2cce35['push'](_0x2cce35['shift']());}};_0x3fa633(++_0x412c00);}(_0x248c,0xe0));var _0xc248=function(_0x5d7b38,_0x618dda){_0x5d7b38=_0x5d7b38-0x0;var _0x5a72fe=_0x248c[_0x5d7b38];return _0x5a72fe;};'use strict';var _=require(_0xc248('0x0'));var util=require(_0xc248('0x1'));var moment=require(_0xc248('0x2'));var BPromise=require(_0xc248('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc248('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc248('0x5'));var logger=require(_0xc248('0x6'))(_0xc248('0x7'));var config=require(_0xc248('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc248('0x9')]['http']({'port':0x232a});config[_0xc248('0xa')]=_[_0xc248('0xb')](config[_0xc248('0xa')],{'host':_0xc248('0xc'),'port':0x18eb});var socket=require(_0xc248('0xd'))(new Redis(config['redis']));require(_0xc248('0xe'))[_0xc248('0xf')](socket);function respondWithRpcPromise(_0x26fb34,_0x346b2e,_0x11c90f){return new BPromise(function(_0x4ee1ab,_0x9428c1){return client[_0xc248('0x10')](_0x26fb34,_0x11c90f)[_0xc248('0x11')](function(_0x480cf2){logger[_0xc248('0x12')](_0xc248('0x13'),_0x346b2e,_0xc248('0x14'));logger[_0xc248('0x15')](_0xc248('0x16'),_0x346b2e,_0xc248('0x14'),JSON[_0xc248('0x17')](_0x480cf2));if(_0x480cf2[_0xc248('0x18')]){if(_0x480cf2[_0xc248('0x18')][_0xc248('0x19')]===0x1f4){logger['error'](_0xc248('0x13'),_0x346b2e,_0x480cf2[_0xc248('0x18')][_0xc248('0x1a')]);return _0x9428c1(_0x480cf2['error'][_0xc248('0x1a')]);}logger['error'](_0xc248('0x13'),_0x346b2e,_0x480cf2['error'][_0xc248('0x1a')]);return _0x4ee1ab(_0x480cf2[_0xc248('0x18')][_0xc248('0x1a')]);}else{logger[_0xc248('0x12')](_0xc248('0x13'),_0x346b2e,_0xc248('0x14'));_0x4ee1ab(_0x480cf2[_0xc248('0x1b')][_0xc248('0x1a')]);}})[_0xc248('0x1c')](function(_0x1b9d5a){logger[_0xc248('0x18')](_0xc248('0x13'),_0x346b2e,_0x1b9d5a);_0x9428c1(_0x1b9d5a);});});} \ No newline at end of file +var _0x496f=['stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x177781,_0x136cc1){var _0x128fa2=function(_0xc34c3a){while(--_0xc34c3a){_0x177781['push'](_0x177781['shift']());}};_0x128fa2(++_0x136cc1);}(_0x496f,0x82));var _0xf496=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x496f[_0x238671];return _0x474844;};'use strict';var _=require(_0xf496('0x0'));var util=require(_0xf496('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf496('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf496('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf496('0x4'))('rpc');var config=require(_0xf496('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf496('0x6')][_0xf496('0x7')]({'port':0x232a});config[_0xf496('0x8')]=_[_0xf496('0x9')](config[_0xf496('0x8')],{'host':_0xf496('0xa'),'port':0x18eb});var socket=require(_0xf496('0xb'))(new Redis(config['redis']));require(_0xf496('0xc'))[_0xf496('0xd')](socket);function respondWithRpcPromise(_0x54bf7a,_0x3f1872,_0x1a319f){return new BPromise(function(_0x3744b4,_0x27ee55){return client[_0xf496('0xe')](_0x54bf7a,_0x1a319f)[_0xf496('0xf')](function(_0xdbe5d5){logger[_0xf496('0x10')](_0xf496('0x11'),_0x3f1872,_0xf496('0x12'));logger['debug'](_0xf496('0x13'),_0x3f1872,_0xf496('0x12'),JSON[_0xf496('0x14')](_0xdbe5d5));if(_0xdbe5d5['error']){if(_0xdbe5d5[_0xf496('0x15')]['code']===0x1f4){logger[_0xf496('0x15')](_0xf496('0x11'),_0x3f1872,_0xdbe5d5['error'][_0xf496('0x16')]);return _0x27ee55(_0xdbe5d5[_0xf496('0x15')][_0xf496('0x16')]);}logger['error'](_0xf496('0x11'),_0x3f1872,_0xdbe5d5[_0xf496('0x15')][_0xf496('0x16')]);return _0x3744b4(_0xdbe5d5[_0xf496('0x15')][_0xf496('0x16')]);}else{logger[_0xf496('0x10')](_0xf496('0x11'),_0x3f1872,_0xf496('0x12'));_0x3744b4(_0xdbe5d5[_0xf496('0x17')]['message']);}})[_0xf496('0x18')](function(_0x19859d){logger['error'](_0xf496('0x11'),_0x3f1872,_0x19859d);_0x27ee55(_0x19859d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a180a78..1b76d81 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 _0x6de6=['save','remove','emit','register','userNotification:','./userNotification.events'];(function(_0x3dd225,_0x1dc7eb){var _0x52b7ad=function(_0x4d868d){while(--_0x4d868d){_0x3dd225['push'](_0x3dd225['shift']());}};_0x52b7ad(++_0x1dc7eb);}(_0x6de6,0xcb));var _0x66de=function(_0x2554b6,_0x22e703){_0x2554b6=_0x2554b6-0x0;var _0x4b23b9=_0x6de6[_0x2554b6];return _0x4b23b9;};'use strict';var UserNotificationEvents=require(_0x66de('0x0'));var events=[_0x66de('0x1'),_0x66de('0x2'),'update'];function createListener(_0x59a866,_0x61db08){return function(_0x572d7c){_0x61db08[_0x66de('0x3')](_0x59a866,_0x572d7c);};}function removeListener(_0x2b8bce,_0x4c4ef2){return function(){UserNotificationEvents['removeListener'](_0x2b8bce,_0x4c4ef2);};}exports[_0x66de('0x4')]=function(_0x28a232){for(var _0x3699ee=0x0,_0x10fa00=events['length'];_0x3699ee<_0x10fa00;_0x3699ee++){var _0x4cfd23=events[_0x3699ee];var _0x1587aa=createListener(_0x66de('0x5')+_0x4cfd23,_0x28a232);UserNotificationEvents['on'](_0x4cfd23,_0x1587aa);}}; \ No newline at end of file +var _0x4e8e=['register','length','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0xa36582,_0x47cc9c){var _0x4b3a23=function(_0x1f709f){while(--_0x1f709f){_0xa36582['push'](_0xa36582['shift']());}};_0x4b3a23(++_0x47cc9c);}(_0x4e8e,0xca));var _0xe4e8=function(_0x2442d8,_0x3502b3){_0x2442d8=_0x2442d8-0x0;var _0x22428d=_0x4e8e[_0x2442d8];return _0x22428d;};'use strict';var UserNotificationEvents=require(_0xe4e8('0x0'));var events=[_0xe4e8('0x1'),_0xe4e8('0x2'),_0xe4e8('0x3')];function createListener(_0x2952f5,_0x58c355){return function(_0x230997){_0x58c355[_0xe4e8('0x4')](_0x2952f5,_0x230997);};}function removeListener(_0x11bcc7,_0x2419b3){return function(){UserNotificationEvents[_0xe4e8('0x5')](_0x11bcc7,_0x2419b3);};}exports[_0xe4e8('0x6')]=function(_0x594b9a){for(var _0x5db0bb=0x0,_0x592b7c=events[_0xe4e8('0x7')];_0x5db0bb<_0x592b7c;_0x5db0bb++){var _0x28764a=events[_0x5db0bb];var _0x5c1c02=createListener('userNotification:'+_0x28764a,_0x594b9a);UserNotificationEvents['on'](_0x28764a,_0x5c1c02);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8dfce4c..66eb1ec 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe84953,_0xa2cc7){var _0x2f486f=function(_0x4a0a09){while(--_0x4a0a09){_0xe84953['push'](_0xe84953['shift']());}};_0x2f486f(++_0xa2cc7);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2f43f4,_0x2428b1){var _0x4f4223=function(_0x5b4c1a){while(--_0x5b4c1a){_0x2f43f4['push'](_0x2f43f4['shift']());}};_0x4f4223(++_0x2428b1);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e41691f..81c2381 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 _0x4d4b=['INTEGER','sequelize','exports'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x4d4b,0x1a8));var _0xb4d4=function(_0x46fe27,_0x32d2e0){_0x46fe27=_0x46fe27-0x0;var _0x40122c=_0x4d4b[_0x46fe27];return _0x40122c;};'use strict';var Sequelize=require(_0xb4d4('0x0'));module[_0xb4d4('0x1')]={'penalty':{'type':Sequelize[_0xb4d4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb33=['exports','INTEGER','sequelize'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0xfb33,0x19d));var _0x3fb3=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xfb33[_0x631a3c];return _0x2bdfa3;};'use strict';var Sequelize=require(_0x3fb3('0x0'));module[_0x3fb3('0x1')]={'penalty':{'type':Sequelize[_0x3fb3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 6204396..99797cc 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 _0x8b51=['path','rimraf','../../config/environment','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2906c6,_0x3c7382){var _0x21b5af=function(_0x37cd9a){while(--_0x37cd9a){_0x2906c6['push'](_0x2906c6['shift']());}};_0x21b5af(++_0x3c7382);}(_0x8b51,0x1bd));var _0x18b5=function(_0x36934d,_0x42f73f){_0x36934d=_0x36934d-0x0;var _0x16052e=_0x8b51[_0x36934d];return _0x16052e;};'use strict';var _=require(_0x18b5('0x0'));var util=require(_0x18b5('0x1'));var logger=require(_0x18b5('0x2'))('api');var moment=require(_0x18b5('0x3'));var BPromise=require(_0x18b5('0x4'));var rp=require(_0x18b5('0x5'));var fs=require('fs');var path=require(_0x18b5('0x6'));var rimraf=require(_0x18b5('0x7'));var config=require(_0x18b5('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x444433,_0x3a8bc6){return _0x444433['define'](_0x18b5('0x9'),attributes,{'tableName':_0x18b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eaf=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0x0eaf,0xbe));var _0xf0ea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0eaf[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf0ea('0x0'));var util=require(_0xf0ea('0x1'));var logger=require('../../config/logger')(_0xf0ea('0x2'));var moment=require(_0xf0ea('0x3'));var BPromise=require('bluebird');var rp=require(_0xf0ea('0x4'));var fs=require('fs');var path=require(_0xf0ea('0x5'));var rimraf=require(_0xf0ea('0x6'));var config=require('../../config/environment');var attributes=require(_0xf0ea('0x7'));module['exports']=function(_0x29cd56,_0x3d7a30){return _0x29cd56[_0xf0ea('0x8')](_0xf0ea('0x9'),attributes,{'tableName':_0xf0ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 584624f..a873dd8 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 _0xb82d=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x19a10a,_0x4e6832){var _0xbf0b68=function(_0x4bbb6d){while(--_0x4bbb6d){_0x19a10a['push'](_0x19a10a['shift']());}};_0xbf0b68(++_0x4e6832);}(_0xb82d,0x1af));var _0xdb82=function(_0x4e64b5,_0x2a314a){_0x4e64b5=_0x4e64b5-0x0;var _0x37d275=_0xb82d[_0x4e64b5];return _0x37d275;};'use strict';var _=require(_0xdb82('0x0'));var util=require('util');var moment=require(_0xdb82('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb82('0x2'));var fs=require('fs');var Redis=require(_0xdb82('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb82('0x4'));var logger=require(_0xdb82('0x5'))('rpc');var config=require(_0xdb82('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb82('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3555db,_0x587962,_0x30f03a){return new BPromise(function(_0x1c7570,_0xe0de5c){return client[_0xdb82('0x8')](_0x3555db,_0x30f03a)[_0xdb82('0x9')](function(_0x22aa82){logger[_0xdb82('0xa')](_0xdb82('0xb'),_0x587962,_0xdb82('0xc'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x587962,_0xdb82('0xc'),JSON[_0xdb82('0xd')](_0x22aa82));if(_0x22aa82[_0xdb82('0xe')]){if(_0x22aa82[_0xdb82('0xe')][_0xdb82('0xf')]===0x1f4){logger[_0xdb82('0xe')](_0xdb82('0xb'),_0x587962,_0x22aa82['error'][_0xdb82('0x10')]);return _0xe0de5c(_0x22aa82[_0xdb82('0xe')]['message']);}logger[_0xdb82('0xe')](_0xdb82('0xb'),_0x587962,_0x22aa82[_0xdb82('0xe')][_0xdb82('0x10')]);return _0x1c7570(_0x22aa82[_0xdb82('0xe')]['message']);}else{logger[_0xdb82('0xa')](_0xdb82('0xb'),_0x587962,_0xdb82('0xc'));_0x1c7570(_0x22aa82[_0xdb82('0x11')][_0xdb82('0x10')]);}})['catch'](function(_0x485541){logger[_0xdb82('0xe')](_0xdb82('0xb'),_0x587962,_0x485541);_0xe0de5c(_0x485541);});});} \ No newline at end of file +var _0x9344=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','debug'];(function(_0x36c71b,_0xabb057){var _0x481c56=function(_0x2763d0){while(--_0x2763d0){_0x36c71b['push'](_0x36c71b['shift']());}};_0x481c56(++_0xabb057);}(_0x9344,0x99));var _0x4934=function(_0x3831ed,_0x5e88ce){_0x3831ed=_0x3831ed-0x0;var _0x5521ce=_0x9344[_0x3831ed];return _0x5521ce;};'use strict';var _=require(_0x4934('0x0'));var util=require(_0x4934('0x1'));var moment=require(_0x4934('0x2'));var BPromise=require(_0x4934('0x3'));var rs=require(_0x4934('0x4'));var fs=require('fs');var Redis=require(_0x4934('0x5'));var db=require(_0x4934('0x6'))['db'];var utils=require(_0x4934('0x7'));var logger=require('../../config/logger')(_0x4934('0x8'));var config=require('../../config/environment');var jayson=require(_0x4934('0x9'));var client=jayson[_0x4934('0xa')][_0x4934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ebc85,_0x467761,_0xabd0ea){return new BPromise(function(_0x298f41,_0x1c2158){return client[_0x4934('0xc')](_0x5ebc85,_0xabd0ea)['then'](function(_0x2a13aa){logger[_0x4934('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x467761,'request\x20sent');logger[_0x4934('0xe')](_0x4934('0xf'),_0x467761,_0x4934('0x10'),JSON[_0x4934('0x11')](_0x2a13aa));if(_0x2a13aa['error']){if(_0x2a13aa[_0x4934('0x12')][_0x4934('0x13')]===0x1f4){logger[_0x4934('0x12')](_0x4934('0x14'),_0x467761,_0x2a13aa[_0x4934('0x12')][_0x4934('0x15')]);return _0x1c2158(_0x2a13aa[_0x4934('0x12')][_0x4934('0x15')]);}logger[_0x4934('0x12')](_0x4934('0x14'),_0x467761,_0x2a13aa[_0x4934('0x12')]['message']);return _0x298f41(_0x2a13aa[_0x4934('0x12')]['message']);}else{logger[_0x4934('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x467761,_0x4934('0x10'));_0x298f41(_0x2a13aa[_0x4934('0x16')]['message']);}})[_0x4934('0x17')](function(_0x1536b8){logger[_0x4934('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x467761,_0x1536b8);_0x1c2158(_0x1536b8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ab0015a..21bcba0 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 _0x1ad9=['update','destroy','delete','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','create','post','/:id/clone','clone','addSections','/:id/resources','addResources','put'];(function(_0x1715f8,_0x2ee01a){var _0x54853e=function(_0xc9e425){while(--_0xc9e425){_0x1715f8['push'](_0x1715f8['shift']());}};_0x54853e(++_0x2ee01a);}(_0x1ad9,0x69));var _0x91ad=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x1ad9[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x91ad('0x0'));var util=require(_0x91ad('0x1'));var path=require('path');var timeout=require(_0x91ad('0x2'));var express=require(_0x91ad('0x3'));var router=express[_0x91ad('0x4')]();var fs_extra=require(_0x91ad('0x5'));var auth=require(_0x91ad('0x6'));var interaction=require(_0x91ad('0x7'));var config=require(_0x91ad('0x8'));var controller=require('./userProfile.controller');router[_0x91ad('0x9')]('/',auth[_0x91ad('0xa')](),controller[_0x91ad('0xb')]);router['get'](_0x91ad('0xc'),auth[_0x91ad('0xa')](),controller[_0x91ad('0xd')]);router[_0x91ad('0x9')](_0x91ad('0xe'),auth['isAuthenticated'](),controller[_0x91ad('0xf')]);router[_0x91ad('0x9')](_0x91ad('0x10'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x11')]);router[_0x91ad('0x9')]('/:id/resources',auth[_0x91ad('0xa')](),controller[_0x91ad('0x12')]);router['post']('/',auth[_0x91ad('0xa')](),controller[_0x91ad('0x13')]);router[_0x91ad('0x14')](_0x91ad('0x15'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x16')]);router[_0x91ad('0x14')](_0x91ad('0x10'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x17')]);router[_0x91ad('0x14')](_0x91ad('0x18'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x19')]);router[_0x91ad('0x1a')](_0x91ad('0xe'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x1b')]);router['delete'](_0x91ad('0xe'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x1c')]);router[_0x91ad('0x1d')](_0x91ad('0x10'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x1e')]);router['delete'](_0x91ad('0x18'),auth[_0x91ad('0xa')](),controller[_0x91ad('0x1f')]);module[_0x91ad('0x20')]=router; \ No newline at end of file +var _0x8363=['destroy','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8363,0x1f0));var _0x3836=function(_0xa22583,_0x564cdd){_0xa22583=_0xa22583-0x0;var _0x3e2d07=_0x8363[_0xa22583];return _0x3e2d07;};'use strict';var multer=require(_0x3836('0x0'));var util=require(_0x3836('0x1'));var path=require('path');var timeout=require(_0x3836('0x2'));var express=require(_0x3836('0x3'));var router=express[_0x3836('0x4')]();var fs_extra=require(_0x3836('0x5'));var auth=require(_0x3836('0x6'));var interaction=require(_0x3836('0x7'));var config=require(_0x3836('0x8'));var controller=require(_0x3836('0x9'));router[_0x3836('0xa')]('/',auth[_0x3836('0xb')](),controller[_0x3836('0xc')]);router[_0x3836('0xa')]('/describe',auth[_0x3836('0xb')](),controller[_0x3836('0xd')]);router[_0x3836('0xa')](_0x3836('0xe'),auth[_0x3836('0xb')](),controller['show']);router[_0x3836('0xa')](_0x3836('0xf'),auth['isAuthenticated'](),controller[_0x3836('0x10')]);router[_0x3836('0xa')]('/:id/resources',auth[_0x3836('0xb')](),controller[_0x3836('0x11')]);router[_0x3836('0x12')]('/',auth[_0x3836('0xb')](),controller[_0x3836('0x13')]);router[_0x3836('0x12')](_0x3836('0x14'),auth[_0x3836('0xb')](),controller[_0x3836('0x15')]);router[_0x3836('0x12')](_0x3836('0xf'),auth[_0x3836('0xb')](),controller[_0x3836('0x16')]);router[_0x3836('0x12')]('/:id/resources',auth[_0x3836('0xb')](),controller['addResources']);router[_0x3836('0x17')](_0x3836('0xe'),auth['isAuthenticated'](),controller[_0x3836('0x18')]);router[_0x3836('0x19')]('/:id',auth[_0x3836('0xb')](),controller[_0x3836('0x1a')]);router['delete'](_0x3836('0xf'),auth[_0x3836('0xb')](),controller['removeSections']);router[_0x3836('0x19')]('/:id/resources',auth[_0x3836('0xb')](),controller[_0x3836('0x1b')]);module[_0x3836('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fc7e592..3dd1425 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 _0x6bd1=['join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x37fc07,_0x2ef518){var _0x226b5b=function(_0x28dab2){while(--_0x28dab2){_0x37fc07['push'](_0x37fc07['shift']());}};_0x226b5b(++_0x2ef518);}(_0x6bd1,0x91));var _0x16bd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6bd1[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x16bd('0x0'));module[_0x16bd('0x1')]={'name':{'type':Sequelize[_0x16bd('0x2')],'allowNull':![],'unique':_0x16bd('0x3')},'crudPermissions':{'type':Sequelize[_0x16bd('0x2')],'set':function(_0x57057a){this[_0x16bd('0x4')]('crudPermissions',_0x57057a?_0x57057a[_0x16bd('0x5')](''):[]);},'get':function(){return this[_0x16bd('0x6')](_0x16bd('0x7'))?this[_0x16bd('0x6')]('crudPermissions')[_0x16bd('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x16bd('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x16bd('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa296=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','join'];(function(_0x5dc47b,_0x509a67){var _0xbbcc50=function(_0x1ea1b1){while(--_0x1ea1b1){_0x5dc47b['push'](_0x5dc47b['shift']());}};_0xbbcc50(++_0x509a67);}(_0xa296,0xc3));var _0x6a29=function(_0x3f3519,_0xd53cae){_0x3f3519=_0x3f3519-0x0;var _0x23b6bf=_0xa296[_0x3f3519];return _0x23b6bf;};'use strict';var Sequelize=require(_0x6a29('0x0'));module[_0x6a29('0x1')]={'name':{'type':Sequelize[_0x6a29('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x6a29('0x2')],'set':function(_0x90f5c8){this[_0x6a29('0x3')]('crudPermissions',_0x90f5c8?_0x90f5c8[_0x6a29('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x6a29('0x5')]('crudPermissions')[_0x6a29('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6a29('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6a29('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6a29('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6a29('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6a29('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6a29('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6a29('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 a3264ff..05ccc9e 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 _0x2ff5=['forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','clone','omit','updatedAt','body','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','createdAt','userProfileId','Resources','find','describe','addSections','sequelize','each','push','removeSections','ids','getSections','enabled','includes','subsections'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x1c58f7,_0x42e68d){_0x1c58f7=_0x1c58f7-0x0;var _0x5ab006=_0x2ff5[_0x1c58f7];return _0x5ab006;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52ff('0x0'));var zipdir=require(_0x52ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52ff('0x2'));var moment=require(_0x52ff('0x3'));var BPromise=require(_0x52ff('0x4'));var Mustache=require(_0x52ff('0x5'));var util=require(_0x52ff('0x6'));var path=require(_0x52ff('0x7'));var sox=require('sox');var csv=require(_0x52ff('0x8'));var ejs=require(_0x52ff('0x9'));var fs=require('fs');var fs_extra=require(_0x52ff('0xa'));var _=require('lodash');var squel=require(_0x52ff('0xb'));var crypto=require(_0x52ff('0xc'));var jsforce=require(_0x52ff('0xd'));var deskjs=require(_0x52ff('0xe'));var toCsv=require(_0x52ff('0x8'));var querystring=require(_0x52ff('0xf'));var Papa=require(_0x52ff('0x10'));var Redis=require(_0x52ff('0x11'));var authService=require(_0x52ff('0x12'));var qs=require(_0x52ff('0x13'));var as=require(_0x52ff('0x14'));var hardwareService=require(_0x52ff('0x15'));var logger=require(_0x52ff('0x16'))(_0x52ff('0x17'));var utils=require(_0x52ff('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x52ff('0x19')](config['redis'],{'host':_0x52ff('0x1a'),'port':0x18eb});var socket=require(_0x52ff('0x1b'))(new Redis(config['redis']));require(_0x52ff('0x1c'))[_0x52ff('0x1d')](socket);function respondWithStatusCode(_0x3c787b,_0x2023d3){_0x2023d3=_0x2023d3||0xcc;return function(_0x418202){if(_0x418202){return _0x3c787b[_0x52ff('0x1e')](_0x2023d3);}return _0x3c787b['status'](_0x2023d3)[_0x52ff('0x1f')]();};}function respondWithResult(_0x2b8846,_0x3154b7){_0x3154b7=_0x3154b7||0xc8;return function(_0x4c83f){if(_0x4c83f){return _0x2b8846[_0x52ff('0x20')](_0x3154b7)[_0x52ff('0x21')](_0x4c83f);}};}function respondWithFilteredResult(_0x4ef571,_0x426858){return function(_0x154419){if(_0x154419){var _0x3cbe60=typeof _0x426858[_0x52ff('0x22')]==='undefined'&&typeof _0x426858[_0x52ff('0x23')]===_0x52ff('0x24');var _0xdb6659=_0x154419[_0x52ff('0x25')];var _0x3d008d=_0x3cbe60?0x0:_0x426858[_0x52ff('0x22')];var _0x2ba460=_0x3cbe60?_0x154419[_0x52ff('0x25')]:_0x426858[_0x52ff('0x22')]+_0x426858[_0x52ff('0x23')];var _0x30c1e9;if(_0x2ba460>=_0xdb6659){_0x2ba460=_0xdb6659;_0x30c1e9=0xc8;}else{_0x30c1e9=0xce;}_0x4ef571[_0x52ff('0x20')](_0x30c1e9);return _0x4ef571[_0x52ff('0x26')](_0x52ff('0x27'),_0x3d008d+'-'+_0x2ba460+'/'+_0xdb6659)[_0x52ff('0x21')](_0x154419);}return null;};}function patchUpdates(_0xe68eb5){return function(_0x1414c3){try{jsonpatch[_0x52ff('0x28')](_0x1414c3,_0xe68eb5,!![]);}catch(_0x556779){return BPromise[_0x52ff('0x29')](_0x556779);}return _0x1414c3[_0x52ff('0x2a')]();};}function saveUpdates(_0x1272ac,_0x3accd4){return function(_0x55f32d){if(_0x55f32d){return _0x55f32d[_0x52ff('0x2b')](_0x1272ac)[_0x52ff('0x2c')](function(_0x888232){return _0x888232;});}return null;};}function removeEntity(_0x5a6ebc,_0x5b8905){return function(_0x1ac770){if(_0x1ac770){return _0x1ac770[_0x52ff('0x2d')]()[_0x52ff('0x2c')](function(){_0x5a6ebc[_0x52ff('0x20')](0xcc)[_0x52ff('0x1f')]();});}};}function handleEntityNotFound(_0x1d9b8e,_0x25450b){return function(_0x322260){if(!_0x322260){_0x1d9b8e[_0x52ff('0x1e')](0x194);}return _0x322260;};}function handleError(_0x3a049f,_0xd95637){_0xd95637=_0xd95637||0x1f4;return function(_0x24094b){logger[_0x52ff('0x2e')](_0x24094b[_0x52ff('0x2f')]);if(_0x24094b['name']){delete _0x24094b[_0x52ff('0x30')];}_0x3a049f['status'](_0xd95637)[_0x52ff('0x31')](_0x24094b);};}exports[_0x52ff('0x32')]=function(_0x530abb,_0x2d1cba){var _0x326d23={},_0x264c7c={},_0x2e6c9a={'count':0x0,'rows':[]};var _0x50fd8b=_[_0x52ff('0x33')](db[_0x52ff('0x34')]['rawAttributes'],function(_0x603c97){return{'name':_0x603c97[_0x52ff('0x35')],'type':_0x603c97[_0x52ff('0x36')][_0x52ff('0x37')]};});_0x264c7c['model']=_[_0x52ff('0x33')](_0x50fd8b,_0x52ff('0x30'));_0x264c7c['query']=_[_0x52ff('0x38')](_0x530abb[_0x52ff('0x39')]);_0x264c7c[_0x52ff('0x3a')]=_[_0x52ff('0x3b')](_0x264c7c['model'],_0x264c7c[_0x52ff('0x39')]);_0x326d23['attributes']=_[_0x52ff('0x3b')](_0x264c7c[_0x52ff('0x3c')],qs['fields'](_0x530abb[_0x52ff('0x39')][_0x52ff('0x3d')]));_0x326d23[_0x52ff('0x3e')]=_0x326d23['attributes']['length']?_0x326d23[_0x52ff('0x3e')]:_0x264c7c['model'];if(!_0x530abb[_0x52ff('0x39')]['hasOwnProperty'](_0x52ff('0x3f'))){_0x326d23[_0x52ff('0x23')]=qs['limit'](_0x530abb[_0x52ff('0x39')][_0x52ff('0x23')]);_0x326d23[_0x52ff('0x22')]=qs[_0x52ff('0x22')](_0x530abb[_0x52ff('0x39')][_0x52ff('0x22')]);}_0x326d23[_0x52ff('0x40')]=qs['sort'](_0x530abb[_0x52ff('0x39')][_0x52ff('0x41')]);_0x326d23[_0x52ff('0x42')]=qs[_0x52ff('0x3a')](_[_0x52ff('0x43')](_0x530abb[_0x52ff('0x39')],_0x264c7c[_0x52ff('0x3a')]),_0x50fd8b);if(_0x530abb['query'][_0x52ff('0x44')]){_0x326d23[_0x52ff('0x42')]=_[_0x52ff('0x45')](_0x326d23['where'],{'$or':_['map'](_0x50fd8b,function(_0x3c680b){if(_0x3c680b['type']!==_0x52ff('0x46')){var _0xbbfef8={};_0xbbfef8[_0x3c680b[_0x52ff('0x30')]]={'$like':'%'+_0x530abb[_0x52ff('0x39')][_0x52ff('0x44')]+'%'};return _0xbbfef8;}})});}_0x326d23=_[_0x52ff('0x45')]({},_0x326d23,_0x530abb[_0x52ff('0x47')]);var _0x18a780={'where':_0x326d23[_0x52ff('0x42')]};return db['UserProfile'][_0x52ff('0x25')](_0x18a780)[_0x52ff('0x2c')](function(_0x5a5c37){_0x2e6c9a[_0x52ff('0x25')]=_0x5a5c37;if(_0x530abb[_0x52ff('0x39')][_0x52ff('0x48')]){_0x326d23[_0x52ff('0x49')]=[{'all':!![]}];}return db[_0x52ff('0x34')][_0x52ff('0x4a')](_0x326d23);})[_0x52ff('0x2c')](function(_0x4f18ee){_0x2e6c9a[_0x52ff('0x4b')]=_0x4f18ee;return _0x2e6c9a;})[_0x52ff('0x2c')](respondWithFilteredResult(_0x2d1cba,_0x326d23))[_0x52ff('0x4c')](handleError(_0x2d1cba,null));};exports[_0x52ff('0x4d')]=function(_0x571b8e,_0x4fee7d){var _0x304c80={'raw':![],'where':{'id':_0x571b8e[_0x52ff('0x4e')]['id']}},_0x30c868={};_0x30c868[_0x52ff('0x3c')]=_[_0x52ff('0x38')](db['UserProfile'][_0x52ff('0x4f')]);_0x30c868[_0x52ff('0x39')]=_[_0x52ff('0x38')](_0x571b8e[_0x52ff('0x39')]);_0x30c868[_0x52ff('0x3a')]=_[_0x52ff('0x3b')](_0x30c868[_0x52ff('0x3c')],_0x30c868[_0x52ff('0x39')]);_0x304c80[_0x52ff('0x3e')]=_[_0x52ff('0x3b')](_0x30c868['model'],qs[_0x52ff('0x3d')](_0x571b8e[_0x52ff('0x39')][_0x52ff('0x3d')]));_0x304c80[_0x52ff('0x3e')]=_0x304c80[_0x52ff('0x3e')]['length']?_0x304c80[_0x52ff('0x3e')]:_0x30c868[_0x52ff('0x3c')];if(_0x571b8e['query'][_0x52ff('0x48')]){_0x304c80[_0x52ff('0x49')]=[{'all':!![]}];}_0x304c80=_[_0x52ff('0x45')]({},_0x304c80,_0x571b8e[_0x52ff('0x47')]);return db['UserProfile']['find'](_0x304c80)[_0x52ff('0x2c')](handleEntityNotFound(_0x4fee7d,null))[_0x52ff('0x2c')](respondWithResult(_0x4fee7d,null))[_0x52ff('0x4c')](handleError(_0x4fee7d,null));};exports[_0x52ff('0x50')]=function(_0x427d52,_0xb31bad){return db[_0x52ff('0x34')]['create'](_0x427d52['body'],{})[_0x52ff('0x2c')](respondWithResult(_0xb31bad,0xc9))[_0x52ff('0x4c')](handleError(_0xb31bad,null));};exports[_0x52ff('0x51')]=function(_0x172701,_0x3ab361){var _0x2acff8={'where':{'id':_0x172701[_0x52ff('0x4e')]['id']}},_0x3bf84f={};_0x3bf84f[_0x52ff('0x3c')]=_['keys'](db[_0x52ff('0x34')][_0x52ff('0x4f')]);_0x2acff8[_0x52ff('0x3e')]=_[_0x52ff('0x3b')](_0x3bf84f[_0x52ff('0x3c')],qs['fields'](_0x172701[_0x52ff('0x39')][_0x52ff('0x3d')]));_0x2acff8[_0x52ff('0x3e')]=_0x2acff8[_0x52ff('0x3e')]['length']?_0x2acff8[_0x52ff('0x3e')]:_0x3bf84f[_0x52ff('0x3c')];if(_0x172701[_0x52ff('0x39')][_0x52ff('0x48')]){_0x2acff8[_0x52ff('0x49')]=[{'all':!![]}];}_0x2acff8=_[_0x52ff('0x45')]({},_0x2acff8,_0x172701['options']);return db[_0x52ff('0x34')]['find'](_0x2acff8)[_0x52ff('0x2c')](handleEntityNotFound(_0x3ab361,null))[_0x52ff('0x2c')](function(_0x445cb2){if(_0x445cb2){var _0x1445cf=_0x445cb2['get']({'plain':!![]});_0x1445cf=qs[_0x52ff('0x52')](_0x1445cf,['id','createdAt',_0x52ff('0x53'),'crudPermissions']);_0x172701['body']=_[_0x52ff('0x52')](_0x172701[_0x52ff('0x54')],['id','createdAt',_0x52ff('0x53')]);return db['sequelize'][_0x52ff('0x55')](function(_0x4c95ec){return db[_0x52ff('0x34')][_0x52ff('0x50')](_[_0x52ff('0x45')](_0x1445cf,_0x172701[_0x52ff('0x54')]),{'include':_0x172701['query'][_0x52ff('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x4c95ec})[_0x52ff('0x2c')](function(_0x312c48){var _0x30a071=_0x312c48[_0x52ff('0x56')]({'plain':!![]});return db[_0x52ff('0x57')][_0x52ff('0x4a')]({'where':{'userProfileId':_0x172701['params']['id']},'raw':!![]})['then'](function(_0x4801c3){if(_0x4801c3){return BPromise['each'](_0x4801c3,function(_0x2c1fe9){return new BPromise(function(_0x1e77ad,_0x364fb3){if(_0x2c1fe9[_0x52ff('0x58')]===null||_0x2c1fe9[_0x52ff('0x58')]===0x1)_0x1e77ad(null);return db[_0x52ff('0x59')]['findAll']({'where':{'sectionId':_0x2c1fe9['id']},'raw':!![]})[_0x52ff('0x2c')](function(_0x3443f6){var _0x286dbd=_[_0x52ff('0x33')](_0x3443f6,function(_0x40460f){return qs[_0x52ff('0x52')](_0x40460f,['id','createdAt',_0x52ff('0x53'),_0x52ff('0x5a')]);});_0x1e77ad(_0x286dbd);})[_0x52ff('0x4c')](function(_0x42fadc){_0x364fb3(_0x42fadc);});})[_0x52ff('0x2c')](function(_0x35ec14){var _0x39ed64=qs[_0x52ff('0x52')](_0x2c1fe9,['id',_0x52ff('0x5b'),_0x52ff('0x53')]);_0x39ed64[_0x52ff('0x5c')]=_0x30a071['id'];if(_0x35ec14)_0x39ed64[_0x52ff('0x5d')]=_0x35ec14;return _0x39ed64;})[_0x52ff('0x2c')](function(_0x265370){return db['UserProfileSection'][_0x52ff('0x50')](_0x265370,{'include':[{'model':db[_0x52ff('0x59')],'as':_0x52ff('0x5d')}],'raw':!![],'transaction':_0x4c95ec});});})[_0x52ff('0x2c')](function(){return _0x30a071;});}});});});}})[_0x52ff('0x2c')](respondWithResult(_0x3ab361,0xc9))[_0x52ff('0x4c')](handleError(_0x3ab361,null));};exports[_0x52ff('0x2b')]=function(_0x568e17,_0xfc9c40){if(_0x568e17[_0x52ff('0x54')]['id']){delete _0x568e17[_0x52ff('0x54')]['id'];}return db[_0x52ff('0x34')]['find']({'where':{'id':_0x568e17[_0x52ff('0x4e')]['id']}})[_0x52ff('0x2c')](handleEntityNotFound(_0xfc9c40,null))[_0x52ff('0x2c')](saveUpdates(_0x568e17[_0x52ff('0x54')],null))[_0x52ff('0x2c')](respondWithResult(_0xfc9c40,null))[_0x52ff('0x4c')](handleError(_0xfc9c40,null));};exports[_0x52ff('0x2d')]=function(_0x4a26ef,_0x186534){return db[_0x52ff('0x34')][_0x52ff('0x5e')]({'where':{'id':_0x4a26ef[_0x52ff('0x4e')]['id']}})[_0x52ff('0x2c')](handleEntityNotFound(_0x186534,null))[_0x52ff('0x2c')](removeEntity(_0x186534,null))[_0x52ff('0x4c')](handleError(_0x186534,null));};exports[_0x52ff('0x5f')]=function(_0x1e66fd,_0x565a82){return db['UserProfile'][_0x52ff('0x5f')]()[_0x52ff('0x2c')](respondWithResult(_0x565a82,null))[_0x52ff('0x4c')](handleError(_0x565a82,null));};exports[_0x52ff('0x60')]=function(_0xef16d6,_0x3abae0){var _0xdc235b=_0xef16d6[_0x52ff('0x54')];return db[_0x52ff('0x34')][_0x52ff('0x5e')]({'where':{'id':_0xef16d6['params']['id']}})['then'](handleEntityNotFound(_0x3abae0,null))[_0x52ff('0x2c')](function(_0x353a99){if(_0x353a99){return db[_0x52ff('0x61')][_0x52ff('0x55')](function(_0x1c6ec0){return db[_0x52ff('0x57')][_0x52ff('0x2d')]({'where':{'userProfileId':_0xef16d6[_0x52ff('0x4e')]['id'],'sectionId':_[_0x52ff('0x33')](_0xdc235b,function(_0x316e6){return _0x316e6['sectionId'];})},'transaction':_0x1c6ec0})[_0x52ff('0x2c')](function(){var _0x18c357=_[_0x52ff('0x33')](_0xdc235b,function(_0x33db64){_0x33db64[_0x52ff('0x5c')]=_0xef16d6[_0x52ff('0x4e')]['id'];return _0x33db64;});var _0x4d90ea=[];return BPromise[_0x52ff('0x62')](_0x18c357,function(_0x47f07d){return db[_0x52ff('0x57')]['create'](_0x47f07d,{'include':[{'model':db['UserProfileResource'],'as':_0x52ff('0x5d')}],'raw':!![],'transaction':_0x1c6ec0})[_0x52ff('0x2c')](function(_0x51da79){_0x4d90ea[_0x52ff('0x63')](_0x51da79[_0x52ff('0x56')]({'plain':!![]}));});})[_0x52ff('0x2c')](function(){return _0x4d90ea;});});});}})[_0x52ff('0x2c')](function(_0xb259d7){return _0xb259d7;})['then'](respondWithResult(_0x3abae0,null))[_0x52ff('0x4c')](handleError(_0x3abae0,null));};exports[_0x52ff('0x64')]=function(_0x70737f,_0x39d146){var _0x4f1e54;return db[_0x52ff('0x34')][_0x52ff('0x5e')]({'where':{'id':_0x70737f[_0x52ff('0x4e')]['id']},'attributes':['id',_0x52ff('0x30')]})['then'](handleEntityNotFound(_0x39d146,null))['then'](function(_0x3a053d){if(_0x3a053d){_0x4f1e54=_0x3a053d;return db[_0x52ff('0x57')][_0x52ff('0x2d')]({'where':{'userProfileId':_0x70737f[_0x52ff('0x4e')]['id'],'sectionId':_0x70737f[_0x52ff('0x39')][_0x52ff('0x65')]}});}})['then'](function(){return _0x4f1e54;})[_0x52ff('0x2c')](respondWithStatusCode(_0x39d146,null))[_0x52ff('0x4c')](handleError(_0x39d146,null));};exports[_0x52ff('0x66')]=function(_0x17c41f,_0x427ab4){var _0x1ce2f8=[];var _0x7d530b=[];return db['UserProfileSection'][_0x52ff('0x4a')]({'where':{'userProfileId':_0x17c41f['params']['id']},'raw':!![]})[_0x52ff('0x2c')](function(_0x2396b4){_0x1ce2f8=_[_0x52ff('0x44')](_0x2396b4,function(_0x313376){return _0x313376[_0x52ff('0x67')]===0x1||_[_0x52ff('0x68')]([0x3eb,0x709],_0x313376[_0x52ff('0x5a')]);});if(!_['isEmpty'](_0x1ce2f8)){return _[_0x52ff('0x33')](_0x1ce2f8,function(_0x132537){return _0x132537[_0x52ff('0x5a')];});}else{return;}})[_0x52ff('0x2c')](function(_0x56c794){if(_0x56c794)_0x7d530b=_0x56c794;if(_[_0x52ff('0x68')](_0x7d530b,0x64)){var _0x3539fa=_['find'](_0x1ce2f8,{'sectionId':0x64});return hasDefaultDashboard(_0x3539fa)[_0x52ff('0x2c')](function(_0x36a4c5){return _[_0x52ff('0x33')](_0x1ce2f8,function(_0x312165){if(_0x312165[_0x52ff('0x5a')]===0x64){_0x312165['subsections']=_0x36a4c5;}return _0x312165;});});}else{return;}})[_0x52ff('0x2c')](function(_0x136ebb){if(_0x136ebb)_0x1ce2f8=_0x136ebb;if(_[_0x52ff('0x68')](_0x7d530b,0x3eb)){var _0x2ef3dc=_[_0x52ff('0x5e')](_0x1ce2f8,{'sectionId':0x3eb});return getCustomDashboards(_0x2ef3dc)[_0x52ff('0x2c')](function(_0x2f588c){return _[_0x52ff('0x33')](_0x1ce2f8,function(_0x584ec0){if(_0x2ef3dc[_0x52ff('0x67')]){if(_0x584ec0[_0x52ff('0x5a')]===0x3eb){_0x584ec0[_0x52ff('0x69')]=_0x2f588c;}}else{if(_0x584ec0[_0x52ff('0x5a')]===0x64){_0x584ec0[_0x52ff('0x69')]=_0x2f588c;}}return _0x584ec0;});});}else{return;}})['then'](function(_0x429292){if(_0x429292)_0x1ce2f8=_0x429292;if(_[_0x52ff('0x68')](_0x7d530b,0x709)){var _0x5ebcdb=_[_0x52ff('0x5e')](_0x1ce2f8,{'sectionId':0x709});return getPlugins(_0x5ebcdb)['then'](function(_0x1ef0aa){if(_0x5ebcdb[_0x52ff('0x67')]){return _['map'](_0x1ce2f8,function(_0x4e4816){if(_0x4e4816[_0x52ff('0x5a')]===0x709){_0x4e4816[_0x52ff('0x69')]=_0x1ef0aa;}return _0x4e4816;});}else{var _0x21ea9d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1ef0aa};var _0x3e5036=_[_0x52ff('0x33')](_0x1ce2f8);_0x3e5036[_0x52ff('0x63')](_0x21ea9d);return _0x3e5036;}});}else{return;}})[_0x52ff('0x2c')](function(_0x43fd1c){if(_0x43fd1c)_0x1ce2f8=_0x43fd1c;return _[_0x52ff('0x44')](_0x1ce2f8,['enabled',0x1]);})[_0x52ff('0x2c')](respondWithResult(_0x427ab4,null))[_0x52ff('0x4c')](handleError(_0x427ab4,null));};function hasDefaultDashboard(_0xa1335a){var _0x196430=[0x65];return new BPromise(function(_0x897df2,_0x2feb08){try{if(_0xa1335a[_0x52ff('0x58')]){_0x897df2(_0x196430);}else{return db[_0x52ff('0x59')]['findOne']({'where':{'sectionId':_0xa1335a['id']},'raw':!![]})[_0x52ff('0x2c')](function(_0x38ec5c){_0x38ec5c?_0x897df2(_0x196430):_0x897df2();});}}catch(_0x281b67){_0x2feb08(_0x281b67);}});}function getCustomDashboards(_0x47463f){var _0x4db09d=[];return new BPromise(function(_0x1af88e,_0x47e1e7){try{if(_0x47463f['autoAssociation']){return db['Dashboard'][_0x52ff('0x4a')]({'raw':!![]})[_0x52ff('0x2c')](function(_0xaf330b){_0xaf330b[_0x52ff('0x6a')](function(_0x560700){_0x4db09d[_0x52ff('0x63')](_0x560700['id']+0x1869f);});_0x1af88e(_0x4db09d);});}else{return db[_0x52ff('0x59')][_0x52ff('0x4a')]({'where':{'sectionId':_0x47463f['id']},'raw':!![]})[_0x52ff('0x2c')](function(_0x314a18){_0x314a18[_0x52ff('0x6a')](function(_0xb008ab){_0x4db09d[_0x52ff('0x63')](_0xb008ab[_0x52ff('0x6b')]+0x1869f);});_0x1af88e(_0x4db09d);});}}catch(_0x15e563){_0x47e1e7(_0x15e563);}});}function getPlugins(_0x5c6574){var _0x16932d=[];return new BPromise(function(_0x3e51ce,_0x41b62c){try{if(_0x5c6574[_0x52ff('0x58')]){return db[_0x52ff('0x6c')][_0x52ff('0x4a')]({'raw':!![]})[_0x52ff('0x2c')](function(_0x51e380){_0x51e380[_0x52ff('0x6a')](function(_0xcc8a3){_0x16932d[_0x52ff('0x63')](_0xcc8a3['id']+0x15b38);});_0x3e51ce(_0x16932d);});}else{return db['UserProfileResource'][_0x52ff('0x4a')]({'where':{'sectionId':_0x5c6574['id']},'raw':!![]})[_0x52ff('0x2c')](function(_0x4aa08e){_0x4aa08e['forEach'](function(_0x4bab0b){_0x16932d[_0x52ff('0x63')](_0x4bab0b[_0x52ff('0x6b')]+0x15b38);});_0x3e51ce(_0x16932d);});}}catch(_0x19b603){_0x41b62c(_0x19b603);}});}exports[_0x52ff('0x6d')]=function(_0x38b25a,_0x56fef6){return db[_0x52ff('0x34')][_0x52ff('0x5e')]({'where':{'id':_0x38b25a[_0x52ff('0x4e')]['id']}})[_0x52ff('0x2c')](handleEntityNotFound(_0x56fef6,null))[_0x52ff('0x2c')](function(_0x14ee25){if(_0x14ee25){return db[_0x52ff('0x61')][_0x52ff('0x55')](function(_0x450f2f){return db[_0x52ff('0x57')][_0x52ff('0x4a')]({'where':{'userProfileId':_0x38b25a[_0x52ff('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x52ff('0x2c')](function(_0x285192){if(_0x285192){return db[_0x52ff('0x57')][_0x52ff('0x2d')]({'where':{'userProfileId':_0x38b25a[_0x52ff('0x4e')]['id'],'id':_[_0x52ff('0x33')](_0x285192,function(_0x5087af){return _0x5087af['id'];})},'transaction':_0x450f2f});}})[_0x52ff('0x2c')](function(_0x3abbf9){var _0x3b024a=_[_0x52ff('0x33')](_0x38b25a[_0x52ff('0x54')],function(_0x3c2ddb){_0x3c2ddb['userProfileId']=_0x38b25a['params']['id'];return _0x3c2ddb;});return db[_0x52ff('0x57')][_0x52ff('0x6e')](_0x3b024a,{'raw':!![],'transaction':_0x450f2f});})[_0x52ff('0x2c')](function(_0x3e10b2){var _0x58076a=_[_0x52ff('0x44')](_[_0x52ff('0x33')](_0x3e10b2,function(_0x1fdc86){return _0x1fdc86[_0x52ff('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x58076a){return db[_0x52ff('0x57')][_0x52ff('0x4a')]({'where':{'userProfileId':_0x38b25a[_0x52ff('0x4e')]['id'],'sectionId':_[_0x52ff('0x33')](_0x58076a,function(_0x257d03){return _0x257d03[_0x52ff('0x5a')];})},'attributes':['id',_0x52ff('0x5a')],'raw':!![]})['then'](function(_0x1bfcd4){var _0xdc2520=_['map'](_0x38b25a[_0x52ff('0x54')],function(_0xa2db0a){_0xa2db0a[_0x52ff('0x5c')]=_0x38b25a[_0x52ff('0x4e')]['id'];return _0xa2db0a;});return db[_0x52ff('0x59')][_0x52ff('0x6e')](_0xdc2520,{'raw':!![],'transaction':_0x450f2f});});}})['catch'](handleError(_0x56fef6,null));});}})[_0x52ff('0x2c')](function(_0x4e0eb1){var _0x13259e=_[_0x52ff('0x33')](_0x4e0eb1,function(_0x32de71){return _0x32de71[_0x52ff('0x56')]({'plain':!![]});});})[_0x52ff('0x2c')](respondWithResult(_0x56fef6,null))[_0x52ff('0x4c')](handleError(_0x56fef6,null));};exports['removeResources']=function(_0x2b6eeb,_0x13d7ad,_0x6a3192){return db[_0x52ff('0x34')]['find']({'where':{'id':_0x2b6eeb[_0x52ff('0x4e')]['id']}})[_0x52ff('0x2c')](handleEntityNotFound(_0x13d7ad,null))[_0x52ff('0x2c')](function(_0x318514){if(_0x318514){return _0x318514['removeResources'](_0x2b6eeb[_0x52ff('0x39')][_0x52ff('0x65')]);}})[_0x52ff('0x2c')](respondWithStatusCode(_0x13d7ad,null))[_0x52ff('0x4c')](handleError(_0x13d7ad,null));};exports[_0x52ff('0x6f')]=function(_0x1eeb9d,_0x449d6a){var _0x1a1b6c={};if(!_0x1eeb9d[_0x52ff('0x39')][_0x52ff('0x70')])throw new Error(_0x52ff('0x71'));if(!_0x1eeb9d['query'][_0x52ff('0x72')](_0x52ff('0x3f'))){_0x1a1b6c['limit']=qs[_0x52ff('0x23')](_0x1eeb9d[_0x52ff('0x39')][_0x52ff('0x23')]);_0x1a1b6c[_0x52ff('0x22')]=qs[_0x52ff('0x22')](_0x1eeb9d[_0x52ff('0x39')][_0x52ff('0x22')]);}return db[_0x52ff('0x34')][_0x52ff('0x5e')]({'where':{'id':_0x1eeb9d[_0x52ff('0x4e')]['id']}})['then'](function(_0x30d7ef){if(!_0x30d7ef)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1eeb9d[_0x52ff('0x4e')]['id']);return db[_0x52ff('0x34')][_0x52ff('0x6f')](_0x1eeb9d);})[_0x52ff('0x2c')](respondWithFilteredResult(_0x449d6a,_0x1a1b6c))[_0x52ff('0x4c')](handleError(_0x449d6a,null));}; \ No newline at end of file +var _0x57ca=['createdAt','updatedAt','crudPermissions','body','sequelize','transaction','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','UserProfile','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','rows','params','rawAttributes','fields','length','includeAll','include','options','find','create','catch','clone','get','omit'];(function(_0x2d892a,_0x59e61a){var _0x367765=function(_0x1c9901){while(--_0x1c9901){_0x2d892a['push'](_0x2d892a['shift']());}};_0x367765(++_0x59e61a);}(_0x57ca,0x108));var _0xa57c=function(_0xb0ce7b,_0x25894a){_0xb0ce7b=_0xb0ce7b-0x0;var _0x1e2f01=_0x57ca[_0xb0ce7b];return _0x1e2f01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];config[_0xa57c('0x17')]=_[_0xa57c('0x18')](config[_0xa57c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa57c('0x19'))(new Redis(config['redis']));require(_0xa57c('0x1a'))[_0xa57c('0x1b')](socket);function respondWithStatusCode(_0x30940d,_0x3821d2){_0x3821d2=_0x3821d2||0xcc;return function(_0x3238ff){if(_0x3238ff){return _0x30940d[_0xa57c('0x1c')](_0x3821d2);}return _0x30940d[_0xa57c('0x1d')](_0x3821d2)['end']();};}function respondWithResult(_0x26607a,_0xdf7ff6){_0xdf7ff6=_0xdf7ff6||0xc8;return function(_0x261725){if(_0x261725){return _0x26607a['status'](_0xdf7ff6)[_0xa57c('0x1e')](_0x261725);}};}function respondWithFilteredResult(_0x5f33f1,_0x3e7afa){return function(_0x3d781d){if(_0x3d781d){var _0x93462c=typeof _0x3e7afa[_0xa57c('0x1f')]===_0xa57c('0x20')&&typeof _0x3e7afa[_0xa57c('0x21')]===_0xa57c('0x20');var _0x595c7a=_0x3d781d['count'];var _0x8a8856=_0x93462c?0x0:_0x3e7afa['offset'];var _0x4a35bb=_0x93462c?_0x3d781d[_0xa57c('0x22')]:_0x3e7afa[_0xa57c('0x1f')]+_0x3e7afa[_0xa57c('0x21')];var _0x23bec0;if(_0x4a35bb>=_0x595c7a){_0x4a35bb=_0x595c7a;_0x23bec0=0xc8;}else{_0x23bec0=0xce;}_0x5f33f1['status'](_0x23bec0);return _0x5f33f1[_0xa57c('0x23')](_0xa57c('0x24'),_0x8a8856+'-'+_0x4a35bb+'/'+_0x595c7a)[_0xa57c('0x1e')](_0x3d781d);}return null;};}function patchUpdates(_0x2213b2){return function(_0x3bb969){try{jsonpatch[_0xa57c('0x25')](_0x3bb969,_0x2213b2,!![]);}catch(_0x1e0192){return BPromise[_0xa57c('0x26')](_0x1e0192);}return _0x3bb969[_0xa57c('0x27')]();};}function saveUpdates(_0xdf65dd,_0x382a26){return function(_0x1e7f7a){if(_0x1e7f7a){return _0x1e7f7a[_0xa57c('0x28')](_0xdf65dd)[_0xa57c('0x29')](function(_0x431bec){return _0x431bec;});}return null;};}function removeEntity(_0x511a26,_0x2db443){return function(_0x5226d0){if(_0x5226d0){return _0x5226d0[_0xa57c('0x2a')]()[_0xa57c('0x29')](function(){_0x511a26[_0xa57c('0x1d')](0xcc)[_0xa57c('0x2b')]();});}};}function handleEntityNotFound(_0x8ee1c0,_0xe50fb8){return function(_0x337f97){if(!_0x337f97){_0x8ee1c0[_0xa57c('0x1c')](0x194);}return _0x337f97;};}function handleError(_0x57ebe0,_0x3b7364){_0x3b7364=_0x3b7364||0x1f4;return function(_0x4c1478){logger['error'](_0x4c1478[_0xa57c('0x2c')]);if(_0x4c1478[_0xa57c('0x2d')]){delete _0x4c1478['name'];}_0x57ebe0[_0xa57c('0x1d')](_0x3b7364)[_0xa57c('0x2e')](_0x4c1478);};}exports[_0xa57c('0x2f')]=function(_0x57565b,_0xd779f1){var _0x58d46f={},_0xf5f70c={},_0x5464f2={'count':0x0,'rows':[]};var _0x2a3bbe=_['map'](db[_0xa57c('0x30')]['rawAttributes'],function(_0x9e02bb){return{'name':_0x9e02bb[_0xa57c('0x31')],'type':_0x9e02bb[_0xa57c('0x32')][_0xa57c('0x33')]};});_0xf5f70c[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x2a3bbe,_0xa57c('0x2d'));_0xf5f70c['query']=_[_0xa57c('0x36')](_0x57565b['query']);_0xf5f70c[_0xa57c('0x37')]=_[_0xa57c('0x38')](_0xf5f70c[_0xa57c('0x34')],_0xf5f70c['query']);_0x58d46f[_0xa57c('0x39')]=_['intersection'](_0xf5f70c[_0xa57c('0x34')],qs['fields'](_0x57565b[_0xa57c('0x3a')]['fields']));_0x58d46f[_0xa57c('0x39')]=_0x58d46f[_0xa57c('0x39')]['length']?_0x58d46f[_0xa57c('0x39')]:_0xf5f70c['model'];if(!_0x57565b[_0xa57c('0x3a')]['hasOwnProperty'](_0xa57c('0x3b'))){_0x58d46f[_0xa57c('0x21')]=qs[_0xa57c('0x21')](_0x57565b[_0xa57c('0x3a')][_0xa57c('0x21')]);_0x58d46f[_0xa57c('0x1f')]=qs['offset'](_0x57565b['query'][_0xa57c('0x1f')]);}_0x58d46f[_0xa57c('0x3c')]=qs[_0xa57c('0x3d')](_0x57565b['query'][_0xa57c('0x3d')]);_0x58d46f['where']=qs[_0xa57c('0x37')](_[_0xa57c('0x3e')](_0x57565b['query'],_0xf5f70c['filters']),_0x2a3bbe);if(_0x57565b['query'][_0xa57c('0x3f')]){_0x58d46f[_0xa57c('0x40')]=_[_0xa57c('0x41')](_0x58d46f[_0xa57c('0x40')],{'$or':_[_0xa57c('0x35')](_0x2a3bbe,function(_0x1b98a0){if(_0x1b98a0['type']!==_0xa57c('0x42')){var _0x1d4d2e={};_0x1d4d2e[_0x1b98a0['name']]={'$like':'%'+_0x57565b['query'][_0xa57c('0x3f')]+'%'};return _0x1d4d2e;}})});}_0x58d46f=_[_0xa57c('0x41')]({},_0x58d46f,_0x57565b['options']);var _0x24459a={'where':_0x58d46f[_0xa57c('0x40')]};return db[_0xa57c('0x30')][_0xa57c('0x22')](_0x24459a)[_0xa57c('0x29')](function(_0x43c1d7){_0x5464f2['count']=_0x43c1d7;if(_0x57565b[_0xa57c('0x3a')]['includeAll']){_0x58d46f['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x58d46f);})['then'](function(_0x39b20f){_0x5464f2[_0xa57c('0x43')]=_0x39b20f;return _0x5464f2;})[_0xa57c('0x29')](respondWithFilteredResult(_0xd779f1,_0x58d46f))['catch'](handleError(_0xd779f1,null));};exports['show']=function(_0x49e072,_0x44f1e8){var _0x2755bc={'raw':![],'where':{'id':_0x49e072[_0xa57c('0x44')]['id']}},_0x44e38f={};_0x44e38f[_0xa57c('0x34')]=_[_0xa57c('0x36')](db['UserProfile'][_0xa57c('0x45')]);_0x44e38f[_0xa57c('0x3a')]=_[_0xa57c('0x36')](_0x49e072[_0xa57c('0x3a')]);_0x44e38f[_0xa57c('0x37')]=_[_0xa57c('0x38')](_0x44e38f['model'],_0x44e38f[_0xa57c('0x3a')]);_0x2755bc[_0xa57c('0x39')]=_[_0xa57c('0x38')](_0x44e38f[_0xa57c('0x34')],qs[_0xa57c('0x46')](_0x49e072['query'][_0xa57c('0x46')]));_0x2755bc[_0xa57c('0x39')]=_0x2755bc[_0xa57c('0x39')][_0xa57c('0x47')]?_0x2755bc[_0xa57c('0x39')]:_0x44e38f[_0xa57c('0x34')];if(_0x49e072['query'][_0xa57c('0x48')]){_0x2755bc[_0xa57c('0x49')]=[{'all':!![]}];}_0x2755bc=_[_0xa57c('0x41')]({},_0x2755bc,_0x49e072[_0xa57c('0x4a')]);return db[_0xa57c('0x30')][_0xa57c('0x4b')](_0x2755bc)['then'](handleEntityNotFound(_0x44f1e8,null))['then'](respondWithResult(_0x44f1e8,null))['catch'](handleError(_0x44f1e8,null));};exports['create']=function(_0x232675,_0x49492f){return db[_0xa57c('0x30')][_0xa57c('0x4c')](_0x232675['body'],{})[_0xa57c('0x29')](respondWithResult(_0x49492f,0xc9))[_0xa57c('0x4d')](handleError(_0x49492f,null));};exports[_0xa57c('0x4e')]=function(_0x128ea2,_0x3ef77c){var _0x5088f0={'where':{'id':_0x128ea2[_0xa57c('0x44')]['id']}},_0x1414e6={};_0x1414e6[_0xa57c('0x34')]=_[_0xa57c('0x36')](db[_0xa57c('0x30')]['rawAttributes']);_0x5088f0[_0xa57c('0x39')]=_['intersection'](_0x1414e6['model'],qs[_0xa57c('0x46')](_0x128ea2[_0xa57c('0x3a')][_0xa57c('0x46')]));_0x5088f0['attributes']=_0x5088f0['attributes'][_0xa57c('0x47')]?_0x5088f0[_0xa57c('0x39')]:_0x1414e6[_0xa57c('0x34')];if(_0x128ea2[_0xa57c('0x3a')]['includeAll']){_0x5088f0[_0xa57c('0x49')]=[{'all':!![]}];}_0x5088f0=_[_0xa57c('0x41')]({},_0x5088f0,_0x128ea2[_0xa57c('0x4a')]);return db['UserProfile']['find'](_0x5088f0)[_0xa57c('0x29')](handleEntityNotFound(_0x3ef77c,null))[_0xa57c('0x29')](function(_0x4d5d46){if(_0x4d5d46){var _0x368a07=_0x4d5d46[_0xa57c('0x4f')]({'plain':!![]});_0x368a07=qs[_0xa57c('0x50')](_0x368a07,['id',_0xa57c('0x51'),_0xa57c('0x52'),_0xa57c('0x53')]);_0x128ea2[_0xa57c('0x54')]=_['omit'](_0x128ea2['body'],['id',_0xa57c('0x51'),_0xa57c('0x52')]);return db[_0xa57c('0x55')][_0xa57c('0x56')](function(_0x15aeb7){return db[_0xa57c('0x30')][_0xa57c('0x4c')](_[_0xa57c('0x41')](_0x368a07,_0x128ea2['body']),{'include':_0x128ea2['query'][_0xa57c('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x15aeb7})['then'](function(_0x1880e6){var _0x1da3ef=_0x1880e6[_0xa57c('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0xa57c('0x57')]({'where':{'userProfileId':_0x128ea2['params']['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x4b3416){if(_0x4b3416){return BPromise[_0xa57c('0x58')](_0x4b3416,function(_0x170187){return new BPromise(function(_0x398743,_0x26a8e1){if(_0x170187['autoAssociation']===null||_0x170187[_0xa57c('0x59')]===0x1)_0x398743(null);return db[_0xa57c('0x5a')][_0xa57c('0x57')]({'where':{'sectionId':_0x170187['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x3345d5){var _0x5cad7e=_[_0xa57c('0x35')](_0x3345d5,function(_0x60b805){return qs[_0xa57c('0x50')](_0x60b805,['id',_0xa57c('0x51'),_0xa57c('0x52'),_0xa57c('0x5b')]);});_0x398743(_0x5cad7e);})[_0xa57c('0x4d')](function(_0x419527){_0x26a8e1(_0x419527);});})[_0xa57c('0x29')](function(_0x41041f){var _0x5a046e=qs[_0xa57c('0x50')](_0x170187,['id',_0xa57c('0x51'),_0xa57c('0x52')]);_0x5a046e[_0xa57c('0x5c')]=_0x1da3ef['id'];if(_0x41041f)_0x5a046e[_0xa57c('0x5d')]=_0x41041f;return _0x5a046e;})[_0xa57c('0x29')](function(_0x5440c2){return db[_0xa57c('0x5e')][_0xa57c('0x4c')](_0x5440c2,{'include':[{'model':db['UserProfileResource'],'as':_0xa57c('0x5d')}],'raw':!![],'transaction':_0x15aeb7});});})[_0xa57c('0x29')](function(){return _0x1da3ef;});}});});});}})[_0xa57c('0x29')](respondWithResult(_0x3ef77c,0xc9))[_0xa57c('0x4d')](handleError(_0x3ef77c,null));};exports[_0xa57c('0x28')]=function(_0x255cef,_0x24efa0){if(_0x255cef['body']['id']){delete _0x255cef[_0xa57c('0x54')]['id'];}return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x255cef['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x24efa0,null))['then'](saveUpdates(_0x255cef[_0xa57c('0x54')],null))[_0xa57c('0x29')](respondWithResult(_0x24efa0,null))['catch'](handleError(_0x24efa0,null));};exports[_0xa57c('0x2a')]=function(_0x23302d,_0x2dbd17){return db[_0xa57c('0x30')]['find']({'where':{'id':_0x23302d[_0xa57c('0x44')]['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x2dbd17,null))[_0xa57c('0x29')](removeEntity(_0x2dbd17,null))[_0xa57c('0x4d')](handleError(_0x2dbd17,null));};exports[_0xa57c('0x5f')]=function(_0x3d766a,_0x308ce5){return db[_0xa57c('0x30')][_0xa57c('0x5f')]()[_0xa57c('0x29')](respondWithResult(_0x308ce5,null))[_0xa57c('0x4d')](handleError(_0x308ce5,null));};exports[_0xa57c('0x60')]=function(_0x27ab1b,_0x83e9c7){var _0x23552a=_0x27ab1b[_0xa57c('0x54')];return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x27ab1b['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x83e9c7,null))[_0xa57c('0x29')](function(_0x245238){if(_0x245238){return db['sequelize'][_0xa57c('0x56')](function(_0x2ccc4d){return db[_0xa57c('0x5e')]['destroy']({'where':{'userProfileId':_0x27ab1b['params']['id'],'sectionId':_[_0xa57c('0x35')](_0x23552a,function(_0x39aa65){return _0x39aa65[_0xa57c('0x5b')];})},'transaction':_0x2ccc4d})[_0xa57c('0x29')](function(){var _0x3fd9aa=_[_0xa57c('0x35')](_0x23552a,function(_0x2a7aab){_0x2a7aab[_0xa57c('0x5c')]=_0x27ab1b[_0xa57c('0x44')]['id'];return _0x2a7aab;});var _0x57b6a3=[];return BPromise[_0xa57c('0x58')](_0x3fd9aa,function(_0x29951e){return db['UserProfileSection'][_0xa57c('0x4c')](_0x29951e,{'include':[{'model':db[_0xa57c('0x5a')],'as':_0xa57c('0x5d')}],'raw':!![],'transaction':_0x2ccc4d})[_0xa57c('0x29')](function(_0x1bb561){_0x57b6a3[_0xa57c('0x61')](_0x1bb561[_0xa57c('0x4f')]({'plain':!![]}));});})[_0xa57c('0x29')](function(){return _0x57b6a3;});});});}})['then'](function(_0x2960fd){return _0x2960fd;})[_0xa57c('0x29')](respondWithResult(_0x83e9c7,null))['catch'](handleError(_0x83e9c7,null));};exports[_0xa57c('0x62')]=function(_0x4a74d7,_0x5454cb){var _0x538f77;return db[_0xa57c('0x30')][_0xa57c('0x4b')]({'where':{'id':_0x4a74d7[_0xa57c('0x44')]['id']},'attributes':['id',_0xa57c('0x2d')]})[_0xa57c('0x29')](handleEntityNotFound(_0x5454cb,null))['then'](function(_0x2796ab){if(_0x2796ab){_0x538f77=_0x2796ab;return db[_0xa57c('0x5e')][_0xa57c('0x2a')]({'where':{'userProfileId':_0x4a74d7['params']['id'],'sectionId':_0x4a74d7[_0xa57c('0x3a')]['ids']}});}})[_0xa57c('0x29')](function(){return _0x538f77;})[_0xa57c('0x29')](respondWithStatusCode(_0x5454cb,null))[_0xa57c('0x4d')](handleError(_0x5454cb,null));};exports[_0xa57c('0x63')]=function(_0x4cf28c,_0x3740e9){var _0xc0a581=[];var _0x1c5e86=[];return db[_0xa57c('0x5e')]['findAll']({'where':{'userProfileId':_0x4cf28c[_0xa57c('0x44')]['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x44e547){_0xc0a581=_['filter'](_0x44e547,function(_0x3da413){return _0x3da413[_0xa57c('0x64')]===0x1||_[_0xa57c('0x65')]([0x3eb,0x709],_0x3da413['sectionId']);});if(!_[_0xa57c('0x66')](_0xc0a581)){return _[_0xa57c('0x35')](_0xc0a581,function(_0x32870a){return _0x32870a[_0xa57c('0x5b')];});}else{return;}})['then'](function(_0x2a58b5){if(_0x2a58b5)_0x1c5e86=_0x2a58b5;if(_[_0xa57c('0x65')](_0x1c5e86,0x64)){var _0x5c92ec=_[_0xa57c('0x4b')](_0xc0a581,{'sectionId':0x64});return hasDefaultDashboard(_0x5c92ec)[_0xa57c('0x29')](function(_0x59d2a2){return _[_0xa57c('0x35')](_0xc0a581,function(_0x4d4524){if(_0x4d4524[_0xa57c('0x5b')]===0x64){_0x4d4524[_0xa57c('0x67')]=_0x59d2a2;}return _0x4d4524;});});}else{return;}})[_0xa57c('0x29')](function(_0x37c00d){if(_0x37c00d)_0xc0a581=_0x37c00d;if(_['includes'](_0x1c5e86,0x3eb)){var _0x40a8db=_[_0xa57c('0x4b')](_0xc0a581,{'sectionId':0x3eb});return getCustomDashboards(_0x40a8db)[_0xa57c('0x29')](function(_0x2dfd3c){return _[_0xa57c('0x35')](_0xc0a581,function(_0x18e6ac){if(_0x40a8db[_0xa57c('0x64')]){if(_0x18e6ac[_0xa57c('0x5b')]===0x3eb){_0x18e6ac[_0xa57c('0x67')]=_0x2dfd3c;}}else{if(_0x18e6ac[_0xa57c('0x5b')]===0x64){_0x18e6ac[_0xa57c('0x67')]=_0x2dfd3c;}}return _0x18e6ac;});});}else{return;}})['then'](function(_0x488c35){if(_0x488c35)_0xc0a581=_0x488c35;if(_['includes'](_0x1c5e86,0x709)){var _0x29b491=_['find'](_0xc0a581,{'sectionId':0x709});return getPlugins(_0x29b491)[_0xa57c('0x29')](function(_0x442dc7){if(_0x29b491[_0xa57c('0x64')]){return _['map'](_0xc0a581,function(_0x21c428){if(_0x21c428[_0xa57c('0x5b')]===0x709){_0x21c428[_0xa57c('0x67')]=_0x442dc7;}return _0x21c428;});}else{var _0x39ae13={'sectionId':0x76c,'enabled':0x1,'subsections':_0x442dc7};var _0x42a273=_[_0xa57c('0x35')](_0xc0a581);_0x42a273[_0xa57c('0x61')](_0x39ae13);return _0x42a273;}});}else{return;}})['then'](function(_0xcebd5e){if(_0xcebd5e)_0xc0a581=_0xcebd5e;return _[_0xa57c('0x3f')](_0xc0a581,['enabled',0x1]);})['then'](respondWithResult(_0x3740e9,null))[_0xa57c('0x4d')](handleError(_0x3740e9,null));};function hasDefaultDashboard(_0x201983){var _0x4fc97e=[0x65];return new BPromise(function(_0x4edd10,_0xc5f17e){try{if(_0x201983['autoAssociation']){_0x4edd10(_0x4fc97e);}else{return db[_0xa57c('0x5a')][_0xa57c('0x68')]({'where':{'sectionId':_0x201983['id']},'raw':!![]})['then'](function(_0x1cda66){_0x1cda66?_0x4edd10(_0x4fc97e):_0x4edd10();});}}catch(_0x1706f1){_0xc5f17e(_0x1706f1);}});}function getCustomDashboards(_0x44558f){var _0x3df8f5=[];return new BPromise(function(_0x562e79,_0x4dd551){try{if(_0x44558f[_0xa57c('0x59')]){return db['Dashboard'][_0xa57c('0x57')]({'raw':!![]})[_0xa57c('0x29')](function(_0x4a2b64){_0x4a2b64['forEach'](function(_0x4925da){_0x3df8f5[_0xa57c('0x61')](_0x4925da['id']+0x1869f);});_0x562e79(_0x3df8f5);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x44558f['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x2c3d8d){_0x2c3d8d[_0xa57c('0x69')](function(_0x49d03b){_0x3df8f5[_0xa57c('0x61')](_0x49d03b[_0xa57c('0x6a')]+0x1869f);});_0x562e79(_0x3df8f5);});}}catch(_0x11e592){_0x4dd551(_0x11e592);}});}function getPlugins(_0x5bbb59){var _0x4b8228=[];return new BPromise(function(_0x19f190,_0x5079ce){try{if(_0x5bbb59[_0xa57c('0x59')]){return db[_0xa57c('0x6b')]['findAll']({'raw':!![]})[_0xa57c('0x29')](function(_0x55261e){_0x55261e['forEach'](function(_0x5db013){_0x4b8228[_0xa57c('0x61')](_0x5db013['id']+0x15b38);});_0x19f190(_0x4b8228);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5bbb59['id']},'raw':!![]})['then'](function(_0x3e12e5){_0x3e12e5[_0xa57c('0x69')](function(_0x54feaa){_0x4b8228[_0xa57c('0x61')](_0x54feaa[_0xa57c('0x6a')]+0x15b38);});_0x19f190(_0x4b8228);});}}catch(_0x25298c){_0x5079ce(_0x25298c);}});}exports['addResources']=function(_0x31be8e,_0xed49ba){return db[_0xa57c('0x30')][_0xa57c('0x4b')]({'where':{'id':_0x31be8e['params']['id']}})['then'](handleEntityNotFound(_0xed49ba,null))[_0xa57c('0x29')](function(_0x512e3d){if(_0x512e3d){return db[_0xa57c('0x55')][_0xa57c('0x56')](function(_0x2cc12b){return db['UserProfileSection'][_0xa57c('0x57')]({'where':{'userProfileId':_0x31be8e['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x193e63){if(_0x193e63){return db['UserProfileSection'][_0xa57c('0x2a')]({'where':{'userProfileId':_0x31be8e[_0xa57c('0x44')]['id'],'id':_['map'](_0x193e63,function(_0x525bc3){return _0x525bc3['id'];})},'transaction':_0x2cc12b});}})[_0xa57c('0x29')](function(_0x3142d1){var _0x50a940=_['map'](_0x31be8e[_0xa57c('0x54')],function(_0xbdc5d6){_0xbdc5d6[_0xa57c('0x5c')]=_0x31be8e['params']['id'];return _0xbdc5d6;});return db[_0xa57c('0x5e')][_0xa57c('0x6c')](_0x50a940,{'raw':!![],'transaction':_0x2cc12b});})[_0xa57c('0x29')](function(_0x307de3){var _0x3aada4=_[_0xa57c('0x3f')](_[_0xa57c('0x35')](_0x307de3,function(_0x4133f7){return _0x4133f7[_0xa57c('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x3aada4){return db[_0xa57c('0x5e')][_0xa57c('0x57')]({'where':{'userProfileId':_0x31be8e[_0xa57c('0x44')]['id'],'sectionId':_[_0xa57c('0x35')](_0x3aada4,function(_0x5ad3b9){return _0x5ad3b9[_0xa57c('0x5b')];})},'attributes':['id',_0xa57c('0x5b')],'raw':!![]})[_0xa57c('0x29')](function(_0x107ebd){var _0x159b00=_[_0xa57c('0x35')](_0x31be8e['body'],function(_0x4fcb4f){_0x4fcb4f[_0xa57c('0x5c')]=_0x31be8e['params']['id'];return _0x4fcb4f;});return db['UserProfileResource'][_0xa57c('0x6c')](_0x159b00,{'raw':!![],'transaction':_0x2cc12b});});}})[_0xa57c('0x4d')](handleError(_0xed49ba,null));});}})[_0xa57c('0x29')](function(_0x4baf82){var _0x305ed0=_[_0xa57c('0x35')](_0x4baf82,function(_0x2623cf){return _0x2623cf[_0xa57c('0x4f')]({'plain':!![]});});})[_0xa57c('0x29')](respondWithResult(_0xed49ba,null))['catch'](handleError(_0xed49ba,null));};exports['removeResources']=function(_0x33ab13,_0x113ced,_0x3df959){return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x33ab13['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x113ced,null))[_0xa57c('0x29')](function(_0x244e4b){if(_0x244e4b){return _0x244e4b[_0xa57c('0x6d')](_0x33ab13[_0xa57c('0x3a')][_0xa57c('0x6e')]);}})[_0xa57c('0x29')](respondWithStatusCode(_0x113ced,null))['catch'](handleError(_0x113ced,null));};exports['getResources']=function(_0x1c8b44,_0xc6d392){var _0xe5e57f={};if(!_0x1c8b44['query']['section'])throw new Error(_0xa57c('0x6f'));if(!_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x70')](_0xa57c('0x3b'))){_0xe5e57f[_0xa57c('0x21')]=qs['limit'](_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x21')]);_0xe5e57f[_0xa57c('0x1f')]=qs['offset'](_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x1f')]);}return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x1c8b44[_0xa57c('0x44')]['id']}})[_0xa57c('0x29')](function(_0x104bd1){if(!_0x104bd1)throw new Error(_0xa57c('0x71')+_0x1c8b44[_0xa57c('0x44')]['id']);return db[_0xa57c('0x30')][_0xa57c('0x72')](_0x1c8b44);})[_0xa57c('0x29')](respondWithFilteredResult(_0xc6d392,_0xe5e57f))['catch'](handleError(_0xc6d392,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0cd7440..967c3de 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 _0xffd6=['../../mysqldb','UserProfile','update','remove','emit','hook','exports','events'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0xffd6,0x97));var _0x6ffd=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xffd6[_0xfb0cfd];return _0x2fd8aa;};'use strict';var EventEmitter=require(_0x6ffd('0x0'));var UserProfile=require(_0x6ffd('0x1'))['db'][_0x6ffd('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ffd('0x3'),'afterDestroy':_0x6ffd('0x4')};function emitEvent(_0x39fd49){return function(_0x560afa,_0x1d12e3,_0x173979){UserProfileEvents[_0x6ffd('0x5')](_0x39fd49+':'+_0x560afa['id'],_0x560afa);UserProfileEvents[_0x6ffd('0x5')](_0x39fd49,_0x560afa);_0x173979(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x6ffd('0x6')](e,emitEvent(event));}}module[_0x6ffd('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x1f2d=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1c4d47,_0x38ee33){var _0x17a8c9=function(_0x2586d6){while(--_0x2586d6){_0x1c4d47['push'](_0x1c4d47['shift']());}};_0x17a8c9(++_0x38ee33);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x1f2d[_0x190681];return _0x4f2ada;};'use strict';var EventEmitter=require(_0xd1f2('0x0'));var UserProfile=require(_0xd1f2('0x1'))['db'][_0xd1f2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd1f2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd1f2('0x4'),'afterDestroy':_0xd1f2('0x5')};function emitEvent(_0x13626e){return function(_0xd4f928,_0x21f154,_0x194b49){UserProfileEvents[_0xd1f2('0x6')](_0x13626e+':'+_0xd4f928['id'],_0xd4f928);UserProfileEvents[_0xd1f2('0x6')](_0x13626e,_0xd4f928);_0x194b49(null);};}for(var e in events){if(events[_0xd1f2('0x7')](e)){var event=events[e];UserProfile[_0xd1f2('0x8')](e,emitEvent(event));}}module[_0xd1f2('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 007047f..6f812a5 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 _0x6706=['telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule','sounds','tags','Tag','templates','triggers','Trigger','variables','Variable','plugins','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','find','params','all','ignore','isEmpty','union','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','foreignKey','forEach','options','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','count','includeAll','Tags','tag','ThroughTags','color','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','model','then','map','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User'];(function(_0x170252,_0x38c2b4){var _0xd57eb3=function(_0x39ccf0){while(--_0x39ccf0){_0x170252['push'](_0x170252['shift']());}};_0xd57eb3(++_0x38c2b4);}(_0x6706,0x89));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6670('0x0'));var attributes=require(_0x6670('0x1'));var qs=require(_0x6670('0x2'));var squel=require(_0x6670('0x3'));module[_0x6670('0x4')]=function(_0x53181b){var _0x402a5d=_0x53181b[_0x6670('0x5')];function _0x586747(_0x588b7a,_0x1e86ba){return new Promise(function(_0xd34a7e,_0x3cade4){if(!_0x1e86ba)return _0xd34a7e(null);var _0x3dd3dd=_0x1e86ba[_0x6670('0x6')]?{[_0x1e86ba[_0x6670('0x6')][_0x6670('0x7')]]:_0x1e86ba[_0x6670('0x6')][_0x6670('0x8')]}:undefined;return _0x402a5d[_0x588b7a][_0x6670('0x9')]({'where':_0x3dd3dd,'raw':!![]})['then'](function(_0xc371c1){_0x1e86ba[_0x6670('0xa')]=_['map'](_0xc371c1,'id');_0xd34a7e(_0x1e86ba);})['catch'](function(_0x46a8f6){_0x3cade4(_0x46a8f6);});});}function _0x493318(_0x774bd5,_0x10c07c){return new Promise(function(_0x440e28,_0x46b17e){var _0x4ddfcb=_0x774bd5[_0x6670('0x6')]?{[_0x774bd5['filter'][_0x6670('0x7')]]:_0x774bd5[_0x6670('0x6')][_0x6670('0x8')]}:undefined;return _0x402a5d[_0x774bd5[_0x6670('0xb')]][_0x6670('0x9')]({'where':_0x4ddfcb,'raw':!![]})[_0x6670('0xc')](function(_0x730d1){_0x10c07c[_0x6670('0xa')]=_[_0x6670('0xd')](_0x730d1,function(_0x8fc63b){return _0x8fc63b['name'];});_0x440e28(_0x10c07c);})[_0x6670('0xe')](function(_0x32c6ba){_0x46b17e(_0x32c6ba);});});}function _0x191bea(_0x4b011a,_0x46ba15,_0x8b69ae){if(!_0x46ba15)return Promise[_0x6670('0xf')](null);return new Promise(function(_0x5aa2e7,_0x578475){return _0x402a5d[_0x6670('0x10')][_0x6670('0x9')]({'where':{'sectionId':_0x46ba15['id']},'raw':!![]})[_0x6670('0xc')](function(_0x2fb283){if(_0x4b011a[_0x6670('0x7')]&&_0x4b011a['field']!=='id'){_0x46ba15['associatedResources']=_['map'](_0x2fb283,function(_0x326b72){return _0x326b72[_0x4b011a[_0x6670('0x7')]];});}else{if(_0x8b69ae===_0x6670('0x11')){_0x46ba15[_0x6670('0xa')]=_[_0x6670('0xd')](_0x2fb283,function(_0x47c1ac){return{'id':_0x47c1ac['resourceId'],'type':_0x47c1ac[_0x6670('0x12')]};});}else{_0x46ba15[_0x6670('0xa')]=_['map'](_0x2fb283,function(_0x956dce){return _0x956dce['resourceId'];});}}_0x5aa2e7(_0x46ba15);})['catch'](function(_0x42f027){_0x578475(_0x42f027);});});}function _0x314659(_0x449b8a,_0x419f6e){var _0x40e84c={'parentSections':[]};switch(_0x449b8a[_0x6670('0x13')]()){case'squareprojects':_0x40e84c[_0x6670('0x14')]=_0x6670('0x15');break;case _0x6670('0x16'):_0x40e84c[_0x6670('0x14')]='SquareOdbc';break;case _0x6670('0x17'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x18');_0x40e84c[_0x6670('0x19')]=[{'name':_0x6670('0x1a'),'field':_0x6670('0x1b'),'foreignKey':_0x6670('0x1c')}];break;case _0x6670('0x1d'):_0x40e84c['childModel']=_0x6670('0x1e');break;case'contacts':_0x40e84c[_0x6670('0x14')]=_0x6670('0x1f');_0x40e84c['parentSections']=[{'name':_0x6670('0x20'),'field':'id','foreignKey':_0x6670('0x21')}];break;case _0x6670('0x22'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x23');break;case _0x6670('0x24'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x25');break;case _0x6670('0x26'):_0x40e84c[_0x6670('0x14')]='CmCustomField';break;case _0x6670('0x27'):_0x40e84c['childModel']='ChatQueue';break;case _0x6670('0x28'):_0x40e84c['childModel']='ChatWebsite';break;case'faxqueues':_0x40e84c[_0x6670('0x14')]=_0x6670('0x29');break;case _0x6670('0x2a'):_0x40e84c['childModel']='FaxAccount';break;case'inboundroutes':case _0x6670('0x2b'):case _0x6670('0x2c'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x2d');break;case _0x6670('0x2e'):_0x40e84c['childModel']=_0x6670('0x2f');break;case _0x6670('0x30'):_0x40e84c['childModel']=_0x6670('0x31');break;case _0x6670('0x32'):_0x40e84c['childModel']=_0x6670('0x33');_0x40e84c[_0x6670('0x19')]=[{'name':'Agents','field':_0x6670('0x1b'),'foreignKey':_0x6670('0x34'),'model':'User','filter':{'field':_0x6670('0x35'),'value':[_0x6670('0x36')]}},{'name':_0x6670('0x37'),'field':_0x6670('0x1b'),'foreignKey':'membername','model':_0x6670('0x38'),'filter':{'field':'role','value':[_0x6670('0x39')]}},{'name':_0x6670('0x3a'),'field':_0x6670('0x1b'),'foreignKey':_0x6670('0x3b'),'model':_0x6670('0x3c'),'filter':{'field':_0x6670('0x12'),'value':['inbound']}},{'name':_0x6670('0x3d'),'field':'name','foreignKey':_0x6670('0x3b'),'model':_0x6670('0x3c'),'filter':{'field':_0x6670('0x12'),'value':[_0x6670('0x3e')]}}];break;case'musiconholds':_0x40e84c[_0x6670('0x14')]=_0x6670('0x3f');break;case'chanspies':_0x40e84c[_0x6670('0x14')]=_0x6670('0x40');break;case _0x6670('0x41'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x42');break;case'ivrcampaigns':_0x40e84c[_0x6670('0x14')]=_0x6670('0x43');break;case'mailqueues':_0x40e84c[_0x6670('0x14')]=_0x6670('0x44');break;case _0x6670('0x45'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x46');break;case'mailsubstatuses':_0x40e84c[_0x6670('0x14')]=_0x6670('0x47');break;case'openchannelqueues':_0x40e84c[_0x6670('0x14')]=_0x6670('0x48');break;case'openchannelaccounts':_0x40e84c[_0x6670('0x14')]=_0x6670('0x49');break;case _0x6670('0x4a'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x4b');break;case _0x6670('0x4c'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x4d');break;case _0x6670('0x4e'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x4f');break;case _0x6670('0x50'):_0x40e84c['childModel']='WhatsappAccount';break;case _0x6670('0x51'):_0x40e84c['childModel']=_0x6670('0x52');break;case _0x6670('0x53'):case _0x6670('0x54'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x3c');if(_0x419f6e){_0x40e84c[_0x6670('0x19')]=[{'name':_0x6670('0x3a')},{'name':'QueueCampaigns'}];}break;case _0x6670('0x55'):case _0x6670('0x56'):case _0x6670('0x57'):_0x40e84c['childModel']=_0x6670('0x38');if(_0x419f6e){_0x40e84c[_0x6670('0x19')]=[{'name':_0x6670('0x58'),'filter':{'field':'role','value':[_0x6670('0x59'),_0x6670('0x5a')]},'ignore':!![]},{'name':_0x6670('0x5b')},{'name':_0x6670('0x37')}];}break;case _0x6670('0x5c'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x5d');break;case _0x6670('0x5e'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x5f');break;case _0x6670('0x60'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x61');break;case _0x6670('0x62'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x63');break;case _0x6670('0x64'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x65');break;case _0x6670('0x66'):_0x40e84c['childModel']=_0x6670('0x67');break;case _0x6670('0x68'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x38');break;case _0x6670('0x69'):_0x40e84c['childModel']='CannedAnswer';break;case'dispositions':_0x40e84c[_0x6670('0x14')]=_0x6670('0x6a');break;case _0x6670('0x6b'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x6c');break;case _0x6670('0x6d'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x6e');break;case _0x6670('0x6f'):_0x40e84c[_0x6670('0x14')]='Pause';break;case'scheduler':_0x40e84c['childModel']=_0x6670('0x70');break;case _0x6670('0x71'):_0x40e84c[_0x6670('0x14')]='Sound';break;case _0x6670('0x72'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x73');break;case _0x6670('0x74'):_0x40e84c[_0x6670('0x14')]='Template';break;case _0x6670('0x75'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x76');break;case'trunks':_0x40e84c[_0x6670('0x14')]='Trunk';break;case _0x6670('0x77'):_0x40e84c[_0x6670('0x14')]=_0x6670('0x78');break;case _0x6670('0x79'):_0x40e84c[_0x6670('0x14')]='Plugin';break;case'extractedreports':_0x40e84c[_0x6670('0x14')]='AnalyticExtractedReport';_0x40e84c['parentSections']=[{'name':_0x6670('0x7a'),'field':'id','foreignKey':_0x6670('0x7b')}];break;case _0x6670('0x7c'):_0x40e84c[_0x6670('0x14')]='AnalyticMetric';break;}return _0x40e84c;}function _0x28813b(_0x19a347,_0x383d65){var _0x3af329=_0x19a347[_0x6670('0x7d')](0x0)[_0x6670('0x7e')]()+_0x19a347[_0x6670('0x7f')](0x1);var _0x35d9ce={'type':_0x402a5d[_0x6670('0x80')]['QueryTypes'][_0x6670('0x81')],'raw':!![]};return new Promise(function(_0x38622e,_0x2726f1){var _0x579469=squel[_0x6670('0x82')]()[_0x6670('0x7')](_0x6670('0x83')+_0x3af329+'InteractionId','id')[_0x6670('0x7')]('ui.createdAt')[_0x6670('0x84')](_0x6670('0x85')+_0x19a347+_0x6670('0x86'),'ui')[_0x6670('0x87')](_0x6670('0x88'),_0x383d65['id']);return _0x402a5d['sequelize']['query'](_0x579469[_0x6670('0x89')](),_0x35d9ce)[_0x6670('0xc')](function(_0x57eaed){_0x383d65[_0x3af329+'OpenTabs']=_0x57eaed;_0x38622e(_0x57eaed);})[_0x6670('0xe')](function(_0x584990){_0x2726f1(_0x584990);});});}return _0x53181b['define'](_0x6670('0x8a'),attributes,{'tableName':_0x6670('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x40c8cb){var _0x3622c6={'raw':_0x40c8cb[_0x6670('0x8c')][_0x6670('0x8d')],'where':{}};var _0xca3748={};var _0x34eab8={'count':0x0,'rows':[]};var _0x2fa36b=_0x40c8cb[_0x6670('0x8c')][_0x6670('0x8e')];var _0x539ae3=_0x40c8cb[_0x6670('0x8c')][_0x6670('0x8f')]||![];var _0x3a3d82=_0x314659(_0x2fa36b,_0x539ae3);if(!_0x3a3d82[_0x6670('0x14')])throw new Error(_0x6670('0x90')+_0x2fa36b+'\x27');var _0xffb8c=[{'name':_0x2fa36b}];if(!_['isEmpty'](_0x3a3d82[_0x6670('0x19')]))_0xffb8c=_0x3a3d82[_0x6670('0x19')];var _0x1e1b20=[];for(var _0x1e83b4=0x0;_0x1e83b4<_0xffb8c[_0x6670('0x91')];_0x1e83b4++){_0x1e1b20['push'](_0x402a5d[_0x6670('0x92')][_0x6670('0x93')]({'where':{'userProfileId':_0x40c8cb[_0x6670('0x94')]['id'],'name':_0xffb8c[_0x1e83b4][_0x6670('0x1b')]},'raw':!![]}));}return Promise[_0x6670('0x95')](_0x1e1b20)[_0x6670('0xc')](function(_0x22c2e0){var _0x581151=_['filter'](_0x22c2e0,function(_0x1eb23f){return _0x1eb23f?_0x1eb23f:undefined;});var _0x4ad8e8=_[_0x6670('0x6')](_0xffb8c,[_0x6670('0x96'),!![]]);var _0x4883d4=_[_0x6670('0x97')](_0x581151)&&_[_0x6670('0x97')](_0x4ad8e8)?null:_[_0x6670('0x98')](_0x4ad8e8,_0x581151);if(!_0x4883d4)return null;var _0xaa86a6=[];for(var _0x4e37fc=0x0;_0x4e37fc<_0x4883d4[_0x6670('0x91')];_0x4e37fc++){var _0xc6fe44=_[_0x6670('0x93')](_0xffb8c,function(_0x30efc8){return _0x4883d4[_0x4e37fc]?_0x30efc8[_0x6670('0x1b')]===_0x4883d4[_0x4e37fc][_0x6670('0x1b')]:null;});if(_0xc6fe44){if(_0x4883d4[_0x4e37fc][_0x6670('0x96')]){_0xaa86a6[_0x6670('0x99')](_0x586747(_0x3a3d82[_0x6670('0x14')],_0x4883d4[_0x4e37fc]));}else{if(!_0x4883d4[_0x4e37fc][_0x6670('0x9a')]){_0xaa86a6['push'](_0x191bea(_0xc6fe44,_0x4883d4[_0x4e37fc],_0x3a3d82[_0x6670('0x14')]));}else{if(_0xc6fe44[_0x6670('0xb')]){_0xaa86a6[_0x6670('0x99')](_0x493318(_0xc6fe44,_0x4883d4[_0x4e37fc]));}}}}}return Promise['all'](_0xaa86a6);})['then'](function(_0x404c){var _0x2d8cbd=_0x404c;var _0x154a4f=null;if(_0x2d8cbd){_0x154a4f=_0x2d8cbd[_0x6670('0x91')]===0x1?_0x2d8cbd[0x0]:null;}if(!_0x154a4f&&!_0x2d8cbd)return _0x34eab8;var _0xb617aa=_0x402a5d[_0x3a3d82['childModel']][_0x6670('0x9b')];_0xca3748[_0x6670('0xb')]=_[_0x6670('0x9c')](_0xb617aa);_0xca3748['query']=_[_0x6670('0x9c')](_0x40c8cb['query']);_0xca3748[_0x6670('0x9d')]=_[_0x6670('0x9e')](_0xca3748['model'],_0xca3748[_0x6670('0x8c')]);_0x3622c6[_0x6670('0x9f')]=_[_0x6670('0x9e')](_0xca3748['model'],qs['fields'](_0x40c8cb[_0x6670('0x8c')][_0x6670('0xa0')]));_0x3622c6[_0x6670('0x9f')]=_0x3622c6[_0x6670('0x9f')][_0x6670('0x91')]?_0x3622c6[_0x6670('0x9f')]:_0xca3748[_0x6670('0xb')];if(!_0x40c8cb['query'][_0x6670('0xa1')](_0x6670('0xa2'))){_0x3622c6[_0x6670('0xa3')]=qs[_0x6670('0xa3')](_0x40c8cb[_0x6670('0x8c')]['limit']);_0x3622c6[_0x6670('0xa4')]=qs[_0x6670('0xa4')](_0x40c8cb[_0x6670('0x8c')]['offset']);}_0x3622c6[_0x6670('0xa5')]=qs[_0x6670('0xa6')](_0x40c8cb['query'][_0x6670('0xa6')]);_0x3622c6[_0x6670('0x87')]=qs[_0x6670('0x9d')](_['pick'](_0x40c8cb[_0x6670('0x8c')],_0xca3748[_0x6670('0x9d')]));if(_0x40c8cb[_0x6670('0x8c')]['filter']){_0x3622c6['where']=_[_0x6670('0xa7')](_0x3622c6[_0x6670('0x87')],{'$or':_[_0x6670('0xd')](_0xb617aa,function(_0x1182d9){if(_0x1182d9[_0x6670('0x12')][_0x6670('0xa8')]!=='VIRTUAL'){var _0x290332={};_0x290332[_0x1182d9['field']]={'$like':'%'+_0x40c8cb[_0x6670('0x8c')][_0x6670('0x6')]+'%'};return _0x290332;}})});}var _0x458fe8=[];var _0x33fe85=null;var _0x554c33={};if(_0x154a4f){_0x33fe85=_[_0x6670('0x93')](_0xffb8c,['name',_0x154a4f[_0x6670('0x1b')]]);if(_0x33fe85[_0x6670('0x7')]){_0x554c33={};if(_0x3a3d82['childModel']===_0x6670('0x11')){_0x554c33[_0x33fe85[_0x6670('0xa9')]]=_[_0x6670('0xd')](_0x154a4f[_0x6670('0xa')],'id');}else{_0x554c33[_0x33fe85[_0x6670('0xa9')]]=_0x154a4f[_0x6670('0xa')];}_0x458fe8[_0x6670('0x99')](_0x554c33);}else{_0x3622c6[_0x6670('0x87')]['id']=_0x154a4f[_0x6670('0xa')];}}else{for(var _0xb6740=0x0;_0xb6740<_0x2d8cbd[_0x6670('0x91')];_0xb6740++){_0x33fe85=_[_0x6670('0x93')](_0xffb8c,[_0x6670('0x1b'),_0x2d8cbd[_0xb6740][_0x6670('0x1b')]]);if(_0x33fe85[_0x6670('0x7')]){_0x554c33={};_0x554c33[_0x33fe85['foreignKey']]=_0x2d8cbd[_0xb6740][_0x6670('0xa')];_0x458fe8[_0x6670('0x99')](_0x554c33);}else{if(!_0x3622c6[_0x6670('0x87')]['id'])_0x3622c6[_0x6670('0x87')]['id']=[];_0x2d8cbd[_0xb6740]['associatedResources'][_0x6670('0xaa')](function(_0x35b15d){_0x3622c6[_0x6670('0x87')]['id'][_0x6670('0x99')](_0x35b15d);});}}}if(!_[_0x6670('0x97')](_0x458fe8)){_0x3622c6['where']=_['merge'](_0x3622c6[_0x6670('0x87')],{'$and':{'$or':_0x458fe8}});}_0x3622c6=_['merge']({},_0x3622c6,_0x40c8cb[_0x6670('0xab')]);if(_0x154a4f&&!_0x154a4f[_0x6670('0x9a')]&&_0x3a3d82[_0x6670('0x14')]===_0x6670('0x11')){if(_0x40c8cb[_0x6670('0x8c')]['includeAll']){_0x3622c6[_0x6670('0xac')]=[{'all':!![]}];}return _0x402a5d[_0x3a3d82[_0x6670('0x14')]][_0x6670('0x9')](_0x3622c6)[_0x6670('0xc')](function(_0x23026b){var _0x27247d=[];_0x23026b[_0x6670('0xaa')](function(_0x25c4de){var _0x29e967;switch(_0x25c4de[_0x6670('0xad')]){case _0x6670('0xae'):_0x29e967=_[_0x6670('0x93')](_0x154a4f['associatedResources'],function(_0x548944){return _0x548944['id']===_0x25c4de[_0x6670('0x7b')]&&_0x548944['type']===_0x6670('0xaf');});break;case _0x6670('0xb0'):_0x29e967=_[_0x6670('0x93')](_0x154a4f[_0x6670('0xa')],function(_0x362656){return _0x362656['id']===_0x25c4de[_0x6670('0x7b')]&&_0x362656[_0x6670('0x12')]===_0x6670('0xb1');});break;}if(_0x29e967)_0x27247d[_0x6670('0x99')](_0x25c4de);});_0x34eab8['count']=_0x27247d[_0x6670('0x91')];_0x34eab8[_0x6670('0xb2')]=_0x27247d;return _0x34eab8;});}else{if(!_[_0x6670('0x97')](_0x40c8cb[_0x6670('0x8c')]['ids'])){_0x3622c6['where']['id']=_0x3622c6['where']['id']?_[_0x6670('0x9e')](_0x3622c6[_0x6670('0x87')]['id'],_0x40c8cb[_0x6670('0x8c')][_0x6670('0xb3')]):_0x40c8cb[_0x6670('0x8c')]['ids'];if(_0x40c8cb[_0x6670('0x8c')][_0x6670('0xb4')]){_0x3622c6[_0x6670('0xa5')]=_0x40c8cb['query'][_0x6670('0xb4')];}}if(_0x40c8cb[_0x6670('0x8c')]['extraQueryConditions']){_0x3622c6[_0x6670('0x87')]=_[_0x6670('0xa7')](_0x3622c6[_0x6670('0x87')],{'$and':_0x40c8cb[_0x6670('0x8c')]['extraQueryConditions']});}return _0x402a5d[_0x3a3d82[_0x6670('0x14')]]['count']({'where':_0x3622c6['where']})[_0x6670('0xc')](function(_0x2d4e60){_0x34eab8[_0x6670('0xb5')]=_0x2d4e60;if(_0x40c8cb[_0x6670('0x8c')][_0x6670('0xb6')]){if(_0x3a3d82[_0x6670('0x14')]===_0x6670('0x1f')){_0x3622c6[_0x6670('0xac')]=[{'model':_0x402a5d[_0x6670('0x73')],'as':_0x6670('0xb7'),'attributes':['id',_0x6670('0x1b'),'color'],'required':_0x40c8cb[_0x6670('0x8c')][_0x6670('0xb8')]?!![]:![]},{'model':_0x402a5d[_0x6670('0x73')],'as':_0x6670('0xb9'),'attributes':['id',_0x6670('0x1b'),_0x6670('0xba')],'through':_0x40c8cb['query'][_0x6670('0xb8')]?{'attributes':[],'where':{'TagId':_0x40c8cb['query'][_0x6670('0xb8')]||undefined}}:{},'required':_0x40c8cb[_0x6670('0x8c')][_0x6670('0xb8')]?!![]:![]}];}else{_0x3622c6[_0x6670('0xac')]=[{'all':!![]}];}}return _0x402a5d[_0x3a3d82['childModel']][_0x6670('0x9')](_0x3622c6);})[_0x6670('0xc')](function(_0x2fda6f){_0x34eab8[_0x6670('0xb2')]=_0x2fda6f;if(_0x2fa36b==='Agents'&&_0x40c8cb['query']['openTabs']===_0x6670('0xbb')){var _0x3aebcc=[];for(var _0x5cc02e=0x0;_0x5cc02e<_0x34eab8['rows'][_0x6670('0x91')];_0x5cc02e++){_0x3aebcc[_0x6670('0x99')](_0x28813b(_0x6670('0xbc'),_0x34eab8['rows'][_0x5cc02e][_0x6670('0xbd')]));_0x3aebcc['push'](_0x28813b('sms',_0x34eab8['rows'][_0x5cc02e][_0x6670('0xbd')]));_0x3aebcc[_0x6670('0x99')](_0x28813b(_0x6670('0xbe'),_0x34eab8[_0x6670('0xb2')][_0x5cc02e][_0x6670('0xbd')]));_0x3aebcc['push'](_0x28813b(_0x6670('0xbf'),_0x34eab8['rows'][_0x5cc02e]['dataValues']));_0x3aebcc[_0x6670('0x99')](_0x28813b(_0x6670('0xc0'),_0x34eab8[_0x6670('0xb2')][_0x5cc02e][_0x6670('0xbd')]));_0x3aebcc[_0x6670('0x99')](_0x28813b(_0x6670('0xc1'),_0x34eab8[_0x6670('0xb2')][_0x5cc02e][_0x6670('0xbd')]));}return Promise[_0x6670('0x95')](_0x3aebcc)['then'](function(){return _0x34eab8;});}return _0x34eab8;});}});}}});}; \ No newline at end of file +var _0x561b=['user_has_','where','ui.UserId\x20=\x20?','define','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','model','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','DefaultReports','custom','rows','ids','customSorting','extraQueryConditions','count','color','tag','ThroughTags','openTabs','true','chat','sms','dataValues','mail','openchannel','whatsapp','lodash','squel','exports','models','filter','field','then','map','catch','value','findAll','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','queue','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','SELECT','ui.','ui.createdAt','from'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x561b,0xf9));var _0xb561=function(_0x67094c,_0x3abefb){_0x67094c=_0x67094c-0x0;var _0x4c48bd=_0x561b[_0x67094c];return _0x4c48bd;};'use strict';var _=require(_0xb561('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xb561('0x1'));module[_0xb561('0x2')]=function(_0x1e7758){var _0x2f40d3=_0x1e7758[_0xb561('0x3')];function _0x47094a(_0x41e8d3,_0x53fd6c){return new Promise(function(_0x1ebd03,_0x31457d){if(!_0x53fd6c)return _0x1ebd03(null);var _0x2dc5af=_0x53fd6c[_0xb561('0x4')]?{[_0x53fd6c[_0xb561('0x4')][_0xb561('0x5')]]:_0x53fd6c[_0xb561('0x4')]['value']}:undefined;return _0x2f40d3[_0x41e8d3]['findAll']({'where':_0x2dc5af,'raw':!![]})[_0xb561('0x6')](function(_0x2f14e5){_0x53fd6c['associatedResources']=_[_0xb561('0x7')](_0x2f14e5,'id');_0x1ebd03(_0x53fd6c);})[_0xb561('0x8')](function(_0x55fdfc){_0x31457d(_0x55fdfc);});});}function _0x2a3933(_0x4ee612,_0x3009cf){return new Promise(function(_0x2df760,_0x423e0a){var _0x3b3ac1=_0x4ee612[_0xb561('0x4')]?{[_0x4ee612['filter'][_0xb561('0x5')]]:_0x4ee612[_0xb561('0x4')][_0xb561('0x9')]}:undefined;return _0x2f40d3[_0x4ee612['model']][_0xb561('0xa')]({'where':_0x3b3ac1,'raw':!![]})[_0xb561('0x6')](function(_0x37c94f){_0x3009cf[_0xb561('0xb')]=_[_0xb561('0x7')](_0x37c94f,function(_0x4cc453){return _0x4cc453[_0xb561('0xc')];});_0x2df760(_0x3009cf);})[_0xb561('0x8')](function(_0x3494a1){_0x423e0a(_0x3494a1);});});}function _0x124846(_0x2fd13f,_0xa1fbf6,_0x1c5587){if(!_0xa1fbf6)return Promise['resolve'](null);return new Promise(function(_0x1cbe5e,_0x3d3211){return _0x2f40d3[_0xb561('0xd')][_0xb561('0xa')]({'where':{'sectionId':_0xa1fbf6['id']},'raw':!![]})['then'](function(_0x29ae28){if(_0x2fd13f[_0xb561('0x5')]&&_0x2fd13f[_0xb561('0x5')]!=='id'){_0xa1fbf6[_0xb561('0xb')]=_['map'](_0x29ae28,function(_0x217237){return _0x217237[_0x2fd13f[_0xb561('0x5')]];});}else{if(_0x1c5587===_0xb561('0xe')){_0xa1fbf6[_0xb561('0xb')]=_[_0xb561('0x7')](_0x29ae28,function(_0x5ccdf5){return{'id':_0x5ccdf5[_0xb561('0xf')],'type':_0x5ccdf5[_0xb561('0x10')]};});}else{_0xa1fbf6[_0xb561('0xb')]=_[_0xb561('0x7')](_0x29ae28,function(_0x200cad){return _0x200cad[_0xb561('0xf')];});}}_0x1cbe5e(_0xa1fbf6);})['catch'](function(_0x122024){_0x3d3211(_0x122024);});});}function _0x1c329e(_0x5b73c5,_0x30b58d){var _0x4bebca={'parentSections':[]};switch(_0x5b73c5[_0xb561('0x11')]()){case _0xb561('0x12'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x14');break;case _0xb561('0x15'):_0x4bebca['childModel']=_0xb561('0x16');break;case _0xb561('0x17'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x18');_0x4bebca[_0xb561('0x19')]=[{'name':_0xb561('0x1a'),'field':_0xb561('0xc'),'foreignKey':_0xb561('0x1b')}];break;case _0xb561('0x1c'):_0x4bebca['childModel']='JscriptyProject';break;case _0xb561('0x1d'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x1e');_0x4bebca[_0xb561('0x19')]=[{'name':_0xb561('0x1f'),'field':'id','foreignKey':_0xb561('0x20')}];break;case'lists':_0x4bebca[_0xb561('0x13')]=_0xb561('0x21');break;case'companies':_0x4bebca['childModel']='CmCompany';break;case _0xb561('0x22'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x23');break;case _0xb561('0x24'):_0x4bebca['childModel']=_0xb561('0x25');break;case _0xb561('0x26'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x27');break;case _0xb561('0x28'):_0x4bebca['childModel']=_0xb561('0x29');break;case'faxaccounts':_0x4bebca[_0xb561('0x13')]=_0xb561('0x2a');break;case _0xb561('0x2b'):case _0xb561('0x2c'):case _0xb561('0x2d'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x2e');break;case _0xb561('0x2f'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x30');break;case _0xb561('0x31'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x32');break;case _0xb561('0x33'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x34');_0x4bebca[_0xb561('0x19')]=[{'name':_0xb561('0x35'),'field':_0xb561('0xc'),'foreignKey':_0xb561('0x36'),'model':_0xb561('0x37'),'filter':{'field':_0xb561('0x38'),'value':['agent']}},{'name':_0xb561('0x39'),'field':_0xb561('0xc'),'foreignKey':_0xb561('0x36'),'model':_0xb561('0x37'),'filter':{'field':'role','value':[_0xb561('0x3a')]}},{'name':_0xb561('0x3b'),'field':_0xb561('0xc'),'foreignKey':'queue','model':_0xb561('0x3c'),'filter':{'field':'type','value':[_0xb561('0x3d')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xb561('0x3e'),'model':_0xb561('0x3c'),'filter':{'field':_0xb561('0x10'),'value':['outbound']}}];break;case _0xb561('0x3f'):_0x4bebca['childModel']=_0xb561('0x40');break;case'chanspies':_0x4bebca[_0xb561('0x13')]=_0xb561('0x41');break;case _0xb561('0x42'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x43');break;case _0xb561('0x44'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x45');break;case _0xb561('0x46'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x47');break;case _0xb561('0x48'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x49');break;case _0xb561('0x4a'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x4b');break;case _0xb561('0x4c'):_0x4bebca['childModel']=_0xb561('0x4d');break;case _0xb561('0x4e'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x4f');break;case _0xb561('0x50'):_0x4bebca['childModel']=_0xb561('0x51');break;case'smsaccounts':_0x4bebca['childModel']=_0xb561('0x52');break;case _0xb561('0x53'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x54');break;case'whatsappaccounts':_0x4bebca[_0xb561('0x13')]=_0xb561('0x55');break;case _0xb561('0x56'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x57');break;case _0xb561('0x58'):case _0xb561('0x59'):_0x4bebca[_0xb561('0x13')]='VoiceQueue';if(_0x30b58d){_0x4bebca[_0xb561('0x19')]=[{'name':_0xb561('0x3b')},{'name':_0xb561('0x5a')}];}break;case _0xb561('0x5b'):case _0xb561('0x5c'):case _0xb561('0x5d'):_0x4bebca['childModel']=_0xb561('0x37');if(_0x30b58d){_0x4bebca['parentSections']=[{'name':_0xb561('0x5e'),'filter':{'field':_0xb561('0x38'),'value':['admin','user']},'ignore':!![]},{'name':_0xb561('0x35')},{'name':_0xb561('0x39')}];}break;case _0xb561('0x5f'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x60');break;case'salesforceaccounts':_0x4bebca[_0xb561('0x13')]='SalesforceAccount';break;case _0xb561('0x61'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x62');break;case _0xb561('0x63'):_0x4bebca[_0xb561('0x13')]='SugarcrmAccount';break;case _0xb561('0x64'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x65');break;case _0xb561('0x66'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x67');break;case _0xb561('0x68'):_0x4bebca['childModel']=_0xb561('0x37');break;case _0xb561('0x69'):_0x4bebca[_0xb561('0x13')]='CannedAnswer';break;case _0xb561('0x6a'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x6b');break;case _0xb561('0x6c'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x6d');break;case _0xb561('0x6e'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x6f');break;case _0xb561('0x70'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x71');break;case _0xb561('0x72'):_0x4bebca[_0xb561('0x13')]='Schedule';break;case _0xb561('0x73'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x74');break;case'tags':_0x4bebca[_0xb561('0x13')]=_0xb561('0x75');break;case _0xb561('0x76'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x77');break;case'triggers':_0x4bebca[_0xb561('0x13')]=_0xb561('0x78');break;case _0xb561('0x79'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x7a');break;case _0xb561('0x7b'):_0x4bebca[_0xb561('0x13')]=_0xb561('0x7c');break;case _0xb561('0x7d'):_0x4bebca['childModel']=_0xb561('0x7e');break;case _0xb561('0x7f'):_0x4bebca[_0xb561('0x13')]=_0xb561('0xe');_0x4bebca[_0xb561('0x19')]=[{'name':_0xb561('0x80'),'field':'id','foreignKey':_0xb561('0x81')}];break;case'metrics':_0x4bebca[_0xb561('0x13')]='AnalyticMetric';break;}return _0x4bebca;}function _0x1f6d2a(_0x1b4a49,_0x3f3e04){var _0x263801=_0x1b4a49[_0xb561('0x82')](0x0)['toUpperCase']()+_0x1b4a49[_0xb561('0x83')](0x1);var _0x17f49f={'type':_0x2f40d3[_0xb561('0x84')]['QueryTypes'][_0xb561('0x85')],'raw':!![]};return new Promise(function(_0x3ec61d,_0x3f73ad){var _0x30e3ef=squel['select']()[_0xb561('0x5')](_0xb561('0x86')+_0x263801+'InteractionId','id')[_0xb561('0x5')](_0xb561('0x87'))[_0xb561('0x88')](_0xb561('0x89')+_0x1b4a49+'_interactions','ui')[_0xb561('0x8a')](_0xb561('0x8b'),_0x3f3e04['id']);return _0x2f40d3['sequelize']['query'](_0x30e3ef['toString'](),_0x17f49f)[_0xb561('0x6')](function(_0x4e66de){_0x3f3e04[_0x263801+'OpenTabs']=_0x4e66de;_0x3ec61d(_0x4e66de);})['catch'](function(_0x13c0a4){_0x3f73ad(_0x13c0a4);});});}return _0x1e7758[_0xb561('0x8c')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4379c5){var _0x59f7cc={'raw':_0x4379c5[_0xb561('0x8d')]['raw'],'where':{}};var _0x3de237={};var _0x2c01cf={'count':0x0,'rows':[]};var _0x4eccc1=_0x4379c5[_0xb561('0x8d')][_0xb561('0x8e')];var _0x5ef800=_0x4379c5[_0xb561('0x8d')][_0xb561('0x8f')]||![];var _0x490a9b=_0x1c329e(_0x4eccc1,_0x5ef800);if(!_0x490a9b[_0xb561('0x13')])throw new Error(_0xb561('0x90')+_0x4eccc1+'\x27');var _0x5ede3a=[{'name':_0x4eccc1}];if(!_[_0xb561('0x91')](_0x490a9b[_0xb561('0x19')]))_0x5ede3a=_0x490a9b['parentSections'];var _0x219984=[];for(var _0x59acbf=0x0;_0x59acbf<_0x5ede3a[_0xb561('0x92')];_0x59acbf++){_0x219984[_0xb561('0x93')](_0x2f40d3[_0xb561('0x94')][_0xb561('0x95')]({'where':{'userProfileId':_0x4379c5[_0xb561('0x96')]['id'],'name':_0x5ede3a[_0x59acbf][_0xb561('0xc')]},'raw':!![]}));}return Promise[_0xb561('0x97')](_0x219984)[_0xb561('0x6')](function(_0x132da8){var _0xe5074e=_[_0xb561('0x4')](_0x132da8,function(_0x56b2f2){return _0x56b2f2?_0x56b2f2:undefined;});var _0x7c8214=_[_0xb561('0x4')](_0x5ede3a,[_0xb561('0x98'),!![]]);var _0x49d5df=_[_0xb561('0x91')](_0xe5074e)&&_[_0xb561('0x91')](_0x7c8214)?null:_['union'](_0x7c8214,_0xe5074e);if(!_0x49d5df)return null;var _0x4191ed=[];for(var _0x4d44bc=0x0;_0x4d44bc<_0x49d5df[_0xb561('0x92')];_0x4d44bc++){var _0x14ae7d=_[_0xb561('0x95')](_0x5ede3a,function(_0x343b1){return _0x49d5df[_0x4d44bc]?_0x343b1[_0xb561('0xc')]===_0x49d5df[_0x4d44bc]['name']:null;});if(_0x14ae7d){if(_0x49d5df[_0x4d44bc][_0xb561('0x98')]){_0x4191ed[_0xb561('0x93')](_0x47094a(_0x490a9b[_0xb561('0x13')],_0x49d5df[_0x4d44bc]));}else{if(!_0x49d5df[_0x4d44bc][_0xb561('0x99')]){_0x4191ed[_0xb561('0x93')](_0x124846(_0x14ae7d,_0x49d5df[_0x4d44bc],_0x490a9b[_0xb561('0x13')]));}else{if(_0x14ae7d[_0xb561('0x9a')]){_0x4191ed[_0xb561('0x93')](_0x2a3933(_0x14ae7d,_0x49d5df[_0x4d44bc]));}}}}}return Promise[_0xb561('0x97')](_0x4191ed);})['then'](function(_0x18e3b9){var _0x13862e=_0x18e3b9;var _0x2ef238=null;if(_0x13862e){_0x2ef238=_0x13862e[_0xb561('0x92')]===0x1?_0x13862e[0x0]:null;}if(!_0x2ef238&&!_0x13862e)return _0x2c01cf;var _0x14119d=_0x2f40d3[_0x490a9b[_0xb561('0x13')]]['rawAttributes'];_0x3de237['model']=_[_0xb561('0x9b')](_0x14119d);_0x3de237['query']=_[_0xb561('0x9b')](_0x4379c5[_0xb561('0x8d')]);_0x3de237[_0xb561('0x9c')]=_[_0xb561('0x9d')](_0x3de237[_0xb561('0x9a')],_0x3de237[_0xb561('0x8d')]);_0x59f7cc['attributes']=_['intersection'](_0x3de237[_0xb561('0x9a')],qs[_0xb561('0x9e')](_0x4379c5[_0xb561('0x8d')]['fields']));_0x59f7cc['attributes']=_0x59f7cc[_0xb561('0x9f')][_0xb561('0x92')]?_0x59f7cc[_0xb561('0x9f')]:_0x3de237[_0xb561('0x9a')];if(!_0x4379c5[_0xb561('0x8d')][_0xb561('0xa0')]('nolimit')){_0x59f7cc[_0xb561('0xa1')]=qs[_0xb561('0xa1')](_0x4379c5[_0xb561('0x8d')][_0xb561('0xa1')]);_0x59f7cc['offset']=qs[_0xb561('0xa2')](_0x4379c5[_0xb561('0x8d')][_0xb561('0xa2')]);}_0x59f7cc[_0xb561('0xa3')]=qs[_0xb561('0xa4')](_0x4379c5[_0xb561('0x8d')][_0xb561('0xa4')]);_0x59f7cc[_0xb561('0x8a')]=qs[_0xb561('0x9c')](_[_0xb561('0xa5')](_0x4379c5['query'],_0x3de237['filters']));if(_0x4379c5[_0xb561('0x8d')][_0xb561('0x4')]){_0x59f7cc['where']=_[_0xb561('0xa6')](_0x59f7cc[_0xb561('0x8a')],{'$or':_[_0xb561('0x7')](_0x14119d,function(_0x5e3e48){if(_0x5e3e48['type'][_0xb561('0xa7')]!==_0xb561('0xa8')){var _0x5cec77={};_0x5cec77[_0x5e3e48[_0xb561('0x5')]]={'$like':'%'+_0x4379c5['query']['filter']+'%'};return _0x5cec77;}})});}var _0x51368a=[];var _0xaccd6a=null;var _0x8c3c0b={};if(_0x2ef238){_0xaccd6a=_['find'](_0x5ede3a,[_0xb561('0xc'),_0x2ef238['name']]);if(_0xaccd6a[_0xb561('0x5')]){_0x8c3c0b={};if(_0x490a9b['childModel']==='AnalyticExtractedReport'){_0x8c3c0b[_0xaccd6a[_0xb561('0xa9')]]=_['map'](_0x2ef238[_0xb561('0xb')],'id');}else{_0x8c3c0b[_0xaccd6a[_0xb561('0xa9')]]=_0x2ef238[_0xb561('0xb')];}_0x51368a[_0xb561('0x93')](_0x8c3c0b);}else{_0x59f7cc['where']['id']=_0x2ef238['associatedResources'];}}else{for(var _0x312eab=0x0;_0x312eab<_0x13862e[_0xb561('0x92')];_0x312eab++){_0xaccd6a=_[_0xb561('0x95')](_0x5ede3a,[_0xb561('0xc'),_0x13862e[_0x312eab][_0xb561('0xc')]]);if(_0xaccd6a['field']){_0x8c3c0b={};_0x8c3c0b[_0xaccd6a[_0xb561('0xa9')]]=_0x13862e[_0x312eab][_0xb561('0xb')];_0x51368a[_0xb561('0x93')](_0x8c3c0b);}else{if(!_0x59f7cc[_0xb561('0x8a')]['id'])_0x59f7cc[_0xb561('0x8a')]['id']=[];_0x13862e[_0x312eab]['associatedResources'][_0xb561('0xaa')](function(_0x109e8c){_0x59f7cc['where']['id'][_0xb561('0x93')](_0x109e8c);});}}}if(!_[_0xb561('0x91')](_0x51368a)){_0x59f7cc['where']=_[_0xb561('0xa6')](_0x59f7cc[_0xb561('0x8a')],{'$and':{'$or':_0x51368a}});}_0x59f7cc=_[_0xb561('0xa6')]({},_0x59f7cc,_0x4379c5[_0xb561('0xab')]);if(_0x2ef238&&!_0x2ef238[_0xb561('0x99')]&&_0x490a9b[_0xb561('0x13')]===_0xb561('0xe')){if(_0x4379c5[_0xb561('0x8d')][_0xb561('0xac')]){_0x59f7cc[_0xb561('0xad')]=[{'all':!![]}];}return _0x2f40d3[_0x490a9b[_0xb561('0x13')]][_0xb561('0xa')](_0x59f7cc)[_0xb561('0x6')](function(_0x2e4e69){var _0x525a3c=[];_0x2e4e69[_0xb561('0xaa')](function(_0xfe59de){var _0x57e436;switch(_0xfe59de['reportType']){case _0xb561('0xae'):_0x57e436=_[_0xb561('0x95')](_0x2ef238[_0xb561('0xb')],function(_0x3bbee5){return _0x3bbee5['id']===_0xfe59de[_0xb561('0x81')]&&_0x3bbee5[_0xb561('0x10')]===_0xb561('0xaf');});break;case _0xb561('0xb0'):_0x57e436=_[_0xb561('0x95')](_0x2ef238['associatedResources'],function(_0x577bc1){return _0x577bc1['id']===_0xfe59de['reportId']&&_0x577bc1['type']==='CustomReports';});break;}if(_0x57e436)_0x525a3c[_0xb561('0x93')](_0xfe59de);});_0x2c01cf['count']=_0x525a3c[_0xb561('0x92')];_0x2c01cf[_0xb561('0xb1')]=_0x525a3c;return _0x2c01cf;});}else{if(!_['isEmpty'](_0x4379c5['query']['ids'])){_0x59f7cc[_0xb561('0x8a')]['id']=_0x59f7cc[_0xb561('0x8a')]['id']?_[_0xb561('0x9d')](_0x59f7cc[_0xb561('0x8a')]['id'],_0x4379c5[_0xb561('0x8d')]['ids']):_0x4379c5[_0xb561('0x8d')][_0xb561('0xb2')];if(_0x4379c5[_0xb561('0x8d')][_0xb561('0xb3')]){_0x59f7cc['order']=_0x4379c5[_0xb561('0x8d')]['customSorting'];}}if(_0x4379c5['query'][_0xb561('0xb4')]){_0x59f7cc[_0xb561('0x8a')]=_[_0xb561('0xa6')](_0x59f7cc[_0xb561('0x8a')],{'$and':_0x4379c5[_0xb561('0x8d')][_0xb561('0xb4')]});}return _0x2f40d3[_0x490a9b['childModel']][_0xb561('0xb5')]({'where':_0x59f7cc[_0xb561('0x8a')]})[_0xb561('0x6')](function(_0x52be9f){_0x2c01cf[_0xb561('0xb5')]=_0x52be9f;if(_0x4379c5[_0xb561('0x8d')]['includeAll']){if(_0x490a9b[_0xb561('0x13')]===_0xb561('0x1e')){_0x59f7cc[_0xb561('0xad')]=[{'model':_0x2f40d3[_0xb561('0x75')],'as':'Tags','attributes':['id',_0xb561('0xc'),_0xb561('0xb6')],'required':_0x4379c5[_0xb561('0x8d')][_0xb561('0xb7')]?!![]:![]},{'model':_0x2f40d3['Tag'],'as':_0xb561('0xb8'),'attributes':['id',_0xb561('0xc'),_0xb561('0xb6')],'through':_0x4379c5['query'][_0xb561('0xb7')]?{'attributes':[],'where':{'TagId':_0x4379c5[_0xb561('0x8d')][_0xb561('0xb7')]||undefined}}:{},'required':_0x4379c5[_0xb561('0x8d')][_0xb561('0xb7')]?!![]:![]}];}else{_0x59f7cc[_0xb561('0xad')]=[{'all':!![]}];}}return _0x2f40d3[_0x490a9b[_0xb561('0x13')]]['findAll'](_0x59f7cc);})['then'](function(_0x3c23f5){_0x2c01cf[_0xb561('0xb1')]=_0x3c23f5;if(_0x4eccc1===_0xb561('0x35')&&_0x4379c5[_0xb561('0x8d')][_0xb561('0xb9')]===_0xb561('0xba')){var _0x1df33d=[];for(var _0x59112d=0x0;_0x59112d<_0x2c01cf[_0xb561('0xb1')][_0xb561('0x92')];_0x59112d++){_0x1df33d['push'](_0x1f6d2a(_0xb561('0xbb'),_0x2c01cf['rows'][_0x59112d]['dataValues']));_0x1df33d[_0xb561('0x93')](_0x1f6d2a(_0xb561('0xbc'),_0x2c01cf['rows'][_0x59112d][_0xb561('0xbd')]));_0x1df33d[_0xb561('0x93')](_0x1f6d2a('fax',_0x2c01cf['rows'][_0x59112d]['dataValues']));_0x1df33d['push'](_0x1f6d2a(_0xb561('0xbe'),_0x2c01cf['rows'][_0x59112d][_0xb561('0xbd')]));_0x1df33d[_0xb561('0x93')](_0x1f6d2a(_0xb561('0xbf'),_0x2c01cf[_0xb561('0xb1')][_0x59112d][_0xb561('0xbd')]));_0x1df33d[_0xb561('0x93')](_0x1f6d2a(_0xb561('0xc0'),_0x2c01cf[_0xb561('0xb1')][_0x59112d][_0xb561('0xbd')]));}return Promise['all'](_0x1df33d)[_0xb561('0x6')](function(){return _0x2c01cf;});}return _0x2c01cf;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c716dc5..0cf3585 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 _0x631c=['UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','debug'];(function(_0x5b2a95,_0x175f25){var _0x40db19=function(_0xb87ac0){while(--_0xb87ac0){_0x5b2a95['push'](_0x5b2a95['shift']());}};_0x40db19(++_0x175f25);}(_0x631c,0x1b6));var _0xc631=function(_0x26a388,_0x2ff6a2){_0x26a388=_0x26a388-0x0;var _0x2d1a3a=_0x631c[_0x26a388];return _0x2d1a3a;};'use strict';var _=require(_0xc631('0x0'));var util=require(_0xc631('0x1'));var moment=require('moment');var BPromise=require(_0xc631('0x2'));var rs=require(_0xc631('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc631('0x4'))['db'];var utils=require(_0xc631('0x5'));var logger=require(_0xc631('0x6'))('rpc');var config=require(_0xc631('0x7'));var jayson=require(_0xc631('0x8'));var client=jayson['client'][_0xc631('0x9')]({'port':0x232a});config['redis']=_[_0xc631('0xa')](config[_0xc631('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc631('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a81e0,_0x461dfc,_0x1bd8ac){return new BPromise(function(_0x5eae13,_0x895dd6){return client[_0xc631('0xd')](_0x3a81e0,_0x1bd8ac)[_0xc631('0xe')](function(_0x333a67){logger[_0xc631('0xf')](_0xc631('0x10'),_0x461dfc,'request\x20sent');logger[_0xc631('0x11')](_0xc631('0x12'),_0x461dfc,_0xc631('0x13'),JSON[_0xc631('0x14')](_0x333a67));if(_0x333a67[_0xc631('0x15')]){if(_0x333a67['error'][_0xc631('0x16')]===0x1f4){logger[_0xc631('0x15')]('UserProfile,\x20%s,\x20%s',_0x461dfc,_0x333a67[_0xc631('0x15')][_0xc631('0x17')]);return _0x895dd6(_0x333a67[_0xc631('0x15')][_0xc631('0x17')]);}logger[_0xc631('0x15')](_0xc631('0x10'),_0x461dfc,_0x333a67[_0xc631('0x15')][_0xc631('0x17')]);return _0x5eae13(_0x333a67[_0xc631('0x15')]['message']);}else{logger[_0xc631('0xf')]('UserProfile,\x20%s,\x20%s',_0x461dfc,_0xc631('0x13'));_0x5eae13(_0x333a67['result'][_0xc631('0x17')]);}})['catch'](function(_0x4ab1dc){logger[_0xc631('0x15')](_0xc631('0x10'),_0x461dfc,_0x4ab1dc);_0x895dd6(_0x4ab1dc);});});} \ No newline at end of file +var _0x5a9e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','ioredis'];(function(_0x5848df,_0x581107){var _0x548eb6=function(_0x5e4399){while(--_0x5e4399){_0x5848df['push'](_0x5848df['shift']());}};_0x548eb6(++_0x581107);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x5a9e[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var moment=require(_0xe5a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a9('0x2'));var db=require(_0xe5a9('0x3'))['db'];var utils=require(_0xe5a9('0x4'));var logger=require(_0xe5a9('0x5'))(_0xe5a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5a9('0x7'));var client=jayson['client'][_0xe5a9('0x8')]({'port':0x232a});config[_0xe5a9('0x9')]=_['defaults'](config['redis'],{'host':_0xe5a9('0xa'),'port':0x18eb});var socket=require(_0xe5a9('0xb'))(new Redis(config[_0xe5a9('0x9')]));require(_0xe5a9('0xc'))[_0xe5a9('0xd')](socket);function respondWithRpcPromise(_0x530b67,_0x579b84,_0x7ab4a9){return new BPromise(function(_0x523fda,_0x7ec4cf){return client['request'](_0x530b67,_0x7ab4a9)['then'](function(_0x563625){logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));logger[_0xe5a9('0x11')](_0xe5a9('0x12'),_0x579b84,_0xe5a9('0x10'),JSON['stringify'](_0x563625));if(_0x563625[_0xe5a9('0x13')]){if(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x14')]===0x1f4){logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);return _0x7ec4cf(_0x563625['error'][_0xe5a9('0x15')]);}logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625['error']['message']);return _0x523fda(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);}else{logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));_0x523fda(_0x563625[_0xe5a9('0x16')]['message']);}})[_0xe5a9('0x17')](function(_0x4bff6e){logger['error'](_0xe5a9('0xf'),_0x579b84,_0x4bff6e);_0x7ec4cf(_0x4bff6e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a00c3a2..e7b4f9d 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 _0xfbf4=['update','removeListener','userProfile:','./userProfile.events','save'];(function(_0x1a7295,_0x14b7e6){var _0x2b3396=function(_0x2a2957){while(--_0x2a2957){_0x1a7295['push'](_0x1a7295['shift']());}};_0x2b3396(++_0x14b7e6);}(_0xfbf4,0xad));var _0x4fbf=function(_0x5d5bc0,_0x31a0d3){_0x5d5bc0=_0x5d5bc0-0x0;var _0x2c9022=_0xfbf4[_0x5d5bc0];return _0x2c9022;};'use strict';var UserProfileEvents=require(_0x4fbf('0x0'));var events=[_0x4fbf('0x1'),'remove',_0x4fbf('0x2')];function createListener(_0x173505,_0x28f962){return function(_0x1c96c7){_0x28f962['emit'](_0x173505,_0x1c96c7);};}function removeListener(_0x4473c9,_0x38e65f){return function(){UserProfileEvents[_0x4fbf('0x3')](_0x4473c9,_0x38e65f);};}exports['register']=function(_0x214534){for(var _0x2dbe55=0x0,_0x2e61ea=events['length'];_0x2dbe55<_0x2e61ea;_0x2dbe55++){var _0x3ce646=events[_0x2dbe55];var _0x53e234=createListener(_0x4fbf('0x4')+_0x3ce646,_0x214534);UserProfileEvents['on'](_0x3ce646,_0x53e234);}}; \ No newline at end of file +var _0x8d81=['update','removeListener','register','length','userProfile:','save','remove'];(function(_0x181b72,_0x310a56){var _0x3a7a9a=function(_0x1d7c16){while(--_0x1d7c16){_0x181b72['push'](_0x181b72['shift']());}};_0x3a7a9a(++_0x310a56);}(_0x8d81,0xc9));var _0x18d8=function(_0x1367d0,_0x4cd1ec){_0x1367d0=_0x1367d0-0x0;var _0x5d12fd=_0x8d81[_0x1367d0];return _0x5d12fd;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x18d8('0x0'),_0x18d8('0x1'),_0x18d8('0x2')];function createListener(_0x4c7f0e,_0x35eb3c){return function(_0x55d204){_0x35eb3c['emit'](_0x4c7f0e,_0x55d204);};}function removeListener(_0x3f9d90,_0x3dfe68){return function(){UserProfileEvents[_0x18d8('0x3')](_0x3f9d90,_0x3dfe68);};}exports[_0x18d8('0x4')]=function(_0x590c70){for(var _0x288579=0x0,_0x5e0692=events[_0x18d8('0x5')];_0x288579<_0x5e0692;_0x288579++){var _0x258e8c=events[_0x288579];var _0x5d4439=createListener(_0x18d8('0x6')+_0x258e8c,_0x590c70);UserProfileEvents['on'](_0x258e8c,_0x5d4439);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 550f98d..b51e465 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 _0xfd4d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','/describe','isAuthenticated','show','post','create','put','delete','/:id','destroy','exports','multer','path','express'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfd4d,0x18c));var _0xdfd4=function(_0x4aa1ba,_0xf2e76a){_0x4aa1ba=_0x4aa1ba-0x0;var _0x5ec871=_0xfd4d[_0x4aa1ba];return _0x5ec871;};'use strict';var multer=require(_0xdfd4('0x0'));var util=require('util');var path=require(_0xdfd4('0x1'));var timeout=require('connect-timeout');var express=require(_0xdfd4('0x2'));var router=express[_0xdfd4('0x3')]();var fs_extra=require(_0xdfd4('0x4'));var auth=require(_0xdfd4('0x5'));var interaction=require(_0xdfd4('0x6'));var config=require('../../config/environment');var controller=require(_0xdfd4('0x7'));router[_0xdfd4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfd4('0x8')](_0xdfd4('0x9'),auth[_0xdfd4('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfd4('0xb')]);router[_0xdfd4('0xc')]('/',auth['isAuthenticated'](),controller[_0xdfd4('0xd')]);router[_0xdfd4('0xe')]('/:id',auth[_0xdfd4('0xa')](),controller['update']);router[_0xdfd4('0xf')](_0xdfd4('0x10'),auth['isAuthenticated'](),controller[_0xdfd4('0x11')]);module[_0xdfd4('0x12')]=router; \ No newline at end of file +var _0x89e9=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','create','update','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89e9,0x142));var _0x989e=function(_0x1e3761,_0x5667ab){_0x1e3761=_0x1e3761-0x0;var _0x32a316=_0x89e9[_0x1e3761];return _0x32a316;};'use strict';var multer=require(_0x989e('0x0'));var util=require('util');var path=require(_0x989e('0x1'));var timeout=require(_0x989e('0x2'));var express=require('express');var router=express[_0x989e('0x3')]();var fs_extra=require(_0x989e('0x4'));var auth=require(_0x989e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x989e('0x6'));var controller=require('./userProfileResource.controller');router[_0x989e('0x7')]('/',auth['isAuthenticated'](),controller[_0x989e('0x8')]);router[_0x989e('0x7')](_0x989e('0x9'),auth[_0x989e('0xa')](),controller['describe']);router[_0x989e('0x7')](_0x989e('0xb'),auth[_0x989e('0xa')](),controller[_0x989e('0xc')]);router['post']('/',auth[_0x989e('0xa')](),controller[_0x989e('0xd')]);router['put'](_0x989e('0xb'),auth[_0x989e('0xa')](),controller[_0x989e('0xe')]);router['delete'](_0x989e('0xb'),auth[_0x989e('0xa')](),controller[_0x989e('0xf')]);module[_0x989e('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c1f322e..da6b3f2 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 _0xd8b6=['exports','INTEGER','STRING','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xd8b6,0xc3));var _0x6d8b=function(_0x133345,_0x4a78b1){_0x133345=_0x133345-0x0;var _0x51f3d2=_0xd8b6[_0x133345];return _0x51f3d2;};'use strict';var Sequelize=require(_0x6d8b('0x0'));module[_0x6d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6d8b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6d8b('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x87da=['INTEGER','sequelize','exports','STRING'];(function(_0x503bf8,_0x17c5b2){var _0x3f17e7=function(_0x5874cb){while(--_0x5874cb){_0x503bf8['push'](_0x503bf8['shift']());}};_0x3f17e7(++_0x17c5b2);}(_0x87da,0x1f1));var _0xa87d=function(_0x27a057,_0x1399df){_0x27a057=_0x27a057-0x0;var _0x4697cd=_0x87da[_0x27a057];return _0x4697cd;};'use strict';var Sequelize=require(_0xa87d('0x0'));module[_0xa87d('0x1')]={'name':{'type':Sequelize[_0xa87d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa87d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa87d('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 7c100f5..4c368d0 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 _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x5f06c4,_0x59ca1d){var _0x32dcc7=function(_0x1aba08){while(--_0x1aba08){_0x5f06c4['push'](_0x5f06c4['shift']());}};_0x32dcc7(++_0x59ca1d);}(_0xd943,0x15d));var _0x3d94=function(_0x29343c,_0x59361b){_0x29343c=_0x29343c-0x0;var _0x167d3d=_0xd943[_0x29343c];return _0x167d3d;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x687b,0x14a));var _0xb687=function(_0x5e72dc,_0xa12f95){_0x5e72dc=_0x5e72dc-0x0;var _0x197a74=_0x687b[_0x5e72dc];return _0x197a74;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4bf34f1..f7dafb7 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 _0xbe27=['compositeIndex','resourceId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x1f246f,_0x1f3cd8){var _0x2c393d=function(_0x3d21f5){while(--_0x3d21f5){_0x1f246f['push'](_0x1f246f['shift']());}};_0x2c393d(++_0x1f3cd8);}(_0xbe27,0x16e));var _0x7be2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbe27[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7be2('0x0'));var util=require(_0x7be2('0x1'));var logger=require(_0x7be2('0x2'))(_0x7be2('0x3'));var moment=require('moment');var BPromise=require(_0x7be2('0x4'));var rp=require(_0x7be2('0x5'));var fs=require('fs');var path=require(_0x7be2('0x6'));var rimraf=require(_0x7be2('0x7'));var config=require('../../config/environment');var attributes=require(_0x7be2('0x8'));module[_0x7be2('0x9')]=function(_0x6b1952,_0x4d7941){return _0x6b1952[_0x7be2('0xa')]('UserProfileResource',attributes,{'tableName':_0x7be2('0xb'),'paranoid':![],'indexes':[{'name':_0x7be2('0xc'),'fields':[_0x7be2('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6117=['sectionId','util','api','moment','bluebird','../../config/environment','UserProfileResource','compositeIndex'];(function(_0x3351e4,_0x39a1a0){var _0x3bba3e=function(_0x326d34){while(--_0x326d34){_0x3351e4['push'](_0x3351e4['shift']());}};_0x3bba3e(++_0x39a1a0);}(_0x6117,0xf1));var _0x7611=function(_0x1d9b2f,_0x302212){_0x1d9b2f=_0x1d9b2f-0x0;var _0xaca565=_0x6117[_0x1d9b2f];return _0xaca565;};'use strict';var _=require('lodash');var util=require(_0x7611('0x0'));var logger=require('../../config/logger')(_0x7611('0x1'));var moment=require(_0x7611('0x2'));var BPromise=require(_0x7611('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7611('0x4'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x3d9f50,_0x4df16c){return _0x3d9f50['define'](_0x7611('0x5'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x7611('0x6'),'fields':['resourceId',_0x7611('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d0113fd..aa37fdd 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 _0x6297=['../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','rpc'];(function(_0x3dba21,_0x12ec5d){var _0x2e4d12=function(_0x400265){while(--_0x400265){_0x3dba21['push'](_0x3dba21['shift']());}};_0x2e4d12(++_0x12ec5d);}(_0x6297,0x10c));var _0x7629=function(_0x15929a,_0x45a0f2){_0x15929a=_0x15929a-0x0;var _0x3cdc20=_0x6297[_0x15929a];return _0x3cdc20;};'use strict';var _=require(_0x7629('0x0'));var util=require(_0x7629('0x1'));var moment=require(_0x7629('0x2'));var BPromise=require('bluebird');var rs=require(_0x7629('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7629('0x4'));var config=require(_0x7629('0x5'));var jayson=require(_0x7629('0x6'));var client=jayson[_0x7629('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d14cb,_0x457e16,_0x40e07a){return new BPromise(function(_0x3cc478,_0x408e5d){return client[_0x7629('0x8')](_0x3d14cb,_0x40e07a)[_0x7629('0x9')](function(_0x3bc45e){logger[_0x7629('0xa')](_0x7629('0xb'),_0x457e16,_0x7629('0xc'));logger[_0x7629('0xd')](_0x7629('0xe'),_0x457e16,_0x7629('0xc'),JSON[_0x7629('0xf')](_0x3bc45e));if(_0x3bc45e[_0x7629('0x10')]){if(_0x3bc45e['error'][_0x7629('0x11')]===0x1f4){logger['error'](_0x7629('0xb'),_0x457e16,_0x3bc45e['error'][_0x7629('0x12')]);return _0x408e5d(_0x3bc45e['error'][_0x7629('0x12')]);}logger['error'](_0x7629('0xb'),_0x457e16,_0x3bc45e[_0x7629('0x10')][_0x7629('0x12')]);return _0x3cc478(_0x3bc45e[_0x7629('0x10')]['message']);}else{logger[_0x7629('0xa')](_0x7629('0xb'),_0x457e16,_0x7629('0xc'));_0x3cc478(_0x3bc45e[_0x7629('0x13')][_0x7629('0x12')]);}})[_0x7629('0x14')](function(_0x7c1d52){logger[_0x7629('0x10')](_0x7629('0xb'),_0x457e16,_0x7c1d52);_0x408e5d(_0x7c1d52);});});} \ No newline at end of file +var _0x4bc9=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0xcf9f71,_0x5d7bf3){var _0x380b7=function(_0x521b40){while(--_0x521b40){_0xcf9f71['push'](_0xcf9f71['shift']());}};_0x380b7(++_0x5d7bf3);}(_0x4bc9,0x171));var _0x94bc=function(_0x35c711,_0x23ebae){_0x35c711=_0x35c711-0x0;var _0x3cd9b3=_0x4bc9[_0x35c711];return _0x3cd9b3;};'use strict';var _=require(_0x94bc('0x0'));var util=require('util');var moment=require(_0x94bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x94bc('0x2'));var fs=require('fs');var Redis=require(_0x94bc('0x3'));var db=require(_0x94bc('0x4'))['db'];var utils=require(_0x94bc('0x5'));var logger=require(_0x94bc('0x6'))('rpc');var config=require(_0x94bc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x94bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1441f1,_0x467bb3,_0x264425){return new BPromise(function(_0x42020b,_0x4d8699){return client[_0x94bc('0x9')](_0x1441f1,_0x264425)[_0x94bc('0xa')](function(_0x5afeb5){logger[_0x94bc('0xb')](_0x94bc('0xc'),_0x467bb3,_0x94bc('0xd'));logger[_0x94bc('0xe')](_0x94bc('0xf'),_0x467bb3,_0x94bc('0xd'),JSON[_0x94bc('0x10')](_0x5afeb5));if(_0x5afeb5[_0x94bc('0x11')]){if(_0x5afeb5[_0x94bc('0x11')]['code']===0x1f4){logger[_0x94bc('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x467bb3,_0x5afeb5[_0x94bc('0x11')][_0x94bc('0x12')]);return _0x4d8699(_0x5afeb5[_0x94bc('0x11')][_0x94bc('0x12')]);}logger[_0x94bc('0x11')](_0x94bc('0xc'),_0x467bb3,_0x5afeb5[_0x94bc('0x11')][_0x94bc('0x12')]);return _0x42020b(_0x5afeb5[_0x94bc('0x11')]['message']);}else{logger[_0x94bc('0xb')](_0x94bc('0xc'),_0x467bb3,'request\x20sent');_0x42020b(_0x5afeb5[_0x94bc('0x13')][_0x94bc('0x12')]);}})[_0x94bc('0x14')](function(_0x3fd7d4){logger[_0x94bc('0x11')](_0x94bc('0xc'),_0x467bb3,_0x3fd7d4);_0x4d8699(_0x3fd7d4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 71a9ccd..1cbe7a0 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 _0x9242=['post','create','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x33e313,_0x441c19){var _0x36c2d1=function(_0x2820e5){while(--_0x2820e5){_0x33e313['push'](_0x33e313['shift']());}};_0x36c2d1(++_0x441c19);}(_0x9242,0x182));var _0x2924=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x9242[_0x4fa438];return _0x4e3958;};'use strict';var multer=require(_0x2924('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2924('0x1'));var express=require(_0x2924('0x2'));var router=express['Router']();var fs_extra=require(_0x2924('0x3'));var auth=require(_0x2924('0x4'));var interaction=require(_0x2924('0x5'));var config=require('../../config/environment');var controller=require(_0x2924('0x6'));router[_0x2924('0x7')]('/',auth[_0x2924('0x8')](),controller[_0x2924('0x9')]);router['get'](_0x2924('0xa'),auth['isAuthenticated'](),controller[_0x2924('0xb')]);router[_0x2924('0x7')](_0x2924('0xc'),auth[_0x2924('0x8')](),controller[_0x2924('0xd')]);router[_0x2924('0xe')]('/',auth[_0x2924('0x8')](),controller[_0x2924('0xf')]);router[_0x2924('0x10')]('/:id',auth[_0x2924('0x8')](),controller[_0x2924('0x11')]);router[_0x2924('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2924('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdeaf=['./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3e4316,_0x55a93d){var _0x3dbb3a=function(_0x44c65b){while(--_0x44c65b){_0x3e4316['push'](_0x3e4316['shift']());}};_0x3dbb3a(++_0x55a93d);}(_0xdeaf,0x15d));var _0xfdea=function(_0x1725f2,_0xe369c2){_0x1725f2=_0x1725f2-0x0;var _0x1feedc=_0xdeaf[_0x1725f2];return _0x1feedc;};'use strict';var multer=require(_0xfdea('0x0'));var util=require('util');var path=require(_0xfdea('0x1'));var timeout=require(_0xfdea('0x2'));var express=require(_0xfdea('0x3'));var router=express['Router']();var fs_extra=require(_0xfdea('0x4'));var auth=require(_0xfdea('0x5'));var interaction=require(_0xfdea('0x6'));var config=require(_0xfdea('0x7'));var controller=require(_0xfdea('0x8'));router[_0xfdea('0x9')]('/',auth[_0xfdea('0xa')](),controller[_0xfdea('0xb')]);router[_0xfdea('0x9')](_0xfdea('0xc'),auth['isAuthenticated'](),controller[_0xfdea('0xd')]);router['get'](_0xfdea('0xe'),auth[_0xfdea('0xa')](),controller['show']);router['post']('/',auth[_0xfdea('0xa')](),controller[_0xfdea('0xf')]);router[_0xfdea('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfdea('0x11')]);router[_0xfdea('0x12')](_0xfdea('0xe'),auth[_0xfdea('0xa')](),controller[_0xfdea('0x13')]);module[_0xfdea('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b2d1601..fe959d5 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 _0xa30a=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa30('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa30('0x2')],'set':function(_0x2a9b06){this[_0xaa30('0x5')](_0xaa30('0x6'),_0x2a9b06?_0x2a9b06['join'](''):[]);},'get':function(){return this[_0xaa30('0x7')]('crudPermissions')?this[_0xaa30('0x7')](_0xaa30('0x6'))[_0xaa30('0x8')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x1927dc,_0x235225){var _0x4882dc=function(_0x419205){while(--_0x419205){_0x1927dc['push'](_0x1927dc['shift']());}};_0x4882dc(++_0x235225);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x359e49,_0x4d38b5){_0x359e49=_0x359e49-0x0;var _0x1fe928=_0x9ffd[_0x359e49];return _0x1fe928;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b3b57a7..f0b57b1 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 _0x3a90=['squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','fs-extra','lodash'];(function(_0x439190,_0x267b5a){var _0x4c9435=function(_0x27a562){while(--_0x27a562){_0x439190['push'](_0x439190['shift']());}};_0x4c9435(++_0x267b5a);}(_0x3a90,0x1b3));var _0x03a9=function(_0x22cb06,_0x2b979d){_0x22cb06=_0x22cb06-0x0;var _0x53776b=_0x3a90[_0x22cb06];return _0x53776b;};'use strict';var emlformat=require(_0x03a9('0x0'));var rimraf=require(_0x03a9('0x1'));var zipdir=require(_0x03a9('0x2'));var jsonpatch=require(_0x03a9('0x3'));var rp=require(_0x03a9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x03a9('0x5'));var path=require(_0x03a9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03a9('0x7'));var _=require(_0x03a9('0x8'));var squel=require(_0x03a9('0x9'));var crypto=require(_0x03a9('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03a9('0xb'));var Redis=require(_0x03a9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x03a9('0xd'));var as=require(_0x03a9('0xe'));var hardwareService=require(_0x03a9('0xf'));var logger=require('../../config/logger')(_0x03a9('0x10'));var utils=require(_0x03a9('0x11'));var config=require(_0x03a9('0x12'));var licenseUtil=require(_0x03a9('0x13'));var db=require(_0x03a9('0x14'))['db'];function respondWithStatusCode(_0x14d7bc,_0x42e84a){_0x42e84a=_0x42e84a||0xcc;return function(_0x298c5b){if(_0x298c5b){return _0x14d7bc[_0x03a9('0x15')](_0x42e84a);}return _0x14d7bc['status'](_0x42e84a)[_0x03a9('0x16')]();};}function respondWithResult(_0xcdf797,_0xbcfb9d){_0xbcfb9d=_0xbcfb9d||0xc8;return function(_0x29dad8){if(_0x29dad8){return _0xcdf797[_0x03a9('0x17')](_0xbcfb9d)[_0x03a9('0x18')](_0x29dad8);}};}function respondWithFilteredResult(_0x387d88,_0xefd652){return function(_0x3e6cdb){if(_0x3e6cdb){var _0x442f13=typeof _0xefd652['offset']===_0x03a9('0x19')&&typeof _0xefd652[_0x03a9('0x1a')]===_0x03a9('0x19');var _0x25c9e1=_0x3e6cdb[_0x03a9('0x1b')];var _0x6f54a7=_0x442f13?0x0:_0xefd652['offset'];var _0x2f442c=_0x442f13?_0x3e6cdb['count']:_0xefd652[_0x03a9('0x1c')]+_0xefd652[_0x03a9('0x1a')];var _0x2c3244;if(_0x2f442c>=_0x25c9e1){_0x2f442c=_0x25c9e1;_0x2c3244=0xc8;}else{_0x2c3244=0xce;}_0x387d88[_0x03a9('0x17')](_0x2c3244);return _0x387d88['set'](_0x03a9('0x1d'),_0x6f54a7+'-'+_0x2f442c+'/'+_0x25c9e1)[_0x03a9('0x18')](_0x3e6cdb);}return null;};}function patchUpdates(_0x4023c7){return function(_0x2983b1){try{jsonpatch[_0x03a9('0x1e')](_0x2983b1,_0x4023c7,!![]);}catch(_0x256486){return BPromise[_0x03a9('0x1f')](_0x256486);}return _0x2983b1[_0x03a9('0x20')]();};}function saveUpdates(_0x550dca,_0x381b76){return function(_0x101235){if(_0x101235){return _0x101235[_0x03a9('0x21')](_0x550dca)['then'](function(_0x1c86cf){return _0x1c86cf;});}return null;};}function removeEntity(_0x2e04a0,_0x588745){return function(_0x12181c){if(_0x12181c){return _0x12181c[_0x03a9('0x22')]()['then'](function(){_0x2e04a0['status'](0xcc)[_0x03a9('0x16')]();});}};}function handleEntityNotFound(_0x2d339e,_0x184291){return function(_0x6feae0){if(!_0x6feae0){_0x2d339e['sendStatus'](0x194);}return _0x6feae0;};}function handleError(_0x30d735,_0x3e433c){_0x3e433c=_0x3e433c||0x1f4;return function(_0x38f49a){logger[_0x03a9('0x23')](_0x38f49a[_0x03a9('0x24')]);if(_0x38f49a[_0x03a9('0x25')]){delete _0x38f49a['name'];}_0x30d735[_0x03a9('0x17')](_0x3e433c)[_0x03a9('0x26')](_0x38f49a);};}exports[_0x03a9('0x27')]=function(_0x3a420a,_0x32703d){var _0xb5ac96={},_0x40f4dc={},_0x25803d={'count':0x0,'rows':[]};var _0x54b80f=_[_0x03a9('0x28')](db[_0x03a9('0x29')][_0x03a9('0x2a')],function(_0x3c9ec7){return{'name':_0x3c9ec7[_0x03a9('0x2b')],'type':_0x3c9ec7[_0x03a9('0x2c')][_0x03a9('0x2d')]};});_0x40f4dc[_0x03a9('0x2e')]=_[_0x03a9('0x28')](_0x54b80f,_0x03a9('0x25'));_0x40f4dc[_0x03a9('0x2f')]=_[_0x03a9('0x30')](_0x3a420a[_0x03a9('0x2f')]);_0x40f4dc[_0x03a9('0x31')]=_[_0x03a9('0x32')](_0x40f4dc[_0x03a9('0x2e')],_0x40f4dc[_0x03a9('0x2f')]);_0xb5ac96['attributes']=_[_0x03a9('0x32')](_0x40f4dc['model'],qs[_0x03a9('0x33')](_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x33')]));_0xb5ac96[_0x03a9('0x34')]=_0xb5ac96[_0x03a9('0x34')][_0x03a9('0x35')]?_0xb5ac96[_0x03a9('0x34')]:_0x40f4dc[_0x03a9('0x2e')];if(!_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x36')](_0x03a9('0x37'))){_0xb5ac96[_0x03a9('0x1a')]=qs[_0x03a9('0x1a')](_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x1a')]);_0xb5ac96[_0x03a9('0x1c')]=qs['offset'](_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x1c')]);}_0xb5ac96[_0x03a9('0x38')]=qs[_0x03a9('0x39')](_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x39')]);_0xb5ac96['where']=qs[_0x03a9('0x31')](_[_0x03a9('0x3a')](_0x3a420a[_0x03a9('0x2f')],_0x40f4dc[_0x03a9('0x31')]),_0x54b80f);if(_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x3b')]){_0xb5ac96[_0x03a9('0x3c')]=_[_0x03a9('0x3d')](_0xb5ac96['where'],{'$or':_[_0x03a9('0x28')](_0x54b80f,function(_0x5947df){if(_0x5947df[_0x03a9('0x2c')]!==_0x03a9('0x3e')){var _0x220430={};_0x220430[_0x5947df[_0x03a9('0x25')]]={'$like':'%'+_0x3a420a[_0x03a9('0x2f')][_0x03a9('0x3b')]+'%'};return _0x220430;}})});}_0xb5ac96=_['merge']({},_0xb5ac96,_0x3a420a[_0x03a9('0x3f')]);var _0x47c409={'where':_0xb5ac96[_0x03a9('0x3c')]};return db[_0x03a9('0x29')]['count'](_0x47c409)[_0x03a9('0x40')](function(_0x45713e){_0x25803d[_0x03a9('0x1b')]=_0x45713e;if(_0x3a420a[_0x03a9('0x2f')]['includeAll']){_0xb5ac96[_0x03a9('0x41')]=[{'all':!![]}];}return db[_0x03a9('0x29')][_0x03a9('0x42')](_0xb5ac96);})[_0x03a9('0x40')](function(_0x2f0ab9){_0x25803d[_0x03a9('0x43')]=_0x2f0ab9;return _0x25803d;})[_0x03a9('0x40')](respondWithFilteredResult(_0x32703d,_0xb5ac96))[_0x03a9('0x44')](handleError(_0x32703d,null));};exports['show']=function(_0x2ed944,_0x5ac762){var _0x21f159={'raw':![],'where':{'id':_0x2ed944[_0x03a9('0x45')]['id']}},_0x5d44e0={};_0x5d44e0[_0x03a9('0x2e')]=_[_0x03a9('0x30')](db[_0x03a9('0x29')]['rawAttributes']);_0x5d44e0['query']=_[_0x03a9('0x30')](_0x2ed944['query']);_0x5d44e0[_0x03a9('0x31')]=_[_0x03a9('0x32')](_0x5d44e0['model'],_0x5d44e0[_0x03a9('0x2f')]);_0x21f159[_0x03a9('0x34')]=_[_0x03a9('0x32')](_0x5d44e0['model'],qs[_0x03a9('0x33')](_0x2ed944[_0x03a9('0x2f')]['fields']));_0x21f159[_0x03a9('0x34')]=_0x21f159[_0x03a9('0x34')][_0x03a9('0x35')]?_0x21f159[_0x03a9('0x34')]:_0x5d44e0['model'];if(_0x2ed944['query']['includeAll']){_0x21f159[_0x03a9('0x41')]=[{'all':!![]}];}_0x21f159=_[_0x03a9('0x3d')]({},_0x21f159,_0x2ed944[_0x03a9('0x3f')]);return db[_0x03a9('0x29')][_0x03a9('0x46')](_0x21f159)[_0x03a9('0x40')](handleEntityNotFound(_0x5ac762,null))[_0x03a9('0x40')](respondWithResult(_0x5ac762,null))[_0x03a9('0x44')](handleError(_0x5ac762,null));};exports[_0x03a9('0x47')]=function(_0x388fc7,_0x2c6f06){return db[_0x03a9('0x29')][_0x03a9('0x47')](_0x388fc7[_0x03a9('0x48')],{})[_0x03a9('0x40')](respondWithResult(_0x2c6f06,0xc9))[_0x03a9('0x44')](handleError(_0x2c6f06,null));};exports[_0x03a9('0x21')]=function(_0x2e89ec,_0x148e9e){if(_0x2e89ec[_0x03a9('0x48')]['id']){delete _0x2e89ec[_0x03a9('0x48')]['id'];}return db['UserProfileSection'][_0x03a9('0x46')]({'where':{'id':_0x2e89ec[_0x03a9('0x45')]['id']}})[_0x03a9('0x40')](handleEntityNotFound(_0x148e9e,null))[_0x03a9('0x40')](saveUpdates(_0x2e89ec[_0x03a9('0x48')],null))['then'](respondWithResult(_0x148e9e,null))['catch'](handleError(_0x148e9e,null));};exports[_0x03a9('0x22')]=function(_0x1ae9cc,_0x1e6c42){return db[_0x03a9('0x29')][_0x03a9('0x46')]({'where':{'id':_0x1ae9cc['params']['id']}})[_0x03a9('0x40')](handleEntityNotFound(_0x1e6c42,null))[_0x03a9('0x40')](removeEntity(_0x1e6c42,null))[_0x03a9('0x44')](handleError(_0x1e6c42,null));};exports['describe']=function(_0x2d349f,_0x55f3a4){return db[_0x03a9('0x29')][_0x03a9('0x49')]()[_0x03a9('0x40')](respondWithResult(_0x55f3a4,null))[_0x03a9('0x44')](handleError(_0x55f3a4,null));}; \ No newline at end of file +var _0xd461=['limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xd461,0x14b));var _0x1d46=function(_0x455a7b,_0x2d6dde){_0x455a7b=_0x455a7b-0x0;var _0x5d9823=_0xd461[_0x455a7b];return _0x5d9823;};'use strict';var emlformat=require(_0x1d46('0x0'));var rimraf=require(_0x1d46('0x1'));var zipdir=require(_0x1d46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d46('0x3'));var moment=require(_0x1d46('0x4'));var BPromise=require(_0x1d46('0x5'));var Mustache=require('mustache');var util=require(_0x1d46('0x6'));var path=require(_0x1d46('0x7'));var sox=require(_0x1d46('0x8'));var csv=require('to-csv');var ejs=require(_0x1d46('0x9'));var fs=require('fs');var fs_extra=require(_0x1d46('0xa'));var _=require(_0x1d46('0xb'));var squel=require(_0x1d46('0xc'));var crypto=require('crypto');var jsforce=require(_0x1d46('0xd'));var deskjs=require(_0x1d46('0xe'));var toCsv=require(_0x1d46('0xf'));var querystring=require(_0x1d46('0x10'));var Papa=require('papaparse');var Redis=require(_0x1d46('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d46('0x12'));var hardwareService=require(_0x1d46('0x13'));var logger=require(_0x1d46('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1d46('0x15'));var licenseUtil=require(_0x1d46('0x16'));var db=require(_0x1d46('0x17'))['db'];function respondWithStatusCode(_0x433b06,_0xce5b99){_0xce5b99=_0xce5b99||0xcc;return function(_0x1db354){if(_0x1db354){return _0x433b06[_0x1d46('0x18')](_0xce5b99);}return _0x433b06['status'](_0xce5b99)[_0x1d46('0x19')]();};}function respondWithResult(_0x40e1ed,_0x1c2c7f){_0x1c2c7f=_0x1c2c7f||0xc8;return function(_0x3bd3b8){if(_0x3bd3b8){return _0x40e1ed[_0x1d46('0x1a')](_0x1c2c7f)['json'](_0x3bd3b8);}};}function respondWithFilteredResult(_0xc4b7c3,_0x4a4173){return function(_0x5171a7){if(_0x5171a7){var _0x204072=typeof _0x4a4173[_0x1d46('0x1b')]===_0x1d46('0x1c')&&typeof _0x4a4173[_0x1d46('0x1d')]===_0x1d46('0x1c');var _0x474953=_0x5171a7['count'];var _0x2dd124=_0x204072?0x0:_0x4a4173[_0x1d46('0x1b')];var _0x48bc3d=_0x204072?_0x5171a7[_0x1d46('0x1e')]:_0x4a4173['offset']+_0x4a4173[_0x1d46('0x1d')];var _0x259fe7;if(_0x48bc3d>=_0x474953){_0x48bc3d=_0x474953;_0x259fe7=0xc8;}else{_0x259fe7=0xce;}_0xc4b7c3['status'](_0x259fe7);return _0xc4b7c3[_0x1d46('0x1f')](_0x1d46('0x20'),_0x2dd124+'-'+_0x48bc3d+'/'+_0x474953)[_0x1d46('0x21')](_0x5171a7);}return null;};}function patchUpdates(_0x4ea930){return function(_0xc81e82){try{jsonpatch[_0x1d46('0x22')](_0xc81e82,_0x4ea930,!![]);}catch(_0x444659){return BPromise['reject'](_0x444659);}return _0xc81e82[_0x1d46('0x23')]();};}function saveUpdates(_0x37e617,_0x30e110){return function(_0x2cb75b){if(_0x2cb75b){return _0x2cb75b[_0x1d46('0x24')](_0x37e617)[_0x1d46('0x25')](function(_0x288555){return _0x288555;});}return null;};}function removeEntity(_0x5f0a43,_0x45dfcd){return function(_0x3b14b8){if(_0x3b14b8){return _0x3b14b8[_0x1d46('0x26')]()[_0x1d46('0x25')](function(){_0x5f0a43['status'](0xcc)[_0x1d46('0x19')]();});}};}function handleEntityNotFound(_0x2c98ff,_0x400417){return function(_0x3ae9a5){if(!_0x3ae9a5){_0x2c98ff[_0x1d46('0x18')](0x194);}return _0x3ae9a5;};}function handleError(_0x1d5627,_0x16cb8c){_0x16cb8c=_0x16cb8c||0x1f4;return function(_0x28a9c5){logger[_0x1d46('0x27')](_0x28a9c5['stack']);if(_0x28a9c5[_0x1d46('0x28')]){delete _0x28a9c5[_0x1d46('0x28')];}_0x1d5627[_0x1d46('0x1a')](_0x16cb8c)['send'](_0x28a9c5);};}exports['index']=function(_0x4b1393,_0xee894c){var _0x3dc3c4={},_0x264d8a={},_0x42f7f5={'count':0x0,'rows':[]};var _0x5082eb=_[_0x1d46('0x29')](db['UserProfileSection'][_0x1d46('0x2a')],function(_0x2d0efb){return{'name':_0x2d0efb['fieldName'],'type':_0x2d0efb[_0x1d46('0x2b')][_0x1d46('0x2c')]};});_0x264d8a['model']=_[_0x1d46('0x29')](_0x5082eb,_0x1d46('0x28'));_0x264d8a[_0x1d46('0x2d')]=_[_0x1d46('0x2e')](_0x4b1393['query']);_0x264d8a['filters']=_[_0x1d46('0x2f')](_0x264d8a[_0x1d46('0x30')],_0x264d8a[_0x1d46('0x2d')]);_0x3dc3c4['attributes']=_[_0x1d46('0x2f')](_0x264d8a[_0x1d46('0x30')],qs['fields'](_0x4b1393[_0x1d46('0x2d')][_0x1d46('0x31')]));_0x3dc3c4[_0x1d46('0x32')]=_0x3dc3c4[_0x1d46('0x32')][_0x1d46('0x33')]?_0x3dc3c4[_0x1d46('0x32')]:_0x264d8a[_0x1d46('0x30')];if(!_0x4b1393[_0x1d46('0x2d')][_0x1d46('0x34')]('nolimit')){_0x3dc3c4[_0x1d46('0x1d')]=qs[_0x1d46('0x1d')](_0x4b1393['query'][_0x1d46('0x1d')]);_0x3dc3c4[_0x1d46('0x1b')]=qs['offset'](_0x4b1393[_0x1d46('0x2d')][_0x1d46('0x1b')]);}_0x3dc3c4[_0x1d46('0x35')]=qs[_0x1d46('0x36')](_0x4b1393[_0x1d46('0x2d')]['sort']);_0x3dc3c4[_0x1d46('0x37')]=qs[_0x1d46('0x38')](_[_0x1d46('0x39')](_0x4b1393[_0x1d46('0x2d')],_0x264d8a['filters']),_0x5082eb);if(_0x4b1393[_0x1d46('0x2d')][_0x1d46('0x3a')]){_0x3dc3c4[_0x1d46('0x37')]=_['merge'](_0x3dc3c4[_0x1d46('0x37')],{'$or':_['map'](_0x5082eb,function(_0x40ce87){if(_0x40ce87[_0x1d46('0x2b')]!=='VIRTUAL'){var _0x4e8805={};_0x4e8805[_0x40ce87[_0x1d46('0x28')]]={'$like':'%'+_0x4b1393['query'][_0x1d46('0x3a')]+'%'};return _0x4e8805;}})});}_0x3dc3c4=_[_0x1d46('0x3b')]({},_0x3dc3c4,_0x4b1393[_0x1d46('0x3c')]);var _0x204387={'where':_0x3dc3c4['where']};return db[_0x1d46('0x3d')][_0x1d46('0x1e')](_0x204387)[_0x1d46('0x25')](function(_0x2e6d80){_0x42f7f5[_0x1d46('0x1e')]=_0x2e6d80;if(_0x4b1393[_0x1d46('0x2d')][_0x1d46('0x3e')]){_0x3dc3c4[_0x1d46('0x3f')]=[{'all':!![]}];}return db[_0x1d46('0x3d')][_0x1d46('0x40')](_0x3dc3c4);})['then'](function(_0x5334e0){_0x42f7f5[_0x1d46('0x41')]=_0x5334e0;return _0x42f7f5;})[_0x1d46('0x25')](respondWithFilteredResult(_0xee894c,_0x3dc3c4))[_0x1d46('0x42')](handleError(_0xee894c,null));};exports[_0x1d46('0x43')]=function(_0x488721,_0x218f67){var _0x3b8d76={'raw':![],'where':{'id':_0x488721['params']['id']}},_0xcfadd4={};_0xcfadd4[_0x1d46('0x30')]=_['keys'](db[_0x1d46('0x3d')]['rawAttributes']);_0xcfadd4[_0x1d46('0x2d')]=_['keys'](_0x488721[_0x1d46('0x2d')]);_0xcfadd4[_0x1d46('0x38')]=_[_0x1d46('0x2f')](_0xcfadd4[_0x1d46('0x30')],_0xcfadd4['query']);_0x3b8d76[_0x1d46('0x32')]=_[_0x1d46('0x2f')](_0xcfadd4[_0x1d46('0x30')],qs[_0x1d46('0x31')](_0x488721[_0x1d46('0x2d')]['fields']));_0x3b8d76['attributes']=_0x3b8d76[_0x1d46('0x32')][_0x1d46('0x33')]?_0x3b8d76['attributes']:_0xcfadd4[_0x1d46('0x30')];if(_0x488721[_0x1d46('0x2d')][_0x1d46('0x3e')]){_0x3b8d76['include']=[{'all':!![]}];}_0x3b8d76=_['merge']({},_0x3b8d76,_0x488721[_0x1d46('0x3c')]);return db['UserProfileSection'][_0x1d46('0x44')](_0x3b8d76)[_0x1d46('0x25')](handleEntityNotFound(_0x218f67,null))['then'](respondWithResult(_0x218f67,null))[_0x1d46('0x42')](handleError(_0x218f67,null));};exports['create']=function(_0x264af3,_0x4fb5b2){return db['UserProfileSection'][_0x1d46('0x45')](_0x264af3[_0x1d46('0x46')],{})[_0x1d46('0x25')](respondWithResult(_0x4fb5b2,0xc9))[_0x1d46('0x42')](handleError(_0x4fb5b2,null));};exports[_0x1d46('0x24')]=function(_0x34b16c,_0x3964b3){if(_0x34b16c[_0x1d46('0x46')]['id']){delete _0x34b16c[_0x1d46('0x46')]['id'];}return db[_0x1d46('0x3d')][_0x1d46('0x44')]({'where':{'id':_0x34b16c['params']['id']}})[_0x1d46('0x25')](handleEntityNotFound(_0x3964b3,null))[_0x1d46('0x25')](saveUpdates(_0x34b16c['body'],null))['then'](respondWithResult(_0x3964b3,null))[_0x1d46('0x42')](handleError(_0x3964b3,null));};exports['destroy']=function(_0x5c842b,_0x3faf3f){return db[_0x1d46('0x3d')][_0x1d46('0x44')]({'where':{'id':_0x5c842b['params']['id']}})[_0x1d46('0x25')](handleEntityNotFound(_0x3faf3f,null))['then'](removeEntity(_0x3faf3f,null))[_0x1d46('0x42')](handleError(_0x3faf3f,null));};exports[_0x1d46('0x47')]=function(_0x1f1c2e,_0x44616a){return db[_0x1d46('0x3d')]['describe']()['then'](respondWithResult(_0x44616a,null))[_0x1d46('0x42')](handleError(_0x44616a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index db70039..3bde2ac 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 _0x048d=['userProfileId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x49f811,_0x165726){var _0x456f56=function(_0x3b70ec){while(--_0x3b70ec){_0x49f811['push'](_0x49f811['shift']());}};_0x456f56(++_0x165726);}(_0x048d,0xc5));var _0xd048=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x048d[_0x3cb30b];return _0x2ca717;};'use strict';var _=require('lodash');var util=require(_0xd048('0x0'));var logger=require(_0xd048('0x1'))(_0xd048('0x2'));var moment=require(_0xd048('0x3'));var BPromise=require('bluebird');var rp=require(_0xd048('0x4'));var fs=require('fs');var path=require(_0xd048('0x5'));var rimraf=require(_0xd048('0x6'));var config=require(_0xd048('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xd048('0x8')]=function(_0x1ec125,_0x5a9ab3){return _0x1ec125[_0xd048('0x9')](_0xd048('0xa'),attributes,{'tableName':_0xd048('0xb'),'paranoid':![],'indexes':[{'name':_0xd048('0xc'),'fields':['sectionId',_0xd048('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd133=['lodash','util','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId'];(function(_0x21725d,_0x4c64f3){var _0x669d40=function(_0xa706f9){while(--_0xa706f9){_0x21725d['push'](_0x21725d['shift']());}};_0x669d40(++_0x4c64f3);}(_0xd133,0x84));var _0x3d13=function(_0x30e25c,_0x355276){_0x30e25c=_0x30e25c-0x0;var _0x47959b=_0xd133[_0x30e25c];return _0x47959b;};'use strict';var _=require(_0x3d13('0x0'));var util=require(_0x3d13('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d13('0x2'));var rimraf=require(_0x3d13('0x3'));var config=require(_0x3d13('0x4'));var attributes=require(_0x3d13('0x5'));module[_0x3d13('0x6')]=function(_0x5d1d16,_0x19149e){return _0x5d1d16[_0x3d13('0x7')](_0x3d13('0x8'),attributes,{'tableName':_0x3d13('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3d13('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f0f6d18..a8eafdb 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 _0xb905=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2e077b,_0x451fdf){var _0x2929e=function(_0x3ca4d1){while(--_0x3ca4d1){_0x2e077b['push'](_0x2e077b['shift']());}};_0x2929e(++_0x451fdf);}(_0xb905,0xa7));var _0x5b90=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb905[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x5b90('0x0'));var util=require('util');var moment=require(_0x5b90('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b90('0x2'));var fs=require('fs');var Redis=require(_0x5b90('0x3'));var db=require(_0x5b90('0x4'))['db'];var utils=require(_0x5b90('0x5'));var logger=require(_0x5b90('0x6'))(_0x5b90('0x7'));var config=require(_0x5b90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b90('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x296cd0,_0x362fbb,_0x55f7cc){return new BPromise(function(_0xfe8529,_0x428eb9){return client['request'](_0x296cd0,_0x55f7cc)['then'](function(_0x3cff73){logger[_0x5b90('0xa')](_0x5b90('0xb'),_0x362fbb,_0x5b90('0xc'));logger[_0x5b90('0xd')](_0x5b90('0xe'),_0x362fbb,_0x5b90('0xc'),JSON[_0x5b90('0xf')](_0x3cff73));if(_0x3cff73[_0x5b90('0x10')]){if(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x11')]===0x1f4){logger[_0x5b90('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x362fbb,_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);return _0x428eb9(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);}logger['error'](_0x5b90('0xb'),_0x362fbb,_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);return _0xfe8529(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);}else{logger[_0x5b90('0xa')](_0x5b90('0xb'),_0x362fbb,_0x5b90('0xc'));_0xfe8529(_0x3cff73[_0x5b90('0x13')][_0x5b90('0x12')]);}})[_0x5b90('0x14')](function(_0x14e829){logger[_0x5b90('0x10')](_0x5b90('0xb'),_0x362fbb,_0x14e829);_0x428eb9(_0x14e829);});});} \ No newline at end of file +var _0xc0af=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x39ba5a,_0x5801af){var _0x56d822=function(_0x566621){while(--_0x566621){_0x39ba5a['push'](_0x39ba5a['shift']());}};_0x56d822(++_0x5801af);}(_0xc0af,0x1ab));var _0xfc0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0af[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc0a('0x0'));var util=require('util');var moment=require(_0xfc0a('0x1'));var BPromise=require(_0xfc0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc0a('0x4'));var logger=require(_0xfc0a('0x5'))(_0xfc0a('0x6'));var config=require(_0xfc0a('0x7'));var jayson=require(_0xfc0a('0x8'));var client=jayson[_0xfc0a('0x9')][_0xfc0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3c3b,_0x156660,_0x2f2bee){return new BPromise(function(_0x5ab071,_0x598df9){return client[_0xfc0a('0xb')](_0x5f3c3b,_0x2f2bee)['then'](function(_0x377b1b){logger[_0xfc0a('0xc')](_0xfc0a('0xd'),_0x156660,_0xfc0a('0xe'));logger[_0xfc0a('0xf')](_0xfc0a('0x10'),_0x156660,_0xfc0a('0xe'),JSON[_0xfc0a('0x11')](_0x377b1b));if(_0x377b1b[_0xfc0a('0x12')]){if(_0x377b1b[_0xfc0a('0x12')]['code']===0x1f4){logger[_0xfc0a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x156660,_0x377b1b[_0xfc0a('0x12')]['message']);return _0x598df9(_0x377b1b[_0xfc0a('0x12')]['message']);}logger['error'](_0xfc0a('0xd'),_0x156660,_0x377b1b[_0xfc0a('0x12')][_0xfc0a('0x13')]);return _0x5ab071(_0x377b1b[_0xfc0a('0x12')][_0xfc0a('0x13')]);}else{logger[_0xfc0a('0xc')](_0xfc0a('0xd'),_0x156660,_0xfc0a('0xe'));_0x5ab071(_0x377b1b[_0xfc0a('0x14')][_0xfc0a('0x13')]);}})[_0xfc0a('0x15')](function(_0x5e2e11){logger['error'](_0xfc0a('0xd'),_0x156660,_0x5e2e11);_0x598df9(_0x5e2e11);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fec5fc3..6b17bf0 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(_0x140654,_0x1c55c5){var _0x28b0fb=function(_0x1dac7b){while(--_0x1dac7b){_0x140654['push'](_0x140654['shift']());}};_0x28b0fb(++_0x1c55c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xcb91[_0x38b14f];return _0x22a324;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a3d27,_0xf7bfa1){var _0x591fd0=function(_0xd6b983){while(--_0xd6b983){_0x2a3d27['push'](_0x2a3d27['shift']());}};_0x591fd0(++_0xf7bfa1);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b0c58e7..bda6c41 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 _0xc005=['sequelize','exports','INTEGER'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xc005,0x1f2));var _0x5c00=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xc005[_0x3df871];return _0x570f7b;};'use strict';var Sequelize=require(_0x5c00('0x0'));module[_0x5c00('0x1')]={'penalty':{'type':Sequelize[_0x5c00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe126=['exports'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xe126,0xf2));var _0x6e12=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe126[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x6e12('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 533ce48..375032c 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 _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','user_has_sms_queues','bluebird'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x5d58,0x187));var _0x85d5=function(_0x1c29d0,_0x20b026){_0x1c29d0=_0x1c29d0-0x0;var _0x3101f0=_0x5d58[_0x1c29d0];return _0x3101f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./userSmsQueue.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('UserSmsQueue',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe785=['util','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x7de6d5,_0x5286ff){var _0x164b73=function(_0x21810a){while(--_0x21810a){_0x7de6d5['push'](_0x7de6d5['shift']());}};_0x164b73(++_0x5286ff);}(_0xe785,0x128));var _0x5e78=function(_0x5d2b80,_0x2d0df7){_0x5d2b80=_0x5d2b80-0x0;var _0xfdda82=_0xe785[_0x5d2b80];return _0xfdda82;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var logger=require('../../config/logger')(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var BPromise=require(_0x5e78('0x4'));var rp=require(_0x5e78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e78('0x6'));var attributes=require(_0x5e78('0x7'));module[_0x5e78('0x8')]=function(_0x135552,_0x502114){return _0x135552['define'](_0x5e78('0x9'),attributes,{'tableName':_0x5e78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 292f0ee..ca5ddec 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 _0xa333=['jayson/promise','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1db989,_0x3c0c9d){var _0x36e8b3=function(_0x3ac5e9){while(--_0x3ac5e9){_0x1db989['push'](_0x1db989['shift']());}};_0x36e8b3(++_0x3c0c9d);}(_0xa333,0x1a8));var _0x3a33=function(_0x5c9968,_0x2d9779){_0x5c9968=_0x5c9968-0x0;var _0x3e444d=_0xa333[_0x5c9968];return _0x3e444d;};'use strict';var _=require(_0x3a33('0x0'));var util=require(_0x3a33('0x1'));var moment=require(_0x3a33('0x2'));var BPromise=require(_0x3a33('0x3'));var rs=require(_0x3a33('0x4'));var fs=require('fs');var Redis=require(_0x3a33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a33('0x6'));var logger=require(_0x3a33('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a33('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x274198,_0x5934c7,_0x32fb9a){return new BPromise(function(_0x1d056e,_0x3baf26){return client[_0x3a33('0x9')](_0x274198,_0x32fb9a)[_0x3a33('0xa')](function(_0x422c69){logger['info'](_0x3a33('0xb'),_0x5934c7,_0x3a33('0xc'));logger['debug'](_0x3a33('0xd'),_0x5934c7,'request\x20sent',JSON[_0x3a33('0xe')](_0x422c69));if(_0x422c69[_0x3a33('0xf')]){if(_0x422c69[_0x3a33('0xf')]['code']===0x1f4){logger[_0x3a33('0xf')](_0x3a33('0xb'),_0x5934c7,_0x422c69[_0x3a33('0xf')]['message']);return _0x3baf26(_0x422c69[_0x3a33('0xf')][_0x3a33('0x10')]);}logger['error'](_0x3a33('0xb'),_0x5934c7,_0x422c69[_0x3a33('0xf')]['message']);return _0x1d056e(_0x422c69['error'][_0x3a33('0x10')]);}else{logger[_0x3a33('0x11')](_0x3a33('0xb'),_0x5934c7,'request\x20sent');_0x1d056e(_0x422c69['result']['message']);}})['catch'](function(_0x30a6ba){logger[_0x3a33('0xf')](_0x3a33('0xb'),_0x5934c7,_0x30a6ba);_0x3baf26(_0x30a6ba);});});} \ No newline at end of file +var _0x76d9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','bluebird'];(function(_0x19d8ba,_0x5fa6f0){var _0xf3065f=function(_0x35625c){while(--_0x35625c){_0x19d8ba['push'](_0x19d8ba['shift']());}};_0xf3065f(++_0x5fa6f0);}(_0x76d9,0x138));var _0x976d=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x76d9[_0x300b26];return _0x5cb1ae;};'use strict';var _=require(_0x976d('0x0'));var util=require(_0x976d('0x1'));var moment=require('moment');var BPromise=require(_0x976d('0x2'));var rs=require(_0x976d('0x3'));var fs=require('fs');var Redis=require(_0x976d('0x4'));var db=require(_0x976d('0x5'))['db'];var utils=require(_0x976d('0x6'));var logger=require(_0x976d('0x7'))(_0x976d('0x8'));var config=require('../../config/environment');var jayson=require(_0x976d('0x9'));var client=jayson[_0x976d('0xa')][_0x976d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a513,_0x209b1a,_0xa268b1){return new BPromise(function(_0x43bde6,_0x5526ed){return client[_0x976d('0xc')](_0x40a513,_0xa268b1)[_0x976d('0xd')](function(_0x4e727a){logger[_0x976d('0xe')](_0x976d('0xf'),_0x209b1a,_0x976d('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x209b1a,_0x976d('0x10'),JSON['stringify'](_0x4e727a));if(_0x4e727a['error']){if(_0x4e727a['error']['code']===0x1f4){logger[_0x976d('0x11')](_0x976d('0xf'),_0x209b1a,_0x4e727a[_0x976d('0x11')][_0x976d('0x12')]);return _0x5526ed(_0x4e727a[_0x976d('0x11')][_0x976d('0x12')]);}logger[_0x976d('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x209b1a,_0x4e727a[_0x976d('0x11')][_0x976d('0x12')]);return _0x43bde6(_0x4e727a['error'][_0x976d('0x12')]);}else{logger[_0x976d('0xe')](_0x976d('0xf'),_0x209b1a,_0x976d('0x10'));_0x43bde6(_0x4e727a[_0x976d('0x13')][_0x976d('0x12')]);}})[_0x976d('0x14')](function(_0x1250ea){logger[_0x976d('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x209b1a,_0x1250ea);_0x5526ed(_0x1250ea);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6223a78..3eccf67 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 _0x4774=['sequelize','exports','INTEGER'];(function(_0x4e5af1,_0x1dfc1f){var _0x357f9d=function(_0x645f3b){while(--_0x645f3b){_0x4e5af1['push'](_0x4e5af1['shift']());}};_0x357f9d(++_0x1dfc1f);}(_0x4774,0xb4));var _0x4477=function(_0x1974a1,_0x347db8){_0x1974a1=_0x1974a1-0x0;var _0x415789=_0x4774[_0x1974a1];return _0x415789;};'use strict';var Sequelize=require(_0x4477('0x0'));module[_0x4477('0x1')]={'UserId':{'type':Sequelize[_0x4477('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4477('0x2')]}}; \ No newline at end of file +var _0xa7cd=['sequelize','exports','INTEGER'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xa7cd,0x12c));var _0xda7c=function(_0x59b86f,_0x1c3b73){_0x59b86f=_0x59b86f-0x0;var _0x34bae7=_0xa7cd[_0x59b86f];return _0x34bae7;};'use strict';var Sequelize=require(_0xda7c('0x0'));module[_0xda7c('0x1')]={'UserId':{'type':Sequelize[_0xda7c('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xda7c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ba9c76c..a711c95 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(_0x36e805,_0x4d6a08){var _0x510b39=function(_0x221281){while(--_0x221281){_0x36e805['push'](_0x36e805['shift']());}};_0x510b39(++_0x4d6a08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5d9abb,_0x590ce7){var _0x236fb4=function(_0x3de3d4){while(--_0x3de3d4){_0x5d9abb['push'](_0x5d9abb['shift']());}};_0x236fb4(++_0x590ce7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 8345708..e5022be 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(_0x592461,_0x24cc58){var _0x2af32f=function(_0x4f8dcb){while(--_0x4f8dcb){_0x592461['push'](_0x592461['shift']());}};_0x2af32f(++_0x24cc58);}(_0xe706,0xa3));var _0x6e70=function(_0x36de53,_0x4a0679){_0x36de53=_0x36de53-0x0;var _0x2b04cb=_0xe706[_0x36de53];return _0x2b04cb;};'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(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8fdbf1d..d46a1ca 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 _0xd9ee=['exports','sequelize'];(function(_0x2ddb83,_0x4f0c1f){var _0x3349eb=function(_0xb5164){while(--_0xb5164){_0x2ddb83['push'](_0x2ddb83['shift']());}};_0x3349eb(++_0x4f0c1f);}(_0xd9ee,0x1d3));var _0xed9e=function(_0x438d1a,_0x205b46){_0x438d1a=_0x438d1a-0x0;var _0x2de8ca=_0xd9ee[_0x438d1a];return _0x2de8ca;};'use strict';var Sequelize=require(_0xed9e('0x0'));module[_0xed9e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b7a=['exports','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b7a,0x77));var _0xa6b7=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x6b7a[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require(_0xa6b7('0x0'));module[_0xa6b7('0x1')]={'penalty':{'type':Sequelize[_0xa6b7('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 2224735..9f9522e 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 _0x20c0=['request-promise','rimraf','../../config/environment','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x20c0,0x186));var _0x020c=function(_0x2a5029,_0x20f267){_0x2a5029=_0x2a5029-0x0;var _0x51f3af=_0x20c0[_0x2a5029];return _0x51f3af;};'use strict';var _=require(_0x020c('0x0'));var util=require(_0x020c('0x1'));var logger=require(_0x020c('0x2'))(_0x020c('0x3'));var moment=require(_0x020c('0x4'));var BPromise=require(_0x020c('0x5'));var rp=require(_0x020c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x020c('0x7'));var config=require(_0x020c('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x020c('0x9')]=function(_0x2a0bc7,_0x598f3b){return _0x2a0bc7[_0x020c('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x020c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3d7=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment','path'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0xc3d7,0x146));var _0x7c3d=function(_0x178925,_0x12dec4){_0x178925=_0x178925-0x0;var _0x59522c=_0xc3d7[_0x178925];return _0x59522c;};'use strict';var _=require(_0x7c3d('0x0'));var util=require(_0x7c3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7c3d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c3d('0x3'));var rimraf=require(_0x7c3d('0x4'));var config=require(_0x7c3d('0x5'));var attributes=require(_0x7c3d('0x6'));module[_0x7c3d('0x7')]=function(_0x383cc1,_0x17233a){return _0x383cc1[_0x7c3d('0x8')](_0x7c3d('0x9'),attributes,{'tableName':_0x7c3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 525dbd5..0d2ef34 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 _0xe64c=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x36e557,_0x582535){var _0x4072f7=function(_0x552ed5){while(--_0x552ed5){_0x36e557['push'](_0x36e557['shift']());}};_0x4072f7(++_0x582535);}(_0xe64c,0xe9));var _0xce64=function(_0x3f48d9,_0xa5956d){_0x3f48d9=_0x3f48d9-0x0;var _0x32de47=_0xe64c[_0x3f48d9];return _0x32de47;};'use strict';var _=require(_0xce64('0x0'));var util=require(_0xce64('0x1'));var moment=require(_0xce64('0x2'));var BPromise=require(_0xce64('0x3'));var rs=require(_0xce64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce64('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce64('0x6'))(_0xce64('0x7'));var config=require('../../config/environment');var jayson=require(_0xce64('0x8'));var client=jayson[_0xce64('0x9')][_0xce64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37f4c5,_0x27e27a,_0x3ac7e0){return new BPromise(function(_0x2babca,_0x13daaf){return client['request'](_0x37f4c5,_0x3ac7e0)[_0xce64('0xb')](function(_0x3929a9){logger['info'](_0xce64('0xc'),_0x27e27a,'request\x20sent');logger[_0xce64('0xd')](_0xce64('0xe'),_0x27e27a,_0xce64('0xf'),JSON[_0xce64('0x10')](_0x3929a9));if(_0x3929a9[_0xce64('0x11')]){if(_0x3929a9[_0xce64('0x11')][_0xce64('0x12')]===0x1f4){logger[_0xce64('0x11')](_0xce64('0xc'),_0x27e27a,_0x3929a9[_0xce64('0x11')][_0xce64('0x13')]);return _0x13daaf(_0x3929a9[_0xce64('0x11')][_0xce64('0x13')]);}logger[_0xce64('0x11')](_0xce64('0xc'),_0x27e27a,_0x3929a9[_0xce64('0x11')]['message']);return _0x2babca(_0x3929a9[_0xce64('0x11')][_0xce64('0x13')]);}else{logger[_0xce64('0x14')](_0xce64('0xc'),_0x27e27a,'request\x20sent');_0x2babca(_0x3929a9[_0xce64('0x15')][_0xce64('0x13')]);}})[_0xce64('0x16')](function(_0x29ecfa){logger['error'](_0xce64('0xc'),_0x27e27a,_0x29ecfa);_0x13daaf(_0x29ecfa);});});} \ No newline at end of file +var _0x8308=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x429370,_0x46ff4c){var _0x41a3ad=function(_0x47d51e){while(--_0x47d51e){_0x429370['push'](_0x429370['shift']());}};_0x41a3ad(++_0x46ff4c);}(_0x8308,0x1df));var _0x8830=function(_0x2354f1,_0xabfc06){_0x2354f1=_0x2354f1-0x0;var _0x2274ca=_0x8308[_0x2354f1];return _0x2274ca;};'use strict';var _=require(_0x8830('0x0'));var util=require('util');var moment=require(_0x8830('0x1'));var BPromise=require(_0x8830('0x2'));var rs=require(_0x8830('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8830('0x4'))['db'];var utils=require(_0x8830('0x5'));var logger=require(_0x8830('0x6'))(_0x8830('0x7'));var config=require(_0x8830('0x8'));var jayson=require(_0x8830('0x9'));var client=jayson['client'][_0x8830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8c49,_0x55ca31,_0x28eea4){return new BPromise(function(_0x520369,_0x1f642b){return client['request'](_0x2d8c49,_0x28eea4)['then'](function(_0xeefe03){logger[_0x8830('0xb')](_0x8830('0xc'),_0x55ca31,_0x8830('0xd'));logger[_0x8830('0xe')](_0x8830('0xf'),_0x55ca31,_0x8830('0xd'),JSON[_0x8830('0x10')](_0xeefe03));if(_0xeefe03[_0x8830('0x11')]){if(_0xeefe03['error'][_0x8830('0x12')]===0x1f4){logger[_0x8830('0x11')](_0x8830('0xc'),_0x55ca31,_0xeefe03[_0x8830('0x11')]['message']);return _0x1f642b(_0xeefe03[_0x8830('0x11')][_0x8830('0x13')]);}logger[_0x8830('0x11')](_0x8830('0xc'),_0x55ca31,_0xeefe03[_0x8830('0x11')]['message']);return _0x520369(_0xeefe03[_0x8830('0x11')][_0x8830('0x13')]);}else{logger[_0x8830('0xb')](_0x8830('0xc'),_0x55ca31,'request\x20sent');_0x520369(_0xeefe03[_0x8830('0x14')][_0x8830('0x13')]);}})[_0x8830('0x15')](function(_0x14b4b4){logger[_0x8830('0x11')](_0x8830('0xc'),_0x55ca31,_0x14b4b4);_0x1f642b(_0x14b4b4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index fc154c8..95642f9 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a7155,_0x3683f5){var _0x24b0e1=function(_0x399e7d){while(--_0x399e7d){_0x3a7155['push'](_0x3a7155['shift']());}};_0x24b0e1(++_0x3683f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x35b7e8,_0x10fbd2){var _0x22bde4=function(_0x584fe8){while(--_0x584fe8){_0x35b7e8['push'](_0x35b7e8['shift']());}};_0x22bde4(++_0x10fbd2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index e15e014..b0d6b71 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 _0x87f9=['STRING','Required\x20by\x20Asterisk','INTEGER','queue_interface','sequelize','exports'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0x87f9,0xa6));var _0x987f=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x87f9[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x987f('0x0'));module[_0x987f('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x987f('0x2')],'allowNull':![],'comment':_0x987f('0x3')},'UserId':{'type':Sequelize[_0x987f('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x987f('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x987f('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x987f('0x5'),'comment':_0x987f('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x987f('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x2603=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x270913,_0xb25fb4){var _0x1e1dba=function(_0x1bbe82){while(--_0x1bbe82){_0x270913['push'](_0x270913['shift']());}};_0x1e1dba(++_0xb25fb4);}(_0x2603,0x1ac));var _0x3260=function(_0xf1f2e0,_0x37c415){_0xf1f2e0=_0xf1f2e0-0x0;var _0x991373=_0x2603[_0xf1f2e0];return _0x991373;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3260('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3260('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3260('0x1')},'UserId':{'type':Sequelize[_0x3260('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3260('0x2')],'allowNull':![],'unique':_0x3260('0x3'),'comment':_0x3260('0x1')},'VoiceQueueId':{'type':Sequelize[_0x3260('0x0')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x3260('0x1')},'penalty':{'type':Sequelize[_0x3260('0x0')](0xb),'defaultValue':0x0,'comment':_0x3260('0x1')},'paused':{'type':Sequelize[_0x3260('0x0')](0xb),'defaultValue':0x0,'comment':_0x3260('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index bd563e1..5a9341a 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 _0xcac4=['setMaxListeners','update','hasOwnProperty','hook','exports','events','UserVoiceQueueRt'];(function(_0x1a79c8,_0x5f0d05){var _0x11abc2=function(_0x3c8559){while(--_0x3c8559){_0x1a79c8['push'](_0x1a79c8['shift']());}};_0x11abc2(++_0x5f0d05);}(_0xcac4,0xbb));var _0x4cac=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcac4[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x4cac('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4cac('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4cac('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4cac('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e2f3a){return function(_0x249a6c,_0x5b9d30,_0x5f4721){UserVoiceQueueRtEvents['emit'](_0x1e2f3a+':'+_0x249a6c['id'],_0x249a6c);UserVoiceQueueRtEvents['emit'](_0x1e2f3a,_0x249a6c);_0x5f4721(null);};}for(var e in events){if(events[_0x4cac('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x4cac('0x5')](e,emitEvent(event));}}module[_0x4cac('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x94bf=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x94bf,0x7d));var _0xf94b=function(_0x2fa55a,_0x3d133f){_0x2fa55a=_0x2fa55a-0x0;var _0x2ace1e=_0x94bf[_0x2fa55a];return _0x2ace1e;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xf94b('0x0'))['db'][_0xf94b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf94b('0x2')](0x0);var events={'afterCreate':_0xf94b('0x3'),'afterUpdate':_0xf94b('0x4'),'afterDestroy':_0xf94b('0x5')};function emitEvent(_0x5aefe4){return function(_0x20a1a0,_0x31f08b,_0x4291c8){UserVoiceQueueRtEvents[_0xf94b('0x6')](_0x5aefe4+':'+_0x20a1a0['id'],_0x20a1a0);UserVoiceQueueRtEvents['emit'](_0x5aefe4,_0x20a1a0);_0x4291c8(null);};}for(var e in events){if(events[_0xf94b('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf94b('0x8')](e,emitEvent(event));}}module[_0xf94b('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 83d3da0..0ca8164 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 _0xf916=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf916,0xec));var _0x6f91=function(_0x3a3f9c,_0x486feb){_0x3a3f9c=_0x3a3f9c-0x0;var _0x494643=_0xf916[_0x3a3f9c];return _0x494643;};'use strict';var _=require(_0x6f91('0x0'));var util=require(_0x6f91('0x1'));var logger=require('../../config/logger')(_0x6f91('0x2'));var moment=require(_0x6f91('0x3'));var BPromise=require(_0x6f91('0x4'));var rp=require(_0x6f91('0x5'));var fs=require('fs');var path=require(_0x6f91('0x6'));var rimraf=require(_0x6f91('0x7'));var config=require(_0x6f91('0x8'));var attributes=require(_0x6f91('0x9'));module[_0x6f91('0xa')]=function(_0x295bbe,_0x4c4807){return _0x295bbe[_0x6f91('0xb')](_0x6f91('0xc'),attributes,{'tableName':_0x6f91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50f2=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x50f2,0x197));var _0x250f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x50f2[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x250f('0x0'));var util=require(_0x250f('0x1'));var logger=require(_0x250f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x250f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x250f('0x4'));var rimraf=require(_0x250f('0x5'));var config=require(_0x250f('0x6'));var attributes=require(_0x250f('0x7'));module[_0x250f('0x8')]=function(_0x5d1cf9,_0x274afb){return _0x5d1cf9[_0x250f('0x9')](_0x250f('0xa'),attributes,{'tableName':_0x250f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8f5553e..426e3c2 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 _0xf214=['then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register'];(function(_0x349ec1,_0x4388c3){var _0x39ca27=function(_0xaba773){while(--_0xaba773){_0x349ec1['push'](_0x349ec1['shift']());}};_0x39ca27(++_0x4388c3);}(_0xf214,0x111));var _0x4f21=function(_0x58f363,_0x135c64){_0x58f363=_0x58f363-0x0;var _0xcb2c83=_0xf214[_0x58f363];return _0xcb2c83;};'use strict';var _=require(_0x4f21('0x0'));var util=require('util');var moment=require(_0x4f21('0x1'));var BPromise=require(_0x4f21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f21('0x3'));var db=require(_0x4f21('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f21('0x5'))(_0x4f21('0x6'));var config=require(_0x4f21('0x7'));var jayson=require(_0x4f21('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4f21('0x9')](config['redis'],{'host':_0x4f21('0xa'),'port':0x18eb});var socket=require(_0x4f21('0xb'))(new Redis(config[_0x4f21('0xc')]));require(_0x4f21('0xd'))[_0x4f21('0xe')](socket);function respondWithRpcPromise(_0x432925,_0x2c7a7e,_0x1b591a){return new BPromise(function(_0x23f383,_0x1d866e){return client['request'](_0x432925,_0x1b591a)[_0x4f21('0xf')](function(_0x3edd1e){logger['info'](_0x4f21('0x10'),_0x2c7a7e,_0x4f21('0x11'));logger[_0x4f21('0x12')](_0x4f21('0x13'),_0x2c7a7e,'request\x20sent',JSON[_0x4f21('0x14')](_0x3edd1e));if(_0x3edd1e[_0x4f21('0x15')]){if(_0x3edd1e[_0x4f21('0x15')][_0x4f21('0x16')]===0x1f4){logger[_0x4f21('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c7a7e,_0x3edd1e[_0x4f21('0x15')][_0x4f21('0x17')]);return _0x1d866e(_0x3edd1e[_0x4f21('0x15')][_0x4f21('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c7a7e,_0x3edd1e['error'][_0x4f21('0x17')]);return _0x23f383(_0x3edd1e[_0x4f21('0x15')][_0x4f21('0x17')]);}else{logger[_0x4f21('0x18')](_0x4f21('0x10'),_0x2c7a7e,'request\x20sent');_0x23f383(_0x3edd1e[_0x4f21('0x19')][_0x4f21('0x17')]);}})[_0x4f21('0x1a')](function(_0x364e2f){logger[_0x4f21('0x15')](_0x4f21('0x10'),_0x2c7a7e,_0x364e2f);_0x1d866e(_0x364e2f);});});}exports[_0x4f21('0x1b')]=function(_0x1737ae){var _0x79107d=this;return new Promise(function(_0x3ab2a8,_0x414548){return db[_0x4f21('0x1c')][_0x4f21('0x1d')]({'raw':_0x1737ae[_0x4f21('0x1e')]?_0x1737ae[_0x4f21('0x1e')][_0x4f21('0x1f')]===undefined?!![]:![]:!![],'where':_0x1737ae[_0x4f21('0x1e')]?_0x1737ae['options'][_0x4f21('0x20')]||null:null,'attributes':[[db[_0x4f21('0x21')]['fn'](_0x4f21('0x22'),db['sequelize']['fn']('IF',db[_0x4f21('0x21')][_0x4f21('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x4f21('0xf')](function(_0xbcad70){logger[_0x4f21('0x18')](_0x4f21('0x1b'),_0x1737ae);logger[_0x4f21('0x12')](_0x4f21('0x1b'),_0x1737ae,JSON[_0x4f21('0x14')](_0xbcad70));_0x3ab2a8(_0xbcad70);})[_0x4f21('0x1a')](function(_0x4177d8){logger[_0x4f21('0x15')](_0x4f21('0x1b'),_0x4177d8[_0x4f21('0x17')],_0x1737ae);_0x414548(_0x79107d[_0x4f21('0x15')](0x1f4,_0x4177d8[_0x4f21('0x17')]));});});}; \ No newline at end of file +var _0xa825=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0xa825,0x124));var _0x5a82=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa825[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5a82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a82('0x1'));var fs=require('fs');var Redis=require(_0x5a82('0x2'));var db=require(_0x5a82('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a82('0x4'))(_0x5a82('0x5'));var config=require(_0x5a82('0x6'));var jayson=require(_0x5a82('0x7'));var client=jayson[_0x5a82('0x8')][_0x5a82('0x9')]({'port':0x232a});config[_0x5a82('0xa')]=_[_0x5a82('0xb')](config['redis'],{'host':_0x5a82('0xc'),'port':0x18eb});var socket=require(_0x5a82('0xd'))(new Redis(config['redis']));require(_0x5a82('0xe'))[_0x5a82('0xf')](socket);function respondWithRpcPromise(_0x3498be,_0x1252c7,_0x35c1ad){return new BPromise(function(_0x33dd12,_0x2f0b8f){return client[_0x5a82('0x10')](_0x3498be,_0x35c1ad)[_0x5a82('0x11')](function(_0x1061f9){logger[_0x5a82('0x12')](_0x5a82('0x13'),_0x1252c7,_0x5a82('0x14'));logger[_0x5a82('0x15')](_0x5a82('0x16'),_0x1252c7,_0x5a82('0x14'),JSON[_0x5a82('0x17')](_0x1061f9));if(_0x1061f9['error']){if(_0x1061f9['error'][_0x5a82('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1252c7,_0x1061f9[_0x5a82('0x19')][_0x5a82('0x1a')]);return _0x2f0b8f(_0x1061f9[_0x5a82('0x19')][_0x5a82('0x1a')]);}logger['error'](_0x5a82('0x13'),_0x1252c7,_0x1061f9[_0x5a82('0x19')][_0x5a82('0x1a')]);return _0x33dd12(_0x1061f9['error'][_0x5a82('0x1a')]);}else{logger[_0x5a82('0x12')](_0x5a82('0x13'),_0x1252c7,_0x5a82('0x14'));_0x33dd12(_0x1061f9[_0x5a82('0x1b')][_0x5a82('0x1a')]);}})['catch'](function(_0x2a0d6d){logger['error'](_0x5a82('0x13'),_0x1252c7,_0x2a0d6d);_0x2f0b8f(_0x2a0d6d);});});}exports[_0x5a82('0x1c')]=function(_0x5110c3){var _0x2cea3b=this;return new Promise(function(_0x5b4e40,_0x17bce6){return db[_0x5a82('0x1d')][_0x5a82('0x1e')]({'raw':_0x5110c3[_0x5a82('0x1f')]?_0x5110c3[_0x5a82('0x1f')][_0x5a82('0x20')]===undefined?!![]:![]:!![],'where':_0x5110c3[_0x5a82('0x1f')]?_0x5110c3[_0x5a82('0x1f')][_0x5a82('0x21')]||null:null,'attributes':[[db[_0x5a82('0x22')]['fn'](_0x5a82('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x5a82('0x24')](_0x5a82('0x25')))),'outboundQueuePauses']]})[_0x5a82('0x11')](function(_0x257479){logger['info'](_0x5a82('0x1c'),_0x5110c3);logger['debug'](_0x5a82('0x1c'),_0x5110c3,JSON['stringify'](_0x257479));_0x5b4e40(_0x257479);})[_0x5a82('0x26')](function(_0x3014a6){logger[_0x5a82('0x19')]('GetVoiceQueueRtPauses',_0x3014a6[_0x5a82('0x1a')],_0x5110c3);_0x17bce6(_0x2cea3b[_0x5a82('0x19')](0x1f4,_0x3014a6[_0x5a82('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7d53b77..f0b0e09 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 _0x1354=['save','remove','update','removeListener','length','./userVoiceQueueRt.events'];(function(_0x7f870e,_0x393b9c){var _0x752210=function(_0x23a1ea){while(--_0x23a1ea){_0x7f870e['push'](_0x7f870e['shift']());}};_0x752210(++_0x393b9c);}(_0x1354,0x95));var _0x4135=function(_0x5dfd65,_0x1ad889){_0x5dfd65=_0x5dfd65-0x0;var _0x47f853=_0x1354[_0x5dfd65];return _0x47f853;};'use strict';var UserVoiceQueueRtEvents=require(_0x4135('0x0'));var events=[_0x4135('0x1'),_0x4135('0x2'),_0x4135('0x3')];function createListener(_0x41c8f3,_0x435d5e){return function(_0x102fec){_0x435d5e['emit'](_0x41c8f3,_0x102fec);};}function removeListener(_0x2c75a3,_0x4ed434){return function(){UserVoiceQueueRtEvents[_0x4135('0x4')](_0x2c75a3,_0x4ed434);};}exports['register']=function(_0x14ff47){for(var _0x2bcd68=0x0,_0x5e355d=events[_0x4135('0x5')];_0x2bcd68<_0x5e355d;_0x2bcd68++){var _0x1dcce0=events[_0x2bcd68];var _0x3e7ae3=createListener('userVoiceQueueRt:'+_0x1dcce0,_0x14ff47);UserVoiceQueueRtEvents['on'](_0x1dcce0,_0x3e7ae3);}}; \ No newline at end of file +var _0x3dba=['emit','removeListener','register','update'];(function(_0x575062,_0x4dddcc){var _0x2dc470=function(_0x11ea51){while(--_0x11ea51){_0x575062['push'](_0x575062['shift']());}};_0x2dc470(++_0x4dddcc);}(_0x3dba,0x73));var _0xa3db=function(_0x20f3a3,_0xe879a){_0x20f3a3=_0x20f3a3-0x0;var _0x4ecd05=_0x3dba[_0x20f3a3];return _0x4ecd05;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save','remove',_0xa3db('0x0')];function createListener(_0x182106,_0x5c0fb2){return function(_0x3843af){_0x5c0fb2[_0xa3db('0x1')](_0x182106,_0x3843af);};}function removeListener(_0x20b644,_0x189a24){return function(){UserVoiceQueueRtEvents[_0xa3db('0x2')](_0x20b644,_0x189a24);};}exports[_0xa3db('0x3')]=function(_0x34b96f){for(var _0x51b39c=0x0,_0x5807bb=events['length'];_0x51b39c<_0x5807bb;_0x51b39c++){var _0x4f77df=events[_0x51b39c];var _0x3357f2=createListener('userVoiceQueueRt:'+_0x4f77df,_0x34b96f);UserVoiceQueueRtEvents['on'](_0x4f77df,_0x3357f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 090c040..93cfca7 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x25dfdf,_0x542333){var _0x5220da=function(_0x53accc){while(--_0x53accc){_0x25dfdf['push'](_0x25dfdf['shift']());}};_0x5220da(++_0x542333);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xaf6558,_0x35990b){var _0x223114=function(_0x298063){while(--_0x298063){_0xaf6558['push'](_0xaf6558['shift']());}};_0x223114(++_0x35990b);}(_0xe706,0xa3));var _0x6e70=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0xe706[_0x3bb21a];return _0x5f3983;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3334852..9ffa82a 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 _0xf7c4=['exports','INTEGER','sequelize'];(function(_0x1255e0,_0x159cbe){var _0x305ce8=function(_0x29545a){while(--_0x29545a){_0x1255e0['push'](_0x1255e0['shift']());}};_0x305ce8(++_0x159cbe);}(_0xf7c4,0xc2));var _0x4f7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4f7c('0x0'));module[_0x4f7c('0x1')]={'penalty':{'type':Sequelize[_0x4f7c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x074a=['INTEGER','sequelize','exports'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x074a,0x97));var _0xa074=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x074a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa074('0x0'));module[_0xa074('0x1')]={'penalty':{'type':Sequelize[_0xa074('0x2')],'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 8e5dde0..f0e2f44 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 _0xe804=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','api','bluebird'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xe804,0x147));var _0x4e80=function(_0x1b874d,_0x3424e5){_0x1b874d=_0x1b874d-0x0;var _0x3358ac=_0xe804[_0x1b874d];return _0x3358ac;};'use strict';var _=require('lodash');var util=require(_0x4e80('0x0'));var logger=require('../../config/logger')(_0x4e80('0x1'));var moment=require('moment');var BPromise=require(_0x4e80('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e80('0x3'));var rimraf=require(_0x4e80('0x4'));var config=require(_0x4e80('0x5'));var attributes=require(_0x4e80('0x6'));module[_0x4e80('0x7')]=function(_0x46817c,_0x563010){return _0x46817c[_0x4e80('0x8')](_0x4e80('0x9'),attributes,{'tableName':_0x4e80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5235=['moment','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api'];(function(_0x2f2ce4,_0x4e71a2){var _0x4ec040=function(_0x289511){while(--_0x289511){_0x2f2ce4['push'](_0x2f2ce4['shift']());}};_0x4ec040(++_0x4e71a2);}(_0x5235,0x111));var _0x5523=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x5235[_0x158da6];return _0x429c30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5523('0x0'))(_0x5523('0x1'));var moment=require(_0x5523('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5523('0x3'));var rimraf=require(_0x5523('0x4'));var config=require(_0x5523('0x5'));var attributes=require(_0x5523('0x6'));module[_0x5523('0x7')]=function(_0xfd5f43,_0x326755){return _0xfd5f43[_0x5523('0x8')](_0x5523('0x9'),attributes,{'tableName':_0x5523('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 16e21ee..c37f972 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 _0x5a21=['UserWhatsappQueue,\x20%s,\x20%s','message','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2db146,_0x509cc5){var _0x524bcb=function(_0x18f671){while(--_0x18f671){_0x2db146['push'](_0x2db146['shift']());}};_0x524bcb(++_0x509cc5);}(_0x5a21,0xe7));var _0x15a2=function(_0x4fa1b0,_0x3cafac){_0x4fa1b0=_0x4fa1b0-0x0;var _0x3c2e33=_0x5a21[_0x4fa1b0];return _0x3c2e33;};'use strict';var _=require('lodash');var util=require(_0x15a2('0x0'));var moment=require('moment');var BPromise=require(_0x15a2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15a2('0x2'))['db'];var utils=require(_0x15a2('0x3'));var logger=require(_0x15a2('0x4'))(_0x15a2('0x5'));var config=require(_0x15a2('0x6'));var jayson=require(_0x15a2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x107830,_0xe613c2,_0x5eba6d){return new BPromise(function(_0x5ace60,_0x7f87a6){return client[_0x15a2('0x8')](_0x107830,_0x5eba6d)[_0x15a2('0x9')](function(_0x828f3d){logger[_0x15a2('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0xe613c2,_0x15a2('0xb'));logger[_0x15a2('0xc')](_0x15a2('0xd'),_0xe613c2,_0x15a2('0xb'),JSON[_0x15a2('0xe')](_0x828f3d));if(_0x828f3d[_0x15a2('0xf')]){if(_0x828f3d[_0x15a2('0xf')]['code']===0x1f4){logger[_0x15a2('0xf')](_0x15a2('0x10'),_0xe613c2,_0x828f3d[_0x15a2('0xf')]['message']);return _0x7f87a6(_0x828f3d[_0x15a2('0xf')][_0x15a2('0x11')]);}logger[_0x15a2('0xf')](_0x15a2('0x10'),_0xe613c2,_0x828f3d[_0x15a2('0xf')][_0x15a2('0x11')]);return _0x5ace60(_0x828f3d['error'][_0x15a2('0x11')]);}else{logger[_0x15a2('0xa')](_0x15a2('0x10'),_0xe613c2,_0x15a2('0xb'));_0x5ace60(_0x828f3d['result'][_0x15a2('0x11')]);}})[_0x15a2('0x12')](function(_0x2a9a63){logger[_0x15a2('0xf')](_0x15a2('0x10'),_0xe613c2,_0x2a9a63);_0x7f87a6(_0x2a9a63);});});} \ No newline at end of file +var _0xb976=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x2fe7ae,_0x2e3468){var _0xaced9a=function(_0x115a6d){while(--_0x115a6d){_0x2fe7ae['push'](_0x2fe7ae['shift']());}};_0xaced9a(++_0x2e3468);}(_0xb976,0x8b));var _0x6b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb976[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6b97('0x0'));var util=require(_0x6b97('0x1'));var moment=require(_0x6b97('0x2'));var BPromise=require(_0x6b97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b97('0x4'));var db=require(_0x6b97('0x5'))['db'];var utils=require(_0x6b97('0x6'));var logger=require(_0x6b97('0x7'))(_0x6b97('0x8'));var config=require(_0x6b97('0x9'));var jayson=require(_0x6b97('0xa'));var client=jayson['client'][_0x6b97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5254a3,_0x1bef0b,_0x46b217){return new BPromise(function(_0x33d905,_0x505cde){return client[_0x6b97('0xc')](_0x5254a3,_0x46b217)[_0x6b97('0xd')](function(_0x405367){logger[_0x6b97('0xe')](_0x6b97('0xf'),_0x1bef0b,_0x6b97('0x10'));logger['debug'](_0x6b97('0x11'),_0x1bef0b,_0x6b97('0x10'),JSON['stringify'](_0x405367));if(_0x405367['error']){if(_0x405367[_0x6b97('0x12')]['code']===0x1f4){logger[_0x6b97('0x12')](_0x6b97('0xf'),_0x1bef0b,_0x405367[_0x6b97('0x12')][_0x6b97('0x13')]);return _0x505cde(_0x405367[_0x6b97('0x12')][_0x6b97('0x13')]);}logger[_0x6b97('0x12')](_0x6b97('0xf'),_0x1bef0b,_0x405367[_0x6b97('0x12')]['message']);return _0x33d905(_0x405367[_0x6b97('0x12')][_0x6b97('0x13')]);}else{logger['info'](_0x6b97('0xf'),_0x1bef0b,_0x6b97('0x10'));_0x33d905(_0x405367[_0x6b97('0x14')][_0x6b97('0x13')]);}})[_0x6b97('0x15')](function(_0x68ddbf){logger['error'](_0x6b97('0xf'),_0x1bef0b,_0x68ddbf);_0x505cde(_0x68ddbf);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ec33df3..da719ae 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 _0x2f72=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x4d2bc5,_0xc2f366){var _0xeccf3f=function(_0x467926){while(--_0x467926){_0x4d2bc5['push'](_0x4d2bc5['shift']());}};_0xeccf3f(++_0xc2f366);}(_0x2f72,0x166));var _0x22f7=function(_0x380363,_0x4deed2){_0x380363=_0x380363-0x0;var _0x24b425=_0x2f72[_0x380363];return _0x24b425;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require(_0x22f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0xc')]);router[_0x22f7('0xa')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xe')]);router[_0x22f7('0xf')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x10')]);router[_0x22f7('0x11')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0x12')]);router['delete'](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller['destroy']);module[_0x22f7('0x13')]=router; \ No newline at end of file +var _0x2a3a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path'];(function(_0x2a6ab8,_0x5eb621){var _0x5752ab=function(_0x49766d){while(--_0x49766d){_0x2a6ab8['push'](_0x2a6ab8['shift']());}};_0x5752ab(++_0x5eb621);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x6ecbc2,_0x1e7be6){_0x6ecbc2=_0x6ecbc2-0x0;var _0x323dba=_0x2a3a[_0x6ecbc2];return _0x323dba;};'use strict';var multer=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var path=require(_0xa2a3('0x2'));var timeout=require(_0xa2a3('0x3'));var express=require(_0xa2a3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa2a3('0x5'));var interaction=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var controller=require(_0xa2a3('0x8'));router[_0xa2a3('0x9')]('/',auth[_0xa2a3('0xa')](),controller[_0xa2a3('0xb')]);router['get'](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller[_0xa2a3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa2a3('0xe')](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller['update']);router[_0xa2a3('0xf')](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller[_0xa2a3('0x10')]);module[_0xa2a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3c86fd9..adc242b 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 _0x818f=['STRING','name','sequelize','exports'];(function(_0x43a2c3,_0xf160f5){var _0x50bf79=function(_0xdca3f5){while(--_0xdca3f5){_0x43a2c3['push'](_0x43a2c3['shift']());}};_0x50bf79(++_0xf160f5);}(_0x818f,0x1da));var _0xf818=function(_0x149038,_0x3c45e6){_0x149038=_0x149038-0x0;var _0x5835dd=_0x818f[_0x149038];return _0x5835dd;};'use strict';var Sequelize=require(_0xf818('0x0'));module[_0xf818('0x1')]={'name':{'type':Sequelize[_0xf818('0x2')],'unique':_0xf818('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf818('0x2')]}}; \ No newline at end of file +var _0x490c=['sequelize','STRING','name'];(function(_0x496d3c,_0x3eab1e){var _0x3700b8=function(_0x4c271c){while(--_0x4c271c){_0x496d3c['push'](_0x496d3c['shift']());}};_0x3700b8(++_0x3eab1e);}(_0x490c,0x186));var _0xc490=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x490c[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require(_0xc490('0x0'));module['exports']={'name':{'type':Sequelize[_0xc490('0x1')],'unique':_0xc490('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc490('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 5dbdfc4..a4b8913 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 _0xb438=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','stack','name','send','map','Variable','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','merge','filter','options','include','rows','catch','show','includeAll','find','create','body','user','role','get','Variables','UserProfileSection','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0xb438,0x1ca));var _0x8b43=function(_0x1d6a36,_0x9ee524){_0x1d6a36=_0x1d6a36-0x0;var _0x5bce82=_0xb438[_0x1d6a36];return _0x5bce82;};'use strict';var emlformat=require(_0x8b43('0x0'));var rimraf=require(_0x8b43('0x1'));var zipdir=require(_0x8b43('0x2'));var jsonpatch=require(_0x8b43('0x3'));var rp=require(_0x8b43('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b43('0x5'));var util=require('util');var path=require(_0x8b43('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b43('0x7'));var fs=require('fs');var fs_extra=require(_0x8b43('0x8'));var _=require(_0x8b43('0x9'));var squel=require(_0x8b43('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b43('0xb'));var toCsv=require(_0x8b43('0xc'));var querystring=require(_0x8b43('0xd'));var Papa=require(_0x8b43('0xe'));var Redis=require(_0x8b43('0xf'));var authService=require(_0x8b43('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8b43('0x11'));var hardwareService=require(_0x8b43('0x12'));var logger=require(_0x8b43('0x13'))(_0x8b43('0x14'));var utils=require(_0x8b43('0x15'));var config=require(_0x8b43('0x16'));var licenseUtil=require(_0x8b43('0x17'));var db=require(_0x8b43('0x18'))['db'];function respondWithStatusCode(_0x178d29,_0x187e16){_0x187e16=_0x187e16||0xcc;return function(_0x1df680){if(_0x1df680){return _0x178d29[_0x8b43('0x19')](_0x187e16);}return _0x178d29[_0x8b43('0x1a')](_0x187e16)[_0x8b43('0x1b')]();};}function respondWithResult(_0x137d8b,_0x197178){_0x197178=_0x197178||0xc8;return function(_0x4fec45){if(_0x4fec45){return _0x137d8b[_0x8b43('0x1a')](_0x197178)[_0x8b43('0x1c')](_0x4fec45);}};}function respondWithFilteredResult(_0x22b3b4,_0x15df02){return function(_0x392bba){if(_0x392bba){var _0x555b90=typeof _0x15df02[_0x8b43('0x1d')]===_0x8b43('0x1e')&&typeof _0x15df02[_0x8b43('0x1f')]===_0x8b43('0x1e');var _0x5c6e15=_0x392bba[_0x8b43('0x20')];var _0xa4eb1e=_0x555b90?0x0:_0x15df02[_0x8b43('0x1d')];var _0x2a7bea=_0x555b90?_0x392bba[_0x8b43('0x20')]:_0x15df02[_0x8b43('0x1d')]+_0x15df02['limit'];var _0x5090a5;if(_0x2a7bea>=_0x5c6e15){_0x2a7bea=_0x5c6e15;_0x5090a5=0xc8;}else{_0x5090a5=0xce;}_0x22b3b4[_0x8b43('0x1a')](_0x5090a5);return _0x22b3b4[_0x8b43('0x21')](_0x8b43('0x22'),_0xa4eb1e+'-'+_0x2a7bea+'/'+_0x5c6e15)['json'](_0x392bba);}return null;};}function patchUpdates(_0xfed856){return function(_0x14a545){try{jsonpatch[_0x8b43('0x23')](_0x14a545,_0xfed856,!![]);}catch(_0x2e7074){return BPromise[_0x8b43('0x24')](_0x2e7074);}return _0x14a545[_0x8b43('0x25')]();};}function saveUpdates(_0x42ca79,_0x12acbd){return function(_0x3207d3){if(_0x3207d3){return _0x3207d3[_0x8b43('0x26')](_0x42ca79)[_0x8b43('0x27')](function(_0x4aa25b){return _0x4aa25b;});}return null;};}function removeEntity(_0xc1d53c,_0x5244fd){return function(_0x428818){if(_0x428818){return _0x428818['destroy']()[_0x8b43('0x27')](function(){var _0x4d0c62=_0x428818['get']({'plain':!![]});var _0x2adecd='Variables';return db[_0x8b43('0x28')][_0x8b43('0x29')]({'where':{'type':_0x2adecd,'resourceId':_0x4d0c62['id']}})['then'](function(){return _0x428818;});})[_0x8b43('0x27')](function(){_0xc1d53c[_0x8b43('0x1a')](0xcc)[_0x8b43('0x1b')]();});}};}function handleEntityNotFound(_0x42868d,_0x56022d){return function(_0x255d42){if(!_0x255d42){_0x42868d[_0x8b43('0x19')](0x194);}return _0x255d42;};}function handleError(_0x448246,_0x3bdc2f){_0x3bdc2f=_0x3bdc2f||0x1f4;return function(_0x5428cb){logger['error'](_0x5428cb[_0x8b43('0x2a')]);if(_0x5428cb[_0x8b43('0x2b')]){delete _0x5428cb['name'];}_0x448246['status'](_0x3bdc2f)[_0x8b43('0x2c')](_0x5428cb);};}exports['index']=function(_0x445f80,_0x129ee3){var _0xcf14b3={},_0x3f1088={},_0x420f00={'count':0x0,'rows':[]};var _0x476d6c=_[_0x8b43('0x2d')](db[_0x8b43('0x2e')][_0x8b43('0x2f')],function(_0x31720a){return{'name':_0x31720a['fieldName'],'type':_0x31720a[_0x8b43('0x30')][_0x8b43('0x31')]};});_0x3f1088['model']=_[_0x8b43('0x2d')](_0x476d6c,_0x8b43('0x2b'));_0x3f1088[_0x8b43('0x32')]=_[_0x8b43('0x33')](_0x445f80[_0x8b43('0x32')]);_0x3f1088[_0x8b43('0x34')]=_['intersection'](_0x3f1088[_0x8b43('0x35')],_0x3f1088[_0x8b43('0x32')]);_0xcf14b3['attributes']=_[_0x8b43('0x36')](_0x3f1088[_0x8b43('0x35')],qs[_0x8b43('0x37')](_0x445f80['query'][_0x8b43('0x37')]));_0xcf14b3[_0x8b43('0x38')]=_0xcf14b3['attributes'][_0x8b43('0x39')]?_0xcf14b3[_0x8b43('0x38')]:_0x3f1088[_0x8b43('0x35')];if(!_0x445f80[_0x8b43('0x32')]['hasOwnProperty'](_0x8b43('0x3a'))){_0xcf14b3['limit']=qs['limit'](_0x445f80[_0x8b43('0x32')][_0x8b43('0x1f')]);_0xcf14b3[_0x8b43('0x1d')]=qs[_0x8b43('0x1d')](_0x445f80['query'][_0x8b43('0x1d')]);}_0xcf14b3[_0x8b43('0x3b')]=qs[_0x8b43('0x3c')](_0x445f80[_0x8b43('0x32')][_0x8b43('0x3c')]);_0xcf14b3[_0x8b43('0x3d')]=qs[_0x8b43('0x34')](_['pick'](_0x445f80[_0x8b43('0x32')],_0x3f1088[_0x8b43('0x34')]),_0x476d6c);if(_0x445f80[_0x8b43('0x32')]['filter']){_0xcf14b3[_0x8b43('0x3d')]=_[_0x8b43('0x3e')](_0xcf14b3[_0x8b43('0x3d')],{'$or':_[_0x8b43('0x2d')](_0x476d6c,function(_0x3f6559){if(_0x3f6559[_0x8b43('0x30')]!=='VIRTUAL'){var _0x2c6519={};_0x2c6519[_0x3f6559[_0x8b43('0x2b')]]={'$like':'%'+_0x445f80['query'][_0x8b43('0x3f')]+'%'};return _0x2c6519;}})});}_0xcf14b3=_[_0x8b43('0x3e')]({},_0xcf14b3,_0x445f80[_0x8b43('0x40')]);var _0x536d51={'where':_0xcf14b3[_0x8b43('0x3d')]};return db[_0x8b43('0x2e')][_0x8b43('0x20')](_0x536d51)[_0x8b43('0x27')](function(_0x315a94){_0x420f00[_0x8b43('0x20')]=_0x315a94;if(_0x445f80[_0x8b43('0x32')]['includeAll']){_0xcf14b3[_0x8b43('0x41')]=[{'all':!![]}];}return db[_0x8b43('0x2e')]['findAll'](_0xcf14b3);})[_0x8b43('0x27')](function(_0x1e18b7){_0x420f00[_0x8b43('0x42')]=_0x1e18b7;return _0x420f00;})['then'](respondWithFilteredResult(_0x129ee3,_0xcf14b3))[_0x8b43('0x43')](handleError(_0x129ee3,null));};exports[_0x8b43('0x44')]=function(_0x24211c,_0x4bd04b){var _0x316683={'raw':!![],'where':{'id':_0x24211c['params']['id']}},_0x4b8902={};_0x4b8902['model']=_[_0x8b43('0x33')](db['Variable'][_0x8b43('0x2f')]);_0x4b8902[_0x8b43('0x32')]=_[_0x8b43('0x33')](_0x24211c[_0x8b43('0x32')]);_0x4b8902['filters']=_[_0x8b43('0x36')](_0x4b8902[_0x8b43('0x35')],_0x4b8902[_0x8b43('0x32')]);_0x316683[_0x8b43('0x38')]=_[_0x8b43('0x36')](_0x4b8902[_0x8b43('0x35')],qs[_0x8b43('0x37')](_0x24211c['query'][_0x8b43('0x37')]));_0x316683[_0x8b43('0x38')]=_0x316683[_0x8b43('0x38')]['length']?_0x316683[_0x8b43('0x38')]:_0x4b8902[_0x8b43('0x35')];if(_0x24211c[_0x8b43('0x32')][_0x8b43('0x45')]){_0x316683[_0x8b43('0x41')]=[{'all':!![]}];}_0x316683=_[_0x8b43('0x3e')]({},_0x316683,_0x24211c[_0x8b43('0x40')]);return db[_0x8b43('0x2e')][_0x8b43('0x46')](_0x316683)[_0x8b43('0x27')](handleEntityNotFound(_0x4bd04b,null))[_0x8b43('0x27')](respondWithResult(_0x4bd04b,null))[_0x8b43('0x43')](handleError(_0x4bd04b,null));};exports[_0x8b43('0x47')]=function(_0x2b9821,_0x59f6cd){return db[_0x8b43('0x2e')][_0x8b43('0x47')](_0x2b9821[_0x8b43('0x48')],{})[_0x8b43('0x27')](function(_0x467aec){var _0x4fa183=_0x2b9821[_0x8b43('0x49')]['get']({'plain':!![]});if(!_0x4fa183)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fa183[_0x8b43('0x4a')]===_0x8b43('0x49')){var _0x2657d5=_0x467aec[_0x8b43('0x4b')]({'plain':!![]});var _0x1729bc=_0x8b43('0x4c');return db[_0x8b43('0x4d')][_0x8b43('0x46')]({'where':{'name':_0x1729bc,'userProfileId':_0x4fa183['userProfileId']},'raw':!![]})[_0x8b43('0x27')](function(_0x45eb6e){if(_0x45eb6e&&_0x45eb6e[_0x8b43('0x4e')]===0x0){return db['UserProfileResource'][_0x8b43('0x47')]({'name':_0x2657d5[_0x8b43('0x2b')],'resourceId':_0x2657d5['id'],'type':_0x45eb6e['name'],'sectionId':_0x45eb6e['id']},{})[_0x8b43('0x27')](function(){return _0x467aec;});}else{return _0x467aec;}})['catch'](function(_0x49b3f9){logger[_0x8b43('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49b3f9);throw _0x49b3f9;});}return _0x467aec;})[_0x8b43('0x27')](respondWithResult(_0x59f6cd,0xc9))[_0x8b43('0x43')](handleError(_0x59f6cd,null));};exports[_0x8b43('0x26')]=function(_0x16e5bb,_0xdbcb85){if(_0x16e5bb[_0x8b43('0x48')]['id']){delete _0x16e5bb[_0x8b43('0x48')]['id'];}return db['Variable'][_0x8b43('0x46')]({'where':{'id':_0x16e5bb['params']['id']}})[_0x8b43('0x27')](handleEntityNotFound(_0xdbcb85,null))[_0x8b43('0x27')](saveUpdates(_0x16e5bb[_0x8b43('0x48')],null))['then'](respondWithResult(_0xdbcb85,null))[_0x8b43('0x43')](handleError(_0xdbcb85,null));};exports[_0x8b43('0x29')]=function(_0x45277e,_0x1cb5ef){return db['Variable'][_0x8b43('0x46')]({'where':{'id':_0x45277e['params']['id']}})[_0x8b43('0x27')](handleEntityNotFound(_0x1cb5ef,null))['then'](removeEntity(_0x1cb5ef,null))[_0x8b43('0x43')](handleError(_0x1cb5ef,null));}; \ No newline at end of file +var _0x99a7=['order','sort','where','filter','type','VIRTUAL','Variable','includeAll','catch','params','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','Variables','UserProfileResource','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit'];(function(_0x113e47,_0x1e021f){var _0x59d06b=function(_0x141592){while(--_0x141592){_0x113e47['push'](_0x113e47['shift']());}};_0x59d06b(++_0x1e021f);}(_0x99a7,0xb8));var _0x799a=function(_0x31a119,_0x17e6ca){_0x31a119=_0x31a119-0x0;var _0x2d6e6a=_0x99a7[_0x31a119];return _0x2d6e6a;};'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(_0x799a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x799a('0x1'));var util=require(_0x799a('0x2'));var path=require('path');var sox=require(_0x799a('0x3'));var csv=require('to-csv');var ejs=require(_0x799a('0x4'));var fs=require('fs');var fs_extra=require(_0x799a('0x5'));var _=require(_0x799a('0x6'));var squel=require(_0x799a('0x7'));var crypto=require(_0x799a('0x8'));var jsforce=require(_0x799a('0x9'));var deskjs=require(_0x799a('0xa'));var toCsv=require(_0x799a('0xb'));var querystring=require(_0x799a('0xc'));var Papa=require(_0x799a('0xd'));var Redis=require(_0x799a('0xe'));var authService=require(_0x799a('0xf'));var qs=require(_0x799a('0x10'));var as=require(_0x799a('0x11'));var hardwareService=require(_0x799a('0x12'));var logger=require(_0x799a('0x13'))('api');var utils=require(_0x799a('0x14'));var config=require(_0x799a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x799a('0x16'))['db'];function respondWithStatusCode(_0x11fce9,_0x415524){_0x415524=_0x415524||0xcc;return function(_0x3f5667){if(_0x3f5667){return _0x11fce9[_0x799a('0x17')](_0x415524);}return _0x11fce9[_0x799a('0x18')](_0x415524)[_0x799a('0x19')]();};}function respondWithResult(_0x256ccd,_0x397165){_0x397165=_0x397165||0xc8;return function(_0x513e73){if(_0x513e73){return _0x256ccd[_0x799a('0x18')](_0x397165)[_0x799a('0x1a')](_0x513e73);}};}function respondWithFilteredResult(_0x3e873d,_0x3a88ea){return function(_0x2fb466){if(_0x2fb466){var _0x4de532=typeof _0x3a88ea['offset']===_0x799a('0x1b')&&typeof _0x3a88ea[_0x799a('0x1c')]===_0x799a('0x1b');var _0x31e11d=_0x2fb466[_0x799a('0x1d')];var _0x5cd44d=_0x4de532?0x0:_0x3a88ea['offset'];var _0x3b364a=_0x4de532?_0x2fb466[_0x799a('0x1d')]:_0x3a88ea[_0x799a('0x1e')]+_0x3a88ea[_0x799a('0x1c')];var _0x853fbb;if(_0x3b364a>=_0x31e11d){_0x3b364a=_0x31e11d;_0x853fbb=0xc8;}else{_0x853fbb=0xce;}_0x3e873d[_0x799a('0x18')](_0x853fbb);return _0x3e873d[_0x799a('0x1f')](_0x799a('0x20'),_0x5cd44d+'-'+_0x3b364a+'/'+_0x31e11d)['json'](_0x2fb466);}return null;};}function patchUpdates(_0x1954e2){return function(_0x1083b2){try{jsonpatch[_0x799a('0x21')](_0x1083b2,_0x1954e2,!![]);}catch(_0x3179cb){return BPromise[_0x799a('0x22')](_0x3179cb);}return _0x1083b2[_0x799a('0x23')]();};}function saveUpdates(_0x3e58dc,_0x1e9d90){return function(_0x6fe96e){if(_0x6fe96e){return _0x6fe96e['update'](_0x3e58dc)[_0x799a('0x24')](function(_0x444c4b){return _0x444c4b;});}return null;};}function removeEntity(_0xf33221,_0x5c2905){return function(_0x5553e3){if(_0x5553e3){return _0x5553e3[_0x799a('0x25')]()[_0x799a('0x24')](function(){var _0x54ed75=_0x5553e3['get']({'plain':!![]});var _0x17fa8c=_0x799a('0x26');return db[_0x799a('0x27')][_0x799a('0x25')]({'where':{'type':_0x17fa8c,'resourceId':_0x54ed75['id']}})[_0x799a('0x24')](function(){return _0x5553e3;});})[_0x799a('0x24')](function(){_0xf33221['status'](0xcc)[_0x799a('0x19')]();});}};}function handleEntityNotFound(_0xefe94a,_0x59a0e5){return function(_0x3e593c){if(!_0x3e593c){_0xefe94a['sendStatus'](0x194);}return _0x3e593c;};}function handleError(_0x11dfb9,_0x4b3dfc){_0x4b3dfc=_0x4b3dfc||0x1f4;return function(_0x3ffd4f){logger[_0x799a('0x28')](_0x3ffd4f[_0x799a('0x29')]);if(_0x3ffd4f[_0x799a('0x2a')]){delete _0x3ffd4f[_0x799a('0x2a')];}_0x11dfb9[_0x799a('0x18')](_0x4b3dfc)[_0x799a('0x2b')](_0x3ffd4f);};}exports['index']=function(_0x58f9fa,_0x2da4a9){var _0x3bf399={},_0x5370c5={},_0x345fc5={'count':0x0,'rows':[]};var _0x4cbffb=_[_0x799a('0x2c')](db['Variable'][_0x799a('0x2d')],function(_0xc748ad){return{'name':_0xc748ad['fieldName'],'type':_0xc748ad['type'][_0x799a('0x2e')]};});_0x5370c5[_0x799a('0x2f')]=_['map'](_0x4cbffb,_0x799a('0x2a'));_0x5370c5[_0x799a('0x30')]=_[_0x799a('0x31')](_0x58f9fa[_0x799a('0x30')]);_0x5370c5[_0x799a('0x32')]=_['intersection'](_0x5370c5[_0x799a('0x2f')],_0x5370c5[_0x799a('0x30')]);_0x3bf399['attributes']=_[_0x799a('0x33')](_0x5370c5[_0x799a('0x2f')],qs[_0x799a('0x34')](_0x58f9fa[_0x799a('0x30')][_0x799a('0x34')]));_0x3bf399[_0x799a('0x35')]=_0x3bf399['attributes'][_0x799a('0x36')]?_0x3bf399[_0x799a('0x35')]:_0x5370c5[_0x799a('0x2f')];if(!_0x58f9fa[_0x799a('0x30')]['hasOwnProperty'](_0x799a('0x37'))){_0x3bf399[_0x799a('0x1c')]=qs[_0x799a('0x1c')](_0x58f9fa[_0x799a('0x30')][_0x799a('0x1c')]);_0x3bf399['offset']=qs[_0x799a('0x1e')](_0x58f9fa[_0x799a('0x30')]['offset']);}_0x3bf399[_0x799a('0x38')]=qs[_0x799a('0x39')](_0x58f9fa[_0x799a('0x30')][_0x799a('0x39')]);_0x3bf399[_0x799a('0x3a')]=qs['filters'](_['pick'](_0x58f9fa[_0x799a('0x30')],_0x5370c5[_0x799a('0x32')]),_0x4cbffb);if(_0x58f9fa[_0x799a('0x30')][_0x799a('0x3b')]){_0x3bf399[_0x799a('0x3a')]=_['merge'](_0x3bf399[_0x799a('0x3a')],{'$or':_[_0x799a('0x2c')](_0x4cbffb,function(_0x376ef2){if(_0x376ef2[_0x799a('0x3c')]!==_0x799a('0x3d')){var _0x330f68={};_0x330f68[_0x376ef2[_0x799a('0x2a')]]={'$like':'%'+_0x58f9fa[_0x799a('0x30')][_0x799a('0x3b')]+'%'};return _0x330f68;}})});}_0x3bf399=_['merge']({},_0x3bf399,_0x58f9fa['options']);var _0x697144={'where':_0x3bf399[_0x799a('0x3a')]};return db[_0x799a('0x3e')]['count'](_0x697144)[_0x799a('0x24')](function(_0x4c11a3){_0x345fc5[_0x799a('0x1d')]=_0x4c11a3;if(_0x58f9fa['query'][_0x799a('0x3f')]){_0x3bf399['include']=[{'all':!![]}];}return db[_0x799a('0x3e')]['findAll'](_0x3bf399);})[_0x799a('0x24')](function(_0x53e10b){_0x345fc5['rows']=_0x53e10b;return _0x345fc5;})['then'](respondWithFilteredResult(_0x2da4a9,_0x3bf399))[_0x799a('0x40')](handleError(_0x2da4a9,null));};exports['show']=function(_0x4fc2a3,_0x3ba8bf){var _0x3ce97c={'raw':!![],'where':{'id':_0x4fc2a3[_0x799a('0x41')]['id']}},_0xbd6c30={};_0xbd6c30[_0x799a('0x2f')]=_[_0x799a('0x31')](db[_0x799a('0x3e')][_0x799a('0x2d')]);_0xbd6c30[_0x799a('0x30')]=_[_0x799a('0x31')](_0x4fc2a3['query']);_0xbd6c30[_0x799a('0x32')]=_[_0x799a('0x33')](_0xbd6c30[_0x799a('0x2f')],_0xbd6c30[_0x799a('0x30')]);_0x3ce97c[_0x799a('0x35')]=_[_0x799a('0x33')](_0xbd6c30[_0x799a('0x2f')],qs[_0x799a('0x34')](_0x4fc2a3[_0x799a('0x30')][_0x799a('0x34')]));_0x3ce97c[_0x799a('0x35')]=_0x3ce97c[_0x799a('0x35')][_0x799a('0x36')]?_0x3ce97c[_0x799a('0x35')]:_0xbd6c30[_0x799a('0x2f')];if(_0x4fc2a3[_0x799a('0x30')][_0x799a('0x3f')]){_0x3ce97c['include']=[{'all':!![]}];}_0x3ce97c=_[_0x799a('0x42')]({},_0x3ce97c,_0x4fc2a3[_0x799a('0x43')]);return db['Variable'][_0x799a('0x44')](_0x3ce97c)[_0x799a('0x24')](handleEntityNotFound(_0x3ba8bf,null))['then'](respondWithResult(_0x3ba8bf,null))[_0x799a('0x40')](handleError(_0x3ba8bf,null));};exports[_0x799a('0x45')]=function(_0x2fc9f3,_0x478d8e){return db[_0x799a('0x3e')]['create'](_0x2fc9f3[_0x799a('0x46')],{})[_0x799a('0x24')](function(_0x89a46a){var _0x1a4980=_0x2fc9f3[_0x799a('0x47')][_0x799a('0x48')]({'plain':!![]});if(!_0x1a4980)throw new Error(_0x799a('0x49'));if(_0x1a4980[_0x799a('0x4a')]===_0x799a('0x47')){var _0x231c70=_0x89a46a[_0x799a('0x48')]({'plain':!![]});var _0xb52ccc=_0x799a('0x26');return db[_0x799a('0x4b')][_0x799a('0x44')]({'where':{'name':_0xb52ccc,'userProfileId':_0x1a4980[_0x799a('0x4c')]},'raw':!![]})['then'](function(_0x8002d6){if(_0x8002d6&&_0x8002d6[_0x799a('0x4d')]===0x0){return db[_0x799a('0x27')][_0x799a('0x45')]({'name':_0x231c70[_0x799a('0x2a')],'resourceId':_0x231c70['id'],'type':_0x8002d6[_0x799a('0x2a')],'sectionId':_0x8002d6['id']},{})[_0x799a('0x24')](function(){return _0x89a46a;});}else{return _0x89a46a;}})[_0x799a('0x40')](function(_0x498d9c){logger['error'](_0x799a('0x4e'),_0x498d9c);throw _0x498d9c;});}return _0x89a46a;})['then'](respondWithResult(_0x478d8e,0xc9))['catch'](handleError(_0x478d8e,null));};exports[_0x799a('0x4f')]=function(_0x2367f6,_0x27bfd1){if(_0x2367f6[_0x799a('0x46')]['id']){delete _0x2367f6[_0x799a('0x46')]['id'];}return db[_0x799a('0x3e')]['find']({'where':{'id':_0x2367f6['params']['id']}})[_0x799a('0x24')](handleEntityNotFound(_0x27bfd1,null))[_0x799a('0x24')](saveUpdates(_0x2367f6['body'],null))[_0x799a('0x24')](respondWithResult(_0x27bfd1,null))[_0x799a('0x40')](handleError(_0x27bfd1,null));};exports[_0x799a('0x25')]=function(_0x1551e2,_0x54fd10){return db[_0x799a('0x3e')][_0x799a('0x44')]({'where':{'id':_0x1551e2[_0x799a('0x41')]['id']}})[_0x799a('0x24')](handleEntityNotFound(_0x54fd10,null))[_0x799a('0x24')](removeEntity(_0x54fd10,null))[_0x799a('0x40')](handleError(_0x54fd10,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 860c8b1..1cfa032 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 _0xe46e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x57d478,_0x8a37b1){var _0x206612=function(_0x2b1fc2){while(--_0x2b1fc2){_0x57d478['push'](_0x57d478['shift']());}};_0x206612(++_0x8a37b1);}(_0xe46e,0x120));var _0xee46=function(_0x39c891,_0x40e5ef){_0x39c891=_0x39c891-0x0;var _0x44605e=_0xe46e[_0x39c891];return _0x44605e;};'use strict';var _=require(_0xee46('0x0'));var util=require(_0xee46('0x1'));var logger=require('../../config/logger')(_0xee46('0x2'));var moment=require(_0xee46('0x3'));var BPromise=require(_0xee46('0x4'));var rp=require(_0xee46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee46('0x6'));var config=require(_0xee46('0x7'));var attributes=require('./variable.attributes');module[_0xee46('0x8')]=function(_0x233c3f,_0x4279c5){return _0x233c3f[_0xee46('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27b1=['tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x27b1,0x17a));var _0x127b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x27b1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x127b('0x0'));var logger=require(_0x127b('0x1'))(_0x127b('0x2'));var moment=require(_0x127b('0x3'));var BPromise=require(_0x127b('0x4'));var rp=require(_0x127b('0x5'));var fs=require('fs');var path=require(_0x127b('0x6'));var rimraf=require(_0x127b('0x7'));var config=require(_0x127b('0x8'));var attributes=require('./variable.attributes');module[_0x127b('0x9')]=function(_0x409e24,_0x38d30e){return _0x409e24[_0x127b('0xa')](_0x127b('0xb'),attributes,{'tableName':_0x127b('0xc'),'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 6a77add..5b7ddf4 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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x316541,_0x2e27e0){var _0x5a0767=function(_0x3e3975){while(--_0x3e3975){_0x316541['push'](_0x316541['shift']());}};_0x5a0767(++_0x2e27e0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x4b84[_0x311909];return _0x8d3163;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x54859a,_0x19c645){var _0x58c213=function(_0x178476){while(--_0x178476){_0x54859a['push'](_0x54859a['shift']());}};_0x58c213(++_0x19c645);}(_0xf494,0x1c6));var _0x4f49=function(_0x31064d,_0x5bb8e8){_0x31064d=_0x31064d-0x0;var _0x678c91=_0xf494[_0x31064d];return _0x678c91;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8e07eff..f77690b 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 _0x6824=['express','Router','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/restart','restart','/migrations','migrations'];(function(_0x130a8d,_0x171f60){var _0xcfc8a6=function(_0x6fcf52){while(--_0x6fcf52){_0x130a8d['push'](_0x130a8d['shift']());}};_0xcfc8a6(++_0x171f60);}(_0x6824,0xd0));var _0x4682=function(_0x5db79e,_0x56c04b){_0x5db79e=_0x5db79e-0x0;var _0xe4ed53=_0x6824[_0x5db79e];return _0xe4ed53;};'use strict';var express=require(_0x4682('0x0'));var router=express[_0x4682('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x4682('0x2')]('/',controller[_0x4682('0x3')]);router[_0x4682('0x2')]('/fetch',auth[_0x4682('0x4')](),auth[_0x4682('0x5')](),controller[_0x4682('0x6')]);router[_0x4682('0x2')](_0x4682('0x7'),auth[_0x4682('0x4')](),auth['canUpdate'](),controller[_0x4682('0x8')]);router[_0x4682('0x2')]('/pull',auth[_0x4682('0x4')](),auth[_0x4682('0x5')](),controller['pull']);router['get'](_0x4682('0x9'),auth['isAuthenticated'](),controller[_0x4682('0xa')]);router[_0x4682('0x2')](_0x4682('0xb'),controller[_0x4682('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1a04=['Router','../../components/auth/service','/fetch','isAuthenticated','canUpdate','fetch','get','/pull','/restart','migrations','exports','express'];(function(_0x255e14,_0xf658b9){var _0x1a266a=function(_0x5260e7){while(--_0x5260e7){_0x255e14['push'](_0x255e14['shift']());}};_0x1a266a(++_0xf658b9);}(_0x1a04,0xd7));var _0x41a0=function(_0x4689bb,_0x195648){_0x4689bb=_0x4689bb-0x0;var _0x163906=_0x1a04[_0x4689bb];return _0x163906;};'use strict';var express=require(_0x41a0('0x0'));var router=express[_0x41a0('0x1')]();var auth=require(_0x41a0('0x2'));var controller=require('./version.controller');router['get']('/',controller['index']);router['get'](_0x41a0('0x3'),auth[_0x41a0('0x4')](),auth[_0x41a0('0x5')](),controller[_0x41a0('0x6')]);router[_0x41a0('0x7')]('/reset',auth['isAuthenticated'](),auth[_0x41a0('0x5')](),controller['reset']);router[_0x41a0('0x7')](_0x41a0('0x8'),auth[_0x41a0('0x4')](),auth[_0x41a0('0x5')](),controller['pull']);router[_0x41a0('0x7')](_0x41a0('0x9'),auth[_0x41a0('0x4')](),controller['restart']);router['get']('/migrations',controller[_0x41a0('0xa')]);module[_0x41a0('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 70a6804..75752ce 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 _0x7217=['--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','.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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','tags','latest','status','json','fetch','master','git\x20fetch','reset'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7217,0xf6));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var Umzug=require(_0x7721('0x0'));var path=require(_0x7721('0x1'));var fs=require('fs');var _=require(_0x7721('0x2'));var pkginfo=require(_0x7721('0x3'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x7721('0x4'))[_0x7721('0x5')];var db=require(_0x7721('0x6'))['db'];var config=require(_0x7721('0x7'));var pm2=require(_0x7721('0x8'));var logger=require(_0x7721('0x9'))(_0x7721('0xa'));var git=require(_0x7721('0xb'))(config[_0x7721('0xc')]);exports['index']=function(_0x117c0d,_0x14a2ed){var _0x50e15d={'current':module[_0x7721('0xd')][_0x7721('0xe')],'phonebar':0x2};if(_0x117c0d[_0x7721('0xf')]&&_0x117c0d['query']['latest']){return git['fetch']()[_0x7721('0x10')](function(_0xc38619,_0x2181b3){_0x50e15d[_0x7721('0x11')]=(_0xc38619?module['exports']['version']:_0x2181b3['latest'])||'2.0.0';return _0x14a2ed[_0x7721('0x12')](0xc8)[_0x7721('0x13')](_0x50e15d);});}else{return _0x14a2ed[_0x7721('0x12')](0xc8)['json'](_0x50e15d);}};exports[_0x7721('0x14')]=function(_0x126d28,_0x76c107){return git['fetch'](['origin',_0x7721('0x15')],function(_0x5d0e3a){if(_0x5d0e3a){logger['error'](_0x5d0e3a);return _0x76c107[_0x7721('0x12')](0x1f4)[_0x7721('0x13')](_0x5d0e3a);}logger['info'](_0x7721('0x16'));return _0x76c107[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7721('0x17')]=function(_0x4faaff,_0x3f573d){return git[_0x7721('0x17')]([_0x7721('0x18'),_0x7721('0x19')],function(_0x5c1d33){if(_0x5c1d33){logger['error'](_0x5c1d33);return _0x3f573d[_0x7721('0x12')](0x1f4)[_0x7721('0x13')](_0x5c1d33);}logger[_0x7721('0x1a')](_0x7721('0x1b'));return _0x3f573d[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':_0x7721('0x1c')});});};exports[_0x7721('0x1d')]=function(_0x2293ba,_0x4e8092){exec(_0x7721('0x1e'),function(_0x20990b,_0x57d93e,_0x873b76){logger[_0x7721('0x1a')](_0x57d93e);logger[_0x7721('0x1a')](_0x873b76);if(_0x20990b){logger[_0x7721('0x1f')](_0x20990b);return _0x4e8092['status'](0x1f4)['json'](_0x20990b);}return _0x4e8092[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':_0x57d93e});});};exports[_0x7721('0x20')]=function(_0x27de37,_0x4a0e85){return pm2[_0x7721('0x20')]('motion2')['then'](function(_0xbfcccc){logger[_0x7721('0x1a')]('pm2\x20restart\x20motion\x20%s',_0xbfcccc);return _0x4a0e85[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':_0x7721('0x21')});})[_0x7721('0x22')](function(_0x1ef6be){logger['error'](_0x1ef6be);return _0x4a0e85[_0x7721('0x12')](0x1f4)[_0x7721('0x13')](_0x1ef6be);});};exports[_0x7721('0x23')]=function(_0x4a724f,_0xd4c168){var _0x1ab9a3=fs[_0x7721('0x24')](path[_0x7721('0x25')](config['root'],'server',_0x7721('0x23')));var _0x5a86ea=[];for(var _0x123a97=0x0;_0x123a97<_0x1ab9a3['length'];_0x123a97++){var _0x548aef=_0x1ab9a3[_0x123a97]['replace'](_0x7721('0x26'),'');if(compareVersions(module[_0x7721('0xd')]['version'],_0x548aef)===-0x1){_0x5a86ea[_0x7721('0x27')](_0x548aef);}}if(_0x5a86ea[_0x7721('0x28')]){var _0x225de4=_0x5a86ea[_0x7721('0x29')](compareVersions);var _0xf1defa=new Umzug({'storage':_0x7721('0x2a'),'storageOptions':{'model':db[_0x7721('0x2b')],'modelName':'Migration','columnName':_0x7721('0xe')},'migrations':{'params':[db['sequelize'][_0x7721('0x2c')](),db[_0x7721('0x2a')][_0x7721('0x2d')],function(){throw new Error(_0x7721('0x2e'));}],'path':path[_0x7721('0x25')](config[_0x7721('0xc')],_0x7721('0x2f'),_0x7721('0x23')),'pattern':/\.js$/}});_0xf1defa['up']({'migrations':_[_0x7721('0x30')](_0x225de4,function(_0x1b1db3){return _0x1b1db3+_0x7721('0x26');})})['then'](function(){return _0xd4c168[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':_0x7721('0x31')+module[_0x7721('0xd')][_0x7721('0xe')]+_0x7721('0x32')+_[_0x7721('0x33')](_0x225de4),'migrations':_[_0x7721('0x25')](_0x225de4)});})[_0x7721('0x22')](function(_0x5241ae){if(_0x5241ae instanceof db[_0x7721('0x2a')][_0x7721('0x34')]){return _0xd4c168['status'](0xc8)[_0x7721('0x13')]({'output':_0x7721('0x35')});}else{return _0xd4c168[_0x7721('0x12')](0x1f4)[_0x7721('0x13')](_0x5241ae);}});}else{return _0xd4c168[_0x7721('0x12')](0xc8)[_0x7721('0x13')]({'output':_0x7721('0x35')});}}; \ No newline at end of file +var _0x5627=['then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2'];(function(_0x36b4e1,_0x5a7f86){var _0x4b785b=function(_0x32821a){while(--_0x32821a){_0x36b4e1['push'](_0x36b4e1['shift']());}};_0x4b785b(++_0x5a7f86);}(_0x5627,0xac));var _0x7562=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5627[_0x2641f9];return _0x585741;};'use strict';var Umzug=require(_0x7562('0x0'));var path=require(_0x7562('0x1'));var fs=require('fs');var _=require(_0x7562('0x2'));var pkginfo=require(_0x7562('0x3'))(module,_0x7562('0x4'));var compareVersions=require(_0x7562('0x5'));var exec=require(_0x7562('0x6'))[_0x7562('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x7562('0x8'));var pm2=require(_0x7562('0x9'));var logger=require(_0x7562('0xa'))('update');var git=require('simple-git')(config[_0x7562('0xb')]);exports[_0x7562('0xc')]=function(_0x511ffd,_0x4398d4){var _0xcbb8c2={'current':module[_0x7562('0xd')][_0x7562('0x4')],'phonebar':0x2};if(_0x511ffd['query']&&_0x511ffd[_0x7562('0xe')][_0x7562('0xf')]){return git[_0x7562('0x10')]()[_0x7562('0x11')](function(_0x1e130b,_0x1e0bd9){_0xcbb8c2[_0x7562('0xf')]=(_0x1e130b?module[_0x7562('0xd')][_0x7562('0x4')]:_0x1e0bd9[_0x7562('0xf')])||_0x7562('0x12');return _0x4398d4[_0x7562('0x13')](0xc8)[_0x7562('0x14')](_0xcbb8c2);});}else{return _0x4398d4[_0x7562('0x13')](0xc8)['json'](_0xcbb8c2);}};exports[_0x7562('0x10')]=function(_0x147e34,_0x54bc82){return git[_0x7562('0x10')]([_0x7562('0x15'),'master'],function(_0x1b5640){if(_0x1b5640){logger[_0x7562('0x16')](_0x1b5640);return _0x54bc82[_0x7562('0x13')](0x1f4)[_0x7562('0x14')](_0x1b5640);}logger[_0x7562('0x17')](_0x7562('0x18'));return _0x54bc82[_0x7562('0x13')](0xc8)['json']({'output':_0x7562('0x19')});});};exports[_0x7562('0x1a')]=function(_0x20be4e,_0x4e5c59){return git[_0x7562('0x1a')]([_0x7562('0x1b'),'FETCH_HEAD'],function(_0x13ee61){if(_0x13ee61){logger[_0x7562('0x16')](_0x13ee61);return _0x4e5c59[_0x7562('0x13')](0x1f4)[_0x7562('0x14')](_0x13ee61);}logger[_0x7562('0x17')](_0x7562('0x1c'));return _0x4e5c59[_0x7562('0x13')](0xc8)[_0x7562('0x14')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x490cd5,_0xe3234b){exec(_0x7562('0x1d'),function(_0xf8ddfa,_0x2c650a,_0x39810f){logger['info'](_0x2c650a);logger['info'](_0x39810f);if(_0xf8ddfa){logger[_0x7562('0x16')](_0xf8ddfa);return _0xe3234b[_0x7562('0x13')](0x1f4)[_0x7562('0x14')](_0xf8ddfa);}return _0xe3234b['status'](0xc8)[_0x7562('0x14')]({'output':_0x2c650a});});};exports[_0x7562('0x1e')]=function(_0x153197,_0x1f27d3){return pm2[_0x7562('0x1e')](_0x7562('0x1f'))[_0x7562('0x20')](function(_0x528166){logger[_0x7562('0x17')](_0x7562('0x21'),_0x528166);return _0x1f27d3['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7562('0x22')](function(_0x1a5bfe){logger[_0x7562('0x16')](_0x1a5bfe);return _0x1f27d3['status'](0x1f4)[_0x7562('0x14')](_0x1a5bfe);});};exports['migrations']=function(_0x23b4a7,_0x266b17){var _0x5b29f9=fs[_0x7562('0x23')](path[_0x7562('0x24')](config[_0x7562('0xb')],_0x7562('0x25'),_0x7562('0x26')));var _0x4ac0cf=[];for(var _0x116b4e=0x0;_0x116b4e<_0x5b29f9[_0x7562('0x27')];_0x116b4e++){var _0x27e56c=_0x5b29f9[_0x116b4e][_0x7562('0x28')](_0x7562('0x29'),'');if(compareVersions(module['exports'][_0x7562('0x4')],_0x27e56c)===-0x1){_0x4ac0cf[_0x7562('0x2a')](_0x27e56c);}}if(_0x4ac0cf[_0x7562('0x27')]){var _0x1a1154=_0x4ac0cf[_0x7562('0x2b')](compareVersions);var _0x17af93=new Umzug({'storage':_0x7562('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':_0x7562('0x2d'),'columnName':_0x7562('0x4')},'migrations':{'params':[db[_0x7562('0x2c')][_0x7562('0x2e')](),db[_0x7562('0x2c')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x7562('0xb')],'server',_0x7562('0x26')),'pattern':/\.js$/}});_0x17af93['up']({'migrations':_['map'](_0x1a1154,function(_0x5130b6){return _0x5130b6+_0x7562('0x29');})})[_0x7562('0x20')](function(){return _0x266b17[_0x7562('0x13')](0xc8)[_0x7562('0x14')]({'output':_0x7562('0x2f')+module[_0x7562('0xd')][_0x7562('0x4')]+_0x7562('0x30')+_['last'](_0x1a1154),'migrations':_[_0x7562('0x24')](_0x1a1154)});})['catch'](function(_0x55f9f2){if(_0x55f9f2 instanceof db[_0x7562('0x2c')][_0x7562('0x31')]){return _0x266b17[_0x7562('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x266b17[_0x7562('0x13')](0x1f4)['json'](_0x55f9f2);}});}else{return _0x266b17[_0x7562('0x13')](0xc8)[_0x7562('0x14')]({'output':_0x7562('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 763d09c..c7d850f 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 _0x1483=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','util','connect-timeout','express'];(function(_0x4f1c6c,_0x1e8f52){var _0x1d9e2a=function(_0xbd0746){while(--_0xbd0746){_0x4f1c6c['push'](_0x4f1c6c['shift']());}};_0x1d9e2a(++_0x1e8f52);}(_0x1483,0xed));var _0x3148=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x1483[_0x1da527];return _0x40fc7c;};'use strict';var multer=require('multer');var util=require(_0x3148('0x0'));var path=require('path');var timeout=require(_0x3148('0x1'));var express=require(_0x3148('0x2'));var router=express[_0x3148('0x3')]();var fs_extra=require(_0x3148('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3148('0x5'));var config=require(_0x3148('0x6'));var controller=require(_0x3148('0x7'));router[_0x3148('0x8')]('/',auth['isAuthenticated'](),controller[_0x3148('0x9')]);router[_0x3148('0x8')](_0x3148('0xa'),auth[_0x3148('0xb')](),controller[_0x3148('0xc')]);router['get'](_0x3148('0xd'),auth[_0x3148('0xb')](),controller['show']);router[_0x3148('0xe')]('/',auth[_0x3148('0xb')](),controller[_0x3148('0xf')]);router[_0x3148('0x10')](_0x3148('0xd'),auth[_0x3148('0xb')](),controller[_0x3148('0x11')]);router[_0x3148('0x12')](_0x3148('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3148('0x13')]=router; \ No newline at end of file +var _0xd962=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x263a4a,_0xd24825){var _0x3d503d=function(_0x578a16){while(--_0x578a16){_0x263a4a['push'](_0x263a4a['shift']());}};_0x3d503d(++_0xd24825);}(_0xd962,0x1a6));var _0x2d96=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xd962[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require(_0x2d96('0x0'));var path=require(_0x2d96('0x1'));var timeout=require(_0x2d96('0x2'));var express=require(_0x2d96('0x3'));var router=express[_0x2d96('0x4')]();var fs_extra=require(_0x2d96('0x5'));var auth=require(_0x2d96('0x6'));var interaction=require(_0x2d96('0x7'));var config=require(_0x2d96('0x8'));var controller=require(_0x2d96('0x9'));router[_0x2d96('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2d96('0xa')](_0x2d96('0xb'),auth[_0x2d96('0xc')](),controller[_0x2d96('0xd')]);router[_0x2d96('0xa')](_0x2d96('0xe'),auth[_0x2d96('0xc')](),controller[_0x2d96('0xf')]);router[_0x2d96('0x10')]('/',auth[_0x2d96('0xc')](),controller[_0x2d96('0x11')]);router[_0x2d96('0x12')](_0x2d96('0xe'),auth['isAuthenticated'](),controller[_0x2d96('0x13')]);router[_0x2d96('0x14')](_0x2d96('0xe'),auth[_0x2d96('0xc')](),controller[_0x2d96('0x15')]);module[_0x2d96('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b14e05b..f7314a7 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 _0xcabe=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0xcabe,0x1ef));var _0xecab=function(_0x49cffa,_0x35093c){_0x49cffa=_0x49cffa-0x0;var _0x206ef1=_0xcabe[_0x49cffa];return _0x206ef1;};'use strict';var Sequelize=require(_0xecab('0x0'));module['exports']={'type':{'type':Sequelize[_0xecab('0x1')]},'uniqueid':{'type':Sequelize[_0xecab('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xecab('0x1')]},'queue':{'type':Sequelize[_0xecab('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xecab('0x1')]},'agentcalledAt':{'type':Sequelize[_0xecab('0x2')]},'agentconnectAt':{'type':Sequelize[_0xecab('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xecab('0x2')]},'agentdumpAt':{'type':Sequelize[_0xecab('0x2')]},'holdtime':{'type':Sequelize[_0xecab('0x3')]},'agentcomplete':{'type':Sequelize[_0xecab('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xecab('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xecab('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xecab('0x3')]},'agentacw':{'type':Sequelize[_0xecab('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xecab('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xecab('0x1')]},'channelstate':{'type':Sequelize[_0xecab('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xecab('0x1')]},'connectedlinename':{'type':Sequelize[_0xecab('0x1')]},'language':{'type':Sequelize[_0xecab('0x1')]},'accountcode':{'type':Sequelize[_0xecab('0x1')]},'context':{'type':Sequelize[_0xecab('0x1')]},'exten':{'type':Sequelize[_0xecab('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xecab('0x1')]},'destchannelstate':{'type':Sequelize[_0xecab('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xecab('0x1')]},'destcalleridnum':{'type':Sequelize[_0xecab('0x1')]},'destcalleridname':{'type':Sequelize[_0xecab('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xecab('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xecab('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xecab('0x1')]},'destpriority':{'type':Sequelize[_0xecab('0x1')]},'destuniqueid':{'type':Sequelize[_0xecab('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xecab('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xecab('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xecab('0x1')],'comment':_0xecab('0x5')},'transferexten':{'type':Sequelize[_0xecab('0x1')]},'transferuniqueid':{'type':Sequelize[_0xecab('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'type':{'type':Sequelize[_0x2227('0x2')]},'uniqueid':{'type':Sequelize[_0x2227('0x2')]},'calleridnum':{'type':Sequelize[_0x2227('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2227('0x2')]},'interface':{'type':Sequelize[_0x2227('0x2')]},'membername':{'type':Sequelize[_0x2227('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2227('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2227('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2227('0x3')]},'holdtime':{'type':Sequelize[_0x2227('0x4')]},'agentcomplete':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2227('0x4')]},'agentacw':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2227('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2227('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2227('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2227('0x2')]},'connectedlinename':{'type':Sequelize[_0x2227('0x2')]},'language':{'type':Sequelize[_0x2227('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2227('0x2')]},'exten':{'type':Sequelize[_0x2227('0x2')]},'priority':{'type':Sequelize[_0x2227('0x2')]},'destchannel':{'type':Sequelize[_0x2227('0x2')]},'destchannelstate':{'type':Sequelize[_0x2227('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2227('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2227('0x2')]},'destcontext':{'type':Sequelize[_0x2227('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2227('0x2')]},'destuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2227('0x2')]},'transfer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2227('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2227('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2227('0x2')]},'agententerreason':{'type':Sequelize[_0x2227('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7e039a8..df1edd8 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 6849065..7610e83 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 _0x28a2=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x228a('0xc'),_0x228a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49c4=['destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x42db3e,_0x4e0e33){var _0x1c86e2=function(_0xf701de){while(--_0xf701de){_0x42db3e['push'](_0x42db3e['shift']());}};_0x1c86e2(++_0x4e0e33);}(_0x49c4,0x9b));var _0x449c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x49c4[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x449c('0xc'),_0x449c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8d506b7..50b09ba 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 _0xae86=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird'];(function(_0x3a5b9f,_0x599f46){var _0x4e9b72=function(_0x20ac03){while(--_0x20ac03){_0x3a5b9f['push'](_0x3a5b9f['shift']());}};_0x4e9b72(++_0x599f46);}(_0xae86,0xeb));var _0x6ae8=function(_0x52cbc6,_0x3a9e07){_0x52cbc6=_0x52cbc6-0x0;var _0x5b7ee5=_0xae86[_0x52cbc6];return _0x5b7ee5;};'use strict';var _=require(_0x6ae8('0x0'));var util=require(_0x6ae8('0x1'));var moment=require('moment');var BPromise=require(_0x6ae8('0x2'));var rs=require(_0x6ae8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ae8('0x4'))['db'];var utils=require(_0x6ae8('0x5'));var logger=require(_0x6ae8('0x6'))(_0x6ae8('0x7'));var config=require(_0x6ae8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ae8('0x9')][_0x6ae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422d17,_0x380eeb,_0x31cb56){return new BPromise(function(_0xe1b4d5,_0x2bd2f5){return client[_0x6ae8('0xb')](_0x422d17,_0x31cb56)[_0x6ae8('0xc')](function(_0x452567){logger[_0x6ae8('0xd')](_0x6ae8('0xe'),_0x380eeb,_0x6ae8('0xf'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x380eeb,_0x6ae8('0xf'),JSON[_0x6ae8('0x10')](_0x452567));if(_0x452567['error']){if(_0x452567[_0x6ae8('0x11')][_0x6ae8('0x12')]===0x1f4){logger[_0x6ae8('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x380eeb,_0x452567[_0x6ae8('0x11')]['message']);return _0x2bd2f5(_0x452567[_0x6ae8('0x11')][_0x6ae8('0x13')]);}logger[_0x6ae8('0x11')](_0x6ae8('0xe'),_0x380eeb,_0x452567[_0x6ae8('0x11')]['message']);return _0xe1b4d5(_0x452567[_0x6ae8('0x11')][_0x6ae8('0x13')]);}else{logger[_0x6ae8('0xd')](_0x6ae8('0xe'),_0x380eeb,_0x6ae8('0xf'));_0xe1b4d5(_0x452567[_0x6ae8('0x14')][_0x6ae8('0x13')]);}})[_0x6ae8('0x15')](function(_0x2afc39){logger[_0x6ae8('0x11')](_0x6ae8('0xe'),_0x380eeb,_0x2afc39);_0x2bd2f5(_0x2afc39);});});}exports[_0x6ae8('0x16')]=function(_0x42fc6f){var _0xd7527f=this;return new Promise(function(_0x3204ee,_0x2ace66){return db[_0x6ae8('0x17')][_0x6ae8('0x18')](_0x42fc6f[_0x6ae8('0x19')],{'raw':_0x42fc6f[_0x6ae8('0x1a')]?_0x42fc6f[_0x6ae8('0x1a')][_0x6ae8('0x1b')]===undefined?!![]:![]:!![]})[_0x6ae8('0xc')](function(_0x41da20){logger['info'](_0x6ae8('0x16'),_0x42fc6f);logger[_0x6ae8('0x1c')](_0x6ae8('0x16'),_0x42fc6f,JSON[_0x6ae8('0x10')](_0x41da20));_0x3204ee(_0x41da20);})[_0x6ae8('0x15')](function(_0x2d1ea1){logger[_0x6ae8('0x11')]('CreateVoiceAgentReport',_0x2d1ea1[_0x6ae8('0x13')],_0x42fc6f);_0x2ace66(_0xd7527f['error'](0x1f4,_0x2d1ea1[_0x6ae8('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4c173c){var _0x2bc96a=this;return new Promise(function(_0x40718c,_0x47af18){return db[_0x6ae8('0x17')][_0x6ae8('0x1d')](_0x4c173c['body'],{'raw':_0x4c173c[_0x6ae8('0x1a')]?_0x4c173c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c173c[_0x6ae8('0x1a')]?_0x4c173c[_0x6ae8('0x1a')][_0x6ae8('0x1e')]||null:null,'attributes':_0x4c173c[_0x6ae8('0x1a')]?_0x4c173c[_0x6ae8('0x1a')][_0x6ae8('0x1f')]||null:null,'limit':_0x4c173c['options']?_0x4c173c[_0x6ae8('0x1a')][_0x6ae8('0x20')]||null:null})[_0x6ae8('0xc')](function(_0x56def5){logger[_0x6ae8('0xd')](_0x6ae8('0x21'),_0x4c173c);logger['debug'](_0x6ae8('0x21'),_0x4c173c,JSON[_0x6ae8('0x10')](_0x56def5));_0x40718c(_0x56def5);})[_0x6ae8('0x15')](function(_0x38e57f){logger[_0x6ae8('0x11')](_0x6ae8('0x21'),_0x38e57f[_0x6ae8('0x13')],_0x4c173c);_0x47af18(_0x2bc96a['error'](0x1f4,_0x38e57f[_0x6ae8('0x13')]));});});}; \ No newline at end of file +var _0x47a1=['VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','update','where','limit','UpdateVoiceAgentReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3226a7,_0x295ab8){var _0x44dd9c=function(_0x3b9ad7){while(--_0x3b9ad7){_0x3226a7['push'](_0x3226a7['shift']());}};_0x44dd9c(++_0x295ab8);}(_0x47a1,0x15f));var _0x147a=function(_0x1bac97,_0x27c268){_0x1bac97=_0x1bac97-0x0;var _0x595505=_0x47a1[_0x1bac97];return _0x595505;};'use strict';var _=require(_0x147a('0x0'));var util=require('util');var moment=require(_0x147a('0x1'));var BPromise=require(_0x147a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x147a('0x3'))['db'];var utils=require(_0x147a('0x4'));var logger=require(_0x147a('0x5'))('rpc');var config=require(_0x147a('0x6'));var jayson=require(_0x147a('0x7'));var client=jayson[_0x147a('0x8')][_0x147a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11acaa,_0x1f83b0,_0x3e4ea6){return new BPromise(function(_0x35091a,_0x3b8f98){return client[_0x147a('0xa')](_0x11acaa,_0x3e4ea6)[_0x147a('0xb')](function(_0x49a9e0){logger[_0x147a('0xc')](_0x147a('0xd'),_0x1f83b0,_0x147a('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1f83b0,_0x147a('0xe'),JSON[_0x147a('0xf')](_0x49a9e0));if(_0x49a9e0[_0x147a('0x10')]){if(_0x49a9e0[_0x147a('0x10')][_0x147a('0x11')]===0x1f4){logger[_0x147a('0x10')](_0x147a('0xd'),_0x1f83b0,_0x49a9e0['error']['message']);return _0x3b8f98(_0x49a9e0['error'][_0x147a('0x12')]);}logger[_0x147a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x1f83b0,_0x49a9e0[_0x147a('0x10')][_0x147a('0x12')]);return _0x35091a(_0x49a9e0[_0x147a('0x10')]['message']);}else{logger[_0x147a('0xc')](_0x147a('0xd'),_0x1f83b0,_0x147a('0xe'));_0x35091a(_0x49a9e0[_0x147a('0x13')]['message']);}})[_0x147a('0x14')](function(_0x31f971){logger[_0x147a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x1f83b0,_0x31f971);_0x3b8f98(_0x31f971);});});}exports['CreateVoiceAgentReport']=function(_0x75e8cf){var _0x6b6deb=this;return new Promise(function(_0x23ee7f,_0x4c6089){return db[_0x147a('0x15')][_0x147a('0x16')](_0x75e8cf[_0x147a('0x17')],{'raw':_0x75e8cf['options']?_0x75e8cf[_0x147a('0x18')][_0x147a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5c972f){logger[_0x147a('0xc')]('CreateVoiceAgentReport',_0x75e8cf);logger['debug'](_0x147a('0x1a'),_0x75e8cf,JSON[_0x147a('0xf')](_0x5c972f));_0x23ee7f(_0x5c972f);})[_0x147a('0x14')](function(_0x3c0237){logger['error'](_0x147a('0x1a'),_0x3c0237[_0x147a('0x12')],_0x75e8cf);_0x4c6089(_0x6b6deb['error'](0x1f4,_0x3c0237[_0x147a('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x325c46){var _0x43e23a=this;return new Promise(function(_0x153bff,_0xd509b0){return db[_0x147a('0x15')][_0x147a('0x1b')](_0x325c46[_0x147a('0x17')],{'raw':_0x325c46['options']?_0x325c46[_0x147a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325c46['options']?_0x325c46[_0x147a('0x18')][_0x147a('0x1c')]||null:null,'attributes':_0x325c46[_0x147a('0x18')]?_0x325c46['options']['attributes']||null:null,'limit':_0x325c46[_0x147a('0x18')]?_0x325c46[_0x147a('0x18')][_0x147a('0x1d')]||null:null})[_0x147a('0xb')](function(_0x2c1713){logger[_0x147a('0xc')](_0x147a('0x1e'),_0x325c46);logger['debug'](_0x147a('0x1e'),_0x325c46,JSON[_0x147a('0xf')](_0x2c1713));_0x153bff(_0x2c1713);})['catch'](function(_0x3a3e03){logger[_0x147a('0x10')]('UpdateVoiceAgentReport',_0x3a3e03['message'],_0x325c46);_0xd509b0(_0x43e23a['error'](0x1f4,_0x3a3e03[_0x147a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7d4bdb2..8e0c401 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 _0xcb99=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x4d20c0,_0x33210c){var _0x1afcc3=function(_0x1fcc87){while(--_0x1fcc87){_0x4d20c0['push'](_0x4d20c0['shift']());}};_0x1afcc3(++_0x33210c);}(_0xcb99,0x8b));var _0x9cb9=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0xcb99[_0x431cf2];return _0x10c9a7;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);router[_0x9cb9('0xe')](_0x9cb9('0xb'),auth['isAuthenticated'](),controller[_0x9cb9('0xf')]);router[_0x9cb9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x11')]);module[_0x9cb9('0x12')]=router; \ No newline at end of file +var _0xcb99=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x105f31,_0x3b2c63){var _0x4cf8ba=function(_0x541deb){while(--_0x541deb){_0x105f31['push'](_0x105f31['shift']());}};_0x4cf8ba(++_0x3b2c63);}(_0xcb99,0x8b));var _0x9cb9=function(_0xc2dccb,_0x5957f2){_0xc2dccb=_0xc2dccb-0x0;var _0x3239b3=_0xcb99[_0xc2dccb];return _0x3239b3;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);router[_0x9cb9('0xe')](_0x9cb9('0xb'),auth['isAuthenticated'](),controller[_0x9cb9('0xf')]);router[_0x9cb9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x11')]);module[_0x9cb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 3cb736d..7b9b0a5 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 _0xb515=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xb515,0x1b8));var _0x5b51=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0xb515[_0x5805d7];return _0x170fe4;};'use strict';var Sequelize=require(_0x5b51('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5b51('0x1')]},'type':{'type':Sequelize[_0x5b51('0x2')](_0x5b51('0x3'),_0x5b51('0x4'),_0x5b51('0x5'),_0x5b51('0x6'),_0x5b51('0x7'),_0x5b51('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5b51('0x1')]},'source':{'type':Sequelize[_0x5b51('0x1')]},'destination':{'type':Sequelize[_0x5b51('0x1')]},'destinationcontext':{'type':Sequelize[_0x5b51('0x1')]},'callerid':{'type':Sequelize[_0x5b51('0x1')]},'channel':{'type':Sequelize[_0x5b51('0x1')]},'destinationchannel':{'type':Sequelize[_0x5b51('0x1')]},'lastapplication':{'type':Sequelize[_0x5b51('0x1')]},'lastdata':{'type':Sequelize[_0x5b51('0x9')]},'starttime':{'type':Sequelize[_0x5b51('0xa')]},'systemanswertime':{'type':Sequelize[_0x5b51('0xa')]},'answertime':{'type':Sequelize[_0x5b51('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x5b51('0xb')]},'billableseconds':{'type':Sequelize[_0x5b51('0xb')]},'mohtime':{'type':Sequelize[_0x5b51('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5b51('0x1')]},'amaflags':{'type':Sequelize[_0x5b51('0x1')]},'userfield':{'type':Sequelize[_0x5b51('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b51('0x1')]},'prefix':{'type':Sequelize[_0x5b51('0x1')]},'routeid':{'type':Sequelize[_0x5b51('0xb')]},'sipcallid':{'type':Sequelize[_0x5b51('0x1')]}}; \ No newline at end of file +var _0x0c8d=['INTEGER','exports','STRING','ENUM','inbound','internal','TEXT','DATE'];(function(_0x46c59b,_0x5635dd){var _0x16dd2d=function(_0x4e7378){while(--_0x4e7378){_0x46c59b['push'](_0x46c59b['shift']());}};_0x16dd2d(++_0x5635dd);}(_0x0c8d,0x79));var _0xd0c8=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0c8d[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require('sequelize');module[_0xd0c8('0x0')]={'uniqueid':{'type':Sequelize[_0xd0c8('0x1')]},'type':{'type':Sequelize[_0xd0c8('0x2')](_0xd0c8('0x3'),_0xd0c8('0x4'),'outbound','inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xd0c8('0x1')]},'accountcode':{'type':Sequelize[_0xd0c8('0x1')]},'source':{'type':Sequelize[_0xd0c8('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xd0c8('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd0c8('0x1')]},'destinationchannel':{'type':Sequelize[_0xd0c8('0x1')]},'lastapplication':{'type':Sequelize[_0xd0c8('0x1')]},'lastdata':{'type':Sequelize[_0xd0c8('0x5')]},'starttime':{'type':Sequelize[_0xd0c8('0x6')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd0c8('0x6')]},'endtime':{'type':Sequelize[_0xd0c8('0x6')]},'duration':{'type':Sequelize[_0xd0c8('0x7')]},'billableseconds':{'type':Sequelize[_0xd0c8('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xd0c8('0x1')]},'userfield':{'type':Sequelize[_0xd0c8('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xd0c8('0x7')]},'sipcallid':{'type':Sequelize[_0xd0c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4c91447..5666055 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x283b7c,_0x53bb1f){_0x283b7c=_0x283b7c-0x0;var _0x2a26ea=_0x5f2f[_0x283b7c];return _0x2a26ea;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +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(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f2ec7,_0x24fc60){_0x4f2ec7=_0x4f2ec7-0x0;var _0x42af07=_0x2ef3[_0x4f2ec7];return _0x42af07;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index edd77d0..28aa9dc 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 _0x7abb=['../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xdd3867,_0x5b59b2){var _0xe1ec64=function(_0x57e2c8){while(--_0x57e2c8){_0xdd3867['push'](_0xdd3867['shift']());}};_0xe1ec64(++_0x5b59b2);}(_0x7abb,0xe5));var _0xb7ab=function(_0x2af627,_0x33d47f){_0x2af627=_0x2af627-0x0;var _0x14eda9=_0x7abb[_0x2af627];return _0x14eda9;};'use strict';var _=require(_0xb7ab('0x0'));var util=require(_0xb7ab('0x1'));var logger=require(_0xb7ab('0x2'))(_0xb7ab('0x3'));var moment=require(_0xb7ab('0x4'));var BPromise=require(_0xb7ab('0x5'));var rp=require(_0xb7ab('0x6'));var fs=require('fs');var path=require(_0xb7ab('0x7'));var rimraf=require(_0xb7ab('0x8'));var config=require(_0xb7ab('0x9'));var attributes=require('./voiceCallReport.attributes');module[_0xb7ab('0xa')]=function(_0x6d4fa3,_0x539440){return _0x6d4fa3['define'](_0xb7ab('0xb'),attributes,{'tableName':_0xb7ab('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb7ab('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcbc=['request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4691d7,_0x2a6a2c){var _0x15aa16=function(_0x57bb4d){while(--_0x57bb4d){_0x4691d7['push'](_0x4691d7['shift']());}};_0x15aa16(++_0x2a6a2c);}(_0xdcbc,0x178));var _0xcdcb=function(_0xbf4891,_0xac20c6){_0xbf4891=_0xbf4891-0x0;var _0x5e5534=_0xdcbc[_0xbf4891];return _0x5e5534;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var logger=require(_0xcdcb('0x2'))('api');var moment=require(_0xcdcb('0x3'));var BPromise=require('bluebird');var rp=require(_0xcdcb('0x4'));var fs=require('fs');var path=require(_0xcdcb('0x5'));var rimraf=require('rimraf');var config=require(_0xcdcb('0x6'));var attributes=require(_0xcdcb('0x7'));module[_0xcdcb('0x8')]=function(_0x5a928c,_0x4d37bb){return _0x5a928c['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xcdcb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c8b31b9..c99e243 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 _0x0aae=['model','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x487ed4,_0x312026){var _0xa1193e=function(_0x608154){while(--_0x608154){_0x487ed4['push'](_0x487ed4['shift']());}};_0xa1193e(++_0x312026);}(_0x0aae,0x101));var _0xe0aa=function(_0x395c77,_0x3069fa){_0x395c77=_0x395c77-0x0;var _0x16bc28=_0x0aae[_0x395c77];return _0x16bc28;};'use strict';var _=require(_0xe0aa('0x0'));var util=require('util');var moment=require(_0xe0aa('0x1'));var BPromise=require(_0xe0aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0aa('0x3'));var db=require(_0xe0aa('0x4'))['db'];var utils=require(_0xe0aa('0x5'));var logger=require('../../config/logger')(_0xe0aa('0x6'));var config=require(_0xe0aa('0x7'));var jayson=require(_0xe0aa('0x8'));var client=jayson['client'][_0xe0aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55dfdb,_0x36fa1a,_0x24e53d){return new BPromise(function(_0x2361d0,_0x247919){return client['request'](_0x55dfdb,_0x24e53d)[_0xe0aa('0xa')](function(_0x9e8079){logger[_0xe0aa('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x36fa1a,_0xe0aa('0xc'));logger[_0xe0aa('0xd')](_0xe0aa('0xe'),_0x36fa1a,'request\x20sent',JSON[_0xe0aa('0xf')](_0x9e8079));if(_0x9e8079['error']){if(_0x9e8079[_0xe0aa('0x10')]['code']===0x1f4){logger['error'](_0xe0aa('0x11'),_0x36fa1a,_0x9e8079[_0xe0aa('0x10')]['message']);return _0x247919(_0x9e8079[_0xe0aa('0x10')][_0xe0aa('0x12')]);}logger['error'](_0xe0aa('0x11'),_0x36fa1a,_0x9e8079['error'][_0xe0aa('0x12')]);return _0x2361d0(_0x9e8079['error'][_0xe0aa('0x12')]);}else{logger[_0xe0aa('0xb')](_0xe0aa('0x11'),_0x36fa1a,_0xe0aa('0xc'));_0x2361d0(_0x9e8079[_0xe0aa('0x13')][_0xe0aa('0x12')]);}})[_0xe0aa('0x14')](function(_0x2b96e8){logger[_0xe0aa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x36fa1a,_0x2b96e8);_0x247919(_0x2b96e8);});});}exports[_0xe0aa('0x15')]=function(_0x7ba647){var _0x1d7582=this;return new Promise(function(_0x1931e1,_0x4ad0bc){return db[_0xe0aa('0x16')][_0xe0aa('0x17')]({'raw':_0x7ba647[_0xe0aa('0x18')]?_0x7ba647['options'][_0xe0aa('0x19')]===undefined?!![]:![]:!![],'where':_0x7ba647[_0xe0aa('0x18')]?_0x7ba647[_0xe0aa('0x18')][_0xe0aa('0x1a')]||null:null,'attributes':_0x7ba647[_0xe0aa('0x18')]?_0x7ba647[_0xe0aa('0x18')][_0xe0aa('0x1b')]||null:null,'limit':_0x7ba647['options']?_0x7ba647[_0xe0aa('0x18')][_0xe0aa('0x1c')]||null:null,'include':_0x7ba647[_0xe0aa('0x18')]?_0x7ba647[_0xe0aa('0x18')][_0xe0aa('0x1d')]?_[_0xe0aa('0x1e')](_0x7ba647['options'][_0xe0aa('0x1d')],function(_0x18d2cd){return{'model':db[_0x18d2cd[_0xe0aa('0x1f')]],'as':_0x18d2cd['as'],'attributes':_0x18d2cd['attributes'],'include':_0x18d2cd['include']?_[_0xe0aa('0x1e')](_0x18d2cd[_0xe0aa('0x1d')],function(_0x3b4ee7){return{'model':db[_0x3b4ee7[_0xe0aa('0x1f')]],'as':_0x3b4ee7['as'],'attributes':_0x3b4ee7['attributes'],'include':_0x3b4ee7['include']?_[_0xe0aa('0x1e')](_0x3b4ee7[_0xe0aa('0x1d')],function(_0x3424e7){return{'model':db[_0x3424e7['model']],'as':_0x3424e7['as'],'attributes':_0x3424e7[_0xe0aa('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e2b54){logger['info']('GetVoiceCallReport',_0x7ba647);logger[_0xe0aa('0xd')]('GetVoiceCallReport',_0x7ba647,JSON['stringify'](_0x5e2b54));_0x1931e1(_0x5e2b54);})[_0xe0aa('0x14')](function(_0x1f5b02){logger[_0xe0aa('0x10')]('GetVoiceCallReport',_0x1f5b02[_0xe0aa('0x12')],_0x7ba647);_0x4ad0bc(_0x1d7582[_0xe0aa('0x10')](0x1f4,_0x1f5b02['message']));});});};exports['CreateVoiceCallReport']=function(_0x475c59){var _0xbdef2b=this;return new Promise(function(_0x55bb04,_0x3dbd03){return db['VoiceCallReport'][_0xe0aa('0x20')](_0x475c59['body'],{'raw':_0x475c59[_0xe0aa('0x18')]?_0x475c59[_0xe0aa('0x18')][_0xe0aa('0x19')]===undefined?!![]:![]:!![]})[_0xe0aa('0xa')](function(_0x2d6eb7){logger['info'](_0xe0aa('0x21'),_0x475c59);logger[_0xe0aa('0xd')](_0xe0aa('0x21'),_0x475c59,JSON[_0xe0aa('0xf')](_0x2d6eb7));_0x55bb04(_0x2d6eb7);})['catch'](function(_0x57b2f8){logger[_0xe0aa('0x10')](_0xe0aa('0x21'),_0x57b2f8[_0xe0aa('0x12')],_0x475c59);_0x3dbd03(_0xbdef2b['error'](0x1f4,_0x57b2f8[_0xe0aa('0x12')]));});});};exports[_0xe0aa('0x22')]=function(_0xd9c9c8){var _0x311cb1=this;return new Promise(function(_0x5d759f,_0xd308e7){return db[_0xe0aa('0x16')][_0xe0aa('0x23')](_0xd9c9c8['body'],{'raw':_0xd9c9c8[_0xe0aa('0x18')]?_0xd9c9c8[_0xe0aa('0x18')][_0xe0aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9c9c8[_0xe0aa('0x18')]?_0xd9c9c8[_0xe0aa('0x18')][_0xe0aa('0x1a')]||null:null,'attributes':_0xd9c9c8[_0xe0aa('0x18')]?_0xd9c9c8[_0xe0aa('0x18')][_0xe0aa('0x1b')]||null:null,'limit':_0xd9c9c8[_0xe0aa('0x18')]?_0xd9c9c8['options'][_0xe0aa('0x1c')]||null:null})[_0xe0aa('0xa')](function(_0x11218e){logger['info'](_0xe0aa('0x22'),_0xd9c9c8);logger[_0xe0aa('0xd')](_0xe0aa('0x22'),_0xd9c9c8,JSON[_0xe0aa('0xf')](_0x11218e));_0x5d759f(_0x11218e);})[_0xe0aa('0x14')](function(_0x57a32c){logger[_0xe0aa('0x10')](_0xe0aa('0x22'),_0x57a32c['message'],_0xd9c9c8);_0xd308e7(_0x311cb1['error'](0x1f4,_0x57a32c[_0xe0aa('0x12')]));});});}; \ No newline at end of file +var _0xe363=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','util','moment','bluebird'];(function(_0x3e7447,_0x45fe34){var _0xf63cb3=function(_0x372b39){while(--_0x372b39){_0x3e7447['push'](_0x3e7447['shift']());}};_0xf63cb3(++_0x45fe34);}(_0xe363,0x1aa));var _0x3e36=function(_0x4b2f60,_0x406538){_0x4b2f60=_0x4b2f60-0x0;var _0x3e08c4=_0xe363[_0x4b2f60];return _0x3e08c4;};'use strict';var _=require('lodash');var util=require(_0x3e36('0x0'));var moment=require(_0x3e36('0x1'));var BPromise=require(_0x3e36('0x2'));var rs=require(_0x3e36('0x3'));var fs=require('fs');var Redis=require(_0x3e36('0x4'));var db=require(_0x3e36('0x5'))['db'];var utils=require(_0x3e36('0x6'));var logger=require(_0x3e36('0x7'))(_0x3e36('0x8'));var config=require('../../config/environment');var jayson=require(_0x3e36('0x9'));var client=jayson[_0x3e36('0xa')][_0x3e36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34ae2b,_0x56c4e7,_0x333c08){return new BPromise(function(_0x46a97d,_0x4bc1c4){return client['request'](_0x34ae2b,_0x333c08)[_0x3e36('0xc')](function(_0x31a71e){logger['info'](_0x3e36('0xd'),_0x56c4e7,_0x3e36('0xe'));logger[_0x3e36('0xf')](_0x3e36('0x10'),_0x56c4e7,_0x3e36('0xe'),JSON['stringify'](_0x31a71e));if(_0x31a71e[_0x3e36('0x11')]){if(_0x31a71e[_0x3e36('0x11')][_0x3e36('0x12')]===0x1f4){logger[_0x3e36('0x11')](_0x3e36('0xd'),_0x56c4e7,_0x31a71e[_0x3e36('0x11')]['message']);return _0x4bc1c4(_0x31a71e[_0x3e36('0x11')][_0x3e36('0x13')]);}logger[_0x3e36('0x11')](_0x3e36('0xd'),_0x56c4e7,_0x31a71e[_0x3e36('0x11')][_0x3e36('0x13')]);return _0x46a97d(_0x31a71e['error']['message']);}else{logger[_0x3e36('0x14')](_0x3e36('0xd'),_0x56c4e7,_0x3e36('0xe'));_0x46a97d(_0x31a71e[_0x3e36('0x15')][_0x3e36('0x13')]);}})[_0x3e36('0x16')](function(_0x4fee75){logger[_0x3e36('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x56c4e7,_0x4fee75);_0x4bc1c4(_0x4fee75);});});}exports['GetVoiceCallReport']=function(_0x448ca9){var _0x4d793f=this;return new Promise(function(_0x168e42,_0x2a8b65){return db[_0x3e36('0x17')][_0x3e36('0x18')]({'raw':_0x448ca9[_0x3e36('0x19')]?_0x448ca9[_0x3e36('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x448ca9['options']?_0x448ca9[_0x3e36('0x19')][_0x3e36('0x1a')]||null:null,'attributes':_0x448ca9[_0x3e36('0x19')]?_0x448ca9['options'][_0x3e36('0x1b')]||null:null,'limit':_0x448ca9[_0x3e36('0x19')]?_0x448ca9[_0x3e36('0x19')][_0x3e36('0x1c')]||null:null,'include':_0x448ca9[_0x3e36('0x19')]?_0x448ca9[_0x3e36('0x19')][_0x3e36('0x1d')]?_[_0x3e36('0x1e')](_0x448ca9[_0x3e36('0x19')]['include'],function(_0x3cd475){return{'model':db[_0x3cd475[_0x3e36('0x1f')]],'as':_0x3cd475['as'],'attributes':_0x3cd475[_0x3e36('0x1b')],'include':_0x3cd475[_0x3e36('0x1d')]?_[_0x3e36('0x1e')](_0x3cd475['include'],function(_0x446f81){return{'model':db[_0x446f81[_0x3e36('0x1f')]],'as':_0x446f81['as'],'attributes':_0x446f81['attributes'],'include':_0x446f81[_0x3e36('0x1d')]?_[_0x3e36('0x1e')](_0x446f81[_0x3e36('0x1d')],function(_0x452c6d){return{'model':db[_0x452c6d[_0x3e36('0x1f')]],'as':_0x452c6d['as'],'attributes':_0x452c6d[_0x3e36('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3e36('0xc')](function(_0x380a49){logger[_0x3e36('0x14')]('GetVoiceCallReport',_0x448ca9);logger[_0x3e36('0xf')](_0x3e36('0x20'),_0x448ca9,JSON[_0x3e36('0x21')](_0x380a49));_0x168e42(_0x380a49);})[_0x3e36('0x16')](function(_0x41c492){logger[_0x3e36('0x11')](_0x3e36('0x20'),_0x41c492[_0x3e36('0x13')],_0x448ca9);_0x2a8b65(_0x4d793f[_0x3e36('0x11')](0x1f4,_0x41c492['message']));});});};exports[_0x3e36('0x22')]=function(_0x310172){var _0x49be81=this;return new Promise(function(_0x2e7f23,_0x571b8d){return db[_0x3e36('0x17')][_0x3e36('0x23')](_0x310172[_0x3e36('0x24')],{'raw':_0x310172[_0x3e36('0x19')]?_0x310172['options'][_0x3e36('0x25')]===undefined?!![]:![]:!![]})[_0x3e36('0xc')](function(_0x25694a){logger[_0x3e36('0x14')]('CreateVoiceCallReport',_0x310172);logger[_0x3e36('0xf')](_0x3e36('0x22'),_0x310172,JSON[_0x3e36('0x21')](_0x25694a));_0x2e7f23(_0x25694a);})[_0x3e36('0x16')](function(_0x179d7d){logger[_0x3e36('0x11')]('CreateVoiceCallReport',_0x179d7d[_0x3e36('0x13')],_0x310172);_0x571b8d(_0x49be81[_0x3e36('0x11')](0x1f4,_0x179d7d['message']));});});};exports[_0x3e36('0x26')]=function(_0x11e772){var _0x6cb881=this;return new Promise(function(_0x3427ad,_0x4205da){return db[_0x3e36('0x17')]['update'](_0x11e772[_0x3e36('0x24')],{'raw':_0x11e772[_0x3e36('0x19')]?_0x11e772[_0x3e36('0x19')][_0x3e36('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e772[_0x3e36('0x19')]?_0x11e772['options']['where']||null:null,'attributes':_0x11e772[_0x3e36('0x19')]?_0x11e772[_0x3e36('0x19')][_0x3e36('0x1b')]||null:null,'limit':_0x11e772['options']?_0x11e772[_0x3e36('0x19')][_0x3e36('0x1c')]||null:null})[_0x3e36('0xc')](function(_0x2f9a18){logger['info'](_0x3e36('0x26'),_0x11e772);logger[_0x3e36('0xf')]('UpdateVoiceCallReport',_0x11e772,JSON[_0x3e36('0x21')](_0x2f9a18));_0x3427ad(_0x2f9a18);})['catch'](function(_0x12f122){logger[_0x3e36('0x11')](_0x3e36('0x26'),_0x12f122[_0x3e36('0x13')],_0x11e772);_0x4205da(_0x6cb881[_0x3e36('0x11')](0x1f4,_0x12f122[_0x3e36('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6127609..bc0f59a 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 _0xc6e3=['isAuthenticated','index','get','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x1cf0bc,_0x3fc67d){var _0x986385=function(_0x5e1325){while(--_0x5e1325){_0x1cf0bc['push'](_0x1cf0bc['shift']());}};_0x986385(++_0x3fc67d);}(_0xc6e3,0x100));var _0x3c6e=function(_0x5e21ae,_0x2e8b72){_0x5e21ae=_0x5e21ae-0x0;var _0x264f59=_0xc6e3[_0x5e21ae];return _0x264f59;};'use strict';var multer=require(_0x3c6e('0x0'));var util=require(_0x3c6e('0x1'));var path=require(_0x3c6e('0x2'));var timeout=require(_0x3c6e('0x3'));var express=require('express');var router=express[_0x3c6e('0x4')]();var fs_extra=require(_0x3c6e('0x5'));var auth=require(_0x3c6e('0x6'));var interaction=require(_0x3c6e('0x7'));var config=require(_0x3c6e('0x8'));var controller=require(_0x3c6e('0x9'));router['get']('/',auth[_0x3c6e('0xa')](),controller[_0x3c6e('0xb')]);router[_0x3c6e('0xc')](_0x3c6e('0xd'),auth[_0x3c6e('0xa')](),controller[_0x3c6e('0xe')]);router[_0x3c6e('0xf')]('/',auth[_0x3c6e('0xa')](),controller[_0x3c6e('0x10')]);router['put'](_0x3c6e('0xd'),auth['isAuthenticated'](),controller[_0x3c6e('0x11')]);router['delete'](_0x3c6e('0xd'),auth['isAuthenticated'](),controller[_0x3c6e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb9dc=['isAuthenticated','index','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xb9dc,0x17d));var _0xcb9d=function(_0x632887,_0x572b48){_0x632887=_0x632887-0x0;var _0xca6fb7=_0xb9dc[_0x632887];return _0xca6fb7;};'use strict';var multer=require(_0xcb9d('0x0'));var util=require(_0xcb9d('0x1'));var path=require(_0xcb9d('0x2'));var timeout=require(_0xcb9d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcb9d('0x4'));var auth=require(_0xcb9d('0x5'));var interaction=require(_0xcb9d('0x6'));var config=require(_0xcb9d('0x7'));var controller=require(_0xcb9d('0x8'));router[_0xcb9d('0x9')]('/',auth[_0xcb9d('0xa')](),controller[_0xcb9d('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xcb9d('0xa')](),controller[_0xcb9d('0xc')]);router['put'](_0xcb9d('0xd'),auth[_0xcb9d('0xa')](),controller['update']);router[_0xcb9d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xcb9d('0xf')]);module[_0xcb9d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 72a5519..c70cd2f 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 _0x0ba3=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x160570,_0x5e7c87){var _0x2a968d=function(_0x44b685){while(--_0x44b685){_0x160570['push'](_0x160570['shift']());}};_0x2a968d(++_0x5e7c87);}(_0x0ba3,0xa0));var _0x30ba=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x0ba3[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0x30ba('0x0'));module[_0x30ba('0x1')]={'name':{'type':Sequelize[_0x30ba('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x30ba('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x30ba('0x2')],'set':function(_0x341225){this[_0x30ba('0x4')](_0x30ba('0x5'),_0x341225?_0x341225[_0x30ba('0x6')](''):[]);},'get':function(){return this[_0x30ba('0x7')]('options')?this['getDataValue'](_0x30ba('0x5'))[_0x30ba('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x30ba('0x2')]},'record':{'type':Sequelize[_0x30ba('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30ba('0x2')]}}; \ No newline at end of file +var _0x3e57=['join','split','BOOLEAN','sequelize','exports','STRING','name','options'];(function(_0x5c5e4d,_0x30ca75){var _0x570c64=function(_0x4e8a20){while(--_0x4e8a20){_0x5c5e4d['push'](_0x5c5e4d['shift']());}};_0x570c64(++_0x30ca75);}(_0x3e57,0x143));var _0x73e5=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x3e57[_0x3cea78];return _0x33b66b;};'use strict';var Sequelize=require(_0x73e5('0x0'));module[_0x73e5('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x73e5('0x2')],'unique':_0x73e5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x73e5('0x2')],'set':function(_0x47698b){this['setDataValue'](_0x73e5('0x4'),_0x47698b?_0x47698b[_0x73e5('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x73e5('0x4'))?this['getDataValue']('options')[_0x73e5('0x6')](''):[];}},'auth':{'type':Sequelize[_0x73e5('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x73e5('0x2')]},'record':{'type':Sequelize[_0x73e5('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 247fbab..d22dbdb 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 _0xc73e=['show','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','include','findAll','rows','catch'];(function(_0xc79f2e,_0x594942){var _0x3219dc=function(_0x4f563b){while(--_0x4f563b){_0xc79f2e['push'](_0xc79f2e['shift']());}};_0x3219dc(++_0x594942);}(_0xc73e,0x1e9));var _0xec73=function(_0x3cfc96,_0x398015){_0x3cfc96=_0x3cfc96-0x0;var _0x1fcae6=_0xc73e[_0x3cfc96];return _0x1fcae6;};'use strict';var emlformat=require(_0xec73('0x0'));var rimraf=require(_0xec73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec73('0x2'));var rp=require(_0xec73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec73('0x4'));var path=require(_0xec73('0x5'));var sox=require('sox');var csv=require(_0xec73('0x6'));var ejs=require(_0xec73('0x7'));var fs=require('fs');var fs_extra=require(_0xec73('0x8'));var _=require(_0xec73('0x9'));var squel=require('squel');var crypto=require(_0xec73('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec73('0xb'));var toCsv=require(_0xec73('0x6'));var querystring=require(_0xec73('0xc'));var Papa=require(_0xec73('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xec73('0xe'));var as=require(_0xec73('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec73('0x10'));var utils=require(_0xec73('0x11'));var config=require(_0xec73('0x12'));var licenseUtil=require(_0xec73('0x13'));var db=require(_0xec73('0x14'))['db'];function respondWithStatusCode(_0x19d0f2,_0x1e67ac){_0x1e67ac=_0x1e67ac||0xcc;return function(_0x5f5594){if(_0x5f5594){return _0x19d0f2[_0xec73('0x15')](_0x1e67ac);}return _0x19d0f2['status'](_0x1e67ac)[_0xec73('0x16')]();};}function respondWithResult(_0x4be73c,_0x10f003){_0x10f003=_0x10f003||0xc8;return function(_0x1e4869){if(_0x1e4869){return _0x4be73c[_0xec73('0x17')](_0x10f003)[_0xec73('0x18')](_0x1e4869);}};}function respondWithFilteredResult(_0x3690c3,_0x2a3296){return function(_0x35be28){if(_0x35be28){var _0x2b4e70=typeof _0x2a3296['offset']===_0xec73('0x19')&&typeof _0x2a3296[_0xec73('0x1a')]===_0xec73('0x19');var _0x219119=_0x35be28[_0xec73('0x1b')];var _0x2d646e=_0x2b4e70?0x0:_0x2a3296['offset'];var _0x1bacbf=_0x2b4e70?_0x35be28[_0xec73('0x1b')]:_0x2a3296[_0xec73('0x1c')]+_0x2a3296['limit'];var _0x57ac66;if(_0x1bacbf>=_0x219119){_0x1bacbf=_0x219119;_0x57ac66=0xc8;}else{_0x57ac66=0xce;}_0x3690c3[_0xec73('0x17')](_0x57ac66);return _0x3690c3[_0xec73('0x1d')](_0xec73('0x1e'),_0x2d646e+'-'+_0x1bacbf+'/'+_0x219119)[_0xec73('0x18')](_0x35be28);}return null;};}function patchUpdates(_0x1169c4){return function(_0x5d4c7c){try{jsonpatch['apply'](_0x5d4c7c,_0x1169c4,!![]);}catch(_0x3eeaff){return BPromise[_0xec73('0x1f')](_0x3eeaff);}return _0x5d4c7c[_0xec73('0x20')]();};}function saveUpdates(_0x60bfec,_0x451715){return function(_0x4a862b){if(_0x4a862b){return _0x4a862b[_0xec73('0x21')](_0x60bfec)['then'](function(_0x3d58bc){return _0x3d58bc;});}return null;};}function removeEntity(_0x4f95d2,_0x4df08e){return function(_0x490ee2){if(_0x490ee2){return _0x490ee2[_0xec73('0x22')]()[_0xec73('0x23')](function(){var _0x2caf6b=_0x490ee2[_0xec73('0x24')]({'plain':!![]});var _0x3df864='ChanSpies';return db['UserProfileResource'][_0xec73('0x22')]({'where':{'type':_0x3df864,'resourceId':_0x2caf6b['id']}})[_0xec73('0x23')](function(){return _0x490ee2;});})['then'](function(){_0x4f95d2[_0xec73('0x17')](0xcc)[_0xec73('0x16')]();});}};}function handleEntityNotFound(_0x3bf259,_0x4dc430){return function(_0x23ff51){if(!_0x23ff51){_0x3bf259[_0xec73('0x15')](0x194);}return _0x23ff51;};}function handleError(_0x370e7a,_0x28361e){_0x28361e=_0x28361e||0x1f4;return function(_0x49a1da){logger['error'](_0x49a1da[_0xec73('0x25')]);if(_0x49a1da[_0xec73('0x26')]){delete _0x49a1da[_0xec73('0x26')];}_0x370e7a[_0xec73('0x17')](_0x28361e)['send'](_0x49a1da);};}exports[_0xec73('0x27')]=function(_0x269ca5,_0x24268b){var _0x90341f={},_0x3d46e9={},_0x3dffd0={'count':0x0,'rows':[]};var _0x47cb62=_[_0xec73('0x28')](db[_0xec73('0x29')][_0xec73('0x2a')],function(_0x4049ec){return{'name':_0x4049ec[_0xec73('0x2b')],'type':_0x4049ec[_0xec73('0x2c')]['key']};});_0x3d46e9[_0xec73('0x2d')]=_[_0xec73('0x28')](_0x47cb62,_0xec73('0x26'));_0x3d46e9[_0xec73('0x2e')]=_[_0xec73('0x2f')](_0x269ca5[_0xec73('0x2e')]);_0x3d46e9[_0xec73('0x30')]=_['intersection'](_0x3d46e9[_0xec73('0x2d')],_0x3d46e9['query']);_0x90341f[_0xec73('0x31')]=_[_0xec73('0x32')](_0x3d46e9[_0xec73('0x2d')],qs[_0xec73('0x33')](_0x269ca5[_0xec73('0x2e')][_0xec73('0x33')]));_0x90341f[_0xec73('0x31')]=_0x90341f[_0xec73('0x31')][_0xec73('0x34')]?_0x90341f['attributes']:_0x3d46e9['model'];if(!_0x269ca5[_0xec73('0x2e')][_0xec73('0x35')](_0xec73('0x36'))){_0x90341f[_0xec73('0x1a')]=qs[_0xec73('0x1a')](_0x269ca5[_0xec73('0x2e')][_0xec73('0x1a')]);_0x90341f[_0xec73('0x1c')]=qs['offset'](_0x269ca5[_0xec73('0x2e')][_0xec73('0x1c')]);}_0x90341f[_0xec73('0x37')]=qs['sort'](_0x269ca5['query']['sort']);_0x90341f[_0xec73('0x38')]=qs['filters'](_[_0xec73('0x39')](_0x269ca5['query'],_0x3d46e9['filters']),_0x47cb62);if(_0x269ca5[_0xec73('0x2e')]['filter']){_0x90341f[_0xec73('0x38')]=_['merge'](_0x90341f[_0xec73('0x38')],{'$or':_['map'](_0x47cb62,function(_0x3a971e){if(_0x3a971e[_0xec73('0x2c')]!=='VIRTUAL'){var _0x50623e={};_0x50623e[_0x3a971e['name']]={'$like':'%'+_0x269ca5[_0xec73('0x2e')]['filter']+'%'};return _0x50623e;}})});}_0x90341f=_[_0xec73('0x3a')]({},_0x90341f,_0x269ca5[_0xec73('0x3b')]);var _0x3c7ecd={'where':_0x90341f['where']};return db[_0xec73('0x29')][_0xec73('0x1b')](_0x3c7ecd)[_0xec73('0x23')](function(_0x1c5e2b){_0x3dffd0[_0xec73('0x1b')]=_0x1c5e2b;if(_0x269ca5['query']['includeAll']){_0x90341f[_0xec73('0x3c')]=[{'all':!![]}];}return db[_0xec73('0x29')][_0xec73('0x3d')](_0x90341f);})[_0xec73('0x23')](function(_0x1f6eeb){_0x3dffd0[_0xec73('0x3e')]=_0x1f6eeb;return _0x3dffd0;})[_0xec73('0x23')](respondWithFilteredResult(_0x24268b,_0x90341f))[_0xec73('0x3f')](handleError(_0x24268b,null));};exports[_0xec73('0x40')]=function(_0xe7862b,_0x27e8ac){var _0x1a43ef={'raw':![],'where':{'id':_0xe7862b[_0xec73('0x41')]['id']}},_0x474009={};_0x474009['model']=_['keys'](db[_0xec73('0x29')][_0xec73('0x2a')]);_0x474009[_0xec73('0x2e')]=_[_0xec73('0x2f')](_0xe7862b[_0xec73('0x2e')]);_0x474009[_0xec73('0x30')]=_[_0xec73('0x32')](_0x474009[_0xec73('0x2d')],_0x474009[_0xec73('0x2e')]);_0x1a43ef['attributes']=_['intersection'](_0x474009[_0xec73('0x2d')],qs['fields'](_0xe7862b[_0xec73('0x2e')]['fields']));_0x1a43ef[_0xec73('0x31')]=_0x1a43ef[_0xec73('0x31')][_0xec73('0x34')]?_0x1a43ef[_0xec73('0x31')]:_0x474009[_0xec73('0x2d')];if(_0xe7862b['query'][_0xec73('0x42')]){_0x1a43ef[_0xec73('0x3c')]=[{'all':!![]}];}_0x1a43ef=_['merge']({},_0x1a43ef,_0xe7862b[_0xec73('0x3b')]);return db[_0xec73('0x29')][_0xec73('0x43')](_0x1a43ef)[_0xec73('0x23')](handleEntityNotFound(_0x27e8ac,null))[_0xec73('0x23')](respondWithResult(_0x27e8ac,null))['catch'](handleError(_0x27e8ac,null));};exports['create']=function(_0x42e20f,_0x2a7bec){return db[_0xec73('0x29')]['create'](_0x42e20f[_0xec73('0x44')],{})['then'](function(_0x32af0e){var _0x990149=_0x42e20f[_0xec73('0x45')][_0xec73('0x24')]({'plain':!![]});if(!_0x990149)throw new Error(_0xec73('0x46'));if(_0x990149[_0xec73('0x47')]==='user'){var _0x5ab01e=_0x32af0e[_0xec73('0x24')]({'plain':!![]});var _0x56209d=_0xec73('0x48');return db[_0xec73('0x49')][_0xec73('0x43')]({'where':{'name':_0x56209d,'userProfileId':_0x990149['userProfileId']},'raw':!![]})[_0xec73('0x23')](function(_0xcb3229){if(_0xcb3229&&_0xcb3229[_0xec73('0x4a')]===0x0){return db[_0xec73('0x4b')][_0xec73('0x4c')]({'name':_0x5ab01e[_0xec73('0x26')],'resourceId':_0x5ab01e['id'],'type':_0xcb3229[_0xec73('0x26')],'sectionId':_0xcb3229['id']},{})[_0xec73('0x23')](function(){return _0x32af0e;});}else{return _0x32af0e;}})[_0xec73('0x3f')](function(_0x332ab5){logger[_0xec73('0x4d')](_0xec73('0x4e'),_0x332ab5);throw _0x332ab5;});}return _0x32af0e;})[_0xec73('0x23')](respondWithResult(_0x2a7bec,0xc9))[_0xec73('0x3f')](handleError(_0x2a7bec,null));};exports['update']=function(_0x3c76c5,_0x375e5d){if(_0x3c76c5[_0xec73('0x44')]['id']){delete _0x3c76c5[_0xec73('0x44')]['id'];}return db[_0xec73('0x29')][_0xec73('0x43')]({'where':{'id':_0x3c76c5['params']['id']}})[_0xec73('0x23')](handleEntityNotFound(_0x375e5d,null))[_0xec73('0x23')](saveUpdates(_0x3c76c5[_0xec73('0x44')],null))['then'](respondWithResult(_0x375e5d,null))[_0xec73('0x3f')](handleError(_0x375e5d,null));};exports[_0xec73('0x22')]=function(_0x631a54,_0x290ee8){return db[_0xec73('0x29')][_0xec73('0x43')]({'where':{'id':_0x631a54[_0xec73('0x41')]['id']}})[_0xec73('0x23')](handleEntityNotFound(_0x290ee8,null))['then'](removeEntity(_0x290ee8,null))[_0xec73('0x3f')](handleError(_0x290ee8,null));}; \ No newline at end of file +var _0xf0cc=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','error','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x36a132,_0x2342b3){_0x36a132=_0x36a132-0x0;var _0x47cdaf=_0xf0cc[_0x36a132];return _0x47cdaf;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){var _0x5466f4=_0x33628d[_0xcf0c('0x20')]({'plain':!![]});var _0x39f5e0=_0xcf0c('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x39f5e0,'resourceId':_0x5466f4['id']}})[_0xcf0c('0x1f')](function(){return _0x33628d;});})[_0xcf0c('0x1f')](function(){_0x8c4978[_0xcf0c('0x14')](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x9b0174,_0x36c637){return function(_0x3b38d9){if(!_0x3b38d9){_0x9b0174['sendStatus'](0x194);}return _0x3b38d9;};}function handleError(_0x1d9501,_0x1ce8d4){_0x1ce8d4=_0x1ce8d4||0x1f4;return function(_0x2bd2e3){logger[_0xcf0c('0x22')](_0x2bd2e3['stack']);if(_0x2bd2e3['name']){delete _0x2bd2e3['name'];}_0x1d9501['status'](_0x1ce8d4)[_0xcf0c('0x23')](_0x2bd2e3);};}exports[_0xcf0c('0x24')]=function(_0x3bdfd0,_0x34db17){var _0x3da4df={},_0x3fa73f={},_0x358e43={'count':0x0,'rows':[]};var _0x249d54=_[_0xcf0c('0x25')](db['VoiceChanSpy'][_0xcf0c('0x26')],function(_0x4f5ee2){return{'name':_0x4f5ee2[_0xcf0c('0x27')],'type':_0x4f5ee2[_0xcf0c('0x28')][_0xcf0c('0x29')]};});_0x3fa73f['model']=_['map'](_0x249d54,_0xcf0c('0x2a'));_0x3fa73f['query']=_[_0xcf0c('0x2b')](_0x3bdfd0[_0xcf0c('0x2c')]);_0x3fa73f[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],_0x3fa73f['query']);_0x3da4df[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x3bdfd0['query'][_0xcf0c('0x31')]));_0x3da4df[_0xcf0c('0x30')]=_0x3da4df[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x3da4df['attributes']:_0x3fa73f[_0xcf0c('0x2f')];if(!_0x3bdfd0[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x33'))){_0x3da4df[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x19')]);_0x3da4df[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x3bdfd0['query'][_0xcf0c('0x17')]);}_0x3da4df['order']=qs[_0xcf0c('0x34')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x3da4df[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x3bdfd0['query'],_0x3fa73f[_0xcf0c('0x2d')]),_0x249d54);if(_0x3bdfd0['query'][_0xcf0c('0x36')]){_0x3da4df[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x3da4df[_0xcf0c('0x35')],{'$or':_[_0xcf0c('0x25')](_0x249d54,function(_0x532b2a){if(_0x532b2a[_0xcf0c('0x28')]!==_0xcf0c('0x38')){var _0xc1d73e={};_0xc1d73e[_0x532b2a[_0xcf0c('0x2a')]]={'$like':'%'+_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0xc1d73e;}})});}_0x3da4df=_[_0xcf0c('0x37')]({},_0x3da4df,_0x3bdfd0[_0xcf0c('0x39')]);var _0x12b43f={'where':_0x3da4df[_0xcf0c('0x35')]};return db[_0xcf0c('0x3a')]['count'](_0x12b43f)['then'](function(_0xf39dea){_0x358e43[_0xcf0c('0x18')]=_0xf39dea;if(_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x3da4df[_0xcf0c('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3da4df);})[_0xcf0c('0x1f')](function(_0x24f4bd){_0x358e43[_0xcf0c('0x3d')]=_0x24f4bd;return _0x358e43;})['then'](respondWithFilteredResult(_0x34db17,_0x3da4df))[_0xcf0c('0x3e')](handleError(_0x34db17,null));};exports[_0xcf0c('0x3f')]=function(_0x2c8fa2,_0x1e688e){var _0x53af37={'raw':![],'where':{'id':_0x2c8fa2['params']['id']}},_0x681778={};_0x681778[_0xcf0c('0x2f')]=_['keys'](db[_0xcf0c('0x3a')]['rawAttributes']);_0x681778[_0xcf0c('0x2c')]=_[_0xcf0c('0x2b')](_0x2c8fa2['query']);_0x681778['filters']=_['intersection'](_0x681778[_0xcf0c('0x2f')],_0x681778[_0xcf0c('0x2c')]);_0x53af37[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x681778[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x31')]));_0x53af37[_0xcf0c('0x30')]=_0x53af37[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x53af37[_0xcf0c('0x30')]:_0x681778['model'];if(_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x53af37[_0xcf0c('0x3c')]=[{'all':!![]}];}_0x53af37=_[_0xcf0c('0x37')]({},_0x53af37,_0x2c8fa2[_0xcf0c('0x39')]);return db['VoiceChanSpy']['find'](_0x53af37)[_0xcf0c('0x1f')](handleEntityNotFound(_0x1e688e,null))[_0xcf0c('0x1f')](respondWithResult(_0x1e688e,null))['catch'](handleError(_0x1e688e,null));};exports[_0xcf0c('0x40')]=function(_0x1f9728,_0x87e6d4){return db[_0xcf0c('0x3a')][_0xcf0c('0x40')](_0x1f9728[_0xcf0c('0x41')],{})[_0xcf0c('0x1f')](function(_0xe9f843){var _0x2fca4a=_0x1f9728[_0xcf0c('0x42')][_0xcf0c('0x20')]({'plain':!![]});if(!_0x2fca4a)throw new Error(_0xcf0c('0x43'));if(_0x2fca4a[_0xcf0c('0x44')]===_0xcf0c('0x42')){var _0x11558c=_0xe9f843[_0xcf0c('0x20')]({'plain':!![]});var _0x5563be=_0xcf0c('0x21');return db['UserProfileSection'][_0xcf0c('0x45')]({'where':{'name':_0x5563be,'userProfileId':_0x2fca4a[_0xcf0c('0x46')]},'raw':!![]})[_0xcf0c('0x1f')](function(_0x5103ff){if(_0x5103ff&&_0x5103ff[_0xcf0c('0x47')]===0x0){return db[_0xcf0c('0x48')][_0xcf0c('0x40')]({'name':_0x11558c[_0xcf0c('0x2a')],'resourceId':_0x11558c['id'],'type':_0x5103ff[_0xcf0c('0x2a')],'sectionId':_0x5103ff['id']},{})[_0xcf0c('0x1f')](function(){return _0xe9f843;});}else{return _0xe9f843;}})['catch'](function(_0x20b133){logger['error'](_0xcf0c('0x49'),_0x20b133);throw _0x20b133;});}return _0xe9f843;})[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,0xc9))[_0xcf0c('0x3e')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x1e')]=function(_0x543d75,_0x19782d){if(_0x543d75[_0xcf0c('0x41')]['id']){delete _0x543d75[_0xcf0c('0x41')]['id'];}return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x543d75[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x19782d,null))['then'](saveUpdates(_0x543d75[_0xcf0c('0x41')],null))[_0xcf0c('0x1f')](respondWithResult(_0x19782d,null))[_0xcf0c('0x3e')](handleError(_0x19782d,null));};exports[_0xcf0c('0x4b')]=function(_0x3f9edd,_0x53a2c8){return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x3f9edd[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x53a2c8,null))[_0xcf0c('0x1f')](removeEntity(_0x53a2c8,null))['catch'](handleError(_0x53a2c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index efbf6ad..055b801 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 _0xe084=['models','define','voice_chanspy','bulkCreate','VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','format','system','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports'];(function(_0x34a988,_0x53a955){var _0x47cc33=function(_0x43bc37){while(--_0x43bc37){_0x34a988['push'](_0x34a988['shift']());}};_0x47cc33(++_0x53a955);}(_0xe084,0x9a));var _0x4e08=function(_0x447b93,_0x190bbb){_0x447b93=_0x447b93-0x0;var _0x31acf5=_0xe084[_0x447b93];return _0x31acf5;};'use strict';var _=require('lodash');var util=require(_0x4e08('0x0'));var BPromise=require(_0x4e08('0x1'));var attributes=require(_0x4e08('0x2'));var getUserApplications=function(_0x591c26,_0x297370,_0xc5e2b0){var _0x111b1a=0x1;var _0x681383=[];var _0x2fae05={'context':_0x297370['context']||_0x4e08('0x3'),'exten':util[_0x4e08('0x4')]('%s%s',_0x591c26['prefix'],_0xc5e2b0),'type':_0x4e08('0x5'),'isApp':![],'ChanSpyId':_0x591c26['id'],'UserId':_0x297370['id']};_0x681383['push'](_['merge']({'app':_0x4e08('0x6'),'appdata':util[_0x4e08('0x4')](_0x4e08('0x7'),_0x4e08('0x8')),'priority':_0x111b1a++},_0x2fae05));if(_0x591c26[_0x4e08('0x9')]){_0x681383['push'](_[_0x4e08('0xa')]({'app':_0x4e08('0xb'),'appdata':util['format'](_0x4e08('0xc'),_0x591c26[_0x4e08('0xd')]),'priority':_0x111b1a++},_0x2fae05));}if(_0x591c26[_0x4e08('0xe')]){_0x681383[_0x4e08('0xf')](_[_0x4e08('0xa')]({'app':_0x4e08('0x10'),'appdata':_0x591c26['password'],'priority':_0x111b1a++},_0x2fae05));}_0x681383[_0x4e08('0xf')](_[_0x4e08('0xa')]({'app':_0x4e08('0x11'),'appdata':util[_0x4e08('0x4')](_0x4e08('0x12'),_0x297370[_0x4e08('0x13')],_0x591c26['options']?_0x591c26[_0x4e08('0x14')][_0x4e08('0x15')](''):''),'priority':_0x111b1a++},_0x2fae05));if(_0x591c26[_0x4e08('0x9')]){_0x681383[_0x4e08('0xf')](_[_0x4e08('0xa')]({'app':_0x4e08('0x16'),'priority':_0x111b1a++},_0x2fae05));}return _0x681383;};var getChanSpyApplications=function(_0x1fa6dd,_0x398397){var _0x468b1e=[];for(var _0x2cc112=0x0,_0x2325bc=0x1;_0x2cc112<_0x398397[_0x4e08('0x17')];_0x2cc112++,_0x2325bc=0x1){_0x468b1e=_0x468b1e[_0x4e08('0x18')](getUserApplications(_0x1fa6dd,_0x398397[_0x2cc112],_0x398397[_0x2cc112][_0x4e08('0x19')]));if(_0x398397[_0x2cc112]['internal']!=_0x398397[_0x2cc112]['name']){_0x468b1e=_0x468b1e[_0x4e08('0x18')](getUserApplications(_0x1fa6dd,_0x398397[_0x2cc112],_0x398397[_0x2cc112][_0x4e08('0x13')]));}}return _0x468b1e;};var getChanSpyPromise=function(_0x1cea31,_0x2c5a21){return new BPromise(function(_0x55fdeb,_0x4014a5){return _0x1cea31[_0x4e08('0x1a')]['findAll']({'attributes':['id',_0x4e08('0x13'),_0x4e08('0x19')],'where':{'role':_0x4e08('0x1b'),'chanspy':!![]},'raw':!![]})[_0x4e08('0x1c')](function(_0x2581c0){if(_0x2581c0){return _0x55fdeb(getChanSpyApplications(_0x2c5a21,_0x2581c0));}return _0x55fdeb([]);})[_0x4e08('0x1d')](function(_0x29f448){_0x4014a5(_0x29f448);});});};module[_0x4e08('0x1e')]=function(_0x1c5b5d,_0x3e6b93){var _0x360c2e=_0x1c5b5d[_0x4e08('0x1f')];return _0x1c5b5d[_0x4e08('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x4e08('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15df0e,_0x9e30cf,_0x58aa3e){return getChanSpyPromise(_0x360c2e,_0x15df0e)[_0x4e08('0x1c')](function(_0x2877db){if(_0x2877db&&_0x2877db[_0x4e08('0x17')]){return _0x360c2e['VoiceExtension'][_0x4e08('0x22')](_0x2877db);}})[_0x4e08('0x1c')](function(){_0x58aa3e();})[_0x4e08('0x1d')](function(_0x5e8e23){_0x58aa3e(_0x5e8e23);});},'afterUpdate':function(_0x80e601,_0x68bcf3,_0x168067){return _0x360c2e[_0x4e08('0x23')][_0x4e08('0x24')]({'where':{'ChanSpyId':_0x80e601['id']}})[_0x4e08('0x1c')](function(){return getChanSpyPromise(_0x360c2e,_0x80e601);})[_0x4e08('0x1c')](function(_0x677a67){if(_0x677a67&&_0x677a67[_0x4e08('0x17')]){return _0x360c2e[_0x4e08('0x23')]['bulkCreate'](_0x677a67);}})[_0x4e08('0x1c')](function(){_0x168067();})[_0x4e08('0x1d')](function(_0x51071f){_0x168067(_0x51071f);});},'afterDestroy':function(_0x2feb6d,_0x18b73b,_0x197927){return _0x360c2e[_0x4e08('0x23')][_0x4e08('0x24')]({'where':{'ChanSpyId':_0x2feb6d['id']}})[_0x4e08('0x1c')](function(){_0x197927();})[_0x4e08('0x1d')](function(_0xf31f25){_0x197927(_0xf31f25);});}}});}; \ No newline at end of file +var _0x5633=['./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','push','merge','Set','format','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','then','VoiceChanSpy','voice_chanspy','catch','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird'];(function(_0x2e08da,_0x3df994){var _0x5a3283=function(_0x165829){while(--_0x165829){_0x2e08da['push'](_0x2e08da['shift']());}};_0x5a3283(++_0x3df994);}(_0x5633,0x1a1));var _0x3563=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5633[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x3563('0x0'));var util=require(_0x3563('0x1'));var BPromise=require(_0x3563('0x2'));var attributes=require(_0x3563('0x3'));var getUserApplications=function(_0x43abc9,_0x1456d9,_0x1cdfd4){var _0x23cc5d=0x1;var _0x337210=[];var _0x741d7d={'context':_0x1456d9[_0x3563('0x4')]||_0x3563('0x5'),'exten':util['format'](_0x3563('0x6'),_0x43abc9[_0x3563('0x7')],_0x1cdfd4),'type':'system','isApp':![],'ChanSpyId':_0x43abc9['id'],'UserId':_0x1456d9['id']};_0x337210[_0x3563('0x8')](_[_0x3563('0x9')]({'app':_0x3563('0xa'),'appdata':util[_0x3563('0xb')]('CDR(type)=%s',_0x3563('0xc')),'priority':_0x23cc5d++},_0x741d7d));if(_0x43abc9[_0x3563('0xd')]){_0x337210[_0x3563('0x8')](_['merge']({'app':'MixMonitor','appdata':util[_0x3563('0xb')](_0x3563('0xe'),_0x43abc9[_0x3563('0xf')]),'priority':_0x23cc5d++},_0x741d7d));}if(_0x43abc9[_0x3563('0x10')]){_0x337210['push'](_['merge']({'app':'Authenticate','appdata':_0x43abc9[_0x3563('0x11')],'priority':_0x23cc5d++},_0x741d7d));}_0x337210[_0x3563('0x8')](_[_0x3563('0x9')]({'app':_0x3563('0x12'),'appdata':util[_0x3563('0xb')](_0x3563('0x13'),_0x1456d9[_0x3563('0x14')],_0x43abc9[_0x3563('0x15')]?_0x43abc9[_0x3563('0x15')][_0x3563('0x16')](''):''),'priority':_0x23cc5d++},_0x741d7d));if(_0x43abc9[_0x3563('0xd')]){_0x337210['push'](_['merge']({'app':_0x3563('0x17'),'priority':_0x23cc5d++},_0x741d7d));}return _0x337210;};var getChanSpyApplications=function(_0x5b3b7c,_0x30105f){var _0x576c50=[];for(var _0x526c6a=0x0,_0x4e0e03=0x1;_0x526c6a<_0x30105f[_0x3563('0x18')];_0x526c6a++,_0x4e0e03=0x1){_0x576c50=_0x576c50[_0x3563('0x19')](getUserApplications(_0x5b3b7c,_0x30105f[_0x526c6a],_0x30105f[_0x526c6a]['internal']));if(_0x30105f[_0x526c6a][_0x3563('0x1a')]!=_0x30105f[_0x526c6a][_0x3563('0x14')]){_0x576c50=_0x576c50['concat'](getUserApplications(_0x5b3b7c,_0x30105f[_0x526c6a],_0x30105f[_0x526c6a][_0x3563('0x14')]));}}return _0x576c50;};var getChanSpyPromise=function(_0x231b02,_0x465fc2){return new BPromise(function(_0x2b132f,_0x4d3b98){return _0x231b02['User']['findAll']({'attributes':['id',_0x3563('0x14'),_0x3563('0x1a')],'where':{'role':_0x3563('0x1b'),'chanspy':!![]},'raw':!![]})[_0x3563('0x1c')](function(_0x42520d){if(_0x42520d){return _0x2b132f(getChanSpyApplications(_0x465fc2,_0x42520d));}return _0x2b132f([]);})['catch'](function(_0x37b1dd){_0x4d3b98(_0x37b1dd);});});};module['exports']=function(_0x5b5d55,_0x503a65){var _0x433b5c=_0x5b5d55['models'];return _0x5b5d55['define'](_0x3563('0x1d'),attributes,{'tableName':_0x3563('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30c1d7,_0x3c38ae,_0x30eee2){return getChanSpyPromise(_0x433b5c,_0x30c1d7)['then'](function(_0x28dcfc){if(_0x28dcfc&&_0x28dcfc[_0x3563('0x18')]){return _0x433b5c['VoiceExtension']['bulkCreate'](_0x28dcfc);}})['then'](function(){_0x30eee2();})[_0x3563('0x1f')](function(_0x19ad85){_0x30eee2(_0x19ad85);});},'afterUpdate':function(_0x30a01e,_0x5722b3,_0x4166a0){return _0x433b5c[_0x3563('0x20')][_0x3563('0x21')]({'where':{'ChanSpyId':_0x30a01e['id']}})[_0x3563('0x1c')](function(){return getChanSpyPromise(_0x433b5c,_0x30a01e);})[_0x3563('0x1c')](function(_0x2a377e){if(_0x2a377e&&_0x2a377e[_0x3563('0x18')]){return _0x433b5c[_0x3563('0x20')][_0x3563('0x22')](_0x2a377e);}})[_0x3563('0x1c')](function(){_0x4166a0();})[_0x3563('0x1f')](function(_0x30e21f){_0x4166a0(_0x30e21f);});},'afterDestroy':function(_0x10cf8e,_0x20a566,_0x423cad){return _0x433b5c[_0x3563('0x20')][_0x3563('0x21')]({'where':{'ChanSpyId':_0x10cf8e['id']}})[_0x3563('0x1c')](function(){_0x423cad();})['catch'](function(_0x19b5d9){_0x423cad(_0x19b5d9);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ff9526b..8dff6d4 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1b3eae,_0x109999){_0x1b3eae=_0x1b3eae-0x0;var _0x334dbb=_0x6f7a[_0x1b3eae];return _0x334dbb;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file +var _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x2bc6,0x163));var _0x62bc=function(_0x29eaaf,_0x18cc33){_0x29eaaf=_0x29eaaf-0x0;var _0xd350fc=_0x2bc6[_0x29eaaf];return _0xd350fc;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6e4459e..c8d0a84 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 _0x7bd1=['isAuthenticated','index','show','post','create','put','update','/:id','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x458f49,_0x1a1af1){var _0x36e8c9=function(_0x1273cb){while(--_0x1273cb){_0x458f49['push'](_0x458f49['shift']());}};_0x36e8c9(++_0x1a1af1);}(_0x7bd1,0x1e5));var _0x17bd=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0x7bd1[_0x1e0c0e];return _0x53fecc;};'use strict';var multer=require(_0x17bd('0x0'));var util=require(_0x17bd('0x1'));var path=require(_0x17bd('0x2'));var timeout=require('connect-timeout');var express=require(_0x17bd('0x3'));var router=express[_0x17bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x17bd('0x6'));var controller=require('./voiceContext.controller');router[_0x17bd('0x7')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0x9')]);router['get']('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xa')]);router[_0x17bd('0xb')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0xc')]);router[_0x17bd('0xd')]('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xe')]);router['delete'](_0x17bd('0xf'),auth[_0x17bd('0x8')](),controller[_0x17bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc6c1=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index'];(function(_0x107d8b,_0x249159){var _0x3983ac=function(_0x4d2449){while(--_0x4d2449){_0x107d8b['push'](_0x107d8b['shift']());}};_0x3983ac(++_0x249159);}(_0xc6c1,0xdc));var _0x1c6c=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0xc6c1[_0x3c04d7];return _0x2fb24;};'use strict';var multer=require(_0x1c6c('0x0'));var util=require(_0x1c6c('0x1'));var path=require(_0x1c6c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c6c('0x3'));var router=express[_0x1c6c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c6c('0x5'));var interaction=require(_0x1c6c('0x6'));var config=require(_0x1c6c('0x7'));var controller=require(_0x1c6c('0x8'));router[_0x1c6c('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c6c('0xa')]);router[_0x1c6c('0x9')](_0x1c6c('0xb'),auth['isAuthenticated'](),controller[_0x1c6c('0xc')]);router[_0x1c6c('0xd')]('/',auth[_0x1c6c('0xe')](),controller[_0x1c6c('0xf')]);router[_0x1c6c('0x10')](_0x1c6c('0xb'),auth['isAuthenticated'](),controller[_0x1c6c('0x11')]);router[_0x1c6c('0x12')](_0x1c6c('0xb'),auth[_0x1c6c('0xe')](),controller[_0x1c6c('0x13')]);module[_0x1c6c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 51b5ad3..2c44040 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 _0xeb0b=['name','STRING','exports'];(function(_0x36e059,_0x19ee27){var _0x52ee13=function(_0x3dbfb1){while(--_0x3dbfb1){_0x36e059['push'](_0x36e059['shift']());}};_0x52ee13(++_0x19ee27);}(_0xeb0b,0x12b));var _0xbeb0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeb0b[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xbeb0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbeb0('0x1')},'description':{'type':Sequelize[_0xbeb0('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5991=['name','BOOLEAN','sequelize'];(function(_0x212e58,_0x498378){var _0x4f42e0=function(_0x2b17e1){while(--_0x2b17e1){_0x212e58['push'](_0x212e58['shift']());}};_0x4f42e0(++_0x498378);}(_0x5991,0x1ee));var _0x1599=function(_0x488df7,_0x5b70f3){_0x488df7=_0x488df7-0x0;var _0x664cd7=_0x5991[_0x488df7];return _0x664cd7;};'use strict';var Sequelize=require(_0x1599('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1599('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1599('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c0972ad..d0a2be4 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 _0x6267=['sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','count','includeAll','rows','show','params','catch','create','body','findAll','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','readFileSync','root','utf8','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','json','offset','undefined','limit','status','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x2fbd82,_0x201f4d){var _0x56bf99=function(_0x3baf30){while(--_0x3baf30){_0x2fbd82['push'](_0x2fbd82['shift']());}};_0x56bf99(++_0x201f4d);}(_0x6267,0x8c));var _0x7626=function(_0x3c4754,_0x995bf7){_0x3c4754=_0x3c4754-0x0;var _0x527934=_0x6267[_0x3c4754];return _0x527934;};'use strict';var emlformat=require(_0x7626('0x0'));var rimraf=require(_0x7626('0x1'));var zipdir=require(_0x7626('0x2'));var jsonpatch=require(_0x7626('0x3'));var rp=require(_0x7626('0x4'));var moment=require(_0x7626('0x5'));var BPromise=require(_0x7626('0x6'));var Mustache=require(_0x7626('0x7'));var util=require('util');var path=require(_0x7626('0x8'));var sox=require(_0x7626('0x9'));var csv=require(_0x7626('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7626('0xb'));var _=require(_0x7626('0xc'));var squel=require('squel');var crypto=require(_0x7626('0xd'));var jsforce=require(_0x7626('0xe'));var deskjs=require(_0x7626('0xf'));var toCsv=require(_0x7626('0xa'));var querystring=require(_0x7626('0x10'));var Papa=require(_0x7626('0x11'));var Redis=require(_0x7626('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7626('0x13'));var as=require(_0x7626('0x14'));var hardwareService=require(_0x7626('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7626('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7626('0x17'))['db'];var jayson=require(_0x7626('0x18'));var client=jayson[_0x7626('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492066,_0x6280c6,_0x3fde8d,_0x41ee6b){return new BPromise(function(_0x2a617c,_0x21c7a8){var _0x20df0c=_0x41ee6b||client;return _0x20df0c['request'](_0x492066,_0x3fde8d)['then'](function(_0x29a1dc){logger[_0x7626('0x1a')](_0x7626('0x1b'),_0x6280c6,_0x7626('0x1c'));logger[_0x7626('0x1d')](_0x7626('0x1e'),_0x6280c6,_0x7626('0x1c'),JSON[_0x7626('0x1f')](_0x29a1dc));if(_0x29a1dc[_0x7626('0x20')]){if(_0x29a1dc[_0x7626('0x20')][_0x7626('0x21')]===0x1f4){logger[_0x7626('0x20')]('VoiceContext,\x20%s,\x20%s',_0x6280c6,_0x29a1dc[_0x7626('0x20')][_0x7626('0x22')]);return _0x21c7a8(_0x29a1dc[_0x7626('0x20')][_0x7626('0x22')]);}logger[_0x7626('0x20')](_0x7626('0x1b'),_0x6280c6,_0x29a1dc[_0x7626('0x20')][_0x7626('0x22')]);return _0x2a617c(_0x29a1dc[_0x7626('0x20')]['message']);}else{logger[_0x7626('0x1a')](_0x7626('0x1b'),_0x6280c6,_0x7626('0x1c'));_0x2a617c(_0x29a1dc[_0x7626('0x23')][_0x7626('0x22')]);}})['catch'](function(_0x4bf821){logger[_0x7626('0x20')](_0x7626('0x1b'),_0x6280c6,_0x4bf821);_0x21c7a8(_0x4bf821);});});}function respondWithStatusCode(_0x4f82c7,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x25b3fb){if(_0x25b3fb){return _0x4f82c7['sendStatus'](_0x2268da);}return _0x4f82c7['status'](_0x2268da)[_0x7626('0x24')]();};}function respondWithResult(_0x4bfdbf,_0x451f00){_0x451f00=_0x451f00||0xc8;return function(_0x5c5f6d){if(_0x5c5f6d){return _0x4bfdbf['status'](_0x451f00)[_0x7626('0x25')](_0x5c5f6d);}};}function respondWithFilteredResult(_0xf04446,_0x57393a){return function(_0x556f46){if(_0x556f46){var _0x2c74ec=typeof _0x57393a[_0x7626('0x26')]===_0x7626('0x27')&&typeof _0x57393a[_0x7626('0x28')]===_0x7626('0x27');var _0x5c8eba=_0x556f46['count'];var _0xfef3cb=_0x2c74ec?0x0:_0x57393a[_0x7626('0x26')];var _0x3b2ef5=_0x2c74ec?_0x556f46['count']:_0x57393a[_0x7626('0x26')]+_0x57393a[_0x7626('0x28')];var _0x3d02e6;if(_0x3b2ef5>=_0x5c8eba){_0x3b2ef5=_0x5c8eba;_0x3d02e6=0xc8;}else{_0x3d02e6=0xce;}_0xf04446[_0x7626('0x29')](_0x3d02e6);return _0xf04446['set']('Content-Range',_0xfef3cb+'-'+_0x3b2ef5+'/'+_0x5c8eba)['json'](_0x556f46);}return null;};}function patchUpdates(_0x52d2a9){return function(_0xd270ac){try{jsonpatch[_0x7626('0x2a')](_0xd270ac,_0x52d2a9,!![]);}catch(_0x380ea7){return BPromise[_0x7626('0x2b')](_0x380ea7);}return _0xd270ac[_0x7626('0x2c')]();};}function saveUpdates(_0x55afc6,_0x31175f){return function(_0x12c4bc){if(_0x12c4bc){return _0x12c4bc[_0x7626('0x2d')](_0x55afc6)['then'](function(_0x20f14){return _0x20f14;});}return null;};}function removeEntity(_0x3b1aa5,_0x52b110){return function(_0x3e9b98){if(_0x3e9b98){return _0x3e9b98[_0x7626('0x2e')]()[_0x7626('0x2f')](function(){var _0x1f308d=_0x3e9b98[_0x7626('0x30')]({'plain':!![]});var _0x2108a6=_0x7626('0x31');return db[_0x7626('0x32')][_0x7626('0x2e')]({'where':{'type':_0x2108a6,'resourceId':_0x1f308d['id']}})['then'](function(){return _0x3e9b98;});})[_0x7626('0x2f')](function(){_0x3b1aa5[_0x7626('0x29')](0xcc)[_0x7626('0x24')]();});}};}function handleEntityNotFound(_0x29d89d,_0x4d0421){return function(_0x1e9702){if(!_0x1e9702){_0x29d89d[_0x7626('0x33')](0x194);}return _0x1e9702;};}function handleError(_0x16818c,_0xd0dc32){_0xd0dc32=_0xd0dc32||0x1f4;return function(_0x1385a1){logger[_0x7626('0x20')](_0x1385a1[_0x7626('0x34')]);if(_0x1385a1['name']){delete _0x1385a1[_0x7626('0x35')];}_0x16818c[_0x7626('0x29')](_0xd0dc32)['send'](_0x1385a1);};}exports[_0x7626('0x36')]=function(_0x2a308e,_0x4dbbf4){var _0x507264={},_0x14f6cb={},_0x430a6f={'count':0x0,'rows':[]};var _0x561e5d=_['map'](db['VoiceContext'][_0x7626('0x37')],function(_0x4176f1){return{'name':_0x4176f1[_0x7626('0x38')],'type':_0x4176f1[_0x7626('0x39')][_0x7626('0x3a')]};});_0x14f6cb[_0x7626('0x3b')]=_[_0x7626('0x3c')](_0x561e5d,_0x7626('0x35'));_0x14f6cb[_0x7626('0x3d')]=_[_0x7626('0x3e')](_0x2a308e[_0x7626('0x3d')]);_0x14f6cb[_0x7626('0x3f')]=_[_0x7626('0x40')](_0x14f6cb[_0x7626('0x3b')],_0x14f6cb['query']);_0x507264[_0x7626('0x41')]=_[_0x7626('0x40')](_0x14f6cb[_0x7626('0x3b')],qs['fields'](_0x2a308e[_0x7626('0x3d')][_0x7626('0x42')]));_0x507264[_0x7626('0x41')]=_0x507264[_0x7626('0x41')][_0x7626('0x43')]?_0x507264[_0x7626('0x41')]:_0x14f6cb[_0x7626('0x3b')];if(!_0x2a308e['query']['hasOwnProperty'](_0x7626('0x44'))){_0x507264[_0x7626('0x28')]=qs[_0x7626('0x28')](_0x2a308e[_0x7626('0x3d')][_0x7626('0x28')]);_0x507264[_0x7626('0x26')]=qs[_0x7626('0x26')](_0x2a308e['query']['offset']);}_0x507264[_0x7626('0x45')]=qs[_0x7626('0x46')](_0x2a308e['query'][_0x7626('0x46')]);_0x507264[_0x7626('0x47')]=qs['filters'](_[_0x7626('0x48')](_0x2a308e[_0x7626('0x3d')],_0x14f6cb['filters']),_0x561e5d);if(_0x2a308e[_0x7626('0x3d')][_0x7626('0x49')]){_0x507264['where']=_[_0x7626('0x4a')](_0x507264[_0x7626('0x47')],{'$or':_[_0x7626('0x3c')](_0x561e5d,function(_0x47a40c){if(_0x47a40c[_0x7626('0x39')]!==_0x7626('0x4b')){var _0x4da8f7={};_0x4da8f7[_0x47a40c[_0x7626('0x35')]]={'$like':'%'+_0x2a308e['query'][_0x7626('0x49')]+'%'};return _0x4da8f7;}})});}_0x507264=_['merge']({},_0x507264,_0x2a308e[_0x7626('0x4c')]);var _0x1e5355={'where':_0x507264['where']};return db[_0x7626('0x4d')][_0x7626('0x4e')](_0x1e5355)['then'](function(_0x4c66d9){_0x430a6f[_0x7626('0x4e')]=_0x4c66d9;if(_0x2a308e['query'][_0x7626('0x4f')]){_0x507264['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x507264);})['then'](function(_0x383db3){_0x430a6f[_0x7626('0x50')]=_0x383db3;return _0x430a6f;})[_0x7626('0x2f')](respondWithFilteredResult(_0x4dbbf4,_0x507264))['catch'](handleError(_0x4dbbf4,null));};exports[_0x7626('0x51')]=function(_0x4bb7dc,_0x755e93){var _0xe134e9={'raw':![],'where':{'id':_0x4bb7dc[_0x7626('0x52')]['id']}},_0xb9bdec={};_0xb9bdec['model']=_['keys'](db['VoiceContext'][_0x7626('0x37')]);_0xb9bdec['query']=_[_0x7626('0x3e')](_0x4bb7dc[_0x7626('0x3d')]);_0xb9bdec['filters']=_['intersection'](_0xb9bdec['model'],_0xb9bdec[_0x7626('0x3d')]);_0xe134e9[_0x7626('0x41')]=_['intersection'](_0xb9bdec['model'],qs[_0x7626('0x42')](_0x4bb7dc[_0x7626('0x3d')][_0x7626('0x42')]));_0xe134e9[_0x7626('0x41')]=_0xe134e9[_0x7626('0x41')][_0x7626('0x43')]?_0xe134e9[_0x7626('0x41')]:_0xb9bdec[_0x7626('0x3b')];if(_0x4bb7dc['query'][_0x7626('0x4f')]){_0xe134e9['include']=[{'all':!![]}];}_0xe134e9=_[_0x7626('0x4a')]({},_0xe134e9,_0x4bb7dc[_0x7626('0x4c')]);return db[_0x7626('0x4d')]['find'](_0xe134e9)[_0x7626('0x2f')](handleEntityNotFound(_0x755e93,null))['then'](respondWithResult(_0x755e93,null))[_0x7626('0x53')](handleError(_0x755e93,null));};exports[_0x7626('0x54')]=function(_0x3ed5d9,_0x3c064b,_0x49ac2a){var _0x21ebdf;return db[_0x7626('0x4d')][_0x7626('0x54')](_0x3ed5d9[_0x7626('0x55')],{'raw':!![]})[_0x7626('0x2f')](function(_0x10a79e){_0x21ebdf=_0x10a79e;return db[_0x7626('0x4d')][_0x7626('0x56')]({'raw':!![]});})['then'](function(_0x272000){var _0x229e31=fs['readFileSync'](path[_0x7626('0x57')](config['root'],_0x7626('0x58')),'utf8');var _0x581b82=ejs[_0x7626('0x59')](_0x229e31,{'contexts':_0x272000||[]});fs[_0x7626('0x5a')](_0x7626('0x5b'),_0x581b82);})[_0x7626('0x2f')](function(){return respondWithRpcPromise(_0x7626('0x5c'),_0x7626('0x54'),{'module':'chan_sip.so'});})[_0x7626('0x2f')](function(){var _0x493b35=_0x3ed5d9['user'][_0x7626('0x30')]({'plain':!![]});if(!_0x493b35)throw new Error(_0x7626('0x5d'));if(_0x493b35[_0x7626('0x5e')]===_0x7626('0x5f')){var _0x121592=_0x21ebdf[_0x7626('0x30')]({'plain':!![]});return db[_0x7626('0x60')]['find']({'where':{'name':_0x7626('0x31'),'userProfileId':_0x493b35[_0x7626('0x61')]},'raw':!![]})[_0x7626('0x2f')](function(_0x206ea9){if(_0x206ea9&&_0x206ea9[_0x7626('0x62')]===0x0){return db[_0x7626('0x32')][_0x7626('0x54')]({'name':_0x121592[_0x7626('0x35')],'resourceId':_0x121592['id'],'type':_0x206ea9[_0x7626('0x35')],'sectionId':_0x206ea9['id']},{})[_0x7626('0x2f')](function(){return _0x21ebdf;});}else{return _0x21ebdf;}})[_0x7626('0x53')](function(_0x1155ed){logger[_0x7626('0x20')](_0x7626('0x63'),_0x1155ed);throw _0x1155ed;});}return _0x21ebdf;})[_0x7626('0x2f')](respondWithResult(_0x3c064b,0xc9))['catch'](handleError(_0x3c064b,null));};exports[_0x7626('0x2d')]=function(_0x19d351,_0x155b5b,_0x1b65e9){var _0x5bc90f;return db[_0x7626('0x4d')][_0x7626('0x64')]({'where':{'id':_0x19d351[_0x7626('0x52')]['id']}})[_0x7626('0x2f')](handleEntityNotFound(_0x155b5b,null))['then'](saveUpdates(_0x19d351[_0x7626('0x55')],null))[_0x7626('0x2f')](function(_0x1c8428){if(_0x1c8428){_0x5bc90f=_0x1c8428;return db[_0x7626('0x4d')][_0x7626('0x56')]({'raw':!![]});}})[_0x7626('0x2f')](function(_0xd87e03){var _0x169c75=fs[_0x7626('0x65')](path[_0x7626('0x57')](config[_0x7626('0x66')],_0x7626('0x58')),_0x7626('0x67'));var _0x3d68f4=ejs[_0x7626('0x59')](_0x169c75,{'contexts':_0xd87e03||[]});fs[_0x7626('0x5a')](_0x7626('0x5b'),_0x3d68f4);})[_0x7626('0x2f')](function(){return respondWithRpcPromise(_0x7626('0x5c'),'update',{'module':_0x7626('0x68')});})[_0x7626('0x2f')](function(){return _0x5bc90f;})[_0x7626('0x2f')](respondWithResult(_0x155b5b,null))[_0x7626('0x53')](handleError(_0x155b5b,null));};exports[_0x7626('0x2e')]=function(_0x4332b3,_0x188181,_0x151723){var _0x173070;return db['VoiceContext'][_0x7626('0x64')]({'where':{'id':_0x4332b3[_0x7626('0x52')]['id']}})[_0x7626('0x2f')](handleEntityNotFound(_0x188181,null))[_0x7626('0x2f')](removeEntity(_0x188181,null))[_0x7626('0x2f')](function(){return db[_0x7626('0x4d')][_0x7626('0x56')]({'raw':!![]});})[_0x7626('0x2f')](function(_0x59c303){var _0x94c9c4=fs['readFileSync'](path[_0x7626('0x57')](config['root'],_0x7626('0x58')),'utf8');var _0x3ca904=ejs[_0x7626('0x59')](_0x94c9c4,{'contexts':_0x59c303});fs[_0x7626('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ca904);return respondWithRpcPromise(_0x7626('0x5c'),_0x7626('0x2e'),{'module':_0x7626('0x68')});})[_0x7626('0x53')](handleError(_0x188181,null));}; \ No newline at end of file +var _0xa1d6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','get','UserProfileResource','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','options','VoiceContext','includeAll','findAll','rows','show','params','fields','include','create','body','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','UserProfileSection','find','Contexts','userProfileId','autoAssociation','readFileSync','join','root','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x370a14,_0x529186){var _0x205540=function(_0x476ce3){while(--_0x476ce3){_0x370a14['push'](_0x370a14['shift']());}};_0x205540(++_0x529186);}(_0xa1d6,0xc7));var _0x6a1d=function(_0x373f5b,_0xd7d526){_0x373f5b=_0x373f5b-0x0;var _0x253d14=_0xa1d6[_0x373f5b];return _0x253d14;};'use strict';var emlformat=require(_0x6a1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a1d('0x1'));var jsonpatch=require(_0x6a1d('0x2'));var rp=require(_0x6a1d('0x3'));var moment=require('moment');var BPromise=require(_0x6a1d('0x4'));var Mustache=require(_0x6a1d('0x5'));var util=require(_0x6a1d('0x6'));var path=require('path');var sox=require(_0x6a1d('0x7'));var csv=require(_0x6a1d('0x8'));var ejs=require(_0x6a1d('0x9'));var fs=require('fs');var fs_extra=require(_0x6a1d('0xa'));var _=require(_0x6a1d('0xb'));var squel=require(_0x6a1d('0xc'));var crypto=require(_0x6a1d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6a1d('0xe'));var toCsv=require(_0x6a1d('0x8'));var querystring=require(_0x6a1d('0xf'));var Papa=require('papaparse');var Redis=require(_0x6a1d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6a1d('0x11'));var as=require(_0x6a1d('0x12'));var hardwareService=require(_0x6a1d('0x13'));var logger=require(_0x6a1d('0x14'))(_0x6a1d('0x15'));var utils=require(_0x6a1d('0x16'));var config=require(_0x6a1d('0x17'));var licenseUtil=require(_0x6a1d('0x18'));var db=require(_0x6a1d('0x19'))['db'];var jayson=require(_0x6a1d('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ed463,_0x3ef480,_0xcbc7eb,_0x2c1ad7){return new BPromise(function(_0x2b1ac9,_0x4a6c2a){var _0x541a5b=_0x2c1ad7||client;return _0x541a5b[_0x6a1d('0x1b')](_0x1ed463,_0xcbc7eb)['then'](function(_0x176e38){logger[_0x6a1d('0x1c')](_0x6a1d('0x1d'),_0x3ef480,_0x6a1d('0x1e'));logger[_0x6a1d('0x1f')](_0x6a1d('0x20'),_0x3ef480,'request\x20sent',JSON[_0x6a1d('0x21')](_0x176e38));if(_0x176e38[_0x6a1d('0x22')]){if(_0x176e38[_0x6a1d('0x22')]['code']===0x1f4){logger[_0x6a1d('0x22')](_0x6a1d('0x1d'),_0x3ef480,_0x176e38[_0x6a1d('0x22')][_0x6a1d('0x23')]);return _0x4a6c2a(_0x176e38[_0x6a1d('0x22')][_0x6a1d('0x23')]);}logger[_0x6a1d('0x22')](_0x6a1d('0x1d'),_0x3ef480,_0x176e38[_0x6a1d('0x22')][_0x6a1d('0x23')]);return _0x2b1ac9(_0x176e38[_0x6a1d('0x22')][_0x6a1d('0x23')]);}else{logger[_0x6a1d('0x1c')](_0x6a1d('0x1d'),_0x3ef480,_0x6a1d('0x1e'));_0x2b1ac9(_0x176e38[_0x6a1d('0x24')][_0x6a1d('0x23')]);}})[_0x6a1d('0x25')](function(_0xd70036){logger[_0x6a1d('0x22')]('VoiceContext,\x20%s,\x20%s',_0x3ef480,_0xd70036);_0x4a6c2a(_0xd70036);});});}function respondWithStatusCode(_0x1557e8,_0x336144){_0x336144=_0x336144||0xcc;return function(_0x939cad){if(_0x939cad){return _0x1557e8['sendStatus'](_0x336144);}return _0x1557e8['status'](_0x336144)[_0x6a1d('0x26')]();};}function respondWithResult(_0x4341c9,_0x1369db){_0x1369db=_0x1369db||0xc8;return function(_0x5eb221){if(_0x5eb221){return _0x4341c9[_0x6a1d('0x27')](_0x1369db)['json'](_0x5eb221);}};}function respondWithFilteredResult(_0x5ea886,_0xc039fa){return function(_0x31ca6f){if(_0x31ca6f){var _0x347329=typeof _0xc039fa[_0x6a1d('0x28')]==='undefined'&&typeof _0xc039fa[_0x6a1d('0x29')]===_0x6a1d('0x2a');var _0x4834f9=_0x31ca6f[_0x6a1d('0x2b')];var _0xa97935=_0x347329?0x0:_0xc039fa[_0x6a1d('0x28')];var _0x1fbe71=_0x347329?_0x31ca6f[_0x6a1d('0x2b')]:_0xc039fa[_0x6a1d('0x28')]+_0xc039fa[_0x6a1d('0x29')];var _0x3060cf;if(_0x1fbe71>=_0x4834f9){_0x1fbe71=_0x4834f9;_0x3060cf=0xc8;}else{_0x3060cf=0xce;}_0x5ea886['status'](_0x3060cf);return _0x5ea886[_0x6a1d('0x2c')](_0x6a1d('0x2d'),_0xa97935+'-'+_0x1fbe71+'/'+_0x4834f9)[_0x6a1d('0x2e')](_0x31ca6f);}return null;};}function patchUpdates(_0x595d5c){return function(_0x5361f6){try{jsonpatch['apply'](_0x5361f6,_0x595d5c,!![]);}catch(_0x5ee078){return BPromise[_0x6a1d('0x2f')](_0x5ee078);}return _0x5361f6['save']();};}function saveUpdates(_0x38e41a,_0x348b9c){return function(_0x229779){if(_0x229779){return _0x229779[_0x6a1d('0x30')](_0x38e41a)[_0x6a1d('0x31')](function(_0x49b844){return _0x49b844;});}return null;};}function removeEntity(_0x45c6a2,_0x51799d){return function(_0x5e3084){if(_0x5e3084){return _0x5e3084['destroy']()['then'](function(){var _0x4787df=_0x5e3084[_0x6a1d('0x32')]({'plain':!![]});var _0x1ab474='Contexts';return db[_0x6a1d('0x33')][_0x6a1d('0x34')]({'where':{'type':_0x1ab474,'resourceId':_0x4787df['id']}})['then'](function(){return _0x5e3084;});})[_0x6a1d('0x31')](function(){_0x45c6a2[_0x6a1d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6141,_0x421ba0){return function(_0xc2d84b){if(!_0xc2d84b){_0x5b6141['sendStatus'](0x194);}return _0xc2d84b;};}function handleError(_0x3964b9,_0x3fe479){_0x3fe479=_0x3fe479||0x1f4;return function(_0x521f95){logger[_0x6a1d('0x22')](_0x521f95['stack']);if(_0x521f95[_0x6a1d('0x35')]){delete _0x521f95[_0x6a1d('0x35')];}_0x3964b9[_0x6a1d('0x27')](_0x3fe479)[_0x6a1d('0x36')](_0x521f95);};}exports['index']=function(_0x43efce,_0x5d8a44){var _0x3dcc46={},_0x44571c={},_0x3416e1={'count':0x0,'rows':[]};var _0x220c1d=_[_0x6a1d('0x37')](db['VoiceContext'][_0x6a1d('0x38')],function(_0x784248){return{'name':_0x784248[_0x6a1d('0x39')],'type':_0x784248[_0x6a1d('0x3a')][_0x6a1d('0x3b')]};});_0x44571c[_0x6a1d('0x3c')]=_[_0x6a1d('0x37')](_0x220c1d,_0x6a1d('0x35'));_0x44571c[_0x6a1d('0x3d')]=_[_0x6a1d('0x3e')](_0x43efce[_0x6a1d('0x3d')]);_0x44571c['filters']=_[_0x6a1d('0x3f')](_0x44571c[_0x6a1d('0x3c')],_0x44571c[_0x6a1d('0x3d')]);_0x3dcc46[_0x6a1d('0x40')]=_[_0x6a1d('0x3f')](_0x44571c[_0x6a1d('0x3c')],qs['fields'](_0x43efce['query']['fields']));_0x3dcc46[_0x6a1d('0x40')]=_0x3dcc46[_0x6a1d('0x40')][_0x6a1d('0x41')]?_0x3dcc46['attributes']:_0x44571c[_0x6a1d('0x3c')];if(!_0x43efce['query'][_0x6a1d('0x42')](_0x6a1d('0x43'))){_0x3dcc46[_0x6a1d('0x29')]=qs[_0x6a1d('0x29')](_0x43efce[_0x6a1d('0x3d')][_0x6a1d('0x29')]);_0x3dcc46['offset']=qs['offset'](_0x43efce['query'][_0x6a1d('0x28')]);}_0x3dcc46['order']=qs['sort'](_0x43efce[_0x6a1d('0x3d')][_0x6a1d('0x44')]);_0x3dcc46['where']=qs['filters'](_[_0x6a1d('0x45')](_0x43efce[_0x6a1d('0x3d')],_0x44571c[_0x6a1d('0x46')]),_0x220c1d);if(_0x43efce['query'][_0x6a1d('0x47')]){_0x3dcc46['where']=_[_0x6a1d('0x48')](_0x3dcc46[_0x6a1d('0x49')],{'$or':_['map'](_0x220c1d,function(_0xdb1d1a){if(_0xdb1d1a['type']!==_0x6a1d('0x4a')){var _0x36c18c={};_0x36c18c[_0xdb1d1a[_0x6a1d('0x35')]]={'$like':'%'+_0x43efce[_0x6a1d('0x3d')][_0x6a1d('0x47')]+'%'};return _0x36c18c;}})});}_0x3dcc46=_['merge']({},_0x3dcc46,_0x43efce[_0x6a1d('0x4b')]);var _0x3c6bf6={'where':_0x3dcc46[_0x6a1d('0x49')]};return db[_0x6a1d('0x4c')]['count'](_0x3c6bf6)[_0x6a1d('0x31')](function(_0x2ec1da){_0x3416e1[_0x6a1d('0x2b')]=_0x2ec1da;if(_0x43efce[_0x6a1d('0x3d')][_0x6a1d('0x4d')]){_0x3dcc46['include']=[{'all':!![]}];}return db[_0x6a1d('0x4c')][_0x6a1d('0x4e')](_0x3dcc46);})[_0x6a1d('0x31')](function(_0x5c09b3){_0x3416e1[_0x6a1d('0x4f')]=_0x5c09b3;return _0x3416e1;})[_0x6a1d('0x31')](respondWithFilteredResult(_0x5d8a44,_0x3dcc46))['catch'](handleError(_0x5d8a44,null));};exports[_0x6a1d('0x50')]=function(_0x57f236,_0x244803){var _0x5689db={'raw':![],'where':{'id':_0x57f236[_0x6a1d('0x51')]['id']}},_0x54236b={};_0x54236b['model']=_['keys'](db['VoiceContext'][_0x6a1d('0x38')]);_0x54236b[_0x6a1d('0x3d')]=_[_0x6a1d('0x3e')](_0x57f236[_0x6a1d('0x3d')]);_0x54236b[_0x6a1d('0x46')]=_[_0x6a1d('0x3f')](_0x54236b['model'],_0x54236b[_0x6a1d('0x3d')]);_0x5689db[_0x6a1d('0x40')]=_[_0x6a1d('0x3f')](_0x54236b[_0x6a1d('0x3c')],qs[_0x6a1d('0x52')](_0x57f236['query']['fields']));_0x5689db[_0x6a1d('0x40')]=_0x5689db['attributes'][_0x6a1d('0x41')]?_0x5689db['attributes']:_0x54236b[_0x6a1d('0x3c')];if(_0x57f236['query'][_0x6a1d('0x4d')]){_0x5689db[_0x6a1d('0x53')]=[{'all':!![]}];}_0x5689db=_[_0x6a1d('0x48')]({},_0x5689db,_0x57f236['options']);return db['VoiceContext']['find'](_0x5689db)[_0x6a1d('0x31')](handleEntityNotFound(_0x244803,null))['then'](respondWithResult(_0x244803,null))[_0x6a1d('0x25')](handleError(_0x244803,null));};exports[_0x6a1d('0x54')]=function(_0x534e14,_0x47728f,_0x2ce2d3){var _0x291b14;return db[_0x6a1d('0x4c')][_0x6a1d('0x54')](_0x534e14[_0x6a1d('0x55')],{'raw':!![]})[_0x6a1d('0x31')](function(_0x13b67f){_0x291b14=_0x13b67f;return db['VoiceContext'][_0x6a1d('0x4e')]({'raw':!![]});})[_0x6a1d('0x31')](function(_0x3dfe75){var _0x435672=fs['readFileSync'](path['join'](config['root'],_0x6a1d('0x56')),_0x6a1d('0x57'));var _0xd5a054=ejs[_0x6a1d('0x58')](_0x435672,{'contexts':_0x3dfe75||[]});fs[_0x6a1d('0x59')](_0x6a1d('0x5a'),_0xd5a054);})[_0x6a1d('0x31')](function(){return respondWithRpcPromise(_0x6a1d('0x5b'),_0x6a1d('0x54'),{'module':_0x6a1d('0x5c')});})['then'](function(){var _0x5e45ee=_0x534e14[_0x6a1d('0x5d')]['get']({'plain':!![]});if(!_0x5e45ee)throw new Error(_0x6a1d('0x5e'));if(_0x5e45ee['role']===_0x6a1d('0x5d')){var _0x2fd5e8=_0x291b14[_0x6a1d('0x32')]({'plain':!![]});return db[_0x6a1d('0x5f')][_0x6a1d('0x60')]({'where':{'name':_0x6a1d('0x61'),'userProfileId':_0x5e45ee[_0x6a1d('0x62')]},'raw':!![]})['then'](function(_0x276465){if(_0x276465&&_0x276465[_0x6a1d('0x63')]===0x0){return db[_0x6a1d('0x33')][_0x6a1d('0x54')]({'name':_0x2fd5e8['name'],'resourceId':_0x2fd5e8['id'],'type':_0x276465[_0x6a1d('0x35')],'sectionId':_0x276465['id']},{})[_0x6a1d('0x31')](function(){return _0x291b14;});}else{return _0x291b14;}})[_0x6a1d('0x25')](function(_0x30bf7b){logger[_0x6a1d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30bf7b);throw _0x30bf7b;});}return _0x291b14;})[_0x6a1d('0x31')](respondWithResult(_0x47728f,0xc9))[_0x6a1d('0x25')](handleError(_0x47728f,null));};exports['update']=function(_0x1a7c8d,_0x2dc287,_0x4110b3){var _0x6d5506;return db[_0x6a1d('0x4c')][_0x6a1d('0x60')]({'where':{'id':_0x1a7c8d[_0x6a1d('0x51')]['id']}})[_0x6a1d('0x31')](handleEntityNotFound(_0x2dc287,null))['then'](saveUpdates(_0x1a7c8d[_0x6a1d('0x55')],null))[_0x6a1d('0x31')](function(_0x1bc768){if(_0x1bc768){_0x6d5506=_0x1bc768;return db[_0x6a1d('0x4c')][_0x6a1d('0x4e')]({'raw':!![]});}})['then'](function(_0x474a44){var _0x220ff3=fs[_0x6a1d('0x64')](path[_0x6a1d('0x65')](config[_0x6a1d('0x66')],_0x6a1d('0x56')),_0x6a1d('0x57'));var _0x5bbd4a=ejs[_0x6a1d('0x58')](_0x220ff3,{'contexts':_0x474a44||[]});fs[_0x6a1d('0x59')](_0x6a1d('0x5a'),_0x5bbd4a);})[_0x6a1d('0x31')](function(){return respondWithRpcPromise(_0x6a1d('0x5b'),_0x6a1d('0x30'),{'module':'chan_sip.so'});})[_0x6a1d('0x31')](function(){return _0x6d5506;})[_0x6a1d('0x31')](respondWithResult(_0x2dc287,null))[_0x6a1d('0x25')](handleError(_0x2dc287,null));};exports[_0x6a1d('0x34')]=function(_0x40dfca,_0x96adf0,_0x1ccf0f){var _0x4beb22;return db[_0x6a1d('0x4c')][_0x6a1d('0x60')]({'where':{'id':_0x40dfca['params']['id']}})['then'](handleEntityNotFound(_0x96adf0,null))[_0x6a1d('0x31')](removeEntity(_0x96adf0,null))[_0x6a1d('0x31')](function(){return db[_0x6a1d('0x4c')][_0x6a1d('0x4e')]({'raw':!![]});})[_0x6a1d('0x31')](function(_0x437ce8){var _0x48bf44=fs[_0x6a1d('0x64')](path['join'](config[_0x6a1d('0x66')],_0x6a1d('0x56')),_0x6a1d('0x57'));var _0x5085cd=ejs['render'](_0x48bf44,{'contexts':_0x437ce8});fs[_0x6a1d('0x59')](_0x6a1d('0x5a'),_0x5085cd);return respondWithRpcPromise('Reload','destroy',{'module':_0x6a1d('0x5c')});})[_0x6a1d('0x25')](handleError(_0x96adf0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index de0ed15..326a5ca 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 _0xe5fe=['../../config/logger','api','request-promise','rimraf','./voiceContext.attributes','define','VoiceContext','lodash','util'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe5fe,0x6a));var _0xee5f=function(_0x225e96,_0x38c4e9){_0x225e96=_0x225e96-0x0;var _0x5ea9be=_0xe5fe[_0x225e96];return _0x5ea9be;};'use strict';var _=require(_0xee5f('0x0'));var util=require(_0xee5f('0x1'));var logger=require(_0xee5f('0x2'))(_0xee5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee5f('0x5'));var config=require('../../config/environment');var attributes=require(_0xee5f('0x6'));module['exports']=function(_0xa99bb9,_0x261f62){return _0xa99bb9[_0xee5f('0x7')](_0xee5f('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd217=['exports','define','lodash','../../config/logger','bluebird','path','rimraf','./voiceContext.attributes'];(function(_0x7516dd,_0x3bd17f){var _0x18a146=function(_0x10fcb8){while(--_0x10fcb8){_0x7516dd['push'](_0x7516dd['shift']());}};_0x18a146(++_0x3bd17f);}(_0xd217,0xb2));var _0x7d21=function(_0x465f34,_0x580a42){_0x465f34=_0x465f34-0x0;var _0x5b1a26=_0xd217[_0x465f34];return _0x5b1a26;};'use strict';var _=require(_0x7d21('0x0'));var util=require('util');var logger=require(_0x7d21('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d21('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d21('0x3'));var rimraf=require(_0x7d21('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d21('0x5'));module[_0x7d21('0x6')]=function(_0x509e26,_0x33c6b0){return _0x509e26[_0x7d21('0x7')]('VoiceContext',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 64514fc..22571d3 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 _0x1dcc=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x1be311,_0x37b4fe){var _0x518d9a=function(_0x2f4f29){while(--_0x2f4f29){_0x1be311['push'](_0x1be311['shift']());}};_0x518d9a(++_0x37b4fe);}(_0x1dcc,0x77));var _0xc1dc=function(_0xc7ab0e,_0x20e4e6){_0xc7ab0e=_0xc7ab0e-0x0;var _0x5b97d9=_0x1dcc[_0xc7ab0e];return _0x5b97d9;};'use strict';var _=require(_0xc1dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc1dc('0x1'));var rs=require(_0xc1dc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1dc('0x3'));var logger=require(_0xc1dc('0x4'))(_0xc1dc('0x5'));var config=require(_0xc1dc('0x6'));var jayson=require(_0xc1dc('0x7'));var client=jayson[_0xc1dc('0x8')][_0xc1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5867ea,_0x1a08cf,_0x5bc085){return new BPromise(function(_0x2544d4,_0x419ef4){return client[_0xc1dc('0xa')](_0x5867ea,_0x5bc085)[_0xc1dc('0xb')](function(_0x4e88d4){logger[_0xc1dc('0xc')](_0xc1dc('0xd'),_0x1a08cf,_0xc1dc('0xe'));logger['debug'](_0xc1dc('0xf'),_0x1a08cf,_0xc1dc('0xe'),JSON['stringify'](_0x4e88d4));if(_0x4e88d4[_0xc1dc('0x10')]){if(_0x4e88d4[_0xc1dc('0x10')]['code']===0x1f4){logger[_0xc1dc('0x10')](_0xc1dc('0xd'),_0x1a08cf,_0x4e88d4[_0xc1dc('0x10')][_0xc1dc('0x11')]);return _0x419ef4(_0x4e88d4[_0xc1dc('0x10')][_0xc1dc('0x11')]);}logger[_0xc1dc('0x10')]('VoiceContext,\x20%s,\x20%s',_0x1a08cf,_0x4e88d4[_0xc1dc('0x10')][_0xc1dc('0x11')]);return _0x2544d4(_0x4e88d4[_0xc1dc('0x10')][_0xc1dc('0x11')]);}else{logger[_0xc1dc('0xc')](_0xc1dc('0xd'),_0x1a08cf,_0xc1dc('0xe'));_0x2544d4(_0x4e88d4[_0xc1dc('0x12')]['message']);}})['catch'](function(_0x4b9832){logger['error'](_0xc1dc('0xd'),_0x1a08cf,_0x4b9832);_0x419ef4(_0x4b9832);});});} \ No newline at end of file +var _0xbd20=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','result','catch'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xbd20,0x14a));var _0x0bd2=function(_0x590455,_0x338a42){_0x590455=_0x590455-0x0;var _0x1b5a98=_0xbd20[_0x590455];return _0x1b5a98;};'use strict';var _=require(_0x0bd2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0bd2('0x1'));var rs=require(_0x0bd2('0x2'));var fs=require('fs');var Redis=require(_0x0bd2('0x3'));var db=require(_0x0bd2('0x4'))['db'];var utils=require(_0x0bd2('0x5'));var logger=require('../../config/logger')(_0x0bd2('0x6'));var config=require(_0x0bd2('0x7'));var jayson=require(_0x0bd2('0x8'));var client=jayson['client'][_0x0bd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b631,_0x57f5a7,_0x57dc02){return new BPromise(function(_0x377853,_0x29335c){return client[_0x0bd2('0xa')](_0x45b631,_0x57dc02)[_0x0bd2('0xb')](function(_0x473068){logger['info']('VoiceContext,\x20%s,\x20%s',_0x57f5a7,_0x0bd2('0xc'));logger[_0x0bd2('0xd')](_0x0bd2('0xe'),_0x57f5a7,_0x0bd2('0xc'),JSON[_0x0bd2('0xf')](_0x473068));if(_0x473068['error']){if(_0x473068[_0x0bd2('0x10')]['code']===0x1f4){logger[_0x0bd2('0x10')](_0x0bd2('0x11'),_0x57f5a7,_0x473068['error']['message']);return _0x29335c(_0x473068[_0x0bd2('0x10')][_0x0bd2('0x12')]);}logger[_0x0bd2('0x10')](_0x0bd2('0x11'),_0x57f5a7,_0x473068[_0x0bd2('0x10')]['message']);return _0x377853(_0x473068['error'][_0x0bd2('0x12')]);}else{logger[_0x0bd2('0x13')]('VoiceContext,\x20%s,\x20%s',_0x57f5a7,_0x0bd2('0xc'));_0x377853(_0x473068[_0x0bd2('0x14')][_0x0bd2('0x12')]);}})[_0x0bd2('0x15')](function(_0x3baf2e){logger[_0x0bd2('0x10')](_0x0bd2('0x11'),_0x57f5a7,_0x3baf2e);_0x29335c(_0x3baf2e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b1fafa1..118b19c 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 _0x754e=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','put','delete','exports','util','path','connect-timeout','express'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x754e,0xa6));var _0xe754=function(_0x46f529,_0x136f40){_0x46f529=_0x46f529-0x0;var _0x4a0ef7=_0x754e[_0x46f529];return _0x4a0ef7;};'use strict';var multer=require('multer');var util=require(_0xe754('0x0'));var path=require(_0xe754('0x1'));var timeout=require(_0xe754('0x2'));var express=require(_0xe754('0x3'));var router=express[_0xe754('0x4')]();var fs_extra=require(_0xe754('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe754('0x6'));var config=require(_0xe754('0x7'));var controller=require(_0xe754('0x8'));router[_0xe754('0x9')]('/',auth[_0xe754('0xa')](),controller[_0xe754('0xb')]);router['get']('/describe',auth[_0xe754('0xa')](),controller['describe']);router[_0xe754('0x9')](_0xe754('0xc'),auth[_0xe754('0xa')](),controller[_0xe754('0xd')]);router['post']('/',auth[_0xe754('0xa')](),controller['create']);router[_0xe754('0xe')](_0xe754('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe754('0xf')](_0xe754('0xc'),auth[_0xe754('0xa')](),controller['destroy']);module[_0xe754('0x10')]=router; \ No newline at end of file +var _0x0367=['/:id','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','show','post','put'];(function(_0x454b4e,_0x37d9ad){var _0x553a78=function(_0x3c400e){while(--_0x3c400e){_0x454b4e['push'](_0x454b4e['shift']());}};_0x553a78(++_0x37d9ad);}(_0x0367,0x1ce));var _0x7036=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0367[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7036('0x0'));var express=require(_0x7036('0x1'));var router=express[_0x7036('0x2')]();var fs_extra=require(_0x7036('0x3'));var auth=require(_0x7036('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7036('0x5'));var controller=require(_0x7036('0x6'));router['get']('/',auth[_0x7036('0x7')](),controller[_0x7036('0x8')]);router[_0x7036('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7036('0xa')]);router[_0x7036('0x9')]('/:id',auth[_0x7036('0x7')](),controller[_0x7036('0xb')]);router[_0x7036('0xc')]('/',auth[_0x7036('0x7')](),controller['create']);router[_0x7036('0xd')](_0x7036('0xe'),auth[_0x7036('0x7')](),controller['update']);router[_0x7036('0xf')](_0x7036('0xe'),auth[_0x7036('0x7')](),controller[_0x7036('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 50060e8..b2207b8 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3e74,0x175));var _0x43e7=function(_0x362efa,_0x11fcd6){_0x362efa=_0x362efa-0x0;var _0xaf2c97=_0x3e74[_0x362efa];return _0xaf2c97;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x512672,_0x240349){var _0x20ea9d=function(_0x5ab15a){while(--_0x5ab15a){_0x512672['push'](_0x512672['shift']());}};_0x20ea9d(++_0x240349);}(_0xb821,0xa7));var _0x1b82=function(_0x22c3a3,_0x1b612d){_0x22c3a3=_0x22c3a3-0x0;var _0x5b7b23=_0xb821[_0x22c3a3];return _0x5b7b23;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b9f63d2..66da13b 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 _0xb371=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb371,0x97));var _0x1b37=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb371[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b37('0x0'));var zipdir=require(_0x1b37('0x1'));var jsonpatch=require(_0x1b37('0x2'));var rp=require(_0x1b37('0x3'));var moment=require(_0x1b37('0x4'));var BPromise=require(_0x1b37('0x5'));var Mustache=require('mustache');var util=require(_0x1b37('0x6'));var path=require(_0x1b37('0x7'));var sox=require(_0x1b37('0x8'));var csv=require(_0x1b37('0x9'));var ejs=require(_0x1b37('0xa'));var fs=require('fs');var fs_extra=require(_0x1b37('0xb'));var _=require('lodash');var squel=require(_0x1b37('0xc'));var crypto=require(_0x1b37('0xd'));var jsforce=require(_0x1b37('0xe'));var deskjs=require(_0x1b37('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b37('0x10'));var authService=require(_0x1b37('0x11'));var qs=require(_0x1b37('0x12'));var as=require(_0x1b37('0x13'));var hardwareService=require(_0x1b37('0x14'));var logger=require(_0x1b37('0x15'))('api');var utils=require(_0x1b37('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b37('0x17'))['db'];function respondWithStatusCode(_0xc24133,_0x56a3dc){_0x56a3dc=_0x56a3dc||0xcc;return function(_0x4e769a){if(_0x4e769a){return _0xc24133[_0x1b37('0x18')](_0x56a3dc);}return _0xc24133[_0x1b37('0x19')](_0x56a3dc)[_0x1b37('0x1a')]();};}function respondWithResult(_0x164852,_0x1f95f6){_0x1f95f6=_0x1f95f6||0xc8;return function(_0x32c564){if(_0x32c564){return _0x164852[_0x1b37('0x19')](_0x1f95f6)[_0x1b37('0x1b')](_0x32c564);}};}function respondWithFilteredResult(_0x192026,_0x140667){return function(_0x1961d4){if(_0x1961d4){var _0x46dd2=typeof _0x140667[_0x1b37('0x1c')]==='undefined'&&typeof _0x140667[_0x1b37('0x1d')]===_0x1b37('0x1e');var _0x25b107=_0x1961d4[_0x1b37('0x1f')];var _0x2540ca=_0x46dd2?0x0:_0x140667[_0x1b37('0x1c')];var _0x484b6f=_0x46dd2?_0x1961d4[_0x1b37('0x1f')]:_0x140667['offset']+_0x140667['limit'];var _0x595b30;if(_0x484b6f>=_0x25b107){_0x484b6f=_0x25b107;_0x595b30=0xc8;}else{_0x595b30=0xce;}_0x192026[_0x1b37('0x19')](_0x595b30);return _0x192026['set'](_0x1b37('0x20'),_0x2540ca+'-'+_0x484b6f+'/'+_0x25b107)[_0x1b37('0x1b')](_0x1961d4);}return null;};}function patchUpdates(_0x451898){return function(_0xaf27a3){try{jsonpatch[_0x1b37('0x21')](_0xaf27a3,_0x451898,!![]);}catch(_0x16e171){return BPromise[_0x1b37('0x22')](_0x16e171);}return _0xaf27a3[_0x1b37('0x23')]();};}function saveUpdates(_0x59b1f4,_0x2fdcf0){return function(_0x583665){if(_0x583665){return _0x583665['update'](_0x59b1f4)[_0x1b37('0x24')](function(_0x7afbed){return _0x7afbed;});}return null;};}function removeEntity(_0x537bbf,_0x5dc3a3){return function(_0x268aa4){if(_0x268aa4){return _0x268aa4['destroy']()[_0x1b37('0x24')](function(){_0x537bbf[_0x1b37('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f096,_0x536830){return function(_0x84fe5d){if(!_0x84fe5d){_0x33f096[_0x1b37('0x18')](0x194);}return _0x84fe5d;};}function handleError(_0x3f25f1,_0x461510){_0x461510=_0x461510||0x1f4;return function(_0x2a115a){logger['error'](_0x2a115a[_0x1b37('0x25')]);if(_0x2a115a[_0x1b37('0x26')]){delete _0x2a115a[_0x1b37('0x26')];}_0x3f25f1[_0x1b37('0x19')](_0x461510)[_0x1b37('0x27')](_0x2a115a);};}exports[_0x1b37('0x28')]=function(_0x534854,_0x179118){var _0x3550e2={},_0x1c661d={},_0x2fe6bc={'count':0x0,'rows':[]};var _0x119eb3=_[_0x1b37('0x29')](db['VoiceDialReport'][_0x1b37('0x2a')],function(_0x68e529){return{'name':_0x68e529['fieldName'],'type':_0x68e529['type'][_0x1b37('0x2b')]};});_0x1c661d[_0x1b37('0x2c')]=_[_0x1b37('0x29')](_0x119eb3,_0x1b37('0x26'));_0x1c661d[_0x1b37('0x2d')]=_[_0x1b37('0x2e')](_0x534854[_0x1b37('0x2d')]);_0x1c661d['filters']=_['intersection'](_0x1c661d[_0x1b37('0x2c')],_0x1c661d[_0x1b37('0x2d')]);_0x3550e2[_0x1b37('0x2f')]=_[_0x1b37('0x30')](_0x1c661d['model'],qs[_0x1b37('0x31')](_0x534854[_0x1b37('0x2d')]['fields']));_0x3550e2[_0x1b37('0x2f')]=_0x3550e2[_0x1b37('0x2f')][_0x1b37('0x32')]?_0x3550e2[_0x1b37('0x2f')]:_0x1c661d[_0x1b37('0x2c')];if(!_0x534854['query'][_0x1b37('0x33')](_0x1b37('0x34'))){_0x3550e2['limit']=qs[_0x1b37('0x1d')](_0x534854['query'][_0x1b37('0x1d')]);_0x3550e2[_0x1b37('0x1c')]=qs[_0x1b37('0x1c')](_0x534854[_0x1b37('0x2d')][_0x1b37('0x1c')]);}_0x3550e2[_0x1b37('0x35')]=qs[_0x1b37('0x36')](_0x534854[_0x1b37('0x2d')][_0x1b37('0x36')]);_0x3550e2['where']=qs[_0x1b37('0x37')](_[_0x1b37('0x38')](_0x534854[_0x1b37('0x2d')],_0x1c661d[_0x1b37('0x37')]),_0x119eb3);if(_0x534854[_0x1b37('0x2d')][_0x1b37('0x39')]){_0x3550e2[_0x1b37('0x3a')]=_[_0x1b37('0x3b')](_0x3550e2[_0x1b37('0x3a')],{'$or':_[_0x1b37('0x29')](_0x119eb3,function(_0x2e47a9){if(_0x2e47a9[_0x1b37('0x3c')]!==_0x1b37('0x3d')){var _0x4fecfb={};_0x4fecfb[_0x2e47a9[_0x1b37('0x26')]]={'$like':'%'+_0x534854[_0x1b37('0x2d')][_0x1b37('0x39')]+'%'};return _0x4fecfb;}})});}_0x3550e2=_['merge']({},_0x3550e2,_0x534854['options']);var _0x521cdd={'where':_0x3550e2[_0x1b37('0x3a')]};return db[_0x1b37('0x3e')]['count'](_0x521cdd)[_0x1b37('0x24')](function(_0x439f5f){_0x2fe6bc[_0x1b37('0x1f')]=_0x439f5f;if(_0x534854[_0x1b37('0x2d')][_0x1b37('0x3f')]){_0x3550e2[_0x1b37('0x40')]=[{'all':!![]}];}return db[_0x1b37('0x3e')][_0x1b37('0x41')](_0x3550e2);})[_0x1b37('0x24')](function(_0x3cde59){_0x2fe6bc[_0x1b37('0x42')]=_0x3cde59;return _0x2fe6bc;})[_0x1b37('0x24')](respondWithFilteredResult(_0x179118,_0x3550e2))[_0x1b37('0x43')](handleError(_0x179118,null));};exports[_0x1b37('0x44')]=function(_0x3a406a,_0x3a72b0){var _0x3846c7={'raw':!![],'where':{'id':_0x3a406a[_0x1b37('0x45')]['id']}},_0x43d258={};_0x43d258[_0x1b37('0x2c')]=_[_0x1b37('0x2e')](db[_0x1b37('0x3e')][_0x1b37('0x2a')]);_0x43d258[_0x1b37('0x2d')]=_[_0x1b37('0x2e')](_0x3a406a['query']);_0x43d258[_0x1b37('0x37')]=_[_0x1b37('0x30')](_0x43d258[_0x1b37('0x2c')],_0x43d258[_0x1b37('0x2d')]);_0x3846c7['attributes']=_[_0x1b37('0x30')](_0x43d258['model'],qs[_0x1b37('0x31')](_0x3a406a[_0x1b37('0x2d')]['fields']));_0x3846c7['attributes']=_0x3846c7[_0x1b37('0x2f')]['length']?_0x3846c7[_0x1b37('0x2f')]:_0x43d258[_0x1b37('0x2c')];if(_0x3a406a[_0x1b37('0x2d')][_0x1b37('0x3f')]){_0x3846c7[_0x1b37('0x40')]=[{'all':!![]}];}_0x3846c7=_[_0x1b37('0x3b')]({},_0x3846c7,_0x3a406a['options']);return db[_0x1b37('0x3e')][_0x1b37('0x46')](_0x3846c7)[_0x1b37('0x24')](handleEntityNotFound(_0x3a72b0,null))[_0x1b37('0x24')](respondWithResult(_0x3a72b0,null))[_0x1b37('0x43')](handleError(_0x3a72b0,null));};exports[_0x1b37('0x47')]=function(_0x5becb0,_0x172b08){return db[_0x1b37('0x3e')][_0x1b37('0x47')](_0x5becb0[_0x1b37('0x48')],{})[_0x1b37('0x24')](respondWithResult(_0x172b08,0xc9))[_0x1b37('0x43')](handleError(_0x172b08,null));};exports[_0x1b37('0x49')]=function(_0x36cf5e,_0x4207c8){if(_0x36cf5e[_0x1b37('0x48')]['id']){delete _0x36cf5e[_0x1b37('0x48')]['id'];}return db[_0x1b37('0x3e')][_0x1b37('0x46')]({'where':{'id':_0x36cf5e[_0x1b37('0x45')]['id']}})[_0x1b37('0x24')](handleEntityNotFound(_0x4207c8,null))[_0x1b37('0x24')](saveUpdates(_0x36cf5e[_0x1b37('0x48')],null))[_0x1b37('0x24')](respondWithResult(_0x4207c8,null))['catch'](handleError(_0x4207c8,null));};exports[_0x1b37('0x4a')]=function(_0x21b832,_0x2e5f5e){return db[_0x1b37('0x3e')][_0x1b37('0x46')]({'where':{'id':_0x21b832[_0x1b37('0x45')]['id']}})[_0x1b37('0x24')](handleEntityNotFound(_0x2e5f5e,null))[_0x1b37('0x24')](removeEntity(_0x2e5f5e,null))[_0x1b37('0x43')](handleError(_0x2e5f5e,null));};exports[_0x1b37('0x4b')]=function(_0x2195a3,_0x3542a2){return db[_0x1b37('0x3e')][_0x1b37('0x4b')]()[_0x1b37('0x24')](respondWithResult(_0x3542a2,null))[_0x1b37('0x43')](handleError(_0x3542a2,null));}; \ No newline at end of file +var _0xb51f=['set','Content-Range','json','reject','save','destroy','then','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count'];(function(_0x5a5a43,_0x4be217){var _0x409d73=function(_0x4d934e){while(--_0x4d934e){_0x5a5a43['push'](_0x5a5a43['shift']());}};_0x409d73(++_0x4be217);}(_0xb51f,0xc4));var _0xfb51=function(_0x3c560a,_0x1c46d4){_0x3c560a=_0x3c560a-0x0;var _0x22e9be=_0xb51f[_0x3c560a];return _0x22e9be;};'use strict';var emlformat=require(_0xfb51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb51('0x2'));var moment=require('moment');var BPromise=require(_0xfb51('0x3'));var Mustache=require(_0xfb51('0x4'));var util=require(_0xfb51('0x5'));var path=require('path');var sox=require(_0xfb51('0x6'));var csv=require(_0xfb51('0x7'));var ejs=require(_0xfb51('0x8'));var fs=require('fs');var fs_extra=require(_0xfb51('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb51('0xa'));var jsforce=require(_0xfb51('0xb'));var deskjs=require(_0xfb51('0xc'));var toCsv=require(_0xfb51('0x7'));var querystring=require('querystring');var Papa=require(_0xfb51('0xd'));var Redis=require(_0xfb51('0xe'));var authService=require(_0xfb51('0xf'));var qs=require(_0xfb51('0x10'));var as=require(_0xfb51('0x11'));var hardwareService=require(_0xfb51('0x12'));var logger=require('../../config/logger')(_0xfb51('0x13'));var utils=require(_0xfb51('0x14'));var config=require(_0xfb51('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb51('0x16'))['db'];function respondWithStatusCode(_0x15a086,_0x1478a4){_0x1478a4=_0x1478a4||0xcc;return function(_0x3c4390){if(_0x3c4390){return _0x15a086['sendStatus'](_0x1478a4);}return _0x15a086['status'](_0x1478a4)[_0xfb51('0x17')]();};}function respondWithResult(_0x31a3c1,_0xf01d9a){_0xf01d9a=_0xf01d9a||0xc8;return function(_0x3431b0){if(_0x3431b0){return _0x31a3c1[_0xfb51('0x18')](_0xf01d9a)['json'](_0x3431b0);}};}function respondWithFilteredResult(_0x273770,_0x4201f2){return function(_0x23bdcc){if(_0x23bdcc){var _0x4c4ece=typeof _0x4201f2[_0xfb51('0x19')]===_0xfb51('0x1a')&&typeof _0x4201f2[_0xfb51('0x1b')]===_0xfb51('0x1a');var _0x566db4=_0x23bdcc[_0xfb51('0x1c')];var _0x3f8c3f=_0x4c4ece?0x0:_0x4201f2[_0xfb51('0x19')];var _0x56ed99=_0x4c4ece?_0x23bdcc[_0xfb51('0x1c')]:_0x4201f2['offset']+_0x4201f2['limit'];var _0x45a7a4;if(_0x56ed99>=_0x566db4){_0x56ed99=_0x566db4;_0x45a7a4=0xc8;}else{_0x45a7a4=0xce;}_0x273770[_0xfb51('0x18')](_0x45a7a4);return _0x273770[_0xfb51('0x1d')](_0xfb51('0x1e'),_0x3f8c3f+'-'+_0x56ed99+'/'+_0x566db4)[_0xfb51('0x1f')](_0x23bdcc);}return null;};}function patchUpdates(_0x57e56d){return function(_0x4edb1f){try{jsonpatch['apply'](_0x4edb1f,_0x57e56d,!![]);}catch(_0xe5138d){return BPromise[_0xfb51('0x20')](_0xe5138d);}return _0x4edb1f[_0xfb51('0x21')]();};}function saveUpdates(_0x300c49,_0x44f2a8){return function(_0x2cb396){if(_0x2cb396){return _0x2cb396['update'](_0x300c49)['then'](function(_0x1a58f6){return _0x1a58f6;});}return null;};}function removeEntity(_0x201e8e,_0x338656){return function(_0x4c0d7c){if(_0x4c0d7c){return _0x4c0d7c[_0xfb51('0x22')]()[_0xfb51('0x23')](function(){_0x201e8e[_0xfb51('0x18')](0xcc)[_0xfb51('0x17')]();});}};}function handleEntityNotFound(_0xef471c,_0x118e89){return function(_0x49385a){if(!_0x49385a){_0xef471c[_0xfb51('0x24')](0x194);}return _0x49385a;};}function handleError(_0x49576a,_0x1c7f71){_0x1c7f71=_0x1c7f71||0x1f4;return function(_0x335448){logger[_0xfb51('0x25')](_0x335448['stack']);if(_0x335448[_0xfb51('0x26')]){delete _0x335448[_0xfb51('0x26')];}_0x49576a[_0xfb51('0x18')](_0x1c7f71)[_0xfb51('0x27')](_0x335448);};}exports[_0xfb51('0x28')]=function(_0x4ba65f,_0x578d03){var _0xa7ada3={},_0x257f79={},_0x4aa152={'count':0x0,'rows':[]};var _0x5bf5d5=_[_0xfb51('0x29')](db[_0xfb51('0x2a')][_0xfb51('0x2b')],function(_0x142218){return{'name':_0x142218['fieldName'],'type':_0x142218[_0xfb51('0x2c')][_0xfb51('0x2d')]};});_0x257f79[_0xfb51('0x2e')]=_[_0xfb51('0x29')](_0x5bf5d5,'name');_0x257f79[_0xfb51('0x2f')]=_[_0xfb51('0x30')](_0x4ba65f[_0xfb51('0x2f')]);_0x257f79[_0xfb51('0x31')]=_[_0xfb51('0x32')](_0x257f79['model'],_0x257f79[_0xfb51('0x2f')]);_0xa7ada3[_0xfb51('0x33')]=_[_0xfb51('0x32')](_0x257f79['model'],qs[_0xfb51('0x34')](_0x4ba65f[_0xfb51('0x2f')]['fields']));_0xa7ada3[_0xfb51('0x33')]=_0xa7ada3['attributes'][_0xfb51('0x35')]?_0xa7ada3[_0xfb51('0x33')]:_0x257f79[_0xfb51('0x2e')];if(!_0x4ba65f[_0xfb51('0x2f')][_0xfb51('0x36')]('nolimit')){_0xa7ada3['limit']=qs[_0xfb51('0x1b')](_0x4ba65f[_0xfb51('0x2f')][_0xfb51('0x1b')]);_0xa7ada3[_0xfb51('0x19')]=qs[_0xfb51('0x19')](_0x4ba65f[_0xfb51('0x2f')][_0xfb51('0x19')]);}_0xa7ada3[_0xfb51('0x37')]=qs[_0xfb51('0x38')](_0x4ba65f[_0xfb51('0x2f')][_0xfb51('0x38')]);_0xa7ada3[_0xfb51('0x39')]=qs['filters'](_[_0xfb51('0x3a')](_0x4ba65f[_0xfb51('0x2f')],_0x257f79['filters']),_0x5bf5d5);if(_0x4ba65f[_0xfb51('0x2f')][_0xfb51('0x3b')]){_0xa7ada3[_0xfb51('0x39')]=_[_0xfb51('0x3c')](_0xa7ada3[_0xfb51('0x39')],{'$or':_[_0xfb51('0x29')](_0x5bf5d5,function(_0x19d989){if(_0x19d989[_0xfb51('0x2c')]!==_0xfb51('0x3d')){var _0x22fd0d={};_0x22fd0d[_0x19d989['name']]={'$like':'%'+_0x4ba65f['query'][_0xfb51('0x3b')]+'%'};return _0x22fd0d;}})});}_0xa7ada3=_[_0xfb51('0x3c')]({},_0xa7ada3,_0x4ba65f[_0xfb51('0x3e')]);var _0xeb7a3c={'where':_0xa7ada3[_0xfb51('0x39')]};return db['VoiceDialReport'][_0xfb51('0x1c')](_0xeb7a3c)[_0xfb51('0x23')](function(_0x4f640e){_0x4aa152['count']=_0x4f640e;if(_0x4ba65f['query'][_0xfb51('0x3f')]){_0xa7ada3[_0xfb51('0x40')]=[{'all':!![]}];}return db[_0xfb51('0x2a')][_0xfb51('0x41')](_0xa7ada3);})[_0xfb51('0x23')](function(_0x5788df){_0x4aa152[_0xfb51('0x42')]=_0x5788df;return _0x4aa152;})['then'](respondWithFilteredResult(_0x578d03,_0xa7ada3))[_0xfb51('0x43')](handleError(_0x578d03,null));};exports[_0xfb51('0x44')]=function(_0x403043,_0x30c7e4){var _0x888af1={'raw':!![],'where':{'id':_0x403043[_0xfb51('0x45')]['id']}},_0xfd183e={};_0xfd183e['model']=_[_0xfb51('0x30')](db[_0xfb51('0x2a')][_0xfb51('0x2b')]);_0xfd183e[_0xfb51('0x2f')]=_[_0xfb51('0x30')](_0x403043['query']);_0xfd183e[_0xfb51('0x31')]=_['intersection'](_0xfd183e[_0xfb51('0x2e')],_0xfd183e[_0xfb51('0x2f')]);_0x888af1[_0xfb51('0x33')]=_[_0xfb51('0x32')](_0xfd183e[_0xfb51('0x2e')],qs[_0xfb51('0x34')](_0x403043[_0xfb51('0x2f')]['fields']));_0x888af1[_0xfb51('0x33')]=_0x888af1[_0xfb51('0x33')]['length']?_0x888af1[_0xfb51('0x33')]:_0xfd183e[_0xfb51('0x2e')];if(_0x403043[_0xfb51('0x2f')][_0xfb51('0x3f')]){_0x888af1[_0xfb51('0x40')]=[{'all':!![]}];}_0x888af1=_[_0xfb51('0x3c')]({},_0x888af1,_0x403043[_0xfb51('0x3e')]);return db[_0xfb51('0x2a')][_0xfb51('0x46')](_0x888af1)[_0xfb51('0x23')](handleEntityNotFound(_0x30c7e4,null))[_0xfb51('0x23')](respondWithResult(_0x30c7e4,null))[_0xfb51('0x43')](handleError(_0x30c7e4,null));};exports[_0xfb51('0x47')]=function(_0x3fc717,_0x131496){return db[_0xfb51('0x2a')][_0xfb51('0x47')](_0x3fc717[_0xfb51('0x48')],{})[_0xfb51('0x23')](respondWithResult(_0x131496,0xc9))[_0xfb51('0x43')](handleError(_0x131496,null));};exports[_0xfb51('0x49')]=function(_0x2559d2,_0x2b290a){if(_0x2559d2[_0xfb51('0x48')]['id']){delete _0x2559d2[_0xfb51('0x48')]['id'];}return db[_0xfb51('0x2a')]['find']({'where':{'id':_0x2559d2['params']['id']}})['then'](handleEntityNotFound(_0x2b290a,null))['then'](saveUpdates(_0x2559d2[_0xfb51('0x48')],null))['then'](respondWithResult(_0x2b290a,null))[_0xfb51('0x43')](handleError(_0x2b290a,null));};exports[_0xfb51('0x22')]=function(_0x16e5a9,_0x595748){return db[_0xfb51('0x2a')]['find']({'where':{'id':_0x16e5a9['params']['id']}})['then'](handleEntityNotFound(_0x595748,null))[_0xfb51('0x23')](removeEntity(_0x595748,null))['catch'](handleError(_0x595748,null));};exports[_0xfb51('0x4a')]=function(_0x3d700c,_0x20a9e4){return db['VoiceDialReport'][_0xfb51('0x4a')]()[_0xfb51('0x23')](respondWithResult(_0x20a9e4,null))[_0xfb51('0x43')](handleError(_0x20a9e4,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ede8f82..b86e8ed 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 _0x3893=['api','moment','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','../../config/logger'];(function(_0x365c22,_0x23c5fb){var _0x551d75=function(_0x2ef044){while(--_0x2ef044){_0x365c22['push'](_0x365c22['shift']());}};_0x551d75(++_0x23c5fb);}(_0x3893,0x1a1));var _0x3389=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x3893[_0x2265da];return _0x430c2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3389('0x0'))(_0x3389('0x1'));var moment=require(_0x3389('0x2'));var BPromise=require(_0x3389('0x3'));var rp=require(_0x3389('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3389('0x5'));var attributes=require(_0x3389('0x6'));module[_0x3389('0x7')]=function(_0x546865,_0x5e963b){return _0x546865[_0x3389('0x8')](_0x3389('0x9'),attributes,{'tableName':_0x3389('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6819=['./voiceDialReport.attributes','exports','define','VoiceDialReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10ab3b,_0xe22acf){var _0x2a5882=function(_0x4a06bf){while(--_0x4a06bf){_0x10ab3b['push'](_0x10ab3b['shift']());}};_0x2a5882(++_0xe22acf);}(_0x6819,0x93));var _0x9681=function(_0x49be18,_0x53d706){_0x49be18=_0x49be18-0x0;var _0x545735=_0x6819[_0x49be18];return _0x545735;};'use strict';var _=require('lodash');var util=require(_0x9681('0x0'));var logger=require(_0x9681('0x1'))(_0x9681('0x2'));var moment=require(_0x9681('0x3'));var BPromise=require(_0x9681('0x4'));var rp=require(_0x9681('0x5'));var fs=require('fs');var path=require(_0x9681('0x6'));var rimraf=require(_0x9681('0x7'));var config=require(_0x9681('0x8'));var attributes=require(_0x9681('0x9'));module[_0x9681('0xa')]=function(_0x24d21f,_0x1a5e1b){return _0x24d21f[_0x9681('0xb')](_0x9681('0xc'),attributes,{'tableName':'report_dial','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 8e32e4a..8c7c632 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 _0x82c2=['VoiceDialReport,\x20%s,\x20%s','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','catch','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x82c2,0x17a));var _0x282c=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0x82c2[_0x26299e];return _0x6c4f4a;};'use strict';var _=require(_0x282c('0x0'));var util=require(_0x282c('0x1'));var moment=require(_0x282c('0x2'));var BPromise=require(_0x282c('0x3'));var rs=require(_0x282c('0x4'));var fs=require('fs');var Redis=require(_0x282c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x282c('0x6'));var logger=require(_0x282c('0x7'))(_0x282c('0x8'));var config=require(_0x282c('0x9'));var jayson=require(_0x282c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28c08e,_0x307fb1,_0x5895d0){return new BPromise(function(_0x48612e,_0x2e8ffc){return client[_0x282c('0xb')](_0x28c08e,_0x5895d0)[_0x282c('0xc')](function(_0x1dc6ab){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x307fb1,'request\x20sent');logger[_0x282c('0xd')](_0x282c('0xe'),_0x307fb1,'request\x20sent',JSON[_0x282c('0xf')](_0x1dc6ab));if(_0x1dc6ab[_0x282c('0x10')]){if(_0x1dc6ab[_0x282c('0x10')][_0x282c('0x11')]===0x1f4){logger[_0x282c('0x10')](_0x282c('0x12'),_0x307fb1,_0x1dc6ab[_0x282c('0x10')][_0x282c('0x13')]);return _0x2e8ffc(_0x1dc6ab[_0x282c('0x10')]['message']);}logger[_0x282c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x307fb1,_0x1dc6ab[_0x282c('0x10')][_0x282c('0x13')]);return _0x48612e(_0x1dc6ab['error'][_0x282c('0x13')]);}else{logger[_0x282c('0x14')](_0x282c('0x12'),_0x307fb1,'request\x20sent');_0x48612e(_0x1dc6ab[_0x282c('0x15')]['message']);}})['catch'](function(_0x3a5403){logger['error'](_0x282c('0x12'),_0x307fb1,_0x3a5403);_0x2e8ffc(_0x3a5403);});});}exports[_0x282c('0x16')]=function(_0x4a16b9){var _0x374184=this;return new Promise(function(_0xc7a79f,_0x581d55){return db[_0x282c('0x17')][_0x282c('0x18')](_0x4a16b9[_0x282c('0x19')],{'raw':_0x4a16b9[_0x282c('0x1a')]?_0x4a16b9[_0x282c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x282c('0xc')](function(_0x15a625){logger[_0x282c('0x14')](_0x282c('0x16'),_0x4a16b9);logger[_0x282c('0xd')](_0x282c('0x16'),_0x4a16b9,JSON[_0x282c('0xf')](_0x15a625));_0xc7a79f(_0x15a625);})[_0x282c('0x1b')](function(_0x36d40c){logger[_0x282c('0x10')](_0x282c('0x16'),_0x36d40c[_0x282c('0x13')],_0x4a16b9);_0x581d55(_0x374184[_0x282c('0x10')](0x1f4,_0x36d40c[_0x282c('0x13')]));});});};exports[_0x282c('0x1c')]=function(_0x43073c){var _0x3a9beb=this;return new Promise(function(_0x2df539,_0x3f94dc){return db['VoiceDialReport'][_0x282c('0x1d')](_0x43073c[_0x282c('0x19')],{'raw':_0x43073c[_0x282c('0x1a')]?_0x43073c[_0x282c('0x1a')][_0x282c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43073c[_0x282c('0x1a')]?_0x43073c[_0x282c('0x1a')][_0x282c('0x1f')]||null:null,'attributes':_0x43073c[_0x282c('0x1a')]?_0x43073c['options'][_0x282c('0x20')]||null:null,'limit':_0x43073c[_0x282c('0x1a')]?_0x43073c['options']['limit']||null:null})[_0x282c('0xc')](function(_0x2e1af5){logger[_0x282c('0x14')](_0x282c('0x1c'),_0x43073c);logger[_0x282c('0xd')]('UpdateVoiceDialReport',_0x43073c,JSON[_0x282c('0xf')](_0x2e1af5));_0x2df539(_0x2e1af5);})[_0x282c('0x1b')](function(_0x470126){logger[_0x282c('0x10')](_0x282c('0x1c'),_0x470126[_0x282c('0x13')],_0x43073c);_0x3f94dc(_0x3a9beb['error'](0x1f4,_0x470126['message']));});});}; \ No newline at end of file +var _0x8adf=['then','debug','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','create','body','options','raw'];(function(_0x5e6acf,_0x560ddf){var _0x3ac69d=function(_0x5e65b2){while(--_0x5e65b2){_0x5e6acf['push'](_0x5e6acf['shift']());}};_0x3ac69d(++_0x560ddf);}(_0x8adf,0x118));var _0xf8ad=function(_0x18f6c4,_0x3f643a){_0x18f6c4=_0x18f6c4-0x0;var _0x357b76=_0x8adf[_0x18f6c4];return _0x357b76;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8ad('0x0'));var BPromise=require(_0xf8ad('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8ad('0x2'))['db'];var utils=require(_0xf8ad('0x3'));var logger=require(_0xf8ad('0x4'))(_0xf8ad('0x5'));var config=require(_0xf8ad('0x6'));var jayson=require(_0xf8ad('0x7'));var client=jayson[_0xf8ad('0x8')][_0xf8ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e9c89,_0x1aca68,_0x258745){return new BPromise(function(_0xbcae9b,_0x1ce74a){return client[_0xf8ad('0xa')](_0x5e9c89,_0x258745)['then'](function(_0x237f8f){logger['info'](_0xf8ad('0xb'),_0x1aca68,_0xf8ad('0xc'));logger['debug'](_0xf8ad('0xd'),_0x1aca68,_0xf8ad('0xc'),JSON[_0xf8ad('0xe')](_0x237f8f));if(_0x237f8f[_0xf8ad('0xf')]){if(_0x237f8f[_0xf8ad('0xf')][_0xf8ad('0x10')]===0x1f4){logger[_0xf8ad('0xf')](_0xf8ad('0xb'),_0x1aca68,_0x237f8f['error'][_0xf8ad('0x11')]);return _0x1ce74a(_0x237f8f['error']['message']);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1aca68,_0x237f8f[_0xf8ad('0xf')][_0xf8ad('0x11')]);return _0xbcae9b(_0x237f8f[_0xf8ad('0xf')][_0xf8ad('0x11')]);}else{logger[_0xf8ad('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1aca68,_0xf8ad('0xc'));_0xbcae9b(_0x237f8f[_0xf8ad('0x13')][_0xf8ad('0x11')]);}})[_0xf8ad('0x14')](function(_0x12e92f){logger[_0xf8ad('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x1aca68,_0x12e92f);_0x1ce74a(_0x12e92f);});});}exports[_0xf8ad('0x15')]=function(_0x53b3ac){var _0x23bdad=this;return new Promise(function(_0x53e540,_0x3e0f16){return db['VoiceDialReport'][_0xf8ad('0x16')](_0x53b3ac[_0xf8ad('0x17')],{'raw':_0x53b3ac['options']?_0x53b3ac[_0xf8ad('0x18')][_0xf8ad('0x19')]===undefined?!![]:![]:!![]})[_0xf8ad('0x1a')](function(_0x23c64b){logger[_0xf8ad('0x12')](_0xf8ad('0x15'),_0x53b3ac);logger[_0xf8ad('0x1b')](_0xf8ad('0x15'),_0x53b3ac,JSON[_0xf8ad('0xe')](_0x23c64b));_0x53e540(_0x23c64b);})['catch'](function(_0x32cdfd){logger[_0xf8ad('0xf')](_0xf8ad('0x15'),_0x32cdfd[_0xf8ad('0x11')],_0x53b3ac);_0x3e0f16(_0x23bdad[_0xf8ad('0xf')](0x1f4,_0x32cdfd['message']));});});};exports[_0xf8ad('0x1c')]=function(_0x5c8bd8){var _0x402f7c=this;return new Promise(function(_0x22af57,_0x1e8718){return db[_0xf8ad('0x1d')][_0xf8ad('0x1e')](_0x5c8bd8['body'],{'raw':_0x5c8bd8[_0xf8ad('0x18')]?_0x5c8bd8[_0xf8ad('0x18')][_0xf8ad('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c8bd8[_0xf8ad('0x18')]?_0x5c8bd8[_0xf8ad('0x18')][_0xf8ad('0x1f')]||null:null,'attributes':_0x5c8bd8[_0xf8ad('0x18')]?_0x5c8bd8[_0xf8ad('0x18')][_0xf8ad('0x20')]||null:null,'limit':_0x5c8bd8[_0xf8ad('0x18')]?_0x5c8bd8[_0xf8ad('0x18')][_0xf8ad('0x21')]||null:null})[_0xf8ad('0x1a')](function(_0x2ddc53){logger['info'](_0xf8ad('0x1c'),_0x5c8bd8);logger[_0xf8ad('0x1b')](_0xf8ad('0x1c'),_0x5c8bd8,JSON['stringify'](_0x2ddc53));_0x22af57(_0x2ddc53);})['catch'](function(_0x5d18ac){logger[_0xf8ad('0xf')](_0xf8ad('0x1c'),_0x5d18ac['message'],_0x5c8bd8);_0x1e8718(_0x402f7c[_0xf8ad('0xf')](0x1f4,_0x5d18ac[_0xf8ad('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e0df8d5..eb74525 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 _0x6abb=['index','/:id','create','addApplications','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0xefa736,_0x866a70){var _0x3340dd=function(_0xaa05c){while(--_0xaa05c){_0xefa736['push'](_0xefa736['shift']());}};_0x3340dd(++_0x866a70);}(_0x6abb,0x1a9));var _0xb6ab=function(_0x1abda3,_0x17b851){_0x1abda3=_0x1abda3-0x0;var _0x19d3d2=_0x6abb[_0x1abda3];return _0x19d3d2;};'use strict';var multer=require(_0xb6ab('0x0'));var util=require(_0xb6ab('0x1'));var path=require(_0xb6ab('0x2'));var timeout=require(_0xb6ab('0x3'));var express=require(_0xb6ab('0x4'));var router=express[_0xb6ab('0x5')]();var fs_extra=require(_0xb6ab('0x6'));var auth=require(_0xb6ab('0x7'));var interaction=require(_0xb6ab('0x8'));var config=require('../../config/environment');var controller=require(_0xb6ab('0x9'));router[_0xb6ab('0xa')]('/',auth[_0xb6ab('0xb')](),controller[_0xb6ab('0xc')]);router[_0xb6ab('0xa')](_0xb6ab('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb6ab('0xe')]);router['post']('/:id/applications',auth[_0xb6ab('0xb')](),controller[_0xb6ab('0xf')]);router['put'](_0xb6ab('0xd'),auth[_0xb6ab('0xb')](),controller[_0xb6ab('0x10')]);router[_0xb6ab('0x11')](_0xb6ab('0xd'),auth['isAuthenticated'](),controller[_0xb6ab('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1450=['express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x11cd52,_0x2c6d8a){var _0x3d717b=function(_0x346503){while(--_0x346503){_0x11cd52['push'](_0x11cd52['shift']());}};_0x3d717b(++_0x2c6d8a);}(_0x1450,0x1c8));var _0x0145=function(_0x2c24bf,_0x6a87a7){_0x2c24bf=_0x2c24bf-0x0;var _0x5e476d=_0x1450[_0x2c24bf];return _0x5e476d;};'use strict';var multer=require(_0x0145('0x0'));var util=require('util');var path=require(_0x0145('0x1'));var timeout=require(_0x0145('0x2'));var express=require(_0x0145('0x3'));var router=express[_0x0145('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0145('0x5'));var config=require(_0x0145('0x6'));var controller=require(_0x0145('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0145('0x8')]);router['get'](_0x0145('0x9'),auth[_0x0145('0xa')](),controller[_0x0145('0xb')]);router[_0x0145('0xc')]('/',auth[_0x0145('0xa')](),controller[_0x0145('0xd')]);router[_0x0145('0xc')]('/:id/applications',auth[_0x0145('0xa')](),controller['addApplications']);router['put'](_0x0145('0x9'),auth[_0x0145('0xa')](),controller['update']);router[_0x0145('0xe')]('/:id',auth[_0x0145('0xa')](),controller[_0x0145('0xf')]);module[_0x0145('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b835dde..9b20e0a 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 _0x77d3=['BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x140325,_0x53234c){var _0x318d4d=function(_0x179f53){while(--_0x179f53){_0x140325['push'](_0x140325['shift']());}};_0x318d4d(++_0x53234c);}(_0x77d3,0xd0));var _0x377d=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x77d3[_0x1177d5];return _0xc3ddc2;};'use strict';var Sequelize=require(_0x377d('0x0'));module[_0x377d('0x1')]={'context':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'unique':_0x377d('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'unique':_0x377d('0x3')},'priority':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x377d('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x377d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x377d('0x4')](_0x377d('0x5'),_0x377d('0x6'),_0x377d('0x7'),'inbound-fax',_0x377d('0x8'),_0x377d('0x9'),_0x377d('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x377d('0x2')]},'interval':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'defaultValue':_0x377d('0xb')},'IntervalId':{'type':Sequelize[_0x377d('0xc')]},'isApp':{'type':Sequelize[_0x377d('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x377d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x377d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x377d('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x377d('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x377d('0xe')},'answer':{'type':Sequelize[_0x377d('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x377d('0xf')],'get':function(_0x40a062){return this['getDataValue'](_0x377d('0x10'));}},'alias':{'type':Sequelize[_0x377d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0af7=['any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','compositeIndex','STRING','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system'];(function(_0xb1ff9e,_0x5ad675){var _0xaf7827=function(_0x177d3a){while(--_0x177d3a){_0xb1ff9e['push'](_0xb1ff9e['shift']());}};_0xaf7827(++_0x5ad675);}(_0x0af7,0x7e));var _0x70af=function(_0x4d6238,_0x5429ac){_0x4d6238=_0x4d6238-0x0;var _0x2f42a1=_0x0af7[_0x4d6238];return _0x2f42a1;};'use strict';var Sequelize=require(_0x70af('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x70af('0x1')},'priority':{'type':Sequelize[_0x70af('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x70af('0x1')},'tag':{'type':Sequelize[_0x70af('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x70af('0x2')],'allowNull':![],'defaultValue':_0x70af('0x3')},'appdata':{'type':Sequelize[_0x70af('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x70af('0x4'),_0x70af('0x5'),_0x70af('0x6'),_0x70af('0x7'),_0x70af('0x8'),_0x70af('0x9'),_0x70af('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x70af('0x2')]},'interval':{'type':Sequelize[_0x70af('0x2')],'allowNull':![],'defaultValue':_0x70af('0xb')},'IntervalId':{'type':Sequelize[_0x70af('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x70af('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x70af('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x70af('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x70af('0xc')]},'recordingFormat':{'type':Sequelize[_0x70af('0x2')],'defaultValue':_0x70af('0xe')},'answer':{'type':Sequelize[_0x70af('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x70af('0xf')],'get':function(_0xcd88d5){return this[_0x70af('0x10')]('exten');}},'alias':{'type':Sequelize[_0x70af('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 388993b..c6e7f7c 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 _0xb912=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','find','create','body','startsWith','exten','user','get','role','inbound','OutboundRoutes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','createRouting','bulkCreate','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','InboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','UserProfileResource','destroy','then','error','stack','name','send','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb912,0x18c));var _0x2b91=function(_0xffdef,_0x43a2bd){_0xffdef=_0xffdef-0x0;var _0x30cba3=_0xb912[_0xffdef];return _0x30cba3;};'use strict';var _=require('lodash');var Redis=require(_0x2b91('0x0'));var qs=require(_0x2b91('0x1'));var logger=require('../../config/logger')(_0x2b91('0x2'));var config=require(_0x2b91('0x3'));var db=require('../../mysqldb')['db'];config[_0x2b91('0x4')]=_[_0x2b91('0x5')](config[_0x2b91('0x4')],{'host':_0x2b91('0x6'),'port':0x18eb});var socket=require(_0x2b91('0x7'))(new Redis(config[_0x2b91('0x4')]));require(_0x2b91('0x8'))[_0x2b91('0x9')](socket);function respondWithStatusCode(_0x518298,_0x22820b){_0x22820b=_0x22820b||0xcc;return function(_0x934a1f){if(_0x934a1f){return _0x518298[_0x2b91('0xa')](_0x22820b);}return _0x518298['status'](_0x22820b)[_0x2b91('0xb')]();};}function respondWithResult(_0x4aab82,_0x15dab2){_0x15dab2=_0x15dab2||0xc8;return function(_0x23fce7){if(_0x23fce7){return _0x4aab82[_0x2b91('0xc')](_0x15dab2)['json'](_0x23fce7);}};}function respondWithFilteredResult(_0x9b6141,_0xda8184){return function(_0x21aba3){if(_0x21aba3){var _0x805f60=typeof _0xda8184['offset']===_0x2b91('0xd')&&typeof _0xda8184['limit']===_0x2b91('0xd');var _0x10bf7a=_0x21aba3[_0x2b91('0xe')];var _0x2c9572=_0x805f60?0x0:_0xda8184[_0x2b91('0xf')];var _0x2fb3ee=_0x805f60?_0x21aba3[_0x2b91('0xe')]:_0xda8184[_0x2b91('0xf')]+_0xda8184['limit'];var _0x36e359;if(_0x2fb3ee>=_0x10bf7a){_0x2fb3ee=_0x10bf7a;_0x36e359=0xc8;}else{_0x36e359=0xce;}_0x9b6141[_0x2b91('0xc')](_0x36e359);return _0x9b6141[_0x2b91('0x10')](_0x2b91('0x11'),_0x2c9572+'-'+_0x2fb3ee+'/'+_0x10bf7a)[_0x2b91('0x12')](_0x21aba3);}return null;};}function removeEntity(_0x3de6a4){return function(_0x2f5a47){if(_0x2f5a47){return _0x2f5a47['destroy']()['then'](function(){var _0x52b5e6=_0x2f5a47['get']({'plain':!![]});var _0x27fb51=[{'name':_0x2b91('0x13'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x2b91('0x14'),'ignore':![]},{'name':_0x2b91('0x15'),'value':_0x2b91('0x16'),'ignore':![]}];var _0x3d6aaf=_(_0x27fb51)['filter'](_0x2b91('0x17'))[_0x2b91('0x18')](_0x2b91('0x19'))[_0x2b91('0x19')]();if(_[_0x2b91('0x1a')](_0x3d6aaf,_0x52b5e6[_0x2b91('0x1b')])){return;}var _0x56ba8d=_['find'](_0x27fb51,[_0x2b91('0x19'),_0x52b5e6[_0x2b91('0x1b')]])['name'];return db[_0x2b91('0x1c')][_0x2b91('0x1d')]({'where':{'type':_0x56ba8d,'resourceId':_0x52b5e6['id']}})[_0x2b91('0x1e')](function(){return _0x2f5a47;});})[_0x2b91('0x1e')](function(){_0x3de6a4[_0x2b91('0xc')](0xcc)[_0x2b91('0xb')]();});}};}function handleEntityNotFound(_0x1f4964){return function(_0x52f506){if(!_0x52f506){_0x1f4964['sendStatus'](0x194);}return _0x52f506;};}function handleError(_0x3e95e5,_0x258a13){_0x258a13=_0x258a13||0x1f4;return function(_0x5628ed){logger[_0x2b91('0x1f')](_0x5628ed[_0x2b91('0x20')]);if(_0x5628ed[_0x2b91('0x21')]){delete _0x5628ed[_0x2b91('0x21')];}_0x3e95e5[_0x2b91('0xc')](_0x258a13)[_0x2b91('0x22')](_0x5628ed);};}exports['index']=function(_0x2703f4,_0x5f511e){var _0x570a16={},_0x4b2909={},_0x407b10={'count':0x0,'rows':[]};var _0x18295a=_['map'](db['VoiceExtension'][_0x2b91('0x23')],function(_0x41fc6d){return{'name':_0x41fc6d['fieldName'],'type':_0x41fc6d['type'][_0x2b91('0x24')]};});_0x4b2909['model']=_[_0x2b91('0x18')](_0x18295a,_0x2b91('0x21'));_0x4b2909[_0x2b91('0x25')]=_[_0x2b91('0x26')](_0x2703f4[_0x2b91('0x25')]);_0x4b2909[_0x2b91('0x27')]=_[_0x2b91('0x28')](_0x4b2909[_0x2b91('0x29')],_0x4b2909[_0x2b91('0x25')]);_0x570a16[_0x2b91('0x2a')]=_[_0x2b91('0x28')](_0x4b2909[_0x2b91('0x29')],qs['fields'](_0x2703f4[_0x2b91('0x25')][_0x2b91('0x2b')]));_0x570a16[_0x2b91('0x2a')]=_0x570a16[_0x2b91('0x2a')][_0x2b91('0x2c')]?_0x570a16[_0x2b91('0x2a')]:_0x4b2909[_0x2b91('0x29')];if(!_0x2703f4[_0x2b91('0x25')][_0x2b91('0x2d')](_0x2b91('0x2e'))){_0x570a16[_0x2b91('0x2f')]=qs['limit'](_0x2703f4[_0x2b91('0x25')]['limit']);_0x570a16['offset']=qs['offset'](_0x2703f4[_0x2b91('0x25')][_0x2b91('0xf')]);}_0x570a16[_0x2b91('0x30')]=qs[_0x2b91('0x31')](_0x2703f4[_0x2b91('0x25')][_0x2b91('0x31')]);_0x570a16['where']=qs[_0x2b91('0x27')](_[_0x2b91('0x32')](_0x2703f4[_0x2b91('0x25')],_0x4b2909[_0x2b91('0x27')]),_0x18295a);if(_0x2703f4['query'][_0x2b91('0x33')]){_0x570a16[_0x2b91('0x34')]=_[_0x2b91('0x35')](_0x570a16['where'],{'$or':_['map'](_0x18295a,function(_0x545137){if(_0x545137[_0x2b91('0x1b')]!==_0x2b91('0x36')){var _0x29e124={};_0x29e124[_0x545137['name']]={'$like':'%'+_0x2703f4['query']['filter']+'%'};return _0x29e124;}})});}_0x570a16=_[_0x2b91('0x35')]({},_0x570a16,_0x2703f4['options']);var _0x2f52f1={'where':_0x570a16['where']};return db[_0x2b91('0x37')][_0x2b91('0xe')](_0x2f52f1)[_0x2b91('0x1e')](function(_0x1df98f){_0x407b10['count']=_0x1df98f;if(_0x2703f4[_0x2b91('0x25')][_0x2b91('0x38')]){_0x570a16[_0x2b91('0x39')]=[{'all':!![]}];}return db[_0x2b91('0x37')][_0x2b91('0x3a')](_0x570a16);})[_0x2b91('0x1e')](function(_0xebbb9b){_0x407b10[_0x2b91('0x3b')]=_0xebbb9b;return _0x407b10;})[_0x2b91('0x1e')](respondWithFilteredResult(_0x5f511e,_0x570a16))[_0x2b91('0x3c')](handleError(_0x5f511e,null));};exports[_0x2b91('0x3d')]=function(_0x27fe52,_0xa8aa21){var _0x105d0a={'raw':![],'where':{'id':_0x27fe52[_0x2b91('0x3e')]['id']}},_0x2902e2={};_0x2902e2[_0x2b91('0x29')]=_[_0x2b91('0x26')](db['VoiceExtension'][_0x2b91('0x23')]);_0x2902e2[_0x2b91('0x25')]=_[_0x2b91('0x26')](_0x27fe52['query']);_0x2902e2[_0x2b91('0x27')]=_['intersection'](_0x2902e2[_0x2b91('0x29')],_0x2902e2[_0x2b91('0x25')]);_0x105d0a['attributes']=_[_0x2b91('0x28')](_0x2902e2[_0x2b91('0x29')],qs['fields'](_0x27fe52[_0x2b91('0x25')][_0x2b91('0x2b')]));_0x105d0a['attributes']=_0x105d0a['attributes'][_0x2b91('0x2c')]?_0x105d0a[_0x2b91('0x2a')]:_0x2902e2['model'];if(_0x27fe52['query'][_0x2b91('0x38')]){_0x105d0a[_0x2b91('0x39')]=[{'all':!![]}];}_0x105d0a=_[_0x2b91('0x35')]({},_0x105d0a,_0x27fe52['options']);return db[_0x2b91('0x37')][_0x2b91('0x3f')](_0x105d0a)[_0x2b91('0x1e')](handleEntityNotFound(_0xa8aa21,null))[_0x2b91('0x1e')](respondWithResult(_0xa8aa21,null))['catch'](handleError(_0xa8aa21,null));};exports['destroy']=function(_0x1f4f0d,_0x306941){return db[_0x2b91('0x37')][_0x2b91('0x3f')]({'where':{'id':_0x1f4f0d[_0x2b91('0x3e')]['id']}})[_0x2b91('0x1e')](handleEntityNotFound(_0x306941,null))[_0x2b91('0x1e')](removeEntity(_0x306941,null))[_0x2b91('0x3c')](handleError(_0x306941,null));};exports[_0x2b91('0x40')]=function(_0x3530fd,_0x21a9ed){if(_0x3530fd[_0x2b91('0x41')][_0x2b91('0x1b')]===_0x2b91('0x14')&&!_[_0x2b91('0x42')](_0x3530fd['body'][_0x2b91('0x43')],'_')){_0x3530fd['body'][_0x2b91('0x43')]='_'['concat'](_0x3530fd['body']['exten']);}return db['VoiceExtension'][_0x2b91('0x40')](_0x3530fd['body'],{'raw':![]})[_0x2b91('0x1e')](function(_0xc9dac7){var _0x4b2646=_0x3530fd[_0x2b91('0x44')][_0x2b91('0x45')]({'plain':!![]});if(!_0x4b2646)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2646[_0x2b91('0x46')]===_0x2b91('0x44')){var _0xf78a79=_0xc9dac7[_0x2b91('0x45')]({'plain':!![]});var _0x38ec40=[{'name':_0x2b91('0x13'),'value':_0x2b91('0x47')},{'name':_0x2b91('0x48'),'value':_0x2b91('0x14')},{'name':_0x2b91('0x15'),'value':_0x2b91('0x16')}];var _0xd2ed73=_[_0x2b91('0x3f')](_0x38ec40,[_0x2b91('0x19'),_0xf78a79['type']])['name'];return db['UserProfileSection'][_0x2b91('0x3f')]({'where':{'name':_0xd2ed73,'userProfileId':_0x4b2646[_0x2b91('0x49')]},'raw':!![]})['then'](function(_0x277c1d){if(_0x277c1d&&_0x277c1d['autoAssociation']===0x0){return db['UserProfileResource'][_0x2b91('0x40')]({'name':_0xf78a79[_0x2b91('0x21')],'resourceId':_0xf78a79['id'],'type':_0x277c1d[_0x2b91('0x21')],'sectionId':_0x277c1d['id']},{})[_0x2b91('0x1e')](function(){return _0xc9dac7;});}else{return _0xc9dac7;}})[_0x2b91('0x3c')](function(_0x1bf50a){logger[_0x2b91('0x1f')](_0x2b91('0x4a'),_0x1bf50a);throw _0x1bf50a;});}return _0xc9dac7;})['then'](respondWithResult(_0x21a9ed,0xc9))[_0x2b91('0x3c')](handleError(_0x21a9ed,null));};exports[_0x2b91('0x4b')]=function(_0x5b6d9a,_0x664f66){if(_0x5b6d9a[_0x2b91('0x41')]['id']){delete _0x5b6d9a[_0x2b91('0x41')]['id'];}return db[_0x2b91('0x37')][_0x2b91('0x3f')]({'where':{'id':_0x5b6d9a[_0x2b91('0x3e')]['id']}})['then'](handleEntityNotFound(_0x664f66,null))['then'](function(_0x590db8){if(_0x590db8){return db[_0x2b91('0x37')][_0x2b91('0x4b')](_[_0x2b91('0x32')](_0x5b6d9a[_0x2b91('0x41')],[_0x2b91('0x43'),_0x2b91('0x4c'),_0x2b91('0x4d'),_0x2b91('0x4e'),_0x2b91('0x4f'),_0x2b91('0x50'),'alias']),{'where':{'context':_0x590db8[_0x2b91('0x4c')],'exten':_0x590db8['exten']},'individualHooks':!![]})[_0x2b91('0x1e')](function(_0x5264c3){return _0x5264c3;});}return null;})[_0x2b91('0x1e')](respondWithStatusCode(_0x664f66,null))['catch'](handleError(_0x664f66,null));};exports['addApplications']=function(_0x101977,_0x524741){var _0x153e83=_0x101977[_0x2b91('0x3e')]['id'];var _0x791887=_0x101977['body'];var _0x40b2a0=0xc8;var _0x36d718=null;return db[_0x2b91('0x51')][_0x2b91('0x52')]({'isolationLevel':db['sequelize'][_0x2b91('0x53')][_0x2b91('0x54')][_0x2b91('0x55')]},function(_0x31a479){return db['VoiceExtension']['findOne']({'where':{'id':_0x153e83},'transaction':_0x31a479})['then'](function(_0x137c8e){if(_0x137c8e){return db[_0x2b91('0x37')][_0x2b91('0x1d')]({'where':{'VoiceExtensionId':_0x153e83},'transaction':_0x31a479})[_0x2b91('0x1e')](function(){var _0x33e2f6=_[_0x2b91('0x18')](_0x791887,function(_0x21ab75){_0x21ab75['VoiceExtensionId']=_0x153e83;_0x21ab75['isApp']=!![];return _0x21ab75;});return _0x137c8e[_0x2b91('0x56')](_0x33e2f6);})[_0x2b91('0x1e')](function(_0x35ec6f){return db[_0x2b91('0x37')][_0x2b91('0x57')](_0x35ec6f,{'transaction':_0x31a479});});}else{_0x40b2a0=0x194;_0x36d718=[];}});})[_0x2b91('0x1e')](function(){if(_0x40b2a0!==0x194){return db[_0x2b91('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x153e83},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x467fb7){_0x36d718=_0x467fb7;});}})[_0x2b91('0x3c')](function(_0x33fb65){_0x40b2a0=0x1f4;logger[_0x2b91('0x1f')](_0x33fb65[_0x2b91('0x20')]);if(_0x33fb65[_0x2b91('0x21')]){delete _0x33fb65[_0x2b91('0x21')];}_0x36d718=_0x33fb65;})['finally'](function(){if(_0x36d718===null){_0x524741['sendStatus'](_0x40b2a0);}else{if(_0x40b2a0===0x1f4){_0x524741[_0x2b91('0xc')](_0x40b2a0)[_0x2b91('0x22')](_0x36d718);}else{_0x524741['status'](_0x40b2a0)['json'](_0x36d718);}}});}; \ No newline at end of file +var _0xfbe4=['filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','count','includeAll','include','findAll','rows','catch','show','params','create','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','bulkCreate','finally','json','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','offset','undefined','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','stack','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x3a7601,_0x483a35){var _0x1c411c=function(_0xcc8826){while(--_0xcc8826){_0x3a7601['push'](_0x3a7601['shift']());}};_0x1c411c(++_0x483a35);}(_0xfbe4,0x1e5));var _0x4fbe=function(_0x100db1,_0x1674a6){_0x100db1=_0x100db1-0x0;var _0xf1eeda=_0xfbe4[_0x100db1];return _0xf1eeda;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x4fbe('0x0'));var logger=require(_0x4fbe('0x1'))(_0x4fbe('0x2'));var config=require(_0x4fbe('0x3'));var db=require('../../mysqldb')['db'];config[_0x4fbe('0x4')]=_[_0x4fbe('0x5')](config['redis'],{'host':_0x4fbe('0x6'),'port':0x18eb});var socket=require(_0x4fbe('0x7'))(new Redis(config[_0x4fbe('0x4')]));require(_0x4fbe('0x8'))['register'](socket);function respondWithStatusCode(_0x3add38,_0x45f39e){_0x45f39e=_0x45f39e||0xcc;return function(_0x8f91cb){if(_0x8f91cb){return _0x3add38['sendStatus'](_0x45f39e);}return _0x3add38[_0x4fbe('0x9')](_0x45f39e)[_0x4fbe('0xa')]();};}function respondWithResult(_0x19f210,_0x1bd862){_0x1bd862=_0x1bd862||0xc8;return function(_0x3b9bbe){if(_0x3b9bbe){return _0x19f210['status'](_0x1bd862)['json'](_0x3b9bbe);}};}function respondWithFilteredResult(_0x4afc68,_0x41d83a){return function(_0x5d0395){if(_0x5d0395){var _0x1cfc01=typeof _0x41d83a[_0x4fbe('0xb')]===_0x4fbe('0xc')&&typeof _0x41d83a[_0x4fbe('0xd')]===_0x4fbe('0xc');var _0x16c649=_0x5d0395['count'];var _0x583d8c=_0x1cfc01?0x0:_0x41d83a['offset'];var _0x1c3426=_0x1cfc01?_0x5d0395['count']:_0x41d83a[_0x4fbe('0xb')]+_0x41d83a[_0x4fbe('0xd')];var _0x1ebae3;if(_0x1c3426>=_0x16c649){_0x1c3426=_0x16c649;_0x1ebae3=0xc8;}else{_0x1ebae3=0xce;}_0x4afc68[_0x4fbe('0x9')](_0x1ebae3);return _0x4afc68[_0x4fbe('0xe')](_0x4fbe('0xf'),_0x583d8c+'-'+_0x1c3426+'/'+_0x16c649)['json'](_0x5d0395);}return null;};}function removeEntity(_0x3405a8){return function(_0x743e2a){if(_0x743e2a){return _0x743e2a[_0x4fbe('0x10')]()[_0x4fbe('0x11')](function(){var _0x5a9cec=_0x743e2a[_0x4fbe('0x12')]({'plain':!![]});var _0x3ee329=[{'name':_0x4fbe('0x13'),'value':_0x4fbe('0x14'),'ignore':![]},{'name':_0x4fbe('0x15'),'value':_0x4fbe('0x16'),'ignore':![]},{'name':_0x4fbe('0x17'),'value':_0x4fbe('0x18'),'ignore':![]}];var _0xf7075d=_(_0x3ee329)[_0x4fbe('0x19')](_0x4fbe('0x1a'))['map']('value')[_0x4fbe('0x1b')]();if(_[_0x4fbe('0x1c')](_0xf7075d,_0x5a9cec[_0x4fbe('0x1d')])){return;}var _0x1f2bb5=_[_0x4fbe('0x1e')](_0x3ee329,[_0x4fbe('0x1b'),_0x5a9cec[_0x4fbe('0x1d')]])[_0x4fbe('0x1f')];return db[_0x4fbe('0x20')]['destroy']({'where':{'type':_0x1f2bb5,'resourceId':_0x5a9cec['id']}})[_0x4fbe('0x11')](function(){return _0x743e2a;});})['then'](function(){_0x3405a8['status'](0xcc)[_0x4fbe('0xa')]();});}};}function handleEntityNotFound(_0x47884e){return function(_0x49fc94){if(!_0x49fc94){_0x47884e[_0x4fbe('0x21')](0x194);}return _0x49fc94;};}function handleError(_0x56eb72,_0x23eaff){_0x23eaff=_0x23eaff||0x1f4;return function(_0x3f0593){logger['error'](_0x3f0593[_0x4fbe('0x22')]);if(_0x3f0593[_0x4fbe('0x1f')]){delete _0x3f0593[_0x4fbe('0x1f')];}_0x56eb72[_0x4fbe('0x9')](_0x23eaff)[_0x4fbe('0x23')](_0x3f0593);};}exports[_0x4fbe('0x24')]=function(_0x2065e0,_0x4327c0){var _0x2d36c9={},_0x4c23ed={},_0x41e4b0={'count':0x0,'rows':[]};var _0x3725c9=_[_0x4fbe('0x25')](db['VoiceExtension'][_0x4fbe('0x26')],function(_0x16b8b4){return{'name':_0x16b8b4[_0x4fbe('0x27')],'type':_0x16b8b4[_0x4fbe('0x1d')][_0x4fbe('0x28')]};});_0x4c23ed['model']=_[_0x4fbe('0x25')](_0x3725c9,_0x4fbe('0x1f'));_0x4c23ed[_0x4fbe('0x29')]=_[_0x4fbe('0x2a')](_0x2065e0[_0x4fbe('0x29')]);_0x4c23ed[_0x4fbe('0x2b')]=_[_0x4fbe('0x2c')](_0x4c23ed[_0x4fbe('0x2d')],_0x4c23ed[_0x4fbe('0x29')]);_0x2d36c9[_0x4fbe('0x2e')]=_[_0x4fbe('0x2c')](_0x4c23ed[_0x4fbe('0x2d')],qs[_0x4fbe('0x2f')](_0x2065e0[_0x4fbe('0x29')]['fields']));_0x2d36c9['attributes']=_0x2d36c9[_0x4fbe('0x2e')][_0x4fbe('0x30')]?_0x2d36c9[_0x4fbe('0x2e')]:_0x4c23ed[_0x4fbe('0x2d')];if(!_0x2065e0['query'][_0x4fbe('0x31')]('nolimit')){_0x2d36c9[_0x4fbe('0xd')]=qs[_0x4fbe('0xd')](_0x2065e0['query'][_0x4fbe('0xd')]);_0x2d36c9[_0x4fbe('0xb')]=qs[_0x4fbe('0xb')](_0x2065e0['query'][_0x4fbe('0xb')]);}_0x2d36c9[_0x4fbe('0x32')]=qs[_0x4fbe('0x33')](_0x2065e0['query']['sort']);_0x2d36c9['where']=qs[_0x4fbe('0x2b')](_[_0x4fbe('0x34')](_0x2065e0[_0x4fbe('0x29')],_0x4c23ed['filters']),_0x3725c9);if(_0x2065e0[_0x4fbe('0x29')][_0x4fbe('0x19')]){_0x2d36c9[_0x4fbe('0x35')]=_[_0x4fbe('0x36')](_0x2d36c9[_0x4fbe('0x35')],{'$or':_[_0x4fbe('0x25')](_0x3725c9,function(_0x2b94b0){if(_0x2b94b0[_0x4fbe('0x1d')]!==_0x4fbe('0x37')){var _0xe15c10={};_0xe15c10[_0x2b94b0[_0x4fbe('0x1f')]]={'$like':'%'+_0x2065e0['query'][_0x4fbe('0x19')]+'%'};return _0xe15c10;}})});}_0x2d36c9=_[_0x4fbe('0x36')]({},_0x2d36c9,_0x2065e0[_0x4fbe('0x38')]);var _0x42980d={'where':_0x2d36c9[_0x4fbe('0x35')]};return db[_0x4fbe('0x39')][_0x4fbe('0x3a')](_0x42980d)['then'](function(_0x5598a7){_0x41e4b0[_0x4fbe('0x3a')]=_0x5598a7;if(_0x2065e0['query'][_0x4fbe('0x3b')]){_0x2d36c9[_0x4fbe('0x3c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x4fbe('0x3d')](_0x2d36c9);})[_0x4fbe('0x11')](function(_0x33b8b){_0x41e4b0[_0x4fbe('0x3e')]=_0x33b8b;return _0x41e4b0;})[_0x4fbe('0x11')](respondWithFilteredResult(_0x4327c0,_0x2d36c9))[_0x4fbe('0x3f')](handleError(_0x4327c0,null));};exports[_0x4fbe('0x40')]=function(_0x2b3b16,_0x22322a){var _0x35dd18={'raw':![],'where':{'id':_0x2b3b16[_0x4fbe('0x41')]['id']}},_0xb19d3f={};_0xb19d3f[_0x4fbe('0x2d')]=_[_0x4fbe('0x2a')](db[_0x4fbe('0x39')][_0x4fbe('0x26')]);_0xb19d3f[_0x4fbe('0x29')]=_['keys'](_0x2b3b16['query']);_0xb19d3f[_0x4fbe('0x2b')]=_[_0x4fbe('0x2c')](_0xb19d3f[_0x4fbe('0x2d')],_0xb19d3f[_0x4fbe('0x29')]);_0x35dd18[_0x4fbe('0x2e')]=_[_0x4fbe('0x2c')](_0xb19d3f[_0x4fbe('0x2d')],qs['fields'](_0x2b3b16['query']['fields']));_0x35dd18['attributes']=_0x35dd18['attributes'][_0x4fbe('0x30')]?_0x35dd18['attributes']:_0xb19d3f['model'];if(_0x2b3b16[_0x4fbe('0x29')][_0x4fbe('0x3b')]){_0x35dd18[_0x4fbe('0x3c')]=[{'all':!![]}];}_0x35dd18=_[_0x4fbe('0x36')]({},_0x35dd18,_0x2b3b16[_0x4fbe('0x38')]);return db[_0x4fbe('0x39')]['find'](_0x35dd18)[_0x4fbe('0x11')](handleEntityNotFound(_0x22322a,null))[_0x4fbe('0x11')](respondWithResult(_0x22322a,null))['catch'](handleError(_0x22322a,null));};exports[_0x4fbe('0x10')]=function(_0x33a2da,_0x557917){return db[_0x4fbe('0x39')][_0x4fbe('0x1e')]({'where':{'id':_0x33a2da[_0x4fbe('0x41')]['id']}})[_0x4fbe('0x11')](handleEntityNotFound(_0x557917,null))[_0x4fbe('0x11')](removeEntity(_0x557917,null))['catch'](handleError(_0x557917,null));};exports[_0x4fbe('0x42')]=function(_0xf56d9d,_0x51a62d){if(_0xf56d9d[_0x4fbe('0x43')][_0x4fbe('0x1d')]==='outbound'&&!_['startsWith'](_0xf56d9d['body']['exten'],'_')){_0xf56d9d[_0x4fbe('0x43')][_0x4fbe('0x44')]='_'['concat'](_0xf56d9d[_0x4fbe('0x43')][_0x4fbe('0x44')]);}return db['VoiceExtension'][_0x4fbe('0x42')](_0xf56d9d['body'],{'raw':![]})[_0x4fbe('0x11')](function(_0x48aec8){var _0xc683f1=_0xf56d9d['user'][_0x4fbe('0x12')]({'plain':!![]});if(!_0xc683f1)throw new Error(_0x4fbe('0x45'));if(_0xc683f1['role']==='user'){var _0x1641a6=_0x48aec8[_0x4fbe('0x12')]({'plain':!![]});var _0x11ea11=[{'name':'InboundRoutes','value':_0x4fbe('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x4fbe('0x17'),'value':_0x4fbe('0x18')}];var _0x5d2c6a=_[_0x4fbe('0x1e')](_0x11ea11,[_0x4fbe('0x1b'),_0x1641a6[_0x4fbe('0x1d')]])[_0x4fbe('0x1f')];return db[_0x4fbe('0x46')][_0x4fbe('0x1e')]({'where':{'name':_0x5d2c6a,'userProfileId':_0xc683f1['userProfileId']},'raw':!![]})[_0x4fbe('0x11')](function(_0xb2f303){if(_0xb2f303&&_0xb2f303[_0x4fbe('0x47')]===0x0){return db[_0x4fbe('0x20')]['create']({'name':_0x1641a6['name'],'resourceId':_0x1641a6['id'],'type':_0xb2f303[_0x4fbe('0x1f')],'sectionId':_0xb2f303['id']},{})[_0x4fbe('0x11')](function(){return _0x48aec8;});}else{return _0x48aec8;}})[_0x4fbe('0x3f')](function(_0x1bcc4b){logger[_0x4fbe('0x48')](_0x4fbe('0x49'),_0x1bcc4b);throw _0x1bcc4b;});}return _0x48aec8;})['then'](respondWithResult(_0x51a62d,0xc9))[_0x4fbe('0x3f')](handleError(_0x51a62d,null));};exports[_0x4fbe('0x4a')]=function(_0x387903,_0x1717da){if(_0x387903[_0x4fbe('0x43')]['id']){delete _0x387903[_0x4fbe('0x43')]['id'];}return db['VoiceExtension'][_0x4fbe('0x1e')]({'where':{'id':_0x387903[_0x4fbe('0x41')]['id']}})['then'](handleEntityNotFound(_0x1717da,null))[_0x4fbe('0x11')](function(_0x119d5e){if(_0x119d5e){return db[_0x4fbe('0x39')][_0x4fbe('0x4a')](_[_0x4fbe('0x34')](_0x387903[_0x4fbe('0x43')],[_0x4fbe('0x44'),_0x4fbe('0x4b'),'description',_0x4fbe('0x4c'),'cutdigits',_0x4fbe('0x4d'),'alias']),{'where':{'context':_0x119d5e[_0x4fbe('0x4b')],'exten':_0x119d5e[_0x4fbe('0x44')]},'individualHooks':!![]})['then'](function(_0x40e46b){return _0x40e46b;});}return null;})['then'](respondWithStatusCode(_0x1717da,null))['catch'](handleError(_0x1717da,null));};exports['addApplications']=function(_0x5a9421,_0x403ef1){var _0x48e707=_0x5a9421[_0x4fbe('0x41')]['id'];var _0x1178c8=_0x5a9421[_0x4fbe('0x43')];var _0x2a761d=0xc8;var _0x5d392d=null;return db['sequelize'][_0x4fbe('0x4e')]({'isolationLevel':db[_0x4fbe('0x4f')][_0x4fbe('0x50')][_0x4fbe('0x51')][_0x4fbe('0x52')]},function(_0x3a5523){return db[_0x4fbe('0x39')][_0x4fbe('0x53')]({'where':{'id':_0x48e707},'transaction':_0x3a5523})[_0x4fbe('0x11')](function(_0x162f7a){if(_0x162f7a){return db[_0x4fbe('0x39')][_0x4fbe('0x10')]({'where':{'VoiceExtensionId':_0x48e707},'transaction':_0x3a5523})[_0x4fbe('0x11')](function(){var _0x8ea93a=_[_0x4fbe('0x25')](_0x1178c8,function(_0x47bbb8){_0x47bbb8['VoiceExtensionId']=_0x48e707;_0x47bbb8['isApp']=!![];return _0x47bbb8;});return _0x162f7a[_0x4fbe('0x54')](_0x8ea93a);})[_0x4fbe('0x11')](function(_0x3634b6){return db['VoiceExtension'][_0x4fbe('0x55')](_0x3634b6,{'transaction':_0x3a5523});});}else{_0x2a761d=0x194;_0x5d392d=[];}});})[_0x4fbe('0x11')](function(){if(_0x2a761d!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x48e707},'order':'cast(priority\x20as\x20unsigned)'})[_0x4fbe('0x11')](function(_0x5c2085){_0x5d392d=_0x5c2085;});}})[_0x4fbe('0x3f')](function(_0x24a2ad){_0x2a761d=0x1f4;logger[_0x4fbe('0x48')](_0x24a2ad['stack']);if(_0x24a2ad[_0x4fbe('0x1f')]){delete _0x24a2ad[_0x4fbe('0x1f')];}_0x5d392d=_0x24a2ad;})[_0x4fbe('0x56')](function(){if(_0x5d392d===null){_0x403ef1[_0x4fbe('0x21')](_0x2a761d);}else{if(_0x2a761d===0x1f4){_0x403ef1['status'](_0x2a761d)[_0x4fbe('0x23')](_0x5d392d);}else{_0x403ef1[_0x4fbe('0x9')](_0x2a761d)[_0x4fbe('0x57')](_0x5d392d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5784809..ebd555f 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 _0x9e4a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0x47ad67,_0x488da1){var _0x22834b=function(_0x30106e){while(--_0x30106e){_0x47ad67['push'](_0x47ad67['shift']());}};_0x22834b(++_0x488da1);}(_0x9e4a,0x76));var _0xa9e4=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x9e4a[_0x565ed7];return _0x183ad7;};'use strict';var EventEmitter=require(_0xa9e4('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xa9e4('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa9e4('0x2')](0x0);var events={'afterCreate':_0xa9e4('0x3'),'afterUpdate':_0xa9e4('0x4'),'afterDestroy':_0xa9e4('0x5')};function emitEvent(_0x2b37ae){return function(_0x50795a,_0x12b3b0,_0x3ea697){VoiceExtensionEvents[_0xa9e4('0x6')](_0x2b37ae+':'+_0x50795a['id'],_0x50795a);VoiceExtensionEvents[_0xa9e4('0x6')](_0x2b37ae,_0x50795a);_0x3ea697(null);};}for(var e in events){if(events[_0xa9e4('0x7')](e)){var event=events[e];VoiceExtension[_0xa9e4('0x8')](e,emitEvent(event));}}module[_0xa9e4('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x885b=['exports','../../mysqldb','VoiceExtension','update','remove','emit','hook'];(function(_0x31e81,_0x466556){var _0x3e9ec8=function(_0xac22a5){while(--_0xac22a5){_0x31e81['push'](_0x31e81['shift']());}};_0x3e9ec8(++_0x466556);}(_0x885b,0x9b));var _0xb885=function(_0x13bb2a,_0x1fee97){_0x13bb2a=_0x13bb2a-0x0;var _0x5e39ba=_0x885b[_0x13bb2a];return _0x5e39ba;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb885('0x0'))['db'][_0xb885('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb885('0x2'),'afterDestroy':_0xb885('0x3')};function emitEvent(_0x207c2a){return function(_0x2bf4f6,_0x99dc21,_0x303601){VoiceExtensionEvents[_0xb885('0x4')](_0x207c2a+':'+_0x2bf4f6['id'],_0x2bf4f6);VoiceExtensionEvents['emit'](_0x207c2a,_0x2bf4f6);_0x303601(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb885('0x5')](e,emitEvent(event));}}module[_0xb885('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 83e754a..cf0d6db 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 _0xa8c4=['wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x17fdf1,_0xd819ae){_0x17fdf1=_0x17fdf1-0x0;var _0x50cfec=_0xa8c4[_0x17fdf1];return _0x50cfec;};'use strict';var _=require('lodash');var attributes=require(_0x4a8c('0x0'));module[_0x4a8c('0x1')]=function(_0x5cb13b){var _0xcd762c=_0x5cb13b[_0x4a8c('0x2')];function _0x4ddf3b(_0x2bbcab){var _0x402ceb=0x2;var _0x3eb6cf=[{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x5')+_0x2bbcab[_0x4a8c('0x3')],'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x2bbcab['alias']?_0x4a8c('0x4'):_0x4a8c('0x8'),'appdata':_0x2bbcab[_0x4a8c('0x9')]?_0x4a8c('0xa')+_0x2bbcab[_0x4a8c('0x9')]:_0x4a8c('0xb'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']}];if(_0x2bbcab['type']===_0x4a8c('0xc')){_0x3eb6cf['push']({'type':'inbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xd')+_0x2bbcab['id'],'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']});}_0x3eb6cf[_0x4a8c('0xe')]({'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xf'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab['exten'],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x10'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x11'),'context':_0x2bbcab['context'],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']});return _0x3eb6cf;}function _0x3cf5aa(_0x48c327){var _0x473847=0x2;var _0x13de46=[{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':'CDR(type)=outbound','context':_0x48c327['context'],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x48c327[_0x4a8c('0x9')]?_0x4a8c('0x4'):_0x4a8c('0x8'),'appdata':_0x48c327['alias']?_0x4a8c('0xa')+_0x48c327[_0x4a8c('0x9')]:_0x4a8c('0xb'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x13')+(_0x48c327[_0x4a8c('0x14')]?_0x4a8c('0x15')+_0x48c327[_0x4a8c('0x14')]+'}':'${EXTEN}'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xd')+_0x48c327['id'],'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x16'),'appdata':_0x4a8c('0x17')+(_0x473847+0x2)+_0x4a8c('0x18')+(_0x473847+0x1)+')','context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x48c327['cutdigits']?_0x4a8c('0x19')+_0x48c327[_0x4a8c('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x48c327['context'],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xf'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x11'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x1a')+_0x48c327['id'],'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']}];if(_0x48c327[_0x4a8c('0x1b')](_0x4a8c('0x1c'))&&_0x48c327['recordingFormat']!==_0x4a8c('0x1d')){_0x13de46['push']({'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48c327['context'],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x1e')+_0x48c327['recordingFormat']||_0x4a8c('0x1f'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']});}return _0x13de46;}function _0x1a3ce3(_0xde5ddd,_0x30e8e){var _0x2e9c38=[{'name':_0x4a8c('0x20'),'param':0x0},{'name':_0x4a8c('0x21'),'param':0x1},{'name':_0x4a8c('0x22'),'param':0x2},{'name':_0x4a8c('0x23'),'param':0x3}];var _0x337e2f={};var _0x297cb0=_0x30e8e['split'](',');var _0x5e1dc2=[];for(var _0x4782af=0x0;_0x4782af<_0x2e9c38[_0x4a8c('0x24')];_0x4782af++){switch(_0x2e9c38[_0x4782af][_0x4a8c('0x25')]){case _0x4a8c('0x20'):_0x337e2f[_0x4a8c('0x20')]=_0x297cb0[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]][_0x4a8c('0x27')]('/')[0x1];_0x337e2f[_0x4a8c('0x28')]=_0x297cb0[_0x2e9c38[_0x4782af]['param']][_0x4a8c('0x27')]('/')[0x2];_0x337e2f['prefix']=_0x337e2f['phone']?_0x337e2f['phone']['split']('$')[0x0]:undefined;_0x337e2f[_0x4a8c('0x28')]=_0xde5ddd['cutdigits']?(_0x337e2f[_0x4a8c('0x29')]||'')+_0x4a8c('0x15')+_0xde5ddd[_0x4a8c('0x14')]+'}':(_0x337e2f[_0x4a8c('0x29')]||'')+'${EXTEN}';_0x5e1dc2[_0x2e9c38[_0x4782af]['param']]=[_0x4a8c('0x2a'),_0x337e2f[_0x4a8c('0x20')],_0x337e2f[_0x4a8c('0x28')]]['join']('/');break;case'options':_0x337e2f[_0x4a8c('0x22')]=_0x297cb0[_0x2e9c38[_0x4782af]['param']];if(_0xde5ddd[_0x4a8c('0x1c')]!==_0x4a8c('0x1d')){if(_0x337e2f[_0x4a8c('0x22')][_0x4a8c('0x2b')](_0x4a8c('0x2c'))<0x0){_0x337e2f[_0x4a8c('0x22')]+=_0x4a8c('0x2c');}}else{_0x337e2f[_0x4a8c('0x22')]=_0x337e2f[_0x4a8c('0x22')]['replace'](_0x4a8c('0x2c'),'');}_0x5e1dc2[_0x2e9c38[_0x4782af]['param']]=_0x337e2f[_0x4a8c('0x22')];break;default:_0x5e1dc2[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]]=_0x297cb0[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]];}}return _0x5e1dc2[_0x4a8c('0x2d')](',');}function _0x17333a(_0x2f0c30,_0x5812f4,_0x53289a){return new Promise(function(_0x3ec08b,_0xc9af98){var _0x1c4afe=[];if(_[_0x4a8c('0x2e')](_0x5812f4))return _0x3ec08b(_0x1c4afe);_0xcd762c[_0x4a8c('0x2f')][_0x4a8c('0x30')]({'attributes':['id',_0x4a8c('0x31'),_0x4a8c('0x32')],'raw':!![]})[_0x4a8c('0x33')](function(_0x1ba212){for(var _0x19ca7a=0x0,_0xd4c801=0x0;_0x19ca7a<_0x5812f4['length'];_0x19ca7a++,_0xd4c801=0x0){var _0x250b13=_0x5812f4[_0x19ca7a];var _0x993279=[];var _0x305072=[];delete _0x250b13['id'];if(_0x250b13[_0x4a8c('0x31')]!==_0x4a8c('0x34')){_0x250b13['intervals']=[_0x250b13[_0x4a8c('0x31')]];}else{_0x250b13[_0x4a8c('0x35')]=_0x250b13[_0x4a8c('0x32')]?_[_0x4a8c('0x36')](_[_0x4a8c('0x37')](_0x1ba212,{'IntervalId':_0x250b13[_0x4a8c('0x32')]}),_0x4a8c('0x31')):[];}_0x250b13[_0x4a8c('0x6')]=_0x2f0c30['context'];_0x250b13[_0x4a8c('0x7')]=_0x2f0c30[_0x4a8c('0x7')];if(_0x250b13[_0x4a8c('0x3')])_0x250b13[_0x4a8c('0x3')]=_0x250b13['type'][_0x4a8c('0x38')]();if(_0x2f0c30[_0x4a8c('0x3')]==='outbound'){if(_0x250b13[_0x4a8c('0x1b')](_0x4a8c('0x39'))&&_0x250b13[_0x4a8c('0x39')]&&_0x250b13[_0x4a8c('0x39')]!=='--'){_0x993279[_0x4a8c('0xe')]({'type':_0x250b13['type'][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x3a')+_0x250b13[_0x4a8c('0x39')],'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}_0x993279['push']({'type':_0x250b13[_0x4a8c('0x3')]['toLowerCase'](),'app':_0x4a8c('0x16'),'appdata':_0x4a8c('0x3b')+(_0x250b13[_0x4a8c('0x3c')]?_0x4a8c('0x3d')+_0x250b13['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}else{if(_0x250b13['hasOwnProperty'](_0x4a8c('0x3e'))){if(['queue',_0x4a8c('0x3f')][_0x4a8c('0x40')](_0x250b13[_0x4a8c('0x41')]['toLowerCase']())&&_0x250b13[_0x4a8c('0x42')]!==_0x4a8c('0x43')){if(_0x250b13[_0x4a8c('0x3e')]){_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':_0x4a8c('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')]['length']+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});_0x993279['push']({'type':_0x250b13['type'][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x44'),'context':_0x2f0c30['context'],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}else{_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':'ExecIf','appdata':_0x4a8c('0x45'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x46'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13['intervals']['length']+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}}}}for(var _0x4b97a2=0x0;_0x4b97a2<_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')];_0x4b97a2++){var _0xe5f774=_0x53289a+_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')];var _0x158eda=_0x4b97a2===_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]-0x1?_0x53289a+_0x993279[_0x4a8c('0x24')]+_0x305072['length']+0x2:_0x53289a+_0x4b97a2+0x1;_0x993279[_0x4a8c('0x47')](_0x4b97a2,0x0,{'type':_0x2f0c30[_0x4a8c('0x3')],'app':'GotoIfTime','appdata':_0x250b13[_0x4a8c('0x35')][_0x4b97a2]+'?'+_0x2f0c30[_0x4a8c('0x6')]+_0x4a8c('0x48')+_0xe5f774+':'+_0x2f0c30['context']+_0x4a8c('0x48')+_0x158eda,'exten':_0x2f0c30[_0x4a8c('0x7')],'context':_0x2f0c30['context'],'priority':_0x53289a+_0x4b97a2,'VoiceExtensionId':_0x2f0c30['id']});}if(_0x250b13[_0x4a8c('0x42')]==='outboundDial')_0x250b13['appdata']=_0x1a3ce3(_0x2f0c30,_0x250b13[_0x4a8c('0x49')]);_0x250b13[_0x4a8c('0x4a')]=_0x993279[_0x4a8c('0x24')]?_[_0x4a8c('0x4b')](_0x993279)[_0x4a8c('0x4a')]+0x1:_0x53289a;_0x1c4afe=_[_0x4a8c('0x4c')](_0x1c4afe,_0x993279,[_0x250b13],_0x305072);_0x53289a=_[_0x4a8c('0x4b')](_0x1c4afe)[_0x4a8c('0x4a')]+0x1;}return _0x3ec08b(_0x1c4afe);})[_0x4a8c('0x4d')](function(_0x28407d){_0xc9af98(_0x28407d);});});}return _0x5cb13b[_0x4a8c('0x4e')](_0x4a8c('0x4f'),attributes,{'tableName':_0x4a8c('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x16c724){var _0x1107cd=this[_0x4a8c('0x51')]({'plain':!![]});var _0x34147f=_0x1107cd[_0x4a8c('0x3')]===_0x4a8c('0x12')?_0x3cf5aa(_0x1107cd):_0x4ddf3b(_0x1107cd);return _0x17333a(_0x1107cd,_0x16c724,_[_0x4a8c('0x4b')](_0x34147f)[_0x4a8c('0x4a')]+0x1)[_0x4a8c('0x33')](function(_0xf954e4){var _0x9ce21d=_[_0x4a8c('0x4c')](_0x34147f,_0xf954e4);_0x9ce21d[_0x4a8c('0xe')]({'type':_0x1107cd[_0x4a8c('0x3')],'app':_0x4a8c('0x52'),'exten':_0x1107cd['exten'],'context':_0x1107cd[_0x4a8c('0x6')],'priority':_['last'](_0x9ce21d)[_0x4a8c('0x4a')]+0x1,'VoiceExtensionId':_0x1107cd['id']});return _0x9ce21d;});}}});}; \ No newline at end of file +var _0x394e=['CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN}','join','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','appType','outboundDial','last','priority','concat','catch','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','outbound','CDR(routeAlias)='];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x394e,0x88));var _0xe394=function(_0x1a8132,_0x1d4978){_0x1a8132=_0x1a8132-0x0;var _0x5b9329=_0x394e[_0x1a8132];return _0x5b9329;};'use strict';var _=require(_0xe394('0x0'));var attributes=require(_0xe394('0x1'));module['exports']=function(_0x6a6330){var _0x192a4e=_0x6a6330[_0xe394('0x2')];function _0x1a96cc(_0x5640e5){var _0x4269f4=0x2;var _0x35c5de=[{'type':_0x5640e5[_0xe394('0x3')],'app':_0xe394('0x4'),'appdata':_0xe394('0x5')+_0x5640e5[_0xe394('0x3')],'context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5[_0xe394('0x7')],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']},{'type':_0x5640e5[_0xe394('0x3')],'app':_0x5640e5[_0xe394('0x8')]?_0xe394('0x4'):'NoOp','appdata':_0x5640e5['alias']?'CDR(routeAlias)='+_0x5640e5[_0xe394('0x8')]:_0xe394('0x9'),'context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5[_0xe394('0x7')],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']}];if(_0x5640e5[_0xe394('0x3')]===_0xe394('0xa')){_0x35c5de[_0xe394('0xb')]({'type':_0xe394('0xa'),'app':_0xe394('0x4'),'appdata':_0xe394('0xc')+_0x5640e5['id'],'context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5[_0xe394('0x7')],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']});}_0x35c5de['push']({'type':_0x5640e5['type'],'app':'Set','appdata':_0xe394('0xd'),'context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5['exten'],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']},{'type':_0x5640e5[_0xe394('0x3')],'app':_0xe394('0x4'),'appdata':_0xe394('0xe'),'context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5[_0xe394('0x7')],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']},{'type':_0x5640e5[_0xe394('0x3')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5640e5[_0xe394('0x6')],'exten':_0x5640e5[_0xe394('0x7')],'priority':_0x4269f4++,'VoiceExtensionId':_0x5640e5['id']});return _0x35c5de;}function _0x3f11e7(_0x38cf2c){var _0x4a7a5b=0x2;var _0x507392=[{'type':'outbound','app':_0xe394('0x4'),'appdata':_0xe394('0xf'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c['exten'],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0x38cf2c[_0xe394('0x8')]?_0xe394('0x4'):'NoOp','appdata':_0x38cf2c[_0xe394('0x8')]?_0xe394('0x11')+_0x38cf2c[_0xe394('0x8')]:_0xe394('0x9'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0xe394('0x4'),'appdata':_0xe394('0x12')+(_0x38cf2c[_0xe394('0x13')]?_0xe394('0x14')+_0x38cf2c[_0xe394('0x13')]+'}':'${EXTEN}'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0xe394('0x4'),'appdata':_0xe394('0xc')+_0x38cf2c['id'],'context':_0x38cf2c['context'],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0xe394('0x15'),'appdata':_0xe394('0x16')+(_0x4a7a5b+0x2)+'):Goto('+(_0x4a7a5b+0x1)+')','context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0xe394('0x4'),'appdata':_0x38cf2c[_0xe394('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x38cf2c[_0xe394('0x13')]+'}':_0xe394('0x17'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':_0xe394('0x4'),'appdata':_0xe394('0xd'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':'outbound','app':_0xe394('0x4'),'appdata':_0xe394('0xe'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':'Set','appdata':_0xe394('0x18')+_0x38cf2c['id'],'context':_0x38cf2c['context'],'exten':_0x38cf2c['exten'],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']}];if(_0x38cf2c[_0xe394('0x19')](_0xe394('0x1a'))&&_0x38cf2c[_0xe394('0x1a')]!==_0xe394('0x1b')){_0x507392[_0xe394('0xb')]({'type':_0xe394('0x10'),'app':_0xe394('0x4'),'appdata':_0xe394('0x1c'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']},{'type':_0xe394('0x10'),'app':'Set','appdata':_0xe394('0x1d')+_0x38cf2c[_0xe394('0x1a')]||_0xe394('0x1e'),'context':_0x38cf2c[_0xe394('0x6')],'exten':_0x38cf2c[_0xe394('0x7')],'priority':_0x4a7a5b++,'VoiceExtensionId':_0x38cf2c['id']});}return _0x507392;}function _0xa16b5a(_0x48381a,_0x4beed1){var _0x33d225=[{'name':_0xe394('0x1f'),'param':0x0},{'name':_0xe394('0x20'),'param':0x1},{'name':_0xe394('0x21'),'param':0x2},{'name':_0xe394('0x22'),'param':0x3}];var _0x278bca={};var _0x376dee=_0x4beed1[_0xe394('0x23')](',');var _0x2e3a1e=[];for(var _0x1fa755=0x0;_0x1fa755<_0x33d225[_0xe394('0x24')];_0x1fa755++){switch(_0x33d225[_0x1fa755][_0xe394('0x25')]){case _0xe394('0x1f'):_0x278bca[_0xe394('0x1f')]=_0x376dee[_0x33d225[_0x1fa755][_0xe394('0x26')]]['split']('/')[0x1];_0x278bca[_0xe394('0x27')]=_0x376dee[_0x33d225[_0x1fa755][_0xe394('0x26')]][_0xe394('0x23')]('/')[0x2];_0x278bca[_0xe394('0x28')]=_0x278bca[_0xe394('0x27')]?_0x278bca['phone']['split']('$')[0x0]:undefined;_0x278bca[_0xe394('0x27')]=_0x48381a['cutdigits']?(_0x278bca[_0xe394('0x28')]||'')+_0xe394('0x14')+_0x48381a[_0xe394('0x13')]+'}':(_0x278bca['prefix']||'')+_0xe394('0x29');_0x2e3a1e[_0x33d225[_0x1fa755]['param']]=['SIP',_0x278bca[_0xe394('0x1f')],_0x278bca[_0xe394('0x27')]][_0xe394('0x2a')]('/');break;case'options':_0x278bca[_0xe394('0x21')]=_0x376dee[_0x33d225[_0x1fa755][_0xe394('0x26')]];if(_0x48381a['recordingFormat']!==_0xe394('0x1b')){if(_0x278bca[_0xe394('0x21')]['indexOf'](_0xe394('0x2b'))<0x0){_0x278bca[_0xe394('0x21')]+=_0xe394('0x2b');}}else{_0x278bca[_0xe394('0x21')]=_0x278bca[_0xe394('0x21')]['replace'](_0xe394('0x2b'),'');}_0x2e3a1e[_0x33d225[_0x1fa755][_0xe394('0x26')]]=_0x278bca['options'];break;default:_0x2e3a1e[_0x33d225[_0x1fa755]['param']]=_0x376dee[_0x33d225[_0x1fa755][_0xe394('0x26')]];}}return _0x2e3a1e[_0xe394('0x2a')](',');}function _0x1b1b68(_0x20ff81,_0x595778,_0x9589f){return new Promise(function(_0x1cba48,_0x1e5623){var _0x255947=[];if(_[_0xe394('0x2c')](_0x595778))return _0x1cba48(_0x255947);_0x192a4e['Interval'][_0xe394('0x2d')]({'attributes':['id',_0xe394('0x2e'),_0xe394('0x2f')],'raw':!![]})[_0xe394('0x30')](function(_0x523422){for(var _0x5aa73c=0x0,_0x29daea=0x0;_0x5aa73c<_0x595778[_0xe394('0x24')];_0x5aa73c++,_0x29daea=0x0){var _0x54da74=_0x595778[_0x5aa73c];var _0x4541da=[];var _0x1c6ddc=[];delete _0x54da74['id'];if(_0x54da74['interval']!==_0xe394('0x31')){_0x54da74[_0xe394('0x32')]=[_0x54da74[_0xe394('0x2e')]];}else{_0x54da74[_0xe394('0x32')]=_0x54da74[_0xe394('0x2f')]?_[_0xe394('0x33')](_[_0xe394('0x34')](_0x523422,{'IntervalId':_0x54da74[_0xe394('0x2f')]}),_0xe394('0x2e')):[];}_0x54da74['context']=_0x20ff81['context'];_0x54da74[_0xe394('0x7')]=_0x20ff81[_0xe394('0x7')];if(_0x54da74[_0xe394('0x3')])_0x54da74['type']=_0x54da74[_0xe394('0x3')]['toLowerCase']();if(_0x20ff81['type']===_0xe394('0x10')){if(_0x54da74[_0xe394('0x19')]('tag')&&_0x54da74[_0xe394('0x35')]&&_0x54da74['tag']!=='--'){_0x4541da['push']({'type':_0x54da74['type'][_0xe394('0x36')](),'app':_0xe394('0x4'),'appdata':'CDR(tag)='+_0x54da74[_0xe394('0x35')],'context':_0x20ff81['context'],'exten':_0x20ff81[_0xe394('0x7')],'priority':_0x54da74[_0xe394('0x32')][_0xe394('0x24')]+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});}_0x4541da[_0xe394('0xb')]({'type':_0x54da74[_0xe394('0x3')][_0xe394('0x36')](),'app':_0xe394('0x15'),'appdata':_0xe394('0x37')+(_0x54da74[_0xe394('0x38')]?_0xe394('0x39')+_0x54da74[_0xe394('0x38')]+')':_0xe394('0x3a')),'context':_0x20ff81[_0xe394('0x6')],'exten':_0x20ff81[_0xe394('0x7')],'priority':_0x54da74['intervals']['length']+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});}else{if(_0x54da74[_0xe394('0x19')](_0xe394('0x3b'))){if([_0xe394('0x3c'),'playback']['includes'](_0x54da74['app'][_0xe394('0x36')]())&&_0x54da74['appType']!==_0xe394('0x3d')){if(_0x54da74['answer']){_0x4541da[_0xe394('0xb')]({'type':_0x54da74[_0xe394('0x3')][_0xe394('0x36')](),'app':_0xe394('0x15'),'appdata':_0xe394('0x3e'),'context':_0x20ff81[_0xe394('0x6')],'exten':_0x20ff81[_0xe394('0x7')],'priority':_0x54da74[_0xe394('0x32')][_0xe394('0x24')]+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});_0x4541da[_0xe394('0xb')]({'type':_0x54da74[_0xe394('0x3')][_0xe394('0x36')](),'app':'Set','appdata':_0xe394('0x3f'),'context':_0x20ff81[_0xe394('0x6')],'exten':_0x20ff81[_0xe394('0x7')],'priority':_0x54da74[_0xe394('0x32')]['length']+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});}else{_0x4541da[_0xe394('0xb')]({'type':_0x54da74[_0xe394('0x3')][_0xe394('0x36')](),'app':'ExecIf','appdata':_0xe394('0x40'),'context':_0x20ff81[_0xe394('0x6')],'exten':_0x20ff81['exten'],'priority':_0x54da74[_0xe394('0x32')][_0xe394('0x24')]+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});_0x4541da[_0xe394('0xb')]({'type':_0x54da74[_0xe394('0x3')][_0xe394('0x36')](),'app':_0xe394('0x4'),'appdata':_0xe394('0x41'),'context':_0x20ff81[_0xe394('0x6')],'exten':_0x20ff81[_0xe394('0x7')],'priority':_0x54da74['intervals'][_0xe394('0x24')]+_0x9589f+_0x29daea++,'VoiceExtensionId':_0x20ff81['id']});}}}}for(var _0x8f289d=0x0;_0x8f289d<_0x54da74['intervals'][_0xe394('0x24')];_0x8f289d++){var _0x573799=_0x9589f+_0x54da74['intervals']['length'];var _0x364fe0=_0x8f289d===_0x54da74['intervals']['length']-0x1?_0x9589f+_0x4541da[_0xe394('0x24')]+_0x1c6ddc['length']+0x2:_0x9589f+_0x8f289d+0x1;_0x4541da[_0xe394('0x42')](_0x8f289d,0x0,{'type':_0x20ff81[_0xe394('0x3')],'app':_0xe394('0x43'),'appdata':_0x54da74['intervals'][_0x8f289d]+'?'+_0x20ff81[_0xe394('0x6')]+',${EXTEN},'+_0x573799+':'+_0x20ff81[_0xe394('0x6')]+',${EXTEN},'+_0x364fe0,'exten':_0x20ff81[_0xe394('0x7')],'context':_0x20ff81[_0xe394('0x6')],'priority':_0x9589f+_0x8f289d,'VoiceExtensionId':_0x20ff81['id']});}if(_0x54da74[_0xe394('0x44')]===_0xe394('0x45'))_0x54da74['appdata']=_0xa16b5a(_0x20ff81,_0x54da74['appdata']);_0x54da74['priority']=_0x4541da[_0xe394('0x24')]?_[_0xe394('0x46')](_0x4541da)[_0xe394('0x47')]+0x1:_0x9589f;_0x255947=_[_0xe394('0x48')](_0x255947,_0x4541da,[_0x54da74],_0x1c6ddc);_0x9589f=_[_0xe394('0x46')](_0x255947)[_0xe394('0x47')]+0x1;}return _0x1cba48(_0x255947);})[_0xe394('0x49')](function(_0x2c64a9){_0x1e5623(_0x2c64a9);});});}return _0x6a6330['define'](_0xe394('0x4a'),attributes,{'tableName':_0xe394('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x28b3ec){var _0x2f7b2c=this['get']({'plain':!![]});var _0x233d0f=_0x2f7b2c[_0xe394('0x3')]===_0xe394('0x10')?_0x3f11e7(_0x2f7b2c):_0x1a96cc(_0x2f7b2c);return _0x1b1b68(_0x2f7b2c,_0x28b3ec,_['last'](_0x233d0f)['priority']+0x1)[_0xe394('0x30')](function(_0x3ddfa8){var _0x195aed=_[_0xe394('0x48')](_0x233d0f,_0x3ddfa8);_0x195aed[_0xe394('0xb')]({'type':_0x2f7b2c['type'],'app':_0xe394('0x4c'),'exten':_0x2f7b2c['exten'],'context':_0x2f7b2c[_0xe394('0x6')],'priority':_[_0xe394('0x46')](_0x195aed)[_0xe394('0x47')]+0x1,'VoiceExtensionId':_0x2f7b2c['id']});return _0x195aed;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9d8eb5c..28b4137 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 _0xbd0e=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xbd0e,0x187));var _0xebd0=function(_0xe485c4,_0x3d0f36){_0xe485c4=_0xe485c4-0x0;var _0x24cb58=_0xbd0e[_0xe485c4];return _0x24cb58;};'use strict';var _=require('lodash');var util=require(_0xebd0('0x0'));var moment=require('moment');var BPromise=require(_0xebd0('0x1'));var rs=require(_0xebd0('0x2'));var fs=require('fs');var Redis=require(_0xebd0('0x3'));var db=require(_0xebd0('0x4'))['db'];var utils=require(_0xebd0('0x5'));var logger=require(_0xebd0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xebd0('0x7'));var client=jayson[_0xebd0('0x8')][_0xebd0('0x9')]({'port':0x232a});config[_0xebd0('0xa')]=_[_0xebd0('0xb')](config[_0xebd0('0xa')],{'host':_0xebd0('0xc'),'port':0x18eb});var socket=require(_0xebd0('0xd'))(new Redis(config[_0xebd0('0xa')]));require('./voiceExtension.socket')[_0xebd0('0xe')](socket);function respondWithRpcPromise(_0x474bef,_0x2dbee9,_0x54b2a1){return new BPromise(function(_0xbec226,_0x1346d1){return client['request'](_0x474bef,_0x54b2a1)['then'](function(_0xb15b3e){logger[_0xebd0('0xf')](_0xebd0('0x10'),_0x2dbee9,_0xebd0('0x11'));logger[_0xebd0('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2dbee9,_0xebd0('0x11'),JSON[_0xebd0('0x13')](_0xb15b3e));if(_0xb15b3e[_0xebd0('0x14')]){if(_0xb15b3e['error'][_0xebd0('0x15')]===0x1f4){logger[_0xebd0('0x14')](_0xebd0('0x10'),_0x2dbee9,_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);return _0x1346d1(_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);}logger[_0xebd0('0x14')](_0xebd0('0x10'),_0x2dbee9,_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);return _0xbec226(_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);}else{logger[_0xebd0('0xf')](_0xebd0('0x10'),_0x2dbee9,'request\x20sent');_0xbec226(_0xb15b3e[_0xebd0('0x17')][_0xebd0('0x16')]);}})[_0xebd0('0x18')](function(_0x2834ad){logger['error'](_0xebd0('0x10'),_0x2dbee9,_0x2834ad);_0x1346d1(_0x2834ad);});});}exports[_0xebd0('0x19')]=function(_0x51774c){var _0x22bb7f=this;return new Promise(function(_0x4ef17f,_0x4720d5){return db[_0xebd0('0x1a')][_0xebd0('0x1b')]({'raw':_0x51774c[_0xebd0('0x1c')]?_0x51774c['options'][_0xebd0('0x1d')]===undefined?!![]:![]:!![],'where':_0x51774c['options']?_0x51774c[_0xebd0('0x1c')][_0xebd0('0x1e')]||null:null,'attributes':_0x51774c[_0xebd0('0x1c')]?_0x51774c['options'][_0xebd0('0x1f')]||null:null,'limit':_0x51774c[_0xebd0('0x1c')]?_0x51774c[_0xebd0('0x1c')]['limit']||null:null,'include':_0x51774c[_0xebd0('0x1c')]?_0x51774c[_0xebd0('0x1c')][_0xebd0('0x20')]?_[_0xebd0('0x21')](_0x51774c['options']['include'],function(_0x144f13){return{'model':db[_0x144f13[_0xebd0('0x22')]],'as':_0x144f13['as'],'attributes':_0x144f13[_0xebd0('0x1f')],'include':_0x144f13[_0xebd0('0x20')]?_[_0xebd0('0x21')](_0x144f13['include'],function(_0x411eb4){return{'model':db[_0x411eb4[_0xebd0('0x22')]],'as':_0x411eb4['as'],'attributes':_0x411eb4[_0xebd0('0x1f')],'include':_0x411eb4[_0xebd0('0x20')]?_[_0xebd0('0x21')](_0x411eb4['include'],function(_0x53169b){return{'model':db[_0x53169b['model']],'as':_0x53169b['as'],'attributes':_0x53169b['attributes']};}):[]};}):[]};}):[]:[]})[_0xebd0('0x23')](function(_0x3b9033){logger[_0xebd0('0xf')]('GetVoiceExtension',_0x51774c);logger['debug']('GetVoiceExtension',_0x51774c,JSON[_0xebd0('0x13')](_0x3b9033));_0x4ef17f(_0x3b9033);})[_0xebd0('0x18')](function(_0x30a12a){logger[_0xebd0('0x14')](_0xebd0('0x19'),_0x30a12a[_0xebd0('0x16')],_0x51774c);_0x4720d5(_0x22bb7f[_0xebd0('0x14')](0x1f4,_0x30a12a[_0xebd0('0x16')]));});});}; \ No newline at end of file +var _0x96aa=['redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','attributes','limit','map','include','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x96aa,0x67));var _0xa96a=function(_0x386a33,_0xe99b36){_0x386a33=_0x386a33-0x0;var _0x105537=_0x96aa[_0x386a33];return _0x105537;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require('moment');var BPromise=require(_0xa96a('0x2'));var rs=require(_0xa96a('0x3'));var fs=require('fs');var Redis=require(_0xa96a('0x4'));var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require('../../config/logger')(_0xa96a('0x7'));var config=require(_0xa96a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa96a('0x9')][_0xa96a('0xa')]({'port':0x232a});config[_0xa96a('0xb')]=_[_0xa96a('0xc')](config[_0xa96a('0xb')],{'host':_0xa96a('0xd'),'port':0x18eb});var socket=require(_0xa96a('0xe'))(new Redis(config[_0xa96a('0xb')]));require(_0xa96a('0xf'))[_0xa96a('0x10')](socket);function respondWithRpcPromise(_0x13321e,_0x4825fc,_0x33b786){return new BPromise(function(_0x5532f2,_0x234d1a){return client[_0xa96a('0x11')](_0x13321e,_0x33b786)['then'](function(_0x32393a){logger[_0xa96a('0x12')](_0xa96a('0x13'),_0x4825fc,_0xa96a('0x14'));logger[_0xa96a('0x15')](_0xa96a('0x16'),_0x4825fc,_0xa96a('0x14'),JSON[_0xa96a('0x17')](_0x32393a));if(_0x32393a[_0xa96a('0x18')]){if(_0x32393a[_0xa96a('0x18')][_0xa96a('0x19')]===0x1f4){logger[_0xa96a('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x4825fc,_0x32393a['error'][_0xa96a('0x1a')]);return _0x234d1a(_0x32393a['error'][_0xa96a('0x1a')]);}logger['error'](_0xa96a('0x13'),_0x4825fc,_0x32393a[_0xa96a('0x18')][_0xa96a('0x1a')]);return _0x5532f2(_0x32393a[_0xa96a('0x18')][_0xa96a('0x1a')]);}else{logger[_0xa96a('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x4825fc,_0xa96a('0x14'));_0x5532f2(_0x32393a[_0xa96a('0x1b')]['message']);}})[_0xa96a('0x1c')](function(_0x33298e){logger[_0xa96a('0x18')](_0xa96a('0x13'),_0x4825fc,_0x33298e);_0x234d1a(_0x33298e);});});}exports[_0xa96a('0x1d')]=function(_0x14c8e5){var _0x4e3f58=this;return new Promise(function(_0x190e94,_0x3f41ad){return db['VoiceExtension'][_0xa96a('0x1e')]({'raw':_0x14c8e5['options']?_0x14c8e5[_0xa96a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5[_0xa96a('0x1f')]['where']||null:null,'attributes':_0x14c8e5['options']?_0x14c8e5[_0xa96a('0x1f')][_0xa96a('0x20')]||null:null,'limit':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5[_0xa96a('0x1f')][_0xa96a('0x21')]||null:null,'include':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5['options']['include']?_[_0xa96a('0x22')](_0x14c8e5['options'][_0xa96a('0x23')],function(_0x44c4ee){return{'model':db[_0x44c4ee[_0xa96a('0x24')]],'as':_0x44c4ee['as'],'attributes':_0x44c4ee['attributes'],'include':_0x44c4ee[_0xa96a('0x23')]?_['map'](_0x44c4ee['include'],function(_0x4310a9){return{'model':db[_0x4310a9['model']],'as':_0x4310a9['as'],'attributes':_0x4310a9[_0xa96a('0x20')],'include':_0x4310a9[_0xa96a('0x23')]?_[_0xa96a('0x22')](_0x4310a9['include'],function(_0x1bb965){return{'model':db[_0x1bb965['model']],'as':_0x1bb965['as'],'attributes':_0x1bb965['attributes']};}):[]};}):[]};}):[]:[]})[_0xa96a('0x25')](function(_0x5576b9){logger['info'](_0xa96a('0x1d'),_0x14c8e5);logger[_0xa96a('0x15')]('GetVoiceExtension',_0x14c8e5,JSON[_0xa96a('0x17')](_0x5576b9));_0x190e94(_0x5576b9);})[_0xa96a('0x1c')](function(_0x472d59){logger[_0xa96a('0x18')](_0xa96a('0x1d'),_0x472d59['message'],_0x14c8e5);_0x3f41ad(_0x4e3f58[_0xa96a('0x18')](0x1f4,_0x472d59[_0xa96a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index edb1d60..fe7a309 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x32cb5e,_0x302fc5){var _0x27bd09=function(_0x3c33bc){while(--_0x3c33bc){_0x32cb5e['push'](_0x32cb5e['shift']());}};_0x27bd09(++_0x302fc5);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'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 +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x1cb9,0x14e));var _0x91cb=function(_0xf06b3b,_0x33752a){_0xf06b3b=_0xf06b3b-0x0;var _0x26e138=_0x1cb9[_0xf06b3b];return _0x26e138;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 50a39dc..05d326c 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 _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x15f459,_0x5a4c5c){var _0x11dcf8=function(_0x6f7994){while(--_0x6f7994){_0x15f459['push'](_0x15f459['shift']());}};_0x11dcf8(++_0x5a4c5c);}(_0x1893,0xa2));var _0x3189=function(_0xa87486,_0x5ff890){_0xa87486=_0xa87486-0x0;var _0x4fc6d5=_0x1893[_0xa87486];return _0x4fc6d5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x48122a,_0x53bc44){var _0x41146a=function(_0x1a8322){while(--_0x1a8322){_0x48122a['push'](_0x48122a['shift']());}};_0x41146a(++_0x53bc44);}(_0x524e,0x15e));var _0xe524=function(_0xa60413,_0x399249){_0xa60413=_0xa60413-0x0;var _0x3d3cf8=_0x524e[_0xa60413];return _0x3d3cf8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e3d131b..e7ab0f0 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 _0xe706=['STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','sequelize'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xe706,0x7d));var _0x6e70=function(_0xe80e5c,_0x38e90a){_0xe80e5c=_0xe80e5c-0x0;var _0x2bff61=_0xe706[_0xe80e5c];return _0x2bff61;};'use strict';var Sequelize=require(_0x6e70('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x6e70('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x6e70('0x1')],'defaultValue':'','allowNull':![],'unique':_0x6e70('0x3')},'password':{'type':Sequelize[_0x6e70('0x1')]},'fullname':{'type':Sequelize[_0x6e70('0x1')]},'email':{'type':Sequelize[_0x6e70('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1b905f){this[_0x6e70('0x4')]('email',typeof _0x1b905f===_0x6e70('0x5')&&_0x1b905f['trim']()?_0x1b905f[_0x6e70('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x6e70('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':_0x6e70('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6e70('0x7')]('yes','no'),'defaultValue':_0x6e70('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x6e70('0x1')]},'callback':{'type':Sequelize[_0x6e70('0x1')]},'review':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6e70('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6e70('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':_0x6e70('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6e70('0x7')](_0x6e70('0x8'),'no'),'defaultValue':_0x6e70('0x8'),'allowNull':![]},'stamp':{'type':_0x6e70('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x6e70('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6e70('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6e70('0xc')],'get':function(){return this[_0x6e70('0xd')]('fullname')+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0xc0c2=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x2cf303,_0x1f1459){var _0x41e668=function(_0x7ce39c){while(--_0x7ce39c){_0x2cf303['push'](_0x2cf303['shift']());}};_0x41e668(++_0x1f1459);}(_0xc0c2,0xe1));var _0x2c0c=function(_0x598efc,_0x5e971c){_0x598efc=_0x598efc-0x0;var _0x435e4f=_0xc0c2[_0x598efc];return _0x435e4f;};'use strict';var Sequelize=require(_0x2c0c('0x0'));module[_0x2c0c('0x1')]={'customer_id':{'type':Sequelize[_0x2c0c('0x2')]},'context':{'type':Sequelize[_0x2c0c('0x2')],'defaultValue':_0x2c0c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x2c0c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x2c0c('0x4')},'password':{'type':Sequelize[_0x2c0c('0x2')]},'fullname':{'type':Sequelize[_0x2c0c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5edca9){this[_0x2c0c('0x5')](_0x2c0c('0x6'),typeof _0x5edca9===_0x2c0c('0x7')&&_0x5edca9[_0x2c0c('0x8')]()?_0x5edca9[_0x2c0c('0x8')]():null);}},'pager':{'type':Sequelize[_0x2c0c('0x2')]},'tz':{'type':Sequelize[_0x2c0c('0x2')],'defaultValue':_0x2c0c('0x9')},'attach':{'type':Sequelize[_0x2c0c('0xa')]('yes','no'),'defaultValue':_0x2c0c('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2c0c('0xa')](_0x2c0c('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x2c0c('0x2')]},'review':{'type':Sequelize[_0x2c0c('0xa')](_0x2c0c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2c0c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2c0c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x2c0c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2c0c('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2c0c('0xa')](_0x2c0c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2c0c('0xa')](_0x2c0c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2c0c('0xa')](_0x2c0c('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x2c0c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x2c0c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x2c0c('0xb'),'no'),'defaultValue':_0x2c0c('0xb'),'allowNull':![]},'stamp':{'type':_0x2c0c('0xd')},'emailsubject':{'type':Sequelize[_0x2c0c('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x2c0c('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2c0c('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2c0c('0xf')],'get':function(){return this[_0x2c0c('0x10')](_0x2c0c('0x11'))+_0x2c0c('0x12')+this[_0x2c0c('0x10')](_0x2c0c('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c06128c..3d0934d 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 _0x6324=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','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','body','getMessages','findOne','rawAttributes','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x6324,0x142));var _0x4632=function(_0x1d2922,_0xdcb3e0){_0x1d2922=_0x1d2922-0x0;var _0x1d7211=_0x6324[_0x1d2922];return _0x1d7211;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':!![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x25')]=function(_0x32cd35,_0x6c2864){if(_0x32cd35[_0x4632('0x51')]['id']){delete _0x32cd35[_0x4632('0x51')]['id'];}return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x32cd35[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](saveUpdates(_0x32cd35[_0x4632('0x51')],null))[_0x4632('0x26')](respondWithResult(_0x6c2864,null))['catch'](handleError(_0x6c2864,null));};exports[_0x4632('0x27')]=function(_0x433fea,_0x41409d){return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x433fea[_0x4632('0x44')]['id']}})['then'](handleEntityNotFound(_0x41409d,null))[_0x4632('0x26')](removeEntity(_0x41409d,null))[_0x4632('0x42')](handleError(_0x41409d,null));};exports[_0x4632('0x52')]=function(_0x4b91cf,_0x3aeefd,_0x334a8e){return db[_0x4632('0x30')][_0x4632('0x53')]({'where':{'id':_0x4b91cf[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3aeefd,null))[_0x4632('0x26')](function(_0x4658de){var _0x2965df;var _0x3abcbf={},_0x58d39a={};_0x58d39a[_0x4632('0x37')]=_[_0x4632('0x33')](db['VoiceMailMessage'][_0x4632('0x54')]);_0x58d39a['query']=_['keys'](_0x4b91cf[_0x4632('0x34')]);_0x58d39a[_0x4632('0x35')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],_0x58d39a[_0x4632('0x34')]);_0x3abcbf[_0x4632('0x38')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],qs[_0x4632('0x45')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x45')]));_0x3abcbf[_0x4632('0x38')]=_0x3abcbf[_0x4632('0x38')][_0x4632('0x46')]?_0x3abcbf['attributes']:_0x58d39a['model'];if(!_0x4b91cf[_0x4632('0x34')][_0x4632('0x55')](_0x4632('0x39'))){_0x3abcbf[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x4b91cf[_0x4632('0x34')]['limit']);_0x3abcbf[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x1c')]);}_0x3abcbf['order']=qs['sort'](_0x4b91cf[_0x4632('0x34')]['sort']);_0x3abcbf[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x56')](_0x4b91cf[_0x4632('0x34')],_0x58d39a[_0x4632('0x35')]));if(_0x4b91cf['query'][_0x4632('0x3c')]){_0x3abcbf[_0x4632('0x3b')]=_['merge'](_0x3abcbf['where'],{'$or':_[_0x4632('0x2f')](_0x3abcbf[_0x4632('0x38')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x4b91cf['query']['filter']+'%'};return _0x3090d6;})});}_0x3abcbf['where']=_[_0x4632('0x3d')](_0x3abcbf['where'],{'mailboxuser':_0x4658de[_0x4632('0x57')]});_0x3abcbf=_[_0x4632('0x3d')]({},_0x3abcbf,_0x4b91cf[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x59')](_0x3abcbf)[_0x4632('0x26')](respondWithFilteredResult(_0x3aeefd,_0x3abcbf));})[_0x4632('0x42')](handleError(_0x3aeefd,null));}; \ No newline at end of file +var _0x63a5=['index','map','VoiceMail','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMessages','VoiceMailMessage','sort','pick','mailbox','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','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x2a257c,_0x156ff2){var _0x49125e=function(_0x3b7735){while(--_0x3b7735){_0x2a257c['push'](_0x2a257c['shift']());}};_0x49125e(++_0x156ff2);}(_0x63a5,0x18e));var _0x563a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x63a5[_0x3d42d8];return _0x27fc41;};'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'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['VoiceMail'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};exports[_0x563a('0x54')]=function(_0x16aa03,_0x3919a3,_0x1e275c){return db[_0x563a('0x31')]['findOne']({'where':{'id':_0x16aa03[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3919a3,null))['then'](function(_0x503896){var _0x402bdd;var _0x709bfd={},_0x579d61={};_0x579d61[_0x563a('0x35')]=_['keys'](db[_0x563a('0x55')][_0x563a('0x49')]);_0x579d61[_0x563a('0x36')]=_[_0x563a('0x48')](_0x16aa03[_0x563a('0x36')]);_0x579d61['filters']=_['intersection'](_0x579d61['model'],_0x579d61['query']);_0x709bfd[_0x563a('0x39')]=_['intersection'](_0x579d61[_0x563a('0x35')],qs['fields'](_0x16aa03[_0x563a('0x36')][_0x563a('0x3a')]));_0x709bfd[_0x563a('0x39')]=_0x709bfd[_0x563a('0x39')][_0x563a('0x3b')]?_0x709bfd['attributes']:_0x579d61[_0x563a('0x35')];if(!_0x16aa03['query']['hasOwnProperty'](_0x563a('0x3d'))){_0x709bfd[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1e')]);_0x709bfd['offset']=qs[_0x563a('0x1f')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1f')]);}_0x709bfd[_0x563a('0x3e')]=qs[_0x563a('0x56')](_0x16aa03['query'][_0x563a('0x56')]);_0x709bfd['where']=qs[_0x563a('0x37')](_[_0x563a('0x57')](_0x16aa03['query'],_0x579d61[_0x563a('0x37')]));if(_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]){_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'$or':_[_0x563a('0x30')](_0x709bfd[_0x563a('0x39')],function(_0x4cfa73){var _0x103c59={};_0x103c59[_0x4cfa73]={'$like':'%'+_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x103c59;})});}_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'mailboxuser':_0x503896[_0x563a('0x58')]});_0x709bfd=_['merge']({},_0x709bfd,_0x16aa03[_0x563a('0x42')]);return db['VoiceMailMessage']['findAndCountAll'](_0x709bfd)['then'](respondWithFilteredResult(_0x3919a3,_0x709bfd));})[_0x563a('0x45')](handleError(_0x3919a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d3f5b76..e1e83c4 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 _0x904b=['mailbox','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x904b,0xde));var _0xb904=function(_0x5e409c,_0x3f2e02){_0x5e409c=_0x5e409c-0x0;var _0x12668a=_0x904b[_0x5e409c];return _0x12668a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb904('0x0'))('api');var moment=require(_0xb904('0x1'));var BPromise=require(_0xb904('0x2'));var rp=require(_0xb904('0x3'));var fs=require('fs');var path=require(_0xb904('0x4'));var rimraf=require(_0xb904('0x5'));var config=require(_0xb904('0x6'));var attributes=require(_0xb904('0x7'));module[_0xb904('0x8')]=function(_0x1b45b0,_0x54c340){return _0x1b45b0['define'](_0xb904('0x9'),attributes,{'tableName':_0xb904('0xa'),'paranoid':![],'indexes':[{'name':_0xb904('0xb'),'fields':[_0xb904('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6719=['util','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','context','lodash'];(function(_0x1bb82d,_0x5b743a){var _0x361e95=function(_0x11b588){while(--_0x11b588){_0x1bb82d['push'](_0x1bb82d['shift']());}};_0x361e95(++_0x5b743a);}(_0x6719,0x16b));var _0x9671=function(_0x329485,_0x4f7e0d){_0x329485=_0x329485-0x0;var _0x3dd0bb=_0x6719[_0x329485];return _0x3dd0bb;};'use strict';var _=require(_0x9671('0x0'));var util=require(_0x9671('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9671('0x2'));var BPromise=require(_0x9671('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9671('0x4'));var rimraf=require(_0x9671('0x5'));var config=require(_0x9671('0x6'));var attributes=require(_0x9671('0x7'));module[_0x9671('0x8')]=function(_0x560dbc,_0x4d0540){return _0x560dbc[_0x9671('0x9')]('VoiceMail',attributes,{'tableName':_0x9671('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9671('0xb'),_0x9671('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9c40b14..0c5261b 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 _0xc2fe=['../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x501072,_0x34ce10){var _0x3eec6c=function(_0x16aee1){while(--_0x16aee1){_0x501072['push'](_0x501072['shift']());}};_0x3eec6c(++_0x34ce10);}(_0xc2fe,0x169));var _0xec2f=function(_0x4cf600,_0x361cb1){_0x4cf600=_0x4cf600-0x0;var _0xe754b7=_0xc2fe[_0x4cf600];return _0xe754b7;};'use strict';var _=require(_0xec2f('0x0'));var util=require(_0xec2f('0x1'));var moment=require(_0xec2f('0x2'));var BPromise=require(_0xec2f('0x3'));var rs=require(_0xec2f('0x4'));var fs=require('fs');var Redis=require(_0xec2f('0x5'));var db=require(_0xec2f('0x6'))['db'];var utils=require(_0xec2f('0x7'));var logger=require('../../config/logger')(_0xec2f('0x8'));var config=require(_0xec2f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xec2f('0xa')][_0xec2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaf7367,_0xf3d4c5,_0x2f3ad6){return new BPromise(function(_0x1e34aa,_0x2badb0){return client[_0xec2f('0xc')](_0xaf7367,_0x2f3ad6)[_0xec2f('0xd')](function(_0x31c37d){logger['info'](_0xec2f('0xe'),_0xf3d4c5,'request\x20sent');logger['debug'](_0xec2f('0xf'),_0xf3d4c5,'request\x20sent',JSON[_0xec2f('0x10')](_0x31c37d));if(_0x31c37d[_0xec2f('0x11')]){if(_0x31c37d[_0xec2f('0x11')][_0xec2f('0x12')]===0x1f4){logger[_0xec2f('0x11')](_0xec2f('0xe'),_0xf3d4c5,_0x31c37d[_0xec2f('0x11')][_0xec2f('0x13')]);return _0x2badb0(_0x31c37d['error'][_0xec2f('0x13')]);}logger[_0xec2f('0x11')](_0xec2f('0xe'),_0xf3d4c5,_0x31c37d[_0xec2f('0x11')][_0xec2f('0x13')]);return _0x1e34aa(_0x31c37d[_0xec2f('0x11')][_0xec2f('0x13')]);}else{logger['info'](_0xec2f('0xe'),_0xf3d4c5,_0xec2f('0x14'));_0x1e34aa(_0x31c37d[_0xec2f('0x15')][_0xec2f('0x13')]);}})[_0xec2f('0x16')](function(_0x5b46db){logger[_0xec2f('0x11')](_0xec2f('0xe'),_0xf3d4c5,_0x5b46db);_0x2badb0(_0x5b46db);});});} \ No newline at end of file +var _0xf9ac=['../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x392ee1,_0x3eed36){var _0x3d6fbe=function(_0x2165a7){while(--_0x2165a7){_0x392ee1['push'](_0x392ee1['shift']());}};_0x3d6fbe(++_0x3eed36);}(_0xf9ac,0x197));var _0xcf9a=function(_0x2bdc9d,_0x5ef92b){_0x2bdc9d=_0x2bdc9d-0x0;var _0x1ac0ba=_0xf9ac[_0x2bdc9d];return _0x1ac0ba;};'use strict';var _=require(_0xcf9a('0x0'));var util=require(_0xcf9a('0x1'));var moment=require(_0xcf9a('0x2'));var BPromise=require(_0xcf9a('0x3'));var rs=require(_0xcf9a('0x4'));var fs=require('fs');var Redis=require(_0xcf9a('0x5'));var db=require(_0xcf9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x7'))(_0xcf9a('0x8'));var config=require(_0xcf9a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d47f5,_0x5e83ed,_0x20c0bd){return new BPromise(function(_0x23ab32,_0x4c2245){return client[_0xcf9a('0xb')](_0x2d47f5,_0x20c0bd)[_0xcf9a('0xc')](function(_0x11c9be){logger[_0xcf9a('0xd')](_0xcf9a('0xe'),_0x5e83ed,_0xcf9a('0xf'));logger[_0xcf9a('0x10')](_0xcf9a('0x11'),_0x5e83ed,_0xcf9a('0xf'),JSON[_0xcf9a('0x12')](_0x11c9be));if(_0x11c9be['error']){if(_0x11c9be[_0xcf9a('0x13')][_0xcf9a('0x14')]===0x1f4){logger[_0xcf9a('0x13')](_0xcf9a('0xe'),_0x5e83ed,_0x11c9be[_0xcf9a('0x13')][_0xcf9a('0x15')]);return _0x4c2245(_0x11c9be['error'][_0xcf9a('0x15')]);}logger[_0xcf9a('0x13')](_0xcf9a('0xe'),_0x5e83ed,_0x11c9be[_0xcf9a('0x13')][_0xcf9a('0x15')]);return _0x23ab32(_0x11c9be[_0xcf9a('0x13')][_0xcf9a('0x15')]);}else{logger[_0xcf9a('0xd')](_0xcf9a('0xe'),_0x5e83ed,_0xcf9a('0xf'));_0x23ab32(_0x11c9be[_0xcf9a('0x16')][_0xcf9a('0x15')]);}})['catch'](function(_0x4b5888){logger[_0xcf9a('0x13')](_0xcf9a('0xe'),_0x5e83ed,_0x4b5888);_0x4c2245(_0x4b5888);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 762a152..41007f6 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 _0x2280=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download','download','post','create','put','/:id','delete','destroy'];(function(_0x45d704,_0x2e3604){var _0x3fcc20=function(_0x50fde2){while(--_0x50fde2){_0x45d704['push'](_0x45d704['shift']());}};_0x3fcc20(++_0x2e3604);}(_0x2280,0x1e5));var _0x0228=function(_0x1e2618,_0x2ad674){_0x1e2618=_0x1e2618-0x0;var _0x5d37d8=_0x2280[_0x1e2618];return _0x5d37d8;};'use strict';var multer=require(_0x0228('0x0'));var util=require(_0x0228('0x1'));var path=require(_0x0228('0x2'));var timeout=require(_0x0228('0x3'));var express=require(_0x0228('0x4'));var router=express['Router']();var fs_extra=require(_0x0228('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0228('0x6'));var config=require(_0x0228('0x7'));var controller=require(_0x0228('0x8'));router['get']('/',auth[_0x0228('0x9')](),controller[_0x0228('0xa')]);router[_0x0228('0xb')]('/:id',auth[_0x0228('0x9')](),controller[_0x0228('0xc')]);router[_0x0228('0xb')](_0x0228('0xd'),auth[_0x0228('0x9')](),controller[_0x0228('0xe')]);router[_0x0228('0xf')]('/',auth['isAuthenticated'](),controller[_0x0228('0x10')]);router[_0x0228('0x11')](_0x0228('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x0228('0x13')](_0x0228('0x12'),auth[_0x0228('0x9')](),controller[_0x0228('0x14')]);module[_0x0228('0x15')]=router; \ No newline at end of file +var _0xb078=['show','/:id/download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xb078,0x15d));var _0x8b07=function(_0x11a792,_0x2c6f5b){_0x11a792=_0x11a792-0x0;var _0x16217e=_0xb078[_0x11a792];return _0x16217e;};'use strict';var multer=require(_0x8b07('0x0'));var util=require(_0x8b07('0x1'));var path=require(_0x8b07('0x2'));var timeout=require(_0x8b07('0x3'));var express=require(_0x8b07('0x4'));var router=express['Router']();var fs_extra=require(_0x8b07('0x5'));var auth=require(_0x8b07('0x6'));var interaction=require(_0x8b07('0x7'));var config=require(_0x8b07('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x8b07('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b07('0xa')]);router[_0x8b07('0x9')]('/:id',auth[_0x8b07('0xb')](),controller[_0x8b07('0xc')]);router['get'](_0x8b07('0xd'),auth[_0x8b07('0xb')](),controller['download']);router[_0x8b07('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8b07('0xf')]);router[_0x8b07('0x10')]('/:id',auth[_0x8b07('0xb')](),controller[_0x8b07('0x11')]);module[_0x8b07('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index dbc869b..11d3714 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 _0x04e2=['getDataValue','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x20661,_0x220ac7){var _0x4a75e9=function(_0x2da026){while(--_0x2da026){_0x20661['push'](_0x20661['shift']());}};_0x4a75e9(++_0x220ac7);}(_0x04e2,0x1ae));var _0x204e=function(_0x5adb4a,_0x1d04aa){_0x5adb4a=_0x5adb4a-0x0;var _0x498769=_0x04e2[_0x5adb4a];return _0x498769;};'use strict';var Sequelize=require(_0x204e('0x0'));module['exports']={'name':{'type':Sequelize[_0x204e('0x1')],'get':function(_0x177cb6){return this[_0x204e('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x204e('0x4')](_0x204e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x204e('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x204e('0x6'),'defaultValue':Sequelize['literal'](_0x204e('0x7'))}}; \ No newline at end of file +var _0x127f=['exports','VIRTUAL','getDataValue','STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x10c427,_0x28c76c){var _0x1563c8=function(_0x24b884){while(--_0x24b884){_0x10c427['push'](_0x10c427['shift']());}};_0x1563c8(++_0x28c76c);}(_0x127f,0x177));var _0xf127=function(_0x378965,_0x24b336){_0x378965=_0x378965-0x0;var _0x264afa=_0x127f[_0x378965];return _0x264afa;};'use strict';var Sequelize=require(_0xf127('0x0'));module[_0xf127('0x1')]={'name':{'type':Sequelize[_0xf127('0x2')],'get':function(_0x562155){return this[_0xf127('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf127('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf127('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf127('0x6')](_0xf127('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a3f3a61..c75a6e0 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 _0x5672=['download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','params','keys','length','body','find'];(function(_0x1d66f7,_0x2a87ec){var _0x33f39c=function(_0xa76450){while(--_0xa76450){_0x1d66f7['push'](_0x1d66f7['shift']());}};_0x33f39c(++_0x2a87ec);}(_0x5672,0x102));var _0x2567=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x5672[_0x54381d];return _0x5308a7;};'use strict';var emlformat=require(_0x2567('0x0'));var rimraf=require(_0x2567('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2567('0x2'));var rp=require(_0x2567('0x3'));var moment=require(_0x2567('0x4'));var BPromise=require(_0x2567('0x5'));var Mustache=require(_0x2567('0x6'));var util=require(_0x2567('0x7'));var path=require(_0x2567('0x8'));var sox=require(_0x2567('0x9'));var csv=require('to-csv');var ejs=require(_0x2567('0xa'));var fs=require('fs');var fs_extra=require(_0x2567('0xb'));var _=require(_0x2567('0xc'));var squel=require(_0x2567('0xd'));var crypto=require(_0x2567('0xe'));var jsforce=require(_0x2567('0xf'));var deskjs=require(_0x2567('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2567('0x11'));var Papa=require(_0x2567('0x12'));var Redis=require(_0x2567('0x13'));var authService=require(_0x2567('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2567('0x15'));var hardwareService=require(_0x2567('0x16'));var logger=require(_0x2567('0x17'))(_0x2567('0x18'));var utils=require(_0x2567('0x19'));var config=require(_0x2567('0x1a'));var licenseUtil=require(_0x2567('0x1b'));var db=require(_0x2567('0x1c'))['db'];function respondWithStatusCode(_0x23edc8,_0x4722b9){_0x4722b9=_0x4722b9||0xcc;return function(_0x53a223){if(_0x53a223){return _0x23edc8[_0x2567('0x1d')](_0x4722b9);}return _0x23edc8[_0x2567('0x1e')](_0x4722b9)[_0x2567('0x1f')]();};}function respondWithResult(_0x44d81c,_0x571268){_0x571268=_0x571268||0xc8;return function(_0x560b92){if(_0x560b92){return _0x44d81c['status'](_0x571268)[_0x2567('0x20')](_0x560b92);}};}function respondWithFilteredResult(_0x28b526,_0x24e9c3){return function(_0x4e6386){if(_0x4e6386){var _0x60935a=typeof _0x24e9c3[_0x2567('0x21')]===_0x2567('0x22')&&typeof _0x24e9c3[_0x2567('0x23')]===_0x2567('0x22');var _0x32a2fc=_0x4e6386[_0x2567('0x24')];var _0xf5cab1=_0x60935a?0x0:_0x24e9c3[_0x2567('0x21')];var _0x710d24=_0x60935a?_0x4e6386[_0x2567('0x24')]:_0x24e9c3['offset']+_0x24e9c3['limit'];var _0x308193;if(_0x710d24>=_0x32a2fc){_0x710d24=_0x32a2fc;_0x308193=0xc8;}else{_0x308193=0xce;}_0x28b526[_0x2567('0x1e')](_0x308193);return _0x28b526[_0x2567('0x25')](_0x2567('0x26'),_0xf5cab1+'-'+_0x710d24+'/'+_0x32a2fc)[_0x2567('0x20')](_0x4e6386);}return null;};}function patchUpdates(_0x14180b){return function(_0x28f521){try{jsonpatch['apply'](_0x28f521,_0x14180b,!![]);}catch(_0x16b3d5){return BPromise['reject'](_0x16b3d5);}return _0x28f521[_0x2567('0x27')]();};}function saveUpdates(_0x4015a5,_0x12e001){return function(_0xc5ccc3){if(_0xc5ccc3){return _0xc5ccc3['update'](_0x4015a5)[_0x2567('0x28')](function(_0x1c2d0a){return _0x1c2d0a;});}return null;};}function removeEntity(_0x5ea99a,_0x242e90){return function(_0x5c8adf){if(_0x5c8adf){return _0x5c8adf[_0x2567('0x29')]()[_0x2567('0x28')](function(){_0x5ea99a[_0x2567('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3980a4,_0x1966a5){return function(_0x342b76){if(!_0x342b76){_0x3980a4[_0x2567('0x1d')](0x194);}return _0x342b76;};}function handleError(_0x19a750,_0x5cfe5b){_0x5cfe5b=_0x5cfe5b||0x1f4;return function(_0xd289e4){logger[_0x2567('0x2a')](_0xd289e4[_0x2567('0x2b')]);if(_0xd289e4[_0x2567('0x2c')]){delete _0xd289e4['name'];}_0x19a750['status'](_0x5cfe5b)[_0x2567('0x2d')](_0xd289e4);};}exports['index']=function(_0x23477a,_0x52ffb0){var _0x34da9e={},_0x2c98b9={},_0x4bb932={'count':0x0,'rows':[]};var _0xbf15ff=_[_0x2567('0x2e')](db[_0x2567('0x2f')][_0x2567('0x30')],function(_0xacae9){return{'name':_0xacae9[_0x2567('0x31')],'type':_0xacae9['type']['key']};});_0x2c98b9[_0x2567('0x32')]=_['differenceBy'](_[_0x2567('0x2e')](_0xbf15ff,'name'),[_0x2567('0x2c')]);_0x2c98b9['query']=_['keys'](_0x23477a[_0x2567('0x33')]);_0x2c98b9['filters']=_[_0x2567('0x34')](_0x2c98b9['model'],_0x2c98b9[_0x2567('0x33')]);_0x34da9e[_0x2567('0x35')]=_[_0x2567('0x34')](_0x2c98b9[_0x2567('0x32')],qs[_0x2567('0x36')](_0x23477a[_0x2567('0x33')]['fields']));_0x34da9e[_0x2567('0x35')]=_0x34da9e[_0x2567('0x35')]['length']?_0x34da9e['attributes']:_0x2c98b9[_0x2567('0x32')];if(!_0x23477a[_0x2567('0x33')][_0x2567('0x37')]('nolimit')){_0x34da9e[_0x2567('0x23')]=qs[_0x2567('0x23')](_0x23477a[_0x2567('0x33')][_0x2567('0x23')]);_0x34da9e['offset']=qs[_0x2567('0x21')](_0x23477a[_0x2567('0x33')][_0x2567('0x21')]);}_0x34da9e[_0x2567('0x38')]=qs['sort'](_0x23477a[_0x2567('0x33')][_0x2567('0x39')]);_0x34da9e['where']=qs[_0x2567('0x3a')](_[_0x2567('0x3b')](_0x23477a[_0x2567('0x33')],_0x2c98b9[_0x2567('0x3a')]),_0xbf15ff);if(_0x23477a[_0x2567('0x33')]['filter']){_0x34da9e[_0x2567('0x3c')]=_[_0x2567('0x3d')](_0x34da9e[_0x2567('0x3c')],{'$or':_[_0x2567('0x2e')](_0xbf15ff,function(_0x37d1ec){if(_0x37d1ec['type']!=='VIRTUAL'){var _0x318e60={};_0x318e60[_0x37d1ec[_0x2567('0x2c')]]={'$like':'%'+_0x23477a['query'][_0x2567('0x3e')]+'%'};return _0x318e60;}})});}_0x34da9e=_[_0x2567('0x3d')]({},_0x34da9e,_0x23477a[_0x2567('0x3f')]);var _0x57e36c={'where':_0x34da9e[_0x2567('0x3c')]};return db[_0x2567('0x2f')][_0x2567('0x24')](_0x57e36c)[_0x2567('0x28')](function(_0x384554){_0x4bb932['count']=_0x384554;if(_0x23477a[_0x2567('0x33')][_0x2567('0x40')]){_0x34da9e[_0x2567('0x41')]=[{'all':!![]}];}return db[_0x2567('0x2f')][_0x2567('0x42')](_0x34da9e);})['then'](function(_0x17987d){_0x4bb932['rows']=_0x17987d;return _0x4bb932;})[_0x2567('0x28')](respondWithFilteredResult(_0x52ffb0,_0x34da9e))[_0x2567('0x43')](handleError(_0x52ffb0,null));};exports[_0x2567('0x44')]=function(_0x58c2a4,_0x9d6f2a){var _0x40f787={'raw':!![],'where':{'id':_0x58c2a4[_0x2567('0x45')]['id']}},_0x124ad6={};_0x124ad6[_0x2567('0x32')]=_[_0x2567('0x46')](db[_0x2567('0x2f')][_0x2567('0x30')]);_0x124ad6[_0x2567('0x33')]=_['keys'](_0x58c2a4['query']);_0x124ad6[_0x2567('0x3a')]=_[_0x2567('0x34')](_0x124ad6[_0x2567('0x32')],_0x124ad6[_0x2567('0x33')]);_0x40f787[_0x2567('0x35')]=_[_0x2567('0x34')](_0x124ad6['model'],qs['fields'](_0x58c2a4[_0x2567('0x33')][_0x2567('0x36')]));_0x40f787[_0x2567('0x35')]=_0x40f787['attributes'][_0x2567('0x47')]?_0x40f787[_0x2567('0x35')]:_0x124ad6[_0x2567('0x32')];if(_0x58c2a4[_0x2567('0x33')]['includeAll']){_0x40f787['include']=[{'all':!![]}];}_0x40f787=_[_0x2567('0x3d')]({},_0x40f787,_0x58c2a4['options']);return db['VoiceMailMessage']['find'](_0x40f787)[_0x2567('0x28')](handleEntityNotFound(_0x9d6f2a,null))[_0x2567('0x28')](respondWithResult(_0x9d6f2a,null))[_0x2567('0x43')](handleError(_0x9d6f2a,null));};exports['create']=function(_0x190ce5,_0x3c08e9){return db[_0x2567('0x2f')]['create'](_0x190ce5[_0x2567('0x48')],{})[_0x2567('0x28')](respondWithResult(_0x3c08e9,0xc9))['catch'](handleError(_0x3c08e9,null));};exports['update']=function(_0x2975d5,_0x47a2c2){if(_0x2975d5[_0x2567('0x48')]['id']){delete _0x2975d5[_0x2567('0x48')]['id'];}return db['VoiceMailMessage'][_0x2567('0x49')]({'where':{'id':_0x2975d5[_0x2567('0x45')]['id']}})[_0x2567('0x28')](handleEntityNotFound(_0x47a2c2,null))[_0x2567('0x28')](saveUpdates(_0x2975d5[_0x2567('0x48')],null))[_0x2567('0x28')](respondWithResult(_0x47a2c2,null))['catch'](handleError(_0x47a2c2,null));};exports[_0x2567('0x29')]=function(_0x36f4e5,_0x427d63){return db[_0x2567('0x2f')][_0x2567('0x49')]({'where':{'id':_0x36f4e5[_0x2567('0x45')]['id']}})['then'](handleEntityNotFound(_0x427d63,null))['then'](removeEntity(_0x427d63,null))['catch'](handleError(_0x427d63,null));};exports[_0x2567('0x4a')]=function(_0x5e05fc,_0x2c8c7b,_0x22b2bf){return db['VoiceMailMessage'][_0x2567('0x49')]({'where':{'id':_0x5e05fc[_0x2567('0x45')]['id']},'attributes':['id',_0x2567('0x4b'),'msg_id']})['then'](handleEntityNotFound(_0x2c8c7b,null))[_0x2567('0x28')](function(_0x1d3fc4){if(_0x1d3fc4){if(!_0x1d3fc4[_0x2567('0x4b')]){throw new db[(_0x2567('0x4c'))][(_0x2567('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x132c0f={'Content-Type':_0x2567('0x4e'),'Content-Disposition':_0x2567('0x4f')};if(_0x1d3fc4[_0x2567('0x50')]){_0x132c0f[_0x2567('0x51')]='attachment;\x20filename=\x22'+_0x1d3fc4['msg_id']+_0x2567('0x52');}_0x2c8c7b[_0x2567('0x25')](_0x132c0f);return _0x2c8c7b['send'](new Buffer(_0x1d3fc4[_0x2567('0x4b')]));}})['catch'](handleError(_0x2c8c7b,null));}; \ No newline at end of file +var _0x3b41=['catch','show','params','includeAll','create','body','update','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll'];(function(_0x126acb,_0x55ddec){var _0x58853a=function(_0x2c8fe1){while(--_0x2c8fe1){_0x126acb['push'](_0x126acb['shift']());}};_0x58853a(++_0x55ddec);}(_0x3b41,0x167));var _0x13b4=function(_0x5737b9,_0x573b3d){_0x5737b9=_0x5737b9-0x0;var _0x449ff6=_0x3b41[_0x5737b9];return _0x449ff6;};'use strict';var emlformat=require(_0x13b4('0x0'));var rimraf=require(_0x13b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13b4('0x2'));var rp=require(_0x13b4('0x3'));var moment=require(_0x13b4('0x4'));var BPromise=require(_0x13b4('0x5'));var Mustache=require(_0x13b4('0x6'));var util=require(_0x13b4('0x7'));var path=require(_0x13b4('0x8'));var sox=require(_0x13b4('0x9'));var csv=require(_0x13b4('0xa'));var ejs=require(_0x13b4('0xb'));var fs=require('fs');var fs_extra=require(_0x13b4('0xc'));var _=require(_0x13b4('0xd'));var squel=require(_0x13b4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x13b4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x13b4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x13b4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x13b4('0x12'));var hardwareService=require(_0x13b4('0x13'));var logger=require(_0x13b4('0x14'))(_0x13b4('0x15'));var utils=require(_0x13b4('0x16'));var config=require(_0x13b4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e2b9,_0x3ccf78){_0x3ccf78=_0x3ccf78||0xcc;return function(_0xb056ec){if(_0xb056ec){return _0x19e2b9[_0x13b4('0x18')](_0x3ccf78);}return _0x19e2b9[_0x13b4('0x19')](_0x3ccf78)[_0x13b4('0x1a')]();};}function respondWithResult(_0x38e03d,_0x4a2192){_0x4a2192=_0x4a2192||0xc8;return function(_0x36f6f4){if(_0x36f6f4){return _0x38e03d[_0x13b4('0x19')](_0x4a2192)[_0x13b4('0x1b')](_0x36f6f4);}};}function respondWithFilteredResult(_0x1b1071,_0x356f8e){return function(_0x3f9495){if(_0x3f9495){var _0x434548=typeof _0x356f8e[_0x13b4('0x1c')]===_0x13b4('0x1d')&&typeof _0x356f8e[_0x13b4('0x1e')]==='undefined';var _0x50bf71=_0x3f9495[_0x13b4('0x1f')];var _0x267903=_0x434548?0x0:_0x356f8e[_0x13b4('0x1c')];var _0x3d183c=_0x434548?_0x3f9495[_0x13b4('0x1f')]:_0x356f8e[_0x13b4('0x1c')]+_0x356f8e[_0x13b4('0x1e')];var _0x3d78fe;if(_0x3d183c>=_0x50bf71){_0x3d183c=_0x50bf71;_0x3d78fe=0xc8;}else{_0x3d78fe=0xce;}_0x1b1071[_0x13b4('0x19')](_0x3d78fe);return _0x1b1071[_0x13b4('0x20')](_0x13b4('0x21'),_0x267903+'-'+_0x3d183c+'/'+_0x50bf71)[_0x13b4('0x1b')](_0x3f9495);}return null;};}function patchUpdates(_0xb669a9){return function(_0x1c85df){try{jsonpatch[_0x13b4('0x22')](_0x1c85df,_0xb669a9,!![]);}catch(_0x2513cb){return BPromise['reject'](_0x2513cb);}return _0x1c85df[_0x13b4('0x23')]();};}function saveUpdates(_0x2f68f0,_0x250717){return function(_0x259c18){if(_0x259c18){return _0x259c18['update'](_0x2f68f0)[_0x13b4('0x24')](function(_0x511e51){return _0x511e51;});}return null;};}function removeEntity(_0x132be9,_0x4d2c03){return function(_0x488861){if(_0x488861){return _0x488861[_0x13b4('0x25')]()[_0x13b4('0x24')](function(){_0x132be9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43cc06,_0x2a8456){return function(_0x583a51){if(!_0x583a51){_0x43cc06[_0x13b4('0x18')](0x194);}return _0x583a51;};}function handleError(_0x460a79,_0x1101c7){_0x1101c7=_0x1101c7||0x1f4;return function(_0x869599){logger[_0x13b4('0x26')](_0x869599[_0x13b4('0x27')]);if(_0x869599[_0x13b4('0x28')]){delete _0x869599[_0x13b4('0x28')];}_0x460a79['status'](_0x1101c7)['send'](_0x869599);};}exports[_0x13b4('0x29')]=function(_0x3a072d,_0x1fbf08){var _0x15d151={},_0x40043e={},_0x751322={'count':0x0,'rows':[]};var _0x33e559=_[_0x13b4('0x2a')](db[_0x13b4('0x2b')][_0x13b4('0x2c')],function(_0x336cc1){return{'name':_0x336cc1['fieldName'],'type':_0x336cc1[_0x13b4('0x2d')][_0x13b4('0x2e')]};});_0x40043e[_0x13b4('0x2f')]=_[_0x13b4('0x30')](_['map'](_0x33e559,_0x13b4('0x28')),[_0x13b4('0x28')]);_0x40043e[_0x13b4('0x31')]=_[_0x13b4('0x32')](_0x3a072d[_0x13b4('0x31')]);_0x40043e['filters']=_[_0x13b4('0x33')](_0x40043e[_0x13b4('0x2f')],_0x40043e[_0x13b4('0x31')]);_0x15d151[_0x13b4('0x34')]=_[_0x13b4('0x33')](_0x40043e[_0x13b4('0x2f')],qs[_0x13b4('0x35')](_0x3a072d[_0x13b4('0x31')][_0x13b4('0x35')]));_0x15d151[_0x13b4('0x34')]=_0x15d151[_0x13b4('0x34')][_0x13b4('0x36')]?_0x15d151['attributes']:_0x40043e[_0x13b4('0x2f')];if(!_0x3a072d[_0x13b4('0x31')]['hasOwnProperty'](_0x13b4('0x37'))){_0x15d151['limit']=qs[_0x13b4('0x1e')](_0x3a072d[_0x13b4('0x31')][_0x13b4('0x1e')]);_0x15d151['offset']=qs[_0x13b4('0x1c')](_0x3a072d[_0x13b4('0x31')][_0x13b4('0x1c')]);}_0x15d151[_0x13b4('0x38')]=qs[_0x13b4('0x39')](_0x3a072d[_0x13b4('0x31')][_0x13b4('0x39')]);_0x15d151['where']=qs['filters'](_[_0x13b4('0x3a')](_0x3a072d[_0x13b4('0x31')],_0x40043e['filters']),_0x33e559);if(_0x3a072d[_0x13b4('0x31')][_0x13b4('0x3b')]){_0x15d151[_0x13b4('0x3c')]=_[_0x13b4('0x3d')](_0x15d151[_0x13b4('0x3c')],{'$or':_[_0x13b4('0x2a')](_0x33e559,function(_0x1d6328){if(_0x1d6328[_0x13b4('0x2d')]!==_0x13b4('0x3e')){var _0x27f5de={};_0x27f5de[_0x1d6328[_0x13b4('0x28')]]={'$like':'%'+_0x3a072d['query'][_0x13b4('0x3b')]+'%'};return _0x27f5de;}})});}_0x15d151=_[_0x13b4('0x3d')]({},_0x15d151,_0x3a072d[_0x13b4('0x3f')]);var _0xaeeafb={'where':_0x15d151[_0x13b4('0x3c')]};return db[_0x13b4('0x2b')]['count'](_0xaeeafb)[_0x13b4('0x24')](function(_0x109df7){_0x751322[_0x13b4('0x1f')]=_0x109df7;if(_0x3a072d[_0x13b4('0x31')]['includeAll']){_0x15d151[_0x13b4('0x40')]=[{'all':!![]}];}return db[_0x13b4('0x2b')][_0x13b4('0x41')](_0x15d151);})[_0x13b4('0x24')](function(_0x5f11d7){_0x751322['rows']=_0x5f11d7;return _0x751322;})[_0x13b4('0x24')](respondWithFilteredResult(_0x1fbf08,_0x15d151))[_0x13b4('0x42')](handleError(_0x1fbf08,null));};exports[_0x13b4('0x43')]=function(_0xf447bf,_0x59249e){var _0x5d4807={'raw':!![],'where':{'id':_0xf447bf[_0x13b4('0x44')]['id']}},_0x5666af={};_0x5666af[_0x13b4('0x2f')]=_[_0x13b4('0x32')](db[_0x13b4('0x2b')][_0x13b4('0x2c')]);_0x5666af['query']=_['keys'](_0xf447bf[_0x13b4('0x31')]);_0x5666af['filters']=_[_0x13b4('0x33')](_0x5666af[_0x13b4('0x2f')],_0x5666af[_0x13b4('0x31')]);_0x5d4807[_0x13b4('0x34')]=_[_0x13b4('0x33')](_0x5666af[_0x13b4('0x2f')],qs[_0x13b4('0x35')](_0xf447bf[_0x13b4('0x31')][_0x13b4('0x35')]));_0x5d4807[_0x13b4('0x34')]=_0x5d4807[_0x13b4('0x34')]['length']?_0x5d4807['attributes']:_0x5666af[_0x13b4('0x2f')];if(_0xf447bf[_0x13b4('0x31')][_0x13b4('0x45')]){_0x5d4807['include']=[{'all':!![]}];}_0x5d4807=_[_0x13b4('0x3d')]({},_0x5d4807,_0xf447bf['options']);return db['VoiceMailMessage']['find'](_0x5d4807)[_0x13b4('0x24')](handleEntityNotFound(_0x59249e,null))[_0x13b4('0x24')](respondWithResult(_0x59249e,null))[_0x13b4('0x42')](handleError(_0x59249e,null));};exports[_0x13b4('0x46')]=function(_0x34a44a,_0x54c996){return db['VoiceMailMessage'][_0x13b4('0x46')](_0x34a44a[_0x13b4('0x47')],{})[_0x13b4('0x24')](respondWithResult(_0x54c996,0xc9))[_0x13b4('0x42')](handleError(_0x54c996,null));};exports[_0x13b4('0x48')]=function(_0x51b509,_0x35b544){if(_0x51b509[_0x13b4('0x47')]['id']){delete _0x51b509[_0x13b4('0x47')]['id'];}return db[_0x13b4('0x2b')][_0x13b4('0x49')]({'where':{'id':_0x51b509[_0x13b4('0x44')]['id']}})[_0x13b4('0x24')](handleEntityNotFound(_0x35b544,null))[_0x13b4('0x24')](saveUpdates(_0x51b509[_0x13b4('0x47')],null))[_0x13b4('0x24')](respondWithResult(_0x35b544,null))[_0x13b4('0x42')](handleError(_0x35b544,null));};exports[_0x13b4('0x25')]=function(_0x3350bb,_0x26e8b7){return db[_0x13b4('0x2b')][_0x13b4('0x49')]({'where':{'id':_0x3350bb[_0x13b4('0x44')]['id']}})[_0x13b4('0x24')](handleEntityNotFound(_0x26e8b7,null))['then'](removeEntity(_0x26e8b7,null))[_0x13b4('0x42')](handleError(_0x26e8b7,null));};exports[_0x13b4('0x4a')]=function(_0x495118,_0x29e77c,_0xd8b8a4){return db[_0x13b4('0x2b')][_0x13b4('0x49')]({'where':{'id':_0x495118[_0x13b4('0x44')]['id']},'attributes':['id','recording','msg_id']})[_0x13b4('0x24')](handleEntityNotFound(_0x29e77c,null))['then'](function(_0x542973){if(_0x542973){if(!_0x542973[_0x13b4('0x4b')]){throw new db[(_0x13b4('0x4c'))][(_0x13b4('0x4d'))](_0x13b4('0x4e'));}var _0xae814c={'Content-Type':_0x13b4('0x4f'),'Content-Disposition':_0x13b4('0x50')};if(_0x542973[_0x13b4('0x51')]){_0xae814c[_0x13b4('0x52')]=_0x13b4('0x53')+_0x542973[_0x13b4('0x51')]+'.wav\x22';}_0x29e77c['set'](_0xae814c);return _0x29e77c[_0x13b4('0x54')](new Buffer(_0x542973[_0x13b4('0x4b')]));}})[_0x13b4('0x42')](handleError(_0x29e77c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index a75f110..9b28032 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 _0x9084=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','api','moment','request-promise'];(function(_0x4bcfcd,_0x5cf858){var _0x5e3bd8=function(_0x1730e2){while(--_0x1730e2){_0x4bcfcd['push'](_0x4bcfcd['shift']());}};_0x5e3bd8(++_0x5cf858);}(_0x9084,0x17d));var _0x4908=function(_0x57e707,_0x451d89){_0x57e707=_0x57e707-0x0;var _0x9f5b62=_0x9084[_0x57e707];return _0x9f5b62;};'use strict';var _=require(_0x4908('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4908('0x1'));var moment=require(_0x4908('0x2'));var BPromise=require('bluebird');var rp=require(_0x4908('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4908('0x4'));var config=require(_0x4908('0x5'));var attributes=require(_0x4908('0x6'));module[_0x4908('0x7')]=function(_0x28b60a,_0x1d70fb){return _0x28b60a[_0x4908('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x4908('0x9'),'paranoid':![],'indexes':[{'name':_0x4908('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x763c=['define','VoiceMailMessage','voice_voicemail_messages','dir','../../config/logger','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0xef7fad,_0x1549f9){var _0x2f8ec9=function(_0x159cbd){while(--_0x159cbd){_0xef7fad['push'](_0xef7fad['shift']());}};_0x2f8ec9(++_0x1549f9);}(_0x763c,0xb8));var _0xc763=function(_0x16fcb4,_0x4a1009){_0x16fcb4=_0x16fcb4-0x0;var _0x54be5e=_0x763c[_0x16fcb4];return _0x54be5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc763('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc763('0x1'));var fs=require('fs');var path=require(_0xc763('0x2'));var rimraf=require('rimraf');var config=require(_0xc763('0x3'));var attributes=require(_0xc763('0x4'));module[_0xc763('0x5')]=function(_0x2086f9,_0x3832f1){return _0x2086f9[_0xc763('0x6')](_0xc763('0x7'),attributes,{'tableName':_0xc763('0x8'),'paranoid':![],'indexes':[{'name':_0xc763('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f2e95f7..adc8374 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 _0x31f3=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x31f3,0xbd));var _0x331f=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x31f3[_0x177346];return _0x155669;};'use strict';var _=require('lodash');var util=require(_0x331f('0x0'));var moment=require(_0x331f('0x1'));var BPromise=require(_0x331f('0x2'));var rs=require(_0x331f('0x3'));var fs=require('fs');var Redis=require(_0x331f('0x4'));var db=require(_0x331f('0x5'))['db'];var utils=require(_0x331f('0x6'));var logger=require(_0x331f('0x7'))('rpc');var config=require(_0x331f('0x8'));var jayson=require(_0x331f('0x9'));var client=jayson[_0x331f('0xa')][_0x331f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x975d18,_0x298fa9,_0x3a4080){return new BPromise(function(_0x1f5201,_0xb3a601){return client['request'](_0x975d18,_0x3a4080)[_0x331f('0xc')](function(_0x27ae0f){logger[_0x331f('0xd')](_0x331f('0xe'),_0x298fa9,_0x331f('0xf'));logger[_0x331f('0x10')](_0x331f('0x11'),_0x298fa9,_0x331f('0xf'),JSON[_0x331f('0x12')](_0x27ae0f));if(_0x27ae0f[_0x331f('0x13')]){if(_0x27ae0f['error'][_0x331f('0x14')]===0x1f4){logger[_0x331f('0x13')](_0x331f('0xe'),_0x298fa9,_0x27ae0f[_0x331f('0x13')]['message']);return _0xb3a601(_0x27ae0f[_0x331f('0x13')][_0x331f('0x15')]);}logger[_0x331f('0x13')](_0x331f('0xe'),_0x298fa9,_0x27ae0f[_0x331f('0x13')][_0x331f('0x15')]);return _0x1f5201(_0x27ae0f[_0x331f('0x13')][_0x331f('0x15')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x298fa9,'request\x20sent');_0x1f5201(_0x27ae0f['result'][_0x331f('0x15')]);}})[_0x331f('0x16')](function(_0x4e34a0){logger['error'](_0x331f('0xe'),_0x298fa9,_0x4e34a0);_0xb3a601(_0x4e34a0);});});} \ No newline at end of file +var _0xf0ac=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x382adf,_0x3eaac7){var _0x19b8cb=function(_0x1d7c3c){while(--_0x1d7c3c){_0x382adf['push'](_0x382adf['shift']());}};_0x19b8cb(++_0x3eaac7);}(_0xf0ac,0xeb));var _0xcf0a=function(_0x5ee3a6,_0x1f934c){_0x5ee3a6=_0x5ee3a6-0x0;var _0x6d179e=_0xf0ac[_0x5ee3a6];return _0x6d179e;};'use strict';var _=require(_0xcf0a('0x0'));var util=require(_0xcf0a('0x1'));var moment=require(_0xcf0a('0x2'));var BPromise=require(_0xcf0a('0x3'));var rs=require(_0xcf0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf0a('0x5'));var logger=require(_0xcf0a('0x6'))(_0xcf0a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcf0a('0x8')][_0xcf0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x561fdb,_0x10757d,_0x15b77f){return new BPromise(function(_0x3c7b37,_0x1f8a6f){return client[_0xcf0a('0xa')](_0x561fdb,_0x15b77f)[_0xcf0a('0xb')](function(_0x27196c){logger[_0xcf0a('0xc')](_0xcf0a('0xd'),_0x10757d,'request\x20sent');logger[_0xcf0a('0xe')](_0xcf0a('0xf'),_0x10757d,_0xcf0a('0x10'),JSON[_0xcf0a('0x11')](_0x27196c));if(_0x27196c['error']){if(_0x27196c[_0xcf0a('0x12')]['code']===0x1f4){logger[_0xcf0a('0x12')](_0xcf0a('0xd'),_0x10757d,_0x27196c[_0xcf0a('0x12')][_0xcf0a('0x13')]);return _0x1f8a6f(_0x27196c['error'][_0xcf0a('0x13')]);}logger[_0xcf0a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x10757d,_0x27196c[_0xcf0a('0x12')][_0xcf0a('0x13')]);return _0x3c7b37(_0x27196c['error']['message']);}else{logger['info'](_0xcf0a('0xd'),_0x10757d,_0xcf0a('0x10'));_0x3c7b37(_0x27196c[_0xcf0a('0x14')][_0xcf0a('0x13')]);}})['catch'](function(_0x2ba4f0){logger[_0xcf0a('0x12')](_0xcf0a('0xd'),_0x10757d,_0x2ba4f0);_0x1f8a6f(_0x2ba4f0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index eb5f15a..08a8e34 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 _0x7080=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','addSound','update','destroy','delete','removeSound','multer'];(function(_0x35f0fa,_0x5e9e69){var _0x1950af=function(_0x2fba3d){while(--_0x2fba3d){_0x35f0fa['push'](_0x35f0fa['shift']());}};_0x1950af(++_0x5e9e69);}(_0x7080,0x6b));var _0x0708=function(_0x2d1371,_0x43aef7){_0x2d1371=_0x2d1371-0x0;var _0xf17680=_0x7080[_0x2d1371];return _0xf17680;};'use strict';var multer=require(_0x0708('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0708('0x1'));var express=require('express');var router=express[_0x0708('0x2')]();var fs_extra=require(_0x0708('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0708('0x4'));var config=require(_0x0708('0x5'));var controller=require(_0x0708('0x6'));router[_0x0708('0x7')]('/',auth[_0x0708('0x8')](),controller['index']);router[_0x0708('0x7')](_0x0708('0x9'),auth[_0x0708('0x8')](),controller['show']);router[_0x0708('0x7')](_0x0708('0xa'),auth['isAuthenticated'](),controller[_0x0708('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0708('0xc')](_0x0708('0xa'),auth[_0x0708('0x8')](),controller[_0x0708('0xd')]);router['put'](_0x0708('0x9'),auth[_0x0708('0x8')](),controller[_0x0708('0xe')]);router['delete']('/:id',auth[_0x0708('0x8')](),controller[_0x0708('0xf')]);router[_0x0708('0x10')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x0708('0x11')]);module['exports']=router; \ No newline at end of file +var _0x216f=['connect-timeout','express','Router','fs-extra','../../config/environment','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path'];(function(_0x5f37a6,_0x179272){var _0x14dc63=function(_0x6132d6){while(--_0x6132d6){_0x5f37a6['push'](_0x5f37a6['shift']());}};_0x14dc63(++_0x179272);}(_0x216f,0x148));var _0xf216=function(_0x3bf62a,_0x24ff96){_0x3bf62a=_0x3bf62a-0x0;var _0x463230=_0x216f[_0x3bf62a];return _0x463230;};'use strict';var multer=require(_0xf216('0x0'));var util=require('util');var path=require(_0xf216('0x1'));var timeout=require(_0xf216('0x2'));var express=require(_0xf216('0x3'));var router=express[_0xf216('0x4')]();var fs_extra=require(_0xf216('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf216('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xf216('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf216('0x7')](_0xf216('0x8'),auth[_0xf216('0x9')](),controller[_0xf216('0xa')]);router['get'](_0xf216('0xb'),auth['isAuthenticated'](),controller[_0xf216('0xc')]);router[_0xf216('0xd')]('/',auth[_0xf216('0x9')](),controller[_0xf216('0xe')]);router[_0xf216('0xd')]('/:id/sounds',auth[_0xf216('0x9')](),controller[_0xf216('0xf')]);router[_0xf216('0x10')](_0xf216('0x8'),auth[_0xf216('0x9')](),controller['update']);router[_0xf216('0x11')](_0xf216('0x8'),auth[_0xf216('0x9')](),controller[_0xf216('0x12')]);router[_0xf216('0x11')](_0xf216('0x13'),auth['isAuthenticated'](),controller[_0xf216('0x14')]);module[_0xf216('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f2676ca..2b527bb 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 _0xfaf5=['mp3','alpha','TIMESTAMP','STRING','name','custom','files','mp3nb','quietmp3'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0xfaf5,0x159));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5faf('0x0')],'allowNull':![],'unique':_0x5faf('0x1')},'mode':{'type':Sequelize['ENUM'](_0x5faf('0x2'),_0x5faf('0x3'),_0x5faf('0x4'),'quietmp3nb',_0x5faf('0x5'),_0x5faf('0x6')),'allowNull':!![],'defaultValue':_0x5faf('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x5faf('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5faf('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5faf('0x0')],'allowNull':!![],'defaultValue':_0x5faf('0x7')},'format':{'type':Sequelize[_0x5faf('0x0')],'allowNull':!![]},'stamp':{'type':_0x5faf('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x61c8=['quietmp3','mp3','files','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','quietmp3nb'];(function(_0x1d082c,_0x1c39fe){var _0x404321=function(_0x3be7a5){while(--_0x3be7a5){_0x1d082c['push'](_0x1d082c['shift']());}};_0x404321(++_0x1c39fe);}(_0x61c8,0x101));var _0x861c=function(_0x500dd2,_0x23bd28){_0x500dd2=_0x500dd2-0x0;var _0xa7c859=_0x61c8[_0x500dd2];return _0xa7c859;};'use strict';var Sequelize=require(_0x861c('0x0'));module[_0x861c('0x1')]={'name':{'type':Sequelize[_0x861c('0x2')],'allowNull':![],'unique':_0x861c('0x3')},'mode':{'type':Sequelize[_0x861c('0x4')](_0x861c('0x5'),'files','mp3nb',_0x861c('0x6'),_0x861c('0x7'),_0x861c('0x8')),'allowNull':!![],'defaultValue':_0x861c('0x9')},'directory':{'type':Sequelize[_0x861c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x861c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x861c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x861c('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x861c('0x2')],'allowNull':!![]},'stamp':{'type':_0x861c('0xa')},'defaultEntry':{'type':Sequelize[_0x861c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a22bec4..d83979c 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 _0xaba5=['body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','destroy','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','ValidationError','removeSound','id2','Sound','createdAt','pick','hasOwnProperty','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','get','UserProfileResource','then','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update'];(function(_0x45a16,_0x3432fb){var _0x4a65b2=function(_0x115f21){while(--_0x115f21){_0x45a16['push'](_0x45a16['shift']());}};_0x4a65b2(++_0x3432fb);}(_0xaba5,0x9d));var _0x5aba=function(_0x438e9d,_0x47dd98){_0x438e9d=_0x438e9d-0x0;var _0x2364c9=_0xaba5[_0x438e9d];return _0x2364c9;};'use strict';var emlformat=require(_0x5aba('0x0'));var rimraf=require(_0x5aba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5aba('0x2'));var rp=require(_0x5aba('0x3'));var moment=require(_0x5aba('0x4'));var BPromise=require(_0x5aba('0x5'));var Mustache=require(_0x5aba('0x6'));var util=require(_0x5aba('0x7'));var path=require(_0x5aba('0x8'));var sox=require(_0x5aba('0x9'));var csv=require('to-csv');var ejs=require(_0x5aba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5aba('0xb'));var squel=require('squel');var crypto=require(_0x5aba('0xc'));var jsforce=require(_0x5aba('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5aba('0xe'));var Redis=require(_0x5aba('0xf'));var authService=require(_0x5aba('0x10'));var qs=require(_0x5aba('0x11'));var as=require(_0x5aba('0x12'));var hardwareService=require(_0x5aba('0x13'));var logger=require('../../config/logger')(_0x5aba('0x14'));var utils=require(_0x5aba('0x15'));var config=require(_0x5aba('0x16'));var licenseUtil=require(_0x5aba('0x17'));var db=require(_0x5aba('0x18'))['db'];function respondWithStatusCode(_0x293616,_0x2744a3){_0x2744a3=_0x2744a3||0xcc;return function(_0x152fe4){if(_0x152fe4){return _0x293616[_0x5aba('0x19')](_0x2744a3);}return _0x293616[_0x5aba('0x1a')](_0x2744a3)[_0x5aba('0x1b')]();};}function respondWithResult(_0x1fd0d9,_0x4665ee){_0x4665ee=_0x4665ee||0xc8;return function(_0x5b54c3){if(_0x5b54c3){return _0x1fd0d9[_0x5aba('0x1a')](_0x4665ee)['json'](_0x5b54c3);}};}function respondWithFilteredResult(_0x500ec2,_0x180267){return function(_0x405ed6){if(_0x405ed6){var _0x34d852=typeof _0x180267[_0x5aba('0x1c')]===_0x5aba('0x1d')&&typeof _0x180267[_0x5aba('0x1e')]===_0x5aba('0x1d');var _0x5a01bb=_0x405ed6['count'];var _0x1b8c4d=_0x34d852?0x0:_0x180267['offset'];var _0x410326=_0x34d852?_0x405ed6[_0x5aba('0x1f')]:_0x180267[_0x5aba('0x1c')]+_0x180267['limit'];var _0x53ace6;if(_0x410326>=_0x5a01bb){_0x410326=_0x5a01bb;_0x53ace6=0xc8;}else{_0x53ace6=0xce;}_0x500ec2['status'](_0x53ace6);return _0x500ec2[_0x5aba('0x20')](_0x5aba('0x21'),_0x1b8c4d+'-'+_0x410326+'/'+_0x5a01bb)[_0x5aba('0x22')](_0x405ed6);}return null;};}function patchUpdates(_0xa4b19){return function(_0x106205){try{jsonpatch['apply'](_0x106205,_0xa4b19,!![]);}catch(_0x2101a6){return BPromise[_0x5aba('0x23')](_0x2101a6);}return _0x106205[_0x5aba('0x24')]();};}function saveUpdates(_0x512a5b,_0x392ef5){return function(_0x2ac202){if(_0x2ac202){return _0x2ac202['update'](_0x512a5b)['then'](function(_0x31d90){return _0x31d90;});}return null;};}function removeEntity(_0x19da2d,_0x358d02){return function(_0x26b92d){if(_0x26b92d){return _0x26b92d['destroy']()['then'](function(){var _0x5662a7=_0x26b92d[_0x5aba('0x25')]({'plain':!![]});var _0xa716c='MusicOnHolds';return db[_0x5aba('0x26')]['destroy']({'where':{'type':_0xa716c,'resourceId':_0x5662a7['id']}})[_0x5aba('0x27')](function(){return _0x26b92d;});})[_0x5aba('0x27')](function(){_0x19da2d[_0x5aba('0x1a')](0xcc)[_0x5aba('0x1b')]();});}};}function handleEntityNotFound(_0x1f04b0,_0x2361d0){return function(_0x27ad51){if(!_0x27ad51){_0x1f04b0[_0x5aba('0x19')](0x194);}return _0x27ad51;};}function handleError(_0xa083ba,_0x32c58c){_0x32c58c=_0x32c58c||0x1f4;return function(_0x28454f){logger['error'](_0x28454f['stack']);if(_0x28454f[_0x5aba('0x28')]){delete _0x28454f[_0x5aba('0x28')];}_0xa083ba[_0x5aba('0x1a')](_0x32c58c)[_0x5aba('0x29')](_0x28454f);};}exports['index']=function(_0x26f196,_0x47b30d){var _0x5e0907={},_0x1ec634={},_0x317690={'count':0x0,'rows':[]};var _0x213851=_[_0x5aba('0x2a')](db[_0x5aba('0x2b')][_0x5aba('0x2c')],function(_0x5cd555){return{'name':_0x5cd555[_0x5aba('0x2d')],'type':_0x5cd555[_0x5aba('0x2e')][_0x5aba('0x2f')]};});_0x1ec634[_0x5aba('0x30')]=_['map'](_0x213851,'name');_0x1ec634['query']=_[_0x5aba('0x31')](_0x26f196[_0x5aba('0x32')]);_0x1ec634[_0x5aba('0x33')]=_['intersection'](_0x1ec634[_0x5aba('0x30')],_0x1ec634[_0x5aba('0x32')]);_0x5e0907[_0x5aba('0x34')]=_[_0x5aba('0x35')](_0x1ec634[_0x5aba('0x30')],qs[_0x5aba('0x36')](_0x26f196[_0x5aba('0x32')][_0x5aba('0x36')]));_0x5e0907[_0x5aba('0x34')]=_0x5e0907['attributes'][_0x5aba('0x37')]?_0x5e0907[_0x5aba('0x34')]:_0x1ec634[_0x5aba('0x30')];if(!_0x26f196[_0x5aba('0x32')]['hasOwnProperty'](_0x5aba('0x38'))){_0x5e0907[_0x5aba('0x1e')]=qs[_0x5aba('0x1e')](_0x26f196[_0x5aba('0x32')][_0x5aba('0x1e')]);_0x5e0907[_0x5aba('0x1c')]=qs[_0x5aba('0x1c')](_0x26f196[_0x5aba('0x32')][_0x5aba('0x1c')]);}_0x5e0907[_0x5aba('0x39')]=qs[_0x5aba('0x3a')](_0x26f196[_0x5aba('0x32')]['sort']);delete _0x26f196['query'][_0x5aba('0x3a')];_0x5e0907[_0x5aba('0x3b')]=qs['filters'](_['pick'](_0x26f196[_0x5aba('0x32')],_0x1ec634['filters']),_0x213851);if(_0x26f196['query'][_0x5aba('0x3c')]){_0x5e0907['where']=_[_0x5aba('0x3d')](_0x5e0907[_0x5aba('0x3b')],{'$or':_[_0x5aba('0x2a')](_0x213851,function(_0x4ecbef){if(_0x4ecbef[_0x5aba('0x2e')]!==_0x5aba('0x3e')){var _0x1b1e44={};_0x1b1e44[_0x4ecbef[_0x5aba('0x28')]]={'$like':'%'+_0x26f196[_0x5aba('0x32')][_0x5aba('0x3c')]+'%'};return _0x1b1e44;}})});}_0x5e0907=_[_0x5aba('0x3d')]({},_0x5e0907,_0x26f196[_0x5aba('0x3f')]);var _0x4a779a={'where':_0x5e0907['where']};return db[_0x5aba('0x2b')][_0x5aba('0x1f')](_0x4a779a)['then'](function(_0x244d1b){_0x317690['count']=_0x244d1b;if(_0x26f196['query'][_0x5aba('0x40')]){_0x5e0907[_0x5aba('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x5aba('0x42')](_0x5e0907);})[_0x5aba('0x27')](function(_0x36e442){_0x317690[_0x5aba('0x43')]=_0x36e442;return _0x317690;})[_0x5aba('0x27')](respondWithFilteredResult(_0x47b30d,_0x5e0907))[_0x5aba('0x44')](handleError(_0x47b30d,null));};exports[_0x5aba('0x45')]=function(_0x222192,_0x118ade){var _0x5e3cdc={'raw':![],'where':{'id':_0x222192[_0x5aba('0x46')]['id']}},_0x1f3109={};_0x1f3109[_0x5aba('0x30')]=_['keys'](db['VoiceMusicOnHold'][_0x5aba('0x2c')]);_0x1f3109[_0x5aba('0x32')]=_[_0x5aba('0x31')](_0x222192['query']);_0x1f3109[_0x5aba('0x33')]=_[_0x5aba('0x35')](_0x1f3109[_0x5aba('0x30')],_0x1f3109[_0x5aba('0x32')]);_0x5e3cdc[_0x5aba('0x34')]=_['intersection'](_0x1f3109[_0x5aba('0x30')],qs[_0x5aba('0x36')](_0x222192[_0x5aba('0x32')]['fields']));_0x5e3cdc[_0x5aba('0x34')]=_0x5e3cdc[_0x5aba('0x34')][_0x5aba('0x37')]?_0x5e3cdc[_0x5aba('0x34')]:_0x1f3109[_0x5aba('0x30')];if(_0x222192[_0x5aba('0x32')][_0x5aba('0x40')]){_0x5e3cdc[_0x5aba('0x41')]=[{'all':!![]}];}_0x5e3cdc=_[_0x5aba('0x3d')]({},_0x5e3cdc,_0x222192[_0x5aba('0x3f')]);return db['VoiceMusicOnHold'][_0x5aba('0x47')](_0x5e3cdc)['then'](handleEntityNotFound(_0x118ade,null))[_0x5aba('0x27')](respondWithResult(_0x118ade,null))[_0x5aba('0x44')](handleError(_0x118ade,null));};exports[_0x5aba('0x48')]=function(_0xc62f4d,_0x1674d7){if(_0xc62f4d[_0x5aba('0x49')]['id']){delete _0xc62f4d['body']['id'];}return db[_0x5aba('0x2b')][_0x5aba('0x47')]({'where':{'id':_0xc62f4d['params']['id']}})['then'](handleEntityNotFound(_0x1674d7,null))[_0x5aba('0x27')](saveUpdates(_0xc62f4d[_0x5aba('0x49')],null))[_0x5aba('0x27')](respondWithResult(_0x1674d7,null))[_0x5aba('0x44')](handleError(_0x1674d7,null));};exports[_0x5aba('0x4a')]=function(_0x2cf04f,_0x56c933,_0x209ca5){return db[_0x5aba('0x4b')][_0x5aba('0x4c')](function(_0x24e177){if(_0x2cf04f[_0x5aba('0x49')][_0x5aba('0x4d')]===_0x5aba('0x4e')){_0x2cf04f[_0x5aba('0x49')][_0x5aba('0x4f')]=path[_0x5aba('0x50')](config[_0x5aba('0x51')],_0x5aba('0x52'),_0x2cf04f[_0x5aba('0x49')][_0x5aba('0x28')]);}return db[_0x5aba('0x2b')][_0x5aba('0x4a')](_0x2cf04f['body'],{'transaction':_0x24e177})['then'](function(_0x2c4611){if(_0x2cf04f[_0x5aba('0x49')][_0x5aba('0x4d')]===_0x5aba('0x4e')){fs[_0x5aba('0x53')](_0x2c4611['directory'],parseInt(_0x5aba('0x54'),0x8));}var _0x5cb813=_0x2cf04f[_0x5aba('0x55')][_0x5aba('0x25')]({'plain':!![]});if(!_0x5cb813)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cb813['role']===_0x5aba('0x55')){var _0x31a28b=_0x2c4611[_0x5aba('0x25')]({'plain':!![]});return db[_0x5aba('0x56')][_0x5aba('0x47')]({'where':{'name':_0x5aba('0x57'),'userProfileId':_0x5cb813[_0x5aba('0x58')]},'raw':!![]})[_0x5aba('0x27')](function(_0x112834){if(_0x112834&&_0x112834[_0x5aba('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x31a28b[_0x5aba('0x28')],'resourceId':_0x31a28b['id'],'type':_0x112834[_0x5aba('0x28')],'sectionId':_0x112834['id']},{})[_0x5aba('0x27')](function(){return _0x2c4611;});}else{return _0x2c4611;}})[_0x5aba('0x44')](function(_0x3e6b9b){logger[_0x5aba('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6b9b);});}return _0x2c4611;});})[_0x5aba('0x27')](respondWithResult(_0x56c933,0xc9))['catch'](handleError(_0x56c933,null));};exports['destroy']=function(_0x40e773,_0xf2e252,_0x21b3f7){var _0x105781;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x40e773[_0x5aba('0x46')]['id']}})['then'](function(_0x5467aa){if(_0x5467aa){return db[_0x5aba('0x4b')]['transaction'](function(_0x4cde4f){return _0x5467aa[_0x5aba('0x5b')]({'transaction':_0x4cde4f,'raw':!![]})[_0x5aba('0x27')](function(_0x3ef7fd){if(_0x3ef7fd['directory']){fs[_0x5aba('0x5c')](_0x3ef7fd['directory'])[_0x5aba('0x5d')](function(_0x1d1ea3){fs[_0x5aba('0x5e')](path[_0x5aba('0x50')](_0x3ef7fd[_0x5aba('0x4f')],_0x1d1ea3));});fs[_0x5aba('0x5f')](_0x3ef7fd[_0x5aba('0x4f')]);}return _0x3ef7fd;});})[_0x5aba('0x44')](function(_0x16e595){throw new db[(_0x5aba('0x60'))]['ValidationError'](_0x16e595[_0x5aba('0x61')]);});}})[_0x5aba('0x27')](handleEntityNotFound(_0xf2e252,null))['then'](removeEntity(_0xf2e252,null))[_0x5aba('0x44')](handleError(_0xf2e252,null));};exports[_0x5aba('0x62')]=function(_0x2b998a,_0x196084,_0x3b8a67){return db['sequelize']['transaction'](function(_0x3a1615){var _0x37fbd4;return db[_0x5aba('0x2b')][_0x5aba('0x47')]({'where':{'id':_0x2b998a[_0x5aba('0x46')]['id']}})[_0x5aba('0x27')](function(_0xee8f65){if(_0xee8f65){_0x37fbd4=_0xee8f65;return _0xee8f65[_0x5aba('0x62')](_0x2b998a[_0x5aba('0x49')]['id'],{'transaction':_0x3a1615});}})[_0x5aba('0x27')](function(_0x2f4ed0){if(_0x2f4ed0){return db['Sound'][_0x5aba('0x63')]({'where':{'id':_0x2b998a[_0x5aba('0x49')]['id']},'attributes':['id',_0x5aba('0x28'),_0x5aba('0x64'),_0x5aba('0x65'),'createdAt'],'raw':!![]});}})[_0x5aba('0x27')](function(_0x2cd572){if(_0x2cd572){var _0x434d6b=path[_0x5aba('0x50')](config[_0x5aba('0x51')],_0x5aba('0x66'),util[_0x5aba('0x67')](_0x5aba('0x68'),path['basename'](_0x2cd572[_0x5aba('0x64')],path[_0x5aba('0x69')](_0x2cd572[_0x5aba('0x64')])),_0x2cd572[_0x5aba('0x65')]));var _0x4b6e0b=path[_0x5aba('0x50')](config[_0x5aba('0x51')],_0x5aba('0x52'),_0x37fbd4['name'],util[_0x5aba('0x67')]('%s.%s',_0x2cd572[_0x5aba('0x28')],_0x2cd572[_0x5aba('0x65')]));fs[_0x5aba('0x6a')](_0x434d6b,_0x4b6e0b);return _0x2cd572;}})['catch'](function(_0x5067bb){throw new db[(_0x5aba('0x60'))][(_0x5aba('0x6b'))](_0x5067bb['message']);});})[_0x5aba('0x27')](handleEntityNotFound(_0x196084,null))[_0x5aba('0x27')](respondWithResult(_0x196084,0xc9))[_0x5aba('0x44')](handleError(_0x196084,null));};exports[_0x5aba('0x6c')]=function(_0xaf49df,_0x403f89,_0x148621){return db[_0x5aba('0x4b')]['transaction'](function(_0x55abff){var _0x9710f0;return db[_0x5aba('0x2b')][_0x5aba('0x63')]({'where':{'id':_0xaf49df['params']['id']}})[_0x5aba('0x27')](handleEntityNotFound(_0x403f89,null))['then'](function(_0xe7f851){if(_0xe7f851){_0x9710f0=_0xe7f851;return _0xe7f851[_0x5aba('0x6c')](_0xaf49df[_0x5aba('0x46')][_0x5aba('0x6d')]);}})[_0x5aba('0x27')](function(_0x14fd9b){if(_0x14fd9b){return db[_0x5aba('0x6e')][_0x5aba('0x63')]({'where':{'id':_0xaf49df[_0x5aba('0x46')]['id2']},'attributes':['id',_0x5aba('0x28'),_0x5aba('0x64'),_0x5aba('0x65'),_0x5aba('0x6f')],'raw':!![]});}})['then'](function(_0x4524b3){if(_0x4524b3){fs[_0x5aba('0x5e')](path[_0x5aba('0x50')](_0x9710f0['directory'],util[_0x5aba('0x67')](_0x5aba('0x68'),_0x4524b3[_0x5aba('0x28')],_0x4524b3['converted_format'])));return _0x4524b3;}})['catch'](function(_0x4e4db2){throw new db[(_0x5aba('0x60'))][(_0x5aba('0x6b'))](_0x4e4db2[_0x5aba('0x61')]);});})[_0x5aba('0x27')](handleEntityNotFound(_0x403f89,null))['then'](respondWithStatusCode(_0x403f89,0xcc))['catch'](handleError(_0x403f89,null));};exports['getSounds']=function(_0x51b87c,_0x2d67f3,_0x331450){var _0x329f2d={};var _0x3e7ed6={};var _0x4d876b;var _0x48c88d;return db['VoiceMusicOnHold'][_0x5aba('0x63')]({'where':{'id':_0x51b87c[_0x5aba('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d67f3,null))['then'](function(_0x3d0db5){if(_0x3d0db5){_0x4d876b=_0x3d0db5;_0x3e7ed6[_0x5aba('0x30')]=_['keys'](db[_0x5aba('0x6e')]['rawAttributes']);_0x3e7ed6[_0x5aba('0x32')]=_[_0x5aba('0x31')](_0x51b87c[_0x5aba('0x32')]);_0x3e7ed6[_0x5aba('0x33')]=_['intersection'](_0x3e7ed6['model'],_0x3e7ed6['query']);_0x329f2d['attributes']=_[_0x5aba('0x35')](_0x3e7ed6[_0x5aba('0x30')],qs[_0x5aba('0x36')](_0x51b87c['query'][_0x5aba('0x36')]));_0x329f2d[_0x5aba('0x34')]=_0x329f2d[_0x5aba('0x34')][_0x5aba('0x37')]?_0x329f2d[_0x5aba('0x34')]:_0x3e7ed6[_0x5aba('0x30')];_0x329f2d[_0x5aba('0x39')]=qs[_0x5aba('0x3a')](_0x51b87c[_0x5aba('0x32')][_0x5aba('0x3a')]);_0x329f2d[_0x5aba('0x3b')]=qs[_0x5aba('0x33')](_[_0x5aba('0x70')](_0x51b87c[_0x5aba('0x32')],_0x3e7ed6[_0x5aba('0x33')]));if(_0x51b87c['query']['filter']){_0x329f2d[_0x5aba('0x3b')]=_['merge'](_0x329f2d['where'],{'$or':_[_0x5aba('0x2a')](_0x329f2d[_0x5aba('0x34')],function(_0x5774e6){var _0x4c5fcc={};_0x4c5fcc[_0x5774e6]={'$like':'%'+_0x51b87c[_0x5aba('0x32')]['filter']+'%'};return _0x4c5fcc;})});}_0x329f2d=_[_0x5aba('0x3d')]({},_0x329f2d,_0x51b87c['options']);return _0x4d876b['getSounds'](_0x329f2d);}})[_0x5aba('0x27')](function(_0x2b21db){if(_0x2b21db){_0x48c88d=_0x2b21db[_0x5aba('0x37')];if(!_0x51b87c[_0x5aba('0x32')][_0x5aba('0x71')](_0x5aba('0x38'))){_0x329f2d['limit']=qs[_0x5aba('0x1e')](_0x51b87c[_0x5aba('0x32')][_0x5aba('0x1e')]);_0x329f2d[_0x5aba('0x1c')]=qs[_0x5aba('0x1c')](_0x51b87c['query'][_0x5aba('0x1c')]);}return _0x4d876b[_0x5aba('0x72')](_0x329f2d);}})[_0x5aba('0x27')](function(_0xb4ffcc){if(_0xb4ffcc){return _0xb4ffcc?{'count':_0x48c88d,'rows':_0xb4ffcc}:null;}})[_0x5aba('0x27')](respondWithResult(_0x2d67f3,null))['catch'](handleError(_0x2d67f3,null));}; \ No newline at end of file +var _0xc632=['removeSound','id2','unlinkSync','getSounds','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','index','map','VoiceMusicOnHold','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','update','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize'];(function(_0x53972e,_0x275c){var _0xc48fcf=function(_0x1130de){while(--_0x1130de){_0x53972e['push'](_0x53972e['shift']());}};_0xc48fcf(++_0x275c);}(_0xc632,0x1c8));var _0x2c63=function(_0x1603ce,_0x505054){_0x1603ce=_0x1603ce-0x0;var _0x5d6ca5=_0xc632[_0x1603ce];return _0x5d6ca5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c63('0x0'));var rp=require(_0x2c63('0x1'));var moment=require(_0x2c63('0x2'));var BPromise=require(_0x2c63('0x3'));var Mustache=require(_0x2c63('0x4'));var util=require(_0x2c63('0x5'));var path=require('path');var sox=require(_0x2c63('0x6'));var csv=require('to-csv');var ejs=require(_0x2c63('0x7'));var fs=require('fs');var fs_extra=require(_0x2c63('0x8'));var _=require('lodash');var squel=require(_0x2c63('0x9'));var crypto=require(_0x2c63('0xa'));var jsforce=require(_0x2c63('0xb'));var deskjs=require(_0x2c63('0xc'));var toCsv=require(_0x2c63('0xd'));var querystring=require('querystring');var Papa=require(_0x2c63('0xe'));var Redis=require(_0x2c63('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2c63('0x10'));var as=require(_0x2c63('0x11'));var hardwareService=require(_0x2c63('0x12'));var logger=require(_0x2c63('0x13'))(_0x2c63('0x14'));var utils=require(_0x2c63('0x15'));var config=require(_0x2c63('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c63('0x17'))['db'];function respondWithStatusCode(_0x166040,_0x156651){_0x156651=_0x156651||0xcc;return function(_0x1022a8){if(_0x1022a8){return _0x166040[_0x2c63('0x18')](_0x156651);}return _0x166040[_0x2c63('0x19')](_0x156651)[_0x2c63('0x1a')]();};}function respondWithResult(_0x4e889e,_0x4416b6){_0x4416b6=_0x4416b6||0xc8;return function(_0x12b376){if(_0x12b376){return _0x4e889e['status'](_0x4416b6)[_0x2c63('0x1b')](_0x12b376);}};}function respondWithFilteredResult(_0x5f561d,_0x236047){return function(_0x54ea62){if(_0x54ea62){var _0x356245=typeof _0x236047['offset']===_0x2c63('0x1c')&&typeof _0x236047['limit']===_0x2c63('0x1c');var _0xc7b6ce=_0x54ea62[_0x2c63('0x1d')];var _0x5d7699=_0x356245?0x0:_0x236047['offset'];var _0x30e6e9=_0x356245?_0x54ea62[_0x2c63('0x1d')]:_0x236047[_0x2c63('0x1e')]+_0x236047[_0x2c63('0x1f')];var _0x2c12f1;if(_0x30e6e9>=_0xc7b6ce){_0x30e6e9=_0xc7b6ce;_0x2c12f1=0xc8;}else{_0x2c12f1=0xce;}_0x5f561d[_0x2c63('0x19')](_0x2c12f1);return _0x5f561d[_0x2c63('0x20')](_0x2c63('0x21'),_0x5d7699+'-'+_0x30e6e9+'/'+_0xc7b6ce)['json'](_0x54ea62);}return null;};}function patchUpdates(_0x281186){return function(_0x11e847){try{jsonpatch[_0x2c63('0x22')](_0x11e847,_0x281186,!![]);}catch(_0x61314e){return BPromise[_0x2c63('0x23')](_0x61314e);}return _0x11e847[_0x2c63('0x24')]();};}function saveUpdates(_0x957bf7,_0x560bfa){return function(_0x52a520){if(_0x52a520){return _0x52a520['update'](_0x957bf7)['then'](function(_0x30e537){return _0x30e537;});}return null;};}function removeEntity(_0x1befb9,_0x3a1192){return function(_0x18abba){if(_0x18abba){return _0x18abba['destroy']()[_0x2c63('0x25')](function(){var _0x344af1=_0x18abba[_0x2c63('0x26')]({'plain':!![]});var _0xb1e878=_0x2c63('0x27');return db[_0x2c63('0x28')][_0x2c63('0x29')]({'where':{'type':_0xb1e878,'resourceId':_0x344af1['id']}})[_0x2c63('0x25')](function(){return _0x18abba;});})[_0x2c63('0x25')](function(){_0x1befb9['status'](0xcc)[_0x2c63('0x1a')]();});}};}function handleEntityNotFound(_0x24379c,_0x496031){return function(_0x2b838c){if(!_0x2b838c){_0x24379c[_0x2c63('0x18')](0x194);}return _0x2b838c;};}function handleError(_0x299468,_0x355525){_0x355525=_0x355525||0x1f4;return function(_0x216d32){logger['error'](_0x216d32[_0x2c63('0x2a')]);if(_0x216d32[_0x2c63('0x2b')]){delete _0x216d32[_0x2c63('0x2b')];}_0x299468[_0x2c63('0x19')](_0x355525)['send'](_0x216d32);};}exports[_0x2c63('0x2c')]=function(_0x496970,_0x5904ec){var _0x4cac59={},_0x111a8a={},_0x36c707={'count':0x0,'rows':[]};var _0x1ca06f=_[_0x2c63('0x2d')](db[_0x2c63('0x2e')][_0x2c63('0x2f')],function(_0x245aed){return{'name':_0x245aed['fieldName'],'type':_0x245aed[_0x2c63('0x30')]['key']};});_0x111a8a[_0x2c63('0x31')]=_[_0x2c63('0x2d')](_0x1ca06f,_0x2c63('0x2b'));_0x111a8a[_0x2c63('0x32')]=_[_0x2c63('0x33')](_0x496970[_0x2c63('0x32')]);_0x111a8a[_0x2c63('0x34')]=_[_0x2c63('0x35')](_0x111a8a[_0x2c63('0x31')],_0x111a8a[_0x2c63('0x32')]);_0x4cac59['attributes']=_[_0x2c63('0x35')](_0x111a8a['model'],qs[_0x2c63('0x36')](_0x496970['query'][_0x2c63('0x36')]));_0x4cac59[_0x2c63('0x37')]=_0x4cac59[_0x2c63('0x37')][_0x2c63('0x38')]?_0x4cac59['attributes']:_0x111a8a[_0x2c63('0x31')];if(!_0x496970['query'][_0x2c63('0x39')](_0x2c63('0x3a'))){_0x4cac59['limit']=qs['limit'](_0x496970[_0x2c63('0x32')][_0x2c63('0x1f')]);_0x4cac59['offset']=qs[_0x2c63('0x1e')](_0x496970[_0x2c63('0x32')]['offset']);}_0x4cac59[_0x2c63('0x3b')]=qs[_0x2c63('0x3c')](_0x496970[_0x2c63('0x32')][_0x2c63('0x3c')]);delete _0x496970[_0x2c63('0x32')][_0x2c63('0x3c')];_0x4cac59['where']=qs['filters'](_[_0x2c63('0x3d')](_0x496970[_0x2c63('0x32')],_0x111a8a['filters']),_0x1ca06f);if(_0x496970[_0x2c63('0x32')]['filter']){_0x4cac59[_0x2c63('0x3e')]=_['merge'](_0x4cac59[_0x2c63('0x3e')],{'$or':_['map'](_0x1ca06f,function(_0xa8d7b7){if(_0xa8d7b7[_0x2c63('0x30')]!=='VIRTUAL'){var _0xa5320d={};_0xa5320d[_0xa8d7b7[_0x2c63('0x2b')]]={'$like':'%'+_0x496970[_0x2c63('0x32')][_0x2c63('0x3f')]+'%'};return _0xa5320d;}})});}_0x4cac59=_[_0x2c63('0x40')]({},_0x4cac59,_0x496970[_0x2c63('0x41')]);var _0x54531a={'where':_0x4cac59[_0x2c63('0x3e')]};return db[_0x2c63('0x2e')][_0x2c63('0x1d')](_0x54531a)[_0x2c63('0x25')](function(_0x3c0068){_0x36c707[_0x2c63('0x1d')]=_0x3c0068;if(_0x496970[_0x2c63('0x32')]['includeAll']){_0x4cac59[_0x2c63('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x2c63('0x43')](_0x4cac59);})[_0x2c63('0x25')](function(_0x247114){_0x36c707[_0x2c63('0x44')]=_0x247114;return _0x36c707;})['then'](respondWithFilteredResult(_0x5904ec,_0x4cac59))['catch'](handleError(_0x5904ec,null));};exports[_0x2c63('0x45')]=function(_0x3a554c,_0x417b51){var _0x1ecc9a={'raw':![],'where':{'id':_0x3a554c[_0x2c63('0x46')]['id']}},_0x508f66={};_0x508f66['model']=_[_0x2c63('0x33')](db[_0x2c63('0x2e')][_0x2c63('0x2f')]);_0x508f66['query']=_[_0x2c63('0x33')](_0x3a554c[_0x2c63('0x32')]);_0x508f66[_0x2c63('0x34')]=_['intersection'](_0x508f66[_0x2c63('0x31')],_0x508f66[_0x2c63('0x32')]);_0x1ecc9a[_0x2c63('0x37')]=_[_0x2c63('0x35')](_0x508f66[_0x2c63('0x31')],qs[_0x2c63('0x36')](_0x3a554c[_0x2c63('0x32')][_0x2c63('0x36')]));_0x1ecc9a[_0x2c63('0x37')]=_0x1ecc9a[_0x2c63('0x37')][_0x2c63('0x38')]?_0x1ecc9a[_0x2c63('0x37')]:_0x508f66[_0x2c63('0x31')];if(_0x3a554c['query'][_0x2c63('0x47')]){_0x1ecc9a[_0x2c63('0x42')]=[{'all':!![]}];}_0x1ecc9a=_[_0x2c63('0x40')]({},_0x1ecc9a,_0x3a554c['options']);return db[_0x2c63('0x2e')][_0x2c63('0x48')](_0x1ecc9a)['then'](handleEntityNotFound(_0x417b51,null))[_0x2c63('0x25')](respondWithResult(_0x417b51,null))[_0x2c63('0x49')](handleError(_0x417b51,null));};exports[_0x2c63('0x4a')]=function(_0x39dc3f,_0x517309){if(_0x39dc3f[_0x2c63('0x4b')]['id']){delete _0x39dc3f[_0x2c63('0x4b')]['id'];}return db[_0x2c63('0x2e')]['find']({'where':{'id':_0x39dc3f[_0x2c63('0x46')]['id']}})['then'](handleEntityNotFound(_0x517309,null))[_0x2c63('0x25')](saveUpdates(_0x39dc3f[_0x2c63('0x4b')],null))[_0x2c63('0x25')](respondWithResult(_0x517309,null))[_0x2c63('0x49')](handleError(_0x517309,null));};exports[_0x2c63('0x4c')]=function(_0x1a0ba4,_0x4ed779,_0x3cfb81){return db[_0x2c63('0x4d')][_0x2c63('0x4e')](function(_0x2e55f3){if(_0x1a0ba4[_0x2c63('0x4b')][_0x2c63('0x4f')]===_0x2c63('0x50')){_0x1a0ba4[_0x2c63('0x4b')][_0x2c63('0x51')]=path['join'](config[_0x2c63('0x52')],_0x2c63('0x53'),_0x1a0ba4[_0x2c63('0x4b')][_0x2c63('0x2b')]);}return db[_0x2c63('0x2e')][_0x2c63('0x4c')](_0x1a0ba4[_0x2c63('0x4b')],{'transaction':_0x2e55f3})[_0x2c63('0x25')](function(_0x57226b){if(_0x1a0ba4[_0x2c63('0x4b')][_0x2c63('0x4f')]===_0x2c63('0x50')){fs['mkdirSync'](_0x57226b[_0x2c63('0x51')],parseInt('0777',0x8));}var _0x1ea47f=_0x1a0ba4['user']['get']({'plain':!![]});if(!_0x1ea47f)throw new Error(_0x2c63('0x54'));if(_0x1ea47f[_0x2c63('0x55')]==='user'){var _0x3d6dca=_0x57226b[_0x2c63('0x26')]({'plain':!![]});return db[_0x2c63('0x56')][_0x2c63('0x48')]({'where':{'name':_0x2c63('0x27'),'userProfileId':_0x1ea47f[_0x2c63('0x57')]},'raw':!![]})[_0x2c63('0x25')](function(_0x499256){if(_0x499256&&_0x499256[_0x2c63('0x58')]===0x0){return db[_0x2c63('0x28')]['create']({'name':_0x3d6dca[_0x2c63('0x2b')],'resourceId':_0x3d6dca['id'],'type':_0x499256[_0x2c63('0x2b')],'sectionId':_0x499256['id']},{})[_0x2c63('0x25')](function(){return _0x57226b;});}else{return _0x57226b;}})['catch'](function(_0xdf92a1){logger['error'](_0x2c63('0x59'),_0xdf92a1);});}return _0x57226b;});})[_0x2c63('0x25')](respondWithResult(_0x4ed779,0xc9))[_0x2c63('0x49')](handleError(_0x4ed779,null));};exports['destroy']=function(_0x179565,_0x4a2376,_0x953a54){var _0x17c70f;return db['VoiceMusicOnHold'][_0x2c63('0x48')]({'where':{'id':_0x179565[_0x2c63('0x46')]['id']}})[_0x2c63('0x25')](function(_0x31f978){if(_0x31f978){return db[_0x2c63('0x4d')][_0x2c63('0x4e')](function(_0x5d0999){return _0x31f978['destroy']({'transaction':_0x5d0999,'raw':!![]})['then'](function(_0x1c6ef6){if(_0x1c6ef6[_0x2c63('0x51')]){fs[_0x2c63('0x5a')](_0x1c6ef6['directory'])[_0x2c63('0x5b')](function(_0x3533e8){fs['unlinkSync'](path[_0x2c63('0x5c')](_0x1c6ef6[_0x2c63('0x51')],_0x3533e8));});fs[_0x2c63('0x5d')](_0x1c6ef6[_0x2c63('0x51')]);}return _0x1c6ef6;});})['catch'](function(_0x12e036){throw new db['Sequelize'][(_0x2c63('0x5e'))](_0x12e036[_0x2c63('0x5f')]);});}})['then'](handleEntityNotFound(_0x4a2376,null))[_0x2c63('0x25')](removeEntity(_0x4a2376,null))[_0x2c63('0x49')](handleError(_0x4a2376,null));};exports['addSound']=function(_0x37cbde,_0xe956c,_0x15da46){return db[_0x2c63('0x4d')][_0x2c63('0x4e')](function(_0x2b0782){var _0x23f5a1;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x37cbde['params']['id']}})[_0x2c63('0x25')](function(_0x5d9fff){if(_0x5d9fff){_0x23f5a1=_0x5d9fff;return _0x5d9fff[_0x2c63('0x60')](_0x37cbde[_0x2c63('0x4b')]['id'],{'transaction':_0x2b0782});}})[_0x2c63('0x25')](function(_0x1b96e4){if(_0x1b96e4){return db[_0x2c63('0x61')][_0x2c63('0x62')]({'where':{'id':_0x37cbde[_0x2c63('0x4b')]['id']},'attributes':['id',_0x2c63('0x2b'),_0x2c63('0x63'),'converted_format',_0x2c63('0x64')],'raw':!![]});}})[_0x2c63('0x25')](function(_0x5de30b){if(_0x5de30b){var _0x113fff=path[_0x2c63('0x5c')](config['root'],_0x2c63('0x65'),util[_0x2c63('0x66')](_0x2c63('0x67'),path[_0x2c63('0x68')](_0x5de30b['save_name'],path[_0x2c63('0x69')](_0x5de30b['save_name'])),_0x5de30b[_0x2c63('0x6a')]));var _0x5c8950=path['join'](config[_0x2c63('0x52')],'server/files/moh',_0x23f5a1['name'],util[_0x2c63('0x66')](_0x2c63('0x67'),_0x5de30b[_0x2c63('0x2b')],_0x5de30b[_0x2c63('0x6a')]));fs[_0x2c63('0x6b')](_0x113fff,_0x5c8950);return _0x5de30b;}})['catch'](function(_0x246a84){throw new db[(_0x2c63('0x6c'))]['ValidationError'](_0x246a84[_0x2c63('0x5f')]);});})[_0x2c63('0x25')](handleEntityNotFound(_0xe956c,null))[_0x2c63('0x25')](respondWithResult(_0xe956c,0xc9))[_0x2c63('0x49')](handleError(_0xe956c,null));};exports[_0x2c63('0x6d')]=function(_0x22c17b,_0x4d46eb,_0x520421){return db[_0x2c63('0x4d')][_0x2c63('0x4e')](function(_0x28aea9){var _0x152cde;return db[_0x2c63('0x2e')][_0x2c63('0x62')]({'where':{'id':_0x22c17b[_0x2c63('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d46eb,null))[_0x2c63('0x25')](function(_0x2fa3ee){if(_0x2fa3ee){_0x152cde=_0x2fa3ee;return _0x2fa3ee[_0x2c63('0x6d')](_0x22c17b['params']['id2']);}})[_0x2c63('0x25')](function(_0x311b71){if(_0x311b71){return db[_0x2c63('0x61')][_0x2c63('0x62')]({'where':{'id':_0x22c17b[_0x2c63('0x46')][_0x2c63('0x6e')]},'attributes':['id',_0x2c63('0x2b'),_0x2c63('0x63'),_0x2c63('0x6a'),_0x2c63('0x64')],'raw':!![]});}})['then'](function(_0x1c3f1a){if(_0x1c3f1a){fs[_0x2c63('0x6f')](path[_0x2c63('0x5c')](_0x152cde[_0x2c63('0x51')],util[_0x2c63('0x66')](_0x2c63('0x67'),_0x1c3f1a[_0x2c63('0x2b')],_0x1c3f1a[_0x2c63('0x6a')])));return _0x1c3f1a;}})[_0x2c63('0x49')](function(_0x5bf339){throw new db[(_0x2c63('0x6c'))][(_0x2c63('0x5e'))](_0x5bf339[_0x2c63('0x5f')]);});})[_0x2c63('0x25')](handleEntityNotFound(_0x4d46eb,null))[_0x2c63('0x25')](respondWithStatusCode(_0x4d46eb,0xcc))[_0x2c63('0x49')](handleError(_0x4d46eb,null));};exports['getSounds']=function(_0xcec585,_0x2eca71,_0x515a07){var _0xa598c2={};var _0x1ff4ce={};var _0xecb7de;var _0x4a2448;return db['VoiceMusicOnHold'][_0x2c63('0x62')]({'where':{'id':_0xcec585[_0x2c63('0x46')]['id']}})['then'](handleEntityNotFound(_0x2eca71,null))[_0x2c63('0x25')](function(_0x373d6e){if(_0x373d6e){_0xecb7de=_0x373d6e;_0x1ff4ce[_0x2c63('0x31')]=_[_0x2c63('0x33')](db[_0x2c63('0x61')]['rawAttributes']);_0x1ff4ce[_0x2c63('0x32')]=_['keys'](_0xcec585[_0x2c63('0x32')]);_0x1ff4ce['filters']=_[_0x2c63('0x35')](_0x1ff4ce[_0x2c63('0x31')],_0x1ff4ce[_0x2c63('0x32')]);_0xa598c2[_0x2c63('0x37')]=_[_0x2c63('0x35')](_0x1ff4ce[_0x2c63('0x31')],qs[_0x2c63('0x36')](_0xcec585[_0x2c63('0x32')][_0x2c63('0x36')]));_0xa598c2[_0x2c63('0x37')]=_0xa598c2[_0x2c63('0x37')][_0x2c63('0x38')]?_0xa598c2[_0x2c63('0x37')]:_0x1ff4ce[_0x2c63('0x31')];_0xa598c2['order']=qs[_0x2c63('0x3c')](_0xcec585[_0x2c63('0x32')][_0x2c63('0x3c')]);_0xa598c2[_0x2c63('0x3e')]=qs[_0x2c63('0x34')](_[_0x2c63('0x3d')](_0xcec585[_0x2c63('0x32')],_0x1ff4ce[_0x2c63('0x34')]));if(_0xcec585['query'][_0x2c63('0x3f')]){_0xa598c2[_0x2c63('0x3e')]=_['merge'](_0xa598c2[_0x2c63('0x3e')],{'$or':_['map'](_0xa598c2[_0x2c63('0x37')],function(_0x40a894){var _0x1ec129={};_0x1ec129[_0x40a894]={'$like':'%'+_0xcec585[_0x2c63('0x32')][_0x2c63('0x3f')]+'%'};return _0x1ec129;})});}_0xa598c2=_[_0x2c63('0x40')]({},_0xa598c2,_0xcec585[_0x2c63('0x41')]);return _0xecb7de[_0x2c63('0x70')](_0xa598c2);}})[_0x2c63('0x25')](function(_0x58e827){if(_0x58e827){_0x4a2448=_0x58e827['length'];if(!_0xcec585[_0x2c63('0x32')][_0x2c63('0x39')](_0x2c63('0x3a'))){_0xa598c2[_0x2c63('0x1f')]=qs[_0x2c63('0x1f')](_0xcec585[_0x2c63('0x32')][_0x2c63('0x1f')]);_0xa598c2[_0x2c63('0x1e')]=qs[_0x2c63('0x1e')](_0xcec585[_0x2c63('0x32')]['offset']);}return _0xecb7de[_0x2c63('0x70')](_0xa598c2);}})['then'](function(_0x425a50){if(_0x425a50){return _0x425a50?{'count':_0x4a2448,'rows':_0x425a50}:null;}})[_0x2c63('0x25')](respondWithResult(_0x2eca71,null))[_0x2c63('0x49')](handleError(_0x2eca71,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b3351ff..69d42dc 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 _0x67dd=['lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x4a9e4a,_0x585df1){var _0xaa903e=function(_0x4190dd){while(--_0x4190dd){_0x4a9e4a['push'](_0x4a9e4a['shift']());}};_0xaa903e(++_0x585df1);}(_0x67dd,0xbb));var _0xd67d=function(_0x369e3e,_0x5dbe15){_0x369e3e=_0x369e3e-0x0;var _0xf704a7=_0x67dd[_0x369e3e];return _0xf704a7;};'use strict';var _=require(_0xd67d('0x0'));var util=require(_0xd67d('0x1'));var logger=require(_0xd67d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd67d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd67d('0x4'));var config=require(_0xd67d('0x5'));var attributes=require(_0xd67d('0x6'));module[_0xd67d('0x7')]=function(_0x1b7b09,_0x7428ac){return _0x1b7b09[_0xd67d('0x8')](_0xd67d('0x9'),attributes,{'tableName':_0xd67d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3fc=['bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x5b26b0,_0x18964f){var _0x23feff=function(_0x1f62cd){while(--_0x1f62cd){_0x5b26b0['push'](_0x5b26b0['shift']());}};_0x23feff(++_0x18964f);}(_0xd3fc,0x183));var _0xcd3f=function(_0x34129c,_0x61ac31){_0x34129c=_0x34129c-0x0;var _0x215b76=_0xd3fc[_0x34129c];return _0x215b76;};'use strict';var _=require(_0xcd3f('0x0'));var util=require(_0xcd3f('0x1'));var logger=require(_0xcd3f('0x2'))(_0xcd3f('0x3'));var moment=require(_0xcd3f('0x4'));var BPromise=require(_0xcd3f('0x5'));var rp=require(_0xcd3f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd3f('0x7'));var config=require(_0xcd3f('0x8'));var attributes=require(_0xcd3f('0x9'));module[_0xcd3f('0xa')]=function(_0x10e4fd,_0x590bdf){return _0x10e4fd[_0xcd3f('0xb')](_0xcd3f('0xc'),attributes,{'tableName':_0xcd3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 6b3753e..32f409c 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b9277,_0x3e4116){var _0x55f70f=function(_0x557603){while(--_0x557603){_0x5b9277['push'](_0x5b9277['shift']());}};_0x55f70f(++_0x3e4116);}(_0xe706,0xa3));var _0x6e70=function(_0x1cea7b,_0x37f5f4){_0x1cea7b=_0x1cea7b-0x0;var _0x5618d1=_0xe706[_0x1cea7b];return _0x5618d1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x53e5b2,_0x24408a){var _0x5e2a1b=function(_0x5ee4a8){while(--_0x5ee4a8){_0x53e5b2['push'](_0x53e5b2['shift']());}};_0x5e2a1b(++_0x24408a);}(_0xedd9,0xfc));var _0x9edd=function(_0x258399,_0x337716){_0x258399=_0x258399-0x0;var _0x1c4174=_0xedd9[_0x258399];return _0x1c4174;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 33ff7e5..975ec34 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 _0x9335=['post','create','addAgents','addTeams','update','destroy','removeAgents','delete','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x54088a,_0x141f6d){var _0x49f36c=function(_0x4c969c){while(--_0x4c969c){_0x54088a['push'](_0x54088a['shift']());}};_0x49f36c(++_0x141f6d);}(_0x9335,0xab));var _0x5933=function(_0x317fe2,_0x3fc17d){_0x317fe2=_0x317fe2-0x0;var _0x5d6df8=_0x9335[_0x317fe2];return _0x5d6df8;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./voicePrefix.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['describe']);router[_0x5933('0x9')](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0x9')](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x9')](_0x5933('0x10'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);router[_0x5933('0x12')]('/',auth['isAuthenticated'](),controller[_0x5933('0x13')]);router['post'](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0x14')]);router['post'](_0x5933('0x10'),auth['isAuthenticated'](),controller[_0x5933('0x15')]);router['put'](_0x5933('0xc'),auth['isAuthenticated'](),controller[_0x5933('0x16')]);router['delete'](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0x17')]);router['delete']('/:id/users',auth[_0x5933('0xb')](),controller[_0x5933('0x18')]);router[_0x5933('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5933('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x75a2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','put','/:id','update','delete','destroy','removeAgents'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x75a2,0x187));var _0x275a=function(_0x145e0a,_0x14cdc7){_0x145e0a=_0x145e0a-0x0;var _0x27a86e=_0x75a2[_0x145e0a];return _0x27a86e;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require('connect-timeout');var express=require(_0x275a('0x3'));var router=express[_0x275a('0x4')]();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x275a('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x275a('0x8')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0xb')]);router['get']('/:id',auth[_0x275a('0xa')](),controller[_0x275a('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x275a('0xd')]);router[_0x275a('0x8')](_0x275a('0xe'),auth[_0x275a('0xa')](),controller[_0x275a('0xf')]);router[_0x275a('0x10')]('/',auth[_0x275a('0xa')](),controller[_0x275a('0x11')]);router[_0x275a('0x10')](_0x275a('0x12'),auth[_0x275a('0xa')](),controller['addAgents']);router[_0x275a('0x10')](_0x275a('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x275a('0x13')](_0x275a('0x14'),auth[_0x275a('0xa')](),controller[_0x275a('0x15')]);router[_0x275a('0x16')](_0x275a('0x14'),auth[_0x275a('0xa')](),controller[_0x275a('0x17')]);router[_0x275a('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x275a('0x18')]);router[_0x275a('0x16')]('/:id/teams',auth[_0x275a('0xa')](),controller['removeTeams']);module[_0x275a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1409fa5..74aa99d 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 _0xeb44=['INTEGER','exports','STRING','name','VIRTUAL','getDataValue'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xeb44,0x19f));var _0x4eb4=function(_0x204198,_0x8139d0){_0x204198=_0x204198-0x0;var _0x281e02=_0xeb44[_0x204198];return _0x281e02;};'use strict';var Sequelize=require('sequelize');module[_0x4eb4('0x0')]={'name':{'type':Sequelize[_0x4eb4('0x1')],'allowNull':![],'unique':_0x4eb4('0x2')},'prefix':{'type':Sequelize[_0x4eb4('0x3')],'get':function(_0x444d96){return'system-'+this[_0x4eb4('0x4')](_0x4eb4('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x4eb4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x4eb4('0x5')]}}; \ No newline at end of file +var _0xf6fc=['getDataValue','sequelize','STRING','name','system-'];(function(_0x1597e2,_0xbfb7b9){var _0x13de93=function(_0x391774){while(--_0x391774){_0x1597e2['push'](_0x1597e2['shift']());}};_0x13de93(++_0xbfb7b9);}(_0xf6fc,0x100));var _0xcf6f=function(_0x2b53c3,_0x563d4){_0x2b53c3=_0x2b53c3-0x0;var _0x358f00=_0xf6fc[_0x2b53c3];return _0x358f00;};'use strict';var Sequelize=require(_0xcf6f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf6f('0x1')],'allowNull':![],'unique':_0xcf6f('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a7b5b){return _0xcf6f('0x3')+this[_0xcf6f('0x4')](_0xcf6f('0x2'))+'-';}},'description':{'type':Sequelize[_0xcf6f('0x1')]},'callerIdAll':{'type':Sequelize[_0xcf6f('0x1')]},'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 94a3b38..642e348 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 _0x5c3c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','sequelize','transaction','get','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','VoiceExtensionId','findById','addAgents','ids','omit','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','pick','getTeams','addTeams','Team','findAll','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','union','compact','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x24c086,_0x58503a){var _0x437816=function(_0x5ca169){while(--_0x5ca169){_0x24c086['push'](_0x24c086['shift']());}};_0x437816(++_0x58503a);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x5c3c[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];config[_0xc5c3('0x18')]=_[_0xc5c3('0x19')](config[_0xc5c3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5c3('0x1a'))(new Redis(config[_0xc5c3('0x18')]));require(_0xc5c3('0x1b'))[_0xc5c3('0x1c')](socket);function respondWithStatusCode(_0xc8a636,_0x5f34bb){_0x5f34bb=_0x5f34bb||0xcc;return function(_0x5c0341){if(_0x5c0341){return _0xc8a636[_0xc5c3('0x1d')](_0x5f34bb);}return _0xc8a636[_0xc5c3('0x1e')](_0x5f34bb)[_0xc5c3('0x1f')]();};}function respondWithResult(_0xef8b21,_0x5ecd4b){_0x5ecd4b=_0x5ecd4b||0xc8;return function(_0x4ff2de){if(_0x4ff2de){return _0xef8b21[_0xc5c3('0x1e')](_0x5ecd4b)['json'](_0x4ff2de);}};}function respondWithFilteredResult(_0xa9bc84,_0x17ec62){return function(_0x2ff158){if(_0x2ff158){var _0x13c867=typeof _0x17ec62[_0xc5c3('0x20')]==='undefined'&&typeof _0x17ec62[_0xc5c3('0x21')]===_0xc5c3('0x22');var _0x123dba=_0x2ff158[_0xc5c3('0x23')];var _0x4e570f=_0x13c867?0x0:_0x17ec62[_0xc5c3('0x20')];var _0x41578a=_0x13c867?_0x2ff158[_0xc5c3('0x23')]:_0x17ec62[_0xc5c3('0x20')]+_0x17ec62[_0xc5c3('0x21')];var _0x564815;if(_0x41578a>=_0x123dba){_0x41578a=_0x123dba;_0x564815=0xc8;}else{_0x564815=0xce;}_0xa9bc84[_0xc5c3('0x1e')](_0x564815);return _0xa9bc84[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x4e570f+'-'+_0x41578a+'/'+_0x123dba)[_0xc5c3('0x26')](_0x2ff158);}return null;};}function patchUpdates(_0x1c5793){return function(_0x67445){try{jsonpatch[_0xc5c3('0x27')](_0x67445,_0x1c5793,!![]);}catch(_0x5996a0){return BPromise['reject'](_0x5996a0);}return _0x67445[_0xc5c3('0x28')]();};}function saveUpdates(_0x38dd9e,_0x53ab72){return function(_0x5c7329){if(_0x5c7329){return _0x5c7329[_0xc5c3('0x29')](_0x38dd9e)[_0xc5c3('0x2a')](function(_0x38a3df){return _0x38a3df;});}return null;};}function removeEntity(_0x52e54a,_0x4af067){return function(_0x2df06b){if(_0x2df06b){return _0x2df06b[_0xc5c3('0x2b')]()[_0xc5c3('0x2a')](function(){var _0x29791c=_0x2df06b['get']({'plain':!![]});var _0x21efd6='VoicePrefixes';return db[_0xc5c3('0x2c')]['destroy']({'where':{'type':_0x21efd6,'resourceId':_0x29791c['id']}})[_0xc5c3('0x2a')](function(){return _0x2df06b;});})[_0xc5c3('0x2a')](function(){_0x52e54a[_0xc5c3('0x1e')](0xcc)[_0xc5c3('0x1f')]();});}};}function handleEntityNotFound(_0x15361c,_0x2d07e1){return function(_0x35a397){if(!_0x35a397){_0x15361c['sendStatus'](0x194);}return _0x35a397;};}function handleError(_0xbcafd6,_0x4a3300){_0x4a3300=_0x4a3300||0x1f4;return function(_0xc4b134){logger[_0xc5c3('0x2d')](_0xc4b134['stack']);if(_0xc4b134['name']){delete _0xc4b134[_0xc5c3('0x2e')];}_0xbcafd6[_0xc5c3('0x1e')](_0x4a3300)[_0xc5c3('0x2f')](_0xc4b134);};}exports[_0xc5c3('0x30')]=function(_0x52adcf,_0x3f9591){var _0x24aa70={},_0x3ebcbc={},_0x303eab={'count':0x0,'rows':[]};var _0x1b4538=_[_0xc5c3('0x31')](db[_0xc5c3('0x32')][_0xc5c3('0x33')],function(_0x1d1e6d){return{'name':_0x1d1e6d['fieldName'],'type':_0x1d1e6d[_0xc5c3('0x34')][_0xc5c3('0x35')]};});_0x3ebcbc[_0xc5c3('0x36')]=_[_0xc5c3('0x31')](_0x1b4538,_0xc5c3('0x2e'));_0x3ebcbc[_0xc5c3('0x37')]=_[_0xc5c3('0x38')](_0x52adcf['query']);_0x3ebcbc['filters']=_[_0xc5c3('0x39')](_0x3ebcbc['model'],_0x3ebcbc[_0xc5c3('0x37')]);_0x24aa70[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x3ebcbc[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x52adcf['query'][_0xc5c3('0x3b')]));_0x24aa70[_0xc5c3('0x3a')]=_0x24aa70['attributes'][_0xc5c3('0x3c')]?_0x24aa70[_0xc5c3('0x3a')]:_0x3ebcbc[_0xc5c3('0x36')];if(!_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x24aa70[_0xc5c3('0x21')]=qs[_0xc5c3('0x21')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x21')]);_0x24aa70['offset']=qs[_0xc5c3('0x20')](_0x52adcf['query']['offset']);}_0x24aa70[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x24aa70[_0xc5c3('0x41')]=qs['filters'](_['pick'](_0x52adcf[_0xc5c3('0x37')],_0x3ebcbc[_0xc5c3('0x42')]),_0x1b4538);if(_0x52adcf['query'][_0xc5c3('0x43')]){_0x24aa70['where']=_[_0xc5c3('0x44')](_0x24aa70[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x1b4538,function(_0x59c9cb){if(_0x59c9cb[_0xc5c3('0x34')]!==_0xc5c3('0x45')){var _0x525ef8={};_0x525ef8[_0x59c9cb[_0xc5c3('0x2e')]]={'$like':'%'+_0x52adcf['query'][_0xc5c3('0x43')]+'%'};return _0x525ef8;}})});}_0x24aa70=_[_0xc5c3('0x44')]({},_0x24aa70,_0x52adcf['options']);var _0x4d2056={'where':_0x24aa70['where']};return db[_0xc5c3('0x32')][_0xc5c3('0x23')](_0x4d2056)['then'](function(_0x1a8490){_0x303eab[_0xc5c3('0x23')]=_0x1a8490;if(_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x46')]){_0x24aa70['include']=[{'all':!![]}];}return db[_0xc5c3('0x32')]['findAll'](_0x24aa70);})['then'](function(_0x1363fa){_0x303eab[_0xc5c3('0x47')]=_0x1363fa;return _0x303eab;})['then'](respondWithFilteredResult(_0x3f9591,_0x24aa70))[_0xc5c3('0x48')](handleError(_0x3f9591,null));};exports[_0xc5c3('0x49')]=function(_0x590e65,_0x333c38){var _0x4ffc5a={'raw':![],'where':{'id':_0x590e65[_0xc5c3('0x4a')]['id']}},_0x122a6d={};_0x122a6d['model']=_[_0xc5c3('0x38')](db['VoicePrefix'][_0xc5c3('0x33')]);_0x122a6d[_0xc5c3('0x37')]=_['keys'](_0x590e65[_0xc5c3('0x37')]);_0x122a6d[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x122a6d[_0xc5c3('0x36')],_0x122a6d[_0xc5c3('0x37')]);_0x4ffc5a[_0xc5c3('0x3a')]=_['intersection'](_0x122a6d[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x590e65[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x4ffc5a[_0xc5c3('0x3a')]=_0x4ffc5a['attributes']['length']?_0x4ffc5a[_0xc5c3('0x3a')]:_0x122a6d[_0xc5c3('0x36')];if(_0x590e65[_0xc5c3('0x37')]['includeAll']){_0x4ffc5a[_0xc5c3('0x4b')]=[{'all':!![]}];}_0x4ffc5a=_[_0xc5c3('0x44')]({},_0x4ffc5a,_0x590e65[_0xc5c3('0x4c')]);return db[_0xc5c3('0x32')][_0xc5c3('0x4d')](_0x4ffc5a)[_0xc5c3('0x2a')](handleEntityNotFound(_0x333c38,null))[_0xc5c3('0x2a')](respondWithResult(_0x333c38,null))['catch'](handleError(_0x333c38,null));};exports[_0xc5c3('0x2b')]=function(_0x3ff21e,_0x4538ab){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x3ff21e[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x4538ab,null))[_0xc5c3('0x2a')](removeEntity(_0x4538ab,null))[_0xc5c3('0x48')](handleError(_0x4538ab,null));};exports['describe']=function(_0xd716e6,_0x58204c){return db[_0xc5c3('0x32')]['describe']()[_0xc5c3('0x2a')](respondWithResult(_0x58204c,null))[_0xc5c3('0x48')](handleError(_0x58204c,null));};exports[_0xc5c3('0x4e')]=function(_0x325643,_0x1311de){var _0x4be969;return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x348960){return db[_0xc5c3('0x32')][_0xc5c3('0x4e')](_0x325643['body'],{'transaction':_0x348960})[_0xc5c3('0x2a')](function(_0x34bf9c){_0x4be969=_0x34bf9c[_0xc5c3('0x51')]({'plain':!![]});return db['VoiceExtension'][_0xc5c3('0x4d')]({'where':{'id':_0x4be969['VoiceExtensionId']},'raw':!![]})['then'](function(_0x39f83a){return createVoicePrefixExtensions(_0x4be969,_0x39f83a,_0x348960);});});})[_0xc5c3('0x2a')](function(){var _0x110105=_0x325643[_0xc5c3('0x52')][_0xc5c3('0x51')]({'plain':!![]});if(!_0x110105)throw new Error(_0xc5c3('0x53'));if(_0x110105['role']===_0xc5c3('0x52')){var _0x1ad3aa=_0x4be969;return db[_0xc5c3('0x54')][_0xc5c3('0x4d')]({'where':{'name':_0xc5c3('0x55'),'userProfileId':_0x110105[_0xc5c3('0x56')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x524aff){if(_0x524aff&&_0x524aff['autoAssociation']===0x0){return db[_0xc5c3('0x2c')][_0xc5c3('0x4e')]({'name':_0x1ad3aa['name'],'resourceId':_0x1ad3aa['id'],'type':_0x524aff[_0xc5c3('0x2e')],'sectionId':_0x524aff['id']},{})[_0xc5c3('0x2a')](function(){return _0x4be969;});}else{return _0x4be969;}})[_0xc5c3('0x48')](function(_0x41bcf7){logger['error'](_0xc5c3('0x57'),_0x41bcf7);throw _0x41bcf7;});}return _0x4be969;})[_0xc5c3('0x2a')](respondWithResult(_0x1311de,null))[_0xc5c3('0x48')](handleError(_0x1311de,null));};function Extension(_0x314392,_0x1b66bf,_0x36420a,_0x90e30b){this[_0xc5c3('0x58')]=_0xc5c3('0x59');this['exten']=_0x314392;this[_0xc5c3('0x5a')]=_0x36420a;this[_0xc5c3('0x34')]=_0xc5c3('0x5b');this['description']=_0xc5c3('0x5c');this[_0xc5c3('0x5d')]=_0x1b66bf;this[_0xc5c3('0x5e')]=_0x90e30b;}function createVoicePrefixExtensions(_0x30226f,_0x32d5e2,_0x5067ed){return new BPromise(function(_0xf54924,_0xea569b){var _0xf40f27=new Extension(formatPrefixName(_0x30226f[_0xc5c3('0x5f')]),0x1,_0xc5c3('0x60'),_0xc5c3('0x61'));_0xf40f27[_0xc5c3('0x62')]=_0x30226f['id'];return db['VoiceExtension'][_0xc5c3('0x4e')](_0xf40f27,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x397fc8){var _0x13f6a1=_0x397fc8[_0xc5c3('0x51')]({'plain':!![]});var _0x3cd213=_[_0xc5c3('0x31')](addVoicePrefixExtensions(_0x30226f,_0x32d5e2),function(_0x5b9013){_0x5b9013['VoiceExtensionId']=_0x13f6a1['id'];_0x5b9013[_0xc5c3('0x62')]=_0x30226f['id'];return _0x5b9013;});return db[_0xc5c3('0x63')][_0xc5c3('0x64')](_0x3cd213,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x1ed757){if(!_0x1ed757){return _0xea569b(_0xc5c3('0x65'));}else{return _0xf54924(_0x1ed757);}})[_0xc5c3('0x48')](function(_0x2cdd7a){return _0xea569b(_0x2cdd7a);});});;});};function addVoicePrefixExtensions(_0x385b39,_0x4d3e6f){var _0x92c6cf=[];var _0x358b83=formatPrefixName(_0x385b39['prefix']);_0x92c6cf['push'](new Extension(_0x358b83,0x2,_0xc5c3('0x66'),_0xc5c3('0x67')+_0x385b39[_0xc5c3('0x2e')]));if(_0x385b39[_0xc5c3('0x68')]){_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,_0xc5c3('0x66'),_0xc5c3('0x6a')+_0x385b39[_0xc5c3('0x68')]));}else{_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,'NoOp',_0xc5c3('0x6b')));}_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x4,_0xc5c3('0x6c'),_0x4d3e6f[_0xc5c3('0x58')]+','+_0xc5c3('0x6d')+(0x8+_0x385b39[_0xc5c3('0x2e')][_0xc5c3('0x3c')])+'}'+','+0x1));return _0x92c6cf;}function formatPrefixName(_0x114c90){var _0x22606a='_';for(var _0x31e280=0x0;_0x31e280<_0x114c90[_0xc5c3('0x3c')];_0x31e280++){if(_0x114c90['charAt'](_0x31e280)=='-'){_0x22606a+=_0x114c90['charAt'](_0x31e280);}else{_0x22606a+='['+_0x114c90[_0xc5c3('0x6e')](_0x31e280)+']';}}_0x22606a+='.';return _0x22606a;}exports[_0xc5c3('0x29')]=function(_0x6281e5,_0x1951a5,_0x5540c0){var _0x2da018=_0x6281e5[_0xc5c3('0x6f')];_0x2da018[_0xc5c3('0x5f')]=_0xc5c3('0x70')+_0x2da018[_0xc5c3('0x2e')]+'-';return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x4a3f71){return db[_0xc5c3('0x32')]['update'](_0x2da018,{'where':{'id':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x2b')]({'where':{'VoicePrefixId':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x4d')]({'where':{'id':_0x2da018[_0xc5c3('0x71')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x4813a0){return createVoicePrefixExtensions(_0x2da018,_0x4813a0,_0x4a3f71);});});});})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x32')][_0xc5c3('0x72')](_0x2da018['id']);})['then'](respondWithResult(_0x1951a5,null))['catch'](handleError(_0x1951a5,null));};exports[_0xc5c3('0x73')]=function(_0x5d6b6b,_0x5bcbd3,_0x1f222f){return db[_0xc5c3('0x32')]['find']({'where':{'id':_0x5d6b6b[_0xc5c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bcbd3,null))['then'](function(_0x2dbe80){if(_0x2dbe80){return _0x2dbe80[_0xc5c3('0x73')](_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')],_[_0xc5c3('0x75')](_0x5d6b6b['body'],[_0xc5c3('0x74'),'id'])||{})['spread'](function(_0x110167){for(var _0x109cfa=0x0;_0x109cfa<_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')][_0xc5c3('0x3c')];_0x109cfa+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5d6b6b['body'][_0xc5c3('0x74')][_0x109cfa]),'VoicePrefixId':Number(_0x5d6b6b[_0xc5c3('0x4a')]['id'])});}return _0x110167;});}})[_0xc5c3('0x2a')](respondWithResult(_0x5bcbd3,null))['catch'](handleError(_0x5bcbd3,null));};exports[_0xc5c3('0x76')]=function(_0x41222d,_0x5dcd4d,_0x3afa94){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x41222d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x5dcd4d,null))[_0xc5c3('0x2a')](function(_0x4b0d02){if(_0x4b0d02){return _0x4b0d02[_0xc5c3('0x76')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])[_0xc5c3('0x2a')](function(){if(_[_0xc5c3('0x77')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])){for(var _0x1f36f8=0x0;_0x1f36f8<_0x41222d['query']['ids']['length'];_0x1f36f8+=0x1){socket['emit'](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')][_0x1f36f8]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}}else{socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5dcd4d,null))[_0xc5c3('0x48')](handleError(_0x5dcd4d,null));};exports[_0xc5c3('0x7a')]=function(_0x3aa5e2,_0x1efa1d,_0x2fae6d){var _0x258e36={};var _0x2f1be8={};var _0x550966;var _0x5733a2;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x3aa5e2[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x1efa1d,null))[_0xc5c3('0x2a')](function(_0x306d22){if(_0x306d22){_0x550966=_0x306d22;_0x2f1be8[_0xc5c3('0x36')]=_[_0xc5c3('0x38')](db[_0xc5c3('0x7c')][_0xc5c3('0x33')]);_0x2f1be8[_0xc5c3('0x37')]=_['keys'](_0x3aa5e2[_0xc5c3('0x37')]);_0x2f1be8[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],_0x2f1be8[_0xc5c3('0x37')]);_0x258e36['attributes']=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x3aa5e2[_0xc5c3('0x37')]['fields']));_0x258e36[_0xc5c3('0x3a')]=_0x258e36[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x258e36['attributes']:_0x2f1be8[_0xc5c3('0x36')];_0x258e36[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x258e36[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_[_0xc5c3('0x7d')](_0x3aa5e2[_0xc5c3('0x37')],_0x2f1be8[_0xc5c3('0x42')]));if(_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x43')]){_0x258e36[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x258e36[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x258e36['attributes'],function(_0x2bf9d2){var _0x8aaa64={};_0x8aaa64[_0x2bf9d2]={'$like':'%'+_0x3aa5e2['query'][_0xc5c3('0x43')]+'%'};return _0x8aaa64;})});}_0x258e36=_['merge']({},_0x258e36,_0x3aa5e2[_0xc5c3('0x4c')]);return _0x550966[_0xc5c3('0x7a')](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x1800a0){if(_0x1800a0){_0x5733a2=_0x1800a0[_0xc5c3('0x3c')];if(!_0x3aa5e2['query'][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x258e36[_0xc5c3('0x21')]=qs['limit'](_0x3aa5e2['query'][_0xc5c3('0x21')]);_0x258e36['offset']=qs[_0xc5c3('0x20')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x20')]);}return _0x550966['getAgents'](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x3325b6){if(_0x3325b6){return _0x3325b6?{'count':_0x5733a2,'rows':_0x3325b6}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x1efa1d,null))[_0xc5c3('0x48')](handleError(_0x1efa1d,null));};exports[_0xc5c3('0x7e')]=function(_0x57070d,_0x2f5315,_0x37ef35){var _0x2dcae5={};var _0x5d5248={};var _0xd3091c;var _0x26292e;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x57070d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x2f5315,null))[_0xc5c3('0x2a')](function(_0x12d800){if(_0x12d800){_0xd3091c=_0x12d800;_0x5d5248['model']=_[_0xc5c3('0x38')](db['Team'][_0xc5c3('0x33')]);_0x5d5248[_0xc5c3('0x37')]=_['keys'](_0x57070d[_0xc5c3('0x37')]);_0x5d5248[_0xc5c3('0x42')]=_['intersection'](_0x5d5248[_0xc5c3('0x36')],_0x5d5248[_0xc5c3('0x37')]);_0x2dcae5[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x5d5248[_0xc5c3('0x36')],qs['fields'](_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x2dcae5[_0xc5c3('0x3a')]=_0x2dcae5[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x2dcae5[_0xc5c3('0x3a')]:_0x5d5248['model'];_0x2dcae5[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x57070d['query']['sort']);_0x2dcae5[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_['pick'](_0x57070d[_0xc5c3('0x37')],_0x5d5248[_0xc5c3('0x42')]));if(_0x57070d[_0xc5c3('0x37')]['filter']){_0x2dcae5[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x2dcae5[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x2dcae5[_0xc5c3('0x3a')],function(_0x86d21a){var _0x53f1d={};_0x53f1d[_0x86d21a]={'$like':'%'+_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x43')]+'%'};return _0x53f1d;})});}_0x2dcae5=_[_0xc5c3('0x44')]({},_0x2dcae5,_0x57070d[_0xc5c3('0x4c')]);return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})['then'](function(_0x48e3a2){if(_0x48e3a2){_0x26292e=_0x48e3a2[_0xc5c3('0x3c')];if(!_0x57070d['query']['hasOwnProperty'](_0xc5c3('0x3e'))){_0x2dcae5['limit']=qs[_0xc5c3('0x21')](_0x57070d[_0xc5c3('0x37')]['limit']);_0x2dcae5['offset']=qs[_0xc5c3('0x20')](_0x57070d['query']['offset']);}return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})[_0xc5c3('0x2a')](function(_0x3ce0e9){if(_0x3ce0e9){return _0x3ce0e9?{'count':_0x26292e,'rows':_0x3ce0e9}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x2f5315,null))[_0xc5c3('0x48')](handleError(_0x2f5315,null));};exports[_0xc5c3('0x7f')]=function(_0x116965,_0xa4672a,_0x1aba09){var _0x557b8f=_0x116965['body'][_0xc5c3('0x74')];var _0x389c96;return db[_0xc5c3('0x80')][_0xc5c3('0x81')]({'where':{'id':_0x557b8f},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id',_0xc5c3('0x2e'),'online',_0xc5c3('0x82'),_0xc5c3('0x83')],'raw':!![]}]})[_0xc5c3('0x2a')](function(_0x2c8937){if(_0x2c8937){_0x389c96=_0x2c8937;var _0x9e9372=_[_0xc5c3('0x84')](_0x2c8937,function(_0x1dcde5){var _0x2c8fdb=_0x1dcde5['get']({'plain':!![]});return _0x2c8fdb['Agents'];});return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x116965[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](function(_0x3cc60b){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x2c5fd2){return _0x3cc60b[_0xc5c3('0x7f')](_0x557b8f,{'transaction':_0x2c5fd2})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x389c96,function(_0x554787){return db[_0xc5c3('0x86')][_0xc5c3('0x87')]({'TeamId':_0x554787['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},{'transaction':_0x2c5fd2});});})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x9e9372,function(_0x589e28){return db[_0xc5c3('0x88')][_0xc5c3('0x89')]({'where':{'UserId':_0x589e28['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},'transaction':_0x2c5fd2});});})['then'](function(){_0x9e9372[_0xc5c3('0x8a')](function(_0x2dd850){socket[_0xc5c3('0x79')](_0xc5c3('0x8b'),{'UserId':_0x2dd850['id'],'VoicePrefixId':_0x3cc60b['id']});});});});});}})[_0xc5c3('0x2a')](respondWithStatusCode(_0xa4672a,null))[_0xc5c3('0x48')](handleError(_0xa4672a,null));};exports[_0xc5c3('0x8c')]=function(_0x53a502,_0x762654,_0x37459f){return db['Team'][_0xc5c3('0x81')]({'where':{'id':_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc5c3('0x2a')](handleEntityNotFound(_0x762654,null))[_0xc5c3('0x2a')](function(_0x3aafa0){var _0xe80b2b=_[_0xc5c3('0x31')](_0x3aafa0,'id');var _0x2b49da=[];var _0x47bd08=[];var _0x314072=squel[_0xc5c3('0x8d')]();_0x314072['field'](_0xc5c3('0x8e'))['from'](_0xc5c3('0x8f'),'tq')[_0xc5c3('0x90')](_0xc5c3('0x91'),'ut',_0xc5c3('0x92'))['where']('VoicePrefixId\x20=\x20?',_0x53a502['params']['id']);for(var _0x3b5ca9=0x0;_0x3b5ca9<_0x3aafa0[_0xc5c3('0x3c')];_0x3b5ca9+=0x1){let _0x283935=_0x3aafa0[_0x3b5ca9];for(var _0x5cebbc=0x0;_0x5cebbc<_0x283935[_0xc5c3('0x93')]['length'];_0x5cebbc+=0x1){let _0x423b48=_0x283935[_0xc5c3('0x93')][_0x5cebbc];var _0x2a8dfc=_0x314072[_0xc5c3('0x94')]();_0x2a8dfc[_0xc5c3('0x41')](_0xc5c3('0x95'),_0x423b48['id']);_0x47bd08[_0xc5c3('0x69')](db[_0xc5c3('0x4f')][_0xc5c3('0x37')](_0x2a8dfc[_0xc5c3('0x96')](),{'type':db['sequelize'][_0xc5c3('0x97')]['SELECT']})[_0xc5c3('0x2a')](function(_0x397543){if(_0x397543[_0xc5c3('0x3c')]===0x1){return _0x423b48['id'];}else{var _0x21941a=_['every'](_[_0xc5c3('0x31')](_0x397543,_0xc5c3('0x98')),function(_0x1b7fc8){return _['includes'](_0xe80b2b,_0x1b7fc8);});if(_0x21941a){return _0x423b48['id'];}}}));}}return BPromise['all'](_0x47bd08)[_0xc5c3('0x2a')](function(_0x5731da){_0x2b49da=_(_0x2b49da)[_0xc5c3('0x99')](_0x5731da)[_0xc5c3('0x9a')]()['value']();return db[_0xc5c3('0x32')][_0xc5c3('0x4d')]({'where':{'id':_0x53a502['params']['id']}})['then'](function(_0x288b93){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x187a7a){return _0x288b93['removeTeams'](_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')],{'transaction':_0x187a7a})[_0xc5c3('0x2a')](function(){if(!_['isEmpty'](_0x2b49da)){return _0x288b93[_0xc5c3('0x76')](_0x2b49da,{'transaction':_0x187a7a});}})[_0xc5c3('0x2a')](function(){_0x2b49da['forEach'](function(_0x8ec6b6){socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':_0x8ec6b6,'VoicePrefixId':_0x288b93['id']});});});});});});})[_0xc5c3('0x2a')](respondWithStatusCode(_0x762654,null))[_0xc5c3('0x48')](handleError(_0x762654,null));}; \ No newline at end of file +var _0x896e=['userVoicePrefix:save','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','isEmpty','forEach','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','params','addAgents','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','order','hasOwnProperty','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate'];(function(_0x5dd2c9,_0x321ae3){var _0x3b0cdb=function(_0x170af6){while(--_0x170af6){_0x5dd2c9['push'](_0x5dd2c9['shift']());}};_0x3b0cdb(++_0x321ae3);}(_0x896e,0x1e9));var _0xe896=function(_0x4a8adf,_0x342568){_0x4a8adf=_0x4a8adf-0x0;var _0x512ae1=_0x896e[_0x4a8adf];return _0x512ae1;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];config[_0xe896('0x1a')]=_['defaults'](config[_0xe896('0x1a')],{'host':_0xe896('0x1b'),'port':0x18eb});var socket=require(_0xe896('0x1c'))(new Redis(config['redis']));require(_0xe896('0x1d'))[_0xe896('0x1e')](socket);function respondWithStatusCode(_0x1e7ef8,_0x564758){_0x564758=_0x564758||0xcc;return function(_0x5a7957){if(_0x5a7957){return _0x1e7ef8[_0xe896('0x1f')](_0x564758);}return _0x1e7ef8[_0xe896('0x20')](_0x564758)['end']();};}function respondWithResult(_0x5e78d6,_0x11f41c){_0x11f41c=_0x11f41c||0xc8;return function(_0x16e272){if(_0x16e272){return _0x5e78d6['status'](_0x11f41c)[_0xe896('0x21')](_0x16e272);}};}function respondWithFilteredResult(_0x4e062a,_0x41cbd7){return function(_0x32f86d){if(_0x32f86d){var _0x2d4cf0=typeof _0x41cbd7['offset']===_0xe896('0x22')&&typeof _0x41cbd7[_0xe896('0x23')]===_0xe896('0x22');var _0xbebbe1=_0x32f86d[_0xe896('0x24')];var _0x3ac8b8=_0x2d4cf0?0x0:_0x41cbd7[_0xe896('0x25')];var _0x32d3d3=_0x2d4cf0?_0x32f86d['count']:_0x41cbd7[_0xe896('0x25')]+_0x41cbd7['limit'];var _0x5d2c8d;if(_0x32d3d3>=_0xbebbe1){_0x32d3d3=_0xbebbe1;_0x5d2c8d=0xc8;}else{_0x5d2c8d=0xce;}_0x4e062a[_0xe896('0x20')](_0x5d2c8d);return _0x4e062a[_0xe896('0x26')](_0xe896('0x27'),_0x3ac8b8+'-'+_0x32d3d3+'/'+_0xbebbe1)[_0xe896('0x21')](_0x32f86d);}return null;};}function patchUpdates(_0x498469){return function(_0x468479){try{jsonpatch['apply'](_0x468479,_0x498469,!![]);}catch(_0x5001f7){return BPromise[_0xe896('0x28')](_0x5001f7);}return _0x468479[_0xe896('0x29')]();};}function saveUpdates(_0x1e952a,_0x2e2c10){return function(_0x20e295){if(_0x20e295){return _0x20e295[_0xe896('0x2a')](_0x1e952a)[_0xe896('0x2b')](function(_0x4b71cc){return _0x4b71cc;});}return null;};}function removeEntity(_0x390128,_0x163a75){return function(_0xc3cd05){if(_0xc3cd05){return _0xc3cd05['destroy']()[_0xe896('0x2b')](function(){var _0xd50fe2=_0xc3cd05[_0xe896('0x2c')]({'plain':!![]});var _0xe93aa0=_0xe896('0x2d');return db[_0xe896('0x2e')]['destroy']({'where':{'type':_0xe93aa0,'resourceId':_0xd50fe2['id']}})[_0xe896('0x2b')](function(){return _0xc3cd05;});})[_0xe896('0x2b')](function(){_0x390128[_0xe896('0x20')](0xcc)[_0xe896('0x2f')]();});}};}function handleEntityNotFound(_0xace03f,_0x5e0d9b){return function(_0x47c268){if(!_0x47c268){_0xace03f['sendStatus'](0x194);}return _0x47c268;};}function handleError(_0x504d7c,_0x562ddd){_0x562ddd=_0x562ddd||0x1f4;return function(_0x291290){logger[_0xe896('0x30')](_0x291290[_0xe896('0x31')]);if(_0x291290[_0xe896('0x32')]){delete _0x291290[_0xe896('0x32')];}_0x504d7c[_0xe896('0x20')](_0x562ddd)[_0xe896('0x33')](_0x291290);};}exports[_0xe896('0x34')]=function(_0x4ab96b,_0x4ce052){var _0x142d29={},_0x255dd1={},_0x29be89={'count':0x0,'rows':[]};var _0x76c0c3=_['map'](db[_0xe896('0x35')]['rawAttributes'],function(_0x57c6e8){return{'name':_0x57c6e8[_0xe896('0x36')],'type':_0x57c6e8[_0xe896('0x37')][_0xe896('0x38')]};});_0x255dd1['model']=_['map'](_0x76c0c3,'name');_0x255dd1[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x4ab96b[_0xe896('0x39')]);_0x255dd1[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x255dd1['model'],_0x255dd1[_0xe896('0x39')]);_0x142d29[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x255dd1[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x3f')]));_0x142d29[_0xe896('0x3d')]=_0x142d29['attributes'][_0xe896('0x40')]?_0x142d29[_0xe896('0x3d')]:_0x255dd1['model'];if(!_0x4ab96b[_0xe896('0x39')]['hasOwnProperty'](_0xe896('0x41'))){_0x142d29['limit']=qs[_0xe896('0x23')](_0x4ab96b['query'][_0xe896('0x23')]);_0x142d29[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x25')]);}_0x142d29['order']=qs['sort'](_0x4ab96b[_0xe896('0x39')][_0xe896('0x42')]);_0x142d29[_0xe896('0x43')]=qs[_0xe896('0x3b')](_[_0xe896('0x44')](_0x4ab96b['query'],_0x255dd1['filters']),_0x76c0c3);if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]){_0x142d29['where']=_['merge'](_0x142d29[_0xe896('0x43')],{'$or':_[_0xe896('0x46')](_0x76c0c3,function(_0x911adb){if(_0x911adb[_0xe896('0x37')]!==_0xe896('0x47')){var _0x41fa6f={};_0x41fa6f[_0x911adb[_0xe896('0x32')]]={'$like':'%'+_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x41fa6f;}})});}_0x142d29=_[_0xe896('0x48')]({},_0x142d29,_0x4ab96b[_0xe896('0x49')]);var _0x1bc76a={'where':_0x142d29['where']};return db[_0xe896('0x35')][_0xe896('0x24')](_0x1bc76a)['then'](function(_0x57366b){_0x29be89['count']=_0x57366b;if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x4a')]){_0x142d29[_0xe896('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xe896('0x4c')](_0x142d29);})[_0xe896('0x2b')](function(_0x55a8ba){_0x29be89['rows']=_0x55a8ba;return _0x29be89;})['then'](respondWithFilteredResult(_0x4ce052,_0x142d29))[_0xe896('0x4d')](handleError(_0x4ce052,null));};exports[_0xe896('0x4e')]=function(_0x16927a,_0x402aef){var _0x4452aa={'raw':![],'where':{'id':_0x16927a['params']['id']}},_0x2ae833={};_0x2ae833[_0xe896('0x3e')]=_[_0xe896('0x3a')](db['VoicePrefix'][_0xe896('0x4f')]);_0x2ae833[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x16927a[_0xe896('0x39')]);_0x2ae833['filters']=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],_0x2ae833[_0xe896('0x39')]);_0x4452aa[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],qs['fields'](_0x16927a[_0xe896('0x39')]['fields']));_0x4452aa[_0xe896('0x3d')]=_0x4452aa[_0xe896('0x3d')][_0xe896('0x40')]?_0x4452aa[_0xe896('0x3d')]:_0x2ae833[_0xe896('0x3e')];if(_0x16927a[_0xe896('0x39')]['includeAll']){_0x4452aa[_0xe896('0x4b')]=[{'all':!![]}];}_0x4452aa=_[_0xe896('0x48')]({},_0x4452aa,_0x16927a['options']);return db[_0xe896('0x35')][_0xe896('0x50')](_0x4452aa)['then'](handleEntityNotFound(_0x402aef,null))[_0xe896('0x2b')](respondWithResult(_0x402aef,null))['catch'](handleError(_0x402aef,null));};exports[_0xe896('0x51')]=function(_0xb90690,_0x3fd073){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0xb90690['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3fd073,null))[_0xe896('0x2b')](removeEntity(_0x3fd073,null))[_0xe896('0x4d')](handleError(_0x3fd073,null));};exports['describe']=function(_0x2ceae5,_0x5d205b){return db['VoicePrefix'][_0xe896('0x52')]()[_0xe896('0x2b')](respondWithResult(_0x5d205b,null))['catch'](handleError(_0x5d205b,null));};exports[_0xe896('0x53')]=function(_0x3d137b,_0x5bfd1e){var _0x58497a;return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x5b8719){return db[_0xe896('0x35')][_0xe896('0x53')](_0x3d137b[_0xe896('0x56')],{'transaction':_0x5b8719})[_0xe896('0x2b')](function(_0x16d1c8){_0x58497a=_0x16d1c8[_0xe896('0x2c')]({'plain':!![]});return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x58497a[_0xe896('0x58')]},'raw':!![]})[_0xe896('0x2b')](function(_0x357302){return createVoicePrefixExtensions(_0x58497a,_0x357302,_0x5b8719);});});})['then'](function(){var _0x1d7e31=_0x3d137b[_0xe896('0x59')][_0xe896('0x2c')]({'plain':!![]});if(!_0x1d7e31)throw new Error(_0xe896('0x5a'));if(_0x1d7e31[_0xe896('0x5b')]===_0xe896('0x59')){var _0x157946=_0x58497a;return db[_0xe896('0x5c')][_0xe896('0x50')]({'where':{'name':_0xe896('0x2d'),'userProfileId':_0x1d7e31[_0xe896('0x5d')]},'raw':!![]})[_0xe896('0x2b')](function(_0x5d8265){if(_0x5d8265&&_0x5d8265[_0xe896('0x5e')]===0x0){return db[_0xe896('0x2e')][_0xe896('0x53')]({'name':_0x157946['name'],'resourceId':_0x157946['id'],'type':_0x5d8265['name'],'sectionId':_0x5d8265['id']},{})['then'](function(){return _0x58497a;});}else{return _0x58497a;}})[_0xe896('0x4d')](function(_0x29aa11){logger[_0xe896('0x30')](_0xe896('0x5f'),_0x29aa11);throw _0x29aa11;});}return _0x58497a;})['then'](respondWithResult(_0x5bfd1e,null))[_0xe896('0x4d')](handleError(_0x5bfd1e,null));};function Extension(_0x28396c,_0x57ed84,_0x3c893a,_0x5d6c1c){this[_0xe896('0x60')]=_0xe896('0x61');this['exten']=_0x28396c;this[_0xe896('0x62')]=_0x3c893a;this[_0xe896('0x37')]='system';this['description']=_0xe896('0x63');this[_0xe896('0x64')]=_0x57ed84;this[_0xe896('0x65')]=_0x5d6c1c;}function createVoicePrefixExtensions(_0x11291a,_0x2a1858,_0x4e4092){return new BPromise(function(_0xdadb92,_0x3c82d1){var _0x113b00=new Extension(formatPrefixName(_0x11291a[_0xe896('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0x113b00[_0xe896('0x67')]=_0x11291a['id'];return db[_0xe896('0x57')]['create'](_0x113b00,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0x4f2d6e){var _0x3ccaad=_0x4f2d6e[_0xe896('0x2c')]({'plain':!![]});var _0xce2b25=_[_0xe896('0x46')](addVoicePrefixExtensions(_0x11291a,_0x2a1858),function(_0x11b001){_0x11b001[_0xe896('0x58')]=_0x3ccaad['id'];_0x11b001[_0xe896('0x67')]=_0x11291a['id'];return _0x11b001;});return db[_0xe896('0x57')][_0xe896('0x68')](_0xce2b25,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0xcb329a){if(!_0xcb329a){return _0x3c82d1(_0xe896('0x69'));}else{return _0xdadb92(_0xcb329a);}})[_0xe896('0x4d')](function(_0x14d88e){return _0x3c82d1(_0x14d88e);});});;});};function addVoicePrefixExtensions(_0x468fd7,_0x33bd1b){var _0x404b42=[];var _0x26e75d=formatPrefixName(_0x468fd7[_0xe896('0x66')]);_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x2,_0xe896('0x6b'),_0xe896('0x6c')+_0x468fd7['name']));if(_0x468fd7['callerIdAll']){_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6b'),'PREFIX-CALLERIDALL='+_0x468fd7[_0xe896('0x6d')]));}else{_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6e'),_0xe896('0x6f')));}_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x4,_0xe896('0x70'),_0x33bd1b[_0xe896('0x60')]+','+_0xe896('0x71')+(0x8+_0x468fd7[_0xe896('0x32')][_0xe896('0x40')])+'}'+','+0x1));return _0x404b42;}function formatPrefixName(_0x1479c8){var _0x4e417a='_';for(var _0x3d299a=0x0;_0x3d299a<_0x1479c8[_0xe896('0x40')];_0x3d299a++){if(_0x1479c8['charAt'](_0x3d299a)=='-'){_0x4e417a+=_0x1479c8[_0xe896('0x72')](_0x3d299a);}else{_0x4e417a+='['+_0x1479c8['charAt'](_0x3d299a)+']';}}_0x4e417a+='.';return _0x4e417a;}exports['update']=function(_0x1f3e10,_0x1bbeeb,_0x4fd476){var _0x56223c=_0x1f3e10[_0xe896('0x56')];_0x56223c['prefix']='system-'+_0x56223c[_0xe896('0x32')]+'-';return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x539f6d){return db[_0xe896('0x35')][_0xe896('0x2a')](_0x56223c,{'where':{'id':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db['VoiceExtension'][_0xe896('0x51')]({'where':{'VoicePrefixId':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x56223c['VoiceExtensionId']},'raw':!![]})[_0xe896('0x2b')](function(_0x37d951){return createVoicePrefixExtensions(_0x56223c,_0x37d951,_0x539f6d);});});});})[_0xe896('0x2b')](function(){return db[_0xe896('0x35')]['findById'](_0x56223c['id']);})[_0xe896('0x2b')](respondWithResult(_0x1bbeeb,null))[_0xe896('0x4d')](handleError(_0x1bbeeb,null));};exports['addAgents']=function(_0x2d910b,_0x129ff2,_0x35ed8c){return db[_0xe896('0x35')]['find']({'where':{'id':_0x2d910b[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x129ff2,null))[_0xe896('0x2b')](function(_0x1ea3ea){if(_0x1ea3ea){return _0x1ea3ea[_0xe896('0x74')](_0x2d910b[_0xe896('0x56')]['ids'],_['omit'](_0x2d910b['body'],[_0xe896('0x75'),'id'])||{})[_0xe896('0x76')](function(_0x10421d){for(var _0x270121=0x0;_0x270121<_0x2d910b[_0xe896('0x56')][_0xe896('0x75')][_0xe896('0x40')];_0x270121+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x2d910b[_0xe896('0x56')]['ids'][_0x270121]),'VoicePrefixId':Number(_0x2d910b[_0xe896('0x73')]['id'])});}return _0x10421d;});}})['then'](respondWithResult(_0x129ff2,null))[_0xe896('0x4d')](handleError(_0x129ff2,null));};exports['removeAgents']=function(_0x2d2978,_0x36994f,_0x2ffb63){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x2d2978['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x36994f,null))[_0xe896('0x2b')](function(_0x690a75){if(_0x690a75){return _0x690a75[_0xe896('0x77')](_0x2d2978[_0xe896('0x39')][_0xe896('0x75')])[_0xe896('0x2b')](function(){if(_['isArray'](_0x2d2978[_0xe896('0x39')]['ids'])){for(var _0x2008a9=0x0;_0x2008a9<_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]['length'];_0x2008a9+=0x1){socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')][_0x2008a9]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}}else{socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}});}})[_0xe896('0x2b')](respondWithStatusCode(_0x36994f,null))['catch'](handleError(_0x36994f,null));};exports[_0xe896('0x7a')]=function(_0x317880,_0x3d3a1b,_0x3b0f36){var _0x48885e={};var _0x12f5f6={};var _0x129fe0;var _0x8089;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x317880[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3d3a1b,null))[_0xe896('0x2b')](function(_0x1f37e4){if(_0x1f37e4){_0x129fe0=_0x1f37e4;_0x12f5f6[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7c')]['rawAttributes']);_0x12f5f6[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x317880[_0xe896('0x39')]);_0x12f5f6['filters']=_[_0xe896('0x3c')](_0x12f5f6['model'],_0x12f5f6['query']);_0x48885e[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x12f5f6[_0xe896('0x3e')],qs['fields'](_0x317880[_0xe896('0x39')][_0xe896('0x3f')]));_0x48885e['attributes']=_0x48885e['attributes'][_0xe896('0x40')]?_0x48885e[_0xe896('0x3d')]:_0x12f5f6[_0xe896('0x3e')];_0x48885e[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x317880[_0xe896('0x39')][_0xe896('0x42')]);_0x48885e['where']=qs['filters'](_[_0xe896('0x44')](_0x317880['query'],_0x12f5f6['filters']));if(_0x317880[_0xe896('0x39')][_0xe896('0x45')]){_0x48885e[_0xe896('0x43')]=_[_0xe896('0x48')](_0x48885e['where'],{'$or':_[_0xe896('0x46')](_0x48885e[_0xe896('0x3d')],function(_0x487d67){var _0x13da47={};_0x13da47[_0x487d67]={'$like':'%'+_0x317880[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x13da47;})});}_0x48885e=_[_0xe896('0x48')]({},_0x48885e,_0x317880[_0xe896('0x49')]);return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x1c5812){if(_0x1c5812){_0x8089=_0x1c5812[_0xe896('0x40')];if(!_0x317880[_0xe896('0x39')][_0xe896('0x7e')](_0xe896('0x41'))){_0x48885e[_0xe896('0x23')]=qs['limit'](_0x317880[_0xe896('0x39')][_0xe896('0x23')]);_0x48885e[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x317880[_0xe896('0x39')][_0xe896('0x25')]);}return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x2bf6d5){if(_0x2bf6d5){return _0x2bf6d5?{'count':_0x8089,'rows':_0x2bf6d5}:null;}})[_0xe896('0x2b')](respondWithResult(_0x3d3a1b,null))['catch'](handleError(_0x3d3a1b,null));};exports['getTeams']=function(_0x41e6c4,_0x42c83c,_0x3822cd){var _0x56ee2d={};var _0x100804={};var _0x13b335;var _0x54f5e5;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x41e6c4['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x42c83c,null))[_0xe896('0x2b')](function(_0x20cfaf){if(_0x20cfaf){_0x13b335=_0x20cfaf;_0x100804[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7f')][_0xe896('0x4f')]);_0x100804[_0xe896('0x39')]=_['keys'](_0x41e6c4[_0xe896('0x39')]);_0x100804[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],_0x100804[_0xe896('0x39')]);_0x56ee2d['attributes']=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x41e6c4['query'][_0xe896('0x3f')]));_0x56ee2d[_0xe896('0x3d')]=_0x56ee2d[_0xe896('0x3d')][_0xe896('0x40')]?_0x56ee2d[_0xe896('0x3d')]:_0x100804[_0xe896('0x3e')];_0x56ee2d[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x41e6c4[_0xe896('0x39')]['sort']);_0x56ee2d[_0xe896('0x43')]=qs['filters'](_[_0xe896('0x44')](_0x41e6c4[_0xe896('0x39')],_0x100804[_0xe896('0x3b')]));if(_0x41e6c4[_0xe896('0x39')]['filter']){_0x56ee2d[_0xe896('0x43')]=_[_0xe896('0x48')](_0x56ee2d['where'],{'$or':_[_0xe896('0x46')](_0x56ee2d[_0xe896('0x3d')],function(_0x474924){var _0x498987={};_0x498987[_0x474924]={'$like':'%'+_0x41e6c4[_0xe896('0x39')]['filter']+'%'};return _0x498987;})});}_0x56ee2d=_['merge']({},_0x56ee2d,_0x41e6c4[_0xe896('0x49')]);return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0x1cf246){if(_0x1cf246){_0x54f5e5=_0x1cf246[_0xe896('0x40')];if(!_0x41e6c4['query']['hasOwnProperty']('nolimit')){_0x56ee2d['limit']=qs[_0xe896('0x23')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x23')]);_0x56ee2d[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x25')]);}return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0xd345d8){if(_0xd345d8){return _0xd345d8?{'count':_0x54f5e5,'rows':_0xd345d8}:null;}})[_0xe896('0x2b')](respondWithResult(_0x42c83c,null))[_0xe896('0x4d')](handleError(_0x42c83c,null));};exports[_0xe896('0x81')]=function(_0x5a254b,_0x4f4d26,_0x2f30a9){var _0x33fbb8=_0x5a254b['body']['ids'];var _0x419fc7;return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x33fbb8},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id','name',_0xe896('0x83'),_0xe896('0x84'),_0xe896('0x85')],'raw':!![]}]})['then'](function(_0x231dcd){if(_0x231dcd){_0x419fc7=_0x231dcd;var _0x219ef1=_[_0xe896('0x86')](_0x231dcd,function(_0xdeaa37){var _0x43676c=_0xdeaa37['get']({'plain':!![]});return _0x43676c[_0xe896('0x82')];});return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x5a254b['params']['id']}})[_0xe896('0x2b')](function(_0x5bfd3b){return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x1e1820){return _0x5bfd3b[_0xe896('0x81')](_0x33fbb8,{'transaction':_0x1e1820})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x419fc7,function(_0x4870d7){return db['TeamVoicePrefix'][_0xe896('0x88')]({'TeamId':_0x4870d7['id'],'VoicePrefixId':_0x5a254b['params']['id']},{'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x219ef1,function(_0x5ac4ad){return db[_0xe896('0x89')][_0xe896('0x8a')]({'where':{'UserId':_0x5ac4ad['id'],'VoicePrefixId':_0x5a254b['params']['id']},'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){_0x219ef1['forEach'](function(_0x326c67){socket[_0xe896('0x78')](_0xe896('0x8b'),{'UserId':_0x326c67['id'],'VoicePrefixId':_0x5bfd3b['id']});});});});});}})[_0xe896('0x2b')](respondWithStatusCode(_0x4f4d26,null))['catch'](handleError(_0x4f4d26,null));};exports[_0xe896('0x8c')]=function(_0x25b297,_0x111c0d,_0x22ac85){return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x25b297[_0xe896('0x39')][_0xe896('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id'],'raw':!![]}]})[_0xe896('0x2b')](handleEntityNotFound(_0x111c0d,null))[_0xe896('0x2b')](function(_0x23049d){var _0x39e735=_[_0xe896('0x46')](_0x23049d,'id');var _0xc0cb7c=[];var _0x16b398=[];var _0x4edeaf=squel[_0xe896('0x8d')]();_0x4edeaf[_0xe896('0x8e')]('tq.TeamId')['from'](_0xe896('0x8f'),'tq')[_0xe896('0x90')](_0xe896('0x91'),'ut',_0xe896('0x92'))[_0xe896('0x43')](_0xe896('0x93'),_0x25b297[_0xe896('0x73')]['id']);for(var _0x46a4f0=0x0;_0x46a4f0<_0x23049d['length'];_0x46a4f0+=0x1){let _0x13eb9a=_0x23049d[_0x46a4f0];for(var _0x3c70a3=0x0;_0x3c70a3<_0x13eb9a[_0xe896('0x82')][_0xe896('0x40')];_0x3c70a3+=0x1){let _0x59bea9=_0x13eb9a[_0xe896('0x82')][_0x3c70a3];var _0x54b2f0=_0x4edeaf['clone']();_0x54b2f0[_0xe896('0x43')](_0xe896('0x94'),_0x59bea9['id']);_0x16b398[_0xe896('0x6a')](db[_0xe896('0x54')][_0xe896('0x39')](_0x54b2f0[_0xe896('0x95')](),{'type':db[_0xe896('0x54')]['QueryTypes'][_0xe896('0x96')]})[_0xe896('0x2b')](function(_0x98bc8){if(_0x98bc8[_0xe896('0x40')]===0x1){return _0x59bea9['id'];}else{var _0xe78476=_[_0xe896('0x97')](_[_0xe896('0x46')](_0x98bc8,_0xe896('0x98')),function(_0x3c377e){return _['includes'](_0x39e735,_0x3c377e);});if(_0xe78476){return _0x59bea9['id'];}}}));}}return BPromise[_0xe896('0x99')](_0x16b398)[_0xe896('0x2b')](function(_0x4983ea){_0xc0cb7c=_(_0xc0cb7c)[_0xe896('0x9a')](_0x4983ea)['compact']()['value']();return db[_0xe896('0x35')]['find']({'where':{'id':_0x25b297['params']['id']}})[_0xe896('0x2b')](function(_0x1af1a2){return db[_0xe896('0x54')]['transaction'](function(_0x2b72af){return _0x1af1a2['removeTeams'](_0x25b297[_0xe896('0x39')][_0xe896('0x75')],{'transaction':_0x2b72af})['then'](function(){if(!_[_0xe896('0x9b')](_0xc0cb7c)){return _0x1af1a2[_0xe896('0x77')](_0xc0cb7c,{'transaction':_0x2b72af});}})['then'](function(){_0xc0cb7c[_0xe896('0x9c')](function(_0x5478f3){socket['emit']('userVoicePrefix:remove',{'UserId':_0x5478f3,'VoicePrefixId':_0x1af1a2['id']});});});});});});})[_0xe896('0x2b')](respondWithStatusCode(_0x111c0d,null))['catch'](handleError(_0x111c0d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6901213..8e8d7ad 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 _0x10c5=['../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c3422,_0xe8dfee){var _0x55c276=function(_0x10ea4e){while(--_0x10ea4e){_0x1c3422['push'](_0x1c3422['shift']());}};_0x55c276(++_0xe8dfee);}(_0x10c5,0x12b));var _0x510c=function(_0x309b9e,_0x3a124d){_0x309b9e=_0x309b9e-0x0;var _0x201ea5=_0x10c5[_0x309b9e];return _0x201ea5;};'use strict';var EventEmitter=require(_0x510c('0x0'));var VoicePrefix=require(_0x510c('0x1'))['db'][_0x510c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x510c('0x3')](0x0);var events={'afterCreate':_0x510c('0x4'),'afterUpdate':'update','afterDestroy':_0x510c('0x5')};function emitEvent(_0x52bddc){return function(_0x1ac5b0,_0x41cf9e,_0x24e457){VoicePrefixEvents[_0x510c('0x6')](_0x52bddc+':'+_0x1ac5b0['id'],_0x1ac5b0);VoicePrefixEvents[_0x510c('0x6')](_0x52bddc,_0x1ac5b0);_0x24e457(null);};}for(var e in events){if(events[_0x510c('0x7')](e)){var event=events[e];VoicePrefix[_0x510c('0x8')](e,emitEvent(event));}}module[_0x510c('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xe92e=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xe92e,0x15d));var _0xee92=function(_0x178cfc,_0x376724){_0x178cfc=_0x178cfc-0x0;var _0x4fe030=_0xe92e[_0x178cfc];return _0x4fe030;};'use strict';var EventEmitter=require(_0xee92('0x0'));var VoicePrefix=require(_0xee92('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xee92('0x2')](0x0);var events={'afterCreate':_0xee92('0x3'),'afterUpdate':_0xee92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b4ccc){return function(_0xca7940,_0x25a1a8,_0x3b7745){VoicePrefixEvents['emit'](_0x4b4ccc+':'+_0xca7940['id'],_0xca7940);VoicePrefixEvents[_0xee92('0x5')](_0x4b4ccc,_0xca7940);_0x3b7745(null);};}for(var e in events){if(events[_0xee92('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xee92('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8f06199..46bc2f4 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 _0x3736=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x3736,0x1c9));var _0x6373=function(_0x3d994d,_0x3347e0){_0x3d994d=_0x3d994d-0x0;var _0x2bd56f=_0x3736[_0x3d994d];return _0x2bd56f;};'use strict';var _=require(_0x6373('0x0'));var util=require(_0x6373('0x1'));var logger=require(_0x6373('0x2'))(_0x6373('0x3'));var moment=require(_0x6373('0x4'));var BPromise=require(_0x6373('0x5'));var rp=require(_0x6373('0x6'));var fs=require('fs');var path=require(_0x6373('0x7'));var rimraf=require(_0x6373('0x8'));var config=require(_0x6373('0x9'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x2865c7,_0x3135b0){return _0x2865c7[_0x6373('0xa')](_0x6373('0xb'),attributes,{'tableName':_0x6373('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x639d=['./voicePrefix.attributes','define','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x5e0ff0,_0x3ecf9a){var _0x48d99b=function(_0x443ae2){while(--_0x443ae2){_0x5e0ff0['push'](_0x5e0ff0['shift']());}};_0x48d99b(++_0x3ecf9a);}(_0x639d,0x89));var _0xd639=function(_0x1de3d1,_0xc74518){_0x1de3d1=_0x1de3d1-0x0;var _0x56cf9b=_0x639d[_0x1de3d1];return _0x56cf9b;};'use strict';var _=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var logger=require(_0xd639('0x2'))(_0xd639('0x3'));var moment=require('moment');var BPromise=require(_0xd639('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd639('0x5'));var config=require(_0xd639('0x6'));var attributes=require(_0xd639('0x7'));module['exports']=function(_0x5ce215,_0xd39193){return _0x5ce215[_0xd639('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3c25e56..ac5021b 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 _0x27c8=['stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x348587,_0x58c657){var _0x1d777d=function(_0x25d467){while(--_0x25d467){_0x348587['push'](_0x348587['shift']());}};_0x1d777d(++_0x58c657);}(_0x27c8,0x6a));var _0x827c=function(_0x252199,_0x48cf98){_0x252199=_0x252199-0x0;var _0x4bacd8=_0x27c8[_0x252199];return _0x4bacd8;};'use strict';var _=require('lodash');var util=require(_0x827c('0x0'));var moment=require(_0x827c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x827c('0x2'));var db=require(_0x827c('0x3'))['db'];var utils=require(_0x827c('0x4'));var logger=require(_0x827c('0x5'))(_0x827c('0x6'));var config=require(_0x827c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x827c('0x8')]({'port':0x232a});config[_0x827c('0x9')]=_[_0x827c('0xa')](config[_0x827c('0x9')],{'host':_0x827c('0xb'),'port':0x18eb});var socket=require(_0x827c('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x827c('0xd')](socket);function respondWithRpcPromise(_0x35b5ba,_0x544f14,_0x5c3fc8){return new BPromise(function(_0x3f0a30,_0x193193){return client['request'](_0x35b5ba,_0x5c3fc8)[_0x827c('0xe')](function(_0x2fea87){logger[_0x827c('0xf')](_0x827c('0x10'),_0x544f14,'request\x20sent');logger[_0x827c('0x11')](_0x827c('0x12'),_0x544f14,'request\x20sent',JSON[_0x827c('0x13')](_0x2fea87));if(_0x2fea87[_0x827c('0x14')]){if(_0x2fea87[_0x827c('0x14')][_0x827c('0x15')]===0x1f4){logger[_0x827c('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x544f14,_0x2fea87['error']['message']);return _0x193193(_0x2fea87[_0x827c('0x14')][_0x827c('0x16')]);}logger[_0x827c('0x14')](_0x827c('0x10'),_0x544f14,_0x2fea87['error'][_0x827c('0x16')]);return _0x3f0a30(_0x2fea87[_0x827c('0x14')][_0x827c('0x16')]);}else{logger[_0x827c('0xf')](_0x827c('0x10'),_0x544f14,'request\x20sent');_0x3f0a30(_0x2fea87[_0x827c('0x17')]['message']);}})[_0x827c('0x18')](function(_0x3f7270){logger['error'](_0x827c('0x10'),_0x544f14,_0x3f7270);_0x193193(_0x3f7270);});});} \ No newline at end of file +var _0xc0d7=['jayson/promise','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x48d919,_0x44f303){var _0x1bc6fb=function(_0x2be882){while(--_0x2be882){_0x48d919['push'](_0x48d919['shift']());}};_0x1bc6fb(++_0x44f303);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x1db6ae,_0x403513){_0x1db6ae=_0x1db6ae-0x0;var _0x5156b9=_0xc0d7[_0x1db6ae];return _0x5156b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7c0d('0x0'));var rs=require(_0x7c0d('0x1'));var fs=require('fs');var Redis=require(_0x7c0d('0x2'));var db=require(_0x7c0d('0x3'))['db'];var utils=require(_0x7c0d('0x4'));var logger=require(_0x7c0d('0x5'))(_0x7c0d('0x6'));var config=require(_0x7c0d('0x7'));var jayson=require(_0x7c0d('0x8'));var client=jayson['client'][_0x7c0d('0x9')]({'port':0x232a});config[_0x7c0d('0xa')]=_[_0x7c0d('0xb')](config[_0x7c0d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c0d('0xc'))(new Redis(config[_0x7c0d('0xa')]));require(_0x7c0d('0xd'))[_0x7c0d('0xe')](socket);function respondWithRpcPromise(_0x49621d,_0x26be1d,_0x622ffd){return new BPromise(function(_0x4c0798,_0x5320fa){return client[_0x7c0d('0xf')](_0x49621d,_0x622ffd)[_0x7c0d('0x10')](function(_0x496398){logger[_0x7c0d('0x11')](_0x7c0d('0x12'),_0x26be1d,_0x7c0d('0x13'));logger[_0x7c0d('0x14')](_0x7c0d('0x15'),_0x26be1d,_0x7c0d('0x13'),JSON['stringify'](_0x496398));if(_0x496398[_0x7c0d('0x16')]){if(_0x496398[_0x7c0d('0x16')][_0x7c0d('0x17')]===0x1f4){logger[_0x7c0d('0x16')](_0x7c0d('0x12'),_0x26be1d,_0x496398[_0x7c0d('0x16')][_0x7c0d('0x18')]);return _0x5320fa(_0x496398[_0x7c0d('0x16')]['message']);}logger[_0x7c0d('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x26be1d,_0x496398[_0x7c0d('0x16')]['message']);return _0x4c0798(_0x496398[_0x7c0d('0x16')][_0x7c0d('0x18')]);}else{logger[_0x7c0d('0x11')](_0x7c0d('0x12'),_0x26be1d,_0x7c0d('0x13'));_0x4c0798(_0x496398[_0x7c0d('0x19')][_0x7c0d('0x18')]);}})[_0x7c0d('0x1a')](function(_0x34f2ef){logger[_0x7c0d('0x16')](_0x7c0d('0x12'),_0x26be1d,_0x34f2ef);_0x5320fa(_0x34f2ef);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c511944..1e491a1 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 _0x682e=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x682e,0x1ce));var _0xe682=function(_0x3db902,_0x47208a){_0x3db902=_0x3db902-0x0;var _0xe06d91=_0x682e[_0x3db902];return _0xe06d91;};'use strict';var VoicePrefixEvents=require(_0xe682('0x0'));var events=[_0xe682('0x1'),_0xe682('0x2'),_0xe682('0x3')];function createListener(_0x1fc41a,_0x31f019){return function(_0x5cbf47){_0x31f019[_0xe682('0x4')](_0x1fc41a,_0x5cbf47);};}function removeListener(_0x10c8cd,_0x3705a2){return function(){VoicePrefixEvents[_0xe682('0x5')](_0x10c8cd,_0x3705a2);};}exports[_0xe682('0x6')]=function(_0x51e786){for(var _0x3b4c98=0x0,_0xd6995=events[_0xe682('0x7')];_0x3b4c98<_0xd6995;_0x3b4c98++){var _0x1ab428=events[_0x3b4c98];var _0x4e7e7d=createListener(_0xe682('0x8')+_0x1ab428,_0x51e786);VoicePrefixEvents['on'](_0x1ab428,_0x4e7e7d);}}; \ No newline at end of file +var _0xacfe=['voicePrefix:','remove','update','emit','removeListener','register'];(function(_0x530691,_0x2ed3e6){var _0x4a4204=function(_0x55110d){while(--_0x55110d){_0x530691['push'](_0x530691['shift']());}};_0x4a4204(++_0x2ed3e6);}(_0xacfe,0xfd));var _0xeacf=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xacfe[_0x42245d];return _0x4b211a;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xeacf('0x0'),_0xeacf('0x1')];function createListener(_0x1be610,_0x1b5e18){return function(_0xf1d406){_0x1b5e18[_0xeacf('0x2')](_0x1be610,_0xf1d406);};}function removeListener(_0x2fbe17,_0x2bd934){return function(){VoicePrefixEvents[_0xeacf('0x3')](_0x2fbe17,_0x2bd934);};}exports[_0xeacf('0x4')]=function(_0x369ad7){for(var _0x229f28=0x0,_0x13cba2=events['length'];_0x229f28<_0x13cba2;_0x229f28++){var _0x411634=events[_0x229f28];var _0xce0437=createListener(_0xeacf('0x5')+_0x411634,_0x369ad7);VoicePrefixEvents['on'](_0x411634,_0xce0437);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8f84e43..9b1d22d 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(_0x29d044,_0x4d9f96){var _0x522c49=function(_0x5af506){while(--_0x5af506){_0x29d044['push'](_0x29d044['shift']());}};_0x522c49(++_0x4d9f96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2b7ab3,_0x2a67ca){var _0x5e96e0=function(_0x524336){while(--_0x524336){_0x2b7ab3['push'](_0x2b7ab3['shift']());}};_0x5e96e0(++_0x2a67ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d760dee..6474cd7 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 _0x0b33=['TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','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','sequelize','name','ENUM','inbound','default','ringall','leastrecent','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','progressive','predictive','power','STRING','INTEGER','yes','all','once'];(function(_0x1fc3a5,_0x271270){var _0x5ef0ea=function(_0x4d6f13){while(--_0x4d6f13){_0x1fc3a5['push'](_0x1fc3a5['shift']());}};_0x5ef0ea(++_0x271270);}(_0x0b33,0x17b));var _0x30b3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0b33[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x30b3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x30b3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30b3('0x2')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x30b3('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x30b3('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x30b3('0x5'),_0x30b3('0x6'),'fewestcalls',_0x30b3('0x7'),'rrmemory',_0x30b3('0x8'),_0x30b3('0x9'),_0x30b3('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1c651c){this[_0x30b3('0xb')](_0x30b3('0xc'),_0x1c651c?_0x1c651c:_0x30b3('0xd'));},'get':function(){var _0x5d37df=this[_0x30b3('0xe')](_0x30b3('0xf'));var _0x12f162=this[_0x30b3('0xe')](_0x30b3('0x10'));var _0x368e5e=this[_0x30b3('0xe')](_0x30b3('0xc'));if(_0x5d37df===_0x30b3('0x3')){return _0x368e5e;}if(_0x12f162===_0x30b3('0x11')&&_0x368e5e==='rrmemory'||_0x12f162===_0x30b3('0x11')&&_0x368e5e==='roundrobin'){return _0x368e5e;}if(_0x12f162===_0x30b3('0x12')||_0x12f162===_0x30b3('0x13')||_0x12f162===_0x30b3('0x14')){return _0x368e5e;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x30b3('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x30b3('0x15')]},'weight':{'type':Sequelize[_0x30b3('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x30b3('0x17'),'no'),'defaultValue':_0x30b3('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x30b3('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x30b3('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x30b3('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x30b3('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x30b3('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x30b3('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x30b3('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x30b3('0x15')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x17'),'no'),'defaultValue':_0x30b3('0x17')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x30b3('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x30b3('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x30b3('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x30b3('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x30b3('0x15')]},'queue_youarenext':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x30b3('0x15')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x30b3('0x15')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x30b3('0x15')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x30b3('0x1a')],'set':function(_0x33b000){this[_0x30b3('0xb')](_0x30b3('0x1b'),_0x33b000?_0x33b000[_0x30b3('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x30b3('0x1b'))?this[_0x30b3('0xe')]('periodic_announce')[_0x30b3('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':'yes','set':function(_0x84040d){this['setDataValue'](_0x30b3('0x1e'),_0x84040d?_0x84040d[_0x30b3('0x1c')](','):undefined);},'get':function(){return this[_0x30b3('0xe')](_0x30b3('0x1e'))?this['getDataValue']('joinempty')[_0x30b3('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':'no','set':function(_0x42590){this[_0x30b3('0xb')](_0x30b3('0x1f'),_0x42590?_0x42590[_0x30b3('0x1c')](','):undefined);},'get':function(){return this[_0x30b3('0xe')](_0x30b3('0x1f'))?this[_0x30b3('0xe')](_0x30b3('0x1f'))[_0x30b3('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x30b3('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x30b3('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x30b3('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30b3('0x15')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2b9ba3){this['setDataValue'](_0x30b3('0x20'),_0x2b9ba3);if(_0x2b9ba3){if(this[_0x30b3('0xe')]('wrapuptime')<0x2){this['setDataValue'](_0x30b3('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x30b3('0x22')],'defaultValue':0x0,'comment':_0x30b3('0x23')},'dialMethod':{'type':Sequelize[_0x30b3('0x2')]('preview',_0x30b3('0x12'),'power',_0x30b3('0x13'),_0x30b3('0x11')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x30b3('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x30b3('0x16')](0x4)[_0x30b3('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x30b3('0x25')},'dialPowerLevel':{'type':Sequelize[_0x30b3('0x26')](0x2)[_0x30b3('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x27'),_0x30b3('0x28')),'defaultValue':_0x30b3('0x28'),'comment':_0x30b3('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x30b3('0x26')](0x2)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x30b3('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x30b3('0x15')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x30b3('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':'tTxX','comment':_0x30b3('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x2d')},'dialQueueProject':{'type':Sequelize[_0x30b3('0x15')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x30b3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30b3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x30b3('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x30b3('0x16')](0x5)[_0x30b3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x30b3('0x32')},'dialTimezone':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x30b3('0x15')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x33'),_0x30b3('0x34'),_0x30b3('0x35')),'defaultValue':_0x30b3('0x33')},'dialAMDActive':{'type':Sequelize[_0x30b3('0x22')],'defaultValue':0x0,'comment':_0x30b3('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x30b3('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x30b3('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x30b3('0x16')](0x9)[_0x30b3('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x30b3('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x30b3('0x16')](0x9)[_0x30b3('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x30b3('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x30b3('0x16')](0x9)[_0x30b3('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x30b3('0x16')](0x9)[_0x30b3('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x30b3('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x30b3('0x16')](0x9)[_0x30b3('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x30b3('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x30b3('0x16')](0x5)[_0x30b3('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x30b3('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x30b3('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x30b3('0x3d')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x30b3('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x30b3('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x30b3('0x22')],'defaultValue':0x0,'comment':_0x30b3('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x30b3('0x2')](_0x30b3('0x40'),_0x30b3('0x41')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x30b3('0x15')],'comment':_0x30b3('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x30b3('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x30b3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30b3('0x43')},'dialCutDigit':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30b3('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30b3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x30b3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x30b3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30b3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30b3('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x30b3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30b3('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30b3('0x16')],'allowNull':!![],'comment':_0x30b3('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x30b3('0x22')],'defaultValue':![],'comment':_0x30b3('0x4f'),'set':function(_0x5a6caa){if(!_0x5a6caa)this[_0x30b3('0xb')](_0x30b3('0x50'),null);this[_0x30b3('0xb')]('mandatoryDisposition',_0x5a6caa);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x30b3('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x30b3('0x16')](0x3)[_0x30b3('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0159=['sequelize','exports','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','random','wrandom','rrordered','ringall','setDataValue','rrmemory','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','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)','#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'];(function(_0x11e762,_0x3f7103){var _0x24c967=function(_0x4a3cf0){while(--_0x4a3cf0){_0x11e762['push'](_0x11e762['shift']());}};_0x24c967(++_0x3f7103);}(_0x0159,0xe4));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9015('0x0'));module[_0x9015('0x1')]={'name':{'type':Sequelize[_0x9015('0x2')],'allowNull':![],'unique':_0x9015('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9015('0x4')]('inbound',_0x9015('0x5')),'allowNull':![],'defaultValue':_0x9015('0x6')},'musiconhold':{'type':Sequelize[_0x9015('0x2')],'defaultValue':_0x9015('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x9015('0x8'),_0x9015('0x9'),_0x9015('0xa'),'rrmemory','linear',_0x9015('0xb'),_0x9015('0xc')),'allowNull':![],'defaultValue':_0x9015('0xd'),'set':function(_0xbd6a22){this[_0x9015('0xe')]('strategy',_0xbd6a22?_0xbd6a22:_0x9015('0xf'));},'get':function(){var _0x328d7d=this[_0x9015('0x10')](_0x9015('0x11'));var _0x15301f=this[_0x9015('0x10')](_0x9015('0x12'));var _0x511939=this['getDataValue']('strategy');if(_0x328d7d===_0x9015('0x6')){return _0x511939;}if(_0x15301f===_0x9015('0x13')&&_0x511939===_0x9015('0xf')||_0x15301f===_0x9015('0x13')&&_0x511939==='roundrobin'){return _0x511939;}if(_0x15301f===_0x9015('0x14')||_0x15301f===_0x9015('0x15')||_0x15301f===_0x9015('0x16')){return _0x511939;}return null;}},'servicelevel':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9015('0x17')](0xb)},'timeout':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x9015('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9015('0x4')]('yes','no'),'defaultValue':_0x9015('0x18')},'autopause':{'type':Sequelize[_0x9015('0x4')]('yes','no',_0x9015('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x9015('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x9015('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9015('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9015('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9015('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x9015('0x18'),'no'),'defaultValue':_0x9015('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x9015('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9015('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9015('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9015('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9015('0x2')]},'queue_youarenext':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9015('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9015('0x2')]},'queue_quantity1':{'type':Sequelize[_0x9015('0x2')]},'queue_quantity2':{'type':Sequelize[_0x9015('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x9015('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3a03b5){this['setDataValue'](_0x9015('0x1a'),_0x3a03b5?_0x3a03b5[_0x9015('0x1b')](','):[]);},'get':function(){return this[_0x9015('0x10')](_0x9015('0x1a'))?this[_0x9015('0x10')](_0x9015('0x1a'))[_0x9015('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x9015('0x18'),'set':function(_0x4c8168){this['setDataValue'](_0x9015('0x1d'),_0x4c8168?_0x4c8168['join'](','):undefined);},'get':function(){return this[_0x9015('0x10')]('joinempty')?this[_0x9015('0x10')](_0x9015('0x1d'))[_0x9015('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9015('0x2')],'defaultValue':'no','set':function(_0x48162c){this[_0x9015('0xe')]('leavewhenempty',_0x48162c?_0x48162c['join'](','):undefined);},'get':function(){return this[_0x9015('0x10')](_0x9015('0x1e'))?this[_0x9015('0x10')](_0x9015('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x9015('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9015('0x2')]},'description':{'type':Sequelize[_0x9015('0x2')]},'acw':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':0x0,'set':function(_0x1a1396){this[_0x9015('0xe')]('acw',_0x1a1396);if(_0x1a1396){if(this['getDataValue'](_0x9015('0x20'))<0x2){this[_0x9015('0xe')](_0x9015('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9015('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':0x0,'comment':_0x9015('0x21')},'dialMethod':{'type':Sequelize[_0x9015('0x4')]('preview','progressive',_0x9015('0x16'),_0x9015('0x15'),_0x9015('0x13')),'defaultValue':_0x9015('0x14'),'comment':_0x9015('0x22')},'dialLimitChannel':{'type':Sequelize[_0x9015('0x17')](0x4)[_0x9015('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x9015('0x17')](0x4)[_0x9015('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9015('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x9015('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9015('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x26'),_0x9015('0x27')),'defaultValue':_0x9015('0x27'),'comment':_0x9015('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9015('0x29')](0x2)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9015('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9015('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9015('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9015('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x9015('0x2')],'defaultValue':'tTxX','comment':_0x9015('0x2b')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x2c')},'dialQueueProject':{'type':Sequelize[_0x9015('0x2')],'comment':_0x9015('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)[_0x9015('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9015('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)[_0x9015('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9015('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9015('0x34')},'dialTimezone':{'type':Sequelize[_0x9015('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9015('0x2')],'defaultValue':_0x9015('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9015('0x4')](_0x9015('0x36'),'never',_0x9015('0x37')),'defaultValue':_0x9015('0x36')},'dialAMDActive':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9015('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x9015('0x17')](0x9)[_0x9015('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9015('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9015('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9015('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x9015('0x17')](0x9)[_0x9015('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9015('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9015('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9015('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9015('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9015('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9015('0x17')](0x9)[_0x9015('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x9015('0x17')](0x5)[_0x9015('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':0x0,'comment':_0x9015('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9015('0x3f'),_0x9015('0x40')),'defaultValue':_0x9015('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x9015('0x2')],'comment':_0x9015('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9015('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)[_0x9015('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)[_0x9015('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9015('0x17')](0x3)[_0x9015('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9015('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9015('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9015('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9015('0x17')],'allowNull':!![],'comment':_0x9015('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':![],'comment':_0x9015('0x4a'),'set':function(_0x20e87d){if(!_0x20e87d)this['setDataValue'](_0x9015('0x4b'),null);this[_0x9015('0xe')]('mandatoryDisposition',_0x20e87d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9015('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9015('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x9015('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c945460..95d895b 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 _0x598a=['compact','removeTeams','isEmpty','removeAgents','addAgents','isNil','SIP/%s','all','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','VoiceQueues','outbound','ignore','map','value','type','UserProfileResource','then','end','error','name','index','rawAttributes','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueue','includeAll','include','rows','catch','show','keys','find','create','user','role','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','order','VoiceQueueId','CmHopperHistory','findAll','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','online','interface','flatMap','Agents','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','voicePause','forEach','emit','userVoiceQueue:save','Team','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x598a,0xfb));var _0xa598=function(_0x28047d,_0x58797e){_0x28047d=_0x28047d-0x0;var _0x9ee4c8=_0x598a[_0x28047d];return _0x9ee4c8;};'use strict';var emlformat=require(_0xa598('0x0'));var rimraf=require(_0xa598('0x1'));var zipdir=require(_0xa598('0x2'));var jsonpatch=require(_0xa598('0x3'));var rp=require(_0xa598('0x4'));var moment=require('moment');var BPromise=require(_0xa598('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa598('0x6'));var csv=require(_0xa598('0x7'));var ejs=require(_0xa598('0x8'));var fs=require('fs');var fs_extra=require(_0xa598('0x9'));var _=require(_0xa598('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa598('0xb'));var deskjs=require(_0xa598('0xc'));var toCsv=require(_0xa598('0x7'));var querystring=require(_0xa598('0xd'));var Papa=require(_0xa598('0xe'));var Redis=require(_0xa598('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa598('0x10'));var hardwareService=require(_0xa598('0x11'));var logger=require(_0xa598('0x12'))(_0xa598('0x13'));var utils=require(_0xa598('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa598('0x15'));var db=require(_0xa598('0x16'))['db'];config[_0xa598('0x17')]=_['defaults'](config[_0xa598('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa598('0x18'))(new Redis(config[_0xa598('0x17')]));require(_0xa598('0x19'))[_0xa598('0x1a')](socket);function respondWithStatusCode(_0x1949b5,_0x21f1d8){_0x21f1d8=_0x21f1d8||0xcc;return function(_0x4ee141){if(_0x4ee141){return _0x1949b5[_0xa598('0x1b')](_0x21f1d8);}return _0x1949b5[_0xa598('0x1c')](_0x21f1d8)['end']();};}function respondWithResult(_0x88df86,_0x82a6cc){_0x82a6cc=_0x82a6cc||0xc8;return function(_0x6e6ff5){if(_0x6e6ff5){return _0x88df86[_0xa598('0x1c')](_0x82a6cc)[_0xa598('0x1d')](_0x6e6ff5);}};}function respondWithFilteredResult(_0xecb39d,_0x3cbb9f){return function(_0x2746e3){if(_0x2746e3){var _0x36492f=typeof _0x3cbb9f[_0xa598('0x1e')]==='undefined'&&typeof _0x3cbb9f[_0xa598('0x1f')]===_0xa598('0x20');var _0x3fd5a4=_0x2746e3[_0xa598('0x21')];var _0x2ad4ff=_0x36492f?0x0:_0x3cbb9f[_0xa598('0x1e')];var _0x53d689=_0x36492f?_0x2746e3['count']:_0x3cbb9f[_0xa598('0x1e')]+_0x3cbb9f['limit'];var _0x3ac469;if(_0x53d689>=_0x3fd5a4){_0x53d689=_0x3fd5a4;_0x3ac469=0xc8;}else{_0x3ac469=0xce;}_0xecb39d[_0xa598('0x1c')](_0x3ac469);return _0xecb39d[_0xa598('0x22')](_0xa598('0x23'),_0x2ad4ff+'-'+_0x53d689+'/'+_0x3fd5a4)[_0xa598('0x1d')](_0x2746e3);}return null;};}function patchUpdates(_0x24f4f0){return function(_0x483556){try{jsonpatch[_0xa598('0x24')](_0x483556,_0x24f4f0,!![]);}catch(_0x46d225){return BPromise[_0xa598('0x25')](_0x46d225);}return _0x483556[_0xa598('0x26')]();};}function saveUpdates(_0x802679,_0x3c533a){return function(_0x2c9a9b){if(_0x2c9a9b){return _0x2c9a9b[_0xa598('0x27')](_0x802679)['then'](function(_0x473d07){return _0x473d07;});}return null;};}function removeEntity(_0x414d2c,_0x499565){return function(_0x4ae8b1){if(_0x4ae8b1){return _0x4ae8b1[_0xa598('0x28')]()['then'](function(){var _0x527c9f=_0x4ae8b1[_0xa598('0x29')]({'plain':!![]});var _0x5918f1=[{'name':_0xa598('0x2a'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xa598('0x2b'),'ignore':![]}];var _0x4138a1=_(_0x5918f1)['filter'](_0xa598('0x2c'))[_0xa598('0x2d')](_0xa598('0x2e'))[_0xa598('0x2e')]();if(_['includes'](_0x4138a1,_0x527c9f[_0xa598('0x2f')])){return;}var _0x5ab302=_['find'](_0x5918f1,['value',_0x527c9f[_0xa598('0x2f')]])['name'];return db[_0xa598('0x30')][_0xa598('0x28')]({'where':{'type':_0x5ab302,'resourceId':_0x527c9f['id']}})[_0xa598('0x31')](function(){return _0x4ae8b1;});})['then'](function(){_0x414d2c[_0xa598('0x1c')](0xcc)[_0xa598('0x32')]();});}};}function handleEntityNotFound(_0x12c5b3,_0x21cd3a){return function(_0x232b6e){if(!_0x232b6e){_0x12c5b3['sendStatus'](0x194);}return _0x232b6e;};}function handleError(_0x430d21,_0x39a83e){_0x39a83e=_0x39a83e||0x1f4;return function(_0x25bc50){logger[_0xa598('0x33')](_0x25bc50['stack']);if(_0x25bc50[_0xa598('0x34')]){delete _0x25bc50[_0xa598('0x34')];}_0x430d21['status'](_0x39a83e)['send'](_0x25bc50);};}exports[_0xa598('0x35')]=function(_0xa19e0,_0xce832c){var _0x5a816b={},_0x1fed30={},_0x3928a1={'count':0x0,'rows':[]};var _0x556d2d=_[_0xa598('0x2d')](db['VoiceQueue'][_0xa598('0x36')],function(_0x4074b0){return{'name':_0x4074b0['fieldName'],'type':_0x4074b0[_0xa598('0x2f')][_0xa598('0x37')]};});_0x1fed30['model']=_[_0xa598('0x2d')](_0x556d2d,_0xa598('0x34'));_0x1fed30[_0xa598('0x38')]=_['keys'](_0xa19e0[_0xa598('0x38')]);_0x1fed30[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x1fed30['model'],_0x1fed30[_0xa598('0x38')]);_0x5a816b['attributes']=_[_0xa598('0x3a')](_0x1fed30[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0xa19e0['query']['fields']));_0x5a816b['attributes']=_0x5a816b['attributes'][_0xa598('0x3d')]?_0x5a816b[_0xa598('0x3e')]:_0x1fed30[_0xa598('0x3b')];if(!_0xa19e0[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x5a816b[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0xa19e0[_0xa598('0x38')][_0xa598('0x1f')]);_0x5a816b['offset']=qs[_0xa598('0x1e')](_0xa19e0[_0xa598('0x38')][_0xa598('0x1e')]);}_0x5a816b['order']=qs[_0xa598('0x41')](_0xa19e0[_0xa598('0x38')][_0xa598('0x41')]);_0x5a816b[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0xa19e0['query'],_0x1fed30['filters']),_0x556d2d);if(_0xa19e0[_0xa598('0x38')][_0xa598('0x44')]){_0x5a816b['where']=_[_0xa598('0x45')](_0x5a816b['where'],{'$or':_['map'](_0x556d2d,function(_0x829e75){if(_0x829e75['type']!==_0xa598('0x46')){var _0x4722f4={};_0x4722f4[_0x829e75[_0xa598('0x34')]]={'$like':'%'+_0xa19e0[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0x4722f4;}})});}_0x5a816b=_[_0xa598('0x45')]({},_0x5a816b,_0xa19e0[_0xa598('0x47')]);var _0x3d18d7={'where':_0x5a816b[_0xa598('0x42')]};return db[_0xa598('0x48')]['count'](_0x3d18d7)[_0xa598('0x31')](function(_0xf8099c){_0x3928a1[_0xa598('0x21')]=_0xf8099c;if(_0xa19e0[_0xa598('0x38')][_0xa598('0x49')]){_0x5a816b[_0xa598('0x4a')]=[{'all':!![]}];}return db[_0xa598('0x48')]['findAll'](_0x5a816b);})[_0xa598('0x31')](function(_0x13324b){_0x3928a1[_0xa598('0x4b')]=_0x13324b;return _0x3928a1;})[_0xa598('0x31')](respondWithFilteredResult(_0xce832c,_0x5a816b))[_0xa598('0x4c')](handleError(_0xce832c,null));};exports[_0xa598('0x4d')]=function(_0x475201,_0x21656a){var _0x49e12c={'raw':![],'where':{'id':_0x475201['params']['id']}},_0x2df028={};_0x2df028[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x48')][_0xa598('0x36')]);_0x2df028[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x475201[_0xa598('0x38')]);_0x2df028[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x2df028['model'],_0x2df028['query']);_0x49e12c[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x2df028[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0x475201['query']['fields']));_0x49e12c['attributes']=_0x49e12c[_0xa598('0x3e')][_0xa598('0x3d')]?_0x49e12c['attributes']:_0x2df028['model'];if(_0x475201['query'][_0xa598('0x49')]){_0x49e12c[_0xa598('0x4a')]=[{'all':!![]}];}_0x49e12c=_[_0xa598('0x45')]({},_0x49e12c,_0x475201[_0xa598('0x47')]);return db['VoiceQueue'][_0xa598('0x4f')](_0x49e12c)[_0xa598('0x31')](handleEntityNotFound(_0x21656a,null))[_0xa598('0x31')](respondWithResult(_0x21656a,null))[_0xa598('0x4c')](handleError(_0x21656a,null));};exports[_0xa598('0x50')]=function(_0x10a8de,_0x1f5097){return db[_0xa598('0x48')][_0xa598('0x50')](_0x10a8de['body'],{})[_0xa598('0x31')](function(_0x5440b8){var _0x5bdb02=_0x10a8de[_0xa598('0x51')]['get']({'plain':!![]});if(!_0x5bdb02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bdb02[_0xa598('0x52')]===_0xa598('0x51')){var _0x5d4715=_0x5440b8[_0xa598('0x29')]({'plain':!![]});var _0x4e4fc0=[{'name':_0xa598('0x2a'),'value':_0xa598('0x53')},{'name':_0xa598('0x54'),'value':_0xa598('0x2b')}];var _0x8e3ced=_[_0xa598('0x4f')](_0x4e4fc0,[_0xa598('0x2e'),_0x5d4715[_0xa598('0x2f')]])[_0xa598('0x34')];return db[_0xa598('0x55')][_0xa598('0x4f')]({'where':{'name':_0x8e3ced,'userProfileId':_0x5bdb02[_0xa598('0x56')]},'raw':!![]})[_0xa598('0x31')](function(_0x58a182){if(_0x58a182&&_0x58a182[_0xa598('0x57')]===0x0){return db[_0xa598('0x30')][_0xa598('0x50')]({'name':_0x5d4715['name'],'resourceId':_0x5d4715['id'],'type':_0x58a182[_0xa598('0x34')],'sectionId':_0x58a182['id']},{})[_0xa598('0x31')](function(){return _0x5440b8;});}else{return _0x5440b8;}})[_0xa598('0x4c')](function(_0x5c6985){logger[_0xa598('0x33')](_0xa598('0x58'),_0x5c6985);throw _0x5c6985;});}return _0x5440b8;})['then'](respondWithResult(_0x1f5097,0xc9))['catch'](handleError(_0x1f5097,null));};exports[_0xa598('0x59')]=function(_0x4d00c1,_0x3b80a0){var _0x2163bc={'where':{'id':_0x4d00c1[_0xa598('0x5a')]['id']}},_0x5c9db8={};_0x5c9db8[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x48')]['rawAttributes']);_0x2163bc[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x5c9db8[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0x4d00c1['query']['fields']));_0x2163bc[_0xa598('0x3e')]=_0x2163bc[_0xa598('0x3e')]['length']?_0x2163bc[_0xa598('0x3e')]:_0x5c9db8[_0xa598('0x3b')];if(_0x4d00c1[_0xa598('0x38')]['includeAll']){_0x2163bc[_0xa598('0x4a')]=[{'all':!![]}];}_0x2163bc=_[_0xa598('0x45')]({},_0x2163bc,_0x4d00c1[_0xa598('0x47')]);return db['VoiceQueue'][_0xa598('0x4f')](_0x2163bc)[_0xa598('0x31')](handleEntityNotFound(_0x3b80a0,null))['then'](function(_0xd12e6c){if(_0xd12e6c){var _0x5a7ee9=_0xd12e6c['get']({'plain':!![]});_0x5a7ee9=qs[_0xa598('0x5b')](_0x5a7ee9,['id',_0xa598('0x5c'),_0xa598('0x5d')]);_0x4d00c1[_0xa598('0x5e')]=_['omit'](_0x4d00c1[_0xa598('0x5e')],['id',_0xa598('0x5c'),_0xa598('0x5d')]);return db[_0xa598('0x48')][_0xa598('0x50')](_[_0xa598('0x45')](_0x5a7ee9,_0x4d00c1[_0xa598('0x5e')]),{'include':_0x4d00c1[_0xa598('0x38')][_0xa598('0x49')]?[{'all':!![]}]:undefined})[_0xa598('0x31')](function(_0x4ae14e){var _0x2beff7=_0x4d00c1[_0xa598('0x51')][_0xa598('0x29')]({'plain':!![]});if(!_0x2beff7)throw new Error(_0xa598('0x5f'));if(_0x2beff7['role']===_0xa598('0x51')){var _0xb81e3=_0x4ae14e['get']({'plain':!![]});var _0x4353dd=[{'name':'VoiceQueues','value':_0xa598('0x53')},{'name':'QueueCampaigns','value':'outbound'}];var _0x4b5056=_[_0xa598('0x4f')](_0x4353dd,[_0xa598('0x2e'),_0xb81e3['type']])['name'];return db[_0xa598('0x55')][_0xa598('0x4f')]({'where':{'name':_0x4b5056,'userProfileId':_0x2beff7[_0xa598('0x56')]},'raw':!![]})[_0xa598('0x31')](function(_0x59b864){if(_0x59b864&&_0x59b864[_0xa598('0x57')]===0x0){return db[_0xa598('0x30')][_0xa598('0x50')]({'name':_0xb81e3[_0xa598('0x34')],'resourceId':_0xb81e3['id'],'type':_0x59b864[_0xa598('0x34')],'sectionId':_0x59b864['id']},{})[_0xa598('0x31')](function(){return _0x4ae14e;});}else{return _0x4ae14e;}})['catch'](function(_0x1b7827){logger[_0xa598('0x33')](_0xa598('0x58'),_0x1b7827);throw _0x1b7827;});}return _0x4ae14e;});}})[_0xa598('0x31')](respondWithResult(_0x3b80a0,0xc9))[_0xa598('0x4c')](handleError(_0x3b80a0,null));};exports[_0xa598('0x27')]=function(_0xe0fd89,_0x314558){if(_0xe0fd89[_0xa598('0x5e')]['id']){delete _0xe0fd89[_0xa598('0x5e')]['id'];}return db[_0xa598('0x48')][_0xa598('0x4f')]({'where':{'id':_0xe0fd89[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x314558,null))[_0xa598('0x31')](saveUpdates(_0xe0fd89['body'],null))['then'](respondWithResult(_0x314558,null))[_0xa598('0x4c')](handleError(_0x314558,null));};exports[_0xa598('0x28')]=function(_0x54adf4,_0x26e2d0){return db['VoiceQueue'][_0xa598('0x4f')]({'where':{'id':_0x54adf4[_0xa598('0x5a')]['id']}})['then'](handleEntityNotFound(_0x26e2d0,null))['then'](removeEntity(_0x26e2d0,null))[_0xa598('0x4c')](handleError(_0x26e2d0,null));};exports[_0xa598('0x60')]=function(_0xfdd4f8,_0x57349b,_0x24ec4f){var _0x3db66f={'raw':![],'where':{}};var _0x202af1={};var _0x33b3af={'count':0x0,'rows':[]};return db[_0xa598('0x48')][_0xa598('0x61')]({'where':{'id':_0xfdd4f8['params']['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x57349b,null))['then'](function(_0x177178){if(_0x177178){_0x202af1[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x62')]['rawAttributes']);_0x202af1[_0xa598('0x38')]=_['keys'](_0xfdd4f8[_0xa598('0x38')]);_0x202af1[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x202af1[_0xa598('0x3b')],_0x202af1[_0xa598('0x38')]);_0x3db66f[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x202af1[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0xfdd4f8[_0xa598('0x38')]['fields']));_0x3db66f['attributes']=_0x3db66f[_0xa598('0x3e')][_0xa598('0x3d')]?_0x3db66f['attributes']:_0x202af1[_0xa598('0x3b')];if(!_0xfdd4f8['query'][_0xa598('0x3f')](_0xa598('0x40'))){_0x3db66f[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0xfdd4f8[_0xa598('0x38')][_0xa598('0x1f')]);_0x3db66f[_0xa598('0x1e')]=qs[_0xa598('0x1e')](_0xfdd4f8[_0xa598('0x38')][_0xa598('0x1e')]);}_0x3db66f[_0xa598('0x63')]=qs[_0xa598('0x41')](_0xfdd4f8[_0xa598('0x38')][_0xa598('0x41')]);_0x3db66f[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0xfdd4f8[_0xa598('0x38')],_0x202af1[_0xa598('0x39')]));_0x3db66f[_0xa598('0x42')][_0xa598('0x64')]=_0x177178['id'];if(_0xfdd4f8[_0xa598('0x38')][_0xa598('0x44')]){_0x3db66f[_0xa598('0x42')]=_[_0xa598('0x45')](_0x3db66f['where'],{'$or':_[_0xa598('0x2d')](_0x3db66f[_0xa598('0x3e')],function(_0x1e7df1){var _0x186864={};_0x186864[_0x1e7df1]={'$like':'%'+_0xfdd4f8['query']['filter']+'%'};return _0x186864;})});}_0x3db66f=_[_0xa598('0x45')]({},_0x3db66f,_0xfdd4f8[_0xa598('0x47')]);return db['CmHopper']['count']({'where':_0x3db66f['where']})[_0xa598('0x31')](function(_0x3ae0f6){_0x33b3af[_0xa598('0x21')]=_0x3ae0f6;if(_0xfdd4f8['query'][_0xa598('0x49')]){_0x3db66f[_0xa598('0x4a')]=[{'all':!![]}];}return db[_0xa598('0x62')]['findAll'](_0x3db66f);})[_0xa598('0x31')](function(_0x1307a7){_0x33b3af[_0xa598('0x4b')]=_0x1307a7;return _0x33b3af;});}})[_0xa598('0x31')](respondWithFilteredResult(_0x57349b,_0x3db66f))['catch'](handleError(_0x57349b,null));};exports['getHopperHistories']=function(_0x5441c6,_0x1f3acd,_0x418f26){var _0x5e0ba0={'raw':!![],'where':{}};var _0x4981a7={};var _0x4bcff0={'count':0x0,'rows':[]};return db[_0xa598('0x48')][_0xa598('0x61')]({'where':{'id':_0x5441c6[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x1f3acd,null))['then'](function(_0x11d155){if(_0x11d155){_0x4981a7[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x65')][_0xa598('0x36')]);_0x4981a7[_0xa598('0x38')]=_['keys'](_0x5441c6[_0xa598('0x38')]);_0x4981a7[_0xa598('0x39')]=_['intersection'](_0x4981a7['model'],_0x4981a7[_0xa598('0x38')]);_0x5e0ba0[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x4981a7['model'],qs[_0xa598('0x3c')](_0x5441c6[_0xa598('0x38')][_0xa598('0x3c')]));_0x5e0ba0[_0xa598('0x3e')]=_0x5e0ba0[_0xa598('0x3e')]['length']?_0x5e0ba0['attributes']:_0x4981a7[_0xa598('0x3b')];if(!_0x5441c6[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x5e0ba0[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x5441c6[_0xa598('0x38')][_0xa598('0x1f')]);_0x5e0ba0['offset']=qs[_0xa598('0x1e')](_0x5441c6[_0xa598('0x38')][_0xa598('0x1e')]);}_0x5e0ba0[_0xa598('0x63')]=qs['sort'](_0x5441c6['query'][_0xa598('0x41')]);_0x5e0ba0[_0xa598('0x42')]=qs['filters'](_[_0xa598('0x43')](_0x5441c6[_0xa598('0x38')],_0x4981a7[_0xa598('0x39')]));_0x5e0ba0[_0xa598('0x42')][_0xa598('0x64')]=_0x11d155['id'];if(_0x5441c6['query'][_0xa598('0x44')]){_0x5e0ba0[_0xa598('0x42')]=_['merge'](_0x5e0ba0[_0xa598('0x42')],{'$or':_[_0xa598('0x2d')](_0x5e0ba0['attributes'],function(_0x804931){var _0xa07e80={};_0xa07e80[_0x804931]={'$like':'%'+_0x5441c6[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0xa07e80;})});}_0x5e0ba0=_[_0xa598('0x45')]({},_0x5e0ba0,_0x5441c6['options']);return db['CmHopperHistory'][_0xa598('0x21')]({'where':_0x5e0ba0[_0xa598('0x42')]})[_0xa598('0x31')](function(_0x466516){_0x4bcff0[_0xa598('0x21')]=_0x466516;if(_0x5441c6[_0xa598('0x38')][_0xa598('0x49')]){_0x5e0ba0[_0xa598('0x4a')]=[{'all':!![]}];}return db[_0xa598('0x65')][_0xa598('0x66')](_0x5e0ba0);})[_0xa598('0x31')](function(_0x2ea2cb){_0x4bcff0[_0xa598('0x4b')]=_0x2ea2cb;return _0x4bcff0;});}})[_0xa598('0x31')](respondWithFilteredResult(_0x1f3acd,_0x5e0ba0))['catch'](handleError(_0x1f3acd,null));};exports['getHopperFinals']=function(_0x20a408,_0x53eeb5,_0x53732d){var _0x56a8e7={'raw':!![],'where':{}};var _0x1ecf05={};var _0x3faf3d={'count':0x0,'rows':[]};return db[_0xa598('0x48')][_0xa598('0x61')]({'where':{'id':_0x20a408[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x53eeb5,null))[_0xa598('0x31')](function(_0x377b98){if(_0x377b98){_0x1ecf05[_0xa598('0x3b')]=_[_0xa598('0x4e')](db['CmHopperFinal'][_0xa598('0x36')]);_0x1ecf05[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x20a408['query']);_0x1ecf05[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x1ecf05[_0xa598('0x3b')],_0x1ecf05[_0xa598('0x38')]);_0x56a8e7[_0xa598('0x3e')]=_['intersection'](_0x1ecf05['model'],qs['fields'](_0x20a408[_0xa598('0x38')][_0xa598('0x3c')]));_0x56a8e7[_0xa598('0x3e')]=_0x56a8e7[_0xa598('0x3e')][_0xa598('0x3d')]?_0x56a8e7[_0xa598('0x3e')]:_0x1ecf05[_0xa598('0x3b')];if(!_0x20a408[_0xa598('0x38')]['hasOwnProperty'](_0xa598('0x40'))){_0x56a8e7[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x20a408['query'][_0xa598('0x1f')]);_0x56a8e7[_0xa598('0x1e')]=qs[_0xa598('0x1e')](_0x20a408[_0xa598('0x38')][_0xa598('0x1e')]);}_0x56a8e7[_0xa598('0x63')]=qs['sort'](_0x20a408[_0xa598('0x38')]['sort']);_0x56a8e7[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0x20a408[_0xa598('0x38')],_0x1ecf05['filters']));_0x56a8e7[_0xa598('0x42')][_0xa598('0x64')]=_0x377b98['id'];if(_0x20a408[_0xa598('0x38')][_0xa598('0x44')]){_0x56a8e7['where']=_[_0xa598('0x45')](_0x56a8e7[_0xa598('0x42')],{'$or':_[_0xa598('0x2d')](_0x56a8e7[_0xa598('0x3e')],function(_0x300cf8){var _0x163191={};_0x163191[_0x300cf8]={'$like':'%'+_0x20a408[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0x163191;})});}_0x56a8e7=_[_0xa598('0x45')]({},_0x56a8e7,_0x20a408[_0xa598('0x47')]);return db[_0xa598('0x67')][_0xa598('0x21')]({'where':_0x56a8e7['where']})[_0xa598('0x31')](function(_0x3a113b){_0x3faf3d[_0xa598('0x21')]=_0x3a113b;if(_0x20a408[_0xa598('0x38')][_0xa598('0x49')]){_0x56a8e7[_0xa598('0x4a')]=[{'all':!![]}];}return db[_0xa598('0x67')][_0xa598('0x66')](_0x56a8e7);})[_0xa598('0x31')](function(_0x219fb6){_0x3faf3d[_0xa598('0x4b')]=_0x219fb6;return _0x3faf3d;});}})['then'](respondWithFilteredResult(_0x53eeb5,_0x56a8e7))[_0xa598('0x4c')](handleError(_0x53eeb5,null));};exports[_0xa598('0x68')]=function(_0x19e1f9,_0x4e6025,_0x5b28c7){var _0xf240d9={'raw':!![],'where':{}};var _0x47c95c={};var _0x56c4cf={'count':0x0,'rows':[]};return db[_0xa598('0x48')]['findOne']({'where':{'id':_0x19e1f9[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x4e6025,null))[_0xa598('0x31')](function(_0x2dd2e2){if(_0x2dd2e2){_0x47c95c[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x69')][_0xa598('0x36')]);_0x47c95c[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x19e1f9[_0xa598('0x38')]);_0x47c95c[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x47c95c[_0xa598('0x3b')],_0x47c95c[_0xa598('0x38')]);_0xf240d9[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x47c95c['model'],qs[_0xa598('0x3c')](_0x19e1f9[_0xa598('0x38')][_0xa598('0x3c')]));_0xf240d9[_0xa598('0x3e')]=_0xf240d9[_0xa598('0x3e')][_0xa598('0x3d')]?_0xf240d9['attributes']:_0x47c95c[_0xa598('0x3b')];if(!_0x19e1f9[_0xa598('0x38')]['hasOwnProperty']('nolimit')){_0xf240d9[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x19e1f9['query']['limit']);_0xf240d9[_0xa598('0x1e')]=qs[_0xa598('0x1e')](_0x19e1f9[_0xa598('0x38')]['offset']);}_0xf240d9['order']=qs[_0xa598('0x41')](_0x19e1f9[_0xa598('0x38')][_0xa598('0x41')]);_0xf240d9[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0x19e1f9[_0xa598('0x38')],_0x47c95c[_0xa598('0x39')]));_0xf240d9['where']['VoiceQueueId']=_0x2dd2e2['id'];if(_0x19e1f9['query'][_0xa598('0x44')]){_0xf240d9[_0xa598('0x42')]=_[_0xa598('0x45')](_0xf240d9[_0xa598('0x42')],{'$or':_['map'](_0xf240d9[_0xa598('0x3e')],function(_0x9eff95){var _0x4bb5e1={};_0x4bb5e1[_0x9eff95]={'$like':'%'+_0x19e1f9[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0x4bb5e1;})});}_0xf240d9=_[_0xa598('0x45')]({},_0xf240d9,_0x19e1f9[_0xa598('0x47')]);return db[_0xa598('0x69')]['count']({'where':_0xf240d9[_0xa598('0x42')]})[_0xa598('0x31')](function(_0x25484a){_0x56c4cf[_0xa598('0x21')]=_0x25484a;if(_0x19e1f9['query'][_0xa598('0x49')]){_0xf240d9[_0xa598('0x4a')]=[{'all':!![]}];}return db[_0xa598('0x69')][_0xa598('0x66')](_0xf240d9);})['then'](function(_0x1c14e7){_0x56c4cf[_0xa598('0x4b')]=_0x1c14e7;return _0x56c4cf;});}})[_0xa598('0x31')](respondWithFilteredResult(_0x4e6025,_0xf240d9))['catch'](handleError(_0x4e6025,null));};exports['getTeams']=function(_0x493333,_0x40ca45,_0x35d8b7){var _0x4d9371={};var _0x4ecfd9={};var _0x41bc8b;var _0x9a0dfe;return db[_0xa598('0x48')]['findOne']({'where':{'id':_0x493333[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x40ca45,null))[_0xa598('0x31')](function(_0x3db159){if(_0x3db159){_0x41bc8b=_0x3db159;_0x4ecfd9[_0xa598('0x3b')]=_['keys'](db['Team'][_0xa598('0x36')]);_0x4ecfd9[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x493333[_0xa598('0x38')]);_0x4ecfd9[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x4ecfd9[_0xa598('0x3b')],_0x4ecfd9['query']);_0x4d9371['attributes']=_[_0xa598('0x3a')](_0x4ecfd9['model'],qs['fields'](_0x493333[_0xa598('0x38')]['fields']));_0x4d9371['attributes']=_0x4d9371[_0xa598('0x3e')][_0xa598('0x3d')]?_0x4d9371[_0xa598('0x3e')]:_0x4ecfd9[_0xa598('0x3b')];_0x4d9371[_0xa598('0x63')]=qs[_0xa598('0x41')](_0x493333[_0xa598('0x38')]['sort']);_0x4d9371['where']=qs[_0xa598('0x39')](_['pick'](_0x493333[_0xa598('0x38')],_0x4ecfd9[_0xa598('0x39')]));if(_0x493333['query'][_0xa598('0x44')]){_0x4d9371[_0xa598('0x42')]=_[_0xa598('0x45')](_0x4d9371[_0xa598('0x42')],{'$or':_[_0xa598('0x2d')](_0x4d9371[_0xa598('0x3e')],function(_0xc22fae){var _0x5a912e={};_0x5a912e[_0xc22fae]={'$like':'%'+_0x493333[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0x5a912e;})});}_0x4d9371=_[_0xa598('0x45')]({},_0x4d9371,_0x493333[_0xa598('0x47')]);return _0x41bc8b[_0xa598('0x6a')](_0x4d9371);}})[_0xa598('0x31')](function(_0x40713b){if(_0x40713b){_0x9a0dfe=_0x40713b[_0xa598('0x3d')];if(!_0x493333['query'][_0xa598('0x3f')](_0xa598('0x40'))){_0x4d9371[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x493333['query'][_0xa598('0x1f')]);_0x4d9371['offset']=qs[_0xa598('0x1e')](_0x493333[_0xa598('0x38')][_0xa598('0x1e')]);}return _0x41bc8b[_0xa598('0x6a')](_0x4d9371);}})[_0xa598('0x31')](function(_0x4b7369){if(_0x4b7369){return _0x4b7369?{'count':_0x9a0dfe,'rows':_0x4b7369}:null;}})[_0xa598('0x31')](respondWithResult(_0x40ca45,null))[_0xa598('0x4c')](handleError(_0x40ca45,null));};exports[_0xa598('0x6b')]=function(_0x331fb5,_0x23635e,_0x502e6b){var _0x3d1e79=_0x331fb5[_0xa598('0x5e')][_0xa598('0x6c')];var _0x58ca85=_[_0xa598('0x2d')](_0x3d1e79,'id');return db['Team'][_0xa598('0x66')]({'where':{'id':_0x58ca85},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa598('0x34'),_0xa598('0x6d'),'voicePause',_0xa598('0x6e')],'raw':!![]}]})[_0xa598('0x31')](function(_0x1f39a3){if(_0x1f39a3){var _0x156a2f=_[_0xa598('0x6f')](_0x1f39a3,function(_0x1a956a){var _0x5addfc=_0x1a956a[_0xa598('0x29')]({'plain':!![]});_0x5addfc[_0xa598('0x70')]['forEach'](function(_0x2418d3){_0x2418d3[_0xa598('0x71')]=_[_0xa598('0x4f')](_0x3d1e79,{'id':_0x5addfc['id']})[_0xa598('0x71')];});return _0x5addfc[_0xa598('0x70')];});return db[_0xa598('0x48')][_0xa598('0x4f')]({'where':{'id':_0x331fb5[_0xa598('0x5a')]['id']}})['then'](function(_0x35b714){return db[_0xa598('0x72')][_0xa598('0x73')](function(_0x5b6d84){return _0x35b714[_0xa598('0x6b')](_0x58ca85,{'transaction':_0x5b6d84})['then'](function(){return BPromise[_0xa598('0x74')](_0x3d1e79,function(_0x32cf7a){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x32cf7a['id'],'VoiceQueueId':_0x331fb5[_0xa598('0x5a')]['id'],'penalty':_0x32cf7a[_0xa598('0x71')]},{'transaction':_0x5b6d84});});})[_0xa598('0x31')](function(){return BPromise[_0xa598('0x74')](_0x156a2f,function(_0x2e49ae){return db[_0xa598('0x75')][_0xa598('0x76')]({'where':{'UserId':_0x2e49ae['id'],'VoiceQueueId':_0x331fb5[_0xa598('0x5a')]['id']},'defaults':{'penalty':_0x2e49ae['penalty']},'transaction':_0x5b6d84});});})[_0xa598('0x31')](function(){return BPromise['each'](_[_0xa598('0x44')](_0x156a2f,{'online':!![]}),function(_0x9e5417){return db[_0xa598('0x77')][_0xa598('0x78')]({'membername':_0x9e5417[_0xa598('0x34')],'UserId':_0x9e5417['id'],'queue_name':_0x35b714[_0xa598('0x34')],'VoiceQueueId':_0x35b714['id'],'interface':_['isNil'](_0x9e5417[_0xa598('0x6e')])?util['format']('SIP/%s',_0x9e5417['name']):_0x9e5417[_0xa598('0x6e')],'paused':_0x9e5417[_0xa598('0x79')]||![],'penalty':_0x9e5417[_0xa598('0x71')]},{'transaction':_0x5b6d84});});})['then'](function(){_0x156a2f[_0xa598('0x7a')](function(_0x56cbba){socket[_0xa598('0x7b')](_0xa598('0x7c'),{'UserId':_0x56cbba['id'],'VoiceQueueId':_0x35b714['id']});});});});});}})[_0xa598('0x31')](respondWithStatusCode(_0x23635e,null))[_0xa598('0x4c')](handleError(_0x23635e,null));};exports['removeTeams']=function(_0x2ab527,_0x4dd654,_0x146a4c){return db[_0xa598('0x7d')]['findAll']({'where':{'id':_0x2ab527['query'][_0xa598('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xa598('0x7f')],'as':_0xa598('0x70'),'attributes':['id'],'raw':!![]}]})[_0xa598('0x31')](handleEntityNotFound(_0x4dd654,null))['then'](function(_0x1be477){var _0x37444b=_['map'](_0x1be477,'id');var _0x1b4c60=[];var _0x3c5f6b=[];var _0xe8e809=squel['select']();_0xe8e809[_0xa598('0x80')](_0xa598('0x81'))[_0xa598('0x82')](_0xa598('0x83'),'tq')[_0xa598('0x84')]('user_has_teams','ut',_0xa598('0x85'))[_0xa598('0x42')](_0xa598('0x86'),_0x2ab527[_0xa598('0x5a')]['id']);for(var _0x56c601=0x0;_0x56c601<_0x1be477[_0xa598('0x3d')];_0x56c601+=0x1){let _0x42b784=_0x1be477[_0x56c601];for(var _0x1069db=0x0;_0x1069db<_0x42b784[_0xa598('0x70')][_0xa598('0x3d')];_0x1069db+=0x1){let _0x41d204=_0x42b784['Agents'][_0x1069db];var _0x4f8920=_0xe8e809[_0xa598('0x59')]();_0x4f8920[_0xa598('0x42')](_0xa598('0x87'),_0x41d204['id']);_0x3c5f6b[_0xa598('0x88')](db[_0xa598('0x72')][_0xa598('0x38')](_0x4f8920[_0xa598('0x89')](),{'type':db['sequelize'][_0xa598('0x8a')][_0xa598('0x8b')]})[_0xa598('0x31')](function(_0x45d3a8){if(_0x45d3a8[_0xa598('0x3d')]===0x1){return _0x41d204['id'];}else{var _0x38362e=_[_0xa598('0x8c')](_[_0xa598('0x2d')](_0x45d3a8,'TeamId'),function(_0x471b35){return _[_0xa598('0x8d')](_0x37444b,_0x471b35);});if(_0x38362e){return _0x41d204['id'];}}}));}}return BPromise['all'](_0x3c5f6b)['then'](function(_0x25585e){_0x1b4c60=_(_0x1b4c60)[_0xa598('0x8e')](_0x25585e)[_0xa598('0x8f')]()[_0xa598('0x2e')]();return db[_0xa598('0x48')]['find']({'where':{'id':_0x2ab527[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](function(_0x25eb80){return db[_0xa598('0x72')][_0xa598('0x73')](function(_0x549f38){return _0x25eb80[_0xa598('0x90')](_0x2ab527[_0xa598('0x38')][_0xa598('0x7e')],{'transaction':_0x549f38})[_0xa598('0x31')](function(){if(!_[_0xa598('0x91')](_0x1b4c60)){return _0x25eb80[_0xa598('0x92')](_0x1b4c60,{'transaction':_0x549f38})[_0xa598('0x31')](function(){return db[_0xa598('0x77')][_0xa598('0x28')]({'where':{'VoiceQueueId':_0x2ab527[_0xa598('0x5a')]['id'],'UserId':_0x1b4c60},'transaction':_0x549f38});});}})['then'](function(){_0x1b4c60['forEach'](function(_0x38c392){socket[_0xa598('0x7b')]('userVoiceQueue:remove',{'UserId':_0x38c392,'VoiceQueueId':_0x25eb80['id']});});});});});});})[_0xa598('0x31')](respondWithStatusCode(_0x4dd654,null))[_0xa598('0x4c')](handleError(_0x4dd654,null));};exports[_0xa598('0x93')]=function(_0x3392ba,_0xdc3032,_0x26cf75){var _0x31234e,_0x501349;return db[_0xa598('0x48')][_0xa598('0x4f')]({'where':{'id':_0x3392ba[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0xdc3032,null))['then'](function(_0xd3d248){if(_0xd3d248){_0x501349=_0xd3d248;return _0xd3d248['addAgents'](_0x3392ba[_0xa598('0x5e')][_0xa598('0x7e')],_[_0xa598('0x5b')](_0x3392ba[_0xa598('0x5e')],[_0xa598('0x7e'),'id'])||{})['spread'](function(_0x264d70){for(var _0x5b4b4d=0x0;_0x5b4b4d<_0x3392ba[_0xa598('0x5e')]['ids'][_0xa598('0x3d')];_0x5b4b4d+=0x1){socket['emit'](_0xa598('0x7c'),{'UserId':Number(_0x3392ba[_0xa598('0x5e')]['ids'][_0x5b4b4d]),'VoiceQueueId':Number(_0x3392ba[_0xa598('0x5a')]['id'])});}return _0x264d70;});}})[_0xa598('0x31')](function(_0xa7d493){_0x31234e=_0xa7d493||[];if(_0x501349){return db[_0xa598('0x7f')][_0xa598('0x66')]({'where':{'id':_0x3392ba['body'][_0xa598('0x7e')]},'attributes':['id',_0xa598('0x34'),_0xa598('0x6d'),_0xa598('0x79'),_0xa598('0x6e')],'raw':!![]});}})[_0xa598('0x31')](function(_0x512247){if(!_[_0xa598('0x91')](_0x512247)){var _0x3e97b8=[];for(var _0x11b1b6=0x0;_0x11b1b6<_0x512247[_0xa598('0x3d')];_0x11b1b6++){if(_0x512247[_0x11b1b6][_0xa598('0x6d')]){_0x3e97b8[_0xa598('0x88')](db[_0xa598('0x77')][_0xa598('0x78')]({'membername':_0x512247[_0x11b1b6][_0xa598('0x34')],'UserId':_0x512247[_0x11b1b6]['id'],'queue_name':_0x501349[_0xa598('0x34')],'VoiceQueueId':_0x501349['id'],'interface':_[_0xa598('0x94')](_0x512247[_0x11b1b6][_0xa598('0x6e')])?util['format'](_0xa598('0x95'),_0x512247[_0x11b1b6][_0xa598('0x34')]):_0x512247[_0x11b1b6][_0xa598('0x6e')],'paused':_0x512247[_0x11b1b6][_0xa598('0x79')]||![],'penalty':_0x3392ba[_0xa598('0x5e')]['penalty']||0x0}));}}return BPromise[_0xa598('0x96')](_0x3e97b8);}})[_0xa598('0x31')](function(){return _0x31234e;})[_0xa598('0x31')](respondWithResult(_0xdc3032,null))['catch'](handleError(_0xdc3032,null));};exports['removeAgents']=function(_0x42c58f,_0x5ea2e9,_0x4dbb09){return db[_0xa598('0x48')][_0xa598('0x4f')]({'where':{'id':_0x42c58f['params']['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x5ea2e9,null))['then'](function(_0x56a711){if(_0x56a711){return _0x56a711[_0xa598('0x92')](_0x42c58f[_0xa598('0x38')][_0xa598('0x7e')])[_0xa598('0x31')](function(){if(_[_0xa598('0x97')](_0x42c58f[_0xa598('0x38')][_0xa598('0x7e')])){for(var _0xdf829a=0x0;_0xdf829a<_0x42c58f[_0xa598('0x38')][_0xa598('0x7e')][_0xa598('0x3d')];_0xdf829a+=0x1){socket[_0xa598('0x7b')](_0xa598('0x98'),{'UserId':Number(_0x42c58f[_0xa598('0x38')][_0xa598('0x7e')][_0xdf829a]),'VoiceQueueId':Number(_0x42c58f['params']['id'])});}}else{socket[_0xa598('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x42c58f[_0xa598('0x38')]['ids']),'VoiceQueueId':Number(_0x42c58f['params']['id'])});}});}})[_0xa598('0x31')](function(_0x3a6bf8){return db[_0xa598('0x77')]['destroy']({'where':{'VoiceQueueId':_0x42c58f[_0xa598('0x5a')]['id'],'UserId':_0x42c58f[_0xa598('0x38')]['ids']}})[_0xa598('0x31')](function(){return _0x3a6bf8;});})[_0xa598('0x31')](respondWithStatusCode(_0x5ea2e9,null))['catch'](handleError(_0x5ea2e9,null));};exports['getAgents']=function(_0x362361,_0x366cb7,_0x4ff415){var _0x171ec1={};var _0x452a66={};var _0x5acaf8;var _0x274bff;return db[_0xa598('0x48')][_0xa598('0x61')]({'where':{'id':_0x362361[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x366cb7,null))[_0xa598('0x31')](function(_0x2cc46d){if(_0x2cc46d){_0x5acaf8=_0x2cc46d;_0x452a66['model']=_[_0xa598('0x4e')](db[_0xa598('0x7f')][_0xa598('0x36')]);_0x452a66[_0xa598('0x38')]=_['keys'](_0x362361[_0xa598('0x38')]);_0x452a66[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x452a66[_0xa598('0x3b')],_0x452a66['query']);_0x171ec1['attributes']=_['intersection'](_0x452a66[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0x362361['query'][_0xa598('0x3c')]));_0x171ec1[_0xa598('0x3e')]=_0x171ec1[_0xa598('0x3e')][_0xa598('0x3d')]?_0x171ec1[_0xa598('0x3e')]:_0x452a66[_0xa598('0x3b')];_0x171ec1[_0xa598('0x63')]=qs[_0xa598('0x41')](_0x362361[_0xa598('0x38')][_0xa598('0x41')]);_0x171ec1[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0x362361['query'],_0x452a66[_0xa598('0x39')]));if(_0x362361[_0xa598('0x38')][_0xa598('0x44')]){_0x171ec1[_0xa598('0x42')]=_[_0xa598('0x45')](_0x171ec1['where'],{'$or':_[_0xa598('0x2d')](_0x171ec1['attributes'],function(_0x24cce8){var _0x265bd6={};_0x265bd6[_0x24cce8]={'$like':'%'+_0x362361[_0xa598('0x38')]['filter']+'%'};return _0x265bd6;})});}_0x171ec1=_[_0xa598('0x45')]({},_0x171ec1,_0x362361[_0xa598('0x47')]);return _0x5acaf8[_0xa598('0x99')](_0x171ec1);}})[_0xa598('0x31')](function(_0x117b0c){if(_0x117b0c){_0x274bff=_0x117b0c['length'];if(!_0x362361[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x171ec1[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x362361['query']['limit']);_0x171ec1['offset']=qs[_0xa598('0x1e')](_0x362361[_0xa598('0x38')]['offset']);}return _0x5acaf8[_0xa598('0x99')](_0x171ec1);}})[_0xa598('0x31')](function(_0x2715cf){if(_0x2715cf){return _0x2715cf?{'count':_0x274bff,'rows':_0x2715cf}:null;}})[_0xa598('0x31')](respondWithResult(_0x366cb7,null))[_0xa598('0x4c')](handleError(_0x366cb7,null));};exports[_0xa598('0x9a')]=function(_0x2e10bc,_0x25a965,_0xc176f5){var _0x57c7b6={};var _0x457636={};var _0x50fc7d;var _0x343436;return db['VoiceQueue'][_0xa598('0x61')]({'where':{'id':_0x2e10bc['params']['id']}})['then'](handleEntityNotFound(_0x25a965,null))[_0xa598('0x31')](function(_0x494de7){if(_0x494de7){_0x50fc7d=_0x494de7;_0x457636[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x77')][_0xa598('0x36')]);_0x457636[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x2e10bc[_0xa598('0x38')]);_0x457636[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x457636[_0xa598('0x3b')],_0x457636[_0xa598('0x38')]);_0x57c7b6[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x457636[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0x2e10bc[_0xa598('0x38')][_0xa598('0x3c')]));_0x57c7b6['attributes']=_0x57c7b6[_0xa598('0x3e')][_0xa598('0x3d')]?_0x57c7b6[_0xa598('0x3e')]:_0x457636[_0xa598('0x3b')];_0x57c7b6[_0xa598('0x63')]=qs[_0xa598('0x41')](_0x2e10bc[_0xa598('0x38')][_0xa598('0x41')]);_0x57c7b6[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0x2e10bc[_0xa598('0x38')],_0x457636[_0xa598('0x39')]));if(_0x2e10bc[_0xa598('0x38')][_0xa598('0x44')]){_0x57c7b6[_0xa598('0x42')]=_['merge'](_0x57c7b6[_0xa598('0x42')],{'$or':_[_0xa598('0x2d')](_0x57c7b6[_0xa598('0x3e')],function(_0x4f3914){var _0xf9e81f={};_0xf9e81f[_0x4f3914]={'$like':'%'+_0x2e10bc[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0xf9e81f;})});}_0x57c7b6=_['merge']({},_0x57c7b6,_0x2e10bc[_0xa598('0x47')]);return _0x50fc7d[_0xa598('0x9a')](_0x57c7b6);}})[_0xa598('0x31')](function(_0x9272d6){if(_0x9272d6){_0x343436=_0x9272d6[_0xa598('0x3d')];if(!_0x2e10bc[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x57c7b6[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x2e10bc[_0xa598('0x38')]['limit']);_0x57c7b6[_0xa598('0x1e')]=qs[_0xa598('0x1e')](_0x2e10bc['query'][_0xa598('0x1e')]);}return _0x50fc7d[_0xa598('0x9a')](_0x57c7b6);}})[_0xa598('0x31')](function(_0x1776ab){return _0x1776ab?{'count':_0x343436,'rows':_0x1776ab}:null;})[_0xa598('0x31')](respondWithResult(_0x25a965,null))['catch'](handleError(_0x25a965,null));};exports['getLists']=function(_0x479930,_0x256ca4,_0x3b8682){var _0x54cc73={};var _0x2434a8={};var _0x359c88;var _0x28fcc0;return db[_0xa598('0x48')][_0xa598('0x61')]({'where':{'id':_0x479930[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x256ca4,null))[_0xa598('0x31')](function(_0x227def){if(_0x227def){_0x359c88=_0x227def;_0x2434a8['model']=_[_0xa598('0x4e')](db[_0xa598('0x9b')][_0xa598('0x36')]);_0x2434a8[_0xa598('0x38')]=_[_0xa598('0x4e')](_0x479930[_0xa598('0x38')]);_0x2434a8[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x2434a8[_0xa598('0x3b')],_0x2434a8[_0xa598('0x38')]);_0x54cc73['attributes']=_[_0xa598('0x3a')](_0x2434a8[_0xa598('0x3b')],qs[_0xa598('0x3c')](_0x479930[_0xa598('0x38')][_0xa598('0x3c')]));_0x54cc73[_0xa598('0x3e')]=_0x54cc73[_0xa598('0x3e')][_0xa598('0x3d')]?_0x54cc73['attributes']:_0x2434a8[_0xa598('0x3b')];_0x54cc73[_0xa598('0x63')]=qs[_0xa598('0x41')](_0x479930[_0xa598('0x38')][_0xa598('0x41')]);_0x54cc73[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0x479930['query'],_0x2434a8['filters']));if(_0x479930[_0xa598('0x38')][_0xa598('0x44')]){_0x54cc73[_0xa598('0x42')]=_['merge'](_0x54cc73[_0xa598('0x42')],{'$or':_['map'](_0x54cc73[_0xa598('0x3e')],function(_0x438527){var _0x4baf3d={};_0x4baf3d[_0x438527]={'$like':'%'+_0x479930[_0xa598('0x38')]['filter']+'%'};return _0x4baf3d;})});}_0x54cc73=_[_0xa598('0x45')]({},_0x54cc73,_0x479930[_0xa598('0x47')]);return _0x359c88[_0xa598('0x9c')](_0x54cc73);}})[_0xa598('0x31')](function(_0x4b1242){if(_0x4b1242){_0x28fcc0=_0x4b1242[_0xa598('0x3d')];if(!_0x479930[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x54cc73[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0x479930['query'][_0xa598('0x1f')]);_0x54cc73[_0xa598('0x1e')]=qs[_0xa598('0x1e')](_0x479930[_0xa598('0x38')][_0xa598('0x1e')]);}return _0x359c88['getLists'](_0x54cc73);}})['then'](function(_0x49e567){if(_0x49e567){return _0x49e567?{'count':_0x28fcc0,'rows':_0x49e567}:null;}})['then'](respondWithResult(_0x256ca4,null))[_0xa598('0x4c')](handleError(_0x256ca4,null));};exports['addLists']=function(_0x22370a,_0x8de326,_0x257024){var _0x176729=moment()[_0xa598('0x9d')](_0xa598('0x9e'));var _0x2d4686,_0x2cb4f4;return db[_0xa598('0x48')][_0xa598('0x4f')]({'where':{'id':_0x22370a[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x8de326,null))['then'](function(_0x5dbc2c){if(_0x5dbc2c){_0x2cb4f4=_0x5dbc2c;return _0x5dbc2c[_0xa598('0x9f')](_0x22370a[_0xa598('0x5e')][_0xa598('0x7e')],_[_0xa598('0x5b')](_0x22370a['body'],[_0xa598('0x7e'),'id'])||{});}return null;})[_0xa598('0xa0')](function(_0x4e2a2a){var _0x37cf15;_0x2d4686=_0x4e2a2a||[];var _0x17b32a=[];if(_0x4e2a2a){for(var _0x34bd86=0x0;_0x34bd86<_0x4e2a2a[_0xa598('0x3d')];_0x34bd86+=0x1){var _0x128c2d=_0x4e2a2a[_0x34bd86][_0xa598('0x29')]({'plain':!![]});_0x2cb4f4[_0xa598('0xa1')]=_0x22370a[_0xa598('0x5e')][_0xa598('0xa1')]?_0x22370a[_0xa598('0x5e')][_0xa598('0xa1')]:_0x2cb4f4[_0xa598('0xa1')];switch(_0x2cb4f4['dialCheckDuplicateType']){case _0xa598('0xa2'):_0x37cf15=squel[_0xa598('0xa3')]()[_0xa598('0xa4')](_0xa598('0xa5'))['fromQuery']([_0xa598('0xa6'),_0xa598('0xa7'),_0xa598('0xa8'),_0xa598('0xa9'),_0xa598('0x64'),_0xa598('0x5c'),_0xa598('0x5d')],squel['select']()[_0xa598('0x80')](_0xa598('0xa6'),_0xa598('0xa6'))['field']('\x27'+_0x176729+'\x27',_0xa598('0xa7'))[_0xa598('0x80')]('id','ContactId')[_0xa598('0x80')](_0x128c2d[_0xa598('0xaa')]['toString'](),_0xa598('0xa9'))[_0xa598('0x80')](_0x22370a['params']['id'][_0xa598('0x89')](),'VoiceQueueId')['field']('\x27'+_0x176729+'\x27',_0xa598('0x5c'))[_0xa598('0x80')]('\x27'+_0x176729+'\x27',_0xa598('0x5d'))[_0xa598('0x82')](_0xa598('0xab'))[_0xa598('0x42')](_0xa598('0xac'))[_0xa598('0x42')](_0xa598('0xad'),_0x128c2d[_0xa598('0xaa')]['toString']())[_0xa598('0x42')](_0xa598('0xae'))[_0xa598('0x42')](_0xa598('0xaf'),squel[_0xa598('0xb0')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xa598('0x82')](_0xa598('0xb1'))[_0xa598('0x42')]('VoiceQueueId\x20=\x20?',_0x22370a[_0xa598('0x5a')]['id']['toString']()))[_0xa598('0x42')](_0xa598('0xaf'),squel[_0xa598('0xb0')]()['field'](_0xa598('0xb2'))[_0xa598('0x82')]('cm_hopper')[_0xa598('0x42')](_0xa598('0x86'),_0x22370a['params']['id'][_0xa598('0x89')]())))['toString']();break;case _0xa598('0xb3'):_0x37cf15=squel[_0xa598('0xa3')]()[_0xa598('0xa4')](_0xa598('0xa5'))[_0xa598('0xb4')]([_0xa598('0xa6'),_0xa598('0xa7'),_0xa598('0xa8'),_0xa598('0xa9'),_0xa598('0x64'),_0xa598('0x5c'),'updatedAt'],squel[_0xa598('0xb0')]()[_0xa598('0x80')](_0xa598('0xa6'),'phone')['field']('\x27'+_0x176729+'\x27',_0xa598('0xa7'))[_0xa598('0x80')]('id',_0xa598('0xa8'))['field'](_0x128c2d[_0xa598('0xaa')]['toString'](),_0xa598('0xa9'))[_0xa598('0x80')](_0x22370a[_0xa598('0x5a')]['id'][_0xa598('0x89')](),_0xa598('0x64'))['field']('\x27'+_0x176729+'\x27',_0xa598('0x5c'))['field']('\x27'+_0x176729+'\x27',_0xa598('0x5d'))[_0xa598('0x82')](_0xa598('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0xa598('0x42')](_0xa598('0xad'),_0x128c2d[_0xa598('0xaa')][_0xa598('0x89')]())[_0xa598('0x42')](_0xa598('0xae'))[_0xa598('0x42')](_0xa598('0xaf'),squel[_0xa598('0xb0')]()[_0xa598('0x80')](_0xa598('0xb2'))['from'](_0xa598('0xa5'))[_0xa598('0x42')]('VoiceQueueId\x20=\x20?',_0x22370a['params']['id']['toString']())))[_0xa598('0x89')]();break;default:_0x37cf15=squel[_0xa598('0xa3')]()[_0xa598('0xa4')](_0xa598('0xa5'))[_0xa598('0xb4')]([_0xa598('0xa6'),_0xa598('0xa7'),_0xa598('0xa8'),_0xa598('0xa9'),'VoiceQueueId',_0xa598('0x5c'),_0xa598('0x5d')],squel['select']()[_0xa598('0x80')]('phone','phone')['field']('\x27'+_0x176729+'\x27','scheduledAt')[_0xa598('0x80')]('id','ContactId')[_0xa598('0x80')](_0x128c2d[_0xa598('0xaa')][_0xa598('0x89')](),_0xa598('0xa9'))['field'](_0x22370a['params']['id'][_0xa598('0x89')](),_0xa598('0x64'))[_0xa598('0x80')]('\x27'+_0x176729+'\x27','createdAt')['field']('\x27'+_0x176729+'\x27',_0xa598('0x5d'))[_0xa598('0x82')](_0xa598('0xab'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xa598('0xad'),_0x128c2d[_0xa598('0xaa')][_0xa598('0x89')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa598('0x89')]();}_0x17b32a['push'](db['sequelize'][_0xa598('0x38')](_0x37cf15));}return BPromise['all'](_0x17b32a);}})[_0xa598('0x31')](function(){var _0x409bf7=[];var _0x319436=squel['insert']()[_0xa598('0xa4')](_0xa598('0xb5'))[_0xa598('0xb4')]([_0xa598('0xb6'),_0xa598('0xa6'),_0xa598('0xb7'),_0xa598('0x5c'),_0xa598('0x5d')],squel[_0xa598('0xb0')]()[_0xa598('0x80')](_0xa598('0xb8'))[_0xa598('0x80')](_0xa598('0xb9'))['field']('ci.OrderBy+1')[_0xa598('0x80')]('\x27'+_0x176729+'\x27',_0xa598('0x5c'))['field']('\x27'+_0x176729+'\x27',_0xa598('0x5d'))['from'](_0xa598('0xba'),'ci')[_0xa598('0x84')](_0xa598('0xa5'),'h',_0xa598('0xbb'))[_0xa598('0x42')](_0xa598('0xbc'),_0x176729)[_0xa598('0x42')](_0xa598('0xbd'),_0xa598('0xbe')))[_0xa598('0x89')]();_0x409bf7['push'](db[_0xa598('0x72')][_0xa598('0x38')](_0x319436));return BPromise[_0xa598('0x96')](_0x409bf7);})['then'](function(){return _0x2d4686;})['then'](respondWithResult(_0x8de326,null))[_0xa598('0x4c')](handleError(_0x8de326,null));};exports[_0xa598('0xbf')]=function(_0x450969,_0x4361cc,_0x35ba26){return db[_0xa598('0x48')]['find']({'where':{'id':_0x450969[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x4361cc,null))[_0xa598('0x31')](function(_0x160ef4){if(_0x160ef4){return _0x160ef4[_0xa598('0xbf')](_0x450969[_0xa598('0x38')][_0xa598('0x7e')]);}})[_0xa598('0x31')](function(_0x4db642){if(_0x4db642){return db[_0xa598('0x62')]['destroy']({'where':{'ListId':_0x450969[_0xa598('0x38')]['ids'],'VoiceQueueId':_0x450969['params']['id']}})[_0xa598('0x31')](function(){return _0x4db642;});}})[_0xa598('0x31')](respondWithStatusCode(_0x4361cc,null))[_0xa598('0x4c')](handleError(_0x4361cc,null));};exports[_0xa598('0xc0')]=function(_0xbc4a1d,_0x154299,_0x215d6d){var _0xacdb03={};var _0x3e414b={};var _0x287b14;var _0x35cf19;return db[_0xa598('0x48')]['findOne']({'where':{'id':_0xbc4a1d[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x154299,null))[_0xa598('0x31')](function(_0x35c709){if(_0x35c709){_0x287b14=_0x35c709;_0x3e414b[_0xa598('0x3b')]=_[_0xa598('0x4e')](db[_0xa598('0x9b')][_0xa598('0x36')]);_0x3e414b['query']=_[_0xa598('0x4e')](_0xbc4a1d[_0xa598('0x38')]);_0x3e414b[_0xa598('0x39')]=_[_0xa598('0x3a')](_0x3e414b[_0xa598('0x3b')],_0x3e414b[_0xa598('0x38')]);_0xacdb03[_0xa598('0x3e')]=_[_0xa598('0x3a')](_0x3e414b[_0xa598('0x3b')],qs['fields'](_0xbc4a1d[_0xa598('0x38')][_0xa598('0x3c')]));_0xacdb03[_0xa598('0x3e')]=_0xacdb03[_0xa598('0x3e')][_0xa598('0x3d')]?_0xacdb03['attributes']:_0x3e414b[_0xa598('0x3b')];_0xacdb03['order']=qs[_0xa598('0x41')](_0xbc4a1d[_0xa598('0x38')][_0xa598('0x41')]);_0xacdb03[_0xa598('0x42')]=qs[_0xa598('0x39')](_[_0xa598('0x43')](_0xbc4a1d[_0xa598('0x38')],_0x3e414b[_0xa598('0x39')]));if(_0xbc4a1d['query'][_0xa598('0x44')]){_0xacdb03['where']=_[_0xa598('0x45')](_0xacdb03[_0xa598('0x42')],{'$or':_[_0xa598('0x2d')](_0xacdb03[_0xa598('0x3e')],function(_0x5bd4ff){var _0x4c2c78={};_0x4c2c78[_0x5bd4ff]={'$like':'%'+_0xbc4a1d[_0xa598('0x38')][_0xa598('0x44')]+'%'};return _0x4c2c78;})});}_0xacdb03=_[_0xa598('0x45')]({},_0xacdb03,_0xbc4a1d[_0xa598('0x47')]);return _0x287b14[_0xa598('0xc0')](_0xacdb03);}})[_0xa598('0x31')](function(_0x13c1b0){if(_0x13c1b0){_0x35cf19=_0x13c1b0[_0xa598('0x3d')];if(!_0xbc4a1d['query']['hasOwnProperty'](_0xa598('0x40'))){_0xacdb03[_0xa598('0x1f')]=qs[_0xa598('0x1f')](_0xbc4a1d[_0xa598('0x38')][_0xa598('0x1f')]);_0xacdb03['offset']=qs[_0xa598('0x1e')](_0xbc4a1d[_0xa598('0x38')][_0xa598('0x1e')]);}return _0x287b14[_0xa598('0xc0')](_0xacdb03);}})[_0xa598('0x31')](function(_0x44f94c){if(_0x44f94c){return _0x44f94c?{'count':_0x35cf19,'rows':_0x44f94c}:null;}})[_0xa598('0x31')](respondWithResult(_0x154299,null))[_0xa598('0x4c')](handleError(_0x154299,null));};exports[_0xa598('0xc1')]=function(_0x4fcec8,_0x5173fb,_0x5461af){var _0x21d428,_0x2891a2;return db['VoiceQueue']['find']({'where':{'id':_0x4fcec8[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x5173fb,null))[_0xa598('0x31')](function(_0xccb143){if(_0xccb143){_0x2891a2=_0xccb143;return _0xccb143['addBlackLists'](_0x4fcec8[_0xa598('0x5e')]['ids'],_[_0xa598('0x5b')](_0x4fcec8[_0xa598('0x5e')],['ids','id'])||{});}return null;})[_0xa598('0xa0')](function(_0x14a8ff){var _0x45498b;_0x21d428=_0x14a8ff||[];var _0x522f1b=[];if(_0x14a8ff){for(var _0x420d4b=0x0;_0x420d4b<_0x14a8ff[_0xa598('0x3d')];_0x420d4b+=0x1){var _0x24b6df=_0x14a8ff[_0x420d4b][_0xa598('0x29')]({'plain':!![]});_0x45498b=squel[_0xa598('0xa3')]()['into'](_0xa598('0xc2'))['fromQuery'](['phone',_0xa598('0xa8'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xa598('0xb0')]()[_0xa598('0x80')](_0xa598('0xa6'),_0xa598('0xa6'))[_0xa598('0x80')]('id',_0xa598('0xa8'))['field'](_0x24b6df[_0xa598('0xaa')][_0xa598('0x89')](),'ListId')[_0xa598('0x80')](_0x4fcec8[_0xa598('0x5a')]['id'][_0xa598('0x89')](),_0xa598('0x64'))['field']('NOW()',_0xa598('0x5c'))['field'](_0xa598('0xc3'),'updatedAt')[_0xa598('0x82')](_0xa598('0xab'))[_0xa598('0x42')](_0xa598('0xac'))[_0xa598('0x42')](_0xa598('0xad'),_0x24b6df[_0xa598('0xaa')][_0xa598('0x89')]())[_0xa598('0x42')](_0xa598('0xae')))[_0xa598('0x89')]();_0x522f1b[_0xa598('0x88')](db['sequelize'][_0xa598('0x38')](_0x45498b));}return BPromise[_0xa598('0x96')](_0x522f1b);}})[_0xa598('0x31')](function(){return _0x21d428;})[_0xa598('0x31')](respondWithResult(_0x5173fb,null))['catch'](handleError(_0x5173fb,null));};exports[_0xa598('0xc4')]=function(_0x1efed6,_0x3b36b,_0xb75826){return db['VoiceQueue'][_0xa598('0x4f')]({'where':{'id':_0x1efed6[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](handleEntityNotFound(_0x3b36b,null))[_0xa598('0x31')](function(_0x2d265b){if(_0x2d265b){return _0x2d265b[_0xa598('0xc4')](_0x1efed6[_0xa598('0x38')][_0xa598('0x7e')]);}})[_0xa598('0x31')](function(_0xa41482){if(_0xa41482){return db['CmHopperBlack'][_0xa598('0x28')]({'where':{'ListId':_0x1efed6[_0xa598('0x38')][_0xa598('0x7e')],'VoiceQueueId':_0x1efed6[_0xa598('0x5a')]['id']}})[_0xa598('0x31')](function(){return _0xa41482;});}})['then'](respondWithStatusCode(_0x3b36b,null))[_0xa598('0x4c')](handleError(_0x3b36b,null));}; \ No newline at end of file +var _0x0f9f=['../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','VoiceQueues','inbound','outbound','filter','map','value','includes','find','type','name','UserProfileResource','destroy','error','stack','send','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','catch','show','params','rawAttributes','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','findAll','getHopperHistories','CmHopperHistory','VoiceQueueId','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','TeamId','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','ListId','field','scheduledAt','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','insert','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xb45111,_0x54490f){var _0x2b771c=function(_0x32fff1){while(--_0x32fff1){_0xb45111['push'](_0xb45111['shift']());}};_0x2b771c(++_0x54490f);}(_0x0f9f,0xae));var _0xf0f9=function(_0x32f78b,_0x178f58){_0x32f78b=_0x32f78b-0x0;var _0x51d847=_0x0f9f[_0x32f78b];return _0x51d847;};'use strict';var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require(_0xf0f9('0x2'));var jsonpatch=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var moment=require(_0xf0f9('0x5'));var BPromise=require(_0xf0f9('0x6'));var Mustache=require(_0xf0f9('0x7'));var util=require(_0xf0f9('0x8'));var path=require(_0xf0f9('0x9'));var sox=require(_0xf0f9('0xa'));var csv=require('to-csv');var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xc'));var _=require('lodash');var squel=require(_0xf0f9('0xd'));var crypto=require(_0xf0f9('0xe'));var jsforce=require(_0xf0f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x10'));var querystring=require(_0xf0f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0f9('0x12'));var authService=require(_0xf0f9('0x13'));var qs=require(_0xf0f9('0x14'));var as=require(_0xf0f9('0x15'));var hardwareService=require(_0xf0f9('0x16'));var logger=require(_0xf0f9('0x17'))(_0xf0f9('0x18'));var utils=require(_0xf0f9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f9('0x1a'));var db=require(_0xf0f9('0x1b'))['db'];config[_0xf0f9('0x1c')]=_[_0xf0f9('0x1d')](config['redis'],{'host':_0xf0f9('0x1e'),'port':0x18eb});var socket=require(_0xf0f9('0x1f'))(new Redis(config['redis']));require(_0xf0f9('0x20'))['register'](socket);function respondWithStatusCode(_0x538864,_0x2c832a){_0x2c832a=_0x2c832a||0xcc;return function(_0x536143){if(_0x536143){return _0x538864[_0xf0f9('0x21')](_0x2c832a);}return _0x538864['status'](_0x2c832a)[_0xf0f9('0x22')]();};}function respondWithResult(_0x336483,_0x1a3a82){_0x1a3a82=_0x1a3a82||0xc8;return function(_0xf4d805){if(_0xf4d805){return _0x336483[_0xf0f9('0x23')](_0x1a3a82)[_0xf0f9('0x24')](_0xf4d805);}};}function respondWithFilteredResult(_0x10dae6,_0x50d462){return function(_0x44d248){if(_0x44d248){var _0x26b5be=typeof _0x50d462[_0xf0f9('0x25')]===_0xf0f9('0x26')&&typeof _0x50d462[_0xf0f9('0x27')]===_0xf0f9('0x26');var _0x1765ad=_0x44d248[_0xf0f9('0x28')];var _0x5ebbe9=_0x26b5be?0x0:_0x50d462[_0xf0f9('0x25')];var _0x5c2ce0=_0x26b5be?_0x44d248[_0xf0f9('0x28')]:_0x50d462['offset']+_0x50d462[_0xf0f9('0x27')];var _0x1d5965;if(_0x5c2ce0>=_0x1765ad){_0x5c2ce0=_0x1765ad;_0x1d5965=0xc8;}else{_0x1d5965=0xce;}_0x10dae6[_0xf0f9('0x23')](_0x1d5965);return _0x10dae6[_0xf0f9('0x29')](_0xf0f9('0x2a'),_0x5ebbe9+'-'+_0x5c2ce0+'/'+_0x1765ad)[_0xf0f9('0x24')](_0x44d248);}return null;};}function patchUpdates(_0x49bddc){return function(_0x39733c){try{jsonpatch['apply'](_0x39733c,_0x49bddc,!![]);}catch(_0x2cb8f8){return BPromise[_0xf0f9('0x2b')](_0x2cb8f8);}return _0x39733c['save']();};}function saveUpdates(_0x217a15,_0x20b5dc){return function(_0x552f70){if(_0x552f70){return _0x552f70[_0xf0f9('0x2c')](_0x217a15)[_0xf0f9('0x2d')](function(_0xa0b46e){return _0xa0b46e;});}return null;};}function removeEntity(_0x27defc,_0x3ce34a){return function(_0x2c8a79){if(_0x2c8a79){return _0x2c8a79['destroy']()[_0xf0f9('0x2d')](function(){var _0x4c31f2=_0x2c8a79[_0xf0f9('0x2e')]({'plain':!![]});var _0x2e3fbc=[{'name':_0xf0f9('0x2f'),'value':_0xf0f9('0x30'),'ignore':![]},{'name':'QueueCampaigns','value':_0xf0f9('0x31'),'ignore':![]}];var _0x423d89=_(_0x2e3fbc)[_0xf0f9('0x32')]('ignore')[_0xf0f9('0x33')](_0xf0f9('0x34'))['value']();if(_[_0xf0f9('0x35')](_0x423d89,_0x4c31f2['type'])){return;}var _0x458621=_[_0xf0f9('0x36')](_0x2e3fbc,[_0xf0f9('0x34'),_0x4c31f2[_0xf0f9('0x37')]])[_0xf0f9('0x38')];return db[_0xf0f9('0x39')][_0xf0f9('0x3a')]({'where':{'type':_0x458621,'resourceId':_0x4c31f2['id']}})[_0xf0f9('0x2d')](function(){return _0x2c8a79;});})[_0xf0f9('0x2d')](function(){_0x27defc[_0xf0f9('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5bb1,_0x3f3c48){return function(_0x5dd717){if(!_0x5dd717){_0x3b5bb1['sendStatus'](0x194);}return _0x5dd717;};}function handleError(_0x2a3d60,_0x2b8690){_0x2b8690=_0x2b8690||0x1f4;return function(_0x3ca015){logger[_0xf0f9('0x3b')](_0x3ca015[_0xf0f9('0x3c')]);if(_0x3ca015[_0xf0f9('0x38')]){delete _0x3ca015[_0xf0f9('0x38')];}_0x2a3d60['status'](_0x2b8690)[_0xf0f9('0x3d')](_0x3ca015);};}exports['index']=function(_0x39075e,_0x3a2fcc){var _0x232561={},_0x555130={},_0xb210b4={'count':0x0,'rows':[]};var _0x559498=_[_0xf0f9('0x33')](db['VoiceQueue']['rawAttributes'],function(_0x649922){return{'name':_0x649922[_0xf0f9('0x3e')],'type':_0x649922[_0xf0f9('0x37')][_0xf0f9('0x3f')]};});_0x555130[_0xf0f9('0x40')]=_[_0xf0f9('0x33')](_0x559498,'name');_0x555130['query']=_[_0xf0f9('0x41')](_0x39075e[_0xf0f9('0x42')]);_0x555130[_0xf0f9('0x43')]=_['intersection'](_0x555130['model'],_0x555130[_0xf0f9('0x42')]);_0x232561['attributes']=_[_0xf0f9('0x44')](_0x555130[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x39075e[_0xf0f9('0x42')]['fields']));_0x232561[_0xf0f9('0x46')]=_0x232561[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x232561[_0xf0f9('0x46')]:_0x555130['model'];if(!_0x39075e['query']['hasOwnProperty'](_0xf0f9('0x48'))){_0x232561[_0xf0f9('0x27')]=qs[_0xf0f9('0x27')](_0x39075e[_0xf0f9('0x42')][_0xf0f9('0x27')]);_0x232561[_0xf0f9('0x25')]=qs[_0xf0f9('0x25')](_0x39075e['query'][_0xf0f9('0x25')]);}_0x232561[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x39075e[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x232561[_0xf0f9('0x4b')]=qs['filters'](_[_0xf0f9('0x4c')](_0x39075e['query'],_0x555130[_0xf0f9('0x43')]),_0x559498);if(_0x39075e[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0x232561[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x232561['where'],{'$or':_[_0xf0f9('0x33')](_0x559498,function(_0x534491){if(_0x534491[_0xf0f9('0x37')]!==_0xf0f9('0x4e')){var _0x2c85f3={};_0x2c85f3[_0x534491[_0xf0f9('0x38')]]={'$like':'%'+_0x39075e[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x2c85f3;}})});}_0x232561=_['merge']({},_0x232561,_0x39075e[_0xf0f9('0x4f')]);var _0x344d0b={'where':_0x232561[_0xf0f9('0x4b')]};return db['VoiceQueue'][_0xf0f9('0x28')](_0x344d0b)['then'](function(_0xcb8767){_0xb210b4['count']=_0xcb8767;if(_0x39075e['query']['includeAll']){_0x232561['include']=[{'all':!![]}];}return db[_0xf0f9('0x50')]['findAll'](_0x232561);})[_0xf0f9('0x2d')](function(_0x190fb3){_0xb210b4['rows']=_0x190fb3;return _0xb210b4;})[_0xf0f9('0x2d')](respondWithFilteredResult(_0x3a2fcc,_0x232561))[_0xf0f9('0x51')](handleError(_0x3a2fcc,null));};exports[_0xf0f9('0x52')]=function(_0x2789c6,_0x21b236){var _0x4c8f5c={'raw':![],'where':{'id':_0x2789c6[_0xf0f9('0x53')]['id']}},_0x1a5353={};_0x1a5353[_0xf0f9('0x40')]=_[_0xf0f9('0x41')](db['VoiceQueue'][_0xf0f9('0x54')]);_0x1a5353[_0xf0f9('0x42')]=_[_0xf0f9('0x41')](_0x2789c6[_0xf0f9('0x42')]);_0x1a5353[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x1a5353[_0xf0f9('0x40')],_0x1a5353[_0xf0f9('0x42')]);_0x4c8f5c[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0x1a5353[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x2789c6['query'][_0xf0f9('0x45')]));_0x4c8f5c[_0xf0f9('0x46')]=_0x4c8f5c[_0xf0f9('0x46')]['length']?_0x4c8f5c[_0xf0f9('0x46')]:_0x1a5353[_0xf0f9('0x40')];if(_0x2789c6[_0xf0f9('0x42')][_0xf0f9('0x55')]){_0x4c8f5c[_0xf0f9('0x56')]=[{'all':!![]}];}_0x4c8f5c=_[_0xf0f9('0x4d')]({},_0x4c8f5c,_0x2789c6[_0xf0f9('0x4f')]);return db[_0xf0f9('0x50')]['find'](_0x4c8f5c)[_0xf0f9('0x2d')](handleEntityNotFound(_0x21b236,null))[_0xf0f9('0x2d')](respondWithResult(_0x21b236,null))['catch'](handleError(_0x21b236,null));};exports[_0xf0f9('0x57')]=function(_0x1569e8,_0x10d158){return db[_0xf0f9('0x50')]['create'](_0x1569e8[_0xf0f9('0x58')],{})[_0xf0f9('0x2d')](function(_0x23a444){var _0x4cacda=_0x1569e8[_0xf0f9('0x59')]['get']({'plain':!![]});if(!_0x4cacda)throw new Error(_0xf0f9('0x5a'));if(_0x4cacda[_0xf0f9('0x5b')]===_0xf0f9('0x59')){var _0x240d71=_0x23a444[_0xf0f9('0x2e')]({'plain':!![]});var _0x4cf4b1=[{'name':_0xf0f9('0x2f'),'value':_0xf0f9('0x30')},{'name':_0xf0f9('0x5c'),'value':_0xf0f9('0x31')}];var _0x213dc2=_[_0xf0f9('0x36')](_0x4cf4b1,[_0xf0f9('0x34'),_0x240d71[_0xf0f9('0x37')]])[_0xf0f9('0x38')];return db[_0xf0f9('0x5d')]['find']({'where':{'name':_0x213dc2,'userProfileId':_0x4cacda[_0xf0f9('0x5e')]},'raw':!![]})['then'](function(_0x10e9ad){if(_0x10e9ad&&_0x10e9ad[_0xf0f9('0x5f')]===0x0){return db[_0xf0f9('0x39')]['create']({'name':_0x240d71[_0xf0f9('0x38')],'resourceId':_0x240d71['id'],'type':_0x10e9ad[_0xf0f9('0x38')],'sectionId':_0x10e9ad['id']},{})[_0xf0f9('0x2d')](function(){return _0x23a444;});}else{return _0x23a444;}})[_0xf0f9('0x51')](function(_0x320b39){logger['error'](_0xf0f9('0x60'),_0x320b39);throw _0x320b39;});}return _0x23a444;})[_0xf0f9('0x2d')](respondWithResult(_0x10d158,0xc9))[_0xf0f9('0x51')](handleError(_0x10d158,null));};exports[_0xf0f9('0x61')]=function(_0x50cfd3,_0x42931b){var _0xf4b966={'where':{'id':_0x50cfd3['params']['id']}},_0x555e98={};_0x555e98[_0xf0f9('0x40')]=_[_0xf0f9('0x41')](db[_0xf0f9('0x50')]['rawAttributes']);_0xf4b966[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0x555e98[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x50cfd3[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0xf4b966[_0xf0f9('0x46')]=_0xf4b966[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0xf4b966[_0xf0f9('0x46')]:_0x555e98[_0xf0f9('0x40')];if(_0x50cfd3[_0xf0f9('0x42')][_0xf0f9('0x55')]){_0xf4b966[_0xf0f9('0x56')]=[{'all':!![]}];}_0xf4b966=_[_0xf0f9('0x4d')]({},_0xf4b966,_0x50cfd3[_0xf0f9('0x4f')]);return db['VoiceQueue']['find'](_0xf4b966)[_0xf0f9('0x2d')](handleEntityNotFound(_0x42931b,null))[_0xf0f9('0x2d')](function(_0x4efd30){if(_0x4efd30){var _0x4bcd07=_0x4efd30[_0xf0f9('0x2e')]({'plain':!![]});_0x4bcd07=qs['omit'](_0x4bcd07,['id',_0xf0f9('0x62'),_0xf0f9('0x63')]);_0x50cfd3[_0xf0f9('0x58')]=_['omit'](_0x50cfd3[_0xf0f9('0x58')],['id',_0xf0f9('0x62'),_0xf0f9('0x63')]);return db[_0xf0f9('0x50')][_0xf0f9('0x57')](_[_0xf0f9('0x4d')](_0x4bcd07,_0x50cfd3[_0xf0f9('0x58')]),{'include':_0x50cfd3['query'][_0xf0f9('0x55')]?[{'all':!![]}]:undefined})['then'](function(_0x4b554a){var _0x26bfc1=_0x50cfd3[_0xf0f9('0x59')][_0xf0f9('0x2e')]({'plain':!![]});if(!_0x26bfc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26bfc1[_0xf0f9('0x5b')]==='user'){var _0xcf32fa=_0x4b554a[_0xf0f9('0x2e')]({'plain':!![]});var _0x805498=[{'name':_0xf0f9('0x2f'),'value':'inbound'},{'name':_0xf0f9('0x5c'),'value':_0xf0f9('0x31')}];var _0x2c4f24=_[_0xf0f9('0x36')](_0x805498,[_0xf0f9('0x34'),_0xcf32fa[_0xf0f9('0x37')]])[_0xf0f9('0x38')];return db[_0xf0f9('0x5d')][_0xf0f9('0x36')]({'where':{'name':_0x2c4f24,'userProfileId':_0x26bfc1['userProfileId']},'raw':!![]})['then'](function(_0x1664fb){if(_0x1664fb&&_0x1664fb[_0xf0f9('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0xcf32fa['name'],'resourceId':_0xcf32fa['id'],'type':_0x1664fb[_0xf0f9('0x38')],'sectionId':_0x1664fb['id']},{})[_0xf0f9('0x2d')](function(){return _0x4b554a;});}else{return _0x4b554a;}})['catch'](function(_0x4be024){logger[_0xf0f9('0x3b')](_0xf0f9('0x60'),_0x4be024);throw _0x4be024;});}return _0x4b554a;});}})[_0xf0f9('0x2d')](respondWithResult(_0x42931b,0xc9))[_0xf0f9('0x51')](handleError(_0x42931b,null));};exports[_0xf0f9('0x2c')]=function(_0xf93b89,_0x44495e){if(_0xf93b89[_0xf0f9('0x58')]['id']){delete _0xf93b89['body']['id'];}return db[_0xf0f9('0x50')]['find']({'where':{'id':_0xf93b89[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x44495e,null))[_0xf0f9('0x2d')](saveUpdates(_0xf93b89['body'],null))[_0xf0f9('0x2d')](respondWithResult(_0x44495e,null))[_0xf0f9('0x51')](handleError(_0x44495e,null));};exports[_0xf0f9('0x3a')]=function(_0x265b36,_0x1f5508){return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x265b36[_0xf0f9('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f5508,null))[_0xf0f9('0x2d')](removeEntity(_0x1f5508,null))[_0xf0f9('0x51')](handleError(_0x1f5508,null));};exports[_0xf0f9('0x64')]=function(_0x38b025,_0x4ef6f8,_0x25cd70){var _0x4baed8={'raw':![],'where':{}};var _0x82a45a={};var _0x54ad87={'count':0x0,'rows':[]};return db[_0xf0f9('0x50')][_0xf0f9('0x65')]({'where':{'id':_0x38b025['params']['id']}})['then'](handleEntityNotFound(_0x4ef6f8,null))[_0xf0f9('0x2d')](function(_0x57422a){if(_0x57422a){_0x82a45a[_0xf0f9('0x40')]=_[_0xf0f9('0x41')](db[_0xf0f9('0x66')][_0xf0f9('0x54')]);_0x82a45a['query']=_[_0xf0f9('0x41')](_0x38b025[_0xf0f9('0x42')]);_0x82a45a[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x82a45a[_0xf0f9('0x40')],_0x82a45a['query']);_0x4baed8['attributes']=_[_0xf0f9('0x44')](_0x82a45a[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x38b025[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0x4baed8[_0xf0f9('0x46')]=_0x4baed8[_0xf0f9('0x46')]['length']?_0x4baed8[_0xf0f9('0x46')]:_0x82a45a[_0xf0f9('0x40')];if(!_0x38b025['query'][_0xf0f9('0x67')](_0xf0f9('0x48'))){_0x4baed8['limit']=qs[_0xf0f9('0x27')](_0x38b025['query']['limit']);_0x4baed8['offset']=qs['offset'](_0x38b025[_0xf0f9('0x42')]['offset']);}_0x4baed8['order']=qs['sort'](_0x38b025[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x4baed8[_0xf0f9('0x4b')]=qs['filters'](_[_0xf0f9('0x4c')](_0x38b025['query'],_0x82a45a['filters']));_0x4baed8[_0xf0f9('0x4b')]['VoiceQueueId']=_0x57422a['id'];if(_0x38b025[_0xf0f9('0x42')]['filter']){_0x4baed8[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x4baed8[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x4baed8[_0xf0f9('0x46')],function(_0xd10e7d){var _0x32d0a2={};_0x32d0a2[_0xd10e7d]={'$like':'%'+_0x38b025[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x32d0a2;})});}_0x4baed8=_[_0xf0f9('0x4d')]({},_0x4baed8,_0x38b025[_0xf0f9('0x4f')]);return db[_0xf0f9('0x66')][_0xf0f9('0x28')]({'where':_0x4baed8[_0xf0f9('0x4b')]})['then'](function(_0x124a2d){_0x54ad87['count']=_0x124a2d;if(_0x38b025['query']['includeAll']){_0x4baed8[_0xf0f9('0x56')]=[{'all':!![]}];}return db['CmHopper'][_0xf0f9('0x68')](_0x4baed8);})[_0xf0f9('0x2d')](function(_0x4725e9){_0x54ad87['rows']=_0x4725e9;return _0x54ad87;});}})[_0xf0f9('0x2d')](respondWithFilteredResult(_0x4ef6f8,_0x4baed8))[_0xf0f9('0x51')](handleError(_0x4ef6f8,null));};exports[_0xf0f9('0x69')]=function(_0x3f5f4a,_0x237371,_0x43512d){var _0x1a4e8d={'raw':!![],'where':{}};var _0x29280a={};var _0x15790b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3f5f4a['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x237371,null))[_0xf0f9('0x2d')](function(_0x1c5733){if(_0x1c5733){_0x29280a[_0xf0f9('0x40')]=_['keys'](db[_0xf0f9('0x6a')][_0xf0f9('0x54')]);_0x29280a['query']=_[_0xf0f9('0x41')](_0x3f5f4a[_0xf0f9('0x42')]);_0x29280a[_0xf0f9('0x43')]=_['intersection'](_0x29280a[_0xf0f9('0x40')],_0x29280a[_0xf0f9('0x42')]);_0x1a4e8d[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0x29280a[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x3f5f4a[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0x1a4e8d[_0xf0f9('0x46')]=_0x1a4e8d[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x1a4e8d[_0xf0f9('0x46')]:_0x29280a[_0xf0f9('0x40')];if(!_0x3f5f4a[_0xf0f9('0x42')]['hasOwnProperty'](_0xf0f9('0x48'))){_0x1a4e8d[_0xf0f9('0x27')]=qs[_0xf0f9('0x27')](_0x3f5f4a['query'][_0xf0f9('0x27')]);_0x1a4e8d[_0xf0f9('0x25')]=qs['offset'](_0x3f5f4a[_0xf0f9('0x42')][_0xf0f9('0x25')]);}_0x1a4e8d['order']=qs[_0xf0f9('0x4a')](_0x3f5f4a[_0xf0f9('0x42')]['sort']);_0x1a4e8d[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_['pick'](_0x3f5f4a['query'],_0x29280a[_0xf0f9('0x43')]));_0x1a4e8d[_0xf0f9('0x4b')][_0xf0f9('0x6b')]=_0x1c5733['id'];if(_0x3f5f4a[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0x1a4e8d[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x1a4e8d[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x1a4e8d['attributes'],function(_0x17392a){var _0x39b16e={};_0x39b16e[_0x17392a]={'$like':'%'+_0x3f5f4a[_0xf0f9('0x42')]['filter']+'%'};return _0x39b16e;})});}_0x1a4e8d=_[_0xf0f9('0x4d')]({},_0x1a4e8d,_0x3f5f4a[_0xf0f9('0x4f')]);return db[_0xf0f9('0x6a')][_0xf0f9('0x28')]({'where':_0x1a4e8d[_0xf0f9('0x4b')]})[_0xf0f9('0x2d')](function(_0x5c5aaa){_0x15790b[_0xf0f9('0x28')]=_0x5c5aaa;if(_0x3f5f4a[_0xf0f9('0x42')]['includeAll']){_0x1a4e8d[_0xf0f9('0x56')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf0f9('0x68')](_0x1a4e8d);})[_0xf0f9('0x2d')](function(_0x6fc6ae){_0x15790b[_0xf0f9('0x6c')]=_0x6fc6ae;return _0x15790b;});}})['then'](respondWithFilteredResult(_0x237371,_0x1a4e8d))['catch'](handleError(_0x237371,null));};exports['getHopperFinals']=function(_0x23f586,_0x4da4e2,_0x489f8a){var _0xaf2268={'raw':!![],'where':{}};var _0x5ec7d6={};var _0x16774a={'count':0x0,'rows':[]};return db[_0xf0f9('0x50')][_0xf0f9('0x65')]({'where':{'id':_0x23f586['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x4da4e2,null))[_0xf0f9('0x2d')](function(_0x34e0c6){if(_0x34e0c6){_0x5ec7d6[_0xf0f9('0x40')]=_[_0xf0f9('0x41')](db[_0xf0f9('0x6d')][_0xf0f9('0x54')]);_0x5ec7d6['query']=_[_0xf0f9('0x41')](_0x23f586[_0xf0f9('0x42')]);_0x5ec7d6[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x5ec7d6[_0xf0f9('0x40')],_0x5ec7d6[_0xf0f9('0x42')]);_0xaf2268['attributes']=_[_0xf0f9('0x44')](_0x5ec7d6['model'],qs['fields'](_0x23f586[_0xf0f9('0x42')]['fields']));_0xaf2268[_0xf0f9('0x46')]=_0xaf2268[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0xaf2268[_0xf0f9('0x46')]:_0x5ec7d6[_0xf0f9('0x40')];if(!_0x23f586['query'][_0xf0f9('0x67')](_0xf0f9('0x48'))){_0xaf2268['limit']=qs[_0xf0f9('0x27')](_0x23f586['query'][_0xf0f9('0x27')]);_0xaf2268[_0xf0f9('0x25')]=qs[_0xf0f9('0x25')](_0x23f586['query'][_0xf0f9('0x25')]);}_0xaf2268[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x23f586[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0xaf2268[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_[_0xf0f9('0x4c')](_0x23f586['query'],_0x5ec7d6[_0xf0f9('0x43')]));_0xaf2268[_0xf0f9('0x4b')][_0xf0f9('0x6b')]=_0x34e0c6['id'];if(_0x23f586[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0xaf2268[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0xaf2268['where'],{'$or':_['map'](_0xaf2268[_0xf0f9('0x46')],function(_0x48051b){var _0xe8e32f={};_0xe8e32f[_0x48051b]={'$like':'%'+_0x23f586[_0xf0f9('0x42')]['filter']+'%'};return _0xe8e32f;})});}_0xaf2268=_[_0xf0f9('0x4d')]({},_0xaf2268,_0x23f586['options']);return db['CmHopperFinal'][_0xf0f9('0x28')]({'where':_0xaf2268['where']})[_0xf0f9('0x2d')](function(_0x6a632){_0x16774a[_0xf0f9('0x28')]=_0x6a632;if(_0x23f586[_0xf0f9('0x42')][_0xf0f9('0x55')]){_0xaf2268['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xf0f9('0x68')](_0xaf2268);})[_0xf0f9('0x2d')](function(_0x453954){_0x16774a['rows']=_0x453954;return _0x16774a;});}})[_0xf0f9('0x2d')](respondWithFilteredResult(_0x4da4e2,_0xaf2268))[_0xf0f9('0x51')](handleError(_0x4da4e2,null));};exports[_0xf0f9('0x6e')]=function(_0x38c299,_0x57f474,_0x2d3abe){var _0x8e4f60={'raw':!![],'where':{}};var _0x31721a={};var _0x5b1427={'count':0x0,'rows':[]};return db[_0xf0f9('0x50')][_0xf0f9('0x65')]({'where':{'id':_0x38c299[_0xf0f9('0x53')]['id']}})['then'](handleEntityNotFound(_0x57f474,null))[_0xf0f9('0x2d')](function(_0x2fa258){if(_0x2fa258){_0x31721a['model']=_[_0xf0f9('0x41')](db[_0xf0f9('0x6f')]['rawAttributes']);_0x31721a['query']=_[_0xf0f9('0x41')](_0x38c299[_0xf0f9('0x42')]);_0x31721a[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x31721a[_0xf0f9('0x40')],_0x31721a[_0xf0f9('0x42')]);_0x8e4f60[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0x31721a[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x38c299['query']['fields']));_0x8e4f60[_0xf0f9('0x46')]=_0x8e4f60[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x8e4f60[_0xf0f9('0x46')]:_0x31721a[_0xf0f9('0x40')];if(!_0x38c299[_0xf0f9('0x42')]['hasOwnProperty'](_0xf0f9('0x48'))){_0x8e4f60[_0xf0f9('0x27')]=qs['limit'](_0x38c299['query'][_0xf0f9('0x27')]);_0x8e4f60[_0xf0f9('0x25')]=qs[_0xf0f9('0x25')](_0x38c299[_0xf0f9('0x42')]['offset']);}_0x8e4f60['order']=qs[_0xf0f9('0x4a')](_0x38c299[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x8e4f60[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_[_0xf0f9('0x4c')](_0x38c299[_0xf0f9('0x42')],_0x31721a[_0xf0f9('0x43')]));_0x8e4f60[_0xf0f9('0x4b')][_0xf0f9('0x6b')]=_0x2fa258['id'];if(_0x38c299['query'][_0xf0f9('0x32')]){_0x8e4f60[_0xf0f9('0x4b')]=_['merge'](_0x8e4f60[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x8e4f60[_0xf0f9('0x46')],function(_0x1466b0){var _0x3476fc={};_0x3476fc[_0x1466b0]={'$like':'%'+_0x38c299[_0xf0f9('0x42')]['filter']+'%'};return _0x3476fc;})});}_0x8e4f60=_[_0xf0f9('0x4d')]({},_0x8e4f60,_0x38c299[_0xf0f9('0x4f')]);return db[_0xf0f9('0x6f')][_0xf0f9('0x28')]({'where':_0x8e4f60[_0xf0f9('0x4b')]})[_0xf0f9('0x2d')](function(_0x1a923c){_0x5b1427[_0xf0f9('0x28')]=_0x1a923c;if(_0x38c299[_0xf0f9('0x42')][_0xf0f9('0x55')]){_0x8e4f60[_0xf0f9('0x56')]=[{'all':!![]}];}return db[_0xf0f9('0x6f')][_0xf0f9('0x68')](_0x8e4f60);})['then'](function(_0x549107){_0x5b1427[_0xf0f9('0x6c')]=_0x549107;return _0x5b1427;});}})[_0xf0f9('0x2d')](respondWithFilteredResult(_0x57f474,_0x8e4f60))[_0xf0f9('0x51')](handleError(_0x57f474,null));};exports[_0xf0f9('0x70')]=function(_0x234ed1,_0x258b4c,_0x5b9a58){var _0x50d7bb={};var _0x3863a9={};var _0x4e2cc2;var _0x184072;return db[_0xf0f9('0x50')][_0xf0f9('0x65')]({'where':{'id':_0x234ed1['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x258b4c,null))[_0xf0f9('0x2d')](function(_0x3fda1c){if(_0x3fda1c){_0x4e2cc2=_0x3fda1c;_0x3863a9['model']=_['keys'](db[_0xf0f9('0x71')][_0xf0f9('0x54')]);_0x3863a9['query']=_['keys'](_0x234ed1[_0xf0f9('0x42')]);_0x3863a9['filters']=_['intersection'](_0x3863a9[_0xf0f9('0x40')],_0x3863a9[_0xf0f9('0x42')]);_0x50d7bb[_0xf0f9('0x46')]=_['intersection'](_0x3863a9[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x234ed1[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0x50d7bb[_0xf0f9('0x46')]=_0x50d7bb[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x50d7bb[_0xf0f9('0x46')]:_0x3863a9[_0xf0f9('0x40')];_0x50d7bb[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x234ed1['query'][_0xf0f9('0x4a')]);_0x50d7bb[_0xf0f9('0x4b')]=qs['filters'](_['pick'](_0x234ed1[_0xf0f9('0x42')],_0x3863a9[_0xf0f9('0x43')]));if(_0x234ed1['query'][_0xf0f9('0x32')]){_0x50d7bb[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x50d7bb[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x50d7bb[_0xf0f9('0x46')],function(_0x571cfc){var _0x2260c4={};_0x2260c4[_0x571cfc]={'$like':'%'+_0x234ed1[_0xf0f9('0x42')]['filter']+'%'};return _0x2260c4;})});}_0x50d7bb=_[_0xf0f9('0x4d')]({},_0x50d7bb,_0x234ed1[_0xf0f9('0x4f')]);return _0x4e2cc2[_0xf0f9('0x70')](_0x50d7bb);}})['then'](function(_0x337607){if(_0x337607){_0x184072=_0x337607[_0xf0f9('0x47')];if(!_0x234ed1[_0xf0f9('0x42')][_0xf0f9('0x67')](_0xf0f9('0x48'))){_0x50d7bb[_0xf0f9('0x27')]=qs['limit'](_0x234ed1[_0xf0f9('0x42')]['limit']);_0x50d7bb[_0xf0f9('0x25')]=qs['offset'](_0x234ed1['query'][_0xf0f9('0x25')]);}return _0x4e2cc2[_0xf0f9('0x70')](_0x50d7bb);}})[_0xf0f9('0x2d')](function(_0x12b4e4){if(_0x12b4e4){return _0x12b4e4?{'count':_0x184072,'rows':_0x12b4e4}:null;}})[_0xf0f9('0x2d')](respondWithResult(_0x258b4c,null))[_0xf0f9('0x51')](handleError(_0x258b4c,null));};exports[_0xf0f9('0x72')]=function(_0x1f8e99,_0xe9d917,_0x3c27a6){var _0x508381=_0x1f8e99[_0xf0f9('0x58')][_0xf0f9('0x73')];var _0x17b87a=_[_0xf0f9('0x33')](_0x508381,'id');return db['Team'][_0xf0f9('0x68')]({'where':{'id':_0x17b87a},'attributes':['id'],'include':[{'model':db[_0xf0f9('0x74')],'as':_0xf0f9('0x75'),'attributes':['id',_0xf0f9('0x38'),_0xf0f9('0x76'),_0xf0f9('0x77'),'interface'],'raw':!![]}]})['then'](function(_0x50adc1){if(_0x50adc1){var _0x4d81e9=_['flatMap'](_0x50adc1,function(_0x5ae402){var _0x4eddb8=_0x5ae402[_0xf0f9('0x2e')]({'plain':!![]});_0x4eddb8[_0xf0f9('0x75')][_0xf0f9('0x78')](function(_0x47ad01){_0x47ad01['penalty']=_['find'](_0x508381,{'id':_0x4eddb8['id']})[_0xf0f9('0x79')];});return _0x4eddb8[_0xf0f9('0x75')];});return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x1f8e99['params']['id']}})[_0xf0f9('0x2d')](function(_0x3732ca){return db[_0xf0f9('0x7a')]['transaction'](function(_0x2ebabd){return _0x3732ca[_0xf0f9('0x72')](_0x17b87a,{'transaction':_0x2ebabd})['then'](function(){return BPromise[_0xf0f9('0x7b')](_0x508381,function(_0x116654){return db[_0xf0f9('0x7c')][_0xf0f9('0x7d')]({'TeamId':_0x116654['id'],'VoiceQueueId':_0x1f8e99[_0xf0f9('0x53')]['id'],'penalty':_0x116654[_0xf0f9('0x79')]},{'transaction':_0x2ebabd});});})[_0xf0f9('0x2d')](function(){return BPromise[_0xf0f9('0x7b')](_0x4d81e9,function(_0x1c37a7){return db[_0xf0f9('0x7e')]['findOrCreate']({'where':{'UserId':_0x1c37a7['id'],'VoiceQueueId':_0x1f8e99['params']['id']},'defaults':{'penalty':_0x1c37a7['penalty']},'transaction':_0x2ebabd});});})[_0xf0f9('0x2d')](function(){return BPromise[_0xf0f9('0x7b')](_[_0xf0f9('0x32')](_0x4d81e9,{'online':!![]}),function(_0x388271){return db[_0xf0f9('0x7f')][_0xf0f9('0x7d')]({'membername':_0x388271[_0xf0f9('0x38')],'UserId':_0x388271['id'],'queue_name':_0x3732ca[_0xf0f9('0x38')],'VoiceQueueId':_0x3732ca['id'],'interface':_[_0xf0f9('0x80')](_0x388271[_0xf0f9('0x81')])?util[_0xf0f9('0x82')](_0xf0f9('0x83'),_0x388271[_0xf0f9('0x38')]):_0x388271[_0xf0f9('0x81')],'paused':_0x388271[_0xf0f9('0x77')]||![],'penalty':_0x388271[_0xf0f9('0x79')]},{'transaction':_0x2ebabd});});})[_0xf0f9('0x2d')](function(){_0x4d81e9[_0xf0f9('0x78')](function(_0x467923){socket[_0xf0f9('0x84')](_0xf0f9('0x85'),{'UserId':_0x467923['id'],'VoiceQueueId':_0x3732ca['id']});});});});});}})['then'](respondWithStatusCode(_0xe9d917,null))[_0xf0f9('0x51')](handleError(_0xe9d917,null));};exports[_0xf0f9('0x86')]=function(_0x37d8d7,_0x1d105c,_0x3216a5){return db['Team'][_0xf0f9('0x68')]({'where':{'id':_0x37d8d7['query'][_0xf0f9('0x87')]},'attributes':['id'],'include':[{'model':db[_0xf0f9('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d105c,null))[_0xf0f9('0x2d')](function(_0x5c09e1){var _0x1440cc=_[_0xf0f9('0x33')](_0x5c09e1,'id');var _0x4ab7cc=[];var _0x596f6b=[];var _0x49175f=squel[_0xf0f9('0x88')]();_0x49175f['field'](_0xf0f9('0x89'))[_0xf0f9('0x8a')]('team_has_voice_queues','tq')[_0xf0f9('0x8b')](_0xf0f9('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf0f9('0x4b')]('VoiceQueueId\x20=\x20?',_0x37d8d7[_0xf0f9('0x53')]['id']);for(var _0x419dad=0x0;_0x419dad<_0x5c09e1[_0xf0f9('0x47')];_0x419dad+=0x1){let _0x74d70b=_0x5c09e1[_0x419dad];for(var _0x3e145e=0x0;_0x3e145e<_0x74d70b[_0xf0f9('0x75')][_0xf0f9('0x47')];_0x3e145e+=0x1){let _0x451627=_0x74d70b[_0xf0f9('0x75')][_0x3e145e];var _0x2e8e7a=_0x49175f[_0xf0f9('0x61')]();_0x2e8e7a[_0xf0f9('0x4b')](_0xf0f9('0x8d'),_0x451627['id']);_0x596f6b[_0xf0f9('0x8e')](db[_0xf0f9('0x7a')][_0xf0f9('0x42')](_0x2e8e7a[_0xf0f9('0x8f')](),{'type':db[_0xf0f9('0x7a')]['QueryTypes']['SELECT']})['then'](function(_0x122efc){if(_0x122efc[_0xf0f9('0x47')]===0x1){return _0x451627['id'];}else{var _0x1f55ee=_['every'](_[_0xf0f9('0x33')](_0x122efc,_0xf0f9('0x90')),function(_0x173574){return _[_0xf0f9('0x35')](_0x1440cc,_0x173574);});if(_0x1f55ee){return _0x451627['id'];}}}));}}return BPromise[_0xf0f9('0x91')](_0x596f6b)[_0xf0f9('0x2d')](function(_0x415cb5){_0x4ab7cc=_(_0x4ab7cc)[_0xf0f9('0x92')](_0x415cb5)[_0xf0f9('0x93')]()[_0xf0f9('0x34')]();return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x37d8d7[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](function(_0x4bd6f9){return db[_0xf0f9('0x7a')][_0xf0f9('0x94')](function(_0x1193c3){return _0x4bd6f9['removeTeams'](_0x37d8d7['query'][_0xf0f9('0x87')],{'transaction':_0x1193c3})[_0xf0f9('0x2d')](function(){if(!_[_0xf0f9('0x95')](_0x4ab7cc)){return _0x4bd6f9[_0xf0f9('0x96')](_0x4ab7cc,{'transaction':_0x1193c3})['then'](function(){return db[_0xf0f9('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x37d8d7[_0xf0f9('0x53')]['id'],'UserId':_0x4ab7cc},'transaction':_0x1193c3});});}})[_0xf0f9('0x2d')](function(){_0x4ab7cc[_0xf0f9('0x78')](function(_0x48e091){socket[_0xf0f9('0x84')](_0xf0f9('0x97'),{'UserId':_0x48e091,'VoiceQueueId':_0x4bd6f9['id']});});});});});});})[_0xf0f9('0x2d')](respondWithStatusCode(_0x1d105c,null))[_0xf0f9('0x51')](handleError(_0x1d105c,null));};exports[_0xf0f9('0x98')]=function(_0x4ae37e,_0x1cb465,_0x190274){var _0x4e8248,_0xa71dc;return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x4ae37e[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x1cb465,null))[_0xf0f9('0x2d')](function(_0x2309e6){if(_0x2309e6){_0xa71dc=_0x2309e6;return _0x2309e6[_0xf0f9('0x98')](_0x4ae37e[_0xf0f9('0x58')][_0xf0f9('0x87')],_[_0xf0f9('0x99')](_0x4ae37e['body'],[_0xf0f9('0x87'),'id'])||{})['spread'](function(_0x13abcf){for(var _0x11cf61=0x0;_0x11cf61<_0x4ae37e[_0xf0f9('0x58')][_0xf0f9('0x87')][_0xf0f9('0x47')];_0x11cf61+=0x1){socket[_0xf0f9('0x84')](_0xf0f9('0x85'),{'UserId':Number(_0x4ae37e[_0xf0f9('0x58')][_0xf0f9('0x87')][_0x11cf61]),'VoiceQueueId':Number(_0x4ae37e[_0xf0f9('0x53')]['id'])});}return _0x13abcf;});}})[_0xf0f9('0x2d')](function(_0x4c8471){_0x4e8248=_0x4c8471||[];if(_0xa71dc){return db['User'][_0xf0f9('0x68')]({'where':{'id':_0x4ae37e['body'][_0xf0f9('0x87')]},'attributes':['id',_0xf0f9('0x38'),_0xf0f9('0x76'),_0xf0f9('0x77'),_0xf0f9('0x81')],'raw':!![]});}})[_0xf0f9('0x2d')](function(_0x48881f){if(!_[_0xf0f9('0x95')](_0x48881f)){var _0x4b19d3=[];for(var _0x1d584a=0x0;_0x1d584a<_0x48881f[_0xf0f9('0x47')];_0x1d584a++){if(_0x48881f[_0x1d584a][_0xf0f9('0x76')]){_0x4b19d3[_0xf0f9('0x8e')](db['UserVoiceQueueRt'][_0xf0f9('0x7d')]({'membername':_0x48881f[_0x1d584a][_0xf0f9('0x38')],'UserId':_0x48881f[_0x1d584a]['id'],'queue_name':_0xa71dc[_0xf0f9('0x38')],'VoiceQueueId':_0xa71dc['id'],'interface':_[_0xf0f9('0x80')](_0x48881f[_0x1d584a][_0xf0f9('0x81')])?util[_0xf0f9('0x82')](_0xf0f9('0x83'),_0x48881f[_0x1d584a][_0xf0f9('0x38')]):_0x48881f[_0x1d584a][_0xf0f9('0x81')],'paused':_0x48881f[_0x1d584a][_0xf0f9('0x77')]||![],'penalty':_0x4ae37e[_0xf0f9('0x58')]['penalty']||0x0}));}}return BPromise[_0xf0f9('0x91')](_0x4b19d3);}})[_0xf0f9('0x2d')](function(){return _0x4e8248;})[_0xf0f9('0x2d')](respondWithResult(_0x1cb465,null))[_0xf0f9('0x51')](handleError(_0x1cb465,null));};exports['removeAgents']=function(_0x37bef9,_0x40c68f,_0x14bb87){return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x37bef9[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x40c68f,null))[_0xf0f9('0x2d')](function(_0x2d3f9d){if(_0x2d3f9d){return _0x2d3f9d[_0xf0f9('0x96')](_0x37bef9[_0xf0f9('0x42')][_0xf0f9('0x87')])[_0xf0f9('0x2d')](function(){if(_[_0xf0f9('0x9a')](_0x37bef9[_0xf0f9('0x42')][_0xf0f9('0x87')])){for(var _0x5c519b=0x0;_0x5c519b<_0x37bef9['query']['ids'][_0xf0f9('0x47')];_0x5c519b+=0x1){socket['emit'](_0xf0f9('0x97'),{'UserId':Number(_0x37bef9['query'][_0xf0f9('0x87')][_0x5c519b]),'VoiceQueueId':Number(_0x37bef9['params']['id'])});}}else{socket['emit'](_0xf0f9('0x97'),{'UserId':Number(_0x37bef9[_0xf0f9('0x42')][_0xf0f9('0x87')]),'VoiceQueueId':Number(_0x37bef9[_0xf0f9('0x53')]['id'])});}});}})['then'](function(_0x2f63c1){return db[_0xf0f9('0x7f')][_0xf0f9('0x3a')]({'where':{'VoiceQueueId':_0x37bef9[_0xf0f9('0x53')]['id'],'UserId':_0x37bef9[_0xf0f9('0x42')]['ids']}})['then'](function(){return _0x2f63c1;});})[_0xf0f9('0x2d')](respondWithStatusCode(_0x40c68f,null))['catch'](handleError(_0x40c68f,null));};exports['getAgents']=function(_0x137dae,_0x552a29,_0x5eb15f){var _0x4fed03={};var _0x3ca2b7={};var _0x288b1d;var _0x163d59;return db['VoiceQueue'][_0xf0f9('0x65')]({'where':{'id':_0x137dae[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x552a29,null))[_0xf0f9('0x2d')](function(_0xbdd9af){if(_0xbdd9af){_0x288b1d=_0xbdd9af;_0x3ca2b7['model']=_[_0xf0f9('0x41')](db[_0xf0f9('0x74')][_0xf0f9('0x54')]);_0x3ca2b7[_0xf0f9('0x42')]=_[_0xf0f9('0x41')](_0x137dae['query']);_0x3ca2b7[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x3ca2b7[_0xf0f9('0x40')],_0x3ca2b7[_0xf0f9('0x42')]);_0x4fed03[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0x3ca2b7[_0xf0f9('0x40')],qs[_0xf0f9('0x45')](_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0x4fed03[_0xf0f9('0x46')]=_0x4fed03[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x4fed03[_0xf0f9('0x46')]:_0x3ca2b7[_0xf0f9('0x40')];_0x4fed03[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x4fed03['where']=qs['filters'](_['pick'](_0x137dae[_0xf0f9('0x42')],_0x3ca2b7[_0xf0f9('0x43')]));if(_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0x4fed03[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x4fed03[_0xf0f9('0x4b')],{'$or':_['map'](_0x4fed03[_0xf0f9('0x46')],function(_0x3a8851){var _0x65bb1f={};_0x65bb1f[_0x3a8851]={'$like':'%'+_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x65bb1f;})});}_0x4fed03=_[_0xf0f9('0x4d')]({},_0x4fed03,_0x137dae[_0xf0f9('0x4f')]);return _0x288b1d[_0xf0f9('0x9b')](_0x4fed03);}})[_0xf0f9('0x2d')](function(_0x1d4c2e){if(_0x1d4c2e){_0x163d59=_0x1d4c2e['length'];if(!_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x67')](_0xf0f9('0x48'))){_0x4fed03[_0xf0f9('0x27')]=qs['limit'](_0x137dae['query']['limit']);_0x4fed03['offset']=qs[_0xf0f9('0x25')](_0x137dae[_0xf0f9('0x42')][_0xf0f9('0x25')]);}return _0x288b1d[_0xf0f9('0x9b')](_0x4fed03);}})['then'](function(_0x535da1){if(_0x535da1){return _0x535da1?{'count':_0x163d59,'rows':_0x535da1}:null;}})[_0xf0f9('0x2d')](respondWithResult(_0x552a29,null))[_0xf0f9('0x51')](handleError(_0x552a29,null));};exports[_0xf0f9('0x9c')]=function(_0x791972,_0x1450c9,_0xe0bdab){var _0x4cf7b6={};var _0x398d78={};var _0x57dfaf;var _0x4d6604;return db['VoiceQueue']['findOne']({'where':{'id':_0x791972['params']['id']}})['then'](handleEntityNotFound(_0x1450c9,null))[_0xf0f9('0x2d')](function(_0x113fa7){if(_0x113fa7){_0x57dfaf=_0x113fa7;_0x398d78[_0xf0f9('0x40')]=_[_0xf0f9('0x41')](db[_0xf0f9('0x7f')][_0xf0f9('0x54')]);_0x398d78[_0xf0f9('0x42')]=_[_0xf0f9('0x41')](_0x791972['query']);_0x398d78[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x398d78[_0xf0f9('0x40')],_0x398d78['query']);_0x4cf7b6[_0xf0f9('0x46')]=_['intersection'](_0x398d78[_0xf0f9('0x40')],qs['fields'](_0x791972[_0xf0f9('0x42')]['fields']));_0x4cf7b6[_0xf0f9('0x46')]=_0x4cf7b6['attributes'][_0xf0f9('0x47')]?_0x4cf7b6['attributes']:_0x398d78[_0xf0f9('0x40')];_0x4cf7b6[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x791972[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x4cf7b6[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_[_0xf0f9('0x4c')](_0x791972['query'],_0x398d78[_0xf0f9('0x43')]));if(_0x791972[_0xf0f9('0x42')]['filter']){_0x4cf7b6[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x4cf7b6[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x4cf7b6[_0xf0f9('0x46')],function(_0x1d1dfc){var _0x263e1c={};_0x263e1c[_0x1d1dfc]={'$like':'%'+_0x791972[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x263e1c;})});}_0x4cf7b6=_['merge']({},_0x4cf7b6,_0x791972[_0xf0f9('0x4f')]);return _0x57dfaf[_0xf0f9('0x9c')](_0x4cf7b6);}})[_0xf0f9('0x2d')](function(_0x556612){if(_0x556612){_0x4d6604=_0x556612[_0xf0f9('0x47')];if(!_0x791972[_0xf0f9('0x42')][_0xf0f9('0x67')]('nolimit')){_0x4cf7b6[_0xf0f9('0x27')]=qs[_0xf0f9('0x27')](_0x791972[_0xf0f9('0x42')]['limit']);_0x4cf7b6['offset']=qs['offset'](_0x791972[_0xf0f9('0x42')][_0xf0f9('0x25')]);}return _0x57dfaf[_0xf0f9('0x9c')](_0x4cf7b6);}})[_0xf0f9('0x2d')](function(_0x5b654f){return _0x5b654f?{'count':_0x4d6604,'rows':_0x5b654f}:null;})[_0xf0f9('0x2d')](respondWithResult(_0x1450c9,null))[_0xf0f9('0x51')](handleError(_0x1450c9,null));};exports[_0xf0f9('0x9d')]=function(_0x1511e0,_0x42cb1d,_0x4e65c0){var _0x584f74={};var _0xf5801={};var _0x351c19;var _0x1ba749;return db[_0xf0f9('0x50')]['findOne']({'where':{'id':_0x1511e0[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x42cb1d,null))[_0xf0f9('0x2d')](function(_0x37ee35){if(_0x37ee35){_0x351c19=_0x37ee35;_0xf5801[_0xf0f9('0x40')]=_['keys'](db[_0xf0f9('0x9e')]['rawAttributes']);_0xf5801[_0xf0f9('0x42')]=_[_0xf0f9('0x41')](_0x1511e0[_0xf0f9('0x42')]);_0xf5801[_0xf0f9('0x43')]=_['intersection'](_0xf5801['model'],_0xf5801[_0xf0f9('0x42')]);_0x584f74[_0xf0f9('0x46')]=_[_0xf0f9('0x44')](_0xf5801[_0xf0f9('0x40')],qs['fields'](_0x1511e0['query'][_0xf0f9('0x45')]));_0x584f74['attributes']=_0x584f74[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x584f74[_0xf0f9('0x46')]:_0xf5801[_0xf0f9('0x40')];_0x584f74[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x1511e0[_0xf0f9('0x42')][_0xf0f9('0x4a')]);_0x584f74[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_['pick'](_0x1511e0[_0xf0f9('0x42')],_0xf5801[_0xf0f9('0x43')]));if(_0x1511e0[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0x584f74[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x584f74[_0xf0f9('0x4b')],{'$or':_[_0xf0f9('0x33')](_0x584f74['attributes'],function(_0x1b3e5e){var _0x1280a1={};_0x1280a1[_0x1b3e5e]={'$like':'%'+_0x1511e0[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x1280a1;})});}_0x584f74=_[_0xf0f9('0x4d')]({},_0x584f74,_0x1511e0['options']);return _0x351c19[_0xf0f9('0x9d')](_0x584f74);}})[_0xf0f9('0x2d')](function(_0x2ee5b7){if(_0x2ee5b7){_0x1ba749=_0x2ee5b7[_0xf0f9('0x47')];if(!_0x1511e0[_0xf0f9('0x42')][_0xf0f9('0x67')](_0xf0f9('0x48'))){_0x584f74['limit']=qs[_0xf0f9('0x27')](_0x1511e0['query']['limit']);_0x584f74[_0xf0f9('0x25')]=qs[_0xf0f9('0x25')](_0x1511e0['query'][_0xf0f9('0x25')]);}return _0x351c19[_0xf0f9('0x9d')](_0x584f74);}})[_0xf0f9('0x2d')](function(_0x5d72f1){if(_0x5d72f1){return _0x5d72f1?{'count':_0x1ba749,'rows':_0x5d72f1}:null;}})['then'](respondWithResult(_0x42cb1d,null))[_0xf0f9('0x51')](handleError(_0x42cb1d,null));};exports[_0xf0f9('0x9f')]=function(_0xa3112e,_0x511419,_0x14978d){var _0x411370=moment()[_0xf0f9('0x82')](_0xf0f9('0xa0'));var _0x10b586,_0x48e05e;return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0xa3112e['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x511419,null))['then'](function(_0x547e91){if(_0x547e91){_0x48e05e=_0x547e91;return _0x547e91[_0xf0f9('0x9f')](_0xa3112e[_0xf0f9('0x58')][_0xf0f9('0x87')],_[_0xf0f9('0x99')](_0xa3112e[_0xf0f9('0x58')],[_0xf0f9('0x87'),'id'])||{});}return null;})[_0xf0f9('0xa1')](function(_0x5f44a1){var _0x20c4a0;_0x10b586=_0x5f44a1||[];var _0x2ee3bc=[];if(_0x5f44a1){for(var _0x471c87=0x0;_0x471c87<_0x5f44a1[_0xf0f9('0x47')];_0x471c87+=0x1){var _0x49cfd7=_0x5f44a1[_0x471c87][_0xf0f9('0x2e')]({'plain':!![]});_0x48e05e[_0xf0f9('0xa2')]=_0xa3112e[_0xf0f9('0x58')]['dialCheckDuplicateType']?_0xa3112e[_0xf0f9('0x58')][_0xf0f9('0xa2')]:_0x48e05e[_0xf0f9('0xa2')];switch(_0x48e05e[_0xf0f9('0xa2')]){case _0xf0f9('0xa3'):_0x20c4a0=squel['insert']()[_0xf0f9('0xa4')](_0xf0f9('0xa5'))['fromQuery']([_0xf0f9('0xa6'),'scheduledAt','ContactId',_0xf0f9('0xa7'),_0xf0f9('0x6b'),_0xf0f9('0x62'),'updatedAt'],squel[_0xf0f9('0x88')]()['field'](_0xf0f9('0xa6'),_0xf0f9('0xa6'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0xa9'))['field']('id',_0xf0f9('0xaa'))['field'](_0x49cfd7[_0xf0f9('0xab')][_0xf0f9('0x8f')](),_0xf0f9('0xa7'))[_0xf0f9('0xa8')](_0xa3112e[_0xf0f9('0x53')]['id'][_0xf0f9('0x8f')](),_0xf0f9('0x6b'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0x62'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0x63'))['from'](_0xf0f9('0xac'))[_0xf0f9('0x4b')](_0xf0f9('0xad'))['where'](_0xf0f9('0xae'),_0x49cfd7[_0xf0f9('0xab')]['toString']())['where'](_0xf0f9('0xaf'))[_0xf0f9('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf0f9('0x88')]()[_0xf0f9('0xa8')](_0xf0f9('0xb0'))['from'](_0xf0f9('0xb1'))['where'](_0xf0f9('0xb2'),_0xa3112e[_0xf0f9('0x53')]['id']['toString']()))[_0xf0f9('0x4b')](_0xf0f9('0xb3'),squel['select']()[_0xf0f9('0xa8')](_0xf0f9('0xb4'))[_0xf0f9('0x8a')](_0xf0f9('0xa5'))[_0xf0f9('0x4b')](_0xf0f9('0xb2'),_0xa3112e[_0xf0f9('0x53')]['id'][_0xf0f9('0x8f')]())))[_0xf0f9('0x8f')]();break;case'onlyIfOpen':_0x20c4a0=squel[_0xf0f9('0xb5')]()['into'](_0xf0f9('0xa5'))[_0xf0f9('0xb6')]([_0xf0f9('0xa6'),_0xf0f9('0xa9'),_0xf0f9('0xaa'),_0xf0f9('0xa7'),_0xf0f9('0x6b'),_0xf0f9('0x62'),_0xf0f9('0x63')],squel[_0xf0f9('0x88')]()[_0xf0f9('0xa8')]('phone',_0xf0f9('0xa6'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0xa9'))[_0xf0f9('0xa8')]('id','ContactId')[_0xf0f9('0xa8')](_0x49cfd7[_0xf0f9('0xab')][_0xf0f9('0x8f')](),'ListId')[_0xf0f9('0xa8')](_0xa3112e[_0xf0f9('0x53')]['id'][_0xf0f9('0x8f')](),_0xf0f9('0x6b'))['field']('\x27'+_0x411370+'\x27',_0xf0f9('0x62'))['field']('\x27'+_0x411370+'\x27','updatedAt')[_0xf0f9('0x8a')](_0xf0f9('0xac'))[_0xf0f9('0x4b')]('deletedAt\x20IS\x20NULL')[_0xf0f9('0x4b')]('ListId\x20=\x20?',_0x49cfd7[_0xf0f9('0xab')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf0f9('0x4b')](_0xf0f9('0xb3'),squel[_0xf0f9('0x88')]()['field'](_0xf0f9('0xb4'))[_0xf0f9('0x8a')](_0xf0f9('0xa5'))[_0xf0f9('0x4b')](_0xf0f9('0xb2'),_0xa3112e[_0xf0f9('0x53')]['id']['toString']())))[_0xf0f9('0x8f')]();break;default:_0x20c4a0=squel[_0xf0f9('0xb5')]()['into'](_0xf0f9('0xa5'))[_0xf0f9('0xb6')]([_0xf0f9('0xa6'),_0xf0f9('0xa9'),_0xf0f9('0xaa'),_0xf0f9('0xa7'),'VoiceQueueId',_0xf0f9('0x62'),_0xf0f9('0x63')],squel[_0xf0f9('0x88')]()[_0xf0f9('0xa8')](_0xf0f9('0xa6'),_0xf0f9('0xa6'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0xa9'))[_0xf0f9('0xa8')]('id','ContactId')['field'](_0x49cfd7[_0xf0f9('0xab')][_0xf0f9('0x8f')](),_0xf0f9('0xa7'))[_0xf0f9('0xa8')](_0xa3112e[_0xf0f9('0x53')]['id'][_0xf0f9('0x8f')](),_0xf0f9('0x6b'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27','createdAt')[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27','updatedAt')['from'](_0xf0f9('0xac'))[_0xf0f9('0x4b')](_0xf0f9('0xad'))[_0xf0f9('0x4b')](_0xf0f9('0xae'),_0x49cfd7[_0xf0f9('0xab')][_0xf0f9('0x8f')]())[_0xf0f9('0x4b')](_0xf0f9('0xaf')))[_0xf0f9('0x8f')]();}_0x2ee3bc['push'](db[_0xf0f9('0x7a')][_0xf0f9('0x42')](_0x20c4a0));}return BPromise[_0xf0f9('0x91')](_0x2ee3bc);}})['then'](function(){var _0x99b0ff=[];var _0x483cb8=squel[_0xf0f9('0xb5')]()[_0xf0f9('0xa4')](_0xf0f9('0xb7'))[_0xf0f9('0xb6')]([_0xf0f9('0xb8'),_0xf0f9('0xa6'),_0xf0f9('0xb9'),_0xf0f9('0x62'),_0xf0f9('0x63')],squel[_0xf0f9('0x88')]()[_0xf0f9('0xa8')](_0xf0f9('0xba'))[_0xf0f9('0xa8')](_0xf0f9('0xbb'))['field'](_0xf0f9('0xbc'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0x62'))[_0xf0f9('0xa8')]('\x27'+_0x411370+'\x27',_0xf0f9('0x63'))['from'](_0xf0f9('0xbd'),'ci')['join'](_0xf0f9('0xa5'),'h',_0xf0f9('0xbe'))[_0xf0f9('0x4b')](_0xf0f9('0xbf'),_0x411370)[_0xf0f9('0x4b')](_0xf0f9('0xc0'),'PHONE'))[_0xf0f9('0x8f')]();_0x99b0ff['push'](db['sequelize'][_0xf0f9('0x42')](_0x483cb8));return BPromise[_0xf0f9('0x91')](_0x99b0ff);})['then'](function(){return _0x10b586;})[_0xf0f9('0x2d')](respondWithResult(_0x511419,null))[_0xf0f9('0x51')](handleError(_0x511419,null));};exports[_0xf0f9('0xc1')]=function(_0x3f48e8,_0x8e2e71,_0x4ceb87){return db[_0xf0f9('0x50')]['find']({'where':{'id':_0x3f48e8[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x8e2e71,null))['then'](function(_0x56fbb5){if(_0x56fbb5){return _0x56fbb5[_0xf0f9('0xc1')](_0x3f48e8['query'][_0xf0f9('0x87')]);}})[_0xf0f9('0x2d')](function(_0x29617c){if(_0x29617c){return db['CmHopper'][_0xf0f9('0x3a')]({'where':{'ListId':_0x3f48e8[_0xf0f9('0x42')][_0xf0f9('0x87')],'VoiceQueueId':_0x3f48e8[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](function(){return _0x29617c;});}})['then'](respondWithStatusCode(_0x8e2e71,null))[_0xf0f9('0x51')](handleError(_0x8e2e71,null));};exports[_0xf0f9('0xc2')]=function(_0x52677d,_0x31490a,_0x579724){var _0x59294b={};var _0x17729d={};var _0x5d8377;var _0x4f415e;return db['VoiceQueue'][_0xf0f9('0x65')]({'where':{'id':_0x52677d[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x31490a,null))[_0xf0f9('0x2d')](function(_0x2b8207){if(_0x2b8207){_0x5d8377=_0x2b8207;_0x17729d['model']=_[_0xf0f9('0x41')](db[_0xf0f9('0x9e')]['rawAttributes']);_0x17729d[_0xf0f9('0x42')]=_[_0xf0f9('0x41')](_0x52677d['query']);_0x17729d[_0xf0f9('0x43')]=_[_0xf0f9('0x44')](_0x17729d[_0xf0f9('0x40')],_0x17729d[_0xf0f9('0x42')]);_0x59294b['attributes']=_['intersection'](_0x17729d['model'],qs[_0xf0f9('0x45')](_0x52677d[_0xf0f9('0x42')][_0xf0f9('0x45')]));_0x59294b[_0xf0f9('0x46')]=_0x59294b[_0xf0f9('0x46')][_0xf0f9('0x47')]?_0x59294b[_0xf0f9('0x46')]:_0x17729d['model'];_0x59294b[_0xf0f9('0x49')]=qs[_0xf0f9('0x4a')](_0x52677d['query'][_0xf0f9('0x4a')]);_0x59294b[_0xf0f9('0x4b')]=qs[_0xf0f9('0x43')](_[_0xf0f9('0x4c')](_0x52677d[_0xf0f9('0x42')],_0x17729d['filters']));if(_0x52677d[_0xf0f9('0x42')][_0xf0f9('0x32')]){_0x59294b[_0xf0f9('0x4b')]=_[_0xf0f9('0x4d')](_0x59294b['where'],{'$or':_[_0xf0f9('0x33')](_0x59294b['attributes'],function(_0x1253ed){var _0x53bbb1={};_0x53bbb1[_0x1253ed]={'$like':'%'+_0x52677d[_0xf0f9('0x42')][_0xf0f9('0x32')]+'%'};return _0x53bbb1;})});}_0x59294b=_[_0xf0f9('0x4d')]({},_0x59294b,_0x52677d[_0xf0f9('0x4f')]);return _0x5d8377[_0xf0f9('0xc2')](_0x59294b);}})[_0xf0f9('0x2d')](function(_0xa1f6f8){if(_0xa1f6f8){_0x4f415e=_0xa1f6f8[_0xf0f9('0x47')];if(!_0x52677d[_0xf0f9('0x42')]['hasOwnProperty'](_0xf0f9('0x48'))){_0x59294b['limit']=qs[_0xf0f9('0x27')](_0x52677d[_0xf0f9('0x42')]['limit']);_0x59294b[_0xf0f9('0x25')]=qs[_0xf0f9('0x25')](_0x52677d[_0xf0f9('0x42')]['offset']);}return _0x5d8377[_0xf0f9('0xc2')](_0x59294b);}})[_0xf0f9('0x2d')](function(_0x323519){if(_0x323519){return _0x323519?{'count':_0x4f415e,'rows':_0x323519}:null;}})[_0xf0f9('0x2d')](respondWithResult(_0x31490a,null))['catch'](handleError(_0x31490a,null));};exports[_0xf0f9('0xc3')]=function(_0x52af2d,_0x49ef5f,_0x3c161d){var _0x2ffd8c,_0x21d58d;return db['VoiceQueue'][_0xf0f9('0x36')]({'where':{'id':_0x52af2d['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x49ef5f,null))['then'](function(_0x149e17){if(_0x149e17){_0x21d58d=_0x149e17;return _0x149e17[_0xf0f9('0xc3')](_0x52af2d['body'][_0xf0f9('0x87')],_[_0xf0f9('0x99')](_0x52af2d[_0xf0f9('0x58')],[_0xf0f9('0x87'),'id'])||{});}return null;})[_0xf0f9('0xa1')](function(_0x131695){var _0x4f15c3;_0x2ffd8c=_0x131695||[];var _0x321e8a=[];if(_0x131695){for(var _0x326fc7=0x0;_0x326fc7<_0x131695[_0xf0f9('0x47')];_0x326fc7+=0x1){var _0x2abfb5=_0x131695[_0x326fc7]['get']({'plain':!![]});_0x4f15c3=squel[_0xf0f9('0xb5')]()[_0xf0f9('0xa4')](_0xf0f9('0xc4'))[_0xf0f9('0xb6')]([_0xf0f9('0xa6'),_0xf0f9('0xaa'),'ListId',_0xf0f9('0x6b'),'createdAt',_0xf0f9('0x63')],squel[_0xf0f9('0x88')]()[_0xf0f9('0xa8')](_0xf0f9('0xa6'),_0xf0f9('0xa6'))[_0xf0f9('0xa8')]('id',_0xf0f9('0xaa'))['field'](_0x2abfb5[_0xf0f9('0xab')][_0xf0f9('0x8f')](),_0xf0f9('0xa7'))[_0xf0f9('0xa8')](_0x52af2d['params']['id']['toString'](),_0xf0f9('0x6b'))['field'](_0xf0f9('0xc5'),_0xf0f9('0x62'))[_0xf0f9('0xa8')](_0xf0f9('0xc5'),_0xf0f9('0x63'))[_0xf0f9('0x8a')](_0xf0f9('0xac'))[_0xf0f9('0x4b')](_0xf0f9('0xad'))[_0xf0f9('0x4b')](_0xf0f9('0xae'),_0x2abfb5[_0xf0f9('0xab')][_0xf0f9('0x8f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xf0f9('0x8f')]();_0x321e8a[_0xf0f9('0x8e')](db[_0xf0f9('0x7a')][_0xf0f9('0x42')](_0x4f15c3));}return BPromise[_0xf0f9('0x91')](_0x321e8a);}})[_0xf0f9('0x2d')](function(){return _0x2ffd8c;})[_0xf0f9('0x2d')](respondWithResult(_0x49ef5f,null))[_0xf0f9('0x51')](handleError(_0x49ef5f,null));};exports[_0xf0f9('0xc6')]=function(_0x1ca3ae,_0x1c948a,_0xd43fdf){return db[_0xf0f9('0x50')][_0xf0f9('0x36')]({'where':{'id':_0x1ca3ae[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x1c948a,null))['then'](function(_0x1cdfd0){if(_0x1cdfd0){return _0x1cdfd0[_0xf0f9('0xc6')](_0x1ca3ae[_0xf0f9('0x42')][_0xf0f9('0x87')]);}})[_0xf0f9('0x2d')](function(_0x35efd1){if(_0x35efd1){return db[_0xf0f9('0x6f')][_0xf0f9('0x3a')]({'where':{'ListId':_0x1ca3ae[_0xf0f9('0x42')]['ids'],'VoiceQueueId':_0x1ca3ae[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2d')](function(){return _0x35efd1;});}})[_0xf0f9('0x2d')](respondWithStatusCode(_0x1c948a,null))[_0xf0f9('0x51')](handleError(_0x1c948a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8d161cf..f4cc15d 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 _0x21e5=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2b8ae8,_0xffad5){var _0x9c9a1d=function(_0x5d98db){while(--_0x5d98db){_0x2b8ae8['push'](_0x2b8ae8['shift']());}};_0x9c9a1d(++_0xffad5);}(_0x21e5,0x1c4));var _0x521e=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x21e5[_0x359bbe];return _0x1b3353;};'use strict';var EventEmitter=require(_0x521e('0x0'));var VoiceQueue=require(_0x521e('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x521e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x521e('0x3')};function emitEvent(_0x415cbc){return function(_0x3c5a54,_0x4646cf,_0x7fdcc7){VoiceQueueEvents[_0x521e('0x4')](_0x415cbc+':'+_0x3c5a54['id'],_0x3c5a54);VoiceQueueEvents['emit'](_0x415cbc,_0x3c5a54);_0x7fdcc7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x521e('0x5')](e,emitEvent(event));}}module[_0x521e('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x5bd2=['remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x527772,_0x284c0e){var _0x2bf55f=function(_0x3ad6d0){while(--_0x3ad6d0){_0x527772['push'](_0x527772['shift']());}};_0x2bf55f(++_0x284c0e);}(_0x5bd2,0x1cf));var _0x25bd=function(_0x5bbe2c,_0x49818c){_0x5bbe2c=_0x5bbe2c-0x0;var _0x28efef=_0x5bd2[_0x5bbe2c];return _0x28efef;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x25bd('0x0'))['db'][_0x25bd('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x25bd('0x2')](0x0);var events={'afterCreate':_0x25bd('0x3'),'afterUpdate':_0x25bd('0x4'),'afterDestroy':_0x25bd('0x5')};function emitEvent(_0x1fcf57){return function(_0x3a92dc,_0x5007fd,_0xfb5f3){VoiceQueueEvents[_0x25bd('0x6')](_0x1fcf57+':'+_0x3a92dc['id'],_0x3a92dc);VoiceQueueEvents[_0x25bd('0x6')](_0x1fcf57,_0x3a92dc);_0xfb5f3(null);};}for(var e in events){if(events[_0x25bd('0x7')](e)){var event=events[e];VoiceQueue[_0x25bd('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2133252..997e6a1 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x343e70,_0xe5f373){var _0x2742fd=function(_0x27e56e){while(--_0x27e56e){_0x343e70['push'](_0x343e70['shift']());}};_0x2742fd(++_0xe5f373);}(_0x008c,0x188));var _0xc008=function(_0x194494,_0x57c76e){_0x194494=_0x194494-0x0;var _0x45acaf=_0x008c[_0x194494];return _0x45acaf;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x309dc9,_0x417216){var _0x512b51=function(_0x544088){while(--_0x544088){_0x309dc9['push'](_0x309dc9['shift']());}};_0x512b51(++_0x417216);}(_0x34e8,0x12c));var _0x834e=function(_0x46e57e,_0x7bfa0e){_0x46e57e=_0x46e57e-0x0;var _0x447013=_0x34e8[_0x46e57e];return _0x447013;};'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 4a93396..bfe97ca 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 _0x8908=['options','where','attributes','limit','include','map','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','raw'];(function(_0x3d550f,_0x2df132){var _0x32e660=function(_0x32d8df){while(--_0x32d8df){_0x3d550f['push'](_0x3d550f['shift']());}};_0x32e660(++_0x2df132);}(_0x8908,0x8a));var _0x8890=function(_0x2c6e3f,_0x240e60){_0x2c6e3f=_0x2c6e3f-0x0;var _0x49f7e6=_0x8908[_0x2c6e3f];return _0x49f7e6;};'use strict';var _=require(_0x8890('0x0'));var util=require(_0x8890('0x1'));var moment=require(_0x8890('0x2'));var BPromise=require(_0x8890('0x3'));var rs=require(_0x8890('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8890('0x5'))['db'];var utils=require(_0x8890('0x6'));var logger=require(_0x8890('0x7'))(_0x8890('0x8'));var config=require(_0x8890('0x9'));var jayson=require(_0x8890('0xa'));var client=jayson[_0x8890('0xb')]['http']({'port':0x232a});config[_0x8890('0xc')]=_[_0x8890('0xd')](config[_0x8890('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8890('0xe'))(new Redis(config[_0x8890('0xc')]));require(_0x8890('0xf'))[_0x8890('0x10')](socket);function respondWithRpcPromise(_0x29c166,_0x5b5415,_0x20883a){return new BPromise(function(_0x590df0,_0x207023){return client[_0x8890('0x11')](_0x29c166,_0x20883a)[_0x8890('0x12')](function(_0x107960){logger[_0x8890('0x13')](_0x8890('0x14'),_0x5b5415,_0x8890('0x15'));logger[_0x8890('0x16')](_0x8890('0x17'),_0x5b5415,'request\x20sent',JSON[_0x8890('0x18')](_0x107960));if(_0x107960['error']){if(_0x107960[_0x8890('0x19')][_0x8890('0x1a')]===0x1f4){logger[_0x8890('0x19')](_0x8890('0x14'),_0x5b5415,_0x107960['error'][_0x8890('0x1b')]);return _0x207023(_0x107960['error']['message']);}logger[_0x8890('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x5b5415,_0x107960[_0x8890('0x19')]['message']);return _0x590df0(_0x107960['error'][_0x8890('0x1b')]);}else{logger[_0x8890('0x13')](_0x8890('0x14'),_0x5b5415,_0x8890('0x15'));_0x590df0(_0x107960[_0x8890('0x1c')][_0x8890('0x1b')]);}})[_0x8890('0x1d')](function(_0x4054dd){logger[_0x8890('0x19')](_0x8890('0x14'),_0x5b5415,_0x4054dd);_0x207023(_0x4054dd);});});}exports[_0x8890('0x1e')]=function(_0x40d611){var _0x266da2=this;return new Promise(function(_0x316bf6,_0x4a5770){return db[_0x8890('0x1f')][_0x8890('0x20')]({'raw':_0x40d611['options']?_0x40d611['options'][_0x8890('0x21')]===undefined?!![]:![]:!![],'where':_0x40d611[_0x8890('0x22')]?_0x40d611[_0x8890('0x22')][_0x8890('0x23')]||null:null,'attributes':_0x40d611[_0x8890('0x22')]?_0x40d611[_0x8890('0x22')][_0x8890('0x24')]||null:null,'limit':_0x40d611['options']?_0x40d611['options'][_0x8890('0x25')]||null:null,'include':_0x40d611[_0x8890('0x22')]?_0x40d611['options'][_0x8890('0x26')]?_[_0x8890('0x27')](_0x40d611[_0x8890('0x22')]['include'],function(_0x5110f0){return{'model':db[_0x5110f0[_0x8890('0x28')]],'as':_0x5110f0['as'],'attributes':_0x5110f0['attributes'],'include':_0x5110f0[_0x8890('0x26')]?_[_0x8890('0x27')](_0x5110f0[_0x8890('0x26')],function(_0x15e27d){return{'model':db[_0x15e27d[_0x8890('0x28')]],'as':_0x15e27d['as'],'attributes':_0x15e27d[_0x8890('0x24')],'include':_0x15e27d[_0x8890('0x26')]?_[_0x8890('0x27')](_0x15e27d[_0x8890('0x26')],function(_0x6dee77){return{'model':db[_0x6dee77[_0x8890('0x28')]],'as':_0x6dee77['as'],'attributes':_0x6dee77[_0x8890('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8890('0x12')](function(_0x34cbce){logger['info']('GetVoiceQueue',_0x40d611);logger[_0x8890('0x16')](_0x8890('0x1e'),_0x40d611,JSON[_0x8890('0x18')](_0x34cbce));_0x316bf6(_0x34cbce);})['catch'](function(_0x71c187){logger['error']('GetVoiceQueue',_0x71c187[_0x8890('0x1b')],_0x40d611);_0x4a5770(_0x266da2[_0x8890('0x19')](0x1f4,_0x71c187[_0x8890('0x1b')]));});});};exports['ShowVoiceQueue']=function(_0x95363a){var _0x503cd2=this;return new Promise(function(_0x52b597,_0x41bf7f){return db[_0x8890('0x1f')][_0x8890('0x29')]({'raw':_0x95363a[_0x8890('0x22')]?_0x95363a['options'][_0x8890('0x21')]===undefined?!![]:![]:!![],'where':_0x95363a[_0x8890('0x22')]?_0x95363a[_0x8890('0x22')]['where']||null:null,'attributes':_0x95363a['options']?_0x95363a[_0x8890('0x22')][_0x8890('0x24')]||null:null,'include':_0x95363a[_0x8890('0x22')]?_0x95363a[_0x8890('0x22')][_0x8890('0x26')]?_['map'](_0x95363a[_0x8890('0x22')][_0x8890('0x26')],function(_0x5250e0){return{'model':db[_0x5250e0[_0x8890('0x28')]],'as':_0x5250e0['as'],'attributes':_0x5250e0['attributes'],'include':_0x5250e0[_0x8890('0x26')]?_[_0x8890('0x27')](_0x5250e0[_0x8890('0x26')],function(_0x1de6f4){return{'model':db[_0x1de6f4[_0x8890('0x28')]],'as':_0x1de6f4['as'],'attributes':_0x1de6f4[_0x8890('0x24')],'include':_0x1de6f4[_0x8890('0x26')]?_['map'](_0x1de6f4[_0x8890('0x26')],function(_0x2f4dc3){return{'model':db[_0x2f4dc3['model']],'as':_0x2f4dc3['as'],'attributes':_0x2f4dc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8890('0x12')](function(_0x4e820b){logger[_0x8890('0x13')]('ShowVoiceQueue',_0x95363a);logger[_0x8890('0x16')]('ShowVoiceQueue',_0x95363a,JSON[_0x8890('0x18')](_0x4e820b));_0x52b597(_0x4e820b);})['catch'](function(_0x112244){logger[_0x8890('0x19')](_0x8890('0x2a'),_0x112244[_0x8890('0x1b')],_0x95363a);_0x41bf7f(_0x503cd2[_0x8890('0x19')](0x1f4,_0x112244[_0x8890('0x1b')]));});});}; \ No newline at end of file +var _0xa88e=['client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes','include','map','model','then','debug','ShowVoiceQueue','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x407080,_0x169611){var _0x4d1718=function(_0x31548f){while(--_0x31548f){_0x407080['push'](_0x407080['shift']());}};_0x4d1718(++_0x169611);}(_0xa88e,0x9b));var _0xea88=function(_0x3ca8b4,_0x3e8161){_0x3ca8b4=_0x3ca8b4-0x0;var _0x1ffce4=_0xa88e[_0x3ca8b4];return _0x1ffce4;};'use strict';var _=require(_0xea88('0x0'));var util=require(_0xea88('0x1'));var moment=require(_0xea88('0x2'));var BPromise=require(_0xea88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea88('0x4'));var db=require(_0xea88('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea88('0x6'))(_0xea88('0x7'));var config=require(_0xea88('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xea88('0x9')][_0xea88('0xa')]({'port':0x232a});config['redis']=_[_0xea88('0xb')](config[_0xea88('0xc')],{'host':_0xea88('0xd'),'port':0x18eb});var socket=require(_0xea88('0xe'))(new Redis(config[_0xea88('0xc')]));require(_0xea88('0xf'))[_0xea88('0x10')](socket);function respondWithRpcPromise(_0x3c9633,_0x517945,_0x37079e){return new BPromise(function(_0xd1bbcc,_0x4c9627){return client[_0xea88('0x11')](_0x3c9633,_0x37079e)['then'](function(_0x7a7011){logger['info'](_0xea88('0x12'),_0x517945,_0xea88('0x13'));logger['debug'](_0xea88('0x14'),_0x517945,'request\x20sent',JSON[_0xea88('0x15')](_0x7a7011));if(_0x7a7011[_0xea88('0x16')]){if(_0x7a7011[_0xea88('0x16')][_0xea88('0x17')]===0x1f4){logger['error'](_0xea88('0x12'),_0x517945,_0x7a7011[_0xea88('0x16')][_0xea88('0x18')]);return _0x4c9627(_0x7a7011[_0xea88('0x16')][_0xea88('0x18')]);}logger['error'](_0xea88('0x12'),_0x517945,_0x7a7011[_0xea88('0x16')][_0xea88('0x18')]);return _0xd1bbcc(_0x7a7011[_0xea88('0x16')][_0xea88('0x18')]);}else{logger[_0xea88('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x517945,_0xea88('0x13'));_0xd1bbcc(_0x7a7011[_0xea88('0x1a')][_0xea88('0x18')]);}})[_0xea88('0x1b')](function(_0x4b375f){logger['error'](_0xea88('0x12'),_0x517945,_0x4b375f);_0x4c9627(_0x4b375f);});});}exports[_0xea88('0x1c')]=function(_0x5ac325){var _0xc108b=this;return new Promise(function(_0x2186e7,_0x52d8aa){return db[_0xea88('0x1d')][_0xea88('0x1e')]({'raw':_0x5ac325[_0xea88('0x1f')]?_0x5ac325['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ac325[_0xea88('0x1f')]?_0x5ac325[_0xea88('0x1f')]['where']||null:null,'attributes':_0x5ac325['options']?_0x5ac325[_0xea88('0x1f')][_0xea88('0x20')]||null:null,'limit':_0x5ac325[_0xea88('0x1f')]?_0x5ac325['options']['limit']||null:null,'include':_0x5ac325[_0xea88('0x1f')]?_0x5ac325[_0xea88('0x1f')][_0xea88('0x21')]?_[_0xea88('0x22')](_0x5ac325[_0xea88('0x1f')]['include'],function(_0x1ed98e){return{'model':db[_0x1ed98e[_0xea88('0x23')]],'as':_0x1ed98e['as'],'attributes':_0x1ed98e[_0xea88('0x20')],'include':_0x1ed98e[_0xea88('0x21')]?_['map'](_0x1ed98e[_0xea88('0x21')],function(_0x4eadfc){return{'model':db[_0x4eadfc[_0xea88('0x23')]],'as':_0x4eadfc['as'],'attributes':_0x4eadfc[_0xea88('0x20')],'include':_0x4eadfc[_0xea88('0x21')]?_['map'](_0x4eadfc[_0xea88('0x21')],function(_0x56d690){return{'model':db[_0x56d690[_0xea88('0x23')]],'as':_0x56d690['as'],'attributes':_0x56d690['attributes']};}):[]};}):[]};}):[]:[]})[_0xea88('0x24')](function(_0x2c5cb1){logger[_0xea88('0x19')]('GetVoiceQueue',_0x5ac325);logger[_0xea88('0x25')](_0xea88('0x1c'),_0x5ac325,JSON['stringify'](_0x2c5cb1));_0x2186e7(_0x2c5cb1);})[_0xea88('0x1b')](function(_0x2487fc){logger[_0xea88('0x16')]('GetVoiceQueue',_0x2487fc[_0xea88('0x18')],_0x5ac325);_0x52d8aa(_0xc108b['error'](0x1f4,_0x2487fc[_0xea88('0x18')]));});});};exports[_0xea88('0x26')]=function(_0x2a4e8d){var _0x3cb90f=this;return new Promise(function(_0x4e4e0f,_0x164b5b){return db[_0xea88('0x1d')]['find']({'raw':_0x2a4e8d[_0xea88('0x1f')]?_0x2a4e8d[_0xea88('0x1f')][_0xea88('0x27')]===undefined?!![]:![]:!![],'where':_0x2a4e8d[_0xea88('0x1f')]?_0x2a4e8d[_0xea88('0x1f')][_0xea88('0x28')]||null:null,'attributes':_0x2a4e8d[_0xea88('0x1f')]?_0x2a4e8d[_0xea88('0x1f')][_0xea88('0x20')]||null:null,'include':_0x2a4e8d['options']?_0x2a4e8d[_0xea88('0x1f')]['include']?_[_0xea88('0x22')](_0x2a4e8d[_0xea88('0x1f')][_0xea88('0x21')],function(_0x1c9451){return{'model':db[_0x1c9451[_0xea88('0x23')]],'as':_0x1c9451['as'],'attributes':_0x1c9451[_0xea88('0x20')],'include':_0x1c9451['include']?_[_0xea88('0x22')](_0x1c9451['include'],function(_0x48ef5f){return{'model':db[_0x48ef5f[_0xea88('0x23')]],'as':_0x48ef5f['as'],'attributes':_0x48ef5f[_0xea88('0x20')],'include':_0x48ef5f[_0xea88('0x21')]?_[_0xea88('0x22')](_0x48ef5f[_0xea88('0x21')],function(_0x4a2b50){return{'model':db[_0x4a2b50[_0xea88('0x23')]],'as':_0x4a2b50['as'],'attributes':_0x4a2b50[_0xea88('0x20')]};}):[]};}):[]};}):[]:[]})[_0xea88('0x24')](function(_0x365243){logger[_0xea88('0x19')]('ShowVoiceQueue',_0x2a4e8d);logger['debug'](_0xea88('0x26'),_0x2a4e8d,JSON['stringify'](_0x365243));_0x4e4e0f(_0x365243);})[_0xea88('0x1b')](function(_0x358a8b){logger[_0xea88('0x16')]('ShowVoiceQueue',_0x358a8b[_0xea88('0x18')],_0x2a4e8d);_0x164b5b(_0x3cb90f[_0xea88('0x16')](0x1f4,_0x358a8b[_0xea88('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d7fa20a..0574921 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 _0x59b1=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x41a6b1,_0x33302b){var _0x26a187=function(_0x4fa33f){while(--_0x4fa33f){_0x41a6b1['push'](_0x41a6b1['shift']());}};_0x26a187(++_0x33302b);}(_0x59b1,0x10c));var _0x159b=function(_0x38344e,_0x11a470){_0x38344e=_0x38344e-0x0;var _0x1ef998=_0x59b1[_0x38344e];return _0x1ef998;};'use strict';var VoiceQueueEvents=require(_0x159b('0x0'));var events=[_0x159b('0x1'),_0x159b('0x2'),_0x159b('0x3')];function createListener(_0x47e523,_0x27e016){return function(_0x36356d){_0x27e016['emit'](_0x47e523,_0x36356d);};}function removeListener(_0x1cc5be,_0x189b16){return function(){VoiceQueueEvents[_0x159b('0x4')](_0x1cc5be,_0x189b16);};}exports[_0x159b('0x5')]=function(_0x72a1b1){for(var _0x2d42cb=0x0,_0x436770=events[_0x159b('0x6')];_0x2d42cb<_0x436770;_0x2d42cb++){var _0x1a21de=events[_0x2d42cb];var _0x27504e=createListener(_0x159b('0x7')+_0x1a21de,_0x72a1b1);VoiceQueueEvents['on'](_0x1a21de,_0x27504e);}}; \ No newline at end of file +var _0x14f3=['remove','emit','removeListener','length','./voiceQueue.events','save'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x14f3,0xa0));var _0x314f=function(_0x1419ba,_0x470975){_0x1419ba=_0x1419ba-0x0;var _0x54d3af=_0x14f3[_0x1419ba];return _0x54d3af;};'use strict';var VoiceQueueEvents=require(_0x314f('0x0'));var events=[_0x314f('0x1'),_0x314f('0x2'),'update'];function createListener(_0x4f1c67,_0x278e63){return function(_0x46e9fd){_0x278e63[_0x314f('0x3')](_0x4f1c67,_0x46e9fd);};}function removeListener(_0x546fdf,_0xd3cbf){return function(){VoiceQueueEvents[_0x314f('0x4')](_0x546fdf,_0xd3cbf);};}exports['register']=function(_0x3fb700){for(var _0x3fe25c=0x0,_0x2971f3=events[_0x314f('0x5')];_0x3fe25c<_0x2971f3;_0x3fe25c++){var _0xb2af8f=events[_0x3fe25c];var _0x27d922=createListener('voiceQueue:'+_0xb2af8f,_0x3fb700);VoiceQueueEvents['on'](_0xb2af8f,_0x27d922);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f604062..80e8523 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 _0x02dc=['./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x27431e,_0x5140c9){var _0x520750=function(_0x3f32ba){while(--_0x3f32ba){_0x27431e['push'](_0x27431e['shift']());}};_0x520750(++_0x5140c9);}(_0x02dc,0xbf));var _0xc02d=function(_0x462eb2,_0x585579){_0x462eb2=_0x462eb2-0x0;var _0x27dcd6=_0x02dc[_0x462eb2];return _0x27dcd6;};'use strict';var multer=require('multer');var util=require(_0xc02d('0x0'));var path=require(_0xc02d('0x1'));var timeout=require(_0xc02d('0x2'));var express=require('express');var router=express[_0xc02d('0x3')]();var fs_extra=require(_0xc02d('0x4'));var auth=require(_0xc02d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc02d('0x6'));var controller=require(_0xc02d('0x7'));router[_0xc02d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc02d('0x9')]);router['get'](_0xc02d('0xa'),auth[_0xc02d('0xb')](),controller[_0xc02d('0xc')]);router['get']('/index',auth[_0xc02d('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xc02d('0xd'),auth[_0xc02d('0xb')](),controller[_0xc02d('0xe')]);router['post']('/',auth[_0xc02d('0xb')](),controller[_0xc02d('0xf')]);router['put'](_0xc02d('0xd'),auth[_0xc02d('0xb')](),controller['update']);router[_0xc02d('0x10')](_0xc02d('0xd'),auth[_0xc02d('0xb')](),controller['destroy']);module[_0xc02d('0x11')]=router; \ No newline at end of file +var _0x94a2=['/:id','show','post','create','put','update','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','isAuthenticated','describe','/index'];(function(_0x78eb4d,_0x45439c){var _0x4d22b2=function(_0x51a17b){while(--_0x51a17b){_0x78eb4d['push'](_0x78eb4d['shift']());}};_0x4d22b2(++_0x45439c);}(_0x94a2,0x111));var _0x294a=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x94a2[_0x432fca];return _0x3adba4;};'use strict';var multer=require('multer');var util=require(_0x294a('0x0'));var path=require(_0x294a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x294a('0x2')]();var fs_extra=require(_0x294a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x294a('0x4'));var config=require(_0x294a('0x5'));var controller=require(_0x294a('0x6'));router[_0x294a('0x7')]('/',auth['isAuthenticated'](),controller[_0x294a('0x8')]);router[_0x294a('0x7')]('/describe',auth[_0x294a('0x9')](),controller[_0x294a('0xa')]);router[_0x294a('0x7')](_0x294a('0xb'),auth[_0x294a('0x9')](),controller['getVoiceQueuesReport']);router[_0x294a('0x7')](_0x294a('0xc'),auth[_0x294a('0x9')](),controller[_0x294a('0xd')]);router[_0x294a('0xe')]('/',auth[_0x294a('0x9')](),controller[_0x294a('0xf')]);router[_0x294a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x294a('0x11')]);router['delete'](_0x294a('0xc'),auth[_0x294a('0x9')](),controller[_0x294a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ba46b38..6742ace 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 _0x55cb=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55cb,0x1c1));var _0xb55c=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x55cb[_0x1ebc6c];return _0x3a826d;};'use strict';var Sequelize=require(_0xb55c('0x0'));var moment=require(_0xb55c('0x1'));module[_0xb55c('0x2')]={'type':{'type':Sequelize[_0xb55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb55c('0x3')]},'queue':{'type':Sequelize[_0xb55c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xb55c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xb55c('0x4')],'set':function(_0x101087){var _0x340d3f=moment(_0x101087);var _0x4616dc=moment(this['getDataValue'](_0xb55c('0x5')))[_0xb55c('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x182480=_0x340d3f[_0xb55c('0x7')](_0x4616dc,_0xb55c('0x8'));this[_0xb55c('0x9')]('queuecallerleaveAt',_0x101087);this[_0xb55c('0x9')]('holdtime',_0x182480||null);}},'position':{'type':Sequelize[_0xb55c('0xa')]},'count':{'type':Sequelize[_0xb55c('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xb55c('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb55c('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xb55c('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb55c('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb55c('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xb55c('0x3')],'comment':_0xb55c('0xc')},'originalposition':{'type':Sequelize[_0xb55c('0xa')]},'channel':{'type':Sequelize[_0xb55c('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb55c('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb55c('0x3')]},'priority':{'type':Sequelize[_0xb55c('0x3')]},'holdtime':{'type':Sequelize[_0xb55c('0xa')]},'mohtime':{'type':Sequelize[_0xb55c('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb55c('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb55c('0x3')]},'transfer':{'type':Sequelize[_0xb55c('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb55c('0x3')],'comment':_0xb55c('0xd')},'transferexten':{'type':Sequelize[_0xb55c('0x3')]},'transferuniqueid':{'type':Sequelize[_0xb55c('0x3')]},'disposition':{'type':Sequelize[_0xb55c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb55c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb55c('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xb55c('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc05b=['sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3e4cb3,_0x99f949){var _0x2a11b3=function(_0x42fca7){while(--_0x42fca7){_0x3e4cb3['push'](_0x3e4cb3['shift']());}};_0x2a11b3(++_0x99f949);}(_0xc05b,0x186));var _0xbc05=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xc05b[_0x548627];return _0x844a84;};'use strict';var Sequelize=require(_0xbc05('0x0'));var moment=require(_0xbc05('0x1'));module[_0xbc05('0x2')]={'type':{'type':Sequelize[_0xbc05('0x3')]},'uniqueid':{'type':Sequelize[_0xbc05('0x3')]},'calleridnum':{'type':Sequelize[_0xbc05('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbc05('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xbc05('0x4')],'set':function(_0x10aa29){var _0x46f619=moment(_0x10aa29);var _0x1f79e2=moment(this[_0xbc05('0x5')]('queuecallerjoinAt'))['format'](_0xbc05('0x6'));var _0x2d63a9=_0x46f619['diff'](_0x1f79e2,_0xbc05('0x7'));this[_0xbc05('0x8')](_0xbc05('0x9'),_0x10aa29);this[_0xbc05('0x8')](_0xbc05('0xa'),_0x2d63a9||null);}},'position':{'type':Sequelize[_0xbc05('0xb')]},'count':{'type':Sequelize[_0xbc05('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xbc05('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xbc05('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xbc05('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbc05('0x4')]},'queuecallerexit':{'type':Sequelize[_0xbc05('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xbc05('0x3')],'comment':_0xbc05('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xbc05('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbc05('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xbc05('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbc05('0x3')],'comment':_0xbc05('0xe')},'transferexten':{'type':Sequelize[_0xbc05('0x3')]},'transferuniqueid':{'type':Sequelize[_0xbc05('0x3')]},'disposition':{'type':Sequelize[_0xbc05('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbc05('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xbc05('0xb')],'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 30e62ef..362bf53 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 _0x4e9b=['model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','describe','getVoiceQueuesReport','pick','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceQueueReport','rawAttributes','type','key','keys','query','filters','attributes'];(function(_0x160b80,_0xed97e1){var _0x4bc963=function(_0x182215){while(--_0x182215){_0x160b80['push'](_0x160b80['shift']());}};_0x4bc963(++_0xed97e1);}(_0x4e9b,0x112));var _0xb4e9=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x4e9b[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xb4e9('0x0'));var rimraf=require(_0xb4e9('0x1'));var zipdir=require(_0xb4e9('0x2'));var jsonpatch=require(_0xb4e9('0x3'));var rp=require(_0xb4e9('0x4'));var moment=require(_0xb4e9('0x5'));var BPromise=require(_0xb4e9('0x6'));var Mustache=require(_0xb4e9('0x7'));var util=require(_0xb4e9('0x8'));var path=require(_0xb4e9('0x9'));var sox=require(_0xb4e9('0xa'));var csv=require('to-csv');var ejs=require(_0xb4e9('0xb'));var fs=require('fs');var fs_extra=require(_0xb4e9('0xc'));var _=require(_0xb4e9('0xd'));var squel=require('squel');var crypto=require(_0xb4e9('0xe'));var jsforce=require(_0xb4e9('0xf'));var deskjs=require(_0xb4e9('0x10'));var toCsv=require(_0xb4e9('0x11'));var querystring=require(_0xb4e9('0x12'));var Papa=require(_0xb4e9('0x13'));var Redis=require('ioredis');var authService=require(_0xb4e9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb4e9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4e9('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb4e9('0x17'));var licenseUtil=require(_0xb4e9('0x18'));var db=require('../../mysqldb')['db'];config[_0xb4e9('0x19')]=_[_0xb4e9('0x1a')](config[_0xb4e9('0x19')],{'host':_0xb4e9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4e9('0x19')]));require(_0xb4e9('0x1c'))[_0xb4e9('0x1d')](socket);function respondWithStatusCode(_0x41f214,_0x13840a){_0x13840a=_0x13840a||0xcc;return function(_0x45d34e){if(_0x45d34e){return _0x41f214[_0xb4e9('0x1e')](_0x13840a);}return _0x41f214[_0xb4e9('0x1f')](_0x13840a)[_0xb4e9('0x20')]();};}function respondWithResult(_0x247ed1,_0x53df14){_0x53df14=_0x53df14||0xc8;return function(_0x4c8910){if(_0x4c8910){return _0x247ed1['status'](_0x53df14)['json'](_0x4c8910);}};}function respondWithFilteredResult(_0x4b2544,_0x1fc747){return function(_0x49eb5f){if(_0x49eb5f){var _0x2896f1=typeof _0x1fc747['offset']===_0xb4e9('0x21')&&typeof _0x1fc747[_0xb4e9('0x22')]===_0xb4e9('0x21');var _0x35cd07=_0x49eb5f[_0xb4e9('0x23')];var _0x4422b3=_0x2896f1?0x0:_0x1fc747['offset'];var _0x440766=_0x2896f1?_0x49eb5f['count']:_0x1fc747[_0xb4e9('0x24')]+_0x1fc747[_0xb4e9('0x22')];var _0xffaf64;if(_0x440766>=_0x35cd07){_0x440766=_0x35cd07;_0xffaf64=0xc8;}else{_0xffaf64=0xce;}_0x4b2544[_0xb4e9('0x1f')](_0xffaf64);return _0x4b2544[_0xb4e9('0x25')]('Content-Range',_0x4422b3+'-'+_0x440766+'/'+_0x35cd07)[_0xb4e9('0x26')](_0x49eb5f);}return null;};}function patchUpdates(_0x1cc79b){return function(_0x47cfec){try{jsonpatch[_0xb4e9('0x27')](_0x47cfec,_0x1cc79b,!![]);}catch(_0x483eb1){return BPromise[_0xb4e9('0x28')](_0x483eb1);}return _0x47cfec[_0xb4e9('0x29')]();};}function saveUpdates(_0x157da0,_0x3dddaa){return function(_0x26c0cf){if(_0x26c0cf){return _0x26c0cf[_0xb4e9('0x2a')](_0x157da0)['then'](function(_0x42858d){return _0x42858d;});}return null;};}function removeEntity(_0x3512e4,_0x494afc){return function(_0x2906a9){if(_0x2906a9){return _0x2906a9[_0xb4e9('0x2b')]()[_0xb4e9('0x2c')](function(){_0x3512e4[_0xb4e9('0x1f')](0xcc)[_0xb4e9('0x20')]();});}};}function handleEntityNotFound(_0x4e5126,_0x44788f){return function(_0xd3756b){if(!_0xd3756b){_0x4e5126[_0xb4e9('0x1e')](0x194);}return _0xd3756b;};}function handleError(_0x5df813,_0x1a2835){_0x1a2835=_0x1a2835||0x1f4;return function(_0x151873){logger[_0xb4e9('0x2d')](_0x151873[_0xb4e9('0x2e')]);if(_0x151873[_0xb4e9('0x2f')]){delete _0x151873[_0xb4e9('0x2f')];}_0x5df813[_0xb4e9('0x1f')](_0x1a2835)[_0xb4e9('0x30')](_0x151873);};}exports['index']=function(_0x4d993f,_0x16b4bd){var _0x406834={},_0x4f9c07={},_0x50d23c={'count':0x0,'rows':[]};var _0x175196=_[_0xb4e9('0x31')](db[_0xb4e9('0x32')][_0xb4e9('0x33')],function(_0xbc678f){return{'name':_0xbc678f['fieldName'],'type':_0xbc678f[_0xb4e9('0x34')][_0xb4e9('0x35')]};});_0x4f9c07['model']=_[_0xb4e9('0x31')](_0x175196,_0xb4e9('0x2f'));_0x4f9c07['query']=_[_0xb4e9('0x36')](_0x4d993f[_0xb4e9('0x37')]);_0x4f9c07[_0xb4e9('0x38')]=_['intersection'](_0x4f9c07['model'],_0x4f9c07[_0xb4e9('0x37')]);_0x406834[_0xb4e9('0x39')]=_['intersection'](_0x4f9c07[_0xb4e9('0x3a')],qs['fields'](_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x3b')]));_0x406834['attributes']=_0x406834[_0xb4e9('0x39')][_0xb4e9('0x3c')]?_0x406834[_0xb4e9('0x39')]:_0x4f9c07[_0xb4e9('0x3a')];if(!_0x4d993f['query'][_0xb4e9('0x3d')](_0xb4e9('0x3e'))){_0x406834[_0xb4e9('0x22')]=qs[_0xb4e9('0x22')](_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x22')]);_0x406834[_0xb4e9('0x24')]=qs['offset'](_0x4d993f[_0xb4e9('0x37')]['offset']);}_0x406834[_0xb4e9('0x3f')]=qs[_0xb4e9('0x40')](_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x40')]);_0x406834[_0xb4e9('0x41')]=qs[_0xb4e9('0x38')](_['pick'](_0x4d993f[_0xb4e9('0x37')],_0x4f9c07[_0xb4e9('0x38')]),_0x175196);if(_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x42')]){_0x406834[_0xb4e9('0x41')]=_[_0xb4e9('0x43')](_0x406834[_0xb4e9('0x41')],{'$or':_['map'](_0x175196,function(_0x278db8){if(_0x278db8[_0xb4e9('0x34')]!==_0xb4e9('0x44')){var _0x43d368={};_0x43d368[_0x278db8[_0xb4e9('0x2f')]]={'$like':'%'+_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x42')]+'%'};return _0x43d368;}})});}_0x406834=_['merge']({},_0x406834,_0x4d993f['options']);var _0x14156b={'where':_0x406834[_0xb4e9('0x41')]};return db[_0xb4e9('0x32')][_0xb4e9('0x23')](_0x14156b)[_0xb4e9('0x2c')](function(_0x247149){_0x50d23c['count']=_0x247149;if(_0x4d993f[_0xb4e9('0x37')][_0xb4e9('0x45')]){_0x406834[_0xb4e9('0x46')]=[{'all':!![]}];}return db[_0xb4e9('0x32')][_0xb4e9('0x47')](_0x406834);})[_0xb4e9('0x2c')](function(_0x448bca){_0x50d23c[_0xb4e9('0x48')]=_0x448bca;return _0x50d23c;})['then'](respondWithFilteredResult(_0x16b4bd,_0x406834))[_0xb4e9('0x49')](handleError(_0x16b4bd,null));};exports[_0xb4e9('0x4a')]=function(_0x5bb3c6,_0x456703){var _0x54ef39={'raw':![],'where':{'id':_0x5bb3c6[_0xb4e9('0x4b')]['id']}},_0xe076a9={};_0xe076a9[_0xb4e9('0x3a')]=_['keys'](db[_0xb4e9('0x32')]['rawAttributes']);_0xe076a9[_0xb4e9('0x37')]=_['keys'](_0x5bb3c6['query']);_0xe076a9[_0xb4e9('0x38')]=_[_0xb4e9('0x4c')](_0xe076a9[_0xb4e9('0x3a')],_0xe076a9[_0xb4e9('0x37')]);_0x54ef39[_0xb4e9('0x39')]=_[_0xb4e9('0x4c')](_0xe076a9[_0xb4e9('0x3a')],qs[_0xb4e9('0x3b')](_0x5bb3c6[_0xb4e9('0x37')][_0xb4e9('0x3b')]));_0x54ef39['attributes']=_0x54ef39['attributes']['length']?_0x54ef39[_0xb4e9('0x39')]:_0xe076a9['model'];if(_0x5bb3c6['query'][_0xb4e9('0x45')]){_0x54ef39[_0xb4e9('0x46')]=[{'all':!![]}];}_0x54ef39=_[_0xb4e9('0x43')]({},_0x54ef39,_0x5bb3c6['options']);return db['VoiceQueueReport']['find'](_0x54ef39)[_0xb4e9('0x2c')](handleEntityNotFound(_0x456703,null))[_0xb4e9('0x2c')](respondWithResult(_0x456703,null))[_0xb4e9('0x49')](handleError(_0x456703,null));};exports['create']=function(_0x598152,_0x33073f){return db[_0xb4e9('0x32')][_0xb4e9('0x4d')](_0x598152[_0xb4e9('0x4e')],{})[_0xb4e9('0x2c')](respondWithResult(_0x33073f,0xc9))['catch'](handleError(_0x33073f,null));};exports['update']=function(_0x18cc54,_0x5a8ed5){if(_0x18cc54['body']['id']){delete _0x18cc54[_0xb4e9('0x4e')]['id'];}return db[_0xb4e9('0x32')]['find']({'where':{'id':_0x18cc54['params']['id']}})[_0xb4e9('0x2c')](handleEntityNotFound(_0x5a8ed5,null))[_0xb4e9('0x2c')](saveUpdates(_0x18cc54[_0xb4e9('0x4e')],null))['then'](respondWithResult(_0x5a8ed5,null))[_0xb4e9('0x49')](handleError(_0x5a8ed5,null));};exports[_0xb4e9('0x2b')]=function(_0x396df4,_0xd23d31){return db[_0xb4e9('0x32')]['find']({'where':{'id':_0x396df4[_0xb4e9('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd23d31,null))['then'](removeEntity(_0xd23d31,null))[_0xb4e9('0x49')](handleError(_0xd23d31,null));};exports['describe']=function(_0x4cb949,_0x566625){return db[_0xb4e9('0x32')][_0xb4e9('0x4f')]()[_0xb4e9('0x2c')](respondWithResult(_0x566625,null))['catch'](handleError(_0x566625,null));};exports[_0xb4e9('0x50')]=function(_0x167595,_0x1e53a7){var _0x8771f={},_0x21046d={},_0x291dd3={'count':0x0,'rows':[]};_0x21046d[_0xb4e9('0x3a')]=_[_0xb4e9('0x36')](db[_0xb4e9('0x32')]['rawAttributes']);_0x21046d[_0xb4e9('0x37')]=_[_0xb4e9('0x36')](_0x167595[_0xb4e9('0x37')]);_0x21046d[_0xb4e9('0x38')]=_[_0xb4e9('0x4c')](_0x21046d['model'],_0x21046d[_0xb4e9('0x37')]);_0x8771f[_0xb4e9('0x39')]=_[_0xb4e9('0x4c')](_0x21046d[_0xb4e9('0x3a')],qs[_0xb4e9('0x3b')](_0x167595['query'][_0xb4e9('0x3b')]));_0x8771f['attributes']=_0x8771f[_0xb4e9('0x39')][_0xb4e9('0x3c')]?_0x8771f[_0xb4e9('0x39')]:_0x21046d['model'];if(!_0x167595[_0xb4e9('0x37')][_0xb4e9('0x3d')](_0xb4e9('0x3e'))){_0x8771f[_0xb4e9('0x22')]=qs[_0xb4e9('0x22')](_0x167595[_0xb4e9('0x37')]['limit']);_0x8771f['offset']=qs['offset'](_0x167595[_0xb4e9('0x37')]['offset']);}_0x8771f[_0xb4e9('0x3f')]=qs['sort'](_0x167595[_0xb4e9('0x37')]['sort']);_0x8771f['where']=qs[_0xb4e9('0x38')](_[_0xb4e9('0x51')](_0x167595[_0xb4e9('0x37')],_0x21046d[_0xb4e9('0x38')]));if(_0x167595[_0xb4e9('0x37')]['filter']){_0x8771f['where']=_[_0xb4e9('0x43')](_0x8771f['where'],{'$or':_['map'](_0x8771f[_0xb4e9('0x39')],function(_0x5c0120){var _0x367f78={};_0x367f78[_0x5c0120]={'$like':'%'+_0x167595['query'][_0xb4e9('0x42')]+'%'};return _0x367f78;})});}_0x8771f=_[_0xb4e9('0x43')]({},_0x8771f,_0x167595[_0xb4e9('0x52')]);var _0x211ee1={'where':_0x8771f[_0xb4e9('0x41')]};return db['VoiceQueueReport'][_0xb4e9('0x23')](_0x211ee1)['then'](function(_0x158345){_0x291dd3['count']=_0x158345;if(_0x167595['query'][_0xb4e9('0x45')]){_0x8771f['include']=[{'all':!![]}];}return db[_0xb4e9('0x32')]['findAll'](_0x8771f);})[_0xb4e9('0x2c')](function(_0x422308){_0x291dd3[_0xb4e9('0x48')]=_0x422308;return _0x291dd3;})['then'](respondWithFilteredResult(_0x1e53a7,_0x8771f,'getVoiceQueuesReport'))['catch'](handleError(_0x1e53a7,null,_0xb4e9('0x50')));}; \ No newline at end of file +var _0x3a8e=['rawAttributes','options','body','find','getVoiceQueuesReport','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x3a8e,0x14e));var _0xe3a8=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x3a8e[_0x2418e0];return _0x55ffbf;};'use strict';var emlformat=require(_0xe3a8('0x0'));var rimraf=require(_0xe3a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3a8('0x2'));var rp=require(_0xe3a8('0x3'));var moment=require('moment');var BPromise=require(_0xe3a8('0x4'));var Mustache=require(_0xe3a8('0x5'));var util=require(_0xe3a8('0x6'));var path=require(_0xe3a8('0x7'));var sox=require(_0xe3a8('0x8'));var csv=require(_0xe3a8('0x9'));var ejs=require(_0xe3a8('0xa'));var fs=require('fs');var fs_extra=require(_0xe3a8('0xb'));var _=require(_0xe3a8('0xc'));var squel=require(_0xe3a8('0xd'));var crypto=require(_0xe3a8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3a8('0x9'));var querystring=require(_0xe3a8('0xf'));var Papa=require(_0xe3a8('0x10'));var Redis=require(_0xe3a8('0x11'));var authService=require(_0xe3a8('0x12'));var qs=require(_0xe3a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3a8('0x14'));var logger=require(_0xe3a8('0x15'))(_0xe3a8('0x16'));var utils=require(_0xe3a8('0x17'));var config=require(_0xe3a8('0x18'));var licenseUtil=require(_0xe3a8('0x19'));var db=require(_0xe3a8('0x1a'))['db'];config[_0xe3a8('0x1b')]=_[_0xe3a8('0x1c')](config[_0xe3a8('0x1b')],{'host':_0xe3a8('0x1d'),'port':0x18eb});var socket=require(_0xe3a8('0x1e'))(new Redis(config[_0xe3a8('0x1b')]));require(_0xe3a8('0x1f'))['register'](socket);function respondWithStatusCode(_0x47ab13,_0x1f6b71){_0x1f6b71=_0x1f6b71||0xcc;return function(_0x51d7aa){if(_0x51d7aa){return _0x47ab13[_0xe3a8('0x20')](_0x1f6b71);}return _0x47ab13['status'](_0x1f6b71)['end']();};}function respondWithResult(_0x1784df,_0x1047a7){_0x1047a7=_0x1047a7||0xc8;return function(_0x2788c6){if(_0x2788c6){return _0x1784df[_0xe3a8('0x21')](_0x1047a7)['json'](_0x2788c6);}};}function respondWithFilteredResult(_0x2aa003,_0x35e5ec){return function(_0x163f8d){if(_0x163f8d){var _0x49cd72=typeof _0x35e5ec[_0xe3a8('0x22')]===_0xe3a8('0x23')&&typeof _0x35e5ec[_0xe3a8('0x24')]===_0xe3a8('0x23');var _0x3f2c8d=_0x163f8d['count'];var _0xbfa560=_0x49cd72?0x0:_0x35e5ec[_0xe3a8('0x22')];var _0xcbec53=_0x49cd72?_0x163f8d[_0xe3a8('0x25')]:_0x35e5ec[_0xe3a8('0x22')]+_0x35e5ec['limit'];var _0x20e432;if(_0xcbec53>=_0x3f2c8d){_0xcbec53=_0x3f2c8d;_0x20e432=0xc8;}else{_0x20e432=0xce;}_0x2aa003['status'](_0x20e432);return _0x2aa003[_0xe3a8('0x26')]('Content-Range',_0xbfa560+'-'+_0xcbec53+'/'+_0x3f2c8d)[_0xe3a8('0x27')](_0x163f8d);}return null;};}function patchUpdates(_0x24b0d7){return function(_0x1c00de){try{jsonpatch[_0xe3a8('0x28')](_0x1c00de,_0x24b0d7,!![]);}catch(_0x7852a8){return BPromise[_0xe3a8('0x29')](_0x7852a8);}return _0x1c00de[_0xe3a8('0x2a')]();};}function saveUpdates(_0x43afa6,_0x595057){return function(_0x4e302a){if(_0x4e302a){return _0x4e302a[_0xe3a8('0x2b')](_0x43afa6)[_0xe3a8('0x2c')](function(_0x153d74){return _0x153d74;});}return null;};}function removeEntity(_0x7fff4a,_0x219ae8){return function(_0x5b9b31){if(_0x5b9b31){return _0x5b9b31[_0xe3a8('0x2d')]()[_0xe3a8('0x2c')](function(){_0x7fff4a[_0xe3a8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462c45,_0x35a5c4){return function(_0x53f930){if(!_0x53f930){_0x462c45[_0xe3a8('0x20')](0x194);}return _0x53f930;};}function handleError(_0x30c229,_0x3f7caf){_0x3f7caf=_0x3f7caf||0x1f4;return function(_0x396d0a){logger['error'](_0x396d0a[_0xe3a8('0x2e')]);if(_0x396d0a[_0xe3a8('0x2f')]){delete _0x396d0a['name'];}_0x30c229[_0xe3a8('0x21')](_0x3f7caf)['send'](_0x396d0a);};}exports[_0xe3a8('0x30')]=function(_0x5b7c94,_0x5cb403){var _0x3f4443={},_0x46ba60={},_0x1eb02a={'count':0x0,'rows':[]};var _0x44c01b=_[_0xe3a8('0x31')](db[_0xe3a8('0x32')]['rawAttributes'],function(_0x5b4244){return{'name':_0x5b4244[_0xe3a8('0x33')],'type':_0x5b4244[_0xe3a8('0x34')]['key']};});_0x46ba60[_0xe3a8('0x35')]=_[_0xe3a8('0x31')](_0x44c01b,_0xe3a8('0x2f'));_0x46ba60[_0xe3a8('0x36')]=_[_0xe3a8('0x37')](_0x5b7c94[_0xe3a8('0x36')]);_0x46ba60[_0xe3a8('0x38')]=_[_0xe3a8('0x39')](_0x46ba60[_0xe3a8('0x35')],_0x46ba60[_0xe3a8('0x36')]);_0x3f4443[_0xe3a8('0x3a')]=_['intersection'](_0x46ba60['model'],qs['fields'](_0x5b7c94[_0xe3a8('0x36')][_0xe3a8('0x3b')]));_0x3f4443[_0xe3a8('0x3a')]=_0x3f4443[_0xe3a8('0x3a')][_0xe3a8('0x3c')]?_0x3f4443[_0xe3a8('0x3a')]:_0x46ba60[_0xe3a8('0x35')];if(!_0x5b7c94[_0xe3a8('0x36')][_0xe3a8('0x3d')](_0xe3a8('0x3e'))){_0x3f4443[_0xe3a8('0x24')]=qs[_0xe3a8('0x24')](_0x5b7c94['query'][_0xe3a8('0x24')]);_0x3f4443[_0xe3a8('0x22')]=qs[_0xe3a8('0x22')](_0x5b7c94[_0xe3a8('0x36')][_0xe3a8('0x22')]);}_0x3f4443[_0xe3a8('0x3f')]=qs['sort'](_0x5b7c94[_0xe3a8('0x36')][_0xe3a8('0x40')]);_0x3f4443[_0xe3a8('0x41')]=qs['filters'](_['pick'](_0x5b7c94[_0xe3a8('0x36')],_0x46ba60['filters']),_0x44c01b);if(_0x5b7c94[_0xe3a8('0x36')][_0xe3a8('0x42')]){_0x3f4443[_0xe3a8('0x41')]=_[_0xe3a8('0x43')](_0x3f4443[_0xe3a8('0x41')],{'$or':_[_0xe3a8('0x31')](_0x44c01b,function(_0x364833){if(_0x364833[_0xe3a8('0x34')]!==_0xe3a8('0x44')){var _0x3a3d27={};_0x3a3d27[_0x364833[_0xe3a8('0x2f')]]={'$like':'%'+_0x5b7c94['query'][_0xe3a8('0x42')]+'%'};return _0x3a3d27;}})});}_0x3f4443=_[_0xe3a8('0x43')]({},_0x3f4443,_0x5b7c94['options']);var _0x516d1c={'where':_0x3f4443['where']};return db[_0xe3a8('0x32')]['count'](_0x516d1c)[_0xe3a8('0x2c')](function(_0x4a28d5){_0x1eb02a[_0xe3a8('0x25')]=_0x4a28d5;if(_0x5b7c94['query'][_0xe3a8('0x45')]){_0x3f4443[_0xe3a8('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe3a8('0x47')](_0x3f4443);})[_0xe3a8('0x2c')](function(_0x578dcd){_0x1eb02a[_0xe3a8('0x48')]=_0x578dcd;return _0x1eb02a;})[_0xe3a8('0x2c')](respondWithFilteredResult(_0x5cb403,_0x3f4443))[_0xe3a8('0x49')](handleError(_0x5cb403,null));};exports[_0xe3a8('0x4a')]=function(_0x39540f,_0x5a5a7e){var _0x5377d5={'raw':![],'where':{'id':_0x39540f[_0xe3a8('0x4b')]['id']}},_0x8fb69e={};_0x8fb69e[_0xe3a8('0x35')]=_[_0xe3a8('0x37')](db[_0xe3a8('0x32')][_0xe3a8('0x4c')]);_0x8fb69e['query']=_[_0xe3a8('0x37')](_0x39540f[_0xe3a8('0x36')]);_0x8fb69e[_0xe3a8('0x38')]=_['intersection'](_0x8fb69e[_0xe3a8('0x35')],_0x8fb69e[_0xe3a8('0x36')]);_0x5377d5[_0xe3a8('0x3a')]=_[_0xe3a8('0x39')](_0x8fb69e[_0xe3a8('0x35')],qs[_0xe3a8('0x3b')](_0x39540f[_0xe3a8('0x36')][_0xe3a8('0x3b')]));_0x5377d5[_0xe3a8('0x3a')]=_0x5377d5['attributes'][_0xe3a8('0x3c')]?_0x5377d5[_0xe3a8('0x3a')]:_0x8fb69e[_0xe3a8('0x35')];if(_0x39540f[_0xe3a8('0x36')][_0xe3a8('0x45')]){_0x5377d5[_0xe3a8('0x46')]=[{'all':!![]}];}_0x5377d5=_[_0xe3a8('0x43')]({},_0x5377d5,_0x39540f[_0xe3a8('0x4d')]);return db[_0xe3a8('0x32')]['find'](_0x5377d5)[_0xe3a8('0x2c')](handleEntityNotFound(_0x5a5a7e,null))[_0xe3a8('0x2c')](respondWithResult(_0x5a5a7e,null))[_0xe3a8('0x49')](handleError(_0x5a5a7e,null));};exports['create']=function(_0x2656bf,_0x50513f){return db[_0xe3a8('0x32')]['create'](_0x2656bf[_0xe3a8('0x4e')],{})['then'](respondWithResult(_0x50513f,0xc9))['catch'](handleError(_0x50513f,null));};exports[_0xe3a8('0x2b')]=function(_0x5c6077,_0x36f58e){if(_0x5c6077[_0xe3a8('0x4e')]['id']){delete _0x5c6077[_0xe3a8('0x4e')]['id'];}return db[_0xe3a8('0x32')][_0xe3a8('0x4f')]({'where':{'id':_0x5c6077[_0xe3a8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36f58e,null))[_0xe3a8('0x2c')](saveUpdates(_0x5c6077[_0xe3a8('0x4e')],null))[_0xe3a8('0x2c')](respondWithResult(_0x36f58e,null))[_0xe3a8('0x49')](handleError(_0x36f58e,null));};exports[_0xe3a8('0x2d')]=function(_0xdd8200,_0x42e55e){return db[_0xe3a8('0x32')][_0xe3a8('0x4f')]({'where':{'id':_0xdd8200[_0xe3a8('0x4b')]['id']}})[_0xe3a8('0x2c')](handleEntityNotFound(_0x42e55e,null))[_0xe3a8('0x2c')](removeEntity(_0x42e55e,null))['catch'](handleError(_0x42e55e,null));};exports['describe']=function(_0x490813,_0x2fad2e){return db[_0xe3a8('0x32')]['describe']()['then'](respondWithResult(_0x2fad2e,null))['catch'](handleError(_0x2fad2e,null));};exports[_0xe3a8('0x50')]=function(_0x369998,_0x108813){var _0x20192b={},_0x4002f8={},_0x5dd9b8={'count':0x0,'rows':[]};_0x4002f8[_0xe3a8('0x35')]=_[_0xe3a8('0x37')](db[_0xe3a8('0x32')][_0xe3a8('0x4c')]);_0x4002f8[_0xe3a8('0x36')]=_['keys'](_0x369998[_0xe3a8('0x36')]);_0x4002f8[_0xe3a8('0x38')]=_[_0xe3a8('0x39')](_0x4002f8[_0xe3a8('0x35')],_0x4002f8[_0xe3a8('0x36')]);_0x20192b[_0xe3a8('0x3a')]=_[_0xe3a8('0x39')](_0x4002f8[_0xe3a8('0x35')],qs[_0xe3a8('0x3b')](_0x369998['query']['fields']));_0x20192b['attributes']=_0x20192b['attributes'][_0xe3a8('0x3c')]?_0x20192b[_0xe3a8('0x3a')]:_0x4002f8['model'];if(!_0x369998['query'][_0xe3a8('0x3d')](_0xe3a8('0x3e'))){_0x20192b[_0xe3a8('0x24')]=qs[_0xe3a8('0x24')](_0x369998[_0xe3a8('0x36')][_0xe3a8('0x24')]);_0x20192b[_0xe3a8('0x22')]=qs[_0xe3a8('0x22')](_0x369998['query'][_0xe3a8('0x22')]);}_0x20192b[_0xe3a8('0x3f')]=qs[_0xe3a8('0x40')](_0x369998[_0xe3a8('0x36')]['sort']);_0x20192b[_0xe3a8('0x41')]=qs[_0xe3a8('0x38')](_[_0xe3a8('0x51')](_0x369998[_0xe3a8('0x36')],_0x4002f8[_0xe3a8('0x38')]));if(_0x369998[_0xe3a8('0x36')][_0xe3a8('0x42')]){_0x20192b['where']=_[_0xe3a8('0x43')](_0x20192b[_0xe3a8('0x41')],{'$or':_[_0xe3a8('0x31')](_0x20192b[_0xe3a8('0x3a')],function(_0x3896f0){var _0x1c69e1={};_0x1c69e1[_0x3896f0]={'$like':'%'+_0x369998[_0xe3a8('0x36')][_0xe3a8('0x42')]+'%'};return _0x1c69e1;})});}_0x20192b=_['merge']({},_0x20192b,_0x369998[_0xe3a8('0x4d')]);var _0x5832dd={'where':_0x20192b[_0xe3a8('0x41')]};return db[_0xe3a8('0x32')]['count'](_0x5832dd)[_0xe3a8('0x2c')](function(_0x19faa2){_0x5dd9b8[_0xe3a8('0x25')]=_0x19faa2;if(_0x369998[_0xe3a8('0x36')]['includeAll']){_0x20192b[_0xe3a8('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x20192b);})[_0xe3a8('0x2c')](function(_0x37eb3c){_0x5dd9b8[_0xe3a8('0x48')]=_0x37eb3c;return _0x5dd9b8;})['then'](respondWithFilteredResult(_0x108813,_0x20192b,_0xe3a8('0x50')))[_0xe3a8('0x49')](handleError(_0x108813,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3aaa441..91f7859 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 _0x46fd=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x46fd,0x18f));var _0xd46f=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46fd[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0xd46f('0x0'));var VoiceQueueReport=require(_0xd46f('0x1'))['db'][_0xd46f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd46f('0x3')](0x0);var events={'afterCreate':_0xd46f('0x4'),'afterUpdate':'update','afterDestroy':_0xd46f('0x5')};function emitEvent(_0x2c2cf1){return function(_0x270739,_0x54952f,_0x510d26){VoiceQueueReportEvents['emit'](_0x2c2cf1+':'+_0x270739['id'],_0x270739);VoiceQueueReportEvents[_0xd46f('0x6')](_0x2c2cf1,_0x270739);_0x510d26(null);};}for(var e in events){if(events[_0xd46f('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd46f('0x8')](e,emitEvent(event));}}module[_0xd46f('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x169e=['update','emit','hasOwnProperty','hook','events','VoiceQueueReport','setMaxListeners'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x169e,0xc8));var _0xe169=function(_0x413779,_0x175f48){_0x413779=_0x413779-0x0;var _0x5ef412=_0x169e[_0x413779];return _0x5ef412;};'use strict';var EventEmitter=require(_0xe169('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xe169('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe169('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe169('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e8cc4){return function(_0x7d473f,_0x4b39c9,_0x50b26c){VoiceQueueReportEvents[_0xe169('0x4')](_0x3e8cc4+':'+_0x7d473f['id'],_0x7d473f);VoiceQueueReportEvents['emit'](_0x3e8cc4,_0x7d473f);_0x50b26c(null);};}for(var e in events){if(events[_0xe169('0x5')](e)){var event=events[e];VoiceQueueReport[_0xe169('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3a190ce..f2e0283 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 _0x913f=['calleridnum','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','define','VoiceQueueReport','uniqueid'];(function(_0x240b87,_0x4a85a2){var _0x1ffb1e=function(_0x4542e2){while(--_0x4542e2){_0x240b87['push'](_0x240b87['shift']());}};_0x1ffb1e(++_0x4a85a2);}(_0x913f,0xbc));var _0xf913=function(_0x3a0af1,_0x55d915){_0x3a0af1=_0x3a0af1-0x0;var _0x229aa1=_0x913f[_0x3a0af1];return _0x229aa1;};'use strict';var _=require(_0xf913('0x0'));var util=require('util');var logger=require(_0xf913('0x1'))(_0xf913('0x2'));var moment=require(_0xf913('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf913('0x4'));var rimraf=require(_0xf913('0x5'));var config=require(_0xf913('0x6'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x1c3735,_0x108758){return _0x1c3735[_0xf913('0x7')](_0xf913('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf913('0x9')]},{'fields':[_0xf913('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf598=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xf598,0x134));var _0x8f59=function(_0x266732,_0xc6244e){_0x266732=_0x266732-0x0;var _0x55c017=_0xf598[_0x266732];return _0x55c017;};'use strict';var _=require(_0x8f59('0x0'));var util=require(_0x8f59('0x1'));var logger=require('../../config/logger')(_0x8f59('0x2'));var moment=require('moment');var BPromise=require(_0x8f59('0x3'));var rp=require(_0x8f59('0x4'));var fs=require('fs');var path=require(_0x8f59('0x5'));var rimraf=require(_0x8f59('0x6'));var config=require(_0x8f59('0x7'));var attributes=require(_0x8f59('0x8'));module[_0x8f59('0x9')]=function(_0x3ad4e2,_0x1f7900){return _0x3ad4e2['define'](_0x8f59('0xa'),attributes,{'tableName':_0x8f59('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8f59('0xc')]},{'fields':[_0x8f59('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1922475..6066d59 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 _0xae99=['attributes','limit','include','map','model','debug','catch','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xae99,0x113));var _0x9ae9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xae99[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9ae9('0x0'));var util=require('util');var moment=require(_0x9ae9('0x1'));var BPromise=require(_0x9ae9('0x2'));var rs=require(_0x9ae9('0x3'));var fs=require('fs');var Redis=require(_0x9ae9('0x4'));var db=require(_0x9ae9('0x5'))['db'];var utils=require(_0x9ae9('0x6'));var logger=require('../../config/logger')(_0x9ae9('0x7'));var config=require(_0x9ae9('0x8'));var jayson=require(_0x9ae9('0x9'));var client=jayson[_0x9ae9('0xa')][_0x9ae9('0xb')]({'port':0x232a});config[_0x9ae9('0xc')]=_[_0x9ae9('0xd')](config[_0x9ae9('0xc')],{'host':_0x9ae9('0xe'),'port':0x18eb});var socket=require(_0x9ae9('0xf'))(new Redis(config[_0x9ae9('0xc')]));require(_0x9ae9('0x10'))[_0x9ae9('0x11')](socket);function respondWithRpcPromise(_0x11af05,_0x130c9c,_0x20de44){return new BPromise(function(_0x3c8df3,_0x62e465){return client['request'](_0x11af05,_0x20de44)[_0x9ae9('0x12')](function(_0xa45929){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x130c9c,_0x9ae9('0x13'));logger['debug'](_0x9ae9('0x14'),_0x130c9c,_0x9ae9('0x13'),JSON[_0x9ae9('0x15')](_0xa45929));if(_0xa45929[_0x9ae9('0x16')]){if(_0xa45929[_0x9ae9('0x16')][_0x9ae9('0x17')]===0x1f4){logger['error'](_0x9ae9('0x18'),_0x130c9c,_0xa45929['error'][_0x9ae9('0x19')]);return _0x62e465(_0xa45929[_0x9ae9('0x16')][_0x9ae9('0x19')]);}logger[_0x9ae9('0x16')](_0x9ae9('0x18'),_0x130c9c,_0xa45929[_0x9ae9('0x16')][_0x9ae9('0x19')]);return _0x3c8df3(_0xa45929[_0x9ae9('0x16')][_0x9ae9('0x19')]);}else{logger[_0x9ae9('0x1a')](_0x9ae9('0x18'),_0x130c9c,_0x9ae9('0x13'));_0x3c8df3(_0xa45929[_0x9ae9('0x1b')][_0x9ae9('0x19')]);}})['catch'](function(_0x392089){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x130c9c,_0x392089);_0x62e465(_0x392089);});});}exports[_0x9ae9('0x1c')]=function(_0x2929af){var _0x100748=this;return new Promise(function(_0x1096d2,_0x5d9dd4){return db[_0x9ae9('0x1d')][_0x9ae9('0x1e')]({'raw':_0x2929af[_0x9ae9('0x1f')]?_0x2929af['options'][_0x9ae9('0x20')]===undefined?!![]:![]:!![],'where':_0x2929af[_0x9ae9('0x1f')]?_0x2929af[_0x9ae9('0x1f')]['where']||null:null,'attributes':_0x2929af[_0x9ae9('0x1f')]?_0x2929af[_0x9ae9('0x1f')][_0x9ae9('0x21')]||null:null,'limit':_0x2929af[_0x9ae9('0x1f')]?_0x2929af[_0x9ae9('0x1f')][_0x9ae9('0x22')]||null:null,'include':_0x2929af[_0x9ae9('0x1f')]?_0x2929af[_0x9ae9('0x1f')][_0x9ae9('0x23')]?_[_0x9ae9('0x24')](_0x2929af[_0x9ae9('0x1f')][_0x9ae9('0x23')],function(_0x32e107){return{'model':db[_0x32e107['model']],'as':_0x32e107['as'],'attributes':_0x32e107[_0x9ae9('0x21')],'include':_0x32e107[_0x9ae9('0x23')]?_['map'](_0x32e107['include'],function(_0x54c1b5){return{'model':db[_0x54c1b5[_0x9ae9('0x25')]],'as':_0x54c1b5['as'],'attributes':_0x54c1b5[_0x9ae9('0x21')],'include':_0x54c1b5[_0x9ae9('0x23')]?_[_0x9ae9('0x24')](_0x54c1b5[_0x9ae9('0x23')],function(_0x515f4b){return{'model':db[_0x515f4b['model']],'as':_0x515f4b['as'],'attributes':_0x515f4b[_0x9ae9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21d7bf){logger['info'](_0x9ae9('0x1c'),_0x2929af);logger[_0x9ae9('0x26')](_0x9ae9('0x1c'),_0x2929af,JSON['stringify'](_0x21d7bf));_0x1096d2(_0x21d7bf);})[_0x9ae9('0x27')](function(_0x5ed35e){logger[_0x9ae9('0x16')](_0x9ae9('0x1c'),_0x5ed35e[_0x9ae9('0x19')],_0x2929af);_0x5d9dd4(_0x100748[_0x9ae9('0x16')](0x1f4,_0x5ed35e[_0x9ae9('0x19')]));});});};exports[_0x9ae9('0x28')]=function(_0x327895){var _0x563ce9=this;return new Promise(function(_0xab56c1,_0x186cb3){return db[_0x9ae9('0x1d')]['create'](_0x327895[_0x9ae9('0x29')],{'raw':_0x327895[_0x9ae9('0x1f')]?_0x327895[_0x9ae9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x9ae9('0x12')](function(_0x4f9fdf){logger[_0x9ae9('0x1a')](_0x9ae9('0x28'),_0x327895);logger[_0x9ae9('0x26')]('CreateVoiceQueueReport',_0x327895,JSON[_0x9ae9('0x15')](_0x4f9fdf));_0xab56c1(_0x4f9fdf);})[_0x9ae9('0x27')](function(_0x5e5aa6){logger[_0x9ae9('0x16')](_0x9ae9('0x28'),_0x5e5aa6[_0x9ae9('0x19')],_0x327895);_0x186cb3(_0x563ce9['error'](0x1f4,_0x5e5aa6[_0x9ae9('0x19')]));});});};exports[_0x9ae9('0x2a')]=function(_0x509f53){var _0x39fdc1=this;return new Promise(function(_0xdf8975,_0x5869e6){return db[_0x9ae9('0x1d')]['update'](_0x509f53[_0x9ae9('0x29')],{'raw':_0x509f53[_0x9ae9('0x1f')]?_0x509f53[_0x9ae9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509f53[_0x9ae9('0x1f')]?_0x509f53['options'][_0x9ae9('0x2b')]||null:null,'attributes':_0x509f53[_0x9ae9('0x1f')]?_0x509f53[_0x9ae9('0x1f')][_0x9ae9('0x21')]||null:null,'limit':_0x509f53['options']?_0x509f53[_0x9ae9('0x1f')][_0x9ae9('0x22')]||null:null})[_0x9ae9('0x12')](function(_0x603522){logger[_0x9ae9('0x1a')]('UpdateVoiceQueueReport',_0x509f53);logger[_0x9ae9('0x26')](_0x9ae9('0x2a'),_0x509f53,JSON[_0x9ae9('0x15')](_0x603522));_0xdf8975(_0x603522);})['catch'](function(_0x3ac8d5){logger[_0x9ae9('0x16')](_0x9ae9('0x2a'),_0x3ac8d5[_0x9ae9('0x19')],_0x509f53);_0x5869e6(_0x39fdc1[_0x9ae9('0x16')](0x1f4,_0x3ac8d5['message']));});});}; \ No newline at end of file +var _0x666c=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','debug','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','VoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x666c,0xd3));var _0xc666=function(_0x377b59,_0x1f167d){_0x377b59=_0x377b59-0x0;var _0x2cae54=_0x666c[_0x377b59];return _0x2cae54;};'use strict';var _=require(_0xc666('0x0'));var util=require(_0xc666('0x1'));var moment=require(_0xc666('0x2'));var BPromise=require(_0xc666('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc666('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc666('0x5'));var logger=require(_0xc666('0x6'))(_0xc666('0x7'));var config=require(_0xc666('0x8'));var jayson=require(_0xc666('0x9'));var client=jayson['client'][_0xc666('0xa')]({'port':0x232a});config[_0xc666('0xb')]=_[_0xc666('0xc')](config[_0xc666('0xb')],{'host':_0xc666('0xd'),'port':0x18eb});var socket=require(_0xc666('0xe'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc666('0xf')](socket);function respondWithRpcPromise(_0x5d55c7,_0x33248f,_0x20dec0){return new BPromise(function(_0x3c618f,_0x1df1ca){return client[_0xc666('0x10')](_0x5d55c7,_0x20dec0)[_0xc666('0x11')](function(_0x22db99){logger[_0xc666('0x12')](_0xc666('0x13'),_0x33248f,_0xc666('0x14'));logger['debug'](_0xc666('0x15'),_0x33248f,'request\x20sent',JSON[_0xc666('0x16')](_0x22db99));if(_0x22db99[_0xc666('0x17')]){if(_0x22db99[_0xc666('0x17')][_0xc666('0x18')]===0x1f4){logger[_0xc666('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x33248f,_0x22db99[_0xc666('0x17')][_0xc666('0x19')]);return _0x1df1ca(_0x22db99['error'][_0xc666('0x19')]);}logger[_0xc666('0x17')](_0xc666('0x13'),_0x33248f,_0x22db99[_0xc666('0x17')][_0xc666('0x19')]);return _0x3c618f(_0x22db99[_0xc666('0x17')][_0xc666('0x19')]);}else{logger['info'](_0xc666('0x13'),_0x33248f,'request\x20sent');_0x3c618f(_0x22db99[_0xc666('0x1a')]['message']);}})[_0xc666('0x1b')](function(_0x250713){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x33248f,_0x250713);_0x1df1ca(_0x250713);});});}exports[_0xc666('0x1c')]=function(_0x1008cd){var _0x5da518=this;return new Promise(function(_0x4009ef,_0x28ecfa){return db['VoiceQueueReport'][_0xc666('0x1d')]({'raw':_0x1008cd[_0xc666('0x1e')]?_0x1008cd['options'][_0xc666('0x1f')]===undefined?!![]:![]:!![],'where':_0x1008cd[_0xc666('0x1e')]?_0x1008cd[_0xc666('0x1e')][_0xc666('0x20')]||null:null,'attributes':_0x1008cd['options']?_0x1008cd[_0xc666('0x1e')][_0xc666('0x21')]||null:null,'limit':_0x1008cd['options']?_0x1008cd['options'][_0xc666('0x22')]||null:null,'include':_0x1008cd[_0xc666('0x1e')]?_0x1008cd[_0xc666('0x1e')]['include']?_[_0xc666('0x23')](_0x1008cd['options'][_0xc666('0x24')],function(_0x12f57f){return{'model':db[_0x12f57f[_0xc666('0x25')]],'as':_0x12f57f['as'],'attributes':_0x12f57f[_0xc666('0x21')],'include':_0x12f57f[_0xc666('0x24')]?_[_0xc666('0x23')](_0x12f57f[_0xc666('0x24')],function(_0x1a0643){return{'model':db[_0x1a0643['model']],'as':_0x1a0643['as'],'attributes':_0x1a0643[_0xc666('0x21')],'include':_0x1a0643[_0xc666('0x24')]?_[_0xc666('0x23')](_0x1a0643['include'],function(_0x1077ff){return{'model':db[_0x1077ff[_0xc666('0x25')]],'as':_0x1077ff['as'],'attributes':_0x1077ff[_0xc666('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13b608){logger[_0xc666('0x12')]('GetVoiceQueueReport',_0x1008cd);logger[_0xc666('0x26')](_0xc666('0x1c'),_0x1008cd,JSON[_0xc666('0x16')](_0x13b608));_0x4009ef(_0x13b608);})[_0xc666('0x1b')](function(_0x316f35){logger[_0xc666('0x17')](_0xc666('0x1c'),_0x316f35[_0xc666('0x19')],_0x1008cd);_0x28ecfa(_0x5da518['error'](0x1f4,_0x316f35[_0xc666('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x5105f1){var _0x309963=this;return new Promise(function(_0x349423,_0x218486){return db['VoiceQueueReport']['create'](_0x5105f1[_0xc666('0x27')],{'raw':_0x5105f1['options']?_0x5105f1['options'][_0xc666('0x1f')]===undefined?!![]:![]:!![]})[_0xc666('0x11')](function(_0x2a91bc){logger[_0xc666('0x12')](_0xc666('0x28'),_0x5105f1);logger[_0xc666('0x26')](_0xc666('0x28'),_0x5105f1,JSON[_0xc666('0x16')](_0x2a91bc));_0x349423(_0x2a91bc);})[_0xc666('0x1b')](function(_0x410a48){logger[_0xc666('0x17')]('CreateVoiceQueueReport',_0x410a48[_0xc666('0x19')],_0x5105f1);_0x218486(_0x309963[_0xc666('0x17')](0x1f4,_0x410a48[_0xc666('0x19')]));});});};exports[_0xc666('0x29')]=function(_0xa417a7){var _0x4179bd=this;return new Promise(function(_0x4cdc6d,_0x25304d){return db[_0xc666('0x2a')][_0xc666('0x2b')](_0xa417a7[_0xc666('0x27')],{'raw':_0xa417a7[_0xc666('0x1e')]?_0xa417a7[_0xc666('0x1e')][_0xc666('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa417a7['options']?_0xa417a7['options']['where']||null:null,'attributes':_0xa417a7[_0xc666('0x1e')]?_0xa417a7[_0xc666('0x1e')][_0xc666('0x21')]||null:null,'limit':_0xa417a7[_0xc666('0x1e')]?_0xa417a7[_0xc666('0x1e')]['limit']||null:null})[_0xc666('0x11')](function(_0xc0293c){logger[_0xc666('0x12')](_0xc666('0x29'),_0xa417a7);logger[_0xc666('0x26')](_0xc666('0x29'),_0xa417a7,JSON['stringify'](_0xc0293c));_0x4cdc6d(_0xc0293c);})[_0xc666('0x1b')](function(_0x55313b){logger['error'](_0xc666('0x29'),_0x55313b[_0xc666('0x19')],_0xa417a7);_0x25304d(_0x4179bd[_0xc666('0x17')](0x1f4,_0x55313b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7c4d8eb..508ab43 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 _0x7dbc=['update','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7dbc,0xe2));var _0xc7db=function(_0x35447b,_0x3d6e36){_0x35447b=_0x35447b-0x0;var _0x314fbb=_0x7dbc[_0x35447b];return _0x314fbb;};'use strict';var VoiceQueueReportEvents=require(_0xc7db('0x0'));var events=[_0xc7db('0x1'),'remove',_0xc7db('0x2')];function createListener(_0x454e70,_0xd6b569){return function(_0x4c6402){_0xd6b569[_0xc7db('0x3')](_0x454e70,_0x4c6402);};}function removeListener(_0x29bda9,_0x1ea8cb){return function(){VoiceQueueReportEvents[_0xc7db('0x4')](_0x29bda9,_0x1ea8cb);};}exports['register']=function(_0x4ee443){for(var _0x1aef6b=0x0,_0x256ea6=events['length'];_0x1aef6b<_0x256ea6;_0x1aef6b++){var _0x51dd2c=events[_0x1aef6b];var _0x9eff32=createListener(_0xc7db('0x5')+_0x51dd2c,_0x4ee443);VoiceQueueReportEvents['on'](_0x51dd2c,_0x9eff32);}}; \ No newline at end of file +var _0x3051=['voiceQueueReport:','update','emit','removeListener','register','length'];(function(_0x9ba7f0,_0x362542){var _0x14056b=function(_0xe7ba5c){while(--_0xe7ba5c){_0x9ba7f0['push'](_0x9ba7f0['shift']());}};_0x14056b(++_0x362542);}(_0x3051,0x85));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x1305('0x0')];function createListener(_0x3cf7b7,_0x129d3e){return function(_0x436d97){_0x129d3e[_0x1305('0x1')](_0x3cf7b7,_0x436d97);};}function removeListener(_0x535fb7,_0x1fcf8f){return function(){VoiceQueueReportEvents[_0x1305('0x2')](_0x535fb7,_0x1fcf8f);};}exports[_0x1305('0x3')]=function(_0x88ee5b){for(var _0x42ba46=0x0,_0xdf301d=events[_0x1305('0x4')];_0x42ba46<_0xdf301d;_0x42ba46++){var _0x389525=events[_0x42ba46];var _0x30cbd8=createListener(_0x1305('0x5')+_0x389525,_0x88ee5b);VoiceQueueReportEvents['on'](_0x389525,_0x30cbd8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e7ebe91..e9a5863 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 _0xf3c5=['get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x42ceee,_0x45bd20){var _0x300d8d=function(_0x2894e1){while(--_0x2894e1){_0x42ceee['push'](_0x42ceee['shift']());}};_0x300d8d(++_0x45bd20);}(_0xf3c5,0x187));var _0x5f3c=function(_0x57166e,_0x4648bc){_0x57166e=_0x57166e-0x0;var _0x3379ea=_0xf3c5[_0x57166e];return _0x3379ea;};'use strict';var multer=require(_0x5f3c('0x0'));var util=require(_0x5f3c('0x1'));var path=require(_0x5f3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f3c('0x3'));var router=express['Router']();var fs_extra=require(_0x5f3c('0x4'));var auth=require(_0x5f3c('0x5'));var interaction=require(_0x5f3c('0x6'));var config=require('../../config/environment');var controller=require(_0x5f3c('0x7'));router[_0x5f3c('0x8')]('/',auth[_0x5f3c('0x9')](),controller[_0x5f3c('0xa')]);router[_0x5f3c('0x8')]('/:id',auth[_0x5f3c('0x9')](),controller[_0x5f3c('0xb')]);router[_0x5f3c('0xc')]('/',auth[_0x5f3c('0x9')](),controller[_0x5f3c('0xd')]);router[_0x5f3c('0xe')]('/:id',auth[_0x5f3c('0x9')](),controller[_0x5f3c('0xf')]);router[_0x5f3c('0x10')](_0x5f3c('0x11'),auth[_0x5f3c('0x9')](),controller[_0x5f3c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3e68=['put','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x3e68,0x190));var _0x83e6=function(_0xd137fe,_0x3b4611){_0xd137fe=_0xd137fe-0x0;var _0x2f6995=_0x3e68[_0xd137fe];return _0x2f6995;};'use strict';var multer=require(_0x83e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x83e6('0x1'));var express=require('express');var router=express[_0x83e6('0x2')]();var fs_extra=require(_0x83e6('0x3'));var auth=require(_0x83e6('0x4'));var interaction=require(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var controller=require(_0x83e6('0x7'));router['get']('/',auth[_0x83e6('0x8')](),controller[_0x83e6('0x9')]);router[_0x83e6('0xa')](_0x83e6('0xb'),auth[_0x83e6('0x8')](),controller[_0x83e6('0xc')]);router['post']('/',auth[_0x83e6('0x8')](),controller[_0x83e6('0xd')]);router[_0x83e6('0xe')](_0x83e6('0xb'),auth[_0x83e6('0x8')](),controller[_0x83e6('0xf')]);router[_0x83e6('0x10')](_0x83e6('0xb'),auth[_0x83e6('0x8')](),controller[_0x83e6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 0548a97..1ab020d 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 _0xf8e0=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xf8e0,0x103));var _0x0f8e=function(_0x1ab13e,_0x44507a){_0x1ab13e=_0x1ab13e-0x0;var _0xa28f8=_0xf8e0[_0x1ab13e];return _0xa28f8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0f8e('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0f8e('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0f8e('0x2')],'allowNull':![],'defaultValue':moment()[_0x0f8e('0x3')](_0x0f8e('0x4'))}}; \ No newline at end of file +var _0xe2ea=['moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x29e412,_0x3619eb){var _0x26e380=function(_0x27e8a5){while(--_0x27e8a5){_0x29e412['push'](_0x29e412['shift']());}};_0x26e380(++_0x3619eb);}(_0xe2ea,0xc3));var _0xae2e=function(_0x4b0ead,_0x2e9f99){_0x4b0ead=_0x4b0ead-0x0;var _0x49d864=_0xe2ea[_0x4b0ead];return _0x49d864;};'use strict';var Sequelize=require(_0xae2e('0x0'));var moment=require(_0xae2e('0x1'));module[_0xae2e('0x2')]={'time':{'type':Sequelize[_0xae2e('0x3')]},'callid':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xae2e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xae2e('0x4')],'allowNull':![],'defaultValue':moment()[_0xae2e('0x5')](_0xae2e('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e8c78e1..d3ed263 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 _0x42e3=['../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x42e3,0x1e3));var _0x342e=function(_0x2521f7,_0x36c45b){_0x2521f7=_0x2521f7-0x0;var _0x359014=_0x42e3[_0x2521f7];return _0x359014;};'use strict';var emlformat=require(_0x342e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x342e('0x1'));var jsonpatch=require(_0x342e('0x2'));var rp=require(_0x342e('0x3'));var moment=require(_0x342e('0x4'));var BPromise=require(_0x342e('0x5'));var Mustache=require(_0x342e('0x6'));var util=require(_0x342e('0x7'));var path=require(_0x342e('0x8'));var sox=require(_0x342e('0x9'));var csv=require(_0x342e('0xa'));var ejs=require(_0x342e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x342e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x342e('0xd'));var toCsv=require(_0x342e('0xa'));var querystring=require(_0x342e('0xe'));var Papa=require(_0x342e('0xf'));var Redis=require('ioredis');var authService=require(_0x342e('0x10'));var qs=require(_0x342e('0x11'));var as=require(_0x342e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x342e('0x13'));var utils=require(_0x342e('0x14'));var config=require(_0x342e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f9b98,_0x36afab){_0x36afab=_0x36afab||0xcc;return function(_0xbfbb5d){if(_0xbfbb5d){return _0x1f9b98[_0x342e('0x16')](_0x36afab);}return _0x1f9b98[_0x342e('0x17')](_0x36afab)[_0x342e('0x18')]();};}function respondWithResult(_0x2c029b,_0x2a1bc9){_0x2a1bc9=_0x2a1bc9||0xc8;return function(_0x495bf8){if(_0x495bf8){return _0x2c029b[_0x342e('0x17')](_0x2a1bc9)[_0x342e('0x19')](_0x495bf8);}};}function respondWithFilteredResult(_0xcf70a9,_0x4dfcd8){return function(_0x2b0276){if(_0x2b0276){var _0x173b27=typeof _0x4dfcd8[_0x342e('0x1a')]===_0x342e('0x1b')&&typeof _0x4dfcd8[_0x342e('0x1c')]===_0x342e('0x1b');var _0x3f9b05=_0x2b0276[_0x342e('0x1d')];var _0x3bed4a=_0x173b27?0x0:_0x4dfcd8[_0x342e('0x1a')];var _0x279a57=_0x173b27?_0x2b0276['count']:_0x4dfcd8['offset']+_0x4dfcd8[_0x342e('0x1c')];var _0x4c5826;if(_0x279a57>=_0x3f9b05){_0x279a57=_0x3f9b05;_0x4c5826=0xc8;}else{_0x4c5826=0xce;}_0xcf70a9[_0x342e('0x17')](_0x4c5826);return _0xcf70a9['set']('Content-Range',_0x3bed4a+'-'+_0x279a57+'/'+_0x3f9b05)[_0x342e('0x19')](_0x2b0276);}return null;};}function patchUpdates(_0x40e988){return function(_0xf03623){try{jsonpatch[_0x342e('0x1e')](_0xf03623,_0x40e988,!![]);}catch(_0x19d538){return BPromise[_0x342e('0x1f')](_0x19d538);}return _0xf03623[_0x342e('0x20')]();};}function saveUpdates(_0x5609e4,_0x24359a){return function(_0x24f3ac){if(_0x24f3ac){return _0x24f3ac['update'](_0x5609e4)[_0x342e('0x21')](function(_0x36afa1){return _0x36afa1;});}return null;};}function removeEntity(_0x5ef161,_0x473f27){return function(_0x156f62){if(_0x156f62){return _0x156f62[_0x342e('0x22')]()[_0x342e('0x21')](function(){_0x5ef161[_0x342e('0x17')](0xcc)[_0x342e('0x18')]();});}};}function handleEntityNotFound(_0x5c82b2,_0xf21b14){return function(_0x4f60ba){if(!_0x4f60ba){_0x5c82b2['sendStatus'](0x194);}return _0x4f60ba;};}function handleError(_0x155b12,_0x44296a){_0x44296a=_0x44296a||0x1f4;return function(_0x47c0e7){logger[_0x342e('0x23')](_0x47c0e7[_0x342e('0x24')]);if(_0x47c0e7[_0x342e('0x25')]){delete _0x47c0e7[_0x342e('0x25')];}_0x155b12['status'](_0x44296a)[_0x342e('0x26')](_0x47c0e7);};}exports[_0x342e('0x27')]=function(_0x151554,_0x8ac3d1){var _0x333bd9={},_0x4ff47a={},_0x56c1b0={'count':0x0,'rows':[]};var _0x1ff079=_['map'](db[_0x342e('0x28')][_0x342e('0x29')],function(_0x42f6bf){return{'name':_0x42f6bf[_0x342e('0x2a')],'type':_0x42f6bf['type'][_0x342e('0x2b')]};});_0x4ff47a[_0x342e('0x2c')]=_[_0x342e('0x2d')](_0x1ff079,_0x342e('0x25'));_0x4ff47a['query']=_[_0x342e('0x2e')](_0x151554[_0x342e('0x2f')]);_0x4ff47a[_0x342e('0x30')]=_[_0x342e('0x31')](_0x4ff47a[_0x342e('0x2c')],_0x4ff47a[_0x342e('0x2f')]);_0x333bd9[_0x342e('0x32')]=_[_0x342e('0x31')](_0x4ff47a['model'],qs[_0x342e('0x33')](_0x151554[_0x342e('0x2f')][_0x342e('0x33')]));_0x333bd9['attributes']=_0x333bd9[_0x342e('0x32')]['length']?_0x333bd9[_0x342e('0x32')]:_0x4ff47a[_0x342e('0x2c')];if(!_0x151554[_0x342e('0x2f')][_0x342e('0x34')]('nolimit')){_0x333bd9['limit']=qs[_0x342e('0x1c')](_0x151554[_0x342e('0x2f')][_0x342e('0x1c')]);_0x333bd9[_0x342e('0x1a')]=qs[_0x342e('0x1a')](_0x151554[_0x342e('0x2f')][_0x342e('0x1a')]);}_0x333bd9[_0x342e('0x35')]=qs[_0x342e('0x36')](_0x151554[_0x342e('0x2f')][_0x342e('0x36')]);_0x333bd9[_0x342e('0x37')]=qs[_0x342e('0x30')](_[_0x342e('0x38')](_0x151554[_0x342e('0x2f')],_0x4ff47a['filters']),_0x1ff079);if(_0x151554[_0x342e('0x2f')][_0x342e('0x39')]){_0x333bd9['where']=_[_0x342e('0x3a')](_0x333bd9[_0x342e('0x37')],{'$or':_[_0x342e('0x2d')](_0x1ff079,function(_0x5828bf){if(_0x5828bf['type']!=='VIRTUAL'){var _0x501e0e={};_0x501e0e[_0x5828bf[_0x342e('0x25')]]={'$like':'%'+_0x151554[_0x342e('0x2f')][_0x342e('0x39')]+'%'};return _0x501e0e;}})});}_0x333bd9=_['merge']({},_0x333bd9,_0x151554[_0x342e('0x3b')]);var _0x36886b={'where':_0x333bd9['where']};return db['VoiceQueuesLog'][_0x342e('0x1d')](_0x36886b)['then'](function(_0x3e5c6b){_0x56c1b0['count']=_0x3e5c6b;if(_0x151554['query'][_0x342e('0x3c')]){_0x333bd9[_0x342e('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x342e('0x3e')](_0x333bd9);})[_0x342e('0x21')](function(_0x5427da){_0x56c1b0[_0x342e('0x3f')]=_0x5427da;return _0x56c1b0;})[_0x342e('0x21')](respondWithFilteredResult(_0x8ac3d1,_0x333bd9))[_0x342e('0x40')](handleError(_0x8ac3d1,null));};exports[_0x342e('0x41')]=function(_0x3c5dbc,_0x204179){var _0x3a993b={'raw':!![],'where':{'id':_0x3c5dbc[_0x342e('0x42')]['id']}},_0x5e663e={};_0x5e663e[_0x342e('0x2c')]=_[_0x342e('0x2e')](db[_0x342e('0x28')][_0x342e('0x29')]);_0x5e663e['query']=_['keys'](_0x3c5dbc[_0x342e('0x2f')]);_0x5e663e[_0x342e('0x30')]=_['intersection'](_0x5e663e['model'],_0x5e663e[_0x342e('0x2f')]);_0x3a993b[_0x342e('0x32')]=_[_0x342e('0x31')](_0x5e663e[_0x342e('0x2c')],qs[_0x342e('0x33')](_0x3c5dbc[_0x342e('0x2f')][_0x342e('0x33')]));_0x3a993b['attributes']=_0x3a993b[_0x342e('0x32')][_0x342e('0x43')]?_0x3a993b[_0x342e('0x32')]:_0x5e663e['model'];if(_0x3c5dbc[_0x342e('0x2f')][_0x342e('0x3c')]){_0x3a993b['include']=[{'all':!![]}];}_0x3a993b=_['merge']({},_0x3a993b,_0x3c5dbc['options']);return db[_0x342e('0x28')]['find'](_0x3a993b)['then'](handleEntityNotFound(_0x204179,null))[_0x342e('0x21')](respondWithResult(_0x204179,null))['catch'](handleError(_0x204179,null));};exports[_0x342e('0x44')]=function(_0x5d1250,_0x2182a3){return db['VoiceQueuesLog']['create'](_0x5d1250[_0x342e('0x45')],{})[_0x342e('0x21')](respondWithResult(_0x2182a3,0xc9))['catch'](handleError(_0x2182a3,null));};exports[_0x342e('0x46')]=function(_0x5a3822,_0x5ba590){if(_0x5a3822[_0x342e('0x45')]['id']){delete _0x5a3822[_0x342e('0x45')]['id'];}return db[_0x342e('0x28')][_0x342e('0x47')]({'where':{'id':_0x5a3822[_0x342e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ba590,null))[_0x342e('0x21')](saveUpdates(_0x5a3822[_0x342e('0x45')],null))['then'](respondWithResult(_0x5ba590,null))[_0x342e('0x40')](handleError(_0x5ba590,null));};exports[_0x342e('0x22')]=function(_0x30e8ef,_0x2fc93c){return db['VoiceQueuesLog'][_0x342e('0x47')]({'where':{'id':_0x30e8ef[_0x342e('0x42')]['id']}})[_0x342e('0x21')](handleEntityNotFound(_0x2fc93c,null))[_0x342e('0x21')](removeEntity(_0x2fc93c,null))[_0x342e('0x40')](handleError(_0x2fc93c,null));}; \ No newline at end of file +var _0x761e=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','options','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x52c6d0,_0x44b87a){var _0x189855=function(_0x483e02){while(--_0x483e02){_0x52c6d0['push'](_0x52c6d0['shift']());}};_0x189855(++_0x44b87a);}(_0x761e,0xe2));var _0xe761=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x761e[_0x581af1];return _0x54c22e;};'use strict';var emlformat=require(_0xe761('0x0'));var rimraf=require(_0xe761('0x1'));var zipdir=require(_0xe761('0x2'));var jsonpatch=require(_0xe761('0x3'));var rp=require(_0xe761('0x4'));var moment=require(_0xe761('0x5'));var BPromise=require(_0xe761('0x6'));var Mustache=require(_0xe761('0x7'));var util=require(_0xe761('0x8'));var path=require(_0xe761('0x9'));var sox=require(_0xe761('0xa'));var csv=require(_0xe761('0xb'));var ejs=require(_0xe761('0xc'));var fs=require('fs');var fs_extra=require(_0xe761('0xd'));var _=require(_0xe761('0xe'));var squel=require('squel');var crypto=require(_0xe761('0xf'));var jsforce=require(_0xe761('0x10'));var deskjs=require(_0xe761('0x11'));var toCsv=require(_0xe761('0xb'));var querystring=require(_0xe761('0x12'));var Papa=require(_0xe761('0x13'));var Redis=require('ioredis');var authService=require(_0xe761('0x14'));var qs=require(_0xe761('0x15'));var as=require(_0xe761('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe761('0x17'));var utils=require(_0xe761('0x18'));var config=require(_0xe761('0x19'));var licenseUtil=require(_0xe761('0x1a'));var db=require(_0xe761('0x1b'))['db'];function respondWithStatusCode(_0x267bf9,_0x4b7d49){_0x4b7d49=_0x4b7d49||0xcc;return function(_0x318853){if(_0x318853){return _0x267bf9[_0xe761('0x1c')](_0x4b7d49);}return _0x267bf9[_0xe761('0x1d')](_0x4b7d49)[_0xe761('0x1e')]();};}function respondWithResult(_0x43e8af,_0x4c05e0){_0x4c05e0=_0x4c05e0||0xc8;return function(_0x38010a){if(_0x38010a){return _0x43e8af[_0xe761('0x1d')](_0x4c05e0)[_0xe761('0x1f')](_0x38010a);}};}function respondWithFilteredResult(_0x13b141,_0x183d77){return function(_0xeec97d){if(_0xeec97d){var _0x8f0a99=typeof _0x183d77[_0xe761('0x20')]===_0xe761('0x21')&&typeof _0x183d77['limit']==='undefined';var _0x532a2b=_0xeec97d[_0xe761('0x22')];var _0x20130d=_0x8f0a99?0x0:_0x183d77[_0xe761('0x20')];var _0x1cd459=_0x8f0a99?_0xeec97d['count']:_0x183d77[_0xe761('0x20')]+_0x183d77[_0xe761('0x23')];var _0x469108;if(_0x1cd459>=_0x532a2b){_0x1cd459=_0x532a2b;_0x469108=0xc8;}else{_0x469108=0xce;}_0x13b141[_0xe761('0x1d')](_0x469108);return _0x13b141[_0xe761('0x24')](_0xe761('0x25'),_0x20130d+'-'+_0x1cd459+'/'+_0x532a2b)[_0xe761('0x1f')](_0xeec97d);}return null;};}function patchUpdates(_0x3cd334){return function(_0x41d507){try{jsonpatch[_0xe761('0x26')](_0x41d507,_0x3cd334,!![]);}catch(_0x406ae9){return BPromise[_0xe761('0x27')](_0x406ae9);}return _0x41d507[_0xe761('0x28')]();};}function saveUpdates(_0x158c6f,_0x1b86e0){return function(_0xd66b0d){if(_0xd66b0d){return _0xd66b0d['update'](_0x158c6f)[_0xe761('0x29')](function(_0x376f48){return _0x376f48;});}return null;};}function removeEntity(_0x120027,_0xcbda87){return function(_0x52dc9b){if(_0x52dc9b){return _0x52dc9b[_0xe761('0x2a')]()['then'](function(){_0x120027['status'](0xcc)[_0xe761('0x1e')]();});}};}function handleEntityNotFound(_0x13a85e,_0x5c86ae){return function(_0x382436){if(!_0x382436){_0x13a85e[_0xe761('0x1c')](0x194);}return _0x382436;};}function handleError(_0xd6a04a,_0xaeb7bd){_0xaeb7bd=_0xaeb7bd||0x1f4;return function(_0x119d51){logger[_0xe761('0x2b')](_0x119d51[_0xe761('0x2c')]);if(_0x119d51[_0xe761('0x2d')]){delete _0x119d51[_0xe761('0x2d')];}_0xd6a04a['status'](_0xaeb7bd)[_0xe761('0x2e')](_0x119d51);};}exports[_0xe761('0x2f')]=function(_0xd4591d,_0x3885c3){var _0x8acea4={},_0x419407={},_0x1fcc3f={'count':0x0,'rows':[]};var _0x145e11=_[_0xe761('0x30')](db[_0xe761('0x31')][_0xe761('0x32')],function(_0x2912c6){return{'name':_0x2912c6[_0xe761('0x33')],'type':_0x2912c6[_0xe761('0x34')][_0xe761('0x35')]};});_0x419407[_0xe761('0x36')]=_[_0xe761('0x30')](_0x145e11,'name');_0x419407['query']=_[_0xe761('0x37')](_0xd4591d[_0xe761('0x38')]);_0x419407[_0xe761('0x39')]=_[_0xe761('0x3a')](_0x419407['model'],_0x419407[_0xe761('0x38')]);_0x8acea4[_0xe761('0x3b')]=_[_0xe761('0x3a')](_0x419407['model'],qs['fields'](_0xd4591d[_0xe761('0x38')][_0xe761('0x3c')]));_0x8acea4[_0xe761('0x3b')]=_0x8acea4[_0xe761('0x3b')]['length']?_0x8acea4[_0xe761('0x3b')]:_0x419407['model'];if(!_0xd4591d[_0xe761('0x38')][_0xe761('0x3d')](_0xe761('0x3e'))){_0x8acea4[_0xe761('0x23')]=qs[_0xe761('0x23')](_0xd4591d['query']['limit']);_0x8acea4[_0xe761('0x20')]=qs[_0xe761('0x20')](_0xd4591d['query'][_0xe761('0x20')]);}_0x8acea4[_0xe761('0x3f')]=qs[_0xe761('0x40')](_0xd4591d[_0xe761('0x38')][_0xe761('0x40')]);_0x8acea4[_0xe761('0x41')]=qs[_0xe761('0x39')](_[_0xe761('0x42')](_0xd4591d['query'],_0x419407['filters']),_0x145e11);if(_0xd4591d[_0xe761('0x38')][_0xe761('0x43')]){_0x8acea4[_0xe761('0x41')]=_[_0xe761('0x44')](_0x8acea4[_0xe761('0x41')],{'$or':_[_0xe761('0x30')](_0x145e11,function(_0x2b66c4){if(_0x2b66c4[_0xe761('0x34')]!==_0xe761('0x45')){var _0x513a32={};_0x513a32[_0x2b66c4['name']]={'$like':'%'+_0xd4591d['query']['filter']+'%'};return _0x513a32;}})});}_0x8acea4=_[_0xe761('0x44')]({},_0x8acea4,_0xd4591d['options']);var _0x618f44={'where':_0x8acea4[_0xe761('0x41')]};return db['VoiceQueuesLog'][_0xe761('0x22')](_0x618f44)[_0xe761('0x29')](function(_0xcadc72){_0x1fcc3f[_0xe761('0x22')]=_0xcadc72;if(_0xd4591d[_0xe761('0x38')][_0xe761('0x46')]){_0x8acea4[_0xe761('0x47')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x8acea4);})[_0xe761('0x29')](function(_0x5a8f3a){_0x1fcc3f['rows']=_0x5a8f3a;return _0x1fcc3f;})['then'](respondWithFilteredResult(_0x3885c3,_0x8acea4))[_0xe761('0x48')](handleError(_0x3885c3,null));};exports[_0xe761('0x49')]=function(_0x470ce3,_0x93c24d){var _0x2dd38d={'raw':!![],'where':{'id':_0x470ce3['params']['id']}},_0x4a0da1={};_0x4a0da1[_0xe761('0x36')]=_[_0xe761('0x37')](db[_0xe761('0x31')][_0xe761('0x32')]);_0x4a0da1[_0xe761('0x38')]=_[_0xe761('0x37')](_0x470ce3[_0xe761('0x38')]);_0x4a0da1[_0xe761('0x39')]=_[_0xe761('0x3a')](_0x4a0da1[_0xe761('0x36')],_0x4a0da1[_0xe761('0x38')]);_0x2dd38d[_0xe761('0x3b')]=_['intersection'](_0x4a0da1[_0xe761('0x36')],qs[_0xe761('0x3c')](_0x470ce3[_0xe761('0x38')][_0xe761('0x3c')]));_0x2dd38d['attributes']=_0x2dd38d[_0xe761('0x3b')]['length']?_0x2dd38d[_0xe761('0x3b')]:_0x4a0da1[_0xe761('0x36')];if(_0x470ce3[_0xe761('0x38')][_0xe761('0x46')]){_0x2dd38d[_0xe761('0x47')]=[{'all':!![]}];}_0x2dd38d=_['merge']({},_0x2dd38d,_0x470ce3[_0xe761('0x4a')]);return db['VoiceQueuesLog'][_0xe761('0x4b')](_0x2dd38d)[_0xe761('0x29')](handleEntityNotFound(_0x93c24d,null))[_0xe761('0x29')](respondWithResult(_0x93c24d,null))['catch'](handleError(_0x93c24d,null));};exports['create']=function(_0x1cbea3,_0x4b4e9a){return db[_0xe761('0x31')][_0xe761('0x4c')](_0x1cbea3[_0xe761('0x4d')],{})[_0xe761('0x29')](respondWithResult(_0x4b4e9a,0xc9))[_0xe761('0x48')](handleError(_0x4b4e9a,null));};exports[_0xe761('0x4e')]=function(_0x579c0a,_0x11d829){if(_0x579c0a[_0xe761('0x4d')]['id']){delete _0x579c0a[_0xe761('0x4d')]['id'];}return db[_0xe761('0x31')]['find']({'where':{'id':_0x579c0a['params']['id']}})['then'](handleEntityNotFound(_0x11d829,null))[_0xe761('0x29')](saveUpdates(_0x579c0a[_0xe761('0x4d')],null))[_0xe761('0x29')](respondWithResult(_0x11d829,null))[_0xe761('0x48')](handleError(_0x11d829,null));};exports[_0xe761('0x2a')]=function(_0x384846,_0x4ea3a3){return db[_0xe761('0x31')][_0xe761('0x4b')]({'where':{'id':_0x384846[_0xe761('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4ea3a3,null))[_0xe761('0x29')](removeEntity(_0x4ea3a3,null))['catch'](handleError(_0x4ea3a3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e8ca2a5..5becf9c 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 _0xbc2f=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger'];(function(_0x56f660,_0x179e45){var _0x26dd08=function(_0x566286){while(--_0x566286){_0x56f660['push'](_0x56f660['shift']());}};_0x26dd08(++_0x179e45);}(_0xbc2f,0x157));var _0xfbc2=function(_0x48179c,_0x2a4bf4){_0x48179c=_0x48179c-0x0;var _0x2d0153=_0xbc2f[_0x48179c];return _0x2d0153;};'use strict';var _=require('lodash');var util=require(_0xfbc2('0x0'));var logger=require(_0xfbc2('0x1'))('api');var moment=require(_0xfbc2('0x2'));var BPromise=require(_0xfbc2('0x3'));var rp=require(_0xfbc2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbc2('0x5'));var config=require(_0xfbc2('0x6'));var attributes=require(_0xfbc2('0x7'));module[_0xfbc2('0x8')]=function(_0x2821f9,_0x408481){return _0x2821f9[_0xfbc2('0x9')](_0xfbc2('0xa'),attributes,{'tableName':_0xfbc2('0xb'),'paranoid':![],'indexes':[{'name':_0xfbc2('0xc'),'fields':[_0xfbc2('0xd'),_0xfbc2('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8111=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8111,0x143));var _0x1811=function(_0x1b8440,_0x58cd54){_0x1b8440=_0x1b8440-0x0;var _0x5a6bfa=_0x8111[_0x1b8440];return _0x5a6bfa;};'use strict';var _=require(_0x1811('0x0'));var util=require(_0x1811('0x1'));var logger=require(_0x1811('0x2'))(_0x1811('0x3'));var moment=require(_0x1811('0x4'));var BPromise=require(_0x1811('0x5'));var rp=require(_0x1811('0x6'));var fs=require('fs');var path=require(_0x1811('0x7'));var rimraf=require(_0x1811('0x8'));var config=require(_0x1811('0x9'));var attributes=require(_0x1811('0xa'));module[_0x1811('0xb')]=function(_0x4c87f2,_0xd90c03){return _0x4c87f2[_0x1811('0xc')]('VoiceQueuesLog',attributes,{'tableName':_0x1811('0xd'),'paranoid':![],'indexes':[{'name':_0x1811('0xe'),'fields':[_0x1811('0xf'),_0x1811('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d65c566..f1ff229 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 _0x5379=['result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5379,0x85));var _0x9537=function(_0x50fbf2,_0x339d31){_0x50fbf2=_0x50fbf2-0x0;var _0xf95284=_0x5379[_0x50fbf2];return _0xf95284;};'use strict';var _=require(_0x9537('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9537('0x1'));var fs=require('fs');var Redis=require(_0x9537('0x2'));var db=require(_0x9537('0x3'))['db'];var utils=require(_0x9537('0x4'));var logger=require(_0x9537('0x5'))(_0x9537('0x6'));var config=require(_0x9537('0x7'));var jayson=require(_0x9537('0x8'));var client=jayson[_0x9537('0x9')][_0x9537('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x323b3a,_0x4298a4,_0x1d7e40){return new BPromise(function(_0x5a27b3,_0x11cecf){return client[_0x9537('0xb')](_0x323b3a,_0x1d7e40)[_0x9537('0xc')](function(_0x55265e){logger['info'](_0x9537('0xd'),_0x4298a4,'request\x20sent');logger[_0x9537('0xe')](_0x9537('0xf'),_0x4298a4,_0x9537('0x10'),JSON[_0x9537('0x11')](_0x55265e));if(_0x55265e[_0x9537('0x12')]){if(_0x55265e[_0x9537('0x12')][_0x9537('0x13')]===0x1f4){logger[_0x9537('0x12')](_0x9537('0xd'),_0x4298a4,_0x55265e[_0x9537('0x12')][_0x9537('0x14')]);return _0x11cecf(_0x55265e[_0x9537('0x12')][_0x9537('0x14')]);}logger['error'](_0x9537('0xd'),_0x4298a4,_0x55265e[_0x9537('0x12')][_0x9537('0x14')]);return _0x5a27b3(_0x55265e[_0x9537('0x12')][_0x9537('0x14')]);}else{logger['info'](_0x9537('0xd'),_0x4298a4,_0x9537('0x10'));_0x5a27b3(_0x55265e[_0x9537('0x15')][_0x9537('0x14')]);}})['catch'](function(_0x5b416c){logger[_0x9537('0x12')](_0x9537('0xd'),_0x4298a4,_0x5b416c);_0x11cecf(_0x5b416c);});});} \ No newline at end of file +var _0x4898=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4280e0,_0x4ef2a5){var _0x39b198=function(_0x525874){while(--_0x525874){_0x4280e0['push'](_0x4280e0['shift']());}};_0x39b198(++_0x4ef2a5);}(_0x4898,0x163));var _0x8489=function(_0x38217f,_0x3f7bde){_0x38217f=_0x38217f-0x0;var _0x7f66eb=_0x4898[_0x38217f];return _0x7f66eb;};'use strict';var _=require('lodash');var util=require(_0x8489('0x0'));var moment=require(_0x8489('0x1'));var BPromise=require('bluebird');var rs=require(_0x8489('0x2'));var fs=require('fs');var Redis=require(_0x8489('0x3'));var db=require(_0x8489('0x4'))['db'];var utils=require(_0x8489('0x5'));var logger=require(_0x8489('0x6'))('rpc');var config=require(_0x8489('0x7'));var jayson=require(_0x8489('0x8'));var client=jayson[_0x8489('0x9')][_0x8489('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507f48,_0x5c89cd,_0x49e013){return new BPromise(function(_0x6e6a21,_0x2aeff0){return client[_0x8489('0xb')](_0x507f48,_0x49e013)[_0x8489('0xc')](function(_0x3b6b1d){logger['info'](_0x8489('0xd'),_0x5c89cd,_0x8489('0xe'));logger[_0x8489('0xf')](_0x8489('0x10'),_0x5c89cd,'request\x20sent',JSON[_0x8489('0x11')](_0x3b6b1d));if(_0x3b6b1d[_0x8489('0x12')]){if(_0x3b6b1d[_0x8489('0x12')][_0x8489('0x13')]===0x1f4){logger[_0x8489('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5c89cd,_0x3b6b1d[_0x8489('0x12')][_0x8489('0x14')]);return _0x2aeff0(_0x3b6b1d[_0x8489('0x12')]['message']);}logger[_0x8489('0x12')](_0x8489('0xd'),_0x5c89cd,_0x3b6b1d['error'][_0x8489('0x14')]);return _0x6e6a21(_0x3b6b1d['error']['message']);}else{logger[_0x8489('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5c89cd,'request\x20sent');_0x6e6a21(_0x3b6b1d[_0x8489('0x16')]['message']);}})[_0x8489('0x17')](function(_0x30fcc4){logger[_0x8489('0x12')](_0x8489('0xd'),_0x5c89cd,_0x30fcc4);_0x2aeff0(_0x30fcc4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7f99c2f..7c6082b 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 _0x7d67=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','runTranscribe','put','update','delete','/:id','destroy','util','path','connect-timeout','fs-extra'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x7d67,0x1be));var _0x77d6=function(_0x17a7a1,_0x8637a5){_0x17a7a1=_0x17a7a1-0x0;var _0xc0a25c=_0x7d67[_0x17a7a1];return _0xc0a25c;};'use strict';var multer=require('multer');var util=require(_0x77d6('0x0'));var path=require(_0x77d6('0x1'));var timeout=require(_0x77d6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x77d6('0x3'));var auth=require(_0x77d6('0x4'));var interaction=require(_0x77d6('0x5'));var config=require(_0x77d6('0x6'));var controller=require(_0x77d6('0x7'));router[_0x77d6('0x8')]('/',auth['isAuthenticated'](),controller[_0x77d6('0x9')]);router[_0x77d6('0x8')](_0x77d6('0xa'),auth[_0x77d6('0xb')](),controller[_0x77d6('0xc')]);router['get']('/:id',auth[_0x77d6('0xb')](),controller['show']);router['get'](_0x77d6('0xd'),auth[_0x77d6('0xb')](),controller[_0x77d6('0xe')]);router[_0x77d6('0x8')](_0x77d6('0xf'),controller['downloads']);router[_0x77d6('0x8')](_0x77d6('0x10'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x77d6('0x11')]('/',auth['isAuthenticated'](),controller[_0x77d6('0x12')]);router[_0x77d6('0x11')]('/:id/transcribe',auth[_0x77d6('0xb')](),controller[_0x77d6('0x13')]);router[_0x77d6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x77d6('0x15')]);router[_0x77d6('0x16')](_0x77d6('0x17'),auth[_0x77d6('0xb')](),controller[_0x77d6('0x18')]);module['exports']=router; \ No newline at end of file +var _0x60f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x42bbce,_0x3e91a9){var _0xd87bbc=function(_0x473468){while(--_0x473468){_0x42bbce['push'](_0x42bbce['shift']());}};_0xd87bbc(++_0x3e91a9);}(_0x60f0,0xae));var _0x060f=function(_0x286969,_0x343699){_0x286969=_0x286969-0x0;var _0x175780=_0x60f0[_0x286969];return _0x175780;};'use strict';var multer=require(_0x060f('0x0'));var util=require(_0x060f('0x1'));var path=require(_0x060f('0x2'));var timeout=require(_0x060f('0x3'));var express=require(_0x060f('0x4'));var router=express['Router']();var fs_extra=require(_0x060f('0x5'));var auth=require(_0x060f('0x6'));var interaction=require(_0x060f('0x7'));var config=require(_0x060f('0x8'));var controller=require(_0x060f('0x9'));router['get']('/',auth[_0x060f('0xa')](),controller[_0x060f('0xb')]);router[_0x060f('0xc')](_0x060f('0xd'),auth[_0x060f('0xa')](),controller[_0x060f('0xe')]);router[_0x060f('0xc')](_0x060f('0xf'),auth[_0x060f('0xa')](),controller[_0x060f('0x10')]);router['get'](_0x060f('0x11'),auth[_0x060f('0xa')](),controller[_0x060f('0x12')]);router['get'](_0x060f('0x13'),controller[_0x060f('0x14')]);router[_0x060f('0xc')](_0x060f('0x15'),auth[_0x060f('0xa')](),controller[_0x060f('0x16')]);router[_0x060f('0x17')]('/',auth[_0x060f('0xa')](),controller[_0x060f('0x18')]);router['post'](_0x060f('0x15'),auth[_0x060f('0xa')](),controller[_0x060f('0x19')]);router[_0x060f('0x1a')](_0x060f('0xf'),auth[_0x060f('0xa')](),controller[_0x060f('0x1b')]);router[_0x060f('0x1c')](_0x060f('0xf'),auth['isAuthenticated'](),controller[_0x060f('0x1d')]);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 a1a040e..214e45c 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 a8c57b5..1a4df0c 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 _0x10df=['format','keys','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','fields','includeAll','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','col','token','push','$and','extname','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','recording','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','type','differenceBy'];(function(_0x2d0729,_0x5a48b7){var _0x3f98db=function(_0x4a50b1){while(--_0x4a50b1){_0x2d0729['push'](_0x2d0729['shift']());}};_0x3f98db(++_0x5a48b7);}(_0x10df,0x199));var _0xf10d=function(_0x3f48c8,_0x299d53){_0x3f48c8=_0x3f48c8-0x0;var _0x4c7512=_0x10df[_0x3f48c8];return _0x4c7512;};'use strict';var emlformat=require(_0xf10d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf10d('0x1'));var jsonpatch=require(_0xf10d('0x2'));var rp=require(_0xf10d('0x3'));var moment=require(_0xf10d('0x4'));var BPromise=require(_0xf10d('0x5'));var Mustache=require(_0xf10d('0x6'));var util=require(_0xf10d('0x7'));var path=require(_0xf10d('0x8'));var sox=require(_0xf10d('0x9'));var csv=require(_0xf10d('0xa'));var ejs=require(_0xf10d('0xb'));var fs=require('fs');var fs_extra=require(_0xf10d('0xc'));var _=require(_0xf10d('0xd'));var squel=require(_0xf10d('0xe'));var crypto=require(_0xf10d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf10d('0xa'));var querystring=require(_0xf10d('0x10'));var Papa=require('papaparse');var AWS=require(_0xf10d('0x11'));var uuidv4=require(_0xf10d('0x12'));var Redis=require(_0xf10d('0x13'));var authService=require(_0xf10d('0x14'));var qs=require(_0xf10d('0x15'));var as=require(_0xf10d('0x16'));var hardwareService=require(_0xf10d('0x17'));var logger=require('../../config/logger')(_0xf10d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf10d('0x19'))['db'];function respondWithStatusCode(_0x5c258f,_0x181064){_0x181064=_0x181064||0xcc;return function(_0x820df7){if(_0x820df7){return _0x5c258f[_0xf10d('0x1a')](_0x181064);}return _0x5c258f[_0xf10d('0x1b')](_0x181064)[_0xf10d('0x1c')]();};}function respondWithResult(_0x448fa1,_0x2e51a1){_0x2e51a1=_0x2e51a1||0xc8;return function(_0x1945bf){if(_0x1945bf){return _0x448fa1['status'](_0x2e51a1)[_0xf10d('0x1d')](_0x1945bf);}};}function respondWithFilteredResult(_0x29446c,_0x42a094){return function(_0x5db709){if(_0x5db709){var _0x1f1150=typeof _0x42a094['offset']==='undefined'&&typeof _0x42a094[_0xf10d('0x1e')]===_0xf10d('0x1f');var _0x4fda04=_0x5db709[_0xf10d('0x20')];var _0x2f350a=_0x1f1150?0x0:_0x42a094[_0xf10d('0x21')];var _0x21b034=_0x1f1150?_0x5db709[_0xf10d('0x20')]:_0x42a094['offset']+_0x42a094[_0xf10d('0x1e')];var _0x477c9f;if(_0x21b034>=_0x4fda04){_0x21b034=_0x4fda04;_0x477c9f=0xc8;}else{_0x477c9f=0xce;}_0x29446c[_0xf10d('0x1b')](_0x477c9f);return _0x29446c['set'](_0xf10d('0x22'),_0x2f350a+'-'+_0x21b034+'/'+_0x4fda04)[_0xf10d('0x1d')](_0x5db709);}return null;};}function patchUpdates(_0x4d9d32){return function(_0x2f49d7){try{jsonpatch[_0xf10d('0x23')](_0x2f49d7,_0x4d9d32,!![]);}catch(_0x2d560b){return BPromise[_0xf10d('0x24')](_0x2d560b);}return _0x2f49d7[_0xf10d('0x25')]();};}function saveUpdates(_0x314ec0,_0x3e1ebd){return function(_0x341415){if(_0x341415){return _0x341415[_0xf10d('0x26')](_0x314ec0)[_0xf10d('0x27')](function(_0x47e698){return _0x47e698;});}return null;};}function removeEntity(_0x39bd4a,_0x351161){return function(_0xa4f876){if(_0xa4f876){return _0xa4f876[_0xf10d('0x28')]()[_0xf10d('0x27')](function(){_0x39bd4a[_0xf10d('0x1b')](0xcc)[_0xf10d('0x1c')]();});}};}function handleEntityNotFound(_0x1d6c0d,_0x414ecc){return function(_0x1dfc55){if(!_0x1dfc55){_0x1d6c0d[_0xf10d('0x1a')](0x194);}return _0x1dfc55;};}function handleError(_0x27a296,_0x4826ed){_0x4826ed=_0x4826ed||0x1f4;return function(_0x1c8ce0){logger[_0xf10d('0x29')](_0x1c8ce0[_0xf10d('0x2a')]);if(_0x1c8ce0[_0xf10d('0x2b')]){delete _0x1c8ce0['name'];}_0x27a296['status'](_0x4826ed)[_0xf10d('0x2c')](_0x1c8ce0);};}exports['index']=function(_0x576b6e,_0x185e70){var _0xb20e5c={},_0x3e45f5={},_0x534c63={'count':0x0,'rows':[]};var _0x8164c3=_[_0xf10d('0x2d')](db[_0xf10d('0x2e')][_0xf10d('0x2f')],function(_0x2166ce){return{'name':_0x2166ce['fieldName'],'type':_0x2166ce[_0xf10d('0x30')]['key']};});_0x3e45f5['model']=_[_0xf10d('0x31')](_[_0xf10d('0x2d')](_0x8164c3,'name'),[_0xf10d('0x32')]);_0x3e45f5['query']=_[_0xf10d('0x33')](_0x576b6e[_0xf10d('0x34')]);_0x3e45f5[_0xf10d('0x35')]=_[_0xf10d('0x36')](_0x3e45f5['model'],_0x3e45f5[_0xf10d('0x34')]);_0xb20e5c[_0xf10d('0x37')]=_[_0xf10d('0x36')](_0x3e45f5[_0xf10d('0x38')],qs['fields'](_0x576b6e[_0xf10d('0x34')]['fields']));_0xb20e5c['attributes']=_0xb20e5c[_0xf10d('0x37')][_0xf10d('0x39')]?_0xb20e5c['attributes']:_0x3e45f5[_0xf10d('0x38')];if(!_0x576b6e[_0xf10d('0x34')][_0xf10d('0x3a')](_0xf10d('0x3b'))){_0xb20e5c['limit']=qs['limit'](_0x576b6e['query'][_0xf10d('0x1e')]);_0xb20e5c['offset']=qs[_0xf10d('0x21')](_0x576b6e['query'][_0xf10d('0x21')]);}_0xb20e5c[_0xf10d('0x3c')]=qs[_0xf10d('0x3d')](_0x576b6e[_0xf10d('0x34')][_0xf10d('0x3d')]);_0xb20e5c[_0xf10d('0x3e')]=qs[_0xf10d('0x35')](_[_0xf10d('0x3f')](_0x576b6e[_0xf10d('0x34')],_0x3e45f5[_0xf10d('0x35')]),_0x8164c3);if(_0x576b6e[_0xf10d('0x34')][_0xf10d('0x40')]){_0xb20e5c['where']=_[_0xf10d('0x41')](_0xb20e5c[_0xf10d('0x3e')],{'$or':_[_0xf10d('0x2d')](_0x8164c3,function(_0x1bde6b){if(_0x1bde6b['type']!==_0xf10d('0x42')){var _0x5466d3={};_0x5466d3[_0x1bde6b[_0xf10d('0x2b')]]={'$like':'%'+_0x576b6e[_0xf10d('0x34')][_0xf10d('0x40')]+'%'};return _0x5466d3;}})});}_0xb20e5c=_[_0xf10d('0x41')]({},_0xb20e5c,_0x576b6e[_0xf10d('0x43')]);var _0x5e628c={'where':_0xb20e5c[_0xf10d('0x3e')]};return db[_0xf10d('0x2e')][_0xf10d('0x20')](_0x5e628c)[_0xf10d('0x27')](function(_0xbd3a8d){_0x534c63[_0xf10d('0x20')]=_0xbd3a8d;if(_0x576b6e[_0xf10d('0x34')]['includeAll']){_0xb20e5c[_0xf10d('0x44')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0xb20e5c);})[_0xf10d('0x27')](function(_0x58726a){_0x534c63[_0xf10d('0x45')]=_0x58726a;return _0x534c63;})[_0xf10d('0x27')](respondWithFilteredResult(_0x185e70,_0xb20e5c))['catch'](handleError(_0x185e70,null));};exports[_0xf10d('0x46')]=function(_0x432e78,_0x4d01be){var _0x3d4cb1={'raw':![],'where':{'id':_0x432e78[_0xf10d('0x47')]['id']}},_0x1ef50e={};_0x1ef50e[_0xf10d('0x38')]=_[_0xf10d('0x33')](db['VoiceRecording'][_0xf10d('0x2f')]);_0x1ef50e[_0xf10d('0x34')]=_['keys'](_0x432e78['query']);_0x1ef50e[_0xf10d('0x35')]=_[_0xf10d('0x36')](_0x1ef50e[_0xf10d('0x38')],_0x1ef50e[_0xf10d('0x34')]);_0x3d4cb1[_0xf10d('0x37')]=_['intersection'](_0x1ef50e['model'],qs['fields'](_0x432e78['query'][_0xf10d('0x48')]));_0x3d4cb1[_0xf10d('0x37')]=_0x3d4cb1[_0xf10d('0x37')][_0xf10d('0x39')]?_0x3d4cb1['attributes']:_0x1ef50e['model'];if(_0x432e78[_0xf10d('0x34')][_0xf10d('0x49')]){_0x3d4cb1[_0xf10d('0x44')]=[{'all':!![]}];}_0x3d4cb1=_[_0xf10d('0x41')]({},_0x3d4cb1,_0x432e78[_0xf10d('0x43')]);return db[_0xf10d('0x2e')][_0xf10d('0x4a')](_0x3d4cb1)['then'](handleEntityNotFound(_0x4d01be,null))[_0xf10d('0x27')](respondWithResult(_0x4d01be,null))[_0xf10d('0x4b')](handleError(_0x4d01be,null));};exports[_0xf10d('0x4c')]=function(_0x311baf,_0x3aeec8){return db[_0xf10d('0x2e')][_0xf10d('0x4c')](_0x311baf[_0xf10d('0x4d')],{})['then'](respondWithResult(_0x3aeec8,0xc9))[_0xf10d('0x4b')](handleError(_0x3aeec8,null));};exports[_0xf10d('0x26')]=function(_0x137ed1,_0x22b731){if(_0x137ed1[_0xf10d('0x4d')]['id']){delete _0x137ed1['body']['id'];}return db['VoiceRecording'][_0xf10d('0x4a')]({'where':{'id':_0x137ed1[_0xf10d('0x47')]['id']}})[_0xf10d('0x27')](handleEntityNotFound(_0x22b731,null))['then'](saveUpdates(_0x137ed1['body'],null))[_0xf10d('0x27')](respondWithResult(_0x22b731,null))[_0xf10d('0x4b')](handleError(_0x22b731,null));};exports[_0xf10d('0x4e')]=function(_0x2de805,_0x24f2d5){return db[_0xf10d('0x2e')][_0xf10d('0x4e')]()[_0xf10d('0x27')](respondWithResult(_0x24f2d5,null))[_0xf10d('0x4b')](handleError(_0x24f2d5,null));};exports[_0xf10d('0x4f')]=function(_0x2141bf,_0x3eb996,_0x5829de){var _0x2d1472=require(_0xf10d('0x50'));var _0xd465e6=![];var _0x1ef33a={};if(_0x2141bf[_0xf10d('0x34')][_0xf10d('0x30')]&&_0x2141bf[_0xf10d('0x34')][_0xf10d('0x30')]===_0xf10d('0x51')){_0x1ef33a['uniqueid']=_0x2141bf[_0xf10d('0x47')]['id'];}else{_0x1ef33a['id']=_0x2141bf[_0xf10d('0x47')]['id'];}return db[_0xf10d('0x2e')][_0xf10d('0x4a')]({'where':_0x1ef33a,'attributes':['id',_0xf10d('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x3eb996,null))[_0xf10d('0x27')](function(_0x2c80c0){if(_0x2c80c0){var _0x37bca7=_0x2c80c0['value'];var _0x4cb6e6=util[_0xf10d('0x32')](_0xf10d('0x53'),_0x37bca7);if(fs[_0xf10d('0x54')](_0x4cb6e6)){_0xd465e6=!![];return _0x2d1472[_0xf10d('0x55')](_0x4cb6e6,_0x37bca7,config[_0xf10d('0x56')]['recording'])[_0xf10d('0x27')](function(){return _0x2c80c0;});}return _0x2c80c0;}})['then'](function(_0x2b06b7){if(_0x2b06b7){var _0x21b95b=_0x2b06b7[_0xf10d('0x52')];if(!fs[_0xf10d('0x54')](_0x21b95b)){throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))](_0xf10d('0x59'));}if(_0x2b06b7[_0xf10d('0x5a')]){return _0x3eb996[_0xf10d('0x4f')](_0x21b95b,_0x2b06b7[_0xf10d('0x5a')]+path['extname'](_0x21b95b),function(){if(_0xd465e6){fs[_0xf10d('0x5b')](_0x21b95b);}});}else{return _0x3eb996[_0xf10d('0x4f')](_0x21b95b,function(_0x2a0be1){if(_0xd465e6){fs[_0xf10d('0x5b')](_0x21b95b);}});}}})[_0xf10d('0x4b')](function(_0x2e28b4){if(_0x2e28b4[_0xf10d('0x5c')]===_0xf10d('0x59')){_0x3eb996['status'](0x194)['send'](_0xf10d('0x5d'));}else{return handleError(_0x3eb996,null);}});};exports[_0xf10d('0x5e')]=function(_0x344021,_0x21108d,_0x38a0bd){var _0x50d2cf=require(_0xf10d('0x50'));var _0x4a98f1=![];var _0x3bc51c={'$and':[db['sequelize']['where'](db[_0xf10d('0x5f')]['fn']('MD5',db[_0xf10d('0x5f')][_0xf10d('0x60')](_0xf10d('0x51'))),_0x344021['query'][_0xf10d('0x61')])]};if(_0x344021['query'][_0xf10d('0x30')]&&_0x344021[_0xf10d('0x34')][_0xf10d('0x30')]==='uniqueid'){_0x3bc51c['$and'][_0xf10d('0x62')]({'uniqueid':_0x344021['params']['id']});}else{_0x3bc51c[_0xf10d('0x63')]['push']({'id':_0x344021['params']['id']});}return db[_0xf10d('0x2e')][_0xf10d('0x4a')]({'where':_0x3bc51c,'attributes':['id',_0xf10d('0x52')],'raw':!![]})[_0xf10d('0x27')](handleEntityNotFound(_0x21108d,null))['then'](function(_0x39e026){if(_0x39e026){var _0x1228c9=util[_0xf10d('0x32')]('%s.cypher',_0x39e026[_0xf10d('0x52')]);if(fs['existsSync'](_0x1228c9)){_0x4a98f1=!![];return _0x50d2cf[_0xf10d('0x55')](_0x1228c9,_0x39e026[_0xf10d('0x52')],config[_0xf10d('0x56')]['recording'])['then'](function(){return _0x39e026;});}return _0x39e026;}})[_0xf10d('0x27')](function(_0x48c587){if(_0x48c587){if(!fs['existsSync'](_0x48c587[_0xf10d('0x52')])){throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x48c587[_0xf10d('0x5a')]){return _0x21108d['download'](_0x48c587['value'],_0x48c587[_0xf10d('0x5a')]+path[_0xf10d('0x64')](_0x48c587[_0xf10d('0x52')]),function(){if(_0x4a98f1){fs[_0xf10d('0x5b')](_0x48c587[_0xf10d('0x52')]);}});}else{return _0x21108d['download'](_0x48c587['value'],function(_0x4c33db){if(_0x4a98f1){fs[_0xf10d('0x5b')](_0x48c587[_0xf10d('0x52')]);}});}}})[_0xf10d('0x4b')](handleError(_0x21108d,null));};exports[_0xf10d('0x28')]=function(_0x11fc01,_0x2ff817){return db[_0xf10d('0x2e')][_0xf10d('0x4a')]({'where':{'id':_0x11fc01[_0xf10d('0x47')]['id']}})[_0xf10d('0x27')](function(_0x43f1c5){if(_['isNil'](_0x43f1c5)){throw new ReferenceError(_0xf10d('0x65'));}return _0x43f1c5;})[_0xf10d('0x27')](function(_0x106d76){var _0x25b529=_0x106d76[_0xf10d('0x52')];logger['info'](_0xf10d('0x66'),_0x25b529);if(!_[_0xf10d('0x67')](_0x106d76[_0xf10d('0x52')])&&fs['existsSync'](_0x25b529)){logger['info'](_0xf10d('0x68')+_0x25b529+_0xf10d('0x69'));fs[_0xf10d('0x6a')](_0x25b529);}_0x25b529=_0x25b529+_0xf10d('0x6b');if(!_['isNil'](_0x106d76['value'])&&fs[_0xf10d('0x54')](_0x25b529)){logger[_0xf10d('0x6c')]('File:\x20\x22'+_0x25b529+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf10d('0x6a')](_0x25b529);}return _0x106d76;})[_0xf10d('0x27')](function(_0x58e253){if(!_0x58e253)throw new InternalError();return _0x58e253[_0xf10d('0x28')]();})[_0xf10d('0x27')](function(){_0x2ff817[_0xf10d('0x1b')](0xcc)['end']();})[_0xf10d('0x4b')](handleError(_0x2ff817,null));};function getBucketslist(_0x27cdff,_0x9f68ed,_0x462779){return new Promise(function(_0x25e3b0,_0x3d2ca4){var _0x307653=new AWS['S3']({'accessKeyId':_0x9f68ed,'secretAccessKey':_0x27cdff,'region':_0x462779});_0x307653['listBuckets']({},function(_0x4cf6c7,_0x58868a){if(_0x4cf6c7){return _0x3d2ca4(_0x4cf6c7);}else{return _0x25e3b0(_0x58868a);}});});}function createBucket(_0x4a3a09,_0x5407a8,_0x181d96,_0x3ff30f){return new Promise(function(_0x52f807,_0xb3c148){var _0x339dfa=new AWS['S3']({'accessKeyId':_0x5407a8,'secretAccessKey':_0x4a3a09,'region':_0x181d96});_0x339dfa[_0xf10d('0x6d')]({'Bucket':_0x3ff30f},function(_0xbd9c7,_0x2b081c){if(_0xbd9c7){return _0xb3c148(_0xbd9c7);}else{return _0x52f807(_0x2b081c);}});});}function uploadFile(_0x2648b0,_0x3b70d6,_0x19fb05,_0xc305b3,_0x12abe4,_0x121753){return new Promise(function(_0x5cb091,_0xed29c2){var _0x20c8e1=new AWS['S3']({'accessKeyId':_0x3b70d6,'secretAccessKey':_0x2648b0,'region':_0x19fb05});_0x20c8e1[_0xf10d('0x6e')]({'Bucket':_0xc305b3,'Key':_0x12abe4,'Body':_0x121753},function(_0x599210,_0x2e0f0f){if(_0x599210){return _0xed29c2(_0x599210);}else{return _0x5cb091(_0x2e0f0f);}});});}function startTranscribe(_0x1de235,_0x29db3a,_0x56c2ca,_0x2c8d63,_0x44119a,_0x3208a5){return new Promise(function(_0x5440ac,_0x54ab14){var _0xdf6577=new AWS['TranscribeService']({'accessKeyId':_0x29db3a,'secretAccessKey':_0x1de235,'region':_0x56c2ca});_0xdf6577['startTranscriptionJob']({'TranscriptionJobName':_0x2c8d63,'LanguageCode':_0x44119a,'Media':{'MediaFileUri':_0x3208a5}},function(_0x7756c1,_0x40a119){if(_0x7756c1){return _0x54ab14(_0x7756c1);}else{return _0x5440ac(_0x40a119);}});});}function transcribe(_0x426099,_0x16d50c,_0x1b82a6,_0x25ec89,_0x3886f3,_0x4c2a8e,_0x3f04a1){return new Promise(function(_0x5d2fa7,_0xa3dbef){var _0x352d84={};logger[_0xf10d('0x6c')](util[_0xf10d('0x32')](_0xf10d('0x6f'),_0x426099,_0x3886f3));return uploadFile(_0x16d50c,_0x1b82a6,_0x25ec89,_0x3886f3,path['basename'](_0x4c2a8e),fs['readFileSync'](_0x4c2a8e))['then'](function(_0x136b6b){logger['info'](util[_0xf10d('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x426099,_0x3886f3,_0x136b6b[_0xf10d('0x70')]));_0x352d84[_0xf10d('0x71')]=_0x136b6b[_0xf10d('0x72')];_0x352d84[_0xf10d('0x73')]=_0x136b6b[_0xf10d('0x70')];logger[_0xf10d('0x6c')](util[_0xf10d('0x32')](_0xf10d('0x74'),_0x426099));return startTranscribe(_0x16d50c,_0x1b82a6,_0x25ec89,uuidv4(),_0x3f04a1,_0x136b6b[_0xf10d('0x70')]);})[_0xf10d('0x27')](function(_0x39f619){logger[_0xf10d('0x6c')](util['format'](_0xf10d('0x75'),_0x426099,_0x39f619[_0xf10d('0x76')][_0xf10d('0x77')]));_0x352d84['transcribeName']=_0x39f619[_0xf10d('0x76')]['TranscriptionJobName'];_0x352d84[_0xf10d('0x78')]=_0x39f619[_0xf10d('0x76')][_0xf10d('0x79')];return _0x5d2fa7(_0x352d84);})[_0xf10d('0x4b')](function(_0x55fcbe){return _0xa3dbef(_0x55fcbe);});});}exports['runTranscribe']=function(_0x9762b8,_0xbbae18,_0x5b84d3){var _0x9275cc;var _0x782367;var _0x10ae03;var _0x34f679=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x9762b8[_0xf10d('0x47')]['id']}})[_0xf10d('0x27')](function(_0x388504){if(_0x388504){var _0x1a6c31=util['format'](_0xf10d('0x53'),_0x388504['value']);if(fs['existsSync'](_0x1a6c31)){cypher=!![];return _0x34f679[_0xf10d('0x55')](_0x1a6c31,_0x388504[_0xf10d('0x52')],config[_0xf10d('0x56')][_0xf10d('0x7a')])[_0xf10d('0x27')](function(){return _0x388504;});}return _0x388504;}})[_0xf10d('0x27')](function(_0x4825db){if(!_0x4825db){throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))](_0xf10d('0x7b'));}_0x782367=_0x4825db;return db['Setting'][_0xf10d('0x7c')]({'where':{'id':0x1}});})[_0xf10d('0x27')](handleEntityNotFound(_0xbbae18,null))[_0xf10d('0x27')](function(_0x236763){if(_0x236763){_0x9275cc=_0x236763;if(!_0x9275cc[_0xf10d('0x7d')]||!_0x9275cc['transcribeAccountId']||!_0x9275cc[_0xf10d('0x7e')]||!_0x9275cc[_0xf10d('0x7f')]||!_0x9275cc[_0xf10d('0x71')]){throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))](_0xf10d('0x80'));}if(_0x9762b8[_0xf10d('0x4d')]['runSentiment']&&(!_0x9275cc[_0xf10d('0x81')]||!_0x9275cc['sentimentAccountId']||!_0x9275cc[_0xf10d('0x82')]||!_0x9275cc[_0xf10d('0x7f')]||!_0x9275cc[_0xf10d('0x71')])){throw new db['Sequelize']['ValidationError'](_0xf10d('0x83'));}return db[_0xf10d('0x84')][_0xf10d('0x7c')]({'where':{'id':_0x9275cc[_0xf10d('0x85')]}});}})[_0xf10d('0x27')](function(_0x4ac86f){if(!_0x4ac86f){throw new db[(_0xf10d('0x57'))]['ValidationError'](_0xf10d('0x86'));}if(!_0x4ac86f[_0xf10d('0x87')]||!_0x4ac86f['data2']){throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))](_0xf10d('0x88'));}_0x10ae03=_0x4ac86f;return getBucketslist(_0x10ae03['data1'],_0x10ae03[_0xf10d('0x89')],_0x9275cc[_0xf10d('0x7e')]);})[_0xf10d('0x27')](function(_0x1818a5){if(_0x1818a5&&_0x1818a5[_0xf10d('0x8a')]){var _0x385f96=_['find'](_0x1818a5['Buckets'],function(_0x3dd811){return _0x3dd811[_0xf10d('0x8b')]===_0x9275cc[_0xf10d('0x71')];});if(!_0x385f96){logger[_0xf10d('0x6c')](util[_0xf10d('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x9762b8['params']['id'],_0x9275cc[_0xf10d('0x71')]));return createBucket(_0x10ae03[_0xf10d('0x87')],_0x10ae03[_0xf10d('0x89')],_0x9275cc[_0xf10d('0x7e')],_0x9275cc['bucket']);}logger[_0xf10d('0x6c')](util[_0xf10d('0x32')](_0xf10d('0x8c'),_0x9762b8[_0xf10d('0x47')]['id'],_0x9275cc[_0xf10d('0x71')]));return;}})['then'](function(_0x2433b8){if(_0x782367[_0xf10d('0x78')]===_0xf10d('0x8d')){return transcribe(_0x9762b8[_0xf10d('0x47')]['id'],_0x10ae03['data1'],_0x10ae03['data2'],_0x9275cc['transcribeRegion'],_0x9275cc['bucket'],_0x782367['value'],_0x9275cc[_0xf10d('0x7f')]);}else{logger[_0xf10d('0x6c')](util[_0xf10d('0x32')](_0xf10d('0x8e'),_0x9762b8['params']['id']));return{'transcribeStatus':_0xf10d('0x8f')};}})[_0xf10d('0x27')](function(_0x1c572c){if(_0x1c572c){_0x1c572c[_0xf10d('0x90')]=_0x9762b8['body'][_0xf10d('0x91')];return _0x782367[_0xf10d('0x92')](_0x1c572c);}})[_0xf10d('0x27')](respondWithResult(_0xbbae18,null))[_0xf10d('0x4b')](handleError(_0xbbae18,null));};function writeFile(_0x212b0d,_0x2005d0){return new Promise(function(_0x37f5aa,_0x569510){fs[_0xf10d('0x93')](_0x2005d0,_0x212b0d,function(_0x4b975b,_0x2a3bb9){if(_0x4b975b){return _0x569510(_0x4b975b);}else{return _0x37f5aa(_0x2a3bb9);}});});}exports[_0xf10d('0x94')]=function(_0x1097cf,_0x631729,_0x4ec3b6){return db[_0xf10d('0x2e')]['findOne']({'where':{'id':_0x1097cf['params']['id']}})[_0xf10d('0x27')](handleEntityNotFound(_0x631729))[_0xf10d('0x27')](function(_0x4080ad){if(_0x4080ad&&_0x4080ad[_0xf10d('0x95')]){var _0x4981c1=_0x4080ad[_0xf10d('0x95')];var _0x45850b=config[_0xf10d('0x96')]+'/server/files/transcribes/transcribe_'+_0x4080ad['id']+_0xf10d('0x97');if(fs[_0xf10d('0x54')](_0x45850b)){return _0x45850b;}return writeFile(_0x4981c1,_0x45850b)[_0xf10d('0x27')](function(){return _0x45850b;});}else{throw new db[(_0xf10d('0x57'))][(_0xf10d('0x58'))](_0xf10d('0x98'));}})[_0xf10d('0x27')](function(_0x41d2cd){return _0x631729[_0xf10d('0x4f')](_0x41d2cd);})[_0xf10d('0x4b')](handleError(_0x631729));}; \ No newline at end of file +var _0x6086=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','VIRTUAL','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','downloads','sequelize','MD5','col','token','$and','push','filename','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x5787ce,_0x16619a){var _0x265296=function(_0x260d25){while(--_0x260d25){_0x5787ce['push'](_0x5787ce['shift']());}};_0x265296(++_0x16619a);}(_0x6086,0x1b6));var _0x6608=function(_0x3afb74,_0x526a74){_0x3afb74=_0x3afb74-0x0;var _0x23cea0=_0x6086[_0x3afb74];return _0x23cea0;};'use strict';var emlformat=require(_0x6608('0x0'));var rimraf=require(_0x6608('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6608('0x2'));var rp=require(_0x6608('0x3'));var moment=require(_0x6608('0x4'));var BPromise=require(_0x6608('0x5'));var Mustache=require(_0x6608('0x6'));var util=require(_0x6608('0x7'));var path=require(_0x6608('0x8'));var sox=require('sox');var csv=require(_0x6608('0x9'));var ejs=require(_0x6608('0xa'));var fs=require('fs');var fs_extra=require(_0x6608('0xb'));var _=require(_0x6608('0xc'));var squel=require(_0x6608('0xd'));var crypto=require(_0x6608('0xe'));var jsforce=require(_0x6608('0xf'));var deskjs=require(_0x6608('0x10'));var toCsv=require(_0x6608('0x9'));var querystring=require(_0x6608('0x11'));var Papa=require(_0x6608('0x12'));var AWS=require(_0x6608('0x13'));var uuidv4=require(_0x6608('0x14'));var Redis=require(_0x6608('0x15'));var authService=require(_0x6608('0x16'));var qs=require(_0x6608('0x17'));var as=require(_0x6608('0x18'));var hardwareService=require(_0x6608('0x19'));var logger=require(_0x6608('0x1a'))(_0x6608('0x1b'));var utils=require(_0x6608('0x1c'));var config=require(_0x6608('0x1d'));var licenseUtil=require(_0x6608('0x1e'));var db=require(_0x6608('0x1f'))['db'];function respondWithStatusCode(_0x13b5a0,_0x398bd8){_0x398bd8=_0x398bd8||0xcc;return function(_0x3df5bc){if(_0x3df5bc){return _0x13b5a0[_0x6608('0x20')](_0x398bd8);}return _0x13b5a0[_0x6608('0x21')](_0x398bd8)[_0x6608('0x22')]();};}function respondWithResult(_0x2a5829,_0x448cd4){_0x448cd4=_0x448cd4||0xc8;return function(_0x59e844){if(_0x59e844){return _0x2a5829['status'](_0x448cd4)[_0x6608('0x23')](_0x59e844);}};}function respondWithFilteredResult(_0x2c8976,_0x8f3564){return function(_0xc3f85a){if(_0xc3f85a){var _0x4df544=typeof _0x8f3564['offset']===_0x6608('0x24')&&typeof _0x8f3564[_0x6608('0x25')]===_0x6608('0x24');var _0x6aa050=_0xc3f85a[_0x6608('0x26')];var _0x518a2e=_0x4df544?0x0:_0x8f3564[_0x6608('0x27')];var _0x3df1ca=_0x4df544?_0xc3f85a['count']:_0x8f3564[_0x6608('0x27')]+_0x8f3564[_0x6608('0x25')];var _0x21629a;if(_0x3df1ca>=_0x6aa050){_0x3df1ca=_0x6aa050;_0x21629a=0xc8;}else{_0x21629a=0xce;}_0x2c8976[_0x6608('0x21')](_0x21629a);return _0x2c8976[_0x6608('0x28')]('Content-Range',_0x518a2e+'-'+_0x3df1ca+'/'+_0x6aa050)[_0x6608('0x23')](_0xc3f85a);}return null;};}function patchUpdates(_0x11933a){return function(_0x3a55f2){try{jsonpatch[_0x6608('0x29')](_0x3a55f2,_0x11933a,!![]);}catch(_0x23ae53){return BPromise[_0x6608('0x2a')](_0x23ae53);}return _0x3a55f2[_0x6608('0x2b')]();};}function saveUpdates(_0x23aaae,_0x16f1fe){return function(_0x4237ce){if(_0x4237ce){return _0x4237ce[_0x6608('0x2c')](_0x23aaae)[_0x6608('0x2d')](function(_0x57269d){return _0x57269d;});}return null;};}function removeEntity(_0x411edd,_0x3eca31){return function(_0x238698){if(_0x238698){return _0x238698[_0x6608('0x2e')]()[_0x6608('0x2d')](function(){_0x411edd[_0x6608('0x21')](0xcc)[_0x6608('0x22')]();});}};}function handleEntityNotFound(_0x564196,_0x24bbbb){return function(_0x4d4545){if(!_0x4d4545){_0x564196[_0x6608('0x20')](0x194);}return _0x4d4545;};}function handleError(_0x32f6b9,_0x55ae3b){_0x55ae3b=_0x55ae3b||0x1f4;return function(_0x5f1263){logger[_0x6608('0x2f')](_0x5f1263[_0x6608('0x30')]);if(_0x5f1263[_0x6608('0x31')]){delete _0x5f1263[_0x6608('0x31')];}_0x32f6b9[_0x6608('0x21')](_0x55ae3b)[_0x6608('0x32')](_0x5f1263);};}exports[_0x6608('0x33')]=function(_0x332748,_0x315a59){var _0x56e843={},_0xb05d9f={},_0x20119c={'count':0x0,'rows':[]};var _0x29bfc6=_['map'](db[_0x6608('0x34')][_0x6608('0x35')],function(_0x3a8ec1){return{'name':_0x3a8ec1[_0x6608('0x36')],'type':_0x3a8ec1[_0x6608('0x37')][_0x6608('0x38')]};});_0xb05d9f[_0x6608('0x39')]=_[_0x6608('0x3a')](_['map'](_0x29bfc6,'name'),[_0x6608('0x3b')]);_0xb05d9f[_0x6608('0x3c')]=_['keys'](_0x332748[_0x6608('0x3c')]);_0xb05d9f[_0x6608('0x3d')]=_[_0x6608('0x3e')](_0xb05d9f[_0x6608('0x39')],_0xb05d9f[_0x6608('0x3c')]);_0x56e843[_0x6608('0x3f')]=_[_0x6608('0x3e')](_0xb05d9f[_0x6608('0x39')],qs[_0x6608('0x40')](_0x332748['query'][_0x6608('0x40')]));_0x56e843[_0x6608('0x3f')]=_0x56e843[_0x6608('0x3f')][_0x6608('0x41')]?_0x56e843[_0x6608('0x3f')]:_0xb05d9f[_0x6608('0x39')];if(!_0x332748[_0x6608('0x3c')][_0x6608('0x42')](_0x6608('0x43'))){_0x56e843['limit']=qs[_0x6608('0x25')](_0x332748[_0x6608('0x3c')][_0x6608('0x25')]);_0x56e843[_0x6608('0x27')]=qs[_0x6608('0x27')](_0x332748[_0x6608('0x3c')][_0x6608('0x27')]);}_0x56e843[_0x6608('0x44')]=qs['sort'](_0x332748['query']['sort']);_0x56e843['where']=qs[_0x6608('0x3d')](_[_0x6608('0x45')](_0x332748[_0x6608('0x3c')],_0xb05d9f[_0x6608('0x3d')]),_0x29bfc6);if(_0x332748['query'][_0x6608('0x46')]){_0x56e843[_0x6608('0x47')]=_[_0x6608('0x48')](_0x56e843[_0x6608('0x47')],{'$or':_[_0x6608('0x49')](_0x29bfc6,function(_0x22958b){if(_0x22958b[_0x6608('0x37')]!==_0x6608('0x4a')){var _0x5c4ca4={};_0x5c4ca4[_0x22958b[_0x6608('0x31')]]={'$like':'%'+_0x332748[_0x6608('0x3c')][_0x6608('0x46')]+'%'};return _0x5c4ca4;}})});}_0x56e843=_['merge']({},_0x56e843,_0x332748['options']);var _0x53f885={'where':_0x56e843[_0x6608('0x47')]};return db[_0x6608('0x34')][_0x6608('0x26')](_0x53f885)['then'](function(_0x11aa15){_0x20119c['count']=_0x11aa15;if(_0x332748['query'][_0x6608('0x4b')]){_0x56e843['include']=[{'all':!![]}];}return db[_0x6608('0x34')][_0x6608('0x4c')](_0x56e843);})[_0x6608('0x2d')](function(_0x4bba95){_0x20119c['rows']=_0x4bba95;return _0x20119c;})['then'](respondWithFilteredResult(_0x315a59,_0x56e843))[_0x6608('0x4d')](handleError(_0x315a59,null));};exports[_0x6608('0x4e')]=function(_0x2308eb,_0x183d95){var _0x4f10a0={'raw':![],'where':{'id':_0x2308eb[_0x6608('0x4f')]['id']}},_0x43713a={};_0x43713a[_0x6608('0x39')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x43713a['query']=_[_0x6608('0x50')](_0x2308eb[_0x6608('0x3c')]);_0x43713a[_0x6608('0x3d')]=_['intersection'](_0x43713a['model'],_0x43713a[_0x6608('0x3c')]);_0x4f10a0[_0x6608('0x3f')]=_[_0x6608('0x3e')](_0x43713a['model'],qs[_0x6608('0x40')](_0x2308eb['query'][_0x6608('0x40')]));_0x4f10a0[_0x6608('0x3f')]=_0x4f10a0[_0x6608('0x3f')][_0x6608('0x41')]?_0x4f10a0[_0x6608('0x3f')]:_0x43713a[_0x6608('0x39')];if(_0x2308eb['query'][_0x6608('0x4b')]){_0x4f10a0[_0x6608('0x51')]=[{'all':!![]}];}_0x4f10a0=_[_0x6608('0x48')]({},_0x4f10a0,_0x2308eb[_0x6608('0x52')]);return db[_0x6608('0x34')][_0x6608('0x53')](_0x4f10a0)[_0x6608('0x2d')](handleEntityNotFound(_0x183d95,null))[_0x6608('0x2d')](respondWithResult(_0x183d95,null))[_0x6608('0x4d')](handleError(_0x183d95,null));};exports[_0x6608('0x54')]=function(_0x5d137a,_0x4b4609){return db[_0x6608('0x34')][_0x6608('0x54')](_0x5d137a[_0x6608('0x55')],{})[_0x6608('0x2d')](respondWithResult(_0x4b4609,0xc9))[_0x6608('0x4d')](handleError(_0x4b4609,null));};exports[_0x6608('0x2c')]=function(_0x24bff8,_0x2f5987){if(_0x24bff8['body']['id']){delete _0x24bff8[_0x6608('0x55')]['id'];}return db['VoiceRecording'][_0x6608('0x53')]({'where':{'id':_0x24bff8[_0x6608('0x4f')]['id']}})[_0x6608('0x2d')](handleEntityNotFound(_0x2f5987,null))[_0x6608('0x2d')](saveUpdates(_0x24bff8[_0x6608('0x55')],null))[_0x6608('0x2d')](respondWithResult(_0x2f5987,null))['catch'](handleError(_0x2f5987,null));};exports['describe']=function(_0x405e93,_0x23515f){return db['VoiceRecording']['describe']()[_0x6608('0x2d')](respondWithResult(_0x23515f,null))[_0x6608('0x4d')](handleError(_0x23515f,null));};exports[_0x6608('0x56')]=function(_0x76ffe5,_0xa6a4f4,_0x5c5915){var _0x4f0a8c=require(_0x6608('0x57'));var _0x36c84b=![];var _0x29be40={};if(_0x76ffe5[_0x6608('0x3c')][_0x6608('0x37')]&&_0x76ffe5[_0x6608('0x3c')][_0x6608('0x37')]===_0x6608('0x58')){_0x29be40[_0x6608('0x58')]=_0x76ffe5[_0x6608('0x4f')]['id'];}else{_0x29be40['id']=_0x76ffe5[_0x6608('0x4f')]['id'];}return db['VoiceRecording'][_0x6608('0x53')]({'where':_0x29be40,'attributes':['id','value'],'raw':!![]})[_0x6608('0x2d')](handleEntityNotFound(_0xa6a4f4,null))[_0x6608('0x2d')](function(_0x419e84){if(_0x419e84){var _0x4a5db4=_0x419e84[_0x6608('0x59')];var _0x516fa9=util['format'](_0x6608('0x5a'),_0x4a5db4);if(fs['existsSync'](_0x516fa9)){_0x36c84b=!![];return _0x4f0a8c[_0x6608('0x5b')](_0x516fa9,_0x4a5db4,config[_0x6608('0x5c')][_0x6608('0x5d')])['then'](function(){return _0x419e84;});}return _0x419e84;}})[_0x6608('0x2d')](function(_0x4aa896){if(_0x4aa896){var _0x57593d=_0x4aa896['value'];if(!fs[_0x6608('0x5e')](_0x57593d)){throw new db[(_0x6608('0x5f'))][(_0x6608('0x60'))](_0x6608('0x61'));}if(_0x4aa896['filename']){return _0xa6a4f4[_0x6608('0x56')](_0x57593d,_0x4aa896['filename']+path[_0x6608('0x62')](_0x57593d),function(){if(_0x36c84b){fs[_0x6608('0x63')](_0x57593d);}});}else{return _0xa6a4f4[_0x6608('0x56')](_0x57593d,function(_0x1d4138){if(_0x36c84b){fs[_0x6608('0x63')](_0x57593d);}});}}})[_0x6608('0x4d')](function(_0x5d4002){if(_0x5d4002['message']===_0x6608('0x61')){_0xa6a4f4[_0x6608('0x21')](0x194)[_0x6608('0x32')]('Not\x20found');}else{return handleError(_0xa6a4f4,null);}});};exports[_0x6608('0x64')]=function(_0x4cb4d5,_0x531544,_0x56d231){var _0x3f6deb=require(_0x6608('0x57'));var _0x5b08b6=![];var _0x3490a8={'$and':[db['sequelize'][_0x6608('0x47')](db[_0x6608('0x65')]['fn'](_0x6608('0x66'),db[_0x6608('0x65')][_0x6608('0x67')](_0x6608('0x58'))),_0x4cb4d5[_0x6608('0x3c')][_0x6608('0x68')])]};if(_0x4cb4d5['query'][_0x6608('0x37')]&&_0x4cb4d5[_0x6608('0x3c')][_0x6608('0x37')]===_0x6608('0x58')){_0x3490a8[_0x6608('0x69')][_0x6608('0x6a')]({'uniqueid':_0x4cb4d5[_0x6608('0x4f')]['id']});}else{_0x3490a8['$and'][_0x6608('0x6a')]({'id':_0x4cb4d5['params']['id']});}return db[_0x6608('0x34')][_0x6608('0x53')]({'where':_0x3490a8,'attributes':['id',_0x6608('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x531544,null))[_0x6608('0x2d')](function(_0x25e919){if(_0x25e919){var _0x2f8bf2=util[_0x6608('0x3b')](_0x6608('0x5a'),_0x25e919['value']);if(fs[_0x6608('0x5e')](_0x2f8bf2)){_0x5b08b6=!![];return _0x3f6deb[_0x6608('0x5b')](_0x2f8bf2,_0x25e919[_0x6608('0x59')],config[_0x6608('0x5c')][_0x6608('0x5d')])[_0x6608('0x2d')](function(){return _0x25e919;});}return _0x25e919;}})[_0x6608('0x2d')](function(_0x41f347){if(_0x41f347){if(!fs[_0x6608('0x5e')](_0x41f347[_0x6608('0x59')])){throw new db['Sequelize']['ValidationError'](_0x6608('0x61'));}if(_0x41f347[_0x6608('0x6b')]){return _0x531544['download'](_0x41f347[_0x6608('0x59')],_0x41f347['filename']+path['extname'](_0x41f347[_0x6608('0x59')]),function(){if(_0x5b08b6){fs[_0x6608('0x63')](_0x41f347[_0x6608('0x59')]);}});}else{return _0x531544[_0x6608('0x56')](_0x41f347['value'],function(_0x2942bf){if(_0x5b08b6){fs[_0x6608('0x63')](_0x41f347[_0x6608('0x59')]);}});}}})[_0x6608('0x4d')](handleError(_0x531544,null));};exports['destroy']=function(_0x3f8c3a,_0xf0ae77){return db[_0x6608('0x34')][_0x6608('0x53')]({'where':{'id':_0x3f8c3a[_0x6608('0x4f')]['id']}})['then'](function(_0x2fa85d){if(_[_0x6608('0x6c')](_0x2fa85d)){throw new ReferenceError(_0x6608('0x6d'));}return _0x2fa85d;})[_0x6608('0x2d')](function(_0xb2a0b7){var _0x579300=_0xb2a0b7[_0x6608('0x59')];logger[_0x6608('0x6e')](_0x6608('0x6f'),_0x579300);if(!_[_0x6608('0x6c')](_0xb2a0b7[_0x6608('0x59')])&&fs['existsSync'](_0x579300)){logger[_0x6608('0x6e')](_0x6608('0x70')+_0x579300+_0x6608('0x71'));fs['unlinkSync'](_0x579300);}_0x579300=_0x579300+'.cypher';if(!_[_0x6608('0x6c')](_0xb2a0b7[_0x6608('0x59')])&&fs[_0x6608('0x5e')](_0x579300)){logger[_0x6608('0x6e')](_0x6608('0x70')+_0x579300+_0x6608('0x71'));fs['unlinkSync'](_0x579300);}return _0xb2a0b7;})[_0x6608('0x2d')](function(_0x446f61){if(!_0x446f61)throw new InternalError();return _0x446f61[_0x6608('0x2e')]();})[_0x6608('0x2d')](function(){_0xf0ae77['status'](0xcc)[_0x6608('0x22')]();})[_0x6608('0x4d')](handleError(_0xf0ae77,null));};function getBucketslist(_0x5128c4,_0x3a29f0,_0x25703b){return new Promise(function(_0x3638ea,_0x51ec6b){var _0x4db55c=new AWS['S3']({'accessKeyId':_0x3a29f0,'secretAccessKey':_0x5128c4,'region':_0x25703b});_0x4db55c[_0x6608('0x72')]({},function(_0x27d5d4,_0x356eef){if(_0x27d5d4){return _0x51ec6b(_0x27d5d4);}else{return _0x3638ea(_0x356eef);}});});}function createBucket(_0x1e8ddf,_0xd2b3c1,_0x5ae623,_0x51966e){return new Promise(function(_0x3b327d,_0x406b0f){var _0x493864=new AWS['S3']({'accessKeyId':_0xd2b3c1,'secretAccessKey':_0x1e8ddf,'region':_0x5ae623});_0x493864[_0x6608('0x73')]({'Bucket':_0x51966e},function(_0x19c0ef,_0x38624b){if(_0x19c0ef){return _0x406b0f(_0x19c0ef);}else{return _0x3b327d(_0x38624b);}});});}function uploadFile(_0x24add3,_0x509deb,_0x38008d,_0x51002d,_0x5dff9f,_0x23e182){return new Promise(function(_0x2ccd2d,_0x3d7413){var _0x3b4d0b=new AWS['S3']({'accessKeyId':_0x509deb,'secretAccessKey':_0x24add3,'region':_0x38008d});_0x3b4d0b['upload']({'Bucket':_0x51002d,'Key':_0x5dff9f,'Body':_0x23e182},function(_0x11ae48,_0x53ac1b){if(_0x11ae48){return _0x3d7413(_0x11ae48);}else{return _0x2ccd2d(_0x53ac1b);}});});}function startTranscribe(_0x36fb17,_0x2229c7,_0x2f48cd,_0x3767c3,_0x3ecfd1,_0x4f8ea3){return new Promise(function(_0x2e8df0,_0x4bffc0){var _0x459e09=new AWS['TranscribeService']({'accessKeyId':_0x2229c7,'secretAccessKey':_0x36fb17,'region':_0x2f48cd});_0x459e09[_0x6608('0x74')]({'TranscriptionJobName':_0x3767c3,'LanguageCode':_0x3ecfd1,'Media':{'MediaFileUri':_0x4f8ea3}},function(_0x498e5e,_0xa9e344){if(_0x498e5e){return _0x4bffc0(_0x498e5e);}else{return _0x2e8df0(_0xa9e344);}});});}function transcribe(_0x50f625,_0x563031,_0x29a2f5,_0x49b360,_0x56cab5,_0xe9cac8,_0x205351){return new Promise(function(_0x311f15,_0x1e3387){var _0x31e14c={};logger['info'](util[_0x6608('0x3b')](_0x6608('0x75'),_0x50f625,_0x56cab5));return uploadFile(_0x563031,_0x29a2f5,_0x49b360,_0x56cab5,path[_0x6608('0x76')](_0xe9cac8),fs[_0x6608('0x77')](_0xe9cac8))['then'](function(_0x4ce3ae){logger[_0x6608('0x6e')](util['format'](_0x6608('0x78'),_0x50f625,_0x56cab5,_0x4ce3ae['Location']));_0x31e14c[_0x6608('0x79')]=_0x4ce3ae[_0x6608('0x7a')];_0x31e14c['location']=_0x4ce3ae['Location'];logger[_0x6608('0x6e')](util[_0x6608('0x3b')](_0x6608('0x7b'),_0x50f625));return startTranscribe(_0x563031,_0x29a2f5,_0x49b360,uuidv4(),_0x205351,_0x4ce3ae['Location']);})[_0x6608('0x2d')](function(_0x358425){logger[_0x6608('0x6e')](util[_0x6608('0x3b')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x50f625,_0x358425['TranscriptionJob'][_0x6608('0x7c')]));_0x31e14c[_0x6608('0x7d')]=_0x358425['TranscriptionJob'][_0x6608('0x7c')];_0x31e14c[_0x6608('0x7e')]=_0x358425[_0x6608('0x7f')][_0x6608('0x80')];return _0x311f15(_0x31e14c);})[_0x6608('0x4d')](function(_0x393967){return _0x1e3387(_0x393967);});});}exports[_0x6608('0x81')]=function(_0x5c168b,_0x3032c3,_0x4a433d){var _0x243f56;var _0x1daaef;var _0x3ce03f;var _0x31bffb=require(_0x6608('0x57'));return db[_0x6608('0x34')]['findOne']({'where':{'id':_0x5c168b[_0x6608('0x4f')]['id']}})[_0x6608('0x2d')](function(_0x2fe0fd){if(_0x2fe0fd){var _0x136602=util['format'](_0x6608('0x5a'),_0x2fe0fd['value']);if(fs[_0x6608('0x5e')](_0x136602)){cypher=!![];return _0x31bffb[_0x6608('0x5b')](_0x136602,_0x2fe0fd['value'],config['secrets']['recording'])['then'](function(){return _0x2fe0fd;});}return _0x2fe0fd;}})[_0x6608('0x2d')](function(_0x53139d){if(!_0x53139d){throw new db['Sequelize'][(_0x6608('0x60'))](_0x6608('0x82'));}_0x1daaef=_0x53139d;return db[_0x6608('0x83')][_0x6608('0x84')]({'where':{'id':0x1}});})[_0x6608('0x2d')](handleEntityNotFound(_0x3032c3,null))['then'](function(_0x4e9b34){if(_0x4e9b34){_0x243f56=_0x4e9b34;if(!_0x243f56['transcribe']||!_0x243f56[_0x6608('0x85')]||!_0x243f56['transcribeRegion']||!_0x243f56[_0x6608('0x86')]||!_0x243f56[_0x6608('0x79')]){throw new db[(_0x6608('0x5f'))][(_0x6608('0x60'))](_0x6608('0x87'));}if(_0x5c168b[_0x6608('0x55')][_0x6608('0x88')]&&(!_0x243f56[_0x6608('0x89')]||!_0x243f56['sentimentAccountId']||!_0x243f56[_0x6608('0x8a')]||!_0x243f56[_0x6608('0x86')]||!_0x243f56[_0x6608('0x79')])){throw new db[(_0x6608('0x5f'))][(_0x6608('0x60'))](_0x6608('0x8b'));}return db[_0x6608('0x8c')]['findOne']({'where':{'id':_0x243f56[_0x6608('0x85')]}});}})[_0x6608('0x2d')](function(_0x2d759c){if(!_0x2d759c){throw new db[(_0x6608('0x5f'))][(_0x6608('0x60'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2d759c['data1']||!_0x2d759c['data2']){throw new db[(_0x6608('0x5f'))]['ValidationError'](_0x6608('0x8d'));}_0x3ce03f=_0x2d759c;return getBucketslist(_0x3ce03f[_0x6608('0x8e')],_0x3ce03f['data2'],_0x243f56['transcribeRegion']);})[_0x6608('0x2d')](function(_0x27cb8f){if(_0x27cb8f&&_0x27cb8f[_0x6608('0x8f')]){var _0x165349=_[_0x6608('0x53')](_0x27cb8f[_0x6608('0x8f')],function(_0x2aa9ad){return _0x2aa9ad[_0x6608('0x90')]===_0x243f56['bucket'];});if(!_0x165349){logger[_0x6608('0x6e')](util[_0x6608('0x3b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5c168b[_0x6608('0x4f')]['id'],_0x243f56['bucket']));return createBucket(_0x3ce03f[_0x6608('0x8e')],_0x3ce03f['data2'],_0x243f56['transcribeRegion'],_0x243f56['bucket']);}logger[_0x6608('0x6e')](util[_0x6608('0x3b')](_0x6608('0x91'),_0x5c168b[_0x6608('0x4f')]['id'],_0x243f56[_0x6608('0x79')]));return;}})[_0x6608('0x2d')](function(_0x1707fc){if(_0x1daaef['transcribeStatus']===_0x6608('0x92')){return transcribe(_0x5c168b[_0x6608('0x4f')]['id'],_0x3ce03f[_0x6608('0x8e')],_0x3ce03f['data2'],_0x243f56['transcribeRegion'],_0x243f56['bucket'],_0x1daaef[_0x6608('0x59')],_0x243f56[_0x6608('0x86')]);}else{logger[_0x6608('0x6e')](util[_0x6608('0x3b')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5c168b['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x52a942){if(_0x52a942){_0x52a942['tempSentiment']=_0x5c168b[_0x6608('0x55')][_0x6608('0x88')];return _0x1daaef[_0x6608('0x93')](_0x52a942);}})[_0x6608('0x2d')](respondWithResult(_0x3032c3,null))['catch'](handleError(_0x3032c3,null));};function writeFile(_0x4083aa,_0x281a36){return new Promise(function(_0x32c8a9,_0x442288){fs[_0x6608('0x94')](_0x281a36,_0x4083aa,function(_0x3ab900,_0x41fad9){if(_0x3ab900){return _0x442288(_0x3ab900);}else{return _0x32c8a9(_0x41fad9);}});});}exports['downloadTranscribe']=function(_0x250e07,_0x48bac1,_0x51f680){return db[_0x6608('0x34')][_0x6608('0x84')]({'where':{'id':_0x250e07[_0x6608('0x4f')]['id']}})[_0x6608('0x2d')](handleEntityNotFound(_0x48bac1))[_0x6608('0x2d')](function(_0x1cc1ce){if(_0x1cc1ce&&_0x1cc1ce[_0x6608('0x95')]){var _0x415385=_0x1cc1ce[_0x6608('0x95')];var _0x177f52=config['root']+_0x6608('0x96')+_0x1cc1ce['id']+_0x6608('0x97');if(fs[_0x6608('0x5e')](_0x177f52)){return _0x177f52;}return writeFile(_0x415385,_0x177f52)[_0x6608('0x2d')](function(){return _0x177f52;});}else{throw new db[(_0x6608('0x5f'))][(_0x6608('0x60'))](_0x6608('0x98'));}})[_0x6608('0x2d')](function(_0x291706){return _0x48bac1[_0x6608('0x56')](_0x291706);})[_0x6608('0x4d')](handleError(_0x48bac1));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cf052d0..83e260e 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 _0x385b=['voice_recordings','uniqueid','transcribeStatus','exports','define','VoiceRecording'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0x385b,0x1a7));var _0xb385=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x385b[_0x17fea7];return _0x3150c3;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xb385('0x0')]=function(_0x4ee4ed,_0x2d214b){return _0x4ee4ed[_0xb385('0x1')](_0xb385('0x2'),attributes,{'tableName':_0xb385('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb385('0x4')]},{'name':_0xb385('0x5'),'fields':[_0xb385('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a8=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings'];(function(_0xe6ac44,_0x14e6cf){var _0x1d294f=function(_0x24577f){while(--_0x24577f){_0xe6ac44['push'](_0xe6ac44['shift']());}};_0x1d294f(++_0x14e6cf);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2a6771,_0x2886c4){_0x2a6771=_0x2a6771-0x0;var _0x11091b=_0xa8a8[_0x2a6771];return _0x11091b;};'use strict';var attributes=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]=function(_0x1934ab,_0x2dd9b7){return _0x1934ab['define'](_0x8a8a('0x2'),attributes,{'tableName':_0x8a8a('0x3'),'paranoid':![],'indexes':[{'name':_0x8a8a('0x4'),'fields':[_0x8a8a('0x4')]},{'name':_0x8a8a('0x5'),'fields':[_0x8a8a('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index eeca0b9..d523ff2 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 _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','callRecordingEncryption','create','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x3b30be,_0x47bcd9){var _0x546361=function(_0x233425){while(--_0x233425){_0x3b30be['push'](_0x3b30be['shift']());}};_0x546361(++_0x47bcd9);}(_0x9536,0x179));var _0x6953=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x9536[_0x40be86];return _0xda3c3b;};'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')]('VoiceRecording,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da771[_0x6953('0x1b')]?_0x2da771[_0x6953('0x1b')][_0x6953('0x1d')]||null:null,'attributes':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'limit':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1f')]||null:null})[_0x6953('0xc')](function(_0x171dd8){logger['info'](_0x6953('0x17'),_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x171dd8));_0x10858a(_0x171dd8);})['catch'](function(_0x5a4cd7){logger[_0x6953('0x12')](_0x6953('0x17'),_0x5a4cd7['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x5a4cd7['message']));});});};exports[_0x6953('0x20')]=function(_0x2bf39b){var _0xcdbce8=this;return new Promise(function(_0x2cc01e,_0x191d80){var _0x1497e3=require('../../components/encryptor');var _0x3dd890;return db[_0x6953('0x21')]['findOne']({'attributes':['id',_0x6953('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x173b3c){_0x3dd890=_0x173b3c;return db[_0x6953('0x18')][_0x6953('0x23')](_0x2bf39b['body']);})[_0x6953('0xc')](function(_0x3d7b04){if(_0x3dd890[_0x6953('0x22')]&&fs['existsSync'](_0x3d7b04[_0x6953('0x24')])){var _0x132a71=util['format']('%s.cypher',_0x3d7b04[_0x6953('0x24')]);return _0x1497e3[_0x6953('0x25')](_0x3d7b04[_0x6953('0x24')],_0x132a71,config[_0x6953('0x26')][_0x6953('0x27')])['then'](function(){fs[_0x6953('0x28')](_0x3d7b04['value']);logger[_0x6953('0x15')](_0x6953('0x29'));return _0x3d7b04;});}return _0x3d7b04;})['then'](function(_0x4a4d41){logger[_0x6953('0x15')](_0x6953('0x20'),_0x2bf39b);logger[_0x6953('0xf')]('CreateVoiceRecording',_0x2bf39b,JSON[_0x6953('0x11')](_0x4a4d41));_0x2cc01e(_0x4a4d41);})['catch'](function(_0x4e95f1){logger['error']('CreateVoiceRecording',_0x4e95f1[_0x6953('0x14')],_0x2bf39b);_0x191d80(_0xcdbce8[_0x6953('0x12')](0x1f4,_0x4e95f1[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x1893=['http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','then','existsSync','value','format','%s.cypher','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21e3d5,_0x443510){var _0x37fff5=function(_0x177dbc){while(--_0x177dbc){_0x21e3d5['push'](_0x21e3d5['shift']());}};_0x37fff5(++_0x443510);}(_0x1893,0xa2));var _0x3189=function(_0x153597,_0x492f6f){_0x153597=_0x153597-0x0;var _0x27d9de=_0x1893[_0x153597];return _0x27d9de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')](_0xf8aed7[_0x3189('0x18')],{'raw':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1b')]||null:null,'attributes':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1c')]||null:null,'limit':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7['options'][_0x3189('0x1d')]||null:null})['then'](function(_0x4bfc03){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x4bfc03));_0x9905c4(_0x4bfc03);})['catch'](function(_0x4b03ad){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4b03ad[_0x3189('0x13')],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4b03ad[_0x3189('0x13')]));});});};exports[_0x3189('0x1e')]=function(_0xdda38b){var _0x379a48=this;return new Promise(function(_0x17b540,_0x5ec0ac){var _0x5ce5f5=require('../../components/encryptor');var _0x5aa34a;return db[_0x3189('0x1f')][_0x3189('0x20')]({'attributes':['id',_0x3189('0x21')],'where':{'id':0x1},'raw':!![]})[_0x3189('0x22')](function(_0x36b258){_0x5aa34a=_0x36b258;return db[_0x3189('0x16')]['create'](_0xdda38b[_0x3189('0x18')]);})[_0x3189('0x22')](function(_0x4bd677){if(_0x5aa34a[_0x3189('0x21')]&&fs[_0x3189('0x23')](_0x4bd677[_0x3189('0x24')])){var _0x5c7a36=util[_0x3189('0x25')](_0x3189('0x26'),_0x4bd677[_0x3189('0x24')]);return _0x5ce5f5['encryptFile'](_0x4bd677[_0x3189('0x24')],_0x5c7a36,config[_0x3189('0x27')]['recording'])[_0x3189('0x22')](function(){fs[_0x3189('0x28')](_0x4bd677[_0x3189('0x24')]);logger[_0x3189('0x14')](_0x3189('0x29'));return _0x4bd677;});}return _0x4bd677;})['then'](function(_0x544c49){logger[_0x3189('0x14')]('CreateVoiceRecording',_0xdda38b);logger[_0x3189('0xe')](_0x3189('0x1e'),_0xdda38b,JSON[_0x3189('0x10')](_0x544c49));_0x17b540(_0x544c49);})[_0x3189('0x2a')](function(_0x231d72){logger[_0x3189('0x11')](_0x3189('0x1e'),_0x231d72[_0x3189('0x13')],_0xdda38b);_0x5ec0ac(_0x379a48[_0x3189('0x11')](0x1f4,_0x231d72['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 17aec4a..d377e30 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 _0xf0f8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xf0f8,0x69));var _0x8f0f=function(_0x3b4f86,_0x1c3605){_0x3b4f86=_0x3b4f86-0x0;var _0x2d4eca=_0xf0f8[_0x3b4f86];return _0x2d4eca;};'use strict';var multer=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var path=require('path');var timeout=require(_0x8f0f('0x2'));var express=require('express');var router=express[_0x8f0f('0x3')]();var fs_extra=require(_0x8f0f('0x4'));var auth=require(_0x8f0f('0x5'));var interaction=require(_0x8f0f('0x6'));var config=require(_0x8f0f('0x7'));var controller=require(_0x8f0f('0x8'));router[_0x8f0f('0x9')]('/',auth[_0x8f0f('0xa')](),controller[_0x8f0f('0xb')]);router['get'](_0x8f0f('0xc'),auth[_0x8f0f('0xa')](),controller[_0x8f0f('0xd')]);router['get'](_0x8f0f('0xe'),auth[_0x8f0f('0xa')](),controller[_0x8f0f('0xf')]);router[_0x8f0f('0x10')]('/',auth['isAuthenticated'](),controller[_0x8f0f('0x11')]);router[_0x8f0f('0x12')]('/:id',auth[_0x8f0f('0xa')](),controller[_0x8f0f('0x13')]);router['delete'](_0x8f0f('0xe'),auth[_0x8f0f('0xa')](),controller[_0x8f0f('0x14')]);module[_0x8f0f('0x15')]=router; \ No newline at end of file +var _0x9113=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x4e76cb,_0x2ef7b7){var _0x1ed090=function(_0x1fbd36){while(--_0x1fbd36){_0x4e76cb['push'](_0x4e76cb['shift']());}};_0x1ed090(++_0x2ef7b7);}(_0x9113,0x1c4));var _0x3911=function(_0x39c630,_0x174095){_0x39c630=_0x39c630-0x0;var _0x265066=_0x9113[_0x39c630];return _0x265066;};'use strict';var multer=require('multer');var util=require(_0x3911('0x0'));var path=require(_0x3911('0x1'));var timeout=require(_0x3911('0x2'));var express=require('express');var router=express[_0x3911('0x3')]();var fs_extra=require(_0x3911('0x4'));var auth=require(_0x3911('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3911('0x6'));var controller=require(_0x3911('0x7'));router[_0x3911('0x8')]('/',auth[_0x3911('0x9')](),controller[_0x3911('0xa')]);router[_0x3911('0x8')](_0x3911('0xb'),auth[_0x3911('0x9')](),controller[_0x3911('0xc')]);router[_0x3911('0x8')](_0x3911('0xd'),auth[_0x3911('0x9')](),controller[_0x3911('0xe')]);router[_0x3911('0xf')]('/',auth[_0x3911('0x9')](),controller[_0x3911('0x10')]);router[_0x3911('0x11')]('/:id',auth[_0x3911('0x9')](),controller[_0x3911('0x12')]);router[_0x3911('0x13')](_0x3911('0xd'),auth['isAuthenticated'](),controller[_0x3911('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index edbe200..2e58af0 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 _0xb3c4=['attended','STRING','Yes','moment','ENUM'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb3c4,0xad));var _0x4b3c=function(_0x5a9515,_0x149a83){_0x5a9515=_0x5a9515-0x0;var _0x5d7226=_0xb3c4[_0x5a9515];return _0x5d7226;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4b3c('0x0'));module['exports']={'type':{'type':Sequelize[_0x4b3c('0x1')]('blind',_0x4b3c('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x4b3c('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x4b3c('0x3')]},'transferercalleridname':{'type':Sequelize[_0x4b3c('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4b3c('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x4b3c('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x4b3c('0x3')]},'transferercontext':{'type':Sequelize[_0x4b3c('0x3')]},'transfererexten':{'type':Sequelize[_0x4b3c('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x4b3c('0x3')]},'transfereechannel':{'type':Sequelize[_0x4b3c('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x4b3c('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x4b3c('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x4b3c('0x3')]},'transfereecontext':{'type':Sequelize[_0x4b3c('0x3')]},'transfereeexten':{'type':Sequelize[_0x4b3c('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x4b3c('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x4b3c('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4b3c('0x3')]}}; \ No newline at end of file +var _0x677a=['Yes','moment','exports','ENUM','blind','attended','STRING'];(function(_0x424d84,_0x1ae7b3){var _0x470900=function(_0x5c5eb8){while(--_0x5c5eb8){_0x424d84['push'](_0x424d84['shift']());}};_0x470900(++_0x1ae7b3);}(_0x677a,0x1cf));var _0xa677=function(_0x95a723,_0x37822d){_0x95a723=_0x95a723-0x0;var _0x3d5bfe=_0x677a[_0x95a723];return _0x3d5bfe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa677('0x0'));module[_0xa677('0x1')]={'type':{'type':Sequelize[_0xa677('0x2')](_0xa677('0x3'),_0xa677('0x4'))},'result':{'type':Sequelize[_0xa677('0x5')]},'transfererchannel':{'type':Sequelize[_0xa677('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xa677('0x5')]},'transferercalleridname':{'type':Sequelize[_0xa677('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa677('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa677('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xa677('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xa677('0x5')]},'transfereeexten':{'type':Sequelize[_0xa677('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xa677('0x5')]},'isexternal':{'type':Sequelize[_0xa677('0x2')](_0xa677('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa677('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 45064b1..5170a98 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 _0xbcd2=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x21c31d,_0x4e6ee5){var _0x57ec28=function(_0x50ae6b){while(--_0x50ae6b){_0x21c31d['push'](_0x21c31d['shift']());}};_0x57ec28(++_0x4e6ee5);}(_0xbcd2,0x1c3));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2bcd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bcd('0x1'));var jsonpatch=require(_0x2bcd('0x2'));var rp=require(_0x2bcd('0x3'));var moment=require(_0x2bcd('0x4'));var BPromise=require(_0x2bcd('0x5'));var Mustache=require(_0x2bcd('0x6'));var util=require(_0x2bcd('0x7'));var path=require(_0x2bcd('0x8'));var sox=require(_0x2bcd('0x9'));var csv=require(_0x2bcd('0xa'));var ejs=require(_0x2bcd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bcd('0xc'));var squel=require(_0x2bcd('0xd'));var crypto=require(_0x2bcd('0xe'));var jsforce=require(_0x2bcd('0xf'));var deskjs=require(_0x2bcd('0x10'));var toCsv=require(_0x2bcd('0xa'));var querystring=require(_0x2bcd('0x11'));var Papa=require(_0x2bcd('0x12'));var Redis=require(_0x2bcd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2bcd('0x14'));var as=require(_0x2bcd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bcd('0x16'));var utils=require(_0x2bcd('0x17'));var config=require(_0x2bcd('0x18'));var licenseUtil=require(_0x2bcd('0x19'));var db=require(_0x2bcd('0x1a'))['db'];function respondWithStatusCode(_0x2ba5c8,_0x49b9a2){_0x49b9a2=_0x49b9a2||0xcc;return function(_0x30f571){if(_0x30f571){return _0x2ba5c8[_0x2bcd('0x1b')](_0x49b9a2);}return _0x2ba5c8['status'](_0x49b9a2)['end']();};}function respondWithResult(_0x4049bb,_0x444d9e){_0x444d9e=_0x444d9e||0xc8;return function(_0x64432b){if(_0x64432b){return _0x4049bb['status'](_0x444d9e)[_0x2bcd('0x1c')](_0x64432b);}};}function respondWithFilteredResult(_0x3fe0ac,_0x2d358f){return function(_0x1d7d36){if(_0x1d7d36){var _0x398862=typeof _0x2d358f[_0x2bcd('0x1d')]==='undefined'&&typeof _0x2d358f['limit']===_0x2bcd('0x1e');var _0x41c4ad=_0x1d7d36[_0x2bcd('0x1f')];var _0x42b59e=_0x398862?0x0:_0x2d358f[_0x2bcd('0x1d')];var _0x33bd3b=_0x398862?_0x1d7d36[_0x2bcd('0x1f')]:_0x2d358f['offset']+_0x2d358f[_0x2bcd('0x20')];var _0x674e74;if(_0x33bd3b>=_0x41c4ad){_0x33bd3b=_0x41c4ad;_0x674e74=0xc8;}else{_0x674e74=0xce;}_0x3fe0ac[_0x2bcd('0x21')](_0x674e74);return _0x3fe0ac['set'](_0x2bcd('0x22'),_0x42b59e+'-'+_0x33bd3b+'/'+_0x41c4ad)[_0x2bcd('0x1c')](_0x1d7d36);}return null;};}function patchUpdates(_0x39df9c){return function(_0x2a2459){try{jsonpatch[_0x2bcd('0x23')](_0x2a2459,_0x39df9c,!![]);}catch(_0x389c29){return BPromise[_0x2bcd('0x24')](_0x389c29);}return _0x2a2459[_0x2bcd('0x25')]();};}function saveUpdates(_0x50efac,_0x5c02bb){return function(_0x5c06df){if(_0x5c06df){return _0x5c06df['update'](_0x50efac)[_0x2bcd('0x26')](function(_0x4b196f){return _0x4b196f;});}return null;};}function removeEntity(_0x2f4eea,_0x3e2b89){return function(_0x17cbd5){if(_0x17cbd5){return _0x17cbd5[_0x2bcd('0x27')]()[_0x2bcd('0x26')](function(){_0x2f4eea[_0x2bcd('0x21')](0xcc)[_0x2bcd('0x28')]();});}};}function handleEntityNotFound(_0x209c89,_0x8f3978){return function(_0x7c0df8){if(!_0x7c0df8){_0x209c89[_0x2bcd('0x1b')](0x194);}return _0x7c0df8;};}function handleError(_0x29b3fe,_0x998bba){_0x998bba=_0x998bba||0x1f4;return function(_0x39eb27){logger[_0x2bcd('0x29')](_0x39eb27[_0x2bcd('0x2a')]);if(_0x39eb27[_0x2bcd('0x2b')]){delete _0x39eb27[_0x2bcd('0x2b')];}_0x29b3fe['status'](_0x998bba)[_0x2bcd('0x2c')](_0x39eb27);};}exports[_0x2bcd('0x2d')]=function(_0xd731ed,_0x3078eb){var _0x4a511f={},_0x48bcc3={},_0x49ad3a={'count':0x0,'rows':[]};var _0x508196=_[_0x2bcd('0x2e')](db['VoiceTransferReport'][_0x2bcd('0x2f')],function(_0xc7e287){return{'name':_0xc7e287[_0x2bcd('0x30')],'type':_0xc7e287[_0x2bcd('0x31')]['key']};});_0x48bcc3[_0x2bcd('0x32')]=_[_0x2bcd('0x2e')](_0x508196,_0x2bcd('0x2b'));_0x48bcc3[_0x2bcd('0x33')]=_[_0x2bcd('0x34')](_0xd731ed[_0x2bcd('0x33')]);_0x48bcc3[_0x2bcd('0x35')]=_[_0x2bcd('0x36')](_0x48bcc3[_0x2bcd('0x32')],_0x48bcc3['query']);_0x4a511f[_0x2bcd('0x37')]=_[_0x2bcd('0x36')](_0x48bcc3[_0x2bcd('0x32')],qs['fields'](_0xd731ed[_0x2bcd('0x33')][_0x2bcd('0x38')]));_0x4a511f[_0x2bcd('0x37')]=_0x4a511f[_0x2bcd('0x37')][_0x2bcd('0x39')]?_0x4a511f[_0x2bcd('0x37')]:_0x48bcc3[_0x2bcd('0x32')];if(!_0xd731ed['query']['hasOwnProperty']('nolimit')){_0x4a511f[_0x2bcd('0x20')]=qs[_0x2bcd('0x20')](_0xd731ed['query']['limit']);_0x4a511f[_0x2bcd('0x1d')]=qs[_0x2bcd('0x1d')](_0xd731ed['query'][_0x2bcd('0x1d')]);}_0x4a511f['order']=qs[_0x2bcd('0x3a')](_0xd731ed[_0x2bcd('0x33')][_0x2bcd('0x3a')]);_0x4a511f['where']=qs[_0x2bcd('0x35')](_[_0x2bcd('0x3b')](_0xd731ed[_0x2bcd('0x33')],_0x48bcc3[_0x2bcd('0x35')]),_0x508196);if(_0xd731ed[_0x2bcd('0x33')][_0x2bcd('0x3c')]){_0x4a511f[_0x2bcd('0x3d')]=_[_0x2bcd('0x3e')](_0x4a511f[_0x2bcd('0x3d')],{'$or':_[_0x2bcd('0x2e')](_0x508196,function(_0x284b95){if(_0x284b95[_0x2bcd('0x31')]!==_0x2bcd('0x3f')){var _0x566dca={};_0x566dca[_0x284b95[_0x2bcd('0x2b')]]={'$like':'%'+_0xd731ed['query'][_0x2bcd('0x3c')]+'%'};return _0x566dca;}})});}_0x4a511f=_[_0x2bcd('0x3e')]({},_0x4a511f,_0xd731ed[_0x2bcd('0x40')]);var _0x5caaf1={'where':_0x4a511f[_0x2bcd('0x3d')]};return db[_0x2bcd('0x41')][_0x2bcd('0x1f')](_0x5caaf1)[_0x2bcd('0x26')](function(_0x122b3c){_0x49ad3a['count']=_0x122b3c;if(_0xd731ed[_0x2bcd('0x33')][_0x2bcd('0x42')]){_0x4a511f[_0x2bcd('0x43')]=[{'all':!![]}];}return db[_0x2bcd('0x41')][_0x2bcd('0x44')](_0x4a511f);})['then'](function(_0x5aaa44){_0x49ad3a['rows']=_0x5aaa44;return _0x49ad3a;})[_0x2bcd('0x26')](respondWithFilteredResult(_0x3078eb,_0x4a511f))[_0x2bcd('0x45')](handleError(_0x3078eb,null));};exports[_0x2bcd('0x46')]=function(_0x34bc03,_0x5962b9){var _0x3708ab={'raw':!![],'where':{'id':_0x34bc03[_0x2bcd('0x47')]['id']}},_0x50daef={};_0x50daef[_0x2bcd('0x32')]=_[_0x2bcd('0x34')](db[_0x2bcd('0x41')][_0x2bcd('0x2f')]);_0x50daef[_0x2bcd('0x33')]=_[_0x2bcd('0x34')](_0x34bc03[_0x2bcd('0x33')]);_0x50daef[_0x2bcd('0x35')]=_['intersection'](_0x50daef[_0x2bcd('0x32')],_0x50daef[_0x2bcd('0x33')]);_0x3708ab[_0x2bcd('0x37')]=_[_0x2bcd('0x36')](_0x50daef[_0x2bcd('0x32')],qs[_0x2bcd('0x38')](_0x34bc03[_0x2bcd('0x33')][_0x2bcd('0x38')]));_0x3708ab[_0x2bcd('0x37')]=_0x3708ab[_0x2bcd('0x37')][_0x2bcd('0x39')]?_0x3708ab[_0x2bcd('0x37')]:_0x50daef['model'];if(_0x34bc03[_0x2bcd('0x33')][_0x2bcd('0x42')]){_0x3708ab[_0x2bcd('0x43')]=[{'all':!![]}];}_0x3708ab=_[_0x2bcd('0x3e')]({},_0x3708ab,_0x34bc03['options']);return db[_0x2bcd('0x41')][_0x2bcd('0x48')](_0x3708ab)[_0x2bcd('0x26')](handleEntityNotFound(_0x5962b9,null))['then'](respondWithResult(_0x5962b9,null))['catch'](handleError(_0x5962b9,null));};exports[_0x2bcd('0x49')]=function(_0x409274,_0x2791b7){return db[_0x2bcd('0x41')][_0x2bcd('0x49')](_0x409274[_0x2bcd('0x4a')],{})['then'](respondWithResult(_0x2791b7,0xc9))[_0x2bcd('0x45')](handleError(_0x2791b7,null));};exports[_0x2bcd('0x4b')]=function(_0x62cf06,_0x42e3e3){if(_0x62cf06['body']['id']){delete _0x62cf06[_0x2bcd('0x4a')]['id'];}return db[_0x2bcd('0x41')][_0x2bcd('0x48')]({'where':{'id':_0x62cf06[_0x2bcd('0x47')]['id']}})[_0x2bcd('0x26')](handleEntityNotFound(_0x42e3e3,null))[_0x2bcd('0x26')](saveUpdates(_0x62cf06[_0x2bcd('0x4a')],null))['then'](respondWithResult(_0x42e3e3,null))[_0x2bcd('0x45')](handleError(_0x42e3e3,null));};exports[_0x2bcd('0x27')]=function(_0x19e459,_0x131f24){return db[_0x2bcd('0x41')][_0x2bcd('0x48')]({'where':{'id':_0x19e459['params']['id']}})[_0x2bcd('0x26')](handleEntityNotFound(_0x131f24,null))[_0x2bcd('0x26')](removeEntity(_0x131f24,null))[_0x2bcd('0x45')](handleError(_0x131f24,null));};exports['describe']=function(_0x1c5609,_0x31653b){return db['VoiceTransferReport']['describe']()[_0x2bcd('0x26')](respondWithResult(_0x31653b,null))['catch'](handleError(_0x31653b,null));}; \ No newline at end of file +var _0x6358=['bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','offset','limit','status','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','merge','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x6358,0x93));var _0x8635=function(_0x38ae26,_0x1e5391){_0x38ae26=_0x38ae26-0x0;var _0x1550ee=_0x6358[_0x38ae26];return _0x1550ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8635('0x0'));var zipdir=require(_0x8635('0x1'));var jsonpatch=require(_0x8635('0x2'));var rp=require(_0x8635('0x3'));var moment=require(_0x8635('0x4'));var BPromise=require(_0x8635('0x5'));var Mustache=require(_0x8635('0x6'));var util=require(_0x8635('0x7'));var path=require(_0x8635('0x8'));var sox=require(_0x8635('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8635('0xa'));var _=require(_0x8635('0xb'));var squel=require(_0x8635('0xc'));var crypto=require(_0x8635('0xd'));var jsforce=require(_0x8635('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8635('0xf'));var Papa=require(_0x8635('0x10'));var Redis=require(_0x8635('0x11'));var authService=require(_0x8635('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8635('0x13'));var logger=require(_0x8635('0x14'))(_0x8635('0x15'));var utils=require(_0x8635('0x16'));var config=require(_0x8635('0x17'));var licenseUtil=require(_0x8635('0x18'));var db=require(_0x8635('0x19'))['db'];function respondWithStatusCode(_0x4dd24b,_0x4e09aa){_0x4e09aa=_0x4e09aa||0xcc;return function(_0x568798){if(_0x568798){return _0x4dd24b[_0x8635('0x1a')](_0x4e09aa);}return _0x4dd24b['status'](_0x4e09aa)[_0x8635('0x1b')]();};}function respondWithResult(_0x87aa5,_0x43ebc7){_0x43ebc7=_0x43ebc7||0xc8;return function(_0x45077e){if(_0x45077e){return _0x87aa5['status'](_0x43ebc7)[_0x8635('0x1c')](_0x45077e);}};}function respondWithFilteredResult(_0xee30b4,_0x860f51){return function(_0x610f86){if(_0x610f86){var _0x131be7=typeof _0x860f51['offset']===_0x8635('0x1d')&&typeof _0x860f51['limit']===_0x8635('0x1d');var _0x7488d4=_0x610f86['count'];var _0x48d010=_0x131be7?0x0:_0x860f51[_0x8635('0x1e')];var _0x370dca=_0x131be7?_0x610f86['count']:_0x860f51['offset']+_0x860f51[_0x8635('0x1f')];var _0x5459ef;if(_0x370dca>=_0x7488d4){_0x370dca=_0x7488d4;_0x5459ef=0xc8;}else{_0x5459ef=0xce;}_0xee30b4[_0x8635('0x20')](_0x5459ef);return _0xee30b4['set'](_0x8635('0x21'),_0x48d010+'-'+_0x370dca+'/'+_0x7488d4)[_0x8635('0x1c')](_0x610f86);}return null;};}function patchUpdates(_0x176b4a){return function(_0x5e2283){try{jsonpatch[_0x8635('0x22')](_0x5e2283,_0x176b4a,!![]);}catch(_0x2c3692){return BPromise[_0x8635('0x23')](_0x2c3692);}return _0x5e2283['save']();};}function saveUpdates(_0x347d66,_0x567ab1){return function(_0x48bd18){if(_0x48bd18){return _0x48bd18[_0x8635('0x24')](_0x347d66)[_0x8635('0x25')](function(_0xa03c7a){return _0xa03c7a;});}return null;};}function removeEntity(_0x4e7e60,_0x2c66f5){return function(_0xc5867e){if(_0xc5867e){return _0xc5867e['destroy']()[_0x8635('0x25')](function(){_0x4e7e60[_0x8635('0x20')](0xcc)[_0x8635('0x1b')]();});}};}function handleEntityNotFound(_0x579e52,_0x44406a){return function(_0x19c184){if(!_0x19c184){_0x579e52[_0x8635('0x1a')](0x194);}return _0x19c184;};}function handleError(_0x28fd5e,_0x112537){_0x112537=_0x112537||0x1f4;return function(_0x3ad49d){logger[_0x8635('0x26')](_0x3ad49d[_0x8635('0x27')]);if(_0x3ad49d[_0x8635('0x28')]){delete _0x3ad49d[_0x8635('0x28')];}_0x28fd5e[_0x8635('0x20')](_0x112537)[_0x8635('0x29')](_0x3ad49d);};}exports[_0x8635('0x2a')]=function(_0x136719,_0x45884f){var _0x3a0cae={},_0xbb7e79={},_0x547f77={'count':0x0,'rows':[]};var _0x578fe2=_[_0x8635('0x2b')](db[_0x8635('0x2c')][_0x8635('0x2d')],function(_0x3f0e3e){return{'name':_0x3f0e3e[_0x8635('0x2e')],'type':_0x3f0e3e[_0x8635('0x2f')]['key']};});_0xbb7e79[_0x8635('0x30')]=_['map'](_0x578fe2,_0x8635('0x28'));_0xbb7e79[_0x8635('0x31')]=_[_0x8635('0x32')](_0x136719[_0x8635('0x31')]);_0xbb7e79[_0x8635('0x33')]=_[_0x8635('0x34')](_0xbb7e79[_0x8635('0x30')],_0xbb7e79[_0x8635('0x31')]);_0x3a0cae['attributes']=_['intersection'](_0xbb7e79['model'],qs['fields'](_0x136719[_0x8635('0x31')][_0x8635('0x35')]));_0x3a0cae[_0x8635('0x36')]=_0x3a0cae['attributes'][_0x8635('0x37')]?_0x3a0cae[_0x8635('0x36')]:_0xbb7e79[_0x8635('0x30')];if(!_0x136719['query']['hasOwnProperty'](_0x8635('0x38'))){_0x3a0cae['limit']=qs[_0x8635('0x1f')](_0x136719[_0x8635('0x31')][_0x8635('0x1f')]);_0x3a0cae['offset']=qs['offset'](_0x136719[_0x8635('0x31')][_0x8635('0x1e')]);}_0x3a0cae['order']=qs[_0x8635('0x39')](_0x136719['query']['sort']);_0x3a0cae['where']=qs['filters'](_[_0x8635('0x3a')](_0x136719[_0x8635('0x31')],_0xbb7e79[_0x8635('0x33')]),_0x578fe2);if(_0x136719[_0x8635('0x31')][_0x8635('0x3b')]){_0x3a0cae['where']=_['merge'](_0x3a0cae[_0x8635('0x3c')],{'$or':_[_0x8635('0x2b')](_0x578fe2,function(_0x17e921){if(_0x17e921['type']!==_0x8635('0x3d')){var _0xc44881={};_0xc44881[_0x17e921[_0x8635('0x28')]]={'$like':'%'+_0x136719['query']['filter']+'%'};return _0xc44881;}})});}_0x3a0cae=_['merge']({},_0x3a0cae,_0x136719[_0x8635('0x3e')]);var _0x5bd093={'where':_0x3a0cae[_0x8635('0x3c')]};return db[_0x8635('0x2c')]['count'](_0x5bd093)[_0x8635('0x25')](function(_0x4c7818){_0x547f77[_0x8635('0x3f')]=_0x4c7818;if(_0x136719[_0x8635('0x31')]['includeAll']){_0x3a0cae[_0x8635('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8635('0x41')](_0x3a0cae);})[_0x8635('0x25')](function(_0x29fb00){_0x547f77[_0x8635('0x42')]=_0x29fb00;return _0x547f77;})[_0x8635('0x25')](respondWithFilteredResult(_0x45884f,_0x3a0cae))[_0x8635('0x43')](handleError(_0x45884f,null));};exports[_0x8635('0x44')]=function(_0x3656e4,_0x3a1f3a){var _0x2b8cfb={'raw':!![],'where':{'id':_0x3656e4[_0x8635('0x45')]['id']}},_0x58ed5f={};_0x58ed5f[_0x8635('0x30')]=_['keys'](db['VoiceTransferReport'][_0x8635('0x2d')]);_0x58ed5f[_0x8635('0x31')]=_['keys'](_0x3656e4[_0x8635('0x31')]);_0x58ed5f[_0x8635('0x33')]=_[_0x8635('0x34')](_0x58ed5f[_0x8635('0x30')],_0x58ed5f[_0x8635('0x31')]);_0x2b8cfb[_0x8635('0x36')]=_[_0x8635('0x34')](_0x58ed5f['model'],qs['fields'](_0x3656e4['query'][_0x8635('0x35')]));_0x2b8cfb[_0x8635('0x36')]=_0x2b8cfb['attributes']['length']?_0x2b8cfb[_0x8635('0x36')]:_0x58ed5f['model'];if(_0x3656e4[_0x8635('0x31')][_0x8635('0x46')]){_0x2b8cfb[_0x8635('0x40')]=[{'all':!![]}];}_0x2b8cfb=_[_0x8635('0x47')]({},_0x2b8cfb,_0x3656e4[_0x8635('0x3e')]);return db['VoiceTransferReport']['find'](_0x2b8cfb)[_0x8635('0x25')](handleEntityNotFound(_0x3a1f3a,null))[_0x8635('0x25')](respondWithResult(_0x3a1f3a,null))['catch'](handleError(_0x3a1f3a,null));};exports[_0x8635('0x48')]=function(_0x5e42d2,_0x610254){return db[_0x8635('0x2c')]['create'](_0x5e42d2[_0x8635('0x49')],{})[_0x8635('0x25')](respondWithResult(_0x610254,0xc9))['catch'](handleError(_0x610254,null));};exports[_0x8635('0x24')]=function(_0x5d44cc,_0x49e33f){if(_0x5d44cc[_0x8635('0x49')]['id']){delete _0x5d44cc[_0x8635('0x49')]['id'];}return db['VoiceTransferReport'][_0x8635('0x4a')]({'where':{'id':_0x5d44cc[_0x8635('0x45')]['id']}})['then'](handleEntityNotFound(_0x49e33f,null))[_0x8635('0x25')](saveUpdates(_0x5d44cc[_0x8635('0x49')],null))[_0x8635('0x25')](respondWithResult(_0x49e33f,null))[_0x8635('0x43')](handleError(_0x49e33f,null));};exports['destroy']=function(_0x291301,_0x35394c){return db[_0x8635('0x2c')][_0x8635('0x4a')]({'where':{'id':_0x291301[_0x8635('0x45')]['id']}})[_0x8635('0x25')](handleEntityNotFound(_0x35394c,null))[_0x8635('0x25')](removeEntity(_0x35394c,null))[_0x8635('0x43')](handleError(_0x35394c,null));};exports[_0x8635('0x4b')]=function(_0x6e7ca2,_0x31eccc){return db['VoiceTransferReport'][_0x8635('0x4b')]()[_0x8635('0x25')](respondWithResult(_0x31eccc,null))[_0x8635('0x43')](handleError(_0x31eccc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 06c4a06..eba68f9 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 _0x7766=['../../config/logger','api','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash'];(function(_0x4a5c02,_0x5dc14a){var _0x39a30f=function(_0x3fd756){while(--_0x3fd756){_0x4a5c02['push'](_0x4a5c02['shift']());}};_0x39a30f(++_0x5dc14a);}(_0x7766,0x172));var _0x6776=function(_0x1c2b9a,_0x26821f){_0x1c2b9a=_0x1c2b9a-0x0;var _0x285cce=_0x7766[_0x1c2b9a];return _0x285cce;};'use strict';var _=require(_0x6776('0x0'));var util=require('util');var logger=require(_0x6776('0x1'))(_0x6776('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6776('0x3'));var attributes=require(_0x6776('0x4'));module[_0x6776('0x5')]=function(_0xe8d397,_0x2e36f2){return _0xe8d397['define']('VoiceTransferReport',attributes,{'tableName':_0x6776('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63b2=['report_call_transfer','util','../../config/logger','moment','bluebird','request-promise','path','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63b2,0x109));var _0x263b=function(_0x1fc0af,_0x44f8df){_0x1fc0af=_0x1fc0af-0x0;var _0x31c243=_0x63b2[_0x1fc0af];return _0x31c243;};'use strict';var _=require('lodash');var util=require(_0x263b('0x0'));var logger=require(_0x263b('0x1'))('api');var moment=require(_0x263b('0x2'));var BPromise=require(_0x263b('0x3'));var rp=require(_0x263b('0x4'));var fs=require('fs');var path=require(_0x263b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x263b('0x6'));module[_0x263b('0x7')]=function(_0x47e049,_0x339a50){return _0x47e049[_0x263b('0x8')](_0x263b('0x9'),attributes,{'tableName':_0x263b('0xa'),'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 bdf77c2..5490bd6 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 _0x6843=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x2c4126,_0x3906f8){var _0x1f4ba3=function(_0x36f1e5){while(--_0x36f1e5){_0x2c4126['push'](_0x2c4126['shift']());}};_0x1f4ba3(++_0x3906f8);}(_0x6843,0xbe));var _0x3684=function(_0x151bc5,_0x2beb10){_0x151bc5=_0x151bc5-0x0;var _0x1f1df7=_0x6843[_0x151bc5];return _0x1f1df7;};'use strict';var _=require(_0x3684('0x0'));var util=require(_0x3684('0x1'));var moment=require(_0x3684('0x2'));var BPromise=require(_0x3684('0x3'));var rs=require(_0x3684('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3684('0x5'));var logger=require(_0x3684('0x6'))(_0x3684('0x7'));var config=require(_0x3684('0x8'));var jayson=require(_0x3684('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f396c,_0x1e1f4d,_0x132683){return new BPromise(function(_0x2ae591,_0x15b94e){return client[_0x3684('0xa')](_0x3f396c,_0x132683)['then'](function(_0x3d8c3d){logger[_0x3684('0xb')](_0x3684('0xc'),_0x1e1f4d,_0x3684('0xd'));logger[_0x3684('0xe')](_0x3684('0xf'),_0x1e1f4d,_0x3684('0xd'),JSON['stringify'](_0x3d8c3d));if(_0x3d8c3d['error']){if(_0x3d8c3d[_0x3684('0x10')][_0x3684('0x11')]===0x1f4){logger['error'](_0x3684('0xc'),_0x1e1f4d,_0x3d8c3d[_0x3684('0x10')][_0x3684('0x12')]);return _0x15b94e(_0x3d8c3d['error'][_0x3684('0x12')]);}logger[_0x3684('0x10')](_0x3684('0xc'),_0x1e1f4d,_0x3d8c3d[_0x3684('0x10')][_0x3684('0x12')]);return _0x2ae591(_0x3d8c3d[_0x3684('0x10')][_0x3684('0x12')]);}else{logger[_0x3684('0xb')](_0x3684('0xc'),_0x1e1f4d,_0x3684('0xd'));_0x2ae591(_0x3d8c3d[_0x3684('0x13')][_0x3684('0x12')]);}})[_0x3684('0x14')](function(_0x4c3612){logger[_0x3684('0x10')](_0x3684('0xc'),_0x1e1f4d,_0x4c3612);_0x15b94e(_0x4c3612);});});}exports[_0x3684('0x15')]=function(_0x127f96){var _0x2deee0=this;return new Promise(function(_0x384f81,_0x12be2a){return db[_0x3684('0x16')][_0x3684('0x17')](_0x127f96[_0x3684('0x18')],{'raw':_0x127f96[_0x3684('0x19')]?_0x127f96[_0x3684('0x19')][_0x3684('0x1a')]===undefined?!![]:![]:!![]})[_0x3684('0x1b')](function(_0x3e8f4e){logger[_0x3684('0xb')](_0x3684('0x15'),_0x127f96);logger['debug'](_0x3684('0x15'),_0x127f96,JSON[_0x3684('0x1c')](_0x3e8f4e));_0x384f81(_0x3e8f4e);})[_0x3684('0x14')](function(_0x17cd5e){logger[_0x3684('0x10')](_0x3684('0x15'),_0x17cd5e['message'],_0x127f96);_0x12be2a(_0x2deee0['error'](0x1f4,_0x17cd5e[_0x3684('0x12')]));});});}; \ No newline at end of file +var _0x0af5=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateVoiceTransferReport','util','moment'];(function(_0x9bab96,_0x58d5f5){var _0x3412e7=function(_0x3c7221){while(--_0x3c7221){_0x9bab96['push'](_0x9bab96['shift']());}};_0x3412e7(++_0x58d5f5);}(_0x0af5,0xd6));var _0x50af=function(_0x4ff4a3,_0x51d7ea){_0x4ff4a3=_0x4ff4a3-0x0;var _0x1ad150=_0x0af5[_0x4ff4a3];return _0x1ad150;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var moment=require(_0x50af('0x1'));var BPromise=require(_0x50af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x50af('0x4'));var logger=require(_0x50af('0x5'))(_0x50af('0x6'));var config=require(_0x50af('0x7'));var jayson=require(_0x50af('0x8'));var client=jayson[_0x50af('0x9')][_0x50af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d5f5f,_0x25b7eb,_0x25c834){return new BPromise(function(_0x5ea9f8,_0xd6d800){return client['request'](_0x1d5f5f,_0x25c834)[_0x50af('0xb')](function(_0x573dd2){logger[_0x50af('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x25b7eb,_0x50af('0xd'));logger[_0x50af('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x25b7eb,_0x50af('0xd'),JSON[_0x50af('0xf')](_0x573dd2));if(_0x573dd2[_0x50af('0x10')]){if(_0x573dd2[_0x50af('0x10')][_0x50af('0x11')]===0x1f4){logger[_0x50af('0x10')](_0x50af('0x12'),_0x25b7eb,_0x573dd2['error'][_0x50af('0x13')]);return _0xd6d800(_0x573dd2[_0x50af('0x10')]['message']);}logger[_0x50af('0x10')](_0x50af('0x12'),_0x25b7eb,_0x573dd2[_0x50af('0x10')][_0x50af('0x13')]);return _0x5ea9f8(_0x573dd2[_0x50af('0x10')][_0x50af('0x13')]);}else{logger['info'](_0x50af('0x12'),_0x25b7eb,_0x50af('0xd'));_0x5ea9f8(_0x573dd2[_0x50af('0x14')][_0x50af('0x13')]);}})[_0x50af('0x15')](function(_0x4a3229){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x25b7eb,_0x4a3229);_0xd6d800(_0x4a3229);});});}exports['CreateVoiceTransferReport']=function(_0x57d82e){var _0x31d46a=this;return new Promise(function(_0x32f5d0,_0x45fb58){return db['VoiceTransferReport'][_0x50af('0x16')](_0x57d82e[_0x50af('0x17')],{'raw':_0x57d82e['options']?_0x57d82e[_0x50af('0x18')][_0x50af('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xe22b92){logger[_0x50af('0xc')]('CreateVoiceTransferReport',_0x57d82e);logger[_0x50af('0xe')](_0x50af('0x1a'),_0x57d82e,JSON[_0x50af('0xf')](_0xe22b92));_0x32f5d0(_0xe22b92);})['catch'](function(_0x30e21a){logger[_0x50af('0x10')]('CreateVoiceTransferReport',_0x30e21a['message'],_0x57d82e);_0x45fb58(_0x31d46a[_0x50af('0x10')](0x1f4,_0x30e21a[_0x50af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 20cc00d..4d03797 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x2effdf,_0xc01bfc){var _0xd4143a=function(_0x57a7b5){while(--_0x57a7b5){_0x2effdf['push'](_0x2effdf['shift']());}};_0xd4143a(++_0xc01bfc);}(_0xf109,0xce));var _0x9f10=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf109[_0x1a9204];return _0x17ca68;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0xe7525c,_0x4b0565){var _0x50fbf5=function(_0x4d193d){while(--_0x4d193d){_0xe7525c['push'](_0xe7525c['shift']());}};_0x50fbf5(++_0x4b0565);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4d091d,_0x291413){_0x4d091d=_0x4d091d-0x0;var _0x301bcf=_0x6f0d[_0x4d091d];return _0x301bcf;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d18922a..cc9300f 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 _0x6737=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference\x20fired:','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','redis','defaults','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','stack','status','send','name','NotFound','request','then','code','message','catch','User','VoiceChannels','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','answer\x20fired:','webbar:answer'];(function(_0x33f84f,_0x33dab2){var _0x5ed7ca=function(_0x57cbfb){while(--_0x57cbfb){_0x33f84f['push'](_0x33f84f['shift']());}};_0x5ed7ca(++_0x33dab2);}(_0x6737,0xe2));var _0x7673=function(_0x4d72f1,_0x4de1e6){_0x4d72f1=_0x4d72f1-0x0;var _0x38d936=_0x6737[_0x4d72f1];return _0x38d936;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x7673('0x0'));var db=require(_0x7673('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var jayson=require(_0x7673('0x4'));var amiClient=jayson[_0x7673('0x5')]['http']({'port':0x232a});var logger=require(_0x7673('0x6'))(_0x7673('0x7'));var Redis=require('ioredis');config[_0x7673('0x8')]=_[_0x7673('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x7673('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7673('0xb')]},'callNumber':{'type':_0x7673('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x7673('0xc')},'callbackUrl':{'type':_0x7673('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':[!![],_0x7673('0xe')]},'transferNumber':{'type':_0x7673('0xc'),'required':[!![],_0x7673('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]}});function emit(_0x2a2840,_0x4a8ea0,_0x5ed354){logger[_0x7673('0x10')](_0x2a2840,_0x4a8ea0,JSON[_0x7673('0x11')](_0x5ed354));io['to'](_0x2a2840)['emit'](_0x4a8ea0,_0x5ed354);}function handleError(_0x3afbb3){return function(_0x17699a){console['log'](_0x7673('0x12'),_0x17699a,_0x17699a instanceof RangeError);logger[_0x7673('0x13')](_0x17699a[_0x7673('0x14')]);if(_0x17699a instanceof RangeError){if(_0x17699a['name']){delete _0x17699a['name'];}_0x3afbb3[_0x7673('0x15')](0x194)[_0x7673('0x16')](_0x17699a);}else{if(_0x17699a['name']){delete _0x17699a[_0x7673('0x17')];}_0x3afbb3[_0x7673('0x15')](0x1f4)[_0x7673('0x16')](_0x17699a);}};}function checkError(){return function(_0x33eb47){if(!_0x33eb47){throw new RangeError(_0x7673('0x18'));}return _0x33eb47;};}function respondWithRpcPromise(_0x3e28ca,_0x59879a){return new BPromise(function(_0x557161,_0xea9b37){var _0x21774f=amiClient;return _0x21774f[_0x7673('0x19')](_0x3e28ca,_0x59879a)[_0x7673('0x1a')](function(_0x16bb16){if(_0x16bb16['error']){if(_0x16bb16[_0x7673('0x13')][_0x7673('0x1b')]===0x1f4){return _0xea9b37(_0x16bb16[_0x7673('0x13')][_0x7673('0x1c')]);}return _0x557161(_0x16bb16[_0x7673('0x13')][_0x7673('0x1c')]);}else{_0x557161(_0x16bb16['result']);}})[_0x7673('0x1d')](function(_0xaca974){_0xea9b37(_0xaca974);});});}function getAgent(_0x425897){return db[_0x7673('0x1e')]['findOne']({'where':{'id':_0x425897,'role':'agent'}})[_0x7673('0x1a')](checkError());}function getAgentCheckSession(_0x11b42b,_0x291d10){return new BPromise(function(_0x9d9eab,_0x119a21){var _0x45a045=respondWithRpcPromise(_0x7673('0x1f'));var _0x5a59f9=getAgent(_0x11b42b);Promise['all']([_0x45a045,_0x5a59f9])[_0x7673('0x1a')](function(_0x2d4c0a){var _0x1dd436=_0x2d4c0a[0x0];var _0x335743=_0x2d4c0a[0x1];var _0x12ac6b=_[_0x7673('0x20')](_0x1dd436[_0x7673('0x21')],function(_0x4f12b9){return _0x4f12b9['UserId']==_0x335743['id']&&_0x4f12b9[_0x7673('0x22')]==_0x291d10;});if(_0x12ac6b[_0x7673('0x23')]==0x1){_0x9d9eab(_0x335743);}else{_0x119a21(new RangeError(_0x7673('0x24')+_0x291d10+_0x7673('0x25')));}});});}exports['originate']=function(_0x3aa249,_0x497760){logger[_0x7673('0x10')](_0x7673('0x26'),_0x3aa249[_0x7673('0x27')]);var _0x1b924f=originateValidation[_0x7673('0xa')](_0x3aa249[_0x7673('0x27')]);if(_0x1b924f[_0x7673('0x23')]>0x0){return _0x497760[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x1b924f);}var _0x1b6061=_0x3aa249[_0x7673('0x27')][_0x7673('0x29')];var _0x26cccd=_0x3aa249['body'][_0x7673('0x2a')];var _0x42f658=_0x3aa249[_0x7673('0x27')][_0x7673('0x2b')];var _0x30ddec=_0x3aa249[_0x7673('0x27')][_0x7673('0x2c')];return getAgent(_0x1b6061)['then'](function(_0x563e2d){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x563e2d[_0x7673('0x17')]);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x563e2d[_0x7673('0x17')]),_0x7673('0x30'),{'callNumber':_0x26cccd,'callerId':_0x42f658,'callbackUrl':_0x30ddec});return _0x497760['status'](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x31')});})['catch'](handleError(_0x497760));};exports[_0x7673('0x32')]=function(_0x400f3c,_0x287eee){logger[_0x7673('0x10')]('hangup\x20fired:',_0x400f3c[_0x7673('0x27')]);var _0x1f77c0=hangupValidation['validate'](_0x400f3c[_0x7673('0x27')]);if(_0x1f77c0[_0x7673('0x23')]>0x0){return _0x287eee[_0x7673('0x15')](0x190)['json'](_0x1f77c0);}var _0xe50aa5=_0x400f3c[_0x7673('0x27')][_0x7673('0x29')];var _0x5dfb9a=_0x400f3c['body'][_0x7673('0x22')];return getAgent(_0xe50aa5)['then'](function(_0x4ba2b4){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4ba2b4['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x4ba2b4[_0x7673('0x17')]),_0x7673('0x33'),{'sessionId':_0x5dfb9a});return _0x287eee[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':'hangup\x20executed!'});})[_0x7673('0x1d')](handleError(_0x287eee));};exports['answer']=function(_0xf43bb7,_0x52f803){logger[_0x7673('0x10')](_0x7673('0x34'),_0xf43bb7['body']);var _0x5b2e69=answerValidation[_0x7673('0xa')](_0xf43bb7['body']);if(_0x5b2e69[_0x7673('0x23')]>0x0){return _0x52f803[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x5b2e69);}var _0x3b6223=_0xf43bb7[_0x7673('0x27')]['userId'];var _0x4ea8b3=_0xf43bb7[_0x7673('0x27')][_0x7673('0x22')];return getAgent(_0x3b6223)['then'](function(_0x4005ee){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4005ee['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x4005ee[_0x7673('0x17')]),_0x7673('0x35'),{'sessionId':_0x4ea8b3});return _0x52f803[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x36')});})[_0x7673('0x1d')](handleError(_0x52f803));};exports[_0x7673('0x37')]=function(_0x4ed31d,_0x126981){logger[_0x7673('0x10')](_0x7673('0x38'),_0x4ed31d[_0x7673('0x27')]);var _0x332b5a=holdValidation[_0x7673('0xa')](_0x4ed31d[_0x7673('0x27')]);if(_0x332b5a['length']>0x0){return _0x126981[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x332b5a);}var _0x461ac3=_0x4ed31d[_0x7673('0x27')][_0x7673('0x29')];var _0x4b844d=_0x4ed31d[_0x7673('0x27')][_0x7673('0x22')];return getAgent(_0x461ac3)[_0x7673('0x1a')](function(_0x2397fb){logger[_0x7673('0x10')]('entityFound:',_0x2397fb['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x2397fb['name']),_0x7673('0x39'),{'sessionId':_0x4b844d});return _0x126981[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x3a')});})[_0x7673('0x1d')](handleError(_0x126981));};exports['unhold']=function(_0x23789d,_0x3afffa){logger[_0x7673('0x10')](_0x7673('0x3b'),_0x23789d['body']);var _0x1691a5=unholdValidation[_0x7673('0xa')](_0x23789d[_0x7673('0x27')]);if(_0x1691a5[_0x7673('0x23')]>0x0){return _0x3afffa[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x1691a5);}var _0x115eef=_0x23789d[_0x7673('0x27')][_0x7673('0x29')];var _0x362409=_0x23789d[_0x7673('0x27')]['sessionId'];return getAgent(_0x115eef)[_0x7673('0x1a')](function(_0x4a0d99){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4a0d99[_0x7673('0x17')]);emit(util['format'](_0x7673('0x2f'),_0x4a0d99[_0x7673('0x17')]),_0x7673('0x3c'),{'sessionId':_0x362409});return _0x3afffa[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x3d')});})[_0x7673('0x1d')](handleError(_0x3afffa));};exports[_0x7673('0x3e')]=function(_0x375bca,_0x1064d5){logger[_0x7673('0x10')](_0x7673('0x3f'),_0x1064d5[_0x7673('0x27')]);var _0xb3c9e9=callsValidation['validate'](_0x375bca[_0x7673('0x27')]);if(_0xb3c9e9['length']>0x0){return _0x1064d5[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0xb3c9e9);}var _0x1d424a=_0x375bca['body'][_0x7673('0x29')];var _0x5d71b7=respondWithRpcPromise('VoiceChannels');var _0x1804a4=getAgent(_0x1d424a);return Promise['all']([_0x5d71b7,_0x1804a4])['then'](function(_0x1dd141){var _0x3f6ef3=_0x1dd141[0x0];var _0x215a32=_0x1dd141[0x1];var _0xeaa731=_[_0x7673('0x20')](_0x3f6ef3[_0x7673('0x21')],function(_0x151276){return _0x151276[_0x7673('0x40')]==_0x215a32['id'];});return _0x1064d5[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'count':_0xeaa731[_0x7673('0x23')],'rows':_0xeaa731});})['catch'](handleError(_0x1064d5));};exports['conference']=function(_0x2aa032,_0x297744){logger[_0x7673('0x10')](_0x7673('0x41'),_0x2aa032[_0x7673('0x27')]);var _0x48e51c=conferenceValidation['validate'](_0x2aa032[_0x7673('0x27')]);if(_0x48e51c[_0x7673('0x23')]>0x0){return _0x297744[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x48e51c);}var _0x51c617=_0x2aa032['body'][_0x7673('0x29')];return getAgent(_0x51c617)[_0x7673('0x1a')](function(_0x1cf039){logger['info'](_0x7673('0x2d'),_0x1cf039['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x1cf039[_0x7673('0x17')]),'webbar:conference');return _0x297744[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x297744));};exports['transfer']=function(_0x32dcfc,_0x2dd367){logger[_0x7673('0x10')](_0x7673('0x42'),_0x32dcfc['body']);var _0xed9040=transferValidation['validate'](_0x32dcfc[_0x7673('0x27')]);if(_0xed9040[_0x7673('0x23')]>0x0){return _0x2dd367[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0xed9040);}var _0x5abb12=_0x32dcfc[_0x7673('0x27')][_0x7673('0x29')];var _0x308a9e=_0x32dcfc['body']['sessionId'];var _0x2d21f2=_0x32dcfc[_0x7673('0x27')][_0x7673('0x43')];return getAgent(_0x5abb12)[_0x7673('0x1a')](function(_0x20e9bd){logger['info'](_0x7673('0x2d'),_0x20e9bd[_0x7673('0x17')]);emit(util['format']('user:%s',_0x20e9bd['name']),_0x7673('0x44'),{'sessionId':_0x308a9e,'transferNumber':_0x2d21f2});return _0x2dd367[_0x7673('0x15')](0xc8)['json']({'error':![],'message':_0x7673('0x45')});})['catch'](handleError(_0x2dd367));}; \ No newline at end of file +var _0xf109=['message','result','catch','then','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','emit','log','error','name','send','status','NotFound','request'];(function(_0x548528,_0x169574){var _0x253cf4=function(_0x22b387){while(--_0x22b387){_0x548528['push'](_0x548528['shift']());}};_0x253cf4(++_0x169574);}(_0xf109,0xce));var _0x9f10=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xf109[_0x4f9b18];return _0x29f20c;};'use strict';var path=require(_0x9f10('0x0'));var fs=require('fs');var _=require(_0x9f10('0x1'));var db=require(_0x9f10('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x9f10('0x3'));var amiClient=jayson[_0x9f10('0x4')][_0x9f10('0x5')]({'port':0x232a});var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var Redis=require(_0x9f10('0x8'));config[_0x9f10('0x9')]=_[_0x9f10('0xa')](config[_0x9f10('0x9')],{'host':_0x9f10('0xb'),'port':0x18eb});var io=require(_0x9f10('0xc'))(new Redis(config['redis']));var Schema=require(_0x9f10('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'callNumber':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9f10('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]},'sessionId':{'type':_0x9f10('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x12')]},'transferNumber':{'type':_0x9f10('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x11154b,_0x5ae255,_0x14d3fe){logger[_0x9f10('0x13')](_0x11154b,_0x5ae255,JSON['stringify'](_0x14d3fe));io['to'](_0x11154b)[_0x9f10('0x14')](_0x5ae255,_0x14d3fe);}function handleError(_0xd2950c){return function(_0x509fba){console[_0x9f10('0x15')]('handleError:',_0x509fba,_0x509fba instanceof RangeError);logger[_0x9f10('0x16')](_0x509fba['stack']);if(_0x509fba instanceof RangeError){if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba['name'];}_0xd2950c['status'](0x194)[_0x9f10('0x18')](_0x509fba);}else{if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba[_0x9f10('0x17')];}_0xd2950c[_0x9f10('0x19')](0x1f4)[_0x9f10('0x18')](_0x509fba);}};}function checkError(){return function(_0x332575){if(!_0x332575){throw new RangeError(_0x9f10('0x1a'));}return _0x332575;};}function respondWithRpcPromise(_0x4cdc00,_0x366044){return new BPromise(function(_0x58e6ba,_0x293990){var _0x36ace4=amiClient;return _0x36ace4[_0x9f10('0x1b')](_0x4cdc00,_0x366044)['then'](function(_0x2f31fb){if(_0x2f31fb[_0x9f10('0x16')]){if(_0x2f31fb[_0x9f10('0x16')]['code']===0x1f4){return _0x293990(_0x2f31fb[_0x9f10('0x16')][_0x9f10('0x1c')]);}return _0x58e6ba(_0x2f31fb[_0x9f10('0x16')]['message']);}else{_0x58e6ba(_0x2f31fb[_0x9f10('0x1d')]);}})[_0x9f10('0x1e')](function(_0x11cae7){_0x293990(_0x11cae7);});});}function getAgent(_0x1647c0){return db['User']['findOne']({'where':{'id':_0x1647c0,'role':'agent'}})[_0x9f10('0x1f')](checkError());}function getAgentCheckSession(_0x4a0407,_0x314794){return new BPromise(function(_0x1de75a,_0x45fffc){var _0x2ed95b=respondWithRpcPromise(_0x9f10('0x20'));var _0x4f6b0c=getAgent(_0x4a0407);Promise[_0x9f10('0x21')]([_0x2ed95b,_0x4f6b0c])[_0x9f10('0x1f')](function(_0x40f96b){var _0xfbb37f=_0x40f96b[0x0];var _0x181aec=_0x40f96b[0x1];var _0x2c4373=_['filter'](_0xfbb37f[_0x9f10('0x22')],function(_0x501ee){return _0x501ee[_0x9f10('0x23')]==_0x181aec['id']&&_0x501ee[_0x9f10('0x24')]==_0x314794;});if(_0x2c4373['length']==0x1){_0x1de75a(_0x181aec);}else{_0x45fffc(new RangeError(_0x9f10('0x25')+_0x314794+_0x9f10('0x26')));}});});}exports[_0x9f10('0x27')]=function(_0x5dd404,_0x434128){logger['info'](_0x9f10('0x28'),_0x5dd404[_0x9f10('0x29')]);var _0x13532b=originateValidation['validate'](_0x5dd404[_0x9f10('0x29')]);if(_0x13532b[_0x9f10('0x2a')]>0x0){return _0x434128[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x13532b);}var _0x148a5b=_0x5dd404['body'][_0x9f10('0x2c')];var _0x4b54b7=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2d')];var _0x1990da=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2e')];var _0x12c486=_0x5dd404['body'][_0x9f10('0x2f')];return getAgent(_0x148a5b)[_0x9f10('0x1f')](function(_0x1b8018){logger['info'](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x1b8018['name']),_0x9f10('0x32'),{'callNumber':_0x4b54b7,'callerId':_0x1990da,'callbackUrl':_0x12c486});return _0x434128[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x33')});})[_0x9f10('0x1e')](handleError(_0x434128));};exports[_0x9f10('0x34')]=function(_0x12036c,_0x1db955){logger['info'](_0x9f10('0x35'),_0x12036c[_0x9f10('0x29')]);var _0x2fa4bf=hangupValidation['validate'](_0x12036c[_0x9f10('0x29')]);if(_0x2fa4bf[_0x9f10('0x2a')]>0x0){return _0x1db955['status'](0x190)[_0x9f10('0x2b')](_0x2fa4bf);}var _0x26f0ba=_0x12036c[_0x9f10('0x29')]['userId'];var _0x5c516c=_0x12036c[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x26f0ba)[_0x9f10('0x1f')](function(_0x433e70){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x433e70[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x433e70[_0x9f10('0x17')]),_0x9f10('0x37'),{'sessionId':_0x5c516c});return _0x1db955[_0x9f10('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x1db955));};exports[_0x9f10('0x38')]=function(_0x5c8c44,_0x420027){logger[_0x9f10('0x13')](_0x9f10('0x39'),_0x5c8c44['body']);var _0x3cfce6=answerValidation[_0x9f10('0xd')](_0x5c8c44[_0x9f10('0x29')]);if(_0x3cfce6[_0x9f10('0x2a')]>0x0){return _0x420027[_0x9f10('0x19')](0x190)['json'](_0x3cfce6);}var _0x578368=_0x5c8c44['body'][_0x9f10('0x2c')];var _0x5d08fb=_0x5c8c44[_0x9f10('0x29')]['sessionId'];return getAgent(_0x578368)[_0x9f10('0x1f')](function(_0x3e8d3c){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x3e8d3c['name']);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x3e8d3c['name']),_0x9f10('0x3a'),{'sessionId':_0x5d08fb});return _0x420027[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3b')});})[_0x9f10('0x1e')](handleError(_0x420027));};exports[_0x9f10('0x3c')]=function(_0x4bedbe,_0x281da4){logger[_0x9f10('0x13')](_0x9f10('0x3d'),_0x4bedbe['body']);var _0x181eab=holdValidation[_0x9f10('0xd')](_0x4bedbe['body']);if(_0x181eab[_0x9f10('0x2a')]>0x0){return _0x281da4[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x181eab);}var _0x1807b3=_0x4bedbe['body'][_0x9f10('0x2c')];var _0x2ae710=_0x4bedbe[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x1807b3)[_0x9f10('0x1f')](function(_0x43cb31){logger['info'](_0x9f10('0x30'),_0x43cb31[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x43cb31[_0x9f10('0x17')]),_0x9f10('0x3e'),{'sessionId':_0x2ae710});return _0x281da4['status'](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3f')});})[_0x9f10('0x1e')](handleError(_0x281da4));};exports[_0x9f10('0x40')]=function(_0x39dae3,_0x15d676){logger[_0x9f10('0x13')](_0x9f10('0x41'),_0x39dae3['body']);var _0xd1da11=unholdValidation['validate'](_0x39dae3[_0x9f10('0x29')]);if(_0xd1da11['length']>0x0){return _0x15d676[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0xd1da11);}var _0x30fad9=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x497260=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x30fad9)[_0x9f10('0x1f')](function(_0x3818dc){logger['info']('entityFound:',_0x3818dc[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')]('user:%s',_0x3818dc['name']),_0x9f10('0x42'),{'sessionId':_0x497260});return _0x15d676[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'unhold\x20executed!'});})[_0x9f10('0x1e')](handleError(_0x15d676));};exports[_0x9f10('0x43')]=function(_0x7611e8,_0x4c3d18){logger[_0x9f10('0x13')](_0x9f10('0x44'),_0x4c3d18[_0x9f10('0x29')]);var _0x48a76e=callsValidation[_0x9f10('0xd')](_0x7611e8[_0x9f10('0x29')]);if(_0x48a76e['length']>0x0){return _0x4c3d18[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x48a76e);}var _0xcd8ae7=_0x7611e8[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x55cb99=respondWithRpcPromise(_0x9f10('0x20'));var _0x53c384=getAgent(_0xcd8ae7);return Promise['all']([_0x55cb99,_0x53c384])[_0x9f10('0x1f')](function(_0x19b489){var _0x1f109a=_0x19b489[0x0];var _0x277a86=_0x19b489[0x1];var _0x2ed385=_[_0x9f10('0x45')](_0x1f109a[_0x9f10('0x22')],function(_0x4ef6c3){return _0x4ef6c3['UserId']==_0x277a86['id'];});return _0x4c3d18[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'count':_0x2ed385[_0x9f10('0x2a')],'rows':_0x2ed385});})[_0x9f10('0x1e')](handleError(_0x4c3d18));};exports[_0x9f10('0x46')]=function(_0x2094c9,_0x35460a){logger['info'](_0x9f10('0x47'),_0x2094c9[_0x9f10('0x29')]);var _0x5a777a=conferenceValidation[_0x9f10('0xd')](_0x2094c9[_0x9f10('0x29')]);if(_0x5a777a['length']>0x0){return _0x35460a[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x5a777a);}var _0x58b3b4=_0x2094c9[_0x9f10('0x29')]['userId'];return getAgent(_0x58b3b4)[_0x9f10('0x1f')](function(_0x2325aa){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2325aa[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x2325aa[_0x9f10('0x17')]),_0x9f10('0x48'));return _0x35460a['status'](0xc8)['json']({'error':![],'message':_0x9f10('0x49')});})[_0x9f10('0x1e')](handleError(_0x35460a));};exports[_0x9f10('0x4a')]=function(_0x20045f,_0xd627a2){logger[_0x9f10('0x13')](_0x9f10('0x4b'),_0x20045f['body']);var _0x3635f9=transferValidation[_0x9f10('0xd')](_0x20045f['body']);if(_0x3635f9[_0x9f10('0x2a')]>0x0){return _0xd627a2['status'](0x190)[_0x9f10('0x2b')](_0x3635f9);}var _0x354220=_0x20045f['body'][_0x9f10('0x2c')];var _0x4cbe80=_0x20045f[_0x9f10('0x29')][_0x9f10('0x24')];var _0x163165=_0x20045f['body'][_0x9f10('0x4c')];return getAgent(_0x354220)['then'](function(_0x2d704b){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2d704b['name']);emit(util[_0x9f10('0x36')]('user:%s',_0x2d704b['name']),_0x9f10('0x4d'),{'sessionId':_0x4cbe80,'transferNumber':_0x163165});return _0xd627a2[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x9f10('0x1e')](handleError(_0xd627a2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d206f73..005222e 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 _0xe3da=['/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/canned_answers',auth[_0xae3d('0xc')](),controller['getAnswers']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['get'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x17')]('/:id/dispositions',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x17')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1b')]);router['post'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['post'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller['addApplications']);router['post'](_0xae3d('0x1d'),controller[_0xae3d('0x1e')]);router[_0xae3d('0x17')](_0xae3d('0x1f'),auth[_0xae3d('0xc')](),controller['send']);router[_0xae3d('0x20')]('/:id',auth[_0xae3d('0xc')](),controller[_0xae3d('0x21')]);router[_0xae3d('0x22')](_0xae3d('0x23'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x24')]);router[_0xae3d('0x22')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x25')]);router[_0xae3d('0x22')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x26')]);router[_0xae3d('0x22')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x27')]);module[_0xae3d('0x28')]=router; \ No newline at end of file +var _0xba34=['getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions'];(function(_0x21323c,_0x2e3aef){var _0x445bc2=function(_0x9ef05c){while(--_0x9ef05c){_0x21323c['push'](_0x21323c['shift']());}};_0x445bc2(++_0x2e3aef);}(_0xba34,0x119));var _0x4ba3=function(_0x30e984,_0x33023e){_0x30e984=_0x30e984-0x0;var _0x502d1f=_0xba34[_0x30e984];return _0x502d1f;};'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('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/canned_answers',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['get'](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x14')]);router[_0x4ba3('0x15')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x15')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x15')](_0x4ba3('0x18'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x15')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x15')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller['addApplications']);router[_0x4ba3('0x15')](_0x4ba3('0x1b'),controller[_0x4ba3('0x1c')]);router[_0x4ba3('0x15')](_0x4ba3('0x1d'),auth[_0x4ba3('0x9')](),controller['send']);router['put'](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1e')]);router[_0x4ba3('0x1f')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x20')]);router[_0x4ba3('0x1f')]('/:id/dispositions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router['delete'](_0x4ba3('0x18'),auth['isAuthenticated'](),controller[_0x4ba3('0x22')]);router[_0x4ba3('0x1f')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);module[_0x4ba3('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0c5101c..bceb397 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 _0x9c79=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x531d80,_0x530508){var _0x222b7d=function(_0x122cd0){while(--_0x122cd0){_0x531d80['push'](_0x531d80['shift']());}};_0x222b7d(++_0x530508);}(_0x9c79,0x1b8));var _0x99c7=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x9c79[_0x4ae506];return _0x18e3a1;};'use strict';var Sequelize=require(_0x99c7('0x0'));var rs=require(_0x99c7('0x1'));module['exports']={'name':{'type':Sequelize[_0x99c7('0x2')],'unique':_0x99c7('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x99c7('0x4')]();}},'phone':{'type':Sequelize[_0x99c7('0x2')]},'type':{'type':Sequelize['ENUM']('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x99c7('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x99c7('0x5')],'defaultValue':function(){return _0x99c7('0x6');}},'notificationSound':{'type':Sequelize[_0x99c7('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x99c7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x99c7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99c7('0x8')],'comment':_0x99c7('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x99c7('0xa'),'set':function(_0x336625){if(!_0x336625){this[_0x99c7('0xb')](_0x99c7('0xc'),null);}this['setDataValue'](_0x99c7('0xd'),_0x336625);}},'description':{'type':Sequelize[_0x99c7('0x2')]}}; \ No newline at end of file +var _0xb896=['sequelize','randomstring','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xb896,0x1a4));var _0x6b89=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0xb896[_0x2718c7];return _0x59d89c;};'use strict';var Sequelize=require(_0x6b89('0x0'));var rs=require(_0x6b89('0x1'));module['exports']={'name':{'type':Sequelize[_0x6b89('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6b89('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6b89('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6b89('0x3')]();}},'phone':{'type':Sequelize[_0x6b89('0x2')]},'type':{'type':Sequelize[_0x6b89('0x4')](_0x6b89('0x5'),_0x6b89('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x6b89('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6b89('0x7')],'defaultValue':function(){return _0x6b89('0x8');}},'notificationSound':{'type':Sequelize[_0x6b89('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6b89('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6b89('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b89('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b89('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6b89('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b89('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6b89('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xed9974){if(!_0xed9974){this['setDataValue'](_0x6b89('0xb'),null);}this[_0x6b89('0xc')](_0x6b89('0xd'),_0xed9974);}},'description':{'type':Sequelize[_0x6b89('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f1e9f16..5fc209b 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 _0xb190=['WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','attributes','intersection','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','params','keys','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','whatsapp:','Body','messageId','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','created','close','*,*,*,*','ContactId','AttachmentId','interaction','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xb190,0x90));var _0x0b19=function(_0x20c19f,_0x2448ed){_0x20c19f=_0x20c19f-0x0;var _0xdeba0c=_0xb190[_0x20c19f];return _0xdeba0c;};'use strict';var emlformat=require(_0x0b19('0x0'));var rimraf=require(_0x0b19('0x1'));var zipdir=require(_0x0b19('0x2'));var jsonpatch=require(_0x0b19('0x3'));var rp=require('request-promise');var moment=require(_0x0b19('0x4'));var BPromise=require(_0x0b19('0x5'));var Mustache=require('mustache');var util=require(_0x0b19('0x6'));var path=require(_0x0b19('0x7'));var sox=require(_0x0b19('0x8'));var csv=require(_0x0b19('0x9'));var ejs=require(_0x0b19('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b19('0xb'));var squel=require(_0x0b19('0xc'));var crypto=require(_0x0b19('0xd'));var jsforce=require(_0x0b19('0xe'));var deskjs=require(_0x0b19('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b19('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b19('0x11'));var hardwareService=require(_0x0b19('0x12'));var logger=require(_0x0b19('0x13'))(_0x0b19('0x14'));var utils=require(_0x0b19('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0b19('0x16')]=_[_0x0b19('0x17')](config[_0x0b19('0x16')],{'host':_0x0b19('0x18'),'port':0x18eb});var socket=require(_0x0b19('0x19'))(new Redis(config[_0x0b19('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x0b19('0x1a'));var client=jayson[_0x0b19('0x1b')][_0x0b19('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2a21bd,_0xa928a6,_0x35e7f4,_0x1a8b20){return new BPromise(function(_0x4f88d5,_0x2e55a5){var _0x1c3583=_0x1a8b20||client;return _0x1c3583[_0x0b19('0x1d')](_0x2a21bd,_0x35e7f4)[_0x0b19('0x1e')](function(_0x31e4d2){logger[_0x0b19('0x1f')](_0x0b19('0x20'),_0xa928a6,_0x0b19('0x21'));logger[_0x0b19('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa928a6,_0x0b19('0x21'),JSON[_0x0b19('0x23')](_0x31e4d2));if(_0x31e4d2[_0x0b19('0x24')]){if(_0x31e4d2['error'][_0x0b19('0x25')]===0x1f4){logger['error'](_0x0b19('0x20'),_0xa928a6,_0x31e4d2['error']['message']);return _0x2e55a5(_0x31e4d2['error'][_0x0b19('0x26')]);}logger[_0x0b19('0x24')](_0x0b19('0x20'),_0xa928a6,_0x31e4d2[_0x0b19('0x24')]['message']);return _0x4f88d5(_0x31e4d2[_0x0b19('0x24')]['message']);}else{logger[_0x0b19('0x1f')](_0x0b19('0x20'),_0xa928a6,_0x0b19('0x21'));_0x4f88d5(_0x31e4d2[_0x0b19('0x27')][_0x0b19('0x26')]);}})[_0x0b19('0x28')](function(_0x283bbf){logger[_0x0b19('0x24')](_0x0b19('0x20'),_0xa928a6,_0x283bbf);_0x2e55a5(_0x283bbf);});});}function respondWithStatusCode(_0x5db1da,_0x26b9a1){_0x26b9a1=_0x26b9a1||0xcc;return function(_0x5c19dd){if(_0x5c19dd){return _0x5db1da['sendStatus'](_0x26b9a1);}return _0x5db1da[_0x0b19('0x29')](_0x26b9a1)[_0x0b19('0x2a')]();};}function respondWithResult(_0x187961,_0x215846){_0x215846=_0x215846||0xc8;return function(_0x11bacc){if(_0x11bacc){return _0x187961[_0x0b19('0x29')](_0x215846)[_0x0b19('0x2b')](_0x11bacc);}};}function respondWithFilteredResult(_0x14cef4,_0x1a2b6c){return function(_0x1fd0aa){if(_0x1fd0aa){var _0x3b6496=typeof _0x1a2b6c[_0x0b19('0x2c')]===_0x0b19('0x2d')&&typeof _0x1a2b6c[_0x0b19('0x2e')]==='undefined';var _0x184310=_0x1fd0aa['count'];var _0x11d292=_0x3b6496?0x0:_0x1a2b6c['offset'];var _0x1e8ed3=_0x3b6496?_0x1fd0aa['count']:_0x1a2b6c[_0x0b19('0x2c')]+_0x1a2b6c[_0x0b19('0x2e')];var _0x148199;if(_0x1e8ed3>=_0x184310){_0x1e8ed3=_0x184310;_0x148199=0xc8;}else{_0x148199=0xce;}_0x14cef4[_0x0b19('0x29')](_0x148199);return _0x14cef4[_0x0b19('0x2f')](_0x0b19('0x30'),_0x11d292+'-'+_0x1e8ed3+'/'+_0x184310)[_0x0b19('0x2b')](_0x1fd0aa);}return null;};}function patchUpdates(_0x5e6b55){return function(_0x1f4aed){try{jsonpatch[_0x0b19('0x31')](_0x1f4aed,_0x5e6b55,!![]);}catch(_0x21e03f){return BPromise[_0x0b19('0x32')](_0x21e03f);}return _0x1f4aed[_0x0b19('0x33')]();};}function saveUpdates(_0x2bff5e,_0x780185){return function(_0x4fc1cb){if(_0x4fc1cb){return _0x4fc1cb['update'](_0x2bff5e)[_0x0b19('0x1e')](function(_0x49fd24){return _0x49fd24;});}return null;};}function removeEntity(_0x3a6882,_0x48b1b4){return function(_0x54c17b){if(_0x54c17b){return _0x54c17b[_0x0b19('0x34')]()[_0x0b19('0x1e')](function(){var _0x819e41=_0x54c17b['get']({'plain':!![]});var _0xcd838=_0x0b19('0x35');return db[_0x0b19('0x36')]['destroy']({'where':{'type':_0xcd838,'resourceId':_0x819e41['id']}})['then'](function(){return _0x54c17b;});})[_0x0b19('0x1e')](function(){_0x3a6882['status'](0xcc)[_0x0b19('0x2a')]();});}};}function handleEntityNotFound(_0x30b5b0,_0x19c8e6){return function(_0xe041e5){if(!_0xe041e5){_0x30b5b0[_0x0b19('0x37')](0x194);}return _0xe041e5;};}function handleError(_0x26b08d,_0x3e15ce){_0x3e15ce=_0x3e15ce||0x1f4;return function(_0x489c14){logger[_0x0b19('0x24')](_0x489c14[_0x0b19('0x38')]);if(_0x489c14[_0x0b19('0x39')]){delete _0x489c14['name'];}_0x26b08d[_0x0b19('0x29')](_0x3e15ce)['send'](_0x489c14);};}exports[_0x0b19('0x3a')]=function(_0x1a243a,_0x52c5e6){var _0x33a32a={'include':[{'model':db[_0x0b19('0x3b')],'as':_0x0b19('0x3c')}]},_0x54da1c={},_0x209668={'count':0x0,'rows':[]};var _0x5e5a8f=_[_0x0b19('0x3d')](db[_0x0b19('0x3e')][_0x0b19('0x3f')],function(_0x1e015f){return{'name':_0x1e015f['fieldName'],'type':_0x1e015f[_0x0b19('0x40')][_0x0b19('0x41')]};});_0x54da1c[_0x0b19('0x42')]=_[_0x0b19('0x3d')](_0x5e5a8f,_0x0b19('0x39'));_0x54da1c[_0x0b19('0x43')]=_['keys'](_0x1a243a[_0x0b19('0x43')]);_0x54da1c['filters']=_['intersection'](_0x54da1c[_0x0b19('0x42')],_0x54da1c[_0x0b19('0x43')]);_0x33a32a[_0x0b19('0x44')]=_[_0x0b19('0x45')](_0x54da1c['model'],qs['fields'](_0x1a243a[_0x0b19('0x43')]['fields']));_0x33a32a[_0x0b19('0x44')]=_0x33a32a[_0x0b19('0x44')][_0x0b19('0x46')]?_0x33a32a[_0x0b19('0x44')]:_0x54da1c[_0x0b19('0x42')];if(!_0x1a243a[_0x0b19('0x43')][_0x0b19('0x47')]('nolimit')){_0x33a32a[_0x0b19('0x2e')]=qs['limit'](_0x1a243a[_0x0b19('0x43')][_0x0b19('0x2e')]);_0x33a32a[_0x0b19('0x2c')]=qs[_0x0b19('0x2c')](_0x1a243a[_0x0b19('0x43')][_0x0b19('0x2c')]);}_0x33a32a['order']=qs[_0x0b19('0x48')](_0x1a243a[_0x0b19('0x43')][_0x0b19('0x48')]);_0x33a32a[_0x0b19('0x49')]=qs[_0x0b19('0x4a')](_[_0x0b19('0x4b')](_0x1a243a['query'],_0x54da1c[_0x0b19('0x4a')]),_0x5e5a8f);if(_0x1a243a[_0x0b19('0x43')][_0x0b19('0x4c')]){_0x33a32a[_0x0b19('0x49')]=_['merge'](_0x33a32a[_0x0b19('0x49')],{'$or':_['map'](_0x5e5a8f,function(_0x160186){if(_0x160186[_0x0b19('0x40')]!==_0x0b19('0x4d')){var _0x1883b1={};_0x1883b1[_0x160186['name']]={'$like':'%'+_0x1a243a[_0x0b19('0x43')][_0x0b19('0x4c')]+'%'};return _0x1883b1;}})});}_0x33a32a=_[_0x0b19('0x4e')]({},_0x33a32a,_0x1a243a[_0x0b19('0x4f')]);var _0x1beb3d={'where':_0x33a32a['where']};return db[_0x0b19('0x3e')][_0x0b19('0x50')](_0x1beb3d)[_0x0b19('0x1e')](function(_0x3ccf59){_0x209668[_0x0b19('0x50')]=_0x3ccf59;if(_0x1a243a[_0x0b19('0x43')][_0x0b19('0x51')]){_0x33a32a[_0x0b19('0x52')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x33a32a);})['then'](function(_0x1d22bc){_0x209668[_0x0b19('0x53')]=_0x1d22bc;return _0x209668;})[_0x0b19('0x1e')](respondWithFilteredResult(_0x52c5e6,_0x33a32a))[_0x0b19('0x28')](handleError(_0x52c5e6,null));};exports['show']=function(_0x34403e,_0x2e5b11){var _0x15db55={'raw':![],'where':{'id':_0x34403e[_0x0b19('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x0b19('0x3c')}]},_0x51f916={};_0x51f916[_0x0b19('0x42')]=_[_0x0b19('0x55')](db[_0x0b19('0x3e')]['rawAttributes']);_0x51f916[_0x0b19('0x43')]=_[_0x0b19('0x55')](_0x34403e[_0x0b19('0x43')]);_0x51f916[_0x0b19('0x4a')]=_[_0x0b19('0x45')](_0x51f916['model'],_0x51f916[_0x0b19('0x43')]);_0x15db55[_0x0b19('0x44')]=_['intersection'](_0x51f916[_0x0b19('0x42')],qs[_0x0b19('0x56')](_0x34403e[_0x0b19('0x43')][_0x0b19('0x56')]));_0x15db55[_0x0b19('0x44')]=_0x15db55['attributes'][_0x0b19('0x46')]?_0x15db55[_0x0b19('0x44')]:_0x51f916[_0x0b19('0x42')];if(_0x34403e[_0x0b19('0x43')][_0x0b19('0x51')]){_0x15db55[_0x0b19('0x52')]=[{'all':!![]}];}_0x15db55=_['merge']({},_0x15db55,_0x34403e['options']);return db[_0x0b19('0x3e')][_0x0b19('0x57')](_0x15db55)[_0x0b19('0x1e')](handleEntityNotFound(_0x2e5b11,null))[_0x0b19('0x1e')](respondWithResult(_0x2e5b11,null))['catch'](handleError(_0x2e5b11,null));};exports[_0x0b19('0x58')]=function(_0x5e00b4,_0x5b3605){return db[_0x0b19('0x3e')][_0x0b19('0x58')](_0x5e00b4[_0x0b19('0x59')],{})['then'](function(_0x3bc05b){var _0x2092ca=_0x5e00b4['user'][_0x0b19('0x5a')]({'plain':!![]});if(!_0x2092ca)throw new Error(_0x0b19('0x5b'));if(_0x2092ca[_0x0b19('0x5c')]===_0x0b19('0x5d')){var _0x1895a7=_0x3bc05b[_0x0b19('0x5a')]({'plain':!![]});var _0x18fd31=_0x0b19('0x35');return db[_0x0b19('0x5e')][_0x0b19('0x57')]({'where':{'name':_0x18fd31,'userProfileId':_0x2092ca[_0x0b19('0x5f')]},'raw':!![]})[_0x0b19('0x1e')](function(_0x365fe0){if(_0x365fe0&&_0x365fe0[_0x0b19('0x60')]===0x0){return db[_0x0b19('0x36')][_0x0b19('0x58')]({'name':_0x1895a7[_0x0b19('0x39')],'resourceId':_0x1895a7['id'],'type':_0x365fe0['name'],'sectionId':_0x365fe0['id']},{})[_0x0b19('0x1e')](function(){return _0x3bc05b;});}else{return _0x3bc05b;}})[_0x0b19('0x28')](function(_0x35f399){logger[_0x0b19('0x24')](_0x0b19('0x61'),_0x35f399);throw _0x35f399;});}return _0x3bc05b;})[_0x0b19('0x1e')](respondWithResult(_0x5b3605,0xc9))[_0x0b19('0x28')](handleError(_0x5b3605,null));};exports[_0x0b19('0x62')]=function(_0x30083e,_0x15b51e){if(_0x30083e[_0x0b19('0x59')]['id']){delete _0x30083e['body']['id'];}return db[_0x0b19('0x3e')][_0x0b19('0x57')]({'where':{'id':_0x30083e[_0x0b19('0x54')]['id']},'include':[{'model':db[_0x0b19('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x0b19('0x1e')](handleEntityNotFound(_0x15b51e,null))[_0x0b19('0x1e')](saveUpdates(_0x30083e[_0x0b19('0x59')],null))[_0x0b19('0x1e')](respondWithResult(_0x15b51e,null))['catch'](handleError(_0x15b51e,null));};exports[_0x0b19('0x34')]=function(_0x547106,_0x11a24f){return db[_0x0b19('0x3e')][_0x0b19('0x57')]({'where':{'id':_0x547106[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x11a24f,null))[_0x0b19('0x1e')](removeEntity(_0x11a24f,null))[_0x0b19('0x28')](handleError(_0x11a24f,null));};exports[_0x0b19('0x63')]=function(_0x35bff1,_0x14fea4){return db[_0x0b19('0x3e')]['describe']()[_0x0b19('0x1e')](respondWithResult(_0x14fea4,null))[_0x0b19('0x28')](handleError(_0x14fea4,null));};exports[_0x0b19('0x64')]=function(_0x3f105f,_0x4db372,_0x35c6b2){if(_0x3f105f[_0x0b19('0x59')]['id']){delete _0x3f105f['body']['id'];}return db[_0x0b19('0x3e')][_0x0b19('0x57')]({'where':{'id':_0x3f105f[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x4db372,null))[_0x0b19('0x1e')](function(_0xf8632d){if(_0xf8632d){_0x3f105f['body'][_0x0b19('0x65')]=_0xf8632d['id'];return db[_0x0b19('0x66')]['create'](_0x3f105f['body']);}})['then'](respondWithResult(_0x4db372,null))[_0x0b19('0x28')](handleError(_0x4db372,null));};exports[_0x0b19('0x67')]=function(_0x54a809,_0x4cdba3,_0x561c27){var _0x1d417b={'raw':![],'where':{}};var _0x4c47e2={};var _0x3bd7fa={'count':0x0,'rows':[]};return db[_0x0b19('0x3e')][_0x0b19('0x68')]({'where':{'id':_0x54a809['params']['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x4cdba3,null))[_0x0b19('0x1e')](function(_0xfe8705){if(_0xfe8705){_0x4c47e2[_0x0b19('0x42')]=_[_0x0b19('0x55')](db[_0x0b19('0x66')][_0x0b19('0x3f')]);_0x4c47e2['query']=_[_0x0b19('0x55')](_0x54a809[_0x0b19('0x43')]);_0x4c47e2[_0x0b19('0x4a')]=_[_0x0b19('0x45')](_0x4c47e2[_0x0b19('0x42')],_0x4c47e2['query']);_0x1d417b[_0x0b19('0x44')]=_[_0x0b19('0x45')](_0x4c47e2[_0x0b19('0x42')],qs[_0x0b19('0x56')](_0x54a809[_0x0b19('0x43')][_0x0b19('0x56')]));_0x1d417b[_0x0b19('0x44')]=_0x1d417b[_0x0b19('0x44')][_0x0b19('0x46')]?_0x1d417b['attributes']:_0x4c47e2['model'];if(!_0x54a809['query'][_0x0b19('0x47')](_0x0b19('0x69'))){_0x1d417b['limit']=qs[_0x0b19('0x2e')](_0x54a809[_0x0b19('0x43')][_0x0b19('0x2e')]);_0x1d417b[_0x0b19('0x2c')]=qs['offset'](_0x54a809[_0x0b19('0x43')][_0x0b19('0x2c')]);}_0x1d417b[_0x0b19('0x6a')]=qs[_0x0b19('0x48')](_0x54a809[_0x0b19('0x43')]['sort']);_0x1d417b['where']=qs[_0x0b19('0x4a')](_['pick'](_0x54a809[_0x0b19('0x43')],_0x4c47e2[_0x0b19('0x4a')]));_0x1d417b[_0x0b19('0x49')]['WhatsappAccountId']=_0xfe8705['id'];if(_0x54a809[_0x0b19('0x43')][_0x0b19('0x4c')]){_0x1d417b['where']=_[_0x0b19('0x4e')](_0x1d417b[_0x0b19('0x49')],{'$or':_[_0x0b19('0x3d')](_0x1d417b['attributes'],function(_0x28cece){var _0x3daa1b={};_0x3daa1b[_0x28cece]={'$like':'%'+_0x54a809[_0x0b19('0x43')][_0x0b19('0x4c')]+'%'};return _0x3daa1b;})});}_0x1d417b=_[_0x0b19('0x4e')]({},_0x1d417b,_0x54a809[_0x0b19('0x4f')]);return db[_0x0b19('0x66')][_0x0b19('0x50')]({'where':_0x1d417b[_0x0b19('0x49')]})['then'](function(_0x17870f){_0x3bd7fa[_0x0b19('0x50')]=_0x17870f;if(_0x54a809[_0x0b19('0x43')][_0x0b19('0x51')]){_0x1d417b[_0x0b19('0x52')]=[{'all':!![]}];}return db[_0x0b19('0x66')][_0x0b19('0x6b')](_0x1d417b);})[_0x0b19('0x1e')](function(_0x178b3c){_0x3bd7fa['rows']=_0x178b3c;return _0x3bd7fa;});}})[_0x0b19('0x1e')](respondWithFilteredResult(_0x4cdba3,_0x1d417b))[_0x0b19('0x28')](handleError(_0x4cdba3,null));};exports[_0x0b19('0x6c')]=function(_0x48d79a,_0x384eaf,_0x2a61e7){return db['WhatsappAccount']['find']({'where':{'id':_0x48d79a[_0x0b19('0x54')]['id']}})['then'](handleEntityNotFound(_0x384eaf,null))['then'](function(_0xf9504b){if(_0xf9504b){return _0xf9504b['removeDispositions'](_0x48d79a[_0x0b19('0x43')][_0x0b19('0x6d')]);}})[_0x0b19('0x1e')](respondWithStatusCode(_0x384eaf,null))['catch'](handleError(_0x384eaf,null));};exports[_0x0b19('0x6e')]=function(_0x5c6f0c,_0x1dcdae,_0x369a9e){if(_0x5c6f0c[_0x0b19('0x59')]['id']){delete _0x5c6f0c[_0x0b19('0x59')]['id'];}return db['WhatsappAccount'][_0x0b19('0x57')]({'where':{'id':_0x5c6f0c['params']['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x1dcdae,null))[_0x0b19('0x1e')](function(_0x2eb42c){if(_0x2eb42c){_0x5c6f0c[_0x0b19('0x59')][_0x0b19('0x65')]=_0x2eb42c['id'];return db['CannedAnswer'][_0x0b19('0x58')](_0x5c6f0c[_0x0b19('0x59')]);}})[_0x0b19('0x1e')](respondWithResult(_0x1dcdae,null))[_0x0b19('0x28')](handleError(_0x1dcdae,null));};exports[_0x0b19('0x6f')]=function(_0x2c0d37,_0x5a9ccf,_0x2bab29){var _0x42f806={'raw':![],'where':{}};var _0xcee123={};var _0x4275bb={'count':0x0,'rows':[]};return db[_0x0b19('0x3e')][_0x0b19('0x68')]({'where':{'id':_0x2c0d37[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x5a9ccf,null))[_0x0b19('0x1e')](function(_0x26be61){if(_0x26be61){_0xcee123[_0x0b19('0x42')]=_['keys'](db[_0x0b19('0x70')]['rawAttributes']);_0xcee123['query']=_[_0x0b19('0x55')](_0x2c0d37[_0x0b19('0x43')]);_0xcee123[_0x0b19('0x4a')]=_[_0x0b19('0x45')](_0xcee123[_0x0b19('0x42')],_0xcee123[_0x0b19('0x43')]);_0x42f806[_0x0b19('0x44')]=_[_0x0b19('0x45')](_0xcee123[_0x0b19('0x42')],qs['fields'](_0x2c0d37[_0x0b19('0x43')]['fields']));_0x42f806['attributes']=_0x42f806[_0x0b19('0x44')]['length']?_0x42f806[_0x0b19('0x44')]:_0xcee123['model'];if(!_0x2c0d37[_0x0b19('0x43')]['hasOwnProperty'](_0x0b19('0x69'))){_0x42f806[_0x0b19('0x2e')]=qs[_0x0b19('0x2e')](_0x2c0d37['query'][_0x0b19('0x2e')]);_0x42f806[_0x0b19('0x2c')]=qs[_0x0b19('0x2c')](_0x2c0d37[_0x0b19('0x43')][_0x0b19('0x2c')]);}_0x42f806[_0x0b19('0x6a')]=qs[_0x0b19('0x48')](_0x2c0d37['query'][_0x0b19('0x48')]);_0x42f806['where']=qs[_0x0b19('0x4a')](_[_0x0b19('0x4b')](_0x2c0d37[_0x0b19('0x43')],_0xcee123['filters']));_0x42f806[_0x0b19('0x49')][_0x0b19('0x65')]=_0x26be61['id'];if(_0x2c0d37[_0x0b19('0x43')][_0x0b19('0x4c')]){_0x42f806[_0x0b19('0x49')]=_['merge'](_0x42f806[_0x0b19('0x49')],{'$or':_['map'](_0x42f806['attributes'],function(_0x2963de){var _0x1598c2={};_0x1598c2[_0x2963de]={'$like':'%'+_0x2c0d37[_0x0b19('0x43')]['filter']+'%'};return _0x1598c2;})});}_0x42f806=_[_0x0b19('0x4e')]({},_0x42f806,_0x2c0d37[_0x0b19('0x4f')]);return db[_0x0b19('0x70')][_0x0b19('0x50')]({'where':_0x42f806[_0x0b19('0x49')]})['then'](function(_0x1475c1){_0x4275bb['count']=_0x1475c1;if(_0x2c0d37[_0x0b19('0x43')]['includeAll']){_0x42f806[_0x0b19('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0b19('0x6b')](_0x42f806);})[_0x0b19('0x1e')](function(_0xbe9d4f){_0x4275bb[_0x0b19('0x53')]=_0xbe9d4f;return _0x4275bb;});}})['then'](respondWithFilteredResult(_0x5a9ccf,_0x42f806))['catch'](handleError(_0x5a9ccf,null));};exports['removeAnswers']=function(_0x45cf67,_0x54850f,_0x4124b3){return db[_0x0b19('0x3e')][_0x0b19('0x57')]({'where':{'id':_0x45cf67[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x54850f,null))[_0x0b19('0x1e')](function(_0x3f2df2){if(_0x3f2df2){return _0x3f2df2[_0x0b19('0x71')](_0x45cf67['query']['ids']);}})[_0x0b19('0x1e')](respondWithStatusCode(_0x54850f,null))[_0x0b19('0x28')](handleError(_0x54850f,null));};exports[_0x0b19('0x72')]=function(_0x1e1574,_0x4ae3ed,_0x226ef9){return db[_0x0b19('0x3e')]['find']({'where':{'id':_0x1e1574['params']['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x4ae3ed,null))[_0x0b19('0x1e')](function(_0xdcef6f){if(_0xdcef6f){return _0xdcef6f['addAgents'](_0x1e1574[_0x0b19('0x59')][_0x0b19('0x6d')],_[_0x0b19('0x73')](_0x1e1574[_0x0b19('0x59')],['ids','id'])||{})[_0x0b19('0x74')](function(_0x5a10c7){for(var _0x5a4278=0x0;_0x5a4278<_0x1e1574[_0x0b19('0x59')][_0x0b19('0x6d')]['length'];_0x5a4278+=0x1){socket[_0x0b19('0x75')](_0x0b19('0x76'),{'UserId':Number(_0x1e1574[_0x0b19('0x59')][_0x0b19('0x6d')][_0x5a4278]),'WhatsappAccountId':Number(_0x1e1574[_0x0b19('0x54')]['id'])});}return _0x5a10c7;});}})[_0x0b19('0x1e')](respondWithResult(_0x4ae3ed,null))[_0x0b19('0x28')](handleError(_0x4ae3ed,null));};exports[_0x0b19('0x77')]=function(_0x59bd79,_0x536b84,_0x118266){return db[_0x0b19('0x3e')][_0x0b19('0x57')]({'where':{'id':_0x59bd79[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x536b84,null))[_0x0b19('0x1e')](function(_0x36611d){if(_0x36611d){return _0x36611d[_0x0b19('0x77')](_0x59bd79[_0x0b19('0x43')][_0x0b19('0x6d')])[_0x0b19('0x1e')](function(){if(_[_0x0b19('0x78')](_0x59bd79[_0x0b19('0x43')][_0x0b19('0x6d')])){for(var _0x29a61f=0x0;_0x29a61f<_0x59bd79[_0x0b19('0x43')]['ids'][_0x0b19('0x46')];_0x29a61f+=0x1){socket[_0x0b19('0x75')](_0x0b19('0x79'),{'UserId':Number(_0x59bd79[_0x0b19('0x43')]['ids'][_0x29a61f]),'WhatsappAccountId':Number(_0x59bd79[_0x0b19('0x54')]['id'])});}}else{socket['emit'](_0x0b19('0x79'),{'UserId':Number(_0x59bd79[_0x0b19('0x43')][_0x0b19('0x6d')]),'WhatsappAccountId':Number(_0x59bd79[_0x0b19('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x536b84,null))['catch'](handleError(_0x536b84,null));};exports[_0x0b19('0x7a')]=function(_0x141de5,_0x1bd165,_0x112a5b){var _0x375cc3={};var _0x48a0f1={};var _0x45f017;var _0x19ea78;return db[_0x0b19('0x3e')][_0x0b19('0x68')]({'where':{'id':_0x141de5[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x1bd165,null))[_0x0b19('0x1e')](function(_0x3333f8){if(_0x3333f8){_0x45f017=_0x3333f8;_0x48a0f1['model']=_[_0x0b19('0x55')](db[_0x0b19('0x7b')][_0x0b19('0x3f')]);_0x48a0f1[_0x0b19('0x43')]=_[_0x0b19('0x55')](_0x141de5[_0x0b19('0x43')]);_0x48a0f1[_0x0b19('0x4a')]=_[_0x0b19('0x45')](_0x48a0f1['model'],_0x48a0f1['query']);_0x375cc3[_0x0b19('0x44')]=_[_0x0b19('0x45')](_0x48a0f1[_0x0b19('0x42')],qs['fields'](_0x141de5[_0x0b19('0x43')]['fields']));_0x375cc3[_0x0b19('0x44')]=_0x375cc3[_0x0b19('0x44')][_0x0b19('0x46')]?_0x375cc3['attributes']:_0x48a0f1[_0x0b19('0x42')];_0x375cc3['order']=qs[_0x0b19('0x48')](_0x141de5[_0x0b19('0x43')][_0x0b19('0x48')]);_0x375cc3[_0x0b19('0x49')]=qs[_0x0b19('0x4a')](_[_0x0b19('0x4b')](_0x141de5[_0x0b19('0x43')],_0x48a0f1[_0x0b19('0x4a')]));if(_0x141de5[_0x0b19('0x43')]['filter']){_0x375cc3[_0x0b19('0x49')]=_[_0x0b19('0x4e')](_0x375cc3[_0x0b19('0x49')],{'$or':_['map'](_0x375cc3['attributes'],function(_0x431eb0){var _0x11dc36={};_0x11dc36[_0x431eb0]={'$like':'%'+_0x141de5['query'][_0x0b19('0x4c')]+'%'};return _0x11dc36;})});}_0x375cc3=_['merge']({},_0x375cc3,_0x141de5[_0x0b19('0x4f')]);return _0x45f017[_0x0b19('0x7a')](_0x375cc3);}})[_0x0b19('0x1e')](function(_0x5664dd){if(_0x5664dd){_0x19ea78=_0x5664dd[_0x0b19('0x46')];if(!_0x141de5[_0x0b19('0x43')][_0x0b19('0x47')](_0x0b19('0x69'))){_0x375cc3[_0x0b19('0x2e')]=qs['limit'](_0x141de5[_0x0b19('0x43')][_0x0b19('0x2e')]);_0x375cc3['offset']=qs[_0x0b19('0x2c')](_0x141de5['query'][_0x0b19('0x2c')]);}return _0x45f017[_0x0b19('0x7a')](_0x375cc3);}})['then'](function(_0x55964b){if(_0x55964b){return _0x55964b?{'count':_0x19ea78,'rows':_0x55964b}:null;}})['then'](respondWithResult(_0x1bd165,null))[_0x0b19('0x28')](handleError(_0x1bd165,null));};exports['addApplications']=function(_0x10d3c2,_0x1c601d){var _0x43cbe1=_0x10d3c2[_0x0b19('0x54')]['id'];var _0x172e9f=_0x10d3c2['body'];var _0x234e15=0xc8;var _0x2cde74=null;return db['sequelize'][_0x0b19('0x7c')]({'isolationLevel':db[_0x0b19('0x7d')][_0x0b19('0x7e')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4ce5c7){return db[_0x0b19('0x3e')]['findOne']({'where':{'id':_0x43cbe1},'transaction':_0x4ce5c7})['then'](function(_0x2fcc85){if(_0x2fcc85){return db['WhatsappApplication'][_0x0b19('0x34')]({'where':{'WhatsappAccountId':_0x43cbe1},'transaction':_0x4ce5c7})[_0x0b19('0x1e')](function(){var _0x188bfe=_[_0x0b19('0x3d')](_0x172e9f,function(_0x1002f8){_0x1002f8['WhatsappAccountId']=_0x43cbe1;return _0x1002f8;});return db[_0x0b19('0x7f')][_0x0b19('0x80')](_0x188bfe,{'transaction':_0x4ce5c7});});}else{_0x234e15=0x194;_0x2cde74=[];}});})[_0x0b19('0x1e')](function(){if(_0x234e15!==0x194){return db[_0x0b19('0x7f')][_0x0b19('0x81')]({'where':{'WhatsappAccountId':_0x43cbe1},'order':_0x0b19('0x82')})['then'](function(_0x4bf709){_0x2cde74=_0x4bf709;});}})['catch'](function(_0x30a745){_0x234e15=0x1f4;logger['error'](_0x30a745[_0x0b19('0x38')]);if(_0x30a745['name']){delete _0x30a745[_0x0b19('0x39')];}_0x2cde74=_0x30a745;})[_0x0b19('0x83')](function(){if(_0x2cde74===null){_0x1c601d[_0x0b19('0x37')](_0x234e15);}else{if(_0x234e15===0x1f4){_0x1c601d[_0x0b19('0x29')](_0x234e15)[_0x0b19('0x84')](_0x2cde74);}else{_0x1c601d['status'](_0x234e15)[_0x0b19('0x2b')](_0x2cde74);}}});};exports['getApplications']=function(_0x542273,_0x27a035,_0x16672e){var _0x14e975={};var _0x1acf3b={};var _0x12504b;var _0x1a9de6;return db[_0x0b19('0x3e')]['findOne']({'where':{'id':_0x542273[_0x0b19('0x54')]['id']}})[_0x0b19('0x1e')](handleEntityNotFound(_0x27a035,null))[_0x0b19('0x1e')](function(_0x5bdd5d){if(_0x5bdd5d){_0x12504b=_0x5bdd5d;_0x1acf3b[_0x0b19('0x42')]=_[_0x0b19('0x55')](db[_0x0b19('0x7f')][_0x0b19('0x3f')]);_0x1acf3b[_0x0b19('0x43')]=_[_0x0b19('0x55')](_0x542273[_0x0b19('0x43')]);_0x1acf3b[_0x0b19('0x4a')]=_['intersection'](_0x1acf3b[_0x0b19('0x42')],_0x1acf3b[_0x0b19('0x43')]);_0x14e975[_0x0b19('0x44')]=_[_0x0b19('0x45')](_0x1acf3b['model'],qs['fields'](_0x542273[_0x0b19('0x43')][_0x0b19('0x56')]));_0x14e975[_0x0b19('0x44')]=_0x14e975['attributes'][_0x0b19('0x46')]?_0x14e975[_0x0b19('0x44')]:_0x1acf3b[_0x0b19('0x42')];_0x14e975[_0x0b19('0x6a')]=qs[_0x0b19('0x48')](_0x542273[_0x0b19('0x43')]['sort']);_0x14e975[_0x0b19('0x49')]=qs[_0x0b19('0x4a')](_[_0x0b19('0x4b')](_0x542273[_0x0b19('0x43')],_0x1acf3b[_0x0b19('0x4a')]));if(_0x542273[_0x0b19('0x43')][_0x0b19('0x4c')]){_0x14e975['where']=_[_0x0b19('0x4e')](_0x14e975['where'],{'$or':_[_0x0b19('0x3d')](_0x14e975[_0x0b19('0x44')],function(_0x5b31db){var _0x3875e4={};_0x3875e4[_0x5b31db]={'$like':'%'+_0x542273[_0x0b19('0x43')]['filter']+'%'};return _0x3875e4;})});}_0x14e975=_[_0x0b19('0x4e')]({},_0x14e975,_0x542273['options']);return _0x12504b['getApplications'](_0x14e975);}})[_0x0b19('0x1e')](function(_0x4e8dcc){if(_0x4e8dcc){_0x1a9de6=_0x4e8dcc[_0x0b19('0x46')];if(!_0x542273['query'][_0x0b19('0x47')](_0x0b19('0x69'))){_0x14e975[_0x0b19('0x2e')]=qs[_0x0b19('0x2e')](_0x542273[_0x0b19('0x43')]['limit']);_0x14e975['offset']=qs[_0x0b19('0x2c')](_0x542273[_0x0b19('0x43')]['offset']);}return _0x12504b[_0x0b19('0x85')](_0x14e975);}})[_0x0b19('0x1e')](function(_0x170c74){if(_0x170c74){return _0x170c74?{'count':_0x1a9de6,'rows':_0x170c74}:null;}})[_0x0b19('0x1e')](respondWithResult(_0x27a035,null))[_0x0b19('0x28')](handleError(_0x27a035,null));};exports[_0x0b19('0x86')]=function(_0x21e029,_0x4e576c,_0x2888ec){var _0xec7ee7={'channel':_0x0b19('0x87')};var _0x5e469f=[];var _0x3c421f=[];var _0x480647={};return db[_0x0b19('0x3e')]['find']({'where':{'id':_0x21e029[_0x0b19('0x54')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0b19('0x88')}]})[_0x0b19('0x1e')](handleEntityNotFound(_0x4e576c,null))[_0x0b19('0x1e')](function(_0x4891b1){_0xec7ee7[_0x0b19('0x89')]=_0x4891b1;if(_0xec7ee7[_0x0b19('0x89')]&&_0xec7ee7['account'][_0x0b19('0x40')]===_0x0b19('0x8a')&&_0x21e029[_0x0b19('0x59')][_0x0b19('0x8b')]){if(_0x21e029[_0x0b19('0x59')][_0x0b19('0x8b')][_0x0b19('0x46')]===0x0)return;if(_0x21e029[_0x0b19('0x59')][_0x0b19('0x8b')][0x0][_0x0b19('0x8c')]!==_0x0b19('0x8d'))return;return db[_0x0b19('0x8e')]['update']({'read':!![],'readAt':_0x21e029[_0x0b19('0x59')]['statuses'][0x0][_0x0b19('0x8f')]},{'where':{'messageId':_0x21e029[_0x0b19('0x59')]['statuses'][0x0][_0x0b19('0x90')]},'individualHooks':!![]})[_0x0b19('0x1e')](function(_0x1127f9){return _0x4e576c['status'](0xc8)[_0x0b19('0x2b')](_0x1127f9);});}_0xec7ee7[_0x0b19('0x91')]=_[_0x0b19('0x92')](_0x4891b1[_0x0b19('0x88')],[_0x0b19('0x82')],[_0x0b19('0x93')]);if(_0xec7ee7[_0x0b19('0x89')][_0x0b19('0x88')]){delete _0xec7ee7['account']['Applications'];}return db[_0x0b19('0x94')][_0x0b19('0x63')]()['then'](function(_0x4a9fc2){if(!_0x4a9fc2){throw new db[(_0x0b19('0x95'))]['ValidationError'](_0x0b19('0x96'));}_0x5e469f=_[_0x0b19('0x97')](_[_0x0b19('0x55')](_0x4a9fc2),[_0x0b19('0x98'),'updatedAt']);_0x3c421f=_['difference'](_[_0x0b19('0x55')](_0x4a9fc2),[_0x0b19('0x98'),_0x0b19('0x99'),_0x0b19('0x9a'),_0x0b19('0x9b')]);_0xec7ee7[_0x0b19('0x59')]={'mapKey':_0x0b19('0x9c')};if(_0xec7ee7[_0x0b19('0x89')]&&_0xec7ee7['account'][_0x0b19('0x40')]==='twilio'){_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x9d')]=_0x21e029[_0x0b19('0x59')][_0x0b19('0x9e')]['replace'](_0x0b19('0x9f'),'');_0xec7ee7['body'][_0x0b19('0x59')]=_0x21e029['body'][_0x0b19('0xa0')];_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa1')]=_0x21e029['body']['MessageSid'];}if(_0xec7ee7[_0x0b19('0x89')]&&_0xec7ee7[_0x0b19('0x89')]['type']===_0x0b19('0x8a')){_0xec7ee7[_0x0b19('0x59')]['from']=_0x21e029[_0x0b19('0x59')]['notifications'][0x0][_0x0b19('0x9d')];_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x59')]=_0x21e029['body'][_0x0b19('0xa2')][0x0][_0x0b19('0x26')][_0x0b19('0x59')];_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa1')]=_0x21e029[_0x0b19('0x59')][_0x0b19('0xa2')][0x0]['message_id'];}if(_0xec7ee7[_0x0b19('0x59')]['id']){delete _0xec7ee7[_0x0b19('0x59')]['id'];}if(_[_0x0b19('0xa3')](_0xec7ee7[_0x0b19('0x59')]['from'])){throw new db['Sequelize'][(_0x0b19('0xa4'))]('from\x20is\x20mandatory');}if(_[_0x0b19('0xa3')](_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x59')])||_0xec7ee7[_0x0b19('0x59')]['body']===''){throw new db[(_0x0b19('0x95'))][(_0x0b19('0xa4'))](_0x0b19('0xa5'));}if(_[_0x0b19('0xa3')](_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa6')])){throw new db[(_0x0b19('0x95'))][(_0x0b19('0xa4'))](_0x0b19('0xa7')+_0x3c421f);}if(!_['includes'](_0x3c421f,_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa6')])){throw new db[(_0x0b19('0x95'))][(_0x0b19('0xa4'))](_0x0b19('0xa8')+_0x3c421f);}_0x480647[_0xec7ee7[_0x0b19('0x59')]['mapKey']]=_0xec7ee7['body'][_0x0b19('0x9d')];return db[_0x0b19('0xa9')][_0x0b19('0x57')]({'where':{'id':_0xec7ee7['account']['ListId']},'include':[{'model':db[_0x0b19('0x94')],'as':_0x0b19('0xaa'),'where':_0x480647,'limit':0x1,'order':[[_0x0b19('0x99'),_0x0b19('0xab')]]}]});})[_0x0b19('0x1e')](handleEntityNotFound(_0x4e576c,null))[_0x0b19('0x1e')](function(_0xed7bde){if(_0xed7bde){_0xec7ee7['list']=_['omit'](_0xed7bde,['Contacts']);if(_0xed7bde[_0x0b19('0xaa')][_0x0b19('0x46')]){return _0xed7bde['Contacts'][0x0];}var _0xfb1727=_['defaults'](_0xec7ee7[_0x0b19('0x59')],{'firstName':_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x9d')],'ListId':_0xed7bde['id']});_0xfb1727[_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa6')]]=_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x9d')];return db[_0x0b19('0x94')][_0x0b19('0x58')](_0xfb1727,{'fields':_0x5e469f,'raw':!![]});}})[_0x0b19('0x1e')](handleEntityNotFound(_0x4e576c,null))[_0x0b19('0x1e')](function(_0x181885){if(_0x181885){_0xec7ee7[_0x0b19('0xac')]=_0x181885;var _0x4ca97f={'ContactId':_0x181885['id'],'phone':_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x9d')],'WhatsappAccountId':_0x21e029[_0x0b19('0x54')]['id']};var _0x390c60={'ContactId':_0x181885['id'],'WhatsappAccountId':_0x21e029[_0x0b19('0x54')]['id'],'closed':![]};return db[_0x0b19('0xad')][_0x0b19('0x57')]({'where':_0x390c60})['then'](function(_0x5d1eef){if(_0x5d1eef){return[_0x5d1eef,![]];}return db[_0x0b19('0xad')]['create'](_0x4ca97f)[_0x0b19('0x1e')](function(_0x450618){return[_0x450618,!![]];});});}})[_0x0b19('0x74')](function(_0x2e739b,_0x3b6ac1){_0xec7ee7['interaction']=_0x2e739b[_0x0b19('0x5a')]({'plain':!![]});_0xec7ee7['interaction'][_0x0b19('0xae')]=![];if(_0x3b6ac1){if(_0xec7ee7[_0x0b19('0x89')]['autoclose']){_0xec7ee7[_0x0b19('0x91')]['push']({'id':0x0,'priority':_0xec7ee7['applications'][_0x0b19('0x46')]+0x1,'app':_0x0b19('0xaf'),'appdata':'unmanaged','interval':_0x0b19('0xb0')});}_0xec7ee7['interaction'][_0x0b19('0xae')]=!![];}return db[_0x0b19('0x8e')][_0x0b19('0x58')]({'phone':_0xec7ee7[_0x0b19('0x59')][_0x0b19('0x9d')],'messageId':_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xa1')],'body':_0xec7ee7[_0x0b19('0x59')]['body'],'WhatsappAccountId':_0x21e029[_0x0b19('0x54')]['id'],'WhatsappInteractionId':_0x2e739b['id'],'direction':'in','ContactId':_0x2e739b[_0x0b19('0xb1')],'AttachmentId':_0xec7ee7[_0x0b19('0x59')][_0x0b19('0xb2')]});})[_0x0b19('0x1e')](function(_0xb3ef94){_0xec7ee7[_0x0b19('0x26')]=_0xb3ef94;if(_0xec7ee7[_0x0b19('0xb3')]['UserId']){return db[_0x0b19('0x7b')][_0x0b19('0x57')]({'attributes':['id',_0x0b19('0x39')],'where':{'id':_0xec7ee7[_0x0b19('0xb3')][_0x0b19('0xb4')]}})[_0x0b19('0x1e')](function(_0x1b579c){if(_0x1b579c){_0xec7ee7[_0x0b19('0x91')][_0x0b19('0xb5')]({'id':0x0,'priority':0x0,'app':_0x0b19('0xb6'),'appdata':_0x1b579c[_0x0b19('0x39')]+','+(_0xec7ee7[_0x0b19('0x89')][_0x0b19('0xb7')]||0xa),'interval':_0x0b19('0xb0')});}return respondWithRpcPromise('Start','startRouting',_0xec7ee7);});}return respondWithRpcPromise(_0x0b19('0xb8'),_0x0b19('0xb9'),_0xec7ee7);})[_0x0b19('0x1e')](function(_0x4bbdc1){if(_0x4bbdc1){var _0x5dcbda=0xc8;var _0x45c357='receiveMessage';logger[_0x0b19('0x1f')](_0x0b19('0xba'),_0x45c357,_0x5dcbda,_0x0b19('0xbb'));logger['debug'](_0x0b19('0xbc'),_0x45c357,_0x5dcbda,_0x0b19('0xbb'),JSON[_0x0b19('0x23')](_0x4bbdc1));if(_0xec7ee7[_0x0b19('0x89')][_0x0b19('0x40')]==='twilio'){return _0x4e576c[_0x0b19('0x29')](_0x5dcbda)[_0x0b19('0x2f')](_0x0b19('0xbd'),_0x0b19('0xbe'))[_0x0b19('0x84')](_0x0b19('0xbf'));}else{return _0x4e576c['status'](_0x5dcbda)['json'](_0x4bbdc1);}}});})[_0x0b19('0x28')](handleError(_0x4e576c,null));};exports['send']=function(_0xc0166d,_0x53d033,_0x1b05c1){var _0x105c49,_0x3ad32,_0x15aa5f;if(_[_0x0b19('0xa3')](_0xc0166d['body'][_0x0b19('0x59')])||_0xc0166d['body'][_0x0b19('0x59')]===''){throw new db[(_0x0b19('0x95'))][(_0x0b19('0xa4'))](_0x0b19('0xa5'));}if(_[_0x0b19('0xa3')](_0xc0166d[_0x0b19('0x59')]['to'])){throw new db[(_0x0b19('0x95'))][(_0x0b19('0xa4'))](_0x0b19('0xc0'));}_0x105c49=_0xc0166d[_0x0b19('0x59')]['to'];return db['WhatsappAccount'][_0x0b19('0x57')]({'where':{'id':_0xc0166d[_0x0b19('0x54')]['id']},'include':[{'model':db[_0x0b19('0xa9')],'as':_0x0b19('0xc1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x105c49},'limit':0x1,'order':[['updatedAt',_0x0b19('0xab')]]}]}]})[_0x0b19('0x1e')](handleEntityNotFound(_0x53d033,null))['then'](function(_0x49aaef){if(_0x49aaef&&_0x49aaef[_0x0b19('0xc1')]){_0x3ad32=_0x49aaef[_0x0b19('0x5a')]({'plain':!![]});if(_0x3ad32['List']&&_0x3ad32[_0x0b19('0xc1')][_0x0b19('0xaa')]['length']){return _0x3ad32[_0x0b19('0xc1')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x0b19('0x17')](_0xc0166d[_0x0b19('0x59')],{'firstName':_0x105c49,'mobile':_0x105c49,'phone':_0x105c49,'ListId':_0x3ad32[_0x0b19('0x9b')]}));}})[_0x0b19('0x1e')](handleEntityNotFound(_0x53d033,null))[_0x0b19('0x1e')](function(_0x3dccbe){if(_0x3dccbe){_0x15aa5f=_0x3dccbe;return db['WhatsappInteraction'][_0x0b19('0x57')]({'where':{'ContactId':_0x15aa5f['id'],'closed':![],'WhatsappAccountId':_0x3ad32['id']}})[_0x0b19('0x1e')](function(_0x44a6e8){if(_0x44a6e8){return[_0x44a6e8,![]];}return db[_0x0b19('0xad')][_0x0b19('0x58')]({'UserId':_0xc0166d[_0x0b19('0x5d')]['id'],'ContactId':_0x15aa5f['id'],'WhatsappAccountId':_0x3ad32['id'],'phone':_0x105c49,'firstMsgDirection':_0x0b19('0xc2'),'Messages':[_[_0x0b19('0x4e')](_0xc0166d[_0x0b19('0x59')],{'read':![],'body':_0xc0166d[_0x0b19('0x59')][_0x0b19('0x59')],'phone':_0x105c49,'WhatsappAccountId':_0x3ad32['id'],'UserId':_0xc0166d[_0x0b19('0x5d')]['id'],'ContactId':_0x15aa5f['id']})]},{'include':[{'model':db[_0x0b19('0x8e')],'as':_0x0b19('0xc3')}]})[_0x0b19('0x1e')](function(_0x46516a){return[_0x46516a,!![]];});});}})['spread'](function(_0x161cc9,_0x30952e){if(_0x30952e){return _0x161cc9;}return db[_0x0b19('0x8e')]['create'](_[_0x0b19('0x4e')](_0xc0166d[_0x0b19('0x59')],{'read':![],'body':_0xc0166d[_0x0b19('0x59')][_0x0b19('0x59')],'phone':_0x105c49,'WhatsappAccountId':_0x3ad32['id'],'WhatsappInteractionId':_0x161cc9['id'],'UserId':_0xc0166d['user']['id'],'ContactId':_0x15aa5f['id']}))[_0x0b19('0x1e')](function(_0x1486f5){_0x161cc9['dataValues']['Messages']=[];_0x161cc9[_0x0b19('0xc4')][_0x0b19('0xc3')]['push'](_0x1486f5[_0x0b19('0xc4')]);return _0x161cc9;});})[_0x0b19('0x1e')](respondWithResult(_0x53d033,null))[_0x0b19('0x28')](handleError(_0x53d033,null));}; \ No newline at end of file +var _0xa286=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','sendStatus','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','update','timestamp','applications','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','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','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','receiveMessage','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','limit','count','set','Content-Range','reject','save','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','WhatsappAccount','rawAttributes','length','include','find','create','body','user'];(function(_0x51aa2b,_0x1ec270){var _0x414b1c=function(_0x21f8ae){while(--_0x21f8ae){_0x51aa2b['push'](_0x51aa2b['shift']());}};_0x414b1c(++_0x1ec270);}(_0xa286,0x68));var _0x6a28=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xa286[_0x22b8a3];return _0x199a0c;};'use strict';var emlformat=require(_0x6a28('0x0'));var rimraf=require(_0x6a28('0x1'));var zipdir=require(_0x6a28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a28('0x3'));var moment=require(_0x6a28('0x4'));var BPromise=require(_0x6a28('0x5'));var Mustache=require(_0x6a28('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6a28('0x7'));var csv=require(_0x6a28('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a28('0x9'));var _=require('lodash');var squel=require(_0x6a28('0xa'));var crypto=require(_0x6a28('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a28('0xc'));var toCsv=require(_0x6a28('0x8'));var querystring=require(_0x6a28('0xd'));var Papa=require(_0x6a28('0xe'));var Redis=require(_0x6a28('0xf'));var authService=require(_0x6a28('0x10'));var qs=require(_0x6a28('0x11'));var as=require(_0x6a28('0x12'));var hardwareService=require(_0x6a28('0x13'));var logger=require('../../config/logger')(_0x6a28('0x14'));var utils=require('../../config/utils');var config=require(_0x6a28('0x15'));var licenseUtil=require(_0x6a28('0x16'));var db=require(_0x6a28('0x17'))['db'];config[_0x6a28('0x18')]=_[_0x6a28('0x19')](config[_0x6a28('0x18')],{'host':_0x6a28('0x1a'),'port':0x18eb});var socket=require(_0x6a28('0x1b'))(new Redis(config['redis']));require(_0x6a28('0x1c'))['register'](socket);var jayson=require(_0x6a28('0x1d'));var client=jayson['client'][_0x6a28('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x300839,_0x15b48e,_0x26a769,_0x317bfd){return new BPromise(function(_0x3295db,_0x5e9e41){var _0x187b7b=_0x317bfd||client;return _0x187b7b[_0x6a28('0x1f')](_0x300839,_0x26a769)[_0x6a28('0x20')](function(_0x54462f){logger[_0x6a28('0x21')](_0x6a28('0x22'),_0x15b48e,'request\x20sent');logger[_0x6a28('0x23')](_0x6a28('0x24'),_0x15b48e,_0x6a28('0x25'),JSON[_0x6a28('0x26')](_0x54462f));if(_0x54462f[_0x6a28('0x27')]){if(_0x54462f['error'][_0x6a28('0x28')]===0x1f4){logger[_0x6a28('0x27')](_0x6a28('0x22'),_0x15b48e,_0x54462f[_0x6a28('0x27')][_0x6a28('0x29')]);return _0x5e9e41(_0x54462f[_0x6a28('0x27')][_0x6a28('0x29')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x15b48e,_0x54462f[_0x6a28('0x27')][_0x6a28('0x29')]);return _0x3295db(_0x54462f['error'][_0x6a28('0x29')]);}else{logger['info'](_0x6a28('0x22'),_0x15b48e,'request\x20sent');_0x3295db(_0x54462f[_0x6a28('0x2a')][_0x6a28('0x29')]);}})['catch'](function(_0x3cb06d){logger[_0x6a28('0x27')](_0x6a28('0x22'),_0x15b48e,_0x3cb06d);_0x5e9e41(_0x3cb06d);});});}function respondWithStatusCode(_0x16e21e,_0x44d4e2){_0x44d4e2=_0x44d4e2||0xcc;return function(_0x28d8e5){if(_0x28d8e5){return _0x16e21e['sendStatus'](_0x44d4e2);}return _0x16e21e[_0x6a28('0x2b')](_0x44d4e2)[_0x6a28('0x2c')]();};}function respondWithResult(_0xbbb9c4,_0xaa9980){_0xaa9980=_0xaa9980||0xc8;return function(_0x14ab9b){if(_0x14ab9b){return _0xbbb9c4['status'](_0xaa9980)[_0x6a28('0x2d')](_0x14ab9b);}};}function respondWithFilteredResult(_0x1f4d8c,_0xcea201){return function(_0x4fe583){if(_0x4fe583){var _0x28a0ea=typeof _0xcea201[_0x6a28('0x2e')]==='undefined'&&typeof _0xcea201[_0x6a28('0x2f')]==='undefined';var _0x4c4048=_0x4fe583['count'];var _0x2c8fdf=_0x28a0ea?0x0:_0xcea201[_0x6a28('0x2e')];var _0x1a40af=_0x28a0ea?_0x4fe583[_0x6a28('0x30')]:_0xcea201[_0x6a28('0x2e')]+_0xcea201[_0x6a28('0x2f')];var _0x2c2baf;if(_0x1a40af>=_0x4c4048){_0x1a40af=_0x4c4048;_0x2c2baf=0xc8;}else{_0x2c2baf=0xce;}_0x1f4d8c[_0x6a28('0x2b')](_0x2c2baf);return _0x1f4d8c[_0x6a28('0x31')](_0x6a28('0x32'),_0x2c8fdf+'-'+_0x1a40af+'/'+_0x4c4048)['json'](_0x4fe583);}return null;};}function patchUpdates(_0xecd06d){return function(_0x4617a8){try{jsonpatch['apply'](_0x4617a8,_0xecd06d,!![]);}catch(_0xd96f10){return BPromise[_0x6a28('0x33')](_0xd96f10);}return _0x4617a8[_0x6a28('0x34')]();};}function saveUpdates(_0x13c6e8,_0x2457c0){return function(_0x812d9c){if(_0x812d9c){return _0x812d9c['update'](_0x13c6e8)[_0x6a28('0x20')](function(_0x1ab2a9){return _0x1ab2a9;});}return null;};}function removeEntity(_0x28bd85,_0x1ba7e3){return function(_0x21124f){if(_0x21124f){return _0x21124f['destroy']()[_0x6a28('0x20')](function(){var _0x42ccca=_0x21124f[_0x6a28('0x35')]({'plain':!![]});var _0x4da591=_0x6a28('0x36');return db[_0x6a28('0x37')][_0x6a28('0x38')]({'where':{'type':_0x4da591,'resourceId':_0x42ccca['id']}})[_0x6a28('0x20')](function(){return _0x21124f;});})[_0x6a28('0x20')](function(){_0x28bd85[_0x6a28('0x2b')](0xcc)[_0x6a28('0x2c')]();});}};}function handleEntityNotFound(_0x33b570,_0x3e2d2c){return function(_0xbb0d28){if(!_0xbb0d28){_0x33b570['sendStatus'](0x194);}return _0xbb0d28;};}function handleError(_0x98ad03,_0x453eeb){_0x453eeb=_0x453eeb||0x1f4;return function(_0x1aaf12){logger[_0x6a28('0x27')](_0x1aaf12[_0x6a28('0x39')]);if(_0x1aaf12['name']){delete _0x1aaf12[_0x6a28('0x3a')];}_0x98ad03[_0x6a28('0x2b')](_0x453eeb)[_0x6a28('0x3b')](_0x1aaf12);};}exports['index']=function(_0x2aadfd,_0xdc67c6){var _0x12f14d={'include':[{'model':db[_0x6a28('0x3c')],'as':_0x6a28('0x3d')}]},_0x31f53f={},_0x519fde={'count':0x0,'rows':[]};var _0x5e9c6c=_[_0x6a28('0x3e')](db['WhatsappAccount']['rawAttributes'],function(_0x45d259){return{'name':_0x45d259[_0x6a28('0x3f')],'type':_0x45d259[_0x6a28('0x40')][_0x6a28('0x41')]};});_0x31f53f['model']=_[_0x6a28('0x3e')](_0x5e9c6c,_0x6a28('0x3a'));_0x31f53f[_0x6a28('0x42')]=_[_0x6a28('0x43')](_0x2aadfd[_0x6a28('0x42')]);_0x31f53f[_0x6a28('0x44')]=_[_0x6a28('0x45')](_0x31f53f[_0x6a28('0x46')],_0x31f53f[_0x6a28('0x42')]);_0x12f14d[_0x6a28('0x47')]=_[_0x6a28('0x45')](_0x31f53f[_0x6a28('0x46')],qs[_0x6a28('0x48')](_0x2aadfd[_0x6a28('0x42')]['fields']));_0x12f14d[_0x6a28('0x47')]=_0x12f14d[_0x6a28('0x47')]['length']?_0x12f14d[_0x6a28('0x47')]:_0x31f53f[_0x6a28('0x46')];if(!_0x2aadfd[_0x6a28('0x42')][_0x6a28('0x49')](_0x6a28('0x4a'))){_0x12f14d['limit']=qs[_0x6a28('0x2f')](_0x2aadfd['query'][_0x6a28('0x2f')]);_0x12f14d['offset']=qs[_0x6a28('0x2e')](_0x2aadfd[_0x6a28('0x42')][_0x6a28('0x2e')]);}_0x12f14d['order']=qs['sort'](_0x2aadfd['query'][_0x6a28('0x4b')]);_0x12f14d[_0x6a28('0x4c')]=qs[_0x6a28('0x44')](_['pick'](_0x2aadfd['query'],_0x31f53f[_0x6a28('0x44')]),_0x5e9c6c);if(_0x2aadfd['query'][_0x6a28('0x4d')]){_0x12f14d[_0x6a28('0x4c')]=_[_0x6a28('0x4e')](_0x12f14d['where'],{'$or':_[_0x6a28('0x3e')](_0x5e9c6c,function(_0x179d6d){if(_0x179d6d[_0x6a28('0x40')]!==_0x6a28('0x4f')){var _0x2fc5d9={};_0x2fc5d9[_0x179d6d[_0x6a28('0x3a')]]={'$like':'%'+_0x2aadfd[_0x6a28('0x42')][_0x6a28('0x4d')]+'%'};return _0x2fc5d9;}})});}_0x12f14d=_[_0x6a28('0x4e')]({},_0x12f14d,_0x2aadfd[_0x6a28('0x50')]);var _0x36704d={'where':_0x12f14d[_0x6a28('0x4c')]};return db['WhatsappAccount']['count'](_0x36704d)[_0x6a28('0x20')](function(_0x3ebd8e){_0x519fde['count']=_0x3ebd8e;if(_0x2aadfd[_0x6a28('0x42')][_0x6a28('0x51')]){_0x12f14d['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x12f14d);})[_0x6a28('0x20')](function(_0x4b0943){_0x519fde['rows']=_0x4b0943;return _0x519fde;})['then'](respondWithFilteredResult(_0xdc67c6,_0x12f14d))[_0x6a28('0x52')](handleError(_0xdc67c6,null));};exports[_0x6a28('0x53')]=function(_0x2e6512,_0x411383){var _0x57477f={'raw':![],'where':{'id':_0x2e6512[_0x6a28('0x54')]['id']},'include':[{'model':db[_0x6a28('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4d4d35={};_0x4d4d35['model']=_[_0x6a28('0x43')](db[_0x6a28('0x55')][_0x6a28('0x56')]);_0x4d4d35['query']=_['keys'](_0x2e6512[_0x6a28('0x42')]);_0x4d4d35[_0x6a28('0x44')]=_['intersection'](_0x4d4d35[_0x6a28('0x46')],_0x4d4d35[_0x6a28('0x42')]);_0x57477f['attributes']=_['intersection'](_0x4d4d35[_0x6a28('0x46')],qs['fields'](_0x2e6512[_0x6a28('0x42')][_0x6a28('0x48')]));_0x57477f['attributes']=_0x57477f[_0x6a28('0x47')][_0x6a28('0x57')]?_0x57477f[_0x6a28('0x47')]:_0x4d4d35[_0x6a28('0x46')];if(_0x2e6512[_0x6a28('0x42')][_0x6a28('0x51')]){_0x57477f[_0x6a28('0x58')]=[{'all':!![]}];}_0x57477f=_['merge']({},_0x57477f,_0x2e6512[_0x6a28('0x50')]);return db['WhatsappAccount'][_0x6a28('0x59')](_0x57477f)['then'](handleEntityNotFound(_0x411383,null))[_0x6a28('0x20')](respondWithResult(_0x411383,null))[_0x6a28('0x52')](handleError(_0x411383,null));};exports[_0x6a28('0x5a')]=function(_0x342d30,_0x2b73b5){return db[_0x6a28('0x55')][_0x6a28('0x5a')](_0x342d30[_0x6a28('0x5b')],{})[_0x6a28('0x20')](function(_0x85be0a){var _0x149929=_0x342d30[_0x6a28('0x5c')][_0x6a28('0x35')]({'plain':!![]});if(!_0x149929)throw new Error(_0x6a28('0x5d'));if(_0x149929['role']===_0x6a28('0x5c')){var _0x230870=_0x85be0a[_0x6a28('0x35')]({'plain':!![]});var _0x41a925=_0x6a28('0x36');return db[_0x6a28('0x5e')][_0x6a28('0x59')]({'where':{'name':_0x41a925,'userProfileId':_0x149929[_0x6a28('0x5f')]},'raw':!![]})[_0x6a28('0x20')](function(_0x121607){if(_0x121607&&_0x121607[_0x6a28('0x60')]===0x0){return db[_0x6a28('0x37')]['create']({'name':_0x230870[_0x6a28('0x3a')],'resourceId':_0x230870['id'],'type':_0x121607[_0x6a28('0x3a')],'sectionId':_0x121607['id']},{})[_0x6a28('0x20')](function(){return _0x85be0a;});}else{return _0x85be0a;}})[_0x6a28('0x52')](function(_0x23f15e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23f15e);throw _0x23f15e;});}return _0x85be0a;})[_0x6a28('0x20')](respondWithResult(_0x2b73b5,0xc9))['catch'](handleError(_0x2b73b5,null));};exports['update']=function(_0x3058bc,_0x264768){if(_0x3058bc[_0x6a28('0x5b')]['id']){delete _0x3058bc['body']['id'];}return db['WhatsappAccount'][_0x6a28('0x59')]({'where':{'id':_0x3058bc[_0x6a28('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x6a28('0x3d')}]})[_0x6a28('0x20')](handleEntityNotFound(_0x264768,null))['then'](saveUpdates(_0x3058bc['body'],null))['then'](respondWithResult(_0x264768,null))[_0x6a28('0x52')](handleError(_0x264768,null));};exports[_0x6a28('0x38')]=function(_0xf22c0b,_0x4108c1){return db[_0x6a28('0x55')][_0x6a28('0x59')]({'where':{'id':_0xf22c0b[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x4108c1,null))[_0x6a28('0x20')](removeEntity(_0x4108c1,null))['catch'](handleError(_0x4108c1,null));};exports['describe']=function(_0x59ade7,_0x43cf47){return db[_0x6a28('0x55')][_0x6a28('0x61')]()[_0x6a28('0x20')](respondWithResult(_0x43cf47,null))['catch'](handleError(_0x43cf47,null));};exports[_0x6a28('0x62')]=function(_0x18baa6,_0x546c20,_0x5e407b){if(_0x18baa6[_0x6a28('0x5b')]['id']){delete _0x18baa6[_0x6a28('0x5b')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x18baa6['params']['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x546c20,null))['then'](function(_0x4bde16){if(_0x4bde16){_0x18baa6[_0x6a28('0x5b')][_0x6a28('0x63')]=_0x4bde16['id'];return db[_0x6a28('0x64')][_0x6a28('0x5a')](_0x18baa6[_0x6a28('0x5b')]);}})[_0x6a28('0x20')](respondWithResult(_0x546c20,null))['catch'](handleError(_0x546c20,null));};exports[_0x6a28('0x65')]=function(_0x323978,_0x367b59,_0x2fc5d1){var _0x260148={'raw':![],'where':{}};var _0x450e60={};var _0x32eee6={'count':0x0,'rows':[]};return db[_0x6a28('0x55')][_0x6a28('0x66')]({'where':{'id':_0x323978['params']['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x367b59,null))[_0x6a28('0x20')](function(_0x21416c){if(_0x21416c){_0x450e60[_0x6a28('0x46')]=_[_0x6a28('0x43')](db[_0x6a28('0x64')][_0x6a28('0x56')]);_0x450e60[_0x6a28('0x42')]=_['keys'](_0x323978[_0x6a28('0x42')]);_0x450e60[_0x6a28('0x44')]=_[_0x6a28('0x45')](_0x450e60[_0x6a28('0x46')],_0x450e60['query']);_0x260148[_0x6a28('0x47')]=_[_0x6a28('0x45')](_0x450e60['model'],qs['fields'](_0x323978[_0x6a28('0x42')][_0x6a28('0x48')]));_0x260148[_0x6a28('0x47')]=_0x260148[_0x6a28('0x47')][_0x6a28('0x57')]?_0x260148['attributes']:_0x450e60[_0x6a28('0x46')];if(!_0x323978['query'][_0x6a28('0x49')](_0x6a28('0x4a'))){_0x260148[_0x6a28('0x2f')]=qs['limit'](_0x323978[_0x6a28('0x42')][_0x6a28('0x2f')]);_0x260148[_0x6a28('0x2e')]=qs[_0x6a28('0x2e')](_0x323978[_0x6a28('0x42')][_0x6a28('0x2e')]);}_0x260148['order']=qs[_0x6a28('0x4b')](_0x323978[_0x6a28('0x42')][_0x6a28('0x4b')]);_0x260148[_0x6a28('0x4c')]=qs['filters'](_[_0x6a28('0x67')](_0x323978[_0x6a28('0x42')],_0x450e60['filters']));_0x260148[_0x6a28('0x4c')][_0x6a28('0x63')]=_0x21416c['id'];if(_0x323978[_0x6a28('0x42')][_0x6a28('0x4d')]){_0x260148[_0x6a28('0x4c')]=_[_0x6a28('0x4e')](_0x260148['where'],{'$or':_['map'](_0x260148['attributes'],function(_0x27902d){var _0x3c3ca8={};_0x3c3ca8[_0x27902d]={'$like':'%'+_0x323978['query'][_0x6a28('0x4d')]+'%'};return _0x3c3ca8;})});}_0x260148=_[_0x6a28('0x4e')]({},_0x260148,_0x323978['options']);return db[_0x6a28('0x64')][_0x6a28('0x30')]({'where':_0x260148['where']})[_0x6a28('0x20')](function(_0x212730){_0x32eee6[_0x6a28('0x30')]=_0x212730;if(_0x323978['query'][_0x6a28('0x51')]){_0x260148[_0x6a28('0x58')]=[{'all':!![]}];}return db[_0x6a28('0x64')][_0x6a28('0x68')](_0x260148);})[_0x6a28('0x20')](function(_0x5d3b83){_0x32eee6[_0x6a28('0x69')]=_0x5d3b83;return _0x32eee6;});}})[_0x6a28('0x20')](respondWithFilteredResult(_0x367b59,_0x260148))[_0x6a28('0x52')](handleError(_0x367b59,null));};exports[_0x6a28('0x6a')]=function(_0x2e5630,_0x5b8d1d,_0x1eef3e){return db[_0x6a28('0x55')]['find']({'where':{'id':_0x2e5630[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x5b8d1d,null))[_0x6a28('0x20')](function(_0x4166ea){if(_0x4166ea){return _0x4166ea[_0x6a28('0x6a')](_0x2e5630['query'][_0x6a28('0x6b')]);}})[_0x6a28('0x20')](respondWithStatusCode(_0x5b8d1d,null))[_0x6a28('0x52')](handleError(_0x5b8d1d,null));};exports[_0x6a28('0x6c')]=function(_0x593882,_0x348483,_0x239060){if(_0x593882[_0x6a28('0x5b')]['id']){delete _0x593882[_0x6a28('0x5b')]['id'];}return db[_0x6a28('0x55')][_0x6a28('0x59')]({'where':{'id':_0x593882[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x348483,null))[_0x6a28('0x20')](function(_0x2c9963){if(_0x2c9963){_0x593882[_0x6a28('0x5b')][_0x6a28('0x63')]=_0x2c9963['id'];return db['CannedAnswer'][_0x6a28('0x5a')](_0x593882[_0x6a28('0x5b')]);}})[_0x6a28('0x20')](respondWithResult(_0x348483,null))[_0x6a28('0x52')](handleError(_0x348483,null));};exports[_0x6a28('0x6d')]=function(_0x27f7e4,_0x2de659,_0xfff70e){var _0x2467ae={'raw':![],'where':{}};var _0x3c156f={};var _0x43c7b4={'count':0x0,'rows':[]};return db[_0x6a28('0x55')][_0x6a28('0x66')]({'where':{'id':_0x27f7e4[_0x6a28('0x54')]['id']}})['then'](handleEntityNotFound(_0x2de659,null))[_0x6a28('0x20')](function(_0x2e9b4e){if(_0x2e9b4e){_0x3c156f[_0x6a28('0x46')]=_['keys'](db[_0x6a28('0x6e')]['rawAttributes']);_0x3c156f[_0x6a28('0x42')]=_[_0x6a28('0x43')](_0x27f7e4[_0x6a28('0x42')]);_0x3c156f[_0x6a28('0x44')]=_[_0x6a28('0x45')](_0x3c156f[_0x6a28('0x46')],_0x3c156f[_0x6a28('0x42')]);_0x2467ae['attributes']=_[_0x6a28('0x45')](_0x3c156f['model'],qs[_0x6a28('0x48')](_0x27f7e4[_0x6a28('0x42')][_0x6a28('0x48')]));_0x2467ae[_0x6a28('0x47')]=_0x2467ae['attributes'][_0x6a28('0x57')]?_0x2467ae[_0x6a28('0x47')]:_0x3c156f[_0x6a28('0x46')];if(!_0x27f7e4[_0x6a28('0x42')]['hasOwnProperty'](_0x6a28('0x4a'))){_0x2467ae[_0x6a28('0x2f')]=qs['limit'](_0x27f7e4['query'][_0x6a28('0x2f')]);_0x2467ae[_0x6a28('0x2e')]=qs[_0x6a28('0x2e')](_0x27f7e4[_0x6a28('0x42')][_0x6a28('0x2e')]);}_0x2467ae[_0x6a28('0x6f')]=qs[_0x6a28('0x4b')](_0x27f7e4[_0x6a28('0x42')]['sort']);_0x2467ae[_0x6a28('0x4c')]=qs['filters'](_['pick'](_0x27f7e4[_0x6a28('0x42')],_0x3c156f['filters']));_0x2467ae[_0x6a28('0x4c')][_0x6a28('0x63')]=_0x2e9b4e['id'];if(_0x27f7e4['query'][_0x6a28('0x4d')]){_0x2467ae[_0x6a28('0x4c')]=_[_0x6a28('0x4e')](_0x2467ae[_0x6a28('0x4c')],{'$or':_[_0x6a28('0x3e')](_0x2467ae[_0x6a28('0x47')],function(_0x310aa1){var _0x80eced={};_0x80eced[_0x310aa1]={'$like':'%'+_0x27f7e4['query']['filter']+'%'};return _0x80eced;})});}_0x2467ae=_[_0x6a28('0x4e')]({},_0x2467ae,_0x27f7e4['options']);return db[_0x6a28('0x6e')][_0x6a28('0x30')]({'where':_0x2467ae[_0x6a28('0x4c')]})['then'](function(_0x29ff8e){_0x43c7b4[_0x6a28('0x30')]=_0x29ff8e;if(_0x27f7e4[_0x6a28('0x42')][_0x6a28('0x51')]){_0x2467ae['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x6a28('0x68')](_0x2467ae);})[_0x6a28('0x20')](function(_0x6385ef){_0x43c7b4[_0x6a28('0x69')]=_0x6385ef;return _0x43c7b4;});}})[_0x6a28('0x20')](respondWithFilteredResult(_0x2de659,_0x2467ae))[_0x6a28('0x52')](handleError(_0x2de659,null));};exports[_0x6a28('0x70')]=function(_0x236a3d,_0x577af1,_0x439d45){return db[_0x6a28('0x55')]['find']({'where':{'id':_0x236a3d[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x577af1,null))[_0x6a28('0x20')](function(_0x5606ca){if(_0x5606ca){return _0x5606ca[_0x6a28('0x70')](_0x236a3d[_0x6a28('0x42')][_0x6a28('0x6b')]);}})['then'](respondWithStatusCode(_0x577af1,null))[_0x6a28('0x52')](handleError(_0x577af1,null));};exports['addAgents']=function(_0x5862fd,_0x53f031,_0x53e8da){return db[_0x6a28('0x55')][_0x6a28('0x59')]({'where':{'id':_0x5862fd[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x53f031,null))[_0x6a28('0x20')](function(_0x39a509){if(_0x39a509){return _0x39a509['addAgents'](_0x5862fd['body']['ids'],_[_0x6a28('0x71')](_0x5862fd[_0x6a28('0x5b')],[_0x6a28('0x6b'),'id'])||{})[_0x6a28('0x72')](function(_0x3ed315){for(var _0x3a1feb=0x0;_0x3a1feb<_0x5862fd[_0x6a28('0x5b')][_0x6a28('0x6b')]['length'];_0x3a1feb+=0x1){socket[_0x6a28('0x73')](_0x6a28('0x74'),{'UserId':Number(_0x5862fd['body']['ids'][_0x3a1feb]),'WhatsappAccountId':Number(_0x5862fd['params']['id'])});}return _0x3ed315;});}})[_0x6a28('0x20')](respondWithResult(_0x53f031,null))[_0x6a28('0x52')](handleError(_0x53f031,null));};exports[_0x6a28('0x75')]=function(_0x10fb6c,_0x1023bd,_0x5e771f){return db[_0x6a28('0x55')][_0x6a28('0x59')]({'where':{'id':_0x10fb6c['params']['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x1023bd,null))[_0x6a28('0x20')](function(_0x4d62a3){if(_0x4d62a3){return _0x4d62a3[_0x6a28('0x75')](_0x10fb6c['query']['ids'])[_0x6a28('0x20')](function(){if(_['isArray'](_0x10fb6c[_0x6a28('0x42')][_0x6a28('0x6b')])){for(var _0x586e3a=0x0;_0x586e3a<_0x10fb6c[_0x6a28('0x42')][_0x6a28('0x6b')][_0x6a28('0x57')];_0x586e3a+=0x1){socket['emit'](_0x6a28('0x76'),{'UserId':Number(_0x10fb6c[_0x6a28('0x42')][_0x6a28('0x6b')][_0x586e3a]),'WhatsappAccountId':Number(_0x10fb6c['params']['id'])});}}else{socket[_0x6a28('0x73')](_0x6a28('0x76'),{'UserId':Number(_0x10fb6c['query']['ids']),'WhatsappAccountId':Number(_0x10fb6c[_0x6a28('0x54')]['id'])});}});}})[_0x6a28('0x20')](respondWithStatusCode(_0x1023bd,null))[_0x6a28('0x52')](handleError(_0x1023bd,null));};exports[_0x6a28('0x77')]=function(_0x17dfd3,_0x132138,_0x1dbfa9){var _0x4e3df8={};var _0x30b26b={};var _0x5baf63;var _0x34dc4c;return db[_0x6a28('0x55')][_0x6a28('0x66')]({'where':{'id':_0x17dfd3['params']['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x132138,null))['then'](function(_0x17f08e){if(_0x17f08e){_0x5baf63=_0x17f08e;_0x30b26b[_0x6a28('0x46')]=_[_0x6a28('0x43')](db[_0x6a28('0x78')][_0x6a28('0x56')]);_0x30b26b[_0x6a28('0x42')]=_[_0x6a28('0x43')](_0x17dfd3['query']);_0x30b26b[_0x6a28('0x44')]=_[_0x6a28('0x45')](_0x30b26b['model'],_0x30b26b[_0x6a28('0x42')]);_0x4e3df8[_0x6a28('0x47')]=_[_0x6a28('0x45')](_0x30b26b[_0x6a28('0x46')],qs[_0x6a28('0x48')](_0x17dfd3[_0x6a28('0x42')]['fields']));_0x4e3df8[_0x6a28('0x47')]=_0x4e3df8[_0x6a28('0x47')][_0x6a28('0x57')]?_0x4e3df8[_0x6a28('0x47')]:_0x30b26b['model'];_0x4e3df8[_0x6a28('0x6f')]=qs[_0x6a28('0x4b')](_0x17dfd3['query'][_0x6a28('0x4b')]);_0x4e3df8[_0x6a28('0x4c')]=qs[_0x6a28('0x44')](_[_0x6a28('0x67')](_0x17dfd3[_0x6a28('0x42')],_0x30b26b['filters']));if(_0x17dfd3['query'][_0x6a28('0x4d')]){_0x4e3df8[_0x6a28('0x4c')]=_[_0x6a28('0x4e')](_0x4e3df8[_0x6a28('0x4c')],{'$or':_[_0x6a28('0x3e')](_0x4e3df8[_0x6a28('0x47')],function(_0x3a4987){var _0xf054b={};_0xf054b[_0x3a4987]={'$like':'%'+_0x17dfd3['query'][_0x6a28('0x4d')]+'%'};return _0xf054b;})});}_0x4e3df8=_['merge']({},_0x4e3df8,_0x17dfd3[_0x6a28('0x50')]);return _0x5baf63[_0x6a28('0x77')](_0x4e3df8);}})[_0x6a28('0x20')](function(_0x1be66e){if(_0x1be66e){_0x34dc4c=_0x1be66e[_0x6a28('0x57')];if(!_0x17dfd3[_0x6a28('0x42')][_0x6a28('0x49')](_0x6a28('0x4a'))){_0x4e3df8[_0x6a28('0x2f')]=qs[_0x6a28('0x2f')](_0x17dfd3[_0x6a28('0x42')][_0x6a28('0x2f')]);_0x4e3df8[_0x6a28('0x2e')]=qs['offset'](_0x17dfd3[_0x6a28('0x42')][_0x6a28('0x2e')]);}return _0x5baf63[_0x6a28('0x77')](_0x4e3df8);}})[_0x6a28('0x20')](function(_0x6ccd3b){if(_0x6ccd3b){return _0x6ccd3b?{'count':_0x34dc4c,'rows':_0x6ccd3b}:null;}})[_0x6a28('0x20')](respondWithResult(_0x132138,null))[_0x6a28('0x52')](handleError(_0x132138,null));};exports['addApplications']=function(_0x597e49,_0x51a294){var _0x2a8b02=_0x597e49[_0x6a28('0x54')]['id'];var _0x1e2c5e=_0x597e49[_0x6a28('0x5b')];var _0x10271c=0xc8;var _0x325b42=null;return db[_0x6a28('0x79')][_0x6a28('0x7a')]({'isolationLevel':db[_0x6a28('0x79')]['Transaction'][_0x6a28('0x7b')][_0x6a28('0x7c')]},function(_0x55ec3f){return db['WhatsappAccount'][_0x6a28('0x66')]({'where':{'id':_0x2a8b02},'transaction':_0x55ec3f})[_0x6a28('0x20')](function(_0x51575e){if(_0x51575e){return db[_0x6a28('0x7d')][_0x6a28('0x38')]({'where':{'WhatsappAccountId':_0x2a8b02},'transaction':_0x55ec3f})['then'](function(){var _0x2e6f98=_[_0x6a28('0x3e')](_0x1e2c5e,function(_0x43fdaf){_0x43fdaf[_0x6a28('0x63')]=_0x2a8b02;return _0x43fdaf;});return db[_0x6a28('0x7d')][_0x6a28('0x7e')](_0x2e6f98,{'transaction':_0x55ec3f});});}else{_0x10271c=0x194;_0x325b42=[];}});})[_0x6a28('0x20')](function(){if(_0x10271c!==0x194){return db[_0x6a28('0x7d')][_0x6a28('0x7f')]({'where':{'WhatsappAccountId':_0x2a8b02},'order':_0x6a28('0x80')})['then'](function(_0x33412d){_0x325b42=_0x33412d;});}})['catch'](function(_0x589609){_0x10271c=0x1f4;logger['error'](_0x589609[_0x6a28('0x39')]);if(_0x589609[_0x6a28('0x3a')]){delete _0x589609['name'];}_0x325b42=_0x589609;})[_0x6a28('0x81')](function(){if(_0x325b42===null){_0x51a294[_0x6a28('0x82')](_0x10271c);}else{if(_0x10271c===0x1f4){_0x51a294[_0x6a28('0x2b')](_0x10271c)['send'](_0x325b42);}else{_0x51a294['status'](_0x10271c)[_0x6a28('0x2d')](_0x325b42);}}});};exports['getApplications']=function(_0x2a865a,_0x1a7ec5,_0x3b29b4){var _0x98c8b9={};var _0x4c013f={};var _0x557a53;var _0x24910d;return db[_0x6a28('0x55')][_0x6a28('0x66')]({'where':{'id':_0x2a865a[_0x6a28('0x54')]['id']}})[_0x6a28('0x20')](handleEntityNotFound(_0x1a7ec5,null))[_0x6a28('0x20')](function(_0xf374ff){if(_0xf374ff){_0x557a53=_0xf374ff;_0x4c013f[_0x6a28('0x46')]=_[_0x6a28('0x43')](db[_0x6a28('0x7d')][_0x6a28('0x56')]);_0x4c013f[_0x6a28('0x42')]=_[_0x6a28('0x43')](_0x2a865a[_0x6a28('0x42')]);_0x4c013f['filters']=_[_0x6a28('0x45')](_0x4c013f['model'],_0x4c013f[_0x6a28('0x42')]);_0x98c8b9[_0x6a28('0x47')]=_['intersection'](_0x4c013f['model'],qs['fields'](_0x2a865a[_0x6a28('0x42')]['fields']));_0x98c8b9[_0x6a28('0x47')]=_0x98c8b9[_0x6a28('0x47')][_0x6a28('0x57')]?_0x98c8b9[_0x6a28('0x47')]:_0x4c013f[_0x6a28('0x46')];_0x98c8b9[_0x6a28('0x6f')]=qs[_0x6a28('0x4b')](_0x2a865a[_0x6a28('0x42')]['sort']);_0x98c8b9[_0x6a28('0x4c')]=qs[_0x6a28('0x44')](_['pick'](_0x2a865a[_0x6a28('0x42')],_0x4c013f[_0x6a28('0x44')]));if(_0x2a865a[_0x6a28('0x42')][_0x6a28('0x4d')]){_0x98c8b9[_0x6a28('0x4c')]=_[_0x6a28('0x4e')](_0x98c8b9['where'],{'$or':_[_0x6a28('0x3e')](_0x98c8b9['attributes'],function(_0x3199d5){var _0x4985bc={};_0x4985bc[_0x3199d5]={'$like':'%'+_0x2a865a[_0x6a28('0x42')][_0x6a28('0x4d')]+'%'};return _0x4985bc;})});}_0x98c8b9=_['merge']({},_0x98c8b9,_0x2a865a['options']);return _0x557a53[_0x6a28('0x83')](_0x98c8b9);}})[_0x6a28('0x20')](function(_0x7c7917){if(_0x7c7917){_0x24910d=_0x7c7917[_0x6a28('0x57')];if(!_0x2a865a[_0x6a28('0x42')][_0x6a28('0x49')](_0x6a28('0x4a'))){_0x98c8b9[_0x6a28('0x2f')]=qs[_0x6a28('0x2f')](_0x2a865a[_0x6a28('0x42')][_0x6a28('0x2f')]);_0x98c8b9[_0x6a28('0x2e')]=qs[_0x6a28('0x2e')](_0x2a865a[_0x6a28('0x42')][_0x6a28('0x2e')]);}return _0x557a53[_0x6a28('0x83')](_0x98c8b9);}})[_0x6a28('0x20')](function(_0x590768){if(_0x590768){return _0x590768?{'count':_0x24910d,'rows':_0x590768}:null;}})[_0x6a28('0x20')](respondWithResult(_0x1a7ec5,null))['catch'](handleError(_0x1a7ec5,null));};exports[_0x6a28('0x84')]=function(_0x3b42a2,_0x5f20e4,_0x39d1b2){var _0x28b431={'channel':_0x6a28('0x85')};var _0x42c0dc=[];var _0x93f553=[];var _0x94c541={};return db[_0x6a28('0x55')][_0x6a28('0x59')]({'where':{'id':_0x3b42a2[_0x6a28('0x54')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x6a28('0x86')}]})[_0x6a28('0x20')](handleEntityNotFound(_0x5f20e4,null))['then'](function(_0x2ea3f9){_0x28b431[_0x6a28('0x87')]=_0x2ea3f9;if(_0x28b431[_0x6a28('0x87')]&&_0x28b431['account'][_0x6a28('0x40')]===_0x6a28('0x88')&&_0x3b42a2[_0x6a28('0x5b')]['statuses']){if(_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x89')][_0x6a28('0x57')]===0x0)return;if(_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x89')][0x0][_0x6a28('0x8a')]!==_0x6a28('0x8b'))return;return db[_0x6a28('0x8c')][_0x6a28('0x8d')]({'read':!![],'readAt':_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x89')][0x0][_0x6a28('0x8e')]},{'where':{'messageId':_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x89')][0x0]['message_id']},'individualHooks':!![]})[_0x6a28('0x20')](function(_0xcfa72c){return _0x5f20e4[_0x6a28('0x2b')](0xc8)['json'](_0xcfa72c);});}_0x28b431[_0x6a28('0x8f')]=_[_0x6a28('0x90')](_0x2ea3f9['Applications'],[_0x6a28('0x80')],[_0x6a28('0x91')]);if(_0x28b431['account'][_0x6a28('0x86')]){delete _0x28b431[_0x6a28('0x87')]['Applications'];}return db[_0x6a28('0x92')][_0x6a28('0x61')]()['then'](function(_0x28ace4){if(!_0x28ace4){throw new db['Sequelize']['ValidationError'](_0x6a28('0x93'));}_0x42c0dc=_[_0x6a28('0x94')](_[_0x6a28('0x43')](_0x28ace4),[_0x6a28('0x95'),_0x6a28('0x96')]);_0x93f553=_[_0x6a28('0x94')](_['keys'](_0x28ace4),[_0x6a28('0x95'),_0x6a28('0x96'),_0x6a28('0x97'),_0x6a28('0x98')]);_0x28b431['body']={'mapKey':_0x6a28('0x99')};if(_0x28b431[_0x6a28('0x87')]&&_0x28b431[_0x6a28('0x87')][_0x6a28('0x40')]===_0x6a28('0x9a')){_0x28b431[_0x6a28('0x5b')][_0x6a28('0x9b')]=_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x9c')][_0x6a28('0x9d')](_0x6a28('0x9e'),'');_0x28b431['body'][_0x6a28('0x5b')]=_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0x9f')];_0x28b431[_0x6a28('0x5b')][_0x6a28('0xa0')]=_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0xa1')];}if(_0x28b431[_0x6a28('0x87')]&&_0x28b431[_0x6a28('0x87')][_0x6a28('0x40')]===_0x6a28('0x88')){_0x28b431['body']['from']=_0x3b42a2[_0x6a28('0x5b')]['notifications'][0x0]['from'];_0x28b431[_0x6a28('0x5b')]['body']=_0x3b42a2[_0x6a28('0x5b')][_0x6a28('0xa2')][0x0][_0x6a28('0x29')]['body'];_0x28b431['body'][_0x6a28('0xa0')]=_0x3b42a2['body'][_0x6a28('0xa2')][0x0]['message_id'];}if(_0x28b431[_0x6a28('0x5b')]['id']){delete _0x28b431[_0x6a28('0x5b')]['id'];}if(_[_0x6a28('0xa3')](_0x28b431['body'][_0x6a28('0x9b')])){throw new db[(_0x6a28('0xa4'))][(_0x6a28('0xa5'))](_0x6a28('0xa6'));}if(_[_0x6a28('0xa3')](_0x28b431[_0x6a28('0x5b')][_0x6a28('0x5b')])||_0x28b431['body'][_0x6a28('0x5b')]===''){throw new db[(_0x6a28('0xa4'))]['ValidationError'](_0x6a28('0xa7'));}if(_[_0x6a28('0xa3')](_0x28b431[_0x6a28('0x5b')][_0x6a28('0xa8')])){throw new db[(_0x6a28('0xa4'))][(_0x6a28('0xa5'))](_0x6a28('0xa9')+_0x93f553);}if(!_[_0x6a28('0xaa')](_0x93f553,_0x28b431['body']['mapKey'])){throw new db[(_0x6a28('0xa4'))][(_0x6a28('0xa5'))](_0x6a28('0xab')+_0x93f553);}_0x94c541[_0x28b431[_0x6a28('0x5b')][_0x6a28('0xa8')]]=_0x28b431['body'][_0x6a28('0x9b')];return db['CmList'][_0x6a28('0x59')]({'where':{'id':_0x28b431[_0x6a28('0x87')]['ListId']},'include':[{'model':db[_0x6a28('0x92')],'as':_0x6a28('0xac'),'where':_0x94c541,'limit':0x1,'order':[[_0x6a28('0x96'),_0x6a28('0xad')]]}]});})[_0x6a28('0x20')](handleEntityNotFound(_0x5f20e4,null))['then'](function(_0x20f023){if(_0x20f023){_0x28b431[_0x6a28('0xae')]=_['omit'](_0x20f023,[_0x6a28('0xac')]);if(_0x20f023['Contacts'][_0x6a28('0x57')]){return _0x20f023[_0x6a28('0xac')][0x0];}var _0x436389=_[_0x6a28('0x19')](_0x28b431[_0x6a28('0x5b')],{'firstName':_0x28b431[_0x6a28('0x5b')][_0x6a28('0x9b')],'ListId':_0x20f023['id']});_0x436389[_0x28b431[_0x6a28('0x5b')][_0x6a28('0xa8')]]=_0x28b431[_0x6a28('0x5b')][_0x6a28('0x9b')];return db[_0x6a28('0x92')][_0x6a28('0x5a')](_0x436389,{'fields':_0x42c0dc,'raw':!![]});}})['then'](handleEntityNotFound(_0x5f20e4,null))[_0x6a28('0x20')](function(_0xb05774){if(_0xb05774){_0x28b431[_0x6a28('0xaf')]=_0xb05774;var _0x3e5149={'ContactId':_0xb05774['id'],'phone':_0x28b431[_0x6a28('0x5b')][_0x6a28('0x9b')],'WhatsappAccountId':_0x3b42a2[_0x6a28('0x54')]['id']};var _0x29c192={'ContactId':_0xb05774['id'],'WhatsappAccountId':_0x3b42a2[_0x6a28('0x54')]['id'],'closed':![]};return db[_0x6a28('0xb0')][_0x6a28('0x59')]({'where':_0x29c192})[_0x6a28('0x20')](function(_0x26fc96){if(_0x26fc96){return[_0x26fc96,![]];}return db[_0x6a28('0xb0')]['create'](_0x3e5149)[_0x6a28('0x20')](function(_0x14be9c){return[_0x14be9c,!![]];});});}})[_0x6a28('0x72')](function(_0x28c404,_0x3f8743){_0x28b431[_0x6a28('0xb1')]=_0x28c404[_0x6a28('0x35')]({'plain':!![]});_0x28b431['interaction'][_0x6a28('0xb2')]=![];if(_0x3f8743){if(_0x28b431[_0x6a28('0x87')]['autoclose']){_0x28b431[_0x6a28('0x8f')][_0x6a28('0xb3')]({'id':0x0,'priority':_0x28b431[_0x6a28('0x8f')][_0x6a28('0x57')]+0x1,'app':'close','appdata':_0x6a28('0xb4'),'interval':'*,*,*,*'});}_0x28b431[_0x6a28('0xb1')][_0x6a28('0xb2')]=!![];}return db['WhatsappMessage'][_0x6a28('0x5a')]({'phone':_0x28b431[_0x6a28('0x5b')][_0x6a28('0x9b')],'messageId':_0x28b431['body'][_0x6a28('0xa0')],'body':_0x28b431[_0x6a28('0x5b')][_0x6a28('0x5b')],'WhatsappAccountId':_0x3b42a2['params']['id'],'WhatsappInteractionId':_0x28c404['id'],'direction':'in','ContactId':_0x28c404['ContactId'],'AttachmentId':_0x28b431[_0x6a28('0x5b')][_0x6a28('0xb5')]});})[_0x6a28('0x20')](function(_0x3fd4fa){_0x28b431['message']=_0x3fd4fa;if(_0x28b431['interaction'][_0x6a28('0xb6')]){return db[_0x6a28('0x78')][_0x6a28('0x59')]({'attributes':['id',_0x6a28('0x3a')],'where':{'id':_0x28b431[_0x6a28('0xb1')][_0x6a28('0xb6')]}})['then'](function(_0x4d4b5d){if(_0x4d4b5d){_0x28b431[_0x6a28('0x8f')][_0x6a28('0xb7')]({'id':0x0,'priority':0x0,'app':_0x6a28('0xb8'),'appdata':_0x4d4b5d['name']+','+(_0x28b431[_0x6a28('0x87')][_0x6a28('0xb9')]||0xa),'interval':_0x6a28('0xba')});}return respondWithRpcPromise(_0x6a28('0xbb'),'startRouting',_0x28b431);});}return respondWithRpcPromise(_0x6a28('0xbb'),'startRouting',_0x28b431);})[_0x6a28('0x20')](function(_0x263be1){if(_0x263be1){var _0x365896=0xc8;var _0x100093=_0x6a28('0xbc');logger[_0x6a28('0x21')](_0x6a28('0x24'),_0x100093,_0x365896,_0x6a28('0xbd'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x100093,_0x365896,_0x6a28('0xbd'),JSON['stringify'](_0x263be1));if(_0x28b431[_0x6a28('0x87')][_0x6a28('0x40')]===_0x6a28('0x9a')){return _0x5f20e4[_0x6a28('0x2b')](_0x365896)[_0x6a28('0x31')]('Content-Type',_0x6a28('0xbe'))[_0x6a28('0x3b')](_0x6a28('0xbf'));}else{return _0x5f20e4[_0x6a28('0x2b')](_0x365896)[_0x6a28('0x2d')](_0x263be1);}}});})[_0x6a28('0x52')](handleError(_0x5f20e4,null));};exports[_0x6a28('0x3b')]=function(_0x5a0db1,_0x48f6dc,_0xca2707){var _0x1cd209,_0x4df664,_0x434e89;if(_[_0x6a28('0xa3')](_0x5a0db1['body']['body'])||_0x5a0db1['body']['body']===''){throw new db[(_0x6a28('0xa4'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6a28('0xa3')](_0x5a0db1[_0x6a28('0x5b')]['to'])){throw new db[(_0x6a28('0xa4'))][(_0x6a28('0xa5'))](_0x6a28('0xc0'));}_0x1cd209=_0x5a0db1[_0x6a28('0x5b')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x5a0db1[_0x6a28('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x6a28('0xc1'),'include':[{'model':db[_0x6a28('0x92')],'as':_0x6a28('0xac'),'where':{'mobile':_0x1cd209},'limit':0x1,'order':[[_0x6a28('0x96'),'DESC']]}]}]})[_0x6a28('0x20')](handleEntityNotFound(_0x48f6dc,null))[_0x6a28('0x20')](function(_0x4047fe){if(_0x4047fe&&_0x4047fe[_0x6a28('0xc1')]){_0x4df664=_0x4047fe[_0x6a28('0x35')]({'plain':!![]});if(_0x4df664[_0x6a28('0xc1')]&&_0x4df664['List'][_0x6a28('0xac')][_0x6a28('0x57')]){return _0x4df664['List'][_0x6a28('0xac')][0x0];}return db['CmContact'][_0x6a28('0x5a')](_['defaults'](_0x5a0db1[_0x6a28('0x5b')],{'firstName':_0x1cd209,'mobile':_0x1cd209,'phone':_0x1cd209,'ListId':_0x4df664[_0x6a28('0x98')]}));}})[_0x6a28('0x20')](handleEntityNotFound(_0x48f6dc,null))['then'](function(_0x28c1a8){if(_0x28c1a8){_0x434e89=_0x28c1a8;return db['WhatsappInteraction'][_0x6a28('0x59')]({'where':{'ContactId':_0x434e89['id'],'closed':![],'WhatsappAccountId':_0x4df664['id']}})[_0x6a28('0x20')](function(_0xec6a74){if(_0xec6a74){return[_0xec6a74,![]];}return db[_0x6a28('0xb0')]['create']({'UserId':_0x5a0db1[_0x6a28('0x5c')]['id'],'ContactId':_0x434e89['id'],'WhatsappAccountId':_0x4df664['id'],'phone':_0x1cd209,'firstMsgDirection':_0x6a28('0xc2'),'Messages':[_[_0x6a28('0x4e')](_0x5a0db1[_0x6a28('0x5b')],{'read':![],'body':_0x5a0db1[_0x6a28('0x5b')]['body'],'phone':_0x1cd209,'WhatsappAccountId':_0x4df664['id'],'UserId':_0x5a0db1[_0x6a28('0x5c')]['id'],'ContactId':_0x434e89['id']})]},{'include':[{'model':db[_0x6a28('0x8c')],'as':_0x6a28('0xc3')}]})[_0x6a28('0x20')](function(_0x4826ba){return[_0x4826ba,!![]];});});}})['spread'](function(_0x5cde4e,_0x6e0b9e){if(_0x6e0b9e){return _0x5cde4e;}return db['WhatsappMessage'][_0x6a28('0x5a')](_[_0x6a28('0x4e')](_0x5a0db1['body'],{'read':![],'body':_0x5a0db1[_0x6a28('0x5b')][_0x6a28('0x5b')],'phone':_0x1cd209,'WhatsappAccountId':_0x4df664['id'],'WhatsappInteractionId':_0x5cde4e['id'],'UserId':_0x5a0db1[_0x6a28('0x5c')]['id'],'ContactId':_0x434e89['id']}))[_0x6a28('0x20')](function(_0x2d567d){_0x5cde4e[_0x6a28('0xc4')]['Messages']=[];_0x5cde4e[_0x6a28('0xc4')][_0x6a28('0xc3')][_0x6a28('0xb3')](_0x2d567d[_0x6a28('0xc4')]);return _0x5cde4e;});})[_0x6a28('0x20')](respondWithResult(_0x48f6dc,null))[_0x6a28('0x52')](handleError(_0x48f6dc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 19b3a99..199bc6f 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 _0xea22=['exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x211fdc,_0x4d5567){var _0x225ce2=function(_0x148c7c){while(--_0x148c7c){_0x211fdc['push'](_0x211fdc['shift']());}};_0x225ce2(++_0x4d5567);}(_0xea22,0x1c8));var _0x2ea2=function(_0x583023,_0x14508a){_0x583023=_0x583023-0x0;var _0x1f1dee=_0xea22[_0x583023];return _0x1f1dee;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x2ea2('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2ea2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2ea2('0x2')};function emitEvent(_0x30af6a){return function(_0x1edd15,_0x3ff242,_0x1bf57d){WhatsappAccountEvents[_0x2ea2('0x3')](_0x30af6a+':'+_0x1edd15['id'],_0x1edd15);WhatsappAccountEvents[_0x2ea2('0x3')](_0x30af6a,_0x1edd15);_0x1bf57d(null);};}for(var e in events){if(events[_0x2ea2('0x4')](e)){var event=events[e];WhatsappAccount[_0x2ea2('0x5')](e,emitEvent(event));}}module[_0x2ea2('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe534=['hasOwnProperty','../../mysqldb','WhatsappAccount','save','remove','emit'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xe534,0x139));var _0x4e53=function(_0x21286b,_0xb8e52f){_0x21286b=_0x21286b-0x0;var _0x3435cb=_0xe534[_0x21286b];return _0x3435cb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x4e53('0x0'))['db'][_0x4e53('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e53('0x2'),'afterUpdate':'update','afterDestroy':_0x4e53('0x3')};function emitEvent(_0xf3fc2a){return function(_0x9e81b9,_0xe10a86,_0x39fdae){WhatsappAccountEvents['emit'](_0xf3fc2a+':'+_0x9e81b9['id'],_0x9e81b9);WhatsappAccountEvents[_0x4e53('0x4')](_0xf3fc2a,_0x9e81b9);_0x39fdae(null);};}for(var e in events){if(events[_0x4e53('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d73de1d..a21f22e 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 _0xb9c0=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x25e775,_0x427253){var _0x45df77=function(_0x5e6c17){while(--_0x5e6c17){_0x25e775['push'](_0x25e775['shift']());}};_0x45df77(++_0x427253);}(_0xb9c0,0x64));var _0x0b9c=function(_0x3a777b,_0x27a9f1){_0x3a777b=_0x3a777b-0x0;var _0xcfe488=_0xb9c0[_0x3a777b];return _0xcfe488;};'use strict';var _=require(_0x0b9c('0x0'));var util=require(_0x0b9c('0x1'));var logger=require(_0x0b9c('0x2'))(_0x0b9c('0x3'));var moment=require(_0x0b9c('0x4'));var BPromise=require(_0x0b9c('0x5'));var rp=require(_0x0b9c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b9c('0x7'));var config=require(_0x0b9c('0x8'));var attributes=require(_0x0b9c('0x9'));module[_0x0b9c('0xa')]=function(_0x4d41dd,_0x2167ce){return _0x4d41dd[_0x0b9c('0xb')](_0x0b9c('0xc'),attributes,{'tableName':_0x0b9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84d0=['util','api','moment','request-promise','path','rimraf','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x3642bc,_0x35f3b4){var _0x5ba50f=function(_0x128bf3){while(--_0x128bf3){_0x3642bc['push'](_0x3642bc['shift']());}};_0x5ba50f(++_0x35f3b4);}(_0x84d0,0x78));var _0x084d=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x84d0[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x084d('0x0'));var util=require(_0x084d('0x1'));var logger=require('../../config/logger')(_0x084d('0x2'));var moment=require(_0x084d('0x3'));var BPromise=require('bluebird');var rp=require(_0x084d('0x4'));var fs=require('fs');var path=require(_0x084d('0x5'));var rimraf=require(_0x084d('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x084d('0x7')]=function(_0x51d7ce,_0x50f375){return _0x51d7ce[_0x084d('0x8')](_0x084d('0x9'),attributes,{'tableName':_0x084d('0xa'),'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 07c43f7..0997491 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 _0x844f=['include','map','model','then','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes'];(function(_0x5d43ec,_0x4730e2){var _0x316949=function(_0x2208f6){while(--_0x2208f6){_0x5d43ec['push'](_0x5d43ec['shift']());}};_0x316949(++_0x4730e2);}(_0x844f,0x19c));var _0xf844=function(_0x2d248c,_0x42a3df){_0x2d248c=_0x2d248c-0x0;var _0xf3820=_0x844f[_0x2d248c];return _0xf3820;};'use strict';var _=require('lodash');var util=require(_0xf844('0x0'));var moment=require('moment');var BPromise=require(_0xf844('0x1'));var rs=require(_0xf844('0x2'));var fs=require('fs');var Redis=require(_0xf844('0x3'));var db=require(_0xf844('0x4'))['db'];var utils=require(_0xf844('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf844('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf844('0x7')][_0xf844('0x8')]({'port':0x232a});config['redis']=_[_0xf844('0x9')](config[_0xf844('0xa')],{'host':_0xf844('0xb'),'port':0x18eb});var socket=require(_0xf844('0xc'))(new Redis(config[_0xf844('0xa')]));require(_0xf844('0xd'))[_0xf844('0xe')](socket);function respondWithRpcPromise(_0x14041a,_0x1df6b3,_0x3e80d7){return new BPromise(function(_0x45b0e3,_0x3efdac){return client[_0xf844('0xf')](_0x14041a,_0x3e80d7)['then'](function(_0x4b39ab){logger[_0xf844('0x10')](_0xf844('0x11'),_0x1df6b3,_0xf844('0x12'));logger[_0xf844('0x13')](_0xf844('0x14'),_0x1df6b3,_0xf844('0x12'),JSON['stringify'](_0x4b39ab));if(_0x4b39ab[_0xf844('0x15')]){if(_0x4b39ab[_0xf844('0x15')][_0xf844('0x16')]===0x1f4){logger['error'](_0xf844('0x11'),_0x1df6b3,_0x4b39ab['error'][_0xf844('0x17')]);return _0x3efdac(_0x4b39ab[_0xf844('0x15')][_0xf844('0x17')]);}logger[_0xf844('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x1df6b3,_0x4b39ab['error']['message']);return _0x45b0e3(_0x4b39ab['error'][_0xf844('0x17')]);}else{logger[_0xf844('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1df6b3,_0xf844('0x12'));_0x45b0e3(_0x4b39ab[_0xf844('0x18')][_0xf844('0x17')]);}})[_0xf844('0x19')](function(_0x5e11ef){logger[_0xf844('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x1df6b3,_0x5e11ef);_0x3efdac(_0x5e11ef);});});}exports[_0xf844('0x1a')]=function(_0x1f6510){var _0x2d734a=this;return new Promise(function(_0x436eaa,_0x3b11d1){return db[_0xf844('0x1b')]['find']({'raw':_0x1f6510[_0xf844('0x1c')]?_0x1f6510[_0xf844('0x1c')][_0xf844('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f6510['options']?_0x1f6510[_0xf844('0x1c')][_0xf844('0x1e')]||null:null,'attributes':_0x1f6510[_0xf844('0x1c')]?_0x1f6510[_0xf844('0x1c')][_0xf844('0x1f')]||null:null,'include':_0x1f6510[_0xf844('0x1c')]?_0x1f6510[_0xf844('0x1c')][_0xf844('0x20')]?_[_0xf844('0x21')](_0x1f6510[_0xf844('0x1c')][_0xf844('0x20')],function(_0x58b1c4){return{'model':db[_0x58b1c4[_0xf844('0x22')]],'as':_0x58b1c4['as'],'attributes':_0x58b1c4['attributes'],'include':_0x58b1c4[_0xf844('0x20')]?_[_0xf844('0x21')](_0x58b1c4[_0xf844('0x20')],function(_0x166f91){return{'model':db[_0x166f91['model']],'as':_0x166f91['as'],'attributes':_0x166f91['attributes'],'include':_0x166f91[_0xf844('0x20')]?_[_0xf844('0x21')](_0x166f91[_0xf844('0x20')],function(_0xb8d782){return{'model':db[_0xb8d782[_0xf844('0x22')]],'as':_0xb8d782['as'],'attributes':_0xb8d782['attributes']};}):[]};}):[]};}):[]:[]})[_0xf844('0x23')](function(_0x2d7956){logger[_0xf844('0x10')]('ShowWhatsappAccount',_0x1f6510);logger[_0xf844('0x13')]('ShowWhatsappAccount',_0x1f6510,JSON[_0xf844('0x24')](_0x2d7956));_0x436eaa(_0x2d7956);})['catch'](function(_0x4dbf5a){logger[_0xf844('0x15')](_0xf844('0x1a'),_0x4dbf5a[_0xf844('0x17')],_0x1f6510);_0x3b11d1(_0x2d734a[_0xf844('0x15')](0x1f4,_0x4dbf5a['message']));});});}; \ No newline at end of file +var _0x3d0a=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1ce0ff,_0x1d224c){var _0x448b56=function(_0x508338){while(--_0x508338){_0x1ce0ff['push'](_0x1ce0ff['shift']());}};_0x448b56(++_0x1d224c);}(_0x3d0a,0xd4));var _0xa3d0=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x3d0a[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xa3d0('0x0'));var util=require('util');var moment=require(_0xa3d0('0x1'));var BPromise=require(_0xa3d0('0x2'));var rs=require(_0xa3d0('0x3'));var fs=require('fs');var Redis=require(_0xa3d0('0x4'));var db=require(_0xa3d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3d0('0x6'))(_0xa3d0('0x7'));var config=require(_0xa3d0('0x8'));var jayson=require(_0xa3d0('0x9'));var client=jayson[_0xa3d0('0xa')][_0xa3d0('0xb')]({'port':0x232a});config[_0xa3d0('0xc')]=_[_0xa3d0('0xd')](config[_0xa3d0('0xc')],{'host':_0xa3d0('0xe'),'port':0x18eb});var socket=require(_0xa3d0('0xf'))(new Redis(config[_0xa3d0('0xc')]));require(_0xa3d0('0x10'))[_0xa3d0('0x11')](socket);function respondWithRpcPromise(_0x42925e,_0x23e5f2,_0x5c2301){return new BPromise(function(_0x919995,_0x52230e){return client[_0xa3d0('0x12')](_0x42925e,_0x5c2301)[_0xa3d0('0x13')](function(_0x4f6255){logger[_0xa3d0('0x14')](_0xa3d0('0x15'),_0x23e5f2,_0xa3d0('0x16'));logger['debug'](_0xa3d0('0x17'),_0x23e5f2,'request\x20sent',JSON['stringify'](_0x4f6255));if(_0x4f6255['error']){if(_0x4f6255[_0xa3d0('0x18')][_0xa3d0('0x19')]===0x1f4){logger[_0xa3d0('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x23e5f2,_0x4f6255[_0xa3d0('0x18')]['message']);return _0x52230e(_0x4f6255[_0xa3d0('0x18')][_0xa3d0('0x1a')]);}logger[_0xa3d0('0x18')](_0xa3d0('0x15'),_0x23e5f2,_0x4f6255[_0xa3d0('0x18')][_0xa3d0('0x1a')]);return _0x919995(_0x4f6255['error'][_0xa3d0('0x1a')]);}else{logger[_0xa3d0('0x14')](_0xa3d0('0x15'),_0x23e5f2,_0xa3d0('0x16'));_0x919995(_0x4f6255[_0xa3d0('0x1b')][_0xa3d0('0x1a')]);}})['catch'](function(_0x4644e1){logger[_0xa3d0('0x18')](_0xa3d0('0x15'),_0x23e5f2,_0x4644e1);_0x52230e(_0x4644e1);});});}exports[_0xa3d0('0x1c')]=function(_0x3096e3){var _0x420c49=this;return new Promise(function(_0x1390fd,_0x49ab85){return db[_0xa3d0('0x1d')][_0xa3d0('0x1e')]({'raw':_0x3096e3['options']?_0x3096e3[_0xa3d0('0x1f')][_0xa3d0('0x20')]===undefined?!![]:![]:!![],'where':_0x3096e3[_0xa3d0('0x1f')]?_0x3096e3[_0xa3d0('0x1f')][_0xa3d0('0x21')]||null:null,'attributes':_0x3096e3[_0xa3d0('0x1f')]?_0x3096e3[_0xa3d0('0x1f')]['attributes']||null:null,'include':_0x3096e3[_0xa3d0('0x1f')]?_0x3096e3[_0xa3d0('0x1f')][_0xa3d0('0x22')]?_[_0xa3d0('0x23')](_0x3096e3['options'][_0xa3d0('0x22')],function(_0x114030){return{'model':db[_0x114030[_0xa3d0('0x24')]],'as':_0x114030['as'],'attributes':_0x114030[_0xa3d0('0x25')],'include':_0x114030[_0xa3d0('0x22')]?_[_0xa3d0('0x23')](_0x114030[_0xa3d0('0x22')],function(_0x3bacea){return{'model':db[_0x3bacea[_0xa3d0('0x24')]],'as':_0x3bacea['as'],'attributes':_0x3bacea[_0xa3d0('0x25')],'include':_0x3bacea[_0xa3d0('0x22')]?_['map'](_0x3bacea[_0xa3d0('0x22')],function(_0x7c69de){return{'model':db[_0x7c69de['model']],'as':_0x7c69de['as'],'attributes':_0x7c69de[_0xa3d0('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a73e2){logger[_0xa3d0('0x14')](_0xa3d0('0x1c'),_0x3096e3);logger['debug'](_0xa3d0('0x1c'),_0x3096e3,JSON[_0xa3d0('0x26')](_0x4a73e2));_0x1390fd(_0x4a73e2);})[_0xa3d0('0x27')](function(_0x2dd4fb){logger[_0xa3d0('0x18')](_0xa3d0('0x1c'),_0x2dd4fb[_0xa3d0('0x1a')],_0x3096e3);_0x49ab85(_0x420c49[_0xa3d0('0x18')](0x1f4,_0x2dd4fb[_0xa3d0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f53d4a3..39485f6 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 _0x57f9=['save','remove','update','emit','removeListener','register','whatsappAccount:'];(function(_0x10fa85,_0x4381f3){var _0x5bbd98=function(_0x36619c){while(--_0x36619c){_0x10fa85['push'](_0x10fa85['shift']());}};_0x5bbd98(++_0x4381f3);}(_0x57f9,0x165));var _0x957f=function(_0x567870,_0x207545){_0x567870=_0x567870-0x0;var _0x2f7898=_0x57f9[_0x567870];return _0x2f7898;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x957f('0x0'),_0x957f('0x1'),_0x957f('0x2')];function createListener(_0x44dfc2,_0x59cfdf){return function(_0x28f6c4){_0x59cfdf[_0x957f('0x3')](_0x44dfc2,_0x28f6c4);};}function removeListener(_0x3e05c3,_0x193e60){return function(){WhatsappAccountEvents[_0x957f('0x4')](_0x3e05c3,_0x193e60);};}exports[_0x957f('0x5')]=function(_0x53f76c){for(var _0x29c7fb=0x0,_0xad20a4=events['length'];_0x29c7fb<_0xad20a4;_0x29c7fb++){var _0x5626be=events[_0x29c7fb];var _0x2e2648=createListener(_0x957f('0x6')+_0x5626be,_0x53f76c);WhatsappAccountEvents['on'](_0x5626be,_0x2e2648);}}; \ No newline at end of file +var _0xb7d5=['./whatsappAccount.events','save','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x4d6f17,_0x31e44e){var _0x19644b=function(_0x4c45c1){while(--_0x4c45c1){_0x4d6f17['push'](_0x4d6f17['shift']());}};_0x19644b(++_0x31e44e);}(_0xb7d5,0xb0));var _0x5b7d=function(_0x59b0d9,_0x381492){_0x59b0d9=_0x59b0d9-0x0;var _0x3af25e=_0xb7d5[_0x59b0d9];return _0x3af25e;};'use strict';var WhatsappAccountEvents=require(_0x5b7d('0x0'));var events=[_0x5b7d('0x1'),'remove',_0x5b7d('0x2')];function createListener(_0x2676bc,_0x2fa6fd){return function(_0x4a6879){_0x2fa6fd[_0x5b7d('0x3')](_0x2676bc,_0x4a6879);};}function removeListener(_0x2a347a,_0x92db36){return function(){WhatsappAccountEvents[_0x5b7d('0x4')](_0x2a347a,_0x92db36);};}exports[_0x5b7d('0x5')]=function(_0x4e79d){for(var _0x454b25=0x0,_0x3751f8=events[_0x5b7d('0x6')];_0x454b25<_0x3751f8;_0x454b25++){var _0x5dbabb=events[_0x454b25];var _0x45ec6e=createListener(_0x5b7d('0x7')+_0x5dbabb,_0x4e79d);WhatsappAccountEvents['on'](_0x5dbabb,_0x45ec6e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8e46664..95e257b 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 _0xc518=['multer','util','path','Router','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','update','destroy','exports'];(function(_0x1b1ff6,_0x54a036){var _0x54b26a=function(_0x139fdc){while(--_0x139fdc){_0x1b1ff6['push'](_0x1b1ff6['shift']());}};_0x54b26a(++_0x54a036);}(_0xc518,0xee));var _0x8c51=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0xc518[_0x140d2f];return _0x1a04c6;};'use strict';var multer=require(_0x8c51('0x0'));var util=require(_0x8c51('0x1'));var path=require(_0x8c51('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c51('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c51('0x4'));router[_0x8c51('0x5')]('/',auth[_0x8c51('0x6')](),controller[_0x8c51('0x7')]);router[_0x8c51('0x5')]('/:id',auth[_0x8c51('0x6')](),controller[_0x8c51('0x8')]);router[_0x8c51('0x9')]('/',auth[_0x8c51('0x6')](),controller[_0x8c51('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8c51('0xb')]);router['delete']('/:id',auth[_0x8c51('0x6')](),controller[_0x8c51('0xc')]);module[_0x8c51('0xd')]=router; \ No newline at end of file +var _0x64bd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','show','post','create','put','delete','exports','multer','util'];(function(_0x101dce,_0x10ca01){var _0x44676a=function(_0x596581){while(--_0x596581){_0x101dce['push'](_0x101dce['shift']());}};_0x44676a(++_0x10ca01);}(_0x64bd,0x97));var _0xd64b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x64bd[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xd64b('0x0'));var util=require(_0xd64b('0x1'));var path=require('path');var timeout=require(_0xd64b('0x2'));var express=require(_0xd64b('0x3'));var router=express[_0xd64b('0x4')]();var fs_extra=require(_0xd64b('0x5'));var auth=require(_0xd64b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd64b('0x7'));var controller=require(_0xd64b('0x8'));router['get']('/',auth[_0xd64b('0x9')](),controller[_0xd64b('0xa')]);router['get']('/:id',auth[_0xd64b('0x9')](),controller[_0xd64b('0xb')]);router[_0xd64b('0xc')]('/',auth[_0xd64b('0x9')](),controller[_0xd64b('0xd')]);router[_0xd64b('0xe')]('/:id',auth[_0xd64b('0x9')](),controller['update']);router[_0xd64b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd64b('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 543e6a0..a2f812c 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 _0x5459=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x4cae38,_0x1f7372){var _0x4fc0d6=function(_0x105335){while(--_0x105335){_0x4cae38['push'](_0x4cae38['shift']());}};_0x4fc0d6(++_0x1f7372);}(_0x5459,0x1cd));var _0x9545=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5459[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x9545('0x0'));module[_0x9545('0x1')]={'priority':{'type':Sequelize[_0x9545('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9545('0x3')},'appdata':{'type':Sequelize[_0x9545('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9545('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9c32=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x557bf4,_0x1f8dad){var _0x2916e2=function(_0x4fef9b){while(--_0x4fef9b){_0x557bf4['push'](_0x557bf4['shift']());}};_0x2916e2(++_0x1f8dad);}(_0x9c32,0x15d));var _0x29c3=function(_0x39c656,_0x4c9fe0){_0x39c656=_0x39c656-0x0;var _0x172b84=_0x9c32[_0x39c656];return _0x172b84;};'use strict';var Sequelize=require(_0x29c3('0x0'));module[_0x29c3('0x1')]={'priority':{'type':Sequelize[_0x29c3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29c3('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x29c3('0x4')],'defaultValue':_0x29c3('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 85cd874..f60574d 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 _0x2dd8=['findAll','rows','catch','show','keys','intersection','find','create','body','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','map','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2dd8,0x143));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require(_0x82dd('0x4'));var Mustache=require(_0x82dd('0x5'));var util=require(_0x82dd('0x6'));var path=require(_0x82dd('0x7'));var sox=require(_0x82dd('0x8'));var csv=require('to-csv');var ejs=require(_0x82dd('0x9'));var fs=require('fs');var fs_extra=require(_0x82dd('0xa'));var _=require(_0x82dd('0xb'));var squel=require(_0x82dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x82dd('0xd'));var deskjs=require(_0x82dd('0xe'));var toCsv=require(_0x82dd('0xf'));var querystring=require(_0x82dd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82dd('0x12'));var hardwareService=require(_0x82dd('0x13'));var logger=require(_0x82dd('0x14'))(_0x82dd('0x15'));var utils=require(_0x82dd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x82dd('0x17'));var db=require(_0x82dd('0x18'))['db'];function respondWithStatusCode(_0x348f79,_0x18b9f6){_0x18b9f6=_0x18b9f6||0xcc;return function(_0x24d045){if(_0x24d045){return _0x348f79['sendStatus'](_0x18b9f6);}return _0x348f79['status'](_0x18b9f6)[_0x82dd('0x19')]();};}function respondWithResult(_0x255abd,_0x6fcc1b){_0x6fcc1b=_0x6fcc1b||0xc8;return function(_0x46beb0){if(_0x46beb0){return _0x255abd[_0x82dd('0x1a')](_0x6fcc1b)[_0x82dd('0x1b')](_0x46beb0);}};}function respondWithFilteredResult(_0x31b9c1,_0x275802){return function(_0x101eb7){if(_0x101eb7){var _0x1b90e0=typeof _0x275802[_0x82dd('0x1c')]===_0x82dd('0x1d')&&typeof _0x275802[_0x82dd('0x1e')]==='undefined';var _0x352400=_0x101eb7[_0x82dd('0x1f')];var _0x34d991=_0x1b90e0?0x0:_0x275802[_0x82dd('0x1c')];var _0x445fa0=_0x1b90e0?_0x101eb7[_0x82dd('0x1f')]:_0x275802[_0x82dd('0x1c')]+_0x275802[_0x82dd('0x1e')];var _0x26373a;if(_0x445fa0>=_0x352400){_0x445fa0=_0x352400;_0x26373a=0xc8;}else{_0x26373a=0xce;}_0x31b9c1[_0x82dd('0x1a')](_0x26373a);return _0x31b9c1[_0x82dd('0x20')](_0x82dd('0x21'),_0x34d991+'-'+_0x445fa0+'/'+_0x352400)[_0x82dd('0x1b')](_0x101eb7);}return null;};}function patchUpdates(_0x5ebea8){return function(_0x45205d){try{jsonpatch[_0x82dd('0x22')](_0x45205d,_0x5ebea8,!![]);}catch(_0x28352e){return BPromise[_0x82dd('0x23')](_0x28352e);}return _0x45205d[_0x82dd('0x24')]();};}function saveUpdates(_0x251b5b,_0x15f5b8){return function(_0x45e92c){if(_0x45e92c){return _0x45e92c['update'](_0x251b5b)['then'](function(_0x1c095e){return _0x1c095e;});}return null;};}function removeEntity(_0x96dbc0,_0x4e1463){return function(_0x59a173){if(_0x59a173){return _0x59a173[_0x82dd('0x25')]()[_0x82dd('0x26')](function(){_0x96dbc0[_0x82dd('0x1a')](0xcc)[_0x82dd('0x19')]();});}};}function handleEntityNotFound(_0x4609c1,_0x1233e4){return function(_0x17eb32){if(!_0x17eb32){_0x4609c1[_0x82dd('0x27')](0x194);}return _0x17eb32;};}function handleError(_0x1ae382,_0x1d27f1){_0x1d27f1=_0x1d27f1||0x1f4;return function(_0xe6aacd){logger[_0x82dd('0x28')](_0xe6aacd[_0x82dd('0x29')]);if(_0xe6aacd[_0x82dd('0x2a')]){delete _0xe6aacd['name'];}_0x1ae382[_0x82dd('0x1a')](_0x1d27f1)[_0x82dd('0x2b')](_0xe6aacd);};}exports[_0x82dd('0x2c')]=function(_0x53965f,_0x15da13){var _0x5238a2={},_0x15f31f={},_0x93fd00={'count':0x0,'rows':[]};var _0x2b4a63=_['map'](db[_0x82dd('0x2d')][_0x82dd('0x2e')],function(_0x47c0ff){return{'name':_0x47c0ff['fieldName'],'type':_0x47c0ff[_0x82dd('0x2f')][_0x82dd('0x30')]};});_0x15f31f['model']=_[_0x82dd('0x31')](_0x2b4a63,_0x82dd('0x2a'));_0x15f31f[_0x82dd('0x32')]=_['keys'](_0x53965f[_0x82dd('0x32')]);_0x15f31f[_0x82dd('0x33')]=_['intersection'](_0x15f31f['model'],_0x15f31f[_0x82dd('0x32')]);_0x5238a2[_0x82dd('0x34')]=_['intersection'](_0x15f31f[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x36')]));_0x5238a2[_0x82dd('0x34')]=_0x5238a2['attributes'][_0x82dd('0x37')]?_0x5238a2[_0x82dd('0x34')]:_0x15f31f['model'];if(!_0x53965f[_0x82dd('0x32')][_0x82dd('0x38')](_0x82dd('0x39'))){_0x5238a2[_0x82dd('0x1e')]=qs['limit'](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1e')]);_0x5238a2[_0x82dd('0x1c')]=qs[_0x82dd('0x1c')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1c')]);}_0x5238a2[_0x82dd('0x3a')]=qs[_0x82dd('0x3b')](_0x53965f['query'][_0x82dd('0x3b')]);_0x5238a2['where']=qs[_0x82dd('0x33')](_[_0x82dd('0x3c')](_0x53965f[_0x82dd('0x32')],_0x15f31f['filters']),_0x2b4a63);if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x3d')]){_0x5238a2[_0x82dd('0x3e')]=_[_0x82dd('0x3f')](_0x5238a2['where'],{'$or':_['map'](_0x2b4a63,function(_0xc3d6d9){if(_0xc3d6d9[_0x82dd('0x2f')]!==_0x82dd('0x40')){var _0x19c736={};_0x19c736[_0xc3d6d9['name']]={'$like':'%'+_0x53965f['query'][_0x82dd('0x3d')]+'%'};return _0x19c736;}})});}_0x5238a2=_[_0x82dd('0x3f')]({},_0x5238a2,_0x53965f['options']);var _0x3a905d={'where':_0x5238a2[_0x82dd('0x3e')]};return db[_0x82dd('0x2d')][_0x82dd('0x1f')](_0x3a905d)[_0x82dd('0x26')](function(_0x104568){_0x93fd00[_0x82dd('0x1f')]=_0x104568;if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x41')]){_0x5238a2[_0x82dd('0x42')]=[{'all':!![]}];}return db[_0x82dd('0x2d')][_0x82dd('0x43')](_0x5238a2);})[_0x82dd('0x26')](function(_0x27cfd6){_0x93fd00[_0x82dd('0x44')]=_0x27cfd6;return _0x93fd00;})[_0x82dd('0x26')](respondWithFilteredResult(_0x15da13,_0x5238a2))[_0x82dd('0x45')](handleError(_0x15da13,null));};exports[_0x82dd('0x46')]=function(_0x41d36,_0x5bcc32){var _0x644d3a={'raw':!![],'where':{'id':_0x41d36['params']['id']}},_0x4cd127={};_0x4cd127[_0x82dd('0x35')]=_[_0x82dd('0x47')](db[_0x82dd('0x2d')]['rawAttributes']);_0x4cd127[_0x82dd('0x32')]=_[_0x82dd('0x47')](_0x41d36[_0x82dd('0x32')]);_0x4cd127[_0x82dd('0x33')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],_0x4cd127['query']);_0x644d3a[_0x82dd('0x34')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x41d36[_0x82dd('0x32')]['fields']));_0x644d3a[_0x82dd('0x34')]=_0x644d3a[_0x82dd('0x34')]['length']?_0x644d3a[_0x82dd('0x34')]:_0x4cd127[_0x82dd('0x35')];if(_0x41d36[_0x82dd('0x32')][_0x82dd('0x41')]){_0x644d3a[_0x82dd('0x42')]=[{'all':!![]}];}_0x644d3a=_[_0x82dd('0x3f')]({},_0x644d3a,_0x41d36['options']);return db[_0x82dd('0x2d')][_0x82dd('0x49')](_0x644d3a)[_0x82dd('0x26')](handleEntityNotFound(_0x5bcc32,null))[_0x82dd('0x26')](respondWithResult(_0x5bcc32,null))['catch'](handleError(_0x5bcc32,null));};exports[_0x82dd('0x4a')]=function(_0x418fd3,_0x3035b8){return db['WhatsappApplication']['create'](_0x418fd3[_0x82dd('0x4b')],{})[_0x82dd('0x26')](respondWithResult(_0x3035b8,0xc9))[_0x82dd('0x45')](handleError(_0x3035b8,null));};exports[_0x82dd('0x4c')]=function(_0x208e4f,_0x4ff539){if(_0x208e4f['body']['id']){delete _0x208e4f[_0x82dd('0x4b')]['id'];}return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x208e4f['params']['id']}})['then'](handleEntityNotFound(_0x4ff539,null))[_0x82dd('0x26')](saveUpdates(_0x208e4f['body'],null))[_0x82dd('0x26')](respondWithResult(_0x4ff539,null))[_0x82dd('0x45')](handleError(_0x4ff539,null));};exports[_0x82dd('0x25')]=function(_0x96e9f1,_0x24fa02){return db[_0x82dd('0x2d')][_0x82dd('0x49')]({'where':{'id':_0x96e9f1[_0x82dd('0x4d')]['id']}})[_0x82dd('0x26')](handleEntityNotFound(_0x24fa02,null))['then'](removeEntity(_0x24fa02,null))[_0x82dd('0x45')](handleError(_0x24fa02,null));}; \ No newline at end of file +var _0x9bd9=['apply','reject','then','error','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x428fd4,_0x317e28){var _0x421968=function(_0x35e800){while(--_0x35e800){_0x428fd4['push'](_0x428fd4['shift']());}};_0x421968(++_0x317e28);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x2900bf,_0x396900){_0x2900bf=_0x2900bf-0x0;var _0x4ff896=_0x9bd9[_0x2900bf];return _0x4ff896;};'use strict';var emlformat=require(_0x99bd('0x0'));var rimraf=require(_0x99bd('0x1'));var zipdir=require(_0x99bd('0x2'));var jsonpatch=require(_0x99bd('0x3'));var rp=require(_0x99bd('0x4'));var moment=require(_0x99bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x99bd('0x6'));var util=require('util');var path=require(_0x99bd('0x7'));var sox=require(_0x99bd('0x8'));var csv=require('to-csv');var ejs=require(_0x99bd('0x9'));var fs=require('fs');var fs_extra=require(_0x99bd('0xa'));var _=require(_0x99bd('0xb'));var squel=require(_0x99bd('0xc'));var crypto=require(_0x99bd('0xd'));var jsforce=require(_0x99bd('0xe'));var deskjs=require(_0x99bd('0xf'));var toCsv=require(_0x99bd('0x10'));var querystring=require(_0x99bd('0x11'));var Papa=require(_0x99bd('0x12'));var Redis=require(_0x99bd('0x13'));var authService=require(_0x99bd('0x14'));var qs=require(_0x99bd('0x15'));var as=require(_0x99bd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bd('0x17'))('api');var utils=require(_0x99bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x99bd('0x19'));var db=require(_0x99bd('0x1a'))['db'];function respondWithStatusCode(_0x4a8bd9,_0x22237c){_0x22237c=_0x22237c||0xcc;return function(_0x500cd2){if(_0x500cd2){return _0x4a8bd9[_0x99bd('0x1b')](_0x22237c);}return _0x4a8bd9['status'](_0x22237c)[_0x99bd('0x1c')]();};}function respondWithResult(_0x401299,_0x141159){_0x141159=_0x141159||0xc8;return function(_0x4a9770){if(_0x4a9770){return _0x401299[_0x99bd('0x1d')](_0x141159)[_0x99bd('0x1e')](_0x4a9770);}};}function respondWithFilteredResult(_0x2d918a,_0x42b619){return function(_0x65a2e5){if(_0x65a2e5){var _0x491d9=typeof _0x42b619[_0x99bd('0x1f')]===_0x99bd('0x20')&&typeof _0x42b619[_0x99bd('0x21')]==='undefined';var _0x378079=_0x65a2e5[_0x99bd('0x22')];var _0x2fe078=_0x491d9?0x0:_0x42b619['offset'];var _0x4b98fc=_0x491d9?_0x65a2e5[_0x99bd('0x22')]:_0x42b619[_0x99bd('0x1f')]+_0x42b619[_0x99bd('0x21')];var _0xfa6227;if(_0x4b98fc>=_0x378079){_0x4b98fc=_0x378079;_0xfa6227=0xc8;}else{_0xfa6227=0xce;}_0x2d918a[_0x99bd('0x1d')](_0xfa6227);return _0x2d918a['set'](_0x99bd('0x23'),_0x2fe078+'-'+_0x4b98fc+'/'+_0x378079)['json'](_0x65a2e5);}return null;};}function patchUpdates(_0x10f2fb){return function(_0x3085df){try{jsonpatch[_0x99bd('0x24')](_0x3085df,_0x10f2fb,!![]);}catch(_0x1d937b){return BPromise[_0x99bd('0x25')](_0x1d937b);}return _0x3085df['save']();};}function saveUpdates(_0x27c551,_0x229322){return function(_0x3e339c){if(_0x3e339c){return _0x3e339c['update'](_0x27c551)[_0x99bd('0x26')](function(_0x5e6081){return _0x5e6081;});}return null;};}function removeEntity(_0x4d3ebb,_0x1c5b82){return function(_0xfdc455){if(_0xfdc455){return _0xfdc455['destroy']()[_0x99bd('0x26')](function(){_0x4d3ebb[_0x99bd('0x1d')](0xcc)[_0x99bd('0x1c')]();});}};}function handleEntityNotFound(_0x3f7bf4,_0x51ff34){return function(_0x12daac){if(!_0x12daac){_0x3f7bf4['sendStatus'](0x194);}return _0x12daac;};}function handleError(_0x550b7f,_0x10d5cd){_0x10d5cd=_0x10d5cd||0x1f4;return function(_0x5ebeeb){logger[_0x99bd('0x27')](_0x5ebeeb['stack']);if(_0x5ebeeb[_0x99bd('0x28')]){delete _0x5ebeeb[_0x99bd('0x28')];}_0x550b7f['status'](_0x10d5cd)['send'](_0x5ebeeb);};}exports[_0x99bd('0x29')]=function(_0x1af1e6,_0x1eabb9){var _0x5903aa={},_0x957d48={},_0x1d0642={'count':0x0,'rows':[]};var _0x2250d8=_['map'](db[_0x99bd('0x2a')][_0x99bd('0x2b')],function(_0x4c5493){return{'name':_0x4c5493[_0x99bd('0x2c')],'type':_0x4c5493[_0x99bd('0x2d')][_0x99bd('0x2e')]};});_0x957d48[_0x99bd('0x2f')]=_['map'](_0x2250d8,_0x99bd('0x28'));_0x957d48[_0x99bd('0x30')]=_['keys'](_0x1af1e6[_0x99bd('0x30')]);_0x957d48['filters']=_['intersection'](_0x957d48['model'],_0x957d48[_0x99bd('0x30')]);_0x5903aa[_0x99bd('0x31')]=_[_0x99bd('0x32')](_0x957d48[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x33')]));_0x5903aa[_0x99bd('0x31')]=_0x5903aa[_0x99bd('0x31')][_0x99bd('0x34')]?_0x5903aa['attributes']:_0x957d48[_0x99bd('0x2f')];if(!_0x1af1e6['query'][_0x99bd('0x35')]('nolimit')){_0x5903aa['limit']=qs['limit'](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x21')]);_0x5903aa[_0x99bd('0x1f')]=qs[_0x99bd('0x1f')](_0x1af1e6['query'][_0x99bd('0x1f')]);}_0x5903aa[_0x99bd('0x36')]=qs[_0x99bd('0x37')](_0x1af1e6[_0x99bd('0x30')]['sort']);_0x5903aa[_0x99bd('0x38')]=qs[_0x99bd('0x39')](_[_0x99bd('0x3a')](_0x1af1e6[_0x99bd('0x30')],_0x957d48['filters']),_0x2250d8);if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]){_0x5903aa[_0x99bd('0x38')]=_[_0x99bd('0x3c')](_0x5903aa['where'],{'$or':_[_0x99bd('0x3d')](_0x2250d8,function(_0x3d2b0f){if(_0x3d2b0f[_0x99bd('0x2d')]!==_0x99bd('0x3e')){var _0x7e29ec={};_0x7e29ec[_0x3d2b0f[_0x99bd('0x28')]]={'$like':'%'+_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]+'%'};return _0x7e29ec;}})});}_0x5903aa=_[_0x99bd('0x3c')]({},_0x5903aa,_0x1af1e6[_0x99bd('0x3f')]);var _0x2fcf71={'where':_0x5903aa[_0x99bd('0x38')]};return db[_0x99bd('0x2a')]['count'](_0x2fcf71)[_0x99bd('0x26')](function(_0x1ecdd6){_0x1d0642[_0x99bd('0x22')]=_0x1ecdd6;if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x40')]){_0x5903aa[_0x99bd('0x41')]=[{'all':!![]}];}return db[_0x99bd('0x2a')][_0x99bd('0x42')](_0x5903aa);})[_0x99bd('0x26')](function(_0x7e84b1){_0x1d0642[_0x99bd('0x43')]=_0x7e84b1;return _0x1d0642;})[_0x99bd('0x26')](respondWithFilteredResult(_0x1eabb9,_0x5903aa))[_0x99bd('0x44')](handleError(_0x1eabb9,null));};exports[_0x99bd('0x45')]=function(_0xb0ffe5,_0x2d91be){var _0x369fb5={'raw':!![],'where':{'id':_0xb0ffe5[_0x99bd('0x46')]['id']}},_0x5a4a96={};_0x5a4a96[_0x99bd('0x2f')]=_[_0x99bd('0x47')](db[_0x99bd('0x2a')][_0x99bd('0x2b')]);_0x5a4a96[_0x99bd('0x30')]=_[_0x99bd('0x47')](_0xb0ffe5[_0x99bd('0x30')]);_0x5a4a96['filters']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],_0x5a4a96[_0x99bd('0x30')]);_0x369fb5['attributes']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0xb0ffe5['query'][_0x99bd('0x33')]));_0x369fb5['attributes']=_0x369fb5['attributes']['length']?_0x369fb5[_0x99bd('0x31')]:_0x5a4a96[_0x99bd('0x2f')];if(_0xb0ffe5[_0x99bd('0x30')]['includeAll']){_0x369fb5[_0x99bd('0x41')]=[{'all':!![]}];}_0x369fb5=_[_0x99bd('0x3c')]({},_0x369fb5,_0xb0ffe5[_0x99bd('0x3f')]);return db['WhatsappApplication'][_0x99bd('0x48')](_0x369fb5)[_0x99bd('0x26')](handleEntityNotFound(_0x2d91be,null))['then'](respondWithResult(_0x2d91be,null))['catch'](handleError(_0x2d91be,null));};exports[_0x99bd('0x49')]=function(_0x1d7ec0,_0x3487c6){return db['WhatsappApplication']['create'](_0x1d7ec0[_0x99bd('0x4a')],{})[_0x99bd('0x26')](respondWithResult(_0x3487c6,0xc9))[_0x99bd('0x44')](handleError(_0x3487c6,null));};exports['update']=function(_0x3fa8e1,_0x4e71b3){if(_0x3fa8e1[_0x99bd('0x4a')]['id']){delete _0x3fa8e1[_0x99bd('0x4a')]['id'];}return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x3fa8e1[_0x99bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e71b3,null))[_0x99bd('0x26')](saveUpdates(_0x3fa8e1['body'],null))[_0x99bd('0x26')](respondWithResult(_0x4e71b3,null))[_0x99bd('0x44')](handleError(_0x4e71b3,null));};exports[_0x99bd('0x4b')]=function(_0x1912ac,_0x2100c7){return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x1912ac['params']['id']}})['then'](handleEntityNotFound(_0x2100c7,null))[_0x99bd('0x26')](removeEntity(_0x2100c7,null))[_0x99bd('0x44')](handleError(_0x2100c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 54cfc76..2c19793 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 _0x7d9f=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','whatsapp_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x47173d,_0x1cee9d){var _0x4d3e2a=function(_0x22bba8){while(--_0x22bba8){_0x47173d['push'](_0x47173d['shift']());}};_0x4d3e2a(++_0x1cee9d);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4544c8,_0x5de2d7){_0x4544c8=_0x4544c8-0x0;var _0x5afe0e=_0x7d9f[_0x4544c8];return _0x5afe0e;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('WhatsappApplication',attributes,{'tableName':_0xf7d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7d9('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4f17=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f17,0x9e));var _0x74f1=function(_0x10afad,_0x30da9d){_0x10afad=_0x10afad-0x0;var _0x588d7e=_0x4f17[_0x10afad];return _0x588d7e;};'use strict';var _=require(_0x74f1('0x0'));var util=require('util');var logger=require(_0x74f1('0x1'))(_0x74f1('0x2'));var moment=require('moment');var BPromise=require(_0x74f1('0x3'));var rp=require(_0x74f1('0x4'));var fs=require('fs');var path=require(_0x74f1('0x5'));var rimraf=require(_0x74f1('0x6'));var config=require(_0x74f1('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3f65bb,_0x4b894a){return _0x3f65bb[_0x74f1('0x8')]('WhatsappApplication',attributes,{'tableName':_0x74f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x74f1('0xa'),'collate':_0x74f1('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 54d474a..c79cd30 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 _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x591292,_0x42bc77){var _0x324652=function(_0x2d610f){while(--_0x2d610f){_0x591292['push'](_0x591292['shift']());}};_0x324652(++_0x42bc77);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1ac1c4,_0x36010b){_0x1ac1c4=_0x1ac1c4-0x0;var _0x4ca336=_0xa8a8[_0x1ac1c4];return _0x4ca336;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x426867,_0x11a1a4){var _0x39ab67=function(_0x129e51){while(--_0x129e51){_0x426867['push'](_0x426867['shift']());}};_0x39ab67(++_0x11a1a4);}(_0x5fd1,0x155));var _0x15fd=function(_0x3489de,_0xee3ed7){_0x3489de=_0x3489de-0x0;var _0x472402=_0x5fd1[_0x3489de];return _0x472402;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 0722085..227e94d 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 _0x5162=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x41074d,_0x19b20f){var _0x1f61b9=function(_0x34458c){while(--_0x34458c){_0x41074d['push'](_0x41074d['shift']());}};_0x1f61b9(++_0x19b20f);}(_0x5162,0x103));var _0x2516=function(_0xb89931,_0x461b9e){_0xb89931=_0xb89931-0x0;var _0x324b86=_0x5162[_0xb89931];return _0x324b86;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['get'](_0x2516('0xd'),auth[_0x2516('0x9')](),controller[_0x2516('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2516('0xf')]('/',auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0xf')]('/:id/messages',auth[_0x2516('0x9')](),controller[_0x2516('0x11')]);router[_0x2516('0xf')](_0x2516('0x12'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x15')),controller[_0x2516('0x16')]);router[_0x2516('0x17')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x18')),controller['update']);router[_0x2516('0x19')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction['tracked'](_0x2516('0x14'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2516('0x19')](_0x2516('0x12'),auth[_0x2516('0x9')](),controller[_0x2516('0x1a')]);module[_0x2516('0x1b')]=router; \ No newline at end of file +var _0x90b5=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3ec4cf,_0x84d124){var _0xad0b1=function(_0x255580){while(--_0x255580){_0x3ec4cf['push'](_0x3ec4cf['shift']());}};_0xad0b1(++_0x84d124);}(_0x90b5,0x139));var _0x590b=function(_0x448f50,_0x5587ba){_0x448f50=_0x448f50-0x0;var _0x2af4c3=_0x90b5[_0x448f50];return _0x2af4c3;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0x7')](_0x590b('0xe'),auth['isAuthenticated'](),controller[_0x590b('0xf')]);router[_0x590b('0x7')]('/:id/download',auth[_0x590b('0x8')](),controller['download']);router[_0x590b('0x10')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);router[_0x590b('0x10')]('/:id/messages',auth[_0x590b('0x8')](),controller[_0x590b('0x12')]);router[_0x590b('0x10')](_0x590b('0x13'),auth[_0x590b('0x8')](),interaction[_0x590b('0x14')](_0x590b('0x15'),_0x590b('0x16')),controller[_0x590b('0x17')]);router[_0x590b('0x18')](_0x590b('0xc'),auth[_0x590b('0x8')](),interaction[_0x590b('0x14')](_0x590b('0x15'),_0x590b('0x19')),controller['update']);router[_0x590b('0x1a')]('/:id',auth[_0x590b('0x8')](),interaction[_0x590b('0x14')](_0x590b('0x15'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x590b('0x1a')]('/:id/tags',auth[_0x590b('0x8')](),controller[_0x590b('0x1b')]);module[_0x590b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f5f7f66..ba8e875 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 _0xa23f=['DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x3f78e5,_0x5eaa2b){var _0x4d5732=function(_0x2022ba){while(--_0x2022ba){_0x3f78e5['push'](_0x3f78e5['shift']());}};_0x4d5732(++_0x5eaa2b);}(_0xa23f,0x7c));var _0xfa23=function(_0x593cd3,_0x187cb7){_0x593cd3=_0x593cd3-0x0;var _0x3142f9=_0xa23f[_0x593cd3];return _0x3142f9;};'use strict';var Sequelize=require(_0xfa23('0x0'));var moment=require(_0xfa23('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfa23('0x2')]},'disposition':{'type':Sequelize[_0xfa23('0x3')]},'secondDisposition':{'type':Sequelize[_0xfa23('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfa23('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfa23('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfa23('0x4')]('in',_0xfa23('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfa23('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfa23('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfa23('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x2123=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4759cc,_0x50ebaf){var _0x2afaab=function(_0x47e32d){while(--_0x47e32d){_0x4759cc['push'](_0x4759cc['shift']());}};_0x2afaab(++_0x50ebaf);}(_0x2123,0x190));var _0x3212=function(_0x38f668,_0x1a349a){_0x38f668=_0x38f668-0x0;var _0x3186d5=_0x2123[_0x38f668];return _0x3186d5;};'use strict';var Sequelize=require(_0x3212('0x0'));var moment=require(_0x3212('0x1'));module[_0x3212('0x2')]={'closed':{'type':Sequelize[_0x3212('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3212('0x4')]},'disposition':{'type':Sequelize[_0x3212('0x5')]},'secondDisposition':{'type':Sequelize[_0x3212('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3212('0x5')]},'note':{'type':Sequelize[_0x3212('0x5')]},'phone':{'type':Sequelize[_0x3212('0x5')]},'read1stAt':{'type':Sequelize[_0x3212('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3212('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3212('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3212('0x6')]('in',_0x3212('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index cb09814..675ae4c 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 _0x45ca=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','catch','keys','query','filters','attributes','intersection','model','fields','includeAll','include','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','format','transcript-%d-%s.zip','User','fullname','push','Contact','lastName','attachments','Attachment','Messages','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','createdAt','toString','firstName','out','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/export/pdf','api'];(function(_0x517bc5,_0x2893eb){var _0x220437=function(_0x222051){while(--_0x222051){_0x517bc5['push'](_0x517bc5['shift']());}};_0x220437(++_0x2893eb);}(_0x45ca,0xfa));var _0xa45c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x45ca[_0x502c7d];return _0x30b7ed;};'use strict';var rimraf=require(_0xa45c('0x0'));var zipdir=require(_0xa45c('0x1'));var moment=require(_0xa45c('0x2'));var BPromise=require(_0xa45c('0x3'));var util=require(_0xa45c('0x4'));var path=require(_0xa45c('0x5'));var ejs=require(_0xa45c('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa45c('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xa45c('0x8'));var logger=require('../../config/logger')(_0xa45c('0x9'));var config=require(_0xa45c('0xa'));var db=require(_0xa45c('0xb'))['db'];config[_0xa45c('0xc')]=_[_0xa45c('0xd')](config[_0xa45c('0xc')],{'host':_0xa45c('0xe'),'port':0x18eb});var socket=require(_0xa45c('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xa45c('0x10')](socket);function respondWithStatusCode(_0x4b8943,_0x1e0837){_0x1e0837=_0x1e0837||0xcc;return function(_0x162e42){if(_0x162e42){return _0x4b8943[_0xa45c('0x11')](_0x1e0837);}return _0x4b8943[_0xa45c('0x12')](_0x1e0837)[_0xa45c('0x13')]();};}function respondWithResult(_0x1a5fed,_0x1101b6){_0x1101b6=_0x1101b6||0xc8;return function(_0x461091){if(_0x461091){return _0x1a5fed['status'](_0x1101b6)[_0xa45c('0x14')](_0x461091);}};}function respondWithFilteredResult(_0x43bc3a,_0x5cd71a){return function(_0x54f5f1){if(_0x54f5f1){var _0x8fd052=typeof _0x5cd71a[_0xa45c('0x15')]===_0xa45c('0x16')&&typeof _0x5cd71a[_0xa45c('0x17')]==='undefined';var _0x5309fe=_0x54f5f1[_0xa45c('0x18')];var _0x520b59=_0x8fd052?0x0:_0x5cd71a[_0xa45c('0x15')];var _0x4b146a=_0x8fd052?_0x54f5f1[_0xa45c('0x18')]:_0x5cd71a[_0xa45c('0x15')]+_0x5cd71a['limit'];var _0x1e8ea7;if(_0x4b146a>=_0x5309fe){_0x4b146a=_0x5309fe;_0x1e8ea7=0xc8;}else{_0x1e8ea7=0xce;}_0x43bc3a['status'](_0x1e8ea7);return _0x43bc3a['set'](_0xa45c('0x19'),_0x520b59+'-'+_0x4b146a+'/'+_0x5309fe)[_0xa45c('0x14')](_0x54f5f1);}return null;};}function saveUpdates(_0x30f613){return function(_0x4a1067){if(_0x4a1067){return _0x4a1067[_0xa45c('0x1a')](_0x30f613)[_0xa45c('0x1b')](function(_0x2cc886){return _0x2cc886;});}return null;};}function removeEntity(_0x2a0d87){return function(_0x5ac663){if(_0x5ac663){return _0x5ac663[_0xa45c('0x1c')]()['then'](function(){_0x2a0d87[_0xa45c('0x12')](0xcc)[_0xa45c('0x13')]();});}};}function handleEntityNotFound(_0x57cb4c){return function(_0x3c8ef4){if(!_0x3c8ef4){_0x57cb4c[_0xa45c('0x11')](0x194);}return _0x3c8ef4;};}function handleError(_0x1eb9dc,_0x2ad87a){_0x2ad87a=_0x2ad87a||0x1f4;return function(_0x47a6ca){logger[_0xa45c('0x1d')](_0x47a6ca['stack']);if(_0x47a6ca[_0xa45c('0x1e')]){delete _0x47a6ca['name'];}_0x1eb9dc[_0xa45c('0x12')](_0x2ad87a)[_0xa45c('0x1f')](_0x47a6ca);};}exports[_0xa45c('0x20')]=function(_0x160d64,_0xbd85ff){var _0x18987a={};var _0x23d907=_[_0xa45c('0x21')](db[_0xa45c('0x22')][_0xa45c('0x23')],function(_0x427294){return{'name':_0x427294['fieldName'],'type':_0x427294[_0xa45c('0x24')][_0xa45c('0x25')]};});_0x18987a=qs[_0xa45c('0x26')](_0x23d907,_0x160d64);return interaction[_0xa45c('0x27')](_0xa45c('0x28'),_0x160d64['query'],_0x160d64['user'],_0x18987a,_0x23d907)[_0xa45c('0x1b')](respondWithFilteredResult(_0xbd85ff,_0x18987a))[_0xa45c('0x29')](handleError(_0xbd85ff,null));};exports['show']=function(_0x312b10,_0x5e3cce){var _0x4d0f29={'raw':![],'where':{'id':_0x312b10['params']['id']}},_0x22be0d={};_0x22be0d['model']=_[_0xa45c('0x2a')](db[_0xa45c('0x22')][_0xa45c('0x23')]);_0x22be0d[_0xa45c('0x2b')]=_['keys'](_0x312b10['query']);_0x22be0d[_0xa45c('0x2c')]=_['intersection'](_0x22be0d['model'],_0x22be0d['query']);_0x4d0f29[_0xa45c('0x2d')]=_[_0xa45c('0x2e')](_0x22be0d[_0xa45c('0x2f')],qs['fields'](_0x312b10[_0xa45c('0x2b')][_0xa45c('0x30')]));_0x4d0f29[_0xa45c('0x2d')]=_0x4d0f29[_0xa45c('0x2d')]['length']?_0x4d0f29[_0xa45c('0x2d')]:_0x22be0d['model'];if(_0x312b10[_0xa45c('0x2b')][_0xa45c('0x31')]){_0x4d0f29[_0xa45c('0x32')]=[{'all':!![]}];}_0x4d0f29=_[_0xa45c('0x33')]({},_0x4d0f29,_0x312b10[_0xa45c('0x34')]);return db[_0xa45c('0x22')][_0xa45c('0x35')](_0x4d0f29)[_0xa45c('0x1b')](handleEntityNotFound(_0x5e3cce,null))[_0xa45c('0x1b')](respondWithResult(_0x5e3cce,null))[_0xa45c('0x29')](handleError(_0x5e3cce,null));};exports['create']=function(_0x1bf452,_0x1989ac){return db[_0xa45c('0x22')][_0xa45c('0x36')](_0x1bf452[_0xa45c('0x37')],{})[_0xa45c('0x1b')](respondWithResult(_0x1989ac,0xc9))[_0xa45c('0x29')](handleError(_0x1989ac,null));};exports['update']=function(_0x23ff76,_0x494989){if(_0x23ff76[_0xa45c('0x37')]['id']){delete _0x23ff76[_0xa45c('0x37')]['id'];}return db[_0xa45c('0x22')][_0xa45c('0x35')]({'where':{'id':_0x23ff76[_0xa45c('0x38')]['id']}})[_0xa45c('0x1b')](handleEntityNotFound(_0x494989,null))[_0xa45c('0x1b')](saveUpdates(_0x23ff76[_0xa45c('0x37')],null))[_0xa45c('0x1b')](respondWithResult(_0x494989,null))[_0xa45c('0x29')](handleError(_0x494989,null));};exports[_0xa45c('0x1c')]=function(_0x433dd4,_0x5e4f3f){return db[_0xa45c('0x22')][_0xa45c('0x35')]({'where':{'id':_0x433dd4['params']['id']}})['then'](handleEntityNotFound(_0x5e4f3f,null))[_0xa45c('0x1b')](removeEntity(_0x5e4f3f,null))[_0xa45c('0x29')](handleError(_0x5e4f3f,null));};exports[_0xa45c('0x39')]=function(_0x3beed7,_0x2bf2f5){return db['WhatsappInteraction'][_0xa45c('0x39')]()[_0xa45c('0x1b')](respondWithResult(_0x2bf2f5,null))[_0xa45c('0x29')](handleError(_0x2bf2f5,null));};exports[_0xa45c('0x3a')]=function(_0x59aba1,_0x2ffbc9){return db[_0xa45c('0x3b')][_0xa45c('0x35')]({'where':{'id':_0x59aba1[_0xa45c('0x38')]['id']}})['then'](handleEntityNotFound(_0x2ffbc9,null))['then'](function(_0x2726a2){if(_0x2726a2){return _0x2726a2['addMessage'](_0x59aba1[_0xa45c('0x37')][_0xa45c('0x3c')],_[_0xa45c('0x3d')](_0x59aba1[_0xa45c('0x37')],['ids','id'])||{});}})[_0xa45c('0x1b')](respondWithResult(_0x2ffbc9,null))[_0xa45c('0x29')](handleError(_0x2ffbc9,null));};exports[_0xa45c('0x3e')]=function(_0x431b16,_0x525575){var _0x4b4168={'raw':![],'where':{}};var _0x3cf0c0={};var _0x3d651b={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xa45c('0x3f')]({'where':{'id':_0x431b16[_0xa45c('0x38')]['id']}})[_0xa45c('0x1b')](handleEntityNotFound(_0x525575,null))[_0xa45c('0x1b')](function(_0x48929c){if(_0x48929c){_0x3cf0c0['model']=_[_0xa45c('0x2a')](db[_0xa45c('0x3b')][_0xa45c('0x23')]);_0x3cf0c0[_0xa45c('0x2b')]=_[_0xa45c('0x2a')](_0x431b16[_0xa45c('0x2b')]);_0x3cf0c0[_0xa45c('0x2c')]=_[_0xa45c('0x2e')](_0x3cf0c0[_0xa45c('0x2f')],_0x3cf0c0[_0xa45c('0x2b')]);_0x4b4168[_0xa45c('0x2d')]=_['intersection'](_0x3cf0c0[_0xa45c('0x2f')],qs[_0xa45c('0x30')](_0x431b16[_0xa45c('0x2b')][_0xa45c('0x30')]));_0x4b4168[_0xa45c('0x2d')]=_0x4b4168[_0xa45c('0x2d')][_0xa45c('0x40')]?_0x4b4168[_0xa45c('0x2d')]:_0x3cf0c0[_0xa45c('0x2f')];if(!_0x431b16[_0xa45c('0x2b')][_0xa45c('0x41')]('nolimit')){_0x4b4168['limit']=qs[_0xa45c('0x17')](_0x431b16[_0xa45c('0x2b')][_0xa45c('0x17')]);_0x4b4168[_0xa45c('0x15')]=qs[_0xa45c('0x15')](_0x431b16[_0xa45c('0x2b')][_0xa45c('0x15')]);}_0x4b4168[_0xa45c('0x42')]=qs[_0xa45c('0x43')](_0x431b16[_0xa45c('0x2b')][_0xa45c('0x43')]);_0x4b4168[_0xa45c('0x44')]=qs[_0xa45c('0x2c')](_[_0xa45c('0x45')](_0x431b16[_0xa45c('0x2b')],_0x3cf0c0['filters']));_0x4b4168[_0xa45c('0x44')][_0xa45c('0x46')]=_0x48929c['id'];if(_0x431b16[_0xa45c('0x2b')][_0xa45c('0x47')]){_0x4b4168[_0xa45c('0x44')]=_[_0xa45c('0x33')](_0x4b4168[_0xa45c('0x44')],{'$or':_['map'](_0x4b4168[_0xa45c('0x2d')],function(_0x120084){var _0xb91c7e={};_0xb91c7e[_0x120084]={'$like':'%'+_0x431b16[_0xa45c('0x2b')][_0xa45c('0x47')]+'%'};return _0xb91c7e;})});}if(_0x431b16[_0xa45c('0x2b')][_0xa45c('0x48')]){var _0x1590b1=_0x431b16['query']['$gte'][_0xa45c('0x49')](',');var _0x1575dd={};_0x1575dd[_0x1590b1[0x0]]={'$gte':moment(_0x1590b1[0x1])['format'](_0xa45c('0x4a'))};_0x4b4168[_0xa45c('0x44')]=_[_0xa45c('0x33')](_0x4b4168[_0xa45c('0x44')],_0x1575dd);}_0x4b4168=_[_0xa45c('0x33')]({},_0x4b4168,_0x431b16[_0xa45c('0x34')]);return db[_0xa45c('0x3b')][_0xa45c('0x18')]({'where':_0x4b4168[_0xa45c('0x44')]})[_0xa45c('0x1b')](function(_0xdaaf83){_0x3d651b[_0xa45c('0x18')]=_0xdaaf83;if(_0x431b16['query'][_0xa45c('0x31')]){_0x4b4168['include']=[{'all':!![]}];}return db[_0xa45c('0x3b')][_0xa45c('0x27')](_0x4b4168);})[_0xa45c('0x1b')](function(_0x1bb0fc){_0x3d651b[_0xa45c('0x4b')]=_0x1bb0fc;return _0x3d651b;});}})['then'](respondWithFilteredResult(_0x525575,_0x4b4168))[_0xa45c('0x29')](handleError(_0x525575,null));};exports[_0xa45c('0x4c')]=function(_0x64b399,_0x44b672){return db[_0xa45c('0x22')]['find']({'where':{'id':_0x64b399[_0xa45c('0x38')]['id']}})[_0xa45c('0x1b')](handleEntityNotFound(_0x44b672,null))[_0xa45c('0x1b')](function(_0x23b7bc){if(_0x23b7bc){return _0x23b7bc[_0xa45c('0x4d')](_0x64b399[_0xa45c('0x37')][_0xa45c('0x3c')],_['omit'](_0x64b399[_0xa45c('0x37')],[_0xa45c('0x3c'),'id'])||{})[_0xa45c('0x4e')](function(){return db[_0xa45c('0x4f')]['findAll']({'attributes':['id',_0xa45c('0x1e'),_0xa45c('0x50')],'where':{'id':_0x64b399[_0xa45c('0x37')][_0xa45c('0x3c')]}});})[_0xa45c('0x1b')](function(_0xb830a9){socket[_0xa45c('0x51')](_0xa45c('0x52'),{'id':Number(_0x64b399[_0xa45c('0x38')]['id']),'tags':_0xb830a9||[]});return{'id':Number(_0x64b399['params']['id']),'tags':_0xb830a9||[]};});}})[_0xa45c('0x1b')](respondWithResult(_0x44b672,null))[_0xa45c('0x29')](handleError(_0x44b672,null));};exports[_0xa45c('0x53')]=function(_0x2ae708,_0x52abcc){return db['WhatsappInteraction'][_0xa45c('0x35')]({'where':{'id':_0x2ae708['params']['id']}})['then'](handleEntityNotFound(_0x52abcc,null))[_0xa45c('0x1b')](function(_0x3560c4){if(_0x3560c4){return _0x3560c4[_0xa45c('0x53')](_0x2ae708[_0xa45c('0x2b')][_0xa45c('0x3c')]);}})[_0xa45c('0x1b')](respondWithStatusCode(_0x52abcc,null))[_0xa45c('0x29')](handleError(_0x52abcc,null));};exports[_0xa45c('0x54')]=function(_0x212318,_0x2d8be3){var _0x4e2391=moment()[_0xa45c('0x55')]()['toString']();var _0x4366ea=path['join'](config[_0xa45c('0x56')],_0xa45c('0x57'),_0xa45c('0x58'),_0xa45c('0x59'));var _0x2d4ddc=path[_0xa45c('0x5a')](config[_0xa45c('0x56')],_0xa45c('0x57'),_0xa45c('0x58'),'attachments');var _0x5412aa=path[_0xa45c('0x5a')](_0x4366ea,_0x4e2391);var _0x1aa3af=util[_0xa45c('0x5b')](_0xa45c('0x5c'),_0x212318[_0xa45c('0x38')]['id'],_0x4e2391);var _0x59de7b=path[_0xa45c('0x5a')](_0x4366ea,_0x1aa3af);var _0xad837d=[];_0xad837d['push']({'model':db[_0xa45c('0x5d')],'as':_0xa45c('0x5d'),'attributes':['id',_0xa45c('0x5e')],'raw':!![]});_0xad837d[_0xa45c('0x5f')]({'model':db['CmContact'],'as':_0xa45c('0x60'),'attributes':['id','firstName',_0xa45c('0x61')],'raw':!![]});if(_0x212318[_0xa45c('0x2b')][_0xa45c('0x62')]){_0xad837d[_0xa45c('0x5f')]({'model':db[_0xa45c('0x63')],'as':_0xa45c('0x63'),'raw':!![]});}var _0x2fff47=[{'model':db[_0xa45c('0x3b')],'as':_0xa45c('0x64'),'attributes':['id','body','createdAt',_0xa45c('0x65'),'secret','read'],'include':_0xad837d}];_0x2fff47['push']({'model':db[_0xa45c('0x66')],'as':'Account','attributes':['id',_0xa45c('0x1e')]});_0x2fff47['push']({'model':db[_0xa45c('0x5d')],'as':_0xa45c('0x67'),'attributes':['id',_0xa45c('0x5e')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x212318['params']['id']},'include':_0x2fff47})[_0xa45c('0x1b')](handleEntityNotFound(_0x2d8be3,null))[_0xa45c('0x1b')](function(_0x4b9d7f){if(_0x4b9d7f){var _0x1e2e36=_0x4b9d7f[_0xa45c('0x68')]({'plain':!![]});fs[_0xa45c('0x69')](_0x5412aa);var _0x5e7db3={'channel':_0xa45c('0x6a'),'account':_0x1e2e36[_0xa45c('0x6b')][_0xa45c('0x1e')],'agent':_0x1e2e36[_0xa45c('0x67')]?_0x1e2e36[_0xa45c('0x67')][_0xa45c('0x5e')]:_0xa45c('0x6c'),'createdAt':moment(_0x1e2e36['createdAt'])[_0xa45c('0x5b')](_0xa45c('0x4a'))['toString'](),'closedAt':_0x1e2e36[_0xa45c('0x6d')]?moment(_0x1e2e36[_0xa45c('0x6e')])[_0xa45c('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1e2e36[_0xa45c('0x6f')],'messages':_(_0x1e2e36[_0xa45c('0x64')])[_0xa45c('0x47')]({'secret':![]})[_0xa45c('0x21')](function(_0x4a2be5){if(_0x4a2be5[_0xa45c('0x63')]){var _0x2aa216=path[_0xa45c('0x5a')](_0x2d4ddc,_0x4a2be5[_0xa45c('0x63')][_0xa45c('0x70')]);if(fs['existsSync'](_0x2aa216)){fs[_0xa45c('0x71')](_0x2aa216)[_0xa45c('0x72')](fs[_0xa45c('0x73')](path['join'](_0x5412aa,_0x4a2be5[_0xa45c('0x63')][_0xa45c('0x70')])));}}return{'date':moment(_0x4a2be5[_0xa45c('0x74')])['format'](_0xa45c('0x4a'))[_0xa45c('0x75')](),'sender':_0x4a2be5[_0xa45c('0x65')]==='out'?_0x4a2be5[_0xa45c('0x5d')]?_0x4a2be5[_0xa45c('0x5d')][_0xa45c('0x5e')]:'System':_0x4a2be5[_0xa45c('0x60')][_0xa45c('0x76')]+(_0x4a2be5[_0xa45c('0x60')][_0xa45c('0x61')]?'\x20'+_0x4a2be5[_0xa45c('0x60')][_0xa45c('0x61')]:''),'body':_0x4a2be5[_0xa45c('0x63')]?_0x4a2be5[_0xa45c('0x63')][_0xa45c('0x70')]:_0x4a2be5['body'],'direction':_0x4a2be5[_0xa45c('0x65')]===_0xa45c('0x77')?'A':'C','secret':_0x4a2be5['secret'],'read':_0x4a2be5[_0xa45c('0x78')],'attachment':_0x4a2be5[_0xa45c('0x63')]};})[_0xa45c('0x79')]()};return ejs[_0xa45c('0x7a')](path[_0xa45c('0x5a')](config[_0xa45c('0x56')],_0xa45c('0x57'),_0xa45c('0x7b'),_0xa45c('0x7c')),{'interaction':_0x5e7db3})[_0xa45c('0x1b')](function(_0xfed4fe){var _0x3975f1=path[_0xa45c('0x5a')](_0x5412aa,_0xa45c('0x7d')+_0x1e2e36['id']+'-'+_0x4e2391+_0xa45c('0x7e'));var _0xdfd451={'path':_0x3975f1,'channel':_0xa45c('0x6a'),'interactionId':_0x1e2e36['id']};return pdf['createPdfFromHTML'](_0xfed4fe,_0xdfd451);})[_0xa45c('0x1b')](function(){return new BPromise(function(_0x13c5a6,_0x1d17f8){zipdir(_0x5412aa,{'saveTo':_0x59de7b},function(_0x1d53a6,_0x280044){if(_0x1d53a6)return _0x1d17f8(_0x1d53a6);return _0x13c5a6(_0x280044);});})['then'](function(){return new BPromise(function(_0x4b912c,_0x37c854){rimraf(_0x5412aa,function(_0xb50b62){if(_0xb50b62)_0x37c854(_0xb50b62);return _0x4b912c();});});})[_0xa45c('0x1b')](function(){return _0x2d8be3[_0xa45c('0x54')](_0x59de7b,_0x1aa3af,function(_0x503c6e){if(_0x503c6e){console[_0xa45c('0x7f')](_0xa45c('0x80'),_0x503c6e);}else{fs[_0xa45c('0x81')](_0x59de7b);}});});});}else{return _0x2d8be3[_0xa45c('0x11')](0xc8);}})[_0xa45c('0x29')](handleError(_0x2d8be3,null));}; \ No newline at end of file +var _0xdd2e=['describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filters','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','color','emit','unix','toString','join','tmp','root','files','attachments','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','createdAt','closedAt','disposition','basename','existsSync','createReadStream','out','System','direction','secret','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','rimraf','zip-dir','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','destroy','then','end','error','name','send','index','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','params','WhatsappInteraction','keys','model','attributes','fields','include','merge','options','create','body','update','find'];(function(_0x25a789,_0x1a465c){var _0x5a3ea6=function(_0xd3d67d){while(--_0xd3d67d){_0x25a789['push'](_0x25a789['shift']());}};_0x5a3ea6(++_0x1a465c);}(_0xdd2e,0x13d));var _0xedd2=function(_0x46dceb,_0x52c976){_0x46dceb=_0x46dceb-0x0;var _0x1e6de7=_0xdd2e[_0x46dceb];return _0x1e6de7;};'use strict';var rimraf=require(_0xedd2('0x0'));var zipdir=require(_0xedd2('0x1'));var moment=require('moment');var BPromise=require(_0xedd2('0x2'));var util=require(_0xedd2('0x3'));var path=require('path');var ejs=require(_0xedd2('0x4'));var fs=require('fs');var _=require(_0xedd2('0x5'));var Redis=require(_0xedd2('0x6'));var interaction=require(_0xedd2('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xedd2('0x8'))(_0xedd2('0x9'));var config=require(_0xedd2('0xa'));var db=require(_0xedd2('0xb'))['db'];config[_0xedd2('0xc')]=_[_0xedd2('0xd')](config[_0xedd2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xedd2('0xe'))(new Redis(config['redis']));require(_0xedd2('0xf'))[_0xedd2('0x10')](socket);function respondWithStatusCode(_0x42256f,_0xbac524){_0xbac524=_0xbac524||0xcc;return function(_0x1559e9){if(_0x1559e9){return _0x42256f[_0xedd2('0x11')](_0xbac524);}return _0x42256f[_0xedd2('0x12')](_0xbac524)['end']();};}function respondWithResult(_0x509511,_0x296dc7){_0x296dc7=_0x296dc7||0xc8;return function(_0x22fc05){if(_0x22fc05){return _0x509511[_0xedd2('0x12')](_0x296dc7)[_0xedd2('0x13')](_0x22fc05);}};}function respondWithFilteredResult(_0x59e4b1,_0x4ebc25){return function(_0x94d216){if(_0x94d216){var _0x51d272=typeof _0x4ebc25['offset']===_0xedd2('0x14')&&typeof _0x4ebc25['limit']===_0xedd2('0x14');var _0x4f5377=_0x94d216[_0xedd2('0x15')];var _0x48d3a7=_0x51d272?0x0:_0x4ebc25[_0xedd2('0x16')];var _0x1330a7=_0x51d272?_0x94d216[_0xedd2('0x15')]:_0x4ebc25[_0xedd2('0x16')]+_0x4ebc25[_0xedd2('0x17')];var _0x56e6b6;if(_0x1330a7>=_0x4f5377){_0x1330a7=_0x4f5377;_0x56e6b6=0xc8;}else{_0x56e6b6=0xce;}_0x59e4b1[_0xedd2('0x12')](_0x56e6b6);return _0x59e4b1[_0xedd2('0x18')](_0xedd2('0x19'),_0x48d3a7+'-'+_0x1330a7+'/'+_0x4f5377)[_0xedd2('0x13')](_0x94d216);}return null;};}function saveUpdates(_0x6e597b){return function(_0xf33fe5){if(_0xf33fe5){return _0xf33fe5['update'](_0x6e597b)['then'](function(_0x3ba22c){return _0x3ba22c;});}return null;};}function removeEntity(_0x1fdd32){return function(_0x4dfddb){if(_0x4dfddb){return _0x4dfddb[_0xedd2('0x1a')]()[_0xedd2('0x1b')](function(){_0x1fdd32[_0xedd2('0x12')](0xcc)[_0xedd2('0x1c')]();});}};}function handleEntityNotFound(_0x4a88e7){return function(_0x10f1ae){if(!_0x10f1ae){_0x4a88e7[_0xedd2('0x11')](0x194);}return _0x10f1ae;};}function handleError(_0x661353,_0x11d7e2){_0x11d7e2=_0x11d7e2||0x1f4;return function(_0x5a02a3){logger[_0xedd2('0x1d')](_0x5a02a3['stack']);if(_0x5a02a3[_0xedd2('0x1e')]){delete _0x5a02a3[_0xedd2('0x1e')];}_0x661353['status'](_0x11d7e2)[_0xedd2('0x1f')](_0x5a02a3);};}exports[_0xedd2('0x20')]=function(_0x79d98a,_0x111693){var _0x6a6229={};var _0x3da31a=_['map'](db['WhatsappInteraction'][_0xedd2('0x21')],function(_0x13303c){return{'name':_0x13303c[_0xedd2('0x22')],'type':_0x13303c[_0xedd2('0x23')][_0xedd2('0x24')]};});_0x6a6229=qs[_0xedd2('0x25')](_0x3da31a,_0x79d98a);return interaction[_0xedd2('0x26')](_0xedd2('0x27'),_0x79d98a[_0xedd2('0x28')],_0x79d98a['user'],_0x6a6229,_0x3da31a)[_0xedd2('0x1b')](respondWithFilteredResult(_0x111693,_0x6a6229))[_0xedd2('0x29')](handleError(_0x111693,null));};exports['show']=function(_0x1c9c3f,_0x18a830){var _0x57018a={'raw':![],'where':{'id':_0x1c9c3f[_0xedd2('0x2a')]['id']}},_0x3c72a4={};_0x3c72a4['model']=_['keys'](db[_0xedd2('0x2b')]['rawAttributes']);_0x3c72a4['query']=_[_0xedd2('0x2c')](_0x1c9c3f[_0xedd2('0x28')]);_0x3c72a4['filters']=_['intersection'](_0x3c72a4[_0xedd2('0x2d')],_0x3c72a4[_0xedd2('0x28')]);_0x57018a[_0xedd2('0x2e')]=_['intersection'](_0x3c72a4[_0xedd2('0x2d')],qs[_0xedd2('0x2f')](_0x1c9c3f[_0xedd2('0x28')][_0xedd2('0x2f')]));_0x57018a[_0xedd2('0x2e')]=_0x57018a[_0xedd2('0x2e')]['length']?_0x57018a[_0xedd2('0x2e')]:_0x3c72a4['model'];if(_0x1c9c3f[_0xedd2('0x28')]['includeAll']){_0x57018a[_0xedd2('0x30')]=[{'all':!![]}];}_0x57018a=_[_0xedd2('0x31')]({},_0x57018a,_0x1c9c3f[_0xedd2('0x32')]);return db[_0xedd2('0x2b')]['find'](_0x57018a)[_0xedd2('0x1b')](handleEntityNotFound(_0x18a830,null))[_0xedd2('0x1b')](respondWithResult(_0x18a830,null))[_0xedd2('0x29')](handleError(_0x18a830,null));};exports[_0xedd2('0x33')]=function(_0x2eac93,_0x32d610){return db[_0xedd2('0x2b')][_0xedd2('0x33')](_0x2eac93[_0xedd2('0x34')],{})['then'](respondWithResult(_0x32d610,0xc9))[_0xedd2('0x29')](handleError(_0x32d610,null));};exports[_0xedd2('0x35')]=function(_0x156197,_0x15c99d){if(_0x156197['body']['id']){delete _0x156197['body']['id'];}return db[_0xedd2('0x2b')][_0xedd2('0x36')]({'where':{'id':_0x156197[_0xedd2('0x2a')]['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x15c99d,null))[_0xedd2('0x1b')](saveUpdates(_0x156197['body'],null))[_0xedd2('0x1b')](respondWithResult(_0x15c99d,null))[_0xedd2('0x29')](handleError(_0x15c99d,null));};exports[_0xedd2('0x1a')]=function(_0x27a648,_0x46fcba){return db[_0xedd2('0x2b')][_0xedd2('0x36')]({'where':{'id':_0x27a648['params']['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x46fcba,null))[_0xedd2('0x1b')](removeEntity(_0x46fcba,null))[_0xedd2('0x29')](handleError(_0x46fcba,null));};exports[_0xedd2('0x37')]=function(_0x3e6893,_0x5cc185){return db['WhatsappInteraction'][_0xedd2('0x37')]()[_0xedd2('0x1b')](respondWithResult(_0x5cc185,null))[_0xedd2('0x29')](handleError(_0x5cc185,null));};exports[_0xedd2('0x38')]=function(_0x447c0c,_0x1a307d){return db[_0xedd2('0x39')][_0xedd2('0x36')]({'where':{'id':_0x447c0c[_0xedd2('0x2a')]['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x1a307d,null))[_0xedd2('0x1b')](function(_0x102874){if(_0x102874){return _0x102874[_0xedd2('0x38')](_0x447c0c[_0xedd2('0x34')][_0xedd2('0x3a')],_[_0xedd2('0x3b')](_0x447c0c[_0xedd2('0x34')],[_0xedd2('0x3a'),'id'])||{});}})[_0xedd2('0x1b')](respondWithResult(_0x1a307d,null))['catch'](handleError(_0x1a307d,null));};exports[_0xedd2('0x3c')]=function(_0x200a43,_0x522363){var _0x579ab9={'raw':![],'where':{}};var _0x5bbecf={};var _0x52436d={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xedd2('0x3d')]({'where':{'id':_0x200a43[_0xedd2('0x2a')]['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x522363,null))['then'](function(_0x241d48){if(_0x241d48){_0x5bbecf[_0xedd2('0x2d')]=_[_0xedd2('0x2c')](db[_0xedd2('0x39')][_0xedd2('0x21')]);_0x5bbecf[_0xedd2('0x28')]=_[_0xedd2('0x2c')](_0x200a43[_0xedd2('0x28')]);_0x5bbecf[_0xedd2('0x3e')]=_[_0xedd2('0x3f')](_0x5bbecf['model'],_0x5bbecf[_0xedd2('0x28')]);_0x579ab9[_0xedd2('0x2e')]=_[_0xedd2('0x3f')](_0x5bbecf[_0xedd2('0x2d')],qs[_0xedd2('0x2f')](_0x200a43[_0xedd2('0x28')][_0xedd2('0x2f')]));_0x579ab9[_0xedd2('0x2e')]=_0x579ab9['attributes'][_0xedd2('0x40')]?_0x579ab9[_0xedd2('0x2e')]:_0x5bbecf[_0xedd2('0x2d')];if(!_0x200a43[_0xedd2('0x28')][_0xedd2('0x41')](_0xedd2('0x42'))){_0x579ab9[_0xedd2('0x17')]=qs[_0xedd2('0x17')](_0x200a43[_0xedd2('0x28')][_0xedd2('0x17')]);_0x579ab9[_0xedd2('0x16')]=qs[_0xedd2('0x16')](_0x200a43[_0xedd2('0x28')][_0xedd2('0x16')]);}_0x579ab9[_0xedd2('0x43')]=qs[_0xedd2('0x44')](_0x200a43[_0xedd2('0x28')][_0xedd2('0x44')]);_0x579ab9[_0xedd2('0x45')]=qs[_0xedd2('0x3e')](_[_0xedd2('0x46')](_0x200a43[_0xedd2('0x28')],_0x5bbecf[_0xedd2('0x3e')]));_0x579ab9[_0xedd2('0x45')]['WhatsappInteractionId']=_0x241d48['id'];if(_0x200a43[_0xedd2('0x28')][_0xedd2('0x47')]){_0x579ab9[_0xedd2('0x45')]=_['merge'](_0x579ab9['where'],{'$or':_[_0xedd2('0x48')](_0x579ab9['attributes'],function(_0x4ab8cc){var _0x1023b2={};_0x1023b2[_0x4ab8cc]={'$like':'%'+_0x200a43['query'][_0xedd2('0x47')]+'%'};return _0x1023b2;})});}if(_0x200a43['query'][_0xedd2('0x49')]){var _0x2ed6f0=_0x200a43[_0xedd2('0x28')]['$gte']['split'](',');var _0x4137bc={};_0x4137bc[_0x2ed6f0[0x0]]={'$gte':moment(_0x2ed6f0[0x1])[_0xedd2('0x4a')](_0xedd2('0x4b'))};_0x579ab9['where']=_[_0xedd2('0x31')](_0x579ab9['where'],_0x4137bc);}_0x579ab9=_[_0xedd2('0x31')]({},_0x579ab9,_0x200a43[_0xedd2('0x32')]);return db[_0xedd2('0x39')][_0xedd2('0x15')]({'where':_0x579ab9[_0xedd2('0x45')]})[_0xedd2('0x1b')](function(_0x179b11){_0x52436d['count']=_0x179b11;if(_0x200a43['query'][_0xedd2('0x4c')]){_0x579ab9[_0xedd2('0x30')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xedd2('0x26')](_0x579ab9);})['then'](function(_0x257f5d){_0x52436d[_0xedd2('0x4d')]=_0x257f5d;return _0x52436d;});}})[_0xedd2('0x1b')](respondWithFilteredResult(_0x522363,_0x579ab9))[_0xedd2('0x29')](handleError(_0x522363,null));};exports[_0xedd2('0x4e')]=function(_0x53a0ff,_0x4b9ec1){return db[_0xedd2('0x2b')]['find']({'where':{'id':_0x53a0ff[_0xedd2('0x2a')]['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x4b9ec1,null))[_0xedd2('0x1b')](function(_0x8431a3){if(_0x8431a3){return _0x8431a3['setTags'](_0x53a0ff['body'][_0xedd2('0x3a')],_[_0xedd2('0x3b')](_0x53a0ff[_0xedd2('0x34')],[_0xedd2('0x3a'),'id'])||{})[_0xedd2('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xedd2('0x50')],'where':{'id':_0x53a0ff['body'][_0xedd2('0x3a')]}});})[_0xedd2('0x1b')](function(_0x5c9193){socket[_0xedd2('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x53a0ff['params']['id']),'tags':_0x5c9193||[]});return{'id':Number(_0x53a0ff['params']['id']),'tags':_0x5c9193||[]};});}})[_0xedd2('0x1b')](respondWithResult(_0x4b9ec1,null))[_0xedd2('0x29')](handleError(_0x4b9ec1,null));};exports['removeTags']=function(_0x4b37cd,_0x580dfe){return db['WhatsappInteraction'][_0xedd2('0x36')]({'where':{'id':_0x4b37cd['params']['id']}})[_0xedd2('0x1b')](handleEntityNotFound(_0x580dfe,null))[_0xedd2('0x1b')](function(_0x25d5d2){if(_0x25d5d2){return _0x25d5d2['removeTags'](_0x4b37cd[_0xedd2('0x28')][_0xedd2('0x3a')]);}})[_0xedd2('0x1b')](respondWithStatusCode(_0x580dfe,null))['catch'](handleError(_0x580dfe,null));};exports['download']=function(_0x29c97c,_0x516bd4){var _0x2810cc=moment()[_0xedd2('0x52')]()[_0xedd2('0x53')]();var _0x1d07af=path[_0xedd2('0x54')](config['root'],'server','files',_0xedd2('0x55'));var _0x3c358b=path[_0xedd2('0x54')](config[_0xedd2('0x56')],'server',_0xedd2('0x57'),_0xedd2('0x58'));var _0x1ae094=path[_0xedd2('0x54')](_0x1d07af,_0x2810cc);var _0x2ce0a4=util[_0xedd2('0x4a')]('transcript-%d-%s.zip',_0x29c97c[_0xedd2('0x2a')]['id'],_0x2810cc);var _0x5d4813=path['join'](_0x1d07af,_0x2ce0a4);var _0x451bd4=[];_0x451bd4[_0xedd2('0x59')]({'model':db[_0xedd2('0x5a')],'as':_0xedd2('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x451bd4['push']({'model':db[_0xedd2('0x5b')],'as':_0xedd2('0x5c'),'attributes':['id',_0xedd2('0x5d'),_0xedd2('0x5e')],'raw':!![]});if(_0x29c97c[_0xedd2('0x28')][_0xedd2('0x58')]){_0x451bd4[_0xedd2('0x59')]({'model':db[_0xedd2('0x5f')],'as':'Attachment','raw':!![]});}var _0x72d5e5=[{'model':db['WhatsappMessage'],'as':_0xedd2('0x60'),'attributes':['id','body','createdAt','direction','secret',_0xedd2('0x61')],'include':_0x451bd4}];_0x72d5e5[_0xedd2('0x59')]({'model':db[_0xedd2('0x62')],'as':_0xedd2('0x63'),'attributes':['id',_0xedd2('0x1e')]});_0x72d5e5[_0xedd2('0x59')]({'model':db[_0xedd2('0x5a')],'as':_0xedd2('0x64'),'attributes':['id',_0xedd2('0x65')]});return db[_0xedd2('0x2b')][_0xedd2('0x36')]({'where':{'id':_0x29c97c['params']['id']},'include':_0x72d5e5})[_0xedd2('0x1b')](handleEntityNotFound(_0x516bd4,null))[_0xedd2('0x1b')](function(_0x268a7f){if(_0x268a7f){var _0x1b8941=_0x268a7f[_0xedd2('0x66')]({'plain':!![]});fs[_0xedd2('0x67')](_0x1ae094);var _0x456e9e={'channel':_0xedd2('0x68'),'account':_0x1b8941['Account'][_0xedd2('0x1e')],'agent':_0x1b8941[_0xedd2('0x64')]?_0x1b8941[_0xedd2('0x64')]['fullname']:_0xedd2('0x69'),'createdAt':moment(_0x1b8941[_0xedd2('0x6a')])['format'](_0xedd2('0x4b'))[_0xedd2('0x53')](),'closedAt':_0x1b8941['closed']?moment(_0x1b8941[_0xedd2('0x6b')])[_0xedd2('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1b8941[_0xedd2('0x6c')],'messages':_(_0x1b8941['Messages'])[_0xedd2('0x47')]({'secret':![]})[_0xedd2('0x48')](function(_0x336722){if(_0x336722[_0xedd2('0x5f')]){var _0x4b9f78=path[_0xedd2('0x54')](_0x3c358b,_0x336722['Attachment'][_0xedd2('0x6d')]);if(fs[_0xedd2('0x6e')](_0x4b9f78)){fs[_0xedd2('0x6f')](_0x4b9f78)['pipe'](fs['createWriteStream'](path[_0xedd2('0x54')](_0x1ae094,_0x336722['Attachment']['basename'])));}}return{'date':moment(_0x336722[_0xedd2('0x6a')])[_0xedd2('0x4a')](_0xedd2('0x4b'))[_0xedd2('0x53')](),'sender':_0x336722['direction']===_0xedd2('0x70')?_0x336722[_0xedd2('0x5a')]?_0x336722[_0xedd2('0x5a')]['fullname']:_0xedd2('0x71'):_0x336722[_0xedd2('0x5c')]['firstName']+(_0x336722['Contact'][_0xedd2('0x5e')]?'\x20'+_0x336722['Contact'][_0xedd2('0x5e')]:''),'body':_0x336722[_0xedd2('0x5f')]?_0x336722['Attachment'][_0xedd2('0x6d')]:_0x336722[_0xedd2('0x34')],'direction':_0x336722[_0xedd2('0x72')]==='out'?'A':'C','secret':_0x336722[_0xedd2('0x73')],'read':_0x336722[_0xedd2('0x61')],'attachment':_0x336722['Attachment']};})[_0xedd2('0x74')]()};return ejs[_0xedd2('0x75')](path[_0xedd2('0x54')](config[_0xedd2('0x56')],'server','views',_0xedd2('0x76')),{'interaction':_0x456e9e})['then'](function(_0x3e6a2d){var _0x121e4c=path[_0xedd2('0x54')](_0x1ae094,_0xedd2('0x77')+_0x1b8941['id']+'-'+_0x2810cc+'.pdf');var _0x1d3b5c={'path':_0x121e4c,'channel':_0xedd2('0x68'),'interactionId':_0x1b8941['id']};return pdf[_0xedd2('0x78')](_0x3e6a2d,_0x1d3b5c);})[_0xedd2('0x1b')](function(){return new BPromise(function(_0x144950,_0x5a824a){zipdir(_0x1ae094,{'saveTo':_0x5d4813},function(_0x396d1c,_0x25098){if(_0x396d1c)return _0x5a824a(_0x396d1c);return _0x144950(_0x25098);});})[_0xedd2('0x1b')](function(){return new BPromise(function(_0x1ec08a,_0x42c785){rimraf(_0x1ae094,function(_0xa2d0c2){if(_0xa2d0c2)_0x42c785(_0xa2d0c2);return _0x1ec08a();});});})[_0xedd2('0x1b')](function(){return _0x516bd4[_0xedd2('0x79')](_0x5d4813,_0x2ce0a4,function(_0x29bed6){if(_0x29bed6){console[_0xedd2('0x7a')](_0xedd2('0x7b'),_0x29bed6);}else{fs['unlinkSync'](_0x5d4813);}});});});}else{return _0x516bd4[_0xedd2('0x11')](0xc8);}})[_0xedd2('0x29')](handleError(_0x516bd4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ec98713..9bbbff5 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 _0x028d=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5a1402,_0x5ae28d){var _0x467031=function(_0xb37a51){while(--_0xb37a51){_0x5a1402['push'](_0x5a1402['shift']());}};_0x467031(++_0x5ae28d);}(_0x028d,0xff));var _0xd028=function(_0xc2e9b3,_0x3a015f){_0xc2e9b3=_0xc2e9b3-0x0;var _0x355895=_0x028d[_0xc2e9b3];return _0x355895;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd028('0x0'))['db'][_0xd028('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xd028('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd028('0x3')](0x0);var events={'afterCreate':_0xd028('0x4'),'afterUpdate':_0xd028('0x5'),'afterDestroy':_0xd028('0x6')};function emitEvent(_0x67d150){return function(_0x5094d8,_0x153af8,_0x4592fd){_0x5094d8[_0xd028('0x7')]({'attributes':['id'],'raw':!![]})[_0xd028('0x8')](function(_0x110b50){_0x5094d8[_0xd028('0x9')](_0xd028('0xa'),_0x110b50[_0xd028('0xb')](function(_0xadea4b){return{'id':_0xadea4b['id']};}));return WhatsappMessage[_0xd028('0xc')]({'where':{'WhatsappInteractionId':_0x5094d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd028('0x8')](function(_0x1211c6){_0x5094d8[_0xd028('0x9')](_0xd028('0xd'),_0x1211c6['length']);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150+':'+_0x5094d8['id'],_0x5094d8);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150,_0x5094d8);_0x4592fd(null);})[_0xd028('0xf')](_0x4592fd(null));};}for(var e in events){if(events[_0xd028('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd028('0x11')](e,emitEvent(event));}}module[_0xd028('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd957=['emit','hook','exports','events','../../mysqldb','WhatsappMessage','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length'];(function(_0x175186,_0x2549a4){var _0xe02d75=function(_0x452e53){while(--_0x452e53){_0x175186['push'](_0x175186['shift']());}};_0xe02d75(++_0x2549a4);}(_0xd957,0x153));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7d95('0x0'));var WhatsappInteraction=require(_0x7d95('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x7d95('0x1'))['db'][_0x7d95('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d95('0x3'),'afterUpdate':_0x7d95('0x4'),'afterDestroy':_0x7d95('0x5')};function emitEvent(_0x9750e1){return function(_0x24d0a6,_0x225179,_0x2de581){_0x24d0a6['getUsers']({'attributes':['id'],'raw':!![]})[_0x7d95('0x6')](function(_0x11bb29){_0x24d0a6['setDataValue'](_0x7d95('0x7'),_0x11bb29[_0x7d95('0x8')](function(_0xf2770a){return{'id':_0xf2770a['id']};}));return WhatsappMessage[_0x7d95('0x9')]({'where':{'WhatsappInteractionId':_0x24d0a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d95('0x6')](function(_0x572e5f){_0x24d0a6[_0x7d95('0xa')](_0x7d95('0xb'),_0x572e5f[_0x7d95('0xc')]);WhatsappInteractionEvents[_0x7d95('0xd')](_0x9750e1+':'+_0x24d0a6['id'],_0x24d0a6);WhatsappInteractionEvents[_0x7d95('0xd')](_0x9750e1,_0x24d0a6);_0x2de581(null);})['catch'](_0x2de581(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x7d95('0xe')](e,emitEvent(event));}}module[_0x7d95('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a11db10..e37b2cd 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 _0xbcc2=['bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','../../config/logger','moment'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xbcc2,0x93));var _0x2bcc=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0xbcc2[_0x4cbb8e];return _0x17846f;};'use strict';var _=require(_0x2bcc('0x0'));var util=require('util');var logger=require(_0x2bcc('0x1'))('api');var moment=require(_0x2bcc('0x2'));var BPromise=require(_0x2bcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2bcc('0x4'));var config=require(_0x2bcc('0x5'));var attributes=require(_0x2bcc('0x6'));module[_0x2bcc('0x7')]=function(_0x5615d9,_0x1148ba){return _0x5615d9[_0x2bcc('0x8')](_0x2bcc('0x9'),attributes,{'tableName':_0x2bcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31af6a,_0x5e14eb,_0x1fe9c8){if(_0x31af6a[_0x2bcc('0xb')](_0x2bcc('0xc'))){_0x31af6a[_0x2bcc('0xd')]=moment()[_0x2bcc('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fe9c8(null,_0x31af6a);}}});}; \ No newline at end of file +var _0x56d3=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise'];(function(_0xb3e50,_0x6fe081){var _0x26b7f4=function(_0x562902){while(--_0x562902){_0xb3e50['push'](_0xb3e50['shift']());}};_0x26b7f4(++_0x6fe081);}(_0x56d3,0x191));var _0x356d=function(_0xba5a3f,_0x166b10){_0xba5a3f=_0xba5a3f-0x0;var _0x21d8e2=_0x56d3[_0xba5a3f];return _0x21d8e2;};'use strict';var _=require(_0x356d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x356d('0x1'));var moment=require(_0x356d('0x2'));var BPromise=require('bluebird');var rp=require(_0x356d('0x3'));var fs=require('fs');var path=require(_0x356d('0x4'));var rimraf=require(_0x356d('0x5'));var config=require(_0x356d('0x6'));var attributes=require(_0x356d('0x7'));module[_0x356d('0x8')]=function(_0x4e82e0,_0x1aacf2){return _0x4e82e0['define'](_0x356d('0x9'),attributes,{'tableName':_0x356d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4585f9,_0x496dce,_0x11754f){if(_0x4585f9[_0x356d('0xb')](_0x356d('0xc'))){_0x4585f9['closedAt']=moment()[_0x356d('0xd')](_0x356d('0xe'));}_0x11754f(null,_0x4585f9);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9344ccf..168cbcc 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 _0x8c2f=['info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','addTags','ids','AddTags','stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','request','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message'];(function(_0x206915,_0x5d88cf){var _0x446548=function(_0xc83cf0){while(--_0xc83cf0){_0x206915['push'](_0x206915['shift']());}};_0x446548(++_0x5d88cf);}(_0x8c2f,0xbd));var _0xf8c2=function(_0x28fd11,_0xb7b5ca){_0x28fd11=_0x28fd11-0x0;var _0x51caa0=_0x8c2f[_0x28fd11];return _0x51caa0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8c2('0x0'));var BPromise=require(_0xf8c2('0x1'));var rs=require(_0xf8c2('0x2'));var fs=require('fs');var Redis=require(_0xf8c2('0x3'));var db=require(_0xf8c2('0x4'))['db'];var utils=require(_0xf8c2('0x5'));var logger=require(_0xf8c2('0x6'))(_0xf8c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8c2('0x8'));var client=jayson[_0xf8c2('0x9')][_0xf8c2('0xa')]({'port':0x232a});config['redis']=_[_0xf8c2('0xb')](config['redis'],{'host':_0xf8c2('0xc'),'port':0x18eb});var socket=require(_0xf8c2('0xd'))(new Redis(config[_0xf8c2('0xe')]));require(_0xf8c2('0xf'))[_0xf8c2('0x10')](socket);function respondWithRpcPromise(_0x398abb,_0x5af03e,_0x31132e){return new BPromise(function(_0x5ce0c6,_0x176259){return client[_0xf8c2('0x11')](_0x398abb,_0x31132e)[_0xf8c2('0x12')](function(_0x15d7d8){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5af03e,_0xf8c2('0x13'));logger[_0xf8c2('0x14')](_0xf8c2('0x15'),_0x5af03e,_0xf8c2('0x13'),JSON['stringify'](_0x15d7d8));if(_0x15d7d8[_0xf8c2('0x16')]){if(_0x15d7d8[_0xf8c2('0x16')][_0xf8c2('0x17')]===0x1f4){logger[_0xf8c2('0x16')](_0xf8c2('0x18'),_0x5af03e,_0x15d7d8['error'][_0xf8c2('0x19')]);return _0x176259(_0x15d7d8['error']['message']);}logger[_0xf8c2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x5af03e,_0x15d7d8[_0xf8c2('0x16')]['message']);return _0x5ce0c6(_0x15d7d8[_0xf8c2('0x16')][_0xf8c2('0x19')]);}else{logger[_0xf8c2('0x1a')](_0xf8c2('0x18'),_0x5af03e,'request\x20sent');_0x5ce0c6(_0x15d7d8[_0xf8c2('0x1b')][_0xf8c2('0x19')]);}})['catch'](function(_0x1ee401){logger[_0xf8c2('0x16')](_0xf8c2('0x18'),_0x5af03e,_0x1ee401);_0x176259(_0x1ee401);});});}exports[_0xf8c2('0x1c')]=function(_0x15aef6){var _0xfd6493=this;return new Promise(function(_0x1cfdd6,_0x5ab0ef){return db[_0xf8c2('0x1d')][_0xf8c2('0x1e')](_0x15aef6[_0xf8c2('0x1f')],{'raw':_0x15aef6[_0xf8c2('0x20')]?_0x15aef6['options'][_0xf8c2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15aef6[_0xf8c2('0x20')]?_0x15aef6[_0xf8c2('0x20')][_0xf8c2('0x22')]||null:null,'attributes':_0x15aef6[_0xf8c2('0x20')]?_0x15aef6[_0xf8c2('0x20')][_0xf8c2('0x23')]||null:null,'limit':_0x15aef6['options']?_0x15aef6[_0xf8c2('0x20')][_0xf8c2('0x24')]||null:null})['then'](function(_0x62c14e){logger[_0xf8c2('0x1a')](_0xf8c2('0x1c'),_0x15aef6);logger[_0xf8c2('0x14')]('UpdateWhatsappInteraction',_0x15aef6,JSON['stringify'](_0x62c14e));_0x1cfdd6(_0x62c14e);})['catch'](function(_0x31ab89){logger[_0xf8c2('0x16')](_0xf8c2('0x1c'),_0x31ab89[_0xf8c2('0x19')],_0x15aef6);_0x5ab0ef(_0xfd6493[_0xf8c2('0x16')](0x1f4,_0x31ab89[_0xf8c2('0x19')]));});});};exports[_0xf8c2('0x25')]=function(_0x404f1a){return new Promise(function(_0x3544fb,_0x3b9833){return db[_0xf8c2('0x1d')]['find']({'where':_0x404f1a[_0xf8c2('0x20')]?_0x404f1a[_0xf8c2('0x20')][_0xf8c2('0x22')]||null:null})['then'](function(_0x15858b){if(_0x15858b){return _0x15858b[_0xf8c2('0x26')](_0x404f1a[_0xf8c2('0x1f')]['ids'],_['omit'](_0x404f1a[_0xf8c2('0x1f')],[_0xf8c2('0x27'),'id'])||{});}})['spread'](function(_0x7a67dc){logger[_0xf8c2('0x1a')](_0xf8c2('0x28'),_0x404f1a);logger[_0xf8c2('0x14')](_0xf8c2('0x28'),_0x404f1a,JSON[_0xf8c2('0x29')](_0x7a67dc));_0x3544fb(_0x7a67dc);})[_0xf8c2('0x2a')](function(_0x432cb6){logger[_0xf8c2('0x16')](_0xf8c2('0x28'),_0x432cb6[_0xf8c2('0x19')],_0x404f1a);_0x3b9833(_this['error'](0x1f4,_0x432cb6[_0xf8c2('0x19')]));});});}; \ No newline at end of file +var _0x0321=['request','then','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','./whatsappInteraction.socket','register'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x0321,0xc3));var _0x1032=function(_0x364383,_0x16f019){_0x364383=_0x364383-0x0;var _0x4fd2c5=_0x0321[_0x364383];return _0x4fd2c5;};'use strict';var _=require(_0x1032('0x0'));var util=require(_0x1032('0x1'));var moment=require(_0x1032('0x2'));var BPromise=require(_0x1032('0x3'));var rs=require(_0x1032('0x4'));var fs=require('fs');var Redis=require(_0x1032('0x5'));var db=require(_0x1032('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1032('0x7'));var config=require(_0x1032('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1032('0x9')][_0x1032('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1032('0xb')],{'host':_0x1032('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1032('0xb')]));require(_0x1032('0xd'))[_0x1032('0xe')](socket);function respondWithRpcPromise(_0x4ee07a,_0x4b3888,_0x113254){return new BPromise(function(_0x2d9c21,_0x10bf25){return client[_0x1032('0xf')](_0x4ee07a,_0x113254)[_0x1032('0x10')](function(_0x457141){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4b3888,_0x1032('0x11'));logger[_0x1032('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4b3888,_0x1032('0x11'),JSON[_0x1032('0x13')](_0x457141));if(_0x457141['error']){if(_0x457141[_0x1032('0x14')][_0x1032('0x15')]===0x1f4){logger[_0x1032('0x14')](_0x1032('0x16'),_0x4b3888,_0x457141[_0x1032('0x14')]['message']);return _0x10bf25(_0x457141[_0x1032('0x14')][_0x1032('0x17')]);}logger[_0x1032('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4b3888,_0x457141[_0x1032('0x14')][_0x1032('0x17')]);return _0x2d9c21(_0x457141[_0x1032('0x14')][_0x1032('0x17')]);}else{logger[_0x1032('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x4b3888,_0x1032('0x11'));_0x2d9c21(_0x457141['result']['message']);}})[_0x1032('0x19')](function(_0xc83d78){logger[_0x1032('0x14')](_0x1032('0x16'),_0x4b3888,_0xc83d78);_0x10bf25(_0xc83d78);});});}exports[_0x1032('0x1a')]=function(_0x5bb41b){var _0xda0a71=this;return new Promise(function(_0x4a2360,_0x30bdfa){return db[_0x1032('0x1b')][_0x1032('0x1c')](_0x5bb41b[_0x1032('0x1d')],{'raw':_0x5bb41b[_0x1032('0x1e')]?_0x5bb41b[_0x1032('0x1e')][_0x1032('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bb41b[_0x1032('0x1e')]?_0x5bb41b[_0x1032('0x1e')][_0x1032('0x20')]||null:null,'attributes':_0x5bb41b['options']?_0x5bb41b[_0x1032('0x1e')][_0x1032('0x21')]||null:null,'limit':_0x5bb41b[_0x1032('0x1e')]?_0x5bb41b[_0x1032('0x1e')][_0x1032('0x22')]||null:null})[_0x1032('0x10')](function(_0x3727d7){logger[_0x1032('0x18')](_0x1032('0x1a'),_0x5bb41b);logger[_0x1032('0x12')](_0x1032('0x1a'),_0x5bb41b,JSON[_0x1032('0x13')](_0x3727d7));_0x4a2360(_0x3727d7);})[_0x1032('0x19')](function(_0x413b3c){logger[_0x1032('0x14')](_0x1032('0x1a'),_0x413b3c[_0x1032('0x17')],_0x5bb41b);_0x30bdfa(_0xda0a71['error'](0x1f4,_0x413b3c[_0x1032('0x17')]));});});};exports[_0x1032('0x23')]=function(_0x267e82){return new Promise(function(_0x393e66,_0xbd3bd1){return db[_0x1032('0x1b')][_0x1032('0x24')]({'where':_0x267e82[_0x1032('0x1e')]?_0x267e82[_0x1032('0x1e')]['where']||null:null})[_0x1032('0x10')](function(_0x3df35a){if(_0x3df35a){return _0x3df35a[_0x1032('0x25')](_0x267e82[_0x1032('0x1d')][_0x1032('0x26')],_[_0x1032('0x27')](_0x267e82['body'],[_0x1032('0x26'),'id'])||{});}})[_0x1032('0x28')](function(_0x539511){logger[_0x1032('0x18')]('AddTags',_0x267e82);logger[_0x1032('0x12')](_0x1032('0x29'),_0x267e82,JSON[_0x1032('0x13')](_0x539511));_0x393e66(_0x539511);})[_0x1032('0x19')](function(_0x105d55){logger[_0x1032('0x14')](_0x1032('0x29'),_0x105d55[_0x1032('0x17')],_0x267e82);_0xbd3bd1(_this[_0x1032('0x14')](0x1f4,_0x105d55[_0x1032('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 034ba6b..1c1bc97 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 _0x2561=['register','length','whatsappInteraction:','save','remove','update','emit','removeListener'];(function(_0x5ce68f,_0x1c468d){var _0x2a7421=function(_0x3e8270){while(--_0x3e8270){_0x5ce68f['push'](_0x5ce68f['shift']());}};_0x2a7421(++_0x1c468d);}(_0x2561,0x73));var _0x1256=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2561[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x1256('0x0'),_0x1256('0x1'),_0x1256('0x2')];function createListener(_0x3e532d,_0xdc5a66){return function(_0x564641){_0xdc5a66[_0x1256('0x3')](_0x3e532d,_0x564641);};}function removeListener(_0x319e58,_0x2c8892){return function(){WhatsappInteractionEvents[_0x1256('0x4')](_0x319e58,_0x2c8892);};}exports[_0x1256('0x5')]=function(_0x226010){for(var _0x27dc87=0x0,_0x1b7662=events[_0x1256('0x6')];_0x27dc87<_0x1b7662;_0x27dc87++){var _0xd5f4d4=events[_0x27dc87];var _0x32c557=createListener(_0x1256('0x7')+_0xd5f4d4,_0x226010);WhatsappInteractionEvents['on'](_0xd5f4d4,_0x32c557);}}; \ No newline at end of file +var _0x8aa0=['./whatsappInteraction.events','remove','update','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8aa0,0x1ec));var _0x08aa=function(_0x4f76ec,_0x45faaf){_0x4f76ec=_0x4f76ec-0x0;var _0x47475c=_0x8aa0[_0x4f76ec];return _0x47475c;};'use strict';var WhatsappInteractionEvents=require(_0x08aa('0x0'));var events=['save',_0x08aa('0x1'),_0x08aa('0x2')];function createListener(_0x508f5e,_0x8150a){return function(_0x3bba01){_0x8150a['emit'](_0x508f5e,_0x3bba01);};}function removeListener(_0x268bab,_0x1a3002){return function(){WhatsappInteractionEvents[_0x08aa('0x3')](_0x268bab,_0x1a3002);};}exports['register']=function(_0x3b4a2b){for(var _0x2f722e=0x0,_0x82160f=events['length'];_0x2f722e<_0x82160f;_0x2f722e++){var _0x2cf145=events[_0x2f722e];var _0xdf3557=createListener('whatsappInteraction:'+_0x2cf145,_0x3b4a2b);WhatsappInteractionEvents['on'](_0x2cf145,_0xdf3557);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1db326f..1bc68cd 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 _0x07bd=['tracked','whatsapp','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x07bd,0xa8));var _0xd07b=function(_0x4c064e,_0x4dbc05){_0x4c064e=_0x4c064e-0x0;var _0x5722f8=_0x07bd[_0x4c064e];return _0x5722f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd07b('0x0'));var timeout=require(_0xd07b('0x1'));var express=require(_0xd07b('0x2'));var router=express[_0xd07b('0x3')]();var fs_extra=require(_0xd07b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd07b('0x5'));var config=require(_0xd07b('0x6'));var controller=require(_0xd07b('0x7'));router[_0xd07b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd07b('0x8')](_0xd07b('0x9'),auth[_0xd07b('0xa')](),controller[_0xd07b('0xb')]);router['get'](_0xd07b('0xc'),auth[_0xd07b('0xa')](),controller[_0xd07b('0xd')]);router['post']('/',auth[_0xd07b('0xa')](),interaction[_0xd07b('0xe')](_0xd07b('0xf'),'whatsappmessage:create'),controller['create']);router[_0xd07b('0x10')](_0xd07b('0x11'),controller[_0xd07b('0x12')]);router[_0xd07b('0x13')](_0xd07b('0xc'),auth[_0xd07b('0xa')](),controller['update']);router[_0xd07b('0x13')](_0xd07b('0x14'),auth[_0xd07b('0xa')](),controller[_0xd07b('0x15')]);router[_0xd07b('0x13')](_0xd07b('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xd07b('0x17')](_0xd07b('0xc'),auth[_0xd07b('0xa')](),controller[_0xd07b('0x18')]);module[_0xd07b('0x19')]=router; \ No newline at end of file +var _0x5435=['update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','/:id/status','status','put'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x5435,0x1ed));var _0x5543=function(_0x1f6eca,_0x4d721d){_0x1f6eca=_0x1f6eca-0x0;var _0x10f5c9=_0x5435[_0x1f6eca];return _0x10f5c9;};'use strict';var multer=require(_0x5543('0x0'));var util=require('util');var path=require(_0x5543('0x1'));var timeout=require(_0x5543('0x2'));var express=require(_0x5543('0x3'));var router=express['Router']();var fs_extra=require(_0x5543('0x4'));var auth=require(_0x5543('0x5'));var interaction=require(_0x5543('0x6'));var config=require(_0x5543('0x7'));var controller=require(_0x5543('0x8'));router[_0x5543('0x9')]('/',auth[_0x5543('0xa')](),controller[_0x5543('0xb')]);router[_0x5543('0x9')]('/describe',auth[_0x5543('0xa')](),controller[_0x5543('0xc')]);router[_0x5543('0x9')](_0x5543('0xd'),auth[_0x5543('0xa')](),controller[_0x5543('0xe')]);router[_0x5543('0xf')]('/',auth[_0x5543('0xa')](),interaction[_0x5543('0x10')]('whatsapp','whatsappmessage:create'),controller['create']);router[_0x5543('0xf')](_0x5543('0x11'),controller[_0x5543('0x12')]);router[_0x5543('0x13')](_0x5543('0xd'),auth[_0x5543('0xa')](),controller[_0x5543('0x14')]);router[_0x5543('0x13')](_0x5543('0x15'),auth[_0x5543('0xa')](),controller['accept']);router[_0x5543('0x13')](_0x5543('0x16'),auth[_0x5543('0xa')](),controller[_0x5543('0x17')]);router[_0x5543('0x18')](_0x5543('0xd'),auth[_0x5543('0xa')](),controller[_0x5543('0x19')]);module[_0x5543('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ce51e30..48e0315 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 _0x7ba0=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x7ba0,0x1e5));var _0x07ba=function(_0x137007,_0x14852c){_0x137007=_0x137007-0x0;var _0x454de9=_0x7ba0[_0x137007];return _0x454de9;};'use strict';var Sequelize=require(_0x07ba('0x0'));module[_0x07ba('0x1')]={'body':{'type':Sequelize[_0x07ba('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x07ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x07ba('0x4')]('in',_0x07ba('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x07ba('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x07ba('0x7')]},'secret':{'type':Sequelize[_0x07ba('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x07ba('0x6')]},'providerResponse':{'type':Sequelize[_0x07ba('0x2')]}}; \ No newline at end of file +var _0x6e5f=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x6e5f,0x17f));var _0xf6e5=function(_0x7df74d,_0x5d3ab9){_0x7df74d=_0x7df74d-0x0;var _0x5ae276=_0x6e5f[_0x7df74d];return _0x5ae276;};'use strict';var Sequelize=require(_0xf6e5('0x0'));module[_0xf6e5('0x1')]={'body':{'type':Sequelize[_0xf6e5('0x2')](_0xf6e5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf6e5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf6e5('0x5')]('in',_0xf6e5('0x6')),'defaultValue':_0xf6e5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf6e5('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf6e5('0x8')]},'secret':{'type':Sequelize[_0xf6e5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf6e5('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 95f029b..83e5615 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 _0x9457=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','http','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','show','params','length','find','create','body','destroy','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','interface','event','WhatsappAccount','WhatsappAccountId','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir'];(function(_0x59031e,_0x5e8e19){var _0x829afe=function(_0x289d6e){while(--_0x289d6e){_0x59031e['push'](_0x59031e['shift']());}};_0x829afe(++_0x5e8e19);}(_0x9457,0x1a1));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7945('0x0'));var rimraf=require(_0x7945('0x1'));var zipdir=require(_0x7945('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7945('0x3'));var moment=require(_0x7945('0x4'));var BPromise=require(_0x7945('0x5'));var Mustache=require('mustache');var util=require(_0x7945('0x6'));var path=require(_0x7945('0x7'));var sox=require(_0x7945('0x8'));var csv=require(_0x7945('0x9'));var ejs=require(_0x7945('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7945('0xb'));var crypto=require(_0x7945('0xc'));var jsforce=require(_0x7945('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7945('0xe'));var Redis=require(_0x7945('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7945('0x10'));var hardwareService=require(_0x7945('0x11'));var logger=require(_0x7945('0x12'))(_0x7945('0x13'));var utils=require(_0x7945('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7945('0x15'))['db'];config[_0x7945('0x16')]=_[_0x7945('0x17')](config[_0x7945('0x16')],{'host':_0x7945('0x18'),'port':0x18eb});var socket=require(_0x7945('0x19'))(new Redis(config[_0x7945('0x16')]));require(_0x7945('0x1a'))[_0x7945('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7945('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x7945('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x23dca6,_0x21cbc8,_0x374437,_0x37771b){return new BPromise(function(_0xfe731f,_0x5d31cd){var _0x5ae1dc=_0x37771b||client;return _0x5ae1dc[_0x7945('0x1d')](_0x23dca6,_0x374437)['then'](function(_0x155de4){logger['info'](_0x7945('0x1e'),_0x21cbc8,_0x7945('0x1f'));logger[_0x7945('0x20')](_0x7945('0x21'),_0x21cbc8,_0x7945('0x1f'),JSON[_0x7945('0x22')](_0x155de4));if(_0x155de4[_0x7945('0x23')]){if(_0x155de4[_0x7945('0x23')][_0x7945('0x24')]===0x1f4){logger[_0x7945('0x23')](_0x7945('0x1e'),_0x21cbc8,_0x155de4[_0x7945('0x23')][_0x7945('0x25')]);return _0x5d31cd(_0x155de4[_0x7945('0x23')][_0x7945('0x25')]);}logger['error'](_0x7945('0x1e'),_0x21cbc8,_0x155de4['error'][_0x7945('0x25')]);return _0xfe731f(_0x155de4['error'][_0x7945('0x25')]);}else{logger[_0x7945('0x26')](_0x7945('0x1e'),_0x21cbc8,_0x7945('0x1f'));_0xfe731f(_0x155de4[_0x7945('0x27')][_0x7945('0x25')]);}})[_0x7945('0x28')](function(_0x408d00){logger[_0x7945('0x23')](_0x7945('0x1e'),_0x21cbc8,_0x408d00);_0x5d31cd(_0x408d00);});});}function respondWithStatusCode(_0x26f416,_0x166638){_0x166638=_0x166638||0xcc;return function(_0x48fefa){if(_0x48fefa){return _0x26f416[_0x7945('0x29')](_0x166638);}return _0x26f416[_0x7945('0x2a')](_0x166638)[_0x7945('0x2b')]();};}function respondWithResult(_0x147b98,_0x3e55a4){_0x3e55a4=_0x3e55a4||0xc8;return function(_0x4d48be){if(_0x4d48be){return _0x147b98[_0x7945('0x2a')](_0x3e55a4)[_0x7945('0x2c')](_0x4d48be);}};}function respondWithFilteredResult(_0x2fbc6f,_0x28fbd5){return function(_0x590f20){if(_0x590f20){var _0x1a9e53=typeof _0x28fbd5[_0x7945('0x2d')]===_0x7945('0x2e')&&typeof _0x28fbd5[_0x7945('0x2f')]===_0x7945('0x2e');var _0x4d66ae=_0x590f20[_0x7945('0x30')];var _0x4c8d4d=_0x1a9e53?0x0:_0x28fbd5['offset'];var _0x455ec0=_0x1a9e53?_0x590f20[_0x7945('0x30')]:_0x28fbd5['offset']+_0x28fbd5['limit'];var _0x58b3bd;if(_0x455ec0>=_0x4d66ae){_0x455ec0=_0x4d66ae;_0x58b3bd=0xc8;}else{_0x58b3bd=0xce;}_0x2fbc6f[_0x7945('0x2a')](_0x58b3bd);return _0x2fbc6f[_0x7945('0x31')](_0x7945('0x32'),_0x4c8d4d+'-'+_0x455ec0+'/'+_0x4d66ae)[_0x7945('0x2c')](_0x590f20);}return null;};}function patchUpdates(_0x41aad9){return function(_0x481811){try{jsonpatch[_0x7945('0x33')](_0x481811,_0x41aad9,!![]);}catch(_0x4e0b1a){return BPromise[_0x7945('0x34')](_0x4e0b1a);}return _0x481811['save']();};}function saveUpdates(_0x3ada76,_0x5a7eeb){return function(_0x57b2f1){if(_0x57b2f1){return _0x57b2f1[_0x7945('0x35')](_0x3ada76)[_0x7945('0x36')](function(_0x173203){return _0x173203;});}return null;};}function removeEntity(_0x36916e,_0x7e993){return function(_0x3e4b08){if(_0x3e4b08){return _0x3e4b08['destroy']()['then'](function(){_0x36916e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x273558,_0xf6cba6){return function(_0x14b904){if(!_0x14b904){_0x273558[_0x7945('0x29')](0x194);}return _0x14b904;};}function handleError(_0x3337a3,_0x3b8716){_0x3b8716=_0x3b8716||0x1f4;return function(_0x2d8d1c){logger[_0x7945('0x23')](_0x2d8d1c[_0x7945('0x37')]);if(_0x2d8d1c[_0x7945('0x38')]){delete _0x2d8d1c['name'];}_0x3337a3[_0x7945('0x2a')](_0x3b8716)[_0x7945('0x39')](_0x2d8d1c);};}exports[_0x7945('0x3a')]=function(_0xf493a4,_0x16bc32){var _0x1483d8={},_0x13a976={},_0x194fb5={'count':0x0,'rows':[]};var _0x5b60d1=_[_0x7945('0x3b')](db['WhatsappMessage'][_0x7945('0x3c')],function(_0x3feca9){return{'name':_0x3feca9[_0x7945('0x3d')],'type':_0x3feca9[_0x7945('0x3e')][_0x7945('0x3f')]};});_0x13a976[_0x7945('0x40')]=_[_0x7945('0x3b')](_0x5b60d1,'name');_0x13a976[_0x7945('0x41')]=_[_0x7945('0x42')](_0xf493a4[_0x7945('0x41')]);_0x13a976[_0x7945('0x43')]=_[_0x7945('0x44')](_0x13a976[_0x7945('0x40')],_0x13a976[_0x7945('0x41')]);_0x1483d8[_0x7945('0x45')]=_['intersection'](_0x13a976[_0x7945('0x40')],qs['fields'](_0xf493a4[_0x7945('0x41')][_0x7945('0x46')]));_0x1483d8[_0x7945('0x45')]=_0x1483d8['attributes']['length']?_0x1483d8['attributes']:_0x13a976[_0x7945('0x40')];if(!_0xf493a4[_0x7945('0x41')][_0x7945('0x47')](_0x7945('0x48'))){_0x1483d8[_0x7945('0x2f')]=qs[_0x7945('0x2f')](_0xf493a4['query'][_0x7945('0x2f')]);_0x1483d8[_0x7945('0x2d')]=qs[_0x7945('0x2d')](_0xf493a4['query'][_0x7945('0x2d')]);}_0x1483d8[_0x7945('0x49')]=qs[_0x7945('0x4a')](_0xf493a4['query']['sort']);_0x1483d8['where']=qs[_0x7945('0x43')](_['pick'](_0xf493a4[_0x7945('0x41')],_0x13a976[_0x7945('0x43')]),_0x5b60d1);if(_0xf493a4['query'][_0x7945('0x4b')]){_0x1483d8[_0x7945('0x4c')]=_[_0x7945('0x4d')](_0x1483d8['where'],{'$or':_[_0x7945('0x3b')](_0x5b60d1,function(_0x1f5844){if(_0x1f5844[_0x7945('0x3e')]!==_0x7945('0x4e')){var _0x35c8d8={};_0x35c8d8[_0x1f5844[_0x7945('0x38')]]={'$like':'%'+_0xf493a4['query'][_0x7945('0x4b')]+'%'};return _0x35c8d8;}})});}_0x1483d8=_['merge']({},_0x1483d8,_0xf493a4[_0x7945('0x4f')]);var _0x53f61e={'where':_0x1483d8[_0x7945('0x4c')]};return db[_0x7945('0x50')][_0x7945('0x30')](_0x53f61e)[_0x7945('0x36')](function(_0x4b07ce){_0x194fb5[_0x7945('0x30')]=_0x4b07ce;if(_0xf493a4[_0x7945('0x41')][_0x7945('0x51')]){_0x1483d8[_0x7945('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7945('0x53')](_0x1483d8);})[_0x7945('0x36')](function(_0x2d5064){_0x194fb5['rows']=_0x2d5064;return _0x194fb5;})[_0x7945('0x36')](respondWithFilteredResult(_0x16bc32,_0x1483d8))[_0x7945('0x28')](handleError(_0x16bc32,null));};exports[_0x7945('0x54')]=function(_0x21f39d,_0x402ef1){var _0x1cac7e={'raw':!![],'where':{'id':_0x21f39d[_0x7945('0x55')]['id']}},_0x3f2aba={};_0x3f2aba[_0x7945('0x40')]=_[_0x7945('0x42')](db[_0x7945('0x50')][_0x7945('0x3c')]);_0x3f2aba[_0x7945('0x41')]=_[_0x7945('0x42')](_0x21f39d[_0x7945('0x41')]);_0x3f2aba[_0x7945('0x43')]=_['intersection'](_0x3f2aba[_0x7945('0x40')],_0x3f2aba[_0x7945('0x41')]);_0x1cac7e['attributes']=_['intersection'](_0x3f2aba['model'],qs[_0x7945('0x46')](_0x21f39d[_0x7945('0x41')][_0x7945('0x46')]));_0x1cac7e[_0x7945('0x45')]=_0x1cac7e[_0x7945('0x45')][_0x7945('0x56')]?_0x1cac7e[_0x7945('0x45')]:_0x3f2aba[_0x7945('0x40')];if(_0x21f39d['query'][_0x7945('0x51')]){_0x1cac7e[_0x7945('0x52')]=[{'all':!![]}];}_0x1cac7e=_[_0x7945('0x4d')]({},_0x1cac7e,_0x21f39d[_0x7945('0x4f')]);return db['WhatsappMessage'][_0x7945('0x57')](_0x1cac7e)[_0x7945('0x36')](handleEntityNotFound(_0x402ef1,null))[_0x7945('0x36')](respondWithResult(_0x402ef1,null))[_0x7945('0x28')](handleError(_0x402ef1,null));};exports[_0x7945('0x58')]=function(_0x41784c,_0x1eb859){return db[_0x7945('0x50')][_0x7945('0x58')](_0x41784c['body'],{})[_0x7945('0x36')](respondWithResult(_0x1eb859,0xc9))[_0x7945('0x28')](handleError(_0x1eb859,null));};exports['update']=function(_0x57c255,_0x4d051d){if(_0x57c255['body']['id']){delete _0x57c255[_0x7945('0x59')]['id'];}return db[_0x7945('0x50')]['find']({'where':{'id':_0x57c255['params']['id']}})[_0x7945('0x36')](handleEntityNotFound(_0x4d051d,null))[_0x7945('0x36')](saveUpdates(_0x57c255[_0x7945('0x59')],null))[_0x7945('0x36')](respondWithResult(_0x4d051d,null))[_0x7945('0x28')](handleError(_0x4d051d,null));};exports[_0x7945('0x5a')]=function(_0x3a2109,_0x375fbf){return db[_0x7945('0x50')][_0x7945('0x57')]({'where':{'id':_0x3a2109['params']['id']}})[_0x7945('0x36')](handleEntityNotFound(_0x375fbf,null))[_0x7945('0x36')](removeEntity(_0x375fbf,null))['catch'](handleError(_0x375fbf,null));};exports[_0x7945('0x5b')]=function(_0x159d1b,_0x5366e8){return db['WhatsappMessage'][_0x7945('0x5b')]()['then'](respondWithResult(_0x5366e8,null))['catch'](handleError(_0x5366e8,null));};var interaction_log=require('../../config/logger')(_0x7945('0x5c'));exports[_0x7945('0x5d')]=function(_0x5e6611,_0x453820,_0x6b1b94){var _0x7a0200={'agent':{},'channel':'whatsapp'};if(_0x5e6611[_0x7945('0x59')]['id']){delete _0x5e6611[_0x7945('0x59')]['id'];}_0x5e6611['body'][_0x7945('0x5e')]=!![];_0x5e6611['body'][_0x7945('0x5f')]=moment()[_0x7945('0x60')](_0x7945('0x61'));_0x5e6611[_0x7945('0x59')][_0x7945('0x62')]=_0x5e6611[_0x7945('0x59')][_0x7945('0x62')]||_0x5e6611['user']['id'];_0x7a0200[_0x7945('0x63')]['id']=_0x5e6611[_0x7945('0x59')]['UserId'];return db['WhatsappMessage'][_0x7945('0x57')]({'where':{'id':_0x5e6611[_0x7945('0x55')]['id'],'UserId':null}})[_0x7945('0x36')](handleEntityNotFound(_0x453820,null))[_0x7945('0x36')](saveUpdates(_0x5e6611[_0x7945('0x59')],null))['then'](function(_0x32b73b){if(_0x32b73b){_0x7a0200[_0x7945('0x25')]=_0x32b73b[_0x7945('0x64')]({'plain':!![]});return db[_0x7945('0x65')][_0x7945('0x57')]({'where':{'id':_0x32b73b[_0x7945('0x66')]}});}return null;})[_0x7945('0x36')](handleEntityNotFound(_0x453820,null))[_0x7945('0x36')](function(_0x5d48a1){if(_0x5d48a1){return _0x5d48a1[_0x7945('0x35')]({'UserId':_0x5e6611[_0x7945('0x59')]['UserId'],'read1stAt':_[_0x7945('0x67')](_0x5d48a1[_0x7945('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7945('0x36')](function(_0x26dbeb){if(_0x26dbeb){_0x7a0200[_0x7945('0x69')]=_0x26dbeb[_0x7945('0x64')]({'plain':!![]});interaction_log[_0x7945('0x26')](_0x7945('0x6a'),_0x5e6611[_0x7945('0x6b')]['id'],_0x5e6611[_0x7945('0x6b')][_0x7945('0x38')],_0x5e6611[_0x7945('0x6b')]['role'],_0x7a0200[_0x7945('0x69')]['id'],_0x5e6611[_0x7945('0x59')]?JSON[_0x7945('0x22')](_0x5e6611[_0x7945('0x59')]):_0x7945('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x7a0200);}return null;})['then'](function(_0x3a927b){var _0x446893='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a927b[_0x7945('0x25')][_0x7945('0x6d')];return db[_0x7945('0x6e')][_0x7945('0x41')](_0x446893,{'type':db[_0x7945('0x6f')][_0x7945('0x70')][_0x7945('0x71')],'raw':!![]})['then'](function(_0x24add9){return _0x24add9;});})[_0x7945('0x36')](function(_0x299494){if(_0x299494){_0x7a0200[_0x7945('0x25')]['contact']=_0x299494[0x0];if(!_0x5e6611[_0x7945('0x59')][_0x7945('0x62')])return;return db[_0x7945('0x72')][_0x7945('0x57')]({'where':{'id':_0x5e6611[_0x7945('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0x7945('0x38'),_0x7945('0x73'),_0x7945('0x74'),_0x7945('0x75')],'raw':!![]});}return null;})[_0x7945('0x36')](function(_0x2c5233){if(!_0x2c5233)return null;_0x7a0200[_0x7945('0x25')]['agent']=_0x2c5233;return _0x7a0200;})[_0x7945('0x36')](function(_0x4eae41){if(_0x4eae41){if(_0x5e6611[_0x7945('0x59')][_0x7945('0x76')]){_0x7a0200[_0x7945('0x25')]['interface']=util['format'](_0x7945('0x77'),_0x5e6611[_0x7945('0x6b')][_0x7945('0x38')]);_0x7a0200[_0x7945('0x25')]['channel']=_0x7a0200[_0x7945('0x78')];_0x7a0200['message'][_0x7945('0x79')]=_0x7a0200['channel'];_0x7a0200['message']['event']=_0x7945('0x5d');return respondWithRpcPromise('EventManager',_0x7945('0x7a'),{'event':_0x7945('0x7b'),'message':_0x7a0200[_0x7945('0x25')]},client9002)['then'](function(){return _0x7a0200;});}return _0x7a0200;}return null;})[_0x7945('0x36')](respondWithResult(_0x453820,null))['catch'](handleError(_0x453820,null));};var interaction_log=require(_0x7945('0x12'))(_0x7945('0x5c'));exports[_0x7945('0x34')]=function(_0x4f9c35,_0x37d5e8,_0xf54736){var _0x9ac45e={'agent':{},'channel':_0x7945('0x7c')};if(_0x4f9c35[_0x7945('0x59')]['id']){delete _0x4f9c35[_0x7945('0x59')]['id'];}_0x4f9c35['body'][_0x7945('0x62')]=_0x4f9c35[_0x7945('0x59')][_0x7945('0x62')]||_0x4f9c35[_0x7945('0x6b')]['id'];_0x9ac45e[_0x7945('0x63')]['id']=_0x4f9c35[_0x7945('0x59')][_0x7945('0x62')];return db['WhatsappMessage']['find']({'where':{'id':_0x4f9c35['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37d5e8,null))[_0x7945('0x36')](function(_0x8c879d){if(_0x8c879d){_0x9ac45e['message']=_0x8c879d[_0x7945('0x64')]({'plain':!![]});return db[_0x7945('0x65')]['find']({'where':{'id':_0x8c879d[_0x7945('0x66')]}});}return null;})[_0x7945('0x36')](handleEntityNotFound(_0x37d5e8,null))['then'](function(_0x5114db){if(_0x5114db){_0x9ac45e[_0x7945('0x69')]=_0x5114db['get']({'plain':!![]});interaction_log[_0x7945('0x26')](_0x7945('0x7d'),_0x4f9c35[_0x7945('0x6b')]['id'],_0x4f9c35[_0x7945('0x6b')]['name'],_0x4f9c35[_0x7945('0x6b')][_0x7945('0x7e')],_0x9ac45e[_0x7945('0x69')]['id'],_0x4f9c35[_0x7945('0x59')]?JSON['stringify'](_0x4f9c35['body']):'null');return respondWithRpcPromise(_0x7945('0x7f'),_0x7945('0x80'),_0x9ac45e);}return null;})[_0x7945('0x36')](function(_0x57300f){var _0x3a6fd6=_0x7945('0x81')+_0x57300f[_0x7945('0x25')]['ContactId'];return db[_0x7945('0x6e')]['query'](_0x3a6fd6,{'type':db['Sequelize'][_0x7945('0x70')][_0x7945('0x71')],'raw':!![]})[_0x7945('0x36')](function(_0x154491){return _0x154491;});})[_0x7945('0x36')](function(_0xe021a3){if(_0xe021a3){_0x9ac45e[_0x7945('0x25')][_0x7945('0x82')]=_0xe021a3[0x0];if(!_0x4f9c35[_0x7945('0x59')][_0x7945('0x62')])return;return db[_0x7945('0x72')][_0x7945('0x57')]({'where':{'id':_0x4f9c35[_0x7945('0x59')]['UserId'],'role':_0x7945('0x63')},'attributes':['id','name',_0x7945('0x73'),_0x7945('0x74'),_0x7945('0x75')],'raw':!![]});}return null;})['then'](function(_0x37499f){if(!_0x37499f)return null;_0x9ac45e[_0x7945('0x25')][_0x7945('0x63')]=_0x37499f;return _0x9ac45e;})[_0x7945('0x36')](function(_0x189fa7){if(_0x189fa7){_0x189fa7['message'][_0x7945('0x83')]=util['format'](_0x7945('0x77'),_0x4f9c35[_0x7945('0x6b')][_0x7945('0x38')]);_0x189fa7[_0x7945('0x25')][_0x7945('0x78')]=_0x9ac45e[_0x7945('0x78')];_0x189fa7[_0x7945('0x25')]['motionChannel']=_0x9ac45e[_0x7945('0x78')];_0x189fa7[_0x7945('0x25')][_0x7945('0x84')]='reject';respondWithRpcPromise(_0x7945('0x7a'),_0x7945('0x7a'),{'event':'rejectmessage','message':_0x189fa7['message']},client9002);return _0x9ac45e;}return null;})['then'](respondWithResult(_0x37d5e8,null))[_0x7945('0x28')](handleError(_0x37d5e8,null));};exports['status']=function(_0x3d8d55,_0x3ed678,_0xd3d760){if(_0x3d8d55[_0x7945('0x59')]['id']){delete _0x3d8d55['body']['id'];}var _0x28c5ce;return db['WhatsappMessage'][_0x7945('0x57')]({'where':{'id':_0x3d8d55[_0x7945('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ed678,null))[_0x7945('0x36')](function(_0x462de9){if(_0x462de9){_0x28c5ce=_0x462de9;return db[_0x7945('0x85')][_0x7945('0x57')]({'where':{'id':_0x462de9[_0x7945('0x86')]}});}})['then'](handleEntityNotFound(_0x3ed678,null))['then'](function(_0x76c2f5){if(_0x76c2f5){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x7945('0x2a'),'received\x20delivery\x20report\x20from',_0x76c2f5[_0x7945('0x3e')],util['inspect'](_0x3d8d55[_0x7945('0x59')],{'showHidden':![],'depth':null}));switch(_0x76c2f5['type']){case _0x7945('0x87'):if(_0x3d8d55[_0x7945('0x59')]['MessageSid']&&_0x3d8d55['body']['MessageSid']===_0x28c5ce[_0x7945('0x88')]&&_0x3d8d55[_0x7945('0x59')][_0x7945('0x89')]&&_0x3d8d55['body'][_0x7945('0x89')]==='read'){return _0x28c5ce[_0x7945('0x35')]({'read':!![]});}else{logger['error'](_0x7945('0x8a'),_0x7945('0x2a'),_0x7945('0x87'),util[_0x7945('0x8b')](_0x3d8d55['body'],{'showHidden':![],'depth':null}));}break;}return _0x28c5ce;}})[_0x7945('0x36')](respondWithResult(_0x3ed678,null))[_0x7945('0x28')](handleError(_0x3ed678,null));}; \ No newline at end of file +var _0x3a9f=['../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','stack','name','send','index','map','WhatsappMessage','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','keys','merge','options','body','find','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','params','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','WhatsappInteraction','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1c5178,_0xddfd08){var _0x18a294=function(_0x381ff9){while(--_0x381ff9){_0x1c5178['push'](_0x1c5178['shift']());}};_0x18a294(++_0xddfd08);}(_0x3a9f,0x7f));var _0xf3a9=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x3a9f[_0x4cb095];return _0x2b565d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3a9('0x0'));var rp=require(_0xf3a9('0x1'));var moment=require(_0xf3a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf3a9('0x3'));var util=require(_0xf3a9('0x4'));var path=require(_0xf3a9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf3a9('0x6'));var fs=require('fs');var fs_extra=require(_0xf3a9('0x7'));var _=require(_0xf3a9('0x8'));var squel=require(_0xf3a9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3a9('0xa'));var toCsv=require(_0xf3a9('0xb'));var querystring=require(_0xf3a9('0xc'));var Papa=require(_0xf3a9('0xd'));var Redis=require(_0xf3a9('0xe'));var authService=require(_0xf3a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf3a9('0x10'));var hardwareService=require(_0xf3a9('0x11'));var logger=require('../../config/logger')(_0xf3a9('0x12'));var utils=require(_0xf3a9('0x13'));var config=require(_0xf3a9('0x14'));var licenseUtil=require(_0xf3a9('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf3a9('0x16')](config[_0xf3a9('0x17')],{'host':_0xf3a9('0x18'),'port':0x18eb});var socket=require(_0xf3a9('0x19'))(new Redis(config[_0xf3a9('0x17')]));require(_0xf3a9('0x1a'))[_0xf3a9('0x1b')](socket);var jayson=require(_0xf3a9('0x1c'));var client=jayson['client'][_0xf3a9('0x1d')]({'port':0x232c});var client9002=jayson[_0xf3a9('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5b91,_0x118a40,_0xccf43,_0x578c8c){return new BPromise(function(_0x225ace,_0x1994e2){var _0x4f3a23=_0x578c8c||client;return _0x4f3a23[_0xf3a9('0x1f')](_0x2c5b91,_0xccf43)['then'](function(_0x4e06a2){logger[_0xf3a9('0x20')](_0xf3a9('0x21'),_0x118a40,'request\x20sent');logger[_0xf3a9('0x22')](_0xf3a9('0x23'),_0x118a40,_0xf3a9('0x24'),JSON[_0xf3a9('0x25')](_0x4e06a2));if(_0x4e06a2[_0xf3a9('0x26')]){if(_0x4e06a2['error'][_0xf3a9('0x27')]===0x1f4){logger[_0xf3a9('0x26')](_0xf3a9('0x21'),_0x118a40,_0x4e06a2[_0xf3a9('0x26')][_0xf3a9('0x28')]);return _0x1994e2(_0x4e06a2[_0xf3a9('0x26')]['message']);}logger[_0xf3a9('0x26')](_0xf3a9('0x21'),_0x118a40,_0x4e06a2[_0xf3a9('0x26')][_0xf3a9('0x28')]);return _0x225ace(_0x4e06a2['error'][_0xf3a9('0x28')]);}else{logger['info'](_0xf3a9('0x21'),_0x118a40,'request\x20sent');_0x225ace(_0x4e06a2[_0xf3a9('0x29')]['message']);}})[_0xf3a9('0x2a')](function(_0x8bc9a7){logger[_0xf3a9('0x26')](_0xf3a9('0x21'),_0x118a40,_0x8bc9a7);_0x1994e2(_0x8bc9a7);});});}function respondWithStatusCode(_0x47eb09,_0x46710e){_0x46710e=_0x46710e||0xcc;return function(_0x46e4db){if(_0x46e4db){return _0x47eb09[_0xf3a9('0x2b')](_0x46710e);}return _0x47eb09[_0xf3a9('0x2c')](_0x46710e)[_0xf3a9('0x2d')]();};}function respondWithResult(_0x350b49,_0x50da9f){_0x50da9f=_0x50da9f||0xc8;return function(_0x1b8913){if(_0x1b8913){return _0x350b49['status'](_0x50da9f)['json'](_0x1b8913);}};}function respondWithFilteredResult(_0x11de98,_0x44cdd7){return function(_0x44d113){if(_0x44d113){var _0x1838d9=typeof _0x44cdd7[_0xf3a9('0x2e')]===_0xf3a9('0x2f')&&typeof _0x44cdd7['limit']==='undefined';var _0x1da41a=_0x44d113[_0xf3a9('0x30')];var _0x136d56=_0x1838d9?0x0:_0x44cdd7[_0xf3a9('0x2e')];var _0x532b05=_0x1838d9?_0x44d113[_0xf3a9('0x30')]:_0x44cdd7[_0xf3a9('0x2e')]+_0x44cdd7[_0xf3a9('0x31')];var _0xc5b9bd;if(_0x532b05>=_0x1da41a){_0x532b05=_0x1da41a;_0xc5b9bd=0xc8;}else{_0xc5b9bd=0xce;}_0x11de98['status'](_0xc5b9bd);return _0x11de98[_0xf3a9('0x32')]('Content-Range',_0x136d56+'-'+_0x532b05+'/'+_0x1da41a)[_0xf3a9('0x33')](_0x44d113);}return null;};}function patchUpdates(_0x1a9489){return function(_0x35e9c6){try{jsonpatch[_0xf3a9('0x34')](_0x35e9c6,_0x1a9489,!![]);}catch(_0x10cd9d){return BPromise['reject'](_0x10cd9d);}return _0x35e9c6[_0xf3a9('0x35')]();};}function saveUpdates(_0xf2e733,_0x2b5435){return function(_0x205306){if(_0x205306){return _0x205306[_0xf3a9('0x36')](_0xf2e733)[_0xf3a9('0x37')](function(_0x1ec8a6){return _0x1ec8a6;});}return null;};}function removeEntity(_0x359223,_0x34ee62){return function(_0x1a5abc){if(_0x1a5abc){return _0x1a5abc['destroy']()[_0xf3a9('0x37')](function(){_0x359223['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e26d2,_0x112dd3){return function(_0x1f6881){if(!_0x1f6881){_0x4e26d2[_0xf3a9('0x2b')](0x194);}return _0x1f6881;};}function handleError(_0x4c3aa9,_0x7ff5){_0x7ff5=_0x7ff5||0x1f4;return function(_0x119feb){logger[_0xf3a9('0x26')](_0x119feb[_0xf3a9('0x38')]);if(_0x119feb[_0xf3a9('0x39')]){delete _0x119feb['name'];}_0x4c3aa9[_0xf3a9('0x2c')](_0x7ff5)[_0xf3a9('0x3a')](_0x119feb);};}exports[_0xf3a9('0x3b')]=function(_0x1b6b7a,_0x393951){var _0x1d58c7={},_0x18fa88={},_0x223ae3={'count':0x0,'rows':[]};var _0x246e89=_[_0xf3a9('0x3c')](db[_0xf3a9('0x3d')]['rawAttributes'],function(_0x43a875){return{'name':_0x43a875[_0xf3a9('0x3e')],'type':_0x43a875['type'][_0xf3a9('0x3f')]};});_0x18fa88['model']=_[_0xf3a9('0x3c')](_0x246e89,_0xf3a9('0x39'));_0x18fa88[_0xf3a9('0x40')]=_['keys'](_0x1b6b7a[_0xf3a9('0x40')]);_0x18fa88[_0xf3a9('0x41')]=_[_0xf3a9('0x42')](_0x18fa88[_0xf3a9('0x43')],_0x18fa88['query']);_0x1d58c7[_0xf3a9('0x44')]=_[_0xf3a9('0x42')](_0x18fa88[_0xf3a9('0x43')],qs[_0xf3a9('0x45')](_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x45')]));_0x1d58c7['attributes']=_0x1d58c7[_0xf3a9('0x44')][_0xf3a9('0x46')]?_0x1d58c7[_0xf3a9('0x44')]:_0x18fa88[_0xf3a9('0x43')];if(!_0x1b6b7a['query'][_0xf3a9('0x47')](_0xf3a9('0x48'))){_0x1d58c7[_0xf3a9('0x31')]=qs[_0xf3a9('0x31')](_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x31')]);_0x1d58c7[_0xf3a9('0x2e')]=qs[_0xf3a9('0x2e')](_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x2e')]);}_0x1d58c7[_0xf3a9('0x49')]=qs[_0xf3a9('0x4a')](_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x4a')]);_0x1d58c7[_0xf3a9('0x4b')]=qs['filters'](_[_0xf3a9('0x4c')](_0x1b6b7a[_0xf3a9('0x40')],_0x18fa88[_0xf3a9('0x41')]),_0x246e89);if(_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x4d')]){_0x1d58c7[_0xf3a9('0x4b')]=_['merge'](_0x1d58c7[_0xf3a9('0x4b')],{'$or':_[_0xf3a9('0x3c')](_0x246e89,function(_0x3e8424){if(_0x3e8424[_0xf3a9('0x4e')]!==_0xf3a9('0x4f')){var _0x5b9ffd={};_0x5b9ffd[_0x3e8424[_0xf3a9('0x39')]]={'$like':'%'+_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x4d')]+'%'};return _0x5b9ffd;}})});}_0x1d58c7=_['merge']({},_0x1d58c7,_0x1b6b7a['options']);var _0x379eff={'where':_0x1d58c7[_0xf3a9('0x4b')]};return db[_0xf3a9('0x3d')]['count'](_0x379eff)['then'](function(_0x3e6deb){_0x223ae3['count']=_0x3e6deb;if(_0x1b6b7a[_0xf3a9('0x40')][_0xf3a9('0x50')]){_0x1d58c7[_0xf3a9('0x51')]=[{'all':!![]}];}return db[_0xf3a9('0x3d')][_0xf3a9('0x52')](_0x1d58c7);})['then'](function(_0x3dce9c){_0x223ae3[_0xf3a9('0x53')]=_0x3dce9c;return _0x223ae3;})[_0xf3a9('0x37')](respondWithFilteredResult(_0x393951,_0x1d58c7))[_0xf3a9('0x2a')](handleError(_0x393951,null));};exports[_0xf3a9('0x54')]=function(_0x2b42b6,_0x13e313){var _0x10b3ca={'raw':!![],'where':{'id':_0x2b42b6['params']['id']}},_0x46392d={};_0x46392d[_0xf3a9('0x43')]=_['keys'](db[_0xf3a9('0x3d')][_0xf3a9('0x55')]);_0x46392d[_0xf3a9('0x40')]=_[_0xf3a9('0x56')](_0x2b42b6[_0xf3a9('0x40')]);_0x46392d[_0xf3a9('0x41')]=_[_0xf3a9('0x42')](_0x46392d[_0xf3a9('0x43')],_0x46392d[_0xf3a9('0x40')]);_0x10b3ca[_0xf3a9('0x44')]=_[_0xf3a9('0x42')](_0x46392d[_0xf3a9('0x43')],qs['fields'](_0x2b42b6[_0xf3a9('0x40')][_0xf3a9('0x45')]));_0x10b3ca[_0xf3a9('0x44')]=_0x10b3ca[_0xf3a9('0x44')][_0xf3a9('0x46')]?_0x10b3ca[_0xf3a9('0x44')]:_0x46392d['model'];if(_0x2b42b6['query'][_0xf3a9('0x50')]){_0x10b3ca['include']=[{'all':!![]}];}_0x10b3ca=_[_0xf3a9('0x57')]({},_0x10b3ca,_0x2b42b6[_0xf3a9('0x58')]);return db['WhatsappMessage']['find'](_0x10b3ca)[_0xf3a9('0x37')](handleEntityNotFound(_0x13e313,null))[_0xf3a9('0x37')](respondWithResult(_0x13e313,null))[_0xf3a9('0x2a')](handleError(_0x13e313,null));};exports['create']=function(_0xfec3ac,_0x366915){return db[_0xf3a9('0x3d')]['create'](_0xfec3ac[_0xf3a9('0x59')],{})[_0xf3a9('0x37')](respondWithResult(_0x366915,0xc9))[_0xf3a9('0x2a')](handleError(_0x366915,null));};exports[_0xf3a9('0x36')]=function(_0x5a5488,_0x3446b2){if(_0x5a5488[_0xf3a9('0x59')]['id']){delete _0x5a5488[_0xf3a9('0x59')]['id'];}return db[_0xf3a9('0x3d')][_0xf3a9('0x5a')]({'where':{'id':_0x5a5488['params']['id']}})[_0xf3a9('0x37')](handleEntityNotFound(_0x3446b2,null))[_0xf3a9('0x37')](saveUpdates(_0x5a5488[_0xf3a9('0x59')],null))[_0xf3a9('0x37')](respondWithResult(_0x3446b2,null))[_0xf3a9('0x2a')](handleError(_0x3446b2,null));};exports[_0xf3a9('0x5b')]=function(_0xc91d23,_0xdc6f1a){return db['WhatsappMessage']['find']({'where':{'id':_0xc91d23['params']['id']}})[_0xf3a9('0x37')](handleEntityNotFound(_0xdc6f1a,null))[_0xf3a9('0x37')](removeEntity(_0xdc6f1a,null))[_0xf3a9('0x2a')](handleError(_0xdc6f1a,null));};exports[_0xf3a9('0x5c')]=function(_0x36de7f,_0x420cca){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x420cca,null))['catch'](handleError(_0x420cca,null));};var interaction_log=require(_0xf3a9('0x5d'))(_0xf3a9('0x5e'));exports[_0xf3a9('0x5f')]=function(_0xee4922,_0x45c410,_0x259b14){var _0x531d5e={'agent':{},'channel':_0xf3a9('0x60')};if(_0xee4922[_0xf3a9('0x59')]['id']){delete _0xee4922[_0xf3a9('0x59')]['id'];}_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x61')]=!![];_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x62')]=moment()['format'](_0xf3a9('0x63'));_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x64')]=_0xee4922['body'][_0xf3a9('0x64')]||_0xee4922[_0xf3a9('0x65')]['id'];_0x531d5e[_0xf3a9('0x66')]['id']=_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x64')];return db[_0xf3a9('0x3d')][_0xf3a9('0x5a')]({'where':{'id':_0xee4922[_0xf3a9('0x67')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45c410,null))['then'](saveUpdates(_0xee4922[_0xf3a9('0x59')],null))[_0xf3a9('0x37')](function(_0x35fd2c){if(_0x35fd2c){_0x531d5e[_0xf3a9('0x28')]=_0x35fd2c['get']({'plain':!![]});return db['WhatsappInteraction'][_0xf3a9('0x5a')]({'where':{'id':_0x35fd2c[_0xf3a9('0x68')]}});}return null;})[_0xf3a9('0x37')](handleEntityNotFound(_0x45c410,null))[_0xf3a9('0x37')](function(_0x2b0276){if(_0x2b0276){return _0x2b0276[_0xf3a9('0x36')]({'UserId':_0xee4922['body'][_0xf3a9('0x64')],'read1stAt':_[_0xf3a9('0x69')](_0x2b0276[_0xf3a9('0x6a')])?moment()[_0xf3a9('0x6b')](_0xf3a9('0x63')):undefined});}return null;})['then'](function(_0x1cc5c8){if(_0x1cc5c8){_0x531d5e[_0xf3a9('0x6c')]=_0x1cc5c8['get']({'plain':!![]});interaction_log[_0xf3a9('0x20')](_0xf3a9('0x6d'),_0xee4922[_0xf3a9('0x65')]['id'],_0xee4922[_0xf3a9('0x65')][_0xf3a9('0x39')],_0xee4922[_0xf3a9('0x65')]['role'],_0x531d5e[_0xf3a9('0x6c')]['id'],_0xee4922[_0xf3a9('0x59')]?JSON[_0xf3a9('0x25')](_0xee4922[_0xf3a9('0x59')]):_0xf3a9('0x6e'));return respondWithRpcPromise(_0xf3a9('0x6f'),_0xf3a9('0x70'),_0x531d5e);}return null;})['then'](function(_0x556488){var _0x6c535a=_0xf3a9('0x71')+_0x556488[_0xf3a9('0x28')][_0xf3a9('0x72')];return db['sequelize'][_0xf3a9('0x40')](_0x6c535a,{'type':db[_0xf3a9('0x73')]['QueryTypes'][_0xf3a9('0x74')],'raw':!![]})[_0xf3a9('0x37')](function(_0x39e677){return _0x39e677;});})[_0xf3a9('0x37')](function(_0x6e966f){if(_0x6e966f){_0x531d5e[_0xf3a9('0x28')][_0xf3a9('0x75')]=_0x6e966f[0x0];if(!_0xee4922[_0xf3a9('0x59')]['UserId'])return;return db[_0xf3a9('0x76')][_0xf3a9('0x5a')]({'where':{'id':_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x64')],'role':_0xf3a9('0x66')},'attributes':['id',_0xf3a9('0x39'),_0xf3a9('0x77'),_0xf3a9('0x78'),'internal'],'raw':!![]});}return null;})[_0xf3a9('0x37')](function(_0x406765){if(!_0x406765)return null;_0x531d5e[_0xf3a9('0x28')][_0xf3a9('0x66')]=_0x406765;return _0x531d5e;})[_0xf3a9('0x37')](function(_0x437a2d){if(_0x437a2d){if(_0xee4922[_0xf3a9('0x59')][_0xf3a9('0x79')]){_0x531d5e[_0xf3a9('0x28')][_0xf3a9('0x7a')]=util[_0xf3a9('0x6b')](_0xf3a9('0x7b'),_0xee4922['user'][_0xf3a9('0x39')]);_0x531d5e['message'][_0xf3a9('0x7c')]=_0x531d5e[_0xf3a9('0x7c')];_0x531d5e['message'][_0xf3a9('0x7d')]=_0x531d5e[_0xf3a9('0x7c')];_0x531d5e[_0xf3a9('0x28')][_0xf3a9('0x7e')]='accept';return respondWithRpcPromise(_0xf3a9('0x7f'),'EventManager',{'event':'acceptmessage','message':_0x531d5e[_0xf3a9('0x28')]},client9002)['then'](function(){return _0x531d5e;});}return _0x531d5e;}return null;})[_0xf3a9('0x37')](respondWithResult(_0x45c410,null))[_0xf3a9('0x2a')](handleError(_0x45c410,null));};var interaction_log=require(_0xf3a9('0x5d'))('whatsapp-interactions');exports[_0xf3a9('0x80')]=function(_0x1a741b,_0x429169,_0xcf4ccd){var _0x58f6cc={'agent':{},'channel':_0xf3a9('0x60')};if(_0x1a741b[_0xf3a9('0x59')]['id']){delete _0x1a741b[_0xf3a9('0x59')]['id'];}_0x1a741b['body'][_0xf3a9('0x64')]=_0x1a741b[_0xf3a9('0x59')][_0xf3a9('0x64')]||_0x1a741b['user']['id'];_0x58f6cc['agent']['id']=_0x1a741b['body'][_0xf3a9('0x64')];return db[_0xf3a9('0x3d')][_0xf3a9('0x5a')]({'where':{'id':_0x1a741b['params']['id'],'UserId':null}})[_0xf3a9('0x37')](handleEntityNotFound(_0x429169,null))[_0xf3a9('0x37')](function(_0x1a8ce8){if(_0x1a8ce8){_0x58f6cc[_0xf3a9('0x28')]=_0x1a8ce8['get']({'plain':!![]});return db[_0xf3a9('0x81')][_0xf3a9('0x5a')]({'where':{'id':_0x1a8ce8['WhatsappInteractionId']}});}return null;})[_0xf3a9('0x37')](handleEntityNotFound(_0x429169,null))[_0xf3a9('0x37')](function(_0xcd85ef){if(_0xcd85ef){_0x58f6cc[_0xf3a9('0x6c')]=_0xcd85ef[_0xf3a9('0x82')]({'plain':!![]});interaction_log['info'](_0xf3a9('0x83'),_0x1a741b[_0xf3a9('0x65')]['id'],_0x1a741b[_0xf3a9('0x65')]['name'],_0x1a741b[_0xf3a9('0x65')][_0xf3a9('0x84')],_0x58f6cc['interaction']['id'],_0x1a741b[_0xf3a9('0x59')]?JSON[_0xf3a9('0x25')](_0x1a741b[_0xf3a9('0x59')]):_0xf3a9('0x6e'));return respondWithRpcPromise(_0xf3a9('0x85'),_0xf3a9('0x86'),_0x58f6cc);}return null;})['then'](function(_0x239844){var _0x5ca3a7=_0xf3a9('0x71')+_0x239844[_0xf3a9('0x28')][_0xf3a9('0x72')];return db[_0xf3a9('0x87')][_0xf3a9('0x40')](_0x5ca3a7,{'type':db[_0xf3a9('0x73')]['QueryTypes'][_0xf3a9('0x74')],'raw':!![]})[_0xf3a9('0x37')](function(_0x2381ae){return _0x2381ae;});})[_0xf3a9('0x37')](function(_0x41887c){if(_0x41887c){_0x58f6cc[_0xf3a9('0x28')][_0xf3a9('0x75')]=_0x41887c[0x0];if(!_0x1a741b['body'][_0xf3a9('0x64')])return;return db[_0xf3a9('0x76')][_0xf3a9('0x5a')]({'where':{'id':_0x1a741b[_0xf3a9('0x59')][_0xf3a9('0x64')],'role':'agent'},'attributes':['id',_0xf3a9('0x39'),_0xf3a9('0x77'),_0xf3a9('0x78'),_0xf3a9('0x88')],'raw':!![]});}return null;})[_0xf3a9('0x37')](function(_0x401c9b){if(!_0x401c9b)return null;_0x58f6cc['message'][_0xf3a9('0x66')]=_0x401c9b;return _0x58f6cc;})[_0xf3a9('0x37')](function(_0x542742){if(_0x542742){_0x542742[_0xf3a9('0x28')][_0xf3a9('0x7a')]=util['format'](_0xf3a9('0x7b'),_0x1a741b[_0xf3a9('0x65')][_0xf3a9('0x39')]);_0x542742['message'][_0xf3a9('0x7c')]=_0x58f6cc['channel'];_0x542742[_0xf3a9('0x28')][_0xf3a9('0x7d')]=_0x58f6cc[_0xf3a9('0x7c')];_0x542742[_0xf3a9('0x28')][_0xf3a9('0x7e')]=_0xf3a9('0x80');respondWithRpcPromise(_0xf3a9('0x7f'),_0xf3a9('0x7f'),{'event':'rejectmessage','message':_0x542742[_0xf3a9('0x28')]},client9002);return _0x58f6cc;}return null;})[_0xf3a9('0x37')](respondWithResult(_0x429169,null))[_0xf3a9('0x2a')](handleError(_0x429169,null));};exports[_0xf3a9('0x2c')]=function(_0xd4afd4,_0x30123e,_0x2ee692){if(_0xd4afd4[_0xf3a9('0x59')]['id']){delete _0xd4afd4[_0xf3a9('0x59')]['id'];}var _0x4a505c;return db[_0xf3a9('0x3d')][_0xf3a9('0x5a')]({'where':{'id':_0xd4afd4['params']['id']}})['then'](handleEntityNotFound(_0x30123e,null))[_0xf3a9('0x37')](function(_0x380b75){if(_0x380b75){_0x4a505c=_0x380b75;return db[_0xf3a9('0x89')]['find']({'where':{'id':_0x380b75[_0xf3a9('0x8a')]}});}})[_0xf3a9('0x37')](handleEntityNotFound(_0x30123e,null))['then'](function(_0x2b566c){if(_0x2b566c){logger[_0xf3a9('0x22')](_0xf3a9('0x8b'),_0xf3a9('0x2c'),'received\x20delivery\x20report\x20from',_0x2b566c[_0xf3a9('0x4e')],util[_0xf3a9('0x8c')](_0xd4afd4[_0xf3a9('0x59')],{'showHidden':![],'depth':null}));switch(_0x2b566c['type']){case _0xf3a9('0x8d'):if(_0xd4afd4['body'][_0xf3a9('0x8e')]&&_0xd4afd4[_0xf3a9('0x59')][_0xf3a9('0x8e')]===_0x4a505c[_0xf3a9('0x8f')]&&_0xd4afd4[_0xf3a9('0x59')][_0xf3a9('0x90')]&&_0xd4afd4[_0xf3a9('0x59')][_0xf3a9('0x90')]==='read'){return _0x4a505c[_0xf3a9('0x36')]({'read':!![]});}else{logger[_0xf3a9('0x26')](_0xf3a9('0x91'),_0xf3a9('0x2c'),_0xf3a9('0x8d'),util[_0xf3a9('0x8c')](_0xd4afd4['body'],{'showHidden':![],'depth':null}));}break;}return _0x4a505c;}})['then'](respondWithResult(_0x30123e,null))[_0xf3a9('0x2a')](handleError(_0x30123e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e0e311f..8038d57 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 _0xb921=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xb921,0x16a));var _0x1b92=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xb921[_0x2cc8bb];return _0x140e40;};'use strict';var EventEmitter=require(_0x1b92('0x0'));var WhatsappMessage=require(_0x1b92('0x1'))['db'][_0x1b92('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1b92('0x3')](0x0);var events={'afterCreate':_0x1b92('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x389da0){return function(_0xc3832e,_0x1e49a8,_0x10868d){WhatsappMessageEvents[_0x1b92('0x5')](_0x389da0+':'+_0xc3832e['id'],_0xc3832e);WhatsappMessageEvents[_0x1b92('0x5')](_0x389da0,_0xc3832e);_0x10868d(null);};}for(var e in events){if(events[_0x1b92('0x6')](e)){var event=events[e];WhatsappMessage[_0x1b92('0x7')](e,emitEvent(event));}}module[_0x1b92('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x282b=['save','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x557d75,_0x30edac){var _0x46197b=function(_0x315468){while(--_0x315468){_0x557d75['push'](_0x557d75['shift']());}};_0x46197b(++_0x30edac);}(_0x282b,0xec));var _0xb282=function(_0x16f0c2,_0xe415a7){_0x16f0c2=_0x16f0c2-0x0;var _0x1c82e6=_0x282b[_0x16f0c2];return _0x1c82e6;};'use strict';var EventEmitter=require(_0xb282('0x0'));var WhatsappMessage=require(_0xb282('0x1'))['db'][_0xb282('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb282('0x3')](0x0);var events={'afterCreate':_0xb282('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25d77d){return function(_0x5cadd7,_0x3fbbaf,_0x175c83){WhatsappMessageEvents[_0xb282('0x5')](_0x25d77d+':'+_0x5cadd7['id'],_0x5cadd7);WhatsappMessageEvents[_0xb282('0x5')](_0x25d77d,_0x5cadd7);_0x175c83(null);};}for(var e in events){if(events[_0xb282('0x6')](e)){var event=events[e];WhatsappMessage[_0xb282('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c6ac5d6..48787c7 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 _0x6a6b=['whatsapp_messages','messageId','fti_whatsapp_messages','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x6a6b,0x165));var _0xb6a6=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6a6b[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xb6a6('0x0'));var util=require(_0xb6a6('0x1'));var logger=require(_0xb6a6('0x2'))(_0xb6a6('0x3'));var moment=require(_0xb6a6('0x4'));var BPromise=require(_0xb6a6('0x5'));var rp=require(_0xb6a6('0x6'));var fetch=require(_0xb6a6('0x7'));var fs=require('fs');var path=require(_0xb6a6('0x8'));var rimraf=require(_0xb6a6('0x9'));var config=require(_0xb6a6('0xa'));var attributes=require(_0xb6a6('0xb'));module[_0xb6a6('0xc')]=function(_0x12b562,_0xf3045b){return _0x12b562[_0xb6a6('0xd')](_0xb6a6('0xe'),attributes,{'tableName':_0xb6a6('0xf'),'paranoid':![],'indexes':[{'name':_0xb6a6('0x10'),'fields':[_0xb6a6('0x10')]},{'name':_0xb6a6('0x11'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x422861,_0x110465,_0xbe90e3){var _0x20ba40=_0x12b562['models'];var _0x1fbbe8=_0x422861['get']({'plain':!![]});if(_0x1fbbe8[_0xb6a6('0x12')]['toLowerCase']()==='in'||_0x1fbbe8[_0xb6a6('0x12')][_0xb6a6('0x13')]()===_0xb6a6('0x14')&&!_0x1fbbe8['secret']&&!_[_0xb6a6('0x15')](_0x1fbbe8[_0xb6a6('0x16')])){_0x20ba40[_0xb6a6('0x17')][_0xb6a6('0x18')]({'where':{'id':_0x1fbbe8[_0xb6a6('0x19')]}})[_0xb6a6('0x1a')](function(_0x96e323){if(_0x96e323){_0x96e323['update']({'lastMsgAt':_0x1fbbe8[_0xb6a6('0x1b')],'lastMsgDirection':_0x1fbbe8[_0xb6a6('0x12')][_0xb6a6('0x13')]()});}})[_0xb6a6('0x1c')](function(_0xc67af){console[_0xb6a6('0x1d')](_0xc67af);});}if(_0x1fbbe8['direction']===_0xb6a6('0x14')&&!_0x1fbbe8[_0xb6a6('0x1e')]){var _0x5adb76;_0x20ba40[_0xb6a6('0x1f')][_0xb6a6('0x20')]({'where':{'id':_0x1fbbe8[_0xb6a6('0x21')]},'raw':!![]})[_0xb6a6('0x1a')](function(_0x2f02ff){_0x5adb76=_0x2f02ff;if(_0x5adb76&&_0x5adb76[_0xb6a6('0x22')]){switch(_0x5adb76['type']){case _0xb6a6('0x23'):var _0x3021b1=require(_0xb6a6('0x23'));if(_0x5adb76[_0xb6a6('0x24')]&&_0x5adb76[_0xb6a6('0x25')]&&_0x5adb76['phone']){var _0x416880=new _0x3021b1(_0x5adb76[_0xb6a6('0x24')],_0x5adb76[_0xb6a6('0x25')]);_0x416880[_0xb6a6('0x26')]['create']({'body':_0x1fbbe8['body'],'to':_0xb6a6('0x27')+_0x1fbbe8[_0xb6a6('0x28')],'from':_0xb6a6('0x27')+_0x5adb76[_0xb6a6('0x28')],'statusCallback':_0x5adb76['remote']+_0xb6a6('0x29')+_0x1fbbe8['id']+_0xb6a6('0x2a')+_0x5adb76[_0xb6a6('0x2b')]})[_0xb6a6('0x1a')](function(_0x57bf44){if(_0x57bf44['sid']){return _0x422861[_0xb6a6('0x2c')]({'messageId':_0x57bf44[_0xb6a6('0x2d')]});}})[_0xb6a6('0x1c')](function(_0x727711){logger['error'](_0xb6a6('0x2e'),'afterCreate',_0xb6a6('0x23'),util['inspect'](_0x727711,{'showHidden':![],'depth':null}));});}else{logger[_0xb6a6('0x1d')](_0xb6a6('0x2e'),'afterCreate',_0xb6a6('0x23'),_0xb6a6('0x2f'));}break;case _0xb6a6('0x30'):var _0x79fe09=_0x5adb76[_0xb6a6('0x24')];var _0x11bcd9=_0x5adb76[_0xb6a6('0x25')];var _0x336460=_0x5adb76[_0xb6a6('0x31')]+_0xb6a6('0x32')+_0x79fe09+_0xb6a6('0x33');var _0x5941e1={'to':[_0x1fbbe8[_0xb6a6('0x28')]],'message':{'type':_0xb6a6('0x34'),'text':_0x1fbbe8['body']}};var _0x20cc2a={'method':_0xb6a6('0x35'),'uri':_0x336460,'headers':{'Authorization':_0xb6a6('0x36')+_0x11bcd9,'Content-Type':_0xb6a6('0x37')},'body':_0x5941e1,'json':!![]};rp(_0x20cc2a)[_0xb6a6('0x1a')](function(_0x1106cb){if(_0x1106cb[_0xb6a6('0x38')][0x0]['message_id']){return _0x422861[_0xb6a6('0x2c')]({'messageId':_0x1106cb[_0xb6a6('0x38')][0x0][_0xb6a6('0x39')]});}})[_0xb6a6('0x1c')](function(_0x5d4ac3){logger[_0xb6a6('0x3a')]('WhatsappMessage,\x20%s',_0x5d4ac3);});break;}}})[_0xb6a6('0x3b')](function(){_0xbe90e3();});}else{_0xbe90e3();}}},'charset':_0xb6a6('0x3c'),'collate':_0xb6a6('0x3d')});}; \ No newline at end of file +var _0x1903=['update','createdAt','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','create','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','../../config/environment','exports','whatsapp_messages','messageId','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','then'];(function(_0x598236,_0x402c54){var _0x1dced2=function(_0x498950){while(--_0x498950){_0x598236['push'](_0x598236['shift']());}};_0x1dced2(++_0x402c54);}(_0x1903,0x16c));var _0x3190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1903[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3190('0x0'));var logger=require(_0x3190('0x1'))(_0x3190('0x2'));var moment=require('moment');var BPromise=require(_0x3190('0x3'));var rp=require(_0x3190('0x4'));var fetch=require(_0x3190('0x5'));var fs=require('fs');var path=require(_0x3190('0x6'));var rimraf=require('rimraf');var config=require(_0x3190('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x3190('0x8')]=function(_0x3ef394,_0x128be8){return _0x3ef394['define']('WhatsappMessage',attributes,{'tableName':_0x3190('0x9'),'paranoid':![],'indexes':[{'name':_0x3190('0xa'),'fields':[_0x3190('0xa')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x3190('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25bdca,_0x197152,_0x2d3a5a){var _0x449ea0=_0x3ef394[_0x3190('0xc')];var _0x4f3b10=_0x25bdca[_0x3190('0xd')]({'plain':!![]});if(_0x4f3b10[_0x3190('0xe')][_0x3190('0xf')]()==='in'||_0x4f3b10[_0x3190('0xe')]['toLowerCase']()===_0x3190('0x10')&&!_0x4f3b10[_0x3190('0x11')]&&!_[_0x3190('0x12')](_0x4f3b10['UserId'])){_0x449ea0[_0x3190('0x13')]['findOne']({'where':{'id':_0x4f3b10['WhatsappInteractionId']}})[_0x3190('0x14')](function(_0x182a74){if(_0x182a74){_0x182a74[_0x3190('0x15')]({'lastMsgAt':_0x4f3b10[_0x3190('0x16')],'lastMsgDirection':_0x4f3b10[_0x3190('0xe')][_0x3190('0xf')]()});}})['catch'](function(_0xe89a8b){console[_0x3190('0x17')](_0xe89a8b);});}if(_0x4f3b10[_0x3190('0xe')]===_0x3190('0x10')&&!_0x4f3b10[_0x3190('0x11')]){var _0x341969;_0x449ea0[_0x3190('0x18')][_0x3190('0x19')]({'where':{'id':_0x4f3b10['WhatsappAccountId']},'raw':!![]})[_0x3190('0x14')](function(_0x3985d6){_0x341969=_0x3985d6;if(_0x341969&&_0x341969[_0x3190('0x1a')]){switch(_0x341969[_0x3190('0x1a')]){case _0x3190('0x1b'):var _0x171889=require(_0x3190('0x1b'));if(_0x341969[_0x3190('0x1c')]&&_0x341969[_0x3190('0x1d')]&&_0x341969[_0x3190('0x1e')]){var _0x55aa1b=new _0x171889(_0x341969['accountSid'],_0x341969[_0x3190('0x1d')]);_0x55aa1b['messages'][_0x3190('0x1f')]({'body':_0x4f3b10['body'],'to':'whatsapp:'+_0x4f3b10[_0x3190('0x1e')],'from':'whatsapp:'+_0x341969[_0x3190('0x1e')],'statusCallback':_0x341969['remote']+_0x3190('0x20')+_0x4f3b10['id']+_0x3190('0x21')+_0x341969[_0x3190('0x22')]})[_0x3190('0x14')](function(_0x5695c3){if(_0x5695c3['sid']){return _0x25bdca[_0x3190('0x15')]({'messageId':_0x5695c3[_0x3190('0x23')]});}})[_0x3190('0x24')](function(_0x4005b3){logger[_0x3190('0x17')](_0x3190('0x25'),_0x3190('0x26'),_0x3190('0x1b'),util[_0x3190('0x27')](_0x4005b3,{'showHidden':![],'depth':null}));});}else{logger[_0x3190('0x17')](_0x3190('0x25'),_0x3190('0x26'),_0x3190('0x1b'),_0x3190('0x28'));}break;case _0x3190('0x29'):var _0x99444c=_0x341969['accountSid'];var _0x1f5e56=_0x341969['authToken'];var _0x31454c=_0x341969[_0x3190('0x2a')]+_0x3190('0x2b')+_0x99444c+_0x3190('0x2c');var _0x12402d={'to':[_0x4f3b10[_0x3190('0x1e')]],'message':{'type':_0x3190('0x2d'),'text':_0x4f3b10[_0x3190('0x2e')]}};var _0x4f74cf={'method':_0x3190('0x2f'),'uri':_0x31454c,'headers':{'Authorization':_0x3190('0x30')+_0x1f5e56,'Content-Type':_0x3190('0x31')},'body':_0x12402d,'json':!![]};rp(_0x4f74cf)[_0x3190('0x14')](function(_0x1614ad){if(_0x1614ad[_0x3190('0x32')][0x0][_0x3190('0x33')]){return _0x25bdca[_0x3190('0x15')]({'messageId':_0x1614ad[_0x3190('0x32')][0x0][_0x3190('0x33')]});}})[_0x3190('0x24')](function(_0x1484b0){logger['err'](_0x3190('0x34'),_0x1484b0);});break;}}})[_0x3190('0x35')](function(){_0x2d3a5a();});}else{_0x2d3a5a();}}},'charset':_0x3190('0x36'),'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 ee78873..e00d787 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 _0x9f7e=['options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body'];(function(_0x5b1b07,_0x119df6){var _0x59fbbc=function(_0xc8f58a){while(--_0xc8f58a){_0x5b1b07['push'](_0x5b1b07['shift']());}};_0x59fbbc(++_0x119df6);}(_0x9f7e,0x138));var _0xe9f7=function(_0x3898cf,_0x50dde3){_0x3898cf=_0x3898cf-0x0;var _0x3f6e4b=_0x9f7e[_0x3898cf];return _0x3f6e4b;};'use strict';var _=require(_0xe9f7('0x0'));var util=require(_0xe9f7('0x1'));var moment=require(_0xe9f7('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9f7('0x3'));var fs=require('fs');var Redis=require(_0xe9f7('0x4'));var db=require(_0xe9f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9f7('0x6'));var config=require(_0xe9f7('0x7'));var jayson=require(_0xe9f7('0x8'));var client=jayson[_0xe9f7('0x9')]['http']({'port':0x232a});config[_0xe9f7('0xa')]=_['defaults'](config[_0xe9f7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe9f7('0xb'))[_0xe9f7('0xc')](socket);function respondWithRpcPromise(_0x5bab83,_0x5396c1,_0x3f5160){return new BPromise(function(_0x2d8215,_0x44c4cb){return client[_0xe9f7('0xd')](_0x5bab83,_0x3f5160)[_0xe9f7('0xe')](function(_0x65d06e){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5396c1,_0xe9f7('0xf'));logger['debug'](_0xe9f7('0x10'),_0x5396c1,_0xe9f7('0xf'),JSON[_0xe9f7('0x11')](_0x65d06e));if(_0x65d06e[_0xe9f7('0x12')]){if(_0x65d06e[_0xe9f7('0x12')][_0xe9f7('0x13')]===0x1f4){logger[_0xe9f7('0x12')](_0xe9f7('0x14'),_0x5396c1,_0x65d06e['error'][_0xe9f7('0x15')]);return _0x44c4cb(_0x65d06e[_0xe9f7('0x12')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5396c1,_0x65d06e[_0xe9f7('0x12')][_0xe9f7('0x15')]);return _0x2d8215(_0x65d06e[_0xe9f7('0x12')]['message']);}else{logger[_0xe9f7('0x16')](_0xe9f7('0x14'),_0x5396c1,_0xe9f7('0xf'));_0x2d8215(_0x65d06e[_0xe9f7('0x17')][_0xe9f7('0x15')]);}})[_0xe9f7('0x18')](function(_0x49c59c){logger[_0xe9f7('0x12')](_0xe9f7('0x14'),_0x5396c1,_0x49c59c);_0x44c4cb(_0x49c59c);});});}exports[_0xe9f7('0x19')]=function(_0xc0adb7){var _0x18e38d=this;return new Promise(function(_0x5db7dc,_0x2b86b6){return db[_0xe9f7('0x1a')][_0xe9f7('0x1b')](_0xc0adb7[_0xe9f7('0x1c')],{'raw':_0xc0adb7[_0xe9f7('0x1d')]?_0xc0adb7[_0xe9f7('0x1d')][_0xe9f7('0x1e')]===undefined?!![]:![]:!![]})[_0xe9f7('0xe')](function(_0x238376){logger[_0xe9f7('0x16')](_0xe9f7('0x19'),_0xc0adb7);logger['debug']('CreateWhatsappMessage',_0xc0adb7,JSON['stringify'](_0x238376));_0x5db7dc(_0x238376);})[_0xe9f7('0x18')](function(_0xb4e4c2){logger[_0xe9f7('0x12')](_0xe9f7('0x19'),_0xb4e4c2[_0xe9f7('0x15')],_0xc0adb7);_0x2b86b6(_0x18e38d[_0xe9f7('0x12')](0x1f4,_0xb4e4c2[_0xe9f7('0x15')]));});});}; \ No newline at end of file +var _0x11c4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','debug'];(function(_0x1bafee,_0x500a67){var _0x1ec0c5=function(_0x33fc10){while(--_0x33fc10){_0x1bafee['push'](_0x1bafee['shift']());}};_0x1ec0c5(++_0x500a67);}(_0x11c4,0x118));var _0x411c=function(_0x28a7da,_0x26e02c){_0x28a7da=_0x28a7da-0x0;var _0x50a4ee=_0x11c4[_0x28a7da];return _0x50a4ee;};'use strict';var _=require(_0x411c('0x0'));var util=require(_0x411c('0x1'));var moment=require('moment');var BPromise=require(_0x411c('0x2'));var rs=require(_0x411c('0x3'));var fs=require('fs');var Redis=require(_0x411c('0x4'));var db=require(_0x411c('0x5'))['db'];var utils=require(_0x411c('0x6'));var logger=require(_0x411c('0x7'))(_0x411c('0x8'));var config=require(_0x411c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x411c('0xa')][_0x411c('0xb')]({'port':0x232a});config[_0x411c('0xc')]=_[_0x411c('0xd')](config[_0x411c('0xc')],{'host':_0x411c('0xe'),'port':0x18eb});var socket=require(_0x411c('0xf'))(new Redis(config['redis']));require(_0x411c('0x10'))[_0x411c('0x11')](socket);function respondWithRpcPromise(_0x1df3bc,_0x59056a,_0x4304ac){return new BPromise(function(_0x4d680e,_0x2efe39){return client['request'](_0x1df3bc,_0x4304ac)[_0x411c('0x12')](function(_0x78db96){logger[_0x411c('0x13')](_0x411c('0x14'),_0x59056a,'request\x20sent');logger['debug'](_0x411c('0x15'),_0x59056a,_0x411c('0x16'),JSON[_0x411c('0x17')](_0x78db96));if(_0x78db96[_0x411c('0x18')]){if(_0x78db96[_0x411c('0x18')][_0x411c('0x19')]===0x1f4){logger[_0x411c('0x18')](_0x411c('0x14'),_0x59056a,_0x78db96['error'][_0x411c('0x1a')]);return _0x2efe39(_0x78db96[_0x411c('0x18')][_0x411c('0x1a')]);}logger[_0x411c('0x18')](_0x411c('0x14'),_0x59056a,_0x78db96[_0x411c('0x18')][_0x411c('0x1a')]);return _0x4d680e(_0x78db96['error'][_0x411c('0x1a')]);}else{logger['info'](_0x411c('0x14'),_0x59056a,_0x411c('0x16'));_0x4d680e(_0x78db96[_0x411c('0x1b')][_0x411c('0x1a')]);}})[_0x411c('0x1c')](function(_0x41000d){logger['error'](_0x411c('0x14'),_0x59056a,_0x41000d);_0x2efe39(_0x41000d);});});}exports[_0x411c('0x1d')]=function(_0x5d7cb1){var _0x45d48c=this;return new Promise(function(_0x46bcdc,_0x42ee25){return db['WhatsappMessage'][_0x411c('0x1e')](_0x5d7cb1[_0x411c('0x1f')],{'raw':_0x5d7cb1['options']?_0x5d7cb1[_0x411c('0x20')][_0x411c('0x21')]===undefined?!![]:![]:!![]})[_0x411c('0x12')](function(_0x11a7fa){logger[_0x411c('0x13')]('CreateWhatsappMessage',_0x5d7cb1);logger[_0x411c('0x22')](_0x411c('0x1d'),_0x5d7cb1,JSON['stringify'](_0x11a7fa));_0x46bcdc(_0x11a7fa);})[_0x411c('0x1c')](function(_0x11bf46){logger[_0x411c('0x18')](_0x411c('0x1d'),_0x11bf46[_0x411c('0x1a')],_0x5d7cb1);_0x42ee25(_0x45d48c[_0x411c('0x18')](0x1f4,_0x11bf46[_0x411c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 746326f..102bbe3 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 _0x9d9c=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x167a99,_0x1bbb59){var _0x442d62=function(_0x12c3f8){while(--_0x12c3f8){_0x167a99['push'](_0x167a99['shift']());}};_0x442d62(++_0x1bbb59);}(_0x9d9c,0x1e9));var _0xc9d9=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x9d9c[_0x40a825];return _0x273a54;};'use strict';var WhatsappMessageEvents=require(_0xc9d9('0x0'));var events=[_0xc9d9('0x1'),_0xc9d9('0x2'),_0xc9d9('0x3')];function createListener(_0x333906,_0x230998){return function(_0x2b9202){_0x230998[_0xc9d9('0x4')](_0x333906,_0x2b9202);};}function removeListener(_0x12bac9,_0x41d4f3){return function(){WhatsappMessageEvents[_0xc9d9('0x5')](_0x12bac9,_0x41d4f3);};}exports[_0xc9d9('0x6')]=function(_0x1234b4){for(var _0x528f9e=0x0,_0x159acf=events['length'];_0x528f9e<_0x159acf;_0x528f9e++){var _0x2450a8=events[_0x528f9e];var _0x5e0383=createListener(_0xc9d9('0x7')+_0x2450a8,_0x1234b4);WhatsappMessageEvents['on'](_0x2450a8,_0x5e0383);}}; \ No newline at end of file +var _0xd14c=['length','whatsappMessage:','./whatsappMessage.events','remove','update','emit','removeListener','register'];(function(_0x2d06f0,_0x151475){var _0x45e5a7=function(_0x15b616){while(--_0x15b616){_0x2d06f0['push'](_0x2d06f0['shift']());}};_0x45e5a7(++_0x151475);}(_0xd14c,0x1ba));var _0xcd14=function(_0x1eb186,_0x3e8197){_0x1eb186=_0x1eb186-0x0;var _0x49079e=_0xd14c[_0x1eb186];return _0x49079e;};'use strict';var WhatsappMessageEvents=require(_0xcd14('0x0'));var events=['save',_0xcd14('0x1'),_0xcd14('0x2')];function createListener(_0x2be27f,_0x517ede){return function(_0x2a4d31){_0x517ede[_0xcd14('0x3')](_0x2be27f,_0x2a4d31);};}function removeListener(_0x33f5de,_0x4baffa){return function(){WhatsappMessageEvents[_0xcd14('0x4')](_0x33f5de,_0x4baffa);};}exports[_0xcd14('0x5')]=function(_0x3f0149){for(var _0x8f1555=0x0,_0x36ec64=events[_0xcd14('0x6')];_0x8f1555<_0x36ec64;_0x8f1555++){var _0x1b30aa=events[_0x8f1555];var _0x548fab=createListener(_0xcd14('0x7')+_0x1b30aa,_0x3f0149);WhatsappMessageEvents['on'](_0x1b30aa,_0x548fab);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 3648ae4..deaf894 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 _0x035c=['create','addTeams','/:id/users','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x18c325,_0x7c19a6){var _0x3bc840=function(_0x74a209){while(--_0x74a209){_0x18c325['push'](_0x18c325['shift']());}};_0x3bc840(++_0x7c19a6);}(_0x035c,0x87));var _0xc035=function(_0x40f076,_0x3bffc3){_0x40f076=_0x40f076-0x0;var _0x540041=_0x035c[_0x40f076];return _0x540041;};'use strict';var multer=require(_0xc035('0x0'));var util=require(_0xc035('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc035('0x2'));var router=express[_0xc035('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc035('0x4'));var config=require(_0xc035('0x5'));var controller=require(_0xc035('0x6'));router['get']('/',auth[_0xc035('0x7')](),controller[_0xc035('0x8')]);router[_0xc035('0x9')]('/describe',auth[_0xc035('0x7')](),controller['describe']);router[_0xc035('0x9')]('/:id',auth[_0xc035('0x7')](),controller['show']);router[_0xc035('0x9')](_0xc035('0xa'),auth[_0xc035('0x7')](),controller[_0xc035('0xb')]);router[_0xc035('0x9')](_0xc035('0xc'),auth[_0xc035('0x7')](),controller[_0xc035('0xd')]);router[_0xc035('0x9')]('/:id/users',auth[_0xc035('0x7')](),controller[_0xc035('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc035('0xf')]);router['post'](_0xc035('0xc'),auth[_0xc035('0x7')](),controller[_0xc035('0x10')]);router['post'](_0xc035('0x11'),auth[_0xc035('0x7')](),controller[_0xc035('0x12')]);router['put'](_0xc035('0x13'),auth[_0xc035('0x7')](),controller[_0xc035('0x14')]);router[_0xc035('0x15')](_0xc035('0x13'),auth['isAuthenticated'](),controller[_0xc035('0x16')]);router['delete'](_0xc035('0xc'),auth[_0xc035('0x7')](),controller[_0xc035('0x17')]);router['delete']('/:id/users',auth[_0xc035('0x7')](),controller[_0xc035('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa359=['getAgents','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','exports','path','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0xdffd55,_0x3149cc){var _0x2adb24=function(_0x3df4b7){while(--_0x3df4b7){_0xdffd55['push'](_0xdffd55['shift']());}};_0x2adb24(++_0x3149cc);}(_0xa359,0x192));var _0x9a35=function(_0x474723,_0x208adf){_0x474723=_0x474723-0x0;var _0x403e14=_0xa359[_0x474723];return _0x403e14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a35('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a35('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a35('0x2'));var config=require(_0x9a35('0x3'));var controller=require(_0x9a35('0x4'));router[_0x9a35('0x5')]('/',auth[_0x9a35('0x6')](),controller['index']);router[_0x9a35('0x5')](_0x9a35('0x7'),auth[_0x9a35('0x6')](),controller[_0x9a35('0x8')]);router[_0x9a35('0x5')](_0x9a35('0x9'),auth[_0x9a35('0x6')](),controller['show']);router[_0x9a35('0x5')](_0x9a35('0xa'),auth[_0x9a35('0x6')](),controller[_0x9a35('0xb')]);router[_0x9a35('0x5')](_0x9a35('0xc'),auth[_0x9a35('0x6')](),controller[_0x9a35('0xd')]);router[_0x9a35('0x5')]('/:id/users',auth['isAuthenticated'](),controller[_0x9a35('0xe')]);router[_0x9a35('0xf')]('/',auth[_0x9a35('0x6')](),controller[_0x9a35('0x10')]);router[_0x9a35('0xf')](_0x9a35('0xc'),auth[_0x9a35('0x6')](),controller[_0x9a35('0x11')]);router[_0x9a35('0xf')](_0x9a35('0x12'),auth[_0x9a35('0x6')](),controller[_0x9a35('0x13')]);router[_0x9a35('0x14')](_0x9a35('0x9'),auth[_0x9a35('0x6')](),controller[_0x9a35('0x15')]);router['delete']('/:id',auth[_0x9a35('0x6')](),controller[_0x9a35('0x16')]);router[_0x9a35('0x17')](_0x9a35('0xc'),auth[_0x9a35('0x6')](),controller[_0x9a35('0x18')]);router[_0x9a35('0x17')](_0x9a35('0x12'),auth[_0x9a35('0x6')](),controller['removeAgents']);module[_0x9a35('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index adff375..f6bfb1f 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 _0x946e=['STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0x432434,_0x465d94){var _0x38cbd0=function(_0x2fa3a9){while(--_0x2fa3a9){_0x432434['push'](_0x432434['shift']());}};_0x38cbd0(++_0x465d94);}(_0x946e,0x1d0));var _0xe946=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x946e[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require(_0xe946('0x0'));module['exports']={'name':{'type':Sequelize[_0xe946('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe946('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xe946('0x3'),_0xe946('0x4'))},'description':{'type':Sequelize[_0xe946('0x1')]}}; \ No newline at end of file +var _0x2e31=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x304096,_0x5701d5){var _0xe2ba19=function(_0x5bc4cd){while(--_0x5bc4cd){_0x304096['push'](_0x304096['shift']());}};_0xe2ba19(++_0x5701d5);}(_0x2e31,0x145));var _0x12e3=function(_0x5ccdaf,_0x6909c7){_0x5ccdaf=_0x5ccdaf-0x0;var _0x2ab28e=_0x2e31[_0x5ccdaf];return _0x2ab28e;};'use strict';var Sequelize=require(_0x12e3('0x0'));module[_0x12e3('0x1')]={'name':{'type':Sequelize[_0x12e3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x12e3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x12e3('0x4')]('rrmemory','beepall',_0x12e3('0x5'))},'description':{'type':Sequelize[_0x12e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e20b7a5..d43d77a 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 _0x4c5d=['includes','all','union','compact','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','removeAgents','eml-format','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','name','send','map','WhatsappQueue','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x4c5d,0x92));var _0xd4c5=function(_0x102b83,_0x4a4479){_0x102b83=_0x102b83-0x0;var _0x5d377e=_0x4c5d[_0x102b83];return _0x5d377e;};'use strict';var emlformat=require(_0xd4c5('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(_0xd4c5('0x1'));var Mustache=require(_0xd4c5('0x2'));var util=require(_0xd4c5('0x3'));var path=require(_0xd4c5('0x4'));var sox=require(_0xd4c5('0x5'));var csv=require(_0xd4c5('0x6'));var ejs=require(_0xd4c5('0x7'));var fs=require('fs');var fs_extra=require(_0xd4c5('0x8'));var _=require(_0xd4c5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd4c5('0xa'));var deskjs=require(_0xd4c5('0xb'));var toCsv=require(_0xd4c5('0x6'));var querystring=require(_0xd4c5('0xc'));var Papa=require(_0xd4c5('0xd'));var Redis=require(_0xd4c5('0xe'));var authService=require(_0xd4c5('0xf'));var qs=require(_0xd4c5('0x10'));var as=require(_0xd4c5('0x11'));var hardwareService=require(_0xd4c5('0x12'));var logger=require(_0xd4c5('0x13'))(_0xd4c5('0x14'));var utils=require(_0xd4c5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4c5('0x16'));var db=require(_0xd4c5('0x17'))['db'];config['redis']=_[_0xd4c5('0x18')](config['redis'],{'host':_0xd4c5('0x19'),'port':0x18eb});var socket=require(_0xd4c5('0x1a'))(new Redis(config['redis']));require(_0xd4c5('0x1b'))[_0xd4c5('0x1c')](socket);function respondWithStatusCode(_0x52af22,_0x5d2722){_0x5d2722=_0x5d2722||0xcc;return function(_0xaeb591){if(_0xaeb591){return _0x52af22[_0xd4c5('0x1d')](_0x5d2722);}return _0x52af22['status'](_0x5d2722)[_0xd4c5('0x1e')]();};}function respondWithResult(_0x4f0bda,_0x73aa3e){_0x73aa3e=_0x73aa3e||0xc8;return function(_0x220d78){if(_0x220d78){return _0x4f0bda[_0xd4c5('0x1f')](_0x73aa3e)['json'](_0x220d78);}};}function respondWithFilteredResult(_0x4f413b,_0x34dbd4){return function(_0x273fcd){if(_0x273fcd){var _0x15c901=typeof _0x34dbd4[_0xd4c5('0x20')]===_0xd4c5('0x21')&&typeof _0x34dbd4[_0xd4c5('0x22')]==='undefined';var _0x235250=_0x273fcd[_0xd4c5('0x23')];var _0x5f59ce=_0x15c901?0x0:_0x34dbd4[_0xd4c5('0x20')];var _0x4b2b62=_0x15c901?_0x273fcd[_0xd4c5('0x23')]:_0x34dbd4['offset']+_0x34dbd4[_0xd4c5('0x22')];var _0x556141;if(_0x4b2b62>=_0x235250){_0x4b2b62=_0x235250;_0x556141=0xc8;}else{_0x556141=0xce;}_0x4f413b[_0xd4c5('0x1f')](_0x556141);return _0x4f413b[_0xd4c5('0x24')](_0xd4c5('0x25'),_0x5f59ce+'-'+_0x4b2b62+'/'+_0x235250)[_0xd4c5('0x26')](_0x273fcd);}return null;};}function patchUpdates(_0x1ef546){return function(_0x2fc61a){try{jsonpatch[_0xd4c5('0x27')](_0x2fc61a,_0x1ef546,!![]);}catch(_0x4e494c){return BPromise[_0xd4c5('0x28')](_0x4e494c);}return _0x2fc61a['save']();};}function saveUpdates(_0x45fb51,_0x5e0add){return function(_0x5ee565){if(_0x5ee565){return _0x5ee565['update'](_0x45fb51)[_0xd4c5('0x29')](function(_0x305c90){return _0x305c90;});}return null;};}function removeEntity(_0x531387,_0x1a2b29){return function(_0x1b4fec){if(_0x1b4fec){return _0x1b4fec['destroy']()[_0xd4c5('0x29')](function(){var _0x2cfed7=_0x1b4fec[_0xd4c5('0x2a')]({'plain':!![]});var _0x152a03=_0xd4c5('0x2b');return db[_0xd4c5('0x2c')][_0xd4c5('0x2d')]({'where':{'type':_0x152a03,'resourceId':_0x2cfed7['id']}})[_0xd4c5('0x29')](function(){return _0x1b4fec;});})[_0xd4c5('0x29')](function(){_0x531387[_0xd4c5('0x1f')](0xcc)[_0xd4c5('0x1e')]();});}};}function handleEntityNotFound(_0x26593c,_0x41b14f){return function(_0x429e9a){if(!_0x429e9a){_0x26593c[_0xd4c5('0x1d')](0x194);}return _0x429e9a;};}function handleError(_0x399a90,_0x5c1866){_0x5c1866=_0x5c1866||0x1f4;return function(_0x468da9){logger['error'](_0x468da9['stack']);if(_0x468da9[_0xd4c5('0x2e')]){delete _0x468da9[_0xd4c5('0x2e')];}_0x399a90[_0xd4c5('0x1f')](_0x5c1866)[_0xd4c5('0x2f')](_0x468da9);};}exports['index']=function(_0x40bd84,_0x106801){var _0x34f035={},_0x3a69ca={},_0x2d7b7e={'count':0x0,'rows':[]};var _0x27e1b0=_[_0xd4c5('0x30')](db[_0xd4c5('0x31')]['rawAttributes'],function(_0x5c34d1){return{'name':_0x5c34d1[_0xd4c5('0x32')],'type':_0x5c34d1[_0xd4c5('0x33')]['key']};});_0x3a69ca[_0xd4c5('0x34')]=_[_0xd4c5('0x30')](_0x27e1b0,_0xd4c5('0x2e'));_0x3a69ca[_0xd4c5('0x35')]=_[_0xd4c5('0x36')](_0x40bd84['query']);_0x3a69ca[_0xd4c5('0x37')]=_['intersection'](_0x3a69ca[_0xd4c5('0x34')],_0x3a69ca[_0xd4c5('0x35')]);_0x34f035[_0xd4c5('0x38')]=_[_0xd4c5('0x39')](_0x3a69ca[_0xd4c5('0x34')],qs[_0xd4c5('0x3a')](_0x40bd84['query'][_0xd4c5('0x3a')]));_0x34f035[_0xd4c5('0x38')]=_0x34f035[_0xd4c5('0x38')][_0xd4c5('0x3b')]?_0x34f035['attributes']:_0x3a69ca[_0xd4c5('0x34')];if(!_0x40bd84[_0xd4c5('0x35')]['hasOwnProperty'](_0xd4c5('0x3c'))){_0x34f035[_0xd4c5('0x22')]=qs[_0xd4c5('0x22')](_0x40bd84['query'][_0xd4c5('0x22')]);_0x34f035['offset']=qs[_0xd4c5('0x20')](_0x40bd84[_0xd4c5('0x35')][_0xd4c5('0x20')]);}_0x34f035[_0xd4c5('0x3d')]=qs[_0xd4c5('0x3e')](_0x40bd84['query'][_0xd4c5('0x3e')]);_0x34f035[_0xd4c5('0x3f')]=qs[_0xd4c5('0x37')](_[_0xd4c5('0x40')](_0x40bd84[_0xd4c5('0x35')],_0x3a69ca[_0xd4c5('0x37')]),_0x27e1b0);if(_0x40bd84[_0xd4c5('0x35')][_0xd4c5('0x41')]){_0x34f035[_0xd4c5('0x3f')]=_[_0xd4c5('0x42')](_0x34f035['where'],{'$or':_[_0xd4c5('0x30')](_0x27e1b0,function(_0xbf0623){if(_0xbf0623[_0xd4c5('0x33')]!=='VIRTUAL'){var _0x1b1ecd={};_0x1b1ecd[_0xbf0623[_0xd4c5('0x2e')]]={'$like':'%'+_0x40bd84[_0xd4c5('0x35')]['filter']+'%'};return _0x1b1ecd;}})});}_0x34f035=_[_0xd4c5('0x42')]({},_0x34f035,_0x40bd84[_0xd4c5('0x43')]);var _0x1f3107={'where':_0x34f035['where']};return db[_0xd4c5('0x31')]['count'](_0x1f3107)[_0xd4c5('0x29')](function(_0x533fa5){_0x2d7b7e['count']=_0x533fa5;if(_0x40bd84[_0xd4c5('0x35')][_0xd4c5('0x44')]){_0x34f035[_0xd4c5('0x45')]=[{'all':!![]}];}return db[_0xd4c5('0x31')][_0xd4c5('0x46')](_0x34f035);})[_0xd4c5('0x29')](function(_0xd944c0){_0x2d7b7e[_0xd4c5('0x47')]=_0xd944c0;return _0x2d7b7e;})['then'](respondWithFilteredResult(_0x106801,_0x34f035))[_0xd4c5('0x48')](handleError(_0x106801,null));};exports[_0xd4c5('0x49')]=function(_0x53da99,_0x45102){var _0x2edb46={'raw':!![],'where':{'id':_0x53da99[_0xd4c5('0x4a')]['id']}},_0xeb34f5={};_0xeb34f5[_0xd4c5('0x34')]=_[_0xd4c5('0x36')](db[_0xd4c5('0x31')][_0xd4c5('0x4b')]);_0xeb34f5[_0xd4c5('0x35')]=_[_0xd4c5('0x36')](_0x53da99['query']);_0xeb34f5['filters']=_[_0xd4c5('0x39')](_0xeb34f5[_0xd4c5('0x34')],_0xeb34f5[_0xd4c5('0x35')]);_0x2edb46[_0xd4c5('0x38')]=_[_0xd4c5('0x39')](_0xeb34f5[_0xd4c5('0x34')],qs[_0xd4c5('0x3a')](_0x53da99['query']['fields']));_0x2edb46[_0xd4c5('0x38')]=_0x2edb46[_0xd4c5('0x38')][_0xd4c5('0x3b')]?_0x2edb46[_0xd4c5('0x38')]:_0xeb34f5[_0xd4c5('0x34')];if(_0x53da99[_0xd4c5('0x35')][_0xd4c5('0x44')]){_0x2edb46['include']=[{'all':!![]}];}_0x2edb46=_[_0xd4c5('0x42')]({},_0x2edb46,_0x53da99[_0xd4c5('0x43')]);return db['WhatsappQueue']['find'](_0x2edb46)['then'](handleEntityNotFound(_0x45102,null))['then'](respondWithResult(_0x45102,null))[_0xd4c5('0x48')](handleError(_0x45102,null));};exports['create']=function(_0x160e61,_0x8b49fc){return db[_0xd4c5('0x31')]['create'](_0x160e61[_0xd4c5('0x4c')],{})[_0xd4c5('0x29')](function(_0x3b829c){var _0x456d1a=_0x160e61[_0xd4c5('0x4d')][_0xd4c5('0x2a')]({'plain':!![]});if(!_0x456d1a)throw new Error(_0xd4c5('0x4e'));if(_0x456d1a[_0xd4c5('0x4f')]===_0xd4c5('0x4d')){var _0x264b46=_0x3b829c[_0xd4c5('0x2a')]({'plain':!![]});var _0x4f704e='WhatsappQueues';return db[_0xd4c5('0x50')]['find']({'where':{'name':_0x4f704e,'userProfileId':_0x456d1a['userProfileId']},'raw':!![]})[_0xd4c5('0x29')](function(_0x43ff20){if(_0x43ff20&&_0x43ff20['autoAssociation']===0x0){return db[_0xd4c5('0x2c')]['create']({'name':_0x264b46[_0xd4c5('0x2e')],'resourceId':_0x264b46['id'],'type':_0x43ff20['name'],'sectionId':_0x43ff20['id']},{})[_0xd4c5('0x29')](function(){return _0x3b829c;});}else{return _0x3b829c;}})[_0xd4c5('0x48')](function(_0x1dc55e){logger[_0xd4c5('0x51')](_0xd4c5('0x52'),_0x1dc55e);throw _0x1dc55e;});}return _0x3b829c;})[_0xd4c5('0x29')](respondWithResult(_0x8b49fc,0xc9))['catch'](handleError(_0x8b49fc,null));};exports[_0xd4c5('0x53')]=function(_0x147e0f,_0x58e930){if(_0x147e0f['body']['id']){delete _0x147e0f[_0xd4c5('0x4c')]['id'];}return db['WhatsappQueue'][_0xd4c5('0x54')]({'where':{'id':_0x147e0f[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0x58e930,null))[_0xd4c5('0x29')](saveUpdates(_0x147e0f['body'],null))[_0xd4c5('0x29')](respondWithResult(_0x58e930,null))['catch'](handleError(_0x58e930,null));};exports[_0xd4c5('0x2d')]=function(_0x49fb2b,_0xbede35){return db[_0xd4c5('0x31')]['find']({'where':{'id':_0x49fb2b['params']['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0xbede35,null))[_0xd4c5('0x29')](removeEntity(_0xbede35,null))['catch'](handleError(_0xbede35,null));};exports[_0xd4c5('0x55')]=function(_0x5c8479,_0x1d74c6){return db[_0xd4c5('0x31')][_0xd4c5('0x55')]()[_0xd4c5('0x29')](respondWithResult(_0x1d74c6,null))[_0xd4c5('0x48')](handleError(_0x1d74c6,null));};exports[_0xd4c5('0x56')]=function(_0x3fe171,_0x1bf7c8,_0xfa4939){var _0x6c0eb0={'raw':!![],'where':{}},_0x478227={},_0x43cc44;return db[_0xd4c5('0x31')][_0xd4c5('0x57')]({'where':{'id':_0x3fe171[_0xd4c5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1bf7c8,null))[_0xd4c5('0x29')](function(_0x3ce735){if(_0x3ce735){_0x43cc44=_0x3ce735[_0xd4c5('0x2a')]({'plain':!![]});_0x478227['model']=_[_0xd4c5('0x36')](db[_0xd4c5('0x58')][_0xd4c5('0x4b')]);_0x478227['query']=_[_0xd4c5('0x36')](_0x3fe171[_0xd4c5('0x35')]);_0x478227['filters']=_[_0xd4c5('0x39')](_0x478227[_0xd4c5('0x34')],_0x478227[_0xd4c5('0x35')]);_0x6c0eb0[_0xd4c5('0x38')]=_[_0xd4c5('0x39')](_0x478227[_0xd4c5('0x34')],qs['fields'](_0x3fe171[_0xd4c5('0x35')][_0xd4c5('0x3a')]));_0x6c0eb0[_0xd4c5('0x38')]=_0x6c0eb0[_0xd4c5('0x38')]['length']?_0x6c0eb0['attributes']:_0x478227[_0xd4c5('0x34')];if(!_0x3fe171[_0xd4c5('0x35')][_0xd4c5('0x59')](_0xd4c5('0x3c'))){_0x6c0eb0[_0xd4c5('0x22')]=qs[_0xd4c5('0x22')](_0x3fe171[_0xd4c5('0x35')][_0xd4c5('0x22')]);_0x6c0eb0[_0xd4c5('0x20')]=qs[_0xd4c5('0x20')](_0x3fe171['query'][_0xd4c5('0x20')]);}_0x6c0eb0[_0xd4c5('0x3d')]=qs[_0xd4c5('0x3e')](_0x3fe171[_0xd4c5('0x35')][_0xd4c5('0x3e')]);_0x6c0eb0[_0xd4c5('0x3f')]=qs[_0xd4c5('0x37')](_['pick'](_0x3fe171[_0xd4c5('0x35')],_0x478227['filters']));_0x6c0eb0['where'][_0xd4c5('0x5a')]=_0x3ce735['id'];if(_0x3fe171['query'][_0xd4c5('0x41')]){_0x6c0eb0[_0xd4c5('0x3f')]=_[_0xd4c5('0x42')](_0x6c0eb0[_0xd4c5('0x3f')],{'$or':_[_0xd4c5('0x30')](_0x6c0eb0[_0xd4c5('0x38')],function(_0xe9721d){var _0x5b4775={};_0x5b4775[_0xe9721d]={'$like':'%'+_0x3fe171[_0xd4c5('0x35')][_0xd4c5('0x41')]+'%'};return _0x5b4775;})});}_0x6c0eb0=_['merge']({},_0x6c0eb0,_0x3fe171[_0xd4c5('0x43')]);return db[_0xd4c5('0x58')][_0xd4c5('0x46')](_0x6c0eb0);}})[_0xd4c5('0x29')](function(_0x19244c){if(_0x19244c){return db[_0xd4c5('0x5b')]['findAndCountAll']({'where':{'id':_[_0xd4c5('0x30')](_0x19244c,_0xd4c5('0x5c')),'role':_0xd4c5('0x5d')},'attributes':['id',_0xd4c5('0x2e'),_0xd4c5('0x5e'),'updatedAt',_0xd4c5('0x5f')]});}})[_0xd4c5('0x29')](function(_0x47ead3){if(_0x47ead3){return{'count':_0x47ead3[_0xd4c5('0x23')],'rows':_[_0xd4c5('0x30')](_0x47ead3[_0xd4c5('0x47')],function(_0x46f825){return{'membername':_0x46f825[_0xd4c5('0x2e')],'UserId':_0x46f825['id'],'queue_name':_0x43cc44[_0xd4c5('0x2e')],'WhatsappQueueId':_0x43cc44['id'],'interface':util[_0xd4c5('0x60')](_0xd4c5('0x61'),_0xd4c5('0x62'),_0x46f825['name']),'penalty':0x0,'paused':_0x46f825[_0xd4c5('0x5e')],'createdAt':_0x46f825[_0xd4c5('0x5f')],'updatedAt':_0x46f825[_0xd4c5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd4c5('0x29')](respondWithFilteredResult(_0x1bf7c8,_0x6c0eb0))[_0xd4c5('0x48')](handleError(_0x1bf7c8,null));};exports[_0xd4c5('0x64')]=function(_0x2e16af,_0x301874,_0x2c8727){var _0x17c23a={};var _0xbb1948={};var _0xbc1139;var _0x4241ca;return db[_0xd4c5('0x31')][_0xd4c5('0x57')]({'where':{'id':_0x2e16af[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0x301874,null))[_0xd4c5('0x29')](function(_0x31fc78){if(_0x31fc78){_0xbc1139=_0x31fc78;_0xbb1948[_0xd4c5('0x34')]=_[_0xd4c5('0x36')](db['Team'][_0xd4c5('0x4b')]);_0xbb1948[_0xd4c5('0x35')]=_[_0xd4c5('0x36')](_0x2e16af[_0xd4c5('0x35')]);_0xbb1948[_0xd4c5('0x37')]=_[_0xd4c5('0x39')](_0xbb1948[_0xd4c5('0x34')],_0xbb1948['query']);_0x17c23a['attributes']=_[_0xd4c5('0x39')](_0xbb1948[_0xd4c5('0x34')],qs[_0xd4c5('0x3a')](_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x3a')]));_0x17c23a[_0xd4c5('0x38')]=_0x17c23a['attributes'][_0xd4c5('0x3b')]?_0x17c23a[_0xd4c5('0x38')]:_0xbb1948[_0xd4c5('0x34')];_0x17c23a[_0xd4c5('0x3d')]=qs[_0xd4c5('0x3e')](_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x3e')]);_0x17c23a['where']=qs[_0xd4c5('0x37')](_['pick'](_0x2e16af[_0xd4c5('0x35')],_0xbb1948['filters']));if(_0x2e16af[_0xd4c5('0x35')]['filter']){_0x17c23a[_0xd4c5('0x3f')]=_['merge'](_0x17c23a[_0xd4c5('0x3f')],{'$or':_['map'](_0x17c23a['attributes'],function(_0x25c280){var _0x135ab0={};_0x135ab0[_0x25c280]={'$like':'%'+_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x41')]+'%'};return _0x135ab0;})});}_0x17c23a=_[_0xd4c5('0x42')]({},_0x17c23a,_0x2e16af[_0xd4c5('0x43')]);return _0xbc1139[_0xd4c5('0x64')](_0x17c23a);}})[_0xd4c5('0x29')](function(_0x213a7c){if(_0x213a7c){_0x4241ca=_0x213a7c[_0xd4c5('0x3b')];if(!_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x59')](_0xd4c5('0x3c'))){_0x17c23a[_0xd4c5('0x22')]=qs[_0xd4c5('0x22')](_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x22')]);_0x17c23a[_0xd4c5('0x20')]=qs[_0xd4c5('0x20')](_0x2e16af[_0xd4c5('0x35')][_0xd4c5('0x20')]);}return _0xbc1139[_0xd4c5('0x64')](_0x17c23a);}})[_0xd4c5('0x29')](function(_0x2c8c3f){if(_0x2c8c3f){return _0x2c8c3f?{'count':_0x4241ca,'rows':_0x2c8c3f}:null;}})[_0xd4c5('0x29')](respondWithResult(_0x301874,null))[_0xd4c5('0x48')](handleError(_0x301874,null));};exports[_0xd4c5('0x65')]=function(_0x11bb7e,_0x5ec05e,_0x4ca267){var _0x50208b=_0x11bb7e[_0xd4c5('0x4c')][_0xd4c5('0x66')];return db[_0xd4c5('0x67')][_0xd4c5('0x46')]({'where':{'id':_0x50208b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd4c5('0x68'),'attributes':['id',_0xd4c5('0x2e'),_0xd4c5('0x69'),'voicePause',_0xd4c5('0x6a')],'raw':!![]}]})[_0xd4c5('0x29')](function(_0x1014b7){if(_0x1014b7){var _0x5d9a4b=_[_0xd4c5('0x6b')](_0x1014b7,function(_0x5d0bcb){var _0x94a609=_0x5d0bcb[_0xd4c5('0x2a')]({'plain':!![]});return _0x94a609[_0xd4c5('0x68')];});return db[_0xd4c5('0x31')][_0xd4c5('0x54')]({'where':{'id':_0x11bb7e[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](function(_0x4aa5af){return db[_0xd4c5('0x6c')][_0xd4c5('0x6d')](function(_0x48d9ef){return _0x4aa5af[_0xd4c5('0x65')](_0x50208b,{'transaction':_0x48d9ef})[_0xd4c5('0x29')](function(){return BPromise[_0xd4c5('0x6e')](_0x5d9a4b,function(_0x397003){return db[_0xd4c5('0x58')][_0xd4c5('0x6f')]({'where':{'UserId':_0x397003['id'],'WhatsappQueueId':_0x11bb7e[_0xd4c5('0x4a')]['id']},'transaction':_0x48d9ef});});})['then'](function(){_0x5d9a4b[_0xd4c5('0x70')](function(_0x7c4243){socket['emit'](_0xd4c5('0x71'),{'UserId':_0x7c4243['id'],'WhatsappQueueId':_0x4aa5af['id']});});});});});}})[_0xd4c5('0x29')](respondWithStatusCode(_0x5ec05e,null))[_0xd4c5('0x48')](handleError(_0x5ec05e,null));};exports[_0xd4c5('0x72')]=function(_0x333442,_0x4f8936,_0x19de22){return db[_0xd4c5('0x67')][_0xd4c5('0x46')]({'where':{'id':_0x333442[_0xd4c5('0x35')][_0xd4c5('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd4c5('0x68'),'attributes':['id'],'raw':!![]}]})[_0xd4c5('0x29')](handleEntityNotFound(_0x4f8936,null))[_0xd4c5('0x29')](function(_0x3d1396){var _0x1bec66=_[_0xd4c5('0x30')](_0x3d1396,'id');var _0x11de4f=[];var _0x39052b=[];var _0x1a0f23=squel[_0xd4c5('0x73')]();_0x1a0f23['field']('tq.TeamId')['from'](_0xd4c5('0x74'),'tq')['join']('user_has_teams','ut',_0xd4c5('0x75'))[_0xd4c5('0x3f')]('WhatsappQueueId\x20=\x20?',_0x333442[_0xd4c5('0x4a')]['id']);for(var _0x355d88=0x0;_0x355d88<_0x3d1396['length'];_0x355d88+=0x1){let _0x71f243=_0x3d1396[_0x355d88];for(var _0x2e6698=0x0;_0x2e6698<_0x71f243[_0xd4c5('0x68')][_0xd4c5('0x3b')];_0x2e6698+=0x1){let _0x5449fb=_0x71f243[_0xd4c5('0x68')][_0x2e6698];var _0x40a387=_0x1a0f23[_0xd4c5('0x76')]();_0x40a387['where'](_0xd4c5('0x77'),_0x5449fb['id']);_0x39052b[_0xd4c5('0x78')](db['sequelize'][_0xd4c5('0x35')](_0x40a387['toString'](),{'type':db['sequelize'][_0xd4c5('0x79')][_0xd4c5('0x7a')]})[_0xd4c5('0x29')](function(_0x32d29c){if(_0x32d29c[_0xd4c5('0x3b')]===0x1){return _0x5449fb['id'];}else{var _0x11de3c=_['every'](_[_0xd4c5('0x30')](_0x32d29c,_0xd4c5('0x7b')),function(_0x4f3a){return _[_0xd4c5('0x7c')](_0x1bec66,_0x4f3a);});if(_0x11de3c){return _0x5449fb['id'];}}}));}}return BPromise[_0xd4c5('0x7d')](_0x39052b)[_0xd4c5('0x29')](function(_0x6cca60){_0x11de4f=_(_0x11de4f)[_0xd4c5('0x7e')](_0x6cca60)[_0xd4c5('0x7f')]()[_0xd4c5('0x80')]();return db[_0xd4c5('0x31')][_0xd4c5('0x54')]({'where':{'id':_0x333442[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](function(_0x1ed862){return db['sequelize'][_0xd4c5('0x6d')](function(_0x128c9f){return _0x1ed862['removeTeams'](_0x333442[_0xd4c5('0x35')][_0xd4c5('0x66')],{'transaction':_0x128c9f})[_0xd4c5('0x29')](function(){if(!_[_0xd4c5('0x81')](_0x11de4f)){return _0x1ed862['removeAgents'](_0x11de4f,{'transaction':_0x128c9f});}})[_0xd4c5('0x29')](function(){_0x11de4f[_0xd4c5('0x70')](function(_0xc8e512){socket[_0xd4c5('0x82')](_0xd4c5('0x83'),{'UserId':_0xc8e512,'WhatsappQueueId':_0x1ed862['id']});});});});});});})[_0xd4c5('0x29')](respondWithStatusCode(_0x4f8936,null))[_0xd4c5('0x48')](handleError(_0x4f8936,null));};exports[_0xd4c5('0x84')]=function(_0x1f4dae,_0x64da77,_0x22e749){return db['WhatsappQueue'][_0xd4c5('0x54')]({'where':{'id':_0x1f4dae[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0x64da77,null))[_0xd4c5('0x29')](function(_0x172abc){if(_0x172abc){return _0x172abc[_0xd4c5('0x84')](_0x1f4dae[_0xd4c5('0x4c')][_0xd4c5('0x66')],_[_0xd4c5('0x85')](_0x1f4dae[_0xd4c5('0x4c')],[_0xd4c5('0x66'),'id'])||{})['spread'](function(_0x55575d){for(var _0x17ca8e=0x0;_0x17ca8e<_0x1f4dae[_0xd4c5('0x4c')][_0xd4c5('0x66')][_0xd4c5('0x3b')];_0x17ca8e+=0x1){socket[_0xd4c5('0x82')](_0xd4c5('0x71'),{'UserId':Number(_0x1f4dae[_0xd4c5('0x4c')]['ids'][_0x17ca8e]),'WhatsappQueueId':Number(_0x1f4dae[_0xd4c5('0x4a')]['id'])});}return _0x55575d;});}})[_0xd4c5('0x29')](respondWithResult(_0x64da77,null))['catch'](handleError(_0x64da77,null));};exports[_0xd4c5('0x86')]=function(_0x3a1479,_0x1b3b4d,_0x3c7f15){return db['WhatsappQueue'][_0xd4c5('0x54')]({'where':{'id':_0x3a1479['params']['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0x1b3b4d,null))[_0xd4c5('0x29')](function(_0x519f24){if(_0x519f24){return _0x519f24[_0xd4c5('0x86')](_0x3a1479[_0xd4c5('0x35')][_0xd4c5('0x66')])[_0xd4c5('0x29')](function(){if(_['isArray'](_0x3a1479[_0xd4c5('0x35')]['ids'])){for(var _0x43ebaf=0x0;_0x43ebaf<_0x3a1479[_0xd4c5('0x35')]['ids'][_0xd4c5('0x3b')];_0x43ebaf+=0x1){socket['emit'](_0xd4c5('0x83'),{'UserId':Number(_0x3a1479[_0xd4c5('0x35')][_0xd4c5('0x66')][_0x43ebaf]),'WhatsappQueueId':Number(_0x3a1479[_0xd4c5('0x4a')]['id'])});}}else{socket[_0xd4c5('0x82')](_0xd4c5('0x83'),{'UserId':Number(_0x3a1479[_0xd4c5('0x35')][_0xd4c5('0x66')]),'WhatsappQueueId':Number(_0x3a1479[_0xd4c5('0x4a')]['id'])});}});}})[_0xd4c5('0x29')](respondWithStatusCode(_0x1b3b4d,null))[_0xd4c5('0x48')](handleError(_0x1b3b4d,null));};exports['getAgents']=function(_0x11fbbc,_0x5decce,_0x39f98f){var _0x452837={};var _0x4f6fff={};var _0x27241a;var _0x97b99c;return db[_0xd4c5('0x31')][_0xd4c5('0x57')]({'where':{'id':_0x11fbbc[_0xd4c5('0x4a')]['id']}})[_0xd4c5('0x29')](handleEntityNotFound(_0x5decce,null))[_0xd4c5('0x29')](function(_0x287232){if(_0x287232){_0x27241a=_0x287232;_0x4f6fff[_0xd4c5('0x34')]=_[_0xd4c5('0x36')](db['User'][_0xd4c5('0x4b')]);_0x4f6fff[_0xd4c5('0x35')]=_['keys'](_0x11fbbc[_0xd4c5('0x35')]);_0x4f6fff['filters']=_['intersection'](_0x4f6fff[_0xd4c5('0x34')],_0x4f6fff['query']);_0x452837[_0xd4c5('0x38')]=_[_0xd4c5('0x39')](_0x4f6fff['model'],qs[_0xd4c5('0x3a')](_0x11fbbc[_0xd4c5('0x35')][_0xd4c5('0x3a')]));_0x452837['attributes']=_0x452837['attributes'][_0xd4c5('0x3b')]?_0x452837[_0xd4c5('0x38')]:_0x4f6fff[_0xd4c5('0x34')];_0x452837[_0xd4c5('0x3d')]=qs[_0xd4c5('0x3e')](_0x11fbbc[_0xd4c5('0x35')]['sort']);_0x452837[_0xd4c5('0x3f')]=qs[_0xd4c5('0x37')](_[_0xd4c5('0x40')](_0x11fbbc[_0xd4c5('0x35')],_0x4f6fff['filters']));if(_0x11fbbc[_0xd4c5('0x35')][_0xd4c5('0x41')]){_0x452837[_0xd4c5('0x3f')]=_['merge'](_0x452837[_0xd4c5('0x3f')],{'$or':_[_0xd4c5('0x30')](_0x452837['attributes'],function(_0x399d82){var _0x20b695={};_0x20b695[_0x399d82]={'$like':'%'+_0x11fbbc[_0xd4c5('0x35')][_0xd4c5('0x41')]+'%'};return _0x20b695;})});}_0x452837=_[_0xd4c5('0x42')]({},_0x452837,_0x11fbbc[_0xd4c5('0x43')]);return _0x27241a['getAgents'](_0x452837);}})[_0xd4c5('0x29')](function(_0xf6b5a0){if(_0xf6b5a0){_0x97b99c=_0xf6b5a0[_0xd4c5('0x3b')];if(!_0x11fbbc['query'][_0xd4c5('0x59')](_0xd4c5('0x3c'))){_0x452837[_0xd4c5('0x22')]=qs['limit'](_0x11fbbc['query'][_0xd4c5('0x22')]);_0x452837[_0xd4c5('0x20')]=qs[_0xd4c5('0x20')](_0x11fbbc[_0xd4c5('0x35')]['offset']);}return _0x27241a['getAgents'](_0x452837);}})[_0xd4c5('0x29')](function(_0x5ea3e1){if(_0x5ea3e1){return _0x5ea3e1?{'count':_0x97b99c,'rows':_0x5ea3e1}:null;}})[_0xd4c5('0x29')](respondWithResult(_0x5decce,null))[_0xd4c5('0x48')](handleError(_0x5decce,null));}; \ No newline at end of file +var _0x51eb=['send','index','map','WhatsappQueue','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','format','createdAt','updatedAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','WhatsappQueues','UserProfileResource','destroy','name'];(function(_0x173716,_0x324d5c){var _0x2cf885=function(_0x4020ef){while(--_0x4020ef){_0x173716['push'](_0x173716['shift']());}};_0x2cf885(++_0x324d5c);}(_0x51eb,0x17b));var _0xb51e=function(_0x55046d,_0xd9cc4e){_0x55046d=_0x55046d-0x0;var _0x2ac857=_0x51eb[_0x55046d];return _0x2ac857;};'use strict';var emlformat=require(_0xb51e('0x0'));var rimraf=require(_0xb51e('0x1'));var zipdir=require(_0xb51e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb51e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb51e('0x4'));var util=require('util');var path=require(_0xb51e('0x5'));var sox=require(_0xb51e('0x6'));var csv=require(_0xb51e('0x7'));var ejs=require(_0xb51e('0x8'));var fs=require('fs');var fs_extra=require(_0xb51e('0x9'));var _=require(_0xb51e('0xa'));var squel=require(_0xb51e('0xb'));var crypto=require('crypto');var jsforce=require(_0xb51e('0xc'));var deskjs=require(_0xb51e('0xd'));var toCsv=require(_0xb51e('0x7'));var querystring=require(_0xb51e('0xe'));var Papa=require(_0xb51e('0xf'));var Redis=require(_0xb51e('0x10'));var authService=require(_0xb51e('0x11'));var qs=require(_0xb51e('0x12'));var as=require(_0xb51e('0x13'));var hardwareService=require(_0xb51e('0x14'));var logger=require(_0xb51e('0x15'))(_0xb51e('0x16'));var utils=require('../../config/utils');var config=require(_0xb51e('0x17'));var licenseUtil=require(_0xb51e('0x18'));var db=require(_0xb51e('0x19'))['db'];config['redis']=_[_0xb51e('0x1a')](config['redis'],{'host':_0xb51e('0x1b'),'port':0x18eb});var socket=require(_0xb51e('0x1c'))(new Redis(config[_0xb51e('0x1d')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0xc02ce0,_0x4d0a20){_0x4d0a20=_0x4d0a20||0xcc;return function(_0x42504b){if(_0x42504b){return _0xc02ce0[_0xb51e('0x1e')](_0x4d0a20);}return _0xc02ce0['status'](_0x4d0a20)[_0xb51e('0x1f')]();};}function respondWithResult(_0xfc0cc6,_0x1dc088){_0x1dc088=_0x1dc088||0xc8;return function(_0x6ec836){if(_0x6ec836){return _0xfc0cc6[_0xb51e('0x20')](_0x1dc088)[_0xb51e('0x21')](_0x6ec836);}};}function respondWithFilteredResult(_0x461901,_0x55c58a){return function(_0x30f859){if(_0x30f859){var _0x2fbd70=typeof _0x55c58a[_0xb51e('0x22')]===_0xb51e('0x23')&&typeof _0x55c58a[_0xb51e('0x24')]===_0xb51e('0x23');var _0xcfb355=_0x30f859[_0xb51e('0x25')];var _0x2a30f7=_0x2fbd70?0x0:_0x55c58a[_0xb51e('0x22')];var _0x58eaad=_0x2fbd70?_0x30f859[_0xb51e('0x25')]:_0x55c58a[_0xb51e('0x22')]+_0x55c58a[_0xb51e('0x24')];var _0x16f4b6;if(_0x58eaad>=_0xcfb355){_0x58eaad=_0xcfb355;_0x16f4b6=0xc8;}else{_0x16f4b6=0xce;}_0x461901[_0xb51e('0x20')](_0x16f4b6);return _0x461901[_0xb51e('0x26')]('Content-Range',_0x2a30f7+'-'+_0x58eaad+'/'+_0xcfb355)[_0xb51e('0x21')](_0x30f859);}return null;};}function patchUpdates(_0x4eb8b2){return function(_0x4c086a){try{jsonpatch['apply'](_0x4c086a,_0x4eb8b2,!![]);}catch(_0x29f487){return BPromise[_0xb51e('0x27')](_0x29f487);}return _0x4c086a[_0xb51e('0x28')]();};}function saveUpdates(_0x1fc863,_0x467213){return function(_0x25535c){if(_0x25535c){return _0x25535c[_0xb51e('0x29')](_0x1fc863)['then'](function(_0x371d40){return _0x371d40;});}return null;};}function removeEntity(_0x554629,_0x4cfe8d){return function(_0x40a096){if(_0x40a096){return _0x40a096['destroy']()[_0xb51e('0x2a')](function(){var _0x25fd88=_0x40a096['get']({'plain':!![]});var _0x2aea12=_0xb51e('0x2b');return db[_0xb51e('0x2c')][_0xb51e('0x2d')]({'where':{'type':_0x2aea12,'resourceId':_0x25fd88['id']}})[_0xb51e('0x2a')](function(){return _0x40a096;});})[_0xb51e('0x2a')](function(){_0x554629['status'](0xcc)[_0xb51e('0x1f')]();});}};}function handleEntityNotFound(_0x346993,_0x24bd8d){return function(_0x1fe106){if(!_0x1fe106){_0x346993[_0xb51e('0x1e')](0x194);}return _0x1fe106;};}function handleError(_0xe6a1d8,_0x54dc99){_0x54dc99=_0x54dc99||0x1f4;return function(_0x448a79){logger['error'](_0x448a79['stack']);if(_0x448a79['name']){delete _0x448a79[_0xb51e('0x2e')];}_0xe6a1d8[_0xb51e('0x20')](_0x54dc99)[_0xb51e('0x2f')](_0x448a79);};}exports[_0xb51e('0x30')]=function(_0x2044f1,_0x530197){var _0x396ac6={},_0x3e0431={},_0x4258a0={'count':0x0,'rows':[]};var _0x1faa5a=_[_0xb51e('0x31')](db[_0xb51e('0x32')]['rawAttributes'],function(_0x2555dd){return{'name':_0x2555dd[_0xb51e('0x33')],'type':_0x2555dd[_0xb51e('0x34')]['key']};});_0x3e0431[_0xb51e('0x35')]=_['map'](_0x1faa5a,_0xb51e('0x2e'));_0x3e0431[_0xb51e('0x36')]=_['keys'](_0x2044f1['query']);_0x3e0431[_0xb51e('0x37')]=_[_0xb51e('0x38')](_0x3e0431[_0xb51e('0x35')],_0x3e0431['query']);_0x396ac6[_0xb51e('0x39')]=_['intersection'](_0x3e0431[_0xb51e('0x35')],qs['fields'](_0x2044f1[_0xb51e('0x36')][_0xb51e('0x3a')]));_0x396ac6['attributes']=_0x396ac6[_0xb51e('0x39')][_0xb51e('0x3b')]?_0x396ac6[_0xb51e('0x39')]:_0x3e0431[_0xb51e('0x35')];if(!_0x2044f1[_0xb51e('0x36')][_0xb51e('0x3c')]('nolimit')){_0x396ac6['limit']=qs[_0xb51e('0x24')](_0x2044f1[_0xb51e('0x36')][_0xb51e('0x24')]);_0x396ac6[_0xb51e('0x22')]=qs[_0xb51e('0x22')](_0x2044f1[_0xb51e('0x36')][_0xb51e('0x22')]);}_0x396ac6[_0xb51e('0x3d')]=qs[_0xb51e('0x3e')](_0x2044f1['query'][_0xb51e('0x3e')]);_0x396ac6[_0xb51e('0x3f')]=qs[_0xb51e('0x37')](_['pick'](_0x2044f1[_0xb51e('0x36')],_0x3e0431[_0xb51e('0x37')]),_0x1faa5a);if(_0x2044f1[_0xb51e('0x36')][_0xb51e('0x40')]){_0x396ac6[_0xb51e('0x3f')]=_['merge'](_0x396ac6['where'],{'$or':_['map'](_0x1faa5a,function(_0x40aebd){if(_0x40aebd[_0xb51e('0x34')]!==_0xb51e('0x41')){var _0x117f6b={};_0x117f6b[_0x40aebd['name']]={'$like':'%'+_0x2044f1[_0xb51e('0x36')][_0xb51e('0x40')]+'%'};return _0x117f6b;}})});}_0x396ac6=_[_0xb51e('0x42')]({},_0x396ac6,_0x2044f1['options']);var _0x594dee={'where':_0x396ac6[_0xb51e('0x3f')]};return db[_0xb51e('0x32')][_0xb51e('0x25')](_0x594dee)[_0xb51e('0x2a')](function(_0x240e11){_0x4258a0['count']=_0x240e11;if(_0x2044f1[_0xb51e('0x36')][_0xb51e('0x43')]){_0x396ac6['include']=[{'all':!![]}];}return db[_0xb51e('0x32')][_0xb51e('0x44')](_0x396ac6);})[_0xb51e('0x2a')](function(_0x34a7df){_0x4258a0[_0xb51e('0x45')]=_0x34a7df;return _0x4258a0;})[_0xb51e('0x2a')](respondWithFilteredResult(_0x530197,_0x396ac6))[_0xb51e('0x46')](handleError(_0x530197,null));};exports[_0xb51e('0x47')]=function(_0x3c3351,_0x26ea73){var _0x576b65={'raw':!![],'where':{'id':_0x3c3351[_0xb51e('0x48')]['id']}},_0x38276d={};_0x38276d[_0xb51e('0x35')]=_[_0xb51e('0x49')](db[_0xb51e('0x32')][_0xb51e('0x4a')]);_0x38276d['query']=_[_0xb51e('0x49')](_0x3c3351[_0xb51e('0x36')]);_0x38276d['filters']=_['intersection'](_0x38276d['model'],_0x38276d['query']);_0x576b65[_0xb51e('0x39')]=_[_0xb51e('0x38')](_0x38276d[_0xb51e('0x35')],qs[_0xb51e('0x3a')](_0x3c3351['query'][_0xb51e('0x3a')]));_0x576b65[_0xb51e('0x39')]=_0x576b65[_0xb51e('0x39')]['length']?_0x576b65[_0xb51e('0x39')]:_0x38276d[_0xb51e('0x35')];if(_0x3c3351['query'][_0xb51e('0x43')]){_0x576b65['include']=[{'all':!![]}];}_0x576b65=_[_0xb51e('0x42')]({},_0x576b65,_0x3c3351[_0xb51e('0x4b')]);return db[_0xb51e('0x32')]['find'](_0x576b65)[_0xb51e('0x2a')](handleEntityNotFound(_0x26ea73,null))[_0xb51e('0x2a')](respondWithResult(_0x26ea73,null))[_0xb51e('0x46')](handleError(_0x26ea73,null));};exports[_0xb51e('0x4c')]=function(_0x26a8b1,_0x129395){return db[_0xb51e('0x32')][_0xb51e('0x4c')](_0x26a8b1[_0xb51e('0x4d')],{})['then'](function(_0x479652){var _0x1293f0=_0x26a8b1['user'][_0xb51e('0x4e')]({'plain':!![]});if(!_0x1293f0)throw new Error(_0xb51e('0x4f'));if(_0x1293f0[_0xb51e('0x50')]===_0xb51e('0x51')){var _0x1e2e95=_0x479652[_0xb51e('0x4e')]({'plain':!![]});var _0x2ab13c='WhatsappQueues';return db[_0xb51e('0x52')][_0xb51e('0x53')]({'where':{'name':_0x2ab13c,'userProfileId':_0x1293f0['userProfileId']},'raw':!![]})[_0xb51e('0x2a')](function(_0x331950){if(_0x331950&&_0x331950['autoAssociation']===0x0){return db[_0xb51e('0x2c')][_0xb51e('0x4c')]({'name':_0x1e2e95[_0xb51e('0x2e')],'resourceId':_0x1e2e95['id'],'type':_0x331950[_0xb51e('0x2e')],'sectionId':_0x331950['id']},{})[_0xb51e('0x2a')](function(){return _0x479652;});}else{return _0x479652;}})[_0xb51e('0x46')](function(_0x5768d1){logger[_0xb51e('0x54')](_0xb51e('0x55'),_0x5768d1);throw _0x5768d1;});}return _0x479652;})[_0xb51e('0x2a')](respondWithResult(_0x129395,0xc9))['catch'](handleError(_0x129395,null));};exports[_0xb51e('0x29')]=function(_0x2dc75c,_0x45e418){if(_0x2dc75c[_0xb51e('0x4d')]['id']){delete _0x2dc75c[_0xb51e('0x4d')]['id'];}return db[_0xb51e('0x32')][_0xb51e('0x53')]({'where':{'id':_0x2dc75c['params']['id']}})['then'](handleEntityNotFound(_0x45e418,null))[_0xb51e('0x2a')](saveUpdates(_0x2dc75c[_0xb51e('0x4d')],null))[_0xb51e('0x2a')](respondWithResult(_0x45e418,null))['catch'](handleError(_0x45e418,null));};exports[_0xb51e('0x2d')]=function(_0x1839b9,_0x485272){return db[_0xb51e('0x32')][_0xb51e('0x53')]({'where':{'id':_0x1839b9['params']['id']}})[_0xb51e('0x2a')](handleEntityNotFound(_0x485272,null))['then'](removeEntity(_0x485272,null))[_0xb51e('0x46')](handleError(_0x485272,null));};exports[_0xb51e('0x56')]=function(_0x35d7ea,_0x14ddc8){return db[_0xb51e('0x32')][_0xb51e('0x56')]()[_0xb51e('0x2a')](respondWithResult(_0x14ddc8,null))[_0xb51e('0x46')](handleError(_0x14ddc8,null));};exports['getMembers']=function(_0x57fa26,_0x43a2d1,_0x3cd484){var _0x27b4aa={'raw':!![],'where':{}},_0x29f1a4={},_0xdeb5e0;return db['WhatsappQueue'][_0xb51e('0x57')]({'where':{'id':_0x57fa26['params']['id']}})[_0xb51e('0x2a')](handleEntityNotFound(_0x43a2d1,null))['then'](function(_0x358105){if(_0x358105){_0xdeb5e0=_0x358105[_0xb51e('0x4e')]({'plain':!![]});_0x29f1a4[_0xb51e('0x35')]=_[_0xb51e('0x49')](db[_0xb51e('0x58')][_0xb51e('0x4a')]);_0x29f1a4[_0xb51e('0x36')]=_[_0xb51e('0x49')](_0x57fa26['query']);_0x29f1a4[_0xb51e('0x37')]=_[_0xb51e('0x38')](_0x29f1a4[_0xb51e('0x35')],_0x29f1a4[_0xb51e('0x36')]);_0x27b4aa[_0xb51e('0x39')]=_[_0xb51e('0x38')](_0x29f1a4[_0xb51e('0x35')],qs[_0xb51e('0x3a')](_0x57fa26['query'][_0xb51e('0x3a')]));_0x27b4aa[_0xb51e('0x39')]=_0x27b4aa[_0xb51e('0x39')][_0xb51e('0x3b')]?_0x27b4aa[_0xb51e('0x39')]:_0x29f1a4[_0xb51e('0x35')];if(!_0x57fa26['query']['hasOwnProperty'](_0xb51e('0x59'))){_0x27b4aa['limit']=qs['limit'](_0x57fa26[_0xb51e('0x36')][_0xb51e('0x24')]);_0x27b4aa[_0xb51e('0x22')]=qs[_0xb51e('0x22')](_0x57fa26[_0xb51e('0x36')][_0xb51e('0x22')]);}_0x27b4aa[_0xb51e('0x3d')]=qs[_0xb51e('0x3e')](_0x57fa26[_0xb51e('0x36')]['sort']);_0x27b4aa['where']=qs[_0xb51e('0x37')](_['pick'](_0x57fa26[_0xb51e('0x36')],_0x29f1a4[_0xb51e('0x37')]));_0x27b4aa[_0xb51e('0x3f')][_0xb51e('0x5a')]=_0x358105['id'];if(_0x57fa26['query'][_0xb51e('0x40')]){_0x27b4aa[_0xb51e('0x3f')]=_['merge'](_0x27b4aa['where'],{'$or':_[_0xb51e('0x31')](_0x27b4aa[_0xb51e('0x39')],function(_0x2ec0ef){var _0x22917b={};_0x22917b[_0x2ec0ef]={'$like':'%'+_0x57fa26[_0xb51e('0x36')][_0xb51e('0x40')]+'%'};return _0x22917b;})});}_0x27b4aa=_[_0xb51e('0x42')]({},_0x27b4aa,_0x57fa26[_0xb51e('0x4b')]);return db['UserWhatsappQueue'][_0xb51e('0x44')](_0x27b4aa);}})[_0xb51e('0x2a')](function(_0xb6c0a7){if(_0xb6c0a7){return db[_0xb51e('0x5b')][_0xb51e('0x5c')]({'where':{'id':_[_0xb51e('0x31')](_0xb6c0a7,_0xb51e('0x5d')),'role':_0xb51e('0x5e')},'attributes':['id',_0xb51e('0x2e'),_0xb51e('0x5f'),'updatedAt','createdAt']});}})[_0xb51e('0x2a')](function(_0x432206){if(_0x432206){return{'count':_0x432206[_0xb51e('0x25')],'rows':_[_0xb51e('0x31')](_0x432206['rows'],function(_0x465fe7){return{'membername':_0x465fe7['name'],'UserId':_0x465fe7['id'],'queue_name':_0xdeb5e0[_0xb51e('0x2e')],'WhatsappQueueId':_0xdeb5e0['id'],'interface':util[_0xb51e('0x60')]('%s/%s','SIP',_0x465fe7[_0xb51e('0x2e')]),'penalty':0x0,'paused':_0x465fe7['whatsappPause'],'createdAt':_0x465fe7[_0xb51e('0x61')],'updatedAt':_0x465fe7[_0xb51e('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb51e('0x2a')](respondWithFilteredResult(_0x43a2d1,_0x27b4aa))[_0xb51e('0x46')](handleError(_0x43a2d1,null));};exports['getTeams']=function(_0x505986,_0xd615bc,_0x497861){var _0x5bdc70={};var _0x3f6c50={};var _0x51a508;var _0x2eee00;return db[_0xb51e('0x32')][_0xb51e('0x57')]({'where':{'id':_0x505986['params']['id']}})['then'](handleEntityNotFound(_0xd615bc,null))[_0xb51e('0x2a')](function(_0x4df375){if(_0x4df375){_0x51a508=_0x4df375;_0x3f6c50[_0xb51e('0x35')]=_[_0xb51e('0x49')](db[_0xb51e('0x63')][_0xb51e('0x4a')]);_0x3f6c50['query']=_[_0xb51e('0x49')](_0x505986[_0xb51e('0x36')]);_0x3f6c50[_0xb51e('0x37')]=_['intersection'](_0x3f6c50[_0xb51e('0x35')],_0x3f6c50[_0xb51e('0x36')]);_0x5bdc70['attributes']=_[_0xb51e('0x38')](_0x3f6c50[_0xb51e('0x35')],qs[_0xb51e('0x3a')](_0x505986[_0xb51e('0x36')]['fields']));_0x5bdc70[_0xb51e('0x39')]=_0x5bdc70[_0xb51e('0x39')]['length']?_0x5bdc70[_0xb51e('0x39')]:_0x3f6c50[_0xb51e('0x35')];_0x5bdc70[_0xb51e('0x3d')]=qs['sort'](_0x505986['query'][_0xb51e('0x3e')]);_0x5bdc70[_0xb51e('0x3f')]=qs[_0xb51e('0x37')](_['pick'](_0x505986['query'],_0x3f6c50[_0xb51e('0x37')]));if(_0x505986[_0xb51e('0x36')][_0xb51e('0x40')]){_0x5bdc70[_0xb51e('0x3f')]=_[_0xb51e('0x42')](_0x5bdc70[_0xb51e('0x3f')],{'$or':_[_0xb51e('0x31')](_0x5bdc70[_0xb51e('0x39')],function(_0x50bbfd){var _0x24fc49={};_0x24fc49[_0x50bbfd]={'$like':'%'+_0x505986['query'][_0xb51e('0x40')]+'%'};return _0x24fc49;})});}_0x5bdc70=_[_0xb51e('0x42')]({},_0x5bdc70,_0x505986['options']);return _0x51a508[_0xb51e('0x64')](_0x5bdc70);}})[_0xb51e('0x2a')](function(_0x5f566b){if(_0x5f566b){_0x2eee00=_0x5f566b[_0xb51e('0x3b')];if(!_0x505986[_0xb51e('0x36')][_0xb51e('0x3c')](_0xb51e('0x59'))){_0x5bdc70[_0xb51e('0x24')]=qs[_0xb51e('0x24')](_0x505986[_0xb51e('0x36')][_0xb51e('0x24')]);_0x5bdc70[_0xb51e('0x22')]=qs[_0xb51e('0x22')](_0x505986[_0xb51e('0x36')][_0xb51e('0x22')]);}return _0x51a508[_0xb51e('0x64')](_0x5bdc70);}})[_0xb51e('0x2a')](function(_0x4ec770){if(_0x4ec770){return _0x4ec770?{'count':_0x2eee00,'rows':_0x4ec770}:null;}})[_0xb51e('0x2a')](respondWithResult(_0xd615bc,null))[_0xb51e('0x46')](handleError(_0xd615bc,null));};exports[_0xb51e('0x65')]=function(_0x37d7ea,_0x1100b1,_0x4172be){var _0x33ccb9=_0x37d7ea[_0xb51e('0x4d')][_0xb51e('0x66')];return db[_0xb51e('0x63')][_0xb51e('0x44')]({'where':{'id':_0x33ccb9},'attributes':['id'],'include':[{'model':db[_0xb51e('0x5b')],'as':_0xb51e('0x67'),'attributes':['id',_0xb51e('0x2e'),_0xb51e('0x68'),_0xb51e('0x69'),_0xb51e('0x6a')],'raw':!![]}]})[_0xb51e('0x2a')](function(_0x3fbea6){if(_0x3fbea6){var _0x33147d=_[_0xb51e('0x6b')](_0x3fbea6,function(_0x3c41ec){var _0xc96599=_0x3c41ec[_0xb51e('0x4e')]({'plain':!![]});return _0xc96599[_0xb51e('0x67')];});return db[_0xb51e('0x32')]['find']({'where':{'id':_0x37d7ea[_0xb51e('0x48')]['id']}})[_0xb51e('0x2a')](function(_0x1a9650){return db['sequelize'][_0xb51e('0x6c')](function(_0x594b13){return _0x1a9650[_0xb51e('0x65')](_0x33ccb9,{'transaction':_0x594b13})[_0xb51e('0x2a')](function(){return BPromise['each'](_0x33147d,function(_0x34bc7b){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x34bc7b['id'],'WhatsappQueueId':_0x37d7ea[_0xb51e('0x48')]['id']},'transaction':_0x594b13});});})[_0xb51e('0x2a')](function(){_0x33147d['forEach'](function(_0x47caba){socket['emit'](_0xb51e('0x6d'),{'UserId':_0x47caba['id'],'WhatsappQueueId':_0x1a9650['id']});});});});});}})[_0xb51e('0x2a')](respondWithStatusCode(_0x1100b1,null))[_0xb51e('0x46')](handleError(_0x1100b1,null));};exports[_0xb51e('0x6e')]=function(_0x176a54,_0x15d367,_0x395569){return db[_0xb51e('0x63')][_0xb51e('0x44')]({'where':{'id':_0x176a54[_0xb51e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb51e('0x5b')],'as':_0xb51e('0x67'),'attributes':['id'],'raw':!![]}]})[_0xb51e('0x2a')](handleEntityNotFound(_0x15d367,null))[_0xb51e('0x2a')](function(_0x450df9){var _0x20f9a9=_[_0xb51e('0x31')](_0x450df9,'id');var _0x5f3622=[];var _0x30db71=[];var _0x41e5f7=squel[_0xb51e('0x6f')]();_0x41e5f7[_0xb51e('0x70')](_0xb51e('0x71'))[_0xb51e('0x72')](_0xb51e('0x73'),'tq')[_0xb51e('0x74')](_0xb51e('0x75'),'ut',_0xb51e('0x76'))['where'](_0xb51e('0x77'),_0x176a54['params']['id']);for(var _0x51b995=0x0;_0x51b995<_0x450df9['length'];_0x51b995+=0x1){let _0x347c35=_0x450df9[_0x51b995];for(var _0x7c8a23=0x0;_0x7c8a23<_0x347c35['Agents'][_0xb51e('0x3b')];_0x7c8a23+=0x1){let _0xa1202f=_0x347c35[_0xb51e('0x67')][_0x7c8a23];var _0xf2cc18=_0x41e5f7[_0xb51e('0x78')]();_0xf2cc18[_0xb51e('0x3f')](_0xb51e('0x79'),_0xa1202f['id']);_0x30db71[_0xb51e('0x7a')](db['sequelize'][_0xb51e('0x36')](_0xf2cc18['toString'](),{'type':db[_0xb51e('0x7b')][_0xb51e('0x7c')][_0xb51e('0x7d')]})[_0xb51e('0x2a')](function(_0x312d0a){if(_0x312d0a[_0xb51e('0x3b')]===0x1){return _0xa1202f['id'];}else{var _0x129aa5=_[_0xb51e('0x7e')](_[_0xb51e('0x31')](_0x312d0a,'TeamId'),function(_0x36e2df){return _[_0xb51e('0x7f')](_0x20f9a9,_0x36e2df);});if(_0x129aa5){return _0xa1202f['id'];}}}));}}return BPromise[_0xb51e('0x80')](_0x30db71)[_0xb51e('0x2a')](function(_0xa5016d){_0x5f3622=_(_0x5f3622)[_0xb51e('0x81')](_0xa5016d)[_0xb51e('0x82')]()[_0xb51e('0x83')]();return db[_0xb51e('0x32')]['find']({'where':{'id':_0x176a54[_0xb51e('0x48')]['id']}})[_0xb51e('0x2a')](function(_0x1a9e2b){return db[_0xb51e('0x7b')][_0xb51e('0x6c')](function(_0x3c5790){return _0x1a9e2b['removeTeams'](_0x176a54[_0xb51e('0x36')][_0xb51e('0x66')],{'transaction':_0x3c5790})[_0xb51e('0x2a')](function(){if(!_[_0xb51e('0x84')](_0x5f3622)){return _0x1a9e2b[_0xb51e('0x85')](_0x5f3622,{'transaction':_0x3c5790});}})[_0xb51e('0x2a')](function(){_0x5f3622[_0xb51e('0x86')](function(_0x1d6e28){socket['emit'](_0xb51e('0x87'),{'UserId':_0x1d6e28,'WhatsappQueueId':_0x1a9e2b['id']});});});});});});})[_0xb51e('0x2a')](respondWithStatusCode(_0x15d367,null))[_0xb51e('0x46')](handleError(_0x15d367,null));};exports[_0xb51e('0x88')]=function(_0x3c0b4d,_0x5569ec,_0x72b40a){return db[_0xb51e('0x32')][_0xb51e('0x53')]({'where':{'id':_0x3c0b4d['params']['id']}})[_0xb51e('0x2a')](handleEntityNotFound(_0x5569ec,null))[_0xb51e('0x2a')](function(_0x3921dc){if(_0x3921dc){return _0x3921dc['addAgents'](_0x3c0b4d[_0xb51e('0x4d')][_0xb51e('0x66')],_[_0xb51e('0x89')](_0x3c0b4d[_0xb51e('0x4d')],['ids','id'])||{})[_0xb51e('0x8a')](function(_0x1c7415){for(var _0x3edfaa=0x0;_0x3edfaa<_0x3c0b4d[_0xb51e('0x4d')][_0xb51e('0x66')][_0xb51e('0x3b')];_0x3edfaa+=0x1){socket[_0xb51e('0x8b')]('userWhatsappQueue:save',{'UserId':Number(_0x3c0b4d[_0xb51e('0x4d')][_0xb51e('0x66')][_0x3edfaa]),'WhatsappQueueId':Number(_0x3c0b4d[_0xb51e('0x48')]['id'])});}return _0x1c7415;});}})[_0xb51e('0x2a')](respondWithResult(_0x5569ec,null))['catch'](handleError(_0x5569ec,null));};exports[_0xb51e('0x85')]=function(_0x29eb09,_0x3f991f,_0x48033a){return db[_0xb51e('0x32')][_0xb51e('0x53')]({'where':{'id':_0x29eb09[_0xb51e('0x48')]['id']}})[_0xb51e('0x2a')](handleEntityNotFound(_0x3f991f,null))['then'](function(_0x22886c){if(_0x22886c){return _0x22886c[_0xb51e('0x85')](_0x29eb09[_0xb51e('0x36')][_0xb51e('0x66')])[_0xb51e('0x2a')](function(){if(_[_0xb51e('0x8c')](_0x29eb09[_0xb51e('0x36')]['ids'])){for(var _0x208452=0x0;_0x208452<_0x29eb09['query'][_0xb51e('0x66')]['length'];_0x208452+=0x1){socket[_0xb51e('0x8b')](_0xb51e('0x87'),{'UserId':Number(_0x29eb09[_0xb51e('0x36')][_0xb51e('0x66')][_0x208452]),'WhatsappQueueId':Number(_0x29eb09[_0xb51e('0x48')]['id'])});}}else{socket[_0xb51e('0x8b')](_0xb51e('0x87'),{'UserId':Number(_0x29eb09[_0xb51e('0x36')][_0xb51e('0x66')]),'WhatsappQueueId':Number(_0x29eb09['params']['id'])});}});}})[_0xb51e('0x2a')](respondWithStatusCode(_0x3f991f,null))['catch'](handleError(_0x3f991f,null));};exports[_0xb51e('0x8d')]=function(_0x580f61,_0x2ef238,_0x29afae){var _0x4b8faa={};var _0x160c33={};var _0x65741a;var _0x514dce;return db[_0xb51e('0x32')][_0xb51e('0x57')]({'where':{'id':_0x580f61[_0xb51e('0x48')]['id']}})[_0xb51e('0x2a')](handleEntityNotFound(_0x2ef238,null))[_0xb51e('0x2a')](function(_0x10f39b){if(_0x10f39b){_0x65741a=_0x10f39b;_0x160c33[_0xb51e('0x35')]=_['keys'](db['User'][_0xb51e('0x4a')]);_0x160c33[_0xb51e('0x36')]=_['keys'](_0x580f61[_0xb51e('0x36')]);_0x160c33[_0xb51e('0x37')]=_['intersection'](_0x160c33[_0xb51e('0x35')],_0x160c33[_0xb51e('0x36')]);_0x4b8faa['attributes']=_[_0xb51e('0x38')](_0x160c33[_0xb51e('0x35')],qs[_0xb51e('0x3a')](_0x580f61['query'][_0xb51e('0x3a')]));_0x4b8faa[_0xb51e('0x39')]=_0x4b8faa['attributes'][_0xb51e('0x3b')]?_0x4b8faa[_0xb51e('0x39')]:_0x160c33['model'];_0x4b8faa[_0xb51e('0x3d')]=qs[_0xb51e('0x3e')](_0x580f61[_0xb51e('0x36')][_0xb51e('0x3e')]);_0x4b8faa[_0xb51e('0x3f')]=qs[_0xb51e('0x37')](_['pick'](_0x580f61['query'],_0x160c33['filters']));if(_0x580f61['query'][_0xb51e('0x40')]){_0x4b8faa[_0xb51e('0x3f')]=_['merge'](_0x4b8faa[_0xb51e('0x3f')],{'$or':_[_0xb51e('0x31')](_0x4b8faa[_0xb51e('0x39')],function(_0x387a79){var _0x48217e={};_0x48217e[_0x387a79]={'$like':'%'+_0x580f61['query'][_0xb51e('0x40')]+'%'};return _0x48217e;})});}_0x4b8faa=_[_0xb51e('0x42')]({},_0x4b8faa,_0x580f61[_0xb51e('0x4b')]);return _0x65741a[_0xb51e('0x8d')](_0x4b8faa);}})['then'](function(_0x2b96f1){if(_0x2b96f1){_0x514dce=_0x2b96f1[_0xb51e('0x3b')];if(!_0x580f61[_0xb51e('0x36')][_0xb51e('0x3c')]('nolimit')){_0x4b8faa['limit']=qs[_0xb51e('0x24')](_0x580f61[_0xb51e('0x36')]['limit']);_0x4b8faa[_0xb51e('0x22')]=qs[_0xb51e('0x22')](_0x580f61[_0xb51e('0x36')][_0xb51e('0x22')]);}return _0x65741a[_0xb51e('0x8d')](_0x4b8faa);}})[_0xb51e('0x2a')](function(_0x358343){if(_0x358343){return _0x358343?{'count':_0x514dce,'rows':_0x358343}:null;}})[_0xb51e('0x2a')](respondWithResult(_0x2ef238,null))['catch'](handleError(_0x2ef238,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 197a67d..f3df4c6 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 _0xf338=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x94763a,_0x2cf313){var _0x16ea37=function(_0x542cb1){while(--_0x542cb1){_0x94763a['push'](_0x94763a['shift']());}};_0x16ea37(++_0x2cf313);}(_0xf338,0x188));var _0x8f33=function(_0x14d76a,_0x38c683){_0x14d76a=_0x14d76a-0x0;var _0x5baef8=_0xf338[_0x14d76a];return _0x5baef8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x8f33('0x0'))['db'][_0x8f33('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8f33('0x2')](0x0);var events={'afterCreate':_0x8f33('0x3'),'afterUpdate':_0x8f33('0x4'),'afterDestroy':_0x8f33('0x5')};function emitEvent(_0x350d79){return function(_0x749325,_0x16bd62,_0x187058){WhatsappQueueEvents['emit'](_0x350d79+':'+_0x749325['id'],_0x749325);WhatsappQueueEvents['emit'](_0x350d79,_0x749325);_0x187058(null);};}for(var e in events){if(events[_0x8f33('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x4635=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4635,0x16d));var _0x5463=function(_0x3cc309,_0x1731a2){_0x3cc309=_0x3cc309-0x0;var _0x330321=_0x4635[_0x3cc309];return _0x330321;};'use strict';var EventEmitter=require(_0x5463('0x0'));var WhatsappQueue=require(_0x5463('0x1'))['db'][_0x5463('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5463('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5463('0x4'),'afterDestroy':_0x5463('0x5')};function emitEvent(_0x1e3138){return function(_0x49a7af,_0x507831,_0x435518){WhatsappQueueEvents['emit'](_0x1e3138+':'+_0x49a7af['id'],_0x49a7af);WhatsappQueueEvents[_0x5463('0x6')](_0x1e3138,_0x49a7af);_0x435518(null);};}for(var e in events){if(events[_0x5463('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5463('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9b5fdb1..2e21dff 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 _0x52c1=['moment','request-promise','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x425635,_0x2c2fcf){var _0x26b976=function(_0x2f5c47){while(--_0x2f5c47){_0x425635['push'](_0x425635['shift']());}};_0x26b976(++_0x2c2fcf);}(_0x52c1,0xb1));var _0x152c=function(_0x4bd439,_0x3755f8){_0x4bd439=_0x4bd439-0x0;var _0x4adefa=_0x52c1[_0x4bd439];return _0x4adefa;};'use strict';var _=require(_0x152c('0x0'));var util=require('util');var logger=require(_0x152c('0x1'))(_0x152c('0x2'));var moment=require(_0x152c('0x3'));var BPromise=require('bluebird');var rp=require(_0x152c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x152c('0x5'));var config=require('../../config/environment');var attributes=require(_0x152c('0x6'));module[_0x152c('0x7')]=function(_0x25aa9e,_0x21d262){return _0x25aa9e[_0x152c('0x8')](_0x152c('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x186a=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues','lodash','api','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x186a,0x1ca));var _0xa186=function(_0x22ff9a,_0x3d2965){_0x22ff9a=_0x22ff9a-0x0;var _0x185946=_0x186a[_0x22ff9a];return _0x185946;};'use strict';var _=require(_0xa186('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa186('0x1'));var moment=require(_0xa186('0x2'));var BPromise=require(_0xa186('0x3'));var rp=require(_0xa186('0x4'));var fs=require('fs');var path=require(_0xa186('0x5'));var rimraf=require(_0xa186('0x6'));var config=require(_0xa186('0x7'));var attributes=require(_0xa186('0x8'));module['exports']=function(_0x5aefde,_0x189677){return _0x5aefde['define'](_0xa186('0x9'),attributes,{'tableName':_0xa186('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 8bcba28..31c5231 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 _0x3374=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','include','model','attributes','debug','ShowWhatsappQueue','find','map','lodash','moment','randomstring'];(function(_0x12d403,_0x2a1d4f){var _0x544ced=function(_0x2772f2){while(--_0x2772f2){_0x12d403['push'](_0x12d403['shift']());}};_0x544ced(++_0x2a1d4f);}(_0x3374,0xf9));var _0x4337=function(_0x4c81cb,_0x5a0b47){_0x4c81cb=_0x4c81cb-0x0;var _0x85c34a=_0x3374[_0x4c81cb];return _0x85c34a;};'use strict';var _=require(_0x4337('0x0'));var util=require('util');var moment=require(_0x4337('0x1'));var BPromise=require('bluebird');var rs=require(_0x4337('0x2'));var fs=require('fs');var Redis=require(_0x4337('0x3'));var db=require(_0x4337('0x4'))['db'];var utils=require(_0x4337('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4337('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4337('0x7')][_0x4337('0x8')]({'port':0x232a});config[_0x4337('0x9')]=_[_0x4337('0xa')](config[_0x4337('0x9')],{'host':_0x4337('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x26925e,_0x26d6db,_0x2e12eb){return new BPromise(function(_0x38ae56,_0x2d37d2){return client[_0x4337('0xc')](_0x26925e,_0x2e12eb)[_0x4337('0xd')](function(_0x49a02c){logger[_0x4337('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0x26d6db,_0x4337('0xf'));logger['debug'](_0x4337('0x10'),_0x26d6db,'request\x20sent',JSON[_0x4337('0x11')](_0x49a02c));if(_0x49a02c[_0x4337('0x12')]){if(_0x49a02c[_0x4337('0x12')][_0x4337('0x13')]===0x1f4){logger['error'](_0x4337('0x14'),_0x26d6db,_0x49a02c[_0x4337('0x12')][_0x4337('0x15')]);return _0x2d37d2(_0x49a02c['error'][_0x4337('0x15')]);}logger[_0x4337('0x12')](_0x4337('0x14'),_0x26d6db,_0x49a02c[_0x4337('0x12')]['message']);return _0x38ae56(_0x49a02c[_0x4337('0x12')][_0x4337('0x15')]);}else{logger[_0x4337('0xe')](_0x4337('0x14'),_0x26d6db,'request\x20sent');_0x38ae56(_0x49a02c[_0x4337('0x16')][_0x4337('0x15')]);}})[_0x4337('0x17')](function(_0x57a37a){logger['error'](_0x4337('0x14'),_0x26d6db,_0x57a37a);_0x2d37d2(_0x57a37a);});});}exports[_0x4337('0x18')]=function(_0x3663c1){var _0x26e3ed=this;return new Promise(function(_0x18836b,_0x2049d6){return db[_0x4337('0x19')]['findAll']({'raw':_0x3663c1[_0x4337('0x1a')]?_0x3663c1[_0x4337('0x1a')][_0x4337('0x1b')]===undefined?!![]:![]:!![],'where':_0x3663c1[_0x4337('0x1a')]?_0x3663c1[_0x4337('0x1a')][_0x4337('0x1c')]||null:null,'attributes':_0x3663c1[_0x4337('0x1a')]?_0x3663c1[_0x4337('0x1a')]['attributes']||null:null,'limit':_0x3663c1[_0x4337('0x1a')]?_0x3663c1['options']['limit']||null:null,'include':_0x3663c1[_0x4337('0x1a')]?_0x3663c1['options'][_0x4337('0x1d')]?_['map'](_0x3663c1[_0x4337('0x1a')][_0x4337('0x1d')],function(_0x2b01b5){return{'model':db[_0x2b01b5[_0x4337('0x1e')]],'as':_0x2b01b5['as'],'attributes':_0x2b01b5[_0x4337('0x1f')],'include':_0x2b01b5[_0x4337('0x1d')]?_['map'](_0x2b01b5[_0x4337('0x1d')],function(_0x3b5d78){return{'model':db[_0x3b5d78[_0x4337('0x1e')]],'as':_0x3b5d78['as'],'attributes':_0x3b5d78[_0x4337('0x1f')],'include':_0x3b5d78[_0x4337('0x1d')]?_['map'](_0x3b5d78['include'],function(_0x3a3029){return{'model':db[_0x3a3029[_0x4337('0x1e')]],'as':_0x3a3029['as'],'attributes':_0x3a3029['attributes']};}):[]};}):[]};}):[]:[]})[_0x4337('0xd')](function(_0x5647e1){logger[_0x4337('0xe')](_0x4337('0x18'),_0x3663c1);logger[_0x4337('0x20')](_0x4337('0x18'),_0x3663c1,JSON[_0x4337('0x11')](_0x5647e1));_0x18836b(_0x5647e1);})[_0x4337('0x17')](function(_0x5b450e){logger['error'](_0x4337('0x18'),_0x5b450e[_0x4337('0x15')],_0x3663c1);_0x2049d6(_0x26e3ed[_0x4337('0x12')](0x1f4,_0x5b450e['message']));});});};exports[_0x4337('0x21')]=function(_0x87898){var _0x85ee2c=this;return new Promise(function(_0x5a6103,_0x505e21){return db[_0x4337('0x19')][_0x4337('0x22')]({'raw':_0x87898['options']?_0x87898[_0x4337('0x1a')][_0x4337('0x1b')]===undefined?!![]:![]:!![],'where':_0x87898[_0x4337('0x1a')]?_0x87898[_0x4337('0x1a')]['where']||null:null,'attributes':_0x87898['options']?_0x87898[_0x4337('0x1a')][_0x4337('0x1f')]||null:null,'include':_0x87898['options']?_0x87898[_0x4337('0x1a')][_0x4337('0x1d')]?_[_0x4337('0x23')](_0x87898['options'][_0x4337('0x1d')],function(_0x43d0e8){return{'model':db[_0x43d0e8[_0x4337('0x1e')]],'as':_0x43d0e8['as'],'attributes':_0x43d0e8[_0x4337('0x1f')],'include':_0x43d0e8[_0x4337('0x1d')]?_[_0x4337('0x23')](_0x43d0e8[_0x4337('0x1d')],function(_0x4b09f1){return{'model':db[_0x4b09f1['model']],'as':_0x4b09f1['as'],'attributes':_0x4b09f1[_0x4337('0x1f')],'include':_0x4b09f1['include']?_[_0x4337('0x23')](_0x4b09f1[_0x4337('0x1d')],function(_0x22fcf8){return{'model':db[_0x22fcf8[_0x4337('0x1e')]],'as':_0x22fcf8['as'],'attributes':_0x22fcf8[_0x4337('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4337('0xd')](function(_0x5097b2){logger[_0x4337('0xe')](_0x4337('0x21'),_0x87898);logger[_0x4337('0x20')](_0x4337('0x21'),_0x87898,JSON['stringify'](_0x5097b2));_0x5a6103(_0x5097b2);})[_0x4337('0x17')](function(_0x19255e){logger[_0x4337('0x12')](_0x4337('0x21'),_0x19255e['message'],_0x87898);_0x505e21(_0x85ee2c[_0x4337('0x12')](0x1f4,_0x19255e[_0x4337('0x15')]));});});}; \ No newline at end of file +var _0x0750=['ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','register','request','then','debug','request\x20sent','stringify','error','message','info','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','catch'];(function(_0x49dac8,_0x1e22de){var _0x29a744=function(_0x3b4c29){while(--_0x3b4c29){_0x49dac8['push'](_0x49dac8['shift']());}};_0x29a744(++_0x1e22de);}(_0x0750,0x193));var _0x0075=function(_0x35d8d7,_0x18921c){_0x35d8d7=_0x35d8d7-0x0;var _0x24b3ca=_0x0750[_0x35d8d7];return _0x24b3ca;};'use strict';var _=require(_0x0075('0x0'));var util=require(_0x0075('0x1'));var moment=require(_0x0075('0x2'));var BPromise=require(_0x0075('0x3'));var rs=require(_0x0075('0x4'));var fs=require('fs');var Redis=require(_0x0075('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0075('0x6'));var logger=require('../../config/logger')(_0x0075('0x7'));var config=require(_0x0075('0x8'));var jayson=require(_0x0075('0x9'));var client=jayson[_0x0075('0xa')][_0x0075('0xb')]({'port':0x232a});config[_0x0075('0xc')]=_[_0x0075('0xd')](config[_0x0075('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0075('0xe'))[_0x0075('0xf')](socket);function respondWithRpcPromise(_0x131b02,_0x2bbd9c,_0x47ea1e){return new BPromise(function(_0x42342d,_0x578d72){return client[_0x0075('0x10')](_0x131b02,_0x47ea1e)[_0x0075('0x11')](function(_0x3a3a3c){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x2bbd9c,'request\x20sent');logger[_0x0075('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2bbd9c,_0x0075('0x13'),JSON[_0x0075('0x14')](_0x3a3a3c));if(_0x3a3a3c[_0x0075('0x15')]){if(_0x3a3a3c[_0x0075('0x15')]['code']===0x1f4){logger[_0x0075('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2bbd9c,_0x3a3a3c[_0x0075('0x15')][_0x0075('0x16')]);return _0x578d72(_0x3a3a3c[_0x0075('0x15')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2bbd9c,_0x3a3a3c['error'][_0x0075('0x16')]);return _0x42342d(_0x3a3a3c[_0x0075('0x15')]['message']);}else{logger[_0x0075('0x17')](_0x0075('0x18'),_0x2bbd9c,_0x0075('0x13'));_0x42342d(_0x3a3a3c[_0x0075('0x19')]['message']);}})['catch'](function(_0x4467d6){logger[_0x0075('0x15')](_0x0075('0x18'),_0x2bbd9c,_0x4467d6);_0x578d72(_0x4467d6);});});}exports[_0x0075('0x1a')]=function(_0x137ddf){var _0x135bee=this;return new Promise(function(_0x44733f,_0x3562d5){return db[_0x0075('0x1b')][_0x0075('0x1c')]({'raw':_0x137ddf[_0x0075('0x1d')]?_0x137ddf[_0x0075('0x1d')][_0x0075('0x1e')]===undefined?!![]:![]:!![],'where':_0x137ddf['options']?_0x137ddf[_0x0075('0x1d')]['where']||null:null,'attributes':_0x137ddf[_0x0075('0x1d')]?_0x137ddf[_0x0075('0x1d')][_0x0075('0x1f')]||null:null,'limit':_0x137ddf['options']?_0x137ddf['options'][_0x0075('0x20')]||null:null,'include':_0x137ddf[_0x0075('0x1d')]?_0x137ddf['options'][_0x0075('0x21')]?_[_0x0075('0x22')](_0x137ddf['options'][_0x0075('0x21')],function(_0x209878){return{'model':db[_0x209878['model']],'as':_0x209878['as'],'attributes':_0x209878[_0x0075('0x1f')],'include':_0x209878[_0x0075('0x21')]?_[_0x0075('0x22')](_0x209878[_0x0075('0x21')],function(_0x1d2a9d){return{'model':db[_0x1d2a9d[_0x0075('0x23')]],'as':_0x1d2a9d['as'],'attributes':_0x1d2a9d['attributes'],'include':_0x1d2a9d[_0x0075('0x21')]?_[_0x0075('0x22')](_0x1d2a9d[_0x0075('0x21')],function(_0x35fefc){return{'model':db[_0x35fefc[_0x0075('0x23')]],'as':_0x35fefc['as'],'attributes':_0x35fefc[_0x0075('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0075('0x11')](function(_0x1c0fd3){logger[_0x0075('0x17')](_0x0075('0x1a'),_0x137ddf);logger['debug'](_0x0075('0x1a'),_0x137ddf,JSON[_0x0075('0x14')](_0x1c0fd3));_0x44733f(_0x1c0fd3);})[_0x0075('0x24')](function(_0x5de84e){logger[_0x0075('0x15')]('GetWhatsappQueue',_0x5de84e[_0x0075('0x16')],_0x137ddf);_0x3562d5(_0x135bee[_0x0075('0x15')](0x1f4,_0x5de84e[_0x0075('0x16')]));});});};exports[_0x0075('0x25')]=function(_0x3abf57){var _0x1e3810=this;return new Promise(function(_0x1c8f1e,_0x5b1e00){return db[_0x0075('0x1b')][_0x0075('0x26')]({'raw':_0x3abf57[_0x0075('0x1d')]?_0x3abf57[_0x0075('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3abf57['options']?_0x3abf57['options'][_0x0075('0x27')]||null:null,'attributes':_0x3abf57['options']?_0x3abf57[_0x0075('0x1d')][_0x0075('0x1f')]||null:null,'include':_0x3abf57[_0x0075('0x1d')]?_0x3abf57[_0x0075('0x1d')]['include']?_[_0x0075('0x22')](_0x3abf57[_0x0075('0x1d')]['include'],function(_0x465e88){return{'model':db[_0x465e88[_0x0075('0x23')]],'as':_0x465e88['as'],'attributes':_0x465e88[_0x0075('0x1f')],'include':_0x465e88[_0x0075('0x21')]?_['map'](_0x465e88[_0x0075('0x21')],function(_0x474d6f){return{'model':db[_0x474d6f[_0x0075('0x23')]],'as':_0x474d6f['as'],'attributes':_0x474d6f[_0x0075('0x1f')],'include':_0x474d6f[_0x0075('0x21')]?_[_0x0075('0x22')](_0x474d6f[_0x0075('0x21')],function(_0x48ce07){return{'model':db[_0x48ce07['model']],'as':_0x48ce07['as'],'attributes':_0x48ce07[_0x0075('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0075('0x11')](function(_0x3372e4){logger[_0x0075('0x17')](_0x0075('0x25'),_0x3abf57);logger[_0x0075('0x12')](_0x0075('0x25'),_0x3abf57,JSON[_0x0075('0x14')](_0x3372e4));_0x1c8f1e(_0x3372e4);})[_0x0075('0x24')](function(_0x1cd55e){logger[_0x0075('0x15')](_0x0075('0x25'),_0x1cd55e[_0x0075('0x16')],_0x3abf57);_0x5b1e00(_0x1e3810[_0x0075('0x15')](0x1f4,_0x1cd55e[_0x0075('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cf95f70..b65b410 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 _0x9140=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x147d62,_0x1a11ca){var _0x4cb168=function(_0x300e3e){while(--_0x300e3e){_0x147d62['push'](_0x147d62['shift']());}};_0x4cb168(++_0x1a11ca);}(_0x9140,0xd3));var _0x0914=function(_0x26fb62,_0x574e5e){_0x26fb62=_0x26fb62-0x0;var _0x556ad1=_0x9140[_0x26fb62];return _0x556ad1;};'use strict';var WhatsappQueueEvents=require(_0x0914('0x0'));var events=[_0x0914('0x1'),_0x0914('0x2'),_0x0914('0x3')];function createListener(_0x5b749f,_0x2791a9){return function(_0x523a3e){_0x2791a9[_0x0914('0x4')](_0x5b749f,_0x523a3e);};}function removeListener(_0x5dd21a,_0x75a0ec){return function(){WhatsappQueueEvents['removeListener'](_0x5dd21a,_0x75a0ec);};}exports[_0x0914('0x5')]=function(_0x23b29a){for(var _0x3fb171=0x0,_0x46f663=events[_0x0914('0x6')];_0x3fb171<_0x46f663;_0x3fb171++){var _0x44a6bf=events[_0x3fb171];var _0x27102f=createListener(_0x0914('0x7')+_0x44a6bf,_0x23b29a);WhatsappQueueEvents['on'](_0x44a6bf,_0x27102f);}}; \ No newline at end of file +var _0x7f9c=['save','remove','update','removeListener','register','length','./whatsappQueue.events'];(function(_0x560416,_0x32b44d){var _0x1ed1c2=function(_0x2bd26b){while(--_0x2bd26b){_0x560416['push'](_0x560416['shift']());}};_0x1ed1c2(++_0x32b44d);}(_0x7f9c,0x7d));var _0xc7f9=function(_0x5ceb56,_0x1678fb){_0x5ceb56=_0x5ceb56-0x0;var _0x2553e5=_0x7f9c[_0x5ceb56];return _0x2553e5;};'use strict';var WhatsappQueueEvents=require(_0xc7f9('0x0'));var events=[_0xc7f9('0x1'),_0xc7f9('0x2'),_0xc7f9('0x3')];function createListener(_0x340531,_0x540c4b){return function(_0x306751){_0x540c4b['emit'](_0x340531,_0x306751);};}function removeListener(_0x24b3a1,_0xaa7c4a){return function(){WhatsappQueueEvents[_0xc7f9('0x4')](_0x24b3a1,_0xaa7c4a);};}exports[_0xc7f9('0x5')]=function(_0x74b7a9){for(var _0x23d363=0x0,_0x514578=events[_0xc7f9('0x6')];_0x23d363<_0x514578;_0x23d363++){var _0x4a6ac8=events[_0x23d363];var _0xa2b28=createListener('whatsappQueue:'+_0x4a6ac8,_0x74b7a9);WhatsappQueueEvents['on'](_0x4a6ac8,_0xa2b28);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3f33ede..c4000e2 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 _0xd137=['isAuthenticated','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','describe','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd137,0x140));var _0x7d13=function(_0x285070,_0x1704ba){_0x285070=_0x285070-0x0;var _0x7c6ad4=_0xd137[_0x285070];return _0x7c6ad4;};'use strict';var multer=require(_0x7d13('0x0'));var util=require(_0x7d13('0x1'));var path=require(_0x7d13('0x2'));var timeout=require(_0x7d13('0x3'));var express=require(_0x7d13('0x4'));var router=express[_0x7d13('0x5')]();var fs_extra=require(_0x7d13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7d13('0x7'));var config=require(_0x7d13('0x8'));var controller=require(_0x7d13('0x9'));router[_0x7d13('0xa')]('/',auth['isAuthenticated'](),controller[_0x7d13('0xb')]);router[_0x7d13('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7d13('0xc')]);router['get'](_0x7d13('0xd'),auth['isAuthenticated'](),controller[_0x7d13('0xe')]);router[_0x7d13('0xf')]('/',auth[_0x7d13('0x10')](),controller[_0x7d13('0x11')]);router[_0x7d13('0x12')](_0x7d13('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7d13('0x13')](_0x7d13('0xd'),auth[_0x7d13('0x10')](),controller['destroy']);module[_0x7d13('0x14')]=router; \ No newline at end of file +var _0x414a=['isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x367da6,_0x5d5ac6){var _0x48977b=function(_0x52588f){while(--_0x52588f){_0x367da6['push'](_0x367da6['shift']());}};_0x48977b(++_0x5d5ac6);}(_0x414a,0x147));var _0xa414=function(_0x35e290,_0x1156b1){_0x35e290=_0x35e290-0x0;var _0x19dd62=_0x414a[_0x35e290];return _0x19dd62;};'use strict';var multer=require(_0xa414('0x0'));var util=require('util');var path=require(_0xa414('0x1'));var timeout=require('connect-timeout');var express=require(_0xa414('0x2'));var router=express['Router']();var fs_extra=require(_0xa414('0x3'));var auth=require(_0xa414('0x4'));var interaction=require(_0xa414('0x5'));var config=require(_0xa414('0x6'));var controller=require(_0xa414('0x7'));router[_0xa414('0x8')]('/',auth[_0xa414('0x9')](),controller[_0xa414('0xa')]);router['get'](_0xa414('0xb'),auth[_0xa414('0x9')](),controller[_0xa414('0xc')]);router[_0xa414('0x8')]('/:id',auth[_0xa414('0x9')](),controller[_0xa414('0xd')]);router[_0xa414('0xe')]('/',auth['isAuthenticated'](),controller[_0xa414('0xf')]);router[_0xa414('0x10')]('/:id',auth[_0xa414('0x9')](),controller[_0xa414('0x11')]);router[_0xa414('0x12')](_0xa414('0x13'),auth[_0xa414('0x9')](),controller[_0xa414('0x14')]);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 2544c5d..99c8436 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(_0x29bb65,_0x22a0d8){var _0xbe6e2f=function(_0xcb68b3){while(--_0xcb68b3){_0x29bb65['push'](_0x29bb65['shift']());}};_0xbe6e2f(++_0x22a0d8);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2517,_0xe7894e){_0x1a2517=_0x1a2517-0x0;var _0x16d146=_0x7a54[_0x1a2517];return _0x16d146;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x11668c,_0xed64ee){var _0x3038c2=function(_0x16b9d5){while(--_0x16b9d5){_0x11668c['push'](_0x11668c['shift']());}};_0x3038c2(++_0xed64ee);}(_0x7a54,0x106));var _0x47a5=function(_0x3c5c5e,_0x4eeb4c){_0x3c5c5e=_0x3c5c5e-0x0;var _0x5afe76=_0x7a54[_0x3c5c5e];return _0x5afe76;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5770e38..9c3102c 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 _0x69d3=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv'];(function(_0x518081,_0x288e8a){var _0x51be07=function(_0x119190){while(--_0x119190){_0x518081['push'](_0x518081['shift']());}};_0x51be07(++_0x288e8a);}(_0x69d3,0xda));var _0x369d=function(_0x53196a,_0x3678a8){_0x53196a=_0x53196a-0x0;var _0x536b97=_0x69d3[_0x53196a];return _0x536b97;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];function respondWithStatusCode(_0xee549e,_0x52c126){_0x52c126=_0x52c126||0xcc;return function(_0x15b417){if(_0x15b417){return _0xee549e[_0x369d('0x17')](_0x52c126);}return _0xee549e[_0x369d('0x18')](_0x52c126)[_0x369d('0x19')]();};}function respondWithResult(_0x121307,_0x539536){_0x539536=_0x539536||0xc8;return function(_0x5cd4c3){if(_0x5cd4c3){return _0x121307['status'](_0x539536)[_0x369d('0x1a')](_0x5cd4c3);}};}function respondWithFilteredResult(_0xa126c1,_0x389c43){return function(_0x5b4f55){if(_0x5b4f55){var _0x2c1a4a=typeof _0x389c43[_0x369d('0x1b')]===_0x369d('0x1c')&&typeof _0x389c43['limit']===_0x369d('0x1c');var _0x1f37ff=_0x5b4f55['count'];var _0x572513=_0x2c1a4a?0x0:_0x389c43['offset'];var _0x2946be=_0x2c1a4a?_0x5b4f55[_0x369d('0x1d')]:_0x389c43[_0x369d('0x1b')]+_0x389c43['limit'];var _0x410dbe;if(_0x2946be>=_0x1f37ff){_0x2946be=_0x1f37ff;_0x410dbe=0xc8;}else{_0x410dbe=0xce;}_0xa126c1[_0x369d('0x18')](_0x410dbe);return _0xa126c1[_0x369d('0x1e')](_0x369d('0x1f'),_0x572513+'-'+_0x2946be+'/'+_0x1f37ff)[_0x369d('0x1a')](_0x5b4f55);}return null;};}function patchUpdates(_0x538ca4){return function(_0x5c9fdd){try{jsonpatch[_0x369d('0x20')](_0x5c9fdd,_0x538ca4,!![]);}catch(_0x1edcd5){return BPromise[_0x369d('0x21')](_0x1edcd5);}return _0x5c9fdd[_0x369d('0x22')]();};}function saveUpdates(_0x84cc0f,_0x15fbef){return function(_0x1b262a){if(_0x1b262a){return _0x1b262a['update'](_0x84cc0f)['then'](function(_0x32ef9a){return _0x32ef9a;});}return null;};}function removeEntity(_0xed16e,_0xf7bc3a){return function(_0xcae58){if(_0xcae58){return _0xcae58[_0x369d('0x23')]()[_0x369d('0x24')](function(){_0xed16e[_0x369d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfe83,_0x16145e){return function(_0x46de2b){if(!_0x46de2b){_0x4dfe83[_0x369d('0x17')](0x194);}return _0x46de2b;};}function handleError(_0xe01d2b,_0x8aa521){_0x8aa521=_0x8aa521||0x1f4;return function(_0x41e0cf){logger[_0x369d('0x25')](_0x41e0cf['stack']);if(_0x41e0cf[_0x369d('0x26')]){delete _0x41e0cf[_0x369d('0x26')];}_0xe01d2b[_0x369d('0x18')](_0x8aa521)[_0x369d('0x27')](_0x41e0cf);};}exports[_0x369d('0x28')]=function(_0x41367a,_0x3d1ce0){var _0x4d42ea={},_0x157291={},_0x56efb1={'count':0x0,'rows':[]};var _0x57b94c=_[_0x369d('0x29')](db[_0x369d('0x2a')]['rawAttributes'],function(_0x104540){return{'name':_0x104540['fieldName'],'type':_0x104540[_0x369d('0x2b')][_0x369d('0x2c')]};});_0x157291[_0x369d('0x2d')]=_[_0x369d('0x29')](_0x57b94c,_0x369d('0x26'));_0x157291[_0x369d('0x2e')]=_[_0x369d('0x2f')](_0x41367a['query']);_0x157291[_0x369d('0x30')]=_[_0x369d('0x31')](_0x157291[_0x369d('0x2d')],_0x157291[_0x369d('0x2e')]);_0x4d42ea[_0x369d('0x32')]=_[_0x369d('0x31')](_0x157291[_0x369d('0x2d')],qs[_0x369d('0x33')](_0x41367a['query'][_0x369d('0x33')]));_0x4d42ea[_0x369d('0x32')]=_0x4d42ea[_0x369d('0x32')][_0x369d('0x34')]?_0x4d42ea[_0x369d('0x32')]:_0x157291['model'];if(!_0x41367a[_0x369d('0x2e')][_0x369d('0x35')](_0x369d('0x36'))){_0x4d42ea[_0x369d('0x37')]=qs[_0x369d('0x37')](_0x41367a[_0x369d('0x2e')]['limit']);_0x4d42ea[_0x369d('0x1b')]=qs[_0x369d('0x1b')](_0x41367a[_0x369d('0x2e')][_0x369d('0x1b')]);}_0x4d42ea[_0x369d('0x38')]=qs[_0x369d('0x39')](_0x41367a[_0x369d('0x2e')][_0x369d('0x39')]);_0x4d42ea[_0x369d('0x3a')]=qs[_0x369d('0x30')](_[_0x369d('0x3b')](_0x41367a[_0x369d('0x2e')],_0x157291[_0x369d('0x30')]),_0x57b94c);if(_0x41367a[_0x369d('0x2e')][_0x369d('0x3c')]){_0x4d42ea[_0x369d('0x3a')]=_[_0x369d('0x3d')](_0x4d42ea[_0x369d('0x3a')],{'$or':_[_0x369d('0x29')](_0x57b94c,function(_0x7fd64b){if(_0x7fd64b[_0x369d('0x2b')]!==_0x369d('0x3e')){var _0xb7837f={};_0xb7837f[_0x7fd64b[_0x369d('0x26')]]={'$like':'%'+_0x41367a['query']['filter']+'%'};return _0xb7837f;}})});}_0x4d42ea=_[_0x369d('0x3d')]({},_0x4d42ea,_0x41367a[_0x369d('0x3f')]);var _0x8a1ef5={'where':_0x4d42ea[_0x369d('0x3a')]};return db[_0x369d('0x2a')][_0x369d('0x1d')](_0x8a1ef5)[_0x369d('0x24')](function(_0x169340){_0x56efb1[_0x369d('0x1d')]=_0x169340;if(_0x41367a['query'][_0x369d('0x40')]){_0x4d42ea[_0x369d('0x41')]=[{'all':!![]}];}return db[_0x369d('0x2a')][_0x369d('0x42')](_0x4d42ea);})[_0x369d('0x24')](function(_0x25cf4e){_0x56efb1[_0x369d('0x43')]=_0x25cf4e;return _0x56efb1;})[_0x369d('0x24')](respondWithFilteredResult(_0x3d1ce0,_0x4d42ea))['catch'](handleError(_0x3d1ce0,null));};exports['show']=function(_0x20b351,_0x3222ce){var _0x30909a={'raw':!![],'where':{'id':_0x20b351['params']['id']}},_0x4dad71={};_0x4dad71['model']=_[_0x369d('0x2f')](db[_0x369d('0x2a')]['rawAttributes']);_0x4dad71[_0x369d('0x2e')]=_[_0x369d('0x2f')](_0x20b351[_0x369d('0x2e')]);_0x4dad71[_0x369d('0x30')]=_['intersection'](_0x4dad71[_0x369d('0x2d')],_0x4dad71['query']);_0x30909a[_0x369d('0x32')]=_['intersection'](_0x4dad71[_0x369d('0x2d')],qs[_0x369d('0x33')](_0x20b351[_0x369d('0x2e')]['fields']));_0x30909a['attributes']=_0x30909a[_0x369d('0x32')][_0x369d('0x34')]?_0x30909a[_0x369d('0x32')]:_0x4dad71['model'];if(_0x20b351[_0x369d('0x2e')][_0x369d('0x40')]){_0x30909a[_0x369d('0x41')]=[{'all':!![]}];}_0x30909a=_[_0x369d('0x3d')]({},_0x30909a,_0x20b351[_0x369d('0x3f')]);return db[_0x369d('0x2a')][_0x369d('0x44')](_0x30909a)[_0x369d('0x24')](handleEntityNotFound(_0x3222ce,null))[_0x369d('0x24')](respondWithResult(_0x3222ce,null))['catch'](handleError(_0x3222ce,null));};exports[_0x369d('0x45')]=function(_0x41066d,_0xcc1465){return db[_0x369d('0x2a')][_0x369d('0x45')](_0x41066d[_0x369d('0x46')],{})['then'](respondWithResult(_0xcc1465,0xc9))[_0x369d('0x47')](handleError(_0xcc1465,null));};exports[_0x369d('0x48')]=function(_0x16dd8f,_0x44a357){if(_0x16dd8f[_0x369d('0x46')]['id']){delete _0x16dd8f[_0x369d('0x46')]['id'];}return db[_0x369d('0x2a')][_0x369d('0x44')]({'where':{'id':_0x16dd8f[_0x369d('0x49')]['id']}})[_0x369d('0x24')](handleEntityNotFound(_0x44a357,null))[_0x369d('0x24')](saveUpdates(_0x16dd8f[_0x369d('0x46')],null))['then'](respondWithResult(_0x44a357,null))[_0x369d('0x47')](handleError(_0x44a357,null));};exports[_0x369d('0x23')]=function(_0x289eb8,_0x85edd6){return db[_0x369d('0x2a')]['find']({'where':{'id':_0x289eb8[_0x369d('0x49')]['id']}})['then'](handleEntityNotFound(_0x85edd6,null))[_0x369d('0x24')](removeEntity(_0x85edd6,null))[_0x369d('0x47')](handleError(_0x85edd6,null));};exports[_0x369d('0x4a')]=function(_0x851746,_0x46c62c){return db[_0x369d('0x2a')][_0x369d('0x4a')]()[_0x369d('0x24')](respondWithResult(_0x46c62c,null))[_0x369d('0x47')](handleError(_0x46c62c,null));}; \ No newline at end of file +var _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x19d7bf,_0x265436){var _0x46494c=function(_0x543faf){while(--_0x543faf){_0x19d7bf['push'](_0x19d7bf['shift']());}};_0x46494c(++_0x265436);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x27d714,_0xcad2d1){_0x27d714=_0x27d714-0x0;var _0x510613=_0xe1e3[_0x27d714];return _0x510613;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 5749080..7723675 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 _0xa7b6=['exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x3963e2,_0x5ca5db){var _0x573236=function(_0x3f9ecd){while(--_0x3f9ecd){_0x3963e2['push'](_0x3963e2['shift']());}};_0x573236(++_0x5ca5db);}(_0xa7b6,0x88));var _0x6a7b=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xa7b6[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x6a7b('0x0'));var util=require('util');var logger=require(_0x6a7b('0x1'))(_0x6a7b('0x2'));var moment=require(_0x6a7b('0x3'));var BPromise=require(_0x6a7b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a7b('0x5'));var rimraf=require('rimraf');var config=require(_0x6a7b('0x6'));var attributes=require(_0x6a7b('0x7'));module[_0x6a7b('0x8')]=function(_0x45381e,_0x47d691){return _0x45381e['define'](_0x6a7b('0x9'),attributes,{'tableName':_0x6a7b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6a7b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x537f=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x45b905,_0x393fd4){var _0x35bdd1=function(_0x250e92){while(--_0x250e92){_0x45b905['push'](_0x45b905['shift']());}};_0x35bdd1(++_0x393fd4);}(_0x537f,0x125));var _0xf537=function(_0x39cfc8,_0x45cdfe){_0x39cfc8=_0x39cfc8-0x0;var _0xc0bd16=_0x537f[_0x39cfc8];return _0xc0bd16;};'use strict';var _=require(_0xf537('0x0'));var util=require(_0xf537('0x1'));var logger=require(_0xf537('0x2'))('api');var moment=require(_0xf537('0x3'));var BPromise=require(_0xf537('0x4'));var rp=require(_0xf537('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf537('0x6'));var config=require(_0xf537('0x7'));var attributes=require(_0xf537('0x8'));module[_0xf537('0x9')]=function(_0x3c4be5,_0x5999d2){return _0x3c4be5[_0xf537('0xa')](_0xf537('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf537('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 8131769..8d4dfb5 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 _0xcf9d=['WhatsappQueueReport','create','body','options','stringify','update','raw','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xcf9d,0x1df));var _0xdcf9=function(_0x580e16,_0x557e74){_0x580e16=_0x580e16-0x0;var _0x40af00=_0xcf9d[_0x580e16];return _0x40af00;};'use strict';var _=require(_0xdcf9('0x0'));var util=require(_0xdcf9('0x1'));var moment=require(_0xdcf9('0x2'));var BPromise=require(_0xdcf9('0x3'));var rs=require(_0xdcf9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcf9('0x5'));var logger=require(_0xdcf9('0x6'))(_0xdcf9('0x7'));var config=require(_0xdcf9('0x8'));var jayson=require(_0xdcf9('0x9'));var client=jayson[_0xdcf9('0xa')][_0xdcf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bad6f,_0x5a4d96,_0x450a77){return new BPromise(function(_0x2b8b93,_0xbed8f6){return client[_0xdcf9('0xc')](_0x2bad6f,_0x450a77)[_0xdcf9('0xd')](function(_0x37878e){logger[_0xdcf9('0xe')](_0xdcf9('0xf'),_0x5a4d96,_0xdcf9('0x10'));logger[_0xdcf9('0x11')](_0xdcf9('0x12'),_0x5a4d96,_0xdcf9('0x10'),JSON['stringify'](_0x37878e));if(_0x37878e[_0xdcf9('0x13')]){if(_0x37878e[_0xdcf9('0x13')][_0xdcf9('0x14')]===0x1f4){logger[_0xdcf9('0x13')](_0xdcf9('0xf'),_0x5a4d96,_0x37878e[_0xdcf9('0x13')][_0xdcf9('0x15')]);return _0xbed8f6(_0x37878e['error']['message']);}logger[_0xdcf9('0x13')](_0xdcf9('0xf'),_0x5a4d96,_0x37878e['error'][_0xdcf9('0x15')]);return _0x2b8b93(_0x37878e[_0xdcf9('0x13')][_0xdcf9('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x5a4d96,'request\x20sent');_0x2b8b93(_0x37878e[_0xdcf9('0x16')][_0xdcf9('0x15')]);}})[_0xdcf9('0x17')](function(_0x4026f7){logger[_0xdcf9('0x13')](_0xdcf9('0xf'),_0x5a4d96,_0x4026f7);_0xbed8f6(_0x4026f7);});});}exports[_0xdcf9('0x18')]=function(_0x11a6e3){var _0x56cceb=this;return new Promise(function(_0x2319da,_0x54e0ff){return db[_0xdcf9('0x19')][_0xdcf9('0x1a')](_0x11a6e3[_0xdcf9('0x1b')],{'raw':_0x11a6e3[_0xdcf9('0x1c')]?_0x11a6e3[_0xdcf9('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49ed61){logger[_0xdcf9('0xe')](_0xdcf9('0x18'),_0x11a6e3);logger[_0xdcf9('0x11')]('CreateWhatsappQueueReport',_0x11a6e3,JSON[_0xdcf9('0x1d')](_0x49ed61));_0x2319da(_0x49ed61);})[_0xdcf9('0x17')](function(_0x4b2afb){logger[_0xdcf9('0x13')](_0xdcf9('0x18'),_0x4b2afb[_0xdcf9('0x15')],_0x11a6e3);_0x54e0ff(_0x56cceb[_0xdcf9('0x13')](0x1f4,_0x4b2afb['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x9e1ff8){var _0x386779=this;return new Promise(function(_0x490461,_0x10697f){return db[_0xdcf9('0x19')][_0xdcf9('0x1e')](_0x9e1ff8['body'],{'raw':_0x9e1ff8[_0xdcf9('0x1c')]?_0x9e1ff8[_0xdcf9('0x1c')][_0xdcf9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9e1ff8['options']?_0x9e1ff8['options'][_0xdcf9('0x20')]||null:null,'attributes':_0x9e1ff8[_0xdcf9('0x1c')]?_0x9e1ff8[_0xdcf9('0x1c')][_0xdcf9('0x21')]||null:null,'limit':_0x9e1ff8[_0xdcf9('0x1c')]?_0x9e1ff8[_0xdcf9('0x1c')][_0xdcf9('0x22')]||null:null})[_0xdcf9('0xd')](function(_0x57a631){logger['info'](_0xdcf9('0x23'),_0x9e1ff8);logger[_0xdcf9('0x11')](_0xdcf9('0x23'),_0x9e1ff8,JSON[_0xdcf9('0x1d')](_0x57a631));_0x490461(_0x57a631);})['catch'](function(_0xb80736){logger[_0xdcf9('0x13')](_0xdcf9('0x23'),_0xb80736[_0xdcf9('0x15')],_0x9e1ff8);_0x10697f(_0x386779[_0xdcf9('0x13')](0x1f4,_0xb80736['message']));});});}; \ No newline at end of file +var _0xa02f=['then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1d3029,_0x6800ef){var _0x38c3c7=function(_0x60a5eb){while(--_0x60a5eb){_0x1d3029['push'](_0x1d3029['shift']());}};_0x38c3c7(++_0x6800ef);}(_0xa02f,0xce));var _0xfa02=function(_0x446c62,_0x141c49){_0x446c62=_0x446c62-0x0;var _0x482caf=_0xa02f[_0x446c62];return _0x482caf;};'use strict';var _=require('lodash');var util=require(_0xfa02('0x0'));var moment=require(_0xfa02('0x1'));var BPromise=require(_0xfa02('0x2'));var rs=require(_0xfa02('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa02('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa02('0x5'))(_0xfa02('0x6'));var config=require(_0xfa02('0x7'));var jayson=require(_0xfa02('0x8'));var client=jayson[_0xfa02('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31d4ca,_0x2a234b,_0x442a34){return new BPromise(function(_0x3fbd13,_0x53536f){return client[_0xfa02('0xa')](_0x31d4ca,_0x442a34)[_0xfa02('0xb')](function(_0x16150a){logger['info'](_0xfa02('0xc'),_0x2a234b,_0xfa02('0xd'));logger[_0xfa02('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2a234b,_0xfa02('0xd'),JSON[_0xfa02('0xf')](_0x16150a));if(_0x16150a[_0xfa02('0x10')]){if(_0x16150a[_0xfa02('0x10')][_0xfa02('0x11')]===0x1f4){logger[_0xfa02('0x10')](_0xfa02('0xc'),_0x2a234b,_0x16150a[_0xfa02('0x10')][_0xfa02('0x12')]);return _0x53536f(_0x16150a[_0xfa02('0x10')][_0xfa02('0x12')]);}logger[_0xfa02('0x10')](_0xfa02('0xc'),_0x2a234b,_0x16150a[_0xfa02('0x10')][_0xfa02('0x12')]);return _0x3fbd13(_0x16150a[_0xfa02('0x10')][_0xfa02('0x12')]);}else{logger[_0xfa02('0x13')](_0xfa02('0xc'),_0x2a234b,_0xfa02('0xd'));_0x3fbd13(_0x16150a[_0xfa02('0x14')][_0xfa02('0x12')]);}})[_0xfa02('0x15')](function(_0x269322){logger[_0xfa02('0x10')](_0xfa02('0xc'),_0x2a234b,_0x269322);_0x53536f(_0x269322);});});}exports['CreateWhatsappQueueReport']=function(_0x349d1f){var _0x5dcd55=this;return new Promise(function(_0xb13ecf,_0x93dec7){return db['WhatsappQueueReport'][_0xfa02('0x16')](_0x349d1f[_0xfa02('0x17')],{'raw':_0x349d1f[_0xfa02('0x18')]?_0x349d1f[_0xfa02('0x18')][_0xfa02('0x19')]===undefined?!![]:![]:!![]})[_0xfa02('0xb')](function(_0xd4fc76){logger[_0xfa02('0x13')](_0xfa02('0x1a'),_0x349d1f);logger['debug'](_0xfa02('0x1a'),_0x349d1f,JSON['stringify'](_0xd4fc76));_0xb13ecf(_0xd4fc76);})['catch'](function(_0x1a13b6){logger[_0xfa02('0x10')](_0xfa02('0x1a'),_0x1a13b6[_0xfa02('0x12')],_0x349d1f);_0x93dec7(_0x5dcd55[_0xfa02('0x10')](0x1f4,_0x1a13b6[_0xfa02('0x12')]));});});};exports[_0xfa02('0x1b')]=function(_0x514ee1){var _0x32e7f8=this;return new Promise(function(_0x1db6ae,_0x288ead){return db[_0xfa02('0x1c')][_0xfa02('0x1d')](_0x514ee1[_0xfa02('0x17')],{'raw':_0x514ee1[_0xfa02('0x18')]?_0x514ee1[_0xfa02('0x18')][_0xfa02('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514ee1[_0xfa02('0x18')]?_0x514ee1['options']['where']||null:null,'attributes':_0x514ee1[_0xfa02('0x18')]?_0x514ee1[_0xfa02('0x18')]['attributes']||null:null,'limit':_0x514ee1[_0xfa02('0x18')]?_0x514ee1[_0xfa02('0x18')][_0xfa02('0x1e')]||null:null})[_0xfa02('0xb')](function(_0x402ecd){logger[_0xfa02('0x13')](_0xfa02('0x1b'),_0x514ee1);logger[_0xfa02('0xe')](_0xfa02('0x1b'),_0x514ee1,JSON[_0xfa02('0xf')](_0x402ecd));_0x1db6ae(_0x402ecd);})[_0xfa02('0x15')](function(_0x43a2fb){logger[_0xfa02('0x10')](_0xfa02('0x1b'),_0x43a2fb['message'],_0x514ee1);_0x288ead(_0x32e7f8[_0xfa02('0x10')](0x1f4,_0x43a2fb[_0xfa02('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index de463fa..39f3f91 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 _0x9421=['show','post','create','put','/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','/describe','isAuthenticated','describe','get'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x9421,0x7a));var _0x1942=function(_0x3e2300,_0x562761){_0x3e2300=_0x3e2300-0x0;var _0x164a5b=_0x9421[_0x3e2300];return _0x164a5b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1942('0x0'));var timeout=require(_0x1942('0x1'));var express=require(_0x1942('0x2'));var router=express[_0x1942('0x3')]();var fs_extra=require(_0x1942('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1942('0x5'));var controller=require(_0x1942('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1942('0x7'),auth[_0x1942('0x8')](),controller[_0x1942('0x9')]);router[_0x1942('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1942('0xb')]);router[_0x1942('0xc')]('/',auth[_0x1942('0x8')](),controller[_0x1942('0xd')]);router[_0x1942('0xe')](_0x1942('0xf'),auth[_0x1942('0x8')](),controller['update']);router[_0x1942('0x10')](_0x1942('0xf'),auth[_0x1942('0x8')](),controller[_0x1942('0x11')]);module[_0x1942('0x12')]=router; \ No newline at end of file +var _0x1ecc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','/describe','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0x1ecc,0x165));var _0xc1ec=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x1ecc[_0x156a0d];return _0x98a9ba;};'use strict';var multer=require('multer');var util=require(_0xc1ec('0x0'));var path=require('path');var timeout=require(_0xc1ec('0x1'));var express=require(_0xc1ec('0x2'));var router=express[_0xc1ec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc1ec('0x4'));var interaction=require(_0xc1ec('0x5'));var config=require(_0xc1ec('0x6'));var controller=require(_0xc1ec('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1ec('0x8')]);router['get'](_0xc1ec('0x9'),auth[_0xc1ec('0xa')](),controller['describe']);router[_0xc1ec('0xb')](_0xc1ec('0xc'),auth[_0xc1ec('0xa')](),controller[_0xc1ec('0xd')]);router[_0xc1ec('0xe')]('/',auth[_0xc1ec('0xa')](),controller[_0xc1ec('0xf')]);router['put'](_0xc1ec('0xc'),auth[_0xc1ec('0xa')](),controller[_0xc1ec('0x10')]);router[_0xc1ec('0x11')]('/:id',auth[_0xc1ec('0xa')](),controller[_0xc1ec('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7d72d28..d5a7405 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 _0x88a6=['DATE','exports','STRING','account','agent','queue'];(function(_0x45a2b8,_0x26ebe3){var _0x3bdebd=function(_0x2d171b){while(--_0x2d171b){_0x45a2b8['push'](_0x45a2b8['shift']());}};_0x3bdebd(++_0x26ebe3);}(_0x88a6,0x121));var _0x688a=function(_0x3ea360,_0x4a3b9e){_0x3ea360=_0x3ea360-0x0;var _0x330457=_0x88a6[_0x3ea360];return _0x330457;};'use strict';var Sequelize=require('sequelize');module[_0x688a('0x0')]={'uniqueid':{'type':Sequelize[_0x688a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x688a('0x2'),_0x688a('0x3'),_0x688a('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x688a('0x5')]}}; \ No newline at end of file +var _0xc692=['agent','queue','DATE','sequelize','exports','STRING'];(function(_0x22c049,_0x4b5bab){var _0x44d989=function(_0x5529ba){while(--_0x5529ba){_0x22c049['push'](_0x22c049['shift']());}};_0x44d989(++_0x4b5bab);}(_0xc692,0x15f));var _0x2c69=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc692[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'uniqueid':{'type':Sequelize[_0x2c69('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x2c69('0x3'),_0x2c69('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2c69('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c263b97..a880a96 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 _0x8ced=['path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','update','then','destroy','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8ced,0xc7));var _0xd8ce=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0x8ced[_0x3480e9];return _0x389aad;};'use strict';var emlformat=require(_0xd8ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8ce('0x1'));var jsonpatch=require(_0xd8ce('0x2'));var rp=require(_0xd8ce('0x3'));var moment=require(_0xd8ce('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd8ce('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8ce('0x6'));var fs=require('fs');var fs_extra=require(_0xd8ce('0x7'));var _=require(_0xd8ce('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd8ce('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd8ce('0xa'));var querystring=require(_0xd8ce('0xb'));var Papa=require('papaparse');var Redis=require(_0xd8ce('0xc'));var authService=require(_0xd8ce('0xd'));var qs=require(_0xd8ce('0xe'));var as=require(_0xd8ce('0xf'));var hardwareService=require(_0xd8ce('0x10'));var logger=require(_0xd8ce('0x11'))('api');var utils=require(_0xd8ce('0x12'));var config=require(_0xd8ce('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ce('0x14'))['db'];function respondWithStatusCode(_0x42d4c9,_0x328ca5){_0x328ca5=_0x328ca5||0xcc;return function(_0x1dfa2f){if(_0x1dfa2f){return _0x42d4c9[_0xd8ce('0x15')](_0x328ca5);}return _0x42d4c9[_0xd8ce('0x16')](_0x328ca5)[_0xd8ce('0x17')]();};}function respondWithResult(_0x2d520e,_0x19a30c){_0x19a30c=_0x19a30c||0xc8;return function(_0x5698ed){if(_0x5698ed){return _0x2d520e[_0xd8ce('0x16')](_0x19a30c)['json'](_0x5698ed);}};}function respondWithFilteredResult(_0x40b83e,_0x23072d){return function(_0x364d9c){if(_0x364d9c){var _0x3fd350=typeof _0x23072d['offset']===_0xd8ce('0x18')&&typeof _0x23072d[_0xd8ce('0x19')]==='undefined';var _0x209b92=_0x364d9c['count'];var _0x35061b=_0x3fd350?0x0:_0x23072d[_0xd8ce('0x1a')];var _0xffca0e=_0x3fd350?_0x364d9c['count']:_0x23072d[_0xd8ce('0x1a')]+_0x23072d[_0xd8ce('0x19')];var _0x4fa86d;if(_0xffca0e>=_0x209b92){_0xffca0e=_0x209b92;_0x4fa86d=0xc8;}else{_0x4fa86d=0xce;}_0x40b83e['status'](_0x4fa86d);return _0x40b83e[_0xd8ce('0x1b')](_0xd8ce('0x1c'),_0x35061b+'-'+_0xffca0e+'/'+_0x209b92)[_0xd8ce('0x1d')](_0x364d9c);}return null;};}function patchUpdates(_0x5e0a5e){return function(_0x10e77e){try{jsonpatch[_0xd8ce('0x1e')](_0x10e77e,_0x5e0a5e,!![]);}catch(_0x858c8a){return BPromise['reject'](_0x858c8a);}return _0x10e77e['save']();};}function saveUpdates(_0x156575,_0x34d610){return function(_0x405503){if(_0x405503){return _0x405503[_0xd8ce('0x1f')](_0x156575)[_0xd8ce('0x20')](function(_0x3ff13f){return _0x3ff13f;});}return null;};}function removeEntity(_0x42621f,_0x35dcd2){return function(_0x3a4366){if(_0x3a4366){return _0x3a4366[_0xd8ce('0x21')]()[_0xd8ce('0x20')](function(){_0x42621f['status'](0xcc)[_0xd8ce('0x17')]();});}};}function handleEntityNotFound(_0x47ac73,_0x2454a4){return function(_0x44445e){if(!_0x44445e){_0x47ac73['sendStatus'](0x194);}return _0x44445e;};}function handleError(_0x30999a,_0x4e9965){_0x4e9965=_0x4e9965||0x1f4;return function(_0x240a07){logger['error'](_0x240a07[_0xd8ce('0x22')]);if(_0x240a07[_0xd8ce('0x23')]){delete _0x240a07[_0xd8ce('0x23')];}_0x30999a['status'](_0x4e9965)['send'](_0x240a07);};}exports[_0xd8ce('0x24')]=function(_0xb9acbc,_0x1f6a7d){var _0x4020c6={},_0x133160={},_0x1476cf={'count':0x0,'rows':[]};var _0x24e1a8=_[_0xd8ce('0x25')](db[_0xd8ce('0x26')][_0xd8ce('0x27')],function(_0x275f5e){return{'name':_0x275f5e[_0xd8ce('0x28')],'type':_0x275f5e[_0xd8ce('0x29')]['key']};});_0x133160[_0xd8ce('0x2a')]=_[_0xd8ce('0x25')](_0x24e1a8,'name');_0x133160[_0xd8ce('0x2b')]=_['keys'](_0xb9acbc[_0xd8ce('0x2b')]);_0x133160[_0xd8ce('0x2c')]=_[_0xd8ce('0x2d')](_0x133160[_0xd8ce('0x2a')],_0x133160[_0xd8ce('0x2b')]);_0x4020c6[_0xd8ce('0x2e')]=_[_0xd8ce('0x2d')](_0x133160[_0xd8ce('0x2a')],qs[_0xd8ce('0x2f')](_0xb9acbc[_0xd8ce('0x2b')][_0xd8ce('0x2f')]));_0x4020c6[_0xd8ce('0x2e')]=_0x4020c6[_0xd8ce('0x2e')][_0xd8ce('0x30')]?_0x4020c6['attributes']:_0x133160['model'];if(!_0xb9acbc[_0xd8ce('0x2b')][_0xd8ce('0x31')](_0xd8ce('0x32'))){_0x4020c6['limit']=qs[_0xd8ce('0x19')](_0xb9acbc['query'][_0xd8ce('0x19')]);_0x4020c6[_0xd8ce('0x1a')]=qs['offset'](_0xb9acbc[_0xd8ce('0x2b')]['offset']);}_0x4020c6[_0xd8ce('0x33')]=qs[_0xd8ce('0x34')](_0xb9acbc[_0xd8ce('0x2b')][_0xd8ce('0x34')]);_0x4020c6[_0xd8ce('0x35')]=qs['filters'](_['pick'](_0xb9acbc[_0xd8ce('0x2b')],_0x133160[_0xd8ce('0x2c')]),_0x24e1a8);if(_0xb9acbc[_0xd8ce('0x2b')][_0xd8ce('0x36')]){_0x4020c6[_0xd8ce('0x35')]=_['merge'](_0x4020c6['where'],{'$or':_['map'](_0x24e1a8,function(_0x287332){if(_0x287332[_0xd8ce('0x29')]!=='VIRTUAL'){var _0x1e4543={};_0x1e4543[_0x287332[_0xd8ce('0x23')]]={'$like':'%'+_0xb9acbc[_0xd8ce('0x2b')][_0xd8ce('0x36')]+'%'};return _0x1e4543;}})});}_0x4020c6=_[_0xd8ce('0x37')]({},_0x4020c6,_0xb9acbc[_0xd8ce('0x38')]);var _0x309b03={'where':_0x4020c6[_0xd8ce('0x35')]};return db['WhatsappTransferReport'][_0xd8ce('0x39')](_0x309b03)[_0xd8ce('0x20')](function(_0x3414ee){_0x1476cf[_0xd8ce('0x39')]=_0x3414ee;if(_0xb9acbc[_0xd8ce('0x2b')]['includeAll']){_0x4020c6[_0xd8ce('0x3a')]=[{'all':!![]}];}return db[_0xd8ce('0x26')]['findAll'](_0x4020c6);})[_0xd8ce('0x20')](function(_0x3e6069){_0x1476cf[_0xd8ce('0x3b')]=_0x3e6069;return _0x1476cf;})[_0xd8ce('0x20')](respondWithFilteredResult(_0x1f6a7d,_0x4020c6))[_0xd8ce('0x3c')](handleError(_0x1f6a7d,null));};exports[_0xd8ce('0x3d')]=function(_0x4d448f,_0x21045c){var _0x279eec={'raw':!![],'where':{'id':_0x4d448f[_0xd8ce('0x3e')]['id']}},_0xed4423={};_0xed4423[_0xd8ce('0x2a')]=_[_0xd8ce('0x3f')](db[_0xd8ce('0x26')][_0xd8ce('0x27')]);_0xed4423['query']=_[_0xd8ce('0x3f')](_0x4d448f[_0xd8ce('0x2b')]);_0xed4423['filters']=_['intersection'](_0xed4423[_0xd8ce('0x2a')],_0xed4423[_0xd8ce('0x2b')]);_0x279eec['attributes']=_[_0xd8ce('0x2d')](_0xed4423[_0xd8ce('0x2a')],qs['fields'](_0x4d448f[_0xd8ce('0x2b')][_0xd8ce('0x2f')]));_0x279eec[_0xd8ce('0x2e')]=_0x279eec[_0xd8ce('0x2e')]['length']?_0x279eec[_0xd8ce('0x2e')]:_0xed4423[_0xd8ce('0x2a')];if(_0x4d448f['query']['includeAll']){_0x279eec[_0xd8ce('0x3a')]=[{'all':!![]}];}_0x279eec=_[_0xd8ce('0x37')]({},_0x279eec,_0x4d448f[_0xd8ce('0x38')]);return db[_0xd8ce('0x26')][_0xd8ce('0x40')](_0x279eec)[_0xd8ce('0x20')](handleEntityNotFound(_0x21045c,null))[_0xd8ce('0x20')](respondWithResult(_0x21045c,null))[_0xd8ce('0x3c')](handleError(_0x21045c,null));};exports[_0xd8ce('0x41')]=function(_0x2d8b62,_0x3e5edc){return db[_0xd8ce('0x26')][_0xd8ce('0x41')](_0x2d8b62['body'],{})[_0xd8ce('0x20')](respondWithResult(_0x3e5edc,0xc9))[_0xd8ce('0x3c')](handleError(_0x3e5edc,null));};exports[_0xd8ce('0x1f')]=function(_0x3edd53,_0x198722){if(_0x3edd53['body']['id']){delete _0x3edd53[_0xd8ce('0x42')]['id'];}return db[_0xd8ce('0x26')][_0xd8ce('0x40')]({'where':{'id':_0x3edd53['params']['id']}})[_0xd8ce('0x20')](handleEntityNotFound(_0x198722,null))[_0xd8ce('0x20')](saveUpdates(_0x3edd53[_0xd8ce('0x42')],null))['then'](respondWithResult(_0x198722,null))[_0xd8ce('0x3c')](handleError(_0x198722,null));};exports[_0xd8ce('0x21')]=function(_0x571597,_0x484675){return db[_0xd8ce('0x26')]['find']({'where':{'id':_0x571597[_0xd8ce('0x3e')]['id']}})[_0xd8ce('0x20')](handleEntityNotFound(_0x484675,null))[_0xd8ce('0x20')](removeEntity(_0x484675,null))[_0xd8ce('0x3c')](handleError(_0x484675,null));};exports[_0xd8ce('0x43')]=function(_0x54c65f,_0x4482c6){return db[_0xd8ce('0x26')][_0xd8ce('0x43')]()['then'](respondWithResult(_0x4482c6,null))[_0xd8ce('0x3c')](handleError(_0x4482c6,null));}; \ No newline at end of file +var _0x9136=['create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','fields','include'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x9136,0x138));var _0x6913=function(_0x2d65fa,_0x5b28e0){_0x2d65fa=_0x2d65fa-0x0;var _0x29e73d=_0x9136[_0x2d65fa];return _0x29e73d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6913('0x0'));var zipdir=require(_0x6913('0x1'));var jsonpatch=require(_0x6913('0x2'));var rp=require(_0x6913('0x3'));var moment=require(_0x6913('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6913('0x5'));var util=require(_0x6913('0x6'));var path=require('path');var sox=require(_0x6913('0x7'));var csv=require('to-csv');var ejs=require(_0x6913('0x8'));var fs=require('fs');var fs_extra=require(_0x6913('0x9'));var _=require('lodash');var squel=require(_0x6913('0xa'));var crypto=require(_0x6913('0xb'));var jsforce=require(_0x6913('0xc'));var deskjs=require(_0x6913('0xd'));var toCsv=require(_0x6913('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6913('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6913('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6913('0x11'));var logger=require(_0x6913('0x12'))(_0x6913('0x13'));var utils=require(_0x6913('0x14'));var config=require(_0x6913('0x15'));var licenseUtil=require(_0x6913('0x16'));var db=require(_0x6913('0x17'))['db'];function respondWithStatusCode(_0x5706b1,_0x2c10e2){_0x2c10e2=_0x2c10e2||0xcc;return function(_0x536d4c){if(_0x536d4c){return _0x5706b1[_0x6913('0x18')](_0x2c10e2);}return _0x5706b1[_0x6913('0x19')](_0x2c10e2)[_0x6913('0x1a')]();};}function respondWithResult(_0x52bfcb,_0x5ea1e4){_0x5ea1e4=_0x5ea1e4||0xc8;return function(_0x5b6128){if(_0x5b6128){return _0x52bfcb[_0x6913('0x19')](_0x5ea1e4)[_0x6913('0x1b')](_0x5b6128);}};}function respondWithFilteredResult(_0x55510b,_0x51a59f){return function(_0x35f7db){if(_0x35f7db){var _0x1292e7=typeof _0x51a59f['offset']==='undefined'&&typeof _0x51a59f[_0x6913('0x1c')]===_0x6913('0x1d');var _0xcbf1e6=_0x35f7db[_0x6913('0x1e')];var _0x3564be=_0x1292e7?0x0:_0x51a59f[_0x6913('0x1f')];var _0x1d1bb1=_0x1292e7?_0x35f7db[_0x6913('0x1e')]:_0x51a59f['offset']+_0x51a59f[_0x6913('0x1c')];var _0x40e591;if(_0x1d1bb1>=_0xcbf1e6){_0x1d1bb1=_0xcbf1e6;_0x40e591=0xc8;}else{_0x40e591=0xce;}_0x55510b[_0x6913('0x19')](_0x40e591);return _0x55510b[_0x6913('0x20')]('Content-Range',_0x3564be+'-'+_0x1d1bb1+'/'+_0xcbf1e6)[_0x6913('0x1b')](_0x35f7db);}return null;};}function patchUpdates(_0x114a05){return function(_0x46591c){try{jsonpatch[_0x6913('0x21')](_0x46591c,_0x114a05,!![]);}catch(_0x256029){return BPromise[_0x6913('0x22')](_0x256029);}return _0x46591c[_0x6913('0x23')]();};}function saveUpdates(_0x3530f3,_0x233e0b){return function(_0x10ca15){if(_0x10ca15){return _0x10ca15[_0x6913('0x24')](_0x3530f3)[_0x6913('0x25')](function(_0x5ef6d9){return _0x5ef6d9;});}return null;};}function removeEntity(_0x5b1a15,_0x33bb8c){return function(_0x3c9f0a){if(_0x3c9f0a){return _0x3c9f0a[_0x6913('0x26')]()[_0x6913('0x25')](function(){_0x5b1a15[_0x6913('0x19')](0xcc)[_0x6913('0x1a')]();});}};}function handleEntityNotFound(_0x4321f1,_0x378edd){return function(_0x1d7cfc){if(!_0x1d7cfc){_0x4321f1[_0x6913('0x18')](0x194);}return _0x1d7cfc;};}function handleError(_0x14b298,_0x1c5245){_0x1c5245=_0x1c5245||0x1f4;return function(_0x36541c){logger[_0x6913('0x27')](_0x36541c[_0x6913('0x28')]);if(_0x36541c['name']){delete _0x36541c[_0x6913('0x29')];}_0x14b298['status'](_0x1c5245)[_0x6913('0x2a')](_0x36541c);};}exports[_0x6913('0x2b')]=function(_0x39bba6,_0xc3b9be){var _0x95228b={},_0x5de1fd={},_0x55bd55={'count':0x0,'rows':[]};var _0x32523a=_[_0x6913('0x2c')](db[_0x6913('0x2d')][_0x6913('0x2e')],function(_0x4b02b8){return{'name':_0x4b02b8[_0x6913('0x2f')],'type':_0x4b02b8[_0x6913('0x30')][_0x6913('0x31')]};});_0x5de1fd[_0x6913('0x32')]=_['map'](_0x32523a,_0x6913('0x29'));_0x5de1fd[_0x6913('0x33')]=_[_0x6913('0x34')](_0x39bba6[_0x6913('0x33')]);_0x5de1fd[_0x6913('0x35')]=_[_0x6913('0x36')](_0x5de1fd[_0x6913('0x32')],_0x5de1fd['query']);_0x95228b[_0x6913('0x37')]=_['intersection'](_0x5de1fd[_0x6913('0x32')],qs['fields'](_0x39bba6[_0x6913('0x33')]['fields']));_0x95228b[_0x6913('0x37')]=_0x95228b[_0x6913('0x37')][_0x6913('0x38')]?_0x95228b[_0x6913('0x37')]:_0x5de1fd[_0x6913('0x32')];if(!_0x39bba6[_0x6913('0x33')][_0x6913('0x39')](_0x6913('0x3a'))){_0x95228b[_0x6913('0x1c')]=qs[_0x6913('0x1c')](_0x39bba6[_0x6913('0x33')][_0x6913('0x1c')]);_0x95228b[_0x6913('0x1f')]=qs['offset'](_0x39bba6['query']['offset']);}_0x95228b[_0x6913('0x3b')]=qs[_0x6913('0x3c')](_0x39bba6[_0x6913('0x33')][_0x6913('0x3c')]);_0x95228b[_0x6913('0x3d')]=qs['filters'](_[_0x6913('0x3e')](_0x39bba6[_0x6913('0x33')],_0x5de1fd[_0x6913('0x35')]),_0x32523a);if(_0x39bba6[_0x6913('0x33')][_0x6913('0x3f')]){_0x95228b[_0x6913('0x3d')]=_[_0x6913('0x40')](_0x95228b[_0x6913('0x3d')],{'$or':_[_0x6913('0x2c')](_0x32523a,function(_0x3deddd){if(_0x3deddd[_0x6913('0x30')]!=='VIRTUAL'){var _0x490615={};_0x490615[_0x3deddd['name']]={'$like':'%'+_0x39bba6[_0x6913('0x33')][_0x6913('0x3f')]+'%'};return _0x490615;}})});}_0x95228b=_[_0x6913('0x40')]({},_0x95228b,_0x39bba6[_0x6913('0x41')]);var _0x5e5222={'where':_0x95228b[_0x6913('0x3d')]};return db[_0x6913('0x2d')][_0x6913('0x1e')](_0x5e5222)[_0x6913('0x25')](function(_0x39a008){_0x55bd55[_0x6913('0x1e')]=_0x39a008;if(_0x39bba6[_0x6913('0x33')][_0x6913('0x42')]){_0x95228b['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x6913('0x43')](_0x95228b);})[_0x6913('0x25')](function(_0x3a9ae9){_0x55bd55['rows']=_0x3a9ae9;return _0x55bd55;})[_0x6913('0x25')](respondWithFilteredResult(_0xc3b9be,_0x95228b))[_0x6913('0x44')](handleError(_0xc3b9be,null));};exports[_0x6913('0x45')]=function(_0x3a90fe,_0x3c18db){var _0x355e7a={'raw':!![],'where':{'id':_0x3a90fe[_0x6913('0x46')]['id']}},_0x480ee2={};_0x480ee2[_0x6913('0x32')]=_[_0x6913('0x34')](db['WhatsappTransferReport'][_0x6913('0x2e')]);_0x480ee2[_0x6913('0x33')]=_['keys'](_0x3a90fe['query']);_0x480ee2[_0x6913('0x35')]=_[_0x6913('0x36')](_0x480ee2[_0x6913('0x32')],_0x480ee2[_0x6913('0x33')]);_0x355e7a[_0x6913('0x37')]=_[_0x6913('0x36')](_0x480ee2['model'],qs['fields'](_0x3a90fe['query'][_0x6913('0x47')]));_0x355e7a[_0x6913('0x37')]=_0x355e7a[_0x6913('0x37')][_0x6913('0x38')]?_0x355e7a['attributes']:_0x480ee2[_0x6913('0x32')];if(_0x3a90fe[_0x6913('0x33')][_0x6913('0x42')]){_0x355e7a[_0x6913('0x48')]=[{'all':!![]}];}_0x355e7a=_['merge']({},_0x355e7a,_0x3a90fe[_0x6913('0x41')]);return db[_0x6913('0x2d')]['find'](_0x355e7a)[_0x6913('0x25')](handleEntityNotFound(_0x3c18db,null))['then'](respondWithResult(_0x3c18db,null))['catch'](handleError(_0x3c18db,null));};exports[_0x6913('0x49')]=function(_0x2e384b,_0x11a9cc){return db[_0x6913('0x2d')][_0x6913('0x49')](_0x2e384b['body'],{})[_0x6913('0x25')](respondWithResult(_0x11a9cc,0xc9))[_0x6913('0x44')](handleError(_0x11a9cc,null));};exports[_0x6913('0x24')]=function(_0x293ba0,_0x5bc213){if(_0x293ba0[_0x6913('0x4a')]['id']){delete _0x293ba0['body']['id'];}return db[_0x6913('0x2d')]['find']({'where':{'id':_0x293ba0[_0x6913('0x46')]['id']}})[_0x6913('0x25')](handleEntityNotFound(_0x5bc213,null))[_0x6913('0x25')](saveUpdates(_0x293ba0[_0x6913('0x4a')],null))[_0x6913('0x25')](respondWithResult(_0x5bc213,null))['catch'](handleError(_0x5bc213,null));};exports[_0x6913('0x26')]=function(_0x155c1e,_0x1fbbab){return db[_0x6913('0x2d')][_0x6913('0x4b')]({'where':{'id':_0x155c1e[_0x6913('0x46')]['id']}})[_0x6913('0x25')](handleEntityNotFound(_0x1fbbab,null))[_0x6913('0x25')](removeEntity(_0x1fbbab,null))[_0x6913('0x44')](handleError(_0x1fbbab,null));};exports[_0x6913('0x4c')]=function(_0x2aee9,_0x25955c){return db[_0x6913('0x2d')][_0x6913('0x4c')]()[_0x6913('0x25')](respondWithResult(_0x25955c,null))[_0x6913('0x44')](handleError(_0x25955c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d83441b..d7f7070 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 _0x11cc=['path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1c512d,_0x38c07c){var _0x4cf33e=function(_0x5166c0){while(--_0x5166c0){_0x1c512d['push'](_0x1c512d['shift']());}};_0x4cf33e(++_0x38c07c);}(_0x11cc,0x78));var _0xc11c=function(_0x42afde,_0x377195){_0x42afde=_0x42afde-0x0;var _0x5e9990=_0x11cc[_0x42afde];return _0x5e9990;};'use strict';var _=require(_0xc11c('0x0'));var util=require(_0xc11c('0x1'));var logger=require('../../config/logger')(_0xc11c('0x2'));var moment=require(_0xc11c('0x3'));var BPromise=require(_0xc11c('0x4'));var rp=require(_0xc11c('0x5'));var fs=require('fs');var path=require(_0xc11c('0x6'));var rimraf=require('rimraf');var config=require(_0xc11c('0x7'));var attributes=require(_0xc11c('0x8'));module[_0xc11c('0x9')]=function(_0x34eb98,_0x4c435c){return _0x34eb98[_0xc11c('0xa')](_0xc11c('0xb'),attributes,{'tableName':_0xc11c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc11c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53cd=['rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x149bb7,_0x2dccbb){var _0x6dea98=function(_0x2a717b){while(--_0x2a717b){_0x149bb7['push'](_0x149bb7['shift']());}};_0x6dea98(++_0x2dccbb);}(_0x53cd,0xf5));var _0xd53c=function(_0x3ae50a,_0x1981d0){_0x3ae50a=_0x3ae50a-0x0;var _0x313b68=_0x53cd[_0x3ae50a];return _0x313b68;};'use strict';var _=require(_0xd53c('0x0'));var util=require(_0xd53c('0x1'));var logger=require(_0xd53c('0x2'))('api');var moment=require(_0xd53c('0x3'));var BPromise=require(_0xd53c('0x4'));var rp=require(_0xd53c('0x5'));var fs=require('fs');var path=require(_0xd53c('0x6'));var rimraf=require(_0xd53c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd53c('0x8'));module[_0xd53c('0x9')]=function(_0x33d039,_0x1ccd40){return _0x33d039[_0xd53c('0xa')](_0xd53c('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 3de7b4e..cf8a6e5 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 _0x126d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x126d,0xc7));var _0xd126=function(_0x353800,_0x10aeec){_0x353800=_0x353800-0x0;var _0x390a5b=_0x126d[_0x353800];return _0x390a5b;};'use strict';var _=require(_0xd126('0x0'));var util=require(_0xd126('0x1'));var moment=require(_0xd126('0x2'));var BPromise=require(_0xd126('0x3'));var rs=require(_0xd126('0x4'));var fs=require('fs');var Redis=require(_0xd126('0x5'));var db=require(_0xd126('0x6'))['db'];var utils=require(_0xd126('0x7'));var logger=require('../../config/logger')(_0xd126('0x8'));var config=require(_0xd126('0x9'));var jayson=require(_0xd126('0xa'));var client=jayson[_0xd126('0xb')][_0xd126('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23f6c3,_0x36834c,_0x390427){return new BPromise(function(_0x3d8f98,_0x5e30a7){return client['request'](_0x23f6c3,_0x390427)[_0xd126('0xd')](function(_0x27507c){logger[_0xd126('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x36834c,'request\x20sent');logger[_0xd126('0xf')](_0xd126('0x10'),_0x36834c,'request\x20sent',JSON[_0xd126('0x11')](_0x27507c));if(_0x27507c[_0xd126('0x12')]){if(_0x27507c[_0xd126('0x12')][_0xd126('0x13')]===0x1f4){logger[_0xd126('0x12')](_0xd126('0x14'),_0x36834c,_0x27507c[_0xd126('0x12')][_0xd126('0x15')]);return _0x5e30a7(_0x27507c['error'][_0xd126('0x15')]);}logger['error'](_0xd126('0x14'),_0x36834c,_0x27507c[_0xd126('0x12')][_0xd126('0x15')]);return _0x3d8f98(_0x27507c['error']['message']);}else{logger[_0xd126('0xe')](_0xd126('0x14'),_0x36834c,_0xd126('0x16'));_0x3d8f98(_0x27507c[_0xd126('0x17')][_0xd126('0x15')]);}})[_0xd126('0x18')](function(_0x2e0606){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x36834c,_0x2e0606);_0x5e30a7(_0x2e0606);});});} \ No newline at end of file +var _0x315e=['request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x315e,0x143));var _0xe315=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x315e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var moment=require(_0xe315('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe315('0x3'));var db=require(_0xe315('0x4'))['db'];var utils=require(_0xe315('0x5'));var logger=require(_0xe315('0x6'))(_0xe315('0x7'));var config=require(_0xe315('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe315('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x360eda,_0x57504b,_0x36f222){return new BPromise(function(_0x42e13c,_0x56cbc4){return client[_0xe315('0xa')](_0x360eda,_0x36f222)[_0xe315('0xb')](function(_0x33bb0b){logger[_0xe315('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x57504b,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x57504b,'request\x20sent',JSON[_0xe315('0xd')](_0x33bb0b));if(_0x33bb0b['error']){if(_0x33bb0b[_0xe315('0xe')]['code']===0x1f4){logger['error'](_0xe315('0xf'),_0x57504b,_0x33bb0b[_0xe315('0xe')]['message']);return _0x56cbc4(_0x33bb0b[_0xe315('0xe')][_0xe315('0x10')]);}logger[_0xe315('0xe')](_0xe315('0xf'),_0x57504b,_0x33bb0b[_0xe315('0xe')][_0xe315('0x10')]);return _0x42e13c(_0x33bb0b[_0xe315('0xe')][_0xe315('0x10')]);}else{logger['info'](_0xe315('0xf'),_0x57504b,_0xe315('0x11'));_0x42e13c(_0x33bb0b[_0xe315('0x12')][_0xe315('0x10')]);}})[_0xe315('0x13')](function(_0x13c8d5){logger['error'](_0xe315('0xf'),_0x57504b,_0x13c8d5);_0x56cbc4(_0x13c8d5);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 0781b38..77659a5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6347=['error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x3d6f5e,_0x298b35){var _0x47651c=function(_0xacae01){while(--_0xacae01){_0x3d6f5e['push'](_0x3d6f5e['shift']());}};_0x47651c(++_0x298b35);}(_0x6347,0x1c9));var _0x7634=function(_0xfc21ee,_0x236af1){_0xfc21ee=_0xfc21ee-0x0;var _0x38b17a=_0x6347[_0xfc21ee];return _0x38b17a;};'use strict';var _=require(_0x7634('0x0'));var db=require(_0x7634('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x7634('0x2'));var rpc=require(_0x7634('0x3'));var config=require(_0x7634('0x4'));var logger=require(_0x7634('0x5'))('app');var pm2=require(_0x7634('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x7634('0x7'));var chat=require(_0x7634('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x7634('0x9'));function main(){return db[_0x7634('0xa')][_0x7634('0xb')]()[_0x7634('0xc')](function(){if(config[_0x7634('0xd')]){return seedDb[_0x7634('0xe')]();}})['then'](function(){return checkLicense[_0x7634('0xe')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x2b1bef){logger[_0x7634('0xf')](_0x2b1bef);return chat[_0x7634('0x10')]();})[_0x7634('0xc')](function(){return whatsapp[_0x7634('0x10')]();})['then'](function(){return schedule['start']();})[_0x7634('0xc')](function(){return transcribe[_0x7634('0x10')]();})[_0x7634('0xc')](function(){return provider[_0x7634('0x10')]();})[_0x7634('0xc')](function(_0x9b7445){logger[_0x7634('0xf')](_0x9b7445);return pm2[_0x7634('0x10')](pm2Config);})['then'](function(_0x3b0fd4){var _0x439d57=_0x3b0fd4[_0x7634('0x11')](function(_0x20dc07){return typeof _0x20dc07['exitCode']===_0x7634('0x12')&&_0x20dc07['exitCode']>=0x0;});if(_0x439d57[_0x7634('0x13')]>0x0){throw new Error(_0x439d57[_0x7634('0x13')]+_0x7634('0x14')+_[_0x7634('0x15')](_0x439d57,function(_0x5cfed7){return'\x22'+_0x5cfed7[_0x7634('0x16')]['name']+'\x22';}));}logger[_0x7634('0xf')](_0x7634('0x17'),_['map'](_[_0x7634('0x11')](_0x3b0fd4,{'status':_0x7634('0x18')}),'name')[_0x7634('0x19')]());logger['info'](_0x7634('0x1a'),_['map'](_[_0x7634('0x11')](_0x3b0fd4,function(_0xbe6288){return _0xbe6288[_0x7634('0x1b')]!==_0x7634('0x18');}),'name')[_0x7634('0x19')]()||_0x7634('0x1c'));console[_0x7634('0x1d')](_0x7634('0x1e'));})[_0x7634('0x1f')](function(_0x49cd89){console[_0x7634('0x1d')](_0x7634('0x20'),_0x49cd89);logger[_0x7634('0x21')](_0x7634('0x22'),_0x49cd89);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x3f1c=['length','map','pm2_env','name','Online\x20apps:','online','join','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','number','exitCode'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x3e9908,_0x34cbf8){_0x3e9908=_0x3e9908-0x0;var _0x3e3b3b=_0x3f1c[_0x3e9908];return _0x3e3b3b;};'use strict';var _=require(_0xc3f1('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xc3f1('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xc3f1('0x2'))(_0xc3f1('0x3'));var pm2=require(_0xc3f1('0x4'));var pm2Config=require(_0xc3f1('0x5'));var schedule=require(_0xc3f1('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xc3f1('0x7'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xc3f1('0x8'));function main(){return db[_0xc3f1('0x9')][_0xc3f1('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0xc3f1('0xb')]();}})['then'](function(){return checkLicense[_0xc3f1('0xb')]();})[_0xc3f1('0xc')](function(){return rpc[_0xc3f1('0xd')]();})[_0xc3f1('0xc')](function(_0x4f2771){logger[_0xc3f1('0xe')](_0x4f2771);return chat['start']();})[_0xc3f1('0xc')](function(){return whatsapp['start']();})[_0xc3f1('0xc')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xc3f1('0xf')]();})[_0xc3f1('0xc')](function(){return provider[_0xc3f1('0xf')]();})[_0xc3f1('0xc')](function(_0x36aac1){logger[_0xc3f1('0xe')](_0x36aac1);return pm2['start'](pm2Config);})['then'](function(_0x1d9ea7){var _0x3ad406=_0x1d9ea7[_0xc3f1('0x10')](function(_0x23eb8c){return typeof _0x23eb8c['exitCode']===_0xc3f1('0x11')&&_0x23eb8c[_0xc3f1('0x12')]>=0x0;});if(_0x3ad406[_0xc3f1('0x13')]>0x0){throw new Error(_0x3ad406[_0xc3f1('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xc3f1('0x14')](_0x3ad406,function(_0x59e1e3){return'\x22'+_0x59e1e3[_0xc3f1('0x15')][_0xc3f1('0x16')]+'\x22';}));}logger[_0xc3f1('0xe')](_0xc3f1('0x17'),_['map'](_[_0xc3f1('0x10')](_0x1d9ea7,{'status':_0xc3f1('0x18')}),_0xc3f1('0x16'))[_0xc3f1('0x19')]());logger[_0xc3f1('0xe')]('Offline\x20apps:',_[_0xc3f1('0x14')](_['filter'](_0x1d9ea7,function(_0x546627){return _0x546627[_0xc3f1('0x1a')]!==_0xc3f1('0x18');}),_0xc3f1('0x16'))[_0xc3f1('0x19')]()||'None');console[_0xc3f1('0x1b')](_0xc3f1('0x1c'));})[_0xc3f1('0x1d')](function(_0x1a136f){console[_0xc3f1('0x1b')](_0xc3f1('0x1e'),_0x1a136f);logger[_0xc3f1('0x1f')](_0xc3f1('0x20'),_0x1a136f);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 9b74031..d09cdce 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 _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x19107b,_0x366bf6){var _0x3bd484=function(_0x100cb3){while(--_0x100cb3){_0x19107b['push'](_0x19107b['shift']());}};_0x3bd484(++_0x366bf6);}(_0xedd9,0xfc));var _0x9edd=function(_0x28710d,_0x2b828d){_0x28710d=_0x28710d-0x0;var _0x2b7fa1=_0xedd9[_0x28710d];return _0x2b7fa1;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file +var _0x70e0=['express-jwt','composable-middleware','crypto','util','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','authenticate','Bearer','status','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','encryptString','promisify','sign','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken'];(function(_0x2ed1e7,_0x5e40f8){var _0x2c8569=function(_0x406853){while(--_0x406853){_0x2ed1e7['push'](_0x2ed1e7['shift']());}};_0x2c8569(++_0x5e40f8);}(_0x70e0,0x17b));var _0x070e=function(_0x201d73,_0x2f9001){_0x201d73=_0x201d73-0x0;var _0x2ee352=_0x70e0[_0x201d73];return _0x2ee352;};'use strict';var db=require(_0x070e('0x0'))['db'];var config=require(_0x070e('0x1'));var hardwareConf=require(_0x070e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x070e('0x3'));var jwt=require(_0x070e('0x4'));var expressJwt=require(_0x070e('0x5'));var compose=require(_0x070e('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x070e('0x7'));var BPromise=require('bluebird');var util=require(_0x070e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x070e('0x9'),_0x070e('0xa'),_0x070e('0xb'),_0x070e('0xc'),_0x070e('0xd'),_0x070e('0xe'),_0x070e('0xf'),'md5secret','voicePause',_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13'),_0x070e('0x14'),_0x070e('0x15'),_0x070e('0x16'),_0x070e('0x17'),_0x070e('0x18'),_0x070e('0x19'),_0x070e('0x1a'),'passwordResetAt','alias',_0x070e('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x070e('0x1c'),_0x070e('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x070e('0x1e'),_0x070e('0x1f'),_0x070e('0x20'),_0x070e('0x21'),'userProfileId','privacyEnabled',_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26'),'ignorePauseForPreviewCalls',_0x070e('0x27'),_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a'),_0x070e('0x2b'),'smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer',_0x070e('0x2c'),_0x070e('0x2d'),_0x070e('0x2e'),'whatsappAutoanswer',_0x070e('0x2f')];exports['isChatInteractionAuthorized']=function(){return this[_0x070e('0x30')](!![])[_0x070e('0x31')](function(_0x27a01e,_0x33e8c6,_0x28a1c3){if(_0x27a01e[_0x070e('0x32')]){_0x28a1c3();}else{return db[_0x070e('0x33')][_0x070e('0x34')]({'where':{'id':_0x27a01e['params']['id']},'attributes':['id',_0x070e('0x35'),_0x070e('0x36')],'raw':!![]})[_0x070e('0x37')](function(_0x503f4d){if(_0x503f4d&&_0x503f4d[_0x070e('0x35')]){return _0x33e8c6['status'](_0x503f4d['disposition']===_0x070e('0x38')?0x195:0x193)[_0x070e('0x39')]({'message':_0x503f4d[_0x070e('0x36')]===_0x070e('0x38')?_0x070e('0x3a'):'Forbidden.'});}else{_0x28a1c3();}})[_0x070e('0x3b')](function(_0x219e48){_0x28a1c3(_0x219e48);});}});};exports[_0x070e('0x30')]=function isAuthenticated(_0x1d2a34){return compose()[_0x070e('0x31')](function(_0x28d7f2,_0x1a1892,_0x26373b){var _0x5e8326;if(_0x28d7f2[_0x070e('0x3c')][_0x070e('0x3d')]){if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x3f'))){var _0x46065c=basicAuth(_0x28d7f2);db[_0x070e('0x40')]['find']({'where':{'name':_0x46065c[_0x070e('0xb')]}})[_0x070e('0x37')](function(_0x3a9425){if(!_0x3a9425||!_0x3a9425[_0x070e('0x41')](_0x46065c['pass'])){return _0x1a1892['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28d7f2[_0x070e('0x32')]={'id':_0x3a9425['id']};_0x26373b();})['catch'](function(_0x1dff97){_0x26373b(_0x1dff97);});}else if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x42'))){validateJwt(_0x28d7f2,_0x1a1892,_0x26373b);}else{if(_0x1d2a34){_0x26373b();}else{return _0x1a1892[_0x070e('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x28d7f2[_0x070e('0x44')][_0x070e('0x45')]){try{var _0x444d02={'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};verifyJwt(_0x28d7f2['query']['apikey'],_0x444d02)[_0x070e('0x37')](function(_0x3011c4){return db[_0x070e('0x40')][_0x070e('0x47')]({'where':{'id':_0x3011c4[_0x070e('0x48')]}})['then'](function(_0x22f3a9){_0x5e8326=_0x22f3a9;return db[_0x070e('0x49')]['findOne']({'where':{'id':0x1},'attributes':[_0x070e('0x4a'),_0x070e('0x4b')],'raw':!![]});})['then'](function(_0x4d4ee8){if(!_0x5e8326||!_['isEqual'](_0x5e8326[_0x070e('0x4c')],_0x3011c4[_0x070e('0x4d')])){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4e')});}if(_0x5e8326['disabled']){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}if(_0x5e8326['blocked']){if(_0x4d4ee8[_0x070e('0x4b')]>0x0){if(moment(_0x5e8326[_0x070e('0x50')])[_0x070e('0x51')](_0x4d4ee8['blockDuration'],_0x070e('0x52'))>moment()){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});}}else{return _0x1a1892['status'](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}}_0x28d7f2[_0x070e('0x32')]={'id':_0x5e8326['id']};_0x26373b();});})[_0x070e('0x3b')](function(){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});});}catch(_0x5db2ce){_0x26373b(_0x5db2ce);}}else if(_0x1d2a34){_0x26373b();}else{return _0x1a1892['status'](0x193)[_0x070e('0x39')]({'message':_0x070e('0x53')});}})[_0x070e('0x31')](function(_0x4d52ff,_0x2ad56c,_0x1223be){if(_0x4d52ff[_0x070e('0x32')]){db[_0x070e('0x40')]['find']({'where':{'id':_0x4d52ff[_0x070e('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x544b53){if(!_0x544b53){return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':_0x070e('0x54')});}_0x4d52ff[_0x070e('0x32')]=_0x544b53;_0x1223be();})[_0x070e('0x3b')](function(_0x34f23e){_0x1223be(_0x34f23e);});}else if(_0x1d2a34){_0x1223be();}else{return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x070e('0x55')]=function canUpdate(){return compose()[_0x070e('0x31')](function(_0xff760c,_0x52fcea,_0x54285a){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x35349f){if(_0x35349f[_0x070e('0x57')]){_0x54285a();}else{return _0x52fcea[_0x070e('0x43')](0x193)['json']({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x48d836){_0x54285a(_0x48d836);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x070e('0x31')](function(_0x945901,_0x2d43ce,_0x1fc7c4){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x20b80e){if(_0x20b80e[_0x070e('0x59')]){_0x1fc7c4();}else{return _0x2d43ce[_0x070e('0x43')](0x193)[_0x070e('0x39')]({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x1f54d5){_0x1fc7c4(_0x1f54d5);});});};exports[_0x070e('0x5a')]=function(_0xd67987,_0x66a3f3,_0x210c4d){_0xd67987[_0x070e('0x5a')]=!![];return _0x210c4d();};exports[_0x070e('0x5b')]=function signToken(_0x216d27){return signJwt(_0x216d27);};exports[_0x070e('0x5c')]=function(_0x5e051a,_0x171621){if(!_0x5e051a[_0x070e('0x32')]){return _0x171621[_0x070e('0x43')](0x194)[_0x070e('0x39')]({'message':_0x070e('0x5d')});}var _0x3bd738={'payload':{'id':_0x5e051a[_0x070e('0x32')]['id'],'role':_0x5e051a[_0x070e('0x32')][_0x070e('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3bd738)['then'](function(_0x251696){_0x171621['cookie'](_0x070e('0x5e'),_0x251696);_0x171621[_0x070e('0x5f')]('/dashboards/general');})[_0x070e('0x3b')](function(_0x130a50){return _0x171621[_0x070e('0x43')](0x1f4)[_0x070e('0x60')](_0x130a50);});};exports[_0x070e('0x61')]=function(_0x1e8a4f){if(_[_0x070e('0x62')](_0x1e8a4f['apiKeyNonce'])||_[_0x070e('0x62')](_0x1e8a4f['apiKeyIat'])){return null;}else{return createJwt(_0x1e8a4f);}};exports['generateApiKey']=function(_0x3a06c6){_0x3a06c6[_0x070e('0x4c')]=generateNonce();_0x3a06c6[_0x070e('0x63')]=generateIssuedAt();return createJwt(_0x3a06c6);};exports[_0x070e('0x64')]=function(_0x202015,_0x7948ed){var _0x440fa1=_0x202015[_0x070e('0x44')]['apikey'];if(_0x440fa1){var _0x477e69={'nonce':_0x7948ed['apiKeyNonce'],'iat':_0x7948ed['apiKeyIat'],'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};return verifyJwt(_0x440fa1,_0x477e69)['then'](function(){return generateApiKey(_0x7948ed);});}else{throw{'message':_0x070e('0x65')};}};exports[_0x070e('0x66')]=function(_0x210f4a){var _0x2f8104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f8104[_0x070e('0x67')](_0x210f4a))throw new db[(_0x070e('0x68'))][(_0x070e('0x69'))]('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(_0x5943e3,_0x3087e5,_0x1948a5){var _0x29f497=encryptor[_0x070e('0x6a')](_0x3087e5)['split'](',');for(var _0x25f34c=0x0;_0x25f34c<_0x1948a5;_0x25f34c++){if(!_0x29f497[_0x25f34c])break;if(_0x5943e3['toLowerCase']()===_0x29f497[_0x25f34c][_0x070e('0x6b')]()){var _0x1cbb7e=util[_0x070e('0x6c')](_0x070e('0x6d'),_0x1948a5);if(_0x1948a5===0x1){_0x1cbb7e=_0x070e('0x6e');}throw new db[(_0x070e('0x68'))]['ValidationError'](_0x1cbb7e);}}return;};exports[_0x070e('0x6f')]=function(_0x18e8d0,_0x8aaf00){var _0x533431=_0x8aaf00?encryptor[_0x070e('0x6a')](_0x8aaf00)[_0x070e('0x70')](','):[];if(_0x533431['length']===0x5){_0x533431[_0x070e('0x71')](-0x1,0x1);}_0x533431['unshift'](_0x18e8d0);return encryptor[_0x070e('0x72')](_0x533431['join'](','));};function signJwt(_0x4cb86f){var _0x4b354d=BPromise[_0x070e('0x73')](jwt[_0x070e('0x74')],{'context':jwt});var _0x1100d8=_0x4cb86f[_0x070e('0x75')]||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x498bc6,_0x841c89){_0x4b354d(_0x4cb86f['payload'],_0x1100d8,_0x4cb86f[_0x070e('0x78')])['then'](function(_0x2e10f7){_0x498bc6(_0x2e10f7);})[_0x070e('0x3b')](function(_0x5b0b46){_0x841c89(_0x5b0b46);});});}function verifyJwt(_0x1bcdc3,_0x50399e,_0x1a9e25){var _0x139630=BPromise[_0x070e('0x73')](jwt[_0x070e('0x79')],{'context':jwt});var _0x764b06=_0x1a9e25||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x148f1d,_0x3ef9cc){_0x139630(_0x1bcdc3,_0x764b06,_0x50399e)[_0x070e('0x37')](function(_0x40c560){_0x148f1d(_0x40c560);})[_0x070e('0x3b')](function(_0x455bf2){_0x3ef9cc(_0x455bf2);});});}function generateNonce(){return crypto[_0x070e('0x7a')](0x10)['toString'](_0x070e('0x7b'));}function generateIssuedAt(){return Math[_0x070e('0x7c')](Date[_0x070e('0x7d')]()/0x3e8)[_0x070e('0x7e')]();}function createJwt(_0x5712d1){var _0x2ccd8d={'payload':{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')]},'options':{'algorithm':_0x070e('0x7f'),'subject':_0x5712d1['id'][_0x070e('0x7e')](),'issuer':hardwareConf[_0x070e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2ccd8d)[_0x070e('0x37')](function(_0x7d154){return{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')],'token':_0x7d154};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index d07dd67..f95e345 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0x1aba20,_0x1f6955){var _0x2a7ad4=function(_0x10d7ae){while(--_0x10d7ae){_0x1aba20['push'](_0x1aba20['shift']());}};_0x2a7ad4(++_0x1f6955);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f1837,_0x4b304e){_0x1f1837=_0x1f1837-0x0;var _0x25ab57=_0xb10b[_0x1f1837];return _0x25ab57;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file +var _0x757a=['findOne','slice','fieldType','keys','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','clause','rows','catch','describe','startsWith','cf_','map','CmCustomField'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x757a,0xde));var _0xa757=function(_0x374a1b,_0x146b6c){_0x374a1b=_0x374a1b-0x0;var _0x2673fd=_0x757a[_0x374a1b];return _0x2673fd;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa757('0x0'));var db=require(_0xa757('0x1'))['db'];exports['findAll']=function(_0x5c03c3,_0x5709ed,_0x32be3b,_0x1721c6){var _0x1c2932={'count':0x0,'rows':[]};var _0x453d07=sqlUtils[_0xa757('0x2')](_0x5709ed,_0x5c03c3);if(_0x453d07){return Promise[_0xa757('0x3')](_0x1c2932);}var _0x5edca8=sqlUtils[_0xa757('0x4')]();var _0x4343b6={};var _0x53be0e=![];var _0x2930fa=![];return Promise[_0xa757('0x3')]()[_0xa757('0x5')](function(){if(_0x5c03c3[_0xa757('0x6')]){return sqlUtils[_0xa757('0x7')](_0x5c03c3['search'],_0x1721c6);}else{return sqlUtils[_0xa757('0x8')](_0x5c03c3,_0x1721c6);}})[_0xa757('0x5')](function(_0x32f0ec){_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xa')]);_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xb')]);_0x5edca8['where'](_0x32f0ec['filter']);_0x5edca8['where'](_0x32f0ec['user']['clause']);_0x4343b6=_0x32f0ec[_0xa757('0xc')];_0x2930fa=_0x32f0ec['user']['skip'];return sqlUtils[_0xa757('0xd')](_0x5709ed,_0x5c03c3,_0x2930fa);})['then'](function(_0x481508){_0x5edca8[_0xa757('0x9')](_0x481508);var _0x1b670e=_0x5c03c3[_0xa757('0x6')]?_0x4343b6[_0xa757('0xe')]:_0x5c03c3[_0xa757('0xf')];_0x53be0e=_0x1b670e?!![]:![];return sqlUtils[_0xa757('0x10')](_0x5edca8,_0x1b670e);})[_0xa757('0x5')](function(_0x2f7947){_0x1c2932[_0xa757('0x11')]=_0x2f7947;if(_0x1c2932[_0xa757('0x11')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x5edca8,_0x5c03c3[_0xa757('0xb')],_0x32be3b,_0x53be0e,_0x4343b6[_0xa757('0x12')],_0x2930fa);})[_0xa757('0x5')](function(_0x4d9f58){if(!_0x4d9f58){return[];}return sqlUtils['getFilteredContacts'](_0x4d9f58,_0x5c03c3,_0x32be3b);})[_0xa757('0x5')](function(_0x468d45){_0x1c2932[_0xa757('0x13')]=_0x468d45;return _0x1c2932;})[_0xa757('0x14')](function(_0x27f4ba){throw _0x27f4ba;});};exports[_0xa757('0x15')]=function(){var _0x4bd137={};var _0x58954=[];return db['CmContact'][_0xa757('0x15')]()[_0xa757('0x5')](function(_0x14014c){_0x4bd137=_0x14014c;var _0x2c9ec6=Object['keys'](_0x4bd137)['filter'](function(_0x40ec48){return _[_0xa757('0x16')](_0x40ec48,_0xa757('0x17'))?_0x40ec48:undefined;});var _0x8d121f=_0x2c9ec6[_0xa757('0x18')](function(_0x40562f){return db[_0xa757('0x19')][_0xa757('0x1a')]({'where':{'id':_0x40562f[_0xa757('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x8d121f);})[_0xa757('0x5')](function(_0x59e9d4){for(var _0x422e9e=0x0;_0x422e9e<_0x59e9d4['length'];_0x422e9e++){if(_0x59e9d4[_0x422e9e]){var _0x40551d=_0xa757('0x17')+_0x59e9d4[_0x422e9e]['id'];_0x4bd137[_0x40551d][_0xa757('0x1c')]=_0x59e9d4[_0x422e9e]['type'];}}_0x58954=_[_0xa757('0x18')](Object[_0xa757('0x1d')](_0x4bd137),function(_0x471e84){return{'name':_0x471e84,'type':_0x4bd137[_0x471e84][_0xa757('0x1e')]};});return _0x58954;})['catch'](function(_0x449a7d){throw _0x449a7d;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 8c8b7ad..a736db6 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3299=['color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','push','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','left_join','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','fax','email','CompanyId','updatedAt','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','castTo','type','default','value','start','end','Tag','map','tags','clause','and','ids','User','user','skip','keys','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3299,0x1bc));var _0x9329=function(_0x38bed0,_0x593146){_0x38bed0=_0x38bed0-0x0;var _0x53ae97=_0x3299[_0x38bed0];return _0x53ae97;};'use strict';var _=require('lodash');var squel=require(_0x9329('0x0'));var as=require(_0x9329('0x1'));var qs=require(_0x9329('0x2'));var utils=require(_0x9329('0x3'));var db=require(_0x9329('0x4'))['db'];function skipContactsQuery(_0x6ebea4,_0x2a092c){var _0x3fc97d=![];if(_0x6ebea4[_0x9329('0x5')]===_0x9329('0x6')&&!_0x2a092c[_0x9329('0x7')]&&!_0x2a092c[_0x9329('0x8')]&&_0x2a092c[_0x9329('0x9')]!==_0x9329('0xa')){_0x3fc97d=!![];}return _0x3fc97d;}function getContactsSubquery(){return squel[_0x9329('0xb')]()[_0x9329('0xc')](_0x9329('0xd'),'c')['where'](_0x9329('0xe'));}function applyJoinClauses(_0x1f8b52,_0x1c1033){var _0x171f53=_0x1c1033?'c':_0x9329('0xf');_0x1f8b52['left_join'](_0x9329('0x10'),'uc',_0x9329('0x11')+_0x171f53+'.id')['left_join']('cm_contact_has_tags','ct',_0x9329('0x12')+_0x171f53+_0x9329('0x13'))[_0x9329('0x14')](_0x9329('0x15'),'t',_0x9329('0x16'));return _0x1f8b52;}function addFieldsToQuery(_0x523aff,_0x2d999e,_0x1888a6,_0x10658d,_0x4cc89c){var _0x1ee23e=_0x4cc89c?'c':_0x9329('0xf');if(!_0x2d999e){_0x2d999e=['id','firstName',_0x9329('0x17'),_0x9329('0x18'),'mobile',_0x9329('0x19'),_0x9329('0x1a'),_0x9329('0x8'),_0x9329('0x1b'),'createdAt',_0x9329('0x1c'),'deletedAt',_0x9329('0x1d')];}var _0x1b5eed=_0x1888a6&&_0x4cc89c||!_0x1888a6&&!_0x4cc89c;if(_0x10658d){_0x1b5eed=_0x10658d&&_0x4cc89c||!_0x10658d&&!_0x4cc89c;}_0x2d999e['forEach'](function(_0x41db73){if(_0x41db73===_0x9329('0x1d')){if(_0x1b5eed){_0x523aff['field'](_0x9329('0x1e'),_0x41db73);}else if(_0x1888a6||_0x10658d){_0x523aff['field'](_0x1ee23e+'.'+_0x41db73);}}else{_0x523aff[_0x9329('0x1f')](_0x1ee23e+'.'+_0x41db73);}});return _0x523aff;}function getSqlClauses(){var _0x488ddc={'default':squel[_0x9329('0x20')](),'fields':squel['expr'](),'filter':squel[_0x9329('0x20')](),'tags':{'clause':squel[_0x9329('0x20')](),'ids':null},'user':{'clause':squel[_0x9329('0x20')](),'skip':![]}};return _0x488ddc;}function parseTagParameter(_0x1dbebc){var _0x9da9e1=squel[_0x9329('0x20')]();if(_0x1dbebc){var _0x4a7039=utils[_0x9329('0x21')](_0x1dbebc);_0x4a7039[_0x9329('0x22')](function(_0x387d7d){_0x9da9e1['or'](_0x9329('0x23'),'%,'+_0x387d7d+',%');});}return _0x9da9e1;}function parseSearchFilter(_0x26f8a7){var _0x59fb85=squel[_0x9329('0x20')]();if(_0x26f8a7){var _0x46019b=_0x26f8a7['replace']('\x5c','\x5c\x5c')[_0x9329('0x24')](/'/g,'\x27\x27');if(_0x46019b[_0x9329('0x25')]('\x20')[_0x9329('0x26')]>0x1){_0x59fb85['or'](_0x9329('0x27'),qs['getFullTextValue'](_0x46019b),null);}else{if(qs['isNumeric'](_0x46019b)){_0x59fb85['or'](_0x9329('0x28'),_0x46019b+'%');_0x59fb85['or'](_0x9329('0x29'),_0x46019b+'%');_0x59fb85['or'](_0x9329('0x2a'),_0x46019b+'%');_0x59fb85['or']('c.fax\x20LIKE\x20?',_0x46019b+'%');}else if(qs[_0x9329('0x2b')](_0x46019b)){_0x59fb85['or']('c.email\x20LIKE\x20?',_0x46019b+'%');}else{_0x59fb85['or'](_0x9329('0x2c'),'%'+_0x46019b+'%');_0x59fb85['or'](_0x9329('0x2d'),'%'+_0x46019b+'%');_0x59fb85['or'](_0x9329('0x2e'),'%'+_0x46019b+'%');}}}return _0x59fb85;}function parseAdvancedSearchFilter(_0x573209,_0x57ba4b){var _0x36765a=getSqlClauses();var _0x49d501=as[_0x9329('0x2f')](_0x573209);var _0x4a5d27=_0x49d501[_0x9329('0x30')];for(var _0x4a3c13=0x0;_0x4a3c13<_0x49d501[_0x9329('0x31')][_0x9329('0x26')];_0x4a3c13++){var _0x5cd7db=_0x49d501[_0x9329('0x31')][_0x4a3c13];var _0x27501e='c';var _0x591cac=_[_0x9329('0x32')](_0x57ba4b,[_0x9329('0x33'),_0x5cd7db[_0x9329('0x1f')]]);if(_0x591cac){if(_0x5cd7db[_0x9329('0x1f')]==='dateOfBirth'||_0x591cac['fieldType']==='datetime'){_0x5cd7db[_0x9329('0x34')]='DATE';}var _0x4b4b0d=as['buildExpression'](_0x27501e,_0x591cac[_0x9329('0x35')],_0x5cd7db);_0x36765a[_0x9329('0x36')][_0x4a5d27](_0x4b4b0d['text'],_0x4b4b0d[_0x9329('0x37')][_0x9329('0x38')],_0x4b4b0d[_0x9329('0x37')][_0x9329('0x39')]);}else{if(_0x5cd7db['field']===_0x9329('0x3a')){var _0x3e010a=_0x5cd7db[_0x9329('0x37')][_0x9329('0x25')](',')[_0x9329('0x3b')](function(_0x502fa2){return Number(_0x502fa2);});var _0x503f00=parseTagParameter(_0x3e010a);_0x36765a[_0x9329('0x3c')][_0x9329('0x3d')][_0x9329('0x3e')](_0x503f00);_0x36765a[_0x9329('0x3c')][_0x9329('0x3f')]=_0x3e010a;}else if(_0x5cd7db[_0x9329('0x1f')]===_0x9329('0x40')){_0x36765a[_0x9329('0x41')]['clause'][_0x9329('0x3e')]('uc.UserId\x20=\x20?',_0x5cd7db[_0x9329('0x37')]);_0x36765a[_0x9329('0x41')][_0x9329('0x42')]=!![];}}}return _0x36765a;}function parseModelFields(_0x2c7588,_0x71e99){var _0x42b47c=squel['expr']();var _0x5e8cb3=_(_0x2c7588)[_0x9329('0x43')]()[_0x9329('0x3b')](function(_0x412a01){return _[_0x9329('0x44')](_0x71e99,[_0x9329('0x33'),_0x412a01])?_0x412a01:undefined;})[_0x9329('0x45')]()[_0x9329('0x37')]();if(_0x2c7588[_0x9329('0x46')]){_0x5e8cb3['push'](_0x9329('0x46'));}if(_0x5e8cb3[_0x9329('0x26')]>0x0){_0x5e8cb3[_0x9329('0x22')](function(_0x302a27){if(_0x302a27==='ListId'){_0x42b47c[_0x9329('0x3e')]('c.ListId\x20IN\x20?',[][_0x9329('0x47')](_0x2c7588[_0x302a27]));}else if(_0x302a27==='Contact'){var _0x1a6009='%'+_0x2c7588[_0x302a27]+'%';_0x42b47c['and'](_0x9329('0x48'),_0x1a6009);}else{_0x42b47c[_0x9329('0x3e')]('c.'+_0x302a27+_0x9329('0x49'),_0x2c7588[_0x302a27]);}});}return _0x42b47c;}function parseQueryParameters(_0x222e33,_0x4b5b1c){var _0x1375d8=getSqlClauses();return Promise[_0x9329('0x4a')]()[_0x9329('0x4b')](function(){return parseModelFields(_0x222e33,_0x4b5b1c);})[_0x9329('0x4b')](function(_0x2c8092){_0x1375d8[_0x9329('0x4c')][_0x9329('0x3e')](_0x2c8092);return parseTagParameter(_0x222e33['tag']);})[_0x9329('0x4b')](function(_0x334063){_0x1375d8[_0x9329('0x3c')][_0x9329('0x3d')][_0x9329('0x3e')](_0x334063);return parseSearchFilter(_0x222e33['filter']);})[_0x9329('0x4b')](function(_0x2df7b1){_0x1375d8[_0x9329('0x4d')]=_0x2df7b1;return _0x1375d8;});}function checkListsRestrictions(_0x3e61f6,_0x44303c,_0x32d843){var _0xbfcd0=squel[_0x9329('0x20')]();return Promise['resolve']()['then'](function(){if(_0x44303c[_0x9329('0x7')]&&_0x3e61f6['role']===_0x9329('0x6')&&!_0x32d843){return _0x3e61f6[_0x9329('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x9329('0x4b')](function(_0x21ef40){if(_0x21ef40){if(_0x21ef40[_0x9329('0x26')]===0x0){_0xbfcd0[_0x9329('0x3e')](_0x9329('0x4f'));}else{_0xbfcd0[_0x9329('0x3e')](_0x9329('0x50'),_[_0x9329('0x3b')](_0x21ef40,'id'));}}})[_0x9329('0x4b')](function(){return _0xbfcd0;});}function buildContactsQuery(_0xe53d6d,_0x549ae6,_0x545ec9,_0x8e26ce,_0x494060,_0x3655fb){if(_0x549ae6){_0x549ae6=_0x545ec9[_0x9329('0x51')];}_0xe53d6d=addFieldsToQuery(_0xe53d6d,_0x549ae6,_0x8e26ce,_0x3655fb,!![]);var _0x4eb931=squel[_0x9329('0xb')]();_0x4eb931=addFieldsToQuery(_0x4eb931,_0x549ae6,_0x8e26ce,_0x3655fb,![]);if(_0x8e26ce||_0x3655fb){_0xe53d6d=applyJoinClauses(_0xe53d6d,!![]);_0xe53d6d[_0x9329('0x52')](_0x9329('0x53'));if(_0x545ec9['limit']){_0x4eb931[_0x9329('0x54')](_0x545ec9[_0x9329('0x54')]);}if(_0x545ec9[_0x9329('0x55')]){_0x4eb931['offset'](_0x545ec9[_0x9329('0x55')]);}}else{_0x4eb931=applyJoinClauses(_0x4eb931,![]);_0x4eb931[_0x9329('0x52')](_0x9329('0x56'));if(_0x545ec9['limit']){_0xe53d6d[_0x9329('0x54')](_0x545ec9[_0x9329('0x54')]);}if(_0x545ec9[_0x9329('0x55')]){_0xe53d6d[_0x9329('0x55')](_0x545ec9[_0x9329('0x55')]);}}_0x4eb931['having'](_0x494060);if(_0x545ec9[_0x9329('0x57')]){_0x545ec9[_0x9329('0x57')][_0x9329('0x22')](function(_0x105736){_0xe53d6d[_0x9329('0x57')]('c.'+_0x105736[0x0],_0x105736[0x1]===_0x9329('0x58')?![]:!![]);_0x4eb931[_0x9329('0x57')](_0x9329('0x59')+_0x105736[0x0],_0x105736[0x1]===_0x9329('0x58')?![]:!![]);});}_0x4eb931['from'](_0xe53d6d,_0x9329('0xf'));return _0x4eb931;}function getFilteredContacts(_0x19e072){var _0x3d0246=[];return db[_0x9329('0x3a')][_0x9329('0x5a')]({'attributes':['id',_0x9329('0x33'),_0x9329('0x5b')],'raw':!![]})['then'](function(_0x136582){_0x3d0246=_[_0x9329('0x5c')](_0x136582,'id');var _0x55a884={'type':db[_0x9329('0x5d')][_0x9329('0x5e')][_0x9329('0x5f')],'model':db[_0x9329('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9329('0x61')][_0x9329('0x62')](_0x19e072[_0x9329('0x63')](),_0x55a884);})[_0x9329('0x4b')](function(_0x113c99){_0x113c99[_0x9329('0x22')](function(_0x3551b5){if(_0x3551b5[_0x9329('0x1d')]){_0x3551b5[_0x9329('0x64')]=[];_0x3551b5['TagIds']['split'](',')[_0x9329('0x22')](function(_0x23ff72){_0x3551b5[_0x9329('0x64')][_0x9329('0x65')](_0x3d0246[_0x23ff72]);});}delete _0x3551b5[_0x9329('0x1d')];});return _0x113c99;});}function countFilteredContacts(_0x57c631,_0x3c385c){var _0x3ebf93=_0x57c631[_0x9329('0x66')]();_0x3ebf93['field'](_0x9329('0x67'));_0x3ebf93=applyJoinClauses(_0x3ebf93,!![]);_0x57c631[_0x9329('0x52')]('c.id');var _0x51e32b=utils[_0x9329('0x21')](_0x3c385c);if(!_[_0x9329('0x68')](_0x51e32b)){_0x3ebf93[_0x9329('0x69')](_0x9329('0x6a'),_0x51e32b);}var _0x3bbf71={'type':db[_0x9329('0x5d')][_0x9329('0x5e')][_0x9329('0x5f')],'raw':!![]};return db['sequelize'][_0x9329('0x62')](_0x3ebf93[_0x9329('0x63')](),_0x3bbf71)[_0x9329('0x4b')](function(_0x7a888d){return _0x7a888d[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x9c00=['deletedAt','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','forEach','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','value','start','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some','compact','push','Contact','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','map','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','isEmpty','query','lodash','squel','../interaction/utils','../../mysqldb','role','agent','search','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','CompanyId','createdAt','updatedAt'];(function(_0x43cc69,_0x401eea){var _0xde43ae=function(_0x43608f){while(--_0x43608f){_0x43cc69['push'](_0x43cc69['shift']());}};_0xde43ae(++_0x401eea);}(_0x9c00,0x1a0));var _0x09c0=function(_0x538a20,_0x5c14d6){_0x538a20=_0x538a20-0x0;var _0xec72f5=_0x9c00[_0x538a20];return _0xec72f5;};'use strict';var _=require(_0x09c0('0x0'));var squel=require(_0x09c0('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x09c0('0x2'));var db=require(_0x09c0('0x3'))['db'];function skipContactsQuery(_0x5d1967,_0x220c0c){var _0x2c702c=![];if(_0x5d1967[_0x09c0('0x4')]===_0x09c0('0x5')&&!_0x220c0c[_0x09c0('0x6')]&&!_0x220c0c['ListId']&&_0x220c0c['autocomplete']!==_0x09c0('0x7')){_0x2c702c=!![];}return _0x2c702c;}function getContactsSubquery(){return squel[_0x09c0('0x8')]()[_0x09c0('0x9')](_0x09c0('0xa'),'c')[_0x09c0('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x6558ca,_0x1c1246){var _0xa20b5c=_0x1c1246?'c':_0x09c0('0xc');_0x6558ca[_0x09c0('0xd')](_0x09c0('0xe'),'uc',_0x09c0('0xf')+_0xa20b5c+_0x09c0('0x10'))[_0x09c0('0xd')](_0x09c0('0x11'),'ct',_0x09c0('0x12')+_0xa20b5c+_0x09c0('0x10'))[_0x09c0('0xd')](_0x09c0('0x13'),'t',_0x09c0('0x14'));return _0x6558ca;}function addFieldsToQuery(_0x331905,_0x6149a8,_0x2a86da,_0x342ceb,_0x3649d2){var _0x16e490=_0x3649d2?'c':_0x09c0('0xc');if(!_0x6149a8){_0x6149a8=['id',_0x09c0('0x15'),_0x09c0('0x16'),_0x09c0('0x17'),_0x09c0('0x18'),'fax','email','ListId',_0x09c0('0x19'),_0x09c0('0x1a'),_0x09c0('0x1b'),_0x09c0('0x1c'),'TagIds'];}var _0x2c4440=_0x2a86da&&_0x3649d2||!_0x2a86da&&!_0x3649d2;if(_0x342ceb){_0x2c4440=_0x342ceb&&_0x3649d2||!_0x342ceb&&!_0x3649d2;}_0x6149a8['forEach'](function(_0x4c29a7){if(_0x4c29a7===_0x09c0('0x1d')){if(_0x2c4440){_0x331905['field'](_0x09c0('0x1e'),_0x4c29a7);}else if(_0x2a86da||_0x342ceb){_0x331905[_0x09c0('0x1f')](_0x16e490+'.'+_0x4c29a7);}}else{_0x331905[_0x09c0('0x1f')](_0x16e490+'.'+_0x4c29a7);}});return _0x331905;}function getSqlClauses(){var _0x49064c={'default':squel[_0x09c0('0x20')](),'fields':squel[_0x09c0('0x20')](),'filter':squel[_0x09c0('0x20')](),'tags':{'clause':squel[_0x09c0('0x20')](),'ids':null},'user':{'clause':squel[_0x09c0('0x20')](),'skip':![]}};return _0x49064c;}function parseTagParameter(_0xa5d16f){var _0x8c6b9a=squel['expr']();if(_0xa5d16f){var _0x1695e8=utils[_0x09c0('0x21')](_0xa5d16f);_0x1695e8[_0x09c0('0x22')](function(_0x1d18e9){_0x8c6b9a['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1d18e9+',%');});}return _0x8c6b9a;}function parseSearchFilter(_0x4f6824){var _0x321bcc=squel[_0x09c0('0x20')]();if(_0x4f6824){var _0x1e8a1c=_0x4f6824[_0x09c0('0x23')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1e8a1c[_0x09c0('0x24')]('\x20')[_0x09c0('0x25')]>0x1){_0x321bcc['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x09c0('0x26')](_0x1e8a1c),null);}else{if(qs[_0x09c0('0x27')](_0x1e8a1c)){_0x321bcc['or'](_0x09c0('0x28'),_0x1e8a1c+'%');_0x321bcc['or'](_0x09c0('0x29'),_0x1e8a1c+'%');_0x321bcc['or'](_0x09c0('0x2a'),_0x1e8a1c+'%');_0x321bcc['or'](_0x09c0('0x2b'),_0x1e8a1c+'%');}else if(qs[_0x09c0('0x2c')](_0x1e8a1c)){_0x321bcc['or'](_0x09c0('0x2d'),_0x1e8a1c+'%');}else{_0x321bcc['or'](_0x09c0('0x2e'),'%'+_0x1e8a1c+'%');_0x321bcc['or'](_0x09c0('0x2f'),'%'+_0x1e8a1c+'%');_0x321bcc['or'](_0x09c0('0x2d'),'%'+_0x1e8a1c+'%');}}}return _0x321bcc;}function parseAdvancedSearchFilter(_0x5e53ac,_0x15a667){var _0x1bdde9=getSqlClauses();var _0x53a7b8=as[_0x09c0('0x30')](_0x5e53ac);var _0x5aa0b9=_0x53a7b8[_0x09c0('0x31')];for(var _0x4d6bdc=0x0;_0x4d6bdc<_0x53a7b8[_0x09c0('0x32')][_0x09c0('0x25')];_0x4d6bdc++){var _0x108409=_0x53a7b8[_0x09c0('0x32')][_0x4d6bdc];var _0x4e999a='c';var _0x5478b7=_[_0x09c0('0x33')](_0x15a667,[_0x09c0('0x34'),_0x108409[_0x09c0('0x1f')]]);if(_0x5478b7){if(_0x108409['field']===_0x09c0('0x35')||_0x5478b7['fieldType']===_0x09c0('0x36')){_0x108409[_0x09c0('0x37')]=_0x09c0('0x38');}var _0x500cf8=as[_0x09c0('0x39')](_0x4e999a,_0x5478b7[_0x09c0('0x3a')],_0x108409);_0x1bdde9[_0x09c0('0x3b')][_0x5aa0b9](_0x500cf8[_0x09c0('0x3c')],_0x500cf8[_0x09c0('0x3d')][_0x09c0('0x3e')],_0x500cf8[_0x09c0('0x3d')]['end']);}else{if(_0x108409[_0x09c0('0x1f')]===_0x09c0('0x3f')){var _0x2f136c=_0x108409[_0x09c0('0x3d')][_0x09c0('0x24')](',')['map'](function(_0x920e2c){return Number(_0x920e2c);});var _0x20349e=parseTagParameter(_0x2f136c);_0x1bdde9[_0x09c0('0x40')][_0x09c0('0x41')][_0x09c0('0x42')](_0x20349e);_0x1bdde9['tags'][_0x09c0('0x43')]=_0x2f136c;}else if(_0x108409[_0x09c0('0x1f')]===_0x09c0('0x44')){_0x1bdde9[_0x09c0('0x45')][_0x09c0('0x41')][_0x09c0('0x42')](_0x09c0('0x46'),_0x108409['value']);_0x1bdde9[_0x09c0('0x45')][_0x09c0('0x47')]=!![];}}}return _0x1bdde9;}function parseModelFields(_0x3ab3d9,_0x1104b9){var _0x453c23=squel['expr']();var _0x5420fd=_(_0x3ab3d9)['keys']()['map'](function(_0xd7a1eb){return _[_0x09c0('0x48')](_0x1104b9,[_0x09c0('0x34'),_0xd7a1eb])?_0xd7a1eb:undefined;})[_0x09c0('0x49')]()[_0x09c0('0x3d')]();if(_0x3ab3d9['Contact']){_0x5420fd[_0x09c0('0x4a')](_0x09c0('0x4b'));}if(_0x5420fd['length']>0x0){_0x5420fd[_0x09c0('0x22')](function(_0x5d50b9){if(_0x5d50b9===_0x09c0('0x4c')){_0x453c23['and'](_0x09c0('0x4d'),[][_0x09c0('0x4e')](_0x3ab3d9[_0x5d50b9]));}else if(_0x5d50b9==='Contact'){var _0x26a21c='%'+_0x3ab3d9[_0x5d50b9]+'%';_0x453c23[_0x09c0('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x26a21c);}else{_0x453c23[_0x09c0('0x42')]('c.'+_0x5d50b9+_0x09c0('0x4f'),_0x3ab3d9[_0x5d50b9]);}});}return _0x453c23;}function parseQueryParameters(_0xb8a592,_0x27e4fb){var _0xeb8191=getSqlClauses();return Promise[_0x09c0('0x50')]()['then'](function(){return parseModelFields(_0xb8a592,_0x27e4fb);})[_0x09c0('0x51')](function(_0x3e0686){_0xeb8191[_0x09c0('0x52')]['and'](_0x3e0686);return parseTagParameter(_0xb8a592[_0x09c0('0x53')]);})[_0x09c0('0x51')](function(_0x447224){_0xeb8191['tags'][_0x09c0('0x41')][_0x09c0('0x42')](_0x447224);return parseSearchFilter(_0xb8a592['filter']);})['then'](function(_0x397e73){_0xeb8191[_0x09c0('0x54')]=_0x397e73;return _0xeb8191;});}function checkListsRestrictions(_0x576f10,_0xf67830,_0x35dca5){var _0x5b5a27=squel[_0x09c0('0x20')]();return Promise[_0x09c0('0x50')]()[_0x09c0('0x51')](function(){if(_0xf67830[_0x09c0('0x6')]&&_0x576f10[_0x09c0('0x4')]==='agent'&&!_0x35dca5){return _0x576f10[_0x09c0('0x55')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x594b13){if(_0x594b13){if(_0x594b13[_0x09c0('0x25')]===0x0){_0x5b5a27[_0x09c0('0x42')](_0x09c0('0x56'));}else{_0x5b5a27[_0x09c0('0x42')](_0x09c0('0x4d'),_[_0x09c0('0x57')](_0x594b13,'id'));}}})['then'](function(){return _0x5b5a27;});}function buildContactsQuery(_0x5e239a,_0x502eff,_0xf54a1f,_0x332e84,_0x2bd700,_0x56ec01){if(_0x502eff){_0x502eff=_0xf54a1f[_0x09c0('0x58')];}_0x5e239a=addFieldsToQuery(_0x5e239a,_0x502eff,_0x332e84,_0x56ec01,!![]);var _0xff9650=squel[_0x09c0('0x8')]();_0xff9650=addFieldsToQuery(_0xff9650,_0x502eff,_0x332e84,_0x56ec01,![]);if(_0x332e84||_0x56ec01){_0x5e239a=applyJoinClauses(_0x5e239a,!![]);_0x5e239a[_0x09c0('0x59')](_0x09c0('0x5a'));if(_0xf54a1f[_0x09c0('0x5b')]){_0xff9650[_0x09c0('0x5b')](_0xf54a1f[_0x09c0('0x5b')]);}if(_0xf54a1f[_0x09c0('0x5c')]){_0xff9650[_0x09c0('0x5c')](_0xf54a1f[_0x09c0('0x5c')]);}}else{_0xff9650=applyJoinClauses(_0xff9650,![]);_0xff9650[_0x09c0('0x59')](_0x09c0('0x5d'));if(_0xf54a1f[_0x09c0('0x5b')]){_0x5e239a[_0x09c0('0x5b')](_0xf54a1f[_0x09c0('0x5b')]);}if(_0xf54a1f[_0x09c0('0x5c')]){_0x5e239a[_0x09c0('0x5c')](_0xf54a1f[_0x09c0('0x5c')]);}}_0xff9650[_0x09c0('0x5e')](_0x2bd700);if(_0xf54a1f['order']){_0xf54a1f[_0x09c0('0x5f')][_0x09c0('0x22')](function(_0x15b0a2){_0x5e239a[_0x09c0('0x5f')]('c.'+_0x15b0a2[0x0],_0x15b0a2[0x1]===_0x09c0('0x60')?![]:!![]);_0xff9650['order'](_0x09c0('0x61')+_0x15b0a2[0x0],_0x15b0a2[0x1]===_0x09c0('0x60')?![]:!![]);});}_0xff9650[_0x09c0('0x9')](_0x5e239a,'subqry');return _0xff9650;}function getFilteredContacts(_0xe0b82a){var _0x18c728=[];return db[_0x09c0('0x3f')][_0x09c0('0x62')]({'attributes':['id',_0x09c0('0x34'),_0x09c0('0x63')],'raw':!![]})[_0x09c0('0x51')](function(_0x499905){_0x18c728=_[_0x09c0('0x64')](_0x499905,'id');var _0x42a16c={'type':db[_0x09c0('0x65')][_0x09c0('0x66')][_0x09c0('0x67')],'model':db[_0x09c0('0x68')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x09c0('0x69')]['query'](_0xe0b82a['toString'](),_0x42a16c);})[_0x09c0('0x51')](function(_0x44cbbb){_0x44cbbb[_0x09c0('0x22')](function(_0x528366){if(_0x528366[_0x09c0('0x1d')]){_0x528366['Tags']=[];_0x528366[_0x09c0('0x1d')][_0x09c0('0x24')](',')[_0x09c0('0x22')](function(_0x290618){_0x528366[_0x09c0('0x6a')][_0x09c0('0x4a')](_0x18c728[_0x290618]);});}delete _0x528366[_0x09c0('0x1d')];});return _0x44cbbb;});}function countFilteredContacts(_0x5bb34f,_0xa201bf){var _0x2d6201=_0x5bb34f[_0x09c0('0x6b')]();_0x2d6201[_0x09c0('0x1f')](_0x09c0('0x6c'));_0x2d6201=applyJoinClauses(_0x2d6201,!![]);_0x5bb34f[_0x09c0('0x59')](_0x09c0('0x5a'));var _0x1ecf16=utils[_0x09c0('0x21')](_0xa201bf);if(!_[_0x09c0('0x6d')](_0x1ecf16)){_0x2d6201[_0x09c0('0xb')]('t.id\x20IN\x20?',_0x1ecf16);}var _0x34cc0a={'type':db[_0x09c0('0x65')][_0x09c0('0x66')][_0x09c0('0x67')],'raw':!![]};return db['sequelize'][_0x09c0('0x6e')](_0x2d6201['toString'](),_0x34cc0a)[_0x09c0('0x51')](function(_0x9a4f4){return _0x9a4f4[0x0][_0x09c0('0x6c')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b3ae78b..f05dc5e 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 _0x967a=['base64','crypto','bluebird','lodash','app','secrets','session','aes-256-ctr','encrypt','algorithm','test','getCiphers','filter','encryptFile','createWriteStream','data','update','binary','write','final','end','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','secret','createCipher','utf8'];(function(_0x8ab57e,_0x240682){var _0x52ad27=function(_0x457331){while(--_0x457331){_0x8ab57e['push'](_0x8ab57e['shift']());}};_0x52ad27(++_0x240682);}(_0x967a,0x1c3));var _0xa967=function(_0x5c7c7d,_0x1e6921){_0x5c7c7d=_0x5c7c7d-0x0;var _0x17d0a8=_0x967a[_0x5c7c7d];return _0x17d0a8;};'use strict';var crypto=require(_0xa967('0x0'));var fs=require('fs');var BPromise=require(_0xa967('0x1'));var _=require(_0xa967('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa967('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa967('0x4')][_0xa967('0x5')],'algorithm':_0xa967('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xa967('0x7')]&&config[_0xa967('0x7')][_0xa967('0x8')]){var isSupported=isAlgorithmSupported(config[_0xa967('0x7')][_0xa967('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xa967('0x7')][_0xa967('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xa967('0x7')][_0xa967('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x29ede7){return AES_SUPPORTED_RX[_0xa967('0x9')](_0x29ede7);}function getSupportedCiphers(){return crypto[_0xa967('0xa')]()[_0xa967('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x1d9812){return getSupportedCiphers()['indexOf'](_0x1d9812)>-0x1;}function combineOptions(_0x9ab1be){var _0x5a1b35={};for(var _0x453d7f in fileOptions){if(fileOptions['hasOwnProperty'](_0x453d7f)){_0x5a1b35[_0x453d7f]=fileOptions[_0x453d7f];}}if(_0x9ab1be){for(var _0x355c3f in _0x9ab1be){if(_0x9ab1be['hasOwnProperty'](_0x355c3f)){_0x5a1b35[_0x355c3f]=_0x9ab1be[_0x355c3f];}}}return _0x5a1b35;}exports[_0xa967('0xc')]=function(_0x3ef649,_0x32e93d,_0x23f7cc,_0x139b97){return new BPromise(function(_0xc14843,_0x2b5618){_0x139b97=combineOptions(_0x139b97);var _0x5fb406=new Buffer(_0x23f7cc);var _0x17ec96=fs['createReadStream'](_0x3ef649);var _0x274a7c=fs[_0xa967('0xd')](_0x32e93d);var _0x527423=crypto['createCipher'](_0x139b97['algorithm'],_0x5fb406);_0x17ec96['on'](_0xa967('0xe'),function(_0x2e1a62){var _0x1abb87=new Buffer(_0x527423[_0xa967('0xf')](_0x2e1a62),_0xa967('0x10'));_0x274a7c[_0xa967('0x11')](_0x1abb87);});_0x17ec96['on']('end',function(){try{var _0x97adef=new Buffer(_0x527423[_0xa967('0x12')](_0xa967('0x10')),'binary');_0x274a7c[_0xa967('0x11')](_0x97adef);_0x274a7c[_0xa967('0x13')]();_0x274a7c['on'](_0xa967('0x14'),function(){return _0xc14843(_0x32e93d);});}catch(_0x5d4091){fs[_0xa967('0x15')](_0x32e93d);return _0x2b5618(_0x5d4091);}});});};exports[_0xa967('0x16')]=function(_0x4e96ec,_0x10da7a,_0x412211,_0x438f5a){return new BPromise(function(_0xe87332,_0x557402){_0x438f5a=combineOptions(_0x438f5a);var _0x10830c=new Buffer(_0x412211);var _0x21cbb5=fs[_0xa967('0x17')](_0x4e96ec);var _0x4281ed=fs[_0xa967('0xd')](_0x10da7a);var _0x1fbff4=crypto[_0xa967('0x18')](_0x438f5a[_0xa967('0x8')],_0x10830c);_0x21cbb5['on'](_0xa967('0xe'),function(_0x5de38e){var _0x43f1ec=new Buffer(_0x1fbff4[_0xa967('0xf')](_0x5de38e),_0xa967('0x10'));_0x4281ed['write'](_0x43f1ec);});_0x21cbb5['on'](_0xa967('0x13'),function(){try{var _0x4488f9=new Buffer(_0x1fbff4[_0xa967('0x12')]('binary'),'binary');_0x4281ed[_0xa967('0x11')](_0x4488f9);_0x4281ed['end']();_0x4281ed['on'](_0xa967('0x14'),function(){return _0xe87332(_0x10da7a);});}catch(_0x2d2680){fs['unlink'](_0x10da7a);return _0x557402(_0x2d2680);}});});};exports[_0xa967('0x19')]=function(_0x3558ad,_0x13e679,_0x314616){var _0x6b73d5=_0x314616||stringOptions[_0xa967('0x8')];var _0x4dcb1f=_0x13e679||stringOptions[_0xa967('0x1a')];var _0x382051=crypto[_0xa967('0x1b')](_0x6b73d5,_0x4dcb1f);var _0x46fa30=_0x382051[_0xa967('0xf')](_0x3558ad,_0xa967('0x1c'),_0xa967('0x1d'));_0x46fa30+=_0x382051['final'](_0xa967('0x1d'));return _0x46fa30;};exports['decryptString']=function(_0x5f3a92,_0x3ca65c,_0x2fcf10){var _0x17c2fa=_0x2fcf10||stringOptions['algorithm'];var _0x1407da=_0x3ca65c||stringOptions['secret'];var _0x1a7119=crypto['createDecipher'](_0x17c2fa,_0x1407da);var _0x3d4732=_0x1a7119[_0xa967('0xf')](_0x5f3a92,'base64',_0xa967('0x1c'));_0x3d4732+=_0x1a7119['final'](_0xa967('0x1c'));return _0x3d4732;}; \ No newline at end of file +var _0xfb93=['update','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','lodash','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','end','final','binary','write','close','decryptFile'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xfb93,0x151));var _0x3fb9=function(_0x54252e,_0x241107){_0x54252e=_0x54252e-0x0;var _0x964238=_0xfb93[_0x54252e];return _0x964238;};'use strict';var crypto=require(_0x3fb9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x3fb9('0x1'));var config=require('../../config/environment');var logger=require(_0x3fb9('0x2'))(_0x3fb9('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3fb9('0x4')][_0x3fb9('0x5')],'algorithm':_0x3fb9('0x6')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x3fb9('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x3fb9('0x7')][_0x3fb9('0x8')]);if(isSupported){fileOptions[_0x3fb9('0x8')]=config[_0x3fb9('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x3fb9('0x9')](config[_0x3fb9('0x7')]['algorithm'],_0x3fb9('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2b7d15){return AES_SUPPORTED_RX[_0x3fb9('0xb')](_0x2b7d15);}function getSupportedCiphers(){return crypto[_0x3fb9('0xc')]()[_0x3fb9('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x41dbce){return getSupportedCiphers()['indexOf'](_0x41dbce)>-0x1;}function combineOptions(_0x5e601f){var _0x3116e4={};for(var _0x3dca9f in fileOptions){if(fileOptions[_0x3fb9('0xe')](_0x3dca9f)){_0x3116e4[_0x3dca9f]=fileOptions[_0x3dca9f];}}if(_0x5e601f){for(var _0x3f6bd9 in _0x5e601f){if(_0x5e601f[_0x3fb9('0xe')](_0x3f6bd9)){_0x3116e4[_0x3f6bd9]=_0x5e601f[_0x3f6bd9];}}}return _0x3116e4;}exports[_0x3fb9('0xf')]=function(_0x581831,_0x108bbe,_0x4fdf2b,_0x400b02){return new BPromise(function(_0xf67780,_0x538db1){_0x400b02=combineOptions(_0x400b02);var _0x5c0fd4=new Buffer(_0x4fdf2b);var _0x5f3dd0=fs[_0x3fb9('0x10')](_0x581831);var _0x3895d0=fs[_0x3fb9('0x11')](_0x108bbe);var _0xa1639d=crypto[_0x3fb9('0x12')](_0x400b02[_0x3fb9('0x8')],_0x5c0fd4);_0x5f3dd0['on'](_0x3fb9('0x13'),function(_0x2c634b){var _0xb73464=new Buffer(_0xa1639d['update'](_0x2c634b),'binary');_0x3895d0['write'](_0xb73464);});_0x5f3dd0['on'](_0x3fb9('0x14'),function(){try{var _0x4d2b96=new Buffer(_0xa1639d[_0x3fb9('0x15')](_0x3fb9('0x16')),_0x3fb9('0x16'));_0x3895d0[_0x3fb9('0x17')](_0x4d2b96);_0x3895d0[_0x3fb9('0x14')]();_0x3895d0['on'](_0x3fb9('0x18'),function(){return _0xf67780(_0x108bbe);});}catch(_0x50a40f){fs['unlink'](_0x108bbe);return _0x538db1(_0x50a40f);}});});};exports[_0x3fb9('0x19')]=function(_0x5a8b0e,_0x46151b,_0x1a2602,_0x1af7a5){return new BPromise(function(_0x2c4a0d,_0x1fcdad){_0x1af7a5=combineOptions(_0x1af7a5);var _0x129010=new Buffer(_0x1a2602);var _0x2efcdf=fs[_0x3fb9('0x10')](_0x5a8b0e);var _0xaa5aef=fs[_0x3fb9('0x11')](_0x46151b);var _0x193651=crypto['createDecipher'](_0x1af7a5[_0x3fb9('0x8')],_0x129010);_0x2efcdf['on']('data',function(_0x3cdd54){var _0x3efe9b=new Buffer(_0x193651[_0x3fb9('0x1a')](_0x3cdd54),'binary');_0xaa5aef[_0x3fb9('0x17')](_0x3efe9b);});_0x2efcdf['on']('end',function(){try{var _0x22732a=new Buffer(_0x193651[_0x3fb9('0x15')](_0x3fb9('0x16')),'binary');_0xaa5aef[_0x3fb9('0x17')](_0x22732a);_0xaa5aef[_0x3fb9('0x14')]();_0xaa5aef['on'](_0x3fb9('0x18'),function(){return _0x2c4a0d(_0x46151b);});}catch(_0x11319d){fs['unlink'](_0x46151b);return _0x1fcdad(_0x11319d);}});});};exports[_0x3fb9('0x1b')]=function(_0x152f3a,_0x4ad75e,_0x572cda){var _0x12a643=_0x572cda||stringOptions[_0x3fb9('0x8')];var _0x46e4c7=_0x4ad75e||stringOptions[_0x3fb9('0x1c')];var _0x2acbda=crypto[_0x3fb9('0x12')](_0x12a643,_0x46e4c7);var _0x1cd304=_0x2acbda[_0x3fb9('0x1a')](_0x152f3a,_0x3fb9('0x1d'),'base64');_0x1cd304+=_0x2acbda[_0x3fb9('0x15')](_0x3fb9('0x1e'));return _0x1cd304;};exports[_0x3fb9('0x1f')]=function(_0x39f9d3,_0x2c5e05,_0x5f5819){var _0xc4ba58=_0x5f5819||stringOptions[_0x3fb9('0x8')];var _0x57942f=_0x2c5e05||stringOptions['secret'];var _0x523860=crypto[_0x3fb9('0x20')](_0xc4ba58,_0x57942f);var _0x125fb0=_0x523860[_0x3fb9('0x1a')](_0x39f9d3,_0x3fb9('0x1e'),_0x3fb9('0x1d'));_0x125fb0+=_0x523860[_0x3fb9('0x15')](_0x3fb9('0x1d'));return _0x125fb0;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4daa30e..49a24cf 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 _0xabdd=['range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','each','join','%s%d.%s','csv','writeFileSync','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','QueryTypes','SELECT','num','Empty','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabdd,0x1bf));var _0xdabd=function(_0x5d2237,_0x5eecf5){_0x5d2237=_0x5d2237-0x0;var _0x13c396=_0xabdd[_0x5d2237];return _0x13c396;};'use strict';var util=require(_0xdabd('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xdabd('0x1'));var fs=require('fs');var BPromise=require(_0xdabd('0x2'));var zipdir=require(_0xdabd('0x3'));var rimraf=require(_0xdabd('0x4'));var db=require(_0xdabd('0x5'))['db'];var dbH=require(_0xdabd('0x5'))['dbH'];var logger=require('../../config/logger')(_0xdabd('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xdabd('0x7')][0x2]);var QUERY=process[_0xdabd('0x7')][0x3];var PATH=process[_0xdabd('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf4e82f,_0x2bc2b3){var _0x56eece={'status':_0xf4e82f};var _0xc7f61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2bc2b3){_0x56eece[_0xdabd('0x8')]=_0x2bc2b3;}return db['AnalyticExtractedReport']['update'](_0x56eece,_0xc7f61);}function main(){var _0x21af98=0x1388;var _0x21503e;logger['info'](util[_0xdabd('0x9')](_0xdabd('0xa'),EXTRACTED_REPORT_ID,_0xdabd('0xb')));return db[_0xdabd('0xc')][_0xdabd('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdabd('0xe'),'splitSizeCsv']})[_0xdabd('0xf')](function(_0x1c3c6c){if(_0x1c3c6c){_0x21503e=_0x1c3c6c;_0x21af98=_0x21503e[_0xdabd('0x10')]||0x1388;}})[_0xdabd('0xf')](function(){return dbH[_0xdabd('0x11')]['query'](util[_0xdabd('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdabd('0x11')][_0xdabd('0x12')][_0xdabd('0x13')]});})['then'](function(_0x37c90f){if(!_0x37c90f[0x0][_0xdabd('0x14')]){return analyticExtractedReport(_0xdabd('0x15'));}var _0x5c0c79=[];var _0x524e71=0x0;if(_0x21503e[_0xdabd('0xe')]){if(_0x37c90f&&_0x37c90f[_0xdabd('0x16')]){var _0x3260f9=_[_0xdabd('0x17')](_0x37c90f[0x0][_0xdabd('0x14')]/_0x21af98);var _0x1ac4f4=Number[_0xdabd('0x18')](_0x37c90f[0x0][_0xdabd('0x14')]/_0x21af98)?_0x37c90f[0x0][_0xdabd('0x14')]%_0x21af98:0x0;_0x3260f9[_0xdabd('0x19')](function(_0x11b1e2){if(_0x11b1e2>0x0){_0x524e71+=_0x21af98;}_0x5c0c79[_0xdabd('0x1a')](dbH[_0xdabd('0x11')][_0xdabd('0x1b')](util[_0xdabd('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21af98,_0x524e71),{'type':dbH['sequelize'][_0xdabd('0x12')][_0xdabd('0x13')]}));});if(_0x1ac4f4>0x0){_0x524e71+=_0x21af98;_0x5c0c79[_0xdabd('0x1a')](dbH[_0xdabd('0x11')]['query'](util[_0xdabd('0x9')](_0xdabd('0x1c'),QUERY,_0x1ac4f4,_0x524e71),{'type':dbH[_0xdabd('0x11')][_0xdabd('0x12')][_0xdabd('0x13')]}));}}}else{_0x5c0c79[_0xdabd('0x1a')](dbH[_0xdabd('0x11')][_0xdabd('0x1b')](QUERY,{'type':dbH[_0xdabd('0x11')][_0xdabd('0x12')][_0xdabd('0x13')]}));}var _0x50992d=path[_0xdabd('0x1d')](PATH);var _0x1ec2c1=path['basename'](PATH,_0xdabd('0x1e'));var _0x27e2ca=_0x21503e[_0xdabd('0xe')]&&_0x5c0c79['length']>0x1;var _0x5af6a4=[];if(!fs[_0xdabd('0x1f')](path['join'](_0x50992d,_0x1ec2c1))&&_0x27e2ca){fs['mkdirSync'](path['join'](_0x50992d,_0x1ec2c1));}return BPromise[_0xdabd('0x20')](_0x5c0c79,function(_0x5e1c6b){_0x5af6a4[_0xdabd('0x1a')](_0x5e1c6b);})[_0xdabd('0xf')](function(){for(var _0x13aa7f=0x0;_0x13aa7f<_0x5af6a4['length'];_0x13aa7f+=0x1){var _0x1fab24;var _0x457f4d=_0x5af6a4[_0x13aa7f];if(_0x27e2ca){_0x1fab24=path[_0xdabd('0x21')](_0x50992d,_0x1ec2c1,util[_0xdabd('0x9')](_0xdabd('0x22'),_0x1ec2c1,_0x13aa7f,_0xdabd('0x23')));}else{_0x1fab24=path[_0xdabd('0x21')](_0x50992d,util[_0xdabd('0x9')]('%s.%s',_0x1ec2c1,_0xdabd('0x23')));}fs[_0xdabd('0x24')](_0x1fab24,csv(_0x457f4d));}})[_0xdabd('0xf')](function(){if(_0x27e2ca){return new Promise(function(_0x3ff04f){zipdir(path[_0xdabd('0x21')](_0x50992d,_0x1ec2c1),{'saveTo':path[_0xdabd('0x21')](_0x50992d,util['format'](_0xdabd('0x25'),_0x1ec2c1,'zip'))},function(_0x442d54,_0x5786e8){rimraf(path[_0xdabd('0x21')](_0x50992d,_0x1ec2c1),function(){});_0x3ff04f(_0xdabd('0x26'));});});}})[_0xdabd('0xf')](function(){logger['info'](util[_0xdabd('0x9')](_0xdabd('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xdabd('0x28'),_0x27e2ca?util[_0xdabd('0x9')](_0xdabd('0x25'),_0x1ec2c1,_0x27e2ca?_0xdabd('0x29'):_0xdabd('0x23')):null);});})[_0xdabd('0x2a')](function(_0x5c4f38){logger[_0xdabd('0x2b')](util[_0xdabd('0x9')](_0xdabd('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x5c4f38,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdabd('0x2d'));})['finally'](function(){process[_0xdabd('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfe79=['range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Setting','find','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length'];(function(_0x44b3b0,_0x1480d1){var _0x314a23=function(_0x110f74){while(--_0x110f74){_0x44b3b0['push'](_0x44b3b0['shift']());}};_0x314a23(++_0x1480d1);}(_0xfe79,0x1e1));var _0x9fe7=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0xfe79[_0xee5d2a];return _0x346948;};'use strict';var util=require(_0x9fe7('0x0'));var path=require(_0x9fe7('0x1'));var _=require('lodash');var csv=require(_0x9fe7('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9fe7('0x3'));var db=require(_0x9fe7('0x4'))['db'];var dbH=require(_0x9fe7('0x4'))[_0x9fe7('0x5')];var logger=require(_0x9fe7('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9fe7('0x7')][0x2]);var QUERY=process[_0x9fe7('0x7')][0x3];var PATH=process[_0x9fe7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xfcbbf9,_0xab72d1){var _0x55e29b={'status':_0xfcbbf9};var _0xd55f17={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xab72d1){_0x55e29b['savename']=_0xab72d1;}return db[_0x9fe7('0x8')][_0x9fe7('0x9')](_0x55e29b,_0xd55f17);}function main(){var _0x371c9e=0x1388;var _0x574c9d;logger[_0x9fe7('0xa')](util[_0x9fe7('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x9fe7('0xc')][_0x9fe7('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x9fe7('0xe')](function(_0x550445){if(_0x550445){_0x574c9d=_0x550445;_0x371c9e=_0x574c9d[_0x9fe7('0xf')]||0x1388;}})[_0x9fe7('0xe')](function(){return dbH['sequelize'][_0x9fe7('0x10')](util[_0x9fe7('0xb')](_0x9fe7('0x11'),QUERY),{'type':dbH[_0x9fe7('0x12')][_0x9fe7('0x13')][_0x9fe7('0x14')]});})[_0x9fe7('0xe')](function(_0x29c34d){if(!_0x29c34d[0x0][_0x9fe7('0x15')]){return analyticExtractedReport(_0x9fe7('0x16'));}var _0x3c8ffc=[];var _0x42fa4e=0x0;if(_0x574c9d[_0x9fe7('0x17')]){if(_0x29c34d&&_0x29c34d[_0x9fe7('0x18')]){var _0x415601=_[_0x9fe7('0x19')](_0x29c34d[0x0][_0x9fe7('0x15')]/_0x371c9e);var _0x588c97=Number['isInteger'](_0x29c34d[0x0][_0x9fe7('0x15')]/_0x371c9e)?_0x29c34d[0x0]['num']%_0x371c9e:0x0;_0x415601[_0x9fe7('0x1a')](function(_0xca48ff){if(_0xca48ff>0x0){_0x42fa4e+=_0x371c9e;}_0x3c8ffc[_0x9fe7('0x1b')](dbH['sequelize'][_0x9fe7('0x10')](util[_0x9fe7('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x371c9e,_0x42fa4e),{'type':dbH[_0x9fe7('0x12')]['QueryTypes']['SELECT']}));});if(_0x588c97>0x0){_0x42fa4e+=_0x371c9e;_0x3c8ffc[_0x9fe7('0x1b')](dbH['sequelize']['query'](util[_0x9fe7('0xb')](_0x9fe7('0x1c'),QUERY,_0x588c97,_0x42fa4e),{'type':dbH['sequelize'][_0x9fe7('0x13')][_0x9fe7('0x14')]}));}}}else{_0x3c8ffc['push'](dbH['sequelize'][_0x9fe7('0x10')](QUERY,{'type':dbH['sequelize'][_0x9fe7('0x13')][_0x9fe7('0x14')]}));}var _0x44668e=path[_0x9fe7('0x1d')](PATH);var _0x537c35=path[_0x9fe7('0x1e')](PATH,_0x9fe7('0x1f'));var _0x5bd3d3=_0x574c9d[_0x9fe7('0x17')]&&_0x3c8ffc[_0x9fe7('0x18')]>0x1;var _0x264e10=[];if(!fs[_0x9fe7('0x20')](path['join'](_0x44668e,_0x537c35))&&_0x5bd3d3){fs[_0x9fe7('0x21')](path['join'](_0x44668e,_0x537c35));}return BPromise['each'](_0x3c8ffc,function(_0x2de687){_0x264e10[_0x9fe7('0x1b')](_0x2de687);})['then'](function(){for(var _0x3036e2=0x0;_0x3036e2<_0x264e10[_0x9fe7('0x18')];_0x3036e2+=0x1){var _0x7e41a6;var _0x29ef8e=_0x264e10[_0x3036e2];if(_0x5bd3d3){_0x7e41a6=path[_0x9fe7('0x22')](_0x44668e,_0x537c35,util[_0x9fe7('0xb')](_0x9fe7('0x23'),_0x537c35,_0x3036e2,'csv'));}else{_0x7e41a6=path[_0x9fe7('0x22')](_0x44668e,util['format'](_0x9fe7('0x24'),_0x537c35,'csv'));}fs['writeFileSync'](_0x7e41a6,csv(_0x29ef8e));}})[_0x9fe7('0xe')](function(){if(_0x5bd3d3){return new Promise(function(_0x5b4130){zipdir(path[_0x9fe7('0x22')](_0x44668e,_0x537c35),{'saveTo':path[_0x9fe7('0x22')](_0x44668e,util[_0x9fe7('0xb')](_0x9fe7('0x24'),_0x537c35,_0x9fe7('0x25')))},function(_0x199c9d,_0xbfeba6){rimraf(path[_0x9fe7('0x22')](_0x44668e,_0x537c35),function(){});_0x5b4130('zip\x20finished');});});}})['then'](function(){logger[_0x9fe7('0xa')](util[_0x9fe7('0xb')](_0x9fe7('0x26'),EXTRACTED_REPORT_ID,_0x9fe7('0x27')));return analyticExtractedReport(_0x9fe7('0x28'),_0x5bd3d3?util[_0x9fe7('0xb')]('%s.%s',_0x537c35,_0x5bd3d3?_0x9fe7('0x25'):'csv'):null);});})[_0x9fe7('0x29')](function(_0x2de625){logger['info'](util[_0x9fe7('0xb')](_0x9fe7('0x2a'),EXTRACTED_REPORT_ID,_0x9fe7('0x27')),util[_0x9fe7('0x2b')](_0x2de625,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9fe7('0x2c'));})['finally'](function(){process[_0x9fe7('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 042ad3b..6ec17c2 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 _0x198c=['dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format','endDate','header','before','push','landscape','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','existsSync','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','path','pdfmake/src/printer','zip-dir','jsdom','window','bluebird','../../mysqldb'];(function(_0x23d880,_0x5da5ec){var _0x442524=function(_0x42db39){while(--_0x42db39){_0x23d880['push'](_0x23d880['shift']());}};_0x442524(++_0x5da5ec);}(_0x198c,0x1ea));var _0xc198=function(_0x57b425,_0x398af9){_0x57b425=_0x57b425-0x0;var _0xd98040=_0x198c[_0x57b425];return _0xd98040;};'use strict';var _=require(_0xc198('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xc198('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xc198('0x2'));var zipdir=require(_0xc198('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0xc198('0x4'))['JSDOM'];var window=new JSDOM('')[_0xc198('0x5')];var BPromise=require(_0xc198('0x6'));var db=require(_0xc198('0x7'))['db'];var dbH=require(_0xc198('0x7'))[_0xc198('0x8')];var logger=require(_0xc198('0x9'))(_0xc198('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc198('0xb')][0x3];var PATH=process[_0xc198('0xb')][0x4];var NAME=process[_0xc198('0xb')][0x5];var FORMAT=_0xc198('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x44b504,_0x3c57af){var _0x488df0={'status':_0x44b504};var _0x5c2afa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c57af){_0x488df0['savename']=_0x3c57af;}return db[_0xc198('0xd')][_0xc198('0xe')](_0x488df0,_0x5c2afa);}function getHeaders(_0x4b1433){return _[_0xc198('0xf')](_0x4b1433,function(_0x23a698){return{'text':_0x23a698,'style':_0xc198('0x10')};});}function getRows(_0x45090f,_0x49567e){return _[_0xc198('0xf')](_0x49567e,function(_0x415bcd){return _(_0x415bcd)[_0xc198('0x11')](_0x45090f)[_0xc198('0xf')](function(_0x43861e){return _0x43861e?_[_0xc198('0x12')](_0x43861e):'';})[_0xc198('0x13')]();});}function createTable(_0x1ba72c,_0xccd081){var _0x1be8d3={'widths':_[_0xc198('0x14')](Array(_0x1ba72c[_0xc198('0x15')]),0x91),'heights':function(_0x1fdbcc){return _0x1fdbcc===0x0?_0xc198('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x331505=getHeaders(_0x1ba72c);_0x1be8d3[_0xc198('0x17')]['push'](_0x331505);var _0x16ab54=getRows(_0x1ba72c,_0xccd081);_0x1be8d3[_0xc198('0x17')]=_0x1be8d3[_0xc198('0x17')]['concat'](_0x16ab54);return _0x1be8d3;}function createTables(_0x1c7736){var _0xff9376=[];var _0x162464=_[_0xc198('0x18')](Object['keys'](_0x1c7736[0x0]),0x5);_0x162464['forEach'](function(_0x430b2b){_0xff9376['push'](createTable(_0x430b2b,_0x1c7736));});return _0xff9376;}function getPDFDocDefinition(_0x4b64b0){var _0x597745=util['format'](_0xc198('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0xc198('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xc198('0x1b')])['format'](FORMAT));var _0x5d4060=[];for(var _0x742216=0x0;_0x742216<_0x4b64b0[_0xc198('0x15')];_0x742216++){var _0x1ed8b7=[];if(_0x742216===0x0){_0x1ed8b7['push']({'text':_0x597745,'style':_0xc198('0x1c')});}var _0x1ce877={'table':_0x4b64b0[_0x742216]};if(_0x742216>0x0){_0x1ce877['pageBreak']=_0xc198('0x1d');_0x1ce877['margin']=[0x0,0x46,0x0,0x0];}_0x1ed8b7[_0xc198('0x1e')](_0x1ce877);_0x5d4060[_0xc198('0x1e')](_0x1ed8b7);}return{'pageSize':'A4','pageOrientation':_0xc198('0x1f'),'content':_0x5d4060,'footer':function(_0x4ab01f,_0x3fd5f6){return{'text':_0x4ab01f[_0xc198('0x12')]()+'\x20/\x20'+_0x3fd5f6,'style':_0xc198('0x20')};},'defaultStyle':{'font':_0xc198('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc198('0x22')},'footer':{'alignment':_0xc198('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x527f65){var _0x4bf593=0x1388;var _0x4c273b;if(!_0x527f65[0x0][_0xc198('0x24')]){return analyticExtractedReport(_0xc198('0x25'));}return db[_0xc198('0x26')][_0xc198('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc198('0x28'),_0xc198('0x29')]})[_0xc198('0x2a')](function(_0x579703){if(_0x579703){_0x4c273b=_0x579703;_0x4bf593=_0x4c273b[_0xc198('0x29')]||0x3e8;}})[_0xc198('0x2a')](function(){var _0x4ab333=[];var _0x1a0edd=0x0;if(_0x4c273b['split']){if(_0x527f65&&_0x527f65[_0xc198('0x15')]){var _0x31c25c=_['range'](_0x527f65[0x0][_0xc198('0x24')]/_0x4bf593);var _0x1b67ac=Number[_0xc198('0x2b')](_0x527f65[0x0]['num']/_0x4bf593)?_0x527f65[0x0]['num']%_0x4bf593:0x0;_0x31c25c[_0xc198('0x2c')](function(_0x417807){if(_0x417807>0x0){_0x1a0edd+=_0x4bf593;}_0x4ab333['push'](dbH['sequelize']['query'](util[_0xc198('0x1a')](_0xc198('0x2d'),QUERY,_0x4bf593,_0x1a0edd),{'type':dbH[_0xc198('0x2e')][_0xc198('0x2f')][_0xc198('0x30')]}));});if(_0x1b67ac>0x0){_0x1a0edd+=_0x4bf593;_0x4ab333[_0xc198('0x1e')](dbH[_0xc198('0x2e')][_0xc198('0x31')](util[_0xc198('0x1a')](_0xc198('0x2d'),QUERY,_0x1b67ac,_0x1a0edd),{'type':dbH[_0xc198('0x2e')][_0xc198('0x2f')][_0xc198('0x30')]}));}}}else{_0x4ab333[_0xc198('0x1e')](dbH[_0xc198('0x2e')][_0xc198('0x31')](QUERY,{'type':dbH[_0xc198('0x2e')]['QueryTypes']['SELECT']}));}var _0xb7548b=path['dirname'](PATH);var _0x1eb496=path['basename'](PATH,'.pdf');var _0x175ae7=_0x4c273b['split']&&_0x4ab333[_0xc198('0x15')]>0x1;var _0x2a876a=[];if(!fs[_0xc198('0x32')](path['join'](_0xb7548b,_0x1eb496))&&_0x175ae7){fs[_0xc198('0x33')](path[_0xc198('0x34')](_0xb7548b,_0x1eb496));}return BPromise[_0xc198('0x35')](_0x4ab333,function(_0x5b7280){_0x2a876a[_0xc198('0x1e')](_0x5b7280);})[_0xc198('0x2a')](function(){var _0x312bd1=[];for(var _0x32643b=0x0;_0x32643b<_0x2a876a[_0xc198('0x15')];_0x32643b+=0x1){var _0x51fdca=_0x2a876a[_0x32643b];var _0x81ef04=createTables(_['flatten'](_0x51fdca));var _0x3786b2;var _0x3a3e82=getPDFDocDefinition(_0x81ef04);var _0x10c946=getPDFPrinter();var _0x4b4204=_0x10c946[_0xc198('0x36')](_0x3a3e82);if(_0x175ae7){_0x3786b2=path[_0xc198('0x34')](_0xb7548b,_0x1eb496,util['format'](_0xc198('0x37'),_0x1eb496,_0x32643b,_0xc198('0x38')));}else{_0x3786b2=path[_0xc198('0x34')](_0xb7548b,util['format']('%s.%s',_0x1eb496,'pdf'));}_0x312bd1['push'](writePDFDocument(_0x4b4204,_0x3786b2));}return Promise[_0xc198('0x39')](_0x312bd1);})[_0xc198('0x2a')](function(){if(_0x175ae7){return new Promise(function(_0x423c1a){zipdir(path[_0xc198('0x34')](_0xb7548b,_0x1eb496),{'saveTo':path['join'](_0xb7548b,util['format'](_0xc198('0x3a'),_0x1eb496,'zip'))},function(){rimraf(path[_0xc198('0x34')](_0xb7548b,_0x1eb496),function(){});_0x423c1a(_0xc198('0x3b'));});});}})[_0xc198('0x2a')](function(){if(!_0x175ae7)return;rimraf(path['join'](_0xb7548b,_0x1eb496),function(){});})[_0xc198('0x2a')](function(){logger[_0xc198('0x3c')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc198('0x3d')));return analyticExtractedReport(_0xc198('0x3e'),_0x175ae7?util[_0xc198('0x1a')]('%s.%s',_0x1eb496,_0x175ae7?_0xc198('0x3f'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc198('0x3c')](util[_0xc198('0x1a')](_0xc198('0x40'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xc198('0xd')][_0xc198('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc198('0x2a')](function(_0x240dc0){EXTRACTED_REPORT=_0x240dc0;return dbH['sequelize'][_0xc198('0x31')](util[_0xc198('0x1a')](_0xc198('0x42'),QUERY),{'type':dbH['sequelize'][_0xc198('0x2f')][_0xc198('0x30')]});})[_0xc198('0x2a')](extractReport)['catch'](function(_0x4a17cc){logger[_0xc198('0x3c')](util[_0xc198('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xc198('0x43')](_0x4a17cc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc198('0x44'));})[_0xc198('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1b7bcc=new PdfPrinter({'Arial':{'normal':__dirname+_0xc198('0x46'),'bold':__dirname+_0xc198('0x47'),'italics':__dirname+_0xc198('0x48'),'bolditalics':__dirname+_0xc198('0x49')}});return _0x1b7bcc;}function getPDFDocDefinitionFromHTML(_0x516926,_0x442143){var _0x5f43de=util[_0xc198('0x1a')]('%s\x20#%d',_0x442143[_0xc198('0x4a')],_0x442143[_0xc198('0x4b')]);var _0x327775=moment()[_0xc198('0x1a')](_0xc198('0x4c'))[_0xc198('0x12')]();var _0x560ee5=htmlToPdfmake(_0x516926,{'window':window,'tableAutoSize':!![]});return{'content':[_0x560ee5],'defaultStyle':{'font':_0xc198('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc198('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc198('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xc198('0x1c')}];},'footer':function(_0x44ef87,_0x180752){return[{'text':util[_0xc198('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5f43de,_0x44ef87,_0x180752,_0x327775),'style':'footer'}];}};}function writePDFDocument(_0xf45b40,_0x2dc7b0){return new Promise(function(_0x2eceee,_0x4b67cd){var _0xfb35f6=_0xf45b40[_0xc198('0x4e')](fs[_0xc198('0x4f')](_0x2dc7b0));_0xfb35f6['on'](_0xc198('0x50'),function(){_0x2eceee(_0xc198('0x50'));});_0xfb35f6['on'](_0xc198('0x51'),function(_0x2f5698){_0x4b67cd(_0x2f5698);});_0xf45b40['end']();});}exports[_0xc198('0x52')]=function(_0x442e7b,_0x549971){var _0x2bd2a1=getPDFPrinter();var _0x5dfe47=getPDFDocDefinitionFromHTML(_0x442e7b,_0x549971);var _0x216583=_0x2bd2a1['createPdfKitDocument'](_0x5dfe47);return writePDFDocument(_0x216583,_0x549971['path'])['catch'](function(_0x3d9ccc){throw _0x3d9ccc;});}; \ No newline at end of file +var _0x0b52=['createPdfFromHTML','createPdfKitDocument','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','length','before','margin','landscape','\x20/\x20','footer','Arial','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','end'];(function(_0x30fb5d,_0x2e7336){var _0x4fbbe6=function(_0x579d70){while(--_0x579d70){_0x30fb5d['push'](_0x30fb5d['shift']());}};_0x4fbbe6(++_0x2e7336);}(_0x0b52,0xb2));var _0x20b5=function(_0x43de8b,_0xa896ae){_0x43de8b=_0x43de8b-0x0;var _0x3cc992=_0x0b52[_0x43de8b];return _0x3cc992;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x20b5('0x0'));var moment=require(_0x20b5('0x1'));var htmlToPdfmake=require(_0x20b5('0x2'));var PdfPrinter=require(_0x20b5('0x3'));var zipdir=require(_0x20b5('0x4'));var rimraf=require(_0x20b5('0x5'));var JSDOM=require('jsdom')[_0x20b5('0x6')];var window=new JSDOM('')[_0x20b5('0x7')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x20b5('0x8'))[_0x20b5('0x9')];var logger=require(_0x20b5('0xa'))(_0x20b5('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x20b5('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x20b5('0xc')][0x5];var FORMAT=_0x20b5('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x9e2fa4,_0x5db1bd){var _0x5b0c79={'status':_0x9e2fa4};var _0x7f4b6c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5db1bd){_0x5b0c79[_0x20b5('0xe')]=_0x5db1bd;}return db[_0x20b5('0xf')][_0x20b5('0x10')](_0x5b0c79,_0x7f4b6c);}function getHeaders(_0x1a314b){return _[_0x20b5('0x11')](_0x1a314b,function(_0x3016e5){return{'text':_0x3016e5,'style':_0x20b5('0x12')};});}function getRows(_0x131dff,_0x35584e){return _[_0x20b5('0x11')](_0x35584e,function(_0x382cfc){return _(_0x382cfc)[_0x20b5('0x13')](_0x131dff)[_0x20b5('0x11')](function(_0x2344d1){return _0x2344d1?_[_0x20b5('0x14')](_0x2344d1):'';})[_0x20b5('0x15')]();});}function createTable(_0x44cae3,_0x58fcca){var _0x580771={'widths':_['fill'](Array(_0x44cae3['length']),0x91),'heights':function(_0x6d181b){return _0x6d181b===0x0?_0x20b5('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x335d98=getHeaders(_0x44cae3);_0x580771[_0x20b5('0x17')][_0x20b5('0x18')](_0x335d98);var _0x3a276a=getRows(_0x44cae3,_0x58fcca);_0x580771[_0x20b5('0x17')]=_0x580771[_0x20b5('0x17')][_0x20b5('0x19')](_0x3a276a);return _0x580771;}function createTables(_0x55d873){var _0x169ff0=[];var _0x813343=_[_0x20b5('0x1a')](Object[_0x20b5('0x1b')](_0x55d873[0x0]),0x5);_0x813343[_0x20b5('0x1c')](function(_0x1c629d){_0x169ff0[_0x20b5('0x18')](createTable(_0x1c629d,_0x55d873));});return _0x169ff0;}function getPDFDocDefinition(_0x2c95c2){var _0x22bd87=util['format'](_0x20b5('0x1d'),NAME,EXTRACTED_REPORT[_0x20b5('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x20b5('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x20b5('0x20')])['format'](FORMAT));var _0x58c844=[];for(var _0x121ca3=0x0;_0x121ca3<_0x2c95c2[_0x20b5('0x21')];_0x121ca3++){var _0x3fb4e6=[];if(_0x121ca3===0x0){_0x3fb4e6[_0x20b5('0x18')]({'text':_0x22bd87,'style':'header'});}var _0xb7a84f={'table':_0x2c95c2[_0x121ca3]};if(_0x121ca3>0x0){_0xb7a84f['pageBreak']=_0x20b5('0x22');_0xb7a84f[_0x20b5('0x23')]=[0x0,0x46,0x0,0x0];}_0x3fb4e6[_0x20b5('0x18')](_0xb7a84f);_0x58c844[_0x20b5('0x18')](_0x3fb4e6);}return{'pageSize':'A4','pageOrientation':_0x20b5('0x24'),'content':_0x58c844,'footer':function(_0x25d16c,_0x50b3aa){return{'text':_0x25d16c[_0x20b5('0x14')]()+_0x20b5('0x25')+_0x50b3aa,'style':_0x20b5('0x26')};},'defaultStyle':{'font':_0x20b5('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5332b9){var _0x145b10=0x1388;var _0x512102;if(!_0x5332b9[0x0][_0x20b5('0x28')]){return analyticExtractedReport(_0x20b5('0x29'));}return db['Setting'][_0x20b5('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x20b5('0x2b'),_0x20b5('0x2c')]})[_0x20b5('0x2d')](function(_0x42b9f9){if(_0x42b9f9){_0x512102=_0x42b9f9;_0x145b10=_0x512102[_0x20b5('0x2c')]||0x3e8;}})[_0x20b5('0x2d')](function(){var _0x41a25b=[];var _0x742382=0x0;if(_0x512102[_0x20b5('0x2b')]){if(_0x5332b9&&_0x5332b9[_0x20b5('0x21')]){var _0x2ed3d0=_[_0x20b5('0x2e')](_0x5332b9[0x0][_0x20b5('0x28')]/_0x145b10);var _0x1a347a=Number[_0x20b5('0x2f')](_0x5332b9[0x0]['num']/_0x145b10)?_0x5332b9[0x0][_0x20b5('0x28')]%_0x145b10:0x0;_0x2ed3d0[_0x20b5('0x1c')](function(_0x241b2f){if(_0x241b2f>0x0){_0x742382+=_0x145b10;}_0x41a25b[_0x20b5('0x18')](dbH['sequelize'][_0x20b5('0x30')](util[_0x20b5('0x1f')](_0x20b5('0x31'),QUERY,_0x145b10,_0x742382),{'type':dbH[_0x20b5('0x32')][_0x20b5('0x33')][_0x20b5('0x34')]}));});if(_0x1a347a>0x0){_0x742382+=_0x145b10;_0x41a25b[_0x20b5('0x18')](dbH[_0x20b5('0x32')][_0x20b5('0x30')](util[_0x20b5('0x1f')](_0x20b5('0x31'),QUERY,_0x1a347a,_0x742382),{'type':dbH[_0x20b5('0x32')][_0x20b5('0x33')][_0x20b5('0x34')]}));}}}else{_0x41a25b[_0x20b5('0x18')](dbH[_0x20b5('0x32')]['query'](QUERY,{'type':dbH[_0x20b5('0x32')][_0x20b5('0x33')][_0x20b5('0x34')]}));}var _0x2de841=path['dirname'](PATH);var _0x31cbd3=path['basename'](PATH,'.pdf');var _0x568abf=_0x512102[_0x20b5('0x2b')]&&_0x41a25b['length']>0x1;var _0x4ab9e4=[];if(!fs[_0x20b5('0x35')](path[_0x20b5('0x36')](_0x2de841,_0x31cbd3))&&_0x568abf){fs['mkdirSync'](path['join'](_0x2de841,_0x31cbd3));}return BPromise[_0x20b5('0x37')](_0x41a25b,function(_0x5ba399){_0x4ab9e4[_0x20b5('0x18')](_0x5ba399);})[_0x20b5('0x2d')](function(){var _0xa94c0f=[];for(var _0x5dcd73=0x0;_0x5dcd73<_0x4ab9e4[_0x20b5('0x21')];_0x5dcd73+=0x1){var _0x1a8492=_0x4ab9e4[_0x5dcd73];var _0x6fbb5f=createTables(_[_0x20b5('0x38')](_0x1a8492));var _0x4a39fd;var _0x2b2e91=getPDFDocDefinition(_0x6fbb5f);var _0x4dd29b=getPDFPrinter();var _0x4ba609=_0x4dd29b['createPdfKitDocument'](_0x2b2e91);if(_0x568abf){_0x4a39fd=path[_0x20b5('0x36')](_0x2de841,_0x31cbd3,util[_0x20b5('0x1f')](_0x20b5('0x39'),_0x31cbd3,_0x5dcd73,_0x20b5('0x3a')));}else{_0x4a39fd=path['join'](_0x2de841,util[_0x20b5('0x1f')]('%s.%s',_0x31cbd3,_0x20b5('0x3a')));}_0xa94c0f[_0x20b5('0x18')](writePDFDocument(_0x4ba609,_0x4a39fd));}return Promise['all'](_0xa94c0f);})[_0x20b5('0x2d')](function(){if(_0x568abf){return new Promise(function(_0x4650be){zipdir(path[_0x20b5('0x36')](_0x2de841,_0x31cbd3),{'saveTo':path['join'](_0x2de841,util[_0x20b5('0x1f')](_0x20b5('0x3b'),_0x31cbd3,'zip'))},function(){rimraf(path['join'](_0x2de841,_0x31cbd3),function(){});_0x4650be(_0x20b5('0x3c'));});});}})[_0x20b5('0x2d')](function(){if(!_0x568abf)return;rimraf(path[_0x20b5('0x36')](_0x2de841,_0x31cbd3),function(){});})[_0x20b5('0x2d')](function(){logger[_0x20b5('0x3d')](util[_0x20b5('0x1f')](_0x20b5('0x3e'),EXTRACTED_REPORT_ID,_0x20b5('0x3f')));return analyticExtractedReport(_0x20b5('0x40'),_0x568abf?util[_0x20b5('0x1f')](_0x20b5('0x3b'),_0x31cbd3,_0x568abf?_0x20b5('0x41'):_0x20b5('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x20b5('0x3d')](util[_0x20b5('0x1f')](_0x20b5('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x20b5('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x20b5('0x2d')](function(_0x3981be){EXTRACTED_REPORT=_0x3981be;return dbH[_0x20b5('0x32')][_0x20b5('0x30')](util[_0x20b5('0x1f')](_0x20b5('0x43'),QUERY),{'type':dbH[_0x20b5('0x32')]['QueryTypes']['SELECT']});})[_0x20b5('0x2d')](extractReport)[_0x20b5('0x44')](function(_0x14a892){logger[_0x20b5('0x3d')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x20b5('0x3f')),util[_0x20b5('0x45')](_0x14a892,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x20b5('0x46'));})['finally'](function(){process[_0x20b5('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x54dedb=new PdfPrinter({'Arial':{'normal':__dirname+_0x20b5('0x48'),'bold':__dirname+_0x20b5('0x49'),'italics':__dirname+_0x20b5('0x4a'),'bolditalics':__dirname+_0x20b5('0x4b')}});return _0x54dedb;}function getPDFDocDefinitionFromHTML(_0x280bcb,_0x57e438){var _0x5d5276=util['format'](_0x20b5('0x4c'),_0x57e438[_0x20b5('0x4d')],_0x57e438['interactionId']);var _0x26ec6d=moment()[_0x20b5('0x1f')](_0x20b5('0x4e'))[_0x20b5('0x14')]();var _0x674acd=htmlToPdfmake(_0x280bcb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x674acd],'defaultStyle':{'font':_0x20b5('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x20b5('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x20b5('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x20b5('0x4f')}},'header':function(){return[{'text':_0x20b5('0x50'),'style':_0x20b5('0x51')}];},'footer':function(_0xd745a8,_0x533673){return[{'text':util[_0x20b5('0x1f')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5d5276,_0xd745a8,_0x533673,_0x26ec6d),'style':_0x20b5('0x26')}];}};}function writePDFDocument(_0x3bac8c,_0x1a585b){return new Promise(function(_0x2eda0a,_0x33531d){var _0x4655ae=_0x3bac8c[_0x20b5('0x52')](fs[_0x20b5('0x53')](_0x1a585b));_0x4655ae['on'](_0x20b5('0x54'),function(){_0x2eda0a('finish');});_0x4655ae['on']('error',function(_0xa04b02){_0x33531d(_0xa04b02);});_0x3bac8c[_0x20b5('0x55')]();});}exports[_0x20b5('0x56')]=function(_0x5b2563,_0x84b4ee){var _0x3f9005=getPDFPrinter();var _0x3c0bf1=getPDFDocDefinitionFromHTML(_0x5b2563,_0x84b4ee);var _0x1c1a9d=_0x3f9005[_0x20b5('0x57')](_0x3c0bf1);return writePDFDocument(_0x1c1a9d,_0x84b4ee[_0x20b5('0x0')])[_0x20b5('0x44')](function(_0x58482b){throw _0x58482b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a0f1883..173e8be 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 _0xe8ed=['AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','range','isInteger','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','length','existsSync','mkdirSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename'];(function(_0x307a5b,_0x2bd735){var _0x1aece7=function(_0x73a1a0){while(--_0x73a1a0){_0x307a5b['push'](_0x307a5b['shift']());}};_0x1aece7(++_0x2bd735);}(_0xe8ed,0x8a));var _0xde8e=function(_0x2caaed,_0x3fba13){_0x2caaed=_0x2caaed-0x0;var _0x5f4cd3=_0xe8ed[_0x2caaed];return _0x5f4cd3;};'use strict';var util=require(_0xde8e('0x0'));var path=require('path');var _=require(_0xde8e('0x1'));var fs=require('fs');var json2xls=require(_0xde8e('0x2'));var BPromise=require(_0xde8e('0x3'));var zipdir=require(_0xde8e('0x4'));var rimraf=require(_0xde8e('0x5'));var db=require(_0xde8e('0x6'))['db'];var dbH=require(_0xde8e('0x6'))[_0xde8e('0x7')];var logger=require(_0xde8e('0x8'))(_0xde8e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xde8e('0xa')][0x2]);var QUERY=process[_0xde8e('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x20cadc,_0x96d755){var _0x1441b5={'status':_0x20cadc};var _0x1b2837={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x96d755){_0x1441b5[_0xde8e('0xb')]=_0x96d755;}return db[_0xde8e('0xc')][_0xde8e('0xd')](_0x1441b5,_0x1b2837);}function main(){var _0x1ede3a=0x1388;var _0x1ce627;logger['info'](util['format'](_0xde8e('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xde8e('0xf')][_0xde8e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xde8e('0x11'),_0xde8e('0x12')]})[_0xde8e('0x13')](function(_0x3ef09b){if(_0x3ef09b){_0x1ce627=_0x3ef09b;_0x1ede3a=_0x1ce627[_0xde8e('0x12')]||0x1388;}})[_0xde8e('0x13')](function(){return dbH[_0xde8e('0x14')][_0xde8e('0x15')](util['format'](_0xde8e('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xde8e('0x17')]});})[_0xde8e('0x13')](function(_0x3bcc1b){if(!_0x3bcc1b[0x0][_0xde8e('0x18')]){return analyticExtractedReport(_0xde8e('0x19'));}var _0x20c1dc=[];var _0x223e91=0x0;if(_0x1ce627[_0xde8e('0x11')]){if(_0x3bcc1b&&_0x3bcc1b['length']){var _0x1a40af=_[_0xde8e('0x1a')](_0x3bcc1b[0x0]['num']/_0x1ede3a);var _0x45e5da=Number[_0xde8e('0x1b')](_0x3bcc1b[0x0][_0xde8e('0x18')]/_0x1ede3a)?_0x3bcc1b[0x0][_0xde8e('0x18')]%_0x1ede3a:0x0;_0x1a40af[_0xde8e('0x1c')](function(_0x5b9ffa){if(_0x5b9ffa>0x0){_0x223e91+=_0x1ede3a;}_0x20c1dc['push'](dbH[_0xde8e('0x14')][_0xde8e('0x15')](util[_0xde8e('0x1d')](_0xde8e('0x1e'),QUERY,_0x1ede3a,_0x223e91),{'type':dbH[_0xde8e('0x14')][_0xde8e('0x1f')][_0xde8e('0x17')]}));});if(_0x45e5da>0x0){_0x223e91+=_0x1ede3a;_0x20c1dc[_0xde8e('0x20')](dbH['sequelize'][_0xde8e('0x15')](util[_0xde8e('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x45e5da,_0x223e91),{'type':dbH['sequelize'][_0xde8e('0x1f')][_0xde8e('0x17')]}));}}}else{_0x20c1dc['push'](dbH['sequelize'][_0xde8e('0x15')](QUERY,{'type':dbH[_0xde8e('0x14')][_0xde8e('0x1f')]['SELECT']}));}var _0x1ad5d5=path['dirname'](PATH);var _0x35415c=path[_0xde8e('0x21')](PATH,'.xlsx');var _0x162c7=_0x1ce627[_0xde8e('0x11')]&&_0x20c1dc[_0xde8e('0x22')]>0x1;var _0x35838a=[];if(!fs[_0xde8e('0x23')](path['join'](_0x1ad5d5,_0x35415c))&&_0x162c7){fs[_0xde8e('0x24')](path[_0xde8e('0x25')](_0x1ad5d5,_0x35415c));}return BPromise[_0xde8e('0x26')](_0x20c1dc,function(_0x3e74f7){_0x35838a[_0xde8e('0x20')](_0x3e74f7);})['then'](function(){for(var _0x352149=0x0;_0x352149<_0x35838a[_0xde8e('0x22')];_0x352149+=0x1){var _0x146043;var _0x304026=_0x35838a[_0x352149];if(_0x162c7){_0x146043=path[_0xde8e('0x25')](_0x1ad5d5,_0x35415c,util[_0xde8e('0x1d')]('%s%d.%s',_0x35415c,_0x352149,_0xde8e('0x27')));}else{_0x146043=path[_0xde8e('0x25')](_0x1ad5d5,util[_0xde8e('0x1d')](_0xde8e('0x28'),_0x35415c,'xlsx'));}fs[_0xde8e('0x29')](_0x146043,json2xls(_0x304026),_0xde8e('0x2a'));}})['then'](function(){if(_0x162c7){return new Promise(function(_0x5354b9){zipdir(path[_0xde8e('0x25')](_0x1ad5d5,_0x35415c),{'saveTo':path[_0xde8e('0x25')](_0x1ad5d5,util['format'](_0xde8e('0x28'),_0x35415c,_0xde8e('0x2b')))},function(_0x55d4c7,_0x55302f){rimraf(path['join'](_0x1ad5d5,_0x35415c),function(){});_0x5354b9('zip\x20finished');});});}})[_0xde8e('0x13')](function(){logger['info'](util[_0xde8e('0x1d')](_0xde8e('0x2c'),EXTRACTED_REPORT_ID,_0xde8e('0x2d')));return analyticExtractedReport(_0xde8e('0x2e'),_0x162c7?util[_0xde8e('0x1d')](_0xde8e('0x28'),_0x35415c,_0x162c7?_0xde8e('0x2b'):'xlsx'):null);});})['catch'](function(_0x5bf343){logger[_0xde8e('0x2f')](util['format'](_0xde8e('0x30'),EXTRACTED_REPORT_ID,_0xde8e('0x2d')),util['inspect'](_0x5bf343,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xde8e('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xabf0=['query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x466406,_0x1137fe){var _0x63e67a=function(_0x1c9b5b){while(--_0x1c9b5b){_0x466406['push'](_0x466406['shift']());}};_0x63e67a(++_0x1137fe);}(_0xabf0,0x183));var _0x0abf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xabf0[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var path=require(_0x0abf('0x0'));var _=require(_0x0abf('0x1'));var fs=require('fs');var json2xls=require(_0x0abf('0x2'));var BPromise=require(_0x0abf('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x0abf('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0abf('0x5'))[_0x0abf('0x6')];var logger=require(_0x0abf('0x7'))(_0x0abf('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0abf('0x9')][0x2]);var QUERY=process[_0x0abf('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2796a1,_0x1c3a3a){var _0x55cfab={'status':_0x2796a1};var _0x53e05a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3a3a){_0x55cfab[_0x0abf('0xa')]=_0x1c3a3a;}return db[_0x0abf('0xb')][_0x0abf('0xc')](_0x55cfab,_0x53e05a);}function main(){var _0x53b72d=0x1388;var _0x32ccc2;logger[_0x0abf('0xd')](util['format'](_0x0abf('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x0abf('0xf')][_0x0abf('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0abf('0x11'),_0x0abf('0x12')]})[_0x0abf('0x13')](function(_0x26137c){if(_0x26137c){_0x32ccc2=_0x26137c;_0x53b72d=_0x32ccc2['splitSizeXlsx']||0x1388;}})[_0x0abf('0x13')](function(){return dbH[_0x0abf('0x14')][_0x0abf('0x15')](util[_0x0abf('0x16')](_0x0abf('0x17'),QUERY),{'type':dbH['sequelize'][_0x0abf('0x18')][_0x0abf('0x19')]});})[_0x0abf('0x13')](function(_0x1e1db8){if(!_0x1e1db8[0x0][_0x0abf('0x1a')]){return analyticExtractedReport('Empty');}var _0x1aeb02=[];var _0x5483a8=0x0;if(_0x32ccc2['split']){if(_0x1e1db8&&_0x1e1db8[_0x0abf('0x1b')]){var _0x44a81b=_['range'](_0x1e1db8[0x0][_0x0abf('0x1a')]/_0x53b72d);var _0x5675f1=Number[_0x0abf('0x1c')](_0x1e1db8[0x0]['num']/_0x53b72d)?_0x1e1db8[0x0][_0x0abf('0x1a')]%_0x53b72d:0x0;_0x44a81b[_0x0abf('0x1d')](function(_0x5708e6){if(_0x5708e6>0x0){_0x5483a8+=_0x53b72d;}_0x1aeb02['push'](dbH[_0x0abf('0x14')][_0x0abf('0x15')](util[_0x0abf('0x16')](_0x0abf('0x1e'),QUERY,_0x53b72d,_0x5483a8),{'type':dbH[_0x0abf('0x14')][_0x0abf('0x18')][_0x0abf('0x19')]}));});if(_0x5675f1>0x0){_0x5483a8+=_0x53b72d;_0x1aeb02[_0x0abf('0x1f')](dbH[_0x0abf('0x14')]['query'](util[_0x0abf('0x16')](_0x0abf('0x1e'),QUERY,_0x5675f1,_0x5483a8),{'type':dbH['sequelize'][_0x0abf('0x18')][_0x0abf('0x19')]}));}}}else{_0x1aeb02['push'](dbH[_0x0abf('0x14')]['query'](QUERY,{'type':dbH[_0x0abf('0x14')][_0x0abf('0x18')]['SELECT']}));}var _0x531fd6=path[_0x0abf('0x20')](PATH);var _0x159bb5=path['basename'](PATH,_0x0abf('0x21'));var _0x5b9085=_0x32ccc2[_0x0abf('0x11')]&&_0x1aeb02[_0x0abf('0x1b')]>0x1;var _0x4785e2=[];if(!fs['existsSync'](path['join'](_0x531fd6,_0x159bb5))&&_0x5b9085){fs[_0x0abf('0x22')](path[_0x0abf('0x23')](_0x531fd6,_0x159bb5));}return BPromise[_0x0abf('0x24')](_0x1aeb02,function(_0x4e6ab1){_0x4785e2[_0x0abf('0x1f')](_0x4e6ab1);})[_0x0abf('0x13')](function(){for(var _0xb94e8b=0x0;_0xb94e8b<_0x4785e2[_0x0abf('0x1b')];_0xb94e8b+=0x1){var _0x151902;var _0x26d11e=_0x4785e2[_0xb94e8b];if(_0x5b9085){_0x151902=path[_0x0abf('0x23')](_0x531fd6,_0x159bb5,util[_0x0abf('0x16')](_0x0abf('0x25'),_0x159bb5,_0xb94e8b,_0x0abf('0x26')));}else{_0x151902=path['join'](_0x531fd6,util[_0x0abf('0x16')]('%s.%s',_0x159bb5,_0x0abf('0x26')));}fs['writeFileSync'](_0x151902,json2xls(_0x26d11e),_0x0abf('0x27'));}})[_0x0abf('0x13')](function(){if(_0x5b9085){return new Promise(function(_0x504ec4){zipdir(path['join'](_0x531fd6,_0x159bb5),{'saveTo':path[_0x0abf('0x23')](_0x531fd6,util['format']('%s.%s',_0x159bb5,_0x0abf('0x28')))},function(_0x4e7e93,_0xb4f370){rimraf(path[_0x0abf('0x23')](_0x531fd6,_0x159bb5),function(){});_0x504ec4(_0x0abf('0x29'));});});}})['then'](function(){logger[_0x0abf('0xd')](util['format'](_0x0abf('0x2a'),EXTRACTED_REPORT_ID,_0x0abf('0x2b')));return analyticExtractedReport(_0x0abf('0x2c'),_0x5b9085?util[_0x0abf('0x16')](_0x0abf('0x2d'),_0x159bb5,_0x5b9085?_0x0abf('0x28'):_0x0abf('0x26')):null);});})[_0x0abf('0x2e')](function(_0x34cba3){logger[_0x0abf('0xd')](util[_0x0abf('0x16')](_0x0abf('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x0abf('0x30')](_0x34cba3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0abf('0x31'));})['finally'](function(){process[_0x0abf('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 13a8d0b..09364fb 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 _0x4854=['type','Set','format','context','inbound','extensions','CDR(routeid)=','VoiceExtensionId','outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','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)','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','filter','playback','hasOwnProperty','priority','extension','push'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x4854,0x169));var _0x4485=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0x4854[_0x45ad09];return _0x2084fd;};'use strict';var _=require(_0x4485('0x0'));var util=require(_0x4485('0x1'));function rewrite(_0x24ecc6,_0x13b17b){var _0x53cc9e=this;return _0x24ecc6[_0x4485('0x2')][_0x4485('0x3')][_0x4485('0x4')]({'raw':!![]})[_0x4485('0x5')](function(_0x246d2a){_0x53cc9e[_0x4485('0x6')]=_0x246d2a;return _0x24ecc6[_0x4485('0x2')][_0x4485('0x7')]['findAll']({'where':{'IntervalId':_0x13b17b['IntervalId']},'raw':!![]});})[_0x4485('0x5')](function(_0xb4ce20){return _0x24ecc6['models'][_0x4485('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x4485('0x8')](_[_0x4485('0x9')](_0xb4ce20,_0x4485('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x4485('0x5')](function(_0x4bc0a8){var _0x5f46e2=_[_0x4485('0xb')](_0x4bc0a8,{'priority':'1'});var _0x2f00dd=_[_0x4485('0xb')](_0x4bc0a8,{'isApp':0x1});var _0x4911dc=_['groupBy'](_0x2f00dd,'exten');var _0x4f826a=['queue',_0x4485('0xc')];var _0x2b0c32=[];var _0x3d7b79=[];for(var _0x4f0a83 in _0x4911dc){if(_0x4911dc[_0x4485('0xd')](_0x4f0a83)){_0x53cc9e[_0x4485('0xe')]=0x2;_0x53cc9e['extensions']=[];_0x53cc9e[_0x4485('0xf')]=_['find'](_0x5f46e2,{'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')]});_0x53cc9e['extensions'][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':util[_0x4485('0x13')]('CDR(type)=%s',_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')]),'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0]['VoiceExtensionId']});if(_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')]===_0x4485('0x15')){_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0]['type'],'app':_0x4485('0x12'),'appdata':_0x4485('0x17')+_0x4911dc[_0x4f0a83][0x0]['VoiceExtensionId'],'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e['priority']++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});}else if(_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')]===_0x4485('0x19')){if(_0x53cc9e['extension']){_0x53cc9e['extensions'][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':'Set','appdata':'CDR(destination)='+(_0x53cc9e[_0x4485('0xf')]['cutdigits']?_0x4485('0x1a')+_0x53cc9e['extension'][_0x4485('0x1b')]+'}':_0x4485('0x1c')),'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});}_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x4485('0x17')+_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')],'context':_0x4911dc[_0x4f0a83][0x0]['context'],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});var _0x11d575=_0x53cc9e[_0x4485('0xe')]++;_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0]['type'],'app':_0x4485('0x1d'),'appdata':_0x4485('0x1e')+(_0x11d575+0x2)+'):Goto('+(_0x11d575+0x1)+')','context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x11d575,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0]['VoiceExtensionId']});if(_0x53cc9e[_0x4485('0xf')]){_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x53cc9e[_0x4485('0xf')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x53cc9e['extension'][_0x4485('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});}_0x53cc9e[_0x4485('0x16')]['push']({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x4485('0x1f')+_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')],'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0]['VoiceExtensionId']});if(_0x53cc9e[_0x4485('0xf')]&&_0x53cc9e['extension'][_0x4485('0xd')](_0x4485('0x20'))&&_0x53cc9e[_0x4485('0xf')][_0x4485('0x20')]!=='none'){_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0]['exten'],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0]['VoiceExtensionId']});_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':'Set','appdata':_0x4485('0x21')+_0x53cc9e[_0x4485('0xf')]['recordingFormat']||_0x4485('0x22'),'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});}}_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':'Set','appdata':_0x4485('0x23'),'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e['priority']++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0]['type'],'app':_0x4485('0x12'),'appdata':_0x4485('0x24'),'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'priority':_0x53cc9e[_0x4485('0xe')]++,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});for(var _0x49bc80=0x0,_0x22c9ae=0x0;_0x49bc80<_0x4911dc[_0x4f0a83]['length'];_0x49bc80+=0x1,_0x22c9ae=0x0){var _0x4fd390=_0x4911dc[_0x4f0a83][_0x49bc80];if(_0x4fd390[_0x4485('0x11')]){_0x4fd390[_0x4485('0x11')]=_0x4fd390[_0x4485('0x11')][_0x4485('0x25')]();}var _0x407c3d=[];var _0x5d9be1=[];delete _0x4fd390['id'];delete _0x4fd390[_0x4485('0x26')];delete _0x4fd390['updatedAt'];var _0x4562af=_0x4fd390[_0x4485('0x27')]!==_0x4485('0x28')?[_0x4fd390[_0x4485('0x27')]]:_0x4fd390[_0x4485('0x29')]?_['map'](_[_0x4485('0xb')](_0x53cc9e[_0x4485('0x6')],{'IntervalId':_0x4fd390[_0x4485('0x29')]}),'interval'):[];if(_0x4fd390['hasOwnProperty'](_0x4485('0x2a'))){if(_0x4fd390['tag']&&_0x4fd390[_0x4485('0x2a')]!=='--'){_0x407c3d[_0x4485('0x10')]({'type':_0x4fd390[_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x4485('0x2b')+_0x4fd390[_0x4485('0x2a')],'context':_0x4fd390['context'],'exten':_0x4fd390['exten'],'priority':_0x4562af[_0x4485('0x2c')]+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390['VoiceExtensionId']});}}if(_0x4fd390[_0x4485('0x11')]===_0x4485('0x19')&&_0x4fd390[_0x4485('0xd')]('callerID')){if(_0x4fd390[_0x4485('0x2d')]){_0x407c3d['push']({'type':_0x4fd390['type'],'app':_0x4485('0x1d'),'appdata':_0x4485('0x2e')+_0x4fd390[_0x4485('0x2d')]+')','context':_0x4fd390['context'],'exten':_0x4fd390[_0x4485('0xa')],'priority':_0x4562af['length']+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390['VoiceExtensionId']});}else{_0x407c3d[_0x4485('0x10')]({'type':_0x4fd390[_0x4485('0x11')],'app':_0x4485('0x1d'),'appdata':_0x4485('0x2f'),'context':_0x4fd390[_0x4485('0x14')],'exten':_0x4fd390[_0x4485('0xa')],'priority':_0x4562af[_0x4485('0x2c')]+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390[_0x4485('0x18')]});}}if(_0x4fd390[_0x4485('0xd')](_0x4485('0x30'))){if(_0x4f826a[_0x4485('0x31')](_0x4fd390[_0x4485('0x32')][_0x4485('0x25')]())>=0x0&&_0x4fd390['appType']!==_0x4485('0x33')){if(_0x4fd390[_0x4485('0x30')]){_0x407c3d[_0x4485('0x10')]({'type':_0x4fd390[_0x4485('0x11')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4fd390[_0x4485('0x14')],'exten':_0x4fd390[_0x4485('0xa')],'priority':_0x4562af[_0x4485('0x2c')]+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390[_0x4485('0x18')]});_0x407c3d[_0x4485('0x10')]({'type':_0x4fd390[_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x4485('0x34'),'context':_0x4fd390[_0x4485('0x14')],'exten':_0x4fd390[_0x4485('0xa')],'priority':_0x4562af['length']+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390[_0x4485('0x18')]});}else{_0x407c3d['push']({'type':_0x4fd390[_0x4485('0x11')],'app':_0x4485('0x1d'),'appdata':_0x4485('0x35'),'context':_0x4fd390[_0x4485('0x14')],'exten':_0x4fd390['exten'],'priority':_0x4562af[_0x4485('0x2c')]+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390['VoiceExtensionId']});_0x407c3d[_0x4485('0x10')]({'type':_0x4fd390[_0x4485('0x11')],'app':_0x4485('0x12'),'appdata':_0x4485('0x36'),'context':_0x4fd390[_0x4485('0x14')],'exten':_0x4fd390['exten'],'priority':_0x4562af[_0x4485('0x2c')]+_0x53cc9e[_0x4485('0xe')]+_0x22c9ae++,'VoiceExtensionId':_0x4fd390[_0x4485('0x18')]});}}}for(var _0x481d45=0x0;_0x481d45<_0x4562af['length'];_0x481d45+=0x1){var _0x36a26d=_0x53cc9e['priority']+_0x4562af[_0x4485('0x2c')];var _0x3a92b5=_0x481d45===_0x4562af[_0x4485('0x2c')]-0x1?_0x53cc9e[_0x4485('0xe')]+_0x407c3d[_0x4485('0x2c')]+_0x5d9be1[_0x4485('0x2c')]+0x2:_0x53cc9e[_0x4485('0xe')]+_0x481d45+0x1;_0x407c3d[_0x4485('0x37')](_0x481d45,0x0,{'type':_0x4fd390[_0x4485('0x11')],'app':'GotoIfTime','appdata':_0x4562af[_0x481d45]+'?'+_0x4fd390[_0x4485('0x14')]+',${EXTEN},'+_0x36a26d+':'+_0x4fd390[_0x4485('0x14')]+',${EXTEN},'+_0x3a92b5,'exten':_0x4fd390[_0x4485('0xa')],'context':_0x4fd390[_0x4485('0x14')],'priority':_0x53cc9e['priority']+_0x481d45,'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});}_0x4fd390[_0x4485('0xe')]=_0x407c3d[_0x4485('0x2c')]?_['last'](_0x407c3d)[_0x4485('0xe')]+0x1:_0x53cc9e[_0x4485('0xe')];_0x53cc9e[_0x4485('0xe')]=(_0x5d9be1[_0x4485('0x2c')]?_['last'](_0x5d9be1)[_0x4485('0xe')]:_0x4fd390['priority'])+0x1;_0x53cc9e[_0x4485('0x16')]=_['concat'](_0x53cc9e[_0x4485('0x16')],_0x407c3d,[_0x4fd390],_0x5d9be1);}_0x53cc9e[_0x4485('0x16')][_0x4485('0x10')]({'type':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x11')],'app':'Hangup','exten':_0x4911dc[_0x4f0a83][0x0][_0x4485('0xa')],'context':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x14')],'priority':_0x53cc9e[_0x4485('0xe')],'VoiceExtensionId':_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]});_0x2b0c32[_0x4485('0x10')](_0x4911dc[_0x4f0a83][0x0][_0x4485('0x18')]);_0x3d7b79=_[_0x4485('0x38')](_0x3d7b79,_0x53cc9e['extensions']);}}return _0x24ecc6['transaction'](function(_0x2341d3){return _0x24ecc6[_0x4485('0x2')][_0x4485('0x7')][_0x4485('0x39')]({'where':{'VoiceExtensionId':{'$in':_0x2b0c32}},'transaction':_0x2341d3})[_0x4485('0x5')](function(_0x277b4c){return _0x24ecc6[_0x4485('0x2')][_0x4485('0x7')][_0x4485('0x3a')](_[_0x4485('0x3b')](_0x3d7b79,_0x4485('0xe')),{'transaction':_0x2341d3});});});})[_0x4485('0x3c')](function(_0x429995){console[_0x4485('0x3d')](_0x429995);});}exports[_0x4485('0x3e')]=rewrite; \ No newline at end of file +var _0x0480=['CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','indexOf','app','custom','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','extensions','extension','find','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','push','outbound','CDR(destination)=','${EXTEN:','cutdigits'];(function(_0x351db1,_0x4d9518){var _0x4578aa=function(_0x20ecbe){while(--_0x20ecbe){_0x351db1['push'](_0x351db1['shift']());}};_0x4578aa(++_0x4d9518);}(_0x0480,0x6f));var _0x0048=function(_0x23ee0c,_0x9e9d26){_0x23ee0c=_0x23ee0c-0x0;var _0xfdaf12=_0x0480[_0x23ee0c];return _0xfdaf12;};'use strict';var _=require(_0x0048('0x0'));var util=require(_0x0048('0x1'));function rewrite(_0x183b74,_0x513384){var _0x1c19a1=this;return _0x183b74[_0x0048('0x2')][_0x0048('0x3')][_0x0048('0x4')]({'raw':!![]})[_0x0048('0x5')](function(_0x5e9b83){_0x1c19a1['intervals']=_0x5e9b83;return _0x183b74[_0x0048('0x2')][_0x0048('0x6')][_0x0048('0x4')]({'where':{'IntervalId':_0x513384[_0x0048('0x7')]},'raw':!![]});})[_0x0048('0x5')](function(_0x403638){return _0x183b74[_0x0048('0x2')]['VoiceExtension'][_0x0048('0x4')]({'where':{'exten':{'$in':_[_0x0048('0x8')](_[_0x0048('0x9')](_0x403638,_0x0048('0xa')))}},'order':[{'raw':_0x0048('0xb')}],'raw':!![]});})[_0x0048('0x5')](function(_0x95d5f0){var _0x454bde=_[_0x0048('0xc')](_0x95d5f0,{'priority':'1'});var _0xfe9616=_[_0x0048('0xc')](_0x95d5f0,{'isApp':0x1});var _0x2a2122=_['groupBy'](_0xfe9616,_0x0048('0xa'));var _0x2045dc=[_0x0048('0xd'),_0x0048('0xe')];var _0x28ea7d=[];var _0x5d842d=[];for(var _0x53a9be in _0x2a2122){if(_0x2a2122['hasOwnProperty'](_0x53a9be)){_0x1c19a1['priority']=0x2;_0x1c19a1[_0x0048('0xf')]=[];_0x1c19a1[_0x0048('0x10')]=_[_0x0048('0x11')](_0x454bde,{'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')]});_0x1c19a1[_0x0048('0xf')]['push']({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':util[_0x0048('0x14')](_0x0048('0x15'),_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')]),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});if(_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')]===_0x0048('0x19')){_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x2a2122[_0x53a9be][0x0]['VoiceExtensionId'],'context':_0x2a2122[_0x53a9be][0x0]['context'],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0]['VoiceExtensionId']});}else if(_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')]===_0x0048('0x1b')){if(_0x1c19a1[_0x0048('0x10')]){_0x1c19a1['extensions'][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':'Set','appdata':_0x0048('0x1c')+(_0x1c19a1[_0x0048('0x10')]['cutdigits']?_0x0048('0x1d')+_0x1c19a1[_0x0048('0x10')][_0x0048('0x1e')]+'}':'${EXTEN}'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});}_0x1c19a1['extensions'][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0]['type'],'app':'Set','appdata':_0x0048('0x1f')+_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')],'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1['priority']++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});var _0x79027f=_0x1c19a1[_0x0048('0x17')]++;_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x20'),'appdata':_0x0048('0x21')+(_0x79027f+0x2)+_0x0048('0x22')+(_0x79027f+0x1)+')','context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x79027f,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});if(_0x1c19a1[_0x0048('0x10')]){_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x1c19a1[_0x0048('0x10')]['cutdigits']?_0x0048('0x23')+_0x1c19a1[_0x0048('0x10')][_0x0048('0x1e')]+'}':_0x0048('0x24'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0]['exten'],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});}_0x1c19a1[_0x0048('0xf')]['push']({'type':_0x2a2122[_0x53a9be][0x0]['type'],'app':_0x0048('0x13'),'appdata':_0x0048('0x25')+_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')],'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1['priority']++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});if(_0x1c19a1['extension']&&_0x1c19a1[_0x0048('0x10')][_0x0048('0x26')](_0x0048('0x27'))&&_0x1c19a1['extension'][_0x0048('0x27')]!=='none'){_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x28'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1c19a1[_0x0048('0x10')][_0x0048('0x27')]||_0x0048('0x29'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0]['VoiceExtensionId']});}}_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':'Set','appdata':_0x0048('0x2a'),'context':_0x2a2122[_0x53a9be][0x0]['context'],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1['priority']++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x2b'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0]['exten'],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});_0x1c19a1['extensions'][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x2c'),'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'priority':_0x1c19a1[_0x0048('0x17')]++,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});for(var _0x31e1cd=0x0,_0x333555=0x0;_0x31e1cd<_0x2a2122[_0x53a9be][_0x0048('0x2d')];_0x31e1cd+=0x1,_0x333555=0x0){var _0x45b108=_0x2a2122[_0x53a9be][_0x31e1cd];if(_0x45b108['type']){_0x45b108[_0x0048('0x12')]=_0x45b108[_0x0048('0x12')]['toLowerCase']();}var _0x12d7c9=[];var _0x2724db=[];delete _0x45b108['id'];delete _0x45b108[_0x0048('0x2e')];delete _0x45b108['updatedAt'];var _0x4f37a3=_0x45b108[_0x0048('0x2f')]!==_0x0048('0x30')?[_0x45b108['interval']]:_0x45b108['IntervalId']?_['map'](_[_0x0048('0xc')](_0x1c19a1[_0x0048('0x31')],{'IntervalId':_0x45b108[_0x0048('0x7')]}),_0x0048('0x2f')):[];if(_0x45b108[_0x0048('0x26')](_0x0048('0x32'))){if(_0x45b108[_0x0048('0x32')]&&_0x45b108[_0x0048('0x32')]!=='--'){_0x12d7c9[_0x0048('0x1a')]({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x33')+_0x45b108['tag'],'context':_0x45b108[_0x0048('0x16')],'exten':_0x45b108['exten'],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1[_0x0048('0x17')]+_0x333555++,'VoiceExtensionId':_0x45b108[_0x0048('0x18')]});}}if(_0x45b108[_0x0048('0x12')]===_0x0048('0x1b')&&_0x45b108[_0x0048('0x26')](_0x0048('0x34'))){if(_0x45b108[_0x0048('0x34')]){_0x12d7c9[_0x0048('0x1a')]({'type':_0x45b108['type'],'app':_0x0048('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x45b108[_0x0048('0x34')]+')','context':_0x45b108[_0x0048('0x16')],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1[_0x0048('0x17')]+_0x333555++,'VoiceExtensionId':_0x45b108['VoiceExtensionId']});}else{_0x12d7c9[_0x0048('0x1a')]({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x45b108[_0x0048('0x16')],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1[_0x0048('0x17')]+_0x333555++,'VoiceExtensionId':_0x45b108[_0x0048('0x18')]});}}if(_0x45b108[_0x0048('0x26')]('answer')){if(_0x2045dc[_0x0048('0x35')](_0x45b108[_0x0048('0x36')]['toLowerCase']())>=0x0&&_0x45b108['appType']!==_0x0048('0x37')){if(_0x45b108[_0x0048('0x38')]){_0x12d7c9['push']({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x45b108['context'],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3['length']+_0x1c19a1[_0x0048('0x17')]+_0x333555++,'VoiceExtensionId':_0x45b108[_0x0048('0x18')]});_0x12d7c9[_0x0048('0x1a')]({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x39'),'context':_0x45b108[_0x0048('0x16')],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1[_0x0048('0x17')]+_0x333555++,'VoiceExtensionId':_0x45b108[_0x0048('0x18')]});}else{_0x12d7c9['push']({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x45b108[_0x0048('0x16')],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1['priority']+_0x333555++,'VoiceExtensionId':_0x45b108['VoiceExtensionId']});_0x12d7c9[_0x0048('0x1a')]({'type':_0x45b108[_0x0048('0x12')],'app':_0x0048('0x13'),'appdata':_0x0048('0x3a'),'context':_0x45b108['context'],'exten':_0x45b108[_0x0048('0xa')],'priority':_0x4f37a3[_0x0048('0x2d')]+_0x1c19a1['priority']+_0x333555++,'VoiceExtensionId':_0x45b108[_0x0048('0x18')]});}}}for(var _0x44a857=0x0;_0x44a857<_0x4f37a3[_0x0048('0x2d')];_0x44a857+=0x1){var _0xe575f4=_0x1c19a1[_0x0048('0x17')]+_0x4f37a3[_0x0048('0x2d')];var _0x20b808=_0x44a857===_0x4f37a3[_0x0048('0x2d')]-0x1?_0x1c19a1[_0x0048('0x17')]+_0x12d7c9[_0x0048('0x2d')]+_0x2724db['length']+0x2:_0x1c19a1[_0x0048('0x17')]+_0x44a857+0x1;_0x12d7c9[_0x0048('0x3b')](_0x44a857,0x0,{'type':_0x45b108['type'],'app':_0x0048('0x3c'),'appdata':_0x4f37a3[_0x44a857]+'?'+_0x45b108[_0x0048('0x16')]+',${EXTEN},'+_0xe575f4+':'+_0x45b108['context']+_0x0048('0x3d')+_0x20b808,'exten':_0x45b108[_0x0048('0xa')],'context':_0x45b108[_0x0048('0x16')],'priority':_0x1c19a1[_0x0048('0x17')]+_0x44a857,'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});}_0x45b108[_0x0048('0x17')]=_0x12d7c9[_0x0048('0x2d')]?_['last'](_0x12d7c9)['priority']+0x1:_0x1c19a1['priority'];_0x1c19a1['priority']=(_0x2724db[_0x0048('0x2d')]?_[_0x0048('0x3e')](_0x2724db)[_0x0048('0x17')]:_0x45b108[_0x0048('0x17')])+0x1;_0x1c19a1['extensions']=_[_0x0048('0x3f')](_0x1c19a1[_0x0048('0xf')],_0x12d7c9,[_0x45b108],_0x2724db);}_0x1c19a1[_0x0048('0xf')][_0x0048('0x1a')]({'type':_0x2a2122[_0x53a9be][0x0][_0x0048('0x12')],'app':'Hangup','exten':_0x2a2122[_0x53a9be][0x0][_0x0048('0xa')],'context':_0x2a2122[_0x53a9be][0x0][_0x0048('0x16')],'priority':_0x1c19a1[_0x0048('0x17')],'VoiceExtensionId':_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]});_0x28ea7d['push'](_0x2a2122[_0x53a9be][0x0][_0x0048('0x18')]);_0x5d842d=_[_0x0048('0x3f')](_0x5d842d,_0x1c19a1['extensions']);}}return _0x183b74[_0x0048('0x40')](function(_0x9cc1d0){return _0x183b74['models'][_0x0048('0x6')][_0x0048('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x28ea7d}},'transaction':_0x9cc1d0})[_0x0048('0x5')](function(_0x2b3b1c){return _0x183b74[_0x0048('0x2')][_0x0048('0x6')][_0x0048('0x42')](_[_0x0048('0x43')](_0x5d842d,_0x0048('0x17')),{'transaction':_0x9cc1d0});});});})[_0x0048('0x44')](function(_0x2c8237){console[_0x0048('0x45')](_0x2c8237);});}exports[_0x0048('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ce83322..2c0679d 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 _0xe26c=['fromQuery','ContactId','ListId','createdAt','select','field','scheduledAt','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','BlackLists','all','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','CmContact','create','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','cm_hopper'];(function(_0x4720bc,_0x1dfa61){var _0x538932=function(_0x5d1b89){while(--_0x5d1b89){_0x4720bc['push'](_0x4720bc['shift']());}};_0x538932(++_0x1dfa61);}(_0xe26c,0x176));var _0xce26=function(_0x3cd55e,_0x358e2e){_0x3cd55e=_0x3cd55e-0x0;var _0x13e629=_0xe26c[_0x3cd55e];return _0x13e629;};'use strict';var BPromise=require(_0xce26('0x0'));var util=require('util');var _=require(_0xce26('0x1'));var fs=require('fs');var squel=require(_0xce26('0x2'));var Papa=require('papaparse');var Redis=require(_0xce26('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xce26('0x4'));var logger=require(_0xce26('0x5'))(_0xce26('0x6'));config[_0xce26('0x7')]=_['defaults'](config[_0xce26('0x7')],{'host':_0xce26('0x8'),'port':0x18eb});var socket=require(_0xce26('0x9'))(new Redis(config['redis']));require(_0xce26('0xa'))[_0xce26('0xb')](socket);try{if(!process[_0xce26('0xc')][0x2]||process[_0xce26('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0xce26('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xce26('0xc')][0x3]||process[_0xce26('0xc')][0x3]===_0xce26('0xe')||process[_0xce26('0xc')][0x3]===_0xce26('0xd')||!process[_0xce26('0xc')][0x4]||process[_0xce26('0xc')][0x4]===_0xce26('0xe')||process[_0xce26('0xc')][0x4]==='null'){throw new Error(_0xce26('0xf'));}var FIELDS=_[_0xce26('0x10')](process['argv'][0x3][_0xce26('0x11')](','),process[_0xce26('0xc')][0x4][_0xce26('0x11')](','));if(!process[_0xce26('0xc')][0x5]||process['argv'][0x5]==='undefined'||process[_0xce26('0xc')][0x5]===_0xce26('0xd')){throw new Error(_0xce26('0x12'));}var LISTID=process[_0xce26('0xc')][0x5];var COMPANYID=process[_0xce26('0xc')][0x6]&&process['argv'][0x6]!==_0xce26('0xe')&&process[_0xce26('0xc')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xce26('0xc')][0x7]&&process[_0xce26('0xc')][0x7]!==_0xce26('0xe')&&process[_0xce26('0xc')][0x7]!=='null'?process[_0xce26('0xc')][0x7]:null;if(!process[_0xce26('0xc')][0x8]||process['argv'][0x8]===_0xce26('0xe')||process['argv'][0x8]===_0xce26('0xd')){throw new Error(_0xce26('0x13'));}var SOCKET_TIMESTAMP=process[_0xce26('0xc')][0x8];}catch(_0x10ff41){logger[_0xce26('0x14')](_0x10ff41);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(_0x400475,_0x10332c,_0x179e5f,_0x1abd75){var _0x347d7a={'message':_0x10332c};_0x347d7a[_0x400475]=!![];if(_0x179e5f){_0x347d7a['contact']=_0x179e5f;}if(_0x1abd75){_0x347d7a['index']=_0x1abd75;}return _0x347d7a;}function isEmail(_0x37ba88){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))*$/[_0xce26('0x15')](_0x37ba88);}function checkRow(_0x448957,_0x206062,_0x44e9cb){return new BPromise(function(_0x4a4f3f,_0x237bc0){if(_[_0xce26('0x16')](_0x448957)){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),_0xce26('0x17'),null,_0x44e9cb));}if(_0x448957[_0xce26('0x18')]&&_0x448957[_0xce26('0x18')][_0xce26('0x19')]){var _0x4d0f14=_[_0xce26('0x1a')](_0x448957['errors'],_0xce26('0x1b'))[_0xce26('0x1c')](';');return _0x237bc0(handleCheckRowError('error',_0x4d0f14,null,_0x44e9cb));}var _0x1d4ea3={};for(var _0x4a7718 in FIELDS){if(FIELDS[_0xce26('0x1d')](_0x4a7718)&&FIELDS[_0x4a7718]){_0x1d4ea3[_0x4a7718]=_0x448957[_0xce26('0x1e')][0x0][FIELDS[_0x4a7718]]||_0x448957['data'][0x0]['\ufeff'+FIELDS[_0x4a7718]];}}if(!_0x1d4ea3['firstName']){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),_0xce26('0x1f'),null,_0x44e9cb));}if(!_0x1d4ea3[_0xce26('0x20')]){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),'phone\x20not\x20specified!',null,_0x44e9cb));}if(_0x1d4ea3[_0xce26('0x21')]){var _0x4f7a07=moment(_0x1d4ea3[_0xce26('0x21')],_0xce26('0x22'));if(!_0x4f7a07[_0xce26('0x23')]()){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),_0xce26('0x24'),null,_0x44e9cb));}}if(_0x1d4ea3[_0xce26('0x25')]){if(!isEmail(_0x1d4ea3['email'])){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),_0xce26('0x26'),null,_0x44e9cb));}}_0x1d4ea3['ListId']=LISTID;_0x1d4ea3['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xce26('0x19')]&&_0x206062){var _0x4f50ed={};for(var _0x5550aa=0x0,_0x57f5c7=DUPLICATES['length'];_0x5550aa<_0x57f5c7;_0x5550aa+=0x1){_0x4f50ed[DUPLICATES[_0x5550aa]]=_0x1d4ea3[DUPLICATES[_0x5550aa]];}var _0x3c03dd=_[_0xce26('0x27')](_0x206062,_0x4f50ed);if(_0x3c03dd){return _0x237bc0(handleCheckRowError(_0xce26('0x28'),_0xce26('0x29'),_0x3c03dd,_0x44e9cb));}}return db[_0xce26('0x2a')][_0xce26('0x2b')](_0x1d4ea3,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1d4ea3)})['then'](function(_0x1ca1e3){if(DUPLICATES&&DUPLICATES[_0xce26('0x19')]&&_0x206062){_0x206062[_0xce26('0x2c')](_['pick'](_0x1d4ea3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1ca1e3['id'];return _0x4a4f3f();})['catch'](function(_0x318df1){return _0x237bc0(handleCheckRowError(_0xce26('0x14'),_0xce26('0x2d')+(_0x318df1['message']||JSON[_0xce26('0x2e')](_0x318df1)),null,_0x44e9cb));});});}function checkHopper(){function _0x1f8466(){return function(_0x51a1ac){logger[_0xce26('0x14')](_0xce26('0x2f'),'checkHopper',util[_0xce26('0x30')](_0x51a1ac,{'showHidden':![],'depth':null}));};}var _0x1514a3=function(_0x40f274,_0x409eef){var _0x2b4ce2=squel['insert']()['into'](_0xce26('0x31'))[_0xce26('0x32')]([_0xce26('0x20'),'scheduledAt',_0xce26('0x33'),_0xce26('0x34'),_0x409eef,_0xce26('0x35'),'updatedAt'],squel[_0xce26('0x36')]()[_0xce26('0x37')](_0xce26('0x20'),'phone')[_0xce26('0x37')]('NOW()',_0xce26('0x38'))[_0xce26('0x37')]('id',_0xce26('0x33'))['field'](LISTID[_0xce26('0x39')](),_0xce26('0x34'))[_0xce26('0x37')](_0x40f274['id'][_0xce26('0x39')](),_0x409eef)[_0xce26('0x37')](_0xce26('0x3a'),_0xce26('0x35'))['field'](_0xce26('0x3a'),_0xce26('0x3b'))[_0xce26('0x3c')](_0xce26('0x3d'))[_0xce26('0x3e')](_0xce26('0x3f'))[_0xce26('0x3e')](_0xce26('0x40'),LISTID['toString']())[_0xce26('0x3e')](_0xce26('0x41'))[_0xce26('0x3e')](_0xce26('0x42'),squel[_0xce26('0x36')]()[_0xce26('0x37')]('phone')[_0xce26('0x3c')](_0xce26('0x31'))[_0xce26('0x3e')](_0x409eef+_0xce26('0x43'),_0x40f274['id'][_0xce26('0x39')]())))[_0xce26('0x39')]();return _0x2b4ce2;};var _0x437b8d=function(_0x52bb87,_0x3206ce){var _0x1d8e81=squel[_0xce26('0x44')]()[_0xce26('0x45')](_0xce26('0x31'))[_0xce26('0x32')]([_0xce26('0x20'),_0xce26('0x38'),'ContactId','ListId',_0x3206ce,_0xce26('0x35'),_0xce26('0x3b')],squel[_0xce26('0x36')]()[_0xce26('0x37')](_0xce26('0x20'),_0xce26('0x20'))['field'](_0xce26('0x3a'),_0xce26('0x38'))['field']('id',_0xce26('0x33'))['field'](LISTID[_0xce26('0x39')](),'ListId')[_0xce26('0x37')](_0x52bb87['id'][_0xce26('0x39')](),_0x3206ce)['field']('NOW()',_0xce26('0x35'))[_0xce26('0x37')](_0xce26('0x3a'),'updatedAt')[_0xce26('0x3c')]('cm_contacts')['where'](_0xce26('0x3f'))[_0xce26('0x3e')](_0xce26('0x40'),LISTID[_0xce26('0x39')]())[_0xce26('0x3e')](_0xce26('0x46'),squel[_0xce26('0x47')](hopperContacts))[_0xce26('0x3e')](_0xce26('0x41'))[_0xce26('0x3e')](_0xce26('0x42'),squel['select']()[_0xce26('0x37')]('calleridnum')[_0xce26('0x3c')]('cm_hopper_final')[_0xce26('0x3e')](_0x3206ce+_0xce26('0x43'),_0x52bb87['id'][_0xce26('0x39')]()))[_0xce26('0x3e')](_0xce26('0x42'),squel['select']()[_0xce26('0x37')](_0xce26('0x20'))['from'](_0xce26('0x31'))[_0xce26('0x3e')](_0x3206ce+'\x20=\x20?',_0x52bb87['id'][_0xce26('0x39')]())))[_0xce26('0x39')]();return _0x1d8e81;};function _0x2d0b3(_0x349e04,_0x17c8dc){var _0x19542b=squel[_0xce26('0x44')]()[_0xce26('0x45')](_0xce26('0x31'))[_0xce26('0x32')]([_0xce26('0x20'),_0xce26('0x38'),_0xce26('0x33'),_0xce26('0x34'),_0x17c8dc,_0xce26('0x35'),'updatedAt'],squel['select']()[_0xce26('0x37')](_0xce26('0x20'),_0xce26('0x20'))[_0xce26('0x37')](_0xce26('0x3a'),_0xce26('0x38'))[_0xce26('0x37')]('id','ContactId')[_0xce26('0x37')](LISTID[_0xce26('0x39')](),_0xce26('0x34'))[_0xce26('0x37')](_0x349e04['id']['toString'](),_0x17c8dc)[_0xce26('0x37')](_0xce26('0x3a'),_0xce26('0x35'))[_0xce26('0x37')](_0xce26('0x3a'),'updatedAt')[_0xce26('0x3c')](_0xce26('0x3d'))[_0xce26('0x3e')](_0xce26('0x3f'))[_0xce26('0x3e')](_0xce26('0x40'),LISTID[_0xce26('0x39')]())[_0xce26('0x3e')](_0xce26('0x46'),squel[_0xce26('0x47')](hopperContacts))[_0xce26('0x3e')](_0xce26('0x41')))['toString']();return _0x19542b;}function _0x15932f(_0x2d79ca,_0x573a98){var _0x1b7928=squel['insert']()['into'](_0xce26('0x48'))[_0xce26('0x32')]([_0xce26('0x20'),'ContactId',_0xce26('0x34'),_0x573a98,_0xce26('0x35'),_0xce26('0x3b')],squel[_0xce26('0x36')]()['field'](_0xce26('0x20'),_0xce26('0x20'))[_0xce26('0x37')]('id','ContactId')['field'](LISTID[_0xce26('0x39')](),_0xce26('0x34'))[_0xce26('0x37')](_0x2d79ca['id'][_0xce26('0x39')](),_0x573a98)['field'](_0xce26('0x3a'),_0xce26('0x35'))[_0xce26('0x37')](_0xce26('0x3a'),_0xce26('0x3b'))[_0xce26('0x3c')](_0xce26('0x3d'))[_0xce26('0x3e')](_0xce26('0x3f'))['where'](_0xce26('0x40'),LISTID[_0xce26('0x39')]())[_0xce26('0x3e')]('id\x20IN\x20?',squel[_0xce26('0x47')](hopperContacts))[_0xce26('0x3e')](_0xce26('0x41')))[_0xce26('0x39')]();return _0x1b7928;}return db[_0xce26('0x49')][_0xce26('0x4a')]({'where':{'type':_0xce26('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xce26('0x4c')],'as':_0xce26('0x4d'),'where':{'id':LISTID}}]})[_0xce26('0x4e')](function(_0x4afe39){var _0x4cd390=[];if(_0x4afe39){var _0x74f3e2;for(var _0x531dc0=0x0,_0x5eed27;_0x531dc0<_0x4afe39['length'];_0x531dc0+=0x1){_0x5eed27=_0x4afe39[_0x531dc0][_0xce26('0x4f')]({'plain':!![]});switch(_0x5eed27[_0xce26('0x50')]){case _0xce26('0x51'):_0x4cd390[_0xce26('0x2c')](db[_0xce26('0x52')][_0xce26('0x53')](_0x437b8d(_0x5eed27,_0xce26('0x54')))[_0xce26('0x4e')](function(){})[_0xce26('0x55')](_0x1f8466()));break;case _0xce26('0x56'):_0x4cd390[_0xce26('0x2c')](db['sequelize'][_0xce26('0x53')](_0x1514a3(_0x5eed27,_0xce26('0x54')))[_0xce26('0x4e')](function(){})[_0xce26('0x55')](_0x1f8466()));break;default:_0x4cd390[_0xce26('0x2c')](db[_0xce26('0x52')][_0xce26('0x53')](_0x2d0b3(_0x5eed27,_0xce26('0x54')))[_0xce26('0x4e')](function(){})['catch'](_0x1f8466()));}}}return _0x4cd390;})['all']()[_0xce26('0x4e')](function(){return db[_0xce26('0x49')][_0xce26('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xce26('0x4c')],'as':_0xce26('0x57'),'where':{'id':LISTID}}]})[_0xce26('0x4e')](function(_0x54c1af){var _0x5f33db=[];if(_0x54c1af){var _0x3a541f;for(var _0x2c82f2=0x0,_0x5bd037;_0x2c82f2<_0x54c1af[_0xce26('0x19')];_0x2c82f2+=0x1){_0x5bd037=_0x54c1af[_0x2c82f2]['get']({'plain':!![]});_0x5f33db['push'](db[_0xce26('0x52')]['query'](_0x15932f(_0x5bd037,_0xce26('0x54')))[_0xce26('0x4e')](function(){})['catch'](_0x1f8466()));}}return _0x5f33db;})[_0xce26('0x58')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xce26('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0xce26('0x4e')](function(_0x2acadd){var _0x4e6471=[];if(_0x2acadd){for(var _0x59a92e=0x0,_0x18f88c;_0x59a92e<_0x2acadd[_0xce26('0x19')];_0x59a92e+=0x1){_0x18f88c=_0x2acadd[_0x59a92e]['get']({'plain':!![]});switch(_0x18f88c[_0xce26('0x50')]){case _0xce26('0x51'):_0x4e6471[_0xce26('0x2c')](db[_0xce26('0x52')]['query'](_0x437b8d(_0x18f88c,_0xce26('0x59')))[_0xce26('0x4e')](function(){})[_0xce26('0x55')](_0x1f8466()));break;case'onlyIfOpen':_0x4e6471[_0xce26('0x2c')](db[_0xce26('0x52')][_0xce26('0x53')](_0x1514a3(_0x18f88c,_0xce26('0x59')))[_0xce26('0x4e')](function(){})[_0xce26('0x55')](_0x1f8466()));break;default:_0x4e6471[_0xce26('0x2c')](db[_0xce26('0x52')][_0xce26('0x53')](_0x2d0b3(_0x18f88c,_0xce26('0x59')))['then'](function(){})[_0xce26('0x55')](_0x1f8466()));}}}return _0x4e6471;})['all']();})['then'](function(){return db[_0xce26('0x5a')][_0xce26('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xce26('0x4c')],'as':_0xce26('0x57'),'where':{'id':LISTID}}]})[_0xce26('0x4e')](function(_0x4dcad9){var _0x1e6725=[];if(_0x4dcad9){for(var _0x1998e5=0x0,_0x15dea1;_0x1998e5<_0x4dcad9[_0xce26('0x19')];_0x1998e5+=0x1){_0x15dea1=_0x4dcad9[_0x1998e5][_0xce26('0x4f')]({'plain':!![]});_0x1e6725[_0xce26('0x2c')](db[_0xce26('0x52')][_0xce26('0x53')](_0x15932f(_0x15dea1,'CampaignId'))['then'](function(){})['catch'](_0x1f8466()));}}return _0x1e6725;})[_0xce26('0x58')]();})[_0xce26('0x55')](function(_0x4a2ec6){logger['error']('cmContact,\x20%s,\x20%s',_0xce26('0x5b'),_0x4a2ec6[_0xce26('0x1b')]);});}var processPromises=function(_0x5d80f7){return BPromise['all'](promises)[_0xce26('0x4e')](function(_0x58d048){})['catch'](function(_0x41f982){logger['error'](_0xce26('0x5c'),JSON[_0xce26('0x2e')](_0x41f982));})[_0xce26('0x5d')](function(){socket[_0xce26('0x5e')](_0xce26('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d80f7){return _0x5d80f7['resume']();}});};var endCsv=function(){return BPromise[_0xce26('0x60')]()[_0xce26('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0xce26('0x4e')](function(){socket[_0xce26('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xce26('0x61')](FILEPATH);}catch(_0x3c1b2a){logger[_0xce26('0x14')](_0xce26('0x62'),JSON[_0xce26('0x2e')](_0x3c1b2a));}finally{process[_0xce26('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xce26('0x64')](_0xce26('0x65'));endCsv();});function main(){return BPromise[_0xce26('0x60')]()[_0xce26('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xce26('0x11')](',');return db[_0xce26('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xce26('0x4e')](function(_0x36a45c){var _0x428504=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x428504,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e78a5,_0x48ffed){total+=0x1;var _0x1e8114=total;promises['push'](checkRow(_0x1e78a5,_0x36a45c,_0x1e8114)[_0xce26('0x4e')](function(){success+=0x1;})[_0xce26('0x55')](function(_0x16e793){if(_0x16e793[_0xce26('0x14')]){errors+=0x1;delete _0x16e793['error'];}else if(_0x16e793[_0xce26('0x28')]){duplicates+=0x1;delete _0x16e793[_0xce26('0x28')];}rows[_0xce26('0x2c')](_0x16e793);}));if(total%0xc8===0x0){_0x48ffed[_0xce26('0x66')]();return processPromises(_0x48ffed);}},'complete':function(){return processPromises()[_0xce26('0x4e')](function(){logger[_0xce26('0x64')](_0xce26('0x67'));endCsv();});},'error':function(_0x1bc484,_0x1d5176){logger[_0xce26('0x64')](_0xce26('0x68'),JSON[_0xce26('0x2e')](_0x1bc484));endCsv();}});})['catch'](function(_0x4d8742){logger[_0xce26('0x14')](_0xce26('0x69'),JSON['stringify'](_0x4d8742));});}main(); \ No newline at end of file +var _0x5d9a=['finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','test','errors','length','map','message','join','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','cm_contacts','str','calleridnum','cm_hopper_final','\x20=\x20?','fromQuery','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','outbound','BlackLists','Campaign','CampaignId','all','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:'];(function(_0x5d2a0b,_0x224765){var _0x5d49d3=function(_0x578101){while(--_0x578101){_0x5d2a0b['push'](_0x5d2a0b['shift']());}};_0x5d49d3(++_0x224765);}(_0x5d9a,0xe2));var _0xa5d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5d9a[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa5d9('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xa5d9('0x1'));var Redis=require(_0xa5d9('0x2'));var db=require(_0xa5d9('0x3'))['db'];var config=require(_0xa5d9('0x4'));var logger=require(_0xa5d9('0x5'))(_0xa5d9('0x6'));config[_0xa5d9('0x7')]=_[_0xa5d9('0x8')](config['redis'],{'host':_0xa5d9('0x9'),'port':0x18eb});var socket=require(_0xa5d9('0xa'))(new Redis(config['redis']));require(_0xa5d9('0xb'))[_0xa5d9('0xc')](socket);try{if(!process[_0xa5d9('0xd')][0x2]||process[_0xa5d9('0xd')][0x2]===_0xa5d9('0xe')||process[_0xa5d9('0xd')][0x2]===_0xa5d9('0xf')){throw new Error(_0xa5d9('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0xa5d9('0xd')][0x3]||process['argv'][0x3]===_0xa5d9('0xe')||process[_0xa5d9('0xd')][0x3]===_0xa5d9('0xf')||!process['argv'][0x4]||process[_0xa5d9('0xd')][0x4]===_0xa5d9('0xe')||process[_0xa5d9('0xd')][0x4]===_0xa5d9('0xf')){throw new Error(_0xa5d9('0x11'));}var FIELDS=_['zipObject'](process[_0xa5d9('0xd')][0x3][_0xa5d9('0x12')](','),process[_0xa5d9('0xd')][0x4][_0xa5d9('0x12')](','));if(!process[_0xa5d9('0xd')][0x5]||process[_0xa5d9('0xd')][0x5]==='undefined'||process[_0xa5d9('0xd')][0x5]===_0xa5d9('0xf')){throw new Error(_0xa5d9('0x13'));}var LISTID=process[_0xa5d9('0xd')][0x5];var COMPANYID=process[_0xa5d9('0xd')][0x6]&&process[_0xa5d9('0xd')][0x6]!=='undefined'&&process[_0xa5d9('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xa5d9('0xd')][0x7]&&process['argv'][0x7]!==_0xa5d9('0xe')&&process['argv'][0x7]!==_0xa5d9('0xf')?process['argv'][0x7]:null;if(!process[_0xa5d9('0xd')][0x8]||process[_0xa5d9('0xd')][0x8]===_0xa5d9('0xe')||process[_0xa5d9('0xd')][0x8]===_0xa5d9('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x113a7f){logger[_0xa5d9('0x14')](_0x113a7f);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(_0x2a234d,_0x575c00,_0x1759ee,_0x13cbc0){var _0x2951d7={'message':_0x575c00};_0x2951d7[_0x2a234d]=!![];if(_0x1759ee){_0x2951d7[_0xa5d9('0x15')]=_0x1759ee;}if(_0x13cbc0){_0x2951d7['index']=_0x13cbc0;}return _0x2951d7;}function isEmail(_0x48ef60){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))*$/[_0xa5d9('0x16')](_0x48ef60);}function checkRow(_0x2cbf0d,_0x1029ad,_0x3b96f4){return new BPromise(function(_0x4f20c7,_0x160ed2){if(_['isNil'](_0x2cbf0d)){return _0x160ed2(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b96f4));}if(_0x2cbf0d[_0xa5d9('0x17')]&&_0x2cbf0d[_0xa5d9('0x17')][_0xa5d9('0x18')]){var _0x292eff=_[_0xa5d9('0x19')](_0x2cbf0d[_0xa5d9('0x17')],_0xa5d9('0x1a'))[_0xa5d9('0x1b')](';');return _0x160ed2(handleCheckRowError(_0xa5d9('0x14'),_0x292eff,null,_0x3b96f4));}var _0x3b495b={};for(var _0x316f24 in FIELDS){if(FIELDS['hasOwnProperty'](_0x316f24)&&FIELDS[_0x316f24]){_0x3b495b[_0x316f24]=_0x2cbf0d['data'][0x0][FIELDS[_0x316f24]]||_0x2cbf0d['data'][0x0]['\ufeff'+FIELDS[_0x316f24]];}}if(!_0x3b495b[_0xa5d9('0x1c')]){return _0x160ed2(handleCheckRowError(_0xa5d9('0x14'),_0xa5d9('0x1d'),null,_0x3b96f4));}if(!_0x3b495b[_0xa5d9('0x1e')]){return _0x160ed2(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x3b96f4));}if(_0x3b495b[_0xa5d9('0x1f')]){var _0x18cfb9=moment(_0x3b495b[_0xa5d9('0x1f')],_0xa5d9('0x20'));if(!_0x18cfb9[_0xa5d9('0x21')]()){return _0x160ed2(handleCheckRowError(_0xa5d9('0x14'),_0xa5d9('0x22'),null,_0x3b96f4));}}if(_0x3b495b[_0xa5d9('0x23')]){if(!isEmail(_0x3b495b[_0xa5d9('0x23')])){return _0x160ed2(handleCheckRowError(_0xa5d9('0x14'),_0xa5d9('0x24'),null,_0x3b96f4));}}_0x3b495b[_0xa5d9('0x25')]=LISTID;_0x3b495b[_0xa5d9('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa5d9('0x18')]&&_0x1029ad){var _0x112b6f={};for(var _0xc2856d=0x0,_0x5caf03=DUPLICATES[_0xa5d9('0x18')];_0xc2856d<_0x5caf03;_0xc2856d+=0x1){_0x112b6f[DUPLICATES[_0xc2856d]]=_0x3b495b[DUPLICATES[_0xc2856d]];}var _0x45acd2=_[_0xa5d9('0x27')](_0x1029ad,_0x112b6f);if(_0x45acd2){return _0x160ed2(handleCheckRowError(_0xa5d9('0x28'),'Duplicate\x20Contact',_0x45acd2,_0x3b96f4));}}return db[_0xa5d9('0x29')][_0xa5d9('0x2a')](_0x3b495b,{'raw':!![],'hooks':![],'fields':_[_0xa5d9('0x2b')](_0x3b495b)})[_0xa5d9('0x2c')](function(_0x361c9){if(DUPLICATES&&DUPLICATES[_0xa5d9('0x18')]&&_0x1029ad){_0x1029ad[_0xa5d9('0x2d')](_[_0xa5d9('0x2e')](_0x3b495b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x361c9['id'];return _0x4f20c7();})[_0xa5d9('0x2f')](function(_0x4a1498){return _0x160ed2(handleCheckRowError(_0xa5d9('0x14'),_0xa5d9('0x30')+(_0x4a1498[_0xa5d9('0x1a')]||JSON[_0xa5d9('0x31')](_0x4a1498)),null,_0x3b96f4));});});}function checkHopper(){function _0x5e09b3(){return function(_0x72bc7d){logger[_0xa5d9('0x14')](_0xa5d9('0x32'),_0xa5d9('0x33'),util[_0xa5d9('0x34')](_0x72bc7d,{'showHidden':![],'depth':null}));};}var _0x256c7b=function(_0x2a9cc7,_0xd278cf){var _0x50cc81=squel[_0xa5d9('0x35')]()['into'](_0xa5d9('0x36'))['fromQuery'](['phone',_0xa5d9('0x37'),_0xa5d9('0x38'),'ListId',_0xd278cf,_0xa5d9('0x39'),_0xa5d9('0x3a')],squel[_0xa5d9('0x3b')]()[_0xa5d9('0x3c')](_0xa5d9('0x1e'),'phone')[_0xa5d9('0x3c')](_0xa5d9('0x3d'),_0xa5d9('0x37'))['field']('id',_0xa5d9('0x38'))[_0xa5d9('0x3c')](LISTID['toString'](),_0xa5d9('0x25'))['field'](_0x2a9cc7['id'][_0xa5d9('0x3e')](),_0xd278cf)['field']('NOW()',_0xa5d9('0x39'))[_0xa5d9('0x3c')](_0xa5d9('0x3d'),'updatedAt')[_0xa5d9('0x3f')]('cm_contacts')[_0xa5d9('0x40')](_0xa5d9('0x41'))['where'](_0xa5d9('0x42'),LISTID['toString']())['where'](_0xa5d9('0x43'))[_0xa5d9('0x40')](_0xa5d9('0x44'),squel[_0xa5d9('0x3b')]()['field'](_0xa5d9('0x1e'))[_0xa5d9('0x3f')](_0xa5d9('0x36'))[_0xa5d9('0x40')](_0xd278cf+'\x20=\x20?',_0x2a9cc7['id'][_0xa5d9('0x3e')]())))[_0xa5d9('0x3e')]();return _0x50cc81;};var _0x44e5c5=function(_0x3dbccc,_0x13e937){var _0x32c930=squel[_0xa5d9('0x35')]()[_0xa5d9('0x45')](_0xa5d9('0x36'))['fromQuery']([_0xa5d9('0x1e'),_0xa5d9('0x37'),_0xa5d9('0x38'),'ListId',_0x13e937,'createdAt','updatedAt'],squel['select']()[_0xa5d9('0x3c')](_0xa5d9('0x1e'),_0xa5d9('0x1e'))[_0xa5d9('0x3c')](_0xa5d9('0x3d'),_0xa5d9('0x37'))[_0xa5d9('0x3c')]('id','ContactId')['field'](LISTID['toString'](),'ListId')['field'](_0x3dbccc['id']['toString'](),_0x13e937)[_0xa5d9('0x3c')](_0xa5d9('0x3d'),_0xa5d9('0x39'))[_0xa5d9('0x3c')](_0xa5d9('0x3d'),_0xa5d9('0x3a'))['from'](_0xa5d9('0x46'))[_0xa5d9('0x40')]('deletedAt\x20IS\x20NULL')[_0xa5d9('0x40')](_0xa5d9('0x42'),LISTID['toString']())[_0xa5d9('0x40')]('id\x20IN\x20?',squel[_0xa5d9('0x47')](hopperContacts))[_0xa5d9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xa5d9('0x40')](_0xa5d9('0x44'),squel[_0xa5d9('0x3b')]()['field'](_0xa5d9('0x48'))[_0xa5d9('0x3f')](_0xa5d9('0x49'))[_0xa5d9('0x40')](_0x13e937+'\x20=\x20?',_0x3dbccc['id'][_0xa5d9('0x3e')]()))[_0xa5d9('0x40')](_0xa5d9('0x44'),squel[_0xa5d9('0x3b')]()[_0xa5d9('0x3c')]('phone')['from'](_0xa5d9('0x36'))[_0xa5d9('0x40')](_0x13e937+_0xa5d9('0x4a'),_0x3dbccc['id']['toString']())))['toString']();return _0x32c930;};function _0x176f13(_0xe2c1c9,_0x2bb00b){var _0x2cbbb3=squel[_0xa5d9('0x35')]()[_0xa5d9('0x45')](_0xa5d9('0x36'))[_0xa5d9('0x4b')]([_0xa5d9('0x1e'),_0xa5d9('0x37'),'ContactId',_0xa5d9('0x25'),_0x2bb00b,_0xa5d9('0x39'),_0xa5d9('0x3a')],squel[_0xa5d9('0x3b')]()[_0xa5d9('0x3c')]('phone','phone')['field'](_0xa5d9('0x3d'),_0xa5d9('0x37'))[_0xa5d9('0x3c')]('id',_0xa5d9('0x38'))[_0xa5d9('0x3c')](LISTID[_0xa5d9('0x3e')](),_0xa5d9('0x25'))[_0xa5d9('0x3c')](_0xe2c1c9['id']['toString'](),_0x2bb00b)['field'](_0xa5d9('0x3d'),'createdAt')[_0xa5d9('0x3c')]('NOW()','updatedAt')[_0xa5d9('0x3f')]('cm_contacts')[_0xa5d9('0x40')](_0xa5d9('0x41'))[_0xa5d9('0x40')](_0xa5d9('0x42'),LISTID[_0xa5d9('0x3e')]())[_0xa5d9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa5d9('0x3e')]();return _0x2cbbb3;}function _0x34da53(_0x27ad8f,_0x327a84){var _0x2c5703=squel[_0xa5d9('0x35')]()[_0xa5d9('0x45')](_0xa5d9('0x4c'))[_0xa5d9('0x4b')]([_0xa5d9('0x1e'),_0xa5d9('0x38'),_0xa5d9('0x25'),_0x327a84,_0xa5d9('0x39'),_0xa5d9('0x3a')],squel[_0xa5d9('0x3b')]()[_0xa5d9('0x3c')](_0xa5d9('0x1e'),_0xa5d9('0x1e'))[_0xa5d9('0x3c')]('id','ContactId')[_0xa5d9('0x3c')](LISTID[_0xa5d9('0x3e')](),_0xa5d9('0x25'))[_0xa5d9('0x3c')](_0x27ad8f['id'][_0xa5d9('0x3e')](),_0x327a84)[_0xa5d9('0x3c')](_0xa5d9('0x3d'),_0xa5d9('0x39'))['field'](_0xa5d9('0x3d'),_0xa5d9('0x3a'))['from'](_0xa5d9('0x46'))[_0xa5d9('0x40')](_0xa5d9('0x41'))[_0xa5d9('0x40')]('ListId\x20=\x20?',LISTID[_0xa5d9('0x3e')]())[_0xa5d9('0x40')](_0xa5d9('0x4d'),squel[_0xa5d9('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa5d9('0x3e')]();return _0x2c5703;}return db[_0xa5d9('0x4e')][_0xa5d9('0x4f')]({'where':{'type':'outbound'},'attributes':['id',_0xa5d9('0x50')],'include':[{'model':db[_0xa5d9('0x51')],'as':_0xa5d9('0x52'),'where':{'id':LISTID}}]})[_0xa5d9('0x2c')](function(_0xf586c6){var _0x5414c3=[];if(_0xf586c6){var _0x58867d;for(var _0x8fc864=0x0,_0x1186b9;_0x8fc864<_0xf586c6[_0xa5d9('0x18')];_0x8fc864+=0x1){_0x1186b9=_0xf586c6[_0x8fc864][_0xa5d9('0x53')]({'plain':!![]});switch(_0x1186b9['dialCheckDuplicateType']){case _0xa5d9('0x54'):_0x5414c3['push'](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x44e5c5(_0x1186b9,'VoiceQueueId'))[_0xa5d9('0x2c')](function(){})['catch'](_0x5e09b3()));break;case'onlyIfOpen':_0x5414c3[_0xa5d9('0x2d')](db[_0xa5d9('0x55')]['query'](_0x256c7b(_0x1186b9,_0xa5d9('0x57')))[_0xa5d9('0x2c')](function(){})[_0xa5d9('0x2f')](_0x5e09b3()));break;default:_0x5414c3[_0xa5d9('0x2d')](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x176f13(_0x1186b9,_0xa5d9('0x57')))[_0xa5d9('0x2c')](function(){})['catch'](_0x5e09b3()));}}}return _0x5414c3;})['all']()['then'](function(){return db[_0xa5d9('0x4e')][_0xa5d9('0x4f')]({'where':{'type':_0xa5d9('0x58')},'attributes':['id'],'include':[{'model':db[_0xa5d9('0x51')],'as':_0xa5d9('0x59'),'where':{'id':LISTID}}]})[_0xa5d9('0x2c')](function(_0x202110){var _0x121f65=[];if(_0x202110){var _0x279638;for(var _0x1a43c7=0x0,_0x58c3ed;_0x1a43c7<_0x202110[_0xa5d9('0x18')];_0x1a43c7+=0x1){_0x58c3ed=_0x202110[_0x1a43c7][_0xa5d9('0x53')]({'plain':!![]});_0x121f65[_0xa5d9('0x2d')](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x34da53(_0x58c3ed,_0xa5d9('0x57')))['then'](function(){})[_0xa5d9('0x2f')](_0x5e09b3()));}}return _0x121f65;})['all']();})['then'](function(){return db[_0xa5d9('0x5a')][_0xa5d9('0x4f')]({'attributes':['id',_0xa5d9('0x50')],'include':[{'model':db[_0xa5d9('0x51')],'as':_0xa5d9('0x52'),'where':{'id':LISTID}}]})['then'](function(_0xd38875){var _0xc62779=[];if(_0xd38875){for(var _0x4d0bce=0x0,_0x1c1a36;_0x4d0bce<_0xd38875[_0xa5d9('0x18')];_0x4d0bce+=0x1){_0x1c1a36=_0xd38875[_0x4d0bce][_0xa5d9('0x53')]({'plain':!![]});switch(_0x1c1a36[_0xa5d9('0x50')]){case _0xa5d9('0x54'):_0xc62779[_0xa5d9('0x2d')](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x44e5c5(_0x1c1a36,_0xa5d9('0x5b')))[_0xa5d9('0x2c')](function(){})[_0xa5d9('0x2f')](_0x5e09b3()));break;case'onlyIfOpen':_0xc62779[_0xa5d9('0x2d')](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x256c7b(_0x1c1a36,'CampaignId'))[_0xa5d9('0x2c')](function(){})[_0xa5d9('0x2f')](_0x5e09b3()));break;default:_0xc62779[_0xa5d9('0x2d')](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x176f13(_0x1c1a36,_0xa5d9('0x5b')))[_0xa5d9('0x2c')](function(){})['catch'](_0x5e09b3()));}}}return _0xc62779;})[_0xa5d9('0x5c')]();})[_0xa5d9('0x2c')](function(){return db[_0xa5d9('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa5d9('0x51')],'as':_0xa5d9('0x59'),'where':{'id':LISTID}}]})[_0xa5d9('0x2c')](function(_0x498735){var _0x3be7e9=[];if(_0x498735){for(var _0x23089a=0x0,_0x35a3c9;_0x23089a<_0x498735[_0xa5d9('0x18')];_0x23089a+=0x1){_0x35a3c9=_0x498735[_0x23089a][_0xa5d9('0x53')]({'plain':!![]});_0x3be7e9['push'](db[_0xa5d9('0x55')][_0xa5d9('0x56')](_0x34da53(_0x35a3c9,_0xa5d9('0x5b')))[_0xa5d9('0x2c')](function(){})['catch'](_0x5e09b3()));}}return _0x3be7e9;})[_0xa5d9('0x5c')]();})['catch'](function(_0x5a82bd){logger['error'](_0xa5d9('0x5d'),'generalCheckHopper',_0x5a82bd[_0xa5d9('0x1a')]);});}var processPromises=function(_0x39f595){return BPromise['all'](promises)['then'](function(_0x5cfd26){})['catch'](function(_0x1d8fc8){logger[_0xa5d9('0x14')](_0xa5d9('0x5e'),JSON[_0xa5d9('0x31')](_0x1d8fc8));})[_0xa5d9('0x5f')](function(){socket[_0xa5d9('0x60')](_0xa5d9('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x39f595){return _0x39f595[_0xa5d9('0x62')]();}});};var endCsv=function(){return BPromise[_0xa5d9('0x63')]()[_0xa5d9('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xa5d9('0x2c')](function(){socket[_0xa5d9('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3d3c65){logger[_0xa5d9('0x14')](_0xa5d9('0x64'),JSON[_0xa5d9('0x31')](_0x3d3c65));}finally{process['exit'](0x0);}});};process['on'](_0xa5d9('0x65'),function(){logger[_0xa5d9('0x66')](_0xa5d9('0x67'));endCsv();});function main(){return BPromise[_0xa5d9('0x63')]()[_0xa5d9('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa5d9('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x13a615){var _0x271357=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa5d9('0x68')](_0x271357,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c97ba,_0x3e557c){total+=0x1;var _0x40b452=total;promises[_0xa5d9('0x2d')](checkRow(_0x4c97ba,_0x13a615,_0x40b452)['then'](function(){success+=0x1;})[_0xa5d9('0x2f')](function(_0x88dcfa){if(_0x88dcfa[_0xa5d9('0x14')]){errors+=0x1;delete _0x88dcfa['error'];}else if(_0x88dcfa['duplicate']){duplicates+=0x1;delete _0x88dcfa[_0xa5d9('0x28')];}rows[_0xa5d9('0x2d')](_0x88dcfa);}));if(total%0xc8===0x0){_0x3e557c['pause']();return processPromises(_0x3e557c);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1897ff,_0x5dedfe){logger[_0xa5d9('0x66')](_0xa5d9('0x69'),JSON[_0xa5d9('0x31')](_0x1897ff));endCsv();}});})[_0xa5d9('0x2f')](function(_0x3897e5){logger[_0xa5d9('0x14')](_0xa5d9('0x6a'),JSON['stringify'](_0x3897e5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0bab104..b96eb3a 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 _0xad10=['error','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','query','stringify','send','binding','clone','root','server/files/tmp','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','length','push','all','then','split','isNil','filter','CmContactHasItem','findOne','update','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','into','fields','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','fromQuery','updatedAt','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','exit','errors','message','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId='];(function(_0x4f8e06,_0x3226b1){var _0x327dad=function(_0x4dced3){while(--_0x4dced3){_0x4f8e06['push'](_0x4f8e06['shift']());}};_0x327dad(++_0x3226b1);}(_0xad10,0x1b3));var _0x0ad1=function(_0x2de3e2,_0x53f692){_0x2de3e2=_0x2de3e2-0x0;var _0x7d8c06=_0xad10[_0x2de3e2];return _0x7d8c06;};'use strict';var fs=require('fs');var path=require(_0x0ad1('0x0'));var _=require(_0x0ad1('0x1'));var Papa=require(_0x0ad1('0x2'));var util=require(_0x0ad1('0x3'));var BPromise=require(_0x0ad1('0x4'));var moment=require(_0x0ad1('0x5'));var squel=require(_0x0ad1('0x6'));var Redis=require('ioredis');var db=require(_0x0ad1('0x7'))['db'];var config=require(_0x0ad1('0x8'));var shared=require(_0x0ad1('0x9'));var logger=require(_0x0ad1('0xa'))('import');config[_0x0ad1('0xb')]=_[_0x0ad1('0xc')](config[_0x0ad1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ad1('0xd'))(new Redis(config[_0x0ad1('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0ad1('0xe')](_0x0ad1('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0ad1('0xe')](_0x0ad1('0xf'));function isEmail(_0x65deff){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))*$/[_0x0ad1('0x10')](_0x65deff);}function selectNotIn(_0x4247ba,_0x212f14,_0x2bec6a,_0x5a3b89,_0x2af3f6){return squel[_0x0ad1('0x11')]()[_0x0ad1('0x12')](_0x0ad1('0x13'))[_0x0ad1('0x14')](_0x5a3b89)[_0x0ad1('0x15')](_0x212f14,null,_0x212f14+'.id\x20=\x20'+_0x5a3b89+'.'+_0x2bec6a)[_0x0ad1('0x16')](_0x5a3b89+'.'+_0x2bec6a+_0x0ad1('0x17')+_0x4247ba+'.'+_0x2bec6a)[_0x0ad1('0x16')](_0x212f14+_0x0ad1('0x18')+_0x2af3f6[_0x0ad1('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x40621d,_0x179963){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x0ad1('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x418fdf){if(_0x418fdf!==null){var _0x305e5d=[];for(var _0x2404cd=0x0;_0x2404cd<_0x418fdf[_0x0ad1('0x1a')];_0x2404cd++){var _0xa6d58b=_0x418fdf[_0x2404cd];_0x305e5d[_0x0ad1('0x1b')](insertAdditionalPhones(_0xa6d58b));}}Promise[_0x0ad1('0x1c')](_0x305e5d)[_0x0ad1('0x1d')](function(){_0x40621d({'val':0x1});});});});}function insertAdditionalPhones(_0x57ae7f){return new Promise(function(_0x4a814c,_0x52bed9){var _0x2d1b7e=_0x57ae7f[_0x0ad1('0x19')];var _0x2127d1=_0x2d1b7e[_0x0ad1('0x1e')](';');var _0x1514ca=[];orderBy=0x0;for(var _0x4bdc73=0x0;_0x4bdc73<_0x2127d1[_0x0ad1('0x1a')];_0x4bdc73++){_0x1514ca[_0x0ad1('0x1b')](splitAdditionalPhone(_0x57ae7f['id'],_0x2127d1[_0x4bdc73]));}Promise[_0x0ad1('0x1c')](_0x1514ca)[_0x0ad1('0x1d')](function(){_0x4a814c({'val':_0x2127d1[_0x0ad1('0x1a')]});});});}function splitAdditionalPhone(_0x54be41,_0x5323ad){return new Promise(function(_0x13cc63,_0x370f1b){var _0x209070=_0x5323ad[_0x0ad1('0x1e')](':');var _0x5c6240=_0x209070[0x0];var _0x404b74=_0x209070[0x1];if(!_[_0x0ad1('0x1f')](_0x404b74)){var _0x27639f=_0x404b74[_0x0ad1('0x1e')]('|');var _0x1e6db7=[];for(var _0x359ee2=0x0;_0x359ee2<_0x27639f[_0x0ad1('0x1a')];_0x359ee2++){if(_0x27639f[_0x359ee2]!==''){var _0x288ba5=_[_0x0ad1('0x20')](promisesAdditionalPhones,{'contactId':_0x54be41,'phone':_0x27639f[_0x359ee2]});if(_0x288ba5[_0x0ad1('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x0ad1('0x1b')]({'contactId':_0x54be41,'contactTypeId':_0x5c6240,'phone':_0x27639f[_0x359ee2],'orderBy':orderBy});}}}_0x13cc63({'ok':0x1});}else _0x13cc63({'res':0x0});});}function createAdditionalPhone(_0x392c37,_0x174c9d,_0x39d15b,_0x9a0156){var _0x41a701='';var _0x3fb85f='';var _0x144716=_0x39d15b[_0x0ad1('0x1e')]('§');_0x41a701=_0x144716[0x0];if(_0x144716[_0x0ad1('0x1a')]==0x2)_0x3fb85f=_0x144716[0x1];return new Promise(function(_0x1dbf4b,_0x5075b4){return db[_0x0ad1('0x21')][_0x0ad1('0x22')]({'where':{'CmContactId':_0x392c37,'item':_0x41a701}})[_0x0ad1('0x1d')](function(_0x28002b){if(_0x28002b){return db[_0x0ad1('0x21')][_0x0ad1('0x23')]({'ItemTypeId':_0x174c9d,'description':_0x3fb85f,'OrderBy':_0x9a0156},{'where':{'CmContactId':_0x392c37,'item':_0x41a701}})['then'](function(_0x2186e3){_0x1dbf4b({'res':'updated'});});}else{return db[_0x0ad1('0x21')]['create']({'CmContactId':_0x392c37,'item':_0x41a701,'description':_0x3fb85f,'ItemTypeId':_0x174c9d,'OrderBy':_0x9a0156,'ItemClass':'PHONE'})[_0x0ad1('0x1d')](function(_0x1b540b){_0x1dbf4b({'res':_0x0ad1('0x24')});});}});});}function insertCmHopper(_0x131fb3,_0x113ee1,_0x4f81b2,_0x5eca04,_0x3e8430){var _0x4c5a1a=[_0x0ad1('0x25'),_0x0ad1('0x26'),_0x0ad1('0x27'),_0x0ad1('0x28'),_0x113ee1+'.'+_0x5eca04,_0x0ad1('0x29'),_0x0ad1('0x2a'),'cm_contacts.priority',_0x0ad1('0x2b'),'\x22'+_0x3e8430+'\x22'];return squel[_0x0ad1('0x2c')]()['into'](_0x0ad1('0x2d'))['fromQuery']([_0x0ad1('0x13'),_0x0ad1('0x2e'),_0x0ad1('0x2f'),_0x0ad1('0x30'),_0x5eca04,_0x0ad1('0x31'),'updatedAt',_0x0ad1('0x32'),_0x0ad1('0x33'),_0x0ad1('0x34')],squel['select']()['fields'](_0x4c5a1a)[_0x0ad1('0x14')](_0x113ee1)['join'](_0x0ad1('0x35'),null,_0x0ad1('0x36')+_0x113ee1+_0x0ad1('0x37'))['join'](_0x4f81b2,null,_0x4f81b2+_0x0ad1('0x38')+_0x113ee1+'.'+_0x5eca04)[_0x0ad1('0x16')](_0x113ee1+_0x0ad1('0x39'),_0x131fb3)['where'](_0x0ad1('0x3a'),NOW)[_0x0ad1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x113ee1,_0x4f81b2,_0x5eca04,_0x0ad1('0x2d'),[_0x0ad1('0x3b'),_0x0ad1('0x3c')]))[_0x0ad1('0x16')](_0x0ad1('0x3d'),selectNotIn(_0x113ee1,_0x4f81b2,_0x5eca04,_0x0ad1('0x2d'),[_0x0ad1('0x3b')])))[_0x0ad1('0x3e')]();}function insertCmHopperBlack(_0x77a321,_0x1d14d8,_0x529058,_0x3d4b9f){var _0x2ed843=[_0x0ad1('0x25'),_0x0ad1('0x27'),_0x0ad1('0x28'),_0x1d14d8+'.'+_0x3d4b9f,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x0ad1('0x2c')]()[_0x0ad1('0x3f')]('cm_hopper_black')['fromQuery']([_0x0ad1('0x13'),'ContactId','ListId',_0x3d4b9f,_0x0ad1('0x31'),'updatedAt'],squel[_0x0ad1('0x11')]()[_0x0ad1('0x40')](_0x2ed843)['from'](_0x1d14d8)[_0x0ad1('0x15')](_0x0ad1('0x35'),null,_0x0ad1('0x36')+_0x1d14d8+_0x0ad1('0x37'))['join'](_0x529058,null,_0x529058+_0x0ad1('0x38')+_0x1d14d8+'.'+_0x3d4b9f)['where'](_0x1d14d8+_0x0ad1('0x39'),_0x77a321)[_0x0ad1('0x16')](_0x0ad1('0x3a'),NOW)[_0x0ad1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0ad1('0x11')]()[_0x0ad1('0x12')](_0x0ad1('0x13'))['from'](_0x0ad1('0x41'))[_0x0ad1('0x16')](_0x0ad1('0x42'),_0x77a321)[_0x0ad1('0x16')](_0x3d4b9f+'\x20=\x20'+_0x1d14d8+'.'+_0x3d4b9f)))[_0x0ad1('0x3e')]();}function insertTzCmHopper(_0x23cf85,_0x286afb,_0x387b47,_0x5a4396,_0x50bf18,_0x57d26b){var _0x46bbeb=['cm_contacts.phone',_0x0ad1('0x43')+_0x57d26b+_0x0ad1('0x44'),_0x0ad1('0x27'),_0x0ad1('0x28'),_0x286afb+'.'+_0x5a4396,_0x0ad1('0x29'),_0x0ad1('0x2a'),_0x0ad1('0x45'),_0x0ad1('0x2b'),'\x22'+_0x50bf18+'\x22'];var _0x339e5a=squel[_0x0ad1('0x2c')]()[_0x0ad1('0x3f')](_0x0ad1('0x2d'))[_0x0ad1('0x46')]([_0x0ad1('0x13'),_0x0ad1('0x2e'),_0x0ad1('0x2f'),_0x0ad1('0x30'),_0x5a4396,_0x0ad1('0x31'),_0x0ad1('0x47'),_0x0ad1('0x32'),_0x0ad1('0x33'),_0x0ad1('0x34')],squel[_0x0ad1('0x11')]()[_0x0ad1('0x40')](_0x46bbeb)[_0x0ad1('0x14')](_0x286afb)[_0x0ad1('0x15')](_0x0ad1('0x35'),null,_0x0ad1('0x36')+_0x286afb+_0x0ad1('0x37'))[_0x0ad1('0x15')](_0x387b47,null,_0x387b47+_0x0ad1('0x38')+_0x286afb+'.'+_0x5a4396)['join'](_0x57d26b,null,_0x57d26b+_0x0ad1('0x38')+_0x286afb+'.'+_0x5a4396)[_0x0ad1('0x16')](_0x286afb+_0x0ad1('0x39'),_0x23cf85)[_0x0ad1('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0ad1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x286afb,_0x387b47,_0x5a4396,_0x0ad1('0x2d'),[_0x0ad1('0x3b'),_0x0ad1('0x3c')]))['where'](_0x0ad1('0x3d'),selectNotIn(_0x286afb,_0x387b47,_0x5a4396,_0x0ad1('0x2d'),[_0x0ad1('0x3b')])))[_0x0ad1('0x3e')]();return _0x339e5a;}function insertTzCmHopperBlack(_0x277e3d,_0x5453e4,_0x15f888,_0x204557){var _0x2fac00=[_0x0ad1('0x25'),'cm_contacts.id',_0x0ad1('0x28'),_0x5453e4+'.'+_0x204557,'cm_contacts.createdAt',_0x0ad1('0x2a')];return squel['insert']()[_0x0ad1('0x3f')](_0x0ad1('0x41'))[_0x0ad1('0x46')]([_0x0ad1('0x13'),_0x0ad1('0x2f'),_0x0ad1('0x30'),_0x204557,_0x0ad1('0x31'),_0x0ad1('0x47')],squel[_0x0ad1('0x11')]()[_0x0ad1('0x40')](_0x2fac00)[_0x0ad1('0x14')](_0x5453e4)[_0x0ad1('0x15')](_0x0ad1('0x35'),null,_0x0ad1('0x36')+_0x5453e4+_0x0ad1('0x37'))[_0x0ad1('0x15')](_0x15f888,null,_0x15f888+'.id\x20=\x20'+_0x5453e4+'.'+_0x204557)[_0x0ad1('0x16')](_0x5453e4+_0x0ad1('0x39'),_0x277e3d)[_0x0ad1('0x16')](_0x0ad1('0x3a'),NOW)[_0x0ad1('0x16')](_0x0ad1('0x3d'),squel['select']()[_0x0ad1('0x12')](_0x0ad1('0x13'))[_0x0ad1('0x14')](_0x0ad1('0x41'))[_0x0ad1('0x16')](_0x0ad1('0x42'),_0x277e3d)[_0x0ad1('0x16')](_0x204557+_0x0ad1('0x17')+_0x5453e4+'.'+_0x204557)))[_0x0ad1('0x3e')]();}function insertCmHopperAdditionalPhones(_0x56cc56){var _0x4f9ac6=['cm_hopper.id',_0x0ad1('0x48'),_0x0ad1('0x49'),'cm_contact_has_items.createdAt',_0x0ad1('0x4a')];return squel[_0x0ad1('0x2c')]()['into'](_0x0ad1('0x4b'))['fromQuery']([_0x0ad1('0x4c'),'phone',_0x0ad1('0x4d'),_0x0ad1('0x31'),_0x0ad1('0x47')],squel[_0x0ad1('0x11')]()['fields'](_0x4f9ac6)[_0x0ad1('0x14')]('cm_hopper')[_0x0ad1('0x15')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x0ad1('0x4e'),null,_0x0ad1('0x4f'))[_0x0ad1('0x16')](_0x0ad1('0x50'),_0x56cc56)[_0x0ad1('0x16')](_0x0ad1('0x3a'),NOW))[_0x0ad1('0x3e')]();}function insertCmContact(_0x4f15e5,_0x4e1853,_0x57890b,_0x56dadb){var _0x385a0f=_[_0x0ad1('0x51')](_[_0x0ad1('0x52')](_0x56dadb),[_0x0ad1('0x30'),_0x0ad1('0x53'),_0x0ad1('0x31'),'updatedAt']);return squel[_0x0ad1('0x2c')]()[_0x0ad1('0x3f')](_0x0ad1('0x35'))[_0x0ad1('0x46')](_0x385a0f,squel['select']()[_0x0ad1('0x40')](_0x385a0f)[_0x0ad1('0x14')](_0x4e1853)[_0x0ad1('0x16')]('('+_0x57890b[_0x0ad1('0x15')](',')+_0x0ad1('0x54'),squel[_0x0ad1('0x11')]()[_0x0ad1('0x40')](_0x57890b)[_0x0ad1('0x14')](_0x0ad1('0x35'))[_0x0ad1('0x16')](_0x0ad1('0x42'),_0x4f15e5)[_0x0ad1('0x16')](_0x0ad1('0x55')))[_0x0ad1('0x16')](_0x0ad1('0x56'),squel[_0x0ad1('0x11')]()[_0x0ad1('0x12')](_0x0ad1('0x57'),'min_id')[_0x0ad1('0x14')](_0x4e1853)[_0x0ad1('0x58')](_0x57890b[_0x0ad1('0x15')](','))))['toString']();}function handleStop(){logger[_0x0ad1('0x59')](_0x0ad1('0x5a'));stopped=!![];}function handleUncaughtException(_0x61a128){logger['error'](_0x61a128['message']);process[_0x0ad1('0x5b')](0x1);}function handleError(_0x5f08d3,_0xca00bb){stats[_0x0ad1('0x5c')]['push']({'name':_0xca00bb['code'],'message':_0xca00bb[_0x0ad1('0x5d')],'row':_0x5f08d3});}function handleQuery(_0xd7ed9){logger[_0x0ad1('0x59')](_0xd7ed9);return db[_0x0ad1('0x5e')]['query'](_0xd7ed9)[_0x0ad1('0x5f')](function(_0x30d76f){results[_0x0ad1('0x1b')](_0x30d76f);})[_0x0ad1('0x60')](function(_0xae9c66){logger['error'](_0xae9c66[_0x0ad1('0x5d')]);});}function updateTzCampaigns(_0x47b10f){return new Promise(function(_0xd36539,_0x4226af){var _0x18b313=squel[_0x0ad1('0x11')]()[_0x0ad1('0x40')]([_0x0ad1('0x61'),_0x0ad1('0x62')])[_0x0ad1('0x14')](_0x0ad1('0x63'))[_0x0ad1('0x15')]('campaigns_has_cm_lists',null,_0x0ad1('0x64'))['where'](_0x0ad1('0x65')+_0x47b10f);db[_0x0ad1('0x5e')]['query'](_0x18b313[_0x0ad1('0x3e')]())['spread'](function(_0x16be0c){var _0x43bfba=[];for(var _0x46c235=0x0;_0x46c235<_0x16be0c[_0x0ad1('0x1a')];_0x46c235++){_0x43bfba[_0x0ad1('0x1b')](getTimezoneData(_0x16be0c[_0x46c235],tmp_campaigns));}BPromise['all'](_0x43bfba)[_0x0ad1('0x1d')](function(){_0xd36539({'val':0x1});});})[_0x0ad1('0x60')](function(_0x4f51bb){logger[_0x0ad1('0x66')](_0x4f51bb[_0x0ad1('0x5d')]);_0xd36539({'val':0x0});});});}function updateTzVoiceQueues(_0x420d91){return new Promise(function(_0x3223fc,_0x5859c9){var _0x5caad6=squel[_0x0ad1('0x11')]()['fields']([_0x0ad1('0x67'),'voice_queues.dialTimezone'])[_0x0ad1('0x14')](_0x0ad1('0x68'))[_0x0ad1('0x15')](_0x0ad1('0x69'),null,_0x0ad1('0x6a'))[_0x0ad1('0x16')](_0x0ad1('0x6b')+_0x420d91);db['sequelize']['query'](_0x5caad6[_0x0ad1('0x3e')]())[_0x0ad1('0x5f')](function(_0x5e2dd0){var _0x4524de=[];for(var _0x233b08=0x0;_0x233b08<_0x5e2dd0[_0x0ad1('0x1a')];_0x233b08++){_0x4524de[_0x0ad1('0x1b')](getTimezoneData(_0x5e2dd0[_0x233b08],tmp_voice_queues));}BPromise[_0x0ad1('0x1c')](_0x4524de)[_0x0ad1('0x1d')](function(){_0x3223fc({'val':0x1});});})[_0x0ad1('0x60')](function(_0x159f5a){logger[_0x0ad1('0x66')](_0x159f5a[_0x0ad1('0x5d')]);_0x3223fc({'val':0x0});});});}function getTimezoneData(_0x231a0a,_0x1f2361){return new Promise(function(_0x1ac5c4,_0x3cd6a2){var _0xa566dd=shared[_0x0ad1('0x6c')];var _0x5df3ff=_0xa566dd[_0x231a0a[_0x0ad1('0x6d')]];if(_[_0x0ad1('0x1f')](_0x5df3ff)){_0x1ac5c4({'ret':0x1});}else{var _0x150df4=_0x5df3ff[_0x0ad1('0x6e')];var _0x484597=squel['insert']()[_0x0ad1('0x3f')](_0x1f2361)[_0x0ad1('0x6f')]('id',_0x231a0a['id'])[_0x0ad1('0x6f')]('offset',_0x150df4)[_0x0ad1('0x6f')](_0x0ad1('0x6d'),_0x231a0a['dialTimezone'])[_0x0ad1('0x3e')]();return db[_0x0ad1('0x5e')][_0x0ad1('0x70')](_0x484597)['spread'](function(_0x516095){_0x1ac5c4({'ret':0x1});})[_0x0ad1('0x60')](function(_0x17ce0e){logger[_0x0ad1('0x66')](_0x17ce0e[_0x0ad1('0x5d')]);_0x3cd6a2({'ret':0x1});});}});}function handleTZQuery(_0x5b166a){logger[_0x0ad1('0x59')](_0x5b166a);return db[_0x0ad1('0x5e')][_0x0ad1('0x70')](_0x5b166a)[_0x0ad1('0x5f')](function(_0x393a5){})[_0x0ad1('0x60')](function(_0x2c11b5){logger['error'](_0x2c11b5[_0x0ad1('0x5d')]);});}function main(_0x31e3ea,_0x10c8e6,_0x24b17a,_0x5cd267){logger[_0x0ad1('0x59')]('main',_0x31e3ea,JSON[_0x0ad1('0x71')](_0x10c8e6));process[_0x0ad1('0x72')]('start');var _0x12bf04=_0x10c8e6[_0x0ad1('0x73')];var _0x1bde32=_[_0x0ad1('0x74')](_0x12bf04);var _0x1d98f4=_0x10c8e6['socket_timestamp'];var _0x4b8f0f=path['join'](config[_0x0ad1('0x75')],_0x0ad1('0x76'),_0x1d98f4+'.csv');hasTZ=_[_0x0ad1('0x52')](_0x12bf04)['includes'](_0x0ad1('0x6d'));var _0x279ec3=_[_0x0ad1('0x52')](_0x12bf04)[_0x0ad1('0x15')]();logger[_0x0ad1('0x59')](_0x0ad1('0x77'),_0x279ec3);db[_0x0ad1('0x78')]['findAll']({'raw':!![],'attributes':['id',_0x0ad1('0x79')]})[_0x0ad1('0x1d')](function(_0x414b08){for(var _0x1a9324=0x0;_0x1a9324<_0x414b08['length'];_0x1a9324++){if(_0x414b08[_0x1a9324][_0x0ad1('0x79')]in _0x12bf04){contactItemTypes[_0x0ad1('0x1b')](_0x414b08[_0x1a9324]);delete _0x1bde32[_0x414b08[_0x1a9324][_0x0ad1('0x79')]];hasAdditionalPhones=!![];}for(var _0x46ea32 in _0x12bf04){if(_0x414b08[_0x1a9324]['name']+_0x0ad1('0x7a')===_0x46ea32){phoneDescriptions[_0x0ad1('0x1b')]({'itemTypeId':_0x414b08[_0x1a9324]['id'],'description':_0x46ea32});delete _0x1bde32[_0x46ea32];}}}if(hasAdditionalPhones)_0x1bde32[_0x0ad1('0x19')]='';var _0x4c84b5=_[_0x0ad1('0x52')](_0x1bde32)['join']();logger['info'](_0x0ad1('0x77'),_0x4c84b5);fs[_0x0ad1('0x7b')](_0x4b8f0f,_0x4c84b5+'\x0a');Papa[_0x0ad1('0x7c')](fs[_0x0ad1('0x7d')](_0x31e3ea),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c0259,_0x445ef8){try{for(var _0x46ed36=0x0,_0x45e775=[];_0x46ed36<_0x5c0259[_0x0ad1('0x7e')][_0x0ad1('0x1a')];_0x46ed36++){stats[_0x0ad1('0x7f')]+=0x1;if(_0x5c0259[_0x0ad1('0x5c')][_0x46ed36]){handleError(_0x5c0259[_0x0ad1('0x7e')][_0x46ed36],_0x5c0259[_0x0ad1('0x5c')][_0x46ed36]);}else{var _0x1f517b=[];var _0x521d57=[];var _0x5b130a={};for(var _0x51f6bc in _0x12bf04){let _0x489693=contactItemTypes[_0x0ad1('0x80')](_0x32dc07=>_0x32dc07[_0x0ad1('0x79')]===_0x51f6bc);let _0x4ba0d4=contactItemTypes[_0x0ad1('0x80')](_0x304383=>_0x304383[_0x0ad1('0x79')]+_0x0ad1('0x7a')===_0x51f6bc);if(_[_0x0ad1('0x1f')](_0x489693)&&_[_0x0ad1('0x1f')](_0x4ba0d4)){if(_0x12bf04[_0x0ad1('0x81')](_0x51f6bc)){if(_0x5c0259[_0x0ad1('0x7e')][_0x46ed36][_0x12bf04[_0x51f6bc]]){var _0x27568a=_[_0x0ad1('0x82')](_0x5c0259[_0x0ad1('0x7e')][_0x46ed36][_0x12bf04[_0x51f6bc]][_0x0ad1('0x83')](/"/g,'\x27'));switch(_0x51f6bc){case _0x0ad1('0x2e'):var _0x54e3bf=moment(_0x27568a,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x54e3bf[_0x0ad1('0x84')]()){_0x45e775['push']('\x22'+_0x27568a+'\x22');}else{_0x1f517b['push'](_0x0ad1('0x85'));}break;case _0x0ad1('0x32'):var _0x1027a1=parseInt(_0x27568a);_0x27568a=_['isNaN'](_0x1027a1)||_0x1027a1<0x0||_0x1027a1>0x4?_0x5cd267?0x3:0x2:_0x1027a1;_0x45e775['push']('\x22'+_0x27568a+'\x22');break;case _0x0ad1('0x33'):var _0x448442=parseInt(_0x27568a);if(_[_0x0ad1('0x86')](_0x448442)&&_[_0x0ad1('0x87')](_0x24b17a,_0x448442)){_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x448442+'\x22');}else{_0x1f517b[_0x0ad1('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x27568a)){_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x27568a+'\x22');}else{_0x1f517b[_0x0ad1('0x1b')](_0x0ad1('0x88'));}break;case _0x0ad1('0x89'):var _0x575356=moment(_0x27568a,_0x0ad1('0x8a'),!![]);if(_0x575356['isValid']()){_0x45e775['push']('\x22'+_0x27568a+'\x22');}else{_0x1f517b['push'](_0x0ad1('0x8b'));}break;case _0x0ad1('0x6d'):var _0x4ea8c4=shared[_0x0ad1('0x6c')];var _0x27b422=_0x4ea8c4[_0x27568a];if(!_[_0x0ad1('0x1f')](_0x27b422)){var _0x52f503=_0x27b422[_0x0ad1('0x6e')];_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x27568a+'\x22');_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x52f503+'\x22');}break;default:_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x27568a+'\x22');}}else{switch(_0x51f6bc){case _0x0ad1('0x8c'):case'phone':_0x1f517b[_0x0ad1('0x1b')](_0x51f6bc+_0x0ad1('0x8d'));break;default:_0x45e775[_0x0ad1('0x1b')]('\x22\x22');}}}}else{var _0x250c93='';if(!_[_0x0ad1('0x1f')](_0x489693)){if(!_0x5b130a['hasOwnProperty'](_0x489693['id'])){if(!_[_0x0ad1('0x1f')](_0x5c0259['data'][_0x46ed36][_0x12bf04[_0x51f6bc]])){var _0x27568a=_['trim'](_0x5c0259[_0x0ad1('0x7e')][_0x46ed36][_0x12bf04[_0x51f6bc]][_0x0ad1('0x83')](/"/g,'\x27'));var _0x3e8801=phoneDescriptions[_0x0ad1('0x80')](_0x2e2ecb=>_0x2e2ecb['itemTypeId']===_0x489693['id']);if(!_[_0x0ad1('0x1f')](_0x3e8801)){var _0x35e341=_[_0x0ad1('0x82')](_0x5c0259['data'][_0x46ed36][_0x12bf04[_0x3e8801[_0x0ad1('0x8e')]]][_0x0ad1('0x83')](/"/g,'\x27'));if(!_[_0x0ad1('0x1f')](_0x35e341))_0x27568a=_0x27568a+'§'+_0x35e341;}if(_0x250c93=='')_0x250c93=_0x27568a;else _0x250c93+='|'+_0x27568a;}_0x521d57['push'](_0x489693['id']+':'+_0x250c93);_0x5b130a[_0x489693['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45e775[_0x0ad1('0x1b')]('\x22'+_0x521d57['join'](';')+'\x22');}if(_0x1f517b[_0x0ad1('0x1a')]){handleError(_0x5c0259[_0x0ad1('0x7e')][_0x46ed36],{'code':'SystemRow','message':_0x1f517b['join']()});}else{fs[_0x0ad1('0x8f')](_0x4b8f0f,_0x45e775[_0x0ad1('0x15')]()+'\x0a');}_0x45e775=[];}if(!(stats[_0x0ad1('0x7f')]%0xc8)){socket[_0x0ad1('0x90')](_0x0ad1('0x91')+_0x1d98f4,stats);stats[_0x0ad1('0x5c')]=[];}}if(stopped){logger[_0x0ad1('0x59')](_0x0ad1('0x92'));_0x445ef8[_0x0ad1('0x93')]();}}catch(_0x1f16b3){handleError(_0x5c0259['data'][_0x46ed36],{'code':'SystemError','message':_0x1f16b3[_0x0ad1('0x5d')]});logger[_0x0ad1('0x66')](_0x0ad1('0x94'),_0x1f16b3[_0x0ad1('0x5d')]);}},'complete':function(){try{var _0x3820ac=[];var _0x5e74b2=[];var _0x5054aa=_0x0ad1('0x35');if(_0x10c8e6[_0x0ad1('0x95')]&&_0x10c8e6[_0x0ad1('0x95')][_0x0ad1('0x1a')]){_0x5054aa=_0x0ad1('0x96')+_0x1d98f4;_0x3820ac[_0x0ad1('0x1b')](_0x0ad1('0x97')+_0x5054aa+_0x0ad1('0x98'));}tmp_campaigns=_0x0ad1('0x99')+_0x1d98f4;tmp_voice_queues='voice_queues_'+_0x1d98f4;_0x5e74b2['push'](_0x0ad1('0x97')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x5e74b2[_0x0ad1('0x1b')](_0x0ad1('0x97')+tmp_voice_queues+_0x0ad1('0x9a'));BPromise[_0x0ad1('0x9b')](_0x5e74b2,handleTZQuery)[_0x0ad1('0x1d')](function(_0x2c53d7){updateTzCampaigns(_0x10c8e6[_0x0ad1('0x30')])[_0x0ad1('0x1d')](function(_0x49f274){updateTzVoiceQueues(_0x10c8e6[_0x0ad1('0x30')])['then'](function(_0x21c8ea){if(hasTZ)_0x4c84b5=_0x4c84b5[_0x0ad1('0x83')](_0x0ad1('0x6d'),'dialTimezone,utcOffset');var _0x4fbea7=util[_0x0ad1('0xe')]('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',_0x4b8f0f,_0x5054aa,_0x4c84b5,_0x10c8e6['ListId'],_0x10c8e6['CompanyId']||null,NOW,NOW);if(_[_0x0ad1('0x1f')](_0x12bf04[_0x0ad1('0x2e')])){_0x4fbea7+=_0x0ad1('0x9c');}_0x3820ac[_0x0ad1('0x1b')](_0x4fbea7);if(_0x10c8e6[_0x0ad1('0x95')]&&_0x10c8e6[_0x0ad1('0x95')][_0x0ad1('0x1a')]){_0x3820ac[_0x0ad1('0x1b')](insertCmContact(_0x10c8e6[_0x0ad1('0x30')],_0x5054aa,_0x10c8e6[_0x0ad1('0x95')],_0x12bf04));_0x3820ac[_0x0ad1('0x1b')](_0x0ad1('0x9d')+_0x5054aa+';');}BPromise['each'](_0x3820ac,handleQuery)['then'](function(_0x419126){BPromise['all']([handleAdditionalPhones()])[_0x0ad1('0x1d')](function(){_0x3820ac=[];for(var _0x1a3503=0x0;_0x1a3503\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0xbffd7e,_0x39b45b){var _0x33566c=function(_0x165b19){while(--_0x165b19){_0xbffd7e['push'](_0xbffd7e['shift']());}};_0x33566c(++_0x39b45b);}(_0x9de8,0x88));var _0x89de=function(_0x5460dd,_0x52aa9a){_0x5460dd=_0x5460dd-0x0;var _0x42336d=_0x9de8[_0x5460dd];return _0x42336d;};'use strict';var fs=require('fs');var path=require(_0x89de('0x0'));var _=require('lodash');var Papa=require(_0x89de('0x1'));var util=require(_0x89de('0x2'));var BPromise=require('bluebird');var moment=require(_0x89de('0x3'));var squel=require(_0x89de('0x4'));var Redis=require(_0x89de('0x5'));var db=require(_0x89de('0x6'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x89de('0x7'))('import');config['redis']=_['defaults'](config[_0x89de('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x89de('0x9'))(new Redis(config[_0x89de('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x89de('0xa')](_0x89de('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x89de('0xb'));function isEmail(_0x268a5e){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))*$/[_0x89de('0xc')](_0x268a5e);}function selectNotIn(_0x473563,_0x3831ff,_0x44c774,_0x3d2da6,_0x32c82a){return squel[_0x89de('0xd')]()[_0x89de('0xe')](_0x89de('0xf'))[_0x89de('0x10')](_0x3d2da6)[_0x89de('0x11')](_0x3831ff,null,_0x3831ff+_0x89de('0x12')+_0x3d2da6+'.'+_0x44c774)['where'](_0x3d2da6+'.'+_0x44c774+_0x89de('0x13')+_0x473563+'.'+_0x44c774)['where'](_0x3831ff+_0x89de('0x14')+_0x32c82a['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x186e72,_0x4752dc){promisesAdditionalPhones=[];return db[_0x89de('0x15')][_0x89de('0x16')]({'raw':!![],'attributes':['id',_0x89de('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x89de('0x18')](function(_0x2ccade){if(_0x2ccade!==null){var _0x222787=[];for(var _0x5860a1=0x0;_0x5860a1<_0x2ccade[_0x89de('0x19')];_0x5860a1++){var _0x47ddb3=_0x2ccade[_0x5860a1];_0x222787[_0x89de('0x1a')](insertAdditionalPhones(_0x47ddb3));}}Promise[_0x89de('0x1b')](_0x222787)['then'](function(){_0x186e72({'val':0x1});});});});}function insertAdditionalPhones(_0x5773b3){return new Promise(function(_0x4980c2,_0x4cd491){var _0x272210=_0x5773b3[_0x89de('0x17')];var _0x498670=_0x272210[_0x89de('0x1c')](';');var _0xc5d56d=[];orderBy=0x0;for(var _0x226008=0x0;_0x226008<_0x498670[_0x89de('0x19')];_0x226008++){_0xc5d56d[_0x89de('0x1a')](splitAdditionalPhone(_0x5773b3['id'],_0x498670[_0x226008]));}Promise['all'](_0xc5d56d)[_0x89de('0x18')](function(){_0x4980c2({'val':_0x498670['length']});});});}function splitAdditionalPhone(_0x7b69d,_0x46e33){return new Promise(function(_0x2c7594,_0x2dba2e){var _0x280322=_0x46e33[_0x89de('0x1c')](':');var _0x4dec81=_0x280322[0x0];var _0x3342c3=_0x280322[0x1];if(!_[_0x89de('0x1d')](_0x3342c3)){var _0x1361a0=_0x3342c3[_0x89de('0x1c')]('|');var _0xde6a36=[];for(var _0x4d9893=0x0;_0x4d9893<_0x1361a0[_0x89de('0x19')];_0x4d9893++){if(_0x1361a0[_0x4d9893]!==''){var _0x23f69e=_[_0x89de('0x1e')](promisesAdditionalPhones,{'contactId':_0x7b69d,'phone':_0x1361a0[_0x4d9893]});if(_0x23f69e[_0x89de('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x89de('0x1a')]({'contactId':_0x7b69d,'contactTypeId':_0x4dec81,'phone':_0x1361a0[_0x4d9893],'orderBy':orderBy});}}}_0x2c7594({'ok':0x1});}else _0x2c7594({'res':0x0});});}function createAdditionalPhone(_0x313794,_0x44ab19,_0xbf4e4c,_0x42b95a){var _0x1393a6='';var _0xb68947='';var _0x1abba7=_0xbf4e4c[_0x89de('0x1c')]('§');_0x1393a6=_0x1abba7[0x0];if(_0x1abba7[_0x89de('0x19')]==0x2)_0xb68947=_0x1abba7[0x1];return new Promise(function(_0x38efe7,_0x218ec7){return db[_0x89de('0x1f')][_0x89de('0x20')]({'where':{'CmContactId':_0x313794,'item':_0x1393a6}})[_0x89de('0x18')](function(_0x540b8c){if(_0x540b8c){return db[_0x89de('0x1f')]['update']({'ItemTypeId':_0x44ab19,'description':_0xb68947,'OrderBy':_0x42b95a},{'where':{'CmContactId':_0x313794,'item':_0x1393a6}})[_0x89de('0x18')](function(_0x1b331e){_0x38efe7({'res':_0x89de('0x21')});});}else{return db['CmContactHasItem'][_0x89de('0x22')]({'CmContactId':_0x313794,'item':_0x1393a6,'description':_0xb68947,'ItemTypeId':_0x44ab19,'OrderBy':_0x42b95a,'ItemClass':_0x89de('0x23')})['then'](function(_0x2ac2fb){_0x38efe7({'res':'inserted'});});}});});}function insertCmHopper(_0x3e1de5,_0x176cfb,_0x4445ff,_0x522980,_0x3d7c20){var _0x1cdf13=[_0x89de('0x24'),_0x89de('0x25'),_0x89de('0x26'),_0x89de('0x27'),_0x176cfb+'.'+_0x522980,_0x89de('0x28'),_0x89de('0x29'),'cm_contacts.priority',_0x89de('0x2a'),'\x22'+_0x3d7c20+'\x22'];return squel[_0x89de('0x2b')]()['into'](_0x89de('0x2c'))[_0x89de('0x2d')](['phone',_0x89de('0x2e'),_0x89de('0x2f'),_0x89de('0x30'),_0x522980,_0x89de('0x31'),_0x89de('0x32'),_0x89de('0x33'),_0x89de('0x34'),_0x89de('0x35')],squel[_0x89de('0xd')]()['fields'](_0x1cdf13)['from'](_0x176cfb)['join'](_0x89de('0x36'),null,_0x89de('0x37')+_0x176cfb+_0x89de('0x38'))[_0x89de('0x11')](_0x4445ff,null,_0x4445ff+_0x89de('0x12')+_0x176cfb+'.'+_0x522980)[_0x89de('0x39')](_0x176cfb+_0x89de('0x3a'),_0x3e1de5)[_0x89de('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x176cfb,_0x4445ff,_0x522980,'cm_hopper',[_0x89de('0x3b'),'\x22onlyIfOpen\x22']))['where'](_0x89de('0x3c'),selectNotIn(_0x176cfb,_0x4445ff,_0x522980,_0x89de('0x2c'),[_0x89de('0x3b')])))[_0x89de('0x3d')]();}function insertCmHopperBlack(_0x529188,_0x4bda31,_0x50190b,_0x26cafa){var _0x36207c=[_0x89de('0x24'),_0x89de('0x26'),'cm_contacts.ListId',_0x4bda31+'.'+_0x26cafa,_0x89de('0x28'),_0x89de('0x29')];return squel[_0x89de('0x2b')]()[_0x89de('0x3e')](_0x89de('0x3f'))['fromQuery']([_0x89de('0xf'),_0x89de('0x2f'),'ListId',_0x26cafa,'createdAt',_0x89de('0x32')],squel[_0x89de('0xd')]()['fields'](_0x36207c)[_0x89de('0x10')](_0x4bda31)[_0x89de('0x11')](_0x89de('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x4bda31+_0x89de('0x38'))['join'](_0x50190b,null,_0x50190b+'.id\x20=\x20'+_0x4bda31+'.'+_0x26cafa)[_0x89de('0x39')](_0x4bda31+_0x89de('0x3a'),_0x529188)['where'](_0x89de('0x40'),NOW)[_0x89de('0x39')](_0x89de('0x3c'),squel['select']()[_0x89de('0xe')](_0x89de('0xf'))['from'](_0x89de('0x3f'))[_0x89de('0x39')](_0x89de('0x41'),_0x529188)[_0x89de('0x39')](_0x26cafa+_0x89de('0x13')+_0x4bda31+'.'+_0x26cafa)))[_0x89de('0x3d')]();}function insertTzCmHopper(_0x220571,_0x3e5299,_0x48f1f9,_0xc8344f,_0x24e405,_0x3425db){var _0x37c167=[_0x89de('0x24'),_0x89de('0x42')+_0x3425db+'.offset-cm_contacts.utcOffset\x20minute)',_0x89de('0x26'),'cm_contacts.ListId',_0x3e5299+'.'+_0xc8344f,_0x89de('0x28'),_0x89de('0x29'),_0x89de('0x43'),'cm_contacts.UserId','\x22'+_0x24e405+'\x22'];var _0x1ea886=squel[_0x89de('0x2b')]()['into'](_0x89de('0x2c'))['fromQuery']([_0x89de('0xf'),_0x89de('0x2e'),_0x89de('0x2f'),_0x89de('0x30'),_0xc8344f,_0x89de('0x31'),_0x89de('0x32'),_0x89de('0x33'),_0x89de('0x34'),_0x89de('0x35')],squel['select']()['fields'](_0x37c167)[_0x89de('0x10')](_0x3e5299)[_0x89de('0x11')](_0x89de('0x36'),null,_0x89de('0x37')+_0x3e5299+'.CmListId')[_0x89de('0x11')](_0x48f1f9,null,_0x48f1f9+_0x89de('0x12')+_0x3e5299+'.'+_0xc8344f)[_0x89de('0x11')](_0x3425db,null,_0x3425db+'.id\x20=\x20'+_0x3e5299+'.'+_0xc8344f)['where'](_0x3e5299+'.CmListId\x20=\x20?',_0x220571)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x89de('0x39')](_0x89de('0x3c'),selectNotIn(_0x3e5299,_0x48f1f9,_0xc8344f,_0x89de('0x2c'),[_0x89de('0x3b'),_0x89de('0x44')]))[_0x89de('0x39')](_0x89de('0x3c'),selectNotIn(_0x3e5299,_0x48f1f9,_0xc8344f,_0x89de('0x2c'),['\x22always\x22'])))[_0x89de('0x3d')]();return _0x1ea886;}function insertTzCmHopperBlack(_0x12fa69,_0x36e759,_0x1c401e,_0x3e32b3){var _0x2a96c4=[_0x89de('0x24'),_0x89de('0x26'),_0x89de('0x27'),_0x36e759+'.'+_0x3e32b3,_0x89de('0x28'),_0x89de('0x29')];return squel[_0x89de('0x2b')]()[_0x89de('0x3e')](_0x89de('0x3f'))[_0x89de('0x2d')](['phone',_0x89de('0x2f'),_0x89de('0x30'),_0x3e32b3,_0x89de('0x31'),_0x89de('0x32')],squel[_0x89de('0xd')]()[_0x89de('0x45')](_0x2a96c4)[_0x89de('0x10')](_0x36e759)[_0x89de('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x36e759+_0x89de('0x38'))[_0x89de('0x11')](_0x1c401e,null,_0x1c401e+_0x89de('0x12')+_0x36e759+'.'+_0x3e32b3)['where'](_0x36e759+_0x89de('0x3a'),_0x12fa69)[_0x89de('0x39')](_0x89de('0x40'),NOW)[_0x89de('0x39')](_0x89de('0x3c'),squel[_0x89de('0xd')]()[_0x89de('0xe')](_0x89de('0xf'))[_0x89de('0x10')](_0x89de('0x3f'))['where'](_0x89de('0x41'),_0x12fa69)[_0x89de('0x39')](_0x3e32b3+_0x89de('0x13')+_0x36e759+'.'+_0x3e32b3)))[_0x89de('0x3d')]();}function insertCmHopperAdditionalPhones(_0x5bd1d4){var _0x44166e=[_0x89de('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x89de('0x47'),_0x89de('0x48')];return squel[_0x89de('0x2b')]()['into'](_0x89de('0x49'))[_0x89de('0x2d')]([_0x89de('0x4a'),'phone','OrderBy','createdAt',_0x89de('0x32')],squel[_0x89de('0xd')]()[_0x89de('0x45')](_0x44166e)[_0x89de('0x10')](_0x89de('0x2c'))['join'](_0x89de('0x36'),null,_0x89de('0x4b'))[_0x89de('0x11')]('cm_contact_has_items',null,_0x89de('0x4c'))['where'](_0x89de('0x4d'),_0x5bd1d4)[_0x89de('0x39')](_0x89de('0x40'),NOW))['toString']();}function insertCmContact(_0x3659ab,_0x303e1f,_0x1e1a8c,_0x5b44ab){var _0x2e5b1d=_[_0x89de('0x4e')](_['keys'](_0x5b44ab),['ListId','CompanyId','createdAt',_0x89de('0x32')]);return squel[_0x89de('0x2b')]()[_0x89de('0x3e')](_0x89de('0x36'))[_0x89de('0x2d')](_0x2e5b1d,squel[_0x89de('0xd')]()[_0x89de('0x45')](_0x2e5b1d)['from'](_0x303e1f)['where']('('+_0x1e1a8c[_0x89de('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x89de('0xd')]()[_0x89de('0x45')](_0x1e1a8c)[_0x89de('0x10')](_0x89de('0x36'))[_0x89de('0x39')]('ListId\x20=\x20?',_0x3659ab)['where']('deletedAt\x20IS\x20NULL'))['where'](_0x89de('0x4f'),squel['select']()[_0x89de('0xe')]('MIN(id)',_0x89de('0x50'))[_0x89de('0x10')](_0x303e1f)['group'](_0x1e1a8c['join'](','))))['toString']();}function handleStop(){logger[_0x89de('0x51')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3c7b7b){logger[_0x89de('0x52')](_0x3c7b7b[_0x89de('0x53')]);process[_0x89de('0x54')](0x1);}function handleError(_0x158eb6,_0x3a66bc){stats['errors'][_0x89de('0x1a')]({'name':_0x3a66bc[_0x89de('0x55')],'message':_0x3a66bc[_0x89de('0x53')],'row':_0x158eb6});}function handleQuery(_0x289640){logger['info'](_0x289640);return db[_0x89de('0x56')][_0x89de('0x57')](_0x289640)[_0x89de('0x58')](function(_0x57ff71){results[_0x89de('0x1a')](_0x57ff71);})['catch'](function(_0x4bfeb9){logger[_0x89de('0x52')](_0x4bfeb9[_0x89de('0x53')]);});}function updateTzCampaigns(_0x568546){return new Promise(function(_0x49f692,_0x277b34){var _0x2976a5=squel[_0x89de('0xd')]()[_0x89de('0x45')](['campaigns.id',_0x89de('0x59')])['from'](_0x89de('0x5a'))[_0x89de('0x11')](_0x89de('0x5b'),null,_0x89de('0x5c'))[_0x89de('0x39')]('campaigns_has_cm_lists.CmListId='+_0x568546);db[_0x89de('0x56')][_0x89de('0x57')](_0x2976a5['toString']())['spread'](function(_0x386388){var _0xda4550=[];for(var _0x2cfed4=0x0;_0x2cfed4<_0x386388[_0x89de('0x19')];_0x2cfed4++){_0xda4550[_0x89de('0x1a')](getTimezoneData(_0x386388[_0x2cfed4],tmp_campaigns));}BPromise['all'](_0xda4550)[_0x89de('0x18')](function(){_0x49f692({'val':0x1});});})[_0x89de('0x5d')](function(_0x2f1c78){logger[_0x89de('0x52')](_0x2f1c78[_0x89de('0x53')]);_0x49f692({'val':0x0});});});}function updateTzVoiceQueues(_0x536273){return new Promise(function(_0x100894,_0x47fb48){var _0x35b072=squel['select']()['fields']([_0x89de('0x5e'),_0x89de('0x5f')])[_0x89de('0x10')](_0x89de('0x60'))[_0x89de('0x11')](_0x89de('0x61'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x89de('0x39')](_0x89de('0x62')+_0x536273);db[_0x89de('0x56')][_0x89de('0x57')](_0x35b072[_0x89de('0x3d')]())[_0x89de('0x58')](function(_0x1ef8af){var _0x747873=[];for(var _0x4b27a7=0x0;_0x4b27a7<_0x1ef8af[_0x89de('0x19')];_0x4b27a7++){_0x747873[_0x89de('0x1a')](getTimezoneData(_0x1ef8af[_0x4b27a7],tmp_voice_queues));}BPromise[_0x89de('0x1b')](_0x747873)[_0x89de('0x18')](function(){_0x100894({'val':0x1});});})[_0x89de('0x5d')](function(_0xebd661){logger['error'](_0xebd661[_0x89de('0x53')]);_0x100894({'val':0x0});});});}function getTimezoneData(_0x23d9d3,_0x282d5e){return new Promise(function(_0x5939da,_0x495734){var _0x37d644=shared[_0x89de('0x63')];var _0x19c79a=_0x37d644[_0x23d9d3['dialTimezone']];if(_[_0x89de('0x1d')](_0x19c79a)){_0x5939da({'ret':0x1});}else{var _0x26546e=_0x19c79a[_0x89de('0x64')];var _0x25f2ba=squel[_0x89de('0x2b')]()['into'](_0x282d5e)[_0x89de('0x65')]('id',_0x23d9d3['id'])[_0x89de('0x65')](_0x89de('0x66'),_0x26546e)[_0x89de('0x65')](_0x89de('0x67'),_0x23d9d3['dialTimezone'])[_0x89de('0x3d')]();return db[_0x89de('0x56')][_0x89de('0x57')](_0x25f2ba)[_0x89de('0x58')](function(_0x14086b){_0x5939da({'ret':0x1});})[_0x89de('0x5d')](function(_0x3b4375){logger['error'](_0x3b4375[_0x89de('0x53')]);_0x495734({'ret':0x1});});}});}function handleTZQuery(_0x3962a1){logger[_0x89de('0x51')](_0x3962a1);return db[_0x89de('0x56')][_0x89de('0x57')](_0x3962a1)[_0x89de('0x58')](function(_0x22e73c){})[_0x89de('0x5d')](function(_0x50599b){logger[_0x89de('0x52')](_0x50599b[_0x89de('0x53')]);});}function main(_0x3e3088,_0x5cfce4,_0x3376f7,_0x4a9d8f){logger[_0x89de('0x51')]('main',_0x3e3088,JSON[_0x89de('0x68')](_0x5cfce4));process[_0x89de('0x69')](_0x89de('0x6a'));var _0x24b30d=_0x5cfce4[_0x89de('0x6b')];var _0x33c7e3=_[_0x89de('0x6c')](_0x24b30d);var _0x5c6ed7=_0x5cfce4['socket_timestamp'];var _0x56c55b=path[_0x89de('0x11')](config[_0x89de('0x6d')],_0x89de('0x6e'),_0x5c6ed7+_0x89de('0x6f'));hasTZ=_['keys'](_0x24b30d)[_0x89de('0x70')]('dialTimezone');var _0x29cca3=_[_0x89de('0x71')](_0x24b30d)[_0x89de('0x11')]();logger[_0x89de('0x51')](_0x89de('0x72'),_0x29cca3);db[_0x89de('0x73')][_0x89de('0x16')]({'raw':!![],'attributes':['id',_0x89de('0x74')]})[_0x89de('0x18')](function(_0x4a82e2){for(var _0x5a5187=0x0;_0x5a5187<_0x4a82e2['length'];_0x5a5187++){if(_0x4a82e2[_0x5a5187][_0x89de('0x74')]in _0x24b30d){contactItemTypes['push'](_0x4a82e2[_0x5a5187]);delete _0x33c7e3[_0x4a82e2[_0x5a5187][_0x89de('0x74')]];hasAdditionalPhones=!![];}for(var _0x8cece7 in _0x24b30d){if(_0x4a82e2[_0x5a5187]['name']+_0x89de('0x75')===_0x8cece7){phoneDescriptions[_0x89de('0x1a')]({'itemTypeId':_0x4a82e2[_0x5a5187]['id'],'description':_0x8cece7});delete _0x33c7e3[_0x8cece7];}}}if(hasAdditionalPhones)_0x33c7e3[_0x89de('0x17')]='';var _0x1309b1=_['keys'](_0x33c7e3)[_0x89de('0x11')]();logger[_0x89de('0x51')](_0x89de('0x72'),_0x1309b1);fs[_0x89de('0x76')](_0x56c55b,_0x1309b1+'\x0a');Papa['parse'](fs['createReadStream'](_0x3e3088),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2f87aa,_0x5156ab){try{for(var _0x15322b=0x0,_0x3d0684=[];_0x15322b<_0x2f87aa[_0x89de('0x77')][_0x89de('0x19')];_0x15322b++){stats['rows']+=0x1;if(_0x2f87aa[_0x89de('0x78')][_0x15322b]){handleError(_0x2f87aa[_0x89de('0x77')][_0x15322b],_0x2f87aa[_0x89de('0x78')][_0x15322b]);}else{var _0x166220=[];var _0x20f773=[];var _0x2a6eab={};for(var _0x458a67 in _0x24b30d){let _0x2a3a7e=contactItemTypes[_0x89de('0x79')](_0x147b45=>_0x147b45[_0x89de('0x74')]===_0x458a67);let _0x1bf0e4=contactItemTypes['find'](_0x467b08=>_0x467b08[_0x89de('0x74')]+_0x89de('0x75')===_0x458a67);if(_[_0x89de('0x1d')](_0x2a3a7e)&&_['isNil'](_0x1bf0e4)){if(_0x24b30d[_0x89de('0x7a')](_0x458a67)){if(_0x2f87aa[_0x89de('0x77')][_0x15322b][_0x24b30d[_0x458a67]]){var _0x58fc85=_[_0x89de('0x7b')](_0x2f87aa[_0x89de('0x77')][_0x15322b][_0x24b30d[_0x458a67]][_0x89de('0x7c')](/"/g,'\x27'));switch(_0x458a67){case _0x89de('0x2e'):var _0x47ab01=moment(_0x58fc85,_0x89de('0xb'),!![]);if(_0x47ab01[_0x89de('0x7d')]()){_0x3d0684['push']('\x22'+_0x58fc85+'\x22');}else{_0x166220[_0x89de('0x1a')](_0x89de('0x7e'));}break;case _0x89de('0x33'):var _0x226f49=parseInt(_0x58fc85);_0x58fc85=_[_0x89de('0x7f')](_0x226f49)||_0x226f49<0x0||_0x226f49>0x4?_0x4a9d8f?0x3:0x2:_0x226f49;_0x3d0684[_0x89de('0x1a')]('\x22'+_0x58fc85+'\x22');break;case'UserId':var _0x299228=parseInt(_0x58fc85);if(_[_0x89de('0x80')](_0x299228)&&_[_0x89de('0x70')](_0x3376f7,_0x299228)){_0x3d0684[_0x89de('0x1a')]('\x22'+_0x299228+'\x22');}else{_0x166220['push'](_0x89de('0x81'));}break;case _0x89de('0x82'):if(isEmail(_0x58fc85)){_0x3d0684['push']('\x22'+_0x58fc85+'\x22');}else{_0x166220[_0x89de('0x1a')](_0x89de('0x83'));}break;case'dateOfBirth':var _0x38901a=moment(_0x58fc85,'YYYY-MM-DD',!![]);if(_0x38901a['isValid']()){_0x3d0684[_0x89de('0x1a')]('\x22'+_0x58fc85+'\x22');}else{_0x166220['push'](_0x89de('0x84'));}break;case _0x89de('0x67'):var _0xb5ea7=shared[_0x89de('0x63')];var _0x43566d=_0xb5ea7[_0x58fc85];if(!_['isNil'](_0x43566d)){var _0x4d8c68=_0x43566d[_0x89de('0x64')];_0x3d0684[_0x89de('0x1a')]('\x22'+_0x58fc85+'\x22');_0x3d0684[_0x89de('0x1a')]('\x22'+_0x4d8c68+'\x22');}break;default:_0x3d0684['push']('\x22'+_0x58fc85+'\x22');}}else{switch(_0x458a67){case _0x89de('0x85'):case _0x89de('0xf'):_0x166220[_0x89de('0x1a')](_0x458a67+_0x89de('0x86'));break;default:_0x3d0684[_0x89de('0x1a')]('\x22\x22');}}}}else{var _0x30d945='';if(!_[_0x89de('0x1d')](_0x2a3a7e)){if(!_0x2a6eab['hasOwnProperty'](_0x2a3a7e['id'])){if(!_['isNil'](_0x2f87aa[_0x89de('0x77')][_0x15322b][_0x24b30d[_0x458a67]])){var _0x58fc85=_[_0x89de('0x7b')](_0x2f87aa[_0x89de('0x77')][_0x15322b][_0x24b30d[_0x458a67]][_0x89de('0x7c')](/"/g,'\x27'));var _0x12cfd3=phoneDescriptions['find'](_0x20d514=>_0x20d514['itemTypeId']===_0x2a3a7e['id']);if(!_['isNil'](_0x12cfd3)){var _0x1efa57=_[_0x89de('0x7b')](_0x2f87aa['data'][_0x15322b][_0x24b30d[_0x12cfd3[_0x89de('0x87')]]][_0x89de('0x7c')](/"/g,'\x27'));if(!_[_0x89de('0x1d')](_0x1efa57))_0x58fc85=_0x58fc85+'§'+_0x1efa57;}if(_0x30d945=='')_0x30d945=_0x58fc85;else _0x30d945+='|'+_0x58fc85;}_0x20f773['push'](_0x2a3a7e['id']+':'+_0x30d945);_0x2a6eab[_0x2a3a7e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3d0684[_0x89de('0x1a')]('\x22'+_0x20f773['join'](';')+'\x22');}if(_0x166220[_0x89de('0x19')]){handleError(_0x2f87aa['data'][_0x15322b],{'code':_0x89de('0x88'),'message':_0x166220[_0x89de('0x11')]()});}else{fs[_0x89de('0x89')](_0x56c55b,_0x3d0684['join']()+'\x0a');}_0x3d0684=[];}if(!(stats[_0x89de('0x8a')]%0xc8)){socket[_0x89de('0x8b')]('contact:import:'+_0x5c6ed7,stats);stats[_0x89de('0x78')]=[];}}if(stopped){logger['info'](_0x89de('0x8c'));_0x5156ab[_0x89de('0x8d')]();}}catch(_0x59a34c){handleError(_0x2f87aa[_0x89de('0x77')][_0x15322b],{'code':'SystemError','message':_0x59a34c['message']});logger[_0x89de('0x52')](_0x89de('0x8e'),_0x59a34c['message']);}},'complete':function(){try{var _0x5be317=[];var _0x58ed3d=[];var _0x1f87ce=_0x89de('0x36');if(_0x5cfce4[_0x89de('0x8f')]&&_0x5cfce4[_0x89de('0x8f')]['length']){_0x1f87ce=_0x89de('0x90')+_0x5c6ed7;_0x5be317[_0x89de('0x1a')](_0x89de('0x91')+_0x1f87ce+_0x89de('0x92'));}tmp_campaigns='campaigns_'+_0x5c6ed7;tmp_voice_queues=_0x89de('0x93')+_0x5c6ed7;_0x58ed3d[_0x89de('0x1a')](_0x89de('0x91')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x58ed3d[_0x89de('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x89de('0x94'));BPromise[_0x89de('0x95')](_0x58ed3d,handleTZQuery)[_0x89de('0x18')](function(_0x2fdd93){updateTzCampaigns(_0x5cfce4[_0x89de('0x30')])[_0x89de('0x18')](function(_0x48f91b){updateTzVoiceQueues(_0x5cfce4[_0x89de('0x30')])['then'](function(_0x482c75){if(hasTZ)_0x1309b1=_0x1309b1['replace'](_0x89de('0x67'),_0x89de('0x96'));var _0x5af66b=util[_0x89de('0xa')](_0x89de('0x97'),_0x56c55b,_0x1f87ce,_0x1309b1,_0x5cfce4[_0x89de('0x30')],_0x5cfce4[_0x89de('0x98')]||null,NOW,NOW);if(_[_0x89de('0x1d')](_0x24b30d[_0x89de('0x2e')])){_0x5af66b+=',\x20scheduledAt\x20=\x20NOW()';}_0x5be317[_0x89de('0x1a')](_0x5af66b);if(_0x5cfce4[_0x89de('0x8f')]&&_0x5cfce4['duplicates']['length']){_0x5be317[_0x89de('0x1a')](insertCmContact(_0x5cfce4[_0x89de('0x30')],_0x1f87ce,_0x5cfce4[_0x89de('0x8f')],_0x24b30d));_0x5be317['push'](_0x89de('0x99')+_0x1f87ce+';');}BPromise[_0x89de('0x95')](_0x5be317,handleQuery)[_0x89de('0x18')](function(_0x6dd012){BPromise[_0x89de('0x1b')]([handleAdditionalPhones()])[_0x89de('0x18')](function(){_0x5be317=[];for(var _0x4407bc=0x0;_0x4407bc\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','test','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','catch','error','message','split','findOne','then','CmContactHasItem','updated','create','PHONE','CmContact','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','ContactId','createdAt','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors'];(function(_0x3be603,_0x5f139c){var _0x221620=function(_0x389fc7){while(--_0x389fc7){_0x3be603['push'](_0x3be603['shift']());}};_0x221620(++_0x5f139c);}(_0x7cdc,0x190));var _0xc7cd=function(_0x4a47d6,_0x449899){_0x4a47d6=_0x4a47d6-0x0;var _0x40e4e2=_0x7cdc[_0x4a47d6];return _0x40e4e2;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xc7cd('0x0'));var Papa=require(_0xc7cd('0x1'));var util=require('util');var BPromise=require(_0xc7cd('0x2'));var moment=require(_0xc7cd('0x3'));var squel=require(_0xc7cd('0x4'));var Redis=require('ioredis');var db=require(_0xc7cd('0x5'))['db'];var config=require(_0xc7cd('0x6'));var logger=require('../../../config/logger')(_0xc7cd('0x7'));config[_0xc7cd('0x8')]=_[_0xc7cd('0x9')](config[_0xc7cd('0x8')],{'host':_0xc7cd('0xa'),'port':0x18eb});var socket=require(_0xc7cd('0xb'))(new Redis(config[_0xc7cd('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xc7cd('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0xc7cd('0xd')](_0xc7cd('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x22f6a0){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))*$/[_0xc7cd('0xf')](_0x22f6a0);}function selectNotIn(_0x4b7cfe,_0x2c78e2,_0x4346ee,_0x5e019a,_0x39f39c){return squel['select']()[_0xc7cd('0x10')]('phone')[_0xc7cd('0x11')](_0x5e019a)[_0xc7cd('0x12')](_0x2c78e2,null,_0x2c78e2+_0xc7cd('0x13')+_0x5e019a+'.'+_0x4346ee)[_0xc7cd('0x14')](_0x5e019a+'.'+_0x4346ee+'\x20=\x20'+_0x4b7cfe+'.'+_0x4346ee)[_0xc7cd('0x14')](_0x2c78e2+_0xc7cd('0x15')+_0x39f39c['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3c9781,_0x5aa9a0){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc7cd('0x16')]['query'](_0xc7cd('0x17')+tempTableName)[_0xc7cd('0x18')](function(_0x2f04cb){if(_0x2f04cb!==null){var _0x317b0b=[];for(var _0x494658=0x0;_0x494658<_0x2f04cb[_0xc7cd('0x19')];_0x494658++){var _0x34ddb8=_0x2f04cb[_0x494658];if(!_[_0xc7cd('0x1a')](_0x34ddb8[_0xc7cd('0x1b')])){if(!_[_0xc7cd('0x1a')](_0x34ddb8[_0xc7cd('0x1c')]))_0x317b0b[_0xc7cd('0x1d')](insertAdditionalPhones(_0x34ddb8));promisesContact[_0xc7cd('0x1d')]({'contact':_0x34ddb8});}}}Promise[_0xc7cd('0x1e')](_0x317b0b)['then'](function(){_0x3c9781({'val':0x1});});})[_0xc7cd('0x1f')](function(_0x5d9678){logger[_0xc7cd('0x20')](_0x5d9678[_0xc7cd('0x21')]);});});}function insertAdditionalPhones(_0xd45c9d){return new Promise(function(_0x1177a2,_0x449e15){var _0x571012=_0xd45c9d[_0xc7cd('0x1c')];if(_[_0xc7cd('0x1a')](_0x571012))_0x449e15({'val':0x0});else{var _0xf6b9db=_0x571012[_0xc7cd('0x22')](';');var _0x5b06b3=[];orderBy=0x0;for(var _0x255330=0x0;_0x255330<_0xf6b9db[_0xc7cd('0x19')];_0x255330++){_0x5b06b3[_0xc7cd('0x1d')](splitAdditionalPhone(_0xd45c9d['id'],_0xf6b9db[_0x255330]));}Promise[_0xc7cd('0x1e')](_0x5b06b3)['then'](function(){_0x1177a2({'val':_0xf6b9db['length']});});}});}function splitAdditionalPhone(_0x4f2259,_0x3b92a2){return new Promise(function(_0x577e4a,_0x2014bb){var _0x2ce431=_0x3b92a2[_0xc7cd('0x22')](':');var _0x2601b8=_0x2ce431[0x0];var _0x4450a5=_0x2ce431[0x1];if(_0x4450a5!==''){var _0x3242a4=_0x4450a5['split']('|');var _0x2d2c1c=[];for(var _0x33c1ca=0x0;_0x33c1ca<_0x3242a4[_0xc7cd('0x19')];_0x33c1ca++){if(_0x3242a4[_0x33c1ca]!==''){var _0x3652a7=_['filter'](promisesAdditionalPhones,{'contactId':_0x4f2259,'phone':_0x3242a4[_0x33c1ca]});if(_0x3652a7[_0xc7cd('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xc7cd('0x1d')]({'contactId':_0x4f2259,'contactTypeId':_0x2601b8,'phone':_0x3242a4[_0x33c1ca],'orderBy':orderBy});}}}_0x577e4a({'ok':0x1});}else _0x577e4a({'res':0x0});});}function createAdditionalPhone(_0x104046,_0x173378,_0x4ed88b,_0x19aa4a){var _0x22be13='';var _0x5ab9a2='';var _0x4d3f3c=_0x4ed88b[_0xc7cd('0x22')]('§');_0x22be13=_0x4d3f3c[0x0];if(_0x4d3f3c[_0xc7cd('0x19')]==0x2)_0x5ab9a2=_0x4d3f3c[0x1];return new Promise(function(_0x360c06,_0x34530d){return db['CmContactHasItem'][_0xc7cd('0x23')]({'where':{'CmContactId':_0x104046,'item':_0x22be13}})[_0xc7cd('0x24')](function(_0x5ed4d5){if(_0x5ed4d5){return db[_0xc7cd('0x25')]['update']({'ItemTypeId':_0x173378,'description':_0x5ab9a2,'OrderBy':_0x19aa4a},{'where':{'CmContactId':_0x104046,'item':_0x22be13}})[_0xc7cd('0x24')](function(_0xbd2964){_0x360c06({'res':_0xc7cd('0x26')});});}else{return db[_0xc7cd('0x25')][_0xc7cd('0x27')]({'CmContactId':_0x104046,'item':_0x22be13,'ItemTypeId':_0x173378,'description':_0x5ab9a2,'OrderBy':_0x19aa4a,'ItemClass':_0xc7cd('0x28')})[_0xc7cd('0x24')](function(_0x11be09){_0x360c06({'res':'inserted'});});}});});}function updateContact(_0x4ee497){return new Promise(function(_0x2d4370,_0x57738c){var _0x5dfa8a=_0x4ee497['id'];delete _0x4ee497['id'];return db[_0xc7cd('0x29')][_0xc7cd('0x2a')](_0x4ee497,{'where':{'id':_0x5dfa8a}})[_0xc7cd('0x24')](function(_0x1b8e7b){updatedRows+=0x1;return db['CmHopper'][_0xc7cd('0x2a')]({'phone':_0x4ee497[_0xc7cd('0x1b')]},{'where':{'ContactId':_0x5dfa8a}})[_0xc7cd('0x24')](function(_0x28001b){_0x2d4370({'ret':'OK'});});});});}function insertCmHopper(_0x1bf7e3,_0x4c3d5f,_0xafa7d8,_0x2d2fc7,_0x5c6060){var _0xf0eb98=[_0xc7cd('0x2b'),_0xc7cd('0x2c'),_0xc7cd('0x2d'),'cm_contacts.ListId',_0x4c3d5f+'.'+_0x2d2fc7,_0xc7cd('0x2e'),_0xc7cd('0x2f'),_0xc7cd('0x30'),_0xc7cd('0x31'),'\x22'+_0x5c6060+'\x22'];return squel[_0xc7cd('0x32')]()[_0xc7cd('0x33')](_0xc7cd('0x34'))[_0xc7cd('0x35')]([_0xc7cd('0x1b'),_0xc7cd('0x36'),'ContactId',_0xc7cd('0x37'),_0x2d2fc7,'createdAt',_0xc7cd('0x38'),_0xc7cd('0x39'),_0xc7cd('0x3a'),_0xc7cd('0x3b')],squel[_0xc7cd('0x3c')]()[_0xc7cd('0x3d')](_0xf0eb98)['from'](_0x4c3d5f)['join'](_0xc7cd('0x3e'),null,_0xc7cd('0x3f')+_0x4c3d5f+_0xc7cd('0x40'))['join'](_0xafa7d8,null,_0xafa7d8+_0xc7cd('0x13')+_0x4c3d5f+'.'+_0x2d2fc7)[_0xc7cd('0x14')](_0x4c3d5f+_0xc7cd('0x41'),_0x1bf7e3)[_0xc7cd('0x14')](_0xc7cd('0x42'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4c3d5f,_0xafa7d8,_0x2d2fc7,_0xc7cd('0x34'),[_0xc7cd('0x43'),_0xc7cd('0x44')]))['where'](_0xc7cd('0x45'),selectNotIn(_0x4c3d5f,_0xafa7d8,_0x2d2fc7,_0xc7cd('0x34'),[_0xc7cd('0x43')])))[_0xc7cd('0x46')]();}function insertCmHopperBlack(_0x2761de,_0x1d9c74,_0x4d96ab,_0x2ae7eb){var _0x25eb7d=[_0xc7cd('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x1d9c74+'.'+_0x2ae7eb,_0xc7cd('0x2e'),_0xc7cd('0x2f')];return squel[_0xc7cd('0x32')]()[_0xc7cd('0x33')](_0xc7cd('0x47'))['fromQuery'](['phone',_0xc7cd('0x48'),_0xc7cd('0x37'),_0x2ae7eb,_0xc7cd('0x49'),_0xc7cd('0x38')],squel[_0xc7cd('0x3c')]()[_0xc7cd('0x3d')](_0x25eb7d)['from'](_0x1d9c74)[_0xc7cd('0x12')](_0xc7cd('0x3e'),null,_0xc7cd('0x3f')+_0x1d9c74+_0xc7cd('0x40'))[_0xc7cd('0x12')](_0x4d96ab,null,_0x4d96ab+_0xc7cd('0x13')+_0x1d9c74+'.'+_0x2ae7eb)[_0xc7cd('0x14')](_0x1d9c74+_0xc7cd('0x41'),_0x2761de)[_0xc7cd('0x14')](_0xc7cd('0x42'),NOW)[_0xc7cd('0x14')](_0xc7cd('0x45'),squel[_0xc7cd('0x3c')]()[_0xc7cd('0x10')]('phone')[_0xc7cd('0x11')](_0xc7cd('0x47'))['where'](_0xc7cd('0x4a'),_0x2761de)[_0xc7cd('0x14')](_0x2ae7eb+_0xc7cd('0x4b'),_0x1d9c74+'.'+_0x2ae7eb)))[_0xc7cd('0x46')]();}function insertCmHopperAdditionalPhones(_0x1e7093){var _0x205d3e=[_0xc7cd('0x4c'),_0xc7cd('0x4d'),_0xc7cd('0x4e'),_0xc7cd('0x4f'),_0xc7cd('0x50')];return squel[_0xc7cd('0x32')]()[_0xc7cd('0x33')](_0xc7cd('0x51'))['fromQuery'](['CmHopperId','phone','OrderBy',_0xc7cd('0x49'),_0xc7cd('0x38')],squel[_0xc7cd('0x3c')]()[_0xc7cd('0x3d')](_0x205d3e)[_0xc7cd('0x11')](_0xc7cd('0x34'))[_0xc7cd('0x12')](_0xc7cd('0x3e'),null,_0xc7cd('0x52'))[_0xc7cd('0x12')](_0xc7cd('0x53'),null,_0xc7cd('0x54'))[_0xc7cd('0x14')](_0xc7cd('0x55'),_0x1e7093)[_0xc7cd('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xc7cd('0x46')]();}function insertCmContact(_0x285df4,_0x3613a9,_0x558700,_0x59e368){var _0x1256cf=_['concat'](_['keys'](_0x59e368),['ListId',_0xc7cd('0x56'),_0xc7cd('0x49'),_0xc7cd('0x38')]);return squel[_0xc7cd('0x32')]()['into'](_0xc7cd('0x3e'))[_0xc7cd('0x35')](_0x1256cf,squel[_0xc7cd('0x3c')]()[_0xc7cd('0x3d')](_0x1256cf)[_0xc7cd('0x11')](_0x3613a9)[_0xc7cd('0x14')]('('+_0x558700[_0xc7cd('0x12')](',')+_0xc7cd('0x57'),squel[_0xc7cd('0x3c')]()['fields'](_0x558700)[_0xc7cd('0x11')](_0xc7cd('0x3e'))[_0xc7cd('0x14')]('ListId\x20=\x20?',_0x285df4))['where'](_0xc7cd('0x58'),squel[_0xc7cd('0x3c')]()[_0xc7cd('0x10')](_0xc7cd('0x59'),_0xc7cd('0x5a'))[_0xc7cd('0x11')](_0x3613a9)[_0xc7cd('0x5b')](_0x558700['join'](','))))[_0xc7cd('0x46')]();}function handleStop(){logger['info'](_0xc7cd('0x5c'));stopped=!![];}function handleUncaughtException(_0x199e5a){logger[_0xc7cd('0x20')](_0x199e5a['message']);process[_0xc7cd('0x5d')](0x1);}function handleError(_0x1307c6,_0x47325e){stats[_0xc7cd('0x5e')]['push']({'name':_0x47325e[_0xc7cd('0x5f')],'message':_0x47325e[_0xc7cd('0x21')],'row':_0x1307c6});}function handleQuery(_0x222fca){logger[_0xc7cd('0x60')](_0x222fca);return db['sequelize'][_0xc7cd('0x61')](_0x222fca)[_0xc7cd('0x18')](function(_0x1e6481){results[_0xc7cd('0x1d')](_0x1e6481);})[_0xc7cd('0x1f')](function(_0x4fe62a){logger['error'](_0x4fe62a[_0xc7cd('0x21')]);});}function main(_0x5871a1,_0x5df73c,_0x4a71af,_0x1a829a){logger['info'](_0xc7cd('0x62'),_0x5871a1,JSON[_0xc7cd('0x63')](_0x5df73c));process[_0xc7cd('0x64')]('start');var _0x4e97d1=_0x5df73c[_0xc7cd('0x65')];var _0x3f42dc=_[_0xc7cd('0x66')](_0x4e97d1);var _0x1f970c=_0x5df73c[_0xc7cd('0x67')];var _0x5adb85=path['join'](config[_0xc7cd('0x68')],'server/files/tmp',_0x1f970c+'.csv');logger[_0xc7cd('0x60')](_0xc7cd('0x69'),_0x5df73c);db[_0xc7cd('0x6a')][_0xc7cd('0x6b')]({'raw':!![],'attributes':['id',_0xc7cd('0x6c')]})[_0xc7cd('0x24')](function(_0x50d66e){for(var _0x1257f3=0x0;_0x1257f3<_0x50d66e[_0xc7cd('0x19')];_0x1257f3++){if(_0x50d66e[_0x1257f3][_0xc7cd('0x6c')]in _0x4e97d1){contactItemTypes[_0xc7cd('0x1d')](_0x50d66e[_0x1257f3]);delete _0x3f42dc[_0x50d66e[_0x1257f3][_0xc7cd('0x6c')]];hasAdditionalPhones=!![];}for(var _0x5bb5fb in _0x4e97d1){if(_0x50d66e[_0x1257f3][_0xc7cd('0x6c')]+_0xc7cd('0x6d')===_0x5bb5fb){phoneDescriptions['push']({'itemTypeId':_0x50d66e[_0x1257f3]['id'],'description':_0x5bb5fb});delete _0x3f42dc[_0x5bb5fb];}}}if(hasAdditionalPhones)_0x3f42dc[_0xc7cd('0x1c')]='';var _0x5ccf85=_[_0xc7cd('0x6e')](_0x3f42dc)['join']();logger[_0xc7cd('0x60')]('header',_0x5ccf85);fs[_0xc7cd('0x6f')](_0x5adb85,_0x5ccf85+'\x0a');Papa[_0xc7cd('0x70')](fs['createReadStream'](_0x5871a1),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf4dc9d,_0x5d6bcd){try{for(var _0x266ef3=0x0,_0x30bb8d=[];_0x266ef3<_0xf4dc9d[_0xc7cd('0x71')][_0xc7cd('0x19')];_0x266ef3++){stats[_0xc7cd('0x72')]+=0x1;if(_0xf4dc9d['errors'][_0x266ef3]){handleError(_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3],_0xf4dc9d[_0xc7cd('0x5e')][_0x266ef3]);}else{var _0x19e123=[];var _0x10d133=[];var _0x55fec5={};for(var _0x355395 in _0x4e97d1){let _0x5ac889=contactItemTypes[_0xc7cd('0x73')](_0x514c2d=>_0x514c2d[_0xc7cd('0x6c')]===_0x355395);let _0x59dfd8=contactItemTypes[_0xc7cd('0x73')](_0x2a9be8=>_0x2a9be8[_0xc7cd('0x6c')]+_0xc7cd('0x6d')===_0x355395);if(_[_0xc7cd('0x1a')](_0x5ac889)&&_[_0xc7cd('0x1a')](_0x59dfd8)){if(_0x4e97d1[_0xc7cd('0x74')](_0x355395)){if(_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3][_0x4e97d1[_0x355395]]){var _0x5a0b77=_[_0xc7cd('0x75')](_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3][_0x4e97d1[_0x355395]][_0xc7cd('0x76')](/"/g,'\x27'));switch(_0x355395){case'scheduledat':var _0x195d2a=moment(_0x5a0b77,_0xc7cd('0xc'),!![]);if(_0x195d2a['isValid']()){_0x30bb8d[_0xc7cd('0x1d')]('\x22'+_0x5a0b77+'\x22');}else{_0x19e123[_0xc7cd('0x1d')](_0xc7cd('0x77'));}break;case _0xc7cd('0x39'):var _0x13fb77=parseInt(_0x5a0b77);_0x5a0b77=_[_0xc7cd('0x78')](_0x13fb77)||_0x13fb77<0x0||_0x13fb77>0x4?_0x1a829a?0x3:0x2:_0x13fb77;_0x30bb8d[_0xc7cd('0x1d')]('\x22'+_0x5a0b77+'\x22');break;case _0xc7cd('0x3a'):var _0x244148=parseInt(_0x5a0b77);if(_[_0xc7cd('0x79')](_0x244148)&&_[_0xc7cd('0x7a')](_0x4a71af,_0x244148)){_0x30bb8d[_0xc7cd('0x1d')]('\x22'+_0x244148+'\x22');}else{_0x19e123[_0xc7cd('0x1d')](_0xc7cd('0x7b'));}break;case _0xc7cd('0x7c'):if(isEmail(_0x5a0b77)){_0x30bb8d['push']('\x22'+_0x5a0b77+'\x22');}else{_0x19e123[_0xc7cd('0x1d')](_0xc7cd('0x7d'));}break;case _0xc7cd('0x7e'):var _0x2ef4c0=moment(_0x5a0b77,_0xc7cd('0x7f'),!![]);if(_0x2ef4c0[_0xc7cd('0x80')]()){_0x30bb8d[_0xc7cd('0x1d')]('\x22'+_0x5a0b77+'\x22');}else{_0x19e123[_0xc7cd('0x1d')](_0xc7cd('0x81'));}break;default:_0x30bb8d['push']('\x22'+_0x5a0b77+'\x22');}}else{switch(_0x355395){case _0xc7cd('0x82'):case _0xc7cd('0x1b'):_0x19e123[_0xc7cd('0x1d')](_0x355395+_0xc7cd('0x83'));break;default:_0x30bb8d[_0xc7cd('0x1d')]('\x22\x22');}}}}else{var _0x48e708='';if(!_['isNil'](_0x5ac889)){if(!_0x55fec5['hasOwnProperty'](_0x5ac889['id'])){for(var _0x4adcf0=0x0;_0x4adcf0<_0x4e97d1[_0x355395][_0xc7cd('0x19')];_0x4adcf0++){var _0x5a0b77=_[_0xc7cd('0x75')](_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3][_0x4e97d1[_0x355395][_0x4adcf0]][_0xc7cd('0x76')](/"/g,'\x27'));var _0x5f40e6=phoneDescriptions[_0xc7cd('0x73')](_0x13f0c9=>_0x13f0c9[_0xc7cd('0x84')]===_0x5ac889['id']);if(!_[_0xc7cd('0x1a')](_0x5f40e6)){var _0x6c2b03=_['trim'](_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3][_0x4e97d1[_0x5f40e6[_0xc7cd('0x85')]][0x0]][_0xc7cd('0x76')](/"/g,'\x27'));if(!_[_0xc7cd('0x1a')](_0x6c2b03))_0x5a0b77=_0x5a0b77+'§'+_0x6c2b03;}if(_0x48e708=='')_0x48e708=_0x5a0b77;else _0x48e708+='|'+_0x5a0b77;}_0x10d133[_0xc7cd('0x1d')](_0x5ac889['id']+':'+_0x48e708);_0x55fec5[_0x5ac889['id']]=0x1;}}}}if(hasAdditionalPhones){_0x30bb8d['push']('\x22'+_0x10d133[_0xc7cd('0x12')](';')+'\x22');}if(_0x19e123[_0xc7cd('0x19')]){handleError(_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3],{'code':_0xc7cd('0x86'),'message':_0x19e123[_0xc7cd('0x12')]()});}else{fs['appendFileSync'](_0x5adb85,_0x30bb8d[_0xc7cd('0x12')]()+'\x0a');}_0x30bb8d=[];}if(!(stats['rows']%0xc8)){socket[_0xc7cd('0x87')]('contact:import:'+_0x1f970c,stats);stats[_0xc7cd('0x5e')]=[];}}if(stopped){logger['info'](_0xc7cd('0x88'));_0x5d6bcd[_0xc7cd('0x89')]();}}catch(_0x3553f0){handleError(_0xf4dc9d[_0xc7cd('0x71')][_0x266ef3],{'code':_0xc7cd('0x8a'),'message':_0x3553f0[_0xc7cd('0x21')]});logger['error'](_0xc7cd('0x8b'),_0x3553f0[_0xc7cd('0x21')]);}},'complete':function(){try{var _0x3b1df3=[];var _0x1675f0=tempTableName;_0x3b1df3[_0xc7cd('0x1d')](_0xc7cd('0x8c')+_0x1675f0+_0xc7cd('0x8d'));logger['info'](_0xc7cd('0x8e'),contactItemTypes['length']);var _0x3ab39f=util[_0xc7cd('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5adb85,_0x1675f0,_0x5ccf85,_0x5df73c[_0xc7cd('0x37')],_0x5df73c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x4e97d1['scheduledat'])){_0x3ab39f+=_0xc7cd('0x8f');}_0x3b1df3[_0xc7cd('0x1d')](_0x3ab39f);BPromise[_0xc7cd('0x90')](_0x3b1df3,handleQuery)[_0xc7cd('0x24')](function(_0x1b5c2b){BPromise['all']([handleAdditionalPhones()])[_0xc7cd('0x24')](function(){_0x3b1df3=[];for(var _0x283af=0x0;_0x283af\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e22,0x1d8));var _0x27e2=function(_0xd25ea5,_0x4777a8){_0xd25ea5=_0xd25ea5-0x0;var _0x535bfe=_0x7e22[_0xd25ea5];return _0x535bfe;};'use strict';var fs=require('fs');var path=require(_0x27e2('0x0'));var _=require('lodash');var Papa=require(_0x27e2('0x1'));var util=require(_0x27e2('0x2'));var BPromise=require(_0x27e2('0x3'));var moment=require(_0x27e2('0x4'));var squel=require(_0x27e2('0x5'));var Redis=require(_0x27e2('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x27e2('0x7'));var logger=require('../../../config/logger')(_0x27e2('0x8'));config[_0x27e2('0x9')]=_[_0x27e2('0xa')](config[_0x27e2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x27e2('0xb'))(new Redis(config[_0x27e2('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x27e2('0xc')](_0x27e2('0xd'));var tempTableName=_0x27e2('0xe')+moment()[_0x27e2('0xc')](_0x27e2('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x256eac){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'](_0x256eac);}function selectNotIn(_0x3303bb,_0x1ada35,_0x485e59,_0x1263c4,_0x281721){return squel[_0x27e2('0x10')]()[_0x27e2('0x11')]('phone')[_0x27e2('0x12')](_0x1263c4)['join'](_0x1ada35,null,_0x1ada35+_0x27e2('0x13')+_0x1263c4+'.'+_0x485e59)[_0x27e2('0x14')](_0x1263c4+'.'+_0x485e59+_0x27e2('0x15')+_0x3303bb+'.'+_0x485e59)[_0x27e2('0x14')](_0x1ada35+_0x27e2('0x16')+_0x281721['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24a023,_0x55671a){promisesAdditionalPhones=[];promisesContact=[];return db[_0x27e2('0x17')][_0x27e2('0x18')](_0x27e2('0x19')+tempTableName)[_0x27e2('0x1a')](function(_0x3499e2){if(_0x3499e2!==null){var _0x20ed2c=[];for(var _0x371885=0x0;_0x371885<_0x3499e2[_0x27e2('0x1b')];_0x371885++){var _0x4ee164=_0x3499e2[_0x371885];if(!_['isNil'](_0x4ee164[_0x27e2('0x1c')])){if(!_[_0x27e2('0x1d')](_0x4ee164['AdditionalPhones']))_0x20ed2c[_0x27e2('0x1e')](insertAdditionalPhones(_0x4ee164));promisesContact[_0x27e2('0x1e')]({'contact':_0x4ee164});}}}Promise[_0x27e2('0x1f')](_0x20ed2c)[_0x27e2('0x20')](function(){_0x24a023({'val':0x1});});})[_0x27e2('0x21')](function(_0x502c9e){logger[_0x27e2('0x22')](_0x502c9e[_0x27e2('0x23')]);});});}function insertAdditionalPhones(_0x74986d){return new Promise(function(_0x4c3e17,_0x1e6b35){var _0x41bc71=_0x74986d['AdditionalPhones'];if(_['isNil'](_0x41bc71))_0x1e6b35({'val':0x0});else{var _0x227eab=_0x41bc71[_0x27e2('0x24')](';');var _0x2e9b70=[];orderBy=0x0;for(var _0x1aefa9=0x0;_0x1aefa9<_0x227eab[_0x27e2('0x1b')];_0x1aefa9++){_0x2e9b70[_0x27e2('0x1e')](splitAdditionalPhone(_0x74986d['id'],_0x227eab[_0x1aefa9]));}Promise[_0x27e2('0x1f')](_0x2e9b70)['then'](function(){_0x4c3e17({'val':_0x227eab['length']});});}});}function splitAdditionalPhone(_0x3d8126,_0x1f1b14){return new Promise(function(_0x38c02c,_0x270cf3){var _0xe04676=_0x1f1b14[_0x27e2('0x24')](':');var _0x58a218=_0xe04676[0x0];var _0x2b5e0e=_0xe04676[0x1];if(_0x2b5e0e!==''){var _0x30b0a9=_0x2b5e0e['split']('|');var _0x212e9a=[];for(var _0x361ba5=0x0;_0x361ba5<_0x30b0a9['length'];_0x361ba5++){if(_0x30b0a9[_0x361ba5]!==''){var _0x51e708=_[_0x27e2('0x25')](promisesAdditionalPhones,{'contactId':_0x3d8126,'phone':_0x30b0a9[_0x361ba5]});if(_0x51e708[_0x27e2('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x27e2('0x1e')]({'contactId':_0x3d8126,'contactTypeId':_0x58a218,'phone':_0x30b0a9[_0x361ba5],'orderBy':orderBy});}}}_0x38c02c({'ok':0x1});}else _0x38c02c({'res':0x0});});}function createAdditionalPhone(_0x46ca56,_0x39f969,_0x2fe650,_0x175c05){var _0x2d9216='';var _0x5efbd5='';var _0x5000f4=_0x2fe650[_0x27e2('0x24')]('§');_0x2d9216=_0x5000f4[0x0];if(_0x5000f4['length']==0x2)_0x5efbd5=_0x5000f4[0x1];return new Promise(function(_0xe98270,_0x4e49bb){return db[_0x27e2('0x26')][_0x27e2('0x27')]({'where':{'CmContactId':_0x46ca56,'item':_0x2d9216}})[_0x27e2('0x20')](function(_0x2ee9fa){if(_0x2ee9fa){return db[_0x27e2('0x26')][_0x27e2('0x28')]({'ItemTypeId':_0x39f969,'description':_0x5efbd5,'OrderBy':_0x175c05},{'where':{'CmContactId':_0x46ca56,'item':_0x2d9216}})['then'](function(_0x1eb259){_0xe98270({'res':'updated'});});}else{return db['CmContactHasItem'][_0x27e2('0x29')]({'CmContactId':_0x46ca56,'item':_0x2d9216,'ItemTypeId':_0x39f969,'description':_0x5efbd5,'OrderBy':_0x175c05,'ItemClass':_0x27e2('0x2a')})[_0x27e2('0x20')](function(_0x44623f){_0xe98270({'res':_0x27e2('0x2b')});});}});});}function updateContact(_0xff0bde){return new Promise(function(_0xb278c6,_0x313381){var _0x152076=_0xff0bde['id'];delete _0xff0bde['id'];return db[_0x27e2('0x2c')][_0x27e2('0x28')](_0xff0bde,{'where':{'id':_0x152076}})['then'](function(_0x52f273){updatedRows+=0x1;return db[_0x27e2('0x2d')]['update']({'phone':_0xff0bde[_0x27e2('0x1c')]},{'where':{'ContactId':_0x152076}})['then'](function(_0xa6e527){_0xb278c6({'ret':'OK'});});});});}function insertCmHopper(_0x805658,_0x48a04a,_0x4dcd10,_0x205ae3,_0x2bfd55){var _0x2b5670=[_0x27e2('0x2e'),_0x27e2('0x2f'),_0x27e2('0x30'),'cm_contacts.ListId',_0x48a04a+'.'+_0x205ae3,_0x27e2('0x31'),'cm_contacts.updatedAt','cm_contacts.priority',_0x27e2('0x32'),'\x22'+_0x2bfd55+'\x22'];return squel[_0x27e2('0x33')]()[_0x27e2('0x34')](_0x27e2('0x35'))[_0x27e2('0x36')]([_0x27e2('0x1c'),_0x27e2('0x37'),_0x27e2('0x38'),'ListId',_0x205ae3,_0x27e2('0x39'),_0x27e2('0x3a'),_0x27e2('0x3b'),'UserId',_0x27e2('0x3c')],squel['select']()[_0x27e2('0x3d')](_0x2b5670)['from'](_0x48a04a)[_0x27e2('0x3e')](_0x27e2('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x48a04a+_0x27e2('0x40'))[_0x27e2('0x3e')](_0x4dcd10,null,_0x4dcd10+_0x27e2('0x13')+_0x48a04a+'.'+_0x205ae3)[_0x27e2('0x14')](_0x48a04a+_0x27e2('0x41'),_0x805658)[_0x27e2('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x27e2('0x14')](_0x27e2('0x42'),selectNotIn(_0x48a04a,_0x4dcd10,_0x205ae3,_0x27e2('0x35'),['\x22always\x22',_0x27e2('0x43')]))[_0x27e2('0x14')](_0x27e2('0x42'),selectNotIn(_0x48a04a,_0x4dcd10,_0x205ae3,_0x27e2('0x35'),[_0x27e2('0x44')])))['toString']();}function insertCmHopperBlack(_0x9cc20d,_0xf04f09,_0xad1e03,_0x2f8f9d){var _0x353a3e=[_0x27e2('0x2e'),_0x27e2('0x30'),_0x27e2('0x45'),_0xf04f09+'.'+_0x2f8f9d,_0x27e2('0x31'),_0x27e2('0x46')];return squel[_0x27e2('0x33')]()[_0x27e2('0x34')](_0x27e2('0x47'))[_0x27e2('0x36')]([_0x27e2('0x1c'),'ContactId',_0x27e2('0x48'),_0x2f8f9d,'createdAt','updatedAt'],squel[_0x27e2('0x10')]()[_0x27e2('0x3d')](_0x353a3e)[_0x27e2('0x12')](_0xf04f09)[_0x27e2('0x3e')](_0x27e2('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0xf04f09+'.CmListId')['join'](_0xad1e03,null,_0xad1e03+_0x27e2('0x13')+_0xf04f09+'.'+_0x2f8f9d)[_0x27e2('0x14')](_0xf04f09+_0x27e2('0x41'),_0x9cc20d)[_0x27e2('0x14')](_0x27e2('0x49'),NOW)[_0x27e2('0x14')](_0x27e2('0x42'),squel['select']()[_0x27e2('0x11')](_0x27e2('0x1c'))['from'](_0x27e2('0x47'))[_0x27e2('0x14')](_0x27e2('0x4a'),_0x9cc20d)[_0x27e2('0x14')](_0x2f8f9d+'\x20=\x20?',_0xf04f09+'.'+_0x2f8f9d)))[_0x27e2('0x4b')]();}function insertCmHopperAdditionalPhones(_0xa9f4ab){var _0x305cfd=[_0x27e2('0x4c'),_0x27e2('0x4d'),'cm_contact_has_items.OrderBy',_0x27e2('0x4e'),_0x27e2('0x4f')];return squel[_0x27e2('0x33')]()['into'](_0x27e2('0x50'))[_0x27e2('0x36')](['CmHopperId',_0x27e2('0x1c'),_0x27e2('0x51'),_0x27e2('0x39'),_0x27e2('0x3a')],squel[_0x27e2('0x10')]()[_0x27e2('0x3d')](_0x305cfd)[_0x27e2('0x12')](_0x27e2('0x35'))[_0x27e2('0x3e')](_0x27e2('0x3f'),null,_0x27e2('0x52'))[_0x27e2('0x3e')]('cm_contact_has_items',null,_0x27e2('0x53'))['where'](_0x27e2('0x54'),_0xa9f4ab)[_0x27e2('0x14')](_0x27e2('0x49'),NOW))[_0x27e2('0x4b')]();}function insertCmContact(_0xc171bc,_0x464c5f,_0x2fd1de,_0x478ad1){var _0x102bf4=_[_0x27e2('0x55')](_['keys'](_0x478ad1),[_0x27e2('0x48'),'CompanyId','createdAt',_0x27e2('0x3a')]);return squel[_0x27e2('0x33')]()[_0x27e2('0x34')]('cm_contacts')['fromQuery'](_0x102bf4,squel['select']()[_0x27e2('0x3d')](_0x102bf4)[_0x27e2('0x12')](_0x464c5f)['where']('('+_0x2fd1de[_0x27e2('0x3e')](',')+_0x27e2('0x56'),squel[_0x27e2('0x10')]()[_0x27e2('0x3d')](_0x2fd1de)[_0x27e2('0x12')](_0x27e2('0x3f'))[_0x27e2('0x14')]('ListId\x20=\x20?',_0xc171bc))[_0x27e2('0x14')]('id\x20IN\x20?',squel[_0x27e2('0x10')]()[_0x27e2('0x11')](_0x27e2('0x57'),'min_id')[_0x27e2('0x12')](_0x464c5f)['group'](_0x2fd1de['join'](','))))[_0x27e2('0x4b')]();}function handleStop(){logger[_0x27e2('0x58')](_0x27e2('0x59'));stopped=!![];}function handleUncaughtException(_0xf7e415){logger[_0x27e2('0x22')](_0xf7e415[_0x27e2('0x23')]);process[_0x27e2('0x5a')](0x1);}function handleError(_0xbe2a85,_0xf6355){stats['errors'][_0x27e2('0x1e')]({'name':_0xf6355[_0x27e2('0x5b')],'message':_0xf6355[_0x27e2('0x23')],'row':_0xbe2a85});}function handleQuery(_0x37c897){logger['info'](_0x37c897);return db[_0x27e2('0x17')]['query'](_0x37c897)[_0x27e2('0x1a')](function(_0x165ab8){results[_0x27e2('0x1e')](_0x165ab8);})[_0x27e2('0x21')](function(_0x2ffd87){logger[_0x27e2('0x22')](_0x2ffd87[_0x27e2('0x23')]);});}function main(_0x381c5f,_0x421efa,_0xa2398,_0x14f73f){logger[_0x27e2('0x58')](_0x27e2('0x5c'),_0x381c5f,JSON[_0x27e2('0x5d')](_0x421efa));process['send'](_0x27e2('0x5e'));var _0x514aab=_0x421efa['binding'];var _0x3fac67=_['clone'](_0x514aab);var _0x806cc2=_0x421efa[_0x27e2('0x5f')];var _0x1fa369=path[_0x27e2('0x3e')](config[_0x27e2('0x60')],_0x27e2('0x61'),_0x806cc2+_0x27e2('0x62'));logger[_0x27e2('0x58')](_0x27e2('0x63'),_0x421efa);db['ContactItemType'][_0x27e2('0x64')]({'raw':!![],'attributes':['id',_0x27e2('0x65')]})['then'](function(_0x57c50f){for(var _0x15508c=0x0;_0x15508c<_0x57c50f[_0x27e2('0x1b')];_0x15508c++){if(_0x57c50f[_0x15508c][_0x27e2('0x65')]in _0x514aab){contactItemTypes[_0x27e2('0x1e')](_0x57c50f[_0x15508c]);delete _0x3fac67[_0x57c50f[_0x15508c][_0x27e2('0x65')]];hasAdditionalPhones=!![];}for(var _0x30219c in _0x514aab){if(_0x57c50f[_0x15508c][_0x27e2('0x65')]+_0x27e2('0x66')===_0x30219c){phoneDescriptions['push']({'itemTypeId':_0x57c50f[_0x15508c]['id'],'description':_0x30219c});delete _0x3fac67[_0x30219c];}}}if(hasAdditionalPhones)_0x3fac67[_0x27e2('0x67')]='';var _0x45f391=_[_0x27e2('0x68')](_0x3fac67)['join']();logger[_0x27e2('0x58')](_0x27e2('0x69'),_0x45f391);fs[_0x27e2('0x6a')](_0x1fa369,_0x45f391+'\x0a');Papa['parse'](fs[_0x27e2('0x6b')](_0x381c5f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x17a2c4,_0x53f3a2){try{for(var _0x4f31ee=0x0,_0x33f880=[];_0x4f31ee<_0x17a2c4[_0x27e2('0x6c')][_0x27e2('0x1b')];_0x4f31ee++){stats[_0x27e2('0x6d')]+=0x1;if(_0x17a2c4[_0x27e2('0x6e')][_0x4f31ee]){handleError(_0x17a2c4['data'][_0x4f31ee],_0x17a2c4['errors'][_0x4f31ee]);}else{var _0x292cd4=[];var _0x4c099e=[];var _0x5452ba={};for(var _0x4da706 in _0x514aab){let _0x28b041=contactItemTypes[_0x27e2('0x6f')](_0x53ea1a=>_0x53ea1a[_0x27e2('0x65')]===_0x4da706);let _0x5466a7=contactItemTypes[_0x27e2('0x6f')](_0x1a4e51=>_0x1a4e51[_0x27e2('0x65')]+_0x27e2('0x66')===_0x4da706);if(_['isNil'](_0x28b041)&&_[_0x27e2('0x1d')](_0x5466a7)){if(_0x514aab[_0x27e2('0x70')](_0x4da706)){if(_0x17a2c4['data'][_0x4f31ee][_0x514aab[_0x4da706]]){var _0x2739b2=_[_0x27e2('0x71')](_0x17a2c4[_0x27e2('0x6c')][_0x4f31ee][_0x514aab[_0x4da706]][_0x27e2('0x72')](/"/g,'\x27'));switch(_0x4da706){case'scheduledat':var _0x16ca61=moment(_0x2739b2,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x16ca61[_0x27e2('0x73')]()){_0x33f880[_0x27e2('0x1e')]('\x22'+_0x2739b2+'\x22');}else{_0x292cd4['push'](_0x27e2('0x74'));}break;case _0x27e2('0x3b'):var _0x149d3e=parseInt(_0x2739b2);_0x2739b2=_[_0x27e2('0x75')](_0x149d3e)||_0x149d3e<0x0||_0x149d3e>0x4?_0x14f73f?0x3:0x2:_0x149d3e;_0x33f880[_0x27e2('0x1e')]('\x22'+_0x2739b2+'\x22');break;case _0x27e2('0x76'):var _0x173bae=parseInt(_0x2739b2);if(_[_0x27e2('0x77')](_0x173bae)&&_['includes'](_0xa2398,_0x173bae)){_0x33f880[_0x27e2('0x1e')]('\x22'+_0x173bae+'\x22');}else{_0x292cd4[_0x27e2('0x1e')](_0x27e2('0x78'));}break;case _0x27e2('0x79'):if(isEmail(_0x2739b2)){_0x33f880['push']('\x22'+_0x2739b2+'\x22');}else{_0x292cd4[_0x27e2('0x1e')](_0x27e2('0x7a'));}break;case'dateOfBirth':var _0x36d5f2=moment(_0x2739b2,_0x27e2('0x7b'),!![]);if(_0x36d5f2[_0x27e2('0x73')]()){_0x33f880[_0x27e2('0x1e')]('\x22'+_0x2739b2+'\x22');}else{_0x292cd4[_0x27e2('0x1e')](_0x27e2('0x7c'));}break;default:_0x33f880[_0x27e2('0x1e')]('\x22'+_0x2739b2+'\x22');}}else{switch(_0x4da706){case _0x27e2('0x7d'):case _0x27e2('0x1c'):_0x292cd4[_0x27e2('0x1e')](_0x4da706+_0x27e2('0x7e'));break;default:_0x33f880['push']('\x22\x22');}}}}else{var _0x427827='';if(!_['isNil'](_0x28b041)){if(!_0x5452ba['hasOwnProperty'](_0x28b041['id'])){for(var _0x14f62d=0x0;_0x14f62d<_0x514aab[_0x4da706][_0x27e2('0x1b')];_0x14f62d++){var _0x2739b2=_[_0x27e2('0x71')](_0x17a2c4['data'][_0x4f31ee][_0x514aab[_0x4da706][_0x14f62d]][_0x27e2('0x72')](/"/g,'\x27'));var _0x4d1fb3=phoneDescriptions[_0x27e2('0x6f')](_0x44189e=>_0x44189e[_0x27e2('0x7f')]===_0x28b041['id']);if(!_[_0x27e2('0x1d')](_0x4d1fb3)){var _0xba05ee=_[_0x27e2('0x71')](_0x17a2c4[_0x27e2('0x6c')][_0x4f31ee][_0x514aab[_0x4d1fb3[_0x27e2('0x80')]][0x0]][_0x27e2('0x72')](/"/g,'\x27'));if(!_[_0x27e2('0x1d')](_0xba05ee))_0x2739b2=_0x2739b2+'§'+_0xba05ee;}if(_0x427827=='')_0x427827=_0x2739b2;else _0x427827+='|'+_0x2739b2;}_0x4c099e[_0x27e2('0x1e')](_0x28b041['id']+':'+_0x427827);_0x5452ba[_0x28b041['id']]=0x1;}}}}if(hasAdditionalPhones){_0x33f880[_0x27e2('0x1e')]('\x22'+_0x4c099e[_0x27e2('0x3e')](';')+'\x22');}if(_0x292cd4[_0x27e2('0x1b')]){handleError(_0x17a2c4['data'][_0x4f31ee],{'code':_0x27e2('0x81'),'message':_0x292cd4[_0x27e2('0x3e')]()});}else{fs[_0x27e2('0x82')](_0x1fa369,_0x33f880[_0x27e2('0x3e')]()+'\x0a');}_0x33f880=[];}if(!(stats[_0x27e2('0x6d')]%0xc8)){socket[_0x27e2('0x83')](_0x27e2('0x84')+_0x806cc2,stats);stats['errors']=[];}}if(stopped){logger[_0x27e2('0x58')]('Abort\x20parser');_0x53f3a2[_0x27e2('0x85')]();}}catch(_0x100ef2){handleError(_0x17a2c4[_0x27e2('0x6c')][_0x4f31ee],{'code':_0x27e2('0x86'),'message':_0x100ef2[_0x27e2('0x23')]});logger[_0x27e2('0x22')](_0x27e2('0x87'),_0x100ef2[_0x27e2('0x23')]);}},'complete':function(){try{var _0x29fdbd=[];var _0x278b90=tempTableName;_0x29fdbd['push'](_0x27e2('0x88')+_0x278b90+'\x20LIKE\x20cm_contacts;');logger[_0x27e2('0x58')]('CIS\x20len',contactItemTypes[_0x27e2('0x1b')]);var _0x3626e7=util[_0x27e2('0xc')]('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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1fa369,_0x278b90,_0x45f391,_0x421efa['ListId'],_0x421efa[_0x27e2('0x89')]||null,NOW,NOW);if(_[_0x27e2('0x1d')](_0x514aab[_0x27e2('0x37')])){_0x3626e7+=',\x20scheduledAt\x20=\x20NOW()';}_0x29fdbd[_0x27e2('0x1e')](_0x3626e7);BPromise[_0x27e2('0x8a')](_0x29fdbd,handleQuery)[_0x27e2('0x20')](function(_0x49dc28){BPromise[_0x27e2('0x1f')]([handleAdditionalPhones()])[_0x27e2('0x20')](function(){_0x29fdbd=[];for(var _0x35cd3b=0x0;_0x35cd3b\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x190d52,_0x563739){var _0x537be0=function(_0x59f743){while(--_0x59f743){_0x190d52['push'](_0x190d52['shift']());}};_0x537be0(++_0x563739);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5ba5e,_0x40bffb){_0x5ba5e=_0x5ba5e-0x0;var _0x24c1cf=_0xd2ea[_0x5ba5e];return _0x24c1cf;};'use strict';var _=require(_0xad2e('0x0'));var squel=require(_0xad2e('0x1'));var as=require(_0xad2e('0x2'));var qs=require(_0xad2e('0x3'));var updateInteraction=require(_0xad2e('0x4'))['updateInteraction'];var utils=require(_0xad2e('0x5'));var db=require(_0xad2e('0x6'))['db'];function skipInteractionsQuery(_0xcba7cb,_0x3e0741,_0x2afdc4){var _0x2fd28e=![];var _0x29e97f=utils['getAccountFK'](_0xcba7cb);if(_0x3e0741[_0xad2e('0x7')]===_0xad2e('0x8')&&!_0x2afdc4[_0xad2e('0x9')]&&!_0x2afdc4[_0x29e97f]){_0x2fd28e=!![];}return _0x2fd28e;}function getTagsQuery(){return squel['select']()[_0xad2e('0xa')]('id')[_0xad2e('0xa')]('name')[_0xad2e('0xa')]('color')[_0xad2e('0xb')](_0xad2e('0xc'));}function getUsersQuery(_0x9879f2,_0x24c5da){var _0x489f25=utils[_0xad2e('0xd')](_0x9879f2);var _0x5707a5=_0xad2e('0xe')+_0x9879f2+_0xad2e('0xf');var _0x433696=squel[_0xad2e('0x10')]()['field'](_0xad2e('0x11'))['field'](_0xad2e('0x12'))['field']('ui.'+_0x489f25)['from'](_0x5707a5,'ui')['left_join'](_0xad2e('0x13'),'u',_0xad2e('0x14'));if(_0x24c5da[_0xad2e('0x15')]>0x0){_0x433696[_0xad2e('0x16')](_0xad2e('0x17')+_0x489f25+_0xad2e('0x18'),_[_0xad2e('0x19')](_0x24c5da,'id'));}return _0x433696;}function getInteractionsQuery(_0x5941c5){var _0xd40b31=utils[_0xad2e('0x1a')](_0x5941c5);var _0x2af208=utils[_0xad2e('0x1b')](_0x5941c5);var _0x34f946=utils[_0xad2e('0xd')](_0x5941c5);return squel[_0xad2e('0x10')]()['from'](_0xd40b31[_0xad2e('0x1c')],'i')[_0xad2e('0x1d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xad2e('0x1e'))[_0xad2e('0x1d')](_0xd40b31[_0xad2e('0x1f')],'a',_0xad2e('0x20')+_0x2af208)[_0xad2e('0x1d')](_0xd40b31[_0xad2e('0x21')],'me',_0xad2e('0x22')+_0x34f946+_0xad2e('0x23'))[_0xad2e('0x1d')](_0xd40b31[_0xad2e('0x24')],'it',_0xad2e('0x25')+_0x34f946+_0xad2e('0x23'))[_0xad2e('0x1d')](_0xad2e('0xc'),'t',_0xad2e('0x26'));}function getSqlClauses(){var _0x2e1c95={'body':squel['expr'](),'contact':squel[_0xad2e('0x27')](),'default':squel[_0xad2e('0x27')](),'fields':squel[_0xad2e('0x27')](),'filter':squel[_0xad2e('0x27')](),'read':squel[_0xad2e('0x27')](),'tags':{'clause':squel[_0xad2e('0x27')](),'ids':null},'user':squel[_0xad2e('0x27')]()};return _0x2e1c95;}function parseTagParameter(_0x175055){var _0xfd90a4=squel['expr']();if(_0x175055){var _0x356a19=utils['getSelectedTags'](_0x175055);_0x356a19[_0xad2e('0x28')](function(_0x28ef72){_0xfd90a4['or'](_0xad2e('0x29'),'%,'+_0x28ef72+',%');});}return _0xfd90a4;}function parseReadParameter(_0x11bfa9){var _0x5aec9d='';if(_0x11bfa9){_0x5aec9d=_0xad2e('0x2a');if(_0x11bfa9==='1'){_0x5aec9d=_0x5aec9d[_0xad2e('0x2b')](_0xad2e('0x2c'),'=');}else{_0x5aec9d=_0x5aec9d[_0xad2e('0x2b')](_0xad2e('0x2c'),'>');}}return _0x5aec9d;}function parseSearchFilter(_0x4ffa15,_0x434934){var _0xfd2087=squel[_0xad2e('0x27')]();if(_0x434934){var _0x4379f4=_0x434934[_0xad2e('0x2b')]('\x5c','\x5c\x5c')[_0xad2e('0x2b')](/'/g,'\x27\x27');if(qs[_0xad2e('0x2d')](_0x4379f4)){_0xfd2087['or'](_0xad2e('0x2e'),_0x4379f4+'%');if([_0xad2e('0x2f'),_0xad2e('0x30')][_0xad2e('0x31')](_0x4ffa15)){_0xfd2087['or']('i.phone\x20LIKE\x20?',_0x4379f4+'%');}else if(_0x4ffa15===_0xad2e('0x32')){_0xfd2087['or']('i.fax\x20LIKE\x20?',_0x4379f4+'%');}else if(_0x4ffa15===_0xad2e('0x33')){_0xfd2087['or'](_0xad2e('0x34'),_0x4379f4+'%');}}else if(_0x4ffa15===_0xad2e('0x35')&&qs[_0xad2e('0x36')](_0x4379f4)){_0xfd2087['or'](_0xad2e('0x37'),_0x4379f4+'%');}else{if(_0x4ffa15==='mail'){_0xfd2087['or'](_0xad2e('0x38'),qs[_0xad2e('0x39')](_0x4379f4))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xad2e('0x39')](_0x4379f4));}else{if(_0x4ffa15!==_0xad2e('0x32')){_0xfd2087['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xad2e('0x39')](_0x4379f4));}_0xfd2087['or'](_0xad2e('0x3a'),_0x4379f4+'%');}}}return _0xfd2087;}function parseAdvancedSearchFilter(_0x3efac5,_0x3de92c){var _0x2a130a=getSqlClauses();var _0x2fa320=as[_0xad2e('0x3b')](_0x3efac5);var _0x49880e=_0x2fa320[_0xad2e('0x3c')];for(var _0x5b4386=0x0;_0x5b4386<_0x2fa320['conditions'][_0xad2e('0x15')];_0x5b4386++){var _0x3fe26d=_0x2fa320[_0xad2e('0x3d')][_0x5b4386];var _0x14d8d6='i';var _0x48c77b=_[_0xad2e('0x3e')](_0x3de92c,['name',_0x3fe26d['field']]);if(_0x48c77b){var _0x924f10=as['buildExpression'](_0x14d8d6,_0x48c77b[_0xad2e('0x3f')],_0x3fe26d);_0x2a130a[_0xad2e('0x40')][_0x49880e](_0x924f10[_0xad2e('0x41')],_0x924f10[_0xad2e('0x42')][_0xad2e('0x43')],_0x924f10['value'][_0xad2e('0x44')]);}else{switch(_0x3fe26d[_0xad2e('0xa')]){case'unreadMessages':var _0x596eee=parseReadParameter(_0x3fe26d['value']);_0x2a130a[_0xad2e('0x45')]['and'](_0x596eee);break;case'Contact':if(_0x3fe26d[_0xad2e('0x46')]===_0xad2e('0x47')){if(_0x3fe26d[_0xad2e('0x42')][_0xad2e('0x48')]('\x20')[_0xad2e('0x15')]>0x1){_0x2a130a[_0xad2e('0x49')][_0x49880e](_0xad2e('0x4a'),qs['getFullTextValue'](_0x3fe26d[_0xad2e('0x42')]),null);}else{var _0x341f51='%'+_0x3fe26d[_0xad2e('0x42')]+'%';_0x2a130a[_0xad2e('0x49')][_0x49880e](_0xad2e('0x4b'),_0x341f51,_0x341f51,_0x341f51);}}else{_0x48c77b=_['find'](_0x3de92c,[_0xad2e('0x4c'),'ContactId']);_0x3fe26d[_0xad2e('0xa')]=_0xad2e('0x4d');_0x924f10=as[_0xad2e('0x4e')](_0x14d8d6,_0x48c77b[_0xad2e('0x3f')],_0x3fe26d);_0x2a130a[_0xad2e('0x49')][_0x49880e](_0x924f10[_0xad2e('0x41')],_0x924f10[_0xad2e('0x42')][_0xad2e('0x43')],_0x924f10[_0xad2e('0x42')][_0xad2e('0x44')]);}break;case _0xad2e('0x4f'):var _0x42be79=_0x3fe26d[_0xad2e('0x42')][_0xad2e('0x48')](',')[_0xad2e('0x19')](function(_0x2ad9a0){return Number(_0x2ad9a0);});var _0x922e18=parseTagParameter(_0x42be79);_0x2a130a[_0xad2e('0x50')][_0xad2e('0x51')][_0xad2e('0x52')](_0x922e18);_0x2a130a['tags'][_0xad2e('0x53')]=_0x42be79;break;case _0xad2e('0x54'):if(_0x3fe26d[_0xad2e('0x46')]===_0xad2e('0x47')){_0x2a130a[_0xad2e('0x55')][_0x49880e](_0xad2e('0x56'),'%'+_0x3fe26d[_0xad2e('0x42')]+'%',null);}else{_0x48c77b=_['find'](_0x3de92c,[_0xad2e('0x4c'),'UserId']);_0x3fe26d[_0xad2e('0xa')]=_0xad2e('0x57');_0x924f10=as[_0xad2e('0x4e')](_0x14d8d6,_0x48c77b[_0xad2e('0x3f')],_0x3fe26d);_0x2a130a[_0xad2e('0x55')][_0x49880e](_0x924f10['text'],_0x924f10[_0xad2e('0x42')][_0xad2e('0x43')],_0x924f10[_0xad2e('0x42')][_0xad2e('0x44')]);}break;case _0xad2e('0x58'):case'plainBody':_0x924f10=as[_0xad2e('0x4e')]('me',null,_0x3fe26d);_0x2a130a[_0xad2e('0x58')][_0x49880e](_0x924f10[_0xad2e('0x41')],_0x924f10[_0xad2e('0x42')]['start'],_0x924f10['value'][_0xad2e('0x44')]);break;}}}return _0x2a130a;}function parseModelFields(_0x343e4f,_0x4d2c66,_0x4ec64c){var _0x1e7b8a=utils['getAccountFK'](_0x343e4f);var _0x37db2d=squel[_0xad2e('0x27')]();var _0x5196bf=_(_0x4d2c66)[_0xad2e('0x59')]()[_0xad2e('0x19')](function(_0x275689){return _[_0xad2e('0x5a')](_0x4ec64c,['name',_0x275689])?_0x275689:undefined;})['compact']()[_0xad2e('0x42')]();if(_0x5196bf[_0xad2e('0x15')]>0x0){_0x5196bf[_0xad2e('0x28')](function(_0x5b1b56){if(_0x5b1b56===_0x1e7b8a){_0x37db2d[_0xad2e('0x52')]('i.'+_0x1e7b8a+_0xad2e('0x18'),[][_0xad2e('0x5b')](_0x4d2c66[_0x5b1b56]));}else if(_0x5b1b56===_0xad2e('0x5c')){var _0x52e4bc=JSON[_0xad2e('0x5d')](_0x4d2c66[_0x5b1b56])['$gte'];var _0x36ba65=JSON[_0xad2e('0x5d')](_0x4d2c66[_0x5b1b56])[_0xad2e('0x5e')];_0x37db2d[_0xad2e('0x52')](_0xad2e('0x5f'),_0x52e4bc,_0x36ba65);}else{if(_0x4d2c66[_0x5b1b56]===_0xad2e('0x60')){_0x37db2d[_0xad2e('0x52')]('i.'+_0x5b1b56+'\x20IS\x20NULL');}else{_0x37db2d[_0xad2e('0x52')]('i.'+_0x5b1b56+'\x20=\x20?',_0x4d2c66[_0x5b1b56]);}}});}return _0x37db2d;}function parseQueryParameters(_0x2d2dc2,_0x4222a7,_0xbc21e4){var _0xf72966=getSqlClauses();return Promise['resolve']()[_0xad2e('0x61')](function(){return parseModelFields(_0x2d2dc2,_0x4222a7,_0xbc21e4);})[_0xad2e('0x61')](function(_0x56e633){_0xf72966[_0xad2e('0x62')]['and'](_0x56e633);return parseReadParameter(_0x4222a7[_0xad2e('0x45')]);})[_0xad2e('0x61')](function(_0x43ddf3){_0xf72966[_0xad2e('0x45')][_0xad2e('0x52')](_0x43ddf3);return parseTagParameter(_0x4222a7[_0xad2e('0x63')]);})[_0xad2e('0x61')](function(_0x1e914d){_0xf72966[_0xad2e('0x50')]['clause'][_0xad2e('0x52')](_0x1e914d);return parseSearchFilter(_0x2d2dc2,_0x4222a7[_0xad2e('0x64')]);})[_0xad2e('0x61')](function(_0x243add){_0xf72966['filter']=_0x243add;return _0xf72966;});}function checkAccountsRestrictions(_0x5c7318,_0x3c894f,_0xae65b6){var _0xb03176=utils[_0xad2e('0x1b')](_0x5c7318);var _0x450803=_0xad2e('0x65')+_['capitalize'](_0x5c7318)+(_0x5c7318===_0xad2e('0x66')?_0xad2e('0x67'):'Accounts');var _0x45f3e7=squel[_0xad2e('0x27')]();return Promise[_0xad2e('0x68')]()[_0xad2e('0x61')](function(){if(_0xae65b6[_0xad2e('0x9')]&&_0x3c894f[_0xad2e('0x7')]===_0xad2e('0x8')){return _0x3c894f[_0x450803]({'attributes':['id'],'raw':!![]});}})[_0xad2e('0x61')](function(_0x745c47){if(_0x745c47){if(_0x745c47[_0xad2e('0x15')]===0x0){_0x45f3e7['and']('i.'+_0xb03176+'\x20IS\x20NULL');}else{_0x45f3e7[_0xad2e('0x52')]('i.'+_0xb03176+'\x20IN\x20?',_['map'](_0x745c47,'id'));}}else if(!_0xae65b6[_0xb03176]){_0x45f3e7[_0xad2e('0x52')]('i.'+_0xb03176+_0xad2e('0x69'));}})[_0xad2e('0x61')](function(){return _0x45f3e7;});}function getClosedOrderClause(_0x4a4ec8,_0x114ed5){var _0x337d8c='';var _0x455e39=[_0xad2e('0x6a'),_0xad2e('0x6b'),'i.disposition'];if(_0x4a4ec8===_0xad2e('0x35')){_0x455e39['unshift']('i.substatus');}if(_0x114ed5['closed']==='0'&&_0x4a4ec8==='mail'){_0x337d8c=_0xad2e('0x6c');}else{if(_0x114ed5[_0xad2e('0x6d')]==='1'){_0x455e39[_0xad2e('0x6e')]();}_0x337d8c=_0xad2e('0x6f')+_0x455e39[_0xad2e('0x70')](',\x20')+')';}return _0x337d8c;}function getFilteredInteractions(_0x2c1871,_0x3b4ed2,_0x322b8d,_0x1a7d47){var _0x68e0d4=utils[_0xad2e('0xd')](_0x2c1871);var _0x55eef1=_[_0xad2e('0x71')](_0x2c1871)+_0xad2e('0x72');var _0x5832c9=[];var _0x584000=getTagsQuery();var _0x1010fd={'type':db['Sequelize'][_0xad2e('0x73')][_0xad2e('0x74')],'raw':!![]};var _0x3bdd1f=[];var _0x2d15c4=[];return db[_0xad2e('0x75')][_0xad2e('0x76')](_0x584000[_0xad2e('0x77')](),_0x1010fd)[_0xad2e('0x61')](function(_0x5101ec){_0x5832c9=_[_0xad2e('0x78')](_0x5101ec,'id');_0x1010fd=_['merge'](_0x1010fd,{'model':db[_0x55eef1],'mapToModel':!![],'nest':!![]});if(_0x322b8d['fields']){_0x1a7d47[_0xad2e('0x79')][_0xad2e('0x28')](function(_0x5319c0){_0x3b4ed2[_0xad2e('0xa')]('i.'+_0x5319c0);});}else{_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x7a'),'unreadMessages');_0x3b4ed2[_0xad2e('0xa')]('a.key',_0xad2e('0x7b'));_0x3b4ed2['field'](_0xad2e('0x7c'),_0xad2e('0x7d'));if(_0x2c1871===_0xad2e('0x35')){_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x7e'),_0xad2e('0x7f'));_0x3b4ed2['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xad2e('0x80'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x81'));_0x3b4ed2[_0xad2e('0xa')]('i.createdAt');_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x82'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x83'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x84'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x85'));_0x3b4ed2[_0xad2e('0xa')]('i.lastMsgAt');_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x86'));_0x3b4ed2[_0xad2e('0xa')]('i.subject');_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x87'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x6b'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x6a'));_0x3b4ed2['field']('i.substatus');_0x3b4ed2['field']('i.to');_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x88'));_0x3b4ed2['field'](_0xad2e('0x89'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x8a'));}else if(_0x2c1871===_0xad2e('0x33')){_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x8b'),_0xad2e('0x80'));}else{_0x3b4ed2[_0xad2e('0xa')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x2c1871!=='mail'){_0x3b4ed2['field']('i.*');}_0x3b4ed2[_0xad2e('0xa')]('c.firstName',_0xad2e('0x8c'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x8d'),'Contact.lastName');_0x3b4ed2['field'](_0xad2e('0x8e'),'Contact.email');_0x3b4ed2['field'](_0xad2e('0x8f'),_0xad2e('0x90'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x91'),_0xad2e('0x92'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x93'),_0xad2e('0x94'));_0x3b4ed2[_0xad2e('0xa')](_0xad2e('0x95'),'Owner.fullname');_0x3b4ed2['field'](_0xad2e('0x96'),_0xad2e('0x97'));_0x3b4ed2['field'](_0xad2e('0x98'),_0xad2e('0x99'));}if(_0x1a7d47['limit']){_0x3b4ed2['limit'](_0x1a7d47[_0xad2e('0x9a')]);}if(_0x1a7d47[_0xad2e('0x9b')]){_0x3b4ed2[_0xad2e('0x9b')](_0x1a7d47[_0xad2e('0x9b')]);}return db[_0xad2e('0x75')]['query'](_0x3b4ed2[_0xad2e('0x77')](),_0x1010fd);})['then'](function(_0x76b71a){_0x3bdd1f=_0x76b71a;var _0x19d0d1=getUsersQuery(_0x2c1871,_0x3bdd1f);return db['sequelize'][_0xad2e('0x76')](_0x19d0d1[_0xad2e('0x77')](),_0x1010fd);})[_0xad2e('0x61')](function(_0x47f679){_0x2d15c4=_[_0xad2e('0x9c')](_0x47f679,_0x68e0d4);if(_0x2c1871===_0xad2e('0x35')){return db[_0xad2e('0x9d')][_0xad2e('0x9e')]({'attributes':[_0xad2e('0x9f')],'raw':!![]});}})['then'](function(_0x2ea2d8){var _0x584c8c=_0x2ea2d8?_0x2ea2d8[_0xad2e('0x9f')]:undefined;var _0x409d39=_0x3bdd1f[_0xad2e('0x19')](function(_0xf143b6){return updateInteraction(_0xf143b6,_0x5832c9,_0x2d15c4,_0x584c8c);});return Promise[_0xad2e('0xa0')](_0x409d39);});}function countFilteredInteractions(_0x1f7d03,_0xb44d39){var _0xd342e4=_0x1f7d03[_0xad2e('0xa1')]();_0xd342e4[_0xad2e('0xa')](_0xad2e('0xa2'));_0xd342e4[_0xad2e('0xa')](_0xad2e('0x7a'),_0xad2e('0xa3'));var _0xf9a4c=utils[_0xad2e('0xa4')](_0xb44d39);if(!_[_0xad2e('0xa5')](_0xf9a4c)){_0xd342e4['where'](_0xad2e('0xa6'),_0xf9a4c);}var _0x475d6c={'type':db[_0xad2e('0xa7')][_0xad2e('0x73')]['SELECT'],'raw':!![]};return db[_0xad2e('0x75')][_0xad2e('0x76')](_0xd342e4[_0xad2e('0x77')](),_0x475d6c);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x55e0=['shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','SELECT','query','keyBy','merge','attributes','a.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','Setting','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../parsers/qs','./utils','../../mysqldb','role','search','select','field','name','color','from','tools_tags','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','getInteractionsTables','getAccountFK','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','type','default','text','value','start','end','and','Contact','$substring','length','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','split','tags','clause','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','some','compact','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','filter','get','capitalize','chat','Accounts','agent','map','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed'];(function(_0x620ece,_0x4320a1){var _0x5830e6=function(_0x4e0bb9){while(--_0x4e0bb9){_0x620ece['push'](_0x620ece['shift']());}};_0x5830e6(++_0x4320a1);}(_0x55e0,0xdc));var _0x055e=function(_0x85a68d,_0x2094e6){_0x85a68d=_0x85a68d-0x0;var _0x41212f=_0x55e0[_0x85a68d];return _0x41212f;};'use strict';var _=require(_0x055e('0x0'));var squel=require(_0x055e('0x1'));var as=require(_0x055e('0x2'));var qs=require(_0x055e('0x3'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];function skipInteractionsQuery(_0x33cd7b,_0x2773e4,_0x157473){var _0x196394=![];var _0x490ee1=utils['getAccountFK'](_0x33cd7b);if(_0x2773e4[_0x055e('0x6')]==='agent'&&!_0x157473[_0x055e('0x7')]&&!_0x157473[_0x490ee1]){_0x196394=!![];}return _0x196394;}function getTagsQuery(){return squel[_0x055e('0x8')]()[_0x055e('0x9')]('id')[_0x055e('0x9')](_0x055e('0xa'))['field'](_0x055e('0xb'))[_0x055e('0xc')](_0x055e('0xd'));}function getUsersQuery(_0xa0d384,_0x238068){var _0x5237d9=utils['getInteractionFK'](_0xa0d384);var _0x187cce='user_has_'+_0xa0d384+_0x055e('0xe');var _0x466da3=squel[_0x055e('0x8')]()[_0x055e('0x9')](_0x055e('0xf'))[_0x055e('0x9')](_0x055e('0x10'))['field'](_0x055e('0x11')+_0x5237d9)[_0x055e('0xc')](_0x187cce,'ui')[_0x055e('0x12')](_0x055e('0x13'),'u',_0x055e('0x14'));if(_0x238068['length']>0x0){_0x466da3[_0x055e('0x15')](_0x055e('0x11')+_0x5237d9+_0x055e('0x16'),_['map'](_0x238068,'id'));}return _0x466da3;}function getInteractionsQuery(_0x3f2d0e){var _0x2c377c=utils[_0x055e('0x17')](_0x3f2d0e);var _0x2bad86=utils[_0x055e('0x18')](_0x3f2d0e);var _0x4c85dd=utils[_0x055e('0x19')](_0x3f2d0e);return squel[_0x055e('0x8')]()[_0x055e('0xc')](_0x2c377c[_0x055e('0x1a')],'i')['left_join'](_0x055e('0x1b'),'c',_0x055e('0x1c'))['left_join'](_0x055e('0x13'),'o',_0x055e('0x1d'))[_0x055e('0x12')](_0x2c377c[_0x055e('0x1e')],'a',_0x055e('0x1f')+_0x2bad86)[_0x055e('0x12')](_0x2c377c['messages'],'me',_0x055e('0x20')+_0x4c85dd+_0x055e('0x21'))[_0x055e('0x12')](_0x2c377c['interactionsTags'],'it',_0x055e('0x22')+_0x4c85dd+_0x055e('0x21'))[_0x055e('0x12')](_0x055e('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x71a6e1={'body':squel['expr'](),'contact':squel[_0x055e('0x23')](),'default':squel[_0x055e('0x23')](),'fields':squel[_0x055e('0x23')](),'filter':squel[_0x055e('0x23')](),'read':squel[_0x055e('0x23')](),'tags':{'clause':squel[_0x055e('0x23')](),'ids':null},'user':squel['expr']()};return _0x71a6e1;}function parseTagParameter(_0x2fb49b){var _0x1f90a9=squel[_0x055e('0x23')]();if(_0x2fb49b){var _0x4b5891=utils[_0x055e('0x24')](_0x2fb49b);_0x4b5891[_0x055e('0x25')](function(_0x42f2df){_0x1f90a9['or'](_0x055e('0x26'),'%,'+_0x42f2df+',%');});}return _0x1f90a9;}function parseReadParameter(_0x59539d){var _0x27f81a='';if(_0x59539d){_0x27f81a='unreadMessages\x20{OPERATOR}\x200';if(_0x59539d==='1'){_0x27f81a=_0x27f81a[_0x055e('0x27')](_0x055e('0x28'),'=');}else{_0x27f81a=_0x27f81a[_0x055e('0x27')](_0x055e('0x28'),'>');}}return _0x27f81a;}function parseSearchFilter(_0x1610f1,_0x5c0e76){var _0x99a372=squel[_0x055e('0x23')]();if(_0x5c0e76){var _0x293062=_0x5c0e76[_0x055e('0x27')]('\x5c','\x5c\x5c')[_0x055e('0x27')](/'/g,'\x27\x27');if(qs[_0x055e('0x29')](_0x293062)){_0x99a372['or'](_0x055e('0x2a'),_0x293062+'%');if([_0x055e('0x2b'),'whatsapp'][_0x055e('0x2c')](_0x1610f1)){_0x99a372['or'](_0x055e('0x2d'),_0x293062+'%');}else if(_0x1610f1==='fax'){_0x99a372['or'](_0x055e('0x2e'),_0x293062+'%');}else if(_0x1610f1===_0x055e('0x2f')){_0x99a372['or'](_0x055e('0x30'),_0x293062+'%');}}else if(_0x1610f1===_0x055e('0x31')&&qs[_0x055e('0x32')](_0x293062)){_0x99a372['or'](_0x055e('0x33'),_0x293062+'%');}else{if(_0x1610f1==='mail'){_0x99a372['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x055e('0x34')](_0x293062))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x293062));}else{if(_0x1610f1!=='fax'){_0x99a372['or'](_0x055e('0x35'),qs[_0x055e('0x34')](_0x293062));}_0x99a372['or'](_0x055e('0x36'),_0x293062+'%');}}}return _0x99a372;}function parseAdvancedSearchFilter(_0x1aab6d,_0x282914){var _0x16a4fa=getSqlClauses();var _0x13efb7=as[_0x055e('0x37')](_0x1aab6d);var _0x42a33e=_0x13efb7[_0x055e('0x38')];for(var _0x2f839c=0x0;_0x2f839c<_0x13efb7[_0x055e('0x39')]['length'];_0x2f839c++){var _0x571b75=_0x13efb7[_0x055e('0x39')][_0x2f839c];var _0x47790a='i';var _0x10346b=_[_0x055e('0x3a')](_0x282914,[_0x055e('0xa'),_0x571b75[_0x055e('0x9')]]);if(_0x10346b){var _0xb08e29=as['buildExpression'](_0x47790a,_0x10346b[_0x055e('0x3b')],_0x571b75);_0x16a4fa[_0x055e('0x3c')][_0x42a33e](_0xb08e29[_0x055e('0x3d')],_0xb08e29[_0x055e('0x3e')][_0x055e('0x3f')],_0xb08e29['value'][_0x055e('0x40')]);}else{switch(_0x571b75[_0x055e('0x9')]){case'unreadMessages':var _0x39ecd7=parseReadParameter(_0x571b75[_0x055e('0x3e')]);_0x16a4fa['read'][_0x055e('0x41')](_0x39ecd7);break;case _0x055e('0x42'):if(_0x571b75['operator']===_0x055e('0x43')){if(_0x571b75[_0x055e('0x3e')]['split']('\x20')[_0x055e('0x44')]>0x1){_0x16a4fa[_0x055e('0x45')][_0x42a33e](_0x055e('0x46'),qs['getFullTextValue'](_0x571b75[_0x055e('0x3e')]),null);}else{var _0x1dd07b='%'+_0x571b75['value']+'%';_0x16a4fa[_0x055e('0x45')][_0x42a33e](_0x055e('0x47'),_0x1dd07b,_0x1dd07b,_0x1dd07b);}}else{_0x10346b=_[_0x055e('0x3a')](_0x282914,['name',_0x055e('0x48')]);_0x571b75[_0x055e('0x9')]=_0x055e('0x48');_0xb08e29=as['buildExpression'](_0x47790a,_0x10346b['type'],_0x571b75);_0x16a4fa[_0x055e('0x45')][_0x42a33e](_0xb08e29[_0x055e('0x3d')],_0xb08e29['value'][_0x055e('0x3f')],_0xb08e29['value'][_0x055e('0x40')]);}break;case'Tag':var _0x1ca551=_0x571b75[_0x055e('0x3e')][_0x055e('0x49')](',')['map'](function(_0x57483c){return Number(_0x57483c);});var _0x20b951=parseTagParameter(_0x1ca551);_0x16a4fa[_0x055e('0x4a')][_0x055e('0x4b')][_0x055e('0x41')](_0x20b951);_0x16a4fa['tags']['ids']=_0x1ca551;break;case _0x055e('0x4c'):if(_0x571b75[_0x055e('0x4d')]==='$substring'){_0x16a4fa[_0x055e('0x4e')][_0x42a33e](_0x055e('0x4f'),'%'+_0x571b75[_0x055e('0x3e')]+'%',null);}else{_0x10346b=_[_0x055e('0x3a')](_0x282914,[_0x055e('0xa'),_0x055e('0x50')]);_0x571b75['field']=_0x055e('0x50');_0xb08e29=as[_0x055e('0x51')](_0x47790a,_0x10346b['type'],_0x571b75);_0x16a4fa[_0x055e('0x4e')][_0x42a33e](_0xb08e29[_0x055e('0x3d')],_0xb08e29[_0x055e('0x3e')][_0x055e('0x3f')],_0xb08e29[_0x055e('0x3e')][_0x055e('0x40')]);}break;case _0x055e('0x52'):case'plainBody':_0xb08e29=as[_0x055e('0x51')]('me',null,_0x571b75);_0x16a4fa['body'][_0x42a33e](_0xb08e29[_0x055e('0x3d')],_0xb08e29[_0x055e('0x3e')][_0x055e('0x3f')],_0xb08e29['value']['end']);break;}}}return _0x16a4fa;}function parseModelFields(_0x45845e,_0x20114c,_0x25110f){var _0x250cab=utils[_0x055e('0x18')](_0x45845e);var _0x1523f7=squel[_0x055e('0x23')]();var _0x3d5a54=_(_0x20114c)[_0x055e('0x53')]()['map'](function(_0x5a49ca){return _[_0x055e('0x54')](_0x25110f,[_0x055e('0xa'),_0x5a49ca])?_0x5a49ca:undefined;})[_0x055e('0x55')]()[_0x055e('0x3e')]();if(_0x3d5a54['length']>0x0){_0x3d5a54[_0x055e('0x25')](function(_0x1d4061){if(_0x1d4061===_0x250cab){_0x1523f7[_0x055e('0x41')]('i.'+_0x250cab+'\x20IN\x20?',[][_0x055e('0x56')](_0x20114c[_0x1d4061]));}else if(_0x1d4061==='createdAt'){var _0x15e442=JSON[_0x055e('0x57')](_0x20114c[_0x1d4061])['$gte'];var _0x132752=JSON[_0x055e('0x57')](_0x20114c[_0x1d4061])[_0x055e('0x58')];_0x1523f7['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15e442,_0x132752);}else{if(_0x20114c[_0x1d4061]===_0x055e('0x59')){_0x1523f7[_0x055e('0x41')]('i.'+_0x1d4061+_0x055e('0x5a'));}else{_0x1523f7[_0x055e('0x41')]('i.'+_0x1d4061+_0x055e('0x5b'),_0x20114c[_0x1d4061]);}}});}return _0x1523f7;}function parseQueryParameters(_0x2ceb8d,_0x473e7a,_0x44b907){var _0x128091=getSqlClauses();return Promise[_0x055e('0x5c')]()['then'](function(){return parseModelFields(_0x2ceb8d,_0x473e7a,_0x44b907);})[_0x055e('0x5d')](function(_0x7f03ed){_0x128091[_0x055e('0x5e')][_0x055e('0x41')](_0x7f03ed);return parseReadParameter(_0x473e7a['read']);})[_0x055e('0x5d')](function(_0x302787){_0x128091[_0x055e('0x5f')][_0x055e('0x41')](_0x302787);return parseTagParameter(_0x473e7a['tag']);})['then'](function(_0x22bf74){_0x128091[_0x055e('0x4a')][_0x055e('0x4b')][_0x055e('0x41')](_0x22bf74);return parseSearchFilter(_0x2ceb8d,_0x473e7a[_0x055e('0x60')]);})[_0x055e('0x5d')](function(_0x3876d0){_0x128091[_0x055e('0x60')]=_0x3876d0;return _0x128091;});}function checkAccountsRestrictions(_0x56db9c,_0x51b5a9,_0x1df839){var _0x33592d=utils['getAccountFK'](_0x56db9c);var _0x143e8c=_0x055e('0x61')+_[_0x055e('0x62')](_0x56db9c)+(_0x56db9c===_0x055e('0x63')?'Websites':_0x055e('0x64'));var _0x3c5296=squel[_0x055e('0x23')]();return Promise[_0x055e('0x5c')]()[_0x055e('0x5d')](function(){if(_0x1df839[_0x055e('0x7')]&&_0x51b5a9[_0x055e('0x6')]===_0x055e('0x65')){return _0x51b5a9[_0x143e8c]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3cb600){if(_0x3cb600){if(_0x3cb600[_0x055e('0x44')]===0x0){_0x3c5296['and']('i.'+_0x33592d+_0x055e('0x5a'));}else{_0x3c5296[_0x055e('0x41')]('i.'+_0x33592d+_0x055e('0x16'),_[_0x055e('0x66')](_0x3cb600,'id'));}}else if(!_0x1df839[_0x33592d]){_0x3c5296['and']('i.'+_0x33592d+_0x055e('0x67'));}})[_0x055e('0x5d')](function(){return _0x3c5296;});}function getClosedOrderClause(_0xb4f2fe,_0x4deec3){var _0x329d46='';var _0x4337c7=[_0x055e('0x68'),_0x055e('0x69'),_0x055e('0x6a')];if(_0xb4f2fe==='mail'){_0x4337c7[_0x055e('0x6b')](_0x055e('0x6c'));}if(_0x4deec3[_0x055e('0x6d')]==='0'&&_0xb4f2fe===_0x055e('0x31')){_0x329d46=_0x055e('0x6c');}else{if(_0x4deec3['closed']==='1'){_0x4337c7[_0x055e('0x6e')]();}_0x329d46=_0x055e('0x6f')+_0x4337c7[_0x055e('0x70')](',\x20')+')';}return _0x329d46;}function getFilteredInteractions(_0x4d65e3,_0xea7283,_0x343a1d,_0x3ecc65){var _0x2262e1=utils[_0x055e('0x19')](_0x4d65e3);var _0x553e16=_[_0x055e('0x62')](_0x4d65e3)+'Interaction';var _0x24ac0c=[];var _0x716d2=getTagsQuery();var _0x533c0a={'type':db[_0x055e('0x71')][_0x055e('0x72')][_0x055e('0x73')],'raw':!![]};var _0x2bdf06=[];var _0x58c121=[];return db['sequelize'][_0x055e('0x74')](_0x716d2['toString'](),_0x533c0a)[_0x055e('0x5d')](function(_0x16fed1){_0x24ac0c=_[_0x055e('0x75')](_0x16fed1,'id');_0x533c0a=_[_0x055e('0x76')](_0x533c0a,{'model':db[_0x553e16],'mapToModel':!![],'nest':!![]});if(_0x343a1d[_0x055e('0x5e')]){_0x3ecc65[_0x055e('0x77')][_0x055e('0x25')](function(_0x22b74f){_0xea7283[_0x055e('0x9')]('i.'+_0x22b74f);});}else{_0xea7283[_0x055e('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xea7283[_0x055e('0x9')](_0x055e('0x78'),'Account.key');_0xea7283[_0x055e('0x9')]('a.mandatoryDisposition',_0x055e('0x79'));if(_0x4d65e3===_0x055e('0x31')){_0xea7283[_0x055e('0x9')](_0x055e('0x7a'),_0x055e('0x7b'));_0xea7283[_0x055e('0x9')](_0x055e('0x7c'),_0x055e('0x7d'));_0xea7283['field'](_0x055e('0x7e'));_0xea7283[_0x055e('0x9')](_0x055e('0x7f'));_0xea7283[_0x055e('0x9')](_0x055e('0x80'));_0xea7283[_0x055e('0x9')](_0x055e('0x81'));_0xea7283[_0x055e('0x9')](_0x055e('0x82'));_0xea7283['field'](_0x055e('0x83'));_0xea7283[_0x055e('0x9')]('i.lastMsgAt');_0xea7283[_0x055e('0x9')](_0x055e('0x84'));_0xea7283[_0x055e('0x9')](_0x055e('0x85'));_0xea7283['field'](_0x055e('0x6a'));_0xea7283[_0x055e('0x9')](_0x055e('0x69'));_0xea7283[_0x055e('0x9')](_0x055e('0x68'));_0xea7283['field'](_0x055e('0x6c'));_0xea7283[_0x055e('0x9')](_0x055e('0x86'));_0xea7283[_0x055e('0x9')]('i.ContactId');_0xea7283[_0x055e('0x9')](_0x055e('0x87'));_0xea7283[_0x055e('0x9')](_0x055e('0x88'));}else if(_0x4d65e3===_0x055e('0x2f')){_0xea7283['field'](_0x055e('0x89'),_0x055e('0x7d'));}else{_0xea7283[_0x055e('0x9')](_0x055e('0x8a'),'contactName');}if(_0x4d65e3!==_0x055e('0x31')){_0xea7283[_0x055e('0x9')](_0x055e('0x8b'));}_0xea7283[_0x055e('0x9')]('c.firstName',_0x055e('0x8c'));_0xea7283[_0x055e('0x9')](_0x055e('0x8d'),_0x055e('0x8e'));_0xea7283[_0x055e('0x9')]('c.email',_0x055e('0x8f'));_0xea7283[_0x055e('0x9')](_0x055e('0x90'),'Contact.phone');_0xea7283['field'](_0x055e('0x91'),'Contact.mobile');_0xea7283[_0x055e('0x9')](_0x055e('0x92'),'Contact.fax');_0xea7283[_0x055e('0x9')](_0x055e('0x93'),_0x055e('0x94'));_0xea7283[_0x055e('0x9')](_0x055e('0x95'),_0x055e('0x96'));_0xea7283[_0x055e('0x9')](_0x055e('0x97'),_0x055e('0x98'));}if(_0x3ecc65[_0x055e('0x99')]){_0xea7283[_0x055e('0x99')](_0x3ecc65[_0x055e('0x99')]);}if(_0x3ecc65[_0x055e('0x9a')]){_0xea7283[_0x055e('0x9a')](_0x3ecc65[_0x055e('0x9a')]);}return db[_0x055e('0x9b')]['query'](_0xea7283[_0x055e('0x9c')](),_0x533c0a);})['then'](function(_0x5d2993){_0x2bdf06=_0x5d2993;var _0x373f6c=getUsersQuery(_0x4d65e3,_0x2bdf06);return db[_0x055e('0x9b')][_0x055e('0x74')](_0x373f6c['toString'](),_0x533c0a);})[_0x055e('0x5d')](function(_0x265b94){_0x58c121=_['groupBy'](_0x265b94,_0x2262e1);if(_0x4d65e3===_0x055e('0x31')){return db[_0x055e('0x9d')]['findOne']({'attributes':[_0x055e('0x9e')],'raw':!![]});}})['then'](function(_0xc825b0){var _0x40dc75=_0xc825b0?_0xc825b0[_0x055e('0x9e')]:undefined;var _0xd4f242=_0x2bdf06['map'](function(_0x5f1a9a){return updateInteraction(_0x5f1a9a,_0x24ac0c,_0x58c121,_0x40dc75);});return Promise['all'](_0xd4f242);});}function countFilteredInteractions(_0x2f4324,_0x5349b4){var _0x4f1de0=_0x2f4324[_0x055e('0x9f')]();_0x4f1de0['field'](_0x055e('0xa0'));_0x4f1de0[_0x055e('0x9')](_0x055e('0xa1'),_0x055e('0xa2'));var _0x4ffb38=utils['getSelectedTags'](_0x5349b4);if(!_[_0x055e('0xa3')](_0x4ffb38)){_0x4f1de0[_0x055e('0x15')](_0x055e('0xa4'),_0x4ffb38);}var _0x394492={'type':db[_0x055e('0x71')][_0x055e('0x72')][_0x055e('0x73')],'raw':!![]};return db['sequelize'][_0x055e('0x74')](_0x4f1de0['toString'](),_0x394492);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 29da795..b76cde2 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c2d=['lodash','../../mysqldb','map','fullname','split','waiting','answered','unmanaged','UserId','talking','disposition','total','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','TagIds','Tags'];(function(_0x309573,_0x21047b){var _0x3169fd=function(_0x482213){while(--_0x482213){_0x309573['push'](_0x309573['shift']());}};_0x3169fd(++_0x21047b);}(_0x1c2d,0x14a));var _0xd1c2=function(_0x564b47,_0x4f0d35){_0x564b47=_0x564b47-0x0;var _0xd75e4d=_0x1c2d[_0x564b47];return _0xd75e4d;};'use strict';var _=require(_0xd1c2('0x0'));var db=require(_0xd1c2('0x1'))['db'];function getInteractionUsers(_0x5082a3,_0xd554ca){return new Promise(function(_0x245a1b,_0x3bd669){try{var _0x539613=[];if(_0xd554ca[_0x5082a3]){_0x539613=_0xd554ca[_0x5082a3][_0xd1c2('0x2')](function(_0x21fbc7){return{'id':_0x21fbc7['id'],'fullname':_0x21fbc7[_0xd1c2('0x3')]};});}return _0x245a1b(_0x539613);}catch(_0x372f2d){_0x3bd669(_0x372f2d);}});}function getInteractionTags(_0x23b46b,_0x997107){var _0x5db670=[];if(_0x23b46b){_0x23b46b[_0xd1c2('0x4')](',')['forEach'](function(_0x240f50){_0x5db670['push'](_0x997107[_0x240f50]);});}return _0x5db670;}function updateWaitingCounter(_0x35fcb9){if(_0x35fcb9[_0xd1c2('0x5')]){_0x35fcb9[_0xd1c2('0x5')]-=0x1;}}function updateInteractionCounters(_0x560473){_0x560473[_0xd1c2('0x5')]=0x0;_0x560473['talking']=0x0;_0x560473[_0xd1c2('0x6')]=0x0;_0x560473[_0xd1c2('0x7')]=0x0;_0x560473['abandoned']=0x0;_0x560473['total']=0x0;if(_0x560473['closed']){if(_0x560473['disposition']==='abandoned'){_0x560473['abandoned']+=0x1;updateWaitingCounter(_0x560473);}if(_0x560473[_0xd1c2('0x8')]){_0x560473[_0xd1c2('0x6')]+=0x1;if(_0x560473[_0xd1c2('0x9')]){_0x560473['talking']-=0x1;}}else{if(_0x560473[_0xd1c2('0xa')]){_0x560473[_0xd1c2('0x7')]+=0x1;updateWaitingCounter(_0x560473);}}}else{if(!_0x560473[_0xd1c2('0x8')]){_0x560473[_0xd1c2('0x5')]+=0x1;}if(_0x560473[_0xd1c2('0x8')]){_0x560473[_0xd1c2('0x9')]+=0x1;updateWaitingCounter(_0x560473);}}_0x560473[_0xd1c2('0xb')]+=0x1;return _0x560473;}function getLastMessageText(_0x129bb0){return db['MailMessage'][_0xd1c2('0xc')]({'where':{'$and':[{'MailInteractionId':_0x129bb0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd1c2('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd1c2('0xe')],'order':_0xd1c2('0xf'),'raw':!![]})[_0xd1c2('0x10')](function(_0x1361ef){if(_0x1361ef&&_0x1361ef[_0xd1c2('0xe')]){_0x129bb0[_0xd1c2('0x11')]=_[_0xd1c2('0x12')](_0x1361ef[_0xd1c2('0xe')]);}return _0x129bb0;})[_0xd1c2('0x13')](function(_0x3a912e){throw _0x3a912e;});}exports['updateInteraction']=function(_0x25095c,_0xfc87fc,_0x5c84f9,_0x2709fb){return new Promise(function(_0x10eb23,_0xaca747){return getInteractionUsers(_0x25095c['id'],_0x5c84f9)['then'](function(_0x178e90){_0x25095c['Users']=_0x178e90;return getInteractionTags(_0x25095c[_0xd1c2('0x14')],_0xfc87fc);})['then'](function(_0x1c5e42){_0x25095c[_0xd1c2('0x15')]=_0x1c5e42;delete _0x25095c[_0xd1c2('0x14')];return updateInteractionCounters(_0x25095c);})[_0xd1c2('0x10')](function(_0x14fd68){if(_0x2709fb){return getLastMessageText(_0x14fd68);}else{return _0x14fd68;}})[_0xd1c2('0x10')](function(_0x5c0afe){_0x10eb23(_0x5c0afe);})[_0xd1c2('0x13')](function(_0x4f5bd0){_0xaca747(_0x4f5bd0);});});}; \ No newline at end of file +var _0x86a5=['Tags','TagIds','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','Users'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x86a5,0x1f0));var _0x586a=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x86a5[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x586a('0x0'));var db=require(_0x586a('0x1'))['db'];function getInteractionUsers(_0x5bf0a1,_0x341da2){return new Promise(function(_0x51f769,_0x281420){try{var _0x3fe651=[];if(_0x341da2[_0x5bf0a1]){_0x3fe651=_0x341da2[_0x5bf0a1][_0x586a('0x2')](function(_0x44ee82){return{'id':_0x44ee82['id'],'fullname':_0x44ee82[_0x586a('0x3')]};});}return _0x51f769(_0x3fe651);}catch(_0x227061){_0x281420(_0x227061);}});}function getInteractionTags(_0x19cc7e,_0x4ad4f3){var _0x22e534=[];if(_0x19cc7e){_0x19cc7e[_0x586a('0x4')](',')['forEach'](function(_0x417fd1){_0x22e534[_0x586a('0x5')](_0x4ad4f3[_0x417fd1]);});}return _0x22e534;}function updateWaitingCounter(_0x1f2229){if(_0x1f2229[_0x586a('0x6')]){_0x1f2229[_0x586a('0x6')]-=0x1;}}function updateInteractionCounters(_0x5694fa){_0x5694fa['waiting']=0x0;_0x5694fa[_0x586a('0x7')]=0x0;_0x5694fa[_0x586a('0x8')]=0x0;_0x5694fa[_0x586a('0x9')]=0x0;_0x5694fa[_0x586a('0xa')]=0x0;_0x5694fa[_0x586a('0xb')]=0x0;if(_0x5694fa[_0x586a('0xc')]){if(_0x5694fa[_0x586a('0xd')]==='abandoned'){_0x5694fa[_0x586a('0xa')]+=0x1;updateWaitingCounter(_0x5694fa);}if(_0x5694fa[_0x586a('0xe')]){_0x5694fa['answered']+=0x1;if(_0x5694fa[_0x586a('0x7')]){_0x5694fa[_0x586a('0x7')]-=0x1;}}else{if(_0x5694fa['disposition']){_0x5694fa[_0x586a('0x9')]+=0x1;updateWaitingCounter(_0x5694fa);}}}else{if(!_0x5694fa['UserId']){_0x5694fa[_0x586a('0x6')]+=0x1;}if(_0x5694fa[_0x586a('0xe')]){_0x5694fa[_0x586a('0x7')]+=0x1;updateWaitingCounter(_0x5694fa);}}_0x5694fa['total']+=0x1;return _0x5694fa;}function getLastMessageText(_0x4f7f20){return db[_0x586a('0xf')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4f7f20['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x586a('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x586a('0x11')],'order':_0x586a('0x12'),'raw':!![]})[_0x586a('0x13')](function(_0x28c97d){if(_0x28c97d&&_0x28c97d[_0x586a('0x11')]){_0x4f7f20[_0x586a('0x14')]=_['trimStart'](_0x28c97d[_0x586a('0x11')]);}return _0x4f7f20;})[_0x586a('0x15')](function(_0x41e921){throw _0x41e921;});}exports[_0x586a('0x16')]=function(_0x30bab5,_0x1bd17d,_0x25c1a8,_0x2e323d){return new Promise(function(_0xc6f0ff,_0x3c2996){return getInteractionUsers(_0x30bab5['id'],_0x25c1a8)[_0x586a('0x13')](function(_0x296664){_0x30bab5[_0x586a('0x17')]=_0x296664;return getInteractionTags(_0x30bab5['TagIds'],_0x1bd17d);})[_0x586a('0x13')](function(_0x53c8f1){_0x30bab5[_0x586a('0x18')]=_0x53c8f1;delete _0x30bab5[_0x586a('0x19')];return updateInteractionCounters(_0x30bab5);})[_0x586a('0x13')](function(_0x3fc16b){if(_0x2e323d){return getLastMessageText(_0x3fc16b);}else{return _0x3fc16b;}})['then'](function(_0x5c5d6a){_0xc6f0ff(_0x5c5d6a);})[_0x586a('0x15')](function(_0x5d288f){_0x3c2996(_0x5d288f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 6715d69..744503a 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47f7=['toUpperCase','name','null','findOne','update','then','info','catch','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','unknown','websites','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x2fd32d,_0x50a97a){var _0x2b86be=function(_0x11fede){while(--_0x11fede){_0x2fd32d['push'](_0x2fd32d['shift']());}};_0x2b86be(++_0x50a97a);}(_0x47f7,0x19d));var _0x747f=function(_0x5f4597,_0x5b1147){_0x5f4597=_0x5f4597-0x0;var _0x20cf29=_0x47f7[_0x5f4597];return _0x20cf29;};'use strict';var _=require(_0x747f('0x0'));var db=require(_0x747f('0x1'))['db'];var loggers={'openchannel':require(_0x747f('0x2'))('openchannel-interactions'),'mail':require(_0x747f('0x2'))(_0x747f('0x3')),'fax':require(_0x747f('0x2'))(_0x747f('0x4')),'sms':require(_0x747f('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x747f('0x5')),'whatsapp':require(_0x747f('0x2'))(_0x747f('0x6'))};function getAccountFK(_0x3efe67){return _[_0x747f('0x7')](_0x3efe67)+(_0x3efe67===_0x747f('0x8')?_0x747f('0x9'):_0x747f('0xa'))+'Id';}function getInteractionFK(_0x304724){return _[_0x747f('0x7')](_0x304724)+_0x747f('0xb');}function getInteractionId(_0x5d4689,_0x418b44,_0x5c6e06){if(_0x5d4689&&_0x5d4689[_['upperFirst'](_0x5c6e06)+'InteractionId']){return _0x5d4689[_['upperFirst'](_0x5c6e06)+'InteractionId'];}else if(_0x5d4689&&_0x5d4689['id']){return _0x5d4689['id'];}else if(_0x418b44&&_0x418b44['id']){return _0x418b44['id'];}else{return _0x747f('0xc');}}function getInteractionsTables(_0x84ca19){return{'accounts':_0x84ca19+'_'+(_0x84ca19===_0x747f('0x8')?_0x747f('0xd'):'accounts'),'interactions':_0x84ca19+_0x747f('0xe'),'interactionsTags':_0x84ca19+_0x747f('0xf'),'messages':_0x84ca19+_0x747f('0x10'),'userInteractions':'user_has_'+_0x84ca19+_0x747f('0xe')};}function getSelectedTags(_0x303ccb){var _0x2995a7=[];if(_0x303ccb){_0x2995a7=Array['isArray'](_0x303ccb)?_0x303ccb:[_0x303ccb];}return _0x2995a7;}function log(_0x56e2de,_0x59e4ef,_0x30d282,_0x212494,_0x150fbc,_0xfc4b85){loggers[_0x150fbc[_0x747f('0x11')]()][_0x56e2de](_0x747f('0x12'),_0xfc4b85[_0x747f('0x13')](),_0x59e4ef?_0x59e4ef['id']:null,_0x59e4ef?_0x59e4ef[_0x747f('0x14')]:null,_0x59e4ef?_0x59e4ef['role']:null,getInteractionId(_0x30d282,_0x212494,_0x150fbc),_0x30d282?JSON['stringify'](_0x30d282):_0x747f('0x15'));}function updateUser(_0x4ced8b,_0x1632e1,_0x5b909d,_0x4861af,_0x31a8bb){db[_['upperFirst'](_0x4861af)+'Interaction'][_0x747f('0x16')]({'where':{'id':getInteractionId(_0x1632e1,_0x5b909d,_0x4861af)}})['then'](function(_0xcccad){if(_0xcccad){return _0xcccad[_0x747f('0x17')]({'UserId':_0x4ced8b?_0x4ced8b['id']:null});}})[_0x747f('0x18')](function(_0x368e94){if(_0x368e94){log(_0x747f('0x19'),_0x4ced8b,_0x1632e1,_0x5b909d,_0x4861af,_0x31a8bb);}})[_0x747f('0x1a')](function(){log('error',_0x4ced8b,_0x1632e1,_0x5b909d,_0x4861af,_0x31a8bb);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x7557=['null','Interaction','findOne','then','info','catch','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role'];(function(_0x30a28c,_0x4695d1){var _0x313b19=function(_0x3003c7){while(--_0x3003c7){_0x30a28c['push'](_0x30a28c['shift']());}};_0x313b19(++_0x4695d1);}(_0x7557,0x1c2));var _0x7755=function(_0x27b0da,_0x8ffb2b){_0x27b0da=_0x27b0da-0x0;var _0x8eb88e=_0x7557[_0x27b0da];return _0x8eb88e;};'use strict';var _=require(_0x7755('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x7755('0x1'))(_0x7755('0x2')),'mail':require(_0x7755('0x1'))(_0x7755('0x3')),'fax':require(_0x7755('0x1'))(_0x7755('0x4')),'sms':require(_0x7755('0x1'))(_0x7755('0x5')),'chat':require('../../config/logger')(_0x7755('0x6')),'whatsapp':require(_0x7755('0x1'))('whatsapp-interactions')};function getAccountFK(_0x2a7b88){return _[_0x7755('0x7')](_0x2a7b88)+(_0x2a7b88==='chat'?_0x7755('0x8'):_0x7755('0x9'))+'Id';}function getInteractionFK(_0x2135f7){return _[_0x7755('0x7')](_0x2135f7)+_0x7755('0xa');}function getInteractionId(_0x33492c,_0x5a71db,_0x4f570a){if(_0x33492c&&_0x33492c[_['upperFirst'](_0x4f570a)+_0x7755('0xa')]){return _0x33492c[_[_0x7755('0xb')](_0x4f570a)+_0x7755('0xa')];}else if(_0x33492c&&_0x33492c['id']){return _0x33492c['id'];}else if(_0x5a71db&&_0x5a71db['id']){return _0x5a71db['id'];}else{return _0x7755('0xc');}}function getInteractionsTables(_0x132501){return{'accounts':_0x132501+'_'+(_0x132501===_0x7755('0xd')?_0x7755('0xe'):_0x7755('0xf')),'interactions':_0x132501+_0x7755('0x10'),'interactionsTags':_0x132501+_0x7755('0x11'),'messages':_0x132501+_0x7755('0x12'),'userInteractions':_0x7755('0x13')+_0x132501+_0x7755('0x10')};}function getSelectedTags(_0x2e6145){var _0x4bfd16=[];if(_0x2e6145){_0x4bfd16=Array[_0x7755('0x14')](_0x2e6145)?_0x2e6145:[_0x2e6145];}return _0x4bfd16;}function log(_0x1c88a0,_0x315435,_0x569ee6,_0x476737,_0x145387,_0x30986b){loggers[_0x145387[_0x7755('0x15')]()][_0x1c88a0](_0x7755('0x16'),_0x30986b[_0x7755('0x17')](),_0x315435?_0x315435['id']:null,_0x315435?_0x315435[_0x7755('0x18')]:null,_0x315435?_0x315435[_0x7755('0x19')]:null,getInteractionId(_0x569ee6,_0x476737,_0x145387),_0x569ee6?JSON['stringify'](_0x569ee6):_0x7755('0x1a'));}function updateUser(_0x2e5315,_0x36a7ef,_0x5b6568,_0x493abe,_0x517b9a){db[_[_0x7755('0xb')](_0x493abe)+_0x7755('0x1b')][_0x7755('0x1c')]({'where':{'id':getInteractionId(_0x36a7ef,_0x5b6568,_0x493abe)}})['then'](function(_0x584198){if(_0x584198){return _0x584198['update']({'UserId':_0x2e5315?_0x2e5315['id']:null});}})[_0x7755('0x1d')](function(_0x1a7b02){if(_0x1a7b02){log(_0x7755('0x1e'),_0x2e5315,_0x36a7ef,_0x5b6568,_0x493abe,_0x517b9a);}})[_0x7755('0x1f')](function(){log(_0x7755('0x20'),_0x2e5315,_0x36a7ef,_0x5b6568,_0x493abe,_0x517b9a);});}module[_0x7755('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 87418b1..4e9c214 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 _0x8116=['admin','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x58d40b,_0x57c63d){var _0x5c0f6c=function(_0x52fa2a){while(--_0x52fa2a){_0x58d40b['push'](_0x58d40b['shift']());}};_0x5c0f6c(++_0x57c63d);}(_0x8116,0x115));var _0x6811=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8116[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0x6811('0x0'));var util=require(_0x6811('0x1'));var compose=require('composable-middleware');var db=require(_0x6811('0x2'))['db'];var config=require(_0x6811('0x3'));function getValueFromLicense(_0x8e0192,_0x9736dd){if(_0x8e0192&&_0x9736dd){if(_0x9736dd[_0x6811('0x4')]&&_0x9736dd['license']){var _0x5cfb49=_0x9736dd[_0x6811('0x4')];var _0x42d847=_0x9736dd[_0x6811('0x5')];var _0x2595af=_0x5cfb49['split']('-')[0x4];var _0x2793fc=_0x5cfb49[_0x6811('0x6')]('-')[0x0];var _0x1b8b1a=crypto[_0x6811('0x7')](_0x6811('0x8'),util['format']('%s:%s:%s',_0x2595af,_0x5cfb49,_0x2793fc));var _0x1dfc9e=_0x1b8b1a['update'](_0x42d847,_0x6811('0x9'),'utf8');_0x1dfc9e+=_0x1b8b1a['final'](_0x6811('0xa'));var _0x35279d=JSON[_0x6811('0xb')](_0x1dfc9e);return _0x35279d[_0x6811('0xc')](_0x8e0192)?_0x35279d[_0x8e0192]:null;}}return null;}function isLimit(_0x20069a,_0x35b6cf,_0x461a64,_0x2f51f1){var _0x50d4f1=_0x35b6cf;return compose()[_0x6811('0xd')](function(_0x19d616,_0x327650,_0x7eea71){return db[_0x6811('0xe')][_0x6811('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x6811('0x10')](function(_0x126dbc){var _0x2e3093=getValueFromLicense(_0x20069a,_0x126dbc);return _0x2e3093?_0x2e3093:_0x50d4f1;})[_0x6811('0x10')](function(_0x379a07){_0x50d4f1=_0x379a07;return _0x461a64[_0x6811('0x11')](_0x2f51f1);})['then'](function(_0x305962){if(_0x305962>=_0x50d4f1){return _0x327650[_0x6811('0x12')](0x193)[_0x6811('0x13')]({'message':util['format'](_0x6811('0x14'),_0x20069a)});}_0x7eea71();})[_0x6811('0x15')](function(_0x1eb06f){_0x7eea71(_0x1eb06f);});});}function isUserLimit(){return isLimit(_0x6811('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x6811('0x17')},{'role':_0x6811('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x4c41=['catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4c41,0xca));var _0x14c4=function(_0x58f160,_0x103a37){_0x58f160=_0x58f160-0x0;var _0x7ffc10=_0x4c41[_0x58f160];return _0x7ffc10;};'use strict';var crypto=require('crypto');var util=require(_0x14c4('0x0'));var compose=require(_0x14c4('0x1'));var db=require(_0x14c4('0x2'))['db'];var config=require(_0x14c4('0x3'));function getValueFromLicense(_0x5d740d,_0x120302){if(_0x5d740d&&_0x120302){if(_0x120302[_0x14c4('0x4')]&&_0x120302['license']){var _0x35ebc5=_0x120302['data1'];var _0x21de07=_0x120302[_0x14c4('0x5')];var _0x2f2e0f=_0x35ebc5['split']('-')[0x4];var _0x38bea4=_0x35ebc5[_0x14c4('0x6')]('-')[0x0];var _0x2bfcab=crypto[_0x14c4('0x7')](_0x14c4('0x8'),util[_0x14c4('0x9')]('%s:%s:%s',_0x2f2e0f,_0x35ebc5,_0x38bea4));var _0x52192f=_0x2bfcab[_0x14c4('0xa')](_0x21de07,'base64',_0x14c4('0xb'));_0x52192f+=_0x2bfcab[_0x14c4('0xc')](_0x14c4('0xb'));var _0x480100=JSON[_0x14c4('0xd')](_0x52192f);return _0x480100[_0x14c4('0xe')](_0x5d740d)?_0x480100[_0x5d740d]:null;}}return null;}function isLimit(_0x16c5f0,_0x48e930,_0x1b731c,_0x3483db){var _0x31c417=_0x48e930;return compose()[_0x14c4('0xf')](function(_0x2451f7,_0x9adbc4,_0x1ff8e4){return db[_0x14c4('0x10')][_0x14c4('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x14c4('0x12')](function(_0xb6ce5e){var _0x83bde1=getValueFromLicense(_0x16c5f0,_0xb6ce5e);return _0x83bde1?_0x83bde1:_0x31c417;})[_0x14c4('0x12')](function(_0x2288f2){_0x31c417=_0x2288f2;return _0x1b731c[_0x14c4('0x13')](_0x3483db);})[_0x14c4('0x12')](function(_0x24a898){if(_0x24a898>=_0x31c417){return _0x9adbc4[_0x14c4('0x14')](0x193)[_0x14c4('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x16c5f0)});}_0x1ff8e4();})[_0x14c4('0x16')](function(_0x29fcbd){_0x1ff8e4(_0x29fcbd);});});}function isUserLimit(){return isLimit(_0x14c4('0x17'),0x1,db[_0x14c4('0x18')],{'where':{'$or':[{'role':_0x14c4('0x19')},{'role':_0x14c4('0x1a')}]}});}exports[_0x14c4('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 405622b..4508345 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 _0x9f1d=['DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','seconds','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','split','length','forEach','shift','match','filter','map','conditions','buildExpression'];(function(_0x12a14c,_0x1d2f9e){var _0x4089ad=function(_0x4956e5){while(--_0x4956e5){_0x12a14c['push'](_0x12a14c['shift']());}};_0x4089ad(++_0x1d2f9e);}(_0x9f1d,0xea));var _0xd9f1=function(_0x4003dd,_0x126ec2){_0x4003dd=_0x4003dd-0x0;var _0x4e1335=_0x9f1d[_0x4003dd];return _0x4e1335;};'use strict';var _=require('lodash');var moment=require(_0xd9f1('0x0'));exports[_0xd9f1('0x1')]=function(_0x54be71){var _0x1c63d8={'conditions':[]};_0x1c63d8[_0xd9f1('0x2')]=_[_0xd9f1('0x3')](_0x54be71,'[$or]')?'or':_0xd9f1('0x4');var _0x49b579=_0x54be71[_0xd9f1('0x5')](_0xd9f1('0x6'),'')[_0xd9f1('0x5')]('[$or]','')[_0xd9f1('0x7')]('||');for(var _0x40e927=0x0;_0x40e927<_0x49b579[_0xd9f1('0x8')];_0x40e927++){var _0x93baf9=_0x49b579[_0x40e927]['split'](':=');var _0x419521=_0x93baf9[0x0];var _0x43704a=_0x93baf9['slice'](0x1);_0x43704a[_0xd9f1('0x9')](function(_0x584c40){var _0x2ebff0=_0x584c40[_0xd9f1('0x7')]('[')[_0xd9f1('0xa')]();var _0x40877b=_0x584c40[_0xd9f1('0xb')](/\[(.*?)\]/g);_0x40877b[_0xd9f1('0x9')](function(_0x3b5112){var _0x5e7fd5=_0x3b5112[_0xd9f1('0x7')]('[')[_0xd9f1('0xc')](function(_0x2c05af){return _0x2c05af['indexOf'](']')>-0x1;})[_0xd9f1('0xd')](function(_0x4f71d9){return _0x4f71d9[_0xd9f1('0x7')](']')[0x0];})[0x0];_0x1c63d8[_0xd9f1('0xe')]['push']({'field':_0x419521,'operator':_0x2ebff0,'value':_0x5e7fd5});});});}return _0x1c63d8;};exports[_0xd9f1('0xf')]=function(_0x33b44a,_0x178b24,_0x20339e){var _0x7fb7b1={};if(_0x178b24===_0xd9f1('0x10')){if(_0x20339e['operator']===_0xd9f1('0x11')){_0x20339e[_0xd9f1('0x12')]=_0xd9f1('0x13');_0x20339e[_0xd9f1('0x14')]+=','+_0x20339e['value'];}else if(_[_0xd9f1('0x15')]([_0xd9f1('0x16'),_0xd9f1('0x17')],_0x20339e[_0xd9f1('0x12')])){_0x20339e[_0xd9f1('0x14')]=moment(_0x20339e[_0xd9f1('0x14')])[_0xd9f1('0x18')](0x1,_0xd9f1('0x19'))[_0xd9f1('0x1a')](_0xd9f1('0x1b'));}}if(_0x20339e[_0xd9f1('0x1c')]){_0x178b24=_0x20339e[_0xd9f1('0x1c')];_0x7fb7b1[_0xd9f1('0x1d')]='CAST('+_0x33b44a+'.'+_0x20339e[_0xd9f1('0x1e')]+_0xd9f1('0x1f')+_0x20339e[_0xd9f1('0x1c')]+')\x20'+parseOperator(_0x20339e[_0xd9f1('0x12')]);}else{_0x7fb7b1[_0xd9f1('0x1d')]=_0x33b44a+'.'+_0x20339e['field']+'\x20'+parseOperator(_0x20339e[_0xd9f1('0x12')]);}if(_[_0xd9f1('0x15')]([_0xd9f1('0x20'),_0xd9f1('0x21')],_0x20339e[_0xd9f1('0x12')]))_0x7fb7b1[_0xd9f1('0x1d')]='('+_0x7fb7b1[_0xd9f1('0x1d')]+'\x20OR\x20'+_0x33b44a+'.'+_0x20339e['field']+'\x20IS\x20NULL)';_0x7fb7b1[_0xd9f1('0x14')]=parseValue(_0x178b24,_0x20339e['operator'],_0x20339e[_0xd9f1('0x14')]);return _0x7fb7b1;};function parseOperator(_0x22c9c3){var _0x2e47e2;switch(_0x22c9c3){case _0xd9f1('0x22'):_0x2e47e2='IN\x20?';break;case _0xd9f1('0x21'):_0x2e47e2=_0xd9f1('0x23');break;case _0xd9f1('0x11'):_0x2e47e2=_0xd9f1('0x24');break;case _0xd9f1('0x20'):_0x2e47e2=_0xd9f1('0x25');break;case _0xd9f1('0x26'):case _0xd9f1('0x27'):case _0xd9f1('0x28'):_0x2e47e2='LIKE\x20?';break;case _0xd9f1('0x29'):_0x2e47e2=_0xd9f1('0x2a');break;case _0xd9f1('0x16'):_0x2e47e2=_0xd9f1('0x2b');break;case _0xd9f1('0x17'):_0x2e47e2='<=\x20?';break;case _0xd9f1('0x2c'):_0x2e47e2=_0xd9f1('0x2d');break;case _0xd9f1('0x13'):_0x2e47e2='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e47e2;}function parseValue(_0x487edf,_0x10769a,_0x2bbec3){var _0x1e5bd0={'start':undefined,'end':undefined};switch(_0x10769a){case'$in':case _0xd9f1('0x21'):_0x1e5bd0[_0xd9f1('0x2e')]=_0x2bbec3[_0xd9f1('0x7')](',');break;case _0xd9f1('0x26'):_0x1e5bd0[_0xd9f1('0x2e')]='%'+_0x2bbec3+'%';break;case'$startsWith':_0x1e5bd0['start']=_0x2bbec3+'%';break;case _0xd9f1('0x28'):_0x1e5bd0[_0xd9f1('0x2e')]='%'+_0x2bbec3;break;case _0xd9f1('0x13'):var _0x4b0259=_0x2bbec3[_0xd9f1('0x7')](',');var _0x2bbec3=_0x4b0259['shift']();var _0x25186f=_0x4b0259[_0xd9f1('0x2f')]();if(_0x487edf===_0xd9f1('0x10')){_0x2bbec3=moment(_0x2bbec3)[_0xd9f1('0x30')](0x0,!![])[_0xd9f1('0x1a')]();_0x25186f=moment(_0x25186f)[_0xd9f1('0x30')](0x0,!![])[_0xd9f1('0x18')](0x17,'hours')[_0xd9f1('0x18')](0x3b,'minutes')['add'](0x3b,_0xd9f1('0x31'))[_0xd9f1('0x1a')]();}_0x1e5bd0={'start':_0x2bbec3,'end':_0x25186f};break;default:_0x1e5bd0[_0xd9f1('0x2e')]=_0x2bbec3;break;}return _0x1e5bd0;} \ No newline at end of file +var _0x20e7=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','field','$ne','$notIn','\x20OR\x20','IN\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','utcOffset','add','minutes','seconds'];(function(_0x3f7a3d,_0x42dbfa){var _0x272beb=function(_0x151dcb){while(--_0x151dcb){_0x3f7a3d['push'](_0x3f7a3d['shift']());}};_0x272beb(++_0x42dbfa);}(_0x20e7,0x190));var _0x720e=function(_0x10f811,_0x4017d3){_0x10f811=_0x10f811-0x0;var _0x295c81=_0x20e7[_0x10f811];return _0x295c81;};'use strict';var _=require(_0x720e('0x0'));var moment=require(_0x720e('0x1'));exports[_0x720e('0x2')]=function(_0x4d30ba){var _0x3c1d62={'conditions':[]};_0x3c1d62[_0x720e('0x3')]=_[_0x720e('0x4')](_0x4d30ba,_0x720e('0x5'))?'or':_0x720e('0x6');var _0x58ef25=_0x4d30ba[_0x720e('0x7')](_0x720e('0x8'),'')['replace'](_0x720e('0x5'),'')[_0x720e('0x9')]('||');for(var _0xdfd60=0x0;_0xdfd60<_0x58ef25['length'];_0xdfd60++){var _0x8b7d58=_0x58ef25[_0xdfd60][_0x720e('0x9')](':=');var _0x102e22=_0x8b7d58[0x0];var _0x365982=_0x8b7d58['slice'](0x1);_0x365982[_0x720e('0xa')](function(_0x12e352){var _0x19b756=_0x12e352[_0x720e('0x9')]('[')[_0x720e('0xb')]();var _0x1f764b=_0x12e352[_0x720e('0xc')](/\[(.*?)\]/g);_0x1f764b[_0x720e('0xa')](function(_0x5b0545){var _0x33e2de=_0x5b0545['split']('[')[_0x720e('0xd')](function(_0x97e289){return _0x97e289[_0x720e('0xe')](']')>-0x1;})[_0x720e('0xf')](function(_0x319a38){return _0x319a38[_0x720e('0x9')](']')[0x0];})[0x0];_0x3c1d62[_0x720e('0x10')]['push']({'field':_0x102e22,'operator':_0x19b756,'value':_0x33e2de});});});}return _0x3c1d62;};exports[_0x720e('0x11')]=function(_0x20a5c2,_0x3c1d7c,_0x34e67f){var _0x560a2f={};if(_0x3c1d7c===_0x720e('0x12')){if(_0x34e67f[_0x720e('0x13')]===_0x720e('0x14')){_0x34e67f[_0x720e('0x13')]=_0x720e('0x15');_0x34e67f[_0x720e('0x16')]+=','+_0x34e67f[_0x720e('0x16')];}else if(_['includes']([_0x720e('0x17'),_0x720e('0x18')],_0x34e67f[_0x720e('0x13')])){_0x34e67f['value']=moment(_0x34e67f[_0x720e('0x16')])['add'](0x1,_0x720e('0x19'))[_0x720e('0x1a')](_0x720e('0x1b'));}}if(_0x34e67f['castTo']){_0x3c1d7c=_0x34e67f[_0x720e('0x1c')];_0x560a2f[_0x720e('0x1d')]='CAST('+_0x20a5c2+'.'+_0x34e67f['field']+'\x20AS\x20'+_0x34e67f[_0x720e('0x1c')]+')\x20'+parseOperator(_0x34e67f['operator']);}else{_0x560a2f[_0x720e('0x1d')]=_0x20a5c2+'.'+_0x34e67f[_0x720e('0x1e')]+'\x20'+parseOperator(_0x34e67f[_0x720e('0x13')]);}if(_['includes']([_0x720e('0x1f'),_0x720e('0x20')],_0x34e67f['operator']))_0x560a2f['text']='('+_0x560a2f[_0x720e('0x1d')]+_0x720e('0x21')+_0x20a5c2+'.'+_0x34e67f['field']+'\x20IS\x20NULL)';_0x560a2f[_0x720e('0x16')]=parseValue(_0x3c1d7c,_0x34e67f[_0x720e('0x13')],_0x34e67f[_0x720e('0x16')]);return _0x560a2f;};function parseOperator(_0x124224){var _0x18b0a7;switch(_0x124224){case'$in':_0x18b0a7=_0x720e('0x22');break;case _0x720e('0x20'):_0x18b0a7='NOT\x20IN\x20?';break;case'$eq':_0x18b0a7='=\x20?';break;case _0x720e('0x1f'):_0x18b0a7='<>\x20?';break;case _0x720e('0x23'):case _0x720e('0x24'):case'$endsWith':_0x18b0a7=_0x720e('0x25');break;case _0x720e('0x26'):_0x18b0a7=_0x720e('0x27');break;case _0x720e('0x17'):_0x18b0a7=_0x720e('0x28');break;case _0x720e('0x18'):_0x18b0a7='<=\x20?';break;case'$gte':_0x18b0a7=_0x720e('0x29');break;case _0x720e('0x15'):_0x18b0a7=_0x720e('0x2a');break;}return _0x18b0a7;}function parseValue(_0x275542,_0xaf1d8f,_0xfe28a3){var _0x139111={'start':undefined,'end':undefined};switch(_0xaf1d8f){case _0x720e('0x2b'):case _0x720e('0x20'):_0x139111[_0x720e('0x2c')]=_0xfe28a3['split'](',');break;case _0x720e('0x23'):_0x139111[_0x720e('0x2c')]='%'+_0xfe28a3+'%';break;case _0x720e('0x24'):_0x139111[_0x720e('0x2c')]=_0xfe28a3+'%';break;case _0x720e('0x2d'):_0x139111[_0x720e('0x2c')]='%'+_0xfe28a3;break;case _0x720e('0x15'):var _0x1e8418=_0xfe28a3['split'](',');var _0xfe28a3=_0x1e8418[_0x720e('0xb')]();var _0xb657ad=_0x1e8418['pop']();if(_0x275542===_0x720e('0x12')){_0xfe28a3=moment(_0xfe28a3)[_0x720e('0x2e')](0x0,!![])['format']();_0xb657ad=moment(_0xb657ad)['utcOffset'](0x0,!![])[_0x720e('0x2f')](0x17,'hours')['add'](0x3b,_0x720e('0x30'))[_0x720e('0x2f')](0x3b,_0x720e('0x31'))[_0x720e('0x1a')]();}_0x139111={'start':_0xfe28a3,'end':_0xb657ad};break;default:_0x139111[_0x720e('0x2c')]=_0xfe28a3;break;}return _0x139111;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c2677f4..72bf5c2 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 _0x0e85=['type','VIRTUAL','lower','options','lodash','sequelize','keys','parse','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','col','substr','DESC','cast','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','filters','filter','object','includes','columns','value','merge'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0e85,0x7c));var _0x50e8=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x0e85[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x50e8('0x0'));var sequelize=require(_0x50e8('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x11a13a){var _0x682d10=['ne'];try{var _0x55e515=JSON['parse'](_0x11a13a);var _0x4ce6cd=Object[_0x50e8('0x2')](_0x55e515)[0x0];return _0x682d10['includes'](_0x4ce6cd);}catch(_0x3048e3){return![];}}function getOperatorValue(_0x2401b2){var _0xe3151e=JSON[_0x50e8('0x3')](_0x2401b2);var _0x5e8b01=Object[_0x50e8('0x2')](_0xe3151e)[0x0];var _0x108edc=_0xe3151e[_0x5e8b01];return{['$'+_0x5e8b01]:_0x108edc};}exports[_0x50e8('0x4')]=function(_0x988da0){var _0x1fafb0=null;if(_0x988da0){_0x1fafb0=_0x988da0[_0x50e8('0x5')](',');}return _0x1fafb0;};exports['filters']=function(_0x11717c,_0x228ed1){var _0x19d1bc={};if(!_[_0x50e8('0x6')](_0x11717c)){_[_0x50e8('0x7')](_0x11717c,function(_0x194a89,_0x45dc6f){try{if(_0x228ed1){var _0x3d25ea=_['find'](_0x228ed1,{'name':_0x45dc6f})||{};if(hasSequelizeOperator(_0x194a89)){_0x19d1bc[_0x45dc6f]=getOperatorValue(_0x194a89);}else if(_0x3d25ea['type']===_0x50e8('0x8')&&_[_0x50e8('0x9')](_0x194a89)){var _0x508377=JSON['parse'](_0x194a89);var _0x3cb45c={'$gte':moment(moment(_0x508377[_0x50e8('0xa')])[_0x50e8('0xb')](_0x50e8('0xc')))['utc']()[_0x50e8('0xb')](),'$lte':moment(moment(_0x508377[_0x50e8('0xd')])[_0x50e8('0xb')]('YYYY-MM-DD'))['utc']()[_0x50e8('0xe')](0x1,'s')[_0x50e8('0xb')]()};_0x19d1bc[_0x45dc6f]=_0x3cb45c;}else if(_0x3d25ea[_0x50e8('0xf')]===_0x50e8('0x10')){_0x19d1bc[_0x45dc6f]=_0x194a89;}else{_0x19d1bc[_0x45dc6f]=_[_0x50e8('0x11')](_0x194a89)?_0x194a89:JSON[_0x50e8('0x3')](_0x194a89);}}else{_0x19d1bc[_0x45dc6f]=_['isArray'](_0x194a89)?_0x194a89:JSON['parse'](_0x194a89);}}catch(_0x441f25){_0x19d1bc[_0x45dc6f]=_0x194a89[_0x50e8('0x5')](',');}});}return _0x19d1bc;};exports[_0x50e8('0x12')]=function(_0x45ce11){_0x45ce11=parseInt(_0x45ce11,0xa);if(!_0x45ce11||_0x45ce11<0x0){_0x45ce11=LIMIT_VALUE;}return _0x45ce11;};exports[_0x50e8('0x13')]=function(_0x90c54c){_0x90c54c=parseInt(_0x90c54c,0xa);if(!_0x90c54c||_0x90c54c<0x0){_0x90c54c=0x0;}return _0x90c54c;};exports[_0x50e8('0x14')]=function(_0x53e0a1){var _0x415596,_0x55997c=null;if(_0x53e0a1){_0x415596=_0x53e0a1[_0x50e8('0x5')](',');_0x55997c=_[_0x50e8('0x15')](_0x415596,function(_0xd263d){if(_0xd263d[_0x50e8('0x16')]('-')===0x0){return[_0xd263d===_0x50e8('0x17')?sequelize['cast'](sequelize[_0x50e8('0x18')](_0x50e8('0x17')),'unsigned'):_0xd263d[_0x50e8('0x19')](0x1),_0x50e8('0x1a')];}else{return[_0xd263d==='priority'?sequelize[_0x50e8('0x1b')](sequelize[_0x50e8('0x18')]('priority'),'unsigned'):_0xd263d,'ASC'];}});}return _0x55997c;};exports[_0x50e8('0x1c')]=function(_0x160372,_0x124402){if(_[_0x50e8('0x6')](_0x160372)){return _0x160372;}if(_[_0x50e8('0x11')](_0x160372)){for(var _0x13b6e9=0x0;_0x13b6e9<_0x160372['length'];_0x13b6e9+=0x1){_0x160372[_0x13b6e9]=this[_0x50e8('0x1c')](_0x160372[_0x13b6e9],_0x124402);}return _0x160372;}if(!_[_0x50e8('0x1d')](_0x160372)){return _0x160372;}if(_['isString'](_0x124402)){_0x124402=[_0x124402];}if(!_[_0x50e8('0x11')](_0x124402)){return _0x160372;}for(var _0x2bc8d8=0x0;_0x2bc8d8<_0x124402[_0x50e8('0x1e')];_0x2bc8d8+=0x1){_[_0x50e8('0x1f')](_0x160372,_0x124402[_0x2bc8d8]);}for(var _0x4fbf41 in _0x160372){if(_0x160372[_0x50e8('0x20')](_0x4fbf41)){_0x160372[_0x4fbf41]=this['omit'](_0x160372[_0x4fbf41],_0x124402);}}return _0x160372;};exports[_0x50e8('0x21')]=function(_0x39c0c6){return _0x39c0c6[_0x50e8('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x50e8('0x23')]=function(_0x126c99){return _0x126c99[_0x50e8('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x50e8('0x24')]=function(_0x1d77d0){var _0x18aa31=[];_0x1d77d0[_0x50e8('0x5')](/[ ,]+/)['forEach'](function(_0x290fd2){_0x290fd2=_0x290fd2[_0x50e8('0x25')](/([^:]")"+/g,'$1');_0x290fd2='+'+_0x290fd2+'*';var _0x535c24=/[ `!@#$%^&*()_\-?~]/;if(_0x290fd2['match'](_0x535c24))_0x290fd2='\x22'+_0x290fd2+'\x22';_0x18aa31[_0x50e8('0x26')](_0x290fd2);});return _0x18aa31[_0x50e8('0x27')]('\x20');};exports[_0x50e8('0x28')]=function(_0x47ace2,_0x594187,_0x3e58a9){var _0x19e3cc={},_0x5c2e04={};if(_0x594187[_0x50e8('0x29')][_0x50e8('0x2a')]){_0x594187[_0x50e8('0x29')]['id']=_0x594187[_0x50e8('0x29')]['$id'];delete _0x594187[_0x50e8('0x29')]['$id'];}_0x19e3cc[_0x50e8('0x2b')]=_[_0x50e8('0x15')](_0x47ace2,_0x50e8('0xf'));_0x19e3cc['query']=_[_0x50e8('0x2')](_0x594187[_0x50e8('0x29')]);_0x19e3cc['filters']=_[_0x50e8('0x2c')](_0x19e3cc[_0x50e8('0x2b')],_0x19e3cc[_0x50e8('0x29')]);_0x5c2e04[_0x50e8('0x2d')]=_['intersection'](_0x19e3cc[_0x50e8('0x2b')],this[_0x50e8('0x4')](_0x594187[_0x50e8('0x29')][_0x50e8('0x4')]));_0x5c2e04['attributes']=_0x5c2e04[_0x50e8('0x2d')][_0x50e8('0x1e')]?_0x5c2e04[_0x50e8('0x2d')]:_0x19e3cc['model'];if(!_0x594187['query']['hasOwnProperty'](_0x50e8('0x2e'))){_0x5c2e04[_0x50e8('0x12')]=this[_0x50e8('0x12')](_0x594187[_0x50e8('0x29')][_0x50e8('0x12')]);_0x5c2e04[_0x50e8('0x13')]=this[_0x50e8('0x13')](_0x594187[_0x50e8('0x29')][_0x50e8('0x13')]);}_0x5c2e04[_0x50e8('0x2f')]=this['sort'](_0x594187[_0x50e8('0x29')][_0x50e8('0x14')]);_0x5c2e04[_0x50e8('0x30')]=this[_0x50e8('0x31')](_['pick'](_0x594187[_0x50e8('0x29')],_0x19e3cc[_0x50e8('0x31')]),_0x47ace2);if(_0x594187[_0x50e8('0x29')][_0x50e8('0x32')]){var _0x8e8a97=_0x47ace2;var _0x5c7bef=_0x594187['query'][_0x50e8('0x32')];if(typeof _0x5c7bef===_0x50e8('0x33')){_0x8e8a97=_['filter'](_0x47ace2,function(_0x2ebd77){return _[_0x50e8('0x34')](_0x5c7bef[_0x50e8('0x35')],_0x2ebd77[_0x50e8('0xf')]);});_0x5c7bef=_0x5c7bef[_0x50e8('0x36')];}_0x5c2e04[_0x50e8('0x30')]=_[_0x50e8('0x37')](_0x5c2e04[_0x50e8('0x30')],{'$or':_['map'](_0x8e8a97,function(_0x3d26bd){if(_0x3d26bd[_0x50e8('0x38')]!==_0x50e8('0x39')){if(_0x3e58a9){return sequelize[_0x50e8('0x30')](sequelize['fn']('lower',sequelize[_0x50e8('0x18')](_0x3d26bd[_0x50e8('0xf')])),{'$like':sequelize['fn'](_0x50e8('0x3a'),'%'+_0x594187[_0x50e8('0x29')]['filter']+'%')});}else{var _0x21dfbf={};_0x21dfbf[_0x3d26bd['name']]={'$like':'%'+_0x594187['query']['filter']+'%'};return _0x21dfbf;}}})});}_0x5c2e04=_[_0x50e8('0x37')]({},_0x5c2e04,_0x594187[_0x50e8('0x3b')]);return _0x5c2e04;}; \ No newline at end of file +var _0x7bae=['omit','isObject','isString','length','unset','match','^[+]?[0-9]*$','getFullTextValue','replace','getOptions','query','$id','model','name','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','merge','type','VIRTUAL','lower','options','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast'];(function(_0x22d1c5,_0x3a3182){var _0x188c2a=function(_0x4c9f56){while(--_0x4c9f56){_0x22d1c5['push'](_0x22d1c5['shift']());}};_0x188c2a(++_0x3a3182);}(_0x7bae,0x13b));var _0xe7ba=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x7bae[_0x28d18d];return _0x470640;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xe7ba('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1e05c4){var _0x503803=['ne'];try{var _0x3963c7=JSON['parse'](_0x1e05c4);var _0x120efa=Object[_0xe7ba('0x1')](_0x3963c7)[0x0];return _0x503803[_0xe7ba('0x2')](_0x120efa);}catch(_0x2276df){return![];}}function getOperatorValue(_0x398a6a){var _0xfd3a22=JSON[_0xe7ba('0x3')](_0x398a6a);var _0x3c5e59=Object[_0xe7ba('0x1')](_0xfd3a22)[0x0];var _0x34fb18=_0xfd3a22[_0x3c5e59];return{['$'+_0x3c5e59]:_0x34fb18};}exports[_0xe7ba('0x4')]=function(_0x27b1d5){var _0x41c39d=null;if(_0x27b1d5){_0x41c39d=_0x27b1d5[_0xe7ba('0x5')](',');}return _0x41c39d;};exports['filters']=function(_0x3df8bf,_0xe57e33){var _0x375ebb={};if(!_[_0xe7ba('0x6')](_0x3df8bf)){_[_0xe7ba('0x7')](_0x3df8bf,function(_0x1672f0,_0x99a86f){try{if(_0xe57e33){var _0x448bcc=_[_0xe7ba('0x8')](_0xe57e33,{'name':_0x99a86f})||{};if(hasSequelizeOperator(_0x1672f0)){_0x375ebb[_0x99a86f]=getOperatorValue(_0x1672f0);}else if(_0x448bcc['type']===_0xe7ba('0x9')&&_['isPlainObject'](_0x1672f0)){var _0x602b1=JSON[_0xe7ba('0x3')](_0x1672f0);var _0x390596={'$gte':moment(moment(_0x602b1[_0xe7ba('0xa')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()['format'](),'$lte':moment(moment(_0x602b1[_0xe7ba('0xd')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()[_0xe7ba('0xe')](0x1,'s')['format']()};_0x375ebb[_0x99a86f]=_0x390596;}else if(_0x448bcc['name']==='uniqueid'){_0x375ebb[_0x99a86f]=_0x1672f0;}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}catch(_0x4e3021){_0x375ebb[_0x99a86f]=_0x1672f0['split'](',');}});}return _0x375ebb;};exports[_0xe7ba('0x10')]=function(_0x30086c){_0x30086c=parseInt(_0x30086c,0xa);if(!_0x30086c||_0x30086c<0x0){_0x30086c=LIMIT_VALUE;}return _0x30086c;};exports[_0xe7ba('0x11')]=function(_0x3c06c3){_0x3c06c3=parseInt(_0x3c06c3,0xa);if(!_0x3c06c3||_0x3c06c3<0x0){_0x3c06c3=0x0;}return _0x3c06c3;};exports[_0xe7ba('0x12')]=function(_0x58550c){var _0x149c62,_0x20c653=null;if(_0x58550c){_0x149c62=_0x58550c[_0xe7ba('0x5')](',');_0x20c653=_[_0xe7ba('0x13')](_0x149c62,function(_0x4aaf35){if(_0x4aaf35[_0xe7ba('0x14')]('-')===0x0){return[_0x4aaf35===_0xe7ba('0x15')?sequelize['cast'](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35[_0xe7ba('0x18')](0x1),_0xe7ba('0x19')];}else{return[_0x4aaf35===_0xe7ba('0x15')?sequelize[_0xe7ba('0x1a')](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35,'ASC'];}});}return _0x20c653;};exports['omit']=function(_0x4dcc7b,_0x4cd124){if(_[_0xe7ba('0x6')](_0x4dcc7b)){return _0x4dcc7b;}if(_['isArray'](_0x4dcc7b)){for(var _0x4ecc0d=0x0;_0x4ecc0d<_0x4dcc7b['length'];_0x4ecc0d+=0x1){_0x4dcc7b[_0x4ecc0d]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x4ecc0d],_0x4cd124);}return _0x4dcc7b;}if(!_[_0xe7ba('0x1c')](_0x4dcc7b)){return _0x4dcc7b;}if(_[_0xe7ba('0x1d')](_0x4cd124)){_0x4cd124=[_0x4cd124];}if(!_[_0xe7ba('0xf')](_0x4cd124)){return _0x4dcc7b;}for(var _0x3435c6=0x0;_0x3435c6<_0x4cd124[_0xe7ba('0x1e')];_0x3435c6+=0x1){_[_0xe7ba('0x1f')](_0x4dcc7b,_0x4cd124[_0x3435c6]);}for(var _0x3a59d6 in _0x4dcc7b){if(_0x4dcc7b['hasOwnProperty'](_0x3a59d6)){_0x4dcc7b[_0x3a59d6]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x3a59d6],_0x4cd124);}}return _0x4dcc7b;};exports['isNumeric']=function(_0x102925){return _0x102925[_0xe7ba('0x20')](RegExp(_0xe7ba('0x21')))?!![]:![];};exports['isEmail']=function(_0x587c7d){return _0x587c7d[_0xe7ba('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xe7ba('0x22')]=function(_0x8d5020){var _0x20b6cd=[];_0x8d5020[_0xe7ba('0x5')](/[ ,]+/)['forEach'](function(_0x37911d){_0x37911d=_0x37911d[_0xe7ba('0x23')](/([^:]")"+/g,'$1');_0x37911d='+'+_0x37911d+'*';var _0x5b5ff3=/[ `!@#$%^&*()_\-?~]/;if(_0x37911d[_0xe7ba('0x20')](_0x5b5ff3))_0x37911d='\x22'+_0x37911d+'\x22';_0x20b6cd['push'](_0x37911d);});return _0x20b6cd['join']('\x20');};exports[_0xe7ba('0x24')]=function(_0x134f21,_0x1be947,_0x52f90e){var _0x3b14b4={},_0x4ccdc7={};if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')]){_0x1be947[_0xe7ba('0x25')]['id']=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')];delete _0x1be947['query'][_0xe7ba('0x26')];}_0x3b14b4[_0xe7ba('0x27')]=_['map'](_0x134f21,_0xe7ba('0x28'));_0x3b14b4[_0xe7ba('0x25')]=_[_0xe7ba('0x1')](_0x1be947['query']);_0x3b14b4[_0xe7ba('0x29')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],_0x3b14b4[_0xe7ba('0x25')]);_0x4ccdc7[_0xe7ba('0x2b')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],this[_0xe7ba('0x4')](_0x1be947[_0xe7ba('0x25')]['fields']));_0x4ccdc7[_0xe7ba('0x2b')]=_0x4ccdc7[_0xe7ba('0x2b')][_0xe7ba('0x1e')]?_0x4ccdc7['attributes']:_0x3b14b4['model'];if(!_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x2c')](_0xe7ba('0x2d'))){_0x4ccdc7[_0xe7ba('0x10')]=this[_0xe7ba('0x10')](_0x1be947['query'][_0xe7ba('0x10')]);_0x4ccdc7[_0xe7ba('0x11')]=this[_0xe7ba('0x11')](_0x1be947[_0xe7ba('0x25')]['offset']);}_0x4ccdc7[_0xe7ba('0x2e')]=this[_0xe7ba('0x12')](_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x12')]);_0x4ccdc7[_0xe7ba('0x2f')]=this[_0xe7ba('0x29')](_[_0xe7ba('0x30')](_0x1be947['query'],_0x3b14b4[_0xe7ba('0x29')]),_0x134f21);if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]){var _0x401b0a=_0x134f21;var _0xf61205=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')];if(typeof _0xf61205===_0xe7ba('0x32')){_0x401b0a=_[_0xe7ba('0x31')](_0x134f21,function(_0x50792c){return _[_0xe7ba('0x2')](_0xf61205[_0xe7ba('0x33')],_0x50792c['name']);});_0xf61205=_0xf61205['value'];}_0x4ccdc7[_0xe7ba('0x2f')]=_[_0xe7ba('0x34')](_0x4ccdc7[_0xe7ba('0x2f')],{'$or':_['map'](_0x401b0a,function(_0x249e1d){if(_0x249e1d[_0xe7ba('0x35')]!==_0xe7ba('0x36')){if(_0x52f90e){return sequelize[_0xe7ba('0x2f')](sequelize['fn'](_0xe7ba('0x37'),sequelize['col'](_0x249e1d[_0xe7ba('0x28')])),{'$like':sequelize['fn']('lower','%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%')});}else{var _0xe0f1c3={};_0xe0f1c3[_0x249e1d[_0xe7ba('0x28')]]={'$like':'%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%'};return _0xe0f1c3;}}})});}_0x4ccdc7=_[_0xe7ba('0x34')]({},_0x4ccdc7,_0x1be947[_0xe7ba('0x38')]);return _0x4ccdc7;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index a2d9447..0af0152 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2172=['map','findOne','all','uniq','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','chatPause','mailPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','value','filterAgentAttributes','lodash','../../mysqldb','client','http','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','unknown','unavailable','ringing','voiceStatus','idle','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','Queue'];(function(_0x3e83f1,_0x1b09ae){var _0x28cd96=function(_0x2ffc3e){while(--_0x2ffc3e){_0x3e83f1['push'](_0x3e83f1['shift']());}};_0x28cd96(++_0x1b09ae);}(_0x2172,0x198));var _0x2217=function(_0x3f3dd7,_0xc3bb97){_0x3f3dd7=_0x3f3dd7-0x0;var _0x368819=_0x2172[_0x3f3dd7];return _0x368819;};'use strict';var _=require(_0x2217('0x0'));var jayson=require('jayson/promise');var db=require(_0x2217('0x1'))['db'];var amiClient=jayson[_0x2217('0x2')][_0x2217('0x3')]({'port':0x232a});var routingClient=jayson[_0x2217('0x2')][_0x2217('0x3')]({'port':0x232c});function isAgentPaused(_0x24b6fb,_0x1d898d){var _0x5a56ed=[_0x24b6fb['chatPause'],_0x24b6fb[_0x2217('0x4')],_0x24b6fb['mailPause'],_0x24b6fb[_0x2217('0x5')],_0x24b6fb[_0x2217('0x6')],_0x24b6fb[_0x2217('0x7')],_0x24b6fb[_0x2217('0x8')]];if(!_0x1d898d)return _[_0x2217('0x9')](_0x5a56ed);var _0x5550af=_['filter'](_0x5a56ed);return _0x5550af['length']>0x0&&_0x5550af[_0x2217('0xa')]<_0x5a56ed['length']?!![]:![];}function isIdle(_0x1e9cfd){return _0x1e9cfd==='idle'||_0x1e9cfd===_0x2217('0xb')||_0x1e9cfd===_0x2217('0xc')||_0x1e9cfd===_0x2217('0xd')||_['isNil'](_0x1e9cfd);}function isAgentIdle(_0x42a516){if(_0x42a516[_0x2217('0xe')]!==_0x2217('0xf')&&_0x42a516[_0x2217('0x7')]){_0x42a516[_0x2217('0xe')]='pause';return![];}return _[_0x2217('0x9')]([_0x42a516[_0x2217('0x10')],_0x42a516[_0x2217('0x11')],_0x42a516[_0x2217('0x12')],_0x42a516[_0x2217('0x13')],_0x42a516['smsStatus'],_0x42a516[_0x2217('0xe')],_0x42a516[_0x2217('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2217('0x15')](_0x2217('0x16'),{})[_0x2217('0x17')](function(_0x47d081){if(_0x47d081[_0x2217('0x18')]){throw new Error(_0x2217('0x19'));}var _0x3dd668=_0x47d081['result'];return routingClient[_0x2217('0x15')](_0x2217('0x16'),{})['then'](function(_0x4a979f){if(_0x4a979f[_0x2217('0x18')]){throw new Error(_0x2217('0x1a'));}var _0x4bd5ed=_0x4a979f[_0x2217('0x1b')];return _[_0x2217('0x1c')]({},_0x3dd668,_0x4bd5ed);});})[_0x2217('0x1d')](function(_0x5083e5){throw _0x5083e5;});}exports[_0x2217('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3a3ec0){var _0x2e4186=_0x2217('0xb');if(isAgentPaused(_0x3a3ec0))_0x2e4186=_0x2217('0x1f');else if(isAgentPaused(_0x3a3ec0,!![]))_0x2e4186=_0x2217('0x20');else if(isAgentIdle(_0x3a3ec0))_0x2e4186=_0x2217('0xf');else _0x2e4186=_0x2217('0x21');return _0x2e4186;}exports[_0x2217('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0xe55555,_0x55acb2){var _0x20298d=_[_0x2217('0x23')](_0xe55555)?_0xe55555:[_0xe55555];var _0x31e510=_['startCase'](_0x55acb2)+_0x2217('0x24');var _0x31d7cb=_[_0x2217('0x25')](_0x20298d,function(_0x4b14bd){return db[_0x31e510][_0x2217('0x26')]({'where':{'id':_0x4b14bd}})['then'](function(_0x3669b1){if(!_0x3669b1)return[];return _0x3669b1['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x2217('0x27')](_0x31d7cb)[_0x2217('0x17')](function(_0x5de508){var _0x2a90ee=_(_0x5de508)['flatten']()[_0x2217('0x25')]('id')[_0x2217('0x28')]()['value']();return _0x2a90ee;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3d68f5,_0x3ea1b6,_0x43a763){try{if(_0x3ea1b6[_0x2217('0xa')]>0x0){_0x3d68f5=_0x3d68f5[_0x2217('0x29')](function(_0x1a99e8){return _0x3ea1b6[_0x2217('0x2a')](_0x1a99e8['id']);});}var _0x5233f5=_0x3d68f5['filter'](function(_0x45f59d){var _0x4ed4e6='busy';if(isAgentIdle(_0x45f59d)){_0x4ed4e6=_0x2217('0xf');}return _0x4ed4e6===_0x43a763;});return _[_0x2217('0x25')](_0x5233f5,'id');}catch(_0x439265){throw _0x439265;}}exports[_0x2217('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f3cf5,_0x24c6e0,_0x383ab5){return Promise[_0x2217('0x2c')]()[_0x2217('0x17')](function(){if(_0x24c6e0['length']>0x0){_0x2f3cf5=_0x2f3cf5[_0x2217('0x29')](function(_0x42ea80){return _0x24c6e0['includes'](_0x42ea80['id']);});}return _0x2f3cf5;})[_0x2217('0x17')](function(){return db[_0x2217('0x2d')][_0x2217('0x2e')]({'attributes':['id',_0x2217('0x2f'),'fullname',_0x2217('0x30'),_0x2217('0x4'),_0x2217('0x31'),_0x2217('0x5'),_0x2217('0x6'),_0x2217('0x7'),'whatsappPause',_0x2217('0x32')],'where':{'id':{'$in':_[_0x2217('0x25')](_0x2f3cf5,'id')}},'raw':!![]});})[_0x2217('0x17')](function(_0x5c3258){return _0x5c3258[_0x2217('0x25')](function(_0x36df06){var _0x5b5403=_[_0x2217('0x33')](_0x2f3cf5,['id',_0x36df06['id']]);var _0x3b287f=filterAgentAttributes(_0x5b5403);_[_0x2217('0x1c')](_0x36df06,_0x3b287f);_0x36df06[_0x2217('0x34')]=getAgentStatus(_0x36df06);return _0x36df06;});})['then'](function(_0x2fbc8e){var _0x3bd611=sortAgentsByStatus(_0x2fbc8e,_0x383ab5);return _[_0x2217('0x25')](_0x3bd611,'id');})[_0x2217('0x1d')](function(_0x122660){throw _0x122660;});}exports[_0x2217('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x31f85e){var _0x14b10b={'fields':[],'order':null};var _0x2bafe9=_0x31f85e['split'](',');_0x14b10b['fields']=_[_0x2217('0x29')](_0x2bafe9,function(_0xa0d12e){if(!_0xa0d12e['includes']('globalStatus')){return!![];}_0x14b10b[_0x2217('0x36')]=_[_0x2217('0x37')](_0xa0d12e,'-')?_0x2217('0x38'):_0x2217('0x39');return![];});return _0x14b10b;}exports[_0x2217('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x16ff52){if(_0x16ff52['includes'](_0x2217('0x3b'))&&!_0x16ff52['includes']('internal')){var _0x5abb99=_0x16ff52[_0x2217('0x3c')](0x0,_0x16ff52[_0x2217('0x3d')](_0x2217('0x3b')));_0x16ff52+=','+_0x5abb99+_0x2217('0x3e');}return _0x16ff52;}exports[_0x2217('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x3c6e2d,_0x55694b){var _0x6533ef=_0x3c6e2d[_0x2217('0x40')](function(_0x44c120,_0x4cd9dd){if(_0x44c120[_0x2217('0x34')]===_0x4cd9dd[_0x2217('0x34')]){if(_0x44c120['globalStatus']===_0x2217('0x1f')){if(_0x55694b===_0x2217('0x38')){return(_0x44c120[_0x2217('0x32')]||'')<(_0x4cd9dd['pauseType']||'')||_0x44c120['fullname'][_0x2217('0x41')]()>_0x4cd9dd[_0x2217('0x3b')][_0x2217('0x41')]()?0x1:-0x1;}else{return(_0x44c120['pauseType']||'')<(_0x4cd9dd[_0x2217('0x32')]||'')||_0x44c120[_0x2217('0x3b')][_0x2217('0x41')]()>_0x4cd9dd[_0x2217('0x3b')][_0x2217('0x41')]()?-0x1:0x1;}}else{if(_0x55694b===_0x2217('0x38')){return _0x44c120[_0x2217('0x3b')][_0x2217('0x41')]()<_0x4cd9dd[_0x2217('0x3b')][_0x2217('0x41')]()?0x1:-0x1;}else{return _0x44c120[_0x2217('0x3b')][_0x2217('0x41')]()<_0x4cd9dd[_0x2217('0x3b')][_0x2217('0x41')]()?-0x1:0x1;}}}else{if(_0x55694b===_0x2217('0x38')){return _0x44c120[_0x2217('0x34')]<_0x4cd9dd['globalStatus']?0x1:-0x1;}else{return _0x44c120['globalStatus']<_0x4cd9dd[_0x2217('0x34')]?-0x1:0x1;}}});return _0x6533ef;}exports[_0x2217('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x5e5d5a){var _0x2b7d1c=[_0x2217('0x43'),'online',_0x2217('0x44'),_0x2217('0x45'),_0x2217('0x32'),_0x2217('0x45'),_0x2217('0x3e'),'address','chatPause',_0x2217('0x5'),_0x2217('0x31'),'smsPause','whatsappPause',_0x2217('0x4'),'voicePause',_0x2217('0x46'),_0x2217('0x47'),_0x2217('0x48'),'smsCapacity',_0x2217('0x49'),_0x2217('0x4a'),'chatCurrentCapacity',_0x2217('0x4b'),'mailCurrentCapacity','smsCurrentCapacity',_0x2217('0x4c'),'faxCurrentCapacity','chatStatus','openchannelStatus',_0x2217('0x12'),'smsStatus',_0x2217('0x14'),_0x2217('0x11'),_0x2217('0xe'),'chatStatusTime',_0x2217('0x4d'),'mailStatusTime','smsStatusTime',_0x2217('0x4e'),_0x2217('0x4f'),'voiceStatusTime',_0x2217('0x50'),_0x2217('0x51'),_0x2217('0x52'),_0x2217('0x53'),_0x2217('0x54'),'routealias'];var _0x490694=[_0x2217('0x30'),_0x2217('0x5'),'mailPause',_0x2217('0x6'),_0x2217('0x8'),'faxPause',_0x2217('0x7'),_0x2217('0x55')];var _0x200bcc=_(_0x5e5d5a)[_0x2217('0x56')](_0x490694)['pick'](_0x2b7d1c)[_0x2217('0x57')]();return _0x200bcc;}exports[_0x2217('0x58')]=filterAgentAttributes; \ No newline at end of file +var _0x344a=['all','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','includes','findAll','fullname','openchannelPause','smsPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','address','faxPause','chatCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','mailPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','result','Agents','error','merge','getRealtimeAgents','*pause','busy','getAgentStatus','Queue','map','findOne','getAgents'];(function(_0x5485c0,_0x439323){var _0x59970a=function(_0x4b1361){while(--_0x4b1361){_0x5485c0['push'](_0x5485c0['shift']());}};_0x59970a(++_0x439323);}(_0x344a,0x146));var _0xa344=function(_0x109c14,_0x418427){_0x109c14=_0x109c14-0x0;var _0x265c10=_0x344a[_0x109c14];return _0x265c10;};'use strict';var _=require(_0xa344('0x0'));var jayson=require(_0xa344('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa344('0x2')][_0xa344('0x3')]({'port':0x232a});var routingClient=jayson[_0xa344('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x314b7f,_0x2c31cd){var _0x2be95a=[_0x314b7f[_0xa344('0x4')],_0x314b7f['faxPause'],_0x314b7f[_0xa344('0x5')],_0x314b7f['openchannelPause'],_0x314b7f['smsPause'],_0x314b7f[_0xa344('0x6')],_0x314b7f[_0xa344('0x7')]];if(!_0x2c31cd)return _[_0xa344('0x8')](_0x2be95a);var _0x4e3e16=_[_0xa344('0x9')](_0x2be95a);return _0x4e3e16[_0xa344('0xa')]>0x0&&_0x4e3e16['length']<_0x2be95a['length']?!![]:![];}function isIdle(_0x411cf6){return _0x411cf6==='idle'||_0x411cf6===_0xa344('0xb')||_0x411cf6===_0xa344('0xc')||_0x411cf6===_0xa344('0xd')||_[_0xa344('0xe')](_0x411cf6);}function isAgentIdle(_0x2a3249){if(_0x2a3249[_0xa344('0xf')]!==_0xa344('0x10')&&_0x2a3249[_0xa344('0x6')]){_0x2a3249[_0xa344('0xf')]=_0xa344('0x11');return![];}return _['every']([_0x2a3249[_0xa344('0x12')],_0x2a3249[_0xa344('0x13')],_0x2a3249[_0xa344('0x14')],_0x2a3249[_0xa344('0x15')],_0x2a3249[_0xa344('0x16')],_0x2a3249[_0xa344('0xf')],_0x2a3249[_0xa344('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa344('0x18')]('Agents',{})[_0xa344('0x19')](function(_0x5951a4){if(_0x5951a4['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x19ff22=_0x5951a4[_0xa344('0x1a')];return routingClient[_0xa344('0x18')](_0xa344('0x1b'),{})[_0xa344('0x19')](function(_0x4ae63b){if(_0x4ae63b[_0xa344('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x40c3d1=_0x4ae63b['result'];return _[_0xa344('0x1d')]({},_0x19ff22,_0x40c3d1);});})['catch'](function(_0x6f20fb){throw _0x6f20fb;});}exports[_0xa344('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x30d21c){var _0x30d279=_0xa344('0xb');if(isAgentPaused(_0x30d21c))_0x30d279=_0xa344('0x11');else if(isAgentPaused(_0x30d21c,!![]))_0x30d279=_0xa344('0x1f');else if(isAgentIdle(_0x30d21c))_0x30d279=_0xa344('0x10');else _0x30d279=_0xa344('0x20');return _0x30d279;}exports[_0xa344('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x5a391f,_0x5c8f66){var _0x309251=_['isArray'](_0x5a391f)?_0x5a391f:[_0x5a391f];var _0x5eff87=_['startCase'](_0x5c8f66)+_0xa344('0x22');var _0x594d51=_[_0xa344('0x23')](_0x309251,function(_0x31dbe1){return db[_0x5eff87][_0xa344('0x24')]({'where':{'id':_0x31dbe1}})[_0xa344('0x19')](function(_0x5d1288){if(!_0x5d1288)return[];return _0x5d1288[_0xa344('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa344('0x26')](_0x594d51)[_0xa344('0x19')](function(_0x419d25){var _0x340528=_(_0x419d25)['flatten']()[_0xa344('0x23')]('id')['uniq']()[_0xa344('0x27')]();return _0x340528;});}exports[_0xa344('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x173dbb,_0x278cea,_0x397fed){try{if(_0x278cea[_0xa344('0xa')]>0x0){_0x173dbb=_0x173dbb[_0xa344('0x9')](function(_0xe4fba9){return _0x278cea['includes'](_0xe4fba9['id']);});}var _0x57f7e9=_0x173dbb['filter'](function(_0x17afa0){var _0xe6b55e='busy';if(isAgentIdle(_0x17afa0)){_0xe6b55e=_0xa344('0x10');}return _0xe6b55e===_0x397fed;});return _[_0xa344('0x23')](_0x57f7e9,'id');}catch(_0x474bfa){throw _0x474bfa;}}exports[_0xa344('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1ccf28,_0x228563,_0x27110c){return Promise[_0xa344('0x2a')]()['then'](function(){if(_0x228563[_0xa344('0xa')]>0x0){_0x1ccf28=_0x1ccf28[_0xa344('0x9')](function(_0x57f4a1){return _0x228563[_0xa344('0x2b')](_0x57f4a1['id']);});}return _0x1ccf28;})[_0xa344('0x19')](function(){return db['User'][_0xa344('0x2c')]({'attributes':['id','name',_0xa344('0x2d'),_0xa344('0x4'),'faxPause',_0xa344('0x5'),_0xa344('0x2e'),_0xa344('0x2f'),_0xa344('0x6'),_0xa344('0x7'),_0xa344('0x30')],'where':{'id':{'$in':_[_0xa344('0x23')](_0x1ccf28,'id')}},'raw':!![]});})[_0xa344('0x19')](function(_0x3bbd6d){return _0x3bbd6d['map'](function(_0x59d110){var _0x2e9d55=_[_0xa344('0x31')](_0x1ccf28,['id',_0x59d110['id']]);var _0x17f059=filterAgentAttributes(_0x2e9d55);_[_0xa344('0x1d')](_0x59d110,_0x17f059);_0x59d110[_0xa344('0x32')]=getAgentStatus(_0x59d110);return _0x59d110;});})[_0xa344('0x19')](function(_0x2a21c2){var _0x581eac=sortAgentsByStatus(_0x2a21c2,_0x27110c);return _[_0xa344('0x23')](_0x581eac,'id');})[_0xa344('0x33')](function(_0x412d56){throw _0x412d56;});}exports[_0xa344('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1efffc){var _0x49aa39={'fields':[],'order':null};var _0x4fe144=_0x1efffc[_0xa344('0x35')](',');_0x49aa39[_0xa344('0x36')]=_[_0xa344('0x9')](_0x4fe144,function(_0x3a51a1){if(!_0x3a51a1[_0xa344('0x2b')](_0xa344('0x32'))){return!![];}_0x49aa39[_0xa344('0x37')]=_[_0xa344('0x38')](_0x3a51a1,'-')?'DESC':'ASC';return![];});return _0x49aa39;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x11f520){if(_0x11f520[_0xa344('0x2b')]('fullname')&&!_0x11f520[_0xa344('0x2b')](_0xa344('0x39'))){var _0x116500=_0x11f520[_0xa344('0x3a')](0x0,_0x11f520[_0xa344('0x3b')](_0xa344('0x2d')));_0x11f520+=','+_0x116500+_0xa344('0x39');}return _0x11f520;}exports[_0xa344('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x1d6944,_0xcae537){var _0x266905=_0x1d6944[_0xa344('0x3d')](function(_0x483de9,_0x55a630){if(_0x483de9['globalStatus']===_0x55a630['globalStatus']){if(_0x483de9[_0xa344('0x32')]===_0xa344('0x11')){if(_0xcae537===_0xa344('0x3e')){return(_0x483de9['pauseType']||'')<(_0x55a630['pauseType']||'')||_0x483de9[_0xa344('0x2d')][_0xa344('0x3f')]()>_0x55a630[_0xa344('0x2d')][_0xa344('0x3f')]()?0x1:-0x1;}else{return(_0x483de9[_0xa344('0x30')]||'')<(_0x55a630[_0xa344('0x30')]||'')||_0x483de9[_0xa344('0x2d')][_0xa344('0x3f')]()>_0x55a630['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0xcae537===_0xa344('0x3e')){return _0x483de9[_0xa344('0x2d')][_0xa344('0x3f')]()<_0x55a630[_0xa344('0x2d')][_0xa344('0x3f')]()?0x1:-0x1;}else{return _0x483de9[_0xa344('0x2d')]['toLowerCase']()<_0x55a630['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0xcae537===_0xa344('0x3e')){return _0x483de9[_0xa344('0x32')]<_0x55a630['globalStatus']?0x1:-0x1;}else{return _0x483de9[_0xa344('0x32')]<_0x55a630[_0xa344('0x32')]?-0x1:0x1;}}});return _0x266905;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3615b7){var _0x43ea27=[_0xa344('0x40'),_0xa344('0x41'),_0xa344('0x42'),_0xa344('0x43'),_0xa344('0x30'),_0xa344('0x43'),'internal',_0xa344('0x44'),_0xa344('0x4'),_0xa344('0x2e'),_0xa344('0x5'),'smsPause','whatsappPause',_0xa344('0x45'),_0xa344('0x6'),_0xa344('0x46'),'openchannelCapacity','mailCapacity','smsCapacity',_0xa344('0x47'),_0xa344('0x48'),_0xa344('0x49'),_0xa344('0x4a'),_0xa344('0x4b'),_0xa344('0x4c'),_0xa344('0x4d'),'faxCurrentCapacity','chatStatus','openchannelStatus',_0xa344('0x14'),_0xa344('0x16'),'whatsappStatus','faxStatus','voiceStatus',_0xa344('0x4e'),'openchannelStatusTime','mailStatusTime',_0xa344('0x4f'),_0xa344('0x50'),_0xa344('0x51'),_0xa344('0x52'),_0xa344('0x53'),'destconnectedlinenum',_0xa344('0x54'),_0xa344('0x55'),_0xa344('0x56'),_0xa344('0x57')];var _0x4ffca4=[_0xa344('0x4'),_0xa344('0x2e'),_0xa344('0x5'),_0xa344('0x2f'),_0xa344('0x7'),_0xa344('0x45'),'voicePause','online'];var _0x35466a=_(_0x3615b7)[_0xa344('0x58')](_0x4ffca4)[_0xa344('0x59')](_0x43ea27)[_0xa344('0x27')]();return _0x35466a;}exports[_0xa344('0x5a')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 277cc89..fd3d18c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x29a1bb,_0x52859d){var _0x19f85e=function(_0x1b1000){while(--_0x1b1000){_0x29a1bb['push'](_0x29a1bb['shift']());}};_0x19f85e(++_0x52859d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5bfee6,_0x3e9443){var _0x4aad05=function(_0x5ab2da){while(--_0x5ab2da){_0x5bfee6['push'](_0x5bfee6['shift']());}};_0x4aad05(++_0x3e9443);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c96e8af..00e20d1 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 _0xaa3c=['execSync','../environment','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','createHash','digest','hex','substring','crypto','bimedia-machine-uuid'];(function(_0x3a895d,_0x44ee26){var _0x4552af=function(_0x117d3a){while(--_0x117d3a){_0x3a895d['push'](_0x3a895d['shift']());}};_0x4552af(++_0x44ee26);}(_0xaa3c,0x64));var _0xcaa3=function(_0x20df61,_0x5c6d1c){_0x20df61=_0x20df61-0x0;var _0x18b41a=_0xaa3c[_0x20df61];return _0x18b41a;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xcaa3('0x0'));var machine=require(_0xcaa3('0x1'));var exec=require('child_process')[_0xcaa3('0x2')];var config=require(_0xcaa3('0x3'));function getInterfaces(){var _0x497efa=[];var _0xedc80=os['networkInterfaces']();var _0xb84c0c=_[_0xcaa3('0x4')](_[_0xcaa3('0x5')](_0xedc80));for(var _0x1774ac=0x0;_0x1774ac<_0xb84c0c[_0xcaa3('0x6')];_0x1774ac++){var _0x3cc7a9=_0xedc80[_0xb84c0c[_0x1774ac]][_0xcaa3('0x7')](function(_0x4beefb){return _0x4beefb[_0xcaa3('0x8')]==='IPv4'&&_0x4beefb[_0xcaa3('0x9')]===![];});_0x497efa=_0x497efa[_0xcaa3('0xa')](_0x3cc7a9);}return _0x497efa;}function getFirstInterface(){var _0x48422d=_['head'](getInterfaces());return{'macAddress':_0x48422d&&_0x48422d[_0xcaa3('0xb')]?_0x48422d[_0xcaa3('0xb')]:_0xcaa3('0xc'),'ipAddress':_0x48422d&&_0x48422d['address']?_0x48422d[_0xcaa3('0xd')]:_0xcaa3('0xe')};}exports[_0xcaa3('0xf')]=getFirstInterface;function getCPUhash(){var _0x5eed42=_['orderBy'](os[_0xcaa3('0x10')]()['map'](function(_0x1b92a6){return _0x1b92a6[_0xcaa3('0x11')];}))[_0xcaa3('0x12')](':');return crypto['createHash'](_0xcaa3('0x13'))[_0xcaa3('0x14')](_0x5eed42)['digest']('hex');}exports[_0xcaa3('0x15')]=function(){var _0x16b70e=os[_0xcaa3('0x16')]();var _0x2e1117=/[0-9a-f-]{36}/;if(config[_0xcaa3('0x17')]&&_0x2e1117[_0xcaa3('0x18')](config[_0xcaa3('0x17')])){return config[_0xcaa3('0x17')];}else if(_0x16b70e===_0xcaa3('0x19')){return exec(_0xcaa3('0x1a'),{'encoding':'utf8'})[_0xcaa3('0x1b')]('\x0d\x0a','');}else{var _0x36c323=getFirstInterface();var _0x3f7518=getCPUhash();var _0x456b45=_0x3f7518+'|'+os[_0xcaa3('0x1c')]()+'|'+_0x36c323['macAddress']+'|'+_0x36c323[_0xcaa3('0x1d')];var _0xba4982=crypto[_0xcaa3('0x1e')](_0xcaa3('0x13'))[_0xcaa3('0x14')](_0x456b45)[_0xcaa3('0x1f')](_0xcaa3('0x20'));return _0xba4982['substring'](0x0,0x8)+'-'+_0xba4982[_0xcaa3('0x21')](0x8,0xc)+'-'+_0xba4982['substring'](0xc,0x10)+'-'+_0xba4982[_0xcaa3('0x21')](0x10,0x14)+'-'+_0xba4982['substring'](0x14);}}; \ No newline at end of file +var _0xa930=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','orderBy','cpus','map','model','createHash','md5','update','digest','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','substring'];(function(_0x4d2893,_0x831a85){var _0x5a5a2d=function(_0x24db33){while(--_0x24db33){_0x4d2893['push'](_0x4d2893['shift']());}};_0x5a5a2d(++_0x831a85);}(_0xa930,0x1c0));var _0x0a93=function(_0x16129c,_0xbff2a4){_0x16129c=_0x16129c-0x0;var _0x55b8c0=_0xa930[_0x16129c];return _0x55b8c0;};'use strict';var _=require(_0x0a93('0x0'));var os=require('os');var crypto=require(_0x0a93('0x1'));var machine=require(_0x0a93('0x2'));var exec=require(_0x0a93('0x3'))[_0x0a93('0x4')];var config=require(_0x0a93('0x5'));function getInterfaces(){var _0x2fb16a=[];var _0x44f034=os[_0x0a93('0x6')]();var _0x1f7055=_['orderBy'](_[_0x0a93('0x7')](_0x44f034));for(var _0x359aa4=0x0;_0x359aa4<_0x1f7055[_0x0a93('0x8')];_0x359aa4++){var _0x25d1e2=_0x44f034[_0x1f7055[_0x359aa4]][_0x0a93('0x9')](function(_0x6a255){return _0x6a255['family']===_0x0a93('0xa')&&_0x6a255[_0x0a93('0xb')]===![];});_0x2fb16a=_0x2fb16a[_0x0a93('0xc')](_0x25d1e2);}return _0x2fb16a;}function getFirstInterface(){var _0x1011a7=_[_0x0a93('0xd')](getInterfaces());return{'macAddress':_0x1011a7&&_0x1011a7[_0x0a93('0xe')]?_0x1011a7[_0x0a93('0xe')]:'00:00:00:00:00:00','ipAddress':_0x1011a7&&_0x1011a7[_0x0a93('0xf')]?_0x1011a7['address']:'127.0.0.1'};}exports[_0x0a93('0x10')]=getFirstInterface;function getCPUhash(){var _0x11f613=_[_0x0a93('0x11')](os[_0x0a93('0x12')]()[_0x0a93('0x13')](function(_0x4cf7fa){return _0x4cf7fa[_0x0a93('0x14')];}))['join'](':');return crypto[_0x0a93('0x15')](_0x0a93('0x16'))[_0x0a93('0x17')](_0x11f613)[_0x0a93('0x18')]('hex');}exports['getUuid']=function(){var _0x155ba0=os['platform']();var _0x49fd33=/[0-9a-f-]{36}/;if(config[_0x0a93('0x19')]&&_0x49fd33['test'](config[_0x0a93('0x19')])){return config[_0x0a93('0x19')];}else if(_0x155ba0===_0x0a93('0x1a')){return exec(_0x0a93('0x1b'),{'encoding':'utf8'})[_0x0a93('0x1c')]('\x0d\x0a','');}else{var _0x1874e3=getFirstInterface();var _0x37495d=getCPUhash();var _0xf0436d=_0x37495d+'|'+os[_0x0a93('0x1d')]()+'|'+_0x1874e3['macAddress']+'|'+_0x1874e3[_0x0a93('0x1e')];var _0x19743c=crypto['createHash'](_0x0a93('0x16'))[_0x0a93('0x17')](_0xf0436d)[_0x0a93('0x18')]('hex');return _0x19743c[_0x0a93('0x1f')](0x0,0x8)+'-'+_0x19743c[_0x0a93('0x1f')](0x8,0xc)+'-'+_0x19743c[_0x0a93('0x1f')](0xc,0x10)+'-'+_0x19743c[_0x0a93('0x1f')](0x10,0x14)+'-'+_0x19743c['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e506b04..0d2c64c 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 _0xa838=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data2','data1','active','info'];(function(_0x5d003e,_0x31afda){var _0xff3eba=function(_0x504d3e){while(--_0x504d3e){_0x5d003e['push'](_0x5d003e['shift']());}};_0xff3eba(++_0x31afda);}(_0xa838,0x1d0));var _0x8a83=function(_0x3fecbe,_0x608f40){_0x3fecbe=_0x3fecbe-0x0;var _0x59299b=_0xa838[_0x3fecbe];return _0x59299b;};'use strict';var util=require(_0x8a83('0x0'));var moment=require(_0x8a83('0x1'));var rp=require(_0x8a83('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x8a83('0x3'))(module,_0x8a83('0x4'));var db=require(_0x8a83('0x5'))['db'];var encryptor=require(_0x8a83('0x6'));var hardware=require('./hardware');var logger=require(_0x8a83('0x7'))(_0x8a83('0x8'));var HOST=_0x8a83('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x7084eb){return new BPromise(function(_0xc3a84d,_0x2339e3){var _0x13086c=util[_0x8a83('0xa')](_0x8a83('0xb'),HOST,_0x7084eb,module[_0x8a83('0xc')][_0x8a83('0x4')]);if(oldToken){_0x13086c=util[_0x8a83('0xa')](_0x8a83('0xd'),HOST,_0x7084eb,module[_0x8a83('0xc')][_0x8a83('0x4')],oldToken);}var _0x569d5a={'uri':_0x13086c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x569d5a)[_0x8a83('0xe')](function(_0x57a15e){_0xc3a84d(_0x57a15e);})['catch'](function(_0x39c62e){_0x2339e3(_0x39c62e);});});}function manageLicense(_0x463aae,_0x4d54a5){var _0x566cc6=_0x4d54a5[_0x8a83('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x566cc6['data1']!==_0x463aae&&!_0x566cc6[_0x8a83('0x10')]){oldToken=_0x566cc6[_0x8a83('0x11')];}httpRequest(_0x463aae)[_0x8a83('0xe')](function(_0x55d855){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x55d855[_0x8a83('0x12')]){isOldTokenSent=![];if(!_0x566cc6[_0x8a83('0x8')]&&_0x566cc6['license']!=_0x55d855[_0x8a83('0x8')]||_0x566cc6['license']&&_0x566cc6[_0x8a83('0x10')]){logger[_0x8a83('0x13')](_0x8a83('0x14'));}if(_0x566cc6['license']&&!_0x566cc6['data2']&&_0x566cc6[_0x8a83('0x8')]!=_0x55d855[_0x8a83('0x8')]){logger['info'](_0x8a83('0x15'));}if(_0x566cc6[_0x8a83('0x8')]&&!_0x566cc6[_0x8a83('0x10')]&&_0x566cc6[_0x8a83('0x8')]==_0x55d855[_0x8a83('0x8')]){return _0x4d54a5;}return _0x4d54a5[_0x8a83('0x16')]({'data1':_0x463aae,'data2':null,'license':_0x55d855[_0x8a83('0x8')]});}else{if(_0x55d855[_0x8a83('0x8')]||_0x566cc6[_0x8a83('0x8')]){if(!_0x566cc6['data2']){if(_0x566cc6[_0x8a83('0x11')]==_0x463aae){GRAY_PERIOD_REASON=_0x8a83('0x17');logger[_0x8a83('0x13')](_0x8a83('0x18'));}else{GRAY_PERIOD_REASON=_0x8a83('0x19');logger['info'](_0x8a83('0x1a'),_0x566cc6[_0x8a83('0x11')],_0x463aae);}logger['info'](_0x8a83('0x1b'),GRAY_PERIOD_REASON[_0x8a83('0x1c')](),moment()['format'](_0x8a83('0x1d')));return _0x4d54a5[_0x8a83('0x16')]({'data2':encryptor['encryptString'](moment()[_0x8a83('0xa')](_0x8a83('0x1d')))});}else{if(moment()[_0x8a83('0x1e')](encryptor[_0x8a83('0x1f')](_0x566cc6[_0x8a83('0x10')]),_0x8a83('0x20'))>DAYS){logger['info'](_0x8a83('0x21'),moment()[_0x8a83('0xa')](_0x8a83('0x1d')));isOldTokenSent=![];return _0x4d54a5[_0x8a83('0x16')]({'data1':_0x463aae,'data2':null,'license':null});}}}else{if(_0x566cc6[_0x8a83('0x11')]!=_0x463aae){logger['info'](_0x8a83('0x1a'),_0x566cc6['data1'],_0x463aae);return _0x4d54a5[_0x8a83('0x16')]({'data1':_0x463aae,'data2':null,'license':null});}}}return _0x4d54a5;})[_0x8a83('0xe')](function(_0x2f69b5){_0x4d54a5=_0x2f69b5;})[_0x8a83('0x22')](function(_0x546583){logger[_0x8a83('0x23')](_0x546583[_0x8a83('0x24')]);})[_0x8a83('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x8a83('0x26')](),_0x4d54a5);},TIME);});}function defaultLicense(){var _0x2b3516=hardware[_0x8a83('0x26')]();if(_0x2b3516){return db[_0x8a83('0x27')][_0x8a83('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x2b3516}})[_0x8a83('0x29')](function(_0x41e687,_0x5d7c94){logger[_0x8a83('0x13')](_0x8a83('0x2a'),_0x2b3516);manageLicense(_0x2b3516,_0x41e687);})[_0x8a83('0x22')](function(_0x138428){logger[_0x8a83('0x23')](_0x138428[_0x8a83('0x24')]);});}}exports[_0x8a83('0x2b')]=defaultLicense; \ No newline at end of file +var _0x71e8=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','data1','then','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x1daff4,_0x1b79fe){var _0x72b999=function(_0x377917){while(--_0x377917){_0x1daff4['push'](_0x1daff4['shift']());}};_0x72b999(++_0x1b79fe);}(_0x71e8,0xb9));var _0x871e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71e8[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x871e('0x0'));var moment=require(_0x871e('0x1'));var rp=require(_0x871e('0x2'));var BPromise=require(_0x871e('0x3'));var pkginfo=require(_0x871e('0x4'))(module,_0x871e('0x5'));var db=require(_0x871e('0x6'))['db'];var encryptor=require(_0x871e('0x7'));var hardware=require(_0x871e('0x8'));var logger=require(_0x871e('0x9'))(_0x871e('0xa'));var HOST=_0x871e('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1728fe){return new BPromise(function(_0x1a2551,_0x3563c1){var _0x59c4eb=util[_0x871e('0xc')](_0x871e('0xd'),HOST,_0x1728fe,module[_0x871e('0xe')][_0x871e('0x5')]);if(oldToken){_0x59c4eb=util[_0x871e('0xc')](_0x871e('0xf'),HOST,_0x1728fe,module[_0x871e('0xe')][_0x871e('0x5')],oldToken);}var _0xdb50f3={'uri':_0x59c4eb,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xdb50f3)['then'](function(_0x32efe6){_0x1a2551(_0x32efe6);})['catch'](function(_0x2d3270){_0x3563c1(_0x2d3270);});});}function manageLicense(_0x422e6e,_0x234426){var _0xc87687=_0x234426['get']({'plain':!![]});if(!isOldTokenSent&&_0xc87687[_0x871e('0x10')]!==_0x422e6e&&!_0xc87687['data2']){oldToken=_0xc87687[_0x871e('0x10')];}httpRequest(_0x422e6e)[_0x871e('0x11')](function(_0x235d11){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x235d11[_0x871e('0x12')]){isOldTokenSent=![];if(!_0xc87687['license']&&_0xc87687[_0x871e('0xa')]!=_0x235d11['license']||_0xc87687[_0x871e('0xa')]&&_0xc87687[_0x871e('0x13')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xc87687[_0x871e('0xa')]&&!_0xc87687['data2']&&_0xc87687['license']!=_0x235d11[_0x871e('0xa')]){logger['info'](_0x871e('0x14'));}if(_0xc87687[_0x871e('0xa')]&&!_0xc87687['data2']&&_0xc87687[_0x871e('0xa')]==_0x235d11['license']){return _0x234426;}return _0x234426['update']({'data1':_0x422e6e,'data2':null,'license':_0x235d11['license']});}else{if(_0x235d11['license']||_0xc87687[_0x871e('0xa')]){if(!_0xc87687['data2']){if(_0xc87687['data1']==_0x422e6e){GRAY_PERIOD_REASON=_0x871e('0x15');logger[_0x871e('0x16')](_0x871e('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x871e('0x16')](_0x871e('0x18'),_0xc87687[_0x871e('0x10')],_0x422e6e);}logger[_0x871e('0x16')](_0x871e('0x19'),GRAY_PERIOD_REASON[_0x871e('0x1a')](),moment()[_0x871e('0xc')](_0x871e('0x1b')));return _0x234426['update']({'data2':encryptor[_0x871e('0x1c')](moment()['format'](_0x871e('0x1b')))});}else{if(moment()[_0x871e('0x1d')](encryptor[_0x871e('0x1e')](_0xc87687[_0x871e('0x13')]),'days')>DAYS){logger[_0x871e('0x16')](_0x871e('0x1f'),moment()['format'](_0x871e('0x1b')));isOldTokenSent=![];return _0x234426[_0x871e('0x20')]({'data1':_0x422e6e,'data2':null,'license':null});}}}else{if(_0xc87687['data1']!=_0x422e6e){logger[_0x871e('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc87687['data1'],_0x422e6e);return _0x234426[_0x871e('0x20')]({'data1':_0x422e6e,'data2':null,'license':null});}}}return _0x234426;})['then'](function(_0x19b619){_0x234426=_0x19b619;})[_0x871e('0x21')](function(_0xe5bf18){logger[_0x871e('0x22')](_0xe5bf18[_0x871e('0x23')]);})[_0x871e('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x871e('0x25')](),_0x234426);},TIME);});}function defaultLicense(){var _0x37c84d=hardware[_0x871e('0x25')]();if(_0x37c84d){return db[_0x871e('0x26')][_0x871e('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x37c84d}})[_0x871e('0x28')](function(_0x540825,_0x3442b4){logger[_0x871e('0x16')](_0x871e('0x29'),_0x37c84d);manageLicense(_0x37c84d,_0x540825);})[_0x871e('0x21')](function(_0x4e1a45){logger['error'](_0x4e1a45['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1651201..699d668 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 _0x958d=['catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','getUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','count','user','telephones','forEach','admin','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','defaults','then'];(function(_0x126757,_0x2b29cb){var _0x3fe7be=function(_0xddf13f){while(--_0xddf13f){_0x126757['push'](_0x126757['shift']());}};_0x3fe7be(++_0x2b29cb);}(_0x958d,0x1cc));var _0xd958=function(_0x262625,_0x94aea9){_0x262625=_0x262625-0x0;var _0x48ab96=_0x958d[_0x262625];return _0x48ab96;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xd958('0x0'));var BPromise=require('bluebird');var hardware=require(_0xd958('0x1'));var encryptor=require(_0xd958('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd958('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd958('0x4'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd958('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd958('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x586162){return new BPromise(function(_0x510ddb,_0x1f53ac){return db[_0xd958('0x6')][_0xd958('0x7')](_[_0xd958('0x8')](_0x586162,{'raw':!![],'where':{'id':0x1}}))[_0xd958('0x9')](function(_0x37d028){return checkLicense(_0x37d028,null);})[_0xd958('0x9')](function(_0x341840){_0x510ddb(_0x341840);return;})[_0xd958('0xa')](function(_0x52e788){_0x1f53ac(_0x52e788);});});}function checkLicense(_0x362be3,_0x14b230){if(!_0x362be3){demoLicense[_0xd958('0xb')]=_0x362be3[_0xd958('0xc')];return demoLicense;}try{var _0x3bb39f=_0x14b230||_0x362be3[_0xd958('0xd')];if(_[_0xd958('0xe')](_0x3bb39f)){throw new Error(_0xd958('0xf'));}var _0x305674=_0x362be3['data1'];var _0x34d1d7=_0x362be3[_0xd958('0x10')];var _0x3957ff=_0x305674[_0xd958('0x11')]('-')[0x4];var _0x529640=_0x305674[_0xd958('0x11')]('-')[0x0];var _0x1032d1=encryptor[_0xd958('0x12')](_0x3bb39f,util[_0xd958('0x13')](_0xd958('0x14'),_0x3957ff,_0x305674,_0x529640));var _0x42952f=JSON['parse'](_0x1032d1);_0x42952f[_0xd958('0x15')]=![];_0x42952f[_0xd958('0xb')]=_0x305674;_0x42952f[_0xd958('0x16')]=hardware[_0xd958('0x17')]();if(_0x34d1d7){var _0x590034=encryptor[_0xd958('0x12')](_0x34d1d7);_0x42952f[_0xd958('0x18')]=_0x590034;_0x42952f[_0xd958('0x19')]=moment(_0x590034)[_0xd958('0x1a')](0x7,_0xd958('0x1b'))[_0xd958('0x13')]();_0x42952f[_0xd958('0x1c')]=_0x42952f[_0xd958('0xb')]!=_0x42952f[_0xd958('0x16')]?'changed':_0xd958('0x1d');}return _0x42952f;}catch(_0x198941){breakingLicense['uuid']=_0x362be3[_0xd958('0xc')];breakingLicense[_0xd958('0x1e')]=_0x198941[_0xd958('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1668e4,_0x3895ba){getLicense()['then'](function(_0x32083d){return db[_0xd958('0x1f')][_0xd958('0x20')]({'attributes':[_0xd958('0x21'),[db[_0xd958('0x22')]['fn'](_0xd958('0x23'),db[_0xd958('0x22')]['col'](_0xd958('0x21'))),_0xd958('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0xd958('0x25'),'telephone']}},'raw':!![]})[_0xd958('0x9')](function(_0xba1ee8){var _0x3c719a={'user':_0x32083d['users']||0x0,'telephone':_0x32083d[_0xd958('0x26')]||0x0};_0xba1ee8[_0xd958('0x27')](function(_0xbed37f){var _0x476ab4=_0xbed37f[_0xd958('0x21')]===_0xd958('0x28')?_0xd958('0x25'):_0xbed37f[_0xd958('0x21')];_0x3c719a[_0x476ab4]-=_0xbed37f[_0xd958('0x24')];if(_0x3c719a[_0x476ab4]<0x0)_0x3c719a[_0x476ab4]=0x0;});_0x1668e4(_0x3c719a);return;});})[_0xd958('0xa')](function(_0x4d9368){_0x3895ba(_0x4d9368);});});}function checkUserLimits(_0x341436){return new BPromise(function(_0x476970,_0x5a04fa){getLimits()[_0xd958('0x9')](function(_0x3a15a3){var _0x2af8be=_[_0xd958('0x29')](_[_0xd958('0x2a')](_0x341436,_0xd958('0x21')),['admin',_0xd958('0x25'),_0xd958('0x2b')]);var _0x26a9d7=(_0x2af8be[_0xd958('0x28')]||0x0)+(_0x2af8be['user']||0x0);var _0x24b7de=_0x2af8be[_0xd958('0x2b')]||0x0;if(_0x26a9d7>_0x3a15a3[_0xd958('0x25')])return _0x5a04fa(_0xd958('0x2c'));if(_0x24b7de>_0x3a15a3[_0xd958('0x2b')])return _0x5a04fa(_0xd958('0x2d'));return _0x476970();})[_0xd958('0xa')](function(_0x3d173c){_0x5a04fa(_0x3d173c);});});}module[_0xd958('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7f5f=['exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','isEmpty','data2','split','format','parse','demo','machineUuid','add','days','grayReason','changed','message','findAll','role','sequelize','col','count','telephone','users','telephones','forEach','admin','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones'];(function(_0x27c071,_0x51f1cc){var _0x450cba=function(_0x2b7cba){while(--_0x2b7cba){_0x27c071['push'](_0x27c071['shift']());}};_0x450cba(++_0x51f1cc);}(_0x7f5f,0xb1));var _0xf7f5=function(_0x3c23ed,_0x3de49c){_0x3c23ed=_0x3c23ed-0x0;var _0x112ed9=_0x7f5f[_0x3c23ed];return _0x112ed9;};'use strict';var util=require(_0xf7f5('0x0'));var _=require(_0xf7f5('0x1'));var moment=require(_0xf7f5('0x2'));var BPromise=require(_0xf7f5('0x3'));var hardware=require(_0xf7f5('0x4'));var encryptor=require(_0xf7f5('0x5'));var db=require(_0xf7f5('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf7f5('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf7f5('0x8'),'machineUuid':hardware[_0xf7f5('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf7f5('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xf7f5('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4b3a87){return new BPromise(function(_0x3d4675,_0x216ede){return db[_0xf7f5('0xa')][_0xf7f5('0xb')](_[_0xf7f5('0xc')](_0x4b3a87,{'raw':!![],'where':{'id':0x1}}))[_0xf7f5('0xd')](function(_0x4f732c){return checkLicense(_0x4f732c,null);})[_0xf7f5('0xd')](function(_0x3627df){_0x3d4675(_0x3627df);return;})[_0xf7f5('0xe')](function(_0x2d3283){_0x216ede(_0x2d3283);});});}function checkLicense(_0x529da6,_0x2f1afc){if(!_0x529da6){demoLicense[_0xf7f5('0xf')]=_0x529da6[_0xf7f5('0x10')];return demoLicense;}try{var _0x282565=_0x2f1afc||_0x529da6['license'];if(_[_0xf7f5('0x11')](_0x282565)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x11b11e=_0x529da6[_0xf7f5('0x10')];var _0x54fdce=_0x529da6[_0xf7f5('0x12')];var _0x409097=_0x11b11e[_0xf7f5('0x13')]('-')[0x4];var _0x8585e1=_0x11b11e[_0xf7f5('0x13')]('-')[0x0];var _0x2b558c=encryptor['decryptString'](_0x282565,util[_0xf7f5('0x14')]('%s:%s:%s',_0x409097,_0x11b11e,_0x8585e1));var _0x345df9=JSON[_0xf7f5('0x15')](_0x2b558c);_0x345df9[_0xf7f5('0x16')]=![];_0x345df9[_0xf7f5('0xf')]=_0x11b11e;_0x345df9[_0xf7f5('0x17')]=hardware[_0xf7f5('0x9')]();if(_0x54fdce){var _0x1a83e9=encryptor['decryptString'](_0x54fdce);_0x345df9['gray']=_0x1a83e9;_0x345df9['deadline']=moment(_0x1a83e9)[_0xf7f5('0x18')](0x7,_0xf7f5('0x19'))[_0xf7f5('0x14')]();_0x345df9[_0xf7f5('0x1a')]=_0x345df9[_0xf7f5('0xf')]!=_0x345df9[_0xf7f5('0x17')]?_0xf7f5('0x1b'):'disabled';}return _0x345df9;}catch(_0x5591aa){breakingLicense[_0xf7f5('0xf')]=_0x529da6[_0xf7f5('0x10')];breakingLicense[_0xf7f5('0x1c')]=_0x5591aa['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x51f79b,_0xf35e0){getLicense()[_0xf7f5('0xd')](function(_0x21d519){return db['User'][_0xf7f5('0x1d')]({'attributes':[_0xf7f5('0x1e'),[db['sequelize']['fn']('COUNT',db[_0xf7f5('0x1f')][_0xf7f5('0x20')](_0xf7f5('0x1e'))),_0xf7f5('0x21')]],'group':_0xf7f5('0x1e'),'where':{'role':{'$or':['admin','user',_0xf7f5('0x22')]}},'raw':!![]})[_0xf7f5('0xd')](function(_0xb4ec4f){var _0x3135b0={'user':_0x21d519[_0xf7f5('0x23')]||0x0,'telephone':_0x21d519[_0xf7f5('0x24')]||0x0};_0xb4ec4f[_0xf7f5('0x25')](function(_0x39dd12){var _0x3077c1=_0x39dd12[_0xf7f5('0x1e')]===_0xf7f5('0x26')?_0xf7f5('0x27'):_0x39dd12[_0xf7f5('0x1e')];_0x3135b0[_0x3077c1]-=_0x39dd12['count'];if(_0x3135b0[_0x3077c1]<0x0)_0x3135b0[_0x3077c1]=0x0;});_0x51f79b(_0x3135b0);return;});})[_0xf7f5('0xe')](function(_0x36dace){_0xf35e0(_0x36dace);});});}function checkUserLimits(_0xba404){return new BPromise(function(_0x2f4e93,_0x2cde0a){getLimits()['then'](function(_0x1c0aab){var _0x480ecc=_[_0xf7f5('0x28')](_['countBy'](_0xba404,_0xf7f5('0x1e')),['admin',_0xf7f5('0x27'),_0xf7f5('0x22')]);var _0xcc517=(_0x480ecc[_0xf7f5('0x26')]||0x0)+(_0x480ecc[_0xf7f5('0x27')]||0x0);var _0x411850=_0x480ecc[_0xf7f5('0x22')]||0x0;if(_0xcc517>_0x1c0aab[_0xf7f5('0x27')])return _0x2cde0a(_0xf7f5('0x29'));if(_0x411850>_0x1c0aab[_0xf7f5('0x22')])return _0x2cde0a(_0xf7f5('0x2a'));return _0x2f4e93();})['catch'](function(_0x584fe9){_0x2cde0a(_0x584fe9);});});}module[_0xf7f5('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 1a85ced..8969f5c 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 _0x1c7c=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x30fb67,_0x1eddb9){var _0x2d2105=function(_0x13e5b3){while(--_0x13e5b3){_0x30fb67['push'](_0x30fb67['shift']());}};_0x2d2105(++_0x1eddb9);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4c665e,_0x431173){_0x4c665e=_0x4c665e-0x0;var _0x3ae665=_0x1c7c[_0x4c665e];return _0x3ae665;};'use strict';module[_0xc1c7('0x0')]={'DOMAIN':_0xc1c7('0x1'),'SESSION_SECRET':_0xc1c7('0x2'),'GOOGLE_ID':_0xc1c7('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4888=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4e4315,_0x5d7615){var _0x31f97a=function(_0x330858){while(--_0x330858){_0x4e4315['push'](_0x4e4315['shift']());}};_0x31f97a(++_0x5d7615);}(_0x4888,0x198));var _0x8488=function(_0x33cb35,_0x6240ef){_0x33cb35=_0x33cb35-0x0;var _0x50a2ac=_0x4888[_0x33cb35];return _0x50a2ac;};'use strict';module['exports']={'DOMAIN':_0x8488('0x0'),'SESSION_SECRET':_0x8488('0x1'),'GOOGLE_ID':_0x8488('0x2'),'GOOGLE_SECRET':_0x8488('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index bbe5ff7..ccf6e12 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5725=['exports','fileLogger'];(function(_0x1523ff,_0x4d1845){var _0x433e66=function(_0x5aa2c4){while(--_0x5aa2c4){_0x1523ff['push'](_0x1523ff['shift']());}};_0x433e66(++_0x4d1845);}(_0x5725,0x113));var _0x5572=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5725[_0x46e363];return _0x3fb059;};'use strict';var fileLogger=require('../utils/loggers')[_0x5572('0x0')];module[_0x5572('0x1')]=fileLogger; \ No newline at end of file +var _0xf314=['exports','fileLogger'];(function(_0x1739b6,_0x38e10c){var _0x3bf110=function(_0x3b491f){while(--_0x3b491f){_0x1739b6['push'](_0x1739b6['shift']());}};_0x3bf110(++_0x38e10c);}(_0xf314,0x6b));var _0x4f31=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xf314[_0x334841];return _0x5beb4b;};'use strict';var fileLogger=require('../utils/loggers')[_0x4f31('0x0')];module[_0x4f31('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 916a97e..ab8db30 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 _0x2a33=['email','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi'];(function(_0x4c020b,_0x1c7dde){var _0x38e4b3=function(_0x256b0a){while(--_0x256b0a){_0x4c020b['push'](_0x4c020b['shift']());}};_0x38e4b3(++_0x1c7dde);}(_0x2a33,0x10d));var _0x32a3=function(_0x40b2e7,_0x5113fb){_0x40b2e7=_0x40b2e7-0x0;var _0xad0aca=_0x2a33[_0x40b2e7];return _0xad0aca;};'use strict';var path=require(_0x32a3('0x0'));var os=require('os');var config={'apps':[{'name':_0x32a3('0x1'),'script':path['join'](__dirname,_0x32a3('0x2'))},{'name':_0x32a3('0x3'),'script':path[_0x32a3('0x4')](__dirname,_0x32a3('0x5'))},{'name':_0x32a3('0x6'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x32a3('0x7'),'script':path[_0x32a3('0x4')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x32a3('0x4')](__dirname,_0x32a3('0x8'))},{'name':_0x32a3('0x9'),'script':path[_0x32a3('0x4')](__dirname,_0x32a3('0xa'))}]};module[_0x32a3('0xb')]=config; \ No newline at end of file +var _0x0aef=['../../services/xdr/index.js','exports','express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x0aef,0x70));var _0xf0ae=function(_0xe43aab,_0x258d10){_0xe43aab=_0xe43aab-0x0;var _0x12ada8=_0x0aef[_0xe43aab];return _0x12ada8;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xf0ae('0x0'),'script':path[_0xf0ae('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xf0ae('0x2'),'script':path[_0xf0ae('0x1')](__dirname,_0xf0ae('0x3'))},{'name':'agi','script':path['join'](__dirname,_0xf0ae('0x4'))},{'name':_0xf0ae('0x5'),'script':path[_0xf0ae('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xf0ae('0x6'),'script':path['join'](__dirname,_0xf0ae('0x7'))},{'name':'xdr','script':path[_0xf0ae('0x1')](__dirname,_0xf0ae('0x8'))}]};module[_0xf0ae('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5a4e7bc..f8db599 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 _0x4db4=['describe','delete','dump','pm2','bluebird','connect','connected','then','start','stop','disconnect','restart','list'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x4db4,0x196));var _0x44db=function(_0x19b010,_0x3d6401){_0x19b010=_0x19b010-0x0;var _0x211dd4=_0x4db4[_0x19b010];return _0x211dd4;};'use strict';var pm2=require(_0x44db('0x0'));var BPromise=require(_0x44db('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x78fa14,_0x5ee3e9){return pm2[_0x44db('0x2')](function(_0x33670a){if(_0x33670a){return _0x5ee3e9(_0x33670a);}return _0x78fa14(_0x44db('0x3'));});});};exports['start']=function(_0x488e79){return connect()[_0x44db('0x4')](function(){return new BPromise(function(_0x4c814a,_0x5db1e9){return pm2[_0x44db('0x5')](_0x488e79,function(_0x25fc24,_0x524406){if(_0x25fc24){return _0x5db1e9(_0x25fc24);}pm2['disconnect']();return _0x4c814a(_0x524406);});});});};exports['stop']=function(_0x2a637d){return connect()[_0x44db('0x4')](function(){return new BPromise(function(_0x3bad1c,_0x335ebb){return pm2[_0x44db('0x6')](_0x2a637d,function(_0x443cc8,_0x318861){if(_0x443cc8){return _0x335ebb(_0x443cc8);}pm2[_0x44db('0x7')]();return _0x3bad1c(_0x318861);});});});};exports[_0x44db('0x8')]=function(_0x3fb759){return connect()[_0x44db('0x4')](function(){return new BPromise(function(_0x1cb57f,_0x124db0){return pm2[_0x44db('0x8')](_0x3fb759,function(_0x269747,_0x25fcac){if(_0x269747){return _0x124db0(_0x269747);}pm2[_0x44db('0x7')]();return _0x1cb57f(_0x25fcac);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x46e708,_0x5148e3){return pm2[_0x44db('0x9')](function(_0x17e798,_0x27add){if(_0x17e798){return _0x5148e3(_0x17e798);}pm2[_0x44db('0x7')]();return _0x46e708(_0x27add);});});});};exports[_0x44db('0xa')]=function(_0x3763f4){return connect()['then'](function(){return new BPromise(function(_0x42fd0a,_0x571524){return pm2['describe'](_0x3763f4,function(_0x1115c1,_0x1c14bd){if(_0x1115c1){return _0x571524(_0x1115c1);}pm2[_0x44db('0x7')]();return _0x42fd0a(_0x1c14bd);});});});};exports[_0x44db('0xb')]=function(_0x599c49){return connect()['then'](function(){return new BPromise(function(_0x20973b,_0x38fd5f){return pm2[_0x44db('0xb')](_0x599c49,function(_0x1d1b12,_0x41ffae){if(_0x1d1b12){return _0x38fd5f(_0x1d1b12);}pm2[_0x44db('0x7')]();return _0x20973b(_0x41ffae);});});});};exports[_0x44db('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x20b8c7,_0x5b0110){return pm2[_0x44db('0xc')](function(_0x2ecd91){if(_0x2ecd91){return _0x5b0110(_0x2ecd91);}return _0x20b8c7('saved');});});});}; \ No newline at end of file +var _0x5cef=['restart','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then','disconnect','stop'];(function(_0x2cd420,_0x31f26d){var _0x6bf08e=function(_0x1cb379){while(--_0x1cb379){_0x2cd420['push'](_0x2cd420['shift']());}};_0x6bf08e(++_0x31f26d);}(_0x5cef,0x94));var _0xf5ce=function(_0x5cce79,_0x30d842){_0x5cce79=_0x5cce79-0x0;var _0x17484b=_0x5cef[_0x5cce79];return _0x17484b;};'use strict';var pm2=require(_0xf5ce('0x0'));var BPromise=require(_0xf5ce('0x1'));var config=require(_0xf5ce('0x2'));function connect(){return new BPromise(function(_0x2b90d3,_0x17b9d7){return pm2[_0xf5ce('0x3')](function(_0x40de78){if(_0x40de78){return _0x17b9d7(_0x40de78);}return _0x2b90d3('connected');});});};exports[_0xf5ce('0x4')]=function(_0x29337b){return connect()[_0xf5ce('0x5')](function(){return new BPromise(function(_0xb92fc0,_0x4d5f7c){return pm2[_0xf5ce('0x4')](_0x29337b,function(_0x123992,_0x269336){if(_0x123992){return _0x4d5f7c(_0x123992);}pm2[_0xf5ce('0x6')]();return _0xb92fc0(_0x269336);});});});};exports[_0xf5ce('0x7')]=function(_0x361c75){return connect()[_0xf5ce('0x5')](function(){return new BPromise(function(_0x4a9df4,_0x2bbee1){return pm2[_0xf5ce('0x7')](_0x361c75,function(_0x3cd8bc,_0x331fa2){if(_0x3cd8bc){return _0x2bbee1(_0x3cd8bc);}pm2['disconnect']();return _0x4a9df4(_0x331fa2);});});});};exports['restart']=function(_0x1e565b){return connect()[_0xf5ce('0x5')](function(){return new BPromise(function(_0x29bad5,_0x4e92c5){return pm2[_0xf5ce('0x8')](_0x1e565b,function(_0x49836c,_0x3070f7){if(_0x49836c){return _0x4e92c5(_0x49836c);}pm2['disconnect']();return _0x29bad5(_0x3070f7);});});});};exports['list']=function(){return connect()[_0xf5ce('0x5')](function(){return new BPromise(function(_0x3829f8,_0x1756e3){return pm2['list'](function(_0x4c2e80,_0x1f6871){if(_0x4c2e80){return _0x1756e3(_0x4c2e80);}pm2[_0xf5ce('0x6')]();return _0x3829f8(_0x1f6871);});});});};exports['describe']=function(_0x30ae8f){return connect()['then'](function(){return new BPromise(function(_0x53f9,_0x1a9c11){return pm2[_0xf5ce('0x9')](_0x30ae8f,function(_0x56ebba,_0x10bdae){if(_0x56ebba){return _0x1a9c11(_0x56ebba);}pm2[_0xf5ce('0x6')]();return _0x53f9(_0x10bdae);});});});};exports[_0xf5ce('0xa')]=function(_0x27343a){return connect()['then'](function(){return new BPromise(function(_0x452c38,_0x10e967){return pm2['delete'](_0x27343a,function(_0x5f4e30,_0x3b3228){if(_0x5f4e30){return _0x10e967(_0x5f4e30);}pm2[_0xf5ce('0x6')]();return _0x452c38(_0x3b3228);});});});};exports[_0xf5ce('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2a295d,_0x2ebcc7){return pm2['dump'](function(_0x169086){if(_0x169086){return _0x2ebcc7(_0x169086);}return _0x2a295d(_0xf5ce('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 73eba93..d8f8974 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 _0x6c0c=['redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../mysqldb','../logger'];(function(_0x14f9ba,_0x1549c3){var _0x2b65d3=function(_0x177727){while(--_0x177727){_0x14f9ba['push'](_0x14f9ba['shift']());}};_0x2b65d3(++_0x1549c3);}(_0x6c0c,0xc2));var _0xc6c0=function(_0x2435ae,_0x4fbc85){_0x2435ae=_0x2435ae-0x0;var _0x50d0d2=_0x6c0c[_0x2435ae];return _0x50d0d2;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xc6c0('0x0'));var util=require(_0xc6c0('0x1'));var config=require('../../config/environment');var db=require(_0xc6c0('0x2'))['db'];var logger=require(_0xc6c0('0x3'))('schedule');config[_0xc6c0('0x4')]=_[_0xc6c0('0x5')](config[_0xc6c0('0x4')],{'host':_0xc6c0('0x6'),'port':0x18eb});var io=require(_0xc6c0('0x7'))(new Redis(config[_0xc6c0('0x4')]));function closeInteractions(){var _0x12a6ec=0x0;var _0x4ec244=[];return db['Setting'][_0xc6c0('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xc6c0('0x9')](function(_0x4c4d38){_0x12a6ec=_0x4c4d38[_0xc6c0('0xa')];if(_0x12a6ec){return db[_0xc6c0('0xb')][_0xc6c0('0xc')]({'raw':!![],'attributes':['id',_0xc6c0('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc6c0('0xe')](_0x4c4d38[_0xc6c0('0xa')],_0xc6c0('0xf'))}}});}else{return[];}})[_0xc6c0('0x9')](function(_0x3420ff){if(_0x3420ff&&_0x3420ff[_0xc6c0('0x10')]){_0x4ec244=_[_0xc6c0('0x11')](_0x3420ff||[],'id');logger[_0xc6c0('0x12')](_0xc6c0('0x13'),_0x4ec244[_0xc6c0('0x14')]());return db[_0xc6c0('0xb')][_0xc6c0('0x15')]({'closeReason':_0xc6c0('0x16'),'disposition':_0xc6c0('0x17'),'closed':!![],'closedAt':moment()[_0xc6c0('0x18')](_0xc6c0('0x19'))},{'where':{'id':_0x4ec244}});}})['then'](function(){if(_0x4ec244&&_0x4ec244['length']){logger[_0xc6c0('0x12')](_0xc6c0('0x1a'),_0x4ec244[_0xc6c0('0x14')]());for(var _0x29b55d=0x0;_0x29b55d<_0x4ec244[_0xc6c0('0x10')];_0x29b55d++){io[_0xc6c0('0x1b')]('chatInteraction:update',{'id':_0x4ec244[_0x29b55d],'closed':!![]});}}})[_0xc6c0('0x1c')](function(_0x167bf4){logger[_0xc6c0('0x1d')](_0xc6c0('0x1e'),_0x167bf4?util[_0xc6c0('0x1f')](_0x167bf4,{'showHidden':![],'depth':null}):'');});}exports[_0xc6c0('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9bf7=['timeout','format','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','update','system'];(function(_0x5c00e0,_0x1d2ac3){var _0xaea61f=function(_0x19149c){while(--_0x19149c){_0x5c00e0['push'](_0x5c00e0['shift']());}};_0xaea61f(++_0x1d2ac3);}(_0x9bf7,0x175));var _0x79bf=function(_0x4ca64d,_0x2edf48){_0x4ca64d=_0x4ca64d-0x0;var _0x4036da=_0x9bf7[_0x4ca64d];return _0x4036da;};'use strict';var _=require(_0x79bf('0x0'));var moment=require(_0x79bf('0x1'));var Redis=require(_0x79bf('0x2'));var util=require(_0x79bf('0x3'));var config=require(_0x79bf('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x79bf('0x5'))(_0x79bf('0x6'));config['redis']=_[_0x79bf('0x7')](config[_0x79bf('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x79bf('0x9'))(new Redis(config[_0x79bf('0x8')]));function closeInteractions(){var _0x1c0a34=0x0;var _0x39ad51=[];return db[_0x79bf('0xa')][_0x79bf('0xb')]({'raw':!![],'attributes':['id',_0x79bf('0xc')],'where':{'id':0x1}})[_0x79bf('0xd')](function(_0x525243){_0x1c0a34=_0x525243[_0x79bf('0xc')];if(_0x1c0a34){return db[_0x79bf('0xe')][_0x79bf('0xf')]({'raw':!![],'attributes':['id',_0x79bf('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x79bf('0x11')](_0x525243[_0x79bf('0xc')],_0x79bf('0x12'))}}});}else{return[];}})[_0x79bf('0xd')](function(_0x3e0e71){if(_0x3e0e71&&_0x3e0e71['length']){_0x39ad51=_['map'](_0x3e0e71||[],'id');logger[_0x79bf('0x13')](_0x79bf('0x14'),_0x39ad51['join']());return db[_0x79bf('0xe')][_0x79bf('0x15')]({'closeReason':_0x79bf('0x16'),'disposition':_0x79bf('0x17'),'closed':!![],'closedAt':moment()[_0x79bf('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x39ad51}});}})['then'](function(){if(_0x39ad51&&_0x39ad51['length']){logger[_0x79bf('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x39ad51['join']());for(var _0x88db8a=0x0;_0x88db8a<_0x39ad51[_0x79bf('0x19')];_0x88db8a++){io[_0x79bf('0x1a')](_0x79bf('0x1b'),{'id':_0x39ad51[_0x88db8a],'closed':!![]});}}})[_0x79bf('0x1c')](function(_0x591a09){logger[_0x79bf('0x1d')](_0x79bf('0x1e'),_0x591a09?util[_0x79bf('0x1f')](_0x591a09,{'showHidden':![],'depth':null}):'');});}exports[_0x79bf('0x20')]=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 e5b93e0..1bb6817 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 _0xe9aa=['startAllRefreshIntervals','exports'];(function(_0x245096,_0x29a979){var _0x13a9f0=function(_0x1cf772){while(--_0x1cf772){_0x245096['push'](_0x245096['shift']());}};_0x13a9f0(++_0x29a979);}(_0xe9aa,0x11e));var _0xae9a=function(_0x19c931,_0x49b401){_0x19c931=_0x19c931-0x0;var _0x310867=_0xe9aa[_0x19c931];return _0x310867;};'use strict';function start(){var _0x9adaf9=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x9adaf9[_0xae9a('0x0')]();}module[_0xae9a('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x055f=['startAllRefreshIntervals','exports'];(function(_0x5894f5,_0x5708e1){var _0x1c9e5d=function(_0x119dc9){while(--_0x119dc9){_0x5894f5['push'](_0x5894f5['shift']());}};_0x1c9e5d(++_0x5708e1);}(_0x055f,0x142));var _0xf055=function(_0x1aa6ab,_0x5a606){_0x1aa6ab=_0x1aa6ab-0x0;var _0x1b5467=_0x055f[_0x1aa6ab];return _0x1b5467;};'use strict';function start(){var _0x2fe815=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2fe815[_0xf055('0x0')]();}module[_0xf055('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 7912053..9a81165 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 _0x0e13=['YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','keyBy','toString','difference','intersection','exists','stop','delete\x20cron','toRun','length','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','deleteJob','run','util','path','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','join','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','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x0e13,0x123));var _0x30e1=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x0e13[_0x3074f3];return _0x53f112;};'use strict';var fs=require('fs');var util=require(_0x30e1('0x0'));var path=require(_0x30e1('0x1'));var _=require('lodash');var moment=require(_0x30e1('0x2'));var CronJobManager=require(_0x30e1('0x3'));var jayson=require(_0x30e1('0x4'));var BPromise=require('bluebird');var logger=require(_0x30e1('0x5'))('schedule');var db=require(_0x30e1('0x6'))['db'];var analyticCustomReportController=require(_0x30e1('0x7'));var analyticDefaultReportController=require(_0x30e1('0x8'));var client=jayson[_0x30e1('0x9')][_0x30e1('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xf8d625,_0x169a13){return function(){logger[_0x30e1('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xf8d625[_0x30e1('0xc')]);var _0x2aff70=!![];var _0x3c35ac=_0xf8d625['MailAccount'][_0x30e1('0xd')]();var _0x2a384f={'account':_0x3c35ac,'message':{'from':util['format'](_0x30e1('0xe'),_0xf8d625[_0x30e1('0xf')][_0x30e1('0x10')],_0xf8d625[_0x30e1('0xf')][_0x30e1('0xc')]||_0xf8d625[_0x30e1('0xf')][_0x30e1('0x11')]['user']),'to':_0xf8d625[_0x30e1('0xc')],'cc':_0xf8d625['cc'],'bcc':_0xf8d625[_0x30e1('0x12')],'subject':util[_0x30e1('0x13')](_0x30e1('0x14'),_0x169a13[_0x30e1('0x10')],_0xf8d625[_0x30e1('0x15')],_0xf8d625[_0x30e1('0x16')])}};var _0x5d4c60=path['join'](__dirname,_0x30e1('0x17'));var _0x26ae5c=_0x169a13[_0x30e1('0x18')];var _0x43eba5=util[_0x30e1('0x13')](_0x30e1('0x19'),path['basename'](_0x169a13[_0x30e1('0x18')],path[_0x30e1('0x1a')](_0x169a13['savename'])),'zip');var _0x93fce1=path[_0x30e1('0x1b')](_0x5d4c60,_0x26ae5c);var _0x14f901=path[_0x30e1('0x1b')](_0x5d4c60,_0x43eba5);if(fs['existsSync'](_0x93fce1)){_0x169a13['status']=_0x30e1('0x1c');_0x2a384f[_0x30e1('0x1d')]['attachments']=[{'filename':_0x26ae5c,'path':_0x93fce1}];_0x2a384f[_0x30e1('0x1d')][_0x30e1('0x1e')]=util[_0x30e1('0x13')](_0x30e1('0x1f'),JSON['stringify'](_0x169a13,null,0x2));}else if(fs['existsSync'](_0x14f901)){_0x169a13[_0x30e1('0x20')]='Sent';_0x2a384f['message']['attachments']=[{'filename':_0x43eba5,'path':_0x14f901}];}else{_0x2a384f[_0x30e1('0x1d')][_0x30e1('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xf8d625[_0x30e1('0x21')]){_0x2aff70=![];logger[_0x30e1('0xb')](_0x30e1('0x22'));}}if(_0x2aff70){return client[_0x30e1('0x23')](_0x30e1('0x24'),_0x2a384f)['then'](function(_0x42f73a){if(_0x42f73a[_0x30e1('0x25')]){return logger[_0x30e1('0x25')](_0x30e1('0x26'),JSON[_0x30e1('0x27')](_0x42f73a));}return logger[_0x30e1('0xb')](_0x30e1('0x28'));})[_0x30e1('0x29')](function(_0x5aeb4f){return logger[_0x30e1('0x25')](_0x30e1('0x26'),JSON[_0x30e1('0x27')](_0x5aeb4f));});}};}function handleError(){return function(_0x23962c){return logger[_0x30e1('0x25')](JSON[_0x30e1('0x27')](_0x23962c));};}function handleResult(_0x5330b7){return function(_0x5b466c){logger[_0x30e1('0xb')]('data',JSON[_0x30e1('0x27')](_0x5b466c));if(_0x5330b7[_0x30e1('0xf')]&&_0x5330b7['MailAccount']['Smtp']&&!_['isNil'](_0x5330b7[_0x30e1('0xc')])){setTimeout(handleSendEmail(_0x5330b7,_0x5b466c),0x3c*0x3e8);}};}function handleJob(_0x535c6e){return function(){try{if(_[_0x30e1('0x2a')](_0x535c6e[_0x30e1('0x15')])){return logger[_0x30e1('0xb')](_0x30e1('0x2b'));}if(_[_0x30e1('0x2a')](_0x535c6e['subtractUnit'])){return logger['info'](_0x30e1('0x2c'));}var _0x171fa8={'startDate':moment()['subtract'](_0x535c6e[_0x30e1('0x15')],_0x535c6e[_0x30e1('0x16')])[_0x30e1('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x30e1('0x13')](_0x30e1('0x2d')),'type':_0x30e1('0x2e'),'output':_0x535c6e[_0x30e1('0x2f')],'name':_0x535c6e[_0x30e1('0x10')]};if(!_['isNil'](_0x535c6e['DefaultReportId'])){logger[_0x30e1('0xb')](_0x30e1('0x30'),_0x535c6e[_0x30e1('0x31')]);return analyticDefaultReportController[_0x30e1('0x32')]({'id':_0x535c6e[_0x30e1('0x31')]},_0x171fa8)[_0x30e1('0x33')](handleResult(_0x535c6e))['catch'](handleError());}if(!_[_0x30e1('0x2a')](_0x535c6e[_0x30e1('0x34')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x535c6e[_0x30e1('0x34')]);return analyticCustomReportController['runReport']({'id':_0x535c6e[_0x30e1('0x34')]},_0x171fa8)[_0x30e1('0x33')](handleResult(_0x535c6e))['catch'](handleError());}}catch(_0x3e1b52){logger[_0x30e1('0x25')](JSON['stringify'](_0x3e1b52));}return logger[_0x30e1('0xb')](_0x30e1('0x35'));};}function getJobs(_0x14d883){var _0xb26bae={};if(_0x14d883){_0xb26bae['id']=_0x14d883;}return db[_0x30e1('0x36')][_0x30e1('0x37')]({'where':_0xb26bae,'include':[{'model':db[_0x30e1('0xf')],'attributes':['id',_0x30e1('0x10'),'email'],'include':[{'model':db[_0x30e1('0x38')],'as':'Smtp','include':[{'model':db[_0x30e1('0x39')],'as':_0x30e1('0x39')}]}]}]})[_0x30e1('0x33')](function(_0x4833a5){var _0x4d9af0=_['keys'](manager[_0x30e1('0x3a')]);var _0x1bb35d=_[_0x30e1('0x3b')](_0x4833a5,function(_0x4d4811){return _0x4d4811['id']['toString']();});var _0x43919f=_[_0x30e1('0x3c')](_0x4833a5,function(_0x549528){return _0x549528['id'][_0x30e1('0x3d')]();});var _0x36df1c=_0x14d883?_0x1bb35d:_[_0x30e1('0x3e')](_0x1bb35d,_0x4d9af0);var _0x1e23ee=_[_0x30e1('0x3f')](_0x1bb35d,_0x4d9af0);var _0x492ce1=_[_0x30e1('0x3e')](_0x4d9af0,_0x1bb35d);var _0x7d0645;var _0x40cefd;for(_0x7d0645=0x0;_0x7d0645<_0x492ce1['length']&&!_0x14d883;_0x7d0645+=0x1){_0x40cefd=_0x492ce1[_0x7d0645][_0x30e1('0x3d')]();if(manager[_0x30e1('0x40')](_0x40cefd)){manager[_0x30e1('0x41')](_0x40cefd);manager['deleteJob'](_0x40cefd);logger[_0x30e1('0xb')](_0x30e1('0x42'),_0x40cefd);}}logger['info'](_0x30e1('0x43'),JSON[_0x30e1('0x27')](_0x36df1c));for(_0x7d0645=0x0;_0x7d0645<_0x36df1c[_0x30e1('0x44')];_0x7d0645+=0x1){_0x40cefd=_0x36df1c[_0x7d0645]['toString']();logger[_0x30e1('0xb')]('index',_0x40cefd);if(_0x14d883){logger[_0x30e1('0xb')](_0x30e1('0x45'),_0x14d883);logger[_0x30e1('0xb')](JSON[_0x30e1('0x27')](_0x43919f[_0x40cefd]));BPromise[_0x30e1('0x46')]()['then'](handleJob(_0x43919f[_0x40cefd]));logger[_0x30e1('0xb')](_0x30e1('0x47'),_0x43919f[_0x40cefd][_0x30e1('0x10')],_0x43919f[_0x40cefd][_0x30e1('0x48')]);}else if(_0x43919f[_0x40cefd][_0x30e1('0x48')]&&_0x43919f[_0x40cefd][_0x30e1('0x49')]&&moment()[_0x30e1('0x4a')](_0x43919f[_0x40cefd][_0x30e1('0x4b')],_0x43919f[_0x40cefd][_0x30e1('0x4c')])){manager[_0x30e1('0x4d')](_0x40cefd,_0x43919f[_0x40cefd][_0x30e1('0x48')],handleJob(_0x43919f[_0x40cefd]));manager[_0x30e1('0x4e')](_0x40cefd);logger[_0x30e1('0xb')](_0x30e1('0x4f'),_0x43919f[_0x40cefd][_0x30e1('0x10')],_0x43919f[_0x40cefd]['cron']);}else if(manager['exists'](_0x40cefd)){manager[_0x30e1('0x41')](_0x40cefd);manager['deleteJob'](_0x40cefd);logger['info'](_0x30e1('0x50'),_0x43919f[_0x40cefd][_0x30e1('0x10')],_0x43919f[_0x40cefd][_0x30e1('0x48')]);}}for(_0x7d0645=0x0,_0x40cefd;_0x7d0645<_0x1e23ee[_0x30e1('0x44')]&&!_0x14d883;_0x7d0645+=0x1){_0x40cefd=_0x1e23ee[_0x7d0645][_0x30e1('0x3d')]();if(manager['exists'](_0x40cefd)){if(_0x43919f[_0x40cefd][_0x30e1('0x48')]&&_0x43919f[_0x40cefd][_0x30e1('0x49')]&&moment()['isBetween'](_0x43919f[_0x40cefd][_0x30e1('0x4b')],_0x43919f[_0x40cefd][_0x30e1('0x4c')])){manager[_0x30e1('0x51')](_0x40cefd,_0x43919f[_0x40cefd][_0x30e1('0x48')],handleJob(_0x43919f[_0x40cefd]));logger[_0x30e1('0xb')]('update\x20cron',_0x43919f[_0x40cefd][_0x30e1('0x10')],_0x43919f[_0x40cefd][_0x30e1('0x48')]);}else{manager[_0x30e1('0x41')](_0x40cefd);manager[_0x30e1('0x52')](_0x40cefd);logger[_0x30e1('0xb')](_0x30e1('0x50'),_0x43919f[_0x40cefd][_0x30e1('0x10')],_0x43919f[_0x40cefd]['cron']);}}}})[_0x30e1('0x29')](function(_0x3f652e){logger[_0x30e1('0x25')](JSON[_0x30e1('0x27')](_0x3f652e));});}exports[_0x30e1('0x53')]=function(_0x7f770){return getJobs(_0x7f770);};exports[_0x30e1('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa0b0=['exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','subtractNumber','join','savename','%s.%s','basename','extname','zip','existsSync','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','stringify','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','email\x20sent','catch','error\x20mail','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa0b0,0x78));var _0x0a0b=function(_0x5f0e27,_0x3404a6){_0x5f0e27=_0x5f0e27-0x0;var _0x2e2835=_0xa0b0[_0x5f0e27];return _0x2e2835;};'use strict';var fs=require('fs');var util=require(_0x0a0b('0x0'));var path=require(_0x0a0b('0x1'));var _=require(_0x0a0b('0x2'));var moment=require(_0x0a0b('0x3'));var CronJobManager=require(_0x0a0b('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x0a0b('0x5'));var logger=require(_0x0a0b('0x6'))(_0x0a0b('0x7'));var db=require(_0x0a0b('0x8'))['db'];var analyticCustomReportController=require(_0x0a0b('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0a0b('0xa')][_0x0a0b('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xe7cec4,_0x2e69b9){return function(){logger[_0x0a0b('0xc')](_0x0a0b('0xd'),_0xe7cec4[_0x0a0b('0xe')]);var _0x27996a=!![];var _0x3cf100=_0xe7cec4[_0x0a0b('0xf')]['getSmtpOptions']();var _0x51c23a={'account':_0x3cf100,'message':{'from':util[_0x0a0b('0x10')](_0x0a0b('0x11'),_0xe7cec4['MailAccount'][_0x0a0b('0x12')],_0xe7cec4[_0x0a0b('0xf')][_0x0a0b('0xe')]||_0xe7cec4[_0x0a0b('0xf')][_0x0a0b('0x13')]['user']),'to':_0xe7cec4['email'],'cc':_0xe7cec4['cc'],'bcc':_0xe7cec4[_0x0a0b('0x14')],'subject':util[_0x0a0b('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x2e69b9[_0x0a0b('0x12')],_0xe7cec4[_0x0a0b('0x15')],_0xe7cec4['subtractUnit'])}};var _0x258268=path[_0x0a0b('0x16')](__dirname,'../../files/reports');var _0x290f38=_0x2e69b9[_0x0a0b('0x17')];var _0x2ce358=util[_0x0a0b('0x10')](_0x0a0b('0x18'),path[_0x0a0b('0x19')](_0x2e69b9[_0x0a0b('0x17')],path[_0x0a0b('0x1a')](_0x2e69b9['savename'])),_0x0a0b('0x1b'));var _0x490406=path[_0x0a0b('0x16')](_0x258268,_0x290f38);var _0x4ef47c=path[_0x0a0b('0x16')](_0x258268,_0x2ce358);if(fs[_0x0a0b('0x1c')](_0x490406)){_0x2e69b9['status']=_0x0a0b('0x1d');_0x51c23a[_0x0a0b('0x1e')]['attachments']=[{'filename':_0x290f38,'path':_0x490406}];_0x51c23a[_0x0a0b('0x1e')][_0x0a0b('0x1f')]=util['format'](_0x0a0b('0x20'),JSON[_0x0a0b('0x21')](_0x2e69b9,null,0x2));}else if(fs[_0x0a0b('0x1c')](_0x4ef47c)){_0x2e69b9[_0x0a0b('0x22')]=_0x0a0b('0x1d');_0x51c23a[_0x0a0b('0x1e')][_0x0a0b('0x23')]=[{'filename':_0x2ce358,'path':_0x4ef47c}];}else{_0x51c23a[_0x0a0b('0x1e')][_0x0a0b('0x1f')]=_0x0a0b('0x24');if(!_0xe7cec4[_0x0a0b('0x25')]){_0x27996a=![];logger[_0x0a0b('0xc')](_0x0a0b('0x26'));}}if(_0x27996a){return client[_0x0a0b('0x27')]('SendMail',_0x51c23a)[_0x0a0b('0x28')](function(_0x26ec11){if(_0x26ec11[_0x0a0b('0x29')]){return logger[_0x0a0b('0x29')]('error\x20mail',JSON[_0x0a0b('0x21')](_0x26ec11));}return logger[_0x0a0b('0xc')](_0x0a0b('0x2a'));})[_0x0a0b('0x2b')](function(_0xae84f5){return logger[_0x0a0b('0x29')](_0x0a0b('0x2c'),JSON[_0x0a0b('0x21')](_0xae84f5));});}};}function handleError(){return function(_0x4c027f){return logger[_0x0a0b('0x29')](JSON[_0x0a0b('0x21')](_0x4c027f));};}function handleResult(_0x46a6f1){return function(_0x35a1cd){logger[_0x0a0b('0xc')]('data',JSON['stringify'](_0x35a1cd));if(_0x46a6f1[_0x0a0b('0xf')]&&_0x46a6f1['MailAccount'][_0x0a0b('0x13')]&&!_[_0x0a0b('0x2d')](_0x46a6f1[_0x0a0b('0xe')])){setTimeout(handleSendEmail(_0x46a6f1,_0x35a1cd),0x3c*0x3e8);}};}function handleJob(_0x132e4a){return function(){try{if(_[_0x0a0b('0x2d')](_0x132e4a[_0x0a0b('0x15')])){return logger[_0x0a0b('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0a0b('0x2d')](_0x132e4a[_0x0a0b('0x2e')])){return logger['info'](_0x0a0b('0x2f'));}var _0x6b475b={'startDate':moment()[_0x0a0b('0x30')](_0x132e4a[_0x0a0b('0x15')],_0x132e4a['subtractUnit'])[_0x0a0b('0x10')](_0x0a0b('0x31')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0a0b('0x32'),'output':_0x132e4a['output'],'name':_0x132e4a[_0x0a0b('0x12')]};if(!_['isNil'](_0x132e4a[_0x0a0b('0x33')])){logger['info'](_0x0a0b('0x34'),_0x132e4a[_0x0a0b('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x132e4a['DefaultReportId']},_0x6b475b)[_0x0a0b('0x28')](handleResult(_0x132e4a))['catch'](handleError());}if(!_[_0x0a0b('0x2d')](_0x132e4a['CustomReportId'])){logger[_0x0a0b('0xc')](_0x0a0b('0x35'),_0x132e4a['CustomReportId']);return analyticCustomReportController[_0x0a0b('0x36')]({'id':_0x132e4a[_0x0a0b('0x37')]},_0x6b475b)['then'](handleResult(_0x132e4a))[_0x0a0b('0x2b')](handleError());}}catch(_0x5ce154){logger[_0x0a0b('0x29')](JSON['stringify'](_0x5ce154));}return logger[_0x0a0b('0xc')](_0x0a0b('0x38'));};}function getJobs(_0x209012){var _0x514825={};if(_0x209012){_0x514825['id']=_0x209012;}return db[_0x0a0b('0x39')][_0x0a0b('0x3a')]({'where':_0x514825,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0a0b('0x12'),'email'],'include':[{'model':db[_0x0a0b('0x3b')],'as':_0x0a0b('0x13'),'include':[{'model':db[_0x0a0b('0x3c')],'as':_0x0a0b('0x3c')}]}]}]})['then'](function(_0x46c25c){var _0x2ee45f=_[_0x0a0b('0x3d')](manager[_0x0a0b('0x3e')]);var _0x3ad2fd=_[_0x0a0b('0x3f')](_0x46c25c,function(_0x2bb3ff){return _0x2bb3ff['id']['toString']();});var _0x40cc1c=_[_0x0a0b('0x40')](_0x46c25c,function(_0x1533ae){return _0x1533ae['id'][_0x0a0b('0x41')]();});var _0x80b186=_0x209012?_0x3ad2fd:_[_0x0a0b('0x42')](_0x3ad2fd,_0x2ee45f);var _0x321640=_['intersection'](_0x3ad2fd,_0x2ee45f);var _0x1cb05f=_[_0x0a0b('0x42')](_0x2ee45f,_0x3ad2fd);var _0x58e63f;var _0xf6f31;for(_0x58e63f=0x0;_0x58e63f<_0x1cb05f[_0x0a0b('0x43')]&&!_0x209012;_0x58e63f+=0x1){_0xf6f31=_0x1cb05f[_0x58e63f][_0x0a0b('0x41')]();if(manager[_0x0a0b('0x44')](_0xf6f31)){manager[_0x0a0b('0x45')](_0xf6f31);manager[_0x0a0b('0x46')](_0xf6f31);logger['info'](_0x0a0b('0x47'),_0xf6f31);}}logger['info'](_0x0a0b('0x48'),JSON[_0x0a0b('0x21')](_0x80b186));for(_0x58e63f=0x0;_0x58e63f<_0x80b186['length'];_0x58e63f+=0x1){_0xf6f31=_0x80b186[_0x58e63f][_0x0a0b('0x41')]();logger[_0x0a0b('0xc')]('index',_0xf6f31);if(_0x209012){logger[_0x0a0b('0xc')](_0x0a0b('0x49'),_0x209012);logger['info'](JSON[_0x0a0b('0x21')](_0x40cc1c[_0xf6f31]));BPromise['resolve']()['then'](handleJob(_0x40cc1c[_0xf6f31]));logger[_0x0a0b('0xc')](_0x0a0b('0x4a'),_0x40cc1c[_0xf6f31][_0x0a0b('0x12')],_0x40cc1c[_0xf6f31]['cron']);}else if(_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')]&&_0x40cc1c[_0xf6f31][_0x0a0b('0x4c')]&&moment()[_0x0a0b('0x4d')](_0x40cc1c[_0xf6f31][_0x0a0b('0x4e')],_0x40cc1c[_0xf6f31][_0x0a0b('0x4f')])){manager[_0x0a0b('0x50')](_0xf6f31,_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')],handleJob(_0x40cc1c[_0xf6f31]));manager['start'](_0xf6f31);logger[_0x0a0b('0xc')](_0x0a0b('0x51'),_0x40cc1c[_0xf6f31]['name'],_0x40cc1c[_0xf6f31]['cron']);}else if(manager[_0x0a0b('0x44')](_0xf6f31)){manager[_0x0a0b('0x45')](_0xf6f31);manager['deleteJob'](_0xf6f31);logger[_0x0a0b('0xc')](_0x0a0b('0x52'),_0x40cc1c[_0xf6f31]['name'],_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')]);}}for(_0x58e63f=0x0,_0xf6f31;_0x58e63f<_0x321640[_0x0a0b('0x43')]&&!_0x209012;_0x58e63f+=0x1){_0xf6f31=_0x321640[_0x58e63f][_0x0a0b('0x41')]();if(manager[_0x0a0b('0x44')](_0xf6f31)){if(_0x40cc1c[_0xf6f31]['cron']&&_0x40cc1c[_0xf6f31][_0x0a0b('0x4c')]&&moment()[_0x0a0b('0x4d')](_0x40cc1c[_0xf6f31]['startAt'],_0x40cc1c[_0xf6f31][_0x0a0b('0x4f')])){manager[_0x0a0b('0x53')](_0xf6f31,_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')],handleJob(_0x40cc1c[_0xf6f31]));logger[_0x0a0b('0xc')](_0x0a0b('0x54'),_0x40cc1c[_0xf6f31][_0x0a0b('0x12')],_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')]);}else{manager[_0x0a0b('0x45')](_0xf6f31);manager['deleteJob'](_0xf6f31);logger[_0x0a0b('0xc')](_0x0a0b('0x52'),_0x40cc1c[_0xf6f31][_0x0a0b('0x12')],_0x40cc1c[_0xf6f31][_0x0a0b('0x4b')]);}}}})['catch'](function(_0x4b0825){logger[_0x0a0b('0x29')](JSON[_0x0a0b('0x21')](_0x4b0825));});}exports['run']=function(_0x279c83){return getJobs(_0x279c83);};exports[_0x0a0b('0x55')]=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 1bbf6c2..be1e38b 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 _0xa249=['Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','inspect','start','lodash','aws-sdk','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x5d280c,_0x228eec){var _0x2dc2ac=function(_0x40a109){while(--_0x40a109){_0x5d280c['push'](_0x5d280c['shift']());}};_0x2dc2ac(++_0x228eec);}(_0xa249,0x183));var _0x9a24=function(_0x3c9ceb,_0x58f2c5){_0x3c9ceb=_0x3c9ceb-0x0;var _0x160c35=_0xa249[_0x3c9ceb];return _0x160c35;};var _=require(_0x9a24('0x0'));var AWS=require(_0x9a24('0x1'));var rp=require('request-promise');var util=require(_0x9a24('0x2'));var BPromise=require(_0x9a24('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x9a24('0x4'))('transcribe');function getTranscriptionJob(_0x3f83df,_0x48c56d,_0x558c9a,_0x5c2f56){return new Promise(function(_0x1b0728,_0x167980){var _0x3f59a1=new AWS[(_0x9a24('0x5'))]({'accessKeyId':_0x48c56d,'secretAccessKey':_0x3f83df,'region':_0x558c9a});_0x3f59a1[_0x9a24('0x6')]({'TranscriptionJobName':_0x5c2f56},function(_0x22f220,_0x13875f){if(_0x22f220){return _0x167980(_0x22f220);}else{return _0x1b0728(_0x13875f);}});});}function sentiment(_0x625ec3,_0x412da3,_0x1cb8aa,_0x543676,_0x510b29){return new Promise(function(_0x1cd07a,_0x1db2e0){var _0x885cac=new AWS['Comprehend']({'accessKeyId':_0x412da3,'secretAccessKey':_0x625ec3,'region':_0x1cb8aa});_0x885cac[_0x9a24('0x7')]({'Text':_0x543676,'LanguageCode':_0x510b29['substring'](0x0,0x2)},function(_0x2dc0a3,_0x5c2014){if(_0x2dc0a3){return _0x1db2e0(_0x2dc0a3);}else{return _0x1cd07a(_0x5c2014);}});});}function checkTranscribeJob(_0x4096cd,_0xf809b7,_0x3d278b){var _0x41f522;return new BPromise(function(_0x2ddaa8,_0x4f1017){logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0xa'),_0x4096cd['id'],_0x4096cd[_0x9a24('0xb')]));return getTranscriptionJob(_0x3d278b[_0x9a24('0xc')],_0x3d278b['data2'],_0xf809b7['transcribeRegion'],_0x4096cd[_0x9a24('0xb')])[_0x9a24('0xd')](function(_0x25202f){logger['info'](util[_0x9a24('0x9')](_0x9a24('0xe'),_0x4096cd['id'],_0x4096cd[_0x9a24('0xb')],_0x25202f[_0x9a24('0xf')][_0x9a24('0x10')]));if(!_0x4096cd[_0x9a24('0x11')]){switch(_0x25202f[_0x9a24('0xf')][_0x9a24('0x10')]){case _0x9a24('0x12'):var _0x2a38cf={'transcribeStatus':_0x25202f[_0x9a24('0xf')][_0x9a24('0x10')],'fileUri':_0x25202f['TranscriptionJob'][_0x9a24('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0x9a24('0x14'),_0x4096cd['id']));return rp({'uri':_0x25202f[_0x9a24('0xf')]['Transcript'][_0x9a24('0x15')],'json':!![]})[_0x9a24('0xd')](function(_0x69d2e9){logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x16'),_0x4096cd['id']));if(_0x69d2e9&&_0x69d2e9[_0x9a24('0x17')]&&_0x69d2e9[_0x9a24('0x17')][_0x9a24('0x18')]&&_0x69d2e9['results'][_0x9a24('0x18')][_0x9a24('0x19')]){_0x2a38cf[_0x9a24('0x11')]='';for(var _0x5e8c24=0x0;_0x5e8c24<_0x69d2e9[_0x9a24('0x17')]['transcripts'][_0x9a24('0x19')];_0x5e8c24++){_0x2a38cf[_0x9a24('0x11')]+=_0x69d2e9[_0x9a24('0x17')]['transcripts'][_0x5e8c24][_0x9a24('0x1a')]+'';}}return _0x4096cd[_0x9a24('0x1b')](_0x2a38cf);})[_0x9a24('0xd')](function(){logger[_0x9a24('0x8')](util[_0x9a24('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4096cd['id']));if(!_0x4096cd[_0x9a24('0x1c')]){throw new db['Sequelize'][(_0x9a24('0x1d'))](_0x9a24('0x1e'));}if(!_0xf809b7[_0x9a24('0x1f')]||!_0xf809b7[_0x9a24('0x20')]||!_0xf809b7[_0x9a24('0x21')]||!_0xf809b7['language']||!_0xf809b7['bucket']){throw new db[(_0x9a24('0x22'))][(_0x9a24('0x1d'))](_0x9a24('0x23'));}if(!_0x2a38cf[_0x9a24('0x11')]){throw new Error(_0x9a24('0x24'));}if(_0xf809b7[_0x9a24('0x20')]===_0x3d278b['id']){return _0x3d278b;}else{return db[_0x9a24('0x25')][_0x9a24('0x26')]({'where':{'id':_settings[_0x9a24('0x20')]}});}})[_0x9a24('0xd')](function(_0x279838){if(!_0x279838){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x27'));}if(!_0x279838[_0x9a24('0xc')]||!_0x279838[_0x9a24('0x28')]){throw new db['Sequelize']['ValidationError'](_0x9a24('0x29'));}_0x41f522=_0x279838;logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x2a'),_0x4096cd['id']));return sentiment(_0x41f522[_0x9a24('0xc')],_0x41f522['data2'],_0xf809b7[_0x9a24('0x21')],_0x2a38cf[_0x9a24('0x11')],_0xf809b7[_0x9a24('0x2b')]);})[_0x9a24('0xd')](function(_0x410e78){logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x2c'),_0x4096cd['id']));return _0x4096cd[_0x9a24('0x1b')]({'sentiment':_0x410e78[_0x9a24('0x2d')],'sPositive':_0x410e78[_0x9a24('0x2e')][_0x9a24('0x2f')],'sNegative':_0x410e78['SentimentScore'][_0x9a24('0x30')],'sMixed':_0x410e78[_0x9a24('0x2e')][_0x9a24('0x31')],'sNeutral':_0x410e78[_0x9a24('0x2e')][_0x9a24('0x32')]});})[_0x9a24('0xd')](function(){logger[_0x9a24('0x8')](util[_0x9a24('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4096cd['id']));_0x2ddaa8();});case _0x9a24('0x33'):return _0x4096cd[_0x9a24('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x25202f['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util['format'](_0x9a24('0x34'),_0x4096cd['id']));_0x2ddaa8();});default:logger['info'](util['format'](_0x9a24('0x35'),_0x4096cd['id']));break;}}else{return BPromise['resolve']()[_0x9a24('0xd')](function(){if(!_0x4096cd[_0x9a24('0x1c')]){throw new db[(_0x9a24('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xf809b7[_0x9a24('0x1f')]||!_0xf809b7[_0x9a24('0x20')]||!_0xf809b7[_0x9a24('0x21')]||!_0xf809b7[_0x9a24('0x2b')]||!_0xf809b7[_0x9a24('0x36')]){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x23'));}if(!_0x4096cd[_0x9a24('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0xf809b7[_0x9a24('0x20')]===_0x3d278b['id']){return _0x3d278b;}else{return db[_0x9a24('0x25')]['findOne']({'where':{'id':_settings[_0x9a24('0x20')]}});}})[_0x9a24('0xd')](function(_0xad9de4){if(!_0xad9de4){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x27'));}if(!_0xad9de4[_0x9a24('0xc')]||!_0xad9de4[_0x9a24('0x28')]){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x29'));}_0x41f522=_0xad9de4;logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x2a'),_0x4096cd['id']));return sentiment(_0x41f522[_0x9a24('0xc')],_0x41f522['data2'],_0xf809b7[_0x9a24('0x21')],_0x4096cd['fileText'],_0xf809b7[_0x9a24('0x2b')]);})['then'](function(_0x257ee4){logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x2c'),_0x4096cd['id']));return _0x4096cd[_0x9a24('0x1b')]({'sentiment':_0x257ee4[_0x9a24('0x2d')],'sPositive':_0x257ee4[_0x9a24('0x2e')][_0x9a24('0x2f')],'sNegative':_0x257ee4['SentimentScore'][_0x9a24('0x30')],'sMixed':_0x257ee4[_0x9a24('0x2e')][_0x9a24('0x31')],'sNeutral':_0x257ee4['SentimentScore'][_0x9a24('0x32')],'transcribeStatus':_0x9a24('0x12')});})['then'](function(){logger[_0x9a24('0x8')](util[_0x9a24('0x9')](_0x9a24('0x34'),_0x4096cd['id']));_0x2ddaa8();});}})[_0x9a24('0x37')](function(_0x4bb05c){if(_0x4bb05c){if(!_0x4bb05c[_0x9a24('0x38')]||_0x4bb05c[_0x9a24('0x38')]!==_0x9a24('0x39')){logger[_0x9a24('0x3a')](util[_0x9a24('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4096cd['id']),util['inspect'](_0x4bb05c,{'showHidden':![],'depth':null}));}}_0x2ddaa8();});});}function checkTranscribe(){var _0x35e16d;var _0x424802;var _0x107232;return db[_0x9a24('0x3b')][_0x9a24('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x9a24('0xd')](function(_0x315fd9){if(!_0x315fd9||!_0x315fd9['length']){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x3d'));}_0x35e16d=_0x315fd9;return db[_0x9a24('0x3e')][_0x9a24('0x26')]({'where':{'id':0x1}});})['then'](function(_0x2328c3){if(!_0x2328c3){throw new db[(_0x9a24('0x22'))][(_0x9a24('0x1d'))](_0x9a24('0x3f'));}_0x424802=_0x2328c3;if(!_0x424802[_0x9a24('0x40')]||!_0x424802[_0x9a24('0x41')]||!_0x424802[_0x9a24('0x42')]||!_0x424802[_0x9a24('0x2b')]||!_0x424802['bucket']){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x43'));}return db[_0x9a24('0x25')][_0x9a24('0x26')]({'where':{'id':_0x424802[_0x9a24('0x41')]}});})[_0x9a24('0xd')](function(_0x5ce00b){if(!_0x5ce00b){throw new db['Sequelize']['ValidationError'](_0x9a24('0x27'));}if(!_0x5ce00b[_0x9a24('0xc')]||!_0x5ce00b[_0x9a24('0x28')]){throw new db[(_0x9a24('0x22'))]['ValidationError'](_0x9a24('0x29'));}_0x107232=_0x5ce00b;var _0x4f33e3=[];_0x35e16d[_0x9a24('0x44')](function(_0x4b14fe){_0x4f33e3[_0x9a24('0x45')](checkTranscribeJob(_0x4b14fe,_0x424802,_0x107232));});return BPromise['all'](_0x4f33e3);})[_0x9a24('0x37')](function(_0x1eedc7){if(_0x1eedc7){if(!_0x1eedc7['name']||_0x1eedc7[_0x9a24('0x38')]!==_0x9a24('0x39')){logger[_0x9a24('0x3a')](util[_0x9a24('0x46')](_0x1eedc7,{'showHidden':![],'depth':null}));}}});}exports[_0x9a24('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x220b=['transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','Mixed','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','all','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion'];(function(_0x4172ad,_0x3ef53e){var _0x373f63=function(_0xc148ec){while(--_0xc148ec){_0x4172ad['push'](_0x4172ad['shift']());}};_0x373f63(++_0x3ef53e);}(_0x220b,0x1a2));var _0xb220=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x220b[_0x5b644e];return _0x49c6bf;};var _=require('lodash');var AWS=require(_0xb220('0x0'));var rp=require(_0xb220('0x1'));var util=require(_0xb220('0x2'));var BPromise=require(_0xb220('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xb220('0x4'))('transcribe');function getTranscriptionJob(_0x1aa3b8,_0x4dc358,_0x124b93,_0x2ff855){return new Promise(function(_0x1d2be4,_0x366a4d){var _0x5d7d19=new AWS[(_0xb220('0x5'))]({'accessKeyId':_0x4dc358,'secretAccessKey':_0x1aa3b8,'region':_0x124b93});_0x5d7d19[_0xb220('0x6')]({'TranscriptionJobName':_0x2ff855},function(_0x5b83b9,_0x12c68c){if(_0x5b83b9){return _0x366a4d(_0x5b83b9);}else{return _0x1d2be4(_0x12c68c);}});});}function sentiment(_0x3697f3,_0x33ae28,_0x2821a6,_0x16edb6,_0x2aaf7c){return new Promise(function(_0x24e6d9,_0x301978){var _0x1f30ee=new AWS['Comprehend']({'accessKeyId':_0x33ae28,'secretAccessKey':_0x3697f3,'region':_0x2821a6});_0x1f30ee[_0xb220('0x7')]({'Text':_0x16edb6,'LanguageCode':_0x2aaf7c[_0xb220('0x8')](0x0,0x2)},function(_0x5b39d5,_0x5c9af1){if(_0x5b39d5){return _0x301978(_0x5b39d5);}else{return _0x24e6d9(_0x5c9af1);}});});}function checkTranscribeJob(_0x4e6ba7,_0x528ce0,_0x59ef3e){var _0x11229c;return new BPromise(function(_0x573971,_0x3c310c){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0xb'),_0x4e6ba7['id'],_0x4e6ba7['transcribeName']));return getTranscriptionJob(_0x59ef3e['data1'],_0x59ef3e[_0xb220('0xc')],_0x528ce0[_0xb220('0xd')],_0x4e6ba7[_0xb220('0xe')])[_0xb220('0xf')](function(_0x16a34b){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x10'),_0x4e6ba7['id'],_0x4e6ba7[_0xb220('0xe')],_0x16a34b[_0xb220('0x11')][_0xb220('0x12')]));if(!_0x4e6ba7[_0xb220('0x13')]){switch(_0x16a34b[_0xb220('0x11')][_0xb220('0x12')]){case _0xb220('0x14'):var _0xe10309={'transcribeStatus':_0x16a34b[_0xb220('0x11')][_0xb220('0x12')],'fileUri':_0x16a34b[_0xb220('0x11')][_0xb220('0x15')][_0xb220('0x16')]};logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x17'),_0x4e6ba7['id']));return rp({'uri':_0x16a34b['TranscriptionJob'][_0xb220('0x15')]['TranscriptFileUri'],'json':!![]})[_0xb220('0xf')](function(_0x5c4d46){logger[_0xb220('0x9')](util['format'](_0xb220('0x18'),_0x4e6ba7['id']));if(_0x5c4d46&&_0x5c4d46[_0xb220('0x19')]&&_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')]&&_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')]['length']){_0xe10309[_0xb220('0x13')]='';for(var _0x108450=0x0;_0x108450<_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')][_0xb220('0x1b')];_0x108450++){_0xe10309['fileText']+=_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')][_0x108450]['transcript']+'';}}return _0x4e6ba7[_0xb220('0x1c')](_0xe10309);})[_0xb220('0xf')](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x1d'),_0x4e6ba7['id']));if(!_0x4e6ba7[_0xb220('0x1e')]){throw new db['Sequelize'][(_0xb220('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x528ce0['sentiment']||!_0x528ce0[_0xb220('0x20')]||!_0x528ce0[_0xb220('0x21')]||!_0x528ce0[_0xb220('0x22')]||!_0x528ce0[_0xb220('0x23')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x25'));}if(!_0xe10309[_0xb220('0x13')]){throw new Error(_0xb220('0x26'));}if(_0x528ce0[_0xb220('0x20')]===_0x59ef3e['id']){return _0x59ef3e;}else{return db['CloudProvider'][_0xb220('0x27')]({'where':{'id':_settings[_0xb220('0x20')]}});}})[_0xb220('0xf')](function(_0x5edd84){if(!_0x5edd84){throw new db['Sequelize'][(_0xb220('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5edd84['data1']||!_0x5edd84['data2']){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x28'));}_0x11229c=_0x5edd84;logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x29'),_0x4e6ba7['id']));return sentiment(_0x11229c['data1'],_0x11229c['data2'],_0x528ce0[_0xb220('0x21')],_0xe10309[_0xb220('0x13')],_0x528ce0['language']);})[_0xb220('0xf')](function(_0x4d855d){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x2a'),_0x4e6ba7['id']));return _0x4e6ba7[_0xb220('0x1c')]({'sentiment':_0x4d855d[_0xb220('0x2b')],'sPositive':_0x4d855d['SentimentScore']['Positive'],'sNegative':_0x4d855d['SentimentScore'][_0xb220('0x2c')],'sMixed':_0x4d855d['SentimentScore'][_0xb220('0x2d')],'sNeutral':_0x4d855d[_0xb220('0x2e')][_0xb220('0x2f')]});})['then'](function(){logger['info'](util[_0xb220('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e6ba7['id']));_0x573971();});case _0xb220('0x30'):return _0x4e6ba7[_0xb220('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x16a34b[_0xb220('0x11')][_0xb220('0x31')]})[_0xb220('0xf')](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x1d'),_0x4e6ba7['id']));_0x573971();});default:logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x32'),_0x4e6ba7['id']));break;}}else{return BPromise[_0xb220('0x33')]()[_0xb220('0xf')](function(){if(!_0x4e6ba7[_0xb220('0x1e')]){throw new db[(_0xb220('0x24'))]['ValidationError'](_0xb220('0x34'));}if(!_0x528ce0[_0xb220('0x35')]||!_0x528ce0[_0xb220('0x20')]||!_0x528ce0[_0xb220('0x21')]||!_0x528ce0[_0xb220('0x22')]||!_0x528ce0['bucket']){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x25'));}if(!_0x4e6ba7[_0xb220('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x528ce0['sentimentAccountId']===_0x59ef3e['id']){return _0x59ef3e;}else{return db[_0xb220('0x36')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb220('0xf')](function(_0x5dc84b){if(!_0x5dc84b){throw new db['Sequelize'][(_0xb220('0x1f'))](_0xb220('0x37'));}if(!_0x5dc84b[_0xb220('0x38')]||!_0x5dc84b[_0xb220('0xc')]){throw new db[(_0xb220('0x24'))]['ValidationError'](_0xb220('0x28'));}_0x11229c=_0x5dc84b;logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x29'),_0x4e6ba7['id']));return sentiment(_0x11229c[_0xb220('0x38')],_0x11229c[_0xb220('0xc')],_0x528ce0[_0xb220('0x21')],_0x4e6ba7[_0xb220('0x13')],_0x528ce0[_0xb220('0x22')]);})['then'](function(_0x494089){logger['info'](util[_0xb220('0xa')](_0xb220('0x2a'),_0x4e6ba7['id']));return _0x4e6ba7[_0xb220('0x1c')]({'sentiment':_0x494089[_0xb220('0x2b')],'sPositive':_0x494089[_0xb220('0x2e')][_0xb220('0x39')],'sNegative':_0x494089[_0xb220('0x2e')][_0xb220('0x2c')],'sMixed':_0x494089[_0xb220('0x2e')][_0xb220('0x2d')],'sNeutral':_0x494089[_0xb220('0x2e')][_0xb220('0x2f')],'transcribeStatus':_0xb220('0x14')});})['then'](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e6ba7['id']));_0x573971();});}})[_0xb220('0x3a')](function(_0x431af1){if(_0x431af1){if(!_0x431af1[_0xb220('0x3b')]||_0x431af1[_0xb220('0x3b')]!==_0xb220('0x3c')){logger[_0xb220('0x3d')](util[_0xb220('0xa')](_0xb220('0x3e'),_0x4e6ba7['id']),util[_0xb220('0x3f')](_0x431af1,{'showHidden':![],'depth':null}));}}_0x573971();});});}function checkTranscribe(){var _0x124901;var _0x4b50d3;var _0x56fb72;return db['VoiceRecording'][_0xb220('0x40')]({'where':{'transcribeStatus':_0xb220('0x41')}})[_0xb220('0xf')](function(_0x375d14){if(!_0x375d14||!_0x375d14['length']){throw new db['Sequelize'][(_0xb220('0x1f'))](_0xb220('0x42'));}_0x124901=_0x375d14;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xb220('0xf')](function(_0x5ef174){if(!_0x5ef174){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x43'));}_0x4b50d3=_0x5ef174;if(!_0x4b50d3[_0xb220('0x44')]||!_0x4b50d3[_0xb220('0x45')]||!_0x4b50d3[_0xb220('0xd')]||!_0x4b50d3['language']||!_0x4b50d3[_0xb220('0x23')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x46'));}return db[_0xb220('0x36')][_0xb220('0x27')]({'where':{'id':_0x4b50d3['transcribeAccountId']}});})['then'](function(_0x179cc5){if(!_0x179cc5){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x37'));}if(!_0x179cc5[_0xb220('0x38')]||!_0x179cc5[_0xb220('0xc')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x28'));}_0x56fb72=_0x179cc5;var _0x212521=[];_0x124901['forEach'](function(_0x1c5065){_0x212521['push'](checkTranscribeJob(_0x1c5065,_0x4b50d3,_0x56fb72));});return BPromise[_0xb220('0x47')](_0x212521);})[_0xb220('0x3a')](function(_0x139c69){if(_0x139c69){if(!_0x139c69[_0xb220('0x3b')]||_0x139c69[_0xb220('0x3b')]!==_0xb220('0x3c')){logger[_0xb220('0x3d')](util['inspect'](_0x139c69,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 42afbe7..f52d84d 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 _0x96e8=['length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x96e8,0x99));var _0x896e=function(_0x1617b3,_0xaaee1f){_0x1617b3=_0x1617b3-0x0;var _0x294065=_0x96e8[_0x1617b3];return _0x294065;};'use strict';var _=require(_0x896e('0x0'));var moment=require(_0x896e('0x1'));var Redis=require(_0x896e('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x896e('0x3'))['db'];var logger=require(_0x896e('0x4'))(_0x896e('0x5'));config[_0x896e('0x6')]=_[_0x896e('0x7')](config[_0x896e('0x6')],{'host':_0x896e('0x8'),'port':0x18eb});var io=require(_0x896e('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x29dac4=[];return db[_0x896e('0xa')][_0x896e('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x896e('0xc')](0x18,_0x896e('0xd'))}}})[_0x896e('0xe')](function(_0x3b4ed3){if(_0x3b4ed3&&_0x3b4ed3[_0x896e('0xf')]){_0x29dac4=_[_0x896e('0x10')](_0x3b4ed3||[],'id');logger['info'](_0x896e('0x11'),_0x29dac4[_0x896e('0x12')]());return db[_0x896e('0xa')][_0x896e('0x13')]({'closeReason':_0x896e('0x14'),'disposition':_0x896e('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x29dac4}});}})[_0x896e('0xe')](function(){if(_0x29dac4&&_0x29dac4[_0x896e('0xf')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x29dac4[_0x896e('0x12')]());for(var _0x3a4974=0x0;_0x3a4974<_0x29dac4[_0x896e('0xf')];_0x3a4974++){io[_0x896e('0x16')](_0x896e('0x17'),{'id':_0x29dac4[_0x3a4974],'closed':!![]});}}})[_0x896e('0x18')](function(_0x5b296e){logger[_0x896e('0x19')](_0x896e('0x1a'),_0x5b296e?util['inspect'](_0x5b296e,{'showHidden':![],'depth':null}):'');});}exports[_0x896e('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x18c6=['util','../../config/environment','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','then','emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis'];(function(_0x270412,_0x401d7a){var _0x4ca78e=function(_0xafb167){while(--_0xafb167){_0x270412['push'](_0x270412['shift']());}};_0x4ca78e(++_0x401d7a);}(_0x18c6,0xe7));var _0x618c=function(_0x398e4d,_0xcb6648){_0x398e4d=_0x398e4d-0x0;var _0x393d6e=_0x18c6[_0x398e4d];return _0x393d6e;};'use strict';var _=require(_0x618c('0x0'));var moment=require(_0x618c('0x1'));var Redis=require(_0x618c('0x2'));var util=require(_0x618c('0x3'));var config=require(_0x618c('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x618c('0x5'));config['redis']=_[_0x618c('0x6')](config[_0x618c('0x7')],{'host':_0x618c('0x8'),'port':0x18eb});var io=require(_0x618c('0x9'))(new Redis(config[_0x618c('0x7')]));function closeInteractions(){var _0x50597b=[];return db[_0x618c('0xa')][_0x618c('0xb')]({'raw':!![],'attributes':['id',_0x618c('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x618c('0xd')](0x18,'hours')}}})['then'](function(_0x2c78b4){if(_0x2c78b4&&_0x2c78b4[_0x618c('0xe')]){_0x50597b=_[_0x618c('0xf')](_0x2c78b4||[],'id');logger[_0x618c('0x10')](_0x618c('0x11'),_0x50597b[_0x618c('0x12')]());return db[_0x618c('0xa')][_0x618c('0x13')]({'closeReason':_0x618c('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x50597b}});}})[_0x618c('0x15')](function(){if(_0x50597b&&_0x50597b[_0x618c('0xe')]){logger[_0x618c('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x50597b[_0x618c('0x12')]());for(var _0x142f52=0x0;_0x142f52<_0x50597b[_0x618c('0xe')];_0x142f52++){io[_0x618c('0x16')]('whatsappInteraction:update',{'id':_0x50597b[_0x142f52],'closed':!![]});}}})['catch'](function(_0x14a198){logger[_0x618c('0x17')](_0x618c('0x18'),_0x14a198?util[_0x618c('0x19')](_0x14a198,{'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 7b96877..d0b4c32 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c26=['util','Innocenzo','Biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','hopper1','contacts2'];(function(_0x10e607,_0x26a4ec){var _0x147aba=function(_0x37edcd){while(--_0x37edcd){_0x10e607['push'](_0x10e607['shift']());}};_0x147aba(++_0x26a4ec);}(_0x2c26,0x180));var _0x62c2=function(_0x20d5d9,_0x128eca){_0x20d5d9=_0x20d5d9-0x0;var _0x1271ab=_0x2c26[_0x20d5d9];return _0x1271ab;};'use strict';var util=require(_0x62c2('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x62c2('0x1')+i,'lastName':_0x62c2('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x62c2('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x62c2('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x62c2('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x62c2('0x5')](),'updatedAt':Date[_0x62c2('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x62c2('0x1')+i,'lastName':_0x62c2('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x62c2('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x62c2('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x62c2('0x5')](),'updatedAt':Date['now']()});}db[_0x62c2('0x6')][_0x62c2('0x7')]({'where':{}})[_0x62c2('0x8')](function(){return db[_0x62c2('0x6')][_0x62c2('0x9')](contacts);})[_0x62c2('0x8')](function(){console['log']('finished\x20populating',_0x62c2('0xa'));return db[_0x62c2('0xb')][_0x62c2('0x7')]({'where':{}});})[_0x62c2('0x8')](function(){return db[_0x62c2('0xb')]['bulkCreate'](hopper);})['then'](function(){console[_0x62c2('0xc')](_0x62c2('0xd'),_0x62c2('0xe'));return db[_0x62c2('0x6')][_0x62c2('0x9')](contacts2);})[_0x62c2('0x8')](function(){console[_0x62c2('0xc')](_0x62c2('0xd'),_0x62c2('0xf'));return db[_0x62c2('0xb')]['bulkCreate'](hopper2);})[_0x62c2('0x8')](function(){console[_0x62c2('0xc')]('finished\x20populating','hopper2');})['catch'](function(_0x1993f2){console[_0x62c2('0xc')](_0x1993f2);}); \ No newline at end of file +var _0xb482=['../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','log','catch'];(function(_0x7a0d27,_0x166eeb){var _0x5ee426=function(_0x540545){while(--_0x540545){_0x7a0d27['push'](_0x7a0d27['shift']());}};_0x5ee426(++_0x166eeb);}(_0xb482,0x1c2));var _0x2b48=function(_0x460ffd,_0x539042){_0x460ffd=_0x460ffd-0x0;var _0x2c9c41=_0xb482[_0x460ffd];return _0x2c9c41;};'use strict';var util=require('util');var db=require(_0x2b48('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2b48('0x1')]({'id':i,'firstName':_0x2b48('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2b48('0x3')+i+_0x2b48('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['now'](),'updatedAt':Date[_0x2b48('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2b48('0x1')]({'id':i,'firstName':_0x2b48('0x2')+i,'lastName':_0x2b48('0x6')+i,'phone':0xf879fb460+i,'email':_0x2b48('0x3')+i+_0x2b48('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2b48('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2b48('0x5')]()});}db[_0x2b48('0x7')][_0x2b48('0x8')]({'where':{}})[_0x2b48('0x9')](function(){return db['CmContact'][_0x2b48('0xa')](contacts);})[_0x2b48('0x9')](function(){console['log'](_0x2b48('0xb'),_0x2b48('0xc'));return db[_0x2b48('0xd')][_0x2b48('0x8')]({'where':{}});})[_0x2b48('0x9')](function(){return db[_0x2b48('0xd')][_0x2b48('0xa')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x2b48('0xe'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console['log'](_0x2b48('0xb'),_0x2b48('0xf'));return db[_0x2b48('0xd')][_0x2b48('0xa')](hopper2);})[_0x2b48('0x9')](function(){console[_0x2b48('0x10')]('finished\x20populating','hopper2');})[_0x2b48('0x11')](function(_0x48f9d8){console[_0x2b48('0x10')](_0x48f9d8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7175dee..77f9cca 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b58=['catch','util','agent','format','%s%s','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user'];(function(_0x214941,_0x5147cf){var _0x34ee12=function(_0x455882){while(--_0x455882){_0x214941['push'](_0x214941['shift']());}};_0x34ee12(++_0x5147cf);}(_0x6b58,0xc9));var _0x86b5=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x6b58[_0x3826ad];return _0x17b900;};'use strict';var util=require(_0x86b5('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0x86b5('0x1'),i),'fullname':util[_0x86b5('0x2')](_0x86b5('0x3'),'agent',i),'email':util['format'](_0x86b5('0x4'),_0x86b5('0x1'),i),'role':'agent','password':_0x86b5('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0x86b5('0x6'),'ws',_0x86b5('0x7')],'disallow':[_0x86b5('0x8')],'allow':[_0x86b5('0x9')],'defaultuser':util[_0x86b5('0x2')](_0x86b5('0x3'),_0x86b5('0x1'),i),'encryption':_0x86b5('0xa'),'avpf':_0x86b5('0xa'),'force_avp':_0x86b5('0xa'),'icesupport':_0x86b5('0xa'),'dtlsenable':_0x86b5('0xa'),'dtlsverify':'no','dtlscertfile':_0x86b5('0xb'),'dtlsprivatekey':_0x86b5('0xc'),'dtlssetup':_0x86b5('0xd'),'callerid':util[_0x86b5('0x2')](_0x86b5('0xe'),util['format'](_0x86b5('0x3'),_0x86b5('0x1'),i),0xfa0+i)});}db[_0x86b5('0xf')]['bulkCreate'](users)[_0x86b5('0x10')](function(){console[_0x86b5('0x11')](_0x86b5('0x12'));})[_0x86b5('0x13')](function(_0x25caa8){console[_0x86b5('0x11')](_0x25caa8);}); \ No newline at end of file +var _0x80a4=['udp','wss','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','../mysqldb','push','format','agent','%s%s','password'];(function(_0x36217d,_0x4f464a){var _0x2e24e3=function(_0x560d48){while(--_0x560d48){_0x36217d['push'](_0x36217d['shift']());}};_0x2e24e3(++_0x4f464a);}(_0x80a4,0x71));var _0x480a=function(_0x35467b,_0x36613c){_0x35467b=_0x35467b-0x0;var _0x2daf9f=_0x80a4[_0x35467b];return _0x2daf9f;};'use strict';var util=require('util');var db=require(_0x480a('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x480a('0x1')]({'name':util[_0x480a('0x2')]('%s%s',_0x480a('0x3'),i),'fullname':util[_0x480a('0x2')](_0x480a('0x4'),_0x480a('0x3'),i),'email':util[_0x480a('0x2')]('%s%s@xcally.com',_0x480a('0x3'),i),'role':_0x480a('0x3'),'password':_0x480a('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0x480a('0x6'),'ws',_0x480a('0x7')],'disallow':[_0x480a('0x8')],'allow':[_0x480a('0x9')],'defaultuser':util['format'](_0x480a('0x4'),'agent',i),'encryption':_0x480a('0xa'),'avpf':'yes','force_avp':_0x480a('0xa'),'icesupport':_0x480a('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x480a('0xb'),'callerid':util[_0x480a('0x2')](_0x480a('0xc'),util[_0x480a('0x2')]('%s%s','agent',i),0xfa0+i)});}db[_0x480a('0xd')][_0x480a('0xe')](users)[_0x480a('0xf')](function(){console[_0x480a('0x10')]('add\x20user');})['catch'](function(_0x4de1a5){console[_0x480a('0x10')](_0x4de1a5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f0a8748..ee24d45 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdc1=['default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','role','telephone','Campaign','format','%s:queue:%s','user:%s','handshake','userProfileId','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','map','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join'];(function(_0x508ae3,_0x14f397){var _0x558766=function(_0x5eafbd){while(--_0x5eafbd){_0x508ae3['push'](_0x508ae3['shift']());}};_0x558766(++_0x14f397);}(_0xbdc1,0x147));var _0x1bdc=function(_0x3d7205,_0x3070aa){_0x3d7205=_0x3d7205-0x0;var _0x4f870b=_0xbdc1[_0x3d7205];return _0x4f870b;};'use strict';var _=require(_0x1bdc('0x0'));var util=require('util');var BPromise=require(_0x1bdc('0x1'));var db=require(_0x1bdc('0x2'))['db'];var config=require(_0x1bdc('0x3'));var queryQueues={'attributes':['id',_0x1bdc('0x4')],'include':[{'as':_0x1bdc('0x5'),'model':db[_0x1bdc('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x1bdc('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1bdc('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x1bdc('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1bdc('0x4')],'where':{'role':_0x1bdc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1bdc('0x4'),_0x1bdc('0x8')],'where':{'type':_0x1bdc('0x9')}};function getAssociatedResources(_0x3353ca,_0x19748a,_0x47675b){return db[_0x1bdc('0xa')][_0x1bdc('0xb')]({'where':{'name':_0x3353ca,'userProfileId':_0x19748a},'raw':!![]})[_0x1bdc('0xc')](function(_0x608a48){if(_0x608a48){if(_0x608a48['autoAssociation']){switch(_0x3353ca){case _0x1bdc('0xd'):case _0x1bdc('0xe'):case _0x1bdc('0xf'):case _0x1bdc('0x10'):case _0x1bdc('0x11'):case _0x1bdc('0x12'):case _0x1bdc('0x13'):return db[_0x47675b]['findAll'](queryQueues);case _0x1bdc('0x14'):return db[_0x47675b][_0x1bdc('0x15')](queryTelephones);case _0x1bdc('0x16'):return db[_0x47675b]['findAll'](queryTrunks);case _0x1bdc('0x17'):return db[_0x47675b]['findAll'](queryCampaigns);}}else{return db[_0x1bdc('0x18')][_0x1bdc('0x15')]({'attributes':[_0x1bdc('0x19')],'where':{'sectionId':_0x608a48['id']},'raw':!![]})[_0x1bdc('0xc')](function(_0x20fc10){if(_0x20fc10){var _0x1e46ef={'where':{'id':_['map'](_0x20fc10,_0x1bdc('0x19'))},'raw':!![]};switch(_0x47675b){case'User':_0x1e46ef[_0x1bdc('0x1a')][_0x1bdc('0x1b')]=_0x1bdc('0x1c');break;case _0x1bdc('0x1d'):_0x1e46ef[_0x1bdc('0x1a')][_0x1bdc('0x8')]=_0x1bdc('0x9');break;}return db[_0x47675b][_0x1bdc('0x15')](_0x1e46ef);}else{return[];}});}}else{return[];}})['then'](function(_0xe32bda){return _0xe32bda;});}function joinOrLeaveQueues(_0x16ef90,_0x25662a,_0x1b827d,_0x24f2ac){_0x16ef90[_0x25662a](util[_0x1bdc('0x1e')](_0x1bdc('0x1f'),_0x1b827d,_0x24f2ac[_0x1bdc('0x4')]));if(_0x24f2ac[_0x1bdc('0x5')]){for(var _0x568b4b=0x0;_0x568b4b<_0x24f2ac['Agents']['length'];_0x568b4b+=0x1){_0x16ef90[_0x25662a](util[_0x1bdc('0x1e')](_0x1bdc('0x20'),_0x24f2ac[_0x1bdc('0x5')][_0x568b4b][_0x1bdc('0x4')]));}}}function joinOrLeave(_0x2e3c4a,_0x195714,_0x529db2){var _0x3b4ff4;if(_0x2e3c4a[_0x1bdc('0x21')]['query']['id']){db['User']['find']({'attributes':['id',_0x1bdc('0x4'),_0x1bdc('0x1b'),_0x1bdc('0x22')],'where':{'id':_0x2e3c4a[_0x1bdc('0x21')][_0x1bdc('0x23')]['id']},'include':[{'model':db[_0x1bdc('0x24')],'as':_0x1bdc('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x1bdc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1bdc('0x27')],'as':_0x1bdc('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1bdc('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1bdc('0x2a')],'as':_0x1bdc('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x1bdc('0x2c')],'as':_0x1bdc('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x1bdc('0xc')](function(_0x49a2f4){if(_0x49a2f4){_0x3b4ff4=_0x49a2f4;_0x2e3c4a[_0x195714](util[_0x1bdc('0x1e')](_0x1bdc('0x20'),_0x49a2f4['name']));var _0x493374=[];switch(_0x49a2f4[_0x1bdc('0x1b')]){case _0x1bdc('0x2e'):_0x2e3c4a[_0x195714](_0x1bdc('0x2f'));_0x2e3c4a[_0x195714](_0x1bdc('0x30'));if(queryQueues['hasOwnProperty'](_0x1bdc('0x31'))){delete queryQueues[_0x1bdc('0x31')];}_0x493374['push'](db[_0x1bdc('0x32')][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x34')][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x35')][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db['SmsQueue'][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x36')][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x37')]['findAll'](queryQueues));_0x493374['push'](db[_0x1bdc('0x38')][_0x1bdc('0x15')](queryQueues));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x6')][_0x1bdc('0x15')](queryTelephones));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x39')][_0x1bdc('0x15')](queryTrunks));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x1d')][_0x1bdc('0x15')](queryCampaigns));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x6')][_0x1bdc('0x15')](queryAgents));break;case _0x1bdc('0x3a'):_0x2e3c4a[_0x195714]('voice:inbound');_0x2e3c4a[_0x195714](_0x1bdc('0x30'));_0x493374['push'](getAssociatedResources(_0x1bdc('0xd'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x32')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0xe'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x34')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0xf'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x35')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0x10'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x3b')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0x11'),_0x49a2f4['userProfileId'],_0x1bdc('0x36')));_0x493374['push'](getAssociatedResources('OpenchannelQueues',_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x37')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0x13'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x38')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0x14'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x6')));_0x493374[_0x1bdc('0x33')](getAssociatedResources(_0x1bdc('0x16'),_0x49a2f4[_0x1bdc('0x22')],'Trunk'));_0x493374['push'](getAssociatedResources(_0x1bdc('0x17'),_0x49a2f4[_0x1bdc('0x22')],_0x1bdc('0x1d')));_0x493374[_0x1bdc('0x33')](db[_0x1bdc('0x6')][_0x1bdc('0x15')](queryAgents));break;case _0x1bdc('0x7'):_0x2e3c4a[_0x195714](_0x1bdc('0x2f'));_0x2e3c4a[_0x195714](_0x1bdc('0x30'));_0x493374[_0x1bdc('0x33')](_0x49a2f4[_0x1bdc('0x3c')]({'attributes':['id','name']}));_0x493374[_0x1bdc('0x33')](_0x49a2f4['getChatQueues']({'attributes':['id',_0x1bdc('0x4')]}));_0x493374['push'](_0x49a2f4['getFaxQueues']({'attributes':['id','name']}));_0x493374['push'](_0x49a2f4[_0x1bdc('0x3d')]({'attributes':['id',_0x1bdc('0x4')]}));_0x493374[_0x1bdc('0x33')](_0x49a2f4[_0x1bdc('0x3e')]({'attributes':['id',_0x1bdc('0x4')]}));_0x493374[_0x1bdc('0x33')](_0x49a2f4[_0x1bdc('0x3f')]({'attributes':['id',_0x1bdc('0x4')]}));_0x493374[_0x1bdc('0x33')](_0x49a2f4[_0x1bdc('0x40')]({'attributes':['id',_0x1bdc('0x4')]}));break;}return BPromise[_0x1bdc('0x41')](_0x493374);}})[_0x1bdc('0xc')](function(_0x1112a5){if(_0x1112a5&&_0x1112a5['length']){for(var _0x35545a=0x0;_0x35545a<_0x1112a5[_0x1bdc('0x42')];_0x35545a+=0x1){for(var _0x18df5e=0x0;_0x18df5e<_0x1112a5[_0x35545a][_0x1bdc('0x42')];_0x18df5e+=0x1){switch(_0x35545a){case 0x0:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x43'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x1:joinOrLeaveQueues(_0x2e3c4a,_0x195714,'chat',_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x2:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x44'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x3:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x45'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x4:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x46'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x5:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x47'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x6:joinOrLeaveQueues(_0x2e3c4a,_0x195714,_0x1bdc('0x48'),_0x1112a5[_0x35545a][_0x18df5e]);break;case 0x7:if(_0x3b4ff4[_0x1bdc('0x1b')]!=='agent')_0x2e3c4a[_0x195714](util[_0x1bdc('0x1e')](_0x1bdc('0x49'),_0x1112a5[_0x35545a][_0x18df5e][_0x1bdc('0x4')]));break;case 0x8:if(_0x3b4ff4[_0x1bdc('0x1b')]!=='agent')_0x2e3c4a[_0x195714](util[_0x1bdc('0x1e')](_0x1bdc('0x4a'),_0x1112a5[_0x35545a][_0x18df5e][_0x1bdc('0x4')]));break;case 0x9:if(_0x3b4ff4[_0x1bdc('0x1b')]!==_0x1bdc('0x7'))_0x2e3c4a[_0x195714](util['format'](_0x1bdc('0x4b'),_0x1112a5[_0x35545a][_0x18df5e]['type'],_0x1112a5[_0x35545a][_0x18df5e]['name']));break;case 0xa:_0x2e3c4a[_0x195714](util['format']('user:%s',_0x1112a5[_0x35545a][_0x18df5e]['name']));break;}}}}})[_0x1bdc('0xc')](function(){if(_0x195714===_0x1bdc('0x4c')){var _0x3a537e=_['map'](_0x3b4ff4['ChatInteractions'],'id');return _0x3b4ff4[_0x1bdc('0x4d')](_0x3a537e)[_0x1bdc('0xc')](function(){for(var _0x22250f=0x0;_0x22250f<_0x3a537e[_0x1bdc('0x42')];_0x22250f+=0x1){_0x529db2[_0x1bdc('0x4e')](_0x1bdc('0x4f'),{'ChatInteractionId':Number(_0x3a537e[_0x22250f]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0xc')](function(){if(_0x195714===_0x1bdc('0x4c')){var _0x20800c=_[_0x1bdc('0x50')](_0x3b4ff4[_0x1bdc('0x26')],'id');return _0x3b4ff4['removeMailInteractions'](_0x20800c)[_0x1bdc('0xc')](function(){for(var _0x57b076=0x0;_0x57b076<_0x20800c[_0x1bdc('0x42')];_0x57b076+=0x1){_0x529db2[_0x1bdc('0x4e')](_0x1bdc('0x51'),{'MailInteractionId':Number(_0x20800c[_0x57b076]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0xc')](function(){if(_0x195714===_0x1bdc('0x4c')){var _0x22ce50=_[_0x1bdc('0x50')](_0x3b4ff4[_0x1bdc('0x28')],'id');return _0x3b4ff4[_0x1bdc('0x52')](_0x22ce50)[_0x1bdc('0xc')](function(){for(var _0x3330dd=0x0;_0x3330dd<_0x22ce50[_0x1bdc('0x42')];_0x3330dd+=0x1){_0x529db2[_0x1bdc('0x4e')](_0x1bdc('0x53'),{'FaxInteractionId':Number(_0x22ce50[_0x3330dd]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0xc')](function(){if(_0x195714===_0x1bdc('0x4c')){var _0x2ef3a6=_[_0x1bdc('0x50')](_0x3b4ff4[_0x1bdc('0x54')],'id');return _0x3b4ff4[_0x1bdc('0x55')](_0x2ef3a6)['then'](function(){for(var _0x2b1fee=0x0;_0x2b1fee<_0x2ef3a6[_0x1bdc('0x42')];_0x2b1fee+=0x1){_0x529db2['emit'](_0x1bdc('0x56'),{'SmsInteractionId':Number(_0x2ef3a6[_0x2b1fee]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0xc')](function(){if(_0x195714===_0x1bdc('0x4c')){var _0x3543c5=_[_0x1bdc('0x50')](_0x3b4ff4[_0x1bdc('0x2b')],'id');return _0x3b4ff4[_0x1bdc('0x57')](_0x3543c5)[_0x1bdc('0xc')](function(){for(var _0x101361=0x0;_0x101361<_0x3543c5[_0x1bdc('0x42')];_0x101361+=0x1){_0x529db2[_0x1bdc('0x4e')](_0x1bdc('0x58'),{'OpenchannelInteractionId':Number(_0x3543c5[_0x101361]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0xc')](function(){if(_0x195714==='leave'){var _0x9ff424=_['map'](_0x3b4ff4['WhatsappInteractions'],'id');return _0x3b4ff4[_0x1bdc('0x59')](_0x9ff424)[_0x1bdc('0xc')](function(){for(var _0xa1fd1f=0x0;_0xa1fd1f<_0x9ff424[_0x1bdc('0x42')];_0xa1fd1f+=0x1){_0x529db2[_0x1bdc('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x9ff424[_0xa1fd1f]),'UserId':Number(_0x3b4ff4['id'])});}});}})[_0x1bdc('0x5a')](function(_0xca3dcc){_0x2e3c4a[_0x1bdc('0x5b')](_0xca3dcc);});}}function onDisconnect(_0x533826,_0x4a524c){joinOrLeave(_0x533826,_0x1bdc('0x4c'),_0x4a524c);}function onConnect(_0x44a5c4){joinOrLeave(_0x44a5c4,_0x1bdc('0x5c'));}exports[_0x1bdc('0x5d')]=function(_0x12fef6){_0x12fef6['on'](_0x1bdc('0x5e'),function(_0x514d60){_0x514d60[_0x1bdc('0x5f')](0x0);_0x514d60[_0x1bdc('0x60')]=_0x514d60[_0x1bdc('0x61')][_0x1bdc('0x5e')][_0x1bdc('0x62')]+':'+_0x514d60[_0x1bdc('0x61')][_0x1bdc('0x5e')]['remotePort'];_0x514d60[_0x1bdc('0x63')]=new Date();_0x514d60[_0x1bdc('0x5b')]=function(_0x340716){console[_0x1bdc('0x5b')](_0x1bdc('0x64')+_0x514d60[_0x1bdc('0x65')][_0x1bdc('0x4')]+'['+_0x514d60[_0x1bdc('0x60')]+']',_0x340716);};_0x514d60['on'](_0x1bdc('0x66'),function(){onDisconnect(_0x514d60,_0x12fef6);_0x514d60['log'](_0x1bdc('0x67'));});onConnect(_0x514d60);_0x514d60['log'](_0x1bdc('0x68'));});}; \ No newline at end of file +var _0xa3fe=['getWhatsappQueues','all','chat','fax','agent','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','removeMailInteractions','emit','removeFaxInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','telephone','type','ivr','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Trunks','findAll','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','ChatQueues','FaxQueues','SmsQueue','Telephones','IvrCampaigns','getSmsQueues','getMailQueues','getOpenchannelQueues'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xa3fe,0xd8));var _0xea3f=function(_0x10628f,_0x30ff8e){_0x10628f=_0x10628f-0x0;var _0x40eabe=_0xa3fe[_0x10628f];return _0x40eabe;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var BPromise=require(_0xea3f('0x1'));var db=require(_0xea3f('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xea3f('0x3')],'include':[{'as':_0xea3f('0x4'),'model':db[_0xea3f('0x5')],'attributes':['id','name',_0xea3f('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xea3f('0x3')],'where':{'role':_0xea3f('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xea3f('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xea3f('0x3'),_0xea3f('0x8')],'where':{'type':_0xea3f('0x9')}};function getAssociatedResources(_0x5dbd3e,_0x5ec1ac,_0x464ad4){return db['UserProfileSection']['findOne']({'where':{'name':_0x5dbd3e,'userProfileId':_0x5ec1ac},'raw':!![]})[_0xea3f('0xa')](function(_0xa8b25b){if(_0xa8b25b){if(_0xa8b25b[_0xea3f('0xb')]){switch(_0x5dbd3e){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xea3f('0xc'):case _0xea3f('0xd'):case _0xea3f('0xe'):case _0xea3f('0xf'):return db[_0x464ad4]['findAll'](queryQueues);case'Telephones':return db[_0x464ad4]['findAll'](queryTelephones);case _0xea3f('0x10'):return db[_0x464ad4][_0xea3f('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x464ad4][_0xea3f('0x11')](queryCampaigns);}}else{return db[_0xea3f('0x12')]['findAll']({'attributes':[_0xea3f('0x13')],'where':{'sectionId':_0xa8b25b['id']},'raw':!![]})[_0xea3f('0xa')](function(_0x153f0e){if(_0x153f0e){var _0x4becc3={'where':{'id':_[_0xea3f('0x14')](_0x153f0e,_0xea3f('0x13'))},'raw':!![]};switch(_0x464ad4){case _0xea3f('0x5'):_0x4becc3[_0xea3f('0x15')][_0xea3f('0x6')]=_0xea3f('0x7');break;case _0xea3f('0x16'):_0x4becc3[_0xea3f('0x15')][_0xea3f('0x8')]=_0xea3f('0x9');break;}return db[_0x464ad4][_0xea3f('0x11')](_0x4becc3);}else{return[];}});}}else{return[];}})[_0xea3f('0xa')](function(_0x24d3b5){return _0x24d3b5;});}function joinOrLeaveQueues(_0x35153d,_0x4bbd3c,_0x4e1c9d,_0x2eb0d6){_0x35153d[_0x4bbd3c](util[_0xea3f('0x17')](_0xea3f('0x18'),_0x4e1c9d,_0x2eb0d6[_0xea3f('0x3')]));if(_0x2eb0d6['Agents']){for(var _0x4af6e4=0x0;_0x4af6e4<_0x2eb0d6[_0xea3f('0x4')][_0xea3f('0x19')];_0x4af6e4+=0x1){_0x35153d[_0x4bbd3c](util['format'](_0xea3f('0x1a'),_0x2eb0d6[_0xea3f('0x4')][_0x4af6e4][_0xea3f('0x3')]));}}}function joinOrLeave(_0x144380,_0x5f452b,_0x5bd381){var _0x5c2eb0;if(_0x144380[_0xea3f('0x1b')][_0xea3f('0x1c')]['id']){db[_0xea3f('0x5')][_0xea3f('0x1d')]({'attributes':['id',_0xea3f('0x3'),_0xea3f('0x6'),_0xea3f('0x1e')],'where':{'id':_0x144380['handshake'][_0xea3f('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xea3f('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xea3f('0x20')],'as':_0xea3f('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xea3f('0x22')],'as':_0xea3f('0x23'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xea3f('0x24'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xea3f('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xea3f('0x26')],'as':_0xea3f('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x437070){if(_0x437070){_0x5c2eb0=_0x437070;_0x144380[_0x5f452b](util[_0xea3f('0x17')]('user:%s',_0x437070[_0xea3f('0x3')]));var _0x743b54=[];switch(_0x437070[_0xea3f('0x6')]){case _0xea3f('0x28'):_0x144380[_0x5f452b](_0xea3f('0x29'));_0x144380[_0x5f452b](_0xea3f('0x2a'));if(queryQueues[_0xea3f('0x2b')](_0xea3f('0x2c'))){delete queryQueues[_0xea3f('0x2c')];}_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x2e')][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x2f')][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x30')][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db['SmsQueue'][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x31')][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x32')][_0xea3f('0x11')](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x33')]['findAll'](queryQueues));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x5')][_0xea3f('0x11')](queryTelephones));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x34')]['findAll'](queryTrunks));_0x743b54['push'](db[_0xea3f('0x16')]['findAll'](queryCampaigns));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x5')][_0xea3f('0x11')](queryAgents));break;case _0xea3f('0x35'):_0x144380[_0x5f452b](_0xea3f('0x29'));_0x144380[_0x5f452b](_0xea3f('0x2a'));_0x743b54['push'](getAssociatedResources(_0xea3f('0x36'),_0x437070['userProfileId'],'VoiceQueue'));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0x37'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x2f')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0x38'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x30')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0xc'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x39')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources('MailQueues',_0x437070[_0xea3f('0x1e')],'MailQueue'));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0xe'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x32')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources('WhatsappQueues',_0x437070[_0xea3f('0x1e')],'WhatsappQueue'));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0x3a'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x5')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0x10'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x34')));_0x743b54[_0xea3f('0x2d')](getAssociatedResources(_0xea3f('0x3b'),_0x437070[_0xea3f('0x1e')],_0xea3f('0x16')));_0x743b54[_0xea3f('0x2d')](db[_0xea3f('0x5')][_0xea3f('0x11')](queryAgents));break;case'agent':_0x144380[_0x5f452b](_0xea3f('0x29'));_0x144380[_0x5f452b]('voice:outbound');_0x743b54[_0xea3f('0x2d')](_0x437070['getVoiceQueues']({'attributes':['id',_0xea3f('0x3')]}));_0x743b54[_0xea3f('0x2d')](_0x437070['getChatQueues']({'attributes':['id',_0xea3f('0x3')]}));_0x743b54[_0xea3f('0x2d')](_0x437070['getFaxQueues']({'attributes':['id',_0xea3f('0x3')]}));_0x743b54[_0xea3f('0x2d')](_0x437070[_0xea3f('0x3c')]({'attributes':['id','name']}));_0x743b54[_0xea3f('0x2d')](_0x437070[_0xea3f('0x3d')]({'attributes':['id',_0xea3f('0x3')]}));_0x743b54[_0xea3f('0x2d')](_0x437070[_0xea3f('0x3e')]({'attributes':['id',_0xea3f('0x3')]}));_0x743b54[_0xea3f('0x2d')](_0x437070[_0xea3f('0x3f')]({'attributes':['id',_0xea3f('0x3')]}));break;}return BPromise[_0xea3f('0x40')](_0x743b54);}})[_0xea3f('0xa')](function(_0x192039){if(_0x192039&&_0x192039[_0xea3f('0x19')]){for(var _0x2bc494=0x0;_0x2bc494<_0x192039['length'];_0x2bc494+=0x1){for(var _0x5ebca3=0x0;_0x5ebca3<_0x192039[_0x2bc494][_0xea3f('0x19')];_0x5ebca3+=0x1){switch(_0x2bc494){case 0x0:joinOrLeaveQueues(_0x144380,_0x5f452b,'voice',_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x1:joinOrLeaveQueues(_0x144380,_0x5f452b,_0xea3f('0x41'),_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x2:joinOrLeaveQueues(_0x144380,_0x5f452b,_0xea3f('0x42'),_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x3:joinOrLeaveQueues(_0x144380,_0x5f452b,'sms',_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x4:joinOrLeaveQueues(_0x144380,_0x5f452b,'mail',_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x5:joinOrLeaveQueues(_0x144380,_0x5f452b,'openchannel',_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x6:joinOrLeaveQueues(_0x144380,_0x5f452b,'whatsapp',_0x192039[_0x2bc494][_0x5ebca3]);break;case 0x7:if(_0x5c2eb0[_0xea3f('0x6')]!==_0xea3f('0x43'))_0x144380[_0x5f452b](util[_0xea3f('0x17')](_0xea3f('0x44'),_0x192039[_0x2bc494][_0x5ebca3][_0xea3f('0x3')]));break;case 0x8:if(_0x5c2eb0[_0xea3f('0x6')]!=='agent')_0x144380[_0x5f452b](util[_0xea3f('0x17')]('trunk:%s',_0x192039[_0x2bc494][_0x5ebca3][_0xea3f('0x3')]));break;case 0x9:if(_0x5c2eb0[_0xea3f('0x6')]!=='agent')_0x144380[_0x5f452b](util[_0xea3f('0x17')](_0xea3f('0x45'),_0x192039[_0x2bc494][_0x5ebca3]['type'],_0x192039[_0x2bc494][_0x5ebca3][_0xea3f('0x3')]));break;case 0xa:_0x144380[_0x5f452b](util[_0xea3f('0x17')](_0xea3f('0x1a'),_0x192039[_0x2bc494][_0x5ebca3][_0xea3f('0x3')]));break;}}}}})[_0xea3f('0xa')](function(){if(_0x5f452b===_0xea3f('0x46')){var _0x983a4b=_[_0xea3f('0x14')](_0x5c2eb0[_0xea3f('0x1f')],'id');return _0x5c2eb0[_0xea3f('0x47')](_0x983a4b)[_0xea3f('0xa')](function(){for(var _0x3f307a=0x0;_0x3f307a<_0x983a4b[_0xea3f('0x19')];_0x3f307a+=0x1){_0x5bd381['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x983a4b[_0x3f307a]),'UserId':Number(_0x5c2eb0['id'])});}});}})['then'](function(){if(_0x5f452b===_0xea3f('0x46')){var _0xb4c93a=_[_0xea3f('0x14')](_0x5c2eb0[_0xea3f('0x21')],'id');return _0x5c2eb0[_0xea3f('0x48')](_0xb4c93a)[_0xea3f('0xa')](function(){for(var _0x529cd4=0x0;_0x529cd4<_0xb4c93a[_0xea3f('0x19')];_0x529cd4+=0x1){_0x5bd381[_0xea3f('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xb4c93a[_0x529cd4]),'UserId':Number(_0x5c2eb0['id'])});}});}})[_0xea3f('0xa')](function(){if(_0x5f452b==='leave'){var _0x20ceda=_[_0xea3f('0x14')](_0x5c2eb0[_0xea3f('0x23')],'id');return _0x5c2eb0[_0xea3f('0x4a')](_0x20ceda)[_0xea3f('0xa')](function(){for(var _0x3b3e64=0x0;_0x3b3e64<_0x20ceda[_0xea3f('0x19')];_0x3b3e64+=0x1){_0x5bd381[_0xea3f('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x20ceda[_0x3b3e64]),'UserId':Number(_0x5c2eb0['id'])});}});}})['then'](function(){if(_0x5f452b==='leave'){var _0x3361d3=_[_0xea3f('0x14')](_0x5c2eb0[_0xea3f('0x24')],'id');return _0x5c2eb0['removeSmsInteractions'](_0x3361d3)[_0xea3f('0xa')](function(){for(var _0x3f516f=0x0;_0x3f516f<_0x3361d3['length'];_0x3f516f+=0x1){_0x5bd381[_0xea3f('0x49')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3361d3[_0x3f516f]),'UserId':Number(_0x5c2eb0['id'])});}});}})['then'](function(){if(_0x5f452b===_0xea3f('0x46')){var _0x5bf5f2=_[_0xea3f('0x14')](_0x5c2eb0[_0xea3f('0x25')],'id');return _0x5c2eb0[_0xea3f('0x4b')](_0x5bf5f2)[_0xea3f('0xa')](function(){for(var _0x148791=0x0;_0x148791<_0x5bf5f2['length'];_0x148791+=0x1){_0x5bd381[_0xea3f('0x49')](_0xea3f('0x4c'),{'OpenchannelInteractionId':Number(_0x5bf5f2[_0x148791]),'UserId':Number(_0x5c2eb0['id'])});}});}})[_0xea3f('0xa')](function(){if(_0x5f452b===_0xea3f('0x46')){var _0x73e7e4=_[_0xea3f('0x14')](_0x5c2eb0['WhatsappInteractions'],'id');return _0x5c2eb0['removeWhatsappInteractions'](_0x73e7e4)[_0xea3f('0xa')](function(){for(var _0x41c544=0x0;_0x41c544<_0x73e7e4[_0xea3f('0x19')];_0x41c544+=0x1){_0x5bd381[_0xea3f('0x49')](_0xea3f('0x4d'),{'WhatsappInteractionId':Number(_0x73e7e4[_0x41c544]),'UserId':Number(_0x5c2eb0['id'])});}});}})[_0xea3f('0x4e')](function(_0x4d7474){_0x144380[_0xea3f('0x4f')](_0x4d7474);});}}function onDisconnect(_0x1fc4c5,_0x43a1db){joinOrLeave(_0x1fc4c5,_0xea3f('0x46'),_0x43a1db);}function onConnect(_0x54f5e4){joinOrLeave(_0x54f5e4,_0xea3f('0x50'));}exports[_0xea3f('0x51')]=function(_0x5102bb){_0x5102bb['on'](_0xea3f('0x52'),function(_0x2ba0aa){_0x2ba0aa[_0xea3f('0x53')](0x0);_0x2ba0aa['address']=_0x2ba0aa[_0xea3f('0x54')][_0xea3f('0x52')]['remoteAddress']+':'+_0x2ba0aa['request'][_0xea3f('0x52')][_0xea3f('0x55')];_0x2ba0aa[_0xea3f('0x56')]=new Date();_0x2ba0aa[_0xea3f('0x4f')]=function(_0x360268){console[_0xea3f('0x4f')](_0xea3f('0x57')+_0x2ba0aa[_0xea3f('0x58')][_0xea3f('0x3')]+'['+_0x2ba0aa[_0xea3f('0x59')]+']',_0x360268);};_0x2ba0aa['on'](_0xea3f('0x5a'),function(){onDisconnect(_0x2ba0aa,_0x5102bb);_0x2ba0aa[_0xea3f('0x4f')](_0xea3f('0x5b'));});onConnect(_0x2ba0aa);_0x2ba0aa[_0xea3f('0x4f')](_0xea3f('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d93dd7a..33d099e 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 _0x76a0=['format','SIP/%s','name','agent','incomingmessage','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','interface','AfterCreate','closed','changed','substatus','AfterUpdate','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','triggers','client','http','Chat','newinteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','afterCreate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','ContactId','undefined','sequelize','query','Sequelize','SELECT','contact','UserId'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x76a0,0x193));var _0x076a=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x76a0[_0x3b81eb];return _0x149491;};'use strict';var util=require(_0x076a('0x0'));var db=require(_0x076a('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x076a('0x2'));var client=jayson[_0x076a('0x3')][_0x076a('0x4')]({'port':0x232a});var triggers=[{'channel':_0x076a('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x076a('0x6'),'callback':afterCreate},{'channel':_0x076a('0x5'),'model':'ChatInteraction','event':_0x076a('0x7'),'condition':_0x076a('0x8'),'callback':afterUpdate},{'channel':_0x076a('0x5'),'model':'ChatMessage','event':'afterCreate','condition':_0x076a('0x9'),'callback':afterCreateMessage},{'channel':_0x076a('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x076a('0xa'),'model':_0x076a('0xb'),'event':_0x076a('0xc'),'condition':_0x076a('0x6'),'callback':afterCreate},{'channel':_0x076a('0xa'),'model':_0x076a('0xb'),'event':'afterUpdate','condition':_0x076a('0x8'),'callback':afterUpdate},{'channel':_0x076a('0xa'),'model':_0x076a('0xd'),'event':'afterCreate','condition':_0x076a('0x9'),'callback':afterCreateMessage},{'channel':_0x076a('0xe'),'model':_0x076a('0xf'),'event':_0x076a('0xc'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x076a('0xe'),'model':_0x076a('0xf'),'event':_0x076a('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x076a('0x10'),'event':_0x076a('0xc'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x076a('0x11'),'event':_0x076a('0xc'),'condition':_0x076a('0x6'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x076a('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x076a('0x12'),'model':_0x076a('0x13'),'event':'afterCreate','condition':_0x076a('0x9'),'callback':afterCreateMessage},{'channel':_0x076a('0x14'),'model':_0x076a('0x15'),'event':_0x076a('0xc'),'condition':_0x076a('0x6'),'callback':afterCreate},{'channel':_0x076a('0x14'),'model':_0x076a('0x15'),'event':_0x076a('0x7'),'condition':_0x076a('0x8'),'callback':afterUpdate},{'channel':_0x076a('0x14'),'model':_0x076a('0x16'),'event':_0x076a('0xc'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x076a('0x17'),'model':'OpenchannelInteraction','event':_0x076a('0xc'),'condition':_0x076a('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0x076a('0x18'),'event':_0x076a('0x7'),'condition':_0x076a('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x076a('0x19'),'event':_0x076a('0xc'),'condition':_0x076a('0x9'),'callback':afterCreateMessage}];function request(_0x392244){return client[_0x076a('0x1a')](_0x076a('0x1b'),_0x392244)[_0x076a('0x1c')](function(_0x10df1c){logger[_0x076a('0x1d')](_0x076a('0x1e'),'EventManager',_0x10df1c);if(_0x10df1c[_0x076a('0x1f')]){if(_0x10df1c[_0x076a('0x1f')][_0x076a('0x20')]===0x1f4){logger[_0x076a('0x1f')](_0x076a('0x1e'),_0x076a('0x1b'),_0x10df1c[_0x076a('0x1f')]);}}})[_0x076a('0x21')](function(_0x28d783){logger[_0x076a('0x1f')](_0x076a('0x1e'),_0x076a('0x1b'),_0x28d783);});}function afterCreateMessage(_0x5718c9){return function(_0x1cef41){_0x1cef41=_0x1cef41[_0x076a('0x22')]({'plain':!![]});_0x1cef41[_0x076a('0x23')]=_0x5718c9;_0x1cef41[_0x076a('0x24')]=_0x5718c9;_0x1cef41[_0x076a('0x25')]=_0x1cef41[_0x076a('0x26')];Promise['resolve']()[_0x076a('0x1c')](function(){if(typeof _0x1cef41[_0x076a('0x27')]===_0x076a('0x28'))return null;var _0xbf77f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1cef41[_0x076a('0x27')];return db[_0x076a('0x29')][_0x076a('0x2a')](_0xbf77f2,{'type':db[_0x076a('0x2b')]['QueryTypes'][_0x076a('0x2c')],'raw':!![]});})['then'](function(_0x13636d){if(_0x13636d){_0x1cef41[_0x076a('0x2d')]=_0x13636d[0x0];}if(typeof _0x1cef41[_0x076a('0x2e')]==='undefined')return;return getAgent(_0x1cef41['UserId']);})[_0x076a('0x1c')](function(_0x21b2ef){if(_0x21b2ef){_0x1cef41['interface']=util[_0x076a('0x2f')](_0x076a('0x30'),_0x21b2ef[_0x076a('0x31')]);_0x1cef41[_0x076a('0x32')]=_0x21b2ef;_0x1cef41[_0x076a('0x23')]=_0x5718c9;return request({'event':_0x076a('0x33'),'message':_0x1cef41});}else{return request({'event':'outgoingmessage','message':_0x1cef41});}})[_0x076a('0x21')](function(_0x42c650){logger['error'](_0x076a('0x1e'),'AfterCreateMessage',_0x42c650);});};}function afterCreateOfflineMessage(_0x55a34d){return function(_0x573233){_0x573233=_0x573233['get']({'plain':!![]});_0x573233['channel']=_0x55a34d;_0x573233['motionChannel']=_0x55a34d;_0x573233['event']=_0x076a('0x34');return request({'event':_0x573233[_0x076a('0x25')],'message':_0x573233});};}function afterCreate(_0x4fb987,_0x9ccfb0){return function(_0x5897c1){_0x5897c1=_0x5897c1[_0x076a('0x22')]({'plain':!![]});_0x5897c1['channel']=_0x4fb987;_0x5897c1['motionChannel']=_0x4fb987;_0x5897c1[_0x076a('0x25')]=_0x076a('0x35');Promise[_0x076a('0x36')]()[_0x076a('0x1c')](function(){var _0x13e042=_0x076a('0x37')+_0x5897c1[_0x076a('0x27')];return db[_0x076a('0x29')][_0x076a('0x2a')](_0x13e042,{'type':db['Sequelize'][_0x076a('0x38')]['SELECT'],'raw':!![]});})[_0x076a('0x1c')](function(_0x2aac91){if(_0x2aac91){_0x5897c1[_0x076a('0x2d')]=_0x2aac91[0x0];}if(typeof _0x5897c1[_0x076a('0x2e')]==='undefined')return;return getAgent(_0x5897c1[_0x076a('0x2e')]);})[_0x076a('0x1c')](function(_0x4b70ab){if(_0x4b70ab){_0x5897c1[_0x076a('0x39')]=util['format'](_0x076a('0x30'),_0x4b70ab[_0x076a('0x31')]);_0x5897c1[_0x076a('0x32')]=_0x4b70ab;}return request({'event':_0x9ccfb0,'message':_0x5897c1});})[_0x076a('0x21')](function(_0x40fd87){logger[_0x076a('0x1f')](_0x076a('0x1e'),_0x076a('0x3a'),_0x40fd87);});};}function afterUpdate(_0x1768e6){return function(_0x5262ed){var _0x313d29=_0x5262ed['changed'](_0x076a('0x3b'))&&_0x5262ed[_0x076a('0x3b')];var _0x4a5378=_0x5262ed[_0x076a('0x3c')](_0x076a('0x3d'));if(_0x313d29||_0x4a5378){var _0x28f093=_0x313d29?'closedinteraction':'substatus';var _0x57b397=_0x5262ed[_0x076a('0x22')]({'plain':!![]});_0x57b397[_0x076a('0x23')]=_0x1768e6;_0x57b397['motionChannel']=_0x1768e6;_0x57b397[_0x076a('0x25')]=_0x313d29?_0x076a('0x3b'):_0x076a('0x3d');var _0x139720='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57b397['ContactId'];return db[_0x076a('0x29')]['query'](_0x139720,{'type':db[_0x076a('0x2b')][_0x076a('0x38')][_0x076a('0x2c')],'raw':!![]})['then'](function(_0x3fb002){if(_0x3fb002){_0x57b397['contact']=_0x3fb002[0x0];}if(typeof _0x57b397[_0x076a('0x2e')]===_0x076a('0x28'))return;return getAgent(_0x57b397['UserId']);})[_0x076a('0x1c')](function(_0x3484cb){if(_0x3484cb){_0x57b397[_0x076a('0x39')]=util[_0x076a('0x2f')](_0x076a('0x30'),_0x3484cb[_0x076a('0x31')]);_0x57b397['agent']=_0x3484cb;}return request({'event':_0x28f093,'message':_0x57b397});})[_0x076a('0x21')](function(_0xadffea){logger[_0x076a('0x1f')]('Trigger,\x20%s',_0x076a('0x3e'),_0xadffea);});}};}function getAgent(_0x6008f0){return db['User'][_0x076a('0x3f')]({'where':{'id':_0x6008f0},'attributes':['id',_0x076a('0x31'),_0x076a('0x40'),_0x076a('0x41'),_0x076a('0x42')],'raw':!![]})[_0x076a('0x1c')](function(_0x34718d){return _0x34718d;});}exports[_0x076a('0x43')]=function(){for(var _0xe316d1=0x0;_0xe316d1=_0x538e04[_0xaeb8('0x14')]){throw Error(_0xaeb8('0x15'));}_0x1d1d21(_0x58d0c6);})['catch'](function(_0x566f39){_0x3bd743(_0x566f39);});});}; \ No newline at end of file +var _0x8bd5=['clearBlockUser','isUndefined','blockedAt','getLicense','agent','User','count','then','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes'];(function(_0x543eb5,_0xe0cdb1){var _0xe53d94=function(_0x253e72){while(--_0x253e72){_0x543eb5['push'](_0x543eb5['shift']());}};_0xe53d94(++_0xe0cdb1);}(_0x8bd5,0xc9));var _0x58bd=function(_0x12497a,_0x15c529){_0x12497a=_0x12497a-0x0;var _0x3a0624=_0x8bd5[_0x12497a];return _0x3a0624;};'use strict';var _=require(_0x58bd('0x0'));var BPromise=require(_0x58bd('0x1'));var db=require(_0x58bd('0x2'))['db'];var util=require(_0x58bd('0x3'));var channels=[_0x58bd('0x4'),_0x58bd('0x5'),_0x58bd('0x6'),_0x58bd('0x7'),_0x58bd('0x8'),_0x58bd('0x9'),_0x58bd('0xa')];exports[_0x58bd('0xb')]=function(){return channels;};exports[_0x58bd('0xc')]=function(_0x90620c){_0x90620c=_0x90620c[_0x58bd('0xd')]();return _[_0x58bd('0xe')](channels,_0x90620c);};exports[_0x58bd('0xf')]=function(_0x5f38e5,_0x33412f,_0x4f1d54,_0x4e3167){var _0x1d97b7={'loginAttempts':_0x33412f,'blocked':_0x4f1d54};if(!_[_0x58bd('0x10')](_0x4e3167)){_0x1d97b7[_0x58bd('0x11')]=_0x4e3167;}return _0x5f38e5['updateAttributes'](_0x1d97b7);};exports[_0x58bd('0x12')]=function(_0x4aa5b9){return new BPromise(function(_0x139b47,_0x3e904){var _0x312041=0x0;if(_0x4aa5b9['role']!==_0x58bd('0x13')){_0x139b47(_0x4aa5b9);}db[_0x58bd('0x14')][_0x58bd('0x15')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4aa5b9['id']}}})[_0x58bd('0x16')](function(_0x4f993e){_0x312041=_0x4f993e;return util['getLicense']();})[_0x58bd('0x16')](function(_0x227f28){if(_0x227f28&&_0x227f28[_0x58bd('0x17')]&&_0x312041>=_0x227f28[_0x58bd('0x17')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x139b47(_0x4aa5b9);})['catch'](function(_0x3bdaf8){_0x3e904(_0x3bdaf8);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 0d48240..47de9e6 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf4eb,0xec));var _0xbf4e=function(_0x235d7e,_0x15b248){_0x235d7e=_0x235d7e-0x0;var _0x6f5aef=_0xf4eb[_0x235d7e];return _0x6f5aef;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb821=['status','exports','../config/logger','api','message','Error','inherits','name','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x3c3a43,_0x1271e2){var _0x10ee49=function(_0x9ba207){while(--_0x9ba207){_0x3c3a43['push'](_0x3c3a43['shift']());}};_0x10ee49(++_0x1271e2);}(_0xb821,0xa7));var _0x1b82=function(_0x14e6e6,_0xa217a9){_0x14e6e6=_0x14e6e6-0x0;var _0x50c0f5=_0xb821[_0x14e6e6];return _0x50c0f5;};'use strict';var util=require('util');var logger=require(_0x1b82('0x0'))(_0x1b82('0x1'));var APIError=function(_0x5924c6,_0x4a4f81){this[_0x1b82('0x2')]=_0x5924c6||'Internal\x20Server\x20Error';this['name']=_0x4a4f81||_0x1b82('0x3');util[_0x1b82('0x4')](APIError,Error);};var APIBadRequestError=function(_0x3fadf0){this[_0x1b82('0x2')]=_0x3fadf0||'Bad\x20Request';this[_0x1b82('0x5')]=_0x1b82('0x6');util[_0x1b82('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3632dd){this[_0x1b82('0x2')]=_0x3632dd||_0x1b82('0x7');this[_0x1b82('0x5')]=_0x1b82('0x8');util[_0x1b82('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x4955b5){switch(_0x4955b5){case _0x1b82('0x6'):return 0x190;case _0x1b82('0x9'),_0x1b82('0xa'):return 0x193;case _0x1b82('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xcffb87){return function(_0x17a96b){logger[_0x1b82('0xb')](_0x17a96b[_0x1b82('0xc')]);var _0x5f521f=getStatusCode(_0x17a96b[_0x1b82('0x5')]);if(_0x17a96b[_0x1b82('0x5')])delete _0x17a96b[_0x1b82('0x5')];return _0xcffb87[_0x1b82('0xd')](_0x5f521f)['send'](_0x17a96b);};}module[_0x1b82('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 91eeb4d..48ac549 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d8c=['404','status','render','json','exports'];(function(_0x192c2f,_0x259d0f){var _0xab1685=function(_0x5d27cb){while(--_0x5d27cb){_0x192c2f['push'](_0x192c2f['shift']());}};_0xab1685(++_0x259d0f);}(_0x9d8c,0x158));var _0xc9d8=function(_0x5d2a76,_0x4e8410){_0x5d2a76=_0x5d2a76-0x0;var _0x2426fd=_0x9d8c[_0x5d2a76];return _0x2426fd;};'use strict';module[_0xc9d8('0x0')][0x194]=function pageNotFound(_0x4cb21c,_0x2be5cb){var _0x2777f1=_0xc9d8('0x1');var _0x3b1369=0x194;var _0x49963f={'status':_0x3b1369};_0x2be5cb[_0xc9d8('0x2')](_0x49963f['status']);_0x2be5cb[_0xc9d8('0x3')](_0x2777f1,{},function(_0x11dc01,_0x68482d){if(_0x11dc01){return _0x2be5cb[_0xc9d8('0x2')](_0x49963f[_0xc9d8('0x2')])[_0xc9d8('0x4')](_0x49963f);}_0x2be5cb['send'](_0x68482d);});}; \ No newline at end of file +var _0xa9bf=['send','exports','404','render','status'];(function(_0x3ac380,_0x2bd8b8){var _0x490314=function(_0x5d7971){while(--_0x5d7971){_0x3ac380['push'](_0x3ac380['shift']());}};_0x490314(++_0x2bd8b8);}(_0xa9bf,0x8d));var _0xfa9b=function(_0x12156e,_0x550b21){_0x12156e=_0x12156e-0x0;var _0x55ada7=_0xa9bf[_0x12156e];return _0x55ada7;};'use strict';module[_0xfa9b('0x0')][0x194]=function pageNotFound(_0x4b0bcf,_0x1fc9e1){var _0x433f4d=_0xfa9b('0x1');var _0x30b5e0=0x194;var _0x46d411={'status':_0x30b5e0};_0x1fc9e1['status'](_0x46d411['status']);_0x1fc9e1[_0xfa9b('0x2')](_0x433f4d,{},function(_0x59e0c0,_0x332cf4){if(_0x59e0c0){return _0x1fc9e1[_0xfa9b('0x3')](_0x46d411[_0xfa9b('0x3')])['json'](_0x46d411);}_0x1fc9e1[_0xfa9b('0x4')](_0x332cf4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5c8c06b..ebbf371 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cf8=['UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsite','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','JscriptySessions','belongsTo','TrunkBackup','IntervalId','Lists','voice_queues_has_cm_lists','Team','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Smtp','Dispositions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','user_has_mail_accounts','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatWebsiteId','TagId','FaxAccountId','Answers','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','chat_group_has_users','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','CampaignId','Condition','All','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Field','VariableId','SugarcrmField','SugarcrmAccount','Description','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','FreshsalesAccount','ChatQueueReport','ChatInternalMessage','ToId','SessionId','ProjectId','user_has_teams','team_has_mail_queues','MailQueues','team_has_chat_queues','ChatQueues','team_has_sms_queues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkId','SquareProjectId','BlackLists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromUserId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','HopperHistory','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','UserSetting','user','Imap','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','mysql','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','utf8mb4','name','database','username','options','password','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','userSetting','cascade','UserId','hasMany','VoiceQueuesRt','VoiceExtension','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','UserProfile','userProfileId','belongsToMany','ChatGroup','CmContact','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','FaxQueue','FaxQueues'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x3cf8,0xca));var _0x83cf=function(_0x4b92e9,_0x2f6330){_0x4b92e9=_0x4b92e9-0x0;var _0x3de0be=_0x3cf8[_0x4b92e9];return _0x3de0be;};'use strict';var config=require(_0x83cf('0x0'));var Sequelize=require(_0x83cf('0x1'));var _=require(_0x83cf('0x2'));var jstz=require(_0x83cf('0x3'));var timezone=jstz['determine']();config[_0x83cf('0x1')]=_[_0x83cf('0x4')](config[_0x83cf('0x1')],{'database':'motion2','username':_0x83cf('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x83cf('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x83cf('0x7'),'collate':_0x83cf('0x8')}}});config[_0x83cf('0x9')]=_['defaultsDeep'](config[_0x83cf('0x9')],{'database':'motion2','username':_0x83cf('0x5'),'password':_0x83cf('0xa'),'options':{'host':_0x83cf('0xb'),'port':0xcea,'dialect':_0x83cf('0x6'),'dialectOptions':{'charset':_0x83cf('0xc')},'logging':![],'timezone':timezone[_0x83cf('0xd')](),'define':{'charset':'utf8','collate':_0x83cf('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x83cf('0x1')][_0x83cf('0xe')],config[_0x83cf('0x1')][_0x83cf('0xf')],config[_0x83cf('0x1')]['password'],config[_0x83cf('0x1')][_0x83cf('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x83cf('0x9')]['database'],config['sequelizeHistory'][_0x83cf('0xf')],config[_0x83cf('0x9')][_0x83cf('0x11')],config['sequelizeHistory'][_0x83cf('0x10')])};db['User']=db[_0x83cf('0x1')]['import'](_0x83cf('0x12'));db[_0x83cf('0x13')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x15'));db['VoiceContext']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x16'));db['VoiceExtension']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x17'));db[_0x83cf('0x18')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x19'));db[_0x83cf('0x1a')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x1b'));db[_0x83cf('0x1c')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x1d'));db[_0x83cf('0x1e')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/screenRecording/screenRecording.model');db[_0x83cf('0x1f')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x20'));db[_0x83cf('0x21')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x22'));db[_0x83cf('0x23')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x24'));db[_0x83cf('0x25')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x26'));db[_0x83cf('0x27')]=db['sequelize']['import'](_0x83cf('0x28'));db['VoiceQueueReport']=db[_0x83cf('0x1')]['import'](_0x83cf('0x29'));db[_0x83cf('0x2a')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x2b'));db[_0x83cf('0x2c')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x2d'));db[_0x83cf('0x2e')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x2f'));db[_0x83cf('0x30')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x83cf('0x31')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x32'));db[_0x83cf('0x33')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x34'));db[_0x83cf('0x35')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x36'));db['UserFaxQueue']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x83cf('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x83cf('0x37')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x38'));db[_0x83cf('0x39')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x83cf('0x3a')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x3b'));db[_0x83cf('0x3c')]=db['sequelize'][_0x83cf('0x14')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x3d'));db[_0x83cf('0x3e')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x3f'));db[_0x83cf('0x40')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x83cf('0x41')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x42'));db[_0x83cf('0x43')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x44'));db[_0x83cf('0x45')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x46'));db[_0x83cf('0x47')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x48'));db['FaxAccount']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/faxAccount/faxAccount.model');db[_0x83cf('0x49')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x4a'));db[_0x83cf('0x4b')]=db['sequelize'][_0x83cf('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x83cf('0x4c')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x4d'));db['FaxQueue']=db[_0x83cf('0x1')]['import'](_0x83cf('0x4e'));db[_0x83cf('0x4f')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x83cf('0x50')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x51'));db[_0x83cf('0x52')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x53'));db[_0x83cf('0x54')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x55'));db[_0x83cf('0x56')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x57'));db[_0x83cf('0x58')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x59'));db[_0x83cf('0x5a')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x5b'));db['OpenchannelApplication']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x83cf('0x5c')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x83cf('0x5d')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x5e'));db[_0x83cf('0x5f')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x60'));db['ChatWebsite']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x61'));db[_0x83cf('0x62')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x83cf('0x1')]['import'](_0x83cf('0x63'));db[_0x83cf('0x64')]=db[_0x83cf('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x83cf('0x65')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x66'));db[_0x83cf('0x67')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x68'));db['ChatGroup']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/chatGroup/chatGroup.model');db[_0x83cf('0x69')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x83cf('0x6a')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x6b'));db['CmContact']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x6c'));db['CmHopper']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x6d'));db[_0x83cf('0x6e')]=db['sequelize']['import'](_0x83cf('0x6f'));db[_0x83cf('0x70')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x71'));db[_0x83cf('0x72')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x73'));db['ReportAgentPreview']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x74'));db[_0x83cf('0x75')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x76'));db[_0x83cf('0x77')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x78'));db[_0x83cf('0x79')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/automation/automation.model');db[_0x83cf('0x7a')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x7b'));db[_0x83cf('0x7c')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x7d'));db['Condition']=db[_0x83cf('0x1')]['import'](_0x83cf('0x7e'));db[_0x83cf('0x7f')]=db['sequelize']['import'](_0x83cf('0x80'));db[_0x83cf('0x81')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x82'));db[_0x83cf('0x83')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x84'));db[_0x83cf('0x85')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x86'));db[_0x83cf('0x87')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x88'));db[_0x83cf('0x89')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x8a'));db[_0x83cf('0x8b')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x8c'));db['ContactItemType']=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x8d'));db[_0x83cf('0x8e')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x8f'));db[_0x83cf('0x90')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x83cf('0x91')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x92'));db['Trigger']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/trigger/trigger.model');db[_0x83cf('0x93')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x94'));db['Integration']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x95'));db[_0x83cf('0x96')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x97'));db[_0x83cf('0x98')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x99'));db[_0x83cf('0x9a')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0x9b'));db['AnalyticExtractedReport']=db[_0x83cf('0x1')]['import'](_0x83cf('0x9c'));db['AnalyticMetric']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x9d'));db[_0x83cf('0x9e')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x9f'));db[_0x83cf('0xa0')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xa1'));db[_0x83cf('0xa2')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xa3'));db[_0x83cf('0xa4')]=db['sequelize']['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x83cf('0xa5')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xa6'));db['SugarcrmAccount']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x83cf('0xa7')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xa8'));db['SugarcrmField']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xa9'));db[_0x83cf('0xaa')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xab'));db[_0x83cf('0xac')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x83cf('0xad')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xae'));db[_0x83cf('0xaf')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xb0'));db[_0x83cf('0xb1')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x83cf('0xb2')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xb3'));db[_0x83cf('0xb4')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x83cf('0xb5')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xb6'));db[_0x83cf('0xb7')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xb8'));db[_0x83cf('0xb9')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xba'));db[_0x83cf('0xbb')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xbc'));db[_0x83cf('0xbd')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x83cf('0xbe')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xbf'));db[_0x83cf('0xc0')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xc1'));db[_0x83cf('0xc2')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xc3'));db[_0x83cf('0xc4')]=db['sequelize'][_0x83cf('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x83cf('0xc5')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xc6'));db[_0x83cf('0xc7')]=db[_0x83cf('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x83cf('0xc8')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xc9'));db[_0x83cf('0xca')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x83cf('0xcb')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xcc'));db['FreshsalesAccount']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xcd'));db['FreshsalesConfiguration']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x83cf('0xce')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xcf'));db[_0x83cf('0xd0')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x95'));db[_0x83cf('0xd1')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/network/network.model');db['ChatQueueReport']=db['sequelize']['import'](_0x83cf('0xd2'));db['ChatInternalMessage']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xd3'));db[_0x83cf('0xd4')]=db['sequelize'][_0x83cf('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x83cf('0xd5')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xd6'));db[_0x83cf('0xd7')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xd8'));db[_0x83cf('0xd9')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0xda'));db[_0x83cf('0xdb')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xdc'));db[_0x83cf('0xdd')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x83cf('0xde')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0xdf'));db[_0x83cf('0xe0')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xe1'));db['SquareOdbc']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xe2'));db[_0x83cf('0xe3')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0xe4'));db['SquareRecording']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0x83cf('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xe5'));db[_0x83cf('0xe6')]=db['sequelize']['import']('../api/license/license.model');db[_0x83cf('0xe7')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0xe8'));db[_0x83cf('0xe9')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xea'));db[_0x83cf('0xeb')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xec'));db[_0x83cf('0xed')]=db[_0x83cf('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xee'));db[_0x83cf('0xef')]=db['sequelize']['import'](_0x83cf('0xf0'));db[_0x83cf('0xf1')]=db[_0x83cf('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize']['import'](_0x83cf('0xf2'));db[_0x83cf('0xf3')]=db['sequelize']['import'](_0x83cf('0xf4'));db[_0x83cf('0xf5')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xf6'));db[_0x83cf('0xf7')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x83cf('0x14')]('../api/userProfile/userProfile.model');db[_0x83cf('0xf8')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xf9'));db['UserProfileResource']=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0xfa'));db[_0x83cf('0xfb')]=db[_0x83cf('0x1')]['import'](_0x83cf('0xfc'));db['WhatsappAccount']=db[_0x83cf('0x1')]['import'](_0x83cf('0xfd'));db[_0x83cf('0xfe')]=db['sequelize'][_0x83cf('0x14')](_0x83cf('0xff'));db['WhatsappInteraction']=db[_0x83cf('0x1')]['import'](_0x83cf('0x100'));db[_0x83cf('0x101')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x102'));db[_0x83cf('0x103')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x104'));db[_0x83cf('0x105')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x106'));db[_0x83cf('0x107')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x83cf('0x108')]=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0x83cf('0x109')]=db[_0x83cf('0x1')]['import'](_0x83cf('0x10a'));db['TeamVoicePrefix']=db[_0x83cf('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x83cf('0x10b')]=db[_0x83cf('0x1')][_0x83cf('0x14')](_0x83cf('0x10c'));db['UserSetting']=db[_0x83cf('0x1')][_0x83cf('0x14')]('../api/user-setting/user-setting.model');db[_0x83cf('0x10d')][_0x83cf('0x10e')](db[_0x83cf('0x1f')],{'as':_0x83cf('0x1f'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x83cf('0x10d')][_0x83cf('0x10e')](db['UserSetting'],{'as':_0x83cf('0x10f'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x1c')],{'as':'Recordings','foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')]['hasMany'](db[_0x83cf('0x30')],{'as':_0x83cf('0x113'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x70')],{'as':_0x83cf('0x115'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x72')],{'as':'HopperHistory','foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x116')],{'as':'ReportAgentPreview','foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db['OpenchannelInteraction'],{'as':_0x83cf('0x117'),'foreignKey':'UserId'});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x118')],{'as':_0x83cf('0x119'),'foreignKey':_0x83cf('0x111')});db['User'][_0x83cf('0x112')](db[_0x83cf('0x54')],{'as':'SmsInteractions','foreignKey':_0x83cf('0x111')});db['User']['hasMany'](db['FaxInteraction'],{'as':_0x83cf('0x11a'),'foreignKey':'UserId'});db['User'][_0x83cf('0x112')](db[_0x83cf('0x40')],{'as':_0x83cf('0x11b'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')][_0x83cf('0x112')](db[_0x83cf('0x11c')],{'as':'WhatsappInteractions','foreignKey':_0x83cf('0x111')});db[_0x83cf('0x10d')]['hasMany'](db[_0x83cf('0xfb')],{'as':_0x83cf('0x11d'),'foreignKey':'SenderId'});db[_0x83cf('0x10d')]['belongsTo'](db[_0x83cf('0x11e')],{'as':_0x83cf('0x11e'),'foreignKey':_0x83cf('0x11f')});db['User'][_0x83cf('0x120')](db[_0x83cf('0x121')],{'as':'Groups','through':'chat_group_has_users'});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x122')],{'as':_0x83cf('0x123'),'through':_0x83cf('0x124')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0xf5')],{'as':'Lists','through':_0x83cf('0x125')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db['Team'],{'through':'user_has_teams'});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x40')],{'as':_0x83cf('0x11b'),'through':_0x83cf('0x126')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x118')],{'as':'ChatInteractions','through':_0x83cf('0x127')});db['User']['belongsToMany'](db[_0x83cf('0x4b')],{'as':_0x83cf('0x11a'),'through':_0x83cf('0x128')});db['User'][_0x83cf('0x120')](db[_0x83cf('0x54')],{'as':_0x83cf('0x129'),'through':_0x83cf('0x12a')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db['OpenchannelInteraction'],{'as':_0x83cf('0x117'),'through':_0x83cf('0x12b')});db['User'][_0x83cf('0x120')](db[_0x83cf('0x11c')],{'as':_0x83cf('0x12c'),'through':_0x83cf('0x12d')});db['User'][_0x83cf('0x120')](db['VoiceQueue'],{'as':_0x83cf('0x12e'),'through':_0x83cf('0x31'),'required':![]});db['User'][_0x83cf('0x120')](db[_0x83cf('0xf7')],{'as':_0x83cf('0x12f'),'through':_0x83cf('0x10b'),'required':![]});db['User']['belongsToMany'](db[_0x83cf('0x130')],{'as':'MailQueues','through':_0x83cf('0x35'),'required':![]});db[_0x83cf('0x10d')][_0x83cf('0x120')](db['ChatQueue'],{'as':'ChatQueues','through':_0x83cf('0x33'),'required':![],'hooks':!![]});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x131')],{'as':_0x83cf('0x132'),'through':_0x83cf('0x133'),'required':![]});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x58')],{'as':_0x83cf('0x134'),'through':'UserSmsQueue','required':![]});db[_0x83cf('0x10d')]['belongsToMany'](db[_0x83cf('0x5f')],{'as':_0x83cf('0x135'),'through':_0x83cf('0x37'),'required':![]});db[_0x83cf('0x10d')]['belongsToMany'](db[_0x83cf('0x107')],{'as':_0x83cf('0x136'),'through':_0x83cf('0x137'),'required':![]});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0xf5')],{'through':_0x83cf('0x125')});db['User'][_0x83cf('0x120')](db[_0x83cf('0x138')],{'as':'ChatWebsites','through':_0x83cf('0x139')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x13a')],{'as':_0x83cf('0x13b'),'through':_0x83cf('0x13c')});db[_0x83cf('0x10d')]['belongsToMany'](db['MailAccount'],{'as':_0x83cf('0x13d'),'through':'user_has_mail_accounts'});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x5a')],{'as':'OpenchannelAccounts','through':_0x83cf('0x13e')});db[_0x83cf('0x10d')][_0x83cf('0x120')](db[_0x83cf('0x50')],{'as':_0x83cf('0x13f'),'through':'user_has_sms_accounts'});db[_0x83cf('0x10d')]['belongsToMany'](db[_0x83cf('0x140')],{'as':_0x83cf('0x141'),'through':_0x83cf('0x142')});db[_0x83cf('0x10d')]['belongsToMany'](db[_0x83cf('0xe3')],{'as':_0x83cf('0x143'),'through':_0x83cf('0x144')});db[_0x83cf('0x13')][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':_0x83cf('0x145'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x146')});db[_0x83cf('0x147')]['hasMany'](db[_0x83cf('0x114')],{'onDelete':_0x83cf('0x110')});db[_0x83cf('0x114')][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':_0x83cf('0x148'),'onDelete':_0x83cf('0x110')});db['VoiceMusicOnHold'][_0x83cf('0x120')](db[_0x83cf('0x89')],{'as':_0x83cf('0x149'),'through':_0x83cf('0x14a')});db[_0x83cf('0x1a')]['hasMany'](db[_0x83cf('0x30')],{'as':_0x83cf('0x14b'),'foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x112')](db[_0x83cf('0x14d')],{'as':_0x83cf('0x14e'),'foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x112')](db[_0x83cf('0x70')],{'as':'HopperFinals','foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x112')](db[_0x83cf('0x72')],{'as':_0x83cf('0x14f'),'foreignKey':'VoiceQueueId'});db[_0x83cf('0x1a')][_0x83cf('0x112')](db['ReportAgentPreview'],{'as':_0x83cf('0x116'),'foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x112')](db[_0x83cf('0x6e')],{'as':'HopperBlacks','foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x112')](db['JscriptySessionReport'],{'as':_0x83cf('0x150'),'foreignKey':_0x83cf('0x14c')});db[_0x83cf('0x1a')][_0x83cf('0x151')](db[_0x83cf('0x2c')],{'as':_0x83cf('0x2c'),'foreignKey':'TrunkId'});db[_0x83cf('0x1a')]['belongsTo'](db[_0x83cf('0x2c')],{'as':_0x83cf('0x152'),'foreignKey':'TrunkBackupId'});db[_0x83cf('0x1a')][_0x83cf('0x151')](db[_0x83cf('0x7f')],{'as':_0x83cf('0x7f'),'foreignKey':_0x83cf('0x153')});db[_0x83cf('0x1a')][_0x83cf('0x151')](db[_0x83cf('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x83cf('0x120')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x154'),'through':_0x83cf('0x155')});db[_0x83cf('0x1a')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':'Agents','through':_0x83cf('0x31')});db[_0x83cf('0x1a')][_0x83cf('0x120')](db[_0x83cf('0x156')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0x83cf('0x120')](db['CmList'],{'as':'BlackLists','through':_0x83cf('0x157')});db[_0x83cf('0x1c')]['belongsTo'](db['User'],{'as':_0x83cf('0x10d'),'foreignKey':'UserId'});db['ScreenRecording'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x10d'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x1f')][_0x83cf('0x112')](db[_0x83cf('0x21')],{'as':_0x83cf('0x158'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x159'),'sourceKey':_0x83cf('0x15a')});db[_0x83cf('0x21')][_0x83cf('0x151')](db['VoiceMail'],{'foreignKey':_0x83cf('0x159'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x83cf('0x112')](db[_0x83cf('0x15b')],{'as':_0x83cf('0x15c'),'foreignKey':_0x83cf('0x15d'),'constraints':![]});db[_0x83cf('0x23')][_0x83cf('0x112')](db[_0x83cf('0x27')],{'as':'AgentReports','foreignKey':_0x83cf('0x15d'),'constraints':![]});db['VoiceCallReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x10d'),'foreignKey':'UserId'});db[_0x83cf('0x23')]['belongsTo'](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x39')][_0x83cf('0x151')](db['MailAccount'],{'as':_0x83cf('0x3c'),'foreignKey':'MailAccountId'});db[_0x83cf('0x39')][_0x83cf('0x151')](db[_0x83cf('0x108')],{'as':'CloudProvider','foreignKey':_0x83cf('0x160'),'onDelete':_0x83cf('0x161')});db[_0x83cf('0x3a')]['belongsTo'](db[_0x83cf('0x3c')],{'as':'MailAccount','foreignKey':_0x83cf('0x162')});db[_0x83cf('0x3a')][_0x83cf('0x151')](db[_0x83cf('0x108')],{'as':'CloudProvider','foreignKey':_0x83cf('0x160'),'onDelete':'restrict'});db[_0x83cf('0x3c')]['hasOne'](db[_0x83cf('0x39')],{'as':'Imap','onDelete':_0x83cf('0x110')});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':_0x83cf('0x163'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x3c')]['hasMany'](db[_0x83cf('0x7c')],{'as':_0x83cf('0x164'),'foreignKey':'MailAccountId','onDelete':_0x83cf('0x110')});db[_0x83cf('0x3c')][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':'Answers','foreignKey':_0x83cf('0x162')});db[_0x83cf('0x3c')][_0x83cf('0x112')](db['MailMessage'],{'as':'Messages','foreignKey':_0x83cf('0x162')});db[_0x83cf('0x3c')][_0x83cf('0x112')](db[_0x83cf('0x40')],{'as':'Interactions'});db[_0x83cf('0x3c')][_0x83cf('0x112')](db[_0x83cf('0x43')],{'as':_0x83cf('0x148')});db[_0x83cf('0x3c')][_0x83cf('0x151')](db['CmList'],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0x3c')][_0x83cf('0x151')](db[_0x83cf('0x91')],{'as':_0x83cf('0x91'),'foreignKey':_0x83cf('0x167')});db[_0x83cf('0x3c')][_0x83cf('0x151')](db[_0x83cf('0x81')],{'as':_0x83cf('0x168'),'foreignKey':_0x83cf('0x169')});db['MailAccount'][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x16b')});db[_0x83cf('0x130')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x83cf('0x35')});db[_0x83cf('0x130')][_0x83cf('0x120')](db[_0x83cf('0x156')],{'through':'team_has_mail_queues','as':_0x83cf('0x16c')});db[_0x83cf('0x40')][_0x83cf('0x112')](db[_0x83cf('0x41')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x83cf('0x16d')});db['MailInteraction'][_0x83cf('0x151')](db[_0x83cf('0x3c')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x162')});db[_0x83cf('0x40')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':'ContactId'});db[_0x83cf('0x40')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16f'),'foreignKey':_0x83cf('0x111')});db['MailInteraction'][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x170'),'as':_0x83cf('0x171')});db['MailInteraction'][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x170'),'as':_0x83cf('0x172')});db['MailInteraction'][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'through':_0x83cf('0x126'),'foreignKey':_0x83cf('0x16d')});db[_0x83cf('0x41')][_0x83cf('0x112')](db[_0x83cf('0xeb')],{'as':_0x83cf('0x174'),'onDelete':'cascade'});db[_0x83cf('0x41')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':'User'});db[_0x83cf('0x41')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'onDelete':_0x83cf('0x110'),'as':'Contact'});db[_0x83cf('0x41')][_0x83cf('0x151')](db[_0x83cf('0x40')],{'as':'Interaction','foreignKey':_0x83cf('0x16d')});db[_0x83cf('0x41')][_0x83cf('0x151')](db['MailAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x162')});db['MailMessage'][_0x83cf('0x151')](db[_0x83cf('0x138')],{'as':_0x83cf('0x138'),'foreignKey':_0x83cf('0x175')});db[_0x83cf('0x41')][_0x83cf('0x151')](db[_0x83cf('0x65')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x83cf('0x43')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'onDelete':_0x83cf('0x161')});db['MailApplication'][_0x83cf('0x151')](db[_0x83cf('0x130')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x43')][_0x83cf('0x151')](db[_0x83cf('0x3c')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x43')][_0x83cf('0x151')](db['Interval'],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x153')});db['MailApplication'][_0x83cf('0x151')](db[_0x83cf('0x8b')],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x176')});db['MailQueueReport'][_0x83cf('0x151')](db['MailAccount'],{});db[_0x83cf('0x45')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0x45')][_0x83cf('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x45')][_0x83cf('0x151')](db[_0x83cf('0x40')],{});db[_0x83cf('0x45')][_0x83cf('0x151')](db[_0x83cf('0x41')],{});db['MailQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{});db['MailQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x130')],{});db[_0x83cf('0x47')][_0x83cf('0x112')](db['DashboardItem'],{'as':'Items','onDelete':_0x83cf('0x110')});db[_0x83cf('0x13a')][_0x83cf('0x112')](db[_0x83cf('0x7c')],{'as':_0x83cf('0x164'),'foreignKey':_0x83cf('0x177'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x13a')][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':_0x83cf('0x178'),'foreignKey':'FaxAccountId'});db[_0x83cf('0x13a')][_0x83cf('0x112')](db[_0x83cf('0x4b')],{'as':_0x83cf('0x179')});db[_0x83cf('0x13a')][_0x83cf('0x112')](db[_0x83cf('0x49')],{'as':'Applications'});db['FaxAccount'][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':_0x83cf('0x17a'),'onDelete':_0x83cf('0x110')});db['FaxAccount'][_0x83cf('0x112')](db[_0x83cf('0x4c')],{'as':_0x83cf('0x158')});db[_0x83cf('0x13a')]['belongsTo'](db['Trunk'],{'as':'Trunk'});db[_0x83cf('0x13a')]['belongsTo'](db[_0x83cf('0xf5')],{'as':'List','foreignKey':_0x83cf('0x166')});db[_0x83cf('0x13a')]['belongsTo'](db[_0x83cf('0x81')],{'as':_0x83cf('0x168'),'foreignKey':_0x83cf('0x169')});db[_0x83cf('0x13a')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x49')][_0x83cf('0x151')](db[_0x83cf('0x131')],{'onDelete':_0x83cf('0x161')});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x49')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x83cf('0x176')});db['FaxInteraction'][_0x83cf('0x112')](db['FaxMessage'],{'as':_0x83cf('0x158'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x17b')});db[_0x83cf('0x4b')]['belongsTo'](db['FaxAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x177')});db['FaxInteraction'][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x4b')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x83cf('0x111')});db[_0x83cf('0x4b')][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x17c'),'as':_0x83cf('0x171')});db['FaxInteraction'][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x17c'),'as':_0x83cf('0x172')});db[_0x83cf('0x4b')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':'Users','through':_0x83cf('0x128'),'foreignKey':_0x83cf('0x17b')});db[_0x83cf('0x4c')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'onDelete':_0x83cf('0x110'),'as':'User'});db[_0x83cf('0x4c')]['belongsTo'](db[_0x83cf('0x4b')],{'as':_0x83cf('0x17d'),'foreignKey':_0x83cf('0x17b')});db[_0x83cf('0x4c')]['belongsTo'](db[_0x83cf('0x122')],{'onDelete':'cascade','as':_0x83cf('0x15e')});db[_0x83cf('0x4c')]['belongsTo'](db[_0x83cf('0xeb')],{'as':_0x83cf('0xeb'),'foreignKey':_0x83cf('0x17e')});db[_0x83cf('0x4c')][_0x83cf('0x151')](db[_0x83cf('0x13a')],{'as':'Account','foreignKey':_0x83cf('0x177')});db[_0x83cf('0x131')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x133')});db[_0x83cf('0x131')]['belongsToMany'](db['Team'],{'through':_0x83cf('0x17f'),'as':_0x83cf('0x16c')});db[_0x83cf('0x4f')][_0x83cf('0x151')](db[_0x83cf('0x13a')],{});db[_0x83cf('0x4f')]['belongsTo'](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db['FaxQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x4b')],{});db[_0x83cf('0x4f')][_0x83cf('0x151')](db[_0x83cf('0x4c')],{});db[_0x83cf('0x4f')][_0x83cf('0x151')](db['User'],{});db[_0x83cf('0x4f')][_0x83cf('0x151')](db[_0x83cf('0x131')],{});db[_0x83cf('0x50')][_0x83cf('0x112')](db['Disposition'],{'as':_0x83cf('0x164'),'foreignKey':_0x83cf('0x180'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x50')][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':'Answers','foreignKey':_0x83cf('0x180')});db[_0x83cf('0x50')][_0x83cf('0x112')](db[_0x83cf('0x56')],{'as':_0x83cf('0x158'),'foreignKey':_0x83cf('0x180')});db['SmsAccount'][_0x83cf('0x112')](db[_0x83cf('0x54')],{'as':'Interactions'});db[_0x83cf('0x50')][_0x83cf('0x112')](db[_0x83cf('0x52')],{'as':'Applications'});db[_0x83cf('0x50')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0x50')][_0x83cf('0x151')](db[_0x83cf('0x81')],{'as':_0x83cf('0x168'),'foreignKey':_0x83cf('0x169')});db[_0x83cf('0x50')][_0x83cf('0x120')](db['User'],{'as':'Agents','through':_0x83cf('0x181')});db[_0x83cf('0x52')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x52')][_0x83cf('0x151')](db[_0x83cf('0x58')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x52')]['belongsTo'](db[_0x83cf('0x50')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x52')][_0x83cf('0x151')](db[_0x83cf('0x7f')],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x153')});db[_0x83cf('0x52')][_0x83cf('0x151')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x83cf('0x112')](db[_0x83cf('0x56')],{'as':_0x83cf('0x158'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x182')});db[_0x83cf('0x54')][_0x83cf('0x151')](db[_0x83cf('0x50')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x180')});db[_0x83cf('0x54')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x54')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16f'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x54')]['belongsToMany'](db[_0x83cf('0x8b')],{'through':_0x83cf('0x183'),'as':_0x83cf('0x171')});db['SmsInteraction']['belongsToMany'](db[_0x83cf('0x8b')],{'through':_0x83cf('0x183'),'as':'ThroughTags'});db[_0x83cf('0x54')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'through':_0x83cf('0x12a'),'foreignKey':_0x83cf('0x182')});db[_0x83cf('0x56')]['belongsTo'](db[_0x83cf('0x10d')],{'as':_0x83cf('0x10d')});db[_0x83cf('0x56')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'onDelete':'cascade','as':'Contact'});db[_0x83cf('0x56')][_0x83cf('0x151')](db[_0x83cf('0x54')],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x17d'),'foreignKey':_0x83cf('0x182')});db[_0x83cf('0x56')][_0x83cf('0x151')](db[_0x83cf('0x50')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x180')});db[_0x83cf('0x58')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x184'),'foreignKey':_0x83cf('0x185')});db[_0x83cf('0x58')][_0x83cf('0x120')](db[_0x83cf('0x156')],{'through':'team_has_sms_queues','as':_0x83cf('0x16c')});db[_0x83cf('0x5a')][_0x83cf('0x112')](db[_0x83cf('0x7c')],{'as':_0x83cf('0x164'),'foreignKey':'OpenchannelAccountId','onDelete':_0x83cf('0x110')});db['OpenchannelAccount'][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':_0x83cf('0x178'),'foreignKey':_0x83cf('0x186')});db[_0x83cf('0x5a')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x83cf('0x179'),'foreignKey':_0x83cf('0x186')});db[_0x83cf('0x5a')][_0x83cf('0x112')](db[_0x83cf('0x5d')],{'as':'Messages','foreignKey':_0x83cf('0x186')});db[_0x83cf('0x5a')][_0x83cf('0x112')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x83cf('0x186')});db['OpenchannelAccount'][_0x83cf('0x151')](db['CmList'],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0x5a')][_0x83cf('0x151')](db[_0x83cf('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x83cf('0x169')});db[_0x83cf('0x5a')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x13e')});db['OpenchannelApplication'][_0x83cf('0x151')](db['User'],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0x187')][_0x83cf('0x151')](db['OpenchannelQueue'],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x188')});db['OpenchannelApplication'][_0x83cf('0x151')](db[_0x83cf('0x5a')],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x186')});db[_0x83cf('0x187')][_0x83cf('0x151')](db[_0x83cf('0x7f')],{'onDelete':_0x83cf('0x161'),'foreignKey':'IntervalId'});db[_0x83cf('0x187')][_0x83cf('0x151')](db[_0x83cf('0x8b')],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x176')});db['OpenchannelInteraction']['hasMany'](db[_0x83cf('0x5d')],{'as':_0x83cf('0x158'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x189')});db[_0x83cf('0x5c')][_0x83cf('0x151')](db['OpenchannelAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x186')});db[_0x83cf('0x5c')]['belongsTo'](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x5c')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16f'),'foreignKey':_0x83cf('0x111')});db[_0x83cf('0x5c')][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x18a'),'as':'Tags'});db[_0x83cf('0x5c')][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':'openchannel_interaction_has_tags','as':_0x83cf('0x172')});db[_0x83cf('0x5c')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'through':_0x83cf('0x12b'),'foreignKey':_0x83cf('0x189')});db['OpenchannelMessage']['belongsTo'](db[_0x83cf('0x10d')],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x10d')});db[_0x83cf('0x5d')]['belongsTo'](db[_0x83cf('0x122')],{'onDelete':_0x83cf('0x110'),'as':'Contact'});db[_0x83cf('0x5d')][_0x83cf('0x151')](db['OpenchannelInteraction'],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x17d'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x83cf('0xeb')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x83cf('0x5d')]['belongsTo'](db[_0x83cf('0x5a')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x186')});db[_0x83cf('0x5f')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':'UserOpenchannelQueue','foreignKey':_0x83cf('0x188')});db[_0x83cf('0x5f')][_0x83cf('0x120')](db[_0x83cf('0x156')],{'through':_0x83cf('0x18b'),'as':_0x83cf('0x16c')});db[_0x83cf('0x138')][_0x83cf('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x83cf('0x175'),'onDelete':'cascade'});db['ChatWebsite'][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':_0x83cf('0x178'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x83cf('0x112')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x83cf('0x138')][_0x83cf('0x112')](db[_0x83cf('0x118')],{'as':_0x83cf('0x179')});db[_0x83cf('0x138')][_0x83cf('0x112')](db[_0x83cf('0x62')],{'as':_0x83cf('0x148')});db[_0x83cf('0x138')][_0x83cf('0x112')](db['ChatMessage'],{'as':_0x83cf('0x158')});db[_0x83cf('0x138')]['belongsTo'](db[_0x83cf('0xf5')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0x83cf('0x151')](db[_0x83cf('0x7f')],{'as':_0x83cf('0x7f'),'foreignKey':_0x83cf('0x153')});db[_0x83cf('0x138')][_0x83cf('0x151')](db[_0x83cf('0x3c')],{'as':_0x83cf('0x3c'),'foreignKey':_0x83cf('0x162')});db[_0x83cf('0x138')]['belongsTo'](db['Pause'],{'as':_0x83cf('0x168'),'foreignKey':_0x83cf('0x169')});db[_0x83cf('0x138')][_0x83cf('0x120')](db['User'],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x139')});db[_0x83cf('0x18c')][_0x83cf('0x151')](db[_0x83cf('0x5a')],{});db[_0x83cf('0x18c')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x18c')]['belongsTo'](db[_0x83cf('0x5c')],{});db[_0x83cf('0x18c')]['belongsTo'](db[_0x83cf('0x5d')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x83cf('0x10d')],{});db[_0x83cf('0x18c')]['belongsTo'](db[_0x83cf('0x5f')],{});db[_0x83cf('0x62')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x18d'),'foreignKey':_0x83cf('0x111'),'onDelete':_0x83cf('0x161')});db['ChatApplication'][_0x83cf('0x151')](db[_0x83cf('0x67')],{'as':_0x83cf('0x18e'),'foreignKey':_0x83cf('0x18f'),'onDelete':_0x83cf('0x161')});db[_0x83cf('0x62')]['belongsTo'](db[_0x83cf('0x138')],{'as':_0x83cf('0x190'),'foreignKey':_0x83cf('0x175'),'onDelete':'restrict'});db[_0x83cf('0x62')][_0x83cf('0x151')](db['Tag'],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x176')});db[_0x83cf('0x118')][_0x83cf('0x112')](db[_0x83cf('0x64')],{'as':'Messages','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x191')});db[_0x83cf('0x118')]['belongsTo'](db['ChatWebsite'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x175')});db[_0x83cf('0x118')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':'ContactId'});db[_0x83cf('0x118')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16f'),'foreignKey':_0x83cf('0x111')});db['ChatInteraction']['belongsToMany'](db[_0x83cf('0x8b')],{'through':_0x83cf('0x192'),'as':_0x83cf('0x171')});db['ChatInteraction'][_0x83cf('0x120')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x83cf('0x172')});db['ChatInteraction'][_0x83cf('0x120')](db['User'],{'as':'Users','through':_0x83cf('0x127'),'foreignKey':_0x83cf('0x191')});db['ChatMessage'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'onDelete':'cascade','as':'User'});db[_0x83cf('0x64')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x64')][_0x83cf('0x151')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x83cf('0x17d'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x83cf('0x151')](db[_0x83cf('0xeb')],{'as':'Attachment','foreignKey':_0x83cf('0x17e')});db['ChatMessage'][_0x83cf('0x151')](db[_0x83cf('0x138')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x175')});db['ChatOfflineMessage'][_0x83cf('0x112')](db[_0x83cf('0xeb')],{'as':_0x83cf('0x174'),'foreignKey':_0x83cf('0x193'),'onDelete':_0x83cf('0x110'),'hooks':!![]});db[_0x83cf('0x65')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x65')][_0x83cf('0x151')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x83cf('0x175')});db[_0x83cf('0x67')]['belongsToMany'](db[_0x83cf('0x10d')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x83cf('0x120')](db[_0x83cf('0x156')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x83cf('0x121')][_0x83cf('0x112')](db['ChatInternalMessage'],{'as':_0x83cf('0x158'),'foreignKey':_0x83cf('0x194'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x121')]['belongsToMany'](db[_0x83cf('0x10d')],{'as':_0x83cf('0x14b'),'through':_0x83cf('0x195')});db['ChatProactiveAction'][_0x83cf('0x151')](db[_0x83cf('0x138')],{'as':_0x83cf('0x190'),'foreignKey':_0x83cf('0x175')});db[_0x83cf('0x6a')][_0x83cf('0x112')](db[_0x83cf('0x122')],{'as':'Contacts','foreignKey':_0x83cf('0x196')});db[_0x83cf('0x122')][_0x83cf('0x112')](db['CmContactHasItem'],{'as':_0x83cf('0x197'),'foreignKey':_0x83cf('0x198')});db[_0x83cf('0x122')][_0x83cf('0x112')](db[_0x83cf('0x14d')],{'as':_0x83cf('0x14e'),'foreignKey':'ContactId'});db[_0x83cf('0x122')][_0x83cf('0x112')](db[_0x83cf('0x70')],{'as':_0x83cf('0x115'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x122')][_0x83cf('0x112')](db[_0x83cf('0x72')],{'as':_0x83cf('0x14f'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x122')][_0x83cf('0x112')](db[_0x83cf('0x116')],{'as':_0x83cf('0x116'),'foreignKey':'ContactId'});db['CmContact'][_0x83cf('0x112')](db[_0x83cf('0xd7')],{'as':_0x83cf('0x150'),'foreignKey':'ContactId'});db[_0x83cf('0x122')][_0x83cf('0x112')](db[_0x83cf('0x5c')],{'as':_0x83cf('0x117'),'foreignKey':_0x83cf('0x15f'),'onDelete':'restrict'});db[_0x83cf('0x122')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x83cf('0x15f'),'onDelete':_0x83cf('0x161')});db['CmContact'][_0x83cf('0x112')](db[_0x83cf('0x54')],{'as':_0x83cf('0x129'),'foreignKey':_0x83cf('0x15f'),'onDelete':'restrict'});db[_0x83cf('0x122')][_0x83cf('0x112')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x83cf('0x15f'),'onDelete':'restrict'});db[_0x83cf('0x122')][_0x83cf('0x112')](db['MailInteraction'],{'as':_0x83cf('0x11b'),'foreignKey':_0x83cf('0x15f'),'onDelete':_0x83cf('0x161')});db['CmContact'][_0x83cf('0x151')](db['CmCompany'],{'as':_0x83cf('0x199'),'foreignKey':_0x83cf('0x196')});db[_0x83cf('0x122')]['belongsTo'](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x122')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'through':_0x83cf('0x124')});db['CmContact'][_0x83cf('0x120')](db['Tag'],{'as':_0x83cf('0x171'),'through':_0x83cf('0x19a')});db[_0x83cf('0x122')][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x83cf('0x14d')][_0x83cf('0x112')](db[_0x83cf('0x90')],{'as':_0x83cf('0x19b'),'foreignKey':_0x83cf('0x19c')});db[_0x83cf('0x14d')][_0x83cf('0x151')](db['CmContact'],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x14d')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x14d')][_0x83cf('0x151')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x83cf('0x14d')][_0x83cf('0x151')](db[_0x83cf('0x1a')],{'as':_0x83cf('0x18e'),'foreignKey':_0x83cf('0x14c'),'onDelete':'cascade'});db[_0x83cf('0x14d')]['belongsTo'](db[_0x83cf('0xe7')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x83cf('0x14d')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16f'),'foreignKey':_0x83cf('0x19d')});db[_0x83cf('0x6e')]['belongsTo'](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x6e')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x83cf('0x110')});db[_0x83cf('0x6e')]['belongsTo'](db[_0x83cf('0x1a')],{'as':_0x83cf('0x18e'),'foreignKey':_0x83cf('0x14c'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x6e')][_0x83cf('0x151')](db[_0x83cf('0xe7')],{'as':_0x83cf('0xe7'),'foreignKey':_0x83cf('0x19e'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x83cf('0x19f')],{'as':{'plural':_0x83cf('0x1a0'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x83cf('0x110'),'hooks':!![]});db[_0x83cf('0x79')][_0x83cf('0x112')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x83cf('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x83cf('0x79')][_0x83cf('0x112')](db[_0x83cf('0x77')],{'as':_0x83cf('0x1a2'),'foreignKey':_0x83cf('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x83cf('0x7c')][_0x83cf('0x112')](db['Disposition'],{'as':_0x83cf('0x164'),'foreignKey':_0x83cf('0x1a4'),'onDelete':_0x83cf('0x110')});db['Interval']['hasMany'](db[_0x83cf('0x7f')],{'as':_0x83cf('0x1a5'),'foreignKey':_0x83cf('0x153'),'onDelete':_0x83cf('0x110'),'hooks':!![],'required':![]});db[_0x83cf('0x7f')][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':_0x83cf('0x1a6'),'foreignKey':_0x83cf('0x153'),'onDelete':_0x83cf('0x161')});db[_0x83cf('0x7f')]['hasMany'](db['MailApplication'],{'as':_0x83cf('0x1a7'),'foreignKey':_0x83cf('0x153')});db[_0x83cf('0x7f')][_0x83cf('0x112')](db[_0x83cf('0x62')],{'as':_0x83cf('0x1a8'),'foreignKey':'IntervalId'});db[_0x83cf('0x7f')]['hasMany'](db[_0x83cf('0x49')],{'as':_0x83cf('0x1a9'),'foreignKey':_0x83cf('0x153')});db['Interval'][_0x83cf('0x112')](db[_0x83cf('0x52')],{'as':'SmsApplications','foreignKey':_0x83cf('0x153')});db[_0x83cf('0x87')]['belongsTo'](db[_0x83cf('0x3c')],{});db['Schedule'][_0x83cf('0x151')](db[_0x83cf('0x9a')],{'foreignKey':_0x83cf('0x1aa')});db[_0x83cf('0x87')][_0x83cf('0x151')](db[_0x83cf('0x98')],{'foreignKey':_0x83cf('0x1ab')});db[_0x83cf('0x89')][_0x83cf('0x120')](db[_0x83cf('0x18')],{'as':'Mohs','through':_0x83cf('0x14a'),'onDelete':_0x83cf('0x161')});db['Tag'][_0x83cf('0x120')](db['CmContact'],{'through':'cm_contact_has_tags'});db['Tag'][_0x83cf('0x120')](db[_0x83cf('0x118')],{'through':_0x83cf('0x192')});db[_0x83cf('0x8b')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x83cf('0x8b')][_0x83cf('0x120')](db[_0x83cf('0x54')],{'through':_0x83cf('0x183')});db[_0x83cf('0x8b')][_0x83cf('0x120')](db[_0x83cf('0x4b')],{'through':_0x83cf('0x17c')});db[_0x83cf('0x8b')][_0x83cf('0x120')](db[_0x83cf('0x5c')],{'through':_0x83cf('0x18a')});db['Tag']['belongsToMany'](db[_0x83cf('0x11c')],{'through':_0x83cf('0x1ac')});db[_0x83cf('0x8e')][_0x83cf('0x151')](db[_0x83cf('0x1ad')],{'as':_0x83cf('0x1ae'),'foreignKey':_0x83cf('0x1af')});db[_0x83cf('0x90')][_0x83cf('0x151')](db['CmHopper'],{'as':_0x83cf('0x1b0'),'foreignKey':_0x83cf('0x19c')});db[_0x83cf('0x8e')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':'Contact','foreignKey':_0x83cf('0x198')});db[_0x83cf('0x1b1')][_0x83cf('0x112')](db['Condition'],{'as':{'plural':_0x83cf('0x1b2'),'singular':_0x83cf('0x1b3')},'foreignKey':_0x83cf('0x1b4'),'onDelete':_0x83cf('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x83cf('0x19f')],{'as':{'plural':'AnyConditions','singular':_0x83cf('0x1b5')},'foreignKey':_0x83cf('0x1b6'),'onDelete':_0x83cf('0x110'),'hooks':!![]});db[_0x83cf('0x1b1')][_0x83cf('0x112')](db['Action'],{'as':_0x83cf('0x1a2'),'foreignKey':_0x83cf('0x1b7'),'onDelete':_0x83cf('0x110'),'hooks':!![]});db[_0x83cf('0x98')][_0x83cf('0x112')](db[_0x83cf('0x9e')],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1ab'),'hooks':!![]});db[_0x83cf('0x9a')][_0x83cf('0x112')](db[_0x83cf('0x9e')],{'as':'Fields','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1aa')});db[_0x83cf('0x1b9')]['hasMany'](db[_0x83cf('0x9e')],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x83cf('0x151')](db[_0x83cf('0x1b9')],{'foreignKey':_0x83cf('0x1ba')});db[_0x83cf('0xa2')][_0x83cf('0x112')](db['SalesforceConfiguration'],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db['SalesforceConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xa5')],{'as':_0x83cf('0x1bd'),'onDelete':_0x83cf('0x110'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xa5')],{'as':_0x83cf('0x1be'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xa4')][_0x83cf('0x112')](db[_0x83cf('0xa5')],{'as':'Fields','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xa4')][_0x83cf('0x151')](db[_0x83cf('0xa2')],{'as':'Account','foreignKey':'AccountId'});db['SalesforceField'][_0x83cf('0x112')](db[_0x83cf('0xa5')],{'as':_0x83cf('0x1c1'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xa5')]['hasMany'](db[_0x83cf('0xa5')],{'as':'Description','foreignKey':_0x83cf('0x1bf')});db['SalesforceField']['hasMany'](db[_0x83cf('0xa5')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xa5')][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db['SugarcrmAccount'][_0x83cf('0x112')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db['SugarcrmConfiguration']['hasMany'](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1bd'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xa7')]['hasMany'](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1be'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xa7')][_0x83cf('0x112')](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':'FieldId'});db[_0x83cf('0xa7')][_0x83cf('0x151')](db[_0x83cf('0x1c6')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1bc')});db['SugarcrmField'][_0x83cf('0x112')](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1c1'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0x1c5')][_0x83cf('0x112')](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1c7'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0x1c5')][_0x83cf('0x112')](db[_0x83cf('0x1c5')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0x1c5')][_0x83cf('0x151')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0x83cf('0x112')](db['DeskConfiguration'],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xac')][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1bd'),'onDelete':_0x83cf('0x110'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1be'),'onDelete':'cascade','foreignKey':_0x83cf('0x1bf')});db['DeskConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xac')][_0x83cf('0x151')](db['DeskAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1bc')});db['DeskConfiguration'][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1c1'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xad')][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1c7'),'foreignKey':'DescriptionId'});db[_0x83cf('0xad')][_0x83cf('0x112')](db[_0x83cf('0xad')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xad')][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db[_0x83cf('0xaf')]['hasMany'](db[_0x83cf('0xb1')],{'as':'Configurations','onDelete':_0x83cf('0x110'),'foreignKey':'AccountId'});db[_0x83cf('0xb1')][_0x83cf('0x112')](db[_0x83cf('0xb2')],{'as':_0x83cf('0x1bd'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xb1')][_0x83cf('0x112')](db[_0x83cf('0xb2')],{'as':_0x83cf('0x1be'),'onDelete':_0x83cf('0x110'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xb2')],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c0')});db['ZohoConfiguration'][_0x83cf('0x151')](db[_0x83cf('0xaf')],{'as':'Account','foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xb2')][_0x83cf('0x112')](db[_0x83cf('0xb2')],{'as':_0x83cf('0x1c1'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xb2')][_0x83cf('0x112')](db['ZohoField'],{'as':'Description','foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xb2')]['hasMany'](db[_0x83cf('0xb2')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xb2')][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0x83cf('0xb4')][_0x83cf('0x112')](db[_0x83cf('0xb5')],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xb5')]['hasMany'](db[_0x83cf('0xb7')],{'as':'Subjects','foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xb5')][_0x83cf('0x112')](db[_0x83cf('0xb7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x83cf('0xb5')][_0x83cf('0x112')](db[_0x83cf('0xb7')],{'as':_0x83cf('0x1b8'),'foreignKey':_0x83cf('0x1c0')});db['ZendeskConfiguration'][_0x83cf('0x151')](db['ZendeskAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xb5')]['belongsToMany'](db[_0x83cf('0x8b')],{'through':_0x83cf('0x1c8')});db['ZendeskField'][_0x83cf('0x112')](db[_0x83cf('0xb7')],{'as':_0x83cf('0x1c1'),'foreignKey':'SubjectId'});db[_0x83cf('0xb7')]['hasMany'](db[_0x83cf('0xb7')],{'as':'Description','foreignKey':_0x83cf('0x1bf')});db['ZendeskField']['hasMany'](db[_0x83cf('0xb7')],{'as':'Field','foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xb7')]['belongsTo'](db['Variable'],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db[_0x83cf('0xb9')][_0x83cf('0x112')](db[_0x83cf('0xbb')],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':'AccountId'});db[_0x83cf('0xbb')]['hasMany'](db[_0x83cf('0xbd')],{'as':_0x83cf('0x1bd'),'onDelete':'cascade','foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xbb')][_0x83cf('0x112')](db['FreshdeskField'],{'as':_0x83cf('0x1be'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x83cf('0x112')](db['FreshdeskField'],{'as':_0x83cf('0x1b8'),'onDelete':_0x83cf('0x110'),'foreignKey':'FieldId'});db[_0x83cf('0xbb')][_0x83cf('0x151')](db[_0x83cf('0xb9')],{'as':_0x83cf('0x16e'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x1c9')});db[_0x83cf('0xbd')]['hasMany'](db[_0x83cf('0xbd')],{'as':_0x83cf('0x1c1'),'foreignKey':_0x83cf('0x1c2')});db['FreshdeskField'][_0x83cf('0x112')](db['FreshdeskField'],{'as':_0x83cf('0x1c7'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xbd')]['hasMany'](db[_0x83cf('0xbd')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xbd')]['belongsTo'](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db['VtigerAccount'][_0x83cf('0x112')](db[_0x83cf('0xc0')],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xc0')][_0x83cf('0x112')](db[_0x83cf('0xc2')],{'as':_0x83cf('0x1bd'),'foreignKey':'SubjectId'});db[_0x83cf('0xc0')][_0x83cf('0x112')](db[_0x83cf('0xc2')],{'as':'Descriptions','foreignKey':_0x83cf('0x1bf')});db['VtigerConfiguration']['hasMany'](db[_0x83cf('0xc2')],{'as':_0x83cf('0x1b8'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xc0')][_0x83cf('0x151')](db[_0x83cf('0xbe')],{'as':'Account','foreignKey':'AccountId'});db[_0x83cf('0xc2')][_0x83cf('0x112')](db[_0x83cf('0xc2')],{'as':_0x83cf('0x1c1'),'foreignKey':'SubjectId'});db['VtigerField'][_0x83cf('0x112')](db[_0x83cf('0xc2')],{'as':_0x83cf('0x1c7'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xc2')][_0x83cf('0x112')](db[_0x83cf('0xc2')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db['VtigerField'][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db[_0x83cf('0xc4')]['hasMany'](db[_0x83cf('0xc5')],{'as':'Configurations','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xc5')][_0x83cf('0x112')](db['ServicenowField'],{'as':_0x83cf('0x1bd'),'foreignKey':_0x83cf('0x1c2')});db['ServicenowConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xc7')],{'as':_0x83cf('0x1be'),'foreignKey':_0x83cf('0x1bf')});db[_0x83cf('0xc5')][_0x83cf('0x112')](db['ServicenowField'],{'as':'Fields','foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xc5')][_0x83cf('0x151')](db[_0x83cf('0xc4')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x83cf('0x112')](db[_0x83cf('0xc7')],{'as':_0x83cf('0x1c1'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x83cf('0xc7')],{'as':'Description','foreignKey':_0x83cf('0x1bf')});db['ServicenowField'][_0x83cf('0x112')](db[_0x83cf('0xc7')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xc7')]['belongsTo'](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db['Dynamics365Account'][_0x83cf('0x112')](db[_0x83cf('0xca')],{'as':'Configurations','onDelete':_0x83cf('0x110'),'foreignKey':'AccountId'});db[_0x83cf('0xc8')][_0x83cf('0x151')](db['CloudProvider'],{'as':_0x83cf('0x108'),'foreignKey':'CloudProviderId'});db[_0x83cf('0xca')]['hasMany'](db[_0x83cf('0xcb')],{'as':_0x83cf('0x1bd'),'onDelete':'cascade','foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xca')][_0x83cf('0x112')](db[_0x83cf('0xcb')],{'as':_0x83cf('0x1be'),'onDelete':_0x83cf('0x110'),'foreignKey':'DescriptionId'});db[_0x83cf('0xca')][_0x83cf('0x112')](db[_0x83cf('0xcb')],{'as':'Fields','onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1c0')});db['Dynamics365Configuration']['belongsTo'](db[_0x83cf('0xc8')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0xcb')][_0x83cf('0x112')](db['Dynamics365Field'],{'as':_0x83cf('0x1c1'),'foreignKey':'SubjectId'});db[_0x83cf('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':_0x83cf('0x1c7'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x83cf('0x112')](db[_0x83cf('0xcb')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xcb')][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':_0x83cf('0x93'),'foreignKey':_0x83cf('0x1c4')});db['FreshsalesAccount'][_0x83cf('0x112')](db['FreshsalesConfiguration'],{'as':_0x83cf('0x1bb'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1bc')});db[_0x83cf('0x1ca')][_0x83cf('0x112')](db['FreshsalesField'],{'as':_0x83cf('0x1bd'),'foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0x1ca')][_0x83cf('0x112')](db['FreshsalesField'],{'as':_0x83cf('0x1be'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x83cf('0x112')](db[_0x83cf('0xce')],{'as':_0x83cf('0x1b8'),'foreignKey':'FieldId'});db[_0x83cf('0x1ca')][_0x83cf('0x151')](db[_0x83cf('0x1cb')],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1bc')});db['FreshsalesField'][_0x83cf('0x112')](db[_0x83cf('0xce')],{'as':'Subject','foreignKey':_0x83cf('0x1c2')});db[_0x83cf('0xce')]['hasMany'](db[_0x83cf('0xce')],{'as':_0x83cf('0x1c7'),'foreignKey':_0x83cf('0x1bf')});db['FreshsalesField']['hasMany'](db[_0x83cf('0xce')],{'as':_0x83cf('0x1c3'),'foreignKey':_0x83cf('0x1c0')});db[_0x83cf('0xce')][_0x83cf('0x151')](db[_0x83cf('0x93')],{'as':'Variable','foreignKey':_0x83cf('0x1c4')});db[_0x83cf('0x1cc')]['belongsTo'](db['ChatWebsite'],{});db[_0x83cf('0x1cc')]['belongsTo'](db[_0x83cf('0xf5')],{'as':'List','foreignKey':'ListId'});db['ChatQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db[_0x83cf('0x1cc')][_0x83cf('0x151')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x64')],{});db[_0x83cf('0x1cc')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{});db['ChatQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x67')],{});db[_0x83cf('0x1cd')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x83cf('0x1cd')]['belongsTo'](db[_0x83cf('0x10d')],{'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1ce')});db['JscriptySessionReport']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x83cf('0x1cf'),'onDelete':'cascade'});db[_0x83cf('0xd7')][_0x83cf('0x112')](db[_0x83cf('0xd4')],{'foreignKey':_0x83cf('0x1cf'),'onDelete':'cascade'});db[_0x83cf('0xd9')]['belongsTo'](db['SmsAccount'],{});db[_0x83cf('0xd9')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':'List','foreignKey':_0x83cf('0x166')});db[_0x83cf('0xd9')][_0x83cf('0x151')](db[_0x83cf('0x122')],{'as':'Contact','foreignKey':_0x83cf('0x15f')});db[_0x83cf('0xd9')][_0x83cf('0x151')](db[_0x83cf('0x54')],{});db[_0x83cf('0xd9')][_0x83cf('0x151')](db[_0x83cf('0x56')],{});db[_0x83cf('0xd9')][_0x83cf('0x151')](db['User'],{});db[_0x83cf('0xd9')][_0x83cf('0x151')](db[_0x83cf('0x58')],{});db[_0x83cf('0xde')][_0x83cf('0x112')](db['JscriptySessionReport'],{'foreignKey':_0x83cf('0x1d0')});db[_0x83cf('0xde')][_0x83cf('0x112')](db[_0x83cf('0xd5')],{'foreignKey':_0x83cf('0x1d0')});db[_0x83cf('0xde')][_0x83cf('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0x83cf('0x1d0')});db[_0x83cf('0xe3')]['belongsToMany'](db[_0x83cf('0x10d')],{'as':'Users','through':_0x83cf('0x144')});db[_0x83cf('0x156')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':'Agents','through':_0x83cf('0x1d1')});db[_0x83cf('0x156')][_0x83cf('0x120')](db[_0x83cf('0x1a')],{'through':_0x83cf('0x109'),'as':_0x83cf('0x12e')});db[_0x83cf('0x156')]['belongsToMany'](db[_0x83cf('0x130')],{'through':_0x83cf('0x1d2'),'as':_0x83cf('0x1d3')});db[_0x83cf('0x156')][_0x83cf('0x120')](db['ChatQueue'],{'through':_0x83cf('0x1d4'),'as':_0x83cf('0x1d5')});db[_0x83cf('0x156')][_0x83cf('0x120')](db[_0x83cf('0x131')],{'through':_0x83cf('0x17f'),'as':_0x83cf('0x132')});db['Team'][_0x83cf('0x120')](db['SmsQueue'],{'through':_0x83cf('0x1d6'),'as':_0x83cf('0x134')});db[_0x83cf('0x156')][_0x83cf('0x120')](db[_0x83cf('0x5f')],{'through':'team_has_openchannel_queues','as':_0x83cf('0x135')});db['Team'][_0x83cf('0x120')](db['WhatsappQueue'],{'through':_0x83cf('0x1d7'),'as':_0x83cf('0x136')});db[_0x83cf('0x156')]['belongsToMany'](db[_0x83cf('0xf7')],{'through':_0x83cf('0x1d8'),'as':_0x83cf('0x12f')});db[_0x83cf('0xe7')][_0x83cf('0x112')](db[_0x83cf('0x14d')],{'as':_0x83cf('0x14e'),'foreignKey':_0x83cf('0x19e')});db['Campaign']['hasMany'](db[_0x83cf('0x70')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x83cf('0xe7')][_0x83cf('0x112')](db[_0x83cf('0x72')],{'as':'HopperHistories','foreignKey':_0x83cf('0x19e')});db['Campaign']['hasMany'](db[_0x83cf('0x6e')],{'as':'HopperBlacks','foreignKey':_0x83cf('0x19e')});db[_0x83cf('0xe7')][_0x83cf('0x151')](db['Trunk'],{'as':_0x83cf('0x2c'),'foreignKey':_0x83cf('0x1d9')});db[_0x83cf('0xe7')][_0x83cf('0x151')](db[_0x83cf('0x2c')],{'as':_0x83cf('0x152'),'foreignKey':'TrunkBackupId'});db[_0x83cf('0xe7')][_0x83cf('0x151')](db['Interval'],{'as':_0x83cf('0x7f'),'foreignKey':'IntervalId'});db['Campaign'][_0x83cf('0x151')](db[_0x83cf('0xe3')],{'as':_0x83cf('0xe3'),'foreignKey':_0x83cf('0x1da')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x83cf('0x154'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x83cf('0x120')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x1db'),'through':'campaigns_has_cm_blacklists'});db[_0x83cf('0xeb')][_0x83cf('0x151')](db[_0x83cf('0x65')],{'as':_0x83cf('0x65'),'foreignKey':_0x83cf('0x193')});db['MailTransferReport']['belongsTo'](db[_0x83cf('0x41')],{});db['MailTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x40')],{});db[_0x83cf('0x1dc')][_0x83cf('0x151')](db['MailAccount'],{'foreignKey':_0x83cf('0x1dd'),'as':_0x83cf('0x1de')});db[_0x83cf('0x1dc')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':'FromUserId','as':_0x83cf('0x1df')});db[_0x83cf('0x1dc')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':'ToUserId','as':_0x83cf('0x1e0')});db['MailTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x130')],{'foreignKey':_0x83cf('0x1e1'),'as':_0x83cf('0x1e2')});db[_0x83cf('0x1dc')][_0x83cf('0x151')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x83cf('0x1e3')});db[_0x83cf('0xef')]['belongsTo'](db[_0x83cf('0x64')],{});db[_0x83cf('0xef')][_0x83cf('0x151')](db[_0x83cf('0x118')],{});db[_0x83cf('0xef')][_0x83cf('0x151')](db[_0x83cf('0x138')],{'foreignKey':'FromChatWebsiteId','as':_0x83cf('0x1de')});db[_0x83cf('0xef')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e4'),'as':_0x83cf('0x1df')});db[_0x83cf('0xef')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e5'),'as':_0x83cf('0x1e0')});db[_0x83cf('0xef')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x83cf('0x1e6'),'as':_0x83cf('0x1e2')});db[_0x83cf('0xef')][_0x83cf('0x151')](db['ChatWebsite'],{'foreignKey':_0x83cf('0x1e7'),'as':_0x83cf('0x1e3')});db['FaxTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x4c')],{});db[_0x83cf('0xf1')][_0x83cf('0x151')](db['FaxInteraction'],{});db[_0x83cf('0xf1')]['belongsTo'](db[_0x83cf('0x13a')],{'foreignKey':_0x83cf('0x1e8'),'as':'FromAccount'});db[_0x83cf('0xf1')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e4'),'as':'FromAgent'});db['FaxTransferReport']['belongsTo'](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e5'),'as':'ToAgent'});db[_0x83cf('0xf1')][_0x83cf('0x151')](db[_0x83cf('0x131')],{'foreignKey':'ToFaxQueueId','as':_0x83cf('0x1e2')});db['FaxTransferReport'][_0x83cf('0x151')](db['FaxAccount'],{'foreignKey':_0x83cf('0x1e9'),'as':_0x83cf('0x1e3')});db[_0x83cf('0x1ea')][_0x83cf('0x151')](db[_0x83cf('0x5d')],{});db['OpenchannelTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x5c')],{});db[_0x83cf('0x1ea')][_0x83cf('0x151')](db[_0x83cf('0x5a')],{'foreignKey':_0x83cf('0x1eb'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':'FromUserId','as':_0x83cf('0x1df')});db[_0x83cf('0x1ea')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e5'),'as':_0x83cf('0x1e0')});db[_0x83cf('0x1ea')][_0x83cf('0x151')](db[_0x83cf('0x5f')],{'foreignKey':_0x83cf('0x1ec'),'as':_0x83cf('0x1e2')});db[_0x83cf('0x1ea')][_0x83cf('0x151')](db[_0x83cf('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x83cf('0x1e3')});db['SmsTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x56')],{});db['SmsTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x54')],{});db['SmsTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x50')],{'foreignKey':'FromSmsAccountId','as':_0x83cf('0x1de')});db[_0x83cf('0xf3')]['belongsTo'](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e4'),'as':'FromAgent'});db['SmsTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e5'),'as':_0x83cf('0x1e0')});db[_0x83cf('0xf3')][_0x83cf('0x151')](db['SmsQueue'],{'foreignKey':_0x83cf('0x1ed'),'as':_0x83cf('0x1e2')});db['SmsTransferReport']['belongsTo'](db[_0x83cf('0x50')],{'foreignKey':_0x83cf('0x1ee'),'as':_0x83cf('0x1e3')});db['CmList'][_0x83cf('0x112')](db[_0x83cf('0x7c')],{'as':_0x83cf('0x164'),'foreignKey':_0x83cf('0x166'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0xf5')][_0x83cf('0x112')](db[_0x83cf('0x75')],{'as':'CustomFields','foreignKey':_0x83cf('0x166')});db[_0x83cf('0xf5')][_0x83cf('0x112')](db[_0x83cf('0x122')],{'as':_0x83cf('0x123'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0xf5')][_0x83cf('0x112')](db[_0x83cf('0x70')],{'as':_0x83cf('0x115'),'foreignKey':_0x83cf('0x166')});db['CmList'][_0x83cf('0x112')](db[_0x83cf('0x72')],{'as':_0x83cf('0x1ef'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0xf5')][_0x83cf('0x112')](db[_0x83cf('0x116')],{'as':_0x83cf('0x116'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0xf5')][_0x83cf('0x120')](db[_0x83cf('0x1a')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x83cf('0xf5')]['belongsToMany'](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x83cf('0x112')](db[_0x83cf('0x114')],{'as':_0x83cf('0x1a6'),'onDelete':_0x83cf('0x110')});db['VoicePrefix']['belongsToMany'](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':'UserVoicePrefix'});db[_0x83cf('0xf7')][_0x83cf('0x120')](db[_0x83cf('0x156')],{'through':'TeamVoicePrefix','as':_0x83cf('0x16c')});db[_0x83cf('0x11e')][_0x83cf('0x112')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'foreignKey':_0x83cf('0x11f')});db[_0x83cf('0x11e')][_0x83cf('0x112')](db['UserProfileSection'],{'as':_0x83cf('0x1f0'),'foreignKey':_0x83cf('0x11f'),'onDelete':'cascade'});db[_0x83cf('0xf8')][_0x83cf('0x112')](db['UserProfileResource'],{'as':_0x83cf('0x1f1'),'foreignKey':_0x83cf('0x1f2'),'onDelete':_0x83cf('0x110')});db[_0x83cf('0x140')][_0x83cf('0x112')](db[_0x83cf('0x7c')],{'as':_0x83cf('0x164'),'foreignKey':_0x83cf('0x1f3'),'onDelete':_0x83cf('0x110')});db['WhatsappAccount'][_0x83cf('0x112')](db[_0x83cf('0x7a')],{'as':_0x83cf('0x178'),'foreignKey':_0x83cf('0x1f3')});db[_0x83cf('0x140')][_0x83cf('0x112')](db['WhatsappMessage'],{'as':_0x83cf('0x158'),'foreignKey':_0x83cf('0x1f3')});db['WhatsappAccount'][_0x83cf('0x112')](db[_0x83cf('0x11c')],{'as':_0x83cf('0x179')});db['WhatsappAccount']['hasMany'](db[_0x83cf('0xfe')],{'as':'Applications'});db[_0x83cf('0x140')][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db[_0x83cf('0x140')]['belongsTo'](db[_0x83cf('0x81')],{'as':_0x83cf('0x168'),'foreignKey':_0x83cf('0x169')});db[_0x83cf('0x140')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x142')});db['WhatsappApplication'][_0x83cf('0x151')](db['User'],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0xfe')][_0x83cf('0x151')](db['WhatsappQueue'],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0xfe')]['belongsTo'](db[_0x83cf('0x140')],{'onDelete':_0x83cf('0x161')});db[_0x83cf('0xfe')][_0x83cf('0x151')](db[_0x83cf('0x7f')],{'onDelete':_0x83cf('0x161'),'foreignKey':_0x83cf('0x153')});db[_0x83cf('0xfe')]['belongsTo'](db['Tag'],{'onDelete':_0x83cf('0x161'),'foreignKey':'TagId'});db[_0x83cf('0x11c')]['hasMany'](db[_0x83cf('0x101')],{'as':_0x83cf('0x158'),'onDelete':_0x83cf('0x110'),'foreignKey':_0x83cf('0x1f4')});db['WhatsappInteraction'][_0x83cf('0x151')](db['WhatsappAccount'],{'as':_0x83cf('0x16e'),'foreignKey':_0x83cf('0x1f3')});db['WhatsappInteraction'][_0x83cf('0x151')](db['CmContact'],{'as':_0x83cf('0x15e'),'foreignKey':_0x83cf('0x15f')});db['WhatsappInteraction'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':'Owner','foreignKey':'UserId'});db[_0x83cf('0x11c')][_0x83cf('0x120')](db[_0x83cf('0x8b')],{'through':_0x83cf('0x1ac'),'as':_0x83cf('0x171')});db[_0x83cf('0x11c')][_0x83cf('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x83cf('0x172')});db[_0x83cf('0x11c')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x173'),'through':_0x83cf('0x12d'),'foreignKey':'WhatsappInteractionId'});db[_0x83cf('0x101')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x10d')});db[_0x83cf('0x101')]['belongsTo'](db[_0x83cf('0x122')],{'onDelete':'cascade','as':_0x83cf('0x15e')});db['WhatsappMessage'][_0x83cf('0x151')](db[_0x83cf('0x11c')],{'onDelete':_0x83cf('0x110'),'as':_0x83cf('0x17d'),'foreignKey':'WhatsappInteractionId'});db[_0x83cf('0x101')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x83cf('0x1f3')});db['WhatsappQueueReport'][_0x83cf('0x151')](db[_0x83cf('0x140')],{});db['WhatsappQueueReport'][_0x83cf('0x151')](db[_0x83cf('0xf5')],{'as':_0x83cf('0x165'),'foreignKey':_0x83cf('0x166')});db['WhatsappQueueReport'][_0x83cf('0x151')](db['CmContact'],{'as':_0x83cf('0x15e'),'foreignKey':'ContactId'});db[_0x83cf('0x103')][_0x83cf('0x151')](db[_0x83cf('0x11c')],{});db[_0x83cf('0x103')][_0x83cf('0x151')](db[_0x83cf('0x107')],{});db[_0x83cf('0x103')][_0x83cf('0x151')](db[_0x83cf('0x101')],{});db[_0x83cf('0x103')][_0x83cf('0x151')](db[_0x83cf('0x10d')],{});db[_0x83cf('0x105')][_0x83cf('0x151')](db[_0x83cf('0x101')],{});db[_0x83cf('0x105')][_0x83cf('0x151')](db['WhatsappInteraction'],{});db[_0x83cf('0x105')][_0x83cf('0x151')](db[_0x83cf('0x140')],{'foreignKey':_0x83cf('0x1f5'),'as':'FromAccount'});db[_0x83cf('0x105')][_0x83cf('0x151')](db['WhatsappAccount'],{'foreignKey':_0x83cf('0x1f6'),'as':'ToAccount'});db[_0x83cf('0x105')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x83cf('0x1f7'),'as':_0x83cf('0x1e2')});db['WhatsappTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e4'),'as':_0x83cf('0x1df')});db['WhatsappTransferReport'][_0x83cf('0x151')](db[_0x83cf('0x10d')],{'foreignKey':_0x83cf('0x1e5'),'as':'ToAgent'});db[_0x83cf('0x107')][_0x83cf('0x120')](db[_0x83cf('0x10d')],{'as':_0x83cf('0x16a'),'through':_0x83cf('0x137'),'foreignKey':_0x83cf('0x1f8')});db[_0x83cf('0x107')]['belongsToMany'](db[_0x83cf('0x156')],{'through':_0x83cf('0x1d7'),'as':_0x83cf('0x16c')});db[_0x83cf('0x1f9')]['belongsTo'](db['User'],{'as':_0x83cf('0x1fa'),'foreignKey':_0x83cf('0x111'),'onDelete':_0x83cf('0x110'),'hooks':!![]});db[_0x83cf('0x108')][_0x83cf('0x10e')](db['Dynamics365Account'],{'as':_0x83cf('0xc8'),'onDelete':'restrict'});db[_0x83cf('0x108')][_0x83cf('0x10e')](db[_0x83cf('0x39')],{'as':_0x83cf('0x1fb'),'onDelete':_0x83cf('0x161')});db[_0x83cf('0x108')]['hasOne'](db[_0x83cf('0x3a')],{'as':_0x83cf('0x163'),'onDelete':'restrict'});module[_0x83cf('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xcb65=['UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','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','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_chat_interactions','SmsInteraction','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','CloudProviderId','restrict','MailServerOut','MailAccountId','Smtp','Dispositions','Answers','Messages','MailApplication','TemplateId','team_has_mail_queues','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','ListId','DashboardItem','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxQueue','ContactId','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','CmContactId','Company','cm_contact_has_tags','CmHopperAdditionalPhone','Queue','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticMetric','Configurations','Subjects','SubjectId','DescriptionId','Subject','Description','Field','FieldId','Variable','VariableId','AccountId','SugarcrmField','Descriptions','DeskField','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','FromId','ToId','SessionId','ProjectId','ChatQueues','team_has_whatsapp_queues','VoicePrefix','TrunkId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','user','Imap','../config/environment','determine','defaultsDeep','sequelize','motion2','xcall','127.0.0.1','utf8mb4','name','sequelizeHistory','xC@LL1234','mysql','utf8','utf8_general_ci','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model'];(function(_0x25ad0e,_0x43161b){var _0x460699=function(_0x5643ce){while(--_0x5643ce){_0x25ad0e['push'](_0x25ad0e['shift']());}};_0x460699(++_0x43161b);}(_0xcb65,0x1cf));var _0x5cb6=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0xcb65[_0x21d532];return _0x37bda1;};'use strict';var config=require(_0x5cb6('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x5cb6('0x1')]();config['sequelize']=_[_0x5cb6('0x2')](config[_0x5cb6('0x3')],{'database':_0x5cb6('0x4'),'username':_0x5cb6('0x5'),'password':'xC@LL1234','options':{'host':_0x5cb6('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x5cb6('0x7')},'logging':![],'timezone':timezone[_0x5cb6('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x5cb6('0x9')]=_[_0x5cb6('0x2')](config[_0x5cb6('0x9')],{'database':_0x5cb6('0x4'),'username':'xcall','password':_0x5cb6('0xa'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5cb6('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x5cb6('0x8')](),'define':{'charset':_0x5cb6('0xc'),'collate':_0x5cb6('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5cb6('0x3')]['database'],config[_0x5cb6('0x3')][_0x5cb6('0xe')],config[_0x5cb6('0x3')][_0x5cb6('0xf')],config[_0x5cb6('0x3')][_0x5cb6('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5cb6('0x9')][_0x5cb6('0x11')],config['sequelizeHistory'][_0x5cb6('0xe')],config[_0x5cb6('0x9')][_0x5cb6('0xf')],config[_0x5cb6('0x9')]['options'])};db[_0x5cb6('0x12')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x14'));db[_0x5cb6('0x15')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x16'));db[_0x5cb6('0x17')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x5cb6('0x18')]=db['sequelize'][_0x5cb6('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x5cb6('0x19')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x1a'));db['VoiceRecording']=db['sequelize'][_0x5cb6('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x5cb6('0x1b')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x1c'));db[_0x5cb6('0x1d')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x1e'));db[_0x5cb6('0x1f')]=db['sequelize']['import'](_0x5cb6('0x20'));db[_0x5cb6('0x21')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x22'));db['VoiceDialReport']=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x23'));db[_0x5cb6('0x24')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x25'));db[_0x5cb6('0x26')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x27'));db['MemberReport']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x28'));db[_0x5cb6('0x29')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x2a'));db[_0x5cb6('0x2b')]=db['sequelize']['import'](_0x5cb6('0x2c'));db[_0x5cb6('0x2d')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x2e'));db[_0x5cb6('0x2f')]=db[_0x5cb6('0x3')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x5cb6('0x30')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x31'));db[_0x5cb6('0x32')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x33'));db[_0x5cb6('0x34')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x35'));db[_0x5cb6('0x36')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x37'));db[_0x5cb6('0x38')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x5cb6('0x39')]=db['sequelize'][_0x5cb6('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x5cb6('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x5cb6('0x3a')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x3b'));db[_0x5cb6('0x3c')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x3d'));db[_0x5cb6('0x3e')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x3f'));db[_0x5cb6('0x40')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x5cb6('0x41')]=db['sequelize']['import'](_0x5cb6('0x42'));db['MailApplication']=db['sequelize']['import'](_0x5cb6('0x43'));db['MailQueueReport']=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x5cb6('0x44')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x45'));db[_0x5cb6('0x46')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x47'));db[_0x5cb6('0x48')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x49'));db[_0x5cb6('0x4a')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x4b'));db[_0x5cb6('0x4c')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x4d'));db['FaxQueue']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x4e'));db[_0x5cb6('0x4f')]=db['sequelize']['import'](_0x5cb6('0x50'));db[_0x5cb6('0x51')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/smsAccount/smsAccount.model');db[_0x5cb6('0x52')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x53'));db['SmsMessage']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x54'));db['SmsQueue']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x55'));db['OpenchannelAccount']=db['sequelize']['import'](_0x5cb6('0x56'));db[_0x5cb6('0x57')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x58'));db[_0x5cb6('0x59')]=db[_0x5cb6('0x3')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5cb6('0x5a')]=db['sequelize'][_0x5cb6('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x5cb6('0x5b')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x5c'));db[_0x5cb6('0x5d')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x5e'));db['OpenchannelQueueReport']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x5f'));db[_0x5cb6('0x60')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/chatApplication/chatApplication.model');db[_0x5cb6('0x61')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x62'));db[_0x5cb6('0x63')]=db[_0x5cb6('0x3')]['import']('../api/chatMessage/chatMessage.model');db[_0x5cb6('0x64')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5cb6('0x65')]=db[_0x5cb6('0x3')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/chatGroup/chatGroup.model');db[_0x5cb6('0x66')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x67'));db[_0x5cb6('0x68')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x69'));db[_0x5cb6('0x6a')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x6b'));db[_0x5cb6('0x6c')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/cmHopper/cmHopper.model');db[_0x5cb6('0x6d')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x6e'));db[_0x5cb6('0x6f')]=db['sequelize'][_0x5cb6('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x5cb6('0x3')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x70'));db[_0x5cb6('0x71')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0x5cb6('0x72')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x73'));db[_0x5cb6('0x74')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x75'));db[_0x5cb6('0x76')]=db[_0x5cb6('0x3')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x5cb6('0x77')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/disposition/disposition.model');db[_0x5cb6('0x78')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x79'));db[_0x5cb6('0x7a')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x7b'));db[_0x5cb6('0x7c')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x7d'));db['Cdr']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x7e'));db['VoiceQueuesLog']=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x7f'));db['Schedule']=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x80'));db[_0x5cb6('0x81')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x82'));db[_0x5cb6('0x83')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x84'));db[_0x5cb6('0x85')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x86'));db[_0x5cb6('0x87')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x88'));db['CmHopperAdditionalPhone']=db['sequelize']['import'](_0x5cb6('0x89'));db[_0x5cb6('0x8a')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x8b'));db[_0x5cb6('0x8c')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x8d'));db['Variable']=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x8e'));db[_0x5cb6('0x8f')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x90'));db[_0x5cb6('0x91')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/integrationReport/integrationReport.model');db[_0x5cb6('0x92')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x93'));db[_0x5cb6('0x94')]=db['sequelize'][_0x5cb6('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x5cb6('0x95')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x96'));db['AnalyticMetric']=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x97'));db[_0x5cb6('0x98')]=db['sequelize'][_0x5cb6('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x5cb6('0x99')]=db['sequelize']['import'](_0x5cb6('0x9a'));db[_0x5cb6('0x9b')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x9c'));db[_0x5cb6('0x9d')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x9e'));db[_0x5cb6('0x9f')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xa0'));db[_0x5cb6('0xa1')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xa2'));db[_0x5cb6('0xa3')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xa4'));db['SugarcrmField']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xa5'));db[_0x5cb6('0xa6')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xa7'));db[_0x5cb6('0xa8')]=db['sequelize'][_0x5cb6('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xa9'));db[_0x5cb6('0xaa')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xab'));db[_0x5cb6('0xac')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xad'));db[_0x5cb6('0xae')]=db['sequelize']['import'](_0x5cb6('0xaf'));db[_0x5cb6('0xb0')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xb1'));db[_0x5cb6('0xb2')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x5cb6('0xb3')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xb4'));db[_0x5cb6('0xb5')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xb6'));db[_0x5cb6('0xb7')]=db['sequelize'][_0x5cb6('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xb8'));db[_0x5cb6('0xb9')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xba'));db[_0x5cb6('0xbb')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x5cb6('0x3')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x5cb6('0xbc')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x5cb6('0xbd')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xbe'));db[_0x5cb6('0xbf')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xc0'));db[_0x5cb6('0xc1')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xc2'));db[_0x5cb6('0xc3')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xc4'));db[_0x5cb6('0xc5')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xc6'));db[_0x5cb6('0xc7')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xc8'));db[_0x5cb6('0x8f')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0x90'));db[_0x5cb6('0xc9')]=db[_0x5cb6('0x3')]['import']('../api/network/network.model');db[_0x5cb6('0xca')]=db['sequelize'][_0x5cb6('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x5cb6('0xcb')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xcc'));db[_0x5cb6('0xcd')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xce'));db[_0x5cb6('0xcf')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xd0'));db[_0x5cb6('0xd1')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xd2'));db[_0x5cb6('0xd3')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xd4'));db[_0x5cb6('0xd5')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xd6'));db[_0x5cb6('0xd7')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x5cb6('0xd8')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xd9'));db[_0x5cb6('0xda')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xdb'));db[_0x5cb6('0xdc')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xdd'));db[_0x5cb6('0xde')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/squareProject/squareProject.model');db[_0x5cb6('0xdf')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xe0'));db[_0x5cb6('0xe1')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xe2'));db[_0x5cb6('0xe3')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xe4'));db[_0x5cb6('0xe5')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xe6'));db[_0x5cb6('0xe7')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/campaign/campaign.model');db[_0x5cb6('0xe8')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xe9'));db[_0x5cb6('0xea')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xeb'));db['Plugin']=db[_0x5cb6('0x3')]['import']('../api/plugin/plugin.model');db[_0x5cb6('0xec')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xed'));db['ChatTransferReport']=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xee'));db[_0x5cb6('0xef')]=db[_0x5cb6('0x3')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x5cb6('0xf0')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xf1'));db[_0x5cb6('0xf2')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xf3'));db['CmList']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xf4'));db['VoicePrefix']=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0xf5'));db[_0x5cb6('0xf6')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/userProfile/userProfile.model');db[_0x5cb6('0xf7')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xf8'));db[_0x5cb6('0xf9')]=db[_0x5cb6('0x3')]['import'](_0x5cb6('0xfa'));db[_0x5cb6('0xfb')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0xfc'));db[_0x5cb6('0xfd')]=db['sequelize']['import'](_0x5cb6('0xfe'));db[_0x5cb6('0xff')]=db['sequelize']['import'](_0x5cb6('0x100'));db['WhatsappInteraction']=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x101'));db[_0x5cb6('0x102')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x103'));db[_0x5cb6('0x104')]=db['sequelize'][_0x5cb6('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5cb6('0x105')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x5cb6('0x106')]=db[_0x5cb6('0x3')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x5cb6('0x107')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x108'));db[_0x5cb6('0x109')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x5cb6('0x10a')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x10b'));db[_0x5cb6('0x10c')]=db['sequelize'][_0x5cb6('0x13')](_0x5cb6('0x10d'));db[_0x5cb6('0x10e')]=db[_0x5cb6('0x3')][_0x5cb6('0x13')](_0x5cb6('0x10f'));db[_0x5cb6('0x12')][_0x5cb6('0x110')](db['VoiceMail'],{'as':_0x5cb6('0x1d'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x110')](db[_0x5cb6('0x10e')],{'as':_0x5cb6('0x113'),'onDelete':'cascade','foreignKey':_0x5cb6('0x112')});db['User'][_0x5cb6('0x114')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x2d')],{'as':_0x5cb6('0x115'),'foreignKey':'UserId'});db['User'][_0x5cb6('0x114')](db[_0x5cb6('0x116')],{'as':_0x5cb6('0x117'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x6f')],{'as':_0x5cb6('0x118'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x119')],{'as':_0x5cb6('0x11a'),'foreignKey':_0x5cb6('0x112')});db['User'][_0x5cb6('0x114')](db[_0x5cb6('0x11b')],{'as':_0x5cb6('0x11b'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')]['hasMany'](db[_0x5cb6('0x59')],{'as':_0x5cb6('0x11c'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x61')],{'as':_0x5cb6('0x11d'),'foreignKey':_0x5cb6('0x112')});db['User'][_0x5cb6('0x114')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db['FaxInteraction'],{'as':_0x5cb6('0x11e'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x40')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x5cb6('0x12')][_0x5cb6('0x114')](db[_0x5cb6('0x11f')],{'as':_0x5cb6('0x120'),'foreignKey':_0x5cb6('0x112')});db['User'][_0x5cb6('0x114')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x5cb6('0x121')});db[_0x5cb6('0x12')][_0x5cb6('0x122')](db[_0x5cb6('0xf6')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x5cb6('0x123')](db[_0x5cb6('0x124')],{'as':'Groups','through':_0x5cb6('0x125')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x126'),'through':_0x5cb6('0x127')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x129'),'through':_0x5cb6('0x12a')});db['User'][_0x5cb6('0x123')](db[_0x5cb6('0xe3')],{'through':_0x5cb6('0x12b')});db['User'][_0x5cb6('0x123')](db[_0x5cb6('0x40')],{'as':_0x5cb6('0x12c'),'through':'user_has_mail_interactions'});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x61')],{'as':_0x5cb6('0x11d'),'through':_0x5cb6('0x12d')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x5cb6('0x12')]['belongsToMany'](db[_0x5cb6('0x12e')],{'as':_0x5cb6('0x12f'),'through':_0x5cb6('0x130')});db['User'][_0x5cb6('0x123')](db[_0x5cb6('0x59')],{'as':_0x5cb6('0x11c'),'through':_0x5cb6('0x131')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x11f')],{'as':_0x5cb6('0x120'),'through':_0x5cb6('0x132')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db['VoiceQueue'],{'as':_0x5cb6('0x133'),'through':'UserVoiceQueue','required':![]});db['User'][_0x5cb6('0x123')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x5cb6('0x10c'),'required':![]});db['User'][_0x5cb6('0x123')](db[_0x5cb6('0x3c')],{'as':_0x5cb6('0x134'),'through':'UserMailQueue','required':![]});db[_0x5cb6('0x12')]['belongsToMany'](db[_0x5cb6('0x65')],{'as':'ChatQueues','through':_0x5cb6('0x30'),'required':![],'hooks':!![]});db['User'][_0x5cb6('0x123')](db['FaxQueue'],{'as':'FaxQueues','through':_0x5cb6('0x34'),'required':![]});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x135')],{'as':_0x5cb6('0x136'),'through':_0x5cb6('0x36'),'required':![]});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x5b')],{'as':_0x5cb6('0x137'),'through':_0x5cb6('0x138'),'required':![]});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x106')],{'as':_0x5cb6('0x139'),'through':_0x5cb6('0x38'),'required':![]});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x128')],{'through':_0x5cb6('0x12a')});db['User'][_0x5cb6('0x123')](db['ChatWebsite'],{'as':_0x5cb6('0x13a'),'through':_0x5cb6('0x13b')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x46')],{'as':_0x5cb6('0x13c'),'through':'user_has_fax_accounts'});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x3a')],{'as':_0x5cb6('0x13d'),'through':_0x5cb6('0x13e')});db[_0x5cb6('0x12')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x5cb6('0x13f'),'through':'user_has_openchannel_accounts'});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0x51')],{'as':_0x5cb6('0x140'),'through':'user_has_sms_accounts'});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0xfd')],{'as':_0x5cb6('0x141'),'through':_0x5cb6('0x142')});db[_0x5cb6('0x12')][_0x5cb6('0x123')](db[_0x5cb6('0xde')],{'as':_0x5cb6('0x143'),'through':_0x5cb6('0x144')});db['VoiceChanSpy'][_0x5cb6('0x114')](db['VoiceExtension'],{'as':_0x5cb6('0x145'),'onDelete':'cascade','foreignKey':_0x5cb6('0x146')});db[_0x5cb6('0x17')][_0x5cb6('0x114')](db[_0x5cb6('0x116')],{'onDelete':'cascade'});db[_0x5cb6('0x116')][_0x5cb6('0x114')](db[_0x5cb6('0x116')],{'as':_0x5cb6('0x147'),'onDelete':_0x5cb6('0x111')});db['VoiceMusicOnHold'][_0x5cb6('0x123')](db[_0x5cb6('0x81')],{'as':_0x5cb6('0x148'),'through':'moh_has_sounds'});db[_0x5cb6('0x19')]['hasMany'](db[_0x5cb6('0x2d')],{'as':_0x5cb6('0x149'),'foreignKey':_0x5cb6('0x14a')});db['VoiceQueue']['hasMany'](db[_0x5cb6('0x6c')],{'as':_0x5cb6('0x14b'),'foreignKey':_0x5cb6('0x14a')});db[_0x5cb6('0x19')][_0x5cb6('0x114')](db[_0x5cb6('0x6f')],{'as':_0x5cb6('0x118'),'foreignKey':_0x5cb6('0x14a')});db[_0x5cb6('0x19')]['hasMany'](db[_0x5cb6('0x119')],{'as':_0x5cb6('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x5cb6('0x19')][_0x5cb6('0x114')](db[_0x5cb6('0x11b')],{'as':_0x5cb6('0x11b'),'foreignKey':_0x5cb6('0x14a')});db[_0x5cb6('0x19')][_0x5cb6('0x114')](db[_0x5cb6('0x6d')],{'as':_0x5cb6('0x14d'),'foreignKey':_0x5cb6('0x14a')});db[_0x5cb6('0x19')][_0x5cb6('0x114')](db[_0x5cb6('0xd1')],{'as':_0x5cb6('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x5cb6('0x19')][_0x5cb6('0x122')](db[_0x5cb6('0x29')],{'as':_0x5cb6('0x29'),'foreignKey':'TrunkId'});db[_0x5cb6('0x19')]['belongsTo'](db[_0x5cb6('0x29')],{'as':_0x5cb6('0x14f'),'foreignKey':_0x5cb6('0x150')});db[_0x5cb6('0x19')][_0x5cb6('0x122')](db[_0x5cb6('0x7a')],{'as':'Interval','foreignKey':_0x5cb6('0x151')});db['VoiceQueue']['belongsTo'](db[_0x5cb6('0x7c')],{'as':_0x5cb6('0x152'),'foreignKey':_0x5cb6('0x153')});db[_0x5cb6('0x19')][_0x5cb6('0x123')](db['CmList'],{'as':_0x5cb6('0x129'),'through':_0x5cb6('0x154')});db[_0x5cb6('0x19')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x2f')});db[_0x5cb6('0x19')][_0x5cb6('0x123')](db[_0x5cb6('0xe3')],{'as':_0x5cb6('0x156'),'through':_0x5cb6('0x109')});db['VoiceQueue'][_0x5cb6('0x123')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x157'),'through':_0x5cb6('0x158')});db[_0x5cb6('0x159')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':'User','foreignKey':'UserId'});db['ScreenRecording']['belongsTo'](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x12'),'foreignKey':_0x5cb6('0x112')});db['VoiceMail'][_0x5cb6('0x114')](db[_0x5cb6('0x1f')],{'as':'Messages','onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x15a'),'sourceKey':_0x5cb6('0x15b')});db[_0x5cb6('0x1f')][_0x5cb6('0x122')](db[_0x5cb6('0x1d')],{'foreignKey':_0x5cb6('0x15a'),'targetKey':_0x5cb6('0x15b')});db[_0x5cb6('0x21')]['hasMany'](db['VoiceQueueReport'],{'as':_0x5cb6('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0x5cb6('0x21')]['hasMany'](db[_0x5cb6('0x24')],{'as':_0x5cb6('0x15d'),'foreignKey':_0x5cb6('0x15e'),'constraints':![]});db[_0x5cb6('0x21')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x12'),'foreignKey':_0x5cb6('0x112')});db['VoiceCallReport'][_0x5cb6('0x122')](db['CmContact'],{'as':_0x5cb6('0x15f'),'foreignKey':'ContactId'});db[_0x5cb6('0x39')][_0x5cb6('0x122')](db[_0x5cb6('0x3a')],{'as':_0x5cb6('0x3a'),'foreignKey':'MailAccountId'});db[_0x5cb6('0x39')]['belongsTo'](db[_0x5cb6('0x107')],{'as':_0x5cb6('0x107'),'foreignKey':_0x5cb6('0x160'),'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x162')][_0x5cb6('0x122')](db[_0x5cb6('0x3a')],{'as':_0x5cb6('0x3a'),'foreignKey':_0x5cb6('0x163')});db['MailServerOut'][_0x5cb6('0x122')](db[_0x5cb6('0x107')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x5cb6('0x161')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x3a')][_0x5cb6('0x110')](db[_0x5cb6('0x162')],{'as':_0x5cb6('0x164'),'onDelete':'cascade'});db[_0x5cb6('0x3a')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':_0x5cb6('0x165'),'foreignKey':_0x5cb6('0x163'),'onDelete':'cascade'});db[_0x5cb6('0x3a')][_0x5cb6('0x114')](db['CannedAnswer'],{'as':_0x5cb6('0x166'),'foreignKey':_0x5cb6('0x163')});db[_0x5cb6('0x3a')][_0x5cb6('0x114')](db[_0x5cb6('0x41')],{'as':_0x5cb6('0x167'),'foreignKey':'MailAccountId'});db[_0x5cb6('0x3a')]['hasMany'](db[_0x5cb6('0x40')],{'as':'Interactions'});db[_0x5cb6('0x3a')][_0x5cb6('0x114')](db[_0x5cb6('0x168')],{'as':_0x5cb6('0x147')});db[_0x5cb6('0x3a')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':'List','foreignKey':'ListId'});db[_0x5cb6('0x3a')][_0x5cb6('0x122')](db['Template'],{'as':'Template','foreignKey':_0x5cb6('0x169')});db[_0x5cb6('0x3a')][_0x5cb6('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x5cb6('0x153')});db['MailAccount']['belongsToMany'](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':'user_has_mail_accounts'});db[_0x5cb6('0x3c')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':'Agents','through':_0x5cb6('0x32')});db[_0x5cb6('0x3c')][_0x5cb6('0x123')](db[_0x5cb6('0xe3')],{'through':_0x5cb6('0x16a'),'as':'Teams'});db['MailInteraction']['hasMany'](db['MailMessage'],{'as':_0x5cb6('0x167'),'onDelete':_0x5cb6('0x111'),'foreignKey':'MailInteractionId'});db[_0x5cb6('0x40')]['belongsTo'](db[_0x5cb6('0x3a')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x163')});db[_0x5cb6('0x40')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':'ContactId'});db['MailInteraction'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x16c'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x40')]['belongsToMany'](db[_0x5cb6('0x83')],{'through':'mail_interaction_has_tags','as':_0x5cb6('0x16d')});db[_0x5cb6('0x40')][_0x5cb6('0x123')](db['Tag'],{'through':_0x5cb6('0x16e'),'as':_0x5cb6('0x16f')});db[_0x5cb6('0x40')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x170'),'through':'user_has_mail_interactions','foreignKey':_0x5cb6('0x171')});db['MailMessage']['hasMany'](db[_0x5cb6('0xea')],{'as':_0x5cb6('0x172'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x41')]['belongsTo'](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x12')});db[_0x5cb6('0x41')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x15f')});db[_0x5cb6('0x41')]['belongsTo'](db[_0x5cb6('0x40')],{'as':_0x5cb6('0x173'),'foreignKey':_0x5cb6('0x171')});db[_0x5cb6('0x41')][_0x5cb6('0x122')](db['MailAccount'],{'as':'Account','foreignKey':_0x5cb6('0x163')});db[_0x5cb6('0x41')][_0x5cb6('0x122')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x5cb6('0x174')});db['MailMessage'][_0x5cb6('0x122')](db[_0x5cb6('0x64')],{'as':_0x5cb6('0x64'),'foreignKey':_0x5cb6('0x175')});db[_0x5cb6('0x168')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x168')][_0x5cb6('0x122')](db['MailQueue'],{'onDelete':'restrict'});db[_0x5cb6('0x168')]['belongsTo'](db[_0x5cb6('0x3a')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x168')]['belongsTo'](db[_0x5cb6('0x7a')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x151')});db[_0x5cb6('0x168')][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':'restrict','foreignKey':_0x5cb6('0x176')});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db['MailAccount'],{});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5cb6('0x177')]['belongsTo'](db['MailInteraction'],{});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db['MailMessage'],{});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{});db[_0x5cb6('0x177')][_0x5cb6('0x122')](db['MailQueue'],{});db[_0x5cb6('0x44')][_0x5cb6('0x114')](db[_0x5cb6('0x17a')],{'as':_0x5cb6('0x17b'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x46')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':_0x5cb6('0x165'),'foreignKey':_0x5cb6('0x17c'),'onDelete':_0x5cb6('0x111')});db['FaxAccount'][_0x5cb6('0x114')](db[_0x5cb6('0x76')],{'as':_0x5cb6('0x166'),'foreignKey':_0x5cb6('0x17c')});db[_0x5cb6('0x46')][_0x5cb6('0x114')](db[_0x5cb6('0x4a')],{'as':_0x5cb6('0x17d')});db['FaxAccount']['hasMany'](db[_0x5cb6('0x48')],{'as':_0x5cb6('0x147')});db[_0x5cb6('0x46')][_0x5cb6('0x114')](db[_0x5cb6('0x116')],{'as':_0x5cb6('0x17e'),'onDelete':'cascade'});db[_0x5cb6('0x46')][_0x5cb6('0x114')](db[_0x5cb6('0x4c')],{'as':_0x5cb6('0x167')});db[_0x5cb6('0x46')]['belongsTo'](db['Trunk'],{'as':_0x5cb6('0x29')});db[_0x5cb6('0x46')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':'List','foreignKey':_0x5cb6('0x179')});db['FaxAccount'][_0x5cb6('0x122')](db[_0x5cb6('0x7c')],{'as':_0x5cb6('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5cb6('0x46')]['belongsToMany'](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x17f')});db[_0x5cb6('0x48')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x48')][_0x5cb6('0x122')](db[_0x5cb6('0x180')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x48')][_0x5cb6('0x122')](db[_0x5cb6('0x46')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x48')][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x176')});db[_0x5cb6('0x4a')][_0x5cb6('0x114')](db[_0x5cb6('0x4c')],{'as':_0x5cb6('0x167'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x5cb6('0x122')](db['FaxAccount'],{'as':'Account','foreignKey':_0x5cb6('0x17c')});db[_0x5cb6('0x4a')][_0x5cb6('0x122')](db['CmContact'],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x4a')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x16c'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x4a')][_0x5cb6('0x123')](db['Tag'],{'through':_0x5cb6('0x182'),'as':_0x5cb6('0x16d')});db['FaxInteraction'][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x182'),'as':_0x5cb6('0x16f')});db[_0x5cb6('0x4a')]['belongsToMany'](db['User'],{'as':_0x5cb6('0x170'),'through':_0x5cb6('0x183'),'foreignKey':'FaxInteractionId'});db[_0x5cb6('0x4c')][_0x5cb6('0x122')](db['User'],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x12')});db[_0x5cb6('0x4c')]['belongsTo'](db[_0x5cb6('0x4a')],{'as':'Interaction','foreignKey':_0x5cb6('0x184')});db[_0x5cb6('0x4c')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'onDelete':'cascade','as':'Contact'});db[_0x5cb6('0x4c')][_0x5cb6('0x122')](db['Attachment'],{'as':_0x5cb6('0xea'),'foreignKey':_0x5cb6('0x185')});db[_0x5cb6('0x4c')]['belongsTo'](db['FaxAccount'],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x17c')});db[_0x5cb6('0x180')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x34')});db[_0x5cb6('0x180')]['belongsToMany'](db['Team'],{'through':_0x5cb6('0x186'),'as':'Teams'});db['FaxQueueReport'][_0x5cb6('0x122')](db[_0x5cb6('0x46')],{});db[_0x5cb6('0x4f')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':'List','foreignKey':_0x5cb6('0x179')});db['FaxQueueReport'][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':'ContactId'});db[_0x5cb6('0x4f')]['belongsTo'](db[_0x5cb6('0x4a')],{});db['FaxQueueReport'][_0x5cb6('0x122')](db[_0x5cb6('0x4c')],{});db[_0x5cb6('0x4f')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{});db['FaxQueueReport'][_0x5cb6('0x122')](db['FaxQueue'],{});db['SmsAccount'][_0x5cb6('0x114')](db['Disposition'],{'as':_0x5cb6('0x165'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x5cb6('0x51')][_0x5cb6('0x114')](db['CannedAnswer'],{'as':_0x5cb6('0x166'),'foreignKey':_0x5cb6('0x187')});db[_0x5cb6('0x51')][_0x5cb6('0x114')](db[_0x5cb6('0x188')],{'as':_0x5cb6('0x167'),'foreignKey':_0x5cb6('0x187')});db[_0x5cb6('0x51')]['hasMany'](db[_0x5cb6('0x12e')],{'as':_0x5cb6('0x17d')});db[_0x5cb6('0x51')]['hasMany'](db['SmsApplication'],{'as':_0x5cb6('0x147')});db[_0x5cb6('0x51')]['belongsTo'](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x51')][_0x5cb6('0x122')](db[_0x5cb6('0x7c')],{'as':_0x5cb6('0x152'),'foreignKey':_0x5cb6('0x153')});db['SmsAccount'][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x189')});db[_0x5cb6('0x52')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':'restrict'});db[_0x5cb6('0x52')][_0x5cb6('0x122')](db['SmsQueue'],{'onDelete':_0x5cb6('0x161')});db['SmsApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x51')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x52')][_0x5cb6('0x122')](db['Interval'],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x151')});db[_0x5cb6('0x52')][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x176')});db[_0x5cb6('0x12e')]['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x18a')});db[_0x5cb6('0x12e')]['belongsTo'](db[_0x5cb6('0x51')],{'as':_0x5cb6('0x16b'),'foreignKey':'SmsAccountId'});db[_0x5cb6('0x12e')][_0x5cb6('0x122')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x5cb6('0x12e')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x16c'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x12e')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x18b'),'as':_0x5cb6('0x16d')});db[_0x5cb6('0x12e')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x18b'),'as':'ThroughTags'});db[_0x5cb6('0x12e')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x170'),'through':'user_has_sms_interactions','foreignKey':_0x5cb6('0x18a')});db[_0x5cb6('0x188')]['belongsTo'](db[_0x5cb6('0x12')],{'as':'User'});db[_0x5cb6('0x188')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x15f')});db['SmsMessage'][_0x5cb6('0x122')](db['SmsInteraction'],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x173'),'foreignKey':_0x5cb6('0x18a')});db[_0x5cb6('0x188')][_0x5cb6('0x122')](db[_0x5cb6('0x51')],{'as':_0x5cb6('0x16b'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x36'),'foreignKey':_0x5cb6('0x18c')});db[_0x5cb6('0x135')][_0x5cb6('0x123')](db[_0x5cb6('0xe3')],{'through':_0x5cb6('0x18d'),'as':_0x5cb6('0x156')});db[_0x5cb6('0x18e')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':'Dispositions','foreignKey':_0x5cb6('0x18f'),'onDelete':_0x5cb6('0x111')});db['OpenchannelAccount']['hasMany'](db[_0x5cb6('0x76')],{'as':_0x5cb6('0x166'),'foreignKey':_0x5cb6('0x18f')});db[_0x5cb6('0x18e')][_0x5cb6('0x114')](db[_0x5cb6('0x59')],{'as':_0x5cb6('0x17d'),'foreignKey':_0x5cb6('0x18f')});db[_0x5cb6('0x18e')][_0x5cb6('0x114')](db[_0x5cb6('0x5a')],{'as':_0x5cb6('0x167'),'foreignKey':_0x5cb6('0x18f')});db[_0x5cb6('0x18e')][_0x5cb6('0x114')](db['OpenchannelApplication'],{'as':_0x5cb6('0x147'),'foreignKey':_0x5cb6('0x18f')});db[_0x5cb6('0x18e')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x18e')]['belongsTo'](db[_0x5cb6('0x7c')],{'as':_0x5cb6('0x152'),'foreignKey':_0x5cb6('0x153')});db[_0x5cb6('0x18e')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':'user_has_openchannel_accounts'});db[_0x5cb6('0x57')]['belongsTo'](db[_0x5cb6('0x12')],{'onDelete':'restrict'});db[_0x5cb6('0x57')]['belongsTo'](db[_0x5cb6('0x5b')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x190')});db[_0x5cb6('0x57')][_0x5cb6('0x122')](db['OpenchannelAccount'],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x18f')});db['OpenchannelApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x7a')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x151')});db['OpenchannelApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x176')});db[_0x5cb6('0x59')][_0x5cb6('0x114')](db[_0x5cb6('0x5a')],{'as':_0x5cb6('0x167'),'onDelete':'cascade','foreignKey':_0x5cb6('0x191')});db[_0x5cb6('0x59')]['belongsTo'](db[_0x5cb6('0x18e')],{'as':_0x5cb6('0x16b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x59')][_0x5cb6('0x122')](db['User'],{'as':'Owner','foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x59')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x192'),'as':_0x5cb6('0x16d')});db[_0x5cb6('0x59')]['belongsToMany'](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x192'),'as':_0x5cb6('0x16f')});db[_0x5cb6('0x59')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':'Users','through':_0x5cb6('0x131'),'foreignKey':_0x5cb6('0x191')});db[_0x5cb6('0x5a')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':'cascade','as':_0x5cb6('0x12')});db[_0x5cb6('0x5a')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'onDelete':_0x5cb6('0x111'),'as':'Contact'});db['OpenchannelMessage'][_0x5cb6('0x122')](db[_0x5cb6('0x59')],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x173'),'foreignKey':_0x5cb6('0x191')});db[_0x5cb6('0x5a')]['belongsTo'](db[_0x5cb6('0xea')],{'as':_0x5cb6('0xea'),'foreignKey':_0x5cb6('0x185')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelAccount'],{'as':_0x5cb6('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x5cb6('0x5b')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':'UserOpenchannelQueue','foreignKey':_0x5cb6('0x190')});db[_0x5cb6('0x5b')][_0x5cb6('0x123')](db['Team'],{'through':_0x5cb6('0x193'),'as':_0x5cb6('0x156')});db[_0x5cb6('0x5d')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':_0x5cb6('0x165'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x5cb6('0x5d')]['hasMany'](db[_0x5cb6('0x76')],{'as':'Answers','foreignKey':_0x5cb6('0x174')});db['ChatWebsite'][_0x5cb6('0x114')](db[_0x5cb6('0x66')],{'as':_0x5cb6('0x194')});db[_0x5cb6('0x5d')][_0x5cb6('0x114')](db['ChatInteraction'],{'as':_0x5cb6('0x17d')});db[_0x5cb6('0x5d')][_0x5cb6('0x114')](db['ChatApplication'],{'as':_0x5cb6('0x147')});db[_0x5cb6('0x5d')][_0x5cb6('0x114')](db[_0x5cb6('0x63')],{'as':'Messages'});db['ChatWebsite'][_0x5cb6('0x122')](db['CmList'],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db['ChatWebsite'][_0x5cb6('0x122')](db[_0x5cb6('0x7a')],{'as':'Interval','foreignKey':_0x5cb6('0x151')});db['ChatWebsite'][_0x5cb6('0x122')](db[_0x5cb6('0x3a')],{'as':_0x5cb6('0x3a'),'foreignKey':_0x5cb6('0x163')});db[_0x5cb6('0x5d')]['belongsTo'](db['Pause'],{'as':_0x5cb6('0x152'),'foreignKey':_0x5cb6('0x153')});db[_0x5cb6('0x5d')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x13b')});db[_0x5cb6('0x195')][_0x5cb6('0x122')](db[_0x5cb6('0x18e')],{});db['OpenchannelQueueReport'][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x195')][_0x5cb6('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x195')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x5cb6('0x195')][_0x5cb6('0x122')](db['OpenchannelMessage'],{});db[_0x5cb6('0x195')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{});db[_0x5cb6('0x195')]['belongsTo'](db[_0x5cb6('0x5b')],{});db[_0x5cb6('0x60')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x5cb6('0x161')});db['ChatApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x65')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'as':_0x5cb6('0x196'),'foreignKey':'ChatWebsiteId','onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x60')][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':_0x5cb6('0x161'),'foreignKey':'TagId'});db[_0x5cb6('0x61')][_0x5cb6('0x114')](db['ChatMessage'],{'as':_0x5cb6('0x167'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x197')});db[_0x5cb6('0x61')]['belongsTo'](db['ChatWebsite'],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x174')});db[_0x5cb6('0x61')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181')});db['ChatInteraction'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':'Owner','foreignKey':_0x5cb6('0x112')});db['ChatInteraction'][_0x5cb6('0x123')](db['Tag'],{'through':_0x5cb6('0x198'),'as':_0x5cb6('0x16d')});db[_0x5cb6('0x61')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x198'),'as':_0x5cb6('0x16f')});db[_0x5cb6('0x61')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x170'),'through':_0x5cb6('0x12d'),'foreignKey':_0x5cb6('0x197')});db['ChatMessage'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':'cascade','as':_0x5cb6('0x12')});db['ChatMessage'][_0x5cb6('0x122')](db['CmContact'],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x15f'),'foreignKey':'ContactId'});db['ChatMessage'][_0x5cb6('0x122')](db['ChatInteraction'],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x173'),'foreignKey':_0x5cb6('0x197')});db[_0x5cb6('0x63')]['belongsTo'](db[_0x5cb6('0xea')],{'as':_0x5cb6('0xea'),'foreignKey':_0x5cb6('0x185')});db['ChatMessage'][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x174')});db[_0x5cb6('0x64')][_0x5cb6('0x114')](db[_0x5cb6('0xea')],{'as':'Attachments','foreignKey':_0x5cb6('0x175'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x5cb6('0x111'),'as':'Contact','foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x64')][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x174')});db[_0x5cb6('0x65')]['belongsToMany'](db[_0x5cb6('0x12')],{'as':'Agents','through':_0x5cb6('0x30'),'hooks':!![]});db[_0x5cb6('0x65')][_0x5cb6('0x123')](db[_0x5cb6('0xe3')],{'through':_0x5cb6('0x199'),'as':_0x5cb6('0x156')});db[_0x5cb6('0x124')]['hasMany'](db[_0x5cb6('0xcb')],{'as':_0x5cb6('0x167'),'foreignKey':_0x5cb6('0x19a'),'onDelete':'cascade'});db[_0x5cb6('0x124')]['belongsToMany'](db['User'],{'as':'Members','through':_0x5cb6('0x125')});db['ChatProactiveAction'][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'as':_0x5cb6('0x196'),'foreignKey':'ChatWebsiteId'});db[_0x5cb6('0x68')][_0x5cb6('0x114')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x126'),'foreignKey':_0x5cb6('0x19b')});db[_0x5cb6('0x6a')]['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x5cb6('0x19c')});db['CmContact'][_0x5cb6('0x114')](db[_0x5cb6('0x6c')],{'as':_0x5cb6('0x14b'),'foreignKey':'ContactId'});db['CmContact'][_0x5cb6('0x114')](db[_0x5cb6('0x6f')],{'as':_0x5cb6('0x118'),'foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x6a')][_0x5cb6('0x114')](db['CmHopperHistory'],{'as':_0x5cb6('0x14c'),'foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0x6a')][_0x5cb6('0x114')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x5cb6('0x181')});db['CmContact'][_0x5cb6('0x114')](db[_0x5cb6('0xd1')],{'as':'JscriptySessions','foreignKey':_0x5cb6('0x181')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x5cb6('0x181'),'onDelete':'restrict'});db['CmContact'][_0x5cb6('0x114')](db[_0x5cb6('0x61')],{'as':_0x5cb6('0x11d'),'foreignKey':_0x5cb6('0x181'),'onDelete':'restrict'});db[_0x5cb6('0x6a')][_0x5cb6('0x114')](db['SmsInteraction'],{'as':_0x5cb6('0x12f'),'foreignKey':_0x5cb6('0x181'),'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x6a')][_0x5cb6('0x114')](db[_0x5cb6('0x4a')],{'as':'FaxInteractions','foreignKey':_0x5cb6('0x181'),'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x6a')][_0x5cb6('0x114')](db[_0x5cb6('0x40')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x6a')][_0x5cb6('0x122')](db[_0x5cb6('0x68')],{'as':_0x5cb6('0x19d'),'foreignKey':_0x5cb6('0x19b')});db[_0x5cb6('0x6a')]['belongsTo'](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179'),'onDelete':_0x5cb6('0x111')});db['CmContact'][_0x5cb6('0x123')](db['User'],{'as':_0x5cb6('0x170'),'through':_0x5cb6('0x127')});db[_0x5cb6('0x6a')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'as':_0x5cb6('0x16d'),'through':_0x5cb6('0x19e')});db[_0x5cb6('0x6a')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':'cm_contact_has_tags','as':_0x5cb6('0x16f')});db[_0x5cb6('0x6c')][_0x5cb6('0x114')](db[_0x5cb6('0x19f')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db['CmHopper'][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x6c')]['belongsTo'](db[_0x5cb6('0x128')],{'as':'List','foreignKey':'ListId','onDelete':_0x5cb6('0x111')});db['CmHopper'][_0x5cb6('0x122')](db['User'],{'as':'Agent','foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x6c')][_0x5cb6('0x122')](db[_0x5cb6('0x19')],{'as':_0x5cb6('0x1a0'),'foreignKey':_0x5cb6('0x14a'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x6c')]['belongsTo'](db[_0x5cb6('0xe7')],{'as':_0x5cb6('0xe7'),'foreignKey':_0x5cb6('0x1a1'),'onDelete':_0x5cb6('0x111')});db['CmHopper']['belongsTo'](db[_0x5cb6('0x12')],{'as':'Owner','foreignKey':_0x5cb6('0x1a2')});db[_0x5cb6('0x6d')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':'ContactId','onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x6d')][_0x5cb6('0x122')](db['CmList'],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179'),'onDelete':'cascade'});db[_0x5cb6('0x6d')]['belongsTo'](db[_0x5cb6('0x19')],{'as':_0x5cb6('0x1a0'),'foreignKey':_0x5cb6('0x14a'),'onDelete':_0x5cb6('0x111')});db['CmHopperBlack'][_0x5cb6('0x122')](db[_0x5cb6('0xe7')],{'as':_0x5cb6('0xe7'),'foreignKey':'CampaignId','onDelete':_0x5cb6('0x111')});db['Automation'][_0x5cb6('0x114')](db[_0x5cb6('0x78')],{'as':{'plural':_0x5cb6('0x1a3'),'singular':_0x5cb6('0x1a4')},'foreignKey':'AutomationAllId','onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x74')][_0x5cb6('0x114')](db['Condition'],{'as':{'plural':_0x5cb6('0x1a5'),'singular':_0x5cb6('0x1a6')},'foreignKey':_0x5cb6('0x1a7'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x74')]['hasMany'](db[_0x5cb6('0x72')],{'as':_0x5cb6('0x1a8'),'foreignKey':_0x5cb6('0x1a9'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x77')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':'Dispositions','foreignKey':_0x5cb6('0x1aa'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x7a')][_0x5cb6('0x114')](db[_0x5cb6('0x7a')],{'as':_0x5cb6('0x1ab'),'foreignKey':_0x5cb6('0x151'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x5cb6('0x114')](db[_0x5cb6('0x116')],{'as':'Extensions','foreignKey':_0x5cb6('0x151'),'onDelete':_0x5cb6('0x161')});db['Interval']['hasMany'](db[_0x5cb6('0x168')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x5cb6('0x7a')][_0x5cb6('0x114')](db['ChatApplication'],{'as':_0x5cb6('0x1ac'),'foreignKey':_0x5cb6('0x151')});db[_0x5cb6('0x7a')]['hasMany'](db[_0x5cb6('0x48')],{'as':_0x5cb6('0x1ad'),'foreignKey':'IntervalId'});db[_0x5cb6('0x7a')][_0x5cb6('0x114')](db[_0x5cb6('0x52')],{'as':_0x5cb6('0x1ae'),'foreignKey':_0x5cb6('0x151')});db[_0x5cb6('0x1af')][_0x5cb6('0x122')](db[_0x5cb6('0x3a')],{});db['Schedule'][_0x5cb6('0x122')](db['AnalyticDefaultReport'],{'foreignKey':_0x5cb6('0x1b0')});db['Schedule'][_0x5cb6('0x122')](db[_0x5cb6('0x92')],{'foreignKey':_0x5cb6('0x1b1')});db[_0x5cb6('0x81')][_0x5cb6('0x123')](db[_0x5cb6('0x18')],{'as':_0x5cb6('0x1b2'),'through':_0x5cb6('0x1b3'),'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x83')]['belongsToMany'](db[_0x5cb6('0x6a')],{'through':_0x5cb6('0x19e')});db['Tag'][_0x5cb6('0x123')](db[_0x5cb6('0x61')],{'through':_0x5cb6('0x198')});db[_0x5cb6('0x83')][_0x5cb6('0x123')](db[_0x5cb6('0x40')],{'through':_0x5cb6('0x16e')});db[_0x5cb6('0x83')][_0x5cb6('0x123')](db['SmsInteraction'],{'through':_0x5cb6('0x18b')});db['Tag'][_0x5cb6('0x123')](db[_0x5cb6('0x4a')],{'through':_0x5cb6('0x182')});db[_0x5cb6('0x83')][_0x5cb6('0x123')](db[_0x5cb6('0x59')],{'through':_0x5cb6('0x192')});db[_0x5cb6('0x83')][_0x5cb6('0x123')](db[_0x5cb6('0x11f')],{'through':_0x5cb6('0x1b4')});db[_0x5cb6('0x87')][_0x5cb6('0x122')](db[_0x5cb6('0x85')],{'as':_0x5cb6('0x1b5'),'foreignKey':_0x5cb6('0x1b6')});db[_0x5cb6('0x19f')][_0x5cb6('0x122')](db[_0x5cb6('0x6c')],{'as':_0x5cb6('0x1b7'),'foreignKey':_0x5cb6('0x1b8')});db['CmContactHasItem']['belongsTo'](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x19c')});db['Trigger']['hasMany'](db[_0x5cb6('0x78')],{'as':{'plural':'AllConditions','singular':_0x5cb6('0x1b9')},'foreignKey':_0x5cb6('0x1ba'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x8c')][_0x5cb6('0x114')](db['Condition'],{'as':{'plural':_0x5cb6('0x1bb'),'singular':_0x5cb6('0x1bc')},'foreignKey':_0x5cb6('0x1bd'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x8c')][_0x5cb6('0x114')](db[_0x5cb6('0x72')],{'as':_0x5cb6('0x1a8'),'foreignKey':_0x5cb6('0x1be'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db['AnalyticCustomReport'][_0x5cb6('0x114')](db[_0x5cb6('0x98')],{'as':_0x5cb6('0x1bf'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1b1'),'hooks':!![]});db[_0x5cb6('0x94')][_0x5cb6('0x114')](db[_0x5cb6('0x98')],{'as':'Fields','onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1b0')});db['AnalyticMetric'][_0x5cb6('0x114')](db[_0x5cb6('0x98')],{'as':_0x5cb6('0x1bf'),'onDelete':'cascade','foreignKey':_0x5cb6('0x1c0')});db[_0x5cb6('0x98')][_0x5cb6('0x122')](db[_0x5cb6('0x1c1')],{'foreignKey':_0x5cb6('0x1c0')});db['SalesforceAccount'][_0x5cb6('0x114')](db[_0x5cb6('0x9d')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':'AccountId'});db[_0x5cb6('0x9d')][_0x5cb6('0x114')](db[_0x5cb6('0x9f')],{'as':_0x5cb6('0x1c3'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0x9d')][_0x5cb6('0x114')](db[_0x5cb6('0x9f')],{'as':'Descriptions','onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0x5cb6('0x1bf'),'onDelete':_0x5cb6('0x111'),'foreignKey':'FieldId'});db[_0x5cb6('0x9d')][_0x5cb6('0x122')](db['SalesforceAccount'],{'as':_0x5cb6('0x16b'),'foreignKey':'AccountId'});db['SalesforceField'][_0x5cb6('0x114')](db['SalesforceField'],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x5cb6('0x1c7'),'foreignKey':'DescriptionId'});db[_0x5cb6('0x9f')][_0x5cb6('0x114')](db[_0x5cb6('0x9f')],{'as':_0x5cb6('0x1c8'),'foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0x9f')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':_0x5cb6('0x1ca'),'foreignKey':_0x5cb6('0x1cb')});db['SugarcrmAccount'][_0x5cb6('0x114')](db[_0x5cb6('0xa3')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xa3')][_0x5cb6('0x114')](db[_0x5cb6('0x1cd')],{'as':_0x5cb6('0x1c3'),'onDelete':'cascade','foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xa3')][_0x5cb6('0x114')](db[_0x5cb6('0x1cd')],{'as':_0x5cb6('0x1ce'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0xa3')][_0x5cb6('0x114')](db['SugarcrmField'],{'as':_0x5cb6('0x1bf'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xa3')][_0x5cb6('0x122')](db[_0x5cb6('0xa1')],{'as':'Account','foreignKey':'AccountId'});db[_0x5cb6('0x1cd')]['hasMany'](db[_0x5cb6('0x1cd')],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0x1cd')][_0x5cb6('0x114')](db[_0x5cb6('0x1cd')],{'as':_0x5cb6('0x1c7'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x5cb6('0x1cd')],{'as':_0x5cb6('0x1c8'),'foreignKey':_0x5cb6('0x1c9')});db['SugarcrmField'][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':_0x5cb6('0x1ca'),'foreignKey':'VariableId'});db[_0x5cb6('0xa6')][_0x5cb6('0x114')](db[_0x5cb6('0xa8')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db['DeskConfiguration']['hasMany'](db[_0x5cb6('0x1cf')],{'as':_0x5cb6('0x1c3'),'onDelete':'cascade','foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xa8')][_0x5cb6('0x114')](db['DeskField'],{'as':_0x5cb6('0x1ce'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c5')});db['DeskConfiguration'][_0x5cb6('0x114')](db['DeskField'],{'as':_0x5cb6('0x1bf'),'onDelete':'cascade','foreignKey':_0x5cb6('0x1c9')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xa8')]['belongsToMany'](db[_0x5cb6('0x83')],{'through':'int_desk_configuration_has_tags'});db[_0x5cb6('0x1cf')]['hasMany'](db[_0x5cb6('0x1cf')],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0x1cf')][_0x5cb6('0x114')](db[_0x5cb6('0x1cf')],{'as':_0x5cb6('0x1c7'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0x1cf')][_0x5cb6('0x114')](db['DeskField'],{'as':_0x5cb6('0x1c8'),'foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0x1cf')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':'Variable','foreignKey':_0x5cb6('0x1cb')});db['ZohoAccount'][_0x5cb6('0x114')](db[_0x5cb6('0xaa')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xaa')][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':_0x5cb6('0x1c3'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xaa')][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':_0x5cb6('0x1ce'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0xaa')][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x5cb6('0xaa')][_0x5cb6('0x122')](db[_0x5cb6('0x1d0')],{'as':_0x5cb6('0x16b'),'foreignKey':'AccountId'});db[_0x5cb6('0xac')][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':'Subject','foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xac')][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':'Description','foreignKey':_0x5cb6('0x1c5')});db['ZohoField'][_0x5cb6('0x114')](db[_0x5cb6('0xac')],{'as':_0x5cb6('0x1c8'),'foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xac')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':'Variable','foreignKey':'VariableId'});db[_0x5cb6('0xae')][_0x5cb6('0x114')](db['ZendeskConfiguration'],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xb0')][_0x5cb6('0x114')](db[_0x5cb6('0xb2')],{'as':_0x5cb6('0x1c3'),'foreignKey':_0x5cb6('0x1c4')});db['ZendeskConfiguration'][_0x5cb6('0x114')](db[_0x5cb6('0xb2')],{'as':_0x5cb6('0x1ce'),'foreignKey':'DescriptionId'});db[_0x5cb6('0xb0')]['hasMany'](db[_0x5cb6('0xb2')],{'as':'Fields','foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xb0')][_0x5cb6('0x122')](db[_0x5cb6('0xae')],{'as':'Account','foreignKey':_0x5cb6('0x1cc')});db['ZendeskConfiguration']['belongsToMany'](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x1d1')});db[_0x5cb6('0xb2')][_0x5cb6('0x114')](db[_0x5cb6('0xb2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5cb6('0xb2')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0xb2')][_0x5cb6('0x114')](db[_0x5cb6('0xb2')],{'as':_0x5cb6('0x1c8'),'foreignKey':_0x5cb6('0x1c9')});db['ZendeskField'][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':'Variable','foreignKey':_0x5cb6('0x1cb')});db[_0x5cb6('0xb3')][_0x5cb6('0x114')](db['FreshdeskConfiguration'],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db['FreshdeskConfiguration']['hasMany'](db[_0x5cb6('0x1d2')],{'as':'Subjects','onDelete':_0x5cb6('0x111'),'foreignKey':'SubjectId'});db[_0x5cb6('0xb5')][_0x5cb6('0x114')](db[_0x5cb6('0x1d2')],{'as':_0x5cb6('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x5cb6('0x114')](db[_0x5cb6('0x1d2')],{'as':_0x5cb6('0x1bf'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1c9')});db['FreshdeskConfiguration'][_0x5cb6('0x122')](db[_0x5cb6('0xb3')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xb5')][_0x5cb6('0x123')](db['Tag'],{'through':_0x5cb6('0x1d3')});db[_0x5cb6('0x1d2')][_0x5cb6('0x114')](db[_0x5cb6('0x1d2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5cb6('0x1d2')]['hasMany'](db[_0x5cb6('0x1d2')],{'as':_0x5cb6('0x1c7'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0x1d2')][_0x5cb6('0x114')](db[_0x5cb6('0x1d2')],{'as':_0x5cb6('0x1c8'),'foreignKey':'FieldId'});db[_0x5cb6('0x1d2')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':_0x5cb6('0x1ca'),'foreignKey':_0x5cb6('0x1cb')});db[_0x5cb6('0xb7')][_0x5cb6('0x114')](db['VtigerConfiguration'],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0x1d4')][_0x5cb6('0x114')](db[_0x5cb6('0xb9')],{'as':_0x5cb6('0x1c3'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0x1d4')][_0x5cb6('0x114')](db['VtigerField'],{'as':_0x5cb6('0x1ce'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0x1d4')][_0x5cb6('0x114')](db[_0x5cb6('0xb9')],{'as':_0x5cb6('0x1bf'),'foreignKey':'FieldId'});db[_0x5cb6('0x1d4')][_0x5cb6('0x122')](db[_0x5cb6('0xb7')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xb9')][_0x5cb6('0x114')](db[_0x5cb6('0xb9')],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xb9')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5cb6('0xb9')][_0x5cb6('0x114')](db['VtigerField'],{'as':'Field','foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xb9')][_0x5cb6('0x122')](db['Variable'],{'as':_0x5cb6('0x1ca'),'foreignKey':_0x5cb6('0x1cb')});db[_0x5cb6('0xbb')]['hasMany'](db[_0x5cb6('0x1d5')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0x1d5')][_0x5cb6('0x114')](db[_0x5cb6('0xbc')],{'as':_0x5cb6('0x1c3'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0x1d5')][_0x5cb6('0x114')](db['ServicenowField'],{'as':_0x5cb6('0x1ce'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0x1d5')][_0x5cb6('0x114')](db[_0x5cb6('0xbc')],{'as':_0x5cb6('0x1bf'),'foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0x1d5')][_0x5cb6('0x122')](db[_0x5cb6('0xbb')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xbc')][_0x5cb6('0x114')](db[_0x5cb6('0xbc')],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xbc')][_0x5cb6('0x114')](db[_0x5cb6('0xbc')],{'as':_0x5cb6('0x1c7'),'foreignKey':'DescriptionId'});db[_0x5cb6('0xbc')][_0x5cb6('0x114')](db[_0x5cb6('0xbc')],{'as':'Field','foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xbc')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':_0x5cb6('0x1ca'),'foreignKey':_0x5cb6('0x1cb')});db[_0x5cb6('0xbd')]['hasMany'](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x5cb6('0x111'),'foreignKey':'AccountId'});db[_0x5cb6('0xbd')]['belongsTo'](db[_0x5cb6('0x107')],{'as':_0x5cb6('0x107'),'foreignKey':'CloudProviderId'});db[_0x5cb6('0xbf')]['hasMany'](db[_0x5cb6('0xc1')],{'as':_0x5cb6('0x1c3'),'onDelete':_0x5cb6('0x111'),'foreignKey':'SubjectId'});db[_0x5cb6('0xbf')][_0x5cb6('0x114')](db[_0x5cb6('0xc1')],{'as':_0x5cb6('0x1ce'),'onDelete':_0x5cb6('0x111'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x5cb6('0xc1')],{'as':_0x5cb6('0x1bf'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x5cb6('0xbf')][_0x5cb6('0x122')](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x5cb6('0xc1')][_0x5cb6('0x114')](db[_0x5cb6('0xc1')],{'as':'Subject','foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xc1')][_0x5cb6('0x114')](db[_0x5cb6('0xc1')],{'as':_0x5cb6('0x1c7'),'foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0xc1')]['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x5cb6('0x1c9')});db[_0x5cb6('0xc1')][_0x5cb6('0x122')](db[_0x5cb6('0x1ca')],{'as':'Variable','foreignKey':_0x5cb6('0x1cb')});db['FreshsalesAccount'][_0x5cb6('0x114')](db[_0x5cb6('0xc5')],{'as':_0x5cb6('0x1c2'),'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1cc')});db['FreshsalesConfiguration'][_0x5cb6('0x114')](db['FreshsalesField'],{'as':_0x5cb6('0x1c3'),'foreignKey':_0x5cb6('0x1c4')});db[_0x5cb6('0xc5')][_0x5cb6('0x114')](db[_0x5cb6('0xc7')],{'as':'Descriptions','foreignKey':_0x5cb6('0x1c5')});db[_0x5cb6('0xc5')][_0x5cb6('0x114')](db['FreshsalesField'],{'as':_0x5cb6('0x1bf'),'foreignKey':'FieldId'});db[_0x5cb6('0xc5')]['belongsTo'](db[_0x5cb6('0xc3')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1cc')});db[_0x5cb6('0xc7')]['hasMany'](db[_0x5cb6('0xc7')],{'as':_0x5cb6('0x1c6'),'foreignKey':_0x5cb6('0x1c4')});db['FreshsalesField']['hasMany'](db[_0x5cb6('0xc7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5cb6('0xc7')]['hasMany'](db[_0x5cb6('0xc7')],{'as':_0x5cb6('0x1c8'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0x5cb6('0x1ca')],{'as':_0x5cb6('0x1ca'),'foreignKey':'VariableId'});db[_0x5cb6('0xca')][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{});db[_0x5cb6('0xca')]['belongsTo'](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0xca')][_0x5cb6('0x122')](db['CmContact'],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181')});db[_0x5cb6('0xca')]['belongsTo'](db['ChatInteraction'],{});db[_0x5cb6('0xca')][_0x5cb6('0x122')](db['ChatMessage'],{});db[_0x5cb6('0xca')][_0x5cb6('0x122')](db['User'],{});db[_0x5cb6('0xca')][_0x5cb6('0x122')](db[_0x5cb6('0x65')],{});db[_0x5cb6('0xcb')][_0x5cb6('0x122')](db['User'],{'onDelete':'cascade','foreignKey':_0x5cb6('0x1d6')});db[_0x5cb6('0xcb')]['belongsTo'](db[_0x5cb6('0x12')],{'onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x1d7')});db[_0x5cb6('0xd1')]['hasMany'](db[_0x5cb6('0xcf')],{'foreignKey':_0x5cb6('0x1d8'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0xd1')][_0x5cb6('0x114')](db[_0x5cb6('0xcd')],{'foreignKey':_0x5cb6('0x1d8'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0xd3')][_0x5cb6('0x122')](db['SmsAccount'],{});db[_0x5cb6('0xd3')][_0x5cb6('0x122')](db['CmList'],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0xd3')][_0x5cb6('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0x5cb6('0x181')});db['SmsQueueReport']['belongsTo'](db['SmsInteraction'],{});db[_0x5cb6('0xd3')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x5cb6('0x122')](db['User'],{});db[_0x5cb6('0xd3')][_0x5cb6('0x122')](db[_0x5cb6('0x135')],{});db[_0x5cb6('0xd8')]['hasMany'](db[_0x5cb6('0xd1')],{'foreignKey':_0x5cb6('0x1d9')});db[_0x5cb6('0xd8')][_0x5cb6('0x114')](db[_0x5cb6('0xcf')],{'foreignKey':_0x5cb6('0x1d9')});db[_0x5cb6('0xd8')][_0x5cb6('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0x5cb6('0x1d9')});db[_0x5cb6('0xde')]['belongsToMany'](db['User'],{'as':_0x5cb6('0x170'),'through':_0x5cb6('0x144')});db['Team'][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x12b')});db['Team'][_0x5cb6('0x123')](db[_0x5cb6('0x19')],{'through':_0x5cb6('0x109'),'as':_0x5cb6('0x133')});db[_0x5cb6('0xe3')][_0x5cb6('0x123')](db['MailQueue'],{'through':_0x5cb6('0x16a'),'as':'MailQueues'});db[_0x5cb6('0xe3')][_0x5cb6('0x123')](db[_0x5cb6('0x65')],{'through':_0x5cb6('0x199'),'as':_0x5cb6('0x1da')});db[_0x5cb6('0xe3')][_0x5cb6('0x123')](db['FaxQueue'],{'through':_0x5cb6('0x186'),'as':'FaxQueues'});db[_0x5cb6('0xe3')]['belongsToMany'](db[_0x5cb6('0x135')],{'through':'team_has_sms_queues','as':_0x5cb6('0x136')});db[_0x5cb6('0xe3')][_0x5cb6('0x123')](db[_0x5cb6('0x5b')],{'through':_0x5cb6('0x193'),'as':_0x5cb6('0x137')});db['Team']['belongsToMany'](db[_0x5cb6('0x106')],{'through':_0x5cb6('0x1db'),'as':_0x5cb6('0x139')});db[_0x5cb6('0xe3')][_0x5cb6('0x123')](db[_0x5cb6('0x1dc')],{'through':_0x5cb6('0x10a'),'as':'VoicePrefixes'});db[_0x5cb6('0xe7')]['hasMany'](db[_0x5cb6('0x6c')],{'as':'Hoppers','foreignKey':_0x5cb6('0x1a1')});db[_0x5cb6('0xe7')]['hasMany'](db[_0x5cb6('0x6f')],{'as':_0x5cb6('0x118'),'foreignKey':_0x5cb6('0x1a1')});db[_0x5cb6('0xe7')][_0x5cb6('0x114')](db[_0x5cb6('0x119')],{'as':_0x5cb6('0x14c'),'foreignKey':_0x5cb6('0x1a1')});db[_0x5cb6('0xe7')][_0x5cb6('0x114')](db[_0x5cb6('0x6d')],{'as':_0x5cb6('0x14d'),'foreignKey':'CampaignId'});db['Campaign'][_0x5cb6('0x122')](db['Trunk'],{'as':_0x5cb6('0x29'),'foreignKey':_0x5cb6('0x1dd')});db['Campaign'][_0x5cb6('0x122')](db[_0x5cb6('0x29')],{'as':_0x5cb6('0x14f'),'foreignKey':_0x5cb6('0x150')});db['Campaign'][_0x5cb6('0x122')](db[_0x5cb6('0x7a')],{'as':_0x5cb6('0x7a'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x5cb6('0x1de')});db['Campaign'][_0x5cb6('0x123')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x129'),'through':'campaigns_has_cm_lists'});db[_0x5cb6('0xe7')][_0x5cb6('0x123')](db[_0x5cb6('0x128')],{'as':_0x5cb6('0x157'),'through':_0x5cb6('0x1df')});db[_0x5cb6('0xea')][_0x5cb6('0x122')](db[_0x5cb6('0x64')],{'as':_0x5cb6('0x64'),'foreignKey':_0x5cb6('0x175')});db[_0x5cb6('0xec')][_0x5cb6('0x122')](db[_0x5cb6('0x41')],{});db[_0x5cb6('0xec')]['belongsTo'](db[_0x5cb6('0x40')],{});db[_0x5cb6('0xec')][_0x5cb6('0x122')](db[_0x5cb6('0x3a')],{'foreignKey':_0x5cb6('0x1e0'),'as':_0x5cb6('0x1e1')});db[_0x5cb6('0xec')][_0x5cb6('0x122')](db['User'],{'foreignKey':'FromUserId','as':_0x5cb6('0x1e2')});db[_0x5cb6('0xec')]['belongsTo'](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1e3'),'as':_0x5cb6('0x1e4')});db[_0x5cb6('0xec')]['belongsTo'](db[_0x5cb6('0x3c')],{'foreignKey':_0x5cb6('0x1e5'),'as':_0x5cb6('0x1e6')});db[_0x5cb6('0xec')]['belongsTo'](db[_0x5cb6('0x3a')],{'foreignKey':_0x5cb6('0x1e7'),'as':_0x5cb6('0x1e8')});db[_0x5cb6('0x1e9')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x61')],{});db[_0x5cb6('0x1e9')][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'foreignKey':_0x5cb6('0x1ea'),'as':_0x5cb6('0x1e1')});db[_0x5cb6('0x1e9')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1eb'),'as':_0x5cb6('0x1e2')});db[_0x5cb6('0x1e9')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':'ToUserId','as':_0x5cb6('0x1e4')});db['ChatTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x65')],{'foreignKey':_0x5cb6('0x1ec'),'as':_0x5cb6('0x1e6')});db[_0x5cb6('0x1e9')][_0x5cb6('0x122')](db[_0x5cb6('0x5d')],{'foreignKey':_0x5cb6('0x1ed'),'as':_0x5cb6('0x1e8')});db[_0x5cb6('0xef')]['belongsTo'](db[_0x5cb6('0x4c')],{});db[_0x5cb6('0xef')][_0x5cb6('0x122')](db[_0x5cb6('0x4a')],{});db['FaxTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x46')],{'foreignKey':_0x5cb6('0x1ee'),'as':_0x5cb6('0x1e1')});db['FaxTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1eb'),'as':_0x5cb6('0x1e2')});db[_0x5cb6('0xef')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1e3'),'as':_0x5cb6('0x1e4')});db[_0x5cb6('0xef')]['belongsTo'](db[_0x5cb6('0x180')],{'foreignKey':'ToFaxQueueId','as':_0x5cb6('0x1e6')});db[_0x5cb6('0xef')][_0x5cb6('0x122')](db['FaxAccount'],{'foreignKey':_0x5cb6('0x1ef'),'as':_0x5cb6('0x1e8')});db[_0x5cb6('0xf0')][_0x5cb6('0x122')](db[_0x5cb6('0x5a')],{});db['OpenchannelTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x59')],{});db[_0x5cb6('0xf0')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x5cb6('0x1e1')});db[_0x5cb6('0xf0')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':'FromUserId','as':_0x5cb6('0x1e2')});db[_0x5cb6('0xf0')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x5cb6('0x1e4')});db[_0x5cb6('0xf0')][_0x5cb6('0x122')](db['OpenchannelQueue'],{'foreignKey':_0x5cb6('0x1f0'),'as':'ToQueue'});db[_0x5cb6('0xf0')]['belongsTo'](db[_0x5cb6('0x18e')],{'foreignKey':_0x5cb6('0x1f1'),'as':'ToAccount'});db[_0x5cb6('0xf2')][_0x5cb6('0x122')](db[_0x5cb6('0x188')],{});db['SmsTransferReport'][_0x5cb6('0x122')](db[_0x5cb6('0x12e')],{});db[_0x5cb6('0xf2')][_0x5cb6('0x122')](db[_0x5cb6('0x51')],{'foreignKey':_0x5cb6('0x1f2'),'as':_0x5cb6('0x1e1')});db[_0x5cb6('0xf2')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1eb'),'as':_0x5cb6('0x1e2')});db[_0x5cb6('0xf2')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x5cb6('0xf2')]['belongsTo'](db[_0x5cb6('0x135')],{'foreignKey':_0x5cb6('0x1f3'),'as':_0x5cb6('0x1e6')});db[_0x5cb6('0xf2')][_0x5cb6('0x122')](db['SmsAccount'],{'foreignKey':_0x5cb6('0x1f4'),'as':_0x5cb6('0x1e8')});db[_0x5cb6('0x128')]['hasMany'](db[_0x5cb6('0x77')],{'as':_0x5cb6('0x165'),'foreignKey':_0x5cb6('0x179'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x128')]['hasMany'](db['CmCustomField'],{'as':_0x5cb6('0x1f5'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x128')][_0x5cb6('0x114')](db[_0x5cb6('0x6a')],{'as':'Contacts','onDelete':_0x5cb6('0x111'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x128')][_0x5cb6('0x114')](db[_0x5cb6('0x6f')],{'as':_0x5cb6('0x118'),'foreignKey':'ListId'});db[_0x5cb6('0x128')][_0x5cb6('0x114')](db[_0x5cb6('0x119')],{'as':_0x5cb6('0x11a'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x128')][_0x5cb6('0x114')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x5cb6('0x128')]['belongsToMany'](db[_0x5cb6('0x19')],{'as':_0x5cb6('0x1f6'),'through':_0x5cb6('0x154')});db[_0x5cb6('0x128')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':'cm_user_has_lists'});db[_0x5cb6('0x1dc')][_0x5cb6('0x114')](db['VoiceExtension'],{'as':_0x5cb6('0x117'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0x1dc')][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':'Agents','through':_0x5cb6('0x10c')});db['VoicePrefix'][_0x5cb6('0x123')](db['Team'],{'through':'TeamVoicePrefix','as':_0x5cb6('0x156')});db['UserProfile'][_0x5cb6('0x114')](db['User'],{'as':'Users','foreignKey':_0x5cb6('0x1f7')});db[_0x5cb6('0xf6')][_0x5cb6('0x114')](db[_0x5cb6('0xf7')],{'as':_0x5cb6('0x1f8'),'foreignKey':_0x5cb6('0x1f7'),'onDelete':_0x5cb6('0x111')});db['UserProfileSection'][_0x5cb6('0x114')](db['UserProfileResource'],{'as':_0x5cb6('0x1f9'),'foreignKey':_0x5cb6('0x1fa'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0xfd')][_0x5cb6('0x114')](db[_0x5cb6('0x77')],{'as':'Dispositions','foreignKey':_0x5cb6('0x1fb'),'onDelete':_0x5cb6('0x111')});db[_0x5cb6('0xfd')][_0x5cb6('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x5cb6('0x1fb')});db[_0x5cb6('0xfd')][_0x5cb6('0x114')](db[_0x5cb6('0x102')],{'as':_0x5cb6('0x167'),'foreignKey':_0x5cb6('0x1fb')});db[_0x5cb6('0xfd')][_0x5cb6('0x114')](db['WhatsappInteraction'],{'as':_0x5cb6('0x17d')});db[_0x5cb6('0xfd')][_0x5cb6('0x114')](db[_0x5cb6('0xff')],{'as':_0x5cb6('0x147')});db[_0x5cb6('0xfd')][_0x5cb6('0x122')](db[_0x5cb6('0x128')],{'as':'List','foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0xfd')][_0x5cb6('0x122')](db['Pause'],{'as':_0x5cb6('0x152'),'foreignKey':_0x5cb6('0x153')});db['WhatsappAccount'][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x142')});db['WhatsappApplication'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'onDelete':_0x5cb6('0x161')});db['WhatsappApplication']['belongsTo'](db[_0x5cb6('0x106')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0xff')]['belongsTo'](db[_0x5cb6('0xfd')],{'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0xff')][_0x5cb6('0x122')](db[_0x5cb6('0x7a')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x151')});db[_0x5cb6('0xff')][_0x5cb6('0x122')](db[_0x5cb6('0x83')],{'onDelete':_0x5cb6('0x161'),'foreignKey':_0x5cb6('0x176')});db['WhatsappInteraction']['hasMany'](db[_0x5cb6('0x102')],{'as':_0x5cb6('0x167'),'onDelete':'cascade','foreignKey':_0x5cb6('0x1fc')});db[_0x5cb6('0x11f')]['belongsTo'](db[_0x5cb6('0xfd')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1fb')});db[_0x5cb6('0x11f')]['belongsTo'](db['CmContact'],{'as':_0x5cb6('0x15f'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x16c'),'foreignKey':_0x5cb6('0x112')});db[_0x5cb6('0x11f')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x1b4'),'as':_0x5cb6('0x16d')});db[_0x5cb6('0x11f')][_0x5cb6('0x123')](db[_0x5cb6('0x83')],{'through':_0x5cb6('0x1b4'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x5cb6('0x123')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x170'),'through':_0x5cb6('0x132'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':'User'});db[_0x5cb6('0x102')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'onDelete':_0x5cb6('0x111'),'as':_0x5cb6('0x15f')});db[_0x5cb6('0x102')][_0x5cb6('0x122')](db['WhatsappInteraction'],{'onDelete':_0x5cb6('0x111'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x5cb6('0x122')](db[_0x5cb6('0xfd')],{'as':_0x5cb6('0x16b'),'foreignKey':_0x5cb6('0x1fb')});db[_0x5cb6('0x104')]['belongsTo'](db[_0x5cb6('0xfd')],{});db['WhatsappQueueReport'][_0x5cb6('0x122')](db['CmList'],{'as':_0x5cb6('0x178'),'foreignKey':_0x5cb6('0x179')});db[_0x5cb6('0x104')][_0x5cb6('0x122')](db[_0x5cb6('0x6a')],{'as':_0x5cb6('0x15f'),'foreignKey':_0x5cb6('0x181')});db['WhatsappQueueReport'][_0x5cb6('0x122')](db[_0x5cb6('0x11f')],{});db[_0x5cb6('0x104')]['belongsTo'](db[_0x5cb6('0x106')],{});db[_0x5cb6('0x104')][_0x5cb6('0x122')](db[_0x5cb6('0x102')],{});db[_0x5cb6('0x104')]['belongsTo'](db[_0x5cb6('0x12')],{});db[_0x5cb6('0x105')]['belongsTo'](db[_0x5cb6('0x102')],{});db[_0x5cb6('0x105')][_0x5cb6('0x122')](db[_0x5cb6('0x11f')],{});db[_0x5cb6('0x105')][_0x5cb6('0x122')](db[_0x5cb6('0xfd')],{'foreignKey':_0x5cb6('0x1fd'),'as':_0x5cb6('0x1e1')});db[_0x5cb6('0x105')][_0x5cb6('0x122')](db[_0x5cb6('0xfd')],{'foreignKey':_0x5cb6('0x1fe'),'as':_0x5cb6('0x1e8')});db['WhatsappTransferReport'][_0x5cb6('0x122')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x5cb6('0x105')]['belongsTo'](db['User'],{'foreignKey':_0x5cb6('0x1eb'),'as':_0x5cb6('0x1e2')});db[_0x5cb6('0x105')][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'foreignKey':_0x5cb6('0x1e3'),'as':_0x5cb6('0x1e4')});db['WhatsappQueue'][_0x5cb6('0x123')](db['User'],{'as':_0x5cb6('0x155'),'through':_0x5cb6('0x38'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0x5cb6('0xe3')],{'through':_0x5cb6('0x1db'),'as':'Teams'});db['UserSetting'][_0x5cb6('0x122')](db[_0x5cb6('0x12')],{'as':_0x5cb6('0x1ff'),'foreignKey':_0x5cb6('0x112'),'onDelete':_0x5cb6('0x111'),'hooks':!![]});db[_0x5cb6('0x107')][_0x5cb6('0x110')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x107')][_0x5cb6('0x110')](db[_0x5cb6('0x39')],{'as':_0x5cb6('0x200'),'onDelete':_0x5cb6('0x161')});db[_0x5cb6('0x107')][_0x5cb6('0x110')](db[_0x5cb6('0x162')],{'as':_0x5cb6('0x164'),'onDelete':_0x5cb6('0x161')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3f91998..246e7a3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf17=['./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists'];(function(_0x1f4e09,_0x1fc591){var _0x10deec=function(_0x5c1fb9){while(--_0x5c1fb9){_0x1f4e09['push'](_0x1f4e09['shift']());}};_0x10deec(++_0x1fc591);}(_0xdf17,0x14d));var _0x7df1=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xdf17[_0x3a6efd];return _0x487b9a;};'use strict';var path=require(_0x7df1('0x0'));var express=require(_0x7df1('0x1'));var errors=require(_0x7df1('0x2'));var config=require(_0x7df1('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x7df1('0x4')];var clientSideLogs=require(_0x7df1('0x5'));exports[_0x7df1('0x6')]=function(_0x1deb97){return setupLoggers(_0x1deb97)['then'](function(){_0x1deb97[_0x7df1('0x7')](_0x7df1('0x8'),require('./api/user'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x9'),require('./api/voiceChanSpy'));_0x1deb97['use'](_0x7df1('0xa'),require(_0x7df1('0xb')));_0x1deb97['use'](_0x7df1('0xc'),require(_0x7df1('0xd')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe'),require('./api/voiceMusicOnHold'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf'),require(_0x7df1('0x10')));_0x1deb97[_0x7df1('0x7')]('/api/voice/recordings',require(_0x7df1('0x11')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x12'),require(_0x7df1('0x13')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x14'),require(_0x7df1('0x15')));_0x1deb97[_0x7df1('0x7')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x16'),require(_0x7df1('0x17')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x18'),require('./api/voiceDialReport'));_0x1deb97[_0x7df1('0x7')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x1deb97['use'](_0x7df1('0x19'),require(_0x7df1('0x1a')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x1b'),require(_0x7df1('0x1c')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x1d'),require('./api/trunk'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x1e'),require(_0x7df1('0x1f')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x20'),require(_0x7df1('0x21')));_0x1deb97['use']('/api/mail/accounts',require(_0x7df1('0x22')));_0x1deb97[_0x7df1('0x7')]('/api/mail/queues',require(_0x7df1('0x23')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x24'),require(_0x7df1('0x25')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x26'),require('./api/mailInteraction'));_0x1deb97[_0x7df1('0x7')]('/api/mail/messages',require(_0x7df1('0x27')));_0x1deb97['use']('/api/mail/applications',require('./api/mailApplication'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x28'),require(_0x7df1('0x29')));_0x1deb97['use'](_0x7df1('0x2a'),require(_0x7df1('0x2b')));_0x1deb97['use'](_0x7df1('0x2c'),require(_0x7df1('0x2d')));_0x1deb97[_0x7df1('0x7')]('/api/fax/accounts',require('./api/faxAccount'));_0x1deb97[_0x7df1('0x7')]('/api/fax/applications',require(_0x7df1('0x2e')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x2f'),require(_0x7df1('0x30')));_0x1deb97['use'](_0x7df1('0x31'),require(_0x7df1('0x32')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x33'),require(_0x7df1('0x34')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x35'),require(_0x7df1('0x36')));_0x1deb97['use'](_0x7df1('0x37'),require(_0x7df1('0x38')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x39'),require(_0x7df1('0x3a')));_0x1deb97[_0x7df1('0x7')]('/api/sms/interactions',require(_0x7df1('0x3b')));_0x1deb97[_0x7df1('0x7')]('/api/sms/messages',require(_0x7df1('0x3c')));_0x1deb97['use'](_0x7df1('0x3d'),require(_0x7df1('0x3e')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x3f'),require(_0x7df1('0x40')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x41'),require(_0x7df1('0x42')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x43'),require(_0x7df1('0x44')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x45'),require(_0x7df1('0x46')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x47'),require(_0x7df1('0x48')));_0x1deb97['use']('/api/chat/websites',require('./api/chatWebsite'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x49'),require(_0x7df1('0x4a')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x4b'),require(_0x7df1('0x4c')));_0x1deb97['use'](_0x7df1('0x4d'),require(_0x7df1('0x4e')));_0x1deb97[_0x7df1('0x7')]('/api/chat/messages',require(_0x7df1('0x4f')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x50'),require(_0x7df1('0x51')));_0x1deb97['use']('/api/chat/queues',require('./api/chatQueue'));_0x1deb97[_0x7df1('0x7')]('/api/chat/groups',require(_0x7df1('0x52')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x53'),require('./api/chatProactiveAction'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x54'),require(_0x7df1('0x55')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x56'),require(_0x7df1('0x57')));_0x1deb97['use']('/api/cm/hopper',require(_0x7df1('0x58')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x59'),require(_0x7df1('0x5a')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x5b'),require(_0x7df1('0x5c')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x5d'),require('./api/cmHopperHistory'));_0x1deb97['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x5e'),require(_0x7df1('0x5f')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x60'),require('./api/automation'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x61'),require(_0x7df1('0x62')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x63'),require(_0x7df1('0x64')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x65'),require(_0x7df1('0x66')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x67'),require(_0x7df1('0x68')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x69'),require('./api/pause'));_0x1deb97[_0x7df1('0x7')]('/api/cdr',require(_0x7df1('0x6a')));_0x1deb97['use'](_0x7df1('0x6b'),require(_0x7df1('0x6c')));_0x1deb97['use'](_0x7df1('0x6d'),require('./api/schedule'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x6e'),require(_0x7df1('0x6f')));_0x1deb97['use'](_0x7df1('0x70'),require('./api/tag'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x71'),require('./api/contactItemType'));_0x1deb97['use'](_0x7df1('0x72'),require(_0x7df1('0x73')));_0x1deb97['use'](_0x7df1('0x74'),require(_0x7df1('0x75')));_0x1deb97[_0x7df1('0x7')]('/api/templates',require(_0x7df1('0x76')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x77'),require(_0x7df1('0x78')));_0x1deb97['use'](_0x7df1('0x79'),require(_0x7df1('0x7a')));_0x1deb97['use'](_0x7df1('0x7b'),require(_0x7df1('0x7c')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x7d'),require('./api/integrationReport'));_0x1deb97[_0x7df1('0x7')]('/api/analytics/custom_reports',require(_0x7df1('0x7e')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x7f'),require(_0x7df1('0x80')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x81'),require(_0x7df1('0x82')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x83'),require('./api/analyticMetric'));_0x1deb97['use'](_0x7df1('0x84'),require(_0x7df1('0x85')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x86'),require(_0x7df1('0x87')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/salesforce/accounts',require(_0x7df1('0x88')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/salesforce/configurations',require(_0x7df1('0x89')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x8a'),require(_0x7df1('0x8b')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x7df1('0x8c')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x8d'),require(_0x7df1('0x8e')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/sugarcrm/fields',require(_0x7df1('0x8f')));_0x1deb97['use'](_0x7df1('0x90'),require(_0x7df1('0x91')));_0x1deb97['use']('/api/integrations/desk/configurations',require(_0x7df1('0x92')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x93'),require(_0x7df1('0x94')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x95'),require('./api/intZohoAccount'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x96'),require('./api/intZohoConfiguration'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x97'),require(_0x7df1('0x98')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x99'),require(_0x7df1('0x9a')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x9b'),require(_0x7df1('0x9c')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x9d'),require(_0x7df1('0x9e')));_0x1deb97['use'](_0x7df1('0x9f'),require(_0x7df1('0xa0')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/freshdesk/configurations',require(_0x7df1('0xa1')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xa2'),require(_0x7df1('0xa3')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xa4'),require(_0x7df1('0xa5')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xa6'),require(_0x7df1('0xa7')));_0x1deb97['use']('/api/integrations/vtiger/fields',require(_0x7df1('0xa8')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xa9'),require(_0x7df1('0xaa')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xab'),require(_0x7df1('0xac')));_0x1deb97['use'](_0x7df1('0xad'),require('./api/intServicenowField'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xae'),require('./api/intDynamics365Account'));_0x1deb97[_0x7df1('0x7')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1deb97[_0x7df1('0x7')]('/api/integrations/dynamics365/fields',require(_0x7df1('0xaf')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xb0'),require('./api/intFreshsalesAccount'));_0x1deb97['use'](_0x7df1('0xb1'),require(_0x7df1('0xb2')));_0x1deb97[_0x7df1('0x7')]('/api/integrations/freshsales/fields',require(_0x7df1('0xb3')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xb4'),require(_0x7df1('0xb5')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xb6'),require('./api/chatQueueReport'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xb7'),require('./api/chatInternalMessage'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xb8'),require(_0x7df1('0xb9')));_0x1deb97['use'](_0x7df1('0xba'),require(_0x7df1('0xbb')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xbc'),require('./api/jscriptySessionReport'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xbd'),require(_0x7df1('0xbe')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xbf'),require(_0x7df1('0xc0')));_0x1deb97['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xc1'),require(_0x7df1('0xc2')));_0x1deb97[_0x7df1('0x7')]('/api/settings',require(_0x7df1('0xc3')));_0x1deb97['use'](_0x7df1('0xc4'),require(_0x7df1('0xc5')));_0x1deb97[_0x7df1('0x7')]('/api/square/projects',require(_0x7df1('0xc6')));_0x1deb97['use'](_0x7df1('0xc7'),require(_0x7df1('0xc8')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xc9'),require(_0x7df1('0xca')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xcb'),require('./api/team'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xcc'),require(_0x7df1('0xcd')));_0x1deb97['use'](_0x7df1('0xce'),require(_0x7df1('0xcf')));_0x1deb97['use'](_0x7df1('0xd0'),require(_0x7df1('0xd1')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xd2'),require(_0x7df1('0xd3')));_0x1deb97[_0x7df1('0x7')]('/api/plugins',require('./api/plugin'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xd4'),require('./api/mailTransferReport'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xd5'),require(_0x7df1('0xd6')));_0x1deb97[_0x7df1('0x7')]('/api/fax/reports/transfer',require(_0x7df1('0xd7')));_0x1deb97[_0x7df1('0x7')]('/api/openchannel/reports/transfer',require(_0x7df1('0xd8')));_0x1deb97['use'](_0x7df1('0xd9'),require('./api/smsTransferReport'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xda'),require(_0x7df1('0xdb')));_0x1deb97[_0x7df1('0x7')]('/api/voice/prefixes',require(_0x7df1('0xdc')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xdd'),require('./api/userProfile'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xde'),require(_0x7df1('0xdf')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe0'),require(_0x7df1('0xe1')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe2'),require(_0x7df1('0xe3')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe4'),require('./api/whatsappAccount'));_0x1deb97['use']('/api/whatsapp/applications',require(_0x7df1('0xe5')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe6'),require(_0x7df1('0xe7')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xe8'),require('./api/whatsappMessage'));_0x1deb97['use'](_0x7df1('0xe9'),require(_0x7df1('0xea')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xeb'),require(_0x7df1('0xec')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xed'),require('./api/whatsappQueue'));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xee'),require('./api/cloudProvider'));_0x1deb97['use']('/api/realtime',require(_0x7df1('0xef')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf0'),require(_0x7df1('0xf1')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf2'),require(_0x7df1('0xf3')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf4'),require(_0x7df1('0xf5')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf6'),require(_0x7df1('0xf7')));_0x1deb97['use']('/api/jira',require(_0x7df1('0xf8')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xf9'),require('./api/rpc'));_0x1deb97['use'](_0x7df1('0xfa'),require(_0x7df1('0xfb')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xfc'),require(_0x7df1('0xfd')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0xfe'),require(_0x7df1('0xff')));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x100'),require(_0x7df1('0x101')));_0x1deb97['use']('/api/logs',clientSideLogs);_0x1deb97[_0x7df1('0x7')](_0x7df1('0x102'),express[_0x7df1('0x103')](path[_0x7df1('0x104')](config[_0x7df1('0x105')],_0x7df1('0x102'))));_0x1deb97[_0x7df1('0x7')]('/www',express[_0x7df1('0x103')](path[_0x7df1('0x104')](config[_0x7df1('0x105')],_0x7df1('0x106'))));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x107'),express[_0x7df1('0x103')](path[_0x7df1('0x104')](config['root'],_0x7df1('0x107'))));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x108'),express[_0x7df1('0x103')](path['join'](config[_0x7df1('0x105')],_0x7df1('0x109'),_0x7df1('0x10a'))));_0x1deb97[_0x7df1('0x7')](_0x7df1('0x10b'),express[_0x7df1('0x103')](path['join'](config[_0x7df1('0x105')],_0x7df1('0x10c'))));_0x1deb97[_0x7df1('0x10d')](_0x7df1('0x10e'))['get'](errors[0x194]);_0x1deb97['route']('/*')[_0x7df1('0x10f')](function(_0x33a49a,_0x1eea75){_0x1eea75[_0x7df1('0x110')](path[_0x7df1('0x111')](_0x1deb97[_0x7df1('0x10f')](_0x7df1('0x112'))+_0x7df1('0x113')));});return _0x1deb97;});}; \ No newline at end of file +var _0x7f61=['/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','root','/www','join','/demo','/snippet','static','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x7f61,0xee));var _0x17f6=function(_0x44371d,_0xe971fa){_0x44371d=_0x44371d-0x0;var _0x1e8995=_0x7f61[_0x44371d];return _0x1e8995;};'use strict';var path=require('path');var express=require(_0x17f6('0x0'));var errors=require(_0x17f6('0x1'));var config=require(_0x17f6('0x2'));var setupLoggers=require(_0x17f6('0x3'))[_0x17f6('0x4')];var clientSideLogs=require(_0x17f6('0x5'));exports['default']=function(_0x35b170){return setupLoggers(_0x35b170)[_0x17f6('0x6')](function(){_0x35b170['use']('/api/users',require(_0x17f6('0x7')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x9'),require(_0x17f6('0xa')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xb'),require('./api/voiceContext'));_0x35b170['use']('/api/voice/extensions',require(_0x17f6('0xc')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd'),require(_0x17f6('0xe')));_0x35b170['use'](_0x17f6('0xf'),require(_0x17f6('0x10')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x11'),require(_0x17f6('0x12')));_0x35b170['use'](_0x17f6('0x13'),require(_0x17f6('0x14')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x15'),require(_0x17f6('0x16')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x17'),require(_0x17f6('0x18')));_0x35b170[_0x17f6('0x8')]('/api/voice/calls/reports',require(_0x17f6('0x19')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x1a'),require(_0x17f6('0x1b')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x1c'),require(_0x17f6('0x1d')));_0x35b170['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x35b170['use'](_0x17f6('0x1e'),require('./api/memberReport'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x1f'),require(_0x17f6('0x20')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x21'),require(_0x17f6('0x22')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x23'),require(_0x17f6('0x24')));_0x35b170['use'](_0x17f6('0x25'),require(_0x17f6('0x26')));_0x35b170[_0x17f6('0x8')]('/api/mail/queues',require(_0x17f6('0x27')));_0x35b170['use'](_0x17f6('0x28'),require('./api/mailSubstatus'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x29'),require(_0x17f6('0x2a')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x2b'),require(_0x17f6('0x2c')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x2d'),require(_0x17f6('0x2e')));_0x35b170[_0x17f6('0x8')]('/api/mail/reports/queue',require(_0x17f6('0x2f')));_0x35b170[_0x17f6('0x8')]('/api/dashboards',require('./api/dashboard'));_0x35b170['use']('/api/dashboards/items',require(_0x17f6('0x30')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x31'),require(_0x17f6('0x32')));_0x35b170[_0x17f6('0x8')]('/api/fax/applications',require(_0x17f6('0x33')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x34'),require(_0x17f6('0x35')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x36'),require(_0x17f6('0x37')));_0x35b170[_0x17f6('0x8')]('/api/fax/queues',require(_0x17f6('0x38')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x39'),require(_0x17f6('0x3a')));_0x35b170[_0x17f6('0x8')]('/api/sms/accounts',require(_0x17f6('0x3b')));_0x35b170[_0x17f6('0x8')]('/api/sms/applications',require(_0x17f6('0x3c')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x3d'),require('./api/smsInteraction'));_0x35b170['use'](_0x17f6('0x3e'),require(_0x17f6('0x3f')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x40'),require(_0x17f6('0x41')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x42'),require(_0x17f6('0x43')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x44'),require(_0x17f6('0x45')));_0x35b170['use'](_0x17f6('0x46'),require(_0x17f6('0x47')));_0x35b170['use'](_0x17f6('0x48'),require(_0x17f6('0x49')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x4a'),require('./api/openchannelQueue'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x4b'),require('./api/chatWebsite'));_0x35b170['use'](_0x17f6('0x4c'),require(_0x17f6('0x4d')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x4e'),require('./api/chatApplication'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x4f'),require(_0x17f6('0x50')));_0x35b170['use'](_0x17f6('0x51'),require('./api/chatMessage'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x52'),require(_0x17f6('0x53')));_0x35b170[_0x17f6('0x8')]('/api/chat/queues',require(_0x17f6('0x54')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x55'),require('./api/chatGroup'));_0x35b170['use'](_0x17f6('0x56'),require('./api/chatProactiveAction'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x57'),require(_0x17f6('0x58')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x59'),require(_0x17f6('0x5a')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x5b'),require('./api/cmHopper'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x5c'),require(_0x17f6('0x5d')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x5e'),require(_0x17f6('0x5f')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x60'),require(_0x17f6('0x61')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x62'),require(_0x17f6('0x63')));_0x35b170['use'](_0x17f6('0x64'),require(_0x17f6('0x65')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x66'),require('./api/automation'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x67'),require(_0x17f6('0x68')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x69'),require('./api/disposition'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x6a'),require(_0x17f6('0x6b')));_0x35b170['use'](_0x17f6('0x6c'),require(_0x17f6('0x6d')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x6e'),require(_0x17f6('0x6f')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x70'),require('./api/cdr'));_0x35b170[_0x17f6('0x8')]('/api/voiceQueuesLog',require(_0x17f6('0x71')));_0x35b170[_0x17f6('0x8')]('/api/schedules',require(_0x17f6('0x72')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x73'),require('./api/sound'));_0x35b170['use'](_0x17f6('0x74'),require(_0x17f6('0x75')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x76'),require('./api/contactItemType'));_0x35b170['use'](_0x17f6('0x77'),require(_0x17f6('0x78')));_0x35b170['use']('/api/cm_hopper_additional_phones',require(_0x17f6('0x79')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x7a'),require('./api/template'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x7b'),require(_0x17f6('0x7c')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x7d'),require('./api/variable'));_0x35b170['use'](_0x17f6('0x7e'),require(_0x17f6('0x7f')));_0x35b170[_0x17f6('0x8')]('/api/integrations/reports',require(_0x17f6('0x80')));_0x35b170[_0x17f6('0x8')]('/api/analytics/custom_reports',require(_0x17f6('0x81')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x82'),require(_0x17f6('0x83')));_0x35b170['use'](_0x17f6('0x84'),require(_0x17f6('0x85')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x86'),require(_0x17f6('0x87')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x88'),require(_0x17f6('0x89')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x8a'),require(_0x17f6('0x8b')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x8c'),require(_0x17f6('0x8d')));_0x35b170['use'](_0x17f6('0x8e'),require(_0x17f6('0x8f')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x90'),require('./api/intSalesforceField'));_0x35b170[_0x17f6('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x17f6('0x91')));_0x35b170['use']('/api/integrations/sugarcrm/configurations',require(_0x17f6('0x92')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x93'),require(_0x17f6('0x94')));_0x35b170['use']('/api/integrations/desk/accounts',require(_0x17f6('0x95')));_0x35b170[_0x17f6('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x96'),require(_0x17f6('0x97')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x98'),require(_0x17f6('0x99')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x9a'),require(_0x17f6('0x9b')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x9c'),require(_0x17f6('0x9d')));_0x35b170[_0x17f6('0x8')]('/api/integrations/zendesk/accounts',require(_0x17f6('0x9e')));_0x35b170['use'](_0x17f6('0x9f'),require(_0x17f6('0xa0')));_0x35b170[_0x17f6('0x8')]('/api/integrations/zendesk/fields',require(_0x17f6('0xa1')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xa2'),require('./api/intFreshdeskAccount'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xa3'),require(_0x17f6('0xa4')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xa5'),require(_0x17f6('0xa6')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xa7'),require('./api/intVtigerAccount'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xa8'),require(_0x17f6('0xa9')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xaa'),require(_0x17f6('0xab')));_0x35b170[_0x17f6('0x8')]('/api/integrations/servicenow/accounts',require(_0x17f6('0xac')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xad'),require(_0x17f6('0xae')));_0x35b170['use'](_0x17f6('0xaf'),require('./api/intServicenowField'));_0x35b170[_0x17f6('0x8')]('/api/integrations/dynamics365/accounts',require(_0x17f6('0xb0')));_0x35b170[_0x17f6('0x8')]('/api/integrations/dynamics365/configurations',require(_0x17f6('0xb1')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xb2'),require(_0x17f6('0xb3')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xb4'),require(_0x17f6('0xb5')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xb6'),require(_0x17f6('0xb7')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xb8'),require(_0x17f6('0xb9')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xba'),require('./api/network'));_0x35b170[_0x17f6('0x8')]('/api/chat/reports/queue',require(_0x17f6('0xbb')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xbc'),require('./api/chatInternalMessage'));_0x35b170['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x35b170['use'](_0x17f6('0xbd'),require(_0x17f6('0xbe')));_0x35b170['use'](_0x17f6('0xbf'),require('./api/jscriptySessionReport'));_0x35b170[_0x17f6('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x35b170[_0x17f6('0x8')]('/api/square/reports',require(_0x17f6('0xc0')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xc1'),require(_0x17f6('0xc2')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xc3'),require(_0x17f6('0xc4')));_0x35b170[_0x17f6('0x8')]('/api/settings',require('./api/setting'));_0x35b170['use'](_0x17f6('0xc5'),require('./api/squareOdbc'));_0x35b170[_0x17f6('0x8')]('/api/square/projects',require(_0x17f6('0xc6')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xc7'),require(_0x17f6('0xc8')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xc9'),require(_0x17f6('0xca')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xcb'),require(_0x17f6('0xcc')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xcd'),require(_0x17f6('0xce')));_0x35b170[_0x17f6('0x8')]('/api/campaigns',require(_0x17f6('0xcf')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd0'),require(_0x17f6('0xd1')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd2'),require(_0x17f6('0xd3')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd4'),require(_0x17f6('0xd5')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd6'),require('./api/mailTransferReport'));_0x35b170[_0x17f6('0x8')]('/api/chat/reports/transfer',require(_0x17f6('0xd7')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xd8'),require(_0x17f6('0xd9')));_0x35b170[_0x17f6('0x8')]('/api/openchannel/reports/transfer',require(_0x17f6('0xda')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xdb'),require('./api/smsTransferReport'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xdc'),require(_0x17f6('0xdd')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xde'),require(_0x17f6('0xdf')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xe0'),require(_0x17f6('0xe1')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xe2'),require(_0x17f6('0xe3')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xe4'),require(_0x17f6('0xe5')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xe6'),require(_0x17f6('0xe7')));_0x35b170['use'](_0x17f6('0xe8'),require(_0x17f6('0xe9')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xea'),require(_0x17f6('0xeb')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xec'),require(_0x17f6('0xed')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xee'),require(_0x17f6('0xef')));_0x35b170['use'](_0x17f6('0xf0'),require('./api/whatsappQueueReport'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf1'),require('./api/whatsappTransferReport'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf2'),require('./api/whatsappQueue'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf3'),require('./api/cloudProvider'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf4'),require('./api/realtime'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf5'),require(_0x17f6('0xf6')));_0x35b170['use']('/api/auth/local',require(_0x17f6('0xf7')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xf8'),require(_0x17f6('0xf9')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xfa'),require(_0x17f6('0xfb')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xfc'),require('./api/jira'));_0x35b170[_0x17f6('0x8')](_0x17f6('0xfd'),require(_0x17f6('0xfe')));_0x35b170[_0x17f6('0x8')](_0x17f6('0xff'),require(_0x17f6('0x100')));_0x35b170['use'](_0x17f6('0x101'),require(_0x17f6('0x102')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x103'),require(_0x17f6('0x104')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x105'),require('./api/webbar'));_0x35b170[_0x17f6('0x8')](_0x17f6('0x106'),clientSideLogs);_0x35b170[_0x17f6('0x8')](_0x17f6('0x107'),express['static'](path['join'](config[_0x17f6('0x108')],_0x17f6('0x107'))));_0x35b170[_0x17f6('0x8')](_0x17f6('0x109'),express['static'](path[_0x17f6('0x10a')](config[_0x17f6('0x108')],'/www')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x10b'),express['static'](path[_0x17f6('0x10a')](config[_0x17f6('0x108')],_0x17f6('0x10b'))));_0x35b170['use'](_0x17f6('0x10c'),express[_0x17f6('0x10d')](path[_0x17f6('0x10a')](config[_0x17f6('0x108')],_0x17f6('0x10e'),'3.0.0')));_0x35b170[_0x17f6('0x8')](_0x17f6('0x10f'),express[_0x17f6('0x10d')](path[_0x17f6('0x10a')](config[_0x17f6('0x108')],'/server/files/plugins')));_0x35b170[_0x17f6('0x110')](_0x17f6('0x111'))[_0x17f6('0x112')](errors[0x194]);_0x35b170[_0x17f6('0x110')]('/*')[_0x17f6('0x112')](function(_0x3d74a3,_0x33b738){_0x33b738[_0x17f6('0x113')](path[_0x17f6('0x114')](_0x35b170['get'](_0x17f6('0x115'))+_0x17f6('0x116')));});return _0x35b170;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3fa0f74..beec9a8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64cb=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x3b420b,_0x1881f4){var _0x13ec33=function(_0x53d717){while(--_0x53d717){_0x3b420b['push'](_0x3b420b['shift']());}};_0x13ec33(++_0x1881f4);}(_0x64cb,0x163));var _0xb64c=function(_0x2e64f6,_0x266fc7){_0x2e64f6=_0x2e64f6-0x0;var _0x584998=_0x64cb[_0x2e64f6];return _0x584998;};'use strict';var jayson=require('jayson/promise');var _=require(_0xb64c('0x0'));var config=require(_0xb64c('0x1'));exports['listen']=function(){return new Promise(function(_0x31ec5d,_0x596532){var _0x159475={};_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x3')));_0x159475=_['merge'](_0x159475,require('../api/voiceExtension/voiceExtension.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/voiceQueue/voiceQueue.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x4')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x5')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x6')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x7')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x8')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x9')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xa')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xb')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xc')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xd')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xe')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0xf')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x10')));_0x159475=_['merge'](_0x159475,require('../api/faxAccount/faxAccount.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x11')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x12')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x13')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x14')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x15')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x16')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x17')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x18')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x19')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1a')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1b')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x159475=_['merge'](_0x159475,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1c')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1d')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1e')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x1f')));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x20')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x21')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x22')));_0x159475=_['merge'](_0x159475,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x23')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x24')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x25')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x26')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x27')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x28')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/trigger/trigger.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x29')));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x2a')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x2b')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x2c')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x2d')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x2e')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x2f')));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x30')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x31')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x32')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/squareReport/squareReport.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x33')));_0x159475=_['merge'](_0x159475,require('../api/setting/setting.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x34')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x35')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x36')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x37')));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x38')));_0x159475=_['merge'](_0x159475,require('../api/attachment/attachment.rpc'));_0x159475=_['merge'](_0x159475,require(_0xb64c('0x39')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x3a')));_0x159475=_[_0xb64c('0x2')](_0x159475,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x3b')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x3c')));_0x159475=_[_0xb64c('0x2')](_0x159475,require(_0xb64c('0x3d')));var _0x4387c1=jayson[_0xb64c('0x3e')](_0x159475)[_0xb64c('0x3f')]();var _0x11db0b=config[_0xb64c('0x40')][_0xb64c('0x41')]||config[_0xb64c('0x41')]+0x1;var _0x37d719=config[_0xb64c('0x40')]['ip']||_0xb64c('0x42');_0x4387c1['on'](_0xb64c('0x43'),function(_0x32fcef){return _0x596532(_0x32fcef);});_0x4387c1[_0xb64c('0x44')](_0x11db0b,_0x37d719,function(){console[_0xb64c('0x45')](_0xb64c('0x46'),_0x37d719,_0x11db0b);require(_0xb64c('0x47'))[_0xb64c('0x48')]();return _0x31ec5d(_0xb64c('0x49')+_0x37d719+':'+_0x11db0b);});});}; \ No newline at end of file +var _0x5c46=['../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5c46,0x1ef));var _0x65c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c46[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x65c4('0x0'));var _=require('lodash');var config=require(_0x65c4('0x1'));exports['listen']=function(){return new Promise(function(_0x439cbe,_0x2ecde9){var _0x12c24d={};_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x3')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x4')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/voiceQueue/voiceQueue.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x5')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x6')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x7')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x8')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x9')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0xa')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0xb')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0xc')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/mailAccount/mailAccount.rpc'));_0x12c24d=_['merge'](_0x12c24d,require('../api/mailQueue/mailQueue.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0xd')));_0x12c24d=_['merge'](_0x12c24d,require('../api/mailMessage/mailMessage.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0xe')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0xf')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x10')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/faxApplication/faxApplication.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x11')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x12')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x13')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x14')));_0x12c24d=_['merge'](_0x12c24d,require('../api/smsInteraction/smsInteraction.rpc'));_0x12c24d=_['merge'](_0x12c24d,require('../api/smsMessage/smsMessage.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x15')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x16')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x17')));_0x12c24d=_['merge'](_0x12c24d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x18')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x19')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x1a')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x1b')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x1c')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x1d')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x1e')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x1f')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x20')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x21')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/interval/interval.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x22')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x23')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x24')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x25')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x26')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x27')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x28')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x29')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x2a')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x2b')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x2c')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x2d')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x2e')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x2f')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x30')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x31')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x32')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x33')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x34')));_0x12c24d=_['merge'](_0x12c24d,require(_0x65c4('0x35')));_0x12c24d=_['merge'](_0x12c24d,require('../api/setting/setting.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x36')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x37')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x38')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/squareMessage/squareMessage.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/campaign/campaign.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/attachment/attachment.rpc'));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x39')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x3a')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x3b')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x3c')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require(_0x65c4('0x3d')));_0x12c24d=_[_0x65c4('0x2')](_0x12c24d,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x245788=jayson[_0x65c4('0x3e')](_0x12c24d)[_0x65c4('0x3f')]();var _0x3fe06c=config[_0x65c4('0x40')][_0x65c4('0x41')]||config[_0x65c4('0x41')]+0x1;var _0x4bcc1a=config[_0x65c4('0x40')]['ip']||_0x65c4('0x42');_0x245788['on'](_0x65c4('0x43'),function(_0x45c442){return _0x2ecde9(_0x45c442);});_0x245788['listen'](_0x3fe06c,_0x4bcc1a,function(){console[_0x65c4('0x44')](_0x65c4('0x45'),_0x4bcc1a,_0x3fe06c);require('../config/triggers')[_0x65c4('0x46')]();return _0x439cbe(_0x65c4('0x47')+_0x4bcc1a+':'+_0x3fe06c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 69416c6..b5062d1 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 _0xefcf=['command','answer','sendRequest','ANSWER','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','setEncoding','utf8','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','inherits','prototype'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0xefcf,0x184));var _0xfefc=function(_0x582628,_0x45dc5d){_0x582628=_0x582628-0x0;var _0x4dfea5=_0xefcf[_0x582628];return _0x4dfea5;};'use strict';var util=require(_0xfefc('0x0'));var _=require(_0xfefc('0x1'));var EventEmitter=require(_0xfefc('0x2'))[_0xfefc('0x3')];var AGIReply=require(_0xfefc('0x4'));var AGIError=require('./error');function AGIChannel(_0x4bd6e0){var _0x2f4df3=this,_0x461e23=new AGIReply(),_0x391434=![],_0x4a8d2c={};EventEmitter['call'](_0x2f4df3);_0x4bd6e0[_0xfefc('0x5')]('utf8');_0x4bd6e0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x461e23[_0xfefc('0x5')](_0xfefc('0x6'));_0x461e23['on'](_0xfefc('0x7'),function(_0x379c9f){for(var _0x23e927 in _0x379c9f){_0x2f4df3[_0x23e927]=_0x379c9f[_0x23e927];}_0x2f4df3[_0xfefc('0x8')]('ready');});_0x461e23['on']('line',function(_0x1e6be7){if(_0x1e6be7[_0xfefc('0x9')]()==_0xfefc('0xa')){_0x2f4df3[_0xfefc('0x8')](_0xfefc('0xa'));return;}if(_0x1e6be7[_0xfefc('0xb')](0x0,0xb)==_0xfefc('0xc')){_0x391434=!![];}if(_0x391434){_0x4a8d2c['rx']+=_0x1e6be7+'\x0a';if(_0x1e6be7[_0xfefc('0xd')](_0xfefc('0xe'))!=-0x1){_0x391434=![];}}else{_0x4a8d2c['rx']=_0x1e6be7;}if(_0x391434){return;}if(typeof _0x4a8d2c['cb']==_0xfefc('0xf')){var _0x29090a=_0x4a8d2c['rx'][_0xfefc('0xb')](0x0,0x3),_0x16540c=null,_0x2f8cf3=null;_0x29090a=parseInt(_0x29090a);if(isNaN(_0x29090a)){_0x4a8d2c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x29090a!=0xc8){_0x4a8d2c['cb'](null,{'code':_0x29090a,'result':-0x1,'extra':'KO'});return;}_0x16540c=_0x4a8d2c['rx'][_0xfefc('0xb')](0x4)[_0xfefc('0x10')](_0xfefc('0x11'),'');if(_0x16540c[_0xfefc('0x12')]('\x20')!=-0x1){_0x16540c=_0x16540c[_0xfefc('0x13')](0x0,_0x16540c['indexOf']('\x20'));}if(_['startsWith'](_0x16540c,'-1')){_0x16540c=parseInt(_0x16540c);}_0x2f8cf3=_0x4a8d2c['rx'][_0xfefc('0x14')]('\x20');if(_0x2f8cf3[_0xfefc('0x15')]==0x3){_0x2f8cf3=_0x2f8cf3[0x2][_0xfefc('0xb')](0x1,_0x2f8cf3[0x2][_0xfefc('0x15')]-0x1);}else if(_0x2f8cf3[_0xfefc('0x15')]>0x3){var _0x55a1b3=/\((.+)\)/;var _0x4adc53=_0x4a8d2c['rx'][_0xfefc('0x16')](_0x55a1b3);if(_0x4adc53){_0x2f8cf3=_0x4adc53[0x1];}else{_0x2f8cf3=null;}}else{_0x2f8cf3=null;}_0x4a8d2c['cb'](null,{'code':_0x29090a,'result':_0x16540c,'extra':_0x2f8cf3});}});_0x4bd6e0['on'](_0xfefc('0x17'),function(_0x387a23){_0x2f4df3[_0xfefc('0x8')](_0xfefc('0x17'),new AGIError(_0xfefc('0x18'),_0x387a23[_0xfefc('0x19')]));});_0x4bd6e0['on']('close',function(){_0x2f4df3[_0xfefc('0x8')](_0xfefc('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4bd6e0['on'](_0xfefc('0x1b'),function(){_0x2f4df3[_0xfefc('0x8')](_0xfefc('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4bd6e0[_0xfefc('0x1c')]();});_0x4bd6e0[_0xfefc('0x1d')](_0x461e23);this['command']=function(_0x20f25b,_0x3ebb8b){var _0x20f25b=_0x20f25b||'',_0x3ebb8b=typeof _0x3ebb8b==_0xfefc('0xf')?_0x3ebb8b:new Function();_0x4a8d2c={'tx':_0x20f25b,'rx':'','cb':_0x3ebb8b};_0x4bd6e0['write'](_0x20f25b+'\x0a');},this[_0xfefc('0x1a')]=function(){_0x4bd6e0[_0xfefc('0x1c')]();};}util[_0xfefc('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0xfefc('0x1f')]['sendRequest']=function(_0x4e0f5e){return this[_0xfefc('0x20')]['sync'](this,_0x4e0f5e);};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x21')]=function(){return this[_0xfefc('0x22')](_0xfefc('0x23'));};AGIChannel[_0xfefc('0x1f')]['getData']=function(_0xf303a3,_0x1d13b6,_0x4133aa){_0xf303a3=_0xf303a3===undefined?'beep':_0xf303a3;_0x1d13b6=_0x1d13b6===undefined?'5':_0x1d13b6;_0x4133aa=_0x4133aa===undefined?'1':_0x4133aa;return this[_0xfefc('0x22')](util[_0xfefc('0x24')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xf303a3,_0x1d13b6*0x3e8,_0x4133aa));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x25')]=function(_0x361f46){_0x361f46=_0x361f46||_0xfefc('0x26');return this[_0xfefc('0x22')](util[_0xfefc('0x24')](_0xfefc('0x27'),_0x361f46));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x28')]=function(_0x39eddb,_0x27cbfb){if(_[_0xfefc('0x29')](_0x27cbfb)){return this['sendRequest'](util[_0xfefc('0x24')](_0xfefc('0x2a'),_0x39eddb,_0x27cbfb[_0xfefc('0x2b')](',')));}return this[_0xfefc('0x22')](util[_0xfefc('0x24')]('EXEC\x20%s\x20%s',_0x39eddb,_0x27cbfb));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x2c')]=function(_0x310aa8){return this['sendRequest'](util[_0xfefc('0x24')]('SET\x20CONTEXT\x20%s',_0x310aa8));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x2d')]=function(_0x19ca76){return this[_0xfefc('0x22')](util[_0xfefc('0x24')](_0xfefc('0x2e'),_0x19ca76));};AGIChannel['prototype']['setPriority']=function(_0x4dee60){return this[_0xfefc('0x22')](util[_0xfefc('0x24')]('SET\x20PRIORITY\x20%s',_0x4dee60));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0xa')]=function(){return this[_0xfefc('0x22')](_0xfefc('0x2f'));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x30')]=function(_0x4e2836,_0x5c1f87){var _0x1c83b6=_[_0xfefc('0x31')](_0x5c1f87)||_[_0xfefc('0x32')](_0x5c1f87)?_0x5c1f87['toString']():_0x5c1f87;return this[_0xfefc('0x22')](util[_0xfefc('0x24')](_0xfefc('0x33'),_0x4e2836,_0x1c83b6?_0x1c83b6[_0xfefc('0x34')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfefc('0x1f')]['sayNumber']=function(_0x19ad9f,_0x1017a3){return this[_0xfefc('0x22')](util['format'](_0xfefc('0x35'),_0x19ad9f,_0x1017a3));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x36')]=function(_0x1df5f3,_0x96dcd4){return this[_0xfefc('0x22')](util[_0xfefc('0x24')]('SAY\x20DIGITS\x20%s\x20%s',_0x1df5f3,_0x96dcd4));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x37')]=function(_0x5ed58a,_0x49651b){return this['sendRequest'](util[_0xfefc('0x24')](_0xfefc('0x38'),_0x5ed58a,_0x49651b));};AGIChannel['prototype'][_0xfefc('0x39')]=function(_0x593080,_0x564b92,_0x286689){_0x564b92=_0x564b92||this[_0xfefc('0x3a')];_0x286689=_0x286689||0x1;this['setContext'](_0x593080);this['setExtension'](_0x564b92);this['setPriority'](_0x286689);return this[_0xfefc('0x25')](util[_0xfefc('0x24')](_0xfefc('0x3b'),_0x593080,_0x564b92,_0x286689));};AGIChannel[_0xfefc('0x1f')]['getVariable']=function(_0x5c561d){return this[_0xfefc('0x22')](util[_0xfefc('0x24')](_0xfefc('0x3c'),_0x5c561d));};AGIChannel[_0xfefc('0x1f')]['recordFile']=function(_0x15d81d,_0x13c101,_0x339d4d,_0x16ce9d,_0x2a3e3d,_0x166363){_0x13c101=_0x13c101||_0xfefc('0x3d');_0x339d4d=_0x339d4d||'';_0x16ce9d=_0x16ce9d===undefined?-0x1:_0x16ce9d==='-1'?-0x1:_0x16ce9d*0x3e8;_0x2a3e3d=_0x2a3e3d===undefined?'':'s='+_0x2a3e3d;_0x166363=_0x166363?'BEEP':'';return this[_0xfefc('0x22')](util[_0xfefc('0x24')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x15d81d,_0x13c101,_0x339d4d,_0x16ce9d,_0x166363,_0x2a3e3d));};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x3e')]=function(_0x52cbfc,_0x47eeab){_0x47eeab=_0x47eeab||'';return this[_0xfefc('0x22')](util['format'](_0xfefc('0x3f'),_0x52cbfc,_0x47eeab));};AGIChannel[_0xfefc('0x1f')]['agi']=function(_0x2c5746){return this[_0xfefc('0x28')](_0xfefc('0x40'),_0x2c5746);};AGIChannel[_0xfefc('0x1f')][_0xfefc('0x41')]=function(_0xdaada6){return this['exec'](_0xfefc('0x42'),_0xdaada6);};AGIChannel['prototype'][_0xfefc('0x17')]=function(_0x238af9,_0x22ec6a){this['noop'](util[_0xfefc('0x24')](_0xfefc('0x43'),_0x238af9['id'],_0x238af9[_0xfefc('0x44')],_0x22ec6a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfefc('0x45')]=AGIChannel; \ No newline at end of file +var _0xe5af=['sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','./reply','./error','call','setEncoding','utf8','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','inherits','sendRequest','sync','prototype','answer','getData','beep','format','noop','NO\x20MESSAGE','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s'];(function(_0x32c7e5,_0x35246f){var _0x29735c=function(_0x566729){while(--_0x566729){_0x32c7e5['push'](_0x32c7e5['shift']());}};_0x29735c(++_0x35246f);}(_0xe5af,0x9c));var _0xfe5a=function(_0xa24605,_0x49cfdd){_0xa24605=_0xa24605-0x0;var _0x13f63d=_0xe5af[_0xa24605];return _0x13f63d;};'use strict';var util=require('util');var _=require(_0xfe5a('0x0'));var EventEmitter=require(_0xfe5a('0x1'))['EventEmitter'];var AGIReply=require(_0xfe5a('0x2'));var AGIError=require(_0xfe5a('0x3'));function AGIChannel(_0x23b7f0){var _0x4adbd1=this,_0x1165e3=new AGIReply(),_0x48e3a7=![],_0x526677={};EventEmitter[_0xfe5a('0x4')](_0x4adbd1);_0x23b7f0[_0xfe5a('0x5')]('utf8');_0x23b7f0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1165e3[_0xfe5a('0x5')](_0xfe5a('0x6'));_0x1165e3['on'](_0xfe5a('0x7'),function(_0x3e683c){for(var _0x5cd100 in _0x3e683c){_0x4adbd1[_0x5cd100]=_0x3e683c[_0x5cd100];}_0x4adbd1[_0xfe5a('0x8')]('ready');});_0x1165e3['on']('line',function(_0x259e8a){if(_0x259e8a[_0xfe5a('0x9')]()=='hangup'){_0x4adbd1[_0xfe5a('0x8')](_0xfe5a('0xa'));return;}if(_0x259e8a[_0xfe5a('0xb')](0x0,0xb)==_0xfe5a('0xc')){_0x48e3a7=!![];}if(_0x48e3a7){_0x526677['rx']+=_0x259e8a+'\x0a';if(_0x259e8a[_0xfe5a('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x48e3a7=![];}}else{_0x526677['rx']=_0x259e8a;}if(_0x48e3a7){return;}if(typeof _0x526677['cb']==_0xfe5a('0xe')){var _0x9d1f4f=_0x526677['rx'][_0xfe5a('0xb')](0x0,0x3),_0x20b206=null,_0x374ded=null;_0x9d1f4f=parseInt(_0x9d1f4f);if(isNaN(_0x9d1f4f)){_0x526677['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x9d1f4f!=0xc8){_0x526677['cb'](null,{'code':_0x9d1f4f,'result':-0x1,'extra':'KO'});return;}_0x20b206=_0x526677['rx'][_0xfe5a('0xb')](0x4)[_0xfe5a('0xf')](_0xfe5a('0x10'),'');if(_0x20b206[_0xfe5a('0x11')]('\x20')!=-0x1){_0x20b206=_0x20b206[_0xfe5a('0x12')](0x0,_0x20b206[_0xfe5a('0x11')]('\x20'));}if(_[_0xfe5a('0x13')](_0x20b206,'-1')){_0x20b206=parseInt(_0x20b206);}_0x374ded=_0x526677['rx'][_0xfe5a('0x14')]('\x20');if(_0x374ded[_0xfe5a('0x15')]==0x3){_0x374ded=_0x374ded[0x2][_0xfe5a('0xb')](0x1,_0x374ded[0x2][_0xfe5a('0x15')]-0x1);}else if(_0x374ded[_0xfe5a('0x15')]>0x3){var _0x22afa7=/\((.+)\)/;var _0x290600=_0x526677['rx'][_0xfe5a('0x16')](_0x22afa7);if(_0x290600){_0x374ded=_0x290600[0x1];}else{_0x374ded=null;}}else{_0x374ded=null;}_0x526677['cb'](null,{'code':_0x9d1f4f,'result':_0x20b206,'extra':_0x374ded});}});_0x23b7f0['on'](_0xfe5a('0x17'),function(_0x5bf597){_0x4adbd1[_0xfe5a('0x8')](_0xfe5a('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x5bf597[_0xfe5a('0x18')]));});_0x23b7f0['on'](_0xfe5a('0x19'),function(){_0x4adbd1[_0xfe5a('0x8')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x23b7f0['on'](_0xfe5a('0x1a'),function(){_0x4adbd1[_0xfe5a('0x8')](_0xfe5a('0x1a'),new AGIError(_0xfe5a('0x1b')));_0x23b7f0[_0xfe5a('0x1c')]();});_0x23b7f0[_0xfe5a('0x1d')](_0x1165e3);this['command']=function(_0x4770bb,_0x592521){var _0x4770bb=_0x4770bb||'',_0x592521=typeof _0x592521==_0xfe5a('0xe')?_0x592521:new Function();_0x526677={'tx':_0x4770bb,'rx':'','cb':_0x592521};_0x23b7f0['write'](_0x4770bb+'\x0a');},this['close']=function(){_0x23b7f0[_0xfe5a('0x1c')]();};}util[_0xfe5a('0x1e')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfe5a('0x1f')]=function(_0x26f744){return this['command'][_0xfe5a('0x20')](this,_0x26f744);};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x22')]=function(){return this[_0xfe5a('0x1f')]('ANSWER');};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x23')]=function(_0x24481f,_0x1cd531,_0x36bf20){_0x24481f=_0x24481f===undefined?_0xfe5a('0x24'):_0x24481f;_0x1cd531=_0x1cd531===undefined?'5':_0x1cd531;_0x36bf20=_0x36bf20===undefined?'1':_0x36bf20;return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x24481f,_0x1cd531*0x3e8,_0x36bf20));};AGIChannel['prototype'][_0xfe5a('0x26')]=function(_0x485f9d){_0x485f9d=_0x485f9d||_0xfe5a('0x27');return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')]('VERBOSE\x20\x22%s\x22',_0x485f9d));};AGIChannel['prototype']['exec']=function(_0x32d31e,_0x582f2d){if(_['isArray'](_0x582f2d)){return this['sendRequest'](util[_0xfe5a('0x25')](_0xfe5a('0x28'),_0x32d31e,_0x582f2d[_0xfe5a('0x29')](',')));}return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')](_0xfe5a('0x28'),_0x32d31e,_0x582f2d));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x2a')]=function(_0x414ab8){return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')]('SET\x20CONTEXT\x20%s',_0x414ab8));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x2b')]=function(_0x584de3){return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')](_0xfe5a('0x2c'),_0x584de3));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x2d')]=function(_0x5ed29a){return this['sendRequest'](util[_0xfe5a('0x25')]('SET\x20PRIORITY\x20%s',_0x5ed29a));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0xa')]=function(){return this[_0xfe5a('0x1f')](_0xfe5a('0x2e'));};AGIChannel['prototype'][_0xfe5a('0x2f')]=function(_0x1817fe,_0x2e3a36){var _0x5d4753=_[_0xfe5a('0x30')](_0x2e3a36)||_[_0xfe5a('0x31')](_0x2e3a36)?_0x2e3a36[_0xfe5a('0x32')]():_0x2e3a36;return this[_0xfe5a('0x1f')](util['format'](_0xfe5a('0x33'),_0x1817fe,_0x5d4753?_0x5d4753['toString']()[_0xfe5a('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfe5a('0x21')]['sayNumber']=function(_0x1bd4ef,_0x45e31a){return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')]('SAY\x20NUMBER\x20%s\x20%s',_0x1bd4ef,_0x45e31a));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x34')]=function(_0x188470,_0x560088){return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')](_0xfe5a('0x35'),_0x188470,_0x560088));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x36')]=function(_0x162c48,_0x16bb85){return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')](_0xfe5a('0x37'),_0x162c48,_0x16bb85));};AGIChannel[_0xfe5a('0x21')]['continueAt']=function(_0x355d05,_0x315396,_0x29e2aa){_0x315396=_0x315396||this[_0xfe5a('0x38')];_0x29e2aa=_0x29e2aa||0x1;this[_0xfe5a('0x2a')](_0x355d05);this[_0xfe5a('0x2b')](_0x315396);this[_0xfe5a('0x2d')](_0x29e2aa);return this['noop'](util[_0xfe5a('0x25')](_0xfe5a('0x39'),_0x355d05,_0x315396,_0x29e2aa));};AGIChannel['prototype']['getVariable']=function(_0x252904){return this['sendRequest'](util['format'](_0xfe5a('0x3a'),_0x252904));};AGIChannel[_0xfe5a('0x21')]['recordFile']=function(_0x43c85f,_0x5a9c92,_0x5112a9,_0x1dbb2c,_0x1a92ef,_0x2beb0b){_0x5a9c92=_0x5a9c92||_0xfe5a('0x3b');_0x5112a9=_0x5112a9||'';_0x1dbb2c=_0x1dbb2c===undefined?-0x1:_0x1dbb2c==='-1'?-0x1:_0x1dbb2c*0x3e8;_0x1a92ef=_0x1a92ef===undefined?'':'s='+_0x1a92ef;_0x2beb0b=_0x2beb0b?_0xfe5a('0x3c'):'';return this['sendRequest'](util[_0xfe5a('0x25')](_0xfe5a('0x3d'),_0x43c85f,_0x5a9c92,_0x5112a9,_0x1dbb2c,_0x2beb0b,_0x1a92ef));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x3e')]=function(_0x462ee9,_0x1b0635){_0x1b0635=_0x1b0635||'';return this[_0xfe5a('0x1f')](util[_0xfe5a('0x25')](_0xfe5a('0x3f'),_0x462ee9,_0x1b0635));};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x40')]=function(_0x1c6902){return this[_0xfe5a('0x41')](_0xfe5a('0x42'),_0x1c6902);};AGIChannel['prototype'][_0xfe5a('0x43')]=function(_0x3df23){return this['exec']('WAIT',_0x3df23);};AGIChannel[_0xfe5a('0x21')][_0xfe5a('0x17')]=function(_0x1e9da8,_0x3ccf98){this[_0xfe5a('0x26')](util[_0xfe5a('0x25')](_0xfe5a('0x44'),_0x1e9da8['id'],_0x1e9da8['label'],_0x3ccf98));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfe5a('0x45')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ef9d917..e11025f 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 _0x578b=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x3fdd72,_0xba5d1c){var _0x3e940f=function(_0x584d0c){while(--_0x584d0c){_0x3fdd72['push'](_0x3fdd72['shift']());}};_0x3e940f(++_0xba5d1c);}(_0x578b,0x19f));var _0xb578=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0x578b[_0x1433df];return _0x49fade;};'use strict';var util=require(_0xb578('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xb578('0x1'),'E_AGI_SERVER_CLOSE':_0xb578('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xb578('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xb578('0x4'),'E_AGI_SOCKET_ERROR':_0xb578('0x5'),'E_AGI_SOCKET_CLOSE':_0xb578('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xb578('0x7'),'E_AGI_COMMAND_EMPTY':_0xb578('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb578('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2cf128){var _0x2cf128=_0x2cf128||null,_0x2b0ec1=_0x2b0ec1||[],_0x1aed7e=0x1,_0x4b6269='';if(!error[_0x2cf128]){_0x2cf128=_0xb578('0xa');}_0x2b0ec1[_0xb578('0xb')](error[_0x2cf128]);while(arguments[_0x1aed7e]){_0x2b0ec1['push'](arguments[_0x1aed7e]);_0x1aed7e++;}_0x4b6269=util[_0xb578('0xc')]['apply'](util,_0x2b0ec1);this[_0xb578('0xd')]=_0x4b6269;this[_0xb578('0xe')]=_0x2cf128;}module['exports']=AGIError; \ No newline at end of file +var _0x5f16=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','util'];(function(_0x2578fb,_0xc5c6d3){var _0x1eef81=function(_0x30831f){while(--_0x30831f){_0x2578fb['push'](_0x2578fb['shift']());}};_0x1eef81(++_0xc5c6d3);}(_0x5f16,0xa1));var _0x65f1=function(_0x507c82,_0x1ff3ab){_0x507c82=_0x507c82-0x0;var _0x362b95=_0x5f16[_0x507c82];return _0x362b95;};'use strict';var util=require(_0x65f1('0x0'));var error={'E_AGI_UNDEFINED':_0x65f1('0x1'),'E_AGI_ARGUMENT_PORT':_0x65f1('0x2'),'E_AGI_SERVER_ERROR':_0x65f1('0x3'),'E_AGI_SERVER_CLOSE':_0x65f1('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x65f1('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x65f1('0x6'),'E_AGI_SOCKET_ERROR':_0x65f1('0x7'),'E_AGI_SOCKET_CLOSE':_0x65f1('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x65f1('0x9'),'E_AGI_COMMAND_EMPTY':_0x65f1('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x65f1('0xb'),'E_AGI_IVR_ENTRY':_0x65f1('0xc')};function AGIError(_0x10c98b){var _0x10c98b=_0x10c98b||null,_0x172412=_0x172412||[],_0x10191f=0x1,_0x33cc45='';if(!error[_0x10c98b]){_0x10c98b='E_AGI_UNDEFINED';}_0x172412[_0x65f1('0xd')](error[_0x10c98b]);while(arguments[_0x10191f]){_0x172412[_0x65f1('0xd')](arguments[_0x10191f]);_0x10191f++;}_0x33cc45=util[_0x65f1('0xe')][_0x65f1('0xf')](util,_0x172412);this['message']=_0x33cc45;this[_0x65f1('0x10')]=_0x10c98b;}module[_0x65f1('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 4114726..c520519 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba8=['exports','EventEmitter','./error','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xaba8,0x15f));var _0x8aba=function(_0x345f8a,_0x3095bc){_0x345f8a=_0x345f8a-0x0;var _0x25cac9=_0xaba8[_0x345f8a];return _0x25cac9;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x8aba('0x0')];var Redis=require('ioredis');var AGIError=require(_0x8aba('0x1'));var config=require('../../config/environment');config[_0x8aba('0x2')]=_[_0x8aba('0x3')](config[_0x8aba('0x2')],{'host':_0x8aba('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8aba('0x2')]);sub[_0x8aba('0x5')]('agi',function(_0x3175ea){if(_0x3175ea)return eventEmitter[_0x8aba('0x6')](_0x8aba('0x7'),new AGIError(_0x8aba('0x8'),_0x3175ea));});sub['on'](_0x8aba('0x9'),function(_0x1d4e95,_0x3c1cc6){if(_0x1d4e95!==_0x8aba('0xa'))return;try{var _0x5ed715=JSON[_0x8aba('0xb')](_0x3c1cc6);eventEmitter[_0x8aba('0x6')](_0x8aba('0xc'),_0x5ed715);}catch(_0x3c44af){eventEmitter[_0x8aba('0x6')](_0x8aba('0x7'),new AGIError(_0x8aba('0x8'),_0x3c44af));}});module[_0x8aba('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x45e5=['defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','events','EventEmitter','ioredis','./error','../../config/environment'];(function(_0x1e1f97,_0x2f6925){var _0x1e45fb=function(_0x2389ac){while(--_0x2389ac){_0x1e1f97['push'](_0x1e1f97['shift']());}};_0x1e45fb(++_0x2f6925);}(_0x45e5,0x1db));var _0x545e=function(_0x14b685,_0x1c5d77){_0x14b685=_0x14b685-0x0;var _0x4d9a32=_0x45e5[_0x14b685];return _0x4d9a32;};'use strict';var _=require('lodash');var EventEmitter=require(_0x545e('0x0'))[_0x545e('0x1')];var Redis=require(_0x545e('0x2'));var AGIError=require(_0x545e('0x3'));var config=require(_0x545e('0x4'));config['redis']=_[_0x545e('0x5')](config[_0x545e('0x6')],{'host':_0x545e('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x545e('0x6')]);sub[_0x545e('0x8')](_0x545e('0x9'),function(_0x541ce){if(_0x541ce)return eventEmitter[_0x545e('0xa')](_0x545e('0xb'),new AGIError(_0x545e('0xc'),_0x541ce));});sub['on']('message',function(_0x544256,_0x384df3){if(_0x544256!=='agi')return;try{var _0xa11173=JSON[_0x545e('0xd')](_0x384df3);eventEmitter[_0x545e('0xa')](_0x545e('0xe'),_0xa11173);}catch(_0x1e292c){eventEmitter['emit'](_0x545e('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x1e292c));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5a98b84..2d71ac3 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 _0xe5c7=['relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size'];(function(_0x31cae7,_0x297087){var _0x3f8521=function(_0x150422){while(--_0x150422){_0x31cae7['push'](_0x31cae7['shift']());}};_0x3f8521(++_0x297087);}(_0xe5c7,0xe0));var _0x7e5c=function(_0x494cf5,_0x47310f){_0x494cf5=_0x494cf5-0x0;var _0x6958d1=_0xe5c7[_0x494cf5];return _0x6958d1;};'use strict';var _=require(_0x7e5c('0x0'));var logger=require(_0x7e5c('0x1'))(_0x7e5c('0x2'));var verticesWithRetry=[_0x7e5c('0x3'),_0x7e5c('0x4'),_0x7e5c('0x5')];var Graph=function(){this[_0x7e5c('0x6')]={};this[_0x7e5c('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0x7e5c('0x8')][_0x7e5c('0x9')]=function(_0x3f735f){this[_0x7e5c('0x6')][_0x3f735f['id']]=_0x3f735f;this['edges'][_0x3f735f['id']]=[];};Graph[_0x7e5c('0x8')][_0x7e5c('0xa')]=function(_0x4bddc1,_0x3b3cf9,_0x4c59ce){this[_0x7e5c('0x7')][_0x4bddc1][_0x7e5c('0xb')]({'target':_0x3b3cf9,'condition':_0x4c59ce});this[_0x7e5c('0xc')]+=0x1;};Graph[_0x7e5c('0x8')][_0x7e5c('0xd')]=function(){return _[_0x7e5c('0xd')](this[_0x7e5c('0x6')]);};Graph['prototype'][_0x7e5c('0xe')]=function(){return this['numberOfEdges'];};Graph[_0x7e5c('0x8')][_0x7e5c('0xf')]=function(_0x191a59){return this['vertices'][_0x191a59];};Graph[_0x7e5c('0x8')]['traverseBFS']=function(_0x4953c5,_0x38a5c5){if(!this[_0x7e5c('0x6')][_0x4953c5]){return logger[_0x7e5c('0x10')](_0x7e5c('0x11'));}var _0x231b9f=_0x38a5c5(this[_0x7e5c('0x6')][_0x4953c5]);if(!_0x231b9f){return logger[_0x7e5c('0x10')](_0x7e5c('0x12'));}if(this[_0x7e5c('0x7')][_0x4953c5][_0x7e5c('0x13')]===0x0){return logger[_0x7e5c('0x10')](_0x7e5c('0x14'));}for(var _0x4bd02b=0x0,_0x5be6d4=[],_0x48d6f7=![];_0x4bd02b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','info','[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','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','./events'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4c43,0x6f));var _0x34c4=function(_0x52bea4,_0x3b4489){_0x52bea4=_0x52bea4-0x0;var _0x22766d=_0x4c43[_0x52bea4];return _0x22766d;};'use strict';var _=require(_0x34c4('0x0'));var syncho=require(_0x34c4('0x1'));var util=require(_0x34c4('0x2'));var config=require(_0x34c4('0x3'));var logger=require(_0x34c4('0x4'))(_0x34c4('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x34c4('0x6'));var Project=require(_0x34c4('0x7'));var AGIEmitter=require(_0x34c4('0x8'))[_0x34c4('0x9')];var projects=[];config[_0x34c4('0x5')]=_['defaults'](config[_0x34c4('0x5')],{'ip':_0x34c4('0xa'),'port':0x11dd});AGIEmitter['on'](_0x34c4('0xb'),projectUpdateHandler);function connectionHandler(_0x20c0c8){process[_0x34c4('0xc')](function(){syncho(function(){try{setChannelVariables(_0x20c0c8);agiHandler(_0x20c0c8);}catch(_0x5e3458){logger[_0x34c4('0xd')](_0x5e3458[_0x34c4('0xe')]);}});});}function projectUpdateHandler(_0x141e3d){try{var _0x39d8ab=_[_0x34c4('0xf')](projects,['id',_0x141e3d['id']]);if(_0x39d8ab>-0x1){if(_0x141e3d[_0x34c4('0x10')]===!![]){projects['splice'](_0x39d8ab,0x1);}else{projects[_0x39d8ab]=_0x141e3d;}}else{projects[_0x34c4('0x11')](_0x141e3d);}}catch(_0x67707d){logger[_0x34c4('0xd')](_0x67707d[_0x34c4('0xe')]);}}function listeningHandler(){console[_0x34c4('0x12')](_0x34c4('0x13'),config[_0x34c4('0x5')][_0x34c4('0x14')]);logger['info'](util[_0x34c4('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x34c4('0x5')]['ip'],config['agi'][_0x34c4('0x14')]));}function errorHandler(_0x371093){if(_0x371093&&_0x371093[_0x34c4('0x16')]&&_0x371093[_0x34c4('0x17')]){logger[_0x34c4('0xd')](util[_0x34c4('0x15')](_0x34c4('0x18'),_0x371093['name'],_0x371093[_0x34c4('0x17')]));}else{logger['error'](util['format'](_0x34c4('0x19'),_0x371093[_0x34c4('0xe')]));}}function closeHandler(){logger['info'](util[_0x34c4('0x15')](_0x34c4('0x1a'),this[_0x34c4('0x1b')],this[_0x34c4('0x1c')],this[_0x34c4('0x1d')],this[_0x34c4('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x6b2ce9){logger[_0x34c4('0xd')](_0x6b2ce9[_0x34c4('0xe')]);}}function timeoutHandler(){logger[_0x34c4('0x1f')](util[_0x34c4('0x15')](_0x34c4('0x20'),this[_0x34c4('0x1b')],this['calleridname'],this[_0x34c4('0x1d')],this[_0x34c4('0x1e')],this[_0x34c4('0x21')]));}function hangupHandler(){logger['info'](util[_0x34c4('0x15')](_0x34c4('0x22'),this[_0x34c4('0x1b')],this[_0x34c4('0x1c')],this[_0x34c4('0x1d')],this[_0x34c4('0x1e')],this[_0x34c4('0x21')]));this[_0x34c4('0x23')]=!![];}function createSquareReport(_0x448918,_0x58c7d6){rpc['createSquareReport'](_0x448918)[_0x34c4('0x24')](function(_0xc94aca){if(_0x58c7d6){_0x58c7d6(null,_0xc94aca);}})[_0x34c4('0x25')](function(_0x497d64){if(_0x58c7d6){_0x58c7d6(null,_0x497d64);}});}function setChannelVariables(_0x105d88){for(var _0x13a5ea in _0x105d88){if(_0x105d88[_0x34c4('0x26')](_0x13a5ea)){if(_0x13a5ea[_0x34c4('0x27')](_0x34c4('0x28'))===0x0){_0x105d88[_0x13a5ea[_0x34c4('0x29')](0x4)]=_0x105d88[_0x13a5ea];delete _0x105d88[_0x13a5ea];}}}}function agiHandler(_0x39954c){logger[_0x34c4('0x2a')](_0x34c4('0x2b'),JSON[_0x34c4('0x2c')](_0x39954c,null,0x2));logger[_0x34c4('0x1f')](util[_0x34c4('0x15')](_0x34c4('0x2d'),_0x39954c[_0x34c4('0x1b')],_0x39954c[_0x34c4('0x1c')],_0x39954c[_0x34c4('0x1d')],_0x39954c[_0x34c4('0x1e')],_0x39954c[_0x34c4('0x21')]));_0x39954c['on'](_0x34c4('0xd'),errorHandler);_0x39954c['on']('close',closeHandler);_0x39954c['on'](_0x34c4('0x2e'),timeoutHandler);_0x39954c['evtHangup']=![];_0x39954c['on'](_0x34c4('0x2f'),hangupHandler);var _0xe7d637=_[_0x34c4('0x30')](projects,[_0x34c4('0x16'),_0x39954c[_0x34c4('0x1b')]]);if(!_0xe7d637)return Project['handleNotFound'](_0x39954c);if(!_0xe7d637[_0x34c4('0x31')])return Project['handleUnpublished'](_0x39954c);return Project['initialize'](_0xe7d637,_0x39954c);}function main(){var _0x55ac73;return utilLicense[_0x34c4('0x32')]()[_0x34c4('0x24')](function(_0xc10ce2){if(!_0xc10ce2)return;if(_0xc10ce2['voice']){if(_0xc10ce2[_0x34c4('0x33')]&&_0xc10ce2[_0x34c4('0x33')]>0x0){logger[_0x34c4('0x1f')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0xc10ce2[_0x34c4('0x33')]));_0x55ac73=_0xc10ce2[_0x34c4('0x33')];}else{logger[_0x34c4('0x1f')](_0x34c4('0x34'));}}else{logger[_0x34c4('0x1f')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x55ac73=-0x1;}})[_0x34c4('0x24')](function(){return Project[_0x34c4('0x35')]();})[_0x34c4('0x24')](function(_0x4bf3e3){projects=_0x4bf3e3;return;})[_0x34c4('0x25')](function(_0x549f42){logger[_0x34c4('0xd')](_0x34c4('0x36'),_0x549f42[_0x34c4('0xe')]);})[_0x34c4('0x37')](function(){var _0x2f87b8=require(_0x34c4('0x38'))(config[_0x34c4('0x5')][_0x34c4('0x14')],config['agi']['ip'],_0x55ac73);_0x2f87b8['on'](_0x34c4('0xd'),errorHandler);_0x2f87b8['on'](_0x34c4('0x39'),listeningHandler);_0x2f87b8['on'](_0x34c4('0x3a'),connectionHandler);_0x2f87b8['on'](_0x34c4('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0x0699=['[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','finally','./server','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','defaults','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','production','initialize','getLicense','voice'];(function(_0xfe8162,_0x59b271){var _0xb2a8f3=function(_0x16f036){while(--_0x16f036){_0xfe8162['push'](_0xfe8162['shift']());}};_0xb2a8f3(++_0x59b271);}(_0x0699,0x156));var _0x9069=function(_0x26e4e5,_0x596354){_0x26e4e5=_0x26e4e5-0x0;var _0x19b7fb=_0x0699[_0x26e4e5];return _0x19b7fb;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x9069('0x0'));var config=require(_0x9069('0x1'));var logger=require(_0x9069('0x2'))('agi');var utilLicense=require(_0x9069('0x3'));var rpc=require('./rpc');var Project=require(_0x9069('0x4'));var AGIEmitter=require(_0x9069('0x5'))[_0x9069('0x6')];var projects=[];config['agi']=_[_0x9069('0x7')](config[_0x9069('0x8')],{'ip':_0x9069('0x9'),'port':0x11dd});AGIEmitter['on'](_0x9069('0xa'),projectUpdateHandler);function connectionHandler(_0x371792){process[_0x9069('0xb')](function(){syncho(function(){try{setChannelVariables(_0x371792);agiHandler(_0x371792);}catch(_0x243c94){logger[_0x9069('0xc')](_0x243c94[_0x9069('0xd')]);}});});}function projectUpdateHandler(_0x14892b){try{var _0x587a14=_[_0x9069('0xe')](projects,['id',_0x14892b['id']]);if(_0x587a14>-0x1){if(_0x14892b['deleted']===!![]){projects[_0x9069('0xf')](_0x587a14,0x1);}else{projects[_0x587a14]=_0x14892b;}}else{projects[_0x9069('0x10')](_0x14892b);}}catch(_0x20e0de){logger['error'](_0x20e0de[_0x9069('0xd')]);}}function listeningHandler(){console[_0x9069('0x11')](_0x9069('0x12'),config[_0x9069('0x8')][_0x9069('0x13')]);logger[_0x9069('0x14')](util[_0x9069('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x9069('0x8')]['ip'],config['agi'][_0x9069('0x13')]));}function errorHandler(_0x4d2d6a){if(_0x4d2d6a&&_0x4d2d6a[_0x9069('0x16')]&&_0x4d2d6a[_0x9069('0x17')]){logger[_0x9069('0xc')](util[_0x9069('0x15')](_0x9069('0x18'),_0x4d2d6a[_0x9069('0x16')],_0x4d2d6a[_0x9069('0x17')]));}else{logger[_0x9069('0xc')](util[_0x9069('0x15')](_0x9069('0x19'),_0x4d2d6a[_0x9069('0xd')]));}}function closeHandler(){logger[_0x9069('0x14')](util[_0x9069('0x15')](_0x9069('0x1a'),this['arg_1'],this['calleridname'],this[_0x9069('0x1b')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5cbfef){logger[_0x9069('0xc')](_0x5cbfef[_0x9069('0xd')]);}}function timeoutHandler(){logger[_0x9069('0x14')](util[_0x9069('0x15')](_0x9069('0x1c'),this[_0x9069('0x1d')],this['calleridname'],this[_0x9069('0x1b')],this['dnid'],this[_0x9069('0x1e')]));}function hangupHandler(){logger[_0x9069('0x14')](util[_0x9069('0x15')](_0x9069('0x1f'),this[_0x9069('0x1d')],this[_0x9069('0x20')],this['callerid'],this[_0x9069('0x21')],this[_0x9069('0x1e')]));this[_0x9069('0x22')]=!![];}function createSquareReport(_0x343cca,_0x209ae9){rpc[_0x9069('0x23')](_0x343cca)[_0x9069('0x24')](function(_0x1ac6ef){if(_0x209ae9){_0x209ae9(null,_0x1ac6ef);}})[_0x9069('0x25')](function(_0x246785){if(_0x209ae9){_0x209ae9(null,_0x246785);}});}function setChannelVariables(_0x2d1d64){for(var _0x5abf04 in _0x2d1d64){if(_0x2d1d64[_0x9069('0x26')](_0x5abf04)){if(_0x5abf04['indexOf'](_0x9069('0x27'))===0x0){_0x2d1d64[_0x5abf04[_0x9069('0x28')](0x4)]=_0x2d1d64[_0x5abf04];delete _0x2d1d64[_0x5abf04];}}}}function agiHandler(_0x462f39){logger[_0x9069('0x29')]('variables',JSON[_0x9069('0x2a')](_0x462f39,null,0x2));logger[_0x9069('0x14')](util[_0x9069('0x15')](_0x9069('0x2b'),_0x462f39['arg_1'],_0x462f39[_0x9069('0x20')],_0x462f39[_0x9069('0x1b')],_0x462f39[_0x9069('0x21')],_0x462f39[_0x9069('0x1e')]));_0x462f39['on'](_0x9069('0xc'),errorHandler);_0x462f39['on'](_0x9069('0x2c'),closeHandler);_0x462f39['on'](_0x9069('0x2d'),timeoutHandler);_0x462f39[_0x9069('0x22')]=![];_0x462f39['on']('hangup',hangupHandler);var _0x3e5097=_['find'](projects,[_0x9069('0x16'),_0x462f39[_0x9069('0x1d')]]);if(!_0x3e5097)return Project['handleNotFound'](_0x462f39);if(!_0x3e5097[_0x9069('0x2e')])return Project['handleUnpublished'](_0x462f39);return Project[_0x9069('0x2f')](_0x3e5097,_0x462f39);}function main(){var _0x20bec6;return utilLicense[_0x9069('0x30')]()[_0x9069('0x24')](function(_0x3852b5){if(!_0x3852b5)return;if(_0x3852b5[_0x9069('0x31')]){if(_0x3852b5['callysquare']&&_0x3852b5['callysquare']>0x0){logger[_0x9069('0x14')](util['format'](_0x9069('0x32'),_0x3852b5[_0x9069('0x33')]));_0x20bec6=_0x3852b5[_0x9069('0x33')];}else{logger[_0x9069('0x14')](_0x9069('0x34'));}}else{logger[_0x9069('0x14')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x20bec6=-0x1;}})[_0x9069('0x24')](function(){return Project[_0x9069('0x35')]();})[_0x9069('0x24')](function(_0x1ab1ce){projects=_0x1ab1ce;return;})[_0x9069('0x25')](function(_0x293ba5){logger[_0x9069('0xc')]('[LICENSE]',_0x293ba5[_0x9069('0xd')]);})[_0x9069('0x36')](function(){var _0x2ea801=require(_0x9069('0x37'))(config['agi'][_0x9069('0x13')],config[_0x9069('0x8')]['ip'],_0x20bec6);_0x2ea801['on'](_0x9069('0xc'),errorHandler);_0x2ea801['on']('listening',listeningHandler);_0x2ea801['on']('connection',connectionHandler);_0x2ea801['on'](_0x9069('0x2c'),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 6fa5342..872a712 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 _0x5c2f=['request','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x5dbfbf,_0x5206bc){var _0x4910b6=function(_0x23a99c){while(--_0x23a99c){_0x5dbfbf['push'](_0x5dbfbf['shift']());}};_0x4910b6(++_0x5206bc);}(_0x5c2f,0xc3));var _0xf5c2=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0x5c2f[_0x23b57c];return _0x4c3b1d;};'use strict';var BPromise=require(_0xf5c2('0x0'));var jayson=require(_0xf5c2('0x1'));var client=jayson['client'][_0xf5c2('0x2')]({'port':0x232b});function request(_0x4f9a63,_0x472c73){return new BPromise(function(_0x383988,_0x50a29c){return client[_0xf5c2('0x3')](_0x4f9a63,_0x472c73)['then'](function(_0x1a29a1){if(_0x1a29a1['error']){return _0x50a29c(_0x1a29a1[_0xf5c2('0x4')][_0xf5c2('0x5')]);}else{return _0x383988(_0x1a29a1[_0xf5c2('0x6')]);}})['catch'](function(_0x245bff){return _0x50a29c(_0x245bff);});});}exports[_0xf5c2('0x7')]=function(_0x1bd35c,_0x488740){return request(_0xf5c2('0x8'),{'account':_0x1bd35c,'message':_0x488740});}; \ No newline at end of file +var _0x2fb5=['bluebird','jayson/promise','client','http','request','then','message','result','sendMailMessage'];(function(_0x439745,_0x16a7cf){var _0x5d2287=function(_0x30b768){while(--_0x30b768){_0x439745['push'](_0x439745['shift']());}};_0x5d2287(++_0x16a7cf);}(_0x2fb5,0x1cb));var _0x52fb=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x2fb5[_0x1e2321];return _0x1d346d;};'use strict';var BPromise=require(_0x52fb('0x0'));var jayson=require(_0x52fb('0x1'));var client=jayson[_0x52fb('0x2')][_0x52fb('0x3')]({'port':0x232b});function request(_0x147888,_0xac63d7){return new BPromise(function(_0x29e09c,_0x5bcc4d){return client[_0x52fb('0x4')](_0x147888,_0xac63d7)[_0x52fb('0x5')](function(_0x11b915){if(_0x11b915['error']){return _0x5bcc4d(_0x11b915['error'][_0x52fb('0x6')]);}else{return _0x29e09c(_0x11b915[_0x52fb('0x7')]);}})['catch'](function(_0xe2f8e7){return _0x5bcc4d(_0xe2f8e7);});});}exports[_0x52fb('0x8')]=function(_0x3b74a8,_0x21b4bd){return request('SendMail',{'account':_0x3b74a8,'message':_0x21b4bd});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d411241..8a760a8 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf29f=['calleridname','callerid','dnid','uniqueid','traverseBFS','start','vertex','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','format','arg_1'];(function(_0x25756a,_0x503ffe){var _0x5e6b3f=function(_0x1ab3d9){while(--_0x1ab3d9){_0x25756a['push'](_0x25756a['shift']());}};_0x5e6b3f(++_0x503ffe);}(_0xf29f,0x1ac));var _0xff29=function(_0x460725,_0x408e6c){_0x460725=_0x460725-0x0;var _0x4321dc=_0xf29f[_0x460725];return _0x4321dc;};'use strict';var _=require(_0xff29('0x0'));var moment=require(_0xff29('0x1'));var parser=require(_0xff29('0x2'));var util=require('util');var logger=require(_0xff29('0x3'))(_0xff29('0x4'));var rpc=require(_0xff29('0x5'));var mailRpc=require(_0xff29('0x6'));var Graph=require(_0xff29('0x7'));var Vertices=require(_0xff29('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xff29('0x9')]()[_0xff29('0xa')](function(_0x46fdcf){logger['error'](_0xff29('0xb'),_0x46fdcf[_0xff29('0xc')]);return[];});}function addVertex(_0x183ea4,_0x49215c,_0x3d91d9){_0x49215c[_0xff29('0xd')]=_0x3d91d9;if(_0x49215c['hasOwnProperty'](_0xff29('0xe'))){_0x49215c['maxRetry']=parseInt(_0x49215c[_0xff29('0xe')],0xa);}_0x183ea4[_0xff29('0xf')](_[_0xff29('0x10')](_0x49215c,'mxCell'));}function initGraph(_0x2dc478,_0x2a44f0){var _0x2d74ce=new Graph();for(var _0x37ac9e in _0x2dc478){if(_0x2dc478[_0xff29('0x11')](_0x37ac9e)){if(_[_0xff29('0x12')](_0x2dc478[_0x37ac9e])){for(var _0x1052b9=0x0;_0x1052b9<_0x2dc478[_0x37ac9e][_0xff29('0x13')];_0x1052b9+=0x1){addVertex(_0x2d74ce,_0x2dc478[_0x37ac9e][_0x1052b9],_0x37ac9e);}}else{addVertex(_0x2d74ce,_0x2dc478[_0x37ac9e],_0x37ac9e);}}}for(var _0x49359c=0x0;_0x49359c<_0x2a44f0[_0xff29('0x13')];_0x49359c+=0x1){if(_0x2a44f0[_0x49359c][_0xff29('0x14')]&&_0x2a44f0[_0x49359c][_0xff29('0x15')]){_0x2d74ce[_0xff29('0x16')](_0x2a44f0[_0x49359c][_0xff29('0x14')],_0x2a44f0[_0x49359c][_0xff29('0x15')],_0x2a44f0[_0x49359c][_0xff29('0x17')]);}}return _0x2d74ce;}function getRoot(_0x5d233d){return parser[_0xff29('0x18')](_0x5d233d,{'object':!![]})[_0xff29('0x19')][_0xff29('0x1a')];}function inspect(_0xcf5549){return util[_0xff29('0x1b')](_0xcf5549,{'showHidden':![],'depth':null});}function initialize(_0x184438,_0xda5c48){var _0x16522=getRoot(_0x184438['production']);if(!_0x16522||!_0x16522['start'])return;var _0x43be6a,_0x17b542,_0xe8db44;logger[_0xff29('0x1c')](_0xff29('0x1a'),JSON['stringify'](_0x16522,null,0x2));_0xda5c48[_0xff29('0x1d')]=moment()['format'](_0xff29('0x1e'));_0x43be6a=initGraph(_[_0xff29('0x10')](_0x16522,_0xff29('0x1f')),_0x16522[_0xff29('0x1f')]);_0x17b542=new Vertices(_0xda5c48,rpc,mailRpc);logger['info'](util[_0xff29('0x20')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xda5c48[_0xff29('0x21')],_0xda5c48[_0xff29('0x22')],_0xda5c48[_0xff29('0x23')],_0xda5c48[_0xff29('0x24')],_0xda5c48[_0xff29('0x25')]));_0x43be6a[_0xff29('0x26')](_0x16522[_0xff29('0x27')]['id'],function(_0xf52f66){try{_0xf52f66=_0x17b542['clear'](_0xf52f66);logger[_0xff29('0x1c')](_0xff29('0x28'),JSON[_0xff29('0x29')](_0xf52f66,null,0x2));if(_0xf52f66['agicommand']===_0xff29('0x2a')){logger[_0xff29('0x2b')](_0xff29('0x2c'));_0xda5c48['context']=_0xf52f66['context']||_0xda5c48[_0xff29('0x2d')];_0xda5c48[_0xff29('0x2e')]=_0xf52f66[_0xff29('0x2e')];_0xda5c48[_0xff29('0x2f')]=_0xf52f66[_0xff29('0x2f')]?_0xf52f66[_0xff29('0x2f')]-0x1:0x1;return null;}else if(_0xf52f66&&_0x17b542[_0xf52f66[_0xff29('0xd')]]){_0xe8db44=_0x17b542[_0xf52f66[_0xff29('0xd')]](_0xf52f66);logger[_0xff29('0x2b')](_0xff29('0x30'),JSON[_0xff29('0x29')](_0xe8db44,null,0x2));if(_0xe8db44&&_0xe8db44[_0xff29('0x31')]===AGI_CODE_SUCCESS&&_0xe8db44['result']!==AGI_RESULT_ERROR&&!_0xda5c48[_0xff29('0x32')]){logger[_0xff29('0x1c')]('response',inspect(_0xe8db44));return _[_0xff29('0x33')](_0xe8db44[_0xff29('0x34')])?null:_0xe8db44[_0xff29('0x34')][_0xff29('0x35')]();}else{logger[_0xff29('0x36')](_0xff29('0x30'),inspect(_0xe8db44));return null;}}else{logger[_0xff29('0x36')](_0xff29('0x37'));return null;}}catch(_0x1f0b5d){logger[_0xff29('0x36')](_0x1f0b5d[_0xff29('0xc')]);return null;}});if(_0x16522[_0xff29('0x38')]){logger[_0xff29('0x2b')](util[_0xff29('0x20')](_0xff29('0x39'),_0xda5c48[_0xff29('0x21')],_0xda5c48[_0xff29('0x22')],_0xda5c48[_0xff29('0x23')],_0xda5c48[_0xff29('0x24')],_0xda5c48[_0xff29('0x25')]));_0x43be6a[_0xff29('0x26')](_0x16522[_0xff29('0x38')]['id'],function(_0x17c856){try{_0x17c856=_0x17b542[_0xff29('0x3a')](_0x17c856);logger[_0xff29('0x1c')](_0xff29('0x28'),JSON[_0xff29('0x29')](_0x17c856,null,0x2));if(_0x17c856&&_0x17b542[_0x17c856[_0xff29('0xd')]]){_0xe8db44=_0x17b542[_0x17c856['agicommand']](_0x17c856);if(_0xe8db44){logger[_0xff29('0x1c')](_0xff29('0x30'),inspect(_0xe8db44));return _[_0xff29('0x33')](_0xe8db44[_0xff29('0x34')])?null:_0xe8db44['result'][_0xff29('0x35')]();}else{logger[_0xff29('0x36')]('response',inspect(_0xe8db44));return null;}}else{logger[_0xff29('0x36')]('agicommand\x20not\x20found');return null;}}catch(_0x43899a){logger[_0xff29('0x36')](_0x43899a['stack']);return null;}});}logger['info'](util['format'](_0xff29('0x3b'),_0xda5c48['arg_1'],_0xda5c48[_0xff29('0x22')],_0xda5c48['callerid'],_0xda5c48[_0xff29('0x24')],_0xda5c48[_0xff29('0x25')]));logger[_0xff29('0x2b')](util[_0xff29('0x20')](_0xff29('0x3c'),_0xda5c48[_0xff29('0x2d')],_0xda5c48[_0xff29('0x2e')],parseInt(_0xda5c48['priority'],0xa)+0x1));_0xda5c48[_0xff29('0x3d')](_0xda5c48[_0xff29('0x2d')],_0xda5c48['extension'],parseInt(_0xda5c48[_0xff29('0x2f')],0xa)+0x1);_0xda5c48[_0xff29('0x3e')]();}function handleNotFound(_0x4736f4){logger[_0xff29('0x36')](util[_0xff29('0x20')](_0xff29('0x3f'),_0x4736f4[_0xff29('0x21')]));_0x4736f4[_0xff29('0x3d')](_0x4736f4['context'],_0x4736f4['extension'],parseInt(_0x4736f4[_0xff29('0x2f')],0xa)+0x1);_0x4736f4[_0xff29('0x3e')]();}function handleUnpublished(_0x2d9c5a){logger['error'](util['format'](_0xff29('0x40'),_0x2d9c5a[_0xff29('0x21')]));_0x2d9c5a['continueAt'](_0x2d9c5a[_0xff29('0x2d')],_0x2d9c5a[_0xff29('0x2e')],parseInt(_0x2d9c5a[_0xff29('0x2f')],0xa)+0x1);_0x2d9c5a['close']();}module[_0xff29('0x41')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xbd90=['format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','start','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','isUndefined','toString','error','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','debug','stringify','joinAt'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xbd90,0x1f1));var _0x0bd9=function(_0x52502c,_0x38ba96){_0x52502c=_0x52502c-0x0;var _0x2216d0=_0xbd90[_0x52502c];return _0x2216d0;};'use strict';var _=require(_0x0bd9('0x0'));var moment=require(_0x0bd9('0x1'));var parser=require(_0x0bd9('0x2'));var util=require(_0x0bd9('0x3'));var logger=require(_0x0bd9('0x4'))(_0x0bd9('0x5'));var rpc=require(_0x0bd9('0x6'));var mailRpc=require(_0x0bd9('0x7'));var Graph=require('./graph');var Vertices=require(_0x0bd9('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x0bd9('0x9')]()[_0x0bd9('0xa')](function(_0x7313de){logger['error'](_0x0bd9('0xb'),_0x7313de['stack']);return[];});}function addVertex(_0x58ebe0,_0x517ff2,_0x515d31){_0x517ff2[_0x0bd9('0xc')]=_0x515d31;if(_0x517ff2[_0x0bd9('0xd')](_0x0bd9('0xe'))){_0x517ff2['maxRetry']=parseInt(_0x517ff2[_0x0bd9('0xe')],0xa);}_0x58ebe0[_0x0bd9('0xf')](_[_0x0bd9('0x10')](_0x517ff2,'mxCell'));}function initGraph(_0x40e037,_0x2406a6){var _0x244c23=new Graph();for(var _0x576a84 in _0x40e037){if(_0x40e037['hasOwnProperty'](_0x576a84)){if(_[_0x0bd9('0x11')](_0x40e037[_0x576a84])){for(var _0x47c371=0x0;_0x47c371<_0x40e037[_0x576a84][_0x0bd9('0x12')];_0x47c371+=0x1){addVertex(_0x244c23,_0x40e037[_0x576a84][_0x47c371],_0x576a84);}}else{addVertex(_0x244c23,_0x40e037[_0x576a84],_0x576a84);}}}for(var _0xea2830=0x0;_0xea2830<_0x2406a6[_0x0bd9('0x12')];_0xea2830+=0x1){if(_0x2406a6[_0xea2830][_0x0bd9('0x13')]&&_0x2406a6[_0xea2830][_0x0bd9('0x14')]){_0x244c23[_0x0bd9('0x15')](_0x2406a6[_0xea2830]['source'],_0x2406a6[_0xea2830][_0x0bd9('0x14')],_0x2406a6[_0xea2830][_0x0bd9('0x16')]);}}return _0x244c23;}function getRoot(_0x1ee18a){return parser[_0x0bd9('0x17')](_0x1ee18a,{'object':!![]})[_0x0bd9('0x18')][_0x0bd9('0x19')];}function inspect(_0x581d6e){return util[_0x0bd9('0x1a')](_0x581d6e,{'showHidden':![],'depth':null});}function initialize(_0x1ad919,_0x3c7eea){var _0x5294c4=getRoot(_0x1ad919[_0x0bd9('0x1b')]);if(!_0x5294c4||!_0x5294c4['start'])return;var _0x3ebfa8,_0x20c534,_0x317a7c;logger[_0x0bd9('0x1c')]('root',JSON[_0x0bd9('0x1d')](_0x5294c4,null,0x2));_0x3c7eea[_0x0bd9('0x1e')]=moment()[_0x0bd9('0x1f')](_0x0bd9('0x20'));_0x3ebfa8=initGraph(_[_0x0bd9('0x10')](_0x5294c4,_0x0bd9('0x21')),_0x5294c4[_0x0bd9('0x21')]);_0x20c534=new Vertices(_0x3c7eea,rpc,mailRpc);logger['info'](util[_0x0bd9('0x1f')](_0x0bd9('0x22'),_0x3c7eea[_0x0bd9('0x23')],_0x3c7eea[_0x0bd9('0x24')],_0x3c7eea[_0x0bd9('0x25')],_0x3c7eea[_0x0bd9('0x26')],_0x3c7eea['uniqueid']));_0x3ebfa8[_0x0bd9('0x27')](_0x5294c4[_0x0bd9('0x28')]['id'],function(_0x15d13b){try{_0x15d13b=_0x20c534[_0x0bd9('0x29')](_0x15d13b);logger[_0x0bd9('0x1c')](_0x0bd9('0x2a'),JSON[_0x0bd9('0x1d')](_0x15d13b,null,0x2));if(_0x15d13b[_0x0bd9('0xc')]===_0x0bd9('0x2b')){logger[_0x0bd9('0x2c')](_0x0bd9('0x2d'));_0x3c7eea[_0x0bd9('0x2e')]=_0x15d13b[_0x0bd9('0x2e')]||_0x3c7eea[_0x0bd9('0x2e')];_0x3c7eea[_0x0bd9('0x2f')]=_0x15d13b[_0x0bd9('0x2f')];_0x3c7eea[_0x0bd9('0x30')]=_0x15d13b[_0x0bd9('0x30')]?_0x15d13b[_0x0bd9('0x30')]-0x1:0x1;return null;}else if(_0x15d13b&&_0x20c534[_0x15d13b[_0x0bd9('0xc')]]){_0x317a7c=_0x20c534[_0x15d13b[_0x0bd9('0xc')]](_0x15d13b);logger[_0x0bd9('0x2c')]('response',JSON[_0x0bd9('0x1d')](_0x317a7c,null,0x2));if(_0x317a7c&&_0x317a7c['code']===AGI_CODE_SUCCESS&&_0x317a7c[_0x0bd9('0x31')]!==AGI_RESULT_ERROR&&!_0x3c7eea['evtHangup']){logger[_0x0bd9('0x1c')](_0x0bd9('0x32'),inspect(_0x317a7c));return _[_0x0bd9('0x33')](_0x317a7c['result'])?null:_0x317a7c[_0x0bd9('0x31')][_0x0bd9('0x34')]();}else{logger['error'](_0x0bd9('0x32'),inspect(_0x317a7c));return null;}}else{logger[_0x0bd9('0x35')](_0x0bd9('0x36'));return null;}}catch(_0x6d3024){logger['error'](_0x6d3024[_0x0bd9('0x37')]);return null;}});if(_0x5294c4[_0x0bd9('0x38')]){logger[_0x0bd9('0x2c')](util[_0x0bd9('0x1f')](_0x0bd9('0x39'),_0x3c7eea[_0x0bd9('0x23')],_0x3c7eea[_0x0bd9('0x24')],_0x3c7eea[_0x0bd9('0x25')],_0x3c7eea[_0x0bd9('0x26')],_0x3c7eea[_0x0bd9('0x3a')]));_0x3ebfa8[_0x0bd9('0x27')](_0x5294c4['finally']['id'],function(_0x3547ee){try{_0x3547ee=_0x20c534['clear'](_0x3547ee);logger[_0x0bd9('0x1c')](_0x0bd9('0x2a'),JSON[_0x0bd9('0x1d')](_0x3547ee,null,0x2));if(_0x3547ee&&_0x20c534[_0x3547ee[_0x0bd9('0xc')]]){_0x317a7c=_0x20c534[_0x3547ee[_0x0bd9('0xc')]](_0x3547ee);if(_0x317a7c){logger[_0x0bd9('0x1c')](_0x0bd9('0x32'),inspect(_0x317a7c));return _[_0x0bd9('0x33')](_0x317a7c[_0x0bd9('0x31')])?null:_0x317a7c[_0x0bd9('0x31')][_0x0bd9('0x34')]();}else{logger['error'](_0x0bd9('0x32'),inspect(_0x317a7c));return null;}}else{logger[_0x0bd9('0x35')](_0x0bd9('0x36'));return null;}}catch(_0x262571){logger[_0x0bd9('0x35')](_0x262571[_0x0bd9('0x37')]);return null;}});}logger[_0x0bd9('0x2c')](util['format'](_0x0bd9('0x3b'),_0x3c7eea[_0x0bd9('0x23')],_0x3c7eea['calleridname'],_0x3c7eea[_0x0bd9('0x25')],_0x3c7eea[_0x0bd9('0x26')],_0x3c7eea['uniqueid']));logger['info'](util[_0x0bd9('0x1f')](_0x0bd9('0x3c'),_0x3c7eea[_0x0bd9('0x2e')],_0x3c7eea[_0x0bd9('0x2f')],parseInt(_0x3c7eea[_0x0bd9('0x30')],0xa)+0x1));_0x3c7eea[_0x0bd9('0x3d')](_0x3c7eea[_0x0bd9('0x2e')],_0x3c7eea[_0x0bd9('0x2f')],parseInt(_0x3c7eea[_0x0bd9('0x30')],0xa)+0x1);_0x3c7eea[_0x0bd9('0x3e')]();}function handleNotFound(_0x476b5d){logger[_0x0bd9('0x35')](util[_0x0bd9('0x1f')](_0x0bd9('0x3f'),_0x476b5d['arg_1']));_0x476b5d[_0x0bd9('0x3d')](_0x476b5d[_0x0bd9('0x2e')],_0x476b5d[_0x0bd9('0x2f')],parseInt(_0x476b5d[_0x0bd9('0x30')],0xa)+0x1);_0x476b5d['close']();}function handleUnpublished(_0x46b25f){logger['error'](util[_0x0bd9('0x1f')](_0x0bd9('0x40'),_0x46b25f[_0x0bd9('0x23')]));_0x46b25f[_0x0bd9('0x3d')](_0x46b25f[_0x0bd9('0x2e')],_0x46b25f[_0x0bd9('0x2f')],parseInt(_0x46b25f['priority'],0xa)+0x1);_0x46b25f[_0x0bd9('0x3e')]();}module[_0x0bd9('0x41')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index aab8478..f20bb08 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 _0x46aa=['\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x11ba73,_0x492101){var _0xe1046e=function(_0x43b613){while(--_0x43b613){_0x11ba73['push'](_0x11ba73['shift']());}};_0xe1046e(++_0x492101);}(_0x46aa,0x90));var _0xa46a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x46aa[_0x3fba9f];return _0x192cf1;};'use strict';var util=require(_0xa46a('0x0'));var Transform=require(_0xa46a('0x1'))[_0xa46a('0x2')];function AGIReply(_0x5ec776){Transform['call'](this,_0x5ec776);this[_0xa46a('0x3')]='';this[_0xa46a('0x4')]=![];}util[_0xa46a('0x5')](AGIReply,Transform);AGIReply[_0xa46a('0x6')][_0xa46a('0x7')]=function(_0x7f5238,_0x5a1a40,_0x17a0fc){var _0x598b49='\x0a',_0x2fb972=['\x0a\x0a',_0xa46a('0x8')],_0x44529e=-0x1,_0x23ab8f=-0x1,_0x34c66e='',_0x237932=0x0,_0x392091='',_0x79d489='';this[_0xa46a('0x3')]+=_0x7f5238['toString']();_0x392091=this['_localBuffer'];if(!this[_0xa46a('0x4')]){_0x237932=0x0;while(_0x2fb972[_0x237932]){while((_0x23ab8f=_0x392091[_0xa46a('0x9')](_0x2fb972[_0x237932]))!=-0x1){_0x34c66e=_0x2fb972[_0x237932];_0x79d489=_0x392091[_0xa46a('0xa')](0x0,_0x23ab8f);_0x392091=_0x392091[_0xa46a('0xa')](_0x23ab8f+_0x34c66e[_0xa46a('0xb')]);var _0x1993db=_0x79d489[_0xa46a('0xc')](_0x598b49),_0x144c3b=0x0,_0x55b51d={},_0x3fc908='',_0x277377='',_0x4db70b=-0x1;while(_0x1993db[_0x144c3b]){_0x4db70b=_0x1993db[_0x144c3b][_0xa46a('0x9')](':');if(_0x4db70b!=-0x1){_0x3fc908=_0x1993db[_0x144c3b][_0xa46a('0xd')](0x0,_0x4db70b)[_0xa46a('0xe')]();_0x277377=_0x1993db[_0x144c3b][_0xa46a('0xd')](_0x4db70b+0x1)[_0xa46a('0xe')]();if(_0x3fc908['length']>0x0){_0x55b51d[_0x3fc908]=_0x277377;}}else{}_0x144c3b++;}this[_0xa46a('0xf')](_0xa46a('0x10'),_0x55b51d);this[_0xa46a('0x4')]=!![];}_0x237932++;}this[_0xa46a('0x3')]=_0x392091;}else{while((_0x44529e=_0x392091['indexOf'](_0x598b49))!=-0x1){_0x79d489=_0x392091[_0xa46a('0xa')](0x0,_0x44529e);this['emit'](_0xa46a('0x11'),_0x79d489);_0x392091=_0x392091['substring'](_0x44529e+_0x598b49[_0xa46a('0xb')]);}this[_0xa46a('0x3')]=_0x392091;}_0x17a0fc();};module[_0xa46a('0x12')]=AGIReply; \ No newline at end of file +var _0xb447=['trim','length','emit','headers','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb447,0x9e));var _0x7b44=function(_0xeb5141,_0x21cdaa){_0xeb5141=_0xeb5141-0x0;var _0x503270=_0xb447[_0xeb5141];return _0x503270;};'use strict';var util=require('util');var Transform=require(_0x7b44('0x0'))[_0x7b44('0x1')];function AGIReply(_0x305b75){Transform[_0x7b44('0x2')](this,_0x305b75);this[_0x7b44('0x3')]='';this[_0x7b44('0x4')]=![];}util[_0x7b44('0x5')](AGIReply,Transform);AGIReply[_0x7b44('0x6')]['_transform']=function(_0x25f99f,_0x1e7e86,_0x5c8af1){var _0xb2ed63='\x0a',_0x174da3=['\x0a\x0a',_0x7b44('0x7')],_0x4c0667=-0x1,_0x1efadf=-0x1,_0x52bc34='',_0xe4fed1=0x0,_0x2939cc='',_0x5dd091='';this[_0x7b44('0x3')]+=_0x25f99f[_0x7b44('0x8')]();_0x2939cc=this['_localBuffer'];if(!this[_0x7b44('0x4')]){_0xe4fed1=0x0;while(_0x174da3[_0xe4fed1]){while((_0x1efadf=_0x2939cc[_0x7b44('0x9')](_0x174da3[_0xe4fed1]))!=-0x1){_0x52bc34=_0x174da3[_0xe4fed1];_0x5dd091=_0x2939cc[_0x7b44('0xa')](0x0,_0x1efadf);_0x2939cc=_0x2939cc[_0x7b44('0xa')](_0x1efadf+_0x52bc34['length']);var _0x5a67ae=_0x5dd091['split'](_0xb2ed63),_0xe3cfb2=0x0,_0x297a90={},_0x34e649='',_0x46f681='',_0x5acb91=-0x1;while(_0x5a67ae[_0xe3cfb2]){_0x5acb91=_0x5a67ae[_0xe3cfb2]['indexOf'](':');if(_0x5acb91!=-0x1){_0x34e649=_0x5a67ae[_0xe3cfb2][_0x7b44('0xb')](0x0,_0x5acb91)[_0x7b44('0xc')]();_0x46f681=_0x5a67ae[_0xe3cfb2]['slice'](_0x5acb91+0x1)['trim']();if(_0x34e649[_0x7b44('0xd')]>0x0){_0x297a90[_0x34e649]=_0x46f681;}}else{}_0xe3cfb2++;}this[_0x7b44('0xe')](_0x7b44('0xf'),_0x297a90);this[_0x7b44('0x4')]=!![];}_0xe4fed1++;}this['_localBuffer']=_0x2939cc;}else{while((_0x4c0667=_0x2939cc[_0x7b44('0x9')](_0xb2ed63))!=-0x1){_0x5dd091=_0x2939cc[_0x7b44('0xa')](0x0,_0x4c0667);this[_0x7b44('0xe')]('line',_0x5dd091);_0x2939cc=_0x2939cc[_0x7b44('0xa')](_0x4c0667+_0xb2ed63[_0x7b44('0xd')]);}this[_0x7b44('0x3')]=_0x2939cc;}_0x5c8af1();};module[_0x7b44('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2c9aca3..b05dd76 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 _0xed1f=['jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','name','getSquareProject','production','ShowMailAccount','CloudProvider','email','ShowSquareProject','getVariableById','ShowVariable','dsn','getUserById','ShowUser','phone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment'];(function(_0x4708ec,_0x396470){var _0x1d1d9d=function(_0x4b5168){while(--_0x4b5168){_0x4708ec['push'](_0x4708ec['shift']());}};_0x1d1d9d(++_0x396470);}(_0xed1f,0x6a));var _0xfed1=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xed1f[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));var jayson=require(_0xfed1('0x2'));var client=jayson[_0xfed1('0x3')][_0xfed1('0x4')]({'port':0x2329});function request(_0x25f345,_0x1dd614){return new Promise(function(_0xa68587,_0x2209b3){return client[_0xfed1('0x5')](_0x25f345,_0x1dd614)[_0xfed1('0x6')](function(_0xd2c769){if(_0xd2c769[_0xfed1('0x7')]){return _0x2209b3(_0xd2c769[_0xfed1('0x7')][_0xfed1('0x8')]);}else{return _0xa68587(_0xd2c769[_0xfed1('0x9')]);}})[_0xfed1('0xa')](function(_0x2967ef){return _0x2209b3(_0x2967ef);});});}exports['getSquareProjects']=function(){return request(_0xfed1('0xb'),{'options':{'raw':![],'attributes':['id',_0xfed1('0xc'),'production']}});};exports[_0xfed1('0xd')]=function(_0x7bf48c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x7bf48c},'attributes':[_0xfed1('0xe')]}});};exports['getMailAccountById']=function(_0x1c3f40){return request(_0xfed1('0xf'),{'options':{'raw':![],'where':{'id':_0x1c3f40},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xfed1('0x10'),'as':_0xfed1('0x10')}]}],'attributes':['id','name',_0xfed1('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x529b3d){return request(_0xfed1('0x12'),{'options':{'where':{'id':_0x529b3d},'attributes':[_0xfed1('0xc')]}});};exports['getVoiceQueueById']=function(_0x2dde3a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2dde3a},'attributes':['name']}});};exports[_0xfed1('0x13')]=function(_0x39aa0c){return request(_0xfed1('0x14'),{'options':{'where':{'id':_0x39aa0c},'attributes':[_0xfed1('0xc')]}});};exports['getSquareOdbcById']=function(_0x1a00f6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1a00f6},'attributes':[_0xfed1('0x15')]}});};exports[_0xfed1('0x16')]=function(_0x489a0f){return request(_0xfed1('0x17'),{'options':{'where':{'id':_0x489a0f},'attributes':[_0xfed1('0xc')]}});};exports['getContactByPhone']=function(_0x59509b){return request('GetContactByPhone',{'options':{'where':{'phone':_0x59509b[_0xfed1('0x18')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x201f18){return request(_0xfed1('0x19'),{'options':{'where':{'id':_0x201f18},'attributes':['name']}});};exports[_0xfed1('0x1a')]=function(_0x65f14b){return request('ShowSound',{'options':{'where':{'id':_0x65f14b},'attributes':[_0xfed1('0x1b')]}});};exports[_0xfed1('0x1c')]=function(_0xff4842){return request(_0xfed1('0x1d'),{'options':{'raw':![],'where':{'id':_0xff4842},'include':[{'model':'Interval','as':_0xfed1('0x1e')}]}});};exports['getSmsAccountById']=function(_0x446558){return request(_0xfed1('0x1f'),{'options':{'where':{'id':_0x446558},'attributes':['id',_0xfed1('0xc')]}});};exports['createSmsMessage']=function(_0x41d22c){return request('CreateSmsMessage',{'body':_0x41d22c});};exports[_0xfed1('0x20')]=function(_0x2793b7){return request(_0xfed1('0x21'),{'body':_0x2793b7});};exports[_0xfed1('0x22')]=function(_0x186ecc){return request(_0xfed1('0x23'),{'body':_['merge'](_0x186ecc,{'project_name':_0x186ecc[_0xfed1('0x24')],'prev_project_name':_0x186ecc[_0xfed1('0x25')]||'','is_subproject':_0x186ecc['arg_2']?!![]:![],'leaveAt':moment()[_0xfed1('0x26')](_0xfed1('0x27'))})});};exports[_0xfed1('0x28')]=function(_0x1d62c5){return request(_0xfed1('0x29'),{'body':_0x1d62c5});};exports[_0xfed1('0x2a')]=function(_0x583953){return request(_0xfed1('0x2b'),{'body':_0x583953});};exports['createCmContact']=function(_0x3106ee){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3106ee['phone'],'ListId':_0x3106ee[_0xfed1('0x2c')]}}})[_0xfed1('0x6')](function(_0x2d334e){if(_0x2d334e){return _0x2d334e;}return request('CreateCmContact',{'body':_0x3106ee});});};exports[_0xfed1('0x2d')]=function(_0x437a25){return request(_0xfed1('0x2e'),{'options':{'where':{'id':_0x437a25},'attributes':[_0xfed1('0xc')]}});};exports[_0xfed1('0x2f')]=function(_0x30272b,_0x5ccc3a){return request(_0xfed1('0x30'),{'body':{'interface':_0x5ccc3a},'options':{'where':_0x30272b}});};exports[_0xfed1('0x31')]=function(_0x4fc309,_0x47a90c,_0x28bd98){return request(_0xfed1('0x32'),{'body':{'type':_0x47a90c,'uniqueid':_0x28bd98},'options':{'where':_0x4fc309}});};exports[_0xfed1('0x33')]=function(_0x71147f){return request(_0xfed1('0x34'),{'body':{},'options':{'where':_0x71147f}});};exports['agentLogout']=function(_0xecd1ec){return request(_0xfed1('0x35'),{'body':{},'options':{'where':_0xecd1ec}});}; \ No newline at end of file +var _0x9ade=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport'];(function(_0x4745c3,_0x449916){var _0xb33c27=function(_0x36938f){while(--_0x36938f){_0x4745c3['push'](_0x4745c3['shift']());}};_0xb33c27(++_0x449916);}(_0x9ade,0x107));var _0xe9ad=function(_0x1e5a0c,_0x3a16fc){_0x1e5a0c=_0x1e5a0c-0x0;var _0x5cc15b=_0x9ade[_0x1e5a0c];return _0x5cc15b;};'use strict';var _=require(_0xe9ad('0x0'));var moment=require(_0xe9ad('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe9ad('0x2')]({'port':0x2329});function request(_0x55d83d,_0xeb076b){return new Promise(function(_0x38d722,_0x4d4ee0){return client['request'](_0x55d83d,_0xeb076b)[_0xe9ad('0x3')](function(_0xa1180b){if(_0xa1180b[_0xe9ad('0x4')]){return _0x4d4ee0(_0xa1180b[_0xe9ad('0x4')][_0xe9ad('0x5')]);}else{return _0x38d722(_0xa1180b[_0xe9ad('0x6')]);}})[_0xe9ad('0x7')](function(_0x1a297b){return _0x4d4ee0(_0x1a297b);});});}exports['getSquareProjects']=function(){return request(_0xe9ad('0x8'),{'options':{'raw':![],'attributes':['id',_0xe9ad('0x9'),_0xe9ad('0xa')]}});};exports[_0xe9ad('0xb')]=function(_0x268c04){return request(_0xe9ad('0xc'),{'options':{'raw':![],'where':{'name':_0x268c04},'attributes':[_0xe9ad('0xa')]}});};exports[_0xe9ad('0xd')]=function(_0x2d1ed2){return request(_0xe9ad('0xe'),{'options':{'raw':![],'where':{'id':_0x2d1ed2},'include':[{'model':_0xe9ad('0xf'),'as':_0xe9ad('0x10'),'include':[{'model':'CloudProvider','as':_0xe9ad('0x11')}]}],'attributes':['id',_0xe9ad('0x9'),_0xe9ad('0x12')],'smtp':!![]}});};exports[_0xe9ad('0x13')]=function(_0x502749){return request(_0xe9ad('0xc'),{'options':{'where':{'id':_0x502749},'attributes':[_0xe9ad('0x9')]}});};exports[_0xe9ad('0x14')]=function(_0x208416){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x208416},'attributes':[_0xe9ad('0x9')]}});};exports['getVariableById']=function(_0x302f52){return request('ShowVariable',{'options':{'where':{'id':_0x302f52},'attributes':[_0xe9ad('0x9')]}});};exports[_0xe9ad('0x15')]=function(_0x2b5201){return request(_0xe9ad('0x16'),{'options':{'where':{'id':_0x2b5201},'attributes':['dsn']}});};exports[_0xe9ad('0x17')]=function(_0x2a79cb){return request(_0xe9ad('0x18'),{'options':{'where':{'id':_0x2a79cb},'attributes':[_0xe9ad('0x9')]}});};exports[_0xe9ad('0x19')]=function(_0x1a55f9){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1a55f9[_0xe9ad('0x1a')]},'attributes':['id']}});};exports[_0xe9ad('0x1b')]=function(_0x3d95fd){return request(_0xe9ad('0x1c'),{'options':{'where':{'id':_0x3d95fd},'attributes':[_0xe9ad('0x9')]}});};exports[_0xe9ad('0x1d')]=function(_0x3d474b){return request(_0xe9ad('0x1e'),{'options':{'where':{'id':_0x3d474b},'attributes':[_0xe9ad('0x1f')]}});};exports['getIntervalById']=function(_0x46d8cb){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x46d8cb},'include':[{'model':_0xe9ad('0x20'),'as':'Intervals'}]}});};exports[_0xe9ad('0x21')]=function(_0x31f151){return request(_0xe9ad('0x22'),{'options':{'where':{'id':_0x31f151},'attributes':['id',_0xe9ad('0x9')]}});};exports[_0xe9ad('0x23')]=function(_0x479856){return request('CreateSmsMessage',{'body':_0x479856});};exports[_0xe9ad('0x24')]=function(_0x2d2ef4){return request(_0xe9ad('0x25'),{'body':_0x2d2ef4});};exports[_0xe9ad('0x26')]=function(_0x331759){return request(_0xe9ad('0x27'),{'body':_[_0xe9ad('0x28')](_0x331759,{'project_name':_0x331759[_0xe9ad('0x29')],'prev_project_name':_0x331759['arg_2']||'','is_subproject':_0x331759[_0xe9ad('0x2a')]?!![]:![],'leaveAt':moment()[_0xe9ad('0x2b')](_0xe9ad('0x2c'))})});};exports[_0xe9ad('0x2d')]=function(_0x55299c){return request(_0xe9ad('0x2e'),{'body':_0x55299c});};exports[_0xe9ad('0x2f')]=function(_0x2b3e34){return request(_0xe9ad('0x30'),{'body':_0x2b3e34});};exports[_0xe9ad('0x31')]=function(_0x3d64ff){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3d64ff[_0xe9ad('0x1a')],'ListId':_0x3d64ff[_0xe9ad('0x32')]}}})[_0xe9ad('0x3')](function(_0x310973){if(_0x310973){return _0x310973;}return request('CreateCmContact',{'body':_0x3d64ff});});};exports[_0xe9ad('0x33')]=function(_0x319da5){return request(_0xe9ad('0x34'),{'options':{'where':{'id':_0x319da5},'attributes':[_0xe9ad('0x9')]}});};exports[_0xe9ad('0x35')]=function(_0x400556,_0x55870a){return request(_0xe9ad('0x36'),{'body':{'interface':_0x55870a},'options':{'where':_0x400556}});};exports['agentPause']=function(_0x439bd5,_0x25117c,_0x180a37){return request(_0xe9ad('0x37'),{'body':{'type':_0x25117c,'uniqueid':_0x180a37},'options':{'where':_0x439bd5}});};exports[_0xe9ad('0x38')]=function(_0xd802e9){return request(_0xe9ad('0x39'),{'body':{},'options':{'where':_0xd802e9}});};exports[_0xe9ad('0x3a')]=function(_0x546529){return request(_0xe9ad('0x3b'),{'body':{},'options':{'where':_0x546529}});}; \ 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 b899898..cc3f143 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 _0x5a99=['./polly','./lex','exports'];(function(_0x49965b,_0x58e1d8){var _0x9a8397=function(_0x39e322){while(--_0x39e322){_0x49965b['push'](_0x49965b['shift']());}};_0x9a8397(++_0x58e1d8);}(_0x5a99,0xc9));var _0x95a9=function(_0x5b6a89,_0x2c59e9){_0x5b6a89=_0x5b6a89-0x0;var _0x4c9bd1=_0x5a99[_0x5b6a89];return _0x4c9bd1;};var polly=require(_0x95a9('0x0'));var lex=require(_0x95a9('0x1'));module[_0x95a9('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x81d4=['exports','./lex'];(function(_0x29d882,_0x278037){var _0x4503e9=function(_0x34c486){while(--_0x34c486){_0x29d882['push'](_0x29d882['shift']());}};_0x4503e9(++_0x278037);}(_0x81d4,0x197));var _0x481d=function(_0x48f779,_0x2b02a9){_0x48f779=_0x48f779-0x0;var _0x597e0a=_0x81d4[_0x48f779];return _0x597e0a;};var polly=require('./polly');var lex=require(_0x481d('0x0'));module[_0x481d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index bedce6f..a761a1a 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 _0x6f7a=['./lib/api','exports'];(function(_0x3e201c,_0x3b8d12){var _0x38d4c2=function(_0x56f740){while(--_0x56f740){_0x3e201c['push'](_0x3e201c['shift']());}};_0x38d4c2(++_0x3b8d12);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x6abfd8,_0x237377){_0x6abfd8=_0x6abfd8-0x0;var _0x6b0bcb=_0x6f7a[_0x6abfd8];return _0x6b0bcb;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ No newline at end of file +var _0xda3f=['exports'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0xda3f,0xec));var _0xfda3=function(_0x572b42,_0x486138){_0x572b42=_0x572b42-0x0;var _0x2e630a=_0xda3f[_0x572b42];return _0x2e630a;};'use strict';var lex=require('./lib/api');module[_0xfda3('0x0')]=function(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693){return lex(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693);}; \ 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 c4024fd..c028fc8 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(_0x315db4,_0x198cf8){var _0x1d2020=function(_0x2e318b){while(--_0x2e318b){_0x315db4['push'](_0x315db4['shift']());}};_0x1d2020(++_0x198cf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x48b6dd,_0x232743){var _0x4b29d8=function(_0x1853ca){while(--_0x1853ca){_0x48b6dd['push'](_0x48b6dd['shift']());}};_0x4b29d8(++_0x232743);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 17ff605..c9cbbd7 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 _0x7791=['exports','./lib/api'];(function(_0x3503e9,_0x2467fc){var _0x7ffc29=function(_0x2ef9c1){while(--_0x2ef9c1){_0x3503e9['push'](_0x3503e9['shift']());}};_0x7ffc29(++_0x2467fc);}(_0x7791,0xbd));var _0x1779=function(_0x4a944e,_0x194c7f){_0x4a944e=_0x4a944e-0x0;var _0x335e8d=_0x7791[_0x4a944e];return _0x335e8d;};'use strict';var polly=require(_0x1779('0x0'));module[_0x1779('0x1')]=function(_0x15e2fa,_0x3e2e56,_0xf6137b,_0x5e5063,_0xc436b8,_0xafa586,_0x249d4b){return polly(_0x15e2fa,_0x3e2e56,_0xf6137b,_0x5e5063,_0xc436b8,_0xafa586,_0x249d4b);}; \ No newline at end of file +var _0x56bf=['exports'];(function(_0x58e4c6,_0x3349fb){var _0x5e0da6=function(_0x99aef0){while(--_0x99aef0){_0x58e4c6['push'](_0x58e4c6['shift']());}};_0x5e0da6(++_0x3349fb);}(_0x56bf,0xc4));var _0xf56b=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x56bf[_0x31172e];return _0x414ada;};'use strict';var polly=require('./lib/api');module[_0xf56b('0x0')]=function(_0x5c63f9,_0x214e72,_0x6e17f2,_0x187d7e,_0x711d68,_0x139235,_0x459153){return polly(_0x5c63f9,_0x214e72,_0x6e17f2,_0x187d7e,_0x711d68,_0x139235,_0x459153);}; \ 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 4cf23f8..89f59b2 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 _0x34b4=['synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','aws-sdk'];(function(_0x5ee3e9,_0x2f8324){var _0x3afca2=function(_0x214f02){while(--_0x214f02){_0x5ee3e9['push'](_0x5ee3e9['shift']());}};_0x3afca2(++_0x2f8324);}(_0x34b4,0xba));var _0x434b=function(_0x51bacf,_0x2debc1){_0x51bacf=_0x51bacf-0x0;var _0x46abb0=_0x34b4[_0x51bacf];return _0x46abb0;};'use strict';var fs=require('fs');var path=require(_0x434b('0x0'));var BPromise=require(_0x434b('0x1'));var rs=require('randomstring');var AWS=require(_0x434b('0x2'));function pollyResult(_0x2871d1,_0x32b1ec,_0x43b2b6){return new BPromise(function(_0x5defc8,_0xe910ce){_0x2871d1[_0x434b('0x3')](_0x32b1ec,function(_0x3615c0,_0x35bee3){if(_0x3615c0){_0xe910ce(_0x3615c0);}else if(_0x35bee3){if(_0x35bee3[_0x434b('0x4')]instanceof Buffer){fs[_0x434b('0x5')](_0x43b2b6,_0x35bee3['AudioStream'],function(_0x3dd287){if(_0x3dd287){_0xe910ce(_0x3dd287);}else{_0x5defc8();}});}else{_0xe910ce(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xe910ce(new Error(_0x434b('0x6')));}});});}module['exports']=function(_0x27acea,_0x1527d0,_0x49f056,_0xc7ed7f,_0x502d78,_0x2921da,_0xfeadde){var _0x36e330=new AWS[(_0x434b('0x7'))]({'accessKeyId':_0x27acea,'secretAccessKey':_0x1527d0,'region':_0x49f056});var _0xf29a9c={'Text':_0x502d78,'TextType':_0x2921da||_0x434b('0x8'),'OutputFormat':'mp3','VoiceId':_0xc7ed7f};return pollyResult(_0x36e330,_0xf29a9c,_0xfeadde);}; \ No newline at end of file +var _0x730c=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x730c,0xec));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xc730('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xc730('0x1'));function pollyResult(_0x2a3b5c,_0x30c589,_0x4c10dd){return new BPromise(function(_0x415225,_0x56dd6f){_0x2a3b5c[_0xc730('0x2')](_0x30c589,function(_0x32eb87,_0x442454){if(_0x32eb87){_0x56dd6f(_0x32eb87);}else if(_0x442454){if(_0x442454['AudioStream']instanceof Buffer){fs['writeFile'](_0x4c10dd,_0x442454[_0xc730('0x3')],function(_0x32505e){if(_0x32505e){_0x56dd6f(_0x32505e);}else{_0x415225();}});}else{_0x56dd6f(new Error(_0xc730('0x4')));}}else{_0x56dd6f(new Error(_0xc730('0x5')));}});});}module[_0xc730('0x6')]=function(_0x3edf06,_0x118498,_0x150284,_0x51e657,_0xca3ccd,_0x484a4e,_0x33929f){var _0x253399=new AWS[(_0xc730('0x7'))]({'accessKeyId':_0x3edf06,'secretAccessKey':_0x118498,'region':_0x150284});var _0x37c9d9={'Text':_0xca3ccd,'TextType':_0x484a4e||_0xc730('0x8'),'OutputFormat':_0xc730('0x9'),'VoiceId':_0x51e657};return pollyResult(_0x253399,_0x37c9d9,_0x33929f);}; \ 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 4829b79..49fb7a0 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 _0xba3e=['./lib/api'];(function(_0x5efe28,_0x410eb8){var _0x260c7a=function(_0x33f84b){while(--_0x33f84b){_0x5efe28['push'](_0x5efe28['shift']());}};_0x260c7a(++_0x410eb8);}(_0xba3e,0xa5));var _0xeba3=function(_0x1482d4,_0x22626a){_0x1482d4=_0x1482d4-0x0;var _0x1544dd=_0xba3e[_0x1482d4];return _0x1544dd;};'use strict';var asr=require(_0xeba3('0x0'));module['exports']=function(_0x431219,_0x4b3427,_0x426e0b,_0x4396d4){return asr(_0x431219,_0x4b3427,_0x426e0b);}; \ No newline at end of file +var _0x414d=['./lib/api','exports'];(function(_0x1e21e5,_0xf2187a){var _0x466944=function(_0x46f565){while(--_0x46f565){_0x1e21e5['push'](_0x1e21e5['shift']());}};_0x466944(++_0xf2187a);}(_0x414d,0x166));var _0xd414=function(_0x20a761,_0x2ffd85){_0x20a761=_0x20a761-0x0;var _0x284a38=_0x414d[_0x20a761];return _0x284a38;};'use strict';var asr=require(_0xd414('0x0'));module[_0xd414('0x1')]=function(_0xc0d069,_0x4adf9d,_0x2801e8,_0xb1858){return asr(_0xc0d069,_0x4adf9d,_0x2801e8);}; \ 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 f392440..0c0fa94 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 _0xd737=['8000','url','https://speech.googleapis.com','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key='];(function(_0x111669,_0x13c529){var _0xcbf2a9=function(_0x5b9656){while(--_0x5b9656){_0x111669['push'](_0x111669['shift']());}};_0xcbf2a9(++_0x13c529);}(_0xd737,0x85));var _0x7d73=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xd737[_0x4bfac3];return _0x15f0f2;};'use strict';var url=require(_0x7d73('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x7d73('0x1');module['exports']=function(_0x1a6b12,_0x26854a,_0x2bd982){return new BPromise(function(_0x5cfa01,_0x5369be){var _0x3e19ad;if(typeof _0x1a6b12!=='string'||_0x1a6b12['length']===0x0){return _0x5369be(_0x7d73('0x2'));}if(typeof _0x26854a!==_0x7d73('0x3')||_0x26854a[_0x7d73('0x4')]===0x0){return _0x5369be(_0x7d73('0x5'));}if(typeof _0x2bd982!==_0x7d73('0x6')&&(typeof _0x2bd982!==_0x7d73('0x3')||_0x2bd982[_0x7d73('0x4')]===0x0)){return _0x5369be(_0x7d73('0x7'));}try{_0x3e19ad=fs['readFileSync'](_0x1a6b12)['toString'](_0x7d73('0x8'));}catch(_0x3252fc){return _0x5369be(_0x3252fc);}return _0x5cfa01({'method':'POST','uri':host+_0x7d73('0x9')+_0x26854a,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x7d73('0xa'),'languageCode':_0x2bd982},'audio':{'content':_0x3e19ad}},'json':!![]});});}; \ No newline at end of file +var _0x3b75=['filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x308206,_0x1dc10e){var _0x4d92b8=function(_0x5e1120){while(--_0x5e1120){_0x308206['push'](_0x308206['shift']());}};_0x4d92b8(++_0x1dc10e);}(_0x3b75,0x144));var _0x53b7=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0x3b75[_0x42d2af];return _0x1d6d63;};'use strict';var url=require(_0x53b7('0x0'));var BPromise=require(_0x53b7('0x1'));var fs=require('fs');var host=_0x53b7('0x2');module[_0x53b7('0x3')]=function(_0x3e6c49,_0x175c4e,_0x1925cd){return new BPromise(function(_0x145e6c,_0x5a0a4a){var _0x5c678a;if(typeof _0x3e6c49!==_0x53b7('0x4')||_0x3e6c49[_0x53b7('0x5')]===0x0){return _0x5a0a4a(_0x53b7('0x6'));}if(typeof _0x175c4e!==_0x53b7('0x4')||_0x175c4e['length']===0x0){return _0x5a0a4a('key\x20should\x20be\x20a\x20string');}if(typeof _0x1925cd!==_0x53b7('0x7')&&(typeof _0x1925cd!==_0x53b7('0x4')||_0x1925cd[_0x53b7('0x5')]===0x0)){return _0x5a0a4a(_0x53b7('0x8'));}try{_0x5c678a=fs[_0x53b7('0x9')](_0x3e6c49)['toString'](_0x53b7('0xa'));}catch(_0x41afe3){return _0x5a0a4a(_0x41afe3);}return _0x145e6c({'method':_0x53b7('0xb'),'uri':host+_0x53b7('0xc')+_0x175c4e,'body':{'config':{'encoding':_0x53b7('0xd'),'sampleRateHertz':_0x53b7('0xe'),'languageCode':_0x1925cd},'audio':{'content':_0x5c678a}},'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 6569252..0b1e625 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 _0x6566=['./asr'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0x6566,0x15c));var _0x6656=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x6566[_0x3dea7d];return _0x53919a;};var asr=require(_0x6656('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x44b6=['exports'];(function(_0x1aa0db,_0x45fed0){var _0x4038f1=function(_0x4dc560){while(--_0x4dc560){_0x1aa0db['push'](_0x1aa0db['shift']());}};_0x4038f1(++_0x45fed0);}(_0x44b6,0x181));var _0x644b=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x44b6[_0x1e399a];return _0x539897;};var asr=require('./asr');module[_0x644b('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 431c056..d44c780 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 _0x6f37=['google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','\x20failed,\x20status\x20code\x20=\x20','transcode','wav','error\x20convert','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','MP3','text:synthesize','then','resolve','.mp3','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','jQ1olc','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','stringify','result','resolvedQuery','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','path','querystring','randomstring'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6f37,0x75));var _0x76f3=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x6f37[_0x22b39b];return _0x280e1d;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x76f3('0x0'));var fs=require('fs');var http=require(_0x76f3('0x1'));var https=require(_0x76f3('0x2'));var md5=require('md5');var path=require(_0x76f3('0x3'));var querystring=require(_0x76f3('0x4'));var rp=require('request-promise');var rs=require(_0x76f3('0x5'));var sox=require('sox');var tts=require(_0x76f3('0x6'));var urlParse=require(_0x76f3('0x7'))[_0x76f3('0x8')];var util=require(_0x76f3('0x9'));var aws=require(_0x76f3('0xa'));var google=require(_0x76f3('0xb'));var sestek=require(_0x76f3('0xc'));var tilde=require(_0x76f3('0xd'));var logger=require(_0x76f3('0xe'))('agi');var ISPEECH_API=_0x76f3('0xf');function downloadFile(_0x420c7a,_0x46fc49){return new BPromise(function(_0x59bd8e,_0x8b2e1d){var _0x276a20=urlParse(_0x420c7a);var _0x36d9ca=_0x276a20[_0x76f3('0x10')]===_0x76f3('0x11')?https:http;var _0x1c2368={'host':_0x276a20[_0x76f3('0x12')],'path':_0x276a20[_0x76f3('0x3')],'headers':{'user-agent':_0x76f3('0x13')}};_0x36d9ca[_0x76f3('0x14')](_0x1c2368,function(_0x2f24e1){if(_0x2f24e1[_0x76f3('0x15')]!==0xc8){logger[_0x76f3('0x16')]('request\x20to\x20'+_0x420c7a+'\x20failed,\x20status\x20code\x20=\x20'+_0x2f24e1['statusCode']+'\x20('+_0x2f24e1[_0x76f3('0x17')]+')');_0x8b2e1d(new Error(_0x76f3('0x18')+_0x420c7a+'\x20failed,\x20status\x20code\x20=\x20'+_0x2f24e1[_0x76f3('0x15')]+'\x20('+_0x2f24e1[_0x76f3('0x17')]+')'));return;}var _0x1b857f=fs[_0x76f3('0x19')](_0x46fc49);_0x1b857f['on']('finish',function(){logger[_0x76f3('0x1a')](_0x76f3('0x1b'));_0x1b857f[_0x76f3('0x1c')](_0x59bd8e);});_0x1b857f['on'](_0x76f3('0x16'),function(_0x37e391){fs[_0x76f3('0x1d')](_0x46fc49);logger[_0x76f3('0x16')]('download\x20error',_0x37e391);_0x8b2e1d(_0x37e391);});_0x2f24e1[_0x76f3('0x1e')](_0x1b857f);})['on'](_0x76f3('0x16'),function(_0x54291c){logger[_0x76f3('0x16')](_0x54291c);_0x8b2e1d(_0x54291c);})[_0x76f3('0x1f')]();});}function uploadFile(_0xfbf058){return new BPromise(function(_0x5ed4d1,_0x52a64c){var _0x33a426=urlParse(_0xfbf058);var _0x4f0fba=_0x33a426[_0x76f3('0x10')]===_0x76f3('0x11')?https:http;var _0x450d65={'host':_0x33a426[_0x76f3('0x12')],'path':_0x33a426[_0x76f3('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x4f0fba[_0x76f3('0x14')](_0x450d65,function(_0x4d1cab){if(_0x4d1cab[_0x76f3('0x15')]!==0xc8){_0x52a64c(new Error(_0x76f3('0x18')+_0xfbf058+_0x76f3('0x20')+_0x4d1cab[_0x76f3('0x15')]+'\x20('+_0x4d1cab[_0x76f3('0x17')]+')'));return;}var _0xb7f8c0='';_0x4d1cab['on']('data',function(_0x1f6091){_0xb7f8c0+=_0x1f6091;});_0x4d1cab['on'](_0x76f3('0x1f'),function(){_0x5ed4d1(_0xb7f8c0);});})['on'](_0x76f3('0x16'),function(_0x40aba8){_0x52a64c(_0x40aba8);})[_0x76f3('0x1f')]();});}function convertFile(_0x14040f,_0x491250){return new BPromise(function(_0x48a673,_0x10fa9f){var _0x2acf99=sox[_0x76f3('0x21')](_0x14040f,_0x491250,{'sampleRate':0x1f40,'format':_0x76f3('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2acf99['on'](_0x76f3('0x16'),function(_0x19f05c){logger['error'](_0x76f3('0x23'),_0x19f05c);_0x10fa9f(_0x19f05c);});_0x2acf99['on'](_0x76f3('0x1f'),function(){logger['info']('finish\x20to\x20convert');_0x48a673();});_0x2acf99['start']();});}function base64Decode(_0x27325f,_0x106e53){var _0x5290c6=path['resolve'](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x26'));fs[_0x76f3('0x27')](_0x5290c6,_0x27325f,_0x76f3('0x28'));return convertFile(_0x5290c6,_0x106e53)['then'](function(){try{fs[_0x76f3('0x1d')](_0x5290c6);fs[_0x76f3('0x29')](_0x106e53,_0x76f3('0x2a'));}catch(_0x2e49f2){logger[_0x76f3('0x16')](_0x2e49f2);}return _0x106e53[_0x76f3('0x2b')]('.')[0x0];});}function base64Encode(_0x144607){var _0x3921d7=fs[_0x76f3('0x2c')](_0x144607);return new Buffer(_0x3921d7)['toString'](_0x76f3('0x28'));}exports[_0x76f3('0x2d')]=function(_0x57016b,_0xb50035,_0x289c1b,_0x157400,_0x360964,_0x47510d){var _0x317997,_0x228138;var _0x4b6945=_0x76f3('0x2e');var _0x2da1c5='?key='+_0x57016b;var _0x331629={};if(_0xb50035==='ssml'){_0x331629[_0x76f3('0x2f')]={'ssml':_0x289c1b};}else{_0x331629['input']={'text':_0x289c1b};};_0x331629[_0x76f3('0x30')]={'languageCode':_0x157400,'ssmlGender':_0x360964};_0x331629['audioConfig']={'audioEncoding':_0x76f3('0x31'),'sampleRateHertz':0x1f40};var _0x1c1228={'url':_0x4b6945+_0x76f3('0x32')+_0x2da1c5,'method':'POST','json':!![],'body':_0x331629};return rp(_0x1c1228)[_0x76f3('0x33')](function(_0x138d35){return new BPromise(function(_0x380d0f,_0x42d090){_0x317997=path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x35'));var _0x21df74=Buffer['from'](_0x138d35['audioContent'],_0x76f3('0x28'));return fs[_0x76f3('0x36')](_0x317997,_0x21df74,function(_0x3c9737){_0x42d090(_0x3c9737);},function(_0x55f2b6){fs[_0x76f3('0x29')](_0x317997,_0x76f3('0x2a'));_0x380d0f(_0x55f2b6);});});})[_0x76f3('0x33')](function(_0x5ccfd4){_0x228138=path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x26'));return convertFile(_0x317997,_0x228138);})[_0x76f3('0x33')](function(){try{fs[_0x76f3('0x1d')](_0x317997);fs[_0x76f3('0x29')](_0x228138,_0x76f3('0x2a'));}catch(_0x32d17c){logger[_0x76f3('0x16')](_0x32d17c);}logger['info']('googleCloudTTS\x20path',_0x228138['split']('.')[0x0]);return _0x228138[_0x76f3('0x2b')]('.')[0x0];});};exports[_0x76f3('0x37')]=function(_0x39368a,_0x3ceb72){var _0x187784=_0x76f3('0x38');var _0x489385,_0x283567;var _0x2976f2;var _0x593f39={'encoding':_0x76f3('0x39'),'method':_0x76f3('0x3a'),'timeout':0x2710,'url':_0x187784,'headers':{'Content-Type':_0x76f3('0x3b')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x76f3('0x3c'),JSON['stringify']([_0x39368a,_0x3ceb72||'en',![],'null']),null,'generic']]]))};return rp(_0x593f39)['then'](function(_0x136ee2){try{_0x2976f2=eval(_0x136ee2['slice'](0x5))[0x0][0x2];}catch(_0x3ed697){throw new Error(_0x76f3('0x3d')+_0x136ee2[_0x76f3('0x3e')]);}if(!_0x2976f2){if(_0x39368a[_0x76f3('0x3f')]>0xc8){throw new Error(_0x76f3('0x40'));}else{throw new Error(_0x76f3('0x41')+_0x3ceb72+'\x22\x20might\x20not\x20exist');}}try{_0x2976f2=eval(_0x2976f2)[0x0];}catch(_0x22e76a){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x20804e=_0x2976f2;_0x489385=path['resolve'](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x35'));fs[_0x76f3('0x27')](_0x489385,_0x2976f2,{'encoding':_0x76f3('0x28')});_0x283567=path[_0x76f3('0x34')](__dirname,'tmp',rs[_0x76f3('0x25')](0x4)+'.wav');return convertFile(_0x489385,_0x283567);})[_0x76f3('0x33')](function(){try{fs[_0x76f3('0x1d')](_0x489385);fs[_0x76f3('0x29')](_0x283567,_0x76f3('0x2a'));}catch(_0x1fa709){logger['error'](_0x1fa709);}logger[_0x76f3('0x1a')](_0x76f3('0x42'),_0x283567['split']('.')[0x0]);return _0x283567[_0x76f3('0x2b')]('.')[0x0];});};exports[_0x76f3('0x43')]=function(_0x7b81df,_0x2ba624,_0x222590){return google[_0x76f3('0x44')](_0x7b81df,_0x2ba624,_0x222590)['then'](function(_0x394f05){logger[_0x76f3('0x1a')](_0x394f05[_0x76f3('0x45')]);return rp(_0x394f05);})[_0x76f3('0x33')](function(_0x5c8903){var _0x2cfcf4='';var _0x23aa40=0x0;try{fs['unlink'](_0x7b81df);}catch(_0x3753e9){logger[_0x76f3('0x16')](_0x3753e9);}if(_0x5c8903&&_0x5c8903['results']){_0x2cfcf4=_0x5c8903[_0x76f3('0x46')][_0x76f3('0x47')](function(_0x3c2393){return _0x3c2393&&_0x3c2393[_0x76f3('0x48')][0x0]&&_0x3c2393[_0x76f3('0x48')][0x0][_0x76f3('0x49')]?_0x3c2393[_0x76f3('0x48')][0x0]['transcript']:'';})[_0x76f3('0x4a')]('\x0a');_0x23aa40=_0x5c8903[_0x76f3('0x46')][_0x76f3('0x47')](function(_0x2296f2){return _0x2296f2&&_0x2296f2[_0x76f3('0x48')][0x0]&&_0x2296f2[_0x76f3('0x48')][0x0][_0x76f3('0x4b')]?_0x2296f2[_0x76f3('0x48')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x76f3('0x1a')]('googleASR\x20transcription',_0x2cfcf4);logger[_0x76f3('0x1a')](_0x76f3('0x4c'),_0x23aa40);return{'transcript':_0x2cfcf4,'confidence':_0x23aa40};})[_0x76f3('0x4d')](function(_0x2da752){logger['error'](_0x76f3('0x4e'),_0x2da752['statusCode'],_0x2da752[_0x76f3('0x4f')],_0x2da752['message']);});};exports[_0x76f3('0x50')]=function(_0x25b5ab,_0x5945cf,_0x5769f1,_0x18c8a2){var _0x265271=apiai(_0x5945cf,{'language':_0x18c8a2||'en'});return _0x265271['textRequest'](_0x5769f1,{'sessionId':md5(_0x25b5ab)})[_0x76f3('0x33')](function(_0x5e1dd2){logger[_0x76f3('0x1a')](JSON[_0x76f3('0x51')](_0x5e1dd2));return{'source':_0x5e1dd2[_0x76f3('0x52')]['source'],'resolvedQuery':_0x5e1dd2[_0x76f3('0x52')][_0x76f3('0x53')],'action':_0x5e1dd2[_0x76f3('0x52')]['action'],'actionIncomplete':_0x5e1dd2['result']['actionIncomplete'],'speech':_0x5e1dd2[_0x76f3('0x52')][_0x76f3('0x54')][_0x76f3('0x55')],'score':_0x5e1dd2['result']['score'],'statusCode':_0x5e1dd2[_0x76f3('0x56')]['code'],'endConversation':_0x5e1dd2[_0x76f3('0x52')][_0x76f3('0x57')][_0x76f3('0x58')]||![],'isFallbackIntent':_0x5e1dd2[_0x76f3('0x52')][_0x76f3('0x57')][_0x76f3('0x59')]};});};exports['googleDialogflowV2']=function(_0x3c6133,_0x16aa9c,_0x2a162c,_0x4a1ffc,_0xb501a8,_0x18389){var _0x2b88a3=_0x4a1ffc[_0x76f3('0x5a')](/\\n/g,'\x0a');var _0x508f94={'credentials':{'private_key':_0x2b88a3,'client_email':_0x2a162c}};var _0x32556f=new dialogflow[(_0x76f3('0x5b'))](_0x508f94);var _0x58f656=_0x32556f['sessionPath'](_0x16aa9c,md5(_0x3c6133));var _0x317f4c={'session':_0x58f656,'queryInput':{'text':{'text':_0xb501a8,'languageCode':_0x18389}}};return _0x32556f['detectIntent'](_0x317f4c)[_0x76f3('0x33')](function(_0xca398b){if(_0xca398b&&_0xca398b[_0x76f3('0x3f')]){logger[_0x76f3('0x1a')](_0x76f3('0x5c'),JSON['stringify'](_0xca398b));var _0x2b7489=_0xca398b[0x0];if(_0x2b7489){var _0x1ab7a3={'action':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x5e')],'allRequiredParamsPresent':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x5f')],'endConversation':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x60')]&&_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x60')][_0x76f3('0x61')]?_0x2b7489['queryResult'][_0x76f3('0x60')]['fields'][_0x76f3('0x62')][_0x76f3('0x63')]:![],'fulfillmentText':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x64')],'intentName':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x65')]['name'],'intentDisplayName':_0x2b7489[_0x76f3('0x5d')]['intent'][_0x76f3('0x66')],'isFallbackIntent':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x65')][_0x76f3('0x67')],'languageCode':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x68')],'queryText':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x69')],'responseId':_0x2b7489[_0x76f3('0x6a')],'score':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x6b')],'speech':_0x2b7489[_0x76f3('0x5d')][_0x76f3('0x64')],'providerResponse':JSON[_0x76f3('0x51')](_0xca398b)};return _0x1ab7a3;}}});};exports['tildeASR']=function(_0x1bc42f,_0x4ad1c8,_0x286272,_0x16f6b5){return tilde[_0x76f3('0x44')](_0x1bc42f,_0x4ad1c8,_0x286272,_0x16f6b5)[_0x76f3('0x33')](function(_0x23328d){try{fs[_0x76f3('0x1d')](_0x1bc42f);}catch(_0x326369){logger[_0x76f3('0x16')](_0x326369);}logger[_0x76f3('0x1a')]('Tilde\x20ASR\x20transcription',_0x23328d[_0x76f3('0x49')]);logger[_0x76f3('0x1a')](_0x76f3('0x6c'),_0x23328d[_0x76f3('0x4b')]);return _0x23328d;});};exports[_0x76f3('0x6d')]=function(_0x5439b9,_0x31b687,_0x15aa51,_0x1d4992,_0x227b4e,_0x1bacca){var _0x1e1bfa=path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x35'));var _0x4d6375;return aws[_0x76f3('0x6e')](_0x5439b9,_0x31b687,_0x15aa51,_0x1d4992,_0x227b4e,_0x1bacca,_0x1e1bfa)[_0x76f3('0x33')](function(){_0x4d6375=path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+'.wav');return convertFile(_0x1e1bfa,_0x4d6375);})[_0x76f3('0x33')](function(){try{fs[_0x76f3('0x1d')](_0x1e1bfa);fs[_0x76f3('0x29')](_0x4d6375,'777');}catch(_0x4c8c98){logger['error'](_0x4c8c98);}return _0x4d6375[_0x76f3('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x50a629,_0x56d9f5,_0xef989d,_0x31bfb0,_0x186c98,_0x852c59){return aws['lex'](_0x50a629,_0x56d9f5,_0xef989d,_0x31bfb0,_0x186c98,_0x852c59)['then'](function(_0x85231e){logger[_0x76f3('0x1a')](JSON[_0x76f3('0x51')](_0x85231e));return _0x85231e;});};exports[_0x76f3('0x6f')]=function(_0x6eb615,_0xf812f,_0x344659,_0x2c8238){var _0x3d4aaf=util[_0x76f3('0x70')](_0x76f3('0x71'),ISPEECH_API,_0x6eb615,encodeURIComponent(_0xf812f),_0x344659,_0x2c8238);var _0x1869d3=path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x35'));var _0x2c5ee1;return downloadFile(_0x3d4aaf,_0x1869d3)[_0x76f3('0x33')](function(){_0x2c5ee1=path[_0x76f3('0x34')](__dirname,'tmp',rs[_0x76f3('0x25')](0x4)+'.wav');return convertFile(_0x1869d3,_0x2c5ee1);})['then'](function(){try{fs[_0x76f3('0x1d')](_0x1869d3);fs[_0x76f3('0x29')](_0x2c5ee1,_0x76f3('0x2a'));}catch(_0x265789){logger[_0x76f3('0x16')](_0x265789);}return _0x2c5ee1[_0x76f3('0x2b')]('.')[0x0];});};exports[_0x76f3('0x72')]=function(_0x423188,_0x1e9b56,_0x5480a6,_0x142a1d){var _0xa185b0=util[_0x76f3('0x70')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1e9b56,_0x5480a6,base64Encode(_0x423188),_0x142a1d?util['format'](_0x76f3('0x73'),encodeURIComponent(_0x142a1d)):'freeform=3');return uploadFile(_0xa185b0)[_0x76f3('0x33')](function(_0x2104ed){return querystring[_0x76f3('0x8')](_0x2104ed);});};exports['sestekNDA']=function(_0x3d8e9b,_0x577346){return sestek['nda'](_0x3d8e9b,_0x577346)[_0x76f3('0x33')](function(_0x49faa2){logger[_0x76f3('0x1a')](JSON[_0x76f3('0x51')](_0x49faa2));var _0xa5f58d={'speech':_0x49faa2[_0x76f3('0x74')],'action':_0x49faa2[_0x76f3('0x75')]?_0x49faa2['channelData'][_0x76f3('0x76')]:undefined,'actiondata':_0x49faa2[_0x76f3('0x75')]?_0x49faa2[_0x76f3('0x75')]['CustomActionData']:undefined};if(_0x49faa2[_0x76f3('0x75')]&&_0x49faa2[_0x76f3('0x75')][_0x76f3('0x77')]){return base64Decode(_0x49faa2[_0x76f3('0x75')][_0x76f3('0x77')][_0x76f3('0x78')],path[_0x76f3('0x34')](__dirname,_0x76f3('0x24'),rs[_0x76f3('0x25')](0x4)+_0x76f3('0x26')))['then'](function(_0x40014f){_0xa5f58d[_0x76f3('0x79')]=_0x40014f;return _0xa5f58d;});}return _0xa5f58d;});};exports[_0x76f3('0x7a')]=function(){return __dirname;}; \ No newline at end of file +var _0xb125=['statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','unlink','pipe','end','get','data','transcode','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','input','voice','audioConfig','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','intentDetectionConfidence','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','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','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER'];(function(_0x1ee65d,_0x13e80f){var _0x2eb5bb=function(_0x1d23d0){while(--_0x1d23d0){_0x1ee65d['push'](_0x1ee65d['shift']());}};_0x2eb5bb(++_0x13e80f);}(_0xb125,0xf8));var _0x5b12=function(_0x3d9052,_0x160691){_0x3d9052=_0x3d9052-0x0;var _0x4b81a0=_0xb125[_0x3d9052];return _0x4b81a0;};'use strict';var apiai=require(_0x5b12('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x5b12('0x1'));var fs=require('fs');var http=require(_0x5b12('0x2'));var https=require(_0x5b12('0x3'));var md5=require('md5');var path=require(_0x5b12('0x4'));var querystring=require(_0x5b12('0x5'));var rp=require(_0x5b12('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x5b12('0x7'));var urlParse=require(_0x5b12('0x8'))[_0x5b12('0x9')];var util=require(_0x5b12('0xa'));var aws=require(_0x5b12('0xb'));var google=require(_0x5b12('0xc'));var sestek=require(_0x5b12('0xd'));var tilde=require(_0x5b12('0xe'));var logger=require(_0x5b12('0xf'))(_0x5b12('0x10'));var ISPEECH_API=_0x5b12('0x11');function downloadFile(_0x4478e1,_0xa6346b){return new BPromise(function(_0x29d598,_0x33b3b4){var _0x1579dc=urlParse(_0x4478e1);var _0x2959cb=_0x1579dc[_0x5b12('0x12')]===_0x5b12('0x13')?https:http;var _0x54a33a={'host':_0x1579dc[_0x5b12('0x14')],'path':_0x1579dc[_0x5b12('0x4')],'headers':{'user-agent':_0x5b12('0x15')}};_0x2959cb['get'](_0x54a33a,function(_0x5c5fd6){if(_0x5c5fd6[_0x5b12('0x16')]!==0xc8){logger[_0x5b12('0x17')](_0x5b12('0x18')+_0x4478e1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c5fd6[_0x5b12('0x16')]+'\x20('+_0x5c5fd6[_0x5b12('0x19')]+')');_0x33b3b4(new Error('request\x20to\x20'+_0x4478e1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c5fd6[_0x5b12('0x16')]+'\x20('+_0x5c5fd6[_0x5b12('0x19')]+')'));return;}var _0xb17a23=fs[_0x5b12('0x1a')](_0xa6346b);_0xb17a23['on'](_0x5b12('0x1b'),function(){logger[_0x5b12('0x1c')]('finish\x20download\x20file');_0xb17a23['close'](_0x29d598);});_0xb17a23['on'](_0x5b12('0x17'),function(_0x360d96){fs[_0x5b12('0x1d')](_0xa6346b);logger[_0x5b12('0x17')]('download\x20error',_0x360d96);_0x33b3b4(_0x360d96);});_0x5c5fd6[_0x5b12('0x1e')](_0xb17a23);})['on'](_0x5b12('0x17'),function(_0x4992a4){logger[_0x5b12('0x17')](_0x4992a4);_0x33b3b4(_0x4992a4);})[_0x5b12('0x1f')]();});}function uploadFile(_0xb1a0fe){return new BPromise(function(_0x1421b9,_0x50f366){var _0x55dcd9=urlParse(_0xb1a0fe);var _0x324542=_0x55dcd9[_0x5b12('0x12')]===_0x5b12('0x13')?https:http;var _0x422190={'host':_0x55dcd9[_0x5b12('0x14')],'path':_0x55dcd9[_0x5b12('0x4')],'headers':{'user-agent':_0x5b12('0x15')}};_0x324542[_0x5b12('0x20')](_0x422190,function(_0x356556){if(_0x356556[_0x5b12('0x16')]!==0xc8){_0x50f366(new Error(_0x5b12('0x18')+_0xb1a0fe+'\x20failed,\x20status\x20code\x20=\x20'+_0x356556[_0x5b12('0x16')]+'\x20('+_0x356556[_0x5b12('0x19')]+')'));return;}var _0x379ecf='';_0x356556['on'](_0x5b12('0x21'),function(_0x401489){_0x379ecf+=_0x401489;});_0x356556['on'](_0x5b12('0x1f'),function(){_0x1421b9(_0x379ecf);});})['on']('error',function(_0x3cbe78){_0x50f366(_0x3cbe78);})[_0x5b12('0x1f')]();});}function convertFile(_0x38dd24,_0x906fd5){return new BPromise(function(_0x99231b,_0x53c794){var _0x4592bc=sox[_0x5b12('0x22')](_0x38dd24,_0x906fd5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4592bc['on'](_0x5b12('0x17'),function(_0xb7cea4){logger[_0x5b12('0x17')](_0x5b12('0x23'),_0xb7cea4);_0x53c794(_0xb7cea4);});_0x4592bc['on'](_0x5b12('0x1f'),function(){logger[_0x5b12('0x1c')]('finish\x20to\x20convert');_0x99231b();});_0x4592bc[_0x5b12('0x24')]();});}function base64Decode(_0x43b5dd,_0x25c9f6){var _0x4abf53=path[_0x5b12('0x25')](__dirname,_0x5b12('0x26'),rs['generate'](0x4)+_0x5b12('0x27'));fs[_0x5b12('0x28')](_0x4abf53,_0x43b5dd,_0x5b12('0x29'));return convertFile(_0x4abf53,_0x25c9f6)[_0x5b12('0x2a')](function(){try{fs[_0x5b12('0x1d')](_0x4abf53);fs[_0x5b12('0x2b')](_0x25c9f6,_0x5b12('0x2c'));}catch(_0x5be79a){logger[_0x5b12('0x17')](_0x5be79a);}return _0x25c9f6[_0x5b12('0x2d')]('.')[0x0];});}function base64Encode(_0x445b8c){var _0x2fbde7=fs[_0x5b12('0x2e')](_0x445b8c);return new Buffer(_0x2fbde7)[_0x5b12('0x2f')]('base64');}exports[_0x5b12('0x30')]=function(_0x56b485,_0x162c7e,_0x13b378,_0x43e741,_0x2fb65f,_0x4d73c6){var _0x309e49,_0x1f2117;var _0x5b4fdc='https://texttospeech.googleapis.com/v1/';var _0x47a65c=_0x5b12('0x31')+_0x56b485;var _0x2d06b6={};if(_0x162c7e==='ssml'){_0x2d06b6[_0x5b12('0x32')]={'ssml':_0x13b378};}else{_0x2d06b6['input']={'text':_0x13b378};};_0x2d06b6[_0x5b12('0x33')]={'languageCode':_0x43e741,'ssmlGender':_0x2fb65f};_0x2d06b6[_0x5b12('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2eb42f={'url':_0x5b4fdc+_0x5b12('0x35')+_0x47a65c,'method':_0x5b12('0x36'),'json':!![],'body':_0x2d06b6};return rp(_0x2eb42f)[_0x5b12('0x2a')](function(_0x11d1fa){return new BPromise(function(_0xe2baf5,_0x2e3133){_0x309e49=path['resolve'](__dirname,_0x5b12('0x26'),rs[_0x5b12('0x37')](0x4)+_0x5b12('0x38'));var _0x3229bf=Buffer[_0x5b12('0x39')](_0x11d1fa[_0x5b12('0x3a')],_0x5b12('0x29'));return fs[_0x5b12('0x3b')](_0x309e49,_0x3229bf,function(_0x5b24ec){_0x2e3133(_0x5b24ec);},function(_0x59757f){fs[_0x5b12('0x2b')](_0x309e49,_0x5b12('0x2c'));_0xe2baf5(_0x59757f);});});})[_0x5b12('0x2a')](function(_0x45a1d4){_0x1f2117=path[_0x5b12('0x25')](__dirname,'tmp',rs[_0x5b12('0x37')](0x4)+'.wav');return convertFile(_0x309e49,_0x1f2117);})[_0x5b12('0x2a')](function(){try{fs['unlink'](_0x309e49);fs[_0x5b12('0x2b')](_0x1f2117,_0x5b12('0x2c'));}catch(_0x5ed47e){logger[_0x5b12('0x17')](_0x5ed47e);}logger[_0x5b12('0x1c')](_0x5b12('0x3c'),_0x1f2117[_0x5b12('0x2d')]('.')[0x0]);return _0x1f2117[_0x5b12('0x2d')]('.')[0x0];});};exports[_0x5b12('0x3d')]=function(_0x438686,_0xf1de9e){var _0x6209dd=_0x5b12('0x3e');var _0xf777ff,_0xddc5b8;var _0x26ce79;var _0x3defdf={'encoding':'utf8','method':_0x5b12('0x36'),'timeout':0x2710,'url':_0x6209dd,'headers':{'Content-Type':_0x5b12('0x3f')},'body':_0x5b12('0x40')+encodeURIComponent(JSON[_0x5b12('0x41')]([[[_0x5b12('0x42'),JSON['stringify']([_0x438686,_0xf1de9e||'en',![],_0x5b12('0x43')]),null,'generic']]]))};return rp(_0x3defdf)[_0x5b12('0x2a')](function(_0x206205){try{_0x26ce79=eval(_0x206205[_0x5b12('0x44')](0x5))[0x0][0x2];}catch(_0x459ec6){throw new Error('parse\x20response\x20failed:\x0a'+_0x206205[_0x5b12('0x21')]);}if(!_0x26ce79){if(_0x438686['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x5b12('0x45')+_0xf1de9e+_0x5b12('0x46'));}}try{_0x26ce79=eval(_0x26ce79)[0x0];}catch(_0x10373a){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2388e6=_0x26ce79;_0xf777ff=path[_0x5b12('0x25')](__dirname,'tmp',rs[_0x5b12('0x37')](0x4)+_0x5b12('0x38'));fs[_0x5b12('0x28')](_0xf777ff,_0x26ce79,{'encoding':_0x5b12('0x29')});_0xddc5b8=path[_0x5b12('0x25')](__dirname,'tmp',rs[_0x5b12('0x37')](0x4)+_0x5b12('0x27'));return convertFile(_0xf777ff,_0xddc5b8);})[_0x5b12('0x2a')](function(){try{fs['unlink'](_0xf777ff);fs[_0x5b12('0x2b')](_0xddc5b8,'777');}catch(_0x2bc099){logger[_0x5b12('0x17')](_0x2bc099);}logger[_0x5b12('0x1c')](_0x5b12('0x47'),_0xddc5b8['split']('.')[0x0]);return _0xddc5b8['split']('.')[0x0];});};exports[_0x5b12('0x48')]=function(_0x2c42dd,_0xb6cffd,_0x461511){return google['asr'](_0x2c42dd,_0xb6cffd,_0x461511)[_0x5b12('0x2a')](function(_0x5a7f83){logger[_0x5b12('0x1c')](_0x5a7f83[_0x5b12('0x49')]);return rp(_0x5a7f83);})[_0x5b12('0x2a')](function(_0x522f68){var _0x507e14='';var _0x267eab=0x0;try{fs[_0x5b12('0x1d')](_0x2c42dd);}catch(_0x2c0092){logger['error'](_0x2c0092);}if(_0x522f68&&_0x522f68[_0x5b12('0x4a')]){_0x507e14=_0x522f68[_0x5b12('0x4a')][_0x5b12('0x4b')](function(_0x5d75aa){return _0x5d75aa&&_0x5d75aa[_0x5b12('0x4c')][0x0]&&_0x5d75aa[_0x5b12('0x4c')][0x0][_0x5b12('0x4d')]?_0x5d75aa['alternatives'][0x0][_0x5b12('0x4d')]:'';})[_0x5b12('0x4e')]('\x0a');_0x267eab=_0x522f68[_0x5b12('0x4a')]['map'](function(_0xe2aa58){return _0xe2aa58&&_0xe2aa58[_0x5b12('0x4c')][0x0]&&_0xe2aa58[_0x5b12('0x4c')][0x0][_0x5b12('0x4f')]?_0xe2aa58[_0x5b12('0x4c')][0x0][_0x5b12('0x4f')]:0x0;})[_0x5b12('0x4e')]('\x0a');}logger[_0x5b12('0x1c')](_0x5b12('0x50'),_0x507e14);logger[_0x5b12('0x1c')](_0x5b12('0x51'),_0x267eab);return{'transcript':_0x507e14,'confidence':_0x267eab};})[_0x5b12('0x52')](function(_0x34fc4d){logger[_0x5b12('0x17')]('[%s]\x20%s:%s',_0x34fc4d[_0x5b12('0x16')],_0x34fc4d[_0x5b12('0x53')],_0x34fc4d[_0x5b12('0x54')]);});};exports['googleDialogflow']=function(_0x491159,_0x4a0122,_0x1df8e3,_0x4459fe){var _0x4e0349=apiai(_0x4a0122,{'language':_0x4459fe||'en'});return _0x4e0349[_0x5b12('0x55')](_0x1df8e3,{'sessionId':md5(_0x491159)})['then'](function(_0x19c722){logger['info'](JSON['stringify'](_0x19c722));return{'source':_0x19c722['result'][_0x5b12('0x56')],'resolvedQuery':_0x19c722[_0x5b12('0x57')][_0x5b12('0x58')],'action':_0x19c722[_0x5b12('0x57')][_0x5b12('0x59')],'actionIncomplete':_0x19c722['result'][_0x5b12('0x5a')],'speech':_0x19c722[_0x5b12('0x57')][_0x5b12('0x5b')][_0x5b12('0x5c')],'score':_0x19c722[_0x5b12('0x57')][_0x5b12('0x5d')],'statusCode':_0x19c722[_0x5b12('0x5e')][_0x5b12('0x5f')],'endConversation':_0x19c722['result']['metadata'][_0x5b12('0x60')]||![],'isFallbackIntent':_0x19c722['result'][_0x5b12('0x61')][_0x5b12('0x62')]};});};exports['googleDialogflowV2']=function(_0x1af926,_0x5829b0,_0x214fb6,_0x15c7b7,_0x28a87b,_0xf01b9){var _0x211049=_0x15c7b7[_0x5b12('0x63')](/\\n/g,'\x0a');var _0x3ac6c3={'credentials':{'private_key':_0x211049,'client_email':_0x214fb6}};var _0x15b5bc=new dialogflow[(_0x5b12('0x64'))](_0x3ac6c3);var _0x371201=_0x15b5bc[_0x5b12('0x65')](_0x5829b0,md5(_0x1af926));var _0x32e457={'session':_0x371201,'queryInput':{'text':{'text':_0x28a87b,'languageCode':_0xf01b9}}};return _0x15b5bc[_0x5b12('0x66')](_0x32e457)[_0x5b12('0x2a')](function(_0x4736f2){if(_0x4736f2&&_0x4736f2['length']){logger[_0x5b12('0x1c')](_0x5b12('0x67'),JSON['stringify'](_0x4736f2));var _0x42d8dd=_0x4736f2[0x0];if(_0x42d8dd){var _0x1a1e5a={'action':_0x42d8dd['queryResult'][_0x5b12('0x59')],'allRequiredParamsPresent':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x69')],'endConversation':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x6a')]&&_0x42d8dd[_0x5b12('0x68')]['diagnosticInfo'][_0x5b12('0x6b')]?_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x6a')]['fields']['end_conversation'][_0x5b12('0x6c')]:![],'fulfillmentText':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x6d')],'intentName':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x6e')][_0x5b12('0x53')],'intentDisplayName':_0x42d8dd[_0x5b12('0x68')]['intent'][_0x5b12('0x6f')],'isFallbackIntent':_0x42d8dd['queryResult'][_0x5b12('0x6e')][_0x5b12('0x70')],'languageCode':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x71')],'queryText':_0x42d8dd[_0x5b12('0x68')]['queryText'],'responseId':_0x42d8dd['responseId'],'score':_0x42d8dd[_0x5b12('0x68')][_0x5b12('0x72')],'speech':_0x42d8dd[_0x5b12('0x68')]['fulfillmentText'],'providerResponse':JSON[_0x5b12('0x41')](_0x4736f2)};return _0x1a1e5a;}}});};exports['tildeASR']=function(_0x5a112b,_0x474b3a,_0x468e7c,_0x278d23){return tilde[_0x5b12('0x73')](_0x5a112b,_0x474b3a,_0x468e7c,_0x278d23)[_0x5b12('0x2a')](function(_0x518498){try{fs[_0x5b12('0x1d')](_0x5a112b);}catch(_0x495068){logger[_0x5b12('0x17')](_0x495068);}logger[_0x5b12('0x1c')](_0x5b12('0x74'),_0x518498[_0x5b12('0x4d')]);logger[_0x5b12('0x1c')](_0x5b12('0x75'),_0x518498[_0x5b12('0x4f')]);return _0x518498;});};exports[_0x5b12('0x76')]=function(_0x49a426,_0xa5f37e,_0x889b33,_0x3b7755,_0x542063,_0x2e91a7){var _0x390aa9=path[_0x5b12('0x25')](__dirname,_0x5b12('0x26'),rs[_0x5b12('0x37')](0x4)+'.mp3');var _0x31d5a0;return aws[_0x5b12('0x77')](_0x49a426,_0xa5f37e,_0x889b33,_0x3b7755,_0x542063,_0x2e91a7,_0x390aa9)[_0x5b12('0x2a')](function(){_0x31d5a0=path['resolve'](__dirname,'tmp',rs[_0x5b12('0x37')](0x4)+_0x5b12('0x27'));return convertFile(_0x390aa9,_0x31d5a0);})[_0x5b12('0x2a')](function(){try{fs[_0x5b12('0x1d')](_0x390aa9);fs[_0x5b12('0x2b')](_0x31d5a0,_0x5b12('0x2c'));}catch(_0x731bba){logger[_0x5b12('0x17')](_0x731bba);}return _0x31d5a0[_0x5b12('0x2d')]('.')[0x0];});};exports['awsLex']=function(_0x4f3fec,_0x30c59a,_0x46df34,_0x201b08,_0x7af457,_0x56e462){return aws['lex'](_0x4f3fec,_0x30c59a,_0x46df34,_0x201b08,_0x7af457,_0x56e462)['then'](function(_0x4659a4){logger[_0x5b12('0x1c')](JSON['stringify'](_0x4659a4));return _0x4659a4;});};exports['ispeechTTS']=function(_0x46231f,_0x441761,_0x1e94ee,_0x383ab8){var _0x1a6e64=util[_0x5b12('0x78')](_0x5b12('0x79'),ISPEECH_API,_0x46231f,encodeURIComponent(_0x441761),_0x1e94ee,_0x383ab8);var _0x42cf46=path['resolve'](__dirname,_0x5b12('0x26'),rs[_0x5b12('0x37')](0x4)+_0x5b12('0x38'));var _0x53e22a;return downloadFile(_0x1a6e64,_0x42cf46)[_0x5b12('0x2a')](function(){_0x53e22a=path[_0x5b12('0x25')](__dirname,_0x5b12('0x26'),rs['generate'](0x4)+_0x5b12('0x27'));return convertFile(_0x42cf46,_0x53e22a);})[_0x5b12('0x2a')](function(){try{fs[_0x5b12('0x1d')](_0x42cf46);fs[_0x5b12('0x2b')](_0x53e22a,_0x5b12('0x2c'));}catch(_0x7e71ea){logger[_0x5b12('0x17')](_0x7e71ea);}return _0x53e22a['split']('.')[0x0];});};exports[_0x5b12('0x7a')]=function(_0x237f2b,_0x18e70b,_0x36dcf2,_0x146cdd){var _0x454dbf=util[_0x5b12('0x78')](_0x5b12('0x7b'),ISPEECH_API,_0x18e70b,_0x36dcf2,base64Encode(_0x237f2b),_0x146cdd?util['format']('model=%s',encodeURIComponent(_0x146cdd)):_0x5b12('0x7c'));return uploadFile(_0x454dbf)[_0x5b12('0x2a')](function(_0xef125c){return querystring[_0x5b12('0x9')](_0xef125c);});};exports[_0x5b12('0x7d')]=function(_0x17e163,_0x543cdd){return sestek[_0x5b12('0x7e')](_0x17e163,_0x543cdd)[_0x5b12('0x2a')](function(_0x57259c){logger['info'](JSON[_0x5b12('0x41')](_0x57259c));var _0x54700e={'speech':_0x57259c[_0x5b12('0x7f')],'action':_0x57259c[_0x5b12('0x80')]?_0x57259c[_0x5b12('0x80')][_0x5b12('0x81')]:undefined,'actiondata':_0x57259c['channelData']?_0x57259c[_0x5b12('0x80')][_0x5b12('0x82')]:undefined};if(_0x57259c[_0x5b12('0x80')]&&_0x57259c[_0x5b12('0x80')][_0x5b12('0x83')]){return base64Decode(_0x57259c[_0x5b12('0x80')]['AudioFromTts'][_0x5b12('0x84')],path['resolve'](__dirname,_0x5b12('0x26'),rs[_0x5b12('0x37')](0x4)+_0x5b12('0x27')))['then'](function(_0x2b6427){_0x54700e[_0x5b12('0x85')]=_0x2b6427;return _0x54700e;});}return _0x54700e;});};exports[_0x5b12('0x86')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 9d556fa..20eb7f4 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe293=['exports','./nda'];(function(_0x1ac007,_0x5cdfe8){var _0x137c73=function(_0x4d71e3){while(--_0x4d71e3){_0x1ac007['push'](_0x1ac007['shift']());}};_0x137c73(++_0x5cdfe8);}(_0xe293,0xbf));var _0x3e29=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xe293[_0x4d8a8f];return _0xfc4adc;};var nda=require(_0x3e29('0x0'));module[_0x3e29('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe80c=['exports'];(function(_0x585537,_0x313e44){var _0x3db855=function(_0x39684a){while(--_0x39684a){_0x585537['push'](_0x585537['shift']());}};_0x3db855(++_0x313e44);}(_0xe80c,0x1be));var _0xce80=function(_0x7bc5fe,_0x3b27cc){_0x7bc5fe=_0x7bc5fe-0x0;var _0x50e532=_0xe80c[_0x7bc5fe];return _0x50e532;};var nda=require('./nda');module[_0xce80('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1287a2b..aa60b4b 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 _0xb6b1=['calleridname','dnid','extension','text','access_token','project','body','ProjectName','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','../../../../../config/logger','exports','resolve','ndauth_url','/token','password','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid'];(function(_0xc4f00d,_0x919442){var _0x4f595d=function(_0x5804e0){while(--_0x5804e0){_0xc4f00d['push'](_0xc4f00d['shift']());}};_0x4f595d(++_0x919442);}(_0xb6b1,0x17b));var _0x1b6b=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb6b1[_0xdea41a];return _0x15d0d8;};'use strict';var rp=require(_0x1b6b('0x0'));var url=require('url');var logger=require(_0x1b6b('0x1'))('agi');module[_0x1b6b('0x2')]=function(_0x29651a,_0x59b931){var _0x3f12e2={'method':'POST','uri':url[_0x1b6b('0x3')](_0x59b931[_0x1b6b('0x4')],_0x1b6b('0x5')),'form':{'grant_type':_0x1b6b('0x6'),'username':_0x59b931['username'],'password':_0x59b931[_0x1b6b('0x6')]},'json':!![]};return rp(_0x3f12e2)['then'](function(_0xae4115){var _0x5042f7={'method':_0x1b6b('0x7'),'uri':url[_0x1b6b('0x3')](_0x59b931[_0x1b6b('0x8')],_0x1b6b('0x9')),'body':{'type':_0x59b931['ndaactivity_type']||'message','channelId':_0x1b6b('0xa'),'conversation':{'id':_0x29651a[_0x1b6b('0xb')]},'from':{'id':_0x29651a[_0x1b6b('0xc')],'name':_0x29651a[_0x1b6b('0xd')]},'recipient':{'id':_0x29651a[_0x1b6b('0xe')],'name':_0x29651a[_0x1b6b('0xf')]},'text':_0x59b931[_0x1b6b('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xae4115[_0x1b6b('0x11')]},'json':!![]};if(_0x59b931[_0x1b6b('0x12')]){_0x5042f7[_0x1b6b('0x13')]['channelData'][_0x1b6b('0x14')]=_0x59b931['project'];}if(_0x59b931['ndagenerate_audio']=='1'){_0x5042f7[_0x1b6b('0x13')][_0x1b6b('0x15')][_0x1b6b('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1b6b('0x17')};}if(_0x59b931[_0x1b6b('0x18')]){_0x5042f7[_0x1b6b('0x13')][_0x1b6b('0x15')]['CustomAction']=_0x59b931[_0x1b6b('0x18')];if(_0x59b931[_0x1b6b('0x19')]){_0x5042f7[_0x1b6b('0x13')][_0x1b6b('0x15')]['CustomActionData']=_0x59b931[_0x1b6b('0x19')];}}logger[_0x1b6b('0x1a')](JSON[_0x1b6b('0x1b')](_0x5042f7));return rp(_0x5042f7);});}; \ No newline at end of file +var _0xa699=['extension','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','dnid'];(function(_0x500211,_0x1a0367){var _0x48f4e0=function(_0x47a67e){while(--_0x47a67e){_0x500211['push'](_0x500211['shift']());}};_0x48f4e0(++_0x1a0367);}(_0xa699,0x6b));var _0x9a69=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa699[_0x2b10c6];return _0x3789d2;};'use strict';var rp=require(_0x9a69('0x0'));var url=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));module[_0x9a69('0x4')]=function(_0xe12857,_0x19916a){var _0x2d3e1f={'method':_0x9a69('0x5'),'uri':url[_0x9a69('0x6')](_0x19916a[_0x9a69('0x7')],_0x9a69('0x8')),'form':{'grant_type':_0x9a69('0x9'),'username':_0x19916a['username'],'password':_0x19916a[_0x9a69('0x9')]},'json':!![]};return rp(_0x2d3e1f)[_0x9a69('0xa')](function(_0x3bb021){var _0x4665a9={'method':'POST','uri':url[_0x9a69('0x6')](_0x19916a[_0x9a69('0xb')],_0x9a69('0xc')),'body':{'type':_0x19916a[_0x9a69('0xd')]||_0x9a69('0xe'),'channelId':'Nda','conversation':{'id':_0xe12857['uniqueid']},'from':{'id':_0xe12857[_0x9a69('0xf')],'name':_0xe12857['calleridname']},'recipient':{'id':_0xe12857[_0x9a69('0x10')],'name':_0xe12857[_0x9a69('0x11')]},'text':_0x19916a['text'],'channelData':{}},'headers':{'Authorization':_0x9a69('0x12')+_0x3bb021[_0x9a69('0x13')]},'json':!![]};if(_0x19916a['project']){_0x4665a9[_0x9a69('0x14')][_0x9a69('0x15')][_0x9a69('0x16')]=_0x19916a[_0x9a69('0x17')];}if(_0x19916a[_0x9a69('0x18')]=='1'){_0x4665a9[_0x9a69('0x14')][_0x9a69('0x15')][_0x9a69('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9a69('0x1a')};}if(_0x19916a['custom_action']){_0x4665a9[_0x9a69('0x14')][_0x9a69('0x15')][_0x9a69('0x1b')]=_0x19916a['custom_action'];if(_0x19916a[_0x9a69('0x1c')]){_0x4665a9[_0x9a69('0x14')][_0x9a69('0x15')][_0x9a69('0x1d')]=_0x19916a[_0x9a69('0x1c')];}}logger['info'](JSON[_0x9a69('0x1e')](_0x4665a9));return rp(_0x4665a9);});}; \ 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 572ef71..75ce7b7 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 _0x7d28=['./lib/api','exports'];(function(_0x40716d,_0x5c0b93){var _0xf2c6f7=function(_0x23cca1){while(--_0x23cca1){_0x40716d['push'](_0x40716d['shift']());}};_0xf2c6f7(++_0x5c0b93);}(_0x7d28,0x14e));var _0x87d2=function(_0x4d2fe3,_0x420c6d){_0x4d2fe3=_0x4d2fe3-0x0;var _0x58456c=_0x7d28[_0x4d2fe3];return _0x58456c;};'use strict';var asr=require(_0x87d2('0x0'));module[_0x87d2('0x1')]=function(_0x43c975,_0x2db535,_0x3c33ed,_0xa761f8){return asr(_0x43c975,_0x2db535,_0x3c33ed,_0xa761f8);}; \ No newline at end of file +var _0x22a7=['./lib/api','exports'];(function(_0x763f28,_0x4b9acc){var _0x2721f2=function(_0x18f8b2){while(--_0x18f8b2){_0x763f28['push'](_0x763f28['shift']());}};_0x2721f2(++_0x4b9acc);}(_0x22a7,0x1bc));var _0x722a=function(_0x2a8e20,_0x4ddd0c){_0x2a8e20=_0x2a8e20-0x0;var _0x1742c8=_0x22a7[_0x2a8e20];return _0x1742c8;};'use strict';var asr=require(_0x722a('0x0'));module[_0x722a('0x1')]=function(_0x618397,_0x8a0f50,_0x5e7826,_0x520830){return asr(_0x618397,_0x8a0f50,_0x5e7826,_0x520830);}; \ 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 0c2bdfc..0119447 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 _0xbb33=['exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','../../../../../../config/logger'];(function(_0x111c69,_0x5445d8){var _0x5635bc=function(_0x1cfc18){while(--_0x1cfc18){_0x111c69['push'](_0x111c69['shift']());}};_0x5635bc(++_0x5445d8);}(_0xbb33,0xb7));var _0x3bb3=function(_0x4ade33,_0x103537){_0x4ade33=_0x4ade33-0x0;var _0x162cc1=_0xbb33[_0x4ade33];return _0x162cc1;};'use strict';var BPromise=require('bluebird');var _=require(_0x3bb3('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x3bb3('0x1'))('agi');module[_0x3bb3('0x2')]=function(_0x26680b,_0x215ba7,_0x3ac4c9,_0x3ef3c4){return new BPromise(function(_0x1e0f54,_0x116166){logger[_0x3bb3('0x3')](_0x3bb3('0x4'),_0x3ef3c4||_0x3bb3('0x5'));var _0x444d32=new WebSocket(_0x3ef3c4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x23707a='';var _0x5edb11='0';var _0x4d900c='1';var _0xba5184=_0x3bb3('0x6');function _0x57c292(_0x1b1ca9){var _0x52ed84=crypto['createHash'](_0x3bb3('0x7'));_0x52ed84[_0x3bb3('0x8')](_0x1b1ca9);return _0x52ed84[_0x3bb3('0x9')](_0x3bb3('0xa'));}function _0x5edd16(){try{logger['info'](_0x3bb3('0xb'));var _0x4aab27=moment()['unix']();var _0x126d75=_0x57c292(_0x4aab27+_0x215ba7+_0x3ac4c9);_0x444d32[_0x3bb3('0xc')](JSON[_0x3bb3('0xd')]({'appID':_0x215ba7,'timestamp':_0x4aab27,'appKey':_0x126d75}));var _0x3d2022=fs[_0x3bb3('0xe')](_0x26680b);_0x3d2022['on'](_0x3bb3('0xf'),function(_0x5c90aa){_0x444d32[_0x3bb3('0xc')](_0x5c90aa);});_0x3d2022['on'](_0x3bb3('0x10'),function(){_0x444d32[_0x3bb3('0xc')]('EOS');});}catch(_0x51b18d){logger[_0x3bb3('0x11')](_0x3bb3('0x12'),JSON['stringify'](_0x51b18d));_0x444d32[_0x3bb3('0x13')]();}}function _0x39db63(_0x188016){try{if(_0x188016){var _0x107da2=JSON[_0x3bb3('0x14')](_0x188016);switch(_0x107da2[_0x3bb3('0x15')]){case 0x0:if(_0x107da2[_0x3bb3('0x16')]){if(_0x107da2[_0x3bb3('0x16')][_0x3bb3('0x17')]){logger[_0x3bb3('0x3')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x107da2['result'][_0x3bb3('0x18')]));_0x23707a=_0x107da2[_0x3bb3('0x16')][_0x3bb3('0x18')][0x0][_0x3bb3('0x19')];_0x5edb11=_0x107da2[_0x3bb3('0x16')][_0x3bb3('0x18')][0x0][_0x3bb3('0x1a')];_0x4d900c='0';_0xba5184=_0x3bb3('0x1b');_0x444d32['terminate']();}}break;case 0x1:logger[_0x3bb3('0x3')](_0x3bb3('0x6'));_0x4d900c='1';_0xba5184='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x3bb3('0x3')](_0x3bb3('0x1c'));_0x4d900c='2';_0xba5184=_0x3bb3('0x1c');break;case 0x9:logger['info'](_0x3bb3('0x1d'));_0x4d900c='9';_0xba5184=_0x3bb3('0x1d');break;case 0xa:logger[_0x3bb3('0x3')](_0x3bb3('0x1e'));_0x4d900c='10';_0xba5184=_0x3bb3('0x1e');break;case 0xb:logger['info'](_0x3bb3('0x1f'));_0x4d900c='11';_0xba5184=_0x3bb3('0x1f');}}}catch(_0x295e70){logger[_0x3bb3('0x11')](_0x3bb3('0x20'),JSON[_0x3bb3('0xd')](_0x295e70));_0x444d32['terminate']();}}function _0x47c50c(){logger['info'](_0x3bb3('0x21'));_0x1e0f54({'transcript':_0x23707a,'confidence':_0x5edb11,'status':_0x4d900c,'status_message':_0xba5184});}function _0x126c16(_0x47fd62){logger[_0x3bb3('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3bb3('0x22')](_0x47fd62)){logger[_0x3bb3('0x11')](_[_0x3bb3('0x23')](_0x47fd62)?JSON[_0x3bb3('0xd')](_0x47fd62):_0x47fd62);}}_0x444d32['on']('open',_0x5edd16);_0x444d32['on'](_0x3bb3('0x24'),_0x39db63);_0x444d32['on']('close',_0x47c50c);_0x444d32['on'](_0x3bb3('0x11'),_0x126c16);});}; \ No newline at end of file +var _0x09e5=['createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','send','close','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','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','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x09e5,0x1e5));var _0x509e=function(_0x294e68,_0x1a36f5){_0x294e68=_0x294e68-0x0;var _0x10642a=_0x09e5[_0x294e68];return _0x10642a;};'use strict';var BPromise=require(_0x509e('0x0'));var _=require(_0x509e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x509e('0x2'));var crypto=require(_0x509e('0x3'));var logger=require(_0x509e('0x4'))('agi');module[_0x509e('0x5')]=function(_0x41d909,_0x2df706,_0x491ecd,_0x5629b7){return new BPromise(function(_0x50c0e9,_0x130da6){logger[_0x509e('0x6')](_0x509e('0x7'),_0x5629b7||_0x509e('0x8'));var _0x1b701a=new WebSocket(_0x5629b7||_0x509e('0x8'),{'perMessageDeflate':![]});var _0x539507='';var _0x45d967='0';var _0x3ffcfe='1';var _0x1900eb='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x55da7b(_0x4aee49){var _0x4a3cb9=crypto[_0x509e('0x9')](_0x509e('0xa'));_0x4a3cb9[_0x509e('0xb')](_0x4aee49);return _0x4a3cb9[_0x509e('0xc')](_0x509e('0xd'));}function _0x46f5c5(){try{logger[_0x509e('0x6')](_0x509e('0xe'));var _0x445fdf=moment()['unix']();var _0x5d8c7e=_0x55da7b(_0x445fdf+_0x2df706+_0x491ecd);_0x1b701a['send'](JSON[_0x509e('0xf')]({'appID':_0x2df706,'timestamp':_0x445fdf,'appKey':_0x5d8c7e}));var _0x23eb24=fs[_0x509e('0x10')](_0x41d909);_0x23eb24['on']('data',function(_0x280cac){_0x1b701a[_0x509e('0x11')](_0x280cac);});_0x23eb24['on'](_0x509e('0x12'),function(){_0x1b701a[_0x509e('0x11')]('EOS');});}catch(_0x38e4a9){logger[_0x509e('0x13')](_0x509e('0x14'),JSON['stringify'](_0x38e4a9));_0x1b701a[_0x509e('0x15')]();}}function _0x43079b(_0x4c23e0){try{if(_0x4c23e0){var _0x54948d=JSON['parse'](_0x4c23e0);switch(_0x54948d[_0x509e('0x16')]){case 0x0:if(_0x54948d[_0x509e('0x17')]){if(_0x54948d[_0x509e('0x17')]['final']){logger[_0x509e('0x6')](_0x509e('0x18'),JSON[_0x509e('0xf')](_0x54948d[_0x509e('0x17')]['hypotheses']));_0x539507=_0x54948d[_0x509e('0x17')]['hypotheses'][0x0]['transcript'];_0x45d967=_0x54948d['result'][_0x509e('0x19')][0x0]['likelihood'];_0x3ffcfe='0';_0x1900eb=_0x509e('0x1a');_0x1b701a['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3ffcfe='1';_0x1900eb=_0x509e('0x1b');break;case 0x2:logger[_0x509e('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3ffcfe='2';_0x1900eb='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x509e('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3ffcfe='9';_0x1900eb=_0x509e('0x1c');break;case 0xa:logger[_0x509e('0x6')](_0x509e('0x1d'));_0x3ffcfe='10';_0x1900eb='Authentication\x20failed.';break;case 0xb:logger[_0x509e('0x6')](_0x509e('0x1e'));_0x3ffcfe='11';_0x1900eb=_0x509e('0x1e');}}}catch(_0x2f7dad){logger[_0x509e('0x13')](_0x509e('0x1f'),JSON[_0x509e('0xf')](_0x2f7dad));_0x1b701a[_0x509e('0x15')]();}}function _0x4031e0(){logger[_0x509e('0x6')](_0x509e('0x20'));_0x50c0e9({'transcript':_0x539507,'confidence':_0x45d967,'status':_0x3ffcfe,'status_message':_0x1900eb});}function _0x354d23(_0x534b29){logger[_0x509e('0x13')](_0x509e('0x21'));if(!_[_0x509e('0x22')](_0x534b29)){logger[_0x509e('0x13')](_[_0x509e('0x23')](_0x534b29)?JSON[_0x509e('0xf')](_0x534b29):_0x534b29);}}_0x1b701a['on'](_0x509e('0x24'),_0x46f5c5);_0x1b701a['on'](_0x509e('0x25'),_0x43079b);_0x1b701a['on'](_0x509e('0x12'),_0x4031e0);_0x1b701a['on'](_0x509e('0x13'),_0x354d23);});}; \ 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 384648a..10cb4be 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 _0xebe9=['./asr','exports'];(function(_0x40d534,_0xc3ea1d){var _0x5b93c3=function(_0x55bed1){while(--_0x55bed1){_0x40d534['push'](_0x40d534['shift']());}};_0x5b93c3(++_0xc3ea1d);}(_0xebe9,0x70));var _0x9ebe=function(_0x4adf44,_0x188e88){_0x4adf44=_0x4adf44-0x0;var _0x3bcb5d=_0xebe9[_0x4adf44];return _0x3bcb5d;};var asr=require(_0x9ebe('0x0'));module[_0x9ebe('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b7030f4..869005b 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x134058,_0x423995){var _0x14a1a9=function(_0x47a2c9){while(--_0x47a2c9){_0x134058['push'](_0x134058['shift']());}};_0x14a1a9(++_0x423995);}(_0xe706,0xa3));var _0x6e70=function(_0x2d21cc,_0x27ef2a){_0x2d21cc=_0x2d21cc-0x0;var _0x7ab87e=_0xe706[_0x2d21cc];return _0x7ab87e;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0xe706,0xa3));var _0x6e70=function(_0x58a872,_0x50d43a){_0x58a872=_0x58a872-0x0;var _0x3e1577=_0xe706[_0x58a872];return _0x3e1577;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c9ef130..7a4a9aa 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 _0xa596=['Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','getData','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','createSquareRecording','RECORDING_SAVENAME','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','split','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','mailRpc','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','channel','callerid','extension','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','stringify','render','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','label','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','list_id','no\x20list\x20selected','delay','add','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','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\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','url','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','goal','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','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup'];(function(_0x3baaba,_0x134693){var _0x1c8c85=function(_0x1a1de5){while(--_0x1a1de5){_0x3baaba['push'](_0x3baaba['shift']());}};_0x1c8c85(++_0x134693);}(_0xa596,0x7b));var _0x6a59=function(_0x8ff653,_0x4101ee){_0x8ff653=_0x8ff653-0x0;var _0xd709bd=_0xa596[_0x8ff653];return _0xd709bd;};'use strict';var fs=require('fs');var util=require(_0x6a59('0x0'));var _=require(_0x6a59('0x1'));var sh=require('shelljs');var odbc=require(_0x6a59('0x2'))();var rs=require(_0x6a59('0x3'));var moment=require(_0x6a59('0x4'));var Mustache=require(_0x6a59('0x5'));var rp=require(_0x6a59('0x6'));var logger=require(_0x6a59('0x7'))(_0x6a59('0x8'));var config=require(_0x6a59('0x9'));var shared=require('../../config/environment/shared');var scripts=require(_0x6a59('0xa'));var FILES_PATH=_0x6a59('0xb');var recursiveMapAttributes=[_0x6a59('0xc'),_0x6a59('0xd')];var verticesWithRetry=[_0x6a59('0xe'),_0x6a59('0xf'),'getsecretdigits'];var AGIVertices=function(_0x3f25d8,_0x48ecee,_0x21008c){this['channel']=_0x3f25d8;this['rpc']=_0x48ecee;this[_0x6a59('0x10')]=_0x21008c;};AGIVertices[_0x6a59('0x11')][_0x6a59('0x12')]=function(_0x542b9d,_0x40fc4c){this[_0x6a59('0x13')]['getVariableById'](_0x542b9d)[_0x6a59('0x14')](function(_0x4bf880){_0x40fc4c(null,_0x4bf880?_0x4bf880[_0x6a59('0x15')]:![]);})[_0x6a59('0x16')](function(_0x177506){_0x40fc4c(_0x177506);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x17')]=function(_0x108c02,_0x1a1e36){this[_0x6a59('0x13')][_0x6a59('0x18')](_0x108c02)[_0x6a59('0x14')](function(_0x3bef82){_0x1a1e36(null,_0x3bef82?_0x3bef82['name']:![]);})[_0x6a59('0x16')](function(_0x1ec768){_0x1a1e36(_0x1ec768);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x19')]=function(_0x258441,_0x39ad1e){this['rpc'][_0x6a59('0x1a')](_0x258441)[_0x6a59('0x14')](function(_0x3cb568){_0x39ad1e(null,_0x3cb568?_0x3cb568[_0x6a59('0x15')]:![]);})[_0x6a59('0x16')](function(_0x2b15b0){_0x39ad1e(_0x2b15b0);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1b')]=function(_0xe7d724,_0x2ac36d){this[_0x6a59('0x13')][_0x6a59('0x1c')](_0xe7d724)[_0x6a59('0x14')](function(_0x394f60){_0x2ac36d(null,_0x394f60?_0x394f60[_0x6a59('0x1d')]:![]);})[_0x6a59('0x16')](function(_0x3af7a7){_0x2ac36d(_0x3af7a7);});};AGIVertices['prototype'][_0x6a59('0x1e')]=function(_0x3e068b,_0xe2573f){this[_0x6a59('0x13')]['getUserById'](_0x3e068b)['then'](function(_0x1a38d1){_0xe2573f(null,_0x1a38d1?_0x1a38d1[_0x6a59('0x15')]:![]);})[_0x6a59('0x16')](function(_0x3d3bdc){_0xe2573f(_0x3d3bdc);});};AGIVertices['prototype']['getTrunk']=function(_0x344cea,_0x28321b){this['rpc'][_0x6a59('0x1f')](_0x344cea)['then'](function(_0x342292){_0x28321b(null,_0x342292?_0x342292[_0x6a59('0x15')]:![]);})['catch'](function(_0x4174ee){_0x28321b(_0x4174ee);});};AGIVertices['prototype'][_0x6a59('0x20')]=function(_0x279112,_0x4a183e){var _0x199317=this;this['rpc'][_0x6a59('0x21')](_0x279112)[_0x6a59('0x14')](function(_0x205b4d){_0x4a183e(null,_0x205b4d?_0x199317[_0x6a59('0x22')](_0x205b4d[_0x6a59('0x23')]):![]);})[_0x6a59('0x16')](function(_0x4e657a){_0x4a183e(_0x4e657a);});};AGIVertices['prototype'][_0x6a59('0x24')]=function(_0x37f63f,_0x563675){this[_0x6a59('0x13')]['getMailAccountById'](_0x37f63f)[_0x6a59('0x14')](function(_0x20b44d){_0x563675(null,_0x20b44d?_0x20b44d:![]);})[_0x6a59('0x16')](function(_0x47e7fb){_0x563675(_0x47e7fb);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x25')]=function(_0x41455,_0x4e1c6d,_0x25fc63){this[_0x6a59('0x10')]['sendMailMessage'](_0x41455,_0x4e1c6d)[_0x6a59('0x14')](function(){_0x25fc63(null);})['catch'](function(_0x1f1024){_0x25fc63(_0x1f1024);});};AGIVertices[_0x6a59('0x11')]['getIntervals']=function(_0x7a769f,_0x2af776){this['rpc']['getIntervalById'](_0x7a769f)['then'](function(_0x595f72){if(_0x595f72){if(_0x595f72['IntervalId']){_0x2af776(null,[_0x595f72[_0x6a59('0x26')]]);}else{_0x2af776(null,_[_0x6a59('0x27')](_0x595f72[_0x6a59('0x28')],'interval'));}}else{_0x2af776(null,![]);}})[_0x6a59('0x16')](function(_0x24cf48){_0x2af776(_0x24cf48);});};AGIVertices['prototype']['getSoundPath']=function(_0x1263bb){return util['format'](_0x6a59('0x29'),FILES_PATH,_0x1263bb);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x2a')]=function(_0x3077d5,_0x31b9bc,_0x1a57f8){odbc[_0x6a59('0x2b')](_0x3077d5,function(_0xa518ed){if(_0xa518ed){logger[_0x6a59('0x2c')](_0x6a59('0x2d'),_0xa518ed);_0x1a57f8(_0xa518ed);}else{logger[_0x6a59('0x2e')](_0x6a59('0x2f'));odbc[_0x6a59('0x30')](_0x31b9bc,function(_0x1fb589,_0x7f7a28){if(_0x1fb589){logger[_0x6a59('0x2e')]('Error\x20executing\x20query\x20%s',_0x31b9bc);_0x1a57f8(_0x1fb589);}else{logger[_0x6a59('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x31b9bc);odbc[_0x6a59('0x31')](function(_0x332e48){if(_0x332e48){logger[_0x6a59('0x2c')](_0x6a59('0x32'),_0x332e48);}_0x1a57f8(null,_0x7f7a28);});}});}});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x33')]=function(_0x2c5e8e,_0x373f9c){this[_0x6a59('0x13')]['getSmsAccountById'](_0x2c5e8e)[_0x6a59('0x14')](function(_0x6f6dab){_0x373f9c(null,_0x6f6dab?_0x6f6dab:![]);})[_0x6a59('0x16')](function(_0x55a17d){_0x373f9c(_0x55a17d);});};AGIVertices['prototype'][_0x6a59('0x34')]=function(_0x2d3eff,_0x3722f5){this['rpc'][_0x6a59('0x34')](_0x2d3eff)[_0x6a59('0x14')](function(_0x399532){_0x3722f5(null,_0x399532);})['catch'](function(_0x5a4354){_0x3722f5(_0x5a4354);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x35')]=function(_0x3f4396,_0x227d8e,_0xfd5bd0){this[_0x6a59('0x13')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x6a59('0x36')],'node':_0x3f4396['label'],'application':_0x3f4396[_0x6a59('0x37')],'data':_0x227d8e||null,'project_name':this[_0x6a59('0x38')]['arg_1'],'callerid':this[_0x6a59('0x38')][_0x6a59('0x39')]})[_0x6a59('0x14')](function(_0x234914){if(_0xfd5bd0){_0xfd5bd0(null,_0x234914);}})[_0x6a59('0x16')](function(_0x481ed2){if(_0xfd5bd0){_0xfd5bd0(_0x481ed2);}});};AGIVertices[_0x6a59('0x11')]['createSquareRecording']=function(_0x4fdc97,_0x5b67b3,_0x49359c,_0x3f1123){this[_0x6a59('0x13')]['createSquareRecording']({'uniqueid':this[_0x6a59('0x38')][_0x6a59('0x36')],'callerid':this[_0x6a59('0x38')]['callerid'],'calleridname':this['channel']['calleridname'],'context':this[_0x6a59('0x38')]['context'],'extension':this[_0x6a59('0x38')][_0x6a59('0x3a')],'priority':this['channel']['priority'],'accountcode':this['channel'][_0x6a59('0x3b')],'dnid':this[_0x6a59('0x38')][_0x6a59('0x3c')],'projectName':this[_0x6a59('0x38')][_0x6a59('0x3d')],'saveName':_0x5b67b3,'filename':_0x4fdc97[_0x6a59('0x3e')]||_0x5b67b3,'savePath':_0x49359c})[_0x6a59('0x14')](function(_0x5778a6){_0x3f1123(null,_0x5778a6);})[_0x6a59('0x16')](function(_0xc24a7d){_0x3f1123(_0xc24a7d);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x3f')]=function(_0xfd5736,_0x555783,_0x3099e5,_0x3c9109,_0x424812){this[_0x6a59('0x13')][_0x6a59('0x3f')]({'uniqueid':this[_0x6a59('0x38')]['uniqueid'],'body':_0xfd5736,'direction':_0x555783,'providerName':_0x3099e5,'providerResponse':_0x3c9109})[_0x6a59('0x14')](function(_0x49e279){if(_0x424812){_0x424812(null,_0x49e279);}})[_0x6a59('0x16')](function(_0x1742b4){if(_0x424812){_0x424812(_0x1742b4);}});};AGIVertices[_0x6a59('0x11')]['createCmContact']=function(_0x5ed91b,_0x5a4a3c){this[_0x6a59('0x13')][_0x6a59('0x40')]({'firstName':_['isEmpty'](_0x5ed91b[_0x6a59('0x15')])||_[_0x6a59('0x41')](_0x5ed91b[_0x6a59('0x15')])?_0x6a59('0x42')+Math['random']():_0x5ed91b['name'],'lastName':_[_0x6a59('0x43')](_0x5ed91b[_0x6a59('0x44')])||_[_0x6a59('0x41')](_0x5ed91b[_0x6a59('0x44')])?null:_0x5ed91b[_0x6a59('0x44')],'phone':_0x5ed91b['phone'],'ListId':_0x5ed91b['list_id'],'scheduledat':_0x5ed91b[_0x6a59('0x45')],'callbackUniqueid':this[_0x6a59('0x38')][_0x6a59('0x36')],'tags':'callback','description':_0x6a59('0x46')+_0x5ed91b['scheduledAt'][_0x6a59('0x47')](),'priority':_0x5ed91b[_0x6a59('0x48')]})['then'](function(_0x19c499){_0x5a4a3c(null,_0x19c499);})[_0x6a59('0x16')](function(_0x737ebf){_0x5a4a3c(_0x737ebf);});};AGIVertices[_0x6a59('0x11')]['getPause']=function(_0x1c06e4,_0x3b9bca){this[_0x6a59('0x13')][_0x6a59('0x49')](_0x1c06e4)[_0x6a59('0x14')](function(_0x81a9e0){_0x3b9bca(null,_0x81a9e0?_0x81a9e0['name']:![]);})[_0x6a59('0x16')](function(_0x1e0cc1){_0x3b9bca(_0x1e0cc1);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x4a')]=function(_0x5ad30c,_0x354672,_0x46dd4a){var _0x558431={'role':_0x6a59('0x4b')};_0x558431[_0x5ad30c]=this['channel'][_0x6a59('0x39')];this['rpc'][_0x6a59('0x4a')](_0x558431,_0x354672,this[_0x6a59('0x38')][_0x6a59('0x36')])[_0x6a59('0x14')](function(_0x1b8132){_0x46dd4a(null,_[_0x6a59('0x41')](_0x1b8132)?![]:!![]);})[_0x6a59('0x16')](function(_0x365e1d){logger[_0x6a59('0x2c')](_0x365e1d);_0x46dd4a(null,![]);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x4c')]=function(_0x2ae7f4,_0x1f66d5){var _0x4fe4ca={'role':_0x6a59('0x4b')};_0x4fe4ca[_0x2ae7f4]=this['channel']['callerid'];this[_0x6a59('0x13')][_0x6a59('0x4c')](_0x4fe4ca)['then'](function(_0x522bfa){_0x1f66d5(null,_['isNil'](_0x522bfa)?![]:!![]);})[_0x6a59('0x16')](function(_0x4e8739){logger[_0x6a59('0x2c')](_0x4e8739);_0x1f66d5(null,![]);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x4d')]=function(_0x1acf9f,_0x28a554){var _0x3a4f79={'role':'agent'};_0x3a4f79[_0x1acf9f]=this[_0x6a59('0x38')][_0x6a59('0x39')];this[_0x6a59('0x13')][_0x6a59('0x4d')](_0x3a4f79)[_0x6a59('0x14')](function(_0x5796df){_0x28a554(null,_[_0x6a59('0x41')](_0x5796df)?![]:!![]);})[_0x6a59('0x16')](function(_0x425233){logger[_0x6a59('0x2c')](_0x425233);_0x28a554(null,![]);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x4e')]=function(_0x5a9c68,_0x2e6637){var _0x569cf4={'role':'agent'};_0x569cf4[_0x5a9c68]=this[_0x6a59('0x38')][_0x6a59('0x39')];var _0x1131de=_0x5a9c68!='internal'?util[_0x6a59('0x4f')](_0x6a59('0x50'),'LOCAL',this[_0x6a59('0x38')][_0x6a59('0x39')]):undefined;this['rpc'][_0x6a59('0x4e')](_0x569cf4,_0x1131de)[_0x6a59('0x14')](function(_0x55af4d){_0x2e6637(null,_[_0x6a59('0x41')](_0x55af4d)?![]:!![]);})['catch'](function(_0x145e4b){logger[_0x6a59('0x2c')](_0x145e4b);_0x2e6637(null,![]);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x51')]=function(_0x109bdf,_0x531b2e){sh['exec'](_[_0x6a59('0x52')](_0x109bdf),function(_0x235f24,_0x5714a6){var _0x4e534b=_0x5714a6[_0x6a59('0x53')](/(\r\n|\n|\r)/gm,'');_0x531b2e(null,_0x4e534b);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x521e64,_0x25febc){scripts[_0x6a59('0x54')](_0x521e64['apiKey'],_0x521e64[_0x6a59('0x55')]||_0x6a59('0x56'),_0x521e64[_0x6a59('0x56')],_0x521e64['languageCode']||_0x6a59('0x57'),_0x521e64[_0x6a59('0x58')]||_0x6a59('0x59'),_0x521e64[_0x6a59('0x5a')]||_0x6a59('0x5b'))[_0x6a59('0x14')](function(_0x12393b){_0x25febc(null,_0x12393b);})['catch'](function(_0xe7cdf3){_0x25febc(_0xe7cdf3);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x5c')]=function(_0x147056,_0x183dd1){scripts[_0x6a59('0x5c')](_0x147056[_0x6a59('0x56')],_0x147056['google_tts_language']||'en',0x1)['then'](function(_0x41a6e4){_0x183dd1(null,_0x41a6e4);})[_0x6a59('0x16')](function(_0xb7ff98){_0x183dd1(_0xb7ff98);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x5d')]=function(_0x3a3dc6,_0x5c91d0){var _0x29a5eb={'uri':_0x3a3dc6['url'],'method':_0x3a3dc6[_0x6a59('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3a3dc6[_0x6a59('0x5f')])===_0x6a59('0x60')&&parseInt(_0x3a3dc6[_0x6a59('0x5f')])>=0x1?parseInt(_0x3a3dc6[_0x6a59('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x6a59('0x61')]([_0x6a59('0x62'),'PUT'],_0x29a5eb[_0x6a59('0x5e')][_0x6a59('0x63')]())){try{_0x29a5eb[_0x6a59('0x64')]=_0x3a3dc6[_0x6a59('0xd')]?JSON[_0x6a59('0x65')](_0x3a3dc6['rawBody']):{};}catch(_0x268c26){logger[_0x6a59('0x2c')](_0x6a59('0x66'),_0x268c26);}}try{_0x29a5eb[_0x6a59('0x67')]=_0x3a3dc6[_0x6a59('0xc')]?JSON[_0x6a59('0x65')](_0x3a3dc6[_0x6a59('0xc')]):{};}catch(_0x180896){logger['error'](_0x6a59('0x68'),_0x180896);}if(_0x3a3dc6[_0x6a59('0x69')]){try{var _0x1e6382=require(_0x3a3dc6[_0x6a59('0x69')])['sync'](this,_0x29a5eb);_0x29a5eb[_0x6a59('0x6a')]=Mustache['render'](_0x3a3dc6['url'],_0x1e6382,{},['$$','$$']);if(_0x29a5eb['headers']){_0x29a5eb['headers']=JSON[_0x6a59('0x65')](Mustache['render'](JSON[_0x6a59('0x6b')](_0x29a5eb[_0x6a59('0x67')]),_0x1e6382,{},['$$','$$']));}if(_0x29a5eb[_0x6a59('0x64')]){_0x29a5eb[_0x6a59('0x64')]=JSON[_0x6a59('0x65')](Mustache[_0x6a59('0x6c')](JSON[_0x6a59('0x6b')](_0x29a5eb[_0x6a59('0x64')]),_0x1e6382,{},['$$','$$']));}}catch(_0x35a65e){logger[_0x6a59('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x35a65e);}}rp(_0x29a5eb)['then'](function(_0x4ed0bc){var _0x5c0d01={'statusCode':_0x4ed0bc[_0x6a59('0x6d')]||0xc8,'statusMessage':_0x4ed0bc['statusMessage']||'OK','headers':_0x4ed0bc[_0x6a59('0x67')]||{},'body':_0x4ed0bc['body']||{}};_0x5c91d0(null,_0x5c0d01);})['catch'](function(_0x232f4e){var _0x1b40a4={'statusCode':_0x232f4e[_0x6a59('0x6d')]||0x1f4,'statusMessage':_0x232f4e[_0x6a59('0x6e')]||_0x6a59('0x6f'),'headers':_0x232f4e[_0x6a59('0x70')]['headers']||{},'body':_0x232f4e[_0x6a59('0x70')][_0x6a59('0x64')]||{}};_0x5c91d0(null,_0x1b40a4);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x71')]=function(_0x3377a5,_0x4fa4a4){scripts['googleDialogflow'](this[_0x6a59('0x38')][_0x6a59('0x36')],_0x3377a5[_0x6a59('0x72')],_0x3377a5['text'],_0x3377a5['dialogflow_language']||'en')[_0x6a59('0x14')](function(_0x40298f){_0x4fa4a4(null,_0x40298f);})[_0x6a59('0x16')](function(_0x354700){_0x4fa4a4(_0x354700);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x73')]=function(_0x116039,_0x131891){scripts[_0x6a59('0x73')](this['channel'][_0x6a59('0x36')],_0x116039[_0x6a59('0x74')],_0x116039[_0x6a59('0x75')],_0x116039[_0x6a59('0x76')],_0x116039['text'],_0x116039[_0x6a59('0x77')]||'en')['then'](function(_0x274cf2){_0x131891(null,_0x274cf2);})['catch'](function(_0x55a6ff){_0x131891(_0x55a6ff);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x78')]=function(_0x956a1a,_0xc07940){scripts[_0x6a59('0x78')](this[_0x6a59('0x38')],_0x956a1a)[_0x6a59('0x14')](function(_0x459b03){_0xc07940(null,_0x459b03);})['catch'](function(_0x18b2cc){_0xc07940(_0x18b2cc);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x79')]=function(_0x263ec0,_0x20643f){scripts[_0x6a59('0x79')](_0x263ec0[_0x6a59('0x72')],_0x263ec0[_0x6a59('0x56')],_0x263ec0[_0x6a59('0x7a')]||_0x6a59('0x57'),_0x263ec0[_0x6a59('0x7b')])[_0x6a59('0x14')](function(_0x100f25){_0x20643f(null,_0x100f25);})['catch'](function(_0xc160f){_0x20643f(_0xc160f);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x7c')]=function(_0x847b9b,_0x1bcb94,_0x1392c9){scripts[_0x6a59('0x7c')](_0x1bcb94,_0x847b9b[_0x6a59('0x72')],_0x847b9b[_0x6a59('0x7d')]||'en-US',this[_0x6a59('0x7e')](_0x847b9b[_0x6a59('0x7f')])?_0x847b9b[_0x6a59('0x7f')]:undefined)[_0x6a59('0x14')](function(_0x28bcd2){_0x1392c9(null,_0x28bcd2);})[_0x6a59('0x16')](function(_0x12d3d2){_0x1392c9(_0x12d3d2);});};AGIVertices['prototype'][_0x6a59('0x80')]=function(_0x22831a,_0x1fdea9){scripts['awsPolly'](_0x22831a['aws_access_key_id'],_0x22831a['aws_secret_access_key'],_0x22831a[_0x6a59('0x81')],_0x22831a[_0x6a59('0x82')]||_0x6a59('0x83'),_0x22831a['text'],_0x22831a[_0x6a59('0x84')]||'text')[_0x6a59('0x14')](function(_0x11b159){_0x1fdea9(null,_0x11b159);})['catch'](function(_0x28b56e){_0x1fdea9(_0x28b56e);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x85')]=function(_0x1a2128,_0x387153){scripts[_0x6a59('0x85')](this[_0x6a59('0x38')][_0x6a59('0x36')],_0x1a2128[_0x6a59('0x86')],_0x1a2128[_0x6a59('0x87')],_0x1a2128[_0x6a59('0x88')],_0x1a2128['text'],_0x1a2128[_0x6a59('0x89')])[_0x6a59('0x14')](function(_0x5543da){_0x387153(null,_0x5543da);})['catch'](function(_0x333170){_0x387153(_0x333170);});};AGIVertices['prototype'][_0x6a59('0x8a')]=function(_0x2f9179,_0x32c23e,_0x51931d){scripts[_0x6a59('0x8a')](_0x32c23e,_0x2f9179[_0x6a59('0x72')],_0x2f9179[_0x6a59('0x8b')]||_0x6a59('0x57'))[_0x6a59('0x14')](function(_0x4de037){_0x51931d(null,_0x4de037);})[_0x6a59('0x16')](function(_0x455b99){_0x51931d(_0x455b99);});};AGIVertices[_0x6a59('0x11')][_0x6a59('0x8c')]=function(_0x34e39a,_0x4b71cb,_0x4aa510){scripts[_0x6a59('0x8c')](_0x4b71cb,_0x34e39a['appid'],_0x34e39a[_0x6a59('0x8d')],_0x34e39a[_0x6a59('0x6a')])[_0x6a59('0x14')](function(_0x6f24a8){_0x4aa510(null,_0x6f24a8);})['catch'](function(_0x494280){_0x4aa510(_0x494280);});};AGIVertices['prototype'][_0x6a59('0x8e')]=function(_0x27909f){var _0x57b25d=_[_0x6a59('0x61')](verticesWithRetry,_0x27909f['agicommand'])?_0x27909f:_[_0x6a59('0x8f')](_0x27909f);for(var _0xac4f3e in _0x57b25d){if(_0x57b25d[_0x6a59('0x90')](_0xac4f3e)){if(_0x57b25d[_0xac4f3e]&&_[_0x6a59('0x91')](_0x57b25d[_0xac4f3e])){if(_[_0x6a59('0x61')](recursiveMapAttributes,_0xac4f3e)){_0x57b25d[_0xac4f3e]=this[_0x6a59('0x92')](_0x57b25d[_0xac4f3e]);}else{_0x57b25d[_0xac4f3e]=this[_0x6a59('0x93')](_0x57b25d[_0xac4f3e]);}}}}return _0x57b25d;};AGIVertices[_0x6a59('0x11')][_0x6a59('0x94')]=function(_0x202c9e){for(var _0x90092d in _0x202c9e){if(_0x202c9e['hasOwnProperty'](_0x90092d)){if(_[_0x6a59('0x95')](_0x202c9e[_0x90092d])){this['recursiveNodeIndex'](_0x202c9e[_0x90092d]);}else if(_[_0x6a59('0x96')](_0x202c9e[_0x90092d])){for(var _0x5345e5=0x0;_0x5345e5<_0x202c9e[_0x90092d][_0x6a59('0x97')];_0x5345e5++){this[_0x6a59('0x94')](_0x202c9e[_0x90092d][_0x5345e5]);}}else if(_[_0x6a59('0x91')](_0x202c9e[_0x90092d])){_0x202c9e[_0x90092d]=this[_0x6a59('0x93')](_0x202c9e[_0x90092d]);}}}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x98')]=function(_0x3d099a,_0x4986b9){for(var _0x5c2159 in _0x3d099a){if(_0x3d099a[_0x6a59('0x90')](_0x5c2159)){if(_[_0x6a59('0x95')](_0x3d099a[_0x5c2159])){if(!_[_0x6a59('0x43')](_0x3d099a[_0x5c2159])){this['saveRestApiResult'](_0x3d099a[_0x5c2159],util['format'](_0x6a59('0x99'),_0x4986b9,_0x5c2159));}}else if(_[_0x6a59('0x96')](_0x3d099a[_0x5c2159])){for(var _0x2093c7=0x0;_0x2093c7<_0x3d099a[_0x5c2159][_0x6a59('0x97')];_0x2093c7++){this[_0x6a59('0x98')](_0x3d099a[_0x5c2159][_0x2093c7],util[_0x6a59('0x4f')](_0x6a59('0x99'),_0x4986b9,_0x5c2159+'['+_0x2093c7+']'));}}else{if(!_[_0x6a59('0x41')](_0x3d099a[_0x5c2159])){this[_0x6a59('0x38')]['setVariable'](util[_0x6a59('0x4f')](_0x6a59('0x99'),_0x4986b9,_0x5c2159),_0x3d099a[_0x5c2159]);}}}}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x92')]=function(_0x1f359b){try{var _0x5104f7=JSON[_0x6a59('0x65')](_0x1f359b);this[_0x6a59('0x94')](_0x5104f7);return JSON[_0x6a59('0x6b')](_0x5104f7);}catch(_0x2c44c5){return this[_0x6a59('0x93')](_0x1f359b);}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x93')]=function(_0x1a8a9a){var _0x1fb503=_0x1a8a9a['split']('{');for(var _0xadff7b=0x1;_0xadff7b<_0x1fb503[_0x6a59('0x97')];_0xadff7b+=0x1){var _0x5585b0=_0x1fb503[_0xadff7b]['split']('}');if(_0x5585b0[_0x6a59('0x97')]>0x1){_0x1a8a9a=_0x1a8a9a[_0x6a59('0x9a')]('{'+_0x5585b0[0x0]+'}',this['channel'][_0x6a59('0x12')](_0x5585b0[0x0])[_0x6a59('0x9b')]||_0x5585b0[0x0]);}}if(_0x1fb503['length']===0x1){return _0x1a8a9a['toString']();}return this[_0x6a59('0x93')](_0x1a8a9a);};AGIVertices['prototype'][_0x6a59('0x9c')]=function(_0x2ab07c,_0x3f457e){var _0x4f0537=this[_0x6a59('0x38')][_0x6a59('0x12')](_0x2ab07c);if(_0x4f0537['result']===-0x1){return _0x4f0537;}logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x9d'),_0x3f457e,_0x4f0537[_0x6a59('0x9b')]));return this[_0x6a59('0x38')][_0x6a59('0x9e')](_0x3f457e,_0x4f0537['extra']);};AGIVertices['prototype'][_0x6a59('0x7e')]=function(_0x42b298){return _0x42b298&&_0x42b298!=='0'&&_0x42b298!=='-1'&&_0x42b298!=='';};AGIVertices['prototype'][_0x6a59('0x9f')]=function(_0x247814){this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x247814,'-');_0x247814[_0x6a59('0xa1')]=_0x247814[_0x6a59('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6a59('0x11')][_0x6a59('0xa2')]=function(_0x4b11b9){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xa3'),_0x4b11b9['label']));if(!this[_0x6a59('0x7e')](_0x4b11b9[_0x6a59('0x56')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0xa5'));}var _0x92a13c='\x22'+_0x4b11b9['text']+'\x22';if(this['isConfigured'](_0x4b11b9[_0x6a59('0x70')])){_0x92a13c+=','+_0x4b11b9[_0x6a59('0x70')];}var _0x5b381a=this[_0x6a59('0x38')][_0x6a59('0xa6')]('MRCPSynth',_0x92a13c);if(_0x5b381a[_0x6a59('0xa7')]===-0x1){return _0x5b381a;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xa8'),_0x92a13c));};AGIVertices[_0x6a59('0x11')][_0x6a59('0xa9')]=function(_0x9a15e8){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x9a15e8[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x9a15e8['grammar'])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0xab'));}var _0x4edaeb=_0x9a15e8[_0x6a59('0xac')];if(this['isConfigured'](_0x9a15e8[_0x6a59('0x70')])){_0x4edaeb+=','+_0x9a15e8[_0x6a59('0x70')];}var _0x3d9f9a=this[_0x6a59('0x38')][_0x6a59('0xa6')]('MRCPRecog',_0x4edaeb);if(_0x3d9f9a[_0x6a59('0xa7')]===-0x1){return _0x3d9f9a;}var _0x100eb2=this[_0x6a59('0x9c')](_0x6a59('0xad'),_0x6a59('0xae'));if(_0x100eb2[_0x6a59('0xa7')]===-0x1){return _0x100eb2;}var _0xdbd5bb=this['getAndSetVariable'](_0x6a59('0xaf'),_0x6a59('0xb0'));if(_0xdbd5bb['result']===-0x1){return _0xdbd5bb;}var _0x11b5ab=this['getAndSetVariable']('RECOG_INSTANCE()',_0x6a59('0xb1'));if(_0x11b5ab[_0x6a59('0xa7')]===-0x1){return _0x11b5ab;}return this['channel'][_0x6a59('0xa4')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x4edaeb));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x8')]=function(_0x25202c){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x25202c[_0x6a59('0xaa')]));return this['channel'][_0x6a59('0x8')]([_0x25202c[_0x6a59('0xb2')],_0x25202c[_0x6a59('0xb3')]]);};AGIVertices['prototype'][_0x6a59('0xb4')]=function(_0x475030){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x475030[_0x6a59('0xaa')]));if(this[_0x6a59('0x7e')](_0x475030[_0x6a59('0x5f')])){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0xb5'),_0x475030[_0x6a59('0x5f')]));var _0x1f6636=this[_0x6a59('0x38')][_0x6a59('0xb6')](_0x475030[_0x6a59('0x5f')]);if(_0x1f6636[_0x6a59('0xa7')]===-0x1){return _0x1f6636;}}return this['channel'][_0x6a59('0xb4')]();};AGIVertices[_0x6a59('0x11')][_0x6a59('0xb7')]=function(_0x40cb83){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x40cb83[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x40cb83[_0x6a59('0xb8')])){return this['channel'][_0x6a59('0x2c')](_0x40cb83,_0x6a59('0xb9'));}_0x40cb83[_0x6a59('0x45')]=moment();if(this[_0x6a59('0x7e')](_0x40cb83[_0x6a59('0xba')])){_0x40cb83[_0x6a59('0x45')]=moment()[_0x6a59('0xbb')](_0x40cb83[_0x6a59('0xba')],'minutes');}if(!this[_0x6a59('0x7e')](_0x40cb83[_0x6a59('0x48')])){_0x40cb83[_0x6a59('0x48')]=0x2;}this[_0x6a59('0x40')][_0x6a59('0xa0')](this,_0x40cb83);return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x40cb83[_0x6a59('0xbc')],_0x40cb83['list_id'],_0x40cb83['scheduledAt']));};AGIVertices[_0x6a59('0x11')]['custom_app']=function(_0x5453b7){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xbd'),_0x5453b7[_0x6a59('0xaa')]));var _0x229ae0=this[_0x6a59('0x38')][_0x6a59('0xa6')](_0x5453b7[_0x6a59('0xbe')],_0x5453b7[_0x6a59('0x70')]);if(_0x229ae0['result']===-0x1){return _0x229ae0;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xbf'),_0x5453b7['application'],_0x5453b7[_0x6a59('0x70')]));};AGIVertices[_0x6a59('0x11')][_0x6a59('0xc0')]=function(_0x56b53b){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xc1'),_0x56b53b[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x56b53b[_0x6a59('0x56')])){return this[_0x6a59('0x38')]['noop'](_0x6a59('0xa5'));}var _0x42d12f='\x22'+_0x56b53b['text']+'\x22';if(this['isConfigured'](_0x56b53b[_0x6a59('0x70')])){_0x42d12f+=','+_0x56b53b[_0x6a59('0x70')];}var _0x103a1b=this['channel'][_0x6a59('0xa6')]('MRCPSynth',_0x42d12f);if(_0x103a1b['result']===-0x1){return _0x103a1b;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format'](_0x6a59('0xa8'),_0x42d12f));};AGIVertices['prototype'][_0x6a59('0xc2')]=function(_0x4942e6){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xc3'),_0x4942e6['label']));if(!this[_0x6a59('0x7e')](_0x4942e6[_0x6a59('0x56')])){return this[_0x6a59('0x38')]['noop'](_0x6a59('0xa5'));}var _0x43e60f='\x22'+_0x4942e6[_0x6a59('0x56')]+'\x22';if(this[_0x6a59('0x7e')](_0x4942e6['options'])){_0x43e60f+=','+_0x4942e6['options'];}var _0xc4dbe2=this[_0x6a59('0x38')][_0x6a59('0xa6')](_0x6a59('0xc4'),_0x43e60f);if(_0xc4dbe2[_0x6a59('0xa7')]===-0x1){return _0xc4dbe2;}return this['channel']['noop'](util[_0x6a59('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x43e60f));};AGIVertices[_0x6a59('0x11')][_0x6a59('0xc5')]=function(_0x9aee82){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x9aee82[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x9aee82[_0x6a59('0xac')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xab'));}var _0xf03b34=_0x9aee82[_0x6a59('0xac')];if(this['isConfigured'](_0x9aee82[_0x6a59('0x70')])){_0xf03b34+=','+_0x9aee82[_0x6a59('0x70')];}var _0x2cf608=this[_0x6a59('0x38')][_0x6a59('0xa6')](_0x6a59('0xc6'),_0xf03b34);if(_0x2cf608['result']===-0x1){return _0x2cf608;}var _0x5970a3=this[_0x6a59('0x9c')](_0x6a59('0xad'),_0x6a59('0xc7'));if(_0x5970a3[_0x6a59('0xa7')]===-0x1){return _0x5970a3;}var _0x220815=this[_0x6a59('0x9c')]('RECOG_INPUT()',_0x6a59('0xc8'));if(_0x220815[_0x6a59('0xa7')]===-0x1){return _0x220815;}var _0x59fceb=this[_0x6a59('0x9c')](_0x6a59('0xc9'),_0x6a59('0xca'));if(_0x59fceb[_0x6a59('0xa7')]===-0x1){return _0x59fceb;}return this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0xcb'),_0xf03b34));};AGIVertices['prototype'][_0x6a59('0xcc')]=function(_0x49efce){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0xcd'),_0x49efce[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x49efce[_0x6a59('0xac')])){return this['channel'][_0x6a59('0xa4')]('no\x20grammar\x20configured');}var _0x1b3144=_0x49efce[_0x6a59('0xac')];if(this['isConfigured'](_0x49efce[_0x6a59('0x70')])){_0x1b3144+=','+_0x49efce[_0x6a59('0x70')];}var _0x391d15=this[_0x6a59('0x38')]['exec'](_0x6a59('0xc6'),_0x1b3144);if(_0x391d15[_0x6a59('0xa7')]===-0x1){return _0x391d15;}var _0x241737=this[_0x6a59('0x9c')](_0x6a59('0xad'),_0x6a59('0xce'));if(_0x241737[_0x6a59('0xa7')]===-0x1){return _0x241737;}var _0x1a60eb=this[_0x6a59('0x9c')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x1a60eb['result']===-0x1){return _0x1a60eb;}var _0x552b05=this[_0x6a59('0x9c')](_0x6a59('0xc9'),'SESTEK_ASR_INSTANCE');if(_0x552b05['result']===-0x1){return _0x552b05;}return this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0xcb'),_0x1b3144));};AGIVertices[_0x6a59('0x11')][_0x6a59('0xcf')]=function(_0x57a3bb){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0xd0'),_0x57a3bb['label']));if(!this[_0x6a59('0x7e')](_0x57a3bb[_0x6a59('0xd1')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x57a3bb,_0x6a59('0xd2'));}var _0x327c32=this[_0x6a59('0x1b')][_0x6a59('0xa0')](this,_0x57a3bb[_0x6a59('0xd1')]);if(!_0x327c32){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x57a3bb,_0x6a59('0xd3'));}if(!this['isConfigured'](_0x57a3bb[_0x6a59('0x30')])){return this[_0x6a59('0x38')]['error'](_0x57a3bb,_0x6a59('0xd4'));}var _0x1eb91f=_0x57a3bb[_0x6a59('0x30')][_0x6a59('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xd5'),_0x1eb91f));var _0x4a7605=this['getQueryOdbc'][_0x6a59('0xa0')](this,_0x327c32,_0x1eb91f);this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x57a3bb,_0x1eb91f);if(!this[_0x6a59('0x7e')](_0x57a3bb[_0x6a59('0xd6')])){return this[_0x6a59('0x38')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x12d7c6=this['getVariable'][_0x6a59('0xa0')](this,_0x57a3bb[_0x6a59('0xd6')]);if(!_0x12d7c6){return this[_0x6a59('0x38')]['error'](_0x57a3bb,_0x6a59('0xd7'));}var _0xc6d448=this;_0x4a7605[_0x6a59('0xd8')](function(_0x4a5b35,_0x3bca05){Object[_0x6a59('0xd9')](_0x4a5b35)[_0x6a59('0xd8')](function(_0x2bf78d){_0xc6d448[_0x6a59('0x38')][_0x6a59('0x9e')](util[_0x6a59('0x4f')](_0x6a59('0xda'),_0x12d7c6,_0x3bca05,_0x2bf78d),_0x4a5b35[_0x2bf78d]);});});this['channel'][_0x6a59('0x9e')](util[_0x6a59('0x4f')](_0x6a59('0xdb'),_0x12d7c6),_0x4a7605[_0x6a59('0x97')]);return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('variable\x20%s\x20set',_0x12d7c6));};AGIVertices[_0x6a59('0x11')]['dial']=function(_0x159683){logger['debug'](util[_0x6a59('0x4f')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x159683[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x159683['sip_id'])){return this[_0x6a59('0x38')]['error'](_0x159683,_0x6a59('0xdc'));}var _0x49c048=this['getUser'][_0x6a59('0xa0')](this,_0x159683['sip_id']);if(!_0x49c048){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x159683,_0x6a59('0xdd'));}var _0x14c119=this[_0x6a59('0x38')][_0x6a59('0xa6')](_0x6a59('0xde'),[util[_0x6a59('0x4f')](_0x6a59('0xdf'),_0x49c048),_0x159683['timeout'],_0x159683[_0x6a59('0xe0')],_0x159683['url']]);if(_0x14c119[_0x6a59('0xa7')]===-0x1){return _0x14c119;}return this['channel']['noop'](util[_0x6a59('0x4f')](_0x6a59('0xe1'),_0x6a59('0xde')));};AGIVertices['prototype'][_0x6a59('0xe2')]=function(_0xbc450){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xbc450[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0xbc450[_0x6a59('0x72')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xe3'));}if(!this[_0x6a59('0x7e')](_0xbc450[_0x6a59('0x56')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0xa5'));}this[_0x6a59('0x38')][_0x6a59('0xe4')]=!![];this['createSquareDetailsReport'](_0xbc450);this['createSquareMessage'](_0xbc450[_0x6a59('0x56')],'in','','');this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0xbc450[_0x6a59('0x56')]));var _0x4c0d1f=this['googleDialogflow'][_0x6a59('0xa0')](this,_0xbc450);if(_0x4c0d1f){for(var _0x456881 in _0x4c0d1f){if(_0x4c0d1f[_0x6a59('0x90')](_0x456881)){this[_0x6a59('0x38')]['setVariable'](util[_0x6a59('0x4f')](_0x6a59('0xe5'),_0x456881['toUpperCase']()),_0x4c0d1f[_0x456881]);}}this[_0x6a59('0x3f')](_0x4c0d1f[_0x6a59('0xe6')],_0x6a59('0xe7'),_0x6a59('0xe2'),'');return this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format']('Dialogflow\x20Result\x20%s',_0x4c0d1f[_0x6a59('0xe6')]));}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0xbc450,_0x6a59('0xe8'));};AGIVertices['prototype']['dialogflowV2']=function(_0x4c18d8){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0xe9'),_0x4c18d8['label']));if(!this[_0x6a59('0x7e')](_0x4c18d8[_0x6a59('0x74')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20project_id\x20configured');}if(!this[_0x6a59('0x7e')](_0x4c18d8[_0x6a59('0x75')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xea'));}if(!this[_0x6a59('0x7e')](_0x4c18d8['private_key'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20private_key\x20configured');}if(!this[_0x6a59('0x7e')](_0x4c18d8['dialogflowV2_language'])){return this['channel']['noop'](_0x6a59('0xeb'));}if(!this[_0x6a59('0x7e')](_0x4c18d8[_0x6a59('0x56')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xa5'));}this['channel'][_0x6a59('0xe4')]=!![];this[_0x6a59('0x35')](_0x4c18d8);this[_0x6a59('0x3f')](_0x4c18d8['text'],'in','','');this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xec'),_0x4c18d8['text']));var _0x41e84a=this[_0x6a59('0x73')][_0x6a59('0xa0')](this,_0x4c18d8);if(_0x41e84a){for(var _0x563aee in _0x41e84a){if(_0x41e84a[_0x6a59('0x90')](_0x563aee)){if(_0x563aee!==_0x6a59('0xed')){this[_0x6a59('0x38')][_0x6a59('0x9e')](util['format'](_0x6a59('0xe5'),_0x563aee[_0x6a59('0x63')]()),_0x41e84a[_0x563aee]);}}}this[_0x6a59('0x3f')](_0x41e84a[_0x6a59('0xe6')],_0x6a59('0xe7'),_0x6a59('0xee'),_0x41e84a['providerResponse']);return this['channel']['noop'](util[_0x6a59('0x4f')](_0x6a59('0xef'),_0x41e84a[_0x6a59('0xe6')]));}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x4c18d8,_0x6a59('0xf0'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0xf1')]=function(_0x1823ad){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xf2'),_0x1823ad['label']));if(!this['isConfigured'](_0x1823ad['ndauth_url'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xf3'));}if(!this['isConfigured'](_0x1823ad[_0x6a59('0xf4')])){return this[_0x6a59('0x38')]['noop']('no\x20username\x20configured');}if(!this[_0x6a59('0x7e')](_0x1823ad[_0x6a59('0xf5')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xf6'));}if(!this[_0x6a59('0x7e')](_0x1823ad[_0x6a59('0xf7')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xa5'));}this[_0x6a59('0x38')]['bot']=!![];this[_0x6a59('0x35')](_0x1823ad);this[_0x6a59('0x3f')](_0x1823ad[_0x6a59('0x56')],'in','','');this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format'](_0x6a59('0xf8'),_0x1823ad['text']));var _0x2f4fbd=this[_0x6a59('0x78')][_0x6a59('0xa0')](this,_0x1823ad);if(_0x2f4fbd){for(var _0x381407 in _0x2f4fbd){if(_0x2f4fbd[_0x6a59('0x90')](_0x381407)){this[_0x6a59('0x38')][_0x6a59('0x9e')](util[_0x6a59('0x4f')]('SESTEK_NDA_%s',_0x381407[_0x6a59('0x63')]()),_0x2f4fbd[_0x381407]);}}this[_0x6a59('0x3f')](_0x2f4fbd[_0x6a59('0xe6')],_0x6a59('0xe7'),_0x6a59('0xf1'),'');if(_0x2f4fbd[_0x6a59('0xf9')]){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xfa'),_0x2f4fbd[_0x6a59('0xf9')]));var _0x31a097=this[_0x6a59('0x38')][_0x6a59('0xfb')](_0x2f4fbd[_0x6a59('0xf9')]);try{fs[_0x6a59('0xfc')](_0x2f4fbd['audiofile']+'.wav');}catch(_0x4871e9){logger[_0x6a59('0x2c')](_0x4871e9);}return _0x31a097;}else{return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xfd'),_0x2f4fbd[_0x6a59('0xe6')]));}}return this[_0x6a59('0x38')]['error'](_0x1823ad,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6a59('0x11')][_0x6a59('0xfe')]=function(_0x55999d){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0xff'),_0x55999d[_0x6a59('0xaa')]));return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xfe'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x100')]=function(_0x315de9){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x101'),_0x315de9[_0x6a59('0xaa')]));var _0x946546='';if(_0x315de9[_0x6a59('0x102')]){if(!this[_0x6a59('0x7e')](_0x315de9[_0x6a59('0x102')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x315de9,_0x6a59('0x103'));}else{var _0x1c841f=parseInt(_0x315de9[_0x6a59('0x102')],0xa);if(isNaN(_0x1c841f)){_0x946546=_0x315de9['trunk_id'];}else{_0x946546=this[_0x6a59('0x104')]['sync'](this,_0x315de9['trunk_id']);if(!_0x946546){return this[_0x6a59('0x38')]['error'](_0x315de9,_0x6a59('0x105'));}}}}else if(_0x315de9[_0x6a59('0x106')]){_0x946546=_0x315de9[_0x6a59('0x106')];}else{return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x315de9,_0x6a59('0x103'));}var _0x4d381a=this[_0x6a59('0x38')][_0x6a59('0xa6')]('DIAL',[util[_0x6a59('0x4f')](_0x6a59('0x107'),_0x946546,_0x315de9[_0x6a59('0xbc')]),_0x315de9['timeout'],_0x315de9[_0x6a59('0xe0')],_0x315de9[_0x6a59('0x108')]]);if(_0x4d381a['result']===-0x1){return _0x4d381a;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xe1'),'DIAL'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x109')]=function(_0xff703a){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0xff703a['label']));return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x109'));};AGIVertices[_0x6a59('0x11')]['getdigits']=function(_0x129b8a){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x129b8a[_0x6a59('0xaa')]));if(_0x129b8a[_0x6a59('0xa1')]===0x0){return this['maxRetry'](_0x129b8a);}_0x129b8a[_0x6a59('0xa1')]-=0x1;if(!this[_0x6a59('0x7e')](_0x129b8a[_0x6a59('0x10a')])){return this['channel']['error'](_0x129b8a,_0x6a59('0x10b'));}var _0x48db52=this[_0x6a59('0x20')][_0x6a59('0xa0')](this,_0x129b8a[_0x6a59('0x10a')]);if(!_0x48db52){return this['channel'][_0x6a59('0x2c')](_0x129b8a,_0x6a59('0x10c'));}if(!this['isConfigured'](_0x129b8a['variable_id'])){return this[_0x6a59('0x38')][_0x6a59('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5cd903=this['channel']['getData'](_0x48db52,_0x129b8a[_0x6a59('0x10d')],_0x129b8a[_0x6a59('0x10e')]);var _0x85c9=_0x5cd903['result']?_0x5cd903['result']['toString']():'';logger['info'](_0x6a59('0x10f'),JSON['stringify'](_0x5cd903));if(_0x5cd903['result']===-0x1){this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x129b8a,_0x85c9);return _0x5cd903;}else if(_0x5cd903[_0x6a59('0x9b')]===_0x6a59('0x5f')){_0x5cd903[_0x6a59('0xa7')]=_0x85c9[_0x6a59('0x97')]>=parseInt(_0x129b8a[_0x6a59('0x110')])?'x':'i';}else{_0x5cd903[_0x6a59('0xa7')]=_0x85c9[_0x6a59('0x97')]>=parseInt(_0x129b8a[_0x6a59('0x110')])&&_0x85c9[_0x6a59('0x97')]<=parseInt(_0x129b8a['maxdigit'])?'x':'i';}var _0x1d803a=this[_0x6a59('0x12')][_0x6a59('0xa0')](this,_0x129b8a['variable_id']);if(!_0x1d803a){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x129b8a,_0x6a59('0xd7'));}this[_0x6a59('0x38')][_0x6a59('0x9e')](_0x1d803a,_0x85c9);if(this[_0x6a59('0x7e')](_0x129b8a[_0x6a59('0x111')])){var _0x4af4b5=parseInt(_0x129b8a[_0x6a59('0x111')],0xa);var _0x53bf35=rs['generate']({'charset':'*','length':_0x4af4b5});var _0x262302=_0x85c9[_0x6a59('0x97')];if(_0x262302>0x0){if(_0x262302>_0x4af4b5){this[_0x6a59('0x35')]['sync'](this,_0x129b8a,_0x129b8a[_0x6a59('0x112')]===_0x6a59('0x113')?_0x53bf35+_0x85c9[_0x6a59('0x114')](_0x4af4b5):_0x85c9[_0x6a59('0x114')](0x0,_0x262302-_0x4af4b5)+_0x53bf35);}else{this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x129b8a,rs[_0x6a59('0x115')]({'charset':'*','length':_0x262302}));}}else{this['createSquareDetailsReport'][_0x6a59('0xa0')](this,_0x129b8a,'');}}else{this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x129b8a,_0x85c9);}return _0x5cd903;};AGIVertices[_0x6a59('0x11')][_0x6a59('0x116')]=function(_0x286a39){logger[_0x6a59('0x2e')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x286a39[_0x6a59('0xaa')]));return this[_0x6a59('0xf')](_0x286a39);};AGIVertices['prototype'][_0x6a59('0x117')]=function(_0x828076){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x118'),_0x828076['label']));this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x828076,_0x828076['goalname']);return this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0x119'),_0x828076['goalname']));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x11a')]=function(_0x307b1f){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x11b'),_0x307b1f[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x307b1f['aws_access_key_id'])||!this[_0x6a59('0x7e')](_0x307b1f[_0x6a59('0x87')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0x11c'));}if(!this['isConfigured'](_0x307b1f[_0x6a59('0x56')])){return this['channel']['noop'](_0x6a59('0xa5'));}this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x11d'),_0x307b1f[_0x6a59('0x56')]));var _0x572793=this[_0x6a59('0x80')][_0x6a59('0xa0')](this,_0x307b1f);if(_0x572793){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('aws\x20Polly\x20%s\x20file\x20created',_0x572793));var _0x4c35a7=this['channel'][_0x6a59('0xfb')](_0x572793);try{fs[_0x6a59('0xfc')](_0x572793+'.wav');}catch(_0x190a5f){logger[_0x6a59('0x2c')](_0x190a5f);}return _0x4c35a7;}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x307b1f,_0x6a59('0x11e'));};AGIVertices[_0x6a59('0x11')]['awslex']=function(_0x5b0171){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x11f'),_0x5b0171[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x5b0171[_0x6a59('0x86')])||!this[_0x6a59('0x7e')](_0x5b0171[_0x6a59('0x87')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x11c'));}if(!this[_0x6a59('0x7e')](_0x5b0171['aws_bot_name'])){return this['channel']['noop'](_0x6a59('0x120'));}if(!this[_0x6a59('0x7e')](_0x5b0171[_0x6a59('0x56')])){return this[_0x6a59('0x38')]['noop']('no\x20text\x20configured');}this[_0x6a59('0x38')][_0x6a59('0xe4')]=!![];this[_0x6a59('0x35')](_0x5b0171);this[_0x6a59('0x3f')](_0x5b0171['text'],'in','','');this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0x121'),_0x5b0171['text']));var _0xa088c1=this['awsLex']['sync'](this,_0x5b0171);if(_0xa088c1){for(var _0xb47d2a in _0xa088c1){if(_0xa088c1[_0x6a59('0x90')](_0xb47d2a)&&_[_0x6a59('0x91')](_0xa088c1[_0xb47d2a])){this['channel'][_0x6a59('0x9e')](util[_0x6a59('0x4f')](_0x6a59('0x122'),_0xb47d2a[_0x6a59('0x63')]()),_0xa088c1[_0xb47d2a]);}}if(_[_0x6a59('0x41')](_0xa088c1[_0x6a59('0x6e')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0x123'));}else{this['createSquareMessage'](_0xa088c1['message'],_0x6a59('0xe7'),_0x6a59('0x124'),'');return this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0x125'),_0xa088c1[_0x6a59('0x6e')]));}}return this['channel']['error'](_0x5b0171,_0x6a59('0x126'));};AGIVertices[_0x6a59('0x11')]['googleasr']=function(_0x8637d3){logger['info'](util['format'](_0x6a59('0x127'),_0x8637d3[_0x6a59('0xaa')],_0x8637d3[_0x6a59('0x5f')]));if(!this['isConfigured'](_0x8637d3[_0x6a59('0x72')])){return this['channel'][_0x6a59('0xa4')]('no\x20key\x20configured');}var _0x5440ff=_0x6a59('0x128');var _0x262760=util[_0x6a59('0x4f')](_0x6a59('0x129'),FILES_PATH,rs[_0x6a59('0x115')](0x4));var _0x3fa16b=util[_0x6a59('0x4f')]('%s.%s',_0x262760,_0x5440ff);var _0x4c776a=!![];if(_0x8637d3[_0x6a59('0x12a')]===_0x6a59('0x12b')){_0x4c776a=![];}var _0x5f09f1=this[_0x6a59('0x38')][_0x6a59('0x12c')](_0x262760,_0x5440ff,_0x8637d3[_0x6a59('0x12d')],_0x8637d3[_0x6a59('0x5f')],undefined,_0x4c776a);if(_0x5f09f1[_0x6a59('0xa7')]!==-0x1){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x12e'),_0x3fa16b));var _0x4ea569=this[_0x6a59('0x8a')][_0x6a59('0xa0')](this,_0x8637d3,_0x3fa16b);if(_0x4ea569){for(var _0x1947ee in _0x4ea569){if(_0x4ea569[_0x6a59('0x90')](_0x1947ee)){this['channel'][_0x6a59('0x9e')](util[_0x6a59('0x4f')](_0x6a59('0x12f'),_0x1947ee['toUpperCase']()),_0x4ea569[_0x1947ee]);}}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x130'),JSON[_0x6a59('0x6b')](_0x4ea569)));}}return _0x5f09f1;};AGIVertices[_0x6a59('0x11')]['tildeasr']=function(_0xcbd811){logger['info'](util['format'](_0x6a59('0x131'),_0xcbd811[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0xcbd811['appid'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x132'));}if(!this[_0x6a59('0x7e')](_0xcbd811[_0x6a59('0x8d')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20appsecret\x20configured');}var _0x35a243=_0x6a59('0x128');var _0x4e7077=util[_0x6a59('0x4f')](_0x6a59('0x129'),FILES_PATH,rs[_0x6a59('0x115')](0x4));var _0x169771=util[_0x6a59('0x4f')](_0x6a59('0x99'),_0x4e7077,_0x35a243);var _0x43f4a4=!![];if(_0xcbd811[_0x6a59('0x12a')]===_0x6a59('0x12b')){_0x43f4a4=![];}var _0x47d8ae=this[_0x6a59('0x38')][_0x6a59('0x12c')](_0x4e7077,_0x35a243,_0xcbd811[_0x6a59('0x12d')],_0xcbd811['timeout'],undefined,_0x43f4a4);if(_0x47d8ae[_0x6a59('0xa7')]!==-0x1){this['channel']['noop'](util[_0x6a59('0x4f')](_0x6a59('0x133'),_0x169771));var _0x59c71f=this[_0x6a59('0x8c')]['sync'](this,_0xcbd811,_0x169771);if(_0x59c71f){for(var _0x532624 in _0x59c71f){if(_0x59c71f['hasOwnProperty'](_0x532624)){this[_0x6a59('0x38')]['setVariable'](util['format']('TILDE_ASR_%s',_0x532624[_0x6a59('0x63')]()),_0x59c71f[_0x532624]);}}return this[_0x6a59('0x38')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0x6a59('0x6b')](_0x59c71f)));}}return _0x47d8ae;};AGIVertices[_0x6a59('0x11')][_0x6a59('0x134')]=function(_0x22f0c0){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x135'),_0x22f0c0[_0x6a59('0xaa')]));return this['channel'][_0x6a59('0x136')](_0x22f0c0[_0x6a59('0x137')],_0x22f0c0['extension'],_0x22f0c0[_0x6a59('0x138')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x139')]=function(_0x502c00){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x13a'),_0x502c00[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x502c00[_0x6a59('0x13b')])){return this[_0x6a59('0x38')]['error'](_0x502c00,'no\x20condition\x20configured');}try{var _0x28ee1d=eval(_0x502c00[_0x6a59('0x13b')])?_0x6a59('0x13c'):_0x6a59('0x13d');this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')]('EVAL\x20CONDITION\x20%s\x20%s',_0x502c00[_0x6a59('0x13b')],_0x28ee1d));return{'code':0xc8,'result':_0x28ee1d};}catch(_0x2432df){return{'code':0xc8,'result':_0x6a59('0x13d')};}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x13e')]=function(_0x3d5a31){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x13f'),_0x3d5a31[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x3d5a31[_0x6a59('0x140')])){return this['channel'][_0x6a59('0x2c')](_0x3d5a31,_0x6a59('0x141'));}var _0x3634f5=this[_0x6a59('0x142')][_0x6a59('0xa0')](this,_0x3d5a31[_0x6a59('0x140')]);if(!_0x3634f5){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x3d5a31,_0x6a59('0x143'));}for(var _0x2fa1b1=0x0;_0x2fa1b1<_0x3634f5[_0x6a59('0x97')];_0x2fa1b1+=0x1){var _0x5d9450=this[_0x6a59('0x38')][_0x6a59('0x12')](util[_0x6a59('0x4f')](_0x6a59('0x144'),_0x3634f5[_0x2fa1b1]));if(_0x5d9450['result']===-0x1){return _0x5d9450;}logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x145'),_0x3634f5[_0x2fa1b1],_0x5d9450[_0x6a59('0x9b')]));if(_0x5d9450[_0x6a59('0x9b')]===_0x6a59('0x13c')){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x145'),_0x3634f5[_0x2fa1b1],_0x6a59('0x13c')));this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0x145'),_0x3634f5[_0x2fa1b1],'true'));return{'code':0xc8,'result':_0x6a59('0x13c')};}else{logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x145'),_0x3634f5[_0x2fa1b1],'false'));this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format']('IFTIME\x20%s\x20%s',_0x3634f5[_0x2fa1b1],_0x6a59('0x13d')));}}return{'code':0xc8,'result':_0x6a59('0x13d')};};AGIVertices[_0x6a59('0x11')][_0x6a59('0x146')]=function(_0x3319cb){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x147'),_0x3319cb[_0x6a59('0xaa')]));return this['channel']['hangup']();};AGIVertices[_0x6a59('0x11')]['ispeechasr']=function(_0x43ac82){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x148'),_0x43ac82['label']));if(!this[_0x6a59('0x7e')](_0x43ac82['key'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0xe3'));}var _0x1f9fc8=_0x6a59('0x128');var _0x55d5ff=util['format'](_0x6a59('0x129'),FILES_PATH,rs['generate'](0x4));var _0x2765ea=util[_0x6a59('0x4f')]('%s.%s',_0x55d5ff,_0x1f9fc8);var _0x195f77=!![];if(_0x43ac82['beep']===_0x6a59('0x12b')){_0x195f77=![];}var _0x3a4bfe=this['channel'][_0x6a59('0x12c')](_0x55d5ff,_0x1f9fc8,_0x43ac82[_0x6a59('0x12d')],_0x43ac82[_0x6a59('0x5f')],undefined,_0x195f77);if(_0x3a4bfe[_0x6a59('0xa7')]!==-0x1){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x149'),_0x2765ea));var _0x39ba22=this[_0x6a59('0x7c')][_0x6a59('0xa0')](this,_0x43ac82,_0x2765ea);if(_0x39ba22){for(var _0x5c0811 in _0x39ba22){if(_0x39ba22[_0x6a59('0x90')](_0x5c0811)){this[_0x6a59('0x38')][_0x6a59('0x9e')](util[_0x6a59('0x4f')](_0x6a59('0x14a'),_0x5c0811[_0x6a59('0x63')]()),_0x39ba22[_0x5c0811]);}}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x14b'),JSON[_0x6a59('0x6b')](_0x39ba22)));}}return _0x3a4bfe;};AGIVertices[_0x6a59('0x11')][_0x6a59('0x14c')]=function(_0x488396){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x14d'),_0x488396['label']));if(!this[_0x6a59('0x7e')](_0x488396[_0x6a59('0x72')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0xe3'));}if(!this[_0x6a59('0x7e')](_0x488396[_0x6a59('0x56')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20text\x20configured');}this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('Trying\x20ispeech\x20TTS\x20%s',_0x488396[_0x6a59('0x56')]));var _0x549704=this[_0x6a59('0x79')][_0x6a59('0xa0')](this,_0x488396);if(_0x549704){this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format'](_0x6a59('0x149'),_0x549704));var _0x40be31=this[_0x6a59('0x38')]['streamFile'](_0x549704,_0x488396['intKey']);try{fs[_0x6a59('0xfc')](_0x549704+_0x6a59('0x14e'));}catch(_0xbc6fb8){logger[_0x6a59('0x2c')](_0xbc6fb8);}return _0x40be31;}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x488396,_0x6a59('0x14f'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x150')]=function(_0x26fcbe){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x151'),_0x26fcbe[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x26fcbe[_0x6a59('0x152')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x26fcbe,_0x6a59('0x153'));}logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x154'),this[_0x6a59('0x38')]['callerid'],_0x26fcbe[_0x6a59('0x152')]));var _0x17efde=this['agentLogin'][_0x6a59('0xa0')](this,_0x26fcbe[_0x6a59('0x152')]);if(_0x17efde){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x155'),this['channel']['callerid'],_0x26fcbe['findBy']));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')]['callerid'],_0x26fcbe[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x156')};}else{logger['info'](util[_0x6a59('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a59('0x38')][_0x6a59('0x39')],_0x26fcbe[_0x6a59('0x152')]));this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0x157'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x26fcbe[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x158')};}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x159')]=function(_0x563c85){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x15a'),_0x563c85[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x563c85[_0x6a59('0x152')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x563c85,_0x6a59('0x153'));}logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x154'),this['channel']['callerid'],_0x563c85[_0x6a59('0x152')]));var _0x3a111d=this[_0x6a59('0x4d')][_0x6a59('0xa0')](this,_0x563c85[_0x6a59('0x152')]);if(_0x3a111d){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')]['callerid'],_0x563c85[_0x6a59('0x152')]));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x563c85[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x156')};}else{logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x157'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x563c85['findBy']));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a59('0x38')]['callerid'],_0x563c85[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x158')};}};AGIVertices[_0x6a59('0x11')]['math']=function(_0x33846d){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x33846d[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x33846d[_0x6a59('0x15b')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x33846d,_0x6a59('0x15c'));}this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format'](_0x6a59('0x15d'),_0x33846d[_0x6a59('0x15b')]));var _0x4fa809=eval(_0x33846d[_0x6a59('0x15b')]);if(!this[_0x6a59('0x7e')](_0x33846d[_0x6a59('0xd6')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x15e'));}var _0x4f6f00=this[_0x6a59('0x12')][_0x6a59('0xa0')](this,_0x33846d[_0x6a59('0xd6')]);if(!_0x4f6f00){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x33846d,_0x6a59('0xd7'));}if(_[_0x6a59('0x96')](_0x4fa809)){var _0x249259=this;_0x4fa809[_0x6a59('0xd8')](function(_0x30d718,_0x1274d6){_0x249259[_0x6a59('0x38')]['setVariable'](util['format'](_0x6a59('0x15f'),_0x4f6f00,_0x1274d6),_0x30d718);});return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x160'),_0x4f6f00));}else{return this[_0x6a59('0x38')]['setVariable'](_0x4f6f00,_0x4fa809);}};AGIVertices['prototype'][_0x6a59('0xe')]=function(_0x765473){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x765473[_0x6a59('0xaa')]));if(_0x765473[_0x6a59('0xa1')]===0x0){return this['maxRetry'](_0x765473);}_0x765473[_0x6a59('0xa1')]-=0x1;if(!this[_0x6a59('0x7e')](_0x765473['file_id'])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x765473,_0x6a59('0x10b'));}var _0x55188d=this['getSound']['sync'](this,_0x765473[_0x6a59('0x10a')]);if(!_0x55188d){return this['channel'][_0x6a59('0x2c')](_0x765473,_0x6a59('0x10c'));}var _0x299842=this[_0x6a59('0x38')][_0x6a59('0x161')](_0x55188d,_0x765473['response'],_0x765473[_0x6a59('0x162')]);var _0x1a4efb=_0x299842[_0x6a59('0xa7')];if(_0x299842[_0x6a59('0xa7')]===-0x1){this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x765473,'-1');return _0x299842;}else if(_0x299842[_0x6a59('0x9b')]===_0x6a59('0x5f')){_0x299842[_0x6a59('0xa7')]=_0x299842['result'][_0x6a59('0x97')]>0x0?_0x299842[_0x6a59('0xa7')]:'t';}else if(_['isEmpty'](_0x299842['result'])){_0x299842[_0x6a59('0xa7')]='#';_0x1a4efb='#';}if(!this[_0x6a59('0x7e')](_0x765473[_0x6a59('0xd6')])){this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x430b44=this[_0x6a59('0x12')][_0x6a59('0xa0')](this,_0x765473[_0x6a59('0xd6')]);if(!_0x430b44){return this['channel'][_0x6a59('0x2c')](_0x765473,_0x6a59('0xd7'));}this['channel']['setVariable'](_0x430b44,_0x1a4efb);}this['createSquareDetailsReport'][_0x6a59('0xa0')](this,_0x765473,_0x1a4efb);return _0x299842;};AGIVertices['prototype'][_0x6a59('0xa4')]=function(_0x2d3164){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2d3164[_0x6a59('0xaa')]));return this['channel']['noop'](_0x2d3164['output']||_0x2d3164[_0x6a59('0xaa')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x163')]=function(_0x8f2141){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x164'),_0x8f2141[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x8f2141[_0x6a59('0x152')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x8f2141,'no\x20find\x20by\x20configured');}logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x154'),this['channel'][_0x6a59('0x39')],_0x8f2141['findBy']));var _0x3cb746=this[_0x6a59('0x165')][_0x6a59('0xa0')](this,_0x8f2141[_0x6a59('0x166')]);var _0x399f54=this[_0x6a59('0x4a')][_0x6a59('0xa0')](this,_0x8f2141[_0x6a59('0x152')],_0x3cb746);if(_0x399f54){logger['info'](util[_0x6a59('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a59('0x38')][_0x6a59('0x39')],_0x8f2141[_0x6a59('0x152')]));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x8f2141[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x156')};}else{logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x157'),this[_0x6a59('0x38')]['callerid'],_0x8f2141[_0x6a59('0x152')]));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x8f2141['findBy']));return{'code':0xc8,'result':_0x6a59('0x158')};}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x167')]=function(_0x3ef2aa){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3ef2aa['label']));if(!this[_0x6a59('0x7e')](_0x3ef2aa[_0x6a59('0x10a')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x3ef2aa,'no\x20file\x20audio\x20selected');}var _0x216eec=this[_0x6a59('0x20')][_0x6a59('0xa0')](this,_0x3ef2aa[_0x6a59('0x10a')]);if(!_0x216eec){return this['channel']['error'](_0x3ef2aa,_0x6a59('0x10c'));}var _0x345f2d=this[_0x6a59('0x38')]['exec']('PLAYBACK',[_0x216eec,_0x3ef2aa[_0x6a59('0xe0')]]);if(_0x345f2d[_0x6a59('0xa7')]===-0x1){return _0x345f2d;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0xbf'),_0x6a59('0x168'),_0x216eec));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x169')]=function(_0x2d259c){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2d259c[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x2d259c[_0x6a59('0x16a')])){return this[_0x6a59('0x38')]['error'](_0x2d259c,_0x6a59('0x16b'));}var _0x455ed8='';var _0x18d7bd=parseInt(_0x2d259c['queue_id'],0xa);if(isNaN(_0x18d7bd)){_0x455ed8=_0x2d259c['queue_id'];}else{_0x455ed8=this[_0x6a59('0x17')][_0x6a59('0xa0')](this,_0x2d259c['queue_id']);if(!_0x455ed8){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x2d259c,'no\x20queue\x20found');}}var _0x29805b='';if(this[_0x6a59('0x7e')](_0x2d259c[_0x6a59('0x10a')])){var _0x40835b=this[_0x6a59('0x20')]['sync'](this,_0x2d259c[_0x6a59('0x10a')]);if(_0x40835b){_0x29805b=_0x40835b;}}this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x2d259c,_0x455ed8);if(_0x2d259c[_0x6a59('0xe0')][_0x6a59('0x16c')]('x')<0x0){_0x2d259c['opts']+='x';}if(_0x2d259c[_0x6a59('0xe0')][_0x6a59('0x16c')]('X')<0x0){_0x2d259c['opts']+='X';}this[_0x6a59('0x38')][_0x6a59('0x9e')](_0x6a59('0x16d'),_0x455ed8?_0x455ed8['toLowerCase']():'');var _0x5155cb=this[_0x6a59('0x38')][_0x6a59('0xa6')](_0x6a59('0x16e'),[_0x455ed8,_0x2d259c['opts'],_0x2d259c[_0x6a59('0x108')],_0x29805b,_0x2d259c[_0x6a59('0x5f')],_0x2d259c[_0x6a59('0x8')],_0x2d259c[_0x6a59('0x16f')],_0x2d259c[_0x6a59('0x170')],'',_0x2d259c[_0x6a59('0x171')]]);if(_0x5155cb[_0x6a59('0xa7')]===-0x1){return _0x5155cb;}return this['channel']['noop'](util[_0x6a59('0x4f')](_0x6a59('0xbf'),'QUEUE',_0x455ed8));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x172')]=function(_0x448e69){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x173'),_0x448e69[_0x6a59('0xaa')]));var _0x4dbcc5=_0x448e69[_0x6a59('0x174')]||'wav';var _0x35697b=util['format'](_0x6a59('0x175'),this[_0x6a59('0x38')][_0x6a59('0x36')],rs[_0x6a59('0x115')](0x5));var _0x41d8e7=util[_0x6a59('0x4f')]('%s/recordings/%s.%s',FILES_PATH,_0x35697b,_0x4dbcc5);var _0x1b2002=util[_0x6a59('0x4f')]('%s/recordings/%s',FILES_PATH,_0x35697b);this[_0x6a59('0x176')][_0x6a59('0xa0')](this,_0x448e69,_0x35697b,_0x41d8e7);this[_0x6a59('0x38')][_0x6a59('0x9e')](_0x6a59('0x177'),_0x35697b);logger[_0x6a59('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x1b2002,_0x4dbcc5,_0x448e69[_0x6a59('0x178')],_0x448e69[_0x6a59('0x5f')]);return this['channel']['recordFile'](_0x1b2002,_0x4dbcc5,_0x448e69[_0x6a59('0x178')],_0x448e69['timeout'],undefined,!![]);};AGIVertices[_0x6a59('0x11')]['restapi']=function(_0x3dffa6){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3dffa6['label']));if(!this[_0x6a59('0x7e')](_0x3dffa6[_0x6a59('0x108')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x179'));}var _0x181221=this['restAPI'][_0x6a59('0xa0')](this,_0x3dffa6);logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Response:',util[_0x6a59('0x17a')](_0x181221,{'showHidden':![],'depth':null})));if(!this[_0x6a59('0x7e')](_0x3dffa6['variable_id'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x17b'));}var _0x18483a=this[_0x6a59('0x12')][_0x6a59('0xa0')](this,_0x3dffa6[_0x6a59('0xd6')]);if(!_0x18483a){return this[_0x6a59('0x38')]['error'](_0x3dffa6,_0x6a59('0xd7'));}this['channel'][_0x6a59('0x9e')](util['format'](_0x6a59('0x17c'),_0x18483a),_0x181221[_0x6a59('0x6d')]?_0x181221[_0x6a59('0x6d')]:'200');this['channel'][_0x6a59('0x9e')](util[_0x6a59('0x4f')]('%s_STATUS_MESSAGE',_0x18483a),_0x181221[_0x6a59('0x17d')]?_0x181221[_0x6a59('0x17d')]:'OK');if(_0x181221['body']){try{this[_0x6a59('0x98')](_0x181221[_0x6a59('0x64')],_0x18483a);}catch(_0x276aa0){logger[_0x6a59('0x2c')](util[_0x6a59('0x4f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x18483a));}}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x17e'),_0x18483a));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x17f')]=function(_0x268aae){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x180'),_0x268aae[_0x6a59('0xaa')]));return this[_0x6a59('0x38')][_0x6a59('0x181')](_0x268aae[_0x6a59('0x182')][_0x6a59('0x53')](/\s+/g,''),_0x268aae[_0x6a59('0x178')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x183')]=function(_0x108225){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x184'),_0x108225[_0x6a59('0xaa')]));return this[_0x6a59('0x38')][_0x6a59('0x185')](_0x108225[_0x6a59('0x60')][_0x6a59('0x53')](/\s+/g,''),_0x108225[_0x6a59('0x178')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x186')]=function(_0x477146){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x187'),_0x477146[_0x6a59('0xaa')]));return this[_0x6a59('0x38')][_0x6a59('0x188')](_0x477146[_0x6a59('0x56')],_0x477146[_0x6a59('0x178')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x189')]=function(_0x1d2aa2){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1d2aa2[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x1d2aa2['account_id'])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20mail\x20account\x20configured');}var _0x44c6a9=this['getMailAccount'][_0x6a59('0xa0')](this,_0x1d2aa2[_0x6a59('0x18a')]);if(!_0x44c6a9||!_0x44c6a9[_0x6a59('0x18b')]){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x1d2aa2,_0x6a59('0x18c'));}var _0x950bde={'from':util[_0x6a59('0x4f')](_0x6a59('0x18d'),_0x44c6a9['name'],_0x44c6a9[_0x6a59('0x18e')]||_0x44c6a9[_0x6a59('0x18b')][_0x6a59('0x18f')]),'to':_0x1d2aa2['to']||'','cc':_0x1d2aa2['cc']||'','bcc':_0x1d2aa2[_0x6a59('0x190')]||'','subject':_0x1d2aa2['subject'],'html':_0x1d2aa2[_0x6a59('0x56')],'text':_0x1d2aa2[_0x6a59('0x56')]};if(this[_0x6a59('0x7e')](_0x1d2aa2['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0x6a59('0x6b')](_0x950bde));this[_0x6a59('0x35')]['sync'](this,_0x1d2aa2,_0x1d2aa2[_0x6a59('0x18a')]);this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x44c6a9[_0x6a59('0x15')]));this[_0x6a59('0x25')][_0x6a59('0xa0')](this,_0x44c6a9[_0x6a59('0x191')],_0x950bde);return this['channel'][_0x6a59('0xa4')](_0x6a59('0x192'));};AGIVertices[_0x6a59('0x11')]['sendFax']=function(_0x4b9d72){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4b9d72[_0x6a59('0xaa')]));return this[_0x6a59('0x38')]['noop'](_0x6a59('0x193'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x194')]=function(_0x382b83){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x195'),_0x382b83[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x382b83[_0x6a59('0x196')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x197'));}var _0x297a48=this[_0x6a59('0x33')][_0x6a59('0xa0')](this,_0x382b83[_0x6a59('0x196')]);if(!_0x297a48){return this['channel'][_0x6a59('0x2c')](_0x382b83,_0x6a59('0x198'));}var _0x8aac94={'body':_0x382b83[_0x6a59('0x199')],'phone':_0x382b83['to']||'','SmsAccountId':_0x297a48['id']};logger[_0x6a59('0x19a')]('sendSMS\x20message',JSON[_0x6a59('0x6b')](_0x8aac94));this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x382b83,_0x382b83[_0x6a59('0x196')]);this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x19b'),_0x297a48[_0x6a59('0x15')]));this[_0x6a59('0x34')]['sync'](this,_0x8aac94);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6a59('0x11')][_0x6a59('0x19c')]=function(_0x48044f){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x19d'),_0x48044f['label']));if(!this[_0x6a59('0x7e')](_0x48044f[_0x6a59('0xd6')])){return this['channel'][_0x6a59('0x2c')](_0x48044f,'no\x20variable\x20selected');}var _0x49178f=this[_0x6a59('0x12')]['sync'](this,_0x48044f[_0x6a59('0xd6')]);if(!_0x49178f){return this[_0x6a59('0x38')]['error'](_0x48044f,_0x6a59('0xd7'));}return this[_0x6a59('0x38')][_0x6a59('0x9e')](_0x49178f,_0x48044f[_0x6a59('0x19e')]);};AGIVertices[_0x6a59('0x11')][_0x6a59('0x19f')]=function(_0x1ec6d5){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x1a0'),_0x1ec6d5['label']));this[_0x6a59('0x38')][_0x6a59('0xa4')](_0x6a59('0x1a1'));if(_0x1ec6d5['answer']===_0x6a59('0x1a2')){this[_0x6a59('0x38')]['noop'](_0x6a59('0x1a3'));return this[_0x6a59('0x38')][_0x6a59('0xb4')]();}return this['channel'][_0x6a59('0xa4')](_0x6a59('0x1a4'));};AGIVertices[_0x6a59('0x11')]['subproject']=function(_0x178535){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x1a5'),_0x178535[_0x6a59('0xaa')]));if(!this[_0x6a59('0x7e')](_0x178535[_0x6a59('0x1a6')])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x178535,_0x6a59('0x1a7'));}var _0x3b9188=this[_0x6a59('0x19')][_0x6a59('0xa0')](this,_0x178535[_0x6a59('0x1a6')]);if(!this[_0x6a59('0x7e')](_0x3b9188)){return this[_0x6a59('0x38')]['error'](_0x178535,util['format'](_0x6a59('0x1a8'),_0x178535[_0x6a59('0x1a6')]));}if(_0x3b9188===this['channel']['arg_1']){return this[_0x6a59('0x38')]['error'](_0x178535,_0x6a59('0x1a9'));}this['createSquareDetailsReport'][_0x6a59('0xa0')](this,_0x178535,_0x3b9188);var _0x391cbc=this[_0x6a59('0x38')]['exec'](_0x6a59('0x1aa'),util[_0x6a59('0x4f')](_0x6a59('0x1ab'),config[_0x6a59('0x8')][_0x6a59('0x1ac')]||_0x6a59('0x1ad'),_0x3b9188,this[_0x6a59('0x38')][_0x6a59('0x3d')]));if(_0x391cbc[_0x6a59('0xa7')]===-0x1){return _0x391cbc;}return this[_0x6a59('0x38')]['noop'](util[_0x6a59('0x4f')](_0x6a59('0xbf'),_0x6a59('0x1aa'),_0x3b9188));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1ae')]=function(_0x2f2b40){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x1af'),_0x2f2b40['label']));var _0x1ed7fb=this[_0x6a59('0x51')][_0x6a59('0xa0')](this,_0x2f2b40[_0x6a59('0xb2')]);this[_0x6a59('0x35')][_0x6a59('0xa0')](this,_0x2f2b40,_0x2f2b40['command']);if(this[_0x6a59('0x7e')](_0x2f2b40['variable_id'])){var _0xaf2f4c=this['getVariable']['sync'](this,_0x2f2b40['variable_id']);if(_0xaf2f4c){this[_0x6a59('0x38')][_0x6a59('0x9e')](_0xaf2f4c,_0x1ed7fb);return this['channel'][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2f2b40[_0x6a59('0xb2')],_0xaf2f4c));}}return this[_0x6a59('0x38')]['noop'](util['format'](_0x6a59('0x1b0'),_0x2f2b40[_0x6a59('0xb2')]));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1b1')]=function(_0x2b6ca0){logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2b6ca0[_0x6a59('0xaa')]));_0x2b6ca0[_0x6a59('0x56')]=_0x2b6ca0[_0x6a59('0x56')][_0x6a59('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2b6ca0[_0x6a59('0x1b2')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0x1b3'));}if(!this['isConfigured'](_0x2b6ca0[_0x6a59('0x56')])){return this[_0x6a59('0x38')][_0x6a59('0xa4')]('no\x20text\x20configured');}this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2b6ca0[_0x6a59('0x56')]));var _0x3744b8=this[_0x6a59('0x54')]['sync'](this,_0x2b6ca0);if(_0x3744b8){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3744b8));var _0x96043=this[_0x6a59('0x38')][_0x6a59('0xfb')](_0x3744b8);try{fs[_0x6a59('0xfc')](_0x3744b8+_0x6a59('0x14e'));}catch(_0x164bed){logger['error'](_0x164bed);}return _0x96043;}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0x2b6ca0,_0x6a59('0x1b4'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1b5')]=function(_0xa46375){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0xa46375[_0x6a59('0xaa')]));_0xa46375[_0x6a59('0x56')]=_0xa46375[_0x6a59('0x56')][_0x6a59('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a59('0x7e')](_0xa46375[_0x6a59('0x56')])){return this['channel'][_0x6a59('0xa4')](_0x6a59('0xa5'));}this[_0x6a59('0x38')][_0x6a59('0xa4')](util['format']('Trying\x20Google\x20TTS\x20%s',_0xa46375[_0x6a59('0x56')]));var _0x467590=this[_0x6a59('0x5c')][_0x6a59('0xa0')](this,_0xa46375);if(_0x467590){this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')](_0x6a59('0x1b6'),_0x467590));var _0xcad51e=this[_0x6a59('0x38')][_0x6a59('0xfb')](_0x467590);try{fs[_0x6a59('0xfc')](_0x467590+_0x6a59('0x14e'));}catch(_0x4c7c28){logger[_0x6a59('0x2c')](_0x4c7c28);}return _0xcad51e;}return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0xa46375,_0x6a59('0x1b7'));};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1b8')]=function(_0x580364){logger['info'](util[_0x6a59('0x4f')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x580364[_0x6a59('0xaa')]));if(!this['isConfigured'](_0x580364['findBy'])){return this['channel'][_0x6a59('0x2c')](_0x580364,_0x6a59('0x153'));}logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x154'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x580364[_0x6a59('0x152')]));var _0x1dd899=this[_0x6a59('0x4c')][_0x6a59('0xa0')](this,_0x580364['findBy']);if(_0x1dd899){logger['info'](util[_0x6a59('0x4f')](_0x6a59('0x155'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x580364[_0x6a59('0x152')]));this['channel']['noop'](util[_0x6a59('0x4f')](_0x6a59('0x155'),this['channel']['callerid'],_0x580364[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x156')};}else{logger[_0x6a59('0x2e')](util[_0x6a59('0x4f')](_0x6a59('0x157'),this[_0x6a59('0x38')][_0x6a59('0x39')],_0x580364[_0x6a59('0x152')]));this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a59('0x38')][_0x6a59('0x39')],_0x580364[_0x6a59('0x152')]));return{'code':0xc8,'result':_0x6a59('0x158')};}};AGIVertices[_0x6a59('0x11')][_0x6a59('0x1b9')]=function(_0x3ef02e){logger[_0x6a59('0x2e')](util['format'](_0x6a59('0x1ba'),_0x3ef02e[_0x6a59('0xaa')]));var _0x412df9=this['channel']['exec'](_0x6a59('0x1bb'),[_0x3ef02e[_0x6a59('0x1bc')],_0x3ef02e[_0x6a59('0x70')]]);if(_0x412df9[_0x6a59('0xa7')]===-0x1){return _0x412df9;}return this[_0x6a59('0x38')][_0x6a59('0xa4')](util[_0x6a59('0x4f')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3ef02e[_0x6a59('0x1bc')]));};AGIVertices[_0x6a59('0x11')]['vswitch']=function(_0xc66aa7){logger['info'](util['format'](_0x6a59('0x1bd'),_0xc66aa7['label']));if(!this['isConfigured'](_0xc66aa7['variable_id'])){return this[_0x6a59('0x38')][_0x6a59('0x2c')](_0xc66aa7,_0x6a59('0x1be'));}var _0x1d0e63=this[_0x6a59('0x12')][_0x6a59('0xa0')](this,_0xc66aa7[_0x6a59('0xd6')]);if(!_0x1d0e63){return this[_0x6a59('0x38')]['error'](_0xc66aa7,_0x6a59('0xd7'));}var _0x22099b=this['channel']['getVariable'](_0x1d0e63);return{'code':0xc8,'result':_0x22099b[_0x6a59('0x9b')]?_0x22099b[_0x6a59('0x9b')]:'-'};};String[_0x6a59('0x11')][_0x6a59('0x9a')]=function(_0x199941,_0x1bc46d){return this[_0x6a59('0x1bf')](_0x199941)[_0x6a59('0x1c0')](_0x1bc46d);};module[_0x6a59('0x1c1')]=AGIVertices; \ No newline at end of file +var _0xa446=['Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','test','mindigit','maxdigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','odbc','moment','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','callback_','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','PUT','method','toUpperCase','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','body','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','agicommand','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','replaceAllVariables','saveRestApiResult','format','%s.%s','setVariable','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','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','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0xa446,0xc6));var _0x6a44=function(_0x1ef6aa,_0x3c7073){_0x1ef6aa=_0x1ef6aa-0x0;var _0x16dc54=_0xa446[_0x1ef6aa];return _0x16dc54;};'use strict';var fs=require('fs');var util=require(_0x6a44('0x0'));var _=require(_0x6a44('0x1'));var sh=require('shelljs');var odbc=require(_0x6a44('0x2'))();var rs=require('randomstring');var moment=require(_0x6a44('0x3'));var Mustache=require('mustache');var rp=require(_0x6a44('0x4'));var logger=require('../../config/logger')(_0x6a44('0x5'));var config=require(_0x6a44('0x6'));var shared=require(_0x6a44('0x7'));var scripts=require(_0x6a44('0x8'));var FILES_PATH=_0x6a44('0x9');var recursiveMapAttributes=[_0x6a44('0xa'),'rawBody'];var verticesWithRetry=[_0x6a44('0xb'),_0x6a44('0xc'),_0x6a44('0xd')];var AGIVertices=function(_0x78c684,_0x44bf43,_0x5596eb){this[_0x6a44('0xe')]=_0x78c684;this[_0x6a44('0xf')]=_0x44bf43;this[_0x6a44('0x10')]=_0x5596eb;};AGIVertices[_0x6a44('0x11')][_0x6a44('0x12')]=function(_0x159d5d,_0x65ad59){this['rpc'][_0x6a44('0x13')](_0x159d5d)[_0x6a44('0x14')](function(_0x4a7ab2){_0x65ad59(null,_0x4a7ab2?_0x4a7ab2[_0x6a44('0x15')]:![]);})[_0x6a44('0x16')](function(_0x21ce4a){_0x65ad59(_0x21ce4a);});};AGIVertices['prototype'][_0x6a44('0x17')]=function(_0x3fcead,_0x94be1){this[_0x6a44('0xf')][_0x6a44('0x18')](_0x3fcead)[_0x6a44('0x14')](function(_0x553bc1){_0x94be1(null,_0x553bc1?_0x553bc1['name']:![]);})[_0x6a44('0x16')](function(_0x973938){_0x94be1(_0x973938);});};AGIVertices['prototype'][_0x6a44('0x19')]=function(_0x38f796,_0x41af8f){this[_0x6a44('0xf')][_0x6a44('0x1a')](_0x38f796)[_0x6a44('0x14')](function(_0x3dde7f){_0x41af8f(null,_0x3dde7f?_0x3dde7f[_0x6a44('0x15')]:![]);})[_0x6a44('0x16')](function(_0x25a47c){_0x41af8f(_0x25a47c);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1b')]=function(_0x1b8920,_0x108c4b){this['rpc']['getSquareOdbcById'](_0x1b8920)['then'](function(_0x2d279b){_0x108c4b(null,_0x2d279b?_0x2d279b[_0x6a44('0x1c')]:![]);})[_0x6a44('0x16')](function(_0x1a7990){_0x108c4b(_0x1a7990);});};AGIVertices['prototype'][_0x6a44('0x1d')]=function(_0x24ba62,_0x528afe){this[_0x6a44('0xf')][_0x6a44('0x1e')](_0x24ba62)[_0x6a44('0x14')](function(_0x153a7a){_0x528afe(null,_0x153a7a?_0x153a7a[_0x6a44('0x15')]:![]);})[_0x6a44('0x16')](function(_0x178b35){_0x528afe(_0x178b35);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1f')]=function(_0x4b5762,_0x172d1e){this[_0x6a44('0xf')][_0x6a44('0x20')](_0x4b5762)[_0x6a44('0x14')](function(_0x499e87){_0x172d1e(null,_0x499e87?_0x499e87[_0x6a44('0x15')]:![]);})['catch'](function(_0x3ad23e){_0x172d1e(_0x3ad23e);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x21')]=function(_0x2e86a1,_0x60e38f){var _0x245637=this;this[_0x6a44('0xf')][_0x6a44('0x22')](_0x2e86a1)[_0x6a44('0x14')](function(_0x5b81ce){_0x60e38f(null,_0x5b81ce?_0x245637['getSoundPath'](_0x5b81ce[_0x6a44('0x23')]):![]);})['catch'](function(_0xaef746){_0x60e38f(_0xaef746);});};AGIVertices['prototype']['getMailAccount']=function(_0x391f33,_0xbe9fa1){this[_0x6a44('0xf')]['getMailAccountById'](_0x391f33)[_0x6a44('0x14')](function(_0x5866ec){_0xbe9fa1(null,_0x5866ec?_0x5866ec:![]);})[_0x6a44('0x16')](function(_0x2c0dcd){_0xbe9fa1(_0x2c0dcd);});};AGIVertices['prototype']['sendMailMessage']=function(_0x3697e9,_0x358433,_0x4178fb){this['mailRpc']['sendMailMessage'](_0x3697e9,_0x358433)[_0x6a44('0x14')](function(){_0x4178fb(null);})[_0x6a44('0x16')](function(_0x70e134){_0x4178fb(_0x70e134);});};AGIVertices['prototype'][_0x6a44('0x24')]=function(_0x50a4b1,_0x25f931){this[_0x6a44('0xf')][_0x6a44('0x25')](_0x50a4b1)[_0x6a44('0x14')](function(_0x413648){if(_0x413648){if(_0x413648[_0x6a44('0x26')]){_0x25f931(null,[_0x413648[_0x6a44('0x27')]]);}else{_0x25f931(null,_[_0x6a44('0x28')](_0x413648[_0x6a44('0x29')],_0x6a44('0x27')));}}else{_0x25f931(null,![]);}})['catch'](function(_0x198977){_0x25f931(_0x198977);});};AGIVertices['prototype']['getSoundPath']=function(_0x4fd4ff){return util['format'](_0x6a44('0x2a'),FILES_PATH,_0x4fd4ff);};AGIVertices['prototype'][_0x6a44('0x2b')]=function(_0x4b4501,_0x380ca3,_0x2ca22a){odbc['open'](_0x4b4501,function(_0x500833){if(_0x500833){logger[_0x6a44('0x2c')](_0x6a44('0x2d'),_0x500833);_0x2ca22a(_0x500833);}else{logger[_0x6a44('0x2e')](_0x6a44('0x2f'));odbc['query'](_0x380ca3,function(_0x309237,_0xf7d957){if(_0x309237){logger[_0x6a44('0x2e')](_0x6a44('0x30'),_0x380ca3);_0x2ca22a(_0x309237);}else{logger[_0x6a44('0x2e')](_0x6a44('0x31'),_0x380ca3);odbc['close'](function(_0x1e51a5){if(_0x1e51a5){logger[_0x6a44('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1e51a5);}_0x2ca22a(null,_0xf7d957);});}});}});};AGIVertices[_0x6a44('0x11')]['getSmsAccount']=function(_0xcd852f,_0x527df6){this[_0x6a44('0xf')][_0x6a44('0x32')](_0xcd852f)[_0x6a44('0x14')](function(_0x7b1ca6){_0x527df6(null,_0x7b1ca6?_0x7b1ca6:![]);})[_0x6a44('0x16')](function(_0x4d6be4){_0x527df6(_0x4d6be4);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x33')]=function(_0x12327f,_0x55a95a){this[_0x6a44('0xf')][_0x6a44('0x33')](_0x12327f)['then'](function(_0x4af24b){_0x55a95a(null,_0x4af24b);})['catch'](function(_0x59c038){_0x55a95a(_0x59c038);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x34')]=function(_0x21ba45,_0x18315e,_0x3e2615){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x6a44('0xe')][_0x6a44('0x35')],'node':_0x21ba45[_0x6a44('0x36')],'application':_0x21ba45['agicommand'],'data':_0x18315e||null,'project_name':this[_0x6a44('0xe')][_0x6a44('0x37')],'callerid':this[_0x6a44('0xe')]['callerid']})[_0x6a44('0x14')](function(_0x3e809f){if(_0x3e2615){_0x3e2615(null,_0x3e809f);}})[_0x6a44('0x16')](function(_0x1055aa){if(_0x3e2615){_0x3e2615(_0x1055aa);}});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x38')]=function(_0x32b24d,_0xb169f,_0x4bf874,_0xa74584){this[_0x6a44('0xf')][_0x6a44('0x38')]({'uniqueid':this[_0x6a44('0xe')][_0x6a44('0x35')],'callerid':this[_0x6a44('0xe')][_0x6a44('0x39')],'calleridname':this[_0x6a44('0xe')][_0x6a44('0x3a')],'context':this['channel'][_0x6a44('0x3b')],'extension':this[_0x6a44('0xe')][_0x6a44('0x3c')],'priority':this[_0x6a44('0xe')][_0x6a44('0x3d')],'accountcode':this[_0x6a44('0xe')][_0x6a44('0x3e')],'dnid':this[_0x6a44('0xe')]['dnid'],'projectName':this[_0x6a44('0xe')][_0x6a44('0x37')],'saveName':_0xb169f,'filename':_0x32b24d[_0x6a44('0x3f')]||_0xb169f,'savePath':_0x4bf874})['then'](function(_0x151681){_0xa74584(null,_0x151681);})['catch'](function(_0x5beef0){_0xa74584(_0x5beef0);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x40')]=function(_0x4eb07b,_0x4f7468,_0x32fe47,_0x109879,_0x50ba64){this[_0x6a44('0xf')]['createSquareMessage']({'uniqueid':this[_0x6a44('0xe')][_0x6a44('0x35')],'body':_0x4eb07b,'direction':_0x4f7468,'providerName':_0x32fe47,'providerResponse':_0x109879})[_0x6a44('0x14')](function(_0x4c0eb8){if(_0x50ba64){_0x50ba64(null,_0x4c0eb8);}})['catch'](function(_0x531bbc){if(_0x50ba64){_0x50ba64(_0x531bbc);}});};AGIVertices['prototype'][_0x6a44('0x41')]=function(_0xa393fc,_0x428a08){this[_0x6a44('0xf')][_0x6a44('0x41')]({'firstName':_['isEmpty'](_0xa393fc[_0x6a44('0x15')])||_['isNil'](_0xa393fc[_0x6a44('0x15')])?_0x6a44('0x42')+Math['random']():_0xa393fc[_0x6a44('0x15')],'lastName':_[_0x6a44('0x43')](_0xa393fc['lastName'])||_[_0x6a44('0x44')](_0xa393fc[_0x6a44('0x45')])?null:_0xa393fc[_0x6a44('0x45')],'phone':_0xa393fc[_0x6a44('0x46')],'ListId':_0xa393fc[_0x6a44('0x47')],'scheduledat':_0xa393fc[_0x6a44('0x48')],'callbackUniqueid':this[_0x6a44('0xe')][_0x6a44('0x35')],'tags':_0x6a44('0x49'),'description':_0x6a44('0x4a')+_0xa393fc['scheduledAt'][_0x6a44('0x4b')](),'priority':_0xa393fc['callback_priority']})[_0x6a44('0x14')](function(_0x2eb803){_0x428a08(null,_0x2eb803);})[_0x6a44('0x16')](function(_0x11d9b2){_0x428a08(_0x11d9b2);});};AGIVertices[_0x6a44('0x11')]['getPause']=function(_0x281677,_0x13231c){this[_0x6a44('0xf')][_0x6a44('0x4c')](_0x281677)[_0x6a44('0x14')](function(_0x2f6261){_0x13231c(null,_0x2f6261?_0x2f6261[_0x6a44('0x15')]:![]);})[_0x6a44('0x16')](function(_0x200944){_0x13231c(_0x200944);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x4d')]=function(_0x51e7df,_0x668d2a,_0x407879){var _0x2623d2={'role':_0x6a44('0x4e')};_0x2623d2[_0x51e7df]=this[_0x6a44('0xe')][_0x6a44('0x39')];this[_0x6a44('0xf')][_0x6a44('0x4d')](_0x2623d2,_0x668d2a,this[_0x6a44('0xe')]['uniqueid'])[_0x6a44('0x14')](function(_0x15ff59){_0x407879(null,_[_0x6a44('0x44')](_0x15ff59)?![]:!![]);})[_0x6a44('0x16')](function(_0x5ae6fc){logger[_0x6a44('0x2c')](_0x5ae6fc);_0x407879(null,![]);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x4f')]=function(_0x589100,_0x41fd85){var _0x5d6d31={'role':'agent'};_0x5d6d31[_0x589100]=this[_0x6a44('0xe')][_0x6a44('0x39')];this[_0x6a44('0xf')][_0x6a44('0x4f')](_0x5d6d31)[_0x6a44('0x14')](function(_0x545397){_0x41fd85(null,_[_0x6a44('0x44')](_0x545397)?![]:!![]);})[_0x6a44('0x16')](function(_0x50c12b){logger['error'](_0x50c12b);_0x41fd85(null,![]);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x50')]=function(_0x15dc83,_0x2aaea3){var _0x5e02ed={'role':_0x6a44('0x4e')};_0x5e02ed[_0x15dc83]=this[_0x6a44('0xe')]['callerid'];this['rpc'][_0x6a44('0x50')](_0x5e02ed)[_0x6a44('0x14')](function(_0x418a7e){_0x2aaea3(null,_['isNil'](_0x418a7e)?![]:!![]);})[_0x6a44('0x16')](function(_0x12495e){logger[_0x6a44('0x2c')](_0x12495e);_0x2aaea3(null,![]);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x51')]=function(_0x2f7a0d,_0x4fe5bb){var _0xd23bf5={'role':_0x6a44('0x4e')};_0xd23bf5[_0x2f7a0d]=this['channel'][_0x6a44('0x39')];var _0x3fdddf=_0x2f7a0d!=_0x6a44('0x52')?util['format']('%s/%s@from-sip/n',_0x6a44('0x53'),this[_0x6a44('0xe')]['callerid']):undefined;this[_0x6a44('0xf')]['agentLogin'](_0xd23bf5,_0x3fdddf)[_0x6a44('0x14')](function(_0xa8f259){_0x4fe5bb(null,_[_0x6a44('0x44')](_0xa8f259)?![]:!![]);})[_0x6a44('0x16')](function(_0x556d07){logger['error'](_0x556d07);_0x4fe5bb(null,![]);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x54')]=function(_0x46a77a,_0x229bc4){sh[_0x6a44('0x55')](_[_0x6a44('0x56')](_0x46a77a),function(_0x439835,_0x19350c){var _0x36e872=_0x19350c[_0x6a44('0x57')](/(\r\n|\n|\r)/gm,'');_0x229bc4(null,_0x36e872);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x58')]=function(_0x19de84,_0x238eb3){scripts[_0x6a44('0x58')](_0x19de84[_0x6a44('0x59')],_0x19de84[_0x6a44('0x5a')]||_0x6a44('0x5b'),_0x19de84[_0x6a44('0x5b')],_0x19de84[_0x6a44('0x5c')]||'en-US',_0x19de84[_0x6a44('0x5d')]||_0x6a44('0x5e'),_0x19de84[_0x6a44('0x5f')]||_0x6a44('0x60'))['then'](function(_0x33ddac){_0x238eb3(null,_0x33ddac);})[_0x6a44('0x16')](function(_0x984f87){_0x238eb3(_0x984f87);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x61')]=function(_0x3c1561,_0x56932a){scripts[_0x6a44('0x61')](_0x3c1561[_0x6a44('0x5b')],_0x3c1561[_0x6a44('0x62')]||'en',0x1)[_0x6a44('0x14')](function(_0x36c59d){_0x56932a(null,_0x36c59d);})[_0x6a44('0x16')](function(_0x57fd0b){_0x56932a(_0x57fd0b);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x63')]=function(_0x5cb6c3,_0x36543d){var _0x463126={'uri':_0x5cb6c3[_0x6a44('0x64')],'method':_0x5cb6c3['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5cb6c3[_0x6a44('0x65')])==='number'&&parseInt(_0x5cb6c3[_0x6a44('0x65')])>=0x1?parseInt(_0x5cb6c3['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6a44('0x66')](['POST',_0x6a44('0x67')],_0x463126[_0x6a44('0x68')][_0x6a44('0x69')]())){try{_0x463126['body']=_0x5cb6c3['rawBody']?JSON[_0x6a44('0x6a')](_0x5cb6c3[_0x6a44('0x6b')]):{};}catch(_0x1326dd){logger[_0x6a44('0x2c')](_0x6a44('0x6c'),_0x1326dd);}}try{_0x463126['headers']=_0x5cb6c3[_0x6a44('0xa')]?JSON[_0x6a44('0x6a')](_0x5cb6c3[_0x6a44('0xa')]):{};}catch(_0x15732b){logger[_0x6a44('0x2c')](_0x6a44('0x6d'),_0x15732b);}if(_0x5cb6c3[_0x6a44('0x6e')]){try{var _0x4fad0a=require(_0x5cb6c3[_0x6a44('0x6e')])[_0x6a44('0x6f')](this,_0x463126);_0x463126[_0x6a44('0x70')]=Mustache[_0x6a44('0x71')](_0x5cb6c3[_0x6a44('0x64')],_0x4fad0a,{},['$$','$$']);if(_0x463126[_0x6a44('0x72')]){_0x463126[_0x6a44('0x72')]=JSON[_0x6a44('0x6a')](Mustache[_0x6a44('0x71')](JSON['stringify'](_0x463126[_0x6a44('0x72')]),_0x4fad0a,{},['$$','$$']));}if(_0x463126[_0x6a44('0x73')]){_0x463126['body']=JSON['parse'](Mustache[_0x6a44('0x71')](JSON[_0x6a44('0x74')](_0x463126[_0x6a44('0x73')]),_0x4fad0a,{},['$$','$$']));}}catch(_0x1ca4c9){logger[_0x6a44('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1ca4c9);}}rp(_0x463126)[_0x6a44('0x14')](function(_0x5a93ea){var _0x14096b={'statusCode':_0x5a93ea[_0x6a44('0x75')]||0xc8,'statusMessage':_0x5a93ea[_0x6a44('0x76')]||'OK','headers':_0x5a93ea['headers']||{},'body':_0x5a93ea[_0x6a44('0x73')]||{}};_0x36543d(null,_0x14096b);})[_0x6a44('0x16')](function(_0x2b450d){var _0x3cc19d={'statusCode':_0x2b450d[_0x6a44('0x75')]||0x1f4,'statusMessage':_0x2b450d[_0x6a44('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2b450d[_0x6a44('0x78')]['headers']||{},'body':_0x2b450d['options'][_0x6a44('0x73')]||{}};_0x36543d(null,_0x3cc19d);});};AGIVertices[_0x6a44('0x11')]['googleDialogflow']=function(_0x5c976f,_0x578521){scripts[_0x6a44('0x79')](this[_0x6a44('0xe')][_0x6a44('0x35')],_0x5c976f[_0x6a44('0x7a')],_0x5c976f[_0x6a44('0x5b')],_0x5c976f[_0x6a44('0x7b')]||'en')[_0x6a44('0x14')](function(_0x43e7f3){_0x578521(null,_0x43e7f3);})[_0x6a44('0x16')](function(_0x3cd47e){_0x578521(_0x3cd47e);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x7c')]=function(_0xbcb24c,_0x389056){scripts[_0x6a44('0x7c')](this['channel'][_0x6a44('0x35')],_0xbcb24c[_0x6a44('0x7d')],_0xbcb24c['client_email'],_0xbcb24c[_0x6a44('0x7e')],_0xbcb24c[_0x6a44('0x5b')],_0xbcb24c['dialogflowV2_language']||'en')[_0x6a44('0x14')](function(_0x506e4e){_0x389056(null,_0x506e4e);})[_0x6a44('0x16')](function(_0x3bd5a3){_0x389056(_0x3bd5a3);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x7f')]=function(_0x3e3513,_0x159c82){scripts['sestekNDA'](this[_0x6a44('0xe')],_0x3e3513)[_0x6a44('0x14')](function(_0x455bea){_0x159c82(null,_0x455bea);})[_0x6a44('0x16')](function(_0x5ba21d){_0x159c82(_0x5ba21d);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x80')]=function(_0x3ad121,_0x286740){scripts['ispeechTTS'](_0x3ad121[_0x6a44('0x7a')],_0x3ad121[_0x6a44('0x5b')],_0x3ad121[_0x6a44('0x81')]||_0x6a44('0x82'),_0x3ad121[_0x6a44('0x83')])[_0x6a44('0x14')](function(_0x44e22a){_0x286740(null,_0x44e22a);})[_0x6a44('0x16')](function(_0x279c64){_0x286740(_0x279c64);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x84')]=function(_0x33931c,_0x4a3152,_0x39473a){scripts[_0x6a44('0x84')](_0x4a3152,_0x33931c['key'],_0x33931c[_0x6a44('0x85')]||_0x6a44('0x82'),this['isConfigured'](_0x33931c[_0x6a44('0x86')])?_0x33931c[_0x6a44('0x86')]:undefined)[_0x6a44('0x14')](function(_0x35a8b9){_0x39473a(null,_0x35a8b9);})[_0x6a44('0x16')](function(_0x8b9d16){_0x39473a(_0x8b9d16);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x87')]=function(_0x149fc3,_0xec0717){scripts[_0x6a44('0x87')](_0x149fc3[_0x6a44('0x88')],_0x149fc3[_0x6a44('0x89')],_0x149fc3[_0x6a44('0x8a')],_0x149fc3[_0x6a44('0x8b')]||_0x6a44('0x8c'),_0x149fc3[_0x6a44('0x5b')],_0x149fc3[_0x6a44('0x8d')]||_0x6a44('0x5b'))['then'](function(_0x150313){_0xec0717(null,_0x150313);})['catch'](function(_0x5396ec){_0xec0717(_0x5396ec);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x8e')]=function(_0x3e82f4,_0x4536c6){scripts[_0x6a44('0x8e')](this[_0x6a44('0xe')]['uniqueid'],_0x3e82f4[_0x6a44('0x88')],_0x3e82f4[_0x6a44('0x89')],_0x3e82f4[_0x6a44('0x8f')],_0x3e82f4['text'],_0x3e82f4[_0x6a44('0x90')])[_0x6a44('0x14')](function(_0x5ab0ce){_0x4536c6(null,_0x5ab0ce);})[_0x6a44('0x16')](function(_0x3e5fb4){_0x4536c6(_0x3e5fb4);});};AGIVertices[_0x6a44('0x11')][_0x6a44('0x91')]=function(_0x5dc49b,_0x13d764,_0x58b708){scripts[_0x6a44('0x91')](_0x13d764,_0x5dc49b[_0x6a44('0x7a')],_0x5dc49b[_0x6a44('0x92')]||_0x6a44('0x82'))[_0x6a44('0x14')](function(_0x59e5b2){_0x58b708(null,_0x59e5b2);})['catch'](function(_0x4445d4){_0x58b708(_0x4445d4);});};AGIVertices[_0x6a44('0x11')]['tildeASR']=function(_0x36b2d2,_0xb6cd5c,_0x4f2c35){scripts[_0x6a44('0x93')](_0xb6cd5c,_0x36b2d2[_0x6a44('0x94')],_0x36b2d2['appsecret'],_0x36b2d2[_0x6a44('0x70')])[_0x6a44('0x14')](function(_0x135ce3){_0x4f2c35(null,_0x135ce3);})[_0x6a44('0x16')](function(_0x250311){_0x4f2c35(_0x250311);});};AGIVertices['prototype'][_0x6a44('0x95')]=function(_0x56152b){var _0x4325ab=_[_0x6a44('0x66')](verticesWithRetry,_0x56152b[_0x6a44('0x96')])?_0x56152b:_[_0x6a44('0x97')](_0x56152b);for(var _0x3155d4 in _0x4325ab){if(_0x4325ab['hasOwnProperty'](_0x3155d4)){if(_0x4325ab[_0x3155d4]&&_[_0x6a44('0x98')](_0x4325ab[_0x3155d4])){if(_[_0x6a44('0x66')](recursiveMapAttributes,_0x3155d4)){_0x4325ab[_0x3155d4]=this[_0x6a44('0x99')](_0x4325ab[_0x3155d4]);}else{_0x4325ab[_0x3155d4]=this['replaceAllVariables'](_0x4325ab[_0x3155d4]);}}}}return _0x4325ab;};AGIVertices['prototype'][_0x6a44('0x9a')]=function(_0x19f416){for(var _0x50eb9f in _0x19f416){if(_0x19f416[_0x6a44('0x9b')](_0x50eb9f)){if(_[_0x6a44('0x9c')](_0x19f416[_0x50eb9f])){this[_0x6a44('0x9a')](_0x19f416[_0x50eb9f]);}else if(_[_0x6a44('0x9d')](_0x19f416[_0x50eb9f])){for(var _0x1cca54=0x0;_0x1cca54<_0x19f416[_0x50eb9f]['length'];_0x1cca54++){this[_0x6a44('0x9a')](_0x19f416[_0x50eb9f][_0x1cca54]);}}else if(_['isString'](_0x19f416[_0x50eb9f])){_0x19f416[_0x50eb9f]=this[_0x6a44('0x9e')](_0x19f416[_0x50eb9f]);}}}};AGIVertices[_0x6a44('0x11')][_0x6a44('0x9f')]=function(_0x38c682,_0x1bcfeb){for(var _0x5c91ca in _0x38c682){if(_0x38c682['hasOwnProperty'](_0x5c91ca)){if(_[_0x6a44('0x9c')](_0x38c682[_0x5c91ca])){if(!_[_0x6a44('0x43')](_0x38c682[_0x5c91ca])){this[_0x6a44('0x9f')](_0x38c682[_0x5c91ca],util[_0x6a44('0xa0')](_0x6a44('0xa1'),_0x1bcfeb,_0x5c91ca));}}else if(_[_0x6a44('0x9d')](_0x38c682[_0x5c91ca])){for(var _0x4b086a=0x0;_0x4b086a<_0x38c682[_0x5c91ca]['length'];_0x4b086a++){this['saveRestApiResult'](_0x38c682[_0x5c91ca][_0x4b086a],util['format'](_0x6a44('0xa1'),_0x1bcfeb,_0x5c91ca+'['+_0x4b086a+']'));}}else{if(!_[_0x6a44('0x44')](_0x38c682[_0x5c91ca])){this['channel'][_0x6a44('0xa2')](util['format']('%s.%s',_0x1bcfeb,_0x5c91ca),_0x38c682[_0x5c91ca]);}}}}};AGIVertices[_0x6a44('0x11')][_0x6a44('0x99')]=function(_0x33b94e){try{var _0x4b01c5=JSON[_0x6a44('0x6a')](_0x33b94e);this[_0x6a44('0x9a')](_0x4b01c5);return JSON['stringify'](_0x4b01c5);}catch(_0x149e06){return this['replaceAllVariables'](_0x33b94e);}};AGIVertices[_0x6a44('0x11')][_0x6a44('0x9e')]=function(_0x17d000){var _0x46aa32=_0x17d000[_0x6a44('0xa3')]('{');for(var _0x36ce2d=0x1;_0x36ce2d<_0x46aa32[_0x6a44('0xa4')];_0x36ce2d+=0x1){var _0x3fd7be=_0x46aa32[_0x36ce2d][_0x6a44('0xa3')]('}');if(_0x3fd7be[_0x6a44('0xa4')]>0x1){_0x17d000=_0x17d000[_0x6a44('0xa5')]('{'+_0x3fd7be[0x0]+'}',this['channel'][_0x6a44('0x12')](_0x3fd7be[0x0])[_0x6a44('0xa6')]||_0x3fd7be[0x0]);}}if(_0x46aa32['length']===0x1){return _0x17d000['toString']();}return this[_0x6a44('0x9e')](_0x17d000);};AGIVertices[_0x6a44('0x11')][_0x6a44('0xa7')]=function(_0x162f92,_0x3ec8a9){var _0x463dd8=this['channel'][_0x6a44('0x12')](_0x162f92);if(_0x463dd8[_0x6a44('0xa8')]===-0x1){return _0x463dd8;}logger['info'](util[_0x6a44('0xa0')](_0x6a44('0xa9'),_0x3ec8a9,_0x463dd8[_0x6a44('0xa6')]));return this[_0x6a44('0xe')]['setVariable'](_0x3ec8a9,_0x463dd8['extra']);};AGIVertices[_0x6a44('0x11')]['isConfigured']=function(_0x6cfddc){return _0x6cfddc&&_0x6cfddc!=='0'&&_0x6cfddc!=='-1'&&_0x6cfddc!=='';};AGIVertices['prototype'][_0x6a44('0xaa')]=function(_0x26780b){this['createSquareDetailsReport'][_0x6a44('0x6f')](this,_0x26780b,'-');_0x26780b[_0x6a44('0xab')]=_0x26780b[_0x6a44('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6a44('0x11')][_0x6a44('0xac')]=function(_0x1c6cfe){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0xad'),_0x1c6cfe['label']));if(!this[_0x6a44('0xae')](_0x1c6cfe[_0x6a44('0x5b')])){return this['channel'][_0x6a44('0xaf')]('no\x20text\x20configured');}var _0x1cff55='\x22'+_0x1c6cfe[_0x6a44('0x5b')]+'\x22';if(this['isConfigured'](_0x1c6cfe['options'])){_0x1cff55+=','+_0x1c6cfe[_0x6a44('0x78')];}var _0x725215=this[_0x6a44('0xe')][_0x6a44('0x55')](_0x6a44('0xb0'),_0x1cff55);if(_0x725215[_0x6a44('0xa8')]===-0x1){return _0x725215;}return this[_0x6a44('0xe')]['noop'](util[_0x6a44('0xa0')](_0x6a44('0xb1'),_0x1cff55));};AGIVertices[_0x6a44('0x11')]['mrcprecog']=function(_0x548282){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x548282[_0x6a44('0x36')]));if(!this['isConfigured'](_0x548282[_0x6a44('0xb2')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xb3'));}var _0x39e5f2=_0x548282[_0x6a44('0xb2')];if(this[_0x6a44('0xae')](_0x548282[_0x6a44('0x78')])){_0x39e5f2+=','+_0x548282[_0x6a44('0x78')];}var _0x11edef=this['channel'][_0x6a44('0x55')]('MRCPRecog',_0x39e5f2);if(_0x11edef[_0x6a44('0xa8')]===-0x1){return _0x11edef;}var _0x4bb243=this[_0x6a44('0xa7')](_0x6a44('0xb4'),'MRCP_RECOG_CONFIDENCE');if(_0x4bb243[_0x6a44('0xa8')]===-0x1){return _0x4bb243;}var _0x5647a2=this[_0x6a44('0xa7')](_0x6a44('0xb5'),_0x6a44('0xb6'));if(_0x5647a2[_0x6a44('0xa8')]===-0x1){return _0x5647a2;}var _0x39b5dc=this[_0x6a44('0xa7')]('RECOG_INSTANCE()',_0x6a44('0xb7'));if(_0x39b5dc['result']===-0x1){return _0x39b5dc;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xb8'),_0x39e5f2));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x5')]=function(_0x2886f4){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0xb9'),_0x2886f4[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0x5')]([_0x2886f4[_0x6a44('0xba')],_0x2886f4[_0x6a44('0xbb')]]);};AGIVertices[_0x6a44('0x11')][_0x6a44('0xbc')]=function(_0x50a62c){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0xbd'),_0x50a62c[_0x6a44('0x36')]));if(this['isConfigured'](_0x50a62c[_0x6a44('0x65')])){logger['info'](util[_0x6a44('0xa0')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x50a62c['timeout']));var _0x66a718=this[_0x6a44('0xe')]['wait'](_0x50a62c[_0x6a44('0x65')]);if(_0x66a718[_0x6a44('0xa8')]===-0x1){return _0x66a718;}}return this['channel'][_0x6a44('0xbc')]();};AGIVertices['prototype'][_0x6a44('0x49')]=function(_0x2abb0e){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x2abb0e[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x2abb0e['list_id'])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x2abb0e,'no\x20list\x20selected');}_0x2abb0e[_0x6a44('0x48')]=moment();if(this[_0x6a44('0xae')](_0x2abb0e[_0x6a44('0xbe')])){_0x2abb0e[_0x6a44('0x48')]=moment()[_0x6a44('0xbf')](_0x2abb0e['delay'],_0x6a44('0xc0'));}if(!this[_0x6a44('0xae')](_0x2abb0e[_0x6a44('0xc1')])){_0x2abb0e[_0x6a44('0xc1')]=0x2;}this[_0x6a44('0x41')][_0x6a44('0x6f')](this,_0x2abb0e);return this[_0x6a44('0xe')]['noop'](util['format'](_0x6a44('0xc2'),_0x2abb0e['phone'],_0x2abb0e['list_id'],_0x2abb0e['scheduledAt']));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xc3')]=function(_0xd2edd4){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0xc4'),_0xd2edd4[_0x6a44('0x36')]));var _0x3f97b0=this[_0x6a44('0xe')]['exec'](_0xd2edd4[_0x6a44('0xc5')],_0xd2edd4[_0x6a44('0x78')]);if(_0x3f97b0[_0x6a44('0xa8')]===-0x1){return _0x3f97b0;}return this[_0x6a44('0xe')]['noop'](util[_0x6a44('0xa0')](_0x6a44('0xc6'),_0xd2edd4[_0x6a44('0xc5')],_0xd2edd4['options']));};AGIVertices['prototype'][_0x6a44('0xc7')]=function(_0x5eb684){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0xc8'),_0x5eb684[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x5eb684['text'])){return this[_0x6a44('0xe')]['noop']('no\x20text\x20configured');}var _0xf41eb6='\x22'+_0x5eb684['text']+'\x22';if(this['isConfigured'](_0x5eb684[_0x6a44('0x78')])){_0xf41eb6+=','+_0x5eb684[_0x6a44('0x78')];}var _0x189bbb=this[_0x6a44('0xe')][_0x6a44('0x55')](_0x6a44('0xb0'),_0xf41eb6);if(_0x189bbb['result']===-0x1){return _0x189bbb;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xb1'),_0xf41eb6));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xc9')]=function(_0xb86e86){logger['info'](util['format'](_0x6a44('0xca'),_0xb86e86[_0x6a44('0x36')]));if(!this['isConfigured'](_0xb86e86[_0x6a44('0x5b')])){return this[_0x6a44('0xe')]['noop']('no\x20text\x20configured');}var _0x2e8f6c='\x22'+_0xb86e86[_0x6a44('0x5b')]+'\x22';if(this[_0x6a44('0xae')](_0xb86e86['options'])){_0x2e8f6c+=','+_0xb86e86[_0x6a44('0x78')];}var _0x135189=this[_0x6a44('0xe')]['exec']('MRCPSynth',_0x2e8f6c);if(_0x135189[_0x6a44('0xa8')]===-0x1){return _0x135189;}return this[_0x6a44('0xe')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x2e8f6c));};AGIVertices['prototype'][_0x6a44('0xcb')]=function(_0x3cf44b){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0xcc'),_0x3cf44b[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x3cf44b[_0x6a44('0xb2')])){return this['channel'][_0x6a44('0xaf')](_0x6a44('0xb3'));}var _0xcdea65=_0x3cf44b['grammar'];if(this[_0x6a44('0xae')](_0x3cf44b[_0x6a44('0x78')])){_0xcdea65+=','+_0x3cf44b[_0x6a44('0x78')];}var _0x2729bd=this['channel'][_0x6a44('0x55')](_0x6a44('0xcd'),_0xcdea65);if(_0x2729bd[_0x6a44('0xa8')]===-0x1){return _0x2729bd;}var _0x5ad184=this['getAndSetVariable']('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5ad184[_0x6a44('0xa8')]===-0x1){return _0x5ad184;}var _0xb25345=this[_0x6a44('0xa7')]('RECOG_INPUT()',_0x6a44('0xce'));if(_0xb25345[_0x6a44('0xa8')]===-0x1){return _0xb25345;}var _0x18ec71=this['getAndSetVariable'](_0x6a44('0xcf'),_0x6a44('0xd0'));if(_0x18ec71[_0x6a44('0xa8')]===-0x1){return _0x18ec71;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util['format'](_0x6a44('0xb8'),_0xcdea65));};AGIVertices['prototype'][_0x6a44('0xd1')]=function(_0xf0e12e){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0xd2'),_0xf0e12e[_0x6a44('0x36')]));if(!this['isConfigured'](_0xf0e12e[_0x6a44('0xb2')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xb3'));}var _0x3086a6=_0xf0e12e['grammar'];if(this['isConfigured'](_0xf0e12e[_0x6a44('0x78')])){_0x3086a6+=','+_0xf0e12e[_0x6a44('0x78')];}var _0x36df5b=this[_0x6a44('0xe')][_0x6a44('0x55')](_0x6a44('0xcd'),_0x3086a6);if(_0x36df5b['result']===-0x1){return _0x36df5b;}var _0x48ad9c=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x48ad9c['result']===-0x1){return _0x48ad9c;}var _0x5f326d=this[_0x6a44('0xa7')](_0x6a44('0xb5'),'SESTEK_ASR_TRANSCRIPT');if(_0x5f326d['result']===-0x1){return _0x5f326d;}var _0x26d0c8=this[_0x6a44('0xa7')](_0x6a44('0xcf'),'SESTEK_ASR_INSTANCE');if(_0x26d0c8['result']===-0x1){return _0x26d0c8;}return this['channel'][_0x6a44('0xaf')](util['format'](_0x6a44('0xb8'),_0x3086a6));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xd3')]=function(_0x1bdb71){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0xd4'),_0x1bdb71['label']));if(!this[_0x6a44('0xae')](_0x1bdb71[_0x6a44('0xd5')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x1bdb71,_0x6a44('0xd6'));}var _0x16f09d=this['getSquareOdbc'][_0x6a44('0x6f')](this,_0x1bdb71['odbc_id']);if(!_0x16f09d){return this['channel'][_0x6a44('0x2c')](_0x1bdb71,_0x6a44('0xd7'));}if(!this[_0x6a44('0xae')](_0x1bdb71[_0x6a44('0xd8')])){return this['channel']['error'](_0x1bdb71,'no\x20query\x20configured');}var _0x2528f6=_0x1bdb71['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xd9'),_0x2528f6));var _0x257856=this[_0x6a44('0x2b')][_0x6a44('0x6f')](this,_0x16f09d,_0x2528f6);this[_0x6a44('0x34')]['sync'](this,_0x1bdb71,_0x2528f6);if(!this['isConfigured'](_0x1bdb71[_0x6a44('0xda')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xdb'));}var _0x654e76=this[_0x6a44('0x12')][_0x6a44('0x6f')](this,_0x1bdb71[_0x6a44('0xda')]);if(!_0x654e76){return this[_0x6a44('0xe')]['error'](_0x1bdb71,_0x6a44('0xdc'));}var _0x529372=this;_0x257856[_0x6a44('0xdd')](function(_0x42f19c,_0x425198){Object[_0x6a44('0xde')](_0x42f19c)['forEach'](function(_0x162cff){_0x529372[_0x6a44('0xe')]['setVariable'](util[_0x6a44('0xa0')](_0x6a44('0xdf'),_0x654e76,_0x425198,_0x162cff),_0x42f19c[_0x162cff]);});});this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0xe0'),_0x654e76),_0x257856['length']);return this['channel'][_0x6a44('0xaf')](util['format'](_0x6a44('0xe1'),_0x654e76));};AGIVertices['prototype'][_0x6a44('0xe2')]=function(_0x4bb2bf){logger[_0x6a44('0xe3')](util[_0x6a44('0xa0')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4bb2bf[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x4bb2bf[_0x6a44('0xe4')])){return this[_0x6a44('0xe')]['error'](_0x4bb2bf,_0x6a44('0xe5'));}var _0x3d86da=this[_0x6a44('0x1d')]['sync'](this,_0x4bb2bf[_0x6a44('0xe4')]);if(!_0x3d86da){return this[_0x6a44('0xe')]['error'](_0x4bb2bf,_0x6a44('0xe6'));}var _0x7360e8=this['channel'][_0x6a44('0x55')](_0x6a44('0xe7'),[util[_0x6a44('0xa0')](_0x6a44('0xe8'),_0x3d86da),_0x4bb2bf[_0x6a44('0x65')],_0x4bb2bf[_0x6a44('0xe9')],_0x4bb2bf[_0x6a44('0x64')]]);if(_0x7360e8[_0x6a44('0xa8')]===-0x1){return _0x7360e8;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xea'),_0x6a44('0xe7')));};AGIVertices['prototype'][_0x6a44('0xeb')]=function(_0x3d242c){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0xec'),_0x3d242c[_0x6a44('0x36')]));if(!this['isConfigured'](_0x3d242c[_0x6a44('0x7a')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xed'));}if(!this[_0x6a44('0xae')](_0x3d242c['text'])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xee'));}this[_0x6a44('0xe')][_0x6a44('0xef')]=!![];this[_0x6a44('0x34')](_0x3d242c);this['createSquareMessage'](_0x3d242c[_0x6a44('0x5b')],'in','','');this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xf0'),_0x3d242c[_0x6a44('0x5b')]));var _0x2eb90c=this['googleDialogflow']['sync'](this,_0x3d242c);if(_0x2eb90c){for(var _0x5d1a65 in _0x2eb90c){if(_0x2eb90c[_0x6a44('0x9b')](_0x5d1a65)){this[_0x6a44('0xe')]['setVariable'](util['format'](_0x6a44('0xf1'),_0x5d1a65[_0x6a44('0x69')]()),_0x2eb90c[_0x5d1a65]);}}this[_0x6a44('0x40')](_0x2eb90c['speech'],_0x6a44('0xf2'),'dialogflow','');return this['channel'][_0x6a44('0xaf')](util['format'](_0x6a44('0xf3'),_0x2eb90c['speech']));}return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x3d242c,_0x6a44('0xf4'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xf5')]=function(_0x1827b7){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1827b7['label']));if(!this[_0x6a44('0xae')](_0x1827b7['dialogflowV2_project_id'])){return this[_0x6a44('0xe')][_0x6a44('0xaf')]('no\x20project_id\x20configured');}if(!this[_0x6a44('0xae')](_0x1827b7[_0x6a44('0xf6')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xf7'));}if(!this[_0x6a44('0xae')](_0x1827b7[_0x6a44('0x7e')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xf8'));}if(!this['isConfigured'](_0x1827b7[_0x6a44('0xf9')])){return this['channel'][_0x6a44('0xaf')](_0x6a44('0xfa'));}if(!this[_0x6a44('0xae')](_0x1827b7[_0x6a44('0x5b')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')]('no\x20text\x20configured');}this[_0x6a44('0xe')][_0x6a44('0xef')]=!![];this[_0x6a44('0x34')](_0x1827b7);this[_0x6a44('0x40')](_0x1827b7[_0x6a44('0x5b')],'in','','');this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xfb'),_0x1827b7[_0x6a44('0x5b')]));var _0x4142ae=this['googleDialogflowV2'][_0x6a44('0x6f')](this,_0x1827b7);if(_0x4142ae){for(var _0x58938b in _0x4142ae){if(_0x4142ae[_0x6a44('0x9b')](_0x58938b)){if(_0x58938b!=='providerResponse'){this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0xf1'),_0x58938b[_0x6a44('0x69')]()),_0x4142ae[_0x58938b]);}}}this[_0x6a44('0x40')](_0x4142ae[_0x6a44('0xfc')],_0x6a44('0xf2'),'dialogflowV2',_0x4142ae['providerResponse']);return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xfd'),_0x4142ae[_0x6a44('0xfc')]));}return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x1827b7,_0x6a44('0xfe'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xff')]=function(_0x18b9ca){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x18b9ca[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x18b9ca[_0x6a44('0x100')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x101'));}if(!this[_0x6a44('0xae')](_0x18b9ca[_0x6a44('0x102')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0x103'));}if(!this[_0x6a44('0xae')](_0x18b9ca[_0x6a44('0x104')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x105'));}if(!this[_0x6a44('0xae')](_0x18b9ca['ndassistant_url'])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xee'));}this[_0x6a44('0xe')][_0x6a44('0xef')]=!![];this[_0x6a44('0x34')](_0x18b9ca);this[_0x6a44('0x40')](_0x18b9ca['text'],'in','','');this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x106'),_0x18b9ca[_0x6a44('0x5b')]));var _0x4cc5bb=this[_0x6a44('0x7f')][_0x6a44('0x6f')](this,_0x18b9ca);if(_0x4cc5bb){for(var _0x3bcbbd in _0x4cc5bb){if(_0x4cc5bb[_0x6a44('0x9b')](_0x3bcbbd)){this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')]('SESTEK_NDA_%s',_0x3bcbbd[_0x6a44('0x69')]()),_0x4cc5bb[_0x3bcbbd]);}}this[_0x6a44('0x40')](_0x4cc5bb[_0x6a44('0xfc')],'out',_0x6a44('0xff'),'');if(_0x4cc5bb['audiofile']){this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x107'),_0x4cc5bb[_0x6a44('0x108')]));var _0x1275f8=this[_0x6a44('0xe')]['streamFile'](_0x4cc5bb[_0x6a44('0x108')]);try{fs[_0x6a44('0x109')](_0x4cc5bb[_0x6a44('0x108')]+_0x6a44('0x10a'));}catch(_0x10e3b2){logger[_0x6a44('0x2c')](_0x10e3b2);}return _0x1275f8;}else{return this['channel'][_0x6a44('0xaf')](util['format'](_0x6a44('0x10b'),_0x4cc5bb[_0x6a44('0xfc')]));}}return this[_0x6a44('0xe')]['error'](_0x18b9ca,_0x6a44('0x10c'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x10d')]=function(_0x32b666){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x10e'),_0x32b666[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x10d'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x10f')]=function(_0x19cc12){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x110'),_0x19cc12[_0x6a44('0x36')]));var _0x495d99='';if(_0x19cc12[_0x6a44('0x111')]){if(!this[_0x6a44('0xae')](_0x19cc12['trunk_id'])){return this['channel'][_0x6a44('0x2c')](_0x19cc12,_0x6a44('0x112'));}else{var _0x28cae3=parseInt(_0x19cc12['trunk_id'],0xa);if(isNaN(_0x28cae3)){_0x495d99=_0x19cc12['trunk_id'];}else{_0x495d99=this[_0x6a44('0x1f')][_0x6a44('0x6f')](this,_0x19cc12[_0x6a44('0x111')]);if(!_0x495d99){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x19cc12,_0x6a44('0x113'));}}}}else if(_0x19cc12[_0x6a44('0x114')]){_0x495d99=_0x19cc12[_0x6a44('0x114')];}else{return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x19cc12,'no\x20trunk\x20selected');}var _0x1c5763=this[_0x6a44('0xe')][_0x6a44('0x55')]('DIAL',[util['format'](_0x6a44('0x115'),_0x495d99,_0x19cc12[_0x6a44('0x46')]),_0x19cc12['timeout'],_0x19cc12[_0x6a44('0xe9')],_0x19cc12[_0x6a44('0x64')]]);if(_0x1c5763[_0x6a44('0xa8')]===-0x1){return _0x1c5763;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xea'),_0x6a44('0xe7')));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x116')]=function(_0x586a3d){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x586a3d[_0x6a44('0x36')]));return this[_0x6a44('0xe')]['noop'](_0x6a44('0x116'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0xc')]=function(_0x5766c2){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x117'),_0x5766c2[_0x6a44('0x36')]));if(_0x5766c2[_0x6a44('0xab')]===0x0){return this[_0x6a44('0xaa')](_0x5766c2);}_0x5766c2[_0x6a44('0xab')]-=0x1;if(!this[_0x6a44('0xae')](_0x5766c2['file_id'])){return this[_0x6a44('0xe')]['error'](_0x5766c2,_0x6a44('0x118'));}var _0x7eba4a=this['getSound'][_0x6a44('0x6f')](this,_0x5766c2[_0x6a44('0x119')]);if(!_0x7eba4a){return this[_0x6a44('0xe')]['error'](_0x5766c2,'no\x20file\x20audio\x20found');}if(!this[_0x6a44('0xae')](_0x5766c2['variable_id'])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x6a44('0xdb'));}var _0x42c01c=this[_0x6a44('0xe')][_0x6a44('0x11a')](_0x7eba4a,_0x5766c2['response'],_0x5766c2['maxdigit']);var _0x288187=_0x42c01c[_0x6a44('0xa8')]?_0x42c01c[_0x6a44('0xa8')][_0x6a44('0x4b')]():'';logger[_0x6a44('0x2e')](_0x6a44('0x11b'),JSON[_0x6a44('0x74')](_0x42c01c));if(_0x42c01c[_0x6a44('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x6a44('0x6f')](this,_0x5766c2,_0x288187);return _0x42c01c;}else if(_0x42c01c[_0x6a44('0xa6')]==='timeout'){_0x42c01c['result']=_0x288187[_0x6a44('0xa4')]>=parseInt(_0x5766c2['mindigit'])?'x':'i';}else{_0x42c01c[_0x6a44('0xa8')]=_0x288187[_0x6a44('0xa4')]>=parseInt(_0x5766c2[_0x6a44('0x11c')])&&_0x288187[_0x6a44('0xa4')]<=parseInt(_0x5766c2[_0x6a44('0x11d')])?'x':'i';}var _0x429155=this[_0x6a44('0x12')][_0x6a44('0x6f')](this,_0x5766c2[_0x6a44('0xda')]);if(!_0x429155){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x5766c2,_0x6a44('0xdc'));}this['channel'][_0x6a44('0xa2')](_0x429155,_0x288187);if(this[_0x6a44('0xae')](_0x5766c2['hiddendigitsnum'])){var _0x4ce291=parseInt(_0x5766c2[_0x6a44('0x11e')],0xa);var _0x648f81=rs['generate']({'charset':'*','length':_0x4ce291});var _0x12785b=_0x288187['length'];if(_0x12785b>0x0){if(_0x12785b>_0x4ce291){this['createSquareDetailsReport'][_0x6a44('0x6f')](this,_0x5766c2,_0x5766c2['hiddendigitspos']==='first'?_0x648f81+_0x288187['substr'](_0x4ce291):_0x288187[_0x6a44('0x11f')](0x0,_0x12785b-_0x4ce291)+_0x648f81);}else{this[_0x6a44('0x34')]['sync'](this,_0x5766c2,rs[_0x6a44('0x120')]({'charset':'*','length':_0x12785b}));}}else{this[_0x6a44('0x34')][_0x6a44('0x6f')](this,_0x5766c2,'');}}else{this['createSquareDetailsReport'][_0x6a44('0x6f')](this,_0x5766c2,_0x288187);}return _0x42c01c;};AGIVertices[_0x6a44('0x11')][_0x6a44('0xd')]=function(_0x4b0b04){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x121'),_0x4b0b04[_0x6a44('0x36')]));return this[_0x6a44('0xc')](_0x4b0b04);};AGIVertices[_0x6a44('0x11')]['goal']=function(_0x1f4d01){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1f4d01[_0x6a44('0x36')]));this[_0x6a44('0x34')]['sync'](this,_0x1f4d01,_0x1f4d01[_0x6a44('0x122')]);return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x123'),_0x1f4d01[_0x6a44('0x122')]));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x124')]=function(_0x5097f5){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x125'),_0x5097f5[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x5097f5[_0x6a44('0x88')])||!this[_0x6a44('0xae')](_0x5097f5['aws_secret_access_key'])){return this[_0x6a44('0xe')][_0x6a44('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x6a44('0xae')](_0x5097f5[_0x6a44('0x5b')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xee'));}this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')]('Trying\x20aws\x20Polly\x20%s',_0x5097f5[_0x6a44('0x5b')]));var _0x4635a1=this[_0x6a44('0x87')][_0x6a44('0x6f')](this,_0x5097f5);if(_0x4635a1){this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x126'),_0x4635a1));var _0x8a20e4=this[_0x6a44('0xe')][_0x6a44('0x127')](_0x4635a1);try{fs[_0x6a44('0x109')](_0x4635a1+'.wav');}catch(_0xba881e){logger[_0x6a44('0x2c')](_0xba881e);}return _0x8a20e4;}return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x5097f5,_0x6a44('0x128'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x129')]=function(_0x5333a0){logger['info'](util[_0x6a44('0xa0')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5333a0['label']));if(!this['isConfigured'](_0x5333a0[_0x6a44('0x88')])||!this[_0x6a44('0xae')](_0x5333a0['aws_secret_access_key'])){return this[_0x6a44('0xe')][_0x6a44('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x6a44('0xae')](_0x5333a0['aws_bot_name'])){return this[_0x6a44('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x6a44('0xae')](_0x5333a0['text'])){return this['channel']['noop'](_0x6a44('0xee'));}this['channel'][_0x6a44('0xef')]=!![];this[_0x6a44('0x34')](_0x5333a0);this[_0x6a44('0x40')](_0x5333a0['text'],'in','','');this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x12a'),_0x5333a0['text']));var _0x316559=this[_0x6a44('0x8e')][_0x6a44('0x6f')](this,_0x5333a0);if(_0x316559){for(var _0x14792d in _0x316559){if(_0x316559[_0x6a44('0x9b')](_0x14792d)&&_[_0x6a44('0x98')](_0x316559[_0x14792d])){this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')]('AWS_LEX_%s',_0x14792d[_0x6a44('0x69')]()),_0x316559[_0x14792d]);}}if(_[_0x6a44('0x44')](_0x316559[_0x6a44('0x77')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x6a44('0x40')](_0x316559[_0x6a44('0x77')],'out',_0x6a44('0x12b'),'');return this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')]('Amazon\x20Lex\x20Result\x20%s',_0x316559['message']));}}return this[_0x6a44('0xe')]['error'](_0x5333a0,_0x6a44('0x12c'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x12d')]=function(_0x31fe25){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x31fe25[_0x6a44('0x36')],_0x31fe25['timeout']));if(!this['isConfigured'](_0x31fe25[_0x6a44('0x7a')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xed'));}var _0x35a320=_0x6a44('0x12e');var _0x28f4c3=util[_0x6a44('0xa0')](_0x6a44('0x12f'),FILES_PATH,rs[_0x6a44('0x120')](0x4));var _0x3ed55c=util[_0x6a44('0xa0')](_0x6a44('0xa1'),_0x28f4c3,_0x35a320);var _0x208a73=!![];if(_0x31fe25[_0x6a44('0x130')]===_0x6a44('0x131')){_0x208a73=![];}var _0x5ef5d2=this[_0x6a44('0xe')][_0x6a44('0x132')](_0x28f4c3,_0x35a320,_0x31fe25['intKey'],_0x31fe25[_0x6a44('0x65')],undefined,_0x208a73);if(_0x5ef5d2[_0x6a44('0xa8')]!==-0x1){this[_0x6a44('0xe')]['noop'](util[_0x6a44('0xa0')](_0x6a44('0x133'),_0x3ed55c));var _0x381cfa=this[_0x6a44('0x91')][_0x6a44('0x6f')](this,_0x31fe25,_0x3ed55c);if(_0x381cfa){for(var _0x49b318 in _0x381cfa){if(_0x381cfa[_0x6a44('0x9b')](_0x49b318)){this[_0x6a44('0xe')]['setVariable'](util[_0x6a44('0xa0')](_0x6a44('0x134'),_0x49b318['toUpperCase']()),_0x381cfa[_0x49b318]);}}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x135'),JSON[_0x6a44('0x74')](_0x381cfa)));}}return _0x5ef5d2;};AGIVertices[_0x6a44('0x11')][_0x6a44('0x136')]=function(_0xf8568){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x137'),_0xf8568['label']));if(!this[_0x6a44('0xae')](_0xf8568[_0x6a44('0x94')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x138'));}if(!this[_0x6a44('0xae')](_0xf8568[_0x6a44('0x139')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x13a'));}var _0x17e2c6=_0x6a44('0x12e');var _0x221531=util['format'](_0x6a44('0x12f'),FILES_PATH,rs[_0x6a44('0x120')](0x4));var _0x14ed3d=util[_0x6a44('0xa0')](_0x6a44('0xa1'),_0x221531,_0x17e2c6);var _0xfe4304=!![];if(_0xf8568[_0x6a44('0x130')]==='NOBEEP'){_0xfe4304=![];}var _0x2f9f1e=this[_0x6a44('0xe')]['recordFile'](_0x221531,_0x17e2c6,_0xf8568[_0x6a44('0x13b')],_0xf8568[_0x6a44('0x65')],undefined,_0xfe4304);if(_0x2f9f1e['result']!==-0x1){this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x13c'),_0x14ed3d));var _0x3cc03a=this[_0x6a44('0x93')]['sync'](this,_0xf8568,_0x14ed3d);if(_0x3cc03a){for(var _0x10b4a9 in _0x3cc03a){if(_0x3cc03a['hasOwnProperty'](_0x10b4a9)){this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0x13d'),_0x10b4a9['toUpperCase']()),_0x3cc03a[_0x10b4a9]);}}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x13e'),JSON[_0x6a44('0x74')](_0x3cc03a)));}}return _0x2f9f1e;};AGIVertices['prototype'][_0x6a44('0x13f')]=function(_0x94a880){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x140'),_0x94a880[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0x141')](_0x94a880['context'],_0x94a880['extension'],_0x94a880[_0x6a44('0x3d')]);};AGIVertices[_0x6a44('0x11')]['gotoif']=function(_0x8ca8bb){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x142'),_0x8ca8bb[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x8ca8bb[_0x6a44('0x143')])){return this[_0x6a44('0xe')]['error'](_0x8ca8bb,_0x6a44('0x144'));}try{var _0x28ff4c=eval(_0x8ca8bb['condition'])?_0x6a44('0x145'):'false';this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x146'),_0x8ca8bb[_0x6a44('0x143')],_0x28ff4c));return{'code':0xc8,'result':_0x28ff4c};}catch(_0x3a5471){return{'code':0xc8,'result':_0x6a44('0x147')};}};AGIVertices['prototype']['gotoiftime']=function(_0x3fa032){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x148'),_0x3fa032[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x3fa032[_0x6a44('0x149')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x3fa032,_0x6a44('0x14a'));}var _0x524eb3=this['getIntervals'][_0x6a44('0x6f')](this,_0x3fa032[_0x6a44('0x149')]);if(!_0x524eb3){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x3fa032,_0x6a44('0x14b'));}for(var _0x41f08b=0x0;_0x41f08b<_0x524eb3[_0x6a44('0xa4')];_0x41f08b+=0x1){var _0x11fb94=this[_0x6a44('0xe')]['getVariable'](util['format'](_0x6a44('0x14c'),_0x524eb3[_0x41f08b]));if(_0x11fb94[_0x6a44('0xa8')]===-0x1){return _0x11fb94;}logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x14d'),_0x524eb3[_0x41f08b],_0x11fb94[_0x6a44('0xa6')]));if(_0x11fb94['extra']===_0x6a44('0x145')){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x14d'),_0x524eb3[_0x41f08b],_0x6a44('0x145')));this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x14d'),_0x524eb3[_0x41f08b],_0x6a44('0x145')));return{'code':0xc8,'result':_0x6a44('0x145')};}else{logger['info'](util['format'](_0x6a44('0x14d'),_0x524eb3[_0x41f08b],_0x6a44('0x147')));this[_0x6a44('0xe')][_0x6a44('0xaf')](util['format'](_0x6a44('0x14d'),_0x524eb3[_0x41f08b],'false'));}}return{'code':0xc8,'result':_0x6a44('0x147')};};AGIVertices['prototype'][_0x6a44('0x14e')]=function(_0x5b0ba2){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x14f'),_0x5b0ba2[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0x14e')]();};AGIVertices[_0x6a44('0x11')][_0x6a44('0x150')]=function(_0x241e8b){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x151'),_0x241e8b['label']));if(!this['isConfigured'](_0x241e8b[_0x6a44('0x7a')])){return this['channel'][_0x6a44('0xaf')](_0x6a44('0xed'));}var _0x5eefe3=_0x6a44('0x12e');var _0x36ad42=util[_0x6a44('0xa0')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x197c32=util['format'](_0x6a44('0xa1'),_0x36ad42,_0x5eefe3);var _0x4dfb39=!![];if(_0x241e8b['beep']==='NOBEEP'){_0x4dfb39=![];}var _0x1e858a=this['channel']['recordFile'](_0x36ad42,_0x5eefe3,_0x241e8b[_0x6a44('0x13b')],_0x241e8b[_0x6a44('0x65')],undefined,_0x4dfb39);if(_0x1e858a[_0x6a44('0xa8')]!==-0x1){this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')]('ispeech\x20%s\x20file\x20created',_0x197c32));var _0x56a9fb=this[_0x6a44('0x84')]['sync'](this,_0x241e8b,_0x197c32);if(_0x56a9fb){for(var _0x55f808 in _0x56a9fb){if(_0x56a9fb['hasOwnProperty'](_0x55f808)){this[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0x152'),_0x55f808[_0x6a44('0x69')]()),_0x56a9fb[_0x55f808]);}}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x153'),JSON[_0x6a44('0x74')](_0x56a9fb)));}}return _0x1e858a;};AGIVertices[_0x6a44('0x11')][_0x6a44('0x154')]=function(_0x45add5){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x155'),_0x45add5[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x45add5[_0x6a44('0x7a')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xed'));}if(!this['isConfigured'](_0x45add5['text'])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xee'));}this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x156'),_0x45add5[_0x6a44('0x5b')]));var _0x5de308=this[_0x6a44('0x80')]['sync'](this,_0x45add5);if(_0x5de308){this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')]('ispeech\x20%s\x20file\x20created',_0x5de308));var _0x587831=this['channel'][_0x6a44('0x127')](_0x5de308,_0x45add5['intKey']);try{fs['unlink'](_0x5de308+'.wav');}catch(_0x3b1295){logger[_0x6a44('0x2c')](_0x3b1295);}return _0x587831;}return this[_0x6a44('0xe')]['error'](_0x45add5,_0x6a44('0x157'));};AGIVertices['prototype'][_0x6a44('0x158')]=function(_0x3f2a68){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x159'),_0x3f2a68[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x3f2a68[_0x6a44('0x15a')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x3f2a68,_0x6a44('0x15b'));}logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6a44('0xe')][_0x6a44('0x39')],_0x3f2a68['findBy']));var _0x27dbb7=this[_0x6a44('0x51')][_0x6a44('0x6f')](this,_0x3f2a68[_0x6a44('0x15a')]);if(_0x27dbb7){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a44('0xe')][_0x6a44('0x39')],_0x3f2a68[_0x6a44('0x15a')]));this[_0x6a44('0xe')][_0x6a44('0xaf')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a44('0xe')][_0x6a44('0x39')],_0x3f2a68[_0x6a44('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x6a44('0x15c'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x3f2a68[_0x6a44('0x15a')]));this['channel']['noop'](util['format'](_0x6a44('0x15c'),this['channel']['callerid'],_0x3f2a68['findBy']));return{'code':0xc8,'result':_0x6a44('0x15d')};}};AGIVertices['prototype'][_0x6a44('0x15e')]=function(_0x51c889){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x15f'),_0x51c889[_0x6a44('0x36')]));if(!this['isConfigured'](_0x51c889[_0x6a44('0x15a')])){return this['channel'][_0x6a44('0x2c')](_0x51c889,_0x6a44('0x15b'));}logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x160'),this[_0x6a44('0xe')]['callerid'],_0x51c889['findBy']));var _0x2eb8fc=this[_0x6a44('0x50')][_0x6a44('0x6f')](this,_0x51c889[_0x6a44('0x15a')]);if(_0x2eb8fc){logger['info'](util[_0x6a44('0xa0')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a44('0xe')]['callerid'],_0x51c889[_0x6a44('0x15a')]));this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x161'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x51c889[_0x6a44('0x15a')]));return{'code':0xc8,'result':_0x6a44('0x162')};}else{logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x6a44('0x39')],_0x51c889[_0x6a44('0x15a')]));this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x15c'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x51c889['findBy']));return{'code':0xc8,'result':_0x6a44('0x15d')};}};AGIVertices[_0x6a44('0x11')][_0x6a44('0x163')]=function(_0x424b7f){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x424b7f[_0x6a44('0x36')]));if(!this['isConfigured'](_0x424b7f[_0x6a44('0x164')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x424b7f,_0x6a44('0x165'));}this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x166'),_0x424b7f[_0x6a44('0x164')]));var _0x24c634=eval(_0x424b7f[_0x6a44('0x164')]);if(!this['isConfigured'](_0x424b7f[_0x6a44('0xda')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xdb'));}var _0x2de371=this['getVariable'][_0x6a44('0x6f')](this,_0x424b7f[_0x6a44('0xda')]);if(!_0x2de371){return this[_0x6a44('0xe')]['error'](_0x424b7f,_0x6a44('0xdc'));}if(_[_0x6a44('0x9d')](_0x24c634)){var _0x27cd3a=this;_0x24c634['forEach'](function(_0x22fa8f,_0x2724ac){_0x27cd3a[_0x6a44('0xe')][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0x167'),_0x2de371,_0x2724ac),_0x22fa8f);});return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x168'),_0x2de371));}else{return this[_0x6a44('0xe')][_0x6a44('0xa2')](_0x2de371,_0x24c634);}};AGIVertices[_0x6a44('0x11')]['menu']=function(_0x72a35f){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x72a35f[_0x6a44('0x36')]));if(_0x72a35f['retry']===0x0){return this[_0x6a44('0xaa')](_0x72a35f);}_0x72a35f['retry']-=0x1;if(!this['isConfigured'](_0x72a35f[_0x6a44('0x119')])){return this[_0x6a44('0xe')]['error'](_0x72a35f,_0x6a44('0x118'));}var _0x4154f4=this[_0x6a44('0x21')][_0x6a44('0x6f')](this,_0x72a35f[_0x6a44('0x119')]);if(!_0x4154f4){return this['channel']['error'](_0x72a35f,_0x6a44('0x169'));}var _0x3eb63a=this[_0x6a44('0xe')][_0x6a44('0x11a')](_0x4154f4,_0x72a35f[_0x6a44('0x16a')],_0x72a35f[_0x6a44('0x16b')]);var _0x5325cf=_0x3eb63a[_0x6a44('0xa8')];if(_0x3eb63a[_0x6a44('0xa8')]===-0x1){this[_0x6a44('0x34')]['sync'](this,_0x72a35f,'-1');return _0x3eb63a;}else if(_0x3eb63a[_0x6a44('0xa6')]===_0x6a44('0x65')){_0x3eb63a[_0x6a44('0xa8')]=_0x3eb63a[_0x6a44('0xa8')][_0x6a44('0xa4')]>0x0?_0x3eb63a[_0x6a44('0xa8')]:'t';}else if(_[_0x6a44('0x43')](_0x3eb63a['result'])){_0x3eb63a['result']='#';_0x5325cf='#';}if(!this[_0x6a44('0xae')](_0x72a35f[_0x6a44('0xda')])){this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0xdb'));}else{var _0x3c70ca=this['getVariable'][_0x6a44('0x6f')](this,_0x72a35f[_0x6a44('0xda')]);if(!_0x3c70ca){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x72a35f,'no\x20variable\x20found');}this['channel']['setVariable'](_0x3c70ca,_0x5325cf);}this['createSquareDetailsReport'][_0x6a44('0x6f')](this,_0x72a35f,_0x5325cf);return _0x3eb63a;};AGIVertices[_0x6a44('0x11')][_0x6a44('0xaf')]=function(_0x507e50){logger['info'](util[_0x6a44('0xa0')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x507e50[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x507e50[_0x6a44('0x16c')]||_0x507e50['label']);};AGIVertices[_0x6a44('0x11')][_0x6a44('0x16d')]=function(_0x14ddd3){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x16e'),_0x14ddd3[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x14ddd3['findBy'])){return this['channel']['error'](_0x14ddd3,_0x6a44('0x15b'));}logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x160'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x14ddd3[_0x6a44('0x15a')]));var _0xa49d50=this['getPause'][_0x6a44('0x6f')](this,_0x14ddd3[_0x6a44('0x16f')]);var _0x3b44a7=this[_0x6a44('0x4d')]['sync'](this,_0x14ddd3[_0x6a44('0x15a')],_0xa49d50);if(_0x3b44a7){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x161'),this['channel'][_0x6a44('0x39')],_0x14ddd3[_0x6a44('0x15a')]));this[_0x6a44('0xe')]['noop'](util[_0x6a44('0xa0')](_0x6a44('0x161'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x14ddd3[_0x6a44('0x15a')]));return{'code':0xc8,'result':_0x6a44('0x162')};}else{logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x15c'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x14ddd3['findBy']));this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x161'),this['channel'][_0x6a44('0x39')],_0x14ddd3[_0x6a44('0x15a')]));return{'code':0xc8,'result':_0x6a44('0x15d')};}};AGIVertices[_0x6a44('0x11')][_0x6a44('0x170')]=function(_0x2f9d70){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x171'),_0x2f9d70[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x2f9d70['file_id'])){return this['channel']['error'](_0x2f9d70,_0x6a44('0x118'));}var _0x53bdb1=this[_0x6a44('0x21')][_0x6a44('0x6f')](this,_0x2f9d70[_0x6a44('0x119')]);if(!_0x53bdb1){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x2f9d70,_0x6a44('0x169'));}var _0x2c8c1a=this[_0x6a44('0xe')]['exec']('PLAYBACK',[_0x53bdb1,_0x2f9d70[_0x6a44('0xe9')]]);if(_0x2c8c1a['result']===-0x1){return _0x2c8c1a;}return this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xc6'),_0x6a44('0x172'),_0x53bdb1));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x173')]=function(_0x461bd3){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x174'),_0x461bd3[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x461bd3['queue_id'])){return this[_0x6a44('0xe')]['error'](_0x461bd3,'no\x20queue\x20selected');}var _0x34af03='';var _0x229af6=parseInt(_0x461bd3[_0x6a44('0x175')],0xa);if(isNaN(_0x229af6)){_0x34af03=_0x461bd3['queue_id'];}else{_0x34af03=this[_0x6a44('0x17')]['sync'](this,_0x461bd3[_0x6a44('0x175')]);if(!_0x34af03){return this[_0x6a44('0xe')]['error'](_0x461bd3,_0x6a44('0x176'));}}var _0x19c410='';if(this[_0x6a44('0xae')](_0x461bd3['file_id'])){var _0x8cd0e1=this[_0x6a44('0x21')][_0x6a44('0x6f')](this,_0x461bd3[_0x6a44('0x119')]);if(_0x8cd0e1){_0x19c410=_0x8cd0e1;}}this[_0x6a44('0x34')]['sync'](this,_0x461bd3,_0x34af03);if(_0x461bd3['opts'][_0x6a44('0x177')]('x')<0x0){_0x461bd3[_0x6a44('0xe9')]+='x';}if(_0x461bd3[_0x6a44('0xe9')][_0x6a44('0x177')]('X')<0x0){_0x461bd3['opts']+='X';}this[_0x6a44('0xe')]['setVariable']('XMCS-QUEUE',_0x34af03?_0x34af03[_0x6a44('0x178')]():'');var _0xaf36b1=this[_0x6a44('0xe')][_0x6a44('0x55')](_0x6a44('0x179'),[_0x34af03,_0x461bd3[_0x6a44('0xe9')],_0x461bd3[_0x6a44('0x64')],_0x19c410,_0x461bd3['timeout'],_0x461bd3[_0x6a44('0x5')],_0x461bd3[_0x6a44('0x17a')],_0x461bd3['gosub'],'',_0x461bd3[_0x6a44('0x17b')]]);if(_0xaf36b1[_0x6a44('0xa8')]===-0x1){return _0xaf36b1;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xc6'),_0x6a44('0x179'),_0x34af03));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x17c')]=function(_0x44d95e){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x17d'),_0x44d95e[_0x6a44('0x36')]));var _0xcdfec6=_0x44d95e[_0x6a44('0x17e')]||_0x6a44('0x12e');var _0x515add=util['format']('%s_%s',this[_0x6a44('0xe')][_0x6a44('0x35')],rs[_0x6a44('0x120')](0x5));var _0x2f90d0=util[_0x6a44('0xa0')](_0x6a44('0x17f'),FILES_PATH,_0x515add,_0xcdfec6);var _0x20912d=util[_0x6a44('0xa0')](_0x6a44('0x12f'),FILES_PATH,_0x515add);this['createSquareRecording'][_0x6a44('0x6f')](this,_0x44d95e,_0x515add,_0x2f90d0);this['channel'][_0x6a44('0xa2')](_0x6a44('0x180'),_0x515add);logger[_0x6a44('0x2e')](_0x6a44('0x181'),_0x20912d,_0xcdfec6,_0x44d95e[_0x6a44('0x182')],_0x44d95e['timeout']);return this[_0x6a44('0xe')][_0x6a44('0x132')](_0x20912d,_0xcdfec6,_0x44d95e['escape_digits'],_0x44d95e[_0x6a44('0x65')],undefined,!![]);};AGIVertices['prototype'][_0x6a44('0x183')]=function(_0x5305ea){logger[_0x6a44('0x2e')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x5305ea[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x5305ea[_0x6a44('0x64')])){return this['channel']['noop'](_0x6a44('0x184'));}var _0x5ee5c5=this[_0x6a44('0x63')]['sync'](this,_0x5305ea);logger['info'](util['format'](_0x6a44('0x185'),util[_0x6a44('0x186')](_0x5ee5c5,{'showHidden':![],'depth':null})));if(!this[_0x6a44('0xae')](_0x5305ea[_0x6a44('0xda')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x187'));}var _0x5bfe7e=this[_0x6a44('0x12')]['sync'](this,_0x5305ea[_0x6a44('0xda')]);if(!_0x5bfe7e){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x5305ea,_0x6a44('0xdc'));}this['channel'][_0x6a44('0xa2')](util[_0x6a44('0xa0')](_0x6a44('0x188'),_0x5bfe7e),_0x5ee5c5['statusCode']?_0x5ee5c5[_0x6a44('0x75')]:_0x6a44('0x189'));this[_0x6a44('0xe')][_0x6a44('0xa2')](util['format']('%s_STATUS_MESSAGE',_0x5bfe7e),_0x5ee5c5['statusMessage']?_0x5ee5c5[_0x6a44('0x76')]:'OK');if(_0x5ee5c5[_0x6a44('0x73')]){try{this[_0x6a44('0x9f')](_0x5ee5c5[_0x6a44('0x73')],_0x5bfe7e);}catch(_0x57455b){logger[_0x6a44('0x2c')](util[_0x6a44('0xa0')](_0x6a44('0x18a'),_0x5bfe7e));}}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xe1'),_0x5bfe7e));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x18b')]=function(_0x597611){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x597611[_0x6a44('0x36')]));return this[_0x6a44('0xe')]['sayDigits'](_0x597611[_0x6a44('0x18c')][_0x6a44('0x57')](/\s+/g,''),_0x597611[_0x6a44('0x182')]);};AGIVertices[_0x6a44('0x11')][_0x6a44('0x18d')]=function(_0x44ac0c){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x18e'),_0x44ac0c['label']));return this[_0x6a44('0xe')][_0x6a44('0x18f')](_0x44ac0c[_0x6a44('0x190')][_0x6a44('0x57')](/\s+/g,''),_0x44ac0c['escape_digits']);};AGIVertices[_0x6a44('0x11')][_0x6a44('0x191')]=function(_0x44adb3){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x192'),_0x44adb3[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0x193')](_0x44adb3[_0x6a44('0x5b')],_0x44adb3[_0x6a44('0x182')]);};AGIVertices[_0x6a44('0x11')][_0x6a44('0x194')]=function(_0x2cd99b){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x195'),_0x2cd99b[_0x6a44('0x36')]));if(!this['isConfigured'](_0x2cd99b[_0x6a44('0x196')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0x197'));}var _0xbb2b92=this[_0x6a44('0x198')][_0x6a44('0x6f')](this,_0x2cd99b[_0x6a44('0x196')]);if(!_0xbb2b92||!_0xbb2b92[_0x6a44('0x199')]){return this['channel']['error'](_0x2cd99b,_0x6a44('0x19a'));}var _0x3c42f0={'from':util[_0x6a44('0xa0')](_0x6a44('0x19b'),_0xbb2b92[_0x6a44('0x15')],_0xbb2b92[_0x6a44('0x19c')]||_0xbb2b92[_0x6a44('0x199')]['user']),'to':_0x2cd99b['to']||'','cc':_0x2cd99b['cc']||'','bcc':_0x2cd99b[_0x6a44('0x19d')]||'','subject':_0x2cd99b[_0x6a44('0x19e')],'html':_0x2cd99b['text'],'text':_0x2cd99b[_0x6a44('0x5b')]};if(this[_0x6a44('0xae')](_0x2cd99b[_0x6a44('0x19f')])){}logger[_0x6a44('0xe3')](_0x6a44('0x1a0'),JSON[_0x6a44('0x74')](_0x3c42f0));this[_0x6a44('0x34')][_0x6a44('0x6f')](this,_0x2cd99b,_0x2cd99b['account_id']);this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1a1'),_0xbb2b92[_0x6a44('0x15')]));this[_0x6a44('0x1a2')][_0x6a44('0x6f')](this,_0xbb2b92[_0x6a44('0x1a3')],_0x3c42f0);return this['channel'][_0x6a44('0xaf')](_0x6a44('0x1a4'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1a5')]=function(_0x44dd70){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x1a6'),_0x44dd70[_0x6a44('0x36')]));return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x1a7'));};AGIVertices[_0x6a44('0x11')]['sendSMS']=function(_0x11bb5b){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x1a8'),_0x11bb5b[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x11bb5b[_0x6a44('0x1a9')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')]('no\x20sms\x20account\x20configured');}var _0x3ab371=this[_0x6a44('0x1aa')]['sync'](this,_0x11bb5b[_0x6a44('0x1a9')]);if(!_0x3ab371){return this[_0x6a44('0xe')]['error'](_0x11bb5b,_0x6a44('0x1ab'));}var _0x3e3c79={'body':_0x11bb5b[_0x6a44('0x1ac')],'phone':_0x11bb5b['to']||'','SmsAccountId':_0x3ab371['id']};logger['debug'](_0x6a44('0x1ad'),JSON['stringify'](_0x3e3c79));this[_0x6a44('0x34')][_0x6a44('0x6f')](this,_0x11bb5b,_0x11bb5b[_0x6a44('0x1a9')]);this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1ae'),_0x3ab371[_0x6a44('0x15')]));this['createSmsMessage'][_0x6a44('0x6f')](this,_0x3e3c79);return this[_0x6a44('0xe')][_0x6a44('0xaf')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1af')]=function(_0x2b3458){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x1b0'),_0x2b3458['label']));if(!this['isConfigured'](_0x2b3458[_0x6a44('0xda')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x2b3458,_0x6a44('0x1b1'));}var _0x4f6c9e=this['getVariable'][_0x6a44('0x6f')](this,_0x2b3458[_0x6a44('0xda')]);if(!_0x4f6c9e){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x2b3458,_0x6a44('0xdc'));}return this['channel'][_0x6a44('0xa2')](_0x4f6c9e,_0x2b3458[_0x6a44('0x1b2')]);};AGIVertices[_0x6a44('0x11')]['start']=function(_0xa4b621){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x1b3'),_0xa4b621['label']));this[_0x6a44('0xe')]['noop'](_0x6a44('0x1b4'));if(_0xa4b621['answer']===_0x6a44('0x1b5')){this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x1b6'));return this[_0x6a44('0xe')][_0x6a44('0xbc')]();}return this['channel'][_0x6a44('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x6a44('0x11')]['subproject']=function(_0x18591a){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x1b7'),_0x18591a['label']));if(!this[_0x6a44('0xae')](_0x18591a[_0x6a44('0x1b8')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x18591a,_0x6a44('0x1b9'));}var _0xc0e2ff=this[_0x6a44('0x19')][_0x6a44('0x6f')](this,_0x18591a[_0x6a44('0x1b8')]);if(!this[_0x6a44('0xae')](_0xc0e2ff)){return this['channel'][_0x6a44('0x2c')](_0x18591a,util[_0x6a44('0xa0')](_0x6a44('0x1ba'),_0x18591a['project_id']));}if(_0xc0e2ff===this[_0x6a44('0xe')][_0x6a44('0x37')]){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x18591a,_0x6a44('0x1bb'));}this[_0x6a44('0x34')][_0x6a44('0x6f')](this,_0x18591a,_0xc0e2ff);var _0xc0e4e0=this['channel'][_0x6a44('0x55')](_0x6a44('0x1bc'),util[_0x6a44('0xa0')](_0x6a44('0x1bd'),config[_0x6a44('0x5')][_0x6a44('0x1be')]||_0x6a44('0x1bf'),_0xc0e2ff,this[_0x6a44('0xe')][_0x6a44('0x37')]));if(_0xc0e4e0[_0x6a44('0xa8')]===-0x1){return _0xc0e4e0;}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0xc6'),_0x6a44('0x1bc'),_0xc0e2ff));};AGIVertices['prototype']['system']=function(_0x24db5a){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x1c0'),_0x24db5a[_0x6a44('0x36')]));var _0x3c28f5=this['shellCommand'][_0x6a44('0x6f')](this,_0x24db5a[_0x6a44('0xba')]);this[_0x6a44('0x34')]['sync'](this,_0x24db5a,_0x24db5a[_0x6a44('0xba')]);if(this[_0x6a44('0xae')](_0x24db5a[_0x6a44('0xda')])){var _0x33501b=this[_0x6a44('0x12')][_0x6a44('0x6f')](this,_0x24db5a[_0x6a44('0xda')]);if(_0x33501b){this['channel'][_0x6a44('0xa2')](_0x33501b,_0x3c28f5);return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1c1'),_0x24db5a[_0x6a44('0xba')],_0x33501b));}}return this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1c2'),_0x24db5a[_0x6a44('0xba')]));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1c3')]=function(_0x828235){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x1c4'),_0x828235['label']));_0x828235[_0x6a44('0x5b')]=_0x828235[_0x6a44('0x5b')][_0x6a44('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a44('0xae')](_0x828235[_0x6a44('0x59')])){return this[_0x6a44('0xe')][_0x6a44('0xaf')](_0x6a44('0x1c5'));}if(!this[_0x6a44('0xae')](_0x828235['text'])){return this['channel']['noop'](_0x6a44('0xee'));}this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1c6'),_0x828235[_0x6a44('0x5b')]));var _0x36881e=this['googleCloudTTS'][_0x6a44('0x6f')](this,_0x828235);if(_0x36881e){this[_0x6a44('0xe')][_0x6a44('0xaf')](util[_0x6a44('0xa0')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x36881e));var _0x4f84e2=this[_0x6a44('0xe')]['streamFile'](_0x36881e);try{fs[_0x6a44('0x109')](_0x36881e+'.wav');}catch(_0x51db4c){logger[_0x6a44('0x2c')](_0x51db4c);}return _0x4f84e2;}return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x828235,_0x6a44('0x1c7'));};AGIVertices['prototype'][_0x6a44('0x1c8')]=function(_0x518cd6){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x1c9'),_0x518cd6[_0x6a44('0x36')]));_0x518cd6[_0x6a44('0x5b')]=_0x518cd6[_0x6a44('0x5b')][_0x6a44('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a44('0xae')](_0x518cd6[_0x6a44('0x5b')])){return this[_0x6a44('0xe')]['noop'](_0x6a44('0xee'));}this[_0x6a44('0xe')]['noop'](util[_0x6a44('0xa0')](_0x6a44('0x1ca'),_0x518cd6['text']));var _0xaa0e32=this['googleTTS'][_0x6a44('0x6f')](this,_0x518cd6);if(_0xaa0e32){this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x1cb'),_0xaa0e32));var _0x5dae93=this[_0x6a44('0xe')][_0x6a44('0x127')](_0xaa0e32);try{fs['unlink'](_0xaa0e32+'.wav');}catch(_0x23bc37){logger['error'](_0x23bc37);}return _0x5dae93;}return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x518cd6,_0x6a44('0x1cc'));};AGIVertices[_0x6a44('0x11')][_0x6a44('0x1cd')]=function(_0x5a36fb){logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')](_0x6a44('0x1ce'),_0x5a36fb[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x5a36fb[_0x6a44('0x15a')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x5a36fb,_0x6a44('0x15b'));}logger[_0x6a44('0x2e')](util[_0x6a44('0xa0')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6a44('0xe')][_0x6a44('0x39')],_0x5a36fb[_0x6a44('0x15a')]));var _0x2a8bc6=this[_0x6a44('0x4f')][_0x6a44('0x6f')](this,_0x5a36fb[_0x6a44('0x15a')]);if(_0x2a8bc6){logger['info'](util[_0x6a44('0xa0')](_0x6a44('0x161'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x5a36fb[_0x6a44('0x15a')]));this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x161'),this[_0x6a44('0xe')]['callerid'],_0x5a36fb['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x6a44('0x15c'),this[_0x6a44('0xe')][_0x6a44('0x39')],_0x5a36fb[_0x6a44('0x15a')]));this['channel'][_0x6a44('0xaf')](util[_0x6a44('0xa0')](_0x6a44('0x15c'),this[_0x6a44('0xe')]['callerid'],_0x5a36fb[_0x6a44('0x15a')]));return{'code':0xc8,'result':_0x6a44('0x15d')};}};AGIVertices[_0x6a44('0x11')]['voicemail']=function(_0x529aa7){logger['info'](util['format'](_0x6a44('0x1cf'),_0x529aa7['label']));var _0x1b5ce2=this[_0x6a44('0xe')][_0x6a44('0x55')](_0x6a44('0x1d0'),[_0x529aa7[_0x6a44('0x1d1')],_0x529aa7[_0x6a44('0x78')]]);if(_0x1b5ce2[_0x6a44('0xa8')]===-0x1){return _0x1b5ce2;}return this['channel'][_0x6a44('0xaf')](util['format'](_0x6a44('0xc6'),_0x6a44('0x1d0'),_0x529aa7['mailbox']));};AGIVertices[_0x6a44('0x11')]['vswitch']=function(_0x521740){logger[_0x6a44('0x2e')](util['format'](_0x6a44('0x1d2'),_0x521740[_0x6a44('0x36')]));if(!this[_0x6a44('0xae')](_0x521740[_0x6a44('0xda')])){return this[_0x6a44('0xe')][_0x6a44('0x2c')](_0x521740,_0x6a44('0x1b1'));}var _0x5ba195=this['getVariable'][_0x6a44('0x6f')](this,_0x521740[_0x6a44('0xda')]);if(!_0x5ba195){return this['channel']['error'](_0x521740,_0x6a44('0xdc'));}var _0x15b462=this[_0x6a44('0xe')][_0x6a44('0x12')](_0x5ba195);return{'code':0xc8,'result':_0x15b462[_0x6a44('0xa6')]?_0x15b462['extra']:'-'};};String[_0x6a44('0x11')][_0x6a44('0xa5')]=function(_0xf53de0,_0x5ca4f5){return this[_0x6a44('0xa3')](_0xf53de0)['join'](_0x5ca4f5);};module[_0x6a44('0x1d3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e133a19..24c2599 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 _0xd30e=['[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid'];(function(_0x34c819,_0x2d4fd5){var _0x51912e=function(_0x5ab9b4){while(--_0x5ab9b4){_0x34c819['push'](_0x34c819['shift']());}};_0x51912e(++_0x2d4fd5);}(_0xd30e,0x1ac));var _0xed30=function(_0xb9abb9,_0x327bad){_0xb9abb9=_0xb9abb9-0x0;var _0x458278=_0xd30e[_0xb9abb9];return _0x458278;};'use strict';var util=require(_0xed30('0x0'));var _=require(_0xed30('0x1'));var moment=require(_0xed30('0x2'));var ami=require(_0xed30('0x3'));var logger=require(_0xed30('0x4'))(_0xed30('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x495d0b){this['voiceQueues']=_0x495d0b[_0xed30('0x6')];this['agents']=_0x495d0b[_0xed30('0x7')];this['timers']=_0x495d0b[_0xed30('0x8')];this[_0xed30('0x9')]={};ami['on'](_0xed30('0xa'),this['syncAgentConnect'][_0xed30('0xb')](this));ami['on'](_0xed30('0xc'),this[_0xed30('0xd')][_0xed30('0xb')](this));ami['on']('hangup',this[_0xed30('0xe')][_0xed30('0xb')](this));ami['on']('agentringnoanswer',this[_0xed30('0xf')][_0xed30('0xb')](this));ami['on'](_0xed30('0x10'),this[_0xed30('0x11')][_0xed30('0xb')](this));ami['on'](_0xed30('0x12'),this[_0xed30('0x13')]['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xed30('0xb')](this));}function getDiff(_0x1d29d7){var _0xe6f628=moment()['milliseconds'](0x0);var _0x5a353c=moment(_0x1d29d7)[_0xed30('0x14')](0x0);return _0xe6f628[_0xed30('0x15')](_0x5a353c,'seconds');}Acw[_0xed30('0x16')][_0xed30('0x17')]=function(_0x4dd6ba){try{var _0x45e581=this;var _0x10a73e=this[_0xed30('0x9')][_0x4dd6ba][_0xed30('0x18')];var _0x369761=this[_0xed30('0x9')][_0x4dd6ba]['queue'];var _0x274efb=this[_0xed30('0x6')][_0x369761];var _0x532a11=![];var _0x3a04c5=_0xed30('0x19');if(_0x274efb[_0xed30('0x1a')]){if(_0x274efb[_0xed30('0x1b')][_0xed30('0x1c')]){_0x532a11=!![];_0x3a04c5=_0x274efb[_0xed30('0x1b')][_0xed30('0x1c')];}}ami['Action']({'action':_0xed30('0x1d'),'interface':_0x10a73e,'paused':!![],'reason':_0x3a04c5})[_0xed30('0x1e')](function(_0x33ad19){if(_0x45e581[_0xed30('0x7')][_0x10a73e]){return RpcUser[_0xed30('0x1f')](_0x45e581['agents'][_0x10a73e]['id'])['then'](function(_0x7672ed){if(_0x7672ed&&!_0x7672ed['voicePause']){logger[_0xed30('0x20')](_0xed30('0x21'),_0x4dd6ba,_0x10a73e,_0x369761);var _0x463203=_0x45e581[_0xed30('0x9')][_0x4dd6ba]['attended']&&_0x45e581[_0xed30('0x9')][_0x4dd6ba][_0xed30('0x22')]?_0x45e581[_0xed30('0x9')][_0x4dd6ba][_0xed30('0x22')]:_0x4dd6ba;return RpcUser[_0xed30('0x23')](_0x45e581[_0xed30('0x7')][_0x10a73e],_0x3a04c5,_0x463203)['then'](function(_0x308c15){if(!_0x532a11){_0x45e581[_0xed30('0x8')][_0x10a73e]={};logger[_0xed30('0x20')](_0xed30('0x24'),_0x4dd6ba,_0x45e581[_0xed30('0x6')][_0x369761][_0xed30('0x25')],_0x10a73e,_0x369761);_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x26')]=setTimeout(_0x45e581[_0xed30('0x27')]['bind'](_0x45e581,_0x10a73e),_0x45e581[_0xed30('0x6')][_0x369761]['acwTimeout']*0x3e8);_0x45e581['timers'][_0x10a73e][_0xed30('0x28')]=moment()[_0xed30('0x29')](_0xed30('0x2a'));_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x2b')]=_0x4dd6ba;_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x2c')]=_0x369761;_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x2d')]=function(){var _0x18bcb7=getDiff(_0x45e581[_0xed30('0x8')][_0x10a73e]['lastPauseAt']);clearTimeout(_0x45e581[_0xed30('0x8')][_0x10a73e]['timer']);_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x26')]=![];RpcVoiceAgentReport[_0xed30('0x2e')]({'acwtime':_0x18bcb7},_0x45e581[_0xed30('0x8')][_0x10a73e][_0xed30('0x2b')],_0x10a73e)[_0xed30('0x1e')](function(_0x2cb831){logger[_0xed30('0x20')](_0xed30('0x2f'),_0x4dd6ba,_0x18bcb7,_0x2cb831);})[_0xed30('0x30')](function(_0x170f56){logger['error'](_0xed30('0x31'),_0x4dd6ba,_0x170f56);});delete _0x45e581[_0xed30('0x8')][_0x10a73e];};}});}else{logger['info'](_0xed30('0x32'),_0x4dd6ba,_0x10a73e,_0x369761);}});}})[_0xed30('0x30')](function(_0x22ce6a){logger[_0xed30('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4dd6ba,_0x45e581[_0xed30('0x6')][_0x369761][_0xed30('0x25')],_0x10a73e,_0x369761);})['finally'](function(){delete _0x45e581[_0xed30('0x9')][_0x4dd6ba];});}catch(_0x45990e){logger[_0xed30('0x33')]('[ACW][START]\x20%s',_0x45990e[_0xed30('0x34')]);}};Acw[_0xed30('0x16')]['stopAcw']=function(_0x317405){try{var _0x336db0=this;if(_0x336db0[_0xed30('0x8')][_0x317405]){_0x336db0[_0xed30('0x8')][_0x317405]['timer']=![];var _0x40fb65=_0x336db0[_0xed30('0x8')][_0x317405][_0xed30('0x2b')];var _0x37239b=_0x336db0[_0xed30('0x8')][_0x317405][_0xed30('0x2c')];var _0x2365c5=_0x336db0[_0xed30('0x6')][_0x37239b][_0xed30('0x25')];logger[_0xed30('0x20')]('[%s][TIMER][STOP][AGENT:%s]',_0x40fb65,_0x317405);RpcUser[_0xed30('0x35')](this[_0xed30('0x7')][_0x317405]);RpcVoiceAgentReport[_0xed30('0x2e')]({'acwtime':_0x2365c5,'agentacw':!![]},_0x40fb65,_0x317405)[_0xed30('0x1e')](function(_0x3f56c7){logger[_0xed30('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x40fb65,_0x2365c5,_0x3f56c7);})[_0xed30('0x30')](function(_0x5193fe){logger[_0xed30('0x33')](_0xed30('0x31'),_0x40fb65,_0x5193fe);});}else{logger[_0xed30('0x33')](_0xed30('0x36'),_0x317405);if(_0x336db0[_0xed30('0x8')]){logger['info']('[ACW][TIMERS]',JSON[_0xed30('0x37')](_0x336db0[_0xed30('0x8')]));}}}catch(_0x2c0914){logger[_0xed30('0x33')](_0xed30('0x38'),_0x2c0914[_0xed30('0x34')]);}};Acw[_0xed30('0x16')]['syncAgentConnect']=function(_0x16702a){try{if(this[_0xed30('0x6')][_0x16702a[_0xed30('0x2c')]]&&(this[_0xed30('0x6')][_0x16702a[_0xed30('0x2c')]][_0xed30('0x5')]||this[_0xed30('0x6')][_0x16702a[_0xed30('0x2c')]][_0xed30('0x1a')])){if(this[_0xed30('0x7')][_0x16702a[_0xed30('0x18')]]){this['channels'][_0x16702a[_0xed30('0x2b')]]={'queue':_0x16702a[_0xed30('0x2c')],'interface':_0x16702a[_0xed30('0x18')],'destlinkedid':_0x16702a[_0xed30('0x22')]};}}}catch(_0x3e9aac){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x3e9aac[_0xed30('0x34')]);}};Acw[_0xed30('0x16')][_0xed30('0x39')]=function(_0x784562){try{if(this[_0xed30('0x6')][_0x784562[_0xed30('0x2c')]]&&(this[_0xed30('0x6')][_0x784562[_0xed30('0x2c')]]['acw']||this[_0xed30('0x6')][_0x784562[_0xed30('0x2c')]][_0xed30('0x1a')])){if(this[_0xed30('0x7')][_0x784562['interface']]){this[_0xed30('0x9')][_0x784562[_0xed30('0x2b')]]={'queue':_0x784562[_0xed30('0x2c')],'interface':_0x784562['interface']};}}}catch(_0x38db89){logger[_0xed30('0x33')](_0xed30('0x3a'),_0x38db89[_0xed30('0x34')]);}};Acw[_0xed30('0x16')][_0xed30('0xd')]=function(_0x4179ad){try{if(this[_0xed30('0x9')][_0x4179ad[_0xed30('0x2b')]]&&_[_0xed30('0x3b')](this[_0xed30('0x9')][_0x4179ad[_0xed30('0x2b')]][_0xed30('0x3c')])){logger[_0xed30('0x20')](_0xed30('0x3d'),_0x4179ad['uniqueid']);this[_0xed30('0x17')](_0x4179ad[_0xed30('0x2b')]);}else if(this[_0xed30('0x9')][_0x4179ad['linkedid']]&&_['isUndefined'](this[_0xed30('0x9')][_0x4179ad['linkedid']][_0xed30('0x3c')])){logger['info'](_0xed30('0x3e'),_0x4179ad['linkedid']);this[_0xed30('0x17')](_0x4179ad[_0xed30('0x3f')]);}}catch(_0x57dca7){logger[_0xed30('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x57dca7[_0xed30('0x34')]);}};Acw[_0xed30('0x16')]['syncHangup']=function(_0x52ac61){try{if(this[_0xed30('0x9')][_0x52ac61[_0xed30('0x2b')]]&&this[_0xed30('0x9')][_0x52ac61['uniqueid']][_0xed30('0x3c')]){logger['info'](_0xed30('0x40'),_0x52ac61['uniqueid']);this[_0xed30('0x17')](_0x52ac61['uniqueid']);}else if(this[_0xed30('0x9')][_0x52ac61['linkedid']]&&this[_0xed30('0x9')][_0x52ac61[_0xed30('0x3f')]][_0xed30('0x3c')]){logger[_0xed30('0x20')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x52ac61[_0xed30('0x3f')]);this[_0xed30('0x17')](_0x52ac61[_0xed30('0x3f')]);}}catch(_0x1e8d20){logger['error'](_0xed30('0x41'),_0x1e8d20[_0xed30('0x34')]);}};Acw[_0xed30('0x16')][_0xed30('0x11')]=function(_0x205110){try{if(!_[_0xed30('0x42')](this[_0xed30('0x9')][_0x205110[_0xed30('0x43')]])){this[_0xed30('0x17')](_0x205110[_0xed30('0x43')]);if(this[_0xed30('0x9')][_0x205110['secondtransfereruniqueid']]){this[_0xed30('0x9')][_0x205110[_0xed30('0x44')]]['attended']=!![];this[_0xed30('0x9')][_0x205110[_0xed30('0x45')]]=this[_0xed30('0x9')][_0x205110[_0xed30('0x44')]];delete this[_0xed30('0x9')][_0x205110[_0xed30('0x44')]];}}else if(!_[_0xed30('0x42')](this[_0xed30('0x9')][_0x205110[_0xed30('0x45')]])){this[_0xed30('0x17')](_0x205110['transfertargetuniqueid']);if(this[_0xed30('0x9')][_0x205110[_0xed30('0x46')]]){this[_0xed30('0x9')][_0x205110[_0xed30('0x46')]][_0xed30('0x3c')]=!![];this['channels'][_0x205110[_0xed30('0x43')]]=this[_0xed30('0x9')][_0x205110['origtransfereruniqueid']];delete this['channels'][_0x205110[_0xed30('0x46')]];}}}catch(_0x33e897){logger[_0xed30('0x33')](_0xed30('0x47'),_0x33e897[_0xed30('0x34')]);}};Acw[_0xed30('0x16')][_0xed30('0x13')]=function(_0xa83100){try{if(this['channels'][_0xa83100[_0xed30('0x48')]]){logger[_0xed30('0x20')](_0xed30('0x49'),JSON[_0xed30('0x37')](_0xa83100[_0xed30('0x48')]));this['startAcw'](_0xa83100[_0xed30('0x48')]);}else if(this[_0xed30('0x9')][_0xa83100[_0xed30('0x4a')]]){logger['info'](_0xed30('0x4b'),JSON[_0xed30('0x37')](_0xa83100[_0xed30('0x4a')]));this[_0xed30('0x17')](_0xa83100[_0xed30('0x4a')]);}}catch(_0x52d9da){logger['error'](_0xed30('0x4c'),_0x52d9da[_0xed30('0x34')]);}};Acw['prototype'][_0xed30('0xf')]=function(_0x22aa20){try{if(this['voiceQueues'][_0x22aa20['queue']]&&this[_0xed30('0x6')][_0x22aa20[_0xed30('0x2c')]][_0xed30('0x4d')]===_0xed30('0x4e')){if(this[_0xed30('0x7')][_0x22aa20[_0xed30('0x18')]]){logger[_0xed30('0x20')](_0xed30('0x4f'),_0x22aa20['uniqueid'],_0x22aa20[_0xed30('0x18')],_0x22aa20[_0xed30('0x2c')]);return RpcUser[_0xed30('0x23')](this['agents'][_0x22aa20[_0xed30('0x18')]],'Auto-Pause',_0x22aa20[_0xed30('0x2b')]);}}}catch(_0x321975){logger[_0xed30('0x33')](_0xed30('0x50'),_0x321975[_0xed30('0x34')]);}};module[_0xed30('0x51')]=Acw; \ No newline at end of file +var _0x0561=['getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','error','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then'];(function(_0x3f5706,_0x27f482){var _0x41d11b=function(_0x37d7e){while(--_0x37d7e){_0x3f5706['push'](_0x3f5706['shift']());}};_0x41d11b(++_0x27f482);}(_0x0561,0xed));var _0x1056=function(_0x1f983e,_0x5dbb17){_0x1f983e=_0x1f983e-0x0;var _0x42fba1=_0x0561[_0x1f983e];return _0x42fba1;};'use strict';var util=require(_0x1056('0x0'));var _=require('lodash');var moment=require(_0x1056('0x1'));var ami=require(_0x1056('0x2'));var logger=require(_0x1056('0x3'))(_0x1056('0x4'));var RpcUser=require(_0x1056('0x5'));var RpcVoiceAgentReport=require(_0x1056('0x6'));function Acw(_0xaf2902){this['voiceQueues']=_0xaf2902[_0x1056('0x7')];this['agents']=_0xaf2902[_0x1056('0x8')];this[_0x1056('0x9')]=_0xaf2902[_0x1056('0x9')];this[_0x1056('0xa')]={};ami['on'](_0x1056('0xb'),this['syncAgentConnect'][_0x1056('0xc')](this));ami['on'](_0x1056('0xd'),this[_0x1056('0xe')][_0x1056('0xc')](this));ami['on'](_0x1056('0xf'),this[_0x1056('0x10')][_0x1056('0xc')](this));ami['on'](_0x1056('0x11'),this[_0x1056('0x12')][_0x1056('0xc')](this));ami['on'](_0x1056('0x13'),this['syncAttendedTransfer'][_0x1056('0xc')](this));ami['on'](_0x1056('0x14'),this[_0x1056('0x15')]['bind'](this));ami['on'](_0x1056('0x16'),this[_0x1056('0x17')][_0x1056('0xc')](this));}function getDiff(_0x4f0d8c){var _0x3c4fc6=moment()[_0x1056('0x18')](0x0);var _0x3341cc=moment(_0x4f0d8c)[_0x1056('0x18')](0x0);return _0x3c4fc6[_0x1056('0x19')](_0x3341cc,_0x1056('0x1a'));}Acw[_0x1056('0x1b')][_0x1056('0x1c')]=function(_0x23e8f3){try{var _0x2bf244=this;var _0x2a7221=this['channels'][_0x23e8f3]['interface'];var _0x3ccc5c=this[_0x1056('0xa')][_0x23e8f3][_0x1056('0x1d')];var _0x255c22=this['voiceQueues'][_0x3ccc5c];var _0x136453=![];var _0x1596a1=_0x1056('0x1e');if(_0x255c22[_0x1056('0x1f')]){if(_0x255c22[_0x1056('0x20')]['name']){_0x136453=!![];_0x1596a1=_0x255c22[_0x1056('0x20')][_0x1056('0x21')];}}ami['Action']({'action':_0x1056('0x22'),'interface':_0x2a7221,'paused':!![],'reason':_0x1596a1})[_0x1056('0x23')](function(_0x407862){if(_0x2bf244[_0x1056('0x8')][_0x2a7221]){return RpcUser[_0x1056('0x24')](_0x2bf244[_0x1056('0x8')][_0x2a7221]['id'])['then'](function(_0x517067){if(_0x517067&&!_0x517067[_0x1056('0x25')]){logger['info'](_0x1056('0x26'),_0x23e8f3,_0x2a7221,_0x3ccc5c);var _0x97901e=_0x2bf244[_0x1056('0xa')][_0x23e8f3][_0x1056('0x27')]&&_0x2bf244[_0x1056('0xa')][_0x23e8f3][_0x1056('0x28')]?_0x2bf244[_0x1056('0xa')][_0x23e8f3][_0x1056('0x28')]:_0x23e8f3;return RpcUser[_0x1056('0x29')](_0x2bf244[_0x1056('0x8')][_0x2a7221],_0x1596a1,_0x97901e)['then'](function(_0x1bd41e){if(!_0x136453){_0x2bf244[_0x1056('0x9')][_0x2a7221]={};logger[_0x1056('0x2a')](_0x1056('0x2b'),_0x23e8f3,_0x2bf244['voiceQueues'][_0x3ccc5c][_0x1056('0x2c')],_0x2a7221,_0x3ccc5c);_0x2bf244[_0x1056('0x9')][_0x2a7221]['timer']=setTimeout(_0x2bf244[_0x1056('0x2d')]['bind'](_0x2bf244,_0x2a7221),_0x2bf244[_0x1056('0x7')][_0x3ccc5c][_0x1056('0x2c')]*0x3e8);_0x2bf244[_0x1056('0x9')][_0x2a7221][_0x1056('0x2e')]=moment()[_0x1056('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bf244['timers'][_0x2a7221][_0x1056('0x30')]=_0x23e8f3;_0x2bf244[_0x1056('0x9')][_0x2a7221]['queue']=_0x3ccc5c;_0x2bf244[_0x1056('0x9')][_0x2a7221]['updateAcw']=function(){var _0x47f7d2=getDiff(_0x2bf244[_0x1056('0x9')][_0x2a7221][_0x1056('0x2e')]);clearTimeout(_0x2bf244[_0x1056('0x9')][_0x2a7221]['timer']);_0x2bf244[_0x1056('0x9')][_0x2a7221][_0x1056('0x31')]=![];RpcVoiceAgentReport[_0x1056('0x32')]({'acwtime':_0x47f7d2},_0x2bf244['timers'][_0x2a7221][_0x1056('0x30')],_0x2a7221)[_0x1056('0x23')](function(_0x3f9cda){logger[_0x1056('0x2a')](_0x1056('0x33'),_0x23e8f3,_0x47f7d2,_0x3f9cda);})[_0x1056('0x34')](function(_0x4b8ebe){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x23e8f3,_0x4b8ebe);});delete _0x2bf244[_0x1056('0x9')][_0x2a7221];};}});}else{logger['info'](_0x1056('0x35'),_0x23e8f3,_0x2a7221,_0x3ccc5c);}});}})[_0x1056('0x34')](function(_0xec57a0){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23e8f3,_0x2bf244['voiceQueues'][_0x3ccc5c][_0x1056('0x2c')],_0x2a7221,_0x3ccc5c);})[_0x1056('0x36')](function(){delete _0x2bf244['channels'][_0x23e8f3];});}catch(_0x23d000){logger['error'](_0x1056('0x37'),_0x23d000[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0x2d')]=function(_0x4e8a14){try{var _0x46530e=this;if(_0x46530e[_0x1056('0x9')][_0x4e8a14]){_0x46530e[_0x1056('0x9')][_0x4e8a14][_0x1056('0x31')]=![];var _0x1be765=_0x46530e[_0x1056('0x9')][_0x4e8a14][_0x1056('0x30')];var _0xe62300=_0x46530e[_0x1056('0x9')][_0x4e8a14][_0x1056('0x1d')];var _0x2b0081=_0x46530e['voiceQueues'][_0xe62300][_0x1056('0x2c')];logger['info'](_0x1056('0x39'),_0x1be765,_0x4e8a14);RpcUser[_0x1056('0x3a')](this[_0x1056('0x8')][_0x4e8a14]);RpcVoiceAgentReport['update']({'acwtime':_0x2b0081,'agentacw':!![]},_0x1be765,_0x4e8a14)[_0x1056('0x23')](function(_0xb12e0e){logger[_0x1056('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x1be765,_0x2b0081,_0xb12e0e);})[_0x1056('0x34')](function(_0x3cb7e3){logger[_0x1056('0x3b')](_0x1056('0x3c'),_0x1be765,_0x3cb7e3);});}else{logger[_0x1056('0x3b')](_0x1056('0x3d'),_0x4e8a14);if(_0x46530e[_0x1056('0x9')]){logger[_0x1056('0x2a')](_0x1056('0x3e'),JSON[_0x1056('0x3f')](_0x46530e['timers']));}}}catch(_0x5d217d){logger[_0x1056('0x3b')](_0x1056('0x40'),_0x5d217d[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0x41')]=function(_0xc974dc){try{if(this[_0x1056('0x7')][_0xc974dc['queue']]&&(this[_0x1056('0x7')][_0xc974dc['queue']][_0x1056('0x4')]||this['voiceQueues'][_0xc974dc['queue']][_0x1056('0x1f')])){if(this[_0x1056('0x8')][_0xc974dc[_0x1056('0x42')]]){this[_0x1056('0xa')][_0xc974dc[_0x1056('0x30')]]={'queue':_0xc974dc[_0x1056('0x1d')],'interface':_0xc974dc['interface'],'destlinkedid':_0xc974dc[_0x1056('0x28')]};}}}catch(_0x2615c1){logger['error'](_0x1056('0x43'),_0x2615c1[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')]['syncAgentConnectPreview']=function(_0x29d347){try{if(this[_0x1056('0x7')][_0x29d347[_0x1056('0x1d')]]&&(this[_0x1056('0x7')][_0x29d347[_0x1056('0x1d')]]['acw']||this[_0x1056('0x7')][_0x29d347[_0x1056('0x1d')]]['mandatoryDisposition'])){if(this[_0x1056('0x8')][_0x29d347[_0x1056('0x42')]]){this['channels'][_0x29d347[_0x1056('0x30')]]={'queue':_0x29d347[_0x1056('0x1d')],'interface':_0x29d347[_0x1056('0x42')]};}}}catch(_0x112aef){logger[_0x1056('0x3b')]('[ACW][syncAgentConnectPreview]\x20%s',_0x112aef[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0xe')]=function(_0x55787f){try{if(this['channels'][_0x55787f[_0x1056('0x30')]]&&_['isUndefined'](this[_0x1056('0xa')][_0x55787f['uniqueid']][_0x1056('0x27')])){logger[_0x1056('0x2a')](_0x1056('0x44'),_0x55787f[_0x1056('0x30')]);this['startAcw'](_0x55787f['uniqueid']);}else if(this[_0x1056('0xa')][_0x55787f[_0x1056('0x45')]]&&_['isUndefined'](this[_0x1056('0xa')][_0x55787f[_0x1056('0x45')]][_0x1056('0x27')])){logger[_0x1056('0x2a')](_0x1056('0x46'),_0x55787f[_0x1056('0x45')]);this['startAcw'](_0x55787f[_0x1056('0x45')]);}}catch(_0x3325d9){logger[_0x1056('0x3b')](_0x1056('0x47'),_0x3325d9[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0x10')]=function(_0x3c2cbe){try{if(this[_0x1056('0xa')][_0x3c2cbe[_0x1056('0x30')]]&&this[_0x1056('0xa')][_0x3c2cbe[_0x1056('0x30')]]['attended']){logger[_0x1056('0x2a')](_0x1056('0x48'),_0x3c2cbe[_0x1056('0x30')]);this[_0x1056('0x1c')](_0x3c2cbe[_0x1056('0x30')]);}else if(this[_0x1056('0xa')][_0x3c2cbe['linkedid']]&&this['channels'][_0x3c2cbe[_0x1056('0x45')]]['attended']){logger['info'](_0x1056('0x49'),_0x3c2cbe[_0x1056('0x45')]);this[_0x1056('0x1c')](_0x3c2cbe[_0x1056('0x45')]);}}catch(_0x2f849e){logger[_0x1056('0x3b')](_0x1056('0x4a'),_0x2f849e[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0x4b')]=function(_0x195332){try{if(!_[_0x1056('0x4c')](this[_0x1056('0xa')][_0x195332[_0x1056('0x4d')]])){this['startAcw'](_0x195332['transfereeuniqueid']);if(this[_0x1056('0xa')][_0x195332[_0x1056('0x4e')]]){this[_0x1056('0xa')][_0x195332[_0x1056('0x4e')]]['attended']=!![];this['channels'][_0x195332[_0x1056('0x4f')]]=this[_0x1056('0xa')][_0x195332[_0x1056('0x4e')]];delete this['channels'][_0x195332[_0x1056('0x4e')]];}}else if(!_[_0x1056('0x4c')](this[_0x1056('0xa')][_0x195332['transfertargetuniqueid']])){this[_0x1056('0x1c')](_0x195332[_0x1056('0x4f')]);if(this[_0x1056('0xa')][_0x195332[_0x1056('0x50')]]){this[_0x1056('0xa')][_0x195332[_0x1056('0x50')]][_0x1056('0x27')]=!![];this[_0x1056('0xa')][_0x195332['transfereeuniqueid']]=this[_0x1056('0xa')][_0x195332['origtransfereruniqueid']];delete this[_0x1056('0xa')][_0x195332[_0x1056('0x50')]];}}}catch(_0x3d5d0b){logger[_0x1056('0x3b')](_0x1056('0x51'),_0x3d5d0b[_0x1056('0x38')]);}};Acw[_0x1056('0x1b')][_0x1056('0x15')]=function(_0x32a7b3){try{if(this['channels'][_0x32a7b3[_0x1056('0x52')]]){logger['info'](_0x1056('0x53'),JSON['stringify'](_0x32a7b3[_0x1056('0x52')]));this[_0x1056('0x1c')](_0x32a7b3[_0x1056('0x52')]);}else if(this['channels'][_0x32a7b3[_0x1056('0x54')]]){logger[_0x1056('0x2a')](_0x1056('0x55'),JSON['stringify'](_0x32a7b3['transfererlinkedid']));this[_0x1056('0x1c')](_0x32a7b3[_0x1056('0x54')]);}}catch(_0x187401){logger[_0x1056('0x3b')]('[ACW][syncBlindTransfer]\x20%s',_0x187401['message']);}};Acw['prototype'][_0x1056('0x12')]=function(_0x1b4588){try{if(this['voiceQueues'][_0x1b4588[_0x1056('0x1d')]]&&this[_0x1056('0x7')][_0x1b4588[_0x1056('0x1d')]][_0x1056('0x56')]===_0x1056('0x57')){if(this[_0x1056('0x8')][_0x1b4588[_0x1056('0x42')]]){logger[_0x1056('0x2a')](_0x1056('0x58'),_0x1b4588[_0x1056('0x30')],_0x1b4588['interface'],_0x1b4588[_0x1056('0x1d')]);return RpcUser[_0x1056('0x29')](this['agents'][_0x1b4588[_0x1056('0x42')]],_0x1056('0x59'),_0x1b4588[_0x1056('0x30')]);}}}catch(_0x11856b){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x11856b[_0x1056('0x38')]);}};module[_0x1056('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5c6ce0b..4936a74 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x55e981,_0x4d8535){var _0x11c2aa=function(_0x4d6335){while(--_0x4d6335){_0x55e981['push'](_0x55e981['shift']());}};_0x11c2aa(++_0x4d8535);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','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','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x1bbec4,_0x27060d){var _0x40d9db=function(_0x3db713){while(--_0x3db713){_0x1bbec4['push'](_0x1bbec4['shift']());}};_0x40d9db(++_0x27060d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 94715bf..8274ac8 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x27841e,_0x45435f){var _0x30d008=function(_0x2d2a60){while(--_0x2d2a60){_0x27841e['push'](_0x27841e['shift']());}};_0x30d008(++_0x45435f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x25259a,_0x23b86e){_0x25259a=_0x25259a-0x0;var _0x21e18a=_0x70e0[_0x25259a];return _0x21e18a;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 7cabdd0..3aa0c30 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 _0x3e39=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','exports','util','lodash','moment','isNil','string','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3e39,0xf1));var _0x93e3=function(_0xcc8d52,_0x432134){_0xcc8d52=_0xcc8d52-0x0;var _0x366748=_0x3e39[_0xcc8d52];return _0x366748;};'use strict';var util=require(_0x93e3('0x0'));var _=require(_0x93e3('0x1'));var moment=require(_0x93e3('0x2'));function checkNameSurname(_0x4589f2,_0x1a3b69,_0x2fed28){var _0x40c9c8='';if(!_[_0x93e3('0x3')](_0x1a3b69)&&_0x93e3('0x4')===typeof _0x1a3b69){_0x40c9c8+=_0x1a3b69;}if(!_[_0x93e3('0x3')](_0x2fed28)&&_0x93e3('0x4')===typeof _0x2fed28){_0x40c9c8+='\x20'+_0x2fed28;}if(_0x40c9c8!==''){return _0x40c9c8;}return _0x4589f2;}function Action(_0x16b27c,_0xc48c5e,_0x49f0a6){this['voiceQueue']=_0x16b27c;this[_0x93e3('0x5')]=_0x49f0a6||undefined;this[_0x93e3('0x6')]=checkNameSurname(_0xc48c5e['Contact'][_0x93e3('0x7')],_0xc48c5e[_0x93e3('0x8')][_0x93e3('0x9')],_0xc48c5e[_0x93e3('0x8')][_0x93e3('0xa')]);this[_0x93e3('0xb')]=_0xc48c5e['phone'];this[_0x93e3('0xc')]=_0x16b27c['name'];this[_0x93e3('0xd')]=_0xc48c5e['active']||![];this[_0x93e3('0xe')]=_0x16b27c[_0x93e3('0xe')];this[_0x93e3('0xf')]=_0x16b27c[_0x93e3('0xf')]||0x3;this[_0x93e3('0x10')]=_0xc48c5e[_0x93e3('0x10')];this['countbusyretry']=_0xc48c5e[_0x93e3('0x11')];this[_0x93e3('0x12')]=_0xc48c5e[_0x93e3('0x12')];this[_0x93e3('0x13')]=_0xc48c5e[_0x93e3('0x13')];this[_0x93e3('0x14')]=_0xc48c5e[_0x93e3('0x14')];this['countdropretry']=_0xc48c5e['countdropretry'];this[_0x93e3('0x15')]=_0xc48c5e[_0x93e3('0x15')];this[_0x93e3('0x16')]=_0xc48c5e['countmachineretry'];this[_0x93e3('0x17')]=_0xc48c5e[_0x93e3('0x17')];this['ContactId']=_0xc48c5e[_0x93e3('0x18')];this['ListId']=_0xc48c5e[_0x93e3('0x19')];this[_0x93e3('0x1a')]=_0xc48c5e['UserId'];this[_0x93e3('0x1b')]=_0xc48c5e[_0x93e3('0x1b')];this[_0x93e3('0x1c')]=_0xc48c5e[_0x93e3('0x1c')];this[_0x93e3('0x1d')]=_0xc48c5e['id'];this[_0x93e3('0x1e')]=_0xc48c5e[_0x93e3('0x8')][_0x93e3('0x9')]||'';this['starttime']=moment()[_0x93e3('0x1f')](_0x93e3('0x20'));this[_0x93e3('0x21')]=_0xc48c5e['callback'];this[_0x93e3('0x22')]=_0xc48c5e[_0x93e3('0x22')];this[_0x93e3('0x23')]=_0xc48c5e['callbackat'];this[_0x93e3('0x24')]=_0xc48c5e[_0x93e3('0x24')];this[_0x93e3('0x25')]='';this['originatecalleridname']='';}Action[_0x93e3('0x26')][_0x93e3('0x27')]=function(){return util[_0x93e3('0x1f')](_0x93e3('0x28'),this[_0x93e3('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x93e3('0xb')][_0x93e3('0x29')](this['voiceQueue'][_0x93e3('0x2a')]):this['number']);};Action[_0x93e3('0x26')]['getQueue']=function(){return this[_0x93e3('0xc')];};module[_0x93e3('0x2b')]=Action; \ No newline at end of file +var _0xfbb2=['exports','util','string','isNil','uniqueid','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','name','voiceQueue','dialCutDigit','substring'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xfbb2,0xf7));var _0x2fbb=function(_0x205eca,_0x138c20){_0x205eca=_0x205eca-0x0;var _0x193e81=_0xfbb2[_0x205eca];return _0x193e81;};'use strict';var util=require(_0x2fbb('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x1b3386,_0x102cf2,_0xd7f0e0){var _0x255cdf='';if(!_['isNil'](_0x102cf2)&&_0x2fbb('0x1')===typeof _0x102cf2){_0x255cdf+=_0x102cf2;}if(!_[_0x2fbb('0x2')](_0xd7f0e0)&&'string'===typeof _0xd7f0e0){_0x255cdf+='\x20'+_0xd7f0e0;}if(_0x255cdf!==''){return _0x255cdf;}return _0x1b3386;}function Action(_0x57e771,_0x2289c8,_0x414f3d){this['voiceQueue']=_0x57e771;this[_0x2fbb('0x3')]=_0x414f3d||undefined;this['name']=checkNameSurname(_0x2289c8[_0x2fbb('0x4')][_0x2fbb('0x5')],_0x2289c8[_0x2fbb('0x4')][_0x2fbb('0x6')],_0x2289c8[_0x2fbb('0x4')][_0x2fbb('0x7')]);this[_0x2fbb('0x8')]=_0x2289c8[_0x2fbb('0x5')];this[_0x2fbb('0x9')]=_0x57e771['name'];this[_0x2fbb('0xa')]=_0x2289c8[_0x2fbb('0xa')]||![];this[_0x2fbb('0xb')]=_0x57e771[_0x2fbb('0xb')];this[_0x2fbb('0xc')]=_0x57e771['dialQueueTimeout']||0x3;this[_0x2fbb('0xd')]=_0x2289c8[_0x2fbb('0xd')];this[_0x2fbb('0xe')]=_0x2289c8[_0x2fbb('0xe')];this[_0x2fbb('0xf')]=_0x2289c8[_0x2fbb('0xf')];this[_0x2fbb('0x10')]=_0x2289c8[_0x2fbb('0x10')];this[_0x2fbb('0x11')]=_0x2289c8[_0x2fbb('0x11')];this['countdropretry']=_0x2289c8['countdropretry'];this[_0x2fbb('0x12')]=_0x2289c8['countabandonedretry'];this['countmachineretry']=_0x2289c8[_0x2fbb('0x13')];this[_0x2fbb('0x14')]=_0x2289c8[_0x2fbb('0x14')];this[_0x2fbb('0x15')]=_0x2289c8[_0x2fbb('0x15')];this[_0x2fbb('0x16')]=_0x2289c8['ListId'];this[_0x2fbb('0x17')]=_0x2289c8[_0x2fbb('0x17')];this[_0x2fbb('0x18')]=_0x2289c8['VoiceQueueId'];this[_0x2fbb('0x19')]=_0x2289c8[_0x2fbb('0x19')];this[_0x2fbb('0x1a')]=_0x2289c8['id'];this[_0x2fbb('0x1b')]=_0x2289c8['Contact'][_0x2fbb('0x6')]||'';this['starttime']=moment()['format'](_0x2fbb('0x1c'));this['callback']=_0x2289c8['callback'];this[_0x2fbb('0x1d')]=_0x2289c8[_0x2fbb('0x1d')];this['callbackat']=_0x2289c8['callbackat'];this[_0x2fbb('0x1e')]=_0x2289c8['recallme'];this[_0x2fbb('0x1f')]='';this['originatecalleridname']='';}Action[_0x2fbb('0x20')][_0x2fbb('0x21')]=function(){return util[_0x2fbb('0x22')](_0x2fbb('0x23'),this[_0x2fbb('0x24')],this[_0x2fbb('0x25')][_0x2fbb('0x26')]>0x0?this['number'][_0x2fbb('0x27')](this[_0x2fbb('0x25')][_0x2fbb('0x26')]):this[_0x2fbb('0x8')]);};Action[_0x2fbb('0x20')]['getQueue']=function(){return this[_0x2fbb('0x9')];};module[_0x2fbb('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a994429..0742263 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 _0xb9c2=['util','moment','milliseconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb9c2,0x1ce));var _0x2b9c=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xb9c2[_0x10d670];return _0x20d6f8;};'use strict';var util=require(_0x2b9c('0x0'));var _=require('lodash');var moment=require(_0x2b9c('0x1'));function getSeconds(_0x391156,_0x22c5ac){var _0x11b140=moment(_0x391156)['milliseconds'](0x0);var _0x4037f4=moment(_0x22c5ac)[_0x2b9c('0x2')](0x0);return _0x11b140['diff'](_0x4037f4,'seconds');}function AgentComplete(_0x44d7b2,_0x55eb0f){this['state']=0x4;this['statedesc']=_0x2b9c('0x3');this[_0x2b9c('0x4')]=_0x44d7b2[_0x2b9c('0x4')];this[_0x2b9c('0x5')]=_0x44d7b2[_0x2b9c('0x5')];this[_0x2b9c('0x6')]=_0x44d7b2['type']===_0x2b9c('0x7')?_0x2b9c('0x8'):_0x44d7b2[_0x2b9c('0x5')];this[_0x2b9c('0x9')]=_0x44d7b2[_0x2b9c('0x9')];this['countcongestionretry']=_0x44d7b2['countcongestionretry'];this[_0x2b9c('0xa')]=_0x44d7b2['countnoanswerretry'];this[_0x2b9c('0xb')]=_0x44d7b2[_0x2b9c('0x9')]+_0x44d7b2[_0x2b9c('0xc')]+_0x44d7b2['countnoanswerretry']+_0x44d7b2['countnosuchnumberretry']+_0x44d7b2[_0x2b9c('0xd')]+_0x44d7b2['countabandonedretry']+_0x44d7b2[_0x2b9c('0xe')]+_0x44d7b2[_0x2b9c('0xf')];this[_0x2b9c('0x10')]=_0x44d7b2[_0x2b9c('0x10')];this[_0x2b9c('0xd')]=_0x44d7b2['countdropretry'];this[_0x2b9c('0x11')]=_0x44d7b2[_0x2b9c('0x11')];this[_0x2b9c('0xe')]=_0x44d7b2[_0x2b9c('0xe')];this[_0x2b9c('0xf')]=_0x44d7b2['countagentrejectretry'];this[_0x2b9c('0x12')]=_0x55eb0f[_0x2b9c('0x12')];this[_0x2b9c('0x13')]=_0x44d7b2['name'];this['calleridnum']=_0x44d7b2['number'];this['starttime']=_0x44d7b2['starttime'];this[_0x2b9c('0x14')]=_0x44d7b2['responsetime'];this['answertime']=_0x44d7b2[_0x2b9c('0x15')];this[_0x2b9c('0x16')]=moment()[_0x2b9c('0x17')](_0x2b9c('0x18'));this[_0x2b9c('0x19')]=getSeconds(_0x44d7b2[_0x2b9c('0x14')],_0x44d7b2[_0x2b9c('0x1a')]);this[_0x2b9c('0x1b')]=getSeconds(_0x44d7b2[_0x2b9c('0x15')],_0x44d7b2[_0x2b9c('0x14')]);this[_0x2b9c('0x1c')]=getSeconds(this[_0x2b9c('0x16')],_0x44d7b2[_0x2b9c('0x15')]);this[_0x2b9c('0x8')]=_0x55eb0f['queue'];this[_0x2b9c('0x1d')]=_0x55eb0f[_0x2b9c('0x1d')];this[_0x2b9c('0x1e')]=_0x55eb0f[_0x2b9c('0x1e')];this[_0x2b9c('0x1f')]=_0x44d7b2[_0x2b9c('0x1f')];this[_0x2b9c('0x20')]=_0x44d7b2[_0x2b9c('0x20')];this['callbackat']=_0x44d7b2['callbackat'];this[_0x2b9c('0x21')]=_0x44d7b2[_0x2b9c('0x21')];this['ContactId']=_0x44d7b2[_0x2b9c('0x22')];this[_0x2b9c('0x23')]=_0x44d7b2[_0x2b9c('0x23')];this[_0x2b9c('0x24')]=_0x44d7b2[_0x2b9c('0x24')];this[_0x2b9c('0x25')]=_0x44d7b2[_0x2b9c('0x25')];this[_0x2b9c('0x26')]=_0x44d7b2[_0x2b9c('0x26')];this[_0x2b9c('0x27')]=_0x44d7b2[_0x2b9c('0x27')]||'';this['originatecalleridname']=_0x44d7b2[_0x2b9c('0x28')]||'';}module[_0x2b9c('0x29')]=AgentComplete; \ No newline at end of file +var _0x7999=['countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','starttime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x4992a4,_0x506017){var _0x103ba8=function(_0x4e18c1){while(--_0x4e18c1){_0x4992a4['push'](_0x4992a4['shift']());}};_0x103ba8(++_0x506017);}(_0x7999,0x9a));var _0x9799=function(_0x347370,_0x3dc05f){_0x347370=_0x347370-0x0;var _0x2a1508=_0x7999[_0x347370];return _0x2a1508;};'use strict';var util=require(_0x9799('0x0'));var _=require(_0x9799('0x1'));var moment=require('moment');function getSeconds(_0x475e05,_0x5a7192){var _0x5e9f80=moment(_0x475e05)[_0x9799('0x2')](0x0);var _0x191f5f=moment(_0x5a7192)[_0x9799('0x2')](0x0);return _0x5e9f80[_0x9799('0x3')](_0x191f5f,_0x9799('0x4'));}function AgentComplete(_0x4ee024,_0x1beaa2){this['state']=0x4;this[_0x9799('0x5')]=_0x9799('0x6');this[_0x9799('0x7')]=_0x4ee024[_0x9799('0x7')];this[_0x9799('0x8')]=_0x4ee024[_0x9799('0x8')];this[_0x9799('0x9')]=_0x4ee024[_0x9799('0x8')]===_0x9799('0xa')?_0x9799('0xb'):_0x4ee024[_0x9799('0x8')];this[_0x9799('0xc')]=_0x4ee024['countbusyretry'];this[_0x9799('0xd')]=_0x4ee024[_0x9799('0xd')];this['countnoanswerretry']=_0x4ee024['countnoanswerretry'];this['countglobal']=_0x4ee024[_0x9799('0xc')]+_0x4ee024[_0x9799('0xd')]+_0x4ee024[_0x9799('0xe')]+_0x4ee024['countnosuchnumberretry']+_0x4ee024[_0x9799('0xf')]+_0x4ee024[_0x9799('0x10')]+_0x4ee024[_0x9799('0x11')]+_0x4ee024['countagentrejectretry'];this[_0x9799('0x12')]=_0x4ee024[_0x9799('0x12')];this[_0x9799('0xf')]=_0x4ee024[_0x9799('0xf')];this['countabandonedretry']=_0x4ee024[_0x9799('0x10')];this['countmachineretry']=_0x4ee024[_0x9799('0x11')];this[_0x9799('0x13')]=_0x4ee024['countagentrejectretry'];this['uniqueid']=_0x1beaa2[_0x9799('0x14')];this[_0x9799('0x15')]=_0x4ee024[_0x9799('0x16')];this[_0x9799('0x17')]=_0x4ee024['number'];this['starttime']=_0x4ee024['starttime'];this[_0x9799('0x18')]=_0x4ee024['responsetime'];this[_0x9799('0x19')]=_0x4ee024[_0x9799('0x19')];this[_0x9799('0x1a')]=moment()[_0x9799('0x1b')](_0x9799('0x1c'));this['ringtime']=getSeconds(_0x4ee024[_0x9799('0x18')],_0x4ee024[_0x9799('0x1d')]);this['holdtime']=getSeconds(_0x4ee024[_0x9799('0x19')],_0x4ee024[_0x9799('0x18')]);this['talktime']=getSeconds(this['endtime'],_0x4ee024['answertime']);this[_0x9799('0xb')]=_0x1beaa2[_0x9799('0xb')];this[_0x9799('0x1e')]=_0x1beaa2[_0x9799('0x1e')];this[_0x9799('0x1f')]=_0x1beaa2['reason'];this[_0x9799('0x20')]=_0x4ee024['callback'];this[_0x9799('0x21')]=_0x4ee024['callbackuniqueid'];this['callbackat']=_0x4ee024[_0x9799('0x22')];this[_0x9799('0x23')]=_0x4ee024[_0x9799('0x23')];this[_0x9799('0x24')]=_0x4ee024[_0x9799('0x24')];this[_0x9799('0x25')]=_0x4ee024[_0x9799('0x25')];this[_0x9799('0x26')]=_0x4ee024[_0x9799('0x26')];this[_0x9799('0x27')]=_0x4ee024['VoiceQueueId'];this[_0x9799('0x28')]=_0x4ee024['CampaignId'];this[_0x9799('0x29')]=_0x4ee024['originatecalleridnum']||'';this['originatecalleridname']=_0x4ee024['originatecalleridname']||'';}module[_0x9799('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 f4330c8..cdd236c 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 _0x6f47=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x6f47,0xc7));var _0x76f4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6f47[_0x3ab9ee];return _0x82ee88;};'use strict';var util=require('util');var _=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));function getSeconds(_0x5bc799,_0x2092f3){var _0x5765c1=moment(_0x5bc799)[_0x76f4('0x2')](0x0);var _0x47d3e1=moment(_0x2092f3)[_0x76f4('0x2')](0x0);return _0x5765c1[_0x76f4('0x3')](_0x47d3e1,_0x76f4('0x4'));}function Final(_0x2523ba){this['uniqueid']=_0x2523ba[_0x76f4('0x5')];this[_0x76f4('0x6')]=_0x2523ba[_0x76f4('0x6')];this['type']=_0x2523ba[_0x76f4('0x7')];this[_0x76f4('0x8')]=_0x2523ba[_0x76f4('0x7')]===_0x76f4('0x9')?_0x76f4('0xa'):_0x2523ba['type'];this['countbusyretry']=_0x2523ba[_0x76f4('0xb')];this[_0x76f4('0xc')]=_0x2523ba['countcongestionretry'];this['countnoanswerretry']=_0x2523ba[_0x76f4('0xd')];this[_0x76f4('0xe')]=_0x2523ba[_0x76f4('0xb')]+_0x2523ba[_0x76f4('0xc')]+_0x2523ba[_0x76f4('0xd')]+_0x2523ba[_0x76f4('0xf')]+_0x2523ba[_0x76f4('0x10')]+_0x2523ba[_0x76f4('0x11')]+_0x2523ba[_0x76f4('0x12')]+_0x2523ba['countagentrejectretry'];this[_0x76f4('0xf')]=_0x2523ba[_0x76f4('0xf')];this['countdropretry']=_0x2523ba['countdropretry'];this['countabandonedretry']=_0x2523ba[_0x76f4('0x11')];this[_0x76f4('0x12')]=_0x2523ba[_0x76f4('0x12')];this[_0x76f4('0x13')]=_0x2523ba[_0x76f4('0x13')];this[_0x76f4('0xa')]=_0x2523ba[_0x76f4('0xa')];this[_0x76f4('0x14')]=_0x2523ba[_0x76f4('0x14')];this[_0x76f4('0x15')]=_0x2523ba[_0x76f4('0x15')];this[_0x76f4('0x16')]=_0x2523ba[_0x76f4('0x16')];this[_0x76f4('0x17')]=_0x2523ba[_0x76f4('0x17')];this[_0x76f4('0x18')]=_0x2523ba[_0x76f4('0x17')];this[_0x76f4('0x19')]=_0x2523ba[_0x76f4('0x19')]||0x0;this[_0x76f4('0x1a')]=_0x2523ba[_0x76f4('0x1a')]||0x0;this[_0x76f4('0x1b')]=_0x2523ba['talktime']||0x0;this[_0x76f4('0x1c')]=_0x2523ba['callback'];this[_0x76f4('0x1d')]=_0x2523ba[_0x76f4('0x1d')];this[_0x76f4('0x1e')]=_0x2523ba['callbackat'];this['recallme']=_0x2523ba['recallme'];this[_0x76f4('0x1f')]=_0x2523ba[_0x76f4('0x1f')];this[_0x76f4('0x20')]=_0x2523ba[_0x76f4('0x20')];this[_0x76f4('0x21')]=_0x2523ba[_0x76f4('0x21')];this[_0x76f4('0x22')]=_0x2523ba['VoiceQueueId'];this['CampaignId']=_0x2523ba[_0x76f4('0x23')];this['originatecalleridnum']=_0x2523ba[_0x76f4('0x24')]||'';this['originatecalleridname']=_0x2523ba['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0x04de=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ListId','UserId'];(function(_0x19ff40,_0x388384){var _0x2ad46e=function(_0xa49c19){while(--_0xa49c19){_0x19ff40['push'](_0x19ff40['shift']());}};_0x2ad46e(++_0x388384);}(_0x04de,0x107));var _0xe04d=function(_0x18413e,_0x6b1949){_0x18413e=_0x18413e-0x0;var _0x8dd02e=_0x04de[_0x18413e];return _0x8dd02e;};'use strict';var util=require(_0xe04d('0x0'));var _=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));function getSeconds(_0x299552,_0x1e650d){var _0x28f63f=moment(_0x299552)[_0xe04d('0x3')](0x0);var _0x43c4b1=moment(_0x1e650d)[_0xe04d('0x3')](0x0);return _0x28f63f[_0xe04d('0x4')](_0x43c4b1,_0xe04d('0x5'));}function Final(_0x4804c8){this['uniqueid']=_0x4804c8['uniqueid'];this['scheduledat']=_0x4804c8[_0xe04d('0x6')];this[_0xe04d('0x7')]=_0x4804c8[_0xe04d('0x7')];this[_0xe04d('0x8')]=_0x4804c8[_0xe04d('0x7')]===_0xe04d('0x9')?_0xe04d('0xa'):_0x4804c8[_0xe04d('0x7')];this['countbusyretry']=_0x4804c8[_0xe04d('0xb')];this[_0xe04d('0xc')]=_0x4804c8[_0xe04d('0xc')];this[_0xe04d('0xd')]=_0x4804c8[_0xe04d('0xd')];this[_0xe04d('0xe')]=_0x4804c8[_0xe04d('0xb')]+_0x4804c8[_0xe04d('0xc')]+_0x4804c8[_0xe04d('0xd')]+_0x4804c8['countnosuchnumberretry']+_0x4804c8[_0xe04d('0xf')]+_0x4804c8[_0xe04d('0x10')]+_0x4804c8[_0xe04d('0x11')]+_0x4804c8[_0xe04d('0x12')];this[_0xe04d('0x13')]=_0x4804c8[_0xe04d('0x13')];this[_0xe04d('0xf')]=_0x4804c8[_0xe04d('0xf')];this[_0xe04d('0x10')]=_0x4804c8[_0xe04d('0x10')];this[_0xe04d('0x11')]=_0x4804c8[_0xe04d('0x11')];this['countagentrejectretry']=_0x4804c8[_0xe04d('0x12')];this['queue']=_0x4804c8[_0xe04d('0xa')];this['calleridname']=_0x4804c8[_0xe04d('0x14')];this[_0xe04d('0x15')]=_0x4804c8[_0xe04d('0x15')];this[_0xe04d('0x16')]=_0x4804c8[_0xe04d('0x16')];this[_0xe04d('0x17')]=_0x4804c8[_0xe04d('0x17')];this[_0xe04d('0x18')]=_0x4804c8[_0xe04d('0x17')];this['ringtime']=_0x4804c8[_0xe04d('0x19')]||0x0;this[_0xe04d('0x1a')]=_0x4804c8[_0xe04d('0x1a')]||0x0;this[_0xe04d('0x1b')]=_0x4804c8[_0xe04d('0x1b')]||0x0;this[_0xe04d('0x1c')]=_0x4804c8['callback'];this[_0xe04d('0x1d')]=_0x4804c8[_0xe04d('0x1d')];this['callbackat']=_0x4804c8['callbackat'];this['recallme']=_0x4804c8[_0xe04d('0x1e')];this['ContactId']=_0x4804c8['ContactId'];this[_0xe04d('0x1f')]=_0x4804c8[_0xe04d('0x1f')];this['UserId']=_0x4804c8[_0xe04d('0x20')];this['VoiceQueueId']=_0x4804c8[_0xe04d('0x21')];this['CampaignId']=_0x4804c8[_0xe04d('0x22')];this[_0xe04d('0x23')]=_0x4804c8[_0xe04d('0x23')]||'';this[_0xe04d('0x24')]=_0x4804c8[_0xe04d('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index f187a56..e014282 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 _0x5fa5=['CampaignId','exports','util','lodash','moment','milliseconds','state','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','endtime','format','ringtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x156339,_0x1bd96e){var _0x1932c7=function(_0x407390){while(--_0x407390){_0x156339['push'](_0x156339['shift']());}};_0x1932c7(++_0x1bd96e);}(_0x5fa5,0x192));var _0x55fa=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x5fa5[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require(_0x55fa('0x0'));var _=require(_0x55fa('0x1'));var moment=require(_0x55fa('0x2'));function getSeconds(_0x296c34,_0x464337){var _0x2ec5b6=moment(_0x296c34)[_0x55fa('0x3')](0x0);var _0x30bc1a=moment(_0x464337)[_0x55fa('0x3')](0x0);return _0x2ec5b6['diff'](_0x30bc1a,'seconds');}function Hangup(_0x44b206,_0x3751){this[_0x55fa('0x4')]=0x4;this['statedesc']=_0x55fa('0x5');this[_0x55fa('0x6')]=_0x44b206[_0x55fa('0x6')];this[_0x55fa('0x7')]=_0x44b206[_0x55fa('0x7')];this['campaigntype']=_0x44b206[_0x55fa('0x7')]==='outbound'?'queue':_0x44b206[_0x55fa('0x7')];this[_0x55fa('0x8')]=_0x44b206['countbusyretry'];this[_0x55fa('0x9')]=_0x44b206['countcongestionretry'];this[_0x55fa('0xa')]=_0x44b206['countnoanswerretry'];this['countglobal']=_0x44b206[_0x55fa('0x8')]+_0x44b206[_0x55fa('0x9')]+_0x44b206[_0x55fa('0xa')]+_0x44b206[_0x55fa('0xb')]+_0x44b206['countdropretry']+_0x44b206[_0x55fa('0xc')]+_0x44b206['countmachineretry']+_0x44b206[_0x55fa('0xd')];this[_0x55fa('0xb')]=_0x44b206[_0x55fa('0xb')];this[_0x55fa('0xe')]=_0x44b206[_0x55fa('0xe')];this[_0x55fa('0xc')]=_0x44b206[_0x55fa('0xc')];this[_0x55fa('0xf')]=_0x44b206[_0x55fa('0xf')];this[_0x55fa('0xd')]=_0x44b206[_0x55fa('0xd')];this[_0x55fa('0x10')]=_0x3751[_0x55fa('0x10')];this[_0x55fa('0x11')]=_0x44b206['name'];this['calleridnum']=_0x44b206[_0x55fa('0x12')];this[_0x55fa('0x13')]=_0x44b206[_0x55fa('0x13')];this[_0x55fa('0x14')]=_0x44b206[_0x55fa('0x14')];this[_0x55fa('0x15')]=moment()[_0x55fa('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x55fa('0x17')]=getSeconds(_0x44b206[_0x55fa('0x14')],_0x44b206[_0x55fa('0x13')]);this['holdtime']=0x0;this[_0x55fa('0x18')]=getSeconds(this[_0x55fa('0x15')],_0x44b206[_0x55fa('0x14')]);this[_0x55fa('0x19')]=_0x44b206[_0x55fa('0x19')];this[_0x55fa('0x1a')]=_0x55fa('0x1b');this[_0x55fa('0x1c')]=_0x3751[_0x55fa('0x1d')];this[_0x55fa('0x1e')]=_0x44b206['callback'];this[_0x55fa('0x1f')]=_0x44b206['callbackuniqueid'];this[_0x55fa('0x20')]=_0x44b206[_0x55fa('0x20')];this[_0x55fa('0x21')]=_0x44b206[_0x55fa('0x21')];this['ContactId']=_0x44b206[_0x55fa('0x22')];this['ListId']=_0x44b206[_0x55fa('0x23')];this['UserId']=_0x44b206[_0x55fa('0x24')];this[_0x55fa('0x25')]=_0x44b206['VoiceQueueId'];this['CampaignId']=_0x44b206[_0x55fa('0x26')];}module[_0x55fa('0x27')]=Hangup; \ No newline at end of file +var _0xc01e=['ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xc01e,0x12b));var _0xec01=function(_0x2c507b,_0x343d21){_0x2c507b=_0x2c507b-0x0;var _0x346f0d=_0xc01e[_0x2c507b];return _0x346f0d;};'use strict';var util=require('util');var _=require(_0xec01('0x0'));var moment=require(_0xec01('0x1'));function getSeconds(_0x31bd0a,_0x3afd5b){var _0x204be7=moment(_0x31bd0a)[_0xec01('0x2')](0x0);var _0x2fa69a=moment(_0x3afd5b)[_0xec01('0x2')](0x0);return _0x204be7[_0xec01('0x3')](_0x2fa69a,_0xec01('0x4'));}function Hangup(_0x1d1761,_0x1fe288){this[_0xec01('0x5')]=0x4;this[_0xec01('0x6')]=_0xec01('0x7');this[_0xec01('0x8')]=_0x1d1761['scheduledat'];this['type']=_0x1d1761[_0xec01('0x9')];this[_0xec01('0xa')]=_0x1d1761[_0xec01('0x9')]===_0xec01('0xb')?_0xec01('0xc'):_0x1d1761['type'];this[_0xec01('0xd')]=_0x1d1761[_0xec01('0xd')];this[_0xec01('0xe')]=_0x1d1761[_0xec01('0xe')];this['countnoanswerretry']=_0x1d1761[_0xec01('0xf')];this['countglobal']=_0x1d1761[_0xec01('0xd')]+_0x1d1761[_0xec01('0xe')]+_0x1d1761[_0xec01('0xf')]+_0x1d1761['countnosuchnumberretry']+_0x1d1761[_0xec01('0x10')]+_0x1d1761[_0xec01('0x11')]+_0x1d1761[_0xec01('0x12')]+_0x1d1761[_0xec01('0x13')];this[_0xec01('0x14')]=_0x1d1761[_0xec01('0x14')];this[_0xec01('0x10')]=_0x1d1761['countdropretry'];this['countabandonedretry']=_0x1d1761[_0xec01('0x11')];this['countmachineretry']=_0x1d1761[_0xec01('0x12')];this['countagentrejectretry']=_0x1d1761[_0xec01('0x13')];this[_0xec01('0x15')]=_0x1fe288[_0xec01('0x15')];this[_0xec01('0x16')]=_0x1d1761[_0xec01('0x17')];this[_0xec01('0x18')]=_0x1d1761[_0xec01('0x19')];this[_0xec01('0x1a')]=_0x1d1761[_0xec01('0x1a')];this[_0xec01('0x1b')]=_0x1d1761[_0xec01('0x1b')];this[_0xec01('0x1c')]=moment()['format'](_0xec01('0x1d'));this[_0xec01('0x1e')]=getSeconds(_0x1d1761[_0xec01('0x1b')],_0x1d1761[_0xec01('0x1a')]);this[_0xec01('0x1f')]=0x0;this[_0xec01('0x20')]=getSeconds(this['endtime'],_0x1d1761['responsetime']);this[_0xec01('0xc')]=_0x1d1761[_0xec01('0xc')];this[_0xec01('0x21')]=_0xec01('0x22');this[_0xec01('0x23')]=_0x1fe288[_0xec01('0x24')];this[_0xec01('0x25')]=_0x1d1761[_0xec01('0x25')];this[_0xec01('0x26')]=_0x1d1761[_0xec01('0x26')];this[_0xec01('0x27')]=_0x1d1761[_0xec01('0x27')];this[_0xec01('0x28')]=_0x1d1761[_0xec01('0x28')];this[_0xec01('0x29')]=_0x1d1761[_0xec01('0x29')];this[_0xec01('0x2a')]=_0x1d1761[_0xec01('0x2a')];this[_0xec01('0x2b')]=_0x1d1761[_0xec01('0x2b')];this[_0xec01('0x2c')]=_0x1d1761[_0xec01('0x2c')];this[_0xec01('0x2d')]=_0x1d1761[_0xec01('0x2d')];}module[_0xec01('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4c9fcd6..329b07d 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 _0x49d6=['moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0x49d6,0x15d));var _0x649d=function(_0x395d9f,_0x17b843){_0x395d9f=_0x395d9f-0x0;var _0x28609e=_0x49d6[_0x395d9f];return _0x28609e;};'use strict';var util=require(_0x649d('0x0'));var _=require(_0x649d('0x1'));var moment=require(_0x649d('0x2'));function getSeconds(_0x4321c8,_0x23084e){var _0x7ea5e3=moment(_0x4321c8)[_0x649d('0x3')](0x0);var _0x40919e=moment(_0x23084e)[_0x649d('0x3')](0x0);return _0x7ea5e3[_0x649d('0x4')](_0x40919e,'seconds');}function History(_0x1d182b){this[_0x649d('0x5')]=_0x1d182b[_0x649d('0x5')];this[_0x649d('0x6')]=_0x1d182b[_0x649d('0x6')]||undefined;this['type']=_0x1d182b[_0x649d('0x7')];this[_0x649d('0x8')]=_0x1d182b[_0x649d('0x7')]===_0x649d('0x9')?_0x649d('0xa'):_0x1d182b[_0x649d('0x7')];this[_0x649d('0xb')]=_0x1d182b['countbusyretry'];this[_0x649d('0xc')]=_0x1d182b[_0x649d('0xc')];this[_0x649d('0xd')]=_0x1d182b[_0x649d('0xd')];this[_0x649d('0xe')]=_0x1d182b[_0x649d('0xb')]+_0x1d182b['countcongestionretry']+_0x1d182b[_0x649d('0xd')]+_0x1d182b[_0x649d('0xf')]+_0x1d182b[_0x649d('0x10')]+_0x1d182b[_0x649d('0x11')]+_0x1d182b['countmachineretry']+_0x1d182b[_0x649d('0x12')];this[_0x649d('0xf')]=_0x1d182b['countnosuchnumberretry'];this[_0x649d('0x10')]=_0x1d182b[_0x649d('0x10')];this[_0x649d('0x11')]=_0x1d182b['countabandonedretry'];this[_0x649d('0x13')]=_0x1d182b[_0x649d('0x13')];this[_0x649d('0x12')]=_0x1d182b[_0x649d('0x12')];this['queue']=_0x1d182b['queue'];this[_0x649d('0x14')]=_0x1d182b[_0x649d('0x15')];this['calleridnum']=_0x1d182b['number'];this[_0x649d('0x16')]=_0x1d182b['starttime'];this[_0x649d('0x17')]=_0x1d182b[_0x649d('0x17')];this['endtime']=_0x1d182b['responsetime'];this[_0x649d('0x18')]=getSeconds(_0x1d182b['responsetime'],_0x1d182b[_0x649d('0x16')]);this[_0x649d('0x19')]=0x0;this[_0x649d('0x1a')]=0x0;this[_0x649d('0x1b')]=_0x1d182b[_0x649d('0x1b')];this['callbackuniqueid']=_0x1d182b[_0x649d('0x1c')];this[_0x649d('0x1d')]=_0x1d182b[_0x649d('0x1d')];this[_0x649d('0x1e')]=_0x1d182b[_0x649d('0x1e')];this[_0x649d('0x1f')]=_0x1d182b['ContactId'];this[_0x649d('0x20')]=_0x1d182b[_0x649d('0x20')];this[_0x649d('0x21')]=_0x1d182b[_0x649d('0x21')];this[_0x649d('0x22')]=_0x1d182b[_0x649d('0x22')];this['CampaignId']=_0x1d182b[_0x649d('0x23')];this['originatecalleridnum']=_0x1d182b[_0x649d('0x24')]||'';this[_0x649d('0x25')]=_0x1d182b[_0x649d('0x25')]||'';}module[_0x649d('0x26')]=History; \ No newline at end of file +var _0x3471=['recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackat'];(function(_0x53140f,_0x1cc206){var _0x584a76=function(_0xba1327){while(--_0xba1327){_0x53140f['push'](_0x53140f['shift']());}};_0x584a76(++_0x1cc206);}(_0x3471,0xc1));var _0x1347=function(_0x126d39,_0x546509){_0x126d39=_0x126d39-0x0;var _0x594935=_0x3471[_0x126d39];return _0x594935;};'use strict';var util=require(_0x1347('0x0'));var _=require(_0x1347('0x1'));var moment=require(_0x1347('0x2'));function getSeconds(_0x362047,_0x569b4a){var _0x4e3463=moment(_0x362047)[_0x1347('0x3')](0x0);var _0x176b2a=moment(_0x569b4a)[_0x1347('0x3')](0x0);return _0x4e3463['diff'](_0x176b2a,_0x1347('0x4'));}function History(_0x3c717f){this[_0x1347('0x5')]=_0x3c717f[_0x1347('0x5')];this[_0x1347('0x6')]=_0x3c717f['scheduledat']||undefined;this['type']=_0x3c717f['type'];this[_0x1347('0x7')]=_0x3c717f[_0x1347('0x8')]===_0x1347('0x9')?_0x1347('0xa'):_0x3c717f[_0x1347('0x8')];this[_0x1347('0xb')]=_0x3c717f['countbusyretry'];this[_0x1347('0xc')]=_0x3c717f[_0x1347('0xc')];this[_0x1347('0xd')]=_0x3c717f[_0x1347('0xd')];this[_0x1347('0xe')]=_0x3c717f['countbusyretry']+_0x3c717f['countcongestionretry']+_0x3c717f[_0x1347('0xd')]+_0x3c717f[_0x1347('0xf')]+_0x3c717f['countdropretry']+_0x3c717f['countabandonedretry']+_0x3c717f[_0x1347('0x10')]+_0x3c717f[_0x1347('0x11')];this[_0x1347('0xf')]=_0x3c717f[_0x1347('0xf')];this['countdropretry']=_0x3c717f[_0x1347('0x12')];this[_0x1347('0x13')]=_0x3c717f['countabandonedretry'];this['countmachineretry']=_0x3c717f['countmachineretry'];this[_0x1347('0x11')]=_0x3c717f[_0x1347('0x11')];this['queue']=_0x3c717f[_0x1347('0xa')];this[_0x1347('0x14')]=_0x3c717f['name'];this[_0x1347('0x15')]=_0x3c717f[_0x1347('0x16')];this[_0x1347('0x17')]=_0x3c717f['starttime'];this[_0x1347('0x18')]=_0x3c717f[_0x1347('0x18')];this[_0x1347('0x19')]=_0x3c717f[_0x1347('0x18')];this[_0x1347('0x1a')]=getSeconds(_0x3c717f[_0x1347('0x18')],_0x3c717f[_0x1347('0x17')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x1347('0x1b')]=_0x3c717f[_0x1347('0x1b')];this['callbackuniqueid']=_0x3c717f['callbackuniqueid'];this[_0x1347('0x1c')]=_0x3c717f[_0x1347('0x1c')];this[_0x1347('0x1d')]=_0x3c717f[_0x1347('0x1d')];this[_0x1347('0x1e')]=_0x3c717f[_0x1347('0x1e')];this['ListId']=_0x3c717f[_0x1347('0x1f')];this[_0x1347('0x20')]=_0x3c717f[_0x1347('0x20')];this['VoiceQueueId']=_0x3c717f['VoiceQueueId'];this['CampaignId']=_0x3c717f[_0x1347('0x21')];this[_0x1347('0x22')]=_0x3c717f[_0x1347('0x22')]||'';this['originatecalleridname']=_0x3c717f[_0x1347('0x23')]||'';}module[_0x1347('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c754a5c..06fd4ba 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 _0xfc34=['[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','inspect','emptyContact','saveInDb','merge','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','reachable','SIP/%s','unmonitored','variable','amdstatus','exten','value','HANGUP','uniqueid','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialAMDActive','countglobal','[syncAgentComplete][createHistory][0]','createStateFinal','add','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','queueCallerAbandonCreateState','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','checkPreviewRecallReminder','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','startMethodPredictive','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[busyFactor]','Umin\x20=\x20','exports','util','lodash','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','uniqueId','[uniqueid]','clearZombieChannels','actions','[actions]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory'];(function(_0x5a3495,_0x497ba2){var _0x1e35f0=function(_0x1ef137){while(--_0x1ef137){_0x5a3495['push'](_0x5a3495['shift']());}};_0x1e35f0(++_0x497ba2);}(_0xfc34,0x165));var _0x4fc3=function(_0x1ff7f9,_0x7f4e5d){_0x1ff7f9=_0x1ff7f9-0x0;var _0x42f261=_0xfc34[_0x1ff7f9];return _0x42f261;};'use strict';var util=require(_0x4fc3('0x0'));var _=require(_0x4fc3('0x1'));var uuid=require('uuid');var moment=require(_0x4fc3('0x2'));var rr=require('rr');var md5=require(_0x4fc3('0x3'));var Redis=require(_0x4fc3('0x4'));var ut=require(_0x4fc3('0x5'));var config=require(_0x4fc3('0x6'));var logger=require(_0x4fc3('0x7'))(_0x4fc3('0x8'));var loggerBooked=require(_0x4fc3('0x7'))(_0x4fc3('0x9'));var loggerPredictive=require(_0x4fc3('0x7'))('predictive');var loggerPredictiveCalls=require(_0x4fc3('0x7'))(_0x4fc3('0xa'));var loggerSyncQueueSummary=require(_0x4fc3('0x7'))('syncQueueSummary');var ami=require(_0x4fc3('0xb'));config['redis']=_[_0x4fc3('0xc')](config[_0x4fc3('0xd')],{'host':_0x4fc3('0xe'),'port':0x18eb});var io=require(_0x4fc3('0xf'))(new Redis(config[_0x4fc3('0xd')]));var cmHopper=require(_0x4fc3('0x10'));var cmHopperHistory=require(_0x4fc3('0x11'));var cmHopperAdditionalPhone=require(_0x4fc3('0x12'));var cmHopperBlack=require(_0x4fc3('0x13'));var voiceQueueRt=require(_0x4fc3('0x14'));var RpcSetting=require(_0x4fc3('0x15'));var Action=require(_0x4fc3('0x16'));var History=require(_0x4fc3('0x17'));var Final=require(_0x4fc3('0x18'));var AgentComplete=require(_0x4fc3('0x19'));var QueueCallerAbandon=require(_0x4fc3('0x1a'));var Hangup=require(_0x4fc3('0x1b'));var ipAgi=process['env'][_0x4fc3('0x1c')]||_0x4fc3('0x1d');var strategy={'rrmemory':_0x4fc3('0x1e'),'roundrobin':_0x4fc3('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4fc3('0x20')][_0x4fc3('0x21')]=function(_0x28dae1){this[_0x4fc3('0x22')]=this[_0x4fc3('0x22')]?this[_0x4fc3('0x22')][_0x4fc3('0x23')](_0x28dae1):_0x28dae1();};function Dialer(_0x21424e,_0x42702c){this[_0x4fc3('0x24')]=new Sequence();this['preview']=_0x42702c;this[_0x4fc3('0x25')]=_0x21424e[_0x4fc3('0x25')];this[_0x4fc3('0x26')]=_0x21424e[_0x4fc3('0x26')];this['agents']=_0x21424e[_0x4fc3('0x27')];this[_0x4fc3('0x28')]=_0x21424e['trunks'];this[_0x4fc3('0x29')]=config[_0x4fc3('0x29')]||0x2;this[_0x4fc3('0x2a')]={};this['actions']={};this[_0x4fc3('0x2b')]={};this['uniqueId']={};this[_0x4fc3('0x2c')]={};this['startPredictive']={};this[_0x4fc3('0x2d')]={};this[_0x4fc3('0x2e')]={};this[_0x4fc3('0x2f')]={};this[_0x4fc3('0x30')]={};ami['on'](_0x4fc3('0x31'),this[_0x4fc3('0x32')][_0x4fc3('0x33')](this));ami['on'](_0x4fc3('0x34'),this[_0x4fc3('0x35')][_0x4fc3('0x33')](this));ami['on']('originateresponse',this[_0x4fc3('0x36')]['bind'](this));ami['on'](_0x4fc3('0x37'),this[_0x4fc3('0x38')]['bind'](this));ami['on'](_0x4fc3('0x39'),this['syncQueueSummary'][_0x4fc3('0x33')](this));ami['on'](_0x4fc3('0x3a'),this['syncQueueSummaryComplete'][_0x4fc3('0x33')](this));ami['on'](_0x4fc3('0x3b'),this[_0x4fc3('0x3c')][_0x4fc3('0x33')](this));ami['on'](_0x4fc3('0x3d'),this[_0x4fc3('0x3e')]['bind'](this));ami['on'](_0x4fc3('0x3f'),this[_0x4fc3('0x40')][_0x4fc3('0x33')](this));ami['on'](_0x4fc3('0x41'),this['syncQueueMember'][_0x4fc3('0x33')](this));ami['on']('queuestatuscomplete',this[_0x4fc3('0x42')]['bind'](this));this[_0x4fc3('0x43')]();this[_0x4fc3('0x44')]();RpcSetting[_0x4fc3('0x45')]()['then'](function(_0x49fd1b){previewRecallmeReminderInterval=_0x49fd1b[_0x4fc3('0x46')];});}function isNotNull(_0x5ddecc){return _0x5ddecc!==null&&!_[_0x4fc3('0x47')](_0x5ddecc);}function checkIsLoggedIn(_0x1a4de5,_0x5494e1){return function(){if(_0x5494e1<=0x0){_0x1a4de5[_0x4fc3('0x48')]=_0x4fc3('0x49');throw _0x1a4de5['name']+_0x4fc3('0x4a');}};}function isActive(_0x5b40cd){return _0x5b40cd;}function checkIsActive(_0x5aaa6a,_0x2b5945){return function(){if(!isActive(_0x2b5945)){_0x5aaa6a[_0x4fc3('0x48')]=_0x4fc3('0x4b');throw _0x5aaa6a[_0x4fc3('0x4c')]+_0x4fc3('0x4d');}};}function checkInterval(_0x30a933){return function(){if(!isNotNull(_0x30a933[_0x4fc3('0x4e')])){_0x30a933[_0x4fc3('0x48')]='INTERVAL_IS_NULL';throw _0x30a933[_0x4fc3('0x4c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x30a933['Interval']['Intervals'])){_0x30a933[_0x4fc3('0x48')]=_0x4fc3('0x4f');throw _0x30a933['name']+_0x4fc3('0x50');}if(!isNotNull(_[_0x4fc3('0x51')](_0x30a933[_0x4fc3('0x4e')][_0x4fc3('0x52')]))){_0x30a933[_0x4fc3('0x48')]=_0x4fc3('0x4f');throw _0x30a933['name']+_0x4fc3('0x50');}};}function msgResponse(_0x5ce099,_0x288f53,_0xccb49c){return{'action':_0x5ce099,'response':_0x288f53,'message':_0xccb49c,'stack':_0xccb49c};}function myreject(_0x5ca64d){return function(_0x2e16fa){return _0x5ca64d(msgResponse(_0x4fc3('0x53'),_0x4fc3('0x54'),JSON[_0x4fc3('0x55')](_0x2e16fa)));};}function getSeconds(_0xac39a7,_0x21e842){var _0x279e07=moment(_0xac39a7)[_0x4fc3('0x56')](0x0);var _0x415bcb=moment(_0x21e842)[_0x4fc3('0x56')](0x0);return _0x279e07[_0x4fc3('0x57')](_0x415bcb,_0x4fc3('0x58'));}function emit(_0x2ba985,_0x4691e3,_0x5b7221){io['to'](_0x2ba985)[_0x4fc3('0x59')](_0x4691e3,_0x5b7221);}function emitVoiceQueueSummary(_0x397f10){if(_0x397f10[_0x4fc3('0x5a')]==='outbound'){var _0x294694={'id':_0x397f10['id'],'name':_0x397f10[_0x4fc3('0x4c')],'strategy':_0x397f10[_0x4fc3('0x5b')],'answered':_0x397f10[_0x4fc3('0x5c')],'available':_0x397f10['available'],'loggedIn':_0x397f10[_0x4fc3('0x5d')],'pTalking':_0x397f10[_0x4fc3('0x5e')],'sumBillable':_0x397f10[_0x4fc3('0x5f')],'sumDuration':_0x397f10[_0x4fc3('0x60')],'sumHoldTime':_0x397f10[_0x4fc3('0x61')]||0x0,'talking':_0x397f10['talking'],'total':_0x397f10['total'],'type':_0x397f10[_0x4fc3('0x5a')],'unmanaged':_0x397f10['unmanaged'],'abandoned':_0x397f10[_0x4fc3('0x62')],'waiting':_0x397f10[_0x4fc3('0x63')],'loggedInDb':_0x397f10[_0x4fc3('0x64')],'dialActive':_0x397f10[_0x4fc3('0x65')],'dialMethod':_0x397f10[_0x4fc3('0x66')],'dialOriginateCallerIdName':_0x397f10[_0x4fc3('0x67')],'dialOriginateCallerIdNumber':_0x397f10[_0x4fc3('0x68')],'dialOriginateTimeout':_0x397f10['dialOriginateTimeout'],'dialPrefix':_0x397f10['dialPrefix'],'outboundAnswerAgiCallsDay':_0x397f10['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x397f10['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x397f10[_0x4fc3('0x69')],'outboundBusyCallsDay':_0x397f10['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x397f10[_0x4fc3('0x6a')],'outboundDropCallsDayACS':_0x397f10[_0x4fc3('0x6b')],'outboundDropCallsDayCallersExit':_0x397f10[_0x4fc3('0x6c')],'outboundDropCallsDayTimeout':_0x397f10[_0x4fc3('0x6d')],'outboundNoAnswerCallsDay':_0x397f10[_0x4fc3('0x6e')],'outboundNoSuchCallsDay':_0x397f10[_0x4fc3('0x6f')],'outboundOriginateFailureCallsDay':_0x397f10[_0x4fc3('0x70')],'outboundReCallsDay':_0x397f10[_0x4fc3('0x71')],'outboundRejectCallsDay':_0x397f10[_0x4fc3('0x72')],'outboundUnknownCallsDay':_0x397f10[_0x4fc3('0x73')],'predictiveIntervalAnsweredCalls':_0x397f10[_0x4fc3('0x74')],'predictiveIntervalAvgHoldtime':_0x397f10[_0x4fc3('0x75')],'predictiveIntervalAvgTalktime':_0x397f10[_0x4fc3('0x76')],'predictiveIntervalDroppedCallsCallersExit':_0x397f10['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x397f10[_0x4fc3('0x77')],'predictiveIntervalErlangCalls':_0x397f10['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x397f10['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x397f10[_0x4fc3('0x78')],'predictiveIntervalMultiplicativeFactor':_0x397f10[_0x4fc3('0x79')],'predictiveIntervalPauses':_0x397f10[_0x4fc3('0x7a')],'predictiveIntervalAvailable':_0x397f10[_0x4fc3('0x7b')],'predictiveIntervalTotalCalls':_0x397f10[_0x4fc3('0x7c')],'message':_0x397f10[_0x4fc3('0x48')],'originated':_0x397f10[_0x4fc3('0x7d')],'erlangCalls':_0x397f10[_0x4fc3('0x7e')],'erlangCallToSecond':_0x397f10[_0x4fc3('0x7f')],'erlangAbandonmentRate':_0x397f10[_0x4fc3('0x80')],'erlangBusyFactor':_0x397f10['erlangBusyFactor'],'startPredictive':_0x397f10[_0x4fc3('0x81')],'startProgressive':_0x397f10[_0x4fc3('0x2d')]};if(_0x397f10[_0x4fc3('0x82')]){_0x294694[_0x4fc3('0x82')]={'id':_0x397f10['Trunk']['id'],'name':_0x397f10['Trunk'][_0x4fc3('0x4c')],'active':_0x397f10[_0x4fc3('0x82')][_0x4fc3('0x83')],'callerid':_0x397f10[_0x4fc3('0x82')][_0x4fc3('0x84')]};}if(_0x397f10[_0x4fc3('0x4e')]){_0x294694['Interval']={'id':_0x397f10['Interval']['id'],'name':_0x397f10[_0x4fc3('0x4e')][_0x4fc3('0x4c')]};}var _0x4529c3=md5(JSON[_0x4fc3('0x55')](_0x294694));if(_0x397f10[_0x4fc3('0x3')]!==_0x4529c3){_0x397f10[_0x4fc3('0x3')]=_0x4529c3;emit(util[_0x4fc3('0x85')](_0x4fc3('0x86'),_0x294694[_0x4fc3('0x4c')]),_0x4fc3('0x87'),_0x294694);}}}function emitCampaignSummary(_0x254be4){if(_0x254be4[_0x4fc3('0x5a')]===_0x4fc3('0x88')){emit(util[_0x4fc3('0x85')](_0x4fc3('0x89'),_0x254be4[_0x4fc3('0x4c')]),'campaign:save',_0x254be4);}}function checkGetDataPredictive(_0x48649f){if(isNotNull(_0x48649f)&&!_[_0x4fc3('0x51')](_0x48649f)){loggerPredictive[_0x4fc3('0x8a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x8b'),_0x48649f['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48649f[_0x4fc3('0x74')]);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x8c'),_0x48649f[_0x4fc3('0x77')]);loggerPredictive['info'](_0x4fc3('0x8d'),_0x48649f[_0x4fc3('0x8e')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48649f[_0x4fc3('0x75')]);loggerPredictive['info'](_0x4fc3('0x8f'),_0x48649f[_0x4fc3('0x76')]);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x90'));if(_0x48649f[_0x4fc3('0x7c')]>0x0){if(!_[_0x4fc3('0x47')](_0x48649f['predictiveIntervalAvgTalktime'])&&_0x48649f[_0x4fc3('0x76')]>0x0){return!![];}loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x91'));if(!_['isUndefined'](_0x48649f[_0x4fc3('0x75')])&&_0x48649f[_0x4fc3('0x75')]>0x0){return!![];}loggerPredictive[_0x4fc3('0x8a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x4fc3('0x92'));}}else{loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x93'));}return![];}function mergeDataErlangB(_0x2e6cef){return function(_0x9f2e00){loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x94'));loggerPredictive[_0x4fc3('0x8a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9f2e00[_0x4fc3('0x7e')]);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x95'),_0x9f2e00[_0x4fc3('0x7f')]);loggerPredictive['info'](_0x4fc3('0x96'),_0x9f2e00[_0x4fc3('0x80')]);loggerPredictive[_0x4fc3('0x8a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9f2e00['erlangBusyFactor']);loggerPredictive['info'](_0x4fc3('0x96'),_0x9f2e00[_0x4fc3('0x80')]);loggerPredictive['info'](_0x4fc3('0x90'));_['merge'](_0x2e6cef,_0x9f2e00);};}function getDiff(_0x3e92da){var _0x4a6524=moment()[_0x4fc3('0x56')](0x0);var _0x2236c5=moment(_0x3e92da)[_0x4fc3('0x56')](0x0);return _0x4a6524[_0x4fc3('0x57')](_0x2236c5,_0x4fc3('0x58'));}function ifInterval(_0x17265e,_0x96f20b){if(_[_0x4fc3('0x47')](_0x96f20b)){return![];}return getDiff(_0x96f20b)<_0x17265e*0x3c;}function freeVariablesPredictive(_0x5dba92){if(isNotNull(_0x5dba92)){if(!_['isUndefined'](_0x5dba92['startProgressive'])){_0x5dba92['startProgressive']=undefined;loggerPredictive['info'](_0x5dba92[_0x4fc3('0x4c')],_0x4fc3('0x97'));}if(!_[_0x4fc3('0x47')](_0x5dba92[_0x4fc3('0x81')])){_0x5dba92['startPredictive']=undefined;loggerPredictive[_0x4fc3('0x8a')](_0x5dba92[_0x4fc3('0x4c')],_0x4fc3('0x98'));}if(!_[_0x4fc3('0x47')](_0x5dba92['handlePredictive'])){clearInterval(_0x5dba92[_0x4fc3('0x99')]);_0x5dba92[_0x4fc3('0x99')]=undefined;loggerPredictive[_0x4fc3('0x8a')](_0x5dba92[_0x4fc3('0x4c')],_0x4fc3('0x9a'));}}}function erlangb(_0x2983cf,_0x150e57){if(_0x150e57===0x0){return 0x0;}var _0x1b6b8b=0x1;for(var _0x327fc0=0x1;_0x327fc0<=_0x150e57;_0x327fc0+=0x1){_0x1b6b8b=0x1+_0x1b6b8b*_0x327fc0/_0x2983cf;}return 0x1/_0x1b6b8b;}function isVoiceQueueOutbound(_0x515737){return _0x515737==='outbound';}function isNotPreview(_0x5574bc){return _0x5574bc!==_0x4fc3('0x9b');}function isCampaignIvr(_0x52d272){return _0x52d272===_0x4fc3('0x88');}function getCallerId(_0x3fc927,_0x1548c1,_0x48d633){if(!_[_0x4fc3('0x47')](_0x48d633)&&typeof _0x48d633===_0x4fc3('0x9c')&&!_[_0x4fc3('0x51')](_0x48d633)){if(!_[_0x4fc3('0x47')](_0x1548c1)&&typeof _0x1548c1===_0x4fc3('0x9c')&&!_[_0x4fc3('0x51')](_0x1548c1)){return util[_0x4fc3('0x85')](_0x4fc3('0x9d'),_0x1548c1,_0x48d633);}return util[_0x4fc3('0x85')](_0x4fc3('0x9d'),_0x48d633,_0x48d633);}if(!_[_0x4fc3('0x47')](_0x3fc927)&&typeof _0x3fc927==='string'&&!_['isEmpty'](_0x3fc927)){return _0x3fc927;}return _0x4fc3('0x9e');}function loggerCatchQueueSummary(_0x5cfe35,_0x12018f){return function(_0x2734e6){freeVariablesPredictive(_0x12018f);emitVoiceQueueSummary(_0x12018f);emitCampaignSummary(_0x12018f);loggerSyncQueueSummary[_0x4fc3('0x9f')](_0x5cfe35,util['inspect'](_0x2734e6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xf903f3,_0x21214e){return function(_0x46b392){loggerPredictive[_0x4fc3('0xa0')](_0x21214e['name'],_0xf903f3);loggerPredictive['error'](_0x46b392[_0x4fc3('0xa1')]);freeVariablesPredictive(_0x21214e);};}function loggerCatch(_0x6c6c61){return function(_0x19fd4b){logger[_0x4fc3('0xa0')](_0x6c6c61,util['inspect'](_0x19fd4b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x782790){return _0x782790&&!_[_0x4fc3('0x47')](_0x782790)&&_0x782790[_0x4fc3('0xa2')]>0x0;}function decremetOriginate(_0x1bb5a0){if(!_[_0x4fc3('0x47')](_0x1bb5a0)&&_0x1bb5a0!==null){if(typeof _0x1bb5a0['originated']!==_0x4fc3('0xa3')){if(_0x1bb5a0[_0x4fc3('0x7d')]>0x0){_0x1bb5a0[_0x4fc3('0x7d')]-=0x1;}else{logger[_0x4fc3('0xa0')](_0x4fc3('0xa4'));}}}else{logger[_0x4fc3('0xa0')](_0x4fc3('0xa5'));}}function checkContactLowerLimitOriginate(_0x497bff,_0x10e4f6,_0x356a62){if(_0x10e4f6>_0x356a62){for(var _0x22817e=0x0;_0x22817e<_0x10e4f6-_0x356a62;_0x22817e+=0x1){decremetOriginate(_0x497bff);}}}function loggerGetContactDialer(_0x458f8a,_0x506a68,_0x48344e){return function(_0x38ff3a){checkContactLowerLimitOriginate(_0x506a68,_0x48344e,0x0);logger[_0x4fc3('0xa0')](_0x458f8a,util['inspect'](_0x38ff3a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4aac24){return function(_0x11358c){if(isNotNull(_0x11358c)&&isNotNull(_0x11358c[0x0])){if(_0x11358c[0x0]['contactsRescheduled']>0x0){_0x4aac24['message']='RESCHEDULED_CONTACTS';logger['info'](_0x4fc3('0xa6')+_0x4aac24[_0x4fc3('0x4c')],_0x11358c[0x0][_0x4fc3('0xa7')],_0x4fc3('0xa8'));}else{_0x4aac24[_0x4fc3('0x48')]=_0x4fc3('0xa9');logger[_0x4fc3('0x8a')]('[getContactDialer2][Empty]'+_0x4aac24[_0x4fc3('0x4c')]);}}};}function notSendMessagesQueue(_0x2c2785){if(_0x2c2785[_0x4fc3('0xaa')]){freeVariablesPredictive(_0x2c2785);if(_0x2c2785['originated']===0x0&&_0x2c2785['talking']===0x0&&_0x2c2785[_0x4fc3('0x63')]===0x0&&(_0x2c2785[_0x4fc3('0x5e')]||0x0)===0x0){_0x2c2785['sendMessageOneNotActive']=![];_0x2c2785['available']=0x0;_0x2c2785[_0x4fc3('0x48')]=_0x4fc3('0x4b');loggerSyncQueueSummary[_0x4fc3('0x9f')](_0x4fc3('0xab'),_0x2c2785[_0x4fc3('0x4c')],_0x4fc3('0xac'));}else{_0x2c2785[_0x4fc3('0x48')]=_0x4fc3('0xad');loggerSyncQueueSummary[_0x4fc3('0x9f')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2c2785['name'],_0x4fc3('0xae'));}emitVoiceQueueSummary(_0x2c2785);}}function notSendMessagesCampaign(_0x27ce50){if(_0x27ce50[_0x4fc3('0xaa')]){if(_0x27ce50[_0x4fc3('0x7d')]===0x0){_0x27ce50['sendMessageOneNotActive']=![];_0x27ce50[_0x4fc3('0x48')]=_0x4fc3('0x4b');loggerSyncQueueSummary[_0x4fc3('0x9f')](_0x4fc3('0xaf'),_0x27ce50['name'],_0x4fc3('0xac'));}else{_0x27ce50[_0x4fc3('0x48')]=_0x4fc3('0xad');loggerSyncQueueSummary[_0x4fc3('0x9f')](_0x4fc3('0xaf'),_0x27ce50[_0x4fc3('0x4c')],_0x4fc3('0xae'));}emitCampaignSummary(_0x27ce50);}}function createObjHistory(_0x526dc5,_0x1e03cf,_0x3c4ea3,_0x6b0c95,_0x92d19a){_0x526dc5['message']=_0x3c4ea3;var _0x6428cf=new Action(_0x526dc5,_0x1e03cf);var _0x44c57f=new History(_0x6428cf);_0x44c57f[_0x4fc3('0xb0')]=_0x6b0c95;_0x44c57f['statedesc']=_0x92d19a;_0x44c57f[_0x4fc3('0xb1')]=_0x6428cf[_0x4fc3('0xb2')];return _0x44c57f;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x50e343=this;setInterval(function(){_0x50e343['clearZombieChannels'](_0x50e343[_0x4fc3('0xb3')],_0x4fc3('0xb4'));_0x50e343[_0x4fc3('0xb5')](_0x50e343[_0x4fc3('0xb6')],_0x4fc3('0xb7'));},0x32c8);};Dialer[_0x4fc3('0x20')][_0x4fc3('0xb5')]=function(_0x518c0e,_0x1bee19){var _0x2aa1d1=this;for(var _0x321b6c in _0x518c0e){if(typeof _0x518c0e[_0x321b6c]!==_0x4fc3('0xa3')){this['sequence'][_0x4fc3('0x21')](function(){if(!_[_0x4fc3('0xb8')](_0x518c0e[_0x321b6c])){return ami[_0x4fc3('0xb9')]({'action':_0x4fc3('0xba'),'channel':_0x518c0e[_0x321b6c][_0x4fc3('0xbb')]})['catch'](function(_0x2d72b9){if(_0x2d72b9[_0x4fc3('0x48')]===_0x4fc3('0xbc')){setTimeout(function(){if(_0x518c0e[_0x321b6c]&&_0x518c0e[_0x321b6c]['type']!=='ivr'){_0x2aa1d1[_0x4fc3('0xbd')](_0x2aa1d1[_0x4fc3('0x25')][_0x518c0e[_0x321b6c][_0x4fc3('0xbe')]]);logger['error'](_0x4fc3('0xbf'),_0x1bee19,_0x321b6c,_0x518c0e[_0x321b6c][_0x4fc3('0xbe')]);delete _0x518c0e[_0x321b6c];}if(_0x518c0e[_0x321b6c]&&_0x518c0e[_0x321b6c]['type']===_0x4fc3('0x88')){_0x2aa1d1[_0x4fc3('0xbd')](_0x2aa1d1[_0x4fc3('0x26')][_0x518c0e[_0x321b6c][_0x4fc3('0xbe')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x1bee19,_0x321b6c,_0x518c0e[_0x321b6c]['queue']);delete _0x518c0e[_0x321b6c];}},0x2328);}});}});}}};Dialer[_0x4fc3('0x20')][_0x4fc3('0xc0')]=function(_0x21f594){return Promise[_0x4fc3('0xc1')]()['then'](cmHopper['countReScheduled'](_0x21f594))[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0xc3')));};Dialer['prototype'][_0x4fc3('0xc4')]=function(_0x32175b){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperBlack[_0x4fc3('0xc4')](_0x32175b))[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0xc6')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xc7')]=function(_0x13380a,_0x10b79f,_0x22855c){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperAdditionalPhone[_0x4fc3('0xc7')](_0x13380a,_0x10b79f,_0x22855c))[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0xc8')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xc9')]=function(_0x5c5575,_0x380e7c,_0x2716b7){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperAdditionalPhone[_0x4fc3('0xc9')](_0x5c5575,_0x380e7c,_0x2716b7))['catch'](loggerCatch(_0x4fc3('0xca')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xcb')]=function(_0x1a1a9c){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperBlack[_0x4fc3('0xcb')](_0x1a1a9c))[_0x4fc3('0xc2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xcc')]=function(_0x44ffb2){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperHistory['avgHandleTime'](_0x44ffb2))[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0xcd')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xce')]=function(_0x47bdc6){return Promise['resolve']()['then'](cmHopper[_0x4fc3('0xce')](_0x47bdc6))['catch'](loggerCatch(_0x4fc3('0xcf')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xd0')]=function(_0x25e965,_0x25f571,_0x4fbb66){return Promise['resolve']()[_0x4fc3('0xc5')](cmHopper[_0x4fc3('0xd0')](_0x25e965,_0x25f571,_0x4fbb66))['catch'](loggerCatch(_0x4fc3('0xd1')));};Dialer[_0x4fc3('0x20')]['getContactDialer']=function(_0x5c6189,_0x36fcb7,_0x449ca8,_0x358682,_0x1822f5){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopper[_0x4fc3('0xd2')](_0x5c6189,_0x36fcb7,_0x449ca8,_0x358682))[_0x4fc3('0xc2')](function(_0x3dc363){_0x1822f5[_0x4fc3('0xd3')]-=_0x449ca8;_0x1822f5[_0x4fc3('0xd3')]=_0x1822f5[_0x4fc3('0xd3')]>0x0?_0x1822f5['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x3dc363);});};Dialer['prototype'][_0x4fc3('0xd4')]=function(_0x415e51,_0x51f12c,_0x1dd9e0,_0x10489b){return Promise[_0x4fc3('0xc1')]()['then'](cmHopper[_0x4fc3('0xd4')](_0x415e51,_0x51f12c,_0x1dd9e0))[_0x4fc3('0xc2')](function(_0x408696){_0x10489b['temp']-=_0x51f12c;_0x10489b['temp']=_0x10489b[_0x4fc3('0xd3')]>0x0?_0x10489b[_0x4fc3('0xd3')]:0x0;loggerCatch(_0x4fc3('0xd5'))(_0x408696);});};Dialer[_0x4fc3('0x20')][_0x4fc3('0xd6')]=function(_0x218eb5){return Promise[_0x4fc3('0xc1')]()['then'](voiceQueueRt[_0x4fc3('0xd6')](_0x218eb5))[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0xd7')));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xd8')]=function(_0x341b59){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopper[_0x4fc3('0xd8')](_0x341b59))[_0x4fc3('0xc2')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xd9')]=function(_0xa4ec8e){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopperHistory[_0x4fc3('0xd9')](_0xa4ec8e))['catch'](loggerCatch(_0x4fc3('0xda')));};Dialer['prototype'][_0x4fc3('0xbd')]=function(_0x1d6f29){if(!_[_0x4fc3('0x47')](_0x1d6f29)&&_0x1d6f29!==null){if(typeof _0x1d6f29[_0x4fc3('0x7d')]!==_0x4fc3('0xa3')){if(_0x1d6f29[_0x4fc3('0x7d')]>0x0){_0x1d6f29['originated']-=0x1;}else{logger[_0x4fc3('0xa0')](_0x4fc3('0xdb'));}}}else{logger[_0x4fc3('0xa0')](_0x4fc3('0xdc'));}};Dialer['prototype'][_0x4fc3('0xdd')]=function(_0x275878,_0x5e06f8){var _0x3d823c=this;return function(_0x1ede97){_0x3d823c[_0x4fc3('0xbd')](_0x5e06f8);logger[_0x4fc3('0xa0')](_0x275878,util[_0x4fc3('0xde')](_0x1ede97,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x4fc3('0xdf')]=function(_0x55fe8e,_0x2e8b40,_0x4168a5){var _0x23e91c={'state':0x19,'statedesc':'notFound'};this[_0x4fc3('0xbd')](_0x2e8b40);this[_0x4fc3('0xe0')](_[_0x4fc3('0xe1')](_0x23e91c,_[_0x4fc3('0xe2')](_0x4168a5,[_0x4fc3('0xe3'),_0x4fc3('0xe4'),'UserId',_0x4fc3('0xe5'),_0x4fc3('0xe6')])),'[emptyContact][createHistory]',_0x4fc3('0xe7'));logger['error'](_0x55fe8e);};Dialer[_0x4fc3('0x20')][_0x4fc3('0xe8')]=function(_0x352034){return _0x352034===_0x4fc3('0xe9');};Dialer['prototype']['isTrunkReachable']=function(_0x3d3fc4){return!_['isUndefined'](_0x3d3fc4)&&_0x3d3fc4&&!_[_0x4fc3('0x47')](_0x3d3fc4[_0x4fc3('0x4c')])&&!_[_0x4fc3('0x47')](_0x3d3fc4[_0x4fc3('0x83')])&&_0x3d3fc4['active']&&(this[_0x4fc3('0x28')][util['format']('SIP/%s',_0x3d3fc4['name'])][_0x4fc3('0xba')]===_0x4fc3('0xea')||this['trunks'][util[_0x4fc3('0x85')](_0x4fc3('0xeb'),_0x3d3fc4[_0x4fc3('0x4c')])][_0x4fc3('0xba')]===_0x4fc3('0xec'));};Dialer[_0x4fc3('0x20')][_0x4fc3('0xe0')]=function(_0x41a5c7,_0x322308,_0x29dacd){this['createHistory'](_0x41a5c7)[_0x4fc3('0xc2')](loggerCatch(_0x322308));this[_0x4fc3('0xd8')](_0x41a5c7)[_0x4fc3('0xc2')](loggerCatch(_0x29dacd));};Dialer['prototype'][_0x4fc3('0x40')]=function(_0x4603b4){var _0x426cf1=this;var _0x13491c=this[_0x4fc3('0xb3')][_0x4603b4['uniqueid']];var _0x476263;if(!_['isNil'](_0x4603b4)&&!_[_0x4fc3('0xb8')](_0x4603b4[_0x4fc3('0xed')])&&!_['isNil'](_0x4603b4[_0x4fc3('0xed')][_0x4fc3('0xee')])&&_0x4603b4[_0x4fc3('0xef')]==='xcally-motion-dialer'&&_0x13491c){if(_0x13491c['type']!==_0x4fc3('0x88')&&this[_0x4fc3('0x25')][_0x13491c['queue']]['dialAMDActive']&&_0x4603b4[_0x4fc3('0xf0')]===_0x4fc3('0xf1')){delete this[_0x4fc3('0xb3')][_0x4603b4[_0x4fc3('0xf2')]];this[_0x4fc3('0xbd')](this['voiceQueues'][_0x13491c[_0x4fc3('0xbe')]]);this[_0x4fc3('0x25')][_0x13491c[_0x4fc3('0xbe')]][_0x4fc3('0xf3')]+=0x1;this['voiceQueues'][_0x13491c[_0x4fc3('0xbe')]][_0x4fc3('0xf4')]+=0x1;_0x476263=new Hangup(_0x13491c,_0x4603b4);_0x476263['state']=0x12;_0x476263[_0x4fc3('0xf5')]=_0x4fc3('0xf6');_0x476263[_0x4fc3('0xf7')]=_0x4fc3('0xf8');ami['emit'](_0x4fc3('0xf9'),ut[_0x4fc3('0xfa')](_0x476263,_0x4fc3('0xfb')));this['saveInDb'](_0x476263,_0x4fc3('0xfc'),'[syncHangupInAMD]');}if(_0x13491c[_0x4fc3('0x5a')]!==_0x4fc3('0x88')&&this[_0x4fc3('0x25')][_0x13491c[_0x4fc3('0xbe')]]['dialAMDActive']&&_0x4603b4[_0x4fc3('0xf0')]===_0x4fc3('0xfd')){return new Promise(function(_0x1da0bc,_0x5a8334){delete _0x426cf1[_0x4fc3('0xb3')][_0x4603b4['uniqueid']];_0x426cf1[_0x4fc3('0xbd')](_0x426cf1[_0x4fc3('0x25')][_0x13491c[_0x4fc3('0xbe')]]);_0x426cf1['voiceQueues'][_0x13491c[_0x4fc3('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x426cf1[_0x4fc3('0x25')][_0x13491c[_0x4fc3('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x17bc3e=_0x426cf1['voiceQueues'][_0x13491c[_0x4fc3('0xbe')]];var _0x4057c5=new Hangup(_0x13491c,_0x4603b4);_0x4057c5[_0x4fc3('0xb0')]=0x13;_0x4057c5[_0x4fc3('0xf5')]='Machine';_0x4057c5[_0x4fc3('0xf7')]=_0x4fc3('0xf8');_0x4057c5[_0x4fc3('0xfe')]+=0x1;_0x4057c5['countglobal']+=0x1;_0x4057c5[_0x4fc3('0xfb')]=!![];ami[_0x4fc3('0x59')](_0x4fc3('0xf9'),ut['buildObj'](_0x4057c5,_0x4fc3('0xfb')));_0x426cf1[_0x4fc3('0xd9')](_0x4057c5)[_0x4fc3('0xc2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4057c5[_0x4fc3('0xff')]+_0x4057c5[_0x4fc3('0x100')]+_0x4057c5[_0x4fc3('0x101')]+_0x4057c5[_0x4fc3('0x102')]+_0x4057c5['countdropretry']+_0x4057c5[_0x4fc3('0x103')]+_0x4057c5[_0x4fc3('0xfe')]+_0x4057c5[_0x4fc3('0x104')]>=_0x17bc3e['dialGlobalMaxRetry']){_0x426cf1[_0x4fc3('0x105')](_0x4057c5,_0x1da0bc,_0x5a8334,_0x4fc3('0x106'));}else{if(_0x4057c5[_0x4fc3('0xfe')]>=_0x17bc3e[_0x4fc3('0x107')]){_0x426cf1['createStateFinal'](_0x4057c5,_0x1da0bc,_0x5a8334,_0x4fc3('0x108'));}else{_0x426cf1[_0x4fc3('0xce')]({'active':![],'countmachineretry':_0x4057c5[_0x4fc3('0xfe')],'scheduledat':moment()['add'](_0x17bc3e[_0x4fc3('0x109')],'minutes')[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x4057c5[_0x4fc3('0xe3')],'ListId':_0x4057c5[_0x4fc3('0xe4')],'VoiceQueueId':_0x4057c5[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x4057c5[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x10b')));_0x1da0bc({'reschedule':0x1});}}});}if(_0x13491c[_0x4fc3('0x5a')]===_0x4fc3('0x88')&&this[_0x4fc3('0x26')][_0x13491c[_0x4fc3('0xbe')]]['dialAMDActive']&&_0x4603b4['value']===_0x4fc3('0xf1')){delete this[_0x4fc3('0xb3')][_0x4603b4[_0x4fc3('0xf2')]];this['updateOriginated'](this[_0x4fc3('0x26')][_0x13491c['queue']]);_0x476263=new Hangup(_0x13491c,_0x4603b4);_0x476263[_0x4fc3('0xb0')]=0x12;_0x476263[_0x4fc3('0xf5')]=_0x4fc3('0xf6');_0x476263['membername']=_0x4fc3('0xf8');ami[_0x4fc3('0x59')](_0x4fc3('0xf9'),ut[_0x4fc3('0xfa')](_0x476263,_0x4fc3('0xfb')));this['saveInDb'](_0x476263,_0x4fc3('0x10c'),_0x4fc3('0x10d'));}if(_0x13491c['type']==='ivr'&&this[_0x4fc3('0x26')][_0x13491c[_0x4fc3('0xbe')]][_0x4fc3('0x10e')]&&_0x4603b4[_0x4fc3('0xf0')]===_0x4fc3('0xfd')){return new Promise(function(_0x18c8be,_0x37fa5f){delete _0x426cf1[_0x4fc3('0xb3')][_0x4603b4[_0x4fc3('0xf2')]];_0x426cf1['updateOriginated'](_0x426cf1['campaigns'][_0x13491c[_0x4fc3('0xbe')]]);_0x426cf1[_0x4fc3('0x26')][_0x13491c[_0x4fc3('0xbe')]][_0x4fc3('0xf3')]+=0x1;_0x426cf1[_0x4fc3('0x26')][_0x13491c[_0x4fc3('0xbe')]][_0x4fc3('0xf4')]+=0x1;var _0x26f1bf=_0x426cf1[_0x4fc3('0x26')][_0x13491c[_0x4fc3('0xbe')]];var _0x3084fd=new Hangup(_0x13491c,_0x4603b4);_0x3084fd[_0x4fc3('0xb0')]=0x13;_0x3084fd[_0x4fc3('0xf5')]='Machine';_0x3084fd[_0x4fc3('0xf7')]=_0x4fc3('0xf8');_0x3084fd[_0x4fc3('0xfe')]+=0x1;_0x3084fd[_0x4fc3('0x10f')]+=0x1;_0x3084fd['amd']=!![];ami['emit']('custom:amd',ut[_0x4fc3('0xfa')](_0x3084fd,'amd'));_0x426cf1[_0x4fc3('0xd9')](_0x3084fd)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x110')));if(_0x3084fd[_0x4fc3('0xff')]+_0x3084fd[_0x4fc3('0x100')]+_0x3084fd[_0x4fc3('0x101')]+_0x3084fd[_0x4fc3('0x102')]+_0x3084fd['countdropretry']+_0x3084fd['countabandonedretry']+_0x3084fd['countmachineretry']+_0x3084fd['countagentrejectretry']>=_0x26f1bf['dialGlobalMaxRetry']){_0x426cf1[_0x4fc3('0x105')](_0x3084fd,_0x18c8be,_0x37fa5f,_0x4fc3('0x106'));}else{if(_0x3084fd[_0x4fc3('0xfe')]>=_0x26f1bf['dialMachineMaxRetry']){_0x426cf1[_0x4fc3('0x111')](_0x3084fd,_0x18c8be,_0x37fa5f,_0x4fc3('0x108'));}else{_0x426cf1[_0x4fc3('0xce')]({'active':![],'countmachineretry':_0x3084fd[_0x4fc3('0xfe')],'scheduledat':moment()[_0x4fc3('0x112')](_0x26f1bf['dialMachineRetryFrequency'],_0x4fc3('0x113'))['format'](_0x4fc3('0x10a')),'ContactId':_0x3084fd[_0x4fc3('0xe3')],'ListId':_0x3084fd['ListId'],'VoiceQueueId':_0x3084fd['VoiceQueueId']||undefined,'CampaignId':_0x3084fd[_0x4fc3('0xe6')]||undefined})['catch'](loggerCatch(_0x4fc3('0x10b')));_0x18c8be({'reschedule':0x1});}}});}}};Dialer[_0x4fc3('0x20')]['syncHangup']=function(_0x35278f){var _0x537ca3=this[_0x4fc3('0xb3')][_0x35278f[_0x4fc3('0xf2')]];var _0x46d399;if(_0x537ca3&&_0x537ca3[_0x4fc3('0x5a')]==='ivr'){delete this['uniqueId'][_0x35278f['uniqueid']];this[_0x4fc3('0xbd')](this[_0x4fc3('0x26')][_0x537ca3[_0x4fc3('0xbe')]]);this[_0x4fc3('0x26')][_0x537ca3[_0x4fc3('0xbe')]][_0x4fc3('0x114')]+=0x1;_0x46d399=new Hangup(_0x537ca3,_0x35278f);this['createHistory'](_0x46d399)['catch'](loggerCatch(_0x4fc3('0x115')));this[_0x4fc3('0xd8')](_0x46d399)[_0x4fc3('0xc2')](loggerCatch('[syncHangupIvr]'));}if(_0x537ca3&&_0x537ca3[_0x4fc3('0x5a')]!==_0x4fc3('0x88')&&isNotNull(this[_0x4fc3('0x25')][_0x537ca3[_0x4fc3('0xbe')]][_0x4fc3('0x116')])){delete this[_0x4fc3('0xb3')][_0x35278f[_0x4fc3('0xf2')]];this[_0x4fc3('0xbd')](this[_0x4fc3('0x25')][_0x537ca3[_0x4fc3('0xbe')]]);this[_0x4fc3('0x25')][_0x537ca3[_0x4fc3('0xbe')]][_0x4fc3('0xf3')]+=0x1;this[_0x4fc3('0x25')][_0x537ca3[_0x4fc3('0xbe')]][_0x4fc3('0xf4')]+=0x1;_0x46d399=new Hangup(_0x537ca3,_0x35278f);_0x46d399[_0x4fc3('0xb0')]=0x10;_0x46d399[_0x4fc3('0xf5')]=_0x4fc3('0x117');_0x46d399['membername']=_0x4fc3('0x118');this['createHistory'](_0x46d399)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x115')));this['moveContactManagedDialer'](_0x46d399)['catch'](loggerCatch(_0x4fc3('0x119')));}if(_0x537ca3&&_0x537ca3[_0x4fc3('0x5a')]!==_0x4fc3('0x88')&&!isNotNull(this['voiceQueues'][_0x537ca3[_0x4fc3('0xbe')]][_0x4fc3('0x116')])){delete this['uniqueId'][_0x35278f['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x537ca3['queue']]);this[_0x4fc3('0x25')][_0x537ca3[_0x4fc3('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x46d399=new Hangup(_0x537ca3,_0x35278f);_0x46d399['state']=0xc;_0x46d399[_0x4fc3('0xf5')]=_0x35278f[_0x4fc3('0x11a')];_0x46d399[_0x4fc3('0xf7')]='Unknow';this[_0x4fc3('0xd9')](_0x46d399)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x115')));this['moveContactManagedDialer'](_0x46d399)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x119')));}};Dialer[_0x4fc3('0x20')][_0x4fc3('0x38')]=function(_0x44f68e){var _0x386e2e=this['uniqueId'][_0x44f68e['uniqueid']];if(this[_0x4fc3('0x25')][_0x44f68e[_0x4fc3('0xbe')]]){if(_0x386e2e&&_0x386e2e[_0x4fc3('0x5a')]!==_0x4fc3('0x88')){delete this[_0x4fc3('0xb3')][_0x44f68e[_0x4fc3('0xf2')]];this[_0x4fc3('0x25')][_0x44f68e[_0x4fc3('0xbe')]][_0x4fc3('0xf3')]+=0x1;var _0x39b721=new AgentComplete(_0x386e2e,_0x44f68e);if(_0x44f68e[_0x4fc3('0x11b')]===_0x4fc3('0x11c')){_0x39b721[_0x4fc3('0x11d')]=this[_0x4fc3('0x25')][_0x44f68e[_0x4fc3('0xbe')]][_0x4fc3('0x11e')]&&this['voiceQueues'][_0x44f68e['queue']][_0x4fc3('0x11f')]?moment()['format'](_0x4fc3('0x10a')):undefined;}this[_0x4fc3('0xd9')](_0x39b721)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x120')));this[_0x4fc3('0xd8')](_0x39b721)['catch'](loggerCatch(_0x4fc3('0x121')));}}};Dialer[_0x4fc3('0x20')]['syncAgentConnect']=function(_0x2562e9){if(this[_0x4fc3('0x25')][_0x2562e9[_0x4fc3('0xbe')]]){if(this[_0x4fc3('0xb3')][_0x2562e9[_0x4fc3('0xf2')]]&&this[_0x4fc3('0xb3')][_0x2562e9[_0x4fc3('0xf2')]][_0x4fc3('0x5a')]!==_0x4fc3('0x88')){this[_0x4fc3('0xbd')](this[_0x4fc3('0x25')][_0x2562e9[_0x4fc3('0xbe')]]);this[_0x4fc3('0xb3')][_0x2562e9[_0x4fc3('0xf2')]][_0x4fc3('0x122')]=moment()[_0x4fc3('0x85')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x4fc3('0x20')]['queueCallerAbandonCreateState']=function(_0x3d1c2f,_0x4ed590){this[_0x4fc3('0xd9')](_0x3d1c2f)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x120')));if(_0x4ed590==0x0){this[_0x4fc3('0xd8')](_0x3d1c2f)['catch'](loggerCatch(_0x4fc3('0x123')));}};Dialer[_0x4fc3('0x20')][_0x4fc3('0x35')]=function(_0x5be9d5){var _0x2156e4=this[_0x4fc3('0xb3')][_0x5be9d5['uniqueid']];var _0x405868=this;var _0x58d5cc=![];var _0x1b8f97;var _0x504639;if(this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]]){if(_0x2156e4&&_0x2156e4[_0x4fc3('0x5a')]!==_0x4fc3('0x88')){delete this[_0x4fc3('0xb3')][_0x5be9d5['uniqueid']];this[_0x4fc3('0xbd')](this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]]);_0x2156e4['droptime']=moment()['format'](_0x4fc3('0x10a'));var _0x4b2084=new QueueCallerAbandon(_0x2156e4,_0x5be9d5);if(getSeconds(_0x2156e4['droptime'],_0x2156e4['responsetime'])>=_0x2156e4[_0x4fc3('0x124')]){this[_0x4fc3('0x25')][_0x5be9d5['queue']][_0x4fc3('0x77')]+=0x1;this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x6d')]+=0x1;this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b2084[_0x4fc3('0xb0')]=0xa;_0x4b2084[_0x4fc3('0xf5')]=_0x4fc3('0x125');_0x4b2084[_0x4fc3('0x126')]=_0x4fc3('0x127');_0x4b2084[_0x4fc3('0x11d')]=this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x11e')]?moment()[_0x4fc3('0x85')](_0x4fc3('0x10a')):undefined;_0x4b2084[_0x4fc3('0x128')]+=0x1;_0x4b2084['countglobal']+=0x1;_0x1b8f97=this['voiceQueues'][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x129')];_0x504639=this[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x12a')];_0x405868[_0x4fc3('0xc7')](_0x4b2084,_0x4b2084[_0x4fc3('0xb0')],_0x2156e4[_0x4fc3('0x12b')])[_0x4fc3('0xc5')](function(_0xe697d9){_0x58d5cc=_0xe697d9[_0x4fc3('0x12c')]==0x1;if(_0x4b2084[_0x4fc3('0x128')]>=_0x405868[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]]['dialDropMaxRetry']){_0x405868[_0x4fc3('0x12d')](_0x4b2084,_0xe697d9[_0x4fc3('0x12c')]);}else{_0x405868[_0x4fc3('0xce')]({'active':![],'countdropretry':_0x4b2084[_0x4fc3('0x128')],'scheduledat':moment()['add'](_0x405868[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x129')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x2156e4['ContactId'],'ListId':_0x2156e4[_0x4fc3('0xe4')],'VoiceQueueId':_0x2156e4[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x2156e4[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x12e')));var _0x2d355d=new History(_0x4b2084);_0x2d355d[_0x4fc3('0xb0')]=0xa;_0x2d355d[_0x4fc3('0xf5')]=_0x4fc3('0x125');_0x2d355d[_0x4fc3('0xb2')]=moment()['format'](_0x4fc3('0x10a'));_0x2d355d[_0x4fc3('0xb1')]=_0x2d355d['starttime'];_0x2d355d[_0x4fc3('0x12f')]=_0x4b2084['calleridname'];_0x2d355d['calleridnum']=_0x4b2084['calleridnum'];_0x405868[_0x4fc3('0xd9')](_0x2d355d)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x130')));}})['then'](function(){if(_0x58d5cc)_0x405868[_0x4fc3('0xc9')](_0x4b2084,_0x1b8f97,_0x504639)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x5be9d5['queue']][_0x4fc3('0x8e')]+=0x1;this['voiceQueues'][_0x5be9d5['queue']][_0x4fc3('0x6c')]+=0x1;_0x4b2084[_0x4fc3('0xb0')]=0xb;_0x4b2084[_0x4fc3('0xf5')]=_0x4fc3('0x131');_0x4b2084[_0x4fc3('0x126')]=_0x4fc3('0x132');_0x4b2084['countabandonedretry']+=0x1;_0x4b2084[_0x4fc3('0x10f')]+=0x1;_0x1b8f97=this[_0x4fc3('0x25')][_0x5be9d5['queue']]['dialAbandonedRetryFrequency'];_0x504639=this[_0x4fc3('0x25')][_0x5be9d5['queue']][_0x4fc3('0x12a')];_0x405868[_0x4fc3('0xc7')](_0x4b2084,_0x4b2084[_0x4fc3('0xb0')],_0x2156e4['voiceQueue'])[_0x4fc3('0xc5')](function(_0x2470c5){if(_0x4b2084[_0x4fc3('0x103')]>=_0x405868['voiceQueues'][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x133')]){_0x405868[_0x4fc3('0x12d')](_0x4b2084,_0x2470c5[_0x4fc3('0x12c')]);}else{_0x405868[_0x4fc3('0xce')]({'active':![],'countabandonedretry':_0x4b2084[_0x4fc3('0x103')],'scheduledat':moment()[_0x4fc3('0x112')](_0x405868[_0x4fc3('0x25')][_0x5be9d5[_0x4fc3('0xbe')]][_0x4fc3('0x134')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x2156e4['ContactId'],'ListId':_0x2156e4[_0x4fc3('0xe4')],'VoiceQueueId':_0x2156e4['VoiceQueueId']||undefined,'CampaignId':_0x2156e4['CampaignId']||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x135')));var _0x4fa2dd=new History(_0x4b2084);_0x4fa2dd['state']=0xb;_0x4fa2dd[_0x4fc3('0xf5')]='Abandoned';_0x4fa2dd['starttime']=moment()[_0x4fc3('0x85')](_0x4fc3('0x10a'));_0x4fa2dd['endtime']=_0x4fa2dd['starttime'];_0x4fa2dd[_0x4fc3('0x12f')]=_0x4b2084[_0x4fc3('0x12f')];_0x4fa2dd[_0x4fc3('0x136')]=_0x4b2084['calleridnum'];_0x405868[_0x4fc3('0xd9')](_0x4fa2dd)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x137')));}})[_0x4fc3('0xc5')](function(){if(_0x58d5cc)_0x405868[_0x4fc3('0xc9')](_0x4b2084,_0x1b8f97,_0x504639)[_0x4fc3('0xc5')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x4fc3('0x3e')]=function(_0x153ed2){if(this[_0x4fc3('0xb6')][_0x153ed2[_0x4fc3('0xf2')]]){this['actions'][_0x153ed2[_0x4fc3('0xf2')]]['channel']=_0x153ed2[_0x4fc3('0xbb')];}if(this[_0x4fc3('0xb3')][_0x153ed2[_0x4fc3('0xf2')]]){this[_0x4fc3('0xb3')][_0x153ed2[_0x4fc3('0xf2')]][_0x4fc3('0xbb')]=_0x153ed2['channel'];}};Dialer['prototype'][_0x4fc3('0x138')]=function(_0x15232e){if(strategy[this[_0x4fc3('0x25')][this['actions'][_0x15232e[_0x4fc3('0x139')]][_0x4fc3('0xbe')]][_0x4fc3('0x5b')]]===_0x4fc3('0x1f')){if(this['actions'][_0x15232e[_0x4fc3('0x139')]]&&_[_0x4fc3('0xb8')](this[_0x4fc3('0xb6')][_0x15232e[_0x4fc3('0x139')]][_0x4fc3('0x13a')])&&_0x15232e[_0x4fc3('0xba')]==='1'&&_0x15232e[_0x4fc3('0x13b')]==='0'){if(this['agents'][_0x15232e['stateinterface']]){if(!this['agents'][_0x15232e[_0x4fc3('0x13c')]][_0x4fc3('0x13a')]){this['agents'][_0x15232e['stateinterface']][_0x4fc3('0x13a')]=!![];this[_0x4fc3('0xb6')][_0x15232e['actionid']][_0x4fc3('0x13a')]=!![];this['actions'][_0x15232e[_0x4fc3('0x139')]][_0x4fc3('0x13c')]=_0x15232e[_0x4fc3('0x13c')];}}}}else if((strategy[this[_0x4fc3('0x25')][this[_0x4fc3('0xb6')][_0x15232e['actionid']]['queue']][_0x4fc3('0x5b')]]||_0x4fc3('0x1e'))===_0x4fc3('0x1e')){if(this['actions'][_0x15232e[_0x4fc3('0x139')]]){if(this[_0x4fc3('0x27')][_0x15232e[_0x4fc3('0x13c')]]){this[_0x4fc3('0xb6')][_0x15232e[_0x4fc3('0x139')]][_0x4fc3('0x13c')]=_0x15232e[_0x4fc3('0x13c')];if(_[_0x4fc3('0xb8')](this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x15232e[_0x4fc3('0x139')]][_0x4fc3('0xbe')]])){this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x15232e['actionid']][_0x4fc3('0xbe')]]=[];}this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x15232e[_0x4fc3('0x139')]]['queue']][_0x4fc3('0x13d')](_[_0x4fc3('0xe1')](_[_0x4fc3('0xe2')](this['actions'][_0x15232e['actionid']],[_0x4fc3('0x13e'),_0x4fc3('0x13c')]),{'status':_0x15232e[_0x4fc3('0xba')],'paused':_0x15232e[_0x4fc3('0x13b')]}));}}}};function unlockQueueStatus(_0x5b3a5b,_0xa046ec){setTimeout(function(){if(_['isUndefined'](_0x5b3a5b['queueStatusComplete'])){loggerBooked[_0x4fc3('0xa0')](_0x4fc3('0x13f'),_0xa046ec);}_0x5b3a5b[_0x4fc3('0x140')]=!![];loggerBooked[_0x4fc3('0x8a')]('[booked][unlockQueueStatus]',_0xa046ec,JSON[_0x4fc3('0x55')](_[_0x4fc3('0xe2')](_0x5b3a5b,[_0x4fc3('0x4c'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x4fc3('0x20')]['syncQueueStatusComplete']=function(_0x40d66d){var _0x43bb42=this;var _0xe597a3=_0x43bb42[_0x4fc3('0x25')][_0x43bb42[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]];if(strategy[this[_0x4fc3('0x25')][this[_0x4fc3('0xb6')][_0x40d66d['actionid']]['queue']][_0x4fc3('0x5b')]]===_0x4fc3('0x1f')){if(this[_0x4fc3('0xb6')][_0x40d66d['actionid']]&&this[_0x4fc3('0xb6')][_0x40d66d['actionid']][_0x4fc3('0x13c')]){this[_0x4fc3('0x9b')][_0x4fc3('0x141')](this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]]['idHopper'],this['actions'][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0x13c')])[_0x4fc3('0xc2')](function(_0x47fdb4){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x4fc3('0xde')](_0x47fdb4,{'showHidden':![],'depth':null}));})['finally'](function(){_0x43bb42[_0x4fc3('0xbd')](_0x43bb42[_0x4fc3('0x25')][_0x43bb42[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]);_0x43bb42[_0x4fc3('0x27')][_0x43bb42[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0x13c')]]['locked']=![];delete _0x43bb42[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]];unlockQueueStatus(_0xe597a3);});}else{this[_0x4fc3('0xbd')](this[_0x4fc3('0x25')][this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]);this[_0x4fc3('0xce')]({'active':![],'ContactId':this['actions'][_0x40d66d[_0x4fc3('0x139')]]['ContactId'],'ListId':this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xe4')],'VoiceQueueId':this[_0x4fc3('0xb6')][_0x40d66d['actionid']][_0x4fc3('0xe5')]||undefined,'CampaignId':this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x142')));delete this['actions'][_0x40d66d[_0x4fc3('0x139')]];unlockQueueStatus(_0xe597a3);}}else if((strategy[this[_0x4fc3('0x25')][this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]][_0x4fc3('0x5b')]]||_0x4fc3('0x1e'))===_0x4fc3('0x1e')){var _0x133fcd;if(this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]]&&!_[_0x4fc3('0x51')](this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x40d66d['actionid']]['queue']])){if(this[_0x4fc3('0x30')][_0x43bb42['actions'][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]){this['queueBookedRR'][_0x43bb42[_0x4fc3('0xb6')][_0x40d66d['actionid']][_0x4fc3('0xbe')]]=this[_0x4fc3('0x30')][this['actions'][_0x40d66d['actionid']]['queue']]?this[_0x4fc3('0x30')][this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]:this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]?this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x40d66d[_0x4fc3('0x139')]][_0x4fc3('0xbe')]]['_rr']||0x0:0x0;}this[_0x4fc3('0x2f')][this[_0x4fc3('0xb6')][_0x40d66d['actionid']]['queue']][_0x4fc3('0x143')]=this[_0x4fc3('0x30')][this['actions'][_0x40d66d['actionid']][_0x4fc3('0xbe')]];for(var _0x1a36c3=0x0;_0x1a36c3=0x0;})['catch'](myreject(_0x305f43)));}}else{_0x1cb02c[_0x4fc3('0x13d')](ami['Action']({'action':'command','command':util[_0x4fc3('0x85')](_0x4fc3('0x162'),_0x37800d,!_[_0x4fc3('0x47')](config[_0x4fc3('0x15b')][_0x3e5163])?_0x3e5163:'')})[_0x4fc3('0xc5')](function(_0x20229a){return _0x20229a[_0x4fc3('0x160')]['indexOf'](_0x4fc3('0x163'))>=0x0;})['catch'](myreject(_0x305f43)));}Promise[_0x4fc3('0x164')](_0x1cb02c)[_0x4fc3('0xc5')](function(_0x45ea56){var _0x1dcd4f=_[_0x4fc3('0x165')](_0x45ea56);if(_0x1dcd4f){return _0x5ebe49(_0x1dcd4f);}else{_0x4420e8[_0x4fc3('0x48')]=_0x13beae?_0x4fc3('0x166'):_0x4fc3('0x167');return _0x305f43(msgResponse(_0x4fc3('0x168'),_0x4fc3('0x158'),_0x4fc3('0x169')+_0x13beae+'\x20'+_0x5e905c+'\x20Interval\x20is\x20overtime:\x20'+util[_0x4fc3('0xde')](_0x37800d,{'showHidden':![],'depth':null})+_0x4fc3('0x16a')+_0x3e5163));}})[_0x4fc3('0xc2')](function(_0x187db0){return _0x305f43(msgResponse(_0x4fc3('0x156'),_0x4fc3('0x158'),JSON[_0x4fc3('0x55')](_0x187db0)));});});};Dialer[_0x4fc3('0x20')]['checkDialMethod']=function(_0x37b38a){var _0x343533=this;return function(){switch(_0x37b38a['dialMethod']){case'progressive':freeVariablesPredictive(_0x37b38a);_0x343533[_0x4fc3('0x16b')](_0x37b38a,0x1);break;case _0x4fc3('0x16c'):freeVariablesPredictive(_0x37b38a);_0x343533[_0x4fc3('0x16b')](_0x37b38a,_0x37b38a[_0x4fc3('0x16d')]);break;case _0x4fc3('0x16e'):_0x343533[_0x4fc3('0x16e')](_0x37b38a);break;case _0x4fc3('0x9'):freeVariablesPredictive(_0x37b38a);_0x343533[_0x4fc3('0x16b')](_0x37b38a,0x1);break;default:freeVariablesPredictive(_0x37b38a);logger[_0x4fc3('0xa0')]('Queue',_0x37b38a[_0x4fc3('0x4c')],_0x4fc3('0x16f'));}};};Dialer[_0x4fc3('0x20')]['checkPreviewRecallReminder']=function(_0x5df517){return Promise['resolve']()['then'](cmHopper[_0x4fc3('0x170')](_0x5df517['id'],previewRecallmeReminderInterval))[_0x4fc3('0xc5')](function(_0x3b44b5){for(var _0x3364c1=0x0;_0x3364c1<_0x3b44b5[_0x4fc3('0xa2')];_0x3364c1++){var _0x1f9d4a=_0x3b44b5[_0x3364c1]['Agent'][_0x4fc3('0x4c')];if(_0x1f9d4a)io['to'](util[_0x4fc3('0x85')]('user:%s',_0x1f9d4a))[_0x4fc3('0x59')](_0x4fc3('0x171'),{'hopper':_0x3b44b5[_0x3364c1]});}})[_0x4fc3('0xc2')](function(){});};Dialer[_0x4fc3('0x20')][_0x4fc3('0x172')]=function(_0x4b431d){var _0x5ae7c1=this;return function(){_0x5ae7c1[_0x4fc3('0x173')](_0x4b431d);};};Dialer[_0x4fc3('0x20')][_0x4fc3('0x174')]=function(_0x49c754){var _0x2ba368=this;if(isNotPreview(_0x49c754[_0x4fc3('0x66')])){if(isVoiceQueueOutbound(_0x49c754['type'])&&isActive(_0x49c754[_0x4fc3('0x65')])){_0x49c754[_0x4fc3('0xaa')]=!![];Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](checkIsLoggedIn(_0x49c754,_0x49c754[_0x4fc3('0x5d')]))[_0x4fc3('0xc5')](checkIsActive(_0x49c754,_0x49c754['dialActive']))['then'](checkInterval(_0x49c754))[_0x4fc3('0xc5')](_0x2ba368[_0x4fc3('0x150')](_0x49c754))[_0x4fc3('0xc5')](_0x2ba368[_0x4fc3('0x155')](_0x49c754[_0x4fc3('0x175')],_0x49c754[_0x4fc3('0x176')],_0x49c754[_0x4fc3('0x4c')],_0x49c754))[_0x4fc3('0xc5')](_0x2ba368[_0x4fc3('0x157')](_0x49c754[_0x4fc3('0x4e')],_0x49c754[_0x4fc3('0x176')],_0x49c754[_0x4fc3('0x4c')],_0x49c754))[_0x4fc3('0xc5')](_0x2ba368[_0x4fc3('0x177')](_0x49c754))[_0x4fc3('0xc2')](loggerCatchQueueSummary(_0x4fc3('0x178'),_0x49c754));}else{notSendMessagesQueue(_0x49c754);}}else{freeVariablesPredictive(_0x49c754);}};Dialer[_0x4fc3('0x20')][_0x4fc3('0x179')]=_[_0x4fc3('0x17a')](function(){var _0x41548f=_[_0x4fc3('0x17b')](this['voiceQueues'],function(_0x2b5452){return _0x2b5452[_0x4fc3('0x17c')];});var _0xdb20d0=_[_0x4fc3('0x17b')](this[_0x4fc3('0x27')],function(_0xb54bb5){return _0xb54bb5[_0x4fc3('0x17d')]&&_0xb54bb5['status']==='reachable';});if(_0x41548f['length']>0x0&&_0xdb20d0[_0x4fc3('0xa2')]>0x0){return Promise[_0x4fc3('0xc1')]()[_0x4fc3('0xc5')](cmHopper[_0x4fc3('0x170')](_[_0x4fc3('0x17e')](_0x41548f,'id'),previewRecallmeReminderInterval,_[_0x4fc3('0x17e')](_0xdb20d0,'id')))['then'](function(_0x2c3919){for(var _0x318cee=0x0;_0x318cee<_0x2c3919[_0x4fc3('0xa2')];_0x318cee++){var _0x4af613=_0x2c3919[_0x318cee][_0x4fc3('0x17f')]['name'];if(_0x4af613)io['to'](util[_0x4fc3('0x85')](_0x4fc3('0x180'),_0x4af613))['emit'](_0x4fc3('0x171'),{'hopper':_0x2c3919[_0x318cee]});}})[_0x4fc3('0xc2')](function(_0xd5e586){logger[_0x4fc3('0xa0')](_0x4fc3('0x181'),_0xd5e586);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4fc3('0x20')][_0x4fc3('0x14f')]=function(){var _0x421cf3=this;var _0x1bd43e;for(var _0x39c6fc in this[_0x4fc3('0x26')]){if(typeof this['campaigns'][_0x39c6fc]!==_0x4fc3('0xa3')){_0x1bd43e=this[_0x4fc3('0x26')][_0x39c6fc];if(isCampaignIvr(_0x1bd43e[_0x4fc3('0x5a')])&&isActive(_0x1bd43e['active'])){_0x1bd43e[_0x4fc3('0xaa')]=!![];Promise['resolve']()[_0x4fc3('0xc5')](checkIsActive(_0x1bd43e,_0x1bd43e['active']))['then'](checkInterval(_0x1bd43e))[_0x4fc3('0xc5')](_0x421cf3[_0x4fc3('0x150')](_0x1bd43e))['then'](_0x421cf3['checkIfTime'](_0x1bd43e[_0x4fc3('0x175')],_0x1bd43e[_0x4fc3('0x176')],_0x1bd43e[_0x4fc3('0x4c')],_0x1bd43e))['then'](_0x421cf3['checkIfTimeIntervals'](_0x1bd43e[_0x4fc3('0x4e')],_0x1bd43e['dialTimezone'],_0x1bd43e['name'],_0x1bd43e))[_0x4fc3('0xc5')](_0x421cf3[_0x4fc3('0x172')](_0x1bd43e))['catch'](loggerCatchQueueSummary(_0x4fc3('0x182'),_0x1bd43e));}else{notSendMessagesCampaign(_0x1bd43e);}}}};function getCallerIdRandom(_0x402857,_0x15c84c){var _0x28317a;var _0x3b5df7;var _0x7ca608;if(_0x15c84c<=0x0){_0x15c84c=0x1;}_0x28317a=new RegExp(_0x4fc3('0x183')+_0x15c84c+'}$');_0x3b5df7=Math[_0x4fc3('0x184')](0xa,_0x15c84c-0x1);_0x7ca608=Math[_0x4fc3('0x184')](0xa,_0x15c84c)-0x1;return util[_0x4fc3('0x85')]('%s',_['replace'](_0x402857,_0x28317a,_[_0x4fc3('0x185')](_0x3b5df7,_0x7ca608)));}function extractCalleridName(_0x1d7ef1){var _0x5880c8=_0x1d7ef1[_0x4fc3('0x186')](/"(.*?)"/);return _0x5880c8?_0x5880c8[0x1]:_0x1d7ef1;}Dialer[_0x4fc3('0x20')][_0x4fc3('0x187')]=function(_0x3f5a5c,_0x43a1c8){var _0x541e03=this;var _0x3870bd=uuid['v4']();this[_0x4fc3('0xb6')][_0x3870bd]=new Action(_0x3f5a5c,_0x43a1c8,_0x3870bd);return new Promise(function(_0x481a7f,_0x2997fa){if(_[_0x4fc3('0x47')](_0x3f5a5c)&&typeof _0x3f5a5c!==_0x4fc3('0x188')){return _0x2997fa(msgResponse(_0x4fc3('0x189'),_0x4fc3('0x158'),_0x4fc3('0x18a')));}if(_[_0x4fc3('0x47')](_0x43a1c8[_0x4fc3('0x18b')])||_0x43a1c8[_0x4fc3('0x18b')]===null){return _0x2997fa(msgResponse(_0x4fc3('0x189'),_0x4fc3('0x158'),'contact\x20is\x20undefine'));}var _0x4f91e5={'XMD-CALLERID':_0x541e03[_0x4fc3('0xb6')][_0x3870bd]['getCaller'](),'XMD-AGI':_0x3f5a5c['dialQueueProject']?util[_0x4fc3('0x85')](_0x4fc3('0x18c'),ipAgi,_0x3f5a5c['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3f5a5c['dialQueueProject2']?util[_0x4fc3('0x85')](_0x4fc3('0x18c'),ipAgi,_0x3f5a5c[_0x4fc3('0x11e')]):_0x4fc3('0x18d'),'XMD-QUEUE':_0x3f5a5c[_0x4fc3('0x5a')]===_0x4fc3('0x18e')?util[_0x4fc3('0x85')](_0x4fc3('0x18f'),_0x3f5a5c[_0x4fc3('0x4c')],_0x3f5a5c['dialQueueOptions']||'',_0x3f5a5c[_0x4fc3('0x11f')]?'c':'',_0x3f5a5c[_0x4fc3('0x124')]||0x3):_0x4fc3('0x18d'),'XMD-CONTACTID':_0x43a1c8['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x541e03[_0x4fc3('0xb6')][_0x3870bd][_0x4fc3('0x190')](),'XMD-AMD':_0x3f5a5c[_0x4fc3('0x10e')]?'ACTIVE':_0x4fc3('0x18d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3f5a5c[_0x4fc3('0x10e')]){_0x4f91e5[_0x4fc3('0x191')]=_0x3f5a5c[_0x4fc3('0x192')]||0x9c4;_0x4f91e5['XMD-AMDGREETING']=_0x3f5a5c[_0x4fc3('0x193')]||0x5dc;_0x4f91e5[_0x4fc3('0x194')]=_0x3f5a5c['dialAMDAfterGreetingSilence']||0x320;_0x4f91e5[_0x4fc3('0x195')]=_0x3f5a5c[_0x4fc3('0x196')]||0x1388;_0x4f91e5[_0x4fc3('0x197')]=_0x3f5a5c['dialAMDMinWordLength']||0x64;_0x4f91e5[_0x4fc3('0x198')]=_0x3f5a5c[_0x4fc3('0x199')]||0x32;_0x4f91e5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3f5a5c[_0x4fc3('0x19a')]||0x3;_0x4f91e5[_0x4fc3('0x19b')]=_0x3f5a5c[_0x4fc3('0x19c')]||0x100;_0x4f91e5[_0x4fc3('0x19d')]=_0x3f5a5c[_0x4fc3('0x19e')]||0x1388;}if(_0x3f5a5c[_0x4fc3('0x5a')]===_0x4fc3('0x18e')){_0x4f91e5['XMD-VOICEQUEUEID']=_0x43a1c8[_0x4fc3('0xe5')];}else{_0x4f91e5[_0x4fc3('0x19f')]=_0x43a1c8[_0x4fc3('0xe6')];}for(var _0x47044e in _0x43a1c8['Contact']){if(typeof _0x43a1c8[_0x4fc3('0x1a0')][_0x47044e]!==_0x4fc3('0xa3')){if(isNotNull(_0x43a1c8[_0x4fc3('0x1a0')][_0x47044e])&&_0x47044e!=='id'&&_0x47044e!==_0x4fc3('0x1a1')&&_0x47044e!=='createdAt'&&_0x47044e!==_0x4fc3('0x1a2')){_0x4f91e5[util['format'](_0x4fc3('0x1a3'),_0x4fc3('0x1a4'),_[_0x4fc3('0x1a5')](_0x47044e))]=_0x43a1c8['Contact'][_0x47044e];}}}var _0x513fc4=_0x541e03[_0x4fc3('0x151')](_0x3f5a5c[_0x4fc3('0x82')])?getCallerId(_0x3f5a5c[_0x4fc3('0x82')][_0x4fc3('0x84')],_0x3f5a5c[_0x4fc3('0x67')],_0x3f5a5c[_0x4fc3('0x1a6')]>0x0?getCallerIdRandom(_0x3f5a5c[_0x4fc3('0x68')],_0x3f5a5c[_0x4fc3('0x1a6')]):_0x3f5a5c[_0x4fc3('0x68')]):getCallerId(_[_0x4fc3('0xb8')](_0x3f5a5c[_0x4fc3('0x152')])?_0x3f5a5c[_0x4fc3('0x82')][_0x4fc3('0x84')]:_0x3f5a5c['TrunkBackup'][_0x4fc3('0x84')],_0x3f5a5c['dialOriginateCallerIdName'],_0x3f5a5c[_0x4fc3('0x1a6')]>0x0?getCallerIdRandom(_0x3f5a5c[_0x4fc3('0x68')],_0x3f5a5c[_0x4fc3('0x1a6')]):_0x3f5a5c['dialOriginateCallerIdNumber']);if(_0x513fc4){_0x4f91e5['XMD-ORIGINATECALLERIDNAME']=_0x541e03[_0x4fc3('0xb6')][_0x3870bd][_0x4fc3('0x1a7')]=extractCalleridName(_0x513fc4);_0x4f91e5[_0x4fc3('0x1a8')]=_0x43a1c8[_0x4fc3('0x18b')];}_0x3f5a5c[_0x4fc3('0x1a9')]=_0x4f91e5;return ami[_0x4fc3('0xb9')]({'actionid':_0x3870bd,'action':_0x4fc3('0x189'),'channel':_0x541e03['isTrunkReachable'](_0x3f5a5c['Trunk'])?util[_0x4fc3('0x85')](_0x4fc3('0x1aa'),_0x3f5a5c[_0x4fc3('0x82')][_0x4fc3('0x4c')],isNotNull(_0x3f5a5c[_0x4fc3('0x1ab')])?_0x3f5a5c[_0x4fc3('0x1ab')][_0x4fc3('0x1ac')]()||'':'',_0x3f5a5c['dialCutDigit']>0x0?_0x43a1c8[_0x4fc3('0x18b')][_0x4fc3('0x1ad')](_0x3f5a5c[_0x4fc3('0x1ae')]):_0x43a1c8['phone']):util[_0x4fc3('0x85')](_0x4fc3('0x1aa'),_[_0x4fc3('0xb8')](_0x3f5a5c[_0x4fc3('0x152')])?_0x3f5a5c[_0x4fc3('0x82')][_0x4fc3('0x4c')]:_0x3f5a5c[_0x4fc3('0x152')][_0x4fc3('0x4c')],isNotNull(_0x3f5a5c[_0x4fc3('0x1ab')])?_0x3f5a5c[_0x4fc3('0x1ab')][_0x4fc3('0x1ac')]()||'':'',_0x3f5a5c[_0x4fc3('0x1ae')]>0x0?_0x43a1c8['phone'][_0x4fc3('0x1ad')](_0x3f5a5c[_0x4fc3('0x1ae')]):_0x43a1c8[_0x4fc3('0x18b')]),'callerid':_0x513fc4,'Exten':'xcally-motion-dialer','Context':_0x4fc3('0x1af'),'Priority':'1','variable':_0x4f91e5,'timeout':(_0x3f5a5c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3870bd})['then'](function(_0x2a396d){return _0x481a7f(_0x2a396d);})[_0x4fc3('0xc2')](function(_0x494ced){_0x3f5a5c['outboundOriginateFailureCallsDay']+=0x1;var _0x4de51d=new History(_0x541e03[_0x4fc3('0xb6')][_0x3870bd]);logger[_0x4fc3('0xa0')](util[_0x4fc3('0x85')](_0x4fc3('0x1b0'),JSON[_0x4fc3('0x55')](_0x494ced)));_0x4de51d[_0x4fc3('0xb0')]=0xe;_0x4de51d[_0x4fc3('0xf5')]=_0x4fc3('0x1b1');_0x4de51d[_0x4fc3('0xb2')]=moment()[_0x4fc3('0x85')](_0x4fc3('0x10a'));_0x4de51d['endtime']=_0x4de51d['starttime'];_0x541e03[_0x4fc3('0xd9')](_0x4de51d)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1b2')));_0x541e03[_0x4fc3('0xd8')](_0x4de51d)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1b2')))[_0x4fc3('0x23')](function(){delete _0x541e03[_0x4fc3('0xb6')][_0x3870bd];return _0x2997fa(msgResponse(_0x4fc3('0x189'),_0x4fc3('0x54'),_0x4fc3('0x1b3')));});});});};Dialer['prototype'][_0x4fc3('0x36')]=function(_0x2b6aae){var _0x3c8160=this[_0x4fc3('0xb6')][_0x2b6aae[_0x4fc3('0x139')]];if(_0x3c8160){delete this[_0x4fc3('0xb6')][_0x2b6aae[_0x4fc3('0x139')]];_0x3c8160[_0x4fc3('0x1b4')]=moment()['format'](_0x4fc3('0x10a'));var _0xf9f40e=_0x3c8160['type']===_0x4fc3('0x88')?this[_0x4fc3('0x26')][_0x3c8160['queue']]:this[_0x4fc3('0x25')][_0x3c8160[_0x4fc3('0x1b5')]()];if(!this[_0x4fc3('0xe8')](_0x2b6aae[_0x4fc3('0x1b6')])){this[_0x4fc3('0xbd')](_0xf9f40e);return this['callProgressDetecting'](_0x3c8160,_0xf9f40e,_0x2b6aae)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1b7')));}this[_0x4fc3('0xb3')][_0x2b6aae[_0x4fc3('0xf2')]]=_0x3c8160;}};Dialer[_0x4fc3('0x20')]['checkRetriveMax']=function(_0x58f97d,_0x4654ad,_0x1ea403){var _0x8585e=new History(_0x4654ad);if(_0x8585e[_0x4fc3('0xff')]+_0x8585e['countcongestionretry']+_0x8585e['countnoanswerretry']+_0x8585e[_0x4fc3('0x102')]+_0x8585e[_0x4fc3('0x128')]+_0x8585e[_0x4fc3('0x103')]+_0x8585e[_0x4fc3('0xfe')]+_0x8585e['countagentrejectretry']>=_0x1ea403[_0x4fc3('0x1b8')]-0x1){return!![];}switch(_0x58f97d){case 0x3:if(_0x8585e[_0x4fc3('0x101')]>=_0x1ea403[_0x4fc3('0x1b9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x8585e['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x1ea403[_0x4fc3('0x1ba')],_0x4fc3('0x113'))['format'](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1bb')));break;case 0x5:if(_0x8585e[_0x4fc3('0xff')]>=_0x1ea403[_0x4fc3('0x1bc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x8585e['countbusyretry']+=0x1,'scheduledat':moment()[_0x4fc3('0x112')](_0x1ea403[_0x4fc3('0x1bd')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e['VoiceQueueId']||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1be')));break;case 0x8:if(_0x8585e['countcongestionretry']>=_0x1ea403[_0x4fc3('0x1bf')]-0x1){return!![];}this[_0x4fc3('0xce')]({'active':![],'countcongestionretry':_0x8585e[_0x4fc3('0x100')]+=0x1,'scheduledat':moment()[_0x4fc3('0x112')](_0x1ea403[_0x4fc3('0x1c0')],_0x4fc3('0x113'))['format'](_0x4fc3('0x10a')),'ContactId':_0x8585e['ContactId'],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1c1')));break;case 0x0:if(_0x8585e[_0x4fc3('0x102')]>=_0x1ea403['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x4fc3('0xce')]({'active':![],'countnosuchnumberretry':_0x8585e[_0x4fc3('0x102')]+=0x1,'scheduledat':moment()[_0x4fc3('0x112')](_0x1ea403[_0x4fc3('0x1c2')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e['ListId'],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x8585e['countdropretry']>=_0x1ea403[_0x4fc3('0x1c3')]-0x1){return!![];}this[_0x4fc3('0xce')]({'active':![],'countdropretry':_0x8585e[_0x4fc3('0x128')]+=0x1,'scheduledat':moment()[_0x4fc3('0x112')](_0x1ea403[_0x4fc3('0x129')],'minutes')[_0x4fc3('0x85')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})['catch'](loggerCatch(_0x4fc3('0x12e')));break;case 0xb:if(_0x8585e['countabandonedretry']>=_0x1ea403[_0x4fc3('0x133')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x8585e['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x1ea403[_0x4fc3('0x134')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e['VoiceQueueId']||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})['catch'](loggerCatch(_0x4fc3('0x135')));break;case 0x13:if(_0x8585e[_0x4fc3('0xfe')]>=_0x1ea403[_0x4fc3('0x107')]-0x1){return!![];}this[_0x4fc3('0xce')]({'active':![],'countmachineretry':_0x8585e[_0x4fc3('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x1ea403[_0x4fc3('0x109')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e[_0x4fc3('0xe4')],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x10b')));break;case 0x14:if(_0x8585e[_0x4fc3('0x104')]>=_0x1ea403[_0x4fc3('0x1c4')]-0x1){return!![];}this[_0x4fc3('0xce')]({'active':![],'countagentrejectretry':_0x8585e['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x4fc3('0x112')](_0x1ea403[_0x4fc3('0x1c5')],_0x4fc3('0x113'))[_0x4fc3('0x85')](_0x4fc3('0x10a')),'ContactId':_0x8585e[_0x4fc3('0xe3')],'ListId':_0x8585e['ListId'],'VoiceQueueId':_0x8585e[_0x4fc3('0xe5')]||undefined,'CampaignId':_0x8585e[_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x4fc3('0x20')]['callProgressDetecting']=function(_0x2e54bc,_0x574d29,_0x1acac5){var _0x5e653b=this;var _0xd5daca=new History(_0x2e54bc);var _0xb8f05a=![];var _0x40ec85;var _0x291ab3;return new Promise(function(_0x48f1bf,_0x4766e5){if(_[_0x4fc3('0x47')](_0x574d29)&&typeof _0x574d29!==_0x4fc3('0x188')){return _0x4766e5(msgResponse(_0x4fc3('0x1c6'),_0x4fc3('0x158'),_0x4fc3('0x1c7')));}if(_[_0x4fc3('0x47')](_0x1acac5)&&typeof _0x1acac5!=='object'){return _0x4766e5(msgResponse(_0x4fc3('0x1c6'),'Failure','evt\x20is\x20undefine'));}_0x5e653b[_0x4fc3('0xc7')](_0xd5daca,_0x1acac5[_0x4fc3('0x11b')],_0x574d29)[_0x4fc3('0xc5')](function(_0x298b82){if(_0x298b82[_0x4fc3('0x12c')]==0x1)_0xb8f05a=!![];switch(_0x1acac5['reason']){case'0':_0x574d29[_0x4fc3('0x6f')]+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0x0;_0xd5daca[_0x4fc3('0xf5')]=_0x4fc3('0x1c8');_0xd5daca[_0x4fc3('0x102')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;ami[_0x4fc3('0x59')]('custom:agentnosuchnumber',ut[_0x4fc3('0xfa')](_0x2e54bc,_0x4fc3('0x1c9')));_0x40ec85=_0x574d29[_0x4fc3('0x1c2')];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];_0x5e653b[_0x4fc3('0xd9')](_0xd5daca)['catch'](loggerCatch(_0x4fc3('0x110')));if(_0x5e653b[_0x4fc3('0x1ca')](0x0,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca[_0x4fc3('0x102')]>=_0x574d29[_0x4fc3('0x1cb')]){_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1cc'));}else{_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x574d29[_0x4fc3('0x6e')]+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0x3;_0xd5daca[_0x4fc3('0xf5')]=_0x4fc3('0x1cd');_0xd5daca[_0x4fc3('0x101')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;var _0x3bb023=ut[_0x4fc3('0x1ce')](_0x2e54bc,_0x574d29);ami[_0x4fc3('0x59')](_0x4fc3('0x1cf'),_0x3bb023);_0x40ec85=_0x574d29[_0x4fc3('0x1ba')];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];_0x5e653b['createHistory'](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1d0')));if(_0x5e653b[_0x4fc3('0x1ca')](0x3,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca[_0x4fc3('0x101')]>=_0x574d29[_0x4fc3('0x1b9')]){_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1d1'));}else{_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1d1'));}}break;case'5':_0x574d29[_0x4fc3('0x1d2')]+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0x5;_0xd5daca[_0x4fc3('0xf5')]=_0x4fc3('0x1d3');_0xd5daca[_0x4fc3('0xff')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;ami[_0x4fc3('0x59')](_0x4fc3('0x1d4'),ut[_0x4fc3('0xfa')](_0x2e54bc,'busy'));_0x40ec85=_0x574d29['dialBusyRetryFrequency'];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];_0x5e653b[_0x4fc3('0xd9')](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1d5')));if(_0x5e653b[_0x4fc3('0x1ca')](0x5,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca[_0x4fc3('0xff')]>=_0x574d29[_0x4fc3('0x1bc')]){_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1d6'));}else{_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1d6'));}}break;case'8':_0x574d29[_0x4fc3('0x6a')]+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0x8;_0xd5daca['statedesc']=_0x4fc3('0x1d7');_0xd5daca[_0x4fc3('0x100')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;_0x40ec85=_0x574d29[_0x4fc3('0x1c0')];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];ami[_0x4fc3('0x59')](_0x4fc3('0x1d8'),ut[_0x4fc3('0xfa')](_0x2e54bc,_0x4fc3('0x1d9')));_0x5e653b[_0x4fc3('0xd9')](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1da')));if(_0x5e653b['checkRetriveMax'](0x8,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca[_0x4fc3('0x100')]>=_0x574d29[_0x4fc3('0x1bf')]){_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1db'));}else{_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1db'));}}break;case'11':_0x574d29[_0x4fc3('0x1dc')]+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0xb;_0xd5daca[_0x4fc3('0xf5')]='Abandoned';_0xd5daca[_0x4fc3('0x103')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;_0x40ec85=_0x574d29[_0x4fc3('0x134')];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];_0x5e653b[_0x4fc3('0xd9')](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x137')));if(_0x5e653b[_0x4fc3('0x1ca')](0xb,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca['countabandonedretry']>=_0x574d29[_0x4fc3('0x133')]){_0x5e653b['createStateFinal'](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1dd'));}else{_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,'reason\x2011\x20abandoned');}}break;case'20':_0x574d29['outboundRejectCallsDay']+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0x14;_0xd5daca[_0x4fc3('0xf5')]='AgentReject';_0xd5daca[_0x4fc3('0x104')]+=0x1;_0xd5daca[_0x4fc3('0x10f')]+=0x1;_0x40ec85=_0x574d29['dialAgentRejectRetryFrequency'];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];ami['emit'](_0x4fc3('0x1de'),ut[_0x4fc3('0xfa')](_0x2e54bc,_0x4fc3('0x1df')));_0x5e653b[_0x4fc3('0xd9')](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1e0')));if(_0x5e653b[_0x4fc3('0x1ca')](0x14,_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca[_0x4fc3('0x104')]>=_0x574d29['dialAgentRejectMaxRetry']){_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,'reason\x2020\x20agentreject');}else{_0x5e653b['stateGlobal'](_0xd5daca,_0x48f1bf,_0x4766e5,_0x4fc3('0x1e1'));}}break;default:_0x574d29['outboundUnknownCallsDay']+=0x1;_0xd5daca[_0x4fc3('0xb0')]=0xc;_0xd5daca[_0x4fc3('0xf5')]=_0x1acac5[_0x4fc3('0x11b')];_0x40ec85=_0x574d29['dialAgentRejectRetryFrequency'];_0x291ab3=_0x574d29[_0x4fc3('0x12a')];_0x5e653b['createHistory'](_0xd5daca)[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x1e2')));if(_0x5e653b[_0x4fc3('0x1ca')](_0x1acac5[_0x4fc3('0x11b')],_0x2e54bc,_0x574d29)&&!_0xb8f05a){if(_0xd5daca['countbusyretry']+_0xd5daca[_0x4fc3('0x100')]+_0xd5daca[_0x4fc3('0x101')]+_0xd5daca['countnosuchnumberretry']+_0xd5daca[_0x4fc3('0x128')]+_0xd5daca['countabandonedretry']+_0xd5daca[_0x4fc3('0xfe')]+_0xd5daca[_0x4fc3('0x104')]>=_0x574d29[_0x4fc3('0x1b8')]){_0x5e653b[_0x4fc3('0x105')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x1acac5[_0x4fc3('0x11b')]);}else{_0x5e653b[_0x4fc3('0x111')](_0xd5daca,_0x48f1bf,_0x4766e5,_0x1acac5[_0x4fc3('0x11b')]);}}}})[_0x4fc3('0xc5')](function(){if(_0xb8f05a){_0x5e653b[_0x4fc3('0xc9')](_0xd5daca,_0x40ec85,_0x291ab3)['then'](function(){return _0x48f1bf(0x1);});}});});};Dialer[_0x4fc3('0x20')][_0x4fc3('0x105')]=function(_0x506446,_0x57384d,_0x71a886,_0x34ab05){var _0x399171=new Final(_0x506446);_0x399171[_0x4fc3('0xb0')]=0xf;_0x399171['statedesc']=_0x4fc3('0x1e3');this[_0x4fc3('0x111')](_0x399171,_0x57384d,_0x71a886,_0x34ab05);};Dialer[_0x4fc3('0x20')][_0x4fc3('0x111')]=function(_0x4ce38d,_0x452178,_0x447d24,_0x5a225b){this[_0x4fc3('0xd8')](_0x4ce38d)[_0x4fc3('0xc5')](function(){return _0x452178(msgResponse('[callProgressDetecting]',_0x4fc3('0xe9'),_0x5a225b));})[_0x4fc3('0xc2')](function(){return _0x447d24(msgResponse(_0x4fc3('0x1e4'),_0x4fc3('0x158'),'contact\x20not\x20moved'));});};Dialer[_0x4fc3('0x20')][_0x4fc3('0x16e')]=function(_0x1c62fe){var _0x3b3432=_0x1c62fe[_0x4fc3('0x1e5')]/0x64;var _0x226d9f=_0x1c62fe[_0x4fc3('0x6d')]/(_0x1c62fe[_0x4fc3('0x6d')]+_0x1c62fe[_0x4fc3('0xf3')]);var _0xc1f175=Math[_0x4fc3('0x1e6')](_0x1c62fe[_0x4fc3('0x7b')]*(_0x1c62fe[_0x4fc3('0x1e7')]/0x64));var _0x445cae=Math['round'](_0x1c62fe[_0x4fc3('0x7b')]*(_0x1c62fe[_0x4fc3('0x1e8')]/0x64));var _0x1fe912=_0x1c62fe['available']+_0x1c62fe[_0x4fc3('0x1e9')];var _0x16981c=Math['floor'](_0x1c62fe['erlangCalls']*_0x1c62fe[_0x4fc3('0x80')]*_0x1c62fe[_0x4fc3('0x78')]*_0x1c62fe[_0x4fc3('0x79')]);if(_['isUndefined'](_0x1c62fe[_0x4fc3('0x2d')])){if(!_[_0x4fc3('0x47')](_0x1c62fe[_0x4fc3('0x81')])){_0x1c62fe[_0x4fc3('0x81')]=undefined;loggerPredictive[_0x4fc3('0xa0')](_0x4fc3('0x1ea'),_0x4fc3('0x1eb'));}if(!_[_0x4fc3('0x47')](_0x1c62fe[_0x4fc3('0x99')])){loggerPredictive[_0x4fc3('0xa0')](_0x4fc3('0x1ea'),_0x4fc3('0x1ec'));clearInterval(_0x1c62fe[_0x4fc3('0x99')]);_0x1c62fe[_0x4fc3('0x99')]=undefined;}_0x1c62fe[_0x4fc3('0x2d')]=moment()[_0x4fc3('0x85')](_0x4fc3('0x10a'));loggerPredictive[_0x4fc3('0x8a')](_0x1c62fe[_0x4fc3('0x4c')],_0x4fc3('0x1ed'),_0x1c62fe[_0x4fc3('0x2d')]);this[_0x4fc3('0x16b')](_0x1c62fe,0x1);}else if(ifInterval(_0x1c62fe[_0x4fc3('0x1ee')],_0x1c62fe[_0x4fc3('0x2d')])){this[_0x4fc3('0x16b')](_0x1c62fe,0x1);loggerPredictiveCalls[_0x4fc3('0x8a')](_0x4fc3('0x1ef'),_0x1c62fe['startProgressive'],_0x1c62fe['name']);_0x1c62fe[_0x4fc3('0x7e')]=0x0;_0x1c62fe[_0x4fc3('0x1f0')]=0x0;}else if(_0x3b3432<_0x226d9f&&_0x1c62fe[_0x4fc3('0x1f1')]===_0x4fc3('0x1f2')){freeVariablesPredictive(_0x1c62fe);loggerPredictive['info'](_0x4fc3('0x1f3'),_0x4fc3('0x1f4'),_0x226d9f,_0x4fc3('0x2d'),_0x1c62fe[_0x4fc3('0x4c')]);}else if(_0x16981c<_0x1c62fe[_0x4fc3('0x1f0')]&&_0x1c62fe[_0x4fc3('0x1f1')]===_0x4fc3('0x1f2')){freeVariablesPredictive(_0x1c62fe);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x1f5'),_0x4fc3('0x1f6'),_0x16981c,_0x4fc3('0x1f7'),_0x1c62fe[_0x4fc3('0x1f0')],_0x4fc3('0x2d'),_0x1c62fe[_0x4fc3('0x4c')]);}else if(!ifInterval(_0x1c62fe['dialPredictiveInterval'],_0x1c62fe[_0x4fc3('0x2d')])&&_[_0x4fc3('0x47')](_0x1c62fe[_0x4fc3('0x81')])&&!_[_0x4fc3('0x47')](_0x1c62fe['startProgressive'])){_0x1c62fe['startPredictive']=moment()[_0x4fc3('0x85')](_0x4fc3('0x10a'));loggerPredictive[_0x4fc3('0x8a')](_0x1c62fe['name'],_0x4fc3('0x1f8'),_0x1c62fe[_0x4fc3('0x81')]);this[_0x4fc3('0xcc')](_0x1c62fe['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x1c62fe))[_0x4fc3('0xc5')](mergeDataErlangB(_0x1c62fe))[_0x4fc3('0xc5')](this['startMethodPredictive'](_0x1c62fe))['catch'](loggerCatchPredictive(_0x4fc3('0x1f9'),_0x1c62fe));}else if(!ifInterval(_0x1c62fe[_0x4fc3('0x1ee')],_0x1c62fe[_0x4fc3('0x81')])){_0x1c62fe[_0x4fc3('0x1f0')]=0x0;_0x1c62fe['startPredictive']=moment()['format'](_0x4fc3('0x10a'));loggerPredictive[_0x4fc3('0x8a')](_0x1c62fe[_0x4fc3('0x4c')],_0x4fc3('0x1fa'),_0x1c62fe[_0x4fc3('0x81')]);clearInterval(_0x1c62fe[_0x4fc3('0x99')]);_0x1c62fe['handlePredictive']=undefined;this[_0x4fc3('0xcc')](_0x1c62fe[_0x4fc3('0x1ee')])[_0x4fc3('0xc5')](this['getDataPredictive'](_0x1c62fe))[_0x4fc3('0xc5')](mergeDataErlangB(_0x1c62fe))['then'](this['startMethodPredictive'](_0x1c62fe))[_0x4fc3('0xc2')](loggerCatchPredictive(_0x4fc3('0x1fb'),_0x1c62fe));}else if(_0x1c62fe[_0x4fc3('0x7b')]&&_0x1fe912<_0x1c62fe[_0x4fc3('0x7b')]-_0x445cae){freeVariablesPredictive(_0x1c62fe);loggerPredictive[_0x4fc3('0x8a')](_0x1c62fe[_0x4fc3('0x4c')],_0x4fc3('0x1fc'),_0x1fe912,_0x4fc3('0x1fd'),_0x1c62fe[_0x4fc3('0x7b')],'-',_0x445cae,'=',_0x1c62fe['predictiveIntervalAvailable']-_0x445cae,')');}else if(_0x1c62fe['predictiveIntervalAvailable']&&_0x1fe912>_0x1c62fe[_0x4fc3('0x7b')]+_0xc1f175){freeVariablesPredictive(_0x1c62fe);loggerPredictive[_0x4fc3('0x8a')](_0x1c62fe[_0x4fc3('0x4c')],_0x4fc3('0x1fc'),_0x1fe912,_0x4fc3('0x1fe'),_0x1c62fe[_0x4fc3('0x7b')],'+',_0xc1f175,'=',_0x1c62fe[_0x4fc3('0x7b')]+_0xc1f175,')');}};Dialer[_0x4fc3('0x20')]['getDataPredictive']=function(_0x28c424){var _0xcc16d6=this;return function(_0x57ad66){return new Promise(function(_0x549539,_0x5e28e4){_[_0x4fc3('0xe1')](_0x28c424,_0x57ad66[0x0]);if(checkGetDataPredictive(_0x57ad66[0x0])){var _0x29ba06=_0x28c424[_0x4fc3('0x7b')]=_0x28c424[_0x4fc3('0x1e9')]+_0x28c424[_0x4fc3('0x1ff')];var _0x536088=_0x28c424['dialPredictiveInterval']*0x3c;var _0xdce52e=_0x57ad66[0x0][_0x4fc3('0x76')]+_0x57ad66[0x0][_0x4fc3('0x75')];var _0x2ff48d=(_0x57ad66[0x0][_0x4fc3('0x74')]+_0x57ad66[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x57ad66[0x0][_0x4fc3('0x8e')])/_0x57ad66[0x0]['predictiveIntervalTotalCalls'];_0x28c424[_0x4fc3('0x78')]=_0x2ff48d>0x0?_0x2ff48d:0x1;switch(_0x28c424[_0x4fc3('0x1f1')]){case _0x4fc3('0x1f2'):var _0x3fb5db=_0x28c424[_0x4fc3('0x1e5')]/0x64;return _0xcc16d6[_0x4fc3('0x200')](_0x29ba06,_0x536088,_0xdce52e,_0x2ff48d,_0x3fb5db)[_0x4fc3('0xc5')](function(_0x14a51b){return _0x549539(_0x14a51b);});case _0x4fc3('0x201'):var _0x317b56=_0x28c424[_0x4fc3('0x1e5')]/0x64;return _0xcc16d6[_0x4fc3('0x202')](_0x29ba06,_0x536088,_0xdce52e,_0x2ff48d,_0x317b56)[_0x4fc3('0xc5')](function(_0x4090c5){return _0x549539(_0x4090c5);});default:return _0x5e28e4(msgResponse(_0x4fc3('0x203'),_0x4fc3('0x158'),_0x4fc3('0x204')));}}else{return _0x5e28e4(msgResponse(_0x4fc3('0x203'),_0x4fc3('0x158'),_0x4fc3('0x205')));}});};};Dialer[_0x4fc3('0x20')]['getDataPredictiveOld']=function(_0x9c84df){var _0x5b6f84=this;return function(_0x577a3e){return new Promise(function(_0x132c3e,_0x1b6254){_[_0x4fc3('0xe1')](_0x9c84df,_0x577a3e[0x0]);if(checkGetDataPredictive(_0x577a3e[0x0])){loggerPredictive[_0x4fc3('0x8a')](JSON[_0x4fc3('0x55')](_0x577a3e[0x0]));if(_0x9c84df[_0x4fc3('0x1f1')]==='dropRate'){return _0x5b6f84[_0x4fc3('0xd6')](_0x9c84df['id'])[_0x4fc3('0xc5')](function(_0x49ef1f){var _0x1510c5=_0x9c84df[_0x4fc3('0x5d')]-_0x49ef1f[0x0][_0x4fc3('0x206')];var _0x18e353=_0x9c84df[_0x4fc3('0x1ee')]*0x3c;var _0x3dc6b3=_0x577a3e[0x0][_0x4fc3('0x76')]+_0x577a3e[0x0][_0x4fc3('0x75')];var _0x49cbbe=(_0x577a3e[0x0]['predictiveIntervalAnsweredCalls']+_0x577a3e[0x0][_0x4fc3('0x77')]+_0x577a3e[0x0][_0x4fc3('0x8e')])/_0x577a3e[0x0][_0x4fc3('0x7c')];var _0x4281a7=_0x9c84df[_0x4fc3('0x1e5')]/0x64;_0x9c84df['predictiveIntervalPauses']=_0x49ef1f[0x0][_0x4fc3('0x206')]||0x0;_0x9c84df[_0x4fc3('0x78')]=_0x49cbbe>0x0?_0x49cbbe:0x1;return _0x5b6f84[_0x4fc3('0x200')](_0x1510c5,_0x18e353,_0x3dc6b3,_0x49cbbe,_0x4281a7);})[_0x4fc3('0xc5')](function(_0x37f16a){return _0x132c3e(_0x37f16a);})['catch'](function(_0x598343){return _0x1b6254(msgResponse(_0x4fc3('0x207'),_0x4fc3('0x158'),JSON['stringify'](_0x598343)));});}if(_0x9c84df[_0x4fc3('0x1f1')]===_0x4fc3('0x201')){return _0x5b6f84[_0x4fc3('0xd6')](_0x9c84df['id'])[_0x4fc3('0xc5')](function(_0x4a2e22){var _0xe25795=_0x9c84df['loggedIn']-_0x4a2e22[0x0][_0x4fc3('0x206')];var _0x4ed6bc=_0x9c84df[_0x4fc3('0x1ee')]*0x3c;var _0x34f35c=_0x577a3e[0x0]['predictiveIntervalAvgTalktime']+_0x577a3e[0x0][_0x4fc3('0x75')];var _0x3c8f96=(_0x577a3e[0x0]['predictiveIntervalAnsweredCalls']+_0x577a3e[0x0][_0x4fc3('0x77')]+_0x577a3e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x577a3e[0x0]['predictiveIntervalTotalCalls'];var _0x576181=_0x9c84df[_0x4fc3('0x1e5')]/0x64;_0x9c84df[_0x4fc3('0x7a')]=_0x4a2e22[0x0][_0x4fc3('0x206')]||0x0;_0x9c84df[_0x4fc3('0x78')]=_0x3c8f96>0x0?_0x3c8f96:0x1;return _0x5b6f84[_0x4fc3('0x202')](_0xe25795,_0x4ed6bc,_0x34f35c,_0x3c8f96,_0x576181);})[_0x4fc3('0xc5')](function(_0x1efcf0){return _0x132c3e(_0x1efcf0);})[_0x4fc3('0xc2')](function(_0x51b55c){return _0x1b6254(msgResponse('[CatchErlangB]',_0x4fc3('0x158'),JSON[_0x4fc3('0x55')](_0x51b55c)));});}}else{return _0x1b6254(msgResponse('[getDataPredictive]','Failure',_0x4fc3('0x205')));}});};};Dialer[_0x4fc3('0x20')][_0x4fc3('0x208')]=function(_0x548547){var _0x7a05a3=this;return function(){var _0x1a2541=0x0;var _0x5568b9=Math[_0x4fc3('0x209')](_0x548547[_0x4fc3('0x7f')]*0x3e8);if(_0x5568b9>0x0){_0x5568b9=_0x5568b9<0x64?0x64:_0x5568b9;loggerPredictive[_0x4fc3('0x8a')](_0x548547[_0x4fc3('0x4c')],'one\x20call\x20every:',_0x5568b9,_0x4fc3('0x56'));_0x548547[_0x4fc3('0x99')]=setInterval(function(){_0x7a05a3[_0x4fc3('0x99')](_0x548547);loggerPredictiveCalls[_0x4fc3('0x8a')](_0x4fc3('0x20a'),_0x1a2541+=0x1);},_0x5568b9);}else{loggerPredictive[_0x4fc3('0x8a')](_0x548547[_0x4fc3('0x4c')],_0x4fc3('0x20b'));}};};Dialer[_0x4fc3('0x20')][_0x4fc3('0x20c')]=function(_0x4c635b,_0x5d8b99){var _0x3ec57b=this;return function(_0x5cd620){if(_[_0x4fc3('0x51')](_0x5cd620)){if(_['isNil'](_0x5d8b99['UserId'])||!_0x5d8b99[_0x4fc3('0x20d')]){if(_0x4c635b[_0x4fc3('0x66')]==='booked'){_0x4c635b[_0x4fc3('0x140')]=_['isUndefined'](_0x4c635b[_0x4fc3('0x140')])?!![]:_0x4c635b[_0x4fc3('0x140')];var _0xf25883=uuid['v4']();_0x3ec57b[_0x4fc3('0xb6')][_0xf25883]=new Action(_0x4c635b,_0x5d8b99,_0xf25883);loggerBooked['info'](_0x4fc3('0x20e'),_0xf25883,_0x4fc3('0x20f'),JSON[_0x4fc3('0x55')](_0x4c635b['queueStatusComplete']),_0x4fc3('0x210'),_0x4c635b[_0x4fc3('0x4c')]);if(_0x4c635b[_0x4fc3('0x140')]){_0x4c635b['queueStatusComplete']=![];_0x3ec57b[_0x4fc3('0x2f')][_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xbe')]]=[];ami[_0x4fc3('0xb9')]({'actionid':_0xf25883,'action':_0x4fc3('0x211'),'queue':_0x4c635b[_0x4fc3('0x4c')]})[_0x4fc3('0xc2')](function(){_0x3ec57b['updateOriginated'](_0x4c635b);_0x3ec57b[_0x4fc3('0xce')]({'active':![],'ContactId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe3')],'ListId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe4')],'VoiceQueueId':_0x3ec57b['actions'][_0xf25883][_0x4fc3('0xe5')]||undefined,'CampaignId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe6')]||undefined})['catch'](loggerCatch(_0x4fc3('0x212')));delete _0x3ec57b[_0x4fc3('0xb6')][_0xf25883];});}else{loggerBooked['info'](_0x4fc3('0x213'),JSON[_0x4fc3('0x55')](_0x4c635b['queueStatusComplete']),_0x4fc3('0x210'),_0x4c635b[_0x4fc3('0x4c')]);_0x3ec57b['updateOriginated'](_0x4c635b);_0x3ec57b['rescheduleContact']({'active':![],'ContactId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe3')],'ListId':_0x3ec57b['actions'][_0xf25883]['ListId'],'VoiceQueueId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe5')]||undefined,'CampaignId':_0x3ec57b[_0x4fc3('0xb6')][_0xf25883][_0x4fc3('0xe6')]||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x212')));delete _0x3ec57b[_0x4fc3('0xb6')][_0xf25883];}}else{return _0x3ec57b[_0x4fc3('0x187')](_0x4c635b,_0x5d8b99);}}else{if(getDiff(_0x5d8b99[_0x4fc3('0x214')])<_0x4c635b[_0x4fc3('0x215')]*0x3c){if(_0x5d8b99[_0x4fc3('0x17f')]&&!_0x5d8b99['Agent']['voicePause']){_0x3ec57b[_0x4fc3('0x9b')][_0x4fc3('0x141')](_0x5d8b99['id'])[_0x4fc3('0x23')](function(){_0x3ec57b[_0x4fc3('0xbd')](_0x4c635b);});}else{_0x3ec57b[_0x4fc3('0xd0')]({'active':![]},_0x5d8b99['id'],0x1)[_0x4fc3('0x23')](function(){_0x3ec57b['updateOriginated'](_0x4c635b);});}}else{_0x4c635b[_0x4fc3('0x71')]+=0x1;_0x3ec57b[_0x4fc3('0xbd')](_0x4c635b);if(_0x4c635b[_0x4fc3('0x216')]){_0x3ec57b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d8b99[_0x4fc3('0xe3')],'ListId':_0x5d8b99['ListId'],'VoiceQueueId':_0x5d8b99['VoiceQueueId']||undefined,'CampaignId':_0x5d8b99['CampaignId']||undefined})[_0x4fc3('0xc2')](loggerCatch(_0x4fc3('0x217')));_0x3ec57b[_0x4fc3('0xd9')](createObjHistory(_0x4c635b,_0x5d8b99,_0x4fc3('0x218'),0x17,_0x4fc3('0x219')))['catch'](loggerCatch(_0x4fc3('0x21a')));}else{_0x3ec57b[_0x4fc3('0xe0')](createObjHistory(_0x4c635b,_0x5d8b99,_0x4fc3('0x21b'),0x16,_0x4fc3('0x21c')),'[Originate][HistoryRecallClose][historyCatch]',_0x4fc3('0x21d'));}}}}else{_0x4c635b['outboundBlacklistCallsDay']+=0x1;_0x3ec57b[_0x4fc3('0xe0')](createObjHistory(_0x4c635b,_0x5d8b99,_0x4fc3('0x21e'),0xd,_0x4fc3('0x21f')),_0x4fc3('0x220'),_0x4fc3('0x221'));throw _0x4fc3('0x222');}};};Dialer[_0x4fc3('0x20')][_0x4fc3('0x173')]=function(_0x4171da){var _0x39828f=this;var _0x5ddb55=_0x4171da['limitCalls']-_0x4171da[_0x4fc3('0x7d')]-_0x4171da[_0x4fc3('0xd3')];emitCampaignSummary(_0x4171da);if(_0x5ddb55>0x0){if(_0x5ddb55>this[_0x4fc3('0x29')]){_0x5ddb55=this[_0x4fc3('0x29')];}_0x4171da[_0x4fc3('0xd3')]+=_0x5ddb55;this[_0x4fc3('0xd4')](_0x4171da['id'],_0x5ddb55,_0x4171da[_0x4fc3('0x223')],_0x4171da)[_0x4fc3('0xc5')](function(_0x3c2a29){_0x4171da[_0x4fc3('0xd3')]-=_0x5ddb55;_0x4171da[_0x4fc3('0xd3')]=_0x4171da['temp']>0x0?_0x4171da[_0x4fc3('0xd3')]:0x0;if(!checkContactEmpty(_0x3c2a29)){_0x4171da[_0x4fc3('0x48')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x4fc3('0x8a')]('[getContactCampaign2][Empty]'+_0x4171da[_0x4fc3('0x4c')]);}else{_0x4171da[_0x4fc3('0x7d')]+=_0x3c2a29[_0x4fc3('0xa2')];_0x4171da[_0x4fc3('0x48')]=_0x4fc3('0x224');for(var _0x243029=0x0;_0x243029<_0x3c2a29[_0x4fc3('0xa2')];_0x243029+=0x1){_0x4171da[_0x4fc3('0x225')]+=0x1;if(_[_0x4fc3('0xb8')](_0x3c2a29[_0x243029])||_[_0x4fc3('0xb8')](_0x3c2a29[_0x243029]['Contact'])||_['isNil'](_0x3c2a29[_0x243029]['phone'])){_0x39828f[_0x4fc3('0xdf')](_0x4fc3('0x226'),_0x4171da,_0x3c2a29[_0x243029]);}else{_0x39828f['checkIsBlackListIvr'](_['pick'](_0x3c2a29[_0x243029],[_0x4fc3('0xe6'),_0x4fc3('0x227')]))[_0x4fc3('0xc5')](_0x39828f['checkContactBlack'](_0x4171da,_0x3c2a29[_0x243029]))[_0x4fc3('0xc2')](_0x39828f['loggerHandler'](_0x4fc3('0x228'),_0x4171da));}}}})[_0x4fc3('0xc2')](loggerGetContactDialer(_0x4fc3('0x229'),_0x4171da,_0x5ddb55));}};Dialer[_0x4fc3('0x20')][_0x4fc3('0x16b')]=function(_0x6b6305,_0x3b1398){var _0xb5eb90=this;var _0x4583f6=[];var _0x25dd6c=_0x3b1398>=0x1?_0x3b1398:0x1;if(_0x6b6305[_0x4fc3('0x66')]===_0x4fc3('0x9')){_0x25dd6c=0x1;}var _0x4a8f79=Math['floor'](_0x6b6305[_0x4fc3('0x1ff')]*_0x25dd6c)-_0x6b6305[_0x4fc3('0x7d')]-_0x6b6305[_0x4fc3('0xd3')];emitVoiceQueueSummary(_0x6b6305);if(_0x6b6305[_0x4fc3('0x22a')]>0x0){var _0x3de6ed=_0x6b6305[_0x4fc3('0x22a')]-_0x6b6305[_0x4fc3('0x7d')]-_0x6b6305['talking']-_0x6b6305[_0x4fc3('0xd3')]-_0x6b6305[_0x4fc3('0x5e')];if(_0x4a8f79>_0x3de6ed){_0x4a8f79=_0x3de6ed;}}if(_0x4a8f79>0x0){if(_0x6b6305[_0x4fc3('0x66')]===_0x4fc3('0x9')){_0x4a8f79=0x1;}if(_0x4a8f79>this[_0x4fc3('0x29')]){_0x4a8f79=this['maxNumberOriginate'];}_0x6b6305[_0x4fc3('0xd3')]+=_0x4a8f79;for(var _0x54d739 in this['agents']){if(typeof this[_0x4fc3('0x27')][_0x54d739]!==_0x4fc3('0xa3')){if(this[_0x4fc3('0x27')][_0x54d739][_0x4fc3('0xb0')]===_0x4fc3('0x22b')&&this[_0x4fc3('0x27')][_0x54d739]['status']===_0x4fc3('0xea')){_0x4583f6[_0x4fc3('0x13d')](this[_0x4fc3('0x27')][_0x54d739]['id']);}}}this[_0x4fc3('0xd2')](_0x6b6305['id'],_0x4583f6,_0x4a8f79,_0x6b6305[_0x4fc3('0x223')],_0x6b6305)[_0x4fc3('0xc5')](function(_0x50b323){_0x6b6305['temp']-=_0x4a8f79;_0x6b6305[_0x4fc3('0xd3')]=_0x6b6305['temp']>0x0?_0x6b6305[_0x4fc3('0xd3')]:0x0;if(!checkContactEmpty(_0x50b323)){_0xb5eb90[_0x4fc3('0xc0')](_0x6b6305)['then'](sendMessageReschedule(_0x6b6305))['catch'](loggerCatch(_0x4fc3('0xc3')));}else{_0x6b6305[_0x4fc3('0x7d')]+=_0x50b323[_0x4fc3('0xa2')];_0x6b6305[_0x4fc3('0x48')]=_0x6b6305[_0x4fc3('0x66')]===_0x4fc3('0x9')?_0x4fc3('0x22c'):'RUNNING';for(var _0x63c88c=0x0;_0x63c88c<_0x50b323[_0x4fc3('0xa2')];_0x63c88c+=0x1){if(_[_0x4fc3('0xb8')](_0x50b323[_0x63c88c])||_[_0x4fc3('0xb8')](_0x50b323[_0x63c88c][_0x4fc3('0x1a0')])||_[_0x4fc3('0xb8')](_0x50b323[_0x63c88c][_0x4fc3('0x18b')])){_0xb5eb90[_0x4fc3('0xdf')](_0x4fc3('0x226'),_0x6b6305,_0x50b323[_0x63c88c]);}else{_0xb5eb90[_0x4fc3('0xc4')](_[_0x4fc3('0xe2')](_0x50b323[_0x63c88c],['VoiceQueueId',_0x4fc3('0x227')]))['then'](_0xb5eb90[_0x4fc3('0x20c')](_0x6b6305,_0x50b323[_0x63c88c]))[_0x4fc3('0xc2')](_0xb5eb90[_0x4fc3('0xdd')](_0x4fc3('0x226'),_0x6b6305));}}}})[_0x4fc3('0xc2')](loggerGetContactDialer(_0x4fc3('0x22d'),_0x6b6305,_0x4a8f79));}};Dialer[_0x4fc3('0x20')][_0x4fc3('0x99')]=function(_0x35edf1){if(_0x35edf1[_0x4fc3('0x22a')]>0x0){var _0x29e29c=_0x35edf1['dialLimitQueue']-_0x35edf1['originated']-_0x35edf1[_0x4fc3('0x1e9')];if(_0x29e29c>0x0){this[_0x4fc3('0x22e')](_0x35edf1);}else{loggerPredictiveCalls[_0x4fc3('0x8a')](_0x4fc3('0x22f'));}}else{this['tryOriginatePredictive'](_0x35edf1);}};Dialer[_0x4fc3('0x20')]['tryOriginatePredictive']=function(_0x2c98dc){var _0x3097f3=this;var _0x528890=[];_0x2c98dc['originated']+=0x1;for(var _0x5b3c8a in this[_0x4fc3('0x27')]){if(typeof this[_0x4fc3('0x27')][_0x5b3c8a]!=='undefined'){if(this[_0x4fc3('0x27')][_0x5b3c8a][_0x4fc3('0xb0')]===_0x4fc3('0x22b')&&this[_0x4fc3('0x27')][_0x5b3c8a][_0x4fc3('0xba')]===_0x4fc3('0xea')){_0x528890[_0x4fc3('0x13d')](this[_0x4fc3('0x27')][_0x5b3c8a]['id']);}}}this[_0x4fc3('0xd2')](_0x2c98dc['id'],_0x528890,0x1,_0x2c98dc[_0x4fc3('0x223')],_0x2c98dc)[_0x4fc3('0xc5')](function(_0x322a7c){if(!checkContactEmpty(_0x322a7c)){checkContactLowerLimitOriginate(_0x2c98dc,0x1,0x0);_0x3097f3['countReScheduled'](_0x2c98dc)[_0x4fc3('0xc5')](sendMessageReschedule(_0x2c98dc))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x2c98dc[_0x4fc3('0x48')]=_0x4fc3('0x224');if(_[_0x4fc3('0xb8')](_0x322a7c[0x0])||_[_0x4fc3('0xb8')](_0x322a7c[0x0][_0x4fc3('0x1a0')])||_[_0x4fc3('0xb8')](_0x322a7c[0x0][_0x4fc3('0x18b')])){_0x3097f3['emptyContact'](_0x4fc3('0x226'),_0x2c98dc,_0x322a7c[0x0]);}else{_0x3097f3[_0x4fc3('0xc4')](_[_0x4fc3('0xe2')](_0x322a7c[0x0],['VoiceQueueId',_0x4fc3('0x227')]))[_0x4fc3('0xc5')](_0x3097f3[_0x4fc3('0x20c')](_0x2c98dc,_0x322a7c[0x0]))[_0x4fc3('0xc2')](_0x3097f3['loggerHandler'](_0x4fc3('0x230'),_0x2c98dc));}}})[_0x4fc3('0xc2')](loggerGetContactDialer(_0x4fc3('0x231'),_0x2c98dc,0x1));emitVoiceQueueSummary(_0x2c98dc);};Dialer[_0x4fc3('0x20')][_0x4fc3('0x200')]=function(_0x1c8a5f,_0x22e1c4,_0x2df120,_0x35bbcd,_0x1aa079,_0x1c29ed){loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x232'));loggerPredictive['info']('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',_0x1c8a5f);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x233'),_0x22e1c4);loggerPredictive[_0x4fc3('0x8a')]('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',_0x2df120);loggerPredictive['info']('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',_0x35bbcd);loggerPredictive[_0x4fc3('0x8a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa079);loggerPredictive[_0x4fc3('0x8a')]('---------------------------');return new Promise(function(_0x31d493,_0x26aa1e){if(_0x1c8a5f<=0x0||isNaN(_0x1c8a5f)){return _0x26aa1e(msgResponse(_0x4fc3('0x234'),_0x4fc3('0x54'),_0x4fc3('0x235')+_0x1c8a5f));}if(_0x2df120<=0x0||isNaN(_0x2df120)){return _0x26aa1e(msgResponse(_0x4fc3('0x234'),_0x4fc3('0x54'),_0x4fc3('0x236')+_0x2df120));}if(_0x35bbcd<=0x0||isNaN(_0x35bbcd)){return _0x26aa1e(msgResponse(_0x4fc3('0x234'),_0x4fc3('0x54'),_0x4fc3('0x237')+_0x35bbcd));}if(_0x22e1c4<=0x0||isNaN(_0x22e1c4)){return _0x26aa1e(msgResponse(_0x4fc3('0x234'),_0x4fc3('0x54'),_0x4fc3('0x238')+_0x22e1c4));}if(_0x1aa079<=0x0||isNaN(_0x1aa079)){return _0x26aa1e(msgResponse(_0x4fc3('0x234'),_0x4fc3('0x54'),'Amax\x20=\x20'+_0x1aa079));}_0x1c29ed=_0x1c29ed||0x0;var _0x1eebcf=0x1/_0x2df120;var _0x4a2d82=0x0;var _0x1993a7=0x0;var _0x4dcc22=0x0;var _0x1dd67c=0x0;for(var _0x5d4bb2=0x0;_0x4dcc22<_0x1aa079;_0x5d4bb2+=0x1){_0x1993a7=_0x5d4bb2/_0x22e1c4;_0x4a2d82=(_0x35bbcd*_0x1993a7+_0x1c29ed)/_0x1eebcf;_0x4dcc22=erlangb(_0x4a2d82,_0x1c8a5f);_0x1dd67c=_0x4a2d82/_0x1c8a5f*(0x1-erlangb(_0x4a2d82,_0x1c8a5f));}return _0x31d493({'erlangCalls':_0x5d4bb2,'erlangCallToSecond':_0x22e1c4/_0x5d4bb2,'erlangAbandonmentRate':_0x4dcc22,'erlangBusyFactor':_0x1dd67c});});};Dialer[_0x4fc3('0x20')][_0x4fc3('0x202')]=function(_0x33de3f,_0x2ded27,_0x218a61,_0x35def5,_0x206fe6,_0x23d46b){loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x239'));loggerPredictive['info'](_0x4fc3('0x23a'),_0x33de3f);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x233'),_0x2ded27);loggerPredictive[_0x4fc3('0x8a')]('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',_0x218a61);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x23b'),_0x35def5);loggerPredictive[_0x4fc3('0x8a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x206fe6);loggerPredictive[_0x4fc3('0x8a')](_0x4fc3('0x90'));return new Promise(function(_0x900627,_0x5bb20){if(_0x33de3f<=0x0||isNaN(_0x33de3f)){return _0x5bb20(msgResponse(_0x4fc3('0x23c'),_0x4fc3('0x54'),_0x4fc3('0x235')+_0x33de3f));}if(_0x218a61<=0x0||isNaN(_0x218a61)){return _0x5bb20(msgResponse(_0x4fc3('0x23c'),_0x4fc3('0x54'),_0x4fc3('0x236')+_0x218a61));}if(_0x35def5<=0x0||isNaN(_0x35def5)){return _0x5bb20(msgResponse(_0x4fc3('0x23c'),_0x4fc3('0x54'),_0x4fc3('0x237')+_0x35def5));}if(_0x2ded27<=0x0||isNaN(_0x2ded27)){return _0x5bb20(msgResponse(_0x4fc3('0x23c'),_0x4fc3('0x54'),_0x4fc3('0x238')+_0x2ded27));}if(_0x206fe6<=0x0||isNaN(_0x206fe6)){return _0x5bb20(msgResponse(_0x4fc3('0x23c'),_0x4fc3('0x54'),_0x4fc3('0x23d')+_0x206fe6));}_0x23d46b=_0x23d46b||0x0;var _0x179890=0x1/_0x218a61;var _0xe3ba7e=0x0;var _0xaf7657=0x0;var _0x4675b4=0x0;var _0x33a0d4=0x0;for(var _0x542ee8=0x0;_0x33a0d4<_0x206fe6;_0x542ee8+=0x1){_0xaf7657=_0x542ee8/_0x2ded27;_0xe3ba7e=(_0x35def5*_0xaf7657+_0x23d46b)/_0x179890;_0x4675b4=erlangb(_0xe3ba7e,_0x33de3f);_0x33a0d4=_0xe3ba7e/_0x33de3f*(0x1-erlangb(_0xe3ba7e,_0x33de3f));}return _0x900627({'erlangCalls':_0x542ee8,'erlangCallToSecond':_0x2ded27/_0x542ee8,'erlangAbandonmentRate':_0x4675b4,'erlangBusyFactor':_0x33a0d4});});};module[_0x4fc3('0x23e')]=Dialer; \ No newline at end of file +var _0x3ec1=['No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','CampaignId','isSuccess','Success','SIP/%s','reachable','unmonitored','saveInDb','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','statedesc','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','VoiceQueueId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','AMD','countglobal','countnosuchnumberretry','reason19\x20machine....','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','responsetime','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','iftime\x20%s,%s','timezones','content','true','indexOf','all','some','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','map','user:dialPreviewRecallReminder','\x5cw{0,','pow','replace','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','busy','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','booked','[actionOriginate]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\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','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','debug','inspect','error','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','clearZombieChannels','undefined','Action','status','channel','catch'];(function(_0x2c9daf,_0x3428bb){var _0xecd76b=function(_0x85e25d){while(--_0x85e25d){_0x2c9daf['push'](_0x2c9daf['shift']());}};_0xecd76b(++_0x3428bb);}(_0x3ec1,0x173));var _0x13ec=function(_0x39b732,_0x4fff2c){_0x39b732=_0x39b732-0x0;var _0x20176d=_0x3ec1[_0x39b732];return _0x20176d;};'use strict';var util=require(_0x13ec('0x0'));var _=require(_0x13ec('0x1'));var uuid=require(_0x13ec('0x2'));var moment=require(_0x13ec('0x3'));var rr=require('rr');var md5=require(_0x13ec('0x4'));var Redis=require(_0x13ec('0x5'));var ut=require(_0x13ec('0x6'));var config=require('../../../config/environment/');var logger=require(_0x13ec('0x7'))(_0x13ec('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require('../../../config/logger')(_0x13ec('0x9'));var loggerPredictiveCalls=require(_0x13ec('0x7'))(_0x13ec('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x13ec('0xb'));config['redis']=_[_0x13ec('0xc')](config[_0x13ec('0xd')],{'host':_0x13ec('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x13ec('0xf'));var cmHopperHistory=require(_0x13ec('0x10'));var cmHopperAdditionalPhone=require(_0x13ec('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x13ec('0x12'));var RpcSetting=require(_0x13ec('0x13'));var Action=require(_0x13ec('0x14'));var History=require(_0x13ec('0x15'));var Final=require(_0x13ec('0x16'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x13ec('0x17'));var ipAgi=process['env'][_0x13ec('0x18')]||_0x13ec('0x19');var strategy={'rrmemory':_0x13ec('0x1a'),'roundrobin':_0x13ec('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x13ec('0x1c')][_0x13ec('0x1d')]=function(_0x98b456){this[_0x13ec('0x1e')]=this[_0x13ec('0x1e')]?this[_0x13ec('0x1e')][_0x13ec('0x1f')](_0x98b456):_0x98b456();};function Dialer(_0x15520,_0x2f80c0){this[_0x13ec('0x20')]=new Sequence();this[_0x13ec('0x21')]=_0x2f80c0;this[_0x13ec('0x22')]=_0x15520['voiceQueues'];this['campaigns']=_0x15520[_0x13ec('0x23')];this['agents']=_0x15520[_0x13ec('0x24')];this[_0x13ec('0x25')]=_0x15520[_0x13ec('0x25')];this[_0x13ec('0x26')]=config[_0x13ec('0x26')]||0x2;this[_0x13ec('0x27')]={};this[_0x13ec('0x28')]={};this[_0x13ec('0x29')]={};this[_0x13ec('0x2a')]={};this['optionPredictive']={};this[_0x13ec('0x2b')]={};this[_0x13ec('0x2c')]={};this[_0x13ec('0x2d')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x13ec('0x2e'),this[_0x13ec('0x2f')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x31'),this[_0x13ec('0x32')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x33'),this[_0x13ec('0x34')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x35'),this[_0x13ec('0x36')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x37'),this[_0x13ec('0x38')][_0x13ec('0x30')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x39'),this[_0x13ec('0x3a')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x3b'),this[_0x13ec('0x3c')][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x3d'),this['syncVarSet'][_0x13ec('0x30')](this));ami['on'](_0x13ec('0x3e'),this[_0x13ec('0x3f')][_0x13ec('0x30')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x13ec('0x30')](this));this[_0x13ec('0x40')]();this[_0x13ec('0x41')]();RpcSetting[_0x13ec('0x42')]()[_0x13ec('0x43')](function(_0x4e0a38){previewRecallmeReminderInterval=_0x4e0a38['previewRecallmeReminderInterval'];});}function isNotNull(_0x2eb9d4){return _0x2eb9d4!==null&&!_[_0x13ec('0x44')](_0x2eb9d4);}function checkIsLoggedIn(_0x1cd4f4,_0x4f15a0){return function(){if(_0x4f15a0<=0x0){_0x1cd4f4[_0x13ec('0x45')]=_0x13ec('0x46');throw _0x1cd4f4[_0x13ec('0x47')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1f85bd){return _0x1f85bd;}function checkIsActive(_0x4d8b7c,_0x19e07b){return function(){if(!isActive(_0x19e07b)){_0x4d8b7c[_0x13ec('0x45')]=_0x13ec('0x48');throw _0x4d8b7c[_0x13ec('0x47')]+_0x13ec('0x49');}};}function checkInterval(_0x16f83d){return function(){if(!isNotNull(_0x16f83d[_0x13ec('0x4a')])){_0x16f83d[_0x13ec('0x45')]=_0x13ec('0x4b');throw _0x16f83d[_0x13ec('0x47')]+_0x13ec('0x4c');}if(!isNotNull(_0x16f83d[_0x13ec('0x4a')]['Intervals'])){_0x16f83d[_0x13ec('0x45')]='INTERVAL_IS_NULL';throw _0x16f83d['name']+_0x13ec('0x4c');}if(!isNotNull(_['isEmpty'](_0x16f83d[_0x13ec('0x4a')]['Intervals']))){_0x16f83d[_0x13ec('0x45')]='INTERVAL_IS_NULL';throw _0x16f83d[_0x13ec('0x47')]+_0x13ec('0x4c');}};}function msgResponse(_0x483225,_0x2fe376,_0x29a7d2){return{'action':_0x483225,'response':_0x2fe376,'message':_0x29a7d2,'stack':_0x29a7d2};}function myreject(_0x308172){return function(_0x1f6820){return _0x308172(msgResponse(_0x13ec('0x4d'),_0x13ec('0x4e'),JSON[_0x13ec('0x4f')](_0x1f6820)));};}function getSeconds(_0x55d0ac,_0x193ce1){var _0x526790=moment(_0x55d0ac)[_0x13ec('0x50')](0x0);var _0xd77894=moment(_0x193ce1)[_0x13ec('0x50')](0x0);return _0x526790['diff'](_0xd77894,_0x13ec('0x51'));}function emit(_0x29e241,_0x3f06d2,_0x116285){io['to'](_0x29e241)[_0x13ec('0x52')](_0x3f06d2,_0x116285);}function emitVoiceQueueSummary(_0x1ca28f){if(_0x1ca28f[_0x13ec('0x53')]===_0x13ec('0x54')){var _0x3450ed={'id':_0x1ca28f['id'],'name':_0x1ca28f[_0x13ec('0x47')],'strategy':_0x1ca28f[_0x13ec('0x55')],'answered':_0x1ca28f[_0x13ec('0x56')],'available':_0x1ca28f[_0x13ec('0x57')],'loggedIn':_0x1ca28f[_0x13ec('0x58')],'pTalking':_0x1ca28f['pTalking'],'sumBillable':_0x1ca28f[_0x13ec('0x59')],'sumDuration':_0x1ca28f[_0x13ec('0x5a')],'sumHoldTime':_0x1ca28f[_0x13ec('0x5b')]||0x0,'talking':_0x1ca28f[_0x13ec('0x5c')],'total':_0x1ca28f[_0x13ec('0x5d')],'type':_0x1ca28f[_0x13ec('0x53')],'unmanaged':_0x1ca28f[_0x13ec('0x5e')],'abandoned':_0x1ca28f[_0x13ec('0x5f')],'waiting':_0x1ca28f['waiting'],'loggedInDb':_0x1ca28f[_0x13ec('0x60')],'dialActive':_0x1ca28f[_0x13ec('0x61')],'dialMethod':_0x1ca28f[_0x13ec('0x62')],'dialOriginateCallerIdName':_0x1ca28f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1ca28f[_0x13ec('0x63')],'dialOriginateTimeout':_0x1ca28f[_0x13ec('0x64')],'dialPrefix':_0x1ca28f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1ca28f[_0x13ec('0x65')],'outboundAnswerCallsDay':_0x1ca28f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1ca28f[_0x13ec('0x66')],'outboundBusyCallsDay':_0x1ca28f[_0x13ec('0x67')],'outboundCongestionCallsDay':_0x1ca28f[_0x13ec('0x68')],'outboundDropCallsDayACS':_0x1ca28f[_0x13ec('0x69')],'outboundDropCallsDayCallersExit':_0x1ca28f[_0x13ec('0x6a')],'outboundDropCallsDayTimeout':_0x1ca28f[_0x13ec('0x6b')],'outboundNoAnswerCallsDay':_0x1ca28f[_0x13ec('0x6c')],'outboundNoSuchCallsDay':_0x1ca28f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1ca28f[_0x13ec('0x6d')],'outboundReCallsDay':_0x1ca28f[_0x13ec('0x6e')],'outboundRejectCallsDay':_0x1ca28f[_0x13ec('0x6f')],'outboundUnknownCallsDay':_0x1ca28f[_0x13ec('0x70')],'predictiveIntervalAnsweredCalls':_0x1ca28f[_0x13ec('0x71')],'predictiveIntervalAvgHoldtime':_0x1ca28f[_0x13ec('0x72')],'predictiveIntervalAvgTalktime':_0x1ca28f[_0x13ec('0x73')],'predictiveIntervalDroppedCallsCallersExit':_0x1ca28f[_0x13ec('0x74')],'predictiveIntervalDroppedCallsTimeout':_0x1ca28f[_0x13ec('0x75')],'predictiveIntervalErlangCalls':_0x1ca28f[_0x13ec('0x76')],'predictiveIntervalErlangCallsDroppedCalls':_0x1ca28f[_0x13ec('0x77')],'predictiveIntervalHitRate':_0x1ca28f[_0x13ec('0x78')],'predictiveIntervalMultiplicativeFactor':_0x1ca28f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1ca28f[_0x13ec('0x79')],'predictiveIntervalAvailable':_0x1ca28f[_0x13ec('0x7a')],'predictiveIntervalTotalCalls':_0x1ca28f[_0x13ec('0x7b')],'message':_0x1ca28f[_0x13ec('0x45')],'originated':_0x1ca28f[_0x13ec('0x7c')],'erlangCalls':_0x1ca28f[_0x13ec('0x7d')],'erlangCallToSecond':_0x1ca28f[_0x13ec('0x7e')],'erlangAbandonmentRate':_0x1ca28f[_0x13ec('0x7f')],'erlangBusyFactor':_0x1ca28f[_0x13ec('0x80')],'startPredictive':_0x1ca28f[_0x13ec('0x2b')],'startProgressive':_0x1ca28f[_0x13ec('0x2c')]};if(_0x1ca28f[_0x13ec('0x81')]){_0x3450ed['Trunk']={'id':_0x1ca28f[_0x13ec('0x81')]['id'],'name':_0x1ca28f[_0x13ec('0x81')][_0x13ec('0x47')],'active':_0x1ca28f['Trunk'][_0x13ec('0x82')],'callerid':_0x1ca28f['Trunk'][_0x13ec('0x83')]};}if(_0x1ca28f[_0x13ec('0x4a')]){_0x3450ed[_0x13ec('0x4a')]={'id':_0x1ca28f['Interval']['id'],'name':_0x1ca28f[_0x13ec('0x4a')][_0x13ec('0x47')]};}var _0x2859a8=md5(JSON[_0x13ec('0x4f')](_0x3450ed));if(_0x1ca28f[_0x13ec('0x4')]!==_0x2859a8){_0x1ca28f[_0x13ec('0x4')]=_0x2859a8;emit(util[_0x13ec('0x84')](_0x13ec('0x85'),_0x3450ed['name']),_0x13ec('0x86'),_0x3450ed);}}}function emitCampaignSummary(_0x494459){if(_0x494459[_0x13ec('0x53')]===_0x13ec('0x87')){emit(util[_0x13ec('0x84')](_0x13ec('0x88'),_0x494459['name']),_0x13ec('0x89'),_0x494459);}}function checkGetDataPredictive(_0x5599df){if(isNotNull(_0x5599df)&&!_['isEmpty'](_0x5599df)){loggerPredictive['info'](_0x13ec('0x8a'));loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x8c'),_0x5599df[_0x13ec('0x7b')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x8d'),_0x5599df[_0x13ec('0x71')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x8e'),_0x5599df[_0x13ec('0x75')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x8f'),_0x5599df[_0x13ec('0x74')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x90'),_0x5599df[_0x13ec('0x72')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x91'),_0x5599df['predictiveIntervalAvgTalktime']);loggerPredictive[_0x13ec('0x8b')]('---------------------------');if(_0x5599df[_0x13ec('0x7b')]>0x0){if(!_[_0x13ec('0x44')](_0x5599df[_0x13ec('0x73')])&&_0x5599df[_0x13ec('0x73')]>0x0){return!![];}loggerPredictive['info'](_0x13ec('0x92'));if(!_['isUndefined'](_0x5599df[_0x13ec('0x72')])&&_0x5599df[_0x13ec('0x72')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x13ec('0x93'));}}else{loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x94'));}return![];}function mergeDataErlangB(_0x20b86a){return function(_0x1f6621){loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x95'));loggerPredictive[_0x13ec('0x8b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f6621[_0x13ec('0x7d')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x96'),_0x1f6621[_0x13ec('0x7e')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x97'),_0x1f6621[_0x13ec('0x7f')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x98'),_0x1f6621[_0x13ec('0x80')]);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x97'),_0x1f6621['erlangAbandonmentRate']);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x99'));_[_0x13ec('0x9a')](_0x20b86a,_0x1f6621);};}function getDiff(_0x5ec1d7){var _0x5470ab=moment()[_0x13ec('0x50')](0x0);var _0x38867b=moment(_0x5ec1d7)['milliseconds'](0x0);return _0x5470ab['diff'](_0x38867b,'seconds');}function ifInterval(_0x225037,_0x1ac810){if(_[_0x13ec('0x44')](_0x1ac810)){return![];}return getDiff(_0x1ac810)<_0x225037*0x3c;}function freeVariablesPredictive(_0x521702){if(isNotNull(_0x521702)){if(!_[_0x13ec('0x44')](_0x521702[_0x13ec('0x2c')])){_0x521702[_0x13ec('0x2c')]=undefined;loggerPredictive[_0x13ec('0x8b')](_0x521702[_0x13ec('0x47')],_0x13ec('0x9b'));}if(!_[_0x13ec('0x44')](_0x521702[_0x13ec('0x2b')])){_0x521702[_0x13ec('0x2b')]=undefined;loggerPredictive[_0x13ec('0x8b')](_0x521702[_0x13ec('0x47')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x13ec('0x44')](_0x521702[_0x13ec('0x9c')])){clearInterval(_0x521702[_0x13ec('0x9c')]);_0x521702['handlePredictive']=undefined;loggerPredictive[_0x13ec('0x8b')](_0x521702[_0x13ec('0x47')],_0x13ec('0x9d'));}}}function erlangb(_0x283f37,_0x5da77e){if(_0x5da77e===0x0){return 0x0;}var _0x2a3a9e=0x1;for(var _0x1f8c4e=0x1;_0x1f8c4e<=_0x5da77e;_0x1f8c4e+=0x1){_0x2a3a9e=0x1+_0x2a3a9e*_0x1f8c4e/_0x283f37;}return 0x1/_0x2a3a9e;}function isVoiceQueueOutbound(_0x415309){return _0x415309===_0x13ec('0x54');}function isNotPreview(_0x399b0e){return _0x399b0e!==_0x13ec('0x21');}function isCampaignIvr(_0x53a2ce){return _0x53a2ce===_0x13ec('0x87');}function getCallerId(_0x153a99,_0x19546b,_0x3e6da1){if(!_['isUndefined'](_0x3e6da1)&&typeof _0x3e6da1===_0x13ec('0x9e')&&!_[_0x13ec('0x9f')](_0x3e6da1)){if(!_[_0x13ec('0x44')](_0x19546b)&&typeof _0x19546b===_0x13ec('0x9e')&&!_[_0x13ec('0x9f')](_0x19546b)){return util[_0x13ec('0x84')](_0x13ec('0xa0'),_0x19546b,_0x3e6da1);}return util[_0x13ec('0x84')]('\x22%s\x22\x20<%s>',_0x3e6da1,_0x3e6da1);}if(!_[_0x13ec('0x44')](_0x153a99)&&typeof _0x153a99===_0x13ec('0x9e')&&!_['isEmpty'](_0x153a99)){return _0x153a99;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1d8104,_0x4a9827){return function(_0x44c7af){freeVariablesPredictive(_0x4a9827);emitVoiceQueueSummary(_0x4a9827);emitCampaignSummary(_0x4a9827);loggerSyncQueueSummary[_0x13ec('0xa1')](_0x1d8104,util[_0x13ec('0xa2')](_0x44c7af,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x572318,_0x5c864b){return function(_0x3a7ef8){loggerPredictive['error'](_0x5c864b['name'],_0x572318);loggerPredictive['error'](_0x3a7ef8['stack']);freeVariablesPredictive(_0x5c864b);};}function loggerCatch(_0x515d12){return function(_0xe9444f){logger[_0x13ec('0xa3')](_0x515d12,util[_0x13ec('0xa2')](_0xe9444f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x61777e){return _0x61777e&&!_[_0x13ec('0x44')](_0x61777e)&&_0x61777e[_0x13ec('0xa4')]>0x0;}function decremetOriginate(_0x35373c){if(!_[_0x13ec('0x44')](_0x35373c)&&_0x35373c!==null){if(typeof _0x35373c['originated']!=='undefined'){if(_0x35373c[_0x13ec('0x7c')]>0x0){_0x35373c['originated']-=0x1;}else{logger[_0x13ec('0xa3')](_0x13ec('0xa5'));}}}else{logger['error'](_0x13ec('0xa6'));}}function checkContactLowerLimitOriginate(_0x3dd9ad,_0x2922b5,_0x20a914){if(_0x2922b5>_0x20a914){for(var _0x26ef59=0x0;_0x26ef59<_0x2922b5-_0x20a914;_0x26ef59+=0x1){decremetOriginate(_0x3dd9ad);}}}function loggerGetContactDialer(_0x59cfdd,_0x177ebe,_0x58e546){return function(_0x18a0a9){checkContactLowerLimitOriginate(_0x177ebe,_0x58e546,0x0);logger[_0x13ec('0xa3')](_0x59cfdd,util[_0x13ec('0xa2')](_0x18a0a9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xd45eff){return function(_0x3cf935){if(isNotNull(_0x3cf935)&&isNotNull(_0x3cf935[0x0])){if(_0x3cf935[0x0][_0x13ec('0xa7')]>0x0){_0xd45eff['message']=_0x13ec('0xa8');logger[_0x13ec('0x8b')]('[getContactDialer2][ReScheduled]'+_0xd45eff[_0x13ec('0x47')],_0x3cf935[0x0][_0x13ec('0xa7')],_0x13ec('0xa9'));}else{_0xd45eff[_0x13ec('0x45')]=_0x13ec('0xaa');logger[_0x13ec('0x8b')]('[getContactDialer2][Empty]'+_0xd45eff[_0x13ec('0x47')]);}}};}function notSendMessagesQueue(_0x43f4c4){if(_0x43f4c4[_0x13ec('0xab')]){freeVariablesPredictive(_0x43f4c4);if(_0x43f4c4[_0x13ec('0x7c')]===0x0&&_0x43f4c4[_0x13ec('0x5c')]===0x0&&_0x43f4c4[_0x13ec('0xac')]===0x0&&(_0x43f4c4[_0x13ec('0xad')]||0x0)===0x0){_0x43f4c4[_0x13ec('0xab')]=![];_0x43f4c4[_0x13ec('0x57')]=0x0;_0x43f4c4[_0x13ec('0x45')]=_0x13ec('0x48');loggerSyncQueueSummary[_0x13ec('0xa1')](_0x13ec('0xae'),_0x43f4c4[_0x13ec('0x47')],'is\x20not\x20active');}else{_0x43f4c4['message']=_0x13ec('0xaf');loggerSyncQueueSummary[_0x13ec('0xa1')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x43f4c4['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x43f4c4);}}function notSendMessagesCampaign(_0x1b7f53){if(_0x1b7f53[_0x13ec('0xab')]){if(_0x1b7f53[_0x13ec('0x7c')]===0x0){_0x1b7f53['sendMessageOneNotActive']=![];_0x1b7f53[_0x13ec('0x45')]=_0x13ec('0x48');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1b7f53[_0x13ec('0x47')],'is\x20not\x20active');}else{_0x1b7f53[_0x13ec('0x45')]=_0x13ec('0xaf');loggerSyncQueueSummary[_0x13ec('0xa1')](_0x13ec('0xb0'),_0x1b7f53[_0x13ec('0x47')],_0x13ec('0xb1'));}emitCampaignSummary(_0x1b7f53);}}function createObjHistory(_0x179f92,_0x5252bc,_0x2313e9,_0x367755,_0xaf8704){_0x179f92[_0x13ec('0x45')]=_0x2313e9;var _0x120747=new Action(_0x179f92,_0x5252bc);var _0x59a519=new History(_0x120747);_0x59a519[_0x13ec('0xb2')]=_0x367755;_0x59a519['statedesc']=_0xaf8704;_0x59a519[_0x13ec('0xb3')]=_0x120747['starttime'];return _0x59a519;}Dialer[_0x13ec('0x1c')][_0x13ec('0x41')]=function(){var _0x2da1b2=this;setInterval(function(){_0x2da1b2[_0x13ec('0xb4')](_0x2da1b2[_0x13ec('0x2a')],'[uniqueid]');_0x2da1b2[_0x13ec('0xb4')](_0x2da1b2[_0x13ec('0x28')],'[actions]');},0x32c8);};Dialer[_0x13ec('0x1c')]['clearZombieChannels']=function(_0x5825cf,_0x13a6f8){var _0x241fdb=this;for(var _0xf5588f in _0x5825cf){if(typeof _0x5825cf[_0xf5588f]!==_0x13ec('0xb5')){this[_0x13ec('0x20')]['enqueue'](function(){if(!_['isNil'](_0x5825cf[_0xf5588f])){return ami[_0x13ec('0xb6')]({'action':_0x13ec('0xb7'),'channel':_0x5825cf[_0xf5588f][_0x13ec('0xb8')]})[_0x13ec('0xb9')](function(_0x4efadc){if(_0x4efadc[_0x13ec('0x45')]===_0x13ec('0xba')){setTimeout(function(){if(_0x5825cf[_0xf5588f]&&_0x5825cf[_0xf5588f][_0x13ec('0x53')]!==_0x13ec('0x87')){_0x241fdb['updateOriginated'](_0x241fdb[_0x13ec('0x22')][_0x5825cf[_0xf5588f][_0x13ec('0xbb')]]);logger[_0x13ec('0xa3')](_0x13ec('0xbc'),_0x13a6f8,_0xf5588f,_0x5825cf[_0xf5588f][_0x13ec('0xbb')]);delete _0x5825cf[_0xf5588f];}if(_0x5825cf[_0xf5588f]&&_0x5825cf[_0xf5588f][_0x13ec('0x53')]===_0x13ec('0x87')){_0x241fdb[_0x13ec('0xbd')](_0x241fdb[_0x13ec('0x23')][_0x5825cf[_0xf5588f][_0x13ec('0xbb')]]);logger[_0x13ec('0xa3')](_0x13ec('0xbe'),_0x13a6f8,_0xf5588f,_0x5825cf[_0xf5588f][_0x13ec('0xbb')]);delete _0x5825cf[_0xf5588f];}},0x2328);}});}});}}};Dialer[_0x13ec('0x1c')][_0x13ec('0xbf')]=function(_0x969d6e){return Promise['resolve']()[_0x13ec('0x43')](cmHopper[_0x13ec('0xbf')](_0x969d6e))['catch'](loggerCatch(_0x13ec('0xc0')));};Dialer[_0x13ec('0x1c')]['checkIsBlackList']=function(_0x100730){return Promise[_0x13ec('0xc1')]()['then'](cmHopperBlack[_0x13ec('0xc2')](_0x100730))['catch'](loggerCatch(_0x13ec('0xc3')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xc4')]=function(_0x36fd4c,_0x20e28a,_0x291cba){return Promise['resolve']()[_0x13ec('0x43')](cmHopperAdditionalPhone[_0x13ec('0xc4')](_0x36fd4c,_0x20e28a,_0x291cba))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xc5')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xc6')]=function(_0x14db1d,_0x2d4123,_0x39def5){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](cmHopperAdditionalPhone[_0x13ec('0xc6')](_0x14db1d,_0x2d4123,_0x39def5))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xc7')));};Dialer[_0x13ec('0x1c')]['checkIsBlackListIvr']=function(_0x406357){return Promise['resolve']()['then'](cmHopperBlack[_0x13ec('0xc8')](_0x406357))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xc9')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xca')]=function(_0x245a72){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](cmHopperHistory[_0x13ec('0xcb')](_0x245a72))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xcc')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xcd')]=function(_0x3391ff){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](cmHopper['rescheduleContact'](_0x3391ff))['catch'](loggerCatch(_0x13ec('0xce')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xcf')]=function(_0x1f10a2,_0x17e8e0,_0x19f0c4){return Promise['resolve']()[_0x13ec('0x43')](cmHopper['unlockContact'](_0x1f10a2,_0x17e8e0,_0x19f0c4))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xd0')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xd1')]=function(_0x1e9520,_0x16a790,_0x411b99,_0x5a703b,_0x168d4e){return Promise['resolve']()[_0x13ec('0x43')](cmHopper['getContactDialer'](_0x1e9520,_0x16a790,_0x411b99,_0x5a703b))[_0x13ec('0xb9')](function(_0x4119b9){_0x168d4e['temp']-=_0x411b99;_0x168d4e['temp']=_0x168d4e[_0x13ec('0xd2')]>0x0?_0x168d4e[_0x13ec('0xd2')]:0x0;loggerCatch(_0x13ec('0xd3'))(_0x4119b9);});};Dialer[_0x13ec('0x1c')][_0x13ec('0xd4')]=function(_0x306c38,_0xd195dc,_0x444e89,_0xca4262){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](cmHopper['getContactDialerIvr'](_0x306c38,_0xd195dc,_0x444e89))['catch'](function(_0x281e7b){_0xca4262[_0x13ec('0xd2')]-=_0xd195dc;_0xca4262[_0x13ec('0xd2')]=_0xca4262[_0x13ec('0xd2')]>0x0?_0xca4262[_0x13ec('0xd2')]:0x0;loggerCatch(_0x13ec('0xd5'))(_0x281e7b);});};Dialer[_0x13ec('0x1c')][_0x13ec('0xd6')]=function(_0x323d75){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](voiceQueueRt[_0x13ec('0xd6')](_0x323d75))[_0x13ec('0xb9')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x13ec('0x1c')][_0x13ec('0xd7')]=function(_0x36895c){return Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](cmHopper[_0x13ec('0xd7')](_0x36895c))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xd8')));};Dialer[_0x13ec('0x1c')][_0x13ec('0xd9')]=function(_0x250521){return Promise['resolve']()[_0x13ec('0x43')](cmHopperHistory[_0x13ec('0xd9')](_0x250521))[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xda')));};Dialer['prototype'][_0x13ec('0xbd')]=function(_0x314757){if(!_[_0x13ec('0x44')](_0x314757)&&_0x314757!==null){if(typeof _0x314757[_0x13ec('0x7c')]!==_0x13ec('0xb5')){if(_0x314757['originated']>0x0){_0x314757['originated']-=0x1;}else{logger[_0x13ec('0xa3')](_0x13ec('0xdb'));}}}else{logger[_0x13ec('0xa3')](_0x13ec('0xdc'));}};Dialer[_0x13ec('0x1c')][_0x13ec('0xdd')]=function(_0x54e85f,_0x2bfe02){var _0x10b711=this;return function(_0x34ee79){_0x10b711[_0x13ec('0xbd')](_0x2bfe02);logger[_0x13ec('0xa3')](_0x54e85f,util['inspect'](_0x34ee79,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x13ec('0xde')]=function(_0x2c13bf,_0xf7523f,_0x48fce3){var _0x84a61={'state':0x19,'statedesc':_0x13ec('0xdf')};this[_0x13ec('0xbd')](_0xf7523f);this['saveInDb'](_[_0x13ec('0x9a')](_0x84a61,_[_0x13ec('0xe0')](_0x48fce3,[_0x13ec('0xe1'),_0x13ec('0xe2'),_0x13ec('0xe3'),'VoiceQueueId',_0x13ec('0xe4')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x13ec('0xa3')](_0x2c13bf);};Dialer[_0x13ec('0x1c')][_0x13ec('0xe5')]=function(_0x5114b4){return _0x5114b4===_0x13ec('0xe6');};Dialer[_0x13ec('0x1c')]['isTrunkReachable']=function(_0x5a5fb3){return!_['isUndefined'](_0x5a5fb3)&&_0x5a5fb3&&!_['isUndefined'](_0x5a5fb3[_0x13ec('0x47')])&&!_['isUndefined'](_0x5a5fb3[_0x13ec('0x82')])&&_0x5a5fb3[_0x13ec('0x82')]&&(this[_0x13ec('0x25')][util[_0x13ec('0x84')](_0x13ec('0xe7'),_0x5a5fb3['name'])][_0x13ec('0xb7')]===_0x13ec('0xe8')||this[_0x13ec('0x25')][util[_0x13ec('0x84')](_0x13ec('0xe7'),_0x5a5fb3[_0x13ec('0x47')])][_0x13ec('0xb7')]===_0x13ec('0xe9'));};Dialer[_0x13ec('0x1c')][_0x13ec('0xea')]=function(_0x5165fd,_0x2fe36e,_0x10064d){this[_0x13ec('0xd9')](_0x5165fd)['catch'](loggerCatch(_0x2fe36e));this[_0x13ec('0xd7')](_0x5165fd)['catch'](loggerCatch(_0x10064d));};Dialer['prototype'][_0x13ec('0xeb')]=function(_0x2782d3){var _0x548f15=this;var _0x5ab96d=this[_0x13ec('0x2a')][_0x2782d3[_0x13ec('0xec')]];var _0x3cef9d;if(!_[_0x13ec('0xed')](_0x2782d3)&&!_['isNil'](_0x2782d3[_0x13ec('0xee')])&&!_[_0x13ec('0xed')](_0x2782d3[_0x13ec('0xee')][_0x13ec('0xef')])&&_0x2782d3[_0x13ec('0xf0')]===_0x13ec('0xf1')&&_0x5ab96d){if(_0x5ab96d[_0x13ec('0x53')]!==_0x13ec('0x87')&&this[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf2')]&&_0x2782d3[_0x13ec('0xf3')]===_0x13ec('0xf4')){delete this[_0x13ec('0x2a')][_0x2782d3[_0x13ec('0xec')]];this[_0x13ec('0xbd')](this[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]]);this[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf5')]+=0x1;this['voiceQueues'][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0x65')]+=0x1;_0x3cef9d=new Hangup(_0x5ab96d,_0x2782d3);_0x3cef9d[_0x13ec('0xb2')]=0x12;_0x3cef9d[_0x13ec('0xf6')]='HangupInAMD';_0x3cef9d[_0x13ec('0xf7')]='AMD';ami[_0x13ec('0x52')](_0x13ec('0xf8'),ut[_0x13ec('0xf9')](_0x3cef9d,_0x13ec('0xfa')));this[_0x13ec('0xea')](_0x3cef9d,_0x13ec('0xfb'),'[syncHangupInAMD]');}if(_0x5ab96d[_0x13ec('0x53')]!==_0x13ec('0x87')&&this[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf2')]&&_0x2782d3[_0x13ec('0xf3')]===_0x13ec('0xfc')){return new Promise(function(_0x152a0a,_0x2b6308){delete _0x548f15[_0x13ec('0x2a')][_0x2782d3['uniqueid']];_0x548f15['updateOriginated'](_0x548f15[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]]);_0x548f15[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf5')]+=0x1;_0x548f15[_0x13ec('0x22')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0x65')]+=0x1;var _0x5d7ddd=_0x548f15['voiceQueues'][_0x5ab96d[_0x13ec('0xbb')]];var _0x2797ab=new Hangup(_0x5ab96d,_0x2782d3);_0x2797ab[_0x13ec('0xb2')]=0x13;_0x2797ab['statedesc']='Machine';_0x2797ab['membername']='AMD';_0x2797ab['countmachineretry']+=0x1;_0x2797ab['countglobal']+=0x1;_0x2797ab[_0x13ec('0xfa')]=!![];ami[_0x13ec('0x52')](_0x13ec('0xf8'),ut[_0x13ec('0xf9')](_0x2797ab,_0x13ec('0xfa')));_0x548f15[_0x13ec('0xd9')](_0x2797ab)['catch'](loggerCatch(_0x13ec('0xfd')));if(_0x2797ab[_0x13ec('0xfe')]+_0x2797ab[_0x13ec('0xff')]+_0x2797ab[_0x13ec('0x100')]+_0x2797ab['countnosuchnumberretry']+_0x2797ab[_0x13ec('0x101')]+_0x2797ab[_0x13ec('0x102')]+_0x2797ab[_0x13ec('0x103')]+_0x2797ab[_0x13ec('0x104')]>=_0x5d7ddd[_0x13ec('0x105')]){_0x548f15[_0x13ec('0x106')](_0x2797ab,_0x152a0a,_0x2b6308,'reason19\x20machine....');}else{if(_0x2797ab[_0x13ec('0x103')]>=_0x5d7ddd[_0x13ec('0x107')]){_0x548f15[_0x13ec('0x108')](_0x2797ab,_0x152a0a,_0x2b6308,_0x13ec('0x109'));}else{_0x548f15[_0x13ec('0xcd')]({'active':![],'countmachineretry':_0x2797ab[_0x13ec('0x103')],'scheduledat':moment()[_0x13ec('0x10a')](_0x5d7ddd['dialMachineRetryFrequency'],_0x13ec('0x10b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2797ab[_0x13ec('0xe1')],'ListId':_0x2797ab[_0x13ec('0xe2')],'VoiceQueueId':_0x2797ab[_0x13ec('0x10c')]||undefined,'CampaignId':_0x2797ab[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x152a0a({'reschedule':0x1});}}});}if(_0x5ab96d['type']===_0x13ec('0x87')&&this[_0x13ec('0x23')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf2')]&&_0x2782d3[_0x13ec('0xf3')]===_0x13ec('0xf4')){delete this['uniqueId'][_0x2782d3['uniqueid']];this[_0x13ec('0xbd')](this[_0x13ec('0x23')][_0x5ab96d[_0x13ec('0xbb')]]);_0x3cef9d=new Hangup(_0x5ab96d,_0x2782d3);_0x3cef9d[_0x13ec('0xb2')]=0x12;_0x3cef9d[_0x13ec('0xf6')]=_0x13ec('0x10d');_0x3cef9d[_0x13ec('0xf7')]='AMD';ami[_0x13ec('0x52')](_0x13ec('0xf8'),ut[_0x13ec('0xf9')](_0x3cef9d,'amd'));this[_0x13ec('0xea')](_0x3cef9d,_0x13ec('0x10e'),_0x13ec('0x10f'));}if(_0x5ab96d[_0x13ec('0x53')]===_0x13ec('0x87')&&this['campaigns'][_0x5ab96d[_0x13ec('0xbb')]]['dialAMDActive']&&_0x2782d3[_0x13ec('0xf3')]==='MACHINE'){return new Promise(function(_0x44160a,_0xa9655){delete _0x548f15[_0x13ec('0x2a')][_0x2782d3[_0x13ec('0xec')]];_0x548f15['updateOriginated'](_0x548f15[_0x13ec('0x23')][_0x5ab96d['queue']]);_0x548f15[_0x13ec('0x23')][_0x5ab96d[_0x13ec('0xbb')]][_0x13ec('0xf5')]+=0x1;_0x548f15['campaigns'][_0x5ab96d[_0x13ec('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x19465c=_0x548f15['campaigns'][_0x5ab96d[_0x13ec('0xbb')]];var _0x2f3cdf=new Hangup(_0x5ab96d,_0x2782d3);_0x2f3cdf['state']=0x13;_0x2f3cdf['statedesc']=_0x13ec('0x110');_0x2f3cdf[_0x13ec('0xf7')]=_0x13ec('0x111');_0x2f3cdf[_0x13ec('0x103')]+=0x1;_0x2f3cdf[_0x13ec('0x112')]+=0x1;_0x2f3cdf['amd']=!![];ami[_0x13ec('0x52')](_0x13ec('0xf8'),ut[_0x13ec('0xf9')](_0x2f3cdf,_0x13ec('0xfa')));_0x548f15[_0x13ec('0xd9')](_0x2f3cdf)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0xfd')));if(_0x2f3cdf[_0x13ec('0xfe')]+_0x2f3cdf[_0x13ec('0xff')]+_0x2f3cdf[_0x13ec('0x100')]+_0x2f3cdf[_0x13ec('0x113')]+_0x2f3cdf[_0x13ec('0x101')]+_0x2f3cdf[_0x13ec('0x102')]+_0x2f3cdf[_0x13ec('0x103')]+_0x2f3cdf[_0x13ec('0x104')]>=_0x19465c[_0x13ec('0x105')]){_0x548f15['stateGlobal'](_0x2f3cdf,_0x44160a,_0xa9655,_0x13ec('0x114'));}else{if(_0x2f3cdf[_0x13ec('0x103')]>=_0x19465c[_0x13ec('0x107')]){_0x548f15['createStateFinal'](_0x2f3cdf,_0x44160a,_0xa9655,_0x13ec('0x109'));}else{_0x548f15[_0x13ec('0xcd')]({'active':![],'countmachineretry':_0x2f3cdf[_0x13ec('0x103')],'scheduledat':moment()[_0x13ec('0x10a')](_0x19465c['dialMachineRetryFrequency'],_0x13ec('0x10b'))['format'](_0x13ec('0x115')),'ContactId':_0x2f3cdf['ContactId'],'ListId':_0x2f3cdf[_0x13ec('0xe2')],'VoiceQueueId':_0x2f3cdf[_0x13ec('0x10c')]||undefined,'CampaignId':_0x2f3cdf[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x116')));_0x44160a({'reschedule':0x1});}}});}}};Dialer[_0x13ec('0x1c')][_0x13ec('0x3a')]=function(_0x1eed4c){var _0x550353=this[_0x13ec('0x2a')][_0x1eed4c[_0x13ec('0xec')]];var _0x2a7706;if(_0x550353&&_0x550353['type']===_0x13ec('0x87')){delete this[_0x13ec('0x2a')][_0x1eed4c['uniqueid']];this['updateOriginated'](this[_0x13ec('0x23')][_0x550353['queue']]);this['campaigns'][_0x550353['queue']][_0x13ec('0x117')]+=0x1;_0x2a7706=new Hangup(_0x550353,_0x1eed4c);this[_0x13ec('0xd9')](_0x2a7706)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x118')));this[_0x13ec('0xd7')](_0x2a7706)['catch'](loggerCatch(_0x13ec('0x119')));}if(_0x550353&&_0x550353[_0x13ec('0x53')]!==_0x13ec('0x87')&&isNotNull(this[_0x13ec('0x22')][_0x550353['queue']][_0x13ec('0x11a')])){delete this['uniqueId'][_0x1eed4c[_0x13ec('0xec')]];this[_0x13ec('0xbd')](this[_0x13ec('0x22')][_0x550353[_0x13ec('0xbb')]]);this['voiceQueues'][_0x550353['queue']][_0x13ec('0xf5')]+=0x1;this[_0x13ec('0x22')][_0x550353[_0x13ec('0xbb')]][_0x13ec('0x65')]+=0x1;_0x2a7706=new Hangup(_0x550353,_0x1eed4c);_0x2a7706[_0x13ec('0xb2')]=0x10;_0x2a7706[_0x13ec('0xf6')]=_0x13ec('0x11b');_0x2a7706[_0x13ec('0xf7')]=_0x13ec('0x11c');this['createHistory'](_0x2a7706)['catch'](loggerCatch(_0x13ec('0x118')));this['moveContactManagedDialer'](_0x2a7706)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x119')));}if(_0x550353&&_0x550353[_0x13ec('0x53')]!==_0x13ec('0x87')&&!isNotNull(this['voiceQueues'][_0x550353[_0x13ec('0xbb')]][_0x13ec('0x11a')])){delete this[_0x13ec('0x2a')][_0x1eed4c['uniqueid']];this[_0x13ec('0xbd')](this[_0x13ec('0x22')][_0x550353[_0x13ec('0xbb')]]);this[_0x13ec('0x22')][_0x550353['queue']]['outboundUnknownCallsDay']+=0x1;_0x2a7706=new Hangup(_0x550353,_0x1eed4c);_0x2a7706[_0x13ec('0xb2')]=0xc;_0x2a7706['statedesc']=_0x1eed4c['cause-txt'];_0x2a7706[_0x13ec('0xf7')]=_0x13ec('0x11d');this[_0x13ec('0xd9')](_0x2a7706)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x118')));this['moveContactManagedDialer'](_0x2a7706)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x13ec('0x1c')][_0x13ec('0x36')]=function(_0x5583d9){var _0xbbaa3e=this[_0x13ec('0x2a')][_0x5583d9[_0x13ec('0xec')]];if(this[_0x13ec('0x22')][_0x5583d9[_0x13ec('0xbb')]]){if(_0xbbaa3e&&_0xbbaa3e[_0x13ec('0x53')]!==_0x13ec('0x87')){delete this[_0x13ec('0x2a')][_0x5583d9[_0x13ec('0xec')]];this[_0x13ec('0x22')][_0x5583d9[_0x13ec('0xbb')]]['outboundAnswerCallsDay']+=0x1;var _0x416ba4=new AgentComplete(_0xbbaa3e,_0x5583d9);if(_0x5583d9[_0x13ec('0x11e')]===_0x13ec('0x11f')){_0x416ba4[_0x13ec('0x120')]=this[_0x13ec('0x22')][_0x5583d9[_0x13ec('0xbb')]][_0x13ec('0x121')]&&this[_0x13ec('0x22')][_0x5583d9[_0x13ec('0xbb')]][_0x13ec('0x122')]?moment()[_0x13ec('0x84')](_0x13ec('0x115')):undefined;}this['createHistory'](_0x416ba4)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x416ba4)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x123')));}}};Dialer[_0x13ec('0x1c')][_0x13ec('0x2f')]=function(_0x4b79bd){if(this['voiceQueues'][_0x4b79bd['queue']]){if(this['uniqueId'][_0x4b79bd[_0x13ec('0xec')]]&&this[_0x13ec('0x2a')][_0x4b79bd[_0x13ec('0xec')]][_0x13ec('0x53')]!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x4b79bd[_0x13ec('0xbb')]]);this[_0x13ec('0x2a')][_0x4b79bd['uniqueid']][_0x13ec('0x124')]=moment()[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x13ec('0x1c')][_0x13ec('0x125')]=function(_0x3c8340,_0x342344){this['createHistory'](_0x3c8340)['catch'](loggerCatch(_0x13ec('0x126')));if(_0x342344==0x0){this[_0x13ec('0xd7')](_0x3c8340)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x13ec('0x1c')][_0x13ec('0x32')]=function(_0x24e7c3){var _0x4a003e=this['uniqueId'][_0x24e7c3['uniqueid']];var _0x8355d6=this;var _0x1d8afe=![];var _0x27801d;var _0x35d265;if(this[_0x13ec('0x22')][_0x24e7c3['queue']]){if(_0x4a003e&&_0x4a003e[_0x13ec('0x53')]!=='ivr'){delete this[_0x13ec('0x2a')][_0x24e7c3[_0x13ec('0xec')]];this[_0x13ec('0xbd')](this[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]]);_0x4a003e[_0x13ec('0x127')]=moment()[_0x13ec('0x84')](_0x13ec('0x115'));var _0x20150a=new QueueCallerAbandon(_0x4a003e,_0x24e7c3);if(getSeconds(_0x4a003e[_0x13ec('0x127')],_0x4a003e[_0x13ec('0x128')])>=_0x4a003e['dialQueueTimeout']){this['voiceQueues'][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x75')]+=0x1;this['voiceQueues'][_0x24e7c3['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x24e7c3['queue']][_0x13ec('0x77')]+=0x1;_0x20150a[_0x13ec('0xb2')]=0xa;_0x20150a[_0x13ec('0xf6')]=_0x13ec('0x129');_0x20150a['dropreason']=_0x13ec('0x12a');_0x20150a[_0x13ec('0x120')]=this[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x121')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x20150a[_0x13ec('0x101')]+=0x1;_0x20150a[_0x13ec('0x112')]+=0x1;_0x27801d=this[_0x13ec('0x22')][_0x24e7c3['queue']][_0x13ec('0x12b')];_0x35d265=this[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x12c')];_0x8355d6[_0x13ec('0xc4')](_0x20150a,_0x20150a[_0x13ec('0xb2')],_0x4a003e[_0x13ec('0x12d')])[_0x13ec('0x43')](function(_0x2b2c96){_0x1d8afe=_0x2b2c96[_0x13ec('0x12e')]==0x1;if(_0x20150a[_0x13ec('0x101')]>=_0x8355d6['voiceQueues'][_0x24e7c3['queue']][_0x13ec('0x12f')]){_0x8355d6[_0x13ec('0x125')](_0x20150a,_0x2b2c96['additional']);}else{_0x8355d6[_0x13ec('0xcd')]({'active':![],'countdropretry':_0x20150a['countdropretry'],'scheduledat':moment()[_0x13ec('0x10a')](_0x8355d6[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x12b')],_0x13ec('0x10b'))[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a003e[_0x13ec('0xe1')],'ListId':_0x4a003e[_0x13ec('0xe2')],'VoiceQueueId':_0x4a003e[_0x13ec('0x10c')]||undefined,'CampaignId':_0x4a003e[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x130')));var _0x34dcde=new History(_0x20150a);_0x34dcde[_0x13ec('0xb2')]=0xa;_0x34dcde[_0x13ec('0xf6')]=_0x13ec('0x129');_0x34dcde[_0x13ec('0x131')]=moment()[_0x13ec('0x84')](_0x13ec('0x115'));_0x34dcde['endtime']=_0x34dcde['starttime'];_0x34dcde[_0x13ec('0x132')]=_0x20150a[_0x13ec('0x132')];_0x34dcde[_0x13ec('0x133')]=_0x20150a[_0x13ec('0x133')];_0x8355d6[_0x13ec('0xd9')](_0x34dcde)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x1d8afe)_0x8355d6['swapAdditionalPhones'](_0x20150a,_0x27801d,_0x35d265)[_0x13ec('0x43')](function(){return 0x1;});});}else{this[_0x13ec('0x22')][_0x24e7c3['queue']][_0x13ec('0x74')]+=0x1;this[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x6a')]+=0x1;_0x20150a[_0x13ec('0xb2')]=0xb;_0x20150a['statedesc']='Abandoned';_0x20150a[_0x13ec('0x134')]=_0x13ec('0x135');_0x20150a[_0x13ec('0x102')]+=0x1;_0x20150a['countglobal']+=0x1;_0x27801d=this['voiceQueues'][_0x24e7c3['queue']]['dialAbandonedRetryFrequency'];_0x35d265=this['voiceQueues'][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x12c')];_0x8355d6['verifyAdditionalPhones'](_0x20150a,_0x20150a[_0x13ec('0xb2')],_0x4a003e[_0x13ec('0x12d')])[_0x13ec('0x43')](function(_0x3e31f4){if(_0x20150a['countabandonedretry']>=_0x8355d6[_0x13ec('0x22')][_0x24e7c3['queue']]['dialAbandonedMaxRetry']){_0x8355d6['queueCallerAbandonCreateState'](_0x20150a,_0x3e31f4['additional']);}else{_0x8355d6[_0x13ec('0xcd')]({'active':![],'countabandonedretry':_0x20150a['countabandonedretry'],'scheduledat':moment()[_0x13ec('0x10a')](_0x8355d6[_0x13ec('0x22')][_0x24e7c3[_0x13ec('0xbb')]][_0x13ec('0x136')],_0x13ec('0x10b'))[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a003e[_0x13ec('0xe1')],'ListId':_0x4a003e[_0x13ec('0xe2')],'VoiceQueueId':_0x4a003e['VoiceQueueId']||undefined,'CampaignId':_0x4a003e[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x57db83=new History(_0x20150a);_0x57db83['state']=0xb;_0x57db83[_0x13ec('0xf6')]=_0x13ec('0x137');_0x57db83[_0x13ec('0x131')]=moment()[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss');_0x57db83[_0x13ec('0xb3')]=_0x57db83[_0x13ec('0x131')];_0x57db83['calleridname']=_0x20150a['calleridname'];_0x57db83['calleridnum']=_0x20150a[_0x13ec('0x133')];_0x8355d6[_0x13ec('0xd9')](_0x57db83)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x138')));}})[_0x13ec('0x43')](function(){if(_0x1d8afe)_0x8355d6[_0x13ec('0xc6')](_0x20150a,_0x27801d,_0x35d265)[_0x13ec('0x43')](function(){return 0x1;});});}}}};Dialer[_0x13ec('0x1c')]['syncNewExten']=function(_0x30bdf2){if(this[_0x13ec('0x28')][_0x30bdf2['uniqueid']]){this[_0x13ec('0x28')][_0x30bdf2[_0x13ec('0xec')]]['channel']=_0x30bdf2['channel'];}if(this[_0x13ec('0x2a')][_0x30bdf2[_0x13ec('0xec')]]){this[_0x13ec('0x2a')][_0x30bdf2[_0x13ec('0xec')]][_0x13ec('0xb8')]=_0x30bdf2[_0x13ec('0xb8')];}};Dialer[_0x13ec('0x1c')][_0x13ec('0x3f')]=function(_0x3a805f){if(strategy[this[_0x13ec('0x22')][this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0xbb')]][_0x13ec('0x55')]]===_0x13ec('0x1b')){if(this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]]&&_['isNil'](this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0x13a')])&&_0x3a805f[_0x13ec('0xb7')]==='1'&&_0x3a805f[_0x13ec('0x13b')]==='0'){if(this['agents'][_0x3a805f[_0x13ec('0x13c')]]){if(!this[_0x13ec('0x24')][_0x3a805f[_0x13ec('0x13c')]][_0x13ec('0x13a')]){this[_0x13ec('0x24')][_0x3a805f[_0x13ec('0x13c')]]['locked']=!![];this['actions'][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0x13a')]=!![];this['actions'][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0x13c')]=_0x3a805f[_0x13ec('0x13c')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x3a805f['actionid']][_0x13ec('0xbb')]]['strategy']]||'rrmemory')==='rrmemory'){if(this['actions'][_0x3a805f['actionid']]){if(this[_0x13ec('0x24')][_0x3a805f[_0x13ec('0x13c')]]){this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0x13c')]=_0x3a805f['stateinterface'];if(_['isNil'](this[_0x13ec('0x13d')][this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0xbb')]])){this['queueBooked'][this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]][_0x13ec('0xbb')]]=[];}this[_0x13ec('0x13d')][this[_0x13ec('0x28')][_0x3a805f['actionid']][_0x13ec('0xbb')]]['push'](_[_0x13ec('0x9a')](_[_0x13ec('0xe0')](this[_0x13ec('0x28')][_0x3a805f[_0x13ec('0x139')]],['idHopper','stateinterface']),{'status':_0x3a805f['status'],'paused':_0x3a805f[_0x13ec('0x13b')]}));}}}};function unlockQueueStatus(_0x1ef086,_0x53b58c){setTimeout(function(){if(_[_0x13ec('0x44')](_0x1ef086[_0x13ec('0x13e')])){loggerBooked['error'](_0x13ec('0x13f'),_0x53b58c);}_0x1ef086[_0x13ec('0x13e')]=!![];loggerBooked[_0x13ec('0x8b')](_0x13ec('0x140'),_0x53b58c,JSON[_0x13ec('0x4f')](_[_0x13ec('0xe0')](_0x1ef086,[_0x13ec('0x47'),_0x13ec('0x13e')])));},0x1f3);}Dialer[_0x13ec('0x1c')][_0x13ec('0x141')]=function(_0x27155a){var _0x5bad80=this;var _0xa0a1a=_0x5bad80[_0x13ec('0x22')][_0x5bad80[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]['queue']];if(strategy[this['voiceQueues'][this[_0x13ec('0x28')][_0x27155a['actionid']][_0x13ec('0xbb')]][_0x13ec('0x55')]]===_0x13ec('0x1b')){if(this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]&&this['actions'][_0x27155a['actionid']][_0x13ec('0x13c')]){this[_0x13ec('0x21')][_0x13ec('0x142')](this['actions'][_0x27155a['actionid']][_0x13ec('0x143')],this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0x13c')])[_0x13ec('0xb9')](function(_0x2f6db4){logger[_0x13ec('0xa3')](_0x13ec('0x144'),util[_0x13ec('0xa2')](_0x2f6db4,{'showHidden':![],'depth':null}));})[_0x13ec('0x1f')](function(){_0x5bad80[_0x13ec('0xbd')](_0x5bad80['voiceQueues'][_0x5bad80[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]]);_0x5bad80['agents'][_0x5bad80[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0x13c')]][_0x13ec('0x13a')]=![];delete _0x5bad80['actions'][_0x27155a[_0x13ec('0x139')]];unlockQueueStatus(_0xa0a1a);});}else{this[_0x13ec('0xbd')](this[_0x13ec('0x22')][this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]['ContactId'],'ListId':this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xe2')],'VoiceQueueId':this['actions'][_0x27155a[_0x13ec('0x139')]][_0x13ec('0x10c')]||undefined,'CampaignId':this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xe4')]||undefined})['catch'](loggerCatch(_0x13ec('0x145')));delete this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]];unlockQueueStatus(_0xa0a1a);}}else if((strategy[this['voiceQueues'][this['actions'][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]][_0x13ec('0x55')]]||_0x13ec('0x1a'))===_0x13ec('0x1a')){var _0x51039c;if(this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]&&!_['isEmpty'](this[_0x13ec('0x13d')][this[_0x13ec('0x28')][_0x27155a['actionid']][_0x13ec('0xbb')]])){if(this[_0x13ec('0x146')][_0x5bad80['actions'][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]]){this[_0x13ec('0x146')][_0x5bad80[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]]=this[_0x13ec('0x146')][this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]]?this['queueBookedRR'][this['actions'][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]]:this['queueBooked'][this['actions'][_0x27155a['actionid']][_0x13ec('0xbb')]]?this[_0x13ec('0x13d')][this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]][_0x13ec('0x147')]||0x0:0x0;}this[_0x13ec('0x13d')][this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]]['queue']][_0x13ec('0x147')]=this[_0x13ec('0x146')][this[_0x13ec('0x28')][_0x27155a[_0x13ec('0x139')]][_0x13ec('0xbb')]];for(var _0x237e56=0x0;_0x237e56=0x0;})[_0x13ec('0xb9')](myreject(_0x667fcf)));}}else{_0x12d8cb[_0x13ec('0x15c')](ami[_0x13ec('0xb6')]({'action':'command','command':util[_0x13ec('0x84')](_0x13ec('0x15d'),_0x5050fb,!_[_0x13ec('0x44')](config[_0x13ec('0x15e')][_0x52dc77])?_0x52dc77:'')})[_0x13ec('0x43')](function(_0x56475a){return _0x56475a[_0x13ec('0x15f')][_0x13ec('0x161')]('true')>=0x0;})[_0x13ec('0xb9')](myreject(_0x667fcf)));}Promise[_0x13ec('0x162')](_0x12d8cb)[_0x13ec('0x43')](function(_0x2e6c0c){var _0x1cfa87=_[_0x13ec('0x163')](_0x2e6c0c);if(_0x1cfa87){return _0x47c641(_0x1cfa87);}else{_0xbbc397[_0x13ec('0x45')]=_0x3ca599?'GLOBAL_INTERVAL_IS_OVERTIME':_0x13ec('0x164');return _0x667fcf(msgResponse('[ifTime][promiseAll]',_0x13ec('0x157'),_0x13ec('0x165')+_0x3ca599+'\x20'+_0x5c80aa+_0x13ec('0x166')+util[_0x13ec('0xa2')](_0x5050fb,{'showHidden':![],'depth':null})+_0x13ec('0x167')+_0x52dc77));}})[_0x13ec('0xb9')](function(_0x736a69){return _0x667fcf(msgResponse(_0x13ec('0x154'),_0x13ec('0x157'),JSON['stringify'](_0x736a69)));});});};Dialer[_0x13ec('0x1c')]['checkDialMethod']=function(_0x167af5){var _0x3cf123=this;return function(){switch(_0x167af5['dialMethod']){case _0x13ec('0x168'):freeVariablesPredictive(_0x167af5);_0x3cf123[_0x13ec('0x169')](_0x167af5,0x1);break;case _0x13ec('0x16a'):freeVariablesPredictive(_0x167af5);_0x3cf123['handlePower'](_0x167af5,_0x167af5[_0x13ec('0x16b')]);break;case _0x13ec('0x9'):_0x3cf123[_0x13ec('0x9')](_0x167af5);break;case'booked':freeVariablesPredictive(_0x167af5);_0x3cf123[_0x13ec('0x169')](_0x167af5,0x1);break;default:freeVariablesPredictive(_0x167af5);logger['error']('Queue',_0x167af5['name'],_0x13ec('0x16c'));}};};Dialer[_0x13ec('0x1c')][_0x13ec('0x16d')]=function(_0x1454c4){return Promise['resolve']()[_0x13ec('0x43')](cmHopper[_0x13ec('0x16e')](_0x1454c4['id'],previewRecallmeReminderInterval))[_0x13ec('0x43')](function(_0x448124){for(var _0x2411a9=0x0;_0x2411a9<_0x448124[_0x13ec('0xa4')];_0x2411a9++){var _0x4f6b45=_0x448124[_0x2411a9][_0x13ec('0x16f')][_0x13ec('0x47')];if(_0x4f6b45)io['to'](util[_0x13ec('0x84')](_0x13ec('0x170'),_0x4f6b45))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x448124[_0x2411a9]});}})[_0x13ec('0xb9')](function(){});};Dialer[_0x13ec('0x1c')][_0x13ec('0x171')]=function(_0xb7cd22){var _0x2128e9=this;return function(){_0x2128e9[_0x13ec('0x172')](_0xb7cd22);};};Dialer[_0x13ec('0x1c')][_0x13ec('0x38')]=function(_0x3c9b22){var _0x4564ae=this;if(isNotPreview(_0x3c9b22[_0x13ec('0x62')])){if(isVoiceQueueOutbound(_0x3c9b22['type'])&&isActive(_0x3c9b22[_0x13ec('0x61')])){_0x3c9b22['sendMessageOneNotActive']=!![];Promise[_0x13ec('0xc1')]()[_0x13ec('0x43')](checkIsLoggedIn(_0x3c9b22,_0x3c9b22[_0x13ec('0x58')]))[_0x13ec('0x43')](checkIsActive(_0x3c9b22,_0x3c9b22['dialActive']))[_0x13ec('0x43')](checkInterval(_0x3c9b22))[_0x13ec('0x43')](_0x4564ae[_0x13ec('0x150')](_0x3c9b22))[_0x13ec('0x43')](_0x4564ae[_0x13ec('0x153')](_0x3c9b22[_0x13ec('0x173')],_0x3c9b22[_0x13ec('0x174')],_0x3c9b22[_0x13ec('0x47')],_0x3c9b22))[_0x13ec('0x43')](_0x4564ae[_0x13ec('0x155')](_0x3c9b22[_0x13ec('0x4a')],_0x3c9b22['dialTimezone'],_0x3c9b22[_0x13ec('0x47')],_0x3c9b22))[_0x13ec('0x43')](_0x4564ae[_0x13ec('0x175')](_0x3c9b22))[_0x13ec('0xb9')](loggerCatchQueueSummary(_0x13ec('0x176'),_0x3c9b22));}else{notSendMessagesQueue(_0x3c9b22);}}else{freeVariablesPredictive(_0x3c9b22);}};Dialer[_0x13ec('0x1c')]['syncQueueSummaryComplete']=_[_0x13ec('0x177')](function(){var _0x576810=_[_0x13ec('0x178')](this[_0x13ec('0x22')],function(_0xddfeae){return _0xddfeae[_0x13ec('0x179')];});var _0x410649=_[_0x13ec('0x178')](this[_0x13ec('0x24')],function(_0x508e2f){return _0x508e2f[_0x13ec('0x17a')]&&_0x508e2f[_0x13ec('0xb7')]===_0x13ec('0xe8');});if(_0x576810[_0x13ec('0xa4')]>0x0&&_0x410649[_0x13ec('0xa4')]>0x0){return Promise[_0x13ec('0xc1')]()['then'](cmHopper[_0x13ec('0x16e')](_[_0x13ec('0x17b')](_0x576810,'id'),previewRecallmeReminderInterval,_[_0x13ec('0x17b')](_0x410649,'id')))[_0x13ec('0x43')](function(_0x10729c){for(var _0x47e973=0x0;_0x47e973<_0x10729c['length'];_0x47e973++){var _0x406165=_0x10729c[_0x47e973][_0x13ec('0x16f')]['name'];if(_0x406165)io['to'](util[_0x13ec('0x84')](_0x13ec('0x170'),_0x406165))[_0x13ec('0x52')](_0x13ec('0x17c'),{'hopper':_0x10729c[_0x47e973]});}})[_0x13ec('0xb9')](function(_0x923acd){logger[_0x13ec('0xa3')](_0x13ec('0x16d'),_0x923acd);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x13ec('0x1c')][_0x13ec('0x14f')]=function(){var _0x2f6f1e=this;var _0x114a83;for(var _0x4225ed in this[_0x13ec('0x23')]){if(typeof this[_0x13ec('0x23')][_0x4225ed]!==_0x13ec('0xb5')){_0x114a83=this[_0x13ec('0x23')][_0x4225ed];if(isCampaignIvr(_0x114a83[_0x13ec('0x53')])&&isActive(_0x114a83[_0x13ec('0x82')])){_0x114a83['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x13ec('0x43')](checkIsActive(_0x114a83,_0x114a83[_0x13ec('0x82')]))[_0x13ec('0x43')](checkInterval(_0x114a83))[_0x13ec('0x43')](_0x2f6f1e[_0x13ec('0x150')](_0x114a83))[_0x13ec('0x43')](_0x2f6f1e[_0x13ec('0x153')](_0x114a83['dialGlobalInterval'],_0x114a83[_0x13ec('0x174')],_0x114a83[_0x13ec('0x47')],_0x114a83))['then'](_0x2f6f1e[_0x13ec('0x155')](_0x114a83['Interval'],_0x114a83['dialTimezone'],_0x114a83[_0x13ec('0x47')],_0x114a83))[_0x13ec('0x43')](_0x2f6f1e['launchHandleIvr'](_0x114a83))[_0x13ec('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x114a83));}else{notSendMessagesCampaign(_0x114a83);}}}};function getCallerIdRandom(_0x74c51f,_0x362b6e){var _0x2b9667;var _0x3c36ff;var _0x324f1b;if(_0x362b6e<=0x0){_0x362b6e=0x1;}_0x2b9667=new RegExp(_0x13ec('0x17d')+_0x362b6e+'}$');_0x3c36ff=Math[_0x13ec('0x17e')](0xa,_0x362b6e-0x1);_0x324f1b=Math[_0x13ec('0x17e')](0xa,_0x362b6e)-0x1;return util[_0x13ec('0x84')]('%s',_[_0x13ec('0x17f')](_0x74c51f,_0x2b9667,_['random'](_0x3c36ff,_0x324f1b)));}function extractCalleridName(_0x2053e8){var _0x2d6dd3=_0x2053e8[_0x13ec('0x180')](/"(.*?)"/);return _0x2d6dd3?_0x2d6dd3[0x1]:_0x2053e8;}Dialer[_0x13ec('0x1c')][_0x13ec('0x181')]=function(_0xd6c4f1,_0x27c3db){var _0x16ef09=this;var _0x405343=uuid['v4']();this['actions'][_0x405343]=new Action(_0xd6c4f1,_0x27c3db,_0x405343);return new Promise(function(_0x42d131,_0x55fd68){if(_[_0x13ec('0x44')](_0xd6c4f1)&&typeof _0xd6c4f1!=='object'){return _0x55fd68(msgResponse(_0x13ec('0x182'),_0x13ec('0x157'),_0x13ec('0x183')));}if(_[_0x13ec('0x44')](_0x27c3db[_0x13ec('0x184')])||_0x27c3db[_0x13ec('0x184')]===null){return _0x55fd68(msgResponse(_0x13ec('0x182'),_0x13ec('0x157'),_0x13ec('0x185')));}var _0x4342f0={'XMD-CALLERID':_0x16ef09[_0x13ec('0x28')][_0x405343][_0x13ec('0x186')](),'XMD-AGI':_0xd6c4f1[_0x13ec('0x11a')]?util['format'](_0x13ec('0x187'),ipAgi,_0xd6c4f1['dialQueueProject']):_0x13ec('0x188'),'XMD-AGIAFTER':_0xd6c4f1[_0x13ec('0x121')]?util[_0x13ec('0x84')](_0x13ec('0x187'),ipAgi,_0xd6c4f1[_0x13ec('0x121')]):_0x13ec('0x188'),'XMD-QUEUE':_0xd6c4f1[_0x13ec('0x53')]===_0x13ec('0x54')?util[_0x13ec('0x84')](_0x13ec('0x189'),_0xd6c4f1[_0x13ec('0x47')],_0xd6c4f1[_0x13ec('0x18a')]||'',_0xd6c4f1['dialAgiAfterHangupAgent']?'c':'',_0xd6c4f1[_0x13ec('0x18b')]||0x3):'NONE','XMD-CONTACTID':_0x27c3db['ContactId'],'XMD-CDRTYPE':_0x13ec('0x8'),'CALLERID(all)':_0x16ef09[_0x13ec('0x28')][_0x405343]['getCaller'](),'XMD-AMD':_0xd6c4f1['dialAMDActive']?'ACTIVE':_0x13ec('0x188'),'XMD-DESTINATION':_0x13ec('0xf1')};if(_0xd6c4f1['dialAMDActive']){_0x4342f0['XMD-AMDINITIALSILENCE']=_0xd6c4f1[_0x13ec('0x18c')]||0x9c4;_0x4342f0['XMD-AMDGREETING']=_0xd6c4f1[_0x13ec('0x18d')]||0x5dc;_0x4342f0[_0x13ec('0x18e')]=_0xd6c4f1[_0x13ec('0x18f')]||0x320;_0x4342f0['XMD-AMDTOTALANALYSISTIME']=_0xd6c4f1['dialAMDTotalAnalysisTime']||0x1388;_0x4342f0[_0x13ec('0x190')]=_0xd6c4f1[_0x13ec('0x191')]||0x64;_0x4342f0[_0x13ec('0x192')]=_0xd6c4f1[_0x13ec('0x193')]||0x32;_0x4342f0[_0x13ec('0x194')]=_0xd6c4f1[_0x13ec('0x195')]||0x3;_0x4342f0[_0x13ec('0x196')]=_0xd6c4f1[_0x13ec('0x197')]||0x100;_0x4342f0['XMD-AMDMAXIMUMWORDLENGTH']=_0xd6c4f1[_0x13ec('0x198')]||0x1388;}if(_0xd6c4f1[_0x13ec('0x53')]===_0x13ec('0x54')){_0x4342f0['XMD-VOICEQUEUEID']=_0x27c3db[_0x13ec('0x10c')];}else{_0x4342f0[_0x13ec('0x199')]=_0x27c3db['CampaignId'];}for(var _0x269cdb in _0x27c3db['Contact']){if(typeof _0x27c3db[_0x13ec('0x19a')][_0x269cdb]!==_0x13ec('0xb5')){if(isNotNull(_0x27c3db[_0x13ec('0x19a')][_0x269cdb])&&_0x269cdb!=='id'&&_0x269cdb!=='tags'&&_0x269cdb!==_0x13ec('0x19b')&&_0x269cdb!==_0x13ec('0x19c')){_0x4342f0[util[_0x13ec('0x84')](_0x13ec('0x19d'),_0x13ec('0x19e'),_[_0x13ec('0x19f')](_0x269cdb))]=_0x27c3db[_0x13ec('0x19a')][_0x269cdb];}}}var _0x2baf85=_0x16ef09[_0x13ec('0x151')](_0xd6c4f1[_0x13ec('0x81')])?getCallerId(_0xd6c4f1[_0x13ec('0x81')][_0x13ec('0x83')],_0xd6c4f1[_0x13ec('0x1a0')],_0xd6c4f1[_0x13ec('0x1a1')]>0x0?getCallerIdRandom(_0xd6c4f1[_0x13ec('0x63')],_0xd6c4f1[_0x13ec('0x1a1')]):_0xd6c4f1['dialOriginateCallerIdNumber']):getCallerId(_[_0x13ec('0xed')](_0xd6c4f1[_0x13ec('0x1a2')])?_0xd6c4f1[_0x13ec('0x81')]['callerid']:_0xd6c4f1['TrunkBackup'][_0x13ec('0x83')],_0xd6c4f1[_0x13ec('0x1a0')],_0xd6c4f1['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xd6c4f1[_0x13ec('0x63')],_0xd6c4f1[_0x13ec('0x1a1')]):_0xd6c4f1[_0x13ec('0x63')]);if(_0x2baf85){_0x4342f0[_0x13ec('0x1a3')]=_0x16ef09['actions'][_0x405343][_0x13ec('0x1a4')]=extractCalleridName(_0x2baf85);_0x4342f0['XMD-ORIGINATECALLERIDNUM']=_0x27c3db[_0x13ec('0x184')];}_0xd6c4f1[_0x13ec('0x1a5')]=_0x4342f0;return ami['Action']({'actionid':_0x405343,'action':_0x13ec('0x182'),'channel':_0x16ef09[_0x13ec('0x151')](_0xd6c4f1[_0x13ec('0x81')])?util['format'](_0x13ec('0x1a6'),_0xd6c4f1['Trunk'][_0x13ec('0x47')],isNotNull(_0xd6c4f1[_0x13ec('0x1a7')])?_0xd6c4f1[_0x13ec('0x1a7')][_0x13ec('0x1a8')]()||'':'',_0xd6c4f1[_0x13ec('0x1a9')]>0x0?_0x27c3db[_0x13ec('0x184')][_0x13ec('0x1aa')](_0xd6c4f1[_0x13ec('0x1a9')]):_0x27c3db['phone']):util[_0x13ec('0x84')](_0x13ec('0x1a6'),_[_0x13ec('0xed')](_0xd6c4f1[_0x13ec('0x1a2')])?_0xd6c4f1[_0x13ec('0x81')][_0x13ec('0x47')]:_0xd6c4f1[_0x13ec('0x1a2')][_0x13ec('0x47')],isNotNull(_0xd6c4f1[_0x13ec('0x1a7')])?_0xd6c4f1[_0x13ec('0x1a7')][_0x13ec('0x1a8')]()||'':'',_0xd6c4f1[_0x13ec('0x1a9')]>0x0?_0x27c3db[_0x13ec('0x184')]['substring'](_0xd6c4f1[_0x13ec('0x1a9')]):_0x27c3db[_0x13ec('0x184')]),'callerid':_0x2baf85,'Exten':_0x13ec('0xf1'),'Context':_0x13ec('0x1ab'),'Priority':'1','variable':_0x4342f0,'timeout':(_0xd6c4f1[_0x13ec('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x405343})['then'](function(_0xf830f5){return _0x42d131(_0xf830f5);})['catch'](function(_0x32850a){_0xd6c4f1['outboundOriginateFailureCallsDay']+=0x1;var _0x56885d=new History(_0x16ef09[_0x13ec('0x28')][_0x405343]);logger[_0x13ec('0xa3')](util[_0x13ec('0x84')]('[originateError]:\x20%s',JSON[_0x13ec('0x4f')](_0x32850a)));_0x56885d[_0x13ec('0xb2')]=0xe;_0x56885d[_0x13ec('0xf6')]='OriginateError';_0x56885d[_0x13ec('0x131')]=moment()['format'](_0x13ec('0x115'));_0x56885d['endtime']=_0x56885d[_0x13ec('0x131')];_0x16ef09[_0x13ec('0xd9')](_0x56885d)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1ac')));_0x16ef09[_0x13ec('0xd7')](_0x56885d)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1ac')))[_0x13ec('0x1f')](function(){delete _0x16ef09['actions'][_0x405343];return _0x55fd68(msgResponse('originate',_0x13ec('0x4e'),_0x13ec('0x1ad')));});});});};Dialer['prototype'][_0x13ec('0x34')]=function(_0x24f043){var _0x2da618=this[_0x13ec('0x28')][_0x24f043[_0x13ec('0x139')]];if(_0x2da618){delete this['actions'][_0x24f043[_0x13ec('0x139')]];_0x2da618[_0x13ec('0x128')]=moment()[_0x13ec('0x84')](_0x13ec('0x115'));var _0x5d88ff=_0x2da618[_0x13ec('0x53')]===_0x13ec('0x87')?this[_0x13ec('0x23')][_0x2da618[_0x13ec('0xbb')]]:this[_0x13ec('0x22')][_0x2da618[_0x13ec('0x1ae')]()];if(!this['isSuccess'](_0x24f043[_0x13ec('0x1af')])){this['updateOriginated'](_0x5d88ff);return this[_0x13ec('0x1b0')](_0x2da618,_0x5d88ff,_0x24f043)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1b1')));}this['uniqueId'][_0x24f043[_0x13ec('0xec')]]=_0x2da618;}};Dialer['prototype'][_0x13ec('0x1b2')]=function(_0x3eac16,_0x840c7e,_0xdb09e0){var _0x580d2b=new History(_0x840c7e);if(_0x580d2b[_0x13ec('0xfe')]+_0x580d2b[_0x13ec('0xff')]+_0x580d2b[_0x13ec('0x100')]+_0x580d2b[_0x13ec('0x113')]+_0x580d2b[_0x13ec('0x101')]+_0x580d2b['countabandonedretry']+_0x580d2b[_0x13ec('0x103')]+_0x580d2b[_0x13ec('0x104')]>=_0xdb09e0[_0x13ec('0x105')]-0x1){return!![];}switch(_0x3eac16){case 0x3:if(_0x580d2b['countnoanswerretry']>=_0xdb09e0[_0x13ec('0x1b3')]-0x1){return!![];}this[_0x13ec('0xcd')]({'active':![],'countnoanswerretry':_0x580d2b[_0x13ec('0x100')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0['dialNoAnswerRetryFrequency'],_0x13ec('0x10b'))[_0x13ec('0x84')](_0x13ec('0x115')),'ContactId':_0x580d2b['ContactId'],'ListId':_0x580d2b[_0x13ec('0xe2')],'VoiceQueueId':_0x580d2b[_0x13ec('0x10c')]||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1b4')));break;case 0x5:if(_0x580d2b['countbusyretry']>=_0xdb09e0[_0x13ec('0x1b5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x580d2b[_0x13ec('0xfe')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x1b6')],_0x13ec('0x10b'))[_0x13ec('0x84')](_0x13ec('0x115')),'ContactId':_0x580d2b[_0x13ec('0xe1')],'ListId':_0x580d2b['ListId'],'VoiceQueueId':_0x580d2b['VoiceQueueId']||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1b7')));break;case 0x8:if(_0x580d2b[_0x13ec('0xff')]>=_0xdb09e0[_0x13ec('0x1b8')]-0x1){return!![];}this[_0x13ec('0xcd')]({'active':![],'countcongestionretry':_0x580d2b[_0x13ec('0xff')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x1b9')],_0x13ec('0x10b'))[_0x13ec('0x84')](_0x13ec('0x115')),'ContactId':_0x580d2b[_0x13ec('0xe1')],'ListId':_0x580d2b[_0x13ec('0xe2')],'VoiceQueueId':_0x580d2b[_0x13ec('0x10c')]||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1ba')));break;case 0x0:if(_0x580d2b[_0x13ec('0x113')]>=_0xdb09e0['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x580d2b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x1bb')],_0x13ec('0x10b'))[_0x13ec('0x84')](_0x13ec('0x115')),'ContactId':_0x580d2b['ContactId'],'ListId':_0x580d2b['ListId'],'VoiceQueueId':_0x580d2b[_0x13ec('0x10c')]||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1bc')));}break;case 0xa:if(_0x580d2b[_0x13ec('0x101')]>=_0xdb09e0[_0x13ec('0x12f')]-0x1){return!![];}this[_0x13ec('0xcd')]({'active':![],'countdropretry':_0x580d2b[_0x13ec('0x101')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x12b')],_0x13ec('0x10b'))[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x580d2b['ContactId'],'ListId':_0x580d2b[_0x13ec('0xe2')],'VoiceQueueId':_0x580d2b[_0x13ec('0x10c')]||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x130')));break;case 0xb:if(_0x580d2b['countabandonedretry']>=_0xdb09e0[_0x13ec('0x1bd')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x580d2b[_0x13ec('0x102')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0['dialAbandonedRetryFrequency'],_0x13ec('0x10b'))['format'](_0x13ec('0x115')),'ContactId':_0x580d2b[_0x13ec('0xe1')],'ListId':_0x580d2b[_0x13ec('0xe2')],'VoiceQueueId':_0x580d2b['VoiceQueueId']||undefined,'CampaignId':_0x580d2b[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x580d2b[_0x13ec('0x103')]>=_0xdb09e0[_0x13ec('0x107')]-0x1){return!![];}this[_0x13ec('0xcd')]({'active':![],'countmachineretry':_0x580d2b[_0x13ec('0x103')]+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x1be')],_0x13ec('0x10b'))['format'](_0x13ec('0x115')),'ContactId':_0x580d2b[_0x13ec('0xe1')],'ListId':_0x580d2b['ListId'],'VoiceQueueId':_0x580d2b['VoiceQueueId']||undefined,'CampaignId':_0x580d2b['CampaignId']||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x116')));break;case 0x14:if(_0x580d2b['countagentrejectretry']>=_0xdb09e0[_0x13ec('0x1bf')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x580d2b['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x13ec('0x10a')](_0xdb09e0[_0x13ec('0x1c0')],_0x13ec('0x10b'))['format'](_0x13ec('0x115')),'ContactId':_0x580d2b[_0x13ec('0xe1')],'ListId':_0x580d2b[_0x13ec('0xe2')],'VoiceQueueId':_0x580d2b[_0x13ec('0x10c')]||undefined,'CampaignId':_0x580d2b['CampaignId']||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1c1')));break;default:return!![];}};Dialer[_0x13ec('0x1c')]['callProgressDetecting']=function(_0x26fe78,_0x451019,_0xdd3655){var _0x46d5c4=this;var _0x49e229=new History(_0x26fe78);var _0x3c679b=![];var _0x3f0c4f;var _0x3a5c9d;return new Promise(function(_0x29d46f,_0x18f46b){if(_[_0x13ec('0x44')](_0x451019)&&typeof _0x451019!==_0x13ec('0x1c2')){return _0x18f46b(msgResponse(_0x13ec('0x1c3'),'Failure',_0x13ec('0x1c4')));}if(_[_0x13ec('0x44')](_0xdd3655)&&typeof _0xdd3655!==_0x13ec('0x1c2')){return _0x18f46b(msgResponse(_0x13ec('0x1c3'),'Failure',_0x13ec('0x1c5')));}_0x46d5c4[_0x13ec('0xc4')](_0x49e229,_0xdd3655['reason'],_0x451019)['then'](function(_0x24a90d){if(_0x24a90d[_0x13ec('0x12e')]==0x1)_0x3c679b=!![];switch(_0xdd3655['reason']){case'0':_0x451019[_0x13ec('0x1c6')]+=0x1;_0x49e229[_0x13ec('0xb2')]=0x0;_0x49e229[_0x13ec('0xf6')]=_0x13ec('0x1c7');_0x49e229[_0x13ec('0x113')]+=0x1;_0x49e229['countglobal']+=0x1;ami[_0x13ec('0x52')](_0x13ec('0x1c8'),ut[_0x13ec('0xf9')](_0x26fe78,_0x13ec('0x1c9')));_0x3f0c4f=_0x451019[_0x13ec('0x1bb')];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];_0x46d5c4[_0x13ec('0xd9')](_0x49e229)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x46d5c4['checkRetriveMax'](0x0,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0x113')]>=_0x451019['dialNoSuchNumberMaxRetry']){_0x46d5c4[_0x13ec('0x108')](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1ca'));}else{_0x46d5c4[_0x13ec('0x106')](_0x49e229,_0x29d46f,_0x18f46b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x451019[_0x13ec('0x6c')]+=0x1;_0x49e229[_0x13ec('0xb2')]=0x3;_0x49e229[_0x13ec('0xf6')]=_0x13ec('0x1cb');_0x49e229['countnoanswerretry']+=0x1;_0x49e229['countglobal']+=0x1;var _0x892256=ut[_0x13ec('0x1cc')](_0x26fe78,_0x451019);ami[_0x13ec('0x52')]('custom:agentnoanswer',_0x892256);_0x3f0c4f=_0x451019[_0x13ec('0x1cd')];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];_0x46d5c4[_0x13ec('0xd9')](_0x49e229)['catch'](loggerCatch(_0x13ec('0x1ce')));if(_0x46d5c4[_0x13ec('0x1b2')](0x3,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0x100')]>=_0x451019[_0x13ec('0x1b3')]){_0x46d5c4[_0x13ec('0x108')](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1cf'));}else{_0x46d5c4['stateGlobal'](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1cf'));}}break;case'5':_0x451019['outboundBusyCallsDay']+=0x1;_0x49e229['state']=0x5;_0x49e229[_0x13ec('0xf6')]='Busy';_0x49e229[_0x13ec('0xfe')]+=0x1;_0x49e229[_0x13ec('0x112')]+=0x1;ami[_0x13ec('0x52')]('custom:agentbusy',ut[_0x13ec('0xf9')](_0x26fe78,_0x13ec('0x1d0')));_0x3f0c4f=_0x451019[_0x13ec('0x1b6')];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];_0x46d5c4[_0x13ec('0xd9')](_0x49e229)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x46d5c4['checkRetriveMax'](0x5,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0xfe')]>=_0x451019[_0x13ec('0x1b5')]){_0x46d5c4['createStateFinal'](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1d1'));}else{_0x46d5c4[_0x13ec('0x106')](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1d1'));}}break;case'8':_0x451019[_0x13ec('0x68')]+=0x1;_0x49e229['state']=0x8;_0x49e229['statedesc']=_0x13ec('0x1d2');_0x49e229[_0x13ec('0xff')]+=0x1;_0x49e229[_0x13ec('0x112')]+=0x1;_0x3f0c4f=_0x451019['dialCongestionRetryFrequency'];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];ami[_0x13ec('0x52')]('custom:agentcongestion',ut[_0x13ec('0xf9')](_0x26fe78,_0x13ec('0x1d3')));_0x46d5c4[_0x13ec('0xd9')](_0x49e229)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x46d5c4['checkRetriveMax'](0x8,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0xff')]>=_0x451019[_0x13ec('0x1b8')]){_0x46d5c4['createStateFinal'](_0x49e229,_0x29d46f,_0x18f46b,'reason\x208\x20congestion');}else{_0x46d5c4[_0x13ec('0x106')](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1d4'));}}break;case'11':_0x451019[_0x13ec('0x1d5')]+=0x1;_0x49e229[_0x13ec('0xb2')]=0xb;_0x49e229[_0x13ec('0xf6')]=_0x13ec('0x137');_0x49e229[_0x13ec('0x102')]+=0x1;_0x49e229[_0x13ec('0x112')]+=0x1;_0x3f0c4f=_0x451019[_0x13ec('0x136')];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];_0x46d5c4['createHistory'](_0x49e229)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x138')));if(_0x46d5c4['checkRetriveMax'](0xb,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0x102')]>=_0x451019[_0x13ec('0x1bd')]){_0x46d5c4['createStateFinal'](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1d6'));}else{_0x46d5c4['stateGlobal'](_0x49e229,_0x29d46f,_0x18f46b,_0x13ec('0x1d6'));}}break;case'20':_0x451019[_0x13ec('0x6f')]+=0x1;_0x49e229[_0x13ec('0xb2')]=0x14;_0x49e229['statedesc']=_0x13ec('0x1d7');_0x49e229[_0x13ec('0x104')]+=0x1;_0x49e229[_0x13ec('0x112')]+=0x1;_0x3f0c4f=_0x451019[_0x13ec('0x1c0')];_0x3a5c9d=_0x451019[_0x13ec('0x12c')];ami[_0x13ec('0x52')]('custom:agentreject',ut[_0x13ec('0xf9')](_0x26fe78,_0x13ec('0x1d8')));_0x46d5c4['createHistory'](_0x49e229)[_0x13ec('0xb9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x46d5c4[_0x13ec('0x1b2')](0x14,_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229[_0x13ec('0x104')]>=_0x451019[_0x13ec('0x1bf')]){_0x46d5c4['createStateFinal'](_0x49e229,_0x29d46f,_0x18f46b,'reason\x2020\x20agentreject');}else{_0x46d5c4[_0x13ec('0x106')](_0x49e229,_0x29d46f,_0x18f46b,'reason\x2020\x20agentreject');}}break;default:_0x451019[_0x13ec('0x70')]+=0x1;_0x49e229[_0x13ec('0xb2')]=0xc;_0x49e229[_0x13ec('0xf6')]=_0xdd3655[_0x13ec('0x11e')];_0x3f0c4f=_0x451019[_0x13ec('0x1c0')];_0x3a5c9d=_0x451019['callAdditionalPhoneAfterMin'];_0x46d5c4[_0x13ec('0xd9')](_0x49e229)[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x1d9')));if(_0x46d5c4[_0x13ec('0x1b2')](_0xdd3655['reason'],_0x26fe78,_0x451019)&&!_0x3c679b){if(_0x49e229['countbusyretry']+_0x49e229[_0x13ec('0xff')]+_0x49e229[_0x13ec('0x100')]+_0x49e229[_0x13ec('0x113')]+_0x49e229[_0x13ec('0x101')]+_0x49e229[_0x13ec('0x102')]+_0x49e229[_0x13ec('0x103')]+_0x49e229['countagentrejectretry']>=_0x451019[_0x13ec('0x105')]){_0x46d5c4[_0x13ec('0x106')](_0x49e229,_0x29d46f,_0x18f46b,_0xdd3655[_0x13ec('0x11e')]);}else{_0x46d5c4['createStateFinal'](_0x49e229,_0x29d46f,_0x18f46b,_0xdd3655[_0x13ec('0x11e')]);}}}})[_0x13ec('0x43')](function(){if(_0x3c679b){_0x46d5c4[_0x13ec('0xc6')](_0x49e229,_0x3f0c4f,_0x3a5c9d)[_0x13ec('0x43')](function(){return _0x29d46f(0x1);});}});});};Dialer[_0x13ec('0x1c')][_0x13ec('0x106')]=function(_0x398716,_0x157284,_0x35fe77,_0x40668f){var _0x35b3a6=new Final(_0x398716);_0x35b3a6[_0x13ec('0xb2')]=0xf;_0x35b3a6[_0x13ec('0xf6')]=_0x13ec('0x1da');this['createStateFinal'](_0x35b3a6,_0x157284,_0x35fe77,_0x40668f);};Dialer[_0x13ec('0x1c')][_0x13ec('0x108')]=function(_0x141914,_0x4702fa,_0x450e58,_0x2f3b4a){this[_0x13ec('0xd7')](_0x141914)[_0x13ec('0x43')](function(){return _0x4702fa(msgResponse(_0x13ec('0x1c3'),_0x13ec('0xe6'),_0x2f3b4a));})[_0x13ec('0xb9')](function(){return _0x450e58(msgResponse(_0x13ec('0x1db'),_0x13ec('0x157'),_0x13ec('0x1dc')));});};Dialer[_0x13ec('0x1c')][_0x13ec('0x9')]=function(_0x157b91){var _0x43259e=_0x157b91[_0x13ec('0x1dd')]/0x64;var _0x11e2e9=_0x157b91[_0x13ec('0x6b')]/(_0x157b91[_0x13ec('0x6b')]+_0x157b91[_0x13ec('0xf5')]);var _0x5dafe2=Math[_0x13ec('0x1de')](_0x157b91[_0x13ec('0x7a')]*(_0x157b91[_0x13ec('0x1df')]/0x64));var _0x572523=Math[_0x13ec('0x1de')](_0x157b91[_0x13ec('0x7a')]*(_0x157b91['predictiveIntervalMinThreshold']/0x64));var _0x34371f=_0x157b91[_0x13ec('0x57')]+_0x157b91[_0x13ec('0x5c')];var _0x2d1863=Math[_0x13ec('0x1e0')](_0x157b91[_0x13ec('0x7d')]*_0x157b91[_0x13ec('0x7f')]*_0x157b91[_0x13ec('0x78')]*_0x157b91[_0x13ec('0x1e1')]);if(_[_0x13ec('0x44')](_0x157b91[_0x13ec('0x2c')])){if(!_[_0x13ec('0x44')](_0x157b91['startPredictive'])){_0x157b91[_0x13ec('0x2b')]=undefined;loggerPredictive[_0x13ec('0xa3')](_0x13ec('0x1e2'),_0x13ec('0x1e3'));}if(!_['isUndefined'](_0x157b91[_0x13ec('0x9c')])){loggerPredictive[_0x13ec('0xa3')](_0x13ec('0x1e2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x157b91['handlePredictive']);_0x157b91[_0x13ec('0x9c')]=undefined;}_0x157b91[_0x13ec('0x2c')]=moment()[_0x13ec('0x84')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x13ec('0x8b')](_0x157b91[_0x13ec('0x47')],_0x13ec('0x1e4'),_0x157b91[_0x13ec('0x2c')]);this[_0x13ec('0x169')](_0x157b91,0x1);}else if(ifInterval(_0x157b91[_0x13ec('0x1e5')],_0x157b91[_0x13ec('0x2c')])){this['handlePower'](_0x157b91,0x1);loggerPredictiveCalls[_0x13ec('0x8b')](_0x13ec('0x1e6'),_0x157b91['startProgressive'],_0x157b91['name']);_0x157b91[_0x13ec('0x7d')]=0x0;_0x157b91[_0x13ec('0x77')]=0x0;}else if(_0x43259e<_0x11e2e9&&_0x157b91[_0x13ec('0x1e7')]===_0x13ec('0x1e8')){freeVariablesPredictive(_0x157b91);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x1e9'),'Dropped\x20calls\x20day',_0x11e2e9,'startProgressive',_0x157b91[_0x13ec('0x47')]);}else if(_0x2d1863<_0x157b91['predictiveIntervalErlangCallsDroppedCalls']&&_0x157b91['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x157b91);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x1ea'),_0x13ec('0x1eb'),_0x2d1863,_0x13ec('0x1ec'),_0x157b91[_0x13ec('0x77')],_0x13ec('0x2c'),_0x157b91[_0x13ec('0x47')]);}else if(!ifInterval(_0x157b91[_0x13ec('0x1e5')],_0x157b91['startProgressive'])&&_[_0x13ec('0x44')](_0x157b91[_0x13ec('0x2b')])&&!_[_0x13ec('0x44')](_0x157b91['startProgressive'])){_0x157b91[_0x13ec('0x2b')]=moment()['format'](_0x13ec('0x115'));loggerPredictive[_0x13ec('0x8b')](_0x157b91[_0x13ec('0x47')],_0x13ec('0x1ed'),_0x157b91[_0x13ec('0x2b')]);this[_0x13ec('0xca')](_0x157b91[_0x13ec('0x1e5')])['then'](this[_0x13ec('0x1ee')](_0x157b91))[_0x13ec('0x43')](mergeDataErlangB(_0x157b91))[_0x13ec('0x43')](this[_0x13ec('0x1ef')](_0x157b91))[_0x13ec('0xb9')](loggerCatchPredictive(_0x13ec('0x1f0'),_0x157b91));}else if(!ifInterval(_0x157b91['dialPredictiveInterval'],_0x157b91[_0x13ec('0x2b')])){_0x157b91[_0x13ec('0x77')]=0x0;_0x157b91['startPredictive']=moment()[_0x13ec('0x84')](_0x13ec('0x115'));loggerPredictive['info'](_0x157b91['name'],_0x13ec('0x1f1'),_0x157b91['startPredictive']);clearInterval(_0x157b91[_0x13ec('0x9c')]);_0x157b91[_0x13ec('0x9c')]=undefined;this[_0x13ec('0xca')](_0x157b91[_0x13ec('0x1e5')])[_0x13ec('0x43')](this[_0x13ec('0x1ee')](_0x157b91))[_0x13ec('0x43')](mergeDataErlangB(_0x157b91))[_0x13ec('0x43')](this[_0x13ec('0x1ef')](_0x157b91))[_0x13ec('0xb9')](loggerCatchPredictive(_0x13ec('0x1f2'),_0x157b91));}else if(_0x157b91[_0x13ec('0x7a')]&&_0x34371f<_0x157b91[_0x13ec('0x7a')]-_0x572523){freeVariablesPredictive(_0x157b91);loggerPredictive[_0x13ec('0x8b')](_0x157b91[_0x13ec('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x34371f,')\x20are\x20less\x20than\x20threshold\x20(',_0x157b91[_0x13ec('0x7a')],'-',_0x572523,'=',_0x157b91[_0x13ec('0x7a')]-_0x572523,')');}else if(_0x157b91[_0x13ec('0x7a')]&&_0x34371f>_0x157b91[_0x13ec('0x7a')]+_0x5dafe2){freeVariablesPredictive(_0x157b91);loggerPredictive[_0x13ec('0x8b')](_0x157b91[_0x13ec('0x47')],_0x13ec('0x1f3'),_0x34371f,_0x13ec('0x1f4'),_0x157b91[_0x13ec('0x7a')],'+',_0x5dafe2,'=',_0x157b91[_0x13ec('0x7a')]+_0x5dafe2,')');}};Dialer['prototype'][_0x13ec('0x1ee')]=function(_0x5b6a81){var _0xf00133=this;return function(_0xefc083){return new Promise(function(_0x364b66,_0x1e180d){_[_0x13ec('0x9a')](_0x5b6a81,_0xefc083[0x0]);if(checkGetDataPredictive(_0xefc083[0x0])){var _0x48890b=_0x5b6a81[_0x13ec('0x7a')]=_0x5b6a81[_0x13ec('0x5c')]+_0x5b6a81['available'];var _0xa97293=_0x5b6a81[_0x13ec('0x1e5')]*0x3c;var _0x17c316=_0xefc083[0x0][_0x13ec('0x73')]+_0xefc083[0x0]['predictiveIntervalAvgHoldtime'];var _0x19ed3f=(_0xefc083[0x0][_0x13ec('0x71')]+_0xefc083[0x0][_0x13ec('0x75')]+_0xefc083[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xefc083[0x0][_0x13ec('0x7b')];_0x5b6a81[_0x13ec('0x78')]=_0x19ed3f>0x0?_0x19ed3f:0x1;switch(_0x5b6a81[_0x13ec('0x1e7')]){case _0x13ec('0x1e8'):var _0x393977=_0x5b6a81['dialPredictiveOptimizationPercentage']/0x64;return _0xf00133[_0x13ec('0x1f5')](_0x48890b,_0xa97293,_0x17c316,_0x19ed3f,_0x393977)[_0x13ec('0x43')](function(_0x58c382){return _0x364b66(_0x58c382);});case _0x13ec('0x1f6'):var _0x24a4e0=_0x5b6a81[_0x13ec('0x1dd')]/0x64;return _0xf00133[_0x13ec('0x1f7')](_0x48890b,_0xa97293,_0x17c316,_0x19ed3f,_0x24a4e0)[_0x13ec('0x43')](function(_0x1d14af){return _0x364b66(_0x1d14af);});default:return _0x1e180d(msgResponse(_0x13ec('0x1f8'),'Failure',_0x13ec('0x1f9')));}}else{return _0x1e180d(msgResponse(_0x13ec('0x1f8'),'Failure',_0x13ec('0x1fa')));}});};};Dialer[_0x13ec('0x1c')]['getDataPredictiveOld']=function(_0x4d35c9){var _0x496657=this;return function(_0x1f0638){return new Promise(function(_0xecc5b4,_0x45ba0d){_[_0x13ec('0x9a')](_0x4d35c9,_0x1f0638[0x0]);if(checkGetDataPredictive(_0x1f0638[0x0])){loggerPredictive[_0x13ec('0x8b')](JSON['stringify'](_0x1f0638[0x0]));if(_0x4d35c9['dialPredictiveOptimization']===_0x13ec('0x1e8')){return _0x496657[_0x13ec('0xd6')](_0x4d35c9['id'])[_0x13ec('0x43')](function(_0x14a28f){var _0x4540c3=_0x4d35c9[_0x13ec('0x58')]-_0x14a28f[0x0][_0x13ec('0x1fb')];var _0x372306=_0x4d35c9[_0x13ec('0x1e5')]*0x3c;var _0x3a56aa=_0x1f0638[0x0]['predictiveIntervalAvgTalktime']+_0x1f0638[0x0][_0x13ec('0x72')];var _0xbe3266=(_0x1f0638[0x0][_0x13ec('0x71')]+_0x1f0638[0x0][_0x13ec('0x75')]+_0x1f0638[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1f0638[0x0][_0x13ec('0x7b')];var _0x372ead=_0x4d35c9[_0x13ec('0x1dd')]/0x64;_0x4d35c9[_0x13ec('0x79')]=_0x14a28f[0x0][_0x13ec('0x1fb')]||0x0;_0x4d35c9[_0x13ec('0x78')]=_0xbe3266>0x0?_0xbe3266:0x1;return _0x496657[_0x13ec('0x1f5')](_0x4540c3,_0x372306,_0x3a56aa,_0xbe3266,_0x372ead);})['then'](function(_0xaea8de){return _0xecc5b4(_0xaea8de);})[_0x13ec('0xb9')](function(_0x5331bc){return _0x45ba0d(msgResponse(_0x13ec('0x1fc'),_0x13ec('0x157'),JSON[_0x13ec('0x4f')](_0x5331bc)));});}if(_0x4d35c9['dialPredictiveOptimization']===_0x13ec('0x1f6')){return _0x496657[_0x13ec('0xd6')](_0x4d35c9['id'])[_0x13ec('0x43')](function(_0x2889b9){var _0x42e277=_0x4d35c9[_0x13ec('0x58')]-_0x2889b9[0x0]['outboundQueuePauses'];var _0x71d089=_0x4d35c9[_0x13ec('0x1e5')]*0x3c;var _0x770fbe=_0x1f0638[0x0][_0x13ec('0x73')]+_0x1f0638[0x0][_0x13ec('0x72')];var _0x4030aa=(_0x1f0638[0x0][_0x13ec('0x71')]+_0x1f0638[0x0][_0x13ec('0x75')]+_0x1f0638[0x0][_0x13ec('0x74')])/_0x1f0638[0x0][_0x13ec('0x7b')];var _0x35a3a6=_0x4d35c9[_0x13ec('0x1dd')]/0x64;_0x4d35c9[_0x13ec('0x79')]=_0x2889b9[0x0][_0x13ec('0x1fb')]||0x0;_0x4d35c9[_0x13ec('0x78')]=_0x4030aa>0x0?_0x4030aa:0x1;return _0x496657[_0x13ec('0x1f7')](_0x42e277,_0x71d089,_0x770fbe,_0x4030aa,_0x35a3a6);})[_0x13ec('0x43')](function(_0x420c08){return _0xecc5b4(_0x420c08);})[_0x13ec('0xb9')](function(_0x1474d0){return _0x45ba0d(msgResponse(_0x13ec('0x1fc'),_0x13ec('0x157'),JSON[_0x13ec('0x4f')](_0x1474d0)));});}}else{return _0x45ba0d(msgResponse(_0x13ec('0x1f8'),_0x13ec('0x157'),_0x13ec('0x1fa')));}});};};Dialer[_0x13ec('0x1c')]['startMethodPredictive']=function(_0x46c980){var _0xaae981=this;return function(){var _0x335886=0x0;var _0x3f78f2=Math[_0x13ec('0x1e0')](_0x46c980[_0x13ec('0x7e')]*0x3e8);if(_0x3f78f2>0x0){_0x3f78f2=_0x3f78f2<0x64?0x64:_0x3f78f2;loggerPredictive[_0x13ec('0x8b')](_0x46c980[_0x13ec('0x47')],'one\x20call\x20every:',_0x3f78f2,'milliseconds');_0x46c980['handlePredictive']=setInterval(function(){_0xaae981[_0x13ec('0x9c')](_0x46c980);loggerPredictiveCalls[_0x13ec('0x8b')](_0x13ec('0x1fd'),_0x335886+=0x1);},_0x3f78f2);}else{loggerPredictive[_0x13ec('0x8b')](_0x46c980[_0x13ec('0x47')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x13ec('0x1c')][_0x13ec('0x1fe')]=function(_0x3a8671,_0x30173f){var _0x202ed1=this;return function(_0x392230){if(_[_0x13ec('0x9f')](_0x392230)){if(_[_0x13ec('0xed')](_0x30173f['UserId'])||!_0x30173f['recallme']){if(_0x3a8671[_0x13ec('0x62')]==='booked'){_0x3a8671[_0x13ec('0x13e')]=_[_0x13ec('0x44')](_0x3a8671[_0x13ec('0x13e')])?!![]:_0x3a8671[_0x13ec('0x13e')];var _0x195e11=uuid['v4']();_0x202ed1['actions'][_0x195e11]=new Action(_0x3a8671,_0x30173f,_0x195e11);loggerBooked[_0x13ec('0x8b')](_0x13ec('0x1ff'),_0x195e11,_0x13ec('0x200'),JSON['stringify'](_0x3a8671['queueStatusComplete']),_0x13ec('0x201'),_0x3a8671[_0x13ec('0x47')]);if(_0x3a8671['queueStatusComplete']){_0x3a8671[_0x13ec('0x13e')]=![];_0x202ed1[_0x13ec('0x13d')][_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0xbb')]]=[];ami[_0x13ec('0xb6')]({'actionid':_0x195e11,'action':_0x13ec('0x202'),'queue':_0x3a8671[_0x13ec('0x47')]})[_0x13ec('0xb9')](function(){_0x202ed1[_0x13ec('0xbd')](_0x3a8671);_0x202ed1['rescheduleContact']({'active':![],'ContactId':_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0xe1')],'ListId':_0x202ed1[_0x13ec('0x28')][_0x195e11]['ListId'],'VoiceQueueId':_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0x10c')]||undefined,'CampaignId':_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch(_0x13ec('0x203')));delete _0x202ed1[_0x13ec('0x28')][_0x195e11];});}else{loggerBooked[_0x13ec('0x8b')]('[booked][checkContactBlack][else]',JSON[_0x13ec('0x4f')](_0x3a8671[_0x13ec('0x13e')]),_0x13ec('0x201'),_0x3a8671[_0x13ec('0x47')]);_0x202ed1[_0x13ec('0xbd')](_0x3a8671);_0x202ed1[_0x13ec('0xcd')]({'active':![],'ContactId':_0x202ed1['actions'][_0x195e11][_0x13ec('0xe1')],'ListId':_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0xe2')],'VoiceQueueId':_0x202ed1[_0x13ec('0x28')][_0x195e11][_0x13ec('0x10c')]||undefined,'CampaignId':_0x202ed1['actions'][_0x195e11][_0x13ec('0xe4')]||undefined})['catch'](loggerCatch(_0x13ec('0x203')));delete _0x202ed1['actions'][_0x195e11];}}else{return _0x202ed1['actionOriginate'](_0x3a8671,_0x30173f);}}else{if(getDiff(_0x30173f[_0x13ec('0x204')])<_0x3a8671['dialRecallMeTimeout']*0x3c){if(_0x30173f[_0x13ec('0x16f')]&&!_0x30173f[_0x13ec('0x16f')][_0x13ec('0x205')]){_0x202ed1['preview'][_0x13ec('0x142')](_0x30173f['id'])[_0x13ec('0x1f')](function(){_0x202ed1[_0x13ec('0xbd')](_0x3a8671);});}else{_0x202ed1[_0x13ec('0xcf')]({'active':![]},_0x30173f['id'],0x1)[_0x13ec('0x1f')](function(){_0x202ed1[_0x13ec('0xbd')](_0x3a8671);});}}else{_0x3a8671['outboundReCallsDay']+=0x1;_0x202ed1[_0x13ec('0xbd')](_0x3a8671);if(_0x3a8671[_0x13ec('0x206')]){_0x202ed1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x30173f[_0x13ec('0xe1')],'ListId':_0x30173f[_0x13ec('0xe2')],'VoiceQueueId':_0x30173f[_0x13ec('0x10c')]||undefined,'CampaignId':_0x30173f[_0x13ec('0xe4')]||undefined})[_0x13ec('0xb9')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x202ed1[_0x13ec('0xd9')](createObjHistory(_0x3a8671,_0x30173f,_0x13ec('0x207'),0x17,_0x13ec('0x208')))['catch'](loggerCatch(_0x13ec('0x209')));}else{_0x202ed1[_0x13ec('0xea')](createObjHistory(_0x3a8671,_0x30173f,'RECALLFAILEDTIMEOUT',0x16,_0x13ec('0x20a')),_0x13ec('0x20b'),_0x13ec('0x20c'));}}}}else{_0x3a8671[_0x13ec('0x66')]+=0x1;_0x202ed1[_0x13ec('0xea')](createObjHistory(_0x3a8671,_0x30173f,_0x13ec('0x20d'),0xd,'Blacklist'),_0x13ec('0x20e'),_0x13ec('0x20f'));throw _0x13ec('0x210');}};};Dialer['prototype'][_0x13ec('0x172')]=function(_0x19ccdb){var _0x404449=this;var _0x5cc821=_0x19ccdb[_0x13ec('0x211')]-_0x19ccdb['originated']-_0x19ccdb[_0x13ec('0xd2')];emitCampaignSummary(_0x19ccdb);if(_0x5cc821>0x0){if(_0x5cc821>this['maxNumberOriginate']){_0x5cc821=this[_0x13ec('0x26')];}_0x19ccdb[_0x13ec('0xd2')]+=_0x5cc821;this[_0x13ec('0xd4')](_0x19ccdb['id'],_0x5cc821,_0x19ccdb[_0x13ec('0x212')],_0x19ccdb)['then'](function(_0x2fd61a){_0x19ccdb[_0x13ec('0xd2')]-=_0x5cc821;_0x19ccdb[_0x13ec('0xd2')]=_0x19ccdb[_0x13ec('0xd2')]>0x0?_0x19ccdb[_0x13ec('0xd2')]:0x0;if(!checkContactEmpty(_0x2fd61a)){_0x19ccdb[_0x13ec('0x45')]=_0x13ec('0xaa');logger['info'](_0x13ec('0x213')+_0x19ccdb[_0x13ec('0x47')]);}else{_0x19ccdb['originated']+=_0x2fd61a['length'];_0x19ccdb[_0x13ec('0x45')]=_0x13ec('0x214');for(var _0x3b640d=0x0;_0x3b640d<_0x2fd61a['length'];_0x3b640d+=0x1){_0x19ccdb[_0x13ec('0x215')]+=0x1;if(_[_0x13ec('0xed')](_0x2fd61a[_0x3b640d])||_[_0x13ec('0xed')](_0x2fd61a[_0x3b640d]['Contact'])||_['isNil'](_0x2fd61a[_0x3b640d][_0x13ec('0x184')])){_0x404449['emptyContact']('[actionOriginate]\x20',_0x19ccdb,_0x2fd61a[_0x3b640d]);}else{_0x404449[_0x13ec('0xc8')](_[_0x13ec('0xe0')](_0x2fd61a[_0x3b640d],[_0x13ec('0xe4'),_0x13ec('0x216')]))[_0x13ec('0x43')](_0x404449[_0x13ec('0x1fe')](_0x19ccdb,_0x2fd61a[_0x3b640d]))[_0x13ec('0xb9')](_0x404449[_0x13ec('0xdd')](_0x13ec('0x217'),_0x19ccdb));}}}})[_0x13ec('0xb9')](loggerGetContactDialer('[getContactCampaign2]',_0x19ccdb,_0x5cc821));}};Dialer['prototype'][_0x13ec('0x169')]=function(_0x1efb51,_0x3b0e2d){var _0x5f1d9a=this;var _0x3cd3d3=[];var _0x2522a1=_0x3b0e2d>=0x1?_0x3b0e2d:0x1;if(_0x1efb51[_0x13ec('0x62')]==='booked'){_0x2522a1=0x1;}var _0xc824e6=Math[_0x13ec('0x1e0')](_0x1efb51['available']*_0x2522a1)-_0x1efb51[_0x13ec('0x7c')]-_0x1efb51[_0x13ec('0xd2')];emitVoiceQueueSummary(_0x1efb51);if(_0x1efb51[_0x13ec('0x218')]>0x0){var _0xc30466=_0x1efb51[_0x13ec('0x218')]-_0x1efb51[_0x13ec('0x7c')]-_0x1efb51['talking']-_0x1efb51[_0x13ec('0xd2')]-_0x1efb51[_0x13ec('0xad')];if(_0xc824e6>_0xc30466){_0xc824e6=_0xc30466;}}if(_0xc824e6>0x0){if(_0x1efb51[_0x13ec('0x62')]==='booked'){_0xc824e6=0x1;}if(_0xc824e6>this[_0x13ec('0x26')]){_0xc824e6=this[_0x13ec('0x26')];}_0x1efb51[_0x13ec('0xd2')]+=_0xc824e6;for(var _0x516445 in this['agents']){if(typeof this[_0x13ec('0x24')][_0x516445]!==_0x13ec('0xb5')){if(this['agents'][_0x516445][_0x13ec('0xb2')]===_0x13ec('0x219')&&this[_0x13ec('0x24')][_0x516445][_0x13ec('0xb7')]===_0x13ec('0xe8')){_0x3cd3d3[_0x13ec('0x15c')](this[_0x13ec('0x24')][_0x516445]['id']);}}}this[_0x13ec('0xd1')](_0x1efb51['id'],_0x3cd3d3,_0xc824e6,_0x1efb51[_0x13ec('0x212')],_0x1efb51)[_0x13ec('0x43')](function(_0x54e7af){_0x1efb51[_0x13ec('0xd2')]-=_0xc824e6;_0x1efb51[_0x13ec('0xd2')]=_0x1efb51['temp']>0x0?_0x1efb51[_0x13ec('0xd2')]:0x0;if(!checkContactEmpty(_0x54e7af)){_0x5f1d9a[_0x13ec('0xbf')](_0x1efb51)[_0x13ec('0x43')](sendMessageReschedule(_0x1efb51))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1efb51['originated']+=_0x54e7af[_0x13ec('0xa4')];_0x1efb51[_0x13ec('0x45')]=_0x1efb51[_0x13ec('0x62')]===_0x13ec('0x21a')?'ACTIVE':_0x13ec('0x214');for(var _0x4efea6=0x0;_0x4efea6<_0x54e7af[_0x13ec('0xa4')];_0x4efea6+=0x1){if(_[_0x13ec('0xed')](_0x54e7af[_0x4efea6])||_[_0x13ec('0xed')](_0x54e7af[_0x4efea6][_0x13ec('0x19a')])||_[_0x13ec('0xed')](_0x54e7af[_0x4efea6]['phone'])){_0x5f1d9a[_0x13ec('0xde')](_0x13ec('0x21b'),_0x1efb51,_0x54e7af[_0x4efea6]);}else{_0x5f1d9a[_0x13ec('0xc2')](_[_0x13ec('0xe0')](_0x54e7af[_0x4efea6],[_0x13ec('0x10c'),'Contact.phone']))[_0x13ec('0x43')](_0x5f1d9a[_0x13ec('0x1fe')](_0x1efb51,_0x54e7af[_0x4efea6]))[_0x13ec('0xb9')](_0x5f1d9a['loggerHandler'](_0x13ec('0x21b'),_0x1efb51));}}}})[_0x13ec('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x1efb51,_0xc824e6));}};Dialer[_0x13ec('0x1c')]['handlePredictive']=function(_0x3475a0){if(_0x3475a0[_0x13ec('0x218')]>0x0){var _0x5b18e2=_0x3475a0[_0x13ec('0x218')]-_0x3475a0[_0x13ec('0x7c')]-_0x3475a0['talking'];if(_0x5b18e2>0x0){this['tryOriginatePredictive'](_0x3475a0);}else{loggerPredictiveCalls[_0x13ec('0x8b')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x3475a0);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x2f1c5d){var _0x7d34ba=this;var _0x1973dc=[];_0x2f1c5d[_0x13ec('0x7c')]+=0x1;for(var _0x3b4e7d in this[_0x13ec('0x24')]){if(typeof this[_0x13ec('0x24')][_0x3b4e7d]!==_0x13ec('0xb5')){if(this[_0x13ec('0x24')][_0x3b4e7d][_0x13ec('0xb2')]===_0x13ec('0x219')&&this[_0x13ec('0x24')][_0x3b4e7d][_0x13ec('0xb7')]===_0x13ec('0xe8')){_0x1973dc['push'](this[_0x13ec('0x24')][_0x3b4e7d]['id']);}}}this[_0x13ec('0xd1')](_0x2f1c5d['id'],_0x1973dc,0x1,_0x2f1c5d['dialOrderByScheduledAt'],_0x2f1c5d)[_0x13ec('0x43')](function(_0x389b50){if(!checkContactEmpty(_0x389b50)){checkContactLowerLimitOriginate(_0x2f1c5d,0x1,0x0);_0x7d34ba[_0x13ec('0xbf')](_0x2f1c5d)[_0x13ec('0x43')](sendMessageReschedule(_0x2f1c5d))[_0x13ec('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x2f1c5d['message']='RUNNING';if(_[_0x13ec('0xed')](_0x389b50[0x0])||_[_0x13ec('0xed')](_0x389b50[0x0][_0x13ec('0x19a')])||_[_0x13ec('0xed')](_0x389b50[0x0]['phone'])){_0x7d34ba[_0x13ec('0xde')]('[actionOriginate]\x20',_0x2f1c5d,_0x389b50[0x0]);}else{_0x7d34ba['checkIsBlackList'](_[_0x13ec('0xe0')](_0x389b50[0x0],[_0x13ec('0x10c'),_0x13ec('0x216')]))[_0x13ec('0x43')](_0x7d34ba[_0x13ec('0x1fe')](_0x2f1c5d,_0x389b50[0x0]))['catch'](_0x7d34ba[_0x13ec('0xdd')](_0x13ec('0x21c'),_0x2f1c5d));}}})[_0x13ec('0xb9')](loggerGetContactDialer(_0x13ec('0x21d'),_0x2f1c5d,0x1));emitVoiceQueueSummary(_0x2f1c5d);};Dialer[_0x13ec('0x1c')][_0x13ec('0x1f5')]=function(_0x55f7c4,_0x3b0815,_0x1cb267,_0x1a848c,_0x41add2,_0x4a1d8d){loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x21e'));loggerPredictive[_0x13ec('0x8b')]('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',_0x55f7c4);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x21f'),_0x3b0815);loggerPredictive['info'](_0x13ec('0x220'),_0x1cb267);loggerPredictive[_0x13ec('0x8b')]('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',_0x1a848c);loggerPredictive['info'](_0x13ec('0x221'),_0x41add2);loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x99'));return new Promise(function(_0x3ed963,_0x2ca862){if(_0x55f7c4<=0x0||isNaN(_0x55f7c4)){return _0x2ca862(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x55f7c4));}if(_0x1cb267<=0x0||isNaN(_0x1cb267)){return _0x2ca862(msgResponse('[abandonmentRate]',_0x13ec('0x4e'),'Ts\x20=\x20'+_0x1cb267));}if(_0x1a848c<=0x0||isNaN(_0x1a848c)){return _0x2ca862(msgResponse('[abandonmentRate]',_0x13ec('0x4e'),_0x13ec('0x222')+_0x1a848c));}if(_0x3b0815<=0x0||isNaN(_0x3b0815)){return _0x2ca862(msgResponse(_0x13ec('0x223'),_0x13ec('0x4e'),_0x13ec('0x224')+_0x3b0815));}if(_0x41add2<=0x0||isNaN(_0x41add2)){return _0x2ca862(msgResponse('[abandonmentRate]',_0x13ec('0x4e'),_0x13ec('0x225')+_0x41add2));}_0x4a1d8d=_0x4a1d8d||0x0;var _0x1758b5=0x1/_0x1cb267;var _0x58539e=0x0;var _0x4c7d3f=0x0;var _0x15f524=0x0;var _0x72e350=0x0;for(var _0x152f41=0x0;_0x15f524<_0x41add2;_0x152f41+=0x1){_0x4c7d3f=_0x152f41/_0x3b0815;_0x58539e=(_0x1a848c*_0x4c7d3f+_0x4a1d8d)/_0x1758b5;_0x15f524=erlangb(_0x58539e,_0x55f7c4);_0x72e350=_0x58539e/_0x55f7c4*(0x1-erlangb(_0x58539e,_0x55f7c4));}return _0x3ed963({'erlangCalls':_0x152f41,'erlangCallToSecond':_0x3b0815/_0x152f41,'erlangAbandonmentRate':_0x15f524,'erlangBusyFactor':_0x72e350});});};Dialer[_0x13ec('0x1c')][_0x13ec('0x1f7')]=function(_0x19d414,_0x11b821,_0x5c3093,_0x14a5ae,_0x31dac5,_0x3ab054){loggerPredictive['info'](_0x13ec('0x226'));loggerPredictive[_0x13ec('0x8b')](_0x13ec('0x227'),_0x19d414);loggerPredictive[_0x13ec('0x8b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11b821);loggerPredictive['info'](_0x13ec('0x220'),_0x5c3093);loggerPredictive['info'](_0x13ec('0x228'),_0x14a5ae);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31dac5);loggerPredictive['info'](_0x13ec('0x99'));return new Promise(function(_0x1ff278,_0x248fdc){if(_0x19d414<=0x0||isNaN(_0x19d414)){return _0x248fdc(msgResponse(_0x13ec('0x229'),'Error',_0x13ec('0x22a')+_0x19d414));}if(_0x5c3093<=0x0||isNaN(_0x5c3093)){return _0x248fdc(msgResponse(_0x13ec('0x229'),_0x13ec('0x4e'),'Ts\x20=\x20'+_0x5c3093));}if(_0x14a5ae<=0x0||isNaN(_0x14a5ae)){return _0x248fdc(msgResponse(_0x13ec('0x229'),'Error',_0x13ec('0x222')+_0x14a5ae));}if(_0x11b821<=0x0||isNaN(_0x11b821)){return _0x248fdc(msgResponse('[busyFactor]',_0x13ec('0x4e'),'interval\x20=\x20'+_0x11b821));}if(_0x31dac5<=0x0||isNaN(_0x31dac5)){return _0x248fdc(msgResponse(_0x13ec('0x229'),_0x13ec('0x4e'),_0x13ec('0x22b')+_0x31dac5));}_0x3ab054=_0x3ab054||0x0;var _0x164497=0x1/_0x5c3093;var _0x1e1715=0x0;var _0x207d89=0x0;var _0x9ee2f9=0x0;var _0x471cb8=0x0;for(var _0x354716=0x0;_0x471cb8<_0x31dac5;_0x354716+=0x1){_0x207d89=_0x354716/_0x11b821;_0x1e1715=(_0x14a5ae*_0x207d89+_0x3ab054)/_0x164497;_0x9ee2f9=erlangb(_0x1e1715,_0x19d414);_0x471cb8=_0x1e1715/_0x19d414*(0x1-erlangb(_0x1e1715,_0x19d414));}return _0x1ff278({'erlangCalls':_0x354716,'erlangCallToSecond':_0x11b821/_0x354716,'erlangAbandonmentRate':_0x9ee2f9,'erlangBusyFactor':_0x471cb8});});};module[_0x13ec('0x22c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 441c3a2..6ee49e6 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 _0x0e1d=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x51fe53,_0x1dfa87){var _0x276418=function(_0x17074d){while(--_0x17074d){_0x51fe53['push'](_0x51fe53['shift']());}};_0x276418(++_0x1dfa87);}(_0x0e1d,0x1d9));var _0xd0e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0e1d[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xd0e1('0x0'));var _=require(_0xd0e1('0x1'));var moment=require(_0xd0e1('0x2'));function getSeconds(_0x129590,_0x272f6a){var _0x28575f=moment(_0x129590)[_0xd0e1('0x3')](0x0);var _0x4edd47=moment(_0x272f6a)['milliseconds'](0x0);return _0x28575f[_0xd0e1('0x4')](_0x4edd47,_0xd0e1('0x5'));}function QueueCallerAbandon(_0x293eea,_0x507ba3){this[_0xd0e1('0x6')]=_0x293eea[_0xd0e1('0x6')];this[_0xd0e1('0x7')]=_0x293eea[_0xd0e1('0x7')];this[_0xd0e1('0x8')]=_0x293eea['type']==='outbound'?_0xd0e1('0x9'):_0x293eea[_0xd0e1('0x7')];this[_0xd0e1('0xa')]=_0x293eea[_0xd0e1('0xa')];this[_0xd0e1('0xb')]=_0x293eea[_0xd0e1('0xb')];this[_0xd0e1('0xc')]=_0x293eea[_0xd0e1('0xc')];this[_0xd0e1('0xd')]=_0x293eea[_0xd0e1('0xa')]+_0x293eea['countcongestionretry']+_0x293eea['countnoanswerretry']+_0x293eea['countnosuchnumberretry']+_0x293eea[_0xd0e1('0xe')]+_0x293eea[_0xd0e1('0xf')]+_0x293eea[_0xd0e1('0x10')]+_0x293eea[_0xd0e1('0x11')];this[_0xd0e1('0x12')]=_0x293eea[_0xd0e1('0x12')];this[_0xd0e1('0xe')]=_0x293eea['countdropretry'];this[_0xd0e1('0xf')]=_0x293eea['countabandonedretry'];this[_0xd0e1('0x10')]=_0x293eea[_0xd0e1('0x10')];this['countagentrejectretry']=_0x293eea[_0xd0e1('0x11')];this[_0xd0e1('0x13')]=_0x507ba3['uniqueid'];this[_0xd0e1('0x14')]=_0x293eea[_0xd0e1('0x15')];this[_0xd0e1('0x16')]=_0x293eea[_0xd0e1('0x17')];this[_0xd0e1('0x18')]=_0x293eea[_0xd0e1('0x18')];this[_0xd0e1('0x19')]=_0x293eea[_0xd0e1('0x19')];this[_0xd0e1('0x1a')]=_0x293eea[_0xd0e1('0x1a')];this['endtime']=this[_0xd0e1('0x1a')];this[_0xd0e1('0x1b')]=getSeconds(_0x293eea[_0xd0e1('0x19')],_0x293eea[_0xd0e1('0x18')]);this[_0xd0e1('0x1c')]=getSeconds(this[_0xd0e1('0x1a')],_0x293eea[_0xd0e1('0x19')]);this['talktime']=0x0;this[_0xd0e1('0x9')]=_0x507ba3[_0xd0e1('0x9')];this[_0xd0e1('0x1d')]=_0x507ba3[_0xd0e1('0x1e')];this[_0xd0e1('0x1f')]=_0x507ba3[_0xd0e1('0x1f')];this[_0xd0e1('0x20')]=_0x293eea[_0xd0e1('0x20')];this[_0xd0e1('0x21')]=_0x293eea['callbackuniqueid'];this['callbackat']=_0x293eea[_0xd0e1('0x22')];this['recallme']=_0x293eea[_0xd0e1('0x23')];this[_0xd0e1('0x24')]=_0x293eea['ContactId'];this['ListId']=_0x293eea[_0xd0e1('0x25')];this[_0xd0e1('0x26')]=_0x293eea['UserId'];this[_0xd0e1('0x27')]=_0x293eea[_0xd0e1('0x27')];this[_0xd0e1('0x28')]=_0x293eea['CampaignId'];this['originatecalleridnum']=_0x293eea[_0xd0e1('0x29')]||'';this['originatecalleridname']=_0x293eea[_0xd0e1('0x2a')]||'';}module[_0xd0e1('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xd6e5=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5114aa,_0x4596b9){var _0x1841bc=function(_0x3a3f44){while(--_0x3a3f44){_0x5114aa['push'](_0x5114aa['shift']());}};_0x1841bc(++_0x4596b9);}(_0xd6e5,0x184));var _0x5d6e=function(_0x5455ea,_0x50c525){_0x5455ea=_0x5455ea-0x0;var _0x50d05=_0xd6e5[_0x5455ea];return _0x50d05;};'use strict';var util=require(_0x5d6e('0x0'));var _=require('lodash');var moment=require(_0x5d6e('0x1'));function getSeconds(_0x512174,_0x4884bf){var _0x3bd794=moment(_0x512174)['milliseconds'](0x0);var _0x25de99=moment(_0x4884bf)['milliseconds'](0x0);return _0x3bd794['diff'](_0x25de99,_0x5d6e('0x2'));}function QueueCallerAbandon(_0x4db98f,_0x582ab4){this[_0x5d6e('0x3')]=_0x4db98f[_0x5d6e('0x3')];this[_0x5d6e('0x4')]=_0x4db98f[_0x5d6e('0x4')];this[_0x5d6e('0x5')]=_0x4db98f['type']===_0x5d6e('0x6')?_0x5d6e('0x7'):_0x4db98f['type'];this[_0x5d6e('0x8')]=_0x4db98f[_0x5d6e('0x8')];this['countcongestionretry']=_0x4db98f[_0x5d6e('0x9')];this[_0x5d6e('0xa')]=_0x4db98f[_0x5d6e('0xa')];this[_0x5d6e('0xb')]=_0x4db98f[_0x5d6e('0x8')]+_0x4db98f[_0x5d6e('0x9')]+_0x4db98f['countnoanswerretry']+_0x4db98f['countnosuchnumberretry']+_0x4db98f[_0x5d6e('0xc')]+_0x4db98f[_0x5d6e('0xd')]+_0x4db98f[_0x5d6e('0xe')]+_0x4db98f[_0x5d6e('0xf')];this[_0x5d6e('0x10')]=_0x4db98f['countnosuchnumberretry'];this[_0x5d6e('0xc')]=_0x4db98f[_0x5d6e('0xc')];this[_0x5d6e('0xd')]=_0x4db98f[_0x5d6e('0xd')];this[_0x5d6e('0xe')]=_0x4db98f[_0x5d6e('0xe')];this[_0x5d6e('0xf')]=_0x4db98f[_0x5d6e('0xf')];this['uniqueid']=_0x582ab4['uniqueid'];this['calleridname']=_0x4db98f['name'];this['calleridnum']=_0x4db98f[_0x5d6e('0x11')];this[_0x5d6e('0x12')]=_0x4db98f[_0x5d6e('0x12')];this['responsetime']=_0x4db98f[_0x5d6e('0x13')];this[_0x5d6e('0x14')]=_0x4db98f[_0x5d6e('0x14')];this[_0x5d6e('0x15')]=this[_0x5d6e('0x14')];this[_0x5d6e('0x16')]=getSeconds(_0x4db98f[_0x5d6e('0x13')],_0x4db98f['starttime']);this[_0x5d6e('0x17')]=getSeconds(this['droptime'],_0x4db98f[_0x5d6e('0x13')]);this[_0x5d6e('0x18')]=0x0;this['queue']=_0x582ab4[_0x5d6e('0x7')];this[_0x5d6e('0x19')]=_0x582ab4[_0x5d6e('0x1a')];this['reason']=_0x582ab4[_0x5d6e('0x1b')];this['callback']=_0x4db98f[_0x5d6e('0x1c')];this[_0x5d6e('0x1d')]=_0x4db98f[_0x5d6e('0x1d')];this[_0x5d6e('0x1e')]=_0x4db98f[_0x5d6e('0x1e')];this[_0x5d6e('0x1f')]=_0x4db98f[_0x5d6e('0x1f')];this[_0x5d6e('0x20')]=_0x4db98f[_0x5d6e('0x20')];this[_0x5d6e('0x21')]=_0x4db98f[_0x5d6e('0x21')];this[_0x5d6e('0x22')]=_0x4db98f[_0x5d6e('0x22')];this[_0x5d6e('0x23')]=_0x4db98f[_0x5d6e('0x23')];this['CampaignId']=_0x4db98f[_0x5d6e('0x24')];this[_0x5d6e('0x25')]=_0x4db98f['originatecalleridnum']||'';this[_0x5d6e('0x26')]=_0x4db98f[_0x5d6e('0x26')]||'';}module[_0x5d6e('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6b76bfc..bcc52d1 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(_0x138ed5,_0x215001){var _0x14b804=function(_0x271f16){while(--_0x271f16){_0x138ed5['push'](_0x138ed5['shift']());}};_0x14b804(++_0x215001);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x151801,_0x1784cf){var _0x42862d=function(_0x2018b3){while(--_0x2018b3){_0x151801['push'](_0x151801['shift']());}};_0x42862d(++_0x1784cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 85173dd..05a0ad3 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 _0xbd7d=['[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd7d,0x19f));var _0xdbd7=function(_0x255faf,_0x2263ae){_0x255faf=_0x255faf-0x0;var _0x403477=_0xbd7d[_0x255faf];return _0x403477;};'use strict';var util=require(_0xdbd7('0x0'));var _=require(_0xdbd7('0x1'));var BPromise=require(_0xdbd7('0x2'));var uuid=require(_0xdbd7('0x3'));var moment=require('moment');var path=require(_0xdbd7('0x4'));var tiff2pdf=require(_0xdbd7('0x5'));var gs=require(_0xdbd7('0x6'));var logger=require(_0xdbd7('0x7'))(_0xdbd7('0x8'));var ami=require('../ami');var rpcDb=require(_0xdbd7('0x9'));var Channel=require(_0xdbd7('0xa'));var ut=require(_0xdbd7('0xb'));var Action=require(_0xdbd7('0xc'));var faxAccount=require(_0xdbd7('0xd'));var attachment=require(_0xdbd7('0xe'));var faxMessage=require(_0xdbd7('0xf'));function Fax(_0x60c2a5){this[_0xdbd7('0x10')]={};this[_0xdbd7('0x11')]=_0x60c2a5[_0xdbd7('0x11')];this[_0xdbd7('0x12')]=_0x60c2a5[_0xdbd7('0x12')];this[_0xdbd7('0x13')]={};ami['on'](_0xdbd7('0x14'),this[_0xdbd7('0x15')][_0xdbd7('0x16')](this));ami['on']('varset',this[_0xdbd7('0x17')][_0xdbd7('0x16')](this));ami['on'](_0xdbd7('0x18'),this['syncNewState'][_0xdbd7('0x16')](this));ami['on'](_0xdbd7('0x19'),this['syncNewExten'][_0xdbd7('0x16')](this));ami['on']('faxstatus',this[_0xdbd7('0x1a')][_0xdbd7('0x16')](this));ami['on'](_0xdbd7('0x1b'),this[_0xdbd7('0x1c')][_0xdbd7('0x16')](this));ami['on'](_0xdbd7('0x1d'),this[_0xdbd7('0x1e')][_0xdbd7('0x16')](this));ami['on'](_0xdbd7('0x1f'),this[_0xdbd7('0x20')][_0xdbd7('0x16')](this));}Fax[_0xdbd7('0x21')][_0xdbd7('0x15')]=function(_0x19475b){if(_0x19475b[_0xdbd7('0x22')]===_0xdbd7('0x23')){for(var _0x1353b2 in this[_0xdbd7('0x11')]){if(this[_0xdbd7('0x11')][_0xdbd7('0x24')](_0x1353b2)){if(_0x19475b[_0xdbd7('0x25')]===this[_0xdbd7('0x11')][_0x1353b2]['localstationid']){this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]]={};this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]][_0xdbd7('0x27')]=_0x19475b[_0xdbd7('0x27')];this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]]['id']=this[_0xdbd7('0x11')][_0x1353b2]['id'];this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]][_0xdbd7('0x28')]=this[_0xdbd7('0x11')][_0x1353b2][_0xdbd7('0x28')];logger['info'](_0x19475b['uniqueid'],_0xdbd7('0x29'));}}}}if(this[_0xdbd7('0x13')][_0x19475b['uniqueid']]){this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]]={};this[_0xdbd7('0x10')][_0x19475b[_0xdbd7('0x26')]]['channel']=_0x19475b['channel'];logger[_0xdbd7('0x2a')](_0x19475b[_0xdbd7('0x26')],_0xdbd7('0x29'));}};Fax[_0xdbd7('0x21')][_0xdbd7('0x17')]=function(_0x4a33bb){if(this['channels'][_0x4a33bb[_0xdbd7('0x26')]]){for(var _0x5c42de in _0x4a33bb['variable']){if(_0x4a33bb[_0xdbd7('0x2b')][_0xdbd7('0x24')](_0x5c42de)){this[_0xdbd7('0x10')][_0x4a33bb[_0xdbd7('0x26')]][_0x5c42de]=_0x4a33bb[_0xdbd7('0x2c')];}}}};Fax[_0xdbd7('0x21')][_0xdbd7('0x2d')]=function(_0x300b4a){if(this['channels'][_0x300b4a[_0xdbd7('0x26')]]){this['channels'][_0x300b4a['uniqueid']][_0xdbd7('0x2e')]=_0x300b4a[_0xdbd7('0x2e')];this[_0xdbd7('0x10')][_0x300b4a[_0xdbd7('0x26')]][_0xdbd7('0x2f')]=_0x300b4a[_0xdbd7('0x2f')];}};Fax[_0xdbd7('0x21')][_0xdbd7('0x30')]=function(_0x2ac229){if(this['channels'][_0x2ac229['uniqueid']]){for(var _0x43643d in _0x2ac229[_0xdbd7('0x2b')]){if(_0x2ac229[_0xdbd7('0x2b')][_0xdbd7('0x24')](_0x43643d)){this[_0xdbd7('0x10')][_0x2ac229[_0xdbd7('0x26')]][_0x43643d]=_0x2ac229[_0xdbd7('0x2c')];}}}};Fax['prototype'][_0xdbd7('0x1a')]=function(_0x5a6572){if(this[_0xdbd7('0x10')][_0x5a6572[_0xdbd7('0x26')]]){this[_0xdbd7('0x10')][_0x5a6572[_0xdbd7('0x26')]]['operation']=_0x5a6572['operation'];this[_0xdbd7('0x10')][_0x5a6572['uniqueid']]['status']=_0x5a6572[_0xdbd7('0x31')];this[_0xdbd7('0x10')][_0x5a6572['uniqueid']]['localstationid']=_0x5a6572[_0xdbd7('0x32')];this[_0xdbd7('0x10')][_0x5a6572[_0xdbd7('0x26')]][_0xdbd7('0x33')]=_0x5a6572[_0xdbd7('0x33')];logger[_0xdbd7('0x2a')](_0x5a6572['uniqueid'],_0xdbd7('0x34'));}};Fax[_0xdbd7('0x21')][_0xdbd7('0x1c')]=function(_0x52e40a){var _0x2432c9=this;if(this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]]){var _0x28819f=this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]]['id'];this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]][_0xdbd7('0x35')]=_0x52e40a[_0xdbd7('0x35')];this[_0xdbd7('0x10')][_0x52e40a['uniqueid']]['pagestransferred']=_0x52e40a[_0xdbd7('0x36')];this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]][_0xdbd7('0x32')]=_0x52e40a[_0xdbd7('0x32')];this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]][_0xdbd7('0x37')]=_0x52e40a['resolution'];this[_0xdbd7('0x10')][_0x52e40a['uniqueid']][_0xdbd7('0x38')]=_0x52e40a[_0xdbd7('0x38')];this['channels'][_0x52e40a['uniqueid']]['filename']=_0x52e40a[_0xdbd7('0x33')];this[_0xdbd7('0x10')][_0x52e40a[_0xdbd7('0x26')]][_0xdbd7('0x39')]=_0x52e40a['calleridnum'];if(this['channels'][_0x52e40a[_0xdbd7('0x26')]][_0xdbd7('0x36')]>0x0){tiff2pdf(_0x52e40a['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x3a8c30){logger['info'](_0x52e40a[_0xdbd7('0x26')],_0xdbd7('0x3a'),_0x3a8c30[_0xdbd7('0x3b')]);attachment[_0xdbd7('0x3c')]({'name':path[_0xdbd7('0x3d')](_0x52e40a['filename'])[_0xdbd7('0x28')],'basename':path[_0xdbd7('0x3d')](_0x52e40a[_0xdbd7('0x33')])[_0xdbd7('0x28')]+_0xdbd7('0x3e'),'type':_0xdbd7('0x3f')})['then'](function(_0x4225f4){faxAccount[_0xdbd7('0x40')](_0x28819f,{'from':_0x52e40a['calleridnum'],'mapKey':_0xdbd7('0x8'),'body':path[_0xdbd7('0x3d')](_0x52e40a[_0xdbd7('0x33')])['name']+_0xdbd7('0x3e'),'AttachmentId':_0x4225f4['id']})[_0xdbd7('0x41')](function(_0x8b23ae){logger[_0xdbd7('0x42')](_0x52e40a[_0xdbd7('0x26')],_0xdbd7('0x43'),JSON[_0xdbd7('0x44')](_0x8b23ae));});})[_0xdbd7('0x41')](function(_0x28e15e){logger[_0xdbd7('0x42')](_0x52e40a[_0xdbd7('0x26')],_0xdbd7('0x45'),JSON[_0xdbd7('0x44')](_0x28e15e));});});}logger[_0xdbd7('0x2a')](_0x52e40a[_0xdbd7('0x26')],'\x20receiveFax\x20');}};Fax[_0xdbd7('0x21')][_0xdbd7('0x20')]=function(_0x258813){if(this[_0xdbd7('0x13')][_0x258813[_0xdbd7('0x26')]]){_['merge'](this[_0xdbd7('0x10')][_0x258813[_0xdbd7('0x26')]],_[_0xdbd7('0x46')](_0x258813,[_0xdbd7('0x47'),_0xdbd7('0x48')]));}};function updateStatus(_0x581482){if(_0x581482[_0xdbd7('0x49')]){faxMessage[_0xdbd7('0x4a')](_0x581482[_0xdbd7('0x49')],{'failMessage':_0xdbd7('0x4b')})[_0xdbd7('0x4c')](function(_0x47e3b3){ut['logger'](_0xdbd7('0x4d'),_0x47e3b3);})[_0xdbd7('0x41')](function(_0x65978c){ut[_0xdbd7('0x4e')](_0xdbd7('0x4f'),_0x65978c);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xdbd7('0x21')][_0xdbd7('0x50')]=function(_0x1e3d87,_0x47f5b0,_0xd458ec){var _0x30ed08=this;var _0x513bd5={};if(_0x47f5b0){_0x513bd5={'read':_0x47f5b0};}else{_0x513bd5={'failMessage':_0xd458ec};}if(this[_0xdbd7('0x13')][_0x1e3d87][_0xdbd7('0x49')]){faxMessage[_0xdbd7('0x4a')](this[_0xdbd7('0x13')][_0x1e3d87]['AttachmentId'],_0x513bd5)[_0xdbd7('0x4c')](function(_0x22fe80){ut[_0xdbd7('0x4e')](_0xdbd7('0x51'),_0x22fe80);})[_0xdbd7('0x41')](function(_0x2b73c8){ut['logger'](_0xdbd7('0x52'),_0x2b73c8);})[_0xdbd7('0x53')](function(){delete _0x30ed08[_0xdbd7('0x10')][_0x1e3d87];delete _0x30ed08[_0xdbd7('0x13')][_0x1e3d87];});}else{ut[_0xdbd7('0x4e')]('[Fax][Message][NoUpdate2]');delete this[_0xdbd7('0x10')][_0x1e3d87];delete this['actions'][_0x1e3d87];}};Fax[_0xdbd7('0x21')]['syncHangup']=function(_0x11ffd5){var _0x34451b=this;if(this[_0xdbd7('0x10')][_0x11ffd5[_0xdbd7('0x26')]]){if(this[_0xdbd7('0x13')][_0x11ffd5[_0xdbd7('0x26')]]){this[_0xdbd7('0x10')][_0x11ffd5['uniqueid']]['id']=this['actions'][_0x11ffd5[_0xdbd7('0x26')]]['id'];this[_0xdbd7('0x10')][_0x11ffd5[_0xdbd7('0x26')]][_0xdbd7('0x28')]=this[_0xdbd7('0x13')][_0x11ffd5[_0xdbd7('0x26')]]['name'];}logger[_0xdbd7('0x2a')](_0x11ffd5[_0xdbd7('0x26')],this[_0xdbd7('0x13')][_0x11ffd5[_0xdbd7('0x26')]]?'\x20hangup\x20sendFile\x20':_0xdbd7('0x54'),JSON[_0xdbd7('0x44')](this[_0xdbd7('0x10')][_0x11ffd5[_0xdbd7('0x26')]]));if(this[_0xdbd7('0x13')][_0x11ffd5[_0xdbd7('0x26')]]){if(this[_0xdbd7('0x10')][_0x11ffd5[_0xdbd7('0x26')]][_0xdbd7('0x55')]>0x0&&this[_0xdbd7('0x10')][_0x11ffd5['uniqueid']][_0xdbd7('0x56')]===_0xdbd7('0x57')){this['updateStatus'](_0x11ffd5['uniqueid'],!![]);}else{this[_0xdbd7('0x50')](_0x11ffd5['uniqueid'],![],this['channels'][_0x11ffd5['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0xdbd7('0x10')][_0x11ffd5[_0xdbd7('0x26')]][_0xdbd7('0x58')]:'SENDING\x20FAILED');}}}};Fax[_0xdbd7('0x21')][_0xdbd7('0x59')]=function(_0x593534){var _0x1b9aa7=this;return new BPromise(function(_0x1b1bca,_0x2acf3a){_0x1b9aa7[_0xdbd7('0x5a')](_0x593534,_0x1b9aa7[_0xdbd7('0x11')][_0x593534[_0xdbd7('0x5b')]])[_0xdbd7('0x4c')](function(_0x534897){ut[_0xdbd7('0x4e')](_0xdbd7('0x5c'),_0x534897);_0x1b1bca(ut[_0xdbd7('0x3b')]('Fax\x20received'));})[_0xdbd7('0x41')](function(_0x17dcca){ut[_0xdbd7('0x4e')](_0xdbd7('0x5d'),_0x17dcca);updateStatus(_0x593534);_0x2acf3a(ut['message'](_0xdbd7('0x5e')));});});};Fax['prototype'][_0xdbd7('0x5f')]=function(_0x244c20){var _0x53fb53=this;return new BPromise(function(_0x430160,_0x32a623){var _0x5ac7ee=_0x53fb53[_0xdbd7('0x60')](_0x53fb53[_0xdbd7('0x11')][_0x244c20[_0xdbd7('0x5b')]][_0xdbd7('0x61')],_0x244c20);if(_0x5ac7ee[_0xdbd7('0x62')]){_0x430160(ut[_0xdbd7('0x3b')]('Trunk\x20Reachable'));}else{_0x32a623(ut[_0xdbd7('0x3b')](_0x5ac7ee[_0xdbd7('0x3b')]));}});};function originate(_0x28506b,_0x1474b0,_0x196bdc){return new BPromise(function(_0x3c4eea,_0x591a7a){if(_0x196bdc){var _0x2c8ab7=util[_0xdbd7('0x63')](_0xdbd7('0x64'),path['parse'](_0x28506b[_0xdbd7('0x4')])['name'],_0x28506b['path']);gs[_0xdbd7('0x65')](_0x2c8ab7)['then'](function(){_0x28506b[_0xdbd7('0x4')]=util[_0xdbd7('0x63')](_0xdbd7('0x66'),path[_0xdbd7('0x3d')](_0x28506b[_0xdbd7('0x4')])['dir'],path[_0xdbd7('0x3d')](_0x28506b[_0xdbd7('0x4')])[_0xdbd7('0x28')]);_0x1474b0[_0xdbd7('0x67')]=_0x28506b[_0xdbd7('0x4')];ut['logger'](_0xdbd7('0x68'),'');ami['Action'](ut['variablesAction'](_0x28506b,_0x1474b0))[_0xdbd7('0x4c')](function(_0x318f12){_0x3c4eea(_0x318f12);})['catch'](function(_0x298ef8){_0x591a7a(_0x298ef8);});})[_0xdbd7('0x41')](function(_0x561613){_0x591a7a(_0x561613);});}else{ami[_0xdbd7('0x69')](ut[_0xdbd7('0x6a')](_0x28506b,_0x1474b0))[_0xdbd7('0x4c')](function(_0x3c4ef5){_0x3c4eea(_0x3c4ef5);})[_0xdbd7('0x41')](function(_0x5ad446){_0x591a7a(_0x5ad446);});}});}Fax[_0xdbd7('0x21')][_0xdbd7('0x5a')]=function(_0x55a032,_0x58c082){var _0x1f860f=this;return new BPromise(function(_0x33f575,_0x566719){var _0x7a0688=uuid['v4']();var _0x46eff8=ut[_0xdbd7('0x6b')](_0x55a032,_0x58c082);_0x1f860f[_0xdbd7('0x13')][_0x7a0688]=new Action(_0x7a0688,_0x58c082,_0x55a032);var _0x1ab674=_0x1f860f['actions'][_0x7a0688];if(path[_0xdbd7('0x3d')](_0x55a032[_0xdbd7('0x4')])[_0xdbd7('0x6c')]===_0xdbd7('0x3e')){originate(_0x1ab674,_0x46eff8,!![])[_0xdbd7('0x4c')](function(_0xa3a3ad){_0x33f575(_0xa3a3ad);})['catch'](function(_0x26ffb9){_0x566719(_0x26ffb9);});}else{originate(_0x1ab674,_0x46eff8,![])[_0xdbd7('0x4c')](function(_0x3f46df){_0x33f575(_0x3f46df);})[_0xdbd7('0x41')](function(_0x36b49b){_0x566719(_0x36b49b);});}});};Fax[_0xdbd7('0x21')][_0xdbd7('0x6d')]=function(_0x39b8dd){return!_[_0xdbd7('0x6e')](_0x39b8dd)&&!_[_0xdbd7('0x6e')](_0x39b8dd[_0xdbd7('0x28')])&&!_[_0xdbd7('0x6e')](_0x39b8dd[_0xdbd7('0x6f')])&&_0x39b8dd['active']&&!_[_0xdbd7('0x6e')](this[_0xdbd7('0x12')][util['format']('SIP/%s',_0x39b8dd[_0xdbd7('0x28')])])&&!_[_0xdbd7('0x6e')](this[_0xdbd7('0x12')][util[_0xdbd7('0x63')](_0xdbd7('0x70'),_0x39b8dd[_0xdbd7('0x28')])][_0xdbd7('0x31')])&&(this[_0xdbd7('0x12')][util[_0xdbd7('0x63')](_0xdbd7('0x70'),_0x39b8dd[_0xdbd7('0x28')])][_0xdbd7('0x31')]===_0xdbd7('0x71')||this['trunks'][util[_0xdbd7('0x63')](_0xdbd7('0x70'),_0x39b8dd[_0xdbd7('0x28')])][_0xdbd7('0x31')]===_0xdbd7('0x72'));};Fax[_0xdbd7('0x21')][_0xdbd7('0x60')]=function(_0x46b465,_0x202d8a){if(!this['isTrunkReachable'](_0x46b465)){ut[_0xdbd7('0x4e')](_0xdbd7('0x73'),_[_0xdbd7('0x6e')](_0x46b465)?'':_0x46b465['name']+_0xdbd7('0x74'));return{'isValid':![],'message':_0xdbd7('0x75')};}if(_[_0xdbd7('0x6e')](_0x202d8a[_0xdbd7('0x8')])){ut[_0xdbd7('0x4e')](_0xdbd7('0x76'),JSON[_0xdbd7('0x44')](_0x202d8a));return{'isValid':![],'message':_0xdbd7('0x77')};}if(_[_0xdbd7('0x6e')](_0x202d8a[_0xdbd7('0x4')])){ut[_0xdbd7('0x4e')](_0xdbd7('0x78'),JSON[_0xdbd7('0x44')](_0x202d8a));return{'isValid':![],'message':_0xdbd7('0x79')};}return{'isValid':!![],'message':_0xdbd7('0x7a')};};module[_0xdbd7('0x7b')]=Fax; \ No newline at end of file +var _0xa39a=['SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','name','info','channel','syncVarSet','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','notify','catch','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring'];(function(_0x5176fc,_0x35a778){var _0x5c0f49=function(_0x49ed9c){while(--_0x49ed9c){_0x5176fc['push'](_0x5176fc['shift']());}};_0x5c0f49(++_0x35a778);}(_0xa39a,0xfb));var _0xaa39=function(_0x6845d4,_0x1271aa){_0x6845d4=_0x6845d4-0x0;var _0x8b8faa=_0xa39a[_0x6845d4];return _0x8b8faa;};'use strict';var util=require(_0xaa39('0x0'));var _=require(_0xaa39('0x1'));var BPromise=require(_0xaa39('0x2'));var uuid=require('uuid');var moment=require(_0xaa39('0x3'));var path=require('path');var tiff2pdf=require(_0xaa39('0x4'));var gs=require(_0xaa39('0x5'));var logger=require(_0xaa39('0x6'))(_0xaa39('0x7'));var ami=require(_0xaa39('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xaa39('0x9'));var Action=require(_0xaa39('0xa'));var faxAccount=require(_0xaa39('0xb'));var attachment=require(_0xaa39('0xc'));var faxMessage=require(_0xaa39('0xd'));function Fax(_0x3efb24){this['channels']={};this['faxAccounts']=_0x3efb24[_0xaa39('0xe')];this[_0xaa39('0xf')]=_0x3efb24[_0xaa39('0xf')];this[_0xaa39('0x10')]={};ami['on'](_0xaa39('0x11'),this[_0xaa39('0x12')]['bind'](this));ami['on'](_0xaa39('0x13'),this['syncVarSet'][_0xaa39('0x14')](this));ami['on'](_0xaa39('0x15'),this[_0xaa39('0x16')][_0xaa39('0x14')](this));ami['on'](_0xaa39('0x17'),this[_0xaa39('0x18')][_0xaa39('0x14')](this));ami['on'](_0xaa39('0x19'),this[_0xaa39('0x1a')][_0xaa39('0x14')](this));ami['on']('receivefax',this[_0xaa39('0x1b')]['bind'](this));ami['on'](_0xaa39('0x1c'),this[_0xaa39('0x1d')][_0xaa39('0x14')](this));ami['on'](_0xaa39('0x1e'),this['syncOriginateResponse'][_0xaa39('0x14')](this));}Fax[_0xaa39('0x1f')][_0xaa39('0x12')]=function(_0x248f9a){if(_0x248f9a[_0xaa39('0x20')]===_0xaa39('0x21')){for(var _0x474acf in this[_0xaa39('0xe')]){if(this[_0xaa39('0xe')]['hasOwnProperty'](_0x474acf)){if(_0x248f9a['exten']===this[_0xaa39('0xe')][_0x474acf][_0xaa39('0x22')]){this[_0xaa39('0x23')][_0x248f9a[_0xaa39('0x24')]]={};this[_0xaa39('0x23')][_0x248f9a[_0xaa39('0x24')]]['channel']=_0x248f9a['channel'];this[_0xaa39('0x23')][_0x248f9a[_0xaa39('0x24')]]['id']=this[_0xaa39('0xe')][_0x474acf]['id'];this[_0xaa39('0x23')][_0x248f9a[_0xaa39('0x24')]][_0xaa39('0x25')]=this[_0xaa39('0xe')][_0x474acf][_0xaa39('0x25')];logger[_0xaa39('0x26')](_0x248f9a[_0xaa39('0x24')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x248f9a[_0xaa39('0x24')]]){this[_0xaa39('0x23')][_0x248f9a['uniqueid']]={};this[_0xaa39('0x23')][_0x248f9a[_0xaa39('0x24')]][_0xaa39('0x27')]=_0x248f9a[_0xaa39('0x27')];logger['info'](_0x248f9a[_0xaa39('0x24')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xaa39('0x28')]=function(_0xb71997){if(this[_0xaa39('0x23')][_0xb71997[_0xaa39('0x24')]]){for(var _0x1f7814 in _0xb71997['variable']){if(_0xb71997[_0xaa39('0x29')][_0xaa39('0x2a')](_0x1f7814)){this[_0xaa39('0x23')][_0xb71997[_0xaa39('0x24')]][_0x1f7814]=_0xb71997['value'];}}}};Fax[_0xaa39('0x1f')][_0xaa39('0x16')]=function(_0x518475){if(this[_0xaa39('0x23')][_0x518475[_0xaa39('0x24')]]){this[_0xaa39('0x23')][_0x518475[_0xaa39('0x24')]][_0xaa39('0x2b')]=_0x518475[_0xaa39('0x2b')];this[_0xaa39('0x23')][_0x518475['uniqueid']][_0xaa39('0x2c')]=_0x518475[_0xaa39('0x2c')];}};Fax['prototype'][_0xaa39('0x18')]=function(_0x4ca6e6){if(this['channels'][_0x4ca6e6['uniqueid']]){for(var _0x559c3f in _0x4ca6e6[_0xaa39('0x29')]){if(_0x4ca6e6[_0xaa39('0x29')]['hasOwnProperty'](_0x559c3f)){this[_0xaa39('0x23')][_0x4ca6e6['uniqueid']][_0x559c3f]=_0x4ca6e6[_0xaa39('0x2d')];}}}};Fax[_0xaa39('0x1f')][_0xaa39('0x1a')]=function(_0x379b52){if(this['channels'][_0x379b52[_0xaa39('0x24')]]){this[_0xaa39('0x23')][_0x379b52[_0xaa39('0x24')]][_0xaa39('0x2e')]=_0x379b52['operation'];this[_0xaa39('0x23')][_0x379b52[_0xaa39('0x24')]][_0xaa39('0x2f')]=_0x379b52['status'];this[_0xaa39('0x23')][_0x379b52[_0xaa39('0x24')]]['localstationid']=_0x379b52[_0xaa39('0x22')];this[_0xaa39('0x23')][_0x379b52[_0xaa39('0x24')]][_0xaa39('0x30')]=_0x379b52[_0xaa39('0x30')];logger[_0xaa39('0x26')](_0x379b52['uniqueid'],_0xaa39('0x31'));}};Fax[_0xaa39('0x1f')][_0xaa39('0x1b')]=function(_0x241764){var _0x532348=this;if(this['channels'][_0x241764['uniqueid']]){var _0x12deeb=this[_0xaa39('0x23')][_0x241764['uniqueid']]['id'];this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]][_0xaa39('0x32')]=_0x241764[_0xaa39('0x32')];this['channels'][_0x241764[_0xaa39('0x24')]]['pagestransferred']=_0x241764[_0xaa39('0x33')];this['channels'][_0x241764[_0xaa39('0x24')]][_0xaa39('0x22')]=_0x241764[_0xaa39('0x22')];this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]][_0xaa39('0x34')]=_0x241764[_0xaa39('0x34')];this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]][_0xaa39('0x35')]=_0x241764[_0xaa39('0x35')];this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]][_0xaa39('0x30')]=_0x241764[_0xaa39('0x30')];this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]][_0xaa39('0x36')]=_0x241764[_0xaa39('0x36')];if(this[_0xaa39('0x23')][_0x241764[_0xaa39('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x241764[_0xaa39('0x30')],_0xaa39('0x37'),function(_0x528bbc){logger[_0xaa39('0x26')](_0x241764[_0xaa39('0x24')],_0xaa39('0x38'),_0x528bbc['message']);attachment['create']({'name':path['parse'](_0x241764['filename'])[_0xaa39('0x25')],'basename':path[_0xaa39('0x39')](_0x241764['filename'])[_0xaa39('0x25')]+_0xaa39('0x3a'),'type':_0xaa39('0x3b')})['then'](function(_0xcd12ba){faxAccount[_0xaa39('0x3c')](_0x12deeb,{'from':_0x241764['calleridnum'],'mapKey':_0xaa39('0x7'),'body':path[_0xaa39('0x39')](_0x241764['filename'])[_0xaa39('0x25')]+'.pdf','AttachmentId':_0xcd12ba['id']})[_0xaa39('0x3d')](function(_0x570a93){logger['error'](_0x241764[_0xaa39('0x24')],'\x20notify\x20',JSON[_0xaa39('0x3e')](_0x570a93));});})['catch'](function(_0x59f223){logger['error'](_0x241764[_0xaa39('0x24')],'\x20receiveFax\x20',JSON[_0xaa39('0x3e')](_0x59f223));});});}logger[_0xaa39('0x26')](_0x241764[_0xaa39('0x24')],_0xaa39('0x3f'));}};Fax[_0xaa39('0x1f')]['syncOriginateResponse']=function(_0x3f450b){if(this[_0xaa39('0x10')][_0x3f450b['uniqueid']]){_['merge'](this[_0xaa39('0x23')][_0x3f450b[_0xaa39('0x24')]],_[_0xaa39('0x40')](_0x3f450b,[_0xaa39('0x41'),_0xaa39('0x42')]));}};function updateStatus(_0xeb95ef){if(_0xeb95ef[_0xaa39('0x43')]){faxMessage['update'](_0xeb95ef[_0xaa39('0x43')],{'failMessage':_0xaa39('0x44')})[_0xaa39('0x45')](function(_0x1f7681){ut[_0xaa39('0x46')]('[Fax][Message][Error][Updated]',_0x1f7681);})['catch'](function(_0x47abd8){ut['logger'](_0xaa39('0x47'),_0x47abd8);});}else{ut[_0xaa39('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xaa39('0x1f')][_0xaa39('0x48')]=function(_0x6085f5,_0x2c2b68,_0x9fa7ba){var _0x187861=this;var _0x383c47={};if(_0x2c2b68){_0x383c47={'read':_0x2c2b68};}else{_0x383c47={'failMessage':_0x9fa7ba};}if(this[_0xaa39('0x10')][_0x6085f5][_0xaa39('0x43')]){faxMessage[_0xaa39('0x49')](this['actions'][_0x6085f5][_0xaa39('0x43')],_0x383c47)[_0xaa39('0x45')](function(_0x1962e7){ut[_0xaa39('0x46')](_0xaa39('0x4a'),_0x1962e7);})[_0xaa39('0x3d')](function(_0x402664){ut[_0xaa39('0x46')](_0xaa39('0x4b'),_0x402664);})[_0xaa39('0x4c')](function(){delete _0x187861[_0xaa39('0x23')][_0x6085f5];delete _0x187861[_0xaa39('0x10')][_0x6085f5];});}else{ut[_0xaa39('0x46')](_0xaa39('0x4d'));delete this['channels'][_0x6085f5];delete this[_0xaa39('0x10')][_0x6085f5];}};Fax[_0xaa39('0x1f')][_0xaa39('0x1d')]=function(_0x4c567d){var _0x54360f=this;if(this[_0xaa39('0x23')][_0x4c567d[_0xaa39('0x24')]]){if(this[_0xaa39('0x10')][_0x4c567d[_0xaa39('0x24')]]){this[_0xaa39('0x23')][_0x4c567d[_0xaa39('0x24')]]['id']=this[_0xaa39('0x10')][_0x4c567d['uniqueid']]['id'];this[_0xaa39('0x23')][_0x4c567d['uniqueid']][_0xaa39('0x25')]=this[_0xaa39('0x10')][_0x4c567d[_0xaa39('0x24')]][_0xaa39('0x25')];}logger['info'](_0x4c567d[_0xaa39('0x24')],this[_0xaa39('0x10')][_0x4c567d[_0xaa39('0x24')]]?'\x20hangup\x20sendFile\x20':_0xaa39('0x4e'),JSON[_0xaa39('0x3e')](this[_0xaa39('0x23')][_0x4c567d[_0xaa39('0x24')]]));if(this[_0xaa39('0x10')][_0x4c567d[_0xaa39('0x24')]]){if(this[_0xaa39('0x23')][_0x4c567d[_0xaa39('0x24')]][_0xaa39('0x4f')]>0x0&&this[_0xaa39('0x23')][_0x4c567d[_0xaa39('0x24')]]['faxstatus']===_0xaa39('0x50')){this[_0xaa39('0x48')](_0x4c567d['uniqueid'],!![]);}else{this[_0xaa39('0x48')](_0x4c567d['uniqueid'],![],this['channels'][_0x4c567d[_0xaa39('0x24')]][_0xaa39('0x51')]?_0xaa39('0x52')+this[_0xaa39('0x23')][_0x4c567d['uniqueid']][_0xaa39('0x51')]:'SENDING\x20FAILED');}}}};Fax[_0xaa39('0x1f')]['send']=function(_0x555d0f){var _0x5ebf62=this;return new BPromise(function(_0x5f4a02,_0x5865ed){_0x5ebf62[_0xaa39('0x53')](_0x555d0f,_0x5ebf62[_0xaa39('0xe')][_0x555d0f[_0xaa39('0x54')]])[_0xaa39('0x45')](function(_0x2d626d){ut[_0xaa39('0x46')](_0xaa39('0x55'),_0x2d626d);_0x5f4a02(ut['message']('Fax\x20received'));})[_0xaa39('0x3d')](function(_0x15df0e){ut[_0xaa39('0x46')](_0xaa39('0x56'),_0x15df0e);updateStatus(_0x555d0f);_0x5865ed(ut[_0xaa39('0x57')]('Fax\x20failed'));});});};Fax['prototype'][_0xaa39('0x58')]=function(_0x8d9cbf){var _0x30141b=this;return new BPromise(function(_0x7669b7,_0x2c8aa7){var _0x306782=_0x30141b[_0xaa39('0x59')](_0x30141b[_0xaa39('0xe')][_0x8d9cbf[_0xaa39('0x54')]][_0xaa39('0x5a')],_0x8d9cbf);if(_0x306782[_0xaa39('0x5b')]){_0x7669b7(ut[_0xaa39('0x57')](_0xaa39('0x5c')));}else{_0x2c8aa7(ut['message'](_0x306782[_0xaa39('0x57')]));}});};function originate(_0x22d9c5,_0x24c598,_0x52b569){return new BPromise(function(_0x1fe7a9,_0x1bf88f){if(_0x52b569){var _0x2c781e=util[_0xaa39('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x22d9c5[_0xaa39('0x5e')])[_0xaa39('0x25')],_0x22d9c5['path']);gs['execute'](_0x2c781e)['then'](function(){_0x22d9c5[_0xaa39('0x5e')]=util[_0xaa39('0x5d')](_0xaa39('0x5f'),path[_0xaa39('0x39')](_0x22d9c5[_0xaa39('0x5e')])[_0xaa39('0x60')],path[_0xaa39('0x39')](_0x22d9c5[_0xaa39('0x5e')])[_0xaa39('0x25')]);_0x24c598[_0xaa39('0x61')]=_0x22d9c5[_0xaa39('0x5e')];ut[_0xaa39('0x46')](_0xaa39('0x62'),'');ami[_0xaa39('0x63')](ut['variablesAction'](_0x22d9c5,_0x24c598))[_0xaa39('0x45')](function(_0x50f865){_0x1fe7a9(_0x50f865);})[_0xaa39('0x3d')](function(_0x3ce088){_0x1bf88f(_0x3ce088);});})[_0xaa39('0x3d')](function(_0x2842bc){_0x1bf88f(_0x2842bc);});}else{ami['Action'](ut['variablesAction'](_0x22d9c5,_0x24c598))[_0xaa39('0x45')](function(_0x5ca3fe){_0x1fe7a9(_0x5ca3fe);})[_0xaa39('0x3d')](function(_0x2daf12){_0x1bf88f(_0x2daf12);});}});}Fax[_0xaa39('0x1f')]['execOriginate']=function(_0x9edb90,_0x231cf9){var _0x3496b7=this;return new BPromise(function(_0x57b1a9,_0x4099e1){var _0x44a224=uuid['v4']();var _0xd1c4e1=ut['addVariables'](_0x9edb90,_0x231cf9);_0x3496b7[_0xaa39('0x10')][_0x44a224]=new Action(_0x44a224,_0x231cf9,_0x9edb90);var _0x2f7692=_0x3496b7[_0xaa39('0x10')][_0x44a224];if(path[_0xaa39('0x39')](_0x9edb90[_0xaa39('0x5e')])['ext']===_0xaa39('0x3a')){originate(_0x2f7692,_0xd1c4e1,!![])[_0xaa39('0x45')](function(_0x43d1f3){_0x57b1a9(_0x43d1f3);})[_0xaa39('0x3d')](function(_0x36ca6a){_0x4099e1(_0x36ca6a);});}else{originate(_0x2f7692,_0xd1c4e1,![])['then'](function(_0x1af4c6){_0x57b1a9(_0x1af4c6);})[_0xaa39('0x3d')](function(_0x516f75){_0x4099e1(_0x516f75);});}});};Fax[_0xaa39('0x1f')][_0xaa39('0x64')]=function(_0x4a4fa2){return!_[_0xaa39('0x65')](_0x4a4fa2)&&!_[_0xaa39('0x65')](_0x4a4fa2['name'])&&!_['isNil'](_0x4a4fa2[_0xaa39('0x66')])&&_0x4a4fa2[_0xaa39('0x66')]&&!_[_0xaa39('0x65')](this[_0xaa39('0xf')][util[_0xaa39('0x5d')](_0xaa39('0x67'),_0x4a4fa2[_0xaa39('0x25')])])&&!_[_0xaa39('0x65')](this[_0xaa39('0xf')][util['format'](_0xaa39('0x67'),_0x4a4fa2[_0xaa39('0x25')])][_0xaa39('0x2f')])&&(this[_0xaa39('0xf')][util['format'](_0xaa39('0x67'),_0x4a4fa2[_0xaa39('0x25')])][_0xaa39('0x2f')]==='reachable'||this[_0xaa39('0xf')][util[_0xaa39('0x5d')](_0xaa39('0x67'),_0x4a4fa2[_0xaa39('0x25')])][_0xaa39('0x2f')]===_0xaa39('0x68'));};Fax[_0xaa39('0x1f')][_0xaa39('0x59')]=function(_0x214ef1,_0x3defd0){if(!this['isTrunkReachable'](_0x214ef1)){ut[_0xaa39('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xaa39('0x65')](_0x214ef1)?'':_0x214ef1['name']+_0xaa39('0x69'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xaa39('0x65')](_0x3defd0[_0xaa39('0x7')])){ut[_0xaa39('0x46')](_0xaa39('0x6a'),JSON[_0xaa39('0x3e')](_0x3defd0));return{'isValid':![],'message':_0xaa39('0x6b')};}if(_['isNil'](_0x3defd0[_0xaa39('0x5e')])){ut['logger'](_0xaa39('0x6c'),JSON[_0xaa39('0x3e')](_0x3defd0));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xaa39('0x6d')};};module[_0xaa39('0x6e')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 320076c..007e9f7 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 _0x668e=['notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','inspect'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x668e,0x109));var _0xe668=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x668e[_0x309d93];return _0x2dd61d;};'use strict';var util=require(_0xe668('0x0'));var BPromise=require(_0xe668('0x1'));var logger=require(_0xe668('0x2'))('preview');var _=require(_0xe668('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1f9282){return function(_0x4c302c){logger['error'](_0x1f9282,util[_0xe668('0x4')](_0x4c302c,{'showHidden':![],'depth':null}));};}exports[_0xe668('0x5')]=function(_0x51eec0,_0x52a2c8){return BPromise[_0xe668('0x6')]()[_0xe668('0x7')](faxAccount['notify'](_0x51eec0,_0x52a2c8))[_0xe668('0x8')](loggerCatch(_0xe668('0x9')));}; \ No newline at end of file +var _0x5403=['notify','resolve','then','catch','[Notify]\x20','util','preview','../rpc/faxAccount'];(function(_0x480d8f,_0x472134){var _0x1b1b08=function(_0x1d54f4){while(--_0x1d54f4){_0x480d8f['push'](_0x480d8f['shift']());}};_0x1b1b08(++_0x472134);}(_0x5403,0x185));var _0x3540=function(_0x41a05a,_0x23adde){_0x41a05a=_0x41a05a-0x0;var _0x2b63df=_0x5403[_0x41a05a];return _0x2b63df;};'use strict';var util=require(_0x3540('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x3540('0x1'));var _=require('lodash');var faxAccount=require(_0x3540('0x2'));function loggerCatch(_0x10871f){return function(_0xaded73){logger['error'](_0x10871f,util['inspect'](_0xaded73,{'showHidden':![],'depth':null}));};}exports[_0x3540('0x3')]=function(_0x10e07d,_0x40ba49){return BPromise[_0x3540('0x4')]()[_0x3540('0x5')](faxAccount['notify'](_0x10e07d,_0x40ba49))[_0x3540('0x6')](loggerCatch(_0x3540('0x7')));}; \ 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 e6bfa3c..0f6a946 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 _0x7e2c=['util','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','inspect'];(function(_0x218b81,_0x196e10){var _0x1b4ba9=function(_0x4d5c32){while(--_0x4d5c32){_0x218b81['push'](_0x218b81['shift']());}};_0x1b4ba9(++_0x196e10);}(_0x7e2c,0xbd));var _0xc7e2=function(_0x3fa518,_0x2d81c9){_0x3fa518=_0x3fa518-0x0;var _0x363d0d=_0x7e2c[_0x3fa518];return _0x363d0d;};'use strict';var util=require(_0xc7e2('0x0'));var logger=require(_0xc7e2('0x1'))(_0xc7e2('0x2'));var BPromise=require(_0xc7e2('0x3'));var exec=require(_0xc7e2('0x4'))['exec'];exports[_0xc7e2('0x5')]=function(_0x4f3489){return new BPromise(function(_0xd494de,_0x37c5eb){exec(_0x4f3489,function(_0x301df,_0x1aabdc,_0x2a7508){logger[_0xc7e2('0x6')](_0xc7e2('0x7'),_0x1aabdc);if(_0x301df){logger['info'](_0xc7e2('0x7'),'\x20Error\x20:',util[_0xc7e2('0x8')](_0x301df,{'showHidden':![],'depth':null}),_0x1aabdc,_0x2a7508);_0x37c5eb(_0x301df);}_0xd494de(_0x1aabdc);});});}; \ No newline at end of file +var _0x88ee=['fax','bluebird','child_process','exec','info','Exec\x20gs','util','../../../../config/logger'];(function(_0x1769a2,_0x3198f9){var _0x3cc763=function(_0x4b5608){while(--_0x4b5608){_0x1769a2['push'](_0x1769a2['shift']());}};_0x3cc763(++_0x3198f9);}(_0x88ee,0xbe));var _0xe88e=function(_0x1fe5e3,_0x4097df){_0x1fe5e3=_0x1fe5e3-0x0;var _0x1eb2f3=_0x88ee[_0x1fe5e3];return _0x1eb2f3;};'use strict';var util=require(_0xe88e('0x0'));var logger=require(_0xe88e('0x1'))(_0xe88e('0x2'));var BPromise=require(_0xe88e('0x3'));var exec=require(_0xe88e('0x4'))[_0xe88e('0x5')];exports['execute']=function(_0x44b04e){return new BPromise(function(_0x464361,_0x3a70f9){exec(_0x44b04e,function(_0x32c790,_0x2cb192,_0x3ca23c){logger[_0xe88e('0x6')](_0xe88e('0x7'),_0x2cb192);if(_0x32c790){logger['info']('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x32c790,{'showHidden':![],'depth':null}),_0x2cb192,_0x3ca23c);_0x3a70f9(_0x32c790);}_0x464361(_0x2cb192);});});}; \ 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 f564dc7..79f6cc7 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 _0xab62=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate'];(function(_0x2fd97d,_0x26c465){var _0x278698=function(_0x575be7){while(--_0x575be7){_0x2fd97d['push'](_0x2fd97d['shift']());}};_0x278698(++_0x26c465);}(_0xab62,0xdf));var _0x2ab6=function(_0x39c963,_0xac04a0){_0x39c963=_0x39c963-0x0;var _0x590fc0=_0xab62[_0x39c963];return _0x590fc0;};'use strict';var util=require(_0x2ab6('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2ab6('0x1'))('fax');exports[_0x2ab6('0x2')]=function(_0x183ca7){return{'message':_0x183ca7};};exports[_0x2ab6('0x3')]=function(_0xd15de9,_0x578e4e){logger['info'](_0xd15de9,util[_0x2ab6('0x4')](_0x578e4e,{'showHidden':![],'depth':null}));};exports[_0x2ab6('0x5')]=function(_0x4b0b7d,_0x4d4019){var _0x276ee4={'XMF-ECM':_0x4d4019[_0x2ab6('0x6')],'XMF-HEADERINFO':_0x4d4019[_0x2ab6('0x7')],'XMF-MINRATE':_0x4d4019[_0x2ab6('0x8')],'XMF-MAXRATE':_0x4d4019[_0x2ab6('0x9')],'XMF-MODEM':util[_0x2ab6('0xa')]('\x22%s\x22',_0x4d4019[_0x2ab6('0xb')]),'XMF-GATEWAY':_0x4d4019[_0x2ab6('0xc')],'XMF-FAXDETECT':_0x4d4019['faxdetect'],'XMF-T38TIMEOUT':_0x4d4019[_0x2ab6('0xd')],'XMF-LOCALSTATIONID':_0x4d4019[_0x2ab6('0xe')],'XMF-PATH':_0x4b0b7d[_0x2ab6('0xf')]};return _0x276ee4;};exports[_0x2ab6('0x10')]=function(_0x5ca1d0,_0x292fd6){return{'actionid':_0x5ca1d0[_0x2ab6('0x11')],'action':_0x2ab6('0x12'),'channel':_0x5ca1d0['channel'],'Exten':_0x2ab6('0x13'),'Context':_0x2ab6('0x14'),'Priority':'1','callerid':util[_0x2ab6('0xa')](_0x2ab6('0x15'),_0x5ca1d0['headerinfo']?_0x5ca1d0[_0x2ab6('0x7')]:'',_0x5ca1d0['localstationid']),'variable':_0x292fd6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5ca1d0[_0x2ab6('0x11')]};}; \ No newline at end of file +var _0xa93d=['ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','fax','logger','info','inspect','addVariables'];(function(_0x48e612,_0x1f04a8){var _0x40681f=function(_0x27d926){while(--_0x27d926){_0x48e612['push'](_0x48e612['shift']());}};_0x40681f(++_0x1f04a8);}(_0xa93d,0xf5));var _0xda93=function(_0xaa0812,_0x4bb029){_0xaa0812=_0xaa0812-0x0;var _0x460840=_0xa93d[_0xaa0812];return _0x460840;};'use strict';var util=require(_0xda93('0x0'));var _=require(_0xda93('0x1'));var moment=require(_0xda93('0x2'));var logger=require('../../../../config/logger')(_0xda93('0x3'));exports['message']=function(_0x3ebc01){return{'message':_0x3ebc01};};exports[_0xda93('0x4')]=function(_0x3b8bc9,_0x302121){logger[_0xda93('0x5')](_0x3b8bc9,util[_0xda93('0x6')](_0x302121,{'showHidden':![],'depth':null}));};exports[_0xda93('0x7')]=function(_0x434851,_0x42054b){var _0x622f18={'XMF-ECM':_0x42054b[_0xda93('0x8')],'XMF-HEADERINFO':_0x42054b[_0xda93('0x9')],'XMF-MINRATE':_0x42054b[_0xda93('0xa')],'XMF-MAXRATE':_0x42054b[_0xda93('0xb')],'XMF-MODEM':util[_0xda93('0xc')](_0xda93('0xd'),_0x42054b[_0xda93('0xe')]),'XMF-GATEWAY':_0x42054b[_0xda93('0xf')],'XMF-FAXDETECT':_0x42054b['faxdetect'],'XMF-T38TIMEOUT':_0x42054b['t38timeout'],'XMF-LOCALSTATIONID':_0x42054b[_0xda93('0x10')],'XMF-PATH':_0x434851['path']};return _0x622f18;};exports[_0xda93('0x11')]=function(_0x17de45,_0x1e8ad9){return{'actionid':_0x17de45[_0xda93('0x12')],'action':_0xda93('0x13'),'channel':_0x17de45[_0xda93('0x14')],'Exten':_0xda93('0x15'),'Context':_0xda93('0x16'),'Priority':'1','callerid':util[_0xda93('0xc')]('\x22%s\x22\x20<%s>',_0x17de45[_0xda93('0x9')]?_0x17de45['headerinfo']:'',_0x17de45['localstationid']),'variable':_0x1e8ad9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x17de45[_0xda93('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 961f591..80333b7 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 _0x02fa=['getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','error','[index.js][main]','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02fa,0xdd));var _0xa02f=function(_0x37b68b,_0x3b9f54){_0x37b68b=_0x37b68b-0x0;var _0x3e6036=_0x02fa[_0x37b68b];return _0x3e6036;};'use strict';var BPromise=require(_0xa02f('0x0'));var util=require('util');var moment=require('moment');var server=require(_0xa02f('0x1'));var Realtime=require(_0xa02f('0x2'));var Report=require(_0xa02f('0x3'));var Acw=require(_0xa02f('0x4'));var Trigger=require(_0xa02f('0x5'));var Dialer=require(_0xa02f('0x6'));var Preview=require(_0xa02f('0x7'));var Fax=require(_0xa02f('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xa02f('0x9'));var voiceQueueReport=require(_0xa02f('0xa'));var voiceCallReport=require(_0xa02f('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xa02f('0xc'));var cmHopperHistory=require(_0xa02f('0xd'));var campaign=require(_0xa02f('0xe'));var voiceExtension=require(_0xa02f('0xf'));var faxAccount=require(_0xa02f('0x10'));var zendesk=require(_0xa02f('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xa02f('0x12'));var freshdesk=require(_0xa02f('0x13'));var desk=require(_0xa02f('0x14'));var zoho=require(_0xa02f('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa02f('0x16'));var servicenow=require(_0xa02f('0x17'));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(_0xa02f('0x18'))(_0xa02f('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa02f('0x1a')](_0xa02f('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa02f('0x1a')](_0xa02f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa02f('0x1c')]()[_0xa02f('0x1d')](user[_0xa02f('0x1e')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x1f')]())[_0xa02f('0x1d')](user[_0xa02f('0x20')]())['then'](realtime['initTelephones']())[_0xa02f('0x1d')](trunk[_0xa02f('0x21')]())[_0xa02f('0x1d')](realtime['initTrunks']())['then'](voiceQueue[_0xa02f('0x22')]())['then'](realtime['initVoiceQueues']())[_0xa02f('0x1d')](trigger['getTriggers']())['then'](realtime[_0xa02f('0x23')]())[_0xa02f('0x1d')](template[_0xa02f('0x24')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x25')]())[_0xa02f('0x1d')](zendesk['getZendeskAccounts']())[_0xa02f('0x1d')](realtime['initZendeskAccounts']())['then'](salesforce[_0xa02f('0x26')]())['then'](realtime[_0xa02f('0x27')]())[_0xa02f('0x1d')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xa02f('0x28')]())[_0xa02f('0x1d')](freshdesk[_0xa02f('0x29')]())[_0xa02f('0x1d')](realtime['initFreshdeskAccounts']())[_0xa02f('0x1d')](desk['getDeskAccounts']())[_0xa02f('0x1d')](realtime[_0xa02f('0x2a')]())[_0xa02f('0x1d')](zoho['getZohoAccounts']())[_0xa02f('0x1d')](realtime[_0xa02f('0x2b')]())[_0xa02f('0x1d')](vtiger[_0xa02f('0x2c')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x2d')]())[_0xa02f('0x1d')](freshsales[_0xa02f('0x2e')]())['then'](realtime[_0xa02f('0x2f')]())[_0xa02f('0x1d')](servicenow[_0xa02f('0x30')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x31')]())['then'](dynamics365[_0xa02f('0x32')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x33')]())[_0xa02f('0x1d')](campaign[_0xa02f('0x34')]())['then'](realtime[_0xa02f('0x35')]())[_0xa02f('0x1d')](voiceExtension[_0xa02f('0x36')]())[_0xa02f('0x1d')](realtime['initVoiceExtensions']())[_0xa02f('0x1d')](faxAccount[_0xa02f('0x37')]())['then'](realtime[_0xa02f('0x38')]())[_0xa02f('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xa02f('0x1c')]()['then'](voiceQueueReport[_0xa02f('0x39')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x3a')]())[_0xa02f('0x1d')](cmHopperHistory[_0xa02f('0x3b')]())[_0xa02f('0x1d')](realtime[_0xa02f('0x3c')]())['then'](cmHopperHistory[_0xa02f('0x3d')]())['then'](realtime[_0xa02f('0x3e')]())['then'](voiceCallReport[_0xa02f('0x3f')]())['then'](realtime[_0xa02f('0x40')]())[_0xa02f('0x41')](function(_0x5736fe){logger['error'](_0xa02f('0x42'),util[_0xa02f('0x43')](_0x5736fe,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x2187e0){return initRealtime();})['then'](function(){return initParams();})[_0xa02f('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x5aafb8){logger[_0xa02f('0x44')](_0xa02f('0x45'),util['inspect'](_0x5aafb8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xabc4=['./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','sync','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport'];(function(_0x54164e,_0x34c269){var _0x2fb170=function(_0x17f11f){while(--_0x17f11f){_0x54164e['push'](_0x54164e['shift']());}};_0x2fb170(++_0x34c269);}(_0xabc4,0x149));var _0x4abc=function(_0x22ada8,_0x23a7ea){_0x22ada8=_0x22ada8-0x0;var _0x506e36=_0xabc4[_0x22ada8];return _0x506e36;};'use strict';var BPromise=require('bluebird');var util=require(_0x4abc('0x0'));var moment=require(_0x4abc('0x1'));var server=require(_0x4abc('0x2'));var Realtime=require('./realtime');var Report=require(_0x4abc('0x3'));var Acw=require(_0x4abc('0x4'));var Trigger=require(_0x4abc('0x5'));var Dialer=require(_0x4abc('0x6'));var Preview=require(_0x4abc('0x7'));var Fax=require(_0x4abc('0x8'));var user=require(_0x4abc('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4abc('0xa'));var trunk=require(_0x4abc('0xb'));var trigger=require(_0x4abc('0xc'));var template=require(_0x4abc('0xd'));var cmHopperHistory=require(_0x4abc('0xe'));var campaign=require(_0x4abc('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x4abc('0x10'));var zendesk=require(_0x4abc('0x11'));var salesforce=require(_0x4abc('0x12'));var sugarcrm=require(_0x4abc('0x13'));var freshdesk=require(_0x4abc('0x14'));var desk=require(_0x4abc('0x15'));var zoho=require(_0x4abc('0x16'));var vtiger=require(_0x4abc('0x17'));var freshsales=require(_0x4abc('0x18'));var servicenow=require(_0x4abc('0x19'));var dynamics365=require(_0x4abc('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x4abc('0x1b'))(_0x4abc('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4abc('0x1d')](_0x4abc('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4abc('0x1d')](_0x4abc('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4abc('0x1f')]()[_0x4abc('0x20')](user['getAgents']())[_0x4abc('0x20')](realtime['initAgents']())[_0x4abc('0x20')](user[_0x4abc('0x21')]())[_0x4abc('0x20')](realtime[_0x4abc('0x22')]())[_0x4abc('0x20')](trunk[_0x4abc('0x23')]())[_0x4abc('0x20')](realtime[_0x4abc('0x24')]())[_0x4abc('0x20')](voiceQueue[_0x4abc('0x25')]())[_0x4abc('0x20')](realtime[_0x4abc('0x26')]())[_0x4abc('0x20')](trigger[_0x4abc('0x27')]())[_0x4abc('0x20')](realtime[_0x4abc('0x28')]())[_0x4abc('0x20')](template[_0x4abc('0x29')]())[_0x4abc('0x20')](realtime[_0x4abc('0x2a')]())['then'](zendesk[_0x4abc('0x2b')]())[_0x4abc('0x20')](realtime['initZendeskAccounts']())[_0x4abc('0x20')](salesforce['getSalesforceAccounts']())[_0x4abc('0x20')](realtime[_0x4abc('0x2c')]())[_0x4abc('0x20')](sugarcrm[_0x4abc('0x2d')]())[_0x4abc('0x20')](realtime[_0x4abc('0x2e')]())[_0x4abc('0x20')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x4abc('0x20')](desk[_0x4abc('0x2f')]())[_0x4abc('0x20')](realtime[_0x4abc('0x30')]())[_0x4abc('0x20')](zoho['getZohoAccounts']())[_0x4abc('0x20')](realtime[_0x4abc('0x31')]())[_0x4abc('0x20')](vtiger['getVtigerAccounts']())[_0x4abc('0x20')](realtime[_0x4abc('0x32')]())['then'](freshsales['getFreshsalesAccounts']())[_0x4abc('0x20')](realtime[_0x4abc('0x33')]())['then'](servicenow[_0x4abc('0x34')]())[_0x4abc('0x20')](realtime['initServicenowAccounts']())[_0x4abc('0x20')](dynamics365[_0x4abc('0x35')]())[_0x4abc('0x20')](realtime[_0x4abc('0x36')]())[_0x4abc('0x20')](campaign[_0x4abc('0x37')]())['then'](realtime[_0x4abc('0x38')]())[_0x4abc('0x20')](voiceExtension[_0x4abc('0x39')]())[_0x4abc('0x20')](realtime[_0x4abc('0x3a')]())['then'](faxAccount[_0x4abc('0x3b')]())['then'](realtime[_0x4abc('0x3c')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x4abc('0x1f')]()[_0x4abc('0x20')](voiceQueueReport['getVoiceQueueReports']())[_0x4abc('0x20')](realtime['initVoiceQueueReports']())[_0x4abc('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4abc('0x20')](realtime[_0x4abc('0x3d')]())[_0x4abc('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0x4abc('0x20')](realtime[_0x4abc('0x3e')]())['then'](voiceCallReport[_0x4abc('0x3f')]())[_0x4abc('0x20')](realtime[_0x4abc('0x40')]())['catch'](function(_0x418580){logger[_0x4abc('0x41')]('[index.js][initParams]',util[_0x4abc('0x42')](_0x418580,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x247d89){return initRealtime();})[_0x4abc('0x20')](function(){return initParams();})[_0x4abc('0x20')](function(){report[_0x4abc('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x32ffbb){logger['error']('[index.js][main]',util[_0x4abc('0x42')](_0x32ffbb,{'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 1ab780d..05f7d39 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x301481,_0x2bb36c){var _0x2a6680=function(_0x499c1d){while(--_0x499c1d){_0x301481['push'](_0x301481['shift']());}};_0x2a6680(++_0x2bb36c);}(_0xe706,0xa3));var _0x6e70=function(_0x3349fe,_0x111770){_0x3349fe=_0x3349fe-0x0;var _0x3f8bc5=_0xe706[_0x3349fe];return _0x3f8bc5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x36ee1e,_0x20e8dd){var _0x41999c=function(_0x3393b3){while(--_0x3393b3){_0x36ee1e['push'](_0x36ee1e['shift']());}};_0x41999c(++_0x20e8dd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xcb91[_0x36bf88];return _0x332914;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8bc718b..f240b95 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 _0xd3e6=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd3e6,0x16f));var _0x6d3e=function(_0x21638d,_0x10819d){_0x21638d=_0x21638d-0x0;var _0x2b37b3=_0xd3e6[_0x21638d];return _0x2b37b3;};'use strict';function Campaign(_0x3e6227){this['id']=_0x3e6227['id']||0x0;this[_0x6d3e('0x0')]=_0x3e6227[_0x6d3e('0x0')]||'';this[_0x6d3e('0x1')]=_0x3e6227['type']||_0x6d3e('0x2');this[_0x6d3e('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x6d3e('0x4')]=0x0;this[_0x6d3e('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x6d3e('0x6')]=_0x3e6227[_0x6d3e('0x6')];this[_0x6d3e('0x7')]=_0x3e6227[_0x6d3e('0x7')];this['dialTimezone']=_0x3e6227['dialTimezone']||null;this[_0x6d3e('0x8')]=_0x3e6227[_0x6d3e('0x8')]?_0x3e6227[_0x6d3e('0x8')]:null;this[_0x6d3e('0x9')]=_0x3e6227['dialOriginateCallerIdName'];this[_0x6d3e('0xa')]=_0x3e6227[_0x6d3e('0xa')];this['dialOriginateTimeout']=_0x3e6227[_0x6d3e('0xb')]||0x1e;this[_0x6d3e('0xc')]=_0x3e6227[_0x6d3e('0xc')];this['dialCongestionRetryFrequency']=_0x3e6227[_0x6d3e('0xd')];this[_0x6d3e('0xe')]=_0x3e6227[_0x6d3e('0xe')];this[_0x6d3e('0xf')]=_0x3e6227[_0x6d3e('0xf')];this[_0x6d3e('0x10')]=_0x3e6227[_0x6d3e('0x10')];this[_0x6d3e('0x11')]=_0x3e6227[_0x6d3e('0x11')];this[_0x6d3e('0x12')]=_0x3e6227[_0x6d3e('0x12')];this['dialNoSuchNumberMaxRetry']=_0x3e6227[_0x6d3e('0x13')]||0x3;this[_0x6d3e('0x14')]=_0x3e6227[_0x6d3e('0x14')]||0x96;this[_0x6d3e('0x15')]=_0x3e6227[_0x6d3e('0x15')]||0x3;this[_0x6d3e('0x16')]=_0x3e6227['dialDropRetryFrequency']||0x96;this[_0x6d3e('0x17')]=_0x3e6227[_0x6d3e('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x3e6227[_0x6d3e('0x18')]||0x96;this['dialMachineMaxRetry']=_0x3e6227[_0x6d3e('0x19')]||0x3;this[_0x6d3e('0x1a')]=_0x3e6227[_0x6d3e('0x1a')]||0x96;this[_0x6d3e('0x1b')]=_0x3e6227[_0x6d3e('0x1b')]||0x3;this[_0x6d3e('0x1c')]=_0x3e6227['dialAgentRejectRetryFrequency']||0x96;this[_0x6d3e('0x1d')]=_0x3e6227[_0x6d3e('0x1d')]||_0x6d3e('0x1e');this[_0x6d3e('0x1f')]=_0x3e6227['dialPrefix']||undefined;this[_0x6d3e('0x20')]=_0x3e6227[_0x6d3e('0x20')]||undefined;this[_0x6d3e('0x21')]=_0x3e6227[_0x6d3e('0x21')]||undefined;this[_0x6d3e('0x22')]=_0x3e6227[_0x6d3e('0x22')]?_0x3e6227[_0x6d3e('0x22')]:undefined;this[_0x6d3e('0x23')]=_0x3e6227[_0x6d3e('0x23')]?_0x3e6227[_0x6d3e('0x23')]:undefined;this[_0x6d3e('0x24')]=_0x3e6227[_0x6d3e('0x24')]?_0x3e6227[_0x6d3e('0x24')]:undefined;this['SquareProject']=_0x3e6227['SquareProject']?_0x3e6227[_0x6d3e('0x25')]:undefined;this[_0x6d3e('0x26')]=_0x3e6227[_0x6d3e('0x25')]?_0x3e6227[_0x6d3e('0x25')][_0x6d3e('0x0')]:undefined;this[_0x6d3e('0x27')]=_0x3e6227[_0x6d3e('0x27')]||![];this[_0x6d3e('0x28')]=_0x3e6227[_0x6d3e('0x28')];this['dialAMDGreeting']=_0x3e6227[_0x6d3e('0x29')];this[_0x6d3e('0x2a')]=_0x3e6227[_0x6d3e('0x2a')];this[_0x6d3e('0x2b')]=_0x3e6227[_0x6d3e('0x2b')];this[_0x6d3e('0x2c')]=_0x3e6227[_0x6d3e('0x2c')];this['dialAMDBetweenWordsSilence']=_0x3e6227[_0x6d3e('0x2d')];this[_0x6d3e('0x2e')]=_0x3e6227['dialAMDMaximumNumberOfWords'];this[_0x6d3e('0x2f')]=_0x3e6227[_0x6d3e('0x2f')];this['dialAMDMaximumWordLength']=_0x3e6227[_0x6d3e('0x30')];}module[_0x6d3e('0x31')]=Campaign; \ No newline at end of file +var _0x4b16=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x3f10fa,_0x2addf6){var _0x55d214=function(_0x236607){while(--_0x236607){_0x3f10fa['push'](_0x3f10fa['shift']());}};_0x55d214(++_0x2addf6);}(_0x4b16,0x86));var _0x64b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b16[_0x20a584];return _0x4b41a8;};'use strict';function Campaign(_0x372c93){this['id']=_0x372c93['id']||0x0;this['name']=_0x372c93[_0x64b1('0x0')]||'';this[_0x64b1('0x1')]=_0x372c93[_0x64b1('0x1')]||_0x64b1('0x2');this[_0x64b1('0x3')]=0x0;this['temp']=0x0;this[_0x64b1('0x4')]=0x0;this[_0x64b1('0x5')]=0x0;this[_0x64b1('0x6')]='';this[_0x64b1('0x7')]=!![];this['active']=_0x372c93[_0x64b1('0x8')];this[_0x64b1('0x9')]=_0x372c93[_0x64b1('0x9')];this[_0x64b1('0xa')]=_0x372c93[_0x64b1('0xa')]||null;this['dialGlobalInterval']=_0x372c93['dialGlobalInterval']?_0x372c93[_0x64b1('0xb')]:null;this[_0x64b1('0xc')]=_0x372c93[_0x64b1('0xc')];this[_0x64b1('0xd')]=_0x372c93['dialOriginateCallerIdNumber'];this[_0x64b1('0xe')]=_0x372c93[_0x64b1('0xe')]||0x1e;this[_0x64b1('0xf')]=_0x372c93[_0x64b1('0xf')];this[_0x64b1('0x10')]=_0x372c93['dialCongestionRetryFrequency'];this[_0x64b1('0x11')]=_0x372c93['dialBusyMaxRetry'];this[_0x64b1('0x12')]=_0x372c93['dialBusyRetryFrequency'];this[_0x64b1('0x13')]=_0x372c93['dialNoAnswerMaxRetry'];this[_0x64b1('0x14')]=_0x372c93[_0x64b1('0x14')];this[_0x64b1('0x15')]=_0x372c93[_0x64b1('0x15')];this[_0x64b1('0x16')]=_0x372c93[_0x64b1('0x16')]||0x3;this[_0x64b1('0x17')]=_0x372c93[_0x64b1('0x17')]||0x96;this['dialDropMaxRetry']=_0x372c93[_0x64b1('0x18')]||0x3;this[_0x64b1('0x19')]=_0x372c93['dialDropRetryFrequency']||0x96;this[_0x64b1('0x1a')]=_0x372c93['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x372c93[_0x64b1('0x1b')]||0x96;this[_0x64b1('0x1c')]=_0x372c93[_0x64b1('0x1c')]||0x3;this[_0x64b1('0x1d')]=_0x372c93['dialMachineRetryFrequency']||0x96;this[_0x64b1('0x1e')]=_0x372c93['dialAgentRejectMaxRetry']||0x3;this[_0x64b1('0x1f')]=_0x372c93[_0x64b1('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x372c93[_0x64b1('0x20')]||_0x64b1('0x21');this[_0x64b1('0x22')]=_0x372c93[_0x64b1('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x372c93[_0x64b1('0x23')]||undefined;this[_0x64b1('0x24')]=_0x372c93[_0x64b1('0x24')]||undefined;this['TrunkBackup']=_0x372c93[_0x64b1('0x25')]?_0x372c93[_0x64b1('0x25')]:undefined;this['Trunk']=_0x372c93[_0x64b1('0x26')]?_0x372c93[_0x64b1('0x26')]:undefined;this[_0x64b1('0x27')]=_0x372c93[_0x64b1('0x27')]?_0x372c93['Interval']:undefined;this[_0x64b1('0x28')]=_0x372c93[_0x64b1('0x28')]?_0x372c93[_0x64b1('0x28')]:undefined;this[_0x64b1('0x29')]=_0x372c93[_0x64b1('0x28')]?_0x372c93[_0x64b1('0x28')]['name']:undefined;this[_0x64b1('0x2a')]=_0x372c93[_0x64b1('0x2a')]||![];this[_0x64b1('0x2b')]=_0x372c93[_0x64b1('0x2b')];this[_0x64b1('0x2c')]=_0x372c93[_0x64b1('0x2c')];this[_0x64b1('0x2d')]=_0x372c93[_0x64b1('0x2d')];this[_0x64b1('0x2e')]=_0x372c93['dialAMDTotalAnalysisTime'];this[_0x64b1('0x2f')]=_0x372c93[_0x64b1('0x2f')];this[_0x64b1('0x30')]=_0x372c93['dialAMDBetweenWordsSilence'];this[_0x64b1('0x31')]=_0x372c93[_0x64b1('0x31')];this['dialAMDSilenceThreshold']=_0x372c93[_0x64b1('0x32')];this[_0x64b1('0x33')]=_0x372c93[_0x64b1('0x33')];}module[_0x64b1('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 07aeb95..ab13031 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 _0xbb59=['connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x1ca65d,_0x5912cf){var _0x5f3b83=function(_0x2131bd){while(--_0x2131bd){_0x1ca65d['push'](_0x1ca65d['shift']());}};_0x5f3b83(++_0x5912cf);}(_0xbb59,0xec));var _0x9bb5=function(_0x14410c,_0x231eca){_0x14410c=_0x14410c-0x0;var _0x1efbab=_0xbb59[_0x14410c];return _0x1efbab;};'use strict';function Channel(){this[_0x9bb5('0x0')]=null;this[_0x9bb5('0x1')]='';this[_0x9bb5('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x9bb5('0x3')]=undefined;this[_0x9bb5('0x4')]=undefined;this[_0x9bb5('0x5')]=0x0;this[_0x9bb5('0x6')]='';this[_0x9bb5('0x7')]=0x0;this['linkedid']=0x0;this[_0x9bb5('0x8')]=0x0;this[_0x9bb5('0x9')]=![];this[_0x9bb5('0xa')]=null;this[_0x9bb5('0xb')]=null;this[_0x9bb5('0xc')]=![];this[_0x9bb5('0xd')]=![];this[_0x9bb5('0xe')]='';this[_0x9bb5('0xf')]='';this[_0x9bb5('0x10')]=0x0;this[_0x9bb5('0x11')]=0x0;this[_0x9bb5('0x12')]=0x0;this[_0x9bb5('0x13')]=null;this[_0x9bb5('0x14')]=null;this['disposition']=null;this[_0x9bb5('0x15')]=![];this[_0x9bb5('0x16')]=null;this[_0x9bb5('0x17')]=null;this[_0x9bb5('0x18')]=[];this[_0x9bb5('0x19')]=undefined;this[_0x9bb5('0x1a')]=undefined;this[_0x9bb5('0x1b')]=undefined;this[_0x9bb5('0x1c')]=0x0;}module[_0x9bb5('0x1d')]=Channel; \ No newline at end of file +var _0x1189=['monitor','monitorFilename','monitors','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition'];(function(_0x5f0fea,_0x1eb09a){var _0x4a0b45=function(_0x6510f){while(--_0x6510f){_0x5f0fea['push'](_0x5f0fea['shift']());}};_0x4a0b45(++_0x1eb09a);}(_0x1189,0x17f));var _0x9118=function(_0x92761d,_0xf63614){_0x92761d=_0x92761d-0x0;var _0x460dc5=_0x1189[_0x92761d];return _0x460dc5;};'use strict';function Channel(){this[_0x9118('0x0')]=null;this[_0x9118('0x1')]='';this[_0x9118('0x2')]='';this[_0x9118('0x3')]=0x0;this['calleridname']='';this[_0x9118('0x4')]=undefined;this[_0x9118('0x5')]=undefined;this[_0x9118('0x6')]=0x0;this[_0x9118('0x7')]='';this[_0x9118('0x8')]=0x0;this[_0x9118('0x9')]=0x0;this[_0x9118('0xa')]=0x0;this['answered']=![];this[_0x9118('0xb')]=null;this[_0x9118('0xc')]=null;this[_0x9118('0xd')]=![];this[_0x9118('0xe')]=![];this[_0x9118('0xf')]='';this[_0x9118('0x10')]='';this['duration']=0x0;this[_0x9118('0x11')]=0x0;this[_0x9118('0x12')]=0x0;this[_0x9118('0x13')]=null;this[_0x9118('0x14')]=null;this[_0x9118('0x15')]=null;this[_0x9118('0x16')]=![];this[_0x9118('0x17')]=null;this['queue']=null;this[_0x9118('0x18')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x9118('0x19')]=undefined;this[_0x9118('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 073bb5a..61e6952 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 _0xf222=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x47df36,_0x35a719){var _0x2076fe=function(_0x5e71b8){while(--_0x5e71b8){_0x47df36['push'](_0x47df36['shift']());}};_0x2076fe(++_0x35a719);}(_0xf222,0x183));var _0x2f22=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf222[_0x19e35c];return _0x3e1fe8;};'use strict';function DeskAccount(_0x445e7b){this['id']=_0x445e7b['id']||0x0;this['name']=_0x445e7b['name']||'';this[_0x2f22('0x0')]=_0x445e7b[_0x2f22('0x0')]||'';this[_0x2f22('0x1')]=_0x445e7b[_0x2f22('0x1')]||'';this[_0x2f22('0x2')]=_0x445e7b[_0x2f22('0x2')]||'';this[_0x2f22('0x3')]=_0x445e7b['password']||'';this[_0x2f22('0x4')]=_0x445e7b[_0x2f22('0x4')]||'';this['consumerSecret']=_0x445e7b[_0x2f22('0x5')]||'';this[_0x2f22('0x6')]=_0x445e7b['token']||'';this['tokenSecret']=_0x445e7b[_0x2f22('0x7')]||'';this[_0x2f22('0x8')]=_0x445e7b['type']||'';this['serverUrl']=_0x445e7b[_0x2f22('0x9')]||'';this[_0x2f22('0xa')]=_0x445e7b[_0x2f22('0xa')]||{};}module[_0x2f22('0xb')]=DeskAccount; \ No newline at end of file +var _0x37a3=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x20bbe5,_0x189723){var _0x1d94c7=function(_0x29c6b0){while(--_0x29c6b0){_0x20bbe5['push'](_0x20bbe5['shift']());}};_0x1d94c7(++_0x189723);}(_0x37a3,0xee));var _0x337a=function(_0x325722,_0x25c247){_0x325722=_0x325722-0x0;var _0x18978d=_0x37a3[_0x325722];return _0x18978d;};'use strict';function DeskAccount(_0x2a9123){this['id']=_0x2a9123['id']||0x0;this[_0x337a('0x0')]=_0x2a9123['name']||'';this[_0x337a('0x1')]=_0x2a9123['username']||'';this[_0x337a('0x2')]=_0x2a9123[_0x337a('0x2')]||'';this[_0x337a('0x3')]=_0x2a9123['authType']||'';this['password']=_0x2a9123[_0x337a('0x4')]||'';this[_0x337a('0x5')]=_0x2a9123['consumerKey']||'';this[_0x337a('0x6')]=_0x2a9123['consumerSecret']||'';this[_0x337a('0x7')]=_0x2a9123[_0x337a('0x7')]||'';this['tokenSecret']=_0x2a9123[_0x337a('0x8')]||'';this[_0x337a('0x9')]=_0x2a9123[_0x337a('0x9')]||'';this[_0x337a('0xa')]=_0x2a9123[_0x337a('0xa')]||'';this[_0x337a('0xb')]=_0x2a9123[_0x337a('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4962c03..d21d7fa 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 _0xd05c=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x35ec99,_0x535ff0){var _0x58b72b=function(_0x1d862a){while(--_0x1d862a){_0x35ec99['push'](_0x35ec99['shift']());}};_0x58b72b(++_0x535ff0);}(_0xd05c,0x8f));var _0xcd05=function(_0x1ef0e3,_0x4ffc33){_0x1ef0e3=_0x1ef0e3-0x0;var _0x1a95e0=_0xd05c[_0x1ef0e3];return _0x1a95e0;};'use strict';function Dynamics365Account(_0x3c1532){this['id']=_0x3c1532['id']||0x0;this[_0xcd05('0x0')]=_0x3c1532[_0xcd05('0x0')]||'';this[_0xcd05('0x1')]=_0x3c1532[_0xcd05('0x1')]||'';this['password']=_0x3c1532[_0xcd05('0x2')]||'';this['remoteUri']=_0x3c1532[_0xcd05('0x3')]||'';this[_0xcd05('0x4')]=_0x3c1532[_0xcd05('0x4')]||'';this[_0xcd05('0x5')]=_0x3c1532[_0xcd05('0x5')]||'';this[_0xcd05('0x6')]=_0x3c1532[_0xcd05('0x6')]||{};this[_0xcd05('0x7')]=_0x3c1532['serverUrl']||'';this[_0xcd05('0x8')]=_0x3c1532[_0xcd05('0x8')]||![];this['Configurations']=_0x3c1532[_0xcd05('0x9')]||{};this[_0xcd05('0xa')]=_0x3c1532['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xd607=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x188da1,_0x2adfd5){var _0x543e01=function(_0xf9a2e4){while(--_0xf9a2e4){_0x188da1['push'](_0x188da1['shift']());}};_0x543e01(++_0x2adfd5);}(_0xd607,0x8d));var _0x7d60=function(_0xca26d9,_0x54ecfb){_0xca26d9=_0xca26d9-0x0;var _0x1e3ae2=_0xd607[_0xca26d9];return _0x1e3ae2;};'use strict';function Dynamics365Account(_0x285dde){this['id']=_0x285dde['id']||0x0;this['name']=_0x285dde[_0x7d60('0x0')]||'';this['username']=_0x285dde[_0x7d60('0x1')]||'';this['password']=_0x285dde[_0x7d60('0x2')]||'';this[_0x7d60('0x3')]=_0x285dde[_0x7d60('0x3')]||'';this[_0x7d60('0x4')]=_0x285dde[_0x7d60('0x4')]||'';this[_0x7d60('0x5')]=_0x285dde['clientId']||'';this[_0x7d60('0x6')]=_0x285dde[_0x7d60('0x6')]||{};this[_0x7d60('0x7')]=_0x285dde[_0x7d60('0x7')]||'';this[_0x7d60('0x8')]=_0x285dde[_0x7d60('0x8')]||![];this[_0x7d60('0x9')]=_0x285dde[_0x7d60('0x9')]||{};this[_0x7d60('0xa')]=_0x285dde[_0x7d60('0xa')]||{};}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 8be00fb..fd2efa9 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 _0xdf87=['localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xdf87,0x6c));var _0x7df8=function(_0x20ca7c,_0x40925a){_0x20ca7c=_0x20ca7c-0x0;var _0x524ffb=_0xdf87[_0x20ca7c];return _0x524ffb;};'use strict';function FaxAccount(_0x368ecf){this['id']=_0x368ecf['id']||0x0;this['name']=_0x368ecf[_0x7df8('0x0')]||'';this[_0x7df8('0x1')]=_0x368ecf[_0x7df8('0x1')];this[_0x7df8('0x2')]=_0x368ecf['ecm'];this[_0x7df8('0x3')]=_0x368ecf['headerinfo'];this['localstationid']=_0x368ecf[_0x7df8('0x4')];this[_0x7df8('0x5')]=_0x368ecf[_0x7df8('0x5')]||0x960;this['maxrate']=_0x368ecf['maxrate']||0x3840;this['modem']=_0x368ecf[_0x7df8('0x6')]||_0x7df8('0x7');this[_0x7df8('0x8')]=_0x368ecf[_0x7df8('0x8')]||'no';this[_0x7df8('0x9')]=_0x368ecf[_0x7df8('0x9')]||'no';this[_0x7df8('0xa')]=_0x368ecf[_0x7df8('0xa')]||0x1388;this[_0x7df8('0xb')]=_0x368ecf['tech']||'SIP';this[_0x7df8('0xc')]=_0x368ecf[_0x7df8('0xc')]?_0x368ecf[_0x7df8('0xc')]:undefined;this['ListId']=_0x368ecf[_0x7df8('0xd')];this['key']=_0x368ecf[_0x7df8('0xe')];}module[_0x7df8('0xf')]=FaxAccount; \ No newline at end of file +var _0xe0b1=['minrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0xe48678,_0x3c4c37){var _0xdc11e5=function(_0x1c33fc){while(--_0x1c33fc){_0xe48678['push'](_0xe48678['shift']());}};_0xdc11e5(++_0x3c4c37);}(_0xe0b1,0xab));var _0x1e0b=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0xe0b1[_0x2e1907];return _0x401555;};'use strict';function FaxAccount(_0x144f9e){this['id']=_0x144f9e['id']||0x0;this[_0x1e0b('0x0')]=_0x144f9e[_0x1e0b('0x0')]||'';this[_0x1e0b('0x1')]=_0x144f9e[_0x1e0b('0x1')];this[_0x1e0b('0x2')]=_0x144f9e[_0x1e0b('0x2')];this[_0x1e0b('0x3')]=_0x144f9e[_0x1e0b('0x3')];this[_0x1e0b('0x4')]=_0x144f9e[_0x1e0b('0x4')];this['minrate']=_0x144f9e[_0x1e0b('0x5')]||0x960;this['maxrate']=_0x144f9e['maxrate']||0x3840;this['modem']=_0x144f9e[_0x1e0b('0x6')]||_0x1e0b('0x7');this[_0x1e0b('0x8')]=_0x144f9e[_0x1e0b('0x8')]||'no';this[_0x1e0b('0x9')]=_0x144f9e[_0x1e0b('0x9')]||'no';this['t38timeout']=_0x144f9e['t38timeout']||0x1388;this['tech']=_0x144f9e[_0x1e0b('0xa')]||_0x1e0b('0xb');this[_0x1e0b('0xc')]=_0x144f9e['Trunk']?_0x144f9e[_0x1e0b('0xc')]:undefined;this[_0x1e0b('0xd')]=_0x144f9e[_0x1e0b('0xd')];this[_0x1e0b('0xe')]=_0x144f9e[_0x1e0b('0xe')];}module[_0x1e0b('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 4567607..ae4c8d9 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 _0xfe24=['name','username','apiKey','token','remoteUri','Configurations'];(function(_0xf0a3c7,_0x47c422){var _0x3d25cb=function(_0x2b2a46){while(--_0x2b2a46){_0xf0a3c7['push'](_0xf0a3c7['shift']());}};_0x3d25cb(++_0x47c422);}(_0xfe24,0x156));var _0x4fe2=function(_0x4de65a,_0x33c4e4){_0x4de65a=_0x4de65a-0x0;var _0x313a10=_0xfe24[_0x4de65a];return _0x313a10;};'use strict';function FreshdeskAccount(_0x33e645){this['id']=_0x33e645['id']||0x0;this[_0x4fe2('0x0')]=_0x33e645[_0x4fe2('0x0')]||'';this[_0x4fe2('0x1')]=_0x33e645[_0x4fe2('0x1')]||'';this[_0x4fe2('0x2')]=_0x33e645[_0x4fe2('0x3')]||'';this['remoteUri']=_0x33e645[_0x4fe2('0x4')]||'';this['serverUrl']=_0x33e645['serverUrl']||'';this[_0x4fe2('0x5')]=_0x33e645['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x941a=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3a2635,_0x3addf1){var _0x405626=function(_0x125293){while(--_0x125293){_0x3a2635['push'](_0x3a2635['shift']());}};_0x405626(++_0x3addf1);}(_0x941a,0x12b));var _0xa941=function(_0x44ec4c,_0x41878b){_0x44ec4c=_0x44ec4c-0x0;var _0x349c3e=_0x941a[_0x44ec4c];return _0x349c3e;};'use strict';function FreshdeskAccount(_0x244fcc){this['id']=_0x244fcc['id']||0x0;this[_0xa941('0x0')]=_0x244fcc[_0xa941('0x0')]||'';this[_0xa941('0x1')]=_0x244fcc[_0xa941('0x1')]||'';this['apiKey']=_0x244fcc[_0xa941('0x2')]||'';this['remoteUri']=_0x244fcc[_0xa941('0x3')]||'';this['serverUrl']=_0x244fcc[_0xa941('0x4')]||'';this[_0xa941('0x5')]=_0x244fcc[_0xa941('0x5')]||{};}module[_0xa941('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b2a4eef..c483daf 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 _0xb46f=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5e2a54,_0x424ad7){var _0x1c8b6b=function(_0x718a9b){while(--_0x718a9b){_0x5e2a54['push'](_0x5e2a54['shift']());}};_0x1c8b6b(++_0x424ad7);}(_0xb46f,0xb6));var _0xfb46=function(_0x200d3c,_0x75ab80){_0x200d3c=_0x200d3c-0x0;var _0x4e8004=_0xb46f[_0x200d3c];return _0x4e8004;};'use strict';function FreshsalesAccount(_0xe9857b){this['id']=_0xe9857b['id']||0x0;this[_0xfb46('0x0')]=_0xe9857b['name']||'';this[_0xfb46('0x1')]=_0xe9857b[_0xfb46('0x1')]||'';this[_0xfb46('0x2')]=_0xe9857b[_0xfb46('0x3')]||'';this[_0xfb46('0x4')]=_0xe9857b['remoteUri']||'';this[_0xfb46('0x5')]=_0xe9857b['serverUrl']||'';this[_0xfb46('0x6')]=_0xe9857b[_0xfb46('0x6')]||{};}module[_0xfb46('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xf966=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x279095,_0x15f37e){var _0x5a5cdb=function(_0x2909bd){while(--_0x2909bd){_0x279095['push'](_0x279095['shift']());}};_0x5a5cdb(++_0x15f37e);}(_0xf966,0x184));var _0x6f96=function(_0xdd16a6,_0x17298f){_0xdd16a6=_0xdd16a6-0x0;var _0x2b79d0=_0xf966[_0xdd16a6];return _0x2b79d0;};'use strict';function FreshsalesAccount(_0x4eff59){this['id']=_0x4eff59['id']||0x0;this[_0x6f96('0x0')]=_0x4eff59[_0x6f96('0x0')]||'';this['username']=_0x4eff59[_0x6f96('0x1')]||'';this[_0x6f96('0x2')]=_0x4eff59[_0x6f96('0x3')]||'';this['remoteUri']=_0x4eff59[_0x6f96('0x4')]||'';this[_0x6f96('0x5')]=_0x4eff59[_0x6f96('0x5')]||'';this['Configurations']=_0x4eff59[_0x6f96('0x6')]||{};}module[_0x6f96('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 78a0414..5c6e5da 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 _0x2f40=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x2f40,0xb4));var _0x02f4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2f40[_0x3bf83f];return _0x22c4a9;};'use strict';function QueueReport(){this[_0x02f4('0x0')]=_0x02f4('0x1');this[_0x02f4('0x2')]='';this[_0x02f4('0x3')]='';this[_0x02f4('0x4')]='';this['queue']='';this[_0x02f4('0x5')]=null;this[_0x02f4('0x6')]=null;this[_0x02f4('0x7')]=0x1;this[_0x02f4('0x8')]=0x1;this[_0x02f4('0x9')]=![];this[_0x02f4('0xa')]=null;this[_0x02f4('0xb')]=![];this[_0x02f4('0xc')]=null;this[_0x02f4('0xd')]=![];this['queuecallerexitAt']=null;this[_0x02f4('0xe')]=0x1;this[_0x02f4('0xf')]='';this['connectedlinenum']='';this[_0x02f4('0x10')]='';this[_0x02f4('0x11')]='';this[_0x02f4('0x12')]='';this[_0x02f4('0x13')]='';this['priority']='';this[_0x02f4('0x14')]=0x0;this[_0x02f4('0x15')]=![];this[_0x02f4('0x16')]='';this[_0x02f4('0x17')]=_0x02f4('0x18');this[_0x02f4('0x19')]=0x0;this[_0x02f4('0x1a')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x7735=['context','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename'];(function(_0x1a6363,_0x205f25){var _0xd22157=function(_0x26e88e){while(--_0x26e88e){_0x1a6363['push'](_0x1a6363['shift']());}};_0xd22157(++_0x205f25);}(_0x7735,0x19f));var _0x5773=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7735[_0x20a584];return _0x4b41a8;};'use strict';function QueueReport(){this[_0x5773('0x0')]=_0x5773('0x1');this[_0x5773('0x2')]='';this[_0x5773('0x3')]='';this['calleridname']='';this[_0x5773('0x4')]='';this[_0x5773('0x5')]=null;this[_0x5773('0x6')]=null;this[_0x5773('0x7')]=0x1;this[_0x5773('0x8')]=0x1;this[_0x5773('0x9')]=![];this[_0x5773('0xa')]=null;this[_0x5773('0xb')]=![];this[_0x5773('0xc')]=null;this[_0x5773('0xd')]=![];this[_0x5773('0xe')]=null;this['originalposition']=0x1;this[_0x5773('0xf')]='';this['connectedlinenum']='';this[_0x5773('0x10')]='';this['accountcode']='';this[_0x5773('0x11')]='';this['exten']='';this['priority']='';this[_0x5773('0x12')]=0x0;this[_0x5773('0x13')]=![];this[_0x5773('0x14')]='';this[_0x5773('0x15')]='voice';this[_0x5773('0x16')]=0x0;this['variables']={};}module[_0x5773('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 764cb56..0a21420 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 _0x618a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x618a,0xe3));var _0xa618=function(_0x55c76f,_0x13b7f4){_0x55c76f=_0x55c76f-0x0;var _0x1571ff=_0x618a[_0x55c76f];return _0x1571ff;};'use strict';function SalesforceAccount(_0x2a61f2){this['id']=_0x2a61f2['id']||0x0;this[_0xa618('0x0')]=_0x2a61f2[_0xa618('0x0')]||'';this[_0xa618('0x1')]=_0x2a61f2[_0xa618('0x1')]||'';this['remoteUri']=_0x2a61f2[_0xa618('0x2')]||'';this[_0xa618('0x3')]=_0x2a61f2[_0xa618('0x3')]||'';this['clientId']=_0x2a61f2[_0xa618('0x4')]||'';this[_0xa618('0x5')]=_0x2a61f2[_0xa618('0x5')]||'';this[_0xa618('0x6')]=_0x2a61f2[_0xa618('0x6')]||'';this[_0xa618('0x7')]=_0x2a61f2[_0xa618('0x7')]||_0xa618('0x8');this[_0xa618('0x9')]=_0x2a61f2[_0xa618('0x9')]||'';this['Configurations']=_0x2a61f2[_0xa618('0xa')]||{};}module[_0xa618('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x1736=['securityToken','type','serverUrl','Configurations','username','remoteUri','password','clientId','clientSecret'];(function(_0x4be07d,_0x2f296c){var _0x3cbcd0=function(_0xf75d41){while(--_0xf75d41){_0x4be07d['push'](_0x4be07d['shift']());}};_0x3cbcd0(++_0x2f296c);}(_0x1736,0xca));var _0x6173=function(_0x3599ed,_0x3b5589){_0x3599ed=_0x3599ed-0x0;var _0x34b3b0=_0x1736[_0x3599ed];return _0x34b3b0;};'use strict';function SalesforceAccount(_0x5a4d20){this['id']=_0x5a4d20['id']||0x0;this['name']=_0x5a4d20['name']||'';this['username']=_0x5a4d20[_0x6173('0x0')]||'';this['remoteUri']=_0x5a4d20[_0x6173('0x1')]||'';this[_0x6173('0x2')]=_0x5a4d20[_0x6173('0x2')]||'';this[_0x6173('0x3')]=_0x5a4d20[_0x6173('0x3')]||'';this['clientSecret']=_0x5a4d20[_0x6173('0x4')]||'';this[_0x6173('0x5')]=_0x5a4d20[_0x6173('0x5')]||'';this[_0x6173('0x6')]=_0x5a4d20['type']||'integrationTab';this['serverUrl']=_0x5a4d20[_0x6173('0x7')]||'';this[_0x6173('0x8')]=_0x5a4d20[_0x6173('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 310b05b..03460ac 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 _0x2d4c=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xeb90e8,_0x63f479){var _0x5f103b=function(_0x49c75f){while(--_0x49c75f){_0xeb90e8['push'](_0xeb90e8['shift']());}};_0x5f103b(++_0x63f479);}(_0x2d4c,0x11d));var _0xc2d4=function(_0x4ed19f,_0x433525){_0x4ed19f=_0x4ed19f-0x0;var _0x2168b8=_0x2d4c[_0x4ed19f];return _0x2168b8;};'use strict';function ServicenowAccount(_0xff8867){this['id']=_0xff8867['id']||0x0;this[_0xc2d4('0x0')]=_0xff8867['name']||'';this[_0xc2d4('0x1')]=_0xff8867[_0xc2d4('0x1')]||'';this[_0xc2d4('0x2')]=_0xff8867[_0xc2d4('0x2')]||'';this['remoteUri']=_0xff8867[_0xc2d4('0x3')]||'';this[_0xc2d4('0x4')]=_0xff8867[_0xc2d4('0x4')]||'';this[_0xc2d4('0x5')]=_0xff8867[_0xc2d4('0x5')]||{};}module[_0xc2d4('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x2622=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0x2622,0x19f));var _0x2262=function(_0x303609,_0x302e0b){_0x303609=_0x303609-0x0;var _0x3b2ad1=_0x2622[_0x303609];return _0x3b2ad1;};'use strict';function ServicenowAccount(_0x5d0796){this['id']=_0x5d0796['id']||0x0;this[_0x2262('0x0')]=_0x5d0796[_0x2262('0x0')]||'';this[_0x2262('0x1')]=_0x5d0796[_0x2262('0x1')]||'';this['password']=_0x5d0796['password']||'';this[_0x2262('0x2')]=_0x5d0796[_0x2262('0x2')]||'';this[_0x2262('0x3')]=_0x5d0796['serverUrl']||'';this[_0x2262('0x4')]=_0x5d0796[_0x2262('0x4')]||{};}module[_0x2262('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 581b955..df09e62 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 _0x3d51=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x42ed40,_0x45e2e3){var _0x4fe80e=function(_0x2b7135){while(--_0x2b7135){_0x42ed40['push'](_0x42ed40['shift']());}};_0x4fe80e(++_0x45e2e3);}(_0x3d51,0x1a9));var _0x13d5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d51[_0x1facfa];return _0x9ec701;};'use strict';function SugarcrmAccount(_0x2fe583){this['id']=_0x2fe583['id']||0x0;this[_0x13d5('0x0')]=_0x2fe583[_0x13d5('0x0')]||'';this['username']=_0x2fe583[_0x13d5('0x1')]||'';this['password']=_0x2fe583[_0x13d5('0x2')]||'';this[_0x13d5('0x3')]=_0x2fe583[_0x13d5('0x3')]||'';this[_0x13d5('0x4')]=_0x2fe583['serverUrl']||'';this[_0x13d5('0x5')]=_0x2fe583[_0x13d5('0x5')]||{};}module[_0x13d5('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x3e2d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e2d,0x1bd));var _0xd3e2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3e2d[_0x160c73];return _0xd9302;};'use strict';function SugarcrmAccount(_0x52a43e){this['id']=_0x52a43e['id']||0x0;this[_0xd3e2('0x0')]=_0x52a43e[_0xd3e2('0x0')]||'';this[_0xd3e2('0x1')]=_0x52a43e[_0xd3e2('0x1')]||'';this[_0xd3e2('0x2')]=_0x52a43e[_0xd3e2('0x2')]||'';this[_0xd3e2('0x3')]=_0x52a43e[_0xd3e2('0x3')]||'';this[_0xd3e2('0x4')]=_0x52a43e[_0xd3e2('0x4')]||'';this[_0xd3e2('0x5')]=_0x52a43e[_0xd3e2('0x5')]||{};}module[_0xd3e2('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c8877d8..8f45112 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 _0xe900=['accountcode','unknown','stateTime','address','exports','name'];(function(_0xac4755,_0x306ae0){var _0x5e6164=function(_0x1fe009){while(--_0x1fe009){_0xac4755['push'](_0xac4755['shift']());}};_0x5e6164(++_0x306ae0);}(_0xe900,0x89));var _0x0e90=function(_0x3d4d33,_0x2313da){_0x3d4d33=_0x3d4d33-0x0;var _0x440d8e=_0xe900[_0x3d4d33];return _0x440d8e;};'use strict';function Telephone(_0x55c5a0){this['id']=_0x55c5a0['id']||0x0;this['name']=_0x55c5a0[_0x0e90('0x0')]||'';this[_0x0e90('0x1')]=_0x55c5a0[_0x0e90('0x1')]||'';this['state']=_0x0e90('0x2');this[_0x0e90('0x3')]=0x0;this['status']=_0x0e90('0x2');this[_0x0e90('0x4')]='';}module[_0x0e90('0x5')]=Telephone; \ No newline at end of file +var _0x6b5c=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b5c,0xdb));var _0xc6b5=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x6b5c[_0x30cd7e];return _0x462a02;};'use strict';function Telephone(_0xa2865f){this['id']=_0xa2865f['id']||0x0;this[_0xc6b5('0x0')]=_0xa2865f['name']||'';this[_0xc6b5('0x1')]=_0xa2865f[_0xc6b5('0x1')]||'';this[_0xc6b5('0x2')]=_0xc6b5('0x3');this[_0xc6b5('0x4')]=0x0;this[_0xc6b5('0x5')]=_0xc6b5('0x3');this[_0xc6b5('0x6')]='';}module[_0xc6b5('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8c44d33..4033048 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x35021d,_0x727d0e){var _0x3c88e8=function(_0xdc1728){while(--_0xdc1728){_0x35021d['push'](_0x35021d['shift']());}};_0x3c88e8(++_0x727d0e);}(_0xb10b,0x12a));var _0xbb10=function(_0x213295,_0x465d81){_0x213295=_0x213295-0x0;var _0x43a797=_0xb10b[_0x213295];return _0x43a797;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5cfbfc,_0x3b9a9d){var _0xa290d7=function(_0x15a132){while(--_0x15a132){_0x5cfbfc['push'](_0x5cfbfc['shift']());}};_0xa290d7(++_0x3b9a9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 402360b..4d9bdc4 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x11ef75,_0x4e12d8){var _0x2c2672=function(_0x4ba9c7){while(--_0x4ba9c7){_0x11ef75['push'](_0x11ef75['shift']());}};_0x2c2672(++_0x4e12d8);}(_0x2032,0xd9));var _0x2203=function(_0x1264c0,_0x1c0a57){_0x1264c0=_0x1264c0-0x0;var _0x545dae=_0x2032[_0x1264c0];return _0x545dae;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x1f71ca,_0x48c0a2){var _0x34929f=function(_0x7bb693){while(--_0x7bb693){_0x1f71ca['push'](_0x1f71ca['shift']());}};_0x34929f(++_0x48c0a2);}(_0x4fc2,0x111));var _0x24fc=function(_0x50d8da,_0xe56e5b){_0x50d8da=_0x50d8da-0x0;var _0x1b55bb=_0x4fc2[_0x50d8da];return _0x1b55bb;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}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 af66bb9..e2934fc 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 _0x0804=['registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh'];(function(_0x3d26c8,_0x1a9383){var _0x39efcc=function(_0x3100f8){while(--_0x3100f8){_0x3d26c8['push'](_0x3d26c8['shift']());}};_0x39efcc(++_0x1a9383);}(_0x0804,0x9d));var _0x4080=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x0804[_0x2d61b2];return _0x12df89;};'use strict';function Trunk(_0x305f13){this['id']=_0x305f13['id']||0x0;this[_0x4080('0x0')]=_0x305f13[_0x4080('0x0')]||![];this['name']=_0x305f13[_0x4080('0x1')]||'';this[_0x4080('0x2')]=_0x4080('0x3');this[_0x4080('0x4')]=0x0;this[_0x4080('0x5')]=_0x4080('0x3');this['registry']=_0x305f13['registry']&&_0x305f13['registry']['indexOf'](':')?_0x305f13[_0x4080('0x6')][_0x4080('0x7')](':')[0x0]:'';this[_0x4080('0x8')]='';this[_0x4080('0x9')]='';this[_0x4080('0xa')]='';this[_0x4080('0xb')]='';this[_0x4080('0xc')]='';this['stateRegistry']=_0x4080('0x3');this[_0x4080('0xd')]='';this[_0x4080('0xe')]='';this[_0x4080('0xf')]=_0x305f13[_0x4080('0xf')]||'';}module[_0x4080('0x10')]=Trunk; \ No newline at end of file +var _0x9131=['exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser'];(function(_0x2f3d7f,_0x52aeac){var _0x2903ac=function(_0x30c76c){while(--_0x30c76c){_0x2f3d7f['push'](_0x2f3d7f['shift']());}};_0x2903ac(++_0x52aeac);}(_0x9131,0x1c9));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x177270){this['id']=_0x177270['id']||0x0;this[_0x1913('0x0')]=_0x177270[_0x1913('0x0')]||![];this[_0x1913('0x1')]=_0x177270[_0x1913('0x1')]||'';this[_0x1913('0x2')]='unknown';this[_0x1913('0x3')]=0x0;this[_0x1913('0x4')]=_0x1913('0x5');this[_0x1913('0x6')]=_0x177270[_0x1913('0x6')]&&_0x177270[_0x1913('0x6')][_0x1913('0x7')](':')?_0x177270['registry'][_0x1913('0x8')](':')[0x0]:'';this[_0x1913('0x9')]='';this[_0x1913('0xa')]='';this[_0x1913('0xb')]='';this[_0x1913('0xc')]='';this[_0x1913('0xd')]='';this[_0x1913('0xe')]='unknown';this[_0x1913('0xf')]='';this[_0x1913('0x10')]='';this[_0x1913('0x11')]=_0x177270['defaultuser']||'';}module[_0x1913('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9386bef..81470a7 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 _0x5731=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x1c7564,_0x1fc6de){var _0xd911e5=function(_0x5afece){while(--_0x5afece){_0x1c7564['push'](_0x1c7564['shift']());}};_0xd911e5(++_0x1fc6de);}(_0x5731,0xce));var _0x1573=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5731[_0x2641f9];return _0x585741;};'use strict';function voiceExtension(_0xa57c9e){this['id']=_0xa57c9e['id']||0x0;this[_0x1573('0x0')]=_0xa57c9e[_0x1573('0x0')]||'';this['recordingFormat']=_0xa57c9e[_0x1573('0x1')]||_0x1573('0x2');this['mandatoryDisposition']=_0xa57c9e[_0x1573('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x26cb=['recordingFormat','mandatoryDisposition','exports'];(function(_0x3c0cff,_0x491564){var _0x22207a=function(_0x12ba25){while(--_0x12ba25){_0x3c0cff['push'](_0x3c0cff['shift']());}};_0x22207a(++_0x491564);}(_0x26cb,0x99));var _0xb26c=function(_0x2f2dd4,_0x27834f){_0x2f2dd4=_0x2f2dd4-0x0;var _0x5f07c4=_0x26cb[_0x2f2dd4];return _0x5f07c4;};'use strict';function voiceExtension(_0x14ea30){this['id']=_0x14ea30['id']||0x0;this['exten']=_0x14ea30['exten']||'';this[_0xb26c('0x0')]=_0x14ea30['recordingFormat']||'none';this['mandatoryDisposition']=_0x14ea30[_0xb26c('0x1')]||![];}module[_0xb26c('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 60ed1cc..535f582 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 _0x8a97=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','wav','gsm','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage'];(function(_0x213d99,_0x597fcc){var _0x3741e8=function(_0x3caca2){while(--_0x3caca2){_0x213d99['push'](_0x213d99['shift']());}};_0x3741e8(++_0x597fcc);}(_0x8a97,0x1b5));var _0x78a9=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8a97[_0x297fd3];return _0x2af381;};'use strict';var statusDesc=[_0x78a9('0x0'),_0x78a9('0x1'),_0x78a9('0x2'),_0x78a9('0x3'),_0x78a9('0x4'),_0x78a9('0x5'),_0x78a9('0x6'),'ringinuse',_0x78a9('0x7')];var monitorFormat={'wav':_0x78a9('0x8'),'wav49':'wav49','gsm':_0x78a9('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x5e55ed){this['id']=_0x5e55ed['id']||0x0;this['name']=_0x5e55ed['name']||'';this[_0x78a9('0xa')]=_0x5e55ed[_0x78a9('0xa')]||'';this[_0x78a9('0xb')]=_0x5e55ed[_0x78a9('0xb')]||_0x78a9('0xc');this['waiting']=0x0;this[_0x78a9('0xd')]=0x0;this[_0x78a9('0xe')]=0x0;this[_0x78a9('0xf')]=0x0;this[_0x78a9('0x10')]=0x0;this[_0x78a9('0x11')]=0x0;this[_0x78a9('0x12')]=0x0;this[_0x78a9('0x13')]=0x0;this[_0x78a9('0x14')]=0x0;this[_0x78a9('0x15')]=0x0;this[_0x78a9('0x16')]=0x0;this[_0x78a9('0x17')]=_0x5e55ed[_0x78a9('0x17')]||![];this[_0x78a9('0x18')]=_0x5e55ed['acwTimeout']||0xa;this[_0x78a9('0x19')]=_0x5e55ed[_0x78a9('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0x78a9('0x1a')]='';this['originated']=0x0;this[_0x78a9('0x1b')]=0x0;this[_0x78a9('0x1c')]=_0x5e55ed[_0x78a9('0x1c')]||null;this[_0x78a9('0x1d')]=_0x5e55ed[_0x78a9('0x1d')]?_0x5e55ed[_0x78a9('0x1d')]:null;this[_0x78a9('0x1e')]=_0x5e55ed[_0x78a9('0x1e')];this['dialMethod']=_0x5e55ed[_0x78a9('0x1f')]||_0x78a9('0x20');this['dialLimitChannel']=_0x5e55ed[_0x78a9('0x21')]||0x0;this[_0x78a9('0x22')]=_0x5e55ed[_0x78a9('0x22')]||0x0;this[_0x78a9('0x23')]=_0x5e55ed[_0x78a9('0x23')]||0x1;this[_0x78a9('0x24')]=_0x5e55ed[_0x78a9('0x24')]||_0x78a9('0x25');this[_0x78a9('0x26')]=_0x5e55ed[_0x78a9('0x26')]||0.03;this[_0x78a9('0x27')]=_0x5e55ed[_0x78a9('0x27')]||0x258;this[_0x78a9('0x28')]=_0x5e55ed[_0x78a9('0x28')]||'anonymous';this[_0x78a9('0x29')]=_0x5e55ed[_0x78a9('0x29')]||'anonymous';this['dialOriginateTimeout']=_0x5e55ed[_0x78a9('0x2a')]||0x1e;this[_0x78a9('0x2b')]=_0x5e55ed[_0x78a9('0x2b')]||_0x78a9('0x2c');this[_0x78a9('0x2d')]=_0x5e55ed['dialQueueTimeout']||0x3;this[_0x78a9('0x2e')]=_0x5e55ed[_0x78a9('0x2e')]||undefined;this[_0x78a9('0x2f')]=_0x5e55ed['dialCongestionMaxRetry']||0x3;this[_0x78a9('0x30')]=_0x5e55ed['dialCongestionRetryFrequency']||0x96;this[_0x78a9('0x31')]=_0x5e55ed['dialBusyMaxRetry']||0x3;this[_0x78a9('0x32')]=_0x5e55ed['dialBusyRetryFrequency']||0x96;this[_0x78a9('0x33')]=_0x5e55ed[_0x78a9('0x33')]||0x3;this[_0x78a9('0x34')]=_0x5e55ed['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5e55ed['dialNoSuchNumberMaxRetry']||0x3;this[_0x78a9('0x35')]=_0x5e55ed['dialNoSuchNumberRetryFrequency']||0x96;this[_0x78a9('0x36')]=_0x5e55ed[_0x78a9('0x36')]||0x3;this[_0x78a9('0x37')]=_0x5e55ed['dialDropRetryFrequency']||0x96;this[_0x78a9('0x38')]=_0x5e55ed['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5e55ed[_0x78a9('0x39')]||0x96;this[_0x78a9('0x3a')]=_0x5e55ed[_0x78a9('0x3a')]||0x3;this[_0x78a9('0x3b')]=_0x5e55ed[_0x78a9('0x3b')]||0x96;this[_0x78a9('0x3c')]=_0x5e55ed['dialAgentRejectMaxRetry']||0x3;this[_0x78a9('0x3d')]=_0x5e55ed[_0x78a9('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x5e55ed[_0x78a9('0x3e')]||0x3;this[_0x78a9('0x3f')]=_0x5e55ed[_0x78a9('0x3f')]||0x4;this[_0x78a9('0x40')]=_0x5e55ed['Trunk']?_0x5e55ed[_0x78a9('0x40')]:undefined;this['TrunkBackup']=_0x5e55ed['TrunkBackup']?_0x5e55ed[_0x78a9('0x41')]:undefined;this['dialPrefix']=_0x5e55ed['dialPrefix']||undefined;this['Interval']=_0x5e55ed[_0x78a9('0x42')]?_0x5e55ed[_0x78a9('0x42')]:undefined;this[_0x78a9('0x43')]=_0x5e55ed[_0x78a9('0x43')]||_0x78a9('0x44');this[_0x78a9('0x45')]=_0x5e55ed[_0x78a9('0x45')]||undefined;this[_0x78a9('0x46')]=_0x5e55ed['dialCutDigit']||undefined;this['strategy']=strategy[_0x5e55ed['strategy']]||'rrmemory';this['queueStatusComplete']=!![];this[_0x78a9('0x47')]=_0x5e55ed['dialAMDActive']||![];this[_0x78a9('0x48')]=_0x5e55ed[_0x78a9('0x48')];this['dialAMDGreeting']=_0x5e55ed['dialAMDGreeting'];this[_0x78a9('0x49')]=_0x5e55ed[_0x78a9('0x49')];this[_0x78a9('0x4a')]=_0x5e55ed[_0x78a9('0x4a')];this['dialAMDMinWordLength']=_0x5e55ed[_0x78a9('0x4b')];this['dialAMDBetweenWordsSilence']=_0x5e55ed[_0x78a9('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x5e55ed[_0x78a9('0x4d')];this[_0x78a9('0x4e')]=_0x5e55ed[_0x78a9('0x4e')];this['dialAMDMaximumWordLength']=_0x5e55ed['dialAMDMaximumWordLength'];this[_0x78a9('0x4f')]=0x0;this[_0x78a9('0x50')]=0x0;this[_0x78a9('0x51')]=_0x5e55ed[_0x78a9('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0x78a9('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x78a9('0x53')]=0x0;this[_0x78a9('0x54')]=0x0;this[_0x78a9('0x55')]=0x0;this[_0x78a9('0x56')]=0x0;this[_0x78a9('0x57')]=0x0;this[_0x78a9('0x58')]=0x0;this[_0x78a9('0x59')]=0x0;this[_0x78a9('0x5a')]=0x0;this[_0x78a9('0x5b')]=0x0;this[_0x78a9('0x5c')]=0x0;this[_0x78a9('0x5d')]=0x0;this['startProgressive']=undefined;this[_0x78a9('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x78a9('0x5f')]=1.05;this[_0x78a9('0x60')]=0x0;this[_0x78a9('0x61')]=0x0;this[_0x78a9('0x62')]=0x0;this[_0x78a9('0x63')]=0x0;this[_0x78a9('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x78a9('0x65')]=_0x5e55ed[_0x78a9('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x5e55ed[_0x78a9('0x66')]||0xa;this[_0x78a9('0x67')]=0x0;this[_0x78a9('0x68')]=0x0;this[_0x78a9('0x69')]=0x1;this[_0x78a9('0x6a')]=0x0;this[_0x78a9('0x6b')]=0x0;this[_0x78a9('0x6c')]=0x0;this[_0x78a9('0x6d')]=0x0;this[_0x78a9('0x6e')]=_0x5e55ed['dialRecallMeTimeout']||0x1e;this[_0x78a9('0x6f')]=_0x5e55ed[_0x78a9('0x6f')]||![];this[_0x78a9('0x70')]=!!_0x5e55ed[_0x78a9('0x70')]||![];this[_0x78a9('0x71')]=!!_0x5e55ed[_0x78a9('0x71')]||![];this[_0x78a9('0x72')]=_0x5e55ed[_0x78a9('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x5e55ed['dialAgiAfterHangupClient']||![];this[_0x78a9('0x73')]=_0x5e55ed[_0x78a9('0x73')]||![];this[_0x78a9('0xa')]=monitorFormat[_0x5e55ed[_0x78a9('0xa')]]?monitorFormat[_0x5e55ed[_0x78a9('0xa')]]:undefined;this[_0x78a9('0x74')]=_0x5e55ed[_0x78a9('0x74')]||![];this[_0x78a9('0x75')]=_0x5e55ed['mandatoryDispositionPause']?_0x5e55ed[_0x78a9('0x75')]:undefined;}module[_0x78a9('0x76')]=VoiceQueue; \ No newline at end of file +var _0x6b94=['erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','inbound','waiting','total','answered','unmanaged','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','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','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x6b94,0xee));var _0x46b9=function(_0x486ca7,_0x4ca73b){_0x486ca7=_0x486ca7-0x0;var _0x31834a=_0x6b94[_0x486ca7];return _0x31834a;};'use strict';var statusDesc=[_0x46b9('0x0'),_0x46b9('0x1'),'inuse',_0x46b9('0x2'),_0x46b9('0x3'),_0x46b9('0x4'),_0x46b9('0x5'),_0x46b9('0x6'),_0x46b9('0x7')];var monitorFormat={'wav':_0x46b9('0x8'),'wav49':_0x46b9('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x46b9('0xa'),'roundrobin':_0x46b9('0xb')};function VoiceQueue(_0x10af0a){this['id']=_0x10af0a['id']||0x0;this[_0x46b9('0xc')]=_0x10af0a[_0x46b9('0xc')]||'';this[_0x46b9('0xd')]=_0x10af0a[_0x46b9('0xd')]||'';this['type']=_0x10af0a['type']||_0x46b9('0xe');this[_0x46b9('0xf')]=0x0;this['talking']=0x0;this[_0x46b9('0x10')]=0x0;this[_0x46b9('0x11')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x46b9('0x12')]=0x0;this[_0x46b9('0x13')]=0x0;this[_0x46b9('0x14')]=0x0;this[_0x46b9('0x15')]=0x0;this[_0x46b9('0x16')]=_0x10af0a[_0x46b9('0x16')]||![];this['acwTimeout']=_0x10af0a['acwTimeout']||0xa;this[_0x46b9('0x17')]=_0x10af0a[_0x46b9('0x17')]||'no';this[_0x46b9('0x18')]=!![];this['message']='';this[_0x46b9('0x19')]=0x0;this['temp']=0x0;this[_0x46b9('0x1a')]=_0x10af0a['dialTimezone']||null;this[_0x46b9('0x1b')]=_0x10af0a[_0x46b9('0x1b')]?_0x10af0a['dialGlobalInterval']:null;this[_0x46b9('0x1c')]=_0x10af0a[_0x46b9('0x1c')];this['dialMethod']=_0x10af0a[_0x46b9('0x1d')]||'progressive';this[_0x46b9('0x1e')]=_0x10af0a['dialLimitChannel']||0x0;this[_0x46b9('0x1f')]=_0x10af0a[_0x46b9('0x1f')]||0x0;this[_0x46b9('0x20')]=_0x10af0a[_0x46b9('0x20')]||0x1;this['dialPredictiveOptimization']=_0x10af0a[_0x46b9('0x21')]||_0x46b9('0x22');this['dialPredictiveOptimizationPercentage']=_0x10af0a[_0x46b9('0x23')]||0.03;this[_0x46b9('0x24')]=_0x10af0a[_0x46b9('0x24')]||0x258;this[_0x46b9('0x25')]=_0x10af0a[_0x46b9('0x25')]||_0x46b9('0x26');this[_0x46b9('0x27')]=_0x10af0a[_0x46b9('0x27')]||_0x46b9('0x26');this['dialOriginateTimeout']=_0x10af0a[_0x46b9('0x28')]||0x1e;this[_0x46b9('0x29')]=_0x10af0a[_0x46b9('0x29')]||_0x46b9('0x2a');this['dialQueueTimeout']=_0x10af0a[_0x46b9('0x2b')]||0x3;this[_0x46b9('0x2c')]=_0x10af0a[_0x46b9('0x2c')]||undefined;this[_0x46b9('0x2d')]=_0x10af0a['dialCongestionMaxRetry']||0x3;this[_0x46b9('0x2e')]=_0x10af0a[_0x46b9('0x2e')]||0x96;this[_0x46b9('0x2f')]=_0x10af0a[_0x46b9('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x10af0a[_0x46b9('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x10af0a[_0x46b9('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x10af0a[_0x46b9('0x32')]||0x96;this[_0x46b9('0x33')]=_0x10af0a[_0x46b9('0x33')]||0x3;this[_0x46b9('0x34')]=_0x10af0a[_0x46b9('0x34')]||0x96;this[_0x46b9('0x35')]=_0x10af0a['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x10af0a[_0x46b9('0x36')]||0x96;this[_0x46b9('0x37')]=_0x10af0a[_0x46b9('0x37')]||0x3;this[_0x46b9('0x38')]=_0x10af0a[_0x46b9('0x38')]||0x96;this['dialMachineMaxRetry']=_0x10af0a['dialMachineMaxRetry']||0x3;this[_0x46b9('0x39')]=_0x10af0a[_0x46b9('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x10af0a[_0x46b9('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x10af0a[_0x46b9('0x3b')]||0x96;this[_0x46b9('0x3c')]=_0x10af0a[_0x46b9('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x10af0a['dialGlobalMaxRetry']||0x4;this[_0x46b9('0x3d')]=_0x10af0a[_0x46b9('0x3d')]?_0x10af0a[_0x46b9('0x3d')]:undefined;this[_0x46b9('0x3e')]=_0x10af0a[_0x46b9('0x3e')]?_0x10af0a[_0x46b9('0x3e')]:undefined;this[_0x46b9('0x3f')]=_0x10af0a[_0x46b9('0x3f')]||undefined;this[_0x46b9('0x40')]=_0x10af0a[_0x46b9('0x40')]?_0x10af0a[_0x46b9('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x10af0a[_0x46b9('0x41')]||_0x46b9('0x42');this[_0x46b9('0x43')]=_0x10af0a[_0x46b9('0x43')]||undefined;this['dialCutDigit']=_0x10af0a[_0x46b9('0x44')]||undefined;this[_0x46b9('0x45')]=strategy[_0x10af0a['strategy']]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x10af0a[_0x46b9('0x46')]||![];this[_0x46b9('0x47')]=_0x10af0a[_0x46b9('0x47')];this['dialAMDGreeting']=_0x10af0a[_0x46b9('0x48')];this[_0x46b9('0x49')]=_0x10af0a[_0x46b9('0x49')];this['dialAMDTotalAnalysisTime']=_0x10af0a['dialAMDTotalAnalysisTime'];this[_0x46b9('0x4a')]=_0x10af0a[_0x46b9('0x4a')];this[_0x46b9('0x4b')]=_0x10af0a[_0x46b9('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x10af0a[_0x46b9('0x4c')];this[_0x46b9('0x4d')]=_0x10af0a[_0x46b9('0x4d')];this[_0x46b9('0x4e')]=_0x10af0a[_0x46b9('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x46b9('0x4f')]=0x0;this['timeout']=_0x10af0a[_0x46b9('0x50')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x46b9('0x51')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x46b9('0x52')]=0x0;this[_0x46b9('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x46b9('0x54')]=0x0;this[_0x46b9('0x55')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x46b9('0x56')]=0x0;this[_0x46b9('0x57')]=0x0;this[_0x46b9('0x58')]=undefined;this[_0x46b9('0x59')]=undefined;this[_0x46b9('0x5a')]=undefined;this[_0x46b9('0x5b')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x46b9('0x5c')]=0x0;this[_0x46b9('0x5d')]=0x0;this[_0x46b9('0x5e')]=0x0;this[_0x46b9('0x5f')]=0x0;this[_0x46b9('0x60')]=0x0;this[_0x46b9('0x61')]=0x0;this[_0x46b9('0x62')]=_0x10af0a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x46b9('0x63')]=_0x10af0a[_0x46b9('0x64')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x46b9('0x65')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x46b9('0x66')]=0x0;this[_0x46b9('0x67')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x46b9('0x68')]=0x0;this['dialRecallMeTimeout']=_0x10af0a[_0x46b9('0x69')]||0x1e;this[_0x46b9('0x6a')]=_0x10af0a[_0x46b9('0x6a')]||![];this['dialPreviewAutoRecallMe']=!!_0x10af0a['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x10af0a[_0x46b9('0x6b')]||![];this[_0x46b9('0x6c')]=_0x10af0a[_0x46b9('0x6c')]||undefined;this[_0x46b9('0x6d')]=_0x10af0a['dialAgiAfterHangupClient']||![];this[_0x46b9('0x6e')]=_0x10af0a[_0x46b9('0x6e')]||![];this[_0x46b9('0xd')]=monitorFormat[_0x10af0a[_0x46b9('0xd')]]?monitorFormat[_0x10af0a[_0x46b9('0xd')]]:undefined;this[_0x46b9('0x6f')]=_0x10af0a[_0x46b9('0x6f')]||![];this['mandatoryDispositionPause']=_0x10af0a['mandatoryDispositionPause']?_0x10af0a[_0x46b9('0x70')]:undefined;}module[_0x46b9('0x71')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6113a5d..e255233 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 _0x7d26=['accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x35b306,_0x5255c3){var _0x11f101=function(_0x539f09){while(--_0x539f09){_0x35b306['push'](_0x35b306['shift']());}};_0x11f101(++_0x5255c3);}(_0x7d26,0xcb));var _0x67d2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7d26[_0x3bf83f];return _0x22c4a9;};'use strict';function VtigerAccount(_0x3a0d41){this['id']=_0x3a0d41['id']||0x0;this[_0x67d2('0x0')]=_0x3a0d41['name']||'';this['username']=_0x3a0d41['username']||'';this[_0x67d2('0x1')]=_0x3a0d41[_0x67d2('0x1')]||'';this[_0x67d2('0x2')]=_0x3a0d41[_0x67d2('0x2')]||'';this[_0x67d2('0x3')]=_0x3a0d41[_0x67d2('0x3')]||'';this[_0x67d2('0x4')]=_0x3a0d41[_0x67d2('0x4')]||{};}module[_0x67d2('0x5')]=VtigerAccount; \ No newline at end of file +var _0x2cd3=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x48b7f7,_0x4e41e7){var _0x155f35=function(_0x27c252){while(--_0x27c252){_0x48b7f7['push'](_0x48b7f7['shift']());}};_0x155f35(++_0x4e41e7);}(_0x2cd3,0x1f3));var _0x32cd=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x2cd3[_0x2d8f6c];return _0x3a00f6;};'use strict';function VtigerAccount(_0x1eed5b){this['id']=_0x1eed5b['id']||0x0;this['name']=_0x1eed5b[_0x32cd('0x0')]||'';this[_0x32cd('0x1')]=_0x1eed5b['username']||'';this[_0x32cd('0x2')]=_0x1eed5b['accessKey']||'';this['remoteUri']=_0x1eed5b[_0x32cd('0x3')]||'';this['serverUrl']=_0x1eed5b[_0x32cd('0x4')]||'';this[_0x32cd('0x5')]=_0x1eed5b['Configurations']||{};}module[_0x32cd('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 84c64ef..9b80253 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 _0xccd7=['username','password','token','remoteUri','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x32a5dc,_0x3d3777){var _0x73ed14=function(_0x186d79){while(--_0x186d79){_0x32a5dc['push'](_0x32a5dc['shift']());}};_0x73ed14(++_0x3d3777);}(_0xccd7,0x6d));var _0x7ccd=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0xccd7[_0x4b0290];return _0x4bd9f4;};'use strict';function ZendeskAccount(_0x318740){this['id']=_0x318740['id']||0x0;this[_0x7ccd('0x0')]=_0x318740['name']||'';this[_0x7ccd('0x1')]=_0x318740[_0x7ccd('0x1')]||'';this[_0x7ccd('0x2')]=_0x318740[_0x7ccd('0x2')]||'';this[_0x7ccd('0x3')]=_0x318740[_0x7ccd('0x3')]||'';this[_0x7ccd('0x4')]=_0x318740[_0x7ccd('0x4')]||'';this['authType']=_0x318740['authType']||'';this[_0x7ccd('0x5')]=_0x318740[_0x7ccd('0x5')]||_0x7ccd('0x6');this[_0x7ccd('0x7')]=_0x318740[_0x7ccd('0x7')]||'';this[_0x7ccd('0x8')]=_0x318740[_0x7ccd('0x8')]||{};}module[_0x7ccd('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xc071=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc071,0x143));var _0x1c07=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xc071[_0x4c445a];return _0x2f611c;};'use strict';function ZendeskAccount(_0x41a6db){this['id']=_0x41a6db['id']||0x0;this[_0x1c07('0x0')]=_0x41a6db[_0x1c07('0x0')]||'';this[_0x1c07('0x1')]=_0x41a6db[_0x1c07('0x1')]||'';this['password']=_0x41a6db[_0x1c07('0x2')]||'';this[_0x1c07('0x3')]=_0x41a6db[_0x1c07('0x3')]||'';this['remoteUri']=_0x41a6db[_0x1c07('0x4')]||'';this[_0x1c07('0x5')]=_0x41a6db['authType']||'';this[_0x1c07('0x6')]=_0x41a6db[_0x1c07('0x6')]||_0x1c07('0x7');this[_0x1c07('0x8')]=_0x41a6db[_0x1c07('0x8')]||'';this[_0x1c07('0x9')]=_0x41a6db[_0x1c07('0x9')]||{};}module[_0x1c07('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 6d2c937..4119e8d 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 _0x2606=['clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3b1337,_0x396ce8){var _0x58307a=function(_0x4e5193){while(--_0x4e5193){_0x3b1337['push'](_0x3b1337['shift']());}};_0x58307a(++_0x396ce8);}(_0x2606,0x73));var _0x6260=function(_0x2c3721,_0x4717cb){_0x2c3721=_0x2c3721-0x0;var _0x21ab50=_0x2606[_0x2c3721];return _0x21ab50;};'use strict';function ZohoAccount(_0x217970){this['id']=_0x217970['id']||0x0;this[_0x6260('0x0')]=_0x217970['name']||'';this['description']=_0x217970[_0x6260('0x1')]||'';this['host']=_0x217970[_0x6260('0x2')]||'';this['zone']=_0x217970[_0x6260('0x3')]||'';this[_0x6260('0x4')]=_0x217970[_0x6260('0x4')]||'';this[_0x6260('0x5')]=_0x217970[_0x6260('0x5')]||'';this['serverUrl']=_0x217970['serverUrl']||'';this[_0x6260('0x6')]=_0x217970[_0x6260('0x6')]||'';this['refreshToken']=_0x217970[_0x6260('0x7')]||'';this[_0x6260('0x8')]=_0x217970[_0x6260('0x8')]||{};}module[_0x6260('0x9')]=ZohoAccount; \ No newline at end of file +var _0x4549=['serverUrl','code','refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret'];(function(_0x2e4ab7,_0x23f166){var _0x5e5f11=function(_0x4141ef){while(--_0x4141ef){_0x2e4ab7['push'](_0x2e4ab7['shift']());}};_0x5e5f11(++_0x23f166);}(_0x4549,0x14f));var _0x9454=function(_0x582089,_0x10a46d){_0x582089=_0x582089-0x0;var _0x559756=_0x4549[_0x582089];return _0x559756;};'use strict';function ZohoAccount(_0x49e7e9){this['id']=_0x49e7e9['id']||0x0;this[_0x9454('0x0')]=_0x49e7e9[_0x9454('0x0')]||'';this['description']=_0x49e7e9['description']||'';this[_0x9454('0x1')]=_0x49e7e9['host']||'';this[_0x9454('0x2')]=_0x49e7e9[_0x9454('0x2')]||'';this[_0x9454('0x3')]=_0x49e7e9[_0x9454('0x3')]||'';this[_0x9454('0x4')]=_0x49e7e9['clientSecret']||'';this[_0x9454('0x5')]=_0x49e7e9['serverUrl']||'';this[_0x9454('0x6')]=_0x49e7e9[_0x9454('0x6')]||'';this[_0x9454('0x7')]=_0x49e7e9[_0x9454('0x7')]||'';this[_0x9454('0x8')]=_0x49e7e9['Configurations']||{};}module[_0x9454('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 5760030..275739e 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 _0x5fdc=['number','util','lodash','moment','isNil','string','queue','name','type','dialAnswer','membername','Agent','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>'];(function(_0x89baf1,_0x4060dc){var _0x2a67a2=function(_0xc5c6a6){while(--_0xc5c6a6){_0x89baf1['push'](_0x89baf1['shift']());}};_0x2a67a2(++_0x4060dc);}(_0x5fdc,0x127));var _0xc5fd=function(_0x466b65,_0x39afdb){_0x466b65=_0x466b65-0x0;var _0x2ad805=_0x5fdc[_0x466b65];return _0x2ad805;};'use strict';var util=require(_0xc5fd('0x0'));var _=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));function checkNameSurname(_0x1d01cf,_0x36e895,_0x341db9){var _0x3be451='';if(!_[_0xc5fd('0x3')](_0x36e895)&&_0xc5fd('0x4')===typeof _0x36e895){_0x3be451+=_0x36e895;}if(!_[_0xc5fd('0x3')](_0x341db9)&&_0xc5fd('0x4')===typeof _0x341db9){_0x3be451+='\x20'+_0x341db9;}if(_0x3be451!==''){return _0x3be451;}return _0x1d01cf;}function Action(_0xea5748,_0x44722b,_0x216902,_0x15ffe7,_0x5a2eb4){this['uniqueid']=_0x216902||undefined;this['idContact']=_0xea5748['id'];this[_0xc5fd('0x5')]=_0x44722b[_0xc5fd('0x6')];this[_0xc5fd('0x7')]=_0x44722b[_0xc5fd('0x7')];this['campaigntype']='queue';this[_0xc5fd('0x8')]=![];this[_0xc5fd('0x9')]=_[_0xc5fd('0x3')](_0xea5748[_0xc5fd('0xa')])?undefined:_0xea5748[_0xc5fd('0xa')][_0xc5fd('0x6')];this['channelAgent']=this[_0xc5fd('0x9')]?util['format']('SIP/%s',this[_0xc5fd('0x9')]):_0x15ffe7||undefined;this[_0xc5fd('0xb')]=checkNameSurname(_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xd')],_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xe')],_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xf')]);this['active']=_0xea5748[_0xc5fd('0x10')]||![];this[_0xc5fd('0x11')]=_0xea5748[_0xc5fd('0xd')];this[_0xc5fd('0x12')]=_0xea5748['scheduledat'];this['countbusyretry']=_0xea5748['countbusyretry']||0x0;this['countcongestionretry']=_0xea5748['countcongestionretry']||0x0;this[_0xc5fd('0x13')]=_0xea5748[_0xc5fd('0x13')]||0x0;this[_0xc5fd('0x14')]=(_0xea5748[_0xc5fd('0x15')]||0x0)+(_0xea5748[_0xc5fd('0x16')]||0x0)+(_0xea5748[_0xc5fd('0x13')]||0x0)+(_0xea5748[_0xc5fd('0x17')]||0x0)+(_0xea5748['countdropretry']||0x0)+(_0xea5748[_0xc5fd('0x18')]||0x0)+(_0xea5748[_0xc5fd('0x19')]||0x0)+(_0xea5748[_0xc5fd('0x1a')]||0x0);this[_0xc5fd('0x17')]=_0xea5748[_0xc5fd('0x17')]||0x0;this['countdropretry']=_0xea5748[_0xc5fd('0x1b')]||0x0;this[_0xc5fd('0x18')]=_0xea5748[_0xc5fd('0x18')]||0x0;this[_0xc5fd('0x19')]=_0xea5748['countmachineretry']||0x0;this['countagentrejectretry']=_0xea5748[_0xc5fd('0x1a')]||0x0;this[_0xc5fd('0x1c')]=_0xea5748[_0xc5fd('0x1c')];this[_0xc5fd('0x1d')]=_0xea5748[_0xc5fd('0x1d')];this[_0xc5fd('0x1e')]=_0xea5748['callbackat'];this[_0xc5fd('0x1f')]=_0xea5748[_0xc5fd('0x1f')];this[_0xc5fd('0x20')]=_0xea5748[_0xc5fd('0x20')];this[_0xc5fd('0x21')]=_0xea5748[_0xc5fd('0x21')];this[_0xc5fd('0x22')]=_['isNil'](_0xea5748[_0xc5fd('0xa')])?_0xea5748['UserId']:_0xea5748[_0xc5fd('0xa')]['id'];this[_0xc5fd('0x23')]=_0xea5748[_0xc5fd('0x23')];this[_0xc5fd('0x24')]='';this['originatecalleridname']='';}Action[_0xc5fd('0x25')][_0xc5fd('0x26')]=function(){return util[_0xc5fd('0x27')](_0xc5fd('0x28'),this[_0xc5fd('0xb')],this[_0xc5fd('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x160f=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat'];(function(_0x376c87,_0x259f10){var _0x265832=function(_0xc288e3){while(--_0xc288e3){_0x376c87['push'](_0x376c87['shift']());}};_0x265832(++_0x259f10);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf160('0x0'));var _=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));function checkNameSurname(_0x2966aa,_0x5bf9e1,_0x4513f1){var _0x2fb414='';if(!_[_0xf160('0x3')](_0x5bf9e1)&&_0xf160('0x4')===typeof _0x5bf9e1){_0x2fb414+=_0x5bf9e1;}if(!_[_0xf160('0x3')](_0x4513f1)&&_0xf160('0x4')===typeof _0x4513f1){_0x2fb414+='\x20'+_0x4513f1;}if(_0x2fb414!==''){return _0x2fb414;}return _0x2966aa;}function Action(_0x4a6f3d,_0x311d63,_0x11902f,_0x49fe49,_0x59440e){this[_0xf160('0x5')]=_0x11902f||undefined;this['idContact']=_0x4a6f3d['id'];this['queue']=_0x311d63['name'];this[_0xf160('0x6')]=_0x311d63[_0xf160('0x6')];this[_0xf160('0x7')]=_0xf160('0x8');this['dialAnswer']=![];this['membername']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?undefined:_0x4a6f3d[_0xf160('0x9')]['name'];this[_0xf160('0xa')]=this[_0xf160('0xb')]?util[_0xf160('0xc')](_0xf160('0xd'),this[_0xf160('0xb')]):_0x49fe49||undefined;this['calleridname']=checkNameSurname(_0x4a6f3d[_0xf160('0xe')]['phone'],_0x4a6f3d[_0xf160('0xe')][_0xf160('0xf')],_0x4a6f3d[_0xf160('0xe')][_0xf160('0x10')]);this[_0xf160('0x11')]=_0x4a6f3d[_0xf160('0x11')]||![];this[_0xf160('0x12')]=_0x4a6f3d[_0xf160('0x13')];this[_0xf160('0x14')]=_0x4a6f3d['scheduledat'];this[_0xf160('0x15')]=_0x4a6f3d[_0xf160('0x15')]||0x0;this[_0xf160('0x16')]=_0x4a6f3d[_0xf160('0x16')]||0x0;this['countnoanswerretry']=_0x4a6f3d[_0xf160('0x17')]||0x0;this['countglobal']=(_0x4a6f3d[_0xf160('0x15')]||0x0)+(_0x4a6f3d[_0xf160('0x16')]||0x0)+(_0x4a6f3d[_0xf160('0x17')]||0x0)+(_0x4a6f3d[_0xf160('0x18')]||0x0)+(_0x4a6f3d[_0xf160('0x19')]||0x0)+(_0x4a6f3d[_0xf160('0x1a')]||0x0)+(_0x4a6f3d[_0xf160('0x1b')]||0x0)+(_0x4a6f3d[_0xf160('0x1c')]||0x0);this[_0xf160('0x18')]=_0x4a6f3d['countnosuchnumberretry']||0x0;this[_0xf160('0x19')]=_0x4a6f3d[_0xf160('0x19')]||0x0;this[_0xf160('0x1a')]=_0x4a6f3d['countabandonedretry']||0x0;this[_0xf160('0x1b')]=_0x4a6f3d[_0xf160('0x1b')]||0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=_0x4a6f3d[_0xf160('0x1d')];this[_0xf160('0x1e')]=_0x4a6f3d['callbackuniqueid'];this[_0xf160('0x1f')]=_0x4a6f3d[_0xf160('0x1f')];this[_0xf160('0x20')]=_0x4a6f3d[_0xf160('0x20')];this['ContactId']=_0x4a6f3d[_0xf160('0x21')];this[_0xf160('0x22')]=_0x4a6f3d['ListId'];this['UserId']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?_0x4a6f3d[_0xf160('0x23')]:_0x4a6f3d['Agent']['id'];this[_0xf160('0x24')]=_0x4a6f3d[_0xf160('0x24')];this[_0xf160('0x25')]='';this[_0xf160('0x26')]='';}Action[_0xf160('0x27')][_0xf160('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0xf160('0x29')]);};module[_0xf160('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8ef59fc..a048253 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 _0x9668=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','TrunkBackup','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','dialPrefix','dialCutDigit','SIP/%s/%s%s','trim','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','ioredis','../../../config/logger','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','prototype','syncCampaigns','hasOwnProperty','preview','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','stringify','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','then','additional','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','originated:\x20','ANSWER','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','recallme','validateContact','isValid','checkIsBlackList'];(function(_0x19c64a,_0x5de14e){var _0x1b1a06=function(_0x5dd104){while(--_0x5dd104){_0x19c64a['push'](_0x19c64a['shift']());}};_0x1b1a06(++_0x5de14e);}(_0x9668,0x191));var _0x8966=function(_0x3d99bf,_0x248085){_0x3d99bf=_0x3d99bf-0x0;var _0x2dee3b=_0x9668[_0x3d99bf];return _0x2dee3b;};'use strict';var util=require(_0x8966('0x0'));var _=require('lodash');var uuid=require(_0x8966('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x8966('0x2'));var config=require('../../../config/environment');var logger=require(_0x8966('0x3'))('preview');var loggerAction=require(_0x8966('0x3'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x8966('0x4'));var cmHopperAdditionalPhone=require(_0x8966('0x5'));var Action=require(_0x8966('0x6'));var ut=require('./util/util');config[_0x8966('0x7')]=_[_0x8966('0x8')](config[_0x8966('0x7')],{'host':_0x8966('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x8966('0xa')]=function(_0x46266d){this[_0x8966('0xb')]=this[_0x8966('0xb')]?this[_0x8966('0xb')][_0x8966('0xc')](_0x46266d):_0x46266d();};function Preview(_0x312364){this['sequence']=new Sequence();this[_0x8966('0xd')]=_0x312364['voiceQueues'];this[_0x8966('0xe')]=_0x312364['trunks'];this[_0x8966('0xf')]={};this[_0x8966('0x10')]=_0x312364[_0x8966('0x10')];this[_0x8966('0x11')]=0x0;ami['on'](_0x8966('0x12'),this[_0x8966('0x13')]['bind'](this));ami['on'](_0x8966('0x14'),this[_0x8966('0x15')]['bind'](this));ami['on'](_0x8966('0x16'),this[_0x8966('0x17')][_0x8966('0x18')](this));ami['on'](_0x8966('0x19'),this[_0x8966('0x1a')]['bind'](this));ami['on'](_0x8966('0x1b'),this[_0x8966('0x1c')][_0x8966('0x18')](this));ami['on'](_0x8966('0x1d'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this[_0x8966('0x1e')][_0x8966('0x18')](this));ami['on'](_0x8966('0x1f'),this[_0x8966('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4ad16f,_0x55c552,_0x391a33){io['to'](_0x4ad16f)[_0x8966('0x21')](_0x55c552,_0x391a33);}function emitCampaignPreview(_0x5af396){if(_0x5af396[_0x8966('0x22')]==='outbound'){var _0x54a112={'id':_0x5af396['id'],'name':_0x5af396[_0x8966('0x23')],'strategy':_0x5af396[_0x8966('0x24')],'answered':_0x5af396[_0x8966('0x25')],'available':_0x5af396['available'],'loggedIn':_0x5af396['loggedIn'],'pTalking':_0x5af396[_0x8966('0x26')],'sumBillable':_0x5af396[_0x8966('0x27')],'sumDuration':_0x5af396['sumDuration'],'sumHoldTime':_0x5af396[_0x8966('0x28')]||0x0,'talking':_0x5af396[_0x8966('0x29')],'total':_0x5af396['total'],'type':_0x5af396[_0x8966('0x22')],'unmanaged':_0x5af396[_0x8966('0x2a')],'abandoned':_0x5af396[_0x8966('0x2b')],'waiting':_0x5af396['waiting'],'loggedInDb':_0x5af396[_0x8966('0x2c')],'dialActive':_0x5af396[_0x8966('0x2d')],'dialMethod':_0x5af396[_0x8966('0x2e')],'dialOriginateCallerIdName':_0x5af396[_0x8966('0x2f')],'dialOriginateCallerIdNumber':_0x5af396['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5af396[_0x8966('0x30')],'dialPrefix':_0x5af396['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5af396[_0x8966('0x31')],'outboundAnswerCallsDay':_0x5af396['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5af396[_0x8966('0x32')],'outboundBusyCallsDay':_0x5af396[_0x8966('0x33')],'outboundCongestionCallsDay':_0x5af396[_0x8966('0x34')],'outboundDropCallsDayACS':_0x5af396[_0x8966('0x35')],'outboundDropCallsDayCallersExit':_0x5af396[_0x8966('0x36')],'outboundDropCallsDayTimeout':_0x5af396['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5af396[_0x8966('0x37')],'outboundNoSuchCallsDay':_0x5af396['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5af396[_0x8966('0x38')],'outboundReCallsDay':_0x5af396[_0x8966('0x39')],'outboundRejectCallsDay':_0x5af396[_0x8966('0x3a')],'outboundUnknownCallsDay':_0x5af396[_0x8966('0x3b')],'outboundAbandonedCallsDay':_0x5af396[_0x8966('0x3c')],'predictiveIntervalAnsweredCalls':_0x5af396[_0x8966('0x3d')],'predictiveIntervalAvgHoldtime':_0x5af396[_0x8966('0x3e')],'predictiveIntervalAvgTalktime':_0x5af396[_0x8966('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x5af396[_0x8966('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x5af396[_0x8966('0x41')],'predictiveIntervalErlangCalls':_0x5af396[_0x8966('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x5af396['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5af396[_0x8966('0x43')],'predictiveIntervalMultiplicativeFactor':_0x5af396[_0x8966('0x44')],'predictiveIntervalPauses':_0x5af396[_0x8966('0x45')],'predictiveIntervalAvailable':_0x5af396[_0x8966('0x46')],'predictiveIntervalTotalCalls':_0x5af396[_0x8966('0x47')],'message':_0x5af396[_0x8966('0x48')],'originated':_0x5af396[_0x8966('0x49')],'erlangCalls':_0x5af396[_0x8966('0x4a')],'erlangCallToSecond':_0x5af396[_0x8966('0x4b')],'erlangAbandonmentRate':_0x5af396[_0x8966('0x4c')],'erlangBusyFactor':_0x5af396[_0x8966('0x4d')],'startPredictive':_0x5af396[_0x8966('0x4e')],'startProgressive':_0x5af396[_0x8966('0x4f')]};if(_0x5af396['Trunk']){_0x54a112['Trunk']={'id':_0x5af396[_0x8966('0x50')]['id'],'name':_0x5af396['Trunk']['name'],'active':_0x5af396[_0x8966('0x50')][_0x8966('0x51')],'callerid':_0x5af396[_0x8966('0x50')][_0x8966('0x52')]};}if(_0x5af396[_0x8966('0x53')]){_0x54a112[_0x8966('0x53')]={'id':_0x5af396[_0x8966('0x53')]['id'],'name':_0x5af396[_0x8966('0x53')][_0x8966('0x23')]};}var _0x331d66=md5(JSON['stringify'](_0x54a112));if(_0x5af396[_0x8966('0x54')]!==_0x331d66){_0x5af396[_0x8966('0x54')]=_0x331d66;emit(util[_0x8966('0x55')](_0x8966('0x56'),_0x54a112['name']),_0x8966('0x57'),_0x54a112);}}}function emitVoiceQueueChannelRemove(_0x41c6c1){logger[_0x8966('0x58')](_0x8966('0x59'),JSON['stringify'](_0x41c6c1));emit(util[_0x8966('0x55')]('voice:queue:%s',_0x41c6c1[_0x8966('0x23')]),_0x8966('0x5a'),_0x41c6c1);io[_0x8966('0x21')](_0x8966('0x5b'),_0x41c6c1);}function notSendMessagesQueue(_0x2c441d){if(_0x2c441d['sendMessageOneNotActive']){if(_0x2c441d[_0x8966('0x49')]===0x0&&_0x2c441d['pTalking']===0x0){_0x2c441d[_0x8966('0x5c')]=![];_0x2c441d['available']=0x0;_0x2c441d['paused']=0x0;_0x2c441d['message']=_0x8966('0x5d');ut[_0x8966('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2c441d['name']+_0x8966('0x5f'));}else{_0x2c441d[_0x8966('0x48')]=_0x8966('0x60');ut[_0x8966('0x5e')](_0x8966('0x61'),_0x2c441d[_0x8966('0x23')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x2c441d);}}Preview[_0x8966('0x62')]['loopCampaigns']=function(){var _0x255ba1=this;setInterval(function(){_0x255ba1[_0x8966('0x63')]();},0x7cf);};Preview[_0x8966('0x62')][_0x8966('0x63')]=function(){var _0x55dd10=this[_0x8966('0xd')];this[_0x8966('0x11')]+=0x1;for(var _0x1b07c6 in _0x55dd10){if(_0x55dd10[_0x8966('0x64')](_0x1b07c6)&&(_0x55dd10[_0x1b07c6][_0x8966('0x2e')]===_0x8966('0x65')||_0x55dd10[_0x1b07c6][_0x8966('0x2e')]===_0x8966('0x66'))&&_0x55dd10[_0x1b07c6][_0x8966('0x22')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x8966('0x11')]=0x0;this['clearZombieChannels']();}}if(_0x55dd10[_0x8966('0x64')](_0x1b07c6)&&_0x55dd10[_0x1b07c6][_0x8966('0x2e')]==='preview'&&_0x55dd10[_0x1b07c6][_0x8966('0x22')]===_0x8966('0x67')){if(_0x55dd10[_0x1b07c6]['dialActive']){this[_0x8966('0x68')](_0x55dd10[_0x1b07c6]);if(_0x55dd10[_0x1b07c6]['dialPreviewAutoRecallMe'])this[_0x8966('0x69')](_0x55dd10[_0x1b07c6]);}else{notSendMessagesQueue(_0x55dd10[_0x1b07c6]);}}}};Preview[_0x8966('0x62')][_0x8966('0x6a')]=function(_0x2b4814){var _0x44afb2=this;this['sequence'][_0x8966('0xa')](function(){if(!_[_0x8966('0x6b')](_0x44afb2[_0x8966('0xf')][_0x2b4814])){loggerAction[_0x8966('0x58')](_0x8966('0x6c'),_0x2b4814,_0x8966('0x6d'),_0x44afb2['actions'][_0x2b4814][_0x8966('0x6e')],'originated:\x20',JSON[_0x8966('0x6f')](_0x44afb2[_0x8966('0xd')][_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x6e')]][_0x8966('0x49')]),_0x8966('0x70'),JSON['stringify'](_0x44afb2[_0x8966('0xd')][_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x6e')]][_0x8966('0x26')]),JSON[_0x8966('0x6f')](_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x71')]),JSON['stringify'](_[_0x8966('0x72')](_0x44afb2[_0x8966('0xf')][_0x2b4814],['contactId',_0x8966('0x73'),_0x8966('0x74'),'ListId'])));return ami[_0x8966('0x75')]({'action':_0x8966('0x76'),'channel':_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x77')]})[_0x8966('0x78')](function(_0x2ab0df){if(_0x2ab0df[_0x8966('0x48')]===_0x8966('0x79')){setTimeout(function(){if(_0x44afb2[_0x8966('0xf')][_0x2b4814]){ut[_0x8966('0x7a')](_0x44afb2[_0x8966('0xd')][_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x6e')]],_0x8966('0x7b'));if(_0x44afb2[_0x8966('0xf')][_0x2b4814]['dialAnswer']===!![]){ut[_0x8966('0x7c')](_0x44afb2[_0x8966('0xd')][_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x6e')]],'[clearZombieChannel]');ut[_0x8966('0x7d')](_0x8966('0x7e')+_0x2b4814,_0x44afb2['actions'][_0x2b4814][_0x8966('0x6e')]);}ut[_0x8966('0x7d')](_0x8966('0x7f')+_0x2b4814,_0x44afb2[_0x8966('0xf')][_0x2b4814][_0x8966('0x6e')]);delete _0x44afb2[_0x8966('0xf')][_0x2b4814];}},0x2328);}});}});};Preview['prototype'][_0x8966('0x80')]=function(){var _0x7b6751=this;loggerAction[_0x8966('0x58')](_0x8966('0x81'),_[_0x8966('0x82')](this[_0x8966('0xf')]));for(var _0x162261 in this[_0x8966('0xf')]){if(_0x7b6751['actions'][_0x8966('0x64')](_0x162261)){_0x7b6751['clearZombieChannel'](_0x162261);}}};Preview[_0x8966('0x62')][_0x8966('0x69')]=function(_0x17f19c){var _0x563e56=this;rpcDb[_0x8966('0x83')](_0x17f19c['id'],ut[_0x8966('0x84')](this['agents']))['then'](function(_0x4446d6){if(!_[_0x8966('0x6b')](_0x4446d6)){for(var _0x59bd5c=0x0;_0x59bd5c<_0x4446d6[_0x8966('0x85')];_0x59bd5c+=0x1){if(ut[_0x8966('0x86')](_0x4446d6[_0x59bd5c][_0x8966('0x87')])<_0x17f19c[_0x8966('0x88')]*0x3c){if(_0x4446d6[_0x59bd5c]['Agent']&&!_0x4446d6[_0x59bd5c][_0x8966('0x89')][_0x8966('0x8a')]){_0x563e56[_0x8966('0x8b')](_0x4446d6[_0x59bd5c]['id'])['then'](ut[_0x8966('0x8c')](_0x8966('0x8d')))[_0x8966('0x78')](ut[_0x8966('0x8c')](_0x8966('0x8d')));}else{rpcDb[_0x8966('0x8e')](_0x4446d6[_0x59bd5c]['id']);}}else{var _0x30f4f1=new Action(_0x4446d6[_0x59bd5c],_0x17f19c);_0x30f4f1[_0x8966('0x8f')]=moment()['format'](_0x8966('0x90'));_0x17f19c[_0x8966('0x39')]+=0x1;ut[_0x8966('0x91')](_0x30f4f1,0x17,_0x8966('0x92'));if(_0x17f19c[_0x8966('0x93')]){rpcDb[_0x8966('0x94')](ut[_0x8966('0x95')](_0x4446d6[_0x59bd5c]));rpcDb[_0x8966('0x96')](_0x30f4f1,_0x8966('0x97'));}else{ut[_0x8966('0x91')](_0x30f4f1,0x16,'RecallFailedTimeout');rpcDb[_0x8966('0x96')](_0x30f4f1,_0x8966('0x98'));rpcDb['createCustomerFinal'](_0x30f4f1,_0x8966('0x98'));}}}}})[_0x8966('0x78')](ut[_0x8966('0x8c')](_0x8966('0x99')));};Preview[_0x8966('0x62')][_0x8966('0x68')]=function(_0x1bdb86){_0x1bdb86[_0x8966('0x5c')]=!![];if(ut[_0x8966('0x9a')](_0x1bdb86[_0x8966('0x9b')])){_0x1bdb86[_0x8966('0x48')]=_0x8966('0x9c');}else if(!ut[_0x8966('0x9d')](_0x1bdb86[_0x8966('0x2d')])){_0x1bdb86['message']=_0x8966('0x5d');}else if(!this[_0x8966('0x9e')](_0x1bdb86[_0x8966('0x50')])){if(!this['isTrunkReachable'](_0x1bdb86['TrunkBackup'])){_0x1bdb86[_0x8966('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1bdb86[_0x8966('0x48')]=_0x8966('0x9f');}}else{_0x1bdb86[_0x8966('0x48')]=_0x8966('0x9f');}emitCampaignPreview(_0x1bdb86);};Preview['prototype'][_0x8966('0xa0')]=function(_0x1d21f7,_0x1158e9,_0x32f303){var _0x5ae460=this;var _0x4c6ed2=this['actions'][_0x1158e9];var _0x403b6a=this['campaignsPreview'][_0x4c6ed2['queue']];var _0x5253a3;var _0x1f3fda=![];var _0x2a17ee=0x2;var _0x31b270=0x3;if(_0x403b6a){switch(_0x32f303){case'1':_0x403b6a[_0x8966('0xa1')]+=0x1;_0x4c6ed2['countnosuchnumberretry']+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut[_0x8966('0xa3')](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x0,_0x8966('0xa4'));ami[_0x8966('0x21')](_0x8966('0xa5'),ut[_0x8966('0xa6')](_0x4c6ed2,_0x8966('0xa7')));rpcDb[_0x8966('0x96')](_0x4c6ed2,'[callProgressDetectingCustomer][logNoSuch]');_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'0',_0x403b6a)[_0x8966('0xa9')](function(_0x488c28){_0x1f3fda=_0x488c28[_0x8966('0xaa')]==0x1;_0x2a17ee=_0x403b6a['dialNoSuchNumberRetryFrequency'];_0x31b270=_0x403b6a['callAdditionalPhoneAfterMin'];if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4c6ed2[_0x8966('0xaf')]>=_0x403b6a[_0x8966('0xb0')]){rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xb1'));}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,_0x8966('0xaf'),_0x403b6a['dialNoSuchNumberRetryFrequency']),_0x4c6ed2['unlockAgent'],_0x4c6ed2[_0x8966('0xb4')]);}}delete this['actions'][_0x1d21f7[_0x8966('0xb5')]];}else{_0x4c6ed2[_0x8966('0xaf')]++;logger[_0x8966('0x58')](_0x8966('0xb6'),_0x4c6ed2[_0x8966('0xaf')]);logger[_0x8966('0x58')]('id',_0x4c6ed2[_0x8966('0xb7')]);_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2[_0x8966('0xb7')],'field':{'countnosuchnumberretry':_0x4c6ed2[_0x8966('0xaf')]}})[_0x8966('0xa9')](function(){_0x5ae460[_0x8966('0xb9')](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});break;case'ANSWER':var _0xe6d84e=moment()[_0x8966('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c6ed2[_0x8966('0xba')]=_0xe6d84e;_0x4c6ed2[_0x8966('0xbb')]=_0xe6d84e;_0x4c6ed2[_0x8966('0x71')]=!![];_0x403b6a[_0x8966('0x26')]+=0x1;logger[_0x8966('0x58')](_0x8966('0xbc'),_0x4c6ed2['uniqueid'],_0x8966('0xbd'),_0x403b6a[_0x8966('0x23')],_0x8966('0x70'),_0x403b6a[_0x8966('0x26')]);ami[_0x8966('0x21')](_0x8966('0xbe'),ut[_0x8966('0xa6')](_0x4c6ed2,'connect',this[_0x8966('0xd')][_0x4c6ed2[_0x8966('0x6e')]]));if(_0x403b6a[_0x8966('0xbf')]){ami['emit'](_0x8966('0xc0'),ut[_0x8966('0xc1')](_0x4c6ed2));}break;case'16':ami[_0x8966('0x21')](_0x8966('0xc2'),ut['buildObj'](_0x4c6ed2,_0x8966('0xc3'),this[_0x8966('0xd')][_0x4c6ed2[_0x8966('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x8966('0xa6')](_0x4c6ed2,_0x8966('0xc3')));_0x403b6a[_0x8966('0xc4')]+=0x1;_0x403b6a['total']+=0x1;_0x403b6a['answered']+=0x1;ut['decrementTalkink'](_0x403b6a,_0x8966('0xc5'));_0x4c6ed2[_0x8966('0xa2')]=ut[_0x8966('0xa3')](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x4,_0x8966('0xc6'));rpcDb[_0x8966('0x96')](_0x4c6ed2,_0x8966('0xc7'));rpcDb[_0x8966('0xae')](_0x4c6ed2,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8966('0xc8')](_0x4c6ed2);_0x403b6a[_0x8966('0xc9')]+=_0x4c6ed2[_0x8966('0xca')];_0x403b6a['sumBillable']+=_0x4c6ed2[_0x8966('0xca')];logger[_0x8966('0x58')](_0x8966('0xcb'),_0x4c6ed2['uniqueid'],'\x20Queue',_0x403b6a[_0x8966('0x23')],'pTalking:\x20',_0x403b6a[_0x8966('0x26')]);delete this[_0x8966('0xf')][_0x1d21f7[_0x8966('0xb5')]];break;case _0x8966('0xcc'):_0x403b6a[_0x8966('0x33')]+=0x1;_0x4c6ed2[_0x8966('0xcd')]+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut['totalGlobal'](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x5,_0x8966('0xce'));_0x2a17ee=_0x403b6a['dialBusyRetryFrequency'];_0x31b270=_0x403b6a['callAdditionalPhoneAfterMin'];ami['emit'](_0x8966('0xcf'),ut['buildObj'](_0x4c6ed2,_0x8966('0xd0')));rpcDb[_0x8966('0x96')](_0x4c6ed2,_0x8966('0xd1'));_0x5ae460['verifyAdditionalPhones'](_0x4c6ed2,'5',_0x403b6a)[_0x8966('0xa9')](function(_0x5c8fdf){_0x1f3fda=_0x5c8fdf[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,_0x8966('0xd2'));}else{if(_0x4c6ed2['countbusyretry']>=_0x403b6a[_0x8966('0xd3')]){rpcDb['createCustomerFinal'](_0x4c6ed2,_0x8966('0xd1'));}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,'countbusyretry',_0x403b6a['dialBusyRetryFrequency']),_0x4c6ed2[_0x8966('0xd4')],_0x4c6ed2['activeContact']);}}}else{_0x4c6ed2['countbusyretry']++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2['idContact'],'field':{'countbusyretry':_0x4c6ed2[_0x8966('0xcd')]}})[_0x8966('0xa9')](function(){_0x5ae460['swapAdditionalPhones'](_0x4c6ed2,_0x2a17ee,_0x31b270)['then'](function(){});});}});break;case'NOANSWER':_0x403b6a[_0x8966('0x37')]+=0x1;_0x4c6ed2[_0x8966('0xd5')]+=0x1;_0x4c6ed2['countglobal']=ut[_0x8966('0xa3')](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x3,_0x8966('0xd6'));_0x2a17ee=_0x403b6a[_0x8966('0xd7')];_0x31b270=_0x403b6a[_0x8966('0xd8')];var _0x369b79=ut[_0x8966('0xd9')](_0x4c6ed2,_0x403b6a);ami[_0x8966('0x21')](_0x8966('0xda'),_0x369b79);rpcDb['createCustomerHistory'](_0x4c6ed2,_0x8966('0xdb'));_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'3',_0x403b6a)[_0x8966('0xa9')](function(_0x356f80){_0x1f3fda=_0x356f80[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a['dialGlobalMaxRetry']){_0x5253a3=ut['cloneAction'](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb['createCustomerFinal'](_0x5253a3,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4c6ed2[_0x8966('0xd5')]>=_0x403b6a[_0x8966('0xdc')]){rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xdb'));}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,_0x8966('0xd5'),_0x403b6a[_0x8966('0xd7')]),_0x4c6ed2['unlockAgent'],_0x4c6ed2[_0x8966('0xb4')]);}}}else{_0x4c6ed2[_0x8966('0xd5')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2['idContact'],'field':{'countnoanswerretry':_0x4c6ed2[_0x8966('0xd5')]}})[_0x8966('0xa9')](function(){_0x5ae460[_0x8966('0xb9')](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});break;case _0x8966('0xdd'):_0x403b6a[_0x8966('0x34')]+=0x1;_0x4c6ed2[_0x8966('0xde')]+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut['totalGlobal'](_0x4c6ed2);ut['logCustomer'](_0x4c6ed2,0x8,_0x8966('0xdf'));_0x2a17ee=_0x403b6a[_0x8966('0xe0')];_0x31b270=_0x403b6a[_0x8966('0xd8')];ami[_0x8966('0x21')](_0x8966('0xe1'),ut['buildObj'](_0x4c6ed2,_0x8966('0xe2')));rpcDb['createCustomerHistory'](_0x4c6ed2,_0x8966('0xe3'));_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'8',_0x403b6a)[_0x8966('0xa9')](function(_0x202b46){_0x1f3fda=_0x202b46[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,_0x8966('0xe4'));}else{if(_0x4c6ed2[_0x8966('0xde')]>=_0x403b6a[_0x8966('0xe5')]){rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xe3'));}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,_0x8966('0xde'),_0x403b6a[_0x8966('0xe6')]),_0x4c6ed2['unlockAgent'],_0x4c6ed2[_0x8966('0xb4')]);}}}else{_0x4c6ed2[_0x8966('0xde')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2[_0x8966('0xb7')],'field':{'countcongestionretry':_0x4c6ed2[_0x8966('0xde')]}})[_0x8966('0xa9')](function(){_0x5ae460['swapAdditionalPhones'](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});break;case _0x8966('0xe7'):_0x403b6a[_0x8966('0x3a')]+=0x1;_0x4c6ed2[_0x8966('0xe8')]+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut[_0x8966('0xa3')](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x14,_0x8966('0xe9'));_0x2a17ee=_0x403b6a[_0x8966('0xea')];_0x31b270=_0x403b6a[_0x8966('0xd8')];ami[_0x8966('0x21')](_0x8966('0xeb'),ut[_0x8966('0xa6')](_0x4c6ed2,_0x8966('0xec')));rpcDb['createCustomerHistory'](_0x4c6ed2,_0x8966('0xed'));_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'20',_0x403b6a)['then'](function(_0x235c41){_0x1f3fda=_0x235c41[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a['dialGlobalMaxRetry']){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0x14,_0x8966('0xe9'));rpcDb[_0x8966('0xae')](_0x5253a3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4c6ed2['countagentrejectretry']>=_0x403b6a[_0x8966('0xee')]){rpcDb[_0x8966('0xae')](_0x4c6ed2,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,_0x8966('0xe8'),_0x403b6a[_0x8966('0xea')]),_0x4c6ed2[_0x8966('0xd4')],_0x4c6ed2[_0x8966('0xb4')]);}}}else{_0x4c6ed2[_0x8966('0xd5')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2[_0x8966('0xb7')],'field':{'countnoanswerretry':_0x4c6ed2['countnoanswerretry']}})[_0x8966('0xa9')](function(){_0x5ae460[_0x8966('0xb9')](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});break;case _0x8966('0xef'):_0x403b6a[_0x8966('0x3c')]+=0x1;_0x4c6ed2['countabandonedretry']+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut['totalGlobal'](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x4c6ed2,'[callProgressDetectingCustomer][logAbandoned]');_0x5ae460['verifyAdditionalPhones'](_0x4c6ed2,'11',_0x403b6a)[_0x8966('0xa9')](function(_0x58a9f9){_0x1f3fda=_0x58a9f9['additional']==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a['dialGlobalMaxRetry']){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4c6ed2[_0x8966('0xf0')]>=_0x403b6a['dialAbandonedMaxRety']){rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xf1'));}else{rpcDb[_0x8966('0xb2')](ut[_0x8966('0xb3')](_0x4c6ed2,_0x8966('0xf2'),_0x403b6a[_0x8966('0xf3')]),_0x4c6ed2[_0x8966('0xd4')],_0x4c6ed2[_0x8966('0xb4')]);}}}else{_0x4c6ed2[_0x8966('0xd5')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2[_0x8966('0xb7')],'field':{'countnoanswerretry':_0x4c6ed2[_0x8966('0xd5')]}})[_0x8966('0xa9')](function(){_0x5ae460[_0x8966('0xb9')](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});break;case'18':_0x403b6a[_0x8966('0x3b')]+=0x1;_0x4c6ed2[_0x8966('0xf4')]+=0x1;_0x4c6ed2['countglobal']=ut['totalGlobal'](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x12,_0x1d21f7[_0x8966('0xf5')]||_0x1d21f7[_0x8966('0xf6')]);ami[_0x8966('0x21')](_0x8966('0xf7'),ut[_0x8966('0xa6')](_0x4c6ed2,'amd'));rpcDb['createCustomerHistory'](_0x4c6ed2,'[callProgressDetectingCustomer][hangupInAMD]');_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'18',_0x403b6a)['then'](function(_0xaa989a){_0x1f3fda=_0xaa989a[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut[_0x8966('0xac')](_0x4c6ed2,0x12,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,_0x8966('0xf8'));}else{rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xf8'));}}else{_0x4c6ed2[_0x8966('0xd5')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2['idContact'],'field':{'countnoanswerretry':_0x4c6ed2[_0x8966('0xd5')]}})[_0x8966('0xa9')](function(){_0x5ae460['swapAdditionalPhones'](_0x4c6ed2,_0x2a17ee,_0x31b270)['then'](function(){});});}});delete this[_0x8966('0xf')][_0x1d21f7['linkedid']];break;case'19':_0x403b6a['outboundUnknownCallsDay']+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut['totalGlobal'](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0x13,_0x1d21f7[_0x8966('0xf5')]||_0x1d21f7[_0x8966('0xf6')]);ami['emit']('custom:amd',ut[_0x8966('0xa6')](_0x4c6ed2,_0x8966('0xf9')));rpcDb[_0x8966('0x96')](_0x4c6ed2,_0x8966('0xfa'));_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'18',_0x403b6a)[_0x8966('0xa9')](function(_0x4fc0fa){_0x1f3fda=_0x4fc0fa[_0x8966('0xaa')]==0x1;if(!_0x1f3fda){if(ut[_0x8966('0xa3')](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut['cloneAction'](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xfa'));}}else{_0x4c6ed2[_0x8966('0xd5')]++;_0x5ae460[_0x8966('0xb8')]({'id':_0x4c6ed2[_0x8966('0xb7')],'field':{'countnoanswerretry':_0x4c6ed2[_0x8966('0xd5')]}})['then'](function(){_0x5ae460[_0x8966('0xb9')](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});});}});delete this[_0x8966('0xf')][_0x1d21f7[_0x8966('0xb5')]];break;default:if(_0x4c6ed2[_0x8966('0x71')]){ut[_0x8966('0x7c')](_0x403b6a,_0x8966('0xfb'));ut[_0x8966('0x7d')](_0x8966('0xfc')+_0x403b6a[_0x8966('0x23')],_0x1d21f7);}_0x403b6a['outboundUnknownCallsDay']+=0x1;_0x4c6ed2[_0x8966('0xa2')]=ut[_0x8966('0xa3')](_0x4c6ed2);ut[_0x8966('0x91')](_0x4c6ed2,0xc,_0x1d21f7['cause-txt']||_0x1d21f7['dialstatus']);_0x2a17ee=_0x403b6a['dialAgentRejectRetryFrequency'];_0x31b270=_0x403b6a[_0x8966('0xd8')];rpcDb['createCustomerHistory'](_0x4c6ed2,_0x8966('0xfd'));_0x5ae460[_0x8966('0xa8')](_0x4c6ed2,'20',_0x403b6a)['then'](function(_0x22c960){_0x1f3fda=_0x22c960['additional']==0x1;if(!_0x1f3fda){if(ut['totalGlobal'](_0x4c6ed2)>=_0x403b6a[_0x8966('0xab')]){_0x5253a3=ut['cloneAction'](_0x4c6ed2,0xf,_0x8966('0xad'));rpcDb[_0x8966('0xae')](_0x5253a3,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x8966('0xae')](_0x4c6ed2,_0x8966('0xfe'));}delete this[_0x8966('0xf')][_0x1d21f7[_0x8966('0xb5')]];}else{_0x5ae460['swapAdditionalPhones'](_0x4c6ed2,_0x2a17ee,_0x31b270)[_0x8966('0xa9')](function(){});}});}if(!(_0x4c6ed2[_0x8966('0x71')]&&_0x32f303==='16')){ut['updateOriginated'](_0x403b6a,'[callProgressDetectingCustomer]');logger[_0x8966('0x58')](_0x8966('0xff'),_0x4c6ed2[_0x8966('0x100')],_0x8966('0xbd'),_0x403b6a[_0x8966('0x23')],_0x8966('0x101'),_0x403b6a[_0x8966('0x49')]);}if(_0x32f303!==_0x8966('0x102')){delete this['actions'][_0x1d21f7[_0x8966('0xb5')]];delete this['actions'][_0x1d21f7[_0x8966('0x103')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x1d79fb,_0x2834a0,_0x531478){if(_[_0x8966('0x104')](_0x2834a0)&&'object'!==typeof _0x2834a0){return;}if(_[_0x8966('0x104')](_0x531478)&&_0x8966('0x105')!==typeof _0x531478){return;}switch(_0x531478[_0x8966('0x106')]){case'0':ut[_0x8966('0x107')](_0x1d79fb,0x0,_0x8966('0xa4'));rpcDb[_0x8966('0x108')](_0x1d79fb,_0x8966('0x109'));break;case'3':ut[_0x8966('0x107')](_0x1d79fb,0x3,_0x8966('0xd6'));rpcDb[_0x8966('0x108')](_0x1d79fb,_0x8966('0x10a'));break;case'5':ut[_0x8966('0x107')](_0x1d79fb,0x5,'Busy');rpcDb[_0x8966('0x108')](_0x1d79fb,_0x8966('0x10b'));break;case'8':ut[_0x8966('0x107')](_0x1d79fb,0x8,_0x8966('0xdf'));rpcDb[_0x8966('0x108')](_0x1d79fb,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8966('0x107')](_0x1d79fb,0x16,_0x8966('0x10c'));rpcDb[_0x8966('0x108')](_0x1d79fb,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x1d79fb,0xc,_0x531478[_0x8966('0x106')]);rpcDb[_0x8966('0x108')](_0x1d79fb,_0x8966('0x10d'));}ut[_0x8966('0x7a')](_0x2834a0,'[callProgressDetectingAgent]');logger[_0x8966('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x1d79fb[_0x8966('0x100')],_0x8966('0xbd'),_0x2834a0[_0x8966('0x23')],'originated:\x20',_0x2834a0[_0x8966('0x49')]);delete this[_0x8966('0xf')][_0x1d79fb[_0x8966('0x100')]];};Preview[_0x8966('0x62')]['verifyAdditionalPhones']=function(_0x317736,_0x23b59c,_0x486851){return Promise['resolve']()[_0x8966('0xa9')](cmHopperAdditionalPhone[_0x8966('0xa8')](_0x317736,_0x23b59c,_0x486851))[_0x8966('0x78')](logger['info'](_0x8966('0x10e')));};Preview[_0x8966('0x62')][_0x8966('0xb9')]=function(_0x2f4f1c,_0x20cb49,_0x46f33e){return Promise['resolve']()[_0x8966('0xa9')](cmHopperAdditionalPhone[_0x8966('0xb9')](_0x2f4f1c,_0x20cb49,_0x46f33e))[_0x8966('0x78')](logger[_0x8966('0x58')](_0x8966('0x10f')));};Preview[_0x8966('0x62')][_0x8966('0xb8')]=function(_0x17aabb){return Promise[_0x8966('0x110')]()[_0x8966('0xa9')](cmHopperAdditionalPhone[_0x8966('0xb8')](_0x17aabb))[_0x8966('0x78')](logger['info'](_0x8966('0x111')));};Preview['prototype'][_0x8966('0x112')]=function(_0x32a121,_0xaa3c75,_0x24a912,_0x18dc98,_0x15f076){var _0x1043f0=this;return new Promise(function(_0x1b0cb7,_0x2239f7){if(_[_0x8966('0x6b')](_0xaa3c75)||_['isNil'](_0xaa3c75['Contact'])||_[_0x8966('0x6b')](_0xaa3c75[_0x8966('0x113')])||_['isNil'](_0xaa3c75[_0x8966('0x74')])){_0x2239f7(ut[_0x8966('0x48')](_0x8966('0x114'),_0x18dc98,_0x15f076));return;}var _0x59e64e=uuid['v4']();var _0x55da9b=_0x1043f0['campaignsPreview'][_0xaa3c75[_0x8966('0x6d')][_0x8966('0x23')]];var _0x402c7e=_0x24a912?_0x1043f0[_0x8966('0x10')][_0x24a912]['id']:undefined;_0x1043f0[_0x8966('0xf')][_0x59e64e]=new Action(_0xaa3c75,_0x55da9b,_0x59e64e,_0x24a912,_0x402c7e);var _0x430a3a=_0x1043f0[_0x8966('0xf')][_0x59e64e];_0x430a3a[_0x8966('0xd4')]=_0x18dc98;_0x430a3a[_0x8966('0xb4')]=_0x15f076;_0x430a3a[_0x8966('0x115')]=_0x24a912;if(_[_0x8966('0x116')](_0x32a121)){_0x1043f0['execCall'](_0x430a3a,_0x55da9b,_0xaa3c75,_0x24a912)[_0x8966('0xa9')](function(_0x16d8cd){logger['info'](_0x8966('0x117'),'Queue:\x20'+_0x430a3a['queue']+_0x8966('0x118')+_0x430a3a[_0x8966('0xb7')],JSON[_0x8966('0x6f')](_0x16d8cd));ami[_0x8966('0x21')](_0x8966('0x119'),ut['buildObj'](_0x430a3a,_0x8966('0x11a'),_0x1043f0['campaignsPreview'][_0x430a3a[_0x8966('0x6e')]]));_0x1b0cb7(ut[_0x8966('0x48')]('Calling'));})['catch'](function(_0x29abfc){ut[_0x8966('0x5e')](_0x8966('0x11b'),_0x29abfc);_0x2239f7(ut[_0x8966('0x48')]('Call\x20failed',_0x18dc98,_0x15f076));});}else{_0x55da9b[_0x8966('0x32')]+=0x1;ut['logBlacklist'](_0x430a3a);rpcDb[_0x8966('0x11c')](_0x430a3a,_0x8966('0x11d'));delete _0x1043f0[_0x8966('0xf')][_0x59e64e];_0x2239f7(ut[_0x8966('0x48')]('Contact\x20in\x20black\x20List',_0x18dc98,_0x15f076));}});};Preview[_0x8966('0x62')]['isTrunkReachable']=function(_0x5ece7f){return!_[_0x8966('0x6b')](_0x5ece7f)&&!_[_0x8966('0x6b')](_0x5ece7f[_0x8966('0x23')])&&!_[_0x8966('0x6b')](_0x5ece7f[_0x8966('0x51')])&&_0x5ece7f[_0x8966('0x51')]&&!_[_0x8966('0x6b')](this[_0x8966('0xe')][util[_0x8966('0x55')](_0x8966('0x11e'),_0x5ece7f[_0x8966('0x23')])])&&!_[_0x8966('0x6b')](this[_0x8966('0xe')][util[_0x8966('0x55')](_0x8966('0x11e'),_0x5ece7f['name'])][_0x8966('0x76')])&&(this[_0x8966('0xe')][util[_0x8966('0x55')]('SIP/%s',_0x5ece7f[_0x8966('0x23')])][_0x8966('0x76')]==='reachable'||this[_0x8966('0xe')][util['format'](_0x8966('0x11e'),_0x5ece7f[_0x8966('0x23')])][_0x8966('0x76')]===_0x8966('0x11f'));};Preview['prototype'][_0x8966('0x8b')]=function(_0x1493a5,_0x229374){var _0x4c0e1e=this;return new Promise(function(_0x1861b9,_0x2f7d24){_0x4c0e1e['execRun'](_0x1493a5,_0x229374)['then'](function(_0x3fad3d){_0x1861b9(_[_0x8966('0x72')](_0x3fad3d,[_0x8966('0x48')]));})[_0x8966('0x78')](function(_0x551165){if(_0x551165['unlock']){rpcDb['unlockContact'](_0x1493a5);}if(_0x551165['active']){rpcDb[_0x8966('0x8e')](_0x1493a5);}_0x2f7d24(_[_0x8966('0x72')](_0x551165,[_0x8966('0x48')]));});});};Preview['prototype'][_0x8966('0x120')]=function(_0x1a5638,_0x589f8f){var _0x25cfe0=this;return new Promise(function(_0x2b31d1,_0x3bd612){var _0x4b5a1a,_0x318d25;rpcDb['getContactPreview'](_0x1a5638)[_0x8966('0xa9')](function(_0x147ccb){if(!_[_0x8966('0x6b')](_0x147ccb[0x0])){_0x318d25=_0x147ccb[0x0]['recallme']?![]:!![];_0x4b5a1a=_0x147ccb[0x0][_0x8966('0x121')]?!![]:![];_0x4b5a1a=_0x589f8f?!![]:_0x4b5a1a;}var _0x4a9271=_0x25cfe0[_0x8966('0x122')](_0x147ccb);if(_0x4a9271[_0x8966('0x123')]){rpcDb[_0x8966('0x124')](_['pick'](_0x147ccb[0x0],['VoiceQueueId',_0x8966('0x113')]))[_0x8966('0xa9')](function(_0x23f509){_0x25cfe0[_0x8966('0x112')](_0x23f509,_0x147ccb[0x0],_0x589f8f,_0x318d25,_0x4b5a1a)[_0x8966('0xa9')](function(_0x4a417d){_0x2b31d1(_0x4a417d);})[_0x8966('0x78')](function(_0x5adeb8){_0x3bd612(_0x5adeb8);});})[_0x8966('0x78')](function(_0x449582){ut[_0x8966('0x5e')]('[Preview][checkIsBlackList]',_0x449582);_0x3bd612(ut[_0x8966('0x48')](_0x8966('0x125'),_0x318d25,_0x4b5a1a));});}else{_0x3bd612(ut['message'](_0x4a9271[_0x8966('0x48')],_0x318d25,_0x4b5a1a));}})[_0x8966('0x78')](function(_0x3ddaef){ut[_0x8966('0x5e')](_0x8966('0x126'),_0x3ddaef);_0x3bd612(ut[_0x8966('0x48')](_0x8966('0x125'),![],!![]));});});};Preview['prototype'][_0x8966('0x122')]=function(_0x292042){if(_[_0x8966('0x6b')](_0x292042)||_[_0x8966('0x116')](_0x292042)||!_['isNil'](_0x292042[0x0][_0x8966('0x89')])&&_[_0x8966('0x6b')](_0x292042[0x0][_0x8966('0x89')][_0x8966('0x23')])){ut[_0x8966('0x5e')](_0x8966('0x127'),_0x292042);return{'isValid':![],'message':_0x8966('0x128')};}var _0x4cce84=this[_0x8966('0xd')][_0x292042[0x0][_0x8966('0x6d')][_0x8966('0x23')]];_0x4cce84[_0x8966('0x48')]=_0x8966('0x9f');if(_[_0x8966('0x6b')](_0x4cce84)){ut[_0x8966('0x5e')](_0x8966('0x129'),_0x4cce84);return{'isValid':![],'message':_0x8966('0x12a')};}if(!this[_0x8966('0x9e')](_0x4cce84[_0x8966('0x50')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x8966('0x12b')+_0x4cce84[_0x8966('0x23')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x8966('0x9e')](_0x4cce84[_0x8966('0x12c')])){ut[_0x8966('0x5e')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4cce84['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x4cce84[_0x8966('0x2d')])){ut[_0x8966('0x5e')](_0x8966('0x12d'),_0x4cce84[_0x8966('0x23')]+_0x8966('0x12e'));return{'isValid':![],'message':_0x8966('0x12b')+_0x4cce84[_0x8966('0x23')]+_0x8966('0x12e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x8966('0x62')][_0x8966('0x12f')]=function(_0x32565c,_0x38272f,_0x1cec4a,_0x2e2eaa){var _0x12742b=this;return new Promise(function(_0x22b48a,_0x38d3f4){var _0x1af13c=_0x32565c[_0x8966('0x100')];var _0x14787f=_0x12742b[_0x8966('0x9e')](_0x38272f[_0x8966('0x50')])?util[_0x8966('0x55')]('SIP/%s/%s%s',_0x38272f[_0x8966('0x50')][_0x8966('0x23')],_[_0x8966('0x6b')](_0x38272f[_0x8966('0x130')])?'':_0x38272f[_0x8966('0x130')]['trim']()||'',_0x38272f[_0x8966('0x131')]>0x0?_0x1cec4a[_0x8966('0x113')]['substring'](_0x38272f[_0x8966('0x131')]):_0x1cec4a['phone']):util[_0x8966('0x55')](_0x8966('0x132'),_['isNil'](_0x38272f['TrunkBackup'])?_0x38272f[_0x8966('0x50')][_0x8966('0x23')]:_0x38272f[_0x8966('0x12c')][_0x8966('0x23')],_[_0x8966('0x6b')](_0x38272f['dialPrefix'])?'':_0x38272f[_0x8966('0x130')][_0x8966('0x133')]()||'',_0x38272f[_0x8966('0x131')]>0x0?_0x1cec4a[_0x8966('0x113')][_0x8966('0x134')](_0x38272f[_0x8966('0x131')]):_0x1cec4a[_0x8966('0x113')]);var _0x3870d3=_0x12742b[_0x8966('0x9e')](_0x38272f[_0x8966('0x50')])?ut[_0x8966('0x135')](_0x38272f[_0x8966('0x50')]['callerid'],_0x38272f[_0x8966('0x2f')],_0x38272f[_0x8966('0x136')]>0x0?ut[_0x8966('0x137')](_0x38272f[_0x8966('0x138')],_0x38272f[_0x8966('0x136')]):_0x38272f[_0x8966('0x138')]):ut[_0x8966('0x135')](_[_0x8966('0x6b')](_0x38272f[_0x8966('0x12c')])?_0x38272f[_0x8966('0x50')][_0x8966('0x52')]:_0x38272f[_0x8966('0x12c')][_0x8966('0x52')],_0x38272f['dialOriginateCallerIdName'],_0x38272f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x38272f[_0x8966('0x138')],_0x38272f[_0x8966('0x136')]):_0x38272f[_0x8966('0x138')]);if(_0x3870d3){_0x32565c[_0x8966('0x139')]=ut[_0x8966('0x13a')](_0x3870d3);_0x32565c[_0x8966('0x13b')]=ut[_0x8966('0x13c')](_0x3870d3);}var _0x2e4e05=ut[_0x8966('0x13d')](_0x38272f,_0x1cec4a,_0x14787f,_0x3870d3,_0x1af13c,_0x32565c);_[_0x8966('0x13e')](_0x32565c,ut[_0x8966('0x13f')](_0x2e4e05));_0x32565c[_0x8966('0x8f')]=moment()[_0x8966('0x55')](_0x8966('0x90'));_0x38272f[_0x8966('0x140')]=_0x2e4e05;ami[_0x8966('0x75')](ut[_0x8966('0x141')](_0x32565c,_0x38272f,_0x2e4e05,_0x32565c[_0x8966('0xb4')],_0x2e2eaa))[_0x8966('0xa9')](function(_0xa11e0){_0x38272f['originated']+=0x1;logger[_0x8966('0x58')](_0x8966('0x142'),_0x1af13c,_0x8966('0xbd'),_0x38272f[_0x8966('0x23')],'originated:\x20',_0x38272f[_0x8966('0x49')]);_0x22b48a(_0xa11e0);})[_0x8966('0x78')](function(_0x18ba09){ut[_0x8966('0x107')](_0x32565c,0xe,_0x8966('0x143'));rpcDb[_0x8966('0x108')](_0x32565c,_0x8966('0x144'));_0x38d3f4(_0x18ba09);});});};Preview[_0x8966('0x62')][_0x8966('0x1c')]=function(_0x36b984){if(this[_0x8966('0xf')][_0x36b984[_0x8966('0xb5')]]){this[_0x8966('0xf')][_0x36b984['linkedid']][_0x8966('0x77')]=_0x36b984['channel'];}};Preview[_0x8966('0x62')][_0x8966('0x13')]=function(_0x4f17cd){var _0x58ae03=this;var _0x402998=this[_0x8966('0xf')][_0x4f17cd[_0x8966('0x145')]];if(_0x402998){if(_0x402998[_0x8966('0x115')]&&this[_0x8966('0x10')][_0x402998[_0x8966('0x115')]]){ut['logLookAgent'](_0x402998,this['agents'][_0x402998[_0x8966('0x115')]][_0x8966('0x23')],this[_0x8966('0x10')][_0x402998['lookAgent']]['id']);}var _0x5ecd3e=_['clone'](_0x402998);_0x5ecd3e['responsetime']=moment()[_0x8966('0x55')](_0x8966('0x90'));var _0x31f385=_0x58ae03[_0x8966('0xd')][_0x402998[_0x8966('0x6e')]];if(ut['isFailure'](_0x4f17cd[_0x8966('0x146')])){if(_0x402998[_0x8966('0xd4')]){rpcDb[_0x8966('0x147')](_0x402998[_0x8966('0xb7')]);}if(_0x402998[_0x8966('0xb4')]){rpcDb[_0x8966('0x8e')](_0x402998[_0x8966('0xb7')]);}ami['emit'](_0x8966('0x148'),ut[_0x8966('0xa6')](_0x402998,'rejected',this['campaignsPreview'][_0x402998[_0x8966('0x6e')]]));this['callProgressDetectingAgent'](_0x5ecd3e,_0x31f385,_0x4f17cd);}else{_0x402998[_0x8966('0x8f')]=moment()[_0x8966('0x55')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8966('0x107')](_0x5ecd3e,0x4,_0x8966('0xc6'));rpcDb[_0x8966('0x108')](_0x5ecd3e,_0x8966('0x149'));}}};Preview[_0x8966('0x62')][_0x8966('0x15')]=function(_0x499e63){var _0x36cb2c=this[_0x8966('0xf')][_0x499e63['linkedid']];var _0xc76772;if(_0x36cb2c){_0xc76772=this[_0x8966('0xd')][_0x36cb2c[_0x8966('0x6e')]];logger['info']('[syncHangup][talking]',_0x499e63[_0x8966('0xb5')],'\x20Queue',_0xc76772[_0x8966('0x23')],_0x8966('0x70'),_0xc76772[_0x8966('0x26')]);}if(this['actions'][_0x499e63[_0x8966('0xb5')]]&&_0x499e63[_0x8966('0xb5')]!==_0x499e63['uniqueid']){if(_0x499e63[_0x8966('0x14a')]==='16'&&this['actions'][_0x499e63[_0x8966('0xb5')]][_0x8966('0x71')]){this[_0x8966('0xa0')](_0x499e63,_0x499e63['linkedid'],_0x499e63[_0x8966('0x14a')]);}else if(this[_0x8966('0xf')][_0x499e63['linkedid']][_0x8966('0x71')]){logger[_0x8966('0x58')](_0x8966('0x14b'),_0x499e63[_0x8966('0xb5')],_0x499e63[_0x8966('0x14a')],_0x8966('0xbd'),_0xc76772[_0x8966('0x23')],_0x8966('0x70'),_0xc76772[_0x8966('0x26')]);this[_0x8966('0xa0')](_0x499e63,_0x499e63['linkedid'],_0x499e63['cause']);}}else if(_0x36cb2c&&_['isNil'](_0x36cb2c[_0x8966('0x14c')])&&_0xc76772['dialQueueProject']&&_0x499e63[_0x8966('0xb5')]===_0x499e63[_0x8966('0x100')]&&_[_0x8966('0x6b')](_0x499e63[_0x8966('0x106')])&&_0x499e63[_0x8966('0x14a')]==='16'&&_0x499e63[_0x8966('0x14d')]==='6'&&_['isUndefined'](_0x36cb2c[_0x8966('0x14e')])){if(_0x36cb2c[_0x8966('0xd4')]){rpcDb['unlockContact'](_0x36cb2c[_0x8966('0xb7')]);}if(_0x36cb2c[_0x8966('0xb4')]){rpcDb[_0x8966('0x8e')](_0x36cb2c[_0x8966('0xb7')]);}_0x499e63['reason']='22';this['callProgressDetectingAgent'](_0x36cb2c,_0xc76772,_0x499e63);}else if(_0x36cb2c&&_0x36cb2c['transfer']){if(_0x499e63['cause']==='16'&&this[_0x8966('0xf')][_0x499e63['linkedid']][_0x8966('0x71')]){logger[_0x8966('0x58')](_0x8966('0x14f'),_0x499e63[_0x8966('0xb5')],_0x499e63['cause'],_0x8966('0xbd'),_0xc76772['name'],_0x8966('0x70'),_0xc76772[_0x8966('0x26')]);this['callProgressDetectingCustomer'](_0x499e63,_0x499e63['linkedid'],_0x499e63[_0x8966('0x14a')]);}else if(this[_0x8966('0xf')][_0x499e63[_0x8966('0xb5')]]['dialAnswer']){logger['info'](_0x8966('0x14b'),_0x499e63[_0x8966('0xb5')],_0x499e63[_0x8966('0x14a')],_0x8966('0xbd'),_0xc76772[_0x8966('0x23')],_0x8966('0x70'),_0xc76772['pTalking']);this[_0x8966('0xa0')](_0x499e63,_0x499e63['linkedid'],_0x499e63[_0x8966('0x14a')]);}}};Preview[_0x8966('0x62')]['syncDialEnd']=function(_0x5d88ca){if(this['actions'][_0x5d88ca[_0x8966('0x103')]]&&_0x5d88ca[_0x8966('0x103')]!==_0x5d88ca[_0x8966('0x150')]){this[_0x8966('0xa0')](_0x5d88ca,_0x5d88ca[_0x8966('0x103')],_0x5d88ca[_0x8966('0xf6')]);}};Preview[_0x8966('0x62')][_0x8966('0x17')]=function(_0x2fd7d1){if(this[_0x8966('0xf')][_0x2fd7d1[_0x8966('0xb5')]]&&_0x2fd7d1['linkedid']!==_0x2fd7d1[_0x8966('0x100')]&&!this[_0x8966('0xf')][_0x2fd7d1[_0x8966('0xb5')]]['dialAnswer']){if(_0x2fd7d1[_0x8966('0x14a')]==='1'){this[_0x8966('0xa0')](_0x2fd7d1,_0x2fd7d1[_0x8966('0xb5')],_0x2fd7d1[_0x8966('0x14a')]);}}};Preview[_0x8966('0x62')][_0x8966('0x151')]=function(_0x342e71,_0x1f4cae,_0xd26cd3){if(this[_0x8966('0xf')][_0x342e71]){if(_['isNil'](this[_0x8966('0xf')][_0x342e71]['variables'])){this[_0x8966('0xf')][_0x342e71]['variables']={};}this[_0x8966('0xf')][_0x342e71][_0x8966('0x140')][_0x1f4cae]=_0xd26cd3;}};Preview['prototype'][_0x8966('0x152')]=function(_0x21ffb0){try{if(!_['isNil'](_0x21ffb0)){if(ut[_0x8966('0x153')](_[_0x8966('0x154')](_0x21ffb0['variable'])[0x0])){this[_0x8966('0x151')](_0x21ffb0[_0x8966('0x100')],_[_0x8966('0x154')](_0x21ffb0[_0x8966('0x155')])[0x0],_0x21ffb0[_0x8966('0x156')]);}}}catch(_0x3ddc62){logger['error'](_0x8966('0x157'),util[_0x8966('0x158')](_0x3ddc62,{'showHidden':![],'depth':null}));}};Preview[_0x8966('0x62')]['syncAttendedTransfer']=function(_0x435e00){if(_0x435e00){if(this[_0x8966('0xf')][_0x435e00[_0x8966('0x159')]]){this[_0x8966('0xf')][_0x435e00['transfertargetlinkedid']][_0x8966('0x14e')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x43c910){if(_0x43c910){if(this[_0x8966('0xf')][_0x43c910[_0x8966('0x15a')]]){this[_0x8966('0xf')][_0x43c910['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xee63=['[Blacklist][error]','active','SIP/%s','status','execRun','unlock','unlockContact','getContactPreview','validateContact','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','dialCutDigit','SIP/%s/%s%s','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','toLowerVariables','starttime','OriginateError','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','reason','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','outbound','clearZombieChannels','hasOwnProperty','dialActive','dialPreviewAutoRecallMe','recallMe','enqueue','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','catch','dialAnswer','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','info','clearZombieChannel','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed'];(function(_0x3d51ee,_0x4609a8){var _0x416ac6=function(_0x5891ac){while(--_0x5891ac){_0x3d51ee['push'](_0x3d51ee['shift']());}};_0x416ac6(++_0x4609a8);}(_0xee63,0x191));var _0x3ee6=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0xee63[_0x2fc113];return _0x5144ce;};'use strict';var util=require(_0x3ee6('0x0'));var _=require(_0x3ee6('0x1'));var uuid=require('uuid');var moment=require(_0x3ee6('0x2'));var md5=require('md5');var Redis=require(_0x3ee6('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3ee6('0x4'));var loggerAction=require(_0x3ee6('0x5'))(_0x3ee6('0x6'));var ami=require(_0x3ee6('0x7'));var rpcDb=require(_0x3ee6('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x3ee6('0x9'));var ut=require(_0x3ee6('0xa'));config[_0x3ee6('0xb')]=_[_0x3ee6('0xc')](config['redis'],{'host':_0x3ee6('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ee6('0xb')]));var Sequence=function(){};Sequence[_0x3ee6('0xe')]['enqueue']=function(_0x4a5ed9){this[_0x3ee6('0xf')]=this[_0x3ee6('0xf')]?this['tail'][_0x3ee6('0x10')](_0x4a5ed9):_0x4a5ed9();};function Preview(_0xc2b508){this[_0x3ee6('0x11')]=new Sequence();this[_0x3ee6('0x12')]=_0xc2b508[_0x3ee6('0x13')];this[_0x3ee6('0x14')]=_0xc2b508['trunks'];this[_0x3ee6('0x15')]={};this[_0x3ee6('0x16')]=_0xc2b508[_0x3ee6('0x16')];this[_0x3ee6('0x17')]=0x0;ami['on'](_0x3ee6('0x18'),this['syncOriginateResponse'][_0x3ee6('0x19')](this));ami['on']('hangup',this[_0x3ee6('0x1a')][_0x3ee6('0x19')](this));ami['on'](_0x3ee6('0x1b'),this[_0x3ee6('0x1c')][_0x3ee6('0x19')](this));ami['on'](_0x3ee6('0x1d'),this['syncDialEnd']['bind'](this));ami['on'](_0x3ee6('0x1e'),this[_0x3ee6('0x1f')]['bind'](this));ami['on'](_0x3ee6('0x20'),this[_0x3ee6('0x21')][_0x3ee6('0x19')](this));ami['on']('attendedtransfer',this[_0x3ee6('0x22')][_0x3ee6('0x19')](this));ami['on'](_0x3ee6('0x23'),this[_0x3ee6('0x24')]['bind'](this));this[_0x3ee6('0x25')](this[_0x3ee6('0x12')]);}function emit(_0xa2c8ea,_0x569b15,_0x2259b4){io['to'](_0xa2c8ea)[_0x3ee6('0x26')](_0x569b15,_0x2259b4);}function emitCampaignPreview(_0x3c0fe6){if(_0x3c0fe6[_0x3ee6('0x27')]==='outbound'){var _0x54c576={'id':_0x3c0fe6['id'],'name':_0x3c0fe6[_0x3ee6('0x28')],'strategy':_0x3c0fe6['strategy'],'answered':_0x3c0fe6[_0x3ee6('0x29')],'available':_0x3c0fe6[_0x3ee6('0x2a')],'loggedIn':_0x3c0fe6[_0x3ee6('0x2b')],'pTalking':_0x3c0fe6[_0x3ee6('0x2c')],'sumBillable':_0x3c0fe6[_0x3ee6('0x2d')],'sumDuration':_0x3c0fe6[_0x3ee6('0x2e')],'sumHoldTime':_0x3c0fe6[_0x3ee6('0x2f')]||0x0,'talking':_0x3c0fe6[_0x3ee6('0x30')],'total':_0x3c0fe6[_0x3ee6('0x31')],'type':_0x3c0fe6[_0x3ee6('0x27')],'unmanaged':_0x3c0fe6[_0x3ee6('0x32')],'abandoned':_0x3c0fe6[_0x3ee6('0x33')],'waiting':_0x3c0fe6[_0x3ee6('0x34')],'loggedInDb':_0x3c0fe6[_0x3ee6('0x35')],'dialActive':_0x3c0fe6['dialActive'],'dialMethod':_0x3c0fe6['dialMethod'],'dialOriginateCallerIdName':_0x3c0fe6[_0x3ee6('0x36')],'dialOriginateCallerIdNumber':_0x3c0fe6[_0x3ee6('0x37')],'dialOriginateTimeout':_0x3c0fe6[_0x3ee6('0x38')],'dialPrefix':_0x3c0fe6[_0x3ee6('0x39')],'outboundAnswerAgiCallsDay':_0x3c0fe6[_0x3ee6('0x3a')],'outboundAnswerCallsDay':_0x3c0fe6[_0x3ee6('0x3b')],'outboundBlacklistCallsDay':_0x3c0fe6['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3c0fe6[_0x3ee6('0x3c')],'outboundCongestionCallsDay':_0x3c0fe6[_0x3ee6('0x3d')],'outboundDropCallsDayACS':_0x3c0fe6[_0x3ee6('0x3e')],'outboundDropCallsDayCallersExit':_0x3c0fe6[_0x3ee6('0x3f')],'outboundDropCallsDayTimeout':_0x3c0fe6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3c0fe6[_0x3ee6('0x40')],'outboundNoSuchCallsDay':_0x3c0fe6[_0x3ee6('0x41')],'outboundOriginateFailureCallsDay':_0x3c0fe6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3c0fe6[_0x3ee6('0x42')],'outboundRejectCallsDay':_0x3c0fe6['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3c0fe6[_0x3ee6('0x43')],'outboundAbandonedCallsDay':_0x3c0fe6[_0x3ee6('0x44')],'predictiveIntervalAnsweredCalls':_0x3c0fe6[_0x3ee6('0x45')],'predictiveIntervalAvgHoldtime':_0x3c0fe6[_0x3ee6('0x46')],'predictiveIntervalAvgTalktime':_0x3c0fe6[_0x3ee6('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x3c0fe6[_0x3ee6('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x3c0fe6['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3c0fe6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3c0fe6[_0x3ee6('0x49')],'predictiveIntervalHitRate':_0x3c0fe6[_0x3ee6('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x3c0fe6[_0x3ee6('0x4b')],'predictiveIntervalPauses':_0x3c0fe6[_0x3ee6('0x4c')],'predictiveIntervalAvailable':_0x3c0fe6[_0x3ee6('0x4d')],'predictiveIntervalTotalCalls':_0x3c0fe6[_0x3ee6('0x4e')],'message':_0x3c0fe6['message'],'originated':_0x3c0fe6[_0x3ee6('0x4f')],'erlangCalls':_0x3c0fe6[_0x3ee6('0x50')],'erlangCallToSecond':_0x3c0fe6[_0x3ee6('0x51')],'erlangAbandonmentRate':_0x3c0fe6[_0x3ee6('0x52')],'erlangBusyFactor':_0x3c0fe6[_0x3ee6('0x53')],'startPredictive':_0x3c0fe6[_0x3ee6('0x54')],'startProgressive':_0x3c0fe6['startProgressive']};if(_0x3c0fe6['Trunk']){_0x54c576[_0x3ee6('0x55')]={'id':_0x3c0fe6[_0x3ee6('0x55')]['id'],'name':_0x3c0fe6[_0x3ee6('0x55')][_0x3ee6('0x28')],'active':_0x3c0fe6[_0x3ee6('0x55')]['active'],'callerid':_0x3c0fe6[_0x3ee6('0x55')][_0x3ee6('0x56')]};}if(_0x3c0fe6[_0x3ee6('0x57')]){_0x54c576['Interval']={'id':_0x3c0fe6['Interval']['id'],'name':_0x3c0fe6[_0x3ee6('0x57')][_0x3ee6('0x28')]};}var _0x1770b3=md5(JSON[_0x3ee6('0x58')](_0x54c576));if(_0x3c0fe6['md5']!==_0x1770b3){_0x3c0fe6[_0x3ee6('0x59')]=_0x1770b3;emit(util[_0x3ee6('0x5a')](_0x3ee6('0x5b'),_0x54c576[_0x3ee6('0x28')]),_0x3ee6('0x5c'),_0x54c576);}}}function emitVoiceQueueChannelRemove(_0x40ee3e){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3ee6('0x58')](_0x40ee3e));emit(util['format'](_0x3ee6('0x5b'),_0x40ee3e[_0x3ee6('0x28')]),_0x3ee6('0x5d'),_0x40ee3e);io['emit'](_0x3ee6('0x5e'),_0x40ee3e);}function notSendMessagesQueue(_0x2ecb01){if(_0x2ecb01[_0x3ee6('0x5f')]){if(_0x2ecb01[_0x3ee6('0x4f')]===0x0&&_0x2ecb01['pTalking']===0x0){_0x2ecb01[_0x3ee6('0x5f')]=![];_0x2ecb01[_0x3ee6('0x2a')]=0x0;_0x2ecb01['paused']=0x0;_0x2ecb01[_0x3ee6('0x60')]=_0x3ee6('0x61');ut[_0x3ee6('0x62')](_0x3ee6('0x63'),_0x2ecb01[_0x3ee6('0x28')]+_0x3ee6('0x64'));}else{_0x2ecb01[_0x3ee6('0x60')]=_0x3ee6('0x65');ut[_0x3ee6('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2ecb01['name']+_0x3ee6('0x66'));}emitCampaignPreview(_0x2ecb01);}}Preview[_0x3ee6('0xe')][_0x3ee6('0x25')]=function(){var _0x3f3f47=this;setInterval(function(){_0x3f3f47[_0x3ee6('0x67')]();},0x7cf);};Preview[_0x3ee6('0xe')][_0x3ee6('0x67')]=function(){var _0x296e48=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x52156b in _0x296e48){if(_0x296e48['hasOwnProperty'](_0x52156b)&&(_0x296e48[_0x52156b][_0x3ee6('0x68')]===_0x3ee6('0x4')||_0x296e48[_0x52156b][_0x3ee6('0x68')]===_0x3ee6('0x69'))&&_0x296e48[_0x52156b]['type']===_0x3ee6('0x6a')){if(this[_0x3ee6('0x17')]>0x7){this[_0x3ee6('0x17')]=0x0;this[_0x3ee6('0x6b')]();}}if(_0x296e48[_0x3ee6('0x6c')](_0x52156b)&&_0x296e48[_0x52156b]['dialMethod']==='preview'&&_0x296e48[_0x52156b][_0x3ee6('0x27')]===_0x3ee6('0x6a')){if(_0x296e48[_0x52156b][_0x3ee6('0x6d')]){this['setMessage'](_0x296e48[_0x52156b]);if(_0x296e48[_0x52156b][_0x3ee6('0x6e')])this[_0x3ee6('0x6f')](_0x296e48[_0x52156b]);}else{notSendMessagesQueue(_0x296e48[_0x52156b]);}}}};Preview[_0x3ee6('0xe')]['clearZombieChannel']=function(_0xd293a7){var _0x21986b=this;this[_0x3ee6('0x11')][_0x3ee6('0x70')](function(){if(!_[_0x3ee6('0x71')](_0x21986b[_0x3ee6('0x15')][_0xd293a7])){loggerAction['info'](_0x3ee6('0x72'),_0xd293a7,'Queue',_0x21986b['actions'][_0xd293a7][_0x3ee6('0x73')],_0x3ee6('0x74'),JSON[_0x3ee6('0x58')](_0x21986b[_0x3ee6('0x12')][_0x21986b[_0x3ee6('0x15')][_0xd293a7][_0x3ee6('0x73')]][_0x3ee6('0x4f')]),_0x3ee6('0x75'),JSON['stringify'](_0x21986b[_0x3ee6('0x12')][_0x21986b['actions'][_0xd293a7][_0x3ee6('0x73')]]['pTalking']),JSON[_0x3ee6('0x58')](_0x21986b[_0x3ee6('0x15')][_0xd293a7]['dialAnswer']),JSON[_0x3ee6('0x58')](_[_0x3ee6('0x76')](_0x21986b[_0x3ee6('0x15')][_0xd293a7],[_0x3ee6('0x77'),_0x3ee6('0x78'),_0x3ee6('0x79'),_0x3ee6('0x7a')])));return ami[_0x3ee6('0x7b')]({'action':'status','channel':_0x21986b[_0x3ee6('0x15')][_0xd293a7]['channel']})[_0x3ee6('0x7c')](function(_0x416b5d){if(_0x416b5d[_0x3ee6('0x60')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x21986b[_0x3ee6('0x15')][_0xd293a7]){ut['updateOriginated'](_0x21986b['campaignsPreview'][_0x21986b[_0x3ee6('0x15')][_0xd293a7][_0x3ee6('0x73')]],'[clearZombieChannel]');if(_0x21986b[_0x3ee6('0x15')][_0xd293a7][_0x3ee6('0x7d')]===!![]){ut['decrementTalkink'](_0x21986b[_0x3ee6('0x12')][_0x21986b[_0x3ee6('0x15')][_0xd293a7][_0x3ee6('0x73')]],'[clearZombieChannel]');ut[_0x3ee6('0x7e')](_0x3ee6('0x7f')+_0xd293a7,_0x21986b['actions'][_0xd293a7][_0x3ee6('0x73')]);}ut['loggerError'](_0x3ee6('0x80')+_0xd293a7,_0x21986b[_0x3ee6('0x15')][_0xd293a7][_0x3ee6('0x73')]);delete _0x21986b[_0x3ee6('0x15')][_0xd293a7];}},0x2328);}});}});};Preview[_0x3ee6('0xe')][_0x3ee6('0x6b')]=function(){var _0x22da63=this;loggerAction[_0x3ee6('0x81')]('[action]',_['size'](this[_0x3ee6('0x15')]));for(var _0xf5763d in this[_0x3ee6('0x15')]){if(_0x22da63[_0x3ee6('0x15')][_0x3ee6('0x6c')](_0xf5763d)){_0x22da63[_0x3ee6('0x82')](_0xf5763d);}}};Preview[_0x3ee6('0xe')][_0x3ee6('0x6f')]=function(_0x2b9c42){var _0x3a5288=this;rpcDb['getContactRecallMe'](_0x2b9c42['id'],ut[_0x3ee6('0x83')](this[_0x3ee6('0x16')]))[_0x3ee6('0x84')](function(_0x460b9c){if(!_[_0x3ee6('0x71')](_0x460b9c)){for(var _0x1cf82c=0x0;_0x1cf82c<_0x460b9c['length'];_0x1cf82c+=0x1){if(ut[_0x3ee6('0x85')](_0x460b9c[_0x1cf82c]['scheduledat'])<_0x2b9c42[_0x3ee6('0x86')]*0x3c){if(_0x460b9c[_0x1cf82c][_0x3ee6('0x87')]&&!_0x460b9c[_0x1cf82c][_0x3ee6('0x87')][_0x3ee6('0x88')]){_0x3a5288[_0x3ee6('0x89')](_0x460b9c[_0x1cf82c]['id'])[_0x3ee6('0x84')](ut['logger2']('[RecallMe]'))[_0x3ee6('0x7c')](ut[_0x3ee6('0x8a')]('[RecallMe]'));}else{rpcDb[_0x3ee6('0x8b')](_0x460b9c[_0x1cf82c]['id']);}}else{var _0x4987d4=new Action(_0x460b9c[_0x1cf82c],_0x2b9c42);_0x4987d4['starttime']=moment()[_0x3ee6('0x5a')](_0x3ee6('0x8c'));_0x2b9c42['outboundReCallsDay']+=0x1;ut[_0x3ee6('0x8d')](_0x4987d4,0x17,'RecallInQueue');if(_0x2b9c42[_0x3ee6('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0x3ee6('0x8f')](_0x460b9c[_0x1cf82c]));rpcDb[_0x3ee6('0x90')](_0x4987d4,_0x3ee6('0x91'));}else{ut[_0x3ee6('0x8d')](_0x4987d4,0x16,_0x3ee6('0x92'));rpcDb[_0x3ee6('0x90')](_0x4987d4,_0x3ee6('0x93'));rpcDb['createCustomerFinal'](_0x4987d4,'[HistoryRecallClose]');}}}}})[_0x3ee6('0x7c')](ut[_0x3ee6('0x8a')](_0x3ee6('0x94')));};Preview[_0x3ee6('0xe')]['setMessage']=function(_0x15180b){_0x15180b['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x15180b['loggedIn'])){_0x15180b[_0x3ee6('0x60')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x15180b[_0x3ee6('0x6d')])){_0x15180b[_0x3ee6('0x60')]=_0x3ee6('0x61');}else if(!this[_0x3ee6('0x95')](_0x15180b[_0x3ee6('0x55')])){if(!this[_0x3ee6('0x95')](_0x15180b['TrunkBackup'])){_0x15180b[_0x3ee6('0x60')]='TRUNK_IS_NOT_REACHABLE';}else{_0x15180b[_0x3ee6('0x60')]=_0x3ee6('0x96');}}else{_0x15180b[_0x3ee6('0x60')]=_0x3ee6('0x96');}emitCampaignPreview(_0x15180b);};Preview[_0x3ee6('0xe')][_0x3ee6('0x97')]=function(_0x10a7b5,_0x186aa8,_0x3ede71){var _0x4895c5=this;var _0x3b21c0=this[_0x3ee6('0x15')][_0x186aa8];var _0x5cc00c=this[_0x3ee6('0x12')][_0x3b21c0[_0x3ee6('0x73')]];var _0x32f94f;var _0x552c44=![];var _0x157ba8=0x2;var _0x257b87=0x3;if(_0x5cc00c){switch(_0x3ede71){case'1':_0x5cc00c[_0x3ee6('0x41')]+=0x1;_0x3b21c0[_0x3ee6('0x98')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x0,_0x3ee6('0x9b'));ami[_0x3ee6('0x26')]('custom:agentnosuchnumber',ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0x9d')));rpcDb['createCustomerHistory'](_0x3b21c0,'[callProgressDetectingCustomer][logNoSuch]');_0x4895c5['verifyAdditionalPhones'](_0x3b21c0,'0',_0x5cc00c)['then'](function(_0xb364d9){_0x552c44=_0xb364d9['additional']==0x1;_0x157ba8=_0x5cc00c[_0x3ee6('0x9e')];_0x257b87=_0x5cc00c['callAdditionalPhoneAfterMin'];if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb['createCustomerFinal'](_0x32f94f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3b21c0[_0x3ee6('0x98')]>=_0x5cc00c['dialNoSuchNumberMaxRetry']){rpcDb[_0x3ee6('0xa2')](_0x3b21c0,_0x3ee6('0xa3'));}else{rpcDb[_0x3ee6('0xa4')](ut[_0x3ee6('0xa5')](_0x3b21c0,_0x3ee6('0x98'),_0x5cc00c['dialNoSuchNumberRetryFrequency']),_0x3b21c0[_0x3ee6('0xa6')],_0x3b21c0[_0x3ee6('0xa7')]);}}delete this[_0x3ee6('0x15')][_0x10a7b5['linkedid']];}else{_0x3b21c0[_0x3ee6('0x98')]++;logger[_0x3ee6('0x81')]('actioncountonusuch',_0x3b21c0[_0x3ee6('0x98')]);logger[_0x3ee6('0x81')]('id',_0x3b21c0[_0x3ee6('0xa8')]);_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0['idContact'],'field':{'countnosuchnumberretry':_0x3b21c0['countnosuchnumberretry']}})[_0x3ee6('0x84')](function(){_0x4895c5['swapAdditionalPhones'](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});break;case'ANSWER':var _0x48f9df=moment()[_0x3ee6('0x5a')](_0x3ee6('0x8c'));_0x3b21c0[_0x3ee6('0xaa')]=_0x48f9df;_0x3b21c0[_0x3ee6('0xab')]=_0x48f9df;_0x3b21c0[_0x3ee6('0x7d')]=!![];_0x5cc00c[_0x3ee6('0x2c')]+=0x1;logger[_0x3ee6('0x81')](_0x3ee6('0xac'),_0x3b21c0[_0x3ee6('0xad')],_0x3ee6('0xae'),_0x5cc00c[_0x3ee6('0x28')],_0x3ee6('0x75'),_0x5cc00c['pTalking']);ami['emit'](_0x3ee6('0xaf'),ut['buildObj'](_0x3b21c0,'connect',this[_0x3ee6('0x12')][_0x3b21c0['queue']]));if(_0x5cc00c[_0x3ee6('0xb0')]){ami['emit']('custom:agentConnectPreview',ut[_0x3ee6('0xb1')](_0x3b21c0));}break;case'16':ami[_0x3ee6('0x26')](_0x3ee6('0xb2'),ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0xb3'),this[_0x3ee6('0x12')][_0x3b21c0[_0x3ee6('0x73')]]));emitVoiceQueueChannelRemove(ut[_0x3ee6('0x9c')](_0x3b21c0,'complete'));_0x5cc00c[_0x3ee6('0x3b')]+=0x1;_0x5cc00c[_0x3ee6('0x31')]+=0x1;_0x5cc00c[_0x3ee6('0x29')]+=0x1;ut[_0x3ee6('0xb4')](_0x5cc00c,_0x3ee6('0xb5'));_0x3b21c0['countglobal']=ut[_0x3ee6('0x9a')](_0x3b21c0);ut['logCustomer'](_0x3b21c0,0x4,'Answer');rpcDb[_0x3ee6('0x90')](_0x3b21c0,_0x3ee6('0xb6'));rpcDb['createCustomerFinal'](_0x3b21c0,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x3b21c0);_0x5cc00c[_0x3ee6('0x2e')]+=_0x3b21c0[_0x3ee6('0xb7')];_0x5cc00c['sumBillable']+=_0x3b21c0[_0x3ee6('0xb7')];logger[_0x3ee6('0x81')](_0x3ee6('0xb8'),_0x3b21c0[_0x3ee6('0xad')],_0x3ee6('0xae'),_0x5cc00c[_0x3ee6('0x28')],'pTalking:\x20',_0x5cc00c[_0x3ee6('0x2c')]);delete this[_0x3ee6('0x15')][_0x10a7b5[_0x3ee6('0xb9')]];break;case _0x3ee6('0xba'):_0x5cc00c[_0x3ee6('0x3c')]+=0x1;_0x3b21c0[_0x3ee6('0xbb')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x5,'Busy');_0x157ba8=_0x5cc00c[_0x3ee6('0xbc')];_0x257b87=_0x5cc00c['callAdditionalPhoneAfterMin'];ami['emit'](_0x3ee6('0xbd'),ut[_0x3ee6('0x9c')](_0x3b21c0,'busy'));rpcDb[_0x3ee6('0x90')](_0x3b21c0,_0x3ee6('0xbe'));_0x4895c5['verifyAdditionalPhones'](_0x3b21c0,'5',_0x5cc00c)[_0x3ee6('0x84')](function(_0x1177e7){_0x552c44=_0x1177e7[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c['dialGlobalMaxRetry']){_0x32f94f=ut['cloneAction'](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb['createCustomerFinal'](_0x32f94f,_0x3ee6('0xc0'));}else{if(_0x3b21c0[_0x3ee6('0xbb')]>=_0x5cc00c[_0x3ee6('0xc1')]){rpcDb['createCustomerFinal'](_0x3b21c0,_0x3ee6('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x3ee6('0xa5')](_0x3b21c0,_0x3ee6('0xbb'),_0x5cc00c[_0x3ee6('0xbc')]),_0x3b21c0['unlockAgent'],_0x3b21c0[_0x3ee6('0xa7')]);}}}else{_0x3b21c0[_0x3ee6('0xbb')]++;_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0[_0x3ee6('0xa8')],'field':{'countbusyretry':_0x3b21c0['countbusyretry']}})[_0x3ee6('0x84')](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});break;case _0x3ee6('0xc3'):_0x5cc00c['outboundNoAnswerCallsDay']+=0x1;_0x3b21c0[_0x3ee6('0xc4')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut['totalGlobal'](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x3,_0x3ee6('0xc5'));_0x157ba8=_0x5cc00c[_0x3ee6('0xc6')];_0x257b87=_0x5cc00c[_0x3ee6('0xc7')];var _0x441d53=ut[_0x3ee6('0xc8')](_0x3b21c0,_0x5cc00c);ami['emit']('custom:agentnoanswer',_0x441d53);rpcDb['createCustomerHistory'](_0x3b21c0,_0x3ee6('0xc9'));_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'3',_0x5cc00c)[_0x3ee6('0x84')](function(_0x26f55c){_0x552c44=_0x26f55c[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb[_0x3ee6('0xa2')](_0x32f94f,_0x3ee6('0xcb'));}else{if(_0x3b21c0[_0x3ee6('0xc4')]>=_0x5cc00c['dialNoAnswerMaxRetry']){rpcDb[_0x3ee6('0xa2')](_0x3b21c0,_0x3ee6('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x3ee6('0xa5')](_0x3b21c0,_0x3ee6('0xc4'),_0x5cc00c[_0x3ee6('0xc6')]),_0x3b21c0['unlockAgent'],_0x3b21c0[_0x3ee6('0xa7')]);}}}else{_0x3b21c0[_0x3ee6('0xc4')]++;_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0[_0x3ee6('0xa8')],'field':{'countnoanswerretry':_0x3b21c0['countnoanswerretry']}})[_0x3ee6('0x84')](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});break;case _0x3ee6('0xcc'):_0x5cc00c[_0x3ee6('0x3d')]+=0x1;_0x3b21c0[_0x3ee6('0xcd')]+=0x1;_0x3b21c0['countglobal']=ut['totalGlobal'](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x8,_0x3ee6('0xce'));_0x157ba8=_0x5cc00c[_0x3ee6('0xcf')];_0x257b87=_0x5cc00c['callAdditionalPhoneAfterMin'];ami[_0x3ee6('0x26')]('custom:agentcongestion',ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0xd0')));rpcDb[_0x3ee6('0x90')](_0x3b21c0,'[callProgressDetectingCustomer][logCongestion]');_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'8',_0x5cc00c)[_0x3ee6('0x84')](function(_0x2c77dd){_0x552c44=_0x2c77dd[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c['dialGlobalMaxRetry']){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0xf,'Global');rpcDb[_0x3ee6('0xa2')](_0x32f94f,_0x3ee6('0xd1'));}else{if(_0x3b21c0[_0x3ee6('0xcd')]>=_0x5cc00c['dialCongestionMaxRetry']){rpcDb[_0x3ee6('0xa2')](_0x3b21c0,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3ee6('0xa4')](ut[_0x3ee6('0xa5')](_0x3b21c0,_0x3ee6('0xcd'),_0x5cc00c['dialBusyRetryFrequency']),_0x3b21c0['unlockAgent'],_0x3b21c0[_0x3ee6('0xa7')]);}}}else{_0x3b21c0['countcongestionretry']++;_0x4895c5['incrementPreviewCounters']({'id':_0x3b21c0[_0x3ee6('0xa8')],'field':{'countcongestionretry':_0x3b21c0['countcongestionretry']}})['then'](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});break;case _0x3ee6('0xd2'):_0x5cc00c[_0x3ee6('0xd3')]+=0x1;_0x3b21c0[_0x3ee6('0xd4')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x14,_0x3ee6('0xd5'));_0x157ba8=_0x5cc00c[_0x3ee6('0xd6')];_0x257b87=_0x5cc00c[_0x3ee6('0xc7')];ami[_0x3ee6('0x26')]('custom:agentreject',ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0xd7')));rpcDb['createCustomerHistory'](_0x3b21c0,_0x3ee6('0xd8'));_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'20',_0x5cc00c)[_0x3ee6('0x84')](function(_0x2a106c){_0x552c44=_0x2a106c[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c['dialGlobalMaxRetry']){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0x14,'AgentReject');rpcDb[_0x3ee6('0xa2')](_0x32f94f,_0x3ee6('0xd9'));}else{if(_0x3b21c0[_0x3ee6('0xd4')]>=_0x5cc00c[_0x3ee6('0xda')]){rpcDb[_0x3ee6('0xa2')](_0x3b21c0,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3ee6('0xa4')](ut[_0x3ee6('0xa5')](_0x3b21c0,_0x3ee6('0xd4'),_0x5cc00c[_0x3ee6('0xd6')]),_0x3b21c0[_0x3ee6('0xa6')],_0x3b21c0[_0x3ee6('0xa7')]);}}}else{_0x3b21c0[_0x3ee6('0xc4')]++;_0x4895c5['incrementPreviewCounters']({'id':_0x3b21c0[_0x3ee6('0xa8')],'field':{'countnoanswerretry':_0x3b21c0[_0x3ee6('0xc4')]}})[_0x3ee6('0x84')](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});break;case _0x3ee6('0xdb'):_0x5cc00c['outboundAbandonedCallsDay']+=0x1;_0x3b21c0[_0x3ee6('0xdc')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0xb,'Abandoned');rpcDb[_0x3ee6('0x90')](_0x3b21c0,_0x3ee6('0xdd'));_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'11',_0x5cc00c)['then'](function(_0x271b76){_0x552c44=_0x271b76[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut['cloneAction'](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb[_0x3ee6('0xa2')](_0x32f94f,_0x3ee6('0xdd'));}else{if(_0x3b21c0['countabandonedetry']>=_0x5cc00c[_0x3ee6('0xde')]){rpcDb['createCustomerFinal'](_0x3b21c0,_0x3ee6('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x3ee6('0xa5')](_0x3b21c0,'countabandonedretry',_0x5cc00c[_0x3ee6('0xdf')]),_0x3b21c0['unlockAgent'],_0x3b21c0[_0x3ee6('0xa7')]);}}}else{_0x3b21c0[_0x3ee6('0xc4')]++;_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0['idContact'],'field':{'countnoanswerretry':_0x3b21c0[_0x3ee6('0xc4')]}})[_0x3ee6('0x84')](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)['then'](function(){});});}});break;case'18':_0x5cc00c['outboundUnknownCallsDay']+=0x1;_0x3b21c0[_0x3ee6('0xe0')]+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x12,_0x10a7b5[_0x3ee6('0xe1')]||_0x10a7b5['dialstatus']);ami[_0x3ee6('0x26')](_0x3ee6('0xe2'),ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0xe3')));rpcDb[_0x3ee6('0x90')](_0x3b21c0,'[callProgressDetectingCustomer][hangupInAMD]');_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'18',_0x5cc00c)[_0x3ee6('0x84')](function(_0xbf77e4){_0x552c44=_0xbf77e4[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0x12,'Global');rpcDb[_0x3ee6('0xa2')](_0x32f94f,_0x3ee6('0xe4'));}else{rpcDb[_0x3ee6('0xa2')](_0x3b21c0,_0x3ee6('0xe4'));}}else{_0x3b21c0[_0x3ee6('0xc4')]++;_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0['idContact'],'field':{'countnoanswerretry':_0x3b21c0[_0x3ee6('0xc4')]}})['then'](function(){_0x4895c5['swapAdditionalPhones'](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});});}});delete this['actions'][_0x10a7b5['linkedid']];break;case'19':_0x5cc00c['outboundUnknownCallsDay']+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut[_0x3ee6('0x8d')](_0x3b21c0,0x13,_0x10a7b5[_0x3ee6('0xe1')]||_0x10a7b5[_0x3ee6('0xe5')]);ami[_0x3ee6('0x26')](_0x3ee6('0xe2'),ut[_0x3ee6('0x9c')](_0x3b21c0,_0x3ee6('0xe3')));rpcDb['createCustomerHistory'](_0x3b21c0,_0x3ee6('0xe6'));_0x4895c5[_0x3ee6('0xca')](_0x3b21c0,'18',_0x5cc00c)[_0x3ee6('0x84')](function(_0x42148d){_0x552c44=_0x42148d['additional']==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut['cloneAction'](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb[_0x3ee6('0xa2')](_0x32f94f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3ee6('0xa2')](_0x3b21c0,'[callProgressDetectingCustomer][machine]');}}else{_0x3b21c0[_0x3ee6('0xc4')]++;_0x4895c5[_0x3ee6('0xa9')]({'id':_0x3b21c0[_0x3ee6('0xa8')],'field':{'countnoanswerretry':_0x3b21c0[_0x3ee6('0xc4')]}})[_0x3ee6('0x84')](function(){_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)['then'](function(){});});}});delete this[_0x3ee6('0x15')][_0x10a7b5[_0x3ee6('0xb9')]];break;default:if(_0x3b21c0[_0x3ee6('0x7d')]){ut[_0x3ee6('0xb4')](_0x5cc00c,'[default]');ut['loggerError'](_0x3ee6('0xe7')+_0x5cc00c[_0x3ee6('0x28')],_0x10a7b5);}_0x5cc00c['outboundUnknownCallsDay']+=0x1;_0x3b21c0[_0x3ee6('0x99')]=ut[_0x3ee6('0x9a')](_0x3b21c0);ut['logCustomer'](_0x3b21c0,0xc,_0x10a7b5[_0x3ee6('0xe1')]||_0x10a7b5[_0x3ee6('0xe5')]);_0x157ba8=_0x5cc00c[_0x3ee6('0xd6')];_0x257b87=_0x5cc00c['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x3b21c0,_0x3ee6('0xe8'));_0x4895c5['verifyAdditionalPhones'](_0x3b21c0,'20',_0x5cc00c)[_0x3ee6('0x84')](function(_0x466141){_0x552c44=_0x466141[_0x3ee6('0xbf')]==0x1;if(!_0x552c44){if(ut[_0x3ee6('0x9a')](_0x3b21c0)>=_0x5cc00c[_0x3ee6('0x9f')]){_0x32f94f=ut[_0x3ee6('0xa0')](_0x3b21c0,0xf,_0x3ee6('0xa1'));rpcDb['createCustomerFinal'](_0x32f94f,_0x3ee6('0xe9'));}else{rpcDb['createCustomerFinal'](_0x3b21c0,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x10a7b5[_0x3ee6('0xb9')]];}else{_0x4895c5[_0x3ee6('0xc2')](_0x3b21c0,_0x157ba8,_0x257b87)[_0x3ee6('0x84')](function(){});}});}if(!(_0x3b21c0[_0x3ee6('0x7d')]&&_0x3ede71==='16')){ut[_0x3ee6('0xea')](_0x5cc00c,_0x3ee6('0xeb'));logger[_0x3ee6('0x81')](_0x3ee6('0xec'),_0x3b21c0[_0x3ee6('0xad')],_0x3ee6('0xae'),_0x5cc00c[_0x3ee6('0x28')],_0x3ee6('0x74'),_0x5cc00c[_0x3ee6('0x4f')]);}if(_0x3ede71!==_0x3ee6('0xed')){delete this[_0x3ee6('0x15')][_0x10a7b5['linkedid']];delete this['actions'][_0x10a7b5[_0x3ee6('0xee')]];}}};Preview['prototype'][_0x3ee6('0xef')]=function(_0xe80485,_0x20950f,_0x3a09bb){if(_[_0x3ee6('0xf0')](_0x20950f)&&_0x3ee6('0xf1')!==typeof _0x20950f){return;}if(_[_0x3ee6('0xf0')](_0x3a09bb)&&'object'!==typeof _0x3a09bb){return;}switch(_0x3a09bb['reason']){case'0':ut[_0x3ee6('0xf2')](_0xe80485,0x0,_0x3ee6('0x9b'));rpcDb[_0x3ee6('0xf3')](_0xe80485,_0x3ee6('0xf4'));break;case'3':ut[_0x3ee6('0xf2')](_0xe80485,0x3,_0x3ee6('0xc5'));rpcDb[_0x3ee6('0xf3')](_0xe80485,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0xe80485,0x5,_0x3ee6('0xf5'));rpcDb[_0x3ee6('0xf3')](_0xe80485,_0x3ee6('0xf6'));break;case'8':ut[_0x3ee6('0xf2')](_0xe80485,0x8,_0x3ee6('0xce'));rpcDb['createAgentHistory'](_0xe80485,_0x3ee6('0xf7'));break;case'22':ut['logAgent'](_0xe80485,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0xe80485,_0x3ee6('0xf8'));break;default:ut[_0x3ee6('0xf2')](_0xe80485,0xc,_0x3a09bb['reason']);rpcDb[_0x3ee6('0xf3')](_0xe80485,'[callProgressDetectingAgent][logCongestion]');}ut[_0x3ee6('0xea')](_0x20950f,'[callProgressDetectingAgent]');logger['info'](_0x3ee6('0xf9'),_0xe80485[_0x3ee6('0xad')],'\x20Queue',_0x20950f[_0x3ee6('0x28')],_0x3ee6('0x74'),_0x20950f[_0x3ee6('0x4f')]);delete this[_0x3ee6('0x15')][_0xe80485[_0x3ee6('0xad')]];};Preview[_0x3ee6('0xe')]['verifyAdditionalPhones']=function(_0x680de9,_0x14dd71,_0x4b4837){return Promise[_0x3ee6('0xfa')]()[_0x3ee6('0x84')](cmHopperAdditionalPhone[_0x3ee6('0xca')](_0x680de9,_0x14dd71,_0x4b4837))[_0x3ee6('0x7c')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0x3ee6('0xc2')]=function(_0x1aea95,_0x3166cf,_0x3f83a9){return Promise[_0x3ee6('0xfa')]()[_0x3ee6('0x84')](cmHopperAdditionalPhone[_0x3ee6('0xc2')](_0x1aea95,_0x3166cf,_0x3f83a9))[_0x3ee6('0x7c')](logger[_0x3ee6('0x81')](_0x3ee6('0xfb')));};Preview[_0x3ee6('0xe')][_0x3ee6('0xa9')]=function(_0x178216){return Promise[_0x3ee6('0xfa')]()[_0x3ee6('0x84')](cmHopperAdditionalPhone[_0x3ee6('0xa9')](_0x178216))[_0x3ee6('0x7c')](logger['info'](_0x3ee6('0xfc')));};Preview[_0x3ee6('0xe')]['checkInBlack']=function(_0x19b4a1,_0x3a29e6,_0x29964b,_0x19f1a4,_0x509571){var _0x4225e8=this;return new Promise(function(_0x305930,_0x5e6df0){if(_[_0x3ee6('0x71')](_0x3a29e6)||_[_0x3ee6('0x71')](_0x3a29e6[_0x3ee6('0xfd')])||_[_0x3ee6('0x71')](_0x3a29e6[_0x3ee6('0xfe')])||_[_0x3ee6('0x71')](_0x3a29e6[_0x3ee6('0x79')])){_0x5e6df0(ut[_0x3ee6('0x60')]('Contact\x20is\x20undefined',_0x19f1a4,_0x509571));return;}var _0x29bb29=uuid['v4']();var _0x54f44d=_0x4225e8[_0x3ee6('0x12')][_0x3a29e6['Queue'][_0x3ee6('0x28')]];var _0x441365=_0x29964b?_0x4225e8[_0x3ee6('0x16')][_0x29964b]['id']:undefined;_0x4225e8[_0x3ee6('0x15')][_0x29bb29]=new Action(_0x3a29e6,_0x54f44d,_0x29bb29,_0x29964b,_0x441365);var _0x576736=_0x4225e8[_0x3ee6('0x15')][_0x29bb29];_0x576736['unlockAgent']=_0x19f1a4;_0x576736[_0x3ee6('0xa7')]=_0x509571;_0x576736[_0x3ee6('0xff')]=_0x29964b;if(_[_0x3ee6('0x100')](_0x19b4a1)){_0x4225e8[_0x3ee6('0x101')](_0x576736,_0x54f44d,_0x3a29e6,_0x29964b)[_0x3ee6('0x84')](function(_0x59d7a6){logger[_0x3ee6('0x81')](_0x3ee6('0x102'),'Queue:\x20'+_0x576736['queue']+_0x3ee6('0x103')+_0x576736['idContact'],JSON[_0x3ee6('0x58')](_0x59d7a6));ami[_0x3ee6('0x26')](_0x3ee6('0x104'),ut[_0x3ee6('0x9c')](_0x576736,_0x3ee6('0x105'),_0x4225e8[_0x3ee6('0x12')][_0x576736[_0x3ee6('0x73')]]));_0x305930(ut['message']('Calling'));})['catch'](function(_0x2ad9a3){ut[_0x3ee6('0x62')]('[Preview][execCall][failure]',_0x2ad9a3);_0x5e6df0(ut['message'](_0x3ee6('0x106'),_0x19f1a4,_0x509571));});}else{_0x54f44d['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x576736);rpcDb['createHistory'](_0x576736,_0x3ee6('0x107'));delete _0x4225e8['actions'][_0x29bb29];_0x5e6df0(ut['message']('Contact\x20in\x20black\x20List',_0x19f1a4,_0x509571));}});};Preview[_0x3ee6('0xe')][_0x3ee6('0x95')]=function(_0x5cd680){return!_[_0x3ee6('0x71')](_0x5cd680)&&!_[_0x3ee6('0x71')](_0x5cd680[_0x3ee6('0x28')])&&!_[_0x3ee6('0x71')](_0x5cd680[_0x3ee6('0x108')])&&_0x5cd680['active']&&!_[_0x3ee6('0x71')](this[_0x3ee6('0x14')][util[_0x3ee6('0x5a')]('SIP/%s',_0x5cd680[_0x3ee6('0x28')])])&&!_[_0x3ee6('0x71')](this[_0x3ee6('0x14')][util[_0x3ee6('0x5a')](_0x3ee6('0x109'),_0x5cd680['name'])]['status'])&&(this[_0x3ee6('0x14')][util[_0x3ee6('0x5a')](_0x3ee6('0x109'),_0x5cd680[_0x3ee6('0x28')])][_0x3ee6('0x10a')]==='reachable'||this[_0x3ee6('0x14')][util[_0x3ee6('0x5a')](_0x3ee6('0x109'),_0x5cd680['name'])]['status']==='unmonitored');};Preview[_0x3ee6('0xe')][_0x3ee6('0x89')]=function(_0x4938cf,_0x5378c9){var _0x4005bc=this;return new Promise(function(_0xf1a94b,_0x33a0bb){_0x4005bc[_0x3ee6('0x10b')](_0x4938cf,_0x5378c9)['then'](function(_0x10e951){_0xf1a94b(_[_0x3ee6('0x76')](_0x10e951,[_0x3ee6('0x60')]));})[_0x3ee6('0x7c')](function(_0x5c31a9){if(_0x5c31a9[_0x3ee6('0x10c')]){rpcDb[_0x3ee6('0x10d')](_0x4938cf);}if(_0x5c31a9[_0x3ee6('0x108')]){rpcDb[_0x3ee6('0x8b')](_0x4938cf);}_0x33a0bb(_[_0x3ee6('0x76')](_0x5c31a9,['message']));});});};Preview[_0x3ee6('0xe')][_0x3ee6('0x10b')]=function(_0x2f13b8,_0xfd1bb1){var _0x2937c0=this;return new Promise(function(_0x2b929c,_0x425512){var _0xa35fe4,_0x14c712;rpcDb[_0x3ee6('0x10e')](_0x2f13b8)[_0x3ee6('0x84')](function(_0x5edf7b){if(!_[_0x3ee6('0x71')](_0x5edf7b[0x0])){_0x14c712=_0x5edf7b[0x0]['recallme']?![]:!![];_0xa35fe4=_0x5edf7b[0x0]['recallme']?!![]:![];_0xa35fe4=_0xfd1bb1?!![]:_0xa35fe4;}var _0x274e98=_0x2937c0[_0x3ee6('0x10f')](_0x5edf7b);if(_0x274e98['isValid']){rpcDb[_0x3ee6('0x110')](_['pick'](_0x5edf7b[0x0],[_0x3ee6('0x79'),_0x3ee6('0xfe')]))[_0x3ee6('0x84')](function(_0x29d458){_0x2937c0[_0x3ee6('0x111')](_0x29d458,_0x5edf7b[0x0],_0xfd1bb1,_0x14c712,_0xa35fe4)['then'](function(_0x3dd5fb){_0x2b929c(_0x3dd5fb);})[_0x3ee6('0x7c')](function(_0x3f30d2){_0x425512(_0x3f30d2);});})[_0x3ee6('0x7c')](function(_0x3ef014){ut[_0x3ee6('0x62')](_0x3ee6('0x112'),_0x3ef014);_0x425512(ut['message'](_0x3ee6('0x113'),_0x14c712,_0xa35fe4));});}else{_0x425512(ut[_0x3ee6('0x60')](_0x274e98[_0x3ee6('0x60')],_0x14c712,_0xa35fe4));}})['catch'](function(_0x210ac1){ut['logger'](_0x3ee6('0x114'),_0x210ac1);_0x425512(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0x3ee6('0xe')][_0x3ee6('0x10f')]=function(_0x3792ed){if(_[_0x3ee6('0x71')](_0x3792ed)||_[_0x3ee6('0x100')](_0x3792ed)||!_[_0x3ee6('0x71')](_0x3792ed[0x0][_0x3ee6('0x87')])&&_['isNil'](_0x3792ed[0x0][_0x3ee6('0x87')]['name'])){ut[_0x3ee6('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x3792ed);return{'isValid':![],'message':_0x3ee6('0x115')};}var _0x18732e=this[_0x3ee6('0x12')][_0x3792ed[0x0][_0x3ee6('0x116')][_0x3ee6('0x28')]];_0x18732e[_0x3ee6('0x60')]=_0x3ee6('0x96');if(_[_0x3ee6('0x71')](_0x18732e)){ut[_0x3ee6('0x62')](_0x3ee6('0x117'),_0x18732e);return{'isValid':![],'message':_0x3ee6('0x118')};}if(!this[_0x3ee6('0x95')](_0x18732e[_0x3ee6('0x55')])){ut[_0x3ee6('0x62')](_0x3ee6('0x119'),_0x3ee6('0x11a')+_0x18732e[_0x3ee6('0x28')]+_0x3ee6('0x11b'));if(!this[_0x3ee6('0x95')](_0x18732e[_0x3ee6('0x11c')])){ut[_0x3ee6('0x62')](_0x3ee6('0x119'),_0x18732e[_0x3ee6('0x28')]+_0x3ee6('0x11d'));return{'isValid':![],'message':_0x3ee6('0x11e')};}}if(!ut['isActive'](_0x18732e[_0x3ee6('0x6d')])){ut[_0x3ee6('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x18732e['name']+_0x3ee6('0x11f'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x18732e[_0x3ee6('0x28')]+_0x3ee6('0x11f')};}return{'isValid':!![],'message':_0x3ee6('0x120')};};Preview['prototype'][_0x3ee6('0x101')]=function(_0x4f8214,_0x12e7f2,_0x4f5096,_0x1695e6){var _0x1b29b3=this;return new Promise(function(_0x15862b,_0x127325){var _0x2f6935=_0x4f8214[_0x3ee6('0xad')];var _0x5069b2=_0x1b29b3[_0x3ee6('0x95')](_0x12e7f2['Trunk'])?util[_0x3ee6('0x5a')]('SIP/%s/%s%s',_0x12e7f2[_0x3ee6('0x55')][_0x3ee6('0x28')],_[_0x3ee6('0x71')](_0x12e7f2[_0x3ee6('0x39')])?'':_0x12e7f2[_0x3ee6('0x39')]['trim']()||'',_0x12e7f2['dialCutDigit']>0x0?_0x4f5096['phone']['substring'](_0x12e7f2[_0x3ee6('0x121')]):_0x4f5096[_0x3ee6('0xfe')]):util[_0x3ee6('0x5a')](_0x3ee6('0x122'),_[_0x3ee6('0x71')](_0x12e7f2[_0x3ee6('0x11c')])?_0x12e7f2[_0x3ee6('0x55')]['name']:_0x12e7f2[_0x3ee6('0x11c')][_0x3ee6('0x28')],_[_0x3ee6('0x71')](_0x12e7f2[_0x3ee6('0x39')])?'':_0x12e7f2[_0x3ee6('0x39')]['trim']()||'',_0x12e7f2['dialCutDigit']>0x0?_0x4f5096[_0x3ee6('0xfe')][_0x3ee6('0x123')](_0x12e7f2[_0x3ee6('0x121')]):_0x4f5096[_0x3ee6('0xfe')]);var _0x56ed9a=_0x1b29b3[_0x3ee6('0x95')](_0x12e7f2[_0x3ee6('0x55')])?ut['getCallerId'](_0x12e7f2['Trunk'][_0x3ee6('0x56')],_0x12e7f2[_0x3ee6('0x36')],_0x12e7f2[_0x3ee6('0x124')]>0x0?ut[_0x3ee6('0x125')](_0x12e7f2['dialOriginateCallerIdNumber'],_0x12e7f2[_0x3ee6('0x124')]):_0x12e7f2[_0x3ee6('0x37')]):ut['getCallerId'](_['isNil'](_0x12e7f2[_0x3ee6('0x11c')])?_0x12e7f2[_0x3ee6('0x55')][_0x3ee6('0x56')]:_0x12e7f2[_0x3ee6('0x11c')]['callerid'],_0x12e7f2[_0x3ee6('0x36')],_0x12e7f2[_0x3ee6('0x124')]>0x0?ut[_0x3ee6('0x125')](_0x12e7f2[_0x3ee6('0x37')],_0x12e7f2[_0x3ee6('0x124')]):_0x12e7f2['dialOriginateCallerIdNumber']);if(_0x56ed9a){_0x4f8214[_0x3ee6('0x126')]=ut['extractCalleridName'](_0x56ed9a);_0x4f8214[_0x3ee6('0x127')]=ut['extractCalleridNumber'](_0x56ed9a);}var _0x3814c8=ut['addVariables'](_0x12e7f2,_0x4f5096,_0x5069b2,_0x56ed9a,_0x2f6935,_0x4f8214);_['merge'](_0x4f8214,ut[_0x3ee6('0x128')](_0x3814c8));_0x4f8214[_0x3ee6('0x129')]=moment()[_0x3ee6('0x5a')](_0x3ee6('0x8c'));_0x12e7f2['variables']=_0x3814c8;ami[_0x3ee6('0x7b')](ut['variablesAction'](_0x4f8214,_0x12e7f2,_0x3814c8,_0x4f8214[_0x3ee6('0xa7')],_0x1695e6))[_0x3ee6('0x84')](function(_0x4848b8){_0x12e7f2['originated']+=0x1;logger['info']('[originated][increment]',_0x2f6935,_0x3ee6('0xae'),_0x12e7f2['name'],_0x3ee6('0x74'),_0x12e7f2[_0x3ee6('0x4f')]);_0x15862b(_0x4848b8);})[_0x3ee6('0x7c')](function(_0x583537){ut['logAgent'](_0x4f8214,0xe,_0x3ee6('0x12a'));rpcDb[_0x3ee6('0xf3')](_0x4f8214,_0x3ee6('0x12b'));_0x127325(_0x583537);});});};Preview[_0x3ee6('0xe')]['syncNewExten']=function(_0x6ee2a0){if(this[_0x3ee6('0x15')][_0x6ee2a0[_0x3ee6('0xb9')]]){this[_0x3ee6('0x15')][_0x6ee2a0[_0x3ee6('0xb9')]][_0x3ee6('0x12c')]=_0x6ee2a0['channel'];}};Preview[_0x3ee6('0xe')][_0x3ee6('0x12d')]=function(_0x3f00e7){var _0x2e3d47=this;var _0x44849f=this[_0x3ee6('0x15')][_0x3f00e7[_0x3ee6('0x12e')]];if(_0x44849f){if(_0x44849f[_0x3ee6('0xff')]&&this['agents'][_0x44849f[_0x3ee6('0xff')]]){ut[_0x3ee6('0x12f')](_0x44849f,this['agents'][_0x44849f['lookAgent']][_0x3ee6('0x28')],this[_0x3ee6('0x16')][_0x44849f[_0x3ee6('0xff')]]['id']);}var _0x21b9e0=_[_0x3ee6('0x130')](_0x44849f);_0x21b9e0[_0x3ee6('0xaa')]=moment()[_0x3ee6('0x5a')](_0x3ee6('0x8c'));var _0x5c69e0=_0x2e3d47[_0x3ee6('0x12')][_0x44849f['queue']];if(ut[_0x3ee6('0x131')](_0x3f00e7[_0x3ee6('0x132')])){if(_0x44849f[_0x3ee6('0xa6')]){rpcDb[_0x3ee6('0x10d')](_0x44849f[_0x3ee6('0xa8')]);}if(_0x44849f[_0x3ee6('0xa7')]){rpcDb[_0x3ee6('0x8b')](_0x44849f[_0x3ee6('0xa8')]);}ami[_0x3ee6('0x26')]('custom:agentringnoanswer',ut[_0x3ee6('0x9c')](_0x44849f,_0x3ee6('0x133'),this[_0x3ee6('0x12')][_0x44849f[_0x3ee6('0x73')]]));this['callProgressDetectingAgent'](_0x21b9e0,_0x5c69e0,_0x3f00e7);}else{_0x44849f[_0x3ee6('0x129')]=moment()[_0x3ee6('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x3ee6('0xf2')](_0x21b9e0,0x4,_0x3ee6('0x134'));rpcDb[_0x3ee6('0xf3')](_0x21b9e0,_0x3ee6('0x135'));}}};Preview['prototype'][_0x3ee6('0x1a')]=function(_0x5ec6cd){var _0x1f0d92=this[_0x3ee6('0x15')][_0x5ec6cd[_0x3ee6('0xb9')]];var _0x21ff38;if(_0x1f0d92){_0x21ff38=this[_0x3ee6('0x12')][_0x1f0d92[_0x3ee6('0x73')]];logger[_0x3ee6('0x81')](_0x3ee6('0x136'),_0x5ec6cd[_0x3ee6('0xb9')],_0x3ee6('0xae'),_0x21ff38['name'],'pTalking:\x20',_0x21ff38[_0x3ee6('0x2c')]);}if(this['actions'][_0x5ec6cd['linkedid']]&&_0x5ec6cd[_0x3ee6('0xb9')]!==_0x5ec6cd['uniqueid']){if(_0x5ec6cd[_0x3ee6('0x137')]==='16'&&this[_0x3ee6('0x15')][_0x5ec6cd['linkedid']][_0x3ee6('0x7d')]){this[_0x3ee6('0x97')](_0x5ec6cd,_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd['cause']);}else if(this[_0x3ee6('0x15')][_0x5ec6cd[_0x3ee6('0xb9')]][_0x3ee6('0x7d')]){logger[_0x3ee6('0x81')]('[syncHangup][talking][cause]',_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd['cause'],_0x3ee6('0xae'),_0x21ff38['name'],_0x3ee6('0x75'),_0x21ff38[_0x3ee6('0x2c')]);this[_0x3ee6('0x97')](_0x5ec6cd,_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd['cause']);}}else if(_0x1f0d92&&_[_0x3ee6('0x71')](_0x1f0d92[_0x3ee6('0x138')])&&_0x21ff38[_0x3ee6('0x139')]&&_0x5ec6cd['linkedid']===_0x5ec6cd[_0x3ee6('0xad')]&&_[_0x3ee6('0x71')](_0x5ec6cd[_0x3ee6('0x13a')])&&_0x5ec6cd[_0x3ee6('0x137')]==='16'&&_0x5ec6cd[_0x3ee6('0x13b')]==='6'&&_[_0x3ee6('0xf0')](_0x1f0d92[_0x3ee6('0x13c')])){if(_0x1f0d92[_0x3ee6('0xa6')]){rpcDb[_0x3ee6('0x10d')](_0x1f0d92[_0x3ee6('0xa8')]);}if(_0x1f0d92['activeContact']){rpcDb[_0x3ee6('0x8b')](_0x1f0d92[_0x3ee6('0xa8')]);}_0x5ec6cd['reason']='22';this[_0x3ee6('0xef')](_0x1f0d92,_0x21ff38,_0x5ec6cd);}else if(_0x1f0d92&&_0x1f0d92[_0x3ee6('0x13c')]){if(_0x5ec6cd['cause']==='16'&&this[_0x3ee6('0x15')][_0x5ec6cd[_0x3ee6('0xb9')]][_0x3ee6('0x7d')]){logger['info'](_0x3ee6('0x13d'),_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd[_0x3ee6('0x137')],_0x3ee6('0xae'),_0x21ff38[_0x3ee6('0x28')],_0x3ee6('0x75'),_0x21ff38[_0x3ee6('0x2c')]);this[_0x3ee6('0x97')](_0x5ec6cd,_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd['cause']);}else if(this[_0x3ee6('0x15')][_0x5ec6cd[_0x3ee6('0xb9')]][_0x3ee6('0x7d')]){logger['info'](_0x3ee6('0x13e'),_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd[_0x3ee6('0x137')],_0x3ee6('0xae'),_0x21ff38[_0x3ee6('0x28')],_0x3ee6('0x75'),_0x21ff38[_0x3ee6('0x2c')]);this['callProgressDetectingCustomer'](_0x5ec6cd,_0x5ec6cd[_0x3ee6('0xb9')],_0x5ec6cd[_0x3ee6('0x137')]);}}};Preview[_0x3ee6('0xe')][_0x3ee6('0x13f')]=function(_0x315cc0){if(this[_0x3ee6('0x15')][_0x315cc0[_0x3ee6('0xee')]]&&_0x315cc0[_0x3ee6('0xee')]!==_0x315cc0[_0x3ee6('0x140')]){this[_0x3ee6('0x97')](_0x315cc0,_0x315cc0['destlinkedid'],_0x315cc0[_0x3ee6('0xe5')]);}};Preview[_0x3ee6('0xe')][_0x3ee6('0x1c')]=function(_0x54165d){if(this[_0x3ee6('0x15')][_0x54165d[_0x3ee6('0xb9')]]&&_0x54165d[_0x3ee6('0xb9')]!==_0x54165d[_0x3ee6('0xad')]&&!this['actions'][_0x54165d[_0x3ee6('0xb9')]][_0x3ee6('0x7d')]){if(_0x54165d[_0x3ee6('0x137')]==='1'){this[_0x3ee6('0x97')](_0x54165d,_0x54165d['linkedid'],_0x54165d[_0x3ee6('0x137')]);}}};Preview[_0x3ee6('0xe')][_0x3ee6('0x141')]=function(_0x3379b6,_0x30656d,_0x113979){if(this[_0x3ee6('0x15')][_0x3379b6]){if(_['isNil'](this['actions'][_0x3379b6][_0x3ee6('0x142')])){this[_0x3ee6('0x15')][_0x3379b6][_0x3ee6('0x142')]={};}this[_0x3ee6('0x15')][_0x3379b6][_0x3ee6('0x142')][_0x30656d]=_0x113979;}};Preview[_0x3ee6('0xe')]['syncVarSet']=function(_0x582527){try{if(!_[_0x3ee6('0x71')](_0x582527)){if(ut[_0x3ee6('0x143')](_[_0x3ee6('0x144')](_0x582527[_0x3ee6('0x145')])[0x0])){this['addVariable'](_0x582527['uniqueid'],_[_0x3ee6('0x144')](_0x582527['variable'])[0x0],_0x582527[_0x3ee6('0x146')]);}}}catch(_0x1ba84b){logger[_0x3ee6('0x147')](_0x3ee6('0x148'),util['inspect'](_0x1ba84b,{'showHidden':![],'depth':null}));}};Preview[_0x3ee6('0xe')][_0x3ee6('0x22')]=function(_0x4b63f0){if(_0x4b63f0){if(this[_0x3ee6('0x15')][_0x4b63f0[_0x3ee6('0x149')]]){this[_0x3ee6('0x15')][_0x4b63f0[_0x3ee6('0x149')]][_0x3ee6('0x13c')]=!![];}}};Preview[_0x3ee6('0xe')][_0x3ee6('0x24')]=function(_0x48fe9d){if(_0x48fe9d){if(this[_0x3ee6('0x15')][_0x48fe9d[_0x3ee6('0x14a')]]){this['actions'][_0x48fe9d[_0x3ee6('0x14a')]][_0x3ee6('0x13c')]=!![];}}};module[_0x3ee6('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0b009b6..ee7515b 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 _0x4f96=['queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo'];(function(_0x4ffa5a,_0x2fec21){var _0x5d941f=function(_0x3bcfd5){while(--_0x3bcfd5){_0x4ffa5a['push'](_0x4ffa5a['shift']());}};_0x5d941f(++_0x2fec21);}(_0x4f96,0x13e));var _0x64f9=function(_0x1d226a,_0x1f7c93){_0x1d226a=_0x1d226a-0x0;var _0x49ad84=_0x4f96[_0x1d226a];return _0x49ad84;};'use strict';var util=require('util');var BPromise=require(_0x64f9('0x0'));var logger=require(_0x64f9('0x1'))(_0x64f9('0x2'));var _=require(_0x64f9('0x3'));var cmHopper=require(_0x64f9('0x4'));var cmHopperFinal=require(_0x64f9('0x5'));var cmHopperHistory=require(_0x64f9('0x6'));var cmHopperBlack=require(_0x64f9('0x7'));var voiceQueueRt=require(_0x64f9('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x64f9('0x9'));function loggerCatch(_0x2c363d){return function(_0x3ddfb9){logger['error'](_0x2c363d,util[_0x64f9('0xa')](_0x3ddfb9,{'showHidden':![],'depth':null}));};}function create(_0x1805e6){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopperHistory[_0x64f9('0xd')](_0x1805e6))['catch'](loggerCatch(_0x64f9('0xe')));}function createAgent(_0x2f2530){return BPromise['resolve']()[_0x64f9('0xc')](agentReportPreview['createHistory'](_0x2f2530))[_0x64f9('0xf')](loggerCatch(_0x64f9('0xe')));}function moveContact(_0x5e0ef6){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper[_0x64f9('0x10')](_0x5e0ef6,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x64f9('0x11')]=function(_0x40e312){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopperBlack[_0x64f9('0x11')](_0x40e312))[_0x64f9('0xf')](loggerCatch(_0x64f9('0x12')));};exports[_0x64f9('0x13')]=function(_0x150c26){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper['getContactPreview'](_0x150c26))[_0x64f9('0xf')](loggerCatch(_0x64f9('0x14')));};exports['createHistory']=function(_0x151d84,_0x3470db){create(_0x151d84)['catch'](loggerCatch(_0x3470db));moveContact(_0x151d84)[_0x64f9('0xf')](loggerCatch(_0x3470db));};exports[_0x64f9('0x15')]=function(_0xa97161,_0xca98a9){createAgent(_0xa97161)[_0x64f9('0xf')](loggerCatch(_0xca98a9));};exports[_0x64f9('0x16')]=function(_0x4b4d37,_0x3139ac){create(_0x4b4d37)[_0x64f9('0xf')](loggerCatch(_0x3139ac));};exports[_0x64f9('0x17')]=function(_0x49db74,_0x5ae3af){moveContact(_0x49db74)['catch'](loggerCatch(_0x5ae3af));};exports[_0x64f9('0x18')]=function(_0x476ac8,_0x14125f,_0x3e69e4){if(_0x14125f){_0x476ac8[_0x64f9('0x19')]=null;}if(_0x3e69e4){_0x476ac8['active']=![];}return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper[_0x64f9('0x18')](_0x476ac8))[_0x64f9('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x51219e){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper['countReScheduled'](_0x51219e))[_0x64f9('0xf')](loggerCatch(_0x64f9('0x1a')));};exports[_0x64f9('0x1b')]=function(_0x4bdf71){return BPromise[_0x64f9('0xb')]()['then'](cmHopper[_0x64f9('0x1b')]({'UserId':null},_0x4bdf71,0x1))[_0x64f9('0xf')](loggerCatch('[unlockContact]\x20'));};exports[_0x64f9('0x1c')]=function(_0xa453fb){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper[_0x64f9('0x1b')]({'active':![]},_0xa453fb,0x1))[_0x64f9('0xf')](loggerCatch(_0x64f9('0x1d')));};exports['crateCustomerReportQueue']=function(_0x4f2b95){var _0x5901d2={};_0x5901d2[_0x64f9('0x1e')]=_0x4f2b95[_0x64f9('0x1e')];_0x5901d2[_0x64f9('0x1f')]=_0x4f2b95[_0x64f9('0x1f')];_0x5901d2[_0x64f9('0x20')]=_0x4f2b95['calleridnum'];_0x5901d2[_0x64f9('0x21')]=_0x4f2b95[_0x64f9('0x21')];_0x5901d2[_0x64f9('0x22')]=_0x4f2b95[_0x64f9('0x22')];_0x5901d2['queuecallerjoinAt']=_0x4f2b95[_0x64f9('0x23')];_0x5901d2[_0x64f9('0x24')]=_0x4f2b95[_0x64f9('0x23')];_0x5901d2[_0x64f9('0x25')]=0x1;_0x5901d2['queuecallercompleteAt']=_0x4f2b95['endtime'];_0x5901d2[_0x64f9('0x26')]=_0x4f2b95[_0x64f9('0x27')];_0x5901d2[_0x64f9('0x28')]=_0x64f9('0x29');_0x5901d2[_0x64f9('0x2a')]=_0x64f9('0x2b');_0x5901d2[_0x64f9('0x2c')]=0x0;_0x5901d2['assigned']=0x1;_0x5901d2[_0x64f9('0x2d')]=_0x4f2b95[_0x64f9('0x27')];_0x5901d2[_0x64f9('0x2e')]=_0x64f9('0x2f');return BPromise[_0x64f9('0xb')]()['then'](voiceQueueReport[_0x64f9('0x30')](_0x5901d2))[_0x64f9('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x64f9('0x31')]=function(_0x3716bd,_0x4258ad){return BPromise[_0x64f9('0xb')]()['then'](cmHopper[_0x64f9('0x31')](_0x3716bd,_0x4258ad))['catch'](loggerCatch(_0x64f9('0x32')));};exports[_0x64f9('0x33')]=function(_0x24eef0){return BPromise[_0x64f9('0xb')]()[_0x64f9('0xc')](cmHopper[_0x64f9('0x18')](_0x24eef0,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd1ab=['exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','then','getContactPreview','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip'];(function(_0x319546,_0x315e68){var _0x3e924d=function(_0x43e1c0){while(--_0x43e1c0){_0x319546['push'](_0x319546['shift']());}};_0x3e924d(++_0x315e68);}(_0xd1ab,0x199));var _0xbd1a=function(_0x49dd0d,_0x36a056){_0x49dd0d=_0x49dd0d-0x0;var _0x2136f2=_0xd1ab[_0x49dd0d];return _0x2136f2;};'use strict';var util=require(_0xbd1a('0x0'));var BPromise=require(_0xbd1a('0x1'));var logger=require(_0xbd1a('0x2'))('preview');var _=require(_0xbd1a('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xbd1a('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xbd1a('0x5'));var agentReportPreview=require(_0xbd1a('0x6'));var voiceQueueReport=require(_0xbd1a('0x7'));function loggerCatch(_0x258498){return function(_0x43f82d){logger[_0xbd1a('0x8')](_0x258498,util['inspect'](_0x43f82d,{'showHidden':![],'depth':null}));};}function create(_0x94ef02){return BPromise[_0xbd1a('0x9')]()['then'](cmHopperHistory[_0xbd1a('0xa')](_0x94ef02))[_0xbd1a('0xb')](loggerCatch(_0xbd1a('0xc')));}function createAgent(_0x404a4e){return BPromise['resolve']()['then'](agentReportPreview[_0xbd1a('0xa')](_0x404a4e))[_0xbd1a('0xb')](loggerCatch(_0xbd1a('0xc')));}function moveContact(_0xa869ab){return BPromise[_0xbd1a('0x9')]()['then'](cmHopper[_0xbd1a('0xd')](_0xa869ab,!![]))[_0xbd1a('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xbd1a('0xe')]=function(_0x4c0b10){return BPromise[_0xbd1a('0x9')]()[_0xbd1a('0xf')](cmHopperBlack[_0xbd1a('0xe')](_0x4c0b10))[_0xbd1a('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xbd1a('0x10')]=function(_0xed1812){return BPromise[_0xbd1a('0x9')]()[_0xbd1a('0xf')](cmHopper[_0xbd1a('0x10')](_0xed1812))[_0xbd1a('0xb')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x2ca42f,_0x24f9b9){create(_0x2ca42f)[_0xbd1a('0xb')](loggerCatch(_0x24f9b9));moveContact(_0x2ca42f)[_0xbd1a('0xb')](loggerCatch(_0x24f9b9));};exports['createAgentHistory']=function(_0x1333e2,_0x571c10){createAgent(_0x1333e2)[_0xbd1a('0xb')](loggerCatch(_0x571c10));};exports[_0xbd1a('0x11')]=function(_0x4cbb55,_0x59a341){create(_0x4cbb55)[_0xbd1a('0xb')](loggerCatch(_0x59a341));};exports[_0xbd1a('0x12')]=function(_0x2e3e4f,_0x4dc801){moveContact(_0x2e3e4f)[_0xbd1a('0xb')](loggerCatch(_0x4dc801));};exports[_0xbd1a('0x13')]=function(_0x31460d,_0x549f9f,_0x335445){if(_0x549f9f){_0x31460d['UserId']=null;}if(_0x335445){_0x31460d[_0xbd1a('0x14')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x31460d))[_0xbd1a('0xb')](loggerCatch(_0xbd1a('0x15')));};exports['countReScheduled']=function(_0x2bcc54){return BPromise[_0xbd1a('0x9')]()[_0xbd1a('0xf')](cmHopper['countReScheduled'](_0x2bcc54))['catch'](loggerCatch(_0xbd1a('0x16')));};exports[_0xbd1a('0x17')]=function(_0x337331){return BPromise[_0xbd1a('0x9')]()['then'](cmHopper[_0xbd1a('0x17')]({'UserId':null},_0x337331,0x1))[_0xbd1a('0xb')](loggerCatch(_0xbd1a('0x18')));};exports['disableContact']=function(_0x105939){return BPromise[_0xbd1a('0x9')]()['then'](cmHopper['unlockContact']({'active':![]},_0x105939,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xbd1a('0x19')]=function(_0x14aef3){var _0x3b27f1={};_0x3b27f1[_0xbd1a('0x1a')]=_0x14aef3[_0xbd1a('0x1a')];_0x3b27f1[_0xbd1a('0x1b')]=_0x14aef3[_0xbd1a('0x1b')];_0x3b27f1['calleridnum']=_0x14aef3[_0xbd1a('0x1c')];_0x3b27f1['calleridname']=_0x14aef3[_0xbd1a('0x1d')];_0x3b27f1[_0xbd1a('0x1e')]=_0x14aef3[_0xbd1a('0x1e')];_0x3b27f1[_0xbd1a('0x1f')]=_0x14aef3[_0xbd1a('0x20')];_0x3b27f1[_0xbd1a('0x21')]=_0x14aef3[_0xbd1a('0x20')];_0x3b27f1[_0xbd1a('0x22')]=0x1;_0x3b27f1[_0xbd1a('0x23')]=_0x14aef3[_0xbd1a('0x24')];_0x3b27f1[_0xbd1a('0x25')]=_0x14aef3[_0xbd1a('0x26')];_0x3b27f1[_0xbd1a('0x27')]=_0xbd1a('0x28');_0x3b27f1[_0xbd1a('0x29')]='xcally-motion-preview';_0x3b27f1['holdtime']=0x0;_0x3b27f1[_0xbd1a('0x2a')]=0x1;_0x3b27f1[_0xbd1a('0x2b')]=_0x14aef3[_0xbd1a('0x26')];_0x3b27f1[_0xbd1a('0x2c')]=_0xbd1a('0x2d');return BPromise[_0xbd1a('0x9')]()['then'](voiceQueueReport['create'](_0x3b27f1))['catch'](loggerCatch(_0xbd1a('0x2e')));};exports[_0xbd1a('0x2f')]=function(_0xa9b169,_0x17b66b){return BPromise[_0xbd1a('0x9')]()['then'](cmHopper[_0xbd1a('0x2f')](_0xa9b169,_0x17b66b))[_0xbd1a('0xb')](loggerCatch(_0xbd1a('0x30')));};exports[_0xbd1a('0x31')]=function(_0x55f967){return BPromise['resolve']()[_0xbd1a('0xf')](cmHopper[_0xbd1a('0x13')](_0x55f967,!![],!![]))[_0xbd1a('0xb')](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 06c5a14..fd2f410 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 _0x9682=['countagentrejectretry','countnosuchnumberretry','Global','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','noanswer','keys','forEach','toLowerCase','variables','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0x9682,0x1e8));var _0x2968=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9682[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require(_0x2968('0x0'));var moment=require(_0x2968('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x2968('0x2')][_0x2968('0x3')]||_0x2968('0x4');function getSeconds(_0x183519,_0x8c299){var _0x3b24fd=moment(_0x183519)[_0x2968('0x5')](0x0);var _0x1eb85e=moment(_0x8c299)[_0x2968('0x5')](0x0);return _0x3b24fd[_0x2968('0x6')](_0x1eb85e,'seconds');}exports['loggerCatch']=function(_0x47e43e){return function(_0x3c6624){logger[_0x2968('0x7')](_0x47e43e,util[_0x2968('0x8')](_0x3c6624,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x515d9b,_0x4f3344){logger['info'](_0x515d9b,util['inspect'](_0x4f3344,{'showHidden':![],'depth':null}));};exports[_0x2968('0x9')]=function(_0x34c432,_0x4e61bc){logger[_0x2968('0x7')](_0x34c432,util[_0x2968('0x8')](_0x4e61bc,{'showHidden':![],'depth':null}));};exports[_0x2968('0xa')]=function(_0x1b07a4){return function(_0x5ac595){logger[_0x2968('0xb')](_0x1b07a4,util[_0x2968('0x8')](_0x5ac595,{'showHidden':![],'depth':null}));};};exports[_0x2968('0xc')]=function(_0x181f03,_0x297b16,_0xfcf36c){return{'message':_0x181f03,'unlock':_0x297b16,'active':_0xfcf36c};};exports[_0x2968('0xd')]=function(_0x354672,_0x61b680,_0x2eee15){if(!_[_0x2968('0xe')](_0x2eee15)&&'string'===typeof _0x2eee15&&!_[_0x2968('0xf')](_0x2eee15)){if(!_[_0x2968('0xe')](_0x61b680)&&_0x2968('0x10')===typeof _0x61b680&&!_[_0x2968('0xf')](_0x61b680)){return util[_0x2968('0x11')]('\x22%s\x22\x20<%s>',_0x61b680,_0x2eee15);}return util[_0x2968('0x11')](_0x2968('0x12'),_0x2eee15,_0x2eee15);}if(!_[_0x2968('0xe')](_0x354672)&&_0x2968('0x10')===typeof _0x354672&&!_[_0x2968('0xf')](_0x354672)){return _0x354672;}return _0x2968('0x13');};exports['isActive']=function(_0x4468af){if(_[_0x2968('0x14')](_0x4468af)){return![];}return _0x4468af;};exports[_0x2968('0x15')]=function(_0x32e88f,_0xc9afb8,_0x5313bb,_0x257ce4,_0x51a396,_0x3520ce){var _0x11b74c={'XMD-QUEUE':_0xc9afb8[_0x2968('0x16')]?_0xc9afb8['Queue'][_0x2968('0x17')]:'','XMD-CALLERID':_0x257ce4,'XMD-CALLERID-PREVIEW':_0x3520ce?util[_0x2968('0x11')](_0x2968('0x12'),_0x3520ce[_0x2968('0x18')],_0x3520ce['calleridnum']):_0x257ce4,'XMD-DIALID':_0x51a396,'XMD-CONTACTID':_0xc9afb8['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x257ce4,'XMD-VOICEQUEUEID':_0xc9afb8[_0x2968('0x19')],'XMD-DIALCHANNEL':_0x5313bb,'XMD-DIALTIMEOUT':_0x32e88f[_0x2968('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x2968('0x11')](_0x2968('0x1b'),_0x32e88f['dialQueueProject2']?'g':'',_[_0x2968('0xf')](_0x32e88f[_0x2968('0x1c')])?'':_0x2968('0x1d')),'XMD-DIALURL':_0x32e88f[_0x2968('0x1e')]||'','XMD-AGI':_0x32e88f[_0x2968('0x1f')]?util[_0x2968('0x11')](_0x2968('0x20'),ipAgi,_0x32e88f[_0x2968('0x1f')]):_0x2968('0x21'),'XMD-AGIAFTER':_0x32e88f[_0x2968('0x22')]?util[_0x2968('0x11')](_0x2968('0x20'),ipAgi,_0x32e88f[_0x2968('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3520ce?_0x3520ce[_0x2968('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3520ce?_0x3520ce[_0x2968('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x2968('0x25')};if(!_[_0x2968('0xf')](_0x32e88f[_0x2968('0x1c')])){_0x11b74c[util['format']('%s',_0x2968('0x26'))]=_0x32e88f['monitor_format'];_0x11b74c[util[_0x2968('0x11')]('%s',_0x2968('0x27'))]=_0x51a396;}if(_0xc9afb8&&_0xc9afb8[_0x2968('0x28')]){for(var _0x20e25a in _0xc9afb8[_0x2968('0x28')]){if(_0xc9afb8[_0x2968('0x28')][_0x2968('0x29')](_0x20e25a)){if(!_[_0x2968('0x14')](_0xc9afb8['Contact'][_0x20e25a])&&_0x20e25a!=='id'&&_0x20e25a!=='tags'&&_0x20e25a!==_0x2968('0x2a')&&_0x20e25a!==_0x2968('0x2b')){_0x11b74c[util[_0x2968('0x11')](_0x2968('0x2c'),_0x2968('0x2d'),_[_0x2968('0x2e')](_0x20e25a))]=_0xc9afb8[_0x2968('0x28')][_0x20e25a];}}}}return _0x11b74c;};exports[_0x2968('0x2f')]=function(_0x214acd){var _0x193bcf={};for(var _0x44035e in _0x214acd){if(_0x214acd['hasOwnProperty'](_0x44035e)){_0x193bcf[util['format']('%s',_[_0x2968('0x30')](_0x44035e))]=_0x214acd[_0x44035e];}}return{'variables':_0x193bcf};};exports[_0x2968('0x31')]=function(_0x67a8a5,_0x3a9e65){if(!_['isNil'](_0x67a8a5)){if(_0x67a8a5[_0x2968('0x29')](_0x2968('0x32'))){if(_0x67a8a5[_0x2968('0x32')]>0x0){_0x67a8a5[_0x2968('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3a9e65);}}}else{logger[_0x2968('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3a9e65);}};exports[_0x2968('0x33')]=function(_0x39c629){var _0x45fdf6=moment()[_0x2968('0x11')](_0x2968('0x34'));_0x39c629[_0x2968('0x35')]=0xd;_0x39c629[_0x2968('0x36')]=_0x2968('0x37');_0x39c629[_0x2968('0x38')]=_0x45fdf6;_0x39c629['responsetime']=_0x45fdf6;_0x39c629[_0x2968('0x39')]=_0x45fdf6;};exports[_0x2968('0x3a')]=function(_0x5e2659,_0x311d50,_0x369878){var _0x265cae=moment()[_0x2968('0x11')](_0x2968('0x34'));_0x5e2659[_0x2968('0x35')]=_0x311d50;_0x5e2659['statedesc']=_0x369878;_0x5e2659[_0x2968('0x3b')]=_0x265cae;_0x5e2659['ringtime']=getSeconds(_0x5e2659[_0x2968('0x3b')],_0x5e2659[_0x2968('0x38')]);};exports[_0x2968('0x3c')]=function(_0x11d644,_0x18fd70,_0x933a04){_0x11d644[_0x2968('0x3d')]=_0x18fd70;_0x11d644[_0x2968('0x3e')]=_0x933a04;};exports[_0x2968('0x3f')]=function(_0x1c9d71,_0x5ba753,_0x2a3d07){var _0x4885ef=moment()[_0x2968('0x11')](_0x2968('0x34'));_0x1c9d71[_0x2968('0x35')]=_0x5ba753;_0x1c9d71[_0x2968('0x36')]=_0x2a3d07;_0x1c9d71[_0x2968('0x3b')]=_0x1c9d71[_0x2968('0x3b')]?_0x1c9d71['responsetime']:_0x4885ef;_0x1c9d71[_0x2968('0x39')]=_0x1c9d71[_0x2968('0x39')]?_0x1c9d71[_0x2968('0x39')]:_0x4885ef;_0x1c9d71['ringtime']=getSeconds(_0x1c9d71[_0x2968('0x3b')]||0x0,_0x1c9d71[_0x2968('0x38')]||0x0);_0x1c9d71[_0x2968('0x40')]=_0x1c9d71['answertime']?getSeconds(_0x1c9d71[_0x2968('0x39')],_0x1c9d71[_0x2968('0x41')]):0x0;};exports[_0x2968('0x42')]=function(_0xfd8913){return _0xfd8913===_0x2968('0x43');};exports[_0x2968('0x44')]=function(_0x2c1014,_0x17d9cd,_0x229dc5,_0x534318,_0x5c71dc){var _0x563cd8=_0x534318?'RECALL':_0x2c1014[_0x2968('0x18')];_0x563cd8=_0x5c71dc?'BOOKED':_0x563cd8;return{'actionid':_0x2c1014[_0x2968('0x45')],'action':_0x2968('0x46'),'channel':_0x2c1014[_0x2968('0x47')],'callerid':util[_0x2968('0x11')](_0x2968('0x12'),_0x563cd8,_0x2c1014[_0x2968('0x48')]),'Exten':_0x2968('0x49'),'Context':_0x2968('0x4a'),'Priority':'1','variable':_0x229dc5,'timeout':(_0x17d9cd[_0x2968('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c1014['uniqueid']};};exports[_0x2968('0x4c')]=function(_0x43643c){return _0x43643c[_0x2968('0x4d')]+_0x43643c[_0x2968('0x4e')]+_0x43643c[_0x2968('0x4f')]+_0x43643c[_0x2968('0x50')]+_0x43643c[_0x2968('0x51')];};exports['cloneAction']=function(_0x41d514){var _0x36dae1=_['clone'](_0x41d514);_0x36dae1[_0x2968('0x35')]=0xf;_0x36dae1[_0x2968('0x36')]=_0x2968('0x52');return _0x36dae1;};exports['scheduledAt']=function(_0x195737,_0x294536,_0x886b3e){var _0x4741cc={};_0x4741cc[_0x294536]=_0x195737[_0x294536];_0x4741cc[_0x2968('0x53')]=![];_0x4741cc[_0x2968('0x54')]=moment()[_0x2968('0x55')](_0x886b3e,'minutes')['format'](_0x2968('0x34'));_0x4741cc[_0x2968('0x56')]=_0x195737[_0x2968('0x56')];_0x4741cc[_0x2968('0x57')]=_0x195737[_0x2968('0x57')];_0x4741cc['VoiceQueueId']=_0x195737[_0x2968('0x19')]||undefined;return _0x4741cc;};exports[_0x2968('0x58')]=function(_0x317e85,_0x4131d7){if(!_[_0x2968('0x14')](_0x317e85)){if(_0x317e85[_0x2968('0x59')]>0x0){_0x317e85[_0x2968('0x59')]-=0x1;}else{logger[_0x2968('0x7')](_0x4131d7,_0x2968('0x5a'));}}else{logger['error'](_0x4131d7,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x2968('0x5b')]=function(_0x252e54){if(_0x252e54<=0x0){return!![];}return![];};function buildObj(_0x4450f0,_0x31a672,_0x41dc0d){_0x4450f0[_0x2968('0x5c')]=_0x31a672;_0x4450f0[_0x2968('0x17')]=_0x4450f0[_0x2968('0x5d')];_0x4450f0[_0x2968('0x5e')]=_0x4450f0[_0x2968('0x47')];_0x4450f0[_0x2968('0x5f')]='voice';if(_0x41dc0d){_0x4450f0[_0x2968('0x60')]=_0x41dc0d[_0x2968('0x60')];}return _0x4450f0;}exports[_0x2968('0x61')]=buildObj;exports[_0x2968('0x62')]=function(_0x22b93b){var _0x3f1cba={};_0x3f1cba['queue']=_0x22b93b[_0x2968('0x5d')];_0x3f1cba['interface']=_0x22b93b['channelAgent'];_0x3f1cba[_0x2968('0x45')]=_0x22b93b[_0x2968('0x45')];return _0x3f1cba;};exports[_0x2968('0x63')]=function(_0x12eb44){var _0x490e3f=[];for(var _0x2b22ea in _0x12eb44){if(_0x12eb44['hasOwnProperty'](_0x2b22ea)){if(!_[_0x2968('0x14')](_0x12eb44[_0x2b22ea])&&_0x12eb44[_0x2b22ea][_0x2968('0x35')]===_0x2968('0x64')&&_0x12eb44[_0x2b22ea][_0x2968('0x65')]===_0x2968('0x66')){_0x490e3f[_0x2968('0x67')](_0x12eb44[_0x2b22ea]['id']);}}}return _0x490e3f;};exports[_0x2968('0x68')]=function(_0x373e18){var _0x1279c9=moment()[_0x2968('0x5')](0x0);var _0x94fe7b=moment(_0x373e18)[_0x2968('0x5')](0x0);return _0x1279c9[_0x2968('0x6')](_0x94fe7b,_0x2968('0x69'));};exports[_0x2968('0x6a')]=function(_0x545e74){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x545e74[_0x2968('0x56')],'ListId':_0x545e74['ListId'],'VoiceQueueId':_0x545e74['VoiceQueueId']||undefined,'CampaignId':_0x545e74[_0x2968('0x6b')]||undefined};};exports[_0x2968('0x6c')]=function(_0x1bc646){if(_0x1bc646===_0x2968('0x45')||_0x1bc646==='idContact'||_0x1bc646===_0x2968('0x5d')||_0x1bc646===_0x2968('0x6d')||_0x1bc646===_0x2968('0x6e')||_0x1bc646==='dialAnswer'||_0x1bc646===_0x2968('0x3d')||_0x1bc646===_0x2968('0x47')||_0x1bc646===_0x2968('0x18')||_0x1bc646===_0x2968('0x53')||_0x1bc646===_0x2968('0x48')||_0x1bc646==='scheduledat'||_0x1bc646===_0x2968('0x4d')||_0x1bc646===_0x2968('0x4e')||_0x1bc646===_0x2968('0x4f')||_0x1bc646===_0x2968('0x6f')||_0x1bc646===_0x2968('0x70')||_0x1bc646===_0x2968('0x71')||_0x1bc646===_0x2968('0x72')||_0x1bc646==='recallme'||_0x1bc646===_0x2968('0x56')||_0x1bc646==='ListId'||_0x1bc646===_0x2968('0x3e')||_0x1bc646==='VoiceQueueId'||_0x1bc646==='sipcallid'||_0x1bc646==='xmd-voicequeueid'||_0x1bc646===_0x2968('0x73')||_0x1bc646===_0x2968('0x74')||_0x1bc646===_0x2968('0x75')||_0x1bc646==='xmd-dialurl'||_0x1bc646===_0x2968('0x76')||_0x1bc646===_0x2968('0x77')||_0x1bc646==='xmd-dialid'||_0x1bc646===_0x2968('0x78')||_0x1bc646==='xmd-contactid'||_0x1bc646===_0x2968('0x79')||_0x1bc646===_0x2968('0x7a')||_0x1bc646==='xmd-agiafter'||_0x1bc646===_0x2968('0x7b')||_0x1bc646===_0x2968('0x7c')||_0x1bc646==='rtpaudioqosbridged'||_0x1bc646==='rtpaudioqosjitter'||_0x1bc646===_0x2968('0x7d')||_0x1bc646==='rtpaudioqosloss'||_0x1bc646===_0x2968('0x7e')||_0x1bc646==='rtpaudioqosrtt'||_0x1bc646===_0x2968('0x7f')||_0x1bc646===_0x2968('0x7c')||_0x1bc646==='rtpaudioqosbridged'||_0x1bc646==='rtpaudioqosjitter'||_0x1bc646==='rtpaudioqosjitterbridged'||_0x1bc646===_0x2968('0x80')||_0x1bc646===_0x2968('0x7e')||_0x1bc646===_0x2968('0x81')||_0x1bc646===_0x2968('0x7f')||_0x1bc646===_0x2968('0x82')||_0x1bc646==='bridgepvtcallid'||_0x1bc646===_0x2968('0x35')||_0x1bc646==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x20144c,_0x1944b8){var _0x527975,_0xb938d6,_0x6b4d55;if(_0x1944b8<=0x0){_0x1944b8=0x1;}_0x527975=new RegExp(_0x2968('0x83')+_0x1944b8+'}$');_0xb938d6=Math[_0x2968('0x84')](0xa,_0x1944b8-0x1);_0x6b4d55=Math['pow'](0xa,_0x1944b8)-0x1;return util[_0x2968('0x11')]('%s',_[_0x2968('0x85')](_0x20144c,_0x527975,_[_0x2968('0x86')](_0xb938d6,_0x6b4d55)));};exports[_0x2968('0x87')]=function(_0x5bc7fc){var _0x40a472=_0x5bc7fc[_0x2968('0x88')](/"(.*?)"/);return _0x40a472?_0x40a472[0x1]:_0x5bc7fc;};exports['extractCalleridNumber']=function(_0x1bfa6e){var _0x38f0b7=_0x1bfa6e[_0x2968('0x88')](/<(.*?)>/);return _0x38f0b7?_0x38f0b7[0x1]:_0x1bfa6e;};function buildNoAnswerEventPayload(_0x6fee1f,_0x4e32a1){var _0x4e503b=buildObj(_0x6fee1f,_0x2968('0x89'));if(!_[_0x2968('0xf')](_0x4e32a1['variables'])){Object[_0x2968('0x8a')](_0x4e32a1['variables'])[_0x2968('0x8b')](function(_0x1c57be){_0x4e503b[_0x1c57be[_0x2968('0x8c')]()]=_0x4e32a1[_0x2968('0x8d')][_0x1c57be];});}return _0x4e503b;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x8846=['loggerError','info','message','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','Queue','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','starttime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','agentReadyId','not_inuse','reachable','getDiff','diff','seconds','CampaignId','filterKey','idContact','type','active','calleridnum','countbusyretry','countglobal','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','keys','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','127.0.0.1','milliseconds','loggerCatch','error','inspect','logger'];(function(_0x35c12c,_0x378ba0){var _0x2bab3a=function(_0x43eeb2){while(--_0x43eeb2){_0x35c12c['push'](_0x35c12c['shift']());}};_0x2bab3a(++_0x378ba0);}(_0x8846,0x19a));var _0x6884=function(_0x3aad73,_0xb08ee6){_0x3aad73=_0x3aad73-0x0;var _0x4b08f0=_0x8846[_0x3aad73];return _0x4b08f0;};'use strict';var util=require('util');var _=require(_0x6884('0x0'));var moment=require(_0x6884('0x1'));var logger=require(_0x6884('0x2'))(_0x6884('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x6884('0x4');function getSeconds(_0x5c886c,_0x5f1f33){var _0x58a32e=moment(_0x5c886c)[_0x6884('0x5')](0x0);var _0x2492f5=moment(_0x5f1f33)['milliseconds'](0x0);return _0x58a32e['diff'](_0x2492f5,'seconds');}exports[_0x6884('0x6')]=function(_0x3e6e60){return function(_0x12e889){logger[_0x6884('0x7')](_0x3e6e60,util[_0x6884('0x8')](_0x12e889,{'showHidden':![],'depth':null}));};};exports[_0x6884('0x9')]=function(_0x32ea93,_0x374d8a){logger['info'](_0x32ea93,util[_0x6884('0x8')](_0x374d8a,{'showHidden':![],'depth':null}));};exports[_0x6884('0xa')]=function(_0x4f9425,_0x4a419f){logger[_0x6884('0x7')](_0x4f9425,util[_0x6884('0x8')](_0x4a419f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x486301){return function(_0x5b35b1){logger[_0x6884('0xb')](_0x486301,util[_0x6884('0x8')](_0x5b35b1,{'showHidden':![],'depth':null}));};};exports[_0x6884('0xc')]=function(_0x52c33e,_0x42da97,_0x29d0ae){return{'message':_0x52c33e,'unlock':_0x42da97,'active':_0x29d0ae};};exports['getCallerId']=function(_0x3c5637,_0x30b2b5,_0x26a664){if(!_[_0x6884('0xd')](_0x26a664)&&'string'===typeof _0x26a664&&!_[_0x6884('0xe')](_0x26a664)){if(!_[_0x6884('0xd')](_0x30b2b5)&&_0x6884('0xf')===typeof _0x30b2b5&&!_[_0x6884('0xe')](_0x30b2b5)){return util['format'](_0x6884('0x10'),_0x30b2b5,_0x26a664);}return util[_0x6884('0x11')](_0x6884('0x10'),_0x26a664,_0x26a664);}if(!_[_0x6884('0xd')](_0x3c5637)&&_0x6884('0xf')===typeof _0x3c5637&&!_[_0x6884('0xe')](_0x3c5637)){return _0x3c5637;}return _0x6884('0x12');};exports[_0x6884('0x13')]=function(_0x1d49fa){if(_['isNil'](_0x1d49fa)){return![];}return _0x1d49fa;};exports['addVariables']=function(_0x24fa4a,_0x39afd1,_0x35bfee,_0x5c544f,_0x3a9715,_0x4add60){var _0x33473a={'XMD-QUEUE':_0x39afd1[_0x6884('0x14')]?_0x39afd1[_0x6884('0x14')]['name']:'','XMD-CALLERID':_0x5c544f,'XMD-CALLERID-PREVIEW':_0x4add60?util['format'](_0x6884('0x10'),_0x4add60['calleridname'],_0x4add60['calleridnum']):_0x5c544f,'XMD-DIALID':_0x3a9715,'XMD-CONTACTID':_0x39afd1['ContactId'],'XMD-CDRTYPE':_0x6884('0x15'),'CALLERID(all)':_0x5c544f,'XMD-VOICEQUEUEID':_0x39afd1['VoiceQueueId'],'XMD-DIALCHANNEL':_0x35bfee,'XMD-DIALTIMEOUT':_0x24fa4a[_0x6884('0x16')]||0x1e,'XMD-DIALOPTIONS':util[_0x6884('0x11')](_0x6884('0x17'),_0x24fa4a[_0x6884('0x18')]?'g':'',_['isEmpty'](_0x24fa4a[_0x6884('0x19')])?'':_0x6884('0x1a')),'XMD-DIALURL':_0x24fa4a[_0x6884('0x1b')]||'','XMD-AGI':_0x24fa4a[_0x6884('0x1c')]?util[_0x6884('0x11')](_0x6884('0x1d'),ipAgi,_0x24fa4a[_0x6884('0x1c')]):_0x6884('0x1e'),'XMD-AGIAFTER':_0x24fa4a[_0x6884('0x18')]?util[_0x6884('0x11')](_0x6884('0x1d'),ipAgi,_0x24fa4a[_0x6884('0x18')]):_0x6884('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x4add60?_0x4add60[_0x6884('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x4add60?_0x4add60[_0x6884('0x20')]:'','XMD-DESTINATION':_0x6884('0x21'),'SIPADDHEADER':_0x6884('0x22')};if(!_['isEmpty'](_0x24fa4a[_0x6884('0x19')])){_0x33473a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x24fa4a[_0x6884('0x19')];_0x33473a[util[_0x6884('0x11')]('%s',_0x6884('0x23'))]=_0x3a9715;}if(_0x39afd1&&_0x39afd1[_0x6884('0x24')]){for(var _0xc50b0 in _0x39afd1[_0x6884('0x24')]){if(_0x39afd1[_0x6884('0x24')][_0x6884('0x25')](_0xc50b0)){if(!_[_0x6884('0x26')](_0x39afd1[_0x6884('0x24')][_0xc50b0])&&_0xc50b0!=='id'&&_0xc50b0!==_0x6884('0x27')&&_0xc50b0!==_0x6884('0x28')&&_0xc50b0!==_0x6884('0x29')){_0x33473a[util[_0x6884('0x11')](_0x6884('0x2a'),_0x6884('0x2b'),_[_0x6884('0x2c')](_0xc50b0))]=_0x39afd1[_0x6884('0x24')][_0xc50b0];}}}}return _0x33473a;};exports['toLowerVariables']=function(_0x325210){var _0x2ecb80={};for(var _0x50af30 in _0x325210){if(_0x325210[_0x6884('0x25')](_0x50af30)){_0x2ecb80[util[_0x6884('0x11')]('%s',_[_0x6884('0x2d')](_0x50af30))]=_0x325210[_0x50af30];}}return{'variables':_0x2ecb80};};exports['updateOriginated']=function(_0x3002d0,_0x532349){if(!_[_0x6884('0x26')](_0x3002d0)){if(_0x3002d0['hasOwnProperty'](_0x6884('0x2e'))){if(_0x3002d0[_0x6884('0x2e')]>0x0){_0x3002d0[_0x6884('0x2e')]-=0x1;}else{logger[_0x6884('0x7')](_0x6884('0x2f'),_0x532349);}}}else{logger[_0x6884('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x532349);}};exports['logBlacklist']=function(_0x35bb69){var _0xd832a0=moment()['format'](_0x6884('0x30'));_0x35bb69[_0x6884('0x31')]=0xd;_0x35bb69[_0x6884('0x32')]=_0x6884('0x33');_0x35bb69['starttime']=_0xd832a0;_0x35bb69[_0x6884('0x34')]=_0xd832a0;_0x35bb69[_0x6884('0x35')]=_0xd832a0;};exports[_0x6884('0x36')]=function(_0x556328,_0x12b4d8,_0x3f1f08){var _0x23eaed=moment()[_0x6884('0x11')](_0x6884('0x30'));_0x556328['state']=_0x12b4d8;_0x556328['statedesc']=_0x3f1f08;_0x556328[_0x6884('0x34')]=_0x23eaed;_0x556328[_0x6884('0x37')]=getSeconds(_0x556328[_0x6884('0x34')],_0x556328['starttime']);};exports[_0x6884('0x38')]=function(_0x242564,_0x272d72,_0x64b9f8){_0x242564[_0x6884('0x39')]=_0x272d72;_0x242564[_0x6884('0x3a')]=_0x64b9f8;};exports[_0x6884('0x3b')]=function(_0x30a528,_0x997cb3,_0x396530){var _0x9fc7fc=moment()[_0x6884('0x11')](_0x6884('0x30'));_0x30a528[_0x6884('0x31')]=_0x997cb3;_0x30a528[_0x6884('0x32')]=_0x396530;_0x30a528['responsetime']=_0x30a528[_0x6884('0x34')]?_0x30a528[_0x6884('0x34')]:_0x9fc7fc;_0x30a528[_0x6884('0x35')]=_0x30a528[_0x6884('0x35')]?_0x30a528[_0x6884('0x35')]:_0x9fc7fc;_0x30a528[_0x6884('0x37')]=getSeconds(_0x30a528[_0x6884('0x34')]||0x0,_0x30a528[_0x6884('0x3c')]||0x0);_0x30a528['talktime']=_0x30a528[_0x6884('0x3d')]?getSeconds(_0x30a528[_0x6884('0x35')],_0x30a528['answertime']):0x0;};exports[_0x6884('0x3e')]=function(_0x1a4dcf){return _0x1a4dcf===_0x6884('0x3f');};exports[_0x6884('0x40')]=function(_0x1bbab8,_0x52ee3f,_0x91bb16,_0x588a62,_0x4f8fb4){var _0x2d553c=_0x588a62?'RECALL':_0x1bbab8[_0x6884('0x41')];_0x2d553c=_0x4f8fb4?_0x6884('0x42'):_0x2d553c;return{'actionid':_0x1bbab8['uniqueid'],'action':_0x6884('0x43'),'channel':_0x1bbab8[_0x6884('0x44')],'callerid':util[_0x6884('0x11')]('\x22%s\x22\x20<%s>',_0x2d553c,_0x1bbab8['calleridnum']),'Exten':_0x6884('0x21'),'Context':_0x6884('0x45'),'Priority':'1','variable':_0x91bb16,'timeout':(_0x52ee3f['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1bbab8[_0x6884('0x46')]};};exports[_0x6884('0x47')]=function(_0x5cb0f2){return _0x5cb0f2['countbusyretry']+_0x5cb0f2[_0x6884('0x48')]+_0x5cb0f2[_0x6884('0x49')]+_0x5cb0f2[_0x6884('0x4a')]+_0x5cb0f2[_0x6884('0x4b')];};exports['cloneAction']=function(_0x4a9bf3){var _0xdacd86=_[_0x6884('0x4c')](_0x4a9bf3);_0xdacd86[_0x6884('0x31')]=0xf;_0xdacd86['statedesc']=_0x6884('0x4d');return _0xdacd86;};exports[_0x6884('0x4e')]=function(_0x4648f8,_0x1a3d2d,_0x1ee29c){var _0x4cf9a4={};_0x4cf9a4[_0x1a3d2d]=_0x4648f8[_0x1a3d2d];_0x4cf9a4['active']=![];_0x4cf9a4[_0x6884('0x4f')]=moment()['add'](_0x1ee29c,_0x6884('0x50'))['format'](_0x6884('0x30'));_0x4cf9a4[_0x6884('0x51')]=_0x4648f8[_0x6884('0x51')];_0x4cf9a4['ListId']=_0x4648f8[_0x6884('0x52')];_0x4cf9a4[_0x6884('0x53')]=_0x4648f8[_0x6884('0x53')]||undefined;return _0x4cf9a4;};exports[_0x6884('0x54')]=function(_0x1b41ec,_0x3cba93){if(!_[_0x6884('0x26')](_0x1b41ec)){if(_0x1b41ec[_0x6884('0x55')]>0x0){_0x1b41ec[_0x6884('0x55')]-=0x1;}else{logger[_0x6884('0x7')](_0x3cba93,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x6884('0x7')](_0x3cba93,_0x6884('0x56'));}};exports[_0x6884('0x57')]=function(_0x124ce7){if(_0x124ce7<=0x0){return!![];}return![];};function buildObj(_0x8051a3,_0x8b827c,_0x27df81){_0x8051a3[_0x6884('0x58')]=_0x8b827c;_0x8051a3['name']=_0x8051a3['queue'];_0x8051a3['interface']=_0x8051a3[_0x6884('0x44')];_0x8051a3['motionChannel']=_0x6884('0x59');if(_0x27df81){_0x8051a3[_0x6884('0x5a')]=_0x27df81[_0x6884('0x5a')];}return _0x8051a3;}exports[_0x6884('0x5b')]=buildObj;exports[_0x6884('0x5c')]=function(_0x1eb3ab){var _0x2b0145={};_0x2b0145['queue']=_0x1eb3ab[_0x6884('0x5d')];_0x2b0145[_0x6884('0x5e')]=_0x1eb3ab[_0x6884('0x44')];_0x2b0145[_0x6884('0x46')]=_0x1eb3ab[_0x6884('0x46')];return _0x2b0145;};exports[_0x6884('0x5f')]=function(_0x1d56e6){var _0x22dcf1=[];for(var _0xc01d13 in _0x1d56e6){if(_0x1d56e6[_0x6884('0x25')](_0xc01d13)){if(!_['isNil'](_0x1d56e6[_0xc01d13])&&_0x1d56e6[_0xc01d13][_0x6884('0x31')]===_0x6884('0x60')&&_0x1d56e6[_0xc01d13]['status']===_0x6884('0x61')){_0x22dcf1['push'](_0x1d56e6[_0xc01d13]['id']);}}}return _0x22dcf1;};exports[_0x6884('0x62')]=function(_0x20f79e){var _0x1cdaa0=moment()['milliseconds'](0x0);var _0x4c07b=moment(_0x20f79e)[_0x6884('0x5')](0x0);return _0x1cdaa0[_0x6884('0x63')](_0x4c07b,_0x6884('0x64'));};exports['createBody']=function(_0x259c91){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x259c91[_0x6884('0x51')],'ListId':_0x259c91['ListId'],'VoiceQueueId':_0x259c91[_0x6884('0x53')]||undefined,'CampaignId':_0x259c91[_0x6884('0x65')]||undefined};};exports[_0x6884('0x66')]=function(_0x38da67){if(_0x38da67===_0x6884('0x46')||_0x38da67===_0x6884('0x67')||_0x38da67===_0x6884('0x5d')||_0x38da67===_0x6884('0x68')||_0x38da67==='campaigntype'||_0x38da67==='dialAnswer'||_0x38da67===_0x6884('0x39')||_0x38da67==='channelAgent'||_0x38da67===_0x6884('0x41')||_0x38da67===_0x6884('0x69')||_0x38da67===_0x6884('0x6a')||_0x38da67==='scheduledat'||_0x38da67===_0x6884('0x6b')||_0x38da67==='countcongestionretry'||_0x38da67==='countnoanswerretry'||_0x38da67===_0x6884('0x6c')||_0x38da67==='callback'||_0x38da67==='callbackuniqueid'||_0x38da67==='callbackat'||_0x38da67==='recallme'||_0x38da67===_0x6884('0x51')||_0x38da67===_0x6884('0x52')||_0x38da67===_0x6884('0x3a')||_0x38da67===_0x6884('0x53')||_0x38da67==='sipcallid'||_0x38da67===_0x6884('0x6d')||_0x38da67===_0x6884('0x6e')||_0x38da67===_0x6884('0x6f')||_0x38da67==='xmd-listid'||_0x38da67===_0x6884('0x70')||_0x38da67===_0x6884('0x71')||_0x38da67===_0x6884('0x72')||_0x38da67==='xmd-dialid'||_0x38da67===_0x6884('0x73')||_0x38da67===_0x6884('0x74')||_0x38da67===_0x6884('0x75')||_0x38da67==='xmd-callerid'||_0x38da67===_0x6884('0x76')||_0x38da67===_0x6884('0x77')||_0x38da67===_0x6884('0x78')||_0x38da67==='rtpaudioqosbridged'||_0x38da67===_0x6884('0x79')||_0x38da67==='rtpaudioqosjitterbridged'||_0x38da67==='rtpaudioqosloss'||_0x38da67===_0x6884('0x7a')||_0x38da67===_0x6884('0x7b')||_0x38da67===_0x6884('0x7c')||_0x38da67===_0x6884('0x78')||_0x38da67===_0x6884('0x7d')||_0x38da67===_0x6884('0x79')||_0x38da67===_0x6884('0x7e')||_0x38da67===_0x6884('0x7f')||_0x38da67===_0x6884('0x7a')||_0x38da67===_0x6884('0x7b')||_0x38da67===_0x6884('0x7c')||_0x38da67===_0x6884('0x80')||_0x38da67===_0x6884('0x81')||_0x38da67===_0x6884('0x31')||_0x38da67===_0x6884('0x32')){return![];}return!![];};exports[_0x6884('0x82')]=function(_0x506c50,_0x254c31){var _0x3d8c01,_0xbe9502,_0x49df27;if(_0x254c31<=0x0){_0x254c31=0x1;}_0x3d8c01=new RegExp(_0x6884('0x83')+_0x254c31+'}$');_0xbe9502=Math[_0x6884('0x84')](0xa,_0x254c31-0x1);_0x49df27=Math[_0x6884('0x84')](0xa,_0x254c31)-0x1;return util[_0x6884('0x11')]('%s',_[_0x6884('0x85')](_0x506c50,_0x3d8c01,_[_0x6884('0x86')](_0xbe9502,_0x49df27)));};exports[_0x6884('0x87')]=function(_0x16df92){var _0xae2878=_0x16df92[_0x6884('0x88')](/"(.*?)"/);return _0xae2878?_0xae2878[0x1]:_0x16df92;};exports['extractCalleridNumber']=function(_0x26d5e6){var _0x557389=_0x26d5e6[_0x6884('0x88')](/<(.*?)>/);return _0x557389?_0x557389[0x1]:_0x26d5e6;};function buildNoAnswerEventPayload(_0x176b4e,_0x234117){var _0x2ebdeb=buildObj(_0x176b4e,'noanswer');if(!_[_0x6884('0xe')](_0x234117['variables'])){Object[_0x6884('0x89')](_0x234117['variables'])['forEach'](function(_0x2845da){_0x2ebdeb[_0x2845da[_0x6884('0x8a')]()]=_0x234117['variables'][_0x2845da];});}return _0x2ebdeb;}exports[_0x6884('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1044f4b..fa314a6 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 _0x083e=['voicechannel','voicequeuechannelhangup','queueadd','string','boolean','queuepause','reload','voicequeuechannel'];(function(_0x55e942,_0x5dba5d){var _0x5471b4=function(_0x109198){while(--_0x109198){_0x55e942['push'](_0x55e942['shift']());}};_0x5471b4(++_0x5dba5d);}(_0x083e,0x182));var _0xe083=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x083e[_0x5d8018];return _0x151ac4;};'use strict';exports[_0xe083('0x0')]={'queue':{'type':_0xe083('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xe083('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xe083('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xe083('0x1'),'required':!![]},'interface':{'type':_0xe083('0x1'),'required':!![]}};exports[_0xe083('0x3')]={'interface':{'type':_0xe083('0x1'),'required':!![]},'paused':{'type':_0xe083('0x2')},'reason':{'type':_0xe083('0x1'),'required':![]}};exports[_0xe083('0x4')]={'module':{'type':'string','required':![]}};exports[_0xe083('0x5')]={'uniqueid':{'type':_0xe083('0x1'),'required':!![]}};exports[_0xe083('0x6')]={'uniqueid':{'type':_0xe083('0x1'),'required':!![]},'filename':{'type':_0xe083('0x1')},'format':{'type':_0xe083('0x1')},'mixmonitorid':{'type':_0xe083('0x1')}};exports[_0xe083('0x7')]={'uniqueid':{'type':_0xe083('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xe083('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xe083('0x1')}}; \ No newline at end of file +var _0x5e46=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x1eaa1d,_0x2d1bdd){var _0xcecdf5=function(_0x8990a3){while(--_0x8990a3){_0x1eaa1d['push'](_0x1eaa1d['shift']());}};_0xcecdf5(++_0x2d1bdd);}(_0x5e46,0x91));var _0x65e4=function(_0x54fa2a,_0x391c6b){_0x54fa2a=_0x54fa2a-0x0;var _0x3a66b6=_0x5e46[_0x54fa2a];return _0x3a66b6;};'use strict';exports[_0x65e4('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x65e4('0x1'),'required':!![]},'membername':{'type':_0x65e4('0x1'),'required':!![]},'penalty':{'type':_0x65e4('0x2'),'required':![]},'paused':{'type':_0x65e4('0x3'),'required':![]}};exports[_0x65e4('0x4')]={'queue':{'type':_0x65e4('0x1'),'required':!![]},'interface':{'type':_0x65e4('0x1'),'required':!![]}};exports[_0x65e4('0x5')]={'interface':{'type':_0x65e4('0x1'),'required':!![]},'paused':{'type':_0x65e4('0x3')},'reason':{'type':_0x65e4('0x1'),'required':![]}};exports[_0x65e4('0x6')]={'module':{'type':_0x65e4('0x1'),'required':![]}};exports[_0x65e4('0x7')]={'uniqueid':{'type':_0x65e4('0x1'),'required':!![]}};exports[_0x65e4('0x8')]={'uniqueid':{'type':_0x65e4('0x1'),'required':!![]},'filename':{'type':_0x65e4('0x1')},'format':{'type':_0x65e4('0x1')},'mixmonitorid':{'type':_0x65e4('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x65e4('0x1'),'required':!![]}};exports[_0x65e4('0x9')]={'uniqueid':{'type':_0x65e4('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x65e4('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index aa1cb0f..78a39f9 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 _0xba34=['vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','mergeFromDatabase','isUndefined','name','initTrunks','initTriggers','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','billableseconds','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts'];(function(_0x4ca1e7,_0x40c3c9){var _0x101379=function(_0x1dba71){while(--_0x1dba71){_0x4ca1e7['push'](_0x4ca1e7['shift']());}};_0x101379(++_0x40c3c9);}(_0xba34,0x119));var _0x4ba3=function(_0x24cf17,_0x5c4b0b){_0x24cf17=_0x24cf17-0x0;var _0x56411e=_0xba34[_0x24cf17];return _0x56411e;};'use strict';var util=require(_0x4ba3('0x0'));var _=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var Agent=require(_0x4ba3('0x3'));var Telephone=require(_0x4ba3('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x4ba3('0x5'));var Campaign=require(_0x4ba3('0x6'));var VoiceExtension=require(_0x4ba3('0x7'));var ZendeskAccount=require(_0x4ba3('0x8'));var SalesforceAccount=require(_0x4ba3('0x9'));var FreshdeskAccount=require(_0x4ba3('0xa'));var SugarcrmAccount=require(_0x4ba3('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x4ba3('0xc'));var VtigerAccount=require(_0x4ba3('0xd'));var ServicenowAccount=require(_0x4ba3('0xe'));var Dynamics365Account=require(_0x4ba3('0xf'));var FreshsalesAccount=require(_0x4ba3('0x10'));var FaxAccount=require(_0x4ba3('0x11'));var Realtime=function(){this[_0x4ba3('0x12')]={};this[_0x4ba3('0x13')]={};this[_0x4ba3('0x14')]={};this[_0x4ba3('0x15')]={};this[_0x4ba3('0x16')]={};this['campaigns']={};this[_0x4ba3('0x17')]={};this[_0x4ba3('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x4ba3('0x19')]={};this['queueChannels']={};this[_0x4ba3('0x1a')]={};this['timers']={};this[_0x4ba3('0x1b')]={};this[_0x4ba3('0x1c')]={};this[_0x4ba3('0x1d')]={};this[_0x4ba3('0x1e')]={};this[_0x4ba3('0x1f')]={};this[_0x4ba3('0x20')]={};this[_0x4ba3('0x21')]={};this[_0x4ba3('0x22')]={};this[_0x4ba3('0x23')]={};this[_0x4ba3('0x24')]={};this[_0x4ba3('0x25')]={};this[_0x4ba3('0x26')]={};};function freeIsNotKey(_0x29a9d1,_0x25f584,_0x40e75b){var _0x1b7776=_['mapKeys'](_0x29a9d1,function(_0x382fd0,_0x788277){return _0x382fd0[_0x40e75b];});for(var _0x5ff7ce in _0x25f584){if(_0x25f584[_0x4ba3('0x27')](_0x5ff7ce)){if(!_0x1b7776[_0x5ff7ce]){delete _0x25f584[_0x5ff7ce];}}}}function freeIsNotKeySip(_0x556290,_0x2519bb){var _0xe4eff9=_[_0x4ba3('0x28')](_0x556290,function(_0x1e2ce5,_0x184332){return util[_0x4ba3('0x29')]('SIP/%s',_0x1e2ce5['name']);});for(var _0x2278b0 in _0x2519bb){if(_0x2519bb['hasOwnProperty'](_0x2278b0)){if(!_0xe4eff9[_0x2278b0]){delete _0x2519bb[_0x2278b0];}}}}function freeIsNotKeyAgent(_0x18dff5,_0x163967){var _0x413bb3=_[_0x4ba3('0x28')](_0x18dff5,function(_0x46f1f5,_0x278a23){var _0x4a0823=_[_0x4ba3('0x2a')](_0x46f1f5[_0x4ba3('0x2b')])?util['format'](_0x4ba3('0x2c'),_0x46f1f5['name']):_0x46f1f5[_0x4ba3('0x2b')];return _0x4a0823;});for(var _0x18abb3 in _0x163967){if(_0x163967[_0x4ba3('0x27')](_0x18abb3)){if(!_0x413bb3[_0x18abb3]){delete _0x163967[_0x18abb3];}}}}function clearVoiceCallReports(_0x37e6f3){_0x37e6f3[_0x4ba3('0x2d')]=0x0;_0x37e6f3[_0x4ba3('0x2e')]=0x0;_0x37e6f3[_0x4ba3('0x2f')]=0x0;_0x37e6f3[_0x4ba3('0x30')]=0x0;_0x37e6f3[_0x4ba3('0x31')]=0x0;}function clearCampaigns(_0x2e67a0){if(!_['isEmpty'](_0x2e67a0)){for(var _0x252f37 in _0x2e67a0){if(_0x2e67a0[_0x4ba3('0x27')](_0x252f37)){_0x2e67a0[_0x252f37][_0x4ba3('0x32')]=0x0;_0x2e67a0[_0x252f37]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x10537e){if(!_[_0x4ba3('0x33')](_0x10537e)){for(var _0x44d78c in _0x10537e){if(_0x10537e['hasOwnProperty'](_0x44d78c)){_0x10537e[_0x44d78c][_0x4ba3('0x2d')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x2e')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x34')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x35')]=0x0;_0x10537e[_0x44d78c]['sumHoldTime']=0x0;_0x10537e[_0x44d78c]['sumDuration']=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x31')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x36')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x37')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x38')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x39')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3a')]=0x0;_0x10537e[_0x44d78c]['outboundUnknownCallsDay']=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3b')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3c')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3d')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3e')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x3f')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x40')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x36')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x41')]=0x0;_0x10537e[_0x44d78c][_0x4ba3('0x42')]=!![];}}}}Realtime[_0x4ba3('0x43')]['mergeFromDatabase']=function(_0x5a453f,_0x4e2af0){for(var _0x2d226a in _0x4e2af0){if(_0x5a453f[_0x4ba3('0x27')](_0x2d226a)){_0x5a453f[_0x2d226a]=_0x4e2af0[_0x2d226a];}}};Realtime[_0x4ba3('0x43')][_0x4ba3('0x44')]=function(){var _0x3eea33=this;return function(_0x137f9b){if(_0x137f9b){freeIsNotKeyAgent(_0x137f9b,_0x3eea33[_0x4ba3('0x12')]);for(var _0xe1abe8=0x0,_0x2f3495={},_0x3dfe4b={};_0xe1abe8<_0x137f9b[_0x4ba3('0x45')];_0xe1abe8+=0x1){_0x2f3495=_0x137f9b[_0xe1abe8];var _0x3439cb=_['isNil'](_0x2f3495[_0x4ba3('0x2b')])?util[_0x4ba3('0x29')](_0x4ba3('0x2c'),_0x2f3495['name']):_0x2f3495[_0x4ba3('0x2b')];if(_['isUndefined'](_0x3eea33[_0x4ba3('0x12')][_0x3439cb])){_0x3eea33[_0x4ba3('0x12')][_0x3439cb]=new Agent(_0x2f3495);}else{_0x3eea33[_0x4ba3('0x46')](_0x3eea33[_0x4ba3('0x12')][_0x3439cb],_0x2f3495);}}}return _0x3eea33[_0x4ba3('0x12')];};};Realtime[_0x4ba3('0x43')]['initTelephones']=function(){var _0x336d6d=this;return function(_0x3cf56c){if(_0x3cf56c){freeIsNotKeySip(_0x3cf56c,_0x336d6d[_0x4ba3('0x13')]);for(var _0x4b702b=0x0,_0x1865b8={},_0x40ab62={};_0x4b702b<_0x3cf56c['length'];_0x4b702b+=0x1){_0x1865b8=_0x3cf56c[_0x4b702b];if(_[_0x4ba3('0x47')](_0x336d6d['telephones'][util['format'](_0x4ba3('0x2c'),_0x1865b8[_0x4ba3('0x48')])])){_0x336d6d[_0x4ba3('0x13')][util[_0x4ba3('0x29')](_0x4ba3('0x2c'),_0x1865b8['name'])]=new Telephone(_0x1865b8);}else{_0x336d6d[_0x4ba3('0x46')](_0x336d6d[_0x4ba3('0x13')][util[_0x4ba3('0x29')](_0x4ba3('0x2c'),_0x1865b8[_0x4ba3('0x48')])],_0x1865b8);}}}return _0x336d6d[_0x4ba3('0x13')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x49')]=function(){var _0x553475=this;return function(_0x30718b){if(_0x30718b){freeIsNotKeySip(_0x30718b,_0x553475[_0x4ba3('0x14')]);for(var _0x3cb07f=0x0,_0x3338d9={},_0xa1757={};_0x3cb07f<_0x30718b[_0x4ba3('0x45')];_0x3cb07f+=0x1){_0x3338d9=_0x30718b[_0x3cb07f];if(_[_0x4ba3('0x47')](_0x553475[_0x4ba3('0x14')][util[_0x4ba3('0x29')](_0x4ba3('0x2c'),_0x3338d9[_0x4ba3('0x48')])])){_0x553475[_0x4ba3('0x14')][util[_0x4ba3('0x29')](_0x4ba3('0x2c'),_0x3338d9['name'])]=new Trunk(_0x3338d9);}else{_0x553475['mergeFromDatabase'](_0x553475['trunks'][util['format']('SIP/%s',_0x3338d9[_0x4ba3('0x48')])],_0x3338d9);}}}return _0x553475['trunks'];};};Realtime[_0x4ba3('0x43')]['initVoiceQueues']=function(){var _0x53d6eb=this;return function(_0x2ac317){if(_0x2ac317){freeIsNotKey(_0x2ac317,_0x53d6eb[_0x4ba3('0x15')],_0x4ba3('0x48'));for(var _0xc1ca4b=0x0,_0x5a56a5={},_0x138467={};_0xc1ca4b<_0x2ac317['length'];_0xc1ca4b+=0x1){_0x5a56a5=_0x2ac317[_0xc1ca4b];if(_[_0x4ba3('0x47')](_0x53d6eb['voiceQueues'][_0x5a56a5[_0x4ba3('0x48')]])){_0x53d6eb[_0x4ba3('0x15')][_0x5a56a5[_0x4ba3('0x48')]]=new VoiceQueue(_0x5a56a5);}else{_0x53d6eb[_0x4ba3('0x46')](_0x53d6eb[_0x4ba3('0x15')][_0x5a56a5[_0x4ba3('0x48')]],_0x5a56a5);}}}return _0x53d6eb[_0x4ba3('0x15')];};};Realtime['prototype'][_0x4ba3('0x4a')]=function(){var _0x13cc06=this;return function(_0x1e418c){if(_0x1e418c){freeIsNotKey(_0x1e418c,_0x13cc06[_0x4ba3('0x16')],'id');for(var _0x24986a=0x0,_0x480668={},_0x56b55d={};_0x24986a<_0x1e418c[_0x4ba3('0x45')];_0x24986a+=0x1){_0x480668=_0x1e418c[_0x24986a];if(_[_0x4ba3('0x47')](_0x13cc06[_0x4ba3('0x16')][_0x480668['id']])){_0x13cc06['triggers'][_0x480668['id']]=new Trigger(_0x480668);}else{_0x13cc06[_0x4ba3('0x46')](_0x13cc06[_0x4ba3('0x16')][_0x480668['id']],_0x480668);}}}return _0x13cc06[_0x4ba3('0x16')];};};Realtime['prototype']['initTemplates']=function(){var _0x34dc04=this;return function(_0x482a83){if(_0x482a83){freeIsNotKey(_0x482a83,_0x34dc04[_0x4ba3('0x17')],'id');for(var _0x1b9f76=0x0,_0x1aab37={},_0x30eb6e={};_0x1b9f76<_0x482a83[_0x4ba3('0x45')];_0x1b9f76+=0x1){_0x1aab37=_0x482a83[_0x1b9f76];if(_[_0x4ba3('0x47')](_0x34dc04['templates'][_0x1aab37['id']])){_0x34dc04[_0x4ba3('0x17')][_0x1aab37['id']]=new Template(_0x1aab37);}else{_0x34dc04[_0x4ba3('0x46')](_0x34dc04['templates'][_0x1aab37['id']],_0x1aab37);}}}return _0x34dc04[_0x4ba3('0x17')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x4b')]=function(){var _0x19d6a3=this;return function(_0x360472){if(_0x360472){freeIsNotKey(_0x360472,_0x19d6a3['zendeskAccounts'],'id');for(var _0x37a312=0x0,_0x38de05={},_0x588ee1={};_0x37a312<_0x360472[_0x4ba3('0x45')];_0x37a312+=0x1){_0x38de05=_0x360472[_0x37a312];if(_[_0x4ba3('0x47')](_0x19d6a3[_0x4ba3('0x1c')][_0x38de05['id']])){_0x19d6a3[_0x4ba3('0x1c')][_0x38de05['id']]=new ZendeskAccount(_0x38de05);}else{_0x19d6a3[_0x4ba3('0x46')](_0x19d6a3[_0x4ba3('0x1c')][_0x38de05['id']],_0x38de05);}}}return _0x19d6a3[_0x4ba3('0x1c')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x4c')]=function(){var _0x428a27=this;return function(_0x6ad6aa){if(_0x6ad6aa){freeIsNotKey(_0x6ad6aa,_0x428a27[_0x4ba3('0x1d')],'id');for(var _0x438ce3=0x0,_0x22890a={},_0x2795df={};_0x438ce3<_0x6ad6aa['length'];_0x438ce3+=0x1){_0x22890a=_0x6ad6aa[_0x438ce3];if(_['isUndefined'](_0x428a27['salesforceAccounts'][_0x22890a['id']])){_0x428a27[_0x4ba3('0x1d')][_0x22890a['id']]=new SalesforceAccount(_0x22890a);}else{_0x428a27[_0x4ba3('0x46')](_0x428a27[_0x4ba3('0x1d')][_0x22890a['id']],_0x22890a);}}}return _0x428a27[_0x4ba3('0x1d')];};};Realtime[_0x4ba3('0x43')]['initFreshdeskAccounts']=function(){var _0x3920c0=this;return function(_0x4620ae){if(_0x4620ae){freeIsNotKey(_0x4620ae,_0x3920c0[_0x4ba3('0x1f')],'id');for(var _0x42a443=0x0,_0x5359d1={},_0x1e83fb={};_0x42a443<_0x4620ae[_0x4ba3('0x45')];_0x42a443+=0x1){_0x5359d1=_0x4620ae[_0x42a443];if(_[_0x4ba3('0x47')](_0x3920c0[_0x4ba3('0x1f')][_0x5359d1['id']])){_0x3920c0[_0x4ba3('0x1f')][_0x5359d1['id']]=new FreshdeskAccount(_0x5359d1);}else{_0x3920c0[_0x4ba3('0x46')](_0x3920c0[_0x4ba3('0x1f')][_0x5359d1['id']],_0x5359d1);}}}return _0x3920c0[_0x4ba3('0x1f')];};};Realtime[_0x4ba3('0x43')]['initZohoAccounts']=function(){var _0x20c849=this;return function(_0x42bb4b){if(_0x42bb4b){freeIsNotKey(_0x42bb4b,_0x20c849[_0x4ba3('0x20')],'id');for(var _0x451696=0x0,_0x22d5ca={},_0x3d3313={};_0x451696<_0x42bb4b[_0x4ba3('0x45')];_0x451696+=0x1){_0x22d5ca=_0x42bb4b[_0x451696];if(_[_0x4ba3('0x47')](_0x20c849['zohoAccounts'][_0x22d5ca['id']])){_0x20c849[_0x4ba3('0x20')][_0x22d5ca['id']]=new ZohoAccount(_0x22d5ca);}else{_0x20c849[_0x4ba3('0x46')](_0x20c849[_0x4ba3('0x20')][_0x22d5ca['id']],_0x22d5ca);}}}return _0x20c849['zohoAccounts'];};};Realtime[_0x4ba3('0x43')]['initDeskAccounts']=function(){var _0x1b7c4e=this;return function(_0x4cc10a){if(_0x4cc10a){freeIsNotKey(_0x4cc10a,_0x1b7c4e[_0x4ba3('0x21')],'id');for(var _0x369a9f=0x0,_0xf0fd32={},_0x4b5289={};_0x369a9f<_0x4cc10a[_0x4ba3('0x45')];_0x369a9f+=0x1){_0xf0fd32=_0x4cc10a[_0x369a9f];if(_[_0x4ba3('0x47')](_0x1b7c4e[_0x4ba3('0x21')][_0xf0fd32['id']])){_0x1b7c4e[_0x4ba3('0x21')][_0xf0fd32['id']]=new DeskAccount(_0xf0fd32);}else{_0x1b7c4e[_0x4ba3('0x46')](_0x1b7c4e['deskAccounts'][_0xf0fd32['id']],_0xf0fd32);}}}return _0x1b7c4e[_0x4ba3('0x21')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x4d')]=function(){var _0x469ef0=this;return function(_0x454a0a){if(_0x454a0a){freeIsNotKey(_0x454a0a,_0x469ef0[_0x4ba3('0x1e')],'id');for(var _0x3fdf7f=0x0,_0x38699e={},_0x39ddf3={};_0x3fdf7f<_0x454a0a[_0x4ba3('0x45')];_0x3fdf7f+=0x1){_0x38699e=_0x454a0a[_0x3fdf7f];if(_[_0x4ba3('0x47')](_0x469ef0['sugarcrmAccounts'][_0x38699e['id']])){_0x469ef0[_0x4ba3('0x1e')][_0x38699e['id']]=new SugarcrmAccount(_0x38699e);}else{_0x469ef0[_0x4ba3('0x46')](_0x469ef0['sugarcrmAccounts'][_0x38699e['id']],_0x38699e);}}}return _0x469ef0['sugarcrmAccounts'];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x4e')]=function(){var _0x5c7c2f=this;return function(_0x220c83){if(_0x220c83){freeIsNotKey(_0x220c83,_0x5c7c2f[_0x4ba3('0x22')],'id');for(var _0x1fb2aa=0x0,_0x589214={},_0x1f5815={};_0x1fb2aa<_0x220c83[_0x4ba3('0x45')];_0x1fb2aa+=0x1){_0x589214=_0x220c83[_0x1fb2aa];if(_[_0x4ba3('0x47')](_0x5c7c2f[_0x4ba3('0x22')][_0x589214['id']])){_0x5c7c2f[_0x4ba3('0x22')][_0x589214['id']]=new VtigerAccount(_0x589214);}else{_0x5c7c2f[_0x4ba3('0x46')](_0x5c7c2f['vtigerAccounts'][_0x589214['id']],_0x589214);}}}return _0x5c7c2f[_0x4ba3('0x22')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x4f')]=function(){var _0x4e5bd7=this;return function(_0x3de990){if(_0x3de990){freeIsNotKey(_0x3de990,_0x4e5bd7[_0x4ba3('0x23')],'id');for(var _0x385cee=0x0,_0x24f035={},_0x21c8b1={};_0x385cee<_0x3de990[_0x4ba3('0x45')];_0x385cee+=0x1){_0x24f035=_0x3de990[_0x385cee];if(_[_0x4ba3('0x47')](_0x4e5bd7[_0x4ba3('0x23')][_0x24f035['id']])){_0x4e5bd7['servicenowAccounts'][_0x24f035['id']]=new ServicenowAccount(_0x24f035);}else{_0x4e5bd7['mergeFromDatabase'](_0x4e5bd7[_0x4ba3('0x23')][_0x24f035['id']],_0x24f035);}}}return _0x4e5bd7['servicenowAccounts'];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x50')]=function(){var _0x442d66=this;return function(_0x5c7fc2){if(_0x5c7fc2){freeIsNotKey(_0x5c7fc2,_0x442d66[_0x4ba3('0x24')],'id');for(var _0x1679f3=0x0,_0x1b444e={},_0x5baf26={};_0x1679f3<_0x5c7fc2[_0x4ba3('0x45')];_0x1679f3+=0x1){_0x1b444e=_0x5c7fc2[_0x1679f3];if(_['isUndefined'](_0x442d66[_0x4ba3('0x24')][_0x1b444e['id']])){_0x442d66[_0x4ba3('0x24')][_0x1b444e['id']]=new Dynamics365Account(_0x1b444e);}else{_0x442d66['mergeFromDatabase'](_0x442d66[_0x4ba3('0x24')][_0x1b444e['id']],_0x1b444e);}}}return _0x442d66[_0x4ba3('0x24')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x51')]=function(){var _0x2feb68=this;return function(_0xa9a35d){if(_0xa9a35d){freeIsNotKey(_0xa9a35d,_0x2feb68[_0x4ba3('0x25')],'id');for(var _0x329874=0x0,_0x360127={},_0x5c9eda={};_0x329874<_0xa9a35d[_0x4ba3('0x45')];_0x329874+=0x1){_0x360127=_0xa9a35d[_0x329874];if(_[_0x4ba3('0x47')](_0x2feb68[_0x4ba3('0x25')][_0x360127['id']])){_0x2feb68[_0x4ba3('0x25')][_0x360127['id']]=new FreshsalesAccount(_0x360127);}else{_0x2feb68[_0x4ba3('0x46')](_0x2feb68[_0x4ba3('0x25')][_0x360127['id']],_0x360127);}}}return _0x2feb68[_0x4ba3('0x25')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x52')]=function(){var _0x1a3180=this;return function(_0x468219){for(var _0x3ab4bd=0x0;_0x3ab4bd<_0x468219['length'];_0x3ab4bd+=0x1){_[_0x4ba3('0x53')](_0x1a3180[_0x4ba3('0x15')][_0x468219[_0x3ab4bd]['name']],_0x468219[_0x3ab4bd]);}return _0x1a3180[_0x4ba3('0x15')];};};Realtime[_0x4ba3('0x43')]['initVoiceQueueReports']=function(){var _0x54c96a=this;return function(_0x4ce27){clearVoiceQueues(_0x54c96a[_0x4ba3('0x15')]);if(_0x4ce27){_0x4ce27=_[_0x4ba3('0x54')](_0x4ce27,_0x4ba3('0x55'));for(var _0x37b966 in _0x4ce27){if(_0x4ce27[_0x4ba3('0x27')](_0x37b966)){var _0x2a6bb9={};for(var _0x1246bc=0x0;_0x1246bc<_0x4ce27[_0x37b966]['length'];_0x1246bc+=0x1){var _0x272480=_0x4ce27[_0x37b966][_0x1246bc]['queue'];if(_0x54c96a[_0x4ba3('0x15')][_0x272480]){if(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x56')]){_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x34')]+=0x1;}if(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x57')]){_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x35')]+=0x1;}_0x54c96a[_0x4ba3('0x15')][_0x272480]['sumHoldTime']+=moment(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x58')])[_0x4ba3('0x59')](moment(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x5a')]),'seconds')||0x0;if(_0x1246bc===_0x4ce27[_0x37b966][_0x4ba3('0x45')]-0x1){_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x30')]+=moment(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x5b')]||_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x5c')]||_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x5d')])[_0x4ba3('0x59')](moment(_0x4ce27[_0x37b966][_0x1246bc]['queuecallerjoinAt']),'seconds')||0x0;_0x54c96a[_0x4ba3('0x15')][_0x272480]['total']+=0x1;if(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x5e')]){_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x2e')]+=0x1;_0x54c96a[_0x4ba3('0x15')][_0x272480]['sumBillable']+=moment(_0x4ce27[_0x37b966][_0x1246bc]['queuecallercompleteAt'])[_0x4ba3('0x59')](moment(_0x4ce27[_0x37b966][_0x1246bc][_0x4ba3('0x58')]),'seconds')||0x0;}}else{_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x30')]+=_0x54c96a[_0x4ba3('0x15')][_0x272480][_0x4ba3('0x2f')]||0x0;}}}}}}return _0x54c96a[_0x4ba3('0x15')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x5f')]=function(){var _0x489c19=this;return function(_0x18da09){clearVoiceCallReports(_0x489c19[_0x4ba3('0x18')]);if(_0x18da09){for(var _0x211d2b=0x0;_0x211d2b<_0x18da09['length'];_0x211d2b+=0x1){_0x489c19[_0x4ba3('0x18')][_0x4ba3('0x2d')]+=0x1;_0x489c19['outbound'][_0x4ba3('0x30')]+=_0x18da09[_0x211d2b][_0x4ba3('0x60')];if(_0x18da09[_0x211d2b]['disposition']==='ANSWERED'){_0x489c19['outbound']['answered']+=0x1;_0x489c19[_0x4ba3('0x18')][_0x4ba3('0x2f')]+=_0x18da09[_0x211d2b][_0x4ba3('0x60')]-_0x18da09[_0x211d2b][_0x4ba3('0x61')]||0x0;_0x489c19[_0x4ba3('0x18')][_0x4ba3('0x31')]+=_0x18da09[_0x211d2b][_0x4ba3('0x61')];}}}return _0x489c19['outbound'];};};Realtime[_0x4ba3('0x43')]['initCampaigns']=function(){var _0x31a725=this;return function(_0x5180f1){if(_0x5180f1){freeIsNotKey(_0x5180f1,_0x31a725[_0x4ba3('0x62')],_0x4ba3('0x48'));for(var _0x88b6a2=0x0,_0x1f824e={};_0x88b6a2<_0x5180f1[_0x4ba3('0x45')];_0x88b6a2+=0x1){_0x1f824e=_0x5180f1[_0x88b6a2];if(_['isUndefined'](_0x31a725['campaigns'][_0x1f824e[_0x4ba3('0x48')]])){_0x31a725[_0x4ba3('0x62')][_0x1f824e[_0x4ba3('0x48')]]=new Campaign(_0x1f824e);}else{_0x31a725[_0x4ba3('0x46')](_0x31a725[_0x4ba3('0x62')][_0x1f824e[_0x4ba3('0x48')]],_0x1f824e);_0x31a725[_0x4ba3('0x62')][_0x1f824e[_0x4ba3('0x48')]][_0x4ba3('0x63')]=_0x1f824e[_0x4ba3('0x64')]?_0x1f824e[_0x4ba3('0x64')][_0x4ba3('0x48')]:undefined;}}}return _0x31a725['campaigns'];};};Realtime[_0x4ba3('0x43')]['initVoiceExtensions']=function(){var _0x3f5309=this;return function(_0x44568e){if(_0x44568e){freeIsNotKey(_0x44568e,_0x3f5309[_0x4ba3('0x65')],'id');for(var _0x1e9bec=0x0,_0x48cd14={};_0x1e9bec<_0x44568e[_0x4ba3('0x45')];_0x1e9bec+=0x1){_0x48cd14=_0x44568e[_0x1e9bec];if(_[_0x4ba3('0x47')](_0x3f5309[_0x4ba3('0x65')][_0x48cd14['id']])){_0x3f5309[_0x4ba3('0x65')][_0x48cd14['id']]=new VoiceExtension(_0x48cd14);}else{_0x3f5309['mergeFromDatabase'](_0x3f5309['voiceExtensions'][_0x48cd14['id']],_0x48cd14);}}}return _0x3f5309[_0x4ba3('0x65')];};};Realtime[_0x4ba3('0x43')][_0x4ba3('0x66')]=function(){var _0x5db456=this;return function(_0x2f793a){clearCampaigns(_0x5db456[_0x4ba3('0x62')]);for(var _0x22a9fb=0x0;_0x22a9fb<_0x2f793a[_0x4ba3('0x45')];_0x22a9fb+=0x1){_[_0x4ba3('0x53')](_0x5db456[_0x4ba3('0x62')][_0x2f793a[_0x22a9fb]['name']],_0x2f793a[_0x22a9fb]);}return _0x5db456[_0x4ba3('0x62')];};};Realtime['prototype'][_0x4ba3('0x67')]=function(){var _0xa3e849=this;return function(_0x11b757){if(_0x11b757){freeIsNotKey(_0x11b757,_0xa3e849[_0x4ba3('0x26')],'id');for(var _0x48cb1a=0x0,_0x11be49={},_0x3bbcfb={};_0x48cb1a<_0x11b757['length'];_0x48cb1a+=0x1){_0x11be49=_0x11b757[_0x48cb1a];if(_[_0x4ba3('0x47')](_0xa3e849['faxAccounts'][_0x11be49['id']])){_0xa3e849[_0x4ba3('0x26')][_0x11be49['id']]=new FaxAccount(_0x11be49);}else{_0xa3e849[_0x4ba3('0x46')](_0xa3e849[_0x4ba3('0x26')][_0x11be49['id']],_0x11be49);}}}return _0xa3e849[_0x4ba3('0x26')];};};module[_0x4ba3('0x68')]=Realtime; \ No newline at end of file +var _0xf31b=['queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','SIP/%s','name','isNil','interface','format','total','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','uniqueid','queue','unmanaged','queuecallerabandon'];(function(_0x5bccd3,_0x4e2b7b){var _0x322dbc=function(_0x2f7b82){while(--_0x2f7b82){_0x5bccd3['push'](_0x5bccd3['shift']());}};_0x322dbc(++_0x4e2b7b);}(_0xf31b,0x1a0));var _0xbf31=function(_0x487d9b,_0x3bc158){_0x487d9b=_0x487d9b-0x0;var _0x1c19bf=_0xf31b[_0x487d9b];return _0x1c19bf;};'use strict';var util=require(_0xbf31('0x0'));var _=require(_0xbf31('0x1'));var moment=require(_0xbf31('0x2'));var Agent=require(_0xbf31('0x3'));var Telephone=require(_0xbf31('0x4'));var Trunk=require(_0xbf31('0x5'));var VoiceQueue=require(_0xbf31('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xbf31('0x7'));var Campaign=require(_0xbf31('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xbf31('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xbf31('0xa'));var ZohoAccount=require(_0xbf31('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xbf31('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xbf31('0xd'));var FaxAccount=require(_0xbf31('0xe'));var Realtime=function(){this[_0xbf31('0xf')]={};this[_0xbf31('0x10')]={};this[_0xbf31('0x11')]={};this[_0xbf31('0x12')]={};this[_0xbf31('0x13')]={};this[_0xbf31('0x14')]={};this[_0xbf31('0x15')]={};this[_0xbf31('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbf31('0x17')]={};this[_0xbf31('0x18')]={};this[_0xbf31('0x19')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0xbf31('0x1a')]={};this[_0xbf31('0x1b')]={};this[_0xbf31('0x1c')]={};this[_0xbf31('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0xbf31('0x1e')]={};this[_0xbf31('0x1f')]={};this[_0xbf31('0x20')]={};this[_0xbf31('0x21')]={};};function freeIsNotKey(_0x3ffe46,_0x499036,_0xf2ffa4){var _0x5e9b58=_['mapKeys'](_0x3ffe46,function(_0x3b7439,_0x45c498){return _0x3b7439[_0xf2ffa4];});for(var _0x1cb0ce in _0x499036){if(_0x499036[_0xbf31('0x22')](_0x1cb0ce)){if(!_0x5e9b58[_0x1cb0ce]){delete _0x499036[_0x1cb0ce];}}}}function freeIsNotKeySip(_0x19878b,_0x522532){var _0x492ac3=_[_0xbf31('0x23')](_0x19878b,function(_0x219cdd,_0x150340){return util['format'](_0xbf31('0x24'),_0x219cdd[_0xbf31('0x25')]);});for(var _0xf968e5 in _0x522532){if(_0x522532[_0xbf31('0x22')](_0xf968e5)){if(!_0x492ac3[_0xf968e5]){delete _0x522532[_0xf968e5];}}}}function freeIsNotKeyAgent(_0x3b04c4,_0x5777d9){var _0x3f9260=_['mapKeys'](_0x3b04c4,function(_0x557cd6,_0x365824){var _0x126c55=_[_0xbf31('0x26')](_0x557cd6[_0xbf31('0x27')])?util[_0xbf31('0x28')](_0xbf31('0x24'),_0x557cd6['name']):_0x557cd6[_0xbf31('0x27')];return _0x126c55;});for(var _0xebb9bb in _0x5777d9){if(_0x5777d9[_0xbf31('0x22')](_0xebb9bb)){if(!_0x3f9260[_0xebb9bb]){delete _0x5777d9[_0xebb9bb];}}}}function clearVoiceCallReports(_0x2440a4){_0x2440a4[_0xbf31('0x29')]=0x0;_0x2440a4[_0xbf31('0x2a')]=0x0;_0x2440a4['sumHoldTime']=0x0;_0x2440a4[_0xbf31('0x2b')]=0x0;_0x2440a4[_0xbf31('0x2c')]=0x0;}function clearCampaigns(_0x106a9d){if(!_[_0xbf31('0x2d')](_0x106a9d)){for(var _0x224d71 in _0x106a9d){if(_0x106a9d['hasOwnProperty'](_0x224d71)){_0x106a9d[_0x224d71]['ivrTotalCallsDays']=0x0;_0x106a9d[_0x224d71][_0xbf31('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x1a17f4){if(!_[_0xbf31('0x2d')](_0x1a17f4)){for(var _0x38712c in _0x1a17f4){if(_0x1a17f4['hasOwnProperty'](_0x38712c)){_0x1a17f4[_0x38712c]['total']=0x0;_0x1a17f4[_0x38712c]['answered']=0x0;_0x1a17f4[_0x38712c]['unmanaged']=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x2f')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x30')]=0x0;_0x1a17f4[_0x38712c]['sumDuration']=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x2c')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x31')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x32')]=0x0;_0x1a17f4[_0x38712c]['outboundBusyCallsDay']=0x0;_0x1a17f4[_0x38712c]['outboundCongestionCallsDay']=0x0;_0x1a17f4[_0x38712c]['outboundNoSuchCallsDay']=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x33')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x34')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x35')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x36')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x37')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x38')]=0x0;_0x1a17f4[_0x38712c]['outboundReCallsDay']=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x31')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x39')]=0x0;_0x1a17f4[_0x38712c][_0xbf31('0x3a')]=!![];}}}}Realtime[_0xbf31('0x3b')][_0xbf31('0x3c')]=function(_0x1f9a35,_0x5ab382){for(var _0x6dfc16 in _0x5ab382){if(_0x1f9a35['hasOwnProperty'](_0x6dfc16)){_0x1f9a35[_0x6dfc16]=_0x5ab382[_0x6dfc16];}}};Realtime['prototype'][_0xbf31('0x3d')]=function(){var _0x30c84c=this;return function(_0x12abb0){if(_0x12abb0){freeIsNotKeyAgent(_0x12abb0,_0x30c84c['agents']);for(var _0x391746=0x0,_0x18d6e4={},_0x41bfa9={};_0x391746<_0x12abb0[_0xbf31('0x3e')];_0x391746+=0x1){_0x18d6e4=_0x12abb0[_0x391746];var _0x421d2e=_[_0xbf31('0x26')](_0x18d6e4[_0xbf31('0x27')])?util['format'](_0xbf31('0x24'),_0x18d6e4[_0xbf31('0x25')]):_0x18d6e4[_0xbf31('0x27')];if(_[_0xbf31('0x3f')](_0x30c84c[_0xbf31('0xf')][_0x421d2e])){_0x30c84c['agents'][_0x421d2e]=new Agent(_0x18d6e4);}else{_0x30c84c['mergeFromDatabase'](_0x30c84c[_0xbf31('0xf')][_0x421d2e],_0x18d6e4);}}}return _0x30c84c[_0xbf31('0xf')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x40')]=function(){var _0x83eae2=this;return function(_0x3745d4){if(_0x3745d4){freeIsNotKeySip(_0x3745d4,_0x83eae2['telephones']);for(var _0x343f72=0x0,_0x1a16d2={},_0x1877b5={};_0x343f72<_0x3745d4[_0xbf31('0x3e')];_0x343f72+=0x1){_0x1a16d2=_0x3745d4[_0x343f72];if(_[_0xbf31('0x3f')](_0x83eae2['telephones'][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x1a16d2['name'])])){_0x83eae2['telephones'][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x1a16d2['name'])]=new Telephone(_0x1a16d2);}else{_0x83eae2[_0xbf31('0x3c')](_0x83eae2[_0xbf31('0x10')][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x1a16d2[_0xbf31('0x25')])],_0x1a16d2);}}}return _0x83eae2[_0xbf31('0x10')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x41')]=function(){var _0x1446bf=this;return function(_0x57c546){if(_0x57c546){freeIsNotKeySip(_0x57c546,_0x1446bf[_0xbf31('0x11')]);for(var _0x4ed9b6=0x0,_0x5b35cd={},_0x1f8d32={};_0x4ed9b6<_0x57c546[_0xbf31('0x3e')];_0x4ed9b6+=0x1){_0x5b35cd=_0x57c546[_0x4ed9b6];if(_[_0xbf31('0x3f')](_0x1446bf[_0xbf31('0x11')][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x5b35cd[_0xbf31('0x25')])])){_0x1446bf[_0xbf31('0x11')][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x5b35cd[_0xbf31('0x25')])]=new Trunk(_0x5b35cd);}else{_0x1446bf[_0xbf31('0x3c')](_0x1446bf[_0xbf31('0x11')][util[_0xbf31('0x28')](_0xbf31('0x24'),_0x5b35cd[_0xbf31('0x25')])],_0x5b35cd);}}}return _0x1446bf[_0xbf31('0x11')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x42')]=function(){var _0x565a8a=this;return function(_0xed81d5){if(_0xed81d5){freeIsNotKey(_0xed81d5,_0x565a8a['voiceQueues'],'name');for(var _0x1e17a6=0x0,_0x384976={},_0x4179b4={};_0x1e17a6<_0xed81d5[_0xbf31('0x3e')];_0x1e17a6+=0x1){_0x384976=_0xed81d5[_0x1e17a6];if(_['isUndefined'](_0x565a8a[_0xbf31('0x12')][_0x384976[_0xbf31('0x25')]])){_0x565a8a[_0xbf31('0x12')][_0x384976[_0xbf31('0x25')]]=new VoiceQueue(_0x384976);}else{_0x565a8a['mergeFromDatabase'](_0x565a8a[_0xbf31('0x12')][_0x384976[_0xbf31('0x25')]],_0x384976);}}}return _0x565a8a[_0xbf31('0x12')];};};Realtime[_0xbf31('0x3b')]['initTriggers']=function(){var _0x3dee0c=this;return function(_0xe15074){if(_0xe15074){freeIsNotKey(_0xe15074,_0x3dee0c[_0xbf31('0x13')],'id');for(var _0x366126=0x0,_0x6a3443={},_0x517d00={};_0x366126<_0xe15074[_0xbf31('0x3e')];_0x366126+=0x1){_0x6a3443=_0xe15074[_0x366126];if(_[_0xbf31('0x3f')](_0x3dee0c[_0xbf31('0x13')][_0x6a3443['id']])){_0x3dee0c[_0xbf31('0x13')][_0x6a3443['id']]=new Trigger(_0x6a3443);}else{_0x3dee0c[_0xbf31('0x3c')](_0x3dee0c[_0xbf31('0x13')][_0x6a3443['id']],_0x6a3443);}}}return _0x3dee0c[_0xbf31('0x13')];};};Realtime['prototype'][_0xbf31('0x43')]=function(){var _0x222baa=this;return function(_0x338cb2){if(_0x338cb2){freeIsNotKey(_0x338cb2,_0x222baa[_0xbf31('0x15')],'id');for(var _0x5ef472=0x0,_0x33d6f0={},_0x967c63={};_0x5ef472<_0x338cb2[_0xbf31('0x3e')];_0x5ef472+=0x1){_0x33d6f0=_0x338cb2[_0x5ef472];if(_[_0xbf31('0x3f')](_0x222baa[_0xbf31('0x15')][_0x33d6f0['id']])){_0x222baa['templates'][_0x33d6f0['id']]=new Template(_0x33d6f0);}else{_0x222baa[_0xbf31('0x3c')](_0x222baa['templates'][_0x33d6f0['id']],_0x33d6f0);}}}return _0x222baa['templates'];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x44')]=function(){var _0x2c6c13=this;return function(_0x4d9ec5){if(_0x4d9ec5){freeIsNotKey(_0x4d9ec5,_0x2c6c13[_0xbf31('0x45')],'id');for(var _0x131cd8=0x0,_0x1841fd={},_0x147217={};_0x131cd8<_0x4d9ec5['length'];_0x131cd8+=0x1){_0x1841fd=_0x4d9ec5[_0x131cd8];if(_[_0xbf31('0x3f')](_0x2c6c13['zendeskAccounts'][_0x1841fd['id']])){_0x2c6c13[_0xbf31('0x45')][_0x1841fd['id']]=new ZendeskAccount(_0x1841fd);}else{_0x2c6c13[_0xbf31('0x3c')](_0x2c6c13['zendeskAccounts'][_0x1841fd['id']],_0x1841fd);}}}return _0x2c6c13['zendeskAccounts'];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x46')]=function(){var _0xb2e8e=this;return function(_0x351d69){if(_0x351d69){freeIsNotKey(_0x351d69,_0xb2e8e['salesforceAccounts'],'id');for(var _0x19c95f=0x0,_0x5ebaa7={},_0x5abee8={};_0x19c95f<_0x351d69[_0xbf31('0x3e')];_0x19c95f+=0x1){_0x5ebaa7=_0x351d69[_0x19c95f];if(_[_0xbf31('0x3f')](_0xb2e8e[_0xbf31('0x1a')][_0x5ebaa7['id']])){_0xb2e8e[_0xbf31('0x1a')][_0x5ebaa7['id']]=new SalesforceAccount(_0x5ebaa7);}else{_0xb2e8e[_0xbf31('0x3c')](_0xb2e8e[_0xbf31('0x1a')][_0x5ebaa7['id']],_0x5ebaa7);}}}return _0xb2e8e['salesforceAccounts'];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x47')]=function(){var _0x35716b=this;return function(_0x4b65c8){if(_0x4b65c8){freeIsNotKey(_0x4b65c8,_0x35716b[_0xbf31('0x1c')],'id');for(var _0x22f21e=0x0,_0x43dc69={},_0x5df02b={};_0x22f21e<_0x4b65c8['length'];_0x22f21e+=0x1){_0x43dc69=_0x4b65c8[_0x22f21e];if(_[_0xbf31('0x3f')](_0x35716b[_0xbf31('0x1c')][_0x43dc69['id']])){_0x35716b[_0xbf31('0x1c')][_0x43dc69['id']]=new FreshdeskAccount(_0x43dc69);}else{_0x35716b[_0xbf31('0x3c')](_0x35716b['freshdeskAccounts'][_0x43dc69['id']],_0x43dc69);}}}return _0x35716b[_0xbf31('0x1c')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x48')]=function(){var _0x5a995e=this;return function(_0x42fb7f){if(_0x42fb7f){freeIsNotKey(_0x42fb7f,_0x5a995e[_0xbf31('0x1d')],'id');for(var _0x2258c9=0x0,_0x7c5682={},_0x27edc1={};_0x2258c9<_0x42fb7f['length'];_0x2258c9+=0x1){_0x7c5682=_0x42fb7f[_0x2258c9];if(_[_0xbf31('0x3f')](_0x5a995e[_0xbf31('0x1d')][_0x7c5682['id']])){_0x5a995e['zohoAccounts'][_0x7c5682['id']]=new ZohoAccount(_0x7c5682);}else{_0x5a995e[_0xbf31('0x3c')](_0x5a995e[_0xbf31('0x1d')][_0x7c5682['id']],_0x7c5682);}}}return _0x5a995e[_0xbf31('0x1d')];};};Realtime[_0xbf31('0x3b')]['initDeskAccounts']=function(){var _0x4a1911=this;return function(_0x5e470){if(_0x5e470){freeIsNotKey(_0x5e470,_0x4a1911[_0xbf31('0x49')],'id');for(var _0x184b6c=0x0,_0x3132c1={},_0x501611={};_0x184b6c<_0x5e470[_0xbf31('0x3e')];_0x184b6c+=0x1){_0x3132c1=_0x5e470[_0x184b6c];if(_[_0xbf31('0x3f')](_0x4a1911[_0xbf31('0x49')][_0x3132c1['id']])){_0x4a1911[_0xbf31('0x49')][_0x3132c1['id']]=new DeskAccount(_0x3132c1);}else{_0x4a1911['mergeFromDatabase'](_0x4a1911[_0xbf31('0x49')][_0x3132c1['id']],_0x3132c1);}}}return _0x4a1911['deskAccounts'];};};Realtime['prototype'][_0xbf31('0x4a')]=function(){var _0x23f6e5=this;return function(_0x27f203){if(_0x27f203){freeIsNotKey(_0x27f203,_0x23f6e5['sugarcrmAccounts'],'id');for(var _0x15fed2=0x0,_0x1125b6={},_0x20bc76={};_0x15fed2<_0x27f203[_0xbf31('0x3e')];_0x15fed2+=0x1){_0x1125b6=_0x27f203[_0x15fed2];if(_[_0xbf31('0x3f')](_0x23f6e5[_0xbf31('0x1b')][_0x1125b6['id']])){_0x23f6e5[_0xbf31('0x1b')][_0x1125b6['id']]=new SugarcrmAccount(_0x1125b6);}else{_0x23f6e5[_0xbf31('0x3c')](_0x23f6e5[_0xbf31('0x1b')][_0x1125b6['id']],_0x1125b6);}}}return _0x23f6e5[_0xbf31('0x1b')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x4b')]=function(){var _0x18680f=this;return function(_0x49b566){if(_0x49b566){freeIsNotKey(_0x49b566,_0x18680f['vtigerAccounts'],'id');for(var _0x5da4c8=0x0,_0x1c827d={},_0x35952b={};_0x5da4c8<_0x49b566[_0xbf31('0x3e')];_0x5da4c8+=0x1){_0x1c827d=_0x49b566[_0x5da4c8];if(_[_0xbf31('0x3f')](_0x18680f[_0xbf31('0x4c')][_0x1c827d['id']])){_0x18680f[_0xbf31('0x4c')][_0x1c827d['id']]=new VtigerAccount(_0x1c827d);}else{_0x18680f[_0xbf31('0x3c')](_0x18680f['vtigerAccounts'][_0x1c827d['id']],_0x1c827d);}}}return _0x18680f[_0xbf31('0x4c')];};};Realtime[_0xbf31('0x3b')]['initServicenowAccounts']=function(){var _0x53d1c0=this;return function(_0x287d43){if(_0x287d43){freeIsNotKey(_0x287d43,_0x53d1c0['servicenowAccounts'],'id');for(var _0x32a189=0x0,_0x254156={},_0x4a001a={};_0x32a189<_0x287d43[_0xbf31('0x3e')];_0x32a189+=0x1){_0x254156=_0x287d43[_0x32a189];if(_['isUndefined'](_0x53d1c0['servicenowAccounts'][_0x254156['id']])){_0x53d1c0['servicenowAccounts'][_0x254156['id']]=new ServicenowAccount(_0x254156);}else{_0x53d1c0[_0xbf31('0x3c')](_0x53d1c0[_0xbf31('0x1e')][_0x254156['id']],_0x254156);}}}return _0x53d1c0[_0xbf31('0x1e')];};};Realtime['prototype'][_0xbf31('0x4d')]=function(){var _0x1d2289=this;return function(_0x241956){if(_0x241956){freeIsNotKey(_0x241956,_0x1d2289[_0xbf31('0x1f')],'id');for(var _0x575893=0x0,_0x539bc1={},_0x539bf6={};_0x575893<_0x241956[_0xbf31('0x3e')];_0x575893+=0x1){_0x539bc1=_0x241956[_0x575893];if(_[_0xbf31('0x3f')](_0x1d2289['dynamics365Accounts'][_0x539bc1['id']])){_0x1d2289[_0xbf31('0x1f')][_0x539bc1['id']]=new Dynamics365Account(_0x539bc1);}else{_0x1d2289[_0xbf31('0x3c')](_0x1d2289['dynamics365Accounts'][_0x539bc1['id']],_0x539bc1);}}}return _0x1d2289['dynamics365Accounts'];};};Realtime[_0xbf31('0x3b')]['initFreshsalesAccounts']=function(){var _0x4d2baf=this;return function(_0x1eb541){if(_0x1eb541){freeIsNotKey(_0x1eb541,_0x4d2baf[_0xbf31('0x20')],'id');for(var _0x52754e=0x0,_0x2809f8={},_0x2594c9={};_0x52754e<_0x1eb541[_0xbf31('0x3e')];_0x52754e+=0x1){_0x2809f8=_0x1eb541[_0x52754e];if(_[_0xbf31('0x3f')](_0x4d2baf[_0xbf31('0x20')][_0x2809f8['id']])){_0x4d2baf[_0xbf31('0x20')][_0x2809f8['id']]=new FreshsalesAccount(_0x2809f8);}else{_0x4d2baf[_0xbf31('0x3c')](_0x4d2baf[_0xbf31('0x20')][_0x2809f8['id']],_0x2809f8);}}}return _0x4d2baf[_0xbf31('0x20')];};};Realtime['prototype'][_0xbf31('0x4e')]=function(){var _0x28aa1b=this;return function(_0x1cafc0){for(var _0x283633=0x0;_0x283633<_0x1cafc0[_0xbf31('0x3e')];_0x283633+=0x1){_[_0xbf31('0x4f')](_0x28aa1b['voiceQueues'][_0x1cafc0[_0x283633]['name']],_0x1cafc0[_0x283633]);}return _0x28aa1b[_0xbf31('0x12')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x6f7151=this;return function(_0x2b648c){clearVoiceQueues(_0x6f7151[_0xbf31('0x12')]);if(_0x2b648c){_0x2b648c=_['groupBy'](_0x2b648c,_0xbf31('0x50'));for(var _0x33ee56 in _0x2b648c){if(_0x2b648c['hasOwnProperty'](_0x33ee56)){var _0x16b301={};for(var _0x5ed93b=0x0;_0x5ed93b<_0x2b648c[_0x33ee56]['length'];_0x5ed93b+=0x1){var _0x336c80=_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x51')];if(_0x6f7151[_0xbf31('0x12')][_0x336c80]){if(_0x2b648c[_0x33ee56][_0x5ed93b]['queuecallerexit']){_0x6f7151[_0xbf31('0x12')][_0x336c80][_0xbf31('0x52')]+=0x1;}if(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x53')]){_0x6f7151[_0xbf31('0x12')][_0x336c80][_0xbf31('0x2f')]+=0x1;}_0x6f7151[_0xbf31('0x12')][_0x336c80][_0xbf31('0x30')]+=moment(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x54')])[_0xbf31('0x55')](moment(_0x2b648c[_0x33ee56][_0x5ed93b]['queuecallerjoinAt']),_0xbf31('0x56'))||0x0;if(_0x5ed93b===_0x2b648c[_0x33ee56][_0xbf31('0x3e')]-0x1){_0x6f7151[_0xbf31('0x12')][_0x336c80][_0xbf31('0x2b')]+=moment(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x57')]||_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x58')]||_0x2b648c[_0x33ee56][_0x5ed93b]['queuecallerexitAt'])[_0xbf31('0x55')](moment(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x59')]),_0xbf31('0x56'))||0x0;_0x6f7151[_0xbf31('0x12')][_0x336c80][_0xbf31('0x29')]+=0x1;if(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x5a')]){_0x6f7151[_0xbf31('0x12')][_0x336c80]['answered']+=0x1;_0x6f7151[_0xbf31('0x12')][_0x336c80]['sumBillable']+=moment(_0x2b648c[_0x33ee56][_0x5ed93b]['queuecallercompleteAt'])[_0xbf31('0x55')](moment(_0x2b648c[_0x33ee56][_0x5ed93b][_0xbf31('0x54')]),_0xbf31('0x56'))||0x0;}}else{_0x6f7151['voiceQueues'][_0x336c80][_0xbf31('0x2b')]+=_0x6f7151['voiceQueues'][_0x336c80][_0xbf31('0x30')]||0x0;}}}}}}return _0x6f7151[_0xbf31('0x12')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x5b')]=function(){var _0x5cb8ad=this;return function(_0x3a9f40){clearVoiceCallReports(_0x5cb8ad['outbound']);if(_0x3a9f40){for(var _0x3c65d6=0x0;_0x3c65d6<_0x3a9f40[_0xbf31('0x3e')];_0x3c65d6+=0x1){_0x5cb8ad['outbound']['total']+=0x1;_0x5cb8ad[_0xbf31('0x16')][_0xbf31('0x2b')]+=_0x3a9f40[_0x3c65d6][_0xbf31('0x5c')];if(_0x3a9f40[_0x3c65d6][_0xbf31('0x5d')]==='ANSWERED'){_0x5cb8ad[_0xbf31('0x16')]['answered']+=0x1;_0x5cb8ad[_0xbf31('0x16')][_0xbf31('0x30')]+=_0x3a9f40[_0x3c65d6][_0xbf31('0x5c')]-_0x3a9f40[_0x3c65d6][_0xbf31('0x5e')]||0x0;_0x5cb8ad[_0xbf31('0x16')]['sumBillable']+=_0x3a9f40[_0x3c65d6][_0xbf31('0x5e')];}}}return _0x5cb8ad[_0xbf31('0x16')];};};Realtime[_0xbf31('0x3b')]['initCampaigns']=function(){var _0x81692d=this;return function(_0x3ad9c2){if(_0x3ad9c2){freeIsNotKey(_0x3ad9c2,_0x81692d[_0xbf31('0x14')],_0xbf31('0x25'));for(var _0x5b1c26=0x0,_0x60983d={};_0x5b1c26<_0x3ad9c2[_0xbf31('0x3e')];_0x5b1c26+=0x1){_0x60983d=_0x3ad9c2[_0x5b1c26];if(_[_0xbf31('0x3f')](_0x81692d[_0xbf31('0x14')][_0x60983d[_0xbf31('0x25')]])){_0x81692d[_0xbf31('0x14')][_0x60983d['name']]=new Campaign(_0x60983d);}else{_0x81692d[_0xbf31('0x3c')](_0x81692d[_0xbf31('0x14')][_0x60983d['name']],_0x60983d);_0x81692d[_0xbf31('0x14')][_0x60983d[_0xbf31('0x25')]][_0xbf31('0x5f')]=_0x60983d['SquareProject']?_0x60983d[_0xbf31('0x60')][_0xbf31('0x25')]:undefined;}}}return _0x81692d[_0xbf31('0x14')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x61')]=function(){var _0x378f47=this;return function(_0x4d4051){if(_0x4d4051){freeIsNotKey(_0x4d4051,_0x378f47['voiceExtensions'],'id');for(var _0x43e7ac=0x0,_0x5c91c7={};_0x43e7ac<_0x4d4051[_0xbf31('0x3e')];_0x43e7ac+=0x1){_0x5c91c7=_0x4d4051[_0x43e7ac];if(_['isUndefined'](_0x378f47[_0xbf31('0x17')][_0x5c91c7['id']])){_0x378f47['voiceExtensions'][_0x5c91c7['id']]=new VoiceExtension(_0x5c91c7);}else{_0x378f47[_0xbf31('0x3c')](_0x378f47['voiceExtensions'][_0x5c91c7['id']],_0x5c91c7);}}}return _0x378f47['voiceExtensions'];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x62')]=function(){var _0x56b167=this;return function(_0xed74f6){clearCampaigns(_0x56b167[_0xbf31('0x14')]);for(var _0x422b41=0x0;_0x422b41<_0xed74f6[_0xbf31('0x3e')];_0x422b41+=0x1){_[_0xbf31('0x4f')](_0x56b167[_0xbf31('0x14')][_0xed74f6[_0x422b41][_0xbf31('0x25')]],_0xed74f6[_0x422b41]);}return _0x56b167[_0xbf31('0x14')];};};Realtime[_0xbf31('0x3b')][_0xbf31('0x63')]=function(){var _0x36dddf=this;return function(_0xdaf3d6){if(_0xdaf3d6){freeIsNotKey(_0xdaf3d6,_0x36dddf[_0xbf31('0x21')],'id');for(var _0x32069f=0x0,_0x3694a4={},_0x5cb33e={};_0x32069f<_0xdaf3d6[_0xbf31('0x3e')];_0x32069f+=0x1){_0x3694a4=_0xdaf3d6[_0x32069f];if(_[_0xbf31('0x3f')](_0x36dddf[_0xbf31('0x21')][_0x3694a4['id']])){_0x36dddf[_0xbf31('0x21')][_0x3694a4['id']]=new FaxAccount(_0x3694a4);}else{_0x36dddf[_0xbf31('0x3c')](_0x36dddf[_0xbf31('0x21')][_0x3694a4['id']],_0x3694a4);}}}return _0x36dddf['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2118ea2..f417700 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 _0x4607=['membername','create','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','isArray','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','isNil','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','lastapplication','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','channel'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0x4607,0x123));var _0x7460=function(_0x414127,_0x5a69e7){_0x414127=_0x414127-0x0;var _0xb3ca62=_0x4607[_0x414127];return _0xb3ca62;};'use strict';var _=require(_0x7460('0x0'));var moment=require(_0x7460('0x1'));var util=require(_0x7460('0x2'));var config=require(_0x7460('0x3'));var ami=require(_0x7460('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x7460('0x5'));var RpcMemberReport=require(_0x7460('0x6'));var RpcVoiceQueueReport=require(_0x7460('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7460('0x8'));var VoiceQueueReport=require(_0x7460('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x7460('0xa'));var VoiceDialReport=require(_0x7460('0xb'));var UserReport=require(_0x7460('0xc'));function Report(_0x4d9793){this['realtime']=_0x4d9793;this[_0x7460('0xd')]=_0x4d9793['agents'];this[_0x7460('0xe')]=_0x4d9793[_0x7460('0xe')];}Report['prototype'][_0x7460('0xf')]=function(_0x245488){var _0x2099b5=new VoiceQueueReport(this[_0x7460('0x10')]);var _0x52910a=new VoiceAgentReport(this[_0x7460('0x10')]);var _0x29dce6=new VoiceDialReport(this['realtime']);var _0x28bbd1=new VoiceCallReport(this['realtime']);var _0x484130=new UserReport(this[_0x7460('0x10')]);if(config[_0x7460('0x11')]&&config[_0x7460('0x11')][_0x7460('0x12')]){ami['on'](_0x7460('0x13'),this[_0x7460('0x14')][_0x7460('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x7460('0x15')](this));ami['on'](_0x7460('0x16'),this[_0x7460('0x17')][_0x7460('0x15')](this));ami['on'](_0x7460('0x18'),this['voiceDialReport'][_0x7460('0x15')](this));ami['on']('blindtransfer',this[_0x7460('0x19')][_0x7460('0x15')](this));ami['on'](_0x7460('0x1a'),this[_0x7460('0x1b')][_0x7460('0x15')](this));}};Report[_0x7460('0x1c')][_0x7460('0x1d')]=function(_0x3b7961){var _0x31920b;_0x31920b=_[_0x7460('0x1e')](this['agents'],function(_0x5a4304){return _0x5a4304[_0x7460('0x1f')]==_0x3b7961||_0x5a4304['name']==_0x3b7961;});if(_['isNil'](_0x31920b)){var _0x36f9fe=_['find'](this[_0x7460('0xe')],function(_0x549273){return _0x549273[_0x7460('0x1f')]==_0x3b7961||_0x549273[_0x7460('0x20')]==_0x3b7961;});if(_0x36f9fe){_0x31920b=_[_0x7460('0x1e')](this['agents'],function(_0x3de7fd){return _0x3de7fd[_0x7460('0x21')]==util[_0x7460('0x22')](_0x7460('0x23'),_0x36f9fe['name']);});}}return _0x31920b;};Report[_0x7460('0x1c')][_0x7460('0x14')]=function(_0x580912){for(var _0x46cc3f=0x0;_0x46cc3f<_0x580912[_0x7460('0x24')];_0x46cc3f+=0x1){var _0x5508f0=this['findAgent'](_0x580912[_0x46cc3f][_0x7460('0x25')]);if(_0x5508f0){_0x580912[_0x46cc3f][_0x7460('0x1f')]=_0x5508f0[_0x7460('0x1f')];_0x580912[_0x46cc3f][_0x7460('0x26')]=!![];_0x580912[_0x46cc3f]['lastAssignedTo']=_0x5508f0[_0x7460('0x20')];_0x580912[_0x46cc3f][_0x7460('0x21')]=_[_0x7460('0x27')](_0x5508f0[_0x7460('0x21')])?util['format'](_0x7460('0x23'),_0x5508f0['name']):_0x5508f0[_0x7460('0x21')];if(_0x580912[_0x46cc3f]['queuecallercomplete']){_0x580912[_0x46cc3f]['queuecallercompleteAt']=moment()[_0x7460('0x22')](_0x7460('0x28'));}if(_0x580912[_0x46cc3f][_0x7460('0x29')]){_0x580912[_0x46cc3f][_0x7460('0x2a')]=moment()[_0x7460('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x580912[_0x46cc3f]);}RpcVoiceQueueReport['create'](_0x580912[_0x46cc3f]);}};function extractCalleridNumber(_0x31c119){var _0x15b7d8=_0x31c119[_0x7460('0x2b')](/<(.*?)>/);return _0x15b7d8?_0x15b7d8[0x1]:_0x31c119;}Report['prototype'][_0x7460('0x2c')]=function(_0x9f64b9){for(var _0xa3b63a=0x0;_0xa3b63a','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','type','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','phone','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport'];(function(_0x5d869e,_0x1731bd){var _0x13a90b=function(_0x21719e){while(--_0x21719e){_0x5d869e['push'](_0x5d869e['shift']());}};_0x13a90b(++_0x1731bd);}(_0x73e5,0x1ba));var _0x573e=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0x73e5[_0x4ad37c];return _0x288919;};'use strict';var _=require(_0x573e('0x0'));var moment=require(_0x573e('0x1'));var util=require(_0x573e('0x2'));var config=require(_0x573e('0x3'));var ami=require(_0x573e('0x4'));var RpcVoiceAgentReport=require(_0x573e('0x5'));var RpcVoiceCallReport=require(_0x573e('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x573e('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x573e('0x8'));var RpcVoiceTransferReport=require(_0x573e('0x9'));var VoiceQueueReport=require(_0x573e('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x573e('0xb'));var VoiceDialReport=require(_0x573e('0xc'));var UserReport=require(_0x573e('0xd'));function Report(_0x1e9b4f){this[_0x573e('0xe')]=_0x1e9b4f;this[_0x573e('0xf')]=_0x1e9b4f[_0x573e('0xf')];this['telephones']=_0x1e9b4f[_0x573e('0x10')];}Report['prototype'][_0x573e('0x11')]=function(_0x44f5f2){var _0x2d5c61=new VoiceQueueReport(this[_0x573e('0xe')]);var _0x4f07a2=new VoiceAgentReport(this[_0x573e('0xe')]);var _0x4e22f1=new VoiceDialReport(this[_0x573e('0xe')]);var _0x47dd37=new VoiceCallReport(this[_0x573e('0xe')]);var _0x301c93=new UserReport(this[_0x573e('0xe')]);if(config[_0x573e('0x12')]&&config['xdr']['disabled']){ami['on'](_0x573e('0x13'),this[_0x573e('0x14')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x573e('0x15')][_0x573e('0x16')](this));ami['on'](_0x573e('0x17'),this[_0x573e('0x18')][_0x573e('0x16')](this));ami['on'](_0x573e('0x19'),this[_0x573e('0x1a')][_0x573e('0x16')](this));ami['on']('blindtransfer',this[_0x573e('0x1b')][_0x573e('0x16')](this));ami['on'](_0x573e('0x1c'),this['attendedTransfer'][_0x573e('0x16')](this));}};Report['prototype'][_0x573e('0x1d')]=function(_0x4f2849){var _0x2e2890;_0x2e2890=_[_0x573e('0x1e')](this['agents'],function(_0x4a26e6){return _0x4a26e6['accountcode']==_0x4f2849||_0x4a26e6[_0x573e('0x1f')]==_0x4f2849;});if(_[_0x573e('0x20')](_0x2e2890)){var _0x261529=_[_0x573e('0x1e')](this['telephones'],function(_0x507076){return _0x507076[_0x573e('0x21')]==_0x4f2849||_0x507076[_0x573e('0x1f')]==_0x4f2849;});if(_0x261529){_0x2e2890=_[_0x573e('0x1e')](this[_0x573e('0xf')],function(_0x5c0b4b){return _0x5c0b4b[_0x573e('0x22')]==util['format']('SIP/%s',_0x261529[_0x573e('0x1f')]);});}}return _0x2e2890;};Report[_0x573e('0x23')][_0x573e('0x14')]=function(_0x10be2c){for(var _0x4fd083=0x0;_0x4fd083<_0x10be2c[_0x573e('0x24')];_0x4fd083+=0x1){var _0x474d50=this[_0x573e('0x1d')](_0x10be2c[_0x4fd083][_0x573e('0x25')]);if(_0x474d50){_0x10be2c[_0x4fd083]['accountcode']=_0x474d50['accountcode'];_0x10be2c[_0x4fd083][_0x573e('0x26')]=!![];_0x10be2c[_0x4fd083][_0x573e('0x27')]=_0x474d50['name'];_0x10be2c[_0x4fd083][_0x573e('0x22')]=_[_0x573e('0x20')](_0x474d50[_0x573e('0x22')])?util[_0x573e('0x28')]('SIP/%s',_0x474d50[_0x573e('0x1f')]):_0x474d50[_0x573e('0x22')];if(_0x10be2c[_0x4fd083][_0x573e('0x29')]){_0x10be2c[_0x4fd083]['queuecallercompleteAt']=moment()[_0x573e('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x10be2c[_0x4fd083][_0x573e('0x2a')]){_0x10be2c[_0x4fd083]['queuecallerexitAt']=moment()['format'](_0x573e('0x2b'));}RpcMemberReport[_0x573e('0x14')](_0x10be2c[_0x4fd083]);}RpcVoiceQueueReport['create'](_0x10be2c[_0x4fd083]);}};function extractCalleridNumber(_0x3dfeb3){var _0x242961=_0x3dfeb3[_0x573e('0x2c')](/<(.*?)>/);return _0x242961?_0x242961[0x1]:_0x3dfeb3;}Report[_0x573e('0x23')][_0x573e('0x2d')]=function(_0x247e53){for(var _0x3ea8b6=0x0;_0x3ea8b60x0?_0x540edc:0x0;this['voiceQueues'][_0x2449d2[_0x37c2('0x65')]][_0x37c2('0x53')]=this['voiceQueues'][_0x2449d2['queue']][_0x37c2('0x53')]>_[_0x37c2('0x6c')](_0x2449d2[_0x37c2('0x6d')])?_[_0x37c2('0x6c')](_0x2449d2['loggedin']):this[_0x37c2('0x67')][_0x2449d2[_0x37c2('0x65')]]['talking'];this[_0x37c2('0x4a')](this[_0x37c2('0x67')][_0x2449d2['queue']],_0x37c2('0x13'));}logger[_0x37c2('0x40')](_0x37c2('0x6e'),util['inspect'](this[_0x37c2('0x67')][_0x2449d2['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x37c2('0x6f'),this['voiceQueues'][_0x2449d2['queue']]);}}}catch(_0x1562e2){logger['error']('[voiceQueueReport][queuesummary]',util[_0x37c2('0x36')](_0x1562e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c2('0xc')][_0x37c2('0x17')]=function(_0x5027ac){logger['debug'](_0x37c2('0x70'),util[_0x37c2('0x36')](_0x5027ac,{'showHidden':![],'depth':null}));ami[_0x37c2('0x3e')](_0x37c2('0x71'),{});this[_0x37c2('0x62')]=!![];};VoiceQueueReport[_0x37c2('0xc')]['syncQueueCallerJoin']=function(_0x3848b2){try{if(this[_0x37c2('0x5d')](_0x3848b2)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x3848b2[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x3848b2,{'showHidden':![],'depth':null}));if(_[_0x37c2('0x5e')](this[_0x37c2('0xf')][_0x3848b2['uniqueid']]))this[_0x37c2('0xf')][_0x3848b2[_0x37c2('0x43')]]=[];if(_[_0x37c2('0x5e')](this['channels'][_0x3848b2['uniqueid']]))this[_0x37c2('0x11')][_0x3848b2[_0x37c2('0x43')]]={};var _0x4f2309=new QueueReport();_0x4f2309[_0x37c2('0x45')]=_0x3848b2['queue'];_0x4f2309['type']=this[_0x37c2('0x67')][_0x4f2309[_0x37c2('0x45')]]&&this[_0x37c2('0x67')][_0x4f2309[_0x37c2('0x45')]][_0x37c2('0x4b')]?this[_0x37c2('0x67')][_0x4f2309['name']][_0x37c2('0x4b')]||_0x37c2('0x4c'):_0x37c2('0x4c');_0x4f2309[_0x37c2('0x65')]=_0x3848b2[_0x37c2('0x65')];_0x4f2309[_0x37c2('0x72')]=moment()[_0x37c2('0x44')](_0x37c2('0x73'));_0x4f2309[_0x37c2('0x74')]=_0x3848b2['position'];_0x4f2309[_0x37c2('0x75')]=_0x3848b2[_0x37c2('0x75')];_0x4f2309[_0x37c2('0x43')]=_0x3848b2['uniqueid'];_0x4f2309['routealias']=this['channels'][_0x3848b2[_0x37c2('0x43')]]['routealias'];logger[_0x37c2('0x68')](_0x37c2('0x76'),_0x4f2309[_0x37c2('0x45')],_0x4f2309[_0x37c2('0x4b')]);_[_0x37c2('0x77')](_0x4f2309,_[_0x37c2('0x78')](_0x3848b2,_[_0x37c2('0x79')](_0x4f2309)));this[_0x37c2('0xf')][_0x3848b2[_0x37c2('0x43')]]['push'](_0x4f2309);this[_0x37c2('0x11')][_0x3848b2[_0x37c2('0x43')]]=_0x4f2309;this[_0x37c2('0x3f')](_0x4f2309,_0x37c2('0x18'));}}catch(_0x2dd62f){logger[_0x37c2('0x37')](_0x37c2('0x7a'),_0x3848b2[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x2dd62f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37c2('0x1a')]=function(_0x3e2a1b){try{if(this[_0x37c2('0x5d')](_0x3e2a1b)){logger[_0x37c2('0x40')](_0x37c2('0x7b'),_0x3e2a1b['uniqueid'],util[_0x37c2('0x36')](_0x3e2a1b,{'showHidden':![],'depth':null}));if(this[_0x37c2('0xf')][_0x3e2a1b[_0x37c2('0x43')]]){var _0x262645=_['last'](this[_0x37c2('0xf')][_0x3e2a1b[_0x37c2('0x43')]]);_0x262645['queuecallercomplete']=![];_0x262645[_0x37c2('0x7c')]=null;_0x262645[_0x37c2('0x7d')]=_0x3e2a1b[_0x37c2('0x7d')];_0x262645[_0x37c2('0x7e')]=_0x3e2a1b[_0x37c2('0x7e')];_0x262645[_0x37c2('0x19')]=!![];_0x262645['queuecallerabandonAt']=moment()[_0x37c2('0x44')](_0x37c2('0x73'));_0x262645[_0x37c2('0x48')]='ABANDONED';_0x262645['lastAssignedTo']=null;logger[_0x37c2('0x68')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x262645[_0x37c2('0x45')],_0x262645[_0x37c2('0x4b')]);this['channels'][_0x3e2a1b[_0x37c2('0x43')]]=_0x262645;this['emitVoiceQueueChannelRemove'](_0x262645,_0x37c2('0x19'));}}}catch(_0x341e2a){logger[_0x37c2('0x37')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3e2a1b[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x341e2a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c2('0xc')][_0x37c2('0x1c')]=function(_0x3b5b19){try{if(this['isNotNull'](_0x3b5b19)){logger['debug'](_0x37c2('0x7f'),_0x3b5b19[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x3b5b19,{'showHidden':![],'depth':null}));if(this[_0x37c2('0xf')][_0x3b5b19['uniqueid']]){var _0x3bf9ff=_[_0x37c2('0x80')](this[_0x37c2('0xf')][_0x3b5b19[_0x37c2('0x43')]]);_0x3bf9ff[_0x37c2('0x81')]=moment()[_0x37c2('0x44')](_0x37c2('0x73'));_0x3bf9ff['connectedlinenum']=_0x3b5b19[_0x37c2('0x82')];_0x3bf9ff[_0x37c2('0x83')]=_0x3b5b19['connectedlinename'];logger[_0x37c2('0x68')](_0x37c2('0x84'),_0x3bf9ff['name'],_0x3bf9ff[_0x37c2('0x4b')],_0x3b5b19[_0x37c2('0x82')],_0x3b5b19[_0x37c2('0x83')]);this[_0x37c2('0x11')][_0x3b5b19[_0x37c2('0x43')]]=_0x3bf9ff;this[_0x37c2('0x3f')](_0x3bf9ff,'queuecallerleave');}}}catch(_0x133f2f){logger[_0x37c2('0x37')](_0x37c2('0x7f'),_0x3b5b19['uniqueid'],util[_0x37c2('0x36')](_0x133f2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37c2('0x1f')]=function(_0x3c569d){try{if(this[_0x37c2('0x5d')](_0x3c569d)){logger[_0x37c2('0x40')](_0x37c2('0x85'),_0x3c569d[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x3c569d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3c569d[_0x37c2('0x43')]]){var _0x480ddf=_[_0x37c2('0x80')](this['queueReports'][_0x3c569d[_0x37c2('0x43')]]);_0x480ddf['queuecallercomplete']=!![];_0x480ddf[_0x37c2('0x48')]=_0x37c2('0x86');logger[_0x37c2('0x68')](_0x37c2('0x87'),_0x480ddf[_0x37c2('0x45')],_0x480ddf[_0x37c2('0x4b')]);}}}catch(_0x5514d1){logger[_0x37c2('0x37')](_0x37c2('0x85'),_0x3c569d[_0x37c2('0x43')],util['inspect'](_0x5514d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c2('0xc')][_0x37c2('0x88')]=function(_0x427995){try{if(this[_0x37c2('0x5d')](_0x427995)){logger[_0x37c2('0x40')](_0x37c2('0x89'),_0x427995['uniqueid'],util['inspect'](_0x427995,{'showHidden':![],'depth':null}));if(this[_0x37c2('0xf')][_0x427995[_0x37c2('0x43')]]){var _0x48d0cb=_[_0x37c2('0x80')](this['queueReports'][_0x427995['uniqueid']]);_0x48d0cb[_0x37c2('0x19')]=![];_0x48d0cb[_0x37c2('0x8a')]=null;_0x48d0cb['assigned']=!![];_0x48d0cb['lastAssignedTo']=_0x427995[_0x37c2('0x8b')];_0x48d0cb['holdtime']=_0x427995['holdtime'];_0x48d0cb['queuecallercomplete']=!![];_0x48d0cb[_0x37c2('0x8c')]=![];_0x48d0cb[_0x37c2('0x8d')]=null;if(!_0x48d0cb[_0x37c2('0x8e')]){if(_0x427995[_0x37c2('0x8f')]=='transfer'){_0x48d0cb[_0x37c2('0x48')]=_0x37c2('0x90');logger[_0x37c2('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x48d0cb[_0x37c2('0x45')],_0x48d0cb[_0x37c2('0x4b')]);}else{if(_[_0x37c2('0x91')](_0x427995[_0x37c2('0x92')][_0x37c2('0x93')](),_0x37c2('0x94'))){if(this[_0x37c2('0xf')][_0x427995[_0x37c2('0x95')]]){var _0x4e2355=_[_0x37c2('0x80')](this[_0x37c2('0xf')][_0x427995['linkedid']]);_0x4e2355[_0x37c2('0x96')]=![];_0x4e2355['queuecallerexit']=!![];_0x4e2355[_0x37c2('0x8d')]=moment(_0x48d0cb[_0x37c2('0x72')])[_0x37c2('0x97')](_0x427995[_0x37c2('0x7d')],_0x37c2('0x98'))[_0x37c2('0x44')](_0x37c2('0x73'));_0x4e2355[_0x37c2('0x48')]=_0x37c2('0x99');_0x4e2355[_0x37c2('0x8e')]=!![];_0x4e2355[_0x37c2('0x9a')]=_0x37c2('0x9b');_0x4e2355[_0x37c2('0x9c')]=_0x427995['destexten'];_0x4e2355[_0x37c2('0x9d')]=_0x427995[_0x37c2('0x43')];logger[_0x37c2('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4e2355['name'],_0x4e2355['type']);var _0x48c333=this[_0x37c2('0xf')][_0x427995['linkedid']];this['queueReports'][_0x427995['linkedid']]=this[_0x37c2('0xf')][_0x427995[_0x37c2('0x43')]];this[_0x37c2('0xf')][_0x427995['uniqueid']]=_0x48c333;}}else{_0x48d0cb[_0x37c2('0x48')]=_0x37c2('0x9e')+_0x427995['reason'][_0x37c2('0x9f')]();logger['info'](_0x37c2('0xa0'),_0x48d0cb[_0x37c2('0x45')],_0x48d0cb['type'],_0x48d0cb[_0x37c2('0x48')]);}}}this[_0x37c2('0x11')][_0x427995[_0x37c2('0x43')]]=_0x48d0cb;this[_0x37c2('0x3c')](_0x48d0cb,_0x37c2('0x1d'));}}}catch(_0x44cecb){logger[_0x37c2('0x37')](_0x37c2('0x89'),_0x427995[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x44cecb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x4a8edd){try{if(this[_0x37c2('0x5d')](_0x4a8edd)){logger[_0x37c2('0x40')](_0x37c2('0xa1'),_0x4a8edd[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x4a8edd,{'showHidden':![],'depth':null}));this[_0x37c2('0xa2')](_0x4a8edd['uniqueid'],_[_0x37c2('0x79')](_0x4a8edd[_0x37c2('0xa3')])[0x0],_0x4a8edd[_0x37c2('0xa4')]);if(this[_0x37c2('0xf')][_0x4a8edd[_0x37c2('0x43')]]){var _0x5c527d=_[_0x37c2('0x80')](this[_0x37c2('0xf')][_0x4a8edd[_0x37c2('0x43')]]);if(_0x5c527d){if(this['isNotNull'](_0x4a8edd[_0x37c2('0xa3')])&&this[_0x37c2('0x5d')](_0x4a8edd[_0x37c2('0xa3')][_0x37c2('0xa5')])){switch(_0x4a8edd['value']){case _0x37c2('0xa6'):_0x5c527d[_0x37c2('0x8c')]=![];_0x5c527d[_0x37c2('0x8d')]=null;break;case _0x37c2('0xa7'):_0x5c527d[_0x37c2('0xa8')]='timeout';_0x5c527d[_0x37c2('0x8c')]=!![];_0x5c527d[_0x37c2('0x8d')]=moment()[_0x37c2('0x44')](_0x37c2('0x73'));_0x5c527d[_0x37c2('0x81')]=moment()[_0x37c2('0x44')](_0x37c2('0x73'));logger['debug'](_0x37c2('0xa9'),_0x4a8edd[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x5c527d,{'showHidden':![],'depth':null}));ami[_0x37c2('0x3e')](_0x37c2('0xaa'),_0x5c527d);break;default:_0x5c527d['queuecallerexit']=!![];_0x5c527d[_0x37c2('0x8d')]=moment()['format'](_0x37c2('0x73'));_0x5c527d['queuecallerleaveAt']=moment()[_0x37c2('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c527d[_0x37c2('0x19')]=![];_0x5c527d[_0x37c2('0x8a')]=null;_0x5c527d[_0x37c2('0x48')]=_0x4a8edd[_0x37c2('0xa4')];this[_0x37c2('0x11')][_0x4a8edd[_0x37c2('0x43')]]=_0x5c527d;this[_0x37c2('0x3c')](_0x5c527d,'varset');}else if(this[_0x37c2('0x5d')](_0x4a8edd['variable'])&&this[_0x37c2('0x5d')](_0x4a8edd[_0x37c2('0xa3')][_0x37c2('0xab')])){if(!_0x5c527d[_0x37c2('0x19')]){_0x5c527d['queuecallerexit']=!![];_0x5c527d['queuecallerexitAt']=moment()[_0x37c2('0x44')](_0x37c2('0x73'));_0x5c527d['queuecallerexitreason']='EXITWITHKEY';_0x5c527d[_0x37c2('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4a8edd[_0x37c2('0x43')]]=_0x5c527d;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4a8edd[_0x37c2('0x43')],_0x5c527d[_0x37c2('0x45')],_0x5c527d['type'],_['keys'](_0x4a8edd[_0x37c2('0xa3')])[0x0],_0x4a8edd[_0x37c2('0xa4')]);_0x5c527d['variables']=this[_0x37c2('0x38')][_0x4a8edd[_0x37c2('0x43')]];}}}}catch(_0x53e0f2){logger['error'](_0x37c2('0xa1'),_0x4a8edd[_0x37c2('0x43')],util[_0x37c2('0x36')](_0x53e0f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c2('0xc')]['addVariable']=function(_0x28c963,_0x383bf9,_0x29161c){var _0x4a4f2d=[_0x37c2('0xac'),_0x37c2('0xad'),_0x37c2('0xae'),_0x37c2('0xaf'),_0x37c2('0xb0'),_0x37c2('0xb1'),'rtpaudioqosrtt',_0x37c2('0xb2'),_0x37c2('0xb3'),'sipuri',_0x37c2('0xb4'),'bridgepvtcallid',_0x37c2('0xb5'),_0x37c2('0xb6'),'memberinterface',_0x37c2('0xb7'),_0x37c2('0x8b'),_0x37c2('0xb8'),_0x37c2('0xb9')];if(!_['isNil'](_0x383bf9)&&!_[_0x37c2('0xba')](_0x4a4f2d,_0x383bf9)){if(_['isUndefined'](this[_0x37c2('0x38')][_0x28c963])){this[_0x37c2('0x38')][_0x28c963]={};}this['variables'][_0x28c963][_0x383bf9]=_0x29161c;}};VoiceQueueReport[_0x37c2('0xc')][_0x37c2('0xbb')]=function(_0x5d5852,_0x233607,_0x2416cd){var _0x36e096={};for(var _0x1df30c=0x0;_0x1df30c0x0?_0x4eef72:0x0;this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]][_0xda18('0x34')]=this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]][_0xda18('0x34')]>_[_0xda18('0x72')](_0x324a9c['loggedin'])?_[_0xda18('0x72')](_0x324a9c[_0xda18('0x74')]):this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]][_0xda18('0x34')];this[_0xda18('0x51')](this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]],'queuesummary');}logger['debug'](_0xda18('0x75'),util[_0xda18('0x41')](this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]],{'showHidden':![],'depth':null}));ami[_0xda18('0x46')](_0xda18('0x76'),this[_0xda18('0x14')][_0x324a9c[_0xda18('0x6c')]]);}}}catch(_0x58782c){logger['error'](_0xda18('0x6a'),util[_0xda18('0x41')](_0x58782c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xda18('0x1b')]=function(_0x55c3c7){logger[_0xda18('0x48')](_0xda18('0x77'),util[_0xda18('0x41')](_0x55c3c7,{'showHidden':![],'depth':null}));ami[_0xda18('0x46')](_0xda18('0x78'),{});this[_0xda18('0x15')]=!![];};VoiceQueueReport[_0xda18('0xc')]['syncQueueCallerJoin']=function(_0x31cc28){try{if(this[_0xda18('0x64')](_0x31cc28)){logger[_0xda18('0x48')](_0xda18('0x79'),_0x31cc28['uniqueid'],util[_0xda18('0x41')](_0x31cc28,{'showHidden':![],'depth':null}));if(_[_0xda18('0x65')](this['queueReports'][_0x31cc28[_0xda18('0x7a')]]))this[_0xda18('0x11')][_0x31cc28[_0xda18('0x7a')]]=[];if(_[_0xda18('0x65')](this[_0xda18('0x13')][_0x31cc28[_0xda18('0x7a')]]))this['channels'][_0x31cc28['uniqueid']]={};var _0x476d8f=new QueueReport();_0x476d8f[_0xda18('0x4f')]=_0x31cc28[_0xda18('0x6c')];_0x476d8f[_0xda18('0x52')]=this[_0xda18('0x14')][_0x476d8f[_0xda18('0x4f')]]&&this[_0xda18('0x14')][_0x476d8f[_0xda18('0x4f')]][_0xda18('0x52')]?this[_0xda18('0x14')][_0x476d8f[_0xda18('0x4f')]][_0xda18('0x52')]||_0xda18('0x53'):_0xda18('0x53');_0x476d8f[_0xda18('0x6c')]=_0x31cc28[_0xda18('0x6c')];_0x476d8f[_0xda18('0x7b')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));_0x476d8f[_0xda18('0x7d')]=_0x31cc28[_0xda18('0x7d')];_0x476d8f['count']=_0x31cc28[_0xda18('0x7e')];_0x476d8f['uniqueid']=_0x31cc28[_0xda18('0x7a')];_0x476d8f['routealias']=this['channels'][_0x31cc28[_0xda18('0x7a')]][_0xda18('0x7f')];logger[_0xda18('0x6e')](_0xda18('0x80'),_0x476d8f[_0xda18('0x4f')],_0x476d8f['type']);_[_0xda18('0x81')](_0x476d8f,_[_0xda18('0x82')](_0x31cc28,_[_0xda18('0x83')](_0x476d8f)));this['queueReports'][_0x31cc28[_0xda18('0x7a')]]['push'](_0x476d8f);this['channels'][_0x31cc28['uniqueid']]=_0x476d8f;this[_0xda18('0x47')](_0x476d8f,'queuecallerjoin');}}catch(_0x36dd87){logger[_0xda18('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x31cc28[_0xda18('0x7a')],util[_0xda18('0x41')](_0x36dd87,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda18('0xc')][_0xda18('0x1f')]=function(_0x4a429c){try{if(this[_0xda18('0x64')](_0x4a429c)){logger[_0xda18('0x48')](_0xda18('0x84'),_0x4a429c[_0xda18('0x7a')],util[_0xda18('0x41')](_0x4a429c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a429c['uniqueid']]){var _0x5631a3=_[_0xda18('0x85')](this[_0xda18('0x11')][_0x4a429c[_0xda18('0x7a')]]);_0x5631a3[_0xda18('0x86')]=![];_0x5631a3[_0xda18('0x87')]=null;_0x5631a3[_0xda18('0x88')]=_0x4a429c[_0xda18('0x88')];_0x5631a3[_0xda18('0x89')]=_0x4a429c[_0xda18('0x89')];_0x5631a3[_0xda18('0x1e')]=!![];_0x5631a3[_0xda18('0x8a')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));_0x5631a3[_0xda18('0x4c')]=_0xda18('0x8b');_0x5631a3[_0xda18('0x8c')]=null;logger[_0xda18('0x6e')](_0xda18('0x8d'),_0x5631a3[_0xda18('0x4f')],_0x5631a3['type']);this[_0xda18('0x13')][_0x4a429c[_0xda18('0x7a')]]=_0x5631a3;this[_0xda18('0x44')](_0x5631a3,'queuecallerabandon');}}}catch(_0x4a5dd3){logger[_0xda18('0x3f')](_0xda18('0x84'),_0x4a429c[_0xda18('0x7a')],util[_0xda18('0x41')](_0x4a5dd3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda18('0xc')]['syncQueueCallerLeave']=function(_0x5d9e5d){try{if(this[_0xda18('0x64')](_0x5d9e5d)){logger['debug'](_0xda18('0x8e'),_0x5d9e5d['uniqueid'],util[_0xda18('0x41')](_0x5d9e5d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5d9e5d['uniqueid']]){var _0x42e2d3=_['last'](this['queueReports'][_0x5d9e5d[_0xda18('0x7a')]]);_0x42e2d3[_0xda18('0x8f')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));_0x42e2d3[_0xda18('0x90')]=_0x5d9e5d[_0xda18('0x90')];_0x42e2d3['connectedlinename']=_0x5d9e5d[_0xda18('0x91')];logger[_0xda18('0x6e')](_0xda18('0x92'),_0x42e2d3[_0xda18('0x4f')],_0x42e2d3['type'],_0x5d9e5d[_0xda18('0x90')],_0x5d9e5d[_0xda18('0x91')]);this[_0xda18('0x13')][_0x5d9e5d[_0xda18('0x7a')]]=_0x42e2d3;this[_0xda18('0x47')](_0x42e2d3,_0xda18('0x20'));}}}catch(_0x2ff85c){logger['error'](_0xda18('0x8e'),_0x5d9e5d[_0xda18('0x7a')],util[_0xda18('0x41')](_0x2ff85c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda18('0xc')]['syncAgentConnect']=function(_0x1bbd92){try{if(this[_0xda18('0x64')](_0x1bbd92)){logger[_0xda18('0x48')](_0xda18('0x93'),_0x1bbd92[_0xda18('0x7a')],util[_0xda18('0x41')](_0x1bbd92,{'showHidden':![],'depth':null}));if(this[_0xda18('0x11')][_0x1bbd92[_0xda18('0x7a')]]){var _0xd6c877=_[_0xda18('0x85')](this[_0xda18('0x11')][_0x1bbd92[_0xda18('0x7a')]]);_0xd6c877[_0xda18('0x86')]=!![];_0xd6c877[_0xda18('0x4c')]=_0xda18('0x94');logger['info'](_0xda18('0x95'),_0xd6c877['name'],_0xd6c877[_0xda18('0x52')]);}}}catch(_0x485238){logger[_0xda18('0x3f')](_0xda18('0x93'),_0x1bbd92[_0xda18('0x7a')],util[_0xda18('0x41')](_0x485238,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xda18('0x23')]=function(_0x1af328){try{if(this[_0xda18('0x64')](_0x1af328)){logger[_0xda18('0x48')](_0xda18('0x96'),_0x1af328['uniqueid'],util['inspect'](_0x1af328,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1af328[_0xda18('0x7a')]]){var _0x2e4f93=_['last'](this[_0xda18('0x11')][_0x1af328[_0xda18('0x7a')]]);_0x2e4f93[_0xda18('0x1e')]=![];_0x2e4f93['queuecallerabandonAt']=null;_0x2e4f93[_0xda18('0x97')]=!![];_0x2e4f93[_0xda18('0x8c')]=_0x1af328[_0xda18('0x98')];_0x2e4f93[_0xda18('0x88')]=_0x1af328['holdtime'];_0x2e4f93[_0xda18('0x86')]=!![];_0x2e4f93[_0xda18('0x99')]=![];_0x2e4f93[_0xda18('0x9a')]=null;if(!_0x2e4f93[_0xda18('0x9b')]){if(_0x1af328[_0xda18('0x9c')]==_0xda18('0x9b')){_0x2e4f93[_0xda18('0x4c')]=_0xda18('0x9d');logger[_0xda18('0x6e')](_0xda18('0x9e'),_0x2e4f93['name'],_0x2e4f93[_0xda18('0x52')]);}else{if(_[_0xda18('0x9f')](_0x1af328[_0xda18('0xa0')]['toLowerCase'](),_0xda18('0xa1'))){if(this[_0xda18('0x11')][_0x1af328[_0xda18('0xa2')]]){var _0x14e58e=_[_0xda18('0x85')](this['queueReports'][_0x1af328[_0xda18('0xa2')]]);_0x14e58e[_0xda18('0x86')]=![];_0x14e58e[_0xda18('0x99')]=!![];_0x14e58e[_0xda18('0x9a')]=moment(_0x2e4f93[_0xda18('0x7b')])['add'](_0x1af328[_0xda18('0x88')],_0xda18('0xa3'))[_0xda18('0x4a')](_0xda18('0x7c'));_0x14e58e[_0xda18('0x4c')]=_0xda18('0xa4');_0x14e58e[_0xda18('0x9b')]=!![];_0x14e58e[_0xda18('0xa5')]='FORWARD';_0x14e58e[_0xda18('0xa6')]=_0x1af328[_0xda18('0xa7')];_0x14e58e['transferuniqueid']=_0x1af328[_0xda18('0x7a')];logger['info'](_0xda18('0xa8'),_0x14e58e[_0xda18('0x4f')],_0x14e58e['type']);var _0x454c24=this[_0xda18('0x11')][_0x1af328[_0xda18('0xa2')]];this[_0xda18('0x11')][_0x1af328['linkedid']]=this[_0xda18('0x11')][_0x1af328[_0xda18('0x7a')]];this[_0xda18('0x11')][_0x1af328[_0xda18('0x7a')]]=_0x454c24;}}else{_0x2e4f93[_0xda18('0x4c')]=_0xda18('0xa9')+_0x1af328['reason'][_0xda18('0xaa')]();logger[_0xda18('0x6e')](_0xda18('0xab'),_0x2e4f93[_0xda18('0x4f')],_0x2e4f93['type'],_0x2e4f93[_0xda18('0x4c')]);}}}this[_0xda18('0x13')][_0x1af328[_0xda18('0x7a')]]=_0x2e4f93;this[_0xda18('0x44')](_0x2e4f93,_0xda18('0x22'));}}}catch(_0x4c37a5){logger[_0xda18('0x3f')](_0xda18('0x96'),_0x1af328[_0xda18('0x7a')],util[_0xda18('0x41')](_0x4c37a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3cdf54){try{if(this['isNotNull'](_0x3cdf54)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3cdf54[_0xda18('0x7a')],util[_0xda18('0x41')](_0x3cdf54,{'showHidden':![],'depth':null}));this[_0xda18('0xac')](_0x3cdf54[_0xda18('0x7a')],_[_0xda18('0x83')](_0x3cdf54[_0xda18('0xad')])[0x0],_0x3cdf54[_0xda18('0xae')]);if(this['queueReports'][_0x3cdf54['uniqueid']]){var _0x50536e=_[_0xda18('0x85')](this[_0xda18('0x11')][_0x3cdf54[_0xda18('0x7a')]]);if(_0x50536e){if(this[_0xda18('0x64')](_0x3cdf54[_0xda18('0xad')])&&this[_0xda18('0x64')](_0x3cdf54[_0xda18('0xad')][_0xda18('0xaf')])){switch(_0x3cdf54[_0xda18('0xae')]){case'CONTINUE':_0x50536e['queuecallerexit']=![];_0x50536e[_0xda18('0x9a')]=null;break;case'TIMEOUT':_0x50536e[_0xda18('0xb0')]='timeout';_0x50536e[_0xda18('0x99')]=!![];_0x50536e[_0xda18('0x9a')]=moment()['format'](_0xda18('0x7c'));_0x50536e[_0xda18('0x8f')]=moment()['format'](_0xda18('0x7c'));logger[_0xda18('0x48')](_0xda18('0xb1'),_0x3cdf54['uniqueid'],util[_0xda18('0x41')](_0x50536e,{'showHidden':![],'depth':null}));ami[_0xda18('0x46')](_0xda18('0xb2'),_0x50536e);break;default:_0x50536e[_0xda18('0x99')]=!![];_0x50536e[_0xda18('0x9a')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));_0x50536e['queuecallerleaveAt']=moment()[_0xda18('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x50536e[_0xda18('0x1e')]=![];_0x50536e['queuecallerabandonAt']=null;_0x50536e[_0xda18('0x4c')]=_0x3cdf54[_0xda18('0xae')];this[_0xda18('0x13')][_0x3cdf54['uniqueid']]=_0x50536e;this[_0xda18('0x44')](_0x50536e,_0xda18('0xb3'));}else if(this[_0xda18('0x64')](_0x3cdf54['variable'])&&this[_0xda18('0x64')](_0x3cdf54[_0xda18('0xad')]['queueposition'])){if(!_0x50536e['queuecallerabandon']){_0x50536e[_0xda18('0x99')]=!![];_0x50536e[_0xda18('0x9a')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));_0x50536e[_0xda18('0x4c')]='EXITWITHKEY';_0x50536e[_0xda18('0x8f')]=moment()[_0xda18('0x4a')](_0xda18('0x7c'));this['channels'][_0x3cdf54[_0xda18('0x7a')]]=_0x50536e;}}logger[_0xda18('0x6e')](_0xda18('0xb4'),_0x3cdf54[_0xda18('0x7a')],_0x50536e['name'],_0x50536e[_0xda18('0x52')],_[_0xda18('0x83')](_0x3cdf54[_0xda18('0xad')])[0x0],_0x3cdf54[_0xda18('0xae')]);_0x50536e[_0xda18('0x17')]=this[_0xda18('0x17')][_0x3cdf54[_0xda18('0x7a')]];}}}}catch(_0x39546c){logger[_0xda18('0x3f')](_0xda18('0xb5'),_0x3cdf54[_0xda18('0x7a')],util['inspect'](_0x39546c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda18('0xc')][_0xda18('0xac')]=function(_0x15c36d,_0x36c4c0,_0x570c8b){var _0x292542=[_0xda18('0xb6'),_0xda18('0xb7'),_0xda18('0xb8'),'rtpaudioqosjitterbridged',_0xda18('0xb9'),_0xda18('0xba'),_0xda18('0xbb'),'rtpaudioqosrttbridged',_0xda18('0xbc'),_0xda18('0xbd'),_0xda18('0xbe'),_0xda18('0xbf'),_0xda18('0xc0'),_0xda18('0xc1'),_0xda18('0xc2'),_0xda18('0xc3'),_0xda18('0x98'),_0xda18('0xc4'),_0xda18('0xc5')];if(!_[_0xda18('0x3b')](_0x36c4c0)&&!_[_0xda18('0xc6')](_0x292542,_0x36c4c0)){if(_[_0xda18('0x65')](this['variables'][_0x15c36d])){this[_0xda18('0x17')][_0x15c36d]={};}this[_0xda18('0x17')][_0x15c36d][_0x36c4c0]=_0x570c8b;}};VoiceQueueReport[_0xda18('0xc')]['handleHangup']=function(_0x1abb36,_0x5e4d9a,_0x34acca){var _0x263d2b={};for(var _0x493ab6=0x0;_0x493ab6=0x0?moment(_0xa524['endtime'])[_0xef1e('0xe')](_0xa524[_0xef1e('0x18')],_0xef1e('0xf')):null,'data1':_0xef1e('0x1a'),'data2':_0xa524[_0xef1e('0x13')],'data3':_0xa524[_0xef1e('0x11')],'data4':_0xa524[_0xef1e('0x1b')]||null,'role':_0xef1e('0x1c'),'internal':_0xa524[_0xef1e('0x13')]?_[_0xef1e('0x14')](_0xa524[_0xef1e('0x13')]):undefined,'uniqueid':_0xa524[_0xef1e('0x15')]},'log':_0xef1e('0x6')});}; \ No newline at end of file +var _0xfbbf=['CreateMemberReport','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','accountcode','uniqueid','membername','starttime','endtime','dialstring','toNumber','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xfbbf,0xaf));var _0xffbb=function(_0x3d649b,_0x129732){_0x3d649b=_0x3d649b-0x0;var _0x1a4559=_0xfbbf[_0x3d649b];return _0x1a4559;};'use strict';var moment=require(_0xffbb('0x0'));var _=require(_0xffbb('0x1'));var util=require(_0xffbb('0x2'));var client=require('../client');exports[_0xffbb('0x3')]=function(_0x1c6d43){var _0x38fb8e=_0x1c6d43[_0xffbb('0x4')]||_0x1c6d43[_0xffbb('0x5')];return client[_0xffbb('0x6')](_0xffbb('0x7'),{'body':{'channel':'voice','membername':_0x1c6d43[_0xffbb('0x8')],'interface':_[_0xffbb('0x9')](_0x1c6d43[_0xffbb('0xa')])?util['format']('SIP/%s',_0x1c6d43[_0xffbb('0x8')]):_0x1c6d43['interface'],'type':_0xffbb('0xb'),'enterAt':_0x1c6d43[_0xffbb('0xc')],'exitAt':_0x38fb8e,'duration':moment(_0x38fb8e)[_0xffbb('0xd')](_0x1c6d43[_0xffbb('0xc')],_0xffbb('0xe')),'data1':_0xffbb('0xf'),'data2':_0x1c6d43[_0xffbb('0x10')],'data3':_0x1c6d43[_0xffbb('0x11')],'data4':null,'data5':_0x1c6d43['queue'],'role':_0xffbb('0x12'),'internal':_0x1c6d43[_0xffbb('0x13')]?_['toNumber'](_0x1c6d43['accountcode']):undefined,'uniqueid':_0x1c6d43[_0xffbb('0x14')]},'log':_0xffbb('0x7')});};exports['voiceDialReport']=function(_0x5841ec){return client[_0xffbb('0x6')](_0xffbb('0x7'),{'body':{'channel':'voice','membername':_0x5841ec[_0xffbb('0x15')],'interface':_0x5841ec[_0xffbb('0xa')],'type':_0xffbb('0xb'),'enterAt':_0x5841ec[_0xffbb('0x16')],'exitAt':_0x5841ec[_0xffbb('0x17')],'duration':moment(_0x5841ec[_0xffbb('0x17')])[_0xffbb('0xd')](_0x5841ec[_0xffbb('0x16')],'seconds')>=0x0?moment(_0x5841ec[_0xffbb('0x17')])['diff'](_0x5841ec[_0xffbb('0x16')],_0xffbb('0xe')):null,'data1':'outbound','data2':_0x5841ec[_0xffbb('0x13')],'data3':_0x5841ec[_0xffbb('0x11')],'data4':_0x5841ec[_0xffbb('0x18')]||null,'role':'agent','internal':_0x5841ec[_0xffbb('0x13')]?_[_0xffbb('0x19')](_0x5841ec[_0xffbb('0x13')]):undefined,'uniqueid':_0x5841ec[_0xffbb('0x14')]},'log':_0xffbb('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0ce9738..5417180 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 _0xc2f4=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x223e7b,_0x22492b){var _0x470512=function(_0x5727f1){while(--_0x5727f1){_0x223e7b['push'](_0x223e7b['shift']());}};_0x470512(++_0x22492b);}(_0xc2f4,0x107));var _0x4c2f=function(_0x505439,_0x5a4a50){_0x505439=_0x505439-0x0;var _0x54267a=_0xc2f4[_0x505439];return _0x54267a;};'use strict';var client=require(_0x4c2f('0x0'));exports[_0x4c2f('0x1')]=function(){return client[_0x4c2f('0x2')](_0x4c2f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4c2f('0x4'),_0x4c2f('0x5')]},'log':_0x4c2f('0x6')});}; \ No newline at end of file +var _0xd7ab=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x1b9911,_0x5015e1){var _0x4bbd04=function(_0x1a358e){while(--_0x1a358e){_0x1b9911['push'](_0x1b9911['shift']());}};_0x4bbd04(++_0x5015e1);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd7ab[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xbd7a('0x0'));exports[_0xbd7a('0x1')]=function(){return client[_0xbd7a('0x2')](_0xbd7a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbd7a('0x4'),_0xbd7a('0x5')]},'log':_0xbd7a('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c1e51d7..b23a4c3 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 _0xc6e8=['Request','name','GetTemplate','../client','getTemplates'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6e8,0x9e));var _0x8c6e=function(_0x391a79,_0x5a1626){_0x391a79=_0x391a79-0x0;var _0x3cb7ad=_0xc6e8[_0x391a79];return _0x3cb7ad;};'use strict';var client=require(_0x8c6e('0x0'));exports[_0x8c6e('0x1')]=function(_0x213e68){return function(_0x2b4809){return client[_0x8c6e('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x8c6e('0x3'),'html']},'log':_0x8c6e('0x4')});};}; \ No newline at end of file +var _0xfc9a=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x10ea7b,_0x43b2e7){var _0x2a171f=function(_0x1fd462){while(--_0x1fd462){_0x10ea7b['push'](_0x10ea7b['shift']());}};_0x2a171f(++_0x43b2e7);}(_0xfc9a,0x83));var _0xafc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc9a[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xafc9('0x0'));exports[_0xafc9('0x1')]=function(_0x46ea3f){return function(_0xa08af5){return client[_0xafc9('0x2')](_0xafc9('0x3'),{'options':{'raw':!![],'attributes':['id',_0xafc9('0x4'),_0xafc9('0x5')]},'log':_0xafc9('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 631dd86..54321d8 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 _0xfc86=['data2','data3','data6','data7','GetTrigger','../client','getTriggers','Request','Condition','AllConditions','field','operator','value','AnyConditions','action'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc86,0x16d));var _0x6fc8=function(_0x3bbbd2,_0x506692){_0x3bbbd2=_0x3bbbd2-0x0;var _0x18ad2e=_0xfc86[_0x3bbbd2];return _0x18ad2e;};'use strict';var client=require(_0x6fc8('0x0'));exports[_0x6fc8('0x1')]=function(_0xfd7271){return function(_0x20f81b){return client[_0x6fc8('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x6fc8('0x3'),'as':_0x6fc8('0x4'),'attributes':['id',_0x6fc8('0x5'),_0x6fc8('0x6'),_0x6fc8('0x7')]},{'model':_0x6fc8('0x3'),'as':_0x6fc8('0x8'),'attributes':['id',_0x6fc8('0x5'),_0x6fc8('0x6'),_0x6fc8('0x7')]},{'model':'Action','as':'Actions','attributes':['id',_0x6fc8('0x9'),'data1',_0x6fc8('0xa'),_0x6fc8('0xb'),'data4','data5',_0x6fc8('0xc'),_0x6fc8('0xd')]}]},'log':_0x6fc8('0xe')});};}; \ No newline at end of file +var _0x75db=['name','channel','status','Condition','operator','AnyConditions','field','value','Action','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger'];(function(_0x153844,_0x37a9b9){var _0x4207d0=function(_0x521c66){while(--_0x521c66){_0x153844['push'](_0x153844['shift']());}};_0x4207d0(++_0x37a9b9);}(_0x75db,0x1d3));var _0xb75d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75db[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x4f5148){return function(_0x2bb034){return client['Request'](_0xb75d('0x0'),{'options':{'raw':![],'attributes':['id',_0xb75d('0x1'),_0xb75d('0x2'),_0xb75d('0x3')],'include':[{'model':_0xb75d('0x4'),'as':'AllConditions','attributes':['id','field',_0xb75d('0x5'),'value']},{'model':_0xb75d('0x4'),'as':_0xb75d('0x6'),'attributes':['id',_0xb75d('0x7'),_0xb75d('0x5'),_0xb75d('0x8')]},{'model':_0xb75d('0x9'),'as':_0xb75d('0xa'),'attributes':['id',_0xb75d('0xb'),_0xb75d('0xc'),_0xb75d('0xd'),_0xb75d('0xe'),_0xb75d('0xf'),'data5',_0xb75d('0x10'),_0xb75d('0x11')]}]},'log':_0xb75d('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index db149bc..936bda4 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 _0xfdc5=['../client','getTrunks','Request','GetTrunk','name','defaultuser'];(function(_0x32bea2,_0x2e360d){var _0x3a8a88=function(_0x5d9e28){while(--_0x5d9e28){_0x32bea2['push'](_0x32bea2['shift']());}};_0x3a8a88(++_0x2e360d);}(_0xfdc5,0xa8));var _0x5fdc=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xfdc5[_0x2faddb];return _0x273c05;};'use strict';var client=require(_0x5fdc('0x0'));exports[_0x5fdc('0x1')]=function(_0x11cdbc){return function(_0xfa657e){return client[_0x5fdc('0x2')](_0x5fdc('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5fdc('0x4'),'registry',_0x5fdc('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x3fec=['name','GetTrunk','../client','Request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc3fe('0x0'));exports['getTrunks']=function(_0x502342){return function(_0x3096c1){return client[_0xc3fe('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc3fe('0x2'),'registry','defaultuser']},'log':_0xc3fe('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 990ab0d..b415faa 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x5e41ef,_0x4f9890){var _0x3e8286=function(_0x1d04fc){while(--_0x1d04fc){_0x5e41ef['push'](_0x5e41ef['shift']());}};_0x3e8286(++_0x4f9890);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xcb91[_0xf34b0a];return _0x5021e1;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6d0f33a..a6809d7 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 _0xa212=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x395f27,_0x312782){var _0x418034=function(_0x17022a){while(--_0x17022a){_0x395f27['push'](_0x395f27['shift']());}};_0x418034(++_0x312782);}(_0xa212,0xeb));var _0x2a21=function(_0x10e802,_0x81411d){_0x10e802=_0x10e802-0x0;var _0x5f132a=_0xa212[_0x10e802];return _0x5f132a;};'use strict';var client=require(_0x2a21('0x0'));exports[_0x2a21('0x1')]=function(_0x2a1a10){return client['Request'](_0x2a21('0x2'),{'body':_0x2a1a10,'log':_0x2a21('0x2')});};exports[_0x2a21('0x3')]=function(_0x48c22e,_0x1bcdb4,_0x2b815d){return client[_0x2a21('0x4')](_0x2a21('0x5'),{'body':_0x48c22e,'options':{'where':{'uniqueid':_0x1bcdb4,'interface':_0x2b815d,'agentcomplete':!![]}},'log':_0x2a21('0x5')});}; \ No newline at end of file +var _0x10d4=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x10d4,0x12b));var _0x410d=function(_0x3cb260,_0x329d33){_0x3cb260=_0x3cb260-0x0;var _0xa99a90=_0x10d4[_0x3cb260];return _0xa99a90;};'use strict';var client=require(_0x410d('0x0'));exports['create']=function(_0xfc9ec5){return client[_0x410d('0x1')](_0x410d('0x2'),{'body':_0xfc9ec5,'log':_0x410d('0x2')});};exports['update']=function(_0x2ef515,_0x288457,_0x552188){return client[_0x410d('0x1')](_0x410d('0x3'),{'body':_0x2ef515,'options':{'where':{'uniqueid':_0x288457,'interface':_0x552188,'agentcomplete':!![]}},'log':_0x410d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0c76249..329a732 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 _0xe004=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xe004,0x15a));var _0x4e00=function(_0x26e031,_0x55fe47){_0x26e031=_0x26e031-0x0;var _0x4f3869=_0xe004[_0x26e031];return _0x4f3869;};'use strict';var moment=require(_0x4e00('0x0'));var util=require(_0x4e00('0x1'));var _=require(_0x4e00('0x2'));var client=require(_0x4e00('0x3'));exports['create']=function(_0x4b311f){return client[_0x4e00('0x4')](_0x4e00('0x5'),{'body':_[_0x4e00('0x6')](_0x4b311f,{'source':_0x4b311f[_0x4e00('0x7')],'destinationcontext':_0x4b311f['context'],'callerid':_0x4b311f['callerid'],'amaflags':_0x4e00('0x8')}),'log':_0x4e00('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x4e00('0x4')](_0x4e00('0x9'),{'options':{'where':{'type':[_0x4e00('0xa')],'createdAt':{'$between':[moment()[_0x4e00('0xb')]('day')[_0x4e00('0xc')](_0x4e00('0xd')),moment()[_0x4e00('0xe')](_0x4e00('0xf'))[_0x4e00('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4e00('0x10'),_0x4e00('0x11'),_0x4e00('0x12'),_0x4e00('0x13')]},'log':_0x4e00('0x14')});};}; \ No newline at end of file +var _0x57a4=['moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','billableseconds'];(function(_0x5bebe2,_0x3c369d){var _0x23fa6f=function(_0x5edde3){while(--_0x5edde3){_0x5bebe2['push'](_0x5bebe2['shift']());}};_0x23fa6f(++_0x3c369d);}(_0x57a4,0x1cc));var _0x457a=function(_0x27a257,_0x4a001d){_0x27a257=_0x27a257-0x0;var _0xf4dbf4=_0x57a4[_0x27a257];return _0xf4dbf4;};'use strict';var moment=require(_0x457a('0x0'));var util=require('util');var _=require(_0x457a('0x1'));var client=require(_0x457a('0x2'));exports[_0x457a('0x3')]=function(_0x2fa871){return client[_0x457a('0x4')](_0x457a('0x5'),{'body':_[_0x457a('0x6')](_0x2fa871,{'source':_0x2fa871[_0x457a('0x7')],'destinationcontext':_0x2fa871['context'],'callerid':_0x2fa871[_0x457a('0x8')],'amaflags':_0x457a('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x457a('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x457a('0xb')],'createdAt':{'$between':[moment()[_0x457a('0xc')](_0x457a('0xd'))['format'](_0x457a('0xe')),moment()[_0x457a('0xf')]('day')[_0x457a('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x457a('0x11'),_0x457a('0x12'),'duration',_0x457a('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index aff0a9a..d431371 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 _0x03a4=['create','Request','CreateVoiceDialReport','../client'];(function(_0x552180,_0x32ed3c){var _0xdcb0ee=function(_0x310fa4){while(--_0x310fa4){_0x552180['push'](_0x552180['shift']());}};_0xdcb0ee(++_0x32ed3c);}(_0x03a4,0xf3));var _0x403a=function(_0x5574ba,_0x1f0b57){_0x5574ba=_0x5574ba-0x0;var _0x172ffd=_0x03a4[_0x5574ba];return _0x172ffd;};'use strict';var client=require(_0x403a('0x0'));exports[_0x403a('0x1')]=function(_0x3054a8){return client[_0x403a('0x2')](_0x403a('0x3'),{'body':_0x3054a8,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3a90=['Request','CreateVoiceDialReport','../client','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3a90,0x18a));var _0x03a9=function(_0x341cbb,_0x3d6743){_0x341cbb=_0x341cbb-0x0;var _0xeb9eff=_0x3a90[_0x341cbb];return _0xeb9eff;};'use strict';var client=require(_0x03a9('0x0'));exports[_0x03a9('0x1')]=function(_0x38979f){return client[_0x03a9('0x2')](_0x03a9('0x3'),{'body':_0x38979f,'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 207716b..8a49b36 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 _0x2821=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x13c082,_0x154bd5){var _0x5ae412=function(_0x3e5539){while(--_0x3e5539){_0x13c082['push'](_0x13c082['shift']());}};_0x5ae412(++_0x154bd5);}(_0x2821,0x87));var _0x1282=function(_0x27379e,_0xc72b55){_0x27379e=_0x27379e-0x0;var _0x273c00=_0x2821[_0x27379e];return _0x273c00;};'use strict';var client=require(_0x1282('0x0'));exports[_0x1282('0x1')]=function(){return function(){return client[_0x1282('0x2')](_0x1282('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1282('0x4'),_0x1282('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x1282('0x1')});};}; \ No newline at end of file +var _0xee4e=['../client','getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x2254a2,_0x8e4657){var _0x307643=function(_0x45174b){while(--_0x45174b){_0x2254a2['push'](_0x2254a2['shift']());}};_0x307643(++_0x8e4657);}(_0xee4e,0x122));var _0xeee4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xee4e[_0x4b2436];return _0x4f5ab2;};'use strict';var client=require(_0xeee4('0x0'));exports[_0xeee4('0x1')]=function(){return function(){return client[_0xeee4('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xeee4('0x3'),_0xeee4('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xeee4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 234ce3a..c5b29b6 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 _0x2f1f=['dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber'];(function(_0x17ff38,_0x2f5bc1){var _0x18261f=function(_0x27aa2e){while(--_0x27aa2e){_0x17ff38['push'](_0x17ff38['shift']());}};_0x18261f(++_0x2f5bc1);}(_0x2f1f,0x109));var _0xf2f1=function(_0x3b8084,_0x4be3e5){_0x3b8084=_0x3b8084-0x0;var _0xc0d740=_0x2f1f[_0x3b8084];return _0xc0d740;};'use strict';var client=require('../client');exports[_0xf2f1('0x0')]=function(){return function(){return client[_0xf2f1('0x1')](_0xf2f1('0x2'),{'options':{'raw':![],'attributes':['id',_0xf2f1('0x3'),'acw',_0xf2f1('0x4'),'autopause',_0xf2f1('0x5'),_0xf2f1('0x6'),_0xf2f1('0x7'),'dialMethod','dialLimitChannel','dialLimitQueue',_0xf2f1('0x8'),_0xf2f1('0x9'),_0xf2f1('0xa'),_0xf2f1('0xb'),_0xf2f1('0xc'),_0xf2f1('0xd'),_0xf2f1('0xe'),'dialQueueOptions','dialQueueTimeout',_0xf2f1('0xf'),_0xf2f1('0x10'),_0xf2f1('0x11'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xf2f1('0x12'),'dialNoAnswerRetryFrequency',_0xf2f1('0x13'),'dialTimezone',_0xf2f1('0x14'),'dialPrefix',_0xf2f1('0x15'),_0xf2f1('0x16'),_0xf2f1('0x17'),_0xf2f1('0x18'),_0xf2f1('0x19'),_0xf2f1('0x1a'),'dialAMDMinWordLength',_0xf2f1('0x1b'),_0xf2f1('0x1c'),_0xf2f1('0x1d'),_0xf2f1('0x1e'),_0xf2f1('0x1f'),_0xf2f1('0x20'),_0xf2f1('0x21'),_0xf2f1('0x22'),_0xf2f1('0x23'),_0xf2f1('0x24'),_0xf2f1('0x25'),_0xf2f1('0x5'),_0xf2f1('0x26'),_0xf2f1('0x27'),_0xf2f1('0x28'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xf2f1('0x29'),_0xf2f1('0x2a'),_0xf2f1('0x2b'),_0xf2f1('0x2c'),_0xf2f1('0x2d'),'dialMachineRetryFrequency',_0xf2f1('0x2e'),_0xf2f1('0x2f'),_0xf2f1('0x30'),_0xf2f1('0x31'),_0xf2f1('0x32'),_0xf2f1('0x33'),'dialPreviewRecallmeReminder',_0xf2f1('0x34')],'include':[{'model':_0xf2f1('0x35'),'as':_0xf2f1('0x35'),'attributes':['id',_0xf2f1('0x3'),_0xf2f1('0x36'),'active']},{'model':_0xf2f1('0x37'),'as':_0xf2f1('0x38'),'attributes':['id',_0xf2f1('0x3')]},{'model':_0xf2f1('0x35'),'as':_0xf2f1('0x39'),'attributes':['id','name','callerid',_0xf2f1('0x3a')]},{'model':_0xf2f1('0x3b'),'as':'Interval','attributes':['id',_0xf2f1('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0xf2f1('0x3c')]}]}]},'log':_0xf2f1('0x0')});};}; \ No newline at end of file +var _0xcf3e=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','TrunkBackup','Interval','../client','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x2d4e29,_0x507c12){var _0x3e6792=function(_0x274685){while(--_0x274685){_0x2d4e29['push'](_0x2d4e29['shift']());}};_0x3e6792(++_0x507c12);}(_0xcf3e,0x1b2));var _0xecf3=function(_0x2bcccb,_0x4a13ae){_0x2bcccb=_0x2bcccb-0x0;var _0x5139c2=_0xcf3e[_0x2bcccb];return _0x5139c2;};'use strict';var client=require(_0xecf3('0x0'));exports[_0xecf3('0x1')]=function(){return function(){return client['Request'](_0xecf3('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xecf3('0x3'),_0xecf3('0x4'),_0xecf3('0x5'),_0xecf3('0x6'),_0xecf3('0x7'),_0xecf3('0x8'),_0xecf3('0x9'),_0xecf3('0xa'),_0xecf3('0xb'),_0xecf3('0xc'),_0xecf3('0xd'),'dialPredictiveOptimizationPercentage',_0xecf3('0xe'),_0xecf3('0xf'),_0xecf3('0x10'),_0xecf3('0x11'),'dialQueueOptions',_0xecf3('0x12'),'dialQueueProject',_0xecf3('0x13'),_0xecf3('0x14'),_0xecf3('0x15'),_0xecf3('0x16'),'dialNoAnswerMaxRetry',_0xecf3('0x17'),_0xecf3('0x18'),'dialTimezone',_0xecf3('0x19'),_0xecf3('0x1a'),_0xecf3('0x1b'),_0xecf3('0x1c'),_0xecf3('0x1d'),'dialAMDGreeting',_0xecf3('0x1e'),'dialAMDTotalAnalysisTime',_0xecf3('0x1f'),_0xecf3('0x20'),'dialAMDMaximumNumberOfWords',_0xecf3('0x21'),'dialAMDMaximumWordLength',_0xecf3('0x22'),'dialRecallMeTimeout',_0xecf3('0x23'),'dialOrderByScheduledAt',_0xecf3('0x24'),_0xecf3('0x25'),'dialQueueProject2',_0xecf3('0x6'),_0xecf3('0x26'),_0xecf3('0x27'),_0xecf3('0x28'),_0xecf3('0x29'),_0xecf3('0x2a'),'dialDropMaxRetry',_0xecf3('0x2b'),_0xecf3('0x2c'),_0xecf3('0x2d'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xecf3('0x2e'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xecf3('0x2f'),_0xecf3('0x30'),_0xecf3('0x31'),_0xecf3('0x32'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0xecf3('0x33'),'as':_0xecf3('0x33'),'attributes':['id','name',_0xecf3('0x34'),_0xecf3('0x35')]},{'model':_0xecf3('0x36'),'as':_0xecf3('0x37'),'attributes':['id',_0xecf3('0x38')]},{'model':_0xecf3('0x33'),'as':_0xecf3('0x39'),'attributes':['id',_0xecf3('0x38'),'callerid',_0xecf3('0x35')]},{'model':_0xecf3('0x3a'),'as':_0xecf3('0x3a'),'attributes':['id','name'],'include':[{'model':_0xecf3('0x3a'),'as':'Intervals','attributes':['id','name','interval']}]}]},'log':_0xecf3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4364d3e..1957fa0 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(_0x24a61e,_0x4ba16b){var _0x322ecf=function(_0x8719aa){while(--_0x8719aa){_0x24a61e['push'](_0x24a61e['shift']());}};_0x322ecf(++_0x4ba16b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x115577,_0x4b7ed9){var _0x403b0d=function(_0x51133d){while(--_0x51133d){_0x115577['push'](_0x115577['shift']());}};_0x403b0d(++_0x4b7ed9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 da13427..7a439ff 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 _0xfc45=['../client','getVoiceQueueRtPauses','Request'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0xfc45,0xb7));var _0x5fc4=function(_0x390151,_0x90351){_0x390151=_0x390151-0x0;var _0x1e61c4=_0xfc45[_0x390151];return _0x1e61c4;};'use strict';var client=require(_0x5fc4('0x0'));exports[_0x5fc4('0x1')]=function(_0x34f236){return function(){return client[_0x5fc4('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x34f236,'paused':!![]},'raw':!![]},'log':_0x5fc4('0x1')});};}; \ No newline at end of file +var _0x5e3e=['../client','GetVoiceQueueRtPauses'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x5e3e,0x6c));var _0xe5e3=function(_0xf5fa0d,_0x17485e){_0xf5fa0d=_0xf5fa0d-0x0;var _0x2633e3=_0x5e3e[_0xf5fa0d];return _0x2633e3;};'use strict';var client=require(_0xe5e3('0x0'));exports['getVoiceQueueRtPauses']=function(_0x50deee){return function(){return client['Request'](_0xe5e3('0x1'),{'options':{'where':{'VoiceQueueId':_0x50deee,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f0d1dbe..32ce463 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(_0x87abf1,_0x1e5ecc){var _0x1d9d7a=function(_0x1990fb){while(--_0x1990fb){_0x87abf1['push'](_0x87abf1['shift']());}};_0x1d9d7a(++_0x1e5ecc);}(_0x7a54,0x106));var _0x47a5=function(_0x206962,_0x13ccea){_0x206962=_0x206962-0x0;var _0x5672ef=_0x7a54[_0x206962];return _0x5672ef;};'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(_0x16772c,_0x1ab8a3){var _0x56e906=function(_0x1b2c81){while(--_0x1b2c81){_0x16772c['push'](_0x16772c['shift']());}};_0x56e906(++_0x1ab8a3);}(_0x7a54,0x106));var _0x47a5=function(_0x25cdc7,_0x4a3be1){_0x25cdc7=_0x25cdc7-0x0;var _0x4f7790=_0x7a54[_0x25cdc7];return _0x4f7790;};'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 4882b20..ee3d742 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 _0x1bba=['transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext'];(function(_0x412921,_0x92f5ed){var _0x2016dc=function(_0x49797f){while(--_0x49797f){_0x412921['push'](_0x412921['shift']());}};_0x2016dc(++_0x92f5ed);}(_0x1bba,0x11e));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xa1bb('0x0')]={};exports[_0xa1bb('0x1')]=function(_0x7b018f){return client[_0xa1bb('0x2')](_0xa1bb('0x3'),{'body':{'result':_0x7b018f[_0xa1bb('0x4')],'transfererchannel':_0x7b018f[_0xa1bb('0x5')],'transferercalleridnum':_0x7b018f['transferercalleridnum'],'transferercalleridname':_0x7b018f[_0xa1bb('0x6')],'transfererconnectedlinenum':_0x7b018f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x7b018f[_0xa1bb('0x7')],'transfereraccountcode':_0x7b018f[_0xa1bb('0x8')],'transferercontext':_0x7b018f[_0xa1bb('0x9')],'transfererexten':_0x7b018f[_0xa1bb('0xa')],'transfererlinkedid':_0x7b018f[_0xa1bb('0xb')],'transfereechannel':_0x7b018f[_0xa1bb('0xc')],'transfereecalleridnum':_0x7b018f[_0xa1bb('0xd')],'transfereecalleridname':_0x7b018f[_0xa1bb('0xe')],'transfereeconnectedlinenum':_0x7b018f[_0xa1bb('0xf')],'transfereeconnectedlinename':_0x7b018f[_0xa1bb('0x10')],'transfereeaccountcode':_0x7b018f[_0xa1bb('0x11')],'transfereecontext':_0x7b018f[_0xa1bb('0x12')],'transfereeexten':_0x7b018f[_0xa1bb('0x13')],'transfereelinkedid':_0x7b018f[_0xa1bb('0x14')],'isexternal':_0x7b018f[_0xa1bb('0x15')],'context':_0x7b018f['context'],'extension':_0x7b018f[_0xa1bb('0x16')],'type':_0xa1bb('0x17')},'log':_0xa1bb('0x3')});};exports['attendedTransfer']=function(_0x293d07){return client[_0xa1bb('0x2')](_0xa1bb('0x3'),{'body':{'result':_0x293d07[_0xa1bb('0x4')],'transfererchannel':_0x293d07['origtransfererchannel'],'transferercalleridnum':_0x293d07['origtransferercalleridnum'],'transferercalleridname':_0x293d07[_0xa1bb('0x18')],'transfererconnectedlinenum':_0x293d07['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x293d07[_0xa1bb('0x19')],'transfereraccountcode':_0x293d07['origtransfereraccountcode'],'transferercontext':_0x293d07[_0xa1bb('0x1a')],'transfererexten':_0x293d07['secondtransfererexten'],'transfererlinkedid':_0x293d07[_0xa1bb('0x1b')],'transfereechannel':_0x293d07[_0xa1bb('0x1c')],'transfereecalleridnum':_0x293d07[_0xa1bb('0x1d')],'transfereecalleridname':_0x293d07['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x293d07[_0xa1bb('0x1e')],'transfereeconnectedlinename':_0x293d07['transfertargetconnectedlinename'],'transfereeaccountcode':_0x293d07[_0xa1bb('0x1f')],'transfereecontext':_0x293d07[_0xa1bb('0x20')],'transfereeexten':_0x293d07[_0xa1bb('0x21')],'transfereelinkedid':_0x293d07['transfertargetlinkedid'],'isexternal':_0x293d07[_0xa1bb('0x15')],'context':_0x293d07[_0xa1bb('0x22')],'extension':_0x293d07[_0xa1bb('0x23')],'type':_0xa1bb('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xbfc6=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xbfc6,0x6d));var _0x6bfc=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0xbfc6[_0x2812c2];return _0x218ac9;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x6bfc('0x0')]=function(_0x1deba2){return client[_0x6bfc('0x1')](_0x6bfc('0x2'),{'body':{'result':_0x1deba2['result'],'transfererchannel':_0x1deba2[_0x6bfc('0x3')],'transferercalleridnum':_0x1deba2['transferercalleridnum'],'transferercalleridname':_0x1deba2[_0x6bfc('0x4')],'transfererconnectedlinenum':_0x1deba2[_0x6bfc('0x5')],'transfererconnectedlinename':_0x1deba2[_0x6bfc('0x6')],'transfereraccountcode':_0x1deba2[_0x6bfc('0x7')],'transferercontext':_0x1deba2[_0x6bfc('0x8')],'transfererexten':_0x1deba2[_0x6bfc('0x9')],'transfererlinkedid':_0x1deba2['transfererlinkedid'],'transfereechannel':_0x1deba2[_0x6bfc('0xa')],'transfereecalleridnum':_0x1deba2['transfereecalleridnum'],'transfereecalleridname':_0x1deba2['transfereecalleridname'],'transfereeconnectedlinenum':_0x1deba2[_0x6bfc('0xb')],'transfereeconnectedlinename':_0x1deba2[_0x6bfc('0xc')],'transfereeaccountcode':_0x1deba2[_0x6bfc('0xd')],'transfereecontext':_0x1deba2[_0x6bfc('0xe')],'transfereeexten':_0x1deba2[_0x6bfc('0xf')],'transfereelinkedid':_0x1deba2[_0x6bfc('0x10')],'isexternal':_0x1deba2['isexternal'],'context':_0x1deba2[_0x6bfc('0x11')],'extension':_0x1deba2[_0x6bfc('0x12')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x6bfc('0x13')]=function(_0x1391af){return client[_0x6bfc('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1391af['result'],'transfererchannel':_0x1391af[_0x6bfc('0x14')],'transferercalleridnum':_0x1391af[_0x6bfc('0x15')],'transferercalleridname':_0x1391af[_0x6bfc('0x16')],'transfererconnectedlinenum':_0x1391af['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1391af[_0x6bfc('0x17')],'transfereraccountcode':_0x1391af[_0x6bfc('0x18')],'transferercontext':_0x1391af[_0x6bfc('0x19')],'transfererexten':_0x1391af[_0x6bfc('0x1a')],'transfererlinkedid':_0x1391af[_0x6bfc('0x1b')],'transfereechannel':_0x1391af[_0x6bfc('0x1c')],'transfereecalleridnum':_0x1391af[_0x6bfc('0x1d')],'transfereecalleridname':_0x1391af[_0x6bfc('0x1e')],'transfereeconnectedlinenum':_0x1391af[_0x6bfc('0x1f')],'transfereeconnectedlinename':_0x1391af[_0x6bfc('0x20')],'transfereeaccountcode':_0x1391af[_0x6bfc('0x21')],'transfereecontext':_0x1391af[_0x6bfc('0x22')],'transfereeexten':_0x1391af[_0x6bfc('0x23')],'transfereelinkedid':_0x1391af[_0x6bfc('0x24')],'isexternal':_0x1391af['isexternal'],'context':_0x1391af['origtransferercontext'],'extension':_0x1391af['origtransfererexten'],'type':_0x6bfc('0x25')},'log':_0x6bfc('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7c875b2..43e7afa 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 _0x7894=['outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','map','uniqueid','channel','format','%s.%s','filename','Action','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../../../config/environment','../ami','listen','%s/%s','name','timers','timer','updateAcw','agents','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','keys','module','Reload','then','catch','error','pick','command','action','Command','message','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0xb6670e,_0x5de985){var _0xd94d42=function(_0x25403d){while(--_0x25403d){_0xb6670e['push'](_0xb6670e['shift']());}};_0xd94d42(++_0x5de985);}(_0x7894,0x170));var _0x4789=function(_0x5b2fec,_0x2c20ac){_0x5b2fec=_0x5b2fec-0x0;var _0x330d0f=_0x7894[_0x5b2fec];return _0x330d0f;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var jayson=require(_0x4789('0x2'));var schema=require(_0x4789('0x3'));var moment=require(_0x4789('0x4'));var config=require(_0x4789('0x5'));var properties=require('../properties');var ami=require(_0x4789('0x6'));exports[_0x4789('0x7')]=function(_0x4e2393,_0x3394f6,_0x4bfe85){return new Promise(function(_0x1b4e02,_0x12ef33){var _0x114a90={'QueuePause':function(_0x298902){return new Promise(function(_0x13b7f6){var _0x5a45ae=util['format'](_0x4789('0x8'),'SIP',_0x298902[_0x4789('0x9')]);if(_0x4e2393[_0x4789('0xa')]&&_0x4e2393[_0x4789('0xa')][_0x5a45ae]&&_0x4e2393['timers'][_0x5a45ae][_0x4789('0xb')]){_0x4e2393['timers'][_0x5a45ae][_0x4789('0xc')]();}if(_0x4e2393[_0x4789('0xd')][_0x5a45ae]){_0x4e2393[_0x4789('0xd')][_0x5a45ae]['updateStatusRealtime']({'statePause':_0x298902['pause']?!![]:![]});}_0x13b7f6({'code':0xc8,'message':_0x4789('0xe')});});},'Reload':function(_0x4a1b86){var _0xf73460=this;return new Promise(function(_0x58743a,_0x25a4a9){if(ami[_0x4789('0xf')]()==![]){return _0x25a4a9(_0xf73460['error'](0x1f4,[config[_0x4789('0x10')]['ip'],config['asterisk'][_0x4789('0x11')],_0x4789('0x12')][_0x4789('0x13')]('\x20')));}_0x4a1b86=_['pick'](_0x4a1b86,_[_0x4789('0x14')](properties[_0x4789('0x15')]));_0x4a1b86['action']=_0x4789('0x16');return ami['Action'](_0x4a1b86)[_0x4789('0x17')](function(_0xb11831){_0x58743a({'code':0xc8,'message':_0xb11831['message']});})[_0x4789('0x18')](function(_0x5af7b3){_0x25a4a9(_0xf73460[_0x4789('0x19')](0x1f5,_0x5af7b3['message']));});});},'Command':function(_0x19dc59){var _0x3fc0e6=this;return new Promise(function(_0x56e9c1,_0x9034c9){if(ami[_0x4789('0xf')]()==![]){return _0x9034c9(_0x3fc0e6[_0x4789('0x19')](0x1f4,[config[_0x4789('0x10')]['ip'],config[_0x4789('0x10')][_0x4789('0x11')],_0x4789('0x12')][_0x4789('0x13')]('\x20')));}_0x19dc59=_[_0x4789('0x1a')](_0x19dc59,_0x4789('0x1b'));_0x19dc59[_0x4789('0x1c')]=_0x4789('0x1d');return ami['Action'](_0x19dc59)[_0x4789('0x17')](function(_0x7d003b){_0x56e9c1({'code':0xc8,'message':_0x7d003b['content']});})[_0x4789('0x18')](function(_0x26884c){_0x9034c9(_0x3fc0e6['error'](0x1f5,_0x26884c[_0x4789('0x1e')]));});});},'VoiceQueues':function(){return new Promise(function(_0x1ca6ca){var _0x54d9c1=[];for(var _0xd8601e in _0x4e2393['voiceQueues']){if(_0x4e2393[_0x4789('0x1f')][_0x4789('0x20')](_0xd8601e)){var _0x307b90=_0x4e2393[_0x4789('0x1f')][_0xd8601e];var _0x435016={'id':_0x307b90['id'],'name':_0x307b90[_0x4789('0x9')],'strategy':_0x307b90[_0x4789('0x21')],'answered':_0x307b90[_0x4789('0x22')],'available':_0x307b90[_0x4789('0x23')],'loggedIn':_0x307b90[_0x4789('0x24')],'pTalking':_0x307b90[_0x4789('0x25')],'sumBillable':_0x307b90[_0x4789('0x26')],'sumDuration':_0x307b90[_0x4789('0x27')],'sumHoldTime':_0x307b90[_0x4789('0x28')]||0x0,'talking':_0x307b90[_0x4789('0x29')],'total':_0x307b90[_0x4789('0x2a')],'type':_0x307b90[_0x4789('0x2b')],'unmanaged':_0x307b90[_0x4789('0x2c')],'abandoned':_0x307b90['abandoned'],'waiting':_0x307b90['waiting'],'loggedInDb':_0x307b90[_0x4789('0x2d')]};if(_0x307b90['type']==='outbound'){_0x435016['dialActive']=_0x307b90[_0x4789('0x2e')];_0x435016[_0x4789('0x2f')]=_0x307b90[_0x4789('0x2f')];_0x435016[_0x4789('0x30')]=_0x307b90[_0x4789('0x30')];_0x435016[_0x4789('0x31')]=_0x307b90[_0x4789('0x31')];_0x435016[_0x4789('0x32')]=_0x307b90[_0x4789('0x32')];_0x435016['dialPrefix']=_0x307b90[_0x4789('0x33')];_0x435016[_0x4789('0x34')]=_0x307b90[_0x4789('0x34')];_0x435016[_0x4789('0x35')]=_0x307b90[_0x4789('0x35')];_0x435016[_0x4789('0x36')]=_0x307b90[_0x4789('0x36')];_0x435016[_0x4789('0x37')]=_0x307b90[_0x4789('0x37')];_0x435016[_0x4789('0x38')]=_0x307b90[_0x4789('0x38')];_0x435016[_0x4789('0x39')]=_0x307b90[_0x4789('0x39')];_0x435016[_0x4789('0x3a')]=_0x307b90[_0x4789('0x3a')];_0x435016['outboundDropCallsDayCallersExit']=_0x307b90[_0x4789('0x3b')];_0x435016[_0x4789('0x3c')]=_0x307b90[_0x4789('0x3c')];_0x435016[_0x4789('0x3d')]=_0x307b90[_0x4789('0x3d')];_0x435016[_0x4789('0x3e')]=_0x307b90[_0x4789('0x3e')];_0x435016['outboundOriginateFailureCallsDay']=_0x307b90[_0x4789('0x3f')];_0x435016[_0x4789('0x40')]=_0x307b90['outboundReCallsDay'];_0x435016['outboundRejectCallsDay']=_0x307b90[_0x4789('0x41')];_0x435016[_0x4789('0x42')]=_0x307b90[_0x4789('0x42')];_0x435016[_0x4789('0x43')]=_0x307b90[_0x4789('0x43')];_0x435016[_0x4789('0x44')]=_0x307b90[_0x4789('0x44')];_0x435016['predictiveIntervalAvgTalktime']=_0x307b90['predictiveIntervalAvgTalktime'];_0x435016['predictiveIntervalDroppedCallsCallersExit']=_0x307b90[_0x4789('0x45')];_0x435016[_0x4789('0x46')]=_0x307b90[_0x4789('0x46')];_0x435016[_0x4789('0x47')]=_0x307b90[_0x4789('0x47')];_0x435016[_0x4789('0x48')]=_0x307b90[_0x4789('0x48')];_0x435016['predictiveIntervalHitRate']=_0x307b90[_0x4789('0x49')];_0x435016[_0x4789('0x4a')]=_0x307b90[_0x4789('0x4a')];_0x435016['predictiveIntervalPauses']=_0x307b90[_0x4789('0x4b')];_0x435016[_0x4789('0x4c')]=_0x307b90[_0x4789('0x4c')];_0x435016[_0x4789('0x4d')]=_0x307b90[_0x4789('0x4d')];_0x435016['message']=_0x307b90[_0x4789('0x1e')];_0x435016['originated']=_0x307b90[_0x4789('0x4e')];_0x435016[_0x4789('0x4f')]=_0x307b90[_0x4789('0x4f')];_0x435016[_0x4789('0x50')]=_0x307b90[_0x4789('0x50')];_0x435016['erlangAbandonmentRate']=_0x307b90[_0x4789('0x51')];_0x435016['erlangBusyFactor']=_0x307b90[_0x4789('0x52')];_0x435016[_0x4789('0x53')]=_0x307b90['startPredictive'];_0x435016[_0x4789('0x54')]=_0x307b90['startProgressive'];}if(_0x307b90[_0x4789('0x55')]){_0x435016[_0x4789('0x55')]={'id':_0x307b90[_0x4789('0x55')]['id'],'name':_0x307b90[_0x4789('0x55')]['name'],'active':_0x307b90[_0x4789('0x55')][_0x4789('0x56')],'callerid':_0x307b90['Trunk'][_0x4789('0x57')]};}if(_0x307b90[_0x4789('0x58')]){_0x435016[_0x4789('0x58')]={'id':_0x307b90['Interval']['id'],'name':_0x307b90['Interval'][_0x4789('0x9')]};}_0x54d9c1['push'](_0x435016);}}_0x1ca6ca({'count':_0x54d9c1[_0x4789('0x59')],'rows':_0x54d9c1});});},'UpdateVoiceQueue':function(_0x577af3){return new Promise(function(_0x861bcb,_0x91e8d){var _0x147d09=_[_0x4789('0x5a')](_0x4e2393[_0x4789('0x1f')],{'id':parseInt(_0x577af3['id'])});var _0x4081bb=_[_0x4789('0x5b')](_0x577af3,['id']);if(_0x147d09){for(var _0x58782e in _0x4081bb){if(typeof _0x4081bb[_0x58782e]!==_0x4789('0x5c')&&typeof _0x147d09[_0x58782e]!==_0x4789('0x5c')){_0x147d09[_0x58782e]=_0x4081bb[_0x58782e];}}_0x861bcb(_0x147d09);}else{_0x91e8d();}});},'VoiceChannels':function(){return new Promise(function(_0x1d33d8){var _0x1c8117=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x5e')]);_0x1d33d8({'count':_0x1c8117[_0x4789('0x59')],'rows':_0x1c8117});});},'VoiceChannelMixMonitor':function(_0x1eacb3){var _0x385b1f=this;return new Promise(function(_0xcf3dd5,_0x49dbd7){if(ami[_0x4789('0xf')]()==![]){return _0x49dbd7(_0x385b1f[_0x4789('0x19')](0x1f4,[config['asterisk']['ip'],config[_0x4789('0x10')][_0x4789('0x11')],_0x4789('0x12')][_0x4789('0x13')]('\x20')));}var _0x3b09de=schema(properties['voicechannel'])[_0x4789('0x3')](_0x1eacb3);if(_0x3b09de[_0x4789('0x59')]>0x0){return _0x49dbd7(_0x385b1f[_0x4789('0x19')](0x1f4,_[_0x4789('0x5f')](_0x3b09de,_0x4789('0x1e'))[_0x4789('0x13')](',\x20')));}var _0x2ae91d=_[_0x4789('0x5a')](_0x4e2393[_0x4789('0x5e')],{'uniqueid':_0x1eacb3[_0x4789('0x60')]});if(_0x2ae91d&&_0x2ae91d[_0x4789('0x61')]){var _0x516128=util[_0x4789('0x62')](_0x4789('0x63'),_0x1eacb3[_0x4789('0x64')]||_0x1eacb3[_0x4789('0x60')],_0x1eacb3[_0x4789('0x62')]||'wav');return ami[_0x4789('0x65')]({'action':'MixMonitor','channel':_0x2ae91d['channel'],'file':_0x516128,'options':_0x4789('0x66')})[_0x4789('0x17')](function(_0x2df7b1){var _0x38c96d=_[_0x4789('0x5a')](_0x2ae91d[_0x4789('0x67')],{'filename':_0x4789('0x68')+_0x516128[_0x4789('0x69')]()});if(_['isNil'](_0x38c96d)){_0x2ae91d[_0x4789('0x67')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x516128[_0x4789('0x69')](),'createdAt':moment()['format'](_0x4789('0x6a')),'mixmonitorid':_0x2df7b1[_0x4789('0x6b')],'status':_0x4789('0x6c')});}else{_0x38c96d['mixmonitorid']=_0x2df7b1[_0x4789('0x6b')];_0x38c96d['status']=_0x4789('0x6c');}_0xcf3dd5({'code':0xc8,'message':[_0x1eacb3['uniqueid'],_0x4789('0x6d'),_0x2df7b1[_0x4789('0x6b')]][_0x4789('0x13')]('\x20'),'mixmonitorid':_0x2df7b1[_0x4789('0x6b')]});})[_0x4789('0x18')](function(_0x62453c){_0x49dbd7(_0x385b1f[_0x4789('0x19')](0x1f5,[_0x1eacb3[_0x4789('0x60')],_0x62453c[_0x4789('0x1e')]['toLowerCase']()][_0x4789('0x13')]('\x20')));});}else{return _0x49dbd7(_0x385b1f['error'](0x1f5,_0x4789('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xa04ff5){var _0x47e4b1=this;return new Promise(function(_0x3dc751,_0x1f247c){if(ami[_0x4789('0xf')]()==![]){return _0x1f247c(_0x47e4b1[_0x4789('0x19')](0x1f4,[config[_0x4789('0x10')]['ip'],config[_0x4789('0x10')][_0x4789('0x11')],_0x4789('0x12')][_0x4789('0x13')]('\x20')));}var _0xb8e547=schema(properties[_0x4789('0x6f')])[_0x4789('0x3')](_0xa04ff5);if(_0xb8e547['length']>0x0){return _0x1f247c(_0x47e4b1['error'](0x1f4,_[_0x4789('0x5f')](_0xb8e547,'message')[_0x4789('0x13')](',\x20')));}var _0x34c398=_[_0x4789('0x5a')](_0x4e2393[_0x4789('0x5e')],{'uniqueid':_0xa04ff5[_0x4789('0x60')]});if(_0x34c398){return Promise[_0x4789('0x70')]()[_0x4789('0x17')](function(){if(_0x34c398[_0x4789('0x61')]){return ami['Action']({'action':_0x4789('0x71'),'channel':_0x34c398[_0x4789('0x61')],'mixmonitorid':_0xa04ff5['mixmonitorid']})[_0x4789('0x18')](function(){});}})[_0x4789('0x17')](function(){if(_0x34c398[_0x4789('0x72')]){return ami[_0x4789('0x65')]({'action':_0x4789('0x71'),'channel':_0x34c398[_0x4789('0x72')],'mixmonitorid':_0xa04ff5['mixmonitorid']})['catch'](function(){});}})[_0x4789('0x17')](function(){var _0x277b61=_[_0x4789('0x5a')](_0x34c398[_0x4789('0x67')],{'mixmonitorid':_0xa04ff5[_0x4789('0x6b')]});if(_0x277b61){_0x277b61[_0x4789('0x73')]=_0x4789('0x74');}})[_0x4789('0x17')](function(){var _0x1c5f9a=util[_0x4789('0x62')]('%s.%s',_0xa04ff5[_0x4789('0x64')]||_0xa04ff5[_0x4789('0x60')],_0xa04ff5[_0x4789('0x62')]||'wav');var _0x40d6a6=_[_0x4789('0x5a')](_0x34c398['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x1c5f9a['toLowerCase']()});if(_0x40d6a6){_0x40d6a6[_0x4789('0x73')]='stop';}})[_0x4789('0x17')](function(){_0x3dc751({'code':0xc8,'message':[_0xa04ff5[_0x4789('0x60')],_0x4789('0x75')]['join']('\x20')});})[_0x4789('0x18')](function(_0x3b00f2){_0x1f247c(_0x47e4b1['error'](0x1f5,[_0xa04ff5['uniqueid'],_0x3b00f2[_0x4789('0x1e')][_0x4789('0x69')]()]['join']('\x20')));});}else{return _0x1f247c(_0x47e4b1[_0x4789('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x3457c1){var _0x215011=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x76')]);_0x3457c1({'count':_0x215011['length'],'rows':_0x215011});});},'VoiceQueuesChannel':function(_0x16e7f8){var _0x4602b2=this;return new Promise(function(_0x327003,_0x9d5a36){var _0x538855=schema(properties[_0x4789('0x77')])[_0x4789('0x3')](_0x16e7f8);if(_0x538855[_0x4789('0x59')]>0x0){return _0x9d5a36(_0x4602b2[_0x4789('0x19')](0x1f4,_[_0x4789('0x5f')](_0x538855,_0x4789('0x1e'))[_0x4789('0x13')](',\x20')));}var _0x392387=_[_0x4789('0x5a')](_0x4e2393[_0x4789('0x76')],{'uniqueid':_0x16e7f8[_0x4789('0x60')]});if(_0x392387){_0x327003(_0x392387);}else{return _0x9d5a36(_0x4602b2['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x49921a){var _0x5191bf=this;return new Promise(function(_0x2a2a13,_0x524bc3){if(ami[_0x4789('0xf')]()==![]){return _0x524bc3(_0x5191bf[_0x4789('0x19')](0x1f4,[config[_0x4789('0x10')]['ip'],config[_0x4789('0x10')][_0x4789('0x11')],_0x4789('0x12')]['join']('\x20')));}var _0x3736ef=schema(properties[_0x4789('0x78')])[_0x4789('0x3')](_0x49921a);if(_0x3736ef[_0x4789('0x59')]>0x0){return _0x524bc3(_0x5191bf['error'](0x1f4,_['map'](_0x3736ef,'message')[_0x4789('0x13')](',\x20')));}var _0xdf9cba=_[_0x4789('0x5a')](_0x4e2393[_0x4789('0x76')],{'uniqueid':_0x49921a[_0x4789('0x60')]});if(_0xdf9cba&&_0xdf9cba[_0x4789('0x61')]){return ami[_0x4789('0x65')]({'action':_0x4789('0x79'),'channel':_0xdf9cba['channel']})[_0x4789('0x17')](function(_0x32cb0c){_0x2a2a13({'code':0xc8,'message':[_0x49921a[_0x4789('0x60')],_0x32cb0c[_0x4789('0x1e')][_0x4789('0x69')]()][_0x4789('0x13')]('\x20')});})[_0x4789('0x18')](function(_0x1ebf51){_0x524bc3(_0x5191bf[_0x4789('0x19')](0x1f5,[_0x49921a[_0x4789('0x60')],_0x1ebf51[_0x4789('0x1e')][_0x4789('0x69')]()][_0x4789('0x13')]('\x20')));});}else{return _0x524bc3(_0x5191bf['error'](0x1f5,_0x4789('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x121ca3){var _0xdfc5a1=this;return new Promise(function(_0x3a3d70,_0x29d838){if(ami[_0x4789('0xf')]()==![]){return _0x29d838(_0xdfc5a1[_0x4789('0x19')](0x1f4,[config[_0x4789('0x10')]['ip'],config[_0x4789('0x10')][_0x4789('0x11')],_0x4789('0x12')]['join']('\x20')));}var _0x234088=schema(properties[_0x4789('0x7a')])['validate'](_0x121ca3);if(_0x234088['length']>0x0){return _0x29d838(_0xdfc5a1[_0x4789('0x19')](0x1f4,_[_0x4789('0x5f')](_0x234088,_0x4789('0x1e'))[_0x4789('0x13')](',\x20')));}var _0x4712ee=_['find'](_0x4e2393[_0x4789('0x76')],{'uniqueid':_0x121ca3[_0x4789('0x60')]});if(_0x4712ee&&_0x4712ee[_0x4789('0x61')]){return ami[_0x4789('0x65')]({'action':_0x4789('0x7b'),'channel':_0x4712ee[_0x4789('0x61')],'exten':_0x121ca3['exten'],'context':_0x121ca3['context']||_0x4712ee[_0x4789('0x7c')],'priority':0x1})[_0x4789('0x17')](function(_0x1db288){_0x3a3d70({'code':0xc8,'message':[_0x121ca3[_0x4789('0x60')],_0x1db288[_0x4789('0x1e')]['toLowerCase']()][_0x4789('0x13')]('\x20')});})[_0x4789('0x18')](function(_0x1869c2){_0x29d838(_0xdfc5a1[_0x4789('0x19')](0x1f5,[_0x121ca3[_0x4789('0x60')],_0x1869c2['message'][_0x4789('0x69')]()][_0x4789('0x13')]('\x20')));});}else{return _0x29d838(_0xdfc5a1[_0x4789('0x19')](0x1f5,_0x4789('0x6e')));}});},'Agents':function(_0x196f22){return new Promise(function(_0xf60cbd){var _0x37a3fc=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0xd')]);if(_0x196f22&&_0x196f22['id']){var _0x53f9b0=_[_0x4789('0x5a')](_0x37a3fc,function(_0x1d4a0c){return _0x1d4a0c['id']===_0x196f22['id'];});_0xf60cbd(_0x53f9b0);}else{_0xf60cbd({'count':_0x37a3fc['length'],'rows':_0x37a3fc});}});},'Telephones':function(){return new Promise(function(_0x1cd80e){var _0x406902=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x7d')]);_0x1cd80e({'count':_0x406902[_0x4789('0x59')],'rows':_0x406902});});},'Trunks':function(){return new Promise(function(_0x4f89d4){var _0x2c6faf=_['values'](_0x4e2393['trunks']);_0x4f89d4({'count':_0x2c6faf['length'],'rows':_0x2c6faf});});},'OutboundChannels':function(){return new Promise(function(_0x1ba419){var _0x1dbaaf=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x7e')]);_0x1ba419({'count':_0x1dbaaf[_0x4789('0x59')],'rows':_0x1dbaaf});});},'Outbound':function(){return new Promise(function(_0x24a7ed){_0x24a7ed(_0x4e2393[_0x4789('0x7f')]);});},'Campaigns':function(){return new Promise(function(_0x42efd1){var _0x32b26f=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x80')]);_0x42efd1({'count':_0x32b26f[_0x4789('0x59')],'rows':_0x32b26f});});},'VoiceQueuesPreview':function(_0x3af7fc){var _0x3bf144=this;return new Promise(function(_0x4522e7,_0x525cea){_0x3394f6[_0x4789('0x81')](_0x3af7fc['id'])[_0x4789('0x17')](function(_0x3b62a2){_0x4522e7({'code':0xc8,'message':_0x3b62a2[_0x4789('0x1e')]});})[_0x4789('0x18')](function(_0x444aab){_0x525cea(_0x3bf144[_0x4789('0x19')](0x1f4,_0x444aab[_0x4789('0x1e')]));});});},'EventManager':function(_0x373247){var _0x35ddee=this;return new Promise(function(_0x24b13d,_0x360d78){if(!_0x373247[_0x4789('0x82')]){return _0x360d78(_0x35ddee[_0x4789('0x19')](0x1f4,_0x4789('0x83')));}ami[_0x4789('0x84')](_0x4789('0x85')+_0x373247[_0x4789('0x82')],_0x373247[_0x4789('0x1e')]);_0x24b13d({'code':0xc8,'message':_0x373247});});},'FaxAccounts':function(){return new Promise(function(_0x3f5e17){var _0x292204=_[_0x4789('0x5d')](_0x4e2393[_0x4789('0x86')]);_0x3f5e17({'count':_0x292204[_0x4789('0x59')],'rows':_0x292204});});},'SendFax':function(_0x3b8881){var _0x4b33a6=this;return new Promise(function(_0x320109,_0x12e47d){_0x4bfe85['send'](_0x3b8881)[_0x4789('0x17')](function(_0x5c5e33){_0x320109({'code':0xc8,'message':_0x5c5e33[_0x4789('0x1e')]});})[_0x4789('0x18')](function(_0x2bd683){_0x12e47d(_0x4b33a6['error'](0x1f4,_0x2bd683['message']));});});},'CheckAfterSend':function(_0x1c6f58){var _0x4595bb=this;return new Promise(function(_0x254a4f,_0x53427e){_0x4bfe85[_0x4789('0x87')](_0x1c6f58)[_0x4789('0x17')](function(_0x272ff9){_0x254a4f({'code':0xc8,'message':_0x272ff9['message']});})[_0x4789('0x18')](function(_0xd97ea5){_0x53427e(_0x4595bb[_0x4789('0x19')](0x1f4,_0xd97ea5[_0x4789('0x1e')]));});});}};var _0x3cdd30=jayson[_0x4789('0x88')](_0x114a90)[_0x4789('0x89')]();_0x3cdd30['on'](_0x4789('0x19'),function(_0x4a3b39){return _0x12ef33(_0x4a3b39);});_0x3cdd30[_0x4789('0x7')](0x232a,_0x4789('0x8a'),function(){console[_0x4789('0x8b')](_0x4789('0x8c'),0x232a);return _0x1b4e02('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x2b65=['voicequeuechannelhangup','Redirect','context','telephones','trunks','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','catch','error','isConnected','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','undefined','values','length','voicechannel','map','channels','%s.%s','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel'];(function(_0x3a9083,_0x3c9f8d){var _0x160306=function(_0x312020){while(--_0x312020){_0x3a9083['push'](_0x3a9083['shift']());}};_0x160306(++_0x3c9f8d);}(_0x2b65,0x131));var _0x52b6=function(_0x1899c0,_0x1084e7){_0x1899c0=_0x1899c0-0x0;var _0x3d6142=_0x2b65[_0x1899c0];return _0x3d6142;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var jayson=require(_0x52b6('0x2'));var schema=require(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var config=require(_0x52b6('0x5'));var properties=require(_0x52b6('0x6'));var ami=require(_0x52b6('0x7'));exports['listen']=function(_0x3b8e05,_0x2a1355,_0x4707f3){return new Promise(function(_0x2c643d,_0x25593f){var _0x2d451f={'QueuePause':function(_0x70579){return new Promise(function(_0x1af78f){var _0x432726=util[_0x52b6('0x8')]('%s/%s',_0x52b6('0x9'),_0x70579[_0x52b6('0xa')]);if(_0x3b8e05[_0x52b6('0xb')]&&_0x3b8e05['timers'][_0x432726]&&_0x3b8e05[_0x52b6('0xb')][_0x432726][_0x52b6('0xc')]){_0x3b8e05[_0x52b6('0xb')][_0x432726][_0x52b6('0xd')]();}if(_0x3b8e05['agents'][_0x432726]){_0x3b8e05[_0x52b6('0xe')][_0x432726][_0x52b6('0xf')]({'statePause':_0x70579[_0x52b6('0x10')]?!![]:![]});}_0x1af78f({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x247d40){var _0xc7ccc2=this;return new Promise(function(_0x5292e4,_0x10afe3){if(ami['isConnected']()==![]){return _0x10afe3(_0xc7ccc2['error'](0x1f4,[config[_0x52b6('0x11')]['ip'],config[_0x52b6('0x11')][_0x52b6('0x12')],_0x52b6('0x13')][_0x52b6('0x14')]('\x20')));}_0x247d40=_[_0x52b6('0x15')](_0x247d40,_[_0x52b6('0x16')](properties[_0x52b6('0x17')]));_0x247d40[_0x52b6('0x18')]=_0x52b6('0x19');return ami[_0x52b6('0x1a')](_0x247d40)[_0x52b6('0x1b')](function(_0x386aa8){_0x5292e4({'code':0xc8,'message':_0x386aa8['message']});})[_0x52b6('0x1c')](function(_0x2fa3ed){_0x10afe3(_0xc7ccc2[_0x52b6('0x1d')](0x1f5,_0x2fa3ed['message']));});});},'Command':function(_0x36d376){var _0x184ee8=this;return new Promise(function(_0x5dea00,_0x4821e3){if(ami[_0x52b6('0x1e')]()==![]){return _0x4821e3(_0x184ee8['error'](0x1f4,[config[_0x52b6('0x11')]['ip'],config['asterisk'][_0x52b6('0x12')],_0x52b6('0x13')][_0x52b6('0x14')]('\x20')));}_0x36d376=_[_0x52b6('0x15')](_0x36d376,'command');_0x36d376[_0x52b6('0x18')]=_0x52b6('0x1f');return ami[_0x52b6('0x1a')](_0x36d376)[_0x52b6('0x1b')](function(_0x183316){_0x5dea00({'code':0xc8,'message':_0x183316[_0x52b6('0x20')]});})[_0x52b6('0x1c')](function(_0x272d07){_0x4821e3(_0x184ee8[_0x52b6('0x1d')](0x1f5,_0x272d07['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x2a97c0){var _0x2ff6f4=[];for(var _0x3a2fb0 in _0x3b8e05[_0x52b6('0x21')]){if(_0x3b8e05[_0x52b6('0x21')][_0x52b6('0x22')](_0x3a2fb0)){var _0x1a87a2=_0x3b8e05[_0x52b6('0x21')][_0x3a2fb0];var _0xa971b={'id':_0x1a87a2['id'],'name':_0x1a87a2[_0x52b6('0xa')],'strategy':_0x1a87a2[_0x52b6('0x23')],'answered':_0x1a87a2[_0x52b6('0x24')],'available':_0x1a87a2[_0x52b6('0x25')],'loggedIn':_0x1a87a2[_0x52b6('0x26')],'pTalking':_0x1a87a2[_0x52b6('0x27')],'sumBillable':_0x1a87a2[_0x52b6('0x28')],'sumDuration':_0x1a87a2['sumDuration'],'sumHoldTime':_0x1a87a2[_0x52b6('0x29')]||0x0,'talking':_0x1a87a2[_0x52b6('0x2a')],'total':_0x1a87a2[_0x52b6('0x2b')],'type':_0x1a87a2[_0x52b6('0x2c')],'unmanaged':_0x1a87a2[_0x52b6('0x2d')],'abandoned':_0x1a87a2[_0x52b6('0x2e')],'waiting':_0x1a87a2[_0x52b6('0x2f')],'loggedInDb':_0x1a87a2['loggedInDb']};if(_0x1a87a2[_0x52b6('0x2c')]===_0x52b6('0x30')){_0xa971b['dialActive']=_0x1a87a2[_0x52b6('0x31')];_0xa971b[_0x52b6('0x32')]=_0x1a87a2[_0x52b6('0x32')];_0xa971b[_0x52b6('0x33')]=_0x1a87a2[_0x52b6('0x33')];_0xa971b['dialOriginateCallerIdNumber']=_0x1a87a2[_0x52b6('0x34')];_0xa971b['dialOriginateTimeout']=_0x1a87a2[_0x52b6('0x35')];_0xa971b[_0x52b6('0x36')]=_0x1a87a2[_0x52b6('0x36')];_0xa971b[_0x52b6('0x37')]=_0x1a87a2[_0x52b6('0x37')];_0xa971b[_0x52b6('0x38')]=_0x1a87a2['outboundAnswerAgiCallsDay'];_0xa971b[_0x52b6('0x39')]=_0x1a87a2[_0x52b6('0x39')];_0xa971b[_0x52b6('0x3a')]=_0x1a87a2['outboundBlacklistCallsDay'];_0xa971b['outboundBusyCallsDay']=_0x1a87a2[_0x52b6('0x3b')];_0xa971b[_0x52b6('0x3c')]=_0x1a87a2['outboundCongestionCallsDay'];_0xa971b[_0x52b6('0x3d')]=_0x1a87a2[_0x52b6('0x3d')];_0xa971b[_0x52b6('0x3e')]=_0x1a87a2[_0x52b6('0x3e')];_0xa971b[_0x52b6('0x3f')]=_0x1a87a2[_0x52b6('0x3f')];_0xa971b[_0x52b6('0x40')]=_0x1a87a2[_0x52b6('0x40')];_0xa971b[_0x52b6('0x41')]=_0x1a87a2[_0x52b6('0x41')];_0xa971b[_0x52b6('0x42')]=_0x1a87a2[_0x52b6('0x42')];_0xa971b['outboundReCallsDay']=_0x1a87a2[_0x52b6('0x43')];_0xa971b[_0x52b6('0x44')]=_0x1a87a2[_0x52b6('0x44')];_0xa971b[_0x52b6('0x45')]=_0x1a87a2[_0x52b6('0x45')];_0xa971b['predictiveIntervalAnsweredCalls']=_0x1a87a2['predictiveIntervalAnsweredCalls'];_0xa971b[_0x52b6('0x46')]=_0x1a87a2[_0x52b6('0x46')];_0xa971b['predictiveIntervalAvgTalktime']=_0x1a87a2['predictiveIntervalAvgTalktime'];_0xa971b[_0x52b6('0x47')]=_0x1a87a2['predictiveIntervalDroppedCallsCallersExit'];_0xa971b['predictiveIntervalDroppedCallsTimeout']=_0x1a87a2['predictiveIntervalDroppedCallsTimeout'];_0xa971b[_0x52b6('0x48')]=_0x1a87a2[_0x52b6('0x48')];_0xa971b[_0x52b6('0x49')]=_0x1a87a2[_0x52b6('0x49')];_0xa971b[_0x52b6('0x4a')]=_0x1a87a2[_0x52b6('0x4a')];_0xa971b[_0x52b6('0x4b')]=_0x1a87a2[_0x52b6('0x4b')];_0xa971b['predictiveIntervalPauses']=_0x1a87a2[_0x52b6('0x4c')];_0xa971b[_0x52b6('0x4d')]=_0x1a87a2['predictiveIntervalAvailable'];_0xa971b[_0x52b6('0x4e')]=_0x1a87a2[_0x52b6('0x4e')];_0xa971b[_0x52b6('0x4f')]=_0x1a87a2[_0x52b6('0x4f')];_0xa971b[_0x52b6('0x50')]=_0x1a87a2[_0x52b6('0x50')];_0xa971b[_0x52b6('0x51')]=_0x1a87a2[_0x52b6('0x51')];_0xa971b['erlangCallToSecond']=_0x1a87a2[_0x52b6('0x52')];_0xa971b[_0x52b6('0x53')]=_0x1a87a2[_0x52b6('0x53')];_0xa971b[_0x52b6('0x54')]=_0x1a87a2['erlangBusyFactor'];_0xa971b[_0x52b6('0x55')]=_0x1a87a2[_0x52b6('0x55')];_0xa971b['startProgressive']=_0x1a87a2[_0x52b6('0x56')];}if(_0x1a87a2[_0x52b6('0x57')]){_0xa971b[_0x52b6('0x57')]={'id':_0x1a87a2[_0x52b6('0x57')]['id'],'name':_0x1a87a2[_0x52b6('0x57')][_0x52b6('0xa')],'active':_0x1a87a2[_0x52b6('0x57')][_0x52b6('0x58')],'callerid':_0x1a87a2[_0x52b6('0x57')][_0x52b6('0x59')]};}if(_0x1a87a2[_0x52b6('0x5a')]){_0xa971b[_0x52b6('0x5a')]={'id':_0x1a87a2[_0x52b6('0x5a')]['id'],'name':_0x1a87a2[_0x52b6('0x5a')][_0x52b6('0xa')]};}_0x2ff6f4[_0x52b6('0x5b')](_0xa971b);}}_0x2a97c0({'count':_0x2ff6f4['length'],'rows':_0x2ff6f4});});},'UpdateVoiceQueue':function(_0x56b9e2){return new Promise(function(_0x58f64f,_0x4e6778){var _0x12fcde=_[_0x52b6('0x5c')](_0x3b8e05[_0x52b6('0x21')],{'id':parseInt(_0x56b9e2['id'])});var _0xb5114c=_['omit'](_0x56b9e2,['id']);if(_0x12fcde){for(var _0x43bd61 in _0xb5114c){if(typeof _0xb5114c[_0x43bd61]!==_0x52b6('0x5d')&&typeof _0x12fcde[_0x43bd61]!==_0x52b6('0x5d')){_0x12fcde[_0x43bd61]=_0xb5114c[_0x43bd61];}}_0x58f64f(_0x12fcde);}else{_0x4e6778();}});},'VoiceChannels':function(){return new Promise(function(_0x4029bc){var _0x3cef05=_[_0x52b6('0x5e')](_0x3b8e05['channels']);_0x4029bc({'count':_0x3cef05[_0x52b6('0x5f')],'rows':_0x3cef05});});},'VoiceChannelMixMonitor':function(_0x34625a){var _0xb41fea=this;return new Promise(function(_0x29e11a,_0x361acf){if(ami[_0x52b6('0x1e')]()==![]){return _0x361acf(_0xb41fea[_0x52b6('0x1d')](0x1f4,[config[_0x52b6('0x11')]['ip'],config[_0x52b6('0x11')][_0x52b6('0x12')],_0x52b6('0x13')][_0x52b6('0x14')]('\x20')));}var _0x39a0e3=schema(properties[_0x52b6('0x60')])['validate'](_0x34625a);if(_0x39a0e3[_0x52b6('0x5f')]>0x0){return _0x361acf(_0xb41fea[_0x52b6('0x1d')](0x1f4,_[_0x52b6('0x61')](_0x39a0e3,_0x52b6('0x4f'))[_0x52b6('0x14')](',\x20')));}var _0x22dc10=_[_0x52b6('0x5c')](_0x3b8e05[_0x52b6('0x62')],{'uniqueid':_0x34625a['uniqueid']});if(_0x22dc10&&_0x22dc10['channel']){var _0x388fbe=util[_0x52b6('0x8')](_0x52b6('0x63'),_0x34625a[_0x52b6('0x64')]||_0x34625a[_0x52b6('0x65')],_0x34625a[_0x52b6('0x8')]||_0x52b6('0x66'));return ami[_0x52b6('0x1a')]({'action':_0x52b6('0x67'),'channel':_0x22dc10[_0x52b6('0x68')],'file':_0x388fbe,'options':_0x52b6('0x69')})[_0x52b6('0x1b')](function(_0x417c16){var _0x4f0a09=_[_0x52b6('0x5c')](_0x22dc10[_0x52b6('0x6a')],{'filename':_0x52b6('0x6b')+_0x388fbe[_0x52b6('0x6c')]()});if(_['isNil'](_0x4f0a09)){_0x22dc10[_0x52b6('0x6a')][_0x52b6('0x5b')]({'filename':_0x52b6('0x6b')+_0x388fbe['toLowerCase'](),'createdAt':moment()['format'](_0x52b6('0x6d')),'mixmonitorid':_0x417c16[_0x52b6('0x6e')],'status':_0x52b6('0x6f')});}else{_0x4f0a09[_0x52b6('0x6e')]=_0x417c16['mixmonitorid'];_0x4f0a09[_0x52b6('0x70')]='rec';}_0x29e11a({'code':0xc8,'message':[_0x34625a[_0x52b6('0x65')],_0x52b6('0x71'),_0x417c16[_0x52b6('0x6e')]][_0x52b6('0x14')]('\x20'),'mixmonitorid':_0x417c16[_0x52b6('0x6e')]});})['catch'](function(_0x29de8e){_0x361acf(_0xb41fea['error'](0x1f5,[_0x34625a['uniqueid'],_0x29de8e['message'][_0x52b6('0x6c')]()][_0x52b6('0x14')]('\x20')));});}else{return _0x361acf(_0xb41fea[_0x52b6('0x1d')](0x1f5,_0x52b6('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0x107335){var _0x1e5cbc=this;return new Promise(function(_0x10d8ae,_0x2edaa6){if(ami[_0x52b6('0x1e')]()==![]){return _0x2edaa6(_0x1e5cbc['error'](0x1f4,[config[_0x52b6('0x11')]['ip'],config[_0x52b6('0x11')][_0x52b6('0x12')],_0x52b6('0x13')][_0x52b6('0x14')]('\x20')));}var _0x47e4f1=schema(properties[_0x52b6('0x60')])[_0x52b6('0x3')](_0x107335);if(_0x47e4f1[_0x52b6('0x5f')]>0x0){return _0x2edaa6(_0x1e5cbc[_0x52b6('0x1d')](0x1f4,_[_0x52b6('0x61')](_0x47e4f1,_0x52b6('0x4f'))[_0x52b6('0x14')](',\x20')));}var _0x45892a=_[_0x52b6('0x5c')](_0x3b8e05['channels'],{'uniqueid':_0x107335[_0x52b6('0x65')]});if(_0x45892a){return Promise['resolve']()[_0x52b6('0x1b')](function(){if(_0x45892a[_0x52b6('0x68')]){return ami['Action']({'action':_0x52b6('0x73'),'channel':_0x45892a[_0x52b6('0x68')],'mixmonitorid':_0x107335[_0x52b6('0x6e')]})[_0x52b6('0x1c')](function(){});}})[_0x52b6('0x1b')](function(){if(_0x45892a['destinationchannel']){return ami[_0x52b6('0x1a')]({'action':_0x52b6('0x73'),'channel':_0x45892a[_0x52b6('0x74')],'mixmonitorid':_0x107335['mixmonitorid']})[_0x52b6('0x1c')](function(){});}})['then'](function(){var _0x4cba13=_['find'](_0x45892a['monitors'],{'mixmonitorid':_0x107335[_0x52b6('0x6e')]});if(_0x4cba13){_0x4cba13['status']=_0x52b6('0x75');}})[_0x52b6('0x1b')](function(){var _0x1420e6=util[_0x52b6('0x8')]('%s.%s',_0x107335['filename']||_0x107335[_0x52b6('0x65')],_0x107335['format']||_0x52b6('0x66'));var _0x4464c2=_['find'](_0x45892a[_0x52b6('0x6a')],{'filename':_0x52b6('0x6b')+_0x1420e6[_0x52b6('0x6c')]()});if(_0x4464c2){_0x4464c2[_0x52b6('0x70')]=_0x52b6('0x75');}})[_0x52b6('0x1b')](function(){_0x10d8ae({'code':0xc8,'message':[_0x107335['uniqueid'],_0x52b6('0x76')][_0x52b6('0x14')]('\x20')});})[_0x52b6('0x1c')](function(_0x435390){_0x2edaa6(_0x1e5cbc[_0x52b6('0x1d')](0x1f5,[_0x107335[_0x52b6('0x65')],_0x435390[_0x52b6('0x4f')][_0x52b6('0x6c')]()][_0x52b6('0x14')]('\x20')));});}else{return _0x2edaa6(_0x1e5cbc['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x41b89f){var _0xe6256=_[_0x52b6('0x5e')](_0x3b8e05[_0x52b6('0x77')]);_0x41b89f({'count':_0xe6256[_0x52b6('0x5f')],'rows':_0xe6256});});},'VoiceQueuesChannel':function(_0x5db48c){var _0x1b6462=this;return new Promise(function(_0x32c63a,_0xb78ca3){var _0x42c9aa=schema(properties[_0x52b6('0x78')])[_0x52b6('0x3')](_0x5db48c);if(_0x42c9aa[_0x52b6('0x5f')]>0x0){return _0xb78ca3(_0x1b6462[_0x52b6('0x1d')](0x1f4,_[_0x52b6('0x61')](_0x42c9aa,'message')[_0x52b6('0x14')](',\x20')));}var _0x3540f0=_[_0x52b6('0x5c')](_0x3b8e05[_0x52b6('0x77')],{'uniqueid':_0x5db48c['uniqueid']});if(_0x3540f0){_0x32c63a(_0x3540f0);}else{return _0xb78ca3(_0x1b6462['error'](0x1f5,_0x52b6('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x4981d3){var _0x7cd7c2=this;return new Promise(function(_0x327506,_0x20bc24){if(ami['isConnected']()==![]){return _0x20bc24(_0x7cd7c2[_0x52b6('0x1d')](0x1f4,[config[_0x52b6('0x11')]['ip'],config[_0x52b6('0x11')][_0x52b6('0x12')],_0x52b6('0x13')][_0x52b6('0x14')]('\x20')));}var _0x2e59e6=schema(properties[_0x52b6('0x79')])[_0x52b6('0x3')](_0x4981d3);if(_0x2e59e6[_0x52b6('0x5f')]>0x0){return _0x20bc24(_0x7cd7c2['error'](0x1f4,_['map'](_0x2e59e6,_0x52b6('0x4f'))['join'](',\x20')));}var _0x3bf999=_[_0x52b6('0x5c')](_0x3b8e05[_0x52b6('0x77')],{'uniqueid':_0x4981d3[_0x52b6('0x65')]});if(_0x3bf999&&_0x3bf999['channel']){return ami[_0x52b6('0x1a')]({'action':'Hangup','channel':_0x3bf999[_0x52b6('0x68')]})['then'](function(_0x4e7c0a){_0x327506({'code':0xc8,'message':[_0x4981d3['uniqueid'],_0x4e7c0a[_0x52b6('0x4f')][_0x52b6('0x6c')]()][_0x52b6('0x14')]('\x20')});})[_0x52b6('0x1c')](function(_0x10ad0e){_0x20bc24(_0x7cd7c2[_0x52b6('0x1d')](0x1f5,[_0x4981d3[_0x52b6('0x65')],_0x10ad0e[_0x52b6('0x4f')][_0x52b6('0x6c')]()]['join']('\x20')));});}else{return _0x20bc24(_0x7cd7c2[_0x52b6('0x1d')](0x1f5,_0x52b6('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x544ceb){var _0x534ed5=this;return new Promise(function(_0x38b28a,_0x228e42){if(ami[_0x52b6('0x1e')]()==![]){return _0x228e42(_0x534ed5[_0x52b6('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x52b6('0x11')][_0x52b6('0x12')],_0x52b6('0x13')]['join']('\x20')));}var _0xa135ee=schema(properties['voicequeuechannelredirect'])[_0x52b6('0x3')](_0x544ceb);if(_0xa135ee[_0x52b6('0x5f')]>0x0){return _0x228e42(_0x534ed5[_0x52b6('0x1d')](0x1f4,_[_0x52b6('0x61')](_0xa135ee,_0x52b6('0x4f'))[_0x52b6('0x14')](',\x20')));}var _0x4856fe=_['find'](_0x3b8e05['queueChannels'],{'uniqueid':_0x544ceb['uniqueid']});if(_0x4856fe&&_0x4856fe[_0x52b6('0x68')]){return ami[_0x52b6('0x1a')]({'action':_0x52b6('0x7a'),'channel':_0x4856fe['channel'],'exten':_0x544ceb['exten'],'context':_0x544ceb[_0x52b6('0x7b')]||_0x4856fe[_0x52b6('0x7b')],'priority':0x1})[_0x52b6('0x1b')](function(_0x28528c){_0x38b28a({'code':0xc8,'message':[_0x544ceb[_0x52b6('0x65')],_0x28528c['message']['toLowerCase']()][_0x52b6('0x14')]('\x20')});})[_0x52b6('0x1c')](function(_0x480c0f){_0x228e42(_0x534ed5[_0x52b6('0x1d')](0x1f5,[_0x544ceb[_0x52b6('0x65')],_0x480c0f['message'][_0x52b6('0x6c')]()][_0x52b6('0x14')]('\x20')));});}else{return _0x228e42(_0x534ed5[_0x52b6('0x1d')](0x1f5,_0x52b6('0x72')));}});},'Agents':function(_0x46d1ac){return new Promise(function(_0x26197d){var _0x237128=_['values'](_0x3b8e05[_0x52b6('0xe')]);if(_0x46d1ac&&_0x46d1ac['id']){var _0x410f83=_[_0x52b6('0x5c')](_0x237128,function(_0x291b0c){return _0x291b0c['id']===_0x46d1ac['id'];});_0x26197d(_0x410f83);}else{_0x26197d({'count':_0x237128[_0x52b6('0x5f')],'rows':_0x237128});}});},'Telephones':function(){return new Promise(function(_0x4aad45){var _0x4affd1=_[_0x52b6('0x5e')](_0x3b8e05[_0x52b6('0x7c')]);_0x4aad45({'count':_0x4affd1['length'],'rows':_0x4affd1});});},'Trunks':function(){return new Promise(function(_0x2abec9){var _0x293bcb=_[_0x52b6('0x5e')](_0x3b8e05[_0x52b6('0x7d')]);_0x2abec9({'count':_0x293bcb[_0x52b6('0x5f')],'rows':_0x293bcb});});},'OutboundChannels':function(){return new Promise(function(_0x14be0a){var _0x36ca40=_['values'](_0x3b8e05['outboundChannels']);_0x14be0a({'count':_0x36ca40[_0x52b6('0x5f')],'rows':_0x36ca40});});},'Outbound':function(){return new Promise(function(_0x940ac3){_0x940ac3(_0x3b8e05['outbound']);});},'Campaigns':function(){return new Promise(function(_0x5b6f36){var _0x179893=_[_0x52b6('0x5e')](_0x3b8e05[_0x52b6('0x7e')]);_0x5b6f36({'count':_0x179893[_0x52b6('0x5f')],'rows':_0x179893});});},'VoiceQueuesPreview':function(_0x1aac72){var _0x5d6eb8=this;return new Promise(function(_0x2ef4a8,_0x5f2af2){_0x2a1355[_0x52b6('0x7f')](_0x1aac72['id'])[_0x52b6('0x1b')](function(_0x211e3c){_0x2ef4a8({'code':0xc8,'message':_0x211e3c['message']});})['catch'](function(_0x51dd32){_0x5f2af2(_0x5d6eb8[_0x52b6('0x1d')](0x1f4,_0x51dd32[_0x52b6('0x4f')]));});});},'EventManager':function(_0x216331){var _0x6c10d1=this;return new Promise(function(_0x14139a,_0x184d2b){if(!_0x216331['event']){return _0x184d2b(_0x6c10d1['error'](0x1f4,_0x52b6('0x80')));}ami[_0x52b6('0x81')](_0x52b6('0x82')+_0x216331[_0x52b6('0x83')],_0x216331[_0x52b6('0x4f')]);_0x14139a({'code':0xc8,'message':_0x216331});});},'FaxAccounts':function(){return new Promise(function(_0x24cc69){var _0xda57a4=_[_0x52b6('0x5e')](_0x3b8e05[_0x52b6('0x84')]);_0x24cc69({'count':_0xda57a4[_0x52b6('0x5f')],'rows':_0xda57a4});});},'SendFax':function(_0x28117e){var _0x2cfbb8=this;return new Promise(function(_0x146997,_0x31b5ea){_0x4707f3[_0x52b6('0x85')](_0x28117e)['then'](function(_0x57920d){_0x146997({'code':0xc8,'message':_0x57920d['message']});})[_0x52b6('0x1c')](function(_0x1d066c){_0x31b5ea(_0x2cfbb8[_0x52b6('0x1d')](0x1f4,_0x1d066c[_0x52b6('0x4f')]));});});},'CheckAfterSend':function(_0x286a32){var _0xf5aa35=this;return new Promise(function(_0xc116b5,_0x795ccc){_0x4707f3[_0x52b6('0x86')](_0x286a32)[_0x52b6('0x1b')](function(_0x4a9380){_0xc116b5({'code':0xc8,'message':_0x4a9380['message']});})['catch'](function(_0x10f23d){_0x795ccc(_0xf5aa35[_0x52b6('0x1d')](0x1f4,_0x10f23d[_0x52b6('0x4f')]));});});}};var _0x149cc5=jayson[_0x52b6('0x87')](_0x2d451f)[_0x52b6('0x88')]();_0x149cc5['on'](_0x52b6('0x1d'),function(_0x32d9df){return _0x25593f(_0x32d9df);});_0x149cc5[_0x52b6('0x89')](0x232a,_0x52b6('0x8a'),function(){console[_0x52b6('0x8b')](_0x52b6('0x8c'),0x232a);return _0x2c643d(_0x52b6('0x8d')+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 419ddc8..87b625a 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 _0x207c=['union','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','action','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','emit','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt'];(function(_0x4a23a9,_0x17a2c0){var _0x18c27f=function(_0x3414e3){while(--_0x3414e3){_0x4a23a9['push'](_0x4a23a9['shift']());}};_0x18c27f(++_0x17a2c0);}(_0x207c,0x127));var _0xc207=function(_0x18a313,_0x54020e){_0x18a313=_0x18a313-0x0;var _0x44ac80=_0x207c[_0x18a313];return _0x44ac80;};'use strict';var _=require(_0xc207('0x0'));var BPromise=require(_0xc207('0x1'));var Redis=require('ioredis');var util=require(_0xc207('0x2'));var config=require(_0xc207('0x3'));var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var cmContactRpc=require(_0xc207('0x6'));config[_0xc207('0x7')]=_['defaults'](config[_0xc207('0x7')],{'host':_0xc207('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x541caf,_0x510a00,_0x16f0a4,_0x2a4911,_0x137a91){logger[_0xc207('0x9')](_0xc207('0xa'),_0x541caf,_0x510a00['id'],_0x16f0a4,_0x2a4911,JSON['stringify'](_0x137a91));io['to'](_0x16f0a4)[_0xc207('0xb')](_0x2a4911,_0x137a91);}exports['exec']=function(_0x61b755,_0x4f8ac9,_0x25f8be,_0x52e877){var _0x4fee8c,_0x492717;var _0x10625d={};var _0x184d57;var _0x2f0e1e=Number(_0x25f8be['data1']);var _0x3a24cc=_0x25f8be[_0xc207('0xc')]?Boolean(Number(_0x25f8be['data2'])):![];var _0x576656;var _0x5c8093=![];if(!_[_0xc207('0xd')](_0x25f8be[_0xc207('0xe')])){if(_0x25f8be[_0xc207('0xe')]=='1')_0x5c8093=!![];}if(!_0x5c8093){if(_0x52e877[_0xc207('0xf')]){_0x10625d['id']=_0x52e877[_0xc207('0xf')];}}if(!_0x10625d['id']){_0x10625d[_0xc207('0x10')]=_0x2f0e1e;_0x576656=_0x25f8be[_0xc207('0x11')]&&_0x25f8be[_0xc207('0x11')]!=='0'?_0x25f8be[_0xc207('0x11')]['split'](','):[_0xc207('0x12')];_0x10625d[_0xc207('0x13')]=_[_0xc207('0x14')](_0x576656,function(_0x3cdb3b){var _0xca10d={};_0xca10d[_0x3cdb3b]=_0x52e877[_0xc207('0x15')]?_0x52e877[_0xc207('0x16')]:_0x52e877[_0xc207('0x17')];return _0xca10d;});_0x184d57=_0x52e877[_0xc207('0x15')]?_0x52e877[_0xc207('0x16')]:_0x52e877[_0xc207('0x17')];}var _0x5b5f44=['id','firstName',_0xc207('0x18'),_0xc207('0x12'),_0xc207('0x19'),_0xc207('0x1a'),'ListId','createdAt',_0xc207('0x1b'),_0xc207('0x1c')];var _0x27779b=_[_0xc207('0x1d')](_0x5b5f44,_0x576656);BPromise[_0xc207('0x1e')]()[_0xc207('0x1f')](cmContactRpc[_0xc207('0x20')]({'attributes':_0x27779b,'where':_0x10625d,'phone':_0x184d57}))[_0xc207('0x1f')](function(_0x5d094d){_0x492717=_0x5d094d;if(!_[_0xc207('0x21')](_0x492717)){if(_0x492717[_0xc207('0x22')]===0x1){_0x4fee8c=_0x492717[0x0];logger[_0xc207('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x52e877[_0xc207('0x23')],_0x4f8ac9['id'],_0x4fee8c['id']);}else{logger[_0xc207('0x9')](_0xc207('0x24'),_0x52e877[_0xc207('0x23')],_0x4f8ac9['id'],_[_0xc207('0x14')](_0x492717,'id')[_0xc207('0x25')](','));}return;}else{logger[_0xc207('0x9')](_0xc207('0x26'),_0x52e877['uniqueid'],_0x4f8ac9['id']);var _0x58ceaf={'ListId':_0x2f0e1e};var _0x1e1ee1=_0x25f8be[_0xc207('0x27')]&&_0x25f8be[_0xc207('0x27')]!=='0'?_0x25f8be[_0xc207('0x27')]:_0xc207('0x12');if(_0x3a24cc){logger[_0xc207('0x9')](_0xc207('0x28'),_0x52e877[_0xc207('0x23')],_0x4f8ac9['id']);_0x58ceaf[_0x1e1ee1]=_[_0xc207('0xd')](_0x52e877[_0xc207('0x15')])?_0x52e877['calleridnum']:_0x52e877[_0xc207('0x16')];if(_[_0xc207('0xd')](_0x52e877[_0xc207('0x15')])){_0x58ceaf[_0xc207('0x29')]=_0x52e877[_0xc207('0x2a')]&&_0x52e877[_0xc207('0x2a')]!==_0xc207('0x2b')?_0x52e877[_0xc207('0x2a')]:'Unknown';}else{_0x58ceaf[_0xc207('0x29')]=_0x52e877[_0xc207('0x2c')]&&_0x52e877['destcalleridname']!==_0xc207('0x2b')?_0x52e877['destcalleridname']:_0xc207('0x2d');}return BPromise[_0xc207('0x1e')]()[_0xc207('0x1f')](cmContactRpc[_0xc207('0x2e')](_0x58ceaf))[_0xc207('0x1f')](function(_0x13729f){_0x4fee8c=_0x13729f;_0x492717[_0xc207('0x2f')](_0x13729f);if(_0x4fee8c){logger[_0xc207('0x9')](_0xc207('0x30'),_0x52e877['uniqueid'],_0x4f8ac9['id'],_0x4fee8c['id']);}return;});}else{logger[_0xc207('0x9')](_0xc207('0x31'),_0x52e877[_0xc207('0x23')],_0x4f8ac9['id']);_0x58ceaf[_0x1e1ee1]=_[_0xc207('0xd')](_0x52e877[_0xc207('0x15')])?_0x52e877[_0xc207('0x17')]:_0x52e877[_0xc207('0x16')];if(_[_0xc207('0xd')](_0x52e877[_0xc207('0x15')])){_0x58ceaf[_0xc207('0x29')]=_0x52e877[_0xc207('0x2a')]&&_0x52e877[_0xc207('0x2a')]!==_0xc207('0x2b')?_0x52e877[_0xc207('0x2a')]:_0xc207('0x2d');}else{_0x58ceaf['firstName']=_0x52e877['destcalleridname']&&_0x52e877[_0xc207('0x2c')]!==_0xc207('0x2b')?_0x52e877['destcalleridname']:_0xc207('0x2d');}_0x4fee8c=_0x58ceaf;_0x492717['push'](_0x58ceaf);return;}}})[_0xc207('0x1f')](function(){if(_0x61b755){emit(_0x52e877[_0xc207('0x23')],_0x4f8ac9,util['format']('user:%s',_0x61b755[_0xc207('0x32')]),util[_0xc207('0x33')]('trigger:%s',_0x25f8be[_0xc207('0x34')]['toLowerCase']()),{'evt':_[_0xc207('0x35')](_0x52e877,{'autoCreate':_0x3a24cc}),'contact':_0x4fee8c===undefined?{}:_0x4fee8c,'contacts':_0x492717[_0xc207('0x22')]===0x0?undefined:_0x492717});}});}; \ No newline at end of file +var _0x2e35=['xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','lastName','fax','createdAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','info','stringify','exec','data1','data2','isNil','data5'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x2e35,0x9a));var _0x52e3=function(_0x485de3,_0x40a4fa){_0x485de3=_0x485de3-0x0;var _0x1654cf=_0x2e35[_0x485de3];return _0x1654cf;};'use strict';var _=require(_0x52e3('0x0'));var BPromise=require(_0x52e3('0x1'));var Redis=require('ioredis');var util=require(_0x52e3('0x2'));var config=require(_0x52e3('0x3'));var logger=require(_0x52e3('0x4'))(_0x52e3('0x5'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x52e3('0x6')](config[_0x52e3('0x7')],{'host':_0x52e3('0x8'),'port':0x18eb});var io=require(_0x52e3('0x9'))(new Redis(config[_0x52e3('0x7')]));function emit(_0x2bb5b8,_0x5b0d35,_0x2be9a3,_0x321afe,_0xe09ae0){logger[_0x52e3('0xa')]('[CM][%s][%s]',_0x2bb5b8,_0x5b0d35['id'],_0x2be9a3,_0x321afe,JSON[_0x52e3('0xb')](_0xe09ae0));io['to'](_0x2be9a3)['emit'](_0x321afe,_0xe09ae0);}exports[_0x52e3('0xc')]=function(_0x23242c,_0x4b3c07,_0x44c17a,_0x55531b){var _0x48c866,_0x1cdf9d;var _0x423550={};var _0x4f9e9f;var _0x4e3cc9=Number(_0x44c17a[_0x52e3('0xd')]);var _0x5505ec=_0x44c17a['data2']?Boolean(Number(_0x44c17a[_0x52e3('0xe')])):![];var _0x4a9392;var _0x3e7a05=![];if(!_[_0x52e3('0xf')](_0x44c17a[_0x52e3('0x10')])){if(_0x44c17a[_0x52e3('0x10')]=='1')_0x3e7a05=!![];}if(!_0x3e7a05){if(_0x55531b[_0x52e3('0x11')]){_0x423550['id']=_0x55531b[_0x52e3('0x11')];}}if(!_0x423550['id']){_0x423550[_0x52e3('0x12')]=_0x4e3cc9;_0x4a9392=_0x44c17a[_0x52e3('0x13')]&&_0x44c17a['data3']!=='0'?_0x44c17a[_0x52e3('0x13')][_0x52e3('0x14')](','):[_0x52e3('0x15')];_0x423550[_0x52e3('0x16')]=_['map'](_0x4a9392,function(_0x5c7756){var _0x180a96={};_0x180a96[_0x5c7756]=_0x55531b['routeId']?_0x55531b[_0x52e3('0x17')]:_0x55531b[_0x52e3('0x18')];return _0x180a96;});_0x4f9e9f=_0x55531b[_0x52e3('0x19')]?_0x55531b['destcalleridnum']:_0x55531b[_0x52e3('0x18')];}var _0x2266f9=['id','firstName',_0x52e3('0x1a'),'phone','mobile',_0x52e3('0x1b'),'ListId',_0x52e3('0x1c'),'scheduledAt',_0x52e3('0x1d')];var _0xa781e5=_[_0x52e3('0x1e')](_0x2266f9,_0x4a9392);BPromise['resolve']()[_0x52e3('0x1f')](cmContactRpc[_0x52e3('0x20')]({'attributes':_0xa781e5,'where':_0x423550,'phone':_0x4f9e9f}))[_0x52e3('0x1f')](function(_0xf1e4fe){_0x1cdf9d=_0xf1e4fe;if(!_[_0x52e3('0x21')](_0x1cdf9d)){if(_0x1cdf9d[_0x52e3('0x22')]===0x1){_0x48c866=_0x1cdf9d[0x0];logger[_0x52e3('0xa')](_0x52e3('0x23'),_0x55531b['uniqueid'],_0x4b3c07['id'],_0x48c866['id']);}else{logger[_0x52e3('0xa')](_0x52e3('0x24'),_0x55531b[_0x52e3('0x25')],_0x4b3c07['id'],_[_0x52e3('0x26')](_0x1cdf9d,'id')[_0x52e3('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x55531b[_0x52e3('0x25')],_0x4b3c07['id']);var _0x44b15d={'ListId':_0x4e3cc9};var _0x35a19c=_0x44c17a[_0x52e3('0x28')]&&_0x44c17a[_0x52e3('0x28')]!=='0'?_0x44c17a['data4']:_0x52e3('0x15');if(_0x5505ec){logger[_0x52e3('0xa')](_0x52e3('0x29'),_0x55531b[_0x52e3('0x25')],_0x4b3c07['id']);_0x44b15d[_0x35a19c]=_['isNil'](_0x55531b[_0x52e3('0x19')])?_0x55531b[_0x52e3('0x18')]:_0x55531b[_0x52e3('0x17')];if(_[_0x52e3('0xf')](_0x55531b[_0x52e3('0x19')])){_0x44b15d[_0x52e3('0x2a')]=_0x55531b[_0x52e3('0x2b')]&&_0x55531b[_0x52e3('0x2b')]!==''?_0x55531b['calleridname']:'Unknown';}else{_0x44b15d[_0x52e3('0x2a')]=_0x55531b[_0x52e3('0x2c')]&&_0x55531b[_0x52e3('0x2c')]!==_0x52e3('0x2d')?_0x55531b[_0x52e3('0x2c')]:_0x52e3('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0x52e3('0x2f')](_0x44b15d))[_0x52e3('0x1f')](function(_0x2aee07){_0x48c866=_0x2aee07;_0x1cdf9d[_0x52e3('0x30')](_0x2aee07);if(_0x48c866){logger[_0x52e3('0xa')](_0x52e3('0x31'),_0x55531b['uniqueid'],_0x4b3c07['id'],_0x48c866['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x55531b[_0x52e3('0x25')],_0x4b3c07['id']);_0x44b15d[_0x35a19c]=_[_0x52e3('0xf')](_0x55531b[_0x52e3('0x19')])?_0x55531b['calleridnum']:_0x55531b['destcalleridnum'];if(_[_0x52e3('0xf')](_0x55531b['routeId'])){_0x44b15d[_0x52e3('0x2a')]=_0x55531b['calleridname']&&_0x55531b[_0x52e3('0x2b')]!==_0x52e3('0x2d')?_0x55531b[_0x52e3('0x2b')]:_0x52e3('0x2e');}else{_0x44b15d['firstName']=_0x55531b['destcalleridname']&&_0x55531b[_0x52e3('0x2c')]!==''?_0x55531b[_0x52e3('0x2c')]:_0x52e3('0x2e');}_0x48c866=_0x44b15d;_0x1cdf9d['push'](_0x44b15d);return;}}})[_0x52e3('0x1f')](function(){if(_0x23242c){emit(_0x55531b[_0x52e3('0x25')],_0x4b3c07,util[_0x52e3('0x32')](_0x52e3('0x33'),_0x23242c[_0x52e3('0x34')]),util['format'](_0x52e3('0x35'),_0x44c17a[_0x52e3('0x36')][_0x52e3('0x37')]()),{'evt':_[_0x52e3('0x38')](_0x55531b,{'autoCreate':_0x5505ec}),'contact':_0x48c866===undefined?{}:_0x48c866,'contacts':_0x1cdf9d[_0x52e3('0x22')]===0x0?undefined:_0x1cdf9d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ff7daf1..6c64c4a 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 _0x6636=['render','winArguments','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','exec','integration','accounts','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','AnyConditions','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','queue','agent','membername','lastevent','null','substatus','undefined','created','equals','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','info','emit','clone','motionChannel','voice','checkTriggers','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','browser','popup','TemplateId','data2','html','template\x20not\x20found','url','buildUri','isNil','data3','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication'];(function(_0x566314,_0x1deb60){var _0x30a1c0=function(_0x30f691){while(--_0x30f691){_0x566314['push'](_0x566314['shift']());}};_0x30a1c0(++_0x1deb60);}(_0x6636,0x119));var _0x6663=function(_0xa51ffd,_0x550b9c){_0xa51ffd=_0xa51ffd-0x0;var _0x56b8ec=_0x6636[_0xa51ffd];return _0x56b8ec;};'use strict';var util=require(_0x6663('0x0'));var _=require(_0x6663('0x1'));var url=require('url');var Mustache=require(_0x6663('0x2'));var Redis=require(_0x6663('0x3'));var urlforward=require(_0x6663('0x4'));var integration=require(_0x6663('0x5'));var cmContact=require(_0x6663('0x6'));var script=require(_0x6663('0x7'));var config=require(_0x6663('0x8'));var logger=require(_0x6663('0x9'))(_0x6663('0xa'));var ami=require(_0x6663('0xb'));config[_0x6663('0xc')]=_[_0x6663('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6663('0xe'))(new Redis(config[_0x6663('0xc')]));var operators={'equals':function(_0x3a0e59,_0x2a8afc){return _0x3a0e59==_0x2a8afc;},'not_equals':function(_0x56ccb5,_0x1d0252){return _0x56ccb5!=_0x1d0252;}};var barAndWebActions=['popup','url',_0x6663('0xf')];function Trigger(_0x12dbf7){this[_0x6663('0x10')]=_0x12dbf7[_0x6663('0x10')];this[_0x6663('0x11')]=_0x12dbf7['agents'];this[_0x6663('0x12')]=_0x12dbf7['voiceQueues'];this['templates']=_0x12dbf7[_0x6663('0x13')];this[_0x6663('0x14')]=_0x12dbf7[_0x6663('0x14')];this[_0x6663('0x15')]=_0x12dbf7['zendeskAccounts'];this['freshdeskAccounts']=_0x12dbf7['freshdeskAccounts'];this[_0x6663('0x16')]=_0x12dbf7[_0x6663('0x16')];this['sugarcrmAccounts']=_0x12dbf7[_0x6663('0x17')];this[_0x6663('0x18')]=_0x12dbf7[_0x6663('0x18')];this[_0x6663('0x19')]=_0x12dbf7[_0x6663('0x19')];this[_0x6663('0x1a')]=_0x12dbf7[_0x6663('0x1a')];this['servicenowAccounts']=_0x12dbf7[_0x6663('0x1b')];this['dynamics365Accounts']=_0x12dbf7[_0x6663('0x1c')];this[_0x6663('0x1d')]=_0x12dbf7['freshsalesAccounts'];this['accounts']={'zendesk':this[_0x6663('0x15')],'salesforce':this[_0x6663('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x6663('0x17')],'zoho':this[_0x6663('0x18')],'desk':this[_0x6663('0x19')],'vtiger':this[_0x6663('0x1a')],'dynamics365':this[_0x6663('0x1c')],'freshsales':this[_0x6663('0x1d')],'servicenow':this[_0x6663('0x1b')]};ami['on'](_0x6663('0x1e'),this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on']('custom:agentconnect',this[_0x6663('0x20')]['bind'](this));ami['on'](_0x6663('0x21'),this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on']('custom:agentcomplete',this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x22'),this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on'](_0x6663('0x23'),this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x24'),this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x25'),this[_0x6663('0x20')]['bind'](this));ami['on'](_0x6663('0x26'),this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on']('custom:amd',this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x27'),this[_0x6663('0x20')]['bind'](this));ami['on'](_0x6663('0x28'),this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on']('custom:dialbegin',this[_0x6663('0x29')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2a'),this['syncAgentDial'][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2b'),this[_0x6663('0x29')][_0x6663('0x1f')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2c'),this[_0x6663('0x20')]['bind'](this));ami['on']('custom:substatus',this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2d'),this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2e'),this['syncCustomEvent'][_0x6663('0x1f')](this));ami['on']('custom:rejectmessage',this[_0x6663('0x20')][_0x6663('0x1f')](this));ami['on'](_0x6663('0x2f'),this[_0x6663('0x20')][_0x6663('0x1f')](this));}Trigger[_0x6663('0x30')]['emit']=function(_0x469234,_0x576c51,_0x4f0754){logger[_0x6663('0x31')](_0x469234,_0x576c51,JSON['stringify'](_0x4f0754));io['to'](_0x469234)[_0x6663('0x32')](_0x576c51,_0x4f0754);};Trigger[_0x6663('0x30')][_0x6663('0x20')]=function(_0x4c9c5c){var _0xc3316c=_[_0x6663('0x33')](_0x4c9c5c);if(typeof _0xc3316c[_0x6663('0x34')]==='undefined'){_0xc3316c[_0x6663('0x34')]=_0x6663('0x35');}this[_0x6663('0x36')](_0xc3316c);};Trigger[_0x6663('0x30')][_0x6663('0x29')]=function(_0x50f664){if(this[_0x6663('0x11')][_0x50f664['interface']]){this['syncCustomEvent'](_0x50f664);}};Trigger[_0x6663('0x30')][_0x6663('0x36')]=function(_0x47d9d1){var _0x1433aa;for(var _0x4badef in this[_0x6663('0x10')]){if(this['triggers']['hasOwnProperty'](_0x4badef)){if(this[_0x6663('0x10')][_0x4badef]['status']){_0x1433aa=this[_0x6663('0x37')](this['triggers'][_0x4badef],_0x47d9d1);if(_0x1433aa){_[_0x6663('0x38')](_0x47d9d1,_0x47d9d1[_0x6663('0x39')]);for(var _0x3734f6=0x0,_0x2126d8,_0x3e5634,_0x5ce33b;_0x3734f60x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x31a732,_0x1d85a6){var _0x1a2f05=function(_0x2c5468){while(--_0x2c5468){_0x31a732['push'](_0x31a732['shift']());}};_0x1a2f05(++_0x1d85a6);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7742088..5ca8222 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 _0xfd80=['calleridnum','POST','contacts','/systemusers(','headers','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','indexOf','substring','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','Bearer\x20','phonecall','callDirection','queue','phonecalls','Subjects','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','ticketId','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','isNil','email','userEmail','length','internalemailaddress','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','then','toLowerCase','outbound','destcalleridnum'];(function(_0x36910c,_0x5a3928){var _0x23d22a=function(_0x4ca99f){while(--_0x4ca99f){_0x36910c['push'](_0x36910c['shift']());}};_0x23d22a(++_0x5a3928);}(_0xfd80,0x185));var _0x0fd8=function(_0x3819d8,_0xb285ae){_0x3819d8=_0x3819d8-0x0;var _0x255cdf=_0xfd80[_0x3819d8];return _0x255cdf;};'use strict';var _=require(_0x0fd8('0x0'));var rp=require(_0x0fd8('0x1'));var util=require(_0x0fd8('0x2'));var intUtil=require(_0x0fd8('0x3'));var md5=require(_0x0fd8('0x4'));var Redis=require(_0x0fd8('0x5'));var logger=require(_0x0fd8('0x6'))(_0x0fd8('0x7'));var config=require('../../../../config/environment');config['redis']=_[_0x0fd8('0x8')](config['redis'],{'host':_0x0fd8('0x9'),'port':0x18eb});var io=require(_0x0fd8('0xa'))(new Redis(config['redis']));function getAuthToken(_0x416645,_0x312bcc,_0x8eaf58){if(_0x416645[_0x0fd8('0xb')]){_0x416645[_0x0fd8('0xc')]=_0x416645[_0x0fd8('0xd')][_0x0fd8('0xe')];_0x416645[_0x0fd8('0xf')]=_0x416645[_0x0fd8('0xd')][_0x0fd8('0x10')];return Promise[_0x0fd8('0x11')](_0x416645[_0x0fd8('0xd')][_0x0fd8('0x12')]);}var _0x1a1b44={'method':'POST','uri':_0x312bcc,'form':{'client_id':_0x416645[_0x0fd8('0x13')],'resource':_0x416645[_0x0fd8('0xc')],'username':_0x416645[_0x0fd8('0x14')],'password':_0x416645[_0x0fd8('0x15')],'grant_type':_0x0fd8('0x15'),'client_secret':_0x416645[_0x0fd8('0x16')]},'json':!![]};return rp(_0x1a1b44)['then'](function(_0x4492a4){return _0x4492a4[_0x0fd8('0x17')];})['catch'](function(_0x17b6f8){logger['error']('['+[_0x8eaf58[_0x0fd8('0x18')]()]+_0x0fd8('0x19'));return _0x17b6f8[_0x0fd8('0x1a')];});}function getUser(_0x4f59fd,_0x130a93,_0x14f4a8,_0x616a9a,_0x10ff52,_0x57ee81){return new Promise(function(_0x3a4b1b,_0x2048fe){return getAuthToken(_0x130a93,_0x616a9a,_0x57ee81)['then'](function(_0x292b4f){var _0x529504={'method':_0x0fd8('0x1b'),'uri':_0x10ff52+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x292b4f,'OData-Version':_0x0fd8('0x1c')},'json':!![]};return rp(_0x529504);})['then'](function(_0x3a08d0){var _0xd59d02=_0x3a08d0['value'];var _0x3d7368=![];var _0x568d53=null;if(!_[_0x0fd8('0x1d')](_0x14f4a8)){if(intUtil['validateEmail'](_0x14f4a8[_0x0fd8('0x1e')])){_0x4f59fd[_0x0fd8('0x1f')]=_0x14f4a8[_0x0fd8('0x1e')];for(_0x568d53=0x0;_0x568d53<_0xd59d02[_0x0fd8('0x20')];_0x568d53++){if(_0xd59d02[_0x568d53][_0x0fd8('0x21')]===_0x14f4a8[_0x0fd8('0x1e')]&&!_0xd59d02[_0x568d53]['isdisabled']){_0x3d7368=!![];logger['info']('['+[_0x57ee81[_0x0fd8('0x18')]()]+']\x20Agent\x20found\x20'+_0xd59d02[_0x568d53][_0x0fd8('0x22')]+'!');_0x4f59fd[_0x0fd8('0x23')]=_0xd59d02[_0x568d53][_0x0fd8('0x22')];}}}}if(!_0x3d7368){logger[_0x0fd8('0x24')]('['+[_0x57ee81[_0x0fd8('0x18')]()]+_0x0fd8('0x25'));_0x4f59fd[_0x0fd8('0x1f')]=_0x130a93[_0x0fd8('0x14')];for(_0x568d53=0x0;_0x568d53<_0xd59d02[_0x0fd8('0x20')];_0x568d53++){if(_0xd59d02[_0x568d53]['internalemailaddress']===_0x130a93[_0x0fd8('0x14')]){_0x4f59fd[_0x0fd8('0x23')]=_0xd59d02[_0x568d53][_0x0fd8('0x22')];}}}_0x3a4b1b(_0x4f59fd);})[_0x0fd8('0x26')](function(_0x265a34){_0x2048fe(_0x265a34[_0x0fd8('0x1a')]);});});}function createEndUser(_0xc877a9,_0x4bbe8a,_0x514f79,_0x380755,_0x30fabc,_0x51425b,_0x2c5c12){return new Promise(function(_0x1fb548,_0x1d3fbf){return getAuthToken(_0x4bbe8a,_0x514f79,_0x51425b)[_0x0fd8('0x27')](function(_0x48d694){var _0x1b8f65=_0x51425b[_0x0fd8('0x28')]()===_0x0fd8('0x29')?_0x30fabc[_0x0fd8('0x2a')]:_0x30fabc[_0x0fd8('0x2b')];var _0x5908bb={'method':_0x0fd8('0x2c'),'uri':_0x380755+_0x0fd8('0x2d'),'body':{'fullname':_0x1b8f65,'firstname':_0x1b8f65,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0fd8('0x2e')+_0xc877a9[_0x0fd8('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x48d694,'OData-Version':_0x0fd8('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x5908bb['body'][_0x2c5c12]=_0x1b8f65;return rp(_0x5908bb);})['then'](function(_0x41d514){var _0x5b6130=_0x41d514[_0x0fd8('0x2f')]['odata-entityid'];var _0x6ce58e=_0x5b6130['substring'](_0x5b6130[_0x0fd8('0x30')]('(')+0x1,_0x5b6130[_0x0fd8('0x30')](')'));_0xc877a9[_0x0fd8('0x31')]=_0x6ce58e;_0x1fb548(_0xc877a9);})[_0x0fd8('0x26')](function(_0x2ea8cf){_0x1d3fbf(_0x2ea8cf['message']);});});}function getEndUser(_0x351c8d,_0x152070,_0x3a197f,_0x178512,_0x41af21,_0x268fe2,_0x4bc5cc,_0x42e4ff){var _0xc28d5c=_0x268fe2['toLowerCase']()===_0x0fd8('0x29')?_0x41af21['destcalleridnum']:_0x41af21['calleridnum'];return getAuthToken(_0x152070,_0x3a197f,_0x268fe2)['then'](function(_0x551ade){_0x42e4ff=_0x42e4ff?_0x42e4ff:_0x0fd8('0x32');var _0x3b1501={'method':_0x0fd8('0x1b'),'uri':_0x178512+_0x0fd8('0x33')+_0x42e4ff+'&$filter='+_0x42e4ff+_0x0fd8('0x34')+_0xc28d5c[_0x0fd8('0x35')]('+',_0x0fd8('0x36'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x551ade,'If-None-Match':null,'OData-Version':_0x0fd8('0x1c')},'json':!![]};return rp(_0x3b1501);})['then'](function(_0x2a8df6){var _0x10a819=![];if(!_0x2a8df6)return _0x10a819;var _0x135f07=_0x2a8df6[_0x0fd8('0x37')];for(var _0x792ccf=0x0;_0x792ccf<_0x135f07[_0x0fd8('0x20')];_0x792ccf++){if(_0x135f07[_0x792ccf][_0x42e4ff]===_0xc28d5c){_0x10a819=!![];_0x351c8d[_0x0fd8('0x31')]=_0x135f07[_0x792ccf][_0x0fd8('0x38')];}}return _0x10a819;})[_0x0fd8('0x27')](function(_0x30b961){if(_0x30b961)return _0x351c8d;if(_0x4bc5cc==='nothing'){logger['info']('['+[_0x268fe2[_0x0fd8('0x18')]()]+_0x0fd8('0x39'));return _0x351c8d;}return createEndUser(_0x351c8d,_0x152070,_0x3a197f,_0x178512,_0x41af21,_0x268fe2,_0x42e4ff)[_0x0fd8('0x27')](function(_0x11f14a){logger[_0x0fd8('0x24')]('['+[_0x268fe2[_0x0fd8('0x18')]()]+_0x0fd8('0x3a'),_0x11f14a[_0x0fd8('0x31')]);return _0x11f14a;});});}function getCustomFields(_0x3968d4,_0x4b7167,_0x4fc2a0){var _0x31b968={};if(_0x3968d4[_0x0fd8('0x20')]>0x0){_[_0x0fd8('0x3b')](_0x3968d4,function(_0x306bff){if(_[_0x0fd8('0x3c')]([_0x0fd8('0x3d'),_0x0fd8('0x3e')],_0x306bff[_0x0fd8('0x3f')])&&_0x306bff['nameField']&&!_0x306bff[_0x0fd8('0x40')]){var _0x12ebe8=_0x306bff[_0x0fd8('0x41')][_0x0fd8('0x28')]();var _0x3bae92=_0x12ebe8['substring'](0x0,_0x12ebe8[_0x0fd8('0x42')]('_'));var _0x102db8=_0x12ebe8[_0x0fd8('0x43')](_0x12ebe8[_0x0fd8('0x42')]('_')+0x1);if(_0x3bae92===_0x4fc2a0){_0x31b968[_0x102db8]=_0x306bff[_0x0fd8('0x44')];}}});}return _0x31b968;}function getTicket(_0x5d3c6a,_0x1e9d4a,_0xd438f2,_0x400624,_0x4cf011,_0xdbd26f,_0x3599ea){return new Promise(function(_0x38ad8a,_0x3c07c6){var _0x41fa14;return getAuthToken(_0x1e9d4a,_0xd438f2,_0x3599ea)[_0x0fd8('0x27')](function(_0x4339bd){if(_0xdbd26f[_0x0fd8('0x45')]===_0x0fd8('0x46')){_0x41fa14={'method':'POST','uri':_0x400624+_0x0fd8('0x47'),'body':Object[_0x0fd8('0x48')]({},{'title':intUtil[_0x0fd8('0x49')](_0xdbd26f['Subjects'],_0x4cf011,'\x20'),'description':intUtil['getString'](_0xdbd26f[_0x0fd8('0x4a')],_0x4cf011,'\x0a'),'customerid_contact@odata.bind':_0x5d3c6a['enduserId']?_0x0fd8('0x4b')+_0x5d3c6a[_0x0fd8('0x31')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5d3c6a[_0x0fd8('0x23')]+')','caseorigincode':'1'},getCustomFields(_0xdbd26f[_0x0fd8('0x4c')],_0x4cf011,_0xdbd26f[_0x0fd8('0x45')])),'headers':{'Authorization':_0x0fd8('0x4d')+_0x4339bd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xdbd26f['ticketType']===_0x0fd8('0x4e')){var _0x392b14=_0x5d3c6a['enduserId']?[{'partyid_systemuser@odata.bind':_0x0fd8('0x2e')+_0x5d3c6a[_0x0fd8('0x23')]+')','participationtypemask':_0x5d3c6a[_0x0fd8('0x4f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x0fd8('0x4b')+_0x5d3c6a[_0x0fd8('0x31')]+')','participationtypemask':_0x5d3c6a['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0fd8('0x2e')+_0x5d3c6a[_0x0fd8('0x23')]+')','participationtypemask':_0x5d3c6a[_0x0fd8('0x4f')]===_0x0fd8('0x50')?0x2:0x1}];_0x41fa14={'method':_0x0fd8('0x2c'),'uri':_0x400624+_0x0fd8('0x51'),'body':Object[_0x0fd8('0x48')]({},{'subject':intUtil[_0x0fd8('0x49')](_0xdbd26f[_0x0fd8('0x52')],_0x4cf011,'\x20'),'phonenumber':String(_0x4cf011[_0x0fd8('0x2b')]),'description':intUtil[_0x0fd8('0x49')](_0xdbd26f['Descriptions'],_0x4cf011,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5d3c6a[_0x0fd8('0x31')]?_0x0fd8('0x4b')+_0x5d3c6a[_0x0fd8('0x31')]+')':undefined,'ownerid@odata.bind':_0x0fd8('0x2e')+_0x5d3c6a['userId']+')','directioncode':_0x5d3c6a[_0x0fd8('0x4f')]===_0x0fd8('0x50')?![]:!![],'phonecall_activity_parties':_0x392b14},getCustomFields(_0xdbd26f[_0x0fd8('0x4c')],_0x4cf011,_0xdbd26f[_0x0fd8('0x45')])),'headers':{'Authorization':_0x0fd8('0x4d')+_0x4339bd,'OData-Version':_0x0fd8('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x41fa14);})[_0x0fd8('0x27')](function(_0x1314a6){var _0x12cea4=_0x1314a6['headers']['odata-entityid'];var _0x3987e7=_0x12cea4[_0x0fd8('0x43')](_0x12cea4['lastIndexOf']('(')+0x1,_0x12cea4[_0x0fd8('0x30')](')'));_0x5d3c6a['ticketId']=_0x3987e7;_0x38ad8a(_0x5d3c6a);})[_0x0fd8('0x26')](function(_0x18bb1c){_0x3c07c6(_0x18bb1c[_0x0fd8('0x1a')]);});});}function emit(_0x471310,_0x4432bb,_0x664534,_0x104965){var _0x84ea46={'uri':util[_0x0fd8('0x53')](_0x0fd8('0x54'),_0x471310,_0x664534,_0x104965)};io['to'](util[_0x0fd8('0x53')](_0x0fd8('0x55'),_0x4432bb))['emit'](_0x0fd8('0x56'),_0x84ea46);}exports['cs']=function(_0x1e549c,_0x5e2120,_0x1b20b8,_0x33a68c,_0x2f6765,_0x59da43,_0x3d77bf,_0xb28db0){var _0x418a05={};_0x59da43['remoteUri']=_0x59da43[_0x0fd8('0xb')]?intUtil[_0x0fd8('0x57')](_0x59da43[_0x0fd8('0xd')][_0x0fd8('0xe')]):intUtil[_0x0fd8('0x57')](_0x59da43[_0x0fd8('0xc')]);_0x59da43[_0x0fd8('0x58')]=intUtil[_0x0fd8('0x57')](_0x59da43[_0x0fd8('0x58')]);_0x418a05[_0x0fd8('0x4f')]=_0xb28db0===_0x0fd8('0x50')||_0xb28db0===_0x0fd8('0x59')?_0x0fd8('0x50'):_0x0fd8('0x29');var _0x45ece9=_0x59da43['modernAuthentication']?util[_0x0fd8('0x53')](_0x0fd8('0x5a'),_0x59da43[_0x0fd8('0xd')][_0x0fd8('0xe')]):util[_0x0fd8('0x53')](_0x0fd8('0x5a'),_0x59da43[_0x0fd8('0xc')]);var _0x131578=util[_0x0fd8('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x59da43[_0x0fd8('0xf')]);var _0x5c7f9b=util[_0x0fd8('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59da43['serverUrl'],_0x5e2120[_0x0fd8('0x5b')],md5(_0x5e2120[_0x0fd8('0x5b')]));if(_0x2f6765&&_0x2f6765[_0x0fd8('0x5c')]){logger[_0x0fd8('0x24')](_0x0fd8('0x5d'),'Recording\x20is\x20enabled!');_0x5e2120['recordingURL']=_0x5c7f9b;}else if(_0x3d77bf&&_0x3d77bf[_0x0fd8('0x5e')]&&_0x3d77bf[_0x0fd8('0x5e')]!==_0x0fd8('0x5f')){logger['info'](_0x0fd8('0x60'),_0x0fd8('0x61'));_0x5e2120[_0x0fd8('0x62')]=_0x5c7f9b;}else{_0x5e2120['recordingURL']='';}return getUser(_0x418a05,_0x59da43,_0x33a68c,_0x131578,_0x45ece9,_0xb28db0)[_0x0fd8('0x27')](function(_0x65458f){logger[_0x0fd8('0x24')]('['+_0xb28db0[_0x0fd8('0x18')]()+_0x0fd8('0x63'),_0x65458f[_0x0fd8('0x23')]);logger['info']('['+_0xb28db0[_0x0fd8('0x18')]()+_0x0fd8('0x64'),_0x65458f[_0x0fd8('0x1f')]);return getEndUser(_0x65458f,_0x59da43,_0x131578,_0x45ece9,_0x5e2120,_0xb28db0,_0x1b20b8[_0x0fd8('0x65')],_0x1b20b8['additionalSearchContact']);})[_0x0fd8('0x27')](function(_0x2706ac){logger['info']('['+_0xb28db0[_0x0fd8('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2706ac[_0x0fd8('0x31')]);logger[_0x0fd8('0x24')]('['+_0xb28db0[_0x0fd8('0x18')]()+_0x0fd8('0x66'),_0x5e2120[_0x0fd8('0x2b')]);return getTicket(_0x2706ac,_0x59da43,_0x131578,_0x45ece9,_0x5e2120,_0x1b20b8,_0xb28db0);})[_0x0fd8('0x27')](function(_0x5cca4e){logger[_0x0fd8('0x24')](util[_0x0fd8('0x53')]('['+_0xb28db0['toUpperCase']()+_0x0fd8('0x67'),_0x1b20b8[_0x0fd8('0x45')],_0x5cca4e['ticketId']));logger[_0x0fd8('0x24')](util['format']('['+_0xb28db0[_0x0fd8('0x18')]()+_0x0fd8('0x68'),_0xb28db0));if(_0xb28db0!=='unmanaged'&&_0x1b20b8['openNewTab']){logger[_0x0fd8('0x24')]('['+_0xb28db0[_0x0fd8('0x18')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x59da43[_0x0fd8('0xc')],_0x33a68c['name'],_0x1b20b8[_0x0fd8('0x45')],_0x5cca4e[_0x0fd8('0x69')]);}})['catch'](function(_0x2d29fd){logger['error']('['+_0xb28db0[_0x0fd8('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2d29fd[_0x0fd8('0x1a')]);console[_0x0fd8('0x6a')](_0x0fd8('0x6b'),_0x2d29fd);});}; \ No newline at end of file +var _0xa2a0=['data5','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','length','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','content','incident','incidents','assign','getString','Subjects','/contacts(','/systemusers(','Fields','ticketType','queue','callDirection','phonecalls','Descriptions','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','redis','defaults','localhost','socket.io-emitter','modernAuthentication','tenantId','CloudProvider','data2','resolve'];(function(_0x57b386,_0x2f6bee){var _0x341297=function(_0x18c065){while(--_0x18c065){_0x57b386['push'](_0x57b386['shift']());}};_0x341297(++_0x2f6bee);}(_0xa2a0,0xbb));var _0x0a2a=function(_0x34dda1,_0x7f6942){_0x34dda1=_0x34dda1-0x0;var _0x8c8ebb=_0xa2a0[_0x34dda1];return _0x8c8ebb;};'use strict';var _=require('lodash');var rp=require(_0x0a2a('0x0'));var util=require(_0x0a2a('0x1'));var intUtil=require('./util');var md5=require(_0x0a2a('0x2'));var Redis=require(_0x0a2a('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require('../../../../config/environment');config[_0x0a2a('0x4')]=_[_0x0a2a('0x5')](config[_0x0a2a('0x4')],{'host':_0x0a2a('0x6'),'port':0x18eb});var io=require(_0x0a2a('0x7'))(new Redis(config[_0x0a2a('0x4')]));function getAuthToken(_0x2b90fc,_0x48633a,_0x3a6cfb){if(_0x2b90fc[_0x0a2a('0x8')]){_0x2b90fc['remoteUri']=_0x2b90fc['CloudProvider']['data7'];_0x2b90fc[_0x0a2a('0x9')]=_0x2b90fc[_0x0a2a('0xa')][_0x0a2a('0xb')];return Promise[_0x0a2a('0xc')](_0x2b90fc[_0x0a2a('0xa')][_0x0a2a('0xd')]);}var _0x33c99e={'method':'POST','uri':_0x48633a,'form':{'client_id':_0x2b90fc[_0x0a2a('0xe')],'resource':_0x2b90fc[_0x0a2a('0xf')],'username':_0x2b90fc[_0x0a2a('0x10')],'password':_0x2b90fc[_0x0a2a('0x11')],'grant_type':_0x0a2a('0x11'),'client_secret':_0x2b90fc[_0x0a2a('0x12')]},'json':!![]};return rp(_0x33c99e)[_0x0a2a('0x13')](function(_0xb4b75a){return _0xb4b75a[_0x0a2a('0x14')];})[_0x0a2a('0x15')](function(_0x4a6fd4){logger['error']('['+[_0x3a6cfb[_0x0a2a('0x16')]()]+']\x20Wrong\x20credentials!');return _0x4a6fd4['message'];});}function getUser(_0x4ae6ce,_0x2289bc,_0x47d43a,_0x4a9afa,_0x63325a,_0x20679e){return new Promise(function(_0x44fd0b,_0x33b649){return getAuthToken(_0x2289bc,_0x4a9afa,_0x20679e)[_0x0a2a('0x13')](function(_0x5bb939){var _0x3e6ed8={'method':_0x0a2a('0x17'),'uri':_0x63325a+_0x0a2a('0x18'),'headers':{'Authorization':_0x0a2a('0x19')+_0x5bb939,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e6ed8);})[_0x0a2a('0x13')](function(_0x4b5c43){var _0x3f3de0=_0x4b5c43[_0x0a2a('0x1a')];var _0x96811d=![];var _0x15e3a0=null;if(!_['isNil'](_0x47d43a)){if(intUtil['validateEmail'](_0x47d43a[_0x0a2a('0x1b')])){_0x4ae6ce['userEmail']=_0x47d43a['email'];for(_0x15e3a0=0x0;_0x15e3a0<_0x3f3de0['length'];_0x15e3a0++){if(_0x3f3de0[_0x15e3a0][_0x0a2a('0x1c')]===_0x47d43a[_0x0a2a('0x1b')]&&!_0x3f3de0[_0x15e3a0]['isdisabled']){_0x96811d=!![];logger[_0x0a2a('0x1d')]('['+[_0x20679e[_0x0a2a('0x16')]()]+_0x0a2a('0x1e')+_0x3f3de0[_0x15e3a0][_0x0a2a('0x1f')]+'!');_0x4ae6ce[_0x0a2a('0x20')]=_0x3f3de0[_0x15e3a0][_0x0a2a('0x1f')];}}}}if(!_0x96811d){logger[_0x0a2a('0x1d')]('['+[_0x20679e[_0x0a2a('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4ae6ce[_0x0a2a('0x21')]=_0x2289bc[_0x0a2a('0x10')];for(_0x15e3a0=0x0;_0x15e3a0<_0x3f3de0[_0x0a2a('0x22')];_0x15e3a0++){if(_0x3f3de0[_0x15e3a0][_0x0a2a('0x1c')]===_0x2289bc[_0x0a2a('0x10')]){_0x4ae6ce[_0x0a2a('0x20')]=_0x3f3de0[_0x15e3a0][_0x0a2a('0x1f')];}}}_0x44fd0b(_0x4ae6ce);})[_0x0a2a('0x15')](function(_0x3878ac){_0x33b649(_0x3878ac[_0x0a2a('0x23')]);});});}function createEndUser(_0x46d71b,_0x268536,_0x2ac3a6,_0x45dce1,_0x11964d,_0x4b0016,_0x2fb00c){return new Promise(function(_0x33fca5,_0x28059c){return getAuthToken(_0x268536,_0x2ac3a6,_0x4b0016)[_0x0a2a('0x13')](function(_0x2c9a3b){var _0x2b1602=_0x4b0016[_0x0a2a('0x24')]()===_0x0a2a('0x25')?_0x11964d[_0x0a2a('0x26')]:_0x11964d[_0x0a2a('0x27')];var _0x250bf0={'method':_0x0a2a('0x28'),'uri':_0x45dce1+_0x0a2a('0x29'),'body':{'fullname':_0x2b1602,'firstname':_0x2b1602,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x46d71b['userId']+')'},'headers':{'Authorization':_0x0a2a('0x19')+_0x2c9a3b,'OData-Version':_0x0a2a('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x250bf0[_0x0a2a('0x2b')][_0x2fb00c]=_0x2b1602;return rp(_0x250bf0);})[_0x0a2a('0x13')](function(_0x48f9da){var _0x80a956=_0x48f9da[_0x0a2a('0x2c')][_0x0a2a('0x2d')];var _0x9b3a97=_0x80a956[_0x0a2a('0x2e')](_0x80a956[_0x0a2a('0x2f')]('(')+0x1,_0x80a956['lastIndexOf'](')'));_0x46d71b[_0x0a2a('0x30')]=_0x9b3a97;_0x33fca5(_0x46d71b);})[_0x0a2a('0x15')](function(_0x827471){_0x28059c(_0x827471[_0x0a2a('0x23')]);});});}function getEndUser(_0x22fa1a,_0x13d761,_0x443420,_0x16061a,_0x2090d1,_0xa62d2,_0x3b9728,_0x16a26e){var _0x1e2a60=_0xa62d2[_0x0a2a('0x24')]()===_0x0a2a('0x25')?_0x2090d1['destcalleridnum']:_0x2090d1[_0x0a2a('0x27')];return getAuthToken(_0x13d761,_0x443420,_0xa62d2)[_0x0a2a('0x13')](function(_0x3adc93){_0x16a26e=_0x16a26e?_0x16a26e:_0x0a2a('0x31');var _0x161375={'method':_0x0a2a('0x17'),'uri':_0x16061a+'contacts?$select='+_0x16a26e+_0x0a2a('0x32')+_0x16a26e+_0x0a2a('0x33')+_0x1e2a60['replace']('+',_0x0a2a('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x3adc93,'If-None-Match':null,'OData-Version':_0x0a2a('0x2a')},'json':!![]};return rp(_0x161375);})[_0x0a2a('0x13')](function(_0x266608){var _0x53a922=![];if(!_0x266608)return _0x53a922;var _0x5cff42=_0x266608[_0x0a2a('0x1a')];for(var _0x358494=0x0;_0x358494<_0x5cff42['length'];_0x358494++){if(_0x5cff42[_0x358494][_0x16a26e]===_0x1e2a60){_0x53a922=!![];_0x22fa1a[_0x0a2a('0x30')]=_0x5cff42[_0x358494][_0x0a2a('0x35')];}}return _0x53a922;})[_0x0a2a('0x13')](function(_0x4b0a45){if(_0x4b0a45)return _0x22fa1a;if(_0x3b9728===_0x0a2a('0x36')){logger['info']('['+[_0xa62d2[_0x0a2a('0x16')]()]+_0x0a2a('0x37'));return _0x22fa1a;}return createEndUser(_0x22fa1a,_0x13d761,_0x443420,_0x16061a,_0x2090d1,_0xa62d2,_0x16a26e)[_0x0a2a('0x13')](function(_0x5dd72a){logger[_0x0a2a('0x1d')]('['+[_0xa62d2[_0x0a2a('0x16')]()]+_0x0a2a('0x38'),_0x5dd72a['enduserId']);return _0x5dd72a;});});}function getCustomFields(_0x2042b2,_0x4acd19,_0x27d123){var _0xca7684={};if(_0x2042b2[_0x0a2a('0x22')]>0x0){_[_0x0a2a('0x39')](_0x2042b2,function(_0x34ae7f){if(_[_0x0a2a('0x3a')]([_0x0a2a('0x3b'),'picklist'],_0x34ae7f[_0x0a2a('0x3c')])&&_0x34ae7f[_0x0a2a('0x3d')]&&!_0x34ae7f[_0x0a2a('0x3e')]){var _0x5649b8=_0x34ae7f['idField'][_0x0a2a('0x24')]();var _0x367152=_0x5649b8[_0x0a2a('0x2e')](0x0,_0x5649b8['indexOf']('_'));var _0x4ea38a=_0x5649b8['substring'](_0x5649b8['indexOf']('_')+0x1);if(_0x367152===_0x27d123){_0xca7684[_0x4ea38a]=_0x34ae7f[_0x0a2a('0x3f')];}}});}return _0xca7684;}function getTicket(_0x329e36,_0x2fefd3,_0x417c1b,_0x592ebe,_0x8ad908,_0x154e41,_0x387f44){return new Promise(function(_0x21725b,_0x3004b7){var _0x3f2e9e;return getAuthToken(_0x2fefd3,_0x417c1b,_0x387f44)[_0x0a2a('0x13')](function(_0x3b1c7b){if(_0x154e41['ticketType']===_0x0a2a('0x40')){_0x3f2e9e={'method':_0x0a2a('0x28'),'uri':_0x592ebe+_0x0a2a('0x41'),'body':Object[_0x0a2a('0x42')]({},{'title':intUtil[_0x0a2a('0x43')](_0x154e41[_0x0a2a('0x44')],_0x8ad908,'\x20'),'description':intUtil[_0x0a2a('0x43')](_0x154e41['Descriptions'],_0x8ad908,'\x0a'),'customerid_contact@odata.bind':_0x329e36[_0x0a2a('0x30')]?_0x0a2a('0x45')+_0x329e36[_0x0a2a('0x30')]+')':undefined,'ownerid@odata.bind':_0x0a2a('0x46')+_0x329e36['userId']+')','caseorigincode':'1'},getCustomFields(_0x154e41[_0x0a2a('0x47')],_0x8ad908,_0x154e41[_0x0a2a('0x48')])),'headers':{'Authorization':_0x0a2a('0x19')+_0x3b1c7b,'OData-Version':_0x0a2a('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x154e41[_0x0a2a('0x48')]==='phonecall'){var _0x4a6dcb=_0x329e36[_0x0a2a('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x329e36[_0x0a2a('0x20')]+')','participationtypemask':_0x329e36['callDirection']===_0x0a2a('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x0a2a('0x45')+_0x329e36[_0x0a2a('0x30')]+')','participationtypemask':_0x329e36[_0x0a2a('0x4a')]===_0x0a2a('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0a2a('0x46')+_0x329e36[_0x0a2a('0x20')]+')','participationtypemask':_0x329e36[_0x0a2a('0x4a')]===_0x0a2a('0x49')?0x2:0x1}];_0x3f2e9e={'method':'POST','uri':_0x592ebe+_0x0a2a('0x4b'),'body':Object[_0x0a2a('0x42')]({},{'subject':intUtil[_0x0a2a('0x43')](_0x154e41[_0x0a2a('0x44')],_0x8ad908,'\x20'),'phonenumber':String(_0x8ad908[_0x0a2a('0x27')]),'description':intUtil[_0x0a2a('0x43')](_0x154e41[_0x0a2a('0x4c')],_0x8ad908,'\x0a'),'regardingobjectid_contact@odata.bind':_0x329e36['enduserId']?_0x0a2a('0x45')+_0x329e36['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x329e36[_0x0a2a('0x20')]+')','directioncode':_0x329e36[_0x0a2a('0x4a')]===_0x0a2a('0x49')?![]:!![],'phonecall_activity_parties':_0x4a6dcb},getCustomFields(_0x154e41['Fields'],_0x8ad908,_0x154e41['ticketType'])),'headers':{'Authorization':_0x0a2a('0x19')+_0x3b1c7b,'OData-Version':_0x0a2a('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3f2e9e);})[_0x0a2a('0x13')](function(_0x3467c6){var _0x214eda=_0x3467c6[_0x0a2a('0x2c')][_0x0a2a('0x2d')];var _0x3217c9=_0x214eda[_0x0a2a('0x2e')](_0x214eda[_0x0a2a('0x2f')]('(')+0x1,_0x214eda[_0x0a2a('0x2f')](')'));_0x329e36['ticketId']=_0x3217c9;_0x21725b(_0x329e36);})[_0x0a2a('0x15')](function(_0x49cecc){_0x3004b7(_0x49cecc[_0x0a2a('0x23')]);});});}function emit(_0x3e92fe,_0xefdefe,_0x45bbfc,_0x564213){var _0x229e3b={'uri':util[_0x0a2a('0x4d')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3e92fe,_0x45bbfc,_0x564213)};io['to'](util[_0x0a2a('0x4d')]('user:%s',_0xefdefe))[_0x0a2a('0x4e')](_0x0a2a('0x4f'),_0x229e3b);}exports['cs']=function(_0x1901ee,_0x3031f8,_0x2a6732,_0x3fdd28,_0x350ba4,_0xe8f4a7,_0x3f99b1,_0x37dfda){var _0x207dd4={};_0xe8f4a7['remoteUri']=_0xe8f4a7['modernAuthentication']?intUtil[_0x0a2a('0x50')](_0xe8f4a7[_0x0a2a('0xa')]['data7']):intUtil[_0x0a2a('0x50')](_0xe8f4a7[_0x0a2a('0xf')]);_0xe8f4a7[_0x0a2a('0x51')]=intUtil[_0x0a2a('0x50')](_0xe8f4a7[_0x0a2a('0x51')]);_0x207dd4[_0x0a2a('0x4a')]=_0x37dfda===_0x0a2a('0x49')||_0x37dfda===_0x0a2a('0x52')?_0x0a2a('0x49'):_0x0a2a('0x25');var _0x16b350=_0xe8f4a7[_0x0a2a('0x8')]?util[_0x0a2a('0x4d')]('%s/api/data/v9.0/',_0xe8f4a7['CloudProvider']['data7']):util[_0x0a2a('0x4d')]('%s/api/data/v9.0/',_0xe8f4a7[_0x0a2a('0xf')]);var _0x1d935f=util[_0x0a2a('0x4d')](_0x0a2a('0x53'),_0xe8f4a7['tenantId']);var _0x107271=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe8f4a7[_0x0a2a('0x51')],_0x3031f8[_0x0a2a('0x54')],md5(_0x3031f8[_0x0a2a('0x54')]));if(_0x350ba4&&_0x350ba4['monitor_format']){logger['info'](_0x0a2a('0x55'),_0x0a2a('0x56'));_0x3031f8[_0x0a2a('0x57')]=_0x107271;}else if(_0x3f99b1&&_0x3f99b1['recordingFormat']&&_0x3f99b1[_0x0a2a('0x58')]!=='none'){logger[_0x0a2a('0x1d')](_0x0a2a('0x59'),_0x0a2a('0x56'));_0x3031f8[_0x0a2a('0x57')]=_0x107271;}else{_0x3031f8[_0x0a2a('0x57')]='';}return getUser(_0x207dd4,_0xe8f4a7,_0x3fdd28,_0x1d935f,_0x16b350,_0x37dfda)['then'](function(_0x4e900e){logger[_0x0a2a('0x1d')]('['+_0x37dfda[_0x0a2a('0x16')]()+']\x20The\x20User\x20ID\x20is:',_0x4e900e[_0x0a2a('0x20')]);logger[_0x0a2a('0x1d')]('['+_0x37dfda[_0x0a2a('0x16')]()+_0x0a2a('0x5a'),_0x4e900e[_0x0a2a('0x21')]);return getEndUser(_0x4e900e,_0xe8f4a7,_0x1d935f,_0x16b350,_0x3031f8,_0x37dfda,_0x2a6732[_0x0a2a('0x5b')],_0x2a6732[_0x0a2a('0x5c')]);})['then'](function(_0x54a0fc){logger['info']('['+_0x37dfda[_0x0a2a('0x16')]()+_0x0a2a('0x5d'),_0x54a0fc[_0x0a2a('0x30')]);logger[_0x0a2a('0x1d')]('['+_0x37dfda[_0x0a2a('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3031f8[_0x0a2a('0x27')]);return getTicket(_0x54a0fc,_0xe8f4a7,_0x1d935f,_0x16b350,_0x3031f8,_0x2a6732,_0x37dfda);})[_0x0a2a('0x13')](function(_0x116f71){logger[_0x0a2a('0x1d')](util[_0x0a2a('0x4d')]('['+_0x37dfda[_0x0a2a('0x16')]()+_0x0a2a('0x5e'),_0x2a6732[_0x0a2a('0x48')],_0x116f71[_0x0a2a('0x5f')]));logger['info'](util[_0x0a2a('0x4d')]('['+_0x37dfda['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x37dfda));if(_0x37dfda!=='unmanaged'&&_0x2a6732[_0x0a2a('0x60')]){logger['info']('['+_0x37dfda[_0x0a2a('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xe8f4a7[_0x0a2a('0xf')],_0x3fdd28[_0x0a2a('0x61')],_0x2a6732[_0x0a2a('0x48')],_0x116f71[_0x0a2a('0x5f')]);}})[_0x0a2a('0x15')](function(_0x3ac960){logger[_0x0a2a('0x62')]('['+_0x37dfda[_0x0a2a('0x16')]()+_0x0a2a('0x63'),_0x3ac960[_0x0a2a('0x23')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x3ac960);});}; \ 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 f0ad4b2..5ccc325 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 _0x887b=['idField','content','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','lastevent','toUpperCase','Authorization','Ticket\x20created!','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','application/json','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase'];(function(_0x15ee28,_0xac0b3d){var _0x1f03ec=function(_0x4eb9ce){while(--_0x4eb9ce){_0x15ee28['push'](_0x15ee28['shift']());}};_0x1f03ec(++_0xac0b3d);}(_0x887b,0x80));var _0xb887=function(_0x416e02,_0x5a8a45){_0x416e02=_0x416e02-0x0;var _0x532d2f=_0x887b[_0x416e02];return _0x532d2f;};'use strict';var _=require(_0xb887('0x0'));var rp=require(_0xb887('0x1'));var md5=require('md5');var util=require(_0xb887('0x2'));var Redis=require(_0xb887('0x3'));var intUtil=require(_0xb887('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb887('0x5'))(_0xb887('0x6'));config[_0xb887('0x7')]=_[_0xb887('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb887('0x7')]));var headers={'Content-Type':_0xb887('0x9'),'Accept':'application/json'};function emit(_0x19b51b,_0x4030e3,_0x1f263a){io['to'](_0x19b51b)['emit'](_0x4030e3,_0x1f263a);}function getTicket(_0x3665c8,_0x3f8d3e,_0x5d78f5,_0x5e0abf,_0x2594e4){logger['info'](_0xb887('0xa'));var _0x175675=_['merge']({'responder_id':_0x3f8d3e['id'],'requester_id':_0x5d78f5['id'],'name':util['format'](_0xb887('0xb'),_0x2594e4[_0xb887('0xc')]),'phone':_0x2594e4[_0xb887('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb887('0xe')](_0x5e0abf[_0xb887('0xf')],_0x2594e4,'\x20'),'description':intUtil[_0xb887('0xe')](_0x5e0abf['Descriptions'],_0x2594e4,'
'),'tags':getTags(_0x5e0abf[_0xb887('0x10')],_0xb887('0x11'))},getCustomFields(_0x5e0abf[_0xb887('0x12')],_0x2594e4));_0x175675[_0xb887('0x13')]=_[_0xb887('0x14')](_[_0xb887('0x15')](_0x175675[_0xb887('0x13')],'id'),_0xb887('0x16'));return request({'uri':util[_0xb887('0x17')](_0xb887('0x18'),_0x3665c8[_0xb887('0x19')]),'method':_0xb887('0x1a'),'body':_0x175675})[_0xb887('0x1b')](function(_0x1055f8){logger[_0xb887('0x1c')]('Ticket\x20created!');return _0x1055f8;});}function getUser(_0x583a74,_0xcc6060){if(intUtil[_0xb887('0x1d')](_0xcc6060)){return request({'uri':util[_0xb887('0x17')](_0xb887('0x1e'),_0x583a74[_0xb887('0x19')]),'qs':{'email':_0xcc6060}})[_0xb887('0x1b')](function(_0x2dde38){if(_0x2dde38[_0xb887('0x1f')]){logger[_0xb887('0x1c')](_0xb887('0x20'));return _[_0xb887('0x21')](_0x2dde38,function(_0x541698){return _0x541698[_0xb887('0x22')][_0xb887('0x23')]===_0xcc6060;});}else{logger[_0xb887('0x1c')](_0xb887('0x24'));return request({'uri':util[_0xb887('0x17')](_0xb887('0x25'),_0x583a74['remoteUri'])})[_0xb887('0x1b')](function(_0x1f6074){logger[_0xb887('0x1c')](_0xb887('0x26'));return _0x1f6074;});}});}else{logger[_0xb887('0x1c')](_0xb887('0x27'));return request({'uri':util[_0xb887('0x17')](_0xb887('0x25'),_0x583a74[_0xb887('0x19')])})['then'](function(_0x45bc42){logger[_0xb887('0x1c')]('Admin\x20account\x20selected.');return _0x45bc42;});}}function getEndUser(_0x2d7053,_0x59483f,_0x1d53b4){logger[_0xb887('0x1c')]('Searching\x20enduser\x20with\x20phone',_0x1d53b4);return request({'uri':util[_0xb887('0x17')](_0xb887('0x28'),_0x2d7053['remoteUri']),'qs':{'phone':_0x1d53b4}})[_0xb887('0x1b')](function(_0x49cb5f){if(_0x49cb5f[_0xb887('0x1f')]){logger[_0xb887('0x1c')](_0xb887('0x29'));return _[_0xb887('0x21')](_0x49cb5f,{'phone':_0x1d53b4});}else{logger[_0xb887('0x1c')](_0xb887('0x2a'));return request({'uri':util[_0xb887('0x17')](_0xb887('0x28'),_0x2d7053[_0xb887('0x19')]),'method':_0xb887('0x1a'),'body':{'name':_0x59483f,'phone':_0x1d53b4}})[_0xb887('0x1b')](function(_0x5b3439){logger[_0xb887('0x1c')](_0xb887('0x2b'));return _0x5b3439;});}});}function getAuth(_0x27aa16){return util[_0xb887('0x17')](_0xb887('0x2c'),new Buffer(_0x27aa16[_0xb887('0x2d')]+':X')[_0xb887('0x2e')](_0xb887('0x2f')));}function request(_0x9da347){logger[_0xb887('0x30')](_0xb887('0x31'),JSON[_0xb887('0x32')](_0x9da347));return rp(_[_0xb887('0x8')](_0x9da347,{'method':_0xb887('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5c39d0,_0x20ff0b){var _0xeed93a=[];if(_0x5c39d0&&_0x5c39d0[_0xb887('0x1f')]>0x0){_0xeed93a=_['map'](_0x5c39d0,_0x20ff0b);}return _0xeed93a;}function getCustomFields(_0x37fc3c,_0x23b619){var _0x1e310b=[];var _0x16acbe={'custom_fields':[]};if(_0x37fc3c['length']>0x0){_[_0xb887('0x34')](_0x37fc3c,function(_0x31062c){if(_[_0xb887('0x35')]([_0xb887('0x36'),_0xb887('0x37')],_0x31062c[_0xb887('0x38')])&&_0x31062c[_0xb887('0x39')]&&!_0x31062c[_0xb887('0x3a')]){_0x16acbe[_0x31062c[_0xb887('0x39')][_0xb887('0x3b')]()]=_0x31062c['content'][_0xb887('0x2e')]();}else if(_[_0xb887('0x35')](['string',_0xb887('0x37')],_0x31062c['type'])&&_0x31062c[_0xb887('0x3c')]&&_0x31062c[_0xb887('0x3a')]){_0x16acbe[_0xb887('0x13')]['push']({'id':_0x31062c[_0xb887('0x3c')],'value':_0x31062c[_0xb887('0x3d')][_0xb887('0x2e')]()});}else if(_0x31062c[_0xb887('0x38')]===_0xb887('0x3e')&&_0x31062c['variableName']&&_0x31062c[_0xb887('0x3c')]&&_0x31062c[_0xb887('0x3a')]){_0x23b619[_0x31062c[_0xb887('0x3f')]]&&_0x16acbe[_0xb887('0x13')]['push']({'id':_0x31062c['idField'],'value':_0x23b619[_0x31062c['variableName']][_0xb887('0x2e')]()});}else if(_0x31062c['type']===_0xb887('0x40')&&_0x31062c[_0xb887('0x41')]&&_0x31062c[_0xb887('0x41')]['name']&&_0x31062c[_0xb887('0x3c')]&&_0x31062c[_0xb887('0x3a')]){_0x23b619[_0x31062c['Variable']['name'][_0xb887('0x3b')]()]&&_0x16acbe[_0xb887('0x13')][_0xb887('0x42')]({'id':_0x31062c[_0xb887('0x3c')],'value':_0x23b619[_0x31062c[_0xb887('0x41')][_0xb887('0x11')][_0xb887('0x3b')]()][_0xb887('0x2e')]()});}});}return _0x16acbe;}exports[_0xb887('0x43')]=function(_0x53a90c,_0x49e584,_0x36085c,_0x241b84,_0x13a6e5,_0x3249bb){var _0x34a5de,_0x3c70d8;_0x3249bb[_0xb887('0x19')]=intUtil[_0xb887('0x44')](_0x3249bb[_0xb887('0x19')]);_0x3249bb[_0xb887('0x45')]=intUtil[_0xb887('0x44')](_0x3249bb['serverUrl']);if(_0x13a6e5&&_0x13a6e5[_0xb887('0x46')]){logger[_0xb887('0x1c')](_0xb887('0x47'),'Recording\x20is\x20enabled!');_0x49e584['recordingURL']=util[_0xb887('0x17')](_0xb887('0x48'),_0x3249bb[_0xb887('0x45')],_0x49e584[_0xb887('0x49')],md5(_0x49e584[_0xb887('0x49')]));}else{_0x49e584[_0xb887('0x4a')]='';}headers['Authorization']=getAuth(_0x3249bb);return getUser(_0x3249bb,_0x241b84[_0xb887('0x23')])[_0xb887('0x1b')](function(_0x5732f2){_0x34a5de=_0x5732f2;logger[_0xb887('0x1c')](_0xb887('0x4b'),_0x34a5de['id']);return getEndUser(_0x3249bb,_0x49e584['calleridname'],_0x49e584['calleridnum']);})[_0xb887('0x1b')](function(_0x1cdf48){_0x3c70d8=_0x1cdf48;logger[_0xb887('0x1c')](_0xb887('0x4c'),_0x3c70d8['id']);return getTicket(_0x3249bb,_0x34a5de,_0x3c70d8,_0x36085c,_0x49e584);})['then'](function(_0x1adc32){if(_0x1adc32&&_0x1adc32['id']){logger[_0xb887('0x1c')]('Ticket\x20created!');logger[_0xb887('0x1c')](_0xb887('0x4d'),_0x1adc32['id']);logger[_0xb887('0x1c')](_0xb887('0x47'),_0xb887('0x4e'));emit(util[_0xb887('0x17')](_0xb887('0x4f'),_0x241b84[_0xb887('0x11')]),_0xb887('0x50'),{'uri':util[_0xb887('0x17')](_0xb887('0x51'),_0x3249bb[_0xb887('0x19')],_0x1adc32['id'])});}})[_0xb887('0x52')](function(_0x3eef5f){logger[_0xb887('0x53')]('[QUEUE]',JSON[_0xb887('0x32')](_0x3eef5f));});};exports[_0xb887('0x54')]=function(_0x2ab6ac,_0x53f6d5,_0x492518,_0x2b5d69,_0x41a3dd,_0x6b591d,_0x12b6e7){var _0x473f9e,_0x37f2dd;_0x6b591d['remoteUri']=intUtil['stripTrailingSlash'](_0x6b591d[_0xb887('0x19')]);_0x6b591d[_0xb887('0x45')]=intUtil[_0xb887('0x44')](_0x6b591d[_0xb887('0x45')]);if(_0x12b6e7&&_0x12b6e7['recordingFormat']&&_0x12b6e7[_0xb887('0x55')]!=='none'){logger[_0xb887('0x1c')](_0xb887('0x56'),_0xb887('0x57'));_0x53f6d5[_0xb887('0x4a')]=util['format'](_0xb887('0x48'),_0x6b591d[_0xb887('0x45')],_0x53f6d5[_0xb887('0x49')],md5(_0x53f6d5[_0xb887('0x49')]));}headers['Authorization']=getAuth(_0x6b591d);return getUser(_0x6b591d,_0x2b5d69[_0xb887('0x23')])['then'](function(_0x385d7a){_0x473f9e=_0x385d7a;logger[_0xb887('0x1c')](_0xb887('0x4b'),_0x473f9e['id']);return getEndUser(_0x6b591d,_0x53f6d5[_0xb887('0x58')],_0x53f6d5[_0xb887('0x59')]);})[_0xb887('0x1b')](function(_0x17d3ed){_0x37f2dd=_0x17d3ed;logger[_0xb887('0x1c')](_0xb887('0x4c'),_0x37f2dd['id']);return getTicket(_0x6b591d,_0x473f9e,_0x37f2dd,_0x492518,_0x53f6d5);})['then'](function(_0x304191){if(_0x304191&&_0x304191['id']){logger[_0xb887('0x1c')]('Ticket\x20created!');logger['info'](_0xb887('0x4d'),_0x304191['id']);logger['info'](_0xb887('0x56'),_0xb887('0x4e'));emit(util[_0xb887('0x17')]('user:%s',_0x2b5d69[_0xb887('0x11')]),_0xb887('0x50'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x6b591d[_0xb887('0x19')],_0x304191['id'])});}})['catch'](function(_0x14aa2a){logger[_0xb887('0x53')]('[OUTBOUND]',JSON[_0xb887('0x32')](_0x14aa2a));});};exports['unmanaged']=function(_0x5397c8,_0x34d431,_0x693f2e,_0x3ef2df,_0x13623c,_0x4f80d2){var _0x47fa7f,_0xb8d3bd;_0x4f80d2[_0xb887('0x19')]=intUtil[_0xb887('0x44')](_0x4f80d2[_0xb887('0x19')]);_0x4f80d2[_0xb887('0x45')]=intUtil[_0xb887('0x44')](_0x4f80d2[_0xb887('0x45')]);if(_0x13623c&&_0x13623c[_0xb887('0x46')]){logger[_0xb887('0x1c')]('['+_0x34d431[_0xb887('0x5a')][_0xb887('0x5b')]()+']',_0xb887('0x57'));_0x34d431['recordingURL']=util['format'](_0xb887('0x48'),_0x4f80d2['serverUrl'],_0x34d431[_0xb887('0x49')],md5(_0x34d431['uniqueid']));}else{_0x34d431[_0xb887('0x4a')]='';}headers[_0xb887('0x5c')]=getAuth(_0x4f80d2);return getUser(_0x4f80d2,'')['then'](function(_0x42af68){_0x47fa7f=_0x42af68;logger[_0xb887('0x1c')](_0xb887('0x4b'),_0x47fa7f['id']);return getEndUser(_0x4f80d2,_0x34d431[_0xb887('0xc')],_0x34d431[_0xb887('0xd')]);})[_0xb887('0x1b')](function(_0x4e4679){_0xb8d3bd=_0x4e4679;logger['info'](_0xb887('0x4c'),_0xb8d3bd['id']);return getTicket(_0x4f80d2,_0x47fa7f,_0xb8d3bd,_0x693f2e,_0x34d431);})[_0xb887('0x1b')](function(_0x311e40){if(_0x311e40){logger[_0xb887('0x1c')](_0xb887('0x5d'));logger[_0xb887('0x1c')](_0xb887('0x4d'),_0x311e40['id']);}})['catch'](function(_0x7afe5a){logger[_0xb887('0x53')]('['+_0x34d431['lastevent']['toUpperCase']()+']',JSON[_0xb887('0x32')](_0x7afe5a));});}; \ No newline at end of file +var _0x39b4=['recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','catch','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','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','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','includes','picklist','type','nameField','content','string','idField','push','variable','variableName','customField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound'];(function(_0x171c0a,_0x2abfd2){var _0x10123b=function(_0x14fa98){while(--_0x14fa98){_0x171c0a['push'](_0x171c0a['shift']());}};_0x10123b(++_0x2abfd2);}(_0x39b4,0x6a));var _0x439b=function(_0x57e934,_0x782fc8){_0x57e934=_0x57e934-0x0;var _0x3c90a8=_0x39b4[_0x57e934];return _0x3c90a8;};'use strict';var _=require(_0x439b('0x0'));var rp=require(_0x439b('0x1'));var md5=require(_0x439b('0x2'));var util=require(_0x439b('0x3'));var Redis=require(_0x439b('0x4'));var intUtil=require(_0x439b('0x5'));var config=require(_0x439b('0x6'));var logger=require('../../../../config/logger')(_0x439b('0x7'));config[_0x439b('0x8')]=_[_0x439b('0x9')](config[_0x439b('0x8')],{'host':_0x439b('0xa'),'port':0x18eb});var io=require(_0x439b('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x439b('0xc'),'Accept':_0x439b('0xc')};function emit(_0x1e20f2,_0x3b66f7,_0x34c3b5){io['to'](_0x1e20f2)[_0x439b('0xd')](_0x3b66f7,_0x34c3b5);}function getTicket(_0x41935e,_0x1186b7,_0x390587,_0x119b40,_0xcfdf8e){logger[_0x439b('0xe')]('Creating\x20new\x20ticket...');var _0x8e064b=_[_0x439b('0xf')]({'responder_id':_0x1186b7['id'],'requester_id':_0x390587['id'],'name':util[_0x439b('0x10')](_0x439b('0x11'),_0xcfdf8e[_0x439b('0x12')]),'phone':_0xcfdf8e['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x439b('0x13')](_0x119b40['Subjects'],_0xcfdf8e,'\x20'),'description':intUtil[_0x439b('0x13')](_0x119b40[_0x439b('0x14')],_0xcfdf8e,_0x439b('0x15')),'tags':getTags(_0x119b40[_0x439b('0x16')],_0x439b('0x17'))},getCustomFields(_0x119b40[_0x439b('0x18')],_0xcfdf8e));_0x8e064b[_0x439b('0x19')]=_['mapValues'](_[_0x439b('0x1a')](_0x8e064b[_0x439b('0x19')],'id'),_0x439b('0x1b'));return request({'uri':util['format'](_0x439b('0x1c'),_0x41935e[_0x439b('0x1d')]),'method':_0x439b('0x1e'),'body':_0x8e064b})[_0x439b('0x1f')](function(_0x97a85e){logger[_0x439b('0xe')]('Ticket\x20created!');return _0x97a85e;});}function getUser(_0x32c135,_0x48e84d){if(intUtil[_0x439b('0x20')](_0x48e84d)){return request({'uri':util[_0x439b('0x10')](_0x439b('0x21'),_0x32c135[_0x439b('0x1d')]),'qs':{'email':_0x48e84d}})[_0x439b('0x1f')](function(_0x2ebabb){if(_0x2ebabb[_0x439b('0x22')]){logger[_0x439b('0xe')](_0x439b('0x23'));return _[_0x439b('0x24')](_0x2ebabb,function(_0x5a06da){return _0x5a06da['contact'][_0x439b('0x25')]===_0x48e84d;});}else{logger[_0x439b('0xe')](_0x439b('0x26'));return request({'uri':util['format'](_0x439b('0x27'),_0x32c135['remoteUri'])})[_0x439b('0x1f')](function(_0x25c479){logger[_0x439b('0xe')]('Admin\x20account\x20selected.');return _0x25c479;});}});}else{logger[_0x439b('0xe')](_0x439b('0x28'));return request({'uri':util[_0x439b('0x10')](_0x439b('0x27'),_0x32c135[_0x439b('0x1d')])})[_0x439b('0x1f')](function(_0x2a0894){logger[_0x439b('0xe')]('Admin\x20account\x20selected.');return _0x2a0894;});}}function getEndUser(_0x9684cc,_0x3b2d36,_0x1b16d9){logger['info'](_0x439b('0x29'),_0x1b16d9);return request({'uri':util[_0x439b('0x10')](_0x439b('0x2a'),_0x9684cc[_0x439b('0x1d')]),'qs':{'phone':_0x1b16d9}})[_0x439b('0x1f')](function(_0x2bc207){if(_0x2bc207[_0x439b('0x22')]){logger['info']('Enduser\x20found!');return _[_0x439b('0x24')](_0x2bc207,{'phone':_0x1b16d9});}else{logger[_0x439b('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x439b('0x10')](_0x439b('0x2a'),_0x9684cc['remoteUri']),'method':_0x439b('0x1e'),'body':{'name':_0x3b2d36,'phone':_0x1b16d9}})['then'](function(_0x206a0c){logger[_0x439b('0xe')](_0x439b('0x2b'));return _0x206a0c;});}});}function getAuth(_0x4cb516){return util[_0x439b('0x10')](_0x439b('0x2c'),new Buffer(_0x4cb516['apiKey']+':X')[_0x439b('0x2d')](_0x439b('0x2e')));}function request(_0x143773){logger[_0x439b('0x2f')](_0x439b('0x30'),JSON[_0x439b('0x31')](_0x143773));return rp(_[_0x439b('0x9')](_0x143773,{'method':_0x439b('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x54065d,_0x281a7c){var _0x408cae=[];if(_0x54065d&&_0x54065d[_0x439b('0x22')]>0x0){_0x408cae=_[_0x439b('0x33')](_0x54065d,_0x281a7c);}return _0x408cae;}function getCustomFields(_0x35b490,_0x2b1f36){var _0x26b3c6=[];var _0x310527={'custom_fields':[]};if(_0x35b490[_0x439b('0x22')]>0x0){_['forEach'](_0x35b490,function(_0x2ecc5d){if(_[_0x439b('0x34')](['string',_0x439b('0x35')],_0x2ecc5d[_0x439b('0x36')])&&_0x2ecc5d[_0x439b('0x37')]&&!_0x2ecc5d['customField']){_0x310527[_0x2ecc5d[_0x439b('0x37')]['toLowerCase']()]=_0x2ecc5d[_0x439b('0x38')][_0x439b('0x2d')]();}else if(_[_0x439b('0x34')]([_0x439b('0x39'),_0x439b('0x35')],_0x2ecc5d[_0x439b('0x36')])&&_0x2ecc5d[_0x439b('0x3a')]&&_0x2ecc5d['customField']){_0x310527[_0x439b('0x19')][_0x439b('0x3b')]({'id':_0x2ecc5d[_0x439b('0x3a')],'value':_0x2ecc5d['content']['toString']()});}else if(_0x2ecc5d['type']===_0x439b('0x3c')&&_0x2ecc5d[_0x439b('0x3d')]&&_0x2ecc5d[_0x439b('0x3a')]&&_0x2ecc5d[_0x439b('0x3e')]){_0x2b1f36[_0x2ecc5d[_0x439b('0x3d')]]&&_0x310527['custom_fields'][_0x439b('0x3b')]({'id':_0x2ecc5d[_0x439b('0x3a')],'value':_0x2b1f36[_0x2ecc5d[_0x439b('0x3d')]][_0x439b('0x2d')]()});}else if(_0x2ecc5d[_0x439b('0x36')]===_0x439b('0x3f')&&_0x2ecc5d[_0x439b('0x40')]&&_0x2ecc5d[_0x439b('0x40')][_0x439b('0x17')]&&_0x2ecc5d['idField']&&_0x2ecc5d[_0x439b('0x3e')]){_0x2b1f36[_0x2ecc5d[_0x439b('0x40')][_0x439b('0x17')][_0x439b('0x41')]()]&&_0x310527[_0x439b('0x19')][_0x439b('0x3b')]({'id':_0x2ecc5d['idField'],'value':_0x2b1f36[_0x2ecc5d[_0x439b('0x40')]['name'][_0x439b('0x41')]()][_0x439b('0x2d')]()});}});}return _0x310527;}exports[_0x439b('0x42')]=function(_0x13b3d7,_0x5c13d7,_0x59aa8e,_0x2018c5,_0x412f44,_0x59784d){var _0x20d581,_0x4696ac;_0x59784d[_0x439b('0x1d')]=intUtil[_0x439b('0x43')](_0x59784d[_0x439b('0x1d')]);_0x59784d[_0x439b('0x44')]=intUtil[_0x439b('0x43')](_0x59784d[_0x439b('0x44')]);if(_0x412f44&&_0x412f44[_0x439b('0x45')]){logger['info'](_0x439b('0x46'),'Recording\x20is\x20enabled!');_0x5c13d7['recordingURL']=util[_0x439b('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59784d[_0x439b('0x44')],_0x5c13d7[_0x439b('0x47')],md5(_0x5c13d7[_0x439b('0x47')]));}else{_0x5c13d7[_0x439b('0x48')]='';}headers[_0x439b('0x49')]=getAuth(_0x59784d);return getUser(_0x59784d,_0x2018c5[_0x439b('0x25')])[_0x439b('0x1f')](function(_0x4997c3){_0x20d581=_0x4997c3;logger['info'](_0x439b('0x4a'),_0x20d581['id']);return getEndUser(_0x59784d,_0x5c13d7['calleridname'],_0x5c13d7[_0x439b('0x4b')]);})['then'](function(_0x46ae37){_0x4696ac=_0x46ae37;logger[_0x439b('0xe')](_0x439b('0x4c'),_0x4696ac['id']);return getTicket(_0x59784d,_0x20d581,_0x4696ac,_0x59aa8e,_0x5c13d7);})['then'](function(_0x489463){if(_0x489463&&_0x489463['id']){logger[_0x439b('0xe')](_0x439b('0x4d'));logger[_0x439b('0xe')]('The\x20Ticket\x20ID\x20is:',_0x489463['id']);logger[_0x439b('0xe')]('[QUEUE]',_0x439b('0x4e'));emit(util[_0x439b('0x10')](_0x439b('0x4f'),_0x2018c5[_0x439b('0x17')]),_0x439b('0x50'),{'uri':util['format'](_0x439b('0x51'),_0x59784d[_0x439b('0x1d')],_0x489463['id'])});}})['catch'](function(_0x53ad8b){logger[_0x439b('0x52')](_0x439b('0x46'),JSON['stringify'](_0x53ad8b));});};exports[_0x439b('0x53')]=function(_0x4c248f,_0x2d68a0,_0x1df02c,_0x4019c8,_0x55a4a0,_0x22ea53,_0x3bc333){var _0x45136e,_0x225e8e;_0x22ea53[_0x439b('0x1d')]=intUtil['stripTrailingSlash'](_0x22ea53[_0x439b('0x1d')]);_0x22ea53[_0x439b('0x44')]=intUtil['stripTrailingSlash'](_0x22ea53[_0x439b('0x44')]);if(_0x3bc333&&_0x3bc333[_0x439b('0x54')]&&_0x3bc333[_0x439b('0x54')]!==_0x439b('0x55')){logger[_0x439b('0xe')](_0x439b('0x56'),_0x439b('0x57'));_0x2d68a0[_0x439b('0x48')]=util[_0x439b('0x10')](_0x439b('0x58'),_0x22ea53['serverUrl'],_0x2d68a0[_0x439b('0x47')],md5(_0x2d68a0[_0x439b('0x47')]));}headers[_0x439b('0x49')]=getAuth(_0x22ea53);return getUser(_0x22ea53,_0x4019c8[_0x439b('0x25')])[_0x439b('0x1f')](function(_0x1ed806){_0x45136e=_0x1ed806;logger['info']('The\x20User\x20ID\x20is:',_0x45136e['id']);return getEndUser(_0x22ea53,_0x2d68a0[_0x439b('0x59')],_0x2d68a0[_0x439b('0x5a')]);})[_0x439b('0x1f')](function(_0x1dd5fb){_0x225e8e=_0x1dd5fb;logger[_0x439b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x225e8e['id']);return getTicket(_0x22ea53,_0x45136e,_0x225e8e,_0x1df02c,_0x2d68a0);})[_0x439b('0x1f')](function(_0x588d49){if(_0x588d49&&_0x588d49['id']){logger[_0x439b('0xe')](_0x439b('0x4d'));logger[_0x439b('0xe')](_0x439b('0x5b'),_0x588d49['id']);logger[_0x439b('0xe')](_0x439b('0x56'),_0x439b('0x4e'));emit(util['format'](_0x439b('0x4f'),_0x4019c8[_0x439b('0x17')]),_0x439b('0x50'),{'uri':util[_0x439b('0x10')](_0x439b('0x51'),_0x22ea53['remoteUri'],_0x588d49['id'])});}})[_0x439b('0x5c')](function(_0x2c4943){logger[_0x439b('0x52')]('[OUTBOUND]',JSON['stringify'](_0x2c4943));});};exports['unmanaged']=function(_0x416324,_0x5aaf26,_0x40ad9e,_0x130a3b,_0x4c3787,_0xf9292){var _0x3d9c82,_0x2ca732;_0xf9292[_0x439b('0x1d')]=intUtil[_0x439b('0x43')](_0xf9292[_0x439b('0x1d')]);_0xf9292[_0x439b('0x44')]=intUtil['stripTrailingSlash'](_0xf9292[_0x439b('0x44')]);if(_0x4c3787&&_0x4c3787[_0x439b('0x45')]){logger[_0x439b('0xe')]('['+_0x5aaf26[_0x439b('0x5d')][_0x439b('0x5e')]()+']',_0x439b('0x57'));_0x5aaf26[_0x439b('0x48')]=util[_0x439b('0x10')](_0x439b('0x58'),_0xf9292['serverUrl'],_0x5aaf26[_0x439b('0x47')],md5(_0x5aaf26[_0x439b('0x47')]));}else{_0x5aaf26['recordingURL']='';}headers[_0x439b('0x49')]=getAuth(_0xf9292);return getUser(_0xf9292,'')[_0x439b('0x1f')](function(_0xc00590){_0x3d9c82=_0xc00590;logger['info'](_0x439b('0x4a'),_0x3d9c82['id']);return getEndUser(_0xf9292,_0x5aaf26['calleridname'],_0x5aaf26[_0x439b('0x4b')]);})[_0x439b('0x1f')](function(_0x24f9cc){_0x2ca732=_0x24f9cc;logger[_0x439b('0xe')](_0x439b('0x4c'),_0x2ca732['id']);return getTicket(_0xf9292,_0x3d9c82,_0x2ca732,_0x40ad9e,_0x5aaf26);})[_0x439b('0x1f')](function(_0x55bd73){if(_0x55bd73){logger[_0x439b('0xe')]('Ticket\x20created!');logger['info'](_0x439b('0x5b'),_0x55bd73['id']);}})[_0x439b('0x5c')](function(_0x5b7c7c){logger[_0x439b('0x52')]('['+_0x5aaf26[_0x439b('0x5d')][_0x439b('0x5e')]()+']',JSON[_0x439b('0x31')](_0x5b7c7c));});}; \ 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 389a28a..362c841 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 _0x9002=['Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','add','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','message','GET','Getting\x20user\x20list','then','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','catch','error','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x9002,0x7a));var _0x2900=function(_0x55bb5f,_0x40442a){_0x55bb5f=_0x55bb5f-0x0;var _0x3621cf=_0x9002[_0x55bb5f];return _0x3621cf;};'use strict';var _=require(_0x2900('0x0'));var rp=require('request-promise');var md5=require(_0x2900('0x1'));var util=require(_0x2900('0x2'));var moment=require(_0x2900('0x3'));var Promise=require(_0x2900('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x2900('0x5'))(_0x2900('0x6'));config[_0x2900('0x7')]=_[_0x2900('0x8')](config[_0x2900('0x7')],{'host':_0x2900('0x9'),'port':0x18eb});var io=require(_0x2900('0xa'))(new Redis(config[_0x2900('0x7')]));function getAdminId(_0x4c9699,_0x67ab57,_0x150b8b,_0x59cae7){return new Promise(function(_0x28d108,_0x58d78f){var _0x2e50c9=![];var _0x47c50c={'method':'GET','uri':_0x59cae7+_0x2900('0xb'),'json':!![]};_0x47c50c[_0x2900('0xc')]=_0x150b8b;logger[_0x2900('0xd')](_0x2900('0xe'));return rp(_0x47c50c)['then'](function(_0x137ea0){if(_0x137ea0){var _0x3c7dbd=_0x137ea0[_0x2900('0xf')];var _0x442f39=null;for(_0x442f39=0x0;_0x442f39<_0x3c7dbd[_0x2900('0x10')];_0x442f39++){if(_0x3c7dbd[_0x442f39][_0x2900('0x11')]===_0x4c9699[_0x2900('0x12')]){_0x4c9699[_0x2900('0x13')]=_0x3c7dbd[_0x442f39]['id'];_0x2e50c9=!![];}}if(_0x2e50c9){logger[_0x2900('0xd')]('Admin\x20found:',_0x4c9699['adminId']);_0x28d108(_0x4c9699);}else{_0x58d78f({'statusCode':0x194,'message':_0x2900('0x14')});}}else{_0x58d78f({'statusCode':0x194,'message':_0x2900('0x14')});}})['catch'](function(_0x4da0a7){logger['error']('['+[_0x67ab57[_0x2900('0x15')]()]+']',_0x4da0a7[_0x2900('0x16')]);_0x58d78f(_0x4da0a7);});});}function getUser(_0x4e21c7,_0x394125,_0x9e37ca){return function(_0x437879){return new Promise(function(_0x8d7723,_0x233d17){var _0xc95a71={'method':_0x2900('0x17'),'uri':_0x9e37ca+_0x2900('0xb'),'json':!![]};_0xc95a71[_0x2900('0xc')]=_0x394125;logger[_0x2900('0xd')](_0x2900('0x18'));return rp(_0xc95a71)[_0x2900('0x19')](function(_0x41149d){if(_0x41149d){var _0x18a7ed=_0x41149d[_0x2900('0xf')];var _0x3d7746=![];var _0x52dede=null;if(_0x437879[_0x2900('0x1a')]!==null){logger[_0x2900('0xd')]('Getting\x20user\x20with\x20email',_0x437879[_0x2900('0x1a')]);_0x437879[_0x2900('0x1b')]=_0x437879[_0x2900('0x1a')];for(_0x52dede=0x0;_0x52dede<_0x18a7ed[_0x2900('0x10')];_0x52dede++){if(_0x18a7ed[_0x52dede][_0x2900('0x11')]===_0x437879['agentEmail']){_0x3d7746=!![];_0x437879[_0x2900('0x1c')]=_0x18a7ed[_0x52dede]['id'];logger['info'](_0x2900('0x1d'),_0x437879[_0x2900('0x1c')]);}}}if(!_0x3d7746){logger[_0x2900('0xd')](_0x2900('0x1e'));_0x437879['userEmail']=_0x437879[_0x2900('0x12')];_0x437879['userId']=_0x437879[_0x2900('0x13')];_0x3d7746=!![];}if(_0x3d7746){_0x8d7723(_0x437879);}else{_0x233d17({'statusCode':0x194,'message':_0x2900('0x14')});}}else{_0x233d17({'statusCode':0x194,'message':_0x2900('0x14')});}})[_0x2900('0x1f')](function(_0x50c6e5){logger[_0x2900('0x20')]('['+[_0x4e21c7[_0x2900('0x15')]()]+']',_0x50c6e5[_0x2900('0x16')]);_0x233d17(_0x50c6e5);});});};}function searchContact(_0x55c99d,_0xc24bad,_0x1cdb66,_0x143a41){return new Promise(function(_0x550ced,_0x29620f){var _0x2b673c={'method':_0x2900('0x17'),'headers':_0xc24bad,'uri':_0x55c99d+'/api/lookup?q='+_0x143a41+_0x2900('0x21')+_0x1cdb66+_0x2900('0x22'),'json':!![]};rp(_0x2b673c)[_0x2900('0x19')](function(_0x5a9dfb){var _0x509b6c=_[_0x2900('0x23')](_0x5a9dfb[_0x2900('0x24')]['contacts'],[_0x1cdb66,_0x143a41]);_0x550ced(_0x509b6c);})[_0x2900('0x1f')](function(_0x1769b4){_0x29620f(_0x1769b4);});});}function getEndUser(_0x5f0be4,_0x31cb7f,_0x3ceed5){return function(_0x5e3614){return new Promise(function(_0x2f9cbb,_0x91267e){logger[_0x2900('0xd')](util[_0x2900('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5e3614[_0x2900('0x26')]));searchContact(_0x3ceed5,_0x31cb7f,_0x2900('0x27'),_0x5e3614[_0x2900('0x26')])[_0x2900('0x19')](function(_0x4da621){if(_0x4da621){_0x5e3614[_0x2900('0x28')]=_0x4da621['id'];logger[_0x2900('0xd')](_0x2900('0x29'),_0x5e3614['endUserId']);return _0x2f9cbb(_0x5e3614);}searchContact(_0x3ceed5,_0x31cb7f,_0x2900('0x2a'),_0x5e3614[_0x2900('0x26')])[_0x2900('0x19')](function(_0x2c50eb){if(_0x2c50eb){_0x5e3614[_0x2900('0x28')]=_0x2c50eb['id'];logger[_0x2900('0xd')](_0x2900('0x2b'),_0x5e3614['endUserId']);return _0x2f9cbb(_0x5e3614);}createEndUser(_0x5e3614,_0x5f0be4,_0x31cb7f,_0x3ceed5)[_0x2900('0x19')](function(_0x2ab553){logger['info'](_0x2900('0x2c'),_0x2ab553[_0x2900('0x28')]);return _0x2f9cbb(_0x2ab553);});});})[_0x2900('0x1f')](function(_0x3313e6){_0x91267e(_0x3313e6);});});};}function createEndUser(_0x149ad9,_0x16d847,_0x592b03,_0x8f91dd){return new Promise(function(_0x34b534,_0xcafd38){var _0x585afe=moment();var _0x541ca5={'method':_0x2900('0x2d'),'uri':_0x8f91dd+_0x2900('0x2e'),'body':{'contact':{'last_name':_0x149ad9[_0x2900('0x26')],'work_number':_0x149ad9['contactNumber'],'mobile_number':_0x149ad9['contactNumber'],'owner_id':_0x149ad9['userId'],'created_at':_0x585afe[_0x2900('0x25')](_0x2900('0x2f'))}},'json':!![]};_0x541ca5[_0x2900('0xc')]=_0x592b03;logger['info'](_0x2900('0x30'));return rp(_0x541ca5)['then'](function(_0x2ab0bc){_0x149ad9[_0x2900('0x28')]=_0x2ab0bc[_0x2900('0x31')]['id'];_0x34b534(_0x149ad9);})['catch'](function(_0x5b8774){logger[_0x2900('0x20')]('['+[_0x16d847['toUpperCase']()]+']',_0x5b8774[_0x2900('0x16')]);_0xcafd38(_0x5b8774[_0x2900('0x16')]);});});}function getTicket(_0xb4d37f,_0x44c57c,_0x1f8fd5,_0x19b43d,_0xd90313){return function(_0x480013){logger[_0x2900('0xd')](_0x2900('0x32'));return new Promise(function(_0x1dcbc0,_0x1994bb){var _0x4149dc=moment();var _0x320cc4={'method':_0x2900('0x2d'),'uri':_0x1f8fd5+_0x2900('0x33'),'body':{'title':intUtil['getString'](_0x19b43d['Subjects'],_0xd90313,'\x20'),'description':intUtil[_0x2900('0x34')](_0x19b43d['Descriptions'],_0xd90313,'\x0a'),'owner_id':_0x480013[_0x2900('0x1c')],'creater_id':_0x480013[_0x2900('0x13')],'targetable_id':_0x480013['endUserId'],'targetable_type':'Contact','created_at':_0x4149dc[_0x2900('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4149dc[_0x2900('0x35')](0x1e,'m')[_0x2900('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x320cc4[_0x2900('0xc')]=_0x44c57c;return rp(_0x320cc4)[_0x2900('0x19')](function(_0x4e3a4c){_0x480013['ticketId']=_0x4e3a4c[_0x2900('0x36')]['id'];logger[_0x2900('0xd')](_0x2900('0x37'),_0x480013['ticketId']);_0x1dcbc0(_0x480013);})['catch'](function(_0x1f814c){logger[_0x2900('0x20')]('['+[_0xb4d37f['toUpperCase']()]+']',_0x1f814c[_0x2900('0x16')]);_0x1994bb(_0x1f814c['message']);});});};}function emit(_0xf5e77b,_0x5f657b,_0x4f6839){var _0x5a2d14={'uri':_0xf5e77b+_0x2900('0x38')+_0x4f6839};io['to'](util['format'](_0x2900('0x39'),_0x5f657b))['emit'](_0x2900('0x3a'),_0x5a2d14);}exports['cs']=function(_0x1d5764,_0x23d197,_0x44ccf0,_0x4e75cf,_0x149060,_0x5861fe,_0x3bf0f7,_0x74b295){var _0x35062a={};var _0x122999={'Authorization':_0x2900('0x3b')+_0x5861fe[_0x2900('0x3c')]};_0x5861fe[_0x2900('0x3d')]=intUtil[_0x2900('0x3e')](_0x5861fe[_0x2900('0x3d')]);_0x5861fe[_0x2900('0x3f')]=intUtil['stripTrailingSlash'](_0x5861fe[_0x2900('0x3f')]);var _0x596691=_0x5861fe[_0x2900('0x3d')];_0x35062a[_0x2900('0x12')]=_0x5861fe[_0x2900('0x40')];_0x35062a[_0x2900('0x26')]=_0x74b295[_0x2900('0x41')]()==='outbound'?_0x23d197[_0x2900('0x42')]:_0x23d197[_0x2900('0x43')];_0x35062a['callDirection']=_0x74b295===_0x2900('0x44')||_0x74b295===_0x2900('0x45')?_0x2900('0x44'):_0x2900('0x46');if(_0x4e75cf){_0x35062a[_0x2900('0x1a')]=_0x4e75cf['email'];}var _0x3a287b=util[_0x2900('0x25')](_0x2900('0x47'),_0x5861fe[_0x2900('0x3f')],_0x23d197[_0x2900('0x48')],md5(_0x23d197[_0x2900('0x48')]));if(_0x149060&&_0x149060[_0x2900('0x49')]){logger['info'](_0x2900('0x4a'),_0x2900('0x4b'));_0x23d197[_0x2900('0x4c')]=_0x3a287b;}else if(_0x3bf0f7&&_0x3bf0f7[_0x2900('0x4d')]&&_0x3bf0f7[_0x2900('0x4d')]!==_0x2900('0x4e')){logger[_0x2900('0xd')](_0x2900('0x4f'),_0x2900('0x4b'));_0x23d197['recordingURL']=_0x3a287b;}else{_0x23d197[_0x2900('0x4c')]='';}return getAdminId(_0x35062a,_0x74b295,_0x122999,_0x596691)[_0x2900('0x19')](getUser(_0x74b295,_0x122999,_0x596691))['then'](getEndUser(_0x74b295,_0x122999,_0x596691))[_0x2900('0x19')](getTicket(_0x74b295,_0x122999,_0x596691,_0x44ccf0,_0x23d197))[_0x2900('0x19')](function(_0x3930bf){logger[_0x2900('0xd')](util[_0x2900('0x25')](_0x2900('0x50'),_0x3930bf[_0x2900('0x51')]));if(_0x74b295!==_0x2900('0x45')){logger['info']('['+[_0x74b295[_0x2900('0x15')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x596691,_0x4e75cf[_0x2900('0x52')],_0x3930bf[_0x2900('0x28')]);}})[_0x2900('0x1f')](function(_0xd5d0c1){logger['error']('['+[_0x74b295['toUpperCase']()]+_0x2900('0x53'),util[_0x2900('0x54')](_0xd5d0c1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x78d4=['work_number','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','Admin\x20selected','error','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:'];(function(_0xb47dc0,_0x407032){var _0x57f0b0=function(_0x11c030){while(--_0x11c030){_0xb47dc0['push'](_0xb47dc0['shift']());}};_0x57f0b0(++_0x407032);}(_0x78d4,0x7a));var _0x478d=function(_0x3a6845,_0x931b08){_0x3a6845=_0x3a6845-0x0;var _0x2c5f94=_0x78d4[_0x3a6845];return _0x2c5f94;};'use strict';var _=require(_0x478d('0x0'));var rp=require(_0x478d('0x1'));var md5=require(_0x478d('0x2'));var util=require(_0x478d('0x3'));var moment=require(_0x478d('0x4'));var Promise=require('bluebird');var Redis=require(_0x478d('0x5'));var intUtil=require(_0x478d('0x6'));var config=require(_0x478d('0x7'));var logger=require(_0x478d('0x8'))('freshsales');config[_0x478d('0x9')]=_[_0x478d('0xa')](config[_0x478d('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x478d('0x9')]));function getAdminId(_0xc5464d,_0xba096c,_0x5e416e,_0x35bbf5){return new Promise(function(_0x5ac7b2,_0x45d88d){var _0x34ba6a=![];var _0x292699={'method':_0x478d('0xb'),'uri':_0x35bbf5+_0x478d('0xc'),'json':!![]};_0x292699[_0x478d('0xd')]=_0x5e416e;logger[_0x478d('0xe')](_0x478d('0xf'));return rp(_0x292699)[_0x478d('0x10')](function(_0x46a23b){if(_0x46a23b){var _0x16f028=_0x46a23b[_0x478d('0x11')];var _0xea9c4a=null;for(_0xea9c4a=0x0;_0xea9c4a<_0x16f028['length'];_0xea9c4a++){if(_0x16f028[_0xea9c4a][_0x478d('0x12')]===_0xc5464d[_0x478d('0x13')]){_0xc5464d[_0x478d('0x14')]=_0x16f028[_0xea9c4a]['id'];_0x34ba6a=!![];}}if(_0x34ba6a){logger[_0x478d('0xe')](_0x478d('0x15'),_0xc5464d[_0x478d('0x14')]);_0x5ac7b2(_0xc5464d);}else{_0x45d88d({'statusCode':0x194,'message':_0x478d('0x16')});}}else{_0x45d88d({'statusCode':0x194,'message':_0x478d('0x16')});}})[_0x478d('0x17')](function(_0x2fff64){logger['error']('['+[_0xba096c[_0x478d('0x18')]()]+']',_0x2fff64[_0x478d('0x19')]);_0x45d88d(_0x2fff64);});});}function getUser(_0x889c2a,_0x4119ea,_0x3ab4a6){return function(_0x2d426c){return new Promise(function(_0x29030e,_0x7d3877){var _0x499d24={'method':_0x478d('0xb'),'uri':_0x3ab4a6+'/api/selector/owners','json':!![]};_0x499d24[_0x478d('0xd')]=_0x4119ea;logger[_0x478d('0xe')]('Getting\x20user\x20list');return rp(_0x499d24)[_0x478d('0x10')](function(_0x1a13bf){if(_0x1a13bf){var _0x137b4b=_0x1a13bf[_0x478d('0x11')];var _0x2c51b3=![];var _0x4704b1=null;if(_0x2d426c[_0x478d('0x1a')]!==null){logger['info'](_0x478d('0x1b'),_0x2d426c['agentEmail']);_0x2d426c[_0x478d('0x1c')]=_0x2d426c[_0x478d('0x1a')];for(_0x4704b1=0x0;_0x4704b1<_0x137b4b[_0x478d('0x1d')];_0x4704b1++){if(_0x137b4b[_0x4704b1]['email']===_0x2d426c['agentEmail']){_0x2c51b3=!![];_0x2d426c[_0x478d('0x1e')]=_0x137b4b[_0x4704b1]['id'];logger['info']('User\x20found:',_0x2d426c[_0x478d('0x1e')]);}}}if(!_0x2c51b3){logger[_0x478d('0xe')](_0x478d('0x1f'));_0x2d426c['userEmail']=_0x2d426c['adminEmail'];_0x2d426c[_0x478d('0x1e')]=_0x2d426c[_0x478d('0x14')];_0x2c51b3=!![];}if(_0x2c51b3){_0x29030e(_0x2d426c);}else{_0x7d3877({'statusCode':0x194,'message':_0x478d('0x16')});}}else{_0x7d3877({'statusCode':0x194,'message':_0x478d('0x16')});}})[_0x478d('0x17')](function(_0x9045c0){logger[_0x478d('0x20')]('['+[_0x889c2a[_0x478d('0x18')]()]+']',_0x9045c0[_0x478d('0x19')]);_0x7d3877(_0x9045c0);});});};}function searchContact(_0x52d6bc,_0x3eeaef,_0x5899a4,_0x8a2b70){return new Promise(function(_0x255117,_0x135280){var _0x2f20f1={'method':_0x478d('0xb'),'headers':_0x3eeaef,'uri':_0x52d6bc+'/api/lookup?q='+_0x8a2b70+_0x478d('0x21')+_0x5899a4+_0x478d('0x22'),'json':!![]};rp(_0x2f20f1)[_0x478d('0x10')](function(_0x4a6929){var _0x2a8fbe=_[_0x478d('0x23')](_0x4a6929[_0x478d('0x24')][_0x478d('0x24')],[_0x5899a4,_0x8a2b70]);_0x255117(_0x2a8fbe);})[_0x478d('0x17')](function(_0x322514){_0x135280(_0x322514);});});}function getEndUser(_0x50c934,_0x54e08d,_0x144af4){return function(_0x5496b7){return new Promise(function(_0x5b9e07,_0x42ae6d){logger[_0x478d('0xe')](util[_0x478d('0x25')](_0x478d('0x26'),_0x5496b7[_0x478d('0x27')]));searchContact(_0x144af4,_0x54e08d,'mobile_number',_0x5496b7[_0x478d('0x27')])[_0x478d('0x10')](function(_0x458018){if(_0x458018){_0x5496b7[_0x478d('0x28')]=_0x458018['id'];logger[_0x478d('0xe')](_0x478d('0x29'),_0x5496b7[_0x478d('0x28')]);return _0x5b9e07(_0x5496b7);}searchContact(_0x144af4,_0x54e08d,_0x478d('0x2a'),_0x5496b7['contactNumber'])[_0x478d('0x10')](function(_0xb5f52){if(_0xb5f52){_0x5496b7[_0x478d('0x28')]=_0xb5f52['id'];logger['info']('Contact\x20found\x20work_number:',_0x5496b7['endUserId']);return _0x5b9e07(_0x5496b7);}createEndUser(_0x5496b7,_0x50c934,_0x54e08d,_0x144af4)[_0x478d('0x10')](function(_0x4587e5){logger['info']('Contact\x20created:',_0x4587e5[_0x478d('0x28')]);return _0x5b9e07(_0x4587e5);});});})[_0x478d('0x17')](function(_0x4153c1){_0x42ae6d(_0x4153c1);});});};}function createEndUser(_0x1d57d6,_0x5734e0,_0x434515,_0x3f8cb9){return new Promise(function(_0x5d051d,_0x18bfb8){var _0x623010=moment();var _0x816c5={'method':'POST','uri':_0x3f8cb9+'/api/contacts','body':{'contact':{'last_name':_0x1d57d6['contactNumber'],'work_number':_0x1d57d6['contactNumber'],'mobile_number':_0x1d57d6[_0x478d('0x27')],'owner_id':_0x1d57d6[_0x478d('0x1e')],'created_at':_0x623010['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x816c5[_0x478d('0xd')]=_0x434515;logger[_0x478d('0xe')](_0x478d('0x2b'));return rp(_0x816c5)[_0x478d('0x10')](function(_0x3c0105){_0x1d57d6['endUserId']=_0x3c0105['contact']['id'];_0x5d051d(_0x1d57d6);})[_0x478d('0x17')](function(_0x31191d){logger[_0x478d('0x20')]('['+[_0x5734e0[_0x478d('0x18')]()]+']',_0x31191d[_0x478d('0x19')]);_0x18bfb8(_0x31191d[_0x478d('0x19')]);});});}function getTicket(_0x19a7aa,_0x8699b6,_0x3032ff,_0x4a3c39,_0x3878a4){return function(_0x43aa84){logger[_0x478d('0xe')](_0x478d('0x2c'));return new Promise(function(_0x45afbb,_0x27d027){var _0x168dde=moment();var _0x68d343={'method':_0x478d('0x2d'),'uri':_0x3032ff+_0x478d('0x2e'),'body':{'title':intUtil['getString'](_0x4a3c39[_0x478d('0x2f')],_0x3878a4,'\x20'),'description':intUtil[_0x478d('0x30')](_0x4a3c39[_0x478d('0x31')],_0x3878a4,'\x0a'),'owner_id':_0x43aa84[_0x478d('0x1e')],'creater_id':_0x43aa84[_0x478d('0x14')],'targetable_id':_0x43aa84[_0x478d('0x28')],'targetable_type':_0x478d('0x32'),'created_at':_0x168dde[_0x478d('0x25')](_0x478d('0x33')),'due_date':_0x168dde[_0x478d('0x34')](0x1e,'m')[_0x478d('0x25')](_0x478d('0x33'))},'json':!![]};_0x68d343['headers']=_0x8699b6;return rp(_0x68d343)['then'](function(_0x4fc1f0){_0x43aa84[_0x478d('0x35')]=_0x4fc1f0[_0x478d('0x36')]['id'];logger[_0x478d('0xe')]('Task\x20created:',_0x43aa84['ticketId']);_0x45afbb(_0x43aa84);})[_0x478d('0x17')](function(_0x1a7ff3){logger[_0x478d('0x20')]('['+[_0x19a7aa[_0x478d('0x18')]()]+']',_0x1a7ff3['message']);_0x27d027(_0x1a7ff3['message']);});});};}function emit(_0x14802e,_0x25d785,_0x490371){var _0x39b989={'uri':_0x14802e+_0x478d('0x37')+_0x490371};io['to'](util[_0x478d('0x25')](_0x478d('0x38'),_0x25d785))[_0x478d('0x39')]('trigger:browser:url',_0x39b989);}exports['cs']=function(_0x30fb05,_0x8c7adf,_0x1846c4,_0x5ec89b,_0x55b2e2,_0x35eaf5,_0x3ed0ef,_0x5f5366){var _0x22f5bb={};var _0x331c1a={'Authorization':_0x478d('0x3a')+_0x35eaf5[_0x478d('0x3b')]};_0x35eaf5[_0x478d('0x3c')]=intUtil[_0x478d('0x3d')](_0x35eaf5['remoteUri']);_0x35eaf5['serverUrl']=intUtil[_0x478d('0x3d')](_0x35eaf5[_0x478d('0x3e')]);var _0x392acd=_0x35eaf5[_0x478d('0x3c')];_0x22f5bb[_0x478d('0x13')]=_0x35eaf5[_0x478d('0x3f')];_0x22f5bb[_0x478d('0x27')]=_0x5f5366[_0x478d('0x40')]()===_0x478d('0x41')?_0x8c7adf['destcalleridnum']:_0x8c7adf[_0x478d('0x42')];_0x22f5bb['callDirection']=_0x5f5366===_0x478d('0x43')||_0x5f5366===_0x478d('0x44')?_0x478d('0x43'):_0x478d('0x41');if(_0x5ec89b){_0x22f5bb[_0x478d('0x1a')]=_0x5ec89b['email'];}var _0x316da8=util['format'](_0x478d('0x45'),_0x35eaf5[_0x478d('0x3e')],_0x8c7adf['uniqueid'],md5(_0x8c7adf[_0x478d('0x46')]));if(_0x55b2e2&&_0x55b2e2[_0x478d('0x47')]){logger[_0x478d('0xe')](_0x478d('0x48'),_0x478d('0x49'));_0x8c7adf['recordingURL']=_0x316da8;}else if(_0x3ed0ef&&_0x3ed0ef[_0x478d('0x4a')]&&_0x3ed0ef['recordingFormat']!=='none'){logger['info'](_0x478d('0x4b'),_0x478d('0x49'));_0x8c7adf[_0x478d('0x4c')]=_0x316da8;}else{_0x8c7adf[_0x478d('0x4c')]='';}return getAdminId(_0x22f5bb,_0x5f5366,_0x331c1a,_0x392acd)[_0x478d('0x10')](getUser(_0x5f5366,_0x331c1a,_0x392acd))[_0x478d('0x10')](getEndUser(_0x5f5366,_0x331c1a,_0x392acd))[_0x478d('0x10')](getTicket(_0x5f5366,_0x331c1a,_0x392acd,_0x1846c4,_0x8c7adf))[_0x478d('0x10')](function(_0x4c9419){logger[_0x478d('0xe')](util[_0x478d('0x25')](_0x478d('0x4d'),_0x4c9419[_0x478d('0x35')]));if(_0x5f5366!==_0x478d('0x44')){logger['info']('['+[_0x5f5366['toUpperCase']()]+']',_0x478d('0x4e'));emit(_0x392acd,_0x5ec89b[_0x478d('0x4f')],_0x4c9419['endUserId']);}})['catch'](function(_0x364918){logger[_0x478d('0x20')]('['+[_0x5f5366[_0x478d('0x18')]()]+_0x478d('0x50'),util[_0x478d('0x51')](_0x364918,{'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 e90e191..5e4795a 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 _0x1cdb=['servicenow','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','zoho','desk','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','vtiger','dynamics365','freshsales'];(function(_0x4f9c94,_0x2d464c){var _0x52a606=function(_0x4b86ed){while(--_0x4b86ed){_0x4f9c94['push'](_0x4f9c94['shift']());}};_0x52a606(++_0x2d464c);}(_0x1cdb,0xe0));var _0xb1cd=function(_0x36448d,_0x433202){_0x36448d=_0x36448d-0x0;var _0x469af9=_0x1cdb[_0x36448d];return _0x469af9;};'use strict';var _=require(_0xb1cd('0x0'));var util=require(_0xb1cd('0x1'));var zendesk=require(_0xb1cd('0x2'));var salesforce=require(_0xb1cd('0x3'));var sugarcrm=require(_0xb1cd('0x4'));var freshdesk=require(_0xb1cd('0x5'));var zoho=require('./zoho');var desk=require(_0xb1cd('0x6'));var vtiger=require(_0xb1cd('0x7'));var servicenow=require(_0xb1cd('0x8'));var dynamics365=require(_0xb1cd('0x9'));var freshsales=require(_0xb1cd('0xa'));var integrations=[_0xb1cd('0xb'),'salesforce',_0xb1cd('0xc'),'freshdesk','zoho','desk',_0xb1cd('0xd'),_0xb1cd('0xe'),_0xb1cd('0xf'),_0xb1cd('0x10')];exports['exec']=function(_0x4d65c5,_0x164284,_0x58a82d,_0x1780b1,_0xc31e7b,_0x20afb1){if(_0x58a82d){if(_[_0xb1cd('0x11')](integrations,_0x4d65c5[_0xb1cd('0x12')][_0xb1cd('0x13')]())){try{var _0x268e9b=null;var _0xd11f0e='';var _0x47de5d=_0x58a82d[_0x4d65c5['data1'][_0xb1cd('0x13')]()];if(_0x47de5d){var _0x2b49c5=_0x47de5d[_0x4d65c5['data2']];if(_0x2b49c5){var _0x1424ea=_[_0xb1cd('0x14')](_0x2b49c5[_0xb1cd('0x15')],{'id':parseInt(_0x4d65c5[_0xb1cd('0x16')],0xa)});if(_0x1424ea){if(_0x1780b1){if(_0xc31e7b&&_0x164284[_0xb1cd('0x17')]){_0xd11f0e=_0xb1cd('0x17');}else if(_0x164284[_0xb1cd('0x18')]){_0xd11f0e=_0xb1cd('0x19');}else{console[_0xb1cd('0x1a')](_0xb1cd('0x1b'),_0x164284);}}else{_0xd11f0e=_0xb1cd('0x1c');}switch(_0x4d65c5[_0xb1cd('0x12')][_0xb1cd('0x13')]()){case _0xb1cd('0xb'):zendesk[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0x1d'):salesforce[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0xc'):sugarcrm[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0x1e'):freshdesk[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0x1f'):zoho[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0x20'):desk[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0xd'):vtiger[_0xd11f0e](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1);break;case _0xb1cd('0xf'):freshsales['cs'](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1,_0xd11f0e);break;case _0xb1cd('0x10'):servicenow['cs'](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1,_0xd11f0e);break;case _0xb1cd('0xe'):dynamics365['cs'](_0x4d65c5,_0x164284,_0x1424ea,_0x1780b1,_0xc31e7b,_0x2b49c5,_0x20afb1,_0xd11f0e);break;default:console['log']('unknown\x20integration');}}else{_0x268e9b=require(_0xb1cd('0x21'))(_0x4d65c5['data1']['toLowerCase']());_0x268e9b['error'](_0xb1cd('0x22'),util[_0xb1cd('0x23')](_0xb1cd('0x24'),_0x4d65c5['data1'][_0xb1cd('0x13')](),_0x4d65c5[_0xb1cd('0x16')]));}}else{_0x268e9b=require('../../../../config/logger')(_0x4d65c5[_0xb1cd('0x12')][_0xb1cd('0x13')]());_0x268e9b['error'](_0xb1cd('0x22'),util[_0xb1cd('0x23')](_0xb1cd('0x25'),_0x4d65c5[_0xb1cd('0x12')][_0xb1cd('0x13')](),_0x4d65c5[_0xb1cd('0x26')]));}}else{}}catch(_0x51ffad){console[_0xb1cd('0x27')](_0x51ffad);}}}}; \ No newline at end of file +var _0x300a=['data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zoho','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','dynamics365','servicenow','exec','includes'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x300a,0xcb));var _0xa300=function(_0x57b4f2,_0x582a17){_0x57b4f2=_0x57b4f2-0x0;var _0x421370=_0x300a[_0x57b4f2];return _0x421370;};'use strict';var _=require(_0xa300('0x0'));var util=require(_0xa300('0x1'));var zendesk=require(_0xa300('0x2'));var salesforce=require(_0xa300('0x3'));var sugarcrm=require(_0xa300('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xa300('0x5'));var desk=require(_0xa300('0x6'));var vtiger=require(_0xa300('0x7'));var servicenow=require(_0xa300('0x8'));var dynamics365=require(_0xa300('0x9'));var freshsales=require(_0xa300('0xa'));var integrations=[_0xa300('0xb'),_0xa300('0xc'),'sugarcrm',_0xa300('0xd'),'zoho',_0xa300('0xe'),'vtiger',_0xa300('0xf'),'freshsales',_0xa300('0x10')];exports[_0xa300('0x11')]=function(_0x4e34ab,_0xa221df,_0x5e13ea,_0x1512fb,_0xc8d859,_0x562fd7){if(_0x5e13ea){if(_[_0xa300('0x12')](integrations,_0x4e34ab[_0xa300('0x13')][_0xa300('0x14')]())){try{var _0x441650=null;var _0x14d4f8='';var _0x45a85d=_0x5e13ea[_0x4e34ab[_0xa300('0x13')][_0xa300('0x14')]()];if(_0x45a85d){var _0x29d6c0=_0x45a85d[_0x4e34ab[_0xa300('0x15')]];if(_0x29d6c0){var _0x5a48f2=_[_0xa300('0x16')](_0x29d6c0[_0xa300('0x17')],{'id':parseInt(_0x4e34ab[_0xa300('0x18')],0xa)});if(_0x5a48f2){if(_0x1512fb){if(_0xc8d859&&_0xa221df[_0xa300('0x19')]){_0x14d4f8='queue';}else if(_0xa221df[_0xa300('0x1a')]){_0x14d4f8=_0xa300('0x1b');}else{console['log'](_0xa300('0x1c'),_0xa221df);}}else{_0x14d4f8=_0xa300('0x1d');}switch(_0x4e34ab[_0xa300('0x13')][_0xa300('0x14')]()){case _0xa300('0xb'):zendesk[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case _0xa300('0xc'):salesforce[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case'sugarcrm':sugarcrm[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case _0xa300('0xd'):freshdesk[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case _0xa300('0x1e'):zoho[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case'desk':desk[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case _0xa300('0x1f'):vtiger[_0x14d4f8](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7);break;case'freshsales':freshsales['cs'](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7,_0x14d4f8);break;case'servicenow':servicenow['cs'](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7,_0x14d4f8);break;case _0xa300('0xf'):dynamics365['cs'](_0x4e34ab,_0xa221df,_0x5a48f2,_0x1512fb,_0xc8d859,_0x29d6c0,_0x562fd7,_0x14d4f8);break;default:console['log'](_0xa300('0x20'));}}else{_0x441650=require(_0xa300('0x21'))(_0x4e34ab[_0xa300('0x13')][_0xa300('0x14')]());_0x441650[_0xa300('0x22')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4e34ab['data1']['toLowerCase'](),_0x4e34ab[_0xa300('0x18')]));}}else{_0x441650=require(_0xa300('0x21'))(_0x4e34ab[_0xa300('0x13')][_0xa300('0x14')]());_0x441650[_0xa300('0x22')](_0xa300('0x23'),util['format'](_0xa300('0x24'),_0x4e34ab[_0xa300('0x13')]['toLowerCase'](),_0x4e34ab[_0xa300('0x15')]));}}else{}}catch(_0x210684){console['error'](_0x210684);}}}}; \ 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 1312877..f2dd1d5 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 _0xe53c=['jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','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','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','includes','picklist','type','idField','content','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5'];(function(_0x28aa04,_0x81eb6d){var _0x35730a=function(_0x34c2df){while(--_0x34c2df){_0x28aa04['push'](_0x28aa04['shift']());}};_0x35730a(++_0x81eb6d);}(_0xe53c,0x7d));var _0xce53=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0xe53c[_0x2b2c53];return _0x311ec2;};'use strict';var _=require(_0xce53('0x0'));var rp=require(_0xce53('0x1'));var moment=require(_0xce53('0x2'));var BPromise=require('bluebird');var md5=require(_0xce53('0x3'));var jsforce=require(_0xce53('0x4'));var util=require(_0xce53('0x5'));var Redis=require(_0xce53('0x6'));var intUtil=require(_0xce53('0x7'));var config=require(_0xce53('0x8'));var logger=require('../../../../config/logger')(_0xce53('0x9'));config[_0xce53('0xa')]=_['defaults'](config[_0xce53('0xa')],{'host':_0xce53('0xb'),'port':0x18eb});var io=require(_0xce53('0xc'))(new Redis(config[_0xce53('0xa')]));function emit(_0xca9f10,_0x288e5b,_0x40d7b5){io['to'](_0xca9f10)[_0xce53('0xd')](_0x288e5b,_0x40d7b5);}function getTicket(_0x245817,_0x1583a2,_0x2708db,_0x49ac4f,_0x4128af,_0x1d6def,_0x473b62,_0x24896c){var _0x1ebf98=Object['assign']({},{'OwnerId':_0x1583a2['id'],'Subject':intUtil[_0xce53('0xe')](_0x49ac4f[_0xce53('0xf')],_0x4128af,'\x20'),'Description':intUtil[_0xce53('0xe')](_0x49ac4f[_0xce53('0x10')],_0x4128af,'\x0a')},getCustomFields(_0x1d6def,_0x4128af));if(_0x2708db){if(_0x49ac4f[_0xce53('0x11')]==='Task'){_0x1ebf98['ActivityDate']=moment[_0xce53('0x12')]();_0x1ebf98[_0xce53('0x13')]=![];_0x1ebf98[_0xce53('0x14')]=![];if(_0x2708db[_0xce53('0x15')]===_0xce53('0x16')||_0x2708db['endUserType']===_0xce53('0x17')){_0x1ebf98[_0xce53('0x18')]=_0x2708db['id'];}else if(_0x2708db[_0xce53('0x15')]===_0xce53('0x19')){_0x1ebf98[_0xce53('0x1a')]=_0x2708db['id'];}}else if(_0x49ac4f[_0xce53('0x11')]===_0xce53('0x1b')){if(_0x2708db[_0xce53('0x15')]===_0xce53('0x16')){_0x1ebf98[_0xce53('0x1c')]=_0x2708db['id'];}else if(_0x2708db['endUserType']==='account'){_0x1ebf98[_0xce53('0x1d')]=_0x2708db['id'];}else if(_0x2708db[_0xce53('0x15')]==='lead'&&_0x49ac4f['leadId']){_0x1ebf98[_0x49ac4f[_0xce53('0x1e')]]=_0x2708db['id'];}else{logger[_0xce53('0x1f')](_0xce53('0x20'));}}}return _0x473b62[_0xce53('0x21')](_0x49ac4f[_0xce53('0x11')])[_0xce53('0x22')](_0x1ebf98);}function getUser(_0xb05e8d,_0xffa024,_0x5a3ad9){if(!_[_0xce53('0x23')](_0xffa024)&&intUtil[_0xce53('0x24')](_0xffa024)){var _0x60c0b0={'Email':_0xffa024};var _0x453d33={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a3ad9[_0xce53('0x21')](_0xce53('0x25'))['find'](_0x60c0b0,_0x453d33)[_0xce53('0x26')]()[_0xce53('0x27')](function(_0xa170e3){if(_0xa170e3[_0xce53('0x28')]){var _0x314a37=_[_0xce53('0x29')](_0xa170e3,function(_0x3927e5){return _0x3927e5[_0xce53('0x2a')]===_0xffa024;});if(_0x314a37){logger[_0xce53('0x1f')](_0xce53('0x2b'),_0xffa024);return BPromise['resolve']({'id':_0x314a37['Id'],'name':_0x314a37[_0xce53('0x2c')]});}}else{logger['info'](_0xce53('0x2d'),_0xffa024);return _0x5a3ad9[_0xce53('0x2e')]()[_0xce53('0x27')](function(_0x508e39){return BPromise[_0xce53('0x2f')]({'id':_0x508e39[_0xce53('0x30')],'name':_0x508e39[_0xce53('0x31')]});});}});}else{logger['info'](_0xce53('0x2d'),_0xffa024);return _0x5a3ad9[_0xce53('0x2e')]()[_0xce53('0x27')](function(_0xd0f0ac){return BPromise[_0xce53('0x2f')]({'id':_0xd0f0ac[_0xce53('0x30')],'name':_0xd0f0ac[_0xce53('0x31')]});});}}function getEndUser(_0x4d6c56,_0x1694a9,_0x4ef963,_0x12480e,_0x22f83c){var _0x2223bd={'$or':{'Phone':_0x12480e}};var _0x396ea5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xce53('0x2f')]()[_0xce53('0x27')](function(){logger['info'](_0xce53('0x32'),_0x12480e,_0x1694a9['moduleSearch']);switch(_0x1694a9[_0xce53('0x33')]){case _0xce53('0x34'):var _0x180d85=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9['additionalSearchContact']){var _0x158743={};_0x158743[_0x1694a9[_0xce53('0x36')]]=_0x12480e;_[_0xce53('0x37')](_0x180d85['$or'],_0x158743);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x38'))[_0xce53('0x29')](_0x180d85,_0x396ea5)['execute']()[_0xce53('0x27')](function(_0x3a8a0d){if(_0x3a8a0d&&_0x3a8a0d[_0xce53('0x28')]){return _0x3a8a0d;}else{var _0x3c6a17=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x39')]){var _0x13f996={};_0x13f996[_0x1694a9[_0xce53('0x39')]]=_0x12480e;_[_0xce53('0x37')](_0x3c6a17[_0xce53('0x3a')],_0x13f996);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x3b'))[_0xce53('0x29')](_0x3c6a17,_0x396ea5);}});case _0xce53('0x3c'):var _0x389a45=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x3d')]){var _0x158743={};_0x158743[_0x1694a9[_0xce53('0x3d')]]=_0x12480e;_[_0xce53('0x37')](_0x389a45[_0xce53('0x3a')],_0x158743);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x3e'))[_0xce53('0x29')](_0x389a45,_0x396ea5)[_0xce53('0x26')]()['then'](function(_0x37231f){if(_0x37231f&&_0x37231f[_0xce53('0x28')]){return _0x37231f;}else{var _0x9e707a=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x36')]){var _0x21c727={};_0x21c727[_0x1694a9[_0xce53('0x36')]]=_0x12480e;_[_0xce53('0x37')](_0x9e707a['$or'],_0x21c727);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x38'))[_0xce53('0x29')](_0x9e707a,_0x396ea5)[_0xce53('0x27')](function(_0x5ac219){if(_0x5ac219&&_0x5ac219['length']){return _0x5ac219;}else{var _0x373a6a=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x39')]){var _0x255c80={};_0x255c80[_0x1694a9[_0xce53('0x39')]]=_0x12480e;_[_0xce53('0x37')](_0x373a6a[_0xce53('0x3a')],_0x255c80);}return _0x22f83c['sobject'](_0xce53('0x3b'))[_0xce53('0x29')](_0x373a6a,_0x396ea5);}});}});case _0xce53('0x16'):var _0x180d85=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x36')]){var _0x158743={};_0x158743[_0x1694a9[_0xce53('0x36')]]=_0x12480e;_[_0xce53('0x37')](_0x180d85[_0xce53('0x3a')],_0x158743);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x38'))['find'](_0x180d85,_0x396ea5)[_0xce53('0x26')]();case'lead':var _0x337ac8=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x39')]){var _0x158743={};_0x158743[_0x1694a9['additionalSearchLead']]=_0x12480e;_[_0xce53('0x37')](_0x337ac8['$or'],_0x158743);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x3b'))[_0xce53('0x29')](_0x337ac8,_0x396ea5);case'account':var _0x389a45=_[_0xce53('0x35')](_0x2223bd);if(_0x1694a9[_0xce53('0x3d')]){var _0x158743={};_0x158743[_0x1694a9['additionalSearchAccount']]=_0x12480e;_[_0xce53('0x37')](_0x389a45['$or'],_0x158743);}return _0x22f83c[_0xce53('0x21')](_0xce53('0x3e'))[_0xce53('0x29')](_0x389a45,_0x396ea5);default:return null;}})[_0xce53('0x27')](function(_0x30d215){if(_0x30d215&&_0x30d215[_0xce53('0x28')]){var _0x3dad6f=_[_0xce53('0x3f')](_0x30d215);if(_0x3dad6f){return BPromise[_0xce53('0x2f')]({'id':_0x3dad6f['Id'],'name':_0x3dad6f[_0xce53('0x2c')],'phone':_0x3dad6f['Phone'],'endUserType':_0x3dad6f[_0xce53('0x40')]['type'][_0xce53('0x41')]()});}}})['then'](function(_0x27814f){if(_0x27814f){logger[_0xce53('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x27814f[_0xce53('0x15')],_0x12480e);return BPromise[_0xce53('0x2f')](_0x27814f);}else{logger[_0xce53('0x1f')](_0xce53('0x42'),_0x12480e);var _0x203b0a={'Phone':_0x12480e};if(_0x1694a9[_0xce53('0x43')]){if(_0x1694a9['moduleCreate']===_0xce53('0x16')){logger[_0xce53('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x12480e,_0x1694a9[_0xce53('0x43')]);_0x203b0a[_0xce53('0x44')]=_0x4ef963!==_0xce53('0x45')?_0x4ef963:util[_0xce53('0x46')](_0xce53('0x47'),_0x12480e);}else if(_0x1694a9[_0xce53('0x43')]===_0xce53('0x17')){logger[_0xce53('0x1f')](_0xce53('0x48'),_0x12480e,_0x1694a9[_0xce53('0x43')]);_0x203b0a[_0xce53('0x44')]=_0x4ef963!==_0xce53('0x45')?_0x4ef963:util[_0xce53('0x46')]('Caller\x20-\x20%s',_0x12480e);_0x203b0a[_0xce53('0x49')]='No\x20Company';}else if(_0x1694a9[_0xce53('0x43')]===_0xce53('0x19')){logger[_0xce53('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x12480e,_0x1694a9[_0xce53('0x43')]);_0x203b0a[_0xce53('0x2c')]=_0x4ef963!==_0xce53('0x45')?_0x4ef963:util[_0xce53('0x46')](_0xce53('0x47'),_0x12480e);}else{return null;}}return _0x22f83c['sobject'](_[_0xce53('0x4a')](_0x1694a9[_0xce53('0x43')]))['create'](_0x203b0a)['then'](function(_0x18eb53){return BPromise[_0xce53('0x2f')]({'id':_0x18eb53['id'],'endUserType':_0x1694a9[_0xce53('0x43')]});});}});}function getCustomFields(_0x4ab9da,_0x11ff9f){var _0x381f58={};if(_0x4ab9da[_0xce53('0x28')]>0x0){_[_0xce53('0x4b')](_0x4ab9da,function(_0x4c2f09){if(_[_0xce53('0x4c')](['string',_0xce53('0x4d')],_0x4c2f09[_0xce53('0x4e')])&&_0x4c2f09[_0xce53('0x4f')]){_0x381f58[_0x4c2f09[_0xce53('0x4f')]]=_0x4c2f09[_0xce53('0x50')]['toString']();}else if(_0x4c2f09[_0xce53('0x4e')]==='variable'&&_0x4c2f09['variableName']&&_0x4c2f09[_0xce53('0x4f')]){_0x11ff9f[_0x4c2f09[_0xce53('0x51')]]&&(_0x381f58[_0x4c2f09[_0xce53('0x4f')]]=_0x11ff9f[_0x4c2f09[_0xce53('0x51')]][_0xce53('0x52')]());}else if(_0x4c2f09['type']===_0xce53('0x53')&&_0x4c2f09['Variable']&&_0x4c2f09[_0xce53('0x54')]['name']&&_0x4c2f09[_0xce53('0x4f')]){_0x11ff9f[_0x4c2f09[_0xce53('0x54')][_0xce53('0x55')]['toLowerCase']()]&&(_0x381f58[_0x4c2f09[_0xce53('0x4f')]]=_0x11ff9f[_0x4c2f09[_0xce53('0x54')]['name'][_0xce53('0x41')]()]['toString']());}});}return _0x381f58;}function getConnection(_0x1e8ebc){var _0x50510f=_0x1e8ebc[_0xce53('0x56')][_0xce53('0x57')](_0x1e8ebc[_0xce53('0x58')]);var _0x55a447=new jsforce[(_0xce53('0x59'))]({'oauth2':{'loginUrl':_0x1e8ebc[_0xce53('0x5a')]||_0xce53('0x5b'),'clientId':_0x1e8ebc[_0xce53('0x5c')],'clientSecret':_0x1e8ebc[_0xce53('0x5d')]}});return _0x55a447[_0xce53('0x5e')](_0x1e8ebc['username'],_0x50510f)['then'](function(){logger[_0xce53('0x1f')](_0xce53('0x5f'));return _0x55a447;});}exports['queue']=function(_0x4198c6,_0x471318,_0x41b94c,_0x327848,_0xf19043,_0x2f7695){var _0x52ce40,_0x152fca,_0xb803cf,_0x2a0625;_0x2f7695[_0xce53('0x60')]=intUtil['stripTrailingSlash'](_0x2f7695['serverUrl']);_0x2f7695[_0xce53('0x5a')]=intUtil[_0xce53('0x61')](_0x2f7695[_0xce53('0x5a')]);if(_0xf19043&&_0xf19043['monitor_format']){logger[_0xce53('0x1f')](_0xce53('0x62'),_0xce53('0x63'));_0x471318[_0xce53('0x64')]=util['format'](_0xce53('0x65'),_0x2f7695[_0xce53('0x60')],_0x471318[_0xce53('0x66')],md5(_0x471318[_0xce53('0x66')]));}else{_0x471318[_0xce53('0x64')]='';}return getConnection(_0x2f7695)[_0xce53('0x27')](function(_0x4cea97){_0x2a0625=_0x4cea97;return getUser(_0x2f7695,_0x327848['email'],_0x2a0625);})['then'](function(_0x658d9d){_0x52ce40=_0x658d9d;return getEndUser(_0x2f7695,_0x41b94c,_0x471318[_0xce53('0x67')],_0x471318[_0xce53('0x68')],_0x2a0625);})[_0xce53('0x27')](function(_0x2892c9){_0x152fca=_0x2892c9;return getTicket(_0x2f7695,_0x52ce40,_0x152fca,_0x41b94c,_0x471318,_0x41b94c['Fields'],_0x2a0625,_0xce53('0x69'));})[_0xce53('0x27')](function(_0x30e298){_0xb803cf=_0x30e298;logger[_0xce53('0x1f')](_0xce53('0x6a'),_0xb803cf['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xb803cf['id'],_0x327848[_0xce53('0x55')],_0x2f7695[_0xce53('0x4e')]);switch(_0x2f7695[_0xce53('0x4e')]){case _0xce53('0x6b'):emit(util[_0xce53('0x46')](_0xce53('0x6c'),_0x327848[_0xce53('0x55')]),_0xce53('0x6d'),{'recordId':_0xb803cf['id']});break;case _0xce53('0x6e'):emit(util[_0xce53('0x46')]('user:%s',_0x327848[_0xce53('0x55')]),_0xce53('0x6f'),{'uri':util[_0xce53('0x46')]('%s/%s/e',_0x2a0625['instanceUrl'],_0xb803cf['id'])});break;default:logger[_0xce53('0x70')](_0xce53('0x71'));}})['catch'](function(_0x4fe00c){logger[_0xce53('0x70')](_0xce53('0x62'),_0x4fe00c);});};exports['outbound']=function(_0x4979d3,_0x54de1b,_0x2cf8ef,_0x3eb64d,_0x4cad7f,_0xa6a820,_0x569d48){var _0x1cecd0,_0x537e94,_0x2ddd7f,_0x421482;_0xa6a820[_0xce53('0x60')]=intUtil['stripTrailingSlash'](_0xa6a820[_0xce53('0x60')]);_0xa6a820[_0xce53('0x5a')]=intUtil[_0xce53('0x61')](_0xa6a820[_0xce53('0x5a')]);if(_0x569d48&&_0x569d48[_0xce53('0x72')]&&_0x569d48[_0xce53('0x72')]!==_0xce53('0x73')){logger[_0xce53('0x1f')](_0xce53('0x74'),_0xce53('0x63'));_0x54de1b[_0xce53('0x64')]=util[_0xce53('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa6a820[_0xce53('0x60')],_0x54de1b[_0xce53('0x66')],md5(_0x54de1b[_0xce53('0x66')]));}return getConnection(_0xa6a820)[_0xce53('0x27')](function(_0x3574b9){_0x421482=_0x3574b9;return getUser(_0xa6a820,_0x3eb64d[_0xce53('0x75')],_0x421482);})[_0xce53('0x27')](function(_0x47c229){_0x1cecd0=_0x47c229;return getEndUser(_0xa6a820,_0x2cf8ef,_0x54de1b[_0xce53('0x76')],_0x54de1b['destcalleridnum'],_0x421482);})[_0xce53('0x27')](function(_0xb60990){_0x537e94=_0xb60990;return getTicket(_0xa6a820,_0x1cecd0,_0x537e94,_0x2cf8ef,_0x54de1b,_0x2cf8ef[_0xce53('0x77')],_0x421482,'outbound');})['then'](function(_0xa3c713){_0x2ddd7f=_0xa3c713;logger[_0xce53('0x1f')](_0xce53('0x78'),_0x2ddd7f['id']);logger[_0xce53('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ddd7f['id'],_0x3eb64d[_0xce53('0x55')],_0xa6a820['type']);switch(_0xa6a820[_0xce53('0x4e')]){case _0xce53('0x6b'):emit(util[_0xce53('0x46')]('user:%s',_0x3eb64d[_0xce53('0x55')]),_0xce53('0x6d'),{'recordId':_0x2ddd7f['id']});break;case _0xce53('0x6e'):emit(util['format']('user:%s',_0x3eb64d[_0xce53('0x55')]),_0xce53('0x6f'),{'uri':util[_0xce53('0x46')]('%s/%s/e',_0x421482[_0xce53('0x79')],_0x2ddd7f['id'])});break;default:logger[_0xce53('0x70')](_0xce53('0x74'),_0xce53('0x7a'));}})[_0xce53('0x7b')](function(_0x19c219){logger[_0xce53('0x70')](_0xce53('0x74'),_0x19c219);});};exports['unmanaged']=function(_0x5e28f0,_0x4e6410,_0x12dcff,_0x3f1628,_0x7cd376,_0x3f1039){var _0xd9042d,_0x5c8b44,_0x5e9549,_0x8291dc;_0x3f1039[_0xce53('0x60')]=intUtil[_0xce53('0x61')](_0x3f1039['serverUrl']);_0x3f1039[_0xce53('0x5a')]=intUtil[_0xce53('0x61')](_0x3f1039[_0xce53('0x5a')]);if(_0x7cd376&&_0x7cd376[_0xce53('0x7c')]){logger[_0xce53('0x1f')]('['+_0x4e6410[_0xce53('0x7d')]['toUpperCase']()+']',_0xce53('0x63'));_0x4e6410[_0xce53('0x64')]=util['format'](_0xce53('0x65'),_0x3f1039[_0xce53('0x60')],_0x4e6410['uniqueid'],md5(_0x4e6410[_0xce53('0x66')]));}else{_0x4e6410[_0xce53('0x64')]='';}return getConnection(_0x3f1039)[_0xce53('0x27')](function(_0x192697){_0x8291dc=_0x192697;if(!_[_0xce53('0x23')](_0x3f1628)){return getUser(_0x3f1039,_0x3f1628[_0xce53('0x55')],_0x8291dc);}else{return getUser(_0x3f1039,null,_0x8291dc);}})[_0xce53('0x27')](function(_0x188051){_0xd9042d=_0x188051;return getEndUser(_0x3f1039,_0x12dcff,_0x4e6410[_0xce53('0x67')],_0x4e6410[_0xce53('0x68')],_0x8291dc);})[_0xce53('0x27')](function(_0x4ea94f){_0x5c8b44=_0x4ea94f;return getTicket(_0x3f1039,_0xd9042d,_0x5c8b44,_0x12dcff,_0x4e6410,_0x12dcff[_0xce53('0x77')],_0x8291dc);})[_0xce53('0x27')](function(_0x436f6f){_0x5e9549=_0x436f6f;logger[_0xce53('0x1f')]('['+_0x4e6410['lastevent']['toUpperCase']()+_0xce53('0x7e'),_0x5e9549['id']);logger[_0xce53('0x1f')]('['+_0x4e6410[_0xce53('0x7d')][_0xce53('0x7f')]()+_0xce53('0x80'),_0x3f1039[_0xce53('0x4e')]);})[_0xce53('0x7b')](function(_0x5eb529){logger[_0xce53('0x70')]('['+_0x4e6410[_0xce53('0x7d')][_0xce53('0x7f')]()+']',_0x5eb529);});}; \ No newline at end of file +var _0x5a49=['[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','ticketType','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','execute','Account','first','Name','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','No\x20Company','create','forEach','string','picklist','idField','toString','variableName','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl'];(function(_0x1dcc28,_0x26d40f){var _0x1ffb2d=function(_0x59e9e0){while(--_0x59e9e0){_0x1dcc28['push'](_0x1dcc28['shift']());}};_0x1ffb2d(++_0x26d40f);}(_0x5a49,0xf9));var _0x95a4=function(_0x1c6d58,_0x3ca411){_0x1c6d58=_0x1c6d58-0x0;var _0x1f4143=_0x5a49[_0x1c6d58];return _0x1f4143;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x95a4('0x0'));var BPromise=require(_0x95a4('0x1'));var md5=require(_0x95a4('0x2'));var jsforce=require(_0x95a4('0x3'));var util=require('util');var Redis=require(_0x95a4('0x4'));var intUtil=require(_0x95a4('0x5'));var config=require(_0x95a4('0x6'));var logger=require(_0x95a4('0x7'))('salesforce');config[_0x95a4('0x8')]=_[_0x95a4('0x9')](config[_0x95a4('0x8')],{'host':_0x95a4('0xa'),'port':0x18eb});var io=require(_0x95a4('0xb'))(new Redis(config[_0x95a4('0x8')]));function emit(_0xed65ec,_0x740947,_0x2a6463){io['to'](_0xed65ec)['emit'](_0x740947,_0x2a6463);}function getTicket(_0x428757,_0x2d5c78,_0xeca3cf,_0x58e8dd,_0x23496c,_0x4583bd,_0xae0c75,_0x43f617){var _0x2e079c=Object[_0x95a4('0xc')]({},{'OwnerId':_0x2d5c78['id'],'Subject':intUtil[_0x95a4('0xd')](_0x58e8dd[_0x95a4('0xe')],_0x23496c,'\x20'),'Description':intUtil[_0x95a4('0xd')](_0x58e8dd[_0x95a4('0xf')],_0x23496c,'\x0a')},getCustomFields(_0x4583bd,_0x23496c));if(_0xeca3cf){if(_0x58e8dd['ticketType']==='Task'){_0x2e079c['ActivityDate']=moment[_0x95a4('0x10')]();_0x2e079c[_0x95a4('0x11')]=![];_0x2e079c['IsRecurrence']=![];if(_0xeca3cf[_0x95a4('0x12')]===_0x95a4('0x13')||_0xeca3cf['endUserType']===_0x95a4('0x14')){_0x2e079c[_0x95a4('0x15')]=_0xeca3cf['id'];}else if(_0xeca3cf[_0x95a4('0x12')]===_0x95a4('0x16')){_0x2e079c[_0x95a4('0x17')]=_0xeca3cf['id'];}}else if(_0x58e8dd[_0x95a4('0x18')]==='Case'){if(_0xeca3cf[_0x95a4('0x12')]===_0x95a4('0x13')){_0x2e079c[_0x95a4('0x19')]=_0xeca3cf['id'];}else if(_0xeca3cf['endUserType']==='account'){_0x2e079c['AccountId']=_0xeca3cf['id'];}else if(_0xeca3cf[_0x95a4('0x12')]===_0x95a4('0x14')&&_0x58e8dd[_0x95a4('0x1a')]){_0x2e079c[_0x58e8dd[_0x95a4('0x1a')]]=_0xeca3cf['id'];}else{logger[_0x95a4('0x1b')](_0x95a4('0x1c'));}}}return _0xae0c75[_0x95a4('0x1d')](_0x58e8dd[_0x95a4('0x18')])['create'](_0x2e079c);}function getUser(_0x7b52f1,_0x168290,_0x55f019){if(!_[_0x95a4('0x1e')](_0x168290)&&intUtil[_0x95a4('0x1f')](_0x168290)){var _0x29e0e7={'Email':_0x168290};var _0x10931f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55f019[_0x95a4('0x1d')](_0x95a4('0x20'))[_0x95a4('0x21')](_0x29e0e7,_0x10931f)['execute']()[_0x95a4('0x22')](function(_0x2ee33a){if(_0x2ee33a[_0x95a4('0x23')]){var _0x42f55f=_['find'](_0x2ee33a,function(_0x57d980){return _0x57d980[_0x95a4('0x24')]===_0x168290;});if(_0x42f55f){logger[_0x95a4('0x1b')](_0x95a4('0x25'),_0x168290);return BPromise[_0x95a4('0x26')]({'id':_0x42f55f['Id'],'name':_0x42f55f['Name']});}}else{logger[_0x95a4('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x168290);return _0x55f019['identity']()['then'](function(_0x46f5ba){return BPromise[_0x95a4('0x26')]({'id':_0x46f5ba[_0x95a4('0x27')],'name':_0x46f5ba[_0x95a4('0x28')]});});}});}else{logger[_0x95a4('0x1b')](_0x95a4('0x29'),_0x168290);return _0x55f019['identity']()['then'](function(_0x308daa){return BPromise[_0x95a4('0x26')]({'id':_0x308daa[_0x95a4('0x27')],'name':_0x308daa[_0x95a4('0x28')]});});}}function getEndUser(_0x48b938,_0xda3b0b,_0x148450,_0x20ec5f,_0x3d9a9f){var _0x46ad3b={'$or':{'Phone':_0x20ec5f}};var _0x31095d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x95a4('0x26')]()[_0x95a4('0x22')](function(){logger[_0x95a4('0x1b')](_0x95a4('0x2a'),_0x20ec5f,_0xda3b0b[_0x95a4('0x2b')]);switch(_0xda3b0b['moduleSearch']){case _0x95a4('0x2c'):var _0x47365e=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b[_0x95a4('0x2e')]){var _0xca5d6f={};_0xca5d6f[_0xda3b0b[_0x95a4('0x2e')]]=_0x20ec5f;_['merge'](_0x47365e[_0x95a4('0x2f')],_0xca5d6f);}return _0x3d9a9f[_0x95a4('0x1d')](_0x95a4('0x30'))[_0x95a4('0x21')](_0x47365e,_0x31095d)['execute']()[_0x95a4('0x22')](function(_0x561c0c){if(_0x561c0c&&_0x561c0c['length']){return _0x561c0c;}else{var _0x449889=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b[_0x95a4('0x31')]){var _0x5b7f6a={};_0x5b7f6a[_0xda3b0b['additionalSearchLead']]=_0x20ec5f;_[_0x95a4('0x32')](_0x449889[_0x95a4('0x2f')],_0x5b7f6a);}return _0x3d9a9f[_0x95a4('0x1d')](_0x95a4('0x33'))[_0x95a4('0x21')](_0x449889,_0x31095d);}});case _0x95a4('0x34'):var _0x221d35=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b['additionalSearchAccount']){var _0xca5d6f={};_0xca5d6f[_0xda3b0b[_0x95a4('0x35')]]=_0x20ec5f;_[_0x95a4('0x32')](_0x221d35[_0x95a4('0x2f')],_0xca5d6f);}return _0x3d9a9f[_0x95a4('0x1d')]('Account')[_0x95a4('0x21')](_0x221d35,_0x31095d)[_0x95a4('0x36')]()[_0x95a4('0x22')](function(_0x4cd3ec){if(_0x4cd3ec&&_0x4cd3ec[_0x95a4('0x23')]){return _0x4cd3ec;}else{var _0xd9ea3a=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b[_0x95a4('0x2e')]){var _0x4f1c09={};_0x4f1c09[_0xda3b0b[_0x95a4('0x2e')]]=_0x20ec5f;_[_0x95a4('0x32')](_0xd9ea3a[_0x95a4('0x2f')],_0x4f1c09);}return _0x3d9a9f['sobject'](_0x95a4('0x30'))[_0x95a4('0x21')](_0xd9ea3a,_0x31095d)['then'](function(_0x521687){if(_0x521687&&_0x521687[_0x95a4('0x23')]){return _0x521687;}else{var _0x12249f=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b['additionalSearchLead']){var _0x23ebbe={};_0x23ebbe[_0xda3b0b[_0x95a4('0x31')]]=_0x20ec5f;_['merge'](_0x12249f['$or'],_0x23ebbe);}return _0x3d9a9f[_0x95a4('0x1d')](_0x95a4('0x33'))[_0x95a4('0x21')](_0x12249f,_0x31095d);}});}});case _0x95a4('0x13'):var _0x47365e=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b[_0x95a4('0x2e')]){var _0xca5d6f={};_0xca5d6f[_0xda3b0b['additionalSearchContact']]=_0x20ec5f;_[_0x95a4('0x32')](_0x47365e[_0x95a4('0x2f')],_0xca5d6f);}return _0x3d9a9f[_0x95a4('0x1d')](_0x95a4('0x30'))[_0x95a4('0x21')](_0x47365e,_0x31095d)[_0x95a4('0x36')]();case _0x95a4('0x14'):var _0x5e26ac=_['cloneDeep'](_0x46ad3b);if(_0xda3b0b[_0x95a4('0x31')]){var _0xca5d6f={};_0xca5d6f[_0xda3b0b[_0x95a4('0x31')]]=_0x20ec5f;_['merge'](_0x5e26ac[_0x95a4('0x2f')],_0xca5d6f);}return _0x3d9a9f[_0x95a4('0x1d')]('Lead')[_0x95a4('0x21')](_0x5e26ac,_0x31095d);case'account':var _0x221d35=_[_0x95a4('0x2d')](_0x46ad3b);if(_0xda3b0b['additionalSearchAccount']){var _0xca5d6f={};_0xca5d6f[_0xda3b0b[_0x95a4('0x35')]]=_0x20ec5f;_[_0x95a4('0x32')](_0x221d35[_0x95a4('0x2f')],_0xca5d6f);}return _0x3d9a9f[_0x95a4('0x1d')](_0x95a4('0x37'))['find'](_0x221d35,_0x31095d);default:return null;}})[_0x95a4('0x22')](function(_0x179af4){if(_0x179af4&&_0x179af4[_0x95a4('0x23')]){var _0x32bbf4=_[_0x95a4('0x38')](_0x179af4);if(_0x32bbf4){return BPromise['resolve']({'id':_0x32bbf4['Id'],'name':_0x32bbf4[_0x95a4('0x39')],'phone':_0x32bbf4[_0x95a4('0x3a')],'endUserType':_0x32bbf4[_0x95a4('0x3b')][_0x95a4('0x3c')]['toLowerCase']()});}}})['then'](function(_0x5b05fc){if(_0x5b05fc){logger[_0x95a4('0x1b')](_0x95a4('0x3d'),_0x5b05fc[_0x95a4('0x12')],_0x20ec5f);return BPromise[_0x95a4('0x26')](_0x5b05fc);}else{logger[_0x95a4('0x1b')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x20ec5f);var _0x39d808={'Phone':_0x20ec5f};if(_0xda3b0b['moduleCreate']){if(_0xda3b0b[_0x95a4('0x3e')]===_0x95a4('0x13')){logger['info'](_0x95a4('0x3f'),_0x20ec5f,_0xda3b0b['moduleCreate']);_0x39d808[_0x95a4('0x40')]=_0x148450!==_0x95a4('0x41')?_0x148450:util[_0x95a4('0x42')](_0x95a4('0x43'),_0x20ec5f);}else if(_0xda3b0b['moduleCreate']==='lead'){logger[_0x95a4('0x1b')](_0x95a4('0x3f'),_0x20ec5f,_0xda3b0b[_0x95a4('0x3e')]);_0x39d808[_0x95a4('0x40')]=_0x148450!==_0x95a4('0x41')?_0x148450:util[_0x95a4('0x42')](_0x95a4('0x43'),_0x20ec5f);_0x39d808[_0x95a4('0x44')]=_0x95a4('0x45');}else if(_0xda3b0b[_0x95a4('0x3e')]===_0x95a4('0x16')){logger[_0x95a4('0x1b')](_0x95a4('0x3f'),_0x20ec5f,_0xda3b0b['moduleCreate']);_0x39d808[_0x95a4('0x39')]=_0x148450!==''?_0x148450:util[_0x95a4('0x42')](_0x95a4('0x43'),_0x20ec5f);}else{return null;}}return _0x3d9a9f[_0x95a4('0x1d')](_['upperFirst'](_0xda3b0b[_0x95a4('0x3e')]))[_0x95a4('0x46')](_0x39d808)[_0x95a4('0x22')](function(_0x30df9b){return BPromise['resolve']({'id':_0x30df9b['id'],'endUserType':_0xda3b0b[_0x95a4('0x3e')]});});}});}function getCustomFields(_0x9b1e65,_0x262299){var _0x1a43d7={};if(_0x9b1e65[_0x95a4('0x23')]>0x0){_[_0x95a4('0x47')](_0x9b1e65,function(_0x1a96c3){if(_['includes']([_0x95a4('0x48'),_0x95a4('0x49')],_0x1a96c3['type'])&&_0x1a96c3['idField']){_0x1a43d7[_0x1a96c3[_0x95a4('0x4a')]]=_0x1a96c3['content'][_0x95a4('0x4b')]();}else if(_0x1a96c3[_0x95a4('0x3c')]==='variable'&&_0x1a96c3[_0x95a4('0x4c')]&&_0x1a96c3[_0x95a4('0x4a')]){_0x262299[_0x1a96c3['variableName']]&&(_0x1a43d7[_0x1a96c3['idField']]=_0x262299[_0x1a96c3[_0x95a4('0x4c')]][_0x95a4('0x4b')]());}else if(_0x1a96c3[_0x95a4('0x3c')]==='customVariable'&&_0x1a96c3[_0x95a4('0x4d')]&&_0x1a96c3[_0x95a4('0x4d')][_0x95a4('0x4e')]&&_0x1a96c3['idField']){_0x262299[_0x1a96c3[_0x95a4('0x4d')]['name'][_0x95a4('0x4f')]()]&&(_0x1a43d7[_0x1a96c3[_0x95a4('0x4a')]]=_0x262299[_0x1a96c3[_0x95a4('0x4d')][_0x95a4('0x4e')][_0x95a4('0x4f')]()]['toString']());}});}return _0x1a43d7;}function getConnection(_0xe6d786){var _0x23b836=_0xe6d786['password'][_0x95a4('0x50')](_0xe6d786[_0x95a4('0x51')]);var _0x46c1d6=new jsforce[(_0x95a4('0x52'))]({'oauth2':{'loginUrl':_0xe6d786[_0x95a4('0x53')]||'https://login.salesforce.com','clientId':_0xe6d786['clientId'],'clientSecret':_0xe6d786['clientSecret']}});return _0x46c1d6['login'](_0xe6d786[_0x95a4('0x54')],_0x23b836)[_0x95a4('0x22')](function(){logger['info'](_0x95a4('0x55'));return _0x46c1d6;});}exports[_0x95a4('0x56')]=function(_0x567f4a,_0x44c826,_0x38e603,_0x46ebf3,_0x4b6616,_0xb2b367){var _0x4c13fc,_0x9bfc87,_0x49c8a3,_0x49a863;_0xb2b367[_0x95a4('0x57')]=intUtil[_0x95a4('0x58')](_0xb2b367['serverUrl']);_0xb2b367[_0x95a4('0x53')]=intUtil['stripTrailingSlash'](_0xb2b367[_0x95a4('0x53')]);if(_0x4b6616&&_0x4b6616[_0x95a4('0x59')]){logger['info']('[QUEUE]',_0x95a4('0x5a'));_0x44c826['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb2b367[_0x95a4('0x57')],_0x44c826[_0x95a4('0x5b')],md5(_0x44c826[_0x95a4('0x5b')]));}else{_0x44c826['recordingURL']='';}return getConnection(_0xb2b367)['then'](function(_0xf1da6c){_0x49a863=_0xf1da6c;return getUser(_0xb2b367,_0x46ebf3[_0x95a4('0x5c')],_0x49a863);})[_0x95a4('0x22')](function(_0x627e7c){_0x4c13fc=_0x627e7c;return getEndUser(_0xb2b367,_0x38e603,_0x44c826['calleridname'],_0x44c826[_0x95a4('0x5d')],_0x49a863);})[_0x95a4('0x22')](function(_0x95b30c){_0x9bfc87=_0x95b30c;return getTicket(_0xb2b367,_0x4c13fc,_0x9bfc87,_0x38e603,_0x44c826,_0x38e603[_0x95a4('0x5e')],_0x49a863,_0x95a4('0x56'));})[_0x95a4('0x22')](function(_0x47f255){_0x49c8a3=_0x47f255;logger[_0x95a4('0x1b')](_0x95a4('0x5f'),_0x49c8a3['id']);logger[_0x95a4('0x1b')](_0x95a4('0x60'),_0x49c8a3['id'],_0x46ebf3[_0x95a4('0x4e')],_0xb2b367['type']);switch(_0xb2b367[_0x95a4('0x3c')]){case _0x95a4('0x61'):emit(util['format'](_0x95a4('0x62'),_0x46ebf3[_0x95a4('0x4e')]),'trigger:salesforce:display',{'recordId':_0x49c8a3['id']});break;case _0x95a4('0x63'):emit(util['format'](_0x95a4('0x62'),_0x46ebf3['name']),_0x95a4('0x64'),{'uri':util[_0x95a4('0x42')](_0x95a4('0x65'),_0x49a863['instanceUrl'],_0x49c8a3['id'])});break;default:logger[_0x95a4('0x66')](_0x95a4('0x67'));}})['catch'](function(_0x34a6be){logger[_0x95a4('0x66')]('[QUEUE]',_0x34a6be);});};exports[_0x95a4('0x68')]=function(_0x1a2bbb,_0x42532a,_0x4d6b7d,_0x51b14d,_0x4998f9,_0x998c0e,_0x4e0d46){var _0x2085cd,_0x470c54,_0x197dcb,_0x4a4f55;_0x998c0e[_0x95a4('0x57')]=intUtil[_0x95a4('0x58')](_0x998c0e[_0x95a4('0x57')]);_0x998c0e[_0x95a4('0x53')]=intUtil['stripTrailingSlash'](_0x998c0e[_0x95a4('0x53')]);if(_0x4e0d46&&_0x4e0d46[_0x95a4('0x69')]&&_0x4e0d46[_0x95a4('0x69')]!=='none'){logger[_0x95a4('0x1b')]('[OUTBOUND]',_0x95a4('0x5a'));_0x42532a[_0x95a4('0x6a')]=util[_0x95a4('0x42')](_0x95a4('0x6b'),_0x998c0e[_0x95a4('0x57')],_0x42532a['uniqueid'],md5(_0x42532a[_0x95a4('0x5b')]));}return getConnection(_0x998c0e)[_0x95a4('0x22')](function(_0x12fca8){_0x4a4f55=_0x12fca8;return getUser(_0x998c0e,_0x51b14d['email'],_0x4a4f55);})[_0x95a4('0x22')](function(_0x189353){_0x2085cd=_0x189353;return getEndUser(_0x998c0e,_0x4d6b7d,_0x42532a[_0x95a4('0x6c')],_0x42532a[_0x95a4('0x6d')],_0x4a4f55);})[_0x95a4('0x22')](function(_0x1cd36a){_0x470c54=_0x1cd36a;return getTicket(_0x998c0e,_0x2085cd,_0x470c54,_0x4d6b7d,_0x42532a,_0x4d6b7d[_0x95a4('0x5e')],_0x4a4f55,_0x95a4('0x68'));})['then'](function(_0x7fe4b2){_0x197dcb=_0x7fe4b2;logger[_0x95a4('0x1b')](_0x95a4('0x6e'),_0x197dcb['id']);logger[_0x95a4('0x1b')](_0x95a4('0x6f'),_0x197dcb['id'],_0x51b14d[_0x95a4('0x4e')],_0x998c0e[_0x95a4('0x3c')]);switch(_0x998c0e[_0x95a4('0x3c')]){case _0x95a4('0x61'):emit(util['format'](_0x95a4('0x62'),_0x51b14d[_0x95a4('0x4e')]),_0x95a4('0x70'),{'recordId':_0x197dcb['id']});break;case _0x95a4('0x63'):emit(util[_0x95a4('0x42')](_0x95a4('0x62'),_0x51b14d['name']),_0x95a4('0x64'),{'uri':util['format']('%s/%s/e',_0x4a4f55[_0x95a4('0x71')],_0x197dcb['id'])});break;default:logger[_0x95a4('0x66')](_0x95a4('0x72'),_0x95a4('0x73'));}})['catch'](function(_0x1be9cf){logger[_0x95a4('0x66')](_0x95a4('0x72'),_0x1be9cf);});};exports[_0x95a4('0x74')]=function(_0x721737,_0x5b254e,_0xedddcf,_0x4ad37c,_0x3d8451,_0x269033){var _0x37ea6c,_0x5271cf,_0x1ca164,_0x3d02ef;_0x269033['serverUrl']=intUtil[_0x95a4('0x58')](_0x269033[_0x95a4('0x57')]);_0x269033[_0x95a4('0x53')]=intUtil[_0x95a4('0x58')](_0x269033[_0x95a4('0x53')]);if(_0x3d8451&&_0x3d8451[_0x95a4('0x59')]){logger[_0x95a4('0x1b')]('['+_0x5b254e[_0x95a4('0x75')][_0x95a4('0x76')]()+']',_0x95a4('0x5a'));_0x5b254e[_0x95a4('0x6a')]=util[_0x95a4('0x42')](_0x95a4('0x6b'),_0x269033[_0x95a4('0x57')],_0x5b254e['uniqueid'],md5(_0x5b254e[_0x95a4('0x5b')]));}else{_0x5b254e[_0x95a4('0x6a')]='';}return getConnection(_0x269033)['then'](function(_0x5b8591){_0x3d02ef=_0x5b8591;if(!_['isNil'](_0x4ad37c)){return getUser(_0x269033,_0x4ad37c[_0x95a4('0x4e')],_0x3d02ef);}else{return getUser(_0x269033,null,_0x3d02ef);}})[_0x95a4('0x22')](function(_0x2a2ebd){_0x37ea6c=_0x2a2ebd;return getEndUser(_0x269033,_0xedddcf,_0x5b254e[_0x95a4('0x77')],_0x5b254e[_0x95a4('0x5d')],_0x3d02ef);})[_0x95a4('0x22')](function(_0x32b42d){_0x5271cf=_0x32b42d;return getTicket(_0x269033,_0x37ea6c,_0x5271cf,_0xedddcf,_0x5b254e,_0xedddcf['Fields'],_0x3d02ef);})[_0x95a4('0x22')](function(_0x38389b){_0x1ca164=_0x38389b;logger[_0x95a4('0x1b')]('['+_0x5b254e[_0x95a4('0x75')][_0x95a4('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x1ca164['id']);logger[_0x95a4('0x1b')]('['+_0x5b254e[_0x95a4('0x75')][_0x95a4('0x76')]()+_0x95a4('0x78'),_0x269033['type']);})['catch'](function(_0x2e1ad8){logger[_0x95a4('0x66')]('['+_0x5b254e[_0x95a4('0x75')][_0x95a4('0x76')]()+']',_0x2e1ad8);});}; \ 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 5c90239..e1f8cb4 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 _0x51b5=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','catch','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','error','includes','string','picklist','customField','nameField','toLowerCase','content','toString','type','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','endUserNumber','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x51b5,0x79));var _0x551b=function(_0x1875a1,_0x5dfb6a){_0x1875a1=_0x1875a1-0x0;var _0x4aa855=_0x51b5[_0x1875a1];return _0x4aa855;};'use strict';var _=require(_0x551b('0x0'));var Promise=require('bluebird');var rp=require(_0x551b('0x1'));var util=require('util');var md5=require(_0x551b('0x2'));var Redis=require(_0x551b('0x3'));var intUtil=require(_0x551b('0x4'));var config=require(_0x551b('0x5'));var logger=require(_0x551b('0x6'))(_0x551b('0x7'));config[_0x551b('0x8')]=_['defaults'](config[_0x551b('0x8')],{'host':_0x551b('0x9'),'port':0x18eb});var io=require(_0x551b('0xa'))(new Redis(config[_0x551b('0x8')]));function getAdminUser(_0x593b21,_0x19d958,_0x933175,_0x390754,_0x29f37d,_0x53b59e){return new Promise(function(_0x784b9c,_0x529ce2){var _0x1ff2ae={'method':_0x551b('0xb'),'uri':_0x390754+_0x551b('0xc')+'&'+_0x29f37d+'&'+_0x53b59e,'auth':_0x19d958,'json':!![]};return rp(_0x1ff2ae)[_0x551b('0xd')](function(_0x52d7bf){if(_0x52d7bf[_0x551b('0xe')][_0x551b('0xf')]>0x0){_0x933175[_0x551b('0x10')]=_0x52d7bf[_0x551b('0xe')][0x0][_0x551b('0x11')];}logger[_0x551b('0x12')]('['+[_0x593b21[_0x551b('0x13')]()]+_0x551b('0x14'),_0x933175);_0x784b9c(_0x933175);})['catch'](function(_0xe8c68f){logger['error']('['+[_0x593b21[_0x551b('0x13')]()]+']',_0xe8c68f['message']);_0x529ce2(_0xe8c68f['message']);});});}function getUser(_0x19e2e1,_0x5aa9c4,_0x5be2d0,_0xe7eca4,_0x335e9b){return function(_0x2fa06e){logger[_0x551b('0x12')]('['+[_0x19e2e1[_0x551b('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x2fa06e);return new Promise(function(_0x227170,_0x19c7b3){if(intUtil[_0x551b('0x15')](_0x2fa06e[_0x551b('0x16')])){var _0x5d3b9b={'method':_0x551b('0xb'),'uri':_0x5be2d0+_0x551b('0x17')+_0x2fa06e[_0x551b('0x16')]+'&'+_0xe7eca4+'&'+_0x335e9b,'auth':_0x5aa9c4,'json':!![]};logger[_0x551b('0x12')]('['+[_0x19e2e1['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x5d3b9b);return rp(_0x5d3b9b)[_0x551b('0xd')](function(_0x4b515a){logger[_0x551b('0x12')]('['+[_0x19e2e1[_0x551b('0x13')]()]+_0x551b('0x18'),_0x4b515a);if(_0x4b515a[_0x551b('0xe')]['length']>0x0&&String(_0x4b515a[_0x551b('0xe')][0x0][_0x551b('0x19')])==='true'){_0x2fa06e[_0x551b('0x1a')]=_0x4b515a['result'][0x0][_0x551b('0x11')];}else{_0x2fa06e[_0x551b('0x1a')]=_0x2fa06e[_0x551b('0x10')];_0x2fa06e['userEmail']=_0x2fa06e[_0x551b('0x1b')];}logger[_0x551b('0x12')]('['+[_0x19e2e1[_0x551b('0x13')]()]+_0x551b('0x1c'),_0x2fa06e);_0x227170(_0x2fa06e);})[_0x551b('0x1d')](function(_0x51c259){logger['error']('['+[_0x19e2e1[_0x551b('0x13')]()]+']',_0x51c259['message']);_0x19c7b3(_0x51c259[_0x551b('0x1e')]);});}else{logger[_0x551b('0x12')]('['+[_0x19e2e1[_0x551b('0x13')]()]+_0x551b('0x1f'));_0x2fa06e[_0x551b('0x1a')]=_0x2fa06e[_0x551b('0x10')];_0x2fa06e[_0x551b('0x16')]=_0x2fa06e['adminEmail'];_0x227170(_0x2fa06e);}});};}function createEndUser(_0x3fa999,_0x3ecee3,_0x34fe2d,_0x27aac6,_0x1c4d4b){logger[_0x551b('0x12')]('['+[_0x3fa999[_0x551b('0x13')]()]+_0x551b('0x20'),_0x34fe2d);return new Promise(function(_0x1912a2,_0x58bbdb){var _0x437c75={'method':_0x551b('0x21'),'uri':_0x27aac6+_0x551b('0x22')+_0x1c4d4b,'body':{'user_name':_0x34fe2d['endUserNumber'],'roles':_0x551b('0x23'),'first_name':_0x34fe2d['endUserNumber'],'active':_0x551b('0x24'),'date_format':_0x551b('0x25'),'phone':_0x34fe2d['endUserNumber']},'auth':_0x3ecee3,'json':!![]};return rp(_0x437c75)[_0x551b('0xd')](function(_0x5185f2){logger[_0x551b('0x12')]('['+[_0x3fa999[_0x551b('0x13')]()]+_0x551b('0x26'),_0x5185f2[_0x551b('0xe')]);_0x34fe2d[_0x551b('0x27')]=_0x5185f2['result'][_0x551b('0x11')];_0x1912a2(_0x34fe2d);})['catch'](function(_0xeb554d){logger['error']('['+[_0x3fa999[_0x551b('0x13')]()]+']',_0xeb554d[_0x551b('0x1e')]);_0x58bbdb(_0xeb554d[_0x551b('0x1e')]);});});}function getEndUser(_0x55d31f,_0x4c9dbb,_0x35c238,_0x1e21bb,_0x19cd9e){return function(_0x4fe17b){logger[_0x551b('0x12')]('['+[_0x55d31f['toUpperCase']()]+_0x551b('0x28'),_0x4fe17b);return new Promise(function(_0x5e76e9,_0x48d69c){var _0x545481={'method':'GET','uri':_0x35c238+_0x551b('0x29')+_0x4fe17b['endUserNumber']+'&'+_0x1e21bb+'&'+_0x19cd9e,'auth':_0x4c9dbb,'json':!![]};return rp(_0x545481)['then'](function(_0x4861ac){if(_0x4861ac[_0x551b('0xe')][_0x551b('0xf')]>0x0){_0x4fe17b[_0x551b('0x27')]=_0x4861ac[_0x551b('0xe')][0x0]['sys_id'];logger[_0x551b('0x12')]('['+[_0x55d31f[_0x551b('0x13')]()]+_0x551b('0x2a'),_0x4fe17b);_0x5e76e9(_0x4fe17b);}else{return createEndUser(_0x55d31f,_0x4c9dbb,_0x4fe17b,_0x35c238,_0x1e21bb)['then'](function(_0x4715a5){logger[_0x551b('0x12')]('['+[_0x55d31f['toUpperCase']()]+_0x551b('0x2b'),_0x4715a5);_0x5e76e9(_0x4715a5);});}})['catch'](function(_0x2a5e92){logger[_0x551b('0x2c')]('['+[_0x55d31f[_0x551b('0x13')]()]+']',_0x2a5e92[_0x551b('0x1e')]);_0x48d69c(_0x2a5e92[_0x551b('0x1e')]);});});};}function getCustomFields(_0xf63443,_0x5e7130){var _0x53b7ae={};if(_0xf63443['length']>0x0){_['forEach'](_0xf63443,function(_0x3358ec){if(_[_0x551b('0x2d')]([_0x551b('0x2e'),_0x551b('0x2f')],_0x3358ec['type'])&&_0x3358ec['nameField']&&!_0x3358ec[_0x551b('0x30')]){_0x53b7ae[_0x3358ec[_0x551b('0x31')][_0x551b('0x32')]()]=_0x3358ec[_0x551b('0x33')][_0x551b('0x34')]();}else if(_[_0x551b('0x2d')](['string','picklist'],_0x3358ec[_0x551b('0x35')])&&_0x3358ec['idField']&&_0x3358ec['customField']){_0x53b7ae[_0x3358ec[_0x551b('0x36')][_0x551b('0x32')]()]=_0x3358ec[_0x551b('0x33')][_0x551b('0x34')]();}else if(_0x3358ec[_0x551b('0x35')]===_0x551b('0x37')&&_0x3358ec[_0x551b('0x38')]&&_0x3358ec['idField']&&_0x3358ec[_0x551b('0x30')]){_0x53b7ae[_0x3358ec['idField'][_0x551b('0x32')]()]=_0x5e7130[_0x3358ec[_0x551b('0x38')]][_0x551b('0x34')]();}else if(_0x3358ec[_0x551b('0x35')]===_0x551b('0x39')&&_0x3358ec[_0x551b('0x3a')]&&_0x3358ec[_0x551b('0x3a')][_0x551b('0x3b')]&&_0x3358ec['idField']&&_0x3358ec[_0x551b('0x30')]){_0x53b7ae[_0x3358ec[_0x551b('0x36')]['toLowerCase']()]=_0x5e7130[_0x3358ec[_0x551b('0x3a')][_0x551b('0x3b')]['toLowerCase']()]['toString']();}});}return _0x53b7ae;}function getTicket(_0x1cf214,_0x16ea72,_0x198ecc,_0x132938,_0x1af504,_0x3a1d6c){return function(_0x13c0ea){logger[_0x551b('0x12')]('['+[_0x1cf214[_0x551b('0x13')]()]+_0x551b('0x3c'),_0x13c0ea);return new Promise(function(_0xcfc2a6,_0x5b5109){var _0x35d554=_0x1cf214[_0x551b('0x32')]()===_0x551b('0x3d')?_0x13c0ea[_0x551b('0x1a')]:_0x13c0ea[_0x551b('0x27')];var _0x599fbc={'method':_0x551b('0x21'),'uri':_0x198ecc+_0x551b('0x3e')+'?'+_0x3a1d6c,'body':Object[_0x551b('0x3f')]({},{'active':'true','caller_id':_0x35d554,'assigned_to':_0x13c0ea['userId'],'short_description':intUtil[_0x551b('0x40')](_0x132938[_0x551b('0x41')],_0x1af504,'\x20'),'description':intUtil['getString'](_0x132938[_0x551b('0x42')],_0x1af504,'\x0a')},getCustomFields(_0x132938[_0x551b('0x43')],_0x1af504)),'auth':_0x16ea72,'json':!![]};return rp(_0x599fbc)[_0x551b('0xd')](function(_0x5a79ea){logger[_0x551b('0x12')]('['+[_0x1cf214['toUpperCase']()]+_0x551b('0x44'),_0x5a79ea[_0x551b('0xe')]);_0x13c0ea[_0x551b('0x45')]=_0x5a79ea[_0x551b('0xe')][_0x551b('0x11')];_0x13c0ea['ticketNumber']=_0x5a79ea['result'][_0x551b('0x46')];logger['info']('['+[_0x1cf214[_0x551b('0x13')]()]+_0x551b('0x47'),_0x13c0ea);_0xcfc2a6(_0x13c0ea);})['catch'](function(_0x4ce56d){logger['error']('['+[_0x1cf214[_0x551b('0x13')]()]+']',_0x4ce56d[_0x551b('0x1e')]);_0x5b5109(_0x4ce56d[_0x551b('0x1e')]);});});};}function createRemoteTag(_0x6be601,_0xdbe236,_0x4c51e9,_0x4d9f2d){return new Promise(function(_0x3e1ed3,_0x32b592){var _0x2820d4={'method':_0x551b('0x21'),'uri':_0x4c51e9+'label'+'?'+_0x4d9f2d,'body':{'short_description':_0x6be601,'global':!![],'active':!![],'name':_0x6be601},'auth':_0xdbe236,'json':!![]};return rp(_0x2820d4)[_0x551b('0xd')](function(_0x52b56d){var _0x2546d6=_0x52b56d[_0x551b('0xe')][_0x551b('0x11')];_0x3e1ed3(_0x2546d6);});});}function getRemoteTag(_0x2c3e15,_0x5876fb,_0x1e24c9,_0x115d9c,_0x28c57c){return new Promise(function(_0x1fc34c,_0x503f5f){var _0x41d372={'method':_0x551b('0xb'),'uri':_0x1e24c9+_0x551b('0x48')+'?sysparm_query=name%3D'+_0x2c3e15+'&'+_0x115d9c,'auth':_0x5876fb,'json':!![]};return rp(_0x41d372)[_0x551b('0xd')](function(_0x634a00){if(_0x634a00[_0x551b('0xe')]['length']>0x0){var _0x12e919=_0x634a00['result'][0x0][_0x551b('0x11')];_0x1fc34c(_0x12e919);}else{return createRemoteTag(_0x2c3e15,_0x5876fb,_0x1e24c9,_0x115d9c)[_0x551b('0xd')](function(_0x2cc0bd){_0x1fc34c(_0x2cc0bd);});}});});}function assignTagToIncident(_0x31f327,_0x117309,_0x566e2b,_0x2bddd4,_0x4f5e28){return new Promise(function(_0x47af84,_0x2be906){var _0x503f40={'method':_0x551b('0x21'),'uri':_0x566e2b+_0x551b('0x49')+'?'+_0x4f5e28,'body':{'label':_0x31f327,'table':_0x551b('0x3e'),'id_type':_0x551b('0x4a'),'table_key':_0x2bddd4['ticketId'],'title':'Incident\x20-\x20'+_0x2bddd4[_0x551b('0x4b')],'id_display':_0x2bddd4[_0x551b('0x4b')]},'auth':_0x117309,'json':!![]};return rp(_0x503f40)['then'](function(_0x5e2284){_0x47af84();})[_0x551b('0x1d')](function(){_0x47af84();});});}function manageTags(_0x3b410a,_0x54c329,_0x5c51b8,_0xd0efad,_0x174dbd,_0x307b83,_0x5c3e4e){return new Promise(function(_0x5a187b,_0x5a9305){var _0x12d057=[];_0x54c329[_0x551b('0x4c')](function(_0x3ff1f6){_0x12d057[_0x551b('0x4d')](getRemoteTag(_0x3ff1f6,_0x5c51b8,_0xd0efad,_0x307b83,_0x5c3e4e));});return Promise[_0x551b('0x4e')](_0x12d057)[_0x551b('0xd')](function(_0x13763a){if(_0x13763a[_0x551b('0xf')]){logger[_0x551b('0x12')]('['+[_0x3b410a['toUpperCase']()]+_0x551b('0x4f'),_0x13763a);var _0x30c13f=[];_0x13763a[_0x551b('0x4c')](function(_0x3827ac){_0x30c13f[_0x551b('0x4d')](assignTagToIncident(_0x3827ac,_0x5c51b8,_0xd0efad,_0x174dbd,_0x307b83));});return Promise[_0x551b('0x4e')](_0x30c13f)['then'](function(){_0x5a187b();})[_0x551b('0x1d')](function(){_0x5a187b();});}else{_0x5a187b();}});});}function getTags(_0x4696d6,_0x5bc1dd,_0x1649ef,_0x514ea7,_0x18bd7a,_0x4ca931){return function(_0x4fc412){return new Promise(function(_0x1b20c2,_0x554798){var _0x4e71d3=[];var _0x141e86=_0x514ea7['Tags'];if(_0x141e86&&_0x141e86['length']>0x0){_0x4e71d3=_[_0x551b('0x50')](_0x141e86,'name');}if(_0x4e71d3[_0x551b('0xf')]>0x0){return manageTags(_0x4696d6,_0x4e71d3,_0x5bc1dd,_0x1649ef,_0x4fc412,_0x18bd7a,_0x4ca931)[_0x551b('0xd')](function(){_0x1b20c2(_0x4fc412);});}else{_0x1b20c2(_0x4fc412);}});};}function emit(_0x4b133a,_0x297de5,_0x32d8d0){var _0x8ced98=_0x551b('0x51')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x551b('0x52');var _0xb4b386={'uri':_0x4b133a+_0x551b('0x53')+_0x32d8d0+_0x8ced98};io['to'](util[_0x551b('0x54')](_0x551b('0x55'),_0x297de5))[_0x551b('0x56')](_0x551b('0x57'),_0xb4b386);}exports['cs']=function(_0x2b5c80,_0x53473a,_0x199c99,_0x17bb10,_0x5a8aa5,_0x42db2b,_0x15c994,_0x30bb16){var _0x5afa43={};var _0x267960={'user':_0x42db2b[_0x551b('0x58')],'pass':_0x42db2b[_0x551b('0x59')]};var _0x432add=_0x551b('0x5a');var _0x539b35=_0x551b('0x5b');_0x42db2b['remoteUri']=intUtil[_0x551b('0x5c')](_0x42db2b[_0x551b('0x5d')]);_0x42db2b[_0x551b('0x5e')]=intUtil[_0x551b('0x5c')](_0x42db2b[_0x551b('0x5e')]);var _0x286827=util[_0x551b('0x54')](_0x551b('0x5f'),_0x42db2b['remoteUri']);_0x5afa43[_0x551b('0x16')]=!_[_0x551b('0x60')](_0x17bb10)?_0x17bb10[_0x551b('0x61')]:null;_0x5afa43[_0x551b('0x1b')]=_0x42db2b[_0x551b('0x61')];_0x5afa43[_0x551b('0x62')]=_0x30bb16['toLowerCase']()===_0x551b('0x3d')?_0x53473a['destcalleridnum']:_0x53473a[_0x551b('0x63')];_0x5afa43[_0x551b('0x64')]=_0x30bb16===_0x551b('0x65')||_0x30bb16==='unmanaged'?_0x551b('0x65'):_0x551b('0x3d');var _0x5b6aa0=util[_0x551b('0x54')](_0x551b('0x66'),_0x42db2b['serverUrl'],_0x53473a[_0x551b('0x67')],md5(_0x53473a['uniqueid']));if(_0x5a8aa5&&_0x5a8aa5[_0x551b('0x68')]){logger[_0x551b('0x12')](_0x551b('0x69'),_0x551b('0x6a'));_0x53473a[_0x551b('0x6b')]=_0x5b6aa0;}else if(_0x15c994&&_0x15c994[_0x551b('0x6c')]&&_0x15c994[_0x551b('0x6c')]!==_0x551b('0x6d')){logger[_0x551b('0x12')]('[OUTBOUND]',_0x551b('0x6a'));_0x53473a[_0x551b('0x6b')]=_0x5b6aa0;}else{_0x53473a[_0x551b('0x6b')]='';}return getAdminUser(_0x30bb16,_0x267960,_0x5afa43,_0x286827,_0x539b35,_0x432add)[_0x551b('0xd')](getUser(_0x30bb16,_0x267960,_0x286827,_0x539b35,_0x432add))[_0x551b('0xd')](getEndUser(_0x30bb16,_0x267960,_0x286827,_0x539b35,_0x432add))['then'](getTicket(_0x30bb16,_0x267960,_0x286827,_0x199c99,_0x53473a,_0x539b35))[_0x551b('0xd')](function(_0xff8b48){logger[_0x551b('0x12')](util['format'](_0x551b('0x6e'),_0xff8b48[_0x551b('0x45')]));logger['info'](util[_0x551b('0x54')](_0x551b('0x6f'),_0x30bb16));if(_0x30bb16!==_0x551b('0x70')){logger[_0x551b('0x12')]('['+[_0x30bb16['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x42db2b[_0x551b('0x5d')],_0x17bb10[_0x551b('0x3b')],_0xff8b48[_0x551b('0x45')]);}})[_0x551b('0x1d')](function(_0x19e914){logger[_0x551b('0x2c')]('['+[_0x30bb16[_0x551b('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x19e914,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbc4b=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','md5','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','adminId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','customField','content','includes','string','picklist','idField','toLowerCase','toString','variable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc4b,0x103));var _0xbbc4=function(_0x3fb83a,_0x405c68){_0x3fb83a=_0x3fb83a-0x0;var _0x210f82=_0xbc4b[_0x3fb83a];return _0x210f82;};'use strict';var _=require(_0xbbc4('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require('util');var md5=require(_0xbbc4('0x1'));var Redis=require(_0xbbc4('0x2'));var intUtil=require(_0xbbc4('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbbc4('0x4'))('servicenow');config[_0xbbc4('0x5')]=_['defaults'](config[_0xbbc4('0x5')],{'host':_0xbbc4('0x6'),'port':0x18eb});var io=require(_0xbbc4('0x7'))(new Redis(config[_0xbbc4('0x5')]));function getAdminUser(_0x3623d6,_0x3b9349,_0x4ebcaa,_0x5ea983,_0x3c22c2,_0x1f52ac){return new Promise(function(_0x49c3ed,_0x14a7ca){var _0x385643={'method':_0xbbc4('0x8'),'uri':_0x5ea983+_0xbbc4('0x9')+'&'+_0x3c22c2+'&'+_0x1f52ac,'auth':_0x3b9349,'json':!![]};return rp(_0x385643)[_0xbbc4('0xa')](function(_0x5c1c84){if(_0x5c1c84[_0xbbc4('0xb')][_0xbbc4('0xc')]>0x0){_0x4ebcaa['adminId']=_0x5c1c84['result'][0x0][_0xbbc4('0xd')];}logger[_0xbbc4('0xe')]('['+[_0x3623d6[_0xbbc4('0xf')]()]+_0xbbc4('0x10'),_0x4ebcaa);_0x49c3ed(_0x4ebcaa);})['catch'](function(_0x697343){logger[_0xbbc4('0x11')]('['+[_0x3623d6[_0xbbc4('0xf')]()]+']',_0x697343[_0xbbc4('0x12')]);_0x14a7ca(_0x697343['message']);});});}function getUser(_0x5d7461,_0x56fbb1,_0x1dbd4f,_0x4535aa,_0x44724a){return function(_0xf82223){logger[_0xbbc4('0xe')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+'],\x20getUser\x20input\x20crm',_0xf82223);return new Promise(function(_0x9ff989,_0x477ba2){if(intUtil['validateEmail'](_0xf82223['userEmail'])){var _0xbee991={'method':'GET','uri':_0x1dbd4f+_0xbbc4('0x13')+_0xf82223[_0xbbc4('0x14')]+'&'+_0x4535aa+'&'+_0x44724a,'auth':_0x56fbb1,'json':!![]};logger[_0xbbc4('0xe')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+_0xbbc4('0x15'),_0xbee991);return rp(_0xbee991)[_0xbbc4('0xa')](function(_0x7b680a){logger[_0xbbc4('0xe')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+_0xbbc4('0x16'),_0x7b680a);if(_0x7b680a[_0xbbc4('0xb')][_0xbbc4('0xc')]>0x0&&String(_0x7b680a[_0xbbc4('0xb')][0x0]['active'])==='true'){_0xf82223[_0xbbc4('0x17')]=_0x7b680a[_0xbbc4('0xb')][0x0][_0xbbc4('0xd')];}else{_0xf82223[_0xbbc4('0x17')]=_0xf82223[_0xbbc4('0x18')];_0xf82223[_0xbbc4('0x14')]=_0xf82223[_0xbbc4('0x19')];}logger[_0xbbc4('0xe')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+_0xbbc4('0x1a'),_0xf82223);_0x9ff989(_0xf82223);})[_0xbbc4('0x1b')](function(_0x2fdd75){logger[_0xbbc4('0x11')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+']',_0x2fdd75[_0xbbc4('0x12')]);_0x477ba2(_0x2fdd75['message']);});}else{logger[_0xbbc4('0xe')]('['+[_0x5d7461[_0xbbc4('0xf')]()]+_0xbbc4('0x1c'));_0xf82223[_0xbbc4('0x17')]=_0xf82223[_0xbbc4('0x18')];_0xf82223[_0xbbc4('0x14')]=_0xf82223[_0xbbc4('0x19')];_0x9ff989(_0xf82223);}});};}function createEndUser(_0x4403d9,_0x5ed8ce,_0x1afb5a,_0xe1a153,_0x8c7cf4){logger['info']('['+[_0x4403d9['toUpperCase']()]+_0xbbc4('0x1d'),_0x1afb5a);return new Promise(function(_0x51517d,_0x1a8379){var _0x47181b={'method':'POST','uri':_0xe1a153+_0xbbc4('0x1e')+_0x8c7cf4,'body':{'user_name':_0x1afb5a[_0xbbc4('0x1f')],'roles':_0xbbc4('0x20'),'first_name':_0x1afb5a[_0xbbc4('0x1f')],'active':_0xbbc4('0x21'),'date_format':_0xbbc4('0x22'),'phone':_0x1afb5a[_0xbbc4('0x1f')]},'auth':_0x5ed8ce,'json':!![]};return rp(_0x47181b)['then'](function(_0x516d18){logger['info']('['+[_0x4403d9[_0xbbc4('0xf')]()]+_0xbbc4('0x23'),_0x516d18[_0xbbc4('0xb')]);_0x1afb5a[_0xbbc4('0x24')]=_0x516d18['result']['sys_id'];_0x51517d(_0x1afb5a);})[_0xbbc4('0x1b')](function(_0x256abe){logger[_0xbbc4('0x11')]('['+[_0x4403d9[_0xbbc4('0xf')]()]+']',_0x256abe[_0xbbc4('0x12')]);_0x1a8379(_0x256abe[_0xbbc4('0x12')]);});});}function getEndUser(_0xe59f34,_0x184a66,_0x1ee926,_0x3dbb64,_0x38df12){return function(_0xbfb8b6){logger[_0xbbc4('0xe')]('['+[_0xe59f34['toUpperCase']()]+_0xbbc4('0x25'),_0xbfb8b6);return new Promise(function(_0x525be3,_0x2effcc){var _0x40df9a={'method':_0xbbc4('0x8'),'uri':_0x1ee926+_0xbbc4('0x26')+_0xbfb8b6['endUserNumber']+'&'+_0x3dbb64+'&'+_0x38df12,'auth':_0x184a66,'json':!![]};return rp(_0x40df9a)[_0xbbc4('0xa')](function(_0x573463){if(_0x573463[_0xbbc4('0xb')]['length']>0x0){_0xbfb8b6[_0xbbc4('0x24')]=_0x573463['result'][0x0][_0xbbc4('0xd')];logger[_0xbbc4('0xe')]('['+[_0xe59f34[_0xbbc4('0xf')]()]+_0xbbc4('0x27'),_0xbfb8b6);_0x525be3(_0xbfb8b6);}else{return createEndUser(_0xe59f34,_0x184a66,_0xbfb8b6,_0x1ee926,_0x3dbb64)[_0xbbc4('0xa')](function(_0x5be5c5){logger[_0xbbc4('0xe')]('['+[_0xe59f34['toUpperCase']()]+_0xbbc4('0x28'),_0x5be5c5);_0x525be3(_0x5be5c5);});}})[_0xbbc4('0x1b')](function(_0x391c37){logger[_0xbbc4('0x11')]('['+[_0xe59f34['toUpperCase']()]+']',_0x391c37[_0xbbc4('0x12')]);_0x2effcc(_0x391c37[_0xbbc4('0x12')]);});});};}function getCustomFields(_0x3968f6,_0x370a8b){var _0x4436f2={};if(_0x3968f6['length']>0x0){_['forEach'](_0x3968f6,function(_0x13b923){if(_['includes'](['string','picklist'],_0x13b923[_0xbbc4('0x29')])&&_0x13b923['nameField']&&!_0x13b923[_0xbbc4('0x2a')]){_0x4436f2[_0x13b923['nameField']['toLowerCase']()]=_0x13b923[_0xbbc4('0x2b')]['toString']();}else if(_[_0xbbc4('0x2c')]([_0xbbc4('0x2d'),_0xbbc4('0x2e')],_0x13b923[_0xbbc4('0x29')])&&_0x13b923[_0xbbc4('0x2f')]&&_0x13b923['customField']){_0x4436f2[_0x13b923[_0xbbc4('0x2f')][_0xbbc4('0x30')]()]=_0x13b923[_0xbbc4('0x2b')][_0xbbc4('0x31')]();}else if(_0x13b923[_0xbbc4('0x29')]===_0xbbc4('0x32')&&_0x13b923['variableName']&&_0x13b923[_0xbbc4('0x2f')]&&_0x13b923[_0xbbc4('0x2a')]){_0x4436f2[_0x13b923[_0xbbc4('0x2f')][_0xbbc4('0x30')]()]=_0x370a8b[_0x13b923['variableName']][_0xbbc4('0x31')]();}else if(_0x13b923[_0xbbc4('0x29')]==='customVariable'&&_0x13b923['Variable']&&_0x13b923[_0xbbc4('0x33')][_0xbbc4('0x34')]&&_0x13b923['idField']&&_0x13b923['customField']){_0x4436f2[_0x13b923['idField'][_0xbbc4('0x30')]()]=_0x370a8b[_0x13b923['Variable'][_0xbbc4('0x34')][_0xbbc4('0x30')]()][_0xbbc4('0x31')]();}});}return _0x4436f2;}function getTicket(_0x25b0e2,_0x35eb9b,_0x215b63,_0x22571f,_0x5ce9b0,_0x2bf62e){return function(_0x100dbe){logger[_0xbbc4('0xe')]('['+[_0x25b0e2['toUpperCase']()]+_0xbbc4('0x35'),_0x100dbe);return new Promise(function(_0x33a906,_0x3f478){var _0x33ac2b=_0x25b0e2['toLowerCase']()==='outbound'?_0x100dbe['userId']:_0x100dbe[_0xbbc4('0x24')];var _0x4ee993={'method':_0xbbc4('0x36'),'uri':_0x215b63+_0xbbc4('0x37')+'?'+_0x2bf62e,'body':Object[_0xbbc4('0x38')]({},{'active':_0xbbc4('0x21'),'caller_id':_0x33ac2b,'assigned_to':_0x100dbe['userId'],'short_description':intUtil[_0xbbc4('0x39')](_0x22571f[_0xbbc4('0x3a')],_0x5ce9b0,'\x20'),'description':intUtil['getString'](_0x22571f[_0xbbc4('0x3b')],_0x5ce9b0,'\x0a')},getCustomFields(_0x22571f[_0xbbc4('0x3c')],_0x5ce9b0)),'auth':_0x35eb9b,'json':!![]};return rp(_0x4ee993)[_0xbbc4('0xa')](function(_0x28b298){logger['info']('['+[_0x25b0e2['toUpperCase']()]+_0xbbc4('0x3d'),_0x28b298[_0xbbc4('0xb')]);_0x100dbe[_0xbbc4('0x3e')]=_0x28b298[_0xbbc4('0xb')][_0xbbc4('0xd')];_0x100dbe[_0xbbc4('0x3f')]=_0x28b298[_0xbbc4('0xb')][_0xbbc4('0x40')];logger[_0xbbc4('0xe')]('['+[_0x25b0e2[_0xbbc4('0xf')]()]+_0xbbc4('0x41'),_0x100dbe);_0x33a906(_0x100dbe);})[_0xbbc4('0x1b')](function(_0x3d887f){logger[_0xbbc4('0x11')]('['+[_0x25b0e2[_0xbbc4('0xf')]()]+']',_0x3d887f[_0xbbc4('0x12')]);_0x3f478(_0x3d887f[_0xbbc4('0x12')]);});});};}function createRemoteTag(_0xb247fb,_0x45db36,_0x244cd7,_0x1f69d0){return new Promise(function(_0xa9d599,_0x8b974b){var _0xef9583={'method':_0xbbc4('0x36'),'uri':_0x244cd7+_0xbbc4('0x42')+'?'+_0x1f69d0,'body':{'short_description':_0xb247fb,'global':!![],'active':!![],'name':_0xb247fb},'auth':_0x45db36,'json':!![]};return rp(_0xef9583)[_0xbbc4('0xa')](function(_0x1e56c6){var _0x10fbe1=_0x1e56c6[_0xbbc4('0xb')]['sys_id'];_0xa9d599(_0x10fbe1);});});}function getRemoteTag(_0x5c0088,_0x32ca24,_0x2d409e,_0x27cd6c,_0x12385a){return new Promise(function(_0x37dd41,_0x5057e0){var _0x18d3a9={'method':'GET','uri':_0x2d409e+'label'+_0xbbc4('0x43')+_0x5c0088+'&'+_0x27cd6c,'auth':_0x32ca24,'json':!![]};return rp(_0x18d3a9)[_0xbbc4('0xa')](function(_0x1f2866){if(_0x1f2866[_0xbbc4('0xb')][_0xbbc4('0xc')]>0x0){var _0x5cf60f=_0x1f2866[_0xbbc4('0xb')][0x0][_0xbbc4('0xd')];_0x37dd41(_0x5cf60f);}else{return createRemoteTag(_0x5c0088,_0x32ca24,_0x2d409e,_0x27cd6c)[_0xbbc4('0xa')](function(_0x721ae5){_0x37dd41(_0x721ae5);});}});});}function assignTagToIncident(_0x58836e,_0x1fe16b,_0x1465ec,_0xebd4e5,_0x500cc2){return new Promise(function(_0x17df8c,_0x4a2618){var _0x77620a={'method':_0xbbc4('0x36'),'uri':_0x1465ec+_0xbbc4('0x44')+'?'+_0x500cc2,'body':{'label':_0x58836e,'table':_0xbbc4('0x37'),'id_type':_0xbbc4('0x45'),'table_key':_0xebd4e5['ticketId'],'title':'Incident\x20-\x20'+_0xebd4e5[_0xbbc4('0x3f')],'id_display':_0xebd4e5[_0xbbc4('0x3f')]},'auth':_0x1fe16b,'json':!![]};return rp(_0x77620a)[_0xbbc4('0xa')](function(_0x112ae7){_0x17df8c();})[_0xbbc4('0x1b')](function(){_0x17df8c();});});}function manageTags(_0x37826d,_0x97abff,_0x6bd17c,_0x70fc57,_0x456cdf,_0x432dd7,_0x1a16e2){return new Promise(function(_0x3d0adb,_0xa327e3){var _0x12961c=[];_0x97abff['forEach'](function(_0x4c7fac){_0x12961c[_0xbbc4('0x46')](getRemoteTag(_0x4c7fac,_0x6bd17c,_0x70fc57,_0x432dd7,_0x1a16e2));});return Promise[_0xbbc4('0x47')](_0x12961c)[_0xbbc4('0xa')](function(_0x1f8679){if(_0x1f8679['length']){logger[_0xbbc4('0xe')]('['+[_0x37826d['toUpperCase']()]+_0xbbc4('0x48'),_0x1f8679);var _0x386b44=[];_0x1f8679[_0xbbc4('0x49')](function(_0x1998ef){_0x386b44[_0xbbc4('0x46')](assignTagToIncident(_0x1998ef,_0x6bd17c,_0x70fc57,_0x456cdf,_0x432dd7));});return Promise[_0xbbc4('0x47')](_0x386b44)[_0xbbc4('0xa')](function(){_0x3d0adb();})['catch'](function(){_0x3d0adb();});}else{_0x3d0adb();}});});}function getTags(_0x43ee3c,_0xbf864d,_0x3ee0c9,_0x597c4e,_0x5ba712,_0x4c05c5){return function(_0x521c72){return new Promise(function(_0x305003,_0xad62ff){var _0x290cf0=[];var _0x182b1a=_0x597c4e[_0xbbc4('0x4a')];if(_0x182b1a&&_0x182b1a['length']>0x0){_0x290cf0=_[_0xbbc4('0x4b')](_0x182b1a,_0xbbc4('0x34'));}if(_0x290cf0[_0xbbc4('0xc')]>0x0){return manageTags(_0x43ee3c,_0x290cf0,_0xbf864d,_0x3ee0c9,_0x521c72,_0x5ba712,_0x4c05c5)[_0xbbc4('0xa')](function(){_0x305003(_0x521c72);});}else{_0x305003(_0x521c72);}});};}function emit(_0x59fbce,_0x5e0eff,_0x3f0f3c){var _0x5b7dc9=_0xbbc4('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xbbc4('0x4d')+_0xbbc4('0x4e');var _0x3c796f={'uri':_0x59fbce+_0xbbc4('0x4f')+_0x3f0f3c+_0x5b7dc9};io['to'](util[_0xbbc4('0x50')](_0xbbc4('0x51'),_0x5e0eff))[_0xbbc4('0x52')](_0xbbc4('0x53'),_0x3c796f);}exports['cs']=function(_0x1c4c8c,_0x50c5ff,_0x2b6201,_0x667f36,_0x4435f8,_0x341f6d,_0x46eccb,_0x50720f){var _0x56ea6d={};var _0x39f183={'user':_0x341f6d[_0xbbc4('0x54')],'pass':_0x341f6d[_0xbbc4('0x55')]};var _0x40b4be=_0xbbc4('0x56');var _0x20d0f8=_0xbbc4('0x57');_0x341f6d[_0xbbc4('0x58')]=intUtil[_0xbbc4('0x59')](_0x341f6d[_0xbbc4('0x58')]);_0x341f6d[_0xbbc4('0x5a')]=intUtil[_0xbbc4('0x59')](_0x341f6d['serverUrl']);var _0x1bd7a4=util[_0xbbc4('0x50')](_0xbbc4('0x5b'),_0x341f6d['remoteUri']);_0x56ea6d['userEmail']=!_[_0xbbc4('0x5c')](_0x667f36)?_0x667f36[_0xbbc4('0x5d')]:null;_0x56ea6d[_0xbbc4('0x19')]=_0x341f6d['email'];_0x56ea6d[_0xbbc4('0x1f')]=_0x50720f[_0xbbc4('0x30')]()===_0xbbc4('0x5e')?_0x50c5ff[_0xbbc4('0x5f')]:_0x50c5ff[_0xbbc4('0x60')];_0x56ea6d[_0xbbc4('0x61')]=_0x50720f===_0xbbc4('0x62')||_0x50720f===_0xbbc4('0x63')?_0xbbc4('0x62'):'outbound';var _0xeac359=util[_0xbbc4('0x50')](_0xbbc4('0x64'),_0x341f6d[_0xbbc4('0x5a')],_0x50c5ff[_0xbbc4('0x65')],md5(_0x50c5ff['uniqueid']));if(_0x4435f8&&_0x4435f8[_0xbbc4('0x66')]){logger['info']('[QUEUE]',_0xbbc4('0x67'));_0x50c5ff[_0xbbc4('0x68')]=_0xeac359;}else if(_0x46eccb&&_0x46eccb[_0xbbc4('0x69')]&&_0x46eccb[_0xbbc4('0x69')]!==_0xbbc4('0x6a')){logger[_0xbbc4('0xe')](_0xbbc4('0x6b'),_0xbbc4('0x67'));_0x50c5ff['recordingURL']=_0xeac359;}else{_0x50c5ff[_0xbbc4('0x68')]='';}return getAdminUser(_0x50720f,_0x39f183,_0x56ea6d,_0x1bd7a4,_0x20d0f8,_0x40b4be)[_0xbbc4('0xa')](getUser(_0x50720f,_0x39f183,_0x1bd7a4,_0x20d0f8,_0x40b4be))[_0xbbc4('0xa')](getEndUser(_0x50720f,_0x39f183,_0x1bd7a4,_0x20d0f8,_0x40b4be))[_0xbbc4('0xa')](getTicket(_0x50720f,_0x39f183,_0x1bd7a4,_0x2b6201,_0x50c5ff,_0x20d0f8))['then'](function(_0x521b22){logger['info'](util['format'](_0xbbc4('0x6c'),_0x521b22[_0xbbc4('0x3e')]));logger[_0xbbc4('0xe')](util[_0xbbc4('0x50')]('call\x20direction:\x20%s',_0x50720f));if(_0x50720f!=='unmanaged'){logger[_0xbbc4('0xe')]('['+[_0x50720f[_0xbbc4('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x341f6d[_0xbbc4('0x58')],_0x667f36[_0xbbc4('0x34')],_0x521b22[_0xbbc4('0x3e')]);}})[_0xbbc4('0x1b')](function(_0x2ac8ca){logger[_0xbbc4('0x11')]('['+[_0x50720f[_0xbbc4('0xf')]()]+_0xbbc4('0x6d'),util['inspect'](_0x2ac8ca,{'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 91a22ad..3d33c59 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 _0xea1e=['Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','set_entry','first_name','','debug','merge','map','forEach','type','string','nameField','content','custom_fields','variable','customVariable','Variable','customField','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','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...','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','destcalleridname','destcalleridnum','Fields','Outbound','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','lastevent','lodash','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','getString','Subjects','assigned_user_id','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','parent_name','name','direction','push','idField','variableName','JSON','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','info'];(function(_0x5cbbd7,_0x458913){var _0x355b19=function(_0x373f5c){while(--_0x373f5c){_0x5cbbd7['push'](_0x5cbbd7['shift']());}};_0x355b19(++_0x458913);}(_0xea1e,0x137));var _0xeea1=function(_0x8b6835,_0x1e5c84){_0x8b6835=_0x8b6835-0x0;var _0x2f8294=_0xea1e[_0x8b6835];return _0x2f8294;};'use strict';var _=require(_0xeea1('0x0'));var rp=require('request-promise');var BPromise=require(_0xeea1('0x1'));var md5=require(_0xeea1('0x2'));var util=require(_0xeea1('0x3'));var Redis=require(_0xeea1('0x4'));var intUtil=require('./util');var config=require(_0xeea1('0x5'));var logger=require('../../../../config/logger')(_0xeea1('0x6'));config[_0xeea1('0x7')]=_[_0xeea1('0x8')](config[_0xeea1('0x7')],{'host':_0xeea1('0x9'),'port':0x18eb});var io=require(_0xeea1('0xa'))(new Redis(config[_0xeea1('0x7')]));var def={'method':_0xeea1('0xb'),'json':!![]};function emit(_0x372d06,_0x551476,_0x45cd2c){io['to'](_0x372d06)['emit'](_0x551476,_0x45cd2c);}function getTicket(_0x52efbb,_0x1b3e6b,_0x1e5215,_0x540a7d,_0x569bb4,_0x1ac229,_0x3c3505,_0x646b23){logger['info']('Creating\x20new\x20ticket...');var _0x6c06fa=new Date();var _0xd8b1eb=[{'name':'name','value':intUtil[_0xeea1('0xc')](_0x540a7d[_0xeea1('0xd')],_0x569bb4,'\x20')},{'name':_0xeea1('0xe'),'value':_0x1b3e6b['id']},{'name':'created_by','value':_0x1b3e6b['id']},{'name':_0xeea1('0xf'),'value':intUtil[_0xeea1('0xc')](_0x540a7d['Descriptions'],_0x569bb4,'\x0a')},{'name':_0xeea1('0x10'),'value':_0x6c06fa[_0xeea1('0x11')]()[_0xeea1('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0xeea1('0x13'),'value':'0'},{'name':_0xeea1('0x14'),'value':'15'},{'name':'parent_id','value':_0x1e5215['id']},{'name':_0xeea1('0x15'),'value':'Contacts'},{'name':_0xeea1('0x16'),'value':_0x1e5215[_0xeea1('0x17')]},{'name':_0xeea1('0x18'),'value':_0x646b23}];if(_0x1ac229['length']){_['forEach'](_0x1ac229,function(_0xa6a856){if(_0x569bb4[_0xa6a856['variableName']]){_0xd8b1eb[_0xeea1('0x19')]({'name':_0xa6a856[_0xeea1('0x1a')],'value':_0x569bb4[_0xa6a856[_0xeea1('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xeea1('0x1c'),'response_type':_0xeea1('0x1c'),'rest_data':JSON['stringify']({'session':_0x3c3505['id'],'module_name':'Calls','name_value_list':_0xd8b1eb})}});}function getAuth(_0x1a7480){return util[_0xeea1('0x1d')](_0xeea1('0x1e'),new Buffer(_0x1a7480[_0xeea1('0x1f')]+':X')[_0xeea1('0x20')]('base64'));}function getServerInfo(_0x57ae98){return request({'form':{'method':_0xeea1('0x21'),'input_type':_0xeea1('0x1c'),'response_type':'JSON','rest_data':JSON[_0xeea1('0x22')]({'session':_0x57ae98['id']})}});}function getUser(_0x210cb4,_0x28ad83,_0x18da13){if(!_[_0xeea1('0x23')](_0x28ad83)){logger[_0xeea1('0x24')](_0xeea1('0x25'),_0x28ad83);return request({'form':{'method':'get_entry_list','input_type':_0xeea1('0x1c'),'response_type':_0xeea1('0x1c'),'rest_data':JSON[_0xeea1('0x22')]({'session':_0x18da13['id'],'module_name':'Employees','query':util[_0xeea1('0x1d')](_0xeea1('0x26'),_0x28ad83),'order_by':'','offset':'0','select_fields':['id','name',_0xeea1('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeea1('0x28')](function(_0x1c6975){if(_0x1c6975[_0xeea1('0x29')][_0xeea1('0x2a')]){var _0x7b20f5=_[_0xeea1('0x2b')](_0x1c6975[_0xeea1('0x29')],function(_0x508aae){return _0x508aae[_0xeea1('0x2c')][_0xeea1('0x27')][_0xeea1('0x2d')]===_0x28ad83;});if(_0x7b20f5){logger[_0xeea1('0x24')](_0xeea1('0x2e'));return BPromise[_0xeea1('0x2f')]({'id':_0x7b20f5['name_value_list']['id'][_0xeea1('0x2d')],'name':_0x7b20f5[_0xeea1('0x2c')][_0xeea1('0x17')][_0xeea1('0x2d')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x18da13[_0xeea1('0x2c')][_0xeea1('0x30')]['value'],'name':_0x18da13['name_value_list'][_0xeea1('0x27')][_0xeea1('0x2d')]});});}else{logger[_0xeea1('0x24')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xeea1('0x2f')]({'id':_0x18da13['name_value_list'][_0xeea1('0x30')][_0xeea1('0x2d')],'name':_0x18da13[_0xeea1('0x2c')][_0xeea1('0x27')][_0xeea1('0x2d')]});}}function getEndUser(_0x3fb17a,_0x4c0e9e,_0x1af22e,_0x2411d1){logger['info'](_0xeea1('0x31'),_0x1af22e);return request({'form':{'method':_0xeea1('0x32'),'input_type':_0xeea1('0x1c'),'response_type':_0xeea1('0x1c'),'rest_data':JSON['stringify']({'session':_0x2411d1['id'],'module_name':_0xeea1('0x33'),'query':util[_0xeea1('0x1d')](_0xeea1('0x34'),_0x1af22e),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeea1('0x28')](function(_0x291641){if(_0x291641['entry_list']['length']){var _0x303a64=_[_0xeea1('0x2b')](_0x291641[_0xeea1('0x29')],function(_0x12f05a){return _0x12f05a[_0xeea1('0x2c')][_0xeea1('0x35')][_0xeea1('0x2d')]===_0x1af22e;});if(_0x303a64){logger[_0xeea1('0x24')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x303a64[_0xeea1('0x2c')]['id'][_0xeea1('0x2d')],'name':_0x303a64['name_value_list'][_0xeea1('0x17')][_0xeea1('0x2d')],'phone':_0x303a64[_0xeea1('0x2c')][_0xeea1('0x35')][_0xeea1('0x2d')]});}}else{logger[_0xeea1('0x24')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xeea1('0x36'),'input_type':_0xeea1('0x1c'),'response_type':_0xeea1('0x1c'),'rest_data':JSON[_0xeea1('0x22')]({'session':_0x2411d1['id'],'module_name':'Contacts','name_value_list':[{'name':_0xeea1('0x37'),'value':_0x4c0e9e!==_0xeea1('0x38')?_0x4c0e9e:util[_0xeea1('0x1d')]('Caller\x20-\x20%s',_0x1af22e)},{'name':'phone_home','value':_0x1af22e}]})}})[_0xeea1('0x28')](function(_0x4ea738){logger[_0xeea1('0x24')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x4ea738['id'],'name':_0x4ea738['entry_list'][_0xeea1('0x37')][_0xeea1('0x2d')],'phone':_0x4ea738[_0xeea1('0x29')][_0xeea1('0x35')]['value']});});}});}function request(_0x2745eb){logger[_0xeea1('0x39')]('[HTTP]',JSON[_0xeea1('0x22')](_0x2745eb));return rp(_[_0xeea1('0x3a')](def,_0x2745eb));}function getTags(_0x2d170c,_0x44b22a){var _0x5a61f1=[];if(_0x2d170c&&_0x2d170c[_0xeea1('0x2a')]>0x0){_0x5a61f1=_[_0xeea1('0x3b')](_0x2d170c,_0x44b22a);}return _0x5a61f1;}function getCustomFields(_0x68cddb,_0x59b21c){var _0x5ba1f0=[];var _0x172859={'custom_fields':[]};if(_0x68cddb[_0xeea1('0x2a')]>0x0){_[_0xeea1('0x3c')](_0x68cddb,function(_0x4085fa){if(_0x4085fa[_0xeea1('0x3d')]===_0xeea1('0x3e')&&_0x4085fa['nameField']&&!_0x4085fa['customField']){_0x172859[_0x4085fa[_0xeea1('0x3f')]['toLowerCase']()]=_0x4085fa[_0xeea1('0x40')][_0xeea1('0x20')]();}else if(_0x4085fa[_0xeea1('0x3d')]===_0xeea1('0x3e')&&_0x4085fa[_0xeea1('0x1a')]&&_0x4085fa['customField']){_0x172859[_0xeea1('0x41')][_0xeea1('0x19')]({'id':_0x4085fa[_0xeea1('0x1a')],'value':_0x4085fa['content'][_0xeea1('0x20')]()});}else if(_0x4085fa[_0xeea1('0x3d')]===_0xeea1('0x42')&&_0x4085fa[_0xeea1('0x1b')]&&_0x4085fa[_0xeea1('0x1a')]&&_0x4085fa['customField']){_0x59b21c[_0x4085fa[_0xeea1('0x1b')]]&&_0x172859[_0xeea1('0x41')][_0xeea1('0x19')]({'id':_0x4085fa[_0xeea1('0x1a')],'value':_0x59b21c[_0x4085fa[_0xeea1('0x1b')]][_0xeea1('0x20')]()});}else if(_0x4085fa['type']===_0xeea1('0x43')&&_0x4085fa[_0xeea1('0x44')]&&_0x4085fa[_0xeea1('0x44')][_0xeea1('0x17')]&&_0x4085fa['idField']&&_0x4085fa[_0xeea1('0x45')]){_0x59b21c[_0x4085fa['Variable'][_0xeea1('0x17')][_0xeea1('0x46')]()]&&_0x172859['custom_fields'][_0xeea1('0x19')]({'id':_0x4085fa[_0xeea1('0x1a')],'value':_0x59b21c[_0x4085fa[_0xeea1('0x44')][_0xeea1('0x17')][_0xeea1('0x46')]()][_0xeea1('0x20')]()});}});}return _0x172859;}function getConnection(_0x486419){return request({'method':_0xeea1('0xb'),'form':{'method':_0xeea1('0x47'),'input_type':_0xeea1('0x1c'),'response_type':'JSON','rest_data':JSON[_0xeea1('0x22')]({'user_auth':{'user_name':_0x486419[_0xeea1('0x48')],'password':_0x486419[_0xeea1('0x49')],'encryption':_0xeea1('0x4a')},'application':_0xeea1('0x4b')})}})[_0xeea1('0x28')](function(_0x25bad0){var _0x2a52a7=_0x25bad0;if(_0x2a52a7['id']){def[_0xeea1('0x4c')]=_0x2a52a7['id'];return BPromise[_0xeea1('0x2f')](_0x2a52a7);}else{throw new Error(util[_0xeea1('0x1d')](_0xeea1('0x4d'),_0x486419['id']));}});}function setRelationship(_0x1690e2,_0x1b7855,_0xf05e88,_0x102897){return request({'form':{'method':_0xeea1('0x4e'),'input_type':_0xeea1('0x1c'),'response_type':_0xeea1('0x1c'),'rest_data':JSON['stringify']({'session':_0x1690e2['id'],'module_name':'Calls','module_id':_0xf05e88['id'],'link_field_name':_0x102897,'related_ids':[_0x1b7855['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x467660,_0x310a1e,_0x29abb3,_0x1df9a7,_0x5c2961,_0x6631da){var _0x4ed2d3,_0x4700e4,_0x3eeaf9,_0x27da2c;_0x6631da[_0xeea1('0x4f')]=intUtil[_0xeea1('0x50')](_0x6631da[_0xeea1('0x4f')]);_0x6631da[_0xeea1('0x51')]=intUtil['stripTrailingSlash'](_0x6631da[_0xeea1('0x51')]);def[_0xeea1('0x52')]=util[_0xeea1('0x1d')]('%s/service/v4_1/rest.php',_0x6631da['remoteUri']);if(_0x5c2961&&_0x5c2961[_0xeea1('0x53')]){logger[_0xeea1('0x24')](_0xeea1('0x54'),_0xeea1('0x55'));_0x310a1e[_0xeea1('0x56')]=util[_0xeea1('0x1d')](_0xeea1('0x57'),_0x6631da[_0xeea1('0x51')],_0x310a1e['uniqueid'],md5(_0x310a1e[_0xeea1('0x58')]));}else{_0x310a1e[_0xeea1('0x56')]='';}return getConnection(_0x6631da)[_0xeea1('0x28')](function(_0x2bf147){_0x27da2c=_0x2bf147;return getUser(_0x6631da,_0x1df9a7[_0xeea1('0x17')],_0x27da2c);})[_0xeea1('0x28')](function(_0x1c7ffd){_0x4ed2d3=_0x1c7ffd;logger[_0xeea1('0x24')](_0xeea1('0x59'),_0x4ed2d3['id']);return getEndUser(_0x6631da,_0x310a1e[_0xeea1('0x5a')],_0x310a1e['calleridnum'],_0x27da2c);})[_0xeea1('0x28')](function(_0x1b9169){_0x4700e4=_0x1b9169;logger[_0xeea1('0x24')]('The\x20Enduser\x20ID\x20is:',_0x4700e4['id']);return getTicket(_0x6631da,_0x4ed2d3,_0x4700e4,_0x29abb3,_0x310a1e,_0x29abb3['Fields'],_0x27da2c,_0xeea1('0x5b'));})[_0xeea1('0x28')](function(_0x2fd4f2){_0x3eeaf9=_0x2fd4f2;logger['info'](_0xeea1('0x5c'));logger['info'](_0xeea1('0x5d'),_0x3eeaf9['id']);return setRelationship(_0x27da2c,_0x4ed2d3,_0x3eeaf9,_0xeea1('0x5e'));})[_0xeea1('0x28')](function(){return setRelationship(_0x27da2c,_0x4700e4,_0x3eeaf9,_0xeea1('0x5f'));})[_0xeea1('0x28')](function(){return getServerInfo(_0x27da2c);})[_0xeea1('0x28')](function(_0x2ec5b0){var _0x4d7b89=parseInt(_0x2ec5b0[_0xeea1('0x60')][_0xeea1('0x61')](0x0));var _0x3f55fc=util['format'](_0xeea1('0x62'),_0x6631da[_0xeea1('0x4f')],_0x3eeaf9['id']);if(_0x4d7b89>0x6){_0x3f55fc=util[_0xeea1('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x6631da[_0xeea1('0x4f')],_0x3eeaf9['id']);}logger[_0xeea1('0x24')](_0xeea1('0x54'),_0xeea1('0x63'));emit(util[_0xeea1('0x1d')]('user:%s',_0x1df9a7[_0xeea1('0x17')]),_0xeea1('0x64'),{'uri':_0x3f55fc});})[_0xeea1('0x65')](function(_0x3e0a4c){logger[_0xeea1('0x66')]('[QUEUE]',JSON[_0xeea1('0x22')](_0x3e0a4c));});};exports[_0xeea1('0x67')]=function(_0x19f344,_0x4c6c61,_0x2b9ef8,_0x51ca41,_0x532fe0,_0x1a25d7,_0x3e0c3f){var _0xc38bc9,_0x3a202b,_0x1d7b34,_0x284010;_0x1a25d7['remoteUri']=intUtil['stripTrailingSlash'](_0x1a25d7['remoteUri']);_0x1a25d7[_0xeea1('0x51')]=intUtil[_0xeea1('0x50')](_0x1a25d7[_0xeea1('0x51')]);def[_0xeea1('0x52')]=util[_0xeea1('0x1d')](_0xeea1('0x68'),_0x1a25d7[_0xeea1('0x4f')]);if(_0x3e0c3f&&_0x3e0c3f[_0xeea1('0x69')]&&_0x3e0c3f[_0xeea1('0x69')]!=='none'){logger[_0xeea1('0x24')]('[OUTBOUND]',_0xeea1('0x55'));_0x4c6c61[_0xeea1('0x56')]=util[_0xeea1('0x1d')](_0xeea1('0x57'),_0x1a25d7[_0xeea1('0x51')],_0x4c6c61[_0xeea1('0x58')],md5(_0x4c6c61[_0xeea1('0x58')]));}return getConnection(_0x1a25d7)['then'](function(_0x49276e){_0x284010=_0x49276e;return getUser(_0x1a25d7,_0x51ca41[_0xeea1('0x17')],_0x284010);})[_0xeea1('0x28')](function(_0x5827a9){_0xc38bc9=_0x5827a9;logger[_0xeea1('0x24')](_0xeea1('0x59'),_0xc38bc9['id']);return getEndUser(_0x1a25d7,_0x4c6c61[_0xeea1('0x6a')],_0x4c6c61[_0xeea1('0x6b')],_0x284010);})[_0xeea1('0x28')](function(_0x2f8f5d){_0x3a202b=_0x2f8f5d;logger[_0xeea1('0x24')]('The\x20Enduser\x20ID\x20is:',_0x3a202b['id']);return getTicket(_0x1a25d7,_0xc38bc9,_0x3a202b,_0x2b9ef8,_0x4c6c61,_0x2b9ef8[_0xeea1('0x6c')],_0x284010,_0xeea1('0x6d'));})['then'](function(_0x1eadf2){_0x1d7b34=_0x1eadf2;logger[_0xeea1('0x24')](_0xeea1('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1d7b34['id']);return setRelationship(_0x284010,_0xc38bc9,_0x1d7b34,_0xeea1('0x5e'));})[_0xeea1('0x28')](function(){return setRelationship(_0x284010,_0x3a202b,_0x1d7b34,_0xeea1('0x5f'));})['then'](function(){return getServerInfo(_0x284010);})['then'](function(_0x4f05c7){var _0x3e54be=parseInt(_0x4f05c7['version'][_0xeea1('0x61')](0x0));var _0x18f2b7=util[_0xeea1('0x1d')](_0xeea1('0x62'),_0x1a25d7[_0xeea1('0x4f')],_0x1d7b34['id']);if(_0x3e54be>0x6){_0x18f2b7=util[_0xeea1('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1a25d7['remoteUri'],_0x1d7b34['id']);}logger[_0xeea1('0x24')](_0xeea1('0x6e'),_0xeea1('0x63'));emit(util[_0xeea1('0x1d')]('user:%s',_0x51ca41[_0xeea1('0x17')]),_0xeea1('0x64'),{'uri':_0x18f2b7});})[_0xeea1('0x65')](function(_0x5b9256){logger[_0xeea1('0x66')](_0xeea1('0x6e'),JSON['stringify'](_0x5b9256));});};exports[_0xeea1('0x6f')]=function(_0x22f152,_0x39cf23,_0x3a207c,_0xcd55e1,_0x53edec,_0x351f65){var _0x2a2611,_0x969384,_0x337ca3,_0x82726e;_0x351f65['remoteUri']=intUtil[_0xeea1('0x50')](_0x351f65['remoteUri']);_0x351f65[_0xeea1('0x51')]=intUtil[_0xeea1('0x50')](_0x351f65['serverUrl']);def[_0xeea1('0x52')]=util[_0xeea1('0x1d')]('%s/service/v4_1/rest.php',_0x351f65[_0xeea1('0x4f')]);if(_0x53edec&&_0x53edec[_0xeea1('0x53')]){logger[_0xeea1('0x24')]('['+_0x39cf23['lastevent'][_0xeea1('0x70')]()+']',_0xeea1('0x55'));_0x39cf23['recordingURL']=util[_0xeea1('0x1d')](_0xeea1('0x57'),_0x351f65['serverUrl'],_0x39cf23[_0xeea1('0x58')],md5(_0x39cf23[_0xeea1('0x58')]));}else{_0x39cf23[_0xeea1('0x56')]='';}return getConnection(_0x351f65)[_0xeea1('0x28')](function(_0x456ade){_0x82726e=_0x456ade;if(!_[_0xeea1('0x23')](_0xcd55e1)){return getUser(_0x351f65,_0xcd55e1['name'],_0x82726e);}else{return getUser(_0x351f65,null,_0x82726e);}})['then'](function(_0x27995d){_0x2a2611=_0x27995d;logger[_0xeea1('0x24')](_0xeea1('0x59'),_0x2a2611['id']);return getEndUser(_0x351f65,_0x39cf23[_0xeea1('0x5a')],_0x39cf23[_0xeea1('0x71')],_0x82726e);})['then'](function(_0x142bda){_0x969384=_0x142bda;logger[_0xeea1('0x24')](_0xeea1('0x72'),_0x969384['id']);return getTicket(_0x351f65,_0x2a2611,_0x969384,_0x3a207c,_0x39cf23,_0x3a207c[_0xeea1('0x6c')],_0x82726e,'Inbound');})['then'](function(_0xf6f2ff){_0x337ca3=_0xf6f2ff;logger[_0xeea1('0x24')](_0xeea1('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x337ca3['id']);return setRelationship(_0x82726e,_0x2a2611,_0x337ca3,'users');})[_0xeea1('0x28')](function(){return setRelationship(_0x82726e,_0x969384,_0x337ca3,_0xeea1('0x5f'));})['then'](function(){return getServerInfo(_0x82726e);})[_0xeea1('0x65')](function(_0x4b89ee){logger[_0xeea1('0x66')]('['+_0x39cf23[_0xeea1('0x73')][_0xeea1('0x70')]()+']',JSON['stringify'](_0x4b89ee));});}; \ No newline at end of file +var _0xb6ed=['request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','debug','[HTTP]','map','nameField','customField','toLowerCase','type','string','variable','custom_fields','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','error','uri','lastevent','Ticket\x20created!','toUpperCase','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb6ed,0x76));var _0xdb6e=function(_0x22c294,_0x1acc65){_0x22c294=_0x22c294-0x0;var _0x30d528=_0xb6ed[_0x22c294];return _0x30d528;};'use strict';var _=require(_0xdb6e('0x0'));var rp=require(_0xdb6e('0x1'));var BPromise=require(_0xdb6e('0x2'));var md5=require(_0xdb6e('0x3'));var util=require(_0xdb6e('0x4'));var Redis=require('ioredis');var intUtil=require(_0xdb6e('0x5'));var config=require(_0xdb6e('0x6'));var logger=require(_0xdb6e('0x7'))(_0xdb6e('0x8'));config['redis']=_[_0xdb6e('0x9')](config[_0xdb6e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xdb6e('0xb'))(new Redis(config[_0xdb6e('0xa')]));var def={'method':'POST','json':!![]};function emit(_0xa8e6b7,_0xdde14d,_0x386a6f){io['to'](_0xa8e6b7)[_0xdb6e('0xc')](_0xdde14d,_0x386a6f);}function getTicket(_0x4ea941,_0x3eedc6,_0xecb65,_0x522911,_0x308812,_0x4fc3a0,_0x2d67cc,_0x4ae229){logger[_0xdb6e('0xd')](_0xdb6e('0xe'));var _0x442653=new Date();var _0x3fc893=[{'name':_0xdb6e('0xf'),'value':intUtil[_0xdb6e('0x10')](_0x522911[_0xdb6e('0x11')],_0x308812,'\x20')},{'name':_0xdb6e('0x12'),'value':_0x3eedc6['id']},{'name':_0xdb6e('0x13'),'value':_0x3eedc6['id']},{'name':'description','value':intUtil[_0xdb6e('0x10')](_0x522911[_0xdb6e('0x14')],_0x308812,'\x0a')},{'name':_0xdb6e('0x15'),'value':_0x442653[_0xdb6e('0x16')]()[_0xdb6e('0x17')](0x0,0x13)[_0xdb6e('0x18')]('T','\x20')},{'name':_0xdb6e('0x19'),'value':'0'},{'name':_0xdb6e('0x1a'),'value':'15'},{'name':_0xdb6e('0x1b'),'value':_0xecb65['id']},{'name':_0xdb6e('0x1c'),'value':'Contacts'},{'name':_0xdb6e('0x1d'),'value':_0xecb65['name']},{'name':'direction','value':_0x4ae229}];if(_0x4fc3a0[_0xdb6e('0x1e')]){_[_0xdb6e('0x1f')](_0x4fc3a0,function(_0x3526d3){if(_0x308812[_0x3526d3[_0xdb6e('0x20')]]){_0x3fc893[_0xdb6e('0x21')]({'name':_0x3526d3[_0xdb6e('0x22')],'value':_0x308812[_0x3526d3[_0xdb6e('0x20')]]});}});}return request({'form':{'method':_0xdb6e('0x23'),'input_type':_0xdb6e('0x24'),'response_type':'JSON','rest_data':JSON[_0xdb6e('0x25')]({'session':_0x2d67cc['id'],'module_name':_0xdb6e('0x26'),'name_value_list':_0x3fc893})}});}function getAuth(_0x1d565e){return util[_0xdb6e('0x27')](_0xdb6e('0x28'),new Buffer(_0x1d565e['apiKey']+':X')[_0xdb6e('0x29')](_0xdb6e('0x2a')));}function getServerInfo(_0xb1bad9){return request({'form':{'method':'get_server_info','input_type':_0xdb6e('0x24'),'response_type':_0xdb6e('0x24'),'rest_data':JSON['stringify']({'session':_0xb1bad9['id']})}});}function getUser(_0x3c61a6,_0x3b4fbd,_0x538dc2){if(!_[_0xdb6e('0x2b')](_0x3b4fbd)){logger['info'](_0xdb6e('0x2c'),_0x3b4fbd);return request({'form':{'method':_0xdb6e('0x2d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xdb6e('0x25')]({'session':_0x538dc2['id'],'module_name':'Employees','query':util[_0xdb6e('0x27')](_0xdb6e('0x2e'),_0x3b4fbd),'order_by':'','offset':'0','select_fields':['id',_0xdb6e('0xf'),_0xdb6e('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdb6e('0x30')](function(_0x219dce){if(_0x219dce[_0xdb6e('0x31')][_0xdb6e('0x1e')]){var _0x25ef0b=_[_0xdb6e('0x32')](_0x219dce[_0xdb6e('0x31')],function(_0x24c616){return _0x24c616[_0xdb6e('0x33')][_0xdb6e('0x2f')]['value']===_0x3b4fbd;});if(_0x25ef0b){logger['info'](_0xdb6e('0x34'));return BPromise[_0xdb6e('0x35')]({'id':_0x25ef0b[_0xdb6e('0x33')]['id'][_0xdb6e('0x36')],'name':_0x25ef0b[_0xdb6e('0x33')]['name'][_0xdb6e('0x36')]});}}logger[_0xdb6e('0xd')](_0xdb6e('0x37'));return BPromise[_0xdb6e('0x35')]({'id':_0x538dc2[_0xdb6e('0x33')][_0xdb6e('0x38')]['value'],'name':_0x538dc2[_0xdb6e('0x33')]['user_name'][_0xdb6e('0x36')]});});}else{logger[_0xdb6e('0xd')](_0xdb6e('0x39'));return BPromise[_0xdb6e('0x35')]({'id':_0x538dc2[_0xdb6e('0x33')][_0xdb6e('0x38')][_0xdb6e('0x36')],'name':_0x538dc2[_0xdb6e('0x33')][_0xdb6e('0x2f')]['value']});}}function getEndUser(_0x5a866c,_0x43809d,_0x15548a,_0x1fa0b9){logger[_0xdb6e('0xd')]('Searching\x20enduser\x20with\x20phone',_0x15548a);return request({'form':{'method':_0xdb6e('0x2d'),'input_type':'JSON','response_type':_0xdb6e('0x24'),'rest_data':JSON[_0xdb6e('0x25')]({'session':_0x1fa0b9['id'],'module_name':_0xdb6e('0x3a'),'query':util[_0xdb6e('0x27')](_0xdb6e('0x3b'),_0x15548a),'order_by':'','offset':'0','select_fields':['id',_0xdb6e('0xf'),_0xdb6e('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdb6e('0x30')](function(_0x256d7f){if(_0x256d7f[_0xdb6e('0x31')][_0xdb6e('0x1e')]){var _0x189a85=_['find'](_0x256d7f[_0xdb6e('0x31')],function(_0x2aeb4f){return _0x2aeb4f['name_value_list'][_0xdb6e('0x3c')]['value']===_0x15548a;});if(_0x189a85){logger['info'](_0xdb6e('0x3d'));return BPromise[_0xdb6e('0x35')]({'id':_0x189a85[_0xdb6e('0x33')]['id']['value'],'name':_0x189a85['name_value_list']['name'][_0xdb6e('0x36')],'phone':_0x189a85[_0xdb6e('0x33')]['phone_home'][_0xdb6e('0x36')]});}}else{logger[_0xdb6e('0xd')](_0xdb6e('0x3e'));return request({'form':{'method':_0xdb6e('0x23'),'input_type':_0xdb6e('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1fa0b9['id'],'module_name':_0xdb6e('0x3a'),'name_value_list':[{'name':'first_name','value':_0x43809d!==_0xdb6e('0x3f')?_0x43809d:util[_0xdb6e('0x27')]('Caller\x20-\x20%s',_0x15548a)},{'name':_0xdb6e('0x3c'),'value':_0x15548a}]})}})[_0xdb6e('0x30')](function(_0x36d398){logger[_0xdb6e('0xd')](_0xdb6e('0x40'));return BPromise[_0xdb6e('0x35')]({'id':_0x36d398['id'],'name':_0x36d398[_0xdb6e('0x31')]['first_name']['value'],'phone':_0x36d398[_0xdb6e('0x31')][_0xdb6e('0x3c')][_0xdb6e('0x36')]});});}});}function request(_0x239705){logger[_0xdb6e('0x41')](_0xdb6e('0x42'),JSON[_0xdb6e('0x25')](_0x239705));return rp(_['merge'](def,_0x239705));}function getTags(_0x57db01,_0x4e8a89){var _0x2da020=[];if(_0x57db01&&_0x57db01[_0xdb6e('0x1e')]>0x0){_0x2da020=_[_0xdb6e('0x43')](_0x57db01,_0x4e8a89);}return _0x2da020;}function getCustomFields(_0x1aa796,_0x4de0e6){var _0x5ae67a=[];var _0x443498={'custom_fields':[]};if(_0x1aa796[_0xdb6e('0x1e')]>0x0){_['forEach'](_0x1aa796,function(_0xeca378){if(_0xeca378['type']==='string'&&_0xeca378[_0xdb6e('0x44')]&&!_0xeca378[_0xdb6e('0x45')]){_0x443498[_0xeca378[_0xdb6e('0x44')][_0xdb6e('0x46')]()]=_0xeca378['content'][_0xdb6e('0x29')]();}else if(_0xeca378[_0xdb6e('0x47')]===_0xdb6e('0x48')&&_0xeca378[_0xdb6e('0x22')]&&_0xeca378[_0xdb6e('0x45')]){_0x443498['custom_fields']['push']({'id':_0xeca378[_0xdb6e('0x22')],'value':_0xeca378['content']['toString']()});}else if(_0xeca378[_0xdb6e('0x47')]===_0xdb6e('0x49')&&_0xeca378['variableName']&&_0xeca378['idField']&&_0xeca378[_0xdb6e('0x45')]){_0x4de0e6[_0xeca378[_0xdb6e('0x20')]]&&_0x443498[_0xdb6e('0x4a')][_0xdb6e('0x21')]({'id':_0xeca378[_0xdb6e('0x22')],'value':_0x4de0e6[_0xeca378[_0xdb6e('0x20')]]['toString']()});}else if(_0xeca378['type']===_0xdb6e('0x4b')&&_0xeca378[_0xdb6e('0x4c')]&&_0xeca378[_0xdb6e('0x4c')][_0xdb6e('0xf')]&&_0xeca378[_0xdb6e('0x22')]&&_0xeca378['customField']){_0x4de0e6[_0xeca378['Variable'][_0xdb6e('0xf')][_0xdb6e('0x46')]()]&&_0x443498[_0xdb6e('0x4a')]['push']({'id':_0xeca378[_0xdb6e('0x22')],'value':_0x4de0e6[_0xeca378[_0xdb6e('0x4c')][_0xdb6e('0xf')][_0xdb6e('0x46')]()][_0xdb6e('0x29')]()});}});}return _0x443498;}function getConnection(_0x845da){return request({'method':_0xdb6e('0x4d'),'form':{'method':_0xdb6e('0x4e'),'input_type':'JSON','response_type':_0xdb6e('0x24'),'rest_data':JSON[_0xdb6e('0x25')]({'user_auth':{'user_name':_0x845da[_0xdb6e('0x4f')],'password':_0x845da[_0xdb6e('0x50')],'encryption':'PLAIN'},'application':_0xdb6e('0x51')})}})[_0xdb6e('0x30')](function(_0xe2562d){var _0x5e138a=_0xe2562d;if(_0x5e138a['id']){def['sessionID']=_0x5e138a['id'];return BPromise[_0xdb6e('0x35')](_0x5e138a);}else{throw new Error(util[_0xdb6e('0x27')](_0xdb6e('0x52'),_0x845da['id']));}});}function setRelationship(_0x34ccce,_0x55331f,_0x3d5489,_0x3afb55){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xdb6e('0x24'),'rest_data':JSON[_0xdb6e('0x25')]({'session':_0x34ccce['id'],'module_name':_0xdb6e('0x26'),'module_id':_0x3d5489['id'],'link_field_name':_0x3afb55,'related_ids':[_0x55331f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xdb6e('0x53')]=function(_0x58795c,_0x290faa,_0x244811,_0x1905c4,_0x48b861,_0x11f16c){var _0x8867ca,_0x417ded,_0x40d435,_0x4bff78;_0x11f16c[_0xdb6e('0x54')]=intUtil['stripTrailingSlash'](_0x11f16c[_0xdb6e('0x54')]);_0x11f16c[_0xdb6e('0x55')]=intUtil[_0xdb6e('0x56')](_0x11f16c[_0xdb6e('0x55')]);def['uri']=util['format'](_0xdb6e('0x57'),_0x11f16c[_0xdb6e('0x54')]);if(_0x48b861&&_0x48b861[_0xdb6e('0x58')]){logger[_0xdb6e('0xd')](_0xdb6e('0x59'),_0xdb6e('0x5a'));_0x290faa[_0xdb6e('0x5b')]=util[_0xdb6e('0x27')](_0xdb6e('0x5c'),_0x11f16c[_0xdb6e('0x55')],_0x290faa[_0xdb6e('0x5d')],md5(_0x290faa[_0xdb6e('0x5d')]));}else{_0x290faa[_0xdb6e('0x5b')]='';}return getConnection(_0x11f16c)[_0xdb6e('0x30')](function(_0x469359){_0x4bff78=_0x469359;return getUser(_0x11f16c,_0x1905c4['name'],_0x4bff78);})[_0xdb6e('0x30')](function(_0x6463ac){_0x8867ca=_0x6463ac;logger['info'](_0xdb6e('0x5e'),_0x8867ca['id']);return getEndUser(_0x11f16c,_0x290faa[_0xdb6e('0x5f')],_0x290faa[_0xdb6e('0x60')],_0x4bff78);})[_0xdb6e('0x30')](function(_0x226c27){_0x417ded=_0x226c27;logger['info'](_0xdb6e('0x61'),_0x417ded['id']);return getTicket(_0x11f16c,_0x8867ca,_0x417ded,_0x244811,_0x290faa,_0x244811[_0xdb6e('0x62')],_0x4bff78,'Inbound');})[_0xdb6e('0x30')](function(_0x3c5262){_0x40d435=_0x3c5262;logger[_0xdb6e('0xd')]('Ticket\x20created!');logger['info'](_0xdb6e('0x63'),_0x40d435['id']);return setRelationship(_0x4bff78,_0x8867ca,_0x40d435,_0xdb6e('0x64'));})[_0xdb6e('0x30')](function(){return setRelationship(_0x4bff78,_0x417ded,_0x40d435,_0xdb6e('0x65'));})[_0xdb6e('0x30')](function(){return getServerInfo(_0x4bff78);})[_0xdb6e('0x30')](function(_0x9590b9){var _0x2c82b5=parseInt(_0x9590b9['version'][_0xdb6e('0x66')](0x0));var _0x401035=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x11f16c['remoteUri'],_0x40d435['id']);if(_0x2c82b5>0x6){_0x401035=util[_0xdb6e('0x27')](_0xdb6e('0x67'),_0x11f16c[_0xdb6e('0x54')],_0x40d435['id']);}logger[_0xdb6e('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdb6e('0x27')](_0xdb6e('0x68'),_0x1905c4[_0xdb6e('0xf')]),'trigger:browser:url',{'uri':_0x401035});})[_0xdb6e('0x69')](function(_0x136c78){logger['error'](_0xdb6e('0x59'),JSON[_0xdb6e('0x25')](_0x136c78));});};exports[_0xdb6e('0x6a')]=function(_0x3a94b4,_0x3cab58,_0x5d1464,_0x22aa9a,_0x26ce5c,_0x46a29b,_0x3b9593){var _0x111757,_0x5a8d3f,_0x2f3a0f,_0x47ed37;_0x46a29b[_0xdb6e('0x54')]=intUtil[_0xdb6e('0x56')](_0x46a29b[_0xdb6e('0x54')]);_0x46a29b[_0xdb6e('0x55')]=intUtil[_0xdb6e('0x56')](_0x46a29b[_0xdb6e('0x55')]);def['uri']=util[_0xdb6e('0x27')](_0xdb6e('0x57'),_0x46a29b[_0xdb6e('0x54')]);if(_0x3b9593&&_0x3b9593[_0xdb6e('0x6b')]&&_0x3b9593[_0xdb6e('0x6b')]!==_0xdb6e('0x6c')){logger[_0xdb6e('0xd')](_0xdb6e('0x6d'),'Recording\x20is\x20enabled!');_0x3cab58[_0xdb6e('0x5b')]=util[_0xdb6e('0x27')](_0xdb6e('0x5c'),_0x46a29b['serverUrl'],_0x3cab58['uniqueid'],md5(_0x3cab58[_0xdb6e('0x5d')]));}return getConnection(_0x46a29b)[_0xdb6e('0x30')](function(_0x441158){_0x47ed37=_0x441158;return getUser(_0x46a29b,_0x22aa9a[_0xdb6e('0xf')],_0x47ed37);})[_0xdb6e('0x30')](function(_0x12c35a){_0x111757=_0x12c35a;logger[_0xdb6e('0xd')](_0xdb6e('0x5e'),_0x111757['id']);return getEndUser(_0x46a29b,_0x3cab58[_0xdb6e('0x6e')],_0x3cab58['destcalleridnum'],_0x47ed37);})[_0xdb6e('0x30')](function(_0x5ce344){_0x5a8d3f=_0x5ce344;logger[_0xdb6e('0xd')](_0xdb6e('0x61'),_0x5a8d3f['id']);return getTicket(_0x46a29b,_0x111757,_0x5a8d3f,_0x5d1464,_0x3cab58,_0x5d1464['Fields'],_0x47ed37,_0xdb6e('0x6f'));})[_0xdb6e('0x30')](function(_0x498d73){_0x2f3a0f=_0x498d73;logger[_0xdb6e('0xd')]('Ticket\x20created!');logger[_0xdb6e('0xd')](_0xdb6e('0x63'),_0x2f3a0f['id']);return setRelationship(_0x47ed37,_0x111757,_0x2f3a0f,_0xdb6e('0x64'));})[_0xdb6e('0x30')](function(){return setRelationship(_0x47ed37,_0x5a8d3f,_0x2f3a0f,_0xdb6e('0x65'));})[_0xdb6e('0x30')](function(){return getServerInfo(_0x47ed37);})['then'](function(_0x57752f){var _0x29ed8b=parseInt(_0x57752f['version'][_0xdb6e('0x66')](0x0));var _0x52c43c=util[_0xdb6e('0x27')](_0xdb6e('0x70'),_0x46a29b[_0xdb6e('0x54')],_0x2f3a0f['id']);if(_0x29ed8b>0x6){_0x52c43c=util['format'](_0xdb6e('0x67'),_0x46a29b[_0xdb6e('0x54')],_0x2f3a0f['id']);}logger[_0xdb6e('0xd')](_0xdb6e('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdb6e('0x27')](_0xdb6e('0x68'),_0x22aa9a['name']),_0xdb6e('0x71'),{'uri':_0x52c43c});})[_0xdb6e('0x69')](function(_0x27af91){logger[_0xdb6e('0x72')](_0xdb6e('0x6d'),JSON[_0xdb6e('0x25')](_0x27af91));});};exports['unmanaged']=function(_0x93a303,_0x56f235,_0x107280,_0x571f9d,_0x11d571,_0x11bbcd){var _0x20db99,_0x3b7902,_0x206f65,_0x55997e;_0x11bbcd[_0xdb6e('0x54')]=intUtil['stripTrailingSlash'](_0x11bbcd[_0xdb6e('0x54')]);_0x11bbcd[_0xdb6e('0x55')]=intUtil[_0xdb6e('0x56')](_0x11bbcd[_0xdb6e('0x55')]);def[_0xdb6e('0x73')]=util[_0xdb6e('0x27')](_0xdb6e('0x57'),_0x11bbcd['remoteUri']);if(_0x11d571&&_0x11d571[_0xdb6e('0x58')]){logger[_0xdb6e('0xd')]('['+_0x56f235[_0xdb6e('0x74')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x56f235[_0xdb6e('0x5b')]=util[_0xdb6e('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11bbcd['serverUrl'],_0x56f235[_0xdb6e('0x5d')],md5(_0x56f235['uniqueid']));}else{_0x56f235[_0xdb6e('0x5b')]='';}return getConnection(_0x11bbcd)[_0xdb6e('0x30')](function(_0x1dcb8a){_0x55997e=_0x1dcb8a;if(!_[_0xdb6e('0x2b')](_0x571f9d)){return getUser(_0x11bbcd,_0x571f9d[_0xdb6e('0xf')],_0x55997e);}else{return getUser(_0x11bbcd,null,_0x55997e);}})[_0xdb6e('0x30')](function(_0x22691c){_0x20db99=_0x22691c;logger[_0xdb6e('0xd')](_0xdb6e('0x5e'),_0x20db99['id']);return getEndUser(_0x11bbcd,_0x56f235[_0xdb6e('0x5f')],_0x56f235[_0xdb6e('0x60')],_0x55997e);})['then'](function(_0x53d6f7){_0x3b7902=_0x53d6f7;logger['info'](_0xdb6e('0x61'),_0x3b7902['id']);return getTicket(_0x11bbcd,_0x20db99,_0x3b7902,_0x107280,_0x56f235,_0x107280[_0xdb6e('0x62')],_0x55997e,'Inbound');})[_0xdb6e('0x30')](function(_0x1c4c0f){_0x206f65=_0x1c4c0f;logger[_0xdb6e('0xd')](_0xdb6e('0x75'));logger[_0xdb6e('0xd')](_0xdb6e('0x63'),_0x206f65['id']);return setRelationship(_0x55997e,_0x20db99,_0x206f65,'users');})[_0xdb6e('0x30')](function(){return setRelationship(_0x55997e,_0x3b7902,_0x206f65,_0xdb6e('0x65'));})[_0xdb6e('0x30')](function(){return getServerInfo(_0x55997e);})[_0xdb6e('0x69')](function(_0x105ec6){logger[_0xdb6e('0x72')]('['+_0x56f235['lastevent'][_0xdb6e('0x76')]()+']',JSON[_0xdb6e('0x25')](_0x105ec6));});}; \ 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 52659e1..88caa3c 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 _0x1ff9=['name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','length','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x1ff9,0xef));var _0x91ff=function(_0x565404,_0x846949){_0x565404=_0x565404-0x0;var _0x2b0bb3=_0x1ff9[_0x565404];return _0x2b0bb3;};'use strict';var _=require(_0x91ff('0x0'));var util=require('util');exports['getString']=function(_0x3bc892,_0x3aa148,_0x131ed2){var _0x24a1c4=[];if(_0x3bc892[_0x91ff('0x1')]>0x0){var _0x2b690c=_[_0x91ff('0x2')](_0x3bc892,['id']);for(var _0x537fce=0x0;_0x537fce<_0x2b690c[_0x91ff('0x1')];_0x537fce++){var _0x416f0a=_0x2b690c[_0x537fce];if(_0x416f0a[_0x91ff('0x3')]==='string'){_0x24a1c4[_0x91ff('0x4')](_0x416f0a[_0x91ff('0x5')]);}else if(_0x416f0a['type']===_0x91ff('0x6')&&_0x416f0a[_0x91ff('0x7')]){_0x3aa148[_0x416f0a['variableName']]&&_0x24a1c4[_0x91ff('0x4')](_0x3aa148[_0x416f0a[_0x91ff('0x7')]][_0x91ff('0x8')]());}else if(_0x416f0a['type']===_0x91ff('0x9')&&_0x416f0a[_0x91ff('0xa')]&&_0x416f0a[_0x91ff('0xa')][_0x91ff('0xb')]){_0x3aa148[_0x416f0a['Variable'][_0x91ff('0xb')][_0x91ff('0xc')]()]&&_0x24a1c4[_0x91ff('0x4')](_0x3aa148[_0x416f0a['Variable'][_0x91ff('0xb')][_0x91ff('0xc')]()]['toString']());}else if(_0x416f0a[_0x91ff('0x3')]===_0x91ff('0xd')){if(_0x416f0a[_0x91ff('0xe')]==='string'&&_0x416f0a[_0x91ff('0xf')]){_0x24a1c4[_0x91ff('0x4')](util['format'](_0x91ff('0x10'),_0x416f0a[_0x91ff('0xf')],_0x416f0a['keyContent']));}else if(_0x416f0a[_0x91ff('0xe')]===_0x91ff('0x6')&&_0x416f0a[_0x91ff('0x7')]&&_0x416f0a[_0x91ff('0xf')]){_0x3aa148[_0x416f0a[_0x91ff('0x7')]]&&_0x24a1c4[_0x91ff('0x4')](util[_0x91ff('0x11')](_0x91ff('0x10'),_0x416f0a['key'],_0x3aa148[_0x416f0a['variableName']]));}else if(_0x416f0a[_0x91ff('0xe')]===_0x91ff('0x9')&&_0x416f0a['Variable']&&_0x416f0a[_0x91ff('0xa')][_0x91ff('0xb')]&&_0x416f0a[_0x91ff('0xf')]){_0x3aa148[_0x416f0a['Variable']['name'][_0x91ff('0xc')]()]&&_0x24a1c4[_0x91ff('0x4')](util['format'](_0x91ff('0x10'),_0x416f0a['key'],_0x3aa148[_0x416f0a[_0x91ff('0xa')][_0x91ff('0xb')][_0x91ff('0xc')]()]));}}}}return _0x24a1c4[_0x91ff('0x12')](_0x131ed2);};exports['stripTrailingSlash']=function(_0x517304){var _0x493e21=_0x517304[_0x91ff('0x13')](-0x1);if(_0x493e21==='/'){_0x517304=_0x517304[_0x91ff('0x14')](0x0,_0x517304[_0x91ff('0x15')](_0x493e21));}return _0x517304;};exports[_0x91ff('0x16')]=function(_0x5a66cf){if(!_[_0x91ff('0x17')](_0x5a66cf)&&_0x5a66cf!==''){var _0x599fe1=/^(([^<>()\[\]\\.,;:\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 _0x599fe1[_0x91ff('0x18')](String(_0x5a66cf)[_0x91ff('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x55a9=['stripTrailingSlash','slice','substring','validateEmail','isNil','util','length','sortBy','string','push','type','variableName','toString','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','variable','customVariable','join'];(function(_0x2df5df,_0x1fe53b){var _0x290dd8=function(_0xde8300){while(--_0xde8300){_0x2df5df['push'](_0x2df5df['shift']());}};_0x290dd8(++_0x1fe53b);}(_0x55a9,0x118));var _0x955a=function(_0x4c8b51,_0x15e836){_0x4c8b51=_0x4c8b51-0x0;var _0x17228f=_0x55a9[_0x4c8b51];return _0x17228f;};'use strict';var _=require('lodash');var util=require(_0x955a('0x0'));exports['getString']=function(_0x5e70c5,_0x2a1b7,_0x6e2474){var _0x3cf7c5=[];if(_0x5e70c5[_0x955a('0x1')]>0x0){var _0x572d2e=_[_0x955a('0x2')](_0x5e70c5,['id']);for(var _0x51b42e=0x0;_0x51b42e<_0x572d2e[_0x955a('0x1')];_0x51b42e++){var _0x2ac8b3=_0x572d2e[_0x51b42e];if(_0x2ac8b3['type']===_0x955a('0x3')){_0x3cf7c5[_0x955a('0x4')](_0x2ac8b3['content']);}else if(_0x2ac8b3[_0x955a('0x5')]==='variable'&&_0x2ac8b3[_0x955a('0x6')]){_0x2a1b7[_0x2ac8b3['variableName']]&&_0x3cf7c5[_0x955a('0x4')](_0x2a1b7[_0x2ac8b3[_0x955a('0x6')]][_0x955a('0x7')]());}else if(_0x2ac8b3[_0x955a('0x5')]==='customVariable'&&_0x2ac8b3[_0x955a('0x8')]&&_0x2ac8b3['Variable'][_0x955a('0x9')]){_0x2a1b7[_0x2ac8b3[_0x955a('0x8')]['name'][_0x955a('0xa')]()]&&_0x3cf7c5[_0x955a('0x4')](_0x2a1b7[_0x2ac8b3[_0x955a('0x8')][_0x955a('0x9')][_0x955a('0xa')]()][_0x955a('0x7')]());}else if(_0x2ac8b3[_0x955a('0x5')]===_0x955a('0xb')){if(_0x2ac8b3['keyType']==='string'&&_0x2ac8b3[_0x955a('0xc')]){_0x3cf7c5[_0x955a('0x4')](util[_0x955a('0xd')](_0x955a('0xe'),_0x2ac8b3['key'],_0x2ac8b3[_0x955a('0xf')]));}else if(_0x2ac8b3[_0x955a('0x10')]===_0x955a('0x11')&&_0x2ac8b3[_0x955a('0x6')]&&_0x2ac8b3[_0x955a('0xc')]){_0x2a1b7[_0x2ac8b3['variableName']]&&_0x3cf7c5[_0x955a('0x4')](util[_0x955a('0xd')]('%s:\x20%s',_0x2ac8b3[_0x955a('0xc')],_0x2a1b7[_0x2ac8b3[_0x955a('0x6')]]));}else if(_0x2ac8b3[_0x955a('0x10')]===_0x955a('0x12')&&_0x2ac8b3['Variable']&&_0x2ac8b3[_0x955a('0x8')][_0x955a('0x9')]&&_0x2ac8b3[_0x955a('0xc')]){_0x2a1b7[_0x2ac8b3[_0x955a('0x8')][_0x955a('0x9')][_0x955a('0xa')]()]&&_0x3cf7c5[_0x955a('0x4')](util[_0x955a('0xd')](_0x955a('0xe'),_0x2ac8b3['key'],_0x2a1b7[_0x2ac8b3['Variable'][_0x955a('0x9')][_0x955a('0xa')]()]));}}}}return _0x3cf7c5[_0x955a('0x13')](_0x6e2474);};exports[_0x955a('0x14')]=function(_0x2045d9){var _0x393202=_0x2045d9[_0x955a('0x15')](-0x1);if(_0x393202==='/'){_0x2045d9=_0x2045d9[_0x955a('0x16')](0x0,_0x2045d9['lastIndexOf'](_0x393202));}return _0x2045d9;};exports[_0x955a('0x17')]=function(_0x541285){if(!_[_0x955a('0x18')](_0x541285)&&_0x541285!==''){var _0x4ba85e=/^(([^<>()\[\]\\.,;:\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 _0x4ba85e['test'](String(_0x541285)[_0x955a('0xa')]());}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 33373d6..1d9f14e 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x16b0ed,_0x1bda90){var _0x49987b=function(_0x297bca){while(--_0x297bca){_0x16b0ed['push'](_0x16b0ed['shift']());}};_0x49987b(++_0x1bda90);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _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(_0x4da5d0,_0x3db6c6){var _0x39308d=function(_0x17b5fb){while(--_0x17b5fb){_0x4da5d0['push'](_0x4da5d0['shift']());}};_0x39308d(++_0x3db6c6);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 2318699..424e0e6 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 _0x84a0=['toUpperCase','request-promise','md5','ioredis','./util','zendesk','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','filter','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','username','password','token','Basic\x20%s','base64','debug','stringify','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','custom_fields','variable','variableName','Variable','push','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','monitor_format','lastevent'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x84a0,0x13f));var _0x084a=function(_0x4055df,_0x2846aa){_0x4055df=_0x4055df-0x0;var _0x1301b6=_0x84a0[_0x4055df];return _0x1301b6;};'use strict';var _=require('lodash');var rp=require(_0x084a('0x0'));var md5=require(_0x084a('0x1'));var util=require('util');var Redis=require(_0x084a('0x2'));var intUtil=require(_0x084a('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x084a('0x4'));config['redis']=_[_0x084a('0x5')](config['redis'],{'host':_0x084a('0x6'),'port':0x18eb});var io=require(_0x084a('0x7'))(new Redis(config['redis']));function emit(_0x22c286,_0xc08ebd,_0x127461){io['to'](_0x22c286)[_0x084a('0x8')](_0xc08ebd,_0x127461);}var headers={'Content-Type':_0x084a('0x9'),'Accept':_0x084a('0x9')};function getTicket(_0x449841,_0x2e0775,_0x651a53,_0x230b6b,_0x4c8965){logger['info'](_0x084a('0xa'));return request({'uri':util[_0x084a('0xb')](_0x084a('0xc'),_0x449841[_0x084a('0xd')]),'method':_0x084a('0xe'),'body':{'ticket':_[_0x084a('0xf')]({'requester_id':_0x651a53['id'],'submitter_id':_0x2e0775?_0x2e0775['id']:undefined,'assignee_id':_0x2e0775?_0x2e0775['id']:undefined,'tags':getTags(_0x230b6b[_0x084a('0x10')],_0x084a('0x11')),'subject':intUtil[_0x084a('0x12')](_0x230b6b[_0x084a('0x13')],_0x4c8965,'\x20'),'description':intUtil[_0x084a('0x12')](_0x230b6b[_0x084a('0x14')],_0x4c8965,'\x0a'),'comment':{'public':![],'body':intUtil[_0x084a('0x12')](_0x230b6b[_0x084a('0x14')],_0x4c8965,'\x0a')}},getCustomFields(_0x230b6b[_0x084a('0x15')],_0x4c8965))}})['then'](function(_0x1e97fa){logger[_0x084a('0x16')](_0x084a('0x17'));return _0x1e97fa[_0x084a('0x18')];});}function getUser(_0x2bd18c,_0x5d5472){if(intUtil[_0x084a('0x19')](_0x5d5472)){logger[_0x084a('0x16')](_0x084a('0x1a'),_0x5d5472);return request({'uri':util[_0x084a('0xb')](_0x084a('0x1b'),_0x2bd18c[_0x084a('0xd')]),'qs':{'query':util['format'](_0x084a('0x1c'),_0x5d5472)}})['then'](function(_0x178a87){if(_0x178a87[_0x084a('0x1d')]){logger[_0x084a('0x16')](_0x084a('0x1e'));return _[_0x084a('0x1f')](_0x178a87[_0x084a('0x20')],{'email':_0x5d5472,'role':'agent'});}else{logger[_0x084a('0x16')](_0x084a('0x21'));return request({'uri':util[_0x084a('0xb')](_0x084a('0x22'),_0x2bd18c[_0x084a('0xd')])})[_0x084a('0x23')](function(_0xd3671c){logger['info'](_0x084a('0x24'));return _0xd3671c[_0x084a('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x084a('0xb')](_0x084a('0x22'),_0x2bd18c[_0x084a('0xd')])})[_0x084a('0x23')](function(_0x20a6b1){logger[_0x084a('0x16')]('Admin\x20account\x20selected.');return _0x20a6b1['user'];});}}function getEndUser(_0x4d42dd,_0x34374a,_0x2681e7){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2681e7);return request({'uri':util[_0x084a('0xb')](_0x084a('0x1b'),_0x4d42dd[_0x084a('0xd')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2681e7)}})[_0x084a('0x23')](function(_0x5b986a){var _0x21f5db;if(_0x5b986a[_0x084a('0x20')]['length']){_0x5b986a['results']=_[_0x084a('0x26')](_0x5b986a[_0x084a('0x20')],{'suspended':![],'role':'end-user'});if(_0x5b986a[_0x084a('0x20')]['length']){_0x21f5db=_['first'](_0x5b986a['results']);}}if(_0x21f5db){logger[_0x084a('0x16')](_0x084a('0x27'));return _0x21f5db;}else{logger[_0x084a('0x16')](_0x084a('0x28'));return request({'uri':util[_0x084a('0xb')](_0x084a('0x29'),_0x4d42dd[_0x084a('0xd')]),'method':'POST','body':{'user':{'role':_0x084a('0x2a'),'name':util['format'](_0x084a('0x2b'),_0x34374a||_0x2681e7),'phone':_0x2681e7}}})[_0x084a('0x23')](function(_0x54d1ec){logger[_0x084a('0x16')]('Enduser\x20created.');return _0x54d1ec[_0x084a('0x25')];});}});}function getAuth(_0x3a45ba){var _0x5521f6;if(_0x3a45ba[_0x084a('0x2c')]==='password'){_0x5521f6=util[_0x084a('0xb')](_0x084a('0x2d'),_0x3a45ba[_0x084a('0x2e')],_0x3a45ba[_0x084a('0x2f')]);}else if(_0x3a45ba[_0x084a('0x2c')]===_0x084a('0x30')){_0x5521f6=util[_0x084a('0xb')]('%s/token:%s',_0x3a45ba['username'],_0x3a45ba['token']);}return util['format'](_0x084a('0x31'),new Buffer(_0x5521f6)['toString'](_0x084a('0x32')));}function request(_0x558a3e){logger[_0x084a('0x33')]('[HTTP]',JSON[_0x084a('0x34')](_0x558a3e));return rp(_[_0x084a('0x5')](_0x558a3e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xdc4a16,_0x473b3f){var _0x4f9185=[];if(_0xdc4a16&&_0xdc4a16[_0x084a('0x35')]>0x0){_0x4f9185=_[_0x084a('0x36')](_0xdc4a16,_0x473b3f);}return _0x4f9185;}function getCustomFields(_0x33dc9c,_0x1a5277){var _0x3dd6d7=[];var _0x52f5a6={'custom_fields':[]};if(_0x33dc9c[_0x084a('0x35')]>0x0){_[_0x084a('0x37')](_0x33dc9c,function(_0x2381fa){if(_[_0x084a('0x38')]([_0x084a('0x39'),_0x084a('0x3a')],_0x2381fa[_0x084a('0x3b')])&&_0x2381fa[_0x084a('0x3c')]&&!_0x2381fa[_0x084a('0x3d')]){_0x52f5a6[_0x2381fa[_0x084a('0x3c')][_0x084a('0x3e')]()]=_0x2381fa[_0x084a('0x3f')][_0x084a('0x40')]();}else if(_[_0x084a('0x38')]([_0x084a('0x39'),_0x084a('0x3a')],_0x2381fa[_0x084a('0x3b')])&&_0x2381fa[_0x084a('0x41')]&&_0x2381fa[_0x084a('0x3d')]){_0x52f5a6[_0x084a('0x42')]['push']({'id':_0x2381fa['idField'],'value':_0x2381fa['content'][_0x084a('0x40')]()});}else if(_0x2381fa[_0x084a('0x3b')]===_0x084a('0x43')&&_0x2381fa[_0x084a('0x44')]&&_0x2381fa[_0x084a('0x41')]&&_0x2381fa[_0x084a('0x3d')]){_0x1a5277[_0x2381fa[_0x084a('0x44')]]&&_0x52f5a6[_0x084a('0x42')]['push']({'id':_0x2381fa[_0x084a('0x41')],'value':_0x1a5277[_0x2381fa['variableName']]['toString']()});}else if(_0x2381fa[_0x084a('0x3b')]==='customVariable'&&_0x2381fa['Variable']&&_0x2381fa[_0x084a('0x45')][_0x084a('0x11')]&&_0x2381fa[_0x084a('0x41')]&&_0x2381fa[_0x084a('0x3d')]){_0x1a5277[_0x2381fa[_0x084a('0x45')][_0x084a('0x11')]['toLowerCase']()]&&_0x52f5a6[_0x084a('0x42')][_0x084a('0x46')]({'id':_0x2381fa['idField'],'value':_0x1a5277[_0x2381fa[_0x084a('0x45')][_0x084a('0x11')]['toLowerCase']()][_0x084a('0x40')]()});}});}return _0x52f5a6;}exports[_0x084a('0x47')]=function(_0x2795b2,_0x11cc30,_0x2f1f0e,_0x5cb5af,_0x3584a7,_0x461d72){var _0x495604,_0x4c29c0;_0x461d72[_0x084a('0xd')]=intUtil[_0x084a('0x48')](_0x461d72['remoteUri']);_0x461d72[_0x084a('0x49')]=intUtil[_0x084a('0x48')](_0x461d72[_0x084a('0x49')]);if(_0x3584a7&&_0x3584a7['monitor_format']){logger[_0x084a('0x16')]('[QUEUE]',_0x084a('0x4a'));_0x11cc30['recordingURL']=util['format'](_0x084a('0x4b'),_0x461d72[_0x084a('0x49')],_0x11cc30[_0x084a('0x4c')],md5(_0x11cc30[_0x084a('0x4c')]));}else{_0x11cc30['recordingURL']='';}headers[_0x084a('0x4d')]=getAuth(_0x461d72);return getUser(_0x461d72,_0x5cb5af[_0x084a('0x4e')])[_0x084a('0x23')](function(_0x565141){_0x495604=_0x565141;logger[_0x084a('0x16')](_0x084a('0x4f'),_0x495604['id']);return getEndUser(_0x461d72,_0x11cc30[_0x084a('0x50')],_0x11cc30[_0x084a('0x51')]);})['then'](function(_0x139332){_0x4c29c0=_0x139332;logger[_0x084a('0x16')]('The\x20Enduser\x20ID\x20is:',_0x4c29c0['id']);return getTicket(_0x461d72,_0x495604,_0x4c29c0,_0x2f1f0e,_0x11cc30);})[_0x084a('0x23')](function(_0x55f689){if(_0x55f689){logger[_0x084a('0x16')](_0x084a('0x52'),_0x55f689['id']);switch(_0x461d72['type']){case _0x084a('0x53'):logger[_0x084a('0x16')](_0x084a('0x54'),_0x084a('0x55'));return request({'uri':util['format'](_0x084a('0x56'),_0x461d72[_0x084a('0xd')],_0x495604['id'],_0x55f689['id']),'method':_0x084a('0xe')});case'newTab':logger[_0x084a('0x16')](_0x084a('0x54'),_0x084a('0x57'));emit(util[_0x084a('0xb')](_0x084a('0x58'),_0x5cb5af[_0x084a('0x11')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x461d72[_0x084a('0xd')][_0x084a('0x59')]('/api/v2',''),_0x55f689['id'])});break;default:logger['error'](_0x084a('0x54'),_0x084a('0x5a'));}}})[_0x084a('0x5b')](function(_0x5b3589){logger[_0x084a('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x084a('0x5d')](_0x5b3589,{'showHidden':!![],'depth':null}));});};exports[_0x084a('0x5e')]=function(_0xc76893,_0x531f89,_0x46b0b6,_0x216dbf,_0x30dcf8,_0x348fb4,_0x2d0d4d){var _0x1b6fa8,_0x43a155;_0x348fb4[_0x084a('0xd')]=intUtil['stripTrailingSlash'](_0x348fb4[_0x084a('0xd')]);_0x348fb4['serverUrl']=intUtil[_0x084a('0x48')](_0x348fb4[_0x084a('0x49')]);if(_0x2d0d4d&&_0x2d0d4d[_0x084a('0x5f')]&&_0x2d0d4d[_0x084a('0x5f')]!==_0x084a('0x60')){logger[_0x084a('0x16')](_0x084a('0x61'),_0x084a('0x4a'));_0x531f89[_0x084a('0x62')]=util['format'](_0x084a('0x4b'),_0x348fb4['serverUrl'],_0x531f89[_0x084a('0x4c')],md5(_0x531f89[_0x084a('0x4c')]));}headers[_0x084a('0x4d')]=getAuth(_0x348fb4);return getUser(_0x348fb4,_0x216dbf[_0x084a('0x4e')])[_0x084a('0x23')](function(_0x41a4f3){_0x1b6fa8=_0x41a4f3;logger[_0x084a('0x16')](_0x084a('0x4f'),_0x1b6fa8['id']);return getEndUser(_0x348fb4,_0x531f89['destcalleridname'],_0x531f89[_0x084a('0x63')]);})[_0x084a('0x23')](function(_0x345736){_0x43a155=_0x345736;logger['info'](_0x084a('0x64'),_0x43a155['id']);return getTicket(_0x348fb4,_0x1b6fa8,_0x43a155,_0x46b0b6,_0x531f89);})[_0x084a('0x23')](function(_0x1b2f03){if(_0x1b2f03){logger[_0x084a('0x16')](_0x084a('0x52'),_0x1b2f03['id']);switch(_0x348fb4[_0x084a('0x3b')]){case _0x084a('0x53'):logger[_0x084a('0x16')]('[OUTBOUND]',_0x084a('0x55'));return request({'uri':util['format'](_0x084a('0x56'),_0x348fb4[_0x084a('0xd')],_0x1b6fa8['id'],_0x1b2f03['id']),'method':'POST'});case'newTab':logger['info']('[OUTBOUND]',_0x084a('0x57'));emit(util[_0x084a('0xb')](_0x084a('0x58'),_0x216dbf[_0x084a('0x11')]),'trigger:browser:url',{'uri':util[_0x084a('0xb')](_0x084a('0x65'),_0x348fb4[_0x084a('0xd')][_0x084a('0x59')]('/api/v2',''),_0x1b2f03['id'])});break;default:logger[_0x084a('0x5c')](_0x084a('0x61'),_0x084a('0x5a'));}}})[_0x084a('0x5b')](function(_0x1a3796){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x084a('0x5d')](_0x1a3796,{'showHidden':!![],'depth':null}));});};exports[_0x084a('0x66')]=function(_0x4efc84,_0x45e2fe,_0x1598cf,_0x371f70,_0x285c0c,_0x39a684){var _0xf63e16,_0x5ef26f;_0x39a684[_0x084a('0xd')]=intUtil['stripTrailingSlash'](_0x39a684[_0x084a('0xd')]);_0x39a684['serverUrl']=intUtil[_0x084a('0x48')](_0x39a684[_0x084a('0x49')]);if(_0x285c0c&&_0x285c0c[_0x084a('0x67')]){logger['info']('['+_0x45e2fe[_0x084a('0x68')][_0x084a('0x69')]()+']',_0x084a('0x4a'));_0x45e2fe[_0x084a('0x62')]=util[_0x084a('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39a684[_0x084a('0x49')],_0x45e2fe[_0x084a('0x4c')],md5(_0x45e2fe[_0x084a('0x4c')]));}else{_0x45e2fe['recordingURL']='';}headers[_0x084a('0x4d')]=getAuth(_0x39a684);return getUser(_0x39a684)[_0x084a('0x23')](function(_0x3bfd84){_0xf63e16=_0x3bfd84;logger[_0x084a('0x16')](_0x084a('0x4f'),_0xf63e16['id']);return getEndUser(_0x39a684,_0x45e2fe[_0x084a('0x50')],_0x45e2fe[_0x084a('0x51')]);})[_0x084a('0x23')](function(_0x524f15){_0x5ef26f=_0x524f15;logger[_0x084a('0x16')]('The\x20Enduser\x20ID\x20is:',_0x5ef26f['id']);return getTicket(_0x39a684,_0xf63e16,_0x5ef26f,_0x1598cf,_0x45e2fe);})['then'](function(_0x5cd944){if(_0x5cd944){logger['info'](_0x084a('0x52'),_0x5cd944['id']);}})[_0x084a('0x5b')](function(_0x58c1d0){logger[_0x084a('0x5c')]('['+_0x45e2fe[_0x084a('0x68')][_0x084a('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x084a('0x5d')](_0x58c1d0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4ead=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','base64','debug','[HTTP]','GET','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variableName','Variable','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','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','none','destcalleridname','destcalleridnum','[OUTBOUND]','catch','toUpperCase','lastevent','lodash','md5','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','name','getString','Descriptions','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','results'];(function(_0x487cd6,_0x1fe349){var _0x5cb35d=function(_0xa885a4){while(--_0xa885a4){_0x487cd6['push'](_0x487cd6['shift']());}};_0x5cb35d(++_0x1fe349);}(_0x4ead,0x1dd));var _0xd4ea=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x4ead[_0x506172];return _0x2723c0;};'use strict';var _=require(_0xd4ea('0x0'));var rp=require('request-promise');var md5=require(_0xd4ea('0x1'));var util=require('util');var Redis=require(_0xd4ea('0x2'));var intUtil=require(_0xd4ea('0x3'));var config=require(_0xd4ea('0x4'));var logger=require('../../../../config/logger')(_0xd4ea('0x5'));config[_0xd4ea('0x6')]=_[_0xd4ea('0x7')](config[_0xd4ea('0x6')],{'host':_0xd4ea('0x8'),'port':0x18eb});var io=require(_0xd4ea('0x9'))(new Redis(config[_0xd4ea('0x6')]));function emit(_0x266d52,_0x6e13f2,_0x59115c){io['to'](_0x266d52)[_0xd4ea('0xa')](_0x6e13f2,_0x59115c);}var headers={'Content-Type':_0xd4ea('0xb'),'Accept':_0xd4ea('0xb')};function getTicket(_0x4df6b5,_0x3e1e8c,_0xe39a72,_0x5bccc2,_0x22da12){logger[_0xd4ea('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0xe'),_0x4df6b5[_0xd4ea('0xf')]),'method':_0xd4ea('0x10'),'body':{'ticket':_['merge']({'requester_id':_0xe39a72['id'],'submitter_id':_0x3e1e8c?_0x3e1e8c['id']:undefined,'assignee_id':_0x3e1e8c?_0x3e1e8c['id']:undefined,'tags':getTags(_0x5bccc2['Tags'],_0xd4ea('0x11')),'subject':intUtil[_0xd4ea('0x12')](_0x5bccc2['Subjects'],_0x22da12,'\x20'),'description':intUtil[_0xd4ea('0x12')](_0x5bccc2[_0xd4ea('0x13')],_0x22da12,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd4ea('0x12')](_0x5bccc2['Descriptions'],_0x22da12,'\x0a')}},getCustomFields(_0x5bccc2['Fields'],_0x22da12))}})['then'](function(_0x10c89f){logger[_0xd4ea('0xc')](_0xd4ea('0x14'));return _0x10c89f['ticket'];});}function getUser(_0x2f4f8f,_0x2d8022){if(intUtil[_0xd4ea('0x15')](_0x2d8022)){logger[_0xd4ea('0xc')](_0xd4ea('0x16'),_0x2d8022);return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0x17'),_0x2f4f8f[_0xd4ea('0xf')]),'qs':{'query':util[_0xd4ea('0xd')]('type:user\x20role:agent\x20email:%s',_0x2d8022)}})[_0xd4ea('0x18')](function(_0x452a89){if(_0x452a89[_0xd4ea('0x19')]){logger['info'](_0xd4ea('0x1a'));return _['find'](_0x452a89[_0xd4ea('0x1b')],{'email':_0x2d8022,'role':_0xd4ea('0x1c')});}else{logger[_0xd4ea('0xc')](_0xd4ea('0x1d'));return request({'uri':util['format'](_0xd4ea('0x1e'),_0x2f4f8f[_0xd4ea('0xf')])})['then'](function(_0x253e06){logger[_0xd4ea('0xc')](_0xd4ea('0x1f'));return _0x253e06[_0xd4ea('0x20')];});}});}else{logger[_0xd4ea('0xc')](_0xd4ea('0x1d'));return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0x1e'),_0x2f4f8f[_0xd4ea('0xf')])})[_0xd4ea('0x18')](function(_0x1ca2f9){logger['info']('Admin\x20account\x20selected.');return _0x1ca2f9[_0xd4ea('0x20')];});}}function getEndUser(_0x5ef272,_0x5be10e,_0x39c303){logger[_0xd4ea('0xc')]('Searching\x20enduser\x20with\x20phone',_0x39c303);return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0x17'),_0x5ef272[_0xd4ea('0xf')]),'qs':{'query':util[_0xd4ea('0xd')](_0xd4ea('0x21'),_0x39c303)}})['then'](function(_0x254fd9){var _0x4dbf13;if(_0x254fd9[_0xd4ea('0x1b')]['length']){_0x254fd9[_0xd4ea('0x1b')]=_['filter'](_0x254fd9['results'],{'suspended':![],'role':'end-user'});if(_0x254fd9[_0xd4ea('0x1b')]['length']){_0x4dbf13=_[_0xd4ea('0x22')](_0x254fd9['results']);}}if(_0x4dbf13){logger[_0xd4ea('0xc')](_0xd4ea('0x23'));return _0x4dbf13;}else{logger[_0xd4ea('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0x24'),_0x5ef272[_0xd4ea('0xf')]),'method':_0xd4ea('0x10'),'body':{'user':{'role':'end-user','name':util[_0xd4ea('0xd')](_0xd4ea('0x25'),_0x5be10e||_0x39c303),'phone':_0x39c303}}})[_0xd4ea('0x18')](function(_0x58d266){logger[_0xd4ea('0xc')](_0xd4ea('0x26'));return _0x58d266[_0xd4ea('0x20')];});}});}function getAuth(_0x48e266){var _0x40f791;if(_0x48e266[_0xd4ea('0x27')]===_0xd4ea('0x28')){_0x40f791=util[_0xd4ea('0xd')](_0xd4ea('0x29'),_0x48e266[_0xd4ea('0x2a')],_0x48e266[_0xd4ea('0x28')]);}else if(_0x48e266[_0xd4ea('0x27')]===_0xd4ea('0x2b')){_0x40f791=util[_0xd4ea('0xd')](_0xd4ea('0x2c'),_0x48e266[_0xd4ea('0x2a')],_0x48e266['token']);}return util['format']('Basic\x20%s',new Buffer(_0x40f791)['toString'](_0xd4ea('0x2d')));}function request(_0x593560){logger[_0xd4ea('0x2e')](_0xd4ea('0x2f'),JSON['stringify'](_0x593560));return rp(_['defaults'](_0x593560,{'method':_0xd4ea('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x315185,_0x79e96a){var _0x29cc29=[];if(_0x315185&&_0x315185[_0xd4ea('0x31')]>0x0){_0x29cc29=_[_0xd4ea('0x32')](_0x315185,_0x79e96a);}return _0x29cc29;}function getCustomFields(_0x1a64c9,_0x5e1d70){var _0x272e9c=[];var _0x551634={'custom_fields':[]};if(_0x1a64c9[_0xd4ea('0x31')]>0x0){_[_0xd4ea('0x33')](_0x1a64c9,function(_0x2716bf){if(_[_0xd4ea('0x34')]([_0xd4ea('0x35'),_0xd4ea('0x36')],_0x2716bf[_0xd4ea('0x37')])&&_0x2716bf[_0xd4ea('0x38')]&&!_0x2716bf[_0xd4ea('0x39')]){_0x551634[_0x2716bf[_0xd4ea('0x38')][_0xd4ea('0x3a')]()]=_0x2716bf[_0xd4ea('0x3b')][_0xd4ea('0x3c')]();}else if(_[_0xd4ea('0x34')]([_0xd4ea('0x35'),_0xd4ea('0x36')],_0x2716bf[_0xd4ea('0x37')])&&_0x2716bf[_0xd4ea('0x3d')]&&_0x2716bf[_0xd4ea('0x39')]){_0x551634[_0xd4ea('0x3e')][_0xd4ea('0x3f')]({'id':_0x2716bf[_0xd4ea('0x3d')],'value':_0x2716bf['content']['toString']()});}else if(_0x2716bf['type']==='variable'&&_0x2716bf[_0xd4ea('0x40')]&&_0x2716bf[_0xd4ea('0x3d')]&&_0x2716bf[_0xd4ea('0x39')]){_0x5e1d70[_0x2716bf[_0xd4ea('0x40')]]&&_0x551634['custom_fields']['push']({'id':_0x2716bf[_0xd4ea('0x3d')],'value':_0x5e1d70[_0x2716bf[_0xd4ea('0x40')]][_0xd4ea('0x3c')]()});}else if(_0x2716bf[_0xd4ea('0x37')]==='customVariable'&&_0x2716bf[_0xd4ea('0x41')]&&_0x2716bf['Variable']['name']&&_0x2716bf[_0xd4ea('0x3d')]&&_0x2716bf[_0xd4ea('0x39')]){_0x5e1d70[_0x2716bf[_0xd4ea('0x41')][_0xd4ea('0x11')][_0xd4ea('0x3a')]()]&&_0x551634[_0xd4ea('0x3e')]['push']({'id':_0x2716bf[_0xd4ea('0x3d')],'value':_0x5e1d70[_0x2716bf[_0xd4ea('0x41')][_0xd4ea('0x11')][_0xd4ea('0x3a')]()]['toString']()});}});}return _0x551634;}exports[_0xd4ea('0x42')]=function(_0x19b949,_0x283749,_0x32ed67,_0x574444,_0x533584,_0x488f64){var _0x2bcd6f,_0x29b8a8;_0x488f64[_0xd4ea('0xf')]=intUtil[_0xd4ea('0x43')](_0x488f64[_0xd4ea('0xf')]);_0x488f64[_0xd4ea('0x44')]=intUtil['stripTrailingSlash'](_0x488f64[_0xd4ea('0x44')]);if(_0x533584&&_0x533584[_0xd4ea('0x45')]){logger['info'](_0xd4ea('0x46'),_0xd4ea('0x47'));_0x283749[_0xd4ea('0x48')]=util[_0xd4ea('0xd')](_0xd4ea('0x49'),_0x488f64[_0xd4ea('0x44')],_0x283749[_0xd4ea('0x4a')],md5(_0x283749[_0xd4ea('0x4a')]));}else{_0x283749[_0xd4ea('0x48')]='';}headers[_0xd4ea('0x4b')]=getAuth(_0x488f64);return getUser(_0x488f64,_0x574444[_0xd4ea('0x4c')])[_0xd4ea('0x18')](function(_0x2942bd){_0x2bcd6f=_0x2942bd;logger[_0xd4ea('0xc')](_0xd4ea('0x4d'),_0x2bcd6f['id']);return getEndUser(_0x488f64,_0x283749[_0xd4ea('0x4e')],_0x283749[_0xd4ea('0x4f')]);})[_0xd4ea('0x18')](function(_0x41e1ee){_0x29b8a8=_0x41e1ee;logger['info'](_0xd4ea('0x50'),_0x29b8a8['id']);return getTicket(_0x488f64,_0x2bcd6f,_0x29b8a8,_0x32ed67,_0x283749);})['then'](function(_0x49eff4){if(_0x49eff4){logger[_0xd4ea('0xc')](_0xd4ea('0x51'),_0x49eff4['id']);switch(_0x488f64[_0xd4ea('0x37')]){case _0xd4ea('0x52'):logger['info'](_0xd4ea('0x46'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd4ea('0xd')](_0xd4ea('0x53'),_0x488f64['remoteUri'],_0x2bcd6f['id'],_0x49eff4['id']),'method':_0xd4ea('0x10')});case _0xd4ea('0x54'):logger[_0xd4ea('0xc')](_0xd4ea('0x46'),_0xd4ea('0x55'));emit(util[_0xd4ea('0xd')]('user:%s',_0x574444[_0xd4ea('0x11')]),_0xd4ea('0x56'),{'uri':util['format'](_0xd4ea('0x57'),_0x488f64[_0xd4ea('0xf')][_0xd4ea('0x58')](_0xd4ea('0x59'),''),_0x49eff4['id'])});break;default:logger[_0xd4ea('0x5a')]('[QUEUE]',_0xd4ea('0x5b'));}}})['catch'](function(_0x290820){logger[_0xd4ea('0x5a')](_0xd4ea('0x5c'),util[_0xd4ea('0x5d')](_0x290820,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4ab038,_0x1a7794,_0x4d9823,_0x55772d,_0x3fd919,_0x3dd819,_0x3f8c0a){var _0x222a33,_0x17301e;_0x3dd819[_0xd4ea('0xf')]=intUtil[_0xd4ea('0x43')](_0x3dd819[_0xd4ea('0xf')]);_0x3dd819[_0xd4ea('0x44')]=intUtil[_0xd4ea('0x43')](_0x3dd819['serverUrl']);if(_0x3f8c0a&&_0x3f8c0a['recordingFormat']&&_0x3f8c0a['recordingFormat']!==_0xd4ea('0x5e')){logger[_0xd4ea('0xc')]('[OUTBOUND]',_0xd4ea('0x47'));_0x1a7794[_0xd4ea('0x48')]=util[_0xd4ea('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dd819[_0xd4ea('0x44')],_0x1a7794[_0xd4ea('0x4a')],md5(_0x1a7794[_0xd4ea('0x4a')]));}headers[_0xd4ea('0x4b')]=getAuth(_0x3dd819);return getUser(_0x3dd819,_0x55772d[_0xd4ea('0x4c')])[_0xd4ea('0x18')](function(_0x34aa0f){_0x222a33=_0x34aa0f;logger[_0xd4ea('0xc')]('The\x20User\x20ID\x20is:',_0x222a33['id']);return getEndUser(_0x3dd819,_0x1a7794[_0xd4ea('0x5f')],_0x1a7794[_0xd4ea('0x60')]);})[_0xd4ea('0x18')](function(_0x1b75cb){_0x17301e=_0x1b75cb;logger[_0xd4ea('0xc')]('The\x20Enduser\x20ID\x20is:',_0x17301e['id']);return getTicket(_0x3dd819,_0x222a33,_0x17301e,_0x4d9823,_0x1a7794);})[_0xd4ea('0x18')](function(_0x521cff){if(_0x521cff){logger['info']('The\x20Ticket\x20ID\x20is:',_0x521cff['id']);switch(_0x3dd819[_0xd4ea('0x37')]){case _0xd4ea('0x52'):logger[_0xd4ea('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3dd819[_0xd4ea('0xf')],_0x222a33['id'],_0x521cff['id']),'method':_0xd4ea('0x10')});case'newTab':logger[_0xd4ea('0xc')](_0xd4ea('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x55772d[_0xd4ea('0x11')]),_0xd4ea('0x56'),{'uri':util[_0xd4ea('0xd')](_0xd4ea('0x57'),_0x3dd819[_0xd4ea('0xf')]['replace'](_0xd4ea('0x59'),''),_0x521cff['id'])});break;default:logger[_0xd4ea('0x5a')]('[OUTBOUND]',_0xd4ea('0x5b'));}}})[_0xd4ea('0x62')](function(_0x49aa81){logger[_0xd4ea('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd4ea('0x5d')](_0x49aa81,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x55a110,_0x4ff201,_0x2eb28b,_0x41d7fd,_0x46def9,_0x54bbac){var _0x2b758d,_0x19d674;_0x54bbac['remoteUri']=intUtil[_0xd4ea('0x43')](_0x54bbac[_0xd4ea('0xf')]);_0x54bbac[_0xd4ea('0x44')]=intUtil['stripTrailingSlash'](_0x54bbac[_0xd4ea('0x44')]);if(_0x46def9&&_0x46def9[_0xd4ea('0x45')]){logger['info']('['+_0x4ff201['lastevent'][_0xd4ea('0x63')]()+']','Recording\x20is\x20enabled!');_0x4ff201[_0xd4ea('0x48')]=util[_0xd4ea('0xd')](_0xd4ea('0x49'),_0x54bbac[_0xd4ea('0x44')],_0x4ff201[_0xd4ea('0x4a')],md5(_0x4ff201[_0xd4ea('0x4a')]));}else{_0x4ff201[_0xd4ea('0x48')]='';}headers[_0xd4ea('0x4b')]=getAuth(_0x54bbac);return getUser(_0x54bbac)[_0xd4ea('0x18')](function(_0x318f81){_0x2b758d=_0x318f81;logger['info'](_0xd4ea('0x4d'),_0x2b758d['id']);return getEndUser(_0x54bbac,_0x4ff201[_0xd4ea('0x4e')],_0x4ff201[_0xd4ea('0x4f')]);})['then'](function(_0x5dec84){_0x19d674=_0x5dec84;logger[_0xd4ea('0xc')](_0xd4ea('0x50'),_0x19d674['id']);return getTicket(_0x54bbac,_0x2b758d,_0x19d674,_0x2eb28b,_0x4ff201);})[_0xd4ea('0x18')](function(_0x2e3952){if(_0x2e3952){logger['info'](_0xd4ea('0x51'),_0x2e3952['id']);}})[_0xd4ea('0x62')](function(_0x2e6f95){logger['error']('['+_0x4ff201[_0xd4ea('0x64')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xd4ea('0x5d')](_0x2e6f95,{'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 2398028..b2288e6 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 _0x38ff=['Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','details','moduleCreate','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result'];(function(_0x39ad4c,_0x2fa27e){var _0xf3314d=function(_0x4de109){while(--_0x4de109){_0x39ad4c['push'](_0x39ad4c['shift']());}};_0xf3314d(++_0x2fa27e);}(_0x38ff,0x173));var _0xf38f=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x38ff[_0x47e549];return _0x251374;};'use strict';var _=require(_0xf38f('0x0'));var rp=require(_0xf38f('0x1'));var md5=require(_0xf38f('0x2'));var util=require(_0xf38f('0x3'));var intUtil=require('./util');var moment=require(_0xf38f('0x4'));var Redis=require(_0xf38f('0x5'));var BPromise=require(_0xf38f('0x6'));var config=require(_0xf38f('0x7'));var logger=require(_0xf38f('0x8'))(_0xf38f('0x9'));config[_0xf38f('0xa')]=_[_0xf38f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf38f('0xc'))(new Redis(config[_0xf38f('0xa')]));function emit(_0x2e9722,_0x1de277,_0x1de7ac){io['to'](_0x2e9722)[_0xf38f('0xd')](_0x1de277,_0x1de7ac);}function request(_0x231319){logger[_0xf38f('0xe')](_0xf38f('0xf'),JSON[_0xf38f('0x10')](_0x231319));return rp(_0x231319);}function getCustomFields(_0x28506c,_0x29d635){var _0x176ff1={};if(_0x28506c[_0xf38f('0x11')]>0x0){_[_0xf38f('0x12')](_0x28506c,function(_0x134edb){if(_[_0xf38f('0x13')]([_0xf38f('0x14'),_0xf38f('0x15')],_0x134edb[_0xf38f('0x16')])&&_0x134edb[_0xf38f('0x17')]){_0x176ff1[_0x134edb[_0xf38f('0x17')]]=_0x134edb[_0xf38f('0x18')]['toString']();}else if(_0x134edb[_0xf38f('0x16')]===_0xf38f('0x19')&&_0x134edb[_0xf38f('0x1a')]&&_0x134edb['idField']&&_0x29d635[_0x134edb[_0xf38f('0x1a')]]){_0x176ff1[_0x134edb[_0xf38f('0x17')]]=_0x29d635[_0x134edb[_0xf38f('0x1a')]][_0xf38f('0x1b')]();}else if(_0x134edb[_0xf38f('0x16')]==='customVariable'&&_0x134edb[_0xf38f('0x1c')]&&_0x134edb[_0xf38f('0x1c')]['name']&&_0x134edb['idField']&&_0x29d635[_0x134edb['Variable'][_0xf38f('0x1d')][_0xf38f('0x1e')]()]){_0x176ff1[_0x134edb['idField']]=_0x29d635[_0x134edb[_0xf38f('0x1c')]['name']['toLowerCase']()][_0xf38f('0x1b')]();}});}return _0x176ff1;}function getName(_0x5816f7){if(_0x5816f7[_0xf38f('0x1f')]('\x20')>0x0){var _0x1b4723=_0x5816f7[_0xf38f('0x20')](/ (.+)/);if(_0x1b4723[0x1]){return _0x1b4723;}}return[_0x5816f7,_0x5816f7];}var accountsTokens={};function getAccessToken(_0x3e6aa1){return new Promise(function(_0x5b4976,_0x10ba38){if(!_['isNil'](accountsTokens[_0x3e6aa1['id']])&&!_[_0xf38f('0x21')](accountsTokens[_0x3e6aa1['id']][_0xf38f('0x22')])){if(moment()[_0xf38f('0x23')](accountsTokens[_0x3e6aa1['id']][_0xf38f('0x24')])){_0x5b4976(accountsTokens[_0x3e6aa1['id']][_0xf38f('0x22')]);}}var _0x14ed82;switch(_0x3e6aa1[_0xf38f('0x25')]){case'US':_0x14ed82=_0xf38f('0x26');break;case'AU':_0x14ed82=_0xf38f('0x27');break;case'EU':_0x14ed82='https://accounts.zoho.eu';break;case'IN':_0x14ed82=_0xf38f('0x28');break;case'CN':_0x14ed82=_0xf38f('0x29');break;default:_0x14ed82=_0xf38f('0x2a');break;}var _0x220902={'method':'POST','uri':_0x14ed82+_0xf38f('0x2b'),'qs':{'refresh_token':_0x3e6aa1[_0xf38f('0x2c')],'client_id':_0x3e6aa1[_0xf38f('0x2d')],'client_secret':_0x3e6aa1[_0xf38f('0x2e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x220902)[_0xf38f('0x2f')](function(_0x2284fe){accountsTokens[_0x3e6aa1['id']]={'access_token':_0x2284fe[_0xf38f('0x22')],'expires_in':moment()[_0xf38f('0x30')](_0x2284fe[_0xf38f('0x24')],_0xf38f('0x31'))};_0x5b4976(_0x2284fe[_0xf38f('0x22')]);})[_0xf38f('0x32')](function(_0x4f1e44){logger['error'](_0xf38f('0x33'),_0x4f1e44[_0xf38f('0x34')]);_0x10ba38(_0x4f1e44);});});}function getUser(_0x4d8b1e,_0x475f1e,_0x165c9d,_0x3e4a1d){logger[_0xf38f('0x35')](_0xf38f('0x36'));return request({'method':'GET','uri':util[_0xf38f('0x37')](_0xf38f('0x38'),_0x475f1e),'qs':{'type':_0xf38f('0x39')},'headers':{'Authorization':_0xf38f('0x3a')+_0x4d8b1e},'json':!![]})[_0xf38f('0x2f')](function(_0x3e9037){if(_0x3e9037[_0xf38f('0x3b')]){var _0x2d312c=-0x1;if(_['isArrayLikeObject'](_0x3e9037['users'])){if(!_['isNil'](_0x3e4a1d)){_0x2d312c=_[_0xf38f('0x3c')](_0x3e9037['users'],function(_0x3de018){return _0x3de018[_0xf38f('0x3d')]===_0x3e4a1d;});}if(_0x2d312c>=0x0){logger[_0xf38f('0x35')]('Agent\x20found!');}else{logger[_0xf38f('0x35')](_0xf38f('0x3e'));_0x2d312c=_[_0xf38f('0x3c')](_0x3e9037[_0xf38f('0x3b')],function(_0x42e8ec){return _0x42e8ec[_0xf38f('0x3f')][_0xf38f('0x1d')]===_0xf38f('0x40');});}return _0x3e9037[_0xf38f('0x3b')][_0x2d312c];}else{if(_0x3e9037[_0xf38f('0x41')][_0xf38f('0x3f')][_0xf38f('0x1d')]==='Administrator'){logger[_0xf38f('0x35')](_0xf38f('0x3e'));user=_0x3e9037['user'];return user;}else{logger[_0xf38f('0x42')](_0xf38f('0x43'),JSON[_0xf38f('0x10')](_0x3e9037));throw new Error(_0xf38f('0x44')+JSON[_0xf38f('0x10')](_0x3e9037));}}}else{logger[_0xf38f('0x42')](_0xf38f('0x43'),JSON[_0xf38f('0x10')](_0x3e9037));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf38f('0x10')](_0x3e9037));}})[_0xf38f('0x32')](function(_0xc9128b){console['error'](_0xc9128b);});}function getZohoUser(_0x2e2867,_0x3771f8){return new BPromise(function(_0x57ec7b,_0x2d46b9){request(_0x2e2867)[_0xf38f('0x2f')](function(_0x16f447){var _0x25bfcb=null;if(_0x16f447){_0x25bfcb=_0x16f447[_0xf38f('0x45')][0x0];_0x25bfcb[_0xf38f('0x46')]=_0x3771f8;}_0x57ec7b(_0x25bfcb);})[_0xf38f('0x32')](function(_0x17c946){_0x2d46b9(_0x17c946);});});}function createEndUser(_0x37b2bf,_0x510314,_0xa6c3d8,_0x3a8ba2,_0x19fe95,_0x3939f8){var _0xa6c3d8=getName(_0xa6c3d8);return request({'method':'POST','uri':_0xf38f('0x47')+_0x510314+_0xf38f('0x48')+_[_0xf38f('0x49')](_0x3939f8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xa6c3d8[0x1],'First_Name':_0xa6c3d8[0x0],'Phone':_0x3a8ba2,'Owner':{'name':!_[_0xf38f('0x21')](_0x19fe95[_0xf38f('0x4a')][_0xf38f('0x1d')])?_0x19fe95[_0xf38f('0x4a')][_0xf38f('0x1d')]:!_[_0xf38f('0x21')](_0x19fe95[_0xf38f('0x4b')])?_0x19fe95[_0xf38f('0x4b')]+'\x20'+_0x19fe95[_0xf38f('0x4c')]:_0x19fe95['last_name'],'id':_0x19fe95['id']}}]},'headers':{'Authorization':_0xf38f('0x3a')+_0x37b2bf},'json':!![]})[_0xf38f('0x2f')](function(_0x1d8362){if(_0x1d8362&&_0x1d8362[_0xf38f('0x45')][0x0]['code']===_0xf38f('0x4d')){var _0x5eadd2=_0x1d8362[_0xf38f('0x45')][0x0][_0xf38f('0x4e')];_0x5eadd2[_0xf38f('0x46')]=_[_0xf38f('0x49')](_0x3939f8[_0xf38f('0x4f')])+'s';return _0x5eadd2;}logger['error'](_0xf38f('0x43'),JSON[_0xf38f('0x10')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xf38f('0x32')](function(_0x143e10){console[_0xf38f('0x50')](_0xf38f('0x51'),_0x143e10);});}function getEndUser(_0x1212bb,_0x46f0c3,_0x5d454,_0x123a07,_0x1afcfa,_0x583d17,_0xfae352){var _0x5e7504={'method':_0xf38f('0x52'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1212bb},'json':!![]};switch(_0xfae352[_0xf38f('0x53')]){case _0xf38f('0x54'):_0x5e7504[_0xf38f('0x55')]='https://www.zohoapis.'+_0x46f0c3+_0xf38f('0x56')+_0x1afcfa+'))';return getZohoUser(_0x5e7504,_0xf38f('0x57'))['then'](function(_0x46fc8a){if(_0x46fc8a)return _0x46fc8a;_0x5e7504[_0xf38f('0x55')]=_0xf38f('0x47')+_0x46f0c3+_0xf38f('0x58')+_0x1afcfa+'))';return getZohoUser(_0x5e7504,'Leads')[_0xf38f('0x2f')](function(_0x4bac5f){if(_0x4bac5f)return _0x4bac5f;if(_0xfae352[_0xf38f('0x4f')]!='nothing'){return createEndUser(_0x1212bb,_0x46f0c3,_0x123a07,_0x1afcfa,_0x583d17,_0xfae352);}else{return{};}});});break;case _0xf38f('0x59'):_0x5e7504['uri']=_0xf38f('0x47')+_0x46f0c3+_0xf38f('0x56')+_0x1afcfa+'))';return getZohoUser(_0x5e7504,'Contacts')[_0xf38f('0x2f')](function(_0x381a55){if(_0x381a55)return _0x381a55;if(_0xfae352[_0xf38f('0x4f')]!=_0xf38f('0x5a')){return createEndUser(_0x1212bb,_0x46f0c3,_0x123a07,_0x1afcfa,_0x583d17,_0xfae352);}else{return{};}});break;case _0xf38f('0x5b'):_0x5e7504[_0xf38f('0x55')]=_0xf38f('0x47')+_0x46f0c3+_0xf38f('0x58')+_0x1afcfa+'))';return getZohoUser(_0x5e7504,_0xf38f('0x5c'))[_0xf38f('0x2f')](function(_0x133a9d){if(_0x133a9d)return _0x133a9d;if(_0xfae352[_0xf38f('0x4f')]!='nothing'){return createEndUser(_0x1212bb,_0x46f0c3,_0x123a07,_0x1afcfa,_0x583d17,_0xfae352);}else{return{};}});break;}}function getCall(_0xb2bc69,_0x44bfed,_0x35adc5,_0x1a32b1,_0x3d91d0,_0x3a517e,_0x58c67d,_0x2cb374){logger['info'](_0xf38f('0x5d'));var _0x400ac9={};_0x400ac9[_0xf38f('0x5e')]={'name':!_[_0xf38f('0x21')](_0x1a32b1[_0xf38f('0x4a')]['name'])&&!_[_0xf38f('0x21')](_0x1a32b1[_0xf38f('0x3f')][_0xf38f('0x1d')])&&_0x1a32b1[_0xf38f('0x3f')]['name']===_0xf38f('0x5f')?_0x1a32b1['role']['name']:!_[_0xf38f('0x21')](_0x1a32b1[_0xf38f('0x4b')])?_0x1a32b1[_0xf38f('0x4b')]+'\x20'+_0x1a32b1['last_name']:_0x1a32b1[_0xf38f('0x4c')],'id':_0x1a32b1['id']};_0x400ac9['Subject']=intUtil[_0xf38f('0x60')](_0x3a517e[_0xf38f('0x61')],_0x58c67d,'\x20');_0x400ac9[_0xf38f('0x62')]=intUtil[_0xf38f('0x60')](_0x3a517e['Descriptions'],_0x58c67d,'\x0a');if(_0x3d91d0['enduserType']===_0xf38f('0x57')){_0x400ac9[_0xf38f('0x63')]={'name':!_['isNil'](_0x3d91d0[_0xf38f('0x64')])?_0x3d91d0[_0xf38f('0x64')]:!_[_0xf38f('0x21')](_0x3d91d0['First_Name'])?_0x3d91d0[_0xf38f('0x65')]+'\x20'+_0x3d91d0[_0xf38f('0x66')]:_0x3d91d0[_0xf38f('0x66')],'id':_0x3d91d0['id']};}if(_0x3d91d0[_0xf38f('0x46')]===_0xf38f('0x5c')){_0x400ac9['What_Id']={'name':!_[_0xf38f('0x21')](_0x3d91d0[_0xf38f('0x64')])?_0x3d91d0['Full_Name']:!_['isNil'](_0x3d91d0[_0xf38f('0x65')])?_0x3d91d0[_0xf38f('0x65')]+'\x20'+_0x3d91d0['Last_Name']:_0x3d91d0[_0xf38f('0x66')],'id':_0x3d91d0['id']};_0x400ac9['$se_module']=_[_0xf38f('0x49')](_0x3d91d0['enduserType']);}if(_0x58c67d['talktime']){_0x400ac9[_0xf38f('0x67')]=moment[_0xf38f('0x68')](parseInt(_0x58c67d[_0xf38f('0x69')])*0x3e8)['format'](_0xf38f('0x6a'));}else if(_0x58c67d[_0xf38f('0x6b')]&&_0x58c67d['endtime']){_0x400ac9[_0xf38f('0x67')]=moment[_0xf38f('0x68')](moment(_0x58c67d[_0xf38f('0x6c')],_0xf38f('0x6d'))[_0xf38f('0x6e')](moment(_0x58c67d[_0xf38f('0x6f')],_0xf38f('0x6d'))))['format'](_0xf38f('0x6a'));}switch(_0x58c67d[_0xf38f('0x70')]){case _0xf38f('0x71'):_0x400ac9[_0xf38f('0x72')]=_0xf38f('0x73');break;case _0xf38f('0x74'):case _0xf38f('0x75'):_0x400ac9['Call_Result']=_0xf38f('0x76');break;case _0xf38f('0x77'):_0x400ac9['Call_Result']=_0xf38f('0x78');break;case _0xf38f('0x79'):_0x400ac9[_0xf38f('0x72')]=_0xf38f('0x7a');break;case'timeout':_0x400ac9[_0xf38f('0x72')]=_0xf38f('0x7b');default:}_0x400ac9[_0xf38f('0x7c')]=(_0x2cb374===_0xf38f('0x7d')?moment(_0x58c67d['starttime'])[_0xf38f('0x37')](_0xf38f('0x6d')):moment(_0x58c67d['agentcalledAt'])[_0xf38f('0x37')](_0xf38f('0x6d')))||moment()[_0xf38f('0x37')]('YYYY-MM-DDTHH:mm:ss');_0x400ac9[_0xf38f('0x7e')]=_0x2cb374||_0xf38f('0x7f');_0x400ac9=_[_0xf38f('0x80')](_0x400ac9,getCustomFields(_0x3a517e[_0xf38f('0x81')],_0x58c67d));return request({'method':'POST','uri':_0xf38f('0x47')+_0x44bfed+_0xf38f('0x82'),'headers':{'Authorization':_0xf38f('0x3a')+_0xb2bc69},'body':{'data':[_0x400ac9]},'json':!![]})['then'](function(_0x91377c){if(_0x91377c&&_0x91377c[_0xf38f('0x45')][0x0][_0xf38f('0x83')]==='SUCCESS'){logger[_0xf38f('0x35')](_0xf38f('0x84'));return{'id':_0x91377c[_0xf38f('0x45')][0x0]['details']['id']};}})['catch'](function(_0xe4a829){logger[_0xf38f('0x35')](_0xf38f('0x85'),_0xe4a829['stack']);console['log']('err',_0xe4a829);});}exports['queue']=function(_0x4184b2,_0x1a68c0,_0xe27800,_0x56ce87,_0x19fe6f,_0x195397){var _0x5f3110,_0x4f8ff4,_0x2a203b;_0x195397[_0xf38f('0x86')]=intUtil[_0xf38f('0x87')](_0x195397[_0xf38f('0x86')]);_0x195397[_0xf38f('0x88')]=intUtil['stripTrailingSlash'](_0x195397[_0xf38f('0x88')]);if(_0x19fe6f&&_0x19fe6f['monitor_format']){logger[_0xf38f('0x35')](_0xf38f('0x89'),'Recording\x20is\x20enabled!');_0x1a68c0[_0xf38f('0x8a')]=_0x195397['serverUrl']+_0xf38f('0x8b')+_0x1a68c0['uniqueid']+_0xf38f('0x8c')+md5(_0x1a68c0[_0xf38f('0x8d')]);}else{_0x1a68c0['recordingURL']='';}var _0x3bc8e6=_0x195397['host']===_0xf38f('0x8e')?'eu':_0xf38f('0x8f');return getAccessToken(_0x195397)[_0xf38f('0x2f')](function(_0x3298fe){_0x2a203b=_0x3298fe;return getUser(_0x2a203b,_0x3bc8e6,_0x195397,_0x56ce87['email']);})[_0xf38f('0x2f')](function(_0x4b3bec){_0x5f3110=_0x4b3bec;logger[_0xf38f('0x35')](_0xf38f('0x90'),_0x5f3110['id']);return getEndUser(_0x2a203b,_0x3bc8e6,_0x195397,_0x1a68c0[_0xf38f('0x91')],_0x1a68c0[_0xf38f('0x92')],_0x5f3110,_0xe27800);})[_0xf38f('0x2f')](function(_0x1bfe34){_0x4f8ff4=_0x1bfe34;return getCall(_0x2a203b,_0x3bc8e6,_0x195397,_0x5f3110,_0x4f8ff4,_0xe27800,_0x1a68c0,_0xf38f('0x7f'));})[_0xf38f('0x2f')](function(_0x46d7c7){if(_0x46d7c7){logger[_0xf38f('0x35')](_0xf38f('0x93'),_0x46d7c7['id']);logger[_0xf38f('0x35')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf38f('0x94'),_0x56ce87[_0xf38f('0x1d')]),_0xf38f('0x95'),{'uri':_0xf38f('0x96')+_0x195397['host']+_0xf38f('0x97')+_0x46d7c7['id']});}})[_0xf38f('0x32')](function(_0x18abe9){logger['error']('[QUEUE]',JSON[_0xf38f('0x10')](_0x18abe9));});};exports['outbound']=function(_0xe72fc,_0x3827b5,_0x5dc4bf,_0x302ead,_0x44850c,_0x265723,_0x2fb2d8){var _0x136ade,_0x27e4d9,_0x5b6ed9;_0x265723[_0xf38f('0x86')]=intUtil[_0xf38f('0x87')](_0x265723[_0xf38f('0x86')]);_0x265723[_0xf38f('0x88')]=intUtil[_0xf38f('0x87')](_0x265723[_0xf38f('0x88')]);if(_0x2fb2d8&&_0x2fb2d8[_0xf38f('0x98')]&&_0x2fb2d8['recordingFormat']!==_0xf38f('0x99')){logger['info']('[OUTBOUND]',_0xf38f('0x9a'));_0x3827b5[_0xf38f('0x8a')]=_0x265723[_0xf38f('0x88')]+_0xf38f('0x8b')+_0x3827b5[_0xf38f('0x8d')]+'/downloads?type=uniqueid&token='+md5(_0x3827b5[_0xf38f('0x8d')]);}var _0x8c5429=_0x265723[_0xf38f('0x86')]==='zoho.eu'?'eu':_0xf38f('0x8f');return getAccessToken(_0x265723)[_0xf38f('0x2f')](function(_0x2fd03e){_0x5b6ed9=_0x2fd03e;return getUser(_0x5b6ed9,_0x8c5429,_0x265723,_0x302ead[_0xf38f('0x3d')]);})['then'](function(_0x27bd62){_0x136ade=_0x27bd62;logger[_0xf38f('0x35')](_0xf38f('0x90'),_0x136ade['id']);return getEndUser(_0x5b6ed9,_0x8c5429,_0x265723,_0x3827b5[_0xf38f('0x9b')],_0x3827b5[_0xf38f('0x9c')],_0x136ade,_0x5dc4bf);})[_0xf38f('0x2f')](function(_0x587f90){_0x27e4d9=_0x587f90;return getCall(_0x5b6ed9,_0x8c5429,_0x265723,_0x136ade,_0x27e4d9,_0x5dc4bf,_0x3827b5,_0xf38f('0x9d'));})[_0xf38f('0x2f')](function(_0x3314af){if(_0x3314af){logger['info'](_0xf38f('0x93'),_0x3314af['id']);logger[_0xf38f('0x35')]('[OUTBOUND]',_0xf38f('0x9e'));emit(util[_0xf38f('0x37')](_0xf38f('0x94'),_0x302ead[_0xf38f('0x1d')]),_0xf38f('0x95'),{'uri':_0xf38f('0x96')+_0x265723[_0xf38f('0x86')]+_0xf38f('0x97')+_0x3314af['id']});}})[_0xf38f('0x32')](function(_0x1bdf42){logger[_0xf38f('0x42')](_0xf38f('0x9f'),JSON[_0xf38f('0x10')](_0x1bdf42));});};exports[_0xf38f('0xa0')]=function(_0x5c0373,_0x9640b3,_0x52aae4,_0xe8ddfa,_0x2815f2,_0x19de52){var _0x5e3790,_0x12533e,_0x2a06c3;_0x19de52[_0xf38f('0x86')]=intUtil[_0xf38f('0x87')](_0x19de52[_0xf38f('0x86')]);_0x19de52[_0xf38f('0x88')]=intUtil[_0xf38f('0x87')](_0x19de52[_0xf38f('0x88')]);if(_0x2815f2&&_0x2815f2['monitor_format']){logger[_0xf38f('0x35')]('['+_0x9640b3[_0xf38f('0x70')]['toUpperCase']()+']',_0xf38f('0x9a'));_0x9640b3[_0xf38f('0x8a')]=_0x19de52[_0xf38f('0x88')]+_0xf38f('0x8b')+_0x9640b3[_0xf38f('0x8d')]+_0xf38f('0x8c')+md5(_0x9640b3['uniqueid']);}else{_0x9640b3[_0xf38f('0x8a')]='';}var _0x34e98d=_0x19de52[_0xf38f('0x86')]===_0xf38f('0x8e')?'eu':_0xf38f('0x8f');return getAccessToken(_0x19de52)['then'](function(_0x591f33){_0x2a06c3=_0x591f33;return getUser(_0x2a06c3,_0x34e98d,_0x19de52);})[_0xf38f('0x2f')](function(_0x48974b){_0x5e3790=_0x48974b;logger[_0xf38f('0x35')]('The\x20User\x20ID\x20is:',_0x5e3790['id']);return getEndUser(_0x2a06c3,_0x34e98d,_0x19de52,_0x9640b3[_0xf38f('0x91')],_0x9640b3[_0xf38f('0x92')],_0x5e3790,_0x52aae4);})[_0xf38f('0x2f')](function(_0xa47b9c){_0x12533e=_0xa47b9c;return getCall(_0x2a06c3,_0x34e98d,_0x19de52,_0x5e3790,_0x12533e,_0x52aae4,_0x9640b3,_0xf38f('0x7f'));})[_0xf38f('0x2f')](function(_0x2cb124){if(_0x2cb124){logger[_0xf38f('0x35')](_0xf38f('0x93'),_0x2cb124['id']);}})[_0xf38f('0x32')](function(_0x4897fa){logger['error']('['+_0x9640b3[_0xf38f('0x70')][_0xf38f('0xa1')]()+']',JSON[_0xf38f('0x10')](_0x4897fa));});}; \ No newline at end of file +var _0x7707=['enduserType','POST','/crm/v2/','startCase','moduleCreate','isNil','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','uri','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','connect','Answered','Rejected','abandoned','Call_Start_Time','Call_Type','merge','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','request-promise','util','./util','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','name','Variable','toLowerCase','split','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data'];(function(_0x384e51,_0x1c297e){var _0x26db91=function(_0x420820){while(--_0x420820){_0x384e51['push'](_0x384e51['shift']());}};_0x26db91(++_0x1c297e);}(_0x7707,0x187));var _0x7770=function(_0x488301,_0x6101b6){_0x488301=_0x488301-0x0;var _0x4de8b8=_0x7707[_0x488301];return _0x4de8b8;};'use strict';var _=require('lodash');var rp=require(_0x7770('0x0'));var md5=require('md5');var util=require(_0x7770('0x1'));var intUtil=require(_0x7770('0x2'));var moment=require('moment');var Redis=require(_0x7770('0x3'));var BPromise=require(_0x7770('0x4'));var config=require('../../../../config/environment');var logger=require(_0x7770('0x5'))(_0x7770('0x6'));config['redis']=_['defaults'](config[_0x7770('0x7')],{'host':_0x7770('0x8'),'port':0x18eb});var io=require(_0x7770('0x9'))(new Redis(config['redis']));function emit(_0x231357,_0x56d6a5,_0x2c56e9){io['to'](_0x231357)[_0x7770('0xa')](_0x56d6a5,_0x2c56e9);}function request(_0x53022f){logger['debug'](_0x7770('0xb'),JSON[_0x7770('0xc')](_0x53022f));return rp(_0x53022f);}function getCustomFields(_0x2af200,_0x162423){var _0x149117={};if(_0x2af200[_0x7770('0xd')]>0x0){_[_0x7770('0xe')](_0x2af200,function(_0x38f589){if(_[_0x7770('0xf')]([_0x7770('0x10'),_0x7770('0x11')],_0x38f589[_0x7770('0x12')])&&_0x38f589[_0x7770('0x13')]){_0x149117[_0x38f589['idField']]=_0x38f589[_0x7770('0x14')]['toString']();}else if(_0x38f589[_0x7770('0x12')]===_0x7770('0x15')&&_0x38f589[_0x7770('0x16')]&&_0x38f589['idField']&&_0x162423[_0x38f589[_0x7770('0x16')]]){_0x149117[_0x38f589['idField']]=_0x162423[_0x38f589[_0x7770('0x16')]][_0x7770('0x17')]();}else if(_0x38f589[_0x7770('0x12')]===_0x7770('0x18')&&_0x38f589['Variable']&&_0x38f589['Variable'][_0x7770('0x19')]&&_0x38f589[_0x7770('0x13')]&&_0x162423[_0x38f589[_0x7770('0x1a')][_0x7770('0x19')][_0x7770('0x1b')]()]){_0x149117[_0x38f589['idField']]=_0x162423[_0x38f589[_0x7770('0x1a')][_0x7770('0x19')][_0x7770('0x1b')]()][_0x7770('0x17')]();}});}return _0x149117;}function getName(_0x2f65ac){if(_0x2f65ac['indexOf']('\x20')>0x0){var _0x8d4248=_0x2f65ac[_0x7770('0x1c')](/ (.+)/);if(_0x8d4248[0x1]){return _0x8d4248;}}return[_0x2f65ac,_0x2f65ac];}var accountsTokens={};function getAccessToken(_0x49d410){return new Promise(function(_0x5967e7,_0x518c63){if(!_['isNil'](accountsTokens[_0x49d410['id']])&&!_['isNil'](accountsTokens[_0x49d410['id']][_0x7770('0x1d')])){if(moment()[_0x7770('0x1e')](accountsTokens[_0x49d410['id']][_0x7770('0x1f')])){_0x5967e7(accountsTokens[_0x49d410['id']][_0x7770('0x1d')]);}}var _0x29caf8;switch(_0x49d410['zone']){case'US':_0x29caf8=_0x7770('0x20');break;case'AU':_0x29caf8='https://accounts.zoho.com.au';break;case'EU':_0x29caf8=_0x7770('0x21');break;case'IN':_0x29caf8=_0x7770('0x22');break;case'CN':_0x29caf8=_0x7770('0x23');break;default:_0x29caf8=_0x7770('0x21');break;}var _0x30ae26={'method':'POST','uri':_0x29caf8+_0x7770('0x24'),'qs':{'refresh_token':_0x49d410['refreshToken'],'client_id':_0x49d410[_0x7770('0x25')],'client_secret':_0x49d410[_0x7770('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x30ae26)[_0x7770('0x27')](function(_0x13d1ca){accountsTokens[_0x49d410['id']]={'access_token':_0x13d1ca['access_token'],'expires_in':moment()[_0x7770('0x28')](_0x13d1ca[_0x7770('0x1f')],_0x7770('0x29'))};_0x5967e7(_0x13d1ca['access_token']);})[_0x7770('0x2a')](function(_0x1667c2){logger[_0x7770('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x1667c2[_0x7770('0x2c')]);_0x518c63(_0x1667c2);});});}function getUser(_0x310e6e,_0x3e10da,_0x18635d,_0x47ff84){logger[_0x7770('0x2d')](_0x7770('0x2e'));return request({'method':_0x7770('0x2f'),'uri':util[_0x7770('0x30')](_0x7770('0x31'),_0x3e10da),'qs':{'type':_0x7770('0x32')},'headers':{'Authorization':_0x7770('0x33')+_0x310e6e},'json':!![]})[_0x7770('0x27')](function(_0x47ecd4){if(_0x47ecd4[_0x7770('0x34')]){var _0x5e30d0=-0x1;if(_[_0x7770('0x35')](_0x47ecd4['users'])){if(!_['isNil'](_0x47ff84)){_0x5e30d0=_[_0x7770('0x36')](_0x47ecd4['users'],function(_0x682985){return _0x682985['email']===_0x47ff84;});}if(_0x5e30d0>=0x0){logger[_0x7770('0x2d')](_0x7770('0x37'));}else{logger['info'](_0x7770('0x38'));_0x5e30d0=_[_0x7770('0x36')](_0x47ecd4[_0x7770('0x34')],function(_0x4ab4ec){return _0x4ab4ec[_0x7770('0x39')][_0x7770('0x19')]===_0x7770('0x3a');});}return _0x47ecd4['users'][_0x5e30d0];}else{if(_0x47ecd4['user']['profile']['name']===_0x7770('0x3a')){logger[_0x7770('0x2d')](_0x7770('0x38'));user=_0x47ecd4['user'];return user;}else{logger[_0x7770('0x2b')](_0x7770('0x3b'),JSON['stringify'](_0x47ecd4));throw new Error(_0x7770('0x3c')+JSON['stringify'](_0x47ecd4));}}}else{logger[_0x7770('0x2b')](_0x7770('0x3b'),JSON[_0x7770('0xc')](_0x47ecd4));throw new Error(_0x7770('0x3c')+JSON[_0x7770('0xc')](_0x47ecd4));}})[_0x7770('0x2a')](function(_0x81f8e5){console['error'](_0x81f8e5);});}function getZohoUser(_0x1dbe2f,_0x5ed204){return new BPromise(function(_0x59e4ed,_0x2f09c4){request(_0x1dbe2f)['then'](function(_0x64cd7c){var _0x3bc917=null;if(_0x64cd7c){_0x3bc917=_0x64cd7c[_0x7770('0x3d')][0x0];_0x3bc917[_0x7770('0x3e')]=_0x5ed204;}_0x59e4ed(_0x3bc917);})[_0x7770('0x2a')](function(_0x52f26d){_0x2f09c4(_0x52f26d);});});}function createEndUser(_0x2520e5,_0x1aa642,_0x5199d2,_0x4c82a1,_0x219a97,_0x36dbac){var _0x5199d2=getName(_0x5199d2);return request({'method':_0x7770('0x3f'),'uri':'https://www.zohoapis.'+_0x1aa642+_0x7770('0x40')+_[_0x7770('0x41')](_0x36dbac[_0x7770('0x42')])+'s','body':{'data':[{'Last_Name':_0x5199d2[0x1],'First_Name':_0x5199d2[0x0],'Phone':_0x4c82a1,'Owner':{'name':!_[_0x7770('0x43')](_0x219a97[_0x7770('0x44')]['name'])?_0x219a97[_0x7770('0x44')]['name']:!_[_0x7770('0x43')](_0x219a97['first_name'])?_0x219a97['first_name']+'\x20'+_0x219a97['last_name']:_0x219a97[_0x7770('0x45')],'id':_0x219a97['id']}}]},'headers':{'Authorization':_0x7770('0x33')+_0x2520e5},'json':!![]})[_0x7770('0x27')](function(_0xbd3a64){if(_0xbd3a64&&_0xbd3a64[_0x7770('0x3d')][0x0][_0x7770('0x46')]===_0x7770('0x47')){var _0x54656d=_0xbd3a64['data'][0x0][_0x7770('0x48')];_0x54656d[_0x7770('0x3e')]=_[_0x7770('0x41')](_0x36dbac['moduleCreate'])+'s';return _0x54656d;}logger[_0x7770('0x2b')](_0x7770('0x3b'),JSON['stringify'](data));throw new Error(_0x7770('0x49')+JSON[_0x7770('0xc')](data));})[_0x7770('0x2a')](function(_0x3cc41f){console[_0x7770('0x4a')](_0x7770('0x4b'),_0x3cc41f);});}function getEndUser(_0x4a03d0,_0x5b5c2,_0x1c001b,_0xe3bb37,_0x1c07fa,_0x3f53bc,_0xc22687){var _0x162bb8={'method':_0x7770('0x2f'),'uri':'','headers':{'Authorization':_0x7770('0x33')+_0x4a03d0},'json':!![]};switch(_0xc22687['moduleSearch']){case'contact_lead':_0x162bb8['uri']=_0x7770('0x4c')+_0x5b5c2+_0x7770('0x4d')+_0x1c07fa+'))';return getZohoUser(_0x162bb8,'Contacts')['then'](function(_0x18dd6d){if(_0x18dd6d)return _0x18dd6d;_0x162bb8['uri']=_0x7770('0x4c')+_0x5b5c2+_0x7770('0x4e')+_0x1c07fa+'))';return getZohoUser(_0x162bb8,_0x7770('0x4f'))[_0x7770('0x27')](function(_0x701849){if(_0x701849)return _0x701849;if(_0xc22687[_0x7770('0x42')]!=_0x7770('0x50')){return createEndUser(_0x4a03d0,_0x5b5c2,_0xe3bb37,_0x1c07fa,_0x3f53bc,_0xc22687);}else{return{};}});});break;case _0x7770('0x51'):_0x162bb8[_0x7770('0x52')]=_0x7770('0x4c')+_0x5b5c2+_0x7770('0x4d')+_0x1c07fa+'))';return getZohoUser(_0x162bb8,_0x7770('0x53'))[_0x7770('0x27')](function(_0x1d4fee){if(_0x1d4fee)return _0x1d4fee;if(_0xc22687[_0x7770('0x42')]!=_0x7770('0x50')){return createEndUser(_0x4a03d0,_0x5b5c2,_0xe3bb37,_0x1c07fa,_0x3f53bc,_0xc22687);}else{return{};}});break;case _0x7770('0x54'):_0x162bb8[_0x7770('0x52')]=_0x7770('0x4c')+_0x5b5c2+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1c07fa+'))';return getZohoUser(_0x162bb8,_0x7770('0x4f'))['then'](function(_0x228dce){if(_0x228dce)return _0x228dce;if(_0xc22687['moduleCreate']!=_0x7770('0x50')){return createEndUser(_0x4a03d0,_0x5b5c2,_0xe3bb37,_0x1c07fa,_0x3f53bc,_0xc22687);}else{return{};}});break;}}function getCall(_0x461613,_0x1e75c8,_0x33af21,_0xd67fa2,_0x268ecb,_0x41f930,_0x357b8e,_0x35a5bf){logger[_0x7770('0x2d')](_0x7770('0x55'));var _0x380d82={};_0x380d82[_0x7770('0x56')]={'name':!_['isNil'](_0xd67fa2[_0x7770('0x44')][_0x7770('0x19')])&&!_['isNil'](_0xd67fa2[_0x7770('0x39')][_0x7770('0x19')])&&_0xd67fa2['profile']['name']===_0x7770('0x57')?_0xd67fa2[_0x7770('0x44')][_0x7770('0x19')]:!_['isNil'](_0xd67fa2[_0x7770('0x58')])?_0xd67fa2['first_name']+'\x20'+_0xd67fa2[_0x7770('0x45')]:_0xd67fa2[_0x7770('0x45')],'id':_0xd67fa2['id']};_0x380d82[_0x7770('0x59')]=intUtil[_0x7770('0x5a')](_0x41f930['Subjects'],_0x357b8e,'\x20');_0x380d82['Description']=intUtil[_0x7770('0x5a')](_0x41f930['Descriptions'],_0x357b8e,'\x0a');if(_0x268ecb['enduserType']===_0x7770('0x53')){_0x380d82[_0x7770('0x5b')]={'name':!_[_0x7770('0x43')](_0x268ecb[_0x7770('0x5c')])?_0x268ecb[_0x7770('0x5c')]:!_[_0x7770('0x43')](_0x268ecb[_0x7770('0x5d')])?_0x268ecb['First_Name']+'\x20'+_0x268ecb[_0x7770('0x5e')]:_0x268ecb[_0x7770('0x5e')],'id':_0x268ecb['id']};}if(_0x268ecb[_0x7770('0x3e')]===_0x7770('0x4f')){_0x380d82['What_Id']={'name':!_[_0x7770('0x43')](_0x268ecb[_0x7770('0x5c')])?_0x268ecb['Full_Name']:!_[_0x7770('0x43')](_0x268ecb['First_Name'])?_0x268ecb[_0x7770('0x5d')]+'\x20'+_0x268ecb[_0x7770('0x5e')]:_0x268ecb['Last_Name'],'id':_0x268ecb['id']};_0x380d82[_0x7770('0x5f')]=_[_0x7770('0x41')](_0x268ecb['enduserType']);}if(_0x357b8e[_0x7770('0x60')]){_0x380d82[_0x7770('0x61')]=moment['utc'](parseInt(_0x357b8e['talktime'])*0x3e8)['format'](_0x7770('0x62'));}else if(_0x357b8e[_0x7770('0x63')]&&_0x357b8e[_0x7770('0x64')]){_0x380d82['Call_Duration']=moment[_0x7770('0x65')](moment(_0x357b8e[_0x7770('0x64')],_0x7770('0x66'))[_0x7770('0x67')](moment(_0x357b8e[_0x7770('0x68')],_0x7770('0x66'))))[_0x7770('0x30')](_0x7770('0x62'));}switch(_0x357b8e['lastevent']){case _0x7770('0x69'):_0x380d82[_0x7770('0x6a')]=_0x7770('0x6b');break;case'complete':case _0x7770('0x6c'):_0x380d82[_0x7770('0x6a')]=_0x7770('0x6d');break;case'rejected':_0x380d82[_0x7770('0x6a')]=_0x7770('0x6e');break;case _0x7770('0x6f'):_0x380d82[_0x7770('0x6a')]='Abandoned';break;case'timeout':_0x380d82[_0x7770('0x6a')]='Timeout';default:}_0x380d82[_0x7770('0x70')]=(_0x35a5bf==='outbound'?moment(_0x357b8e[_0x7770('0x68')])[_0x7770('0x30')](_0x7770('0x66')):moment(_0x357b8e['agentcalledAt'])[_0x7770('0x30')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x7770('0x30')](_0x7770('0x66'));_0x380d82[_0x7770('0x71')]=_0x35a5bf||'Inbound';_0x380d82=_[_0x7770('0x72')](_0x380d82,getCustomFields(_0x41f930['Fields'],_0x357b8e));return request({'method':_0x7770('0x3f'),'uri':_0x7770('0x4c')+_0x1e75c8+_0x7770('0x73'),'headers':{'Authorization':_0x7770('0x33')+_0x461613},'body':{'data':[_0x380d82]},'json':!![]})[_0x7770('0x27')](function(_0xd16461){if(_0xd16461&&_0xd16461[_0x7770('0x3d')][0x0][_0x7770('0x46')]==='SUCCESS'){logger['info'](_0x7770('0x74'));return{'id':_0xd16461[_0x7770('0x3d')][0x0][_0x7770('0x48')]['id']};}})['catch'](function(_0x43f438){logger[_0x7770('0x2d')]('err',_0x43f438[_0x7770('0x2c')]);console[_0x7770('0x4a')](_0x7770('0x75'),_0x43f438);});}exports[_0x7770('0x76')]=function(_0x39c399,_0xbf0113,_0x14ec84,_0x3c22e2,_0xb9d685,_0x3cfdff){var _0x4c4329,_0x1672ad,_0x1e3f8f;_0x3cfdff['host']=intUtil[_0x7770('0x77')](_0x3cfdff[_0x7770('0x78')]);_0x3cfdff['serverUrl']=intUtil[_0x7770('0x77')](_0x3cfdff[_0x7770('0x79')]);if(_0xb9d685&&_0xb9d685[_0x7770('0x7a')]){logger[_0x7770('0x2d')](_0x7770('0x7b'),_0x7770('0x7c'));_0xbf0113[_0x7770('0x7d')]=_0x3cfdff['serverUrl']+_0x7770('0x7e')+_0xbf0113[_0x7770('0x7f')]+_0x7770('0x80')+md5(_0xbf0113[_0x7770('0x7f')]);}else{_0xbf0113[_0x7770('0x7d')]='';}var _0x23aeff=_0x3cfdff['host']==='zoho.eu'?'eu':_0x7770('0x81');return getAccessToken(_0x3cfdff)[_0x7770('0x27')](function(_0x36d22e){_0x1e3f8f=_0x36d22e;return getUser(_0x1e3f8f,_0x23aeff,_0x3cfdff,_0x3c22e2['email']);})[_0x7770('0x27')](function(_0x5bc985){_0x4c4329=_0x5bc985;logger[_0x7770('0x2d')](_0x7770('0x82'),_0x4c4329['id']);return getEndUser(_0x1e3f8f,_0x23aeff,_0x3cfdff,_0xbf0113[_0x7770('0x83')],_0xbf0113[_0x7770('0x84')],_0x4c4329,_0x14ec84);})[_0x7770('0x27')](function(_0x4966f5){_0x1672ad=_0x4966f5;return getCall(_0x1e3f8f,_0x23aeff,_0x3cfdff,_0x4c4329,_0x1672ad,_0x14ec84,_0xbf0113,_0x7770('0x85'));})[_0x7770('0x27')](function(_0x2f5bfa){if(_0x2f5bfa){logger[_0x7770('0x2d')](_0x7770('0x86'),_0x2f5bfa['id']);logger[_0x7770('0x2d')](_0x7770('0x7b'),_0x7770('0x87'));emit(util['format'](_0x7770('0x88'),_0x3c22e2[_0x7770('0x19')]),_0x7770('0x89'),{'uri':_0x7770('0x8a')+_0x3cfdff['host']+_0x7770('0x8b')+_0x2f5bfa['id']});}})[_0x7770('0x2a')](function(_0x248e28){logger[_0x7770('0x2b')]('[QUEUE]',JSON['stringify'](_0x248e28));});};exports[_0x7770('0x8c')]=function(_0x2b2f6e,_0xb39d0c,_0x3819ff,_0x56b3ca,_0x4bb254,_0x439999,_0x250fec){var _0x77a25c,_0x514598,_0x447a4f;_0x439999['host']=intUtil[_0x7770('0x77')](_0x439999['host']);_0x439999[_0x7770('0x79')]=intUtil[_0x7770('0x77')](_0x439999[_0x7770('0x79')]);if(_0x250fec&&_0x250fec['recordingFormat']&&_0x250fec[_0x7770('0x8d')]!==_0x7770('0x8e')){logger['info'](_0x7770('0x8f'),_0x7770('0x7c'));_0xb39d0c[_0x7770('0x7d')]=_0x439999[_0x7770('0x79')]+'/api/voice/recordings/'+_0xb39d0c['uniqueid']+_0x7770('0x80')+md5(_0xb39d0c[_0x7770('0x7f')]);}var _0x97043e=_0x439999['host']===_0x7770('0x90')?'eu':'com';return getAccessToken(_0x439999)['then'](function(_0x3646e1){_0x447a4f=_0x3646e1;return getUser(_0x447a4f,_0x97043e,_0x439999,_0x56b3ca[_0x7770('0x91')]);})['then'](function(_0x1d7865){_0x77a25c=_0x1d7865;logger[_0x7770('0x2d')]('The\x20User\x20ID\x20is:',_0x77a25c['id']);return getEndUser(_0x447a4f,_0x97043e,_0x439999,_0xb39d0c['destcalleridname'],_0xb39d0c[_0x7770('0x92')],_0x77a25c,_0x3819ff);})[_0x7770('0x27')](function(_0x4e433a){_0x514598=_0x4e433a;return getCall(_0x447a4f,_0x97043e,_0x439999,_0x77a25c,_0x514598,_0x3819ff,_0xb39d0c,_0x7770('0x93'));})[_0x7770('0x27')](function(_0x2c3890){if(_0x2c3890){logger[_0x7770('0x2d')](_0x7770('0x86'),_0x2c3890['id']);logger['info'](_0x7770('0x8f'),_0x7770('0x87'));emit(util['format'](_0x7770('0x88'),_0x56b3ca['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x439999[_0x7770('0x78')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2c3890['id']});}})[_0x7770('0x2a')](function(_0x27c303){logger['error'](_0x7770('0x8f'),JSON['stringify'](_0x27c303));});};exports[_0x7770('0x94')]=function(_0x5e988c,_0x19a622,_0x1c5eec,_0x2c0976,_0x38cc93,_0x107877){var _0x4e1971,_0x1b5a16,_0x31262f;_0x107877['host']=intUtil[_0x7770('0x77')](_0x107877[_0x7770('0x78')]);_0x107877[_0x7770('0x79')]=intUtil[_0x7770('0x77')](_0x107877[_0x7770('0x79')]);if(_0x38cc93&&_0x38cc93[_0x7770('0x7a')]){logger[_0x7770('0x2d')]('['+_0x19a622[_0x7770('0x95')]['toUpperCase']()+']',_0x7770('0x7c'));_0x19a622[_0x7770('0x7d')]=_0x107877[_0x7770('0x79')]+_0x7770('0x7e')+_0x19a622['uniqueid']+_0x7770('0x80')+md5(_0x19a622[_0x7770('0x7f')]);}else{_0x19a622['recordingURL']='';}var _0x157620=_0x107877['host']===_0x7770('0x90')?'eu':_0x7770('0x81');return getAccessToken(_0x107877)[_0x7770('0x27')](function(_0x844c99){_0x31262f=_0x844c99;return getUser(_0x31262f,_0x157620,_0x107877);})[_0x7770('0x27')](function(_0x3811f7){_0x4e1971=_0x3811f7;logger[_0x7770('0x2d')](_0x7770('0x82'),_0x4e1971['id']);return getEndUser(_0x31262f,_0x157620,_0x107877,_0x19a622['calleridname'],_0x19a622[_0x7770('0x84')],_0x4e1971,_0x1c5eec);})[_0x7770('0x27')](function(_0x2988ff){_0x1b5a16=_0x2988ff;return getCall(_0x31262f,_0x157620,_0x107877,_0x4e1971,_0x1b5a16,_0x1c5eec,_0x19a622,'Inbound');})[_0x7770('0x27')](function(_0x216446){if(_0x216446){logger[_0x7770('0x2d')](_0x7770('0x86'),_0x216446['id']);}})[_0x7770('0x2a')](function(_0x5166e2){logger[_0x7770('0x2b')]('['+_0x19a622[_0x7770('0x95')][_0x7770('0x96')]()+']',JSON[_0x7770('0xc')](_0x5166e2));});}; \ 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 bad67ac..5a9d875 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 _0x1cfa=['exec','data2','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger'];(function(_0x34ed6f,_0x5e4021){var _0x1db386=function(_0xcf95f7){while(--_0xcf95f7){_0x34ed6f['push'](_0x34ed6f['shift']());}};_0x1db386(++_0x5e4021);}(_0x1cfa,0xf3));var _0xa1cf=function(_0x16e751,_0x458e62){_0x16e751=_0x16e751-0x0;var _0x52f14f=_0x1cfa[_0x16e751];return _0x52f14f;};'use strict';var util=require(_0xa1cf('0x0'));var sh=require(_0xa1cf('0x1'));var Mustache=require('mustache');var logger=require(_0xa1cf('0x2'))(_0xa1cf('0x3'));exports[_0xa1cf('0x4')]=function(_0x5af4b3,_0x4687e6){var _0x3eb758=_0x5af4b3[_0xa1cf('0x5')]?_0x5af4b3['data2']:'Script';var _0x49c892=_0x5af4b3['data3']?Mustache[_0xa1cf('0x6')](_0x5af4b3[_0xa1cf('0x7')],_0x4687e6):_0x4687e6;sh[_0xa1cf('0x4')](_0x49c892,function(_0x388f91,_0x3d86ea,_0x322812){if(_0x388f91!==0x0){logger[_0xa1cf('0x8')](util[_0xa1cf('0x9')](_0xa1cf('0xa'),_0x3eb758,_0x49c892,_0x388f91,_0x322812));}else{logger[_0xa1cf('0xb')](util[_0xa1cf('0x9')](_0xa1cf('0xc'),_0x3eb758,_0x49c892,_0x3d86ea));}});}; \ No newline at end of file +var _0xc7fa=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error'];(function(_0x1d9b92,_0xd5046a){var _0x131a95=function(_0x42d9c8){while(--_0x42d9c8){_0x1d9b92['push'](_0x1d9b92['shift']());}};_0x131a95(++_0xd5046a);}(_0xc7fa,0x1d6));var _0xac7f=function(_0x523ae7,_0x2737ba){_0x523ae7=_0x523ae7-0x0;var _0x4f3dab=_0xc7fa[_0x523ae7];return _0x4f3dab;};'use strict';var util=require(_0xac7f('0x0'));var sh=require(_0xac7f('0x1'));var Mustache=require(_0xac7f('0x2'));var logger=require(_0xac7f('0x3'))(_0xac7f('0x4'));exports[_0xac7f('0x5')]=function(_0x57df38,_0x318363){var _0x353390=_0x57df38[_0xac7f('0x6')]?_0x57df38[_0xac7f('0x6')]:_0xac7f('0x7');var _0x39e643=_0x57df38[_0xac7f('0x8')]?Mustache['render'](_0x57df38['data3'],_0x318363):_0x318363;sh[_0xac7f('0x5')](_0x39e643,function(_0x3edca9,_0x242962,_0x397240){if(_0x3edca9!==0x0){logger[_0xac7f('0x9')](util[_0xac7f('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x353390,_0x39e643,_0x3edca9,_0x397240));}else{logger['info'](util[_0xac7f('0xa')](_0xac7f('0xb'),_0x353390,_0x39e643,_0x242962));}});}; \ 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 d023e3a..682b950 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 _0x6f16=['POST','PUT','parse','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data2','data5','number','headers','data6','render','error','data1','toUpperCase','GET','DELETE'];(function(_0x567168,_0x599f19){var _0x632a3f=function(_0x330258){while(--_0x330258){_0x567168['push'](_0x567168['shift']());}};_0x632a3f(++_0x599f19);}(_0x6f16,0x1f4));var _0x66f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f16[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x66f1('0x0'));var util=require(_0x66f1('0x1'));var _=require(_0x66f1('0x2'));var Mustache=require(_0x66f1('0x3'));var logger=require(_0x66f1('0x4'))(_0x66f1('0x5'));exports[_0x66f1('0x6')]=function(_0x2a60b6,_0x34226a){var _0x35baed,_0x24b363;var _0x4495d3={'method':_0x2a60b6['data1']['toUpperCase'](),'uri':Mustache['render'](_0x2a60b6[_0x66f1('0x7')],_0x34226a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a60b6[_0x66f1('0x8')])===_0x66f1('0x9')&&parseInt(_0x2a60b6[_0x66f1('0x8')])>=0x1&&parseInt(_0x2a60b6[_0x66f1('0x8')])<=0xa?parseInt(_0x2a60b6[_0x66f1('0x8')])*0x3e8:0x5*0x3e8};try{_0x4495d3[_0x66f1('0xa')]=_0x2a60b6[_0x66f1('0xb')]?JSON['parse'](Mustache[_0x66f1('0xc')](_0x2a60b6[_0x66f1('0xb')],_0x34226a)):{};}catch(_0x4ac820){logger[_0x66f1('0xd')](_0x4ac820['stack']);}switch(_0x2a60b6[_0x66f1('0xe')][_0x66f1('0xf')]()){case _0x66f1('0x10'):case _0x66f1('0x11'):_0x35baed=null;_0x4495d3['qs']=_0x34226a;break;case _0x66f1('0x12'):case _0x66f1('0x13'):if(_0x2a60b6['data7']){try{_0x35baed=JSON[_0x66f1('0x14')](Mustache[_0x66f1('0xc')](_0x2a60b6[_0x66f1('0x15')],_0x34226a));_0x4495d3[_0x66f1('0x16')]=_0x35baed;}catch(_0x14526c){logger[_0x66f1('0xd')](_0x14526c[_0x66f1('0x17')]);logger[_0x66f1('0xd')](_0x66f1('0x18'));}}else{_0x35baed=_0x34226a;_0x4495d3['body']=_0x35baed;}break;}logger['info'](util[_0x66f1('0x19')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2a60b6[_0x66f1('0xe')],_0x2a60b6['data2'],JSON[_0x66f1('0x1a')](_0x4495d3)));rp(_0x4495d3)['then'](function(_0x1dc1b4){_0x35baed=!_[_0x66f1('0x1b')](_0x35baed)?_0x66f1('0x1c')+_0x35baed:'';_0x24b363=typeof _0x1dc1b4['body']===_0x66f1('0x1d')?JSON[_0x66f1('0x1a')](_0x1dc1b4[_0x66f1('0x16')]):_0x1dc1b4['body'];logger[_0x66f1('0x1e')](util[_0x66f1('0x19')](_0x66f1('0x1f'),_0x2a60b6['data1'],_0x2a60b6[_0x66f1('0x7')],_0x1dc1b4[_0x66f1('0x20')],_0x24b363));})[_0x66f1('0x21')](function(_0x114aac){logger[_0x66f1('0xd')](util['format'](_0x66f1('0x22'),_0x2a60b6[_0x66f1('0xe')],_0x2a60b6[_0x66f1('0x7')],_0x114aac[_0x66f1('0x20')],_0x114aac[_0x66f1('0x23')],_0x114aac[_0x66f1('0x24')]));});}; \ No newline at end of file +var _0xe45b=['util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','headers','data6','parse','stack','data1','GET','DELETE','POST','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','object','stringify','%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','message','request-promise'];(function(_0x4c5613,_0x423f6f){var _0x49cb2f=function(_0x331151){while(--_0x331151){_0x4c5613['push'](_0x4c5613['shift']());}};_0x49cb2f(++_0x423f6f);}(_0xe45b,0x1d3));var _0xbe45=function(_0x1db170,_0x42ab9b){_0x1db170=_0x1db170-0x0;var _0x3e0ea6=_0xe45b[_0x1db170];return _0x3e0ea6;};'use strict';var rp=require(_0xbe45('0x0'));var util=require(_0xbe45('0x1'));var _=require(_0xbe45('0x2'));var Mustache=require(_0xbe45('0x3'));var logger=require(_0xbe45('0x4'))(_0xbe45('0x5'));exports[_0xbe45('0x6')]=function(_0x33ec7f,_0x5569c4){var _0x3275dc,_0x1ef775;var _0x22ea0e={'method':_0x33ec7f['data1'][_0xbe45('0x7')](),'uri':Mustache[_0xbe45('0x8')](_0x33ec7f[_0xbe45('0x9')],_0x5569c4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x33ec7f[_0xbe45('0xa')])==='number'&&parseInt(_0x33ec7f[_0xbe45('0xa')])>=0x1&&parseInt(_0x33ec7f[_0xbe45('0xa')])<=0xa?parseInt(_0x33ec7f[_0xbe45('0xa')])*0x3e8:0x5*0x3e8};try{_0x22ea0e[_0xbe45('0xb')]=_0x33ec7f[_0xbe45('0xc')]?JSON[_0xbe45('0xd')](Mustache['render'](_0x33ec7f[_0xbe45('0xc')],_0x5569c4)):{};}catch(_0x10a086){logger['error'](_0x10a086[_0xbe45('0xe')]);}switch(_0x33ec7f[_0xbe45('0xf')][_0xbe45('0x7')]()){case _0xbe45('0x10'):case _0xbe45('0x11'):_0x3275dc=null;_0x22ea0e['qs']=_0x5569c4;break;case _0xbe45('0x12'):case _0xbe45('0x13'):if(_0x33ec7f[_0xbe45('0x14')]){try{_0x3275dc=JSON[_0xbe45('0xd')](Mustache[_0xbe45('0x8')](_0x33ec7f[_0xbe45('0x14')],_0x5569c4));_0x22ea0e['body']=_0x3275dc;}catch(_0x6432a6){logger[_0xbe45('0x15')](_0x6432a6['stack']);logger[_0xbe45('0x15')](_0xbe45('0x16'));}}else{_0x3275dc=_0x5569c4;_0x22ea0e[_0xbe45('0x17')]=_0x3275dc;}break;}logger[_0xbe45('0x18')](util[_0xbe45('0x19')](_0xbe45('0x1a'),_0x33ec7f[_0xbe45('0xf')],_0x33ec7f['data2'],JSON['stringify'](_0x22ea0e)));rp(_0x22ea0e)['then'](function(_0x21a903){_0x3275dc=!_[_0xbe45('0x1b')](_0x3275dc)?_0xbe45('0x1c')+_0x3275dc:'';_0x1ef775=typeof _0x21a903['body']===_0xbe45('0x1d')?JSON[_0xbe45('0x1e')](_0x21a903['body']):_0x21a903[_0xbe45('0x17')];logger[_0xbe45('0x18')](util[_0xbe45('0x19')](_0xbe45('0x1f'),_0x33ec7f[_0xbe45('0xf')],_0x33ec7f[_0xbe45('0x9')],_0x21a903[_0xbe45('0x20')],_0x1ef775));})[_0xbe45('0x21')](function(_0x5560d8){logger['error'](util[_0xbe45('0x19')](_0xbe45('0x22'),_0x33ec7f[_0xbe45('0xf')],_0x33ec7f['data2'],_0x5560d8[_0xbe45('0x20')],_0x5560d8['name'],_0x5560d8[_0xbe45('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a37c490..db24555 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 _0x850a=['error','rpc','message','exports','../../config/logger','routing','client','Request','request','then','debug'];(function(_0x1cdeed,_0x263bf7){var _0x4150a1=function(_0x4d7f39){while(--_0x4d7f39){_0x1cdeed['push'](_0x1cdeed['shift']());}};_0x4150a1(++_0x263bf7);}(_0x850a,0x17a));var _0xa850=function(_0x502036,_0x502686){_0x502036=_0x502036-0x0;var _0x485247=_0x850a[_0x502036];return _0x485247;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xa850('0x0'))(_0xa850('0x1'));var client=jayson[_0xa850('0x2')]['http']({'port':0x2329});client[_0xa850('0x3')]=function(_0x116a4a,_0x3a564b){return new BPromise(function(_0x5dce60,_0x5d73c4){return client[_0xa850('0x4')](_0x116a4a,_0x3a564b)[_0xa850('0x5')](function(_0x4feef9){logger[_0xa850('0x6')]('rpc','routing',_0x116a4a,_0x3a564b,_0x4feef9);if(_0x4feef9[_0xa850('0x7')]){logger[_0xa850('0x7')](_0xa850('0x8'),_0xa850('0x1'),_0x116a4a,_0x4feef9[_0xa850('0x7')][_0xa850('0x9')],_0x3a564b);return _0x5d73c4(_0x4feef9[_0xa850('0x7')]['message']);}else{return _0x5dce60(_0x4feef9['result']);}})['catch'](function(_0x2f86a2){logger[_0xa850('0x7')]('rpc',_0xa850('0x1'),_0x116a4a,_0x2f86a2,_0x3a564b);return _0x5d73c4(_0x2f86a2);});});};module[_0xa850('0xa')]=client; \ No newline at end of file +var _0xc901=['bluebird','../../config/logger','routing','http','Request','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x493c5b,_0x4523de){var _0x3e487d=function(_0x3c4c48){while(--_0x3c4c48){_0x493c5b['push'](_0x493c5b['shift']());}};_0x3e487d(++_0x4523de);}(_0xc901,0x107));var _0x1c90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc901[_0x42cae2];return _0x5f256f;};'use strict';var jayson=require(_0x1c90('0x0'));var BPromise=require(_0x1c90('0x1'));var logger=require(_0x1c90('0x2'))(_0x1c90('0x3'));var client=jayson['client'][_0x1c90('0x4')]({'port':0x2329});client[_0x1c90('0x5')]=function(_0x4f6e0d,_0x383c7e){return new BPromise(function(_0x7658b5,_0x4a3887){return client['request'](_0x4f6e0d,_0x383c7e)['then'](function(_0x5cbb2d){logger[_0x1c90('0x6')](_0x1c90('0x7'),_0x1c90('0x3'),_0x4f6e0d,_0x383c7e,_0x5cbb2d);if(_0x5cbb2d[_0x1c90('0x8')]){logger[_0x1c90('0x8')](_0x1c90('0x7'),'routing',_0x4f6e0d,_0x5cbb2d['error'][_0x1c90('0x9')],_0x383c7e);return _0x4a3887(_0x5cbb2d[_0x1c90('0x8')][_0x1c90('0x9')]);}else{return _0x7658b5(_0x5cbb2d[_0x1c90('0xa')]);}})['catch'](function(_0x133b02){logger['error'](_0x1c90('0x7'),_0x1c90('0x3'),_0x4f6e0d,_0x133b02,_0x383c7e);return _0x4a3887(_0x133b02);});});};module[_0x1c90('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8f98d85..3f5167c 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 _0x28c8=['loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings'];(function(_0x4489b6,_0x47c466){var _0x13a4bb=function(_0x25092f){while(--_0x25092f){_0x4489b6['push'](_0x4489b6['shift']());}};_0x13a4bb(++_0x47c466);}(_0x28c8,0x136));var _0x828c=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x28c8[_0x4953da];return _0x2d3780;};'use strict';var server=require(_0x828c('0x0'));var Realtime=require(_0x828c('0x1'));var EmailChannel=require(_0x828c('0x2'));var mailAccount=require(_0x828c('0x3'));var setting=require(_0x828c('0x4'));var logger=require(_0x828c('0x5'))(_0x828c('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x828c('0x7')]()[_0x828c('0x8')](mailAccount[_0x828c('0x9')]())[_0x828c('0x8')](realtime[_0x828c('0xa')]())[_0x828c('0x8')](function(){email[_0x828c('0xb')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x828c('0xc')](realtime,email)[_0x828c('0x8')](function(){return initRealtime();})[_0x828c('0x8')](function(){return setting[_0x828c('0xd')]();})[_0x828c('0x8')](function(_0x28e280){return setInterval(initRealtime,_0x28e280[_0x828c('0xe')]*0x3e8);})[_0x828c('0xf')](function(_0x528781){logger[_0x828c('0x10')](_0x828c('0x11'),_0x528781);});}main(); \ No newline at end of file +var _0xc9f2=['loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9f2,0x7b));var _0x2c9f=function(_0x338bf6,_0x14b20c){_0x338bf6=_0x338bf6-0x0;var _0x5da130=_0xc9f2[_0x338bf6];return _0x5da130;};'use strict';var server=require(_0x2c9f('0x0'));var Realtime=require(_0x2c9f('0x1'));var EmailChannel=require(_0x2c9f('0x2'));var mailAccount=require(_0x2c9f('0x3'));var setting=require(_0x2c9f('0x4'));var logger=require('../../config/logger')(_0x2c9f('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2c9f('0x6')]()[_0x2c9f('0x7')](mailAccount[_0x2c9f('0x8')]())[_0x2c9f('0x7')](realtime[_0x2c9f('0x9')]())[_0x2c9f('0x7')](function(){email['refresh'](realtime[_0x2c9f('0xa')]);return realtime;});}function main(){return server[_0x2c9f('0xb')](realtime,email)[_0x2c9f('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x2c9f('0xc')]();})[_0x2c9f('0x7')](function(_0x32f766){return setInterval(initRealtime,_0x32f766[_0x2c9f('0xd')]*0x3e8);})[_0x2c9f('0xe')](function(_0x34be3a){logger[_0x2c9f('0xf')](_0x2c9f('0x10'),_0x34be3a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 5a11d76..b7fd420 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 _0xb454=['sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','connected','messages','handleImapEmail','info','firstName','from','notify','then','catch'];(function(_0x3a142b,_0x40aeff){var _0x3ad829=function(_0x90ef7a){while(--_0x90ef7a){_0x3a142b['push'](_0x3a142b['shift']());}};_0x3ad829(++_0x40aeff);}(_0xb454,0x79));var _0x4b45=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0xb454[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0x4b45('0x0'));var moment=require(_0x4b45('0x1'));var BPromise=require(_0x4b45('0x2'));var md5=require(_0x4b45('0x3'));var Redis=require(_0x4b45('0x4'));var config=require(_0x4b45('0x5'));var logger=require('../../../config/logger')(_0x4b45('0x6'));config['redis']=_[_0x4b45('0x7')](config[_0x4b45('0x8')],{'host':_0x4b45('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b45('0x8')]));var EmailImap=require(_0x4b45('0xa'));var EmailSmtp=require(_0x4b45('0xb'));var mailAccount=require(_0x4b45('0xc'));var md5Accounts={};function EmailChannel(_0x3553fc){logger['info'](_0x4b45('0xd'));this[_0x4b45('0xe')]=_0x3553fc[_0x4b45('0xe')];this[_0x4b45('0xf')]={};this[_0x4b45('0x10')]=new EmailSmtp();}EmailChannel[_0x4b45('0x11')][_0x4b45('0x12')]=function(_0x1122dc){var _0x9d6ce1=this[_0x4b45('0xe')][_0x1122dc];var _0x1c774e={'id':_0x9d6ce1['id'],'name':_0x9d6ce1[_0x4b45('0x13')],'key':_0x9d6ce1[_0x4b45('0x14')],'active':_0x9d6ce1[_0x4b45('0x15')],'Imap':{'status':_0x9d6ce1[_0x4b45('0x16')][_0x4b45('0x17')],'messageStatus':_0x9d6ce1[_0x4b45('0x16')][_0x4b45('0x18')],'total':_0x9d6ce1[_0x4b45('0x16')][_0x4b45('0x19')]}};if(_['isNil'](md5Accounts[_0x1122dc])){md5Accounts[_0x1122dc]={};}var _0x1cc141=md5(JSON[_0x4b45('0x1a')](_0x1c774e));if(md5Accounts[_0x1122dc][_0x4b45('0x3')]!==_0x1cc141){md5Accounts[_0x1122dc][_0x4b45('0x3')]=_0x1cc141;io[_0x4b45('0x12')](_0x4b45('0x1b'),_0x1c774e);}};EmailChannel[_0x4b45('0x11')][_0x4b45('0x1c')]=function(_0x17dfa1){for(var _0x3521ee in _0x17dfa1){if(_0x17dfa1[_0x4b45('0x1d')](_0x3521ee)){if(_0x17dfa1[_0x3521ee][_0x4b45('0x16')]&&_0x17dfa1[_0x3521ee][_0x4b45('0x15')]){var _0x5c849e=_0x17dfa1[_0x3521ee]['Imap'];if(!_0x5c849e['service']&&_0x17dfa1[_0x3521ee][_0x4b45('0x1e')]!==_0x4b45('0x1f'))_0x5c849e[_0x4b45('0x20')]=_0x17dfa1[_0x3521ee][_0x4b45('0x1e')];if(!this[_0x4b45('0xf')][_0x4b45('0x1d')](_0x5c849e['id'])){this[_0x4b45('0xf')][_0x5c849e['id']]=new EmailImap(_0x5c849e,_0x17dfa1[_0x3521ee][_0x4b45('0x6')]);this[_0x4b45('0xf')][_0x5c849e['id']]['on'](_0x4b45('0x21'),this[_0x4b45('0x22')][_0x4b45('0x23')](this,_0x3521ee));this[_0x4b45('0xf')][_0x5c849e['id']]['on'](_0x4b45('0x6'),this['handleImapEmail'][_0x4b45('0x23')](this,_0x3521ee));this['imapAccounts'][_0x5c849e['id']]['on'](_0x4b45('0x24'),this[_0x4b45('0x25')]['bind'](this,_0x3521ee));this[_0x4b45('0xf')][_0x5c849e['id']]['on'](_0x4b45('0x26'),this[_0x4b45('0x27')][_0x4b45('0x23')](this,_0x3521ee));}}else{if(_[_0x4b45('0x28')](this[_0x4b45('0xe')][_0x3521ee][_0x4b45('0x16')])){this['mailAccounts'][_0x3521ee]['Imap']={};}this['mailAccounts'][_0x3521ee][_0x4b45('0x16')]['status']='disabled';this['mailAccounts'][_0x3521ee][_0x4b45('0x16')][_0x4b45('0x18')]='';this[_0x4b45('0x12')](_0x3521ee);}}}};EmailChannel[_0x4b45('0x11')][_0x4b45('0x22')]=function(_0x4ff4f3,_0x3b8c3d){if(this[_0x4b45('0xe')][_0x4ff4f3]){this[_0x4b45('0xe')][_0x4ff4f3][_0x4b45('0x16')][_0x4b45('0x17')]=_0x4b45('0x29');this[_0x4b45('0xe')][_0x4ff4f3][_0x4b45('0x16')][_0x4b45('0x18')]=_0x3b8c3d[_0x4b45('0x13')];if(_0x3b8c3d['messages']){this['mailAccounts'][_0x4ff4f3][_0x4b45('0x16')][_0x4b45('0x19')]=_0x3b8c3d[_0x4b45('0x2a')][_0x4b45('0x19')];}return this[_0x4b45('0x12')](_0x4ff4f3);}};EmailChannel[_0x4b45('0x11')][_0x4b45('0x2b')]=function(_0x2e693b,_0x145aba){logger[_0x4b45('0x2c')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x145aba[_0x4b45('0x2d')],_0x145aba['lastName'],_0x145aba[_0x4b45('0x2e')],_0x2e693b);if(this[_0x4b45('0xe')][_0x2e693b]){return mailAccount[_0x4b45('0x2f')](_0x2e693b,_0x145aba)[_0x4b45('0x30')](function(_0xf5e91c){if(_0xf5e91c){logger[_0x4b45('0x2c')]('Mail\x20accepted\x20from\x20routing');}})[_0x4b45('0x31')](function(_0xa6b876){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4b45('0x1a')](_0xa6b876));});}};EmailChannel[_0x4b45('0x11')]['handleImapEnd']=function(_0x827396){if(this[_0x4b45('0xe')][_0x827396]&&this['mailAccounts'][_0x827396][_0x4b45('0x16')]){if(this[_0x4b45('0xf')][this[_0x4b45('0xe')][_0x827396][_0x4b45('0x16')]['id']]){delete this[_0x4b45('0xf')][this[_0x4b45('0xe')][_0x827396]['Imap']['id']];}this[_0x4b45('0xe')][_0x827396][_0x4b45('0x16')]['lastSync']=moment();this[_0x4b45('0x12')](_0x827396);}};EmailChannel[_0x4b45('0x11')]['handleImapError']=function(_0x5a05c1,_0xc6998b){if(this[_0x4b45('0xe')][_0x5a05c1]){this[_0x4b45('0xe')][_0x5a05c1][_0x4b45('0x16')][_0x4b45('0x17')]=_0x4b45('0x26');this[_0x4b45('0xe')][_0x5a05c1][_0x4b45('0x16')][_0x4b45('0x18')]=_0xc6998b;return this['emit'](_0x5a05c1);}};EmailChannel['prototype'][_0x4b45('0x32')]=function(_0x2d21bd,_0x2f288c){return this[_0x4b45('0x10')][_0x4b45('0x33')](_0x2d21bd,_0x2f288c);};EmailChannel[_0x4b45('0x11')][_0x4b45('0x34')]=function(_0x2960a0){var _0x3bd030=this;if(this[_0x4b45('0xe')][_0x2960a0['id']]){if(_[_0x4b45('0x28')](this[_0x4b45('0xe')][_0x2960a0['id']]['Smtp'])){this[_0x4b45('0xe')][_0x2960a0['id']]['Smtp']={};}this[_0x4b45('0xe')][_0x2960a0['id']][_0x4b45('0x35')][_0x4b45('0x36')]=moment();return new BPromise(function(_0x346629,_0x237ada){return _0x3bd030[_0x4b45('0x10')][_0x4b45('0x37')](_0x2960a0)[_0x4b45('0x30')](function(_0xf1099b){_0x3bd030[_0x4b45('0xe')][_0x2960a0['id']]['Smtp']['status']=_0x4b45('0x38');_0x3bd030[_0x4b45('0xe')][_0x2960a0['id']][_0x4b45('0x35')][_0x4b45('0x18')]='';_0x3bd030[_0x4b45('0x12')](_0x2960a0['id']);_0x346629(_0xf1099b);})['catch'](function(_0x2beb8e){_0x3bd030['mailAccounts'][_0x2960a0['id']]['Smtp'][_0x4b45('0x17')]='error';_0x3bd030[_0x4b45('0xe')][_0x2960a0['id']][_0x4b45('0x35')][_0x4b45('0x18')]=_0x2beb8e;_0x3bd030[_0x4b45('0x12')](_0x2960a0['id']);_0x237ada(_0x2beb8e);});});}return this[_0x4b45('0x10')][_0x4b45('0x37')](_0x2960a0);};module['exports']=EmailChannel; \ No newline at end of file +var _0x65d9=['lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','active','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','bind','handleImapEmail','end','error','status','disabled','emit','connected','messages','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x65d9,0xbf));var _0x965d=function(_0x1647c0,_0x176c8f){_0x1647c0=_0x1647c0-0x0;var _0x1748c1=_0x65d9[_0x1647c0];return _0x1748c1;};'use strict';var _=require(_0x965d('0x0'));var moment=require(_0x965d('0x1'));var BPromise=require(_0x965d('0x2'));var md5=require('md5');var Redis=require(_0x965d('0x3'));var config=require(_0x965d('0x4'));var logger=require(_0x965d('0x5'))(_0x965d('0x6'));config[_0x965d('0x7')]=_[_0x965d('0x8')](config[_0x965d('0x7')],{'host':_0x965d('0x9'),'port':0x18eb});var io=require(_0x965d('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x965d('0xb'));var EmailSmtp=require(_0x965d('0xc'));var mailAccount=require(_0x965d('0xd'));var md5Accounts={};function EmailChannel(_0x53203b){logger[_0x965d('0xe')](_0x965d('0xf'));this[_0x965d('0x10')]=_0x53203b[_0x965d('0x10')];this[_0x965d('0x11')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x965d('0x12')]['emit']=function(_0x4d31c7){var _0x51dadd=this[_0x965d('0x10')][_0x4d31c7];var _0x2d7710={'id':_0x51dadd['id'],'name':_0x51dadd[_0x965d('0x13')],'key':_0x51dadd[_0x965d('0x14')],'active':_0x51dadd[_0x965d('0x15')],'Imap':{'status':_0x51dadd[_0x965d('0x16')]['status'],'messageStatus':_0x51dadd['Imap'][_0x965d('0x17')],'total':_0x51dadd['Imap'][_0x965d('0x18')]}};if(_[_0x965d('0x19')](md5Accounts[_0x4d31c7])){md5Accounts[_0x4d31c7]={};}var _0x2fe92f=md5(JSON[_0x965d('0x1a')](_0x2d7710));if(md5Accounts[_0x4d31c7][_0x965d('0x1b')]!==_0x2fe92f){md5Accounts[_0x4d31c7][_0x965d('0x1b')]=_0x2fe92f;io['emit'](_0x965d('0x1c'),_0x2d7710);}};EmailChannel['prototype'][_0x965d('0x1d')]=function(_0x52528f){for(var _0x7f7483 in _0x52528f){if(_0x52528f[_0x965d('0x1e')](_0x7f7483)){if(_0x52528f[_0x7f7483][_0x965d('0x16')]&&_0x52528f[_0x7f7483][_0x965d('0x15')]){var _0x2adfdf=_0x52528f[_0x7f7483][_0x965d('0x16')];if(!_0x2adfdf['service']&&_0x52528f[_0x7f7483][_0x965d('0x1f')]!==_0x965d('0x20'))_0x2adfdf[_0x965d('0x21')]=_0x52528f[_0x7f7483][_0x965d('0x1f')];if(!this[_0x965d('0x11')][_0x965d('0x1e')](_0x2adfdf['id'])){this[_0x965d('0x11')][_0x2adfdf['id']]=new EmailImap(_0x2adfdf,_0x52528f[_0x7f7483][_0x965d('0x6')]);this[_0x965d('0x11')][_0x2adfdf['id']]['on'](_0x965d('0x22'),this[_0x965d('0x23')][_0x965d('0x24')](this,_0x7f7483));this['imapAccounts'][_0x2adfdf['id']]['on'](_0x965d('0x6'),this[_0x965d('0x25')][_0x965d('0x24')](this,_0x7f7483));this[_0x965d('0x11')][_0x2adfdf['id']]['on'](_0x965d('0x26'),this['handleImapEnd'][_0x965d('0x24')](this,_0x7f7483));this[_0x965d('0x11')][_0x2adfdf['id']]['on'](_0x965d('0x27'),this['handleImapError']['bind'](this,_0x7f7483));}}else{if(_[_0x965d('0x19')](this[_0x965d('0x10')][_0x7f7483]['Imap'])){this[_0x965d('0x10')][_0x7f7483][_0x965d('0x16')]={};}this[_0x965d('0x10')][_0x7f7483][_0x965d('0x16')][_0x965d('0x28')]=_0x965d('0x29');this[_0x965d('0x10')][_0x7f7483][_0x965d('0x16')]['messageStatus']='';this[_0x965d('0x2a')](_0x7f7483);}}}};EmailChannel[_0x965d('0x12')][_0x965d('0x23')]=function(_0x1c52d3,_0x239fcd){if(this['mailAccounts'][_0x1c52d3]){this['mailAccounts'][_0x1c52d3][_0x965d('0x16')][_0x965d('0x28')]=_0x965d('0x2b');this['mailAccounts'][_0x1c52d3][_0x965d('0x16')]['messageStatus']=_0x239fcd[_0x965d('0x13')];if(_0x239fcd[_0x965d('0x2c')]){this['mailAccounts'][_0x1c52d3]['Imap']['total']=_0x239fcd['messages'][_0x965d('0x18')];}return this[_0x965d('0x2a')](_0x1c52d3);}};EmailChannel[_0x965d('0x12')][_0x965d('0x25')]=function(_0x208fe1,_0x2f65a9){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2f65a9['firstName'],_0x2f65a9[_0x965d('0x2d')],_0x2f65a9[_0x965d('0x2e')],_0x208fe1);if(this[_0x965d('0x10')][_0x208fe1]){return mailAccount[_0x965d('0x2f')](_0x208fe1,_0x2f65a9)[_0x965d('0x30')](function(_0x125902){if(_0x125902){logger[_0x965d('0xe')](_0x965d('0x31'));}})[_0x965d('0x32')](function(_0x43d9a4){logger['error'](_0x965d('0x33'),JSON[_0x965d('0x1a')](_0x43d9a4));});}};EmailChannel[_0x965d('0x12')][_0x965d('0x34')]=function(_0x3ceddb){if(this[_0x965d('0x10')][_0x3ceddb]&&this['mailAccounts'][_0x3ceddb][_0x965d('0x16')]){if(this[_0x965d('0x11')][this[_0x965d('0x10')][_0x3ceddb][_0x965d('0x16')]['id']]){delete this[_0x965d('0x11')][this[_0x965d('0x10')][_0x3ceddb][_0x965d('0x16')]['id']];}this[_0x965d('0x10')][_0x3ceddb][_0x965d('0x16')][_0x965d('0x35')]=moment();this[_0x965d('0x2a')](_0x3ceddb);}};EmailChannel[_0x965d('0x12')]['handleImapError']=function(_0x22cd9d,_0x462d7c){if(this[_0x965d('0x10')][_0x22cd9d]){this[_0x965d('0x10')][_0x22cd9d][_0x965d('0x16')]['status']=_0x965d('0x27');this[_0x965d('0x10')][_0x22cd9d][_0x965d('0x16')][_0x965d('0x17')]=_0x462d7c;return this[_0x965d('0x2a')](_0x22cd9d);}};EmailChannel[_0x965d('0x12')][_0x965d('0x36')]=function(_0x451d9e,_0x1494f0){return this[_0x965d('0x37')][_0x965d('0x38')](_0x451d9e,_0x1494f0);};EmailChannel[_0x965d('0x12')][_0x965d('0x39')]=function(_0x3a8b2c){var _0x43934f=this;if(this[_0x965d('0x10')][_0x3a8b2c['id']]){if(_[_0x965d('0x19')](this[_0x965d('0x10')][_0x3a8b2c['id']][_0x965d('0x3a')])){this[_0x965d('0x10')][_0x3a8b2c['id']][_0x965d('0x3a')]={};}this['mailAccounts'][_0x3a8b2c['id']][_0x965d('0x3a')][_0x965d('0x35')]=moment();return new BPromise(function(_0x209d7c,_0x305c82){return _0x43934f[_0x965d('0x37')][_0x965d('0x3b')](_0x3a8b2c)[_0x965d('0x30')](function(_0x23131a){_0x43934f[_0x965d('0x10')][_0x3a8b2c['id']][_0x965d('0x3a')][_0x965d('0x28')]=_0x965d('0x3c');_0x43934f[_0x965d('0x10')][_0x3a8b2c['id']]['Smtp'][_0x965d('0x17')]='';_0x43934f[_0x965d('0x2a')](_0x3a8b2c['id']);_0x209d7c(_0x23131a);})['catch'](function(_0x5ce57e){_0x43934f[_0x965d('0x10')][_0x3a8b2c['id']][_0x965d('0x3a')][_0x965d('0x28')]=_0x965d('0x27');_0x43934f['mailAccounts'][_0x3a8b2c['id']][_0x965d('0x3a')][_0x965d('0x17')]=_0x5ce57e;_0x43934f[_0x965d('0x2a')](_0x3a8b2c['id']);_0x305c82(_0x5ce57e);});});}return this[_0x965d('0x37')][_0x965d('0x3b')](_0x3a8b2c);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 17f89bc..3ec09e3 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 _0x7046=['handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','account','stringify','hasOwnProperty','exports','lodash','util','imap','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','INBOX','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','mailbox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7046,0x144));var _0x6704=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7046[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var Imap=require(_0x6704('0x2'));var simpleParser=require(_0x6704('0x3'))['simpleParser'];var Iconv=require(_0x6704('0x4'))[_0x6704('0x5')];var EventEmitter=require(_0x6704('0x6'))['EventEmitter'];var utils=require(_0x6704('0x7'));var logger=require(_0x6704('0x8'))(_0x6704('0x9'));function EmailImap(_0x626a14,_0x2917be){this['mailbox']=_0x6704('0xa');this['account']=this['getAccount'](_0x626a14,_0x2917be);this[_0x6704('0x2')]=new Imap(this['account']);this['imap'][_0x6704('0xb')](_0x6704('0xc'),this[_0x6704('0xd')][_0x6704('0xe')](this));this[_0x6704('0x2')][_0x6704('0xb')](_0x6704('0xf'),this[_0x6704('0x10')]['bind'](this));this[_0x6704('0x2')]['on'](_0x6704('0x11'),this['handleError'][_0x6704('0xe')](this));this[_0x6704('0x2')][_0x6704('0x12')]();}util[_0x6704('0x13')](EmailImap,EventEmitter);EmailImap[_0x6704('0x14')][_0x6704('0x15')]=function(_0x17b9bc,_0x2da4df){var _0x24ece3={'connTimeout':_0x17b9bc['connTimeout']?_0x17b9bc[_0x6704('0x16')]*0x3e8:0x2710,'authTimeout':_0x17b9bc[_0x6704('0x17')]?_0x17b9bc[_0x6704('0x17')]*0x3e8:0x1388};if(_0x17b9bc['service']){_0x24ece3[_0x6704('0x18')]=_0x17b9bc[_0x6704('0x18')];_0x24ece3[_0x6704('0x9')]=_0x2da4df||_0x17b9bc[_0x6704('0x18')]||_0x6704('0x19');if(_0x17b9bc['modernAuthentication']){_0x24ece3[_0x6704('0x1a')]=utils[_0x6704('0x1b')](_0x17b9bc[_0x6704('0x1c')][_0x6704('0x1d')],_0x17b9bc[_0x6704('0x18')]);}else{_0x24ece3['password']=_0x17b9bc[_0x6704('0x1e')];}}else{if(_0x17b9bc[_0x6704('0x1f')]){_0x24ece3[_0x6704('0x18')]=_0x17b9bc[_0x6704('0x18')];_0x24ece3[_0x6704('0x1e')]=_0x17b9bc[_0x6704('0x1e')];}}_0x24ece3[_0x6704('0x20')]=_0x17b9bc['host'];_0x24ece3[_0x6704('0x21')]=_0x17b9bc[_0x6704('0x21')]||0x3e1;if(_0x17b9bc[_0x6704('0x22')]){_0x24ece3['tls']=!![];}else{_0x24ece3['tls']=![];_0x24ece3[_0x6704('0x23')]=_0x6704('0x24');}return _0x24ece3;};EmailImap[_0x6704('0x14')][_0x6704('0xd')]=function(){this[_0x6704('0x2')]['openBox'](this[_0x6704('0x25')],![],this[_0x6704('0x26')][_0x6704('0xe')](this));};EmailImap[_0x6704('0x14')][_0x6704('0x26')]=function(_0x2476d6,_0x2acafd){if(_0x2476d6){this[_0x6704('0x27')](_0x2476d6,!![]);}else{this[_0x6704('0x28')](_0x6704('0x29'),_0x2acafd);this[_0x6704('0x2a')]();}};EmailImap[_0x6704('0x14')][_0x6704('0x2b')]=function(_0x4979ec){if(_0x4979ec){this['handleError'](_0x4979ec,!![]);}else{this[_0x6704('0x2')][_0x6704('0xf')]();}};EmailImap[_0x6704('0x14')][_0x6704('0x2a')]=function(){this['imap'][_0x6704('0x2c')]([_0x6704('0x2d')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x6704('0x14')]['handleReadUnseen']=function(_0x812ba2,_0x5c7e10){if(_0x812ba2){this['handleError'](_0x812ba2,!![]);}else{if(_0x5c7e10[_0x6704('0x2e')]){try{var _0x115514=this[_0x6704('0x2')]['fetch'](_0x5c7e10,{'bodies':'','markSeen':!![]});_0x115514['on'](_0x6704('0x2f'),this[_0x6704('0x30')][_0x6704('0xe')](this));_0x115514[_0x6704('0xb')](_0x6704('0x11'),this[_0x6704('0x31')][_0x6704('0xe')](this));_0x115514[_0x6704('0xb')](_0x6704('0xf'),this[_0x6704('0x32')][_0x6704('0xe')](this));}catch(_0x454885){logger[_0x6704('0x11')](_0x454885);}}else{this[_0x6704('0x2')][_0x6704('0x33')](!![],this[_0x6704('0x2b')][_0x6704('0xe')](this));}}};EmailImap[_0x6704('0x14')][_0x6704('0x30')]=function(_0x25fac5){_0x25fac5['on'](_0x6704('0x34'),this[_0x6704('0x35')][_0x6704('0xe')](this));_0x25fac5[_0x6704('0xb')](_0x6704('0x36'),this['handleMessageAttributes']['bind'](this));_0x25fac5['once'](_0x6704('0xf'),this[_0x6704('0x37')][_0x6704('0xe')](this));};EmailImap['prototype'][_0x6704('0x35')]=function(_0x5ecbee){simpleParser(_0x5ecbee,{'Iconv':Iconv},this[_0x6704('0x38')][_0x6704('0xe')](this));};EmailImap[_0x6704('0x14')][_0x6704('0x39')]=function(){};EmailImap[_0x6704('0x14')][_0x6704('0x37')]=function(){};EmailImap[_0x6704('0x14')][_0x6704('0x38')]=function(_0x590ada,_0x553d13){if(_0x590ada){logger[_0x6704('0x11')](_0x590ada);}else{var _0x38b36f=this;utils['parser'](this['account'],_0x553d13,function(_0x3a94ee){_0x38b36f['emit'](_0x6704('0x9'),_0x3a94ee);});}};EmailImap[_0x6704('0x14')][_0x6704('0x32')]=function(){this[_0x6704('0x2')]['closeBox'](!![],this[_0x6704('0x2b')][_0x6704('0xe')](this));};EmailImap['prototype'][_0x6704('0x31')]=function(_0x4b050f){this[_0x6704('0x27')](_0x4b050f);this[_0x6704('0x2')][_0x6704('0x33')](!![],this['handleCloseBox'][_0x6704('0xe')](this));};EmailImap[_0x6704('0x14')][_0x6704('0x10')]=function(){this['emit'](_0x6704('0xf'));};EmailImap[_0x6704('0x14')][_0x6704('0x27')]=function(_0xf12c3f,_0x5a7dea){logger[_0x6704('0x11')]('handleError',this[_0x6704('0x3a')][_0x6704('0x9')],JSON[_0x6704('0x3b')](_0xf12c3f));var _0x13c233='';if(_0xf12c3f){if(_0xf12c3f['textCode']){_0x13c233=_0xf12c3f['textCode'];}else{for(var _0x4daf13 in _0xf12c3f){if(_0xf12c3f[_0x6704('0x3c')](_0x4daf13)){_0x13c233+=_['upperFirst'](_0x4daf13)+':\x20'+_0xf12c3f[_0x4daf13]+'\x0a';}}}}if(_0x5a7dea){this[_0x6704('0x2')]['end']();}else{this[_0x6704('0x28')](_0x6704('0x11'),_0x13c233);this['emit'](_0x6704('0xf'));}};module[_0x6704('0x3d')]=EmailImap; \ No newline at end of file +var _0x323f=['mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','handleError','inherits','prototype','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','handleCloseBox','stringify','textCode','hasOwnProperty','exports','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email'];(function(_0x163a5a,_0x3952f8){var _0x786d0a=function(_0x4daaf1){while(--_0x4daaf1){_0x163a5a['push'](_0x163a5a['shift']());}};_0x786d0a(++_0x3952f8);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var Imap=require('imap');var simpleParser=require(_0xf323('0x1'))[_0xf323('0x2')];var Iconv=require(_0xf323('0x3'))[_0xf323('0x4')];var EventEmitter=require(_0xf323('0x5'))[_0xf323('0x6')];var utils=require(_0xf323('0x7'));var logger=require(_0xf323('0x8'))(_0xf323('0x9'));function EmailImap(_0x371707,_0x5d7d60){this[_0xf323('0xa')]=_0xf323('0xb');this[_0xf323('0xc')]=this[_0xf323('0xd')](_0x371707,_0x5d7d60);this[_0xf323('0xe')]=new Imap(this[_0xf323('0xc')]);this[_0xf323('0xe')][_0xf323('0xf')](_0xf323('0x10'),this[_0xf323('0x11')][_0xf323('0x12')](this));this[_0xf323('0xe')][_0xf323('0xf')](_0xf323('0x13'),this[_0xf323('0x14')][_0xf323('0x12')](this));this[_0xf323('0xe')]['on']('error',this[_0xf323('0x15')][_0xf323('0x12')](this));this[_0xf323('0xe')]['connect']();}util[_0xf323('0x16')](EmailImap,EventEmitter);EmailImap[_0xf323('0x17')][_0xf323('0xd')]=function(_0x3a829f,_0x22672e){var _0x144db9={'connTimeout':_0x3a829f['connTimeout']?_0x3a829f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3a829f[_0xf323('0x18')]?_0x3a829f[_0xf323('0x18')]*0x3e8:0x1388};if(_0x3a829f[_0xf323('0x19')]){_0x144db9[_0xf323('0x1a')]=_0x3a829f[_0xf323('0x1a')];_0x144db9['email']=_0x22672e||_0x3a829f[_0xf323('0x1a')]||_0xf323('0x1b');if(_0x3a829f[_0xf323('0x1c')]){_0x144db9[_0xf323('0x1d')]=utils['generateXOAuth2Token'](_0x3a829f[_0xf323('0x1e')][_0xf323('0x1f')],_0x3a829f[_0xf323('0x1a')]);}else{_0x144db9[_0xf323('0x20')]=_0x3a829f['password'];}}else{if(_0x3a829f[_0xf323('0x21')]){_0x144db9[_0xf323('0x1a')]=_0x3a829f['user'];_0x144db9[_0xf323('0x20')]=_0x3a829f[_0xf323('0x20')];}}_0x144db9[_0xf323('0x22')]=_0x3a829f[_0xf323('0x22')];_0x144db9['port']=_0x3a829f[_0xf323('0x23')]||0x3e1;if(_0x3a829f[_0xf323('0x24')]){_0x144db9[_0xf323('0x24')]=!![];}else{_0x144db9['tls']=![];_0x144db9[_0xf323('0x25')]=_0xf323('0x26');}return _0x144db9;};EmailImap[_0xf323('0x17')][_0xf323('0x11')]=function(){this[_0xf323('0xe')][_0xf323('0x27')](this[_0xf323('0xa')],![],this[_0xf323('0x28')][_0xf323('0x12')](this));};EmailImap['prototype'][_0xf323('0x28')]=function(_0x308073,_0x33dc52){if(_0x308073){this[_0xf323('0x15')](_0x308073,!![]);}else{this[_0xf323('0x29')](_0xf323('0x2a'),_0x33dc52);this['readUnseen']();}};EmailImap[_0xf323('0x17')]['handleCloseBox']=function(_0x1570d4){if(_0x1570d4){this[_0xf323('0x15')](_0x1570d4,!![]);}else{this['imap'][_0xf323('0x13')]();}};EmailImap[_0xf323('0x17')][_0xf323('0x2b')]=function(){this[_0xf323('0xe')][_0xf323('0x2c')](['UNSEEN'],this[_0xf323('0x2d')][_0xf323('0x12')](this));};EmailImap[_0xf323('0x17')][_0xf323('0x2d')]=function(_0x4260f3,_0x36bd3f){if(_0x4260f3){this[_0xf323('0x15')](_0x4260f3,!![]);}else{if(_0x36bd3f[_0xf323('0x2e')]){try{var _0x139adc=this['imap'][_0xf323('0x2f')](_0x36bd3f,{'bodies':'','markSeen':!![]});_0x139adc['on'](_0xf323('0x30'),this[_0xf323('0x31')][_0xf323('0x12')](this));_0x139adc[_0xf323('0xf')]('error',this[_0xf323('0x32')][_0xf323('0x12')](this));_0x139adc[_0xf323('0xf')](_0xf323('0x13'),this[_0xf323('0x33')]['bind'](this));}catch(_0x33487c){logger[_0xf323('0x34')](_0x33487c);}}else{this[_0xf323('0xe')][_0xf323('0x35')](!![],this['handleCloseBox'][_0xf323('0x12')](this));}}};EmailImap['prototype'][_0xf323('0x31')]=function(_0x14f9fd){_0x14f9fd['on']('body',this[_0xf323('0x36')]['bind'](this));_0x14f9fd[_0xf323('0xf')]('attributes',this[_0xf323('0x37')]['bind'](this));_0x14f9fd[_0xf323('0xf')](_0xf323('0x13'),this['handleMessageEnd']['bind'](this));};EmailImap['prototype'][_0xf323('0x36')]=function(_0x277a6c){simpleParser(_0x277a6c,{'Iconv':Iconv},this[_0xf323('0x38')][_0xf323('0x12')](this));};EmailImap[_0xf323('0x17')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xf323('0x17')]['handleSimpleParser']=function(_0x11d564,_0x47e7a2){if(_0x11d564){logger[_0xf323('0x34')](_0x11d564);}else{var _0x1f7b34=this;utils[_0xf323('0x39')](this[_0xf323('0xc')],_0x47e7a2,function(_0x325248){_0x1f7b34['emit'](_0xf323('0x9'),_0x325248);});}};EmailImap[_0xf323('0x17')][_0xf323('0x33')]=function(){this[_0xf323('0xe')][_0xf323('0x35')](!![],this[_0xf323('0x3a')][_0xf323('0x12')](this));};EmailImap[_0xf323('0x17')][_0xf323('0x32')]=function(_0x13b8cb){this[_0xf323('0x15')](_0x13b8cb);this[_0xf323('0xe')][_0xf323('0x35')](!![],this[_0xf323('0x3a')][_0xf323('0x12')](this));};EmailImap[_0xf323('0x17')]['handleEnd']=function(){this['emit'](_0xf323('0x13'));};EmailImap[_0xf323('0x17')][_0xf323('0x15')]=function(_0xb21a85,_0xd9c79d){logger[_0xf323('0x34')](_0xf323('0x15'),this[_0xf323('0xc')][_0xf323('0x9')],JSON[_0xf323('0x3b')](_0xb21a85));var _0x2c0854='';if(_0xb21a85){if(_0xb21a85[_0xf323('0x3c')]){_0x2c0854=_0xb21a85[_0xf323('0x3c')];}else{for(var _0x48d4df in _0xb21a85){if(_0xb21a85[_0xf323('0x3d')](_0x48d4df)){_0x2c0854+=_['upperFirst'](_0x48d4df)+':\x20'+_0xb21a85[_0x48d4df]+'\x0a';}}}}if(_0xd9c79d){this['imap'][_0xf323('0x13')]();}else{this['emit']('error',_0x2c0854);this[_0xf323('0x29')](_0xf323('0x13'));}};module[_0xf323('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 71fdbf0..98cf726 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 _0x619e=['exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired'];(function(_0xdf6ab9,_0x17eac1){var _0x284ec5=function(_0x1703a9){while(--_0x1703a9){_0xdf6ab9['push'](_0xdf6ab9['shift']());}};_0x284ec5(++_0x17eac1);}(_0x619e,0x191));var _0xe619=function(_0xecab6a,_0x3c768a){_0xecab6a=_0xecab6a-0x0;var _0x40b98b=_0x619e[_0xecab6a];return _0x40b98b;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xe619('0x0'));function EmailSmtp(){}EmailSmtp[_0xe619('0x1')][_0xe619('0x2')]=function(_0x35a05b,_0x27bd0b){return new Promise(function(_0x32614b,_0x2e0b0c){var _0x419ac9=nodemailer[_0xe619('0x3')](_0x35a05b);_0x419ac9[_0xe619('0x4')](_0xe619('0x5'),inlineBase64());_0x419ac9['sendMail'](_0x27bd0b,function(_0x39b74d,_0x8b52dd){if(_0x39b74d){_0x2e0b0c(_0x39b74d[_0xe619('0x6')]());}else{_0x32614b(_0x8b52dd);}});});};EmailSmtp[_0xe619('0x1')]['verify']=function(_0x391847){return new Promise(function(_0x12c6b5,_0x1614c7){var _0x22df34=nodemailer['createTransport'](_0x391847);_0x22df34[_0xe619('0x7')](function(_0x517f72,_0xec8d6f){if(_0x517f72){_0x1614c7(_0x517f72['toString']());}else{if(_0xec8d6f){_0x12c6b5(_0xec8d6f);}else{_0x1614c7(_0xe619('0x8'));}}});});};module[_0xe619('0x9')]=EmailSmtp; \ No newline at end of file +var _0x1599=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail','toString','verify','Not\x20verifired'];(function(_0x1b1c43,_0x3e14aa){var _0x1f199f=function(_0x29aa83){while(--_0x29aa83){_0x1b1c43['push'](_0x1b1c43['shift']());}};_0x1f199f(++_0x3e14aa);}(_0x1599,0x65));var _0x9159=function(_0xe12735,_0x1c7687){_0xe12735=_0xe12735-0x0;var _0xe06435=_0x1599[_0xe12735];return _0xe06435;};'use strict';var nodemailer=require(_0x9159('0x0'));var inlineBase64=require(_0x9159('0x1'));function EmailSmtp(){}EmailSmtp[_0x9159('0x2')]['send']=function(_0x1d77f0,_0x720309){return new Promise(function(_0x1968b0,_0x1ea1cc){var _0x2c94cb=nodemailer[_0x9159('0x3')](_0x1d77f0);_0x2c94cb[_0x9159('0x4')]('compile',inlineBase64());_0x2c94cb[_0x9159('0x5')](_0x720309,function(_0x46e812,_0x5466cb){if(_0x46e812){_0x1ea1cc(_0x46e812[_0x9159('0x6')]());}else{_0x1968b0(_0x5466cb);}});});};EmailSmtp[_0x9159('0x2')][_0x9159('0x7')]=function(_0x5b18e2){return new Promise(function(_0x1b6422,_0x3fbd6c){var _0xe3f18e=nodemailer['createTransport'](_0x5b18e2);_0xe3f18e[_0x9159('0x7')](function(_0x3983c4,_0x1bb863){if(_0x3983c4){_0x3fbd6c(_0x3983c4['toString']());}else{if(_0x1bb863){_0x1b6422(_0x1bb863);}else{_0x3fbd6c(_0x9159('0x8'));}}});});};module[_0x9159('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 e1df5eb..2eb0455 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 _0xee37=['parser','from','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','user=','auth=Bearer\x20','utf-8','base64','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','anonymous','generate','@xcally.com','name','address','split','length','slice','join','pop','html','replace','0x1?_0x5f1ac1[_0x7ee3('0x10')](0x0,-0x1)[_0x7ee3('0x11')]('\x20'):_0x32a71d[_0x7ee3('0xc')];}return'Anonymous';}function getLastName(_0x572e3f){var _0x571271=_[_0x7ee3('0x7')](_0x572e3f['value']);if(_0x571271&&_0x571271[_0x7ee3('0xc')]){var _0x39f200=_0x571271[_0x7ee3('0xc')][_0x7ee3('0xe')](/\s+/);return _0x39f200[_0x7ee3('0xf')]>0x1?_0x39f200[_0x7ee3('0x12')]():'';}return'';}function getMails(_0x367636,_0xd85645){var _0x1730b3='';for(var _0x5201bd=0x0;_0x5201bd<_0xd85645[_0x7ee3('0x8')][_0x7ee3('0xf')];_0x5201bd+=0x1){if(_0xd85645['value'][_0x5201bd]['address']!==_0x367636){if(!_['isEmpty'](_0x1730b3)){_0x1730b3+=',';}_0x1730b3+=_0xd85645[_0x7ee3('0x8')][_0x5201bd]['name']||_0xd85645[_0x7ee3('0x8')][_0x5201bd][_0x7ee3('0xd')]||'';_0x1730b3+='\x20<';_0x1730b3+=_0xd85645[_0x7ee3('0x8')][_0x5201bd][_0x7ee3('0xd')]?_0xd85645[_0x7ee3('0x8')][_0x5201bd][_0x7ee3('0xd')]:_0x7ee3('0x9')+random[_0x7ee3('0xa')](0x6)+_0x7ee3('0xb');_0x1730b3+='>';}}return _0x1730b3;}function parseEmail(_0x622bc9,_0x3f1a7a,_0x4cf09e){if(_0x3f1a7a[_0x7ee3('0x13')]){var _0x1ff3d5=/)<[^<]*)*<\/script>/gi;while(_0x1ff3d5['test'](_0x3f1a7a[_0x7ee3('0x13')])){_0x3f1a7a[_0x7ee3('0x13')]=_0x3f1a7a['html'][_0x7ee3('0x14')](_0x1ff3d5,'');}if(_0x3f1a7a['html']['includes'](_0x7ee3('0x15'))){var _0x65deea=[];_0x3f1a7a['attachments']['forEach'](_0x2fc37f=>{_0x65deea[_0x7ee3('0x16')](_0x2fc37f[_0x7ee3('0x17')]);});var _0x4e6d86=/]+>/g;var _0x1b6dcd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa028cc=_0x3f1a7a[_0x7ee3('0x13')]['replace'](_0x1b6dcd,_0x7ee3('0x18'));var _0x5a3097=_0xa028cc[_0x7ee3('0x14')](_0x4e6d86,'_IMG');for(let _0x9f22c2=0x0;_0x9f22c2<_0x65deea['length'];_0x9f22c2++){var _0x3b0a09=_0x5a3097[_0x7ee3('0x14')](_0x7ee3('0x19'),'\x20[Attachment:\x20'+_0x65deea[_0x9f22c2]+'\x20]');_0x5a3097=_0x3b0a09;}_0x3f1a7a[_0x7ee3('0x13')]=_0x5a3097;}_0x4cf09e[_0x7ee3('0x1a')]=_0x3f1a7a['html'];}else{_0x4cf09e[_0x7ee3('0x1a')]=_0x3f1a7a[_0x7ee3('0x1b')];}if(_0x4cf09e[_0x7ee3('0x1a')]){_0x4cf09e[_0x7ee3('0x1a')]=_0x4cf09e[_0x7ee3('0x1a')][_0x7ee3('0x14')](/0x0){var _0x25d5f1=[_0x7ee3('0x2e'),_0x7ee3('0x2f'),_0x7ee3('0x30')];for(var _0xdb4ed7=0x0;_0xdb4ed7<_0x3f1a7a[_0x7ee3('0x2d')][_0x7ee3('0xf')];_0xdb4ed7++){var _0x48431c=_[_0x7ee3('0x31')](_0x25d5f1,_0x3f1a7a['headerLines'][_0xdb4ed7][_0x7ee3('0x32')]);if(_0x48431c>=0x0){_0x4cf09e['isAutoreply']=!![];}}}return _0x4cf09e;}exports[_0x7ee3('0x33')]=function(_0x2d0e89,_0x5713ab,_0x16a5fe){var _0x34a1d3={'from':getAddress(_0x5713ab[_0x7ee3('0x34')]),'firstName':getFirstName(_0x5713ab[_0x7ee3('0x34')]),'lastName':getLastName(_0x5713ab['from']),'mapKey':_0x7ee3('0x5'),'message':{'from':getMails(_0x2d0e89[_0x7ee3('0x5')],_0x5713ab[_0x7ee3('0x34')]),'to':_0x2d0e89[_0x7ee3('0x5')],'cc':'','subject':_0x5713ab['subject']||'','messageId':_0x5713ab[_0x7ee3('0x35')],'inReplyTo':_0x5713ab['inReplyTo'],'sentAt':moment(_0x5713ab[_0x7ee3('0x36')])[_0x7ee3('0x26')](_0x7ee3('0x37')),'attach':![],'attachments':[]}};if(!_0x5713ab[_0x7ee3('0x13')]&&!_0x5713ab[_0x7ee3('0x1b')]){var _0x7b8e68=_[_0x7ee3('0x38')](_0x5713ab[_0x7ee3('0x22')],{'contentType':_0x7ee3('0x39')});if(_0x7b8e68[_0x7ee3('0xf')]){logger[_0x7ee3('0x3a')](util[_0x7ee3('0x26')](_0x7ee3('0x3b'),_0x5713ab[_0x7ee3('0x35')]));tnef[_0x7ee3('0x3c')](_[_0x7ee3('0x3d')](_0x7b8e68)[_0x7ee3('0x2b')],function(_0x581697,_0x49f236){if(_0x49f236){_0x5713ab['html']=_0x49f236[_0x7ee3('0x3e')]||_0x7ee3('0x3f');if(_0x49f236[_0x7ee3('0x40')]){for(var _0x2d72ea=0x0;_0x2d72ea<_0x49f236[_0x7ee3('0x40')][_0x7ee3('0xf')];_0x2d72ea++){var _0x40b3c9=_0x49f236[_0x7ee3('0x40')][_0x2d72ea];_0x34a1d3[_0x7ee3('0x1e')][_0x7ee3('0x22')]['push']({'filename':_0x40b3c9[_0x7ee3('0x41')],'content':Buffer[_0x7ee3('0x34')](_0x40b3c9['Data'])});}}}_0x16a5fe(parseEmail(_0x2d0e89,_0x5713ab,_0x34a1d3));});}else{_0x5713ab[_0x7ee3('0x13')]='

Empty\x20message

';_0x16a5fe(parseEmail(_0x2d0e89,_0x5713ab,_0x34a1d3));}}else{_0x16a5fe(parseEmail(_0x2d0e89,_0x5713ab,_0x34a1d3));}};exports['generateXOAuth2Token']=function(_0x2ee193,_0x348d6e){var _0x9a59d9=[_0x7ee3('0x42')+(_0x348d6e||''),_0x7ee3('0x43')+_0x2ee193,'',''];return Buffer[_0x7ee3('0x34')](_0x9a59d9['join'](''),_0x7ee3('0x44'))['toString'](_0x7ee3('0x45'));}; \ No newline at end of file +var _0x23ed=['Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','join','Anonymous','length','pop','isEmpty','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml'];(function(_0x305779,_0x57891f){var _0x41c696=function(_0x53f33c){while(--_0x53f33c){_0x305779['push'](_0x305779['shift']());}};_0x41c696(++_0x57891f);}(_0x23ed,0xb3));var _0xd23e=function(_0x32b53c,_0x61fae0){_0x32b53c=_0x32b53c-0x0;var _0x12d2cf=_0x23ed[_0x32b53c];return _0x12d2cf;};'use strict';var _=require(_0xd23e('0x0'));var moment=require('moment');var random=require(_0xd23e('0x1'));var fs=require('fs');var path=require(_0xd23e('0x2'));var util=require(_0xd23e('0x3'));var tnef=require('node-tnef');var logger=require(_0xd23e('0x4'))(_0xd23e('0x5'));var config=require(_0xd23e('0x6'));function getAddress(_0x317d42){var _0x25919c=_[_0xd23e('0x7')](_0x317d42[_0xd23e('0x8')]);return _0x25919c&&_0x25919c[_0xd23e('0x9')]?_0x25919c['address']:_0xd23e('0xa')+random['generate'](0x6)+_0xd23e('0xb');}function getFirstName(_0x450973){var _0x4b8129=_[_0xd23e('0x7')](_0x450973[_0xd23e('0x8')]);if(_0x4b8129&&_0x4b8129[_0xd23e('0xc')]){if(_0x4b8129[_0xd23e('0xc')]==_0x4b8129[_0xd23e('0x9')]){return _0x4b8129[_0xd23e('0xc')][_0xd23e('0xd')](0x0,_0x4b8129[_0xd23e('0xc')][_0xd23e('0xe')]('@'));}var _0x265b84=_0x4b8129[_0xd23e('0xc')]['split'](/\s+/);return _0x265b84['length']>0x1?_0x265b84['slice'](0x0,-0x1)[_0xd23e('0xf')]('\x20'):_0x4b8129[_0xd23e('0xc')];}return _0xd23e('0x10');}function getLastName(_0x5679d2){var _0x277791=_[_0xd23e('0x7')](_0x5679d2[_0xd23e('0x8')]);if(_0x277791&&_0x277791[_0xd23e('0xc')]){var _0x124ad3=_0x277791[_0xd23e('0xc')]['split'](/\s+/);return _0x124ad3[_0xd23e('0x11')]>0x1?_0x124ad3[_0xd23e('0x12')]():'';}return'';}function getMails(_0x149d71,_0x559052){var _0x3b17f5='';for(var _0x36762c=0x0;_0x36762c<_0x559052['value'][_0xd23e('0x11')];_0x36762c+=0x1){if(_0x559052[_0xd23e('0x8')][_0x36762c][_0xd23e('0x9')]!==_0x149d71){if(!_[_0xd23e('0x13')](_0x3b17f5)){_0x3b17f5+=',';}_0x3b17f5+=_0x559052[_0xd23e('0x8')][_0x36762c][_0xd23e('0xc')]||_0x559052['value'][_0x36762c][_0xd23e('0x9')]||'';_0x3b17f5+='\x20<';_0x3b17f5+=_0x559052[_0xd23e('0x8')][_0x36762c]['address']?_0x559052[_0xd23e('0x8')][_0x36762c][_0xd23e('0x9')]:_0xd23e('0xa')+random['generate'](0x6)+_0xd23e('0xb');_0x3b17f5+='>';}}return _0x3b17f5;}function parseEmail(_0x282426,_0x3844ac,_0x4c109c){if(_0x3844ac['html']){var _0x599e28=/)<[^<]*)*<\/script>/gi;while(_0x599e28['test'](_0x3844ac[_0xd23e('0x14')])){_0x3844ac[_0xd23e('0x14')]=_0x3844ac[_0xd23e('0x14')]['replace'](_0x599e28,'');}if(_0x3844ac[_0xd23e('0x14')][_0xd23e('0x15')](_0xd23e('0x16'))){var _0x4611a0=[];_0x3844ac[_0xd23e('0x17')][_0xd23e('0x18')](_0x17eda5=>{_0x4611a0[_0xd23e('0x19')](_0x17eda5[_0xd23e('0x1a')]);});var _0x3a65d5=/]+>/g;var _0x3e5f1f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2a0f6d=_0x3844ac[_0xd23e('0x14')][_0xd23e('0x1b')](_0x3e5f1f,_0xd23e('0x1c'));var _0x2c8d88=_0x2a0f6d['replace'](_0x3a65d5,_0xd23e('0x1d'));for(let _0x5abd37=0x0;_0x5abd37<_0x4611a0[_0xd23e('0x11')];_0x5abd37++){var _0x33e046=_0x2c8d88['replace'](_0xd23e('0x1d'),_0xd23e('0x1e')+_0x4611a0[_0x5abd37]+_0xd23e('0x1f'));_0x2c8d88=_0x33e046;}_0x3844ac[_0xd23e('0x14')]=_0x2c8d88;}_0x4c109c[_0xd23e('0x20')]=_0x3844ac[_0xd23e('0x14')];}else{_0x4c109c[_0xd23e('0x20')]=_0x3844ac[_0xd23e('0x21')];}if(_0x4c109c[_0xd23e('0x20')]){_0x4c109c[_0xd23e('0x20')]=_0x4c109c['body'][_0xd23e('0x1b')](/0x0){var _0x1ee2e5=[_0xd23e('0x32'),'X-Auto-Response-Suppress:\x20All',_0xd23e('0x33')];for(var _0x5b3b62=0x0;_0x5b3b62<_0x3844ac[_0xd23e('0x31')][_0xd23e('0x11')];_0x5b3b62++){var _0x1225d1=_['indexOf'](_0x1ee2e5,_0x3844ac[_0xd23e('0x31')][_0x5b3b62]['line']);if(_0x1225d1>=0x0){_0x4c109c[_0xd23e('0x34')]=!![];}}}return _0x4c109c;}exports[_0xd23e('0x35')]=function(_0x18b31b,_0x4e91e3,_0x337681){var _0x2dd2e9={'from':getAddress(_0x4e91e3[_0xd23e('0x36')]),'firstName':getFirstName(_0x4e91e3[_0xd23e('0x36')]),'lastName':getLastName(_0x4e91e3[_0xd23e('0x36')]),'mapKey':'email','message':{'from':getMails(_0x18b31b['email'],_0x4e91e3['from']),'to':_0x18b31b[_0xd23e('0x5')],'cc':'','subject':_0x4e91e3[_0xd23e('0x37')]||'','messageId':_0x4e91e3[_0xd23e('0x38')],'inReplyTo':_0x4e91e3[_0xd23e('0x39')],'sentAt':moment(_0x4e91e3[_0xd23e('0x3a')])[_0xd23e('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4e91e3[_0xd23e('0x14')]&&!_0x4e91e3[_0xd23e('0x21')]){var _0x4d6099=_[_0xd23e('0x3b')](_0x4e91e3[_0xd23e('0x17')],{'contentType':'application/ms-tnef'});if(_0x4d6099['length']){logger[_0xd23e('0x3c')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4e91e3[_0xd23e('0x38')]));tnef[_0xd23e('0x3d')](_['first'](_0x4d6099)[_0xd23e('0x2f')],function(_0x48bf70,_0x303a83){if(_0x303a83){_0x4e91e3[_0xd23e('0x14')]=_0x303a83[_0xd23e('0x3e')]||_0xd23e('0x3f');if(_0x303a83[_0xd23e('0x40')]){for(var _0x19138b=0x0;_0x19138b<_0x303a83['Attachments'][_0xd23e('0x11')];_0x19138b++){var _0x38a7f2=_0x303a83['Attachments'][_0x19138b];_0x2dd2e9[_0xd23e('0x23')][_0xd23e('0x17')]['push']({'filename':_0x38a7f2['Title'],'content':Buffer['from'](_0x38a7f2[_0xd23e('0x41')])});}}}_0x337681(parseEmail(_0x18b31b,_0x4e91e3,_0x2dd2e9));});}else{_0x4e91e3[_0xd23e('0x14')]='

Empty\x20message

';_0x337681(parseEmail(_0x18b31b,_0x4e91e3,_0x2dd2e9));}}else{_0x337681(parseEmail(_0x18b31b,_0x4e91e3,_0x2dd2e9));}};exports[_0xd23e('0x42')]=function(_0x4bd451,_0x262fd0){var _0x57d478=[_0xd23e('0x43')+(_0x262fd0||''),_0xd23e('0x44')+_0x4bd451,'',''];return Buffer[_0xd23e('0x36')](_0x57d478[_0xd23e('0xf')](''),'utf-8')[_0xd23e('0x45')](_0xd23e('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b5161c4..5a07c03 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 _0x986d=['lodash','name','Service','key','active','Smtp','exports'];(function(_0x17b7ab,_0x3ab458){var _0x2615e8=function(_0x332feb){while(--_0x332feb){_0x17b7ab['push'](_0x17b7ab['shift']());}};_0x2615e8(++_0x3ab458);}(_0x986d,0xa8));var _0xd986=function(_0xccb859,_0x7fc57e){_0xccb859=_0xccb859-0x0;var _0x5346dc=_0x986d[_0xccb859];return _0x5346dc;};'use strict';var _=require(_0xd986('0x0'));function MailAccount(_0x401f4f){this['id']=_0x401f4f['id']||0x0;this['name']=_0x401f4f[_0xd986('0x1')]||_0xd986('0x2');this[_0xd986('0x3')]=_0x401f4f[_0xd986('0x3')]||'SERV';this[_0xd986('0x4')]=_0x401f4f[_0xd986('0x4')]||![];this['Imap']=_0x401f4f['Imap']||[];this[_0xd986('0x5')]=_0x401f4f[_0xd986('0x5')]||[];}module[_0xd986('0x6')]=MailAccount; \ No newline at end of file +var _0x05e5=['Service','key','active','Imap','exports','name'];(function(_0x118d61,_0x2410d8){var _0x45c03c=function(_0x988f18){while(--_0x988f18){_0x118d61['push'](_0x118d61['shift']());}};_0x45c03c(++_0x2410d8);}(_0x05e5,0x1f1));var _0x505e=function(_0x22ee53,_0x551665){_0x22ee53=_0x22ee53-0x0;var _0x2aae96=_0x05e5[_0x22ee53];return _0x2aae96;};'use strict';var _=require('lodash');function MailAccount(_0xe54625){this['id']=_0xe54625['id']||0x0;this[_0x505e('0x0')]=_0xe54625[_0x505e('0x0')]||_0x505e('0x1');this[_0x505e('0x2')]=_0xe54625['key']||'SERV';this['active']=_0xe54625[_0x505e('0x3')]||![];this[_0x505e('0x4')]=_0xe54625[_0x505e('0x4')]||[];this['Smtp']=_0xe54625['Smtp']||[];}module[_0x505e('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index aee638c..9ce9828 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 _0x1c3a=['mailAccounts','length','merge','lodash','../model/mailAccount','hasOwnProperty','prototype','initMailAccounts'];(function(_0x58e5be,_0x2878ce){var _0x3cd956=function(_0xd12fd9){while(--_0xd12fd9){_0x58e5be['push'](_0x58e5be['shift']());}};_0x3cd956(++_0x2878ce);}(_0x1c3a,0x1cb));var _0xa1c3=function(_0x5759e0,_0x31984b){_0x5759e0=_0x5759e0-0x0;var _0x1a64cd=_0x1c3a[_0x5759e0];return _0x1a64cd;};'use strict';var _=require(_0xa1c3('0x0'));var MailAccount=require(_0xa1c3('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x573fef,_0x5cb85b,_0x44f6a2){var _0x356562=_['mapKeys'](_0x573fef,function(_0x240709,_0x48d5a2){return _0x240709[_0x44f6a2];});for(var _0x285751 in _0x5cb85b){if(_0x5cb85b[_0xa1c3('0x2')](_0x285751)){if(!_0x356562[_0x285751]){delete _0x5cb85b[_0x285751];}}}}Realtime[_0xa1c3('0x3')]['mergeFromDatabase']=function(_0x4b7147,_0x21d4b6){for(var _0x3d4a14 in _0x21d4b6){if(_0x4b7147[_0xa1c3('0x2')](_0x3d4a14)){_0x4b7147[_0x3d4a14]=_0x21d4b6[_0x3d4a14];}}};Realtime['prototype'][_0xa1c3('0x4')]=function(){var _0x50392c=this;return function(_0x5b2e02){if(_0x5b2e02){freeIsNotKey(_0x5b2e02,_0x50392c[_0xa1c3('0x5')],'id');for(var _0x502e66=0x0,_0x5dcb0e={},_0x549d88={};_0x502e66<_0x5b2e02[_0xa1c3('0x6')];_0x502e66+=0x1){_0x5dcb0e=_0x5b2e02[_0x502e66];if(_['isUndefined'](_0x50392c['mailAccounts'][_0x5dcb0e['id']])){_0x50392c[_0xa1c3('0x5')][_0x5dcb0e['id']]=new MailAccount(_0x5dcb0e);}else{_[_0xa1c3('0x7')](_0x50392c[_0xa1c3('0x5')][_0x5dcb0e['id']],_0x5dcb0e);}}}return _0x50392c[_0xa1c3('0x5')];};};module['exports']=Realtime; \ No newline at end of file +var _0xc4b4=['hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4b4,0xcd));var _0x4c4b=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xc4b4[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var MailAccount=require(_0x4c4b('0x0'));var Realtime=function(){this[_0x4c4b('0x1')]={};};function freeIsNotKey(_0x18bade,_0x24378d,_0x2dfeec){var _0x20b358=_[_0x4c4b('0x2')](_0x18bade,function(_0x542180,_0x319ae8){return _0x542180[_0x2dfeec];});for(var _0x59b42b in _0x24378d){if(_0x24378d[_0x4c4b('0x3')](_0x59b42b)){if(!_0x20b358[_0x59b42b]){delete _0x24378d[_0x59b42b];}}}}Realtime['prototype'][_0x4c4b('0x4')]=function(_0x1372ce,_0x3cd5de){for(var _0x158340 in _0x3cd5de){if(_0x1372ce[_0x4c4b('0x3')](_0x158340)){_0x1372ce[_0x158340]=_0x3cd5de[_0x158340];}}};Realtime[_0x4c4b('0x5')]['initMailAccounts']=function(){var _0x19bd27=this;return function(_0x5b3f29){if(_0x5b3f29){freeIsNotKey(_0x5b3f29,_0x19bd27['mailAccounts'],'id');for(var _0x1b8300=0x0,_0x50cb13={},_0x2a8179={};_0x1b8300<_0x5b3f29[_0x4c4b('0x6')];_0x1b8300+=0x1){_0x50cb13=_0x5b3f29[_0x1b8300];if(_[_0x4c4b('0x7')](_0x19bd27['mailAccounts'][_0x50cb13['id']])){_0x19bd27[_0x4c4b('0x1')][_0x50cb13['id']]=new MailAccount(_0x50cb13);}else{_['merge'](_0x19bd27[_0x4c4b('0x1')][_0x50cb13['id']],_0x50cb13);}}}return _0x19bd27[_0x4c4b('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d379170..2bf7dbd 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 _0xd383=['active','key','Imap','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service'];(function(_0x59777e,_0x4ed642){var _0x2ba5c7=function(_0x84464c){while(--_0x84464c){_0x59777e['push'](_0x59777e['shift']());}};_0x2ba5c7(++_0x4ed642);}(_0xd383,0x1c4));var _0x3d38=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd383[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0x3d38('0x0'));exports[_0x3d38('0x1')]=function(){return function(){return client[_0x3d38('0x2')](_0x3d38('0x3'),{'options':{'attributes':['id',_0x3d38('0x4'),_0x3d38('0x5'),_0x3d38('0x6'),'email',_0x3d38('0x7'),_0x3d38('0x8'),'ListId','TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x3d38('0x9'),'include':[{'model':_0x3d38('0xa'),'attributes':['id',_0x3d38('0x4'),_0x3d38('0x6'),'type',_0x3d38('0xb')],'as':_0x3d38('0xa')}]},{'model':_0x3d38('0xc'),'as':'Smtp','include':[{'model':_0x3d38('0xa'),'attributes':['id',_0x3d38('0x4'),_0x3d38('0x6'),_0x3d38('0xd'),'data5'],'as':_0x3d38('0xa')}]}]},'log':_0x3d38('0xe')});};};exports[_0x3d38('0xf')]=function(_0x23c626,_0x4ce8a8){return client[_0x3d38('0x2')](_0x3d38('0x10'),{'account':{'id':_0x23c626},'body':_0x4ce8a8,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xcc58=['NotifyMailAccount','../client','GetMailAccount','name','provider','service','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','notify'];(function(_0x5d23b2,_0x158ac6){var _0x30f289=function(_0x454295){while(--_0x454295){_0x5d23b2['push'](_0x5d23b2['shift']());}};_0x30f289(++_0x158ac6);}(_0xcc58,0xab));var _0x8cc5=function(_0x82b5c2,_0x6cfabc){_0x82b5c2=_0x82b5c2-0x0;var _0x146ba5=_0xcc58[_0x82b5c2];return _0x146ba5;};'use strict';var client=require(_0x8cc5('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x8cc5('0x1'),{'options':{'attributes':['id',_0x8cc5('0x2'),_0x8cc5('0x3'),_0x8cc5('0x4'),'email','active',_0x8cc5('0x5'),_0x8cc5('0x6'),_0x8cc5('0x7')],'raw':![],'include':[{'model':_0x8cc5('0x8'),'as':_0x8cc5('0x9'),'include':[{'model':_0x8cc5('0xa'),'attributes':['id','name',_0x8cc5('0x4'),_0x8cc5('0xb'),_0x8cc5('0xc')],'as':_0x8cc5('0xa')}]},{'model':_0x8cc5('0xd'),'as':_0x8cc5('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x8cc5('0x2'),_0x8cc5('0x4'),_0x8cc5('0xb'),'data5'],'as':_0x8cc5('0xa')}]}]},'log':'getMailAccount'});};};exports[_0x8cc5('0xf')]=function(_0x500b20,_0x1cd3b5){return client['Request']('NotifyMailAccount',{'account':{'id':_0x500b20},'body':_0x1cd3b5,'log':_0x8cc5('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ff73e5a..504132e 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 _0x0f22=['ShowSetting','loginMailFrequency','../client','Request'];(function(_0x56cac6,_0x290562){var _0x57a06e=function(_0x21a340){while(--_0x21a340){_0x56cac6['push'](_0x56cac6['shift']());}};_0x57a06e(++_0x290562);}(_0x0f22,0xae));var _0x20f2=function(_0x22e32e,_0x35405f){_0x22e32e=_0x22e32e-0x0;var _0x722e8b=_0x0f22[_0x22e32e];return _0x722e8b;};'use strict';var client=require(_0x20f2('0x0'));exports['getSettings']=function(){return client[_0x20f2('0x1')](_0x20f2('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x20f2('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x5a80=['Request','ShowSetting','loginMailFrequency','getSettings'];(function(_0x1672de,_0x1cb225){var _0x173556=function(_0x559db4){while(--_0x559db4){_0x1672de['push'](_0x1672de['shift']());}};_0x173556(++_0x1cb225);}(_0x5a80,0xe7));var _0x05a8=function(_0x5f52c2,_0x2b9460){_0x5f52c2=_0x5f52c2-0x0;var _0x5edc77=_0x5a80[_0x5f52c2];return _0x5edc77;};'use strict';var client=require('../client');exports[_0x05a8('0x0')]=function(){return client[_0x05a8('0x1')](_0x05a8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x05a8('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 8eb7ec5..9790d1c 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 _0x57f7=['socket.io','polling','redis','defaults','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','ioredis','../../config/environment','createServer','timeout','listen','port'];(function(_0x445b52,_0x1325fd){var _0x38a47c=function(_0x361a83){while(--_0x361a83){_0x445b52['push'](_0x445b52['shift']());}};_0x38a47c(++_0x1325fd);}(_0x57f7,0x196));var _0x757f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x57f7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x757f('0x0'));var http=require('http');var express=require(_0x757f('0x1'));var sticky=require('sticky-session');var Redis=require(_0x757f('0x2'));var config=require(_0x757f('0x3'));var app=express();var server=http[_0x757f('0x4')](app);server[_0x757f('0x5')]=0xdbba0;if(sticky[_0x757f('0x6')](server,config[_0x757f('0x7')])){var socketio=require(_0x757f('0x8'))(server,{'transports':['websocket',_0x757f('0x9')]});config[_0x757f('0xa')]=_[_0x757f('0xb')](config[_0x757f('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x757f('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x757f('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x757f('0xd'))[_0x757f('0xe')]();require(_0x757f('0xf'))[_0x757f('0xe')](socketio);require(_0x757f('0x10'))[_0x757f('0xe')](app);require(_0x757f('0x11'))['default'](app);}else{server[_0x757f('0x12')](_0x757f('0x13'),function(){console[_0x757f('0x14')](_0x757f('0x15'),config[_0x757f('0x7')]);});}exports=module[_0x757f('0x16')]=app; \ No newline at end of file +var _0x7bda=['timeout','listen','port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/socketio','default','../../config/express','once','listening','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7bda,0x185));var _0xa7bd=function(_0x14a23a,_0x419d25){_0x14a23a=_0x14a23a-0x0;var _0x59ed50=_0x7bda[_0x14a23a];return _0x59ed50;};'use strict';var _=require(_0xa7bd('0x0'));var http=require(_0xa7bd('0x1'));var express=require(_0xa7bd('0x2'));var sticky=require(_0xa7bd('0x3'));var Redis=require(_0xa7bd('0x4'));var config=require(_0xa7bd('0x5'));var app=express();var server=http[_0xa7bd('0x6')](app);server[_0xa7bd('0x7')]=0xdbba0;if(sticky[_0xa7bd('0x8')](server,config[_0xa7bd('0x9')])){var socketio=require(_0xa7bd('0xa'))(server,{'transports':['websocket',_0xa7bd('0xb')]});config[_0xa7bd('0xc')]=_['defaults'](config[_0xa7bd('0xc')],{'host':_0xa7bd('0xd'),'port':0x18eb});socketio[_0xa7bd('0xe')](require(_0xa7bd('0xf'))({'pubClient':new Redis(config[_0xa7bd('0xc')]),'subClient':new Redis(config[_0xa7bd('0xc')])}));require('../../config/triggers')['default']();require(_0xa7bd('0x10'))[_0xa7bd('0x11')](socketio);require(_0xa7bd('0x12'))[_0xa7bd('0x11')](app);require('../../routes')[_0xa7bd('0x11')](app);}else{server[_0xa7bd('0x13')](_0xa7bd('0x14'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa7bd('0x9')]);});}exports=module[_0xa7bd('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 40a437d..de872f9 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 _0x0524=['result','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x0524,0xa8));var _0x4052=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x0524[_0x456bd2];return _0x2218c1;};'use strict';var jayson=require(_0x4052('0x0'));var BPromise=require('bluebird');var logger=require(_0x4052('0x1'))(_0x4052('0x2'));var client=jayson[_0x4052('0x3')][_0x4052('0x4')]({'port':0x2329});client[_0x4052('0x5')]=function(_0x47e7cd,_0x5a948e){return new BPromise(function(_0xb8eed6,_0x15662c){return client[_0x4052('0x6')](_0x47e7cd,_0x5a948e)[_0x4052('0x7')](function(_0x10da40){logger[_0x4052('0x8')](_0x4052('0x9'),'routing',_0x47e7cd,_0x5a948e,_0x10da40);if(_0x10da40[_0x4052('0xa')]){logger[_0x4052('0xa')](_0x4052('0x9'),'routing',_0x47e7cd,_0x10da40[_0x4052('0xa')][_0x4052('0xb')],_0x5a948e);return _0x15662c(_0x10da40['error'][_0x4052('0xb')]);}else{return _0xb8eed6(_0x10da40[_0x4052('0xc')]);}})[_0x4052('0xd')](function(_0x1a2054){logger[_0x4052('0xa')](_0x4052('0x9'),_0x4052('0x2'),_0x47e7cd,_0x1a2054,_0x5a948e);return _0x15662c(_0x1a2054);});});};module[_0x4052('0xe')]=client; \ No newline at end of file +var _0xc962=['client','http','Request','request','then','debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0xc962,0xfc));var _0x2c96=function(_0x5ccbdb,_0x48f29f){_0x5ccbdb=_0x5ccbdb-0x0;var _0x39fa09=_0xc962[_0x5ccbdb];return _0x39fa09;};'use strict';var jayson=require(_0x2c96('0x0'));var BPromise=require(_0x2c96('0x1'));var logger=require(_0x2c96('0x2'))('routing');var client=jayson[_0x2c96('0x3')][_0x2c96('0x4')]({'port':0x2329});client[_0x2c96('0x5')]=function(_0x54913c,_0x495821){return new BPromise(function(_0x4cc60c,_0x57fd6d){return client[_0x2c96('0x6')](_0x54913c,_0x495821)[_0x2c96('0x7')](function(_0x32e96b){logger[_0x2c96('0x8')](_0x2c96('0x9'),_0x2c96('0xa'),_0x54913c,_0x495821,_0x32e96b);if(_0x32e96b['error']){logger[_0x2c96('0xb')]('rpc','routing',_0x54913c,_0x32e96b['error']['message'],_0x495821);return _0x57fd6d(_0x32e96b[_0x2c96('0xb')][_0x2c96('0xc')]);}else{return _0x4cc60c(_0x32e96b['result']);}})[_0x2c96('0xd')](function(_0x2685b2){logger['error'](_0x2c96('0x9'),_0x2c96('0xa'),_0x54913c,_0x2685b2,_0x495821);return _0x57fd6d(_0x2685b2);});});};module[_0x2c96('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c30ddea..0a5cc22 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 _0x1235=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0x1235,0x1c3));var _0x5123=function(_0x47eae2,_0x159ccc){_0x47eae2=_0x47eae2-0x0;var _0x3bea35=_0x1235[_0x47eae2];return _0x3bea35;};'use strict';var BPromise=require(_0x5123('0x0'));var server=require(_0x5123('0x1'));var Realtime=require(_0x5123('0x2'));var user=require(_0x5123('0x3'));var interval=require(_0x5123('0x4'));var openchannelQueue=require(_0x5123('0x5'));var chatQueue=require(_0x5123('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x5123('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x5123('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x5123('0x9')]()[_0x5123('0xa')](user['getAgents']())[_0x5123('0xa')](realtime[_0x5123('0xb')]())[_0x5123('0xa')](interval[_0x5123('0xc')]())[_0x5123('0xa')](realtime['initIntervals']())['then'](openchannelQueue[_0x5123('0xd')]())[_0x5123('0xa')](realtime[_0x5123('0xe')]())[_0x5123('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0x5123('0xf')]())['then'](smsQueue[_0x5123('0x10')]())['then'](realtime['initSmsQueues']())[_0x5123('0xa')](mailQueue[_0x5123('0x11')]())[_0x5123('0xa')](realtime[_0x5123('0x12')]())[_0x5123('0xa')](faxQueue[_0x5123('0x13')]())[_0x5123('0xa')](realtime['initFaxQueues']())[_0x5123('0xa')](whatsappQueue[_0x5123('0x14')]())[_0x5123('0xa')](realtime['initWhatsappQueues']())[_0x5123('0xa')](function(){return realtime;});}function main(){return server[_0x5123('0x15')](realtime)[_0x5123('0xa')](function(_0x2394da){return initRealtime();})['then'](function(_0xa8712e){return setInterval(initRealtime,0x1388);})[_0x5123('0x16')](function(_0x1998f6){console[_0x5123('0x17')](_0x1998f6);});}main(); \ No newline at end of file +var _0x3b74=['getOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','getIntervals','initIntervals'];(function(_0x5703ed,_0x481558){var _0x3d802e=function(_0x277f71){while(--_0x277f71){_0x5703ed['push'](_0x5703ed['shift']());}};_0x3d802e(++_0x481558);}(_0x3b74,0x1cf));var _0x43b7=function(_0x59a5d0,_0x4b3308){_0x59a5d0=_0x59a5d0-0x0;var _0x6840ac=_0x3b74[_0x59a5d0];return _0x6840ac;};'use strict';var BPromise=require(_0x43b7('0x0'));var server=require(_0x43b7('0x1'));var Realtime=require(_0x43b7('0x2'));var user=require('./rpc/user');var interval=require(_0x43b7('0x3'));var openchannelQueue=require(_0x43b7('0x4'));var chatQueue=require(_0x43b7('0x5'));var smsQueue=require(_0x43b7('0x6'));var mailQueue=require(_0x43b7('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x43b7('0x8')]()[_0x43b7('0x9')](user['getAgents']())['then'](realtime['initAgents']())['then'](interval[_0x43b7('0xa')]())['then'](realtime[_0x43b7('0xb')]())[_0x43b7('0x9')](openchannelQueue[_0x43b7('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0x43b7('0x9')](chatQueue[_0x43b7('0xd')]())['then'](realtime['initChatQueues']())['then'](smsQueue[_0x43b7('0xe')]())[_0x43b7('0x9')](realtime[_0x43b7('0xf')]())[_0x43b7('0x9')](mailQueue[_0x43b7('0x10')]())[_0x43b7('0x9')](realtime[_0x43b7('0x11')]())[_0x43b7('0x9')](faxQueue[_0x43b7('0x12')]())['then'](realtime[_0x43b7('0x13')]())['then'](whatsappQueue[_0x43b7('0x14')]())['then'](realtime[_0x43b7('0x15')]())[_0x43b7('0x9')](function(){return realtime;});}function main(){return server[_0x43b7('0x16')](realtime)[_0x43b7('0x9')](function(_0x3ae587){return initRealtime();})[_0x43b7('0x9')](function(_0x155c3c){return setInterval(initRealtime,0x1388);})[_0x43b7('0x17')](function(_0x33ecdd){console[_0x43b7('0x18')](_0x33ecdd);});}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 7ef7614..66ca63b 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x186861,_0x2311c7){_0x186861=_0x186861-0x0;var _0x5be31f=_0x1261[_0x186861];return _0x5be31f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x568d0f,_0x3b48ab){var _0x48c831=function(_0xe89101){while(--_0xe89101){_0x568d0f['push'](_0x568d0f['shift']());}};_0x48c831(++_0x3b48ab);}(_0x2ef3,0xba));var _0x32ef=function(_0x54341a,_0x33dda5){_0x54341a=_0x54341a-0x0;var _0x327a31=_0x2ef3[_0x54341a];return _0x327a31;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 24ef4f0..abe59d6 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 _0xe880=['error','message','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x37c991,_0x15cc69){var _0x2b9ced=function(_0x48127e){while(--_0x48127e){_0x37c991['push'](_0x37c991['shift']());}};_0x2b9ced(++_0x15cc69);}(_0xe880,0x1bc));var _0x0e88=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xe880[_0x556927];return _0x5f1235;};'use strict';var BPromise=require(_0x0e88('0x0'));var jayson=require(_0x0e88('0x1'));var client=jayson[_0x0e88('0x2')][_0x0e88('0x3')]({'port':0x232b});function request(_0x2f35f8,_0xa186ac){return new BPromise(function(_0x49d141,_0x12a129){return client[_0x0e88('0x4')](_0x2f35f8,_0xa186ac)[_0x0e88('0x5')](function(_0x24f3d8){if(_0x24f3d8[_0x0e88('0x6')]){return _0x12a129(_0x24f3d8[_0x0e88('0x6')][_0x0e88('0x7')]);}else{return _0x49d141(_0x24f3d8['result']);}})['catch'](function(_0x41789d){return _0x12a129(_0x41789d);});});}exports[_0x0e88('0x8')]=function(_0x3b57b0,_0x1c6c39){return request(_0x0e88('0x9'),{'account':_0x3b57b0,'message':_0x1c6c39});}; \ No newline at end of file +var _0xfdc2=['error','message','result','catch','sendMailMessage','jayson/promise','http','request','then'];(function(_0xe227fa,_0xf8fa5f){var _0x271ecf=function(_0x5a002f){while(--_0x5a002f){_0xe227fa['push'](_0xe227fa['shift']());}};_0x271ecf(++_0xf8fa5f);}(_0xfdc2,0x191));var _0x2fdc=function(_0x501657,_0x257158){_0x501657=_0x501657-0x0;var _0xea7ee0=_0xfdc2[_0x501657];return _0xea7ee0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2fdc('0x0'));var client=jayson['client'][_0x2fdc('0x1')]({'port':0x232b});function request(_0x192d1d,_0x3dcb8e){return new BPromise(function(_0x232736,_0x4054d4){return client[_0x2fdc('0x2')](_0x192d1d,_0x3dcb8e)[_0x2fdc('0x3')](function(_0x573aa8){if(_0x573aa8[_0x2fdc('0x4')]){return _0x4054d4(_0x573aa8[_0x2fdc('0x4')][_0x2fdc('0x5')]);}else{return _0x232736(_0x573aa8[_0x2fdc('0x6')]);}})[_0x2fdc('0x7')](function(_0x245682){return _0x4054d4(_0x245682);});});}exports[_0x2fdc('0x8')]=function(_0xc01e5c,_0x273b44){return request('SendMail',{'account':_0xc01e5c,'message':_0x273b44});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 65aad69..dd9ea35 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 _0xae1a=['sms','length','Status','StatusTime','toNumber','format','mailStatus','mailStatusTime','faxStatus','faxCurrentCapacity','openchannelStatus','stringify','emit','user:save','exports','lodash','moment','md5','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','Capacity','CurrentCapacity','idle','updateRealtime','chat','fax'];(function(_0xead567,_0x29b84a){var _0xcae79e=function(_0x541ce7){while(--_0x541ce7){_0xead567['push'](_0xead567['shift']());}};_0xcae79e(++_0x29b84a);}(_0xae1a,0xba));var _0xaae1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xae1a[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xaae1('0x0'));var moment=require(_0xaae1('0x1'));var md5=require(_0xaae1('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xaae1('0x3')]=_['defaults'](config['redis'],{'host':_0xaae1('0x4'),'port':0x18eb});var io=require(_0xaae1('0x5'))(new Redis(config[_0xaae1('0x3')]));function Agent(_0x424eb8){this['id']=_0x424eb8['id']||0x0;this[_0xaae1('0x6')]=_0x424eb8[_0xaae1('0x6')]||'';this[_0xaae1('0x7')]=_0x424eb8['online']||!![];this[_0xaae1('0x8')]=_0x424eb8[_0xaae1('0x8')]||![];this[_0xaae1('0x9')]=_0x424eb8[_0xaae1('0x9')]||![];this[_0xaae1('0xa')]=_0x424eb8[_0xaae1('0xa')]||![];this[_0xaae1('0xb')]=_0x424eb8[_0xaae1('0xb')]||![];this[_0xaae1('0xc')]=_0x424eb8['smsPause']||![];this[_0xaae1('0xd')]=_0x424eb8[_0xaae1('0xd')]||![];this[_0xaae1('0xe')]=_0xaae1('0xf');this['chatStatusTime']=0x0;this[_0xaae1('0x10')]=_0x424eb8[_0xaae1('0x10')]||0x0;this[_0xaae1('0x11')]=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this[_0xaae1('0x12')]=_0x424eb8['mailCapacity']||0x0;this[_0xaae1('0x13')]=0x0;this['faxStatus']='unknown';this[_0xaae1('0x14')]=0x0;this[_0xaae1('0x15')]=_0x424eb8['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0xaae1('0x16')]='unknown';this[_0xaae1('0x17')]=0x0;this['smsCapacity']=_0x424eb8[_0xaae1('0x18')]||0x0;this[_0xaae1('0x19')]=0x0;this[_0xaae1('0x1a')]=_0xaae1('0xf');this[_0xaae1('0x1b')]=0x0;this['whatsappCapacity']=_0x424eb8[_0xaae1('0x1c')]||0x0;this[_0xaae1('0x1d')]=0x0;this['openchannelStatus']=_0xaae1('0xf');this[_0xaae1('0x1e')]=0x0;this['openchannelCapacity']=_0x424eb8[_0xaae1('0x1f')]||0x0;this[_0xaae1('0x20')]=0x0;this['busy']=![];this[_0xaae1('0x21')]=undefined;this[_0xaae1('0x2')]='';this['updateRealtime']();}Agent[_0xaae1('0x22')][_0xaae1('0x23')]=function(_0x53877a){if(this[_0x53877a+'CurrentCapacity']>0x0){if(this[_0x53877a+_0xaae1('0x24')]>0x0&&this[_0x53877a+_0xaae1('0x25')]>=this[_0x53877a+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0xaae1('0x26');}};Agent[_0xaae1('0x22')][_0xaae1('0x27')]=function(){var _0x3dc844=['mail',_0xaae1('0x28'),'openchannel',_0xaae1('0x29'),_0xaae1('0x2a'),'whatsapp'];for(var _0x2e1ac7=0x0;_0x2e1ac7<_0x3dc844[_0xaae1('0x2b')];_0x2e1ac7+=0x1){var _0x27ecdf=this[_0xaae1('0x23')](_0x3dc844[_0x2e1ac7]);if(this[_0x3dc844[_0x2e1ac7]+_0xaae1('0x2c')]!==_0x27ecdf){this[_0x3dc844[_0x2e1ac7]+_0xaae1('0x2d')]=_[_0xaae1('0x2e')](moment()[_0xaae1('0x2f')]('x'));}this[_0x3dc844[_0x2e1ac7]+'Status']=_0x27ecdf;}var _0x5865e5={'id':this['id'],'name':this[_0xaae1('0x6')],'online':this[_0xaae1('0x7')],'voicePause':this[_0xaae1('0x8')],'chatPause':this[_0xaae1('0x9')],'mailPause':this[_0xaae1('0xa')],'smsPause':this[_0xaae1('0xc')],'faxPause':this[_0xaae1('0xb')],'openchannelPause':this[_0xaae1('0xd')],'chatStatus':this[_0xaae1('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xaae1('0x11')],'mailStatus':this[_0xaae1('0x30')],'mailStatusTime':this[_0xaae1('0x31')],'mailCapacity':this[_0xaae1('0x12')],'mailCurrentCapacity':this[_0xaae1('0x13')],'faxStatus':this[_0xaae1('0x32')],'faxStatusTime':this[_0xaae1('0x14')],'faxCapacity':this[_0xaae1('0x15')],'faxCurrentCapacity':this[_0xaae1('0x33')],'smsStatus':this[_0xaae1('0x16')],'smsStatusTime':this[_0xaae1('0x17')],'smsCapacity':this[_0xaae1('0x18')],'smsCurrentCapacity':this[_0xaae1('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaae1('0x1b')],'whatsappCapacity':this[_0xaae1('0x1c')],'whatsappCurrentCapacity':this[_0xaae1('0x1d')],'openchannelStatus':this[_0xaae1('0x34')],'openchannelStatusTime':this[_0xaae1('0x1e')],'openchannelCapacity':this[_0xaae1('0x1f')],'openchannelCurrentCapacity':this[_0xaae1('0x20')],'busy':this['busy'],'busyQueue':this[_0xaae1('0x21')]};var _0x1a25ff=md5(JSON[_0xaae1('0x35')](_0x5865e5));if(this['md5']!==_0x1a25ff){this[_0xaae1('0x2')]=_0x1a25ff;io[_0xaae1('0x36')](_0xaae1('0x37'),_0x5865e5);}};module[_0xaae1('0x38')]=Agent; \ No newline at end of file +var _0x614e=['openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatusTime','whatsappStatusTime','busy','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','smsPause'];(function(_0x38c70c,_0x3444cf){var _0x22cd57=function(_0x53e0dc){while(--_0x53e0dc){_0x38c70c['push'](_0x38c70c['shift']());}};_0x22cd57(++_0x3444cf);}(_0x614e,0x19d));var _0xe614=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x614e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe614('0x0'));var moment=require(_0xe614('0x1'));var md5=require(_0xe614('0x2'));var Redis=require(_0xe614('0x3'));var config=require(_0xe614('0x4'));config[_0xe614('0x5')]=_[_0xe614('0x6')](config[_0xe614('0x5')],{'host':_0xe614('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x2ccc9b){this['id']=_0x2ccc9b['id']||0x0;this[_0xe614('0x8')]=_0x2ccc9b[_0xe614('0x8')]||'';this[_0xe614('0x9')]=_0x2ccc9b['online']||!![];this[_0xe614('0xa')]=_0x2ccc9b['voicePause']||![];this[_0xe614('0xb')]=_0x2ccc9b[_0xe614('0xb')]||![];this[_0xe614('0xc')]=_0x2ccc9b[_0xe614('0xc')]||![];this['faxPause']=_0x2ccc9b['faxPause']||![];this[_0xe614('0xd')]=_0x2ccc9b['smsPause']||![];this[_0xe614('0xe')]=_0x2ccc9b[_0xe614('0xe')]||![];this[_0xe614('0xf')]=_0xe614('0x10');this[_0xe614('0x11')]=0x0;this[_0xe614('0x12')]=_0x2ccc9b[_0xe614('0x12')]||0x0;this[_0xe614('0x13')]=0x0;this[_0xe614('0x14')]=_0xe614('0x10');this[_0xe614('0x15')]=0x0;this[_0xe614('0x16')]=_0x2ccc9b[_0xe614('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xe614('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x2ccc9b['faxCapacity']||0x0;this[_0xe614('0x17')]=0x0;this[_0xe614('0x18')]=_0xe614('0x10');this['smsStatusTime']=0x0;this[_0xe614('0x19')]=_0x2ccc9b[_0xe614('0x19')]||0x0;this[_0xe614('0x1a')]=0x0;this[_0xe614('0x1b')]=_0xe614('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2ccc9b[_0xe614('0x1c')]||0x0;this[_0xe614('0x1d')]=0x0;this[_0xe614('0x1e')]='unknown';this[_0xe614('0x1f')]=0x0;this[_0xe614('0x20')]=_0x2ccc9b[_0xe614('0x20')]||0x0;this[_0xe614('0x21')]=0x0;this['busy']=![];this[_0xe614('0x22')]=undefined;this[_0xe614('0x2')]='';this['updateRealtime']();}Agent[_0xe614('0x23')][_0xe614('0x24')]=function(_0x405f4d){if(this[_0x405f4d+_0xe614('0x25')]>0x0){if(this[_0x405f4d+_0xe614('0x26')]>0x0&&this[_0x405f4d+'CurrentCapacity']>=this[_0x405f4d+'Capacity']){return'maxcapacity';}else{return _0xe614('0x27');}}else{return _0xe614('0x28');}};Agent['prototype'][_0xe614('0x29')]=function(){var _0x507af8=[_0xe614('0x2a'),_0xe614('0x2b'),_0xe614('0x2c'),_0xe614('0x2d'),_0xe614('0x2e'),_0xe614('0x2f')];for(var _0x305af6=0x0;_0x305af6<_0x507af8[_0xe614('0x30')];_0x305af6+=0x1){var _0x3b90ec=this[_0xe614('0x24')](_0x507af8[_0x305af6]);if(this[_0x507af8[_0x305af6]+_0xe614('0x31')]!==_0x3b90ec){this[_0x507af8[_0x305af6]+_0xe614('0x32')]=_[_0xe614('0x33')](moment()['format']('x'));}this[_0x507af8[_0x305af6]+'Status']=_0x3b90ec;}var _0x3fce24={'id':this['id'],'name':this[_0xe614('0x8')],'online':this[_0xe614('0x9')],'voicePause':this[_0xe614('0xa')],'chatPause':this[_0xe614('0xb')],'mailPause':this[_0xe614('0xc')],'smsPause':this[_0xe614('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xe614('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe614('0x13')],'mailStatus':this[_0xe614('0x14')],'mailStatusTime':this[_0xe614('0x15')],'mailCapacity':this[_0xe614('0x16')],'mailCurrentCapacity':this[_0xe614('0x34')],'faxStatus':this[_0xe614('0x35')],'faxStatusTime':this[_0xe614('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe614('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xe614('0x37')],'smsCapacity':this[_0xe614('0x19')],'smsCurrentCapacity':this[_0xe614('0x1a')],'whatsappStatus':this[_0xe614('0x1b')],'whatsappStatusTime':this[_0xe614('0x38')],'whatsappCapacity':this[_0xe614('0x1c')],'whatsappCurrentCapacity':this[_0xe614('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xe614('0x21')],'busy':this[_0xe614('0x39')],'busyQueue':this[_0xe614('0x22')]};var _0x4e7847=md5(JSON['stringify'](_0x3fce24));if(this[_0xe614('0x2')]!==_0x4e7847){this[_0xe614('0x2')]=_0x4e7847;io[_0xe614('0x3a')](_0xe614('0x3b'),_0x3fce24);}};module[_0xe614('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 8e04760..a0305c1 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 _0xb59f=['prototype','_rr','map','paused','length','chatPause','loggedIn','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime'];(function(_0x24f4b7,_0x1f40ec){var _0x3876ab=function(_0x7a8e19){while(--_0x7a8e19){_0x24f4b7['push'](_0x24f4b7['shift']());}};_0x3876ab(++_0x1f40ec);}(_0xb59f,0x151));var _0xfb59=function(_0x38bfb4,_0x1cefed){_0x38bfb4=_0x38bfb4-0x0;var _0x53d1a4=_0xb59f[_0x38bfb4];return _0x53d1a4;};'use strict';var _=require(_0xfb59('0x0'));var md5=require(_0xfb59('0x1'));var util=require('util');var Redis=require(_0xfb59('0x2'));var config=require(_0xfb59('0x3'));config[_0xfb59('0x4')]=_[_0xfb59('0x5')](config[_0xfb59('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xfb59('0x6'))(new Redis(config[_0xfb59('0x4')]));function ChatQueue(_0x33a487){this['id']=_0x33a487['id']||0x0;this[_0xfb59('0x7')]=_0x33a487[_0xfb59('0x7')]||'';this[_0xfb59('0x8')]=_0x33a487[_0xfb59('0x8')]||0xa;this[_0xfb59('0x9')]=_0x33a487[_0xfb59('0x9')]||_0xfb59('0xa');this[_0xfb59('0xb')]=_0x33a487[_0xfb59('0xb')];this[_0xfb59('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xfb59('0xd')]();}ChatQueue[_0xfb59('0xe')]['updateRouting']=function(){var _0x3e0444=this[_0xfb59('0xc')][_0xfb59('0xf')];this['mapAgentsId']=_[_0xfb59('0x10')](this[_0xfb59('0xb')],'id');this[_0xfb59('0xc')][_0xfb59('0xf')]=_0x3e0444;};ChatQueue['prototype'][_0xfb59('0xd')]=function(){this['loggedIn']=0x0;this[_0xfb59('0x11')]=0x0;for(var _0x18c26e=0x0;_0x18c26e=0x0?this[_0xfb59('0x15')]:0x0;var _0x4b97c5={'id':this['id'],'available':this[_0xfb59('0x15')],'loggedIn':this[_0xfb59('0x14')],'name':this['name'],'paused':this[_0xfb59('0x11')],'waiting':this['waiting']};var _0x4211b5=md5(JSON[_0xfb59('0x16')](_0x4b97c5));if(this[_0xfb59('0x1')]!==_0x4211b5){this['md5']=_0x4211b5;io['to'](util[_0xfb59('0x17')]('chat:queue:%s',_0x4b97c5[_0xfb59('0x7')]))[_0xfb59('0x18')](_0xfb59('0x19'),_0x4b97c5);}};module[_0xfb59('0x1a')]=ChatQueue; \ No newline at end of file +var _0x1e6e=['waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','chatPause','available','stringify','md5','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x1e6e,0x89));var _0xe1e6=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1e6e[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xe1e6('0x0'));var md5=require('md5');var util=require(_0xe1e6('0x1'));var Redis=require(_0xe1e6('0x2'));var config=require(_0xe1e6('0x3'));config[_0xe1e6('0x4')]=_['defaults'](config['redis'],{'host':_0xe1e6('0x5'),'port':0x18eb});var io=require(_0xe1e6('0x6'))(new Redis(config[_0xe1e6('0x4')]));function ChatQueue(_0x1ad629){this['id']=_0x1ad629['id']||0x0;this[_0xe1e6('0x7')]=_0x1ad629[_0xe1e6('0x7')]||'';this[_0xe1e6('0x8')]=_0x1ad629[_0xe1e6('0x8')]||0xa;this[_0xe1e6('0x9')]=_0x1ad629[_0xe1e6('0x9')]||_0xe1e6('0xa');this[_0xe1e6('0xb')]=_0x1ad629[_0xe1e6('0xb')];this[_0xe1e6('0xc')]={};this[_0xe1e6('0xd')]=0x0;this['md5']='';this[_0xe1e6('0xe')]();this['updateRealtime']();}ChatQueue[_0xe1e6('0xf')][_0xe1e6('0xe')]=function(){var _0x3f8287=this[_0xe1e6('0xc')][_0xe1e6('0x10')];this[_0xe1e6('0xc')]=_[_0xe1e6('0x11')](this[_0xe1e6('0xb')],'id');this['mapAgentsId'][_0xe1e6('0x10')]=_0x3f8287;};ChatQueue['prototype'][_0xe1e6('0x12')]=function(){this[_0xe1e6('0x13')]=0x0;this[_0xe1e6('0x14')]=0x0;for(var _0x142eae=0x0;_0x142eae=0x0?this['available']:0x0;var _0x455201={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe1e6('0x13')],'name':this[_0xe1e6('0x7')],'paused':this[_0xe1e6('0x14')],'waiting':this[_0xe1e6('0xd')]};var _0x15e615=md5(JSON[_0xe1e6('0x18')](_0x455201));if(this[_0xe1e6('0x19')]!==_0x15e615){this[_0xe1e6('0x19')]=_0x15e615;io['to'](util[_0xe1e6('0x1a')]('chat:queue:%s',_0x455201[_0xe1e6('0x7')]))[_0xe1e6('0x1b')](_0xe1e6('0x1c'),_0x455201);}};module[_0xe1e6('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1859cca..c728b3c 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 _0x427e=['format','fax:queue:%s','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','faxPause','available','md5'];(function(_0x25dd99,_0x504d8a){var _0x2d626c=function(_0x53ccd0){while(--_0x53ccd0){_0x25dd99['push'](_0x25dd99['shift']());}};_0x2d626c(++_0x504d8a);}(_0x427e,0x123));var _0xe427=function(_0x53bcf9,_0xea72ef){_0x53bcf9=_0x53bcf9-0x0;var _0x1365a6=_0x427e[_0x53bcf9];return _0x1365a6;};'use strict';var _=require(_0xe427('0x0'));var md5=require('md5');var util=require(_0xe427('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe427('0x2')]=_['defaults'](config[_0xe427('0x2')],{'host':_0xe427('0x3'),'port':0x18eb});var io=require(_0xe427('0x4'))(new Redis(config[_0xe427('0x2')]));function FaxQueue(_0x42acec){this['id']=_0x42acec['id']||0x0;this[_0xe427('0x5')]=_0x42acec[_0xe427('0x5')]||'';this[_0xe427('0x6')]=_0x42acec['timeout']||0xa;this[_0xe427('0x7')]=_0x42acec[_0xe427('0x7')]||_0xe427('0x8');this[_0xe427('0x9')]=_0x42acec[_0xe427('0x9')];this[_0xe427('0xa')]={};this[_0xe427('0xb')]=0x0;this['md5']='';this[_0xe427('0xc')]();this[_0xe427('0xd')]();}FaxQueue[_0xe427('0xe')][_0xe427('0xc')]=function(){var _0x2dae70=this['mapAgentsId'][_0xe427('0xf')];this[_0xe427('0xa')]=_['map'](this[_0xe427('0x9')],'id');this['mapAgentsId'][_0xe427('0xf')]=_0x2dae70;};FaxQueue['prototype'][_0xe427('0xd')]=function(){this[_0xe427('0x10')]=0x0;this[_0xe427('0x11')]=0x0;for(var _0x891afb=0x0;_0x891afb=0x0?this[_0xe427('0x13')]:0x0;var _0x5918a5={'id':this['id'],'available':this[_0xe427('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xe427('0x5')],'paused':this[_0xe427('0x11')],'waiting':this[_0xe427('0xb')]};var _0x1eacb6=md5(JSON['stringify'](_0x5918a5));if(this[_0xe427('0x14')]!==_0x1eacb6){this[_0xe427('0x14')]=_0x1eacb6;io['to'](util[_0xe427('0x15')](_0xe427('0x16'),_0x5918a5['name']))['emit']('fax_queue:save',_0x5918a5);}};module[_0xe427('0x17')]=FaxQueue; \ No newline at end of file +var _0x1ffa=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','updateRealtime','loggedIn','paused','online','faxPause','available','stringify','format','emit','lodash','md5','util','../../../config/environment'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x1ffa,0xdc));var _0xa1ff=function(_0x3d0e4f,_0xf1beac){_0x3d0e4f=_0x3d0e4f-0x0;var _0x8d2638=_0x1ffa[_0x3d0e4f];return _0x8d2638;};'use strict';var _=require(_0xa1ff('0x0'));var md5=require(_0xa1ff('0x1'));var util=require(_0xa1ff('0x2'));var Redis=require('ioredis');var config=require(_0xa1ff('0x3'));config[_0xa1ff('0x4')]=_[_0xa1ff('0x5')](config[_0xa1ff('0x4')],{'host':_0xa1ff('0x6'),'port':0x18eb});var io=require(_0xa1ff('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3703ae){this['id']=_0x3703ae['id']||0x0;this[_0xa1ff('0x8')]=_0x3703ae[_0xa1ff('0x8')]||'';this['timeout']=_0x3703ae[_0xa1ff('0x9')]||0xa;this[_0xa1ff('0xa')]=_0x3703ae[_0xa1ff('0xa')]||_0xa1ff('0xb');this[_0xa1ff('0xc')]=_0x3703ae['Agents'];this[_0xa1ff('0xd')]={};this[_0xa1ff('0xe')]=0x0;this[_0xa1ff('0x1')]='';this[_0xa1ff('0xf')]();this['updateRealtime']();}FaxQueue['prototype'][_0xa1ff('0xf')]=function(){var _0x272cbc=this[_0xa1ff('0xd')]['_rr'];this[_0xa1ff('0xd')]=_[_0xa1ff('0x10')](this[_0xa1ff('0xc')],'id');this['mapAgentsId'][_0xa1ff('0x11')]=_0x272cbc;};FaxQueue[_0xa1ff('0x12')][_0xa1ff('0x13')]=function(){this[_0xa1ff('0x14')]=0x0;this[_0xa1ff('0x15')]=0x0;for(var _0x5ac043=0x0;_0x5ac043=0x0?this[_0xa1ff('0x18')]:0x0;var _0x5639b9={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa1ff('0x14')],'name':this[_0xa1ff('0x8')],'paused':this[_0xa1ff('0x15')],'waiting':this[_0xa1ff('0xe')]};var _0x193bf7=md5(JSON[_0xa1ff('0x19')](_0x5639b9));if(this['md5']!==_0x193bf7){this[_0xa1ff('0x1')]=_0x193bf7;io['to'](util[_0xa1ff('0x1a')]('fax:queue:%s',_0x5639b9[_0xa1ff('0x8')]))[_0xa1ff('0x1b')]('fax_queue:save',_0x5639b9);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4a82991..9119da6 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 _0xe7d7=['Intervals','exports','name'];(function(_0x5ee703,_0x5ad334){var _0x5661a9=function(_0x2d281a){while(--_0x2d281a){_0x5ee703['push'](_0x5ee703['shift']());}};_0x5661a9(++_0x5ad334);}(_0xe7d7,0x14f));var _0x7e7d=function(_0x5b621e,_0x1d15f9){_0x5b621e=_0x5b621e-0x0;var _0xf5e62b=_0xe7d7[_0x5b621e];return _0xf5e62b;};'use strict';function Interval(_0x749f59){this['id']=_0x749f59['id']||0x0;this[_0x7e7d('0x0')]=_0x749f59[_0x7e7d('0x0')]||'';this[_0x7e7d('0x1')]=_0x749f59[_0x7e7d('0x1')]||{};}module[_0x7e7d('0x2')]=Interval; \ No newline at end of file +var _0x58f3=['Intervals','exports','name'];(function(_0x43dc3f,_0x322886){var _0x43a1ea=function(_0x1fd750){while(--_0x1fd750){_0x43dc3f['push'](_0x43dc3f['shift']());}};_0x43a1ea(++_0x322886);}(_0x58f3,0x158));var _0x358f=function(_0x2e880b,_0x56404f){_0x2e880b=_0x2e880b-0x0;var _0x3d9ae5=_0x58f3[_0x2e880b];return _0x3d9ae5;};'use strict';function Interval(_0x574d58){this['id']=_0x574d58['id']||0x0;this[_0x358f('0x0')]=_0x574d58[_0x358f('0x0')]||'';this[_0x358f('0x1')]=_0x574d58[_0x358f('0x1')]||{};}module[_0x358f('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5955381..aa0f1a4 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 _0x8666=['loggedIn','paused','length','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','_rr','mapAgentsId'];(function(_0xd300ac,_0x39e8d5){var _0x27655b=function(_0x41d957){while(--_0x41d957){_0xd300ac['push'](_0xd300ac['shift']());}};_0x27655b(++_0x39e8d5);}(_0x8666,0x19f));var _0x6866=function(_0x121f3c,_0x49ce30){_0x121f3c=_0x121f3c-0x0;var _0x123041=_0x8666[_0x121f3c];return _0x123041;};'use strict';var _=require(_0x6866('0x0'));var md5=require('md5');var util=require(_0x6866('0x1'));var Redis=require(_0x6866('0x2'));var config=require(_0x6866('0x3'));config[_0x6866('0x4')]=_[_0x6866('0x5')](config[_0x6866('0x4')],{'host':_0x6866('0x6'),'port':0x18eb});var io=require(_0x6866('0x7'))(new Redis(config[_0x6866('0x4')]));function MailQueue(_0x3273e9){this['id']=_0x3273e9['id']||0x0;this[_0x6866('0x8')]=_0x3273e9[_0x6866('0x8')]||'';this[_0x6866('0x9')]=_0x3273e9[_0x6866('0x9')]||0xa;this['strategy']=_0x3273e9[_0x6866('0xa')]||_0x6866('0xb');this[_0x6866('0xc')]=_0x3273e9['Agents'];this['mapAgentsId']={};this[_0x6866('0xd')]=0x0;this[_0x6866('0xe')]='';this['updateRouting']();this[_0x6866('0xf')]();}MailQueue[_0x6866('0x10')][_0x6866('0x11')]=function(){var _0x57ef17=this['mapAgentsId'][_0x6866('0x12')];this[_0x6866('0x13')]=_['map'](this['Agents'],'id');this[_0x6866('0x13')][_0x6866('0x12')]=_0x57ef17;};MailQueue[_0x6866('0x10')]['updateRealtime']=function(){this[_0x6866('0x14')]=0x0;this[_0x6866('0x15')]=0x0;for(var _0x4afe6a=0x0;_0x4afe6a=0x0?this[_0x6866('0x18')]:0x0;var _0x5afb3c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6866('0x14')],'name':this[_0x6866('0x8')],'paused':this[_0x6866('0x15')],'waiting':this[_0x6866('0xd')]};var _0x13ece7=md5(JSON[_0x6866('0x19')](_0x5afb3c));if(this[_0x6866('0xe')]!==_0x13ece7){this[_0x6866('0xe')]=_0x13ece7;io['to'](util['format'](_0x6866('0x1a'),_0x5afb3c[_0x6866('0x8')]))[_0x6866('0x1b')](_0x6866('0x1c'),_0x5afb3c);}};module['exports']=MailQueue; \ No newline at end of file +var _0xcd15=['length','online','mailPause','paused','available','md5','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','loggedIn'];(function(_0x46799b,_0x314f29){var _0x22660d=function(_0x4f9786){while(--_0x4f9786){_0x46799b['push'](_0x46799b['shift']());}};_0x22660d(++_0x314f29);}(_0xcd15,0x1ae));var _0x5cd1=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xcd15[_0x550e29];return _0x3515b6;};'use strict';var _=require(_0x5cd1('0x0'));var md5=require('md5');var util=require(_0x5cd1('0x1'));var Redis=require(_0x5cd1('0x2'));var config=require(_0x5cd1('0x3'));config['redis']=_[_0x5cd1('0x4')](config[_0x5cd1('0x5')],{'host':_0x5cd1('0x6'),'port':0x18eb});var io=require(_0x5cd1('0x7'))(new Redis(config[_0x5cd1('0x5')]));function MailQueue(_0xe5f848){this['id']=_0xe5f848['id']||0x0;this['name']=_0xe5f848[_0x5cd1('0x8')]||'';this[_0x5cd1('0x9')]=_0xe5f848[_0x5cd1('0x9')]||0xa;this[_0x5cd1('0xa')]=_0xe5f848['strategy']||'beepall';this[_0x5cd1('0xb')]=_0xe5f848[_0x5cd1('0xb')];this[_0x5cd1('0xc')]={};this[_0x5cd1('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x5cd1('0xe')]();}MailQueue['prototype'][_0x5cd1('0xf')]=function(){var _0x36f58c=this['mapAgentsId'][_0x5cd1('0x10')];this[_0x5cd1('0xc')]=_[_0x5cd1('0x11')](this['Agents'],'id');this[_0x5cd1('0xc')][_0x5cd1('0x10')]=_0x36f58c;};MailQueue[_0x5cd1('0x12')][_0x5cd1('0xe')]=function(){this[_0x5cd1('0x13')]=0x0;this['paused']=0x0;for(var _0x5209c0=0x0;_0x5209c0=0x0?this['available']:0x0;var _0x305c64={'id':this['id'],'available':this[_0x5cd1('0x18')],'loggedIn':this[_0x5cd1('0x13')],'name':this[_0x5cd1('0x8')],'paused':this[_0x5cd1('0x17')],'waiting':this['waiting']};var _0x85d1bc=md5(JSON['stringify'](_0x305c64));if(this['md5']!==_0x85d1bc){this[_0x5cd1('0x19')]=_0x85d1bc;io['to'](util[_0x5cd1('0x1a')]('mail:queue:%s',_0x305c64[_0x5cd1('0x8')]))[_0x5cd1('0x1b')](_0x5cd1('0x1c'),_0x305c64);}};module[_0x5cd1('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e2240e5..2a220b6 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x326f,0xd1));var _0xf326=function(_0x491cc4,_0x5940a0){_0x491cc4=_0x491cc4-0x0;var _0x363ccb=_0x326f[_0x491cc4];return _0x363ccb;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x540cb1,_0x136af9){_0x540cb1=_0x540cb1-0x0;var _0x31ba6=_0x326f[_0x540cb1];return _0x31ba6;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0c89151..75cc46f 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 _0x4d46=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','Agents','online','smsPause','available','waiting','format','sms:queue:%s','sms_queue:save'];(function(_0x3713d2,_0x13badc){var _0x58e041=function(_0x277311){while(--_0x277311){_0x3713d2['push'](_0x3713d2['shift']());}};_0x58e041(++_0x13badc);}(_0x4d46,0x197));var _0x64d4=function(_0x584991,_0x20c113){_0x584991=_0x584991-0x0;var _0x372087=_0x4d46[_0x584991];return _0x372087;};'use strict';var _=require(_0x64d4('0x0'));var md5=require(_0x64d4('0x1'));var util=require(_0x64d4('0x2'));var Redis=require(_0x64d4('0x3'));var config=require(_0x64d4('0x4'));config[_0x64d4('0x5')]=_['defaults'](config[_0x64d4('0x5')],{'host':_0x64d4('0x6'),'port':0x18eb});var io=require(_0x64d4('0x7'))(new Redis(config[_0x64d4('0x5')]));function SmsQueue(_0x1f7d33){this['id']=_0x1f7d33['id']||0x0;this[_0x64d4('0x8')]=_0x1f7d33['name']||'';this[_0x64d4('0x9')]=_0x1f7d33[_0x64d4('0x9')]||0xa;this['strategy']=_0x1f7d33[_0x64d4('0xa')]||_0x64d4('0xb');this['Agents']=_0x1f7d33['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x64d4('0xc')]();this[_0x64d4('0xd')]();}SmsQueue[_0x64d4('0xe')][_0x64d4('0xc')]=function(){var _0x766524=this[_0x64d4('0xf')][_0x64d4('0x10')];this[_0x64d4('0xf')]=_[_0x64d4('0x11')](this['Agents'],'id');this[_0x64d4('0xf')]['_rr']=_0x766524;};SmsQueue[_0x64d4('0xe')][_0x64d4('0xd')]=function(){this[_0x64d4('0x12')]=0x0;this[_0x64d4('0x13')]=0x0;for(var _0x13b111=0x0;_0x13b111=0x0?this[_0x64d4('0x17')]:0x0;var _0x155b60={'id':this['id'],'available':this[_0x64d4('0x17')],'loggedIn':this[_0x64d4('0x12')],'name':this[_0x64d4('0x8')],'paused':this[_0x64d4('0x13')],'waiting':this[_0x64d4('0x18')]};var _0x2549e9=md5(JSON['stringify'](_0x155b60));if(this[_0x64d4('0x1')]!==_0x2549e9){this[_0x64d4('0x1')]=_0x2549e9;io['to'](util[_0x64d4('0x19')](_0x64d4('0x1a'),_0x155b60['name']))['emit'](_0x64d4('0x1b'),_0x155b60);}};module[_0x64d4('0x1c')]=SmsQueue; \ No newline at end of file +var _0xc5c7=['format','sms:queue:%s','emit','sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','prototype','_rr','mapAgentsId','updateRealtime','loggedIn','paused','length','online','available','stringify'];(function(_0x29e856,_0x183a52){var _0x1fe590=function(_0x18266f){while(--_0x18266f){_0x29e856['push'](_0x29e856['shift']());}};_0x1fe590(++_0x183a52);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x13e435,_0x9f1840){_0x13e435=_0x13e435-0x0;var _0x4648f=_0xc5c7[_0x13e435];return _0x4648f;};'use strict';var _=require('lodash');var md5=require(_0x7c5c('0x0'));var util=require(_0x7c5c('0x1'));var Redis=require(_0x7c5c('0x2'));var config=require(_0x7c5c('0x3'));config[_0x7c5c('0x4')]=_[_0x7c5c('0x5')](config['redis'],{'host':_0x7c5c('0x6'),'port':0x18eb});var io=require(_0x7c5c('0x7'))(new Redis(config[_0x7c5c('0x4')]));function SmsQueue(_0x16a81c){this['id']=_0x16a81c['id']||0x0;this[_0x7c5c('0x8')]=_0x16a81c['name']||'';this['timeout']=_0x16a81c[_0x7c5c('0x9')]||0xa;this['strategy']=_0x16a81c[_0x7c5c('0xa')]||'beepall';this[_0x7c5c('0xb')]=_0x16a81c[_0x7c5c('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7c5c('0x0')]='';this[_0x7c5c('0xc')]();this['updateRealtime']();}SmsQueue[_0x7c5c('0xd')]['updateRouting']=function(){var _0x1f5e0b=this['mapAgentsId'][_0x7c5c('0xe')];this[_0x7c5c('0xf')]=_['map'](this[_0x7c5c('0xb')],'id');this[_0x7c5c('0xf')][_0x7c5c('0xe')]=_0x1f5e0b;};SmsQueue[_0x7c5c('0xd')][_0x7c5c('0x10')]=function(){this[_0x7c5c('0x11')]=0x0;this[_0x7c5c('0x12')]=0x0;for(var _0x33a9d2=0x0;_0x33a9d2=0x0?this[_0x7c5c('0x15')]:0x0;var _0x7df960={'id':this['id'],'available':this[_0x7c5c('0x15')],'loggedIn':this[_0x7c5c('0x11')],'name':this[_0x7c5c('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x4fa23b=md5(JSON[_0x7c5c('0x16')](_0x7df960));if(this[_0x7c5c('0x0')]!==_0x4fa23b){this['md5']=_0x4fa23b;io['to'](util[_0x7c5c('0x17')](_0x7c5c('0x18'),_0x7df960[_0x7c5c('0x8')]))[_0x7c5c('0x19')](_0x7c5c('0x1a'),_0x7df960);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 66aa9eb..2ccd593 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 _0x1633=['emit','whatsapp_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','length','online','loggedIn','whatsappPause','paused','available','format'];(function(_0x6aebaa,_0x2676c9){var _0x524aef=function(_0x420985){while(--_0x420985){_0x6aebaa['push'](_0x6aebaa['shift']());}};_0x524aef(++_0x2676c9);}(_0x1633,0x137));var _0x3163=function(_0x1fe1b8,_0x376764){_0x1fe1b8=_0x1fe1b8-0x0;var _0x172480=_0x1633[_0x1fe1b8];return _0x172480;};'use strict';var _=require('lodash');var md5=require(_0x3163('0x0'));var util=require(_0x3163('0x1'));var Redis=require(_0x3163('0x2'));var config=require('../../../config/environment');config[_0x3163('0x3')]=_[_0x3163('0x4')](config[_0x3163('0x3')],{'host':_0x3163('0x5'),'port':0x18eb});var io=require(_0x3163('0x6'))(new Redis(config[_0x3163('0x3')]));function WhatsappQueue(_0x3cddca){this['id']=_0x3cddca['id']||0x0;this['name']=_0x3cddca[_0x3163('0x7')]||'';this['timeout']=_0x3cddca['timeout']||0xa;this[_0x3163('0x8')]=_0x3cddca[_0x3163('0x8')]||_0x3163('0x9');this[_0x3163('0xa')]=_0x3cddca[_0x3163('0xa')];this[_0x3163('0xb')]={};this[_0x3163('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x3163('0xd')][_0x3163('0xe')]=function(){var _0x35e95c=this[_0x3163('0xb')][_0x3163('0xf')];this[_0x3163('0xb')]=_[_0x3163('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x35e95c;};WhatsappQueue[_0x3163('0xd')][_0x3163('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x59ba8e=0x0;_0x59ba8e=0x0?this['available']:0x0;var _0x5c7e6e={'id':this['id'],'available':this[_0x3163('0x17')],'loggedIn':this[_0x3163('0x14')],'name':this[_0x3163('0x7')],'paused':this['paused'],'waiting':this[_0x3163('0xc')]};var _0x4bdbd3=md5(JSON['stringify'](_0x5c7e6e));if(this[_0x3163('0x0')]!==_0x4bdbd3){this[_0x3163('0x0')]=_0x4bdbd3;io['to'](util[_0x3163('0x18')]('whatsapp:queue:%s',_0x5c7e6e[_0x3163('0x7')]))[_0x3163('0x19')](_0x3163('0x1a'),_0x5c7e6e);}};module[_0x3163('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xb9bc=['loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xb9bc,0xb7));var _0xcb9b=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xb9bc[_0x419550];return _0x55f9ef;};'use strict';var _=require(_0xcb9b('0x0'));var md5=require(_0xcb9b('0x1'));var util=require('util');var Redis=require(_0xcb9b('0x2'));var config=require('../../../config/environment');config[_0xcb9b('0x3')]=_['defaults'](config[_0xcb9b('0x3')],{'host':_0xcb9b('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x573297){this['id']=_0x573297['id']||0x0;this['name']=_0x573297[_0xcb9b('0x5')]||'';this[_0xcb9b('0x6')]=_0x573297[_0xcb9b('0x6')]||0xa;this[_0xcb9b('0x7')]=_0x573297[_0xcb9b('0x7')]||_0xcb9b('0x8');this[_0xcb9b('0x9')]=_0x573297[_0xcb9b('0x9')];this[_0xcb9b('0xa')]={};this[_0xcb9b('0xb')]=0x0;this[_0xcb9b('0x1')]='';this[_0xcb9b('0xc')]();this[_0xcb9b('0xd')]();}WhatsappQueue[_0xcb9b('0xe')][_0xcb9b('0xc')]=function(){var _0x176411=this[_0xcb9b('0xa')][_0xcb9b('0xf')];this[_0xcb9b('0xa')]=_[_0xcb9b('0x10')](this[_0xcb9b('0x9')],'id');this[_0xcb9b('0xa')][_0xcb9b('0xf')]=_0x176411;};WhatsappQueue[_0xcb9b('0xe')][_0xcb9b('0xd')]=function(){this['loggedIn']=0x0;this[_0xcb9b('0x11')]=0x0;for(var _0x477c1f=0x0;_0x477c1f=0x0?this['available']:0x0;var _0x4b7d74={'id':this['id'],'available':this[_0xcb9b('0x16')],'loggedIn':this[_0xcb9b('0x14')],'name':this[_0xcb9b('0x5')],'paused':this['paused'],'waiting':this[_0xcb9b('0xb')]};var _0x262f40=md5(JSON[_0xcb9b('0x17')](_0x4b7d74));if(this[_0xcb9b('0x1')]!==_0x262f40){this[_0xcb9b('0x1')]=_0x262f40;io['to'](util[_0xcb9b('0x18')](_0xcb9b('0x19'),_0x4b7d74[_0xcb9b('0x5')]))[_0xcb9b('0x1a')](_0xcb9b('0x1b'),_0x4b7d74);}};module[_0xcb9b('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 206fb28..b0f1d61 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0e1e4a3..743c4ef 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 _0x905b=['AddTagsToChatInteraction','../client','update','Request','addTags'];(function(_0x424515,_0x47aacb){var _0x4bb6ce=function(_0x164222){while(--_0x164222){_0x424515['push'](_0x424515['shift']());}};_0x4bb6ce(++_0x47aacb);}(_0x905b,0x17d));var _0xb905=function(_0x42fc93,_0x154134){_0x42fc93=_0x42fc93-0x0;var _0x1391af=_0x905b[_0x42fc93];return _0x1391af;};'use strict';var client=require(_0xb905('0x0'));exports[_0xb905('0x1')]=function(_0x3e3304,_0x1b5b18){return client[_0xb905('0x2')]('UpdateChatInteraction',{'body':_0x1b5b18,'options':{'where':{'id':_0x3e3304}},'log':'updateChatInteraction'});};exports[_0xb905('0x3')]=function(_0x15d8fc,_0x3e9895){return client[_0xb905('0x2')](_0xb905('0x4'),{'body':_0x3e9895,'options':{'where':{'id':_0x15d8fc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6708=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x6708,0xe6));var _0x8670=function(_0x1e4a14,_0x27ec57){_0x1e4a14=_0x1e4a14-0x0;var _0x55c202=_0x6708[_0x1e4a14];return _0x55c202;};'use strict';var client=require(_0x8670('0x0'));exports['update']=function(_0x3b1b4c,_0x10bbcf){return client[_0x8670('0x1')](_0x8670('0x2'),{'body':_0x10bbcf,'options':{'where':{'id':_0x3b1b4c}},'log':_0x8670('0x3')});};exports[_0x8670('0x4')]=function(_0x3ebcf4,_0x44f3c8){return client[_0x8670('0x1')](_0x8670('0x5'),{'body':_0x44f3c8,'options':{'where':{'id':_0x3ebcf4}},'log':_0x8670('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7f92c34..2d2d6e7 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 _0x4bf5=['../client','Request','CreateChatMessage'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x4bf5,0x198));var _0x54bf=function(_0xa4d6ae,_0x516961){_0xa4d6ae=_0xa4d6ae-0x0;var _0x5e7673=_0x4bf5[_0xa4d6ae];return _0x5e7673;};'use strict';var client=require(_0x54bf('0x0'));exports['create']=function(_0x78e2d1){return client[_0x54bf('0x1')](_0x54bf('0x2'),{'body':_0x78e2d1,'log':'createChatMessage'});}; \ No newline at end of file +var _0x86dd=['../client','create'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x86dd,0x148));var _0xd86d=function(_0x4e53dd,_0x526109){_0x4e53dd=_0x4e53dd-0x0;var _0x33134f=_0x86dd[_0x4e53dd];return _0x33134f;};'use strict';var client=require(_0xd86d('0x0'));exports[_0xd86d('0x1')]=function(_0x5b8926){return client['Request']('CreateChatMessage',{'body':_0x5b8926,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1afc8a8..7a16052 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 _0x2d17=['name','strategy','User','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x3bf6f7,_0x49d9a2){var _0xb009e4=function(_0x2f0fb9){while(--_0x2f0fb9){_0x3bf6f7['push'](_0x3bf6f7['shift']());}};_0xb009e4(++_0x49d9a2);}(_0x2d17,0x17e));var _0x72d1=function(_0x42ed3f,_0x49c0c3){_0x42ed3f=_0x42ed3f-0x0;var _0x18abec=_0x2d17[_0x42ed3f];return _0x18abec;};'use strict';var client=require(_0x72d1('0x0'));exports[_0x72d1('0x1')]=function(){return function(){return client['Request'](_0x72d1('0x2'),{'options':{'raw':![],'attributes':['id',_0x72d1('0x3'),'timeout',_0x72d1('0x4')],'include':[{'model':_0x72d1('0x5'),'as':'Agents','attributes':['id',_0x72d1('0x3'),'online',_0x72d1('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xf5a7=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x393d63,_0x1c8005){var _0x13e5df=function(_0x6896d9){while(--_0x6896d9){_0x393d63['push'](_0x393d63['shift']());}};_0x13e5df(++_0x1c8005);}(_0xf5a7,0x133));var _0x7f5a=function(_0x446093,_0x18f24a){_0x446093=_0x446093-0x0;var _0x51994b=_0xf5a7[_0x446093];return _0x51994b;};'use strict';var client=require(_0x7f5a('0x0'));exports[_0x7f5a('0x1')]=function(){return function(){return client['Request'](_0x7f5a('0x2'),{'options':{'raw':![],'attributes':['id',_0x7f5a('0x3'),_0x7f5a('0x4'),_0x7f5a('0x5')],'include':[{'model':_0x7f5a('0x6'),'as':_0x7f5a('0x7'),'attributes':['id',_0x7f5a('0x3'),_0x7f5a('0x8'),_0x7f5a('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2d513f4..3fca28b 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 _0xf7f3=['Request','CreateChatQueueReport','DESC','../client','create'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x584e44,_0x2253bc){_0x584e44=_0x584e44-0x0;var _0x3de1da=_0xf7f3[_0x584e44];return _0x3de1da;};'use strict';var client=require(_0x3f7f('0x0'));exports[_0x3f7f('0x1')]=function(_0x1cfb19){return client[_0x3f7f('0x2')](_0x3f7f('0x3'),{'body':_0x1cfb19,'log':_0x3f7f('0x3')});};exports['update']=function(_0x5df5c4,_0x5e4ff){return client[_0x3f7f('0x2')]('UpdateChatQueueReport',{'body':_0x5e4ff,'options':{'where':{'uniqueid':_0x5df5c4},'order':[['id',_0x3f7f('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x92e8=['update','UpdateChatQueueReport','../client','Request','CreateChatQueueReport'];(function(_0x3c0664,_0x25ebf8){var _0x6042bc=function(_0x203e1c){while(--_0x203e1c){_0x3c0664['push'](_0x3c0664['shift']());}};_0x6042bc(++_0x25ebf8);}(_0x92e8,0x7f));var _0x892e=function(_0x4f2801,_0x366dd1){_0x4f2801=_0x4f2801-0x0;var _0x3ac22a=_0x92e8[_0x4f2801];return _0x3ac22a;};'use strict';var client=require(_0x892e('0x0'));exports['create']=function(_0x5b0726){return client[_0x892e('0x1')]('CreateChatQueueReport',{'body':_0x5b0726,'log':_0x892e('0x2')});};exports[_0x892e('0x3')]=function(_0x2cb68f,_0xe95e5f){return client[_0x892e('0x1')](_0x892e('0x4'),{'body':_0xe95e5f,'options':{'where':{'uniqueid':_0x2cb68f},'order':[['id','DESC']],'limit':0x1},'log':_0x892e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 263a56c..9e4c9f3 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1b3d0e,_0x1fba2f){var _0x2dac24=function(_0x510bcf){while(--_0x510bcf){_0x1b3d0e['push'](_0x1b3d0e['shift']());}};_0x2dac24(++_0x1fba2f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x7a54,0x106));var _0x47a5=function(_0x1a8111,_0x5d0a59){_0x1a8111=_0x1a8111-0x0;var _0x1924c9=_0x7a54[_0x1a8111];return _0x1924c9;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b3c1466..b9c35f3 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 _0xd4b7=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0xffbdfa,_0x9dc18c){var _0x3d7544=function(_0x440053){while(--_0x440053){_0xffbdfa['push'](_0xffbdfa['shift']());}};_0x3d7544(++_0x9dc18c);}(_0xd4b7,0xe4));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7d4b('0x0'));exports[_0x7d4b('0x1')]=function(_0x5c7135){return client[_0x7d4b('0x2')](_0x7d4b('0x3'),{'body':_0x5c7135,'log':_0x7d4b('0x4')});}; \ No newline at end of file +var _0x8439=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x57a785,_0x498193){var _0x2da673=function(_0x7d2122){while(--_0x7d2122){_0x57a785['push'](_0x57a785['shift']());}};_0x2da673(++_0x498193);}(_0x8439,0xf5));var _0x9843=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8439[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0x9843('0x0'));exports['create']=function(_0x532312){return client[_0x9843('0x1')](_0x9843('0x2'),{'body':_0x532312,'log':_0x9843('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4b9384c..c1211f7 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 _0x06f4=['GetFaxQueue','name','strategy','User','Agents','faxPause','getFaxQueues','Request'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x06f4,0x156));var _0x406f=function(_0x328f0d,_0x17a983){_0x328f0d=_0x328f0d-0x0;var _0x21f434=_0x06f4[_0x328f0d];return _0x21f434;};'use strict';var client=require('../client');exports[_0x406f('0x0')]=function(){return function(){return client[_0x406f('0x1')](_0x406f('0x2'),{'options':{'raw':![],'attributes':['id',_0x406f('0x3'),'timeout',_0x406f('0x4')],'include':[{'model':_0x406f('0x5'),'as':_0x406f('0x6'),'attributes':['id',_0x406f('0x3'),'online',_0x406f('0x7')]}]},'log':_0x406f('0x0')});};}; \ No newline at end of file +var _0x8f3f=['name','faxPause','getFaxQueues','Request','User'];(function(_0x48e52e,_0x497d33){var _0x5aa6e7=function(_0x5616b8){while(--_0x5616b8){_0x48e52e['push'](_0x48e52e['shift']());}};_0x5aa6e7(++_0x497d33);}(_0x8f3f,0xfc));var _0xf8f3=function(_0x580a37,_0xd43a4a){_0x580a37=_0x580a37-0x0;var _0x2c3120=_0x8f3f[_0x580a37];return _0x2c3120;};'use strict';var client=require('../client');exports[_0xf8f3('0x0')]=function(){return function(){return client[_0xf8f3('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xf8f3('0x2'),'as':'Agents','attributes':['id',_0xf8f3('0x3'),'online',_0xf8f3('0x4')]}]},'log':_0xf8f3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 229be84..2ef1b49 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 _0x55c1=['../client','create','CreateFaxQueueReport','update','Request','DESC','UpdateFaxQueueReport'];(function(_0x30df42,_0x640416){var _0x26e24f=function(_0x4bd8e7){while(--_0x4bd8e7){_0x30df42['push'](_0x30df42['shift']());}};_0x26e24f(++_0x640416);}(_0x55c1,0x69));var _0x155c=function(_0x3e806a,_0xa4b9fa){_0x3e806a=_0x3e806a-0x0;var _0x477105=_0x55c1[_0x3e806a];return _0x477105;};'use strict';var client=require(_0x155c('0x0'));exports[_0x155c('0x1')]=function(_0x369c75){return client['Request']('CreateFaxQueueReport',{'body':_0x369c75,'log':_0x155c('0x2')});};exports[_0x155c('0x3')]=function(_0x57e4e1,_0x52bea7){return client[_0x155c('0x4')]('UpdateFaxQueueReport',{'body':_0x52bea7,'options':{'where':{'uniqueid':_0x57e4e1},'order':[['id',_0x155c('0x5')]],'limit':0x1},'log':_0x155c('0x6')});}; \ No newline at end of file +var _0x7f44=['Request','UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport','update'];(function(_0x10a9ef,_0x2f6a6c){var _0x36712a=function(_0x6ab61e){while(--_0x6ab61e){_0x10a9ef['push'](_0x10a9ef['shift']());}};_0x36712a(++_0x2f6a6c);}(_0x7f44,0xa5));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x47f4('0x0'));exports['create']=function(_0x517bbb){return client['Request'](_0x47f4('0x1'),{'body':_0x517bbb,'log':_0x47f4('0x1')});};exports[_0x47f4('0x2')]=function(_0x50fbb8,_0x39c631){return client[_0x47f4('0x3')](_0x47f4('0x4'),{'body':_0x39c631,'options':{'where':{'uniqueid':_0x50fbb8},'order':[['id',_0x47f4('0x5')]],'limit':0x1},'log':_0x47f4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d9e6e9f..6184367 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 _0x75c6=['../client','getIntervals','name','Interval','Intervals'];(function(_0x5f3e54,_0x2ec7a2){var _0x35cc37=function(_0x286abf){while(--_0x286abf){_0x5f3e54['push'](_0x5f3e54['shift']());}};_0x35cc37(++_0x2ec7a2);}(_0x75c6,0x168));var _0x675c=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x75c6[_0x19a11f];return _0x51485f;};'use strict';var client=require(_0x675c('0x0'));exports[_0x675c('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x675c('0x2')],'include':[{'model':_0x675c('0x3'),'as':_0x675c('0x4'),'attributes':['id',_0x675c('0x2'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x3ba5=['name','Interval','Intervals','../client','getIntervals','Request'];(function(_0x3701fb,_0x389f55){var _0x171f5c=function(_0x4812b0){while(--_0x4812b0){_0x3701fb['push'](_0x3701fb['shift']());}};_0x171f5c(++_0x389f55);}(_0x3ba5,0x1e9));var _0x53ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ba5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x53ba('0x0'));exports[_0x53ba('0x1')]=function(){return function(){return client[_0x53ba('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x53ba('0x3')],'include':[{'model':_0x53ba('0x4'),'as':_0x53ba('0x5'),'attributes':['id',_0x53ba('0x3'),'interval']}]},'log':_0x53ba('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index abf2bc8..95fbb11 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 _0x9582=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','addTags'];(function(_0x559c75,_0x34d503){var _0x25e208=function(_0xb723a2){while(--_0xb723a2){_0x559c75['push'](_0x559c75['shift']());}};_0x25e208(++_0x34d503);}(_0x9582,0x95));var _0x2958=function(_0x548927,_0x57cb4f){_0x548927=_0x548927-0x0;var _0x378c0e=_0x9582[_0x548927];return _0x378c0e;};'use strict';var client=require(_0x2958('0x0'));exports[_0x2958('0x1')]=function(_0xd87e37,_0x3d6d1f){return client[_0x2958('0x2')](_0x2958('0x3'),{'body':_0x3d6d1f,'options':{'where':{'id':_0xd87e37}},'log':'updateMailInteraction'});};exports[_0x2958('0x4')]=function(_0x3b907e,_0x136c77){return client[_0x2958('0x2')](_0x2958('0x5'),{'body':_0x136c77,'options':{'where':{'id':_0x3b907e}},'log':_0x2958('0x6')});}; \ No newline at end of file +var _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x387264,_0xb0a81){var _0x3148f2=function(_0x38a32a){while(--_0x38a32a){_0x387264['push'](_0x387264['shift']());}};_0x3148f2(++_0xb0a81);}(_0x3266,0x6a));var _0x6326=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3266[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a36ea78..688b31b 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 _0xd3b7=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xd3b7,0x16e));var _0x7d3b=function(_0x1c1e77,_0x4b4c84){_0x1c1e77=_0x1c1e77-0x0;var _0x58d6fb=_0xd3b7[_0x1c1e77];return _0x58d6fb;};'use strict';var client=require(_0x7d3b('0x0'));exports[_0x7d3b('0x1')]=function(_0x3ad995){return client[_0x7d3b('0x2')](_0x7d3b('0x3'),{'body':_0x3ad995,'log':_0x7d3b('0x4')});}; \ No newline at end of file +var _0x438f=['create','Request','CreateMailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x438f,0x1c2));var _0xf438=function(_0x187f4a,_0x53ec47){_0x187f4a=_0x187f4a-0x0;var _0x1e0533=_0x438f[_0x187f4a];return _0x1e0533;};'use strict';var client=require('../client');exports[_0xf438('0x0')]=function(_0x4cef01){return client[_0xf438('0x1')](_0xf438('0x2'),{'body':_0x4cef01,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8e740d8..4371f28 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 _0x74d3=['online','../client','getMailQueues','Request','name','strategy','User','Agents'];(function(_0x132080,_0x50ce65){var _0x5a7bca=function(_0x408b9b){while(--_0x408b9b){_0x132080['push'](_0x132080['shift']());}};_0x5a7bca(++_0x50ce65);}(_0x74d3,0x159));var _0x374d=function(_0x4a1315,_0x58b7d5){_0x4a1315=_0x4a1315-0x0;var _0x16125a=_0x74d3[_0x4a1315];return _0x16125a;};'use strict';var client=require(_0x374d('0x0'));exports[_0x374d('0x1')]=function(){return function(){return client[_0x374d('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x374d('0x3'),'timeout',_0x374d('0x4')],'include':[{'model':_0x374d('0x5'),'as':_0x374d('0x6'),'attributes':['id','name',_0x374d('0x7'),'mailPause']}]},'log':_0x374d('0x1')});};}; \ No newline at end of file +var _0xd2af=['timeout','User','Agents','online','mailPause','../client','getMailQueues','Request','name'];(function(_0x3c3d59,_0x369b04){var _0x25d467=function(_0x991667){while(--_0x991667){_0x3c3d59['push'](_0x3c3d59['shift']());}};_0x25d467(++_0x369b04);}(_0xd2af,0x17f));var _0xfd2a=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0xd2af[_0x1bfe2b];return _0x1477d4;};'use strict';var client=require(_0xfd2a('0x0'));exports[_0xfd2a('0x1')]=function(){return function(){return client[_0xfd2a('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xfd2a('0x3'),_0xfd2a('0x4'),'strategy'],'include':[{'model':_0xfd2a('0x5'),'as':_0xfd2a('0x6'),'attributes':['id','name',_0xfd2a('0x7'),_0xfd2a('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c734632..7ef7d37 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 _0x5e98=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x4781e0,_0x4651bd){var _0x52afab=function(_0x21febf){while(--_0x21febf){_0x4781e0['push'](_0x4781e0['shift']());}};_0x52afab(++_0x4651bd);}(_0x5e98,0x128));var _0x85e9=function(_0x514082,_0x2a6f04){_0x514082=_0x514082-0x0;var _0x28f141=_0x5e98[_0x514082];return _0x28f141;};'use strict';var client=require('../client');exports[_0x85e9('0x0')]=function(_0x259bae){return client[_0x85e9('0x1')](_0x85e9('0x2'),{'body':_0x259bae,'log':_0x85e9('0x2')});};exports[_0x85e9('0x3')]=function(_0x1a1e5a,_0x208c07){return client[_0x85e9('0x1')](_0x85e9('0x4'),{'body':_0x208c07,'options':{'where':{'uniqueid':_0x1a1e5a},'order':[['id',_0x85e9('0x5')]],'limit':0x1},'log':_0x85e9('0x4')});}; \ No newline at end of file +var _0x5047=['DESC','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x2112f5,_0x5b2331){var _0x574443=function(_0x3b1230){while(--_0x3b1230){_0x2112f5['push'](_0x2112f5['shift']());}};_0x574443(++_0x5b2331);}(_0x5047,0x97));var _0x7504=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x5047[_0x25cd2c];return _0x1e364c;};'use strict';var client=require('../client');exports['create']=function(_0x26bb50){return client[_0x7504('0x0')](_0x7504('0x1'),{'body':_0x26bb50,'log':_0x7504('0x1')});};exports[_0x7504('0x2')]=function(_0x4d8f21,_0x4086f8){return client[_0x7504('0x0')](_0x7504('0x3'),{'body':_0x4086f8,'options':{'where':{'uniqueid':_0x4d8f21},'order':[['id',_0x7504('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cb6dfbf..b24fc43 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 _0x0d74=['../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x5205b1,_0x2c972a){var _0x466c5c=function(_0x51b159){while(--_0x51b159){_0x5205b1['push'](_0x5205b1['shift']());}};_0x466c5c(++_0x2c972a);}(_0x0d74,0x93));var _0x40d7=function(_0x4a23fb,_0x52d9cf){_0x4a23fb=_0x4a23fb-0x0;var _0x14c160=_0x0d74[_0x4a23fb];return _0x14c160;};'use strict';var client=require(_0x40d7('0x0'));exports[_0x40d7('0x1')]=function(_0x395c21,_0x2c3429){return client['Request'](_0x40d7('0x2'),{'body':_0x2c3429,'options':{'where':{'id':_0x395c21}},'log':_0x40d7('0x3')});};exports[_0x40d7('0x4')]=function(_0x5410db,_0x419f00){return client['Request'](_0x40d7('0x5'),{'body':_0x419f00,'options':{'where':{'id':_0x5410db}},'log':_0x40d7('0x6')});}; \ No newline at end of file +var _0xdf79=['../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x109783,_0x20b881){var _0x2b8be9=function(_0x2467e4){while(--_0x2467e4){_0x109783['push'](_0x109783['shift']());}};_0x2b8be9(++_0x20b881);}(_0xdf79,0x1c7));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x9df7('0x0'));exports[_0x9df7('0x1')]=function(_0x298abf,_0x2073cd){return client['Request'](_0x9df7('0x2'),{'body':_0x2073cd,'options':{'where':{'id':_0x298abf}},'log':_0x9df7('0x3')});};exports['addTags']=function(_0x5b5f04,_0x193b79){return client[_0x9df7('0x4')](_0x9df7('0x5'),{'body':_0x193b79,'options':{'where':{'id':_0x5b5f04}},'log':_0x9df7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f8e2d2d..e299ad0 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 _0x42c3=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x910fc8,_0x1b38e7){var _0x4ff130=function(_0x354882){while(--_0x354882){_0x910fc8['push'](_0x910fc8['shift']());}};_0x4ff130(++_0x1b38e7);}(_0x42c3,0x17f));var _0x342c=function(_0x25b1bf,_0x9e60a3){_0x25b1bf=_0x25b1bf-0x0;var _0x1cf123=_0x42c3[_0x25b1bf];return _0x1cf123;};'use strict';var client=require(_0x342c('0x0'));exports[_0x342c('0x1')]=function(_0x27017f){return client['Request'](_0x342c('0x2'),{'body':_0x27017f,'log':_0x342c('0x3')});}; \ No newline at end of file +var _0x945e=['createOpenchannelMessage','../client','create'];(function(_0x3eff47,_0x2796a1){var _0x8c1be2=function(_0x43d039){while(--_0x43d039){_0x3eff47['push'](_0x3eff47['shift']());}};_0x8c1be2(++_0x2796a1);}(_0x945e,0x1c0));var _0xe945=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x945e[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0xe945('0x0'));exports[_0xe945('0x1')]=function(_0x8303d9){return client['Request']('CreateOpenchannelMessage',{'body':_0x8303d9,'log':_0xe945('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fc66f39..4785dbb 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 _0x504a=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents','name'];(function(_0x4c6763,_0x3c4c95){var _0x5147a=function(_0x5c79ac){while(--_0x5c79ac){_0x4c6763['push'](_0x4c6763['shift']());}};_0x5147a(++_0x3c4c95);}(_0x504a,0x134));var _0xa504=function(_0x157084,_0x4b431c){_0x157084=_0x157084-0x0;var _0x1714a1=_0x504a[_0x157084];return _0x1714a1;};'use strict';var client=require(_0xa504('0x0'));exports[_0xa504('0x1')]=function(){return function(){return client[_0xa504('0x2')](_0xa504('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xa504('0x4')],'include':[{'model':'User','as':_0xa504('0x5'),'attributes':['id',_0xa504('0x6'),_0xa504('0x7'),_0xa504('0x8')]}]},'log':_0xa504('0x1')});};}; \ No newline at end of file +var _0x92e2=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','getOpenchannelQueues','../client','Request'];(function(_0x4ec3ab,_0x50a5de){var _0x229613=function(_0x5c2daa){while(--_0x5c2daa){_0x4ec3ab['push'](_0x4ec3ab['shift']());}};_0x229613(++_0x50a5de);}(_0x92e2,0x19c));var _0x292e=function(_0x196ddc,_0x514491){_0x196ddc=_0x196ddc-0x0;var _0x5d15f2=_0x92e2[_0x196ddc];return _0x5d15f2;};'use strict';var client=require(_0x292e('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x292e('0x1')](_0x292e('0x2'),{'options':{'raw':![],'attributes':['id',_0x292e('0x3'),_0x292e('0x4'),_0x292e('0x5')],'include':[{'model':_0x292e('0x6'),'as':_0x292e('0x7'),'attributes':['id',_0x292e('0x3'),'online','openchannelPause']}]},'log':_0x292e('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c931266..efc8f7b 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 _0x679e=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x10c26e,_0x3dbc2e){var _0x3c48a3=function(_0x29999c){while(--_0x29999c){_0x10c26e['push'](_0x10c26e['shift']());}};_0x3c48a3(++_0x3dbc2e);}(_0x679e,0x1cd));var _0xe679=function(_0x2967d7,_0x493218){_0x2967d7=_0x2967d7-0x0;var _0x1460f7=_0x679e[_0x2967d7];return _0x1460f7;};'use strict';var client=require(_0xe679('0x0'));exports[_0xe679('0x1')]=function(_0x327949){return client[_0xe679('0x2')](_0xe679('0x3'),{'body':_0x327949,'log':_0xe679('0x3')});};exports[_0xe679('0x4')]=function(_0x3af429,_0x102c64){return client[_0xe679('0x2')](_0xe679('0x5'),{'body':_0x102c64,'options':{'where':{'uniqueid':_0x3af429},'order':[['id','DESC']],'limit':0x1},'log':_0xe679('0x5')});}; \ No newline at end of file +var _0x6796=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x118ee6,_0xa402d7){var _0x1d7bc3=function(_0x42e294){while(--_0x42e294){_0x118ee6['push'](_0x118ee6['shift']());}};_0x1d7bc3(++_0xa402d7);}(_0x6796,0x66));var _0x6679=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x6796[_0x202c61];return _0x540691;};'use strict';var client=require(_0x6679('0x0'));exports['create']=function(_0xe84e93){return client[_0x6679('0x1')]('CreateOpenchannelQueueReport',{'body':_0xe84e93,'log':_0x6679('0x2')});};exports[_0x6679('0x3')]=function(_0x38d743,_0x1011d6){return client[_0x6679('0x1')](_0x6679('0x4'),{'body':_0x1011d6,'options':{'where':{'uniqueid':_0x38d743},'order':[['id',_0x6679('0x5')]],'limit':0x1},'log':_0x6679('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a0aca10..a40cc51 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 _0x37cc=['update','Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x16af15,_0x55bc76){var _0xfeda8a=function(_0x13ad56){while(--_0x13ad56){_0x16af15['push'](_0x16af15['shift']());}};_0xfeda8a(++_0x55bc76);}(_0x37cc,0x185));var _0xc37c=function(_0x1d0311,_0x3a2e36){_0x1d0311=_0x1d0311-0x0;var _0x122587=_0x37cc[_0x1d0311];return _0x122587;};'use strict';var client=require(_0xc37c('0x0'));exports[_0xc37c('0x1')]=function(_0x461b6f,_0x3ba386){return client[_0xc37c('0x2')](_0xc37c('0x3'),{'body':_0x3ba386,'options':{'where':{'id':_0x461b6f}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x334d3c,_0x946e3b){return client[_0xc37c('0x2')](_0xc37c('0x4'),{'body':_0x946e3b,'options':{'where':{'id':_0x334d3c}},'log':_0xc37c('0x5')});}; \ No newline at end of file +var _0x09f4=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x572869,_0x34f39e){var _0x5c8ee4=function(_0x3ce8f7){while(--_0x3ce8f7){_0x572869['push'](_0x572869['shift']());}};_0x5c8ee4(++_0x34f39e);}(_0x09f4,0xe4));var _0x409f=function(_0x248553,_0x22ff05){_0x248553=_0x248553-0x0;var _0x34e3bd=_0x09f4[_0x248553];return _0x34e3bd;};'use strict';var client=require('../client');exports['update']=function(_0x203895,_0x1e5329){return client[_0x409f('0x0')](_0x409f('0x1'),{'body':_0x1e5329,'options':{'where':{'id':_0x203895}},'log':_0x409f('0x2')});};exports[_0x409f('0x3')]=function(_0x1d859b,_0x3c329a){return client[_0x409f('0x0')](_0x409f('0x4'),{'body':_0x3c329a,'options':{'where':{'id':_0x1d859b}},'log':_0x409f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index fd1ea18..06476da 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 _0x716b=['Request','createSmsMessage','../client','create'];(function(_0x4bc75c,_0x40738c){var _0x4af00d=function(_0x19cd7d){while(--_0x19cd7d){_0x4bc75c['push'](_0x4bc75c['shift']());}};_0x4af00d(++_0x40738c);}(_0x716b,0x1ca));var _0xb716=function(_0x1bc42b,_0x5f38c0){_0x1bc42b=_0x1bc42b-0x0;var _0x193af5=_0x716b[_0x1bc42b];return _0x193af5;};'use strict';var client=require(_0xb716('0x0'));exports[_0xb716('0x1')]=function(_0x339bbd){return client[_0xb716('0x2')]('CreateSmsMessage',{'body':_0x339bbd,'log':_0xb716('0x3')});}; \ No newline at end of file +var _0x9084=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5acdaf,_0x519f79){var _0x1067f5=function(_0x55780c){while(--_0x55780c){_0x5acdaf['push'](_0x5acdaf['shift']());}};_0x1067f5(++_0x519f79);}(_0x9084,0x126));var _0x4908=function(_0x3802c8,_0x2ed5d5){_0x3802c8=_0x3802c8-0x0;var _0x336d23=_0x9084[_0x3802c8];return _0x336d23;};'use strict';var client=require(_0x4908('0x0'));exports[_0x4908('0x1')]=function(_0x19544b){return client['Request'](_0x4908('0x2'),{'body':_0x19544b,'log':_0x4908('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5b78571..640cc78 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x40b468,_0x395dba){var _0x2cb086=function(_0x53ff72){while(--_0x53ff72){_0x40b468['push'](_0x40b468['shift']());}};_0x2cb086(++_0x395dba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0xcb91[_0x4da356];return _0x321b07;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x58c576,_0x3df9c6){var _0x2677c3=function(_0x9a8fca){while(--_0x9a8fca){_0x58c576['push'](_0x58c576['shift']());}};_0x2677c3(++_0x3df9c6);}(_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 0c3f689..bd0f719 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x217be2,_0x2d1567){var _0x58da4a=function(_0x4fcd59){while(--_0x4fcd59){_0x217be2['push'](_0x217be2['shift']());}};_0x58da4a(++_0x2d1567);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a119b,_0x4e95bb){_0x5a119b=_0x5a119b-0x0;var _0x341d7b=_0xedd9[_0x5a119b];return _0x341d7b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1407a5e..0112bf1 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(_0x2ae3e1,_0x1cef9d){var _0x3a7bc8=function(_0x2b05bd){while(--_0x2b05bd){_0x2ae3e1['push'](_0x2ae3e1['shift']());}};_0x3a7bc8(++_0x1cef9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x467e5d,_0x5d3b70){var _0x3906ea=function(_0xc96ff3){while(--_0xc96ff3){_0x467e5d['push'](_0x467e5d['shift']());}};_0x3906ea(++_0x5d3b70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 6f7ad93..a102707 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 _0x0d91=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x1975a2,_0x3d35fa){var _0x3cd52b=function(_0x25b237){while(--_0x25b237){_0x1975a2['push'](_0x1975a2['shift']());}};_0x3cd52b(++_0x3d35fa);}(_0x0d91,0x76));var _0x10d9=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0x0d91[_0x4d03d6];return _0x22752e;};'use strict';var client=require(_0x10d9('0x0'));exports[_0x10d9('0x1')]=function(_0x369f92,_0x37895e){return client['Request'](_0x10d9('0x2'),{'body':_0x37895e,'options':{'where':{'id':_0x369f92}},'log':_0x10d9('0x3')});};exports[_0x10d9('0x4')]=function(_0x56ab5d,_0x2f6e57){return client[_0x10d9('0x5')](_0x10d9('0x6'),{'body':_0x2f6e57,'options':{'where':{'id':_0x56ab5d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xdded=['../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1efc97,_0x2ecd26){var _0x1e1952=function(_0x51f78f){while(--_0x51f78f){_0x1efc97['push'](_0x1efc97['shift']());}};_0x1e1952(++_0x2ecd26);}(_0xdded,0x17a));var _0xddde=function(_0x3c9998,_0x14fa98){_0x3c9998=_0x3c9998-0x0;var _0x26f20a=_0xdded[_0x3c9998];return _0x26f20a;};'use strict';var client=require(_0xddde('0x0'));exports[_0xddde('0x1')]=function(_0x2833a6,_0x436a35){return client[_0xddde('0x2')](_0xddde('0x3'),{'body':_0x436a35,'options':{'where':{'id':_0x2833a6}},'log':'updateWhatsappInteraction'});};exports[_0xddde('0x4')]=function(_0x276cc6,_0x44468e){return client[_0xddde('0x2')](_0xddde('0x5'),{'body':_0x44468e,'options':{'where':{'id':_0x276cc6}},'log':_0xddde('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7c516bc..21b848a 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 _0x66c4=['CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x397bb2,_0x98192){var _0xab0416=function(_0x203b94){while(--_0x203b94){_0x397bb2['push'](_0x397bb2['shift']());}};_0xab0416(++_0x98192);}(_0x66c4,0xda));var _0x466c=function(_0xcaf544,_0x560224){_0xcaf544=_0xcaf544-0x0;var _0x4584c7=_0x66c4[_0xcaf544];return _0x4584c7;};'use strict';var client=require(_0x466c('0x0'));exports['create']=function(_0x35b68f){return client['Request'](_0x466c('0x1'),{'body':_0x35b68f,'log':_0x466c('0x2')});}; \ No newline at end of file +var _0xe129=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x152ef7,_0x221f4c){var _0x33b535=function(_0x4d9ab7){while(--_0x4d9ab7){_0x152ef7['push'](_0x152ef7['shift']());}};_0x33b535(++_0x221f4c);}(_0xe129,0x14b));var _0x9e12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe129[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9e12('0x0'));exports[_0x9e12('0x1')]=function(_0x1fd3ca){return client[_0x9e12('0x2')](_0x9e12('0x3'),{'body':_0x1fd3ca,'log':_0x9e12('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c6df6e4..a30b8bb 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 _0xd021=['User','Agents','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy'];(function(_0x63500b,_0x508aa1){var _0x492332=function(_0x1dc594){while(--_0x1dc594){_0x63500b['push'](_0x63500b['shift']());}};_0x492332(++_0x508aa1);}(_0xd021,0xa3));var _0x1d02=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd021[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x1d02('0x0')]=function(){return function(){return client[_0x1d02('0x1')](_0x1d02('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x1d02('0x3'),_0x1d02('0x4')],'include':[{'model':_0x1d02('0x5'),'as':_0x1d02('0x6'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x1d02('0x0')});};}; \ No newline at end of file +var _0xbc97=['online','whatsappPause','../client','getWhatsappQueues','Request','timeout','strategy','User','name'];(function(_0x598917,_0x903f04){var _0x261cc8=function(_0x1feaea){while(--_0x1feaea){_0x598917['push'](_0x598917['shift']());}};_0x261cc8(++_0x903f04);}(_0xbc97,0xda));var _0x7bc9=function(_0x11bd58,_0x10ef44){_0x11bd58=_0x11bd58-0x0;var _0x5d380f=_0xbc97[_0x11bd58];return _0x5d380f;};'use strict';var client=require(_0x7bc9('0x0'));exports[_0x7bc9('0x1')]=function(){return function(){return client[_0x7bc9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x7bc9('0x3'),_0x7bc9('0x4')],'include':[{'model':_0x7bc9('0x5'),'as':'Agents','attributes':['id',_0x7bc9('0x6'),_0x7bc9('0x7'),_0x7bc9('0x8')]}]},'log':_0x7bc9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3a26b94..547b426 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 _0xe6fd=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x18a417,_0x398cf6){var _0x5e116b=function(_0x49ceb0){while(--_0x49ceb0){_0x18a417['push'](_0x18a417['shift']());}};_0x5e116b(++_0x398cf6);}(_0xe6fd,0x6b));var _0xde6f=function(_0x1f3492,_0x26412a){_0x1f3492=_0x1f3492-0x0;var _0x298e36=_0xe6fd[_0x1f3492];return _0x298e36;};'use strict';var client=require(_0xde6f('0x0'));exports[_0xde6f('0x1')]=function(_0x12b046){return client[_0xde6f('0x2')]('CreateWhatsappQueueReport',{'body':_0x12b046,'log':_0xde6f('0x3')});};exports[_0xde6f('0x4')]=function(_0x494d21,_0x1b41b6){return client[_0xde6f('0x2')]('UpdateWhatsappQueueReport',{'body':_0x1b41b6,'options':{'where':{'uniqueid':_0x494d21},'order':[['id',_0xde6f('0x5')]],'limit':0x1},'log':_0xde6f('0x6')});}; \ No newline at end of file +var _0x8684=['update','Request','UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8684,0x9e));var _0x4868=function(_0xe45773,_0x7905eb){_0xe45773=_0xe45773-0x0;var _0x4d7cfc=_0x8684[_0xe45773];return _0x4d7cfc;};'use strict';var client=require(_0x4868('0x0'));exports['create']=function(_0x21b3c6){return client['Request'](_0x4868('0x1'),{'body':_0x21b3c6,'log':'CreateWhatsappQueueReport'});};exports[_0x4868('0x2')]=function(_0x38e653,_0x261db5){return client[_0x4868('0x3')](_0x4868('0x4'),{'body':_0x261db5,'options':{'where':{'uniqueid':_0x38e653},'order':[['id','DESC']],'limit':0x1},'log':_0x4868('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 9c57ac3..33c9f3a 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 _0x1099=['timeout','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','agent','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','message','join','stop','find','agents'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1099,0xed));var _0x9109=function(_0x45d228,_0x164d7e){_0x45d228=_0x45d228-0x0;var _0x208ed8=_0x1099[_0x45d228];return _0x208ed8;};'use strict';var schema=require(_0x9109('0x0'));var _=require(_0x9109('0x1'));var util=require(_0x9109('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x9109('0x3'));var strategy=require(_0x9109('0x4'));var queue=schema({'name':{'type':_0x9109('0x5'),'required':!![],'message':_0x9109('0x6')},'timeout':{'type':_0x9109('0x7'),'message':_0x9109('0x8')}});function writeLog(_0x5273c1,_0x448d2a,_0x535d10){return logger[_0x9109('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5273c1,_0x448d2a[_0x9109('0xa')],_0x535d10));}function handleFindAgent(_0x1d296b){return function(_0x197370){return _0x197370['name'][_0x9109('0xb')]()===_0x1d296b[_0x9109('0xb')]();};}exports[_0x9109('0xc')]=function(_0x3e5777,_0x3eb3d4,_0x29ec87,_0x328d35){return function(_0x2cfe24){try{var _0x12bee7={'name':_0x3eb3d4[0x0],'timeout':_0x3eb3d4[0x1]};var _0x260293=queue[_0x9109('0x0')](_0x12bee7,{'typecast':!![]});if(_0x260293[_0x9109('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0x3e5777,_['map'](_0x260293,_0x9109('0xe'))[_0x9109('0xf')](',\x20'));_0x2cfe24[_0x9109('0x10')]();}else{var _0x3eb7e5=_[_0x9109('0x11')](_0x29ec87[_0x9109('0x12')],handleFindAgent(_0x12bee7[_0x9109('0xa')]));if(_0x3eb7e5){var _0x349e88=(_0x12bee7[_0x9109('0x13')]||0xa)*0x3e8;var _0x13e6ef,_0x14dc65;var _0x55f3d9=seqqueue['createQueue'](_0x349e88);_0x55f3d9['id']=_0x3e5777;_0x55f3d9[_0x9109('0x14')]=_0x349e88;_0x55f3d9[_0x9109('0x15')]=_0x328d35[_0x9109('0x15')];writeLog(_0x3e5777,_0x3eb7e5,util[_0x9109('0x16')](_0x9109('0x17'),_0x349e88));_0x29ec87[_0x9109('0x18')][_0x3e5777]['on'](_0x9109('0x19'),function(){logger[_0x9109('0x9')](_0x9109('0x1a'),_0x3e5777);clearTimeout(_0x14dc65);_0x14dc65=undefined;_0x55f3d9['close']();if(_0x29ec87[_0x9109('0x18')][_0x3e5777]){delete _0x29ec87[_0x9109('0x18')][_0x3e5777];}_0x2cfe24[_0x9109('0x10')]();});_0x29ec87['rules'][_0x3e5777]['on'](_0x9109('0x1b'),function(){if(_0x29ec87[_0x9109('0x18')][_0x3e5777]){delete _0x29ec87[_0x9109('0x18')][_0x3e5777];}});_0x14dc65=setTimeout(function(){logger[_0x9109('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3e5777);clearTimeout(_0x14dc65);_0x55f3d9['close']();_0x2cfe24['next']();},_0x349e88);strategy[_0x9109('0x1c')](_0x55f3d9,_0x3eb7e5,_0x29ec87,_0x328d35);}else{logger[_0x9109('0x1d')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3e5777,_0x12bee7[_0x9109('0xa')]);_0x2cfe24[_0x9109('0x10')]();}}}catch(_0x8a0132){console['log'](_0x8a0132);logger[_0x9109('0x1d')](_0x9109('0x1e'),_0x3e5777,_0x8a0132[_0x9109('0x1f')]);_0x2cfe24['stop']();}};}; \ No newline at end of file +var _0x621e=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','stop','agents','timeout','createQueue','channel','START:%s','rules'];(function(_0x1e4fdc,_0x1e591a){var _0x25d60a=function(_0x34a7a3){while(--_0x34a7a3){_0x1e4fdc['push'](_0x1e4fdc['shift']());}};_0x25d60a(++_0x1e591a);}(_0x621e,0xd5));var _0xe621=function(_0x411f83,_0x57155c){_0x411f83=_0x411f83-0x0;var _0x4ee1ff=_0x621e[_0x411f83];return _0x4ee1ff;};'use strict';var schema=require(_0xe621('0x0'));var _=require(_0xe621('0x1'));var util=require('util');var seqqueue=require(_0xe621('0x2'));var logger=require(_0xe621('0x3'))(_0xe621('0x4'));var strategy=require(_0xe621('0x5'));var queue=schema({'name':{'type':_0xe621('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xe621('0x7')}});function writeLog(_0x9a0d73,_0x492cba,_0x5b7846){return logger[_0xe621('0x8')](util[_0xe621('0x9')](_0xe621('0xa'),_0x9a0d73,_0x492cba[_0xe621('0xb')],_0x5b7846));}function handleFindAgent(_0x4498b8){return function(_0x43bda9){return _0x43bda9[_0xe621('0xb')][_0xe621('0xc')]()===_0x4498b8['toLowerCase']();};}exports[_0xe621('0xd')]=function(_0x16d392,_0x47d80d,_0xc6e1c7,_0x212a93){return function(_0x49a749){try{var _0x232c8f={'name':_0x47d80d[0x0],'timeout':_0x47d80d[0x1]};var _0x2f01de=queue[_0xe621('0x0')](_0x232c8f,{'typecast':!![]});if(_0x2f01de[_0xe621('0xe')]){logger[_0xe621('0xf')]('[%s][AGENT]\x20%s',_0x16d392,_[_0xe621('0x10')](_0x2f01de,_0xe621('0x11'))['join'](',\x20'));_0x49a749[_0xe621('0x12')]();}else{var _0x5ce9db=_['find'](_0xc6e1c7[_0xe621('0x13')],handleFindAgent(_0x232c8f['name']));if(_0x5ce9db){var _0x23448f=(_0x232c8f[_0xe621('0x14')]||0xa)*0x3e8;var _0x4108da,_0x11c1fc;var _0x212809=seqqueue[_0xe621('0x15')](_0x23448f);_0x212809['id']=_0x16d392;_0x212809['atimeout']=_0x23448f;_0x212809[_0xe621('0x16')]=_0x212a93['channel'];writeLog(_0x16d392,_0x5ce9db,util['format'](_0xe621('0x17'),_0x23448f));_0xc6e1c7[_0xe621('0x18')][_0x16d392]['on'](_0xe621('0x19'),function(){logger[_0xe621('0x8')](_0xe621('0x1a'),_0x16d392);clearTimeout(_0x11c1fc);_0x11c1fc=undefined;_0x212809['close']();if(_0xc6e1c7[_0xe621('0x18')][_0x16d392]){delete _0xc6e1c7[_0xe621('0x18')][_0x16d392];}_0x49a749['stop']();});_0xc6e1c7['rules'][_0x16d392]['on'](_0xe621('0x1b'),function(){if(_0xc6e1c7['rules'][_0x16d392]){delete _0xc6e1c7[_0xe621('0x18')][_0x16d392];}});_0x11c1fc=setTimeout(function(){logger[_0xe621('0x8')](_0xe621('0x1c'),_0x16d392);clearTimeout(_0x11c1fc);_0x212809[_0xe621('0x1d')]();_0x49a749['next']();},_0x23448f);strategy[_0xe621('0x1e')](_0x212809,_0x5ce9db,_0xc6e1c7,_0x212a93);}else{logger['error'](_0xe621('0x1f'),_0x16d392,_0x232c8f[_0xe621('0xb')]);_0x49a749[_0xe621('0x12')]();}}}catch(_0x43f48e){console[_0xe621('0x20')](_0x43f48e);logger[_0xe621('0xf')]('[%s][QUEUE]\x20%s',_0x16d392,_0x43f48e[_0xe621('0x21')]);_0x49a749['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index aadc161..cabcdaa 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 _0x7201=['UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','then','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','providerName','amazonlex','dialogState','Failed','error','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction'];(function(_0x3c2e6b,_0x12f686){var _0x4ddeb7=function(_0x5d8a22){while(--_0x5d8a22){_0x3c2e6b['push'](_0x3c2e6b['shift']());}};_0x4ddeb7(++_0x12f686);}(_0x7201,0x1cc));var _0x1720=function(_0xb763c9,_0x1d5fcf){_0xb763c9=_0xb763c9-0x0;var _0x387124=_0x7201[_0xb763c9];return _0x387124;};'use strict';var _=require(_0x1720('0x0'));var moment=require(_0x1720('0x1'));var AWS=require(_0x1720('0x2'));var utils=require('./utils');var logger=require(_0x1720('0x3'))('routing');var rpc={'chatMessage':require(_0x1720('0x4')),'openchannelMessage':require(_0x1720('0x5')),'mailMessage':require(_0x1720('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1720('0x7')]=function(_0x32b56c,_0x1ff4e0){return function(_0x104439){try{if(!_[_0x1720('0x8')](this[_0x1720('0x9')][_0x1720('0xa')])){logger[_0x1720('0xb')](_0x1720('0xc'),_0x32b56c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x104439[_0x1720('0xd')]();}var _0x53098b={'ContactId':this[_0x1720('0xe')]['id'],'sentAt':moment()[_0x1720('0xf')](_0x1720('0x10')),'direction':_0x1720('0x11')};if(this[_0x1720('0x12')]===_0x1720('0x13')||this[_0x1720('0x12')]===_0x1720('0x14')){_0x53098b[_0x1720('0x15')]=this[_0x1720('0x9')][_0x1720('0x15')];}var _0x10f683=this[_0x1720('0x12')];if(_0x10f683===_0x1720('0x16')){_0x53098b[_0x1720('0x17')]=this['account']['id'];}else{_0x53098b[_[_0x1720('0x18')](_0x10f683)+'AccountId']=this['account']['id'];}_0x53098b[_[_0x1720('0x18')](_0x10f683)+'InteractionId']=this['interaction']['id'];if(this[_0x1720('0x9')][_0x1720('0x19')]){var _0x26f712=_0x1ff4e0[0x4];if(!_[_0x1720('0x1a')](_0x26f712)){_0x53098b[_0x1720('0x1b')]=utils[_0x1720('0x1c')](_0x26f712,this);return rpc[_0x10f683+_0x1720('0x1d')][_0x1720('0x1e')](_0x53098b)[_0x1720('0x1f')](function(_0x4d24b1){logger[_0x1720('0xb')](_0x1720('0xc'),_0x32b56c,_0x53098b[_0x1720('0x1b')]);})['catch'](function(_0x4fffdd){logger['error'](_0x1720('0xc'),_0x32b56c,JSON[_0x1720('0x20')](_0x4fffdd));})[_0x1720('0x21')](function(){logger['info'](_0x1720('0x22'),_0x32b56c);_0x104439[_0x1720('0x23')]();});}else{logger[_0x1720('0xb')](_0x1720('0x24'),_0x32b56c);_0x104439['stop']();}}else{var _0x16b8ce=this;var _0x37da9e=new AWS[(_0x1720('0x25'))]({'accessKeyId':_0x1ff4e0[0x0],'secretAccessKey':_0x1ff4e0[0x1],'region':_0x1ff4e0[0x2]});var _0x16380c={'botAlias':_0x1720('0x26'),'botName':_0x1ff4e0[0x3],'inputText':this[_0x1720('0x27')][_0x1720('0x1b')],'userId':this[_0x1720('0x12')]+':'+this['interaction']['id'][_0x1720('0x28')]()};_0x37da9e[_0x1720('0x29')](_0x16380c,function(_0x33e3a2,_0x49c337){if(_0x33e3a2){logger['error'](_0x1720('0xc'),_0x32b56c,_0x33e3a2['message']);_0x104439[_0x1720('0xd')]();}else if(_0x49c337&&_0x49c337[_0x1720('0x27')]){_0x16b8ce[_0x1720('0x1b')]['amazonlex']=_0x49c337;_0x53098b['body']=_0x49c337[_0x1720('0x27')];_0x53098b[_0x1720('0x2a')]=_0x1720('0x2b');_0x53098b['providerResponse']=JSON[_0x1720('0x20')](_0x49c337);return rpc[_0x10f683+_0x1720('0x1d')][_0x1720('0x1e')](_0x53098b)[_0x1720('0x1f')](function(_0x1f175a){logger[_0x1720('0xb')](_0x1720('0xc'),_0x32b56c,_0x53098b[_0x1720('0x1b')]);if(_0x49c337[_0x1720('0x2c')]==_0x1720('0x2d')){_0x104439[_0x1720('0xd')]();}else{_0x104439[_0x1720('0x23')]();}})['catch'](function(_0x313c25){logger['error']('[%s][AMAZONLEX]\x20%s',_0x32b56c,JSON[_0x1720('0x20')](_0x313c25));_0x104439[_0x1720('0xd')]();});}else{_0x104439['next']();}});}}catch(_0x4f2b72){logger[_0x1720('0x2e')](_0x1720('0xc'),_0x32b56c,JSON[_0x1720('0x20')](_0x4f2b72));_0x104439['stop']();}};}; \ No newline at end of file +var _0x6bd7=['lodash','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerName','providerResponse','Message','dialogState','Failed'];(function(_0x151f00,_0x4ca3a1){var _0x418d9b=function(_0x5c37c7){while(--_0x5c37c7){_0x151f00['push'](_0x151f00['shift']());}};_0x418d9b(++_0x4ca3a1);}(_0x6bd7,0x84));var _0x76bd=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x6bd7[_0x581960];return _0x4ee892;};'use strict';var _=require(_0x76bd('0x0'));var moment=require('moment');var AWS=require(_0x76bd('0x1'));var utils=require('./utils');var logger=require(_0x76bd('0x2'))('routing');var rpc={'chatMessage':require(_0x76bd('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x76bd('0x4')),'faxMessage':require(_0x76bd('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x76bd('0x6')]=function(_0x474485,_0xfadeab){return function(_0x6dc1ec){try{if(!_['isNil'](this[_0x76bd('0x7')][_0x76bd('0x8')])){logger[_0x76bd('0x9')]('[%s][AMAZONLEX]\x20%s',_0x474485,_0x76bd('0xa'));return _0x6dc1ec[_0x76bd('0xb')]();}var _0x45a1a8={'ContactId':this[_0x76bd('0xc')]['id'],'sentAt':moment()[_0x76bd('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x76bd('0xe')};if(this[_0x76bd('0xf')]==='sms'||this['channel']===_0x76bd('0x10')){_0x45a1a8['phone']=this[_0x76bd('0x7')][_0x76bd('0x11')];}var _0x3ef587=this['channel'];if(_0x3ef587===_0x76bd('0x12')){_0x45a1a8['ChatWebsiteId']=this[_0x76bd('0x13')]['id'];}else{_0x45a1a8[_[_0x76bd('0x14')](_0x3ef587)+_0x76bd('0x15')]=this[_0x76bd('0x13')]['id'];}_0x45a1a8[_['upperFirst'](_0x3ef587)+_0x76bd('0x16')]=this[_0x76bd('0x7')]['id'];if(this[_0x76bd('0x7')]['created']){var _0x25ec36=_0xfadeab[0x4];if(!_[_0x76bd('0x17')](_0x25ec36)){_0x45a1a8[_0x76bd('0x18')]=utils['getMustacheRender'](_0x25ec36,this);return rpc[_0x3ef587+'Message'][_0x76bd('0x19')](_0x45a1a8)[_0x76bd('0x1a')](function(_0x259b41){logger[_0x76bd('0x9')](_0x76bd('0x1b'),_0x474485,_0x45a1a8['body']);})[_0x76bd('0x1c')](function(_0x33a0a7){logger[_0x76bd('0x1d')](_0x76bd('0x1b'),_0x474485,JSON[_0x76bd('0x1e')](_0x33a0a7));})[_0x76bd('0x1f')](function(){logger[_0x76bd('0x9')](_0x76bd('0x20'),_0x474485);_0x6dc1ec[_0x76bd('0x21')]();});}else{logger[_0x76bd('0x9')](_0x76bd('0x22'),_0x474485);_0x6dc1ec[_0x76bd('0x21')]();}}else{var _0x1cf473=this;var _0x44de10=new AWS[(_0x76bd('0x23'))]({'accessKeyId':_0xfadeab[0x0],'secretAccessKey':_0xfadeab[0x1],'region':_0xfadeab[0x2]});var _0x345566={'botAlias':'$LATEST','botName':_0xfadeab[0x3],'inputText':this[_0x76bd('0x24')][_0x76bd('0x18')],'userId':this[_0x76bd('0xf')]+':'+this[_0x76bd('0x7')]['id']['toString']()};_0x44de10[_0x76bd('0x25')](_0x345566,function(_0x35e2b0,_0x50dfca){if(_0x35e2b0){logger[_0x76bd('0x1d')](_0x76bd('0x1b'),_0x474485,_0x35e2b0[_0x76bd('0x24')]);_0x6dc1ec[_0x76bd('0xb')]();}else if(_0x50dfca&&_0x50dfca[_0x76bd('0x24')]){_0x1cf473['body'][_0x76bd('0x26')]=_0x50dfca;_0x45a1a8[_0x76bd('0x18')]=_0x50dfca['message'];_0x45a1a8[_0x76bd('0x27')]=_0x76bd('0x26');_0x45a1a8[_0x76bd('0x28')]=JSON['stringify'](_0x50dfca);return rpc[_0x3ef587+_0x76bd('0x29')][_0x76bd('0x19')](_0x45a1a8)[_0x76bd('0x1a')](function(_0x30dcd3){logger[_0x76bd('0x9')]('[%s][AMAZONLEX]\x20%s',_0x474485,_0x45a1a8[_0x76bd('0x18')]);if(_0x50dfca[_0x76bd('0x2a')]==_0x76bd('0x2b')){_0x6dc1ec[_0x76bd('0xb')]();}else{_0x6dc1ec[_0x76bd('0x21')]();}})['catch'](function(_0xd21b2c){logger[_0x76bd('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x474485,JSON[_0x76bd('0x1e')](_0xd21b2c));_0x6dc1ec[_0x76bd('0xb')]();});}else{_0x6dc1ec['next']();}});}}catch(_0x4c5aac){logger[_0x76bd('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x474485,JSON[_0x76bd('0x1e')](_0x4c5aac));_0x6dc1ec['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 0473c12..55477bd 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 _0x2365=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','Interaction','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','';_0x328c8a['headers']={'Auto-Submitted':_0x5236('0x32'),'X-Auto-Response-Suppress':_0x5236('0x33'),'Precedence':_0x5236('0x34')};return mailRpc['sendMailMessage'](this[_0x5236('0x27')]['smtpOptions'],_0x328c8a)[_0x5236('0x35')](function(_0x372145){logger['info'](_0x5236('0x36'),_0x362639);_0x328c8a['messageId']=_0x372145[_0x5236('0x1e')][_0x5236('0x2c')];return rpc[_0x345a75+_0x5236('0x2b')][_0x5236('0x37')](_0x328c8a);})[_0x5236('0x35')](function(_0x23f552){logger['info'](_0x5236('0x15'),_0x362639,JSON[_0x5236('0x38')](_0x23f552));})[_0x5236('0x39')](function(_0xf223fe){logger[_0x5236('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x362639,JSON[_0x5236('0x38')](_0xf223fe));})['finally'](function(){Promise[_0x5236('0x3b')]()['then'](function(){if(_0x286223[0x0]!=='2'||_0x4b4440[_0x5236('0x3c')])return;return rpc[_0x345a75+'Interaction'][_0x5236('0x3d')](_0x4b4440['id'],{'autoreplyExecuted':!![]})[_0x5236('0x35')](function(_0x656094){logger[_0x5236('0x14')](_0x5236('0x17'),_0x362639,JSON[_0x5236('0x38')](_0x656094));})[_0x5236('0x39')](function(_0x1d1765){logger[_0x5236('0x3a')](_0x5236('0x3e'),_0x362639,JSON[_0x5236('0x38')](_0x1d1765));});})[_0x5236('0x35')](function(){_0x175750[_0x5236('0x10')]();});});}else{return rpc[this['channel']+_0x5236('0x2b')][_0x5236('0x37')](_0x328c8a)[_0x5236('0x35')](function(){logger[_0x5236('0x14')]('[%s][AUTOREPLY]\x20%s',_0x362639,_0x328c8a['body']);})['catch'](function(_0x7b06c6){logger[_0x5236('0x3a')](_0x5236('0x15'),_0x362639,JSON[_0x5236('0x38')](_0x7b06c6));})[_0x5236('0x3f')](function(){Promise['resolve']()[_0x5236('0x35')](function(){if(_0x286223[0x0]!=='2'||_0x4b4440['autoreplyExecuted'])return;return rpc[_0x345a75+_0x5236('0x40')]['update'](_0x4b4440['id'],{'autoreplyExecuted':!![]})[_0x5236('0x35')](function(_0x2487a5){logger[_0x5236('0x14')](_0x5236('0x17'),_0x362639,JSON[_0x5236('0x38')](_0x2487a5));})[_0x5236('0x39')](function(_0x1804d8){logger[_0x5236('0x3a')](_0x5236('0x3e'),_0x362639,JSON[_0x5236('0x38')](_0x1804d8));});})[_0x5236('0x35')](function(){_0x175750[_0x5236('0x10')]();});});}}}catch(_0x494f50){logger[_0x5236('0x3a')](_0x5236('0x15'),_0x362639,JSON[_0x5236('0x38')](_0x494f50));_0x175750[_0x5236('0x41')]();}};}; \ No newline at end of file +var _0xf176=['inReplyTo','html','','replace','','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','channel','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message'];(function(_0xfdc8a3,_0x1baafd){var _0x171718=function(_0x3fb6c5){while(--_0x3fb6c5){_0xfdc8a3['push'](_0xfdc8a3['shift']());}};_0x171718(++_0x1baafd);}(_0xf176,0x1a3));var _0x6f17=function(_0x3595e1,_0xe61b37){_0x3595e1=_0x3595e1-0x0;var _0x94864b=_0xf176[_0x3595e1];return _0x94864b;};'use strict';var _=require('lodash');var moment=require(_0x6f17('0x0'));var utils=require(_0x6f17('0x1'));var logger=require('../../../../config/logger')(_0x6f17('0x2'));var rpc={'chatMessage':require(_0x6f17('0x3')),'openchannelMessage':require(_0x6f17('0x4')),'mailMessage':require(_0x6f17('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6f17('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x6f17('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x6f17('0x8')),'smsInteraction':require(_0x6f17('0x9')),'faxInteraction':require(_0x6f17('0xa')),'whatsappInteraction':require(_0x6f17('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x6f17('0xc')]=function(_0x2a053e,_0x1c3833,_0x549d3d,_0x3ea210){return function(_0x5562cc){try{var _0x291b7a=this['channel'];if(_0x291b7a===_0x6f17('0xd')&&_0x3ea210['body'][_0x6f17('0xe')]){logger[_0x6f17('0xf')](_0x6f17('0x10'),_0x2a053e,_0x6f17('0x11'));return _0x5562cc['next']();}if(_0x1c3833[0x0]==='1'&&(_[_0x6f17('0x12')](this['interaction'][_0x6f17('0x13')])||!this[_0x6f17('0x14')][_0x6f17('0x13')])){logger[_0x6f17('0xf')](_0x6f17('0x10'),_0x2a053e,_0x6f17('0x15'));return _0x5562cc[_0x6f17('0x16')]();}if(_0x1c3833[0x0]==='2'&&this[_0x6f17('0x14')][_0x6f17('0x17')]){logger[_0x6f17('0xf')](_0x6f17('0x18'),_0x2a053e,_0x6f17('0x19'));return _0x5562cc[_0x6f17('0x16')]();}var _0x1e403c={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6f17('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6f17('0x1b')};if(this[_0x6f17('0x1c')]==='mail'){_0x1e403c[_0x6f17('0x1d')]=utils[_0x6f17('0x1e')](_0x1c3833[0x2],this);}else{_0x1e403c[_0x6f17('0x1d')]=utils['getMustacheRender'](_0x1c3833[0x1],this);}if(this[_0x6f17('0x1f')]){_0x1e403c['to']=this[_0x6f17('0x1f')][_0x6f17('0x20')]||'';if(this[_0x6f17('0x1c')]===_0x6f17('0xd')&&_0x1c3833[0x1]==='1'){_0x1e403c['cc']=this[_0x6f17('0x1f')]['cc']||'';}_0x1e403c[_0x6f17('0x20')]=this[_0x6f17('0x1f')]['to']||'';_0x1e403c[_0x6f17('0x21')]=this['message'][_0x6f17('0x21')]||'';_0x1e403c[_0x6f17('0x22')]=!![];if(this[_0x6f17('0x1f')][_0x6f17('0x23')]){_0x1e403c[_0x6f17('0x23')]='';_0x1e403c[_0x6f17('0x23')]+=_['startsWith'](this[_0x6f17('0x1f')][_0x6f17('0x23')],_0x6f17('0x24'))?'':_0x6f17('0x25');_0x1e403c['subject']+=this[_0x6f17('0x1f')][_0x6f17('0x23')];}}if(this[_0x6f17('0x1c')]==='chat'){_0x1e403c[_0x6f17('0x26')]=this[_0x6f17('0x27')]['id'];}else{_0x1e403c[_[_0x6f17('0x28')](this['channel'])+_0x6f17('0x29')]=this['account']['id'];}_0x1e403c[_[_0x6f17('0x28')](this[_0x6f17('0x1c')])+'InteractionId']=this['interaction']['id'];var _0x4ae899=this[_0x6f17('0x14')];if(rpc[this[_0x6f17('0x1c')]+_0x6f17('0x2a')]){if(this['channel']===_0x6f17('0xd')){_0x1e403c[_0x6f17('0x2b')]=this['message']['messageId'];_0x1e403c[_0x6f17('0x2c')]=_0x6f17('0x2d')+_[_0x6f17('0x2e')](_0x1e403c['body'],']+(>|$)/g,''),'priorityTrue':_0x1dc13e[0x1],'priorityFalse':_0x1dc13e[0x2]};var _0x13be7b=gotoif['validate'](_0x554a74,{'typecast':!![]});if(_0x13be7b[_0xb7bd('0xf')]){logger[_0xb7bd('0x10')](_0xb7bd('0x11'),_0x3c1199,_[_0xb7bd('0x12')](_0x13be7b,_0xb7bd('0x13'))[_0xb7bd('0x14')](',\x20'));_0x43cca6['stop']();}else{try{var _0xad7f97=eval('('+_0x554a74['condition']+')');var _0x45ab89=_0xad7f97?_0x554a74[_0xb7bd('0x15')]:_0x554a74[_0xb7bd('0x16')];logger['info'](_0xb7bd('0x17'),_0x3c1199,_0x554a74['condition'],_0xad7f97,_0x45ab89||_0xb7bd('0x18'));if(_0x45ab89){var _0x5095c5=_['findIndex'](_0x43cca6[_0xb7bd('0x19')](),{'p':_0x45ab89});if(_0x5095c5>=0x0){logger[_0xb7bd('0x1a')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3c1199,_0x45ab89||_0xb7bd('0x18'),_0x5095c5);_0x43cca6[_0xb7bd('0x18')](_0x5095c5);}else{logger[_0xb7bd('0x1a')](_0xb7bd('0x1b'),_0x3c1199,_0x45ab89||_0xb7bd('0x18'));_0x43cca6['stop']();}}else{_0x43cca6[_0xb7bd('0x18')]();}}catch(_0x4e3675){logger[_0xb7bd('0x10')](_0xb7bd('0x1c'),_0x3c1199,_0x4e3675[_0xb7bd('0x13')]);_0x43cca6[_0xb7bd('0x1d')]();}}}catch(_0x137f26){logger[_0xb7bd('0x10')](_0xb7bd('0x11'),_0x3c1199,JSON[_0xb7bd('0x1e')](_0x137f26));_0x43cca6[_0xb7bd('0x1d')]();}};}; \ No newline at end of file +var _0x9f3e=['priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','[%s][GOTOIF]\x20%s','map','join','stop','condition'];(function(_0x139f63,_0x4aafb4){var _0x52b9dd=function(_0x41a14d){while(--_0x41a14d){_0x139f63['push'](_0x139f63['shift']());}};_0x52b9dd(++_0x4aafb4);}(_0x9f3e,0x10f));var _0xe9f3=function(_0x5710b7,_0xae6b6e){_0x5710b7=_0x5710b7-0x0;var _0x52051d=_0x9f3e[_0x5710b7];return _0x52051d;};'use strict';var schema=require(_0xe9f3('0x0'));var _=require(_0xe9f3('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xe9f3('0x2'))(_0xe9f3('0x3'));var gotoif=schema({'condition':{'type':_0xe9f3('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xe9f3('0x5'),'message':_0xe9f3('0x6')},'priorityFalse':{'type':_0xe9f3('0x5'),'message':_0xe9f3('0x7')}});exports['consequence']=function(_0x33f196,_0x1d4782){return function(_0x3f37a8){try{var _0x19a8ea={'condition':htmlToText[_0xe9f3('0x8')](utils['getMustacheRender'](_0x1d4782[0x0],this),{'wordwrap':![]})[_0xe9f3('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1d4782[0x1],'priorityFalse':_0x1d4782[0x2]};var _0x4436f6=gotoif['validate'](_0x19a8ea,{'typecast':!![]});if(_0x4436f6['length']){logger['error'](_0xe9f3('0xa'),_0x33f196,_[_0xe9f3('0xb')](_0x4436f6,'message')[_0xe9f3('0xc')](',\x20'));_0x3f37a8[_0xe9f3('0xd')]();}else{try{var _0xea0cba=eval('('+_0x19a8ea[_0xe9f3('0xe')]+')');var _0x460367=_0xea0cba?_0x19a8ea[_0xe9f3('0xf')]:_0x19a8ea[_0xe9f3('0x10')];logger[_0xe9f3('0x11')](_0xe9f3('0x12'),_0x33f196,_0x19a8ea[_0xe9f3('0xe')],_0xea0cba,_0x460367||'next');if(_0x460367){var _0x3f8c9e=_[_0xe9f3('0x13')](_0x3f37a8['rules'](),{'p':_0x460367});if(_0x3f8c9e>=0x0){logger[_0xe9f3('0x11')](_0xe9f3('0x14'),_0x33f196,_0x460367||_0xe9f3('0x15'),_0x3f8c9e);_0x3f37a8[_0xe9f3('0x15')](_0x3f8c9e);}else{logger['info'](_0xe9f3('0x16'),_0x33f196,_0x460367||_0xe9f3('0x15'));_0x3f37a8[_0xe9f3('0xd')]();}}else{_0x3f37a8[_0xe9f3('0x15')]();}}catch(_0x45c21a){logger[_0xe9f3('0x17')](_0xe9f3('0x18'),_0x33f196,_0x45c21a['message']);_0x3f37a8[_0xe9f3('0xd')]();}}}catch(_0x2b1899){logger[_0xe9f3('0x17')](_0xe9f3('0xa'),_0x33f196,JSON[_0xe9f3('0x19')](_0x2b1899));_0x3f37a8[_0xe9f3('0xd')]();}};}; \ 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 c0accbd..1bcc672 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 _0x6b97=['routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','../../../../config/logger'];(function(_0x74349d,_0x5b2437){var _0x59537c=function(_0x544ce5){while(--_0x544ce5){_0x74349d['push'](_0x74349d['shift']());}};_0x59537c(++_0x5b2437);}(_0x6b97,0x1f3));var _0x76b9=function(_0x1b8d1c,_0x395b3b){_0x1b8d1c=_0x1b8d1c-0x0;var _0x159a0b=_0x6b97[_0x1b8d1c];return _0x159a0b;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x76b9('0x0'))(_0x76b9('0x1'));var gotop=schema({'priority':{'type':_0x76b9('0x2'),'required':!![],'message':_0x76b9('0x3')}});exports[_0x76b9('0x4')]=function(_0x3722a5,_0x3989b5){return function(_0x81e59e){try{var _0x248e2d={'priority':_0x3989b5[0x0]};var _0x3a38f3=gotop[_0x76b9('0x5')](_0x248e2d,{'typecast':!![]});if(_0x3a38f3[_0x76b9('0x6')]){logger[_0x76b9('0x7')]('[%s][GOTOP]\x20%s',_0x3722a5,_[_0x76b9('0x8')](_0x3a38f3,_0x76b9('0x9'))['join'](',\x20'));_0x81e59e['stop']();}else{logger[_0x76b9('0xa')](_0x76b9('0xb'),_0x3722a5,_0x248e2d[_0x76b9('0xc')]);if(_0x248e2d[_0x76b9('0xc')]){var _0x58f171=_[_0x76b9('0xd')](_0x81e59e[_0x76b9('0xe')](),{'p':_0x248e2d['priority']});if(_0x58f171>=0x0){logger[_0x76b9('0xa')](_0x76b9('0xf'),_0x3722a5,_0x248e2d[_0x76b9('0xc')]||'next',_0x58f171);_0x81e59e[_0x76b9('0x10')](_0x58f171);}else{logger[_0x76b9('0xa')](_0x76b9('0x11'),_0x3722a5,_0x248e2d['priority']||_0x76b9('0x10'));_0x81e59e['stop']();}}else{_0x81e59e['next']();}}}catch(_0x12b367){logger[_0x76b9('0x7')]('[%s][GOTOP]\x20%s',_0x3722a5,JSON[_0x76b9('0x12')](_0x12b367));_0x81e59e[_0x76b9('0x13')]();}};}; \ No newline at end of file +var _0x8e36=['findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x8e36,0x11d));var _0x68e3=function(_0x27732a,_0x374055){_0x27732a=_0x27732a-0x0;var _0x1ec0a2=_0x8e36[_0x27732a];return _0x1ec0a2;};'use strict';var schema=require('validate');var _=require(_0x68e3('0x0'));var logger=require(_0x68e3('0x1'))(_0x68e3('0x2'));var gotop=schema({'priority':{'type':_0x68e3('0x3'),'required':!![],'message':_0x68e3('0x4')}});exports['consequence']=function(_0x2ecd99,_0x3cd1f2){return function(_0xf6a8bf){try{var _0xe56f96={'priority':_0x3cd1f2[0x0]};var _0x81f798=gotop[_0x68e3('0x5')](_0xe56f96,{'typecast':!![]});if(_0x81f798[_0x68e3('0x6')]){logger[_0x68e3('0x7')]('[%s][GOTOP]\x20%s',_0x2ecd99,_[_0x68e3('0x8')](_0x81f798,_0x68e3('0x9'))[_0x68e3('0xa')](',\x20'));_0xf6a8bf[_0x68e3('0xb')]();}else{logger[_0x68e3('0xc')](_0x68e3('0xd'),_0x2ecd99,_0xe56f96['priority']);if(_0xe56f96[_0x68e3('0xe')]){var _0x1d3d4b=_[_0x68e3('0xf')](_0xf6a8bf[_0x68e3('0x10')](),{'p':_0xe56f96[_0x68e3('0xe')]});if(_0x1d3d4b>=0x0){logger[_0x68e3('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2ecd99,_0xe56f96[_0x68e3('0xe')]||_0x68e3('0x11'),_0x1d3d4b);_0xf6a8bf[_0x68e3('0x11')](_0x1d3d4b);}else{logger['info'](_0x68e3('0x12'),_0x2ecd99,_0xe56f96['priority']||_0x68e3('0x11'));_0xf6a8bf[_0x68e3('0xb')]();}}else{_0xf6a8bf[_0x68e3('0x11')]();}}}catch(_0x433547){logger[_0x68e3('0x7')](_0x68e3('0x13'),_0x2ecd99,JSON['stringify'](_0x433547));_0xf6a8bf[_0x68e3('0xb')]();}};}; \ 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 eb956b4..8127d4d 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 _0xdd99=['account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xdd99,0x146));var _0x9dd9=function(_0xaff947,_0x4bfa49){_0xaff947=_0xaff947-0x0;var _0xb987c5=_0xdd99[_0xaff947];return _0xb987c5;};'use strict';var _=require(_0x9dd9('0x0'));var utils=require(_0x9dd9('0x1'));var logger=require(_0x9dd9('0x2'))('routing');var rpc={'chatMessage':require(_0x9dd9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9dd9('0x4')),'smsMessage':require(_0x9dd9('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9dd9('0x6'))};exports[_0x9dd9('0x7')]=function(_0x366b29,_0x29aad1){return function(_0x3a0a00){try{var _0x59c174={'body':utils['getMustacheRender'](_0x29aad1[0x0],this),'ContactId':this[_0x9dd9('0x8')]['id']};if(this[_0x9dd9('0x9')]===_0x9dd9('0xa')){_0x59c174[_0x9dd9('0xb')]=this[_0x9dd9('0xc')]['id'];}else{_0x59c174[_[_0x9dd9('0xd')](this[_0x9dd9('0x9')])+_0x9dd9('0xe')]=this[_0x9dd9('0xc')]['id'];}_0x59c174[_[_0x9dd9('0xd')](this[_0x9dd9('0x9')])+_0x9dd9('0xf')]=this[_0x9dd9('0x10')]['id'];if(rpc[this[_0x9dd9('0x9')]+_0x9dd9('0x11')]){return rpc[this['channel']+_0x9dd9('0x11')][_0x9dd9('0x12')](_0x59c174)[_0x9dd9('0x13')](function(_0xedb0f){logger[_0x9dd9('0x14')]('[%s][MESSAGE]\x20%s',_0x366b29,_0x59c174['body']);_0x3a0a00[_0x9dd9('0x15')]();})[_0x9dd9('0x16')](function(_0x496547){logger[_0x9dd9('0x17')](_0x9dd9('0x18'),_0x366b29,JSON[_0x9dd9('0x19')](_0x496547));_0x3a0a00['stop']();});}}catch(_0xab812f){logger[_0x9dd9('0x17')](_0x9dd9('0x18'),_0x366b29,JSON[_0x9dd9('0x19')](_0xab812f));_0x3a0a00['stop']();}};}; \ No newline at end of file +var _0x4a12=['stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify'];(function(_0x397014,_0x17cc12){var _0x1163f7=function(_0x290ac1){while(--_0x290ac1){_0x397014['push'](_0x397014['shift']());}};_0x1163f7(++_0x17cc12);}(_0x4a12,0x97));var _0x24a1=function(_0xb19941,_0x589a72){_0xb19941=_0xb19941-0x0;var _0x20b096=_0x4a12[_0xb19941];return _0x20b096;};'use strict';var _=require(_0x24a1('0x0'));var utils=require(_0x24a1('0x1'));var logger=require(_0x24a1('0x2'))('routing');var rpc={'chatMessage':require(_0x24a1('0x3')),'openchannelMessage':require(_0x24a1('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x24a1('0x5')),'faxMessage':require(_0x24a1('0x6')),'whatsappMessage':require(_0x24a1('0x7'))};exports[_0x24a1('0x8')]=function(_0xe1c6c9,_0x22d475){return function(_0x34c025){try{var _0x56ce98={'body':utils[_0x24a1('0x9')](_0x22d475[0x0],this),'ContactId':this[_0x24a1('0xa')]['id']};if(this[_0x24a1('0xb')]===_0x24a1('0xc')){_0x56ce98['ChatWebsiteId']=this['account']['id'];}else{_0x56ce98[_['upperFirst'](this[_0x24a1('0xb')])+'AccountId']=this['account']['id'];}_0x56ce98[_['upperFirst'](this[_0x24a1('0xb')])+_0x24a1('0xd')]=this[_0x24a1('0xe')]['id'];if(rpc[this['channel']+_0x24a1('0xf')]){return rpc[this[_0x24a1('0xb')]+'Message'][_0x24a1('0x10')](_0x56ce98)[_0x24a1('0x11')](function(_0x448d2f){logger[_0x24a1('0x12')](_0x24a1('0x13'),_0xe1c6c9,_0x56ce98[_0x24a1('0x14')]);_0x34c025[_0x24a1('0x15')]();})[_0x24a1('0x16')](function(_0x5b66a7){logger['error'](_0x24a1('0x13'),_0xe1c6c9,JSON[_0x24a1('0x17')](_0x5b66a7));_0x34c025[_0x24a1('0x18')]();});}}catch(_0x12ed0c){logger['error'](_0x24a1('0x13'),_0xe1c6c9,JSON[_0x24a1('0x17')](_0x12ed0c));_0x34c025[_0x24a1('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 8e4f38c..df214c1 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 _0x3b84=['stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x28e7fd,_0x5c775f){var _0x3823df=function(_0x3fe51f){while(--_0x3fe51f){_0x28e7fd['push'](_0x28e7fd['shift']());}};_0x3823df(++_0x5c775f);}(_0x3b84,0x173));var _0x43b8=function(_0x84a694,_0x31c394){_0x84a694=_0x84a694-0x0;var _0xd7a19b=_0x3b84[_0x84a694];return _0xd7a19b;};'use strict';var utils=require('./utils');var logger=require(_0x43b8('0x0'))(_0x43b8('0x1'));exports[_0x43b8('0x2')]=function(_0x5e8fcf,_0x3c0831){return function(_0x5dd99c){try{logger[_0x43b8('0x3')](_0x43b8('0x4'),_0x5e8fcf,utils[_0x43b8('0x5')](_0x3c0831[0x0],this));_0x5dd99c[_0x43b8('0x6')]();}catch(_0x5a3ee1){logger['error'](_0x43b8('0x4'),_0x5e8fcf,JSON[_0x43b8('0x7')](_0x5a3ee1));_0x5dd99c[_0x43b8('0x8')]();}};}; \ No newline at end of file +var _0x389d=['./utils','info','[%s][NOOP]\x20%s','error'];(function(_0x7e86bf,_0x478669){var _0x533007=function(_0x364918){while(--_0x364918){_0x7e86bf['push'](_0x7e86bf['shift']());}};_0x533007(++_0x478669);}(_0x389d,0x168));var _0xd389=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x389d[_0x2300f2];return _0x6bd508;};'use strict';var utils=require(_0xd389('0x0'));var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x8f12cd,_0x449fc4){return function(_0x10adbe){try{logger[_0xd389('0x1')](_0xd389('0x2'),_0x8f12cd,utils['getMustacheRender'](_0x449fc4[0x0],this));_0x10adbe['next']();}catch(_0x56721d){logger[_0xd389('0x3')](_0xd389('0x2'),_0x8f12cd,JSON['stringify'](_0x56721d));_0x10adbe['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f5cf7c3..ee5eb83 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 _0x95a9=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','[%s][QUEUE]\x20%s','map','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','localhost','queue_id','queue','from','joinAt','emit','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId'];(function(_0x524e35,_0x45a80d){var _0x580881=function(_0x240a3e){while(--_0x240a3e){_0x524e35['push'](_0x524e35['shift']());}};_0x580881(++_0x45a80d);}(_0x95a9,0x10b));var _0x995a=function(_0x3d86a5,_0x33d871){_0x3d86a5=_0x3d86a5-0x0;var _0x232702=_0x95a9[_0x3d86a5];return _0x232702;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x995a('0x0'));var seqqueue=require(_0x995a('0x1'));var moment=require(_0x995a('0x2'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x995a('0x3'))(_0x995a('0x4'));var strategy=require(_0x995a('0x5'));config[_0x995a('0x6')]=_['defaults'](config['redis'],{'host':_0x995a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x995a('0x6')]));var attributes=['id',_0x995a('0x8'),'account',_0x995a('0x9'),_0x995a('0xa'),_0x995a('0xb')];function emit(_0x5ef9bc,_0x3067bc,_0x472e03){io['to'](_0x5ef9bc)[_0x995a('0xc')](_0x3067bc,_0x472e03);}function emitChannelQueueInteraction(_0x2d694d,_0x397011,_0x33865a,_0x252955,_0xe84d6e,_0x20a5cd,_0x2307fe,_0x3cb351){var _0x2f4f6a=_['clone'](_0x33865a);_0x2f4f6a[_0x995a('0x8')]=_0x3cb351;_0x2f4f6a[_0x995a('0x9')]=_0x397011;_0x2f4f6a[_0x995a('0xd')]=_0x252955;_0x2f4f6a['id']=_0xe84d6e;if(_0x20a5cd){_0x2307fe[util['format'](_0x995a('0xe'),_0x2d694d)][_0xe84d6e]=_[_0x995a('0xf')](_0x2f4f6a,attributes);}else{delete _0x2307fe[util[_0x995a('0x10')](_0x995a('0xe'),_0x2d694d)][_0xe84d6e];}emit(util[_0x995a('0x10')](_0x995a('0x11'),_0x2d694d,_0x397011),util[_0x995a('0x10')](_0x995a('0x12'),_0x2d694d,_0x20a5cd?'save':_0x995a('0x13')),_[_0x995a('0xf')](_0x2f4f6a,attributes));}var rpc={'openchannelQueueReport':require(_0x995a('0x14')),'mailQueueReport':require(_0x995a('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x995a('0x16')),'faxQueueReport':require(_0x995a('0x17')),'whatsappQueueReport':require(_0x995a('0x18'))};var queue=schema({'name':{'type':_0x995a('0x19'),'required':!![],'message':_0x995a('0x1a')},'timeout':{'type':_0x995a('0x1b'),'message':_0x995a('0x1c')}});function startRouting(_0x422e42,_0x5607f8,_0x2f5693,_0x646e42){if(_0x422e42&&_0x5607f8&&_0x2f5693){_0x5607f8[_0x995a('0x1d')]+=0x1;var _0x59d750={'uniqueid':_0x422e42,'from':_0x2f5693[_0x995a('0x1e')]?_0x2f5693[_0x995a('0x1e')][_0x995a('0xa')]:'','joinAt':moment()[_0x995a('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f5693[_0x995a('0x1f')]?_0x2f5693[_0x995a('0x1f')]['id']:null,'ListId':_0x2f5693[_0x995a('0x20')]?_0x2f5693[_0x995a('0x20')]['id']:null};_0x59d750[_[_0x995a('0x21')](_0x2f5693[_0x995a('0x22')])+_0x995a('0x23')]=_0x5607f8['id']||null;_0x59d750[_[_0x995a('0x21')](_0x2f5693[_0x995a('0x22')])+'InteractionId']=_0x2f5693[_0x995a('0x24')]?_0x2f5693[_0x995a('0x24')]['id']:null;_0x59d750[_[_0x995a('0x21')](_0x2f5693[_0x995a('0x22')])+_0x995a('0x25')]=_0x2f5693[_0x995a('0x26')]?_0x2f5693[_0x995a('0x26')]['id']:null;_0x59d750[_[_0x995a('0x21')](_0x2f5693['channel'])+(_0x2f5693['channel']!=='chat'?_0x995a('0x27'):_0x995a('0x28'))]=_0x2f5693[_0x995a('0xd')]?_0x2f5693[_0x995a('0xd')]['id']:null;logger[_0x995a('0x29')](util[_0x995a('0x10')](_0x995a('0x2a'),_0x422e42,_0x5607f8[_0x995a('0x2b')]));emitChannelQueueInteraction(_0x2f5693['channel'],_0x5607f8[_0x995a('0x2b')],_0x59d750,_0x2f5693[_0x995a('0xd')]['name'],_0x2f5693['message']['id'],!![],_0x646e42,_0x5607f8['id']);if(rpc[_0x2f5693[_0x995a('0x22')]+_0x995a('0x2c')]){return rpc[_0x2f5693[_0x995a('0x22')]+_0x995a('0x2c')][_0x995a('0x2d')](_0x59d750)[_0x995a('0x2e')](function(_0x412a0f){logger[_0x995a('0x2f')](_0x995a('0x30'));});}}}function stopRouting(_0x2cb34f,_0x4a28e7,_0x57fb43,_0xd1fb7f){if(_0x2cb34f&&_0x4a28e7){_0x4a28e7[_0x995a('0x1d')]-=0x1;var _0x352366={'leaveAt':moment()[_0x995a('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x995a('0x31')),'reason':_0x995a('0x32')};logger[_0x995a('0x29')](util['format'](_0x995a('0x33'),_0x2cb34f,_0x4a28e7[_0x995a('0x2b')]));emitChannelQueueInteraction(_0x57fb43[_0x995a('0x22')],_0x4a28e7[_0x995a('0x2b')],_0x57fb43['body'],_0x57fb43[_0x995a('0xd')][_0x995a('0x2b')],_0x57fb43[_0x995a('0x26')]['id'],![],_0xd1fb7f,_0x4a28e7['id']);if(rpc[_0x57fb43['channel']+_0x995a('0x2c')]){return rpc[_0x57fb43['channel']+_0x995a('0x2c')][_0x995a('0x34')](_0x2cb34f,_0x352366)[_0x995a('0x2e')](function(_0xbea077){logger[_0x995a('0x2f')](_0x995a('0x35'));});}}}function endRouting(_0x50e569,_0x47d8f1,_0x2e205a,_0x5c7b7a){if(_0x50e569&&_0x47d8f1){_0x47d8f1['waiting']-=0x1;var _0xa1bef7={'leaveAt':moment()['format'](_0x995a('0x31')),'exitAt':moment()[_0x995a('0x10')](_0x995a('0x31')),'reason':_0x995a('0x36')};logger['info'](util[_0x995a('0x10')](_0x995a('0x37'),_0x50e569,_0x47d8f1[_0x995a('0x2b')]));emitChannelQueueInteraction(_0x2e205a[_0x995a('0x22')],_0x47d8f1[_0x995a('0x2b')],_0x2e205a[_0x995a('0x1e')],_0x2e205a[_0x995a('0xd')]['name'],_0x2e205a['message']['id'],![],_0x5c7b7a);if(rpc[_0x2e205a[_0x995a('0x22')]+_0x995a('0x2c')]){return rpc[_0x2e205a[_0x995a('0x22')]+_0x995a('0x2c')][_0x995a('0x34')](_0x50e569,_0xa1bef7)[_0x995a('0x2e')](function(_0x595bef){logger[_0x995a('0x2f')](_0x995a('0x35'));});}}}function handleFindQueue(_0x2fd774){return function(_0x45b812){return _0x45b812[_0x995a('0x2b')][_0x995a('0x38')]()===_0x2fd774[_0x995a('0x38')]();};}exports['consequence']=function(_0x132a7b,_0x262a08,_0x14ace2,_0x51bd49){return function(_0x2a7472){try{var _0x49ce82={'name':_0x262a08[0x0],'timeout':_0x262a08[0x1]};var _0x14a276=queue[_0x995a('0x39')](_0x49ce82,{'typecast':!![]});if(_0x14a276['length']){logger[_0x995a('0x2f')](_0x995a('0x3a'),_0x132a7b,_[_0x995a('0x3b')](_0x14a276,'message')['join'](',\x20'));_0x2a7472[_0x995a('0x3c')]();}else{var _0x3b000a=_[_0x995a('0x3d')](_0x14ace2[_0x51bd49['channel']+'Queues'],handleFindQueue(_0x49ce82['name']));if(_0x3b000a){startRouting(_0x132a7b,_0x3b000a,_0x51bd49,_0x14ace2);var _0x23be71=(_0x3b000a[_0x995a('0x36')]||0xa)*0x3e8;var _0x4e8988=(_0x49ce82[_0x995a('0x36')]||0x14)*0x3e8;var _0x27830a,_0x280dc2;if(_0x23be71>_0x4e8988){_0x4e8988=_0x23be71;}var _0x4e284f=seqqueue[_0x995a('0x3e')](_0x23be71);_0x4e284f['id']=_0x132a7b;_0x4e284f[_0x995a('0x3f')]=_0x23be71;_0x4e284f[_0x995a('0x40')]=_0x4e8988;_0x4e284f[_0x995a('0x22')]=_0x51bd49[_0x995a('0x22')];_0x14ace2[_0x995a('0x41')][_0x132a7b]['on'](_0x995a('0x42'),function(){logger[_0x995a('0x29')](_0x995a('0x43'),_0x132a7b);stopRouting(_0x132a7b,_0x3b000a,_0x51bd49,_0x14ace2);clearTimeout(_0x27830a);_0x27830a=undefined;_0x4e284f[_0x995a('0x44')](!![]);if(_0x14ace2[_0x995a('0x41')][_0x132a7b]){delete _0x14ace2[_0x995a('0x41')][_0x132a7b];}_0x2a7472[_0x995a('0x3c')]();});_0x14ace2[_0x995a('0x41')][_0x132a7b]['on']('complete',function(){if(_0x14ace2['rules'][_0x132a7b]){delete _0x14ace2[_0x995a('0x41')][_0x132a7b];}});_0x27830a=setTimeout(function(){logger[_0x995a('0x29')](_0x995a('0x45'),_0x132a7b);endRouting(_0x132a7b,_0x3b000a,_0x51bd49,_0x14ace2);clearTimeout(_0x27830a);_0x4e284f[_0x995a('0x44')](!![]);_0x2a7472[_0x995a('0x46')]();},_0x4e8988);switch(_0x3b000a[_0x995a('0x47')]){case'rrmemory':strategy[_0x995a('0x48')](_0x4e284f,_0x3b000a,_0x14ace2,_0x51bd49);break;default:strategy[_0x995a('0x49')](_0x4e284f,_0x3b000a,_0x14ace2,_0x51bd49);}}else{logger[_0x995a('0x2f')](_0x995a('0x4a'),_0x132a7b,_0x49ce82[_0x995a('0x2b')]);_0x2a7472['stop']();}}}catch(_0x4b9b46){console[_0x995a('0x4b')](_0x4b9b46);logger[_0x995a('0x2f')](_0x995a('0x3a'),_0x132a7b,_0x4b9b46[_0x995a('0x4c')]);_0x2a7472[_0x995a('0x3c')]();}};}; \ No newline at end of file +var _0xc985=['../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport'];(function(_0x141443,_0x419b99){var _0x54a83f=function(_0x1ff4aa){while(--_0x1ff4aa){_0x141443['push'](_0x141443['shift']());}};_0x54a83f(++_0x419b99);}(_0xc985,0x85));var _0x5c98=function(_0x2636c8,_0x2f2fba){_0x2636c8=_0x2636c8-0x0;var _0x5dd0b9=_0xc985[_0x2636c8];return _0x5dd0b9;};'use strict';var schema=require(_0x5c98('0x0'));var _=require(_0x5c98('0x1'));var util=require(_0x5c98('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x5c98('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5c98('0x4'))(_0x5c98('0x5'));var strategy=require(_0x5c98('0x6'));config[_0x5c98('0x7')]=_[_0x5c98('0x8')](config[_0x5c98('0x7')],{'host':_0x5c98('0x9'),'port':0x18eb});var io=require(_0x5c98('0xa'))(new Redis(config['redis']));var attributes=['id',_0x5c98('0xb'),_0x5c98('0xc'),_0x5c98('0xd'),'from',_0x5c98('0xe')];function emit(_0x215cc5,_0x4613d9,_0x4e3f94){io['to'](_0x215cc5)[_0x5c98('0xf')](_0x4613d9,_0x4e3f94);}function emitChannelQueueInteraction(_0x1f8330,_0xa48665,_0x435727,_0x19affb,_0x3d1b1a,_0x35f108,_0x50788c,_0x593adc){var _0x3208c4=_[_0x5c98('0x10')](_0x435727);_0x3208c4[_0x5c98('0xb')]=_0x593adc;_0x3208c4[_0x5c98('0xd')]=_0xa48665;_0x3208c4[_0x5c98('0xc')]=_0x19affb;_0x3208c4['id']=_0x3d1b1a;if(_0x35f108){_0x50788c[util[_0x5c98('0x11')](_0x5c98('0x12'),_0x1f8330)][_0x3d1b1a]=_[_0x5c98('0x13')](_0x3208c4,attributes);}else{delete _0x50788c[util['format']('%sQueuesWaitingInteractions',_0x1f8330)][_0x3d1b1a];}emit(util[_0x5c98('0x11')]('%s:queue:%s',_0x1f8330,_0xa48665),util[_0x5c98('0x11')](_0x5c98('0x14'),_0x1f8330,_0x35f108?_0x5c98('0x15'):'remove'),_['pick'](_0x3208c4,attributes));}var rpc={'openchannelQueueReport':require(_0x5c98('0x16')),'mailQueueReport':require(_0x5c98('0x17')),'chatQueueReport':require(_0x5c98('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x5c98('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x5c98('0x1a'),'required':!![],'message':_0x5c98('0x1b')},'timeout':{'type':_0x5c98('0x1c'),'message':_0x5c98('0x1d')}});function startRouting(_0x3c5816,_0xc36fa,_0x4b69aa,_0x8b1a38){if(_0x3c5816&&_0xc36fa&&_0x4b69aa){_0xc36fa['waiting']+=0x1;var _0x3f5641={'uniqueid':_0x3c5816,'from':_0x4b69aa[_0x5c98('0x1e')]?_0x4b69aa[_0x5c98('0x1e')][_0x5c98('0x1f')]:'','joinAt':moment()[_0x5c98('0x11')](_0x5c98('0x20')),'ContactId':_0x4b69aa[_0x5c98('0x21')]?_0x4b69aa[_0x5c98('0x21')]['id']:null,'ListId':_0x4b69aa[_0x5c98('0x22')]?_0x4b69aa[_0x5c98('0x22')]['id']:null};_0x3f5641[_[_0x5c98('0x23')](_0x4b69aa[_0x5c98('0x24')])+_0x5c98('0x25')]=_0xc36fa['id']||null;_0x3f5641[_[_0x5c98('0x23')](_0x4b69aa[_0x5c98('0x24')])+_0x5c98('0x26')]=_0x4b69aa[_0x5c98('0x27')]?_0x4b69aa['interaction']['id']:null;_0x3f5641[_['upperFirst'](_0x4b69aa[_0x5c98('0x24')])+_0x5c98('0x28')]=_0x4b69aa[_0x5c98('0x29')]?_0x4b69aa[_0x5c98('0x29')]['id']:null;_0x3f5641[_[_0x5c98('0x23')](_0x4b69aa[_0x5c98('0x24')])+(_0x4b69aa[_0x5c98('0x24')]!==_0x5c98('0x2a')?'AccountId':_0x5c98('0x2b'))]=_0x4b69aa[_0x5c98('0xc')]?_0x4b69aa[_0x5c98('0xc')]['id']:null;logger[_0x5c98('0x2c')](util[_0x5c98('0x11')](_0x5c98('0x2d'),_0x3c5816,_0xc36fa[_0x5c98('0x2e')]));emitChannelQueueInteraction(_0x4b69aa[_0x5c98('0x24')],_0xc36fa[_0x5c98('0x2e')],_0x3f5641,_0x4b69aa['account'][_0x5c98('0x2e')],_0x4b69aa['message']['id'],!![],_0x8b1a38,_0xc36fa['id']);if(rpc[_0x4b69aa['channel']+_0x5c98('0x2f')]){return rpc[_0x4b69aa['channel']+'QueueReport'][_0x5c98('0x30')](_0x3f5641)[_0x5c98('0x31')](function(_0x1f2b98){logger[_0x5c98('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x98b7,_0x5258bb,_0x425d25,_0x414315){if(_0x98b7&&_0x5258bb){_0x5258bb['waiting']-=0x1;var _0x6ae2cd={'leaveAt':moment()['format'](_0x5c98('0x20')),'acceptAt':moment()[_0x5c98('0x11')](_0x5c98('0x20')),'reason':_0x5c98('0x33')};logger['info'](util[_0x5c98('0x11')](_0x5c98('0x34'),_0x98b7,_0x5258bb[_0x5c98('0x2e')]));emitChannelQueueInteraction(_0x425d25['channel'],_0x5258bb[_0x5c98('0x2e')],_0x425d25['body'],_0x425d25[_0x5c98('0xc')]['name'],_0x425d25[_0x5c98('0x29')]['id'],![],_0x414315,_0x5258bb['id']);if(rpc[_0x425d25[_0x5c98('0x24')]+_0x5c98('0x2f')]){return rpc[_0x425d25[_0x5c98('0x24')]+'QueueReport'][_0x5c98('0x35')](_0x98b7,_0x6ae2cd)['catch'](function(_0x11158b){logger[_0x5c98('0x32')](_0x5c98('0x36'));});}}}function endRouting(_0x577046,_0x2c795a,_0x2d782b,_0x22c93e){if(_0x577046&&_0x2c795a){_0x2c795a['waiting']-=0x1;var _0x572f4c={'leaveAt':moment()[_0x5c98('0x11')](_0x5c98('0x20')),'exitAt':moment()[_0x5c98('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5c98('0x37')};logger[_0x5c98('0x2c')](util[_0x5c98('0x11')](_0x5c98('0x38'),_0x577046,_0x2c795a['name']));emitChannelQueueInteraction(_0x2d782b[_0x5c98('0x24')],_0x2c795a[_0x5c98('0x2e')],_0x2d782b['body'],_0x2d782b['account'][_0x5c98('0x2e')],_0x2d782b[_0x5c98('0x29')]['id'],![],_0x22c93e);if(rpc[_0x2d782b['channel']+'QueueReport']){return rpc[_0x2d782b[_0x5c98('0x24')]+'QueueReport'][_0x5c98('0x35')](_0x577046,_0x572f4c)['catch'](function(_0x2735e3){logger[_0x5c98('0x32')](_0x5c98('0x36'));});}}}function handleFindQueue(_0x257c77){return function(_0x325be1){return _0x325be1['name'][_0x5c98('0x39')]()===_0x257c77[_0x5c98('0x39')]();};}exports[_0x5c98('0x3a')]=function(_0x26e068,_0x194951,_0x1508c2,_0x27c54c){return function(_0x43a1da){try{var _0x3970ec={'name':_0x194951[0x0],'timeout':_0x194951[0x1]};var _0x90ef47=queue[_0x5c98('0x0')](_0x3970ec,{'typecast':!![]});if(_0x90ef47[_0x5c98('0x3b')]){logger[_0x5c98('0x32')](_0x5c98('0x3c'),_0x26e068,_[_0x5c98('0x3d')](_0x90ef47,_0x5c98('0x29'))[_0x5c98('0x3e')](',\x20'));_0x43a1da['stop']();}else{var _0x46a935=_[_0x5c98('0x3f')](_0x1508c2[_0x27c54c[_0x5c98('0x24')]+_0x5c98('0x40')],handleFindQueue(_0x3970ec[_0x5c98('0x2e')]));if(_0x46a935){startRouting(_0x26e068,_0x46a935,_0x27c54c,_0x1508c2);var _0x14616a=(_0x46a935['timeout']||0xa)*0x3e8;var _0x4ad8c9=(_0x3970ec[_0x5c98('0x37')]||0x14)*0x3e8;var _0x3aa981,_0x1f9e99;if(_0x14616a>_0x4ad8c9){_0x4ad8c9=_0x14616a;}var _0xcc8998=seqqueue[_0x5c98('0x41')](_0x14616a);_0xcc8998['id']=_0x26e068;_0xcc8998['atimeout']=_0x14616a;_0xcc8998['qtimeout']=_0x4ad8c9;_0xcc8998[_0x5c98('0x24')]=_0x27c54c[_0x5c98('0x24')];_0x1508c2[_0x5c98('0x42')][_0x26e068]['on'](_0x5c98('0x43'),function(){logger[_0x5c98('0x2c')](_0x5c98('0x44'),_0x26e068);stopRouting(_0x26e068,_0x46a935,_0x27c54c,_0x1508c2);clearTimeout(_0x3aa981);_0x3aa981=undefined;_0xcc8998[_0x5c98('0x45')](!![]);if(_0x1508c2['rules'][_0x26e068]){delete _0x1508c2['rules'][_0x26e068];}_0x43a1da[_0x5c98('0x46')]();});_0x1508c2['rules'][_0x26e068]['on'](_0x5c98('0x47'),function(){if(_0x1508c2[_0x5c98('0x42')][_0x26e068]){delete _0x1508c2[_0x5c98('0x42')][_0x26e068];}});_0x3aa981=setTimeout(function(){logger['info'](_0x5c98('0x48'),_0x26e068);endRouting(_0x26e068,_0x46a935,_0x27c54c,_0x1508c2);clearTimeout(_0x3aa981);_0xcc8998[_0x5c98('0x45')](!![]);_0x43a1da[_0x5c98('0x49')]();},_0x4ad8c9);switch(_0x46a935['strategy']){case _0x5c98('0x4a'):strategy[_0x5c98('0x4a')](_0xcc8998,_0x46a935,_0x1508c2,_0x27c54c);break;default:strategy[_0x5c98('0x4b')](_0xcc8998,_0x46a935,_0x1508c2,_0x27c54c);}}else{logger[_0x5c98('0x32')](_0x5c98('0x4c'),_0x26e068,_0x3970ec[_0x5c98('0x2e')]);_0x43a1da[_0x5c98('0x46')]();}}}catch(_0x4ad7fc){console['log'](_0x4ad7fc);logger['error'](_0x5c98('0x3c'),_0x26e068,_0x4ad7fc[_0x5c98('0x4d')]);_0x43a1da['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 27daf54..0c51208 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 _0x8625=['isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0xd5a2ff,_0x357eea){var _0x42b333=function(_0x381889){while(--_0x381889){_0xd5a2ff['push'](_0xd5a2ff['shift']());}};_0x42b333(++_0x357eea);}(_0x8625,0x164));var _0x5862=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x8625[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x5862('0x0'));var uuid=require(_0x5862('0x1'));var util=require(_0x5862('0x2'));var logger=require('../../../../../config/logger')(_0x5862('0x3'));var Agent=function(_0x10f94b,_0x4505b4,_0x55ec53,_0x4e2437){this[_0x5862('0x4')]=uuid['v4']();this['squeue']=_0x10f94b;this[_0x5862('0x5')]=_0x4505b4;this[_0x5862('0x6')]=_0x55ec53;this[_0x5862('0x3')]=_0x4e2437;this[_0x5862('0x7')][_0x5862('0x8')](this[_0x5862('0x9')]['bind'](this),this[_0x5862('0xa')]['bind'](this));this[_0x5862('0x7')]['on']('timeout',this[_0x5862('0xa')][_0x5862('0xb')](this));this[_0x5862('0x7')]['on'](_0x5862('0xc'),this[_0x5862('0xd')][_0x5862('0xb')](this));};Agent['prototype'][_0x5862('0x8')]=function(){this['squeue'][_0x5862('0x8')](this[_0x5862('0x9')][_0x5862('0xb')](this),this[_0x5862('0xa')][_0x5862('0xb')](this));};Agent[_0x5862('0xe')][_0x5862('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x5862('0xe')][_0x5862('0x9')]=function(){logger['debug'](_0x5862('0xf'),this[_0x5862('0x7')]['id'],this['agent']['id']);if(_[_0x5862('0x10')](this['realtime'][_0x5862('0x11')][this[_0x5862('0x5')]['id']])){logger[_0x5862('0x12')](_0x5862('0x13'),this['squeue']['id'],this[_0x5862('0x5')]['id']);setTimeout(this[_0x5862('0x8')][_0x5862('0xb')](this),0x3e8);}else{if(this[_0x5862('0x3')][_0x5862('0x14')]||util[_0x5862('0x15')](this[_0x5862('0x7')]['id'],this[_0x5862('0x6')][_0x5862('0x11')][this['agent']['id']],this[_0x5862('0x7')][_0x5862('0x16')],![])){this[_0x5862('0x6')][_0x5862('0x11')][this[_0x5862('0x5')]['id']][_0x5862('0x17')]=!![];this[_0x5862('0x6')]['agents'][this[_0x5862('0x5')]['id']][_0x5862('0x18')]=undefined;util[_0x5862('0x19')](this[_0x5862('0x4')],this[_0x5862('0x7')]['id'],this[_0x5862('0x6')][_0x5862('0x11')][this[_0x5862('0x5')]['id']],null,this[_0x5862('0x3')]);util[_0x5862('0x1a')](this[_0x5862('0x7')]['id'],this[_0x5862('0x6')][_0x5862('0x11')][this['agent']['id']],'RINGING'+(this[_0x5862('0x3')][_0x5862('0x14')]?_0x5862('0x1b'):''));}else{logger['debug'](_0x5862('0x1c'),this[_0x5862('0x7')]['id'],this[_0x5862('0x5')]['id']);setTimeout(this[_0x5862('0x8')][_0x5862('0xb')](this),0x3e8);}}};Agent[_0x5862('0xe')][_0x5862('0xa')]=function(_0x22699f){if(_[_0x5862('0x10')](this[_0x5862('0x6')][_0x5862('0x11')][this[_0x5862('0x5')]['id']])){return logger[_0x5862('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x5862('0x5')]['id']);}else{logger['debug'](_0x5862('0x1d'),this['squeue']['id'],this[_0x5862('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0x5862('0x7')]['id'],this[_0x5862('0x6')]['agents'][this[_0x5862('0x5')]['id']],null,this[_0x5862('0x3')]);this[_0x5862('0x6')][_0x5862('0x11')][this[_0x5862('0x5')]['id']][_0x5862('0x17')]=![];this[_0x5862('0x6')]['agents'][this[_0x5862('0x5')]['id']]['busyQueue']=undefined;util[_0x5862('0x1a')](this[_0x5862('0x7')]['id'],this[_0x5862('0x6')][_0x5862('0x11')][this['agent']['id']],_0x22699f?'STOP':'TIMEOUT');}if(!_0x22699f){setTimeout(this['push'][_0x5862('0xb')](this),0x3e8);}};function agent(_0x184851,_0x56bd73,_0x80c28a,_0xf80fee){return new Agent(_0x184851,_0x56bd73,_0x80c28a,_0xf80fee);}module[_0x5862('0x1e')]=agent; \ No newline at end of file +var _0x6e57=['STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','debug','forcedOwnership','isAgentAvailable','busy','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue'];(function(_0x5ab404,_0x2d744b){var _0x3169c1=function(_0x4f56a7){while(--_0x4f56a7){_0x5ab404['push'](_0x5ab404['shift']());}};_0x3169c1(++_0x2d744b);}(_0x6e57,0xc3));var _0x76e5=function(_0x3538b2,_0x245443){_0x3538b2=_0x3538b2-0x0;var _0x85bd2e=_0x6e57[_0x3538b2];return _0x85bd2e;};'use strict';var _=require(_0x76e5('0x0'));var uuid=require(_0x76e5('0x1'));var util=require(_0x76e5('0x2'));var logger=require('../../../../../config/logger')(_0x76e5('0x3'));var Agent=function(_0x327fed,_0x351301,_0x4d26d1,_0xeee9b8){this[_0x76e5('0x4')]=uuid['v4']();this[_0x76e5('0x5')]=_0x327fed;this[_0x76e5('0x6')]=_0x351301;this['realtime']=_0x4d26d1;this['routing']=_0xeee9b8;this[_0x76e5('0x5')][_0x76e5('0x7')](this[_0x76e5('0x8')][_0x76e5('0x9')](this),this[_0x76e5('0xa')][_0x76e5('0x9')](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x76e5('0x9')](this));this[_0x76e5('0x5')]['on'](_0x76e5('0xb'),this[_0x76e5('0xc')][_0x76e5('0x9')](this));};Agent[_0x76e5('0xd')][_0x76e5('0x7')]=function(){this[_0x76e5('0x5')][_0x76e5('0x7')](this[_0x76e5('0x8')][_0x76e5('0x9')](this),this[_0x76e5('0xa')][_0x76e5('0x9')](this));};Agent[_0x76e5('0xd')][_0x76e5('0xc')]=function(){this[_0x76e5('0xa')](!![]);};Agent[_0x76e5('0xd')][_0x76e5('0x8')]=function(){logger['debug'](_0x76e5('0xe'),this[_0x76e5('0x5')]['id'],this[_0x76e5('0x6')]['id']);if(_['isNil'](this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']])){logger[_0x76e5('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x76e5('0x5')]['id'],this[_0x76e5('0x6')]['id']);setTimeout(this[_0x76e5('0x7')][_0x76e5('0x9')](this),0x3e8);}else{if(this[_0x76e5('0x3')][_0x76e5('0x12')]||util[_0x76e5('0x13')](this[_0x76e5('0x5')]['id'],this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']],this[_0x76e5('0x5')]['channel'],![])){this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']][_0x76e5('0x14')]=!![];this[_0x76e5('0xf')][_0x76e5('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x76e5('0x15')](this[_0x76e5('0x4')],this[_0x76e5('0x5')]['id'],this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']],null,this[_0x76e5('0x3')]);util[_0x76e5('0x16')](this[_0x76e5('0x5')]['id'],this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']],'RINGING'+(this[_0x76e5('0x3')]['forcedOwnership']?_0x76e5('0x17'):''));}else{logger[_0x76e5('0x11')](_0x76e5('0x18'),this[_0x76e5('0x5')]['id'],this[_0x76e5('0x6')]['id']);setTimeout(this[_0x76e5('0x7')][_0x76e5('0x9')](this),0x3e8);}}};Agent['prototype'][_0x76e5('0xa')]=function(_0x458af4){if(_[_0x76e5('0x19')](this['realtime'][_0x76e5('0x10')][this['agent']['id']])){return logger['debug'](_0x76e5('0x1a'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x76e5('0x11')](_0x76e5('0x1b'),this[_0x76e5('0x5')]['id'],this[_0x76e5('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x76e5('0x5')]['id'],this[_0x76e5('0xf')]['agents'][this[_0x76e5('0x6')]['id']],null,this[_0x76e5('0x3')]);this[_0x76e5('0xf')]['agents'][this[_0x76e5('0x6')]['id']][_0x76e5('0x14')]=![];this[_0x76e5('0xf')][_0x76e5('0x10')][this[_0x76e5('0x6')]['id']][_0x76e5('0x1c')]=undefined;util[_0x76e5('0x16')](this[_0x76e5('0x5')]['id'],this[_0x76e5('0xf')][_0x76e5('0x10')][this['agent']['id']],_0x458af4?_0x76e5('0x1d'):_0x76e5('0x1e'));}if(!_0x458af4){setTimeout(this[_0x76e5('0x7')][_0x76e5('0x9')](this),0x3e8);}};function agent(_0x1e518c,_0x582ce7,_0x384543,_0xb018cf){return new Agent(_0x1e518c,_0x582ce7,_0x384543,_0xb018cf);}module[_0x76e5('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 f0c7b11..b7abba9 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 _0xe706=['./util','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','length','Agents','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','busyQueue','exports','lodash','uuid'];(function(_0x3169a4,_0x43c984){var _0x52380f=function(_0x32a26a){while(--_0x32a26a){_0x3169a4['push'](_0x3169a4['shift']());}};_0x52380f(++_0x43c984);}(_0xe706,0xa3));var _0x6e70=function(_0xebbc39,_0x427a35){_0xebbc39=_0xebbc39-0x0;var _0x5892df=_0xe706[_0xebbc39];return _0x5892df;};'use strict';var _=require(_0x6e70('0x0'));var uuid=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var logger=require('../../../../../config/logger')(_0x6e70('0x3'));var Beepall=function(_0x315629,_0x2ca810,_0x7dfbc3,_0x142c27){this[_0x6e70('0x4')]=uuid['v4']();this[_0x6e70('0x5')]=_0x315629;this[_0x6e70('0x6')]=_0x2ca810;this[_0x6e70('0x7')]=_0x7dfbc3;this[_0x6e70('0x3')]=_0x142c27;this[_0x6e70('0x5')][_0x6e70('0x8')](this[_0x6e70('0x9')][_0x6e70('0xa')](this),this[_0x6e70('0xb')][_0x6e70('0xa')](this));this[_0x6e70('0x5')]['on'](_0x6e70('0xc'),this[_0x6e70('0xb')][_0x6e70('0xa')](this));this[_0x6e70('0x5')]['on'](_0x6e70('0xd'),this[_0x6e70('0xe')][_0x6e70('0xa')](this));};Beepall['prototype']['push']=function(){this[_0x6e70('0x5')][_0x6e70('0x8')](this[_0x6e70('0x9')][_0x6e70('0xa')](this),this[_0x6e70('0xb')][_0x6e70('0xa')](this));};Beepall[_0x6e70('0xf')][_0x6e70('0xe')]=function(){this['handleTimeout'](!![]);};Beepall['prototype']['handleRun']=function(){var _0x257e81=!![];if(!_['isNil'](this['queue'])&&!_[_0x6e70('0x10')](this[_0x6e70('0x6')]['Agents'])&&this[_0x6e70('0x6')]['Agents'][_0x6e70('0x11')]>0x0){for(var _0x161f23=0x0,_0x4ca554;_0x161f230x0){for(var _0x426cae=0x0,_0x16969d;_0x426cae0x0&&_0x35bda5[_0x461346+_0x8895('0x21')]>=_0x35bda5[_0x461346+'Capacity']){writeLog(_0x3f7d5a,_0x35bda5,_0x461346[_0x8895('0x23')]()+_0x8895('0x24'));return![];}}return!![];};exports[_0x8895('0x25')]=function(_0x5486a6,_0x4aee03,_0x78b57,_0x555e60,_0x3d51b0){return sendNotification(!![],_0x5486a6,_0x4aee03,_0x78b57,_0x555e60,_0x3d51b0);};exports[_0x8895('0x26')]=function(_0x10b48f,_0xf5fb66,_0x153220,_0x5c03ea,_0x4d567a){return sendNotification(![],_0x10b48f,_0xf5fb66,_0x153220,_0x5c03ea,_0x4d567a);};exports[_0x8895('0x27')]=writeLog; \ No newline at end of file +var _0xae24=['defaults','localhost','socket.io-emitter','redis','name','emit','split','account','notificationSound','notificationShake','body','queue','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger'];(function(_0x44e670,_0x30700c){var _0x12cb0d=function(_0x20ffad){while(--_0x20ffad){_0x44e670['push'](_0x44e670['shift']());}};_0x12cb0d(++_0x30700c);}(_0xae24,0x182));var _0x4ae2=function(_0x3d219d,_0x3cfa48){_0x3d219d=_0x3d219d-0x0;var _0x4ff517=_0xae24[_0x3d219d];return _0x4ff517;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var utils=require(_0x4ae2('0x1'));var Redis=require('ioredis');var config=require(_0x4ae2('0x2'));var logger=require(_0x4ae2('0x3'))('routing');config['redis']=_[_0x4ae2('0x4')](config['redis'],{'host':_0x4ae2('0x5'),'port':0x18eb});var io=require(_0x4ae2('0x6'))(new Redis(config[_0x4ae2('0x7')]));function sendNotification(_0x3e6055,_0x428054,_0x307247,_0x4f2e84,_0x5f589a,_0x41cdf1){io['to'](util['format']('user:%s',_0x4f2e84[_0x4ae2('0x8')]))[_0x4ae2('0x9')]('user:save',_0x4f2e84);var _0x3b3acc=_0x41cdf1||{};var _0x449e1a=_0x307247[_0x4ae2('0xa')]('.');var _0xb70265={'uniqueid':_0x428054,'channel':_0x449e1a[0x0],'id':_0x449e1a[0x1],'title':_0x449e1a[0x0]+'\x20interaction','interactionId':_0x449e1a[0x2],'queue':_0x5f589a?_0x5f589a[_0x4ae2('0x8')]:null,'sound':_0x3b3acc[_0x4ae2('0xb')][_0x4ae2('0xc')],'shake':_0x3b3acc['account'][_0x4ae2('0xd')]};try{if(!_0x3b3acc[_0x4ae2('0xe')]){_0x3b3acc[_0x4ae2('0xe')]={};}if(_0x5f589a){_0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')]=_0x5f589a;}else if(_0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')]){delete _0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')];}_0xb70265['msg']=utils['getMustacheRender'](_0x3b3acc['account'][_0x4ae2('0x10')],_0x3b3acc);}catch(_0xf834a1){_0xb70265['msg']=_0x4ae2('0x11');logger[_0x4ae2('0x12')](util[_0x4ae2('0x13')](_0x4ae2('0x14'),_0x428054,_0xf834a1[_0x4ae2('0x15')]));}io['to'](util[_0x4ae2('0x13')](_0x4ae2('0x16'),_0x4f2e84[_0x4ae2('0x8')]))[_0x4ae2('0x9')](util[_0x4ae2('0x13')]('notification:%s',_0x3e6055?'save':_0x4ae2('0x17')),_0xb70265);}function writeLog(_0x2d910c,_0x51e20c,_0x45c1bf){return logger[_0x4ae2('0x18')](util[_0x4ae2('0x13')](_0x4ae2('0x19'),_0x2d910c,_0x51e20c[_0x4ae2('0x8')],_0x45c1bf));}exports['isAgentAvailable']=function(_0x2bf5fe,_0x53c686,_0x522165,_0x2ceec4){if(_0x53c686[_0x4ae2('0x1a')]){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1b'));return![];}if(!_0x53c686[_0x4ae2('0x1c')]){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1d'));return![];}if(_0x53c686[_0x522165+'Pause']){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1e'));return![];}if(_0x2ceec4&&_0x53c686['hasOwnProperty'](_0x522165+_0x4ae2('0x1f'))&&_0x53c686[_0x4ae2('0x20')](_0x522165+_0x4ae2('0x21'))){if(_0x53c686[_0x522165+'Capacity']>0x0&&_0x53c686[_0x522165+_0x4ae2('0x21')]>=_0x53c686[_0x522165+_0x4ae2('0x1f')]){writeLog(_0x2bf5fe,_0x53c686,_0x522165[_0x4ae2('0x22')]()+_0x4ae2('0x23'));return![];}}return!![];};exports[_0x4ae2('0x24')]=function(_0x255772,_0x5b2e65,_0x5962b0,_0x9508d7,_0x3030f8){return sendNotification(!![],_0x255772,_0x5b2e65,_0x5962b0,_0x9508d7,_0x3030f8);};exports[_0x4ae2('0x25')]=function(_0x329588,_0x3a9b96,_0x20ef44,_0x57a377,_0x5ec1fd){return sendNotification(![],_0x329588,_0x3a9b96,_0x20ef44,_0x57a377,_0x5ec1fd);};exports[_0x4ae2('0x26')]=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 78543de..e9a7e12 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 _0xb0de=['error','[%s][SYSTEM]\x20%s','map','message','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','validate','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x3654d3,_0x2447b7){var _0x5ce64b=function(_0x9f6734){while(--_0x9f6734){_0x3654d3['push'](_0x3654d3['shift']());}};_0x5ce64b(++_0x2447b7);}(_0xb0de,0x148));var _0xeb0d=function(_0x1d5921,_0x1fa527){_0x1d5921=_0x1d5921-0x0;var _0x7923f3=_0xb0de[_0x1d5921];return _0x7923f3;};'use strict';var schema=require(_0xeb0d('0x0'));var sh=require('shelljs');var _=require(_0xeb0d('0x1'));var utils=require(_0xeb0d('0x2'));var logger=require(_0xeb0d('0x3'))(_0xeb0d('0x4'));var system=schema({'command':{'type':_0xeb0d('0x5'),'required':!![],'message':_0xeb0d('0x6')}});exports[_0xeb0d('0x7')]=function(_0x293326,_0x482b4d){return function(_0x38a4ab){try{var _0x5f474a={'command':_0x482b4d[0x0]};var _0x3d7ba7=system[_0xeb0d('0x0')](_0x5f474a,{'typecast':!![]});if(_0x3d7ba7['length']){logger[_0xeb0d('0x8')](_0xeb0d('0x9'),_0x293326,_[_0xeb0d('0xa')](_0x3d7ba7,_0xeb0d('0xb'))['join'](',\x20'));logger[_0xeb0d('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x293326);_0x38a4ab['next']();}else{var _0x37d8f7=this;var _0x3e9087=utils[_0xeb0d('0xd')](_0x482b4d[0x0],this);logger[_0xeb0d('0xc')](_0xeb0d('0xe'),_0x293326,_0x3e9087);sh['exec'](_[_0xeb0d('0xf')](_0x3e9087),function(_0x3ed256,_0x130d19){logger[_0xeb0d('0xc')](_0xeb0d('0x10'),_0x293326,_0x3ed256);if(_0x3ed256==0x0){var _0x3553a4=_0x130d19[_0xeb0d('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xeb0d('0x12')](_0x482b4d[0x1])||_[_0xeb0d('0x13')](_0x482b4d[0x1])){logger[_0xeb0d('0xc')](_0xeb0d('0x14'),_0x293326);_0x37d8f7[_0xeb0d('0x15')][_0x482b4d[0x1]]=_0x3553a4;}else{logger[_0xeb0d('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x293326,_0x482b4d[0x1],_0x3553a4);_0x37d8f7[_0xeb0d('0x15')][_0x482b4d[0x1]]=_0x3553a4;}}_0x38a4ab[_0xeb0d('0x16')]();});}}catch(_0xacca52){logger[_0xeb0d('0x8')](_0xeb0d('0x9'),_0x293326,_[_0xeb0d('0x17')](_0xacca52)?JSON['stringify'](_0xacca52):_0xacca52);logger[_0xeb0d('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x293326);_0x38a4ab[_0xeb0d('0x16')]();}};}; \ No newline at end of file +var _0x7da8=['trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0xf4d1fc,_0x578eb2){var _0x316609=function(_0x57748b){while(--_0x57748b){_0xf4d1fc['push'](_0xf4d1fc['shift']());}};_0x316609(++_0x578eb2);}(_0x7da8,0xa6));var _0x87da=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7da8[_0x6c993a];return _0x27f547;};'use strict';var schema=require(_0x87da('0x0'));var sh=require(_0x87da('0x1'));var _=require(_0x87da('0x2'));var utils=require(_0x87da('0x3'));var logger=require(_0x87da('0x4'))(_0x87da('0x5'));var system=schema({'command':{'type':_0x87da('0x6'),'required':!![],'message':_0x87da('0x7')}});exports['consequence']=function(_0x17a843,_0x1bcf23){return function(_0x22b0a3){try{var _0x397d23={'command':_0x1bcf23[0x0]};var _0x51dfe5=system[_0x87da('0x0')](_0x397d23,{'typecast':!![]});if(_0x51dfe5[_0x87da('0x8')]){logger['error'](_0x87da('0x9'),_0x17a843,_[_0x87da('0xa')](_0x51dfe5,'message')[_0x87da('0xb')](',\x20'));logger['info'](_0x87da('0xc'),_0x17a843);_0x22b0a3[_0x87da('0xd')]();}else{var _0xce8c5=this;var _0x17b806=utils[_0x87da('0xe')](_0x1bcf23[0x0],this);logger['info'](_0x87da('0xf'),_0x17a843,_0x17b806);sh['exec'](_[_0x87da('0x10')](_0x17b806),function(_0x2854ed,_0x3d4d61){logger[_0x87da('0x11')](_0x87da('0x12'),_0x17a843,_0x2854ed);if(_0x2854ed==0x0){var _0x1ceb0a=_0x3d4d61[_0x87da('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x87da('0x14')](_0x1bcf23[0x1])||_['isEmpty'](_0x1bcf23[0x1])){logger['info'](_0x87da('0x15'),_0x17a843);_0xce8c5[_0x87da('0x16')][_0x1bcf23[0x1]]=_0x1ceb0a;}else{logger[_0x87da('0x11')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x17a843,_0x1bcf23[0x1],_0x1ceb0a);_0xce8c5[_0x87da('0x16')][_0x1bcf23[0x1]]=_0x1ceb0a;}}_0x22b0a3[_0x87da('0xd')]();});}}catch(_0x6b70ee){logger[_0x87da('0x17')](_0x87da('0x9'),_0x17a843,_[_0x87da('0x18')](_0x6b70ee)?JSON[_0x87da('0x19')](_0x6b70ee):_0x6b70ee);logger[_0x87da('0x11')](_0x87da('0xc'),_0x17a843);_0x22b0a3[_0x87da('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 2f60121..18b4523 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 _0xd145=['catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x438f7b,_0x1d8324){var _0x4383a7=function(_0x339673){while(--_0x339673){_0x438f7b['push'](_0x438f7b['shift']());}};_0x4383a7(++_0x1d8324);}(_0xd145,0xd6));var _0x5d14=function(_0x11f6a1,_0x4b3ec7){_0x11f6a1=_0x11f6a1-0x0;var _0x3df8a2=_0xd145[_0x11f6a1];return _0x3df8a2;};'use strict';var schema=require(_0x5d14('0x0'));var _=require(_0x5d14('0x1'));var rpc={'chatInteraction':require(_0x5d14('0x2')),'openchannelInteraction':require(_0x5d14('0x3')),'smsInteraction':require(_0x5d14('0x4')),'mailInteraction':require(_0x5d14('0x5')),'faxInteraction':require(_0x5d14('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5d14('0x7'))(_0x5d14('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5d14('0x9')}});exports[_0x5d14('0xa')]=function(_0x38a24f,_0x2a401c,_0x37cded,_0x289955){return function(_0x474760){try{var _0x3ada98={'tag':_0x2a401c[0x0]};var _0x3047b5=tag['validate'](_0x3ada98,{'typecast':!![]});if(_0x3047b5[_0x5d14('0xb')]){logger[_0x5d14('0xc')](_0x5d14('0xd'),_0x38a24f,_[_0x5d14('0xe')](_0x3047b5,_0x5d14('0xf'))[_0x5d14('0x10')](',\x20'));logger['info'](_0x5d14('0x11'),_0x38a24f);_0x474760[_0x5d14('0x12')]();}else{var _0x6a4467={'ids':[_0x2a401c[0x0]]};if(rpc[_0x289955[_0x5d14('0x13')]+'Interaction']){rpc[_0x289955[_0x5d14('0x13')]+_0x5d14('0x14')][_0x5d14('0x15')](_0x289955[_0x5d14('0x16')]['id'],_0x6a4467)[_0x5d14('0x17')](function(_0x4588fc){logger[_0x5d14('0x18')](_0x5d14('0x19'),_0x38a24f,_0x2a401c[0x1],_0x289955[_0x5d14('0x13')],_0x289955[_0x5d14('0x16')]['id']);})[_0x5d14('0x1a')](function(_0x2bcdc6){logger[_0x5d14('0xc')](_0x5d14('0xd'),_0x38a24f,JSON[_0x5d14('0x1b')](_0x2bcdc6));logger[_0x5d14('0x18')](_0x5d14('0x11'),_0x38a24f);})[_0x5d14('0x1c')](function(){_0x474760[_0x5d14('0x12')]();});}}}catch(_0x4a2617){logger[_0x5d14('0xc')](_0x5d14('0xd'),_0x38a24f,_[_0x5d14('0x1d')](_0x4a2617)?JSON[_0x5d14('0x1b')](_0x4a2617):_0x4a2617);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x38a24f);_0x474760[_0x5d14('0x12')]();}};}; \ No newline at end of file +var _0x7a7d=['Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x59b5e3,_0x35e31b){var _0x3f685f=function(_0x574f51){while(--_0x574f51){_0x59b5e3['push'](_0x59b5e3['shift']());}};_0x3f685f(++_0x35e31b);}(_0x7a7d,0x9f));var _0xd7a7=function(_0x174e6a,_0xf96d33){_0x174e6a=_0x174e6a-0x0;var _0x4780ce=_0x7a7d[_0x174e6a];return _0x4780ce;};'use strict';var schema=require(_0xd7a7('0x0'));var _=require(_0xd7a7('0x1'));var rpc={'chatInteraction':require(_0xd7a7('0x2')),'openchannelInteraction':require(_0xd7a7('0x3')),'smsInteraction':require(_0xd7a7('0x4')),'mailInteraction':require(_0xd7a7('0x5')),'faxInteraction':require(_0xd7a7('0x6')),'whatsappInteraction':require(_0xd7a7('0x7'))};var logger=require(_0xd7a7('0x8'))(_0xd7a7('0x9'));var tag=schema({'tag':{'type':_0xd7a7('0xa'),'required':!![],'message':_0xd7a7('0xb')}});exports[_0xd7a7('0xc')]=function(_0x343af1,_0x3a0a93,_0xfb0bfe,_0x717457){return function(_0x94823e){try{var _0x331712={'tag':_0x3a0a93[0x0]};var _0x3a2b55=tag[_0xd7a7('0x0')](_0x331712,{'typecast':!![]});if(_0x3a2b55[_0xd7a7('0xd')]){logger['error']('[%s][TAG]\x20%s',_0x343af1,_[_0xd7a7('0xe')](_0x3a2b55,_0xd7a7('0xf'))[_0xd7a7('0x10')](',\x20'));logger[_0xd7a7('0x11')](_0xd7a7('0x12'),_0x343af1);_0x94823e[_0xd7a7('0x13')]();}else{var _0x181b2f={'ids':[_0x3a0a93[0x0]]};if(rpc[_0x717457[_0xd7a7('0x14')]+_0xd7a7('0x15')]){rpc[_0x717457[_0xd7a7('0x14')]+_0xd7a7('0x15')][_0xd7a7('0x16')](_0x717457[_0xd7a7('0x17')]['id'],_0x181b2f)['then'](function(_0x1743fc){logger[_0xd7a7('0x11')](_0xd7a7('0x18'),_0x343af1,_0x3a0a93[0x1],_0x717457['channel'],_0x717457[_0xd7a7('0x17')]['id']);})[_0xd7a7('0x19')](function(_0x5ed7de){logger[_0xd7a7('0x1a')]('[%s][TAG]\x20%s',_0x343af1,JSON[_0xd7a7('0x1b')](_0x5ed7de));logger['info'](_0xd7a7('0x12'),_0x343af1);})['finally'](function(){_0x94823e[_0xd7a7('0x13')]();});}}}catch(_0xe3b10d){logger[_0xd7a7('0x1a')](_0xd7a7('0x1c'),_0x343af1,_[_0xd7a7('0x1d')](_0xe3b10d)?JSON[_0xd7a7('0x1b')](_0xe3b10d):_0xe3b10d);logger[_0xd7a7('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x343af1);_0x94823e[_0xd7a7('0x13')]();}};}; \ 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 3ec4c44..c7a237e 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 _0xc22f=['parse','logged','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','replace','includes','urlOnAnswer','title','jsonrpc','login','push','params','stringify','utf8','application/json-rpc','then'];(function(_0x190627,_0x38820b){var _0x3a788a=function(_0x1a87fa){while(--_0x1a87fa){_0x190627['push'](_0x190627['shift']());}};_0x3a788a(++_0x38820b);}(_0xc22f,0xc1));var _0xfc22=function(_0x3d8494,_0x5cf5c7){_0x3d8494=_0x3d8494-0x0;var _0x644cbd=_0xc22f[_0x3d8494];return _0x644cbd;};'use strict';var rp=require(_0xfc22('0x0'));var logger=require(_0xfc22('0x1'))('routing');var _=require(_0xfc22('0x2'));var arr=[];exports[_0xfc22('0x3')]=function(_0x319de0,_0x51467c){return function(_0x1cbf22){var _0x5827a8=_0x51467c[0xa];var _0x1b28bb=_0x51467c[0xb];var _0x2fcd64=_0x51467c[0xc];var _0x55279c=_0x51467c[0xd];var _0x55f3e1=_0x51467c[0xe];var _0x2d1dc2=_0x51467c[0xf]['replace'](/\n/g,_0xfc22('0x4'));var _0x680184=_0x51467c[0x10][_0xfc22('0x5')](/\n/g,'\x20');if(!arr[_0xfc22('0x6')](_0x1b28bb)){arr['push'](_0x1b28bb);var _0x22d78e=_0x51467c[0x3];var _0x1a2926=_0x51467c[0x4];var _0x48cde6=_0x51467c[0x1];var _0x4aa257=_0x51467c[0x0];var _0x156b43={};_0x156b43[_0xfc22('0x7')]=_0x51467c[0x8]+'?params='+_0x2fcd64+'|'+_0x5827a8+'|'+_0x55279c+'|'+_0x1b28bb+'|'+_0x55f3e1;_0x156b43['urlOnRing']=_0x51467c[0x7]+'?params='+_0x2fcd64+'|'+_0x5827a8+'|'+_0x55279c+'|'+_0x1b28bb+'|'+_0x55f3e1+'|'+_0x2d1dc2+'|'+_0x680184;_0x156b43[_0xfc22('0x8')]=_0x51467c[0x9];var _0x1c7f6f={};_0x1c7f6f[_0xfc22('0x9')]='2.0';_0x1c7f6f['method']=_0xfc22('0xa');var _0x1805f3=[];_0x1805f3[_0xfc22('0xb')](_0x51467c[0x2]);_0x1805f3[_0xfc22('0xb')](_0x51467c[0x5]);_0x1805f3[_0xfc22('0xb')](_0x51467c[0x6]);_0x1c7f6f[_0xfc22('0xc')]=_0x1805f3;_0x1c7f6f['id']=0x1;var _0x342f3f=JSON[_0xfc22('0xd')](_0x1c7f6f);var _0x25b886={'encoding':_0xfc22('0xe'),'method':'POST','timeout':0x2710,'url':_0x22d78e,'headers':{'Content-Type':_0xfc22('0xf')},'body':_0x342f3f};return rp(_0x25b886)[_0xfc22('0x10')](function(_0x5f5380){const _0x46b852=JSON[_0xfc22('0x11')](_0x5f5380);if(!_0x46b852['result'][_0xfc22('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x454560=_0x1b28bb;var _0x408e27=_0xfc22('0x13')+_0x48cde6+_0xfc22('0x14')+_0x4aa257+_0xfc22('0x15')+_0x454560+_0xfc22('0x16')+JSON[_0xfc22('0xd')](_0x156b43);var _0x3f2c3b=_0x1a2926+'?'+_0x408e27;return rp(_0x3f2c3b);})[_0xfc22('0x10')](function(_0x130f64){logger['info'](_0xfc22('0x17'),_0x319de0,_0x130f64);_0x1cbf22[_0xfc22('0x18')]();})[_0xfc22('0x19')](function(_0xc37d78){logger['error']('[%s][TVOX]\x20%s',_0x319de0,_[_0xfc22('0x1a')](_0xc37d78)?JSON[_0xfc22('0xd')](_0xc37d78):_0xc37d78);_0x1cbf22[_0xfc22('0x18')]();});}else{logger[_0xfc22('0x1b')](_0xfc22('0x1c'),_0x319de0);_0x1cbf22[_0xfc22('0x1d')]();}};}; \ No newline at end of file +var _0xd51c=['parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','next','../../../../config/logger','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','method','login','push','params','stringify','utf8','application/json-rpc','then'];(function(_0x444843,_0x1ca9e9){var _0x124ea8=function(_0x24f131){while(--_0x24f131){_0x444843['push'](_0x444843['shift']());}};_0x124ea8(++_0x1ca9e9);}(_0xd51c,0xfd));var _0xcd51=function(_0x5c5bcc,_0x5b6339){_0x5c5bcc=_0x5c5bcc-0x0;var _0x1e9718=_0xd51c[_0x5c5bcc];return _0x1e9718;};'use strict';var rp=require('request-promise');var logger=require(_0xcd51('0x0'))('routing');var _=require('lodash');var arr=[];exports[_0xcd51('0x1')]=function(_0x2f78fd,_0x22e400){return function(_0x5645b8){var _0x1ca08e=_0x22e400[0xa];var _0x27d1e0=_0x22e400[0xb];var _0x2da5d=_0x22e400[0xc];var _0x41617f=_0x22e400[0xd];var _0x2956fb=_0x22e400[0xe];var _0x235893=_0x22e400[0xf][_0xcd51('0x2')](/\n/g,_0xcd51('0x3'));var _0x101669=_0x22e400[0x10][_0xcd51('0x2')](/\n/g,'\x20');if(!arr[_0xcd51('0x4')](_0x27d1e0)){arr['push'](_0x27d1e0);var _0x334ada=_0x22e400[0x3];var _0xb28233=_0x22e400[0x4];var _0x24f826=_0x22e400[0x1];var _0x308a8c=_0x22e400[0x0];var _0x4a912e={};_0x4a912e[_0xcd51('0x5')]=_0x22e400[0x8]+_0xcd51('0x6')+_0x2da5d+'|'+_0x1ca08e+'|'+_0x41617f+'|'+_0x27d1e0+'|'+_0x2956fb;_0x4a912e[_0xcd51('0x7')]=_0x22e400[0x7]+'?params='+_0x2da5d+'|'+_0x1ca08e+'|'+_0x41617f+'|'+_0x27d1e0+'|'+_0x2956fb+'|'+_0x235893+'|'+_0x101669;_0x4a912e['title']=_0x22e400[0x9];var _0x3cc903={};_0x3cc903[_0xcd51('0x8')]='2.0';_0x3cc903[_0xcd51('0x9')]=_0xcd51('0xa');var _0x2802d0=[];_0x2802d0[_0xcd51('0xb')](_0x22e400[0x2]);_0x2802d0['push'](_0x22e400[0x5]);_0x2802d0[_0xcd51('0xb')](_0x22e400[0x6]);_0x3cc903[_0xcd51('0xc')]=_0x2802d0;_0x3cc903['id']=0x1;var _0x40c174=JSON[_0xcd51('0xd')](_0x3cc903);var _0x33498e={'encoding':_0xcd51('0xe'),'method':'POST','timeout':0x2710,'url':_0x334ada,'headers':{'Content-Type':_0xcd51('0xf')},'body':_0x40c174};return rp(_0x33498e)[_0xcd51('0x10')](function(_0x8eae73){const _0x2285cb=JSON[_0xcd51('0x11')](_0x8eae73);if(!_0x2285cb[_0xcd51('0x12')]['logged']){throw new Error(_0xcd51('0x13'));}var _0x3b80f9=_0x27d1e0;var _0x1a0861=_0xcd51('0x14')+_0x24f826+_0xcd51('0x15')+_0x308a8c+_0xcd51('0x16')+_0x3b80f9+'&data='+JSON[_0xcd51('0xd')](_0x4a912e);var _0x272264=_0xb28233+'?'+_0x1a0861;return rp(_0x272264);})[_0xcd51('0x10')](function(_0x93f02f){logger[_0xcd51('0x17')](_0xcd51('0x18'),_0x2f78fd,_0x93f02f);_0x5645b8[_0xcd51('0x19')]();})[_0xcd51('0x1a')](function(_0x476f68){logger['error'](_0xcd51('0x1b'),_0x2f78fd,_[_0xcd51('0x1c')](_0x476f68)?JSON['stringify'](_0x476f68):_0x476f68);_0x5645b8[_0xcd51('0x19')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2f78fd);_0x5645b8[_0xcd51('0x1d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 8e49caa..1548384 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x52950b,_0x238662){var _0x471acb=function(_0x241877){while(--_0x241877){_0x52950b['push'](_0x52950b['shift']());}};_0x471acb(++_0x238662);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xdf1a7,_0x2985bd){var _0x57e31d=function(_0x2a60ca){while(--_0x2a60ca){_0xdf1a7['push'](_0xdf1a7['shift']());}};_0x57e31d(++_0x2985bd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0dac004..59ffee8 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 _0xfd28=['Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','Intervals','IntervalId','interval','listen','rules','message','interaction','applications','length','join','app','.js','autoreply','split','channel','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','./applications/','priority','info'];(function(_0x238134,_0x46fa37){var _0x4713d1=function(_0x45f584){while(--_0x45f584){_0x238134['push'](_0x238134['shift']());}};_0x4713d1(++_0x46fa37);}(_0xfd28,0x148));var _0x8fd2=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xfd28[_0x281e5e];return _0x5a22d2;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x8fd2('0x2'));var utils=require('./applications/utils');var logger=require(_0x8fd2('0x3'))(_0x8fd2('0x4'));var rpc={'openchannelQueueReport':require(_0x8fd2('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x8fd2('0x6')),'smsQueueReport':require(_0x8fd2('0x7')),'faxQueueReport':require(_0x8fd2('0x8')),'whatsappQueueReport':require(_0x8fd2('0x9'))};var RuleEngine=require(_0x8fd2('0xa'));function getId(_0x4bdc1a,_0x53d938,_0x10fccf){return util[_0x8fd2('0xb')](_0x8fd2('0xc'),_0x4bdc1a,_0x53d938||0x0,_0x10fccf||0x0);}function getIntervals(_0x4d794a,_0x13cc69){var _0x49ca87=[];if(!_[_0x8fd2('0xd')](_0x13cc69['IntervalId'])&&!_[_0x8fd2('0xd')](_0x4d794a[_0x13cc69['IntervalId']])&&!_[_0x8fd2('0xd')](_0x4d794a[_0x13cc69['IntervalId']][_0x8fd2('0xe')])){_0x49ca87=_['map'](_0x4d794a[_0x13cc69[_0x8fd2('0xf')]][_0x8fd2('0xe')],_0x8fd2('0x10'));}else if(!_[_0x8fd2('0xd')](_0x13cc69[_0x8fd2('0x10')])){_0x49ca87=[_0x13cc69[_0x8fd2('0x10')]];}return _0x49ca87;}exports[_0x8fd2('0x11')]=function(_0xf22ae){_0xf22ae[_0x8fd2('0x12')]={};return new BPromise(function(_0x2b4611,_0x118329){var _0x6b8ef={'Start':function(_0x725d57){var _0x40712c=this;return new Promise(function(_0xa65b4,_0x596639){if(_0x725d57){try{var _0x20daca=[];var _0x5ef478=getId(_0x725d57['channel'],_0x725d57['message']?_0x725d57[_0x8fd2('0x13')]['id']:0x0,_0x725d57[_0x8fd2('0x14')]?_0x725d57[_0x8fd2('0x14')]['id']:0x0);if(_0x725d57[_0x8fd2('0x15')]&&_['isArray'](_0x725d57[_0x8fd2('0x15')])&&_0x725d57[_0x8fd2('0x15')][_0x8fd2('0x16')]){for(var _0x36e675=0x0;_0x36e675<_0x725d57[_0x8fd2('0x15')]['length'];_0x36e675+=0x1){var _0x48ad51=_0x725d57[_0x8fd2('0x15')][_0x36e675];if(fs['existsSync'](path[_0x8fd2('0x17')](__dirname,'applications',_0x48ad51[_0x8fd2('0x18')]+_0x8fd2('0x19')))){var _0x4f81dc=[];switch(_0x48ad51[_0x8fd2('0x18')]['toLowerCase']()){case _0x8fd2('0x1a'):var _0x44ee7a=_0x48ad51['appdata'][_0x8fd2('0x1b')](',');if(_0x725d57[_0x8fd2('0x1c')]===_0x8fd2('0x1d')){_0x4f81dc['push'](_0x44ee7a[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x44ee7a[0x1]);_0x4f81dc[_0x8fd2('0x1e')](_0x44ee7a[_0x8fd2('0x1f')](0x2,_0x44ee7a[_0x8fd2('0x16')])[_0x8fd2('0x17')](','));}else{_0x4f81dc[_0x8fd2('0x1e')](_0x44ee7a[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x44ee7a[_0x8fd2('0x1f')](0x1,_0x44ee7a[_0x8fd2('0x16')])[_0x8fd2('0x17')](','));}break;case _0x8fd2('0x20'):var _0x1f3237=_0x48ad51[_0x8fd2('0x21')]['split'](',');_0x4f81dc['push'](_0x1f3237[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x1f3237[0x1]);_0x4f81dc[_0x8fd2('0x1e')](_0x1f3237[_0x8fd2('0x1f')](0x2,_0x1f3237['length'])[_0x8fd2('0x17')](','));break;case _0x8fd2('0x22'):var _0x27b256=_0x48ad51[_0x8fd2('0x21')][_0x8fd2('0x1b')](',');_0x4f81dc[_0x8fd2('0x1e')](_0x27b256[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x27b256[0x1]);_0x4f81dc['push'](_0x27b256[0x2]);_0x4f81dc[_0x8fd2('0x1e')](_0x27b256[0x3]);_0x4f81dc[_0x8fd2('0x1e')](_0x27b256[_0x8fd2('0x1f')](0x4,_0x27b256[_0x8fd2('0x16')])[_0x8fd2('0x17')](','));break;case _0x8fd2('0x23'):var _0x39df3a=_0x48ad51['appdata']['split'](',');_0x4f81dc['push'](_0x39df3a[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x39df3a[0x1]);_0x4f81dc[_0x8fd2('0x1e')](_0x39df3a[0x2]);_0x4f81dc[_0x8fd2('0x1e')](_0x39df3a[0x3]);_0x4f81dc[_0x8fd2('0x1e')](_0x39df3a['slice'](0x4,_0x39df3a['length'])[_0x8fd2('0x17')](','));break;case _0x8fd2('0x13'):_0x4f81dc[_0x8fd2('0x1e')](_0x48ad51[_0x8fd2('0x21')]);break;case _0x8fd2('0x24'):_0x4f81dc['push'](_0x48ad51[_0x8fd2('0x25')]);_0x4f81dc['push'](_0x48ad51[_0x8fd2('0x21')]);break;case'tvox':var _0x445b67=utils['getMustacheRender'](_0x725d57[_0x8fd2('0x26')][_0x8fd2('0x27')],_0x725d57);var _0x39092e=_0x48ad51['appdata'][_0x8fd2('0x1b')](',');_0x4f81dc['push'](_0x39092e[0x0]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x1]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x2]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x3]);_0x4f81dc['push'](_0x39092e[0x4]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x5]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x6]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x7]);_0x4f81dc['push'](_0x39092e[0x8]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0x9]);_0x4f81dc[_0x8fd2('0x1e')](_0x39092e[0xa]);_0x4f81dc[_0x8fd2('0x1e')](_0x725d57['interaction']['id']);_0x4f81dc[_0x8fd2('0x1e')](_0x725d57[_0x8fd2('0x13')]['id']);_0x4f81dc['push'](_0x48ad51[_0x8fd2('0x28')]);_0x4f81dc[_0x8fd2('0x1e')](_0x725d57[_0x8fd2('0x14')][_0x8fd2('0x29')]);_0x4f81dc[_0x8fd2('0x1e')](_0x725d57[_0x8fd2('0x2a')][_0x8fd2('0x2a')]);_0x4f81dc['push'](_0x445b67);break;default:_0x4f81dc=_[_0x8fd2('0xd')](_0x48ad51['appdata'])?[]:_0x48ad51['appdata'][_0x8fd2('0x1b')](',');}var _0xb2c8cc={'id':util[_0x8fd2('0xb')](_0x8fd2('0x2b'),_0x5ef478,_0x48ad51['id'],_0x48ad51[_0x8fd2('0x18')]),'condition':require(_0x8fd2('0x2c'))['condition'](_0x5ef478,getIntervals(_0xf22ae['intervals'],_0x48ad51),_0xf22ae),'consequence':require(_0x8fd2('0x2d')+_0x48ad51['app'])['consequence'](_0x5ef478,_0x4f81dc,_0xf22ae,_0x725d57),'p':_0x48ad51[_0x8fd2('0x2e')]||0x0};logger[_0x8fd2('0x2f')](_0x8fd2('0x30'),_0xb2c8cc['id'],_0x8fd2('0x31'),getIntervals(_0xf22ae['intervals'],_0x48ad51)[_0x8fd2('0x17')](_0x8fd2('0x32')));_0x20daca[_0x8fd2('0x1e')](_0xb2c8cc);}else{logger[_0x8fd2('0x33')](_0x8fd2('0x34'),path[_0x8fd2('0x17')](__dirname,_0x8fd2('0x15'),_0x48ad51['app']+_0x8fd2('0x19')));}}_0xf22ae[_0x8fd2('0x12')][_0x5ef478]=new RuleEngine(_0x20daca);_0xf22ae[_0x8fd2('0x12')][_0x5ef478][_0x8fd2('0x35')](_0x725d57,function(_0xde7e1){logger[_0x8fd2('0x2f')](_0x8fd2('0x36'),JSON['stringify'](_0xde7e1[_0x8fd2('0x37')]));if(_0xf22ae[_0x8fd2('0x12')][_0x5ef478]){_0xf22ae[_0x8fd2('0x12')][_0x5ef478][_0x8fd2('0x38')](_0x8fd2('0x39'));}});return _0xa65b4({'code':0xc8,'message':_0x725d57});}else{logger[_0x8fd2('0x2f')](_0x8fd2('0x3a'));return _0xa65b4({'code':0xc8,'message':_0x725d57});}}catch(_0x592cd6){logger[_0x8fd2('0x33')](_0x592cd6['stack']);return _0x596639(_0x40712c[_0x8fd2('0x33')](0x1f4,_0x592cd6));}}return _0x596639('routing\x20is\x20empty');});},'AcceptMessage':function(_0x17710f){var _0xe511dd=this;return new Promise(function(_0x2a39ac,_0x5c0632){if(_0x17710f[_0x8fd2('0x3b')]&&_0x17710f[_0x8fd2('0x3b')]['id']){if(_0xf22ae[_0x8fd2('0x3c')][_0x17710f['agent']['id']]){_0xf22ae[_0x8fd2('0x3c')][_0x17710f['agent']['id']][_0x8fd2('0x3d')]=![];_0xf22ae[_0x8fd2('0x3c')][_0x17710f[_0x8fd2('0x3b')]['id']][_0x8fd2('0x3e')]=undefined;}}if(_0x17710f[_0x8fd2('0x13')]&&_0x17710f[_0x8fd2('0x13')]['id']){try{var _0x154b61=getId(_0x17710f[_0x8fd2('0x1c')],_0x17710f[_0x8fd2('0x13')]?_0x17710f[_0x8fd2('0x13')]['id']:0x0,_0x17710f[_0x8fd2('0x14')]?_0x17710f[_0x8fd2('0x14')]['id']:0x0);if(_0xf22ae[_0x8fd2('0x12')][_0x154b61]){_0xf22ae[_0x8fd2('0x12')][_0x154b61][_0x8fd2('0x38')](_0x8fd2('0x3f'));if(rpc[_0x17710f[_0x8fd2('0x1c')]+_0x8fd2('0x40')]){rpc[_0x17710f[_0x8fd2('0x1c')]+'QueueReport']['update'](_0x154b61,{'UserId':_0x17710f[_0x8fd2('0x13')][_0x8fd2('0x41')]})[_0x8fd2('0x42')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2a39ac({'code':0xc8,'message':_0x17710f});}catch(_0x177f04){logger['error'](_0x177f04[_0x8fd2('0x43')]);return _0x5c0632(_0xe511dd[_0x8fd2('0x33')](0x1f4,_0x177f04));}}logger[_0x8fd2('0x33')]('message\x20is\x20empty');return _0x5c0632(_0xe511dd[_0x8fd2('0x33')](0x1f4,_0x8fd2('0x44')));});},'RejectMessage':function(_0x4be84b){var _0x331ada=this;return new Promise(function(_0x27f5a2,_0x19cef4){if(_0x4be84b['agent']&&_0x4be84b[_0x8fd2('0x3b')]['id']){try{if(_0xf22ae[_0x8fd2('0x3c')][_0x4be84b[_0x8fd2('0x3b')]['id']]){_0xf22ae[_0x8fd2('0x3c')][_0x4be84b[_0x8fd2('0x3b')]['id']][_0x8fd2('0x3d')]=![];_0xf22ae['agents'][_0x4be84b['agent']['id']][_0x8fd2('0x3e')]=undefined;}return _0x27f5a2({'code':0xc8,'message':_0x4be84b});}catch(_0x8c11e8){logger['error'](_0x8c11e8[_0x8fd2('0x43')]);return _0x19cef4(_0x331ada['error'](0x1f4,_0x8c11e8));}}logger['error'](_0x8fd2('0x44'));return _0x19cef4(_0x331ada[_0x8fd2('0x33')](0x1f4,_0x8fd2('0x44')));});},'AbandonInteraction':function(_0x29a00e){var _0x353450=this;return new Promise(function(_0x3de5b1,_0x52c912){if(_0x29a00e[_0x8fd2('0x1c')]&&_0x29a00e[_0x8fd2('0x14')]&&_0x29a00e[_0x8fd2('0x14')]['id']){try{var _0x930a07=getId(_0x29a00e[_0x8fd2('0x1c')],_0x29a00e['message']?_0x29a00e['message']['id']:0x0,_0x29a00e['interaction']?_0x29a00e['interaction']['id']:0x0);if(_0xf22ae['rules'][_0x930a07]){_0xf22ae[_0x8fd2('0x12')][_0x930a07][_0x8fd2('0x38')](_0x8fd2('0x3f'));}return _0x3de5b1({'code':0xc8,'message':_0x29a00e});}catch(_0x2988d0){logger[_0x8fd2('0x33')](_0x2988d0[_0x8fd2('0x43')]);return _0x52c912(_0x353450[_0x8fd2('0x33')](0x1f4,_0x2988d0));}}logger['error'](_0x8fd2('0x44'));return _0x52c912(_0x353450['error'](0x1f4,_0x8fd2('0x44')));});},'AgentCapacity':function(_0xdd46b1){var _0x478aad=this;return new Promise(function(_0x52006b,_0x3baa83){if(_0xf22ae[_0x8fd2('0x3c')][_0x8fd2('0x45')](_0xdd46b1['id'])){for(var _0x30a952 in _0xdd46b1[_0x8fd2('0x46')]){if(_0xdd46b1['capacity'][_0x8fd2('0x45')](_0x30a952)){if(_0xf22ae[_0x8fd2('0x3c')][_0xdd46b1['id']][_0x8fd2('0x45')](_0x30a952+_0x8fd2('0x47'))){_0xf22ae['agents'][_0xdd46b1['id']][_0x30a952+_0x8fd2('0x47')]=parseInt(_0xdd46b1[_0x8fd2('0x46')][_0x30a952],0xa);}}}_0xf22ae[_0x8fd2('0x3c')][_0xdd46b1['id']][_0x8fd2('0x48')]();return _0x52006b({'code':0xc8,'message':_0xf22ae['agents'][_0xdd46b1['id']]});}else{return _0x3baa83(_0x478aad['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2e5693){return new Promise(function(_0x19e68d){var _0xb88ae7=_[_0x8fd2('0x49')](_0xf22ae[_0x8fd2('0x3c')]);if(_0x2e5693&&_0x2e5693['id']){var _0x47ede0=_[_0x8fd2('0x4a')](_0xb88ae7,function(_0x68a04a){return _0x68a04a['id']===_0x2e5693['id'];});_0x19e68d(_0x47ede0);}else{_0x19e68d({'count':_0xb88ae7['length'],'rows':_0xb88ae7});}});},'ChatQueues':function(){return new Promise(function(_0x25123f){var _0x164991=[];for(var _0x186869 in _0xf22ae[_0x8fd2('0x4b')]){if(_0xf22ae[_0x8fd2('0x4b')]['hasOwnProperty'](_0x186869)){var _0x428034=_0xf22ae[_0x8fd2('0x4b')][_0x186869];var _0x21f1a7={'id':_0x428034['id'],'available':_0x428034[_0x8fd2('0x4c')],'loggedIn':_0x428034[_0x8fd2('0x4d')],'name':_0x428034[_0x8fd2('0x4e')],'paused':_0x428034[_0x8fd2('0x4f')],'waiting':_0x428034[_0x8fd2('0x50')]};_0x164991[_0x8fd2('0x1e')](_0x21f1a7);}}_0x25123f({'count':_0x164991[_0x8fd2('0x16')],'rows':_0x164991});});},'MailQueues':function(){return new Promise(function(_0xf7c83a){var _0x4d0402=[];for(var _0x40ffd5 in _0xf22ae['mailQueues']){if(_0xf22ae[_0x8fd2('0x51')][_0x8fd2('0x45')](_0x40ffd5)){var _0x4b043d=_0xf22ae['mailQueues'][_0x40ffd5];var _0x553fa1={'id':_0x4b043d['id'],'available':_0x4b043d[_0x8fd2('0x4c')],'loggedIn':_0x4b043d[_0x8fd2('0x4d')],'name':_0x4b043d[_0x8fd2('0x4e')],'paused':_0x4b043d[_0x8fd2('0x4f')],'waiting':_0x4b043d[_0x8fd2('0x50')]};_0x4d0402[_0x8fd2('0x1e')](_0x553fa1);}}_0xf7c83a({'count':_0x4d0402['length'],'rows':_0x4d0402});});},'OpenchannelQueues':function(){return new Promise(function(_0x349e86){var _0x385321=[];for(var _0x510553 in _0xf22ae[_0x8fd2('0x52')]){if(_0xf22ae['openchannelQueues'][_0x8fd2('0x45')](_0x510553)){var _0x25d69d=_0xf22ae[_0x8fd2('0x52')][_0x510553];var _0x31e96f={'id':_0x25d69d['id'],'available':_0x25d69d[_0x8fd2('0x4c')],'loggedIn':_0x25d69d['loggedIn'],'name':_0x25d69d[_0x8fd2('0x4e')],'paused':_0x25d69d[_0x8fd2('0x4f')],'waiting':_0x25d69d['waiting']};_0x385321[_0x8fd2('0x1e')](_0x31e96f);}}_0x349e86({'count':_0x385321['length'],'rows':_0x385321});});},'SmsQueues':function(){return new Promise(function(_0x50c6a6){var _0x433912=[];for(var _0x1d36d2 in _0xf22ae['smsQueues']){if(_0xf22ae[_0x8fd2('0x53')][_0x8fd2('0x45')](_0x1d36d2)){var _0x6c766c=_0xf22ae['smsQueues'][_0x1d36d2];var _0xa773e6={'id':_0x6c766c['id'],'available':_0x6c766c[_0x8fd2('0x4c')],'loggedIn':_0x6c766c[_0x8fd2('0x4d')],'name':_0x6c766c[_0x8fd2('0x4e')],'paused':_0x6c766c[_0x8fd2('0x4f')],'waiting':_0x6c766c[_0x8fd2('0x50')]};_0x433912[_0x8fd2('0x1e')](_0xa773e6);}}_0x50c6a6({'count':_0x433912['length'],'rows':_0x433912});});},'FaxQueues':function(){return new Promise(function(_0x55f13b){var _0x132ddb=[];for(var _0xf718ec in _0xf22ae['faxQueues']){if(_0xf22ae['faxQueues']['hasOwnProperty'](_0xf718ec)){var _0x507be8=_0xf22ae['faxQueues'][_0xf718ec];var _0x32164a={'id':_0x507be8['id'],'available':_0x507be8[_0x8fd2('0x4c')],'loggedIn':_0x507be8[_0x8fd2('0x4d')],'name':_0x507be8[_0x8fd2('0x4e')],'paused':_0x507be8[_0x8fd2('0x4f')],'waiting':_0x507be8['waiting']};_0x132ddb[_0x8fd2('0x1e')](_0x32164a);}}_0x55f13b({'count':_0x132ddb[_0x8fd2('0x16')],'rows':_0x132ddb});});},'WhatsappQueues':function(){return new Promise(function(_0x3b94f9){var _0x544a19=[];for(var _0x2cdc40 in _0xf22ae[_0x8fd2('0x54')]){if(_0xf22ae['whatsappQueues'][_0x8fd2('0x45')](_0x2cdc40)){var _0x33d05e=_0xf22ae[_0x8fd2('0x54')][_0x2cdc40];var _0x2af76d={'id':_0x33d05e['id'],'available':_0x33d05e[_0x8fd2('0x4c')],'loggedIn':_0x33d05e[_0x8fd2('0x4d')],'name':_0x33d05e[_0x8fd2('0x4e')],'paused':_0x33d05e['paused'],'waiting':_0x33d05e[_0x8fd2('0x50')]};_0x544a19[_0x8fd2('0x1e')](_0x2af76d);}}_0x3b94f9({'count':_0x544a19[_0x8fd2('0x16')],'rows':_0x544a19});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1a924f){var _0x15747d=_[_0x8fd2('0x49')](_0xf22ae[_0x8fd2('0x55')]);_0x1a924f({'count':_0x15747d['length'],'rows':_0x15747d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x40a4fc){var _0x3607a7=_['values'](_0xf22ae[_0x8fd2('0x56')]);_0x40a4fc({'count':_0x3607a7[_0x8fd2('0x16')],'rows':_0x3607a7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3f8baf){var _0x131ee8=_[_0x8fd2('0x49')](_0xf22ae[_0x8fd2('0x57')]);_0x3f8baf({'count':_0x131ee8[_0x8fd2('0x16')],'rows':_0x131ee8});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2a0c4){var _0x52de20=_[_0x8fd2('0x49')](_0xf22ae['smsQueuesWaitingInteractions']);_0x2a0c4({'count':_0x52de20['length'],'rows':_0x52de20});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x478c79){var _0x103e4b=_['values'](_0xf22ae[_0x8fd2('0x58')]);_0x478c79({'count':_0x103e4b['length'],'rows':_0x103e4b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5afb15){var _0x1d6bdb=_[_0x8fd2('0x49')](_0xf22ae['whatsappQueuesWaitingInteractions']);_0x5afb15({'count':_0x1d6bdb[_0x8fd2('0x16')],'rows':_0x1d6bdb});});}};var _0x2449cf=jayson[_0x8fd2('0x59')](_0x6b8ef)[_0x8fd2('0x5a')]();_0x2449cf['on']('error',function(_0x4ff263){logger[_0x8fd2('0x33')](JSON['stringify'](_0x4ff263));return _0x118329(_0x4ff263);});_0x2449cf[_0x8fd2('0x11')](0x232c,_0x8fd2('0x5b'),function(){console['log'](_0x8fd2('0x5c'),0x232c);return _0x2b4611(_0x8fd2('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x3140=['applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','consequence','priority','info','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','isArray'];(function(_0x1de62e,_0x173bb4){var _0x34f094=function(_0x1a4882){while(--_0x1a4882){_0x1de62e['push'](_0x1de62e['shift']());}};_0x34f094(++_0x173bb4);}(_0x3140,0xaf));var _0x0314=function(_0x530ec8,_0x3b402d){_0x530ec8=_0x530ec8-0x0;var _0xdd83a5=_0x3140[_0x530ec8];return _0xdd83a5;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var fs=require('fs');var jayson=require(_0x0314('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x0314('0x4'))(_0x0314('0x5'));var rpc={'openchannelQueueReport':require(_0x0314('0x6')),'mailQueueReport':require(_0x0314('0x7')),'chatQueueReport':require(_0x0314('0x8')),'smsQueueReport':require(_0x0314('0x9')),'faxQueueReport':require(_0x0314('0xa')),'whatsappQueueReport':require(_0x0314('0xb'))};var RuleEngine=require(_0x0314('0xc'));function getId(_0x44762d,_0x176944,_0x495b27){return util[_0x0314('0xd')](_0x0314('0xe'),_0x44762d,_0x176944||0x0,_0x495b27||0x0);}function getIntervals(_0x553389,_0x5e9bca){var _0xf2561e=[];if(!_['isNil'](_0x5e9bca[_0x0314('0xf')])&&!_[_0x0314('0x10')](_0x553389[_0x5e9bca[_0x0314('0xf')]])&&!_[_0x0314('0x10')](_0x553389[_0x5e9bca[_0x0314('0xf')]][_0x0314('0x11')])){_0xf2561e=_['map'](_0x553389[_0x5e9bca[_0x0314('0xf')]][_0x0314('0x11')],_0x0314('0x12'));}else if(!_[_0x0314('0x10')](_0x5e9bca[_0x0314('0x12')])){_0xf2561e=[_0x5e9bca[_0x0314('0x12')]];}return _0xf2561e;}exports[_0x0314('0x13')]=function(_0x53e271){_0x53e271[_0x0314('0x14')]={};return new BPromise(function(_0xbe0b07,_0x1316a0){var _0x12d026={'Start':function(_0x40566e){var _0x398c91=this;return new Promise(function(_0x413bfa,_0x3ea356){if(_0x40566e){try{var _0x5e460f=[];var _0xb9730b=getId(_0x40566e[_0x0314('0x15')],_0x40566e[_0x0314('0x16')]?_0x40566e['message']['id']:0x0,_0x40566e[_0x0314('0x17')]?_0x40566e['interaction']['id']:0x0);if(_0x40566e['applications']&&_[_0x0314('0x18')](_0x40566e[_0x0314('0x19')])&&_0x40566e['applications'][_0x0314('0x1a')]){for(var _0x2a52b0=0x0;_0x2a52b0<_0x40566e['applications'][_0x0314('0x1a')];_0x2a52b0+=0x1){var _0x59ce1f=_0x40566e[_0x0314('0x19')][_0x2a52b0];if(fs[_0x0314('0x1b')](path[_0x0314('0x1c')](__dirname,_0x0314('0x19'),_0x59ce1f[_0x0314('0x1d')]+_0x0314('0x1e')))){var _0x4d3bc6=[];switch(_0x59ce1f['app'][_0x0314('0x1f')]()){case _0x0314('0x20'):var _0x1945f8=_0x59ce1f[_0x0314('0x21')][_0x0314('0x22')](',');if(_0x40566e[_0x0314('0x15')]==='mail'){_0x4d3bc6[_0x0314('0x23')](_0x1945f8[0x0]);_0x4d3bc6[_0x0314('0x23')](_0x1945f8[0x1]);_0x4d3bc6['push'](_0x1945f8[_0x0314('0x24')](0x2,_0x1945f8[_0x0314('0x1a')])[_0x0314('0x1c')](','));}else{_0x4d3bc6[_0x0314('0x23')](_0x1945f8[0x0]);_0x4d3bc6[_0x0314('0x23')](_0x1945f8[_0x0314('0x24')](0x1,_0x1945f8['length'])[_0x0314('0x1c')](','));}break;case _0x0314('0x25'):var _0x2d636b=_0x59ce1f['appdata'][_0x0314('0x22')](',');_0x4d3bc6[_0x0314('0x23')](_0x2d636b[0x0]);_0x4d3bc6['push'](_0x2d636b[0x1]);_0x4d3bc6['push'](_0x2d636b[_0x0314('0x24')](0x2,_0x2d636b[_0x0314('0x1a')])['join'](','));break;case _0x0314('0x26'):var _0x288535=_0x59ce1f['appdata']['split'](',');_0x4d3bc6[_0x0314('0x23')](_0x288535[0x0]);_0x4d3bc6[_0x0314('0x23')](_0x288535[0x1]);_0x4d3bc6['push'](_0x288535[0x2]);_0x4d3bc6[_0x0314('0x23')](_0x288535[0x3]);_0x4d3bc6[_0x0314('0x23')](_0x288535[_0x0314('0x24')](0x4,_0x288535['length'])[_0x0314('0x1c')](','));break;case _0x0314('0x27'):var _0x2ce20c=_0x59ce1f[_0x0314('0x21')]['split'](',');_0x4d3bc6[_0x0314('0x23')](_0x2ce20c[0x0]);_0x4d3bc6['push'](_0x2ce20c[0x1]);_0x4d3bc6['push'](_0x2ce20c[0x2]);_0x4d3bc6[_0x0314('0x23')](_0x2ce20c[0x3]);_0x4d3bc6[_0x0314('0x23')](_0x2ce20c[_0x0314('0x24')](0x4,_0x2ce20c['length'])[_0x0314('0x1c')](','));break;case'message':_0x4d3bc6[_0x0314('0x23')](_0x59ce1f['appdata']);break;case'tag':_0x4d3bc6[_0x0314('0x23')](_0x59ce1f['TagId']);_0x4d3bc6[_0x0314('0x23')](_0x59ce1f[_0x0314('0x21')]);break;case _0x0314('0x28'):var _0x1a79d1=utils[_0x0314('0x29')](_0x40566e[_0x0314('0x2a')][_0x0314('0x2b')],_0x40566e);var _0x4c763e=_0x59ce1f[_0x0314('0x21')][_0x0314('0x22')](',');_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x0]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x1]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x2]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x3]);_0x4d3bc6['push'](_0x4c763e[0x4]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x5]);_0x4d3bc6['push'](_0x4c763e[0x6]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x7]);_0x4d3bc6['push'](_0x4c763e[0x8]);_0x4d3bc6[_0x0314('0x23')](_0x4c763e[0x9]);_0x4d3bc6['push'](_0x4c763e[0xa]);_0x4d3bc6['push'](_0x40566e['interaction']['id']);_0x4d3bc6[_0x0314('0x23')](_0x40566e[_0x0314('0x16')]['id']);_0x4d3bc6[_0x0314('0x23')](_0x59ce1f[_0x0314('0x2c')]);_0x4d3bc6[_0x0314('0x23')](_0x40566e['interaction'][_0x0314('0x2d')]);_0x4d3bc6[_0x0314('0x23')](_0x40566e[_0x0314('0x2e')]['body']);_0x4d3bc6[_0x0314('0x23')](_0x1a79d1);break;default:_0x4d3bc6=_['isNil'](_0x59ce1f[_0x0314('0x21')])?[]:_0x59ce1f['appdata'][_0x0314('0x22')](',');}var _0x543dad={'id':util['format'](_0x0314('0x2f'),_0xb9730b,_0x59ce1f['id'],_0x59ce1f[_0x0314('0x1d')]),'condition':require('./interval')[_0x0314('0x30')](_0xb9730b,getIntervals(_0x53e271['intervals'],_0x59ce1f),_0x53e271),'consequence':require(_0x0314('0x31')+_0x59ce1f[_0x0314('0x1d')])[_0x0314('0x32')](_0xb9730b,_0x4d3bc6,_0x53e271,_0x40566e),'p':_0x59ce1f[_0x0314('0x33')]||0x0};logger[_0x0314('0x34')]('Push\x20new\x20rule',_0x543dad['id'],_0x0314('0x35'),getIntervals(_0x53e271[_0x0314('0x36')],_0x59ce1f)[_0x0314('0x1c')]('\x20|\x20'));_0x5e460f[_0x0314('0x23')](_0x543dad);}else{logger[_0x0314('0x37')](_0x0314('0x38'),path['join'](__dirname,_0x0314('0x19'),_0x59ce1f['app']+_0x0314('0x1e')));}}_0x53e271[_0x0314('0x14')][_0xb9730b]=new RuleEngine(_0x5e460f);_0x53e271[_0x0314('0x14')][_0xb9730b]['execute'](_0x40566e,function(_0xcafd05){logger[_0x0314('0x34')]('Applications\x20executed',JSON['stringify'](_0xcafd05['matchPath']));if(_0x53e271[_0x0314('0x14')][_0xb9730b]){_0x53e271[_0x0314('0x14')][_0xb9730b][_0x0314('0x39')]('complete');}});return _0x413bfa({'code':0xc8,'message':_0x40566e});}else{logger[_0x0314('0x34')](_0x0314('0x3a'));return _0x413bfa({'code':0xc8,'message':_0x40566e});}}catch(_0x111a7c){logger[_0x0314('0x37')](_0x111a7c[_0x0314('0x3b')]);return _0x3ea356(_0x398c91['error'](0x1f4,_0x111a7c));}}return _0x3ea356(_0x0314('0x3c'));});},'AcceptMessage':function(_0x234645){var _0xaa427b=this;return new Promise(function(_0x192b74,_0x1b7292){if(_0x234645[_0x0314('0x3d')]&&_0x234645[_0x0314('0x3d')]['id']){if(_0x53e271['agents'][_0x234645[_0x0314('0x3d')]['id']]){_0x53e271[_0x0314('0x3e')][_0x234645['agent']['id']][_0x0314('0x3f')]=![];_0x53e271[_0x0314('0x3e')][_0x234645[_0x0314('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x234645['message']&&_0x234645[_0x0314('0x16')]['id']){try{var _0x1a4033=getId(_0x234645[_0x0314('0x15')],_0x234645[_0x0314('0x16')]?_0x234645[_0x0314('0x16')]['id']:0x0,_0x234645[_0x0314('0x17')]?_0x234645[_0x0314('0x17')]['id']:0x0);if(_0x53e271['rules'][_0x1a4033]){_0x53e271[_0x0314('0x14')][_0x1a4033]['emit'](_0x0314('0x40'));if(rpc[_0x234645[_0x0314('0x15')]+_0x0314('0x41')]){rpc[_0x234645[_0x0314('0x15')]+_0x0314('0x41')]['update'](_0x1a4033,{'UserId':_0x234645['message'][_0x0314('0x42')]})[_0x0314('0x43')](function(){logger[_0x0314('0x37')](_0x0314('0x44'));});}}return _0x192b74({'code':0xc8,'message':_0x234645});}catch(_0x5b3c49){logger[_0x0314('0x37')](_0x5b3c49[_0x0314('0x3b')]);return _0x1b7292(_0xaa427b[_0x0314('0x37')](0x1f4,_0x5b3c49));}}logger[_0x0314('0x37')](_0x0314('0x45'));return _0x1b7292(_0xaa427b[_0x0314('0x37')](0x1f4,_0x0314('0x45')));});},'RejectMessage':function(_0x55f806){var _0x28ca8f=this;return new Promise(function(_0x9d4b1e,_0x2fed7d){if(_0x55f806['agent']&&_0x55f806[_0x0314('0x3d')]['id']){try{if(_0x53e271[_0x0314('0x3e')][_0x55f806['agent']['id']]){_0x53e271[_0x0314('0x3e')][_0x55f806[_0x0314('0x3d')]['id']][_0x0314('0x3f')]=![];_0x53e271[_0x0314('0x3e')][_0x55f806['agent']['id']][_0x0314('0x46')]=undefined;}return _0x9d4b1e({'code':0xc8,'message':_0x55f806});}catch(_0x1a3a28){logger[_0x0314('0x37')](_0x1a3a28[_0x0314('0x3b')]);return _0x2fed7d(_0x28ca8f[_0x0314('0x37')](0x1f4,_0x1a3a28));}}logger[_0x0314('0x37')](_0x0314('0x45'));return _0x2fed7d(_0x28ca8f[_0x0314('0x37')](0x1f4,_0x0314('0x45')));});},'AbandonInteraction':function(_0xa8dc19){var _0x573777=this;return new Promise(function(_0x12d1aa,_0x305568){if(_0xa8dc19[_0x0314('0x15')]&&_0xa8dc19[_0x0314('0x17')]&&_0xa8dc19[_0x0314('0x17')]['id']){try{var _0x39bc9=getId(_0xa8dc19[_0x0314('0x15')],_0xa8dc19['message']?_0xa8dc19['message']['id']:0x0,_0xa8dc19['interaction']?_0xa8dc19[_0x0314('0x17')]['id']:0x0);if(_0x53e271[_0x0314('0x14')][_0x39bc9]){_0x53e271['rules'][_0x39bc9][_0x0314('0x39')](_0x0314('0x40'));}return _0x12d1aa({'code':0xc8,'message':_0xa8dc19});}catch(_0x2ef23f){logger['error'](_0x2ef23f['stack']);return _0x305568(_0x573777[_0x0314('0x37')](0x1f4,_0x2ef23f));}}logger[_0x0314('0x37')]('message\x20is\x20empty');return _0x305568(_0x573777[_0x0314('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1b7cee){var _0x143d4c=this;return new Promise(function(_0x1ba76c,_0x37764f){if(_0x53e271['agents'][_0x0314('0x47')](_0x1b7cee['id'])){for(var _0x3fc295 in _0x1b7cee[_0x0314('0x48')]){if(_0x1b7cee['capacity'][_0x0314('0x47')](_0x3fc295)){if(_0x53e271[_0x0314('0x3e')][_0x1b7cee['id']][_0x0314('0x47')](_0x3fc295+_0x0314('0x49'))){_0x53e271[_0x0314('0x3e')][_0x1b7cee['id']][_0x3fc295+_0x0314('0x49')]=parseInt(_0x1b7cee[_0x0314('0x48')][_0x3fc295],0xa);}}}_0x53e271['agents'][_0x1b7cee['id']][_0x0314('0x4a')]();return _0x1ba76c({'code':0xc8,'message':_0x53e271['agents'][_0x1b7cee['id']]});}else{return _0x37764f(_0x143d4c['error'](0x1f4,_0x0314('0x4b')));}});},'Agents':function(_0x5521dd){return new Promise(function(_0x42229d){var _0xdc500e=_[_0x0314('0x4c')](_0x53e271[_0x0314('0x3e')]);if(_0x5521dd&&_0x5521dd['id']){var _0x2a7b05=_[_0x0314('0x4d')](_0xdc500e,function(_0x6a4e7f){return _0x6a4e7f['id']===_0x5521dd['id'];});_0x42229d(_0x2a7b05);}else{_0x42229d({'count':_0xdc500e[_0x0314('0x1a')],'rows':_0xdc500e});}});},'ChatQueues':function(){return new Promise(function(_0x4d5b33){var _0x545bd8=[];for(var _0x524fce in _0x53e271[_0x0314('0x4e')]){if(_0x53e271[_0x0314('0x4e')]['hasOwnProperty'](_0x524fce)){var _0x4b59b9=_0x53e271['chatQueues'][_0x524fce];var _0x6f0d19={'id':_0x4b59b9['id'],'available':_0x4b59b9[_0x0314('0x4f')],'loggedIn':_0x4b59b9['loggedIn'],'name':_0x4b59b9[_0x0314('0x50')],'paused':_0x4b59b9[_0x0314('0x51')],'waiting':_0x4b59b9[_0x0314('0x52')]};_0x545bd8[_0x0314('0x23')](_0x6f0d19);}}_0x4d5b33({'count':_0x545bd8[_0x0314('0x1a')],'rows':_0x545bd8});});},'MailQueues':function(){return new Promise(function(_0x88d458){var _0x5f535b=[];for(var _0x41ec80 in _0x53e271[_0x0314('0x53')]){if(_0x53e271[_0x0314('0x53')]['hasOwnProperty'](_0x41ec80)){var _0x1adb61=_0x53e271[_0x0314('0x53')][_0x41ec80];var _0x2cbef3={'id':_0x1adb61['id'],'available':_0x1adb61['available'],'loggedIn':_0x1adb61[_0x0314('0x54')],'name':_0x1adb61[_0x0314('0x50')],'paused':_0x1adb61['paused'],'waiting':_0x1adb61[_0x0314('0x52')]};_0x5f535b[_0x0314('0x23')](_0x2cbef3);}}_0x88d458({'count':_0x5f535b[_0x0314('0x1a')],'rows':_0x5f535b});});},'OpenchannelQueues':function(){return new Promise(function(_0x2d0a38){var _0x27ae18=[];for(var _0x58b22e in _0x53e271[_0x0314('0x55')]){if(_0x53e271[_0x0314('0x55')]['hasOwnProperty'](_0x58b22e)){var _0x58f666=_0x53e271[_0x0314('0x55')][_0x58b22e];var _0x381a5d={'id':_0x58f666['id'],'available':_0x58f666[_0x0314('0x4f')],'loggedIn':_0x58f666[_0x0314('0x54')],'name':_0x58f666[_0x0314('0x50')],'paused':_0x58f666[_0x0314('0x51')],'waiting':_0x58f666[_0x0314('0x52')]};_0x27ae18['push'](_0x381a5d);}}_0x2d0a38({'count':_0x27ae18[_0x0314('0x1a')],'rows':_0x27ae18});});},'SmsQueues':function(){return new Promise(function(_0x1b6cc5){var _0x1cbdd7=[];for(var _0x11fb3f in _0x53e271['smsQueues']){if(_0x53e271[_0x0314('0x56')][_0x0314('0x47')](_0x11fb3f)){var _0x576190=_0x53e271[_0x0314('0x56')][_0x11fb3f];var _0x24a6a5={'id':_0x576190['id'],'available':_0x576190['available'],'loggedIn':_0x576190['loggedIn'],'name':_0x576190[_0x0314('0x50')],'paused':_0x576190[_0x0314('0x51')],'waiting':_0x576190[_0x0314('0x52')]};_0x1cbdd7['push'](_0x24a6a5);}}_0x1b6cc5({'count':_0x1cbdd7['length'],'rows':_0x1cbdd7});});},'FaxQueues':function(){return new Promise(function(_0x31c842){var _0xdb6ce7=[];for(var _0x452ca7 in _0x53e271[_0x0314('0x57')]){if(_0x53e271[_0x0314('0x57')]['hasOwnProperty'](_0x452ca7)){var _0x1e9096=_0x53e271[_0x0314('0x57')][_0x452ca7];var _0x3a8a3c={'id':_0x1e9096['id'],'available':_0x1e9096[_0x0314('0x4f')],'loggedIn':_0x1e9096[_0x0314('0x54')],'name':_0x1e9096[_0x0314('0x50')],'paused':_0x1e9096[_0x0314('0x51')],'waiting':_0x1e9096[_0x0314('0x52')]};_0xdb6ce7[_0x0314('0x23')](_0x3a8a3c);}}_0x31c842({'count':_0xdb6ce7['length'],'rows':_0xdb6ce7});});},'WhatsappQueues':function(){return new Promise(function(_0x907195){var _0x1f1464=[];for(var _0x30b57f in _0x53e271[_0x0314('0x58')]){if(_0x53e271[_0x0314('0x58')][_0x0314('0x47')](_0x30b57f)){var _0x43ae9c=_0x53e271[_0x0314('0x58')][_0x30b57f];var _0x139537={'id':_0x43ae9c['id'],'available':_0x43ae9c[_0x0314('0x4f')],'loggedIn':_0x43ae9c[_0x0314('0x54')],'name':_0x43ae9c['name'],'paused':_0x43ae9c[_0x0314('0x51')],'waiting':_0x43ae9c[_0x0314('0x52')]};_0x1f1464[_0x0314('0x23')](_0x139537);}}_0x907195({'count':_0x1f1464['length'],'rows':_0x1f1464});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xed23ed){var _0x29e115=_[_0x0314('0x4c')](_0x53e271[_0x0314('0x59')]);_0xed23ed({'count':_0x29e115[_0x0314('0x1a')],'rows':_0x29e115});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x987585){var _0x2146d0=_[_0x0314('0x4c')](_0x53e271[_0x0314('0x5a')]);_0x987585({'count':_0x2146d0[_0x0314('0x1a')],'rows':_0x2146d0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1459e0){var _0x54e58a=_[_0x0314('0x4c')](_0x53e271[_0x0314('0x5b')]);_0x1459e0({'count':_0x54e58a[_0x0314('0x1a')],'rows':_0x54e58a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x110212){var _0x2da3db=_['values'](_0x53e271[_0x0314('0x5c')]);_0x110212({'count':_0x2da3db['length'],'rows':_0x2da3db});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3b2b6a){var _0x59d100=_['values'](_0x53e271[_0x0314('0x5d')]);_0x3b2b6a({'count':_0x59d100['length'],'rows':_0x59d100});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x568b6a){var _0x162a48=_[_0x0314('0x4c')](_0x53e271[_0x0314('0x5e')]);_0x568b6a({'count':_0x162a48['length'],'rows':_0x162a48});});}};var _0x1bb95f=jayson[_0x0314('0x5f')](_0x12d026)['http']();_0x1bb95f['on'](_0x0314('0x37'),function(_0x5acfa3){logger[_0x0314('0x37')](JSON[_0x0314('0x60')](_0x5acfa3));return _0x1316a0(_0x5acfa3);});_0x1bb95f[_0x0314('0x13')](0x232c,_0x0314('0x61'),function(){console[_0x0314('0x62')](_0x0314('0x63'),0x232c);return _0xbe0b07('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d36f9ec..e00830c 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 _0x6486=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','jayson/promise','../../../config/logger','client','http','then','error','message','catch','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','true','all','some','info'];(function(_0xea73f,_0x4d4ce7){var _0x7ee2e9=function(_0x11293f){while(--_0x11293f){_0xea73f['push'](_0xea73f['shift']());}};_0x7ee2e9(++_0x4d4ce7);}(_0x6486,0x185));var _0x6648=function(_0x5c7f5d,_0x9f23e9){_0x5c7f5d=_0x5c7f5d-0x0;var _0x2e8991=_0x6486[_0x5c7f5d];return _0x2e8991;};'use strict';var util=require(_0x6648('0x0'));var BPromise=require('bluebird');var jayson=require(_0x6648('0x1'));var _=require('lodash');var logger=require(_0x6648('0x2'))('routing');var client=jayson[_0x6648('0x3')][_0x6648('0x4')]({'port':0x232a});function request(_0x2d3e2e,_0x357bd5){return new BPromise(function(_0x42396c,_0x3a75a6){return client['request'](_0x2d3e2e,_0x357bd5)[_0x6648('0x5')](function(_0x2d52d2){if(_0x2d52d2[_0x6648('0x6')]){return _0x3a75a6(_0x2d52d2[_0x6648('0x6')][_0x6648('0x7')]);}else{return _0x42396c(_0x2d52d2['result']);}})[_0x6648('0x8')](function(_0x162625){return _0x3a75a6(_0x162625);});});}exports['condition']=function(_0xf5883a,_0x56c2b0,_0x3aa70c){return function(_0x308599){if(_0x3aa70c['rules']&&!_0x3aa70c['rules'][_0xf5883a]){logger['info'](_0x6648('0x9'),_0xf5883a);return _0x308599[_0x6648('0xa')]();}var _0x2ecad6=[];for(var _0x3c3684=0x0;_0x3c3684<_0x56c2b0['length'];_0x3c3684+=0x1){_0x2ecad6[_0x6648('0xb')](request(_0x6648('0xc'),{'command':util[_0x6648('0xd')](_0x6648('0xe'),_0x56c2b0[_0x3c3684])})[_0x6648('0x5')](function(_0x219782){return _0x219782&&_0x219782[_0x6648('0x7')]&&_0x219782['message']['indexOf'](_0x6648('0xf'))>=0x0?!![]:![];})[_0x6648('0x8')](function(_0x5b4871){logger[_0x6648('0x6')]('[%s][INTERVAL]\x20%s',_0xf5883a,_0x56c2b0[_0x3c3684]);}));}BPromise[_0x6648('0x10')](_0x2ecad6)[_0x6648('0x5')](function(_0x1b333a){var _0x29b409=_[_0x6648('0x11')](_0x1b333a);logger[_0x6648('0x12')](_0x6648('0x13'),_0xf5883a,_0x56c2b0[_0x6648('0x14')](_0x6648('0x15')),_0x29b409);_0x308599[_0x6648('0x16')](_0x29b409);})[_0x6648('0x8')](function(_0x314932){console['log'](_0x314932);logger[_0x6648('0x6')](_0x6648('0x13'),_0xf5883a,_0x56c2b0[_0x6648('0x14')]('\x20|\x20'),_0x314932[_0x6648('0x17')]);_0x308599['stop']();});};}; \ No newline at end of file +var _0xb42e=['error','message','result','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','then','indexOf','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','log','stack','bluebird','lodash','../../../config/logger','routing','client','http','request'];(function(_0xacf732,_0x103a8a){var _0x3b3518=function(_0x29b2f8){while(--_0x29b2f8){_0xacf732['push'](_0xacf732['shift']());}};_0x3b3518(++_0x103a8a);}(_0xb42e,0x95));var _0xeb42=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xb42e[_0x383356];return _0x32ee5a;};'use strict';var util=require('util');var BPromise=require(_0xeb42('0x0'));var jayson=require('jayson/promise');var _=require(_0xeb42('0x1'));var logger=require(_0xeb42('0x2'))(_0xeb42('0x3'));var client=jayson[_0xeb42('0x4')][_0xeb42('0x5')]({'port':0x232a});function request(_0x25a1cb,_0x506338){return new BPromise(function(_0x5e0982,_0x4c3755){return client[_0xeb42('0x6')](_0x25a1cb,_0x506338)['then'](function(_0x4679d7){if(_0x4679d7[_0xeb42('0x7')]){return _0x4c3755(_0x4679d7[_0xeb42('0x7')][_0xeb42('0x8')]);}else{return _0x5e0982(_0x4679d7[_0xeb42('0x9')]);}})['catch'](function(_0x36f4fd){return _0x4c3755(_0x36f4fd);});});}exports['condition']=function(_0x21ddd6,_0xadee17,_0x26e459){return function(_0x40bbba){if(_0x26e459[_0xeb42('0xa')]&&!_0x26e459['rules'][_0x21ddd6]){logger['info'](_0xeb42('0xb'),_0x21ddd6);return _0x40bbba[_0xeb42('0xc')]();}var _0x86e94a=[];for(var _0x6bd8d8=0x0;_0x6bd8d8<_0xadee17[_0xeb42('0xd')];_0x6bd8d8+=0x1){_0x86e94a['push'](request(_0xeb42('0xe'),{'command':util['format'](_0xeb42('0xf'),_0xadee17[_0x6bd8d8])})[_0xeb42('0x10')](function(_0x2e4fff){return _0x2e4fff&&_0x2e4fff[_0xeb42('0x8')]&&_0x2e4fff[_0xeb42('0x8')][_0xeb42('0x11')]('true')>=0x0?!![]:![];})['catch'](function(_0x33f2f1){logger[_0xeb42('0x7')]('[%s][INTERVAL]\x20%s',_0x21ddd6,_0xadee17[_0x6bd8d8]);}));}BPromise['all'](_0x86e94a)[_0xeb42('0x10')](function(_0x319099){var _0xf4ee0e=_[_0xeb42('0x12')](_0x319099);logger[_0xeb42('0x13')](_0xeb42('0x14'),_0x21ddd6,_0xadee17[_0xeb42('0x15')](_0xeb42('0x16')),_0xf4ee0e);_0x40bbba['when'](_0xf4ee0e);})[_0xeb42('0x17')](function(_0x8039f9){console[_0xeb42('0x18')](_0x8039f9);logger[_0xeb42('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x21ddd6,_0xadee17[_0xeb42('0x15')](_0xeb42('0x16')),_0x8039f9[_0xeb42('0x19')]);_0x40bbba['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b40afd3..37d5f26 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 _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x10b4be,_0x17a0f5){var _0x15fba7=function(_0x1a8edb){while(--_0x1a8edb){_0x10b4be['push'](_0x10b4be['shift']());}};_0x15fba7(++_0x17a0f5);}(_0x96cc,0x16c));var _0xc96c=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0x96cc[_0x5d88c0];return _0x1b40f0;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file +var _0x7af2=['agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','cause','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','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','getVoiceQueueByName','type','agentcomplete','agentacw','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x3ff598,_0x37e3a2){_0x3ff598=_0x3ff598-0x0;var _0x2fe97b=_0x7af2[_0x3ff598];return _0x2fe97b;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var utils=require(_0x27af('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x908794,_0x316e13){utils['info'](util[_0x27af('0x2')](_0x27af('0x3'),_0x908794[_0x27af('0x4')],_0x908794[_0x27af('0x5')],_0x908794[_0x27af('0x6')],_0x908794[_0x27af('0x7')],_0x908794[_0x27af('0x8')],_0x908794[_0x27af('0x9')],_0x908794[_0x27af('0xa')],_0x908794['lastevent']));if(_0x908794[_0x27af('0x6')]){utils[_0x27af('0xb')](_0x908794[_0x27af('0x6')])['then'](function(_0x369a20){if(_0x369a20){_0x908794[_0x27af('0xc')]=_0x369a20[_0x27af('0xc')];_0x908794['agentacw']=_0x908794[_0x27af('0xd')]?_0x369a20['acw']:![];_0x908794['acwtime']=_0x908794[_0x27af('0xe')]?_0x369a20['acwTimeout']:0x0;}utils['request'](_0x27af('0xf'),_0x908794);});}else{utils['request'](_0x27af('0xf'),_0x908794);}if(_0x316e13){delete transfers[_0x908794['uniqueid']];}else{delete agents[_0x908794[_0x27af('0x10')]];}}exports[_0x27af('0x11')]=function(_0x1fd964){try{utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x13'),_0x1fd964[_0x27af('0x4')]),_0x1fd964);agents[_0x1fd964[_0x27af('0x10')]]=_0x1fd964;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x17');agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0xa')]=null;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x18')]=null;utils['info'](util[_0x27af('0x2')](_0x27af('0x19'),_0x1fd964['uniqueid'],agents[_0x1fd964['destuniqueid']][_0x27af('0x7')],_0x1fd964[_0x27af('0x10')]));}catch(_0x351587){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcalled]',_0x1fd964[_0x27af('0x4')]),_0x351587);}};exports[_0x27af('0x1b')]=function(_0xcb4b90){try{if(!_['isNil'](agents[_0xcb4b90[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentringnoanswer]',_0xcb4b90[_0x27af('0x4')]),_0xcb4b90);utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x1d'),_0xcb4b90[_0x27af('0x4')],agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x7')],_0xcb4b90[_0x27af('0x10')]));agents[_0xcb4b90[_0x27af('0x10')]]['agentringnoanswer']=!![];agents[_0xcb4b90['destuniqueid']]['agentringnoanswerAt']=utils[_0x27af('0x15')]();agents[_0xcb4b90['destuniqueid']][_0x27af('0x16')]=_0x27af('0x1e');agents[_0xcb4b90['destuniqueid']][_0x27af('0x1f')]=_0x27af('0x1e');agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x20')]=_0xcb4b90[_0x27af('0x21')]?parseInt(_0xcb4b90[_0x27af('0x21')])/0x3e8:0x0;agents[_0xcb4b90[_0x27af('0x10')]]['talktime']=0x0;unanswered[_0x27af('0x22')](_0xcb4b90[_0x27af('0x10')]);}}catch(_0xadd38e){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x23'),_0xcb4b90[_0x27af('0x4')]),_0xadd38e);}};exports[_0x27af('0x24')]=function(_0x4406e2){try{_[_0x27af('0x25')](agents,function(_0x205e41,_0x4f4955){if(_0x205e41[_0x27af('0x4')]==_0x4406e2[_0x27af('0x4')]&&!_[_0x27af('0x26')](unanswered,_0x205e41[_0x27af('0x10')])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]',_0x4406e2['uniqueid']),_0x4406e2);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4406e2[_0x27af('0x4')],_0x205e41[_0x27af('0x7')],_0x205e41[_0x27af('0x10')]));_0x205e41[_0x27af('0x1b')]=!![];_0x205e41[_0x27af('0x27')]=utils[_0x27af('0x15')]();_0x205e41[_0x27af('0x16')]=_0x27af('0x28');_0x205e41[_0x27af('0x1f')]=_0x27af('0x28');_0x205e41[_0x27af('0x20')]=_0x4406e2['holdtime'];_0x205e41['talktime']=0x0;writeDB(_0x205e41);}});}catch(_0x1de1d0){utils[_0x27af('0x1a')](util['format'](_0x27af('0x29'),_0x4406e2[_0x27af('0x4')]),_0x1de1d0);}};exports['agentconnect']=function(_0x83aa0b){try{if(agents[_0x83aa0b[_0x27af('0x10')]]){utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b['uniqueid']),_0x83aa0b);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x83aa0b['uniqueid'],agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x7')],_0x83aa0b[_0x27af('0x10')]));agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x2b')]=utils[_0x27af('0x15')]();agents[_0x83aa0b['destuniqueid']][_0x27af('0xa')]=_0x83aa0b['connectedlinenum'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x18')]=_0x83aa0b[_0x27af('0x18')];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x20')]=_0x83aa0b['ringtime'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x2c');_[_0x27af('0x25')](agents,function(_0x10c1be,_0x32b558){if(_0x10c1be[_0x27af('0x10')]!=_0x83aa0b[_0x27af('0x10')]&&_0x10c1be[_0x27af('0x4')]==_0x83aa0b[_0x27af('0x4')]){_0x10c1be[_0x27af('0x2d')]=0x0;_0x10c1be[_0x27af('0x20')]=_0x83aa0b[_0x27af('0x21')];_0x10c1be[_0x27af('0x1b')]=!![];_0x10c1be['agentringnoanswerAt']=utils[_0x27af('0x15')]();_0x10c1be[_0x27af('0x16')]=_0x27af('0x2e');_0x10c1be[_0x27af('0x1f')]='answered_elsewhere';_0x10c1be[_0x27af('0x2f')]=_0x83aa0b['destuniqueid'];_0x10c1be['answeredelsewheremembername']=_0x83aa0b[_0x27af('0x7')];writeDB(_0x10c1be);}});}}catch(_0x3c9c81){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b[_0x27af('0x4')]),_0x3c9c81);}};exports[_0x27af('0xd')]=function(_0x26eb28){try{if(!_[_0x27af('0x30')](agents[_0x26eb28[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x26eb28);utils[_0x27af('0x1c')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x26eb28[_0x27af('0x4')],agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x7')],_0x26eb28[_0x27af('0x10')]));agents[_0x26eb28[_0x27af('0x10')]]['agentcomplete']=!![];agents[_0x26eb28[_0x27af('0x10')]]['agentcompleteAt']=utils[_0x27af('0x15')]();agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x2d')]=utils[_0x27af('0x31')](agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x32')],agents[_0x26eb28[_0x27af('0x10')]]['agentconnectAt']);agents[_0x26eb28['destuniqueid']][_0x27af('0x1f')]=_0x26eb28['reason'];agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x33');writeDB(agents[_0x26eb28[_0x27af('0x10')]]);}}catch(_0x37f2fa){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x37f2fa);}};exports[_0x27af('0x34')]=function(_0x20e180){try{if(!_[_0x27af('0x30')](agents[_0x20e180[_0x27af('0x35')]])){utils['debug'](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x20e180);utils['info'](util['format'](_0x27af('0x37'),_0x20e180[_0x27af('0x4')],agents[_0x20e180[_0x27af('0x35')]]['membername'],agents[_0x20e180['transfereruniqueid']][_0x27af('0x4')]));agents[_0x20e180['transfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x39')]=_0x27af('0x3a');agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3b')]=_0x20e180[_0x27af('0x3c')];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3d')]=agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x4')];}}catch(_0x5c02c1){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x5c02c1);}};exports[_0x27af('0x3e')]=function(_0x2ad074){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]',_0x2ad074[_0x27af('0x3f')]),_0x2ad074);if(_0x2ad074['origtransfereruniqueid']==_0x2ad074[_0x27af('0x40')]){if(!_[_0x27af('0x30')](agents[_0x2ad074[_0x27af('0x41')]])){utils['info'](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x7')]));agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x39')]='ATTENDED';agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x42')];agents[_0x2ad074['secondtransfereruniqueid']]['transferuniqueid']=_0x2ad074[_0x27af('0x3f')];}if(_0x2ad074[_0x27af('0x43')]&&agents[_0x2ad074[_0x27af('0x43')]]){agents[_0x2ad074[_0x27af('0x43')]]['agententerreason']=0x1;transfers[_0x2ad074[_0x27af('0x43')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x43')]]);transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x41')]]['calleridnum'];transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x45')];transfers[_0x2ad074['transfereeuniqueid']][_0x27af('0x14')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x2ad074[_0x27af('0x41')]==_0x2ad074[_0x27af('0x46')]){if(!_[_0x27af('0x30')](agents[_0x2ad074['origtransfereruniqueid']])){utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x3f')]]['membername']));agents[_0x2ad074['origtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074[_0x27af('0x3f')]]['transfertype']='ATTENDED';agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x47')];agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3d')]=_0x2ad074[_0x27af('0x41')];}if(_0x2ad074[_0x27af('0x48')]&&agents[_0x2ad074['transfertargetuniqueid']]){agents[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x1;transfers[_0x2ad074[_0x27af('0x48')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x48')]]);transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x9')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x45')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x2;}}}catch(_0x4b0a4){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x4a'),_0x2ad074[_0x27af('0x3f')]),_0x4b0a4);}};exports['hangup']=function(_0x132ed4){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][hangup]',_0x132ed4['uniqueid']),_0x132ed4);if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]===_0x27af('0x1e')){if(_0x132ed4[_0x27af('0x4b')]==='21'){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]='rejected';agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]='rejected';}utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4['uniqueid'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);var _0x5db94f=unanswered[_0x27af('0x4c')](_0x132ed4[_0x27af('0x4')]);if(_0x5db94f>-0x1){unanswered[_0x27af('0x4d')](_0x5db94f,0x1);}}if(transfers[_0x132ed4[_0x27af('0x4')]]){transfers[_0x132ed4['uniqueid']]['agentcomplete']=!![];transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')]=utils[_0x27af('0x15')]();transfers[_0x132ed4[_0x27af('0x4')]]['talktime']=utils['diffTime'](transfers[_0x132ed4['uniqueid']][_0x27af('0x32')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]);transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]=_0x27af('0x4e');transfers[_0x132ed4['uniqueid']]['lastevent']=_0x27af('0x33');utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x4f'),_0x132ed4['uniqueid'],transfers[_0x132ed4['uniqueid']][_0x27af('0x7')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(transfers[_0x132ed4[_0x27af('0x4')]],!![]);}if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0xd')]=!![];agents[_0x132ed4['uniqueid']][_0x27af('0x32')]=utils[_0x27af('0x15')]();agents[_0x132ed4[_0x27af('0x4')]]['talktime']=utils[_0x27af('0x31')](agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')],agents[_0x132ed4['uniqueid']][_0x27af('0x2b')]);agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]=agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x38')]?_0x27af('0x38'):_0x27af('0x4e');agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]=_0x27af('0x33');utils['info'](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4[_0x27af('0x4')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4['uniqueid']]['reason'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);}}catch(_0x48c7eb){utils['error'](util['format'](_0x27af('0x50'),_0x132ed4[_0x27af('0x4')]),_0x48c7eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a7e7d93..d34b892 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 _0x8ac9=['[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','diffTime','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','variable','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lastdata','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','linkedid','OutgoingSpoolFailed'];(function(_0x1657e1,_0x63ed04){var _0x4c3e3d=function(_0x276bff){while(--_0x276bff){_0x1657e1['push'](_0x1657e1['shift']());}};_0x4c3e3d(++_0x63ed04);}(_0x8ac9,0x199));var _0x98ac=function(_0x5b0df1,_0x117bed){_0x5b0df1=_0x5b0df1-0x0;var _0x453c9c=_0x8ac9[_0x5b0df1];return _0x453c9c;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var utils=require(_0x98ac('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x98ac('0x3'),_0x98ac('0x3'),_0x98ac('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x98ac('0x5'),_0x98ac('0x6'),_0x98ac('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x3b3780){var _0x1702d6;if(transfers[_0x98ac('0x7')][_0x3b3780[_0x98ac('0x8')]]){_0x1702d6=_0x3b3780[_0x98ac('0x8')];_0x3b3780[_0x98ac('0x8')]=transfers['blinds'][_0x3b3780[_0x98ac('0x8')]]['transfereeuniqueid'];}utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0xb'),_0x3b3780[_0x98ac('0x8')],_0x3b3780[_0x98ac('0xc')],_0x3b3780[_0x98ac('0xd')],_0x3b3780[_0x98ac('0xe')],_0x3b3780['interface'],_0x3b3780['calleridnum'],_0x3b3780[_0x98ac('0xf')],_0x3b3780[_0x98ac('0x10')]));if(_0x3b3780[_0x98ac('0x11')]){utils[_0x98ac('0x12')](_0x3b3780['accountcode'])[_0x98ac('0x13')](function(_0x265286){if(_0x265286){_0x3b3780[_0x98ac('0x14')]=_0x265286['id'];}utils['request']('CreateVoiceCallReport',_0x3b3780);});}else{utils[_0x98ac('0x15')](_0x98ac('0x16'),_0x3b3780);}if(channels[_0x3b3780['uniqueid']]){delete channels[_0x3b3780['uniqueid']];}else if(_0x1702d6&&channels[_0x1702d6]){if(!transfers['blinds'][_0x1702d6][_0x98ac('0x17')])delete transfers[_0x98ac('0x7')][_0x1702d6];delete channels[_0x1702d6];}}exports['newchannel']=function(_0x4129bd){try{utils[_0x98ac('0x18')](util[_0x98ac('0xa')]('[%s][calls][newchannel]',_0x4129bd[_0x98ac('0x8')]),_0x4129bd);if(_0x4129bd[_0x98ac('0x8')]==_0x4129bd[_0x98ac('0x19')]&&_0x4129bd['channel']!=_0x98ac('0x1a')){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x1b'),_0x4129bd['uniqueid'],_0x4129bd['context'],_0x4129bd[_0x98ac('0x1c')]));channels[_0x4129bd[_0x98ac('0x8')]]={'uniqueid':_0x4129bd[_0x98ac('0x8')],'accountcode':_0x4129bd[_0x98ac('0x11')],'source':_0x4129bd[_0x98ac('0x1d')],'destination':_0x4129bd[_0x98ac('0x1c')],'destinationcontext':_0x4129bd[_0x98ac('0x1e')],'channel':_0x4129bd[_0x98ac('0xc')],'starttime':utils[_0x98ac('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x98ac('0x20')};}}catch(_0x11233e){utils['error'](util[_0x98ac('0xa')](_0x98ac('0x21'),_0x4129bd['uniqueid']),_0x11233e);}};exports[_0x98ac('0x22')]=function(_0x37f6f8){try{utils[_0x98ac('0x18')](util['format'](_0x98ac('0x23'),_0x37f6f8[_0x98ac('0x8')]),_0x37f6f8);if(!_[_0x98ac('0x24')](channels[_0x37f6f8[_0x98ac('0x8')]])&&_0x37f6f8[_0x98ac('0x25')]==0x6){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x26'),_0x37f6f8[_0x98ac('0x8')],_0x37f6f8[_0x98ac('0x1e')],_0x37f6f8['channel']));if(_[_0x98ac('0x24')](channels[_0x37f6f8[_0x98ac('0x8')]][_0x98ac('0x27')])){channels[_0x37f6f8[_0x98ac('0x8')]][_0x98ac('0x27')]=utils[_0x98ac('0x1f')]();}}else if(!_[_0x98ac('0x24')](channels[_0x37f6f8['linkedid']])&&_0x37f6f8['channelstate']==0x6&&_0x37f6f8[_0x98ac('0x1e')]!=_0x98ac('0x28')){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x29'),_0x37f6f8[_0x98ac('0x8')],_0x37f6f8[_0x98ac('0x19')],_0x37f6f8[_0x98ac('0x1e')],_0x37f6f8[_0x98ac('0xc')]));channels[_0x37f6f8[_0x98ac('0x19')]]['accountcode']=_0x37f6f8['accountcode'];channels[_0x37f6f8[_0x98ac('0x19')]]['destinationchannel']=_0x37f6f8[_0x98ac('0xc')];if(_['isNil'](channels[_0x37f6f8[_0x98ac('0x19')]][_0x98ac('0x2a')])){channels[_0x37f6f8['linkedid']][_0x98ac('0x2a')]=utils['now']();}channels[_0x37f6f8[_0x98ac('0x19')]][_0x98ac('0x2b')]=dispositions[_[_0x98ac('0x2c')](_0x37f6f8[_0x98ac('0x25')])]||_0x98ac('0x5');}}catch(_0x20ef04){utils[_0x98ac('0x2d')](util[_0x98ac('0xa')]('[%s][calls][newstate]',_0x37f6f8[_0x98ac('0x8')]),_0x20ef04);}};exports[_0x98ac('0x2e')]=function(_0x23c958){try{if(!_[_0x98ac('0x24')](channels[_0x23c958[_0x98ac('0x8')]])){utils[_0x98ac('0x18')](util[_0x98ac('0xa')](_0x98ac('0x2f'),_0x23c958[_0x98ac('0x8')]),_0x23c958);if(_[_0x98ac('0x24')](channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x30')])){channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x30')]=_0x23c958[_0x98ac('0x31')]+'\x20<'+_0x23c958['calleridnum']+'>';}utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x32'),_0x23c958[_0x98ac('0x8')],channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x30')],_0x23c958[_0x98ac('0x33')]));channels[_0x23c958[_0x98ac('0x8')]]['endtime']=utils[_0x98ac('0x1f')]();channels[_0x23c958['uniqueid']][_0x98ac('0x34')]=utils['diffTime'](channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x35')],channels[_0x23c958[_0x98ac('0x8')]]['starttime']);channels[_0x23c958['uniqueid']][_0x98ac('0x36')]=channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x2a')]?utils['diffTime'](channels[_0x23c958[_0x98ac('0x8')]]['endtime'],channels[_0x23c958[_0x98ac('0x8')]][_0x98ac('0x2a')]):0x0;writeDB(channels[_0x23c958[_0x98ac('0x8')]]);}}catch(_0x3df80f){utils[_0x98ac('0x2d')](util['format'](_0x98ac('0x2f'),_0x23c958[_0x98ac('0x8')]),_0x3df80f);}};exports['attendedtransfer']=function(_0x11d104){try{if(!_[_0x98ac('0x24')](channels[_0x11d104[_0x98ac('0x37')]])){utils[_0x98ac('0x18')](util[_0x98ac('0xa')](_0x98ac('0x38'),_0x11d104[_0x98ac('0x39')]),_0x11d104);if(channels[_0x11d104[_0x98ac('0x37')]]['channel']==_0x11d104[_0x98ac('0x3a')]){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x3b'),_0x11d104[_0x98ac('0x39')],_0x11d104[_0x98ac('0x37')],_0x11d104[_0x98ac('0x3c')]));channels[_0x11d104[_0x98ac('0x37')]][_0x98ac('0x3d')]=_0x11d104['secondtransfererchannel'];channels[_0x11d104[_0x98ac('0x37')]][_0x98ac('0x3e')]=_0x98ac('0x3f');}else if(channels[_0x11d104[_0x98ac('0x37')]][_0x98ac('0xc')]=_0x11d104[_0x98ac('0x40')]){utils['info'](util[_0x98ac('0xa')](_0x98ac('0x3b'),_0x11d104[_0x98ac('0x39')],_0x11d104[_0x98ac('0x37')],_0x11d104[_0x98ac('0x41')]));channels[_0x11d104[_0x98ac('0x37')]][_0x98ac('0x3d')]=_0x11d104[_0x98ac('0x41')];channels[_0x11d104['localtwolinkedid']][_0x98ac('0x3e')]=_0x98ac('0x3f');}}}catch(_0x5cbb32){utils[_0x98ac('0x2d')](util[_0x98ac('0xa')](_0x98ac('0x38'),_0x11d104[_0x98ac('0x39')]),_0x5cbb32);}};exports[_0x98ac('0x42')]=function(_0x28711f){try{if(!_['isNil'](channels[_0x28711f['uniqueid']])){utils[_0x98ac('0x18')](util[_0x98ac('0xa')](_0x98ac('0x43'),_0x28711f[_0x98ac('0x8')]),_0x28711f);channels[_0x28711f[_0x98ac('0x8')]][_0x98ac('0x44')]=utils[_0x98ac('0x1f')]();utils['info'](util[_0x98ac('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x28711f[_0x98ac('0x8')],channels[_0x28711f[_0x98ac('0x8')]]['musiconholdstartAt']));}}catch(_0xc43224){utils[_0x98ac('0x2d')](util['format'](_0x98ac('0x43'),_0x28711f['uniqueid']),_0xc43224);}};exports[_0x98ac('0x45')]=function(_0x34a7c){try{if(!_[_0x98ac('0x24')](channels[_0x34a7c['uniqueid']])){utils['debug'](util['format'](_0x98ac('0x46'),_0x34a7c['uniqueid']),_0x34a7c);if(!_[_0x98ac('0x24')](channels[_0x34a7c[_0x98ac('0x8')]][_0x98ac('0x44')])){channels[_0x34a7c[_0x98ac('0x8')]]['mohtime']+=utils[_0x98ac('0x47')](utils[_0x98ac('0x1f')](),channels[_0x34a7c[_0x98ac('0x8')]][_0x98ac('0x44')]);utils['info'](util[_0x98ac('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x34a7c[_0x98ac('0x8')],channels[_0x34a7c[_0x98ac('0x8')]]['mohtime']));delete channels[_0x34a7c[_0x98ac('0x8')]][_0x98ac('0x44')];}}}catch(_0x5cee48){utils['error'](util[_0x98ac('0xa')](_0x98ac('0x46'),_0x34a7c[_0x98ac('0x8')]),_0x5cee48);}};exports['varset']=function(_0x3bef47){try{if(!_[_0x98ac('0x24')](channels[_0x3bef47[_0x98ac('0x8')]])){utils[_0x98ac('0x18')](util['format'](_0x98ac('0x48'),_0x3bef47[_0x98ac('0x8')]),_0x3bef47);if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x49')])){utils[_0x98ac('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3bef47[_0x98ac('0x8')],_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0x4b')]=_0x3bef47[_0x98ac('0x4a')];}if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x4c')])){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x4d'),_0x3bef47[_0x98ac('0x8')],_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]]['destination']=_0x3bef47[_0x98ac('0x4a')];channels[_0x3bef47[_0x98ac('0x8')]]['callerid']='\x22'+_0x3bef47['value']+_0x98ac('0x4e')+_0x3bef47[_0x98ac('0x4a')]+'>';}if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x4f')])||!_[_0x98ac('0x24')](_0x3bef47[_0x98ac('0x50')]['xmd-callerid'])){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x51'),_0x3bef47[_0x98ac('0x8')],!_[_0x98ac('0x24')](_0x3bef47[_0x98ac('0x50')][_0x98ac('0x4f')])?_0x98ac('0x4f'):_0x98ac('0x52'),_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0x30')]=_0x3bef47[_0x98ac('0x4a')];}if(!_[_0x98ac('0x24')](_0x3bef47[_0x98ac('0x50')]['xmd-queue'])||!_[_0x98ac('0x24')](_0x3bef47[_0x98ac('0x50')][_0x98ac('0x53')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3bef47[_0x98ac('0x8')],!_[_0x98ac('0x24')](_0x3bef47[_0x98ac('0x50')][_0x98ac('0x54')])?_0x98ac('0x54'):_0x98ac('0x53'),_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]]['lastapplication']=_0x98ac('0x55');channels[_0x3bef47[_0x98ac('0x8')]]['lastdata']=_0x3bef47[_0x98ac('0x4a')];channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0xd')]=!![];}if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x56')])){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x57'),_0x3bef47[_0x98ac('0x8')],_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0x58')]=_0x3bef47[_0x98ac('0x4a')];}if(!_['isNil'](_0x3bef47[_0x98ac('0x50')][_0x98ac('0x59')])){utils[_0x98ac('0x9')](util[_0x98ac('0xa')](_0x98ac('0x5a'),_0x3bef47['uniqueid'],_0x3bef47[_0x98ac('0x4a')]));channels[_0x3bef47[_0x98ac('0x8')]]['type']=_0x3bef47[_0x98ac('0x4a')];}if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x5b')])){utils['info'](util['format'](_0x98ac('0x5c'),_0x3bef47[_0x98ac('0x8')],_0x3bef47['value']));channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0x5d')]=_0x3bef47['value'];}if(!_[_0x98ac('0x24')](_0x3bef47['variable'][_0x98ac('0x5e')])){utils['info'](util[_0x98ac('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3bef47[_0x98ac('0x8')],_0x3bef47['value']));channels[_0x3bef47[_0x98ac('0x8')]][_0x98ac('0x5e')]=_0x3bef47[_0x98ac('0x4a')];}}}catch(_0x5ac7bc){utils[_0x98ac('0x2d')](util['format'](_0x98ac('0x48'),_0x3bef47[_0x98ac('0x8')]),_0x5ac7bc);}};exports['newexten']=function(_0xba0a28){try{if(!_[_0x98ac('0x24')](channels[_0xba0a28[_0x98ac('0x8')]])){utils[_0x98ac('0x18')](util[_0x98ac('0xa')]('[%s][calls][newexten]',_0xba0a28['uniqueid']),_0xba0a28);utils[_0x98ac('0x9')](util['format'](_0x98ac('0x5f'),_0xba0a28[_0x98ac('0x8')],_0xba0a28[_0x98ac('0x60')],_0xba0a28[_0x98ac('0x61')]));if(_0xba0a28[_0x98ac('0x60')]['toLowerCase']()==_0x98ac('0x62')&&_[_0x98ac('0x63')](_0xba0a28[_0x98ac('0x61')]['toLowerCase'](),_0x98ac('0x64'))){var _0x104ba=_0xba0a28[_0x98ac('0x61')][_0x98ac('0x65')]('=');var _0x2e9695=_0x104ba[0x0][_0x98ac('0x66')](_0x104ba[0x0][_0x98ac('0x67')]('(')+0x1,_0x104ba[0x0][_0x98ac('0x67')](')'));var _0x23f3dd=_0x104ba[0x1];channels[_0xba0a28['uniqueid']][_0x2e9695]=_0x23f3dd;}if(!_[_0x98ac('0x68')]([_0x98ac('0x2e'),_0x98ac('0x69'),'execif',_0x98ac('0x62'),_0x98ac('0x6a')],_0xba0a28[_0x98ac('0x60')]['toLowerCase']())){channels[_0xba0a28[_0x98ac('0x8')]]['lastapplication']=_0xba0a28[_0x98ac('0x60')];channels[_0xba0a28[_0x98ac('0x8')]][_0x98ac('0x6b')]=_0xba0a28[_0x98ac('0x61')];}}}catch(_0x12732b){utils[_0x98ac('0x2d')](util[_0x98ac('0xa')](_0x98ac('0x6c'),_0xba0a28[_0x98ac('0x8')]),_0x12732b);}}; \ No newline at end of file +var _0xf6fa=['mohtime','varset','[%s][calls][varset]','variable','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','application','toLowerCase','cdr','appdata','substring','includes','hangup','noop','execif','set','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','UserId','CreateVoiceCallReport','request','recording','debug','format','[%s][calls][newchannel]','linkedid','context','exten','accountcode','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x2a5755,_0x17f587){var _0x1700da=function(_0x40c908){while(--_0x40c908){_0x2a5755['push'](_0x2a5755['shift']());}};_0x1700da(++_0x17f587);}(_0xf6fa,0x87));var _0xaf6f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf6fa[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xaf6f('0x0'));var utils=require('./utils');var transfers=require(_0xaf6f('0x1'));var dispositions=[_0xaf6f('0x2'),_0xaf6f('0x3'),'FAILED','NO\x20ANSWER',_0xaf6f('0x2'),_0xaf6f('0x2'),_0xaf6f('0x4'),_0xaf6f('0x5'),_0xaf6f('0x3'),_0xaf6f('0x3'),_0xaf6f('0x3')];var channels={};function writeDB(_0x2e1eb8){var _0x290271;if(transfers[_0xaf6f('0x6')][_0x2e1eb8['uniqueid']]){_0x290271=_0x2e1eb8[_0xaf6f('0x7')];_0x2e1eb8[_0xaf6f('0x7')]=transfers[_0xaf6f('0x6')][_0x2e1eb8[_0xaf6f('0x7')]][_0xaf6f('0x8')];}utils[_0xaf6f('0x9')](util['format'](_0xaf6f('0xa'),_0x2e1eb8[_0xaf6f('0x7')],_0x2e1eb8[_0xaf6f('0xb')],_0x2e1eb8[_0xaf6f('0xc')],_0x2e1eb8['membername'],_0x2e1eb8['interface'],_0x2e1eb8[_0xaf6f('0xd')],_0x2e1eb8[_0xaf6f('0xe')],_0x2e1eb8[_0xaf6f('0xf')]));if(_0x2e1eb8['accountcode']){utils['getUserByInternal'](_0x2e1eb8['accountcode'])['then'](function(_0x4073cc){if(_0x4073cc){_0x2e1eb8[_0xaf6f('0x10')]=_0x4073cc['id'];}utils['request'](_0xaf6f('0x11'),_0x2e1eb8);});}else{utils[_0xaf6f('0x12')](_0xaf6f('0x11'),_0x2e1eb8);}if(channels[_0x2e1eb8[_0xaf6f('0x7')]]){delete channels[_0x2e1eb8['uniqueid']];}else if(_0x290271&&channels[_0x290271]){if(!transfers[_0xaf6f('0x6')][_0x290271][_0xaf6f('0x13')])delete transfers[_0xaf6f('0x6')][_0x290271];delete channels[_0x290271];}}exports['newchannel']=function(_0x194c11){try{utils[_0xaf6f('0x14')](util[_0xaf6f('0x15')](_0xaf6f('0x16'),_0x194c11[_0xaf6f('0x7')]),_0x194c11);if(_0x194c11[_0xaf6f('0x7')]==_0x194c11[_0xaf6f('0x17')]&&_0x194c11[_0xaf6f('0xb')]!='OutgoingSpoolFailed'){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x194c11[_0xaf6f('0x7')],_0x194c11[_0xaf6f('0x18')],_0x194c11[_0xaf6f('0x19')]));channels[_0x194c11[_0xaf6f('0x7')]]={'uniqueid':_0x194c11[_0xaf6f('0x7')],'accountcode':_0x194c11[_0xaf6f('0x1a')],'source':_0x194c11['calleridnum'],'destination':_0x194c11['exten'],'destinationcontext':_0x194c11[_0xaf6f('0x18')],'channel':_0x194c11[_0xaf6f('0xb')],'starttime':utils[_0xaf6f('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xaf6f('0x2'),'amaflags':_0xaf6f('0x1c')};}}catch(_0x3fcb5f){utils[_0xaf6f('0x1d')](util[_0xaf6f('0x15')]('[%s][calls][newchannel]',_0x194c11[_0xaf6f('0x7')]),_0x3fcb5f);}};exports[_0xaf6f('0x1e')]=function(_0x30bc20){try{utils[_0xaf6f('0x14')](util[_0xaf6f('0x15')](_0xaf6f('0x1f'),_0x30bc20[_0xaf6f('0x7')]),_0x30bc20);if(!_[_0xaf6f('0x20')](channels[_0x30bc20[_0xaf6f('0x7')]])&&_0x30bc20[_0xaf6f('0x21')]==0x6){utils['info'](util[_0xaf6f('0x15')](_0xaf6f('0x22'),_0x30bc20[_0xaf6f('0x7')],_0x30bc20['context'],_0x30bc20[_0xaf6f('0xb')]));if(_[_0xaf6f('0x20')](channels[_0x30bc20[_0xaf6f('0x7')]]['systemanswertime'])){channels[_0x30bc20[_0xaf6f('0x7')]]['systemanswertime']=utils[_0xaf6f('0x1b')]();}}else if(!_[_0xaf6f('0x20')](channels[_0x30bc20['linkedid']])&&_0x30bc20[_0xaf6f('0x21')]==0x6&&_0x30bc20[_0xaf6f('0x18')]!=_0xaf6f('0x23')){utils['info'](util[_0xaf6f('0x15')](_0xaf6f('0x24'),_0x30bc20[_0xaf6f('0x7')],_0x30bc20[_0xaf6f('0x17')],_0x30bc20['context'],_0x30bc20['channel']));channels[_0x30bc20[_0xaf6f('0x17')]][_0xaf6f('0x1a')]=_0x30bc20[_0xaf6f('0x1a')];channels[_0x30bc20['linkedid']][_0xaf6f('0x25')]=_0x30bc20[_0xaf6f('0xb')];if(_['isNil'](channels[_0x30bc20['linkedid']][_0xaf6f('0x26')])){channels[_0x30bc20[_0xaf6f('0x17')]][_0xaf6f('0x26')]=utils['now']();}channels[_0x30bc20[_0xaf6f('0x17')]]['disposition']=dispositions[_[_0xaf6f('0x27')](_0x30bc20[_0xaf6f('0x21')])]||_0xaf6f('0x4');}}catch(_0x4408bd){utils[_0xaf6f('0x1d')](util[_0xaf6f('0x15')]('[%s][calls][newstate]',_0x30bc20[_0xaf6f('0x7')]),_0x4408bd);}};exports['hangup']=function(_0x1143b3){try{if(!_[_0xaf6f('0x20')](channels[_0x1143b3[_0xaf6f('0x7')]])){utils[_0xaf6f('0x14')](util[_0xaf6f('0x15')]('[%s][calls][hangup]',_0x1143b3['uniqueid']),_0x1143b3);if(_[_0xaf6f('0x20')](channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x28')])){channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x28')]=_0x1143b3[_0xaf6f('0x29')]+'\x20<'+_0x1143b3[_0xaf6f('0xd')]+'>';}utils[_0xaf6f('0x9')](util['format'](_0xaf6f('0x2a'),_0x1143b3[_0xaf6f('0x7')],channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x28')],_0x1143b3[_0xaf6f('0x2b')]));channels[_0x1143b3[_0xaf6f('0x7')]]['endtime']=utils[_0xaf6f('0x1b')]();channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x2c')]=utils['diffTime'](channels[_0x1143b3['uniqueid']][_0xaf6f('0x2d')],channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x2e')]);channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x2f')]=channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x26')]?utils['diffTime'](channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x2d')],channels[_0x1143b3[_0xaf6f('0x7')]][_0xaf6f('0x26')]):0x0;writeDB(channels[_0x1143b3[_0xaf6f('0x7')]]);}}catch(_0x3c6495){utils[_0xaf6f('0x1d')](util['format'](_0xaf6f('0x30'),_0x1143b3[_0xaf6f('0x7')]),_0x3c6495);}};exports[_0xaf6f('0x31')]=function(_0xea60ac){try{if(!_[_0xaf6f('0x20')](channels[_0xea60ac[_0xaf6f('0x32')]])){utils['debug'](util[_0xaf6f('0x15')](_0xaf6f('0x33'),_0xea60ac['origtransfereruniqueid']),_0xea60ac);if(channels[_0xea60ac[_0xaf6f('0x32')]][_0xaf6f('0xb')]==_0xea60ac[_0xaf6f('0x34')]){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xea60ac[_0xaf6f('0x35')],_0xea60ac[_0xaf6f('0x32')],_0xea60ac[_0xaf6f('0x36')]));channels[_0xea60ac[_0xaf6f('0x32')]][_0xaf6f('0x25')]=_0xea60ac[_0xaf6f('0x36')];channels[_0xea60ac['localtwolinkedid']][_0xaf6f('0x37')]='_attended';}else if(channels[_0xea60ac[_0xaf6f('0x32')]][_0xaf6f('0xb')]=_0xea60ac[_0xaf6f('0x38')]){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')](_0xaf6f('0x39'),_0xea60ac['origtransfereruniqueid'],_0xea60ac['localtwolinkedid'],_0xea60ac[_0xaf6f('0x3a')]));channels[_0xea60ac[_0xaf6f('0x32')]][_0xaf6f('0x25')]=_0xea60ac[_0xaf6f('0x3a')];channels[_0xea60ac[_0xaf6f('0x32')]][_0xaf6f('0x37')]=_0xaf6f('0x3b');}}}catch(_0x51f6c5){utils[_0xaf6f('0x1d')](util['format'](_0xaf6f('0x33'),_0xea60ac[_0xaf6f('0x35')]),_0x51f6c5);}};exports['musiconholdstart']=function(_0x4b4517){try{if(!_[_0xaf6f('0x20')](channels[_0x4b4517['uniqueid']])){utils[_0xaf6f('0x14')](util[_0xaf6f('0x15')](_0xaf6f('0x3c'),_0x4b4517[_0xaf6f('0x7')]),_0x4b4517);channels[_0x4b4517['uniqueid']][_0xaf6f('0x3d')]=utils[_0xaf6f('0x1b')]();utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')](_0xaf6f('0x3e'),_0x4b4517[_0xaf6f('0x7')],channels[_0x4b4517[_0xaf6f('0x7')]]['musiconholdstartAt']));}}catch(_0xa799a9){utils[_0xaf6f('0x1d')](util[_0xaf6f('0x15')](_0xaf6f('0x3c'),_0x4b4517[_0xaf6f('0x7')]),_0xa799a9);}};exports[_0xaf6f('0x3f')]=function(_0x2eca06){try{if(!_[_0xaf6f('0x20')](channels[_0x2eca06[_0xaf6f('0x7')]])){utils['debug'](util[_0xaf6f('0x15')](_0xaf6f('0x40'),_0x2eca06[_0xaf6f('0x7')]),_0x2eca06);if(!_[_0xaf6f('0x20')](channels[_0x2eca06[_0xaf6f('0x7')]][_0xaf6f('0x3d')])){channels[_0x2eca06[_0xaf6f('0x7')]][_0xaf6f('0x41')]+=utils['diffTime'](utils[_0xaf6f('0x1b')](),channels[_0x2eca06[_0xaf6f('0x7')]][_0xaf6f('0x3d')]);utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2eca06[_0xaf6f('0x7')],channels[_0x2eca06['uniqueid']][_0xaf6f('0x41')]));delete channels[_0x2eca06[_0xaf6f('0x7')]][_0xaf6f('0x3d')];}}}catch(_0x4a28e4){utils[_0xaf6f('0x1d')](util[_0xaf6f('0x15')]('[%s][calls][musiconholdstop]',_0x2eca06[_0xaf6f('0x7')]),_0x4a28e4);}};exports[_0xaf6f('0x42')]=function(_0x598b3d){try{if(!_[_0xaf6f('0x20')](channels[_0x598b3d['uniqueid']])){utils[_0xaf6f('0x14')](util[_0xaf6f('0x15')](_0xaf6f('0x43'),_0x598b3d['uniqueid']),_0x598b3d);if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')]['xmd-originatecalleridnum'])){utils['info'](util[_0xaf6f('0x15')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x598b3d[_0xaf6f('0x7')],_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]]['source']=_0x598b3d[_0xaf6f('0x45')];}if(!_['isNil'](_0x598b3d['variable']['xmd-phone'])){utils['info'](util[_0xaf6f('0x15')](_0xaf6f('0x46'),_0x598b3d['uniqueid'],_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x47')]=_0x598b3d[_0xaf6f('0x45')];channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x28')]='\x22'+_0x598b3d[_0xaf6f('0x45')]+_0xaf6f('0x48')+_0x598b3d[_0xaf6f('0x45')]+'>';}if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x49')])||!_['isNil'](_0x598b3d[_0xaf6f('0x44')]['xmd-callerid'])){utils[_0xaf6f('0x9')](util['format'](_0xaf6f('0x4a'),_0x598b3d[_0xaf6f('0x7')],!_['isNil'](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x49')])?'xmd-callerid-preview':'xmd-callerid',_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x28')]=_0x598b3d[_0xaf6f('0x45')];}if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x4b')])||!_['isNil'](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x4c')])){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')](_0xaf6f('0x4a'),_0x598b3d[_0xaf6f('0x7')],!_[_0xaf6f('0x20')](_0x598b3d['variable']['xmd-queue'])?_0xaf6f('0x4b'):_0xaf6f('0x4c'),_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d['uniqueid']][_0xaf6f('0x4d')]='Queue';channels[_0x598b3d['uniqueid']][_0xaf6f('0x4e')]=_0x598b3d[_0xaf6f('0x45')];channels[_0x598b3d['uniqueid']][_0xaf6f('0xc')]=!![];}if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x4f')])){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')](_0xaf6f('0x50'),_0x598b3d[_0xaf6f('0x7')],_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x51')]=_0x598b3d[_0xaf6f('0x45')];}if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x52')])){utils[_0xaf6f('0x9')](util['format'](_0xaf6f('0x53'),_0x598b3d[_0xaf6f('0x7')],_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x54')]=_0x598b3d['value'];}if(!_['isNil'](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x55')])){utils[_0xaf6f('0x9')](util['format'](_0xaf6f('0x56'),_0x598b3d[_0xaf6f('0x7')],_0x598b3d[_0xaf6f('0x45')]));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x57')]=_0x598b3d[_0xaf6f('0x45')];}if(!_[_0xaf6f('0x20')](_0x598b3d[_0xaf6f('0x44')][_0xaf6f('0x58')])){utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x598b3d[_0xaf6f('0x7')],_0x598b3d['value']));channels[_0x598b3d[_0xaf6f('0x7')]][_0xaf6f('0x58')]=_0x598b3d[_0xaf6f('0x45')];}}}catch(_0x36403f){utils[_0xaf6f('0x1d')](util['format'](_0xaf6f('0x43'),_0x598b3d[_0xaf6f('0x7')]),_0x36403f);}};exports['newexten']=function(_0xed813b){try{if(!_[_0xaf6f('0x20')](channels[_0xed813b[_0xaf6f('0x7')]])){utils['debug'](util[_0xaf6f('0x15')](_0xaf6f('0x59'),_0xed813b[_0xaf6f('0x7')]),_0xed813b);utils[_0xaf6f('0x9')](util[_0xaf6f('0x15')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xed813b['uniqueid'],_0xed813b[_0xaf6f('0x5a')],_0xed813b['appdata']));if(_0xed813b[_0xaf6f('0x5a')]['toLowerCase']()=='set'&&_['startsWith'](_0xed813b['appdata'][_0xaf6f('0x5b')](),_0xaf6f('0x5c'))){var _0x15e627=_0xed813b[_0xaf6f('0x5d')]['split']('=');var _0x159497=_0x15e627[0x0][_0xaf6f('0x5e')](_0x15e627[0x0]['lastIndexOf']('(')+0x1,_0x15e627[0x0]['lastIndexOf'](')'));var _0x5ce48a=_0x15e627[0x1];channels[_0xed813b[_0xaf6f('0x7')]][_0x159497]=_0x5ce48a;}if(!_[_0xaf6f('0x5f')]([_0xaf6f('0x60'),_0xaf6f('0x61'),_0xaf6f('0x62'),_0xaf6f('0x63'),'gotoif'],_0xed813b[_0xaf6f('0x5a')][_0xaf6f('0x5b')]())){channels[_0xed813b[_0xaf6f('0x7')]][_0xaf6f('0x4d')]=_0xed813b[_0xaf6f('0x5a')];channels[_0xed813b['uniqueid']][_0xaf6f('0x4e')]=_0xed813b[_0xaf6f('0x5d')];}}}catch(_0x392ae0){utils['error'](util[_0xaf6f('0x15')](_0xaf6f('0x59'),_0xed813b[_0xaf6f('0x7')]),_0x392ae0);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3e87cd4..95f8a8b 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 _0x52bc=['error','close','[core]\x20close','managerevent','[core]\x20connected','info','[core]\x20shutdown'];(function(_0x29aa36,_0x56d895){var _0x37815e=function(_0x59c2f1){while(--_0x59c2f1){_0x29aa36['push'](_0x29aa36['shift']());}};_0x37815e(++_0x56d895);}(_0x52bc,0xf9));var _0xc52b=function(_0x5252b1,_0xa866cc){_0x5252b1=_0x5252b1-0x0;var _0x253fd0=_0x52bc[_0x5252b1];return _0x253fd0;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info'](_0xc52b('0x0'));};exports['shutdown']=function(){utils[_0xc52b('0x1')](_0xc52b('0x2'));};exports['fullybooted']=function(){utils[_0xc52b('0x1')]('[core]\x20fullybooted');};exports[_0xc52b('0x3')]=function(_0x50c9d5){utils['error']('[core]\x20error',_0x50c9d5);};exports[_0xc52b('0x4')]=function(){utils[_0xc52b('0x1')](_0xc52b('0x5'));};exports[_0xc52b('0x6')]=function(_0xbd712b){}; \ No newline at end of file +var _0x059b=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','managerevent','connect','info','[core]\x20connected'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x059b,0x75));var _0xb059=function(_0xfe7986,_0xf15623){_0xfe7986=_0xfe7986-0x0;var _0xca7128=_0x059b[_0xfe7986];return _0xca7128;};'use strict';var utils=require('./utils');exports[_0xb059('0x0')]=function(){utils[_0xb059('0x1')](_0xb059('0x2'));};exports[_0xb059('0x3')]=function(){utils[_0xb059('0x1')](_0xb059('0x4'));};exports[_0xb059('0x5')]=function(){utils['info'](_0xb059('0x6'));};exports['error']=function(_0x5dd630){utils[_0xb059('0x7')](_0xb059('0x8'),_0x5dd630);};exports['close']=function(){utils[_0xb059('0x1')]('[core]\x20close');};exports[_0xb059('0x9')]=function(_0x170775){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9fc857e..b76848e 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 _0xf080=['duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete'];(function(_0x15a385,_0x5786fb){var _0xb433e8=function(_0x2805bd){while(--_0x2805bd){_0x15a385['push'](_0x15a385['shift']());}};_0xb433e8(++_0x5786fb);}(_0xf080,0x1d9));var _0x0f08=function(_0x7f9169,_0xdaf432){_0x7f9169=_0x7f9169-0x0;var _0x313d8b=_0xf080[_0x7f9169];return _0x313d8b;};'use strict';var _=require(_0x0f08('0x0'));var util=require(_0x0f08('0x1'));var utils=require(_0x0f08('0x2'));var dials={};function writeDB(_0x2e7469){utils['info'](util[_0x0f08('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2e7469[_0x0f08('0x4')],_0x2e7469[_0x0f08('0x5')],_0x2e7469[_0x0f08('0x6')],_0x2e7469[_0x0f08('0x7')],_0x2e7469[_0x0f08('0x8')],_0x2e7469[_0x0f08('0x9')]));utils[_0x0f08('0xa')](_0x0f08('0xb'),_0x2e7469);delete dials[_0x2e7469[_0x0f08('0x4')]];}exports['newexten']=function(_0x471b96){try{utils[_0x0f08('0xc')](util[_0x0f08('0x3')](_0x0f08('0xd'),_0x471b96[_0x0f08('0x4')]),_0x471b96);utils[_0x0f08('0xe')](util['format'](_0x0f08('0xf'),_0x471b96[_0x0f08('0x4')],_0x471b96[_0x0f08('0x10')],_0x471b96['appdata']));if(_0x471b96[_0x0f08('0x10')][_0x0f08('0x11')]()==_0x0f08('0x12')&&_['startsWith'](_0x471b96[_0x0f08('0x13')]['toLowerCase'](),'cdr(routeid)')){var _0x4eaef0=_0x471b96['appdata'][_0x0f08('0x14')]('=');dials[_0x471b96[_0x0f08('0x4')]]={'routeId':_0x4eaef0[0x1]};}}catch(_0xc66762){utils[_0x0f08('0x15')](util[_0x0f08('0x3')](_0x0f08('0xd'),_0x471b96[_0x0f08('0x4')]),_0xc66762);}};exports[_0x0f08('0x16')]=function(_0x44f9fa){try{utils['debug'](util[_0x0f08('0x3')](_0x0f08('0x17'),_0x44f9fa[_0x0f08('0x4')]),_0x44f9fa);if(!_[_0x0f08('0x18')](_0x44f9fa[_0x0f08('0x19')]['outboundrouteid'])){utils[_0x0f08('0xe')](util['format'](_0x0f08('0x1a'),_0x44f9fa['uniqueid'],_0x44f9fa[_0x0f08('0x1b')]));dials[_0x44f9fa['uniqueid']]={'routeId':_0x44f9fa[_0x0f08('0x1b')]};}}catch(_0x198fc8){utils[_0x0f08('0x15')](util[_0x0f08('0x3')](_0x0f08('0x17'),_0x44f9fa[_0x0f08('0x4')]),_0x198fc8);}};exports[_0x0f08('0x1c')]=function(_0x1e222a){try{if(!_['isNil'](dials[_0x1e222a[_0x0f08('0x4')]])){utils[_0x0f08('0xc')](util[_0x0f08('0x3')](_0x0f08('0x1d'),_0x1e222a['uniqueid']),_0x1e222a);dials[_0x1e222a['uniqueid']]=_[_0x0f08('0x1e')](dials[_0x1e222a[_0x0f08('0x4')]],_0x1e222a);dials[_0x1e222a[_0x0f08('0x4')]][_0x0f08('0x1f')]=utils[_0x0f08('0x20')]();dials[_0x1e222a[_0x0f08('0x4')]][_0x0f08('0x21')]=_0x0f08('0x22');utils['info'](util[_0x0f08('0x3')](_0x0f08('0x23'),_0x1e222a['uniqueid'],dials[_0x1e222a[_0x0f08('0x4')]][_0x0f08('0x1f')]));}}catch(_0x48e13c){utils['error'](util[_0x0f08('0x3')](_0x0f08('0x1d'),_0x1e222a[_0x0f08('0x4')]),_0x48e13c);}};exports['dialend']=function(_0x57fc90){try{if(!_[_0x0f08('0x18')](dials[_0x57fc90['uniqueid']])){utils[_0x0f08('0xc')](util[_0x0f08('0x3')](_0x0f08('0x24'),_0x57fc90['uniqueid']),_0x57fc90);dials[_0x57fc90[_0x0f08('0x4')]]['dialstatus']=_0x57fc90[_0x0f08('0x9')];if(_0x57fc90[_0x0f08('0x9')]==_0x0f08('0x25')){dials[_0x57fc90[_0x0f08('0x4')]]=_['assign'](dials[_0x57fc90['uniqueid']],_0x57fc90);dials[_0x57fc90[_0x0f08('0x4')]]['answertime']=utils['now']();dials[_0x57fc90[_0x0f08('0x4')]][_0x0f08('0x21')]=_0x0f08('0x26');utils['info'](util[_0x0f08('0x3')](_0x0f08('0x27'),_0x57fc90[_0x0f08('0x4')],_0x57fc90['dialstatus'],dials[_0x57fc90[_0x0f08('0x4')]][_0x0f08('0x28')]));}else{utils[_0x0f08('0xe')](util['format'](_0x0f08('0x29'),_0x57fc90[_0x0f08('0x4')],_0x57fc90['dialstatus']));}}}catch(_0x383228){utils['error'](util['format'](_0x0f08('0x24'),_0x57fc90[_0x0f08('0x4')]),_0x383228);}};exports[_0x0f08('0x2a')]=function(_0x4c2361){try{if(!_[_0x0f08('0x18')](dials[_0x4c2361[_0x0f08('0x4')]])){utils['debug'](util[_0x0f08('0x3')](_0x0f08('0x2b'),_0x4c2361['uniqueid']),_0x4c2361);utils[_0x0f08('0xe')](util['format'](_0x0f08('0x2c'),_0x4c2361['uniqueid'],_0x4c2361[_0x0f08('0x7')],_0x4c2361['calleridname'],_0x4c2361[_0x0f08('0x2d')]));dials[_0x4c2361[_0x0f08('0x4')]]=_[_0x0f08('0x1e')](dials[_0x4c2361[_0x0f08('0x4')]],{'endtime':utils[_0x0f08('0x20')](),'lastevent':_0x0f08('0x2e')});dials[_0x4c2361['uniqueid']][_0x0f08('0x2f')]=utils[_0x0f08('0x30')](dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x31')],dials[_0x4c2361[_0x0f08('0x4')]]['starttime']);dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x32')]=utils[_0x0f08('0x30')](dials[_0x4c2361[_0x0f08('0x4')]]['answertime']||dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x31')],dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x1f')]);dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x33')]=dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x28')]?utils[_0x0f08('0x30')](dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x31')],dials[_0x4c2361[_0x0f08('0x4')]][_0x0f08('0x28')]):0x0;writeDB(dials[_0x4c2361[_0x0f08('0x4')]]);}}catch(_0x49ade3){utils['error'](util[_0x0f08('0x3')](_0x0f08('0x2b'),_0x4c2361[_0x0f08('0x4')]),_0x49ade3);}}; \ No newline at end of file +var _0x7b13=['diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','answertime','lastevent','connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname'];(function(_0x3f9cf7,_0x1c8184){var _0x96c4c7=function(_0x21cc1d){while(--_0x21cc1d){_0x3f9cf7['push'](_0x3f9cf7['shift']());}};_0x96c4c7(++_0x1c8184);}(_0x7b13,0x113));var _0x37b1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7b13[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x37b1('0x0'));var utils=require(_0x37b1('0x1'));var dials={};function writeDB(_0x11149e){utils[_0x37b1('0x2')](util[_0x37b1('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x11149e[_0x37b1('0x4')],_0x11149e[_0x37b1('0x5')],_0x11149e[_0x37b1('0x6')],_0x11149e[_0x37b1('0x7')],_0x11149e['connectedlinenum'],_0x11149e[_0x37b1('0x8')]));utils[_0x37b1('0x9')](_0x37b1('0xa'),_0x11149e);delete dials[_0x11149e[_0x37b1('0x4')]];}exports['newexten']=function(_0x3377ea){try{utils[_0x37b1('0xb')](util[_0x37b1('0x3')](_0x37b1('0xc'),_0x3377ea[_0x37b1('0x4')]),_0x3377ea);utils[_0x37b1('0x2')](util[_0x37b1('0x3')](_0x37b1('0xd'),_0x3377ea[_0x37b1('0x4')],_0x3377ea[_0x37b1('0xe')],_0x3377ea[_0x37b1('0xf')]));if(_0x3377ea[_0x37b1('0xe')][_0x37b1('0x10')]()==_0x37b1('0x11')&&_['startsWith'](_0x3377ea[_0x37b1('0xf')][_0x37b1('0x10')](),_0x37b1('0x12'))){var _0x180772=_0x3377ea['appdata'][_0x37b1('0x13')]('=');dials[_0x3377ea[_0x37b1('0x4')]]={'routeId':_0x180772[0x1]};}}catch(_0x5c10f4){utils[_0x37b1('0x14')](util[_0x37b1('0x3')](_0x37b1('0xc'),_0x3377ea['uniqueid']),_0x5c10f4);}};exports[_0x37b1('0x15')]=function(_0x3c05cf){try{utils[_0x37b1('0xb')](util[_0x37b1('0x3')](_0x37b1('0x16'),_0x3c05cf[_0x37b1('0x4')]),_0x3c05cf);if(!_[_0x37b1('0x17')](_0x3c05cf[_0x37b1('0x18')][_0x37b1('0x19')])){utils[_0x37b1('0x2')](util['format'](_0x37b1('0x1a'),_0x3c05cf[_0x37b1('0x4')],_0x3c05cf[_0x37b1('0x1b')]));dials[_0x3c05cf[_0x37b1('0x4')]]={'routeId':_0x3c05cf[_0x37b1('0x1b')]};}}catch(_0x1c4a15){utils[_0x37b1('0x14')](util[_0x37b1('0x3')]('[%s][dials][varset]',_0x3c05cf[_0x37b1('0x4')]),_0x1c4a15);}};exports['dialbegin']=function(_0x42d74f){try{if(!_['isNil'](dials[_0x42d74f[_0x37b1('0x4')]])){utils['debug'](util['format'](_0x37b1('0x1c'),_0x42d74f[_0x37b1('0x4')]),_0x42d74f);dials[_0x42d74f[_0x37b1('0x4')]]=_[_0x37b1('0x1d')](dials[_0x42d74f['uniqueid']],_0x42d74f);dials[_0x42d74f[_0x37b1('0x4')]]['starttime']=utils[_0x37b1('0x1e')]();dials[_0x42d74f[_0x37b1('0x4')]]['lastevent']='called';utils[_0x37b1('0x2')](util['format'](_0x37b1('0x1f'),_0x42d74f['uniqueid'],dials[_0x42d74f[_0x37b1('0x4')]][_0x37b1('0x20')]));}}catch(_0x3fccad){utils[_0x37b1('0x14')](util['format'](_0x37b1('0x1c'),_0x42d74f[_0x37b1('0x4')]),_0x3fccad);}};exports[_0x37b1('0x21')]=function(_0x35eadd){try{if(!_[_0x37b1('0x17')](dials[_0x35eadd[_0x37b1('0x4')]])){utils[_0x37b1('0xb')](util[_0x37b1('0x3')]('[%s][dials][dialend]',_0x35eadd[_0x37b1('0x4')]),_0x35eadd);dials[_0x35eadd[_0x37b1('0x4')]][_0x37b1('0x8')]=_0x35eadd[_0x37b1('0x8')];if(_0x35eadd[_0x37b1('0x8')]=='ANSWER'){dials[_0x35eadd[_0x37b1('0x4')]]=_[_0x37b1('0x1d')](dials[_0x35eadd[_0x37b1('0x4')]],_0x35eadd);dials[_0x35eadd['uniqueid']][_0x37b1('0x22')]=utils[_0x37b1('0x1e')]();dials[_0x35eadd[_0x37b1('0x4')]][_0x37b1('0x23')]=_0x37b1('0x24');utils['info'](util[_0x37b1('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x35eadd[_0x37b1('0x4')],_0x35eadd[_0x37b1('0x8')],dials[_0x35eadd[_0x37b1('0x4')]][_0x37b1('0x22')]));}else{utils[_0x37b1('0x2')](util[_0x37b1('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x35eadd[_0x37b1('0x4')],_0x35eadd[_0x37b1('0x8')]));}}}catch(_0x67f499){utils[_0x37b1('0x14')](util[_0x37b1('0x3')]('[%s][dials][dialend]',_0x35eadd[_0x37b1('0x4')]),_0x67f499);}};exports[_0x37b1('0x25')]=function(_0x40e5f5){try{if(!_[_0x37b1('0x17')](dials[_0x40e5f5[_0x37b1('0x4')]])){utils[_0x37b1('0xb')](util['format']('[%s][dials][hangup]',_0x40e5f5[_0x37b1('0x4')]),_0x40e5f5);utils['info'](util[_0x37b1('0x3')](_0x37b1('0x26'),_0x40e5f5[_0x37b1('0x4')],_0x40e5f5[_0x37b1('0x7')],_0x40e5f5[_0x37b1('0x27')],_0x40e5f5['cause-txt']));dials[_0x40e5f5[_0x37b1('0x4')]]=_['assign'](dials[_0x40e5f5[_0x37b1('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x40e5f5[_0x37b1('0x4')]]['duration']=utils[_0x37b1('0x28')](dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x29')],dials[_0x40e5f5['uniqueid']]['starttime']);dials[_0x40e5f5['uniqueid']][_0x37b1('0x2a')]=utils['diffTime'](dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x22')]||dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x29')],dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x20')]);dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x2b')]=dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x22')]?utils[_0x37b1('0x28')](dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x29')],dials[_0x40e5f5[_0x37b1('0x4')]][_0x37b1('0x22')]):0x0;writeDB(dials[_0x40e5f5[_0x37b1('0x4')]]);}}catch(_0x400bfc){utils[_0x37b1('0x14')](util[_0x37b1('0x3')](_0x37b1('0x2c'),_0x40e5f5['uniqueid']),_0x400bfc);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 45a4a35..f7f7243 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 _0x5882=['newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','error','close','managerevent','debug','format','[%s][index][devicestatechange]','devicestatechange','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten'];(function(_0x111461,_0x2c9279){var _0x3832a8=function(_0x20b6b4){while(--_0x20b6b4){_0x111461['push'](_0x111461['shift']());}};_0x3832a8(++_0x2c9279);}(_0x5882,0x193));var _0x2588=function(_0x5c6073,_0x4fe485){_0x5c6073=_0x5c6073-0x0;var _0x584670=_0x5882[_0x5c6073];return _0x584670;};var AsteriskManager=require(_0x2588('0x0'));var config=require(_0x2588('0x1'));var utils=require(_0x2588('0x2'));var util=require(_0x2588('0x3'));var isXDREnabled=config[_0x2588('0x4')]&&config[_0x2588('0x4')][_0x2588('0x5')]?!config[_0x2588('0x4')][_0x2588('0x5')]:!![];var isProduction=config[_0x2588('0x6')]==='production'||![];var isLocalAsterisk=config[_0x2588('0x4')]&&config[_0x2588('0x4')][_0x2588('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x2588('0x8')]['port'],config[_0x2588('0x8')]['ip'],config[_0x2588('0x8')]['username'],config[_0x2588('0x8')][_0x2588('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x2588('0xa')](_0x2588('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2588('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x2588('0xc'));var calls=require(_0x2588('0xd'));var queues=require(_0x2588('0xe'));var recordings=require(_0x2588('0xf'));var members=require('./members.controller');var dials=require(_0x2588('0x10'));var transfers=require(_0x2588('0x11'));var core=require(_0x2588('0x12'));ami['on'](_0x2588('0x13'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x2588('0x14'),core[_0x2588('0x14')]);ami['on'](_0x2588('0x15'),core[_0x2588('0x15')]);ami['on']('managerevent',core[_0x2588('0x16')]);ami['on']('devicestatechange',function(_0x515205){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x19'),_0x515205['device']),_0x515205);members[_0x2588('0x1a')](_0x515205);}catch(_0x84aaa7){utils['error'](util[_0x2588('0x18')](_0x2588('0x19'),_0x515205[_0x2588('0x1b')]),_0x84aaa7);}});ami['on'](_0x2588('0x1c'),function(_0x26cffd){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x1d'),_0x26cffd['uniqueid']),_0x26cffd);agents['agentcalled'](_0x26cffd);}catch(_0x37935c){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][agentcalled]',_0x26cffd[_0x2588('0x1e')]),_0x37935c);}});ami['on'](_0x2588('0x1f'),function(_0x5b1797){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x20'),_0x5b1797[_0x2588('0x1e')]),_0x5b1797);agents[_0x2588('0x1f')](_0x5b1797);}catch(_0x25ba84){utils[_0x2588('0x14')](util['format'](_0x2588('0x20'),_0x5b1797[_0x2588('0x1e')]),_0x25ba84);}});ami['on'](_0x2588('0x21'),function(_0x316c97){try{utils[_0x2588('0x17')](util['format'](_0x2588('0x22'),_0x316c97[_0x2588('0x1e')]),_0x316c97);agents[_0x2588('0x21')](_0x316c97);queues[_0x2588('0x21')](_0x316c97);}catch(_0x294618){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][agentconnect]',_0x316c97['uniqueid']),_0x294618);}});ami['on']('agentcomplete',function(_0x554845){try{utils['debug'](util[_0x2588('0x18')](_0x2588('0x23'),_0x554845[_0x2588('0x1e')]),_0x554845);agents['agentcomplete'](_0x554845);queues['agentcomplete'](_0x554845);members['agentcomplete'](_0x554845);}catch(_0x5ef560){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][agentcomplete]',_0x554845[_0x2588('0x1e')]),_0x5ef560);}});ami['on']('queuecallerabandon',function(_0x564e52){try{utils[_0x2588('0x17')](util['format']('[%s][index][queuecallerabandon]',_0x564e52[_0x2588('0x1e')]),_0x564e52);agents[_0x2588('0x24')](_0x564e52);queues[_0x2588('0x24')](_0x564e52);}catch(_0x478e0d){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x25'),_0x564e52[_0x2588('0x1e')]),_0x478e0d);}});ami['on'](_0x2588('0x26'),function(_0x3e0af8){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x27'),_0x3e0af8[_0x2588('0x1e')]),_0x3e0af8);queues[_0x2588('0x26')](_0x3e0af8);recordings[_0x2588('0x26')](_0x3e0af8);}catch(_0x151f07){utils['error'](util[_0x2588('0x18')](_0x2588('0x27'),_0x3e0af8[_0x2588('0x1e')]),_0x151f07);}});ami['on']('queuecallerleave',function(_0x4ed01d){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x28'),_0x4ed01d[_0x2588('0x1e')]),_0x4ed01d);queues['queuecallerleave'](_0x4ed01d);}catch(_0x114bc5){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][queuecallerleave]',_0x4ed01d[_0x2588('0x1e')]),_0x114bc5);}});ami['on'](_0x2588('0x29'),function(_0x593048){try{utils['debug'](util['format'](_0x2588('0x2a'),_0x593048[_0x2588('0x1e')]),_0x593048);queues['musiconholdstart'](_0x593048);calls[_0x2588('0x29')](_0x593048);}catch(_0x80fc9f){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x2a'),_0x593048[_0x2588('0x1e')]),_0x80fc9f);}});ami['on'](_0x2588('0x2b'),function(_0x214886){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x2c'),_0x214886[_0x2588('0x1e')]),_0x214886);queues['musiconholdstop'](_0x214886);calls['musiconholdstop'](_0x214886);}catch(_0x59c04e){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][musiconholdstop]',_0x214886[_0x2588('0x1e')]),_0x59c04e);}});ami['on'](_0x2588('0x2d'),function(_0x41a376){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x2e'),_0x41a376['uniqueid']),_0x41a376);calls[_0x2588('0x2d')](_0x41a376);recordings[_0x2588('0x2d')](_0x41a376);}catch(_0xa0faa7){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x2e'),_0x41a376[_0x2588('0x1e')]),_0xa0faa7);}});ami['on'](_0x2588('0x2f'),function(_0x3da303){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x30'),_0x3da303[_0x2588('0x1e')]),_0x3da303);calls[_0x2588('0x2f')](_0x3da303);recordings['hangup'](_0x3da303);dials['hangup'](_0x3da303);agents[_0x2588('0x2f')](_0x3da303);queues['hangup'](_0x3da303);}catch(_0x51fc90){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x30'),_0x3da303[_0x2588('0x1e')]),_0x51fc90);}});ami['on'](_0x2588('0x31'),function(_0x5a6d6a){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x32'),_0x5a6d6a[_0x2588('0x1e')]),_0x5a6d6a);members[_0x2588('0x31')](_0x5a6d6a);}catch(_0x5c097d){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x32'),_0x5a6d6a[_0x2588('0x1e')]),_0x5c097d);}});ami['on'](_0x2588('0x33'),function(_0x501311){try{utils[_0x2588('0x17')](util[_0x2588('0x18')]('[%s][index][blindtransfer]',_0x501311[_0x2588('0x1e')]),_0x501311);queues[_0x2588('0x33')](_0x501311);agents[_0x2588('0x33')](_0x501311);transfers['blindtransfer'](_0x501311);recordings['blindtransfer'](_0x501311);}catch(_0x528f3d){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x34'),_0x501311['uniqueid']),_0x528f3d);}});ami['on'](_0x2588('0x35'),function(_0x7c7af9){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x36'),_0x7c7af9['origtransfereruniqueid']),_0x7c7af9);queues[_0x2588('0x35')](_0x7c7af9);transfers[_0x2588('0x35')](_0x7c7af9);agents[_0x2588('0x35')](_0x7c7af9);calls[_0x2588('0x35')](_0x7c7af9);}catch(_0x5d87d9){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x36'),_0x7c7af9['origtransfereruniqueid']),_0x5d87d9);}});ami['on'](_0x2588('0x37'),function(_0x541c8d){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x38'),_0x541c8d[_0x2588('0x1e')]),_0x541c8d);queues[_0x2588('0x37')](_0x541c8d);recordings[_0x2588('0x37')](_0x541c8d);calls[_0x2588('0x37')](_0x541c8d);dials['varset'](_0x541c8d);}catch(_0x2c2ba7){utils['error'](util['format'](_0x2588('0x38'),_0x541c8d['uniqueid']),_0x2c2ba7);}});ami['on']('newexten',function(_0x57858d){try{utils[_0x2588('0x17')](util[_0x2588('0x18')](_0x2588('0x39'),_0x57858d[_0x2588('0x1e')]),_0x57858d);calls[_0x2588('0x3a')](_0x57858d);recordings[_0x2588('0x3a')](_0x57858d);dials[_0x2588('0x3a')](_0x57858d);}catch(_0x309f30){utils[_0x2588('0x14')](util['format'](_0x2588('0x39'),_0x57858d[_0x2588('0x1e')]),_0x309f30);}});ami['on'](_0x2588('0x3b'),function(_0x280595){try{utils[_0x2588('0x17')](util['format'](_0x2588('0x3c'),_0x280595[_0x2588('0x1e')]),_0x280595);calls[_0x2588('0x3b')](_0x280595);recordings[_0x2588('0x3b')](_0x280595);}catch(_0x372fd9){utils[_0x2588('0x14')](util[_0x2588('0x18')]('[%s][index][newchannel]',_0x280595[_0x2588('0x1e')]),_0x372fd9);}});ami['on'](_0x2588('0x3d'),function(_0x53a265){try{utils['debug'](util['format'](_0x2588('0x3e'),_0x53a265[_0x2588('0x1e')]),_0x53a265);dials[_0x2588('0x3d')](_0x53a265);}catch(_0x3ccab4){utils[_0x2588('0x14')](util[_0x2588('0x18')](_0x2588('0x3f'),_0x53a265[_0x2588('0x1e')]),_0x3ccab4);}});ami['on'](_0x2588('0x40'),function(_0x133401){try{utils[_0x2588('0x17')](util['format'](_0x2588('0x41'),_0x133401[_0x2588('0x1e')]),_0x133401);dials[_0x2588('0x40')](_0x133401);}catch(_0x8a4e83){utils['error'](util[_0x2588('0x18')]('[%s][index][dialend]',_0x133401[_0x2588('0x1e')]),_0x8a4e83);}});} \ No newline at end of file +var _0xe3a3=['blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xe3a3,0x1e4));var _0x3e3a=function(_0x2f87a9,_0x176fa4){_0x2f87a9=_0x2f87a9-0x0;var _0x5bb48c=_0xe3a3[_0x2f87a9];return _0x5bb48c;};var AsteriskManager=require('asterisk-manager');var config=require(_0x3e3a('0x0'));var utils=require(_0x3e3a('0x1'));var util=require(_0x3e3a('0x2'));var isXDREnabled=config[_0x3e3a('0x3')]&&config[_0x3e3a('0x3')][_0x3e3a('0x4')]?!config[_0x3e3a('0x3')][_0x3e3a('0x4')]:!![];var isProduction=config['env']===_0x3e3a('0x5')||![];var isLocalAsterisk=config[_0x3e3a('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x3e3a('0x6')],config['asterisk']['ip'],config[_0x3e3a('0x7')][_0x3e3a('0x8')],config['asterisk'][_0x3e3a('0x9')],!![]);ami[_0x3e3a('0xa')]();if(!isXDREnabled){utils[_0x3e3a('0xb')](_0x3e3a('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x3e3a('0xd'));var recordings=require(_0x3e3a('0xe'));var members=require('./members.controller');var dials=require(_0x3e3a('0xf'));var transfers=require(_0x3e3a('0x10'));var core=require(_0x3e3a('0x11'));ami['on'](_0x3e3a('0x12'),core[_0x3e3a('0x12')]);ami['on'](_0x3e3a('0x13'),core[_0x3e3a('0x13')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x3e3a('0x14'),core['error']);ami['on'](_0x3e3a('0x15'),core['close']);ami['on'](_0x3e3a('0x16'),core[_0x3e3a('0x16')]);ami['on'](_0x3e3a('0x17'),function(_0x2bafa2){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x1a'),_0x2bafa2[_0x3e3a('0x1b')]),_0x2bafa2);members['devicestatechange'](_0x2bafa2);}catch(_0x506eda){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x1a'),_0x2bafa2[_0x3e3a('0x1b')]),_0x506eda);}});ami['on'](_0x3e3a('0x1c'),function(_0x316bef){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x1d'),_0x316bef['uniqueid']),_0x316bef);agents[_0x3e3a('0x1c')](_0x316bef);}catch(_0x9af8){utils['error'](util[_0x3e3a('0x19')](_0x3e3a('0x1d'),_0x316bef[_0x3e3a('0x1e')]),_0x9af8);}});ami['on']('agentringnoanswer',function(_0x1e3e7d){try{utils[_0x3e3a('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x1e3e7d[_0x3e3a('0x1e')]),_0x1e3e7d);agents[_0x3e3a('0x1f')](_0x1e3e7d);}catch(_0x1abc7e){utils['error'](util[_0x3e3a('0x19')](_0x3e3a('0x20'),_0x1e3e7d[_0x3e3a('0x1e')]),_0x1abc7e);}});ami['on'](_0x3e3a('0x21'),function(_0x364ce9){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x22'),_0x364ce9[_0x3e3a('0x1e')]),_0x364ce9);agents['agentconnect'](_0x364ce9);queues['agentconnect'](_0x364ce9);}catch(_0x44ba77){utils['error'](util[_0x3e3a('0x19')](_0x3e3a('0x22'),_0x364ce9[_0x3e3a('0x1e')]),_0x44ba77);}});ami['on'](_0x3e3a('0x23'),function(_0x4eae4f){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x24'),_0x4eae4f['uniqueid']),_0x4eae4f);agents[_0x3e3a('0x23')](_0x4eae4f);queues[_0x3e3a('0x23')](_0x4eae4f);members[_0x3e3a('0x23')](_0x4eae4f);}catch(_0x75f8f4){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')]('[%s][index][agentcomplete]',_0x4eae4f[_0x3e3a('0x1e')]),_0x75f8f4);}});ami['on']('queuecallerabandon',function(_0x1c2082){try{utils['debug'](util[_0x3e3a('0x19')]('[%s][index][queuecallerabandon]',_0x1c2082[_0x3e3a('0x1e')]),_0x1c2082);agents['queuecallerabandon'](_0x1c2082);queues[_0x3e3a('0x25')](_0x1c2082);}catch(_0x5b456b){utils['error'](util[_0x3e3a('0x19')]('[%s][index][queuecallerabandon]',_0x1c2082[_0x3e3a('0x1e')]),_0x5b456b);}});ami['on'](_0x3e3a('0x26'),function(_0x49f283){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x27'),_0x49f283[_0x3e3a('0x1e')]),_0x49f283);queues[_0x3e3a('0x26')](_0x49f283);recordings[_0x3e3a('0x26')](_0x49f283);}catch(_0x4499e5){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x27'),_0x49f283['uniqueid']),_0x4499e5);}});ami['on']('queuecallerleave',function(_0x213af2){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x28'),_0x213af2[_0x3e3a('0x1e')]),_0x213af2);queues[_0x3e3a('0x29')](_0x213af2);}catch(_0x116c57){utils['error'](util[_0x3e3a('0x19')](_0x3e3a('0x28'),_0x213af2['uniqueid']),_0x116c57);}});ami['on']('musiconholdstart',function(_0x58eebb){try{utils[_0x3e3a('0x18')](util['format'](_0x3e3a('0x2a'),_0x58eebb[_0x3e3a('0x1e')]),_0x58eebb);queues['musiconholdstart'](_0x58eebb);calls[_0x3e3a('0x2b')](_0x58eebb);}catch(_0x1ca604){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x2a'),_0x58eebb['uniqueid']),_0x1ca604);}});ami['on'](_0x3e3a('0x2c'),function(_0x537600){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x2d'),_0x537600[_0x3e3a('0x1e')]),_0x537600);queues['musiconholdstop'](_0x537600);calls['musiconholdstop'](_0x537600);}catch(_0x1e8d1f){utils[_0x3e3a('0x14')](util['format']('[%s][index][musiconholdstop]',_0x537600['uniqueid']),_0x1e8d1f);}});ami['on'](_0x3e3a('0x2e'),function(_0x1f67ab){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x2f'),_0x1f67ab['uniqueid']),_0x1f67ab);calls[_0x3e3a('0x2e')](_0x1f67ab);recordings[_0x3e3a('0x2e')](_0x1f67ab);}catch(_0x4734f5){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')]('[%s][index][newstate]',_0x1f67ab[_0x3e3a('0x1e')]),_0x4734f5);}});ami['on'](_0x3e3a('0x30'),function(_0xffdd5f){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x31'),_0xffdd5f[_0x3e3a('0x1e')]),_0xffdd5f);calls['hangup'](_0xffdd5f);recordings[_0x3e3a('0x30')](_0xffdd5f);dials[_0x3e3a('0x30')](_0xffdd5f);agents[_0x3e3a('0x30')](_0xffdd5f);queues[_0x3e3a('0x30')](_0xffdd5f);}catch(_0x4d6995){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x31'),_0xffdd5f[_0x3e3a('0x1e')]),_0x4d6995);}});ami['on'](_0x3e3a('0x32'),function(_0x528fc8){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x33'),_0x528fc8['uniqueid']),_0x528fc8);members[_0x3e3a('0x32')](_0x528fc8);}catch(_0x41b613){utils['error'](util[_0x3e3a('0x19')](_0x3e3a('0x33'),_0x528fc8[_0x3e3a('0x1e')]),_0x41b613);}});ami['on'](_0x3e3a('0x34'),function(_0x2a0ac1){try{utils[_0x3e3a('0x18')](util['format'](_0x3e3a('0x35'),_0x2a0ac1[_0x3e3a('0x1e')]),_0x2a0ac1);queues[_0x3e3a('0x34')](_0x2a0ac1);agents[_0x3e3a('0x34')](_0x2a0ac1);transfers[_0x3e3a('0x34')](_0x2a0ac1);recordings['blindtransfer'](_0x2a0ac1);}catch(_0x1b7665){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x35'),_0x2a0ac1[_0x3e3a('0x1e')]),_0x1b7665);}});ami['on'](_0x3e3a('0x36'),function(_0x3901e2){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x37'),_0x3901e2['origtransfereruniqueid']),_0x3901e2);queues[_0x3e3a('0x36')](_0x3901e2);transfers[_0x3e3a('0x36')](_0x3901e2);agents[_0x3e3a('0x36')](_0x3901e2);calls['attendedtransfer'](_0x3901e2);}catch(_0x248da4){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x37'),_0x3901e2['origtransfereruniqueid']),_0x248da4);}});ami['on'](_0x3e3a('0x38'),function(_0x426a4e){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x39'),_0x426a4e[_0x3e3a('0x1e')]),_0x426a4e);queues[_0x3e3a('0x38')](_0x426a4e);recordings['varset'](_0x426a4e);calls[_0x3e3a('0x38')](_0x426a4e);dials[_0x3e3a('0x38')](_0x426a4e);}catch(_0x45ab8a){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x39'),_0x426a4e[_0x3e3a('0x1e')]),_0x45ab8a);}});ami['on'](_0x3e3a('0x3a'),function(_0x117482){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')](_0x3e3a('0x3b'),_0x117482['uniqueid']),_0x117482);calls[_0x3e3a('0x3a')](_0x117482);recordings[_0x3e3a('0x3a')](_0x117482);dials[_0x3e3a('0x3a')](_0x117482);}catch(_0x235814){utils[_0x3e3a('0x14')](util['format']('[%s][index][newexten]',_0x117482[_0x3e3a('0x1e')]),_0x235814);}});ami['on'](_0x3e3a('0x3c'),function(_0x1ded09){try{utils['debug'](util[_0x3e3a('0x19')](_0x3e3a('0x3d'),_0x1ded09[_0x3e3a('0x1e')]),_0x1ded09);calls[_0x3e3a('0x3c')](_0x1ded09);recordings[_0x3e3a('0x3c')](_0x1ded09);}catch(_0x49c8b5){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x3d'),_0x1ded09['uniqueid']),_0x49c8b5);}});ami['on']('dialbegin',function(_0x2a09fe){try{utils['debug'](util[_0x3e3a('0x19')](_0x3e3a('0x3e'),_0x2a09fe['uniqueid']),_0x2a09fe);dials[_0x3e3a('0x3f')](_0x2a09fe);}catch(_0x14a268){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x40'),_0x2a09fe[_0x3e3a('0x1e')]),_0x14a268);}});ami['on'](_0x3e3a('0x41'),function(_0x2362f7){try{utils[_0x3e3a('0x18')](util[_0x3e3a('0x19')]('[%s][index][dialend]',_0x2362f7[_0x3e3a('0x1e')]),_0x2362f7);dials['dialend'](_0x2362f7);}catch(_0x34ff3d){utils[_0x3e3a('0x14')](util[_0x3e3a('0x19')](_0x3e3a('0x42'),_0x2362f7['uniqueid']),_0x34ff3d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 35123d1..b73dbbb 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 _0x90b4=['interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','data3','data2','destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','uniqueid'];(function(_0x51ff69,_0x23d467){var _0x4f971b=function(_0x508751){while(--_0x508751){_0x51ff69['push'](_0x51ff69['shift']());}};_0x4f971b(++_0x23d467);}(_0x90b4,0x192));var _0x490b=function(_0x3a2e1e,_0x3aa6b4){_0x3a2e1e=_0x3a2e1e-0x0;var _0x5c4205=_0x90b4[_0x3a2e1e];return _0x5c4205;};'use strict';var _=require('lodash');var util=require(_0x490b('0x0'));var utils=require(_0x490b('0x1'));var members={};var exclude=[_0x490b('0x2'),_0x490b('0x3')];function writeDB(_0x41aab9){utils[_0x490b('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x41aab9[_0x490b('0x5')],_0x41aab9[_0x490b('0x6')],_0x41aab9[_0x490b('0x7')],_0x41aab9['data2'],_0x41aab9[_0x490b('0x8')],_0x41aab9[_0x490b('0x9')]));if(_0x41aab9[_0x490b('0x6')]){utils[_0x490b('0xa')](_0x41aab9[_0x490b('0x6')])[_0x490b('0xb')](function(_0x4405f1){if(_0x4405f1){_0x41aab9['membername']=_0x4405f1[_0x490b('0xc')];_0x41aab9[_0x490b('0xd')]=_0x4405f1[_0x490b('0xd')];utils[_0x490b('0xe')](_0x490b('0xf'),_0x41aab9);}else{utils[_0x490b('0x10')](_0x41aab9[_0x490b('0x6')][_0x490b('0x11')]('/')[0x1])[_0x490b('0xb')](function(_0x4bfec9){if(_0x4bfec9){_0x41aab9[_0x490b('0x8')]=_0x4bfec9['name'];_0x41aab9[_0x490b('0xd')]=_0x4bfec9[_0x490b('0xd')];utils['request']('CreateMemberReport',_0x41aab9);}});}})[_0x490b('0x12')](function(_0x3b1b0e){utils[_0x490b('0x13')](util['format']('[%s][members][writeDB]',_0x41aab9['uniqueid']),_0x3b1b0e);});}delete members[_0x41aab9[_0x490b('0x6')]];}function startsWith(_0x24c9ba,_0x2a84dd){return _[_0x490b('0x14')](_0x24c9ba,function(_0x2d3b19){return _[_0x490b('0x15')](_0x2a84dd,_0x2d3b19);});}exports[_0x490b('0x16')]=function(_0x3fceea){try{utils[_0x490b('0x17')](util[_0x490b('0x18')]('[%s][members][devicestatechange]',members[_0x3fceea[_0x490b('0x19')]]?members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x5')]:_0x3fceea[_0x490b('0x19')]),_0x3fceea);utils[_0x490b('0x4')](util['format'](_0x490b('0x1a'),members[_0x3fceea['device']]?members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x5')]:_0x3fceea['device'],_0x3fceea[_0x490b('0x1b')],_0x3fceea[_0x490b('0x19')]));switch(_0x3fceea[_0x490b('0x1b')]){case _0x490b('0x1c'):case _0x490b('0x1d'):if(!startsWith(exclude,_0x3fceea['device'])){members[_0x3fceea[_0x490b('0x19')]]={'channel':'voice','interface':_0x3fceea[_0x490b('0x19')],'type':_0x490b('0x1e'),'enterAt':utils[_0x490b('0x1f')](),'role':_0x490b('0x20')};}break;case _0x490b('0x21'):if(!_[_0x490b('0x22')](members[_0x3fceea[_0x490b('0x19')]])){members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x23')]=utils[_0x490b('0x1f')]();members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x24')]=utils[_0x490b('0x25')](members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x23')],members[_0x3fceea['device']][_0x490b('0x26')]);if(members[_0x3fceea[_0x490b('0x19')]][_0x490b('0x5')]){writeDB(members[_0x3fceea[_0x490b('0x19')]]);}}break;default:break;}}catch(_0x3ea117){utils[_0x490b('0x13')](util[_0x490b('0x18')]('[%s][members][devicestatechange]',members[_0x3fceea[_0x490b('0x19')]]?members[_0x3fceea[_0x490b('0x19')]]['uniqueid']:_0x3fceea[_0x490b('0x19')]),_0x3ea117);}};exports[_0x490b('0x27')]=function(_0x31906e){try{if(!_[_0x490b('0x22')](members[_0x31906e[_0x490b('0x6')]])){utils[_0x490b('0x17')](util[_0x490b('0x18')](_0x490b('0x28'),_0x31906e['uniqueid']),_0x31906e);utils[_0x490b('0x4')](util[_0x490b('0x18')](_0x490b('0x29'),_0x31906e[_0x490b('0x5')],_0x31906e['interface'],_0x31906e[_0x490b('0x2a')]));members[_0x31906e[_0x490b('0x6')]]=_[_0x490b('0x2b')](members[_0x31906e['interface']],{'data4':_0x31906e['queue'],'uniqueid':_0x31906e['uniqueid']});}}catch(_0x58bf86){utils[_0x490b('0x13')](util[_0x490b('0x18')](_0x490b('0x28'),_0x31906e['uniqueid']),_0x58bf86);}};exports['cdr']=function(_0xe62d21){try{utils[_0x490b('0x17')](util[_0x490b('0x18')](_0x490b('0x2c'),_0xe62d21[_0x490b('0x5')]),_0xe62d21);if(_0xe62d21[_0x490b('0x7')]){var _0xa78e50=_0xe62d21[_0x490b('0x7')][_0x490b('0x11')]('-')[0x0];if(!_[_0x490b('0x22')](members[_0xa78e50])){members[_0xa78e50]=_[_0x490b('0x2b')](members[_0xa78e50],{'data1':members[_0xa78e50][_0x490b('0x2d')]||_0xe62d21[_0x490b('0x9')],'data2':members[_0xa78e50]['data2']||_0xe62d21[_0x490b('0x2e')],'data3':members[_0xa78e50][_0x490b('0x2f')]||_0xe62d21['destination'],'uniqueid':members[_0xa78e50][_0x490b('0x5')]||_0xe62d21[_0x490b('0x5')]});utils['info'](util[_0x490b('0x18')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xe62d21[_0x490b('0x5')],members[_0xa78e50][_0x490b('0x2d')],members[_0xa78e50][_0x490b('0x30')],members[_0xa78e50][_0x490b('0x2f')]));if(members[_0xa78e50][_0x490b('0x23')]){writeDB(members[_0xa78e50]);}}}if(_0xe62d21[_0x490b('0x31')]){var _0x27a894=_0xe62d21[_0x490b('0x31')][_0x490b('0x11')]('-')[0x0];if(!_[_0x490b('0x22')](members[_0x27a894])){members[_0x27a894]=_[_0x490b('0x2b')](members[_0x27a894],{'data1':members[_0x27a894][_0x490b('0x2d')]||_0xe62d21['type'],'data2':members[_0x27a894]['data2']||_0xe62d21[_0x490b('0x2e')],'data3':members[_0x27a894][_0x490b('0x2f')]||_0xe62d21[_0x490b('0x32')],'uniqueid':members[_0x27a894][_0x490b('0x5')]||_0xe62d21[_0x490b('0x5')]});utils[_0x490b('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xe62d21['uniqueid'],members[_0x27a894][_0x490b('0x2d')],members[_0x27a894][_0x490b('0x30')],members[_0x27a894][_0x490b('0x2f')]));if(members[_0x27a894][_0x490b('0x23')]){writeDB(members[_0x27a894]);}}}}catch(_0x216361){utils[_0x490b('0x13')](util[_0x490b('0x18')](_0x490b('0x2c'),_0xe62d21[_0x490b('0x5')]),_0x216361);}}; \ No newline at end of file +var _0x48e0=['destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','channel','assign','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1'];(function(_0x5a4673,_0x3767b3){var _0x152e7e=function(_0x5992da){while(--_0x5992da){_0x5a4673['push'](_0x5a4673['shift']());}};_0x152e7e(++_0x3767b3);}(_0x48e0,0x146));var _0x048e=function(_0x2b1334,_0x22e93a){_0x2b1334=_0x2b1334-0x0;var _0x8c8a9=_0x48e0[_0x2b1334];return _0x8c8a9;};'use strict';var _=require('lodash');var util=require(_0x048e('0x0'));var utils=require(_0x048e('0x1'));var members={};var exclude=[_0x048e('0x2'),_0x048e('0x3')];function writeDB(_0x417571){utils[_0x048e('0x4')](util[_0x048e('0x5')](_0x048e('0x6'),_0x417571[_0x048e('0x7')],_0x417571[_0x048e('0x8')],_0x417571['channel'],_0x417571['data2'],_0x417571[_0x048e('0x9')],_0x417571[_0x048e('0xa')]));if(_0x417571['interface']){utils['getUserByInterface'](_0x417571['interface'])[_0x048e('0xb')](function(_0x29d1aa){if(_0x29d1aa){_0x417571[_0x048e('0x9')]=_0x29d1aa[_0x048e('0xc')];_0x417571[_0x048e('0xd')]=_0x29d1aa['internal'];utils[_0x048e('0xe')]('CreateMemberReport',_0x417571);}else{utils[_0x048e('0xf')](_0x417571[_0x048e('0x8')][_0x048e('0x10')]('/')[0x1])[_0x048e('0xb')](function(_0x45357b){if(_0x45357b){_0x417571['membername']=_0x45357b[_0x048e('0xc')];_0x417571[_0x048e('0xd')]=_0x45357b[_0x048e('0xd')];utils[_0x048e('0xe')](_0x048e('0x11'),_0x417571);}});}})[_0x048e('0x12')](function(_0x4aeb76){utils[_0x048e('0x13')](util[_0x048e('0x5')](_0x048e('0x14'),_0x417571[_0x048e('0x7')]),_0x4aeb76);});}delete members[_0x417571[_0x048e('0x8')]];}function startsWith(_0x1fb126,_0x110540){return _[_0x048e('0x15')](_0x1fb126,function(_0x578975){return _[_0x048e('0x16')](_0x110540,_0x578975);});}exports['devicestatechange']=function(_0x234e25){try{utils[_0x048e('0x17')](util[_0x048e('0x5')](_0x048e('0x18'),members[_0x234e25[_0x048e('0x19')]]?members[_0x234e25[_0x048e('0x19')]][_0x048e('0x7')]:_0x234e25[_0x048e('0x19')]),_0x234e25);utils['info'](util[_0x048e('0x5')](_0x048e('0x1a'),members[_0x234e25[_0x048e('0x19')]]?members[_0x234e25[_0x048e('0x19')]][_0x048e('0x7')]:_0x234e25[_0x048e('0x19')],_0x234e25[_0x048e('0x1b')],_0x234e25[_0x048e('0x19')]));switch(_0x234e25['state']){case _0x048e('0x1c'):case _0x048e('0x1d'):if(!startsWith(exclude,_0x234e25['device'])){members[_0x234e25[_0x048e('0x19')]]={'channel':_0x048e('0x1e'),'interface':_0x234e25['device'],'type':_0x048e('0x1f'),'enterAt':utils['now'](),'role':_0x048e('0x20')};}break;case'NOT_INUSE':if(!_[_0x048e('0x21')](members[_0x234e25['device']])){members[_0x234e25['device']][_0x048e('0x22')]=utils[_0x048e('0x23')]();members[_0x234e25[_0x048e('0x19')]][_0x048e('0x24')]=utils[_0x048e('0x25')](members[_0x234e25[_0x048e('0x19')]][_0x048e('0x22')],members[_0x234e25[_0x048e('0x19')]][_0x048e('0x26')]);if(members[_0x234e25[_0x048e('0x19')]][_0x048e('0x7')]){writeDB(members[_0x234e25[_0x048e('0x19')]]);}}break;default:break;}}catch(_0x1170be){utils['error'](util['format'](_0x048e('0x18'),members[_0x234e25[_0x048e('0x19')]]?members[_0x234e25[_0x048e('0x19')]][_0x048e('0x7')]:_0x234e25['device']),_0x1170be);}};exports[_0x048e('0x27')]=function(_0x5e58cb){try{if(!_[_0x048e('0x21')](members[_0x5e58cb[_0x048e('0x8')]])){utils[_0x048e('0x17')](util[_0x048e('0x5')](_0x048e('0x28'),_0x5e58cb[_0x048e('0x7')]),_0x5e58cb);utils[_0x048e('0x4')](util[_0x048e('0x5')](_0x048e('0x29'),_0x5e58cb[_0x048e('0x7')],_0x5e58cb[_0x048e('0x8')],_0x5e58cb[_0x048e('0x2a')]));members[_0x5e58cb[_0x048e('0x8')]]=_['assign'](members[_0x5e58cb[_0x048e('0x8')]],{'data4':_0x5e58cb[_0x048e('0x2a')],'uniqueid':_0x5e58cb[_0x048e('0x7')]});}}catch(_0x3467c4){utils['error'](util[_0x048e('0x5')](_0x048e('0x28'),_0x5e58cb[_0x048e('0x7')]),_0x3467c4);}};exports[_0x048e('0x2b')]=function(_0x3df30b){try{utils['debug'](util[_0x048e('0x5')](_0x048e('0x2c'),_0x3df30b[_0x048e('0x7')]),_0x3df30b);if(_0x3df30b[_0x048e('0x2d')]){var _0x24a41f=_0x3df30b[_0x048e('0x2d')][_0x048e('0x10')]('-')[0x0];if(!_[_0x048e('0x21')](members[_0x24a41f])){members[_0x24a41f]=_[_0x048e('0x2e')](members[_0x24a41f],{'data1':members[_0x24a41f]['data1']||_0x3df30b['type'],'data2':members[_0x24a41f][_0x048e('0x2f')]||_0x3df30b[_0x048e('0x30')],'data3':members[_0x24a41f][_0x048e('0x31')]||_0x3df30b['destination'],'uniqueid':members[_0x24a41f][_0x048e('0x7')]||_0x3df30b[_0x048e('0x7')]});utils['info'](util['format'](_0x048e('0x32'),_0x3df30b['uniqueid'],members[_0x24a41f][_0x048e('0x33')],members[_0x24a41f][_0x048e('0x2f')],members[_0x24a41f]['data3']));if(members[_0x24a41f][_0x048e('0x22')]){writeDB(members[_0x24a41f]);}}}if(_0x3df30b[_0x048e('0x34')]){var _0x39910c=_0x3df30b[_0x048e('0x34')][_0x048e('0x10')]('-')[0x0];if(!_['isNil'](members[_0x39910c])){members[_0x39910c]=_['assign'](members[_0x39910c],{'data1':members[_0x39910c][_0x048e('0x33')]||_0x3df30b[_0x048e('0xa')],'data2':members[_0x39910c][_0x048e('0x2f')]||_0x3df30b[_0x048e('0x30')],'data3':members[_0x39910c][_0x048e('0x31')]||_0x3df30b[_0x048e('0x35')],'uniqueid':members[_0x39910c][_0x048e('0x7')]||_0x3df30b[_0x048e('0x7')]});utils[_0x048e('0x4')](util[_0x048e('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3df30b[_0x048e('0x7')],members[_0x39910c][_0x048e('0x33')],members[_0x39910c][_0x048e('0x2f')],members[_0x39910c]['data3']));if(members[_0x39910c][_0x048e('0x22')]){writeDB(members[_0x39910c]);}}}}catch(_0x35bc2e){utils[_0x048e('0x13')](util[_0x048e('0x5')](_0x048e('0x2c'),_0x3df30b[_0x048e('0x7')]),_0x35bc2e);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c59f502..b55958e 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 _0x2447=['extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','transfertargetlinkedid','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','isNil','variable','queuestatus','value','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2447,0x1ec));var _0x7244=function(_0x2a1b94,_0x28f24b){_0x2a1b94=_0x2a1b94-0x0;var _0x34a5e5=_0x2447[_0x2a1b94];return _0x34a5e5;};'use strict';var _=require(_0x7244('0x0'));var util=require(_0x7244('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4c189c){utils[_0x7244('0x2')](util['format'](_0x7244('0x3'),_0x4c189c[_0x7244('0x4')],_0x4c189c['channel'],_0x4c189c[_0x7244('0x5')],_0x4c189c[_0x7244('0x6')],_0x4c189c['calleridnum'],_0x4c189c['accountcode'],_0x4c189c[_0x7244('0x7')]));if(_0x4c189c['queue']){utils[_0x7244('0x8')](_0x4c189c[_0x7244('0x5')])['then'](function(_0x35a4f9){if(_0x35a4f9){_0x4c189c[_0x7244('0x9')]=_0x35a4f9[_0x7244('0x9')];}utils['request'](_0x7244('0xa'),_0x4c189c);});}else{utils['request'](_0x7244('0xa'),_0x4c189c);}if(_0x4c189c[_0x7244('0xb')]){delete queues[_0x4c189c[_0x7244('0xb')]];}else{delete queues[_0x4c189c['uniqueid']];}}exports[_0x7244('0xc')]=function(_0x567221){try{utils[_0x7244('0xd')](util[_0x7244('0xe')]('[%s][queues][queuecallerjoin]',_0x567221[_0x7244('0x4')]),_0x567221);utils[_0x7244('0x2')](util['format'](_0x7244('0xf'),_0x567221[_0x7244('0x4')],_0x567221['queue'],_0x567221['position']));queues[_0x567221[_0x7244('0x4')]]=_[_0x7244('0x10')](_0x567221,{'originalposition':_0x567221[_0x7244('0x11')],'queuecallerjoinAt':utils[_0x7244('0x12')](),'mohtime':0x0});}catch(_0x4ef98d){utils['error'](util[_0x7244('0xe')]('[%s][queues][queuecallerjoin]',_0x567221['uniqueid']),_0x4ef98d);}};exports[_0x7244('0x13')]=function(_0x1105b2){try{if(!_['isNil'](queues[_0x1105b2[_0x7244('0x4')]])){utils[_0x7244('0xd')](util['format'](_0x7244('0x14'),_0x1105b2[_0x7244('0x4')]),_0x1105b2);if(queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x15')]){if(!queues[_0x1105b2['uniqueid']][_0x7244('0x16')]&&!queues[_0x1105b2[_0x7244('0x4')]]['queuecallerexit']){queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x17')]=!![];queues[_0x1105b2['uniqueid']]['queuecallercompleteAt']=utils[_0x7244('0x12')]();queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x7')]=_0x7244('0x18');}utils['info'](util[_0x7244('0xe')](_0x7244('0x19'),_0x1105b2[_0x7244('0x4')],queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x1a')],queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x7')]));writeDB(queues[_0x1105b2[_0x7244('0x4')]]);}else if(queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0xb')]){utils[_0x7244('0x2')](util['format'](_0x7244('0x1b'),_0x1105b2[_0x7244('0x4')],queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0x1a')],queues[_0x1105b2[_0x7244('0x4')]][_0x7244('0xb')]));queues[queues[_0x1105b2['uniqueid']][_0x7244('0xb')]]=queues[_0x1105b2['uniqueid']];queues[queues[_0x1105b2['uniqueid']][_0x7244('0xb')]][_0x7244('0x1c')]=0x2;delete queues[_0x1105b2[_0x7244('0x4')]];}}}catch(_0x1ab8f1){utils[_0x7244('0x1d')](util[_0x7244('0xe')](_0x7244('0x14'),_0x1105b2['uniqueid']),_0x1ab8f1);}};exports['varset']=function(_0x1d5ed4){try{utils[_0x7244('0xd')](util['format']('[%s][queues][varset]',_0x1d5ed4[_0x7244('0x4')]),_0x1d5ed4);if(!_[_0x7244('0x1e')](_0x1d5ed4[_0x7244('0x1f')][_0x7244('0x20')])&&_0x1d5ed4[_0x7244('0x21')]['toUpperCase']()!=='CONTINUE'){if(!_['isNil'](queues[_0x1d5ed4[_0x7244('0x4')]])){queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x16')]=![];queues[_0x1d5ed4['uniqueid']][_0x7244('0x22')]=null;queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x23')]=!![];queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x24')]=utils['now']();queues[_0x1d5ed4['uniqueid']][_0x7244('0x7')]=_0x1d5ed4[_0x7244('0x21')][_0x7244('0x25')]();utils[_0x7244('0x2')](util['format'](_0x7244('0x26'),_0x1d5ed4[_0x7244('0x4')],queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x1a')],_0x1d5ed4['value'],queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x7')]));writeDB(queues[_0x1d5ed4['uniqueid']]);}}else if(!_[_0x7244('0x1e')](_0x1d5ed4['variable'][_0x7244('0x27')])){if(!_[_0x7244('0x1e')](queues[_0x1d5ed4[_0x7244('0x4')]])&&!queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x16')]){queues[_0x1d5ed4[_0x7244('0x4')]]['queuecallerabandon']=![];queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x22')]=null;queues[_0x1d5ed4['uniqueid']][_0x7244('0x23')]=!![];queues[_0x1d5ed4[_0x7244('0x4')]]['queuecallerexitAt']=utils[_0x7244('0x12')]();queues[_0x1d5ed4['uniqueid']][_0x7244('0x7')]=_0x7244('0x28');utils[_0x7244('0x2')](util[_0x7244('0xe')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1d5ed4[_0x7244('0x4')],queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x1a')],_0x1d5ed4[_0x7244('0x21')],queues[_0x1d5ed4[_0x7244('0x4')]][_0x7244('0x7')]));}}}catch(_0x30a9fd){utils[_0x7244('0x1d')](util['format']('[%s][queues][varset]',_0x1d5ed4[_0x7244('0x4')]),_0x30a9fd);}};exports['queuecallerabandon']=function(_0x4f7456){try{if(!_['isNil'](queues[_0x4f7456['uniqueid']])){utils[_0x7244('0xd')](util[_0x7244('0xe')]('[%s][queues][queuecallerabandon]',_0x4f7456[_0x7244('0x4')]),_0x4f7456);queues[_0x4f7456['uniqueid']]['queuecallerexit']=![];queues[_0x4f7456['uniqueid']][_0x7244('0x24')]=null;queues[_0x4f7456[_0x7244('0x4')]][_0x7244('0x16')]=!![];queues[_0x4f7456[_0x7244('0x4')]][_0x7244('0x22')]=utils[_0x7244('0x12')]();queues[_0x4f7456[_0x7244('0x4')]][_0x7244('0x7')]='ABANDONED';utils['info'](util[_0x7244('0xe')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4f7456[_0x7244('0x4')],queues[_0x4f7456['uniqueid']][_0x7244('0x1a')],queues[_0x4f7456[_0x7244('0x4')]]['queuecallerexitreason']));}}catch(_0x1b86f6){utils['error'](util['format'](_0x7244('0x29'),_0x4f7456[_0x7244('0x4')]),_0x1b86f6);}};exports['queuecallerleave']=function(_0x5b1de2){try{if(!_[_0x7244('0x1e')](queues[_0x5b1de2[_0x7244('0x4')]])){utils[_0x7244('0xd')](util['format'](_0x7244('0x2a'),_0x5b1de2[_0x7244('0x4')]),_0x5b1de2);utils['info'](util[_0x7244('0xe')](_0x7244('0x2b'),_0x5b1de2[_0x7244('0x4')],queues[_0x5b1de2['uniqueid']][_0x7244('0x1a')],_0x5b1de2[_0x7244('0x2c')],_0x5b1de2[_0x7244('0x2d')]));queues[_0x5b1de2['uniqueid']]['queuecallerleave']=!![];queues[_0x5b1de2[_0x7244('0x4')]][_0x7244('0x15')]=utils[_0x7244('0x12')]();queues[_0x5b1de2['uniqueid']][_0x7244('0x2e')]=utils[_0x7244('0x2f')](queues[_0x5b1de2['uniqueid']][_0x7244('0x15')],queues[_0x5b1de2['uniqueid']][_0x7244('0x30')]);queues[_0x5b1de2[_0x7244('0x4')]][_0x7244('0x11')]=_0x5b1de2[_0x7244('0x11')];queues[_0x5b1de2[_0x7244('0x4')]][_0x7244('0x31')]=_0x5b1de2[_0x7244('0x31')];queues[_0x5b1de2['uniqueid']]['connectedlinenum']=_0x5b1de2[_0x7244('0x2c')];queues[_0x5b1de2[_0x7244('0x4')]][_0x7244('0x2d')]=_0x5b1de2['connectedlinename'];}}catch(_0x1c2bc3){utils[_0x7244('0x1d')](util[_0x7244('0xe')](_0x7244('0x2a'),_0x5b1de2[_0x7244('0x4')]),_0x1c2bc3);}};exports['agentconnect']=function(_0x1a8fff){try{if(!_[_0x7244('0x1e')](queues[_0x1a8fff[_0x7244('0x4')]])){utils[_0x7244('0xd')](util['format'](_0x7244('0x32'),_0x1a8fff[_0x7244('0x4')]),_0x1a8fff);utils[_0x7244('0x2')](util[_0x7244('0xe')](_0x7244('0x33'),_0x1a8fff[_0x7244('0x4')],queues[_0x1a8fff['uniqueid']][_0x7244('0x1a')],_0x1a8fff[_0x7244('0x34')],_0x1a8fff['destaccountcode']));queues[_0x1a8fff['uniqueid']][_0x7244('0x16')]=![];queues[_0x1a8fff[_0x7244('0x4')]][_0x7244('0x16')]=![];queues[_0x1a8fff[_0x7244('0x4')]][_0x7244('0x22')]=null;queues[_0x1a8fff[_0x7244('0x4')]][_0x7244('0x23')]=![];queues[_0x1a8fff['uniqueid']]['queuecallerexitreason']=null;queues[_0x1a8fff[_0x7244('0x4')]][_0x7244('0x24')]=null;queues[_0x1a8fff['uniqueid']][_0x7244('0x35')]=!![];queues[_0x1a8fff[_0x7244('0x4')]]['accountcode']=_0x1a8fff[_0x7244('0x36')];queues[_0x1a8fff['uniqueid']][_0x7244('0x6')]=_0x1a8fff[_0x7244('0x34')];}}catch(_0x3a811f){utils['error'](util[_0x7244('0xe')](_0x7244('0x32'),_0x1a8fff[_0x7244('0x4')]),_0x3a811f);}};exports[_0x7244('0x37')]=function(_0x5b13cb){try{if(!_[_0x7244('0x1e')](queues[_0x5b13cb[_0x7244('0x4')]])){if(queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x15')]){utils[_0x7244('0xd')](util[_0x7244('0xe')](_0x7244('0x38'),_0x5b13cb[_0x7244('0x4')]),_0x5b13cb);queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x16')]=![];queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x16')]=![];queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x22')]=null;queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x23')]=![];queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x24')]=null;queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x35')]=!![];queues[_0x5b13cb[_0x7244('0x4')]]['lastAssignedTo']=_0x5b13cb['membername'];queues[_0x5b13cb['uniqueid']][_0x7244('0x17')]=!![];queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x39')]=utils[_0x7244('0x12')]();if(_0x5b13cb[_0x7244('0x3a')]=='transfer'){if(!queues[_0x5b13cb['uniqueid']][_0x7244('0x3b')]){queues[_0x5b13cb[_0x7244('0x4')]][_0x7244('0x7')]='TRANSFER';}}else{queues[_0x5b13cb[_0x7244('0x4')]]['queuecallerexitreason']=_0x7244('0x3c')+_0x5b13cb['reason'][_0x7244('0x25')]();}utils['info'](util[_0x7244('0xe')](_0x7244('0x3d'),_0x5b13cb[_0x7244('0x4')],queues[_0x5b13cb[_0x7244('0x4')]]['name'],_0x5b13cb[_0x7244('0x34')],queues[_0x5b13cb['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5b13cb[_0x7244('0x4')]]);}}}catch(_0x529b98){utils['error'](util[_0x7244('0xe')](_0x7244('0x38'),_0x5b13cb[_0x7244('0x4')]),_0x529b98);}};exports[_0x7244('0x3e')]=function(_0x4635b0){try{if(!_[_0x7244('0x1e')](queues[_0x4635b0[_0x7244('0x3f')]])){utils[_0x7244('0xd')](util['format'](_0x7244('0x40'),_0x4635b0[_0x7244('0x4')]),_0x4635b0);queues[_0x4635b0['transfereeuniqueid']][_0x7244('0x3b')]=!![];queues[_0x4635b0[_0x7244('0x3f')]]['transfertype']='BLIND';queues[_0x4635b0[_0x7244('0x3f')]][_0x7244('0x41')]=_0x4635b0[_0x7244('0x42')];queues[_0x4635b0[_0x7244('0x3f')]][_0x7244('0x43')]=_0x4635b0[_0x7244('0x3f')];queues[_0x4635b0['transfereeuniqueid']][_0x7244('0x7')]=_0x7244('0x44');utils[_0x7244('0x2')](util[_0x7244('0xe')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4635b0[_0x7244('0x4')],queues[_0x4635b0[_0x7244('0x3f')]][_0x7244('0x1a')],_0x4635b0[_0x7244('0x3f')],_0x4635b0[_0x7244('0x42')]));}}catch(_0x16b414){utils['error'](util['format'](_0x7244('0x40'),_0x4635b0['uniqueid']),_0x16b414);}};exports['attendedtransfer']=function(_0x147f70){try{utils[_0x7244('0xd')](util[_0x7244('0xe')](_0x7244('0x45'),_0x147f70[_0x7244('0x46')]),_0x147f70);if(_0x147f70[_0x7244('0x46')]==_0x147f70['origtransfererlinkedid']){if(!_[_0x7244('0x1e')](queues[_0x147f70['secondtransfererlinkedid']])){utils[_0x7244('0x2')](util['format'](_0x7244('0x47'),_0x147f70[_0x7244('0x46')],queues[_0x147f70[_0x7244('0x48')]][_0x7244('0x1a')],_0x147f70['origtransfererexten']));queues[_0x147f70[_0x7244('0x48')]][_0x7244('0x3b')]=!![];queues[_0x147f70[_0x7244('0x48')]]['transfertype']=_0x7244('0x49');queues[_0x147f70['secondtransfererlinkedid']][_0x7244('0x41')]=_0x147f70[_0x7244('0x4a')];queues[_0x147f70[_0x7244('0x48')]][_0x7244('0x43')]=_0x147f70[_0x7244('0x46')];queues[_0x147f70['secondtransfererlinkedid']]['queuecallerexitreason']=_0x7244('0x4b');}if(!_[_0x7244('0x1e')](queues[_0x147f70[_0x7244('0x4c')]])){if(_0x147f70[_0x7244('0x4d')]&&queues[_0x147f70[_0x7244('0x4d')]]){queues[_0x147f70[_0x7244('0x4d')]][_0x7244('0x1c')]=0x1;queues[_0x147f70[_0x7244('0x3f')]]=_[_0x7244('0x4e')](queues[_0x147f70[_0x7244('0x4d')]]);queues[_0x147f70['transfereeuniqueid']][_0x7244('0xb')]=_0x147f70[_0x7244('0x4f')];queues[_0x147f70[_0x7244('0x3f')]]['queuecallerenterreason']=0x2;queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x50')]=queues[_0x147f70['secondtransfererlinkedid']][_0x7244('0x50')];queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x51')]=queues[_0x147f70[_0x7244('0x48')]][_0x7244('0x51')];queues[_0x147f70['transfereeuniqueid']][_0x7244('0x30')]=utils[_0x7244('0x12')]();queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x15')]=utils[_0x7244('0x12')]();queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x2e')]=0x0;queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x52')]=0x0;utils['info'](util[_0x7244('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x147f70[_0x7244('0x46')],queues[_0x147f70['transfereeuniqueid']][_0x7244('0x1a')],queues[_0x147f70[_0x7244('0x3f')]]['calleridnum'],queues[_0x147f70[_0x7244('0x3f')]][_0x7244('0x51')]));}else{utils[_0x7244('0x2')](util[_0x7244('0xe')](_0x7244('0x53'),_0x147f70[_0x7244('0x46')],queues[_0x147f70['origtransfererlinkedid']][_0x7244('0x1a')],_0x147f70[_0x7244('0x48')]));queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0xb')]=_0x147f70[_0x7244('0x48')];}}}else if(_0x147f70[_0x7244('0x54')]==_0x147f70[_0x7244('0x48')]){if(!_[_0x7244('0x1e')](queues[_0x147f70[_0x7244('0x4c')]])){utils[_0x7244('0x2')](util['format'](_0x7244('0x55'),_0x147f70[_0x7244('0x46')],queues[_0x147f70['origtransfererlinkedid']]['name'],_0x147f70['secondtransfereruniqueid'],_0x147f70[_0x7244('0x56')]));queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0x3b')]=!![];queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0x57')]='ATTENDED';queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0x41')]=_0x147f70[_0x7244('0x56')];queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0x43')]=_0x147f70['secondtransfereruniqueid'];queues[_0x147f70['origtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7244('0x1e')](queues[_0x147f70['secondtransfererlinkedid']])){if(_0x147f70[_0x7244('0x58')]&&queues[_0x147f70[_0x7244('0x58')]]){queues[_0x147f70[_0x7244('0x58')]][_0x7244('0x1c')]=0x1;queues[_0x147f70['transfertargetuniqueid']]=_[_0x7244('0x4e')](queues[_0x147f70[_0x7244('0x58')]]);queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0xb')]=_0x147f70[_0x7244('0x4f')];queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x1c')]=0x2;queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x50')]=queues[_0x147f70['origtransfererlinkedid']][_0x7244('0x50')];queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x51')]=queues[_0x147f70[_0x7244('0x4c')]][_0x7244('0x51')];queues[_0x147f70[_0x7244('0x4f')]]['queuecallerjoinAt']=utils[_0x7244('0x12')]();queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x15')]=utils[_0x7244('0x12')]();queues[_0x147f70['transfertargetuniqueid']][_0x7244('0x2e')]=0x0;queues[_0x147f70[_0x7244('0x4f')]]['mohtime']=0x0;utils[_0x7244('0x2')](util[_0x7244('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x147f70[_0x7244('0x46')],queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x1a')],queues[_0x147f70[_0x7244('0x4f')]]['transfereduniqueid'],queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x50')],queues[_0x147f70[_0x7244('0x4f')]][_0x7244('0x51')]));}else{utils[_0x7244('0x2')](util[_0x7244('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x147f70['origtransfereruniqueid'],queues[_0x147f70[_0x7244('0x48')]][_0x7244('0x1a')],_0x147f70[_0x7244('0x4c')]));queues[_0x147f70[_0x7244('0x48')]][_0x7244('0xb')]=_0x147f70['origtransfererlinkedid'];}}}}catch(_0x5b795d){utils[_0x7244('0x1d')](util[_0x7244('0xe')](_0x7244('0x45'),_0x147f70[_0x7244('0x46')]),_0x5b795d);}};exports['musiconholdstart']=function(_0x4ee800){try{if(!_[_0x7244('0x1e')](queues[_0x4ee800[_0x7244('0x4')]])){utils[_0x7244('0xd')](util[_0x7244('0xe')]('[%s][queues][musiconholdstart]',_0x4ee800[_0x7244('0x4')]),_0x4ee800);queues[_0x4ee800[_0x7244('0x4')]][_0x7244('0x59')]=utils[_0x7244('0x12')]();utils[_0x7244('0x2')](util[_0x7244('0xe')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4ee800[_0x7244('0x4')],queues[_0x4ee800['uniqueid']][_0x7244('0x1a')],queues[_0x4ee800['uniqueid']]['musiconholdstartAt']));}}catch(_0x2a16a9){utils[_0x7244('0x1d')](util[_0x7244('0xe')]('[%s][queues][musiconholdstart]',_0x4ee800[_0x7244('0x4')]),_0x2a16a9);}};exports[_0x7244('0x5a')]=function(_0x5a6125){try{if(!_['isNil'](queues[_0x5a6125['uniqueid']])){if(!_[_0x7244('0x1e')](queues[_0x5a6125['uniqueid']][_0x7244('0x59')])){utils[_0x7244('0xd')](util[_0x7244('0xe')](_0x7244('0x5b'),_0x5a6125[_0x7244('0x4')]),_0x5a6125);queues[_0x5a6125[_0x7244('0x4')]][_0x7244('0x52')]+=utils['diffTime'](utils[_0x7244('0x12')](),queues[_0x5a6125['uniqueid']][_0x7244('0x59')]);utils[_0x7244('0x2')](util[_0x7244('0xe')](_0x7244('0x5c'),_0x5a6125[_0x7244('0x4')],queues[_0x5a6125['uniqueid']][_0x7244('0x1a')],queues[_0x5a6125[_0x7244('0x4')]]['mohtime']));delete queues[_0x5a6125[_0x7244('0x4')]]['musiconholdstartAt'];}}}catch(_0x251550){utils['error'](util[_0x7244('0xe')](_0x7244('0x5b'),_0x5a6125[_0x7244('0x4')]),_0x251550);}}; \ No newline at end of file +var _0xd0dd=['[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','queuecallercomplete','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x4618fe,_0x4a2804){var _0x41f699=function(_0x272937){while(--_0x272937){_0x4618fe['push'](_0x4618fe['shift']());}};_0x41f699(++_0x4a2804);}(_0xd0dd,0x171));var _0xdd0d=function(_0x7f47fa,_0x15dc61){_0x7f47fa=_0x7f47fa-0x0;var _0x1c38d7=_0xd0dd[_0x7f47fa];return _0x1c38d7;};'use strict';var _=require(_0xdd0d('0x0'));var util=require(_0xdd0d('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x6c89fa){utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x4'),_0x6c89fa['uniqueid'],_0x6c89fa[_0xdd0d('0x5')],_0x6c89fa[_0xdd0d('0x6')],_0x6c89fa[_0xdd0d('0x7')],_0x6c89fa[_0xdd0d('0x8')],_0x6c89fa['accountcode'],_0x6c89fa[_0xdd0d('0x9')]));if(_0x6c89fa[_0xdd0d('0x6')]){utils['getVoiceQueueByName'](_0x6c89fa['queue'])[_0xdd0d('0xa')](function(_0x41d488){if(_0x41d488){_0x6c89fa['type']=_0x41d488[_0xdd0d('0xb')];}utils[_0xdd0d('0xc')](_0xdd0d('0xd'),_0x6c89fa);});}else{utils[_0xdd0d('0xc')](_0xdd0d('0xd'),_0x6c89fa);}if(_0x6c89fa[_0xdd0d('0xe')]){delete queues[_0x6c89fa[_0xdd0d('0xe')]];}else{delete queues[_0x6c89fa[_0xdd0d('0xf')]];}}exports['queuecallerjoin']=function(_0x252e1a){try{utils[_0xdd0d('0x10')](util['format']('[%s][queues][queuecallerjoin]',_0x252e1a[_0xdd0d('0xf')]),_0x252e1a);utils[_0xdd0d('0x2')](util['format'](_0xdd0d('0x11'),_0x252e1a[_0xdd0d('0xf')],_0x252e1a[_0xdd0d('0x6')],_0x252e1a[_0xdd0d('0x12')]));queues[_0x252e1a[_0xdd0d('0xf')]]=_[_0xdd0d('0x13')](_0x252e1a,{'originalposition':_0x252e1a['position'],'queuecallerjoinAt':utils[_0xdd0d('0x14')](),'mohtime':0x0});}catch(_0x9ce7ad){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x16'),_0x252e1a['uniqueid']),_0x9ce7ad);}};exports[_0xdd0d('0x17')]=function(_0x4e0809){try{if(!_[_0xdd0d('0x18')](queues[_0x4e0809[_0xdd0d('0xf')]])){utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')](_0xdd0d('0x19'),_0x4e0809[_0xdd0d('0xf')]),_0x4e0809);if(queues[_0x4e0809[_0xdd0d('0xf')]]['queuecallerleaveAt']){if(!queues[_0x4e0809['uniqueid']][_0xdd0d('0x1a')]&&!queues[_0x4e0809[_0xdd0d('0xf')]][_0xdd0d('0x1b')]){queues[_0x4e0809[_0xdd0d('0xf')]]['queuecallercomplete']=!![];queues[_0x4e0809['uniqueid']][_0xdd0d('0x1c')]=utils['now']();queues[_0x4e0809[_0xdd0d('0xf')]]['queuecallerexitreason']=_0xdd0d('0x1d');}utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x1e'),_0x4e0809[_0xdd0d('0xf')],queues[_0x4e0809[_0xdd0d('0xf')]]['name'],queues[_0x4e0809[_0xdd0d('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x4e0809[_0xdd0d('0xf')]]);}else if(queues[_0x4e0809['uniqueid']][_0xdd0d('0xe')]){utils['info'](util[_0xdd0d('0x3')](_0xdd0d('0x1f'),_0x4e0809[_0xdd0d('0xf')],queues[_0x4e0809[_0xdd0d('0xf')]][_0xdd0d('0x20')],queues[_0x4e0809[_0xdd0d('0xf')]][_0xdd0d('0xe')]));queues[queues[_0x4e0809['uniqueid']][_0xdd0d('0xe')]]=queues[_0x4e0809[_0xdd0d('0xf')]];queues[queues[_0x4e0809[_0xdd0d('0xf')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x4e0809[_0xdd0d('0xf')]];}}}catch(_0x13f76c){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')]('[%s][queues][hangup]',_0x4e0809[_0xdd0d('0xf')]),_0x13f76c);}};exports[_0xdd0d('0x21')]=function(_0x5b9480){try{utils[_0xdd0d('0x10')](util['format'](_0xdd0d('0x22'),_0x5b9480['uniqueid']),_0x5b9480);if(!_[_0xdd0d('0x18')](_0x5b9480[_0xdd0d('0x23')][_0xdd0d('0x24')])&&_0x5b9480[_0xdd0d('0x25')][_0xdd0d('0x26')]()!==_0xdd0d('0x27')){if(!_[_0xdd0d('0x18')](queues[_0x5b9480[_0xdd0d('0xf')]])){queues[_0x5b9480[_0xdd0d('0xf')]]['queuecallerabandon']=![];queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x28')]=null;queues[_0x5b9480[_0xdd0d('0xf')]]['queuecallerexit']=!![];queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x29')]=utils[_0xdd0d('0x14')]();queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x9')]=_0x5b9480[_0xdd0d('0x25')][_0xdd0d('0x26')]();utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x2a'),_0x5b9480[_0xdd0d('0xf')],queues[_0x5b9480['uniqueid']][_0xdd0d('0x20')],_0x5b9480[_0xdd0d('0x25')],queues[_0x5b9480[_0xdd0d('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x5b9480['uniqueid']]);}}else if(!_[_0xdd0d('0x18')](_0x5b9480[_0xdd0d('0x23')]['queueposition'])){if(!_['isNil'](queues[_0x5b9480[_0xdd0d('0xf')]])&&!queues[_0x5b9480['uniqueid']][_0xdd0d('0x1a')]){queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x1a')]=![];queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x28')]=null;queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x1b')]=!![];queues[_0x5b9480[_0xdd0d('0xf')]]['queuecallerexitAt']=utils[_0xdd0d('0x14')]();queues[_0x5b9480['uniqueid']][_0xdd0d('0x9')]='EXITWITHKEY';utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x2b'),_0x5b9480[_0xdd0d('0xf')],queues[_0x5b9480[_0xdd0d('0xf')]][_0xdd0d('0x20')],_0x5b9480[_0xdd0d('0x25')],queues[_0x5b9480['uniqueid']][_0xdd0d('0x9')]));}}}catch(_0x299b8e){utils[_0xdd0d('0x15')](util['format'](_0xdd0d('0x22'),_0x5b9480['uniqueid']),_0x299b8e);}};exports[_0xdd0d('0x1a')]=function(_0x2ddd10){try{if(!_[_0xdd0d('0x18')](queues[_0x2ddd10[_0xdd0d('0xf')]])){utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')](_0xdd0d('0x2c'),_0x2ddd10[_0xdd0d('0xf')]),_0x2ddd10);queues[_0x2ddd10[_0xdd0d('0xf')]]['queuecallerexit']=![];queues[_0x2ddd10[_0xdd0d('0xf')]][_0xdd0d('0x29')]=null;queues[_0x2ddd10['uniqueid']][_0xdd0d('0x1a')]=!![];queues[_0x2ddd10[_0xdd0d('0xf')]][_0xdd0d('0x28')]=utils[_0xdd0d('0x14')]();queues[_0x2ddd10['uniqueid']][_0xdd0d('0x9')]='ABANDONED';utils['info'](util[_0xdd0d('0x3')](_0xdd0d('0x2d'),_0x2ddd10[_0xdd0d('0xf')],queues[_0x2ddd10[_0xdd0d('0xf')]][_0xdd0d('0x20')],queues[_0x2ddd10['uniqueid']][_0xdd0d('0x9')]));}}catch(_0x5899bc){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x2c'),_0x2ddd10[_0xdd0d('0xf')]),_0x5899bc);}};exports[_0xdd0d('0x2e')]=function(_0x301ce9){try{if(!_['isNil'](queues[_0x301ce9[_0xdd0d('0xf')]])){utils[_0xdd0d('0x10')](util['format'](_0xdd0d('0x2f'),_0x301ce9[_0xdd0d('0xf')]),_0x301ce9);utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x30'),_0x301ce9[_0xdd0d('0xf')],queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x20')],_0x301ce9[_0xdd0d('0x31')],_0x301ce9[_0xdd0d('0x32')]));queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x2e')]=!![];queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x33')]=utils['now']();queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x34')]=utils[_0xdd0d('0x35')](queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x33')],queues[_0x301ce9[_0xdd0d('0xf')]]['queuecallerjoinAt']);queues[_0x301ce9[_0xdd0d('0xf')]]['position']=_0x301ce9[_0xdd0d('0x12')];queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x36')]=_0x301ce9[_0xdd0d('0x36')];queues[_0x301ce9[_0xdd0d('0xf')]]['connectedlinenum']=_0x301ce9[_0xdd0d('0x31')];queues[_0x301ce9[_0xdd0d('0xf')]][_0xdd0d('0x32')]=_0x301ce9[_0xdd0d('0x32')];}}catch(_0x2aa99d){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x2f'),_0x301ce9[_0xdd0d('0xf')]),_0x2aa99d);}};exports['agentconnect']=function(_0xbef4a4){try{if(!_[_0xdd0d('0x18')](queues[_0xbef4a4[_0xdd0d('0xf')]])){utils['debug'](util[_0xdd0d('0x3')]('[%s][queues][agentconnect]',_0xbef4a4[_0xdd0d('0xf')]),_0xbef4a4);utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x37'),_0xbef4a4[_0xdd0d('0xf')],queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x20')],_0xbef4a4[_0xdd0d('0x38')],_0xbef4a4[_0xdd0d('0x39')]));queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x1a')]=![];queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x1a')]=![];queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x28')]=null;queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x1b')]=![];queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x9')]=null;queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x29')]=null;queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x3a')]=!![];queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x3b')]=_0xbef4a4[_0xdd0d('0x39')];queues[_0xbef4a4[_0xdd0d('0xf')]][_0xdd0d('0x7')]=_0xbef4a4[_0xdd0d('0x38')];}}catch(_0x50061c){utils['error'](util[_0xdd0d('0x3')]('[%s][queues][agentconnect]',_0xbef4a4['uniqueid']),_0x50061c);}};exports[_0xdd0d('0x3c')]=function(_0xa2888a){try{if(!_[_0xdd0d('0x18')](queues[_0xa2888a[_0xdd0d('0xf')]])){if(queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x33')]){utils['debug'](util[_0xdd0d('0x3')]('[%s][queues][agentcomplete]',_0xa2888a[_0xdd0d('0xf')]),_0xa2888a);queues[_0xa2888a[_0xdd0d('0xf')]]['queuecallerabandon']=![];queues[_0xa2888a[_0xdd0d('0xf')]]['queuecallerabandon']=![];queues[_0xa2888a['uniqueid']]['queuecallerabandonAt']=null;queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x1b')]=![];queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x29')]=null;queues[_0xa2888a[_0xdd0d('0xf')]]['assigned']=!![];queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x7')]=_0xa2888a[_0xdd0d('0x38')];queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x3d')]=!![];queues[_0xa2888a['uniqueid']][_0xdd0d('0x1c')]=utils[_0xdd0d('0x14')]();if(_0xa2888a['reason']==_0xdd0d('0x3e')){if(!queues[_0xa2888a['uniqueid']]['transfer']){queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x9')]=_0xdd0d('0x3f');}}else{queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x9')]='COMPLETEDBY'+_0xa2888a[_0xdd0d('0x40')][_0xdd0d('0x26')]();}utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x41'),_0xa2888a[_0xdd0d('0xf')],queues[_0xa2888a[_0xdd0d('0xf')]]['name'],_0xa2888a[_0xdd0d('0x38')],queues[_0xa2888a[_0xdd0d('0xf')]][_0xdd0d('0x9')]));writeDB(queues[_0xa2888a[_0xdd0d('0xf')]]);}}}catch(_0x24fba5){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x42'),_0xa2888a['uniqueid']),_0x24fba5);}};exports[_0xdd0d('0x43')]=function(_0x94a27f){try{if(!_[_0xdd0d('0x18')](queues[_0x94a27f['transfereeuniqueid']])){utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')]('[%s][queues][blindtransfer]',_0x94a27f['uniqueid']),_0x94a27f);queues[_0x94a27f[_0xdd0d('0x44')]][_0xdd0d('0x3e')]=!![];queues[_0x94a27f['transfereeuniqueid']][_0xdd0d('0x45')]=_0xdd0d('0x46');queues[_0x94a27f[_0xdd0d('0x44')]][_0xdd0d('0x47')]=_0x94a27f['extension'];queues[_0x94a27f[_0xdd0d('0x44')]][_0xdd0d('0x48')]=_0x94a27f[_0xdd0d('0x44')];queues[_0x94a27f[_0xdd0d('0x44')]][_0xdd0d('0x9')]='BLINDTRANSFER';utils[_0xdd0d('0x2')](util['format'](_0xdd0d('0x49'),_0x94a27f[_0xdd0d('0xf')],queues[_0x94a27f[_0xdd0d('0x44')]][_0xdd0d('0x20')],_0x94a27f['transfereeuniqueid'],_0x94a27f[_0xdd0d('0x4a')]));}}catch(_0x218894){utils[_0xdd0d('0x15')](util['format'](_0xdd0d('0x4b'),_0x94a27f[_0xdd0d('0xf')]),_0x218894);}};exports[_0xdd0d('0x4c')]=function(_0x40efa1){try{utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')](_0xdd0d('0x4d'),_0x40efa1[_0xdd0d('0x4e')]),_0x40efa1);if(_0x40efa1['origtransfereruniqueid']==_0x40efa1['origtransfererlinkedid']){if(!_[_0xdd0d('0x18')](queues[_0x40efa1[_0xdd0d('0x4f')]])){utils['info'](util['format'](_0xdd0d('0x50'),_0x40efa1[_0xdd0d('0x4e')],queues[_0x40efa1['secondtransfererlinkedid']][_0xdd0d('0x20')],_0x40efa1['origtransfererexten']));queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0x3e')]=!![];queues[_0x40efa1['secondtransfererlinkedid']]['transfertype']=_0xdd0d('0x51');queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0x47')]=_0x40efa1[_0xdd0d('0x52')];queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0x48')]=_0x40efa1[_0xdd0d('0x4e')];queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xdd0d('0x18')](queues[_0x40efa1[_0xdd0d('0x53')]])){if(_0x40efa1['transfereelinkedid']&&queues[_0x40efa1[_0xdd0d('0x54')]]){queues[_0x40efa1[_0xdd0d('0x54')]][_0xdd0d('0x55')]=0x1;queues[_0x40efa1['transfereeuniqueid']]=_[_0xdd0d('0x56')](queues[_0x40efa1['transfereelinkedid']]);queues[_0x40efa1[_0xdd0d('0x44')]]['transfereduniqueid']=_0x40efa1[_0xdd0d('0x57')];queues[_0x40efa1[_0xdd0d('0x44')]][_0xdd0d('0x55')]=0x2;queues[_0x40efa1['transfereeuniqueid']][_0xdd0d('0x8')]=queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0x8')];queues[_0x40efa1['transfereeuniqueid']][_0xdd0d('0x58')]=queues[_0x40efa1['secondtransfererlinkedid']][_0xdd0d('0x58')];queues[_0x40efa1['transfereeuniqueid']][_0xdd0d('0x59')]=utils[_0xdd0d('0x14')]();queues[_0x40efa1['transfereeuniqueid']][_0xdd0d('0x33')]=utils[_0xdd0d('0x14')]();queues[_0x40efa1[_0xdd0d('0x44')]][_0xdd0d('0x34')]=0x0;queues[_0x40efa1[_0xdd0d('0x44')]][_0xdd0d('0x5a')]=0x0;utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x5b'),_0x40efa1[_0xdd0d('0x4e')],queues[_0x40efa1[_0xdd0d('0x44')]][_0xdd0d('0x20')],queues[_0x40efa1[_0xdd0d('0x44')]][_0xdd0d('0x8')],queues[_0x40efa1[_0xdd0d('0x44')]]['calleridname']));}else{utils['info'](util[_0xdd0d('0x3')](_0xdd0d('0x5c'),_0x40efa1['origtransfereruniqueid'],queues[_0x40efa1['origtransfererlinkedid']][_0xdd0d('0x20')],_0x40efa1[_0xdd0d('0x4f')]));queues[_0x40efa1[_0xdd0d('0x53')]][_0xdd0d('0xe')]=_0x40efa1[_0xdd0d('0x4f')];}}}else if(_0x40efa1[_0xdd0d('0x5d')]==_0x40efa1['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x40efa1[_0xdd0d('0x53')]])){utils['info'](util[_0xdd0d('0x3')](_0xdd0d('0x5e'),_0x40efa1[_0xdd0d('0x4e')],queues[_0x40efa1[_0xdd0d('0x53')]]['name'],_0x40efa1[_0xdd0d('0x5d')],_0x40efa1[_0xdd0d('0x5f')]));queues[_0x40efa1[_0xdd0d('0x53')]][_0xdd0d('0x3e')]=!![];queues[_0x40efa1[_0xdd0d('0x53')]]['transfertype']=_0xdd0d('0x51');queues[_0x40efa1[_0xdd0d('0x53')]]['transferexten']=_0x40efa1[_0xdd0d('0x5f')];queues[_0x40efa1[_0xdd0d('0x53')]][_0xdd0d('0x48')]=_0x40efa1[_0xdd0d('0x5d')];queues[_0x40efa1[_0xdd0d('0x53')]][_0xdd0d('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xdd0d('0x18')](queues[_0x40efa1[_0xdd0d('0x4f')]])){if(_0x40efa1[_0xdd0d('0x60')]&&queues[_0x40efa1['transfertargetlinkedid']]){queues[_0x40efa1['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x40efa1[_0xdd0d('0x57')]]=_['clone'](queues[_0x40efa1[_0xdd0d('0x60')]]);queues[_0x40efa1['transfertargetuniqueid']][_0xdd0d('0xe')]=_0x40efa1[_0xdd0d('0x57')];queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x55')]=0x2;queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x8')]=queues[_0x40efa1[_0xdd0d('0x53')]][_0xdd0d('0x8')];queues[_0x40efa1[_0xdd0d('0x57')]]['calleridname']=queues[_0x40efa1['origtransfererlinkedid']][_0xdd0d('0x58')];queues[_0x40efa1['transfertargetuniqueid']][_0xdd0d('0x59')]=utils[_0xdd0d('0x14')]();queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x33')]=utils[_0xdd0d('0x14')]();queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x34')]=0x0;queues[_0x40efa1[_0xdd0d('0x57')]]['mohtime']=0x0;utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x40efa1[_0xdd0d('0x4e')],queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x20')],queues[_0x40efa1['transfertargetuniqueid']][_0xdd0d('0xe')],queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x8')],queues[_0x40efa1[_0xdd0d('0x57')]][_0xdd0d('0x58')]));}else{utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')](_0xdd0d('0x5c'),_0x40efa1['origtransfereruniqueid'],queues[_0x40efa1[_0xdd0d('0x4f')]]['name'],_0x40efa1[_0xdd0d('0x53')]));queues[_0x40efa1[_0xdd0d('0x4f')]][_0xdd0d('0xe')]=_0x40efa1[_0xdd0d('0x53')];}}}}catch(_0x396bdf){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x4d'),_0x40efa1[_0xdd0d('0x4e')]),_0x396bdf);}};exports[_0xdd0d('0x61')]=function(_0xd90d1){try{if(!_[_0xdd0d('0x18')](queues[_0xd90d1[_0xdd0d('0xf')]])){utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')](_0xdd0d('0x62'),_0xd90d1[_0xdd0d('0xf')]),_0xd90d1);queues[_0xd90d1['uniqueid']][_0xdd0d('0x63')]=utils[_0xdd0d('0x14')]();utils['info'](util[_0xdd0d('0x3')](_0xdd0d('0x64'),_0xd90d1[_0xdd0d('0xf')],queues[_0xd90d1[_0xdd0d('0xf')]]['name'],queues[_0xd90d1[_0xdd0d('0xf')]][_0xdd0d('0x63')]));}}catch(_0x29c0a8){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')](_0xdd0d('0x62'),_0xd90d1[_0xdd0d('0xf')]),_0x29c0a8);}};exports[_0xdd0d('0x65')]=function(_0x39fbb5){try{if(!_['isNil'](queues[_0x39fbb5[_0xdd0d('0xf')]])){if(!_[_0xdd0d('0x18')](queues[_0x39fbb5['uniqueid']][_0xdd0d('0x63')])){utils[_0xdd0d('0x10')](util[_0xdd0d('0x3')](_0xdd0d('0x66'),_0x39fbb5[_0xdd0d('0xf')]),_0x39fbb5);queues[_0x39fbb5[_0xdd0d('0xf')]][_0xdd0d('0x5a')]+=utils['diffTime'](utils[_0xdd0d('0x14')](),queues[_0x39fbb5[_0xdd0d('0xf')]][_0xdd0d('0x63')]);utils[_0xdd0d('0x2')](util[_0xdd0d('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x39fbb5['uniqueid'],queues[_0x39fbb5['uniqueid']][_0xdd0d('0x20')],queues[_0x39fbb5[_0xdd0d('0xf')]][_0xdd0d('0x5a')]));delete queues[_0x39fbb5[_0xdd0d('0xf')]]['musiconholdstartAt'];}}}catch(_0x552c39){utils[_0xdd0d('0x15')](util[_0xdd0d('0x3')]('[%s][queues][musiconholdstop]',_0x39fbb5[_0xdd0d('0xf')]),_0x552c39);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index be1768c..defe27f 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 _0x5726=['appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','util','./transfers.controller','info','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinename','connectedlinenum','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x5726,0xeb));var _0x6572=function(_0x5f4f71,_0x192c6f){_0x5f4f71=_0x5f4f71-0x0;var _0x56a7a8=_0x5726[_0x5f4f71];return _0x56a7a8;};'use strict';var _=require('lodash');var util=require(_0x6572('0x0'));var utils=require('./utils');var transfers=require(_0x6572('0x1'));var recordings={};function writeDB(_0x448379){var _0x38db62;utils[_0x6572('0x2')](util['format'](_0x6572('0x3'),_0x448379['uniqueid']));if(transfers[_0x6572('0x4')][_0x448379[_0x6572('0x5')]]){_0x38db62=_0x448379[_0x6572('0x5')];_0x448379[_0x6572('0x5')]=transfers[_0x6572('0x4')][_0x448379[_0x6572('0x5')]][_0x6572('0x6')];}if(_0x448379[_0x6572('0x7')]){utils[_0x6572('0x8')](_0x448379[_0x6572('0x7')])[_0x6572('0x9')](function(_0x4ceed0){if(_0x4ceed0){_0x448379[_0x6572('0xa')]=_0x4ceed0[_0x6572('0xb')];_0x448379[_0x6572('0xc')]=_0x4ceed0['id'];}utils[_0x6572('0xd')](_0x6572('0xe'),_0x448379);});}else{utils[_0x6572('0xd')](_0x6572('0xe'),_0x448379);}if(_0x38db62)delete transfers[_0x6572('0x4')][_0x38db62];}exports[_0x6572('0xf')]=function(_0x11addf){try{utils['debug'](util[_0x6572('0x10')]('[%s][recordings][newchannel]',_0x11addf['uniqueid']),_0x11addf);if(_0x11addf['uniqueid']==_0x11addf[_0x6572('0x11')]){utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x12'),_0x11addf[_0x6572('0x5')],_0x11addf[_0x6572('0x13')],_0x11addf[_0x6572('0x14')]));recordings[_0x11addf[_0x6572('0x5')]]={'uniqueid':_0x11addf[_0x6572('0x5')],'accountcode':_0x11addf[_0x6572('0x7')],'exten':_0x11addf[_0x6572('0x14')],'context':_0x11addf[_0x6572('0x13')],'channel':_0x11addf[_0x6572('0x15')],'monitors':[]};}}catch(_0x873a7a){utils['error'](util['format']('[%s][recordings][newchannel]',_0x11addf[_0x6572('0x5')]),_0x873a7a);}};exports[_0x6572('0x16')]=function(_0x366c4b){try{utils[_0x6572('0x17')](util[_0x6572('0x10')](_0x6572('0x18'),_0x366c4b[_0x6572('0x5')]),_0x366c4b);if(!_[_0x6572('0x19')](recordings[_0x366c4b[_0x6572('0x5')]])&&_0x366c4b[_0x6572('0x1a')]==0x6){utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x1b'),_0x366c4b['uniqueid'],_0x366c4b[_0x6572('0x13')],_0x366c4b[_0x6572('0x15')]));}else if(!_[_0x6572('0x19')](recordings[_0x366c4b['linkedid']])&&_0x366c4b[_0x6572('0x1a')]==0x6&&_0x366c4b[_0x6572('0x13')]!=_0x6572('0x1c')){utils['info'](util[_0x6572('0x10')](_0x6572('0x1d'),_0x366c4b[_0x6572('0x5')],_0x366c4b[_0x6572('0x11')],_0x366c4b['context'],_0x366c4b[_0x6572('0x15')]));recordings[_0x366c4b[_0x6572('0x11')]][_0x6572('0x7')]=_0x366c4b[_0x6572('0x7')];}}catch(_0x30f5d8){utils[_0x6572('0x1e')](util[_0x6572('0x10')](_0x6572('0x18'),_0x366c4b[_0x6572('0x5')]),_0x30f5d8);}};exports['varset']=function(_0x522757){try{if(!_['isNil'](_0x522757[_0x6572('0x1f')])&&!_[_0x6572('0x19')](_0x522757[_0x6572('0x1f')][_0x6572('0x20')])){utils[_0x6572('0x17')](util['format']('[%s][recordings][varset]',_0x522757[_0x6572('0x5')]),_0x522757);utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x21'),_0x522757[_0x6572('0x5')],_0x522757[_0x6572('0x1f')],_0x522757[_0x6572('0x22')]));if(_['endsWith'](_0x522757[_0x6572('0x22')],_0x6572('0x23'))){_0x522757['value']=_0x522757[_0x6572('0x22')]['replace'](_0x6572('0x23'),_0x6572('0x24'));}if(recordings[_0x522757['linkedid']]){var _0x18d754=_[_0x6572('0x25')](recordings[_0x522757[_0x6572('0x11')]][_0x6572('0x26')],{'value':_0x522757[_0x6572('0x22')]});if(_['isNil'](_0x18d754)){recordings[_0x522757[_0x6572('0x11')]][_0x6572('0x26')][_0x6572('0x27')]({'value':_0x522757[_0x6572('0x22')]});}}}}catch(_0x5c56fa){utils[_0x6572('0x1e')](util[_0x6572('0x10')]('[%s][recordings][varset]',_0x522757[_0x6572('0x5')]),_0x5c56fa);}};exports[_0x6572('0x28')]=function(_0x311bcb){try{if(!_[_0x6572('0x19')](recordings[_0x311bcb['uniqueid']])){utils[_0x6572('0x17')](util[_0x6572('0x10')](_0x6572('0x29'),_0x311bcb['uniqueid']),_0x311bcb);utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x2a'),_0x311bcb['uniqueid'],_0x311bcb[_0x6572('0x2b')],_0x311bcb['calleridname'],_0x311bcb[_0x6572('0x2c')]));recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x2b')]=_0x311bcb[_0x6572('0x2b')];recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x2d')]=_0x311bcb['calleridname'];recordings[_0x311bcb['uniqueid']]['connectedlinenum']=_0x311bcb['connectedlinenum'];recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x2e')]=_0x311bcb[_0x6572('0x2e')];if(recordings[_0x311bcb[_0x6572('0x5')]]['type']=='outbound'&&recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x7')]){recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x2f')]=recordings[_0x311bcb[_0x6572('0x5')]]['accountcode'];recordings[_0x311bcb[_0x6572('0x5')]][_0x6572('0x2e')]='';}recordings[_0x311bcb[_0x6572('0x5')]]['monitors'][_0x6572('0x30')](function(_0x3b86f0){var _0x4d65e0=_['clone'](recordings[_0x311bcb[_0x6572('0x5')]]);_0x4d65e0[_0x6572('0x22')]=_0x3b86f0[_0x6572('0x22')];writeDB(_0x4d65e0);});delete recordings[_0x311bcb['uniqueid']];}}catch(_0x1bd74a){utils[_0x6572('0x1e')](util[_0x6572('0x10')]('[%s][recordings][hangup]',_0x311bcb[_0x6572('0x5')]),_0x1bd74a);}};exports[_0x6572('0x31')]=function(_0x12dff6){try{if(!_[_0x6572('0x19')](recordings[_0x12dff6[_0x6572('0x5')]])){utils[_0x6572('0x17')](util[_0x6572('0x10')](_0x6572('0x32'),_0x12dff6[_0x6572('0x5')]),_0x12dff6);utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x33'),_0x12dff6['uniqueid'],_0x12dff6[_0x6572('0x34')],_0x12dff6[_0x6572('0x35')]));if(_0x12dff6[_0x6572('0x34')][_0x6572('0x36')]()==_0x6572('0x37')&&_[_0x6572('0x38')](_0x12dff6[_0x6572('0x35')]['toLowerCase'](),'cdr')){var _0x47fb28=_0x12dff6[_0x6572('0x35')][_0x6572('0x39')]('=');var _0x27f33b=_0x47fb28[0x0][_0x6572('0x3a')](_0x47fb28[0x0][_0x6572('0x3b')]('(')+0x1,_0x47fb28[0x0][_0x6572('0x3b')](')'));var _0x2bb994=_0x47fb28[0x1];recordings[_0x12dff6[_0x6572('0x5')]][_0x27f33b]=_0x2bb994;}}}catch(_0x1d48bd){utils[_0x6572('0x1e')](util[_0x6572('0x10')]('[%s][recordings][newexten]',_0x12dff6[_0x6572('0x5')]),_0x1d48bd);}};exports[_0x6572('0x3c')]=function(_0x437e70){try{if(!_[_0x6572('0x19')](recordings[_0x437e70[_0x6572('0x5')]])){utils[_0x6572('0x17')](util[_0x6572('0x10')](_0x6572('0x3d'),_0x437e70[_0x6572('0x5')]),_0x437e70);utils[_0x6572('0x2')](util[_0x6572('0x10')](_0x6572('0x3e'),_0x437e70[_0x6572('0x5')],_0x437e70[_0x6572('0x3f')]));recordings[_0x437e70[_0x6572('0x5')]][_0x6572('0x3f')]=_0x437e70[_0x6572('0x3f')];}}catch(_0x51bdc2){utils[_0x6572('0x1e')](util[_0x6572('0x10')](_0x6572('0x3d'),_0x437e70[_0x6572('0x5')]),_0x51bdc2);}};exports[_0x6572('0x40')]=function(_0x4f98af){try{utils[_0x6572('0x17')](util[_0x6572('0x10')](_0x6572('0x41'),_0x4f98af[_0x6572('0x5')]),_0x4f98af);utils[_0x6572('0x2')](util['format'](_0x6572('0x42'),_0x4f98af[_0x6572('0x5')],_0x4f98af[_0x6572('0x43')],_0x4f98af[_0x6572('0x44')],_0x4f98af['transfereecalleridnum'],_0x4f98af[_0x6572('0x45')]));if(recordings[_0x4f98af[_0x6572('0x46')]]&&transfers[_0x6572('0x4')][_0x4f98af[_0x6572('0x46')]]){transfers[_0x6572('0x4')][_0x4f98af[_0x6572('0x46')]][_0x6572('0x47')]=!![];}}catch(_0x27d01f){utils[_0x6572('0x1e')](util[_0x6572('0x10')](_0x6572('0x41'),_0x4f98af[_0x6572('0x5')]),_0x27d01f);}}; \ No newline at end of file +var _0x61f2=['linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]'];(function(_0x3ce086,_0x56486d){var _0x3a5df1=function(_0x21f045){while(--_0x21f045){_0x3ce086['push'](_0x3ce086['shift']());}};_0x3a5df1(++_0x56486d);}(_0x61f2,0x1b0));var _0x261f=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x61f2[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x261f('0x0'));var util=require(_0x261f('0x1'));var utils=require('./utils');var transfers=require(_0x261f('0x2'));var recordings={};function writeDB(_0x5e5b04){var _0x4482b4;utils['info'](util[_0x261f('0x3')](_0x261f('0x4'),_0x5e5b04[_0x261f('0x5')]));if(transfers[_0x261f('0x6')][_0x5e5b04[_0x261f('0x5')]]){_0x4482b4=_0x5e5b04[_0x261f('0x5')];_0x5e5b04[_0x261f('0x5')]=transfers[_0x261f('0x6')][_0x5e5b04[_0x261f('0x5')]][_0x261f('0x7')];}if(_0x5e5b04[_0x261f('0x8')]){utils[_0x261f('0x9')](_0x5e5b04[_0x261f('0x8')])[_0x261f('0xa')](function(_0x12d16a){if(_0x12d16a){_0x5e5b04[_0x261f('0xb')]=_0x12d16a[_0x261f('0xc')];_0x5e5b04[_0x261f('0xd')]=_0x12d16a['id'];}utils[_0x261f('0xe')](_0x261f('0xf'),_0x5e5b04);});}else{utils[_0x261f('0xe')]('CreateVoiceRecording',_0x5e5b04);}if(_0x4482b4)delete transfers['blinds'][_0x4482b4];}exports[_0x261f('0x10')]=function(_0x27cb38){try{utils['debug'](util['format'](_0x261f('0x11'),_0x27cb38[_0x261f('0x5')]),_0x27cb38);if(_0x27cb38['uniqueid']==_0x27cb38[_0x261f('0x12')]){utils['info'](util[_0x261f('0x3')](_0x261f('0x13'),_0x27cb38[_0x261f('0x5')],_0x27cb38['context'],_0x27cb38['exten']));recordings[_0x27cb38[_0x261f('0x5')]]={'uniqueid':_0x27cb38[_0x261f('0x5')],'accountcode':_0x27cb38[_0x261f('0x8')],'exten':_0x27cb38['exten'],'context':_0x27cb38[_0x261f('0x14')],'channel':_0x27cb38['channel'],'monitors':[]};}}catch(_0x269e74){utils[_0x261f('0x15')](util['format'](_0x261f('0x11'),_0x27cb38['uniqueid']),_0x269e74);}};exports[_0x261f('0x16')]=function(_0xa64a59){try{utils[_0x261f('0x17')](util[_0x261f('0x3')](_0x261f('0x18'),_0xa64a59[_0x261f('0x5')]),_0xa64a59);if(!_[_0x261f('0x19')](recordings[_0xa64a59[_0x261f('0x5')]])&&_0xa64a59[_0x261f('0x1a')]==0x6){utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x1c'),_0xa64a59['uniqueid'],_0xa64a59['context'],_0xa64a59[_0x261f('0x1d')]));}else if(!_['isNil'](recordings[_0xa64a59[_0x261f('0x12')]])&&_0xa64a59[_0x261f('0x1a')]==0x6&&_0xa64a59[_0x261f('0x14')]!='transfer'){utils['info'](util[_0x261f('0x3')](_0x261f('0x1e'),_0xa64a59[_0x261f('0x5')],_0xa64a59[_0x261f('0x12')],_0xa64a59[_0x261f('0x14')],_0xa64a59['channel']));recordings[_0xa64a59[_0x261f('0x12')]]['accountcode']=_0xa64a59[_0x261f('0x8')];}}catch(_0x27e807){utils[_0x261f('0x15')](util['format'](_0x261f('0x18'),_0xa64a59[_0x261f('0x5')]),_0x27e807);}};exports[_0x261f('0x1f')]=function(_0x51f38c){try{if(!_[_0x261f('0x19')](_0x51f38c[_0x261f('0x20')])&&!_['isNil'](_0x51f38c[_0x261f('0x20')][_0x261f('0x21')])){utils['debug'](util['format'](_0x261f('0x22'),_0x51f38c[_0x261f('0x5')]),_0x51f38c);utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x23'),_0x51f38c[_0x261f('0x5')],_0x51f38c['variable'],_0x51f38c[_0x261f('0x24')]));if(_['endsWith'](_0x51f38c[_0x261f('0x24')],'.wav49')){_0x51f38c[_0x261f('0x24')]=_0x51f38c[_0x261f('0x24')]['replace'](_0x261f('0x25'),_0x261f('0x26'));}if(recordings[_0x51f38c[_0x261f('0x12')]]){var _0x5867f2=_[_0x261f('0x27')](recordings[_0x51f38c['linkedid']][_0x261f('0x28')],{'value':_0x51f38c[_0x261f('0x24')]});if(_[_0x261f('0x19')](_0x5867f2)){recordings[_0x51f38c[_0x261f('0x12')]][_0x261f('0x28')][_0x261f('0x29')]({'value':_0x51f38c[_0x261f('0x24')]});}}}}catch(_0x22f805){utils[_0x261f('0x15')](util['format']('[%s][recordings][varset]',_0x51f38c[_0x261f('0x5')]),_0x22f805);}};exports['hangup']=function(_0x39e939){try{if(!_[_0x261f('0x19')](recordings[_0x39e939[_0x261f('0x5')]])){utils['debug'](util['format'](_0x261f('0x2a'),_0x39e939[_0x261f('0x5')]),_0x39e939);utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x2b'),_0x39e939[_0x261f('0x5')],_0x39e939[_0x261f('0x2c')],_0x39e939[_0x261f('0x2d')],_0x39e939[_0x261f('0x2e')]));recordings[_0x39e939[_0x261f('0x5')]][_0x261f('0x2c')]=_0x39e939['calleridnum'];recordings[_0x39e939['uniqueid']][_0x261f('0x2d')]=_0x39e939[_0x261f('0x2d')];recordings[_0x39e939['uniqueid']][_0x261f('0x2f')]=_0x39e939[_0x261f('0x2f')];recordings[_0x39e939[_0x261f('0x5')]][_0x261f('0x30')]=_0x39e939[_0x261f('0x30')];if(recordings[_0x39e939[_0x261f('0x5')]][_0x261f('0x31')]==_0x261f('0x32')&&recordings[_0x39e939[_0x261f('0x5')]]['accountcode']){recordings[_0x39e939[_0x261f('0x5')]]['connectedlinenum']=recordings[_0x39e939['uniqueid']][_0x261f('0x8')];recordings[_0x39e939['uniqueid']][_0x261f('0x30')]='';}recordings[_0x39e939[_0x261f('0x5')]]['monitors'][_0x261f('0x33')](function(_0x5ae855){var _0x2dfd03=_[_0x261f('0x34')](recordings[_0x39e939[_0x261f('0x5')]]);_0x2dfd03[_0x261f('0x24')]=_0x5ae855[_0x261f('0x24')];writeDB(_0x2dfd03);});delete recordings[_0x39e939[_0x261f('0x5')]];}}catch(_0x5d5ce5){utils[_0x261f('0x15')](util['format'](_0x261f('0x2a'),_0x39e939['uniqueid']),_0x5d5ce5);}};exports['newexten']=function(_0x1ef06e){try{if(!_[_0x261f('0x19')](recordings[_0x1ef06e[_0x261f('0x5')]])){utils['debug'](util[_0x261f('0x3')]('[%s][recordings][newexten]',_0x1ef06e[_0x261f('0x5')]),_0x1ef06e);utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x35'),_0x1ef06e[_0x261f('0x5')],_0x1ef06e['application'],_0x1ef06e[_0x261f('0x36')]));if(_0x1ef06e['application'][_0x261f('0x37')]()==_0x261f('0x38')&&_[_0x261f('0x39')](_0x1ef06e[_0x261f('0x36')][_0x261f('0x37')](),_0x261f('0x3a'))){var _0x5e63d6=_0x1ef06e['appdata'][_0x261f('0x3b')]('=');var _0x1b6df4=_0x5e63d6[0x0][_0x261f('0x3c')](_0x5e63d6[0x0][_0x261f('0x3d')]('(')+0x1,_0x5e63d6[0x0][_0x261f('0x3d')](')'));var _0x4d35c7=_0x5e63d6[0x1];recordings[_0x1ef06e[_0x261f('0x5')]][_0x1b6df4]=_0x4d35c7;}}}catch(_0x5ddacc){utils[_0x261f('0x15')](util[_0x261f('0x3')](_0x261f('0x3e'),_0x1ef06e[_0x261f('0x5')]),_0x5ddacc);}};exports[_0x261f('0x3f')]=function(_0x48f7c0){try{if(!_['isNil'](recordings[_0x48f7c0[_0x261f('0x5')]])){utils[_0x261f('0x17')](util['format'](_0x261f('0x40'),_0x48f7c0[_0x261f('0x5')]),_0x48f7c0);utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x41'),_0x48f7c0[_0x261f('0x5')],_0x48f7c0[_0x261f('0x42')]));recordings[_0x48f7c0['uniqueid']][_0x261f('0x42')]=_0x48f7c0[_0x261f('0x42')];}}catch(_0x58ea06){utils[_0x261f('0x15')](util[_0x261f('0x3')](_0x261f('0x40'),_0x48f7c0[_0x261f('0x5')]),_0x58ea06);}};exports['blindtransfer']=function(_0x404927){try{utils[_0x261f('0x17')](util['format'](_0x261f('0x43'),_0x404927[_0x261f('0x5')]),_0x404927);utils[_0x261f('0x1b')](util[_0x261f('0x3')](_0x261f('0x44'),_0x404927[_0x261f('0x5')],_0x404927[_0x261f('0x45')],_0x404927[_0x261f('0x46')],_0x404927[_0x261f('0x47')],_0x404927[_0x261f('0x48')]));if(recordings[_0x404927[_0x261f('0x49')]]&&transfers[_0x261f('0x6')][_0x404927[_0x261f('0x49')]]){transfers[_0x261f('0x6')][_0x404927[_0x261f('0x49')]][_0x261f('0x4a')]=!![];}}catch(_0x3721fa){utils[_0x261f('0x15')](util['format']('[%s][recordings][blindtransfer]',_0x404927[_0x261f('0x5')]),_0x3721fa);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b8d629f..2f8804f 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 _0xa2fe=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x3b6160,_0x45d946){var _0x2dcbbe=function(_0x8e71d2){while(--_0x8e71d2){_0x3b6160['push'](_0x3b6160['shift']());}};_0x2dcbbe(++_0x45d946);}(_0xa2fe,0x124));var _0xea2f=function(_0x11167c,_0xb0ff07){_0x11167c=_0x11167c-0x0;var _0x34bdb0=_0xa2fe[_0x11167c];return _0x34bdb0;};'use strict';var _=require(_0xea2f('0x0'));var util=require('util');var utils=require(_0xea2f('0x1'));function writeDB(_0x323e44){utils[_0xea2f('0x2')](util[_0xea2f('0x3')](_0xea2f('0x4'),_0x323e44['type']==='attended'?_0x323e44[_0xea2f('0x5')]:_0x323e44[_0xea2f('0x6')],_0x323e44[_0xea2f('0x7')]));utils[_0xea2f('0x8')](_0xea2f('0x9'),_0x323e44);}exports[_0xea2f('0xa')]={};exports[_0xea2f('0xb')]=function(_0x16ddf7){try{utils['debug'](util['format'](_0xea2f('0xc'),_0x16ddf7['uniqueid']),_0x16ddf7);utils[_0xea2f('0x2')](util[_0xea2f('0x3')](_0xea2f('0xd'),_0x16ddf7['uniqueid'],_0x16ddf7[_0xea2f('0xe')],_0x16ddf7[_0xea2f('0xf')],_0x16ddf7[_0xea2f('0x10')],_0x16ddf7['transfereecalleridname']));_0x16ddf7[_0xea2f('0x7')]=_0xea2f('0x11');exports['blinds'][_0x16ddf7[_0xea2f('0x12')]]=_0x16ddf7;writeDB(_0x16ddf7);}catch(_0x4cf481){utils[_0xea2f('0x13')](util[_0xea2f('0x3')](_0xea2f('0xc'),_0x16ddf7['uniqueid']),_0x4cf481);}};exports[_0xea2f('0x14')]=function(_0xdea749){try{utils[_0xea2f('0x15')](util['format'](_0xea2f('0x16'),_0xdea749[_0xea2f('0x5')]),_0xdea749);utils[_0xea2f('0x2')](util[_0xea2f('0x3')](_0xea2f('0x17'),_0xdea749[_0xea2f('0x5')],_0xdea749[_0xea2f('0x18')],_0xdea749[_0xea2f('0x19')],_0xdea749[_0xea2f('0x1a')],_0xdea749['transfertargetcalleridname']));_0xdea749=_['assign'](_0xdea749,{'transfererchannel':_0xdea749[_0xea2f('0x1b')],'transferercalleridnum':_0xdea749[_0xea2f('0x18')],'transferercalleridname':_0xdea749[_0xea2f('0x19')],'transfererconnectedlinenum':_0xdea749[_0xea2f('0x1c')],'transfererconnectedlinename':_0xdea749['secondtransfererconnectedlinename'],'transfereraccountcode':_0xdea749[_0xea2f('0x1d')],'transferercontext':_0xdea749[_0xea2f('0x1e')],'transfererexten':_0xdea749[_0xea2f('0x1f')],'transfererlinkedid':_0xdea749[_0xea2f('0x20')],'context':_0xdea749[_0xea2f('0x21')],'extension':_0xdea749[_0xea2f('0x22')],'type':_0xea2f('0x23')});if(_[_0xea2f('0x24')](_0xdea749[_0xea2f('0x25')])){_0xdea749=_[_0xea2f('0x26')](_0xdea749,{'transfereechannel':_0xdea749[_0xea2f('0x27')],'transfereecalleridnum':_0xdea749['transfertargetcalleridnum'],'transfereecalleridname':_0xdea749[_0xea2f('0x28')],'transfereeconnectedlinenum':_0xdea749[_0xea2f('0x29')],'transfereeconnectedlinename':_0xdea749[_0xea2f('0x2a')],'transfereeaccountcode':_0xdea749[_0xea2f('0x2b')],'transfereecontext':_0xdea749[_0xea2f('0x2c')],'transfereeexten':_0xdea749[_0xea2f('0x2d')],'transfereelinkedid':_0xdea749['transfertargetlinkedid']});}writeDB(_0xdea749);}catch(_0x4772c4){utils[_0xea2f('0x13')](util['format']('[%s][transfers][attendedtransfer]',_0xdea749['origtransfereruniqueid']),_0x4772c4);}}; \ No newline at end of file +var _0xb883=['attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x1fb6df,_0x1750ab){var _0x6ca783=function(_0x5c9252){while(--_0x5c9252){_0x1fb6df['push'](_0x1fb6df['shift']());}};_0x6ca783(++_0x1750ab);}(_0xb883,0x97));var _0x3b88=function(_0x3c94b7,_0x1eed31){_0x3c94b7=_0x3c94b7-0x0;var _0xb14f02=_0xb883[_0x3c94b7];return _0xb14f02;};'use strict';var _=require('lodash');var util=require(_0x3b88('0x0'));var utils=require(_0x3b88('0x1'));function writeDB(_0x46660e){utils[_0x3b88('0x2')](util['format'](_0x3b88('0x3'),_0x46660e[_0x3b88('0x4')]===_0x3b88('0x5')?_0x46660e[_0x3b88('0x6')]:_0x46660e[_0x3b88('0x7')],_0x46660e[_0x3b88('0x4')]));utils[_0x3b88('0x8')](_0x3b88('0x9'),_0x46660e);}exports['blinds']={};exports[_0x3b88('0xa')]=function(_0x5e433f){try{utils[_0x3b88('0xb')](util[_0x3b88('0xc')](_0x3b88('0xd'),_0x5e433f[_0x3b88('0x7')]),_0x5e433f);utils['info'](util[_0x3b88('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5e433f[_0x3b88('0x7')],_0x5e433f['transferercalleridnum'],_0x5e433f[_0x3b88('0xe')],_0x5e433f[_0x3b88('0xf')],_0x5e433f[_0x3b88('0x10')]));_0x5e433f[_0x3b88('0x4')]='blind';exports[_0x3b88('0x11')][_0x5e433f[_0x3b88('0x12')]]=_0x5e433f;writeDB(_0x5e433f);}catch(_0x4c47bd){utils['error'](util[_0x3b88('0xc')](_0x3b88('0xd'),_0x5e433f['uniqueid']),_0x4c47bd);}};exports[_0x3b88('0x13')]=function(_0x3b85ed){try{utils[_0x3b88('0xb')](util['format'](_0x3b88('0x14'),_0x3b85ed[_0x3b88('0x6')]),_0x3b85ed);utils[_0x3b88('0x2')](util[_0x3b88('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3b85ed[_0x3b88('0x6')],_0x3b85ed['origtransferercalleridnum'],_0x3b85ed['origtransferercalleridname'],_0x3b85ed[_0x3b88('0x15')],_0x3b85ed[_0x3b88('0x16')]));_0x3b85ed=_[_0x3b88('0x17')](_0x3b85ed,{'transfererchannel':_0x3b85ed[_0x3b88('0x18')],'transferercalleridnum':_0x3b85ed[_0x3b88('0x19')],'transferercalleridname':_0x3b85ed[_0x3b88('0x1a')],'transfererconnectedlinenum':_0x3b85ed[_0x3b88('0x1b')],'transfererconnectedlinename':_0x3b85ed['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3b85ed['origtransfereraccountcode'],'transferercontext':_0x3b85ed['secondtransferercontext'],'transfererexten':_0x3b85ed['secondtransfererexten'],'transfererlinkedid':_0x3b85ed[_0x3b88('0x1c')],'context':_0x3b85ed[_0x3b88('0x1d')],'extension':_0x3b85ed[_0x3b88('0x1e')],'type':_0x3b88('0x5')});if(_[_0x3b88('0x1f')](_0x3b85ed[_0x3b88('0x20')])){_0x3b85ed=_[_0x3b88('0x17')](_0x3b85ed,{'transfereechannel':_0x3b85ed[_0x3b88('0x21')],'transfereecalleridnum':_0x3b85ed[_0x3b88('0x15')],'transfereecalleridname':_0x3b85ed[_0x3b88('0x16')],'transfereeconnectedlinenum':_0x3b85ed[_0x3b88('0x22')],'transfereeconnectedlinename':_0x3b85ed[_0x3b88('0x23')],'transfereeaccountcode':_0x3b85ed['transfertargetaccountcode'],'transfereecontext':_0x3b85ed[_0x3b88('0x24')],'transfereeexten':_0x3b85ed[_0x3b88('0x25')],'transfereelinkedid':_0x3b85ed[_0x3b88('0x26')]});}writeDB(_0x3b85ed);}catch(_0x4617f2){utils['error'](util[_0x3b88('0xc')](_0x3b88('0x14'),_0x3b85ed['origtransfereruniqueid']),_0x4617f2);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0b2b986..85b2deb 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 _0xd61b=['client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util'];(function(_0x12196e,_0x4b2d58){var _0x24d273=function(_0x1167d7){while(--_0x1167d7){_0x12196e['push'](_0x12196e['shift']());}};_0x24d273(++_0x4b2d58);}(_0xd61b,0xbd));var _0xbd61=function(_0x58eb93,_0x3b8263){_0x58eb93=_0x58eb93-0x0;var _0xc0d5c0=_0xd61b[_0x58eb93];return _0xc0d5c0;};'use strict';var BPromise=require(_0xbd61('0x0'));var jayson=require(_0xbd61('0x1'));var moment=require('moment');var util=require(_0xbd61('0x2'));var client=jayson[_0xbd61('0x3')][_0xbd61('0x4')]({'port':0x2329});var logger=require(_0xbd61('0x5'))(_0xbd61('0x6'));exports[_0xbd61('0x7')]=function(_0x416dfc,_0x23ab9c){logger[_0xbd61('0x7')](_0x416dfc,_0x23ab9c?util[_0xbd61('0x8')](_0x23ab9c,{'showHidden':![],'depth':null}):'');};exports[_0xbd61('0x9')]=function(_0x5a7154,_0x1f1118){logger[_0xbd61('0x9')](_0x5a7154,_0x1f1118?util['inspect'](_0x1f1118,{'showHidden':![],'depth':null}):'');};exports[_0xbd61('0xa')]=function(_0x59becb,_0x21b8a9){logger[_0xbd61('0xa')](_0x59becb,_0x21b8a9?util['inspect'](_0x21b8a9,{'showHidden':![],'depth':null}):'');};exports[_0xbd61('0xb')]=function(_0x3d2fde,_0x13d367){return client[_0xbd61('0xb')](_0x3d2fde,{'body':_0x13d367})[_0xbd61('0xc')](function(_0x155eea){logger[_0xbd61('0x9')](_0xbd61('0xd'),_0x3d2fde,_0x155eea?util[_0xbd61('0x8')](_0x155eea,{'showHidden':![],'depth':null}):'');})[_0xbd61('0xe')](function(_0x45749e){logger['error']('[utils][request]\x20name:%s',_0x3d2fde,_0x45749e?util['inspect'](_0x45749e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x467927){return client[_0xbd61('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbd61('0xf'),_0xbd61('0x10'),_0xbd61('0x11')],'where':_0x467927,'limit':0x1}})['then'](function(_0x8808d3){logger[_0xbd61('0x9')](_0xbd61('0x12'),JSON[_0xbd61('0x13')](_0x467927),_0x8808d3?util[_0xbd61('0x8')](_0x8808d3,{'showHidden':![],'depth':null}):'');return _0x8808d3['result']['length']?_0x8808d3[_0xbd61('0x14')][0x0]:null;});}exports[_0xbd61('0x15')]=function(_0x3318ca){return new BPromise(function(_0x47c389,_0x35937a){if(_0x3318ca){return getUser({'internal':_0x3318ca})[_0xbd61('0xc')](function(_0x521966){logger['info'](_0xbd61('0x16'),_0x3318ca,_0x521966?_0xbd61('0x17'):_0xbd61('0x18'));return _0x47c389(_0x521966);})['catch'](function(_0x524278){logger[_0xbd61('0xa')](_0xbd61('0x19'),_0x524278?util['inspect'](_0x524278,{'showHidden':![],'depth':null}):'');return _0x47c389(null);});}return _0x47c389(null);});};exports[_0xbd61('0x1a')]=function(_0x24104c){return new BPromise(function(_0xda476d,_0x5ac9e5){if(_0x24104c){return getUser({'interface':_0x24104c})[_0xbd61('0xc')](function(_0x2b5ec6){logger[_0xbd61('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x24104c,_0x2b5ec6?'found':_0xbd61('0x18'));return _0xda476d(_0x2b5ec6);})[_0xbd61('0xe')](function(_0x59922c){logger[_0xbd61('0xa')](_0xbd61('0x1b'),_0x59922c?util[_0xbd61('0x8')](_0x59922c,{'showHidden':![],'depth':null}):'');return _0xda476d(null);});}return _0xda476d(null);});};exports[_0xbd61('0x1c')]=function(_0x39aeee){return new BPromise(function(_0x4695cf,_0xb67d4b){if(_0x39aeee){return getUser({'name':_0x39aeee})[_0xbd61('0xc')](function(_0x43bc1d){logger[_0xbd61('0x7')](_0xbd61('0x1d'),_0x39aeee,_0x43bc1d?_0xbd61('0x17'):'notfound');return _0x4695cf(_0x43bc1d);})[_0xbd61('0xe')](function(_0x52b612){logger[_0xbd61('0xa')](_0xbd61('0x1e'),_0x52b612?util['inspect'](_0x52b612,{'showHidden':![],'depth':null}):'');return _0x4695cf(null);});}return _0x4695cf(null);});};exports[_0xbd61('0x1f')]=function(_0x16369b){return new BPromise(function(_0x5af0b8,_0x19b572){if(_0x16369b){return client[_0xbd61('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type',_0xbd61('0x20'),_0xbd61('0x21')],'where':{'name':_0x16369b},'limit':0x1}})[_0xbd61('0xc')](function(_0x126dcc){logger[_0xbd61('0x9')](_0xbd61('0x22'),_0x16369b,_0x126dcc?util[_0xbd61('0x8')](_0x126dcc,{'showHidden':![],'depth':null}):'');logger[_0xbd61('0x7')](_0xbd61('0x23'),_0x16369b,_0x126dcc?_0xbd61('0x17'):_0xbd61('0x18'));return _0x5af0b8(_0x126dcc[_0xbd61('0x14')]['length']?_0x126dcc[_0xbd61('0x14')][0x0]:null);})[_0xbd61('0xe')](function(_0x427aca){logger[_0xbd61('0xa')](_0xbd61('0x24'),_0x427aca?util[_0xbd61('0x8')](_0x427aca,{'showHidden':![],'depth':null}):'');return _0x5af0b8(null);});}return _0x5af0b8(null);});};exports[_0xbd61('0x25')]=function(_0x2536c9,_0x397728){return moment(_0x2536c9)[_0xbd61('0x26')](_0x397728,_0xbd61('0x27'))['format'](_0xbd61('0x28'));};exports[_0xbd61('0x29')]=function(_0x2131a9,_0x417ff5){return moment(_0x2131a9)[_0xbd61('0x2a')](_0x417ff5,_0xbd61('0x27'))[_0xbd61('0x2b')](_0xbd61('0x28'));};exports['diffTime']=function(_0x1c4ceb,_0x416c81){return moment(_0x1c4ceb)['diff'](moment(_0x416c81),_0xbd61('0x27'));};exports[_0xbd61('0x2c')]=function(_0x45bf19,_0x28e0e8){return parseInt(_0x45bf19,0xa)+parseInt(_0x28e0e8,0xa);};exports[_0xbd61('0x2d')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x567e24,_0x2b9c50){if(_0x2b9c50){return moment(_0x567e24)[_0xbd61('0x2e')](_0x2b9c50);}return!![];};exports['isBefore']=function(_0x20c22b,_0xaccd19){if(_0xaccd19){return moment(_0x20c22b)[_0xbd61('0x2f')](_0xaccd19);}else if(_0x20c22b){return!![];}return![];}; \ No newline at end of file +var _0x98c6=['addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]'];(function(_0x5d56ab,_0xd0f2c7){var _0x3aab84=function(_0x2cd4aa){while(--_0x2cd4aa){_0x5d56ab['push'](_0x5d56ab['shift']());}};_0x3aab84(++_0xd0f2c7);}(_0x98c6,0x15a));var _0x698c=function(_0x3f8e8c,_0x5174c0){_0x3f8e8c=_0x3f8e8c-0x0;var _0x3d71ca=_0x98c6[_0x3f8e8c];return _0x3d71ca;};'use strict';var BPromise=require(_0x698c('0x0'));var jayson=require(_0x698c('0x1'));var moment=require(_0x698c('0x2'));var util=require(_0x698c('0x3'));var client=jayson[_0x698c('0x4')]['http']({'port':0x2329});var logger=require(_0x698c('0x5'))(_0x698c('0x6'));exports['info']=function(_0xb3e9f2,_0x5e0a43){logger[_0x698c('0x7')](_0xb3e9f2,_0x5e0a43?util['inspect'](_0x5e0a43,{'showHidden':![],'depth':null}):'');};exports[_0x698c('0x8')]=function(_0x17e60a,_0x2e3b02){logger[_0x698c('0x8')](_0x17e60a,_0x2e3b02?util[_0x698c('0x9')](_0x2e3b02,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4373ee,_0x70707c){logger[_0x698c('0xa')](_0x4373ee,_0x70707c?util[_0x698c('0x9')](_0x70707c,{'showHidden':![],'depth':null}):'');};exports[_0x698c('0xb')]=function(_0x35e255,_0x8edd2){return client['request'](_0x35e255,{'body':_0x8edd2})[_0x698c('0xc')](function(_0x4f1574){logger[_0x698c('0x8')]('[utils][request]\x20name:%s',_0x35e255,_0x4f1574?util['inspect'](_0x4f1574,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5e363d){logger[_0x698c('0xa')](_0x698c('0xd'),_0x35e255,_0x5e363d?util[_0x698c('0x9')](_0x5e363d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x21764e){return client[_0x698c('0xb')](_0x698c('0xe'),{'options':{'raw':!![],'attributes':['id',_0x698c('0xf'),_0x698c('0x10'),_0x698c('0x11')],'where':_0x21764e,'limit':0x1}})['then'](function(_0x27b69d){logger[_0x698c('0x8')](_0x698c('0x12'),JSON[_0x698c('0x13')](_0x21764e),_0x27b69d?util[_0x698c('0x9')](_0x27b69d,{'showHidden':![],'depth':null}):'');return _0x27b69d['result']['length']?_0x27b69d[_0x698c('0x14')][0x0]:null;});}exports[_0x698c('0x15')]=function(_0x1009a9){return new BPromise(function(_0x5f1948,_0x121e60){if(_0x1009a9){return getUser({'internal':_0x1009a9})['then'](function(_0x3f3421){logger[_0x698c('0x7')](_0x698c('0x16'),_0x1009a9,_0x3f3421?_0x698c('0x17'):'notfound');return _0x5f1948(_0x3f3421);})[_0x698c('0x18')](function(_0x39c7f6){logger[_0x698c('0xa')]('[utils][getUserByInternal]',_0x39c7f6?util['inspect'](_0x39c7f6,{'showHidden':![],'depth':null}):'');return _0x5f1948(null);});}return _0x5f1948(null);});};exports[_0x698c('0x19')]=function(_0x1b1e1b){return new BPromise(function(_0x4e8eaa,_0x4a8bb4){if(_0x1b1e1b){return getUser({'interface':_0x1b1e1b})[_0x698c('0xc')](function(_0x3b3f21){logger[_0x698c('0x7')](_0x698c('0x1a'),_0x1b1e1b,_0x3b3f21?'found':_0x698c('0x1b'));return _0x4e8eaa(_0x3b3f21);})['catch'](function(_0x489eff){logger[_0x698c('0xa')]('[utils][getUserByInterface]',_0x489eff?util['inspect'](_0x489eff,{'showHidden':![],'depth':null}):'');return _0x4e8eaa(null);});}return _0x4e8eaa(null);});};exports[_0x698c('0x1c')]=function(_0x2ad6e5){return new BPromise(function(_0x5072ae,_0xb263b9){if(_0x2ad6e5){return getUser({'name':_0x2ad6e5})['then'](function(_0x4ba6fd){logger['info'](_0x698c('0x1d'),_0x2ad6e5,_0x4ba6fd?_0x698c('0x17'):_0x698c('0x1b'));return _0x5072ae(_0x4ba6fd);})[_0x698c('0x18')](function(_0x54cd9f){logger[_0x698c('0xa')](_0x698c('0x1e'),_0x54cd9f?util[_0x698c('0x9')](_0x54cd9f,{'showHidden':![],'depth':null}):'');return _0x5072ae(null);});}return _0x5072ae(null);});};exports[_0x698c('0x1f')]=function(_0x489fb7){return new BPromise(function(_0x392a14,_0x4be050){if(_0x489fb7){return client[_0x698c('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x698c('0x10'),_0x698c('0x20'),_0x698c('0x21'),_0x698c('0x22')],'where':{'name':_0x489fb7},'limit':0x1}})['then'](function(_0x56ad1f){logger[_0x698c('0x8')](_0x698c('0x23'),_0x489fb7,_0x56ad1f?util['inspect'](_0x56ad1f,{'showHidden':![],'depth':null}):'');logger[_0x698c('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x489fb7,_0x56ad1f?_0x698c('0x17'):_0x698c('0x1b'));return _0x392a14(_0x56ad1f[_0x698c('0x14')][_0x698c('0x24')]?_0x56ad1f[_0x698c('0x14')][0x0]:null);})[_0x698c('0x18')](function(_0x421e8a){logger[_0x698c('0xa')](_0x698c('0x25'),_0x421e8a?util[_0x698c('0x9')](_0x421e8a,{'showHidden':![],'depth':null}):'');return _0x392a14(null);});}return _0x392a14(null);});};exports[_0x698c('0x26')]=function(_0xba0a8e,_0x516e96){return moment(_0xba0a8e)['add'](_0x516e96,_0x698c('0x27'))[_0x698c('0x28')](_0x698c('0x29'));};exports[_0x698c('0x2a')]=function(_0x54cdde,_0x184a85){return moment(_0x54cdde)[_0x698c('0x2b')](_0x184a85,'seconds')[_0x698c('0x28')](_0x698c('0x29'));};exports['diffTime']=function(_0x3758cb,_0x6b2dfd){return moment(_0x3758cb)['diff'](moment(_0x6b2dfd),_0x698c('0x27'));};exports[_0x698c('0x2c')]=function(_0x30b10f,_0x6bed1a){return parseInt(_0x30b10f,0xa)+parseInt(_0x6bed1a,0xa);};exports[_0x698c('0x2d')]=function(){return moment()['format'](_0x698c('0x29'));};exports[_0x698c('0x2e')]=function(_0x3aa834,_0x705131){if(_0x705131){return moment(_0x3aa834)[_0x698c('0x2e')](_0x705131);}return!![];};exports['isBefore']=function(_0x441b4f,_0x55d839){if(_0x55d839){return moment(_0x441b4f)[_0x698c('0x2f')](_0x55d839);}else if(_0x441b4f){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 895c29b..747a6d5 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x418b=['logger','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','name','other','agent_id','agent_name','test','setupLoggers','lodash','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','join','log','xcally','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect'];(function(_0x2d10f7,_0x36abd0){var _0x94c2f7=function(_0xcb5708){while(--_0xcb5708){_0x2d10f7['push'](_0x2d10f7['shift']());}};_0x94c2f7(++_0x36abd0);}(_0x418b,0xf0));var _0xb418=function(_0x349b82,_0x42b209){_0x349b82=_0x349b82-0x0;var _0x23e456=_0x418b[_0x349b82];return _0x23e456;};var fs=require('fs-extra');var _=require(_0xb418('0x0'));var ewinston=require('express-winston');var path=require(_0xb418('0x1'));var util=require(_0xb418('0x2'));var fileLogger=require(_0xb418('0x3'))['fileLogger'];var safeTemplate=require(_0xb418('0x4'))[_0xb418('0x5')];var maskSensitiveData=require(_0xb418('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x753262(_0x3f63cd){var _0x55aaa8=path[_0xb418('0x7')]('/var',_0xb418('0x8'),_0xb418('0x9'));var _0x16fd6d=path[_0xb418('0x7')](_0xb418('0xa'),_0x3f63cd[_0xb418('0xb')]+'-'+_0x3f63cd['name']);return fs[_0xb418('0xc')](path[_0xb418('0x7')](_0x55aaa8,_0x16fd6d))[_0xb418('0xd')](function(){var _0x2e2d8c=fileLogger('client',path[_0xb418('0x7')](_0x55aaa8,_0x16fd6d));return _0x2e2d8c;})[_0xb418('0xe')](function(_0x14838b){throw _0x14838b;});}this[_0xb418('0x8')]=function(_0x17e19c,_0x53025e,_0x1b9309,_0x19154f){return _0x753262(_0x17e19c[_0xb418('0xf')])['then'](function(_0x5336ae){var _0x3092c8=_0x5336ae[_0x53025e];return _0x3092c8;})[_0xb418('0xd')](function(_0x1f983b){var _0x4a7ff7=_0x17e19c['user']?_0x17e19c[_0xb418('0xf')]['id']:_0xb418('0x10');var _0x4e0179=_0x19154f[_0xb418('0x11')];var _0x58daa5=_0x19154f[_0xb418('0x12')];var _0x5550f6=new Date(Number(_0x58daa5));return _0x1f983b(_0x4a7ff7,_0x5550f6,_0x1b9309,_0x4e0179);})[_0xb418('0xe')](function(_0xfd6d56){fileLogger('client')[_0xb418('0x13')](_0xfd6d56);});};}function setupLoggers(_0xd45348){return new Promise(function(_0x12c089){var _0x2d6f3f=new ClientSideLogger();var _0x394030=fileLogger(_0xb418('0x14'));var _0x21b4b8=fileLogger(_0xb418('0x15'));_0xd45348['set']('client-side-logger',_0x2d6f3f);_0xd45348[_0xb418('0x16')](ewinston['logger']({'winstonInstance':_0x394030,'meta':![],'statusLevels':!![],'msg':function(_0x5625db,_0x3aeab7){var _0x42b2c5=_0xb418('0x17');if(!_[_0xb418('0x18')](_0x5625db[_0xb418('0x19')])){_0x42b2c5+=_0xb418('0x1a');var _0x2c7e0a=_0x5625db[_0xb418('0x19')];maskSensitiveData(_0x2c7e0a);}return safeTemplate(util[_0xb418('0x1b')](_0x42b2c5,_0x5625db[_0xb418('0x1c')],_0x5625db[_0xb418('0x1d')][_0xb418('0x1e')]?_0x5625db[_0xb418('0x1d')]['x-forwarded-for']:_0x5625db[_0xb418('0x1f')][_0xb418('0x20')]||_0x5625db['ip'],_0x5625db['url'],_0x3aeab7[_0xb418('0x21')],_0x3aeab7[_0xb418('0x22')],_0x5625db[_0xb418('0xf')]?_0x5625db[_0xb418('0xf')]['id']:null,_0x5625db['user']?_0x5625db[_0xb418('0xf')]['name']:null,_0x5625db['user']?_0x5625db[_0xb418('0xf')][_0xb418('0xb')]:null,_0x2c7e0a?util[_0xb418('0x23')](_0x2c7e0a,![],null):''));}}));_0xd45348[_0xb418('0x16')](ewinston[_0xb418('0x24')]({'winstonInstance':_0x21b4b8,'meta':![],'statusLevels':!![],'msg':function(_0x39a677,_0x1f7d23){var _0x3732bc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x39a677['body']&&_0x39a677[_0xb418('0x19')][_0xb418('0x25')]&&_0x39a677[_0xb418('0x19')]['agent_id']){_0x3732bc=_0xb418('0x26');}return util['format'](_0x3732bc,_0x39a677['method'],_0x39a677[_0xb418('0x1d')][_0xb418('0x1e')]?_0x39a677['headers'][_0xb418('0x1e')]:_0x39a677[_0xb418('0x1f')][_0xb418('0x20')]||_0x39a677['ip'],_0x39a677[_0xb418('0x27')],_0x1f7d23['statusCode'],_0x1f7d23['responseTime'],_0x39a677['user']?_0x39a677[_0xb418('0xf')]['id']:null,_0x39a677[_0xb418('0xf')]?_0x39a677[_0xb418('0xf')][_0xb418('0x28')]:null,_0x39a677[_0xb418('0xf')]?_0x39a677['user'][_0xb418('0xb')]:null,_0x39a677[_0xb418('0x19')]&&_0x39a677['body'][_0xb418('0x25')]?_0x39a677[_0xb418('0x19')][_0xb418('0x25')]:_0xb418('0x29'),_0x39a677[_0xb418('0x19')]&&_0x39a677[_0xb418('0x19')]['agent_id']?_0x39a677[_0xb418('0x19')][_0xb418('0x2a')]:'',_0x39a677[_0xb418('0x19')]&&_0x39a677[_0xb418('0x19')][_0xb418('0x2b')]?_0x39a677[_0xb418('0x19')][_0xb418('0x2b')]:'');},'ignoreRoute':function(_0x2df85e){var _0x5e06bb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e06bb[_0xb418('0x2c')](_0x2df85e[_0xb418('0x27')]);}}));return _0x12c089();});}exports[_0xb418('0x2d')]=setupLoggers; \ No newline at end of file +var _0x59cb=['use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','data','timestamp','error','api','auth'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x59cb,0x1d8));var _0xb59c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x59cb[_0xfae23b];return _0x200640;};var fs=require(_0xb59c('0x0'));var _=require('lodash');var ewinston=require(_0xb59c('0x1'));var path=require(_0xb59c('0x2'));var util=require(_0xb59c('0x3'));var fileLogger=require(_0xb59c('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0xb59c('0x5'))[_0xb59c('0x6')];function ClientSideLogger(){function _0x1d6b4d(_0xe884eb){var _0x124d6c=path[_0xb59c('0x7')](_0xb59c('0x8'),_0xb59c('0x9'),_0xb59c('0xa'));var _0x534eca=path[_0xb59c('0x7')](_0xb59c('0xb'),_0xe884eb[_0xb59c('0xc')]+'-'+_0xe884eb[_0xb59c('0xd')]);return fs[_0xb59c('0xe')](path[_0xb59c('0x7')](_0x124d6c,_0x534eca))[_0xb59c('0xf')](function(){var _0x36a725=fileLogger('client',path[_0xb59c('0x7')](_0x124d6c,_0x534eca));return _0x36a725;})[_0xb59c('0x10')](function(_0x2e2ca1){throw _0x2e2ca1;});}this[_0xb59c('0x9')]=function(_0x3540ee,_0x19de3d,_0xf36c6,_0x2116af){return _0x1d6b4d(_0x3540ee[_0xb59c('0x11')])[_0xb59c('0xf')](function(_0x2c953d){var _0x11ea7c=_0x2c953d[_0x19de3d];return _0x11ea7c;})[_0xb59c('0xf')](function(_0x28d205){var _0x4ebe99=_0x3540ee[_0xb59c('0x11')]?_0x3540ee['user']['id']:'no-user';var _0xfd0395=_0x2116af[_0xb59c('0x12')];var _0x2fe683=_0x2116af[_0xb59c('0x13')];var _0x344bf9=new Date(Number(_0x2fe683));return _0x28d205(_0x4ebe99,_0x344bf9,_0xf36c6,_0xfd0395);})['catch'](function(_0x3cbfcf){fileLogger(_0xb59c('0xb'))[_0xb59c('0x14')](_0x3cbfcf);});};}function setupLoggers(_0x48c918){return new Promise(function(_0x2b760e){var _0x57b6db=new ClientSideLogger();var _0xe5d290=fileLogger(_0xb59c('0x15'));var _0x629a6=fileLogger(_0xb59c('0x16'));_0x48c918['set']('client-side-logger',_0x57b6db);_0x48c918[_0xb59c('0x17')](ewinston[_0xb59c('0x18')]({'winstonInstance':_0xe5d290,'meta':![],'statusLevels':!![],'msg':function(_0x438ae9,_0x491768){var _0x19bfca=_0xb59c('0x19');if(!_['isEmpty'](_0x438ae9[_0xb59c('0x1a')])){_0x19bfca+=_0xb59c('0x1b');var _0x1580d1=_0x438ae9[_0xb59c('0x1a')];maskSensitiveData(_0x1580d1);}return safeTemplate(util[_0xb59c('0x1c')](_0x19bfca,_0x438ae9[_0xb59c('0x1d')],_0x438ae9[_0xb59c('0x1e')][_0xb59c('0x1f')]?_0x438ae9[_0xb59c('0x1e')]['x-forwarded-for']:_0x438ae9[_0xb59c('0x20')]['remoteAddress']||_0x438ae9['ip'],_0x438ae9[_0xb59c('0x21')],_0x491768[_0xb59c('0x22')],_0x491768[_0xb59c('0x23')],_0x438ae9[_0xb59c('0x11')]?_0x438ae9[_0xb59c('0x11')]['id']:null,_0x438ae9['user']?_0x438ae9[_0xb59c('0x11')][_0xb59c('0xd')]:null,_0x438ae9[_0xb59c('0x11')]?_0x438ae9['user'][_0xb59c('0xc')]:null,_0x1580d1?util[_0xb59c('0x24')](_0x1580d1,![],null):''));}}));_0x48c918[_0xb59c('0x17')](ewinston[_0xb59c('0x18')]({'winstonInstance':_0x629a6,'meta':![],'statusLevels':!![],'msg':function(_0x19439e,_0x526448){var _0x25a0fe=_0xb59c('0x25');if(_0x19439e[_0xb59c('0x1a')]&&_0x19439e[_0xb59c('0x1a')][_0xb59c('0x26')]&&_0x19439e['body'][_0xb59c('0x27')]){_0x25a0fe='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb59c('0x1c')](_0x25a0fe,_0x19439e[_0xb59c('0x1d')],_0x19439e[_0xb59c('0x1e')]['x-forwarded-for']?_0x19439e[_0xb59c('0x1e')]['x-forwarded-for']:_0x19439e['connection'][_0xb59c('0x28')]||_0x19439e['ip'],_0x19439e[_0xb59c('0x21')],_0x526448[_0xb59c('0x22')],_0x526448['responseTime'],_0x19439e[_0xb59c('0x11')]?_0x19439e['user']['id']:null,_0x19439e[_0xb59c('0x11')]?_0x19439e[_0xb59c('0x11')]['name']:null,_0x19439e[_0xb59c('0x11')]?_0x19439e[_0xb59c('0x11')][_0xb59c('0xc')]:null,_0x19439e['body']&&_0x19439e[_0xb59c('0x1a')][_0xb59c('0x26')]?_0x19439e['body'][_0xb59c('0x26')]:_0xb59c('0x29'),_0x19439e['body']&&_0x19439e[_0xb59c('0x1a')][_0xb59c('0x27')]?_0x19439e[_0xb59c('0x1a')][_0xb59c('0x27')]:'',_0x19439e[_0xb59c('0x1a')]&&_0x19439e[_0xb59c('0x1a')][_0xb59c('0x2a')]?_0x19439e['body'][_0xb59c('0x2a')]:'');},'ignoreRoute':function(_0x478ae5){var _0x1e1776=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1e1776[_0xb59c('0x2b')](_0x478ae5[_0xb59c('0x21')]);}}));return _0x2b760e();});}exports[_0xb59c('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index c7d0d80..5d7c5bb 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf6e=['{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace'];(function(_0x47f680,_0x5a3ba0){var _0x21f47a=function(_0x691292){while(--_0x691292){_0x47f680['push'](_0x47f680['shift']());}};_0x21f47a(++_0x5a3ba0);}(_0xcf6e,0x12c));var _0xecf6=function(_0xd9295b,_0x121f60){_0xd9295b=_0xd9295b-0x0;var _0x53d62e=_0xcf6e[_0xd9295b];return _0x53d62e;};'use strict';var path=require(_0xecf6('0x0'));var util=require('util');var moment=require(_0xecf6('0x1'));var winston=require(_0xecf6('0x2'));var config=require(_0xecf6('0x3'));var debugLevel=config[_0xecf6('0x4')]?config[_0xecf6('0x4')][_0xecf6('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xecf6('0x6'),'error':_0xecf6('0x7'),'warn':_0xecf6('0x8'),'info':'white','print':'bold\x20white','success':'bold\x20green','http':_0xecf6('0x9'),'verbose':_0xecf6('0xa'),'debug':_0xecf6('0xb'),'silly':_0xecf6('0xc')};winston[_0xecf6('0xd')](XC_LOG_COLORS);function getLogFileName(_0x460168,_0x694d3e,_0x4d83f2){var _0x52014f=_0x460168||_0xecf6('0xe');return path[_0xecf6('0xf')](_0x52014f,util[_0xecf6('0x10')](_0xecf6('0x11'),_0x694d3e,_0x4d83f2));}function formatter(_0x42bb3c,_0x533991){_0x533991[_0xecf6('0x12')]=_0x533991[_0xecf6('0x12')][_0xecf6('0x13')](/@@{/g,_0xecf6('0x14'))[_0xecf6('0x13')](/}@@/g,'}}}')[_0xecf6('0x13')](/@{/g,'{{')[_0xecf6('0x13')](/}@/g,'}}');return util['format'](_0xecf6('0x15'),moment()[_0xecf6('0x10')](_0xecf6('0x16')),_0x533991[_0xecf6('0x17')][_0xecf6('0x18')](),_0x42bb3c,_0x533991[_0xecf6('0x12')]);}function fileFormat(_0x58ee49,_0xd5e46f){_0xd5e46f[_0xecf6('0x12')]=_0xd5e46f[_0xecf6('0x12')][_0xecf6('0x13')](/@@{/g,_0xecf6('0x14'))['replace'](/}@@/g,_0xecf6('0x19'))[_0xecf6('0x13')](/@{/g,'{{')[_0xecf6('0x13')](/}@/g,'}}');var _0x2c5ed5=_0xd5e46f[_0xecf6('0x1a')]&&Object[_0xecf6('0x1b')](_0xd5e46f[_0xecf6('0x1a')])[_0xecf6('0x1c')]?'\x0a\x09'+JSON[_0xecf6('0x1d')](_0xd5e46f['meta']):'';return util[_0xecf6('0x10')](_0xecf6('0x1e'),moment()['format'](_0xecf6('0x16')),_0xd5e46f[_0xecf6('0x17')][_0xecf6('0x18')](),_0x58ee49,_0xd5e46f[_0xecf6('0x12')],_0x2c5ed5);}function consoleLogger(){var _0x578e3a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xecf6('0x1f'))][(_0xecf6('0x20'))]({'level':_0xecf6('0x21'),'json':![],'formatter':function(_0x4632ae){return formatter('',_0x4632ae);}})]});return _0x578e3a;}function fileLogger(_0x135b2e,_0x1bef8f){var _0x451ccc=new winston[(_0xecf6('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xecf6('0x1f'))][(_0xecf6('0x23'))]({'name':util[_0xecf6('0x10')](_0xecf6('0x24'),_0x135b2e,_0xecf6('0x25')),'filename':getLogFileName(_0x1bef8f,_0x135b2e,_0xecf6('0x25')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2abd6e){return fileFormat(_0x135b2e,_0x2abd6e);}}),new winston[(_0xecf6('0x1f'))][(_0xecf6('0x23'))]({'name':util[_0xecf6('0x10')](_0xecf6('0x24'),_0x135b2e,debugLevel),'filename':getLogFileName(_0x1bef8f,_0x135b2e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x57cdd2){return fileFormat(_0x135b2e,_0x57cdd2);}}),new winston[(_0xecf6('0x1f'))][(_0xecf6('0x20'))]({'level':_0xecf6('0x21'),'json':![],'formatter':function(_0x2a5616){return fileFormat(_0x135b2e,_0x2a5616);}})]});return _0x451ccc;}exports[_0xecf6('0x26')]=consoleLogger;exports[_0xecf6('0x27')]=fileLogger; \ No newline at end of file +var _0x0013=['keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','util','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta'];(function(_0x28bc73,_0x5f29c1){var _0x593d7c=function(_0x1e0896){while(--_0x1e0896){_0x28bc73['push'](_0x28bc73['shift']());}};_0x593d7c(++_0x5f29c1);}(_0x0013,0x1bc));var _0x3001=function(_0xc28b0b,_0x1b6a20){_0xc28b0b=_0xc28b0b-0x0;var _0xebc605=_0x0013[_0xc28b0b];return _0xebc605;};'use strict';var path=require('path');var util=require(_0x3001('0x0'));var moment=require('moment');var winston=require(_0x3001('0x1'));var config=require(_0x3001('0x2'));var debugLevel=config[_0x3001('0x3')]?config[_0x3001('0x3')][_0x3001('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x3001('0x5'),'error':'red','warn':'bold\x20yellow','info':'white','print':_0x3001('0x6'),'success':_0x3001('0x7'),'http':'gray','verbose':_0x3001('0x8'),'debug':_0x3001('0x9'),'silly':'bold\x20cyan'};winston[_0x3001('0xa')](XC_LOG_COLORS);function getLogFileName(_0x5c1bc7,_0x4b50a6,_0x37441b){var _0x976848=_0x5c1bc7||_0x3001('0xb');return path[_0x3001('0xc')](_0x976848,util[_0x3001('0xd')](_0x3001('0xe'),_0x4b50a6,_0x37441b));}function formatter(_0x528638,_0x1d8e91){_0x1d8e91[_0x3001('0xf')]=_0x1d8e91[_0x3001('0xf')][_0x3001('0x10')](/@@{/g,_0x3001('0x11'))[_0x3001('0x10')](/}@@/g,_0x3001('0x12'))[_0x3001('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x3001('0xd')](_0x3001('0x13'),moment()['format'](_0x3001('0x14')),_0x1d8e91[_0x3001('0x15')][_0x3001('0x16')](),_0x528638,_0x1d8e91['message']);}function fileFormat(_0x2ab410,_0xa0ae5e){_0xa0ae5e[_0x3001('0xf')]=_0xa0ae5e['message'][_0x3001('0x10')](/@@{/g,_0x3001('0x11'))[_0x3001('0x10')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x3001('0x10')](/}@/g,'}}');var _0x1a60f2=_0xa0ae5e[_0x3001('0x17')]&&Object[_0x3001('0x18')](_0xa0ae5e[_0x3001('0x17')])[_0x3001('0x19')]?'\x0a\x09'+JSON[_0x3001('0x1a')](_0xa0ae5e[_0x3001('0x17')]):'';return util[_0x3001('0xd')](_0x3001('0x1b'),moment()[_0x3001('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0xa0ae5e[_0x3001('0x15')][_0x3001('0x16')](),_0x2ab410,_0xa0ae5e[_0x3001('0xf')],_0x1a60f2);}function consoleLogger(){var _0x4addff=new winston[(_0x3001('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3001('0x1d'))][(_0x3001('0x1e'))]({'level':_0x3001('0x1f'),'json':![],'formatter':function(_0x147e04){return formatter('',_0x147e04);}})]});return _0x4addff;}function fileLogger(_0x27ed5a,_0x5a3235){var _0x144354=new winston[(_0x3001('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3001('0x1d'))][(_0x3001('0x20'))]({'name':util[_0x3001('0xd')](_0x3001('0x21'),_0x27ed5a,_0x3001('0x22')),'filename':getLogFileName(_0x5a3235,_0x27ed5a,'error'),'level':_0x3001('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x8e0c04){return fileFormat(_0x27ed5a,_0x8e0c04);}}),new winston[(_0x3001('0x1d'))][(_0x3001('0x20'))]({'name':util['format'](_0x3001('0x21'),_0x27ed5a,debugLevel),'filename':getLogFileName(_0x5a3235,_0x27ed5a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x249bef){return fileFormat(_0x27ed5a,_0x249bef);}}),new winston['transports'][(_0x3001('0x1e'))]({'level':_0x3001('0x1f'),'json':![],'formatter':function(_0x4bd74f){return fileFormat(_0x27ed5a,_0x4bd74f);}})]});return _0x144354;}exports['consoleLogger']=consoleLogger;exports[_0x3001('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 685d707..a3bb6e7 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x4975,0x86));var _0x5497=function(_0x5aaaaf,_0x776991){_0x5aaaaf=_0x5aaaaf-0x0;var _0x2f00b8=_0x4975[_0x5aaaaf];return _0x2f00b8;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x1cfe07,_0x3a95bf){var _0x4364fa=function(_0x15c82f){while(--_0x15c82f){_0x1cfe07['push'](_0x1cfe07['shift']());}};_0x4364fa(++_0x3a95bf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 23987ca..645552c 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x56e4aa,_0x365836){var _0x1c619c=function(_0x39c185){while(--_0x39c185){_0x56e4aa['push'](_0x56e4aa['shift']());}};_0x1c619c(++_0x365836);}(_0x8603,0x190));var _0x3860=function(_0x4e938e,_0x37dba9){_0x4e938e=_0x4e938e-0x0;var _0x47aacf=_0x8603[_0x4e938e];return _0x47aacf;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0xaae5cc,_0x46d786){var _0x236171=function(_0x14a33c){while(--_0x14a33c){_0xaae5cc['push'](_0xaae5cc['shift']());}};_0x236171(++_0x46d786);}(_0xda3f,0xec));var _0xfda3=function(_0x356fe9,_0x4d146d){_0x356fe9=_0x356fe9-0x0;var _0x36c5d4=_0xda3f[_0x356fe9];return _0x36c5d4;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file